Skip to content

Commit 90ad3b4

Browse files
committed
chore(playground): add some instances
1 parent c3de12e commit 90ad3b4

File tree

2 files changed

+112
-1
lines changed

2 files changed

+112
-1
lines changed

playground/src/config/instance.ts

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1+
import ins01 from '../instances/instance/ins01.sciux?raw'
2+
import ins02 from '../instances/instance/ins02.sciux?raw'
13
import angle from '../instances/math/angle.sciux?raw'
4+
import axis from '../instances/math/axis.sciux?raw'
5+
import circle from '../instances/math/circle.sciux?raw'
6+
import dot from '../instances/math/dot.sciux?raw'
7+
import figure from '../instances/math/figure.sciux?raw'
8+
9+
import parametric from '../instances/math/parametric.sciux?raw'
10+
import plane from '../instances/math/plane.sciux?raw'
11+
import mermaid from '../instances/mermaid.sciux?raw'
12+
13+
import model from '../instances/model.sciux?raw'
14+
import widget from '../instances/widget.sciux?raw'
215

316
export interface InstanceItem {
417
name: string
@@ -28,6 +41,90 @@ export default {
2841
description: 'Angle components',
2942
content: angle,
3043
},
44+
{
45+
name: 'Axis',
46+
id: 'axis',
47+
description: 'Axis components',
48+
content: axis,
49+
},
50+
{
51+
name: 'Circle',
52+
id: 'circle',
53+
description: 'Circle components',
54+
content: circle,
55+
},
56+
{
57+
name: 'Dot',
58+
id: 'dot',
59+
description: 'Dot components',
60+
content: dot,
61+
},
62+
{
63+
name: 'Figure',
64+
id: 'figure',
65+
description: 'Figure components',
66+
content: figure,
67+
},
68+
{
69+
name: 'Parametric',
70+
id: 'parametric',
71+
description: 'Parametric components',
72+
content: parametric,
73+
},
74+
{
75+
name: 'Plane',
76+
id: 'plane',
77+
description: 'Plane components',
78+
content: plane,
79+
},
80+
],
81+
},
82+
{
83+
name: '@sciux/widget',
84+
description: 'Widget components',
85+
children: [
86+
{
87+
name: 'Widget',
88+
id: 'widget',
89+
description: 'Widget components',
90+
content: widget,
91+
},
92+
{
93+
name: 'Mermaid',
94+
id: 'mermaid',
95+
description: 'Mermaid components',
96+
content: mermaid,
97+
},
98+
],
99+
},
100+
{
101+
name: '@sciux/model',
102+
description: 'Model components',
103+
children: [
104+
{
105+
name: 'Model',
106+
id: 'model',
107+
description: 'Model components',
108+
content: model,
109+
},
110+
],
111+
},
112+
{
113+
name: 'Instances',
114+
description: 'Instances',
115+
children: [
116+
{
117+
name: 'Ins01',
118+
id: 'ins01',
119+
description: 'Ins01 components',
120+
content: ins01,
121+
},
122+
{
123+
name: 'Ins02',
124+
id: 'ins02',
125+
description: 'Ins02 components',
126+
content: ins02,
127+
},
31128
],
32129
},
33130
],

playground/src/views/Preview.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useRoute } from 'vue-router'
44
import Sidebar from '../components/Sidebar.vue'
55
import MonacoEditor from '../components/MonacoEditor.vue'
66
import config from '../config/instance'
7-
import { activeContext, globals, reactive as sciuxReactive, render, applyTheme } from 'sciux'
7+
import { activeContext, globals, reactive as sciuxReactive, render, applyTheme, animationManager } from 'sciux'
88
import init from 'sciux'
99
1010
const route = useRoute()
@@ -134,6 +134,7 @@ onMounted(() => {
134134
init()
135135
nextTick(() => {
136136
triggerManualRender()
137+
animationManager.init()
137138
})
138139
})
139140
@@ -142,6 +143,7 @@ const handleRenderRequest = (content: string) => {
142143
if (preview.value) {
143144
preview.value.innerHTML = ''
144145
const [ast, update] = render(content, preview.value)
146+
animationManager.init()
145147
}
146148
}
147149
@@ -171,6 +173,18 @@ const safeHtml = computed(() => {
171173
return renderedHtml.value
172174
})
173175
176+
watch(animationSettings, (settings) => {
177+
console.log(settings)
178+
if (settings.autoExecute) {
179+
console.log(animationManager.getIn())
180+
animationManager.enableAutoExecute()
181+
animationManager.setAutoIn('creation', settings.duration)
182+
}
183+
else {
184+
animationManager.disableAutoExecute()
185+
}
186+
}, { deep: true, immediate: true })
187+
174188
// 预定义的动画曲线选项
175189
const animationCurves = [
176190
'ease',

0 commit comments

Comments
 (0)