@almadar/ui 6.59.0 → 6.61.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 (90) hide show
  1. package/dist/BehaviorValueFrame-3ORZHPWQ.css +1252 -0
  2. package/dist/BehaviorValueFrame-QTD7BWOI.js +18 -0
  3. package/dist/TraitValueFrame-2WMYJOA5.css +1252 -0
  4. package/dist/TraitValueFrame-WOXNLLMM.js +17 -0
  5. package/dist/Typography-BY4A2NBY.js +5 -0
  6. package/dist/{UISlotRenderer-YNY7V2UJ.js → UISlotRenderer-EEOXSJCI.js} +10 -8
  7. package/dist/avl/index.cjs +31974 -27856
  8. package/dist/avl/index.d.ts +36 -13
  9. package/dist/avl/index.js +296 -6128
  10. package/dist/{avl-3d-context-BpBKZIbc.d.ts → avl-3d-context-Dxun3-ri.d.ts} +2 -0
  11. package/dist/{chunk-E6MWYQVZ.js → chunk-6PV4LASE.js} +9493 -641
  12. package/dist/{chunk-723MJUU3.js → chunk-6ZCU3BQN.js} +1 -1
  13. package/dist/{chunk-7CVXM2KS.js → chunk-7NIU5GDC.js} +2 -2
  14. package/dist/{chunk-YYYHH5BA.js → chunk-CB64IOYD.js} +0 -4
  15. package/dist/{chunk-MZIDOJMD.js → chunk-EIIQGOZW.js} +2 -1
  16. package/dist/chunk-F7NZ3KZQ.js +434 -0
  17. package/dist/{chunk-LZRW6GXG.js → chunk-FYX64CDL.js} +0 -2
  18. package/dist/{chunk-4ZGXIW3B.js → chunk-KZRAMPM6.js} +1 -1
  19. package/dist/chunk-LUREMDI3.js +49 -0
  20. package/dist/{chunk-J755QADM.js → chunk-MGN6B6OQ.js} +318 -18
  21. package/dist/{chunk-Q47ZN2DW.js → chunk-N23SVGTH.js} +83 -1
  22. package/dist/{chunk-KJGVLXEN.js → chunk-N4IJS5DD.js} +50 -116
  23. package/dist/{chunk-I5QOYW2Z.js → chunk-UTSDPJUP.js} +205 -2
  24. package/dist/{chunk-V3FGTQUE.js → chunk-ZR45FGW3.js} +7 -1
  25. package/dist/{cn-DIql5232.d.ts → cn-CDIhHCUC.d.ts} +40 -16
  26. package/dist/components/index.cjs +14423 -4100
  27. package/dist/components/index.d.ts +160 -172
  28. package/dist/components/index.js +14 -15
  29. package/dist/context/index.cjs +9 -1
  30. package/dist/context/index.js +3 -1
  31. package/dist/hooks/index.cjs +72 -6
  32. package/dist/hooks/index.d.ts +43 -2
  33. package/dist/hooks/index.js +6 -7
  34. package/dist/lib/drawable/three/index.cjs +350 -26
  35. package/dist/lib/drawable/three/index.d.ts +2 -2
  36. package/dist/lib/drawable/three/index.js +28 -7
  37. package/dist/lib/index.cjs +90 -4
  38. package/dist/lib/index.d.ts +2 -2
  39. package/dist/lib/index.js +74 -6
  40. package/dist/locales/index.cjs +0 -6
  41. package/dist/locales/index.js +2 -2
  42. package/dist/providers/index.cjs +13846 -1062
  43. package/dist/providers/index.d.ts +36 -4
  44. package/dist/providers/index.js +35 -15
  45. package/dist/runtime/index.cjs +28395 -18308
  46. package/dist/runtime/index.d.ts +65 -3
  47. package/dist/runtime/index.js +13 -379
  48. package/dist/ssr/index.cjs +506 -133
  49. package/dist/ssr/index.d.cts +56 -4
  50. package/dist/ssr/index.d.ts +56 -4
  51. package/dist/ssr/index.js +444 -71
  52. package/dist/{verificationRegistry-B3dj1Zl8.d.ts → verificationRegistry-B5aGl7WF.d.ts} +2 -1
  53. package/locales/ar.json +0 -2
  54. package/locales/en.json +0 -2
  55. package/locales/sl.json +0 -2
  56. package/package.json +7 -7
  57. package/tailwind-preset.cjs +78 -8
  58. package/themes/_contract.md +6 -0
  59. package/themes/_fonts.css +4 -4
  60. package/themes/_foundation.css +11 -0
  61. package/themes/_presets.css +2 -0
  62. package/themes/almadar-website.css +10 -0
  63. package/themes/almadar.css +10 -0
  64. package/themes/atelier.css +10 -0
  65. package/themes/bauhaus.css +10 -0
  66. package/themes/bloomberg-dense.css +10 -0
  67. package/themes/clay.css +10 -0
  68. package/themes/corporate.css +10 -0
  69. package/themes/gazette.css +10 -0
  70. package/themes/glass.css +10 -0
  71. package/themes/kflow.css +5 -0
  72. package/themes/kiosk.css +10 -0
  73. package/themes/linear-clean.css +10 -0
  74. package/themes/material.css +10 -0
  75. package/themes/minimalist.css +10 -0
  76. package/themes/nata.css +304 -0
  77. package/themes/neon.css +10 -0
  78. package/themes/notion-editorial.css +10 -0
  79. package/themes/orb.css +10 -0
  80. package/themes/prism.css +10 -0
  81. package/themes/rawi.css +304 -0
  82. package/themes/retro.css +10 -0
  83. package/themes/risograph.css +10 -0
  84. package/themes/scandi.css +10 -0
  85. package/themes/solarpunk.css +10 -0
  86. package/themes/terminal.css +138 -128
  87. package/dist/Typography-LZTP72Y4.js +0 -5
  88. package/dist/chunk-D2E44ODB.js +0 -350
  89. package/dist/chunk-N7JIG57B.js +0 -138
  90. package/dist/chunk-QJIAJ6EH.js +0 -2256
@@ -1,6 +1,5 @@
1
- import { domPassthrough, cn } from './chunk-64WACXM7.js';
2
- import { useState, useRef, useCallback, useLayoutEffect, useEffect, useSyncExternalStore } from 'react';
3
- import { jsx } from 'react/jsx-runtime';
1
+ import { isMotionEnabled } from './chunk-N23SVGTH.js';
2
+ import { useRef, useLayoutEffect, useSyncExternalStore } from 'react';
4
3
  import { ENTER_DELAY_STEPS, ENTER_ANIMATIONS, isFileValue } from '@almadar/core';
5
4
  export { getNestedValue } from '@almadar/core';
6
5
  import { perfStore, pushPerfEntry } from '@almadar/runtime/ui';
@@ -87,71 +86,6 @@ function eightPointedStarPath(cx, cy, outerR, innerR) {
87
86
  function arrowheadPath(size) {
88
87
  return `M 0 0 L ${size} ${size / 2} L 0 ${size} Z`;
89
88
  }
90
- var SAFE_EXIT_MS = 1e3;
91
- var motionEnabledCache = null;
92
- function isMotionEnabled() {
93
- if (typeof document === "undefined") return true;
94
- if (motionEnabledCache !== null) return motionEnabledCache;
95
- const v = getComputedStyle(document.documentElement).getPropertyValue("--motion-enable").trim().toLowerCase();
96
- motionEnabledCache = v !== "off";
97
- return motionEnabledCache;
98
- }
99
- function usePresence(show, opts) {
100
- const { animation, animate = true, onExited } = opts;
101
- const [mounted, setMounted] = useState(show);
102
- const [exiting, setExiting] = useState(false);
103
- const prev = useRef(show);
104
- const onExitedRef = useRef(onExited);
105
- onExitedRef.current = onExited;
106
- const safeTimer = useRef(null);
107
- const clearSafe = useCallback(() => {
108
- if (safeTimer.current) {
109
- clearTimeout(safeTimer.current);
110
- safeTimer.current = null;
111
- }
112
- }, []);
113
- const finishExit = useCallback(() => {
114
- clearSafe();
115
- setExiting(false);
116
- setMounted(false);
117
- onExitedRef.current?.();
118
- }, [clearSafe]);
119
- useLayoutEffect(() => {
120
- const moving = animate && isMotionEnabled();
121
- if (show && !prev.current) {
122
- setExiting(false);
123
- setMounted(true);
124
- } else if (!show && prev.current) {
125
- if (moving) {
126
- setExiting(true);
127
- clearSafe();
128
- safeTimer.current = setTimeout(finishExit, SAFE_EXIT_MS);
129
- } else {
130
- setMounted(false);
131
- setExiting(false);
132
- onExitedRef.current?.();
133
- }
134
- }
135
- prev.current = show;
136
- }, [show, animate, clearSafe, finishExit]);
137
- useEffect(() => () => clearSafe(), [clearSafe]);
138
- const disabled = !animate || !isMotionEnabled();
139
- const className = disabled ? "" : show ? `animate-${animation}-in` : `animate-${animation}-out`;
140
- const onAnimationEnd = useCallback(
141
- (e) => {
142
- if (e.target !== e.currentTarget) return;
143
- if (exiting) finishExit();
144
- },
145
- [exiting, finishExit]
146
- );
147
- return { mounted, exiting, className, onAnimationEnd };
148
- }
149
- var Presence = ({ show, className, children, ...rest }) => {
150
- const { mounted, className: animClass, onAnimationEnd } = usePresence(show, rest);
151
- if (!mounted) return null;
152
- return /* @__PURE__ */ jsx("div", { className: cn(animClass, className), onAnimationEnd, ...domPassthrough(rest), children });
153
- };
154
- Presence.displayName = "Presence";
155
89
  var ENTER_SLOT_CLASS = "almadar-enter-slot";
156
90
  function asEnterAnimation(value) {
157
91
  return ENTER_ANIMATIONS.find((e) => e === value);
@@ -774,6 +708,53 @@ function parseContentSegments(content) {
774
708
  }
775
709
  return segments;
776
710
  }
711
+
712
+ // lib/traitRegistry.ts
713
+ var traits = /* @__PURE__ */ new Map();
714
+ var listeners = /* @__PURE__ */ new Set();
715
+ function notifyListeners() {
716
+ listeners.forEach((listener) => listener());
717
+ }
718
+ function registerTrait(info) {
719
+ traits.set(info.id, info);
720
+ notifyListeners();
721
+ }
722
+ function updateTraitState(id, newState) {
723
+ const trait = traits.get(id);
724
+ if (trait) {
725
+ trait.currentState = newState;
726
+ trait.transitionCount++;
727
+ notifyListeners();
728
+ }
729
+ }
730
+ function updateGuardResult(traitId, guardName, result) {
731
+ const trait = traits.get(traitId);
732
+ if (trait) {
733
+ const guard = trait.guards.find((g) => g.name === guardName);
734
+ if (guard) {
735
+ guard.lastResult = result;
736
+ notifyListeners();
737
+ }
738
+ }
739
+ }
740
+ function unregisterTrait(id) {
741
+ traits.delete(id);
742
+ notifyListeners();
743
+ }
744
+ function getAllTraits() {
745
+ return Array.from(traits.values());
746
+ }
747
+ function getTrait(id) {
748
+ return traits.get(id);
749
+ }
750
+ function subscribeToTraitChanges(listener) {
751
+ listeners.add(listener);
752
+ return () => listeners.delete(listener);
753
+ }
754
+ function clearTraits() {
755
+ traits.clear();
756
+ notifyListeners();
757
+ }
777
758
  var NAMESPACE = "almadar:ui:debug";
778
759
  var log = createLogger(NAMESPACE);
779
760
  var inputLog = createLogger("almadar:ui:debug:input");
@@ -859,53 +840,6 @@ function toLogMetaValue(v) {
859
840
  return String(v);
860
841
  }
861
842
 
862
- // lib/traitRegistry.ts
863
- var traits = /* @__PURE__ */ new Map();
864
- var listeners = /* @__PURE__ */ new Set();
865
- function notifyListeners() {
866
- listeners.forEach((listener) => listener());
867
- }
868
- function registerTrait(info) {
869
- traits.set(info.id, info);
870
- notifyListeners();
871
- }
872
- function updateTraitState(id, newState) {
873
- const trait = traits.get(id);
874
- if (trait) {
875
- trait.currentState = newState;
876
- trait.transitionCount++;
877
- notifyListeners();
878
- }
879
- }
880
- function updateGuardResult(traitId, guardName, result) {
881
- const trait = traits.get(traitId);
882
- if (trait) {
883
- const guard = trait.guards.find((g) => g.name === guardName);
884
- if (guard) {
885
- guard.lastResult = result;
886
- notifyListeners();
887
- }
888
- }
889
- }
890
- function unregisterTrait(id) {
891
- traits.delete(id);
892
- notifyListeners();
893
- }
894
- function getAllTraits() {
895
- return Array.from(traits.values());
896
- }
897
- function getTrait(id) {
898
- return traits.get(id);
899
- }
900
- function subscribeToTraitChanges(listener) {
901
- listeners.add(listener);
902
- return () => listeners.delete(listener);
903
- }
904
- function clearTraits() {
905
- traits.clear();
906
- notifyListeners();
907
- }
908
-
909
843
  // lib/tickRegistry.ts
910
844
  var ticks = /* @__PURE__ */ new Map();
911
845
  var listeners2 = /* @__PURE__ */ new Set();
@@ -1195,4 +1129,4 @@ function parseLessonSegments(lesson) {
1195
1129
  return segments;
1196
1130
  }
1197
1131
 
1198
- export { EDITOR_MOTIONS, EDITOR_OPERATORS, ENTER_SLOT_CLASS, INDENT_UNIT, MAX_ENTER_DELAY, Presence, applyMotion, applyOperator, arrowheadPath, asEnterAnimation, brainIconPath, clearDebugEvents, clearEntityProvider, clearGuardHistory, clearTicks, clearTraits, computeLineDiff, debug, debugCollision, debugError, debugGameState, debugGroup, debugGroupEnd, debugInput, debugPhysics, debugTable, debugTime, debugTimeEnd, debugWarn, eightPointedStarPath, enterClassName, gearTeethPath, getAllTicks, getAllTraits, getDebugEvents, getEntitiesByType, getEntityById, getEntitySnapshot, getEventsBySource, getEventsByType, getGuardEvaluationsForTrait, getGuardHistory, getRecentEvents, getRecentGuardEvaluations, getTick, getTrait, initDebugShortcut, isDebugEnabled, isDebugEnabled2, isEditorMotion, isEditorOperator, isMotionEnabled, lockIconPath, logDebugEvent, logEffectExecuted, logError, logEventFired, logInfo, logStateChange, logWarning, motionRange, onDebugToggle, parseContentSegments, parseLessonSegments, parseMarkdownWithCodeBlocks, parseMarkdownWithCodeBlocks2, pipeIconPath, profilerOnRender, recordGuardEvaluation, registerTick, registerTrait, resolveImageUrl, setDebugEnabled, setEntityProvider, setTickActive, slotPlaysDefaultEnter, subscribeToDebugEvents, subscribeToGuardChanges, subscribeToTickChanges, subscribeToTraitChanges, toggleDebug, unregisterTick, unregisterTrait, updateGuardResult, updateTickExecution, updateTraitState, usePerfBuffer, usePresence, useSlotEnterRestart };
1132
+ export { EDITOR_MOTIONS, EDITOR_OPERATORS, ENTER_SLOT_CLASS, INDENT_UNIT, MAX_ENTER_DELAY, applyMotion, applyOperator, arrowheadPath, asEnterAnimation, brainIconPath, clearDebugEvents, clearEntityProvider, clearGuardHistory, clearTicks, clearTraits, computeLineDiff, debug, debugCollision, debugError, debugGameState, debugGroup, debugGroupEnd, debugInput, debugPhysics, debugTable, debugTime, debugTimeEnd, debugWarn, eightPointedStarPath, enterClassName, gearTeethPath, getAllTicks, getAllTraits, getDebugEvents, getEntitiesByType, getEntityById, getEntitySnapshot, getEventsBySource, getEventsByType, getGuardEvaluationsForTrait, getGuardHistory, getRecentEvents, getRecentGuardEvaluations, getTick, getTrait, initDebugShortcut, isDebugEnabled, isDebugEnabled2, isEditorMotion, isEditorOperator, lockIconPath, logDebugEvent, logEffectExecuted, logError, logEventFired, logInfo, logStateChange, logWarning, motionRange, onDebugToggle, parseContentSegments, parseLessonSegments, parseMarkdownWithCodeBlocks, parseMarkdownWithCodeBlocks2, pipeIconPath, profilerOnRender, recordGuardEvaluation, registerTick, registerTrait, resolveImageUrl, setDebugEnabled, setEntityProvider, setTickActive, slotPlaysDefaultEnter, subscribeToDebugEvents, subscribeToGuardChanges, subscribeToTickChanges, subscribeToTraitChanges, toggleDebug, unregisterTick, unregisterTrait, updateGuardResult, updateTickExecution, updateTraitState, usePerfBuffer, useSlotEnterRestart };
@@ -1,5 +1,10 @@
1
+ import { ar_default, sl_default } from './chunk-CB64IOYD.js';
1
2
  import { useEventBus } from './chunk-CHNC4UYE.js';
2
- import { createContext, useCallback, useSyncExternalStore, useRef, useState, useContext, useEffect, useMemo } from 'react';
3
+ import { DEFAULT_CURRENCY } from './chunk-6ZCU3BQN.js';
4
+ import { en_default } from './chunk-FYX64CDL.js';
5
+ import React, { createContext, useCallback, useSyncExternalStore, useRef, useState, useContext, useEffect, useMemo } from 'react';
6
+ import { mergeEntityFrame, resolvePageMeta } from '@almadar/core';
7
+ import { createLogger } from '@almadar/logger';
3
8
 
4
9
  function useMediaQuery(query) {
5
10
  const subscribe = useCallback(
@@ -549,6 +554,204 @@ function parseQueryBinding(binding) {
549
554
  field: parts.length > 1 ? parts.slice(1).join(".") : void 0
550
555
  };
551
556
  }
557
+ var { $meta: _meta, ...coreMessages } = en_default;
558
+ var coreLocale = coreMessages;
559
+ var { $meta: _arMeta, ...arMessages } = ar_default;
560
+ var { $meta: _slMeta, ...slMessages } = sl_default;
561
+ var uiLocales = { en: coreLocale, ar: arMessages, sl: slMessages };
562
+ var I18nContext = createContext({
563
+ locale: "en",
564
+ direction: "ltr",
565
+ t: (key, params) => {
566
+ let msg = coreLocale[key] ?? key;
567
+ if (params) {
568
+ for (const [k, v] of Object.entries(params)) {
569
+ msg = msg.split(`{{${k}}}`).join(String(v));
570
+ }
571
+ }
572
+ return msg;
573
+ }
574
+ });
575
+ I18nContext.displayName = "I18nContext";
576
+ function I18nProvider({ value, children, documentRoot }) {
577
+ useEffect(() => {
578
+ if (!documentRoot) return;
579
+ document.documentElement.lang = value.locale;
580
+ document.documentElement.dir = value.direction;
581
+ }, [documentRoot, value.locale, value.direction]);
582
+ return React.createElement(I18nContext.Provider, { value }, children);
583
+ }
584
+ function useTranslate() {
585
+ return useContext(I18nContext);
586
+ }
587
+ function useRenderI18n() {
588
+ const { locale, messages } = useContext(I18nContext);
589
+ return useMemo(() => messages !== void 0 ? { locale, messages } : void 0, [locale, messages]);
590
+ }
591
+ function useFormatContext() {
592
+ const { t, locale, currency } = useContext(I18nContext);
593
+ return useMemo(
594
+ () => ({ locale, currency: currency ?? DEFAULT_CURRENCY, booleanLabels: { yes: t("common.yes"), no: t("common.no") } }),
595
+ [t, locale, currency]
596
+ );
597
+ }
598
+ function createTranslate(messages, locale) {
599
+ const uiCatalog = locale !== void 0 ? uiLocales[locale] : void 0;
600
+ return (key, params) => {
601
+ let msg = messages[key] ?? uiCatalog?.[key] ?? coreLocale[key] ?? key;
602
+ if (params) {
603
+ for (const [k, v] of Object.entries(params)) {
604
+ msg = msg.split(`{{${k}}}`).join(String(v));
605
+ }
606
+ }
607
+ return msg;
608
+ };
609
+ }
610
+
611
+ // lib/bus-claim.ts
612
+ var claims = /* @__PURE__ */ new WeakMap();
613
+ function claimDelivery(source, trait, event) {
614
+ if (source === void 0) return true;
615
+ const key = `${trait}\0${event}`;
616
+ const seen = claims.get(source);
617
+ if (seen === void 0) {
618
+ claims.set(source, /* @__PURE__ */ new Set([key]));
619
+ return true;
620
+ }
621
+ if (seen.has(key)) return false;
622
+ seen.add(key);
623
+ return true;
624
+ }
625
+ var log = createLogger("almadar:ui:shared-entity-store");
626
+ var EMPTY_ENTITY_STATE = {};
627
+ function createSharedEntityStore() {
628
+ const states = /* @__PURE__ */ new Map();
629
+ const subscribers = /* @__PURE__ */ new Map();
630
+ const getSnapshot = (entityId) => states.get(entityId) ?? EMPTY_ENTITY_STATE;
631
+ const subscribe = (entityId, callback) => {
632
+ let set = subscribers.get(entityId);
633
+ if (!set) {
634
+ set = /* @__PURE__ */ new Set();
635
+ subscribers.set(entityId, set);
636
+ }
637
+ set.add(callback);
638
+ return () => {
639
+ const current = subscribers.get(entityId);
640
+ if (!current) return;
641
+ current.delete(callback);
642
+ if (current.size === 0) {
643
+ subscribers.delete(entityId);
644
+ }
645
+ };
646
+ };
647
+ const commit = (entityId, nextState) => {
648
+ states.set(entityId, nextState);
649
+ const set = subscribers.get(entityId);
650
+ if (!set) return;
651
+ set.forEach((callback) => {
652
+ try {
653
+ callback();
654
+ } catch (error) {
655
+ log.error("Shared entity subscriber error", {
656
+ entityId,
657
+ error: error instanceof Error ? error : String(error)
658
+ });
659
+ }
660
+ });
661
+ };
662
+ const seed = (entityId, initialState) => {
663
+ if (!states.has(entityId)) {
664
+ states.set(entityId, initialState);
665
+ }
666
+ };
667
+ return { getSnapshot, subscribe, commit, seed };
668
+ }
669
+ function useSharedEntityStore() {
670
+ const storeRef = useRef(null);
671
+ if (storeRef.current === null) {
672
+ storeRef.current = createSharedEntityStore();
673
+ }
674
+ return storeRef.current;
675
+ }
676
+ var SharedEntityStoreContext = createContext(null);
677
+ function useSharedEntityStoreContext() {
678
+ const store = useContext(SharedEntityStoreContext);
679
+ if (!store) {
680
+ throw new Error(
681
+ "useSharedEntityStoreContext: no SharedEntityStoreContext.Provider found in the component tree"
682
+ );
683
+ }
684
+ return store;
685
+ }
686
+ function useSharedEntitySnapshot(store, entityId) {
687
+ return useSyncExternalStore(
688
+ (onStoreChange) => store.subscribe(entityId, onStoreChange),
689
+ () => store.getSnapshot(entityId)
690
+ );
691
+ }
692
+ function runTickFrame(entityId, orderedWriters, store) {
693
+ let scratch = store.getSnapshot(entityId);
694
+ for (const writer of orderedWriters) {
695
+ const writes = writer(scratch);
696
+ scratch = mergeEntityFrame(scratch, writes);
697
+ }
698
+ store.commit(entityId, scratch);
699
+ return scratch;
700
+ }
701
+ var OWNED = "data-orb-head";
702
+ var shellTitle;
703
+ function ownedTag(tag, attrs) {
704
+ const el = document.createElement(tag);
705
+ for (const [k, v] of Object.entries(attrs)) el.setAttribute(k, v);
706
+ el.setAttribute(OWNED, "");
707
+ return el;
708
+ }
709
+ function usePageHead(input) {
710
+ const { messages, locale } = useTranslate();
711
+ const title = input ? resolvePageMeta(input.title, (k) => messages?.[k]) : void 0;
712
+ const description = input ? resolvePageMeta(input.description, (k) => messages?.[k]) : void 0;
713
+ const isPublic = input?.access !== "authenticated" && input?.indexing !== "noindex";
714
+ const canonical = input?.origin !== void 0 ? `${input.origin.replace(/\/+$/, "")}${input.path}` : void 0;
715
+ const siteName = input?.siteName;
716
+ const active = input !== null;
717
+ const originBase = input?.origin?.replace(/\/+$/, "");
718
+ const hreflang = [];
719
+ if (originBase !== void 0) {
720
+ for (const alt of input?.alternates ?? []) hreflang.push([alt.locale, `${originBase}${alt.path}`]);
721
+ const fallback = input?.alternates?.find((alt) => alt.locale === input.defaultLocale);
722
+ if (fallback !== void 0) hreflang.push(["x-default", `${originBase}${fallback.path}`]);
723
+ }
724
+ const hreflangKey = hreflang.map(([lang, href]) => `${lang} ${href}`).join("\n");
725
+ useEffect(() => {
726
+ if (!active || typeof document === "undefined") return void 0;
727
+ shellTitle ?? (shellTitle = document.title);
728
+ document.title = title ?? siteName ?? shellTitle;
729
+ const tags = [];
730
+ if (!isPublic) tags.push(ownedTag("meta", { name: "robots", content: "noindex" }));
731
+ if (isPublic && description !== void 0) {
732
+ tags.push(ownedTag("meta", { name: "description", content: description }));
733
+ tags.push(ownedTag("meta", { property: "og:description", content: description }));
734
+ }
735
+ if (isPublic && title !== void 0) tags.push(ownedTag("meta", { property: "og:title", content: title }));
736
+ if (isPublic && canonical !== void 0) {
737
+ tags.push(ownedTag("link", { rel: "canonical", href: canonical }));
738
+ tags.push(ownedTag("meta", { property: "og:url", content: canonical }));
739
+ }
740
+ if (isPublic && siteName !== void 0) tags.push(ownedTag("meta", { property: "og:site_name", content: siteName }));
741
+ if (isPublic) tags.push(ownedTag("meta", { property: "og:locale", content: locale }));
742
+ if (isPublic && hreflangKey !== "") {
743
+ for (const line of hreflangKey.split("\n")) {
744
+ const space = line.indexOf(" ");
745
+ tags.push(ownedTag("link", { rel: "alternate", hreflang: line.slice(0, space), href: line.slice(space + 1) }));
746
+ }
747
+ }
748
+ for (const stale of Array.from(document.head.querySelectorAll(`[${OWNED}]`))) stale.remove();
749
+ for (const tag of tags) document.head.appendChild(tag);
750
+ return () => {
751
+ for (const tag of tags) tag.remove();
752
+ };
753
+ }, [active, title, description, isPublic, canonical, siteName, locale, hreflangKey]);
754
+ }
552
755
  function usePullToRefresh(onRefresh, options = {}) {
553
756
  const { threshold = 60, maxPull = 120 } = options;
554
757
  const [pullDistance, setPullDistance] = useState(0);
@@ -678,4 +881,4 @@ function useDragReorder(initialItems, onReorder) {
678
881
  };
679
882
  }
680
883
 
681
- export { ALMADAR_DND_MIME, PendingScopeContext, beginPending, endPending, parseQueryBinding, useAuthContext, useCanvasGestures, useDragReorder, useDraggable, useDropZone, useInfiniteScroll, useLongPress, useMediaQuery, usePendingAction, usePendingRows, usePendingScopeValue, usePrefersReducedMotion, usePullToRefresh, useQuerySingleton, useScopeHasPending, useSwipeGesture };
884
+ export { ALMADAR_DND_MIME, I18nProvider, PendingScopeContext, SharedEntityStoreContext, beginPending, claimDelivery, createSharedEntityStore, createTranslate, endPending, parseQueryBinding, runTickFrame, useAuthContext, useCanvasGestures, useDragReorder, useDraggable, useDropZone, useFormatContext, useInfiniteScroll, useLongPress, useMediaQuery, usePageHead, usePendingAction, usePendingRows, usePendingScopeValue, usePrefersReducedMotion, usePullToRefresh, useQuerySingleton, useRenderI18n, useScopeHasPending, useSharedEntitySnapshot, useSharedEntityStore, useSharedEntityStoreContext, useSwipeGesture, useTranslate };
@@ -134,7 +134,13 @@ var SURFACE_VARS = [
134
134
  { cssVar: "--surface-card-image", key: "cardImage" },
135
135
  { cssVar: "--surface-page-image", key: "pageImage" },
136
136
  { cssVar: "--surface-page-image-size", key: "pageImageSize" },
137
- { cssVar: "--surface-diagram", key: "diagram" }
137
+ { cssVar: "--surface-diagram", key: "diagram" },
138
+ { cssVar: "--surface-edge-mask", key: "edgeMask" },
139
+ { cssVar: "--surface-edge-height", key: "edgeHeight" },
140
+ { cssVar: "--surface-texture-mask", key: "textureMask" },
141
+ { cssVar: "--surface-texture-size", key: "textureSize" },
142
+ { cssVar: "--surface-accent-image", key: "accentImage" },
143
+ { cssVar: "--surface-scrim", key: "scrim" }
138
144
  ];
139
145
  var DIAGRAM_VARS = [
140
146
  { cssVar: "--diagram-stroke-thin", key: "strokeThin" },
@@ -135,12 +135,14 @@ declare const BloomQuizBlock: React__default.FC<BloomQuizBlockProps>;
135
135
  /**
136
136
  * CodeRunnerPanel Organism Component
137
137
  *
138
- * Editable code block with Run/Reset buttons and simulated terminal output.
139
- * Real execution is a future concern; callers supply a simulation function via
140
- * `onRun`. Emits `UI:RUN_CODE { language, exitCode }` on every run attempt.
138
+ * Editable code block with Run/Reset buttons and a terminal output pane.
139
+ * Running is the program's job: Run emits the declared `runEvent` request and the
140
+ * program binds the result back through `output` / `running` / `error`.
141
141
  *
142
142
  * Event Contract:
143
- * - Emits: UI:RUN_CODE { language, exitCode, error? }
143
+ * - Emits: UI:<runEvent> { code, language, runId? } on Run
144
+ * - Emits: UI:<resetEvent> { runId? } on Reset (when declared)
145
+ * - Emits: UI:COPY_CODE { language, success } on Copy
144
146
  * - entityAware: false
145
147
  */
146
148
 
@@ -160,16 +162,26 @@ interface CodeRunnerPanelProps extends Omit<React__default.AriaAttributes, keyof
160
162
  code: string;
161
163
  /** Programming language for syntax highlighting */
162
164
  language: string;
163
- /** Whether the panel allows running (false = read-only code block) */
165
+ /** Whether the panel is editable and runnable (default false = read-only code block) */
164
166
  runnable?: boolean;
165
- /**
166
- * Simulate executing the code. Omit to render a read-only block.
167
- * Real execution is a separate future track — this callback supplies
168
- * deterministic simulated output for UI feedback.
169
- */
170
- onRun?: (code: string) => Promise<CodeSimulationOutput>;
171
- /** Event name to emit on run (emitted as `UI:<runEvent>`). Defaults to 'RUN_CODE'. */
172
- runEvent?: string;
167
+ /** Event emitted on Run as `UI:<runEvent>` with `{ code, language, runId }`. Defaults to 'RUN_CODE'. */
168
+ runEvent?: EventEmit<{
169
+ code: string;
170
+ language: string;
171
+ runId: string;
172
+ }>;
173
+ /** Event emitted on Reset as `UI:<resetEvent>` with `{ runId }`; Reset only restores the code when absent. */
174
+ resetEvent?: EventEmit<{
175
+ runId: string;
176
+ }>;
177
+ /** Identifies this panel in its run/reset payloads (e.g. a lesson segment); empty when one panel stands alone. */
178
+ runId?: string;
179
+ /** The program's result for the last run, bound back into the panel. */
180
+ output?: CodeSimulationOutput | null;
181
+ /** True while the program is running the code. */
182
+ running?: boolean;
183
+ /** A run failure message from the program; replaces the output body. */
184
+ error?: string | null;
173
185
  /** Additional CSS classes */
174
186
  className?: string;
175
187
  }
@@ -280,10 +292,22 @@ interface SegmentRendererProps extends Omit<React__default.AriaAttributes, keyof
280
292
  /** User progress for restoring activation/reflection state */
281
293
  userProgress?: LessonUserProgress;
282
294
  /**
283
- * Simulate executing runnable code blocks. Omit to render runnable blocks
284
- * as read-only. Real execution is a future track.
295
+ * Event a runnable code block emits on Run (`{ code, language, runId }`, runId = the segment
296
+ * index). Omit to render runnable blocks read-only.
285
297
  */
286
- onRunCodeSimulation?: (code: string, language: string) => Promise<CodeSimulationOutput>;
298
+ runCodeEvent?: EventEmit<{
299
+ code: string;
300
+ language: string;
301
+ runId: string;
302
+ }>;
303
+ /** Event a runnable code block emits on Reset (`{ runId }`). */
304
+ resetCodeEvent?: EventEmit<{
305
+ runId: string;
306
+ }>;
307
+ /** The program's run results, keyed by segment runId. */
308
+ codeOutputs?: Record<string, CodeSimulationOutput>;
309
+ /** The runId the program is currently running. */
310
+ runningCode?: string;
287
311
  /**
288
312
  * Optional render slot for `visualization` segment types. When not provided,
289
313
  * visualization segments are silently skipped. Callers can wire this to any