@skhema/embed 0.1.8 → 0.1.10
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/README.md +55 -0
- package/dist/components/SkhemaComponent.d.ts +0 -1
- package/dist/components/SkhemaComponent.d.ts.map +1 -1
- package/dist/components/SkhemaElement.d.ts.map +1 -1
- package/dist/embed.min.js +1 -1
- package/dist/embed.min.js.map +1 -1
- package/dist/index-DBeyneZT.cjs +215 -0
- package/dist/index-DBeyneZT.cjs.map +1 -0
- package/dist/index-jwx5CXLB.js +216 -0
- package/dist/index-jwx5CXLB.js.map +1 -0
- package/dist/index.cjs +113 -668
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +83 -637
- package/dist/index.es.js.map +1 -1
- package/dist/render/index.d.ts +55 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render.cjs +7 -0
- package/dist/render.cjs.map +1 -0
- package/dist/render.d.ts +2 -0
- package/dist/render.es.js +7 -0
- package/dist/render.es.js.map +1 -0
- package/dist/styles/design-tokens.d.ts +32 -4
- package/dist/styles/design-tokens.d.ts.map +1 -1
- package/dist/tokens.cjs +16 -0
- package/dist/tokens.cjs.map +1 -0
- package/dist/tokens.d.ts +17 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.es.js +16 -0
- package/dist/tokens.es.js.map +1 -0
- package/dist/utils/color.d.ts +25 -0
- package/dist/utils/color.d.ts.map +1 -0
- package/dist/utils/sanitization.d.ts +7 -1
- package/dist/utils/sanitization.d.ts.map +1 -1
- package/dist/validation-DCw9rQeH.cjs +176 -0
- package/dist/validation-DCw9rQeH.cjs.map +1 -0
- package/dist/validation-Dt4L_df8.js +177 -0
- package/dist/validation-Dt4L_df8.js.map +1 -0
- package/package.json +20 -7
- package/dist/utils/author-attribution.d.ts +0 -16
- package/dist/utils/author-attribution.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
package/dist/render.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -31,6 +31,38 @@ export declare const COMPONENT_COLORS: {
|
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
33
|
export type ComponentColorKey = keyof typeof COMPONENT_COLORS;
|
|
34
|
+
/**
|
|
35
|
+
* Email-safe flat hex palette for the card surface, per theme. These mirror the
|
|
36
|
+
* Tailwind slate values behind the `CARD_VARS` HSL tokens, pre-resolved to hex
|
|
37
|
+
* because email clients ignore `<style>` / CSS vars. The card renderer
|
|
38
|
+
* (`@skhema/embed/render`) inlines these so the live browser embed and email
|
|
39
|
+
* share one colour system (see the "converge on hex" decision).
|
|
40
|
+
*/
|
|
41
|
+
export declare const CARD_PALETTE: {
|
|
42
|
+
readonly light: {
|
|
43
|
+
readonly cardBg: "#ffffff";
|
|
44
|
+
readonly border: "#e2e8f0";
|
|
45
|
+
readonly text: "#020817";
|
|
46
|
+
readonly textMuted: "#64748b";
|
|
47
|
+
};
|
|
48
|
+
readonly dark: {
|
|
49
|
+
readonly cardBg: "#020817";
|
|
50
|
+
readonly border: "#1e293b";
|
|
51
|
+
readonly text: "#f8fafc";
|
|
52
|
+
readonly textMuted: "#94a3b8";
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export type CardTheme = keyof typeof CARD_PALETTE;
|
|
56
|
+
/** Save-button brand colours (hex) — match the `--skhema-primary*` HSL tokens. */
|
|
57
|
+
export declare const PRIMARY_HEX = "#cd476a";
|
|
58
|
+
export declare const PRIMARY_HOVER_HEX = "#b53d5e";
|
|
59
|
+
export declare const PRIMARY_PRESSED_HEX = "#9d3552";
|
|
60
|
+
/** Card geometry / typography shared by the renderer and the browser embed. */
|
|
61
|
+
export declare const CARD_RADIUS = "4px";
|
|
62
|
+
export declare const CARD_SHADOW = "0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1)";
|
|
63
|
+
export declare const CARD_SHADOW_LG = "0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)";
|
|
64
|
+
export declare const FONT_STACK = "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Inter', sans-serif";
|
|
65
|
+
export declare const MONO_STACK = "ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace";
|
|
34
66
|
/**
|
|
35
67
|
* Shared base card CSS variables for light and dark modes.
|
|
36
68
|
*/
|
|
@@ -54,10 +86,6 @@ export declare const CARD_VARS: {
|
|
|
54
86
|
readonly '--skhema-surface-subtle': "hsl(217.2 32.6% 12%)";
|
|
55
87
|
};
|
|
56
88
|
};
|
|
57
|
-
/**
|
|
58
|
-
* Shared card structure styles (used by both SkhemaElement and SkhemaComponent).
|
|
59
|
-
*/
|
|
60
|
-
export declare const SHARED_CARD_STYLES = "\n/* Monospace acronym badge */\n.skhema-acronym-badge {\n display: inline-flex;\n align-items: center;\n font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;\n font-size: 10px;\n font-weight: 600;\n padding: 2px 6px;\n border-radius: 2px;\n letter-spacing: 0.02em;\n flex-shrink: 0;\n}\n\n/* Footer attribution tagline */\n.skhema-footer-attribution {\n font-size: 11px;\n color: var(--skhema-text-muted);\n line-height: 1.4;\n}\n\n.skhema-footer-attribution a {\n color: var(--skhema-text-muted);\n text-decoration: underline;\n text-decoration-color: var(--skhema-border);\n text-underline-offset: 2px;\n}\n\n.skhema-footer-attribution a:hover {\n color: var(--skhema-text);\n}\n\n/* Contributor line in footer */\n.skhema-contributor-line {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 12px;\n color: var(--skhema-text-muted);\n}\n\n.skhema-contributor-line svg {\n width: 14px;\n height: 14px;\n flex-shrink: 0;\n}\n\n.skhema-author-link {\n color: inherit;\n text-decoration: none;\n}\n\n.skhema-author-link:hover {\n color: var(--skhema-text);\n text-decoration: underline;\n}\n\n/* Save button \u2014 primary brand color */\n.skhema-save-btn {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n background: var(--skhema-primary);\n color: white;\n border: none;\n padding: 6px 14px;\n border-radius: calc(var(--skhema-radius) + 2px);\n font-size: 12px;\n font-weight: 500;\n text-decoration: none;\n cursor: pointer;\n transition: background 0.15s ease;\n white-space: nowrap;\n}\n\n.skhema-save-btn:hover {\n background: var(--skhema-primary-hover);\n}\n\n.skhema-save-btn:active {\n background: var(--skhema-primary-pressed);\n}\n\n.skhema-save-btn:focus {\n outline: 2px solid var(--skhema-primary);\n outline-offset: 2px;\n}\n\n.skhema-save-btn::after {\n content: '\\2192';\n font-size: 13px;\n}\n";
|
|
61
89
|
/**
|
|
62
90
|
* User SVG icon (inline, no external deps).
|
|
63
91
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design-tokens.d.ts","sourceRoot":"","sources":["../../src/styles/design-tokens.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BnB,CAAA;AAEV,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,gBAAgB,CAAA;AAE7D
|
|
1
|
+
{"version":3,"file":"design-tokens.d.ts","sourceRoot":"","sources":["../../src/styles/design-tokens.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BnB,CAAA;AAEV,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,gBAAgB,CAAA;AAE7D;;;;;;GAMG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;CAaf,CAAA;AAEV,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,YAAY,CAAA;AAEjD,kFAAkF;AAClF,eAAO,MAAM,WAAW,YAAY,CAAA;AACpC,eAAO,MAAM,iBAAiB,YAAY,CAAA;AAC1C,eAAO,MAAM,mBAAmB,YAAY,CAAA;AAE5C,+EAA+E;AAC/E,eAAO,MAAM,WAAW,QAAQ,CAAA;AAChC,eAAO,MAAM,WAAW,gEACuC,CAAA;AAC/D,eAAO,MAAM,cAAc,qEACyC,CAAA;AACpE,eAAO,MAAM,UAAU,iFACyD,CAAA;AAChF,eAAO,MAAM,UAAU,wEACgD,CAAA;AAEvE;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;CAmBZ,CAAA;AAEV;;GAEG;AACH,eAAO,MAAM,aAAa,kRAA4P,CAAA"}
|
package/dist/tokens.cjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const validation = require("./validation-DCw9rQeH.cjs");
|
|
4
|
+
exports.CARD_VARS = validation.CARD_VARS;
|
|
5
|
+
exports.COMPONENT_COLORS = validation.COMPONENT_COLORS;
|
|
6
|
+
exports.USER_ICON_SVG = validation.USER_ICON_SVG;
|
|
7
|
+
exports.getComponentTypeAcronym = validation.getComponentTypeAcronym;
|
|
8
|
+
exports.getComponentTypeLabel = validation.getComponentTypeLabel;
|
|
9
|
+
exports.getElementTypeAcronym = validation.getElementTypeAcronym;
|
|
10
|
+
exports.getElementTypeLabel = validation.getElementTypeLabel;
|
|
11
|
+
exports.getElementTypesForComponent = validation.getElementTypesForComponent;
|
|
12
|
+
exports.isValidComponentType = validation.isValidComponentType;
|
|
13
|
+
exports.isValidElementType = validation.isValidElementType;
|
|
14
|
+
exports.resolveComponentType = validation.resolveComponentType;
|
|
15
|
+
exports.validateElementBelongsToComponent = validation.validateElementBelongsToComponent;
|
|
16
|
+
//# sourceMappingURL=tokens.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
package/dist/tokens.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM-free entry point for `@skhema/embed`.
|
|
3
|
+
*
|
|
4
|
+
* The package's main barrel (`@skhema/embed`) imports the `SkhemaElement` /
|
|
5
|
+
* `SkhemaComponent` web-component classes, which `extends HTMLElement` at
|
|
6
|
+
* module-evaluation time — that throws in a non-DOM runtime (Node). Server /
|
|
7
|
+
* CLI consumers (e.g. `sk comms curated`) that only need the design tokens and
|
|
8
|
+
* the pure component-type helpers must import them from here instead, so they
|
|
9
|
+
* never load the web components.
|
|
10
|
+
*
|
|
11
|
+
* Everything re-exported below is pure (no DOM, no side effects).
|
|
12
|
+
*/
|
|
13
|
+
export { CARD_VARS, COMPONENT_COLORS, USER_ICON_SVG, } from './styles/design-tokens.js';
|
|
14
|
+
export type { ComponentColorKey } from './styles/design-tokens.js';
|
|
15
|
+
export { getComponentTypeAcronym, getComponentTypeLabel, getElementTypesForComponent, isValidComponentType, resolveComponentType, validateElementBelongsToComponent, } from './utils/component-validation.js';
|
|
16
|
+
export { getElementTypeAcronym, getElementTypeLabel, isValidElementType, } from './utils/validation.js';
|
|
17
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,aAAa,GACd,MAAM,2BAA2B,CAAA;AAClC,YAAY,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAElE,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,2BAA2B,EAC3B,oBAAoB,EACpB,oBAAoB,EACpB,iCAAiC,GAClC,MAAM,iCAAiC,CAAA;AAExC,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,uBAAuB,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { C, a, U, g, b, c, d, e, i, f, r, v } from "./validation-Dt4L_df8.js";
|
|
2
|
+
export {
|
|
3
|
+
C as CARD_VARS,
|
|
4
|
+
a as COMPONENT_COLORS,
|
|
5
|
+
U as USER_ICON_SVG,
|
|
6
|
+
g as getComponentTypeAcronym,
|
|
7
|
+
b as getComponentTypeLabel,
|
|
8
|
+
c as getElementTypeAcronym,
|
|
9
|
+
d as getElementTypeLabel,
|
|
10
|
+
e as getElementTypesForComponent,
|
|
11
|
+
i as isValidComponentType,
|
|
12
|
+
f as isValidElementType,
|
|
13
|
+
r as resolveComponentType,
|
|
14
|
+
v as validateElementBelongsToComponent
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=tokens.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM-free colour utilities for the email-safe card renderer.
|
|
3
|
+
*
|
|
4
|
+
* The card palette (`COMPONENT_COLORS`) is authored in `oklch()` for the live
|
|
5
|
+
* browser embed, but email clients can't parse `oklch()` and `<style>` is
|
|
6
|
+
* stripped, so every colour must be a pre-computed sRGB hex with all styles
|
|
7
|
+
* inlined. This converts a single `oklch(...)` token to hex, compositing any
|
|
8
|
+
* alpha over a flat background (white for light cards, the dark card surface
|
|
9
|
+
* for dark cards) so the result is opaque and email-safe.
|
|
10
|
+
*
|
|
11
|
+
* This is the single source of the conversion that `sk comms curated` and the
|
|
12
|
+
* `CuratedElements` email template previously duplicated.
|
|
13
|
+
*/
|
|
14
|
+
/** Brand pink (hsl(344 57% 54%)) — fallback when a component palette is missing. */
|
|
15
|
+
export declare const BRAND_PINK = "#cd476a";
|
|
16
|
+
/**
|
|
17
|
+
* Convert a single `oklch(...)` token to an email-safe sRGB hex. When the token
|
|
18
|
+
* carries an alpha (e.g. the badge `bg` @ 0.15 / `border` @ 0.3), the colour is
|
|
19
|
+
* composited over `overHex` so the result is a flat opaque hex.
|
|
20
|
+
*
|
|
21
|
+
* @param token An `oklch(L C H)` or `oklch(L C H / A)` string.
|
|
22
|
+
* @param overHex The flat background to composite alpha over (default white).
|
|
23
|
+
*/
|
|
24
|
+
export declare function oklchToHex(token: string, overHex?: string): string;
|
|
25
|
+
//# sourceMappingURL=color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../src/utils/color.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,oFAAoF;AACpF,eAAO,MAAM,UAAU,YAAY,CAAA;AAWnC;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,SAAY,GAAG,MAAM,CAqCrE"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Content sanitization utilities for Skhema
|
|
2
|
+
* Content sanitization utilities for Skhema cards.
|
|
3
|
+
*
|
|
4
|
+
* DOM-free by design: `sanitizeContent` is imported by the email-safe card
|
|
5
|
+
* renderer (`@skhema/embed/render`), which must run in Node / email / CLI
|
|
6
|
+
* runtimes with no `document`. Keep every export here free of DOM access at
|
|
7
|
+
* call time (the legacy `stripHtml` below is the one exception and is not used
|
|
8
|
+
* by the renderer).
|
|
3
9
|
*/
|
|
4
10
|
/**
|
|
5
11
|
* Sanitizes content to prevent XSS attacks and removes URLs
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitization.d.ts","sourceRoot":"","sources":["../../src/utils/sanitization.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sanitization.d.ts","sourceRoot":"","sources":["../../src/utils/sanitization.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAcH;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAcvD;AA4DD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG;IACxD,QAAQ,EAAE,OAAO,CAAA;IACjB,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB,CAqCA;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAIjD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAUrD"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const types = require("@skhema/types");
|
|
3
|
+
const COMPONENT_COLORS = {
|
|
4
|
+
diagnosis: {
|
|
5
|
+
bg: "oklch(0.65 0.06 25 / 0.15)",
|
|
6
|
+
text: "oklch(0.65 0.06 25)",
|
|
7
|
+
border: "oklch(0.65 0.06 25 / 0.3)"
|
|
8
|
+
},
|
|
9
|
+
method: {
|
|
10
|
+
bg: "oklch(0.6 0.06 250 / 0.15)",
|
|
11
|
+
text: "oklch(0.6 0.06 250)",
|
|
12
|
+
border: "oklch(0.6 0.06 250 / 0.3)"
|
|
13
|
+
},
|
|
14
|
+
initiatives: {
|
|
15
|
+
bg: "oklch(0.6 0.06 155 / 0.15)",
|
|
16
|
+
text: "oklch(0.6 0.06 155)",
|
|
17
|
+
border: "oklch(0.6 0.06 155 / 0.3)"
|
|
18
|
+
},
|
|
19
|
+
measures: {
|
|
20
|
+
bg: "oklch(0.6 0.06 300 / 0.15)",
|
|
21
|
+
text: "oklch(0.6 0.06 300)",
|
|
22
|
+
border: "oklch(0.6 0.06 300 / 0.3)"
|
|
23
|
+
},
|
|
24
|
+
support: {
|
|
25
|
+
bg: "oklch(0.65 0.06 65 / 0.15)",
|
|
26
|
+
text: "oklch(0.65 0.06 65)",
|
|
27
|
+
border: "oklch(0.65 0.06 65 / 0.3)"
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const CARD_PALETTE = {
|
|
31
|
+
light: {
|
|
32
|
+
cardBg: "#ffffff",
|
|
33
|
+
// hsl(0 0% 100%)
|
|
34
|
+
border: "#e2e8f0",
|
|
35
|
+
// hsl(214.3 31.8% 91.4%) — slate-200
|
|
36
|
+
text: "#020817",
|
|
37
|
+
// hsl(222.2 84% 4.9%) — slate-950
|
|
38
|
+
textMuted: "#64748b"
|
|
39
|
+
// hsl(215.4 16.3% 46.9%) — slate-500
|
|
40
|
+
},
|
|
41
|
+
dark: {
|
|
42
|
+
cardBg: "#020817",
|
|
43
|
+
// hsl(222.2 84% 4.9%) — slate-950
|
|
44
|
+
border: "#1e293b",
|
|
45
|
+
// hsl(217.2 32.6% 17.5%) — slate-800
|
|
46
|
+
text: "#f8fafc",
|
|
47
|
+
// hsl(210 40% 98%) — slate-50
|
|
48
|
+
textMuted: "#94a3b8"
|
|
49
|
+
// hsl(215 20.2% 65.1%) — slate-400
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const PRIMARY_HEX = "#cd476a";
|
|
53
|
+
const PRIMARY_HOVER_HEX = "#b53d5e";
|
|
54
|
+
const PRIMARY_PRESSED_HEX = "#9d3552";
|
|
55
|
+
const CARD_RADIUS = "4px";
|
|
56
|
+
const CARD_SHADOW = "0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1)";
|
|
57
|
+
const CARD_SHADOW_LG = "0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)";
|
|
58
|
+
const FONT_STACK = "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Inter', sans-serif";
|
|
59
|
+
const MONO_STACK = "ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace";
|
|
60
|
+
const CARD_VARS = {
|
|
61
|
+
light: {
|
|
62
|
+
"--skhema-bg": "hsl(0 0% 100%)",
|
|
63
|
+
"--skhema-card": "hsl(0 0% 100%)",
|
|
64
|
+
"--skhema-border": "hsl(214.3 31.8% 91.4%)",
|
|
65
|
+
"--skhema-text": "hsl(222.2 84% 4.9%)",
|
|
66
|
+
"--skhema-text-muted": "hsl(215.4 16.3% 46.9%)",
|
|
67
|
+
"--skhema-accent": "hsl(210 40% 96%)",
|
|
68
|
+
"--skhema-surface-subtle": "hsl(210 40% 97%)"
|
|
69
|
+
},
|
|
70
|
+
dark: {
|
|
71
|
+
"--skhema-bg": "hsl(222.2 84% 4.9%)",
|
|
72
|
+
"--skhema-card": "hsl(222.2 84% 4.9%)",
|
|
73
|
+
"--skhema-border": "hsl(217.2 32.6% 17.5%)",
|
|
74
|
+
"--skhema-text": "hsl(210 40% 98%)",
|
|
75
|
+
"--skhema-text-muted": "hsl(215 20.2% 65.1%)",
|
|
76
|
+
"--skhema-accent": "hsl(217.2 32.6% 17.5%)",
|
|
77
|
+
"--skhema-surface-subtle": "hsl(217.2 32.6% 12%)"
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const USER_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>`;
|
|
81
|
+
function isValidComponentType(componentType) {
|
|
82
|
+
const validTypes = Object.values(types.COMPONENT_TYPES).map((t) => t.value);
|
|
83
|
+
return validTypes.includes(componentType);
|
|
84
|
+
}
|
|
85
|
+
function validateElementBelongsToComponent(elementType, componentType) {
|
|
86
|
+
if (!isValidComponentType(componentType)) return false;
|
|
87
|
+
const validElements = types.SKHEMA_MAPPING.elementFlow[componentType];
|
|
88
|
+
if (!validElements) return false;
|
|
89
|
+
return validElements.some((e) => e.value === elementType);
|
|
90
|
+
}
|
|
91
|
+
function getComponentTypeLabel(componentType) {
|
|
92
|
+
const type = Object.values(types.COMPONENT_TYPES).find(
|
|
93
|
+
(t) => t.value === componentType
|
|
94
|
+
);
|
|
95
|
+
return type?.label || componentType;
|
|
96
|
+
}
|
|
97
|
+
function getComponentTypeAcronym(componentType) {
|
|
98
|
+
const type = Object.values(types.COMPONENT_TYPES).find(
|
|
99
|
+
(t) => t.value === componentType
|
|
100
|
+
);
|
|
101
|
+
return type?.acronym || componentType.substring(0, 2).toUpperCase();
|
|
102
|
+
}
|
|
103
|
+
function resolveComponentType(elementType) {
|
|
104
|
+
for (const [componentValue, elements] of Object.entries(
|
|
105
|
+
types.SKHEMA_MAPPING.elementFlow
|
|
106
|
+
)) {
|
|
107
|
+
if (elements.some((e) => e.value === elementType)) {
|
|
108
|
+
return componentValue;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return "diagnosis";
|
|
112
|
+
}
|
|
113
|
+
function getElementTypesForComponent(componentType) {
|
|
114
|
+
if (!isValidComponentType(componentType)) return [];
|
|
115
|
+
const elements = types.SKHEMA_MAPPING.elementFlow[componentType];
|
|
116
|
+
return elements?.map((e) => e.value) || [];
|
|
117
|
+
}
|
|
118
|
+
function isValidElementType(elementType) {
|
|
119
|
+
const validTypes = Object.values(types.ELEMENT_TYPES).map((type) => type.value);
|
|
120
|
+
return validTypes.includes(elementType);
|
|
121
|
+
}
|
|
122
|
+
function validateAttributes(element) {
|
|
123
|
+
const errors = [];
|
|
124
|
+
const elementType = element.getAttribute("element-type");
|
|
125
|
+
const contributorId = element.getAttribute("contributor-id");
|
|
126
|
+
if (!elementType) {
|
|
127
|
+
errors.push("Missing required attribute: element-type");
|
|
128
|
+
} else if (!isValidElementType(elementType)) {
|
|
129
|
+
const validTypes = Object.values(types.ELEMENT_TYPES).map((t) => t.value).join(", ");
|
|
130
|
+
errors.push(
|
|
131
|
+
`Invalid element-type "${elementType}". Valid types: ${validTypes}`
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
if (!contributorId) {
|
|
135
|
+
errors.push("Missing required attribute: contributor-id");
|
|
136
|
+
} else if (contributorId.trim().length === 0) {
|
|
137
|
+
errors.push("contributor-id cannot be empty");
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
isValid: errors.length === 0,
|
|
141
|
+
errors,
|
|
142
|
+
elementType: isValidElementType(elementType || "") ? elementType : void 0,
|
|
143
|
+
contributorId: contributorId || void 0
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function getElementTypeLabel(elementType) {
|
|
147
|
+
const type = Object.values(types.ELEMENT_TYPES).find((t) => t.value === elementType);
|
|
148
|
+
return type?.label || elementType;
|
|
149
|
+
}
|
|
150
|
+
function getElementTypeAcronym(elementType) {
|
|
151
|
+
const type = Object.values(types.ELEMENT_TYPES).find((t) => t.value === elementType);
|
|
152
|
+
return type?.acronym || elementType.substring(0, 2).toUpperCase();
|
|
153
|
+
}
|
|
154
|
+
exports.CARD_PALETTE = CARD_PALETTE;
|
|
155
|
+
exports.CARD_RADIUS = CARD_RADIUS;
|
|
156
|
+
exports.CARD_SHADOW = CARD_SHADOW;
|
|
157
|
+
exports.CARD_SHADOW_LG = CARD_SHADOW_LG;
|
|
158
|
+
exports.CARD_VARS = CARD_VARS;
|
|
159
|
+
exports.COMPONENT_COLORS = COMPONENT_COLORS;
|
|
160
|
+
exports.FONT_STACK = FONT_STACK;
|
|
161
|
+
exports.MONO_STACK = MONO_STACK;
|
|
162
|
+
exports.PRIMARY_HEX = PRIMARY_HEX;
|
|
163
|
+
exports.PRIMARY_HOVER_HEX = PRIMARY_HOVER_HEX;
|
|
164
|
+
exports.PRIMARY_PRESSED_HEX = PRIMARY_PRESSED_HEX;
|
|
165
|
+
exports.USER_ICON_SVG = USER_ICON_SVG;
|
|
166
|
+
exports.getComponentTypeAcronym = getComponentTypeAcronym;
|
|
167
|
+
exports.getComponentTypeLabel = getComponentTypeLabel;
|
|
168
|
+
exports.getElementTypeAcronym = getElementTypeAcronym;
|
|
169
|
+
exports.getElementTypeLabel = getElementTypeLabel;
|
|
170
|
+
exports.getElementTypesForComponent = getElementTypesForComponent;
|
|
171
|
+
exports.isValidComponentType = isValidComponentType;
|
|
172
|
+
exports.isValidElementType = isValidElementType;
|
|
173
|
+
exports.resolveComponentType = resolveComponentType;
|
|
174
|
+
exports.validateAttributes = validateAttributes;
|
|
175
|
+
exports.validateElementBelongsToComponent = validateElementBelongsToComponent;
|
|
176
|
+
//# sourceMappingURL=validation-DCw9rQeH.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-DCw9rQeH.cjs","sources":["../src/styles/design-tokens.ts","../src/utils/component-validation.ts","../src/utils/validation.ts"],"sourcesContent":["/**\n * Hardcoded color tokens for component-type badge colors.\n * Embeds can't rely on host page CSS vars, so we use inline values.\n * Source: skhema-web/src/app/globals.css oklch tokens converted to HSL-ish for browser compat.\n */\n\nexport const COMPONENT_COLORS = {\n diagnosis: {\n bg: 'oklch(0.65 0.06 25 / 0.15)',\n text: 'oklch(0.65 0.06 25)',\n border: 'oklch(0.65 0.06 25 / 0.3)',\n },\n method: {\n bg: 'oklch(0.6 0.06 250 / 0.15)',\n text: 'oklch(0.6 0.06 250)',\n border: 'oklch(0.6 0.06 250 / 0.3)',\n },\n initiatives: {\n bg: 'oklch(0.6 0.06 155 / 0.15)',\n text: 'oklch(0.6 0.06 155)',\n border: 'oklch(0.6 0.06 155 / 0.3)',\n },\n measures: {\n bg: 'oklch(0.6 0.06 300 / 0.15)',\n text: 'oklch(0.6 0.06 300)',\n border: 'oklch(0.6 0.06 300 / 0.3)',\n },\n support: {\n bg: 'oklch(0.65 0.06 65 / 0.15)',\n text: 'oklch(0.65 0.06 65)',\n border: 'oklch(0.65 0.06 65 / 0.3)',\n },\n} as const\n\nexport type ComponentColorKey = keyof typeof COMPONENT_COLORS\n\n/**\n * Email-safe flat hex palette for the card surface, per theme. These mirror the\n * Tailwind slate values behind the `CARD_VARS` HSL tokens, pre-resolved to hex\n * because email clients ignore `<style>` / CSS vars. The card renderer\n * (`@skhema/embed/render`) inlines these so the live browser embed and email\n * share one colour system (see the \"converge on hex\" decision).\n */\nexport const CARD_PALETTE = {\n light: {\n cardBg: '#ffffff', // hsl(0 0% 100%)\n border: '#e2e8f0', // hsl(214.3 31.8% 91.4%) — slate-200\n text: '#020817', // hsl(222.2 84% 4.9%) — slate-950\n textMuted: '#64748b', // hsl(215.4 16.3% 46.9%) — slate-500\n },\n dark: {\n cardBg: '#020817', // hsl(222.2 84% 4.9%) — slate-950\n border: '#1e293b', // hsl(217.2 32.6% 17.5%) — slate-800\n text: '#f8fafc', // hsl(210 40% 98%) — slate-50\n textMuted: '#94a3b8', // hsl(215 20.2% 65.1%) — slate-400\n },\n} as const\n\nexport type CardTheme = keyof typeof CARD_PALETTE\n\n/** Save-button brand colours (hex) — match the `--skhema-primary*` HSL tokens. */\nexport const PRIMARY_HEX = '#cd476a' // hsl(344 57% 54%)\nexport const PRIMARY_HOVER_HEX = '#b53d5e' // hsl(344 50% 47%)\nexport const PRIMARY_PRESSED_HEX = '#9d3552' // hsl(343 50% 41%)\n\n/** Card geometry / typography shared by the renderer and the browser embed. */\nexport const CARD_RADIUS = '4px' // calc(0.1rem + 2px) ≈ 3.6px\nexport const CARD_SHADOW =\n '0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1)'\nexport const CARD_SHADOW_LG =\n '0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)'\nexport const FONT_STACK =\n \"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Inter', sans-serif\"\nexport const MONO_STACK =\n \"ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace\"\n\n/**\n * Shared base card CSS variables for light and dark modes.\n */\nexport const CARD_VARS = {\n light: {\n '--skhema-bg': 'hsl(0 0% 100%)',\n '--skhema-card': 'hsl(0 0% 100%)',\n '--skhema-border': 'hsl(214.3 31.8% 91.4%)',\n '--skhema-text': 'hsl(222.2 84% 4.9%)',\n '--skhema-text-muted': 'hsl(215.4 16.3% 46.9%)',\n '--skhema-accent': 'hsl(210 40% 96%)',\n '--skhema-surface-subtle': 'hsl(210 40% 97%)',\n },\n dark: {\n '--skhema-bg': 'hsl(222.2 84% 4.9%)',\n '--skhema-card': 'hsl(222.2 84% 4.9%)',\n '--skhema-border': 'hsl(217.2 32.6% 17.5%)',\n '--skhema-text': 'hsl(210 40% 98%)',\n '--skhema-text-muted': 'hsl(215 20.2% 65.1%)',\n '--skhema-accent': 'hsl(217.2 32.6% 17.5%)',\n '--skhema-surface-subtle': 'hsl(217.2 32.6% 12%)',\n },\n} as const\n\n/**\n * User SVG icon (inline, no external deps).\n */\nexport const USER_ICON_SVG = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2\"/><circle cx=\"12\" cy=\"7\" r=\"4\"/></svg>`\n","import type { ComponentValue, ElementValue } from '@skhema/types'\nimport { COMPONENT_TYPES, SKHEMA_MAPPING } from '@skhema/types'\n\n/**\n * Validate that a string is a valid component type.\n */\nexport function isValidComponentType(\n componentType: string\n): componentType is ComponentValue {\n const validTypes = Object.values(COMPONENT_TYPES).map((t) => t.value)\n return validTypes.includes(componentType as ComponentValue)\n}\n\n/**\n * Validate that an element type belongs to the given component type.\n */\nexport function validateElementBelongsToComponent(\n elementType: string,\n componentType: string\n): boolean {\n if (!isValidComponentType(componentType)) return false\n\n const validElements =\n SKHEMA_MAPPING.elementFlow[\n componentType as keyof typeof SKHEMA_MAPPING.elementFlow\n ]\n if (!validElements) return false\n\n return validElements.some((e) => e.value === elementType)\n}\n\n/**\n * Get the human-readable label for a component type.\n */\nexport function getComponentTypeLabel(componentType: string): string {\n const type = Object.values(COMPONENT_TYPES).find(\n (t) => t.value === componentType\n )\n return type?.label || componentType\n}\n\n/**\n * Get the acronym for a component type (e.g., 'BD' for diagnosis).\n */\nexport function getComponentTypeAcronym(componentType: string): string {\n const type = Object.values(COMPONENT_TYPES).find(\n (t) => t.value === componentType\n )\n return type?.acronym || componentType.substring(0, 2).toUpperCase()\n}\n\n/**\n * Resolve which component type an element belongs to.\n * Returns the component value, or 'diagnosis' as fallback.\n */\nexport function resolveComponentType(elementType: string): ComponentValue {\n for (const [componentValue, elements] of Object.entries(\n SKHEMA_MAPPING.elementFlow\n )) {\n if (elements.some((e) => e.value === elementType)) {\n return componentValue as ComponentValue\n }\n }\n return 'diagnosis'\n}\n\n/**\n * Get all valid element types for a given component, ordered per the mapping.\n */\nexport function getElementTypesForComponent(\n componentType: string\n): ElementValue[] {\n if (!isValidComponentType(componentType)) return []\n const elements =\n SKHEMA_MAPPING.elementFlow[\n componentType as keyof typeof SKHEMA_MAPPING.elementFlow\n ]\n return elements?.map((e) => e.value) || []\n}\n","import type { ElementValue } from '@skhema/types'\nimport { ELEMENT_TYPES } from '@skhema/types'\n\nexport function isValidElementType(\n elementType: string\n): elementType is ElementValue {\n const validTypes = Object.values(ELEMENT_TYPES).map((type) => type.value)\n return validTypes.includes(elementType as ElementValue)\n}\n\nexport function validateAttributes(element: HTMLElement): {\n isValid: boolean\n errors: string[]\n elementType?: ElementValue\n contributorId?: string\n} {\n const errors: string[] = []\n\n const elementType = element.getAttribute('element-type')\n const contributorId = element.getAttribute('contributor-id')\n\n if (!elementType) {\n errors.push('Missing required attribute: element-type')\n } else if (!isValidElementType(elementType)) {\n const validTypes = Object.values(ELEMENT_TYPES)\n .map((t) => t.value)\n .join(', ')\n errors.push(\n `Invalid element-type \"${elementType}\". Valid types: ${validTypes}`\n )\n }\n\n if (!contributorId) {\n errors.push('Missing required attribute: contributor-id')\n } else if (contributorId.trim().length === 0) {\n errors.push('contributor-id cannot be empty')\n }\n\n return {\n isValid: errors.length === 0,\n errors,\n elementType: isValidElementType(elementType || '')\n ? (elementType as ElementValue)\n : undefined,\n contributorId: contributorId || undefined,\n }\n}\n\nexport function getElementTypeLabel(elementType: ElementValue): string {\n const type = Object.values(ELEMENT_TYPES).find((t) => t.value === elementType)\n return type?.label || elementType\n}\n\nexport function getElementTypeAcronym(elementType: ElementValue): string {\n const type = Object.values(ELEMENT_TYPES).find((t) => t.value === elementType)\n return type?.acronym || elementType.substring(0, 2).toUpperCase()\n}\n"],"names":["COMPONENT_TYPES","SKHEMA_MAPPING","ELEMENT_TYPES"],"mappings":";;AAMO,MAAM,mBAAmB;AAAA,EAC9B,WAAW;AAAA,IACT,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,QAAQ;AAAA,EAAA;AAAA,EAEV,QAAQ;AAAA,IACN,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,QAAQ;AAAA,EAAA;AAAA,EAEV,aAAa;AAAA,IACX,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,QAAQ;AAAA,EAAA;AAAA,EAEV,UAAU;AAAA,IACR,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,QAAQ;AAAA,EAAA;AAAA,EAEV,SAAS;AAAA,IACP,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,QAAQ;AAAA,EAAA;AAEZ;AAWO,MAAM,eAAe;AAAA,EAC1B,OAAO;AAAA,IACL,QAAQ;AAAA;AAAA,IACR,QAAQ;AAAA;AAAA,IACR,MAAM;AAAA;AAAA,IACN,WAAW;AAAA;AAAA,EAAA;AAAA,EAEb,MAAM;AAAA,IACJ,QAAQ;AAAA;AAAA,IACR,QAAQ;AAAA;AAAA,IACR,MAAM;AAAA;AAAA,IACN,WAAW;AAAA;AAAA,EAAA;AAEf;AAKO,MAAM,cAAc;AACpB,MAAM,oBAAoB;AAC1B,MAAM,sBAAsB;AAG5B,MAAM,cAAc;AACpB,MAAM,cACX;AACK,MAAM,iBACX;AACK,MAAM,aACX;AACK,MAAM,aACX;AAKK,MAAM,YAAY;AAAA,EACvB,OAAO;AAAA,IACL,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,iBAAiB;AAAA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AO,MAAM,WAAW,YAAY,UAAU,GAAG,CAAC,EAAE,YAAA;AACtD;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, SKHEMA_MAPPING, ELEMENT_TYPES } from "@skhema/types";
|
|
2
|
+
const COMPONENT_COLORS = {
|
|
3
|
+
diagnosis: {
|
|
4
|
+
bg: "oklch(0.65 0.06 25 / 0.15)",
|
|
5
|
+
text: "oklch(0.65 0.06 25)",
|
|
6
|
+
border: "oklch(0.65 0.06 25 / 0.3)"
|
|
7
|
+
},
|
|
8
|
+
method: {
|
|
9
|
+
bg: "oklch(0.6 0.06 250 / 0.15)",
|
|
10
|
+
text: "oklch(0.6 0.06 250)",
|
|
11
|
+
border: "oklch(0.6 0.06 250 / 0.3)"
|
|
12
|
+
},
|
|
13
|
+
initiatives: {
|
|
14
|
+
bg: "oklch(0.6 0.06 155 / 0.15)",
|
|
15
|
+
text: "oklch(0.6 0.06 155)",
|
|
16
|
+
border: "oklch(0.6 0.06 155 / 0.3)"
|
|
17
|
+
},
|
|
18
|
+
measures: {
|
|
19
|
+
bg: "oklch(0.6 0.06 300 / 0.15)",
|
|
20
|
+
text: "oklch(0.6 0.06 300)",
|
|
21
|
+
border: "oklch(0.6 0.06 300 / 0.3)"
|
|
22
|
+
},
|
|
23
|
+
support: {
|
|
24
|
+
bg: "oklch(0.65 0.06 65 / 0.15)",
|
|
25
|
+
text: "oklch(0.65 0.06 65)",
|
|
26
|
+
border: "oklch(0.65 0.06 65 / 0.3)"
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const CARD_PALETTE = {
|
|
30
|
+
light: {
|
|
31
|
+
cardBg: "#ffffff",
|
|
32
|
+
// hsl(0 0% 100%)
|
|
33
|
+
border: "#e2e8f0",
|
|
34
|
+
// hsl(214.3 31.8% 91.4%) — slate-200
|
|
35
|
+
text: "#020817",
|
|
36
|
+
// hsl(222.2 84% 4.9%) — slate-950
|
|
37
|
+
textMuted: "#64748b"
|
|
38
|
+
// hsl(215.4 16.3% 46.9%) — slate-500
|
|
39
|
+
},
|
|
40
|
+
dark: {
|
|
41
|
+
cardBg: "#020817",
|
|
42
|
+
// hsl(222.2 84% 4.9%) — slate-950
|
|
43
|
+
border: "#1e293b",
|
|
44
|
+
// hsl(217.2 32.6% 17.5%) — slate-800
|
|
45
|
+
text: "#f8fafc",
|
|
46
|
+
// hsl(210 40% 98%) — slate-50
|
|
47
|
+
textMuted: "#94a3b8"
|
|
48
|
+
// hsl(215 20.2% 65.1%) — slate-400
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const PRIMARY_HEX = "#cd476a";
|
|
52
|
+
const PRIMARY_HOVER_HEX = "#b53d5e";
|
|
53
|
+
const PRIMARY_PRESSED_HEX = "#9d3552";
|
|
54
|
+
const CARD_RADIUS = "4px";
|
|
55
|
+
const CARD_SHADOW = "0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1)";
|
|
56
|
+
const CARD_SHADOW_LG = "0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)";
|
|
57
|
+
const FONT_STACK = "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Inter', sans-serif";
|
|
58
|
+
const MONO_STACK = "ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace";
|
|
59
|
+
const CARD_VARS = {
|
|
60
|
+
light: {
|
|
61
|
+
"--skhema-bg": "hsl(0 0% 100%)",
|
|
62
|
+
"--skhema-card": "hsl(0 0% 100%)",
|
|
63
|
+
"--skhema-border": "hsl(214.3 31.8% 91.4%)",
|
|
64
|
+
"--skhema-text": "hsl(222.2 84% 4.9%)",
|
|
65
|
+
"--skhema-text-muted": "hsl(215.4 16.3% 46.9%)",
|
|
66
|
+
"--skhema-accent": "hsl(210 40% 96%)",
|
|
67
|
+
"--skhema-surface-subtle": "hsl(210 40% 97%)"
|
|
68
|
+
},
|
|
69
|
+
dark: {
|
|
70
|
+
"--skhema-bg": "hsl(222.2 84% 4.9%)",
|
|
71
|
+
"--skhema-card": "hsl(222.2 84% 4.9%)",
|
|
72
|
+
"--skhema-border": "hsl(217.2 32.6% 17.5%)",
|
|
73
|
+
"--skhema-text": "hsl(210 40% 98%)",
|
|
74
|
+
"--skhema-text-muted": "hsl(215 20.2% 65.1%)",
|
|
75
|
+
"--skhema-accent": "hsl(217.2 32.6% 17.5%)",
|
|
76
|
+
"--skhema-surface-subtle": "hsl(217.2 32.6% 12%)"
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const USER_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>`;
|
|
80
|
+
function isValidComponentType(componentType) {
|
|
81
|
+
const validTypes = Object.values(COMPONENT_TYPES).map((t) => t.value);
|
|
82
|
+
return validTypes.includes(componentType);
|
|
83
|
+
}
|
|
84
|
+
function validateElementBelongsToComponent(elementType, componentType) {
|
|
85
|
+
if (!isValidComponentType(componentType)) return false;
|
|
86
|
+
const validElements = SKHEMA_MAPPING.elementFlow[componentType];
|
|
87
|
+
if (!validElements) return false;
|
|
88
|
+
return validElements.some((e) => e.value === elementType);
|
|
89
|
+
}
|
|
90
|
+
function getComponentTypeLabel(componentType) {
|
|
91
|
+
const type = Object.values(COMPONENT_TYPES).find(
|
|
92
|
+
(t) => t.value === componentType
|
|
93
|
+
);
|
|
94
|
+
return type?.label || componentType;
|
|
95
|
+
}
|
|
96
|
+
function getComponentTypeAcronym(componentType) {
|
|
97
|
+
const type = Object.values(COMPONENT_TYPES).find(
|
|
98
|
+
(t) => t.value === componentType
|
|
99
|
+
);
|
|
100
|
+
return type?.acronym || componentType.substring(0, 2).toUpperCase();
|
|
101
|
+
}
|
|
102
|
+
function resolveComponentType(elementType) {
|
|
103
|
+
for (const [componentValue, elements] of Object.entries(
|
|
104
|
+
SKHEMA_MAPPING.elementFlow
|
|
105
|
+
)) {
|
|
106
|
+
if (elements.some((e) => e.value === elementType)) {
|
|
107
|
+
return componentValue;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return "diagnosis";
|
|
111
|
+
}
|
|
112
|
+
function getElementTypesForComponent(componentType) {
|
|
113
|
+
if (!isValidComponentType(componentType)) return [];
|
|
114
|
+
const elements = SKHEMA_MAPPING.elementFlow[componentType];
|
|
115
|
+
return elements?.map((e) => e.value) || [];
|
|
116
|
+
}
|
|
117
|
+
function isValidElementType(elementType) {
|
|
118
|
+
const validTypes = Object.values(ELEMENT_TYPES).map((type) => type.value);
|
|
119
|
+
return validTypes.includes(elementType);
|
|
120
|
+
}
|
|
121
|
+
function validateAttributes(element) {
|
|
122
|
+
const errors = [];
|
|
123
|
+
const elementType = element.getAttribute("element-type");
|
|
124
|
+
const contributorId = element.getAttribute("contributor-id");
|
|
125
|
+
if (!elementType) {
|
|
126
|
+
errors.push("Missing required attribute: element-type");
|
|
127
|
+
} else if (!isValidElementType(elementType)) {
|
|
128
|
+
const validTypes = Object.values(ELEMENT_TYPES).map((t) => t.value).join(", ");
|
|
129
|
+
errors.push(
|
|
130
|
+
`Invalid element-type "${elementType}". Valid types: ${validTypes}`
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
if (!contributorId) {
|
|
134
|
+
errors.push("Missing required attribute: contributor-id");
|
|
135
|
+
} else if (contributorId.trim().length === 0) {
|
|
136
|
+
errors.push("contributor-id cannot be empty");
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
isValid: errors.length === 0,
|
|
140
|
+
errors,
|
|
141
|
+
elementType: isValidElementType(elementType || "") ? elementType : void 0,
|
|
142
|
+
contributorId: contributorId || void 0
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function getElementTypeLabel(elementType) {
|
|
146
|
+
const type = Object.values(ELEMENT_TYPES).find((t) => t.value === elementType);
|
|
147
|
+
return type?.label || elementType;
|
|
148
|
+
}
|
|
149
|
+
function getElementTypeAcronym(elementType) {
|
|
150
|
+
const type = Object.values(ELEMENT_TYPES).find((t) => t.value === elementType);
|
|
151
|
+
return type?.acronym || elementType.substring(0, 2).toUpperCase();
|
|
152
|
+
}
|
|
153
|
+
export {
|
|
154
|
+
CARD_VARS as C,
|
|
155
|
+
FONT_STACK as F,
|
|
156
|
+
MONO_STACK as M,
|
|
157
|
+
PRIMARY_HEX as P,
|
|
158
|
+
USER_ICON_SVG as U,
|
|
159
|
+
COMPONENT_COLORS as a,
|
|
160
|
+
getComponentTypeLabel as b,
|
|
161
|
+
getElementTypeAcronym as c,
|
|
162
|
+
getElementTypeLabel as d,
|
|
163
|
+
getElementTypesForComponent as e,
|
|
164
|
+
isValidElementType as f,
|
|
165
|
+
getComponentTypeAcronym as g,
|
|
166
|
+
CARD_PALETTE as h,
|
|
167
|
+
isValidComponentType as i,
|
|
168
|
+
CARD_RADIUS as j,
|
|
169
|
+
CARD_SHADOW as k,
|
|
170
|
+
CARD_SHADOW_LG as l,
|
|
171
|
+
PRIMARY_HOVER_HEX as m,
|
|
172
|
+
PRIMARY_PRESSED_HEX as n,
|
|
173
|
+
validateAttributes as o,
|
|
174
|
+
resolveComponentType as r,
|
|
175
|
+
validateElementBelongsToComponent as v
|
|
176
|
+
};
|
|
177
|
+
//# sourceMappingURL=validation-Dt4L_df8.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-Dt4L_df8.js","sources":["../src/styles/design-tokens.ts","../src/utils/component-validation.ts","../src/utils/validation.ts"],"sourcesContent":["/**\n * Hardcoded color tokens for component-type badge colors.\n * Embeds can't rely on host page CSS vars, so we use inline values.\n * Source: skhema-web/src/app/globals.css oklch tokens converted to HSL-ish for browser compat.\n */\n\nexport const COMPONENT_COLORS = {\n diagnosis: {\n bg: 'oklch(0.65 0.06 25 / 0.15)',\n text: 'oklch(0.65 0.06 25)',\n border: 'oklch(0.65 0.06 25 / 0.3)',\n },\n method: {\n bg: 'oklch(0.6 0.06 250 / 0.15)',\n text: 'oklch(0.6 0.06 250)',\n border: 'oklch(0.6 0.06 250 / 0.3)',\n },\n initiatives: {\n bg: 'oklch(0.6 0.06 155 / 0.15)',\n text: 'oklch(0.6 0.06 155)',\n border: 'oklch(0.6 0.06 155 / 0.3)',\n },\n measures: {\n bg: 'oklch(0.6 0.06 300 / 0.15)',\n text: 'oklch(0.6 0.06 300)',\n border: 'oklch(0.6 0.06 300 / 0.3)',\n },\n support: {\n bg: 'oklch(0.65 0.06 65 / 0.15)',\n text: 'oklch(0.65 0.06 65)',\n border: 'oklch(0.65 0.06 65 / 0.3)',\n },\n} as const\n\nexport type ComponentColorKey = keyof typeof COMPONENT_COLORS\n\n/**\n * Email-safe flat hex palette for the card surface, per theme. These mirror the\n * Tailwind slate values behind the `CARD_VARS` HSL tokens, pre-resolved to hex\n * because email clients ignore `<style>` / CSS vars. The card renderer\n * (`@skhema/embed/render`) inlines these so the live browser embed and email\n * share one colour system (see the \"converge on hex\" decision).\n */\nexport const CARD_PALETTE = {\n light: {\n cardBg: '#ffffff', // hsl(0 0% 100%)\n border: '#e2e8f0', // hsl(214.3 31.8% 91.4%) — slate-200\n text: '#020817', // hsl(222.2 84% 4.9%) — slate-950\n textMuted: '#64748b', // hsl(215.4 16.3% 46.9%) — slate-500\n },\n dark: {\n cardBg: '#020817', // hsl(222.2 84% 4.9%) — slate-950\n border: '#1e293b', // hsl(217.2 32.6% 17.5%) — slate-800\n text: '#f8fafc', // hsl(210 40% 98%) — slate-50\n textMuted: '#94a3b8', // hsl(215 20.2% 65.1%) — slate-400\n },\n} as const\n\nexport type CardTheme = keyof typeof CARD_PALETTE\n\n/** Save-button brand colours (hex) — match the `--skhema-primary*` HSL tokens. */\nexport const PRIMARY_HEX = '#cd476a' // hsl(344 57% 54%)\nexport const PRIMARY_HOVER_HEX = '#b53d5e' // hsl(344 50% 47%)\nexport const PRIMARY_PRESSED_HEX = '#9d3552' // hsl(343 50% 41%)\n\n/** Card geometry / typography shared by the renderer and the browser embed. */\nexport const CARD_RADIUS = '4px' // calc(0.1rem + 2px) ≈ 3.6px\nexport const CARD_SHADOW =\n '0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1)'\nexport const CARD_SHADOW_LG =\n '0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)'\nexport const FONT_STACK =\n \"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Inter', sans-serif\"\nexport const MONO_STACK =\n \"ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace\"\n\n/**\n * Shared base card CSS variables for light and dark modes.\n */\nexport const CARD_VARS = {\n light: {\n '--skhema-bg': 'hsl(0 0% 100%)',\n '--skhema-card': 'hsl(0 0% 100%)',\n '--skhema-border': 'hsl(214.3 31.8% 91.4%)',\n '--skhema-text': 'hsl(222.2 84% 4.9%)',\n '--skhema-text-muted': 'hsl(215.4 16.3% 46.9%)',\n '--skhema-accent': 'hsl(210 40% 96%)',\n '--skhema-surface-subtle': 'hsl(210 40% 97%)',\n },\n dark: {\n '--skhema-bg': 'hsl(222.2 84% 4.9%)',\n '--skhema-card': 'hsl(222.2 84% 4.9%)',\n '--skhema-border': 'hsl(217.2 32.6% 17.5%)',\n '--skhema-text': 'hsl(210 40% 98%)',\n '--skhema-text-muted': 'hsl(215 20.2% 65.1%)',\n '--skhema-accent': 'hsl(217.2 32.6% 17.5%)',\n '--skhema-surface-subtle': 'hsl(217.2 32.6% 12%)',\n },\n} as const\n\n/**\n * User SVG icon (inline, no external deps).\n */\nexport const USER_ICON_SVG = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2\"/><circle cx=\"12\" cy=\"7\" r=\"4\"/></svg>`\n","import type { ComponentValue, ElementValue } from '@skhema/types'\nimport { COMPONENT_TYPES, SKHEMA_MAPPING } from '@skhema/types'\n\n/**\n * Validate that a string is a valid component type.\n */\nexport function isValidComponentType(\n componentType: string\n): componentType is ComponentValue {\n const validTypes = Object.values(COMPONENT_TYPES).map((t) => t.value)\n return validTypes.includes(componentType as ComponentValue)\n}\n\n/**\n * Validate that an element type belongs to the given component type.\n */\nexport function validateElementBelongsToComponent(\n elementType: string,\n componentType: string\n): boolean {\n if (!isValidComponentType(componentType)) return false\n\n const validElements =\n SKHEMA_MAPPING.elementFlow[\n componentType as keyof typeof SKHEMA_MAPPING.elementFlow\n ]\n if (!validElements) return false\n\n return validElements.some((e) => e.value === elementType)\n}\n\n/**\n * Get the human-readable label for a component type.\n */\nexport function getComponentTypeLabel(componentType: string): string {\n const type = Object.values(COMPONENT_TYPES).find(\n (t) => t.value === componentType\n )\n return type?.label || componentType\n}\n\n/**\n * Get the acronym for a component type (e.g., 'BD' for diagnosis).\n */\nexport function getComponentTypeAcronym(componentType: string): string {\n const type = Object.values(COMPONENT_TYPES).find(\n (t) => t.value === componentType\n )\n return type?.acronym || componentType.substring(0, 2).toUpperCase()\n}\n\n/**\n * Resolve which component type an element belongs to.\n * Returns the component value, or 'diagnosis' as fallback.\n */\nexport function resolveComponentType(elementType: string): ComponentValue {\n for (const [componentValue, elements] of Object.entries(\n SKHEMA_MAPPING.elementFlow\n )) {\n if (elements.some((e) => e.value === elementType)) {\n return componentValue as ComponentValue\n }\n }\n return 'diagnosis'\n}\n\n/**\n * Get all valid element types for a given component, ordered per the mapping.\n */\nexport function getElementTypesForComponent(\n componentType: string\n): ElementValue[] {\n if (!isValidComponentType(componentType)) return []\n const elements =\n SKHEMA_MAPPING.elementFlow[\n componentType as keyof typeof SKHEMA_MAPPING.elementFlow\n ]\n return elements?.map((e) => e.value) || []\n}\n","import type { ElementValue } from '@skhema/types'\nimport { ELEMENT_TYPES } from '@skhema/types'\n\nexport function isValidElementType(\n elementType: string\n): elementType is ElementValue {\n const validTypes = Object.values(ELEMENT_TYPES).map((type) => type.value)\n return validTypes.includes(elementType as ElementValue)\n}\n\nexport function validateAttributes(element: HTMLElement): {\n isValid: boolean\n errors: string[]\n elementType?: ElementValue\n contributorId?: string\n} {\n const errors: string[] = []\n\n const elementType = element.getAttribute('element-type')\n const contributorId = element.getAttribute('contributor-id')\n\n if (!elementType) {\n errors.push('Missing required attribute: element-type')\n } else if (!isValidElementType(elementType)) {\n const validTypes = Object.values(ELEMENT_TYPES)\n .map((t) => t.value)\n .join(', ')\n errors.push(\n `Invalid element-type \"${elementType}\". Valid types: ${validTypes}`\n )\n }\n\n if (!contributorId) {\n errors.push('Missing required attribute: contributor-id')\n } else if (contributorId.trim().length === 0) {\n errors.push('contributor-id cannot be empty')\n }\n\n return {\n isValid: errors.length === 0,\n errors,\n elementType: isValidElementType(elementType || '')\n ? (elementType as ElementValue)\n : undefined,\n contributorId: contributorId || undefined,\n }\n}\n\nexport function getElementTypeLabel(elementType: ElementValue): string {\n const type = Object.values(ELEMENT_TYPES).find((t) => t.value === elementType)\n return type?.label || elementType\n}\n\nexport function getElementTypeAcronym(elementType: ElementValue): string {\n const type = Object.values(ELEMENT_TYPES).find((t) => t.value === elementType)\n return type?.acronym || elementType.substring(0, 2).toUpperCase()\n}\n"],"names":[],"mappings":";AAMO,MAAM,mBAAmB;AAAA,EAC9B,WAAW;AAAA,IACT,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,QAAQ;AAAA,EAAA;AAAA,EAEV,QAAQ;AAAA,IACN,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,QAAQ;AAAA,EAAA;AAAA,EAEV,aAAa;AAAA,IACX,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,QAAQ;AAAA,EAAA;AAAA,EAEV,UAAU;AAAA,IACR,IAAI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