aptechka 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierignore +16 -0
- package/.prettierrc +9 -0
- package/.vscode/extensions.json +4 -0
- package/.vscode/launch.json +11 -0
- package/.vscode/settings.json +18 -0
- package/README.md +0 -0
- package/index.html +32 -0
- package/package.json +272 -0
- package/public/vite.svg +1 -0
- package/src/packages/animation/Animated.ts +189 -0
- package/src/packages/animation/Damped.ts +39 -0
- package/src/packages/animation/Tweened.ts +51 -0
- package/src/packages/animation/index.ts +10 -0
- package/src/packages/attribute/index.ts +59 -0
- package/src/packages/canvas-2d/index.ts +137 -0
- package/src/packages/controls/Controls.ts +15 -0
- package/src/packages/controls/KeyboardControls.ts +63 -0
- package/src/packages/controls/LinearControls.ts +27 -0
- package/src/packages/controls/User.ts +20 -0
- package/src/packages/controls/WheelControls.ts +92 -0
- package/src/packages/controls/index.ts +5 -0
- package/src/packages/css-unit-parser/index.ts +32 -0
- package/src/packages/custom-element/index.ts +19 -0
- package/src/packages/device/Device.ts +113 -0
- package/src/packages/device/Viewport.ts +67 -0
- package/src/packages/device/index.ts +2 -0
- package/src/packages/element-constructor/ElementConstructor.ts +577 -0
- package/src/packages/element-constructor/htmlTags.ts +679 -0
- package/src/packages/element-constructor/index.ts +4 -0
- package/src/packages/element-constructor/specialObjects.ts +8 -0
- package/src/packages/element-constructor/svgTags.ts +588 -0
- package/src/packages/en3/attachments/En3SourceManager.ts +116 -0
- package/src/packages/en3/core/en3.ts +306 -0
- package/src/packages/en3/index.ts +52 -0
- package/src/packages/en3/instances/en3LazyLoader.ts +22 -0
- package/src/packages/en3/libs/MeshoptDecoder.js +138 -0
- package/src/packages/en3/loaders/en3GLTFLoader.ts +54 -0
- package/src/packages/en3/loaders/en3TextureLoader.ts +3 -0
- package/src/packages/en3/objects/En3Clip.ts +53 -0
- package/src/packages/en3/objects/En3ClipHelpers.ts +12 -0
- package/src/packages/en3/objects/En3GLTF.ts +35 -0
- package/src/packages/en3/objects/En3Image.ts +18 -0
- package/src/packages/en3/objects/En3ImageLike.ts +101 -0
- package/src/packages/en3/objects/En3SourceConsumer.ts +5 -0
- package/src/packages/en3/objects/En3Video.ts +88 -0
- package/src/packages/en3/test/En3HTML.ts +55 -0
- package/src/packages/en3/test/En3ModifiedMaterial.ts +221 -0
- package/src/packages/en3/test/En3Raycaster.ts +187 -0
- package/src/packages/en3/utils/coverTexture.ts +29 -0
- package/src/packages/en3/utils/dispose.ts +27 -0
- package/src/packages/en3/utils/traverseMaterials.ts +10 -0
- package/src/packages/en3/utils/traverseMeshes.ts +9 -0
- package/src/packages/image/index.ts +19 -0
- package/src/packages/intersector/index.ts +83 -0
- package/src/packages/ladder/index.ts +112 -0
- package/src/packages/layout-box/index.ts +417 -0
- package/src/packages/loading/index.ts +131 -0
- package/src/packages/measurer/CumulativeOffsetLeft.ts +8 -0
- package/src/packages/measurer/CumulativeOffsetTop.ts +8 -0
- package/src/packages/measurer/Meaurer.ts +38 -0
- package/src/packages/measurer/index.ts +3 -0
- package/src/packages/media/index.ts +38 -0
- package/src/packages/morph/Link.ts +32 -0
- package/src/packages/morph/Morph.ts +246 -0
- package/src/packages/morph/index.ts +10 -0
- package/src/packages/notifier/index.ts +41 -0
- package/src/packages/order/index.ts +14 -0
- package/src/packages/resizer/index.ts +55 -0
- package/src/packages/router/Link.ts +33 -0
- package/src/packages/router/Route.ts +152 -0
- package/src/packages/router/RouteElement.ts +34 -0
- package/src/packages/router/Router.ts +190 -0
- package/src/packages/router/index.ts +13 -0
- package/src/packages/scroll/ScrollElement.ts +618 -0
- package/src/packages/scroll/ScrollUserElement.ts +21 -0
- package/src/packages/scroll/ScrollbarElement.ts +170 -0
- package/src/packages/scroll/index.ts +2 -0
- package/src/packages/scroll-entries/index.ts +74 -0
- package/src/packages/source/SourceClass.ts +77 -0
- package/src/packages/source/SourceElement.ts +177 -0
- package/src/packages/source/SourceManager.ts +61 -0
- package/src/packages/source/SourceSet.ts +52 -0
- package/src/packages/source/index.ts +8 -0
- package/src/packages/store/Composed.ts +33 -0
- package/src/packages/store/Derived.ts +24 -0
- package/src/packages/store/DerivedArray.ts +36 -0
- package/src/packages/store/Resource.ts +38 -0
- package/src/packages/store/Store.ts +144 -0
- package/src/packages/store/StoreRegistry.ts +105 -0
- package/src/packages/store/index.ts +23 -0
- package/src/packages/ticker/index.ts +173 -0
- package/src/packages/utils/array.ts +3 -0
- package/src/packages/utils/attributes.ts +19 -0
- package/src/packages/utils/browser.ts +2 -0
- package/src/packages/utils/canvas.ts +46 -0
- package/src/packages/utils/collisions.ts +12 -0
- package/src/packages/utils/coordinates.ts +40 -0
- package/src/packages/utils/decoding.ts +11 -0
- package/src/packages/utils/dev.ts +5 -0
- package/src/packages/utils/dom.ts +48 -0
- package/src/packages/utils/easings.ts +69 -0
- package/src/packages/utils/file.ts +17 -0
- package/src/packages/utils/function.ts +29 -0
- package/src/packages/utils/index.ts +61 -0
- package/src/packages/utils/layout.ts +22 -0
- package/src/packages/utils/math.ts +74 -0
- package/src/packages/utils/number.ts +26 -0
- package/src/packages/utils/object.ts +108 -0
- package/src/packages/utils/string.ts +49 -0
- package/src/packages/utils/ts-shape.ts +25 -0
- package/src/packages/utils/ts-utility.ts +47 -0
- package/src/packages/video/index.ts +39 -0
- package/src/playground/index.ts +0 -0
- package/tsconfig.json +31 -0
- package/vite.config.ts +65 -0
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
import { ElementConstructorTagObject, ElementConstructor } from './ElementConstructor'
|
|
2
|
+
|
|
3
|
+
export function svgA(object?: Omit<ElementConstructorTagObject<'a'>, 'svg'>) {
|
|
4
|
+
return new ElementConstructor({
|
|
5
|
+
a: {
|
|
6
|
+
...object,
|
|
7
|
+
svg: true,
|
|
8
|
+
},
|
|
9
|
+
})
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function animate(object?: Omit<ElementConstructorTagObject<'animate'>, 'svg'>) {
|
|
13
|
+
return new ElementConstructor({
|
|
14
|
+
animate: {
|
|
15
|
+
...object,
|
|
16
|
+
svg: true,
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function animateMotion(object?: Omit<ElementConstructorTagObject<'animateMotion'>, 'svg'>) {
|
|
22
|
+
return new ElementConstructor({
|
|
23
|
+
animateMotion: {
|
|
24
|
+
...object,
|
|
25
|
+
svg: true,
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function animateTransform(
|
|
31
|
+
object?: Omit<ElementConstructorTagObject<'animateTransform'>, 'svg'>
|
|
32
|
+
) {
|
|
33
|
+
return new ElementConstructor({
|
|
34
|
+
animateTransform: {
|
|
35
|
+
...object,
|
|
36
|
+
svg: true,
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function circle(object?: Omit<ElementConstructorTagObject<'circle'>, 'svg'>) {
|
|
42
|
+
return new ElementConstructor({
|
|
43
|
+
circle: {
|
|
44
|
+
...object,
|
|
45
|
+
svg: true,
|
|
46
|
+
},
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function clipPath(object?: Omit<ElementConstructorTagObject<'clipPath'>, 'svg'>) {
|
|
51
|
+
return new ElementConstructor({
|
|
52
|
+
clipPath: {
|
|
53
|
+
...object,
|
|
54
|
+
svg: true,
|
|
55
|
+
},
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function defs(object?: Omit<ElementConstructorTagObject<'defs'>, 'svg'>) {
|
|
60
|
+
return new ElementConstructor({
|
|
61
|
+
defs: {
|
|
62
|
+
...object,
|
|
63
|
+
svg: true,
|
|
64
|
+
},
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function desc(object?: Omit<ElementConstructorTagObject<'desc'>, 'svg'>) {
|
|
69
|
+
return new ElementConstructor({
|
|
70
|
+
desc: {
|
|
71
|
+
...object,
|
|
72
|
+
svg: true,
|
|
73
|
+
},
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function ellipse(object?: Omit<ElementConstructorTagObject<'ellipse'>, 'svg'>) {
|
|
78
|
+
return new ElementConstructor({
|
|
79
|
+
ellipse: {
|
|
80
|
+
...object,
|
|
81
|
+
svg: true,
|
|
82
|
+
},
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function feBlend(object?: Omit<ElementConstructorTagObject<'feBlend'>, 'svg'>) {
|
|
87
|
+
return new ElementConstructor({
|
|
88
|
+
feBlend: {
|
|
89
|
+
...object,
|
|
90
|
+
svg: true,
|
|
91
|
+
},
|
|
92
|
+
})
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function feColorMatrix(object?: Omit<ElementConstructorTagObject<'feColorMatrix'>, 'svg'>) {
|
|
96
|
+
return new ElementConstructor({
|
|
97
|
+
feColorMatrix: {
|
|
98
|
+
...object,
|
|
99
|
+
svg: true,
|
|
100
|
+
},
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function feComponentTransfer(
|
|
105
|
+
object?: Omit<ElementConstructorTagObject<'feComponentTransfer'>, 'svg'>
|
|
106
|
+
) {
|
|
107
|
+
return new ElementConstructor({
|
|
108
|
+
feComponentTransfer: {
|
|
109
|
+
...object,
|
|
110
|
+
svg: true,
|
|
111
|
+
},
|
|
112
|
+
})
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export function feComposite(object?: Omit<ElementConstructorTagObject<'feComposite'>, 'svg'>) {
|
|
116
|
+
return new ElementConstructor({
|
|
117
|
+
feComposite: {
|
|
118
|
+
...object,
|
|
119
|
+
svg: true,
|
|
120
|
+
},
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function feConvolveMatrix(
|
|
125
|
+
object?: Omit<ElementConstructorTagObject<'feConvolveMatrix'>, 'svg'>
|
|
126
|
+
) {
|
|
127
|
+
return new ElementConstructor({
|
|
128
|
+
feConvolveMatrix: {
|
|
129
|
+
...object,
|
|
130
|
+
svg: true,
|
|
131
|
+
},
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function feDiffuseLighting(
|
|
136
|
+
object?: Omit<ElementConstructorTagObject<'feDiffuseLighting'>, 'svg'>
|
|
137
|
+
) {
|
|
138
|
+
return new ElementConstructor({
|
|
139
|
+
feDiffuseLighting: {
|
|
140
|
+
...object,
|
|
141
|
+
svg: true,
|
|
142
|
+
},
|
|
143
|
+
})
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export function feDisplacementMap(
|
|
147
|
+
object?: Omit<ElementConstructorTagObject<'feDisplacementMap'>, 'svg'>
|
|
148
|
+
) {
|
|
149
|
+
return new ElementConstructor({
|
|
150
|
+
feDisplacementMap: {
|
|
151
|
+
...object,
|
|
152
|
+
svg: true,
|
|
153
|
+
},
|
|
154
|
+
})
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export function feDistantLight(
|
|
158
|
+
object?: Omit<ElementConstructorTagObject<'feDistantLight'>, 'svg'>
|
|
159
|
+
) {
|
|
160
|
+
return new ElementConstructor({
|
|
161
|
+
feDistantLight: {
|
|
162
|
+
...object,
|
|
163
|
+
svg: true,
|
|
164
|
+
},
|
|
165
|
+
})
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export function feDropShadow(object?: Omit<ElementConstructorTagObject<'feDropShadow'>, 'svg'>) {
|
|
169
|
+
return new ElementConstructor({
|
|
170
|
+
feDropShadow: {
|
|
171
|
+
...object,
|
|
172
|
+
svg: true,
|
|
173
|
+
},
|
|
174
|
+
})
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export function feFlood(object?: Omit<ElementConstructorTagObject<'feFlood'>, 'svg'>) {
|
|
178
|
+
return new ElementConstructor({
|
|
179
|
+
feFlood: {
|
|
180
|
+
...object,
|
|
181
|
+
svg: true,
|
|
182
|
+
},
|
|
183
|
+
})
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export function feFuncA(object?: Omit<ElementConstructorTagObject<'feFuncA'>, 'svg'>) {
|
|
187
|
+
return new ElementConstructor({
|
|
188
|
+
feFuncA: {
|
|
189
|
+
...object,
|
|
190
|
+
svg: true,
|
|
191
|
+
},
|
|
192
|
+
})
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export function feFuncB(object?: Omit<ElementConstructorTagObject<'feFuncB'>, 'svg'>) {
|
|
196
|
+
return new ElementConstructor({
|
|
197
|
+
feFuncB: {
|
|
198
|
+
...object,
|
|
199
|
+
svg: true,
|
|
200
|
+
},
|
|
201
|
+
})
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export function feFuncG(object?: Omit<ElementConstructorTagObject<'feFuncG'>, 'svg'>) {
|
|
205
|
+
return new ElementConstructor({
|
|
206
|
+
feFuncG: {
|
|
207
|
+
...object,
|
|
208
|
+
svg: true,
|
|
209
|
+
},
|
|
210
|
+
})
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export function feFuncR(object?: Omit<ElementConstructorTagObject<'feFuncR'>, 'svg'>) {
|
|
214
|
+
return new ElementConstructor({
|
|
215
|
+
feFuncR: {
|
|
216
|
+
...object,
|
|
217
|
+
svg: true,
|
|
218
|
+
},
|
|
219
|
+
})
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export function feGaussianBlur(
|
|
223
|
+
object?: Omit<ElementConstructorTagObject<'feGaussianBlur'>, 'svg'>
|
|
224
|
+
) {
|
|
225
|
+
return new ElementConstructor({
|
|
226
|
+
feGaussianBlur: {
|
|
227
|
+
...object,
|
|
228
|
+
svg: true,
|
|
229
|
+
},
|
|
230
|
+
})
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export function feImage(object?: Omit<ElementConstructorTagObject<'feImage'>, 'svg'>) {
|
|
234
|
+
return new ElementConstructor({
|
|
235
|
+
feImage: {
|
|
236
|
+
...object,
|
|
237
|
+
svg: true,
|
|
238
|
+
},
|
|
239
|
+
})
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export function feMerge(object?: Omit<ElementConstructorTagObject<'feMerge'>, 'svg'>) {
|
|
243
|
+
return new ElementConstructor({
|
|
244
|
+
feMerge: {
|
|
245
|
+
...object,
|
|
246
|
+
svg: true,
|
|
247
|
+
},
|
|
248
|
+
})
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export function feMergeNode(object?: Omit<ElementConstructorTagObject<'feMergeNode'>, 'svg'>) {
|
|
252
|
+
return new ElementConstructor({
|
|
253
|
+
feMergeNode: {
|
|
254
|
+
...object,
|
|
255
|
+
svg: true,
|
|
256
|
+
},
|
|
257
|
+
})
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export function feMorphology(object?: Omit<ElementConstructorTagObject<'feMorphology'>, 'svg'>) {
|
|
261
|
+
return new ElementConstructor({
|
|
262
|
+
feMorphology: {
|
|
263
|
+
...object,
|
|
264
|
+
svg: true,
|
|
265
|
+
},
|
|
266
|
+
})
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export function feOffset(object?: Omit<ElementConstructorTagObject<'feOffset'>, 'svg'>) {
|
|
270
|
+
return new ElementConstructor({
|
|
271
|
+
feOffset: {
|
|
272
|
+
...object,
|
|
273
|
+
svg: true,
|
|
274
|
+
},
|
|
275
|
+
})
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export function fePointLight(object?: Omit<ElementConstructorTagObject<'fePointLight'>, 'svg'>) {
|
|
279
|
+
return new ElementConstructor({
|
|
280
|
+
fePointLight: {
|
|
281
|
+
...object,
|
|
282
|
+
svg: true,
|
|
283
|
+
},
|
|
284
|
+
})
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export function feSpecularLighting(
|
|
288
|
+
object?: Omit<ElementConstructorTagObject<'feSpecularLighting'>, 'svg'>
|
|
289
|
+
) {
|
|
290
|
+
return new ElementConstructor({
|
|
291
|
+
feSpecularLighting: {
|
|
292
|
+
...object,
|
|
293
|
+
svg: true,
|
|
294
|
+
},
|
|
295
|
+
})
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export function feSpotLight(object?: Omit<ElementConstructorTagObject<'feSpotLight'>, 'svg'>) {
|
|
299
|
+
return new ElementConstructor({
|
|
300
|
+
feSpotLight: {
|
|
301
|
+
...object,
|
|
302
|
+
svg: true,
|
|
303
|
+
},
|
|
304
|
+
})
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
export function feTile(object?: Omit<ElementConstructorTagObject<'feTile'>, 'svg'>) {
|
|
308
|
+
return new ElementConstructor({
|
|
309
|
+
feTile: {
|
|
310
|
+
...object,
|
|
311
|
+
svg: true,
|
|
312
|
+
},
|
|
313
|
+
})
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
export function feTurbulence(object?: Omit<ElementConstructorTagObject<'feTurbulence'>, 'svg'>) {
|
|
317
|
+
return new ElementConstructor({
|
|
318
|
+
feTurbulence: {
|
|
319
|
+
...object,
|
|
320
|
+
svg: true,
|
|
321
|
+
},
|
|
322
|
+
})
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export function filter(object?: Omit<ElementConstructorTagObject<'filter'>, 'svg'>) {
|
|
326
|
+
return new ElementConstructor({
|
|
327
|
+
filter: {
|
|
328
|
+
...object,
|
|
329
|
+
svg: true,
|
|
330
|
+
},
|
|
331
|
+
})
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export function foreignObject(object?: Omit<ElementConstructorTagObject<'foreignObject'>, 'svg'>) {
|
|
335
|
+
return new ElementConstructor({
|
|
336
|
+
foreignObject: {
|
|
337
|
+
...object,
|
|
338
|
+
svg: true,
|
|
339
|
+
},
|
|
340
|
+
})
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export function g(object?: Omit<ElementConstructorTagObject<'g'>, 'svg'>) {
|
|
344
|
+
return new ElementConstructor({
|
|
345
|
+
g: {
|
|
346
|
+
...object,
|
|
347
|
+
svg: true,
|
|
348
|
+
},
|
|
349
|
+
})
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
export function image(object?: Omit<ElementConstructorTagObject<'image'>, 'svg'>) {
|
|
353
|
+
return new ElementConstructor({
|
|
354
|
+
image: {
|
|
355
|
+
...object,
|
|
356
|
+
svg: true,
|
|
357
|
+
},
|
|
358
|
+
})
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export function line(object?: Omit<ElementConstructorTagObject<'line'>, 'svg'>) {
|
|
362
|
+
return new ElementConstructor({
|
|
363
|
+
line: {
|
|
364
|
+
...object,
|
|
365
|
+
svg: true,
|
|
366
|
+
},
|
|
367
|
+
})
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export function linearGradient(
|
|
371
|
+
object?: Omit<ElementConstructorTagObject<'linearGradient'>, 'svg'>
|
|
372
|
+
) {
|
|
373
|
+
return new ElementConstructor({
|
|
374
|
+
linearGradient: {
|
|
375
|
+
...object,
|
|
376
|
+
svg: true,
|
|
377
|
+
},
|
|
378
|
+
})
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
export function marker(object?: Omit<ElementConstructorTagObject<'marker'>, 'svg'>) {
|
|
382
|
+
return new ElementConstructor({
|
|
383
|
+
marker: {
|
|
384
|
+
...object,
|
|
385
|
+
svg: true,
|
|
386
|
+
},
|
|
387
|
+
})
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
export function mask(object?: Omit<ElementConstructorTagObject<'mask'>, 'svg'>) {
|
|
391
|
+
return new ElementConstructor({
|
|
392
|
+
mask: {
|
|
393
|
+
...object,
|
|
394
|
+
svg: true,
|
|
395
|
+
},
|
|
396
|
+
})
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
export function metadata(object?: Omit<ElementConstructorTagObject<'metadata'>, 'svg'>) {
|
|
400
|
+
return new ElementConstructor({
|
|
401
|
+
metadata: {
|
|
402
|
+
...object,
|
|
403
|
+
svg: true,
|
|
404
|
+
},
|
|
405
|
+
})
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
export function mpath(object?: Omit<ElementConstructorTagObject<'mpath'>, 'svg'>) {
|
|
409
|
+
return new ElementConstructor({
|
|
410
|
+
mpath: {
|
|
411
|
+
...object,
|
|
412
|
+
svg: true,
|
|
413
|
+
},
|
|
414
|
+
})
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
export function path(object?: Omit<ElementConstructorTagObject<'path'>, 'svg'>) {
|
|
418
|
+
return new ElementConstructor({
|
|
419
|
+
path: {
|
|
420
|
+
...object,
|
|
421
|
+
svg: true,
|
|
422
|
+
},
|
|
423
|
+
})
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
export function pattern(object?: Omit<ElementConstructorTagObject<'pattern'>, 'svg'>) {
|
|
427
|
+
return new ElementConstructor({
|
|
428
|
+
pattern: {
|
|
429
|
+
...object,
|
|
430
|
+
svg: true,
|
|
431
|
+
},
|
|
432
|
+
})
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
export function polygon(object?: Omit<ElementConstructorTagObject<'polygon'>, 'svg'>) {
|
|
436
|
+
return new ElementConstructor({
|
|
437
|
+
polygon: {
|
|
438
|
+
...object,
|
|
439
|
+
svg: true,
|
|
440
|
+
},
|
|
441
|
+
})
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
export function polyline(object?: Omit<ElementConstructorTagObject<'polyline'>, 'svg'>) {
|
|
445
|
+
return new ElementConstructor({
|
|
446
|
+
polyline: {
|
|
447
|
+
...object,
|
|
448
|
+
svg: true,
|
|
449
|
+
},
|
|
450
|
+
})
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
export function radialGradient(
|
|
454
|
+
object?: Omit<ElementConstructorTagObject<'radialGradient'>, 'svg'>
|
|
455
|
+
) {
|
|
456
|
+
return new ElementConstructor({
|
|
457
|
+
radialGradient: {
|
|
458
|
+
...object,
|
|
459
|
+
svg: true,
|
|
460
|
+
},
|
|
461
|
+
})
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
export function rect(object?: Omit<ElementConstructorTagObject<'rect'>, 'svg'>) {
|
|
465
|
+
return new ElementConstructor({
|
|
466
|
+
rect: {
|
|
467
|
+
...object,
|
|
468
|
+
svg: true,
|
|
469
|
+
},
|
|
470
|
+
})
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
export function svgScript(object?: Omit<ElementConstructorTagObject<'script'>, 'svg'>) {
|
|
474
|
+
return new ElementConstructor({
|
|
475
|
+
script: {
|
|
476
|
+
...object,
|
|
477
|
+
svg: true,
|
|
478
|
+
},
|
|
479
|
+
})
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
export function set(object?: Omit<ElementConstructorTagObject<'set'>, 'svg'>) {
|
|
483
|
+
return new ElementConstructor({
|
|
484
|
+
set: {
|
|
485
|
+
...object,
|
|
486
|
+
svg: true,
|
|
487
|
+
},
|
|
488
|
+
})
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
export function stop(object?: Omit<ElementConstructorTagObject<'stop'>, 'svg'>) {
|
|
492
|
+
return new ElementConstructor({
|
|
493
|
+
stop: {
|
|
494
|
+
...object,
|
|
495
|
+
svg: true,
|
|
496
|
+
},
|
|
497
|
+
})
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
export function svgStyle(object?: Omit<ElementConstructorTagObject<'style'>, 'svg'>) {
|
|
501
|
+
return new ElementConstructor({
|
|
502
|
+
style: {
|
|
503
|
+
...object,
|
|
504
|
+
svg: true,
|
|
505
|
+
},
|
|
506
|
+
})
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
export function svg(object?: Omit<ElementConstructorTagObject<'svg'>, 'svg'>) {
|
|
510
|
+
return new ElementConstructor({
|
|
511
|
+
svg: {
|
|
512
|
+
...object,
|
|
513
|
+
svg: true,
|
|
514
|
+
},
|
|
515
|
+
})
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
export function svgSwitch(object?: Omit<ElementConstructorTagObject<'switch'>, 'svg'>) {
|
|
519
|
+
return new ElementConstructor({
|
|
520
|
+
switch: {
|
|
521
|
+
...object,
|
|
522
|
+
svg: true,
|
|
523
|
+
},
|
|
524
|
+
})
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
export function symbol(object?: Omit<ElementConstructorTagObject<'symbol'>, 'svg'>) {
|
|
528
|
+
return new ElementConstructor({
|
|
529
|
+
symbol: {
|
|
530
|
+
...object,
|
|
531
|
+
svg: true,
|
|
532
|
+
},
|
|
533
|
+
})
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
export function text(object?: Omit<ElementConstructorTagObject<'text'>, 'svg'>) {
|
|
537
|
+
return new ElementConstructor({
|
|
538
|
+
text: {
|
|
539
|
+
...object,
|
|
540
|
+
svg: true,
|
|
541
|
+
},
|
|
542
|
+
})
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
export function textPath(object?: Omit<ElementConstructorTagObject<'textPath'>, 'svg'>) {
|
|
546
|
+
return new ElementConstructor({
|
|
547
|
+
textPath: {
|
|
548
|
+
...object,
|
|
549
|
+
svg: true,
|
|
550
|
+
},
|
|
551
|
+
})
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
export function svgTitle(object?: Omit<ElementConstructorTagObject<'title'>, 'svg'>) {
|
|
555
|
+
return new ElementConstructor({
|
|
556
|
+
title: {
|
|
557
|
+
...object,
|
|
558
|
+
svg: true,
|
|
559
|
+
},
|
|
560
|
+
})
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
export function tspan(object?: Omit<ElementConstructorTagObject<'tspan'>, 'svg'>) {
|
|
564
|
+
return new ElementConstructor({
|
|
565
|
+
tspan: {
|
|
566
|
+
...object,
|
|
567
|
+
svg: true,
|
|
568
|
+
},
|
|
569
|
+
})
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
export function use(object?: Omit<ElementConstructorTagObject<'use'>, 'svg'>) {
|
|
573
|
+
return new ElementConstructor({
|
|
574
|
+
use: {
|
|
575
|
+
...object,
|
|
576
|
+
svg: true,
|
|
577
|
+
},
|
|
578
|
+
})
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
export function view(object?: Omit<ElementConstructorTagObject<'view'>, 'svg'>) {
|
|
582
|
+
return new ElementConstructor({
|
|
583
|
+
view: {
|
|
584
|
+
...object,
|
|
585
|
+
svg: true,
|
|
586
|
+
},
|
|
587
|
+
})
|
|
588
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { loading } from '$packages/loading'
|
|
2
|
+
import { SourceManagerParameters, SourceManager } from '$packages/source'
|
|
3
|
+
import { Store } from '$packages/store'
|
|
4
|
+
import { EventDispatcher, Loader } from 'three'
|
|
5
|
+
|
|
6
|
+
export interface En3SourceManagerLoader<T> {
|
|
7
|
+
load: Loader<T>['load']
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface En3SourceManagerFullParameters<T> extends SourceManagerParameters {
|
|
11
|
+
keepSourceParameters?: boolean
|
|
12
|
+
loader: En3SourceManagerLoader<T>
|
|
13
|
+
lazy?: boolean
|
|
14
|
+
consumer: EventDispatcher
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type En3SourceManagerParameters<T> = Omit<
|
|
18
|
+
En3SourceManagerFullParameters<T>,
|
|
19
|
+
'loader' | 'element' | 'consumer'
|
|
20
|
+
>
|
|
21
|
+
|
|
22
|
+
export type En3SourceManagerLoadingState = 'start' | 'complete' | 'error' | undefined
|
|
23
|
+
|
|
24
|
+
export class En3SourceManager<T> extends SourceManager {
|
|
25
|
+
#data = new Store<T | undefined | null>(null)
|
|
26
|
+
#loading = new Store<En3SourceManagerLoadingState>(undefined)
|
|
27
|
+
#consumer: EventDispatcher
|
|
28
|
+
#loader: En3SourceManagerLoader<T>
|
|
29
|
+
#isKeepSourceParameters: boolean
|
|
30
|
+
#isLazy: boolean
|
|
31
|
+
#isLazyLoaded = false
|
|
32
|
+
|
|
33
|
+
constructor(parameters: En3SourceManagerFullParameters<T>) {
|
|
34
|
+
super(parameters)
|
|
35
|
+
|
|
36
|
+
this.#consumer = parameters.consumer
|
|
37
|
+
this.#loader = parameters.loader
|
|
38
|
+
this.#isKeepSourceParameters = parameters.keepSourceParameters || false
|
|
39
|
+
this.#isLazy = parameters.lazy || false
|
|
40
|
+
|
|
41
|
+
this.subscribe(this.#updateData)
|
|
42
|
+
|
|
43
|
+
this.#consumer.addEventListener('added', () => {
|
|
44
|
+
this.connect()
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
this.#consumer.addEventListener('removed', () => {
|
|
48
|
+
this.disconnect()
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Resource store.
|
|
54
|
+
*/
|
|
55
|
+
public get data() {
|
|
56
|
+
return this.#data
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Loading store.
|
|
61
|
+
*/
|
|
62
|
+
public get loading() {
|
|
63
|
+
return this.#loading
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Calling this method will start loading the resource.
|
|
68
|
+
*/
|
|
69
|
+
public lazyLoad() {
|
|
70
|
+
if (!this.#isLazyLoaded) {
|
|
71
|
+
this.#isLazyLoaded = true
|
|
72
|
+
this.#updateData()
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
#updateData = () => {
|
|
77
|
+
if (this.#isLazy && !this.#isLazyLoaded) {
|
|
78
|
+
return
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (this.current !== this.previous) {
|
|
82
|
+
this.#data.current = null
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (this.current) {
|
|
86
|
+
const url = this.#isKeepSourceParameters
|
|
87
|
+
? this.current.url
|
|
88
|
+
: this.current.name + this.current.extension
|
|
89
|
+
|
|
90
|
+
if (!this.#isLazy) {
|
|
91
|
+
loading.setTotal(url, 1)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
this.#loading.current = 'start'
|
|
95
|
+
|
|
96
|
+
this.#loader.load(
|
|
97
|
+
url,
|
|
98
|
+
(data) => {
|
|
99
|
+
this.#data.current = data
|
|
100
|
+
this.#loading.current = 'complete'
|
|
101
|
+
|
|
102
|
+
if (!this.#isLazy) {
|
|
103
|
+
loading.setLoaded(url, 1)
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
undefined,
|
|
107
|
+
() => {
|
|
108
|
+
if (!this.#isLazy) {
|
|
109
|
+
this.#loading.current = 'error'
|
|
110
|
+
loading.setError(url, url)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|