decantr 0.9.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/AGENTS.md +868 -0
- package/CHANGELOG.md +255 -0
- package/CLAUDE.md +178 -0
- package/LICENSE +21 -0
- package/README.md +229 -0
- package/cli/art.js +127 -0
- package/cli/commands/a11y.js +61 -0
- package/cli/commands/audit.js +225 -0
- package/cli/commands/build.js +38 -0
- package/cli/commands/dev.js +18 -0
- package/cli/commands/doctor.js +197 -0
- package/cli/commands/figma-sync.js +48 -0
- package/cli/commands/figma-tokens.js +55 -0
- package/cli/commands/generate.js +26 -0
- package/cli/commands/init.js +116 -0
- package/cli/commands/lint.js +209 -0
- package/cli/commands/mcp.js +530 -0
- package/cli/commands/migrate.js +175 -0
- package/cli/commands/test.js +38 -0
- package/cli/commands/validate.js +354 -0
- package/cli/index.js +113 -0
- package/package.json +95 -0
- package/reference/atoms.md +517 -0
- package/reference/behaviors.md +384 -0
- package/reference/build-tooling.md +275 -0
- package/reference/color-guidelines.md +965 -0
- package/reference/component-lifecycle.md +137 -0
- package/reference/compound-spacing.md +95 -0
- package/reference/decantation-process.md +499 -0
- package/reference/dev-server-routes.md +93 -0
- package/reference/form-system.md +253 -0
- package/reference/i18n.md +336 -0
- package/reference/icons.md +576 -0
- package/reference/llm-primer.md +953 -0
- package/reference/plugins.md +252 -0
- package/reference/registry-consumption.md +76 -0
- package/reference/router.md +217 -0
- package/reference/shells.md +116 -0
- package/reference/spatial-guidelines.md +541 -0
- package/reference/ssr.md +234 -0
- package/reference/state-data.md +215 -0
- package/reference/state-patterns.md +166 -0
- package/reference/state.md +194 -0
- package/reference/style-system.md +110 -0
- package/reference/tokens.md +460 -0
- package/src/app.js +19 -0
- package/src/chart/_animate.js +266 -0
- package/src/chart/_base.js +109 -0
- package/src/chart/_data.js +209 -0
- package/src/chart/_format.js +106 -0
- package/src/chart/_interact.js +364 -0
- package/src/chart/_palette.js +105 -0
- package/src/chart/_renderer.js +52 -0
- package/src/chart/_scene.js +262 -0
- package/src/chart/_shared.js +371 -0
- package/src/chart/index.js +637 -0
- package/src/chart/layouts/_layout-base.js +328 -0
- package/src/chart/layouts/cartesian.js +148 -0
- package/src/chart/layouts/hierarchy.js +562 -0
- package/src/chart/layouts/polar.js +101 -0
- package/src/chart/renderers/canvas.js +179 -0
- package/src/chart/renderers/svg.js +256 -0
- package/src/chart/renderers/webgpu.js +715 -0
- package/src/chart/types/_type-base.js +26 -0
- package/src/chart/types/area.js +134 -0
- package/src/chart/types/bar.js +173 -0
- package/src/chart/types/box-plot.js +125 -0
- package/src/chart/types/bubble.js +63 -0
- package/src/chart/types/candlestick.js +115 -0
- package/src/chart/types/chord.js +85 -0
- package/src/chart/types/combination.js +108 -0
- package/src/chart/types/funnel.js +68 -0
- package/src/chart/types/gauge.js +163 -0
- package/src/chart/types/heatmap.js +98 -0
- package/src/chart/types/histogram.js +71 -0
- package/src/chart/types/line.js +111 -0
- package/src/chart/types/org-chart.js +93 -0
- package/src/chart/types/pie.js +81 -0
- package/src/chart/types/radar.js +96 -0
- package/src/chart/types/radial.js +68 -0
- package/src/chart/types/range-area.js +55 -0
- package/src/chart/types/range-bar.js +61 -0
- package/src/chart/types/sankey.js +73 -0
- package/src/chart/types/scatter.js +66 -0
- package/src/chart/types/sparkline.js +81 -0
- package/src/chart/types/sunburst.js +69 -0
- package/src/chart/types/swimlane.js +88 -0
- package/src/chart/types/treemap.js +62 -0
- package/src/chart/types/waterfall.js +100 -0
- package/src/components/_base.js +1658 -0
- package/src/components/_behaviors.js +1140 -0
- package/src/components/_primitives.js +534 -0
- package/src/components/_qr-encoder.js +539 -0
- package/src/components/accordion.js +207 -0
- package/src/components/affix.js +62 -0
- package/src/components/alert-dialog.js +75 -0
- package/src/components/alert.js +47 -0
- package/src/components/aspect-ratio.js +24 -0
- package/src/components/avatar-group.js +55 -0
- package/src/components/avatar.js +38 -0
- package/src/components/back-top.js +75 -0
- package/src/components/badge.js +74 -0
- package/src/components/banner.js +68 -0
- package/src/components/breadcrumb.js +162 -0
- package/src/components/button.js +115 -0
- package/src/components/calendar.js +131 -0
- package/src/components/card.js +192 -0
- package/src/components/carousel.js +98 -0
- package/src/components/cascader.js +261 -0
- package/src/components/checkbox.js +80 -0
- package/src/components/chip.js +81 -0
- package/src/components/code-block.js +82 -0
- package/src/components/collapsible.js +50 -0
- package/src/components/color-palette.js +438 -0
- package/src/components/color-picker.js +314 -0
- package/src/components/combobox.js +181 -0
- package/src/components/command.js +174 -0
- package/src/components/comment.js +206 -0
- package/src/components/context-menu.js +76 -0
- package/src/components/data-table.js +724 -0
- package/src/components/date-picker.js +217 -0
- package/src/components/date-range-picker.js +244 -0
- package/src/components/datetime-picker.js +271 -0
- package/src/components/descriptions.js +68 -0
- package/src/components/drawer.js +179 -0
- package/src/components/dropdown.js +88 -0
- package/src/components/empty.js +41 -0
- package/src/components/float-button.js +90 -0
- package/src/components/form.js +106 -0
- package/src/components/hover-card.js +49 -0
- package/src/components/icon.js +87 -0
- package/src/components/image.js +97 -0
- package/src/components/index.js +117 -0
- package/src/components/input-group.js +75 -0
- package/src/components/input-number.js +155 -0
- package/src/components/input-otp.js +178 -0
- package/src/components/input.js +91 -0
- package/src/components/kbd.js +36 -0
- package/src/components/label.js +25 -0
- package/src/components/list.js +118 -0
- package/src/components/masked-input.js +236 -0
- package/src/components/mentions.js +165 -0
- package/src/components/menu.js +259 -0
- package/src/components/message.js +80 -0
- package/src/components/modal.js +147 -0
- package/src/components/navigation-menu.js +166 -0
- package/src/components/notification.js +84 -0
- package/src/components/pagination.js +104 -0
- package/src/components/placeholder.js +132 -0
- package/src/components/popconfirm.js +70 -0
- package/src/components/popover.js +58 -0
- package/src/components/progress.js +61 -0
- package/src/components/qrcode.js +251 -0
- package/src/components/radiogroup.js +120 -0
- package/src/components/range-slider.js +176 -0
- package/src/components/rate.js +186 -0
- package/src/components/resizable.js +83 -0
- package/src/components/result.js +57 -0
- package/src/components/scroll-area.js +43 -0
- package/src/components/segmented.js +97 -0
- package/src/components/select.js +165 -0
- package/src/components/separator.js +31 -0
- package/src/components/shell.js +407 -0
- package/src/components/skeleton.js +39 -0
- package/src/components/slider.js +141 -0
- package/src/components/sortable-list.js +176 -0
- package/src/components/space.js +42 -0
- package/src/components/spinner.js +112 -0
- package/src/components/splitter.js +147 -0
- package/src/components/statistic.js +136 -0
- package/src/components/steps.js +99 -0
- package/src/components/switch.js +95 -0
- package/src/components/table.js +44 -0
- package/src/components/tabs.js +216 -0
- package/src/components/tag.js +115 -0
- package/src/components/textarea.js +82 -0
- package/src/components/time-picker.js +153 -0
- package/src/components/time-range-picker.js +170 -0
- package/src/components/timeline.js +226 -0
- package/src/components/toast.js +71 -0
- package/src/components/toggle.js +213 -0
- package/src/components/tooltip.js +57 -0
- package/src/components/tour.js +159 -0
- package/src/components/transfer.js +163 -0
- package/src/components/tree-select.js +274 -0
- package/src/components/tree.js +141 -0
- package/src/components/typography.js +136 -0
- package/src/components/upload.js +118 -0
- package/src/components/visually-hidden.js +20 -0
- package/src/components/watermark.js +124 -0
- package/src/core/index.js +539 -0
- package/src/core/lifecycle.js +69 -0
- package/src/css/atoms.js +651 -0
- package/src/css/components.js +940 -0
- package/src/css/derive.js +1296 -0
- package/src/css/index.js +265 -0
- package/src/css/runtime.js +268 -0
- package/src/css/styles/addons/bioluminescent.js +93 -0
- package/src/css/styles/addons/clay.js +70 -0
- package/src/css/styles/addons/clean.js +57 -0
- package/src/css/styles/addons/command-center.js +143 -0
- package/src/css/styles/addons/dopamine.js +83 -0
- package/src/css/styles/addons/editorial.js +80 -0
- package/src/css/styles/addons/glassmorphism.js +99 -0
- package/src/css/styles/addons/liquid-glass.js +105 -0
- package/src/css/styles/addons/prismatic.js +100 -0
- package/src/css/styles/addons/retro.js +63 -0
- package/src/css/styles/auradecantism.js +96 -0
- package/src/css/theme-registry.js +444 -0
- package/src/data/entity.js +281 -0
- package/src/data/index.js +13 -0
- package/src/data/persist.js +225 -0
- package/src/data/query.js +839 -0
- package/src/data/realtime.js +299 -0
- package/src/data/url.js +177 -0
- package/src/data/worker.js +134 -0
- package/src/explorer/archetypes.js +243 -0
- package/src/explorer/atoms.js +228 -0
- package/src/explorer/charts.js +497 -0
- package/src/explorer/components.js +129 -0
- package/src/explorer/foundations.js +949 -0
- package/src/explorer/icons.js +178 -0
- package/src/explorer/patterns.js +247 -0
- package/src/explorer/recipes.js +194 -0
- package/src/explorer/shared/pattern-examples.js +1337 -0
- package/src/explorer/shared/showcase-renderer.js +958 -0
- package/src/explorer/shared/spec-table.js +41 -0
- package/src/explorer/shared/usage-links.js +87 -0
- package/src/explorer/shell-config.js +10 -0
- package/src/explorer/shells.js +551 -0
- package/src/explorer/styles.js +161 -0
- package/src/explorer/tokens.js +262 -0
- package/src/explorer/tools.js +525 -0
- package/src/form/index.js +804 -0
- package/src/i18n/index.js +251 -0
- package/src/icons/essential.js +479 -0
- package/src/icons/index.js +53 -0
- package/src/plugins/index.js +282 -0
- package/src/registry/archetypes/content-site.json +71 -0
- package/src/registry/archetypes/docs-explorer.json +23 -0
- package/src/registry/archetypes/ecommerce.json +104 -0
- package/src/registry/archetypes/financial-dashboard.json +77 -0
- package/src/registry/archetypes/index.json +41 -0
- package/src/registry/archetypes/portfolio.json +82 -0
- package/src/registry/archetypes/recipe-community.json +159 -0
- package/src/registry/archetypes/saas-dashboard.json +86 -0
- package/src/registry/architect/cross-cutting.json +45 -0
- package/src/registry/architect/domains/ecommerce.json +294 -0
- package/src/registry/architect/domains/financial-services.json +302 -0
- package/src/registry/architect/index.json +26 -0
- package/src/registry/architect/traits.json +379 -0
- package/src/registry/atoms.json +16 -0
- package/src/registry/chart-showcase.json +160 -0
- package/src/registry/chart.json +136 -0
- package/src/registry/components.json +8616 -0
- package/src/registry/core.json +216 -0
- package/src/registry/css.json +319 -0
- package/src/registry/data.json +135 -0
- package/src/registry/foundations.json +11 -0
- package/src/registry/icons.json +463 -0
- package/src/registry/index.json +101 -0
- package/src/registry/patterns/activity-feed.json +37 -0
- package/src/registry/patterns/article-content.json +27 -0
- package/src/registry/patterns/auth-form.json +37 -0
- package/src/registry/patterns/author-card.json +20 -0
- package/src/registry/patterns/card-grid.json +127 -0
- package/src/registry/patterns/category-nav.json +26 -0
- package/src/registry/patterns/chart-grid.json +36 -0
- package/src/registry/patterns/chat-interface.json +37 -0
- package/src/registry/patterns/checklist-card.json +55 -0
- package/src/registry/patterns/comparison-panel.json +27 -0
- package/src/registry/patterns/component-showcase.json +24 -0
- package/src/registry/patterns/contact-form.json +31 -0
- package/src/registry/patterns/cta-section.json +20 -0
- package/src/registry/patterns/data-table.json +37 -0
- package/src/registry/patterns/detail-header.json +83 -0
- package/src/registry/patterns/detail-panel.json +27 -0
- package/src/registry/patterns/explorer-shell.json +22 -0
- package/src/registry/patterns/filter-bar.json +33 -0
- package/src/registry/patterns/filter-sidebar.json +27 -0
- package/src/registry/patterns/form-sections.json +110 -0
- package/src/registry/patterns/goal-tracker.json +27 -0
- package/src/registry/patterns/hero.json +107 -0
- package/src/registry/patterns/index.json +47 -0
- package/src/registry/patterns/kpi-grid.json +36 -0
- package/src/registry/patterns/media-gallery.json +20 -0
- package/src/registry/patterns/order-history.json +20 -0
- package/src/registry/patterns/pagination.json +19 -0
- package/src/registry/patterns/photo-to-recipe.json +36 -0
- package/src/registry/patterns/pipeline-tracker.json +28 -0
- package/src/registry/patterns/post-list.json +27 -0
- package/src/registry/patterns/pricing-table.json +32 -0
- package/src/registry/patterns/scorecard.json +28 -0
- package/src/registry/patterns/search-bar.json +20 -0
- package/src/registry/patterns/specimen-grid.json +19 -0
- package/src/registry/patterns/stat-card.json +55 -0
- package/src/registry/patterns/stats-bar.json +55 -0
- package/src/registry/patterns/steps-card.json +55 -0
- package/src/registry/patterns/table-of-contents.json +19 -0
- package/src/registry/patterns/testimonials.json +21 -0
- package/src/registry/patterns/timeline.json +27 -0
- package/src/registry/patterns/token-inspector.json +21 -0
- package/src/registry/patterns/wizard.json +27 -0
- package/src/registry/recipe-auradecantism.json +69 -0
- package/src/registry/recipe-clean.json +65 -0
- package/src/registry/recipe-command-center.json +78 -0
- package/src/registry/router.json +73 -0
- package/src/registry/schema/README.md +197 -0
- package/src/registry/skeletons.json +259 -0
- package/src/registry/state.json +137 -0
- package/src/registry/tokens.json +40 -0
- package/src/router/hash.js +17 -0
- package/src/router/history.js +18 -0
- package/src/router/index.js +598 -0
- package/src/ssr/index.js +922 -0
- package/src/state/arrays.js +181 -0
- package/src/state/devtools.js +647 -0
- package/src/state/index.js +498 -0
- package/src/state/middleware.js +288 -0
- package/src/state/scheduler.js +206 -0
- package/src/state/store.js +300 -0
- package/src/tags/index.js +19 -0
- package/src/tannins/auth.js +396 -0
- package/src/test/dom.js +352 -0
- package/src/test/index.js +62 -0
- package/src/test/state.js +306 -0
- package/tools/a11y-audit.js +487 -0
- package/tools/analyzer.js +315 -0
- package/tools/audit.js +706 -0
- package/tools/builder.js +1422 -0
- package/tools/css-extract.js +188 -0
- package/tools/dev-server.js +316 -0
- package/tools/dts-gen.js +1260 -0
- package/tools/figma-components.js +329 -0
- package/tools/figma-patterns.js +516 -0
- package/tools/figma-plugin/code.js +453 -0
- package/tools/figma-plugin/manifest.json +14 -0
- package/tools/figma-plugin/ui.html +268 -0
- package/tools/figma-render.js +293 -0
- package/tools/figma-tokens.js +712 -0
- package/tools/figma-upload.js +318 -0
- package/tools/generate.js +738 -0
- package/tools/icons.js +133 -0
- package/tools/init-templates.js +265 -0
- package/tools/install-hooks.sh +5 -0
- package/tools/migrations/0.5.0.js +53 -0
- package/tools/migrations/0.6.0.js +95 -0
- package/tools/minify.js +170 -0
- package/tools/pre-commit +4 -0
- package/tools/registry.js +662 -0
- package/tools/reset-playground.js +61 -0
- package/tools/starter-templates/content-site/app.js +49 -0
- package/tools/starter-templates/content-site/essence.js +19 -0
- package/tools/starter-templates/content-site/pages.js +31 -0
- package/tools/starter-templates/ecommerce/app.js +50 -0
- package/tools/starter-templates/ecommerce/essence.js +19 -0
- package/tools/starter-templates/ecommerce/pages.js +31 -0
- package/tools/starter-templates/landing-page/app.js +38 -0
- package/tools/starter-templates/landing-page/essence.js +18 -0
- package/tools/starter-templates/landing-page/pages.js +21 -0
- package/tools/starter-templates/portfolio/app.js +45 -0
- package/tools/starter-templates/portfolio/essence.js +19 -0
- package/tools/starter-templates/portfolio/pages.js +33 -0
- package/tools/starter-templates/saas-dashboard/app.js +70 -0
- package/tools/starter-templates/saas-dashboard/essence.js +19 -0
- package/tools/starter-templates/saas-dashboard/pages.js +31 -0
- package/tools/verify-pack.js +203 -0
- package/types/chart.d.ts +77 -0
- package/types/components.d.ts +587 -0
- package/types/core.d.ts +89 -0
- package/types/css.d.ts +149 -0
- package/types/data.d.ts +238 -0
- package/types/form.d.ts +164 -0
- package/types/i18n.d.ts +51 -0
- package/types/icons.d.ts +27 -0
- package/types/index.d.ts +13 -0
- package/types/router.d.ts +116 -0
- package/types/ssr.d.ts +102 -0
- package/types/state.d.ts +83 -0
- package/types/tags.d.ts +62 -0
- package/types/tannins.d.ts +63 -0
- package/types/test.d.ts +48 -0
package/src/css/atoms.js
ADDED
|
@@ -0,0 +1,651 @@
|
|
|
1
|
+
// ─── Helpers ────────────────────────────────────────────────────
|
|
2
|
+
const scale = [0, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3];
|
|
3
|
+
const extScale = { 14: 3.5, 16: 4, 20: 5, 24: 6, 32: 8, 40: 10, 48: 12, 56: 14, 64: 16 };
|
|
4
|
+
const extKeys = new Set(Object.keys(extScale).map(Number));
|
|
5
|
+
|
|
6
|
+
function rem(n) {
|
|
7
|
+
if (n === 0) return '0';
|
|
8
|
+
const val = scale[n] ?? extScale[n];
|
|
9
|
+
return val !== undefined ? `${val}rem` : `${n * 0.25}rem`;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function validSpacing(n) { return (n >= 0 && n <= 12) || extKeys.has(n); }
|
|
13
|
+
function validNeg(n) { return (n >= 1 && n <= 12) || (extKeys.has(n) && n <= 32); }
|
|
14
|
+
|
|
15
|
+
// ─── DIRECT — flat non-numeric atoms ────────────────────────────
|
|
16
|
+
const DIRECT = {
|
|
17
|
+
// Display
|
|
18
|
+
block: 'display:block', inline: 'display:inline', flex: 'display:flex',
|
|
19
|
+
grid: 'display:grid', none: 'display:none', contents: 'display:contents',
|
|
20
|
+
iflex: 'display:inline-flex', igrid: 'display:inline-grid',
|
|
21
|
+
|
|
22
|
+
// Flexbox
|
|
23
|
+
col: 'flex-direction:column', row: 'flex-direction:row',
|
|
24
|
+
colr: 'flex-direction:column-reverse', rowr: 'flex-direction:row-reverse',
|
|
25
|
+
wrap: 'flex-wrap:wrap', nowrap: 'flex-wrap:nowrap', wrapr: 'flex-wrap:wrap-reverse',
|
|
26
|
+
grow: 'flex-grow:1', grow0: 'flex-grow:0', shrink: 'flex-shrink:1', shrink0: 'flex-shrink:0',
|
|
27
|
+
flex1: 'flex:1 1 0%', flexauto: 'flex:1 1 auto', flexnone: 'flex:none', flexinit: 'flex:0 1 auto',
|
|
28
|
+
|
|
29
|
+
// Flex-basis keywords
|
|
30
|
+
basisa: 'flex-basis:auto', basis0: 'flex-basis:0', basisfull: 'flex-basis:100%',
|
|
31
|
+
// Flex-basis percentages
|
|
32
|
+
basis25: 'flex-basis:25%', basis33: 'flex-basis:33.333%', basis50: 'flex-basis:50%',
|
|
33
|
+
basis66: 'flex-basis:66.667%', basis75: 'flex-basis:75%',
|
|
34
|
+
|
|
35
|
+
// Order keywords
|
|
36
|
+
ordfirst: 'order:-9999', ordlast: 'order:9999',
|
|
37
|
+
|
|
38
|
+
// Auto margins
|
|
39
|
+
ma: 'margin:auto', mxa: 'margin-inline:auto', mya: 'margin-block:auto',
|
|
40
|
+
mta: 'margin-top:auto', mra: 'margin-right:auto', mba: 'margin-bottom:auto', mla: 'margin-left:auto',
|
|
41
|
+
|
|
42
|
+
// Alignment
|
|
43
|
+
center: 'align-items:center;justify-content:center',
|
|
44
|
+
aic: 'align-items:center', ais: 'align-items:stretch',
|
|
45
|
+
aifs: 'align-items:flex-start', aife: 'align-items:flex-end', aibs: 'align-items:baseline',
|
|
46
|
+
jcc: 'justify-content:center', jcsb: 'justify-content:space-between',
|
|
47
|
+
jcsa: 'justify-content:space-around', jcse: 'justify-content:space-evenly',
|
|
48
|
+
jcfs: 'justify-content:flex-start', jcfe: 'justify-content:flex-end',
|
|
49
|
+
// align-content
|
|
50
|
+
acc: 'align-content:center', acsb: 'align-content:space-between',
|
|
51
|
+
acsa: 'align-content:space-around', acse: 'align-content:space-evenly',
|
|
52
|
+
acfs: 'align-content:flex-start', acfe: 'align-content:flex-end', acs: 'align-content:stretch',
|
|
53
|
+
// align-self
|
|
54
|
+
asc: 'align-self:center', ass: 'align-self:stretch',
|
|
55
|
+
asfs: 'align-self:flex-start', asfe: 'align-self:flex-end',
|
|
56
|
+
asa: 'align-self:auto', asbs: 'align-self:baseline',
|
|
57
|
+
// justify-items
|
|
58
|
+
jic: 'justify-items:center', jis: 'justify-items:stretch',
|
|
59
|
+
jifs: 'justify-items:start', jife: 'justify-items:end',
|
|
60
|
+
// justify-self
|
|
61
|
+
jsc: 'justify-self:center', jss: 'justify-self:stretch',
|
|
62
|
+
jsfs: 'justify-self:start', jsfe: 'justify-self:end', jsa: 'justify-self:auto',
|
|
63
|
+
// place shorthands
|
|
64
|
+
pic: 'place-items:center', pis: 'place-items:stretch',
|
|
65
|
+
pcc: 'place-content:center', pcse: 'place-content:space-evenly', pcsb: 'place-content:space-between',
|
|
66
|
+
|
|
67
|
+
// Grid misc
|
|
68
|
+
gcnone: 'grid-template-columns:none', grnone: 'grid-template-rows:none',
|
|
69
|
+
spanfull: 'grid-column:1/-1', rspanfull: 'grid-row:1/-1',
|
|
70
|
+
gcaf: 'grid-template-columns:repeat(auto-fit,minmax(0,1fr))',
|
|
71
|
+
gcafl: 'grid-template-columns:repeat(auto-fill,minmax(0,1fr))',
|
|
72
|
+
gflowr: 'grid-auto-flow:row', gflowc: 'grid-auto-flow:column', gflowd: 'grid-auto-flow:dense',
|
|
73
|
+
gflowrd: 'grid-auto-flow:row dense', gflowcd: 'grid-auto-flow:column dense',
|
|
74
|
+
gacfr: 'grid-auto-columns:minmax(0,1fr)', gacmin: 'grid-auto-columns:min-content', gacmax: 'grid-auto-columns:max-content',
|
|
75
|
+
garfr: 'grid-auto-rows:minmax(0,1fr)', garmin: 'grid-auto-rows:min-content', garmax: 'grid-auto-rows:max-content',
|
|
76
|
+
|
|
77
|
+
// Position
|
|
78
|
+
relative: 'position:relative', absolute: 'position:absolute', fixed: 'position:fixed', sticky: 'position:sticky',
|
|
79
|
+
rel: 'position:relative', abs: 'position:absolute',
|
|
80
|
+
top0: 'top:0', right0: 'right:0', bottom0: 'bottom:0', left0: 'left:0', inset0: 'inset:0',
|
|
81
|
+
|
|
82
|
+
// Typography — non-numeric
|
|
83
|
+
bold: 'font-weight:700', medium: 'font-weight:500', normal: 'font-weight:400', light: 'font-weight:300',
|
|
84
|
+
italic: 'font-style:italic', underline: 'text-decoration:underline', strike: 'text-decoration:line-through',
|
|
85
|
+
nounder: 'text-decoration:none', upper: 'text-transform:uppercase', lower: 'text-transform:lowercase',
|
|
86
|
+
cap: 'text-transform:capitalize', tl: 'text-align:left', tc: 'text-align:center', tr: 'text-align:right',
|
|
87
|
+
fontmono: 'font-family:var(--d-font-mono)',
|
|
88
|
+
|
|
89
|
+
// Line-height static
|
|
90
|
+
lh1: 'line-height:1', lh1a: 'line-height:1.25', lh1b: 'line-height:1.5', lh2: 'line-height:2',
|
|
91
|
+
lh125: 'line-height:1.25', lh150: 'line-height:1.5', lh175: 'line-height:1.75',
|
|
92
|
+
|
|
93
|
+
// Token-backed semantic typography
|
|
94
|
+
textxs: 'font-size:var(--d-text-xs,0.625rem)', textsm: 'font-size:var(--d-text-sm,0.75rem)',
|
|
95
|
+
textbase: 'font-size:var(--d-text-base,0.875rem)', textmd: 'font-size:var(--d-text-md,1rem)',
|
|
96
|
+
textlg: 'font-size:var(--d-text-lg,1.125rem)', textxl: 'font-size:var(--d-text-xl,1.25rem)',
|
|
97
|
+
text2xl: 'font-size:var(--d-text-2xl,1.5rem)', text3xl: 'font-size:var(--d-text-3xl,2rem)',
|
|
98
|
+
text4xl: 'font-size:var(--d-text-4xl,2.5rem)',
|
|
99
|
+
lhtight: 'line-height:var(--d-lh-tight,1.1)', lhsnug: 'line-height:var(--d-lh-snug,1.25)',
|
|
100
|
+
lhnormal: 'line-height:var(--d-lh-normal,1.5)', lhrelaxed: 'line-height:var(--d-lh-relaxed,1.6)',
|
|
101
|
+
lhloose: 'line-height:var(--d-lh-loose,1.75)',
|
|
102
|
+
fwheading: 'font-weight:var(--d-fw-heading,700)', fwtitle: 'font-weight:var(--d-fw-title,600)',
|
|
103
|
+
fwmedium: 'font-weight:var(--d-fw-medium,500)', lsheading: 'letter-spacing:var(--d-ls-heading,-0.025em)',
|
|
104
|
+
|
|
105
|
+
// Overflow
|
|
106
|
+
ohidden: 'overflow:hidden', oauto: 'overflow:auto', oscroll: 'overflow:scroll', ovisible: 'overflow:visible',
|
|
107
|
+
oxhidden: 'overflow-x:hidden', oxauto: 'overflow-x:auto', oxscroll: 'overflow-x:scroll',
|
|
108
|
+
oyhidden: 'overflow-y:hidden', oyauto: 'overflow-y:auto', oyscroll: 'overflow-y:scroll',
|
|
109
|
+
|
|
110
|
+
// Aspect ratio
|
|
111
|
+
arsq: 'aspect-ratio:1', ar169: 'aspect-ratio:16/9', ar43: 'aspect-ratio:4/3',
|
|
112
|
+
ar219: 'aspect-ratio:21/9', ar32: 'aspect-ratio:3/2', ara: 'aspect-ratio:auto',
|
|
113
|
+
|
|
114
|
+
// Container utilities
|
|
115
|
+
ctrsm: 'max-width:640px;margin-inline:auto', ctr: 'max-width:960px;margin-inline:auto',
|
|
116
|
+
ctrlg: 'max-width:1080px;margin-inline:auto', ctrxl: 'max-width:1280px;margin-inline:auto',
|
|
117
|
+
ctrfull: 'max-width:100%;margin-inline:auto',
|
|
118
|
+
|
|
119
|
+
// Visibility/whitespace
|
|
120
|
+
visible: 'visibility:visible', invisible: 'visibility:hidden',
|
|
121
|
+
wsnw: 'white-space:nowrap', wsnormal: 'white-space:normal', wspre: 'white-space:pre', wsprewrap: 'white-space:pre-wrap',
|
|
122
|
+
|
|
123
|
+
// Cursor
|
|
124
|
+
pointer: 'cursor:pointer', grab: 'cursor:grab',
|
|
125
|
+
|
|
126
|
+
// Transitions
|
|
127
|
+
trans: 'transition:all 0.2s ease', transfast: 'transition:all 0.1s ease',
|
|
128
|
+
transslow: 'transition:all 0.4s ease', transnone: 'transition:none',
|
|
129
|
+
|
|
130
|
+
// Shadows
|
|
131
|
+
shadow: 'box-shadow:0 1px 3px rgba(0,0,0,0.12),0 1px 2px rgba(0,0,0,0.06)',
|
|
132
|
+
shadowmd: 'box-shadow:0 4px 6px rgba(0,0,0,0.1),0 2px 4px rgba(0,0,0,0.06)',
|
|
133
|
+
shadowlg: 'box-shadow:0 10px 15px rgba(0,0,0,0.1),0 4px 6px rgba(0,0,0,0.05)',
|
|
134
|
+
shadowno: 'box-shadow:none',
|
|
135
|
+
|
|
136
|
+
// Borders
|
|
137
|
+
b0: 'border:0', b1: 'border:1px solid', b2: 'border:2px solid',
|
|
138
|
+
rfull: 'border-radius:9999px', rcircle: 'border-radius:50%',
|
|
139
|
+
|
|
140
|
+
// Container queries
|
|
141
|
+
cqinl: 'container-type:inline-size', cqsz: 'container-type:size', cqnorm: 'container-type:normal',
|
|
142
|
+
|
|
143
|
+
// Logical inset
|
|
144
|
+
insetis0: 'inset-inline-start:0', insetie0: 'inset-inline-end:0',
|
|
145
|
+
insetbs0: 'inset-block-start:0', insetbe0: 'inset-block-end:0',
|
|
146
|
+
|
|
147
|
+
// Logical border-radius
|
|
148
|
+
rss: 'border-start-start-radius:var(--d-radius)', rse: 'border-start-end-radius:var(--d-radius)',
|
|
149
|
+
res: 'border-end-start-radius:var(--d-radius)', ree: 'border-end-end-radius:var(--d-radius)',
|
|
150
|
+
|
|
151
|
+
// Text alignment logical
|
|
152
|
+
tstart: 'text-align:start', tend: 'text-align:end',
|
|
153
|
+
|
|
154
|
+
// Float logical
|
|
155
|
+
floatis: 'float:inline-start', floatie: 'float:inline-end',
|
|
156
|
+
|
|
157
|
+
// Inline/block sizing
|
|
158
|
+
wi: 'inline-size:100%', wb: 'block-size:100%',
|
|
159
|
+
|
|
160
|
+
// Content sizing keywords
|
|
161
|
+
wmin: 'width:min-content', wmax: 'width:max-content',
|
|
162
|
+
hmin: 'height:min-content', hmax: 'height:max-content',
|
|
163
|
+
mwmin: 'max-width:min-content', mwmax: 'max-width:max-content',
|
|
164
|
+
mhmin: 'max-height:min-content', mhmax: 'max-height:max-content',
|
|
165
|
+
|
|
166
|
+
// Size keywords (per prefix)
|
|
167
|
+
w100: 'width:100%', wscreen: 'width:100vw', wauto: 'width:auto', wfull: 'width:100%', wfit: 'width:fit-content',
|
|
168
|
+
h100: 'height:100%', hscreen: 'height:100vh', hauto: 'height:auto', hfull: 'height:100%', hfit: 'height:fit-content',
|
|
169
|
+
mw100: 'max-width:100%', mwscreen: 'max-width:100vw', mwauto: 'max-width:auto', mwfull: 'max-width:100%', mwfit: 'max-width:fit-content',
|
|
170
|
+
mh100: 'max-height:100%', mhscreen: 'max-height:100vh', mhauto: 'max-height:auto', mhfull: 'max-height:100%', mhfit: 'max-height:fit-content',
|
|
171
|
+
minwfull: 'min-width:100%', minwscreen: 'min-width:100vw', minwfit: 'min-width:fit-content', minwmin: 'min-width:min-content', minwmax: 'min-width:max-content',
|
|
172
|
+
minhfull: 'min-height:100%', minhscreen: 'min-height:100vh', minhfit: 'min-height:fit-content', minhmin: 'min-height:min-content', minhmax: 'min-height:max-content',
|
|
173
|
+
|
|
174
|
+
// Semantic neutral colors
|
|
175
|
+
bgbg: 'background:var(--d-bg)', fgfg: 'color:var(--d-fg)',
|
|
176
|
+
bgmuted: 'background:var(--d-muted)', fgmuted: 'color:var(--d-muted)',
|
|
177
|
+
fgmutedfg: 'color:var(--d-muted-fg)', bcborder: 'border-color:var(--d-border)', bcstrong: 'border-color:var(--d-border-strong)',
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
// ─── Algorithmic property maps ──────────────────────────────────
|
|
181
|
+
const SPACING_PROPS = {
|
|
182
|
+
p: 'padding', px: 'padding-inline', py: 'padding-block',
|
|
183
|
+
pt: 'padding-top', pr: 'padding-right', pb: 'padding-bottom', pl: 'padding-left',
|
|
184
|
+
m: 'margin', mx: 'margin-inline', my: 'margin-block',
|
|
185
|
+
mt: 'margin-top', mr: 'margin-right', mb: 'margin-bottom', ml: 'margin-left',
|
|
186
|
+
gap: 'gap', gx: 'column-gap', gy: 'row-gap'
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
const NEG_MARGIN_PROPS = {
|
|
190
|
+
'-m': 'margin', '-mx': 'margin-inline', '-my': 'margin-block',
|
|
191
|
+
'-mt': 'margin-top', '-mr': 'margin-right', '-mb': 'margin-bottom', '-ml': 'margin-left'
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const SIZE_PROPS = { w: 'width', h: 'height', mw: 'max-width', mh: 'max-height' };
|
|
195
|
+
const MINSIZE_PROPS = { minw: 'min-width', minh: 'min-height' };
|
|
196
|
+
|
|
197
|
+
const LOGICAL_PROPS = {
|
|
198
|
+
mis: 'margin-inline-start', mie: 'margin-inline-end', mbs: 'margin-block-start', mbe: 'margin-block-end',
|
|
199
|
+
pis: 'padding-inline-start', pie: 'padding-inline-end', pbs: 'padding-block-start', pbe: 'padding-block-end'
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const FONT_SIZES = { 10: '0.625', 12: '0.75', 14: '0.875', 16: '1', 18: '1.125', 20: '1.25', 24: '1.5', 28: '1.75', 32: '2', 36: '2.25', 40: '2.5', 48: '3' };
|
|
203
|
+
|
|
204
|
+
const GRAD_DIRS = { R: 'to right', L: 'to left', T: 'to top', B: 'to bottom', BR: 'to bottom right', BL: 'to bottom left', TR: 'to top right', TL: 'to top left' };
|
|
205
|
+
|
|
206
|
+
const GRAD_COLORS = {
|
|
207
|
+
Primary: 'var(--d-primary)', Accent: 'var(--d-accent)', Tertiary: 'var(--d-tertiary)',
|
|
208
|
+
Success: 'var(--d-success)', Warning: 'var(--d-warning)', Error: 'var(--d-error)',
|
|
209
|
+
Info: 'var(--d-info)', Bg: 'var(--d-bg)', Surface1: 'var(--d-surface-1)', Transparent: 'transparent'
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
const BF_BLUR = { 0: '', 4: 'blur(4px)', 8: 'blur(8px)', 12: 'blur(12px)', 16: 'blur(16px)', 20: 'blur(20px)', 24: 'blur(24px)' };
|
|
213
|
+
const BF_SAT = { 100: 'saturate(1)', 125: 'saturate(1.25)', 150: 'saturate(1.5)', 180: 'saturate(1.8)', 200: 'saturate(2)' };
|
|
214
|
+
const BF_BRIGHT = { 90: 'brightness(0.9)', 100: 'brightness(1)', 110: 'brightness(1.1)', 120: 'brightness(1.2)' };
|
|
215
|
+
const BF = 'backdrop-filter:var(--d-bf-blur, ) var(--d-bf-sat, ) var(--d-bf-bright, );-webkit-backdrop-filter:var(--d-bf-blur, ) var(--d-bf-sat, ) var(--d-bf-bright, )';
|
|
216
|
+
|
|
217
|
+
const GCAF_SIZES = new Set([160, 200, 220, 250, 280, 300, 320]);
|
|
218
|
+
|
|
219
|
+
const SEMANTIC_ROLES = new Set(['primary', 'accent', 'tertiary', 'success', 'warning', 'error', 'info']);
|
|
220
|
+
const Z_VALUES = new Set([0, 10, 20, 30, 40, 50]);
|
|
221
|
+
const FW_VALUES = new Set([300, 400, 500, 600, 700]);
|
|
222
|
+
|
|
223
|
+
// ─── Algorithmic resolver ───────────────────────────────────────
|
|
224
|
+
function resolveAlgorithmic(n) {
|
|
225
|
+
let m;
|
|
226
|
+
|
|
227
|
+
// (a) Spacing: p0-p64, px0-px64, gap0-gap64, etc.
|
|
228
|
+
if ((m = n.match(/^(p|px|py|pt|pr|pb|pl|m|mx|my|mt|mr|mb|ml|gap|gx|gy)(\d+)$/))) {
|
|
229
|
+
const prop = SPACING_PROPS[m[1]];
|
|
230
|
+
const num = Number(m[2]);
|
|
231
|
+
if (prop && validSpacing(num)) return `${prop}:${rem(num)}`;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// (b) Negative margins: -m1, -mx4, etc.
|
|
235
|
+
if ((m = n.match(/^(-m|-mx|-my|-mt|-mr|-mb|-ml)(\d+)$/))) {
|
|
236
|
+
const prop = NEG_MARGIN_PROPS[m[1]];
|
|
237
|
+
const num = Number(m[2]);
|
|
238
|
+
if (prop && validNeg(num)) return `${prop}:-${rem(num)}`;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// (c) Sizing: w0-w12, w14-w64 (extScale), h0-h12, etc.
|
|
242
|
+
// Excludes w100/wscreen/etc. (those are in DIRECT)
|
|
243
|
+
if ((m = n.match(/^(w|h|mw|mh)(\d+)$/))) {
|
|
244
|
+
const prop = SIZE_PROPS[m[1]];
|
|
245
|
+
const num = Number(m[2]);
|
|
246
|
+
// Skip if it's a keyword-number already in DIRECT (100)
|
|
247
|
+
if (prop && num !== 100 && validSpacing(num)) return `${prop}:${rem(num)}`;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// (d) Min-sizing: minw0-minw12, minw14-minw64, minh0-minh12, etc.
|
|
251
|
+
if ((m = n.match(/^(minw|minh)(\d+)$/))) {
|
|
252
|
+
const prop = MINSIZE_PROPS[m[1]];
|
|
253
|
+
const num = Number(m[2]);
|
|
254
|
+
if (prop && validSpacing(num)) return `${prop}:${rem(num)}`;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// (e) Grid columns: gc1-gc12
|
|
258
|
+
if ((m = n.match(/^gc(\d+)$/))) {
|
|
259
|
+
const num = Number(m[1]);
|
|
260
|
+
if (num >= 1 && num <= 12) return `grid-template-columns:repeat(${num},minmax(0,1fr))`;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// (f) Grid rows: gr1-gr6
|
|
264
|
+
if ((m = n.match(/^gr(\d+)$/))) {
|
|
265
|
+
const num = Number(m[1]);
|
|
266
|
+
if (num >= 1 && num <= 6) return `grid-template-rows:repeat(${num},minmax(0,1fr))`;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// (g) Grid span: span1-span12
|
|
270
|
+
if ((m = n.match(/^span(\d+)$/))) {
|
|
271
|
+
const num = Number(m[1]);
|
|
272
|
+
if (num >= 1 && num <= 12) return `grid-column:span ${num}/span ${num}`;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// (h) Row span: rspan1-rspan6
|
|
276
|
+
if ((m = n.match(/^rspan(\d+)$/))) {
|
|
277
|
+
const num = Number(m[1]);
|
|
278
|
+
if (num >= 1 && num <= 6) return `grid-row:span ${num}/span ${num}`;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// (i) Grid col/row start/end
|
|
282
|
+
if ((m = n.match(/^(gcs|gce)(\d+)$/))) {
|
|
283
|
+
const num = Number(m[2]);
|
|
284
|
+
if (num >= 1 && num <= 13) return `${m[1] === 'gcs' ? 'grid-column-start' : 'grid-column-end'}:${num}`;
|
|
285
|
+
}
|
|
286
|
+
if ((m = n.match(/^(grs|gre)(\d+)$/))) {
|
|
287
|
+
const num = Number(m[2]);
|
|
288
|
+
if (num >= 1 && num <= 7) return `${m[1] === 'grs' ? 'grid-row-start' : 'grid-row-end'}:${num}`;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// (j) Grid auto-fit sized: gcaf160, gcaf200, etc.
|
|
292
|
+
if ((m = n.match(/^gcaf(\d+)$/))) {
|
|
293
|
+
const size = Number(m[1]);
|
|
294
|
+
if (GCAF_SIZES.has(size)) return `grid-template-columns:repeat(auto-fit,minmax(${size}px,1fr))`;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// (k) Typography sizes: t10, t12, t14, t16, t18, t20, t24, t28, t32, t36, t40, t48
|
|
298
|
+
if ((m = n.match(/^t(\d+)$/))) {
|
|
299
|
+
const size = FONT_SIZES[m[1]];
|
|
300
|
+
if (size) return `font-size:${size}rem`;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// (l) Font weight: fw300-fw700
|
|
304
|
+
if ((m = n.match(/^fw(\d+)$/))) {
|
|
305
|
+
const num = Number(m[1]);
|
|
306
|
+
if (FW_VALUES.has(num)) return `font-weight:${num}`;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// (m) Opacity: op0-op10
|
|
310
|
+
if ((m = n.match(/^op(\d+)$/))) {
|
|
311
|
+
const num = Number(m[1]);
|
|
312
|
+
if (num >= 0 && num <= 10) return `opacity:${num / 10}`;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// (n) Border radius: r0-r8
|
|
316
|
+
if ((m = n.match(/^r(\d)$/))) {
|
|
317
|
+
const num = Number(m[1]);
|
|
318
|
+
if (num >= 0 && num <= 8) return `border-radius:${rem(num)}`;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// (o) Z-index: z0, z10, z20, z30, z40, z50
|
|
322
|
+
if ((m = n.match(/^z(\d+)$/))) {
|
|
323
|
+
const num = Number(m[1]);
|
|
324
|
+
if (Z_VALUES.has(num)) return `z-index:${num}`;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// (p) Semantic colors: bg/fg/bc + role + optional suffix
|
|
328
|
+
if ((m = n.match(/^(bg|fg|bc)(primary|accent|tertiary|success|warning|error|info)(sub|bdr|on)?$/))) {
|
|
329
|
+
const [, prefix, role, suffix] = m;
|
|
330
|
+
if (!suffix) {
|
|
331
|
+
if (prefix === 'bg') return `background:var(--d-${role})`;
|
|
332
|
+
if (prefix === 'fg') return `color:var(--d-${role})`;
|
|
333
|
+
return `border-color:var(--d-${role})`;
|
|
334
|
+
}
|
|
335
|
+
if (suffix === 'sub') {
|
|
336
|
+
if (prefix === 'bg') return `background:var(--d-${role}-subtle)`;
|
|
337
|
+
if (prefix === 'fg') return `color:var(--d-${role}-subtle-fg)`;
|
|
338
|
+
}
|
|
339
|
+
if (suffix === 'bdr' && prefix === 'bc') return `border-color:var(--d-${role}-border)`;
|
|
340
|
+
if (suffix === 'on' && prefix === 'fg') return `color:var(--d-${role}-fg)`;
|
|
341
|
+
return null;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// (r) Surfaces: surface0-3, fgsurface0-3, bcsurface0-3
|
|
345
|
+
if ((m = n.match(/^(surface|fgsurface|bcsurface)(\d)$/))) {
|
|
346
|
+
const num = Number(m[2]);
|
|
347
|
+
if (num >= 0 && num <= 3) {
|
|
348
|
+
if (m[1] === 'surface') return `background:var(--d-surface-${num})`;
|
|
349
|
+
if (m[1] === 'fgsurface') return `color:var(--d-surface-${num}-fg)`;
|
|
350
|
+
return `border-color:var(--d-surface-${num}-border)`;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// (s) Elevations: elev0-3
|
|
355
|
+
if ((m = n.match(/^elev(\d)$/))) {
|
|
356
|
+
const num = Number(m[1]);
|
|
357
|
+
if (num >= 0 && num <= 3) return `box-shadow:var(--d-elevation-${num})`;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// (t) Logical spacing: mis/mie/mbs/mbe/pis/pie/pbs/pbe + number
|
|
361
|
+
if ((m = n.match(/^(mis|mie|mbs|mbe|pis|pie|pbs|pbe)(\d+)$/))) {
|
|
362
|
+
const prop = LOGICAL_PROPS[m[1]];
|
|
363
|
+
const num = Number(m[2]);
|
|
364
|
+
if (prop && validSpacing(num)) return `${prop}:${rem(num)}`;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// (u) Flex-basis: basis1-basis12, basis14-basis64 (extScale)
|
|
368
|
+
if ((m = n.match(/^basis(\d+)$/))) {
|
|
369
|
+
const num = Number(m[2] || m[1]);
|
|
370
|
+
// Percentages already in DIRECT (25,33,50,66,75), and basis0 is in DIRECT
|
|
371
|
+
if (num >= 1 && num <= 12) return `flex-basis:${rem(num)}`;
|
|
372
|
+
if (extKeys.has(num)) return `flex-basis:${rem(num)}`;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// (v) Order: ord0-ord12, ord-1
|
|
376
|
+
if ((m = n.match(/^ord(-?\d+)$/))) {
|
|
377
|
+
const num = Number(m[1]);
|
|
378
|
+
if ((num >= 0 && num <= 12) || num === -1) return `order:${num}`;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// (w) Gradient directions: gradR, gradBR, etc.
|
|
382
|
+
if ((m = n.match(/^grad(R|L|T|B|BR|BL|TR|TL)$/))) {
|
|
383
|
+
const dir = GRAD_DIRS[m[1]];
|
|
384
|
+
return `background-image:linear-gradient(${dir},var(--d-grad-stops,transparent,transparent))`;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// (x) Gradient from/via/to
|
|
388
|
+
if ((m = n.match(/^(from|via|to)(Primary|Accent|Tertiary|Success|Warning|Error|Info|Bg|Surface1|Transparent)$/))) {
|
|
389
|
+
const color = GRAD_COLORS[m[2]];
|
|
390
|
+
if (m[1] === 'from') return `--d-grad-from:${color};--d-grad-stops:var(--d-grad-from),var(--d-grad-to,transparent)`;
|
|
391
|
+
if (m[1] === 'via') return `--d-grad-stops:var(--d-grad-from,transparent),${color},var(--d-grad-to,transparent)`;
|
|
392
|
+
return `--d-grad-to:${color}`;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
// (y) Backdrop filter: bfblur, bfsat, bfbright
|
|
396
|
+
if ((m = n.match(/^bfblur(\d+)$/))) {
|
|
397
|
+
const v = BF_BLUR[Number(m[1])];
|
|
398
|
+
if (v !== undefined) return `--d-bf-blur:${v};${BF}`;
|
|
399
|
+
}
|
|
400
|
+
if ((m = n.match(/^bfsat(\d+)$/))) {
|
|
401
|
+
const v = BF_SAT[Number(m[1])];
|
|
402
|
+
if (v !== undefined) return `--d-bf-sat:${v};${BF}`;
|
|
403
|
+
}
|
|
404
|
+
if ((m = n.match(/^bfbright(\d+)$/))) {
|
|
405
|
+
const v = BF_BRIGHT[Number(m[1])];
|
|
406
|
+
if (v !== undefined) return `--d-bf-bright:${v};${BF}`;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// (z) bgSurface convenience: bgSurface0-3
|
|
410
|
+
if ((m = n.match(/^bgSurface(\d)$/))) {
|
|
411
|
+
const num = Number(m[1]);
|
|
412
|
+
if (num >= 0 && num <= 3) return `background:var(--d-surface-${num})`;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
return null;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// ─── RESIDUAL — compound atoms that can't be computed ───────────
|
|
419
|
+
const RESIDUAL = {
|
|
420
|
+
truncate: 'overflow:hidden;text-overflow:ellipsis;white-space:nowrap',
|
|
421
|
+
clamp2: 'display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden',
|
|
422
|
+
clamp3: 'display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden',
|
|
423
|
+
srOnly: 'position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0',
|
|
424
|
+
disabled: 'opacity:var(--d-disabled-opacity);cursor:not-allowed;pointer-events:none',
|
|
425
|
+
// Typography presets
|
|
426
|
+
heading1: 'font-size:var(--d-text-4xl,2.5rem);font-weight:var(--d-fw-heading,700);line-height:var(--d-lh-tight,1.1);letter-spacing:var(--d-ls-heading,-0.025em)',
|
|
427
|
+
heading2: 'font-size:var(--d-text-3xl,2rem);font-weight:var(--d-fw-heading,700);line-height:var(--d-lh-tight,1.1);letter-spacing:var(--d-ls-heading,-0.025em)',
|
|
428
|
+
heading3: 'font-size:var(--d-text-2xl,1.5rem);font-weight:var(--d-fw-heading,700);line-height:var(--d-lh-snug,1.25);letter-spacing:var(--d-ls-heading,-0.025em)',
|
|
429
|
+
heading4: 'font-size:var(--d-text-xl,1.25rem);font-weight:var(--d-fw-title,600);line-height:var(--d-lh-snug,1.25)',
|
|
430
|
+
heading5: 'font-size:var(--d-text-lg,1.125rem);font-weight:var(--d-fw-title,600);line-height:var(--d-lh-snug,1.25)',
|
|
431
|
+
heading6: 'font-size:var(--d-text-md,1rem);font-weight:var(--d-fw-title,600);line-height:var(--d-lh-normal,1.5)',
|
|
432
|
+
body: 'font-size:var(--d-text-base,0.875rem);line-height:var(--d-lh-normal,1.5)',
|
|
433
|
+
bodylg: 'font-size:var(--d-text-md,1rem);line-height:var(--d-lh-relaxed,1.6)',
|
|
434
|
+
caption: 'font-size:var(--d-text-sm,0.75rem);line-height:var(--d-lh-normal,1.5);color:var(--d-muted-fg)',
|
|
435
|
+
label: 'font-size:var(--d-text-sm,0.75rem);font-weight:var(--d-fw-medium,500);line-height:var(--d-lh-none,1)',
|
|
436
|
+
overline: 'font-size:var(--d-text-xs,0.625rem);font-weight:var(--d-fw-medium,500);line-height:var(--d-lh-none,1);text-transform:uppercase;letter-spacing:0.08em',
|
|
437
|
+
// Field/state
|
|
438
|
+
field: 'background:var(--d-field-bg);border:var(--d-field-border-width) var(--d-border-style) var(--d-field-border);border-radius:var(--d-field-radius)',
|
|
439
|
+
fieldFilled: '--d-field-bg:var(--d-surface-1);--d-field-border:transparent',
|
|
440
|
+
fieldGhost: '--d-field-bg:transparent;--d-field-border:transparent',
|
|
441
|
+
hoverBg: 'background:var(--d-item-hover-bg)',
|
|
442
|
+
activeBg: 'background:var(--d-item-active-bg)',
|
|
443
|
+
selectedBg: 'background:var(--d-selected-bg)',
|
|
444
|
+
selectedFg: 'color:var(--d-selected-fg)',
|
|
445
|
+
proseWidth: 'max-width:var(--d-prose-width)',
|
|
446
|
+
// Gradient presets
|
|
447
|
+
gradbrand: 'background:var(--d-gradient-brand)',
|
|
448
|
+
gradbrandalt: 'background:var(--d-gradient-brand-alt)',
|
|
449
|
+
gradbrandfull: 'background:var(--d-gradient-brand-full)',
|
|
450
|
+
gradsurface: 'background:var(--d-gradient-surface)',
|
|
451
|
+
gradoverlay: 'background:var(--d-gradient-overlay)',
|
|
452
|
+
gradtext: 'background:var(--d-gradient-text);-webkit-background-clip:text;-webkit-text-fill-color:transparent',
|
|
453
|
+
gradtextalt: 'background:var(--d-gradient-text-alt);-webkit-background-clip:text;-webkit-text-fill-color:transparent',
|
|
454
|
+
// Miscellaneous
|
|
455
|
+
bgOverlay: 'background:var(--d-overlay)',
|
|
456
|
+
rounded: 'border-radius:var(--d-radius)',
|
|
457
|
+
bgTransparent: 'background:transparent',
|
|
458
|
+
outlineNone: 'outline:none',
|
|
459
|
+
borderB: 'border-bottom:1px solid var(--d-border)',
|
|
460
|
+
borderT: 'border-top:1px solid var(--d-border)',
|
|
461
|
+
borderR: 'border-right:1px solid var(--d-border)',
|
|
462
|
+
borderL: 'border-left:1px solid var(--d-border)',
|
|
463
|
+
borderBorder: 'border-color:var(--d-border)',
|
|
464
|
+
overflowX: 'overflow-x:auto',
|
|
465
|
+
// Regular filters
|
|
466
|
+
fblur4: 'filter:blur(4px)', fblur8: 'filter:blur(8px)', fblur16: 'filter:blur(16px)',
|
|
467
|
+
fgray: 'filter:grayscale(1)', fgray50: 'filter:grayscale(0.5)', finvert: 'filter:invert(1)',
|
|
468
|
+
fbright50: 'filter:brightness(0.5)', fbright75: 'filter:brightness(0.75)', fbright110: 'filter:brightness(1.1)',
|
|
469
|
+
// Ring utilities (focus indicators, decorative outlines)
|
|
470
|
+
ring1: 'box-shadow:0 0 0 1px var(--d-ring)',
|
|
471
|
+
ring2: 'box-shadow:0 0 0 2px var(--d-ring)',
|
|
472
|
+
ring4: 'box-shadow:0 0 0 4px var(--d-ring)',
|
|
473
|
+
ring0: 'box-shadow:none',
|
|
474
|
+
ringPrimary: '--d-ring:var(--d-primary)',
|
|
475
|
+
ringAccent: '--d-ring:var(--d-accent)',
|
|
476
|
+
ringBorder: '--d-ring:var(--d-border)',
|
|
477
|
+
// Transition-property shortcuts
|
|
478
|
+
transColors: 'transition:color 0.2s ease,background-color 0.2s ease,border-color 0.2s ease,fill 0.2s ease,stroke 0.2s ease',
|
|
479
|
+
transOpacity: 'transition:opacity 0.2s ease',
|
|
480
|
+
transTransform: 'transition:transform 0.2s ease',
|
|
481
|
+
transShadow: 'transition:box-shadow 0.2s ease',
|
|
482
|
+
// Text wrapping
|
|
483
|
+
textBalance: 'text-wrap:balance',
|
|
484
|
+
textPretty: 'text-wrap:pretty',
|
|
485
|
+
// Scroll behavior
|
|
486
|
+
scrollSmooth: 'scroll-behavior:smooth',
|
|
487
|
+
// Component-class atoms (resolved as class passthrough, CSS comes from components.js)
|
|
488
|
+
// _prose → adds 'd-prose' class
|
|
489
|
+
// _divideY → adds 'd-divide-y' class
|
|
490
|
+
// _divideX → adds 'd-divide-x' class
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
// ─── ALIASES — long-form → canonical (both with leading _) ──────
|
|
494
|
+
export const ALIASES = {
|
|
495
|
+
// Grid columns: _gridCols1 → _gc1 ... _gridCols12 → _gc12
|
|
496
|
+
...Object.fromEntries(Array.from({ length: 12 }, (_, i) => [`_gridCols${i + 1}`, `_gc${i + 1}`])),
|
|
497
|
+
'_gridColsNone': '_gcnone',
|
|
498
|
+
// Grid rows: _gridRows1 → _gr1 ... _gridRows6 → _gr6
|
|
499
|
+
...Object.fromEntries(Array.from({ length: 6 }, (_, i) => [`_gridRows${i + 1}`, `_gr${i + 1}`])),
|
|
500
|
+
// Text decoration
|
|
501
|
+
'_noDecoration': '_nounder',
|
|
502
|
+
// Border shortcuts
|
|
503
|
+
'_border': '_b1',
|
|
504
|
+
'_borderColor': '_bcborder',
|
|
505
|
+
// Border radius
|
|
506
|
+
'_radius': '_r1',
|
|
507
|
+
'_radiusFull': '_rfull',
|
|
508
|
+
'_radiusCircle': '_rcircle',
|
|
509
|
+
...Object.fromEntries(Array.from({ length: 9 }, (_, i) => [`_radius${i}`, `_r${i}`])),
|
|
510
|
+
// Layout/Flexbox
|
|
511
|
+
'_flexCol': '_col', '_flexRow': '_row',
|
|
512
|
+
'_flexWrap': '_wrap', '_flexNowrap': '_nowrap',
|
|
513
|
+
'_flexGrow': '_grow', '_flexShrink': '_shrink',
|
|
514
|
+
'_flexNone': '_flexnone', '_flexAuto': '_flexauto',
|
|
515
|
+
// Alignment
|
|
516
|
+
'_itemsCenter': '_aic', '_itemsStart': '_aifs', '_itemsEnd': '_aife',
|
|
517
|
+
'_itemsStretch': '_ais', '_itemsBaseline': '_aibs',
|
|
518
|
+
'_justifyCenter': '_jcc', '_justifyBetween': '_jcsb',
|
|
519
|
+
'_justifyAround': '_jcsa', '_justifyEvenly': '_jcse',
|
|
520
|
+
'_justifyStart': '_jcfs', '_justifyEnd': '_jcfe',
|
|
521
|
+
'_selfCenter': '_asc', '_selfStart': '_asfs', '_selfEnd': '_asfe',
|
|
522
|
+
// Sizing (case-sensitivity fix)
|
|
523
|
+
'_wFull': '_wfull', '_hFull': '_hfull',
|
|
524
|
+
'_wScreen': '_wscreen', '_hScreen': '_hscreen',
|
|
525
|
+
'_wAuto': '_wauto', '_hAuto': '_hauto',
|
|
526
|
+
'_wFit': '_wfit', '_hFit': '_hfit',
|
|
527
|
+
'_minWFull': '_minwfull', '_maxWFull': '_mwfull',
|
|
528
|
+
// Text/typography
|
|
529
|
+
'_textCenter': '_tc', '_textRight': '_tr', '_textLeft': '_tl',
|
|
530
|
+
'_uppercase': '_upper', '_lowercase': '_lower', '_capitalize': '_cap',
|
|
531
|
+
'_fontBold': '_bold', '_fontMedium': '_medium', '_fontMono': '_fontmono',
|
|
532
|
+
// Overflow
|
|
533
|
+
'_overflowHidden': '_ohidden', '_overflowAuto': '_oauto',
|
|
534
|
+
'_overflowScroll': '_oscroll', '_overflowVisible': '_ovisible',
|
|
535
|
+
'_overflowXHidden': '_oxhidden', '_overflowXAuto': '_oxauto',
|
|
536
|
+
'_overflowYHidden': '_oyhidden', '_overflowYAuto': '_oyauto',
|
|
537
|
+
'_overflowYScroll': '_oyscroll',
|
|
538
|
+
// Cursor/interaction
|
|
539
|
+
'_cursor': '_pointer', '_cursorPointer': '_pointer', '_cursorGrab': '_grab',
|
|
540
|
+
// Transition
|
|
541
|
+
'_transAll': '_trans',
|
|
542
|
+
// Visibility
|
|
543
|
+
'_hidden': '_none',
|
|
544
|
+
// Auto-margin
|
|
545
|
+
'_mlAuto': '_mla', '_mrAuto': '_mra', '_mxAuto': '_mxa',
|
|
546
|
+
// Field/state aliases
|
|
547
|
+
'_fieldOutlined': '_field',
|
|
548
|
+
// Case-fix aliases for Error
|
|
549
|
+
'_bgError': '_bgerror',
|
|
550
|
+
'_fgError': '_fgerror',
|
|
551
|
+
|
|
552
|
+
// ── Tailwind-compatible aliases (bridge for LLM training data) ──
|
|
553
|
+
// Layout / Flexbox
|
|
554
|
+
'_flex-col': '_col', '_flex-row': '_row',
|
|
555
|
+
'_flex-wrap': '_wrap', '_flex-nowrap': '_nowrap',
|
|
556
|
+
'_flex-1': '_flex1', '_flex-none': '_flexnone', '_flex-auto': '_flexauto',
|
|
557
|
+
'_flex-grow': '_grow', '_flex-shrink': '_shrink',
|
|
558
|
+
// Alignment
|
|
559
|
+
'_items-center': '_aic', '_items-start': '_aifs', '_items-end': '_aife',
|
|
560
|
+
'_items-stretch': '_ais', '_items-baseline': '_aibs',
|
|
561
|
+
'_justify-center': '_jcc', '_justify-between': '_jcsb',
|
|
562
|
+
'_justify-around': '_jcsa', '_justify-evenly': '_jcse',
|
|
563
|
+
'_justify-start': '_jcfs', '_justify-end': '_jcfe',
|
|
564
|
+
'_self-center': '_asc', '_self-start': '_asfs', '_self-end': '_asfe',
|
|
565
|
+
'_place-center': '_pic', '_place-items-center': '_pic',
|
|
566
|
+
// Sizing
|
|
567
|
+
'_w-full': '_wfull', '_h-full': '_hfull',
|
|
568
|
+
'_w-screen': '_wscreen', '_h-screen': '_hscreen',
|
|
569
|
+
'_w-auto': '_wauto', '_h-auto': '_hauto',
|
|
570
|
+
'_w-fit': '_wfit', '_h-fit': '_hfit',
|
|
571
|
+
'_min-h-screen': '_minhscreen', '_min-w-full': '_minwfull',
|
|
572
|
+
'_max-w-full': '_mwfull',
|
|
573
|
+
// Typography
|
|
574
|
+
'_text-center': '_tc', '_text-left': '_tl', '_text-right': '_tr',
|
|
575
|
+
'_font-bold': '_bold', '_font-medium': '_medium',
|
|
576
|
+
'_font-normal': '_normal', '_font-light': '_light',
|
|
577
|
+
'_font-mono': '_fontmono',
|
|
578
|
+
'_text-xs': '_textxs', '_text-sm': '_textsm', '_text-base': '_textbase',
|
|
579
|
+
'_text-lg': '_textlg', '_text-xl': '_textxl', '_text-2xl': '_text2xl',
|
|
580
|
+
'_text-3xl': '_text3xl', '_text-4xl': '_text4xl',
|
|
581
|
+
'_leading-tight': '_lhtight', '_leading-normal': '_lhnormal',
|
|
582
|
+
'_leading-relaxed': '_lhrelaxed', '_leading-loose': '_lhloose',
|
|
583
|
+
'_tracking-tight': '_lsheading',
|
|
584
|
+
'_uppercase': '_upper', '_lowercase': '_lower', '_capitalize': '_cap',
|
|
585
|
+
'_line-through': '_strike', '_no-underline': '_nounder',
|
|
586
|
+
'_line-clamp-2': '_clamp2', '_line-clamp-3': '_clamp3',
|
|
587
|
+
'_whitespace-nowrap': '_wsnw',
|
|
588
|
+
// Spacing (hyphenated: _p-4 → _p4, etc.)
|
|
589
|
+
...Object.fromEntries([0,1,2,3,4,5,6,7,8,9,10,11,12].flatMap(n => [
|
|
590
|
+
[`_p-${n}`, `_p${n}`], [`_px-${n}`, `_px${n}`], [`_py-${n}`, `_py${n}`],
|
|
591
|
+
[`_m-${n}`, `_m${n}`], [`_mx-${n}`, `_mx${n}`], [`_my-${n}`, `_my${n}`],
|
|
592
|
+
[`_gap-${n}`, `_gap${n}`]
|
|
593
|
+
])),
|
|
594
|
+
// Borders / Radius
|
|
595
|
+
'_border': '_b1', '_border-0': '_b0', '_border-2': '_b2',
|
|
596
|
+
'_rounded-full': '_rfull',
|
|
597
|
+
'_rounded-sm': '_r1', '_rounded-md': '_r2', '_rounded-lg': '_r4',
|
|
598
|
+
'_rounded-xl': '_r6', '_rounded-2xl': '_r8', '_rounded-none': '_r0',
|
|
599
|
+
// Shadows
|
|
600
|
+
'_shadow-md': '_shadowmd', '_shadow-lg': '_shadowlg',
|
|
601
|
+
'_shadow-none': '_shadowno',
|
|
602
|
+
// Colors (Tailwind-style semantic)
|
|
603
|
+
'_bg-primary': '_bgprimary', '_bg-accent': '_bgaccent',
|
|
604
|
+
'_bg-success': '_bgsuccess', '_bg-warning': '_bgwarning', '_bg-error': '_bgerror',
|
|
605
|
+
'_bg-muted': '_bgmuted', '_bg-transparent': '_bgTransparent',
|
|
606
|
+
'_text-primary': '_fgprimary', '_text-accent': '_fgaccent',
|
|
607
|
+
'_text-muted': '_fgmuted', '_text-muted-foreground': '_fgmutedfg',
|
|
608
|
+
'_text-success': '_fgsuccess', '_text-warning': '_fgwarning', '_text-error': '_fgerror',
|
|
609
|
+
'_border-border': '_bcborder', '_border-strong': '_bcstrong',
|
|
610
|
+
// Overflow
|
|
611
|
+
'_overflow-hidden': '_ohidden', '_overflow-auto': '_oauto',
|
|
612
|
+
'_overflow-scroll': '_oscroll', '_overflow-visible': '_ovisible',
|
|
613
|
+
'_overflow-x-hidden': '_oxhidden', '_overflow-x-auto': '_oxauto',
|
|
614
|
+
'_overflow-y-hidden': '_oyhidden', '_overflow-y-auto': '_oyauto',
|
|
615
|
+
// Position
|
|
616
|
+
// Position (only add aliases that differ from canonical names)
|
|
617
|
+
'_inset-0': '_inset0', '_top-0': '_top0', '_right-0': '_right0',
|
|
618
|
+
'_bottom-0': '_bottom0', '_left-0': '_left0',
|
|
619
|
+
// Transition
|
|
620
|
+
'_transition': '_trans', '_transition-all': '_trans', '_transition-none': '_transnone',
|
|
621
|
+
// Cursor
|
|
622
|
+
'_cursor-pointer': '_pointer', '_cursor-grab': '_grab',
|
|
623
|
+
// Visibility
|
|
624
|
+
'_sr-only': '_srOnly',
|
|
625
|
+
// Grid
|
|
626
|
+
'_grid-cols-1': '_gc1', '_grid-cols-2': '_gc2', '_grid-cols-3': '_gc3',
|
|
627
|
+
'_grid-cols-4': '_gc4', '_grid-cols-6': '_gc6', '_grid-cols-12': '_gc12',
|
|
628
|
+
'_col-span-1': '_span1', '_col-span-2': '_span2', '_col-span-3': '_span3',
|
|
629
|
+
'_col-span-4': '_span4', '_col-span-6': '_span6', '_col-span-full': '_spanfull',
|
|
630
|
+
// Opacity
|
|
631
|
+
'_opacity-0': '_op0', '_opacity-50': '_op5', '_opacity-100': '_op10',
|
|
632
|
+
};
|
|
633
|
+
|
|
634
|
+
// ─── Main resolver ──────────────────────────────────────────────
|
|
635
|
+
export function resolveAtomDecl(name) {
|
|
636
|
+
// Alias resolution (aliases include underscore prefix)
|
|
637
|
+
if (ALIASES[name]) return resolveAtomDecl(ALIASES[name]);
|
|
638
|
+
|
|
639
|
+
// Strip leading underscore
|
|
640
|
+
const n = name.startsWith('_') ? name.slice(1) : name;
|
|
641
|
+
|
|
642
|
+
// DIRECT lookup
|
|
643
|
+
if (DIRECT[n] !== undefined) return DIRECT[n];
|
|
644
|
+
|
|
645
|
+
// Algorithmic resolution
|
|
646
|
+
const algo = resolveAlgorithmic(n);
|
|
647
|
+
if (algo) return algo;
|
|
648
|
+
|
|
649
|
+
// Residual
|
|
650
|
+
return RESIDUAL[n] || null;
|
|
651
|
+
}
|