@_unit/unit 1.0.25 → 1.0.27

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.
Files changed (108) hide show
  1. package/build/web.js +10 -10
  2. package/lib/API.d.ts +3 -1
  3. package/lib/client/PositionObserver.d.ts +3 -3
  4. package/lib/client/PositionObserver.js +4 -25
  5. package/lib/client/PositionObserver.js.map +1 -1
  6. package/lib/client/component.d.ts +0 -3
  7. package/lib/client/component.js +2 -40
  8. package/lib/client/component.js.map +1 -1
  9. package/lib/client/makeEventListener.d.ts +1 -1
  10. package/lib/client/makeEventListener.js +0 -6
  11. package/lib/client/makeEventListener.js.map +1 -1
  12. package/lib/client/noop/MutationObserver.d.ts +2 -2
  13. package/lib/client/noop/MutationObserver.js.map +1 -1
  14. package/lib/client/noop/ResizeObserver.d.ts +2 -2
  15. package/lib/client/noop/ResizeObserver.js.map +1 -1
  16. package/lib/client/platform/web/api/document.js +0 -16
  17. package/lib/client/platform/web/api/document.js.map +1 -1
  18. package/lib/client/platform/web/api/theme.d.ts +3 -0
  19. package/lib/{system/platform/api/popover/HidePopover/index.js → client/platform/web/api/theme.js} +13 -25
  20. package/lib/client/platform/web/api/theme.js.map +1 -0
  21. package/lib/client/platform/web/boot.js +4 -0
  22. package/lib/client/platform/web/boot.js.map +1 -1
  23. package/lib/host/none.js +5 -3
  24. package/lib/host/none.js.map +1 -1
  25. package/lib/system/_classes.d.ts +0 -10
  26. package/lib/system/_classes.js +0 -10
  27. package/lib/system/_classes.js.map +1 -1
  28. package/lib/system/_components.d.ts +0 -2
  29. package/lib/system/_components.js +86 -88
  30. package/lib/system/_components.js.map +1 -1
  31. package/lib/system/_ids.d.ts +0 -6
  32. package/lib/system/_ids.js +8 -14
  33. package/lib/system/_ids.js.map +1 -1
  34. package/lib/system/_specs.js +1 -1
  35. package/lib/system/_specs.js.map +1 -1
  36. package/lib/system/platform/component/Button/index.d.ts +0 -1
  37. package/lib/system/platform/component/Button/index.js +1 -1
  38. package/lib/system/platform/component/Button/index.js.map +1 -1
  39. package/lib/system/platform/component/Render/Component.js +1 -1
  40. package/lib/system/platform/component/Render/Component.js.map +1 -1
  41. package/lib/system/platform/component/Render/index.d.ts +3 -3
  42. package/lib/system/platform/component/Render/index.js +1 -1
  43. package/lib/system/platform/component/Render/index.js.map +1 -1
  44. package/lib/system/platform/component/app/GUI/Component.js +1 -1
  45. package/lib/system/platform/component/app/GUI/Component.js.map +1 -1
  46. package/lib/system/platform/method/value/Write/index.js.map +1 -1
  47. package/lib/types/global/IPositionObserver.d.ts +4 -4
  48. package/package.json +1 -1
  49. package/public/_worker.js +5 -5
  50. package/public/_worker.js.map +4 -4
  51. package/public/build.json +1 -1
  52. package/public/index.js +10 -10
  53. package/public/index.js.map +4 -4
  54. package/src/API.ts +3 -1
  55. package/src/client/PositionObserver.ts +12 -46
  56. package/src/client/component.ts +2 -48
  57. package/src/client/makeEventListener.ts +0 -9
  58. package/src/client/noop/MutationObserver.ts +2 -2
  59. package/src/client/noop/ResizeObserver.ts +2 -2
  60. package/src/client/platform/web/api/document.ts +0 -6
  61. package/src/client/platform/web/api/theme.ts +19 -0
  62. package/src/client/platform/web/boot.ts +5 -0
  63. package/src/host/none.ts +5 -3
  64. package/src/system/_classes.ts +0 -10
  65. package/src/system/_components.ts +0 -2
  66. package/src/system/_ids.ts +0 -6
  67. package/src/system/_specs.ts +1 -1
  68. package/src/system/platform/component/Button/index.ts +1 -2
  69. package/src/system/platform/component/Button/spec.json +0 -7
  70. package/src/system/platform/component/Render/Component.ts +1 -1
  71. package/src/system/platform/component/Render/index.ts +4 -4
  72. package/src/system/platform/component/Render/spec.json +3 -3
  73. package/src/system/platform/component/app/GUI/Component.ts +1 -1
  74. package/src/system/platform/method/value/Write/index.ts +0 -1
  75. package/src/types/global/IPositionObserver.ts +4 -4
  76. package/lib/client/event/toggle.d.ts +0 -5
  77. package/lib/client/event/toggle.js +0 -27
  78. package/lib/client/event/toggle.js.map +0 -1
  79. package/lib/system/platform/api/observer/PositionObserver/index.d.ts +0 -20
  80. package/lib/system/platform/api/observer/PositionObserver/index.js +0 -65
  81. package/lib/system/platform/api/observer/PositionObserver/index.js.map +0 -1
  82. package/lib/system/platform/api/popover/HidePopover/index.d.ts +0 -15
  83. package/lib/system/platform/api/popover/HidePopover/index.js.map +0 -1
  84. package/lib/system/platform/api/popover/ShowPopover/index.d.ts +0 -15
  85. package/lib/system/platform/api/popover/ShowPopover/index.js +0 -38
  86. package/lib/system/platform/api/popover/ShowPopover/index.js.map +0 -1
  87. package/lib/system/platform/api/popover/TogglePopover/index.d.ts +0 -15
  88. package/lib/system/platform/api/popover/TogglePopover/index.js +0 -38
  89. package/lib/system/platform/api/popover/TogglePopover/index.js.map +0 -1
  90. package/lib/system/platform/component/Follow/Component.d.ts +0 -51
  91. package/lib/system/platform/component/Follow/Component.js +0 -293
  92. package/lib/system/platform/component/Follow/Component.js.map +0 -1
  93. package/lib/system/platform/component/Follow/index.d.ts +0 -10
  94. package/lib/system/platform/component/Follow/index.js +0 -11
  95. package/lib/system/platform/component/Follow/index.js.map +0 -1
  96. package/src/client/event/toggle.ts +0 -37
  97. package/src/system/platform/api/observer/PositionObserver/index.ts +0 -95
  98. package/src/system/platform/api/observer/PositionObserver/spec.json +0 -30
  99. package/src/system/platform/api/popover/HidePopover/index.ts +0 -41
  100. package/src/system/platform/api/popover/HidePopover/spec.json +0 -23
  101. package/src/system/platform/api/popover/ShowPopover/index.ts +0 -41
  102. package/src/system/platform/api/popover/ShowPopover/spec.json +0 -23
  103. package/src/system/platform/api/popover/TogglePopover/index.ts +0 -41
  104. package/src/system/platform/api/popover/TogglePopover/spec.json +0 -23
  105. package/src/system/platform/component/Follow/Component.ts +0 -499
  106. package/src/system/platform/component/Follow/index.ts +0 -21
  107. package/src/system/platform/component/Follow/spec.json +0 -25
  108. package/src/system/platform/core/api/event/OnToggle/spec.json +0 -49
@@ -1,23 +0,0 @@
1
- {
2
- "name": "toggle popover",
3
- "inputs": {
4
- "component": {
5
- "type": "`C`",
6
- "ref": true
7
- },
8
- "any": {
9
- "type": "any"
10
- }
11
- },
12
- "outputs": {},
13
- "metadata": {
14
- "icon": "send",
15
- "description": "toggle popover hidden state",
16
- "complexity": 3,
17
- "tags": ["platform", "api", "popover"]
18
- },
19
- "base": true,
20
- "id": "f9be5d07-9548-4a14-b5b9-fa954599a170",
21
- "type": "`U`",
22
- "system": true
23
- }
@@ -1,499 +0,0 @@
1
- import { Component } from '../../../../client/component'
2
- import { componentClassFromSpecId } from '../../../../client/componentClassFromSpecId'
3
- import { getComponentInterface } from '../../../../client/component_'
4
- import { parentClass } from '../../../../client/createParent'
5
- import { Element } from '../../../../client/element'
6
- import parentElement from '../../../../client/platform/web/parentElement'
7
- import { ComponentClass, System } from '../../../../system'
8
- import { UnitBundleSpec } from '../../../../types/UnitBundleSpec'
9
- import { $Wrap } from '../../../../types/interface/async/$Wrap'
10
- import { insert, push, removeAt, unshift } from '../../../../util/array'
11
-
12
- export interface Props {
13
- component?: UnitBundleSpec
14
- }
15
-
16
- export const DEFAULT_STYLE = {}
17
-
18
- export default class Follow extends Element<HTMLDivElement, Props, $Wrap> {
19
- private _Container: ComponentClass = parentClass()
20
-
21
- private _child_container: Component[] = []
22
- private _parent_container: Component[] = []
23
- private _parent_child_container: Component[] = []
24
-
25
- constructor(props: {}, $system: System) {
26
- super(props, $system)
27
-
28
- const $element = parentElement($system)
29
-
30
- $element.className = 'wrap'
31
-
32
- this.$element = $element
33
-
34
- this.$slot = {
35
- default: this,
36
- }
37
- }
38
-
39
- private _rewrap = (): void => {
40
- for (let at = 0; at < this._child_container.length; at++) {
41
- this.rewrapChild(at)
42
- }
43
-
44
- for (let at = 0; at < this._parent_container.length; at++) {
45
- this.rewrapParentRoot(at)
46
- }
47
-
48
- for (let at = 0; at < this._parent_child_container.length; at++) {
49
- this.rewrapParentChild(at)
50
- }
51
- }
52
-
53
- private rewrapParentChild(at: number) {
54
- const _at = at
55
-
56
- const container = this._parent_child_container[at]
57
-
58
- container.disconnect()
59
-
60
- const child = this.$parentRoot[at]
61
- const childSlot = this.$parentRootSlotName[at]
62
-
63
- const new_container = this._connected_parent_root_container(at)
64
- this._parent_child_container[at] = new_container
65
-
66
- super.domRemoveParentChildAt(container, childSlot, at, _at)
67
- super.memRemoveParentChildAt(container, childSlot, at, _at)
68
-
69
- container.removeChild(child)
70
-
71
- new_container.appendChild(child)
72
-
73
- super.domAppendParentChildAt(new_container, childSlot, at, _at)
74
- super.memAppendParentChild(new_container, childSlot, at, _at)
75
- }
76
-
77
- private rewrapParentRoot(at: number) {
78
- const container = this._parent_container[at]
79
-
80
- container.disconnect()
81
-
82
- const child = this.$parentRoot[at]
83
- const childSlot = this.$parentRootSlotName[at]
84
-
85
- const new_container = this._connected_parent_root_container(at)
86
- this._parent_container[at] = new_container
87
-
88
- if (this.$mountParentRoot.includes(child)) {
89
- super.domRemoveParentRootAt(container, childSlot, at, at)
90
- super.postRemoveParentRootAt(container, childSlot, at, at)
91
-
92
- container.removeChild(child)
93
-
94
- new_container.appendChild(child)
95
-
96
- super.domAppendParentRoot(new_container, childSlot, at)
97
- super.postAppendParentRoot(new_container, childSlot, at)
98
- }
99
- }
100
-
101
- private rewrapChild(at: number) {
102
- const container = this._child_container[at]
103
-
104
- container.disconnect()
105
-
106
- const child = this.$children[at]
107
- const childSlot = this.$childSlotName[at]
108
-
109
- super.domRemoveChild(container, childSlot, at)
110
- super.postRemoveChild(container, at)
111
-
112
- container.removeChild(child)
113
-
114
- const new_container = this._connected_child_container(at)
115
-
116
- new_container.appendChild(child)
117
-
118
- this._child_container[at] = new_container
119
-
120
- super.domAppendChild(new_container, childSlot, at)
121
- super.postAppendChild(new_container, childSlot, at)
122
- }
123
-
124
- private _connected_container = (at: number, method: string): Component => {
125
- const container = new this._Container({}, this.$system)
126
-
127
- const _ = getComponentInterface(container)
128
-
129
- const containerUnit = this.$unit[`${method}`]({ at, _ })
130
-
131
- container.connect(containerUnit)
132
-
133
- return container
134
- }
135
-
136
- private _connected_child_container(at: number): Component {
137
- return this._connected_container(at, '$refChildContainer')
138
- }
139
-
140
- private _connected_parent_root_container(at: number): Component {
141
- return this._connected_container(at, '$refParentRootContainer')
142
- }
143
-
144
- private _connected_parent_child_container(at: number): Component {
145
- return this._connected_container(at, '$refParentChildContainer')
146
- }
147
-
148
- public memAppendChild(child: Component, slotName: string, at: number): void {
149
- const container = this._connected_child_container(at)
150
-
151
- this._child_container.push(container)
152
-
153
- container.memAppendChild(child, 'default', at)
154
-
155
- super.memAppendChild(child, slotName, at)
156
- }
157
-
158
- public memAppendParentChild(
159
- component: Component,
160
- slotName: string,
161
- at: number,
162
- _at: number
163
- ): void {
164
- // console.log(
165
- // 'Wrap',
166
- // 'memAppendParentChild',
167
- // component.constructor.name,
168
- // component.$globalId,
169
- // slotName,
170
- // at,
171
- // _at
172
- // )
173
-
174
- const container = this._connected_parent_child_container(at)
175
-
176
- push(this._parent_child_container, container)
177
-
178
- container.memAppendChild(component, 'default', at)
179
-
180
- super.memAppendParentChild(component, slotName, at, _at)
181
- }
182
-
183
- public domAppendParentChildAt(
184
- component: Component,
185
- slotName: string,
186
- _at: number
187
- ): void {
188
- // console.log(
189
- // 'Wrap',
190
- // 'domAppendParentChildAt',
191
- // component.constructor.name,
192
- // component.$globalId,
193
- // slotName,
194
- // at,
195
- // _at
196
- // )
197
-
198
- const container = this._parent_child_container[_at]
199
-
200
- container.domAppendChild(component, 'default', _at)
201
-
202
- super.domAppendParentChildAt(container, slotName, _at, _at)
203
- }
204
-
205
- public memInsertParentChildAt(
206
- component: Component,
207
- slotName: string,
208
- _at: number
209
- ): void {
210
- // console.log(
211
- // 'Wrap',
212
- // 'memInsertParentChildAt',
213
- // component.constructor.name,
214
- // component.$globalId,
215
- // slotName,
216
- // _at
217
- // )
218
-
219
- const container = this._connected_parent_child_container(_at)
220
-
221
- insert(this._parent_child_container, container, _at)
222
-
223
- container.memAppendChild(component, 'default', _at)
224
-
225
- super.memInsertParentChildAt(component, slotName, _at)
226
- }
227
-
228
- public domInsertParentChildAt(
229
- component: Component,
230
- slotName: string,
231
- _at: number
232
- ): void {
233
- // console.log(
234
- // 'Wrap',
235
- // 'domInsertParentChildAt',
236
- // component.constructor.name,
237
- // component.$globalId,
238
- // slotName,
239
- // at,
240
- // _at
241
- // )
242
-
243
- const container = this._parent_child_container[_at]
244
-
245
- container.domInsertParentChildAt(component, 'default', _at)
246
-
247
- super.domInsertParentChildAt(container, slotName, _at)
248
- }
249
-
250
- public memRemoveParentChildAt(
251
- component: Component,
252
- slotName: string,
253
- at: number,
254
- _at: number
255
- ): void {
256
- // console.log(
257
- // 'Wrap',
258
- // 'memRemoveParentChildAt',
259
- // component.constructor.name,
260
- // component.$globalId,
261
- // at,
262
- // _at
263
- // )
264
-
265
- this._parent_child_container.splice(_at, 1)
266
-
267
- super.memRemoveParentChildAt(component, slotName, at, _at)
268
- }
269
-
270
- public domRemoveParentChildAt(
271
- component: Component,
272
- slotName: string,
273
- at: number,
274
- _at: number
275
- ): void {
276
- // console.log(
277
- // 'Wrap',
278
- // 'domRemoveParentChildAt',
279
- // component.constructor.name,
280
- // component.$globalId,
281
- // at,
282
- // _at
283
- // )
284
-
285
- const container = this._parent_child_container[_at]
286
-
287
- container.domRemoveChild(component, 'default', at)
288
-
289
- super.domRemoveParentChildAt(container, slotName, at, _at)
290
- }
291
-
292
- public domAppendChild(child: Component, slotName: string, at: number) {
293
- const container = this._child_container[at]
294
-
295
- container.domAppendChild(child, 'default', at)
296
-
297
- super.domAppendChild(container, slotName, at)
298
- }
299
-
300
- public postAppendChild(child: Component, slotName: string, at: number): void {
301
- const container = this._child_container[at]
302
-
303
- child.$parent = this
304
-
305
- container.mount(this.$context)
306
- }
307
-
308
- public postAppendParentChild(
309
- child: Component,
310
- slotName: string,
311
- at: number
312
- ): void {
313
- const container = this._parent_child_container[at]
314
-
315
- container.mount(this.$context)
316
- }
317
-
318
- public domRemoveChild(child: Component, slotName: string, at: number) {
319
- const container = this._child_container[at]
320
-
321
- container.domRemoveChild(child, 'default', at)
322
-
323
- super.domRemoveChild(container, slotName, at)
324
- }
325
-
326
- public postRemoveChild(child: Component, at: number): void {
327
- const container = this._child_container[at]
328
-
329
- container.unmount()
330
-
331
- super.postRemoveChild(child, at)
332
- }
333
-
334
- public insertParentRoot(
335
- component: Component,
336
- at: number,
337
- slotName: string
338
- ): void {
339
- // console.log('Graph', 'insertParentRoot', component, at, slotName)
340
-
341
- const container = this._connected_parent_root_container(at)
342
-
343
- insert(this._parent_container, container, at)
344
-
345
- super.insertParentRoot(component, at, slotName)
346
- }
347
-
348
- public unshiftParentRoot(component: Component, slotName: string): void {
349
- // console.log('Graph', 'unshiftParentRoot', component)
350
-
351
- const container = this._connected_parent_root_container(0)
352
-
353
- unshift(this._parent_container, container)
354
-
355
- super.unshiftParentRoot(component, slotName)
356
- }
357
-
358
- public pullParentRoot(component: Component): void {
359
- // console.log('Graph', 'pullParentRoot', component)
360
-
361
- const at = this.$parentRoot.indexOf(component)
362
-
363
- removeAt(this._parent_container, at)
364
-
365
- super.pullParentRoot(component)
366
- }
367
-
368
- public memAppendParentRoot(
369
- component: Component,
370
- slotName: string,
371
- at: number
372
- ): void {
373
- const container = this._connected_parent_root_container(at)
374
-
375
- this._parent_container.push(container)
376
-
377
- container.memAppendChild(component, 'default', at)
378
-
379
- super.memAppendParentRoot(component, slotName, at)
380
- }
381
-
382
- public domAppendParentRoot(
383
- component: Component,
384
- slotName: string,
385
- at: number
386
- ): void {
387
- // console.log('Graph', 'domAppendParentRoot', component, slotName, at)
388
-
389
- const container = this._parent_container[at]
390
-
391
- container.appendChild(component)
392
-
393
- super.domAppendParentRoot(container, slotName, at)
394
- }
395
-
396
- public postAppendParentRoot(
397
- component: Component,
398
- slotName: string,
399
- at: number
400
- ): void {
401
- // console.log('Graph', 'postAppendParentRoot', component, slotName, at)
402
-
403
- const container = this._parent_container[at]
404
-
405
- super.postAppendParentRoot(container, slotName, at)
406
- }
407
-
408
- public domRemoveParentRootAt(
409
- component: Component,
410
- slotName: string,
411
- at: number,
412
- _at: number
413
- ): void {
414
- // console.log('Wrap', 'domRemoveParentRootAt', component, at)
415
-
416
- const container = this._parent_container[_at]
417
-
418
- container.domRemoveChild(component, 'default', at)
419
-
420
- super.domRemoveParentRootAt(container, slotName, at, _at)
421
- }
422
-
423
- public postRemoveParentRootAt(
424
- component: Component,
425
- slotName: string,
426
- at: number,
427
- _at: number
428
- ): void {
429
- // console.log('Wrap', 'postRemoveParentRootAt', component, at)
430
-
431
- super.postRemoveParentRootAt(component, slotName, at, _at)
432
- }
433
-
434
- public domInsertParentRootAt(
435
- component: Component,
436
- at: number,
437
- slotName: string
438
- ): void {
439
- const container = this._parent_container[at]
440
-
441
- container.domAppendChild(component, 'default', at)
442
-
443
- super.domInsertParentRootAt(container, at, slotName)
444
- }
445
-
446
- public postInsertParentRootAt(
447
- component: Component,
448
- at: number,
449
- slotName: string
450
- ): void {
451
- const container = this._parent_container[at]
452
-
453
- super.postInsertParentRootAt(container, at, slotName)
454
- }
455
-
456
- public onPropChanged(name: string, current: any): void {
457
- if (name === 'component') {
458
- let componentClass: ComponentClass
459
-
460
- if (current) {
461
- const Class = current
462
-
463
- const { __bundle } = Class
464
-
465
- const { id, input } = __bundle.unit
466
-
467
- componentClass = componentClassFromSpecId(
468
- this.$system.components,
469
- this.$system.specs,
470
- this.$system.classes,
471
- id,
472
- input
473
- )
474
- } else {
475
- componentClass = parentClass()
476
- }
477
-
478
- this._Container = componentClass
479
-
480
- this._rewrap()
481
- }
482
- }
483
-
484
- public getContainer(): ComponentClass {
485
- return this._Container
486
- }
487
-
488
- public getChildContainer(at: number): Component {
489
- return this._child_container[at]
490
- }
491
-
492
- public getParentChildContainer(at: number): Component {
493
- return this._parent_child_container[at]
494
- }
495
-
496
- public getParentRootContainer(at: number): Component {
497
- return this._parent_container[at]
498
- }
499
- }
@@ -1,21 +0,0 @@
1
- import { Element_ } from '../../../../Class/Element'
2
- import { System } from '../../../../system'
3
- import { UnitBundle } from '../../../../types/UnitBundle'
4
- import { ID_WRAP } from '../../../_ids'
5
-
6
- export type I = {
7
- component: UnitBundle
8
- }
9
-
10
- export type O = {}
11
-
12
- export default class Follow extends Element_<I, O> {
13
- constructor(system: System) {
14
- super(
15
- { i: ['component'], o: ['parent'] },
16
- { output: { parent: { ref: true } } },
17
- system,
18
- ID_WRAP
19
- )
20
- }
21
- }
@@ -1,25 +0,0 @@
1
- {
2
- "name": "follow",
3
- "inputs": {
4
- "component": {
5
- "type": "`C`",
6
- "ref": true
7
- }
8
- },
9
- "outputs": {},
10
- "metadata": {
11
- "icon": "square",
12
- "description": "wrap all children with `component`",
13
- "complexity": 43,
14
- "tags": ["platform", "component"]
15
- },
16
- "id": "b3b92c9a-dcfb-4c88-b5c0-2e65ad4305a7",
17
- "base": true,
18
- "component": {
19
- "defaultWidth": 240,
20
- "defaultHeight": 240
21
- },
22
- "type": "`U`&`C`&`V`&`J`",
23
- "system": true,
24
- "render": true
25
- }
@@ -1,49 +0,0 @@
1
- {
2
- "name": "on toggle",
3
- "units": {
4
- "listen": {
5
- "id": "367241d8-ad12-11ea-beed-9777f31699a8",
6
- "input": {
7
- "event": {
8
- "data": "'toggle'"
9
- },
10
- "remove": {
11
- "ignored": false
12
- }
13
- }
14
- }
15
- },
16
- "merges": {},
17
- "inputs": {
18
- "element": {
19
- "plug": {
20
- "0": {
21
- "unitId": "listen",
22
- "pinId": "emitter"
23
- }
24
- },
25
- "type": "`C`",
26
- "ref": true
27
- }
28
- },
29
- "outputs": {
30
- "event": {
31
- "plug": {
32
- "0": {
33
- "unitId": "listen",
34
- "pinId": "data"
35
- }
36
- },
37
- "type": "boolean"
38
- }
39
- },
40
- "metadata": {
41
- "icon": "square",
42
- "description": "listen to `element` click event",
43
- "complexity": 5,
44
- "tags": ["platform", "core", "api", "event"]
45
- },
46
- "id": "9649cf39-fd6e-4437-a268-c0b4def6bcbd",
47
- "type": "`U`&`G`",
48
- "system": true
49
- }