@ultrst-armada/floks 1.5.5 → 1.5.6

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.
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schema": 1,
3
3
  "packageName": "@ultrst-armada/floks",
4
- "version": "1.5.5",
5
- "sourceCommit": "af00b230359a30a4db9e36e7c63712ad445d4889",
4
+ "version": "1.5.6",
5
+ "sourceCommit": "2765edf71e8a8bf68112ba7d00c9026112543422",
6
6
  "releaseWorkflow": "npm Release",
7
- "workflowRunId": "40319238976"
7
+ "workflowRunId": "40323294788"
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultrst-armada/floks",
3
- "version": "1.5.5",
3
+ "version": "1.5.6",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -53,6 +53,8 @@ interface UIAuthoringSession {
53
53
 
54
54
  declare function getAuthoringDepth(node: UIAuthoringNode, nodes: UIAuthoringNode[]): number;
55
55
  declare function getAuthoringChildren(nodeId: string, nodes: UIAuthoringNode[]): UIAuthoringNode[];
56
+ /** Returns a node and all descendants, even when the input tree is malformed. */
57
+ declare function getAuthoringSubtreeIds(nodeId: string, nodes: UIAuthoringNode[]): Set<string>;
56
58
 
57
59
  declare function UiAuthoringTree(props: {
58
60
  nodes: UIAuthoringNode[];
@@ -77,4 +79,4 @@ declare function UiAuthoringBindingEditor(props: {
77
79
  onChange: (session: UIAuthoringSession) => void;
78
80
  }): React__default.JSX.Element;
79
81
 
80
- export { type AuthoringAssetRef, type UIAuthoringContext, type UIAuthoringNode, type UIAuthoringNodeKind, type UIAuthoringSession, UiAuthoringBindingEditor, UiAuthoringInspector, UiAuthoringTree, UiAuthoringWorkspace, getAuthoringChildren, getAuthoringDepth };
82
+ export { type AuthoringAssetRef, type UIAuthoringContext, type UIAuthoringNode, type UIAuthoringNodeKind, type UIAuthoringSession, UiAuthoringBindingEditor, UiAuthoringInspector, UiAuthoringTree, UiAuthoringWorkspace, getAuthoringChildren, getAuthoringDepth, getAuthoringSubtreeIds };
@@ -4,13 +4,15 @@ import {
4
4
  UiAuthoringTree,
5
5
  UiAuthoringWorkspace,
6
6
  getAuthoringChildren,
7
- getAuthoringDepth
8
- } from "../chunk-GJ472MWX.js";
7
+ getAuthoringDepth,
8
+ getAuthoringSubtreeIds
9
+ } from "../chunk-NJOTRYYJ.js";
9
10
  export {
10
11
  UiAuthoringBindingEditor,
11
12
  UiAuthoringInspector,
12
13
  UiAuthoringTree,
13
14
  UiAuthoringWorkspace,
14
15
  getAuthoringChildren,
15
- getAuthoringDepth
16
+ getAuthoringDepth,
17
+ getAuthoringSubtreeIds
16
18
  };
@@ -13,6 +13,20 @@ function getAuthoringDepth(node, nodes) {
13
13
  function getAuthoringChildren(nodeId, nodes) {
14
14
  return nodes.filter((node) => node.parentId === nodeId);
15
15
  }
16
+ function getAuthoringSubtreeIds(nodeId, nodes) {
17
+ const ids = /* @__PURE__ */ new Set([nodeId]);
18
+ let changed = true;
19
+ while (changed) {
20
+ changed = false;
21
+ for (const node of nodes) {
22
+ if (node.parentId && ids.has(node.parentId) && !ids.has(node.id)) {
23
+ ids.add(node.id);
24
+ changed = true;
25
+ }
26
+ }
27
+ }
28
+ return ids;
29
+ }
16
30
 
17
31
  // src/authoring/UiAuthoringTree.tsx
18
32
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -227,9 +241,17 @@ function UiAuthoringWorkspace(props) {
227
241
  };
228
242
  const removeSelected = () => {
229
243
  if (!selectedNode) return;
244
+ const removedIds = getAuthoringSubtreeIds(selectedNode.id, props.session.nodes);
230
245
  props.onChange({
231
246
  ...props.session,
232
- nodes: props.session.nodes.filter((node) => node.id !== selectedNode.id && node.parentId !== selectedNode.id)
247
+ nodes: props.session.nodes.filter((node) => !removedIds.has(node.id)).map((node) => ({
248
+ ...node,
249
+ slots: node.slots ? Object.fromEntries(Object.entries(node.slots).map(([slot, children]) => [
250
+ slot,
251
+ children.filter((childId) => !removedIds.has(childId))
252
+ ])) : void 0
253
+ })),
254
+ bindings: props.session.bindings.filter((binding) => !removedIds.has(binding.componentId))
233
255
  });
234
256
  setSelectedNodeId(void 0);
235
257
  };
@@ -275,6 +297,7 @@ function UiAuthoringWorkspace(props) {
275
297
  export {
276
298
  getAuthoringDepth,
277
299
  getAuthoringChildren,
300
+ getAuthoringSubtreeIds,
278
301
  UiAuthoringTree,
279
302
  UiAuthoringInspector,
280
303
  UiAuthoringBindingEditor,
@@ -10,7 +10,7 @@ export { FrnlEditableNodeGraph, FrnlEditableNodeGraphProps, frnlEditableNodeGrap
10
10
  export { B as BIOME_CONFIGS, C as COORD_SCALE, a as CameraState, b as Canvas2DViewerProps, c as ConnectingWireState } from './types-D3RRfQUo.js';
11
11
  export { CanvasBackground2D, CanvasErrorBoundary, ContainerNode2D, EffectNode2D, MagneticTraces2D, ModuleNode2D, NODE_CARD_WIDTH, Node2DBase, Node2DBaseProps, NodeRenderer2D, NodeRenderer2DProps, RecorderWaveformDisplay, RecorderWaveformDisplayProps, RotaryKnob, RotaryKnobProps, SOCKET_ROW_HEIGHT, Socket2D, Socket2DProps, SocketScreenPosition, TriggerNode2D, Wire2D, Wire2DProps, getSocketLocalOffset, getSocketScreenPosition, renderSpriteIcon, useCanvas2DCoordinates, useCanvas2DMagnetic } from './graph-2d/index.js';
12
12
  export { PredictiveGhostNodeCard, PredictiveGhostNodeCardProps, PredictiveHudToolbar, PredictiveLayer2D, PredictiveLayer2DProps, UsePredictiveGraph2DProps, UseViewer2DPredictiveProps, usePredictiveGraph2D } from './predictive/index.js';
13
- export { AuthoringAssetRef, UIAuthoringContext, UIAuthoringNode, UIAuthoringNodeKind, UIAuthoringSession, UiAuthoringBindingEditor, UiAuthoringInspector, UiAuthoringTree, UiAuthoringWorkspace, getAuthoringChildren, getAuthoringDepth } from './authoring/index.js';
13
+ export { AuthoringAssetRef, UIAuthoringContext, UIAuthoringNode, UIAuthoringNodeKind, UIAuthoringSession, UiAuthoringBindingEditor, UiAuthoringInspector, UiAuthoringTree, UiAuthoringWorkspace, getAuthoringChildren, getAuthoringDepth, getAuthoringSubtreeIds } from './authoring/index.js';
14
14
 
15
15
  interface MidpointWidgetsProps {
16
16
  x: number;
@@ -10,8 +10,9 @@ import {
10
10
  UiAuthoringTree,
11
11
  UiAuthoringWorkspace,
12
12
  getAuthoringChildren,
13
- getAuthoringDepth
14
- } from "./chunk-GJ472MWX.js";
13
+ getAuthoringDepth,
14
+ getAuthoringSubtreeIds
15
+ } from "./chunk-NJOTRYYJ.js";
15
16
  import {
16
17
  CanvasViewport,
17
18
  InfiniteCanvas,
@@ -28,15 +29,6 @@ import {
28
29
  skipoDarkTheme,
29
30
  useMonaco
30
31
  } from "./chunk-5I3TTHDX.js";
31
- import {
32
- CanvasContextMenu,
33
- CompatibleNodePicker,
34
- FrnlEditableNodeGraph,
35
- NodeSearchPalette,
36
- frnlEditableNodeGraphDefinition,
37
- menuCategory,
38
- menuHidden
39
- } from "./chunk-VESG3VP3.js";
40
32
  import {
41
33
  BIOME_CONFIGS,
42
34
  COORD_SCALE,
@@ -53,14 +45,20 @@ import {
53
45
  useCanvas2DCoordinates,
54
46
  useCanvas2DMagnetic
55
47
  } from "./chunk-XVAHT5WE.js";
48
+ import {
49
+ CanvasContextMenu,
50
+ CompatibleNodePicker,
51
+ FrnlEditableNodeGraph,
52
+ NodeSearchPalette,
53
+ frnlEditableNodeGraphDefinition,
54
+ menuCategory,
55
+ menuHidden
56
+ } from "./chunk-VESG3VP3.js";
56
57
  import {
57
58
  PredictiveGhostNodeCard,
58
59
  PredictiveHudToolbar,
59
60
  PredictiveLayer2D
60
61
  } from "./chunk-RH5NINIT.js";
61
- import {
62
- usePredictiveGraph2D
63
- } from "./chunk-QRYNQ36L.js";
64
62
  import {
65
63
  NODE_CARD_WIDTH,
66
64
  Node2DBase,
@@ -71,6 +69,9 @@ import {
71
69
  getSocketScreenPosition,
72
70
  renderSpriteIcon
73
71
  } from "./chunk-U2SC3RMJ.js";
72
+ import {
73
+ usePredictiveGraph2D
74
+ } from "./chunk-QRYNQ36L.js";
74
75
 
75
76
  // src/node-graph-ui/widgets/MidpointWidgets.tsx
76
77
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -747,6 +748,7 @@ export {
747
748
  frnlEditableNodeGraphDefinition,
748
749
  getAuthoringChildren,
749
750
  getAuthoringDepth,
751
+ getAuthoringSubtreeIds,
750
752
  getSocketLocalOffset,
751
753
  getSocketScreenPosition,
752
754
  menuCategory,
@@ -3,10 +3,10 @@ import {
3
3
  PredictiveHudToolbar,
4
4
  PredictiveLayer2D
5
5
  } from "../chunk-RH5NINIT.js";
6
+ import "../chunk-U2SC3RMJ.js";
6
7
  import {
7
8
  usePredictiveGraph2D
8
9
  } from "../chunk-QRYNQ36L.js";
9
- import "../chunk-U2SC3RMJ.js";
10
10
  export {
11
11
  PredictiveGhostNodeCard,
12
12
  PredictiveHudToolbar,