@operato/scene-excel 9.1.1 → 10.0.0-beta.1

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/dist/excel.d.ts CHANGED
@@ -1,7 +1,466 @@
1
1
  import { ComponentNature, Properties, Shape } from '@hatiolab/things-scene';
2
2
  declare const Excel_base: (new (...args: any[]) => {
3
+ _convertDataFormat(data: any, format: any): any;
3
4
  isDataSource(): boolean;
4
- _convertDataFormat(data: any, format: "json" | "text" | "jsonp" | string): any;
5
+ _app: any;
6
+ _model: any;
7
+ _state: any;
8
+ _delta: any;
9
+ _animation: any;
10
+ _animate: any;
11
+ _parent: any;
12
+ _disposed: any;
13
+ _textHidden: any;
14
+ _text_substitutor: any;
15
+ _value_substitutor: any;
16
+ _mappings: any;
17
+ _realObject: import("@hatiolab/things-scene").IRealObject | undefined;
18
+ _cachedState: any;
19
+ updatedAt: any;
20
+ fontSize: any;
21
+ __cache__: any;
22
+ created(): void;
23
+ added(parent: any): void;
24
+ removed(parent: any): void;
25
+ ready(): Promise<void>;
26
+ touch(): void;
27
+ clearCache(...attrs: any[]): void;
28
+ removeSelf(completely: any): void;
29
+ resetAnimation(): void;
30
+ dispose(): void;
31
+ get nature(): import("@hatiolab/things-scene").ComponentNature;
32
+ get disposed(): boolean;
33
+ isLayer(): boolean;
34
+ isGroup(): boolean;
35
+ isContainer(): this is import("@hatiolab/things-scene/dist-types/types/component").Container;
36
+ isLine(): boolean;
37
+ isRoot(): boolean;
38
+ isRootModel(): boolean;
39
+ is3dish(): boolean;
40
+ get is3dMode(): boolean;
41
+ isIn3DSpace(): boolean;
42
+ isTemplate(): boolean;
43
+ isHTMLElement(): boolean;
44
+ isConnectable(): boolean;
45
+ isIdentifiable(): boolean;
46
+ isPositionable(): boolean;
47
+ replaceRefids(replaceMap: any): void;
48
+ get(property: any): any;
49
+ set(props: any, propval?: any): any;
50
+ getState(property: any): any;
51
+ setState(props: any, propval?: any): any;
52
+ get model(): any;
53
+ get state(): any;
54
+ get hierarchy(): any;
55
+ get volatile(): never[];
56
+ _applyProps(target: any, props: any, options: any): any;
57
+ contains(x: number, y: number): boolean;
58
+ move(offset: {
59
+ x: number;
60
+ y: number;
61
+ }, ...args: boolean[]): void;
62
+ symmetryX(x?: number): void;
63
+ symmetryY(y: number): void;
64
+ adjustResize(bounds: import("@hatiolab/things-scene").BOUNDS, origin_bounds: import("@hatiolab/things-scene").BOUNDS, diagonal: boolean): {
65
+ left: any;
66
+ top: any;
67
+ width: any;
68
+ height: any;
69
+ };
70
+ adjustRotation(rotation: number, step: boolean): number;
71
+ outline(progress: number): any;
72
+ get bounds(): import("@hatiolab/things-scene").BOUNDS;
73
+ set bounds(b: import("@hatiolab/things-scene").BOUNDS): any;
74
+ get center(): import("@hatiolab/things-scene").POINT;
75
+ set center(p: import("@hatiolab/things-scene").POINT): any;
76
+ get location(): import("@hatiolab/things-scene").POINT;
77
+ set location(l: import("@hatiolab/things-scene").POINT): any;
78
+ get rotate(): import("@hatiolab/things-scene").POINT;
79
+ set rotate(r: import("@hatiolab/things-scene").POINT): any;
80
+ get dimension(): import("@hatiolab/things-scene").DIMENSION;
81
+ set dimension(d: import("@hatiolab/things-scene").DIMENSION): any;
82
+ get path(): import("@hatiolab/things-scene").POINT[];
83
+ set path(p: import("@hatiolab/things-scene").POINT[]): any;
84
+ get drawPath(): import("@hatiolab/things-scene").POINT[];
85
+ get rotatePoint(): import("@hatiolab/things-scene").POINT;
86
+ get mutable(): boolean;
87
+ get resizable(): boolean;
88
+ get rotatable(): boolean;
89
+ buildRealObject(): import("@hatiolab/things-scene").IRealObject | undefined;
90
+ get realObject(): import("@hatiolab/things-scene").IRealObject | undefined;
91
+ draw(context?: import("@hatiolab/things-scene").SceneRenderContext): void;
92
+ prerender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
93
+ render(context: import("@hatiolab/things-scene").SceneRenderContext): void;
94
+ postrender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
95
+ prepare(resolve: (component: import("@hatiolab/things-scene").Component) => void, reject: (reason: any) => void): void;
96
+ prepareIf(condition: boolean): void;
97
+ drawText(context: import("@hatiolab/things-scene").SceneRenderContext): void;
98
+ drawStroke(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
99
+ drawFill(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
100
+ get strokeStyle(): any;
101
+ set strokeStyle(v: any): any;
102
+ get fillStyle(): any;
103
+ set fillStyle(v: any): any;
104
+ get fontColor(): string;
105
+ set fontColor(v: string): any;
106
+ get rotation(): number;
107
+ set rotation(v: number): any;
108
+ get decorators(): string[];
109
+ get decotag(): string;
110
+ get hidden(): boolean;
111
+ set hidden(v: boolean): any;
112
+ get tag(): string;
113
+ set tag(v: string): any;
114
+ get appendum(): any;
115
+ set appendum(v: any): any;
116
+ defaultTextSubstitutor(): string;
117
+ textLines(context?: import("@hatiolab/things-scene").SceneRenderContext): any[][];
118
+ get font(): string;
119
+ get lineHeight(): number;
120
+ get textSubstitutor(): () => string;
121
+ get text(): string;
122
+ set text(v: string): any;
123
+ get textBounds(): import("@hatiolab/things-scene").BOUNDS;
124
+ get textRotation(): number;
125
+ get textHidden(): boolean;
126
+ set textHidden(v: boolean): any;
127
+ get hasTextProperty(): boolean;
128
+ animate(opts: import("@hatiolab/things-scene").AnimationConfig): any;
129
+ effect(context: import("@hatiolab/things-scene").SceneRenderContext, model: any): void;
130
+ serialize(...others: any[]): string;
131
+ trim(): void;
132
+ closeScene(data: any): void;
133
+ delta(attr?: string | object, value?: any): any;
134
+ invalidate(): void;
135
+ get value(): any;
136
+ set value(v: any): any;
137
+ get data(): any;
138
+ set data(v: any): any;
139
+ set tap(v: any): any;
140
+ get mappings(): any[];
141
+ get retention(): number;
142
+ get animation(): import("@hatiolab/things-scene").AnimationController | undefined;
143
+ get started(): boolean;
144
+ set started(v: boolean): any;
145
+ get controls(): import("@hatiolab/things-scene").Control[] | undefined;
146
+ findFirst(finder: string | ((c: import("@hatiolab/things-scene").Component) => boolean), ...others: any[]): import("@hatiolab/things-scene").Component | undefined;
147
+ findAll(s: string | ((c: import("@hatiolab/things-scene").Component) => boolean), ...others: any[]): any[] | undefined;
148
+ capture(x: number, y: number, except?: (c: import("@hatiolab/things-scene").Component) => boolean): any;
149
+ findAnchor(name: string): any;
150
+ isDescendible(container: import("@hatiolab/things-scene").Component): boolean;
151
+ getContext(component?: unknown): any;
152
+ get root(): import("@hatiolab/things-scene").Component;
153
+ get rootModel(): import("@hatiolab/things-scene").Component;
154
+ get parent(): import("@hatiolab/things-scene").Component;
155
+ set parent(v: import("@hatiolab/things-scene").Component): any;
156
+ get anchors(): import("@hatiolab/things-scene").Anchor[];
157
+ get scalable(): boolean;
158
+ get stuck(): boolean;
159
+ get capturable(): boolean;
160
+ get position(): string;
161
+ get origin(): string;
162
+ get offset(): import("@hatiolab/things-scene").POINT;
163
+ get app(): import("@hatiolab/things-scene").ApplicationContext;
164
+ drawEffect(context: import("@hatiolab/things-scene").SceneRenderContext): void;
165
+ prepareFill(resolve: Function, reject: Function): void;
166
+ prepareFillIf(condition: boolean): void;
167
+ onchangeFill(after: Record<string, any>, before: Record<string, any>): void;
168
+ drawImage(context: import("@hatiolab/things-scene").SceneRenderContext, image: HTMLImageElement, left: number, top: number, width: number, height: number): void;
169
+ mutateBounds(logic: ((bounds: import("@hatiolab/things-scene").BOUNDS) => import("@hatiolab/things-scene").BOUNDS | void) | null, context?: any): void;
170
+ mutatePath(beforeLogic: ((path: import("@hatiolab/things-scene").POINT[]) => import("@hatiolab/things-scene").POINT[] | void) | null, afterLogic: ((path: import("@hatiolab/things-scene").POINT[]) => import("@hatiolab/things-scene").POINT[] | void) | null, context?: any): void;
171
+ access(accessor: string): any;
172
+ substitute(template: string, data: any): string | undefined;
173
+ onchangeMappings(after: Record<string, any>, before: Record<string, any>): void;
174
+ onchangeData(after: Record<string, any>, before: Record<string, any>): void;
175
+ buildMappings(): void;
176
+ executeMappings(force?: boolean): void;
177
+ disposeMappings(): void;
178
+ ondropfile(transfered: FileList, files: string[]): void;
179
+ transcoordS2P(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
180
+ transcoordP2S(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
181
+ transcoordS2T(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
182
+ transcoordT2P(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
183
+ transcoordT2S(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
184
+ transcoordS2TR(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
185
+ transcoordS2O(x: number, y: number, target: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
186
+ transcoordC2S(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
187
+ transcoordS2C(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
188
+ toParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
189
+ fromParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
190
+ toScene(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
191
+ fromScene(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
192
+ toLocal(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
193
+ toGlobal(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
194
+ toOther(x: number, y: number, target: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
195
+ on(name: string | object, callback: Function, context?: any): any;
196
+ off(name?: string | object, callback?: Function, context?: any): any;
197
+ once(name: string | object, callback: Function, context?: any): any;
198
+ trigger(name: string, ...args: any[]): any;
199
+ delegate_on(delegator: any): any;
200
+ delegate_off(delegator: any): any;
201
+ onchange(after: Record<string, any>, before: Record<string, any>): void;
202
+ calculateBounds?(): void;
203
+ oncreate_element?(element: HTMLElement): void;
204
+ removeComponent(component: import("@hatiolab/things-scene").Component, ghost?: boolean): void;
205
+ addComponent(component: import("@hatiolab/things-scene").Component, ghost?: boolean): void;
206
+ insertComponentAt(component: import("@hatiolab/things-scene").Component, index: number, ghost?: boolean): void;
207
+ getOverlay(component: import("@hatiolab/things-scene").Component): HTMLElement | undefined;
208
+ findById(id: string): import("@hatiolab/things-scene").Component | undefined;
209
+ findByRefid(ref: string | number): import("@hatiolab/things-scene").Component | undefined;
210
+ findAllById(id: string): import("@hatiolab/things-scene").Component[];
211
+ resize(): void;
212
+ fit(type?: string): void;
213
+ get components(): import("@hatiolab/things-scene").Component[] | undefined;
214
+ get layout(): any;
215
+ get auxOverlay(): HTMLElement | undefined;
216
+ get isReady(): boolean;
217
+ get unitScale(): number;
218
+ get selected(): import("@hatiolab/things-scene").Component[];
219
+ set selected(_v: import("@hatiolab/things-scene").Component[]): any;
220
+ get focused(): import("@hatiolab/things-scene").Component | null;
221
+ set focused(_v: import("@hatiolab/things-scene").Component | null): any;
222
+ get hasSameParentForAllSelected(): boolean;
223
+ set hasSameParentForAllSelected(_v: boolean): any;
224
+ get fitMode(): string | undefined;
225
+ set fitMode(_v: string | undefined): any;
226
+ get element(): HTMLElement | null;
227
+ set element(_v: HTMLElement | null): any;
228
+ }) & (new (...args: any[]) => {
229
+ contains(x: number, y: number): boolean;
230
+ get path(): {
231
+ x: any;
232
+ y: any;
233
+ }[];
234
+ set path(path: {
235
+ x: any;
236
+ y: any;
237
+ }[]): any;
238
+ get anchors(): {
239
+ name: string;
240
+ position: {
241
+ x: any;
242
+ y: any;
243
+ };
244
+ }[];
245
+ get bounds(): any;
246
+ set bounds(bounds: any): any;
247
+ render(ctx: CanvasRenderingContext2D): void;
248
+ _app: any;
249
+ _model: any;
250
+ _state: any;
251
+ _delta: any;
252
+ _animation: any;
253
+ _animate: any;
254
+ _parent: any;
255
+ _disposed: any;
256
+ _textHidden: any;
257
+ _text_substitutor: any;
258
+ _value_substitutor: any;
259
+ _mappings: any;
260
+ _realObject: import("@hatiolab/things-scene").IRealObject | undefined;
261
+ _cachedState: any;
262
+ updatedAt: any;
263
+ fontSize: any;
264
+ __cache__: any;
265
+ created(): void;
266
+ added(parent: any): void;
267
+ removed(parent: any): void;
268
+ ready(): Promise<void>;
269
+ touch(): void;
270
+ clearCache(...attrs: any[]): void;
271
+ removeSelf(completely: any): void;
272
+ resetAnimation(): void;
273
+ dispose(): void;
274
+ get nature(): import("@hatiolab/things-scene").ComponentNature;
275
+ get disposed(): boolean;
276
+ isLayer(): boolean;
277
+ isGroup(): boolean;
278
+ isContainer(): this is import("@hatiolab/things-scene/dist-types/types/component").Container;
279
+ isLine(): boolean;
280
+ isRoot(): boolean;
281
+ isRootModel(): boolean;
282
+ is3dish(): boolean;
283
+ get is3dMode(): boolean;
284
+ isIn3DSpace(): boolean;
285
+ isTemplate(): boolean;
286
+ isHTMLElement(): boolean;
287
+ isConnectable(): boolean;
288
+ isIdentifiable(): boolean;
289
+ isPositionable(): boolean;
290
+ replaceRefids(replaceMap: any): void;
291
+ get(property: any): any;
292
+ set(props: any, propval?: any): any;
293
+ getState(property: any): any;
294
+ setState(props: any, propval?: any): any;
295
+ get model(): any;
296
+ get state(): any;
297
+ get hierarchy(): any;
298
+ get volatile(): never[];
299
+ _applyProps(target: any, props: any, options: any): any;
300
+ move(offset: {
301
+ x: number;
302
+ y: number;
303
+ }, ...args: boolean[]): void;
304
+ symmetryX(x?: number): void;
305
+ symmetryY(y: number): void;
306
+ adjustResize(bounds: import("@hatiolab/things-scene").BOUNDS, origin_bounds: import("@hatiolab/things-scene").BOUNDS, diagonal: boolean): {
307
+ left: any;
308
+ top: any;
309
+ width: any;
310
+ height: any;
311
+ };
312
+ adjustRotation(rotation: number, step: boolean): number;
313
+ outline(progress: number): any;
314
+ get center(): import("@hatiolab/things-scene").POINT;
315
+ set center(p: import("@hatiolab/things-scene").POINT): any;
316
+ get location(): import("@hatiolab/things-scene").POINT;
317
+ set location(l: import("@hatiolab/things-scene").POINT): any;
318
+ get rotate(): import("@hatiolab/things-scene").POINT;
319
+ set rotate(r: import("@hatiolab/things-scene").POINT): any;
320
+ get dimension(): import("@hatiolab/things-scene").DIMENSION;
321
+ set dimension(d: import("@hatiolab/things-scene").DIMENSION): any;
322
+ get drawPath(): import("@hatiolab/things-scene").POINT[];
323
+ get rotatePoint(): import("@hatiolab/things-scene").POINT;
324
+ get mutable(): boolean;
325
+ get resizable(): boolean;
326
+ get rotatable(): boolean;
327
+ buildRealObject(): import("@hatiolab/things-scene").IRealObject | undefined;
328
+ get realObject(): import("@hatiolab/things-scene").IRealObject | undefined;
329
+ draw(context?: import("@hatiolab/things-scene").SceneRenderContext): void;
330
+ prerender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
331
+ postrender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
332
+ prepare(resolve: (component: import("@hatiolab/things-scene").Component) => void, reject: (reason: any) => void): void;
333
+ prepareIf(condition: boolean): void;
334
+ drawText(context: import("@hatiolab/things-scene").SceneRenderContext): void;
335
+ drawStroke(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
336
+ drawFill(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
337
+ get strokeStyle(): any;
338
+ set strokeStyle(v: any): any;
339
+ get fillStyle(): any;
340
+ set fillStyle(v: any): any;
341
+ get fontColor(): string;
342
+ set fontColor(v: string): any;
343
+ get rotation(): number;
344
+ set rotation(v: number): any;
345
+ get decorators(): string[];
346
+ get decotag(): string;
347
+ get hidden(): boolean;
348
+ set hidden(v: boolean): any;
349
+ get tag(): string;
350
+ set tag(v: string): any;
351
+ get appendum(): any;
352
+ set appendum(v: any): any;
353
+ defaultTextSubstitutor(): string;
354
+ textLines(context?: import("@hatiolab/things-scene").SceneRenderContext): any[][];
355
+ get font(): string;
356
+ get lineHeight(): number;
357
+ get textSubstitutor(): () => string;
358
+ get text(): string;
359
+ set text(v: string): any;
360
+ get textBounds(): import("@hatiolab/things-scene").BOUNDS;
361
+ get textRotation(): number;
362
+ get textHidden(): boolean;
363
+ set textHidden(v: boolean): any;
364
+ get hasTextProperty(): boolean;
365
+ animate(opts: import("@hatiolab/things-scene").AnimationConfig): any;
366
+ effect(context: import("@hatiolab/things-scene").SceneRenderContext, model: any): void;
367
+ serialize(...others: any[]): string;
368
+ trim(): void;
369
+ closeScene(data: any): void;
370
+ delta(attr?: string | object, value?: any): any;
371
+ invalidate(): void;
372
+ get value(): any;
373
+ set value(v: any): any;
374
+ get data(): any;
375
+ set data(v: any): any;
376
+ set tap(v: any): any;
377
+ get mappings(): any[];
378
+ get retention(): number;
379
+ get animation(): import("@hatiolab/things-scene").AnimationController | undefined;
380
+ get started(): boolean;
381
+ set started(v: boolean): any;
382
+ get controls(): import("@hatiolab/things-scene").Control[] | undefined;
383
+ findFirst(finder: string | ((c: import("@hatiolab/things-scene").Component) => boolean), ...others: any[]): import("@hatiolab/things-scene").Component | undefined;
384
+ findAll(s: string | ((c: import("@hatiolab/things-scene").Component) => boolean), ...others: any[]): any[] | undefined;
385
+ capture(x: number, y: number, except?: (c: import("@hatiolab/things-scene").Component) => boolean): any;
386
+ findAnchor(name: string): any;
387
+ isDescendible(container: import("@hatiolab/things-scene").Component): boolean;
388
+ getContext(component?: unknown): any;
389
+ get root(): import("@hatiolab/things-scene").Component;
390
+ get rootModel(): import("@hatiolab/things-scene").Component;
391
+ get parent(): import("@hatiolab/things-scene").Component;
392
+ set parent(v: import("@hatiolab/things-scene").Component): any;
393
+ get scalable(): boolean;
394
+ get stuck(): boolean;
395
+ get capturable(): boolean;
396
+ get position(): string;
397
+ get origin(): string;
398
+ get offset(): import("@hatiolab/things-scene").POINT;
399
+ get app(): import("@hatiolab/things-scene").ApplicationContext;
400
+ drawEffect(context: import("@hatiolab/things-scene").SceneRenderContext): void;
401
+ prepareFill(resolve: Function, reject: Function): void;
402
+ prepareFillIf(condition: boolean): void;
403
+ onchangeFill(after: Record<string, any>, before: Record<string, any>): void;
404
+ drawImage(context: import("@hatiolab/things-scene").SceneRenderContext, image: HTMLImageElement, left: number, top: number, width: number, height: number): void;
405
+ mutateBounds(logic: ((bounds: import("@hatiolab/things-scene").BOUNDS) => import("@hatiolab/things-scene").BOUNDS | void) | null, context?: any): void;
406
+ mutatePath(beforeLogic: ((path: import("@hatiolab/things-scene").POINT[]) => import("@hatiolab/things-scene").POINT[] | void) | null, afterLogic: ((path: import("@hatiolab/things-scene").POINT[]) => import("@hatiolab/things-scene").POINT[] | void) | null, context?: any): void;
407
+ access(accessor: string): any;
408
+ substitute(template: string, data: any): string | undefined;
409
+ onchangeMappings(after: Record<string, any>, before: Record<string, any>): void;
410
+ onchangeData(after: Record<string, any>, before: Record<string, any>): void;
411
+ buildMappings(): void;
412
+ executeMappings(force?: boolean): void;
413
+ disposeMappings(): void;
414
+ ondropfile(transfered: FileList, files: string[]): void;
415
+ transcoordS2P(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
416
+ transcoordP2S(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
417
+ transcoordS2T(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
418
+ transcoordT2P(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
419
+ transcoordT2S(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
420
+ transcoordS2TR(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
421
+ transcoordS2O(x: number, y: number, target: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
422
+ transcoordC2S(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
423
+ transcoordS2C(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
424
+ toParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
425
+ fromParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
426
+ toScene(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
427
+ fromScene(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
428
+ toLocal(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
429
+ toGlobal(x: number, y: number, top?: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
430
+ toOther(x: number, y: number, target: import("@hatiolab/things-scene").Component): import("@hatiolab/things-scene").POINT;
431
+ on(name: string | object, callback: Function, context?: any): any;
432
+ off(name?: string | object, callback?: Function, context?: any): any;
433
+ once(name: string | object, callback: Function, context?: any): any;
434
+ trigger(name: string, ...args: any[]): any;
435
+ delegate_on(delegator: any): any;
436
+ delegate_off(delegator: any): any;
437
+ onchange(after: Record<string, any>, before: Record<string, any>): void;
438
+ calculateBounds?(): void;
439
+ oncreate_element?(element: HTMLElement): void;
440
+ removeComponent(component: import("@hatiolab/things-scene").Component, ghost?: boolean): void;
441
+ addComponent(component: import("@hatiolab/things-scene").Component, ghost?: boolean): void;
442
+ insertComponentAt(component: import("@hatiolab/things-scene").Component, index: number, ghost?: boolean): void;
443
+ getOverlay(component: import("@hatiolab/things-scene").Component): HTMLElement | undefined;
444
+ findById(id: string): import("@hatiolab/things-scene").Component | undefined;
445
+ findByRefid(ref: string | number): import("@hatiolab/things-scene").Component | undefined;
446
+ findAllById(id: string): import("@hatiolab/things-scene").Component[];
447
+ resize(): void;
448
+ fit(type?: string): void;
449
+ get components(): import("@hatiolab/things-scene").Component[] | undefined;
450
+ get layout(): any;
451
+ get auxOverlay(): HTMLElement | undefined;
452
+ get isReady(): boolean;
453
+ get unitScale(): number;
454
+ get selected(): import("@hatiolab/things-scene").Component[];
455
+ set selected(_v: import("@hatiolab/things-scene").Component[]): any;
456
+ get focused(): import("@hatiolab/things-scene").Component | null;
457
+ set focused(_v: import("@hatiolab/things-scene").Component | null): any;
458
+ get hasSameParentForAllSelected(): boolean;
459
+ set hasSameParentForAllSelected(_v: boolean): any;
460
+ get fitMode(): string | undefined;
461
+ set fitMode(_v: string | undefined): any;
462
+ get element(): HTMLElement | null;
463
+ set element(_v: HTMLElement | null): any;
5
464
  }) & typeof Shape;
6
465
  export default class Excel extends Excel_base {
7
466
  static _image: HTMLImageElement;
@@ -9,7 +468,7 @@ export default class Excel extends Excel_base {
9
468
  private repeatTimer?;
10
469
  private src?;
11
470
  dispose(): void;
12
- ready(): void;
471
+ ready(): Promise<void>;
13
472
  render(context: CanvasRenderingContext2D): void;
14
473
  get nature(): ComponentNature;
15
474
  _initInterval(): void;
package/dist/excel.js CHANGED
@@ -53,7 +53,9 @@ async function fetchData(url) {
53
53
  console.log('result', result);
54
54
  return result;
55
55
  }
56
- let Excel = Excel_1 = class Excel extends DataSource(RectPath(Shape)) {
56
+ let Excel = class Excel extends DataSource(RectPath(Shape)) {
57
+ static { Excel_1 = this; }
58
+ static _image;
57
59
  static get image() {
58
60
  if (!Excel_1._image) {
59
61
  Excel_1._image = new Image();
@@ -61,11 +63,14 @@ let Excel = Excel_1 = class Excel extends DataSource(RectPath(Shape)) {
61
63
  }
62
64
  return Excel_1._image;
63
65
  }
66
+ repeatTimer;
67
+ src;
64
68
  dispose() {
65
69
  this._stopRepeater();
66
70
  super.dispose();
67
71
  }
68
- ready() {
72
+ async ready() {
73
+ await super.ready();
69
74
  const { src } = this.state;
70
75
  if (src) {
71
76
  this._initInterval();
package/dist/excel.js.map CHANGED
@@ -1 +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Aa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QACjC,CAAC;QAED,IAAI,CAAC,WAAW,GAAG,IAAI,CAAA;IACzB,CAAC;IAED,UAAU,CAAC,UAAe,EAAE,KAAU;QACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3C,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;gBACxC,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;gBACnB,OAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;IAED,QAAQ,CAAC,KAAiB,EAAE,MAAkB;QAC5C,IAAI,QAAQ,IAAI,KAAK,IAAI,KAAK,IAAI,KAAK,EAAE,CAAC;YACxC,IAAI,CAAC,aAAa,EAAE,CAAA;QACtB,CAAC;IACH,CAAC;CACF,CAAA;AA3FoB,KAAK;IADzB,cAAc,CAAC,OAAO,CAAC;GACH,KAAK,CA2FzB;eA3FoB,KAAK","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport * as XLSX from 'xlsx'\n\nimport { ComponentNature, DataSource, Properties, RectPath, Shape, sceneComponent } from '@hatiolab/things-scene'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'attachment-selector',\n label: 'src',\n name: 'src',\n placeholder: 'Excel File URL'\n },\n {\n type: 'number',\n label: 'period',\n name: 'period',\n placeholder: 'seconds'\n }\n ],\n help: 'scene/component/excel'\n}\n\nasync function fetchData(url: string) {\n if (!url.startsWith('data:')) {\n // prevent read from cache\n if (url.indexOf('?') !== -1) {\n url = url + `&ts=${Date.now()}`\n } else {\n url = url + `?ts=${Date.now()}`\n }\n }\n\n const file = await fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/xlsx'\n },\n credentials: 'include'\n })\n\n const workbook: XLSX.WorkBook = XLSX.read(await file.arrayBuffer(), { type: 'array' })\n\n var result: { [key: string]: unknown } = {}\n workbook.SheetNames.forEach((sheet: string) => {\n var roa = XLSX.utils.sheet_to_json(workbook.Sheets[sheet])\n if (roa.length) {\n result[sheet] = roa\n }\n })\n\n console.log('result', result)\n return result\n}\n\n@sceneComponent('excel')\nexport default class Excel extends DataSource(RectPath(Shape)) {\n static _image: HTMLImageElement\n\n static get image() {\n if (!Excel._image) {\n Excel._image = new Image()\n Excel._image.src = new URL('../icons/symbol-excel.png', import.meta.url).href\n }\n\n return Excel._image\n }\n\n private repeatTimer?: NodeJS.Timeout | null\n private src?: string\n\n dispose() {\n this._stopRepeater()\n super.dispose()\n }\n\n ready() {\n const { src } = this.state\n\n if (src) {\n this._initInterval()\n }\n }\n\n render(context: CanvasRenderingContext2D) {\n var { left, top, width, height } = this.bounds\n\n context.beginPath()\n this.drawImage(context, Excel.image, left, top, width, height)\n }\n\n get nature() {\n return NATURE\n }\n\n _initInterval() {\n this._stopRepeater()\n this._startRepeater()\n }\n\n _startRepeater() {\n var { src, period } = this.state\n period = Number(period)\n\n var fetchable = true\n\n if (period && this.app.isViewMode) {\n this.repeatTimer = setInterval(() => {\n fetchable &&\n this.repeatTimer &&\n requestAnimationFrame(() => {\n fetchable = true\n fetchData(src).then(data => {\n this.setState('data', data)\n })\n })\n fetchable = false\n }, period * 1000)\n }\n\n fetchData(src).then(data => {\n this.setState('data', data)\n })\n }\n\n _stopRepeater() {\n if (this.repeatTimer) {\n clearInterval(this.repeatTimer)\n }\n\n this.repeatTimer = null\n }\n\n ondropfile(transfered: any, files: any) {\n for (let i = 0; i < transfered.length; i++) {\n if (/\\.xlsx?$/.test(transfered[i].name)) {\n this.src = files[i]\n return\n }\n }\n }\n\n onchange(after: Properties, before: Properties) {\n if ('period' in after || 'src' in after) {\n this._initInterval()\n }\n }\n}\n"]}
1
+ {"version":3,"file":"excel.js","sourceRoot":"","sources":["../src/excel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AAA;IACJ,CAAC;IAED,aAAa;QACX,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QACjC,CAAC;QAED,IAAI,CAAC,WAAW,GAAG,IAAI,CAAA;IACzB,CAAC;IAED,UAAU,CAAC,UAAe,EAAE,KAAU;QACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3C,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;gBACxC,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;gBACnB,OAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;IAED,QAAQ,CAAC,KAAiB,EAAE,MAAkB;QAC5C,IAAI,QAAQ,IAAI,KAAK,IAAI,KAAK,IAAI,KAAK,EAAE,CAAC;YACxC,IAAI,CAAC,aAAa,EAAE,CAAA;QACtB,CAAC;IACH,CAAC;CACF,CAAA;AA5FoB,KAAK;IADzB,cAAc,CAAC,OAAO,CAAC;GACH,KAAK,CA4FzB;eA5FoB,KAAK","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport * as XLSX from 'xlsx'\n\nimport { ComponentNature, DataSource, Properties, RectPath, Shape, sceneComponent } from '@hatiolab/things-scene'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'attachment-selector',\n label: 'src',\n name: 'src',\n placeholder: 'Excel File URL'\n },\n {\n type: 'number',\n label: 'period',\n name: 'period',\n placeholder: 'seconds'\n }\n ],\n help: 'scene/component/excel'\n}\n\nasync function fetchData(url: string) {\n if (!url.startsWith('data:')) {\n // prevent read from cache\n if (url.indexOf('?') !== -1) {\n url = url + `&ts=${Date.now()}`\n } else {\n url = url + `?ts=${Date.now()}`\n }\n }\n\n const file = await fetch(url, {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/xlsx'\n },\n credentials: 'include'\n })\n\n const workbook: XLSX.WorkBook = XLSX.read(await file.arrayBuffer(), { type: 'array' })\n\n var result: { [key: string]: unknown } = {}\n workbook.SheetNames.forEach((sheet: string) => {\n var roa = XLSX.utils.sheet_to_json(workbook.Sheets[sheet])\n if (roa.length) {\n result[sheet] = roa\n }\n })\n\n console.log('result', result)\n return result\n}\n\n@sceneComponent('excel')\nexport default class Excel extends DataSource(RectPath(Shape)) {\n static _image: HTMLImageElement\n\n static get image() {\n if (!Excel._image) {\n Excel._image = new Image()\n Excel._image.src = new URL('../icons/symbol-excel.png', import.meta.url).href\n }\n\n return Excel._image\n }\n\n private repeatTimer?: NodeJS.Timeout | null\n private src?: string\n\n dispose() {\n this._stopRepeater()\n super.dispose()\n }\n\n async ready() {\n await super.ready()\n const { src } = this.state\n\n if (src) {\n this._initInterval()\n }\n }\n\n render(context: CanvasRenderingContext2D) {\n var { left, top, width, height } = this.bounds\n\n context.beginPath()\n this.drawImage(context, Excel.image, left, top, width, height)\n }\n\n get nature() {\n return NATURE\n }\n\n _initInterval() {\n this._stopRepeater()\n this._startRepeater()\n }\n\n _startRepeater() {\n var { src, period } = this.state\n period = Number(period)\n\n var fetchable = true\n\n if (period && this.app.isViewMode) {\n this.repeatTimer = setInterval(() => {\n fetchable &&\n this.repeatTimer &&\n requestAnimationFrame(() => {\n fetchable = true\n fetchData(src).then(data => {\n this.setState('data', data)\n })\n })\n fetchable = false\n }, period * 1000)\n }\n\n fetchData(src).then(data => {\n this.setState('data', data)\n })\n }\n\n _stopRepeater() {\n if (this.repeatTimer) {\n clearInterval(this.repeatTimer)\n }\n\n this.repeatTimer = null\n }\n\n ondropfile(transfered: any, files: any) {\n for (let i = 0; i < transfered.length; i++) {\n if (/\\.xlsx?$/.test(transfered[i].name)) {\n this.src = files[i]\n return\n }\n }\n }\n\n onchange(after: Properties, before: Properties) {\n if ('period' in after || 'src' in after) {\n this._initInterval()\n }\n }\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@operato/scene-excel",
3
3
  "description": "Excel integration component for things-scene",
4
- "version": "9.1.1",
4
+ "version": "10.0.0-beta.1",
5
5
  "type": "module",
6
6
  "author": "heartyoh",
7
7
  "main": "dist/index.js",
@@ -22,28 +22,28 @@
22
22
  "serve:dev": "npm run serve",
23
23
  "start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
24
24
  "build": "tsc",
25
- "prepublish": "tsc",
26
- "lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
27
- "format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
25
+ "prepublishOnly": "tsc",
26
+ "lint": "eslint src/ && prettier \"src/**/*.ts\" --check",
27
+ "format": "eslint src/ --fix && prettier \"src/**/*.ts\" --write",
28
28
  "migration": "things-factory-migration"
29
29
  },
30
30
  "dependencies": {
31
- "@hatiolab/things-scene": "^9.0.0",
31
+ "@hatiolab/things-scene": "^10.0.0-beta.1",
32
32
  "xlsx": "^0.18.5"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@hatiolab/prettier-config": "^1.0.0",
36
- "@things-factory/builder": "^9.0.0",
37
- "@things-factory/operato-board": "^9.0.0",
38
- "@typescript-eslint/eslint-plugin": "^4.33.0",
39
- "@typescript-eslint/parser": "^4.33.0",
36
+ "@things-factory/builder": "^10.0.0-beta.1",
37
+ "@things-factory/operato-board": "^10.0.0-beta.1",
38
+ "@typescript-eslint/eslint-plugin": "^8.0.0",
39
+ "@typescript-eslint/parser": "^8.0.0",
40
40
  "@web/dev-server": "^0.1.28",
41
41
  "concurrently": "^8.0.1",
42
42
  "eslint": "^9.18.0",
43
43
  "eslint-config-prettier": "^10.0.1",
44
44
  "husky": "^8.0.3",
45
- "lint-staged": "^13.2.2",
46
- "prettier": "^2.4.1",
45
+ "lint-staged": "^15.2.2",
46
+ "prettier": "^3.2.5",
47
47
  "tslib": "^2.3.1",
48
48
  "typescript": "^5.0.4"
49
49
  },
@@ -59,5 +59,5 @@
59
59
  "prettier --write"
60
60
  ]
61
61
  },
62
- "gitHead": "14946e6f709e9b427a43ac6c5751b4fdb58961dd"
62
+ "gitHead": "bb127dd516b9e962fb2d0a24bc2d8c5e108f06fb"
63
63
  }