@almadar/shell-web 0.1.0 → 1.1.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.
Files changed (131) hide show
  1. package/dist/{ArbitraryClassCompiler-Mzabq-UB.d.ts → ArbitraryClassCompiler-CO_iASBn.d.ts} +99 -4
  2. package/dist/AvlGlyph-PIXU6QH5.js +5 -0
  3. package/dist/AvlStateMachine-CKGMECMG.js +8 -0
  4. package/dist/AvlTransitionDetail-QZX6G5KJ.js +10 -0
  5. package/dist/AvlTransitionExplainer-26WLEIC6.js +11 -0
  6. package/dist/BehaviorView-JLZ4PKWY.js +10 -0
  7. package/dist/{EventBusProvider-CVwjkV_2.d.ts → EventBusProvider-BFFHfN4O.d.ts} +12 -0
  8. package/dist/{FileTree-BCFnBEuQ.d.ts → FileTree-B3GDAjaQ.d.ts} +131 -4
  9. package/dist/FlowCanvas-RPII4V24.js +23 -0
  10. package/dist/{BehaviorValueFrame-SSEMEBTG.css → FlowCanvas-VWUPMBKB.css} +189 -191
  11. package/dist/{GameAudioProvider-Cm9BnvmP.d.ts → GameAudioProvider-D7wo5ryN.d.ts} +5 -8
  12. package/dist/KernelEngineContext-CPeWQMAz.d.ts +46 -0
  13. package/dist/LayersPanel-M2LHWUFF.js +6 -0
  14. package/dist/ModuleCard-NJD6JQGD.js +6 -0
  15. package/dist/OrbInspector-OWWKPOBF.js +23 -0
  16. package/dist/{TraitValueFrame-4G3KOUBR.css → OrbInspector-VMTMZHNQ.css} +189 -191
  17. package/dist/{Select-mDZIwNqN.d.ts → Select-C2Uq6t86.d.ts} +17 -31
  18. package/dist/ServerBridge-Bqsj-lOU.d.ts +124 -0
  19. package/dist/{FlowCanvas-3JRMNJLV.css → UISlotRenderer-BIS6KT7T.css} +189 -191
  20. package/dist/UISlotRenderer-PY7FIJXN.js +23 -0
  21. package/dist/auth/browser/index.js +1 -0
  22. package/dist/auth/react/index.d.ts +8 -1
  23. package/dist/auth/react/index.js +40 -2
  24. package/dist/avl/index.css +189 -191
  25. package/dist/avl/index.d.ts +107 -85
  26. package/dist/avl/index.js +170 -39
  27. package/dist/{chunk-P4LNHAFI.js → chunk-2WGR4TDJ.js} +465 -36
  28. package/dist/{chunk-GKIFONTE.js → chunk-3S54FWRC.js} +2 -2
  29. package/dist/{chunk-KVQS4GXU.js → chunk-4YJ53G7S.js} +18 -8
  30. package/dist/{chunk-MBQAMMSE.js → chunk-4YXBKHHM.js} +269 -658
  31. package/dist/{chunk-YDNJLLG6.js → chunk-57DC34LY.js} +19 -10
  32. package/dist/{chunk-FP3WIKTC.js → chunk-7N6ZPHQ5.js} +9 -1
  33. package/dist/{chunk-AILY3XPS.js → chunk-AE7VCQB6.js} +5 -6
  34. package/dist/{chunk-L677XGY3.js → chunk-AGVSO4WY.js} +4 -5
  35. package/dist/{chunk-FAJDTHWC.js → chunk-AGXD77SL.js} +2 -2
  36. package/dist/chunk-AU7O65OX.js +66 -0
  37. package/dist/{chunk-DFNZUYX4.js → chunk-FAKU5F62.js} +273 -29
  38. package/dist/{chunk-U6QRZASX.js → chunk-ILQXJ2AR.js} +1 -1
  39. package/dist/chunk-M74BCDBQ.js +490 -0
  40. package/dist/{chunk-GYTPOFVC.js → chunk-MS4K3K2R.js} +12095 -13329
  41. package/dist/{chunk-SGM3FASH.js → chunk-OWNG4JZI.js} +13 -12
  42. package/dist/{chunk-VFF5OO47.js → chunk-PCR37T3U.js} +15 -38
  43. package/dist/{chunk-SJGJJKBY.js → chunk-PRLHKBXG.js} +5 -3
  44. package/dist/{chunk-R5O5AUPI.js → chunk-PRXQGGCO.js} +93 -86
  45. package/dist/{chunk-42FY4RYA.js → chunk-REXYVBUO.js} +2 -2
  46. package/dist/{chunk-EQAMU2ZC.js → chunk-UTDC2NEA.js} +1 -1
  47. package/dist/{chunk-73SRAB4P.js → chunk-UU57VNS2.js} +2 -2
  48. package/dist/{chunk-TESBIVUA.js → chunk-VHC2M26B.js} +2 -2
  49. package/dist/{chunk-L2DEKY4J.js → chunk-VO2TTLS5.js} +3 -6
  50. package/dist/{chunk-2PY54Z44.js → chunk-VUIACGDU.js} +4 -5
  51. package/dist/{chunk-DLZF4PVE.js → chunk-YYIHRIDH.js} +3 -3
  52. package/dist/{chunk-DYEKAA4L.js → chunk-ZDRDJKYB.js} +243 -252
  53. package/dist/components/index.css +189 -191
  54. package/dist/components/index.d.ts +739 -289
  55. package/dist/components/index.js +25 -28
  56. package/dist/context/index.d.ts +2 -3
  57. package/dist/context/index.js +4 -3
  58. package/dist/core.d.ts +95 -19
  59. package/dist/core.js +2 -1
  60. package/dist/design-classes/index.cjs +3 -1
  61. package/dist/design-classes/index.js +3 -1
  62. package/dist/{fx-CmQjnHmT.d.ts → fx-Br8zjvu9.d.ts} +6 -6
  63. package/dist/hooks/index.d.ts +40 -5
  64. package/dist/hooks/index.js +5 -4
  65. package/dist/index.d.ts +40 -114
  66. package/dist/index.js +174 -34
  67. package/dist/kernel-client-JW6OH5FX.js +537 -0
  68. package/dist/kernel-wire-DGAySGhX.d.ts +95 -0
  69. package/dist/lib/index.d.ts +3 -4
  70. package/dist/lib/index.js +4 -4
  71. package/dist/{prism-AIWGN2X5.js → prism-X5YWKXO5.js} +5 -3
  72. package/dist/providers/index.css +189 -191
  73. package/dist/providers/index.d.ts +41 -28
  74. package/dist/providers/index.js +19 -24
  75. package/dist/renderer/index.d.ts +0 -2
  76. package/dist/renderer/index.js +1 -0
  77. package/dist/runtime/index.css +189 -191
  78. package/dist/runtime/index.d.ts +57 -253
  79. package/dist/runtime/index.js +18 -24
  80. package/dist/ssr/index.cjs +2643 -535
  81. package/dist/ssr/index.d.cts +0 -23
  82. package/dist/ssr/index.d.ts +0 -23
  83. package/dist/ssr/index.js +2639 -535
  84. package/dist/storage/browser/index.js +1 -0
  85. package/dist/test-support.d.ts +15 -8
  86. package/dist/test-support.js +91 -24
  87. package/dist/{paintDispatch-ChW5mVuK.d.ts → verificationRegistry-oopV1J1n.d.ts} +132 -30
  88. package/package.json +14 -38
  89. package/src/core/lib/band-shapes.json +7 -0
  90. package/src/core/locales/ar.json +18 -5
  91. package/src/core/locales/en.json +18 -5
  92. package/src/core/locales/sl.json +18 -5
  93. package/tailwind-preset.cjs +30 -1
  94. package/dist/AvlGlyph-JKJOAH23.js +0 -6
  95. package/dist/AvlStateMachine-PI4YGREK.js +0 -8
  96. package/dist/AvlTransitionDetail-ZH7V24UG.js +0 -12
  97. package/dist/AvlTransitionExplainer-ZSRT7L6Y.js +0 -13
  98. package/dist/BehaviorValueFrame-6RUJXT4A.js +0 -29
  99. package/dist/BehaviorView-RFEE5J6E.js +0 -10
  100. package/dist/Canvas3DHost-_Y-5uLM_.d.ts +0 -552
  101. package/dist/FlowCanvas-STDC4OWK.js +0 -27
  102. package/dist/KernelEngineContext-BOCQoFwk.d.ts +0 -43
  103. package/dist/LayersPanel-BBQ54IVG.js +0 -7
  104. package/dist/ModuleCard-3TT2X7IW.js +0 -7
  105. package/dist/OrbInspector-K6T6O7GI.js +0 -27
  106. package/dist/OrbInspector-MHLJ6OEE.css +0 -1756
  107. package/dist/ServerBridge-Cm1On51b.d.ts +0 -233
  108. package/dist/TraitValueFrame-2PJGLLVI.js +0 -28
  109. package/dist/UISlotRenderer-JKFSX24W.js +0 -27
  110. package/dist/UISlotRenderer-KVFO6J7R.css +0 -1756
  111. package/dist/UserContext-DqWeZkUZ.d.ts +0 -100
  112. package/dist/avl-3d-context-BIRKWpaL.d.ts +0 -204
  113. package/dist/avl-schema-parser-CtJxJ9KU.d.ts +0 -132
  114. package/dist/avl-zoom-state-CKMVuBFg.d.ts +0 -17
  115. package/dist/chunk-2QOH2HWM.js +0 -95
  116. package/dist/chunk-6P3MWXYE.js +0 -440
  117. package/dist/chunk-B4BU77LT.js +0 -432
  118. package/dist/chunk-DJ433ET5.js +0 -1327
  119. package/dist/chunk-DZ42OJQC.js +0 -176
  120. package/dist/chunk-EOWMARUB.js +0 -16
  121. package/dist/chunk-FIW6WN23.js +0 -508
  122. package/dist/chunk-GAR5TQ5B.js +0 -199
  123. package/dist/chunk-PC7K4SK7.js +0 -1384
  124. package/dist/chunk-ZO6MXAS3.js +0 -69
  125. package/dist/kernel-client-ZH4PSMCN.js +0 -367
  126. package/dist/kernel-wire-B4S8pnP3.d.ts +0 -65
  127. package/dist/three/index.css +0 -503
  128. package/dist/three/index.d.ts +0 -1185
  129. package/dist/three/index.js +0 -3896
  130. package/dist/useKeyboardRouter-Dsq553Ur.d.ts +0 -42
  131. package/dist/verificationRegistry-CabxhfTv.d.ts +0 -122
@@ -1,14 +1,13 @@
1
- import { JsonTreeEditor } from './chunk-U6QRZASX.js';
2
- import { transitionPlayback, Accordion } from './chunk-42FY4RYA.js';
3
- import { EmptyState } from './chunk-FAJDTHWC.js';
4
- import { useContainerWidth, roundedEdgePath } from './chunk-GAR5TQ5B.js';
5
- import { AvlExplain, AvlEffectChip } from './chunk-SJGJJKBY.js';
6
- import { AvlEffect } from './chunk-DZ42OJQC.js';
7
- import { parseTraitLevel } from './chunk-VFF5OO47.js';
8
- import { AVL_INK, AVL_FONT, effectZoneOf, avlTint, OPERATOR_CATEGORY_COLORS, avlBlend } from './chunk-DFNZUYX4.js';
9
- import { useTranslate, useMediaQuery, Box, Typography, Card, VStack, HStack, Badge, Button } from './chunk-MBQAMMSE.js';
1
+ import { JsonTreeEditor } from './chunk-ILQXJ2AR.js';
2
+ import { transitionPlayback, Accordion } from './chunk-REXYVBUO.js';
3
+ import { EmptyState } from './chunk-AGXD77SL.js';
4
+ import { useContainerWidth, roundedEdgePath } from './chunk-M74BCDBQ.js';
5
+ import { parseTraitLevel } from './chunk-PCR37T3U.js';
6
+ import { AvlExplain, AvlEffectChip } from './chunk-PRLHKBXG.js';
7
+ import { AVL_INK, AVL_FONT, effectZoneOf, avlTint, AvlEffect, OPERATOR_CATEGORY_COLORS, avlBlend } from './chunk-FAKU5F62.js';
8
+ import { useTranslate, useMediaQuery, Box, Typography, Card, VStack, HStack, Badge, Button } from './chunk-4YXBKHHM.js';
10
9
  import { useRef, useMemo, useState } from 'react';
11
- import { formatSExpr, isBinding } from '@almadar/core';
10
+ import { formatSExpr, JsonValueSchema, isJsonObject, isBinding } from '@almadar/core';
12
11
  import { operatorVisualForm, getStdOperatorMeta } from '@almadar/std/registry';
13
12
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
14
13
 
@@ -587,7 +586,6 @@ var AvlCircuit = ({ expr, trace, cursor, title, showCode = true, className }) =>
587
586
  ] });
588
587
  };
589
588
  AvlCircuit.displayName = "AvlCircuit";
590
- var isConfigObject = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
591
589
  var EffectHeader = ({ type, failed, failedLabel, note }) => /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
592
590
  /* @__PURE__ */ jsx(AvlEffectChip, { effectType: type, size: 18, note }),
593
591
  /* @__PURE__ */ jsx(Badge, { variant: "primary", size: "sm", children: type }),
@@ -640,7 +638,10 @@ var TransitionDetailBody = ({ orbital, trait, transition, annotations, playback,
640
638
  stepEvent ? /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
641
639
  /* @__PURE__ */ jsx(Typography, { variant: "overline", color: "muted", children: t("avl.play.payload") }),
642
640
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "start", children: [
643
- /* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsx(JsonTreeEditor, { value: payload, onChange: (next) => setPayload(isConfigObject(next) ? next : {}) }) }),
641
+ /* @__PURE__ */ jsx(Box, { className: "flex-1 min-w-0", children: /* @__PURE__ */ jsx(JsonTreeEditor, { value: payload, onChange: (next) => {
642
+ const json = JsonValueSchema.safeParse(next);
643
+ setPayload(json.success && isJsonObject(json.data) ? json.data : {});
644
+ } }) }),
644
645
  /* @__PURE__ */ jsx(Button, { variant: "primary", size: "sm", action: stepEvent, actionPayload: request, leftIcon: "skip-forward", children: t("avl.play.step") })
645
646
  ] })
646
647
  ] }) : null,
@@ -1,46 +1,11 @@
1
- import { routing_exports } from './chunk-DYEKAA4L.js';
2
1
  import { renderUiEntriesOf } from '@almadar/core/patterns';
3
- import { isInlineTrait } from '@almadar/core';
2
+ import { kernelEvaluator } from '@almadar/core';
4
3
 
5
- function instanceOf(orbital, orbitalId, ref) {
6
- const at = orbitalId === void 0 ? { orbital } : { orbital, orbitalId };
7
- if (isInlineTrait(ref)) return { ...at, name: ref.name, trait: ref };
8
- if (typeof ref === "object" && ref._resolved) return { ...at, name: ref.name ?? ref._resolved.name, trait: ref._resolved };
9
- return null;
10
- }
11
4
  var wiresBySchema = /* @__PURE__ */ new WeakMap();
12
5
  function traitEventWires(schema) {
13
6
  const cached = wiresBySchema.get(schema);
14
7
  if (cached) return cached;
15
- const instances = (schema.orbitals ?? []).flatMap(
16
- (o) => (o.traits ?? []).map((ref) => instanceOf(o.name, o.id, ref)).filter((i) => i !== null)
17
- );
18
- const listensByEvent = /* @__PURE__ */ new Map();
19
- for (const listener of instances) {
20
- for (const listen of listener.trait.listens ?? []) {
21
- const { bareEvent, matcher } = (0, routing_exports.parseListenSource)(listen, listener.orbital);
22
- const bucket = listensByEvent.get(bareEvent);
23
- if (bucket) bucket.push({ listener, matcher });
24
- else listensByEvent.set(bareEvent, [{ listener, matcher }]);
25
- }
26
- }
27
- const wires = [];
28
- for (const emitter of instances) {
29
- const source = { orbital: emitter.orbital, trait: emitter.name, ...emitter.orbitalId ? { orbitalId: emitter.orbitalId } : {}, ...emitter.trait.id ? { traitId: emitter.trait.id } : {} };
30
- for (const emit of emitter.trait.emits ?? []) {
31
- for (const { listener, matcher } of listensByEvent.get(emit.event) ?? []) {
32
- if (listener.orbital === emitter.orbital && listener.name === emitter.name) continue;
33
- if (!matcher(source)) continue;
34
- wires.push({
35
- emitterOrbital: emitter.orbital,
36
- emitterTrait: emitter.name,
37
- listenerOrbital: listener.orbital,
38
- listenerTrait: listener.name,
39
- event: emit.event
40
- });
41
- }
42
- }
43
- }
8
+ const wires = kernelEvaluator().eventWires(schema);
44
9
  wiresBySchema.set(schema, wires);
45
10
  return wires;
46
11
  }
@@ -269,6 +234,18 @@ function traitLevelFromDescription(description) {
269
234
  description.events.listens
270
235
  );
271
236
  }
237
+ function traitLevelFromMounted(trait) {
238
+ return {
239
+ name: trait.trait,
240
+ linkedEntity: trait.linkedEntity ?? "",
241
+ states: trait.states.map((s) => ({ name: s.name, isInitial: s.isInitial, isTerminal: s.isTerminal })),
242
+ transitions: trait.transitions.flatMap(
243
+ (t) => t.from.map((from) => ({ from, to: t.to, event: t.event, guard: null, effects: [], index: t.index }))
244
+ ),
245
+ emittedEvents: trait.emits,
246
+ listenedEvents: trait.listens.map((l) => l.event)
247
+ };
248
+ }
272
249
  function traitLevelOf(name, linkedEntity, sm, emittedEvents, listenedEvents) {
273
250
  const states = getStates(sm).map((s) => ({
274
251
  name: s.name ?? "",
@@ -316,4 +293,4 @@ function parseTransitionLevel(schema, orbitalName, traitName, transitionIndex) {
316
293
  };
317
294
  }
318
295
 
319
- export { parseApplicationLevel, parseOrbitalLevel, parseTraitLevel, parseTransitionLevel, programTraits, traitEventWires, traitLevelFromDescription, traitLevelFromTrait, traitTransitionRenderUi };
296
+ export { parseApplicationLevel, parseOrbitalLevel, parseTraitLevel, parseTransitionLevel, programTraits, traitEventWires, traitLevelFromDescription, traitLevelFromMounted, traitLevelFromTrait, traitTransitionRenderUi };
@@ -1,6 +1,5 @@
1
- import { AvlEffect } from './chunk-DZ42OJQC.js';
2
- import { effectCategoryOf } from './chunk-DFNZUYX4.js';
3
- import { useThemeScope, Box, useTapReveal, Typography, cn, domPassthrough, usePresence, useDialogBehavior, SurfaceBoundary, VStack, useTranslate } from './chunk-MBQAMMSE.js';
1
+ import { effectCategoryOf, AvlEffect } from './chunk-FAKU5F62.js';
2
+ import { useThemeScope, Box, useTapReveal, Typography, cn, domPassthrough, usePresence, useDialogBehavior, SurfaceBoundary, VStack, useTranslate } from './chunk-4YXBKHHM.js';
4
3
  import { createPortal } from 'react-dom';
5
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
5
  import React, { useId, useState, useRef, useLayoutEffect, useEffect } from 'react';
@@ -420,6 +419,9 @@ var Popover = ({
420
419
  style: {
421
420
  left: placement.left,
422
421
  top: placement.top,
422
+ // Sized by its content, not by the room right of `left`: a placement-dependent width re-places it forever.
423
+ width: "max-content",
424
+ maxWidth: `calc(100vw - ${2 * VIEWPORT_EDGE_PADDING}px)`,
423
425
  ...popoverWidth === 0 ? { visibility: "hidden" } : void 0
424
426
  },
425
427
  ...domPassthrough(rest),
@@ -1,7 +1,30 @@
1
- import { useEventBus, useTranslate } from './chunk-MBQAMMSE.js';
2
- import { useRef, useEffect, useCallback, useState, useMemo } from 'react';
1
+ import { useEventBus, useTranslate } from './chunk-4YXBKHHM.js';
2
+ import { createContext, useMemo, useContext, useRef, useEffect, useCallback, useState } from 'react';
3
+ import { jsx } from 'react/jsx-runtime';
3
4
  import { resolvePageMeta } from '@almadar/core';
4
5
 
6
+ function createEditorFocus() {
7
+ let current = null;
8
+ return {
9
+ focused: () => current,
10
+ focus: (editorId) => {
11
+ current = editorId;
12
+ },
13
+ blur: (editorId) => {
14
+ if (current === editorId) current = null;
15
+ }
16
+ };
17
+ }
18
+ var INERT_EDITOR_FOCUS = { focused: () => null, focus: () => void 0, blur: () => void 0 };
19
+ var EditorFocusContext = createContext(INERT_EDITOR_FOCUS);
20
+ var EditorFocusProvider = ({ children }) => {
21
+ const focus = useMemo(createEditorFocus, []);
22
+ return /* @__PURE__ */ jsx(EditorFocusContext.Provider, { value: focus, children });
23
+ };
24
+ EditorFocusProvider.displayName = "EditorFocusProvider";
25
+ function useEditorFocus() {
26
+ return useContext(EditorFocusContext);
27
+ }
5
28
  function mergeCaptureTables(tables) {
6
29
  const merged = {};
7
30
  for (const table of tables) {
@@ -32,38 +55,18 @@ function keyChord(event) {
32
55
  function useKeyboardRouter(options) {
33
56
  const {
34
57
  captureTable,
35
- editorFocusEvent = "EDITOR_FOCUS",
36
- editorBlurEvent = "EDITOR_BLUR",
37
58
  keyEvent = "KEY",
38
59
  enabled = true
39
60
  } = options;
40
61
  const eventBus = useEventBus();
41
62
  const captureTableRef = useRef(captureTable);
42
63
  captureTableRef.current = captureTable;
43
- const focusedEditorIdRef = useRef(null);
44
- useEffect(() => {
45
- const unsubFocus = eventBus.on(`UI:${editorFocusEvent}`, (event) => {
46
- const editorId = event.payload?.editorId;
47
- if (typeof editorId === "string") {
48
- focusedEditorIdRef.current = editorId;
49
- }
50
- });
51
- const unsubBlur = eventBus.on(`UI:${editorBlurEvent}`, (event) => {
52
- const editorId = event.payload?.editorId;
53
- if (typeof editorId === "string" && focusedEditorIdRef.current === editorId) {
54
- focusedEditorIdRef.current = null;
55
- }
56
- });
57
- return () => {
58
- unsubFocus();
59
- unsubBlur();
60
- };
61
- }, [eventBus, editorFocusEvent, editorBlurEvent]);
64
+ const editorFocus = useEditorFocus();
62
65
  useEffect(() => {
63
66
  if (!enabled) return;
64
67
  const handleKeyDown = (event) => {
65
68
  if (event.isComposing) return;
66
- const target = focusedEditorIdRef.current ?? "shell";
69
+ const target = editorFocus.focused() ?? "shell";
67
70
  const entry = captureTableRef.current[target];
68
71
  const captured = entry !== void 0 && (entry.keys.has(event.key) || entry.keys.has(keyChord(event)));
69
72
  if (captured) {
@@ -84,7 +87,7 @@ function useKeyboardRouter(options) {
84
87
  return () => {
85
88
  window.removeEventListener("keydown", handleKeyDown, { capture: true });
86
89
  };
87
- }, [eventBus, enabled, keyEvent]);
90
+ }, [eventBus, editorFocus, enabled, keyEvent]);
88
91
  }
89
92
  function useSwipeGesture(callbacks, options = {}) {
90
93
  const { threshold = 50, velocityThreshold = 0.3, preventDefault = false } = options;
@@ -372,66 +375,6 @@ function parseQueryBinding(binding) {
372
375
  field: parts.length > 1 ? parts.slice(1).join(".") : void 0
373
376
  };
374
377
  }
375
- function usePullToRefresh(onRefresh, options = {}) {
376
- const { threshold = 60, maxPull = 120 } = options;
377
- const [pullDistance, setPullDistance] = useState(0);
378
- const [isPulling, setIsPulling] = useState(false);
379
- const [isRefreshing, setIsRefreshing] = useState(false);
380
- const startY = useRef(0);
381
- const scrollTopRef = useRef(0);
382
- const onTouchStart = useCallback((e) => {
383
- const container = e.currentTarget;
384
- scrollTopRef.current = container.scrollTop;
385
- if (scrollTopRef.current <= 0) {
386
- startY.current = e.touches[0].clientY;
387
- setIsPulling(true);
388
- }
389
- }, []);
390
- const onTouchMove = useCallback((e) => {
391
- if (!isPulling || isRefreshing) return;
392
- const container = e.currentTarget;
393
- if (container.scrollTop > 0) {
394
- setPullDistance(0);
395
- return;
396
- }
397
- const dy = e.touches[0].clientY - startY.current;
398
- if (dy > 0) {
399
- const distance = Math.min(dy * 0.5, maxPull);
400
- setPullDistance(distance);
401
- }
402
- }, [isPulling, isRefreshing, maxPull]);
403
- const onTouchEnd = useCallback(() => {
404
- if (!isPulling) return;
405
- setIsPulling(false);
406
- if (pullDistance >= threshold && !isRefreshing) {
407
- setIsRefreshing(true);
408
- setPullDistance(threshold);
409
- onRefresh();
410
- } else {
411
- setPullDistance(0);
412
- }
413
- }, [isPulling, pullDistance, threshold, isRefreshing, onRefresh]);
414
- const endRefresh = useCallback(() => {
415
- setIsRefreshing(false);
416
- setPullDistance(0);
417
- }, []);
418
- const containerProps = {
419
- onTouchStart,
420
- onTouchMove,
421
- onTouchEnd,
422
- style: {
423
- transform: pullDistance > 0 ? `translateY(${pullDistance}px)` : void 0,
424
- transition: isPulling ? "none" : "transform 300ms ease-out"
425
- }
426
- };
427
- return {
428
- pullDistance,
429
- isPulling,
430
- isRefreshing,
431
- containerProps,
432
- endRefresh
433
- };
434
- }
435
378
 
436
379
  // src/lib/bus-claim.ts
437
380
  var claims = /* @__PURE__ */ new WeakMap();
@@ -447,6 +390,10 @@ function claimDelivery(source, trait, event) {
447
390
  seen.add(key);
448
391
  return true;
449
392
  }
393
+ var DISPATCH_CLAIM = "$dispatch";
394
+ function claimDispatch(source, event) {
395
+ return claimDelivery(source, DISPATCH_CLAIM, event);
396
+ }
450
397
  var OWNED = "data-orb-head";
451
398
  var shellTitle;
452
399
  function ownedTag(tag, attrs) {
@@ -501,6 +448,66 @@ function usePageHead(input) {
501
448
  };
502
449
  }, [active, title, description, isPublic, canonical, siteName, locale, hreflangKey]);
503
450
  }
451
+ function usePullToRefresh(onRefresh, options = {}) {
452
+ const { threshold = 60, maxPull = 120 } = options;
453
+ const [pullDistance, setPullDistance] = useState(0);
454
+ const [isPulling, setIsPulling] = useState(false);
455
+ const [isRefreshing, setIsRefreshing] = useState(false);
456
+ const startY = useRef(0);
457
+ const scrollTopRef = useRef(0);
458
+ const onTouchStart = useCallback((e) => {
459
+ const container = e.currentTarget;
460
+ scrollTopRef.current = container.scrollTop;
461
+ if (scrollTopRef.current <= 0) {
462
+ startY.current = e.touches[0].clientY;
463
+ setIsPulling(true);
464
+ }
465
+ }, []);
466
+ const onTouchMove = useCallback((e) => {
467
+ if (!isPulling || isRefreshing) return;
468
+ const container = e.currentTarget;
469
+ if (container.scrollTop > 0) {
470
+ setPullDistance(0);
471
+ return;
472
+ }
473
+ const dy = e.touches[0].clientY - startY.current;
474
+ if (dy > 0) {
475
+ const distance = Math.min(dy * 0.5, maxPull);
476
+ setPullDistance(distance);
477
+ }
478
+ }, [isPulling, isRefreshing, maxPull]);
479
+ const onTouchEnd = useCallback(() => {
480
+ if (!isPulling) return;
481
+ setIsPulling(false);
482
+ if (pullDistance >= threshold && !isRefreshing) {
483
+ setIsRefreshing(true);
484
+ setPullDistance(threshold);
485
+ onRefresh();
486
+ } else {
487
+ setPullDistance(0);
488
+ }
489
+ }, [isPulling, pullDistance, threshold, isRefreshing, onRefresh]);
490
+ const endRefresh = useCallback(() => {
491
+ setIsRefreshing(false);
492
+ setPullDistance(0);
493
+ }, []);
494
+ const containerProps = {
495
+ onTouchStart,
496
+ onTouchMove,
497
+ onTouchEnd,
498
+ style: {
499
+ transform: pullDistance > 0 ? `translateY(${pullDistance}px)` : void 0,
500
+ transition: isPulling ? "none" : "transform 300ms ease-out"
501
+ }
502
+ };
503
+ return {
504
+ pullDistance,
505
+ isPulling,
506
+ isRefreshing,
507
+ containerProps,
508
+ endRefresh
509
+ };
510
+ }
504
511
  function useDragReorder(initialItems, onReorder) {
505
512
  const [items, setItems] = useState(initialItems);
506
513
  const [dragIndex, setDragIndex] = useState(-1);
@@ -570,4 +577,4 @@ function useDragReorder(initialItems, onReorder) {
570
577
  };
571
578
  }
572
579
 
573
- export { claimDelivery, keyChord, mergeCaptureTables, parseQueryBinding, useAuthContext, useCanvasGestures, useDragReorder, useKeyboardRouter, useLongPress, usePageHead, usePullToRefresh, useQuerySingleton, useSwipeGesture };
580
+ export { EditorFocusProvider, claimDelivery, claimDispatch, keyChord, mergeCaptureTables, parseQueryBinding, useAuthContext, useCanvasGestures, useDragReorder, useEditorFocus, useKeyboardRouter, useLongPress, usePageHead, usePullToRefresh, useQuerySingleton, useSwipeGesture };
@@ -1,5 +1,5 @@
1
- import { traitLevelFromDescription } from './chunk-VFF5OO47.js';
2
- import { useContentSurface, useEventBus, Typography, Icon, cn, domPassthrough } from './chunk-MBQAMMSE.js';
1
+ import { traitLevelFromDescription } from './chunk-PCR37T3U.js';
2
+ import { useContentSurface, useEventBus, Typography, Icon, cn, domPassthrough } from './chunk-4YXBKHHM.js';
3
3
  import { useState } from 'react';
4
4
  import { jsx, jsxs } from 'react/jsx-runtime';
5
5
 
@@ -1,4 +1,4 @@
1
- import { ThemeProvider, useTheme } from './chunk-MBQAMMSE.js';
1
+ import { ThemeProvider, useTheme } from './chunk-4YXBKHHM.js';
2
2
 
3
3
  // src/providers/DesignThemeContext.tsx
4
4
  var DesignThemeProvider = ThemeProvider;
@@ -1,5 +1,5 @@
1
- import { claimDelivery } from './chunk-R5O5AUPI.js';
2
- import { useEventBus, getTraitPresence, beginPending, endPending } from './chunk-MBQAMMSE.js';
1
+ import { claimDelivery } from './chunk-PRXQGGCO.js';
2
+ import { useEventBus, getTraitPresence, beginPending, endPending } from './chunk-4YXBKHHM.js';
3
3
  import { createContext, useState, useCallback, useEffect, useMemo, useRef, useContext, useSyncExternalStore } from 'react';
4
4
  import { createLogger } from '@almadar/logger';
5
5
  import { mergeEntityFrame } from '@almadar/core';
@@ -1,5 +1,5 @@
1
- import { AvlTransitionDetail } from './chunk-SGM3FASH.js';
2
- import { Box, domPassthrough } from './chunk-MBQAMMSE.js';
1
+ import { AvlTransitionDetail } from './chunk-OWNG4JZI.js';
2
+ import { Box, domPassthrough } from './chunk-4YXBKHHM.js';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
5
5
  var AvlTransitionExplainer = ({ orbitalName, traitName, transition, annotations, className, ...rest }) => {
@@ -1,10 +1,9 @@
1
- import { useEventBus } from './chunk-MBQAMMSE.js';
1
+ import { useEventBus } from './chunk-4YXBKHHM.js';
2
2
  import { useState, useCallback, useMemo } from 'react';
3
3
 
4
4
  var ALMADAR_DND_MIME = "application/x-almadar-dnd";
5
5
  function useDraggable({ payload, disabled = false }) {
6
6
  const [isDragging, setIsDragging] = useState(false);
7
- const eventBus = useEventBus();
8
7
  const handleDragStart = useCallback(
9
8
  (e) => {
10
9
  if (disabled) {
@@ -14,16 +13,14 @@ function useDraggable({ payload, disabled = false }) {
14
13
  e.dataTransfer.setData(ALMADAR_DND_MIME, JSON.stringify(payload));
15
14
  e.dataTransfer.effectAllowed = "copy";
16
15
  setIsDragging(true);
17
- eventBus.emit("UI:DRAG_START", { kind: payload.kind, data: payload.data });
18
16
  },
19
- [disabled, payload, eventBus]
17
+ [disabled, payload]
20
18
  );
21
19
  const handleDragEnd = useCallback(
22
20
  (e) => {
23
21
  setIsDragging(false);
24
- eventBus.emit("UI:DRAG_END", { kind: payload.kind, data: payload.data });
25
22
  },
26
- [payload, eventBus]
23
+ []
27
24
  );
28
25
  const dragProps = useMemo(
29
26
  () => ({
@@ -1,8 +1,7 @@
1
- import { AvlState, AvlEntity, AvlFieldType, AvlPage } from './chunk-FP3WIKTC.js';
2
- import { AvlExplain, useEffectLines } from './chunk-SJGJJKBY.js';
3
- import { AvlEffect } from './chunk-DZ42OJQC.js';
4
- import { getStateRole, CONNECTION_COLORS } from './chunk-DFNZUYX4.js';
5
- import { useTranslate, Box, cn, domPassthrough } from './chunk-MBQAMMSE.js';
1
+ import { AvlState, AvlEntity, AvlFieldType, AvlPage } from './chunk-7N6ZPHQ5.js';
2
+ import { AvlExplain, useEffectLines } from './chunk-PRLHKBXG.js';
3
+ import { getStateRole, AvlEffect, CONNECTION_COLORS } from './chunk-FAKU5F62.js';
4
+ import { useTranslate, Box, cn, domPassthrough } from './chunk-4YXBKHHM.js';
6
5
  import { useNodeId, ReactFlowProvider, Handle, Position } from '@xyflow/react';
7
6
  import React from 'react';
8
7
  import { jsxs, jsx } from 'react/jsx-runtime';
@@ -1,6 +1,6 @@
1
- import { AvlStateMachine } from './chunk-KVQS4GXU.js';
2
- import { EmptyState } from './chunk-FAJDTHWC.js';
3
- import { useTranslate, Box, domPassthrough } from './chunk-MBQAMMSE.js';
1
+ import { AvlStateMachine } from './chunk-4YJ53G7S.js';
2
+ import { EmptyState } from './chunk-AGXD77SL.js';
3
+ import { useTranslate, Box, domPassthrough } from './chunk-4YXBKHHM.js';
4
4
  import { jsx } from 'react/jsx-runtime';
5
5
 
6
6
  var BehaviorView = ({ data, ...rest }) => {