@elmethis/core 0.23.0 → 0.24.1

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/dist/index.mjs CHANGED
@@ -561,8 +561,15 @@ function inlineZod(schema) {
561
561
  });
562
562
  return rest;
563
563
  }
564
- const FINGERPRINT_TO_REF = /* @__PURE__ */ new Map();
565
- for (const [name, schema] of COMMON_BY_REF) FINGERPRINT_TO_REF.set(fingerprint(inlineZod(schema)), name);
564
+ let fingerprintToRef;
565
+ function getFingerprintToRef() {
566
+ if (fingerprintToRef === void 0) {
567
+ const refs = /* @__PURE__ */ new Map();
568
+ for (const [name, schema] of COMMON_BY_REF) refs.set(fingerprint(inlineZod(schema)), name);
569
+ fingerprintToRef = refs;
570
+ }
571
+ return fingerprintToRef;
572
+ }
566
573
  /**
567
574
  * Walks a JSON Schema subtree. Whenever it finds a node whose structural
568
575
  * fingerprint matches a registered common type, it replaces that node with
@@ -574,7 +581,7 @@ function collapseCommonRefs(node) {
574
581
  if (Array.isArray(node)) return node.map(collapseCommonRefs);
575
582
  if (!node || typeof node !== "object") return node;
576
583
  const obj = node;
577
- const refName = FINGERPRINT_TO_REF.get(fingerprint(obj));
584
+ const refName = getFingerprintToRef().get(fingerprint(obj));
578
585
  if (refName !== void 0) {
579
586
  const description = obj.description;
580
587
  return description !== void 0 ? {
@@ -588,7 +595,8 @@ function collapseCommonRefs(node) {
588
595
  }
589
596
  const FACTORED_OUT_KEYS = /* @__PURE__ */ new Set(["accessibility", "weight"]);
590
597
  function buildComponentSchema(api) {
591
- const inner = zodToJsonSchema(z.object({ x: api.schema }), {
598
+ const wrapped = z.object({ x: api.schema });
599
+ const inner = zodToJsonSchema(wrapped, {
592
600
  $refStrategy: "none",
593
601
  target: "jsonSchema7"
594
602
  }).properties?.x ?? {};
@@ -643,13 +651,14 @@ function assembleCatalog(envelope, components) {
643
651
  /**
644
652
  * Method A — runtime catalog constant.
645
653
  *
646
- * Assembles the Notion block catalog from the `*Api` Zod definitions into a
647
- * freestanding A2UI v0.9 catalog JSON Schema document. Consumers that want
648
- * the catalog at runtime (e.g. to feed into an LLM system prompt or to
649
- * validate an inbound A2UI message) import `notionBlockCatalogJson` directly.
654
+ * Exposes the Notion block catalog as a freestanding A2UI v0.9 JSON Schema
655
+ * document. Assembly is deferred until `components` or `$defs` is accessed,
656
+ * so consumers importing only metadata do not run schema generation.
657
+ * Consumers that need the schema at runtime (e.g. for an LLM system prompt
658
+ * or inbound message validation) can serialize this object normally.
650
659
  *
651
660
  * Consumers that want the document as a hostable artifact use Method B:
652
- * `dist/a2ui/notion_block_catalog.json` is emitted at build time from this
661
+ * `dist/a2ui/v0_9/notion_block_catalog.json` is emitted at build time from this
653
662
  * same constant and is served at the URL identified by
654
663
  * `NOTION_BLOCK_CATALOG_ID`.
655
664
  */
@@ -659,11 +668,7 @@ function assembleCatalog(envelope, components) {
659
668
  * third-party agents and validators that look up `catalogId`.
660
669
  */
661
670
  const NOTION_BLOCK_CATALOG_ID = "https://46ki75.github.io/elmethis/a2ui/v0_9/notion_block_catalog.json";
662
- const notionBlockCatalogJson = assembleCatalog({
663
- id: NOTION_BLOCK_CATALOG_ID,
664
- title: "Elmethis Notion Block Catalog",
665
- description: "Notion block-level A2UI components used by the @elmethis renderers (typography, media, code, math, table, tabs). Extends — does not replace — the A2UI Basic Catalog."
666
- }, [
671
+ const NOTION_BLOCK_CATALOG_COMPONENTS = [
667
672
  RichTextApi,
668
673
  LinkTextApi,
669
674
  IconApi,
@@ -694,7 +699,35 @@ const notionBlockCatalogJson = assembleCatalog({
694
699
  TableRowApi,
695
700
  TableCellApi,
696
701
  UnsupportedApi
697
- ]);
702
+ ];
703
+ const envelope = {
704
+ id: NOTION_BLOCK_CATALOG_ID,
705
+ title: "Elmethis Notion Block Catalog",
706
+ description: "Notion block-level A2UI components used by the @elmethis renderers (typography, media, code, math, table, tabs). Extends — does not replace — the A2UI Basic Catalog."
707
+ };
708
+ let assembledCatalog;
709
+ function getCatalog() {
710
+ return assembledCatalog ??= assembleCatalog(envelope, NOTION_BLOCK_CATALOG_COMPONENTS);
711
+ }
712
+ const notionBlockCatalogJson = {
713
+ $schema: "https://json-schema.org/draft/2020-12/schema",
714
+ $id: envelope.id,
715
+ catalogId: envelope.id,
716
+ title: envelope.title,
717
+ description: envelope.description,
718
+ get components() {
719
+ return getCatalog().components;
720
+ },
721
+ set components(value) {
722
+ getCatalog().components = value;
723
+ },
724
+ get $defs() {
725
+ return getCatalog().$defs;
726
+ },
727
+ set $defs(value) {
728
+ getCatalog().$defs = value;
729
+ }
730
+ };
698
731
  //#endregion
699
732
  //#region src/icon/languages/registry.ts
700
733
  /**
@@ -0,0 +1,32 @@
1
+ //#region src/style/stylelint.ts
2
+ const stylelintConfig = {
3
+ extends: ["stylelint-config-standard", "stylelint-config-css-modules"],
4
+ plugins: ["stylelint-value-no-unknown-custom-properties"],
5
+ rules: {
6
+ "color-no-hex": [true, {
7
+ message: "Use an Elmethis color token instead of a hex color",
8
+ severity: "error"
9
+ }],
10
+ "color-named": ["never", {
11
+ message: "Use an Elmethis color token instead of a named color",
12
+ severity: "error"
13
+ }],
14
+ "declaration-property-value-disallowed-list": [{ "/.*/": ["/(?<![-\\w])(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)\\((?!\\s*from\\b)/i"] }, {
15
+ message: "Use an Elmethis color token instead of a color function",
16
+ severity: "error"
17
+ }],
18
+ "declaration-property-value-allowed-list": [{ "box-shadow": [
19
+ "var(--elmethis-box-shadow-small)",
20
+ "var(--elmethis-box-shadow-medium)",
21
+ "var(--elmethis-box-shadow-large)",
22
+ "none"
23
+ ] }, {
24
+ message: "Use an Elmethis box-shadow token",
25
+ severity: "error"
26
+ }],
27
+ "selector-class-pattern": ["^[a-z][a-z0-9]*(?:-[a-z0-9]+)*(?:__[a-z0-9]+(?:-[a-z0-9]+)*)?(?:--[a-z0-9]+(?:-[a-z0-9]+)*)?$", { message: "Expected class selector to be kebab-case with optional BEM '__element' and/or '--modifier' suffix" }],
28
+ "no-descending-specificity": null
29
+ }
30
+ };
31
+ //#endregion
32
+ module.exports = stylelintConfig;
@@ -0,0 +1,38 @@
1
+ //#region src/style/stylelint.d.ts
2
+ declare const stylelintConfig: {
3
+ extends: string[];
4
+ plugins: string[];
5
+ rules: {
6
+ "color-no-hex": (boolean | {
7
+ message: string;
8
+ severity: string;
9
+ })[];
10
+ "color-named": (string | {
11
+ message: string;
12
+ severity: string;
13
+ })[];
14
+ "declaration-property-value-disallowed-list": ({
15
+ "/.*/": string[];
16
+ message?: undefined;
17
+ severity?: undefined;
18
+ } | {
19
+ message: string;
20
+ severity: string;
21
+ "/.*/"?: undefined;
22
+ })[];
23
+ "declaration-property-value-allowed-list": ({
24
+ "box-shadow": string[];
25
+ message?: undefined;
26
+ severity?: undefined;
27
+ } | {
28
+ message: string;
29
+ severity: string;
30
+ "box-shadow"?: undefined;
31
+ })[];
32
+ "selector-class-pattern": (string | {
33
+ message: string;
34
+ })[];
35
+ "no-descending-specificity": null;
36
+ };
37
+ };
38
+ export = stylelintConfig;
@@ -0,0 +1,39 @@
1
+ //#region src/style/stylelint.d.ts
2
+ declare const stylelintConfig: {
3
+ extends: string[];
4
+ plugins: string[];
5
+ rules: {
6
+ "color-no-hex": (boolean | {
7
+ message: string;
8
+ severity: string;
9
+ })[];
10
+ "color-named": (string | {
11
+ message: string;
12
+ severity: string;
13
+ })[];
14
+ "declaration-property-value-disallowed-list": ({
15
+ "/.*/": string[];
16
+ message?: undefined;
17
+ severity?: undefined;
18
+ } | {
19
+ message: string;
20
+ severity: string;
21
+ "/.*/"?: undefined;
22
+ })[];
23
+ "declaration-property-value-allowed-list": ({
24
+ "box-shadow": string[];
25
+ message?: undefined;
26
+ severity?: undefined;
27
+ } | {
28
+ message: string;
29
+ severity: string;
30
+ "box-shadow"?: undefined;
31
+ })[];
32
+ "selector-class-pattern": (string | {
33
+ message: string;
34
+ })[];
35
+ "no-descending-specificity": null;
36
+ };
37
+ };
38
+ //#endregion
39
+ export { stylelintConfig as default };
@@ -0,0 +1,32 @@
1
+ //#region src/style/stylelint.ts
2
+ const stylelintConfig = {
3
+ extends: ["stylelint-config-standard", "stylelint-config-css-modules"],
4
+ plugins: ["stylelint-value-no-unknown-custom-properties"],
5
+ rules: {
6
+ "color-no-hex": [true, {
7
+ message: "Use an Elmethis color token instead of a hex color",
8
+ severity: "error"
9
+ }],
10
+ "color-named": ["never", {
11
+ message: "Use an Elmethis color token instead of a named color",
12
+ severity: "error"
13
+ }],
14
+ "declaration-property-value-disallowed-list": [{ "/.*/": ["/(?<![-\\w])(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)\\((?!\\s*from\\b)/i"] }, {
15
+ message: "Use an Elmethis color token instead of a color function",
16
+ severity: "error"
17
+ }],
18
+ "declaration-property-value-allowed-list": [{ "box-shadow": [
19
+ "var(--elmethis-box-shadow-small)",
20
+ "var(--elmethis-box-shadow-medium)",
21
+ "var(--elmethis-box-shadow-large)",
22
+ "none"
23
+ ] }, {
24
+ message: "Use an Elmethis box-shadow token",
25
+ severity: "error"
26
+ }],
27
+ "selector-class-pattern": ["^[a-z][a-z0-9]*(?:-[a-z0-9]+)*(?:__[a-z0-9]+(?:-[a-z0-9]+)*)?(?:--[a-z0-9]+(?:-[a-z0-9]+)*)?$", { message: "Expected class selector to be kebab-case with optional BEM '__element' and/or '--modifier' suffix" }],
28
+ "no-descending-specificity": null
29
+ }
30
+ };
31
+ //#endregion
32
+ export { stylelintConfig as default };
@@ -0,0 +1,201 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/style/color-scale.ts
3
+ const parseHex = (hex) => {
4
+ if (!/^#[\da-f]{6}$/i.test(hex)) throw new Error(`Expected a six-digit hex color, received ${hex}`);
5
+ return [
6
+ Number.parseInt(hex.slice(1, 3), 16) / 255,
7
+ Number.parseInt(hex.slice(3, 5), 16) / 255,
8
+ Number.parseInt(hex.slice(5, 7), 16) / 255
9
+ ];
10
+ };
11
+ const srgbToLinear = (channel) => channel <= .04045 ? channel / 12.92 : ((channel + .055) / 1.055) ** 2.4;
12
+ const linearToSrgb = (channel) => channel <= .0031308 ? channel * 12.92 : 1.055 * channel ** (1 / 2.4) - .055;
13
+ const hexToOklab = (hex) => {
14
+ const [encodedRed, encodedGreen, encodedBlue] = parseHex(hex);
15
+ const red = srgbToLinear(encodedRed);
16
+ const green = srgbToLinear(encodedGreen);
17
+ const blue = srgbToLinear(encodedBlue);
18
+ const lightness = Math.cbrt(.4122214708 * red + .5363325363 * green + .0514459929 * blue);
19
+ const medium = Math.cbrt(.2119034982 * red + .6806995451 * green + .1073969566 * blue);
20
+ const short = Math.cbrt(.0883024619 * red + .2817188376 * green + .6299787005 * blue);
21
+ return [
22
+ .2104542553 * lightness + .793617785 * medium - .0040720468 * short,
23
+ 1.9779984951 * lightness - 2.428592205 * medium + .4505937099 * short,
24
+ .0259040371 * lightness + .7827717662 * medium - .808675766 * short
25
+ ];
26
+ };
27
+ const oklabToHex = ([lightness, a, b]) => {
28
+ const light = (lightness + .3963377774 * a + .2158037573 * b) ** 3;
29
+ const medium = (lightness - .1055613458 * a - .0638541728 * b) ** 3;
30
+ const short = (lightness - .0894841775 * a - 1.291485548 * b) ** 3;
31
+ return `#${[
32
+ 4.0767416621 * light - 3.3077115913 * medium + .2309699292 * short,
33
+ -1.2684380046 * light + 2.6097574011 * medium - .3413193965 * short,
34
+ -.0041960863 * light - .7034186147 * medium + 1.707614701 * short
35
+ ].map(linearToSrgb).map((channel) => Math.min(1, Math.max(0, channel))).map((channel) => Math.round(channel * 255).toString(16).padStart(2, "0")).join("")}`;
36
+ };
37
+ const interpolateOklab = (start, end, amount) => oklabToHex([
38
+ start[0] + (end[0] - start[0]) * amount,
39
+ start[1] + (end[1] - start[1]) * amount,
40
+ start[2] + (end[2] - start[2]) * amount
41
+ ]);
42
+ /**
43
+ * Expands the authored 100/500/900 anchors into a perceptually even ramp.
44
+ * OKLab avoids the muddy midpoints produced by interpolating encoded sRGB.
45
+ */
46
+ const createColorScale = (light, middle, dark) => {
47
+ const lightOklab = hexToOklab(light);
48
+ const middleOklab = hexToOklab(middle);
49
+ const darkOklab = hexToOklab(dark);
50
+ return {
51
+ 100: light.toLowerCase(),
52
+ 200: interpolateOklab(lightOklab, middleOklab, .25),
53
+ 300: interpolateOklab(lightOklab, middleOklab, .5),
54
+ 400: interpolateOklab(lightOklab, middleOklab, .75),
55
+ 500: middle.toLowerCase(),
56
+ 600: interpolateOklab(middleOklab, darkOklab, .25),
57
+ 700: interpolateOklab(middleOklab, darkOklab, .5),
58
+ 800: interpolateOklab(middleOklab, darkOklab, .75),
59
+ 900: dark.toLowerCase()
60
+ };
61
+ };
62
+ //#endregion
63
+ //#region src/style/token.ts
64
+ const PRIMITIVE_VALUES = {
65
+ color: {
66
+ red: createColorScale("#e9dddd", "#ae6e6e", "#291313"),
67
+ orange: createColorScale("#ebdfdb", "#b8816e", "#3f251c"),
68
+ yellow: createColorScale("#ebe6db", "#b09a66", "#332b19"),
69
+ green: createColorScale("#dde9e2", "#659878", "#15281d"),
70
+ cyan: createColorScale("#dde9e7", "#6091a0", "#203b37"),
71
+ blue: createColorScale("#dde2e9", "#68779f", "#242d3e"),
72
+ purple: createColorScale("#e3dde9", "#8d799f", "#271836"),
73
+ magenta: createColorScale("#eadce4", "#b17396", "#3c1f2f"),
74
+ slate: {
75
+ 100: "#d7d9e1",
76
+ 200: "#b0b5be",
77
+ 300: "#949ba7",
78
+ 400: "#6c7483",
79
+ 500: "#555b67",
80
+ 600: "#40444c",
81
+ 700: "#393e46",
82
+ 800: "#31353a",
83
+ 900: "#242629"
84
+ },
85
+ gold: {
86
+ 100: "#f7f5f4",
87
+ 200: "#efecea",
88
+ 300: "#d9d3cc",
89
+ 400: "#cabfb2",
90
+ 500: "#c6b5a2",
91
+ 600: "#bda68b",
92
+ 700: "#a68c70",
93
+ 800: "#8e7356",
94
+ 900: "#6e583f"
95
+ }
96
+ },
97
+ font: { family: {
98
+ sans: "\"DM Sans\", \"Zen Kaku Gothic New\", -apple-system, BlinkMacSystemFont, \"Hiragino Kaku Gothic ProN\", Meiryo, sans-serif",
99
+ monospace: "\"DM Mono\", \"Source Code Pro\", Menlo, Consolas, \"DejaVu Sans Mono\", \"Zen Kaku Gothic New\", monospace"
100
+ } }
101
+ };
102
+ const makePrimitive = (path, value) => {
103
+ const property = `--elmethis-primitive-${path.join("-")}`;
104
+ return {
105
+ property,
106
+ value,
107
+ ref: `var(${property})`
108
+ };
109
+ };
110
+ const buildPrimitives = (values, path) => {
111
+ const out = {};
112
+ for (const [key, value] of Object.entries(values)) {
113
+ const next = [...path, key];
114
+ out[key] = typeof value === "string" ? makePrimitive(next, value) : buildPrimitives(value, next);
115
+ }
116
+ return out;
117
+ };
118
+ /** Primitive tokens, addressable as `primitive.color.blue[500]`. */
119
+ const primitive = buildPrimitives(PRIMITIVE_VALUES, []);
120
+ const resolve = (ref) => typeof ref === "string" ? ref : ref.ref;
121
+ /** A theme-independent semantic value. */
122
+ const common = (ref) => ({ common: resolve(ref) });
123
+ /** A native `light-dark()` semantic value. */
124
+ const theme = (light, dark) => ({
125
+ light: resolve(light),
126
+ dark: resolve(dark)
127
+ });
128
+ const { color, font } = primitive;
129
+ /**
130
+ * Semantic tokens, keyed by the full kebab suffix that follows `--elmethis-`
131
+ * (so `"color-accent-info-surface"` emits `--elmethis-color-accent-info-surface`).
132
+ *
133
+ * Flat keys keep a 1:1 mapping to the emitted CSS and sidestep the
134
+ * leaf-vs-group ambiguity a nested tree creates for base/variant pairs — e.g.
135
+ * `color-neutral` coexisting with `color-neutral-weak`. References to the
136
+ * primitive layer are symbolic (`PrimitiveToken.ref`), never resolved values.
137
+ */
138
+ const semanticTokens = {
139
+ /**
140
+ * Vertical rhythm between stacked blocks. Applied as `gap` on an explicit
141
+ * flex-column "stack" container (e.g. each framework's `ElmA2ui` surface,
142
+ * `ElmMarkdown`, and container child slots like Callout/BlockQuote/Toggle/
143
+ * TabPanel) — never as a leading margin on individual leaf components.
144
+ * `gap` only ever applies between items, so there's no first-child case to
145
+ * special-case and no risk of a standalone/nested component floating an
146
+ * unexplained gap above it.
147
+ */
148
+ "stack-gap": common("2rem"),
149
+ "box-shadow-small": common("0 0 1px var(--elmethis-color-box-shadow)"),
150
+ "box-shadow-medium": common("0 0 2px var(--elmethis-color-box-shadow)"),
151
+ "box-shadow-large": common("0 0 4px var(--elmethis-color-box-shadow)"),
152
+ "font-family-sans": common(font.family.sans),
153
+ "font-family-monospace": common(font.family.monospace),
154
+ "color-box-shadow": theme("oklch(from #3e434b l c h / 0.25)", color.slate[900]),
155
+ "color-accent-link-surface": theme(color.blue[100], color.blue[900]),
156
+ "color-accent-link": common(color.blue[500]),
157
+ "color-accent-link-visited": common(color.purple[500]),
158
+ "color-accent-link-surface-visited": theme(color.purple[100], color.purple[900]),
159
+ "color-accent-info": common(color.blue[500]),
160
+ "color-accent-info-surface": theme(color.blue[100], color.blue[900]),
161
+ "color-accent-success": common(color.green[500]),
162
+ "color-accent-success-surface": theme(color.green[100], color.green[900]),
163
+ "color-accent-important": common(color.purple[500]),
164
+ "color-accent-important-surface": theme(color.purple[100], color.purple[900]),
165
+ "color-accent-warning": common(color.yellow[500]),
166
+ "color-accent-warning-surface": theme(color.yellow[100], color.yellow[900]),
167
+ "color-accent-error": common(color.red[500]),
168
+ "color-accent-error-surface": theme(color.red[100], color.red[900]),
169
+ "color-divider": theme(color.gold[300], color.slate[800]),
170
+ "color-modal-backdrop": common("oklch(from black l c h / 50%)"),
171
+ "color-surface-sunken": theme(color.gold[300], color.slate[800]),
172
+ "color-surface-base": theme(color.gold[200], color.slate[700]),
173
+ "color-surface-raised": theme(color.gold[100], color.slate[600]),
174
+ "color-neutral": theme(color.slate[400], color.slate[200]),
175
+ "color-neutral-weak": common(color.slate[300]),
176
+ "color-neutral-strong": theme(color.slate[500], color.slate[100]),
177
+ "color-primary": theme(color.gold[700], color.gold[500]),
178
+ "color-primary-weak": common(color.gold[600]),
179
+ "color-primary-strong": theme(color.gold[800], color.gold[400]),
180
+ "color-primary-hover": common("oklch(from var(--elmethis-color-primary) l c h / 15%)"),
181
+ "color-selection": common("oklch(from var(--elmethis-color-primary) l c h / 25%)"),
182
+ "color-display-red": common(color.red[500]),
183
+ "color-display-red-surface": theme(color.red[100], color.red[900]),
184
+ "color-display-orange": common(color.orange[500]),
185
+ "color-display-orange-surface": theme(color.orange[100], color.orange[900]),
186
+ "color-display-yellow": common(color.yellow[500]),
187
+ "color-display-yellow-surface": theme(color.yellow[100], color.yellow[900]),
188
+ "color-display-green": common(color.green[500]),
189
+ "color-display-green-surface": theme(color.green[100], color.green[900]),
190
+ "color-display-cyan": common(color.cyan[500]),
191
+ "color-display-cyan-surface": theme(color.cyan[100], color.cyan[900]),
192
+ "color-display-blue": common(color.blue[500]),
193
+ "color-display-blue-surface": theme(color.blue[100], color.blue[900]),
194
+ "color-display-purple": common(color.purple[500]),
195
+ "color-display-purple-surface": theme(color.purple[100], color.purple[900]),
196
+ "color-display-magenta": common(color.magenta[500]),
197
+ "color-display-magenta-surface": theme(color.magenta[100], color.magenta[900])
198
+ };
199
+ //#endregion
200
+ exports.primitive = primitive;
201
+ exports.semanticTokens = semanticTokens;
package/dist/tokens.css CHANGED
@@ -1,27 +1,75 @@
1
1
  :root {
2
2
  --elmethis-primitive-color-red-100: #e9dddd;
3
+ --elmethis-primitive-color-red-200: #dbc1c0;
4
+ --elmethis-primitive-color-red-300: #cda5a4;
5
+ --elmethis-primitive-color-red-400: #be8989;
3
6
  --elmethis-primitive-color-red-500: #ae6e6e;
7
+ --elmethis-primitive-color-red-600: #8a5555;
8
+ --elmethis-primitive-color-red-700: #683e3e;
9
+ --elmethis-primitive-color-red-800: #472727;
4
10
  --elmethis-primitive-color-red-900: #291313;
5
11
  --elmethis-primitive-color-orange-100: #ebdfdb;
12
+ --elmethis-primitive-color-orange-200: #dfc7bf;
13
+ --elmethis-primitive-color-orange-300: #d2afa3;
14
+ --elmethis-primitive-color-orange-400: #c59888;
6
15
  --elmethis-primitive-color-orange-500: #b8816e;
16
+ --elmethis-primitive-color-orange-600: #986858;
17
+ --elmethis-primitive-color-orange-700: #795143;
18
+ --elmethis-primitive-color-orange-800: #5b3a2f;
7
19
  --elmethis-primitive-color-orange-900: #3f251c;
8
20
  --elmethis-primitive-color-yellow-100: #ebe6db;
21
+ --elmethis-primitive-color-yellow-200: #dcd3be;
22
+ --elmethis-primitive-color-yellow-300: #cdc0a0;
23
+ --elmethis-primitive-color-yellow-400: #bfad83;
9
24
  --elmethis-primitive-color-yellow-500: #b09a66;
25
+ --elmethis-primitive-color-yellow-600: #8e7c51;
26
+ --elmethis-primitive-color-yellow-700: #6e603d;
27
+ --elmethis-primitive-color-yellow-800: #50442b;
10
28
  --elmethis-primitive-color-yellow-900: #332b19;
11
29
  --elmethis-primitive-color-green-100: #dde9e2;
30
+ --elmethis-primitive-color-green-200: #bfd4c7;
31
+ --elmethis-primitive-color-green-300: #a1c0ac;
32
+ --elmethis-primitive-color-green-400: #83ac92;
12
33
  --elmethis-primitive-color-green-500: #659878;
34
+ --elmethis-primitive-color-green-600: #4f7a5f;
35
+ --elmethis-primitive-color-green-700: #3b5d48;
36
+ --elmethis-primitive-color-green-800: #274232;
13
37
  --elmethis-primitive-color-green-900: #15281d;
14
38
  --elmethis-primitive-color-cyan-100: #dde9e7;
39
+ --elmethis-primitive-color-cyan-200: #bdd2d5;
40
+ --elmethis-primitive-color-cyan-300: #9ebcc3;
41
+ --elmethis-primitive-color-cyan-400: #7fa6b1;
15
42
  --elmethis-primitive-color-cyan-500: #6091a0;
43
+ --elmethis-primitive-color-cyan-600: #4f7a84;
44
+ --elmethis-primitive-color-cyan-700: #3f6469;
45
+ --elmethis-primitive-color-cyan-800: #2f4f4f;
16
46
  --elmethis-primitive-color-cyan-900: #203b37;
17
47
  --elmethis-primitive-color-blue-100: #dde2e9;
48
+ --elmethis-primitive-color-blue-200: #bec6d6;
49
+ --elmethis-primitive-color-blue-300: #a1abc4;
50
+ --elmethis-primitive-color-blue-400: #8491b2;
18
51
  --elmethis-primitive-color-blue-500: #68779f;
52
+ --elmethis-primitive-color-blue-600: #566385;
53
+ --elmethis-primitive-color-blue-700: #45516d;
54
+ --elmethis-primitive-color-blue-800: #343e55;
19
55
  --elmethis-primitive-color-blue-900: #242d3e;
20
56
  --elmethis-primitive-color-purple-100: #e3dde9;
57
+ --elmethis-primitive-color-purple-200: #cdc3d6;
58
+ --elmethis-primitive-color-purple-300: #b7aac4;
59
+ --elmethis-primitive-color-purple-400: #a291b1;
21
60
  --elmethis-primitive-color-purple-500: #8d799f;
61
+ --elmethis-primitive-color-purple-600: #725f83;
62
+ --elmethis-primitive-color-purple-700: #574668;
63
+ --elmethis-primitive-color-purple-800: #3e2e4f;
22
64
  --elmethis-primitive-color-purple-900: #271836;
23
65
  --elmethis-primitive-color-magenta-100: #eadce4;
66
+ --elmethis-primitive-color-magenta-200: #dcc1d0;
67
+ --elmethis-primitive-color-magenta-300: #cea7bc;
68
+ --elmethis-primitive-color-magenta-400: #c08da9;
24
69
  --elmethis-primitive-color-magenta-500: #b17396;
70
+ --elmethis-primitive-color-magenta-600: #925d7a;
71
+ --elmethis-primitive-color-magenta-700: #744760;
72
+ --elmethis-primitive-color-magenta-800: #573247;
25
73
  --elmethis-primitive-color-magenta-900: #3c1f2f;
26
74
  --elmethis-primitive-color-slate-100: #d7d9e1;
27
75
  --elmethis-primitive-color-slate-200: #b0b5be;
@@ -0,0 +1,140 @@
1
+ //#region src/style/color-scale.d.ts
2
+ type ColorStep = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
3
+ //#endregion
4
+ //#region src/style/token.d.ts
5
+ /**
6
+ * Design tokens for `@elmethis/core` — the single source of truth that the
7
+ * vanilla-extract build (`scripts/build-tokens.ts`) emits to `dist/tokens.css`
8
+ * as `--elmethis-*` custom properties: a primitive layer of concrete values
9
+ * and a semantic layer that references it, themed natively via `light-dark()`.
10
+ */
11
+ /** A primitive token knows the custom property that defines it. */
12
+ export interface PrimitiveToken {
13
+ /** e.g. `--elmethis-primitive-color-blue-500` */
14
+ readonly property: string;
15
+ /** the literal value, e.g. `#68779f` */
16
+ readonly value: string;
17
+ /** a `var(--…)` reference for the semantic layer to consume */
18
+ readonly ref: string;
19
+ }
20
+ /** A semantic token is either theme-independent or a `light-dark()` pair. */
21
+ export type SemanticValue = {
22
+ readonly common: string;
23
+ } | {
24
+ readonly light: string;
25
+ readonly dark: string;
26
+ };
27
+ declare const PRIMITIVE_VALUES: {
28
+ readonly color: {
29
+ readonly red: Readonly<Record<ColorStep, string>>;
30
+ readonly orange: Readonly<Record<ColorStep, string>>;
31
+ readonly yellow: Readonly<Record<ColorStep, string>>;
32
+ readonly green: Readonly<Record<ColorStep, string>>;
33
+ readonly cyan: Readonly<Record<ColorStep, string>>;
34
+ readonly blue: Readonly<Record<ColorStep, string>>;
35
+ readonly purple: Readonly<Record<ColorStep, string>>;
36
+ readonly magenta: Readonly<Record<ColorStep, string>>;
37
+ readonly slate: {
38
+ readonly 100: "#d7d9e1";
39
+ readonly 200: "#b0b5be";
40
+ readonly 300: "#949ba7";
41
+ readonly 400: "#6c7483";
42
+ readonly 500: "#555b67";
43
+ readonly 600: "#40444c";
44
+ readonly 700: "#393e46";
45
+ readonly 800: "#31353a";
46
+ readonly 900: "#242629";
47
+ };
48
+ readonly gold: {
49
+ readonly 100: "#f7f5f4";
50
+ readonly 200: "#efecea";
51
+ readonly 300: "#d9d3cc";
52
+ readonly 400: "#cabfb2";
53
+ readonly 500: "#c6b5a2";
54
+ readonly 600: "#bda68b";
55
+ readonly 700: "#a68c70";
56
+ readonly 800: "#8e7356";
57
+ readonly 900: "#6e583f";
58
+ };
59
+ };
60
+ readonly font: {
61
+ readonly family: {
62
+ readonly sans: "\"DM Sans\", \"Zen Kaku Gothic New\", -apple-system, BlinkMacSystemFont, \"Hiragino Kaku Gothic ProN\", Meiryo, sans-serif";
63
+ readonly monospace: "\"DM Mono\", \"Source Code Pro\", Menlo, Consolas, \"DejaVu Sans Mono\", \"Zen Kaku Gothic New\", monospace";
64
+ };
65
+ };
66
+ };
67
+ type PrimitiveTree<T> = { readonly [K in keyof T]: T[K] extends string ? PrimitiveToken : PrimitiveTree<T[K]>; };
68
+ /** Primitive tokens, addressable as `primitive.color.blue[500]`. */
69
+ export declare const primitive: PrimitiveTree<typeof PRIMITIVE_VALUES>;
70
+ /**
71
+ * Semantic tokens, keyed by the full kebab suffix that follows `--elmethis-`
72
+ * (so `"color-accent-info-surface"` emits `--elmethis-color-accent-info-surface`).
73
+ *
74
+ * Flat keys keep a 1:1 mapping to the emitted CSS and sidestep the
75
+ * leaf-vs-group ambiguity a nested tree creates for base/variant pairs — e.g.
76
+ * `color-neutral` coexisting with `color-neutral-weak`. References to the
77
+ * primitive layer are symbolic (`PrimitiveToken.ref`), never resolved values.
78
+ */
79
+ export declare const semanticTokens: {
80
+ /**
81
+ * Vertical rhythm between stacked blocks. Applied as `gap` on an explicit
82
+ * flex-column "stack" container (e.g. each framework's `ElmA2ui` surface,
83
+ * `ElmMarkdown`, and container child slots like Callout/BlockQuote/Toggle/
84
+ * TabPanel) — never as a leading margin on individual leaf components.
85
+ * `gap` only ever applies between items, so there's no first-child case to
86
+ * special-case and no risk of a standalone/nested component floating an
87
+ * unexplained gap above it.
88
+ */
89
+ "stack-gap": SemanticValue;
90
+ "box-shadow-small": SemanticValue;
91
+ "box-shadow-medium": SemanticValue;
92
+ "box-shadow-large": SemanticValue;
93
+ "font-family-sans": SemanticValue;
94
+ "font-family-monospace": SemanticValue;
95
+ "color-box-shadow": SemanticValue;
96
+ "color-accent-link-surface": SemanticValue;
97
+ "color-accent-link": SemanticValue;
98
+ "color-accent-link-visited": SemanticValue;
99
+ "color-accent-link-surface-visited": SemanticValue;
100
+ "color-accent-info": SemanticValue;
101
+ "color-accent-info-surface": SemanticValue;
102
+ "color-accent-success": SemanticValue;
103
+ "color-accent-success-surface": SemanticValue;
104
+ "color-accent-important": SemanticValue;
105
+ "color-accent-important-surface": SemanticValue;
106
+ "color-accent-warning": SemanticValue;
107
+ "color-accent-warning-surface": SemanticValue;
108
+ "color-accent-error": SemanticValue;
109
+ "color-accent-error-surface": SemanticValue;
110
+ "color-divider": SemanticValue;
111
+ "color-modal-backdrop": SemanticValue;
112
+ "color-surface-sunken": SemanticValue;
113
+ "color-surface-base": SemanticValue;
114
+ "color-surface-raised": SemanticValue;
115
+ "color-neutral": SemanticValue;
116
+ "color-neutral-weak": SemanticValue;
117
+ "color-neutral-strong": SemanticValue;
118
+ "color-primary": SemanticValue;
119
+ "color-primary-weak": SemanticValue;
120
+ "color-primary-strong": SemanticValue;
121
+ "color-primary-hover": SemanticValue;
122
+ "color-selection": SemanticValue;
123
+ "color-display-red": SemanticValue;
124
+ "color-display-red-surface": SemanticValue;
125
+ "color-display-orange": SemanticValue;
126
+ "color-display-orange-surface": SemanticValue;
127
+ "color-display-yellow": SemanticValue;
128
+ "color-display-yellow-surface": SemanticValue;
129
+ "color-display-green": SemanticValue;
130
+ "color-display-green-surface": SemanticValue;
131
+ "color-display-cyan": SemanticValue;
132
+ "color-display-cyan-surface": SemanticValue;
133
+ "color-display-blue": SemanticValue;
134
+ "color-display-blue-surface": SemanticValue;
135
+ "color-display-purple": SemanticValue;
136
+ "color-display-purple-surface": SemanticValue;
137
+ "color-display-magenta": SemanticValue;
138
+ "color-display-magenta-surface": SemanticValue;
139
+ };
140
+ //#endregion