@operato/scene-graphql 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/graphql-client.d.ts +462 -3
- package/dist/graphql-client.js +6 -3
- package/dist/graphql-client.js.map +1 -1
- package/dist/graphql-query-and-mutation.d.ts +462 -4
- package/dist/graphql-query-and-mutation.js +10 -12
- package/dist/graphql-query-and-mutation.js.map +1 -1
- package/dist/graphql-subscription.d.ts +462 -3
- package/dist/graphql-subscription.js +6 -3
- package/dist/graphql-subscription.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +13 -14
package/dist/graphql-client.d.ts
CHANGED
|
@@ -1,14 +1,473 @@
|
|
|
1
1
|
import { ApolloClient, NormalizedCacheObject } from '@apollo/client/core/index.js';
|
|
2
|
-
import { ComponentNature, Shape } from '@hatiolab/things-scene';
|
|
2
|
+
import { Component, ComponentNature, Shape } from '@hatiolab/things-scene';
|
|
3
3
|
declare const GraphqlClient_base: (new (...args: any[]) => {
|
|
4
|
+
_convertDataFormat(data: any, format: any): any;
|
|
4
5
|
isDataSource(): boolean;
|
|
5
|
-
|
|
6
|
+
_app: any;
|
|
7
|
+
_model: any;
|
|
8
|
+
_state: any;
|
|
9
|
+
_delta: any;
|
|
10
|
+
_animation: any;
|
|
11
|
+
_animate: any;
|
|
12
|
+
_parent: any;
|
|
13
|
+
_disposed: any;
|
|
14
|
+
_textHidden: any;
|
|
15
|
+
_text_substitutor: any;
|
|
16
|
+
_value_substitutor: any;
|
|
17
|
+
_mappings: any;
|
|
18
|
+
_realObject: import("@hatiolab/things-scene").IRealObject | undefined;
|
|
19
|
+
_cachedState: any;
|
|
20
|
+
updatedAt: any;
|
|
21
|
+
fontSize: any;
|
|
22
|
+
__cache__: any;
|
|
23
|
+
created(): void;
|
|
24
|
+
added(parent: any): void;
|
|
25
|
+
removed(parent: any): void;
|
|
26
|
+
ready(): Promise<void>;
|
|
27
|
+
touch(): void;
|
|
28
|
+
clearCache(...attrs: any[]): void;
|
|
29
|
+
removeSelf(completely: any): void;
|
|
30
|
+
resetAnimation(): void;
|
|
31
|
+
dispose(): void;
|
|
32
|
+
get nature(): import("@hatiolab/things-scene").ComponentNature;
|
|
33
|
+
get disposed(): boolean;
|
|
34
|
+
isLayer(): boolean;
|
|
35
|
+
isGroup(): boolean;
|
|
36
|
+
isContainer(): this is import("@hatiolab/things-scene/dist-types/types/component").Container;
|
|
37
|
+
isLine(): boolean;
|
|
38
|
+
isRoot(): boolean;
|
|
39
|
+
isRootModel(): boolean;
|
|
40
|
+
is3dish(): boolean;
|
|
41
|
+
get is3dMode(): boolean;
|
|
42
|
+
isIn3DSpace(): boolean;
|
|
43
|
+
isTemplate(): boolean;
|
|
44
|
+
isHTMLElement(): boolean;
|
|
45
|
+
isConnectable(): boolean;
|
|
46
|
+
isIdentifiable(): boolean;
|
|
47
|
+
isPositionable(): boolean;
|
|
48
|
+
replaceRefids(replaceMap: any): void;
|
|
49
|
+
get(property: any): any;
|
|
50
|
+
set(props: any, propval?: any): any;
|
|
51
|
+
getState(property: any): any;
|
|
52
|
+
setState(props: any, propval?: any): any;
|
|
53
|
+
get model(): any;
|
|
54
|
+
get state(): any;
|
|
55
|
+
get hierarchy(): any;
|
|
56
|
+
get volatile(): never[];
|
|
57
|
+
_applyProps(target: any, props: any, options: any): any;
|
|
58
|
+
contains(x: number, y: number): boolean;
|
|
59
|
+
move(offset: {
|
|
60
|
+
x: number;
|
|
61
|
+
y: number;
|
|
62
|
+
}, ...args: boolean[]): void;
|
|
63
|
+
symmetryX(x?: number): void;
|
|
64
|
+
symmetryY(y: number): void;
|
|
65
|
+
adjustResize(bounds: import("@hatiolab/things-scene").BOUNDS, origin_bounds: import("@hatiolab/things-scene").BOUNDS, diagonal: boolean): {
|
|
66
|
+
left: any;
|
|
67
|
+
top: any;
|
|
68
|
+
width: any;
|
|
69
|
+
height: any;
|
|
70
|
+
};
|
|
71
|
+
adjustRotation(rotation: number, step: boolean): number;
|
|
72
|
+
outline(progress: number): any;
|
|
73
|
+
get bounds(): import("@hatiolab/things-scene").BOUNDS;
|
|
74
|
+
set bounds(b: import("@hatiolab/things-scene").BOUNDS): any;
|
|
75
|
+
get center(): import("@hatiolab/things-scene").POINT;
|
|
76
|
+
set center(p: import("@hatiolab/things-scene").POINT): any;
|
|
77
|
+
get location(): import("@hatiolab/things-scene").POINT;
|
|
78
|
+
set location(l: import("@hatiolab/things-scene").POINT): any;
|
|
79
|
+
get rotate(): import("@hatiolab/things-scene").POINT;
|
|
80
|
+
set rotate(r: import("@hatiolab/things-scene").POINT): any;
|
|
81
|
+
get dimension(): import("@hatiolab/things-scene").DIMENSION;
|
|
82
|
+
set dimension(d: import("@hatiolab/things-scene").DIMENSION): any;
|
|
83
|
+
get path(): import("@hatiolab/things-scene").POINT[];
|
|
84
|
+
set path(p: import("@hatiolab/things-scene").POINT[]): any;
|
|
85
|
+
get drawPath(): import("@hatiolab/things-scene").POINT[];
|
|
86
|
+
get rotatePoint(): import("@hatiolab/things-scene").POINT;
|
|
87
|
+
get mutable(): boolean;
|
|
88
|
+
get resizable(): boolean;
|
|
89
|
+
get rotatable(): boolean;
|
|
90
|
+
buildRealObject(): import("@hatiolab/things-scene").IRealObject | undefined;
|
|
91
|
+
get realObject(): import("@hatiolab/things-scene").IRealObject | undefined;
|
|
92
|
+
draw(context?: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
93
|
+
prerender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
94
|
+
render(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
95
|
+
postrender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
96
|
+
prepare(resolve: (component: Component) => void, reject: (reason: any) => void): void;
|
|
97
|
+
prepareIf(condition: boolean): void;
|
|
98
|
+
drawText(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
99
|
+
drawStroke(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
|
|
100
|
+
drawFill(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
|
|
101
|
+
get strokeStyle(): any;
|
|
102
|
+
set strokeStyle(v: any): any;
|
|
103
|
+
get fillStyle(): any;
|
|
104
|
+
set fillStyle(v: any): any;
|
|
105
|
+
get fontColor(): string;
|
|
106
|
+
set fontColor(v: string): any;
|
|
107
|
+
get rotation(): number;
|
|
108
|
+
set rotation(v: number): any;
|
|
109
|
+
get decorators(): string[];
|
|
110
|
+
get decotag(): string;
|
|
111
|
+
get hidden(): boolean;
|
|
112
|
+
set hidden(v: boolean): any;
|
|
113
|
+
get tag(): string;
|
|
114
|
+
set tag(v: string): any;
|
|
115
|
+
get appendum(): any;
|
|
116
|
+
set appendum(v: any): any;
|
|
117
|
+
defaultTextSubstitutor(): string;
|
|
118
|
+
textLines(context?: import("@hatiolab/things-scene").SceneRenderContext): any[][];
|
|
119
|
+
get font(): string;
|
|
120
|
+
get lineHeight(): number;
|
|
121
|
+
get textSubstitutor(): () => string;
|
|
122
|
+
get text(): string;
|
|
123
|
+
set text(v: string): any;
|
|
124
|
+
get textBounds(): import("@hatiolab/things-scene").BOUNDS;
|
|
125
|
+
get textRotation(): number;
|
|
126
|
+
get textHidden(): boolean;
|
|
127
|
+
set textHidden(v: boolean): any;
|
|
128
|
+
get hasTextProperty(): boolean;
|
|
129
|
+
animate(opts: import("@hatiolab/things-scene").AnimationConfig): any;
|
|
130
|
+
effect(context: import("@hatiolab/things-scene").SceneRenderContext, model: any): void;
|
|
131
|
+
serialize(...others: any[]): string;
|
|
132
|
+
trim(): void;
|
|
133
|
+
closeScene(data: any): void;
|
|
134
|
+
delta(attr?: string | object, value?: any): any;
|
|
135
|
+
invalidate(): void;
|
|
136
|
+
get value(): any;
|
|
137
|
+
set value(v: any): any;
|
|
138
|
+
get data(): any;
|
|
139
|
+
set data(v: any): any;
|
|
140
|
+
set tap(v: any): any;
|
|
141
|
+
get mappings(): any[];
|
|
142
|
+
get retention(): number;
|
|
143
|
+
get animation(): import("@hatiolab/things-scene").AnimationController | undefined;
|
|
144
|
+
get started(): boolean;
|
|
145
|
+
set started(v: boolean): any;
|
|
146
|
+
get controls(): import("@hatiolab/things-scene").Control[] | undefined;
|
|
147
|
+
findFirst(finder: string | ((c: Component) => boolean), ...others: any[]): Component | undefined;
|
|
148
|
+
findAll(s: string | ((c: Component) => boolean), ...others: any[]): any[] | undefined;
|
|
149
|
+
capture(x: number, y: number, except?: (c: Component) => boolean): any;
|
|
150
|
+
findAnchor(name: string): any;
|
|
151
|
+
isDescendible(container: Component): boolean;
|
|
152
|
+
getContext(component?: unknown): any;
|
|
153
|
+
get root(): Component;
|
|
154
|
+
get rootModel(): Component;
|
|
155
|
+
get parent(): Component;
|
|
156
|
+
set parent(v: Component): any;
|
|
157
|
+
get anchors(): import("@hatiolab/things-scene").Anchor[];
|
|
158
|
+
get scalable(): boolean;
|
|
159
|
+
get stuck(): boolean;
|
|
160
|
+
get capturable(): boolean;
|
|
161
|
+
get position(): string;
|
|
162
|
+
get origin(): string;
|
|
163
|
+
get offset(): import("@hatiolab/things-scene").POINT;
|
|
164
|
+
get app(): import("@hatiolab/things-scene").ApplicationContext;
|
|
165
|
+
drawEffect(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
166
|
+
prepareFill(resolve: Function, reject: Function): void;
|
|
167
|
+
prepareFillIf(condition: boolean): void;
|
|
168
|
+
onchangeFill(after: Record<string, any>, before: Record<string, any>): void;
|
|
169
|
+
drawImage(context: import("@hatiolab/things-scene").SceneRenderContext, image: HTMLImageElement, left: number, top: number, width: number, height: number): void;
|
|
170
|
+
mutateBounds(logic: ((bounds: import("@hatiolab/things-scene").BOUNDS) => import("@hatiolab/things-scene").BOUNDS | void) | null, context?: any): void;
|
|
171
|
+
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;
|
|
172
|
+
access(accessor: string): any;
|
|
173
|
+
substitute(template: string, data: any): string | undefined;
|
|
174
|
+
onchangeMappings(after: Record<string, any>, before: Record<string, any>): void;
|
|
175
|
+
onchangeData(after: Record<string, any>, before: Record<string, any>): void;
|
|
176
|
+
buildMappings(): void;
|
|
177
|
+
executeMappings(force?: boolean): void;
|
|
178
|
+
disposeMappings(): void;
|
|
179
|
+
ondropfile(transfered: FileList, files: string[]): void;
|
|
180
|
+
transcoordS2P(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
181
|
+
transcoordP2S(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
182
|
+
transcoordS2T(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
183
|
+
transcoordT2P(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
184
|
+
transcoordT2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
185
|
+
transcoordS2TR(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
186
|
+
transcoordS2O(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
187
|
+
transcoordC2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
188
|
+
transcoordS2C(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
189
|
+
toParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
190
|
+
fromParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
191
|
+
toScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
192
|
+
fromScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
193
|
+
toLocal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
194
|
+
toGlobal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
195
|
+
toOther(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
196
|
+
on(name: string | object, callback: Function, context?: any): any;
|
|
197
|
+
off(name?: string | object, callback?: Function, context?: any): any;
|
|
198
|
+
once(name: string | object, callback: Function, context?: any): any;
|
|
199
|
+
trigger(name: string, ...args: any[]): any;
|
|
200
|
+
delegate_on(delegator: any): any;
|
|
201
|
+
delegate_off(delegator: any): any;
|
|
202
|
+
onchange(after: Record<string, any>, before: Record<string, any>): void;
|
|
203
|
+
calculateBounds?(): void;
|
|
204
|
+
oncreate_element?(element: HTMLElement): void;
|
|
205
|
+
removeComponent(component: Component, ghost?: boolean): void;
|
|
206
|
+
addComponent(component: Component, ghost?: boolean): void;
|
|
207
|
+
insertComponentAt(component: Component, index: number, ghost?: boolean): void;
|
|
208
|
+
getOverlay(component: Component): HTMLElement | undefined;
|
|
209
|
+
findById(id: string): Component | undefined;
|
|
210
|
+
findByRefid(ref: string | number): Component | undefined;
|
|
211
|
+
findAllById(id: string): Component[];
|
|
212
|
+
resize(): void;
|
|
213
|
+
fit(type?: string): void;
|
|
214
|
+
get components(): Component[] | undefined;
|
|
215
|
+
get layout(): any;
|
|
216
|
+
get auxOverlay(): HTMLElement | undefined;
|
|
217
|
+
get isReady(): boolean;
|
|
218
|
+
get unitScale(): number;
|
|
219
|
+
get selected(): Component[];
|
|
220
|
+
set selected(_v: Component[]): any;
|
|
221
|
+
get focused(): Component | null;
|
|
222
|
+
set focused(_v: Component | null): any;
|
|
223
|
+
get hasSameParentForAllSelected(): boolean;
|
|
224
|
+
set hasSameParentForAllSelected(_v: boolean): any;
|
|
225
|
+
get fitMode(): string | undefined;
|
|
226
|
+
set fitMode(_v: string | undefined): any;
|
|
227
|
+
get element(): HTMLElement | null;
|
|
228
|
+
set element(_v: HTMLElement | null): any;
|
|
229
|
+
}) & (new (...args: any[]) => {
|
|
230
|
+
contains(x: number, y: number): boolean;
|
|
231
|
+
get path(): {
|
|
232
|
+
x: any;
|
|
233
|
+
y: any;
|
|
234
|
+
}[];
|
|
235
|
+
set path(path: {
|
|
236
|
+
x: any;
|
|
237
|
+
y: any;
|
|
238
|
+
}[]): any;
|
|
239
|
+
get anchors(): {
|
|
240
|
+
name: string;
|
|
241
|
+
position: {
|
|
242
|
+
x: any;
|
|
243
|
+
y: any;
|
|
244
|
+
};
|
|
245
|
+
}[];
|
|
246
|
+
get bounds(): any;
|
|
247
|
+
set bounds(bounds: any): any;
|
|
248
|
+
render(ctx: CanvasRenderingContext2D): void;
|
|
249
|
+
_app: any;
|
|
250
|
+
_model: any;
|
|
251
|
+
_state: any;
|
|
252
|
+
_delta: any;
|
|
253
|
+
_animation: any;
|
|
254
|
+
_animate: any;
|
|
255
|
+
_parent: any;
|
|
256
|
+
_disposed: any;
|
|
257
|
+
_textHidden: any;
|
|
258
|
+
_text_substitutor: any;
|
|
259
|
+
_value_substitutor: any;
|
|
260
|
+
_mappings: any;
|
|
261
|
+
_realObject: import("@hatiolab/things-scene").IRealObject | undefined;
|
|
262
|
+
_cachedState: any;
|
|
263
|
+
updatedAt: any;
|
|
264
|
+
fontSize: any;
|
|
265
|
+
__cache__: any;
|
|
266
|
+
created(): void;
|
|
267
|
+
added(parent: any): void;
|
|
268
|
+
removed(parent: any): void;
|
|
269
|
+
ready(): Promise<void>;
|
|
270
|
+
touch(): void;
|
|
271
|
+
clearCache(...attrs: any[]): void;
|
|
272
|
+
removeSelf(completely: any): void;
|
|
273
|
+
resetAnimation(): void;
|
|
274
|
+
dispose(): void;
|
|
275
|
+
get nature(): import("@hatiolab/things-scene").ComponentNature;
|
|
276
|
+
get disposed(): boolean;
|
|
277
|
+
isLayer(): boolean;
|
|
278
|
+
isGroup(): boolean;
|
|
279
|
+
isContainer(): this is import("@hatiolab/things-scene/dist-types/types/component").Container;
|
|
280
|
+
isLine(): boolean;
|
|
281
|
+
isRoot(): boolean;
|
|
282
|
+
isRootModel(): boolean;
|
|
283
|
+
is3dish(): boolean;
|
|
284
|
+
get is3dMode(): boolean;
|
|
285
|
+
isIn3DSpace(): boolean;
|
|
286
|
+
isTemplate(): boolean;
|
|
287
|
+
isHTMLElement(): boolean;
|
|
288
|
+
isConnectable(): boolean;
|
|
289
|
+
isIdentifiable(): boolean;
|
|
290
|
+
isPositionable(): boolean;
|
|
291
|
+
replaceRefids(replaceMap: any): void;
|
|
292
|
+
get(property: any): any;
|
|
293
|
+
set(props: any, propval?: any): any;
|
|
294
|
+
getState(property: any): any;
|
|
295
|
+
setState(props: any, propval?: any): any;
|
|
296
|
+
get model(): any;
|
|
297
|
+
get state(): any;
|
|
298
|
+
get hierarchy(): any;
|
|
299
|
+
get volatile(): never[];
|
|
300
|
+
_applyProps(target: any, props: any, options: any): any;
|
|
301
|
+
move(offset: {
|
|
302
|
+
x: number;
|
|
303
|
+
y: number;
|
|
304
|
+
}, ...args: boolean[]): void;
|
|
305
|
+
symmetryX(x?: number): void;
|
|
306
|
+
symmetryY(y: number): void;
|
|
307
|
+
adjustResize(bounds: import("@hatiolab/things-scene").BOUNDS, origin_bounds: import("@hatiolab/things-scene").BOUNDS, diagonal: boolean): {
|
|
308
|
+
left: any;
|
|
309
|
+
top: any;
|
|
310
|
+
width: any;
|
|
311
|
+
height: any;
|
|
312
|
+
};
|
|
313
|
+
adjustRotation(rotation: number, step: boolean): number;
|
|
314
|
+
outline(progress: number): any;
|
|
315
|
+
get center(): import("@hatiolab/things-scene").POINT;
|
|
316
|
+
set center(p: import("@hatiolab/things-scene").POINT): any;
|
|
317
|
+
get location(): import("@hatiolab/things-scene").POINT;
|
|
318
|
+
set location(l: import("@hatiolab/things-scene").POINT): any;
|
|
319
|
+
get rotate(): import("@hatiolab/things-scene").POINT;
|
|
320
|
+
set rotate(r: import("@hatiolab/things-scene").POINT): any;
|
|
321
|
+
get dimension(): import("@hatiolab/things-scene").DIMENSION;
|
|
322
|
+
set dimension(d: import("@hatiolab/things-scene").DIMENSION): any;
|
|
323
|
+
get drawPath(): import("@hatiolab/things-scene").POINT[];
|
|
324
|
+
get rotatePoint(): import("@hatiolab/things-scene").POINT;
|
|
325
|
+
get mutable(): boolean;
|
|
326
|
+
get resizable(): boolean;
|
|
327
|
+
get rotatable(): boolean;
|
|
328
|
+
buildRealObject(): import("@hatiolab/things-scene").IRealObject | undefined;
|
|
329
|
+
get realObject(): import("@hatiolab/things-scene").IRealObject | undefined;
|
|
330
|
+
draw(context?: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
331
|
+
prerender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
332
|
+
postrender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
333
|
+
prepare(resolve: (component: Component) => void, reject: (reason: any) => void): void;
|
|
334
|
+
prepareIf(condition: boolean): void;
|
|
335
|
+
drawText(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
336
|
+
drawStroke(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
|
|
337
|
+
drawFill(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
|
|
338
|
+
get strokeStyle(): any;
|
|
339
|
+
set strokeStyle(v: any): any;
|
|
340
|
+
get fillStyle(): any;
|
|
341
|
+
set fillStyle(v: any): any;
|
|
342
|
+
get fontColor(): string;
|
|
343
|
+
set fontColor(v: string): any;
|
|
344
|
+
get rotation(): number;
|
|
345
|
+
set rotation(v: number): any;
|
|
346
|
+
get decorators(): string[];
|
|
347
|
+
get decotag(): string;
|
|
348
|
+
get hidden(): boolean;
|
|
349
|
+
set hidden(v: boolean): any;
|
|
350
|
+
get tag(): string;
|
|
351
|
+
set tag(v: string): any;
|
|
352
|
+
get appendum(): any;
|
|
353
|
+
set appendum(v: any): any;
|
|
354
|
+
defaultTextSubstitutor(): string;
|
|
355
|
+
textLines(context?: import("@hatiolab/things-scene").SceneRenderContext): any[][];
|
|
356
|
+
get font(): string;
|
|
357
|
+
get lineHeight(): number;
|
|
358
|
+
get textSubstitutor(): () => string;
|
|
359
|
+
get text(): string;
|
|
360
|
+
set text(v: string): any;
|
|
361
|
+
get textBounds(): import("@hatiolab/things-scene").BOUNDS;
|
|
362
|
+
get textRotation(): number;
|
|
363
|
+
get textHidden(): boolean;
|
|
364
|
+
set textHidden(v: boolean): any;
|
|
365
|
+
get hasTextProperty(): boolean;
|
|
366
|
+
animate(opts: import("@hatiolab/things-scene").AnimationConfig): any;
|
|
367
|
+
effect(context: import("@hatiolab/things-scene").SceneRenderContext, model: any): void;
|
|
368
|
+
serialize(...others: any[]): string;
|
|
369
|
+
trim(): void;
|
|
370
|
+
closeScene(data: any): void;
|
|
371
|
+
delta(attr?: string | object, value?: any): any;
|
|
372
|
+
invalidate(): void;
|
|
373
|
+
get value(): any;
|
|
374
|
+
set value(v: any): any;
|
|
375
|
+
get data(): any;
|
|
376
|
+
set data(v: any): any;
|
|
377
|
+
set tap(v: any): any;
|
|
378
|
+
get mappings(): any[];
|
|
379
|
+
get retention(): number;
|
|
380
|
+
get animation(): import("@hatiolab/things-scene").AnimationController | undefined;
|
|
381
|
+
get started(): boolean;
|
|
382
|
+
set started(v: boolean): any;
|
|
383
|
+
get controls(): import("@hatiolab/things-scene").Control[] | undefined;
|
|
384
|
+
findFirst(finder: string | ((c: Component) => boolean), ...others: any[]): Component | undefined;
|
|
385
|
+
findAll(s: string | ((c: Component) => boolean), ...others: any[]): any[] | undefined;
|
|
386
|
+
capture(x: number, y: number, except?: (c: Component) => boolean): any;
|
|
387
|
+
findAnchor(name: string): any;
|
|
388
|
+
isDescendible(container: Component): boolean;
|
|
389
|
+
getContext(component?: unknown): any;
|
|
390
|
+
get root(): Component;
|
|
391
|
+
get rootModel(): Component;
|
|
392
|
+
get parent(): Component;
|
|
393
|
+
set parent(v: Component): any;
|
|
394
|
+
get scalable(): boolean;
|
|
395
|
+
get stuck(): boolean;
|
|
396
|
+
get capturable(): boolean;
|
|
397
|
+
get position(): string;
|
|
398
|
+
get origin(): string;
|
|
399
|
+
get offset(): import("@hatiolab/things-scene").POINT;
|
|
400
|
+
get app(): import("@hatiolab/things-scene").ApplicationContext;
|
|
401
|
+
drawEffect(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
402
|
+
prepareFill(resolve: Function, reject: Function): void;
|
|
403
|
+
prepareFillIf(condition: boolean): void;
|
|
404
|
+
onchangeFill(after: Record<string, any>, before: Record<string, any>): void;
|
|
405
|
+
drawImage(context: import("@hatiolab/things-scene").SceneRenderContext, image: HTMLImageElement, left: number, top: number, width: number, height: number): void;
|
|
406
|
+
mutateBounds(logic: ((bounds: import("@hatiolab/things-scene").BOUNDS) => import("@hatiolab/things-scene").BOUNDS | void) | null, context?: any): void;
|
|
407
|
+
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;
|
|
408
|
+
access(accessor: string): any;
|
|
409
|
+
substitute(template: string, data: any): string | undefined;
|
|
410
|
+
onchangeMappings(after: Record<string, any>, before: Record<string, any>): void;
|
|
411
|
+
onchangeData(after: Record<string, any>, before: Record<string, any>): void;
|
|
412
|
+
buildMappings(): void;
|
|
413
|
+
executeMappings(force?: boolean): void;
|
|
414
|
+
disposeMappings(): void;
|
|
415
|
+
ondropfile(transfered: FileList, files: string[]): void;
|
|
416
|
+
transcoordS2P(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
417
|
+
transcoordP2S(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
418
|
+
transcoordS2T(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
419
|
+
transcoordT2P(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
420
|
+
transcoordT2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
421
|
+
transcoordS2TR(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
422
|
+
transcoordS2O(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
423
|
+
transcoordC2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
424
|
+
transcoordS2C(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
425
|
+
toParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
426
|
+
fromParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
427
|
+
toScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
428
|
+
fromScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
429
|
+
toLocal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
430
|
+
toGlobal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
431
|
+
toOther(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
432
|
+
on(name: string | object, callback: Function, context?: any): any;
|
|
433
|
+
off(name?: string | object, callback?: Function, context?: any): any;
|
|
434
|
+
once(name: string | object, callback: Function, context?: any): any;
|
|
435
|
+
trigger(name: string, ...args: any[]): any;
|
|
436
|
+
delegate_on(delegator: any): any;
|
|
437
|
+
delegate_off(delegator: any): any;
|
|
438
|
+
onchange(after: Record<string, any>, before: Record<string, any>): void;
|
|
439
|
+
calculateBounds?(): void;
|
|
440
|
+
oncreate_element?(element: HTMLElement): void;
|
|
441
|
+
removeComponent(component: Component, ghost?: boolean): void;
|
|
442
|
+
addComponent(component: Component, ghost?: boolean): void;
|
|
443
|
+
insertComponentAt(component: Component, index: number, ghost?: boolean): void;
|
|
444
|
+
getOverlay(component: Component): HTMLElement | undefined;
|
|
445
|
+
findById(id: string): Component | undefined;
|
|
446
|
+
findByRefid(ref: string | number): Component | undefined;
|
|
447
|
+
findAllById(id: string): Component[];
|
|
448
|
+
resize(): void;
|
|
449
|
+
fit(type?: string): void;
|
|
450
|
+
get components(): Component[] | undefined;
|
|
451
|
+
get layout(): any;
|
|
452
|
+
get auxOverlay(): HTMLElement | undefined;
|
|
453
|
+
get isReady(): boolean;
|
|
454
|
+
get unitScale(): number;
|
|
455
|
+
get selected(): Component[];
|
|
456
|
+
set selected(_v: Component[]): any;
|
|
457
|
+
get focused(): Component | null;
|
|
458
|
+
set focused(_v: Component | null): any;
|
|
459
|
+
get hasSameParentForAllSelected(): boolean;
|
|
460
|
+
set hasSameParentForAllSelected(_v: boolean): any;
|
|
461
|
+
get fitMode(): string | undefined;
|
|
462
|
+
set fitMode(_v: string | undefined): any;
|
|
463
|
+
get element(): HTMLElement | null;
|
|
464
|
+
set element(_v: HTMLElement | null): any;
|
|
6
465
|
}) & typeof Shape;
|
|
7
466
|
export default class GraphqlClient extends GraphqlClient_base {
|
|
8
467
|
private static _image;
|
|
9
468
|
private _client?;
|
|
10
469
|
static get image(): HTMLImageElement;
|
|
11
|
-
ready(): void
|
|
470
|
+
ready(): Promise<void>;
|
|
12
471
|
init(): void;
|
|
13
472
|
get client(): ApolloClient<NormalizedCacheObject> | undefined;
|
|
14
473
|
dispose(): void;
|
package/dist/graphql-client.js
CHANGED
|
@@ -81,7 +81,10 @@ const NATURE = {
|
|
|
81
81
|
],
|
|
82
82
|
help: 'scene/component/graphql'
|
|
83
83
|
};
|
|
84
|
-
let GraphqlClient =
|
|
84
|
+
let GraphqlClient = class GraphqlClient extends DataSource(RectPath(Shape)) {
|
|
85
|
+
static { GraphqlClient_1 = this; }
|
|
86
|
+
static _image;
|
|
87
|
+
_client;
|
|
85
88
|
static get image() {
|
|
86
89
|
if (!GraphqlClient_1._image) {
|
|
87
90
|
GraphqlClient_1._image = new Image();
|
|
@@ -89,8 +92,8 @@ let GraphqlClient = GraphqlClient_1 = class GraphqlClient extends DataSource(Rec
|
|
|
89
92
|
}
|
|
90
93
|
return GraphqlClient_1._image;
|
|
91
94
|
}
|
|
92
|
-
ready() {
|
|
93
|
-
super.ready();
|
|
95
|
+
async ready() {
|
|
96
|
+
await super.ready();
|
|
94
97
|
this.init();
|
|
95
98
|
}
|
|
96
99
|
init() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-client.js","sourceRoot":"","sources":["../src/graphql-client.ts"],"names":[],"mappings":"AAAA;;GAEG;;;AAEH,OAAO,EACL,YAAY,EAEZ,IAAI,EACJ,QAAQ,EAER,aAAa,EAGd,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAa,OAAO,EAAE,MAAM,oCAAoC,CAAA;AACvE,OAAO,EAA8B,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAEhH,MAAM,cAAc,GAAmB;IACrC,UAAU,EAAE;QACV,WAAW,EAAE,UAAU;QACvB,WAAW,EAAE,QAAQ;KACtB;IACD,KAAK,EAAE;QACL,WAAW,EAAE,UAAU,EAAE,gBAAgB;QACzC,WAAW,EAAE,KAAK;KACnB;IACD,MAAM,EAAE;QACN,WAAW,EAAE,KAAK;KACnB;CACF,CAAA;AAED,MAAM,aAAa,GAA2B,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,EAAE,EAAE;IAC3F,IAAI,aAAa,EAAE,CAAC;QAClB,QAAQ,CAAC,aAAa,CACpB,IAAI,WAAW,CAAC,QAAQ,EAAE;YACxB,MAAM,EAAE;gBACN,KAAK,EAAE,OAAO;gBACd,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,OAAO;gBACjC,EAAE,EAAE,aAAa;aAClB;SACF,CAAC,CACH,CAAA;IACH,CAAC;IAED,IAAI,YAAY,EAAE,CAAC;QACjB,4EAA4E;QAC5E,QAAS,YAAiC,CAAC,UAAU,EAAE,CAAC;YACtD,KAAK,SAAS,CAAC,mDAAmD;gBAChE,QAAQ,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IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAA;YACrB,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QAClB,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAED,MAAM,CAAC,OAAiC;QACtC;;WAEG;QAEH,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAA;QAE9C,OAAO,CAAC,SAAS,EAAE,CAAA;QACnB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,eAAa,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IACxE,CAAC;IAED,YAAY,CAAC,IAAS,EAAE,MAAW;QACjC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IAClC,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA;AA7EoB,aAAa;IADjC,cAAc,CAAC,gBAAgB,CAAC;GACZ,aAAa,CA6EjC;eA7EoB,aAAa","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nimport {\n ApolloClient,\n DefaultOptions,\n from,\n HttpLink,\n HttpOptions,\n InMemoryCache,\n NormalizedCacheObject,\n ServerParseError\n} from '@apollo/client/core/index.js'\nimport { ErrorLink, onError } from '@apollo/client/link/error/index.js'\nimport { Component, ComponentNature, DataSource, RectPath, Shape, sceneComponent } from '@hatiolab/things-scene'\n\nconst defaultOptions: DefaultOptions = {\n watchQuery: {\n fetchPolicy: 'no-cache',\n errorPolicy: 'ignore'\n },\n query: {\n fetchPolicy: 'no-cache', //'network-only'\n errorPolicy: 'all'\n },\n mutate: {\n errorPolicy: 'all'\n }\n}\n\nconst ERROR_HANDLER: ErrorLink.ErrorHandler = ({ operation, graphQLErrors, networkError }) => {\n if (graphQLErrors) {\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level: 'error',\n message: graphQLErrors[0].message,\n ex: graphQLErrors\n }\n })\n )\n }\n\n if (networkError) {\n /* networkError가 ServerParseError 이거나 ServerError 인 경우에만 statusCode를 갖는다. */\n switch ((networkError as ServerParseError).statusCode) {\n case undefined /* in case this error is not a server side error */:\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level: 'error',\n message: networkError.message,\n ex: networkError\n }\n })\n )\n break\n\n case 401:\n /* 401 에러가 리턴되면, 인증이 필요하다는 메시지를 dispatch 한다. 이 auth 모듈 등에서 이 메시지를 받아서 signin 프로세스를 진행할 수 있다. */\n document.dispatchEvent(new CustomEvent('auth-required'))\n break\n\n case 403:\n /* 403 에러가 리턴되면, 도메인 정보가 필요하다는 메시지를 dispatch 한다. 이 auth 모듈 등에서 이 메시지를 받아서 domain-register 프로세스 등을 진행할 수 있다. */\n document.dispatchEvent(new CustomEvent('domain-required'))\n break\n\n default:\n var { name, response, statusCode, bodyText, message } = networkError as ServerParseError\n if (name == 'ServerParseError') {\n message = `[ ${statusCode || ''} : ${response.statusText} ] ${bodyText}`\n } else {\n /* in case this error is instanceof ServerError */\n message = `[ ${statusCode || ''} : ${response.statusText} ] ${message}`\n }\n\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: {\n level: 'error',\n message,\n ex: networkError\n }\n })\n )\n }\n }\n}\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'string',\n label: 'endpoint',\n name: 'endpoint'\n }\n ],\n help: 'scene/component/graphql'\n}\n\n@sceneComponent('graphql-client')\nexport default class GraphqlClient extends DataSource(RectPath(Shape)) {\n private static _image: HTMLImageElement\n private _client?: ApolloClient<NormalizedCacheObject>\n\n static get image() {\n if (!GraphqlClient._image) {\n GraphqlClient._image = new Image()\n GraphqlClient._image.src = new URL('../icons/symbol-graphql-client.png', import.meta.url).href\n }\n\n return GraphqlClient._image\n }\n\n async ready() {\n await super.ready()\n\n this.init()\n }\n\n init() {\n var { endpoint } = this.state\n\n if (!endpoint) {\n console.warn('endpoint not defined')\n return\n }\n\n var cache = new InMemoryCache()\n const httpOptions: HttpOptions = {\n uri: endpoint,\n credentials: 'include'\n }\n\n const client = new ApolloClient({\n defaultOptions,\n cache,\n link: from([onError(ERROR_HANDLER), new HttpLink(httpOptions)])\n })\n\n this._client = client\n }\n\n get client(): ApolloClient<NormalizedCacheObject> | undefined {\n return this._client\n }\n\n dispose() {\n super.dispose()\n\n try {\n if (this._client) {\n this._client.stop()\n }\n } catch (e) {\n console.error(e)\n }\n delete this._client\n }\n\n render(context: CanvasRenderingContext2D) {\n /*\n * TODO role이 publisher 인지 subscriber 인지에 따라서 구분할 수 있는 표시를 추가할 것.\n */\n\n var { left, top, width, height } = this.bounds\n\n context.beginPath()\n this.drawImage(context, GraphqlClient.image, left, top, width, height)\n }\n\n onchangeData(data: any, before: any) {\n super.onchangeData(data, before)\n }\n\n get nature() {\n return NATURE\n }\n}\n"]}
|