@almadar/shell-web 0.0.0-stage → 0.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.
- package/bundling.d.mts +18 -0
- package/bundling.mjs +28 -0
- package/dist/ArbitraryClassCompiler-Mzabq-UB.d.ts +100 -0
- package/dist/AvlGlyph-JKJOAH23.js +6 -0
- package/dist/AvlStateMachine-PI4YGREK.js +8 -0
- package/dist/AvlTransitionDetail-ZH7V24UG.js +12 -0
- package/dist/AvlTransitionExplainer-ZSRT7L6Y.js +13 -0
- package/dist/BehaviorValueFrame-6RUJXT4A.js +29 -0
- package/dist/BehaviorValueFrame-SSEMEBTG.css +1756 -0
- package/dist/BehaviorView-RFEE5J6E.js +10 -0
- package/dist/Canvas3DHost-_Y-5uLM_.d.ts +552 -0
- package/dist/EventBusProvider-CVwjkV_2.d.ts +284 -0
- package/dist/FileTree-BCFnBEuQ.d.ts +254 -0
- package/dist/FlowCanvas-3JRMNJLV.css +1756 -0
- package/dist/FlowCanvas-STDC4OWK.js +27 -0
- package/dist/GameAudioProvider-Cm9BnvmP.d.ts +93 -0
- package/dist/KaTeX_AMS-Regular-CYEKBG2K.woff +0 -0
- package/dist/KaTeX_AMS-Regular-JKX5W2C4.ttf +0 -0
- package/dist/KaTeX_AMS-Regular-U6PRYMIZ.woff2 +0 -0
- package/dist/KaTeX_Caligraphic-Bold-5QL5CMTE.woff2 +0 -0
- package/dist/KaTeX_Caligraphic-Bold-WZ3QSGD3.woff +0 -0
- package/dist/KaTeX_Caligraphic-Bold-ZTS3R3HK.ttf +0 -0
- package/dist/KaTeX_Caligraphic-Regular-3LKEU76G.woff +0 -0
- package/dist/KaTeX_Caligraphic-Regular-A7XRTZ5Q.ttf +0 -0
- package/dist/KaTeX_Caligraphic-Regular-KX5MEWCF.woff2 +0 -0
- package/dist/KaTeX_Fraktur-Bold-2QVFK6NQ.woff2 +0 -0
- package/dist/KaTeX_Fraktur-Bold-T4SWXBMT.woff +0 -0
- package/dist/KaTeX_Fraktur-Bold-WGHVTYOR.ttf +0 -0
- package/dist/KaTeX_Fraktur-Regular-2PEIFJSJ.woff2 +0 -0
- package/dist/KaTeX_Fraktur-Regular-5U4OPH2X.ttf +0 -0
- package/dist/KaTeX_Fraktur-Regular-PQMHCIK6.woff +0 -0
- package/dist/KaTeX_Main-Bold-2GA4IZIN.woff +0 -0
- package/dist/KaTeX_Main-Bold-W5FBVCZM.ttf +0 -0
- package/dist/KaTeX_Main-Bold-YP5VVQRP.woff2 +0 -0
- package/dist/KaTeX_Main-BoldItalic-4P4C7HJH.woff +0 -0
- package/dist/KaTeX_Main-BoldItalic-N4V3DX7S.woff2 +0 -0
- package/dist/KaTeX_Main-BoldItalic-ODMLBJJQ.ttf +0 -0
- package/dist/KaTeX_Main-Italic-I43T2HSR.ttf +0 -0
- package/dist/KaTeX_Main-Italic-RELBIK7M.woff2 +0 -0
- package/dist/KaTeX_Main-Italic-SASNQFN2.woff +0 -0
- package/dist/KaTeX_Main-Regular-ARRPAO67.woff2 +0 -0
- package/dist/KaTeX_Main-Regular-P5I74A2A.woff +0 -0
- package/dist/KaTeX_Main-Regular-W74P5G27.ttf +0 -0
- package/dist/KaTeX_Math-BoldItalic-6EBV3DK5.woff +0 -0
- package/dist/KaTeX_Math-BoldItalic-K4WTGH3J.woff2 +0 -0
- package/dist/KaTeX_Math-BoldItalic-VB447A4D.ttf +0 -0
- package/dist/KaTeX_Math-Italic-6KGCHLFN.woff2 +0 -0
- package/dist/KaTeX_Math-Italic-KKK3USB2.woff +0 -0
- package/dist/KaTeX_Math-Italic-SON4MRCA.ttf +0 -0
- package/dist/KaTeX_SansSerif-Bold-RRNVJFFW.woff2 +0 -0
- package/dist/KaTeX_SansSerif-Bold-STQ6RXC7.ttf +0 -0
- package/dist/KaTeX_SansSerif-Bold-X5M5EMOD.woff +0 -0
- package/dist/KaTeX_SansSerif-Italic-HMPFTM52.woff2 +0 -0
- package/dist/KaTeX_SansSerif-Italic-PSN4QKYX.woff +0 -0
- package/dist/KaTeX_SansSerif-Italic-WTBAZBGY.ttf +0 -0
- package/dist/KaTeX_SansSerif-Regular-2TL3USAE.ttf +0 -0
- package/dist/KaTeX_SansSerif-Regular-OQCII6EP.woff +0 -0
- package/dist/KaTeX_SansSerif-Regular-XIQ62X4E.woff2 +0 -0
- package/dist/KaTeX_Script-Regular-72OLXYNA.ttf +0 -0
- package/dist/KaTeX_Script-Regular-A5IFOEBS.woff +0 -0
- package/dist/KaTeX_Script-Regular-APUWIHLP.woff2 +0 -0
- package/dist/KaTeX_Size1-Regular-4HRHTS65.woff +0 -0
- package/dist/KaTeX_Size1-Regular-5LRUTBFT.woff2 +0 -0
- package/dist/KaTeX_Size1-Regular-7K6AASVL.ttf +0 -0
- package/dist/KaTeX_Size2-Regular-222HN3GT.ttf +0 -0
- package/dist/KaTeX_Size2-Regular-K5ZHAIS6.woff +0 -0
- package/dist/KaTeX_Size2-Regular-LELKET5D.woff2 +0 -0
- package/dist/KaTeX_Size3-Regular-TLFPAHDE.woff +0 -0
- package/dist/KaTeX_Size3-Regular-UFCO6WCA.ttf +0 -0
- package/dist/KaTeX_Size3-Regular-WQRQ47UD.woff2 +0 -0
- package/dist/KaTeX_Size4-Regular-7PGNVPQK.ttf +0 -0
- package/dist/KaTeX_Size4-Regular-CDMV7U5C.woff2 +0 -0
- package/dist/KaTeX_Size4-Regular-PKMWZHNC.woff +0 -0
- package/dist/KaTeX_Typewriter-Regular-3F5K6SQ6.ttf +0 -0
- package/dist/KaTeX_Typewriter-Regular-MJMFSK64.woff +0 -0
- package/dist/KaTeX_Typewriter-Regular-VBYJ4NRC.woff2 +0 -0
- package/dist/KernelEngineContext-BOCQoFwk.d.ts +43 -0
- package/dist/LayersPanel-BBQ54IVG.js +7 -0
- package/dist/ModuleCard-3TT2X7IW.js +7 -0
- package/dist/OrbInspector-K6T6O7GI.js +27 -0
- package/dist/OrbInspector-MHLJ6OEE.css +1756 -0
- package/dist/Select-mDZIwNqN.d.ts +199 -0
- package/dist/ServerBridge-Cm1On51b.d.ts +233 -0
- package/dist/ThemeContext-DJmO59xd.d.ts +147 -0
- package/dist/TraitValueFrame-2PJGLLVI.js +28 -0
- package/dist/TraitValueFrame-4G3KOUBR.css +1756 -0
- package/dist/UISlotContext-Dl_ewwCI.d.ts +79 -0
- package/dist/UISlotRenderer-JKFSX24W.js +27 -0
- package/dist/UISlotRenderer-KVFO6J7R.css +1756 -0
- package/dist/UserContext-DqWeZkUZ.d.ts +100 -0
- package/dist/auth/browser/index.d.ts +2 -0
- package/dist/auth/browser/index.js +1 -0
- package/dist/auth/react/index.d.ts +49 -0
- package/dist/auth/react/index.js +119 -0
- package/dist/avl/index.css +1756 -0
- package/dist/avl/index.d.ts +2238 -0
- package/dist/avl/index.js +2693 -0
- package/dist/avl-3d-context-BIRKWpaL.d.ts +204 -0
- package/dist/avl-schema-parser-CtJxJ9KU.d.ts +132 -0
- package/dist/avl-zoom-state-CKMVuBFg.d.ts +17 -0
- package/dist/chunk-2PY54Z44.js +227 -0
- package/dist/chunk-2QOH2HWM.js +95 -0
- package/dist/chunk-3BBUBJFF.js +339 -0
- package/dist/chunk-42FY4RYA.js +191 -0
- package/dist/chunk-5QTYQTPS.js +15 -0
- package/dist/chunk-6P3MWXYE.js +440 -0
- package/dist/chunk-73SRAB4P.js +1053 -0
- package/dist/chunk-A2LR6VQQ.js +349 -0
- package/dist/chunk-AILY3XPS.js +562 -0
- package/dist/chunk-B4BU77LT.js +432 -0
- package/dist/chunk-DFNZUYX4.js +378 -0
- package/dist/chunk-DJ433ET5.js +1327 -0
- package/dist/chunk-DLZF4PVE.js +24 -0
- package/dist/chunk-DYEKAA4L.js +787 -0
- package/dist/chunk-DZ42OJQC.js +176 -0
- package/dist/chunk-EOWMARUB.js +16 -0
- package/dist/chunk-EQAMU2ZC.js +14 -0
- package/dist/chunk-FAJDTHWC.js +98 -0
- package/dist/chunk-FIW6WN23.js +508 -0
- package/dist/chunk-FP3WIKTC.js +303 -0
- package/dist/chunk-G7DCAZ22.js +19 -0
- package/dist/chunk-GAR5TQ5B.js +199 -0
- package/dist/chunk-GKIFONTE.js +131 -0
- package/dist/chunk-GYTPOFVC.js +47155 -0
- package/dist/chunk-KVQS4GXU.js +328 -0
- package/dist/chunk-L2DEKY4J.js +97 -0
- package/dist/chunk-L677XGY3.js +701 -0
- package/dist/chunk-MBQAMMSE.js +11877 -0
- package/dist/chunk-P4LNHAFI.js +1051 -0
- package/dist/chunk-P4ZFUQFF.js +93 -0
- package/dist/chunk-PC7K4SK7.js +1384 -0
- package/dist/chunk-R5O5AUPI.js +573 -0
- package/dist/chunk-SGM3FASH.js +672 -0
- package/dist/chunk-SJGJJKBY.js +502 -0
- package/dist/chunk-TESBIVUA.js +11 -0
- package/dist/chunk-TZZBINQY.js +82 -0
- package/dist/chunk-U6QRZASX.js +280 -0
- package/dist/chunk-VFF5OO47.js +319 -0
- package/dist/chunk-YDNJLLG6.js +516 -0
- package/dist/chunk-YHMRX6YA.js +455 -0
- package/dist/chunk-ZO6MXAS3.js +69 -0
- package/dist/components/index.css +1756 -0
- package/dist/components/index.d.ts +11093 -0
- package/dist/components/index.js +1110 -0
- package/dist/context/index.d.ts +9 -0
- package/dist/context/index.js +7 -0
- package/dist/core.d.ts +2523 -0
- package/dist/core.js +2 -0
- package/dist/design-classes/index.cjs +429 -0
- package/dist/design-classes/index.d.cts +165 -0
- package/dist/design-classes/index.d.ts +165 -0
- package/dist/design-classes/index.js +397 -0
- package/dist/emojiItems-QGSNAABW.js +20 -0
- package/dist/fx-CmQjnHmT.d.ts +371 -0
- package/dist/hooks/index.d.ts +936 -0
- package/dist/hooks/index.js +7 -0
- package/dist/index.d.ts +486 -0
- package/dist/index.js +38 -0
- package/dist/katexPlugin-FA7NX4PE.css +1161 -0
- package/dist/katexPlugin-NCDKOOQY.js +2 -0
- package/dist/kernel-client-ZH4PSMCN.js +367 -0
- package/dist/kernel-wire-B4S8pnP3.d.ts +65 -0
- package/dist/lib/index.d.ts +602 -0
- package/dist/lib/index.js +1288 -0
- package/dist/paintDispatch-ChW5mVuK.d.ts +698 -0
- package/dist/parseLessonSegments-GpCeMrb2.d.ts +334 -0
- package/dist/perf-CKiBKbkw.d.ts +22 -0
- package/dist/perf-Dr28-AgT.d.ts +57 -0
- package/dist/prism-AIWGN2X5.js +134 -0
- package/dist/providers/index.css +1756 -0
- package/dist/providers/index.d.ts +340 -0
- package/dist/providers/index.js +30 -0
- package/dist/renderer/index.d.ts +467 -0
- package/dist/renderer/index.js +3 -0
- package/dist/runtime/index.css +1756 -0
- package/dist/runtime/index.d.ts +440 -0
- package/dist/runtime/index.js +31 -0
- package/dist/slot-host-CPzrxLo9.d.ts +48 -0
- package/dist/ssr/index.cjs +7631 -0
- package/dist/ssr/index.d.cts +487 -0
- package/dist/ssr/index.d.ts +487 -0
- package/dist/ssr/index.js +7599 -0
- package/dist/storage/browser/index.d.ts +1 -0
- package/dist/storage/browser/index.js +1 -0
- package/dist/test-support.d.ts +35 -0
- package/dist/test-support.js +114 -0
- package/dist/themeTokens-CRd8AEDF.d.ts +125 -0
- package/dist/three/index.css +503 -0
- package/dist/three/index.d.ts +1185 -0
- package/dist/three/index.js +3896 -0
- package/dist/useKeyboardRouter-Dsq553Ur.d.ts +42 -0
- package/dist/useUISlots-CiobNFGb.d.ts +211 -0
- package/dist/verification-C5pTeMJv.d.ts +66 -0
- package/dist/verificationRegistry-CabxhfTv.d.ts +122 -0
- package/dist/wrapCallbackForEvent-B9QLbhxX.d.ts +19 -0
- package/index.css +199 -0
- package/package.json +269 -3
- package/src/core/locales/ar.json +1263 -0
- package/src/core/locales/en.json +1263 -0
- package/src/core/locales/index.ts +54 -0
- package/src/core/locales/sl.json +1263 -0
- package/src/core/tokens/native-tokens.json +369 -0
- package/tailwind-compile.cjs +29 -0
- package/tailwind-preset.cjs +991 -0
- package/themes/_base.css +451 -0
- package/themes/_contract.md +307 -0
- package/themes/_fonts-kenney.css +11 -0
- package/themes/_fonts.css +12 -0
- package/themes/_foundation.css +105 -0
- package/themes/_head.css +22 -0
- package/themes/_presets.css +67 -0
- package/themes/almadar-heritage.css +455 -0
- package/themes/almadar-website.css +269 -0
- package/themes/almadar.css +269 -0
- package/themes/aqua.css +455 -0
- package/themes/arabesque.css +459 -0
- package/themes/art-deco.css +457 -0
- package/themes/art-nouveau.css +459 -0
- package/themes/atelier.css +463 -0
- package/themes/bauhaus.css +461 -0
- package/themes/bloomberg-dense.css +463 -0
- package/themes/blueprint.css +457 -0
- package/themes/clay.css +449 -0
- package/themes/comic.css +453 -0
- package/themes/constructivist.css +457 -0
- package/themes/corporate.css +449 -0
- package/themes/cyberpunk.css +453 -0
- package/themes/frutiger-aero.css +458 -0
- package/themes/game-adventure.css +201 -0
- package/themes/game-rpg.css +203 -0
- package/themes/game-sci-fi.css +201 -0
- package/themes/game-ui-pack.css +200 -0
- package/themes/gazette.css +449 -0
- package/themes/glass.css +457 -0
- package/themes/gothic.css +453 -0
- package/themes/index.css +21 -0
- package/themes/ink-wash.css +459 -0
- package/themes/kawaii.css +459 -0
- package/themes/kflow.css +310 -0
- package/themes/kiosk.css +449 -0
- package/themes/linear-clean.css +463 -0
- package/themes/luxury.css +451 -0
- package/themes/mac-classic.css +455 -0
- package/themes/material.css +463 -0
- package/themes/memphis.css +453 -0
- package/themes/mid-century.css +455 -0
- package/themes/minimalist.css +449 -0
- package/themes/mudcloth.css +459 -0
- package/themes/nata.css +310 -0
- package/themes/neon.css +453 -0
- package/themes/neumorphic.css +451 -0
- package/themes/newsprint.css +455 -0
- package/themes/notion-editorial.css +463 -0
- package/themes/orb.css +465 -0
- package/themes/pixel.css +449 -0
- package/themes/prism.css +309 -0
- package/themes/rawi.css +310 -0
- package/themes/retro.css +452 -0
- package/themes/risograph.css +463 -0
- package/themes/scandi.css +469 -0
- package/themes/sketch.css +455 -0
- package/themes/solarpunk.css +469 -0
- package/themes/steampunk.css +451 -0
- package/themes/swiss.css +455 -0
- package/themes/terminal.css +466 -0
- package/themes/trait-wars.css +487 -0
- package/themes/ukiyo-e.css +459 -0
- package/themes/vaporwave.css +455 -0
- package/themes/victorian.css +453 -0
- package/themes/wabi-sabi.css +459 -0
- package/themes/win95.css +455 -0
- package/themes/wireframe.css +439 -0
- package/themes/zine.css +455 -0
- package/README.md +0 -3
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
// src/lib/themeTokens.ts
|
|
2
|
+
function applyFlat(obj, table, vars) {
|
|
3
|
+
if (!obj) return;
|
|
4
|
+
for (const { cssVar, key } of table) {
|
|
5
|
+
const value = obj[key];
|
|
6
|
+
if (value !== void 0) vars[cssVar] = value;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
var DENSITY_SPACING_VARS = [
|
|
10
|
+
{ cssVar: "--space-0", key: "space0" },
|
|
11
|
+
{ cssVar: "--space-1", key: "space1" },
|
|
12
|
+
{ cssVar: "--space-2", key: "space2" },
|
|
13
|
+
{ cssVar: "--space-3", key: "space3" },
|
|
14
|
+
{ cssVar: "--space-4", key: "space4" },
|
|
15
|
+
{ cssVar: "--space-5", key: "space5" },
|
|
16
|
+
{ cssVar: "--space-6", key: "space6" },
|
|
17
|
+
{ cssVar: "--space-7", key: "space7" },
|
|
18
|
+
{ cssVar: "--space-8", key: "space8" },
|
|
19
|
+
{ cssVar: "--space-9", key: "space9" },
|
|
20
|
+
{ cssVar: "--space-10", key: "space10" },
|
|
21
|
+
{ cssVar: "--space-11", key: "space11" },
|
|
22
|
+
{ cssVar: "--space-12", key: "space12" }
|
|
23
|
+
];
|
|
24
|
+
var DENSITY_ELEMENT_VARS = [
|
|
25
|
+
{ cssVar: "--button-height-sm", key: "buttonHeightSm" },
|
|
26
|
+
{ cssVar: "--button-height-md", key: "buttonHeightMd" },
|
|
27
|
+
{ cssVar: "--button-height-lg", key: "buttonHeightLg" },
|
|
28
|
+
{ cssVar: "--input-height-sm", key: "inputHeightSm" },
|
|
29
|
+
{ cssVar: "--input-height-md", key: "inputHeightMd" },
|
|
30
|
+
{ cssVar: "--input-height-lg", key: "inputHeightLg" },
|
|
31
|
+
{ cssVar: "--row-height-compact", key: "rowHeightCompact" },
|
|
32
|
+
{ cssVar: "--row-height-normal", key: "rowHeightNormal" },
|
|
33
|
+
{ cssVar: "--row-height-spacious", key: "rowHeightSpacious" },
|
|
34
|
+
{ cssVar: "--card-padding-sm", key: "cardPaddingSm" },
|
|
35
|
+
{ cssVar: "--card-padding-md", key: "cardPaddingMd" },
|
|
36
|
+
{ cssVar: "--card-padding-lg", key: "cardPaddingLg" },
|
|
37
|
+
{ cssVar: "--dialog-padding", key: "dialogPadding" },
|
|
38
|
+
{ cssVar: "--section-gap", key: "sectionGap" }
|
|
39
|
+
];
|
|
40
|
+
var TYPE_FAMILY_VARS = [
|
|
41
|
+
{ cssVar: "--font-family-display", key: "displayFamily" },
|
|
42
|
+
{ cssVar: "--font-family-body", key: "bodyFamily" },
|
|
43
|
+
{ cssVar: "--font-family-mono", key: "monoFamily" }
|
|
44
|
+
];
|
|
45
|
+
var TYPE_HEADING_VARS = [
|
|
46
|
+
{ cssVar: "--heading-weight", key: "headingWeight" },
|
|
47
|
+
{ cssVar: "--heading-transform", key: "headingTransform" },
|
|
48
|
+
{ cssVar: "--heading-tracking", key: "headingTracking" },
|
|
49
|
+
{ cssVar: "--heading-style", key: "headingStyle" },
|
|
50
|
+
{ cssVar: "--heading-shadow", key: "headingShadow" }
|
|
51
|
+
];
|
|
52
|
+
var TYPE_SIZE_KEYS = [
|
|
53
|
+
"xs",
|
|
54
|
+
"sm",
|
|
55
|
+
"base",
|
|
56
|
+
"lg",
|
|
57
|
+
"xl",
|
|
58
|
+
"2xl",
|
|
59
|
+
"3xl",
|
|
60
|
+
"4xl",
|
|
61
|
+
"display-1",
|
|
62
|
+
"display-2"
|
|
63
|
+
];
|
|
64
|
+
var TYPE_INTENT_VARS = [
|
|
65
|
+
{ key: "headingMajor", cssName: "heading-major" },
|
|
66
|
+
{ key: "headingMinor", cssName: "heading-minor" },
|
|
67
|
+
{ key: "bodyEmphasis", cssName: "body-emphasis" },
|
|
68
|
+
{ key: "bodyDefault", cssName: "body-default" },
|
|
69
|
+
{ key: "bodyQuiet", cssName: "body-quiet" },
|
|
70
|
+
{ key: "caption", cssName: "caption" },
|
|
71
|
+
{ key: "numeric", cssName: "numeric" }
|
|
72
|
+
];
|
|
73
|
+
var MOTION_DURATION_KEYS = [
|
|
74
|
+
"instant",
|
|
75
|
+
"fast",
|
|
76
|
+
"normal",
|
|
77
|
+
"slow",
|
|
78
|
+
"dramatic"
|
|
79
|
+
];
|
|
80
|
+
var MOTION_EASING_KEYS = [
|
|
81
|
+
"linear",
|
|
82
|
+
"standard",
|
|
83
|
+
"emphasized",
|
|
84
|
+
"spring"
|
|
85
|
+
];
|
|
86
|
+
var MOTION_INTENT_VARS = [
|
|
87
|
+
{ key: "enter", cssName: "enter" },
|
|
88
|
+
{ key: "exit", cssName: "exit" },
|
|
89
|
+
{ key: "hover", cssName: "hover" },
|
|
90
|
+
{ key: "press", cssName: "press" },
|
|
91
|
+
{ key: "expand", cssName: "expand" },
|
|
92
|
+
{ key: "transition", cssName: "transition" }
|
|
93
|
+
];
|
|
94
|
+
var MOTION_SHAPE_VARS = [
|
|
95
|
+
{ cssVar: "--motion-modal-enter-from-transform", key: "modalEnter" },
|
|
96
|
+
{ cssVar: "--motion-modal-exit-to-transform", key: "modalExit" },
|
|
97
|
+
{ cssVar: "--motion-popover-enter-from-transform", key: "popoverEnter" },
|
|
98
|
+
{ cssVar: "--motion-popover-exit-to-transform", key: "popoverExit" },
|
|
99
|
+
{ cssVar: "--motion-toast-enter-from-transform", key: "toastEnter" },
|
|
100
|
+
{ cssVar: "--motion-toast-exit-to-transform", key: "toastExit" },
|
|
101
|
+
{ cssVar: "--motion-page-enter-from-transform", key: "pageEnter" },
|
|
102
|
+
{ cssVar: "--motion-enter-rise-from-transform", key: "enterRise" },
|
|
103
|
+
{ cssVar: "--motion-enter-scale-from-transform", key: "enterScale" },
|
|
104
|
+
{ cssVar: "--motion-enter-slide-from-transform", key: "enterSlide" }
|
|
105
|
+
];
|
|
106
|
+
var ICONOGRAPHY_VARS = [
|
|
107
|
+
{ cssVar: "--icon-family", key: "family" },
|
|
108
|
+
{ cssVar: "--icon-stroke-width", key: "strokeWidth" },
|
|
109
|
+
{ cssVar: "--icon-default-size", key: "defaultSize" }
|
|
110
|
+
];
|
|
111
|
+
var ELEVATION_VARS = [
|
|
112
|
+
{ cssVar: "--elevation-card", key: "cardElevation" },
|
|
113
|
+
{ cssVar: "--elevation-popover", key: "popoverElevation" },
|
|
114
|
+
{ cssVar: "--elevation-dialog", key: "dialogElevation" },
|
|
115
|
+
{ cssVar: "--elevation-toast", key: "toastElevation" },
|
|
116
|
+
{ cssVar: "--elevation-interactive", key: "interactiveElevation" },
|
|
117
|
+
{ cssVar: "--elevation-pressed", key: "pressedElevation" }
|
|
118
|
+
];
|
|
119
|
+
var GEOMETRY_VARS = [
|
|
120
|
+
{ cssVar: "--radius-container", key: "radiusContainer" },
|
|
121
|
+
{ cssVar: "--radius-interactive", key: "radiusInteractive" },
|
|
122
|
+
{ cssVar: "--radius-pill", key: "radiusPill" },
|
|
123
|
+
{ cssVar: "--border-hairline", key: "borderHairline" },
|
|
124
|
+
{ cssVar: "--border-standard", key: "borderStandard" },
|
|
125
|
+
{ cssVar: "--border-heavy", key: "borderHeavy" },
|
|
126
|
+
{ cssVar: "--corner-shape", key: "cornerShape" },
|
|
127
|
+
{ cssVar: "--corner-shape-pill", key: "cornerShapePill" },
|
|
128
|
+
{ cssVar: "--corner-shape-interactive", key: "cornerShapeInteractive" },
|
|
129
|
+
{ cssVar: "--border-style", key: "borderStyle" },
|
|
130
|
+
{ cssVar: "--border-style-interactive", key: "borderStyleInteractive" }
|
|
131
|
+
];
|
|
132
|
+
var SURFACE_VARS = [
|
|
133
|
+
{ cssVar: "--surface-backdrop", key: "backdrop" },
|
|
134
|
+
{ cssVar: "--surface-card-image", key: "cardImage" },
|
|
135
|
+
{ cssVar: "--surface-page-image", key: "pageImage" },
|
|
136
|
+
{ cssVar: "--surface-page-image-size", key: "pageImageSize" },
|
|
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" }
|
|
144
|
+
];
|
|
145
|
+
var DIAGRAM_VARS = [
|
|
146
|
+
{ cssVar: "--diagram-stroke-thin", key: "strokeThin" },
|
|
147
|
+
{ cssVar: "--diagram-stroke-normal", key: "strokeNormal" },
|
|
148
|
+
{ cssVar: "--diagram-stroke-bold", key: "strokeBold" },
|
|
149
|
+
{ cssVar: "--diagram-line-cap", key: "lineCap" },
|
|
150
|
+
{ cssVar: "--diagram-line-join", key: "lineJoin" },
|
|
151
|
+
{ cssVar: "--diagram-dash", key: "dash" },
|
|
152
|
+
{ cssVar: "--diagram-dot", key: "dot" },
|
|
153
|
+
{ cssVar: "--diagram-fill-style", key: "fillStyle" },
|
|
154
|
+
{ cssVar: "--diagram-fill-opacity", key: "fillOpacity" },
|
|
155
|
+
{ cssVar: "--diagram-roughness", key: "roughness" },
|
|
156
|
+
{ cssVar: "--diagram-glow", key: "glow" },
|
|
157
|
+
{ cssVar: "--diagram-shadow", key: "shadow" },
|
|
158
|
+
{ cssVar: "--diagram-marker", key: "marker" },
|
|
159
|
+
{ cssVar: "--diagram-label-font", key: "labelFont" },
|
|
160
|
+
{ cssVar: "--diagram-label-size", key: "labelSize" },
|
|
161
|
+
{ cssVar: "--diagram-label-weight", key: "labelWeight" },
|
|
162
|
+
{ cssVar: "--diagram-label-case", key: "labelCase" },
|
|
163
|
+
{ cssVar: "--diagram-corner", key: "corner" }
|
|
164
|
+
];
|
|
165
|
+
var SCENE_VARS = [
|
|
166
|
+
{ cssVar: "--material-roughness", key: "materialRoughness" },
|
|
167
|
+
{ cssVar: "--material-metalness", key: "materialMetalness" },
|
|
168
|
+
{ cssVar: "--material-flat", key: "materialFlat" },
|
|
169
|
+
{ cssVar: "--material-outline", key: "materialOutline" },
|
|
170
|
+
{ cssVar: "--light-ambient", key: "lightAmbient" },
|
|
171
|
+
{ cssVar: "--light-key", key: "lightKey" },
|
|
172
|
+
{ cssVar: "--light-key-color", key: "lightKeyColor" },
|
|
173
|
+
{ cssVar: "--scene-fog", key: "fog" }
|
|
174
|
+
];
|
|
175
|
+
var LEGACY_PREFIXES = {
|
|
176
|
+
colors: "--color-",
|
|
177
|
+
radii: "--radius-",
|
|
178
|
+
spacing: "--space-",
|
|
179
|
+
shadows: "--shadow-"
|
|
180
|
+
};
|
|
181
|
+
function themeTokensToCssVars(tokens, mode = "light", darkVariant) {
|
|
182
|
+
const vars = {};
|
|
183
|
+
const isDark = mode === "dark";
|
|
184
|
+
const pickColors = isDark && darkVariant?.colors ? darkVariant.colors : tokens.colors;
|
|
185
|
+
if (pickColors) {
|
|
186
|
+
for (const [key, value] of Object.entries(pickColors)) {
|
|
187
|
+
vars[`${LEGACY_PREFIXES.colors}${key}`] = value;
|
|
188
|
+
}
|
|
189
|
+
if (isDark && darkVariant?.colors && tokens.colors) {
|
|
190
|
+
for (const [key, value] of Object.entries(tokens.colors)) {
|
|
191
|
+
const varName = `${LEGACY_PREFIXES.colors}${key}`;
|
|
192
|
+
if (!(varName in vars)) vars[varName] = value;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
const pickRadii = isDark && darkVariant?.radii ? darkVariant.radii : tokens.radii;
|
|
197
|
+
if (pickRadii) {
|
|
198
|
+
for (const [key, value] of Object.entries(pickRadii)) {
|
|
199
|
+
vars[`${LEGACY_PREFIXES.radii}${key}`] = value;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
const pickSpacing = isDark && darkVariant?.spacing ? darkVariant.spacing : tokens.spacing;
|
|
203
|
+
if (pickSpacing) {
|
|
204
|
+
for (const [key, value] of Object.entries(pickSpacing)) {
|
|
205
|
+
vars[`${LEGACY_PREFIXES.spacing}${key}`] = value;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const pickTypography = isDark && darkVariant?.typography ? darkVariant.typography : tokens.typography;
|
|
209
|
+
if (pickTypography) {
|
|
210
|
+
for (const [key, value] of Object.entries(pickTypography)) {
|
|
211
|
+
vars[`--${key}`] = value;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
const pickShadows = isDark && darkVariant?.shadows ? darkVariant.shadows : tokens.shadows;
|
|
215
|
+
if (pickShadows) {
|
|
216
|
+
for (const [key, value] of Object.entries(pickShadows)) {
|
|
217
|
+
vars[`${LEGACY_PREFIXES.shadows}${key}`] = value;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
const pickDensity = isDark && darkVariant?.density ? darkVariant.density : tokens.density;
|
|
221
|
+
emitDensity(pickDensity, vars);
|
|
222
|
+
const pickTypeScale = isDark && darkVariant?.typeScale ? darkVariant.typeScale : tokens.typeScale;
|
|
223
|
+
emitTypeScale(pickTypeScale, vars);
|
|
224
|
+
const pickMotion = isDark && darkVariant?.motion ? darkVariant.motion : tokens.motion;
|
|
225
|
+
emitMotion(pickMotion, vars);
|
|
226
|
+
const pickIconography = isDark && darkVariant?.iconography ? darkVariant.iconography : tokens.iconography;
|
|
227
|
+
emitIconography(pickIconography, vars);
|
|
228
|
+
const pickElevation = isDark && darkVariant?.elevation ? darkVariant.elevation : tokens.elevation;
|
|
229
|
+
emitElevation(pickElevation, vars);
|
|
230
|
+
const pickGeometry = isDark && darkVariant?.geometry ? darkVariant.geometry : tokens.geometry;
|
|
231
|
+
emitGeometry(pickGeometry, vars);
|
|
232
|
+
const pickIllustration = isDark && darkVariant?.illustration ? darkVariant.illustration : tokens.illustration;
|
|
233
|
+
emitIllustration(pickIllustration, vars);
|
|
234
|
+
const pickSurface = isDark && darkVariant?.surface ? darkVariant.surface : tokens.surface;
|
|
235
|
+
applyFlat(pickSurface, SURFACE_VARS, vars);
|
|
236
|
+
const pickDiagram = isDark && darkVariant?.diagram ? darkVariant.diagram : tokens.diagram;
|
|
237
|
+
applyFlat(pickDiagram, DIAGRAM_VARS, vars);
|
|
238
|
+
const pickScene = isDark && darkVariant?.scene ? darkVariant.scene : tokens.scene;
|
|
239
|
+
applyFlat(pickScene, SCENE_VARS, vars);
|
|
240
|
+
return vars;
|
|
241
|
+
}
|
|
242
|
+
function emitDensity(density, vars) {
|
|
243
|
+
if (!density) return;
|
|
244
|
+
applyFlat(density.spacing, DENSITY_SPACING_VARS, vars);
|
|
245
|
+
applyFlat(density, DENSITY_ELEMENT_VARS, vars);
|
|
246
|
+
}
|
|
247
|
+
function typeSizeKeyStr(k) {
|
|
248
|
+
return k;
|
|
249
|
+
}
|
|
250
|
+
function typeWeightStr(w) {
|
|
251
|
+
return w;
|
|
252
|
+
}
|
|
253
|
+
function emitTypeIntent(name, intent, vars) {
|
|
254
|
+
const sizeKey = typeSizeKeyStr(intent.size);
|
|
255
|
+
const weight = typeWeightStr(intent.weight);
|
|
256
|
+
vars[`--intent-${name}-size`] = `var(--text-${sizeKey})`;
|
|
257
|
+
vars[`--intent-${name}-weight`] = `var(--font-weight-${weight})`;
|
|
258
|
+
vars[`--intent-${name}-leading`] = `var(--leading-${sizeKey})`;
|
|
259
|
+
}
|
|
260
|
+
function emitTypeScale(ts, vars) {
|
|
261
|
+
if (!ts) return;
|
|
262
|
+
applyFlat(ts, TYPE_FAMILY_VARS, vars);
|
|
263
|
+
applyFlat(ts, TYPE_HEADING_VARS, vars);
|
|
264
|
+
if (ts.scale) {
|
|
265
|
+
const s = ts.scale;
|
|
266
|
+
for (const k of TYPE_SIZE_KEYS) {
|
|
267
|
+
const entry = s[k];
|
|
268
|
+
if (entry !== void 0) {
|
|
269
|
+
vars[`--text-${k}`] = entry.size;
|
|
270
|
+
vars[`--leading-${k}`] = entry.lineHeight;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
if (ts.intents) {
|
|
275
|
+
const i = ts.intents;
|
|
276
|
+
for (const { key, cssName } of TYPE_INTENT_VARS) {
|
|
277
|
+
const intent = i[key];
|
|
278
|
+
if (intent) emitTypeIntent(cssName, intent, vars);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
function emitMotionIntent(name, intent, vars) {
|
|
283
|
+
vars[`--intent-${name}-duration`] = `var(--duration-${intent.duration})`;
|
|
284
|
+
vars[`--intent-${name}-easing`] = `var(--easing-${intent.easing})`;
|
|
285
|
+
}
|
|
286
|
+
function emitMotion(m, vars) {
|
|
287
|
+
if (!m) return;
|
|
288
|
+
if (m.durations) {
|
|
289
|
+
const d = m.durations;
|
|
290
|
+
for (const k of MOTION_DURATION_KEYS) {
|
|
291
|
+
const v = d[k];
|
|
292
|
+
if (v !== void 0) vars[`--duration-${k}`] = v;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
if (m.easings) {
|
|
296
|
+
const e = m.easings;
|
|
297
|
+
for (const k of MOTION_EASING_KEYS) {
|
|
298
|
+
const v = e[k];
|
|
299
|
+
if (v !== void 0) vars[`--easing-${k}`] = v;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
if (m.intents) {
|
|
303
|
+
const i = m.intents;
|
|
304
|
+
for (const { key, cssName } of MOTION_INTENT_VARS) {
|
|
305
|
+
const intent = i[key];
|
|
306
|
+
if (intent) emitMotionIntent(cssName, intent, vars);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
applyFlat(m.shapes, MOTION_SHAPE_VARS, vars);
|
|
310
|
+
if (m.entry?.default !== void 0) vars["--motion-enter-default"] = enterKeyframe(m.entry.default);
|
|
311
|
+
if (m.entry?.stagger !== void 0) vars["--motion-enter-stagger"] = m.entry.stagger;
|
|
312
|
+
if (m.busyDelay !== void 0) vars["--motion-busy-delay"] = m.busyDelay;
|
|
313
|
+
if (m.awaitingSkeleton !== void 0) vars["--awaiting-skeleton-display"] = m.awaitingSkeleton ? "block" : "none";
|
|
314
|
+
}
|
|
315
|
+
function enterKeyframe(enter) {
|
|
316
|
+
return enter === "none" ? "none" : `almadar-enter-${enter}`;
|
|
317
|
+
}
|
|
318
|
+
function emitIconography(i, vars) {
|
|
319
|
+
applyFlat(i, ICONOGRAPHY_VARS, vars);
|
|
320
|
+
}
|
|
321
|
+
function emitElevation(e, vars) {
|
|
322
|
+
applyFlat(e, ELEVATION_VARS, vars);
|
|
323
|
+
}
|
|
324
|
+
function emitGeometry(g, vars) {
|
|
325
|
+
applyFlat(g, GEOMETRY_VARS, vars);
|
|
326
|
+
}
|
|
327
|
+
function emitIllustration(il, vars) {
|
|
328
|
+
if (!il?.loadingAsset) return;
|
|
329
|
+
vars["--illustration-loading"] = `url("${il.loadingAsset}")`;
|
|
330
|
+
vars["--loader-mark-display"] = "inline-block";
|
|
331
|
+
vars["--loader-icon-display"] = "none";
|
|
332
|
+
}
|
|
333
|
+
function resolveThemeForRuntime(theme) {
|
|
334
|
+
if (theme === void 0) return void 0;
|
|
335
|
+
if (typeof theme === "string") return void 0;
|
|
336
|
+
return theme;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export { DENSITY_ELEMENT_VARS, DENSITY_SPACING_VARS, DIAGRAM_VARS, ELEVATION_VARS, GEOMETRY_VARS, ICONOGRAPHY_VARS, LEGACY_PREFIXES, MOTION_DURATION_KEYS, MOTION_EASING_KEYS, MOTION_INTENT_VARS, MOTION_SHAPE_VARS, SCENE_VARS, SURFACE_VARS, TYPE_FAMILY_VARS, TYPE_HEADING_VARS, TYPE_INTENT_VARS, TYPE_SIZE_KEYS, enterKeyframe, resolveThemeForRuntime, themeTokensToCssVars };
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { traitLevelFromDescription } from './chunk-VFF5OO47.js';
|
|
2
|
+
import { useContentSurface, useEventBus, Typography, Icon, cn, domPassthrough } from './chunk-MBQAMMSE.js';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
function generateItemId(item, index) {
|
|
7
|
+
if (item.id) return item.id;
|
|
8
|
+
const headerText = item.header ?? item.title;
|
|
9
|
+
if (typeof headerText === "string") {
|
|
10
|
+
return `accordion-${headerText.toLowerCase().replace(/\s+/g, "-")}-${index}`;
|
|
11
|
+
}
|
|
12
|
+
return `accordion-item-${index}`;
|
|
13
|
+
}
|
|
14
|
+
function normalizeItem(item, index) {
|
|
15
|
+
return {
|
|
16
|
+
...item,
|
|
17
|
+
id: generateItemId(item, index),
|
|
18
|
+
header: item.header ?? item.title ?? ""
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
var Accordion = ({
|
|
22
|
+
items,
|
|
23
|
+
multiple = false,
|
|
24
|
+
defaultOpenItems,
|
|
25
|
+
defaultOpen,
|
|
26
|
+
openItems: controlledOpenItems,
|
|
27
|
+
onItemToggle,
|
|
28
|
+
className,
|
|
29
|
+
toggleEvent,
|
|
30
|
+
surface = "auto",
|
|
31
|
+
...rest
|
|
32
|
+
}) => {
|
|
33
|
+
const contentSurface = useContentSurface(surface);
|
|
34
|
+
const eventBus = useEventBus();
|
|
35
|
+
const normalizedItems = items.map(
|
|
36
|
+
(item, index) => normalizeItem(item, index)
|
|
37
|
+
);
|
|
38
|
+
const resolveDefaultOpen = () => {
|
|
39
|
+
if (defaultOpenItems) return defaultOpenItems;
|
|
40
|
+
if (defaultOpen) {
|
|
41
|
+
return defaultOpen.filter((index) => index >= 0 && index < normalizedItems.length).map((index) => normalizedItems[index].id);
|
|
42
|
+
}
|
|
43
|
+
return normalizedItems.filter((item) => item.defaultOpen).map((item) => item.id);
|
|
44
|
+
};
|
|
45
|
+
const [internalOpenItems, setInternalOpenItems] = useState(
|
|
46
|
+
new Set(resolveDefaultOpen())
|
|
47
|
+
);
|
|
48
|
+
const openItemsSet = controlledOpenItems ? new Set(controlledOpenItems) : internalOpenItems;
|
|
49
|
+
const handleToggle = (itemId) => {
|
|
50
|
+
const isOpen = openItemsSet.has(itemId);
|
|
51
|
+
const newOpenItems = new Set(openItemsSet);
|
|
52
|
+
if (isOpen) {
|
|
53
|
+
newOpenItems.delete(itemId);
|
|
54
|
+
} else {
|
|
55
|
+
if (!multiple) {
|
|
56
|
+
newOpenItems.clear();
|
|
57
|
+
}
|
|
58
|
+
newOpenItems.add(itemId);
|
|
59
|
+
}
|
|
60
|
+
if (controlledOpenItems === void 0) {
|
|
61
|
+
setInternalOpenItems(newOpenItems);
|
|
62
|
+
}
|
|
63
|
+
onItemToggle?.(itemId, !isOpen);
|
|
64
|
+
if (toggleEvent) eventBus.emit(`UI:${toggleEvent}`, { itemId, isOpen: !isOpen });
|
|
65
|
+
};
|
|
66
|
+
return contentSurface.provide(
|
|
67
|
+
/* @__PURE__ */ jsx(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
...domPassthrough(rest),
|
|
71
|
+
className: cn("w-full divide-y divide-border", contentSurface.className && cn(contentSurface.className, "overflow-hidden"), className),
|
|
72
|
+
children: normalizedItems.map((item) => {
|
|
73
|
+
const isOpen = openItemsSet.has(item.id);
|
|
74
|
+
const isDisabled = item.disabled;
|
|
75
|
+
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { className: "overflow-hidden", children: [
|
|
76
|
+
/* @__PURE__ */ jsxs(
|
|
77
|
+
"button",
|
|
78
|
+
{
|
|
79
|
+
type: "button",
|
|
80
|
+
onClick: () => !isDisabled && handleToggle(item.id),
|
|
81
|
+
disabled: isDisabled,
|
|
82
|
+
className: cn(
|
|
83
|
+
"w-full flex items-center justify-between px-4 py-3",
|
|
84
|
+
"hover:bg-muted",
|
|
85
|
+
"transition-colors duration-fast",
|
|
86
|
+
"focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",
|
|
87
|
+
"disabled:opacity-50 disabled:cursor-not-allowed",
|
|
88
|
+
isOpen && "bg-muted font-bold"
|
|
89
|
+
),
|
|
90
|
+
"aria-expanded": isOpen,
|
|
91
|
+
"aria-controls": `accordion-content-${item.id}`,
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 text-left", children: typeof item.header === "string" ? /* @__PURE__ */ jsx(Typography, { variant: "body", weight: "medium", children: item.header }) : item.header }),
|
|
94
|
+
/* @__PURE__ */ jsx(
|
|
95
|
+
Icon,
|
|
96
|
+
{
|
|
97
|
+
name: "chevron-down",
|
|
98
|
+
size: "sm",
|
|
99
|
+
className: cn(
|
|
100
|
+
"transition-transform duration-fast",
|
|
101
|
+
isOpen && "transform rotate-180"
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
),
|
|
108
|
+
isOpen && /* @__PURE__ */ jsx(
|
|
109
|
+
"div",
|
|
110
|
+
{
|
|
111
|
+
id: `accordion-content-${item.id}`,
|
|
112
|
+
className: "px-4 py-3 border-t-heavy border-border",
|
|
113
|
+
children: item.content
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
] }) }, item.id);
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
);
|
|
121
|
+
};
|
|
122
|
+
Accordion.displayName = "Accordion";
|
|
123
|
+
|
|
124
|
+
// src/lib/avl-play.ts
|
|
125
|
+
function armsOf(trait, from, event) {
|
|
126
|
+
return trait.transitions.filter((t) => t.from === from && t.event === event);
|
|
127
|
+
}
|
|
128
|
+
function armPosition(trait, transition) {
|
|
129
|
+
return armsOf(trait, transition.from, transition.event).findIndex((t) => t.index === transition.index);
|
|
130
|
+
}
|
|
131
|
+
function firedTransition(trait, step) {
|
|
132
|
+
if (step.result.firedArm === void 0 || !step.result.transitionFired) return void 0;
|
|
133
|
+
return armsOf(trait, step.from, step.result.event)[step.result.firedArm];
|
|
134
|
+
}
|
|
135
|
+
var ofTrait = (steps, orbital, trait) => steps.filter((s) => s.orbital === orbital && s.trait === trait);
|
|
136
|
+
function stateMachinePlayback(trait, orbital, steps, cursor) {
|
|
137
|
+
const played = ofTrait(steps.slice(0, cursor + 1), orbital, trait.name);
|
|
138
|
+
const visitedStates = [];
|
|
139
|
+
for (const step of played) {
|
|
140
|
+
for (const state of [step.result.state.before, step.result.state.after]) {
|
|
141
|
+
if (state !== null && visitedStates[visitedStates.length - 1] !== state) visitedStates.push(state);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const last = played[played.length - 1];
|
|
145
|
+
if (!last) return { visitedStates };
|
|
146
|
+
return {
|
|
147
|
+
activeState: last.result.state.after ?? last.result.state.before ?? void 0,
|
|
148
|
+
activeTransition: firedTransition(trait, last)?.index,
|
|
149
|
+
visitedStates
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function tracedTransition(trait, trace) {
|
|
153
|
+
const arms = armsOf(trait, trace.from, trace.event);
|
|
154
|
+
const arm = trace.firedArm;
|
|
155
|
+
if (arm !== void 0) return arms[arm];
|
|
156
|
+
const entering = arms.filter((t) => t.to === trace.to);
|
|
157
|
+
return entering.length === 1 ? entering[0] : void 0;
|
|
158
|
+
}
|
|
159
|
+
function tracePlayback(trait, traces) {
|
|
160
|
+
const hops = traces.filter((t) => t.traitName === trait.name);
|
|
161
|
+
const visitedStates = [];
|
|
162
|
+
for (const hop of hops) {
|
|
163
|
+
for (const state of [hop.from, hop.to]) {
|
|
164
|
+
if (visitedStates[visitedStates.length - 1] !== state) visitedStates.push(state);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
const last = hops[hops.length - 1];
|
|
168
|
+
if (!last) return { visitedStates };
|
|
169
|
+
return { activeState: last.to, activeTransition: tracedTransition(trait, last)?.index, visitedStates };
|
|
170
|
+
}
|
|
171
|
+
function describedTransitionLines(description, running, transition) {
|
|
172
|
+
const printed = traitLevelFromDescription(description);
|
|
173
|
+
if (!printed || !description.source) return void 0;
|
|
174
|
+
const match = armsOf(printed, transition.from, transition.event)[armPosition(running, transition)];
|
|
175
|
+
const lines = match ? description.source.transitions.find((l) => l.index === match.index) : void 0;
|
|
176
|
+
return lines ? { start: lines.start, end: lines.end } : void 0;
|
|
177
|
+
}
|
|
178
|
+
function transitionPlayback(trait, orbital, transition, steps, cursor) {
|
|
179
|
+
const arm = armPosition(trait, transition);
|
|
180
|
+
const played = ofTrait(steps.slice(0, cursor + 1), orbital, trait.name);
|
|
181
|
+
for (let i = played.length - 1; i >= 0; i--) {
|
|
182
|
+
const step = played[i];
|
|
183
|
+
if (step.from !== transition.from || step.result.event !== transition.event) continue;
|
|
184
|
+
const fired = step.result.transitionFired && step.result.firedArm === arm;
|
|
185
|
+
const guard = step.result.guards?.find((g) => g.arm === arm);
|
|
186
|
+
if (fired || guard) return { step, fired, ...guard ? { guard } : {}, effects: fired ? step.result.effects : [] };
|
|
187
|
+
}
|
|
188
|
+
return void 0;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export { Accordion, armPosition, armsOf, describedTransitionLines, firedTransition, stateMachinePlayback, tracePlayback, transitionPlayback };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/types/slot-host.ts
|
|
2
|
+
function assertUniqueSlotsPerHost(manifest) {
|
|
3
|
+
const seenBySlot = /* @__PURE__ */ new Map();
|
|
4
|
+
for (const [regionId, region] of Object.entries(manifest.regions)) {
|
|
5
|
+
const existingRegionId = seenBySlot.get(region.slot);
|
|
6
|
+
if (existingRegionId !== void 0) {
|
|
7
|
+
throw new Error(
|
|
8
|
+
`assertUniqueSlotsPerHost: regions "${existingRegionId}" and "${regionId}" both bind slot "${region.slot}" \u2014 a slot may be mounted by only one region per host.`
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
seenBySlot.set(region.slot, regionId);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { assertUniqueSlotsPerHost };
|