@operato/scene-restful 0.1.2

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/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ### [0.1.2](https://github.com/things-scene/operato-scene/compare/v0.1.1...v0.1.2) (2022-01-13)
7
+
8
+ **Note:** Version bump only for package @operato/scene-restful
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Hearty, Oh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,13 @@
1
+ ## build
2
+
3
+ `$ yarn build`
4
+
5
+ | type | filename | for | tested |
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 |
10
+
11
+ ## publish
12
+
13
+ `$ yarn publish`
@@ -0,0 +1,12 @@
1
+ {
2
+ "SAMPLE": {
3
+ "name": "SAMPLE",
4
+ "description": "",
5
+ "width": 1920,
6
+ "height": 1080,
7
+ "updatedAt": 1524117648813,
8
+ "createdAt": 1524110268095,
9
+ "group": "DEFAULT-GROUP",
10
+ "thumbnail": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAADhCAYAAADmtuMcAAARIklEQVR4Xu3dbZCV5XkH8Os8uyiyy7KCWqqiVihirVA0MYzVRsmL1peQEF/itH7yJW2d6NhOtdRMRzqZdKJVnIk2mjGfbILRKio0VUuwppmYVjSjQpgoajA6JYq47LLI2zmnc7YBlUEXnt1z7r23v53xg+65n+vi93/kP885K1bCFwECBAgQKCFQKXHGEQIECBAgEArETUCAAAECpQQUSCk2hwgQIEBAgbgHCBAgQKCUgAIpxeYQAQIECCgQ9wABAgQIlBJQIKXYHCJAgAABBeIeIECAAIFSAgqkFJtDBAgQIKBA3AMECBAgUEpAgZRic4gAAQIEFIh7gAABAgRKCSiQUmwOESBAgIACcQ8QIECAQCkBBVKKzSECBAgQUCDuAQIECBAoJaBASrE5RIAAAQIKxD1AgAABAqUEFEgpNocIECBAQIG4BwgQIECglIACKcXmEAECBAgoEPcAAQIECJQSUCCl2BwiQIAAAQXiHiBAgACBUgIKpBSbQwQIECCgQNwDBAgQIFBKQIGUYnOIAAECBBSIe4AAAQIESgkokFJsDhEgQICAAnEPECBAgEApAQVSis0hAgQIEFAg7gECBAgQKCWgQEqxOUSAAAECCsQ9QIAAAQKlBBRIKTaHCBAgQECBuAcIECBAoJSAAinF5hABAgQIKBD3AAECBAiUElAgpdgcIkCAAAEF4h4gQIAAgVICCqQUm0MECBAgoEDcAwQIECBQSkCBlGJziAABAgQUiHuAAAECBEoJKJBSbA4RIECAgAJxDxAgQIBAKQEFU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b9OmmyNi3INHHHtEo0CWTJn22aISp9ajuurzr736Lw8fNfW6ea+9fNOH7ahABkvP9wkQIJBQYNcTyOfWvRS17dvjB8edUK/VYvfv3Y1/vvaf7oztPT2x9q7vvFcgXV1f6e3t/WbnhAlzi3r9D6Mo2urV6jcrlcofR8TESqWyPiJ+Z9OmTd94aMrUGyqVSi0q9faoV9qiEi9F1A+PHbVH6m2Vcz7/q1cW7Y1AgSS8MYwmQIDAYAK7CmTn9q0RtV0fWzQ+wmh81d77JKOIaB87bneBDHbd4fi+AhkORdcgQIBAkwQenjL1S2c8vmxGz/M/r3fNmFYZe8gh9a09PZX2sWPjgK7uOOCQibG9tzciilh23PHxxfWvD3wGctFFF51ZrxfjKpVaX0TbofV6vTsi1lerxaq2tvitoqhOKori6cWLF2+48MILJxdFMbvx97Va7aharX1HRG1CUdS2FUUxbvHixU96AmlSwC5LgACBZgo8OvPkk477m+tO7D7hhBjTPT6q/VtrbWPHVA7o6qqMmTSpWu3vj9rWHW0PHT/9gYveemvz/uxyySWXnLB48eLVe545//xLDlm6dPGGj7qWJ5D9kfZaAgQIENgtoEDcDAQIECBQSkCBlGJziAABAgQUiHuAAAECBEoJKJBSbA4RIECAgAJxDxAgQIBAKYH/Bc5VOg+wNnUeAAAAAElFTkSuQmCC"
11
+ }
12
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "DEFAULT-GROUP": {
3
+ "name": "DEFAULT-GROUP",
4
+ "description": "",
5
+ "type": "group"
6
+ }
7
+ }
@@ -0,0 +1,70 @@
1
+ {
2
+ "width": 1920,
3
+ "height": 1080,
4
+ "type": "model-layer",
5
+ "translate": {
6
+ "x": 0,
7
+ "y": 264.53125
8
+ },
9
+ "scale": {
10
+ "x": 0.37864583333333335,
11
+ "y": 0.37864583333333335
12
+ },
13
+ "event": {
14
+ "hover": {},
15
+ "tap": {
16
+ "value": ""
17
+ }
18
+ },
19
+ "components": [
20
+ {
21
+ "type": "restful",
22
+ "xx": 0,
23
+ "left": 615.5295735900962,
24
+ "top": 281.36176066024746,
25
+ "width": 100,
26
+ "height": 100,
27
+ "hidden": false,
28
+ "dataFormat": "json",
29
+ "rotation": 0,
30
+ "url": "http://services.groupkt.com/country/get/iso2code/IN",
31
+ "withCredentials": true,
32
+ "period": 10,
33
+ "id": "rest"
34
+ },
35
+ {
36
+ "type": "rect",
37
+ "xx": 0,
38
+ "left": 1183.1636863823933,
39
+ "top": 270.79779917469045,
40
+ "width": 538.5832187070155,
41
+ "height": 100,
42
+ "fillStyle": "#fff",
43
+ "strokeStyle": "#000",
44
+ "alpha": 1,
45
+ "hidden": false,
46
+ "lineWidth": 1,
47
+ "lineDash": "solid",
48
+ "lineCap": "butt",
49
+ "rotation": 0,
50
+ "text": "URL",
51
+ "fontSize": 36,
52
+ "data": "https://httpbin.org/get",
53
+ "mappings": [
54
+ {
55
+ "rule": "value",
56
+ "target": "#rest",
57
+ "property": "value"
58
+ }
59
+ ],
60
+ "id": "url",
61
+ "event": {
62
+ "hover": {},
63
+ "tap": {
64
+ "target": "$url",
65
+ "value": "https://httpbin.org/get"
66
+ }
67
+ }
68
+ }
69
+ ]
70
+ }
@@ -0,0 +1,116 @@
1
+ <!--
2
+ @license
3
+ Copyright © HatioLab Inc. All rights reserved.
4
+ -->
5
+ <!doctype html>
6
+ <html>
7
+ <head>
8
+ <meta charset="utf-8">
9
+ <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
10
+ <title>restful Demo</title>
11
+ <script src="../../webcomponentsjs/webcomponents-lite.min.js"></script>
12
+
13
+ <link rel="import" href="../../things-scene-viewer/things-scene-viewer.html">
14
+ <link rel="import" href="../../things-scene-viewer/things-scene-layer.html">
15
+ <link rel="import" href="../../things-scene-viewer/things-scene-handler.html">
16
+
17
+ <link rel="import" href="../../things-designer-elements/things-editor-properties.html">
18
+
19
+ <link rel="import" href="./things-scene-restful.html">
20
+
21
+ <link rel="import" href="./things-theme.html">
22
+
23
+ <style is="custom-style" include="things-theme">
24
+ things-scene-viewer {
25
+ display: block;
26
+ width: 640px;
27
+ height: 480px;
28
+ }
29
+ </style>
30
+ </head>
31
+ <body unresolved>
32
+
33
+ <template is="dom-bind" id="app">
34
+ <p>An example of <code>&lt;restful&gt;</code>:</p>
35
+
36
+ <things-scene-viewer id='scene'
37
+ scene='{{scene}}'
38
+ selected='{{selected}}'
39
+ model='[[model]]'
40
+ mode="0">
41
+ <things-scene-layer type="selection-layer"></things-scene-layer>
42
+ <things-scene-layer type="modeling-layer"></things-scene-layer>
43
+ <things-scene-handler type="text-editor"></things-scene-handler>
44
+ <things-scene-handler type="move-handler"></things-scene-handler>
45
+ </things-scene-viewer>
46
+
47
+ <p>Properties</p>
48
+ <things-editor-properties id='props' target="{{props}}" props="[[selected.0.nature.properties]]">
49
+ </things-editor-properties>
50
+
51
+ </template>
52
+
53
+ <script>
54
+ window.addEventListener('WebComponentsReady', function(e) {
55
+ var app = document.querySelector('#app')
56
+
57
+ app.props = {}
58
+
59
+ setTimeout(function() {
60
+ app.scene.on('selected', function(after) {
61
+ var target = after[0]
62
+ var props = {}
63
+ if(target) {
64
+ target.nature.properties.forEach(function(prop) {
65
+ var property = prop.property
66
+ props[property] = target.model[property]
67
+ })
68
+ }
69
+ app.props = props
70
+ });
71
+ });
72
+
73
+ app.$.props.addEventListener('change', function() {
74
+ app.selected[0].set(app.props)
75
+ });
76
+
77
+ app.model = {
78
+ width: 640,
79
+ height: 480,
80
+ components: [{
81
+ type: 'restful',
82
+ top: 100,
83
+ left: 100,
84
+ width:200,
85
+ height: 70,
86
+ fontSize: 40,
87
+ fillStyle: '#00ff00',
88
+ fontColor: '#FF0000',
89
+ strokeStyle: '#000',
90
+ lineWidth: 5,
91
+ value: 40,
92
+ text: '#{value}',
93
+ lineCap: 'round',
94
+ url: 'http://factory.hatiolab.com/rest/publishers/initData?subject=/elidom/stomp/topic/hatiolab-hq/smart/SCENE-22',
95
+ period: 60
96
+ }, {
97
+ type: 'rect',
98
+ id: 'ss3Text',
99
+ top: 100,
100
+ left: 100,
101
+ width:200,
102
+ height: 70,
103
+ fontSize: 40,
104
+ fillStyle: '#00ff00',
105
+ fontColor: '#FF0000',
106
+ strokeStyle: '#000',
107
+ lineWidth: 5,
108
+ value: 40,
109
+ text: '#{data}',
110
+ lineCap: 'round'
111
+ }]
112
+ }
113
+ });
114
+ </script>
115
+ </body>
116
+ </html>
@@ -0,0 +1,5 @@
1
+ <!--
2
+ @license
3
+ Copyright © HatioLab Inc. All rights reserved.
4
+ -->
5
+ <script src="../things-scene-restful.js"></script>
@@ -0,0 +1,178 @@
1
+ <!--
2
+ @license
3
+ Copyright © HatioLab Inc. All rights reserved.
4
+ -->
5
+ <dom-module id="things-theme">
6
+ <template>
7
+ <style>
8
+ :root {
9
+ /* element reset style */
10
+ --paper-badge-background: rgba(0, 0, 0, 0.2);
11
+ --paper-badge-margin-left: -25px;
12
+ --paper-fab-background: var(--things-secondary-color);
13
+ --paper-fab-background: tomato;
14
+ --paper-input-container-focus-color: var(--things-secondary-color);
15
+ --paper-toolbar-background: transparent;
16
+
17
+ /* common style */
18
+ --border-radius-clear: {
19
+ -webkit-border-radius: 0px;
20
+ -moz-border-radius: 0px;
21
+ border-radius: 0px;
22
+ }
23
+ --things-default-padding: {
24
+ padding: 15px;
25
+ }
26
+ --things-tight-padding: {
27
+ padding: 7px;
28
+ }
29
+ --things-loose-padding: {
30
+ padding: 30px;
31
+ }
32
+ --things-table-padding: {
33
+ padding: 15px 15px 0 15px;
34
+ }
35
+ --things-padding-clear: {
36
+ padding: 0;
37
+ }
38
+ --things-default-margin: {
39
+ margin: 15px;
40
+ }
41
+ --things-margin-clear: {
42
+ margin: 0;
43
+ }
44
+
45
+ /* color style */
46
+ --things-primary-color: #826960;
47
+ --things-secondary-color: #aa866a;
48
+ --things-focus-background-color: #867f7c;
49
+ --things-primary-background-color: #826960;
50
+ --things-secondary-background-color: #aa866a;
51
+ --things-lightgrey-background-color: rgba(0, 0, 0, 0.15);
52
+ --things-white-color: #fff;
53
+ --things-error-color: var(--paper-deep-orange-700);
54
+ --things-primary-text-color: #726765;
55
+ --things-green-text-color: var(--paper-green-600);
56
+ --things-dark-text-color: #585858;
57
+
58
+ /* properties panel style */
59
+ --things-properties-panel: {
60
+ display: block;
61
+ width: 270px;
62
+ min-width: 270px;
63
+ background-color: var(--paper-blue-grey-50);
64
+ }
65
+
66
+ /* form style */
67
+ --things-label: {
68
+ position: relative;
69
+ top: -3px;
70
+ width: 25%;
71
+ min-height: 20px;
72
+ display: inline-block;
73
+ margin-bottom: 10px;
74
+ color: var(--things-primary-text-color);
75
+ font-size: 12px;
76
+ text-align: right;
77
+ font-weight: 100;
78
+ line-height: 1.6;
79
+ }
80
+ --things-input: {
81
+ width: 65%;
82
+ margin-bottom: 10px;
83
+ padding: 3px 5px 2px 5px;
84
+ -webkit-border-radius: 4px;
85
+ -moz-border-radius: 4px;
86
+ border-radius: 4px;
87
+ border: 1px solid rgba(0, 0, 0, 0.15);
88
+ font-size: 15px;
89
+ font-weight: 300;
90
+ }
91
+ --things-input-readonly-important: {
92
+ background-color: transparent;
93
+ padding: 0 0 0 3px;
94
+ position: relative;
95
+ top: -2px;
96
+ border-color: transparent;
97
+ font-weight: 600;
98
+ color: var(--things-primary-text-color);
99
+ }
100
+ --things-textarea-label-width: 12.25%;
101
+ --things-textarea-width: 94.5%;
102
+ --things-textarea: {
103
+ -webkit-border-radius: 4px;
104
+ -moz-border-radius: 4px;
105
+ border-radius: 4px;
106
+ border: 1px solid rgba(0, 0, 0, 0.2);
107
+ color: var(--things-primary-text-color);
108
+ font-size: 13px;
109
+ width: 100%;
110
+ height: 84%;
111
+ padding: 1%;
112
+ }
113
+ --things-fieldset: {
114
+ border: none;
115
+ margin: 0;
116
+ padding: 9px 0 0 0;
117
+ border-bottom: 1px solid #cfd8dc;
118
+ color: var(--things-primary-text-color);
119
+ font-size: 12px;
120
+ }
121
+ --things-fieldset-legend: {
122
+ padding: 9px 0 0 7px;
123
+ font-size: 11px;
124
+ color: #e46c2e;
125
+ font-weight: bold;
126
+ text-transform: capitalize;
127
+ }
128
+ --things-select: {
129
+ max-width: 69%;
130
+ min-width: 50%;
131
+ margin-bottom: 10px;
132
+ padding: 3px 20px 2px 5px;
133
+ -webkit-border-radius: 4px;
134
+ -moz-border-radius: 4px;
135
+ border-radius: 4px;
136
+ border: 1px solid rgba(0, 0, 0, 0.15);
137
+ font-size: 15px;
138
+ font-weight: 300;
139
+ -webkit-appearance: none;
140
+ }
141
+ --things-input-color: {
142
+ position: relative;
143
+ margin-left: -30px;
144
+ width: 25px;
145
+ height: 21px;
146
+ border: none;
147
+ padding: 0;
148
+ }
149
+ --things-properties-icon-only-label: {
150
+ width: 30px;
151
+ height: 24px;
152
+ margin-top: 2px;
153
+ margin-bottom: 5px;
154
+ }
155
+ --things-editor-colorbar: {
156
+ border: 1px solid #ccc;
157
+ }
158
+ --things-editor-color-input-text: {
159
+ @apply (--things-input);
160
+ }
161
+ --things-editor-color-input-color: {
162
+ border: none;
163
+ background-color: transparent;
164
+ margin-left: -27px;
165
+ position: relative;
166
+ width: 20px;
167
+ }
168
+ --things-dropdown-item: {
169
+ min-height: 30px;
170
+ border-bottom: 1px solid rgba(0, 0, 0, 0.1);
171
+ padding: 0 10px;
172
+ font-size: 13px;
173
+ color: var(--things-primary-text-color);
174
+ }
175
+ }
176
+ </style>
177
+ </template>
178
+ </dom-module>
@@ -0,0 +1 @@
1
+ export { default as Restful } from './restful';
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ /*
2
+ * Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+ export { default as Restful } from './restful';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA","sourcesContent":["/*\n * Copyright © HatioLab Inc. All rights reserved.\n */\n\nexport { default as Restful } from './restful'\n"]}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * JSONP handler
3
+ *
4
+ * Options:
5
+ * - param {String} qs parameter (`callback`)
6
+ * - prefix {String} qs parameter (`__jp`)
7
+ * - name {String} qs parameter (`prefix` + incr)
8
+ * - timeout {Number} how long after a timeout error is emitted (`60000`)
9
+ *
10
+ * @param {String} url
11
+ * @param {Object|Function} optional options / callback
12
+ * @param {Function} optional callback
13
+ */
14
+ export default function jsonp(url: string, opts: {
15
+ prefix?: string;
16
+ name?: string;
17
+ param?: string;
18
+ timeout?: number;
19
+ }, fn: (self: any, data?: any) => void): () => void;
package/dist/jsonp.js ADDED
@@ -0,0 +1,73 @@
1
+ import { debug } from '@hatiolab/things-scene';
2
+ var count = 0;
3
+ function noop() { }
4
+ /**
5
+ * JSONP handler
6
+ *
7
+ * Options:
8
+ * - param {String} qs parameter (`callback`)
9
+ * - prefix {String} qs parameter (`__jp`)
10
+ * - name {String} qs parameter (`prefix` + incr)
11
+ * - timeout {Number} how long after a timeout error is emitted (`60000`)
12
+ *
13
+ * @param {String} url
14
+ * @param {Object|Function} optional options / callback
15
+ * @param {Function} optional callback
16
+ */
17
+ export default function jsonp(url, opts, fn) {
18
+ var _a;
19
+ if ('function' == typeof opts) {
20
+ fn = opts;
21
+ opts = {};
22
+ }
23
+ if (!opts)
24
+ opts = {};
25
+ var prefix = opts.prefix || '__jp';
26
+ // use the callback name that was passed if one was provided.
27
+ // otherwise generate a unique name by incrementing our counter.
28
+ var id = opts.name || prefix + count++;
29
+ var param = opts.param || 'callback';
30
+ var timeout = null != opts.timeout ? opts.timeout : 60000;
31
+ var enc = encodeURIComponent;
32
+ var target = document.getElementsByTagName('script')[0] || document.head;
33
+ var script;
34
+ var timer;
35
+ if (timeout) {
36
+ timer = setTimeout(function () {
37
+ cleanup();
38
+ if (fn)
39
+ fn(new Error('Timeout'));
40
+ }, timeout);
41
+ }
42
+ function cleanup() {
43
+ if (script.parentNode)
44
+ script.parentNode.removeChild(script);
45
+ //@ts-ignore
46
+ window[id] = noop;
47
+ if (timer)
48
+ clearTimeout(timer);
49
+ }
50
+ function cancel() {
51
+ // @ts-ignore
52
+ if (window[id]) {
53
+ cleanup();
54
+ }
55
+ }
56
+ //@ts-ignore
57
+ window[id] = function (data) {
58
+ debug('jsonp got', data);
59
+ cleanup();
60
+ if (fn)
61
+ fn(null, data);
62
+ };
63
+ // add qs component
64
+ url += (~url.indexOf('?') ? '&' : '?') + param + '=' + enc(id);
65
+ url = url.replace('?&', '?');
66
+ debug('jsonp req "%s"', url);
67
+ // create script
68
+ script = document.createElement('script');
69
+ script.src = url;
70
+ (_a = target.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(script, target);
71
+ return cancel;
72
+ }
73
+ //# sourceMappingURL=jsonp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonp.js","sourceRoot":"","sources":["../src/jsonp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAE9C,IAAI,KAAK,GAAG,CAAC,CAAA;AAEb,SAAS,IAAI,KAAI,CAAC;AAElB;;;;;;;;;;;;GAYG;AAEH,MAAM,CAAC,OAAO,UAAU,KAAK,CAC3B,GAAW,EACX,IAA0E,EAC1E,EAAmC;;IAEnC,IAAI,UAAU,IAAI,OAAO,IAAI,EAAE;QAC7B,EAAE,GAAG,IAAI,CAAA;QACT,IAAI,GAAG,EAAE,CAAA;KACV;IACD,IAAI,CAAC,IAAI;QAAE,IAAI,GAAG,EAAE,CAAA;IAEpB,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,MAAM,CAAA;IAElC,6DAA6D;IAC7D,gEAAgE;IAChE,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,IAAI,MAAM,GAAG,KAAK,EAAE,CAAA;IAEtC,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,UAAU,CAAA;IACpC,IAAI,OAAO,GAAG,IAAI,IAA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;IAC9D,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAE5B,KAAK,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAA;IAE5B,gBAAgB;IAChB,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;IACzC,MAAM,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,MAAA,MAAM,CAAC,UAAU,0CAAE,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAE/C,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import { debug } from '@hatiolab/things-scene'\n\nvar count = 0\n\nfunction noop() {}\n\n/**\n * JSONP handler\n *\n * Options:\n * - param {String} qs parameter (`callback`)\n * - prefix {String} qs parameter (`__jp`)\n * - name {String} qs parameter (`prefix` + incr)\n * - timeout {Number} how long after a timeout error is emitted (`60000`)\n *\n * @param {String} url\n * @param {Object|Function} optional options / callback\n * @param {Function} optional callback\n */\n\nexport default function jsonp(\n url: string,\n opts: { prefix?: string; name?: string; param?: string; timeout?: number },\n fn: (self: any, data?: any) => void\n) {\n if ('function' == typeof opts) {\n fn = opts\n opts = {}\n }\n if (!opts) opts = {}\n\n var prefix = opts.prefix || '__jp'\n\n // use the callback name that was passed if one was provided.\n // otherwise generate a unique name by incrementing our counter.\n var id = opts.name || prefix + count++\n\n var param = opts.param || 'callback'\n var timeout = null != opts.timeout ? opts.timeout : 60000\n var enc = encodeURIComponent\n var target = document.getElementsByTagName('script')[0] || document.head\n var script: any\n var timer: any\n\n if (timeout) {\n timer = setTimeout(function () {\n cleanup()\n if (fn) fn(new Error('Timeout'))\n }, timeout)\n }\n\n function cleanup() {\n if (script.parentNode) script.parentNode.removeChild(script)\n //@ts-ignore\n window[id] = noop\n if (timer) clearTimeout(timer)\n }\n\n function cancel() {\n // @ts-ignore\n if (window[id]) {\n cleanup()\n }\n }\n\n //@ts-ignore\n window[id] = function (data) {\n debug('jsonp got', data)\n cleanup()\n if (fn) fn(null, data)\n }\n\n // add qs component\n url += (~url.indexOf('?') ? '&' : '?') + param + '=' + enc(id)\n url = url.replace('?&', '?')\n\n debug('jsonp req \"%s\"', url)\n\n // create script\n script = document.createElement('script')\n script.src = url\n target.parentNode?.insertBefore(script, target)\n\n return cancel\n}\n"]}
@@ -0,0 +1,68 @@
1
+ /// <reference types="node" />
2
+ import { Shape } from '@hatiolab/things-scene';
3
+ declare const Restful_base: (new (...args: any[]) => {
4
+ isDataSource(): boolean;
5
+ }) & typeof Shape;
6
+ export default class Restful extends Restful_base {
7
+ static _image: HTMLImageElement;
8
+ static get image(): HTMLImageElement;
9
+ get url(): any;
10
+ set url(url: any);
11
+ get period(): number;
12
+ set period(period: number);
13
+ get withCredentials(): boolean;
14
+ set withCredentials(withCredentials: boolean);
15
+ _repeatTimer: NodeJS.Timeout;
16
+ _httpRequest?: any;
17
+ _isStarted: boolean;
18
+ _convertDataFormat?: any;
19
+ get repeatTimer(): NodeJS.Timeout;
20
+ set repeatTimer(repeatTimer: NodeJS.Timeout);
21
+ get httpRequest(): any;
22
+ set httpRequest(httpRequest: any);
23
+ ready(): void;
24
+ _initRestful(): void;
25
+ dispose(): void;
26
+ _startRepeater(): void;
27
+ _stopRepeater(): void;
28
+ _makeRequest(url: string): boolean;
29
+ _makeRequestJsonp(url: string): void;
30
+ _abortRequest(): void;
31
+ onDataReceived(): void;
32
+ callAjax(): void;
33
+ _draw(context: CanvasRenderingContext2D): void;
34
+ ondblclick(e: Event): void;
35
+ get controls(): never[];
36
+ get nature(): {
37
+ mutable: boolean;
38
+ resizable: boolean;
39
+ rotatable: boolean;
40
+ properties: ({
41
+ type: string;
42
+ label: string;
43
+ name: string;
44
+ placeholder?: undefined;
45
+ property?: undefined;
46
+ } | {
47
+ type: string;
48
+ label: string;
49
+ name: string;
50
+ placeholder: string;
51
+ property?: undefined;
52
+ } | {
53
+ type: string;
54
+ label: string;
55
+ name: string;
56
+ property: {
57
+ options: {
58
+ display: string;
59
+ value: string;
60
+ }[];
61
+ };
62
+ placeholder?: undefined;
63
+ })[];
64
+ 'value-property': string;
65
+ help: string;
66
+ };
67
+ }
68
+ export {};