@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,165 @@
|
|
|
1
|
+
import { OrbitalSchema } from '@almadar/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The Tailwind class vocabulary a visual editor may write onto a pattern's
|
|
5
|
+
* `className`. Declared once here: editors pick from it, and
|
|
6
|
+
* `@almadar/ui/tailwind-preset` safelists exactly it, so every class an
|
|
7
|
+
* editor writes is compiled into the builder and every generated app.
|
|
8
|
+
*
|
|
9
|
+
* Color and radius classes are backed by theme tokens (`bg-primary` reads
|
|
10
|
+
* `--color-primary`), so an edit can target the class (this element) or the
|
|
11
|
+
* token (every element using it). Spacing steps 0–12 read `--space-N` theme
|
|
12
|
+
* tokens (not linear: the base theme's `--space-4` is 14px); the rest are
|
|
13
|
+
* Tailwind's rem steps. What a step renders at is therefore a theme question —
|
|
14
|
+
* callers that convert pixels pass the rendered size of each step.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** Color tokens the preset maps to `--color-<token>` (`tailwind-preset.cjs` `colors`). */
|
|
18
|
+
declare const DESIGN_COLOR_TOKENS: readonly ["primary", "primary-foreground", "primary-hover", "secondary", "secondary-foreground", "secondary-hover", "muted", "muted-foreground", "accent", "accent-foreground", "background", "foreground", "card", "card-foreground", "surface", "border", "input", "ring", "error", "error-foreground", "success", "success-foreground", "warning", "warning-foreground", "info", "info-foreground"];
|
|
19
|
+
type DesignColorToken = (typeof DESIGN_COLOR_TOKENS)[number];
|
|
20
|
+
/** Utilities that take a color token. */
|
|
21
|
+
declare const DESIGN_COLOR_UTILITIES: readonly ["bg", "text", "border"];
|
|
22
|
+
type DesignColorUtility = (typeof DESIGN_COLOR_UTILITIES)[number];
|
|
23
|
+
/** Radius tokens the preset maps to `--radius-<token>` (`rounded-<token>`). */
|
|
24
|
+
declare const DESIGN_RADIUS_TOKENS: readonly ["none", "sm", "md", "lg", "xl", "full"];
|
|
25
|
+
type DesignRadiusToken = (typeof DESIGN_RADIUS_TOKENS)[number];
|
|
26
|
+
/** Tailwind's spacing scale (1 step = 0.25rem = 4px at a 16px root). */
|
|
27
|
+
declare const DESIGN_SPACING_SCALE: readonly [0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 72, 80, 96];
|
|
28
|
+
type DesignSpacingStep = (typeof DESIGN_SPACING_SCALE)[number];
|
|
29
|
+
/** Utilities that take a spacing step. */
|
|
30
|
+
declare const DESIGN_SPACING_UTILITIES: readonly ["w", "h", "min-w", "max-w", "min-h", "max-h", "p", "px", "py", "pt", "pr", "pb", "pl", "m", "mx", "my", "gap"];
|
|
31
|
+
/** Figma's non-fixed sizing modes per axis: Hug contents (`fit`) and Fill container (`full`). */
|
|
32
|
+
declare const DESIGN_SIZING_CLASSES: readonly ["w-fit", "w-full", "h-fit", "h-full"];
|
|
33
|
+
type DesignSpacingUtility = (typeof DESIGN_SPACING_UTILITIES)[number];
|
|
34
|
+
/** Figma auto layout: direction, the 3×3 alignment grid (main axis `justify`, cross axis `items`), space-between and wrap. */
|
|
35
|
+
declare const DESIGN_LAYOUT_CLASSES: readonly ["flex-row", "flex-col", "items-start", "items-center", "items-end", "justify-start", "justify-center", "justify-end", "justify-between", "flex-wrap"];
|
|
36
|
+
/** Absolute position: the element, its positioning context, and the Center constraint's class pairs. Pixel and % offsets are arbitrary values. */
|
|
37
|
+
declare const DESIGN_POSITION_CLASSES: readonly ["absolute", "relative", "left-0", "right-0", "top-0", "bottom-0", "left-1/2", "-translate-x-1/2", "top-1/2", "-translate-y-1/2"];
|
|
38
|
+
/** Pixels per spacing step at the default 16px root. */
|
|
39
|
+
declare const DESIGN_SPACING_STEP_PX = 4;
|
|
40
|
+
declare function colorClass(utility: DesignColorUtility, token: DesignColorToken): string;
|
|
41
|
+
declare function radiusClass(token: DesignRadiusToken): string;
|
|
42
|
+
declare function spacingClass(utility: DesignSpacingUtility, step: DesignSpacingStep): string;
|
|
43
|
+
/** What a spacing step renders at, in px. */
|
|
44
|
+
type SpacingStepPx = (step: DesignSpacingStep) => number;
|
|
45
|
+
/** Tailwind's default: 0.25rem per step at a 16px root. */
|
|
46
|
+
declare const defaultSpacingStepPx: SpacingStepPx;
|
|
47
|
+
/** Steps the preset maps to `--space-N` theme tokens (`tailwind-preset.cjs` `spacing`). */
|
|
48
|
+
declare const DESIGN_SPACING_TOKEN_STEPS: readonly DesignSpacingStep[];
|
|
49
|
+
/** The theme token a spacing step reads, or null for a plain rem step. */
|
|
50
|
+
declare function spacingTokenOf(step: DesignSpacingStep): `--space-${number}` | null;
|
|
51
|
+
/**
|
|
52
|
+
* The spacing step whose rendered size is nearest `px`. On a tie a
|
|
53
|
+
* token-backed step wins (it follows the theme), then the smaller step.
|
|
54
|
+
*/
|
|
55
|
+
declare function snapToSpacingStep(px: number, pxOf?: SpacingStepPx): DesignSpacingStep;
|
|
56
|
+
/** Every class in the vocabulary — the preset's safelist. */
|
|
57
|
+
declare function allDesignClasses(): string[];
|
|
58
|
+
/** Figma's per-axis resizing: Fixed (a spacing step), Hug contents, or Fill container. */
|
|
59
|
+
type DesignSizing = {
|
|
60
|
+
mode: 'fixed';
|
|
61
|
+
step: DesignSpacingStep;
|
|
62
|
+
} | {
|
|
63
|
+
mode: 'hug';
|
|
64
|
+
} | {
|
|
65
|
+
mode: 'fill';
|
|
66
|
+
};
|
|
67
|
+
type DesignAxis = 'w' | 'h';
|
|
68
|
+
declare function sizingOf(classes: readonly string[], axis: DesignAxis): DesignSizing;
|
|
69
|
+
/** Replace this axis's base size class with the one for `sizing`; everything else stays. */
|
|
70
|
+
declare function withSizing(classes: readonly string[], axis: DesignAxis, sizing: DesignSizing): string[];
|
|
71
|
+
type DesignSizeLimit = 'min' | 'max';
|
|
72
|
+
/** The spacing step a `min-*` / `max-*` class sets on this axis, or null (a custom `[…]` value is not a step). */
|
|
73
|
+
declare function sizeLimitOf(classes: readonly string[], axis: DesignAxis, limit: DesignSizeLimit): DesignSpacingStep | null;
|
|
74
|
+
/** Replace this axis's base `min-*` / `max-*` class (a step or a custom value) with `step`, or clear it with null. */
|
|
75
|
+
declare function withSizeLimit(classes: readonly string[], axis: DesignAxis, limit: DesignSizeLimit, step: DesignSpacingStep | null): string[];
|
|
76
|
+
/** Gap between children and padding per side, in spacing steps. */
|
|
77
|
+
interface DesignSpacing {
|
|
78
|
+
gap: DesignSpacingStep;
|
|
79
|
+
top: DesignSpacingStep;
|
|
80
|
+
right: DesignSpacingStep;
|
|
81
|
+
bottom: DesignSpacingStep;
|
|
82
|
+
left: DesignSpacingStep;
|
|
83
|
+
}
|
|
84
|
+
/** Current spacing; a side-specific class beats an axis class, which beats `p-*`. */
|
|
85
|
+
declare function spacingOf(classes: readonly string[]): DesignSpacing;
|
|
86
|
+
/** Apply `change` and write the smallest class set for the result (`p-*`, else `px-* py-*`, else each side). */
|
|
87
|
+
declare function withSpacing(classes: readonly string[], change: Partial<DesignSpacing>): string[];
|
|
88
|
+
/** One grid position on an axis. */
|
|
89
|
+
type DesignAlignment = 'start' | 'center' | 'end';
|
|
90
|
+
type DesignDirection = 'horizontal' | 'vertical';
|
|
91
|
+
/** Main-axis distribution: a grid position, or Figma's space-between. */
|
|
92
|
+
type DesignJustify = DesignAlignment | 'between';
|
|
93
|
+
/** Auto layout as the classes set it; null where no base class decides it (the element's own default applies). */
|
|
94
|
+
interface DesignLayout {
|
|
95
|
+
direction: DesignDirection | null;
|
|
96
|
+
/** Cross axis (`items-*`). */
|
|
97
|
+
align: DesignAlignment | null;
|
|
98
|
+
/** Main axis (`justify-*`). */
|
|
99
|
+
justify: DesignJustify | null;
|
|
100
|
+
wrap: boolean;
|
|
101
|
+
}
|
|
102
|
+
declare function layoutOf(classes: readonly string[]): DesignLayout;
|
|
103
|
+
/** Replace the base class for each changed part of the layout; everything else (variants included) stays. */
|
|
104
|
+
declare function withLayout(classes: readonly string[], change: Partial<{
|
|
105
|
+
direction: DesignDirection;
|
|
106
|
+
align: DesignAlignment;
|
|
107
|
+
justify: DesignJustify;
|
|
108
|
+
wrap: boolean;
|
|
109
|
+
}>): string[];
|
|
110
|
+
/**
|
|
111
|
+
* How an absolute element keeps its place when its parent resizes, per axis
|
|
112
|
+
* (Figma constraints): pinned to the start (left/top) or end (right/bottom)
|
|
113
|
+
* side, to both (stretches), centred, or scaled (offsets in % of the parent).
|
|
114
|
+
*/
|
|
115
|
+
type DesignConstraint = 'start' | 'end' | 'both' | 'center' | 'scale';
|
|
116
|
+
/** One axis: its constraint and the start/end offsets it uses — px, or % for `scale`; for `center`, `start` is the px offset from the centre. */
|
|
117
|
+
interface DesignAxisPosition {
|
|
118
|
+
constraint: DesignConstraint;
|
|
119
|
+
start: number;
|
|
120
|
+
end: number;
|
|
121
|
+
}
|
|
122
|
+
interface DesignPosition {
|
|
123
|
+
absolute: boolean;
|
|
124
|
+
x: DesignAxisPosition;
|
|
125
|
+
y: DesignAxisPosition;
|
|
126
|
+
}
|
|
127
|
+
declare function positionOf(classes: readonly string[]): DesignPosition;
|
|
128
|
+
/** Replace every base position class with the ones `position` needs; not absolute → none at all. */
|
|
129
|
+
declare function withPosition(classes: readonly string[], position: DesignPosition): string[];
|
|
130
|
+
/** Make an element the positioning context for its absolute children (`relative`, unless it is already positioned). */
|
|
131
|
+
declare function withPositioningContext(classes: readonly string[]): string[];
|
|
132
|
+
/** The theme token a class reads, when it reads one. */
|
|
133
|
+
type DesignClassToken = {
|
|
134
|
+
group: 'colors';
|
|
135
|
+
key: DesignColorToken;
|
|
136
|
+
} | {
|
|
137
|
+
group: 'radii';
|
|
138
|
+
key: DesignRadiusToken;
|
|
139
|
+
} | {
|
|
140
|
+
group: 'spacing';
|
|
141
|
+
key: string;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* The theme token behind one class (`hover:bg-primary` → colors `primary`,
|
|
145
|
+
* `p-4` → spacing `4`, i.e. `--space-4`), or null when the class is outside
|
|
146
|
+
* the vocabulary or not token-backed.
|
|
147
|
+
*/
|
|
148
|
+
declare function tokenOfDesignClass(className: string): DesignClassToken | null;
|
|
149
|
+
/**
|
|
150
|
+
* An arbitrary-value class — one class (no spaces) ending in a `[…]` value,
|
|
151
|
+
* variants allowed: `w-[243px]`, `hover:bg-[#e14b2a]`. The designer's custom
|
|
152
|
+
* field accepts only these; scale and token classes have their own editors.
|
|
153
|
+
*/
|
|
154
|
+
declare function isArbitraryClass(className: string): boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Every arbitrary-value class in the schema's literal `className`s, once,
|
|
157
|
+
* sorted. Tailwind only compiles classes it saw at build time, so a runtime
|
|
158
|
+
* that renders a schema compiles these on demand (the scale and token classes
|
|
159
|
+
* are safelisted by the preset). Bound (expression) classNames are skipped.
|
|
160
|
+
* `_metadata` and `ledger` are provenance and identity records, never render trees.
|
|
161
|
+
*/
|
|
162
|
+
declare function arbitraryClassesOf(schema: OrbitalSchema): string[];
|
|
163
|
+
|
|
164
|
+
export { DESIGN_COLOR_TOKENS, DESIGN_COLOR_UTILITIES, DESIGN_LAYOUT_CLASSES, DESIGN_POSITION_CLASSES, DESIGN_RADIUS_TOKENS, DESIGN_SIZING_CLASSES, DESIGN_SPACING_SCALE, DESIGN_SPACING_STEP_PX, DESIGN_SPACING_TOKEN_STEPS, DESIGN_SPACING_UTILITIES, allDesignClasses, arbitraryClassesOf, colorClass, defaultSpacingStepPx, isArbitraryClass, layoutOf, positionOf, radiusClass, sizeLimitOf, sizingOf, snapToSpacingStep, spacingClass, spacingOf, spacingTokenOf, tokenOfDesignClass, withLayout, withPosition, withPositioningContext, withSizeLimit, withSizing, withSpacing };
|
|
165
|
+
export type { DesignAlignment, DesignAxis, DesignAxisPosition, DesignClassToken, DesignColorToken, DesignColorUtility, DesignConstraint, DesignDirection, DesignJustify, DesignLayout, DesignPosition, DesignRadiusToken, DesignSizeLimit, DesignSizing, DesignSpacing, DesignSpacingStep, DesignSpacingUtility, SpacingStepPx };
|
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
import { toPayloadValue } from '@almadar/core';
|
|
2
|
+
|
|
3
|
+
// src/lib/design-classes.ts
|
|
4
|
+
var DESIGN_COLOR_TOKENS = [
|
|
5
|
+
"primary",
|
|
6
|
+
"primary-foreground",
|
|
7
|
+
"primary-hover",
|
|
8
|
+
"secondary",
|
|
9
|
+
"secondary-foreground",
|
|
10
|
+
"secondary-hover",
|
|
11
|
+
"muted",
|
|
12
|
+
"muted-foreground",
|
|
13
|
+
"accent",
|
|
14
|
+
"accent-foreground",
|
|
15
|
+
"background",
|
|
16
|
+
"foreground",
|
|
17
|
+
"card",
|
|
18
|
+
"card-foreground",
|
|
19
|
+
"surface",
|
|
20
|
+
"border",
|
|
21
|
+
"input",
|
|
22
|
+
"ring",
|
|
23
|
+
"error",
|
|
24
|
+
"error-foreground",
|
|
25
|
+
"success",
|
|
26
|
+
"success-foreground",
|
|
27
|
+
"warning",
|
|
28
|
+
"warning-foreground",
|
|
29
|
+
"info",
|
|
30
|
+
"info-foreground"
|
|
31
|
+
];
|
|
32
|
+
var DESIGN_COLOR_UTILITIES = ["bg", "text", "border"];
|
|
33
|
+
var DESIGN_RADIUS_TOKENS = ["none", "sm", "md", "lg", "xl", "full"];
|
|
34
|
+
var DESIGN_SPACING_SCALE = [
|
|
35
|
+
0,
|
|
36
|
+
0.5,
|
|
37
|
+
1,
|
|
38
|
+
1.5,
|
|
39
|
+
2,
|
|
40
|
+
2.5,
|
|
41
|
+
3,
|
|
42
|
+
3.5,
|
|
43
|
+
4,
|
|
44
|
+
5,
|
|
45
|
+
6,
|
|
46
|
+
7,
|
|
47
|
+
8,
|
|
48
|
+
9,
|
|
49
|
+
10,
|
|
50
|
+
11,
|
|
51
|
+
12,
|
|
52
|
+
14,
|
|
53
|
+
16,
|
|
54
|
+
20,
|
|
55
|
+
24,
|
|
56
|
+
28,
|
|
57
|
+
32,
|
|
58
|
+
36,
|
|
59
|
+
40,
|
|
60
|
+
44,
|
|
61
|
+
48,
|
|
62
|
+
52,
|
|
63
|
+
56,
|
|
64
|
+
60,
|
|
65
|
+
64,
|
|
66
|
+
72,
|
|
67
|
+
80,
|
|
68
|
+
96
|
|
69
|
+
];
|
|
70
|
+
var DESIGN_SPACING_UTILITIES = [
|
|
71
|
+
"w",
|
|
72
|
+
"h",
|
|
73
|
+
"min-w",
|
|
74
|
+
"max-w",
|
|
75
|
+
"min-h",
|
|
76
|
+
"max-h",
|
|
77
|
+
"p",
|
|
78
|
+
"px",
|
|
79
|
+
"py",
|
|
80
|
+
"pt",
|
|
81
|
+
"pr",
|
|
82
|
+
"pb",
|
|
83
|
+
"pl",
|
|
84
|
+
"m",
|
|
85
|
+
"mx",
|
|
86
|
+
"my",
|
|
87
|
+
"gap"
|
|
88
|
+
];
|
|
89
|
+
var DESIGN_SIZING_CLASSES = ["w-fit", "w-full", "h-fit", "h-full"];
|
|
90
|
+
var DESIGN_LAYOUT_CLASSES = [
|
|
91
|
+
"flex-row",
|
|
92
|
+
"flex-col",
|
|
93
|
+
"items-start",
|
|
94
|
+
"items-center",
|
|
95
|
+
"items-end",
|
|
96
|
+
"justify-start",
|
|
97
|
+
"justify-center",
|
|
98
|
+
"justify-end",
|
|
99
|
+
"justify-between",
|
|
100
|
+
"flex-wrap"
|
|
101
|
+
];
|
|
102
|
+
var DESIGN_POSITION_CLASSES = [
|
|
103
|
+
"absolute",
|
|
104
|
+
"relative",
|
|
105
|
+
"left-0",
|
|
106
|
+
"right-0",
|
|
107
|
+
"top-0",
|
|
108
|
+
"bottom-0",
|
|
109
|
+
"left-1/2",
|
|
110
|
+
"-translate-x-1/2",
|
|
111
|
+
"top-1/2",
|
|
112
|
+
"-translate-y-1/2"
|
|
113
|
+
];
|
|
114
|
+
var DESIGN_SPACING_STEP_PX = 4;
|
|
115
|
+
function colorClass(utility, token) {
|
|
116
|
+
return `${utility}-${token}`;
|
|
117
|
+
}
|
|
118
|
+
function radiusClass(token) {
|
|
119
|
+
return `rounded-${token}`;
|
|
120
|
+
}
|
|
121
|
+
function spacingClass(utility, step) {
|
|
122
|
+
return `${utility}-${step}`;
|
|
123
|
+
}
|
|
124
|
+
var defaultSpacingStepPx = (step) => step * DESIGN_SPACING_STEP_PX;
|
|
125
|
+
var DESIGN_SPACING_TOKEN_STEPS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
|
126
|
+
function spacingTokenOf(step) {
|
|
127
|
+
return DESIGN_SPACING_TOKEN_STEPS.includes(step) ? `--space-${step}` : null;
|
|
128
|
+
}
|
|
129
|
+
function snapToSpacingStep(px, pxOf = defaultSpacingStepPx) {
|
|
130
|
+
const target = Math.max(0, px);
|
|
131
|
+
let best = DESIGN_SPACING_SCALE[0];
|
|
132
|
+
for (const step of DESIGN_SPACING_SCALE) {
|
|
133
|
+
const d = Math.abs(pxOf(step) - target);
|
|
134
|
+
const bestD = Math.abs(pxOf(best) - target);
|
|
135
|
+
if (d < bestD || d === bestD && spacingTokenOf(step) !== null && spacingTokenOf(best) === null) best = step;
|
|
136
|
+
}
|
|
137
|
+
return best;
|
|
138
|
+
}
|
|
139
|
+
function allDesignClasses() {
|
|
140
|
+
return [
|
|
141
|
+
...DESIGN_COLOR_UTILITIES.flatMap((u) => DESIGN_COLOR_TOKENS.map((t) => colorClass(u, t))),
|
|
142
|
+
...DESIGN_RADIUS_TOKENS.map(radiusClass),
|
|
143
|
+
...DESIGN_SPACING_UTILITIES.flatMap((u) => DESIGN_SPACING_SCALE.map((s) => spacingClass(u, s))),
|
|
144
|
+
...DESIGN_SIZING_CLASSES,
|
|
145
|
+
...DESIGN_LAYOUT_CLASSES,
|
|
146
|
+
...DESIGN_POSITION_CLASSES
|
|
147
|
+
];
|
|
148
|
+
}
|
|
149
|
+
var SPACING_STEP_BY_TEXT = new Map(
|
|
150
|
+
DESIGN_SPACING_SCALE.map((step) => [String(step), step])
|
|
151
|
+
);
|
|
152
|
+
function stepOf(className, utility) {
|
|
153
|
+
if (!className.startsWith(`${utility}-`)) return void 0;
|
|
154
|
+
return SPACING_STEP_BY_TEXT.get(className.slice(utility.length + 1));
|
|
155
|
+
}
|
|
156
|
+
function isAxisSizeClass(className, axis) {
|
|
157
|
+
return className.startsWith(`${axis}-`);
|
|
158
|
+
}
|
|
159
|
+
function sizingOf(classes, axis) {
|
|
160
|
+
for (const c of classes) {
|
|
161
|
+
if (c === `${axis}-full`) return { mode: "fill" };
|
|
162
|
+
if (c === `${axis}-fit`) return { mode: "hug" };
|
|
163
|
+
const step = stepOf(c, axis);
|
|
164
|
+
if (step !== void 0) return { mode: "fixed", step };
|
|
165
|
+
}
|
|
166
|
+
return { mode: "hug" };
|
|
167
|
+
}
|
|
168
|
+
function withSizing(classes, axis, sizing) {
|
|
169
|
+
const kept = classes.filter((c) => !isAxisSizeClass(c, axis));
|
|
170
|
+
const next = sizing.mode === "fixed" ? `${axis}-${sizing.step}` : sizing.mode === "hug" ? `${axis}-fit` : `${axis}-full`;
|
|
171
|
+
return [...kept, next];
|
|
172
|
+
}
|
|
173
|
+
function sizeLimitOf(classes, axis, limit) {
|
|
174
|
+
for (const c of classes) {
|
|
175
|
+
const step = stepOf(c, `${limit}-${axis}`);
|
|
176
|
+
if (step !== void 0) return step;
|
|
177
|
+
}
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
function withSizeLimit(classes, axis, limit, step) {
|
|
181
|
+
const kept = classes.filter((c) => !c.startsWith(`${limit}-${axis}-`));
|
|
182
|
+
return step === null ? kept : [...kept, `${limit}-${axis}-${step}`];
|
|
183
|
+
}
|
|
184
|
+
var PADDING_UTILITIES = ["p", "px", "py", "pt", "pr", "pb", "pl"];
|
|
185
|
+
function isSpacingClass(className) {
|
|
186
|
+
return stepOf(className, "gap") !== void 0 || PADDING_UTILITIES.some((u) => stepOf(className, u) !== void 0);
|
|
187
|
+
}
|
|
188
|
+
function spacingOf(classes) {
|
|
189
|
+
const find = (utility) => {
|
|
190
|
+
for (const c of classes) {
|
|
191
|
+
const step = stepOf(c, utility);
|
|
192
|
+
if (step !== void 0) return step;
|
|
193
|
+
}
|
|
194
|
+
return void 0;
|
|
195
|
+
};
|
|
196
|
+
const all = find("p") ?? 0;
|
|
197
|
+
const x = find("px") ?? all;
|
|
198
|
+
const y = find("py") ?? all;
|
|
199
|
+
return {
|
|
200
|
+
gap: find("gap") ?? 0,
|
|
201
|
+
top: find("pt") ?? y,
|
|
202
|
+
right: find("pr") ?? x,
|
|
203
|
+
bottom: find("pb") ?? y,
|
|
204
|
+
left: find("pl") ?? x
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
function withSpacing(classes, change) {
|
|
208
|
+
const next = { ...spacingOf(classes), ...change };
|
|
209
|
+
const kept = classes.filter((c) => !isSpacingClass(c));
|
|
210
|
+
const out = [...kept];
|
|
211
|
+
if (next.gap !== 0) out.push(`gap-${next.gap}`);
|
|
212
|
+
const { top, right, bottom, left } = next;
|
|
213
|
+
if (top === right && right === bottom && bottom === left) {
|
|
214
|
+
if (top !== 0) out.push(`p-${top}`);
|
|
215
|
+
} else if (top === bottom && left === right) {
|
|
216
|
+
out.push(`px-${left}`, `py-${top}`);
|
|
217
|
+
} else {
|
|
218
|
+
out.push(`pt-${top}`, `pr-${right}`, `pb-${bottom}`, `pl-${left}`);
|
|
219
|
+
}
|
|
220
|
+
return out;
|
|
221
|
+
}
|
|
222
|
+
var DIRECTION_CLASSES = ["flex-row", "flex-row-reverse", "flex-col", "flex-col-reverse"];
|
|
223
|
+
var ALIGNMENTS = ["start", "center", "end"];
|
|
224
|
+
var JUSTIFIES = [...ALIGNMENTS, "between"];
|
|
225
|
+
var WRAP_CLASSES = ["flex-wrap", "flex-nowrap", "flex-wrap-reverse"];
|
|
226
|
+
function firstOf(classes, utility, values) {
|
|
227
|
+
for (const c of classes) {
|
|
228
|
+
for (const v of values) if (c === `${utility}-${v}`) return v;
|
|
229
|
+
}
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
function layoutOf(classes) {
|
|
233
|
+
const direction = classes.find((c) => DIRECTION_CLASSES.includes(c));
|
|
234
|
+
return {
|
|
235
|
+
direction: direction === void 0 ? null : direction.startsWith("flex-row") ? "horizontal" : "vertical",
|
|
236
|
+
align: firstOf(classes, "items", ALIGNMENTS),
|
|
237
|
+
justify: firstOf(classes, "justify", JUSTIFIES),
|
|
238
|
+
wrap: classes.includes("flex-wrap")
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
function withLayout(classes, change) {
|
|
242
|
+
let next = [...classes];
|
|
243
|
+
if (change.direction) {
|
|
244
|
+
next = next.filter((c) => !DIRECTION_CLASSES.includes(c));
|
|
245
|
+
next.push(change.direction === "horizontal" ? "flex-row" : "flex-col");
|
|
246
|
+
}
|
|
247
|
+
if (change.align) {
|
|
248
|
+
next = next.filter((c) => !c.startsWith("items-"));
|
|
249
|
+
next.push(`items-${change.align}`);
|
|
250
|
+
}
|
|
251
|
+
if (change.justify) {
|
|
252
|
+
next = next.filter((c) => !c.startsWith("justify-"));
|
|
253
|
+
next.push(`justify-${change.justify}`);
|
|
254
|
+
}
|
|
255
|
+
if (change.wrap !== void 0) {
|
|
256
|
+
next = next.filter((c) => !WRAP_CLASSES.includes(c));
|
|
257
|
+
if (change.wrap) next.push("flex-wrap");
|
|
258
|
+
}
|
|
259
|
+
return next;
|
|
260
|
+
}
|
|
261
|
+
var AXIS_SIDES = { x: ["left", "right"], y: ["top", "bottom"] };
|
|
262
|
+
var CENTER_CLASSES = { x: ["left-1/2", "-translate-x-1/2"], y: ["top-1/2", "-translate-y-1/2"] };
|
|
263
|
+
function offsetOf(classes, side) {
|
|
264
|
+
for (const c of classes) {
|
|
265
|
+
if (!c.startsWith(`${side}-`)) continue;
|
|
266
|
+
const step = stepOf(c, side);
|
|
267
|
+
if (step !== void 0) return { value: defaultSpacingStepPx(step), unit: "px" };
|
|
268
|
+
const m = /^\[(-?\d+(?:\.\d+)?)(px|%)\]$/.exec(c.slice(side.length + 1));
|
|
269
|
+
if (m) return { value: Number(m[1]), unit: m[2] === "%" ? "%" : "px" };
|
|
270
|
+
}
|
|
271
|
+
return null;
|
|
272
|
+
}
|
|
273
|
+
function centerOffsetOf(classes, side) {
|
|
274
|
+
for (const c of classes) {
|
|
275
|
+
if (c === `${side}-1/2`) return 0;
|
|
276
|
+
const m = new RegExp(`^${side}-\\[calc\\(50%([+-])(\\d+(?:\\.\\d+)?)px\\)\\]$`).exec(c);
|
|
277
|
+
if (m) return (m[1] === "-" ? -1 : 1) * Number(m[2]);
|
|
278
|
+
}
|
|
279
|
+
return null;
|
|
280
|
+
}
|
|
281
|
+
function axisPositionOf(classes, axis) {
|
|
282
|
+
const [startSide, endSide] = AXIS_SIDES[axis];
|
|
283
|
+
const center = centerOffsetOf(classes, startSide);
|
|
284
|
+
if (center !== null && classes.includes(CENTER_CLASSES[axis][1])) return { constraint: "center", start: center, end: 0 };
|
|
285
|
+
const start = offsetOf(classes, startSide);
|
|
286
|
+
const end = offsetOf(classes, endSide);
|
|
287
|
+
if (start?.unit === "%" || end?.unit === "%") {
|
|
288
|
+
return { constraint: "scale", start: start?.value ?? 0, end: end?.value ?? 0 };
|
|
289
|
+
}
|
|
290
|
+
if (start && end) return { constraint: "both", start: start.value, end: end.value };
|
|
291
|
+
if (end) return { constraint: "end", start: 0, end: end.value };
|
|
292
|
+
return { constraint: "start", start: start?.value ?? 0, end: 0 };
|
|
293
|
+
}
|
|
294
|
+
function positionOf(classes) {
|
|
295
|
+
return {
|
|
296
|
+
absolute: classes.includes("absolute"),
|
|
297
|
+
x: axisPositionOf(classes, "x"),
|
|
298
|
+
y: axisPositionOf(classes, "y")
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
function isPositionClass(className) {
|
|
302
|
+
if (className === "absolute") return true;
|
|
303
|
+
if (CENTER_CLASSES.x.some((c) => c === className) || CENTER_CLASSES.y.some((c) => c === className)) return true;
|
|
304
|
+
return [...AXIS_SIDES.x, ...AXIS_SIDES.y].some((side) => className.startsWith(`${side}-`));
|
|
305
|
+
}
|
|
306
|
+
function offsetClass(side, value, unit) {
|
|
307
|
+
const rounded = unit === "%" ? Math.round(value * 10) / 10 : Math.round(value);
|
|
308
|
+
return rounded === 0 ? `${side}-0` : `${side}-[${rounded}${unit}]`;
|
|
309
|
+
}
|
|
310
|
+
function axisClasses(axis, p) {
|
|
311
|
+
const [startSide, endSide] = AXIS_SIDES[axis];
|
|
312
|
+
switch (p.constraint) {
|
|
313
|
+
case "center": {
|
|
314
|
+
const offset = Math.round(p.start);
|
|
315
|
+
const pin = offset === 0 ? CENTER_CLASSES[axis][0] : `${startSide}-[calc(50%${offset < 0 ? "-" : "+"}${Math.abs(offset)}px)]`;
|
|
316
|
+
return [pin, CENTER_CLASSES[axis][1]];
|
|
317
|
+
}
|
|
318
|
+
case "end":
|
|
319
|
+
return [offsetClass(endSide, p.end, "px")];
|
|
320
|
+
case "both":
|
|
321
|
+
return [offsetClass(startSide, p.start, "px"), offsetClass(endSide, p.end, "px")];
|
|
322
|
+
case "scale":
|
|
323
|
+
return [offsetClass(startSide, p.start, "%"), offsetClass(endSide, p.end, "%")];
|
|
324
|
+
case "start":
|
|
325
|
+
return [offsetClass(startSide, p.start, "px")];
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
function withPosition(classes, position) {
|
|
329
|
+
const kept = classes.filter((c) => !isPositionClass(c));
|
|
330
|
+
if (!position.absolute) return kept;
|
|
331
|
+
return [...kept, "absolute", ...axisClasses("x", position.x), ...axisClasses("y", position.y)];
|
|
332
|
+
}
|
|
333
|
+
function withPositioningContext(classes) {
|
|
334
|
+
return classes.includes("relative") || classes.includes("absolute") ? [...classes] : [...classes, "relative"];
|
|
335
|
+
}
|
|
336
|
+
var COLOR_TOKEN_SET = new Set(DESIGN_COLOR_TOKENS);
|
|
337
|
+
var RADIUS_TOKEN_SET = new Set(DESIGN_RADIUS_TOKENS);
|
|
338
|
+
function isColorToken(value) {
|
|
339
|
+
return COLOR_TOKEN_SET.has(value);
|
|
340
|
+
}
|
|
341
|
+
function isRadiusToken(value) {
|
|
342
|
+
return RADIUS_TOKEN_SET.has(value);
|
|
343
|
+
}
|
|
344
|
+
function tokenOfDesignClass(className) {
|
|
345
|
+
const base = className.slice(className.lastIndexOf(":") + 1);
|
|
346
|
+
if (base.startsWith("rounded-")) {
|
|
347
|
+
const key = base.slice("rounded-".length);
|
|
348
|
+
return isRadiusToken(key) ? { group: "radii", key } : null;
|
|
349
|
+
}
|
|
350
|
+
for (const utility of DESIGN_COLOR_UTILITIES) {
|
|
351
|
+
const prefix = `${utility}-`;
|
|
352
|
+
if (!base.startsWith(prefix)) continue;
|
|
353
|
+
const key = base.slice(prefix.length);
|
|
354
|
+
if (isColorToken(key)) return { group: "colors", key };
|
|
355
|
+
}
|
|
356
|
+
for (const utility of DESIGN_SPACING_UTILITIES) {
|
|
357
|
+
const step = stepOf(base, utility);
|
|
358
|
+
if (step !== void 0 && spacingTokenOf(step) !== null) return { group: "spacing", key: String(step) };
|
|
359
|
+
}
|
|
360
|
+
return null;
|
|
361
|
+
}
|
|
362
|
+
function isArbitraryClass(className) {
|
|
363
|
+
return /^[a-z0-9:@/-]*-\[[^\]\s]+\]$/i.test(className);
|
|
364
|
+
}
|
|
365
|
+
function collectClasses(value, found) {
|
|
366
|
+
if (Array.isArray(value)) {
|
|
367
|
+
for (const item of value) collectClasses(item, found);
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
if (value === null || typeof value !== "object") return;
|
|
371
|
+
for (const [key, child] of Object.entries(value)) {
|
|
372
|
+
if (key === "className" && typeof child === "string") {
|
|
373
|
+
for (const cls of child.split(/\s+/)) if (cls && isArbitraryClass(cls)) found.add(cls);
|
|
374
|
+
} else {
|
|
375
|
+
collectClasses(child, found);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
function classesOfPart(part) {
|
|
380
|
+
const found = /* @__PURE__ */ new Set();
|
|
381
|
+
collectClasses(toPayloadValue(part), found);
|
|
382
|
+
return [...found];
|
|
383
|
+
}
|
|
384
|
+
var classesByOrbital = /* @__PURE__ */ new WeakMap();
|
|
385
|
+
function arbitraryClassesOf(schema) {
|
|
386
|
+
const { orbitals, _metadata: _provenance, ledger: _identities, ...rest } = schema;
|
|
387
|
+
const found = new Set(classesOfPart(rest));
|
|
388
|
+
for (const orbital of orbitals ?? []) {
|
|
389
|
+
let classes = classesByOrbital.get(orbital);
|
|
390
|
+
if (!classes) {
|
|
391
|
+
classes = classesOfPart(orbital);
|
|
392
|
+
classesByOrbital.set(orbital, classes);
|
|
393
|
+
}
|
|
394
|
+
for (const cls of classes) found.add(cls);
|
|
395
|
+
}
|
|
396
|
+
return [...found].sort();
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
export { DESIGN_COLOR_TOKENS, DESIGN_COLOR_UTILITIES, DESIGN_LAYOUT_CLASSES, DESIGN_POSITION_CLASSES, DESIGN_RADIUS_TOKENS, DESIGN_SIZING_CLASSES, DESIGN_SPACING_SCALE, DESIGN_SPACING_STEP_PX, DESIGN_SPACING_TOKEN_STEPS, DESIGN_SPACING_UTILITIES, allDesignClasses, arbitraryClassesOf, colorClass, defaultSpacingStepPx, isArbitraryClass, layoutOf, positionOf, radiusClass, sizeLimitOf, sizingOf, snapToSpacingStep, spacingClass, spacingOf, spacingTokenOf, tokenOfDesignClass, withLayout, withPosition, withPositioningContext, withSizeLimit, withSizing, withSpacing };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import './chunk-G7DCAZ22.js';
|
|
2
|
+
import emojilib from 'emojilib';
|
|
3
|
+
|
|
4
|
+
var { lib, ordered } = emojilib;
|
|
5
|
+
var EMOJI_ITEMS = (() => {
|
|
6
|
+
const items = [];
|
|
7
|
+
for (const name of ordered) {
|
|
8
|
+
const entry = lib[name];
|
|
9
|
+
if (entry === void 0 || entry.char === null || entry.char === "") continue;
|
|
10
|
+
items.push({
|
|
11
|
+
id: entry.char,
|
|
12
|
+
label: name.replace(/_/g, " "),
|
|
13
|
+
category: entry.category.replace(/_/g, " "),
|
|
14
|
+
keywords: entry.keywords
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return items;
|
|
18
|
+
})();
|
|
19
|
+
|
|
20
|
+
export { EMOJI_ITEMS };
|