@_unit/unit 1.0.7 → 1.0.8
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/build/web.js +1201 -0
- package/package.json +1 -1
- package/public/_worker.js +294 -103
- package/public/_worker.js.map +4 -4
- package/public/app/html/index.html +74 -0
- package/public/build.json +1 -1
- package/public/index.js +297 -103
- package/public/index.js.map +4 -4
- package/src/API.ts +1 -0
- package/src/Class/Graph/index.ts +14 -1
- package/src/Class/Graph/interface.ts +7 -0
- package/src/Class/Graph/moveSubgraph.ts +25 -25
- package/src/client/component.ts +18 -7
- package/src/client/extractStyle.ts +161 -0
- package/src/client/isTextLike.ts +16 -0
- package/src/client/platform/web/api/document.ts +3 -0
- package/src/debug/graph/watchGraphInternal.ts +2 -0
- package/src/debug/graph/watchGraphSetUnitPinSetIdEvent.ts +39 -0
- package/src/docs/concept/README.md +8 -2
- package/src/interface.ts +1 -0
- package/src/script/build/client.ts +4 -2
- package/src/spec/Lazy.ts +10 -2
- package/src/spec/util.ts +4 -0
- package/src/system/_classes.ts +2 -2
- package/src/system/_ids.ts +1 -1
- package/src/system/_specs.ts +1 -1
- package/src/system/core/unit/MergeInput/spec.json +1 -1
- package/src/system/globalComponent.ts +29 -0
- package/src/system/platform/api/canvas/AddRect/index.ts +2 -6
- package/src/system/platform/api/canvas/ToBlob/index.ts +5 -1
- package/src/system/platform/api/media/MediaRecorder/index.ts +6 -0
- package/src/system/platform/api/media/RequestPictureInPicture/index.ts +10 -5
- package/src/system/platform/api/media/image/{BlobToBitmap → ImageToBitmap}/index.ts +10 -10
- package/src/system/platform/api/media/image/{BlobToBitmap → ImageToBitmap}/spec.json +9 -18
- package/src/system/platform/component/Iframe/Component.ts +2 -0
- package/src/system/platform/component/Inherit/Component.ts +0 -18
- package/src/system/platform/component/app/Editor/Component.ts +214 -77
- package/src/system/platform/component/app/GUI/Component.ts +19 -4
- package/src/system/platform/component/canvas/Canvas/index.ts +2 -2
- package/src/system/platform/component/media/Video/index.ts +15 -2
- package/src/system/platform/core/SetCurrentTime/spec.json +1 -1
- package/src/system/platform/core/SetScale/spec.json +1 -1
- package/src/system/platform/core/api/location/LocationQuery/spec.json +1 -1
- package/src/system/platform/core/asset/IconNames/spec.json +1 -1
- package/src/system/platform/core/canvas/DownloadBlob/spec.json +1 -1
- package/src/system/platform/core/component/Charcode/spec.json +1 -1
- package/src/system/platform/core/download/DownloadGraph/spec.json +1 -1
- package/src/system/platform/core/math/geometry/trigonometry/Hypotenuse/spec.json +1 -1
- package/src/system/platform/core/math/power/Pow2/spec.json +1 -1
- package/src/system/platform/core/string/RemoveNewLine/spec.json +1 -1
- package/src/test/system/core/MergeSort.ts +1 -1
- package/src/types/GraphSpec.ts +0 -1
- package/src/types/interface/B.ts +3 -1
- package/src/types/interface/G.ts +8 -0
- package/src/types/interface/async/$G.ts +3 -0
- package/src/types/interface/async/AsyncG.ts +10 -0
- package/public/metadata.mp4 +0 -0
|
@@ -167,7 +167,9 @@ import {
|
|
|
167
167
|
IOWheelEvent,
|
|
168
168
|
makeWheelListener,
|
|
169
169
|
} from '../../../../../client/event/wheel'
|
|
170
|
-
import {
|
|
170
|
+
import {
|
|
171
|
+
extractStyle
|
|
172
|
+
} from '../../../../../client/extractStyle'
|
|
171
173
|
import { extractTrait } from '../../../../../client/extractTrait'
|
|
172
174
|
import { findRef } from '../../../../../client/findRef'
|
|
173
175
|
import { getSize } from '../../../../../client/getSize'
|
|
@@ -229,6 +231,7 @@ import {
|
|
|
229
231
|
evaluateBundleStr,
|
|
230
232
|
idFromUnitValue,
|
|
231
233
|
} from '../../../../../client/idFromUnitValue'
|
|
234
|
+
import { isTextLike } from '../../../../../client/isTextLike'
|
|
232
235
|
import { Mode } from '../../../../../client/mode'
|
|
233
236
|
import { _pinTypeMatch } from '../../../../../client/parser'
|
|
234
237
|
import { rawExtractStyle } from '../../../../../client/rawExtractStyle'
|
|
@@ -489,6 +492,7 @@ import {
|
|
|
489
492
|
forEachGraphSpecPin,
|
|
490
493
|
forEachPinOnMerge,
|
|
491
494
|
forEachPinOnMerges,
|
|
495
|
+
getExposePinSpec,
|
|
492
496
|
getExposedPinSpecs,
|
|
493
497
|
getInputNodeId,
|
|
494
498
|
getMergePinCount,
|
|
@@ -3831,8 +3835,6 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
3831
3835
|
|
|
3832
3836
|
const bundle = unitBundleSpec(unit, specs)
|
|
3833
3837
|
|
|
3834
|
-
console.log({ bundle })
|
|
3835
|
-
|
|
3836
3838
|
return bundle
|
|
3837
3839
|
}
|
|
3838
3840
|
|
|
@@ -6423,6 +6425,10 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
6423
6425
|
this._set_plug_selection_to_name(plug_node_id)
|
|
6424
6426
|
}
|
|
6425
6427
|
|
|
6428
|
+
private _on_unit_pin_name_focus = (pin_node_id: string): void => {
|
|
6429
|
+
this._set_pin_selection_to_name(pin_node_id)
|
|
6430
|
+
}
|
|
6431
|
+
|
|
6426
6432
|
private _on_plug_name_blur = (plug_node_id: string): void => {
|
|
6427
6433
|
// console.log('Graph', '_on_plug_name_blur', plug_node_id)
|
|
6428
6434
|
|
|
@@ -6452,10 +6458,70 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
6452
6458
|
}
|
|
6453
6459
|
}
|
|
6454
6460
|
|
|
6461
|
+
private _pod_set_unit_pin_set_id = (
|
|
6462
|
+
unitId: string,
|
|
6463
|
+
type: IO,
|
|
6464
|
+
pinId: string,
|
|
6465
|
+
nextPinId: string
|
|
6466
|
+
): void => {
|
|
6467
|
+
this._pod.$setUnitPinSetId({
|
|
6468
|
+
unitId,
|
|
6469
|
+
type,
|
|
6470
|
+
pinId,
|
|
6471
|
+
nextPinId,
|
|
6472
|
+
})
|
|
6473
|
+
}
|
|
6474
|
+
|
|
6475
|
+
private _on_unit_pin_name_blur = (pin_node_id: string) => {
|
|
6476
|
+
// console.log('Graph', '_on_unit_pin_name_blur', pin_node_id)
|
|
6477
|
+
|
|
6478
|
+
this._set_node_selection_to_node(pin_node_id)
|
|
6479
|
+
|
|
6480
|
+
const { unitId, type, pinId } = segmentLinkPinNodeId(pin_node_id)
|
|
6481
|
+
|
|
6482
|
+
const value = this._get_node_temp_name(pin_node_id)
|
|
6483
|
+
const valid = this._is_valid_pin_name_value(value)
|
|
6484
|
+
|
|
6485
|
+
let next_pin_id = pinId
|
|
6486
|
+
|
|
6487
|
+
if (value !== pinId) {
|
|
6488
|
+
if (valid) {
|
|
6489
|
+
this._on_graph_unit_set_pin_set_id({
|
|
6490
|
+
type,
|
|
6491
|
+
pinId,
|
|
6492
|
+
nextPinId: value,
|
|
6493
|
+
path: [unitId],
|
|
6494
|
+
})
|
|
6495
|
+
|
|
6496
|
+
this._pod_set_unit_pin_set_id(unitId, type, pinId, value)
|
|
6497
|
+
|
|
6498
|
+
next_pin_id = value
|
|
6499
|
+
} else {
|
|
6500
|
+
this._set_node_temp_name(pin_node_id, pinId)
|
|
6501
|
+
|
|
6502
|
+
const pin_name = this._pin_name[pin_node_id]
|
|
6503
|
+
|
|
6504
|
+
if (pin_name) {
|
|
6505
|
+
pin_name.setProp('value', pinId)
|
|
6506
|
+
}
|
|
6507
|
+
}
|
|
6508
|
+
|
|
6509
|
+
const next_pin_node_id = getPinNodeId(unitId, type, next_pin_id)
|
|
6510
|
+
|
|
6511
|
+
if (this._mode === 'info') {
|
|
6512
|
+
this._enable_pin_name(next_pin_node_id)
|
|
6513
|
+
}
|
|
6514
|
+
}
|
|
6515
|
+
}
|
|
6516
|
+
|
|
6455
6517
|
private _set_plug_selection_to_name = (ext_node_id: string): void => {
|
|
6456
6518
|
this._set_node_selection_to_name(ext_node_id, -2, 0)
|
|
6457
6519
|
}
|
|
6458
6520
|
|
|
6521
|
+
private _set_pin_selection_to_name = (pin_node_id: string): void => {
|
|
6522
|
+
this._set_node_selection_to_name(pin_node_id, -1, 0, 0, -2)
|
|
6523
|
+
}
|
|
6524
|
+
|
|
6459
6525
|
private _set_node_selection_to_node = (unit_id: string): void => {
|
|
6460
6526
|
const {
|
|
6461
6527
|
width: node_width,
|
|
@@ -6498,7 +6564,10 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
6498
6564
|
this._disable_core_resize(node_id)
|
|
6499
6565
|
}
|
|
6500
6566
|
|
|
6501
|
-
|
|
6567
|
+
const _width = width + dw
|
|
6568
|
+
const _height = height + dh
|
|
6569
|
+
|
|
6570
|
+
this._resize_selection(node_id, _width, _height)
|
|
6502
6571
|
}
|
|
6503
6572
|
|
|
6504
6573
|
private _set_selection_x = (node_id: string, x: number) => {
|
|
@@ -7263,6 +7332,8 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
7263
7332
|
return this._get_core_name_size(node_id)
|
|
7264
7333
|
} else if (this._is_ext_node_id(node_id)) {
|
|
7265
7334
|
return this._get_plug_name_size(node_id)
|
|
7335
|
+
} else if (this._is_link_pin_node_id(node_id)) {
|
|
7336
|
+
return this._get_pin_name_size(node_id)
|
|
7266
7337
|
} else {
|
|
7267
7338
|
throw new ShouldNeverHappenError()
|
|
7268
7339
|
}
|
|
@@ -7280,9 +7351,13 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
7280
7351
|
}
|
|
7281
7352
|
|
|
7282
7353
|
private _get_plug_name_size = (ext_node_id: string): Size => {
|
|
7283
|
-
|
|
7354
|
+
return this._get_pin_name_size(ext_node_id)
|
|
7355
|
+
}
|
|
7356
|
+
|
|
7357
|
+
private _get_pin_name_size = (pin_node_id: string) => {
|
|
7358
|
+
// console.log('Graph', '_get_pin_name_size', pin_node_id)
|
|
7284
7359
|
|
|
7285
|
-
const value = this._node_name[
|
|
7360
|
+
const value = this._node_name[pin_node_id]
|
|
7286
7361
|
|
|
7287
7362
|
const size = getDivTextSize(
|
|
7288
7363
|
value,
|
|
@@ -7413,7 +7488,31 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
7413
7488
|
pin_node_id: string,
|
|
7414
7489
|
value: string
|
|
7415
7490
|
): void => {
|
|
7416
|
-
|
|
7491
|
+
const valid = this._is_valid_pin_name_value(value)
|
|
7492
|
+
|
|
7493
|
+
if (valid) {
|
|
7494
|
+
this._set_pin_name_caret_color(pin_node_id, 'currentColor')
|
|
7495
|
+
} else {
|
|
7496
|
+
this._set_pin_name_caret_color(pin_node_id, this._get_err_color())
|
|
7497
|
+
}
|
|
7498
|
+
|
|
7499
|
+
this._refresh_pin_name_size(pin_node_id)
|
|
7500
|
+
}
|
|
7501
|
+
|
|
7502
|
+
private _set_pin_name_caret_color = (pin_node_id: string, color: string) => {
|
|
7503
|
+
this._set_pin_name_style_attr(pin_node_id, 'caretColor', color)
|
|
7504
|
+
}
|
|
7505
|
+
|
|
7506
|
+
private _refresh_pin_name_size = (pin_node_id: string) => {
|
|
7507
|
+
const { width, height } = this._get_pin_name_size(pin_node_id)
|
|
7508
|
+
|
|
7509
|
+
const _width = Math.max(width, 6)
|
|
7510
|
+
const _height = Math.max(height, 6)
|
|
7511
|
+
|
|
7512
|
+
this._set_pin_name_style_attr(pin_node_id, 'width', `${_width}px`)
|
|
7513
|
+
this._set_pin_name_style_attr(pin_node_id, 'height', `${_height}px`)
|
|
7514
|
+
|
|
7515
|
+
this._set_pin_selection_to_name(pin_node_id)
|
|
7417
7516
|
}
|
|
7418
7517
|
|
|
7419
7518
|
private _set_unit_pin_name = (pin_node_id: string, value: string): void => {
|
|
@@ -7991,6 +8090,8 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
7991
8090
|
this._on_core_name_focus(node_id)
|
|
7992
8091
|
} else if (this._is_ext_node_id(node_id)) {
|
|
7993
8092
|
this._on_plug_name_focus(node_id)
|
|
8093
|
+
} else if (this._is_link_pin_node_id(node_id)) {
|
|
8094
|
+
this._on_unit_pin_name_focus(node_id)
|
|
7994
8095
|
}
|
|
7995
8096
|
|
|
7996
8097
|
this._edit_node_name_id = node_id
|
|
@@ -8008,6 +8109,8 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
8008
8109
|
this._on_core_name_blur(node_id)
|
|
8009
8110
|
} else if (this._is_ext_node_id(node_id)) {
|
|
8010
8111
|
this._on_plug_name_blur(node_id)
|
|
8112
|
+
} else if (this._is_link_pin_node_id(node_id)) {
|
|
8113
|
+
this._on_unit_pin_name_blur(node_id)
|
|
8011
8114
|
}
|
|
8012
8115
|
|
|
8013
8116
|
this._enable_crud()
|
|
@@ -8087,12 +8190,7 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
8087
8190
|
}
|
|
8088
8191
|
}
|
|
8089
8192
|
|
|
8090
|
-
private
|
|
8091
|
-
type: IO,
|
|
8092
|
-
pinId: string,
|
|
8093
|
-
subPinId: string,
|
|
8094
|
-
value: string
|
|
8095
|
-
) => {
|
|
8193
|
+
private _is_valid_pin_name_value = (value: string) => {
|
|
8096
8194
|
if (value.length === 0) {
|
|
8097
8195
|
return false
|
|
8098
8196
|
}
|
|
@@ -8104,6 +8202,15 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
8104
8202
|
return true
|
|
8105
8203
|
}
|
|
8106
8204
|
|
|
8205
|
+
private __is_valid_plug_name = (
|
|
8206
|
+
type: IO,
|
|
8207
|
+
pinId: string,
|
|
8208
|
+
subPinId: string,
|
|
8209
|
+
value: string
|
|
8210
|
+
) => {
|
|
8211
|
+
return this._is_valid_pin_name_value(value)
|
|
8212
|
+
}
|
|
8213
|
+
|
|
8107
8214
|
private _is_valid_plug_name = (plug_node_id: string, value: string) => {
|
|
8108
8215
|
const { type, pinId, subPinId } = segmentPlugNodeId(plug_node_id)
|
|
8109
8216
|
|
|
@@ -9940,6 +10047,8 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
9940
10047
|
this._pin_name[pin_node_id] = pin_name
|
|
9941
10048
|
pin_node_content.appendChild(pin_name)
|
|
9942
10049
|
|
|
10050
|
+
this._node_name[pin_node_id] = pin_id
|
|
10051
|
+
|
|
9943
10052
|
this._sim_setup_node_name(pin_node_id, pin_name)
|
|
9944
10053
|
|
|
9945
10054
|
if (ref_output) {
|
|
@@ -16238,7 +16347,17 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
16238
16347
|
|
|
16239
16348
|
private _enable_unit_pin_names = (unit_id: string) => {
|
|
16240
16349
|
this._for_each_unit_pin(unit_id, (pin_node_id: string) => {
|
|
16241
|
-
this.
|
|
16350
|
+
if (this._has_node(pin_node_id)) {
|
|
16351
|
+
this._enable_pin_name(pin_node_id)
|
|
16352
|
+
}
|
|
16353
|
+
})
|
|
16354
|
+
}
|
|
16355
|
+
|
|
16356
|
+
private _disable_unit_pin_names = (unit_id: string) => {
|
|
16357
|
+
this._for_each_unit_pin(unit_id, (pin_node_id: string) => {
|
|
16358
|
+
if (this._has_node(pin_node_id)) {
|
|
16359
|
+
this._disable_pin_name(pin_node_id)
|
|
16360
|
+
}
|
|
16242
16361
|
})
|
|
16243
16362
|
}
|
|
16244
16363
|
|
|
@@ -16265,6 +16384,7 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
16265
16384
|
for (const unit_id in this._unit_node) {
|
|
16266
16385
|
if (!this._is_unit_base(unit_id)) {
|
|
16267
16386
|
this._disable_core_name(unit_id)
|
|
16387
|
+
this._disable_unit_pin_names(unit_id)
|
|
16268
16388
|
}
|
|
16269
16389
|
}
|
|
16270
16390
|
|
|
@@ -18321,10 +18441,8 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
18321
18441
|
pointerEvents: 'none',
|
|
18322
18442
|
}
|
|
18323
18443
|
|
|
18324
|
-
const is_text =
|
|
18325
|
-
|
|
18326
|
-
(leaf_comp.$element instanceof HTMLDivElement &&
|
|
18327
|
-
leaf_comp.$element.getAttribute('contenteditable') === 'true')
|
|
18444
|
+
const is_text = isTextLike(leaf_comp)
|
|
18445
|
+
|
|
18328
18446
|
const is_canvas = leaf_comp.$element instanceof HTMLCanvasElement
|
|
18329
18447
|
const is_svg = leaf_comp.isSVG()
|
|
18330
18448
|
|
|
@@ -18946,19 +19064,14 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
18946
19064
|
},
|
|
18947
19065
|
} = this.$system
|
|
18948
19066
|
|
|
18949
|
-
const _extractStyle: ExpandChildFunction = (leaf_id,
|
|
18950
|
-
if (
|
|
18951
|
-
this._leaf_style[leaf_id]
|
|
18952
|
-
|
|
18953
|
-
|
|
18954
|
-
(component.$element instanceof HTMLDivElement &&
|
|
18955
|
-
component.$element.getAttribute('contenteditable') === 'true')
|
|
18956
|
-
)
|
|
18957
|
-
) {
|
|
18958
|
-
return this._leaf_style[leaf_id]
|
|
19067
|
+
const _extractStyle: ExpandChildFunction = (leaf_id, leaf_comp) => {
|
|
19068
|
+
if (this._leaf_style[leaf_id] && !isTextLike(leaf_comp)) {
|
|
19069
|
+
let leaf_style = this._leaf_style[leaf_id]
|
|
19070
|
+
|
|
19071
|
+
return leaf_style
|
|
18959
19072
|
}
|
|
18960
19073
|
|
|
18961
|
-
return extractStyle(this._component,
|
|
19074
|
+
return extractStyle(this._component, leaf_comp, trait, measureText, true)
|
|
18962
19075
|
}
|
|
18963
19076
|
|
|
18964
19077
|
const base_trait = reflectComponentBaseTrait(
|
|
@@ -22067,6 +22180,26 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
22067
22180
|
|
|
22068
22181
|
private _enable_pin_name = (pin_node_id: string): void => {
|
|
22069
22182
|
// console.log('Graph', '_enable_pin_name', pin_node_id)
|
|
22183
|
+
|
|
22184
|
+
this._set_pin_name_style_attr(pin_node_id, 'pointerEvents', 'inherit')
|
|
22185
|
+
}
|
|
22186
|
+
|
|
22187
|
+
private _disable_pin_name = (pin_node_id: string): void => {
|
|
22188
|
+
// console.log('Graph', '_disable_pin_name', pin_node_id)
|
|
22189
|
+
|
|
22190
|
+
this._set_pin_name_style_attr(pin_node_id, 'pointerEvents', 'none')
|
|
22191
|
+
}
|
|
22192
|
+
|
|
22193
|
+
private _set_pin_name_style_attr = (
|
|
22194
|
+
pin_node_id: string,
|
|
22195
|
+
name: string,
|
|
22196
|
+
value: string
|
|
22197
|
+
): void => {
|
|
22198
|
+
// console.log('Graph', '_set_pin_name_style_attr', pin_node_id, name, value)
|
|
22199
|
+
|
|
22200
|
+
const text_comp = this._pin_name[pin_node_id]
|
|
22201
|
+
|
|
22202
|
+
text_comp.$element.style[name] = value
|
|
22070
22203
|
}
|
|
22071
22204
|
|
|
22072
22205
|
private _disable_plug_name = (ext_node_id: string): void => {
|
|
@@ -22822,12 +22955,12 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
22822
22955
|
|
|
22823
22956
|
if (a_ref && !b_ref) {
|
|
22824
22957
|
return (
|
|
22825
|
-
|
|
22958
|
+
b_type === 'output' &&
|
|
22826
22959
|
this._is_link_pin_ref_link_pin_type_match(a, a_type, b, b_type)
|
|
22827
22960
|
)
|
|
22828
22961
|
} else if (!a_ref && b_ref) {
|
|
22829
22962
|
return (
|
|
22830
|
-
|
|
22963
|
+
a_type === 'output' &&
|
|
22831
22964
|
this._is_ref_link_pin_link_pin_type_match(a, a_type, b, b_type)
|
|
22832
22965
|
)
|
|
22833
22966
|
} else if (a_ref && b_ref) {
|
|
@@ -23139,13 +23272,7 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
23139
23272
|
): boolean => {
|
|
23140
23273
|
const target_type = this._runtime_pin_type(b, b_type)
|
|
23141
23274
|
|
|
23142
|
-
// if (
|
|
23143
|
-
// [
|
|
23144
|
-
// TreeNodeType.Class,
|
|
23145
|
-
// TreeNodeType.ClassLiteral,
|
|
23146
|
-
// TreeNodeType.Unit,
|
|
23147
|
-
// ].includes(target_type.type)
|
|
23148
|
-
// ) {
|
|
23275
|
+
// if (this._is_unit_datum_type(target_type)) {
|
|
23149
23276
|
return this._is_pin_pin_type_match(a, a_type, b, b_type)
|
|
23150
23277
|
// }
|
|
23151
23278
|
|
|
@@ -28404,10 +28531,7 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
28404
28531
|
|
|
28405
28532
|
const leaf_id = joinLeafPath(leaf_path)
|
|
28406
28533
|
|
|
28407
|
-
const is_text =
|
|
28408
|
-
leaf_comp.$element instanceof Text ||
|
|
28409
|
-
(leaf_comp.$element instanceof HTMLDivElement &&
|
|
28410
|
-
leaf_comp.$element.getAttribute('contenteditable') === 'true')
|
|
28534
|
+
const is_text = isTextLike(leaf_comp)
|
|
28411
28535
|
|
|
28412
28536
|
const cached_style = this._leaf_style[leaf_id]
|
|
28413
28537
|
|
|
@@ -36206,7 +36330,7 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
36206
36330
|
}
|
|
36207
36331
|
|
|
36208
36332
|
private _sim_graph_unit_remove_pin = (pin_node_id: string): void => {
|
|
36209
|
-
// console.log('Graph', '
|
|
36333
|
+
// console.log('Graph', '_sim_graph_unit_remove_pin', pin_node_id)
|
|
36210
36334
|
|
|
36211
36335
|
const { type, unitId, pinId } = segmentLinkPinNodeId(pin_node_id)
|
|
36212
36336
|
|
|
@@ -41624,7 +41748,6 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
41624
41748
|
(graph_render || there_is_selected_sub_component) &&
|
|
41625
41749
|
(!init_unit_id || !init_unit_is_render)
|
|
41626
41750
|
|
|
41627
|
-
|
|
41628
41751
|
this._flush_debugger()
|
|
41629
41752
|
this._pause_debugger()
|
|
41630
41753
|
|
|
@@ -42206,8 +42329,8 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
42206
42329
|
getExposedPinSpecs: (): IOOf<GraphPinsSpec> => {
|
|
42207
42330
|
return this._spec_get_exposed_pin_specs()
|
|
42208
42331
|
},
|
|
42209
|
-
isPinConstant:
|
|
42210
|
-
|
|
42332
|
+
isPinConstant: (type: IO, name: string): boolean => {
|
|
42333
|
+
return false
|
|
42211
42334
|
},
|
|
42212
42335
|
removePinFromMerge: (mergeId, unitId, type, pinId) => {
|
|
42213
42336
|
this.__state_remove_pin_from_merge(mergeId, unitId, type, pinId)
|
|
@@ -42458,10 +42581,9 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
42458
42581
|
},
|
|
42459
42582
|
getExposedPinSpecs: (): IOOf<GraphPinsSpec> => {
|
|
42460
42583
|
return getExposedPinSpecs(spec)
|
|
42461
|
-
// return this._spec_graph_unit_get_exposed_pin_specs(graph_id)
|
|
42462
42584
|
},
|
|
42463
42585
|
getExposedPinSpec: (type: IO, pinId: string): GraphPinSpec => {
|
|
42464
|
-
return
|
|
42586
|
+
return getExposePinSpec(spec, type, pinId)
|
|
42465
42587
|
},
|
|
42466
42588
|
removePinOrMerge: (
|
|
42467
42589
|
mergeId: string,
|
|
@@ -42478,7 +42600,7 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
42478
42600
|
)
|
|
42479
42601
|
},
|
|
42480
42602
|
isPinConstant: (type: IO, name: string): boolean => {
|
|
42481
|
-
|
|
42603
|
+
return isUnitPinConstant(spec, graph_id, type, name)
|
|
42482
42604
|
},
|
|
42483
42605
|
removePinFromMerge: (
|
|
42484
42606
|
mergeId: string,
|
|
@@ -42958,8 +43080,8 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
42958
43080
|
): void {
|
|
42959
43081
|
//
|
|
42960
43082
|
},
|
|
42961
|
-
isPinConstant:
|
|
42962
|
-
|
|
43083
|
+
isPinConstant: (type: IO, name: string): boolean => {
|
|
43084
|
+
return false
|
|
42963
43085
|
},
|
|
42964
43086
|
removePinFromMerge: () => {
|
|
42965
43087
|
//
|
|
@@ -43052,7 +43174,7 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
43052
43174
|
const sub_component_index_map = {}
|
|
43053
43175
|
const sub_component_children_map = {}
|
|
43054
43176
|
|
|
43055
|
-
const
|
|
43177
|
+
const next_pin_id_map: GraphMoveSubGraphData['nextPinIdMap'] = {}
|
|
43056
43178
|
const next_merge_pin_id: GraphMoveSubGraphData['nextMergePinId'] = {}
|
|
43057
43179
|
const next_plug_spec_map: GraphMoveSubGraphData['nextPlugSpec'] = {
|
|
43058
43180
|
input: {},
|
|
@@ -43154,7 +43276,7 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
43154
43276
|
const ref = this._is_link_pin_ref(pin_node_id)
|
|
43155
43277
|
const ignored = this._spec_is_link_pin_ignored(pin_node_id)
|
|
43156
43278
|
|
|
43157
|
-
pathSet(
|
|
43279
|
+
pathSet(next_pin_id_map, [unit_id, type, pin_id], {
|
|
43158
43280
|
pinId: next_pin_id,
|
|
43159
43281
|
subPinId: `${next_sub_pin_id}`,
|
|
43160
43282
|
ref,
|
|
@@ -43613,10 +43735,7 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
43613
43735
|
if (merge_node_id) {
|
|
43614
43736
|
const merge_ref_unit_id = this._merge_to_ref_unit[merge_node_id]
|
|
43615
43737
|
|
|
43616
|
-
if (
|
|
43617
|
-
!merge_ref_unit_id &&
|
|
43618
|
-
(!node_id_set.has(merge_node_id) || pin_id === SELF)
|
|
43619
|
-
) {
|
|
43738
|
+
if (!node_id_set.has(merge_node_id) || pin_id === SELF) {
|
|
43620
43739
|
let next_pin_id = pathOrDefault(
|
|
43621
43740
|
merge_to_exposed_pin_id,
|
|
43622
43741
|
[type, merge_node_id],
|
|
@@ -43939,7 +44058,7 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
43939
44058
|
},
|
|
43940
44059
|
nextSpecId,
|
|
43941
44060
|
nextIdMap: next_id_map,
|
|
43942
|
-
nextPinIdMap:
|
|
44061
|
+
nextPinIdMap: next_pin_id_map,
|
|
43943
44062
|
nextMergePinId: next_merge_pin_id,
|
|
43944
44063
|
nextUnitPinMergeMap: next_unit_pin_merge_map,
|
|
43945
44064
|
nextPlugSpec: next_plug_spec_map,
|
|
@@ -45328,9 +45447,11 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
45328
45447
|
merge_is_collapsing_too && !any_merge_unit_pin_not_collapsing
|
|
45329
45448
|
|
|
45330
45449
|
forIOObjKV(prev_merge_unit, (type, pin_id: string) => {
|
|
45450
|
+
const is_self_pin = type === 'output' && pin_id === SELF
|
|
45451
|
+
|
|
45331
45452
|
if (
|
|
45332
45453
|
!merge_should_be_ignored &&
|
|
45333
|
-
next_unit_pin_map[unit_id]?.[type]?.[pin_id]
|
|
45454
|
+
(next_unit_pin_map[unit_id]?.[type]?.[pin_id] || is_self_pin)
|
|
45334
45455
|
) {
|
|
45335
45456
|
const fallback_pin_id = newSpecPinId(
|
|
45336
45457
|
graph_spec,
|
|
@@ -45355,12 +45476,14 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
45355
45476
|
pin_id
|
|
45356
45477
|
)
|
|
45357
45478
|
|
|
45358
|
-
|
|
45359
|
-
|
|
45360
|
-
|
|
45361
|
-
|
|
45362
|
-
|
|
45363
|
-
|
|
45479
|
+
if (!is_self_pin) {
|
|
45480
|
+
pathSet(next_pin_id_map, [type, pin_id], {
|
|
45481
|
+
pinId: next_pin_id,
|
|
45482
|
+
subPinId: next_sub_pin_id,
|
|
45483
|
+
ref,
|
|
45484
|
+
defaultIgnored: default_ignored,
|
|
45485
|
+
})
|
|
45486
|
+
}
|
|
45364
45487
|
|
|
45365
45488
|
pathSet(next_merge_unit, [type, next_pin_id], true)
|
|
45366
45489
|
}
|
|
@@ -46504,7 +46627,7 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
46504
46627
|
pinId: string,
|
|
46505
46628
|
mergeId: string | null
|
|
46506
46629
|
) => {
|
|
46507
|
-
// console.log('Graph', '_spec_graph_unit_remove_pin',
|
|
46630
|
+
// console.log('Graph', '_spec_graph_unit_remove_pin', graphId, type, mergeId)
|
|
46508
46631
|
|
|
46509
46632
|
const { setSpec } = this.$props
|
|
46510
46633
|
|
|
@@ -46521,6 +46644,8 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
46521
46644
|
this._spec_remove_pin_or_merge(pin_node_id)
|
|
46522
46645
|
}
|
|
46523
46646
|
|
|
46647
|
+
pathDelete(this._spec, ['units', graphId, type, pinId])
|
|
46648
|
+
|
|
46524
46649
|
setSpec(graph_spec_id, next_graph_spec)
|
|
46525
46650
|
}
|
|
46526
46651
|
|
|
@@ -46856,10 +46981,6 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
46856
46981
|
)
|
|
46857
46982
|
}
|
|
46858
46983
|
}
|
|
46859
|
-
|
|
46860
|
-
if (plug_spec) {
|
|
46861
|
-
const { type, pinId, subPinId } = plug_spec
|
|
46862
|
-
}
|
|
46863
46984
|
} else {
|
|
46864
46985
|
this._stop_node_long_press_collapse(pin_node_id)
|
|
46865
46986
|
}
|
|
@@ -46999,6 +47120,8 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
46999
47120
|
updated_graph_spec
|
|
47000
47121
|
)
|
|
47001
47122
|
|
|
47123
|
+
pathDelete(this._spec, ['units', graph_id, type, pinId])
|
|
47124
|
+
|
|
47002
47125
|
setSpec(graph_spec_id, updated_graph_spec)
|
|
47003
47126
|
} else {
|
|
47004
47127
|
//
|
|
@@ -50278,6 +50401,7 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
50278
50401
|
'set_unit_pin_constant',
|
|
50279
50402
|
'set_unit_pin_ignored',
|
|
50280
50403
|
'set_unit_pin_data',
|
|
50404
|
+
'set_unit_pin_set_id',
|
|
50281
50405
|
'remove_unit_pin_data',
|
|
50282
50406
|
'set_pin_set_functional',
|
|
50283
50407
|
'bulk_edit',
|
|
@@ -50889,7 +51013,7 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
50889
51013
|
setSpec(spec.id, spec)
|
|
50890
51014
|
}
|
|
50891
51015
|
|
|
50892
|
-
if (path.length
|
|
51016
|
+
if (path.length >= 1) {
|
|
50893
51017
|
const unit_id = last(path)
|
|
50894
51018
|
const parent_path = butLast(path)
|
|
50895
51019
|
|
|
@@ -51852,10 +51976,9 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
51852
51976
|
}
|
|
51853
51977
|
|
|
51854
51978
|
if (this._subgraph_unit_id !== path[0]) {
|
|
51979
|
+
sub_component.removeSubComponent(unitId)
|
|
51980
|
+
sub_component.pullRoot(sub_sub_component)
|
|
51855
51981
|
|
|
51856
|
-
sub_component.removeSubComponent(unitId)
|
|
51857
|
-
sub_component.pullRoot(sub_sub_component)
|
|
51858
|
-
|
|
51859
51982
|
sub_sub_component.disconnect()
|
|
51860
51983
|
}
|
|
51861
51984
|
}
|
|
@@ -52264,7 +52387,7 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
52264
52387
|
|
|
52265
52388
|
const { specs, setSpec } = this.$props
|
|
52266
52389
|
|
|
52267
|
-
const { nodeIds, path, graphBundle } = data
|
|
52390
|
+
const { graphId, nodeIds, path, graphBundle } = data
|
|
52268
52391
|
|
|
52269
52392
|
const { spec } = graphBundle
|
|
52270
52393
|
|
|
@@ -52276,6 +52399,11 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
52276
52399
|
|
|
52277
52400
|
if (this._is_spec_updater(path)) {
|
|
52278
52401
|
// if (this._subgraph_unit_id !== graph_unit_id) {
|
|
52402
|
+
|
|
52403
|
+
const spec = findSpecAtPath(specs, this._spec, path)
|
|
52404
|
+
|
|
52405
|
+
const next_spec = clone(spec)
|
|
52406
|
+
|
|
52279
52407
|
const graph_unit_spec = this._get_unit_spec(graph_unit_id) as GraphSpec
|
|
52280
52408
|
|
|
52281
52409
|
const merges = clone(
|
|
@@ -52290,9 +52418,19 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
52290
52418
|
plugs,
|
|
52291
52419
|
}
|
|
52292
52420
|
|
|
52421
|
+
const spec_interface = this._make_graph_spec_interface(spec)
|
|
52422
|
+
|
|
52293
52423
|
moveSubgraph(
|
|
52294
52424
|
this._state_get_subgraph_graph_interface(graph_unit_id),
|
|
52295
|
-
|
|
52425
|
+
weakMerge(spec_interface, {
|
|
52426
|
+
coverPinSet: (type, pinId, path) => {
|
|
52427
|
+
pathDelete(next_spec, ['units', graphId, type, pinId])
|
|
52428
|
+
|
|
52429
|
+
setSpec(next_spec.id, next_spec)
|
|
52430
|
+
|
|
52431
|
+
spec_interface.coverPinSet(type, pinId, path)
|
|
52432
|
+
},
|
|
52433
|
+
}),
|
|
52296
52434
|
data.graphId,
|
|
52297
52435
|
data,
|
|
52298
52436
|
connectOpt,
|
|
@@ -52944,7 +53082,6 @@ export class Editor_ extends Element<HTMLDivElement, _Props> {
|
|
|
52944
53082
|
this._flush_debugger()
|
|
52945
53083
|
}
|
|
52946
53084
|
}
|
|
52947
|
-
|
|
52948
53085
|
|
|
52949
53086
|
if (this._debug_interval === null && this._enabled()) {
|
|
52950
53087
|
this._start_debugger()
|
|
@@ -60,6 +60,7 @@ export default class GUI extends Element<HTMLDivElement, Props> {
|
|
|
60
60
|
public _color_pallete: Div
|
|
61
61
|
public _share: Div
|
|
62
62
|
public _import: IconButton
|
|
63
|
+
public _folder: IconButton
|
|
63
64
|
public _export: IconButton
|
|
64
65
|
public _history: Div
|
|
65
66
|
|
|
@@ -214,6 +215,20 @@ export default class GUI extends Element<HTMLDivElement, Props> {
|
|
|
214
215
|
color_pallete.appendChild(color_picker)
|
|
215
216
|
this._color_pallete = color_pallete
|
|
216
217
|
|
|
218
|
+
const folder_button = new IconButton(
|
|
219
|
+
{
|
|
220
|
+
icon: 'folder',
|
|
221
|
+
style: {
|
|
222
|
+
width: '21px',
|
|
223
|
+
height: '21px',
|
|
224
|
+
padding: '6px',
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
this.$system
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
this._folder = folder_button
|
|
231
|
+
|
|
217
232
|
const export_button = new IconButton(
|
|
218
233
|
{
|
|
219
234
|
icon: 'upload',
|
|
@@ -253,6 +268,7 @@ export default class GUI extends Element<HTMLDivElement, Props> {
|
|
|
253
268
|
},
|
|
254
269
|
this.$system
|
|
255
270
|
)
|
|
271
|
+
share.appendChild(folder_button)
|
|
256
272
|
share.appendChild(export_button)
|
|
257
273
|
share.appendChild(import_button)
|
|
258
274
|
this._share = share
|
|
@@ -510,7 +526,9 @@ export default class GUI extends Element<HTMLDivElement, Props> {
|
|
|
510
526
|
|
|
511
527
|
private _background_color = (): string => {
|
|
512
528
|
const { $theme } = this.$context
|
|
529
|
+
|
|
513
530
|
const backgroundColor = setAlpha(themeBackgroundColor($theme), 0.75)
|
|
531
|
+
|
|
514
532
|
return backgroundColor
|
|
515
533
|
}
|
|
516
534
|
|
|
@@ -521,15 +539,12 @@ export default class GUI extends Element<HTMLDivElement, Props> {
|
|
|
521
539
|
mergePropStyle(this._cabinet, {
|
|
522
540
|
backgroundColor,
|
|
523
541
|
})
|
|
524
|
-
|
|
525
542
|
mergePropStyle(this._modes, {
|
|
526
543
|
backgroundColor,
|
|
527
544
|
})
|
|
528
|
-
|
|
529
545
|
mergePropStyle(this._search, {
|
|
530
546
|
backgroundColor,
|
|
531
547
|
})
|
|
532
|
-
|
|
533
548
|
mergePropStyle(this._minimap, {
|
|
534
549
|
color,
|
|
535
550
|
})
|
|
@@ -581,7 +596,7 @@ export default class GUI extends Element<HTMLDivElement, Props> {
|
|
|
581
596
|
component: this._share,
|
|
582
597
|
active: false,
|
|
583
598
|
width: 30,
|
|
584
|
-
height:
|
|
599
|
+
height: 97,
|
|
585
600
|
state: { y: cy + 47.765 },
|
|
586
601
|
},
|
|
587
602
|
})
|