@almadar/shell-web 0.0.0-stage → 1.0.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-CO_iASBn.d.ts +195 -0
- package/dist/AvlGlyph-EPJKFEO3.js +6 -0
- package/dist/AvlStateMachine-RKZIKNGC.js +9 -0
- package/dist/AvlTransitionDetail-63SD6GZF.js +11 -0
- package/dist/AvlTransitionExplainer-ZBTLOM3T.js +12 -0
- package/dist/BehaviorView-YS5G4GNB.js +11 -0
- package/dist/Canvas3DHost-BkZQB5l2.d.ts +552 -0
- package/dist/EventBusProvider-BFFHfN4O.d.ts +296 -0
- package/dist/FileTree-BCFnBEuQ.d.ts +254 -0
- package/dist/FlowCanvas-3JRMNJLV.css +1756 -0
- package/dist/FlowCanvas-AUMTWMNG.js +26 -0
- package/dist/GameAudioProvider-ceM_n0ey.d.ts +90 -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-CcxGYtlr.d.ts +33 -0
- package/dist/LayersPanel-M2LHWUFF.js +6 -0
- package/dist/ModuleCard-QHDGK5XK.js +7 -0
- package/dist/OrbInspector-MHLJ6OEE.css +1756 -0
- package/dist/OrbInspector-QCPEPUPH.js +26 -0
- package/dist/Select-B-iDdnvE.d.ts +185 -0
- package/dist/ServerBridge-Bqsj-lOU.d.ts +124 -0
- package/dist/ThemeContext-DJmO59xd.d.ts +147 -0
- package/dist/UISlotContext-Dl_ewwCI.d.ts +79 -0
- package/dist/UISlotRenderer-C7WWOK43.js +26 -0
- package/dist/UISlotRenderer-KVFO6J7R.css +1756 -0
- package/dist/auth/browser/index.d.ts +2 -0
- package/dist/auth/browser/index.js +2 -0
- package/dist/auth/react/index.d.ts +56 -0
- package/dist/auth/react/index.js +157 -0
- package/dist/avl/index.css +1756 -0
- package/dist/avl/index.d.ts +2248 -0
- package/dist/avl/index.js +2693 -0
- package/dist/avl-3d-context-BycmO6tG.d.ts +201 -0
- package/dist/avl-schema-parser-CtJxJ9KU.d.ts +132 -0
- package/dist/avl-zoom-state-CKMVuBFg.d.ts +17 -0
- package/dist/chunk-3BBUBJFF.js +339 -0
- package/dist/chunk-3S54FWRC.js +131 -0
- package/dist/chunk-3VZ36ZKO.js +775 -0
- package/dist/chunk-4T3P43NS.js +1133 -0
- package/dist/chunk-4YXBKHHM.js +11488 -0
- package/dist/chunk-57DC34LY.js +525 -0
- package/dist/chunk-5QTYQTPS.js +15 -0
- package/dist/chunk-A2LR6VQQ.js +349 -0
- package/dist/chunk-AB3X7QTE.js +505 -0
- package/dist/chunk-AE7VCQB6.js +561 -0
- package/dist/chunk-AGXD77SL.js +98 -0
- package/dist/chunk-AU7O65OX.js +66 -0
- package/dist/chunk-CPLN6NBQ.js +701 -0
- package/dist/chunk-DZBQA2OW.js +176 -0
- package/dist/chunk-E6KA4J6N.js +227 -0
- package/dist/chunk-EOWMARUB.js +16 -0
- package/dist/chunk-G7DCAZ22.js +19 -0
- package/dist/chunk-GFXCPUMX.js +1334 -0
- package/dist/chunk-HH5KSMH5.js +311 -0
- package/dist/chunk-ILQXJ2AR.js +280 -0
- package/dist/chunk-ILZ7ORX7.js +432 -0
- package/dist/chunk-K4MOPSEL.js +674 -0
- package/dist/chunk-LHP2TK7O.js +47587 -0
- package/dist/chunk-P4ZFUQFF.js +93 -0
- package/dist/chunk-PCR37T3U.js +296 -0
- package/dist/chunk-PRXQGGCO.js +580 -0
- package/dist/chunk-REXYVBUO.js +191 -0
- package/dist/chunk-ROICKAU7.js +24 -0
- package/dist/chunk-SP5CDJ6K.js +338 -0
- package/dist/chunk-TUPZWTRE.js +1051 -0
- package/dist/chunk-TXAUOLWZ.js +490 -0
- package/dist/chunk-TZZBINQY.js +82 -0
- package/dist/chunk-UTDC2NEA.js +14 -0
- package/dist/chunk-UU57VNS2.js +1053 -0
- package/dist/chunk-UXLE3IPR.js +421 -0
- package/dist/chunk-VO2TTLS5.js +94 -0
- package/dist/chunk-X3DMMX27.js +11 -0
- package/dist/chunk-YHMRX6YA.js +455 -0
- package/dist/components/index.css +1756 -0
- package/dist/components/index.d.ts +11299 -0
- package/dist/components/index.js +1110 -0
- package/dist/context/index.d.ts +8 -0
- package/dist/context/index.js +8 -0
- package/dist/core.d.ts +2599 -0
- package/dist/core.js +3 -0
- package/dist/design-classes/index.cjs +431 -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 +399 -0
- package/dist/emojiItems-QGSNAABW.js +20 -0
- package/dist/fx-CmQjnHmT.d.ts +371 -0
- package/dist/hooks/index.d.ts +971 -0
- package/dist/hooks/index.js +8 -0
- package/dist/index.d.ts +408 -0
- package/dist/index.js +178 -0
- package/dist/katexPlugin-FA7NX4PE.css +1161 -0
- package/dist/katexPlugin-NCDKOOQY.js +2 -0
- package/dist/kernel-client-TZKGHJRY.js +516 -0
- package/dist/kernel-wire-wNdAPfhJ.d.ts +88 -0
- package/dist/lib/index.d.ts +602 -0
- package/dist/lib/index.js +1289 -0
- package/dist/paintDispatch-CuJLsr9Y.d.ts +688 -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-X5YWKXO5.js +136 -0
- package/dist/providers/index.css +1756 -0
- package/dist/providers/index.d.ts +355 -0
- package/dist/providers/index.js +29 -0
- package/dist/renderer/index.d.ts +465 -0
- package/dist/renderer/index.js +4 -0
- package/dist/runtime/index.css +1756 -0
- package/dist/runtime/index.d.ts +239 -0
- package/dist/runtime/index.js +28 -0
- package/dist/slot-host-CPzrxLo9.d.ts +48 -0
- package/dist/ssr/index.cjs +9739 -0
- package/dist/ssr/index.d.cts +464 -0
- package/dist/ssr/index.d.ts +464 -0
- package/dist/ssr/index.js +9703 -0
- package/dist/storage/browser/index.d.ts +1 -0
- package/dist/storage/browser/index.js +2 -0
- package/dist/test-support.d.ts +42 -0
- package/dist/test-support.js +181 -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 +3908 -0
- package/dist/useUISlots-CiobNFGb.d.ts +211 -0
- package/dist/verification-C5pTeMJv.d.ts +66 -0
- package/dist/verificationRegistry-CVrcxG1s.d.ts +122 -0
- package/dist/wrapCallbackForEvent-B9QLbhxX.d.ts +19 -0
- package/index.css +199 -0
- package/package.json +273 -3
- package/src/core/lib/band-shapes.json +7 -0
- package/src/core/locales/ar.json +1276 -0
- package/src/core/locales/en.json +1276 -0
- package/src/core/locales/index.ts +54 -0
- package/src/core/locales/sl.json +1276 -0
- package/src/core/tokens/native-tokens.json +369 -0
- package/tailwind-compile.cjs +29 -0
- package/tailwind-preset.cjs +1020 -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,561 @@
|
|
|
1
|
+
import { resolveThemeForRuntime, themeTokensToCssVars } from './chunk-3BBUBJFF.js';
|
|
2
|
+
import { useUISlotManager } from './chunk-YHMRX6YA.js';
|
|
3
|
+
import { useThemeScope, useTheme, keyInViewerMode, ThemeScopeContext, Box, cn } from './chunk-4YXBKHHM.js';
|
|
4
|
+
import { createContext, useMemo, useContext, useCallback, useEffect } from 'react';
|
|
5
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
6
|
+
import { ANONYMOUS_USER, isThemeRegistryKey, toPayloadValue } from '@almadar/core';
|
|
7
|
+
export { ANONYMOUS_USER } from '@almadar/core';
|
|
8
|
+
import { createLogger } from '@almadar/logger';
|
|
9
|
+
|
|
10
|
+
var UISlotContext = createContext(null);
|
|
11
|
+
function UISlotProvider({ children }) {
|
|
12
|
+
const slotManager = useUISlotManager();
|
|
13
|
+
const contextValue = useMemo(() => slotManager, [slotManager]);
|
|
14
|
+
return /* @__PURE__ */ jsx(UISlotContext.Provider, { value: contextValue, children });
|
|
15
|
+
}
|
|
16
|
+
function useUISlots() {
|
|
17
|
+
const context = useContext(UISlotContext);
|
|
18
|
+
if (!context) {
|
|
19
|
+
throw new Error(
|
|
20
|
+
"useUISlots must be used within a UISlotProvider. Make sure your component tree is wrapped with <UISlotProvider>."
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
return context;
|
|
24
|
+
}
|
|
25
|
+
function useSlotContent(slot) {
|
|
26
|
+
const { getContent } = useUISlots();
|
|
27
|
+
return getContent(slot);
|
|
28
|
+
}
|
|
29
|
+
function useSlotHasContent(slot) {
|
|
30
|
+
const { hasContent } = useUISlots();
|
|
31
|
+
return hasContent(slot);
|
|
32
|
+
}
|
|
33
|
+
var CurrentPagePathContext = createContext(void 0);
|
|
34
|
+
var CurrentPagePathProvider = ({
|
|
35
|
+
value,
|
|
36
|
+
children
|
|
37
|
+
}) => /* @__PURE__ */ jsx(CurrentPagePathContext.Provider, { value, children });
|
|
38
|
+
CurrentPagePathProvider.displayName = "CurrentPagePathProvider";
|
|
39
|
+
var useCurrentPagePath = () => useContext(CurrentPagePathContext);
|
|
40
|
+
var UserContext = createContext(null);
|
|
41
|
+
function UserProvider({
|
|
42
|
+
user = null,
|
|
43
|
+
children
|
|
44
|
+
}) {
|
|
45
|
+
const hasRole = useCallback(
|
|
46
|
+
(role) => {
|
|
47
|
+
if (!user) return role === "anonymous";
|
|
48
|
+
return user.role === role;
|
|
49
|
+
},
|
|
50
|
+
[user]
|
|
51
|
+
);
|
|
52
|
+
const hasPermission = useCallback(
|
|
53
|
+
(permission) => {
|
|
54
|
+
if (!user) return false;
|
|
55
|
+
return user.permissions?.includes(permission) ?? false;
|
|
56
|
+
},
|
|
57
|
+
[user]
|
|
58
|
+
);
|
|
59
|
+
const hasAnyRole = useCallback(
|
|
60
|
+
(roles) => {
|
|
61
|
+
if (!user) return roles.includes("anonymous");
|
|
62
|
+
return user.role ? roles.includes(user.role) : false;
|
|
63
|
+
},
|
|
64
|
+
[user]
|
|
65
|
+
);
|
|
66
|
+
const hasAllPermissions = useCallback(
|
|
67
|
+
(permissions) => {
|
|
68
|
+
if (!user || !user.permissions) return false;
|
|
69
|
+
return permissions.every((p) => user.permissions?.includes(p));
|
|
70
|
+
},
|
|
71
|
+
[user]
|
|
72
|
+
);
|
|
73
|
+
const getUserField = useCallback(
|
|
74
|
+
(path) => {
|
|
75
|
+
const viewer = user ?? ANONYMOUS_USER;
|
|
76
|
+
const [first, ...rest] = path.split(".");
|
|
77
|
+
if (!first) return void 0;
|
|
78
|
+
let value = viewer[first];
|
|
79
|
+
for (const segment of rest) {
|
|
80
|
+
if (value === null || typeof value !== "object" || Array.isArray(value) || value instanceof Date) {
|
|
81
|
+
return void 0;
|
|
82
|
+
}
|
|
83
|
+
value = value[segment];
|
|
84
|
+
}
|
|
85
|
+
return value;
|
|
86
|
+
},
|
|
87
|
+
[user]
|
|
88
|
+
);
|
|
89
|
+
const contextValue = useMemo(
|
|
90
|
+
() => ({
|
|
91
|
+
user,
|
|
92
|
+
isLoggedIn: user !== null,
|
|
93
|
+
hasRole,
|
|
94
|
+
hasPermission,
|
|
95
|
+
hasAnyRole,
|
|
96
|
+
hasAllPermissions,
|
|
97
|
+
getUserField
|
|
98
|
+
}),
|
|
99
|
+
[user, hasRole, hasPermission, hasAnyRole, hasAllPermissions, getUserField]
|
|
100
|
+
);
|
|
101
|
+
return /* @__PURE__ */ jsx(UserContext.Provider, { value: contextValue, children });
|
|
102
|
+
}
|
|
103
|
+
function useUser() {
|
|
104
|
+
const context = useContext(UserContext);
|
|
105
|
+
if (!context) {
|
|
106
|
+
return {
|
|
107
|
+
user: null,
|
|
108
|
+
isLoggedIn: false,
|
|
109
|
+
hasRole: (role) => role === "anonymous",
|
|
110
|
+
hasPermission: () => false,
|
|
111
|
+
hasAnyRole: (roles) => roles.includes("anonymous"),
|
|
112
|
+
hasAllPermissions: () => false,
|
|
113
|
+
getUserField: () => void 0
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
return context;
|
|
117
|
+
}
|
|
118
|
+
function useHasRole(role) {
|
|
119
|
+
const { hasRole } = useUser();
|
|
120
|
+
return hasRole(role);
|
|
121
|
+
}
|
|
122
|
+
function useHasPermission(permission) {
|
|
123
|
+
const { hasPermission } = useUser();
|
|
124
|
+
return hasPermission(permission);
|
|
125
|
+
}
|
|
126
|
+
function useUserForEvaluation() {
|
|
127
|
+
const { user, isLoggedIn } = useUser();
|
|
128
|
+
return isLoggedIn && user ? user : void 0;
|
|
129
|
+
}
|
|
130
|
+
var DESIGN_COLOR_TOKENS = [
|
|
131
|
+
"primary",
|
|
132
|
+
"primary-foreground",
|
|
133
|
+
"primary-hover",
|
|
134
|
+
"secondary",
|
|
135
|
+
"secondary-foreground",
|
|
136
|
+
"secondary-hover",
|
|
137
|
+
"muted",
|
|
138
|
+
"muted-foreground",
|
|
139
|
+
"accent",
|
|
140
|
+
"accent-foreground",
|
|
141
|
+
"background",
|
|
142
|
+
"foreground",
|
|
143
|
+
"card",
|
|
144
|
+
"card-foreground",
|
|
145
|
+
"surface",
|
|
146
|
+
"border",
|
|
147
|
+
"input",
|
|
148
|
+
"ring",
|
|
149
|
+
"error",
|
|
150
|
+
"error-foreground",
|
|
151
|
+
"success",
|
|
152
|
+
"success-foreground",
|
|
153
|
+
"warning",
|
|
154
|
+
"warning-foreground",
|
|
155
|
+
"info",
|
|
156
|
+
"info-foreground"
|
|
157
|
+
];
|
|
158
|
+
var DESIGN_COLOR_UTILITIES = ["bg", "text", "border"];
|
|
159
|
+
var DESIGN_RADIUS_TOKENS = ["none", "sm", "md", "lg", "xl", "full"];
|
|
160
|
+
var DESIGN_SPACING_SCALE = [
|
|
161
|
+
0,
|
|
162
|
+
0.5,
|
|
163
|
+
1,
|
|
164
|
+
1.5,
|
|
165
|
+
2,
|
|
166
|
+
2.5,
|
|
167
|
+
3,
|
|
168
|
+
3.5,
|
|
169
|
+
4,
|
|
170
|
+
5,
|
|
171
|
+
6,
|
|
172
|
+
7,
|
|
173
|
+
8,
|
|
174
|
+
9,
|
|
175
|
+
10,
|
|
176
|
+
11,
|
|
177
|
+
12,
|
|
178
|
+
14,
|
|
179
|
+
16,
|
|
180
|
+
20,
|
|
181
|
+
24,
|
|
182
|
+
28,
|
|
183
|
+
32,
|
|
184
|
+
36,
|
|
185
|
+
40,
|
|
186
|
+
44,
|
|
187
|
+
48,
|
|
188
|
+
52,
|
|
189
|
+
56,
|
|
190
|
+
60,
|
|
191
|
+
64,
|
|
192
|
+
72,
|
|
193
|
+
80,
|
|
194
|
+
96
|
|
195
|
+
];
|
|
196
|
+
var DESIGN_SPACING_UTILITIES = [
|
|
197
|
+
"w",
|
|
198
|
+
"h",
|
|
199
|
+
"min-w",
|
|
200
|
+
"max-w",
|
|
201
|
+
"min-h",
|
|
202
|
+
"max-h",
|
|
203
|
+
"p",
|
|
204
|
+
"px",
|
|
205
|
+
"py",
|
|
206
|
+
"pt",
|
|
207
|
+
"pr",
|
|
208
|
+
"pb",
|
|
209
|
+
"pl",
|
|
210
|
+
"m",
|
|
211
|
+
"mx",
|
|
212
|
+
"my",
|
|
213
|
+
"gap"
|
|
214
|
+
];
|
|
215
|
+
var DESIGN_SPACING_STEP_PX = 4;
|
|
216
|
+
var defaultSpacingStepPx = (step) => step * DESIGN_SPACING_STEP_PX;
|
|
217
|
+
var DESIGN_SPACING_TOKEN_STEPS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
|
218
|
+
function spacingTokenOf(step) {
|
|
219
|
+
return DESIGN_SPACING_TOKEN_STEPS.includes(step) ? `--space-${step}` : null;
|
|
220
|
+
}
|
|
221
|
+
function snapToSpacingStep(px, pxOf = defaultSpacingStepPx) {
|
|
222
|
+
const target = Math.max(0, px);
|
|
223
|
+
let best = DESIGN_SPACING_SCALE[0];
|
|
224
|
+
for (const step of DESIGN_SPACING_SCALE) {
|
|
225
|
+
const d = Math.abs(pxOf(step) - target);
|
|
226
|
+
const bestD = Math.abs(pxOf(best) - target);
|
|
227
|
+
if (d < bestD || d === bestD && spacingTokenOf(step) !== null && spacingTokenOf(best) === null) best = step;
|
|
228
|
+
}
|
|
229
|
+
return best;
|
|
230
|
+
}
|
|
231
|
+
var SPACING_STEP_BY_TEXT = new Map(
|
|
232
|
+
DESIGN_SPACING_SCALE.map((step) => [String(step), step])
|
|
233
|
+
);
|
|
234
|
+
function stepOf(className, utility) {
|
|
235
|
+
if (!className.startsWith(`${utility}-`)) return void 0;
|
|
236
|
+
return SPACING_STEP_BY_TEXT.get(className.slice(utility.length + 1));
|
|
237
|
+
}
|
|
238
|
+
function isAxisSizeClass(className, axis) {
|
|
239
|
+
return className.startsWith(`${axis}-`);
|
|
240
|
+
}
|
|
241
|
+
function sizingOf(classes, axis) {
|
|
242
|
+
for (const c of classes) {
|
|
243
|
+
if (c === `${axis}-full`) return { mode: "fill" };
|
|
244
|
+
if (c === `${axis}-fit`) return { mode: "hug" };
|
|
245
|
+
const step = stepOf(c, axis);
|
|
246
|
+
if (step !== void 0) return { mode: "fixed", step };
|
|
247
|
+
}
|
|
248
|
+
return { mode: "hug" };
|
|
249
|
+
}
|
|
250
|
+
function withSizing(classes, axis, sizing) {
|
|
251
|
+
const kept = classes.filter((c) => !isAxisSizeClass(c, axis));
|
|
252
|
+
const next = sizing.mode === "fixed" ? `${axis}-${sizing.step}` : sizing.mode === "hug" ? `${axis}-fit` : `${axis}-full`;
|
|
253
|
+
return [...kept, next];
|
|
254
|
+
}
|
|
255
|
+
function sizeLimitOf(classes, axis, limit) {
|
|
256
|
+
for (const c of classes) {
|
|
257
|
+
const step = stepOf(c, `${limit}-${axis}`);
|
|
258
|
+
if (step !== void 0) return step;
|
|
259
|
+
}
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
function withSizeLimit(classes, axis, limit, step) {
|
|
263
|
+
const kept = classes.filter((c) => !c.startsWith(`${limit}-${axis}-`));
|
|
264
|
+
return step === null ? kept : [...kept, `${limit}-${axis}-${step}`];
|
|
265
|
+
}
|
|
266
|
+
var PADDING_UTILITIES = ["p", "px", "py", "pt", "pr", "pb", "pl"];
|
|
267
|
+
function isSpacingClass(className) {
|
|
268
|
+
return stepOf(className, "gap") !== void 0 || PADDING_UTILITIES.some((u) => stepOf(className, u) !== void 0);
|
|
269
|
+
}
|
|
270
|
+
function spacingOf(classes) {
|
|
271
|
+
const find = (utility) => {
|
|
272
|
+
for (const c of classes) {
|
|
273
|
+
const step = stepOf(c, utility);
|
|
274
|
+
if (step !== void 0) return step;
|
|
275
|
+
}
|
|
276
|
+
return void 0;
|
|
277
|
+
};
|
|
278
|
+
const all = find("p") ?? 0;
|
|
279
|
+
const x = find("px") ?? all;
|
|
280
|
+
const y = find("py") ?? all;
|
|
281
|
+
return {
|
|
282
|
+
gap: find("gap") ?? 0,
|
|
283
|
+
top: find("pt") ?? y,
|
|
284
|
+
right: find("pr") ?? x,
|
|
285
|
+
bottom: find("pb") ?? y,
|
|
286
|
+
left: find("pl") ?? x
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
function withSpacing(classes, change) {
|
|
290
|
+
const next = { ...spacingOf(classes), ...change };
|
|
291
|
+
const kept = classes.filter((c) => !isSpacingClass(c));
|
|
292
|
+
const out = [...kept];
|
|
293
|
+
if (next.gap !== 0) out.push(`gap-${next.gap}`);
|
|
294
|
+
const { top, right, bottom, left } = next;
|
|
295
|
+
if (top === right && right === bottom && bottom === left) {
|
|
296
|
+
if (top !== 0) out.push(`p-${top}`);
|
|
297
|
+
} else if (top === bottom && left === right) {
|
|
298
|
+
out.push(`px-${left}`, `py-${top}`);
|
|
299
|
+
} else {
|
|
300
|
+
out.push(`pt-${top}`, `pr-${right}`, `pb-${bottom}`, `pl-${left}`);
|
|
301
|
+
}
|
|
302
|
+
return out;
|
|
303
|
+
}
|
|
304
|
+
var DIRECTION_CLASSES = ["flex-row", "flex-row-reverse", "flex-col", "flex-col-reverse"];
|
|
305
|
+
var ALIGNMENTS = ["start", "center", "end"];
|
|
306
|
+
var JUSTIFIES = [...ALIGNMENTS, "between"];
|
|
307
|
+
var WRAP_CLASSES = ["flex-wrap", "flex-nowrap", "flex-wrap-reverse"];
|
|
308
|
+
function firstOf(classes, utility, values) {
|
|
309
|
+
for (const c of classes) {
|
|
310
|
+
for (const v of values) if (c === `${utility}-${v}`) return v;
|
|
311
|
+
}
|
|
312
|
+
return null;
|
|
313
|
+
}
|
|
314
|
+
function layoutOf(classes) {
|
|
315
|
+
const direction = classes.find((c) => DIRECTION_CLASSES.includes(c));
|
|
316
|
+
return {
|
|
317
|
+
direction: direction === void 0 ? null : direction.startsWith("flex-row") ? "horizontal" : "vertical",
|
|
318
|
+
align: firstOf(classes, "items", ALIGNMENTS),
|
|
319
|
+
justify: firstOf(classes, "justify", JUSTIFIES),
|
|
320
|
+
wrap: classes.includes("flex-wrap")
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
function withLayout(classes, change) {
|
|
324
|
+
let next = [...classes];
|
|
325
|
+
if (change.direction) {
|
|
326
|
+
next = next.filter((c) => !DIRECTION_CLASSES.includes(c));
|
|
327
|
+
next.push(change.direction === "horizontal" ? "flex-row" : "flex-col");
|
|
328
|
+
}
|
|
329
|
+
if (change.align) {
|
|
330
|
+
next = next.filter((c) => !c.startsWith("items-"));
|
|
331
|
+
next.push(`items-${change.align}`);
|
|
332
|
+
}
|
|
333
|
+
if (change.justify) {
|
|
334
|
+
next = next.filter((c) => !c.startsWith("justify-"));
|
|
335
|
+
next.push(`justify-${change.justify}`);
|
|
336
|
+
}
|
|
337
|
+
if (change.wrap !== void 0) {
|
|
338
|
+
next = next.filter((c) => !WRAP_CLASSES.includes(c));
|
|
339
|
+
if (change.wrap) next.push("flex-wrap");
|
|
340
|
+
}
|
|
341
|
+
return next;
|
|
342
|
+
}
|
|
343
|
+
var AXIS_SIDES = { x: ["left", "right"], y: ["top", "bottom"] };
|
|
344
|
+
var CENTER_CLASSES = { x: ["left-1/2", "-translate-x-1/2"], y: ["top-1/2", "-translate-y-1/2"] };
|
|
345
|
+
function offsetOf(classes, side) {
|
|
346
|
+
for (const c of classes) {
|
|
347
|
+
if (!c.startsWith(`${side}-`)) continue;
|
|
348
|
+
const step = stepOf(c, side);
|
|
349
|
+
if (step !== void 0) return { value: defaultSpacingStepPx(step), unit: "px" };
|
|
350
|
+
const m = /^\[(-?\d+(?:\.\d+)?)(px|%)\]$/.exec(c.slice(side.length + 1));
|
|
351
|
+
if (m) return { value: Number(m[1]), unit: m[2] === "%" ? "%" : "px" };
|
|
352
|
+
}
|
|
353
|
+
return null;
|
|
354
|
+
}
|
|
355
|
+
function centerOffsetOf(classes, side) {
|
|
356
|
+
for (const c of classes) {
|
|
357
|
+
if (c === `${side}-1/2`) return 0;
|
|
358
|
+
const m = new RegExp(`^${side}-\\[calc\\(50%([+-])(\\d+(?:\\.\\d+)?)px\\)\\]$`).exec(c);
|
|
359
|
+
if (m) return (m[1] === "-" ? -1 : 1) * Number(m[2]);
|
|
360
|
+
}
|
|
361
|
+
return null;
|
|
362
|
+
}
|
|
363
|
+
function axisPositionOf(classes, axis) {
|
|
364
|
+
const [startSide, endSide] = AXIS_SIDES[axis];
|
|
365
|
+
const center = centerOffsetOf(classes, startSide);
|
|
366
|
+
if (center !== null && classes.includes(CENTER_CLASSES[axis][1])) return { constraint: "center", start: center, end: 0 };
|
|
367
|
+
const start = offsetOf(classes, startSide);
|
|
368
|
+
const end = offsetOf(classes, endSide);
|
|
369
|
+
if (start?.unit === "%" || end?.unit === "%") {
|
|
370
|
+
return { constraint: "scale", start: start?.value ?? 0, end: end?.value ?? 0 };
|
|
371
|
+
}
|
|
372
|
+
if (start && end) return { constraint: "both", start: start.value, end: end.value };
|
|
373
|
+
if (end) return { constraint: "end", start: 0, end: end.value };
|
|
374
|
+
return { constraint: "start", start: start?.value ?? 0, end: 0 };
|
|
375
|
+
}
|
|
376
|
+
function positionOf(classes) {
|
|
377
|
+
return {
|
|
378
|
+
absolute: classes.includes("absolute"),
|
|
379
|
+
x: axisPositionOf(classes, "x"),
|
|
380
|
+
y: axisPositionOf(classes, "y")
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
function isPositionClass(className) {
|
|
384
|
+
if (className === "absolute") return true;
|
|
385
|
+
if (CENTER_CLASSES.x.some((c) => c === className) || CENTER_CLASSES.y.some((c) => c === className)) return true;
|
|
386
|
+
return [...AXIS_SIDES.x, ...AXIS_SIDES.y].some((side) => className.startsWith(`${side}-`));
|
|
387
|
+
}
|
|
388
|
+
function offsetClass(side, value, unit) {
|
|
389
|
+
const rounded = unit === "%" ? Math.round(value * 10) / 10 : Math.round(value);
|
|
390
|
+
return rounded === 0 ? `${side}-0` : `${side}-[${rounded}${unit}]`;
|
|
391
|
+
}
|
|
392
|
+
function axisClasses(axis, p) {
|
|
393
|
+
const [startSide, endSide] = AXIS_SIDES[axis];
|
|
394
|
+
switch (p.constraint) {
|
|
395
|
+
case "center": {
|
|
396
|
+
const offset = Math.round(p.start);
|
|
397
|
+
const pin = offset === 0 ? CENTER_CLASSES[axis][0] : `${startSide}-[calc(50%${offset < 0 ? "-" : "+"}${Math.abs(offset)}px)]`;
|
|
398
|
+
return [pin, CENTER_CLASSES[axis][1]];
|
|
399
|
+
}
|
|
400
|
+
case "end":
|
|
401
|
+
return [offsetClass(endSide, p.end, "px")];
|
|
402
|
+
case "both":
|
|
403
|
+
return [offsetClass(startSide, p.start, "px"), offsetClass(endSide, p.end, "px")];
|
|
404
|
+
case "scale":
|
|
405
|
+
return [offsetClass(startSide, p.start, "%"), offsetClass(endSide, p.end, "%")];
|
|
406
|
+
case "start":
|
|
407
|
+
return [offsetClass(startSide, p.start, "px")];
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
function withPosition(classes, position) {
|
|
411
|
+
const kept = classes.filter((c) => !isPositionClass(c));
|
|
412
|
+
if (!position.absolute) return kept;
|
|
413
|
+
return [...kept, "absolute", ...axisClasses("x", position.x), ...axisClasses("y", position.y)];
|
|
414
|
+
}
|
|
415
|
+
var COLOR_TOKEN_SET = new Set(DESIGN_COLOR_TOKENS);
|
|
416
|
+
var RADIUS_TOKEN_SET = new Set(DESIGN_RADIUS_TOKENS);
|
|
417
|
+
function isColorToken(value) {
|
|
418
|
+
return COLOR_TOKEN_SET.has(value);
|
|
419
|
+
}
|
|
420
|
+
function isRadiusToken(value) {
|
|
421
|
+
return RADIUS_TOKEN_SET.has(value);
|
|
422
|
+
}
|
|
423
|
+
function tokenOfDesignClass(className) {
|
|
424
|
+
const base = className.slice(className.lastIndexOf(":") + 1);
|
|
425
|
+
if (base.startsWith("rounded-")) {
|
|
426
|
+
const key = base.slice("rounded-".length);
|
|
427
|
+
return isRadiusToken(key) ? { group: "radii", key } : null;
|
|
428
|
+
}
|
|
429
|
+
for (const utility of DESIGN_COLOR_UTILITIES) {
|
|
430
|
+
const prefix = `${utility}-`;
|
|
431
|
+
if (!base.startsWith(prefix)) continue;
|
|
432
|
+
const key = base.slice(prefix.length);
|
|
433
|
+
if (isColorToken(key)) return { group: "colors", key };
|
|
434
|
+
}
|
|
435
|
+
for (const utility of DESIGN_SPACING_UTILITIES) {
|
|
436
|
+
const step = stepOf(base, utility);
|
|
437
|
+
if (step !== void 0 && spacingTokenOf(step) !== null) return { group: "spacing", key: String(step) };
|
|
438
|
+
}
|
|
439
|
+
return null;
|
|
440
|
+
}
|
|
441
|
+
function isArbitraryClass(className) {
|
|
442
|
+
return /^[a-z0-9:@/-]*-\[[^\]\s]+\]$/i.test(className);
|
|
443
|
+
}
|
|
444
|
+
function collectClasses(value, found) {
|
|
445
|
+
if (Array.isArray(value)) {
|
|
446
|
+
for (const item of value) collectClasses(item, found);
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
if (value === null || typeof value !== "object") return;
|
|
450
|
+
for (const [key, child] of Object.entries(value)) {
|
|
451
|
+
if (key === "className" && typeof child === "string") {
|
|
452
|
+
for (const cls of child.split(/\s+/)) if (cls && isArbitraryClass(cls)) found.add(cls);
|
|
453
|
+
} else {
|
|
454
|
+
collectClasses(child, found);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
function classesOfPart(part) {
|
|
459
|
+
const found = /* @__PURE__ */ new Set();
|
|
460
|
+
collectClasses(toPayloadValue(part), found);
|
|
461
|
+
return [...found];
|
|
462
|
+
}
|
|
463
|
+
var classesByOrbital = /* @__PURE__ */ new WeakMap();
|
|
464
|
+
function arbitraryClassesOf(schema) {
|
|
465
|
+
const { orbitals, _metadata: _provenance, ledger: _identities, ...rest } = schema;
|
|
466
|
+
const found = new Set(classesOfPart(rest));
|
|
467
|
+
for (const orbital of orbitals ?? []) {
|
|
468
|
+
let classes = classesByOrbital.get(orbital);
|
|
469
|
+
if (!classes) {
|
|
470
|
+
classes = classesOfPart(orbital);
|
|
471
|
+
classesByOrbital.set(orbital, classes);
|
|
472
|
+
}
|
|
473
|
+
for (const cls of classes) found.add(cls);
|
|
474
|
+
}
|
|
475
|
+
return [...found].sort();
|
|
476
|
+
}
|
|
477
|
+
var log = createLogger("almadar:ui:arbitrary-classes");
|
|
478
|
+
var ARBITRARY_CLASS_STYLE_ID = "almadar-arbitrary-classes";
|
|
479
|
+
var CompilerContext = createContext(null);
|
|
480
|
+
function ArbitraryClassCompilerProvider({ compile, children }) {
|
|
481
|
+
return /* @__PURE__ */ jsx(CompilerContext.Provider, { value: compile, children });
|
|
482
|
+
}
|
|
483
|
+
var compiled = /* @__PURE__ */ new Set();
|
|
484
|
+
var pending = /* @__PURE__ */ new Set();
|
|
485
|
+
function appendCss(css) {
|
|
486
|
+
let el = document.getElementById(ARBITRARY_CLASS_STYLE_ID);
|
|
487
|
+
if (!el) {
|
|
488
|
+
el = document.createElement("style");
|
|
489
|
+
el.id = ARBITRARY_CLASS_STYLE_ID;
|
|
490
|
+
document.head.appendChild(el);
|
|
491
|
+
}
|
|
492
|
+
el.textContent = `${el.textContent ?? ""}${css}
|
|
493
|
+
`;
|
|
494
|
+
}
|
|
495
|
+
function resetArbitraryClassStyles() {
|
|
496
|
+
compiled.clear();
|
|
497
|
+
pending.clear();
|
|
498
|
+
document.getElementById(ARBITRARY_CLASS_STYLE_ID)?.remove();
|
|
499
|
+
}
|
|
500
|
+
function useArbitraryClassStyles(schema) {
|
|
501
|
+
const compile = useContext(CompilerContext);
|
|
502
|
+
const classes = useMemo(() => schema ? arbitraryClassesOf(schema) : [], [schema]);
|
|
503
|
+
useEffect(() => {
|
|
504
|
+
if (!compile) return;
|
|
505
|
+
const missing = classes.filter((c) => !compiled.has(c) && !pending.has(c));
|
|
506
|
+
if (missing.length === 0) return;
|
|
507
|
+
missing.forEach((c) => pending.add(c));
|
|
508
|
+
compile(missing).then((css) => {
|
|
509
|
+
missing.forEach((c) => {
|
|
510
|
+
pending.delete(c);
|
|
511
|
+
compiled.add(c);
|
|
512
|
+
});
|
|
513
|
+
if (css) appendCss(css);
|
|
514
|
+
}).catch((err) => {
|
|
515
|
+
missing.forEach((c) => pending.delete(c));
|
|
516
|
+
log.warn("compile:failed", { classes: missing, error: err instanceof Error ? err.message : String(err) });
|
|
517
|
+
});
|
|
518
|
+
}, [compile, classes]);
|
|
519
|
+
}
|
|
520
|
+
var SURFACE = "h-full min-h-full bg-background surface-page text-foreground";
|
|
521
|
+
function useFontImport(href) {
|
|
522
|
+
useEffect(() => {
|
|
523
|
+
if (!href || typeof document === "undefined") return;
|
|
524
|
+
const existing = Array.from(document.head.querySelectorAll("link[data-almadar-font]")).some((el) => el.getAttribute("href") === href);
|
|
525
|
+
if (existing) return;
|
|
526
|
+
const link = document.createElement("link");
|
|
527
|
+
link.rel = "stylesheet";
|
|
528
|
+
link.href = href;
|
|
529
|
+
link.setAttribute("data-almadar-font", "");
|
|
530
|
+
document.head.appendChild(link);
|
|
531
|
+
}, [href]);
|
|
532
|
+
}
|
|
533
|
+
function OrbitalThemeProvider({ theme: declared, override, children }) {
|
|
534
|
+
const parent = useThemeScope();
|
|
535
|
+
const hostOverride = override || parent.override || void 0;
|
|
536
|
+
const theme = hostOverride ?? declared;
|
|
537
|
+
const resolved = resolveThemeForRuntime(theme);
|
|
538
|
+
const { resolvedMode, availableThemes } = useTheme();
|
|
539
|
+
const darkTypeScale = resolvedMode === "dark" ? resolved?.variants?.dark?.typeScale : void 0;
|
|
540
|
+
useFontImport(darkTypeScale?.fontImport ?? resolved?.tokens.typeScale?.fontImport);
|
|
541
|
+
if (isThemeRegistryKey(theme)) {
|
|
542
|
+
const inherited = !override && parent.override ? { key: parent.override, mode: parent.mode } : void 0;
|
|
543
|
+
const { key, mode: keyMode } = inherited ?? keyInViewerMode(theme, availableThemes, resolvedMode);
|
|
544
|
+
const mode = keyMode ?? parent.mode;
|
|
545
|
+
return /* @__PURE__ */ jsx(
|
|
546
|
+
ThemeScopeContext.Provider,
|
|
547
|
+
{
|
|
548
|
+
value: hostOverride ? { ...parent, theme: key, mode, vars: void 0, override: key } : { ...parent, theme: key, mode },
|
|
549
|
+
children: /* @__PURE__ */ jsx(Box, { "data-theme": key, className: cn(SURFACE, keyMode), children })
|
|
550
|
+
}
|
|
551
|
+
);
|
|
552
|
+
}
|
|
553
|
+
if (!resolved) {
|
|
554
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
555
|
+
}
|
|
556
|
+
const vars = themeTokensToCssVars(resolved.tokens, resolvedMode, resolved.variants?.dark);
|
|
557
|
+
return /* @__PURE__ */ jsx(ThemeScopeContext.Provider, { value: { ...parent, vars: { ...parent.vars, ...vars } }, children: /* @__PURE__ */ jsx(Box, { "data-orbital-theme": resolved.name, className: SURFACE, style: vars, children }) });
|
|
558
|
+
}
|
|
559
|
+
OrbitalThemeProvider.displayName = "OrbitalThemeProvider";
|
|
560
|
+
|
|
561
|
+
export { ARBITRARY_CLASS_STYLE_ID, ArbitraryClassCompilerProvider, CurrentPagePathContext, CurrentPagePathProvider, DESIGN_COLOR_TOKENS, DESIGN_RADIUS_TOKENS, DESIGN_SPACING_SCALE, OrbitalThemeProvider, UISlotContext, UISlotProvider, UserContext, UserProvider, defaultSpacingStepPx, isArbitraryClass, layoutOf, positionOf, resetArbitraryClassStyles, sizeLimitOf, sizingOf, snapToSpacingStep, spacingOf, spacingTokenOf, tokenOfDesignClass, useArbitraryClassStyles, useCurrentPagePath, useHasPermission, useHasRole, useSlotContent, useSlotHasContent, useUISlots, useUser, useUserForEvaluation, withLayout, withPosition, withSizeLimit, withSizing, withSpacing };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { useEventBus, useTranslate, Box, VStack, Icon, cn, Typography, Button, domPassthrough } from './chunk-4YXBKHHM.js';
|
|
2
|
+
import { EMPTY_STATE_MARKER } from '@almadar/core';
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
var ICON_NAME_ALIASES = {
|
|
6
|
+
check: "check-circle",
|
|
7
|
+
error: "x-circle",
|
|
8
|
+
warning: "alert-circle"
|
|
9
|
+
};
|
|
10
|
+
var lookStyles = {
|
|
11
|
+
"icon-only": "",
|
|
12
|
+
illustrated: "[&_svg]:w-32 [&_svg]:h-32",
|
|
13
|
+
"text-only": "[&_svg]:hidden",
|
|
14
|
+
mascot: "[&_svg]:w-24 [&_svg]:h-24 [&_svg]:rounded-pill"
|
|
15
|
+
};
|
|
16
|
+
var EmptyState = ({
|
|
17
|
+
icon,
|
|
18
|
+
title,
|
|
19
|
+
message,
|
|
20
|
+
description,
|
|
21
|
+
actionLabel,
|
|
22
|
+
onAction,
|
|
23
|
+
className,
|
|
24
|
+
destructive,
|
|
25
|
+
variant,
|
|
26
|
+
actionEvent,
|
|
27
|
+
look = "icon-only",
|
|
28
|
+
...rest
|
|
29
|
+
}) => {
|
|
30
|
+
const eventBus = useEventBus();
|
|
31
|
+
const { t } = useTranslate();
|
|
32
|
+
const handleAction = () => {
|
|
33
|
+
if (actionEvent) eventBus.emit(`UI:${actionEvent}`, {});
|
|
34
|
+
onAction?.();
|
|
35
|
+
};
|
|
36
|
+
const iconName = typeof icon === "string" ? ICON_NAME_ALIASES[icon] ?? icon : void 0;
|
|
37
|
+
const iconComponent = typeof icon === "string" ? void 0 : icon;
|
|
38
|
+
const hasIcon = Boolean(iconName || iconComponent);
|
|
39
|
+
const isDestructive = destructive || variant === "error";
|
|
40
|
+
const isSuccess = variant === "success";
|
|
41
|
+
const displayText = title || message || t("empty.noItems");
|
|
42
|
+
return /* @__PURE__ */ jsx(Box, { ...domPassthrough(rest), className: "contents", ...{ [EMPTY_STATE_MARKER]: "" }, children: /* @__PURE__ */ jsxs(
|
|
43
|
+
VStack,
|
|
44
|
+
{
|
|
45
|
+
align: "center",
|
|
46
|
+
className: cn(
|
|
47
|
+
"justify-center py-12 text-center",
|
|
48
|
+
lookStyles[look],
|
|
49
|
+
className
|
|
50
|
+
),
|
|
51
|
+
children: [
|
|
52
|
+
hasIcon && /* @__PURE__ */ jsx(
|
|
53
|
+
Box,
|
|
54
|
+
{
|
|
55
|
+
className: cn(
|
|
56
|
+
"mb-4 rounded-full p-3",
|
|
57
|
+
isDestructive ? "bg-error/10" : isSuccess ? "bg-success/10" : "bg-muted"
|
|
58
|
+
),
|
|
59
|
+
children: /* @__PURE__ */ jsx(
|
|
60
|
+
Icon,
|
|
61
|
+
{
|
|
62
|
+
...iconName ? { name: iconName } : { icon: iconComponent },
|
|
63
|
+
className: cn(
|
|
64
|
+
"h-8 w-8",
|
|
65
|
+
isDestructive ? "text-error" : isSuccess ? "text-success" : "text-muted-foreground"
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ jsx(
|
|
72
|
+
Typography,
|
|
73
|
+
{
|
|
74
|
+
variant: "h3",
|
|
75
|
+
className: cn(
|
|
76
|
+
"text-lg",
|
|
77
|
+
isDestructive ? "text-error" : isSuccess ? "text-success" : "text-foreground"
|
|
78
|
+
),
|
|
79
|
+
children: displayText
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
description && /* @__PURE__ */ jsx(Typography, { variant: "small", className: "mt-1 text-muted-foreground max-w-sm", children: description }),
|
|
83
|
+
actionLabel && (onAction || actionEvent) && /* @__PURE__ */ jsx(
|
|
84
|
+
Button,
|
|
85
|
+
{
|
|
86
|
+
className: "mt-4",
|
|
87
|
+
variant: isDestructive ? "danger" : "primary",
|
|
88
|
+
onClick: handleAction,
|
|
89
|
+
children: actionLabel
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
) });
|
|
95
|
+
};
|
|
96
|
+
EmptyState.displayName = "EmptyState";
|
|
97
|
+
|
|
98
|
+
export { EmptyState };
|