@elmethis/core 0.24.0 → 0.25.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.
@@ -142,7 +142,7 @@
142
142
  },
143
143
  "children": {
144
144
  "$ref": "#/$defs/ChildList",
145
- "description": "Defines the children. Use an array of strings for a fixed set of children, or a template object to generate children from a data list. Children cannot be defined inline, they must be referred to by ID."
145
+ "description": "REF:#/$defs/ChildList|Defines the children. Use an array of strings for a fixed set of children, or a template object to generate children from a data list. Children cannot be defined inline, they must be referred to by ID."
146
146
  },
147
147
  "justify": {
148
148
  "type": "string",
@@ -0,0 +1,124 @@
1
+ ---
2
+ version: alpha
3
+ name: Elmethis Dark
4
+ description: Elmethis semantic design system resolved for the dark color scheme.
5
+ omitted:
6
+ - section: rounded
7
+ reason: "@elmethis/core does not define a global corner-radius scale."
8
+ - section: components
9
+ reason: Framework components consume shared semantic tokens but core defines no component-token map.
10
+ colors:
11
+ box-shadow: "#242629"
12
+ accent-link-surface: "#3a3f48"
13
+ accent-link: "#68779f"
14
+ accent-link-visited: "#8d799f"
15
+ accent-link-surface-visited: "#3a3341"
16
+ accent-info: "#68779f"
17
+ accent-info-surface: "#3a3f48"
18
+ accent-success: "#659878"
19
+ accent-success-surface: "#333d37"
20
+ accent-important: "#8d799f"
21
+ accent-important-surface: "#3a3341"
22
+ accent-warning: "#b09a66"
23
+ accent-warning-surface: "#4a463b"
24
+ accent-error: "#ae6e6e"
25
+ accent-error-surface: "#3b2e2d"
26
+ divider: "#31353a"
27
+ modal-backdrop: "#00000080"
28
+ surface-sunken: "#31353a"
29
+ surface-base: "#393e46"
30
+ surface-raised: "#40444c"
31
+ neutral: "#b0b5be"
32
+ neutral-weak: "#949ba7"
33
+ neutral-strong: "#d7d9e1"
34
+ primary: "#c6b5a2"
35
+ primary-weak: "#bda68b"
36
+ primary-strong: "#cabfb2"
37
+ primary-hover: "#c6b5a226"
38
+ selection: "#c6b5a240"
39
+ display-red: "#ae6e6e"
40
+ display-red-surface: "#211817"
41
+ display-orange: "#b8816e"
42
+ display-orange-surface: "#352a26"
43
+ display-yellow: "#b09a66"
44
+ display-yellow-surface: "#2f2c24"
45
+ display-green: "#659878"
46
+ display-green-surface: "#1e2521"
47
+ display-cyan: "#6091a0"
48
+ display-cyan-surface: "#2d3836"
49
+ display-blue: "#68779f"
50
+ display-blue-surface: "#292d34"
51
+ display-purple: "#8d799f"
52
+ display-purple-surface: "#231d2a"
53
+ display-magenta: "#b17396"
54
+ display-magenta-surface: "#32262c"
55
+ typography:
56
+ sans:
57
+ fontFamily: '"DM Sans", "Zen Kaku Gothic New", -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif'
58
+ monospace:
59
+ fontFamily: '"DM Mono", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", "Zen Kaku Gothic New", monospace'
60
+ spacing:
61
+ stack-gap: 2rem
62
+ ---
63
+
64
+ # Elmethis Dark
65
+
66
+ ## Overview
67
+
68
+ Elmethis is a small, restrained design system for content-forward interfaces. This document resolves its semantic tokens for the dark color scheme. Let an element's role determine its appearance; do not choose a hue before deciding what the element means.
69
+
70
+ The frontmatter values are design context, not application CSS. Implementations must use the matching `--elmethis-*` custom properties from `@elmethis/core/tokens.css` so they continue to follow the published theme.
71
+
72
+ ## Colors
73
+
74
+ Choose color in this order: semantic role, display preset, then a primitive only when no public role applies. Primitive colors are deliberately absent from this document because appearance-based names are not stable component contracts.
75
+
76
+ - Use `neutral` for body text, `neutral-weak` for secondary text, and `neutral-strong` for headings and emphasis.
77
+ - Use `surface-base` for the page, `surface-raised` for containers, `surface-sunken` for inset regions, and `divider` for borders and separators.
78
+ - Pair each `accent-{role}` foreground with its `accent-{role}-surface`. Available roles are link, info, success, important, warning, and error.
79
+ - Reserve `display-{color}` and its matching surface for charts, legends, swatches, or content where the color itself is meaningful. Never substitute a display color for a semantic status.
80
+ - A frontmatter token such as `surface-base` maps to the CSS property `--elmethis-color-surface-base`.
81
+
82
+ ## Typography
83
+
84
+ Use the sans family for interfaces and prose. Use monospace only for code, identifiers, and fixed-width data. Applications must reference `--elmethis-font-family-sans` and `--elmethis-font-family-monospace` rather than repeating the resolved stacks.
85
+
86
+ Elmethis core defines font families but not a universal size, weight, or line-height scale. Preserve the hierarchy of the host component or product instead of inventing a core typography scale.
87
+
88
+ ## Layout
89
+
90
+ Use explicit layout containers and `gap` for rhythm between sibling blocks. The `stack-gap` token is the standard separation for Elmethis content stacks; do not emulate it with leading margins on leaf components.
91
+
92
+ Elmethis core does not prescribe a page grid or a complete spacing scale. Keep layouts responsive, preserve readable line lengths, and derive product-level spacing decisions consistently from the surrounding interface.
93
+
94
+ ## Elevation & Depth
95
+
96
+ Prefer tonal surfaces and the `divider` token over shadows. When elevation is necessary, use the smallest shadow that communicates the relationship:
97
+
98
+ - Small: `0 0 1px #242629`
99
+ - Medium: `0 0 2px #242629`
100
+ - Large: `0 0 4px #242629`
101
+
102
+ These resolved values correspond to `--elmethis-box-shadow-small`, `--elmethis-box-shadow-medium`, and `--elmethis-box-shadow-large`. Use those properties in CSS rather than copying the values.
103
+
104
+ ## Shapes
105
+
106
+ Elmethis core intentionally defines no global corner-radius scale. Keep geometry restrained and component-specific. Do not impose pill shapes, excessive rounding, or a new universal radius without a product-level design requirement.
107
+
108
+ ## Components
109
+
110
+ Build components from semantic roles: base and raised surfaces establish containment, dividers establish separation, neutral roles establish text hierarchy, and accent pairs establish interactive or status meaning.
111
+
112
+ Keep focus visible with a primary-colored outline. Pair status color with an icon or text label, and test content in both color schemes. Component implementations should consume the public CSS properties rather than the resolved literals in this file.
113
+
114
+ ## Do's and Don'ts
115
+
116
+ - Do use semantic colors whenever a role fits.
117
+ - Do use matching accent foreground and surface pairs.
118
+ - Do reserve display colors for visualization and intentionally color-named content.
119
+ - Do prefer dividers and tonal surfaces over unnecessary elevation.
120
+ - Do test focus visibility, text contrast, status cues, and both color schemes.
121
+ - Don't copy resolved colors, font stacks, or shadows into application CSS.
122
+ - Don't use primitives where a semantic or display token applies.
123
+ - Don't communicate state through color alone.
124
+ - Don't add component-level light and dark overrides for behavior already provided by Elmethis tokens.
@@ -0,0 +1,124 @@
1
+ ---
2
+ version: alpha
3
+ name: Elmethis Light
4
+ description: Elmethis semantic design system resolved for the light color scheme.
5
+ omitted:
6
+ - section: rounded
7
+ reason: "@elmethis/core does not define a global corner-radius scale."
8
+ - section: components
9
+ reason: Framework components consume shared semantic tokens but core defines no component-token map.
10
+ colors:
11
+ box-shadow: "#3e434b40"
12
+ accent-link-surface: "#e0e2e5"
13
+ accent-link: "#68779f"
14
+ accent-link-visited: "#8d799f"
15
+ accent-link-surface-visited: "#e1dfe4"
16
+ accent-info: "#68779f"
17
+ accent-info-surface: "#e0e2e5"
18
+ accent-success: "#659878"
19
+ accent-success-surface: "#e2e7e4"
20
+ accent-important: "#8d799f"
21
+ accent-important-surface: "#e1dfe4"
22
+ accent-warning: "#b09a66"
23
+ accent-warning-surface: "#e8e6e2"
24
+ accent-error: "#ae6e6e"
25
+ accent-error-surface: "#e4dfdf"
26
+ divider: "#d9d3cc"
27
+ modal-backdrop: "#00000080"
28
+ surface-sunken: "#d9d3cc"
29
+ surface-base: "#efecea"
30
+ surface-raised: "#f7f5f4"
31
+ neutral: "#6c7483"
32
+ neutral-weak: "#949ba7"
33
+ neutral-strong: "#555b67"
34
+ primary: "#a68c70"
35
+ primary-weak: "#bda68b"
36
+ primary-strong: "#8e7356"
37
+ primary-hover: "#a68c7026"
38
+ selection: "#a68c7040"
39
+ display-red: "#ae6e6e"
40
+ display-red-surface: "#e4dfdf"
41
+ display-orange: "#b8816e"
42
+ display-orange-surface: "#e6e1df"
43
+ display-yellow: "#b09a66"
44
+ display-yellow-surface: "#e8e6e2"
45
+ display-green: "#659878"
46
+ display-green-surface: "#e2e7e4"
47
+ display-cyan: "#6091a0"
48
+ display-cyan-surface: "#e2e7e6"
49
+ display-blue: "#68779f"
50
+ display-blue-surface: "#e0e2e5"
51
+ display-purple: "#8d799f"
52
+ display-purple-surface: "#e1dfe4"
53
+ display-magenta: "#b17396"
54
+ display-magenta-surface: "#e4dfe2"
55
+ typography:
56
+ sans:
57
+ fontFamily: '"DM Sans", "Zen Kaku Gothic New", -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif'
58
+ monospace:
59
+ fontFamily: '"DM Mono", "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", "Zen Kaku Gothic New", monospace'
60
+ spacing:
61
+ stack-gap: 2rem
62
+ ---
63
+
64
+ # Elmethis Light
65
+
66
+ ## Overview
67
+
68
+ Elmethis is a small, restrained design system for content-forward interfaces. This document resolves its semantic tokens for the light color scheme. Let an element's role determine its appearance; do not choose a hue before deciding what the element means.
69
+
70
+ The frontmatter values are design context, not application CSS. Implementations must use the matching `--elmethis-*` custom properties from `@elmethis/core/tokens.css` so they continue to follow the published theme.
71
+
72
+ ## Colors
73
+
74
+ Choose color in this order: semantic role, display preset, then a primitive only when no public role applies. Primitive colors are deliberately absent from this document because appearance-based names are not stable component contracts.
75
+
76
+ - Use `neutral` for body text, `neutral-weak` for secondary text, and `neutral-strong` for headings and emphasis.
77
+ - Use `surface-base` for the page, `surface-raised` for containers, `surface-sunken` for inset regions, and `divider` for borders and separators.
78
+ - Pair each `accent-{role}` foreground with its `accent-{role}-surface`. Available roles are link, info, success, important, warning, and error.
79
+ - Reserve `display-{color}` and its matching surface for charts, legends, swatches, or content where the color itself is meaningful. Never substitute a display color for a semantic status.
80
+ - A frontmatter token such as `surface-base` maps to the CSS property `--elmethis-color-surface-base`.
81
+
82
+ ## Typography
83
+
84
+ Use the sans family for interfaces and prose. Use monospace only for code, identifiers, and fixed-width data. Applications must reference `--elmethis-font-family-sans` and `--elmethis-font-family-monospace` rather than repeating the resolved stacks.
85
+
86
+ Elmethis core defines font families but not a universal size, weight, or line-height scale. Preserve the hierarchy of the host component or product instead of inventing a core typography scale.
87
+
88
+ ## Layout
89
+
90
+ Use explicit layout containers and `gap` for rhythm between sibling blocks. The `stack-gap` token is the standard separation for Elmethis content stacks; do not emulate it with leading margins on leaf components.
91
+
92
+ Elmethis core does not prescribe a page grid or a complete spacing scale. Keep layouts responsive, preserve readable line lengths, and derive product-level spacing decisions consistently from the surrounding interface.
93
+
94
+ ## Elevation & Depth
95
+
96
+ Prefer tonal surfaces and the `divider` token over shadows. When elevation is necessary, use the smallest shadow that communicates the relationship:
97
+
98
+ - Small: `0 0 1px #3e434b40`
99
+ - Medium: `0 0 2px #3e434b40`
100
+ - Large: `0 0 4px #3e434b40`
101
+
102
+ These resolved values correspond to `--elmethis-box-shadow-small`, `--elmethis-box-shadow-medium`, and `--elmethis-box-shadow-large`. Use those properties in CSS rather than copying the values.
103
+
104
+ ## Shapes
105
+
106
+ Elmethis core intentionally defines no global corner-radius scale. Keep geometry restrained and component-specific. Do not impose pill shapes, excessive rounding, or a new universal radius without a product-level design requirement.
107
+
108
+ ## Components
109
+
110
+ Build components from semantic roles: base and raised surfaces establish containment, dividers establish separation, neutral roles establish text hierarchy, and accent pairs establish interactive or status meaning.
111
+
112
+ Keep focus visible with a primary-colored outline. Pair status color with an icon or text label, and test content in both color schemes. Component implementations should consume the public CSS properties rather than the resolved literals in this file.
113
+
114
+ ## Do's and Don'ts
115
+
116
+ - Do use semantic colors whenever a role fits.
117
+ - Do use matching accent foreground and surface pairs.
118
+ - Do reserve display colors for visualization and intentionally color-named content.
119
+ - Do prefer dividers and tonal surfaces over unnecessary elevation.
120
+ - Do test focus visibility, text contrast, status cues, and both color schemes.
121
+ - Don't copy resolved colors, font stacks, or shadows into application CSS.
122
+ - Don't use primitives where a semantic or display token applies.
123
+ - Don't communicate state through color alone.
124
+ - Don't add component-level light and dark overrides for behavior already provided by Elmethis tokens.
package/dist/index.cjs CHANGED
@@ -562,8 +562,15 @@ function inlineZod(schema) {
562
562
  });
563
563
  return rest;
564
564
  }
565
- const FINGERPRINT_TO_REF = /* @__PURE__ */ new Map();
566
- for (const [name, schema] of COMMON_BY_REF) FINGERPRINT_TO_REF.set(fingerprint(inlineZod(schema)), name);
565
+ let fingerprintToRef;
566
+ function getFingerprintToRef() {
567
+ if (fingerprintToRef === void 0) {
568
+ const refs = /* @__PURE__ */ new Map();
569
+ for (const [name, schema] of COMMON_BY_REF) refs.set(fingerprint(inlineZod(schema)), name);
570
+ fingerprintToRef = refs;
571
+ }
572
+ return fingerprintToRef;
573
+ }
567
574
  /**
568
575
  * Walks a JSON Schema subtree. Whenever it finds a node whose structural
569
576
  * fingerprint matches a registered common type, it replaces that node with
@@ -575,7 +582,7 @@ function collapseCommonRefs(node) {
575
582
  if (Array.isArray(node)) return node.map(collapseCommonRefs);
576
583
  if (!node || typeof node !== "object") return node;
577
584
  const obj = node;
578
- const refName = FINGERPRINT_TO_REF.get(fingerprint(obj));
585
+ const refName = getFingerprintToRef().get(fingerprint(obj));
579
586
  if (refName !== void 0) {
580
587
  const description = obj.description;
581
588
  return description !== void 0 ? {
@@ -589,7 +596,8 @@ function collapseCommonRefs(node) {
589
596
  }
590
597
  const FACTORED_OUT_KEYS = /* @__PURE__ */ new Set(["accessibility", "weight"]);
591
598
  function buildComponentSchema(api) {
592
- const inner = (0, zod_to_json_schema.zodToJsonSchema)(zod.z.object({ x: api.schema }), {
599
+ const wrapped = zod.z.object({ x: api.schema });
600
+ const inner = (0, zod_to_json_schema.zodToJsonSchema)(wrapped, {
593
601
  $refStrategy: "none",
594
602
  target: "jsonSchema7"
595
603
  }).properties?.x ?? {};
@@ -644,13 +652,14 @@ function assembleCatalog(envelope, components) {
644
652
  /**
645
653
  * Method A — runtime catalog constant.
646
654
  *
647
- * Assembles the Notion block catalog from the `*Api` Zod definitions into a
648
- * freestanding A2UI v0.9 catalog JSON Schema document. Consumers that want
649
- * the catalog at runtime (e.g. to feed into an LLM system prompt or to
650
- * validate an inbound A2UI message) import `notionBlockCatalogJson` directly.
655
+ * Exposes the Notion block catalog as a freestanding A2UI v0.9 JSON Schema
656
+ * document. Assembly is deferred until `components` or `$defs` is accessed,
657
+ * so consumers importing only metadata do not run schema generation.
658
+ * Consumers that need the schema at runtime (e.g. for an LLM system prompt
659
+ * or inbound message validation) can serialize this object normally.
651
660
  *
652
661
  * Consumers that want the document as a hostable artifact use Method B:
653
- * `dist/a2ui/notion_block_catalog.json` is emitted at build time from this
662
+ * `dist/a2ui/v0_9/notion_block_catalog.json` is emitted at build time from this
654
663
  * same constant and is served at the URL identified by
655
664
  * `NOTION_BLOCK_CATALOG_ID`.
656
665
  */
@@ -692,11 +701,34 @@ const NOTION_BLOCK_CATALOG_COMPONENTS = [
692
701
  TableCellApi,
693
702
  UnsupportedApi
694
703
  ];
695
- const notionBlockCatalogJson = assembleCatalog({
704
+ const envelope = {
696
705
  id: NOTION_BLOCK_CATALOG_ID,
697
706
  title: "Elmethis Notion Block Catalog",
698
707
  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."
699
- }, NOTION_BLOCK_CATALOG_COMPONENTS);
708
+ };
709
+ let assembledCatalog;
710
+ function getCatalog() {
711
+ return assembledCatalog ??= assembleCatalog(envelope, NOTION_BLOCK_CATALOG_COMPONENTS);
712
+ }
713
+ const notionBlockCatalogJson = {
714
+ $schema: "https://json-schema.org/draft/2020-12/schema",
715
+ $id: envelope.id,
716
+ catalogId: envelope.id,
717
+ title: envelope.title,
718
+ description: envelope.description,
719
+ get components() {
720
+ return getCatalog().components;
721
+ },
722
+ set components(value) {
723
+ getCatalog().components = value;
724
+ },
725
+ get $defs() {
726
+ return getCatalog().$defs;
727
+ },
728
+ set $defs(value) {
729
+ getCatalog().$defs = value;
730
+ }
731
+ };
700
732
  //#endregion
701
733
  //#region src/icon/languages/registry.ts
702
734
  /**