@multiplatform.one/node-graph 11.3.2 → 11.4.0

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 +1 @@
1
- {"version":3,"file":"NodeGraphWeb.native.js","names":[],"sources":["esm/react-flow/NodeGraphWeb.native.js"],"sourcesContent":["import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport \"@xyflow/react/dist/style.css\";\n\nimport { isTouchSurface, useResolvedKnobs } from \"@multiplatform.one/theme\";\nimport { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from \"react\";\nimport { graphEdgeTypes } from \"../edges/GraphEdge\";\nimport { applySnapToChanges, createSnapSession, snapContextOptions } from \"../interaction/snapChanges\";\nimport { useLassoSelect } from \"../interaction/useLassoSelect\";\nimport { LassoOverlay } from \"./LassoOverlay\";\nimport { SnapGuides } from \"./SnapGuides\";\nimport { ConnectionPuck } from \"./ConnectionPuck\";\nimport { KnobEnvelopeProvider } from \"../knobs/KnobEnvelopeProvider\";\nimport { useKnobEnvelope } from \"../knobs/useKnobEnvelope\";\nimport { portConnectionRadius } from \"../nodes/handleGeometry\";\nimport { defaultOverviewZoom } from \"../nodes/lod\";\nimport { graphNodeSize } from \"../nodes/nodeMeasure\";\nimport { GraphVars, graphRootClassName } from \"../theme/GraphVarsStyle\";\nimport { GraphActionsProvider } from \"./GraphActions\";\nimport { GraphCommandBridge } from \"./GraphCommandBridge\";\nimport { GraphPaintProbe } from \"./GraphPaintProbe\";\nimport { GraphZoomVar } from \"./GraphZoomVar\";\nimport { GraphHostProvider, GraphNodeHost } from \"./GraphNodeHost\";\nimport { defaultGraphNodeType, useGraphController } from \"./useGraphController\";\nimport { ReactFlow, ReactFlowProvider, useReactFlow, useStore } from \"./xy\";\nvar graphCanvasDefaults = {\n onlyRenderVisibleElements: true,\n fitView: true,\n /** Below this zoom a node draws in `overview` mode. Design §5. */\n overviewZoom: defaultOverviewZoom,\n /**\n * React Flow's own default is **0.5**, which is ABOVE `overviewZoom`.\n *\n * Measured in Chrome on `NodeGraph/Overview` at 500 nodes: the zoom-out\n * control bottomed out at 0.5, `fitView` clamped there and showed 50 of the\n * 500 nodes, and the overview mode this milestone builds was unreachable —\n * not broken, unreachable, which is worse, because every unit spec around it\n * was green. A level of detail below a floor the user cannot cross is dead\n * code with a passing test suite.\n *\n * `graphCanvasDefaults.minZoom < graphCanvasDefaults.overviewZoom` is\n * asserted in `lod.spec.tsx`, so the two cannot drift back into that state.\n */\n minZoom: 0.05,\n maxZoom: 2\n};\nfunction FitOnFirstMeasure(param) {\n var { enabled } = param;\n var { fitView } = useReactFlow();\n var allMeasured = useStore(function(state) {\n var total = 0;\n var measured = 0;\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = state.nodeLookup.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var node = _step.value;\n var _node_measured;\n total += 1;\n if ((_node_measured = node.measured) === null || _node_measured === void 0 ? void 0 : _node_measured.height) measured += 1;\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n return total > 0 && total === measured;\n });\n var fitted = useRef(false);\n useEffect(function() {\n if (!enabled || fitted.current || !allMeasured) return;\n fitted.current = true;\n void fitView();\n }, [\n enabled,\n allMeasured,\n fitView\n ]);\n return null;\n}\nfunction NodeGraphCanvas(props) {\n var _props_renderer, _props_commandSlot;\n var { schema, document, defaultDocument, onDocumentChange, onConnectionRefused, readOnly = false, knobs, presetName, intent, coarsePointer = isTouchSurface(), interactionMode = \"pan\", onlyRenderVisibleElements = graphCanvasDefaults.onlyRenderVisibleElements, fitView = graphCanvasDefaults.fitView, overviewZoom = graphCanvasDefaults.overviewZoom, snapping, minZoom = graphCanvasDefaults.minZoom, maxZoom = graphCanvasDefaults.maxZoom, nodeTypes, connectionPuck = true, longPressLasso = false, nodeLabel, className, style, children } = props;\n var rootRef = useRef(null);\n var graphEventRef = useRef(props.onGraphEvent);\n graphEventRef.current = props.onGraphEvent;\n var emit = useCallback(function(event) {\n var _graphEventRef_current;\n return (_graphEventRef_current = graphEventRef.current) === null || _graphEventRef_current === void 0 ? void 0 : _graphEventRef_current.call(graphEventRef, event);\n }, []);\n var perfHost = (_props_renderer = props.renderer) !== null && _props_renderer !== void 0 ? _props_renderer : \"react-flow-web\";\n var readBootMsRef = useRef(props.readBootMs);\n readBootMsRef.current = props.readBootMs;\n var onPaint = useCallback(function() {\n var _ref;\n var _readBootMsRef_current;\n return emit({\n t: \"paint\",\n bootMs: (_ref = (_readBootMsRef_current = readBootMsRef.current) === null || _readBootMsRef_current === void 0 ? void 0 : _readBootMsRef_current.call(readBootMsRef)) !== null && _ref !== void 0 ? _ref : null\n });\n }, [\n emit\n ]);\n var { knobProps } = useResolvedKnobs();\n var size = graphNodeSize(knobProps.sizeToken);\n var envelope = useKnobEnvelope({\n knobs,\n presetName,\n intent: intent !== null && intent !== void 0 ? intent : void 0,\n pointer: coarsePointer ? \"coarse\" : \"fine\"\n });\n var connectionRadius = portConnectionRadius({\n size,\n coarsePointer\n });\n var reactFlowApi = useReactFlow();\n var readMeasuredSizes = useCallback(function() {\n var sizes = {};\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = reactFlowApi.getNodes()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var node = _step.value;\n var _node_measured, _node_measured1;\n var width = (_node_measured = node.measured) === null || _node_measured === void 0 ? void 0 : _node_measured.width;\n var height = (_node_measured1 = node.measured) === null || _node_measured1 === void 0 ? void 0 : _node_measured1.height;\n if (width && height) sizes[node.id] = {\n width,\n height\n };\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n return sizes;\n }, [\n reactFlowApi\n ]);\n var controller = useGraphController({\n schema,\n document,\n defaultDocument,\n onDocumentChange,\n onConnectionRefused,\n readOnly,\n size,\n coarsePointer,\n readMeasuredSizes\n });\n var setNodeData = useCallback(function(id, patch) {\n var node = controller.document.nodes.find(function(candidate) {\n return candidate.id === id;\n });\n if (!node) return;\n controller.commit({\n t: \"setNodeData\",\n id,\n data: {\n ...node.data,\n ...patch\n }\n });\n }, [\n controller\n ]);\n var host = useMemo(function() {\n return {\n schema,\n overviewZoom,\n coarsePointer,\n readOnly,\n setNodeData\n };\n }, [\n schema,\n overviewZoom,\n coarsePointer,\n readOnly,\n setNodeData\n ]);\n var snapSession = useRef(createSnapSession());\n var [guides, setGuides] = useState([]);\n var snapOptions = snapContextOptions({\n snapping,\n animation: envelope.knobs.animation,\n reducedMotion: envelope.prefersReducedMotion,\n coarsePointer\n });\n var { alignment: snapAlignmentOn, grid: snapGrid, thresholdScreenPx } = snapOptions;\n var reactFlow = reactFlowApi;\n var controllerNodesRef = useRef(controller.nodes);\n controllerNodesRef.current = controller.nodes;\n var controllerChangeRef = useRef(controller.onNodesChange);\n controllerChangeRef.current = controller.onNodesChange;\n var onNodesChange = useCallback(function(changes) {\n var snapped = applySnapToChanges(changes, {\n nodes: controllerNodesRef.current,\n zoom: reactFlow.getZoom(),\n session: snapSession.current,\n alignment: snapAlignmentOn,\n grid: snapGrid,\n thresholdScreenPx\n });\n setGuides(function(previous) {\n return previous.length === 0 && snapped.guides.length === 0 ? previous : snapped.guides;\n });\n controllerChangeRef.current(snapped.changes);\n }, [\n reactFlow,\n snapAlignmentOn,\n snapGrid,\n thresholdScreenPx\n ]);\n var longPress = useMemo(function() {\n return {\n rootRef,\n enabled: longPressLasso,\n viewport: {\n get: function get() {\n return reactFlowApi.getViewport();\n },\n set: function set(viewport) {\n void reactFlowApi.setViewport(viewport, {\n duration: 0\n });\n }\n },\n getNodeRects: function getNodeRects() {\n return reactFlowApi.getNodes().map(function(node) {\n var _ref, _ref1, _ref2, _ref3;\n var _node_measured, _node_measured1;\n return {\n id: node.id,\n rect: {\n x: node.position.x,\n y: node.position.y,\n width: (_ref = (_ref1 = (_node_measured = node.measured) === null || _node_measured === void 0 ? void 0 : _node_measured.width) !== null && _ref1 !== void 0 ? _ref1 : node.width) !== null && _ref !== void 0 ? _ref : 0,\n height: (_ref2 = (_ref3 = (_node_measured1 = node.measured) === null || _node_measured1 === void 0 ? void 0 : _node_measured1.height) !== null && _ref3 !== void 0 ? _ref3 : node.height) !== null && _ref2 !== void 0 ? _ref2 : 0\n }\n };\n });\n },\n onSelect: function onSelect(ids) {\n var wanted = new Set(ids);\n reactFlowApi.setNodes(function(nodes) {\n return nodes.map(function(node) {\n return {\n ...node,\n selected: wanted.has(node.id)\n };\n });\n });\n emit({\n t: \"lasso\",\n phase: \"select\",\n ids,\n haptic: null\n });\n emit({\n t: \"selection\",\n ids\n });\n },\n // A WebView cannot buzz. The shell can, so the canvas asks — a HINT, not\n // a command: whether a buzz is appropriate is the shell's call.\n onHaptic: function onHaptic() {\n return emit({\n t: \"lasso\",\n phase: \"arm\",\n ids: [],\n haptic: \"selection\"\n });\n },\n onCancel: function onCancel() {\n return emit({\n t: \"lasso\",\n phase: \"cancel\",\n ids: [],\n haptic: null\n });\n }\n };\n }, [\n emit,\n longPressLasso,\n reactFlowApi\n ]);\n var lasso = useLassoSelect({\n mode: interactionMode,\n longPress\n });\n var ownSlot = useRef(null);\n var slot = (_props_commandSlot = props.commandSlot) !== null && _props_commandSlot !== void 0 ? _props_commandSlot : ownSlot;\n var handle = useMemo(function() {\n return {\n fitView: function fitView2() {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.fitView();\n },\n relayout: function relayout() {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.relayout();\n },\n zoomTo: function zoomTo(zoom) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.zoomTo(zoom);\n },\n centerOn: function centerOn(nodeId) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.centerOn(nodeId);\n },\n setSelection: function setSelection(ids) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.setSelection(ids);\n },\n exportViewport: function exportViewport() {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.exportViewport();\n },\n undo: function undo() {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.undo();\n },\n redo: function redo() {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.redo();\n },\n perfStart: function perfStart(label) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.perfStart(label);\n },\n perfStop: function perfStop(label) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.perfStop(label);\n },\n perfMark: function perfMark(label) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.perfMark(label);\n },\n setViewport: function setViewport(x, y, zoom) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.setViewport(x, y, zoom);\n },\n synthPinch: function synthPinch(scale, steps) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.synthPinch(scale, steps);\n }\n };\n }, [\n slot\n ]);\n useImperativeHandle(props.graphRef, function() {\n return handle;\n }, [\n handle\n ]);\n var types = useMemo(function() {\n return {\n [defaultGraphNodeType]: GraphNodeHost,\n ...nodeTypes\n };\n }, [\n nodeTypes\n ]);\n var actions = useMemo(function() {\n return {\n relayout: controller.relayout,\n undo: controller.undo,\n redo: controller.redo,\n canUndo: controller.canUndo,\n canRedo: controller.canRedo,\n layoutRunner: controller.layoutRunner,\n lastLayoutMs: controller.lastLayoutMs,\n layoutPending: controller.layoutPending,\n nodeCount: controller.document.nodes.length\n };\n }, [\n controller.relayout,\n controller.undo,\n controller.redo,\n controller.canUndo,\n controller.canRedo,\n controller.layoutRunner,\n controller.lastLayoutMs,\n controller.layoutPending,\n controller.document.nodes.length\n ]);\n return /* @__PURE__ */ _jsxs(\"div\", {\n ref: rootRef,\n className: className ? `${graphRootClassName} ${className}` : graphRootClassName,\n \"data-graph-scheme\": envelope.scheme,\n style: {\n width: \"100%\",\n height: \"100%\",\n ...style\n },\n children: [\n /* @__PURE__ */ _jsx(GraphVars, {\n vars: envelope.vars,\n scheme: envelope.scheme,\n revision: envelope.revision\n }),\n /* @__PURE__ */ _jsx(KnobEnvelopeProvider, {\n envelope,\n children: /* @__PURE__ */ _jsx(GraphActionsProvider, {\n value: actions,\n children: /* @__PURE__ */ _jsx(GraphHostProvider, {\n value: host,\n children: /* @__PURE__ */ _jsxs(ReactFlow, {\n nodes: controller.nodes,\n edges: controller.edges,\n nodeTypes: types,\n edgeTypes: graphEdgeTypes,\n onNodesChange,\n onEdgesChange: controller.onEdgesChange,\n onConnect: controller.onConnect,\n isValidConnection: controller.isValidConnection,\n connectionRadius,\n onlyRenderVisibleElements,\n fitView,\n minZoom,\n maxZoom,\n ...lasso.flowProps,\n // The scheme the envelope resolved, so the canvas chrome and the\n // Tamagui bodies inside it cannot disagree about which theme is on.\n colorMode: envelope.scheme,\n nodesDraggable: !readOnly,\n nodesConnectable: !readOnly,\n elementsSelectable: true,\n proOptions: {\n hideAttribution: true\n },\n children: [\n /* @__PURE__ */ _jsx(FitOnFirstMeasure, {\n enabled: fitView\n }),\n /* @__PURE__ */ _jsx(GraphZoomVar, {\n rootRef\n }),\n /* @__PURE__ */ _jsx(GraphPaintProbe, {\n onPaint\n }),\n /* @__PURE__ */ _jsx(GraphCommandBridge, {\n commands: slot,\n culling: onlyRenderVisibleElements,\n emit,\n host: perfHost,\n rootRef,\n onMounted: props.onCanvasMounted\n }),\n /* @__PURE__ */ _jsx(SnapGuides, {\n guides,\n animated: snapOptions.animateGuides\n }),\n /* INSIDE the canvas, so the `--xy-selection-*` layer is in scope.\n Outside it the rectangle is the right size and invisible. */\n /* @__PURE__ */ _jsx(LassoOverlay, {\n rect: lasso.marquee\n }),\n connectionPuck ? /* @__PURE__ */ _jsx(ConnectionPuck, {\n document: controller.document,\n schema,\n nodeLabel\n }) : null,\n children\n ]\n })\n })\n })\n })\n ]\n });\n}\nfunction NodeGraphWeb(props) {\n return /* @__PURE__ */ _jsx(ReactFlowProvider, {\n children: /* @__PURE__ */ _jsx(NodeGraphCanvas, {\n ...props\n })\n });\n}\nexport {\n NodeGraphWeb,\n graphCanvasDefaults\n};\n//# sourceMappingURL=NodeGraphWeb.js.map\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAI,sBAAsB;CACxB,2BAA2B;CAC3B,SAAS;;CAET,cAAc;;;;;;;;;;;;;;CAcd,SAAS;CACT,SAAS;AACX;AACA,SAAS,kBAAkB,OAAO;CAChC,IAAI,EAAE,YAAY;CAClB,IAAI,EAAE,YAAY,aAAa;CAC/B,IAAI,cAAc,SAAS,SAAS,OAAO;EACzC,IAAI,QAAQ;EACZ,IAAI,WAAW;EACf,IAAI,4BAA4B,MAAM,oBAAoB,OAAO,iBAAiB,KAAK;EACvF,IAAI;GACF,KAAK,IAAI,YAAY,MAAM,WAAW,OAAO,CAAC,CAAC,OAAO,SAAS,CAAC,GAAG,OAAO,EAAE,6BAA6B,QAAQ,UAAU,KAAK,EAAC,CAAE,OAAO,4BAA4B,MAAM;IAC1K,IAAI,OAAO,MAAM;IACjB,IAAI;IACJ,SAAS;IACT,KAAK,iBAAiB,KAAK,cAAc,QAAQ,mBAAmB,KAAK,IAAI,KAAK,IAA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MAAM,QACd,CAAC;OACD,iBAAiC,oBAAK,gBAAgB;QACpD,UAAU,WAAW;QACrB;QACA;OACF,CAAC,IAAI;OACL;MACF;KACF,CAAC;IACH,CAAC;GACH,CAAC;EACH,CAAC,CACH;CACF,CAAC;AACH;AACA,SAAS,aAAa,OAAO;CAC3B,OAAuB,oBAAK,mBAAmB,EAC7C,UAA0B,oBAAK,iBAAiB,EAC9C,GAAG,MACL,CAAC,EACH,CAAC;AACH"}
1
+ {"version":3,"file":"NodeGraphWeb.native.js","names":[],"sources":["esm/react-flow/NodeGraphWeb.native.js"],"sourcesContent":["import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport \"@xyflow/react/dist/style.css\";\n\nimport { isTouchSurface, useResolvedKnobs } from \"@multiplatform.one/theme\";\nimport { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from \"react\";\nimport { graphEdgeTypes } from \"../edges/GraphEdge\";\nimport { applySnapToChanges, createSnapSession, snapContextOptions } from \"../interaction/snapChanges\";\nimport { useLassoSelect } from \"../interaction/useLassoSelect\";\nimport { LassoOverlay } from \"./LassoOverlay\";\nimport { SnapGuides } from \"./SnapGuides\";\nimport { ConnectionPuck } from \"./ConnectionPuck\";\nimport { KnobEnvelopeProvider } from \"../knobs/KnobEnvelopeProvider\";\nimport { useKnobEnvelope } from \"../knobs/useKnobEnvelope\";\nimport { portConnectionRadius } from \"../nodes/handleGeometry\";\nimport { defaultOverviewZoom } from \"../nodes/lod\";\nimport { graphNodeSize } from \"../nodes/nodeMeasure\";\nimport { GraphVars, graphRootClassName } from \"../theme/GraphVarsStyle\";\nimport { GraphActionsProvider } from \"./GraphActions\";\nimport { GraphCommandBridge } from \"./GraphCommandBridge\";\nimport { GraphPaintProbe } from \"./GraphPaintProbe\";\nimport { GraphZoomVar } from \"./GraphZoomVar\";\nimport { GraphHostProvider, GraphNodeHost } from \"./GraphNodeHost\";\nimport { defaultGraphNodeType, useGraphController } from \"./useGraphController\";\nimport { ReactFlow, ReactFlowProvider, useReactFlow, useStore } from \"./xy\";\nvar graphCanvasDefaults = {\n onlyRenderVisibleElements: true,\n fitView: true,\n /** Below this zoom a node draws in `overview` mode. Design §5. */\n overviewZoom: defaultOverviewZoom,\n /**\n * React Flow's own default is **0.5**, which is ABOVE `overviewZoom`.\n *\n * Measured in Chrome on `NodeGraph/Overview` at 500 nodes: the zoom-out\n * control bottomed out at 0.5, `fitView` clamped there and showed 50 of the\n * 500 nodes, and the overview mode this milestone builds was unreachable —\n * not broken, unreachable, which is worse, because every unit spec around it\n * was green. A level of detail below a floor the user cannot cross is dead\n * code with a passing test suite.\n *\n * `graphCanvasDefaults.minZoom < graphCanvasDefaults.overviewZoom` is\n * asserted in `lod.spec.tsx`, so the two cannot drift back into that state.\n */\n minZoom: 0.05,\n maxZoom: 2\n};\nfunction FitOnFirstMeasure(param) {\n var { enabled, onFitted } = param;\n var { fitView } = useReactFlow();\n var allMeasured = useStore(function(state) {\n var total = 0;\n var measured = 0;\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = state.nodeLookup.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var node = _step.value;\n var _node_measured;\n total += 1;\n if ((_node_measured = node.measured) === null || _node_measured === void 0 ? void 0 : _node_measured.height) measured += 1;\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n return total > 0 && total === measured;\n });\n var fitted = useRef(false);\n useEffect(function() {\n if (!enabled || fitted.current || !allMeasured) return;\n fitted.current = true;\n void fitView().then(onFitted);\n }, [\n enabled,\n allMeasured,\n fitView,\n onFitted\n ]);\n return null;\n}\nfunction NodeGraphCanvas(props) {\n var _props_renderer, _props_commandSlot;\n var { schema, document, defaultDocument, onDocumentChange, onConnectionRefused, readOnly = false, knobs, presetName, intent, coarsePointer = isTouchSurface(), interactionMode = \"pan\", onlyRenderVisibleElements = graphCanvasDefaults.onlyRenderVisibleElements, fitView = graphCanvasDefaults.fitView, overviewZoom = graphCanvasDefaults.overviewZoom, snapping, minZoom = graphCanvasDefaults.minZoom, maxZoom = graphCanvasDefaults.maxZoom, nodeTypes, connectionPuck = true, longPressLasso = false, nodeLabel, className, style, children } = props;\n var rootRef = useRef(null);\n var graphEventRef = useRef(props.onGraphEvent);\n graphEventRef.current = props.onGraphEvent;\n var emit = useCallback(function(event) {\n var _graphEventRef_current;\n return (_graphEventRef_current = graphEventRef.current) === null || _graphEventRef_current === void 0 ? void 0 : _graphEventRef_current.call(graphEventRef, event);\n }, []);\n var perfHost = (_props_renderer = props.renderer) !== null && _props_renderer !== void 0 ? _props_renderer : \"react-flow-web\";\n var readBootMsRef = useRef(props.readBootMs);\n readBootMsRef.current = props.readBootMs;\n var onPaint = useCallback(function() {\n var _ref;\n var _readBootMsRef_current;\n return emit({\n t: \"paint\",\n bootMs: (_ref = (_readBootMsRef_current = readBootMsRef.current) === null || _readBootMsRef_current === void 0 ? void 0 : _readBootMsRef_current.call(readBootMsRef)) !== null && _ref !== void 0 ? _ref : null\n });\n }, [\n emit\n ]);\n var { knobProps } = useResolvedKnobs();\n var size = graphNodeSize(knobProps.sizeToken);\n var envelope = useKnobEnvelope({\n knobs,\n presetName,\n intent: intent !== null && intent !== void 0 ? intent : void 0,\n pointer: coarsePointer ? \"coarse\" : \"fine\"\n });\n var connectionRadius = portConnectionRadius({\n size,\n coarsePointer\n });\n var reactFlowApi = useReactFlow();\n var readMeasuredSizes = useCallback(function() {\n var sizes = {};\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = reactFlowApi.getNodes()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var node = _step.value;\n var _node_measured, _node_measured1;\n var width = (_node_measured = node.measured) === null || _node_measured === void 0 ? void 0 : _node_measured.width;\n var height = (_node_measured1 = node.measured) === null || _node_measured1 === void 0 ? void 0 : _node_measured1.height;\n if (width && height) sizes[node.id] = {\n width,\n height\n };\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n return sizes;\n }, [\n reactFlowApi\n ]);\n var controller = useGraphController({\n schema,\n document,\n defaultDocument,\n onDocumentChange,\n onConnectionRefused,\n readOnly,\n size,\n coarsePointer,\n readMeasuredSizes\n });\n var setNodeData = useCallback(function(id, patch) {\n var node = controller.document.nodes.find(function(candidate) {\n return candidate.id === id;\n });\n if (!node) return;\n controller.commit({\n t: \"setNodeData\",\n id,\n data: {\n ...node.data,\n ...patch\n }\n });\n }, [\n controller\n ]);\n var host = useMemo(function() {\n return {\n schema,\n overviewZoom,\n coarsePointer,\n readOnly,\n setNodeData\n };\n }, [\n schema,\n overviewZoom,\n coarsePointer,\n readOnly,\n setNodeData\n ]);\n var snapSession = useRef(createSnapSession());\n var [guides, setGuides] = useState([]);\n var [fitted, setFitted] = useState(false);\n var markFitted = useCallback(function() {\n return setFitted(true);\n }, []);\n var snapOptions = snapContextOptions({\n snapping,\n animation: envelope.knobs.animation,\n reducedMotion: envelope.prefersReducedMotion,\n coarsePointer\n });\n var { alignment: snapAlignmentOn, grid: snapGrid, thresholdScreenPx } = snapOptions;\n var reactFlow = reactFlowApi;\n var controllerNodesRef = useRef(controller.nodes);\n controllerNodesRef.current = controller.nodes;\n var controllerChangeRef = useRef(controller.onNodesChange);\n controllerChangeRef.current = controller.onNodesChange;\n var onNodesChange = useCallback(function(changes) {\n var snapped = applySnapToChanges(changes, {\n nodes: controllerNodesRef.current,\n zoom: reactFlow.getZoom(),\n session: snapSession.current,\n alignment: snapAlignmentOn,\n grid: snapGrid,\n thresholdScreenPx\n });\n setGuides(function(previous) {\n return previous.length === 0 && snapped.guides.length === 0 ? previous : snapped.guides;\n });\n controllerChangeRef.current(snapped.changes);\n }, [\n reactFlow,\n snapAlignmentOn,\n snapGrid,\n thresholdScreenPx\n ]);\n var longPress = useMemo(function() {\n return {\n rootRef,\n enabled: longPressLasso,\n viewport: {\n get: function get() {\n return reactFlowApi.getViewport();\n },\n set: function set(viewport) {\n void reactFlowApi.setViewport(viewport, {\n duration: 0\n });\n }\n },\n getNodeRects: function getNodeRects() {\n return reactFlowApi.getNodes().map(function(node) {\n var _ref, _ref1, _ref2, _ref3;\n var _node_measured, _node_measured1;\n return {\n id: node.id,\n rect: {\n x: node.position.x,\n y: node.position.y,\n width: (_ref = (_ref1 = (_node_measured = node.measured) === null || _node_measured === void 0 ? void 0 : _node_measured.width) !== null && _ref1 !== void 0 ? _ref1 : node.width) !== null && _ref !== void 0 ? _ref : 0,\n height: (_ref2 = (_ref3 = (_node_measured1 = node.measured) === null || _node_measured1 === void 0 ? void 0 : _node_measured1.height) !== null && _ref3 !== void 0 ? _ref3 : node.height) !== null && _ref2 !== void 0 ? _ref2 : 0\n }\n };\n });\n },\n onSelect: function onSelect(ids) {\n var wanted = new Set(ids);\n reactFlowApi.setNodes(function(nodes) {\n return nodes.map(function(node) {\n return {\n ...node,\n selected: wanted.has(node.id)\n };\n });\n });\n emit({\n t: \"lasso\",\n phase: \"select\",\n ids,\n haptic: null\n });\n emit({\n t: \"selection\",\n ids\n });\n },\n // A WebView cannot buzz. The shell can, so the canvas asks — a HINT, not\n // a command: whether a buzz is appropriate is the shell's call.\n onHaptic: function onHaptic() {\n return emit({\n t: \"lasso\",\n phase: \"arm\",\n ids: [],\n haptic: \"selection\"\n });\n },\n onCancel: function onCancel() {\n return emit({\n t: \"lasso\",\n phase: \"cancel\",\n ids: [],\n haptic: null\n });\n }\n };\n }, [\n emit,\n longPressLasso,\n reactFlowApi\n ]);\n var lasso = useLassoSelect({\n mode: interactionMode,\n longPress\n });\n var ownSlot = useRef(null);\n var slot = (_props_commandSlot = props.commandSlot) !== null && _props_commandSlot !== void 0 ? _props_commandSlot : ownSlot;\n var handle = useMemo(function() {\n return {\n fitView: function fitView2() {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.fitView();\n },\n relayout: function relayout() {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.relayout();\n },\n zoomTo: function zoomTo(zoom) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.zoomTo(zoom);\n },\n centerOn: function centerOn(nodeId) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.centerOn(nodeId);\n },\n setSelection: function setSelection(ids) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.setSelection(ids);\n },\n exportViewport: function exportViewport() {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.exportViewport();\n },\n undo: function undo() {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.undo();\n },\n redo: function redo() {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.redo();\n },\n perfStart: function perfStart(label) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.perfStart(label);\n },\n perfStop: function perfStop(label) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.perfStop(label);\n },\n perfMark: function perfMark(label) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.perfMark(label);\n },\n setViewport: function setViewport(x, y, zoom) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.setViewport(x, y, zoom);\n },\n synthPinch: function synthPinch(scale, steps) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.synthPinch(scale, steps);\n }\n };\n }, [\n slot\n ]);\n useImperativeHandle(props.graphRef, function() {\n return handle;\n }, [\n handle\n ]);\n var types = useMemo(function() {\n return {\n [defaultGraphNodeType]: GraphNodeHost,\n ...nodeTypes\n };\n }, [\n nodeTypes\n ]);\n var actions = useMemo(function() {\n return {\n relayout: controller.relayout,\n undo: controller.undo,\n redo: controller.redo,\n canUndo: controller.canUndo,\n canRedo: controller.canRedo,\n layoutRunner: controller.layoutRunner,\n lastLayoutMs: controller.lastLayoutMs,\n layoutPending: controller.layoutPending,\n nodeCount: controller.document.nodes.length\n };\n }, [\n controller.relayout,\n controller.undo,\n controller.redo,\n controller.canUndo,\n controller.canRedo,\n controller.layoutRunner,\n controller.lastLayoutMs,\n controller.layoutPending,\n controller.document.nodes.length\n ]);\n return /* @__PURE__ */ _jsxs(\"div\", {\n ref: rootRef,\n className: className ? `${graphRootClassName} ${className}` : graphRootClassName,\n \"data-graph-scheme\": envelope.scheme,\n \"data-graph-fitted\": fitted ? \"\" : void 0,\n style: {\n width: \"100%\",\n height: \"100%\",\n ...style\n },\n children: [\n /* @__PURE__ */ _jsx(GraphVars, {\n vars: envelope.vars,\n scheme: envelope.scheme,\n revision: envelope.revision\n }),\n /* @__PURE__ */ _jsx(KnobEnvelopeProvider, {\n envelope,\n children: /* @__PURE__ */ _jsx(GraphActionsProvider, {\n value: actions,\n children: /* @__PURE__ */ _jsx(GraphHostProvider, {\n value: host,\n children: /* @__PURE__ */ _jsxs(ReactFlow, {\n nodes: controller.nodes,\n edges: controller.edges,\n nodeTypes: types,\n edgeTypes: graphEdgeTypes,\n onNodesChange,\n onEdgesChange: controller.onEdgesChange,\n onConnect: controller.onConnect,\n isValidConnection: controller.isValidConnection,\n connectionRadius,\n onlyRenderVisibleElements,\n fitView,\n minZoom,\n maxZoom,\n ...lasso.flowProps,\n // The scheme the envelope resolved, so the canvas chrome and the\n // Tamagui bodies inside it cannot disagree about which theme is on.\n colorMode: envelope.scheme,\n nodesDraggable: !readOnly,\n nodesConnectable: !readOnly,\n elementsSelectable: true,\n proOptions: {\n hideAttribution: true\n },\n children: [\n /* @__PURE__ */ _jsx(FitOnFirstMeasure, {\n enabled: fitView,\n onFitted: markFitted\n }),\n /* @__PURE__ */ _jsx(GraphZoomVar, {\n rootRef\n }),\n /* @__PURE__ */ _jsx(GraphPaintProbe, {\n onPaint\n }),\n /* @__PURE__ */ _jsx(GraphCommandBridge, {\n commands: slot,\n culling: onlyRenderVisibleElements,\n emit,\n host: perfHost,\n rootRef,\n onMounted: props.onCanvasMounted\n }),\n /* @__PURE__ */ _jsx(SnapGuides, {\n guides,\n animated: snapOptions.animateGuides\n }),\n /* INSIDE the canvas, so the `--xy-selection-*` layer is in scope.\n Outside it the rectangle is the right size and invisible. */\n /* @__PURE__ */ _jsx(LassoOverlay, {\n rect: lasso.marquee\n }),\n connectionPuck ? /* @__PURE__ */ _jsx(ConnectionPuck, {\n document: controller.document,\n schema,\n nodeLabel\n }) : null,\n children\n ]\n })\n })\n })\n })\n ]\n });\n}\nfunction NodeGraphWeb(props) {\n return /* @__PURE__ */ _jsx(ReactFlowProvider, {\n children: /* @__PURE__ */ _jsx(NodeGraphCanvas, {\n ...props\n })\n });\n}\nexport {\n NodeGraphWeb,\n graphCanvasDefaults\n};\n//# sourceMappingURL=NodeGraphWeb.js.map\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,IAAI,sBAAsB;CACxB,2BAA2B;CAC3B,SAAS;;CAET,cAAc;;;;;;;;;;;;;;CAcd,SAAS;CACT,SAAS;AACX;AACA,SAAS,kBAAkB,OAAO;CAChC,IAAI,EAAE,SAAS,aAAa;CAC5B,IAAI,EAAE,YAAY,aAAa;CAC/B,IAAI,cAAc,SAAS,SAAS,OAAO;EACzC,IAAI,QAAQ;EACZ,IAAI,WAAW;EACf,IAAI,4BAA4B,MAAM,oBAAoB,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AAW,WAAW;MACtB,mBAAmB,WAAW;MAC9B;MACA;MACA;MACA;MACA;MACA,GAAG,MAAM;MAGT,WAAW,SAAS;MACpB,gBAAgB,CAAC;MACjB,kBAAkB,CAAC;MACnB,oBAAoB;MACpB,YAAY,EACV,iBAAiB,KACnB;MACA,UAAU;OACQ,oBAAK,mBAAmB;QACtC,SAAS;QACT,UAAU;OACZ,CAAC;OACe,oBAAK,cAAc,EACjC,QACF,CAAC;OACe,oBAAK,iBAAiB,EACpC,QACF,CAAC;OACe,oBAAK,oBAAoB;QACvC,UAAU;QACV,SAAS;QACT;QACA,MAAM;QACN;QACA,WAAW,MAAM;OACnB,CAAC;OACe,oBAAK,YAAY;QAC/B;QACA,UAAU,YAAY;OACxB,CAAC;OAGe,oBAAK,cAAc,EACjC,MAAM,MAAM,QACd,CAAC;OACD,iBAAiC,oBAAK,gBAAgB;QACpD,UAAU,WAAW;QACrB;QACA;OACF,CAAC,IAAI;OACL;MACF;KACF,CAAC;IACH,CAAC;GACH,CAAC;EACH,CAAC,CACH;CACF,CAAC;AACH;AACA,SAAS,aAAa,OAAO;CAC3B,OAAuB,oBAAK,mBAAmB,EAC7C,UAA0B,oBAAK,iBAAiB,EAC9C,GAAG,MACL,CAAC,EACH,CAAC;AACH"}
@@ -43,7 +43,7 @@ const graphCanvasDefaults = {
43
43
  minZoom: .05,
44
44
  maxZoom: 2
45
45
  };
46
- function FitOnFirstMeasure({ enabled }) {
46
+ function FitOnFirstMeasure({ enabled, onFitted }) {
47
47
  const { fitView } = useReactFlow();
48
48
  const allMeasured = useStore((state) => {
49
49
  let total = 0;
@@ -58,11 +58,12 @@ function FitOnFirstMeasure({ enabled }) {
58
58
  useEffect(() => {
59
59
  if (!enabled || fitted.current || !allMeasured) return;
60
60
  fitted.current = true;
61
- void fitView();
61
+ void fitView().then(onFitted);
62
62
  }, [
63
63
  enabled,
64
64
  allMeasured,
65
- fitView
65
+ fitView,
66
+ onFitted
66
67
  ]);
67
68
  return null;
68
69
  }
@@ -142,6 +143,8 @@ function NodeGraphCanvas(props) {
142
143
  ]);
143
144
  const snapSession = useRef(createSnapSession());
144
145
  const [guides, setGuides] = useState([]);
146
+ const [fitted, setFitted] = useState(false);
147
+ const markFitted = useCallback(() => setFitted(true), []);
145
148
  const snapOptions = snapContextOptions({
146
149
  snapping,
147
150
  animation: envelope.knobs.animation,
@@ -274,6 +277,7 @@ function NodeGraphCanvas(props) {
274
277
  ref: rootRef,
275
278
  className: className ? `${graphRootClassName} ${className}` : graphRootClassName,
276
279
  "data-graph-scheme": envelope.scheme,
280
+ "data-graph-fitted": fitted ? "" : void 0,
277
281
  style: {
278
282
  width: "100%",
279
283
  height: "100%",
@@ -310,7 +314,10 @@ function NodeGraphCanvas(props) {
310
314
  elementsSelectable: true,
311
315
  proOptions: { hideAttribution: true },
312
316
  children: [
313
- /* @__PURE__ */ jsx(FitOnFirstMeasure, { enabled: fitView }),
317
+ /* @__PURE__ */ jsx(FitOnFirstMeasure, {
318
+ enabled: fitView,
319
+ onFitted: markFitted
320
+ }),
314
321
  /* @__PURE__ */ jsx(GraphZoomVar, { rootRef }),
315
322
  /* @__PURE__ */ jsx(GraphPaintProbe, { onPaint }),
316
323
  /* @__PURE__ */ jsx(GraphCommandBridge, {
@@ -1 +1 @@
1
- {"version":3,"file":"NodeGraphWeb.js","names":[],"sources":["jsx/react-flow/NodeGraphWeb.js"],"sourcesContent":["import \"@xyflow/react/dist/style.css\";\n\nimport { isTouchSurface, useResolvedKnobs } from \"@multiplatform.one/theme\";\nimport {\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState\n} from \"react\";\nimport { graphEdgeTypes } from \"../edges/GraphEdge\";\nimport {\n applySnapToChanges,\n createSnapSession,\n snapContextOptions\n} from \"../interaction/snapChanges\";\nimport { useLassoSelect } from \"../interaction/useLassoSelect\";\nimport { LassoOverlay } from \"./LassoOverlay\";\nimport { SnapGuides } from \"./SnapGuides\";\nimport { ConnectionPuck } from \"./ConnectionPuck\";\nimport { KnobEnvelopeProvider } from \"../knobs/KnobEnvelopeProvider\";\nimport { useKnobEnvelope } from \"../knobs/useKnobEnvelope\";\nimport { portConnectionRadius } from \"../nodes/handleGeometry\";\nimport { defaultOverviewZoom } from \"../nodes/lod\";\nimport { graphNodeSize } from \"../nodes/nodeMeasure\";\nimport { GraphVars, graphRootClassName } from \"../theme/GraphVarsStyle\";\nimport { GraphActionsProvider } from \"./GraphActions\";\nimport { GraphCommandBridge } from \"./GraphCommandBridge\";\nimport { GraphPaintProbe } from \"./GraphPaintProbe\";\nimport { GraphZoomVar } from \"./GraphZoomVar\";\nimport { GraphHostProvider, GraphNodeHost } from \"./GraphNodeHost\";\nimport { defaultGraphNodeType, useGraphController } from \"./useGraphController\";\nimport { ReactFlow, ReactFlowProvider, useReactFlow, useStore } from \"./xy\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nconst graphCanvasDefaults = {\n onlyRenderVisibleElements: true,\n fitView: true,\n /** Below this zoom a node draws in `overview` mode. Design §5. */\n overviewZoom: defaultOverviewZoom,\n /**\n * React Flow's own default is **0.5**, which is ABOVE `overviewZoom`.\n *\n * Measured in Chrome on `NodeGraph/Overview` at 500 nodes: the zoom-out\n * control bottomed out at 0.5, `fitView` clamped there and showed 50 of the\n * 500 nodes, and the overview mode this milestone builds was unreachable —\n * not broken, unreachable, which is worse, because every unit spec around it\n * was green. A level of detail below a floor the user cannot cross is dead\n * code with a passing test suite.\n *\n * `graphCanvasDefaults.minZoom < graphCanvasDefaults.overviewZoom` is\n * asserted in `lod.spec.tsx`, so the two cannot drift back into that state.\n */\n minZoom: 0.05,\n maxZoom: 2\n};\nfunction FitOnFirstMeasure({ enabled }) {\n const { fitView } = useReactFlow();\n const allMeasured = useStore((state) => {\n let total = 0;\n let measured = 0;\n for (const node of state.nodeLookup.values()) {\n total += 1;\n if (node.measured?.height) measured += 1;\n }\n return total > 0 && total === measured;\n });\n const fitted = useRef(false);\n useEffect(() => {\n if (!enabled || fitted.current || !allMeasured) return;\n fitted.current = true;\n void fitView();\n }, [enabled, allMeasured, fitView]);\n return null;\n}\nfunction NodeGraphCanvas(props) {\n const {\n schema,\n document,\n defaultDocument,\n onDocumentChange,\n onConnectionRefused,\n readOnly = false,\n knobs,\n presetName,\n intent,\n coarsePointer = isTouchSurface(),\n interactionMode = \"pan\",\n onlyRenderVisibleElements = graphCanvasDefaults.onlyRenderVisibleElements,\n fitView = graphCanvasDefaults.fitView,\n overviewZoom = graphCanvasDefaults.overviewZoom,\n snapping,\n minZoom = graphCanvasDefaults.minZoom,\n maxZoom = graphCanvasDefaults.maxZoom,\n nodeTypes,\n connectionPuck = true,\n longPressLasso = false,\n nodeLabel,\n className,\n style,\n children\n } = props;\n const rootRef = useRef(null);\n const graphEventRef = useRef(props.onGraphEvent);\n graphEventRef.current = props.onGraphEvent;\n const emit = useCallback((event) => graphEventRef.current?.(event), []);\n const perfHost = props.renderer ?? \"react-flow-web\";\n const readBootMsRef = useRef(props.readBootMs);\n readBootMsRef.current = props.readBootMs;\n const onPaint = useCallback(\n () => emit({ t: \"paint\", bootMs: readBootMsRef.current?.() ?? null }),\n [emit]\n );\n const { knobProps } = useResolvedKnobs();\n const size = graphNodeSize(knobProps.sizeToken);\n const envelope = useKnobEnvelope({\n knobs,\n presetName,\n intent: intent ?? void 0,\n pointer: coarsePointer ? \"coarse\" : \"fine\"\n });\n const connectionRadius = portConnectionRadius({ size, coarsePointer });\n const reactFlowApi = useReactFlow();\n const readMeasuredSizes = useCallback(() => {\n const sizes = {};\n for (const node of reactFlowApi.getNodes()) {\n const width = node.measured?.width;\n const height = node.measured?.height;\n if (width && height) sizes[node.id] = { width, height };\n }\n return sizes;\n }, [reactFlowApi]);\n const controller = useGraphController({\n schema,\n document,\n defaultDocument,\n onDocumentChange,\n onConnectionRefused,\n readOnly,\n size,\n coarsePointer,\n readMeasuredSizes\n });\n const setNodeData = useCallback(\n (id, patch) => {\n const node = controller.document.nodes.find((candidate) => candidate.id === id);\n if (!node) return;\n controller.commit({\n t: \"setNodeData\",\n id,\n data: { ...node.data, ...patch }\n });\n },\n [controller]\n );\n const host = useMemo(\n () => ({\n schema,\n overviewZoom,\n coarsePointer,\n readOnly,\n setNodeData\n }),\n [schema, overviewZoom, coarsePointer, readOnly, setNodeData]\n );\n const snapSession = useRef(createSnapSession());\n const [guides, setGuides] = useState([]);\n const snapOptions = snapContextOptions({\n snapping,\n animation: envelope.knobs.animation,\n reducedMotion: envelope.prefersReducedMotion,\n coarsePointer\n });\n const { alignment: snapAlignmentOn, grid: snapGrid, thresholdScreenPx } = snapOptions;\n const reactFlow = reactFlowApi;\n const controllerNodesRef = useRef(controller.nodes);\n controllerNodesRef.current = controller.nodes;\n const controllerChangeRef = useRef(controller.onNodesChange);\n controllerChangeRef.current = controller.onNodesChange;\n const onNodesChange = useCallback(\n (changes) => {\n const snapped = applySnapToChanges(changes, {\n nodes: controllerNodesRef.current,\n zoom: reactFlow.getZoom(),\n session: snapSession.current,\n alignment: snapAlignmentOn,\n grid: snapGrid,\n thresholdScreenPx\n });\n setGuides(\n (previous) => previous.length === 0 && snapped.guides.length === 0 ? previous : snapped.guides\n );\n controllerChangeRef.current(snapped.changes);\n },\n [reactFlow, snapAlignmentOn, snapGrid, thresholdScreenPx]\n );\n const longPress = useMemo(\n () => ({\n rootRef,\n enabled: longPressLasso,\n viewport: {\n get: () => reactFlowApi.getViewport(),\n set: (viewport) => {\n void reactFlowApi.setViewport(viewport, { duration: 0 });\n }\n },\n getNodeRects: () => reactFlowApi.getNodes().map((node) => ({\n id: node.id,\n rect: {\n x: node.position.x,\n y: node.position.y,\n width: node.measured?.width ?? node.width ?? 0,\n height: node.measured?.height ?? node.height ?? 0\n }\n })),\n onSelect: (ids) => {\n const wanted = new Set(ids);\n reactFlowApi.setNodes(\n (nodes) => nodes.map((node) => ({ ...node, selected: wanted.has(node.id) }))\n );\n emit({ t: \"lasso\", phase: \"select\", ids, haptic: null });\n emit({ t: \"selection\", ids });\n },\n // A WebView cannot buzz. The shell can, so the canvas asks — a HINT, not\n // a command: whether a buzz is appropriate is the shell's call.\n onHaptic: () => emit({ t: \"lasso\", phase: \"arm\", ids: [], haptic: \"selection\" }),\n onCancel: () => emit({ t: \"lasso\", phase: \"cancel\", ids: [], haptic: null })\n }),\n [emit, longPressLasso, reactFlowApi]\n );\n const lasso = useLassoSelect({ mode: interactionMode, longPress });\n const ownSlot = useRef(null);\n const slot = props.commandSlot ?? ownSlot;\n const handle = useMemo(\n () => ({\n fitView: () => slot.current?.fitView(),\n relayout: () => slot.current?.relayout(),\n zoomTo: (zoom) => slot.current?.zoomTo(zoom),\n centerOn: (nodeId) => slot.current?.centerOn(nodeId),\n setSelection: (ids) => slot.current?.setSelection(ids),\n exportViewport: () => slot.current?.exportViewport(),\n undo: () => slot.current?.undo(),\n redo: () => slot.current?.redo(),\n perfStart: (label) => slot.current?.perfStart(label),\n perfStop: (label) => slot.current?.perfStop(label),\n perfMark: (label) => slot.current?.perfMark(label),\n setViewport: (x, y, zoom) => slot.current?.setViewport(x, y, zoom),\n synthPinch: (scale, steps) => slot.current?.synthPinch(scale, steps)\n }),\n [slot]\n );\n useImperativeHandle(props.graphRef, () => handle, [handle]);\n const types = useMemo(\n () => ({ [defaultGraphNodeType]: GraphNodeHost, ...nodeTypes }),\n [nodeTypes]\n );\n const actions = useMemo(\n () => ({\n relayout: controller.relayout,\n undo: controller.undo,\n redo: controller.redo,\n canUndo: controller.canUndo,\n canRedo: controller.canRedo,\n layoutRunner: controller.layoutRunner,\n lastLayoutMs: controller.lastLayoutMs,\n layoutPending: controller.layoutPending,\n nodeCount: controller.document.nodes.length\n }),\n [\n controller.relayout,\n controller.undo,\n controller.redo,\n controller.canUndo,\n controller.canRedo,\n controller.layoutRunner,\n controller.lastLayoutMs,\n controller.layoutPending,\n controller.document.nodes.length\n ]\n );\n return /* @__PURE__ */ jsxs(\n \"div\",\n {\n ref: rootRef,\n className: className ? `${graphRootClassName} ${className}` : graphRootClassName,\n \"data-graph-scheme\": envelope.scheme,\n style: { width: \"100%\", height: \"100%\", ...style },\n children: [\n /* @__PURE__ */ jsx(GraphVars, { vars: envelope.vars, scheme: envelope.scheme, revision: envelope.revision }),\n /* @__PURE__ */ jsx(KnobEnvelopeProvider, { envelope, children: /* @__PURE__ */ jsx(GraphActionsProvider, { value: actions, children: /* @__PURE__ */ jsx(GraphHostProvider, { value: host, children: /* @__PURE__ */ jsxs(\n ReactFlow,\n {\n nodes: controller.nodes,\n edges: controller.edges,\n nodeTypes: types,\n edgeTypes: graphEdgeTypes,\n onNodesChange,\n onEdgesChange: controller.onEdgesChange,\n onConnect: controller.onConnect,\n isValidConnection: controller.isValidConnection,\n connectionRadius,\n onlyRenderVisibleElements,\n fitView,\n minZoom,\n maxZoom,\n ...lasso.flowProps,\n colorMode: envelope.scheme,\n nodesDraggable: !readOnly,\n nodesConnectable: !readOnly,\n elementsSelectable: true,\n proOptions: { hideAttribution: true },\n children: [\n /* @__PURE__ */ jsx(FitOnFirstMeasure, { enabled: fitView }),\n /* @__PURE__ */ jsx(GraphZoomVar, { rootRef }),\n /* @__PURE__ */ jsx(GraphPaintProbe, { onPaint }),\n /* @__PURE__ */ jsx(\n GraphCommandBridge,\n {\n commands: slot,\n culling: onlyRenderVisibleElements,\n emit,\n host: perfHost,\n rootRef,\n onMounted: props.onCanvasMounted\n }\n ),\n /* @__PURE__ */ jsx(SnapGuides, { guides, animated: snapOptions.animateGuides }),\n /* @__PURE__ */ jsx(LassoOverlay, { rect: lasso.marquee }),\n connectionPuck ? /* @__PURE__ */ jsx(\n ConnectionPuck,\n {\n document: controller.document,\n schema,\n nodeLabel\n }\n ) : null,\n children\n ]\n }\n ) }) }) })\n ]\n }\n );\n}\nfunction NodeGraphWeb(props) {\n return /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(NodeGraphCanvas, { ...props }) });\n}\nexport {\n NodeGraphWeb,\n graphCanvasDefaults\n};\n//# sourceMappingURL=NodeGraphWeb.js.map\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,oBAAI,mBAAmB,EAAE,UAA0B,oBAAI,iBAAiB,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;AAChH"}
1
+ {"version":3,"file":"NodeGraphWeb.js","names":[],"sources":["jsx/react-flow/NodeGraphWeb.js"],"sourcesContent":["import \"@xyflow/react/dist/style.css\";\n\nimport { isTouchSurface, useResolvedKnobs } from \"@multiplatform.one/theme\";\nimport {\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState\n} from \"react\";\nimport { graphEdgeTypes } from \"../edges/GraphEdge\";\nimport {\n applySnapToChanges,\n createSnapSession,\n snapContextOptions\n} from \"../interaction/snapChanges\";\nimport { useLassoSelect } from \"../interaction/useLassoSelect\";\nimport { LassoOverlay } from \"./LassoOverlay\";\nimport { SnapGuides } from \"./SnapGuides\";\nimport { ConnectionPuck } from \"./ConnectionPuck\";\nimport { KnobEnvelopeProvider } from \"../knobs/KnobEnvelopeProvider\";\nimport { useKnobEnvelope } from \"../knobs/useKnobEnvelope\";\nimport { portConnectionRadius } from \"../nodes/handleGeometry\";\nimport { defaultOverviewZoom } from \"../nodes/lod\";\nimport { graphNodeSize } from \"../nodes/nodeMeasure\";\nimport { GraphVars, graphRootClassName } from \"../theme/GraphVarsStyle\";\nimport { GraphActionsProvider } from \"./GraphActions\";\nimport { GraphCommandBridge } from \"./GraphCommandBridge\";\nimport { GraphPaintProbe } from \"./GraphPaintProbe\";\nimport { GraphZoomVar } from \"./GraphZoomVar\";\nimport { GraphHostProvider, GraphNodeHost } from \"./GraphNodeHost\";\nimport { defaultGraphNodeType, useGraphController } from \"./useGraphController\";\nimport { ReactFlow, ReactFlowProvider, useReactFlow, useStore } from \"./xy\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nconst graphCanvasDefaults = {\n onlyRenderVisibleElements: true,\n fitView: true,\n /** Below this zoom a node draws in `overview` mode. Design §5. */\n overviewZoom: defaultOverviewZoom,\n /**\n * React Flow's own default is **0.5**, which is ABOVE `overviewZoom`.\n *\n * Measured in Chrome on `NodeGraph/Overview` at 500 nodes: the zoom-out\n * control bottomed out at 0.5, `fitView` clamped there and showed 50 of the\n * 500 nodes, and the overview mode this milestone builds was unreachable —\n * not broken, unreachable, which is worse, because every unit spec around it\n * was green. A level of detail below a floor the user cannot cross is dead\n * code with a passing test suite.\n *\n * `graphCanvasDefaults.minZoom < graphCanvasDefaults.overviewZoom` is\n * asserted in `lod.spec.tsx`, so the two cannot drift back into that state.\n */\n minZoom: 0.05,\n maxZoom: 2\n};\nfunction FitOnFirstMeasure({ enabled, onFitted }) {\n const { fitView } = useReactFlow();\n const allMeasured = useStore((state) => {\n let total = 0;\n let measured = 0;\n for (const node of state.nodeLookup.values()) {\n total += 1;\n if (node.measured?.height) measured += 1;\n }\n return total > 0 && total === measured;\n });\n const fitted = useRef(false);\n useEffect(() => {\n if (!enabled || fitted.current || !allMeasured) return;\n fitted.current = true;\n void fitView().then(onFitted);\n }, [enabled, allMeasured, fitView, onFitted]);\n return null;\n}\nfunction NodeGraphCanvas(props) {\n const {\n schema,\n document,\n defaultDocument,\n onDocumentChange,\n onConnectionRefused,\n readOnly = false,\n knobs,\n presetName,\n intent,\n coarsePointer = isTouchSurface(),\n interactionMode = \"pan\",\n onlyRenderVisibleElements = graphCanvasDefaults.onlyRenderVisibleElements,\n fitView = graphCanvasDefaults.fitView,\n overviewZoom = graphCanvasDefaults.overviewZoom,\n snapping,\n minZoom = graphCanvasDefaults.minZoom,\n maxZoom = graphCanvasDefaults.maxZoom,\n nodeTypes,\n connectionPuck = true,\n longPressLasso = false,\n nodeLabel,\n className,\n style,\n children\n } = props;\n const rootRef = useRef(null);\n const graphEventRef = useRef(props.onGraphEvent);\n graphEventRef.current = props.onGraphEvent;\n const emit = useCallback((event) => graphEventRef.current?.(event), []);\n const perfHost = props.renderer ?? \"react-flow-web\";\n const readBootMsRef = useRef(props.readBootMs);\n readBootMsRef.current = props.readBootMs;\n const onPaint = useCallback(\n () => emit({ t: \"paint\", bootMs: readBootMsRef.current?.() ?? null }),\n [emit]\n );\n const { knobProps } = useResolvedKnobs();\n const size = graphNodeSize(knobProps.sizeToken);\n const envelope = useKnobEnvelope({\n knobs,\n presetName,\n intent: intent ?? void 0,\n pointer: coarsePointer ? \"coarse\" : \"fine\"\n });\n const connectionRadius = portConnectionRadius({ size, coarsePointer });\n const reactFlowApi = useReactFlow();\n const readMeasuredSizes = useCallback(() => {\n const sizes = {};\n for (const node of reactFlowApi.getNodes()) {\n const width = node.measured?.width;\n const height = node.measured?.height;\n if (width && height) sizes[node.id] = { width, height };\n }\n return sizes;\n }, [reactFlowApi]);\n const controller = useGraphController({\n schema,\n document,\n defaultDocument,\n onDocumentChange,\n onConnectionRefused,\n readOnly,\n size,\n coarsePointer,\n readMeasuredSizes\n });\n const setNodeData = useCallback(\n (id, patch) => {\n const node = controller.document.nodes.find((candidate) => candidate.id === id);\n if (!node) return;\n controller.commit({\n t: \"setNodeData\",\n id,\n data: { ...node.data, ...patch }\n });\n },\n [controller]\n );\n const host = useMemo(\n () => ({\n schema,\n overviewZoom,\n coarsePointer,\n readOnly,\n setNodeData\n }),\n [schema, overviewZoom, coarsePointer, readOnly, setNodeData]\n );\n const snapSession = useRef(createSnapSession());\n const [guides, setGuides] = useState([]);\n const [fitted, setFitted] = useState(false);\n const markFitted = useCallback(() => setFitted(true), []);\n const snapOptions = snapContextOptions({\n snapping,\n animation: envelope.knobs.animation,\n reducedMotion: envelope.prefersReducedMotion,\n coarsePointer\n });\n const { alignment: snapAlignmentOn, grid: snapGrid, thresholdScreenPx } = snapOptions;\n const reactFlow = reactFlowApi;\n const controllerNodesRef = useRef(controller.nodes);\n controllerNodesRef.current = controller.nodes;\n const controllerChangeRef = useRef(controller.onNodesChange);\n controllerChangeRef.current = controller.onNodesChange;\n const onNodesChange = useCallback(\n (changes) => {\n const snapped = applySnapToChanges(changes, {\n nodes: controllerNodesRef.current,\n zoom: reactFlow.getZoom(),\n session: snapSession.current,\n alignment: snapAlignmentOn,\n grid: snapGrid,\n thresholdScreenPx\n });\n setGuides(\n (previous) => previous.length === 0 && snapped.guides.length === 0 ? previous : snapped.guides\n );\n controllerChangeRef.current(snapped.changes);\n },\n [reactFlow, snapAlignmentOn, snapGrid, thresholdScreenPx]\n );\n const longPress = useMemo(\n () => ({\n rootRef,\n enabled: longPressLasso,\n viewport: {\n get: () => reactFlowApi.getViewport(),\n set: (viewport) => {\n void reactFlowApi.setViewport(viewport, { duration: 0 });\n }\n },\n getNodeRects: () => reactFlowApi.getNodes().map((node) => ({\n id: node.id,\n rect: {\n x: node.position.x,\n y: node.position.y,\n width: node.measured?.width ?? node.width ?? 0,\n height: node.measured?.height ?? node.height ?? 0\n }\n })),\n onSelect: (ids) => {\n const wanted = new Set(ids);\n reactFlowApi.setNodes(\n (nodes) => nodes.map((node) => ({ ...node, selected: wanted.has(node.id) }))\n );\n emit({ t: \"lasso\", phase: \"select\", ids, haptic: null });\n emit({ t: \"selection\", ids });\n },\n // A WebView cannot buzz. The shell can, so the canvas asks — a HINT, not\n // a command: whether a buzz is appropriate is the shell's call.\n onHaptic: () => emit({ t: \"lasso\", phase: \"arm\", ids: [], haptic: \"selection\" }),\n onCancel: () => emit({ t: \"lasso\", phase: \"cancel\", ids: [], haptic: null })\n }),\n [emit, longPressLasso, reactFlowApi]\n );\n const lasso = useLassoSelect({ mode: interactionMode, longPress });\n const ownSlot = useRef(null);\n const slot = props.commandSlot ?? ownSlot;\n const handle = useMemo(\n () => ({\n fitView: () => slot.current?.fitView(),\n relayout: () => slot.current?.relayout(),\n zoomTo: (zoom) => slot.current?.zoomTo(zoom),\n centerOn: (nodeId) => slot.current?.centerOn(nodeId),\n setSelection: (ids) => slot.current?.setSelection(ids),\n exportViewport: () => slot.current?.exportViewport(),\n undo: () => slot.current?.undo(),\n redo: () => slot.current?.redo(),\n perfStart: (label) => slot.current?.perfStart(label),\n perfStop: (label) => slot.current?.perfStop(label),\n perfMark: (label) => slot.current?.perfMark(label),\n setViewport: (x, y, zoom) => slot.current?.setViewport(x, y, zoom),\n synthPinch: (scale, steps) => slot.current?.synthPinch(scale, steps)\n }),\n [slot]\n );\n useImperativeHandle(props.graphRef, () => handle, [handle]);\n const types = useMemo(\n () => ({ [defaultGraphNodeType]: GraphNodeHost, ...nodeTypes }),\n [nodeTypes]\n );\n const actions = useMemo(\n () => ({\n relayout: controller.relayout,\n undo: controller.undo,\n redo: controller.redo,\n canUndo: controller.canUndo,\n canRedo: controller.canRedo,\n layoutRunner: controller.layoutRunner,\n lastLayoutMs: controller.lastLayoutMs,\n layoutPending: controller.layoutPending,\n nodeCount: controller.document.nodes.length\n }),\n [\n controller.relayout,\n controller.undo,\n controller.redo,\n controller.canUndo,\n controller.canRedo,\n controller.layoutRunner,\n controller.lastLayoutMs,\n controller.layoutPending,\n controller.document.nodes.length\n ]\n );\n return /* @__PURE__ */ jsxs(\n \"div\",\n {\n ref: rootRef,\n className: className ? `${graphRootClassName} ${className}` : graphRootClassName,\n \"data-graph-scheme\": envelope.scheme,\n \"data-graph-fitted\": fitted ? \"\" : void 0,\n style: { width: \"100%\", height: \"100%\", ...style },\n children: [\n /* @__PURE__ */ jsx(GraphVars, { vars: envelope.vars, scheme: envelope.scheme, revision: envelope.revision }),\n /* @__PURE__ */ jsx(KnobEnvelopeProvider, { envelope, children: /* @__PURE__ */ jsx(GraphActionsProvider, { value: actions, children: /* @__PURE__ */ jsx(GraphHostProvider, { value: host, children: /* @__PURE__ */ jsxs(\n ReactFlow,\n {\n nodes: controller.nodes,\n edges: controller.edges,\n nodeTypes: types,\n edgeTypes: graphEdgeTypes,\n onNodesChange,\n onEdgesChange: controller.onEdgesChange,\n onConnect: controller.onConnect,\n isValidConnection: controller.isValidConnection,\n connectionRadius,\n onlyRenderVisibleElements,\n fitView,\n minZoom,\n maxZoom,\n ...lasso.flowProps,\n colorMode: envelope.scheme,\n nodesDraggable: !readOnly,\n nodesConnectable: !readOnly,\n elementsSelectable: true,\n proOptions: { hideAttribution: true },\n children: [\n /* @__PURE__ */ jsx(FitOnFirstMeasure, { enabled: fitView, onFitted: markFitted }),\n /* @__PURE__ */ jsx(GraphZoomVar, { rootRef }),\n /* @__PURE__ */ jsx(GraphPaintProbe, { onPaint }),\n /* @__PURE__ */ jsx(\n GraphCommandBridge,\n {\n commands: slot,\n culling: onlyRenderVisibleElements,\n emit,\n host: perfHost,\n rootRef,\n onMounted: props.onCanvasMounted\n }\n ),\n /* @__PURE__ */ jsx(SnapGuides, { guides, animated: snapOptions.animateGuides }),\n /* @__PURE__ */ jsx(LassoOverlay, { rect: lasso.marquee }),\n connectionPuck ? /* @__PURE__ */ jsx(\n ConnectionPuck,\n {\n document: controller.document,\n schema,\n nodeLabel\n }\n ) : null,\n children\n ]\n }\n ) }) }) })\n ]\n }\n );\n}\nfunction NodeGraphWeb(props) {\n return /* @__PURE__ */ jsx(ReactFlowProvider, { children: /* @__PURE__ */ jsx(NodeGraphCanvas, { ...props }) });\n}\nexport {\n NodeGraphWeb,\n graphCanvasDefaults\n};\n//# sourceMappingURL=NodeGraphWeb.js.map\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAM,sBAAsB;CAC1B,2BAA2B;CAC3B,SAAS;;CAET,cAAc;;;;;;;;;;;;;;CAcd,SAAS;CACT,SAAS;AACX;AACA,SAAS,kBAAkB,EAAE,SAAS,YAAY;CAChD,MAAM,EAAE,YAAY,aAAa;CACjC,MAAM,cAAc,UAAU,UAAU;EACtC,IAAI,QAAQ;EACZ,IAAI,WAAW;EACf,KAAK,MAAM,QAAQ,MAAM,WAAW,OAAO,GAAG;GAC5C,SAAS;GACT,IAAI,KAAK,UAAU,QAAQ,YAAY;EACzC;EACA,OAAO,QAAQ,KAAK,UAAU;CAChC,CAAC;CACD,MAAM,SAAS,OAAO,KAAK;CAC3B,gBAAgB;EACd,IAAI,CAAC,WAAW,OAAO,WAAW,CAAC,aAAa;EAChD,OAAO,UAAU;EACjB,KAAK,QAAQ,CAAC,CAAC,KAAK,QAAQ;CA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KAAE,OAAO;KAAM,UAA0B,qBACpN,WACA;MACE,OAAO,WAAW;MAClB,OAAO,WAAW;MAClB,WAAW;MACX,WAAW;MACX;MACA,eAAe,WAAW;MAC1B,WAAW,WAAW;MACtB,mBAAmB,WAAW;MAC9B;MACA;MACA;MACA;MACA;MACA,GAAG,MAAM;MACT,WAAW,SAAS;MACpB,gBAAgB,CAAC;MACjB,kBAAkB,CAAC;MACnB,oBAAoB;MACpB,YAAY,EAAE,iBAAiB,KAAK;MACpC,UAAU;OACQ,oBAAI,mBAAmB;QAAE,SAAS;QAAS,UAAU;OAAW,CAAC;OACjE,oBAAI,cAAc,EAAE,QAAQ,CAAC;OAC7B,oBAAI,iBAAiB,EAAE,QAAQ,CAAC;OAChC,oBACd,oBACA;QACE,UAAU;QACV,SAAS;QACT;QACA,MAAM;QACN;QACA,WAAW,MAAM;OACnB,CACF;OACgB,oBAAI,YAAY;QAAE;QAAQ,UAAU,YAAY;OAAc,CAAC;OAC/D,oBAAI,cAAc,EAAE,MAAM,MAAM,QAAQ,CAAC;OACzD,iBAAiC,oBAC/B,gBACA;QACE,UAAU,WAAW;QACrB;QACA;OACF,CACF,IAAI;OACJ;MACF;KACF,CACF;IAAE,CAAC;GAAE,CAAC;EAAE,CAAC,CACX;CACF,CACF;AACF;AACA,SAAS,aAAa,OAAO;CAC3B,OAAuB,oBAAI,mBAAmB,EAAE,UAA0B,oBAAI,iBAAiB,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;AAChH"}
@@ -72,7 +72,7 @@ var graphCanvasDefaults = {
72
72
  maxZoom: 2
73
73
  };
74
74
  function FitOnFirstMeasure(param) {
75
- var { enabled } = param;
75
+ var { enabled, onFitted } = param;
76
76
  var { fitView } = (0, import_xy.useReactFlow)();
77
77
  var allMeasured = (0, import_xy.useStore)(function(state) {
78
78
  var total = 0;
@@ -105,11 +105,12 @@ function FitOnFirstMeasure(param) {
105
105
  (0, import_react.useEffect)(function() {
106
106
  if (!enabled || fitted.current || !allMeasured) return;
107
107
  fitted.current = true;
108
- void fitView();
108
+ void fitView().then(onFitted);
109
109
  }, [
110
110
  enabled,
111
111
  allMeasured,
112
- fitView
112
+ fitView,
113
+ onFitted
113
114
  ]);
114
115
  return null;
115
116
  }
@@ -219,6 +220,10 @@ function NodeGraphCanvas(props) {
219
220
  ]);
220
221
  var snapSession = (0, import_react.useRef)((0, import_snapChanges.createSnapSession)());
221
222
  var [guides, setGuides] = (0, import_react.useState)([]);
223
+ var [fitted, setFitted] = (0, import_react.useState)(false);
224
+ var markFitted = (0, import_react.useCallback)(function() {
225
+ return setFitted(true);
226
+ }, []);
222
227
  var snapOptions = (0, import_snapChanges.snapContextOptions)({
223
228
  snapping,
224
229
  animation: envelope.knobs.animation,
@@ -418,6 +423,7 @@ function NodeGraphCanvas(props) {
418
423
  ref: rootRef,
419
424
  className: className ? `${import_GraphVarsStyle.graphRootClassName} ${className}` : import_GraphVarsStyle.graphRootClassName,
420
425
  "data-graph-scheme": envelope.scheme,
426
+ "data-graph-fitted": fitted ? "" : void 0,
421
427
  style: {
422
428
  width: "100%",
423
429
  height: "100%",
@@ -454,7 +460,10 @@ function NodeGraphCanvas(props) {
454
460
  elementsSelectable: true,
455
461
  proOptions: { hideAttribution: true },
456
462
  children: [
457
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FitOnFirstMeasure, { enabled: fitView }),
463
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FitOnFirstMeasure, {
464
+ enabled: fitView,
465
+ onFitted: markFitted
466
+ }),
458
467
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GraphZoomVar.GraphZoomVar, { rootRef }),
459
468
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GraphPaintProbe.GraphPaintProbe, { onPaint }),
460
469
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GraphCommandBridge.GraphCommandBridge, {
@@ -72,7 +72,7 @@ var graphCanvasDefaults = {
72
72
  maxZoom: 2
73
73
  };
74
74
  function FitOnFirstMeasure(param) {
75
- var { enabled } = param;
75
+ var { enabled, onFitted } = param;
76
76
  var { fitView } = (0, import_xy.useReactFlow)();
77
77
  var allMeasured = (0, import_xy.useStore)(function(state) {
78
78
  var total = 0;
@@ -105,11 +105,12 @@ function FitOnFirstMeasure(param) {
105
105
  (0, import_react.useEffect)(function() {
106
106
  if (!enabled || fitted.current || !allMeasured) return;
107
107
  fitted.current = true;
108
- void fitView();
108
+ void fitView().then(onFitted);
109
109
  }, [
110
110
  enabled,
111
111
  allMeasured,
112
- fitView
112
+ fitView,
113
+ onFitted
113
114
  ]);
114
115
  return null;
115
116
  }
@@ -219,6 +220,10 @@ function NodeGraphCanvas(props) {
219
220
  ]);
220
221
  var snapSession = (0, import_react.useRef)((0, import_snapChanges.createSnapSession)());
221
222
  var [guides, setGuides] = (0, import_react.useState)([]);
223
+ var [fitted, setFitted] = (0, import_react.useState)(false);
224
+ var markFitted = (0, import_react.useCallback)(function() {
225
+ return setFitted(true);
226
+ }, []);
222
227
  var snapOptions = (0, import_snapChanges.snapContextOptions)({
223
228
  snapping,
224
229
  animation: envelope.knobs.animation,
@@ -418,6 +423,7 @@ function NodeGraphCanvas(props) {
418
423
  ref: rootRef,
419
424
  className: className ? `${import_GraphVarsStyle.graphRootClassName} ${className}` : import_GraphVarsStyle.graphRootClassName,
420
425
  "data-graph-scheme": envelope.scheme,
426
+ "data-graph-fitted": fitted ? "" : void 0,
421
427
  style: {
422
428
  width: "100%",
423
429
  height: "100%",
@@ -454,7 +460,10 @@ function NodeGraphCanvas(props) {
454
460
  elementsSelectable: true,
455
461
  proOptions: { hideAttribution: true },
456
462
  children: [
457
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FitOnFirstMeasure, { enabled: fitView }),
463
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FitOnFirstMeasure, {
464
+ enabled: fitView,
465
+ onFitted: markFitted
466
+ }),
458
467
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GraphZoomVar.GraphZoomVar, { rootRef }),
459
468
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GraphPaintProbe.GraphPaintProbe, { onPaint }),
460
469
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GraphCommandBridge.GraphCommandBridge, {
@@ -1 +1 @@
1
- {"version":3,"file":"NodeGraphWeb.native.js","names":[],"sources":["jsx/react-flow/NodeGraphWeb.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar NodeGraphWeb_exports = {};\n__export(NodeGraphWeb_exports, {\n NodeGraphWeb: () => NodeGraphWeb,\n graphCanvasDefaults: () => graphCanvasDefaults\n});\nmodule.exports = __toCommonJS(NodeGraphWeb_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_style = require(\"@xyflow/react/dist/style.css\");\nvar import_graph = require(\"../../css/graph.css\");\nvar import_theme = require(\"@multiplatform.one/theme\");\nvar import_react = require(\"react\");\nvar import_GraphEdge = require(\"../edges/GraphEdge\");\nvar import_snapChanges = require(\"../interaction/snapChanges\");\nvar import_useLassoSelect = require(\"../interaction/useLassoSelect\");\nvar import_LassoOverlay = require(\"./LassoOverlay\");\nvar import_SnapGuides = require(\"./SnapGuides\");\nvar import_ConnectionPuck = require(\"./ConnectionPuck\");\nvar import_KnobEnvelopeProvider = require(\"../knobs/KnobEnvelopeProvider\");\nvar import_useKnobEnvelope = require(\"../knobs/useKnobEnvelope\");\nvar import_handleGeometry = require(\"../nodes/handleGeometry\");\nvar import_lod = require(\"../nodes/lod\");\nvar import_nodeMeasure = require(\"../nodes/nodeMeasure\");\nvar import_GraphVarsStyle = require(\"../theme/GraphVarsStyle\");\nvar import_GraphActions = require(\"./GraphActions\");\nvar import_GraphCommandBridge = require(\"./GraphCommandBridge\");\nvar import_GraphPaintProbe = require(\"./GraphPaintProbe\");\nvar import_GraphZoomVar = require(\"./GraphZoomVar\");\nvar import_GraphNodeHost = require(\"./GraphNodeHost\");\nvar import_useGraphController = require(\"./useGraphController\");\nvar import_xy = require(\"./xy\");\nvar graphCanvasDefaults = {\n onlyRenderVisibleElements: true,\n fitView: true,\n /** Below this zoom a node draws in `overview` mode. Design §5. */\n overviewZoom: import_lod.defaultOverviewZoom,\n /**\n * React Flow's own default is **0.5**, which is ABOVE `overviewZoom`.\n *\n * Measured in Chrome on `NodeGraph/Overview` at 500 nodes: the zoom-out\n * control bottomed out at 0.5, `fitView` clamped there and showed 50 of the\n * 500 nodes, and the overview mode this milestone builds was unreachable —\n * not broken, unreachable, which is worse, because every unit spec around it\n * was green. A level of detail below a floor the user cannot cross is dead\n * code with a passing test suite.\n *\n * `graphCanvasDefaults.minZoom < graphCanvasDefaults.overviewZoom` is\n * asserted in `lod.spec.tsx`, so the two cannot drift back into that state.\n */\n minZoom: 0.05,\n maxZoom: 2\n};\nfunction FitOnFirstMeasure(param) {\n var { enabled } = param;\n var { fitView } = (0, import_xy.useReactFlow)();\n var allMeasured = (0, import_xy.useStore)(function(state) {\n var total = 0;\n var measured = 0;\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = state.nodeLookup.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var node = _step.value;\n var _node_measured;\n total += 1;\n if ((_node_measured = node.measured) === null || _node_measured === void 0 ? void 0 : _node_measured.height) measured += 1;\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n return total > 0 && total === measured;\n });\n var fitted = (0, import_react.useRef)(false);\n (0, import_react.useEffect)(function() {\n if (!enabled || fitted.current || !allMeasured) return;\n fitted.current = true;\n void fitView();\n }, [\n enabled,\n allMeasured,\n fitView\n ]);\n return null;\n}\nfunction NodeGraphCanvas(props) {\n var _props_renderer, _props_commandSlot;\n var { schema, document, defaultDocument, onDocumentChange, onConnectionRefused, readOnly = false, knobs, presetName, intent, coarsePointer = (0, import_theme.isTouchSurface)(), interactionMode = \"pan\", onlyRenderVisibleElements = graphCanvasDefaults.onlyRenderVisibleElements, fitView = graphCanvasDefaults.fitView, overviewZoom = graphCanvasDefaults.overviewZoom, snapping, minZoom = graphCanvasDefaults.minZoom, maxZoom = graphCanvasDefaults.maxZoom, nodeTypes, connectionPuck = true, longPressLasso = false, nodeLabel, className, style, children } = props;\n var rootRef = (0, import_react.useRef)(null);\n var graphEventRef = (0, import_react.useRef)(props.onGraphEvent);\n graphEventRef.current = props.onGraphEvent;\n var emit = (0, import_react.useCallback)(function(event) {\n var _graphEventRef_current;\n return (_graphEventRef_current = graphEventRef.current) === null || _graphEventRef_current === void 0 ? void 0 : _graphEventRef_current.call(graphEventRef, event);\n }, []);\n var perfHost = (_props_renderer = props.renderer) !== null && _props_renderer !== void 0 ? _props_renderer : \"react-flow-web\";\n var readBootMsRef = (0, import_react.useRef)(props.readBootMs);\n readBootMsRef.current = props.readBootMs;\n var onPaint = (0, import_react.useCallback)(function() {\n var _ref;\n var _readBootMsRef_current;\n return emit({\n t: \"paint\",\n bootMs: (_ref = (_readBootMsRef_current = readBootMsRef.current) === null || _readBootMsRef_current === void 0 ? void 0 : _readBootMsRef_current.call(readBootMsRef)) !== null && _ref !== void 0 ? _ref : null\n });\n }, [\n emit\n ]);\n var { knobProps } = (0, import_theme.useResolvedKnobs)();\n var size = (0, import_nodeMeasure.graphNodeSize)(knobProps.sizeToken);\n var envelope = (0, import_useKnobEnvelope.useKnobEnvelope)({\n knobs,\n presetName,\n intent: intent !== null && intent !== void 0 ? intent : void 0,\n pointer: coarsePointer ? \"coarse\" : \"fine\"\n });\n var connectionRadius = (0, import_handleGeometry.portConnectionRadius)({\n size,\n coarsePointer\n });\n var reactFlowApi = (0, import_xy.useReactFlow)();\n var readMeasuredSizes = (0, import_react.useCallback)(function() {\n var sizes = {};\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = reactFlowApi.getNodes()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var node = _step.value;\n var _node_measured, _node_measured1;\n var width = (_node_measured = node.measured) === null || _node_measured === void 0 ? void 0 : _node_measured.width;\n var height = (_node_measured1 = node.measured) === null || _node_measured1 === void 0 ? void 0 : _node_measured1.height;\n if (width && height) sizes[node.id] = {\n width,\n height\n };\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n return sizes;\n }, [\n reactFlowApi\n ]);\n var controller = (0, import_useGraphController.useGraphController)({\n schema,\n document,\n defaultDocument,\n onDocumentChange,\n onConnectionRefused,\n readOnly,\n size,\n coarsePointer,\n readMeasuredSizes\n });\n var setNodeData = (0, import_react.useCallback)(function(id, patch) {\n var node = controller.document.nodes.find(function(candidate) {\n return candidate.id === id;\n });\n if (!node) return;\n controller.commit({\n t: \"setNodeData\",\n id,\n data: {\n ...node.data,\n ...patch\n }\n });\n }, [\n controller\n ]);\n var host = (0, import_react.useMemo)(function() {\n return {\n schema,\n overviewZoom,\n coarsePointer,\n readOnly,\n setNodeData\n };\n }, [\n schema,\n overviewZoom,\n coarsePointer,\n readOnly,\n setNodeData\n ]);\n var snapSession = (0, import_react.useRef)((0, import_snapChanges.createSnapSession)());\n var [guides, setGuides] = (0, import_react.useState)([]);\n var snapOptions = (0, import_snapChanges.snapContextOptions)({\n snapping,\n animation: envelope.knobs.animation,\n reducedMotion: envelope.prefersReducedMotion,\n coarsePointer\n });\n var { alignment: snapAlignmentOn, grid: snapGrid, thresholdScreenPx } = snapOptions;\n var reactFlow = reactFlowApi;\n var controllerNodesRef = (0, import_react.useRef)(controller.nodes);\n controllerNodesRef.current = controller.nodes;\n var controllerChangeRef = (0, import_react.useRef)(controller.onNodesChange);\n controllerChangeRef.current = controller.onNodesChange;\n var onNodesChange = (0, import_react.useCallback)(function(changes) {\n var snapped = (0, import_snapChanges.applySnapToChanges)(changes, {\n nodes: controllerNodesRef.current,\n zoom: reactFlow.getZoom(),\n session: snapSession.current,\n alignment: snapAlignmentOn,\n grid: snapGrid,\n thresholdScreenPx\n });\n setGuides(function(previous) {\n return previous.length === 0 && snapped.guides.length === 0 ? previous : snapped.guides;\n });\n controllerChangeRef.current(snapped.changes);\n }, [\n reactFlow,\n snapAlignmentOn,\n snapGrid,\n thresholdScreenPx\n ]);\n var longPress = (0, import_react.useMemo)(function() {\n return {\n rootRef,\n enabled: longPressLasso,\n viewport: {\n get: function get() {\n return reactFlowApi.getViewport();\n },\n set: function set(viewport) {\n void reactFlowApi.setViewport(viewport, {\n duration: 0\n });\n }\n },\n getNodeRects: function getNodeRects() {\n return reactFlowApi.getNodes().map(function(node) {\n var _ref, _ref1, _ref2, _ref3;\n var _node_measured, _node_measured1;\n return {\n id: node.id,\n rect: {\n x: node.position.x,\n y: node.position.y,\n width: (_ref = (_ref1 = (_node_measured = node.measured) === null || _node_measured === void 0 ? void 0 : _node_measured.width) !== null && _ref1 !== void 0 ? _ref1 : node.width) !== null && _ref !== void 0 ? _ref : 0,\n height: (_ref2 = (_ref3 = (_node_measured1 = node.measured) === null || _node_measured1 === void 0 ? void 0 : _node_measured1.height) !== null && _ref3 !== void 0 ? _ref3 : node.height) !== null && _ref2 !== void 0 ? _ref2 : 0\n }\n };\n });\n },\n onSelect: function onSelect(ids) {\n var wanted = new Set(ids);\n reactFlowApi.setNodes(function(nodes) {\n return nodes.map(function(node) {\n return {\n ...node,\n selected: wanted.has(node.id)\n };\n });\n });\n emit({\n t: \"lasso\",\n phase: \"select\",\n ids,\n haptic: null\n });\n emit({\n t: \"selection\",\n ids\n });\n },\n // A WebView cannot buzz. The shell can, so the canvas asks — a HINT, not\n // a command: whether a buzz is appropriate is the shell's call.\n onHaptic: function onHaptic() {\n return emit({\n t: \"lasso\",\n phase: \"arm\",\n ids: [],\n haptic: \"selection\"\n });\n },\n onCancel: function onCancel() {\n return emit({\n t: \"lasso\",\n phase: \"cancel\",\n ids: [],\n haptic: null\n });\n }\n };\n }, [\n emit,\n longPressLasso,\n reactFlowApi\n ]);\n var lasso = (0, import_useLassoSelect.useLassoSelect)({\n mode: interactionMode,\n longPress\n });\n var ownSlot = (0, import_react.useRef)(null);\n var slot = (_props_commandSlot = props.commandSlot) !== null && _props_commandSlot !== void 0 ? _props_commandSlot : ownSlot;\n var handle = (0, import_react.useMemo)(function() {\n return {\n fitView: function fitView2() {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.fitView();\n },\n relayout: function relayout() {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.relayout();\n },\n zoomTo: function zoomTo(zoom) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.zoomTo(zoom);\n },\n centerOn: function centerOn(nodeId) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.centerOn(nodeId);\n },\n setSelection: function setSelection(ids) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.setSelection(ids);\n },\n exportViewport: function exportViewport() {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.exportViewport();\n },\n undo: function undo() {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.undo();\n },\n redo: function redo() {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.redo();\n },\n perfStart: function perfStart(label) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.perfStart(label);\n },\n perfStop: function perfStop(label) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.perfStop(label);\n },\n perfMark: function perfMark(label) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.perfMark(label);\n },\n setViewport: function setViewport(x, y, zoom) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.setViewport(x, y, zoom);\n },\n synthPinch: function synthPinch(scale, steps) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.synthPinch(scale, steps);\n }\n };\n }, [\n slot\n ]);\n (0, import_react.useImperativeHandle)(props.graphRef, function() {\n return handle;\n }, [\n handle\n ]);\n var types = (0, import_react.useMemo)(function() {\n return {\n [import_useGraphController.defaultGraphNodeType]: import_GraphNodeHost.GraphNodeHost,\n ...nodeTypes\n };\n }, [\n nodeTypes\n ]);\n var actions = (0, import_react.useMemo)(function() {\n return {\n relayout: controller.relayout,\n undo: controller.undo,\n redo: controller.redo,\n canUndo: controller.canUndo,\n canRedo: controller.canRedo,\n layoutRunner: controller.layoutRunner,\n lastLayoutMs: controller.lastLayoutMs,\n layoutPending: controller.layoutPending,\n nodeCount: controller.document.nodes.length\n };\n }, [\n controller.relayout,\n controller.undo,\n controller.redo,\n controller.canUndo,\n controller.canRedo,\n controller.layoutRunner,\n controller.lastLayoutMs,\n controller.layoutPending,\n controller.document.nodes.length\n ]);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(\"div\", {\n ref: rootRef,\n className: className ? `${import_GraphVarsStyle.graphRootClassName} ${className}` : import_GraphVarsStyle.graphRootClassName,\n \"data-graph-scheme\": envelope.scheme,\n style: {\n width: \"100%\",\n height: \"100%\",\n ...style\n },\n children: [\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GraphVarsStyle.GraphVars, {\n vars: envelope.vars,\n scheme: envelope.scheme,\n revision: envelope.revision\n }),\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_KnobEnvelopeProvider.KnobEnvelopeProvider, {\n envelope,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GraphActions.GraphActionsProvider, {\n value: actions,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GraphNodeHost.GraphHostProvider, {\n value: host,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_xy.ReactFlow, {\n nodes: controller.nodes,\n edges: controller.edges,\n nodeTypes: types,\n edgeTypes: import_GraphEdge.graphEdgeTypes,\n onNodesChange,\n onEdgesChange: controller.onEdgesChange,\n onConnect: controller.onConnect,\n isValidConnection: controller.isValidConnection,\n connectionRadius,\n onlyRenderVisibleElements,\n fitView,\n minZoom,\n maxZoom,\n ...lasso.flowProps,\n // The scheme the envelope resolved, so the canvas chrome and the\n // Tamagui bodies inside it cannot disagree about which theme is on.\n colorMode: envelope.scheme,\n nodesDraggable: !readOnly,\n nodesConnectable: !readOnly,\n elementsSelectable: true,\n proOptions: {\n hideAttribution: true\n },\n children: [\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FitOnFirstMeasure, {\n enabled: fitView\n }),\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GraphZoomVar.GraphZoomVar, {\n rootRef\n }),\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GraphPaintProbe.GraphPaintProbe, {\n onPaint\n }),\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GraphCommandBridge.GraphCommandBridge, {\n commands: slot,\n culling: onlyRenderVisibleElements,\n emit,\n host: perfHost,\n rootRef,\n onMounted: props.onCanvasMounted\n }),\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SnapGuides.SnapGuides, {\n guides,\n animated: snapOptions.animateGuides\n }),\n /* INSIDE the canvas, so the `--xy-selection-*` layer is in scope.\n Outside it the rectangle is the right size and invisible. */\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_LassoOverlay.LassoOverlay, {\n rect: lasso.marquee\n }),\n connectionPuck ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ConnectionPuck.ConnectionPuck, {\n document: controller.document,\n schema,\n nodeLabel\n }) : null,\n children\n ]\n })\n })\n })\n })\n ]\n });\n}\nfunction NodeGraphWeb(props) {\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_xy.ReactFlowProvider, {\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NodeGraphCanvas, {\n ...props\n })\n });\n}\n//# sourceMappingURL=NodeGraphWeb.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EA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EAC5E,QACF,CAAC;OACe,iBAAC,GAAG,mBAAmB,IAAG,CAAE,uBAAuB,iBAAiB,EAClF,QACF,CAAC;OACe,iBAAC,GAAG,mBAAmB,IAAG,CAAE,0BAA0B,oBAAoB;QACxF,UAAU;QACV,SAAS;QACT;QACA,MAAM;QACN;QACA,WAAW,MAAM;OACnB,CAAC;OACe,iBAAC,GAAG,mBAAmB,IAAG,CAAE,kBAAkB,YAAY;QACxE;QACA,UAAU,YAAY;OACxB,CAAC;OAGe,iBAAC,GAAG,mBAAmB,IAAG,CAAE,oBAAoB,cAAc,EAC5E,MAAM,MAAM,QACd,CAAC;OACD,iBAAiC,iBAAC,GAAG,mBAAmB,IAAG,CAAE,sBAAsB,gBAAgB;QACjG,UAAU,WAAW;QACrB;QACA;OACF,CAAC,IAAI;OACL;MACF;KACF,CAAC;IACH,CAAC;GACH,CAAC;EACH,CAAC,CACH;CACF,CAAC;AACH;AACA,SAAS,aAAa,OAAO;CAC3B,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,UAAU,mBAAmB,EAC9E,UAA0B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,iBAAiB,EACrE,GAAG,MACL,CAAC,EACH,CAAC;AACH"}
1
+ {"version":3,"file":"NodeGraphWeb.native.js","names":[],"sources":["jsx/react-flow/NodeGraphWeb.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar NodeGraphWeb_exports = {};\n__export(NodeGraphWeb_exports, {\n NodeGraphWeb: () => NodeGraphWeb,\n graphCanvasDefaults: () => graphCanvasDefaults\n});\nmodule.exports = __toCommonJS(NodeGraphWeb_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_style = require(\"@xyflow/react/dist/style.css\");\nvar import_graph = require(\"../../css/graph.css\");\nvar import_theme = require(\"@multiplatform.one/theme\");\nvar import_react = require(\"react\");\nvar import_GraphEdge = require(\"../edges/GraphEdge\");\nvar import_snapChanges = require(\"../interaction/snapChanges\");\nvar import_useLassoSelect = require(\"../interaction/useLassoSelect\");\nvar import_LassoOverlay = require(\"./LassoOverlay\");\nvar import_SnapGuides = require(\"./SnapGuides\");\nvar import_ConnectionPuck = require(\"./ConnectionPuck\");\nvar import_KnobEnvelopeProvider = require(\"../knobs/KnobEnvelopeProvider\");\nvar import_useKnobEnvelope = require(\"../knobs/useKnobEnvelope\");\nvar import_handleGeometry = require(\"../nodes/handleGeometry\");\nvar import_lod = require(\"../nodes/lod\");\nvar import_nodeMeasure = require(\"../nodes/nodeMeasure\");\nvar import_GraphVarsStyle = require(\"../theme/GraphVarsStyle\");\nvar import_GraphActions = require(\"./GraphActions\");\nvar import_GraphCommandBridge = require(\"./GraphCommandBridge\");\nvar import_GraphPaintProbe = require(\"./GraphPaintProbe\");\nvar import_GraphZoomVar = require(\"./GraphZoomVar\");\nvar import_GraphNodeHost = require(\"./GraphNodeHost\");\nvar import_useGraphController = require(\"./useGraphController\");\nvar import_xy = require(\"./xy\");\nvar graphCanvasDefaults = {\n onlyRenderVisibleElements: true,\n fitView: true,\n /** Below this zoom a node draws in `overview` mode. Design §5. */\n overviewZoom: import_lod.defaultOverviewZoom,\n /**\n * React Flow's own default is **0.5**, which is ABOVE `overviewZoom`.\n *\n * Measured in Chrome on `NodeGraph/Overview` at 500 nodes: the zoom-out\n * control bottomed out at 0.5, `fitView` clamped there and showed 50 of the\n * 500 nodes, and the overview mode this milestone builds was unreachable —\n * not broken, unreachable, which is worse, because every unit spec around it\n * was green. A level of detail below a floor the user cannot cross is dead\n * code with a passing test suite.\n *\n * `graphCanvasDefaults.minZoom < graphCanvasDefaults.overviewZoom` is\n * asserted in `lod.spec.tsx`, so the two cannot drift back into that state.\n */\n minZoom: 0.05,\n maxZoom: 2\n};\nfunction FitOnFirstMeasure(param) {\n var { enabled, onFitted } = param;\n var { fitView } = (0, import_xy.useReactFlow)();\n var allMeasured = (0, import_xy.useStore)(function(state) {\n var total = 0;\n var measured = 0;\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = state.nodeLookup.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var node = _step.value;\n var _node_measured;\n total += 1;\n if ((_node_measured = node.measured) === null || _node_measured === void 0 ? void 0 : _node_measured.height) measured += 1;\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n return total > 0 && total === measured;\n });\n var fitted = (0, import_react.useRef)(false);\n (0, import_react.useEffect)(function() {\n if (!enabled || fitted.current || !allMeasured) return;\n fitted.current = true;\n void fitView().then(onFitted);\n }, [\n enabled,\n allMeasured,\n fitView,\n onFitted\n ]);\n return null;\n}\nfunction NodeGraphCanvas(props) {\n var _props_renderer, _props_commandSlot;\n var { schema, document, defaultDocument, onDocumentChange, onConnectionRefused, readOnly = false, knobs, presetName, intent, coarsePointer = (0, import_theme.isTouchSurface)(), interactionMode = \"pan\", onlyRenderVisibleElements = graphCanvasDefaults.onlyRenderVisibleElements, fitView = graphCanvasDefaults.fitView, overviewZoom = graphCanvasDefaults.overviewZoom, snapping, minZoom = graphCanvasDefaults.minZoom, maxZoom = graphCanvasDefaults.maxZoom, nodeTypes, connectionPuck = true, longPressLasso = false, nodeLabel, className, style, children } = props;\n var rootRef = (0, import_react.useRef)(null);\n var graphEventRef = (0, import_react.useRef)(props.onGraphEvent);\n graphEventRef.current = props.onGraphEvent;\n var emit = (0, import_react.useCallback)(function(event) {\n var _graphEventRef_current;\n return (_graphEventRef_current = graphEventRef.current) === null || _graphEventRef_current === void 0 ? void 0 : _graphEventRef_current.call(graphEventRef, event);\n }, []);\n var perfHost = (_props_renderer = props.renderer) !== null && _props_renderer !== void 0 ? _props_renderer : \"react-flow-web\";\n var readBootMsRef = (0, import_react.useRef)(props.readBootMs);\n readBootMsRef.current = props.readBootMs;\n var onPaint = (0, import_react.useCallback)(function() {\n var _ref;\n var _readBootMsRef_current;\n return emit({\n t: \"paint\",\n bootMs: (_ref = (_readBootMsRef_current = readBootMsRef.current) === null || _readBootMsRef_current === void 0 ? void 0 : _readBootMsRef_current.call(readBootMsRef)) !== null && _ref !== void 0 ? _ref : null\n });\n }, [\n emit\n ]);\n var { knobProps } = (0, import_theme.useResolvedKnobs)();\n var size = (0, import_nodeMeasure.graphNodeSize)(knobProps.sizeToken);\n var envelope = (0, import_useKnobEnvelope.useKnobEnvelope)({\n knobs,\n presetName,\n intent: intent !== null && intent !== void 0 ? intent : void 0,\n pointer: coarsePointer ? \"coarse\" : \"fine\"\n });\n var connectionRadius = (0, import_handleGeometry.portConnectionRadius)({\n size,\n coarsePointer\n });\n var reactFlowApi = (0, import_xy.useReactFlow)();\n var readMeasuredSizes = (0, import_react.useCallback)(function() {\n var sizes = {};\n var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n try {\n for (var _iterator = reactFlowApi.getNodes()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var node = _step.value;\n var _node_measured, _node_measured1;\n var width = (_node_measured = node.measured) === null || _node_measured === void 0 ? void 0 : _node_measured.width;\n var height = (_node_measured1 = node.measured) === null || _node_measured1 === void 0 ? void 0 : _node_measured1.height;\n if (width && height) sizes[node.id] = {\n width,\n height\n };\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return != null) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n return sizes;\n }, [\n reactFlowApi\n ]);\n var controller = (0, import_useGraphController.useGraphController)({\n schema,\n document,\n defaultDocument,\n onDocumentChange,\n onConnectionRefused,\n readOnly,\n size,\n coarsePointer,\n readMeasuredSizes\n });\n var setNodeData = (0, import_react.useCallback)(function(id, patch) {\n var node = controller.document.nodes.find(function(candidate) {\n return candidate.id === id;\n });\n if (!node) return;\n controller.commit({\n t: \"setNodeData\",\n id,\n data: {\n ...node.data,\n ...patch\n }\n });\n }, [\n controller\n ]);\n var host = (0, import_react.useMemo)(function() {\n return {\n schema,\n overviewZoom,\n coarsePointer,\n readOnly,\n setNodeData\n };\n }, [\n schema,\n overviewZoom,\n coarsePointer,\n readOnly,\n setNodeData\n ]);\n var snapSession = (0, import_react.useRef)((0, import_snapChanges.createSnapSession)());\n var [guides, setGuides] = (0, import_react.useState)([]);\n var [fitted, setFitted] = (0, import_react.useState)(false);\n var markFitted = (0, import_react.useCallback)(function() {\n return setFitted(true);\n }, []);\n var snapOptions = (0, import_snapChanges.snapContextOptions)({\n snapping,\n animation: envelope.knobs.animation,\n reducedMotion: envelope.prefersReducedMotion,\n coarsePointer\n });\n var { alignment: snapAlignmentOn, grid: snapGrid, thresholdScreenPx } = snapOptions;\n var reactFlow = reactFlowApi;\n var controllerNodesRef = (0, import_react.useRef)(controller.nodes);\n controllerNodesRef.current = controller.nodes;\n var controllerChangeRef = (0, import_react.useRef)(controller.onNodesChange);\n controllerChangeRef.current = controller.onNodesChange;\n var onNodesChange = (0, import_react.useCallback)(function(changes) {\n var snapped = (0, import_snapChanges.applySnapToChanges)(changes, {\n nodes: controllerNodesRef.current,\n zoom: reactFlow.getZoom(),\n session: snapSession.current,\n alignment: snapAlignmentOn,\n grid: snapGrid,\n thresholdScreenPx\n });\n setGuides(function(previous) {\n return previous.length === 0 && snapped.guides.length === 0 ? previous : snapped.guides;\n });\n controllerChangeRef.current(snapped.changes);\n }, [\n reactFlow,\n snapAlignmentOn,\n snapGrid,\n thresholdScreenPx\n ]);\n var longPress = (0, import_react.useMemo)(function() {\n return {\n rootRef,\n enabled: longPressLasso,\n viewport: {\n get: function get() {\n return reactFlowApi.getViewport();\n },\n set: function set(viewport) {\n void reactFlowApi.setViewport(viewport, {\n duration: 0\n });\n }\n },\n getNodeRects: function getNodeRects() {\n return reactFlowApi.getNodes().map(function(node) {\n var _ref, _ref1, _ref2, _ref3;\n var _node_measured, _node_measured1;\n return {\n id: node.id,\n rect: {\n x: node.position.x,\n y: node.position.y,\n width: (_ref = (_ref1 = (_node_measured = node.measured) === null || _node_measured === void 0 ? void 0 : _node_measured.width) !== null && _ref1 !== void 0 ? _ref1 : node.width) !== null && _ref !== void 0 ? _ref : 0,\n height: (_ref2 = (_ref3 = (_node_measured1 = node.measured) === null || _node_measured1 === void 0 ? void 0 : _node_measured1.height) !== null && _ref3 !== void 0 ? _ref3 : node.height) !== null && _ref2 !== void 0 ? _ref2 : 0\n }\n };\n });\n },\n onSelect: function onSelect(ids) {\n var wanted = new Set(ids);\n reactFlowApi.setNodes(function(nodes) {\n return nodes.map(function(node) {\n return {\n ...node,\n selected: wanted.has(node.id)\n };\n });\n });\n emit({\n t: \"lasso\",\n phase: \"select\",\n ids,\n haptic: null\n });\n emit({\n t: \"selection\",\n ids\n });\n },\n // A WebView cannot buzz. The shell can, so the canvas asks — a HINT, not\n // a command: whether a buzz is appropriate is the shell's call.\n onHaptic: function onHaptic() {\n return emit({\n t: \"lasso\",\n phase: \"arm\",\n ids: [],\n haptic: \"selection\"\n });\n },\n onCancel: function onCancel() {\n return emit({\n t: \"lasso\",\n phase: \"cancel\",\n ids: [],\n haptic: null\n });\n }\n };\n }, [\n emit,\n longPressLasso,\n reactFlowApi\n ]);\n var lasso = (0, import_useLassoSelect.useLassoSelect)({\n mode: interactionMode,\n longPress\n });\n var ownSlot = (0, import_react.useRef)(null);\n var slot = (_props_commandSlot = props.commandSlot) !== null && _props_commandSlot !== void 0 ? _props_commandSlot : ownSlot;\n var handle = (0, import_react.useMemo)(function() {\n return {\n fitView: function fitView2() {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.fitView();\n },\n relayout: function relayout() {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.relayout();\n },\n zoomTo: function zoomTo(zoom) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.zoomTo(zoom);\n },\n centerOn: function centerOn(nodeId) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.centerOn(nodeId);\n },\n setSelection: function setSelection(ids) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.setSelection(ids);\n },\n exportViewport: function exportViewport() {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.exportViewport();\n },\n undo: function undo() {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.undo();\n },\n redo: function redo() {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.redo();\n },\n perfStart: function perfStart(label) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.perfStart(label);\n },\n perfStop: function perfStop(label) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.perfStop(label);\n },\n perfMark: function perfMark(label) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.perfMark(label);\n },\n setViewport: function setViewport(x, y, zoom) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.setViewport(x, y, zoom);\n },\n synthPinch: function synthPinch(scale, steps) {\n var _slot_current;\n return (_slot_current = slot.current) === null || _slot_current === void 0 ? void 0 : _slot_current.synthPinch(scale, steps);\n }\n };\n }, [\n slot\n ]);\n (0, import_react.useImperativeHandle)(props.graphRef, function() {\n return handle;\n }, [\n handle\n ]);\n var types = (0, import_react.useMemo)(function() {\n return {\n [import_useGraphController.defaultGraphNodeType]: import_GraphNodeHost.GraphNodeHost,\n ...nodeTypes\n };\n }, [\n nodeTypes\n ]);\n var actions = (0, import_react.useMemo)(function() {\n return {\n relayout: controller.relayout,\n undo: controller.undo,\n redo: controller.redo,\n canUndo: controller.canUndo,\n canRedo: controller.canRedo,\n layoutRunner: controller.layoutRunner,\n lastLayoutMs: controller.lastLayoutMs,\n layoutPending: controller.layoutPending,\n nodeCount: controller.document.nodes.length\n };\n }, [\n controller.relayout,\n controller.undo,\n controller.redo,\n controller.canUndo,\n controller.canRedo,\n controller.layoutRunner,\n controller.lastLayoutMs,\n controller.layoutPending,\n controller.document.nodes.length\n ]);\n return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(\"div\", {\n ref: rootRef,\n className: className ? `${import_GraphVarsStyle.graphRootClassName} ${className}` : import_GraphVarsStyle.graphRootClassName,\n \"data-graph-scheme\": envelope.scheme,\n \"data-graph-fitted\": fitted ? \"\" : void 0,\n style: {\n width: \"100%\",\n height: \"100%\",\n ...style\n },\n children: [\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GraphVarsStyle.GraphVars, {\n vars: envelope.vars,\n scheme: envelope.scheme,\n revision: envelope.revision\n }),\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_KnobEnvelopeProvider.KnobEnvelopeProvider, {\n envelope,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GraphActions.GraphActionsProvider, {\n value: actions,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GraphNodeHost.GraphHostProvider, {\n value: host,\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_xy.ReactFlow, {\n nodes: controller.nodes,\n edges: controller.edges,\n nodeTypes: types,\n edgeTypes: import_GraphEdge.graphEdgeTypes,\n onNodesChange,\n onEdgesChange: controller.onEdgesChange,\n onConnect: controller.onConnect,\n isValidConnection: controller.isValidConnection,\n connectionRadius,\n onlyRenderVisibleElements,\n fitView,\n minZoom,\n maxZoom,\n ...lasso.flowProps,\n // The scheme the envelope resolved, so the canvas chrome and the\n // Tamagui bodies inside it cannot disagree about which theme is on.\n colorMode: envelope.scheme,\n nodesDraggable: !readOnly,\n nodesConnectable: !readOnly,\n elementsSelectable: true,\n proOptions: {\n hideAttribution: true\n },\n children: [\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FitOnFirstMeasure, {\n enabled: fitView,\n onFitted: markFitted\n }),\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GraphZoomVar.GraphZoomVar, {\n rootRef\n }),\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GraphPaintProbe.GraphPaintProbe, {\n onPaint\n }),\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GraphCommandBridge.GraphCommandBridge, {\n commands: slot,\n culling: onlyRenderVisibleElements,\n emit,\n host: perfHost,\n rootRef,\n onMounted: props.onCanvasMounted\n }),\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SnapGuides.SnapGuides, {\n guides,\n animated: snapOptions.animateGuides\n }),\n /* INSIDE the canvas, so the `--xy-selection-*` layer is in scope.\n Outside it the rectangle is the right size and invisible. */\n /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_LassoOverlay.LassoOverlay, {\n rect: lasso.marquee\n }),\n connectionPuck ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ConnectionPuck.ConnectionPuck, {\n document: controller.document,\n schema,\n nodeLabel\n }) : null,\n children\n ]\n })\n })\n })\n })\n ]\n });\n}\nfunction NodeGraphWeb(props) {\n return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_xy.ReactFlowProvider, {\n children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NodeGraphCanvas, {\n ...props\n })\n });\n}\n//# sourceMappingURL=NodeGraphWeb.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,uBAAuB,CAAC;AAC5B,SAAS,sBAAsB;CAC7B,oBAAoB;CACpB,2BAA2B;AAC7B,CAAC;AACD,OAAO,UAAU,aAAa,oBAAoB;AAClD,IAAI,qBAAqB,QAAQ,mBAAmB;AACpD,IAAI,eAAe,QAAQ,8BAA8B;AACzD,IAAI,eAAe,QAAQ,qBAAqB;AAChD,IAAI,eAAe,QAAQ,0BAA0B;AACrD,IAAI,eAAe,QAAQ,OAAO;AAClC,IAAI,mBAAmB,QAAQ,8BAAoB;AACnD,IAAI,qB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AY;QACxE;QACA,UAAU,YAAY;OACxB,CAAC;OAGe,iBAAC,GAAG,mBAAmB,IAAG,CAAE,oBAAoB,cAAc,EAC5E,MAAM,MAAM,QACd,CAAC;OACD,iBAAiC,iBAAC,GAAG,mBAAmB,IAAG,CAAE,sBAAsB,gBAAgB;QACjG,UAAU,WAAW;QACrB;QACA;OACF,CAAC,IAAI;OACL;MACF;KACF,CAAC;IACH,CAAC;GACH,CAAC;EACH,CAAC,CACH;CACF,CAAC;AACH;AACA,SAAS,aAAa,OAAO;CAC3B,OAAuB,iBAAC,GAAG,mBAAmB,IAAG,CAAE,UAAU,mBAAmB,EAC9E,UAA0B,iBAAC,GAAG,mBAAmB,IAAG,CAAE,iBAAiB,EACrE,GAAG,MACL,CAAC,EACH,CAAC;AACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplatform.one/node-graph",
3
- "version": "11.3.2",
3
+ "version": "11.4.0",
4
4
  "description": "Node graph editor — React Flow on web, Tamagui knob-aware nodes, an Expo DOM host on native",
5
5
  "keywords": [
6
6
  "multiplatform",
@@ -91,16 +91,16 @@
91
91
  },
92
92
  "dependencies": {
93
93
  "@dagrejs/dagre": "^3.1.1",
94
- "@multiplatform.one/forms": "^11.3.2",
95
- "@multiplatform.one/theme": "^11.3.2",
94
+ "@multiplatform.one/forms": "^11.4.0",
95
+ "@multiplatform.one/theme": "^11.4.0",
96
96
  "@tamagui/web": "3.2.3",
97
97
  "@xyflow/react": "^12.12.0",
98
98
  "@xyflow/system": "0.0.83",
99
99
  "tamagui": "3.2.3"
100
100
  },
101
101
  "devDependencies": {
102
- "@multiplatform.one/config": "11.3.2",
103
- "@multiplatform.one/test-utils": "11.3.2",
102
+ "@multiplatform.one/config": "11.4.0",
103
+ "@multiplatform.one/test-utils": "11.4.0",
104
104
  "@tamagui/build": "3.2.3",
105
105
  "@testing-library/react": "^16.3.3",
106
106
  "@types/react-dom": "^19.3.0",
@@ -113,7 +113,7 @@
113
113
  "vitest": "^4.1.12"
114
114
  },
115
115
  "peerDependencies": {
116
- "@multiplatform.one/components": "^11.3.2",
116
+ "@multiplatform.one/components": "^11.4.0",
117
117
  "expo": ">=55",
118
118
  "expo-haptics": "58.0.7",
119
119
  "react": "^19.1.0",
@@ -37,6 +37,7 @@
37
37
 
38
38
  import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
39
39
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
40
+ import { expect, waitFor } from "storybook/test";
40
41
  import { Button } from "@multiplatform.one/forms";
41
42
  import { SizableText as TamaguiSizableText, XStack, YStack } from "tamagui";
42
43
  import type { GraphEventWire } from "../dom/wire";
@@ -346,4 +347,12 @@ export const Undo: Story = {
346
347
 
347
348
  export const Large200: Story = {
348
349
  render: () => <AutoLayoutPage count={200} parkHandle fitView />,
350
+ // FZ-12131: the shot waits for the fit on the measured nodes, not the one
351
+ // React Flow makes on the seeded boxes first.
352
+ play: async ({ canvasElement }) => {
353
+ await waitFor(() => expect(canvasElement.querySelector("[data-graph-fitted]")).not.toBeNull(), {
354
+ timeout: 20000,
355
+ });
356
+ },
357
+ parameters: { lostpixel: { waitForPlay: true } },
349
358
  };