@operato/scene-restful 10.0.0-beta.2 → 10.0.0-beta.30
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/README.md +29 -9
- package/dist/restful.d.ts +73 -73
- package/dist/restful.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,13 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
# @operato/scene-restful
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Restful Client Component for Things Scene
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
| ---- | -------------------------- | -------------- | ------ |
|
|
7
|
-
| UMD | things-scene-restful.js | modern browser | O |
|
|
8
|
-
| UMD | things-scene-restful-ie.js | ie 11 | O |
|
|
9
|
-
| ESM | things-scene-restful.mjs | modern browser | O |
|
|
5
|
+
<!-- AUTOGEN_BEGIN: do not edit between markers (run scripts/regenerate-readmes.mjs to update) -->
|
|
10
6
|
|
|
11
|
-
##
|
|
7
|
+
## Components
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
- `Restful`
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
yarn add @operato/scene-restful
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { Restful } from '@operato/scene-restful'
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Build
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
yarn build
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Output: ESM module at `dist/index.js` (single bundle, no UMD/IE legacy).
|
|
30
|
+
|
|
31
|
+
_Version: 10.0.0-beta.2_
|
|
32
|
+
|
|
33
|
+
<!-- AUTOGEN_END -->
|
package/dist/restful.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentNature, Shape } from '@hatiolab/things-scene';
|
|
2
2
|
declare const Restful_base: (new (...args: any[]) => {
|
|
3
3
|
_convertDataFormat(data: any, format: any): any;
|
|
4
4
|
isDataSource(): boolean;
|
|
@@ -32,7 +32,7 @@ declare const Restful_base: (new (...args: any[]) => {
|
|
|
32
32
|
get disposed(): boolean;
|
|
33
33
|
isLayer(): boolean;
|
|
34
34
|
isGroup(): boolean;
|
|
35
|
-
isContainer(): this is import("@hatiolab/things-scene
|
|
35
|
+
isContainer(): this is import("@hatiolab/things-scene").Container;
|
|
36
36
|
isLine(): boolean;
|
|
37
37
|
isRoot(): boolean;
|
|
38
38
|
isRootModel(): boolean;
|
|
@@ -48,9 +48,9 @@ declare const Restful_base: (new (...args: any[]) => {
|
|
|
48
48
|
get(property: any): any;
|
|
49
49
|
set(props: any, propval?: any): any;
|
|
50
50
|
getState(property: any): any;
|
|
51
|
-
setState(props:
|
|
51
|
+
setState(props: Partial<import("@hatiolab/things-scene").State> | string, propval?: any): any;
|
|
52
52
|
get model(): any;
|
|
53
|
-
get state():
|
|
53
|
+
get state(): import("@hatiolab/things-scene").State;
|
|
54
54
|
get hierarchy(): any;
|
|
55
55
|
get volatile(): never[];
|
|
56
56
|
_applyProps(target: any, props: any, options: any): any;
|
|
@@ -92,7 +92,7 @@ declare const Restful_base: (new (...args: any[]) => {
|
|
|
92
92
|
prerender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
93
93
|
render(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
94
94
|
postrender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
95
|
-
prepare(resolve: (component: Component) => void, reject: (reason: any) => void): void;
|
|
95
|
+
prepare(resolve: (component: import("@hatiolab/things-scene").Component) => void, reject: (reason: any) => void): void;
|
|
96
96
|
prepareIf(condition: boolean): void;
|
|
97
97
|
drawText(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
98
98
|
drawStroke(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
|
|
@@ -143,16 +143,16 @@ declare const Restful_base: (new (...args: any[]) => {
|
|
|
143
143
|
get started(): boolean;
|
|
144
144
|
set started(v: boolean): any;
|
|
145
145
|
get controls(): import("@hatiolab/things-scene").Control[] | undefined;
|
|
146
|
-
findFirst(finder: string | ((c: Component) => boolean), ...others: any[]): Component | undefined;
|
|
147
|
-
findAll(s: string | ((c: Component) => boolean), ...others: any[]): any[] | undefined;
|
|
148
|
-
capture(x: number, y: number, except?: (c: Component) => boolean): any;
|
|
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
149
|
findAnchor(name: string): any;
|
|
150
|
-
isDescendible(container: Component): boolean;
|
|
150
|
+
isDescendible(container: import("@hatiolab/things-scene").Component): boolean;
|
|
151
151
|
getContext(component?: unknown): any;
|
|
152
|
-
get root(): Component;
|
|
153
|
-
get rootModel(): Component;
|
|
154
|
-
get parent(): Component;
|
|
155
|
-
set parent(v: Component): 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
156
|
get anchors(): import("@hatiolab/things-scene").Anchor[];
|
|
157
157
|
get scalable(): boolean;
|
|
158
158
|
get stuck(): boolean;
|
|
@@ -178,20 +178,20 @@ declare const Restful_base: (new (...args: any[]) => {
|
|
|
178
178
|
ondropfile(transfered: FileList, files: string[]): void;
|
|
179
179
|
transcoordS2P(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
180
180
|
transcoordP2S(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
181
|
-
transcoordS2T(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
182
|
-
transcoordT2P(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
183
|
-
transcoordT2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
184
|
-
transcoordS2TR(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
185
|
-
transcoordS2O(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
186
|
-
transcoordC2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
187
|
-
transcoordS2C(x: number, y: number, top?: Component): 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
188
|
toParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
189
189
|
fromParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
190
|
-
toScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
191
|
-
fromScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
192
|
-
toLocal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
193
|
-
toGlobal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
194
|
-
toOther(x: number, y: number, target: Component): 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
195
|
on(name: string | object, callback: Function, context?: any): any;
|
|
196
196
|
off(name?: string | object, callback?: Function, context?: any): any;
|
|
197
197
|
once(name: string | object, callback: Function, context?: any): any;
|
|
@@ -201,24 +201,24 @@ declare const Restful_base: (new (...args: any[]) => {
|
|
|
201
201
|
onchange(after: Record<string, any>, before: Record<string, any>): void;
|
|
202
202
|
calculateBounds?(): void;
|
|
203
203
|
oncreate_element?(element: HTMLElement): void;
|
|
204
|
-
removeComponent(component: Component, ghost?: boolean): void;
|
|
205
|
-
addComponent(component: Component, ghost?: boolean): void;
|
|
206
|
-
insertComponentAt(component: Component, index: number, ghost?: boolean): void;
|
|
207
|
-
getOverlay(component: Component): HTMLElement | undefined;
|
|
208
|
-
findById(id: string): Component | undefined;
|
|
209
|
-
findByRefid(ref: string | number): Component | undefined;
|
|
210
|
-
findAllById(id: string): Component[];
|
|
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
211
|
resize(): void;
|
|
212
212
|
fit(type?: string): void;
|
|
213
|
-
get components(): Component[] | undefined;
|
|
213
|
+
get components(): import("@hatiolab/things-scene").Component[] | undefined;
|
|
214
214
|
get layout(): any;
|
|
215
215
|
get auxOverlay(): HTMLElement | undefined;
|
|
216
216
|
get isReady(): boolean;
|
|
217
217
|
get unitScale(): number;
|
|
218
|
-
get selected(): Component[];
|
|
219
|
-
set selected(_v: Component[]): any;
|
|
220
|
-
get focused(): Component | null;
|
|
221
|
-
set focused(_v: Component | null): any;
|
|
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
222
|
get hasSameParentForAllSelected(): boolean;
|
|
223
223
|
set hasSameParentForAllSelected(_v: boolean): any;
|
|
224
224
|
get fitMode(): string | undefined;
|
|
@@ -275,7 +275,7 @@ declare const Restful_base: (new (...args: any[]) => {
|
|
|
275
275
|
get disposed(): boolean;
|
|
276
276
|
isLayer(): boolean;
|
|
277
277
|
isGroup(): boolean;
|
|
278
|
-
isContainer(): this is import("@hatiolab/things-scene
|
|
278
|
+
isContainer(): this is import("@hatiolab/things-scene").Container;
|
|
279
279
|
isLine(): boolean;
|
|
280
280
|
isRoot(): boolean;
|
|
281
281
|
isRootModel(): boolean;
|
|
@@ -291,9 +291,9 @@ declare const Restful_base: (new (...args: any[]) => {
|
|
|
291
291
|
get(property: any): any;
|
|
292
292
|
set(props: any, propval?: any): any;
|
|
293
293
|
getState(property: any): any;
|
|
294
|
-
setState(props:
|
|
294
|
+
setState(props: Partial<import("@hatiolab/things-scene").State> | string, propval?: any): any;
|
|
295
295
|
get model(): any;
|
|
296
|
-
get state():
|
|
296
|
+
get state(): import("@hatiolab/things-scene").State;
|
|
297
297
|
get hierarchy(): any;
|
|
298
298
|
get volatile(): never[];
|
|
299
299
|
_applyProps(target: any, props: any, options: any): any;
|
|
@@ -329,7 +329,7 @@ declare const Restful_base: (new (...args: any[]) => {
|
|
|
329
329
|
draw(context?: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
330
330
|
prerender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
331
331
|
postrender(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
332
|
-
prepare(resolve: (component: Component) => void, reject: (reason: any) => void): void;
|
|
332
|
+
prepare(resolve: (component: import("@hatiolab/things-scene").Component) => void, reject: (reason: any) => void): void;
|
|
333
333
|
prepareIf(condition: boolean): void;
|
|
334
334
|
drawText(context: import("@hatiolab/things-scene").SceneRenderContext): void;
|
|
335
335
|
drawStroke(context: import("@hatiolab/things-scene").SceneRenderContext, override?: Record<string, unknown>): void;
|
|
@@ -380,16 +380,16 @@ declare const Restful_base: (new (...args: any[]) => {
|
|
|
380
380
|
get started(): boolean;
|
|
381
381
|
set started(v: boolean): any;
|
|
382
382
|
get controls(): import("@hatiolab/things-scene").Control[] | undefined;
|
|
383
|
-
findFirst(finder: string | ((c: Component) => boolean), ...others: any[]): Component | undefined;
|
|
384
|
-
findAll(s: string | ((c: Component) => boolean), ...others: any[]): any[] | undefined;
|
|
385
|
-
capture(x: number, y: number, except?: (c: Component) => boolean): any;
|
|
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
386
|
findAnchor(name: string): any;
|
|
387
|
-
isDescendible(container: Component): boolean;
|
|
387
|
+
isDescendible(container: import("@hatiolab/things-scene").Component): boolean;
|
|
388
388
|
getContext(component?: unknown): any;
|
|
389
|
-
get root(): Component;
|
|
390
|
-
get rootModel(): Component;
|
|
391
|
-
get parent(): Component;
|
|
392
|
-
set parent(v: Component): 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
393
|
get scalable(): boolean;
|
|
394
394
|
get stuck(): boolean;
|
|
395
395
|
get capturable(): boolean;
|
|
@@ -414,20 +414,20 @@ declare const Restful_base: (new (...args: any[]) => {
|
|
|
414
414
|
ondropfile(transfered: FileList, files: string[]): void;
|
|
415
415
|
transcoordS2P(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
416
416
|
transcoordP2S(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
417
|
-
transcoordS2T(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
418
|
-
transcoordT2P(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
419
|
-
transcoordT2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
420
|
-
transcoordS2TR(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
421
|
-
transcoordS2O(x: number, y: number, target: Component): import("@hatiolab/things-scene").POINT;
|
|
422
|
-
transcoordC2S(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
423
|
-
transcoordS2C(x: number, y: number, top?: Component): 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
424
|
toParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
425
425
|
fromParent(x: number, y: number, rp?: import("@hatiolab/things-scene").POINT): import("@hatiolab/things-scene").POINT;
|
|
426
|
-
toScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
427
|
-
fromScene(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
428
|
-
toLocal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
429
|
-
toGlobal(x: number, y: number, top?: Component): import("@hatiolab/things-scene").POINT;
|
|
430
|
-
toOther(x: number, y: number, target: Component): 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
431
|
on(name: string | object, callback: Function, context?: any): any;
|
|
432
432
|
off(name?: string | object, callback?: Function, context?: any): any;
|
|
433
433
|
once(name: string | object, callback: Function, context?: any): any;
|
|
@@ -437,24 +437,24 @@ declare const Restful_base: (new (...args: any[]) => {
|
|
|
437
437
|
onchange(after: Record<string, any>, before: Record<string, any>): void;
|
|
438
438
|
calculateBounds?(): void;
|
|
439
439
|
oncreate_element?(element: HTMLElement): void;
|
|
440
|
-
removeComponent(component: Component, ghost?: boolean): void;
|
|
441
|
-
addComponent(component: Component, ghost?: boolean): void;
|
|
442
|
-
insertComponentAt(component: Component, index: number, ghost?: boolean): void;
|
|
443
|
-
getOverlay(component: Component): HTMLElement | undefined;
|
|
444
|
-
findById(id: string): Component | undefined;
|
|
445
|
-
findByRefid(ref: string | number): Component | undefined;
|
|
446
|
-
findAllById(id: string): Component[];
|
|
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
447
|
resize(): void;
|
|
448
448
|
fit(type?: string): void;
|
|
449
|
-
get components(): Component[] | undefined;
|
|
449
|
+
get components(): import("@hatiolab/things-scene").Component[] | undefined;
|
|
450
450
|
get layout(): any;
|
|
451
451
|
get auxOverlay(): HTMLElement | undefined;
|
|
452
452
|
get isReady(): boolean;
|
|
453
453
|
get unitScale(): number;
|
|
454
|
-
get selected(): Component[];
|
|
455
|
-
set selected(_v: Component[]): any;
|
|
456
|
-
get focused(): Component | null;
|
|
457
|
-
set focused(_v: Component | null): any;
|
|
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
458
|
get hasSameParentForAllSelected(): boolean;
|
|
459
459
|
set hasSameParentForAllSelected(_v: boolean): any;
|
|
460
460
|
get fitMode(): string | undefined;
|
package/dist/restful.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restful.js","sourceRoot":"","sources":["../src/restful.ts"],"names":[],"mappings":";;AAAA,OAAO,EAA8B,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAEtH,OAAO,KAAK,MAAM,YAAY,CAAA;AAE9B,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;IACf,UAAU,EAAE;QACV;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;YACf,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE;gBACR,OAAO,EAAE;oBACP;wBACE,OAAO,EAAE,KAAK;wBACd,KAAK,EAAE,KAAK;qBACb;oBACD;wBACE,OAAO,EAAE,MAAM;wBACf,KAAK,EAAE,MAAM;qBACd;oBACD;wBACE,OAAO,EAAE,KAAK;wBACd,KAAK,EAAE,KAAK;qBACb;oBACD;wBACE,OAAO,EAAE,QAAQ;wBACjB,KAAK,EAAE,QAAQ;qBAChB;iBACF;aACF;SACF;QACD;YACE,IAAI,EAAE,QAAQ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QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;QAE1C,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,OAAM;QACR,CAAC;QAED,IAAI,UAAU,KAAK,MAAM,EAAE,CAAC;YAC1B,IAAI,CAAC,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QACnC,CAAC;aAAM,IAAI,UAAU,KAAK,MAAM,EAAE,CAAC;YACjC,IAAI,CAAC,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QACnC,CAAC;IACH,CAAC;IAED,MAAM,CAAC,OAAiC;QACtC,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,SAAO,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;IAClE,CAAC;IAED,UAAU,CAAC,CAAQ;QACjB,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;YACd,IAAI,CAAC,WAAW,CAAC,CAAA;YACjB,OAAM;QACR,CAAC;QAED,IAAI,CAAC,KAAK,EAAE,CAAA;IACd,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,EAAE,CAAA;IACX,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA;AA/MoB,OAAO;IAD3B,cAAc,CAAC,SAAS,CAAC;GACL,OAAO,CA+M3B;eA/MoB,OAAO","sourcesContent":["import { Component, ComponentNature, DataSource, RectPath, sceneComponent, Shape, warn } from '@hatiolab/things-scene'\n\nimport jsonp from './jsonp.js'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'select',\n label: 'method',\n name: 'method',\n property: {\n options: [\n {\n display: 'GET',\n value: 'GET'\n },\n {\n display: 'POST',\n value: 'POST'\n },\n {\n display: 'PUT',\n value: 'PUT'\n },\n {\n display: 'DELETE',\n value: 'DELETE'\n }\n ]\n }\n },\n {\n type: 'string',\n label: 'url',\n name: 'url'\n },\n {\n type: 'string',\n label: 'authorization',\n name: 'authorization'\n },\n {\n type: 'select',\n label: 'data-format',\n name: 'dataFormat',\n property: {\n options: [\n {\n display: 'json',\n value: 'json'\n },\n {\n display: 'jsonp',\n value: 'jsonp'\n },\n {\n display: 'text',\n value: 'text'\n }\n ]\n }\n },\n {\n type: 'select',\n label: 'content-type',\n name: 'contentType',\n property: {\n options: [\n {\n display: 'application/json',\n value: 'application/json'\n },\n {\n display: 'application/x-www-form-urlencoded',\n value: 'application/x-www-form-urlencoded'\n },\n {\n display: 'text/plain',\n value: 'text/plain'\n }\n ]\n }\n },\n {\n type: 'select',\n label: 'mode',\n name: 'mode',\n property: {\n options: [\n {\n display: 'cors',\n value: 'cors'\n },\n {\n display: 'no-cors',\n value: 'no-cors'\n },\n {\n display: 'same-origin',\n value: 'same-origin'\n }\n ]\n }\n },\n {\n type: 'select',\n label: 'credentials',\n name: 'credentials',\n property: {\n options: [\n {\n display: 'same-origin',\n value: 'same-origin'\n },\n {\n display: 'include',\n value: 'include'\n },\n {\n display: 'omit',\n value: 'omit'\n }\n ]\n }\n },\n {\n type: 'select',\n label: 'cache',\n name: 'cache',\n property: {\n options: [\n {\n display: 'default',\n value: 'default'\n },\n {\n display: 'no-cache',\n value: 'no-cache'\n },\n {\n display: 'reload',\n value: 'reload'\n },\n {\n display: 'force-cache',\n value: 'force-cache'\n },\n {\n display: 'only-if-cached',\n value: 'only-if-cached'\n }\n ]\n }\n },\n {\n type: 'select',\n label: 'redirect',\n name: 'redirect',\n property: {\n options: [\n {\n display: 'follow',\n value: 'follow'\n },\n {\n display: 'manual',\n value: 'manual'\n },\n {\n display: 'error',\n value: 'error'\n }\n ]\n }\n },\n {\n type: 'select',\n label: 'referrer-policy',\n name: 'referrerPolicy',\n property: {\n options: [\n {\n display: 'no-referrer-when-downgrade',\n value: 'no-referrer-when-downgrade'\n },\n {\n display: 'no-referrer',\n value: 'no-referrer'\n },\n {\n display: 'origin',\n value: 'origin'\n },\n {\n display: 'origin-when-cross-origin',\n value: 'origin-when-cross-origin'\n },\n {\n display: 'same-origin',\n value: 'same-origin'\n },\n {\n display: 'strict-origin',\n value: 'strict-origin'\n },\n {\n display: 'strict-origin-when-cross-origin',\n value: 'strict-origin-when-cross-origin'\n },\n {\n display: 'unsafe-url',\n value: 'unsafe-url'\n }\n ]\n }\n },\n {\n type: 'key-values',\n label: 'headers',\n name: 'headers'\n },\n {\n type: 'number',\n label: 'period',\n name: 'period',\n placeholder: 'SECONDS'\n },\n {\n type: 'checkbox',\n label: 'fetch-on-load',\n name: 'fetchOnLoad'\n }\n ],\n help: 'scene/component/restful'\n}\n\nconst REST_IMAGE =\n 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKIAAACWCAMAAABqx6OSAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAB1WlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx0aWZmOkNvbXByZXNzaW9uPjE8L3RpZmY6Q29tcHJlc3Npb24+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3R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QWvh7nhJTs3vKrohhc+p+b2Jkm496nUB85/+dgNr3BLS2UTmmyFF6c+LeenE3BDUgY3pLawPkHIgQnJqJyfZsXiZDUmJexzfsofNyROsij91K7JSfqcn8RrygWp0HBFrpm2BhC0JqEc3mvdMGlVxKq0fGSscXpywyk3pIgkNenwRJuyl3R6ulKyXOH0pK9ydOHw1LmycALisaN3yL4ExIqFOzyNc3/N9EMy7IOAs5Jh/5M79D8U6UTFcE/VFgAAAABJRU5ErkJggg=='\n\nconst WARN_NO_URL = 'Valid URL property required'\n\n@sceneComponent('restful')\nexport default class Restful extends DataSource(RectPath(Shape)) {\n static _image: HTMLImageElement\n\n static get image() {\n if (!Restful._image) {\n Restful._image = new Image()\n Restful._image.src = REST_IMAGE\n }\n\n return Restful._image\n }\n\n private _repeatTimer!: number\n private _isStarted = false\n\n get url() {\n return this.getState('url')\n }\n\n set url(url) {\n this.setState('url', url)\n this._initRestful()\n }\n\n get period() {\n return Number(this.state.period) * 1000\n }\n\n set period(period) {\n this.setState('period', Number(period))\n this._initRestful()\n }\n\n get value() {\n return this.state.value\n }\n\n set value(value) {\n this.setState('value', value)\n this._initRestful(true)\n }\n\n get withCredentials() {\n return !!this.getState('withCredentials')\n }\n\n set withCredentials(withCredentials) {\n this.setState('withCredentials', withCredentials)\n this._initRestful()\n }\n\n get repeatTimer() {\n return this._repeatTimer\n }\n\n set repeatTimer(repeatTimer) {\n this._stopRepeater()\n this._repeatTimer = repeatTimer\n }\n\n async ready() {\n await super.ready()\n this._initRestful(this.state.fetchOnLoad)\n }\n\n _initRestful(force: boolean = false) {\n if (!this.app.isViewMode) return\n\n if (!this.url) {\n warn(WARN_NO_URL)\n return\n }\n\n this._stopRepeater()\n if (this.period > 0) {\n this._startRepeater()\n } else {\n force && this.fetch()\n }\n }\n\n dispose() {\n super.dispose()\n this._stopRepeater()\n }\n\n _startRepeater() {\n this._isStarted = true\n\n var self = this\n\n function _() {\n if (!self._isStarted) {\n return\n }\n self.fetch()\n\n if (!self.period) {\n self._stopRepeater()\n return\n }\n\n self._repeatTimer = setTimeout(() => {\n requestAnimationFrame(_)\n }, self.period)\n }\n\n requestAnimationFrame(_)\n }\n\n _stopRepeater() {\n this._isStarted = false\n if (this.repeatTimer) {\n clearTimeout(this._repeatTimer)\n }\n }\n\n async fetch() {\n var {\n url,\n method = 'GET',\n mode = 'cors',\n cache = 'default',\n credentials = 'same-origin',\n redirect = 'follow',\n referrerPolicy = 'no-referrer-when-downgrade',\n contentType = 'application/json',\n dataFormat = 'json',\n headers = {},\n value\n } = this.state\n\n if (dataFormat == 'jsonp') {\n if (value && typeof value == 'string') {\n url = value\n }\n\n jsonp(url, {}, (self, data) => {\n if (this._isStarted && data) {\n this.data = data\n }\n })\n\n return\n }\n\n var options: any = {\n method,\n mode,\n cache,\n credentials,\n headers: {\n 'Content-Type': contentType,\n ...headers\n },\n redirect,\n referrerPolicy\n }\n\n if (method != 'GET' && method != 'HEAD') {\n if (contentType == 'application/json') {\n options.body = JSON.stringify(value)\n } else {\n options.body = value\n }\n } else {\n if (value && typeof value == 'string') {\n url = value\n }\n }\n\n const response = await fetch(url, options)\n\n if (!this._isStarted) {\n return\n }\n\n if (dataFormat === 'json') {\n this.data = await response.json()\n } else if (dataFormat === 'text') {\n this.data = await response.text()\n }\n }\n\n render(context: CanvasRenderingContext2D) {\n var { left, top, width, height } = this.bounds\n\n context.beginPath()\n this.drawImage(context, Restful.image, left, top, width, height)\n }\n\n ondblclick(e: Event) {\n if (!this.url) {\n warn(WARN_NO_URL)\n return\n }\n\n this.fetch()\n }\n\n get controls() {\n return []\n }\n\n get nature() {\n return NATURE\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"restful.js","sourceRoot":"","sources":["../src/restful.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAmB,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAE3G,OAAO,KAAK,MAAM,YAAY,CAAA;AAE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AAI,CAAC,GAAG,EAAE,CAAC;YACd,IAAI,CAAC,WAAW,CAAC,CAAA;YACjB,OAAM;QACR,CAAC;QAED,IAAI,CAAC,KAAK,EAAE,CAAA;IACd,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,EAAE,CAAA;IACX,CAAC;IAED,IAAI,MAAM;QACR,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA;AA/MoB,OAAO;IAD3B,cAAc,CAAC,SAAS,CAAC;GACL,OAAO,CA+M3B;eA/MoB,OAAO","sourcesContent":["import { ComponentNature, DataSource, RectPath, sceneComponent, Shape, warn } from '@hatiolab/things-scene'\n\nimport jsonp from './jsonp.js'\n\nconst NATURE: ComponentNature = {\n mutable: false,\n resizable: true,\n rotatable: true,\n properties: [\n {\n type: 'select',\n label: 'method',\n name: 'method',\n property: {\n options: [\n {\n display: 'GET',\n value: 'GET'\n },\n {\n display: 'POST',\n value: 'POST'\n },\n {\n display: 'PUT',\n value: 'PUT'\n },\n {\n display: 'DELETE',\n value: 'DELETE'\n }\n ]\n }\n },\n {\n type: 'string',\n label: 'url',\n name: 'url'\n },\n {\n type: 'string',\n label: 'authorization',\n name: 'authorization'\n },\n {\n type: 'select',\n label: 'data-format',\n name: 'dataFormat',\n property: {\n options: [\n {\n display: 'json',\n value: 'json'\n },\n {\n display: 'jsonp',\n value: 'jsonp'\n },\n {\n display: 'text',\n value: 'text'\n }\n ]\n }\n },\n {\n type: 'select',\n label: 'content-type',\n name: 'contentType',\n property: {\n options: [\n {\n display: 'application/json',\n value: 'application/json'\n },\n {\n display: 'application/x-www-form-urlencoded',\n value: 'application/x-www-form-urlencoded'\n },\n {\n display: 'text/plain',\n value: 'text/plain'\n }\n ]\n }\n },\n {\n type: 'select',\n label: 'mode',\n name: 'mode',\n property: {\n options: [\n {\n display: 'cors',\n value: 'cors'\n },\n {\n display: 'no-cors',\n value: 'no-cors'\n },\n {\n display: 'same-origin',\n value: 'same-origin'\n }\n ]\n }\n },\n {\n type: 'select',\n label: 'credentials',\n name: 'credentials',\n property: {\n options: [\n {\n display: 'same-origin',\n value: 'same-origin'\n },\n {\n display: 'include',\n value: 'include'\n },\n {\n display: 'omit',\n value: 'omit'\n }\n ]\n }\n },\n {\n type: 'select',\n label: 'cache',\n name: 'cache',\n property: {\n options: [\n {\n display: 'default',\n value: 'default'\n },\n {\n display: 'no-cache',\n value: 'no-cache'\n },\n {\n display: 'reload',\n value: 'reload'\n },\n {\n display: 'force-cache',\n value: 'force-cache'\n },\n {\n display: 'only-if-cached',\n value: 'only-if-cached'\n }\n ]\n }\n },\n {\n type: 'select',\n label: 'redirect',\n name: 'redirect',\n property: {\n options: [\n {\n display: 'follow',\n value: 'follow'\n },\n {\n display: 'manual',\n value: 'manual'\n },\n {\n display: 'error',\n value: 'error'\n }\n ]\n }\n },\n {\n type: 'select',\n label: 'referrer-policy',\n name: 'referrerPolicy',\n property: {\n options: [\n {\n display: 'no-referrer-when-downgrade',\n value: 'no-referrer-when-downgrade'\n },\n {\n display: 'no-referrer',\n value: 'no-referrer'\n },\n {\n display: 'origin',\n value: 'origin'\n },\n {\n display: 'origin-when-cross-origin',\n value: 'origin-when-cross-origin'\n },\n {\n display: 'same-origin',\n value: 'same-origin'\n },\n {\n display: 'strict-origin',\n value: 'strict-origin'\n },\n {\n display: 'strict-origin-when-cross-origin',\n value: 'strict-origin-when-cross-origin'\n },\n {\n display: 'unsafe-url',\n value: 'unsafe-url'\n }\n ]\n }\n },\n {\n type: 'key-values',\n label: 'headers',\n name: 'headers'\n },\n {\n type: 'number',\n label: 'period',\n name: 'period',\n placeholder: 'SECONDS'\n },\n {\n type: 'checkbox',\n label: 'fetch-on-load',\n name: 'fetchOnLoad'\n }\n ],\n help: 'scene/component/restful'\n}\n\nconst REST_IMAGE =\n 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKIAAACWCAMAAABqx6OSAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgA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7Av7VeJzGKuPLZ6RX7gC1cjnRwGP2WFj5OryTEeLU/c+lc9MMDgvhMRdQ9vdI1SQU3zWbzjHRvMVaX/i4C9rI5oIeMAOFp8br68FC7LiXY929mpLt3H9fpjE5S9U31hfe4XgTS36IS9/cl4lm0tBKAxQ3Wmajc1YdIneq7YMHEDctOLli8c8ESqAsWkl2wHD98U6N4JFixqSEcFYdtavwyujXUzsfjUbO3hqLxeL5tdGtoxAZb+7F5Zu4G21nzsW18g422TZnsb1N2zd2m7Pa3KZMGtimpm70ZZSKoDgG+utnbCzVaGUObvdQt82ip0pBUM3vLvIZLrZSixrbM3XDwwAXHN1xwCGZqPmw/4ZijRC44kOWGY23Tzj8caP8Ry8Xxr5Hv2Eu4o+MldBcc93XBoWk3HD13wQF+2jxrQtL9GoQLXiZxwys5bnixyQWvh7nhJTs3vKrohhc+p+b2Jkm496nUB85/+dgNr3BLS2UTmmyFF6c+LeenE3BDUgY3pLawPkHIgQnJqJyfZsXiZDUmJexzfsofNyROsij91K7JSfqcn8RrygWp0HBFrpm2BhC0JqEc3mvdMGlVxKq0fGSscXpywyk3pIgkNenwRJuyl3R6ulKyXOH0pK9ydOHw1LmycALisaN3yL4ExIqFOzyNc3/N9EMy7IOAs5Jh/5M79D8U6UTFcE/VFgAAAABJRU5ErkJggg=='\n\nconst WARN_NO_URL = 'Valid URL property required'\n\n@sceneComponent('restful')\nexport default class Restful extends DataSource(RectPath(Shape)) {\n static _image: HTMLImageElement\n\n static get image() {\n if (!Restful._image) {\n Restful._image = new Image()\n Restful._image.src = REST_IMAGE\n }\n\n return Restful._image\n }\n\n private _repeatTimer!: number\n private _isStarted = false\n\n get url() {\n return this.getState('url')\n }\n\n set url(url) {\n this.setState('url', url)\n this._initRestful()\n }\n\n get period() {\n return Number(this.state.period) * 1000\n }\n\n set period(period) {\n this.setState('period', Number(period))\n this._initRestful()\n }\n\n get value() {\n return this.state.value\n }\n\n set value(value) {\n this.setState('value', value)\n this._initRestful(true)\n }\n\n get withCredentials() {\n return !!this.getState('withCredentials')\n }\n\n set withCredentials(withCredentials) {\n this.setState('withCredentials', withCredentials)\n this._initRestful()\n }\n\n get repeatTimer() {\n return this._repeatTimer\n }\n\n set repeatTimer(repeatTimer) {\n this._stopRepeater()\n this._repeatTimer = repeatTimer\n }\n\n async ready() {\n await super.ready()\n this._initRestful(this.state.fetchOnLoad)\n }\n\n _initRestful(force: boolean = false) {\n if (!this.app.isViewMode) return\n\n if (!this.url) {\n warn(WARN_NO_URL)\n return\n }\n\n this._stopRepeater()\n if (this.period > 0) {\n this._startRepeater()\n } else {\n force && this.fetch()\n }\n }\n\n dispose() {\n super.dispose()\n this._stopRepeater()\n }\n\n _startRepeater() {\n this._isStarted = true\n\n var self = this\n\n function _() {\n if (!self._isStarted) {\n return\n }\n self.fetch()\n\n if (!self.period) {\n self._stopRepeater()\n return\n }\n\n self._repeatTimer = setTimeout(() => {\n requestAnimationFrame(_)\n }, self.period)\n }\n\n requestAnimationFrame(_)\n }\n\n _stopRepeater() {\n this._isStarted = false\n if (this.repeatTimer) {\n clearTimeout(this._repeatTimer)\n }\n }\n\n async fetch() {\n var {\n url,\n method = 'GET',\n mode = 'cors',\n cache = 'default',\n credentials = 'same-origin',\n redirect = 'follow',\n referrerPolicy = 'no-referrer-when-downgrade',\n contentType = 'application/json',\n dataFormat = 'json',\n headers = {},\n value\n } = this.state\n\n if (dataFormat == 'jsonp') {\n if (value && typeof value == 'string') {\n url = value\n }\n\n jsonp(url, {}, (self, data) => {\n if (this._isStarted && data) {\n this.data = data\n }\n })\n\n return\n }\n\n var options: any = {\n method,\n mode,\n cache,\n credentials,\n headers: {\n 'Content-Type': contentType,\n ...headers\n },\n redirect,\n referrerPolicy\n }\n\n if (method != 'GET' && method != 'HEAD') {\n if (contentType == 'application/json') {\n options.body = JSON.stringify(value)\n } else {\n options.body = value\n }\n } else {\n if (value && typeof value == 'string') {\n url = value\n }\n }\n\n const response = await fetch(url, options)\n\n if (!this._isStarted) {\n return\n }\n\n if (dataFormat === 'json') {\n this.data = await response.json()\n } else if (dataFormat === 'text') {\n this.data = await response.text()\n }\n }\n\n render(context: CanvasRenderingContext2D) {\n var { left, top, width, height } = this.bounds\n\n context.beginPath()\n this.drawImage(context, Restful.image, left, top, width, height)\n }\n\n ondblclick(e: Event) {\n if (!this.url) {\n warn(WARN_NO_URL)\n return\n }\n\n this.fetch()\n }\n\n get controls() {\n return []\n }\n\n get nature() {\n return NATURE\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@operato/scene-restful",
|
|
3
3
|
"description": "Restful Client Component for Things Scene",
|
|
4
4
|
"author": "heartyoh",
|
|
5
|
-
"version": "10.0.0-beta.
|
|
5
|
+
"version": "10.0.0-beta.30",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/index.js",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"prettier --write"
|
|
59
59
|
]
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "06b35b1726ec4f27ee76657ce341c6c6f3ba1b3a"
|
|
62
62
|
}
|