@skhema/embed 0.1.9 → 0.1.11
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/components/types.d.ts +1 -1
- package/dist/components/types.d.ts.map +1 -1
- package/dist/embed.min.js +1 -1
- package/dist/embed.min.js.map +1 -1
- package/dist/index-B8ZF3snD.cjs +215 -0
- package/dist/index-B8ZF3snD.cjs.map +1 -0
- package/dist/index-nkGvTyQR.js +216 -0
- package/dist/index-nkGvTyQR.js.map +1 -0
- package/dist/index.cjs +113 -474
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +88 -449
- package/dist/index.es.js.map +1 -1
- package/dist/method-schema.d.ts +244 -0
- package/dist/method-schema.d.ts.map +1 -0
- 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-BQf5zJ3j.js +333 -0
- package/dist/tokens-BQf5zJ3j.js.map +1 -0
- package/dist/tokens-BxpYMhDq.cjs +332 -0
- package/dist/tokens-BxpYMhDq.cjs.map +1 -0
- package/dist/tokens.cjs +13 -13
- package/dist/tokens.d.ts +1 -1
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.es.js +8 -8
- package/dist/utils/color.d.ts +25 -0
- package/dist/utils/color.d.ts.map +1 -0
- package/dist/utils/component-validation.d.ts +1 -1
- package/dist/utils/component-validation.d.ts.map +1 -1
- package/dist/utils/sanitization.d.ts +7 -1
- package/dist/utils/sanitization.d.ts.map +1 -1
- package/dist/utils/seo.d.ts +1 -1
- package/dist/utils/seo.d.ts.map +1 -1
- package/dist/utils/validation.d.ts +1 -1
- package/dist/utils/validation.d.ts.map +1 -1
- package/package.json +11 -7
- package/dist/utils/author-attribution.d.ts +0 -16
- package/dist/utils/author-attribution.d.ts.map +0 -1
- package/dist/validation-CNWaQfh_.cjs +0 -231
- package/dist/validation-CNWaQfh_.cjs.map +0 -1
- package/dist/validation-MSiRF5Wt.js +0 -232
- package/dist/validation-MSiRF5Wt.js.map +0 -1
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
const ELEMENT_TYPES = {
|
|
81
|
+
KEY_CHALLENGE: {
|
|
82
|
+
value: "key_challenge",
|
|
83
|
+
label: "Key Challenge",
|
|
84
|
+
acronym: "CHL"
|
|
85
|
+
},
|
|
86
|
+
SUPPORTING_FACT: {
|
|
87
|
+
value: "supporting_fact",
|
|
88
|
+
label: "Supporting Fact",
|
|
89
|
+
acronym: "FCT"
|
|
90
|
+
},
|
|
91
|
+
IMPACT: {
|
|
92
|
+
value: "impact",
|
|
93
|
+
label: "Impact",
|
|
94
|
+
acronym: "IMP"
|
|
95
|
+
},
|
|
96
|
+
GUIDING_POLICY: {
|
|
97
|
+
value: "guiding_policy",
|
|
98
|
+
label: "Guiding Policy",
|
|
99
|
+
acronym: "POL"
|
|
100
|
+
},
|
|
101
|
+
COMPETITOR_MOVE: {
|
|
102
|
+
value: "competitor_move",
|
|
103
|
+
label: "Competitor Move",
|
|
104
|
+
acronym: "CMV"
|
|
105
|
+
},
|
|
106
|
+
SCOPE: {
|
|
107
|
+
value: "scope",
|
|
108
|
+
label: "Scope",
|
|
109
|
+
acronym: "SCP"
|
|
110
|
+
},
|
|
111
|
+
CONSTRAINT: {
|
|
112
|
+
value: "constraint",
|
|
113
|
+
label: "Constraint",
|
|
114
|
+
acronym: "CST"
|
|
115
|
+
},
|
|
116
|
+
SOLUTION: {
|
|
117
|
+
value: "solution",
|
|
118
|
+
label: "Solution",
|
|
119
|
+
acronym: "SOL"
|
|
120
|
+
},
|
|
121
|
+
ASSUMPTION_HYPOTHESIS: {
|
|
122
|
+
value: "assumption_hypothesis",
|
|
123
|
+
label: "Assumption Hypothesis",
|
|
124
|
+
acronym: "HYP"
|
|
125
|
+
},
|
|
126
|
+
EXPERIMENT: {
|
|
127
|
+
value: "experiment",
|
|
128
|
+
label: "Experiment",
|
|
129
|
+
acronym: "EXP"
|
|
130
|
+
},
|
|
131
|
+
ACTION: {
|
|
132
|
+
value: "action",
|
|
133
|
+
label: "Action",
|
|
134
|
+
acronym: "ACT"
|
|
135
|
+
},
|
|
136
|
+
INVESTMENT: {
|
|
137
|
+
value: "investment",
|
|
138
|
+
label: "Investment",
|
|
139
|
+
acronym: "INV"
|
|
140
|
+
},
|
|
141
|
+
ESTIMATE: {
|
|
142
|
+
value: "estimate",
|
|
143
|
+
label: "Estimate",
|
|
144
|
+
acronym: "EST"
|
|
145
|
+
},
|
|
146
|
+
BASELINE: {
|
|
147
|
+
value: "baseline",
|
|
148
|
+
label: "Baseline",
|
|
149
|
+
acronym: "BSL"
|
|
150
|
+
},
|
|
151
|
+
OUTCOME: {
|
|
152
|
+
value: "outcome",
|
|
153
|
+
label: "Outcome",
|
|
154
|
+
acronym: "OCM"
|
|
155
|
+
},
|
|
156
|
+
PERFORMANCE_VARIABLE: {
|
|
157
|
+
value: "performance_variable",
|
|
158
|
+
label: "Performance Variable",
|
|
159
|
+
acronym: "VAR"
|
|
160
|
+
},
|
|
161
|
+
CAPABILITY: {
|
|
162
|
+
value: "capability",
|
|
163
|
+
label: "Capability",
|
|
164
|
+
acronym: "CAP"
|
|
165
|
+
},
|
|
166
|
+
SYSTEM: {
|
|
167
|
+
value: "system",
|
|
168
|
+
label: "System",
|
|
169
|
+
acronym: "SYS"
|
|
170
|
+
},
|
|
171
|
+
PRINCIPLE: {
|
|
172
|
+
value: "principle",
|
|
173
|
+
label: "Principle",
|
|
174
|
+
acronym: "PRN"
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
const COMPONENT_TYPES = {
|
|
178
|
+
DIAGNOSIS: {
|
|
179
|
+
value: "diagnosis",
|
|
180
|
+
label: "Diagnosis",
|
|
181
|
+
acronym: "BD"
|
|
182
|
+
},
|
|
183
|
+
METHOD: {
|
|
184
|
+
value: "method",
|
|
185
|
+
label: "Method & Positioning",
|
|
186
|
+
acronym: "MP"
|
|
187
|
+
},
|
|
188
|
+
INITIATIVES: {
|
|
189
|
+
value: "initiatives",
|
|
190
|
+
label: "Portfolio of Initiatives",
|
|
191
|
+
acronym: "PI"
|
|
192
|
+
},
|
|
193
|
+
MEASURES: {
|
|
194
|
+
value: "measures",
|
|
195
|
+
label: "Measures",
|
|
196
|
+
acronym: "M"
|
|
197
|
+
},
|
|
198
|
+
SUPPORT: {
|
|
199
|
+
value: "support",
|
|
200
|
+
label: "Support Structures",
|
|
201
|
+
acronym: "SS"
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
const SKHEMA_MAPPING = {
|
|
205
|
+
elementFlow: {
|
|
206
|
+
[COMPONENT_TYPES.DIAGNOSIS.value]: [
|
|
207
|
+
ELEMENT_TYPES.KEY_CHALLENGE,
|
|
208
|
+
ELEMENT_TYPES.SUPPORTING_FACT,
|
|
209
|
+
ELEMENT_TYPES.IMPACT
|
|
210
|
+
],
|
|
211
|
+
[COMPONENT_TYPES.METHOD.value]: [
|
|
212
|
+
ELEMENT_TYPES.GUIDING_POLICY,
|
|
213
|
+
ELEMENT_TYPES.COMPETITOR_MOVE,
|
|
214
|
+
ELEMENT_TYPES.SCOPE,
|
|
215
|
+
ELEMENT_TYPES.CONSTRAINT
|
|
216
|
+
],
|
|
217
|
+
[COMPONENT_TYPES.INITIATIVES.value]: [
|
|
218
|
+
ELEMENT_TYPES.SOLUTION,
|
|
219
|
+
ELEMENT_TYPES.ASSUMPTION_HYPOTHESIS,
|
|
220
|
+
ELEMENT_TYPES.EXPERIMENT,
|
|
221
|
+
ELEMENT_TYPES.ACTION,
|
|
222
|
+
ELEMENT_TYPES.ESTIMATE,
|
|
223
|
+
ELEMENT_TYPES.INVESTMENT
|
|
224
|
+
],
|
|
225
|
+
[COMPONENT_TYPES.MEASURES.value]: [
|
|
226
|
+
ELEMENT_TYPES.BASELINE,
|
|
227
|
+
ELEMENT_TYPES.OUTCOME,
|
|
228
|
+
ELEMENT_TYPES.PERFORMANCE_VARIABLE
|
|
229
|
+
],
|
|
230
|
+
[COMPONENT_TYPES.SUPPORT.value]: [
|
|
231
|
+
ELEMENT_TYPES.CAPABILITY,
|
|
232
|
+
ELEMENT_TYPES.SYSTEM,
|
|
233
|
+
ELEMENT_TYPES.PRINCIPLE
|
|
234
|
+
]
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
function isValidComponentType(componentType) {
|
|
238
|
+
const validTypes = Object.values(COMPONENT_TYPES).map((t) => t.value);
|
|
239
|
+
return validTypes.includes(componentType);
|
|
240
|
+
}
|
|
241
|
+
function validateElementBelongsToComponent(elementType, componentType) {
|
|
242
|
+
if (!isValidComponentType(componentType)) return false;
|
|
243
|
+
const validElements = SKHEMA_MAPPING.elementFlow[componentType];
|
|
244
|
+
if (!validElements) return false;
|
|
245
|
+
return validElements.some((e) => e.value === elementType);
|
|
246
|
+
}
|
|
247
|
+
function getComponentTypeLabel(componentType) {
|
|
248
|
+
const type = Object.values(COMPONENT_TYPES).find(
|
|
249
|
+
(t) => t.value === componentType
|
|
250
|
+
);
|
|
251
|
+
return type?.label || componentType;
|
|
252
|
+
}
|
|
253
|
+
function getComponentTypeAcronym(componentType) {
|
|
254
|
+
const type = Object.values(COMPONENT_TYPES).find(
|
|
255
|
+
(t) => t.value === componentType
|
|
256
|
+
);
|
|
257
|
+
return type?.acronym || componentType.substring(0, 2).toUpperCase();
|
|
258
|
+
}
|
|
259
|
+
function resolveComponentType(elementType) {
|
|
260
|
+
for (const [componentValue, elements] of Object.entries(
|
|
261
|
+
SKHEMA_MAPPING.elementFlow
|
|
262
|
+
)) {
|
|
263
|
+
if (elements.some((e) => e.value === elementType)) {
|
|
264
|
+
return componentValue;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return "diagnosis";
|
|
268
|
+
}
|
|
269
|
+
function getElementTypesForComponent(componentType) {
|
|
270
|
+
if (!isValidComponentType(componentType)) return [];
|
|
271
|
+
const elements = SKHEMA_MAPPING.elementFlow[componentType];
|
|
272
|
+
return elements?.map((e) => e.value) || [];
|
|
273
|
+
}
|
|
274
|
+
function isValidElementType(elementType) {
|
|
275
|
+
const validTypes = Object.values(ELEMENT_TYPES).map((type) => type.value);
|
|
276
|
+
return validTypes.includes(elementType);
|
|
277
|
+
}
|
|
278
|
+
function validateAttributes(element) {
|
|
279
|
+
const errors = [];
|
|
280
|
+
const elementType = element.getAttribute("element-type");
|
|
281
|
+
const contributorId = element.getAttribute("contributor-id");
|
|
282
|
+
if (!elementType) {
|
|
283
|
+
errors.push("Missing required attribute: element-type");
|
|
284
|
+
} else if (!isValidElementType(elementType)) {
|
|
285
|
+
const validTypes = Object.values(ELEMENT_TYPES).map((t) => t.value).join(", ");
|
|
286
|
+
errors.push(
|
|
287
|
+
`Invalid element-type "${elementType}". Valid types: ${validTypes}`
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
if (!contributorId) {
|
|
291
|
+
errors.push("Missing required attribute: contributor-id");
|
|
292
|
+
} else if (contributorId.trim().length === 0) {
|
|
293
|
+
errors.push("contributor-id cannot be empty");
|
|
294
|
+
}
|
|
295
|
+
return {
|
|
296
|
+
isValid: errors.length === 0,
|
|
297
|
+
errors,
|
|
298
|
+
elementType: isValidElementType(elementType || "") ? elementType : void 0,
|
|
299
|
+
contributorId: contributorId || void 0
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
function getElementTypeLabel(elementType) {
|
|
303
|
+
const type = Object.values(ELEMENT_TYPES).find((t) => t.value === elementType);
|
|
304
|
+
return type?.label || elementType;
|
|
305
|
+
}
|
|
306
|
+
function getElementTypeAcronym(elementType) {
|
|
307
|
+
const type = Object.values(ELEMENT_TYPES).find((t) => t.value === elementType);
|
|
308
|
+
return type?.acronym || elementType.substring(0, 2).toUpperCase();
|
|
309
|
+
}
|
|
310
|
+
exports.CARD_PALETTE = CARD_PALETTE;
|
|
311
|
+
exports.CARD_RADIUS = CARD_RADIUS;
|
|
312
|
+
exports.CARD_SHADOW = CARD_SHADOW;
|
|
313
|
+
exports.CARD_SHADOW_LG = CARD_SHADOW_LG;
|
|
314
|
+
exports.CARD_VARS = CARD_VARS;
|
|
315
|
+
exports.COMPONENT_COLORS = COMPONENT_COLORS;
|
|
316
|
+
exports.FONT_STACK = FONT_STACK;
|
|
317
|
+
exports.MONO_STACK = MONO_STACK;
|
|
318
|
+
exports.PRIMARY_HEX = PRIMARY_HEX;
|
|
319
|
+
exports.PRIMARY_HOVER_HEX = PRIMARY_HOVER_HEX;
|
|
320
|
+
exports.PRIMARY_PRESSED_HEX = PRIMARY_PRESSED_HEX;
|
|
321
|
+
exports.USER_ICON_SVG = USER_ICON_SVG;
|
|
322
|
+
exports.getComponentTypeAcronym = getComponentTypeAcronym;
|
|
323
|
+
exports.getComponentTypeLabel = getComponentTypeLabel;
|
|
324
|
+
exports.getElementTypeAcronym = getElementTypeAcronym;
|
|
325
|
+
exports.getElementTypeLabel = getElementTypeLabel;
|
|
326
|
+
exports.getElementTypesForComponent = getElementTypesForComponent;
|
|
327
|
+
exports.isValidComponentType = isValidComponentType;
|
|
328
|
+
exports.isValidElementType = isValidElementType;
|
|
329
|
+
exports.resolveComponentType = resolveComponentType;
|
|
330
|
+
exports.validateAttributes = validateAttributes;
|
|
331
|
+
exports.validateElementBelongsToComponent = validateElementBelongsToComponent;
|
|
332
|
+
//# sourceMappingURL=tokens-BxpYMhDq.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens-BxpYMhDq.cjs","sources":["../src/styles/design-tokens.ts","../src/method-schema.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","/**\n * Vendored from @skhema/types (src/schema/{elements,components,mapping}.ts).\n *\n * @skhema/types is a restricted npm package; @skhema/embed is public, so it\n * must not depend on it at install time. This is the public method vocabulary\n * (it renders verbatim in public embeds) — keep it in sync with @skhema/types\n * when the method schema changes (same pattern as\n * skhema-cli/src/lib/contribute/method-schema.ts).\n */\n\nexport const ELEMENT_TYPES = {\n KEY_CHALLENGE: {\n value: 'key_challenge',\n label: 'Key Challenge',\n acronym: 'CHL',\n },\n SUPPORTING_FACT: {\n value: 'supporting_fact',\n label: 'Supporting Fact',\n acronym: 'FCT',\n },\n IMPACT: {\n value: 'impact',\n label: 'Impact',\n acronym: 'IMP',\n },\n GUIDING_POLICY: {\n value: 'guiding_policy',\n label: 'Guiding Policy',\n acronym: 'POL',\n },\n COMPETITOR_MOVE: {\n value: 'competitor_move',\n label: 'Competitor Move',\n acronym: 'CMV',\n },\n SCOPE: {\n value: 'scope',\n label: 'Scope',\n acronym: 'SCP',\n },\n CONSTRAINT: {\n value: 'constraint',\n label: 'Constraint',\n acronym: 'CST',\n },\n SOLUTION: {\n value: 'solution',\n label: 'Solution',\n acronym: 'SOL',\n },\n ASSUMPTION_HYPOTHESIS: {\n value: 'assumption_hypothesis',\n label: 'Assumption Hypothesis',\n acronym: 'HYP',\n },\n EXPERIMENT: {\n value: 'experiment',\n label: 'Experiment',\n acronym: 'EXP',\n },\n ACTION: {\n value: 'action',\n label: 'Action',\n acronym: 'ACT',\n },\n INVESTMENT: {\n value: 'investment',\n label: 'Investment',\n acronym: 'INV',\n },\n ESTIMATE: {\n value: 'estimate',\n label: 'Estimate',\n acronym: 'EST',\n },\n BASELINE: {\n value: 'baseline',\n label: 'Baseline',\n acronym: 'BSL',\n },\n OUTCOME: {\n value: 'outcome',\n label: 'Outcome',\n acronym: 'OCM',\n },\n PERFORMANCE_VARIABLE: {\n value: 'performance_variable',\n label: 'Performance Variable',\n acronym: 'VAR',\n },\n CAPABILITY: {\n value: 'capability',\n label: 'Capability',\n acronym: 'CAP',\n },\n SYSTEM: {\n value: 'system',\n label: 'System',\n acronym: 'SYS',\n },\n PRINCIPLE: {\n value: 'principle',\n label: 'Principle',\n acronym: 'PRN',\n },\n} as const\n\nexport const COMPONENT_TYPES = {\n DIAGNOSIS: {\n value: 'diagnosis',\n label: 'Diagnosis',\n acronym: 'BD',\n },\n METHOD: {\n value: 'method',\n label: 'Method & Positioning',\n acronym: 'MP',\n },\n INITIATIVES: {\n value: 'initiatives',\n label: 'Portfolio of Initiatives',\n acronym: 'PI',\n },\n MEASURES: {\n value: 'measures',\n label: 'Measures',\n acronym: 'M',\n },\n SUPPORT: {\n value: 'support',\n label: 'Support Structures',\n acronym: 'SS',\n },\n} as const\n\nexport const SKHEMA_MAPPING = {\n componentFlow: [\n COMPONENT_TYPES.DIAGNOSIS,\n COMPONENT_TYPES.METHOD,\n COMPONENT_TYPES.INITIATIVES,\n COMPONENT_TYPES.MEASURES,\n COMPONENT_TYPES.SUPPORT,\n ] as const,\n\n elementFlow: {\n [COMPONENT_TYPES.DIAGNOSIS.value]: [\n ELEMENT_TYPES.KEY_CHALLENGE,\n ELEMENT_TYPES.SUPPORTING_FACT,\n ELEMENT_TYPES.IMPACT,\n ],\n [COMPONENT_TYPES.METHOD.value]: [\n ELEMENT_TYPES.GUIDING_POLICY,\n ELEMENT_TYPES.COMPETITOR_MOVE,\n ELEMENT_TYPES.SCOPE,\n ELEMENT_TYPES.CONSTRAINT,\n ],\n [COMPONENT_TYPES.INITIATIVES.value]: [\n ELEMENT_TYPES.SOLUTION,\n ELEMENT_TYPES.ASSUMPTION_HYPOTHESIS,\n ELEMENT_TYPES.EXPERIMENT,\n ELEMENT_TYPES.ACTION,\n ELEMENT_TYPES.ESTIMATE,\n ELEMENT_TYPES.INVESTMENT,\n ],\n [COMPONENT_TYPES.MEASURES.value]: [\n ELEMENT_TYPES.BASELINE,\n ELEMENT_TYPES.OUTCOME,\n ELEMENT_TYPES.PERFORMANCE_VARIABLE,\n ],\n [COMPONENT_TYPES.SUPPORT.value]: [\n ELEMENT_TYPES.CAPABILITY,\n ELEMENT_TYPES.SYSTEM,\n ELEMENT_TYPES.PRINCIPLE,\n ],\n } as const,\n} as const\n\nexport type ElementType = (typeof ELEMENT_TYPES)[keyof typeof ELEMENT_TYPES]\nexport type ElementValue = ElementType['value']\nexport type ComponentType =\n (typeof COMPONENT_TYPES)[keyof typeof COMPONENT_TYPES]\nexport type ComponentValue = ComponentType['value']\n","import type { ComponentValue, ElementValue } from '../method-schema.js'\nimport { COMPONENT_TYPES, SKHEMA_MAPPING } from '../method-schema.js'\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 '../method-schema.js'\nimport { ELEMENT_TYPES } from '../method-schema.js'\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;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,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,GAAG;AAC5C,WAAO,KAAK,gCAAgC;AAAA,EAC9C;AAEA,SAAO;AAAA,IACL,SAAS,OAAO,WAAW;AAAA,IAC3B;AAAA,IACA,aAAa,mBAAmB,eAAe,EAAE,IAC5C,cACD;AAAA,IACJ,eAAe,iBAAiB;AAAA,EAAA;AAEpC;AAEO,SAAS,oBAAoB,aAAmC;AACrE,QAAM,OAAO,OAAO,OAAO,aAAa,EAAE,KAAK,CAAC,MAAM,EAAE,UAAU,WAAW;AAC7E,SAAO,MAAM,SAAS;AACxB;AAEO,SAAS,sBAAsB,aAAmC;AACvE,QAAM,OAAO,OAAO,OAAO,aAAa,EAAE,KAAK,CAAC,MAAM,EAAE,UAAU,WAAW;AAC7E,SAAO,MAAM,WAAW,YAAY,UAAU,GAAG,CAAC,EAAE,YAAA;AACtD;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/tokens.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
exports.CARD_VARS =
|
|
5
|
-
exports.COMPONENT_COLORS =
|
|
6
|
-
exports.USER_ICON_SVG =
|
|
7
|
-
exports.getComponentTypeAcronym =
|
|
8
|
-
exports.getComponentTypeLabel =
|
|
9
|
-
exports.getElementTypeAcronym =
|
|
10
|
-
exports.getElementTypeLabel =
|
|
11
|
-
exports.getElementTypesForComponent =
|
|
12
|
-
exports.isValidComponentType =
|
|
13
|
-
exports.isValidElementType =
|
|
14
|
-
exports.resolveComponentType =
|
|
15
|
-
exports.validateElementBelongsToComponent =
|
|
3
|
+
const tokens = require("./tokens-BxpYMhDq.cjs");
|
|
4
|
+
exports.CARD_VARS = tokens.CARD_VARS;
|
|
5
|
+
exports.COMPONENT_COLORS = tokens.COMPONENT_COLORS;
|
|
6
|
+
exports.USER_ICON_SVG = tokens.USER_ICON_SVG;
|
|
7
|
+
exports.getComponentTypeAcronym = tokens.getComponentTypeAcronym;
|
|
8
|
+
exports.getComponentTypeLabel = tokens.getComponentTypeLabel;
|
|
9
|
+
exports.getElementTypeAcronym = tokens.getElementTypeAcronym;
|
|
10
|
+
exports.getElementTypeLabel = tokens.getElementTypeLabel;
|
|
11
|
+
exports.getElementTypesForComponent = tokens.getElementTypesForComponent;
|
|
12
|
+
exports.isValidComponentType = tokens.isValidComponentType;
|
|
13
|
+
exports.isValidElementType = tokens.isValidElementType;
|
|
14
|
+
exports.resolveComponentType = tokens.resolveComponentType;
|
|
15
|
+
exports.validateElementBelongsToComponent = tokens.validateElementBelongsToComponent;
|
|
16
16
|
//# sourceMappingURL=tokens.cjs.map
|
package/dist/tokens.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Everything re-exported below is pure (no DOM, no side effects).
|
|
12
12
|
*/
|
|
13
|
-
export {
|
|
13
|
+
export { CARD_VARS, COMPONENT_COLORS, USER_ICON_SVG, } from './styles/design-tokens.js';
|
|
14
14
|
export type { ComponentColorKey } from './styles/design-tokens.js';
|
|
15
15
|
export { getComponentTypeAcronym, getComponentTypeLabel, getElementTypesForComponent, isValidComponentType, resolveComponentType, validateElementBelongsToComponent, } from './utils/component-validation.js';
|
|
16
16
|
export { getElementTypeAcronym, getElementTypeLabel, isValidElementType, } from './utils/validation.js';
|
package/dist/tokens.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,gBAAgB,EAChB,
|
|
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"}
|
package/dist/tokens.es.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o, c, U, a, b, m, g, f, i, n, r, v } from "./tokens-BQf5zJ3j.js";
|
|
2
2
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
o as CARD_VARS,
|
|
4
|
+
c as COMPONENT_COLORS,
|
|
5
5
|
U as USER_ICON_SVG,
|
|
6
|
-
|
|
6
|
+
a as getComponentTypeAcronym,
|
|
7
7
|
b as getComponentTypeLabel,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
m as getElementTypeAcronym,
|
|
9
|
+
g as getElementTypeLabel,
|
|
10
|
+
f as getElementTypesForComponent,
|
|
11
11
|
i as isValidComponentType,
|
|
12
|
-
|
|
12
|
+
n as isValidElementType,
|
|
13
13
|
r as resolveComponentType,
|
|
14
14
|
v as validateElementBelongsToComponent
|
|
15
15
|
};
|
|
@@ -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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-validation.d.ts","sourceRoot":"","sources":["../../src/utils/component-validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"component-validation.d.ts","sourceRoot":"","sources":["../../src/utils/component-validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAGvE;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,aAAa,EAAE,MAAM,GACpB,aAAa,IAAI,cAAc,CAGjC;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAC/C,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,GACpB,OAAO,CAUT;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAKnE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAKrE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc,CASxE;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,MAAM,GACpB,YAAY,EAAE,CAOhB"}
|
|
@@ -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"}
|
package/dist/utils/seo.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentValue, ElementValue } from '
|
|
1
|
+
import { ComponentValue, ElementValue } from '../method-schema.js';
|
|
2
2
|
export declare function generateStructuredData(content: string, elementType: ElementValue, contributorId: string, sourceUrl: string): object;
|
|
3
3
|
export declare function generateRedirectUrl(content: string, elementType: ElementValue, contributorId: string, options?: {
|
|
4
4
|
baseUrl?: string;
|
package/dist/utils/seo.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seo.d.ts","sourceRoot":"","sources":["../../src/utils/seo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"seo.d.ts","sourceRoot":"","sources":["../../src/utils/seo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAKvE,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,YAAY,EACzB,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,GAChB,MAAM,CAqBR;AAED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,YAAY,EACzB,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE;IACP,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;CAChB,GACL,MAAM,CAiBR;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,YAAY,EACzB,aAAa,EAAE,MAAM,GACpB,MAAM,CAYR;AAED,wBAAgB,+BAA+B,CAC7C,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,cAAc,EAC7B,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,KAAK,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,EACzD,SAAS,EAAE,MAAM,GAChB,MAAM,CAiCR;AAED,wBAAgB,4BAA4B,CAC1C,aAAa,EAAE,MAAM,EACrB,aAAa,EAAE,cAAc,EAC7B,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE;IACP,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;CAChB,GACL,MAAM,CAeR;AAED,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,YAAY,GACxB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQxB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElementValue } from '
|
|
1
|
+
import { ElementValue } from '../method-schema.js';
|
|
2
2
|
export declare function isValidElementType(elementType: string): elementType is ElementValue;
|
|
3
3
|
export declare function validateAttributes(element: HTMLElement): {
|
|
4
4
|
isValid: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAGvD,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,GAClB,WAAW,IAAI,YAAY,CAG7B;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG;IACxD,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,WAAW,CAAC,EAAE,YAAY,CAAA;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CA+BA;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,YAAY,GAAG,MAAM,CAGrE;AAED,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,YAAY,GAAG,MAAM,CAGvE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skhema/embed",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "Embeddable component for integrating strategic elements with Skhema.",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
@@ -26,6 +26,12 @@
|
|
|
26
26
|
"require": "./dist/tokens.cjs",
|
|
27
27
|
"default": "./dist/tokens.es.js"
|
|
28
28
|
},
|
|
29
|
+
"./render": {
|
|
30
|
+
"types": "./dist/render.d.ts",
|
|
31
|
+
"import": "./dist/render.es.js",
|
|
32
|
+
"require": "./dist/render.cjs",
|
|
33
|
+
"default": "./dist/render.es.js"
|
|
34
|
+
},
|
|
29
35
|
"./cdn": {
|
|
30
36
|
"types": "./dist/cdn.d.ts",
|
|
31
37
|
"import": "./dist/embed.min.js"
|
|
@@ -45,8 +51,8 @@
|
|
|
45
51
|
"lint:fix": "eslint . --fix",
|
|
46
52
|
"format": "prettier --write .",
|
|
47
53
|
"format:check": "prettier --check .",
|
|
48
|
-
"test": "
|
|
49
|
-
"test:watch": "
|
|
54
|
+
"test": "vitest run",
|
|
55
|
+
"test:watch": "vitest",
|
|
50
56
|
"check": "npm run typecheck && npm run lint && npm run format:check",
|
|
51
57
|
"check:fix": "npm run format && npm run lint:fix",
|
|
52
58
|
"preview": "vite preview",
|
|
@@ -63,9 +69,6 @@
|
|
|
63
69
|
],
|
|
64
70
|
"author": "Skhema Team",
|
|
65
71
|
"license": "MIT",
|
|
66
|
-
"dependencies": {
|
|
67
|
-
"@skhema/types": "2.5.0"
|
|
68
|
-
},
|
|
69
72
|
"devDependencies": {
|
|
70
73
|
"@skhema/linter": "2.2.0",
|
|
71
74
|
"@skhema/prettier-config": "1.0.0",
|
|
@@ -76,7 +79,8 @@
|
|
|
76
79
|
"terser": "^5.0.0",
|
|
77
80
|
"typescript": "^5.0.0",
|
|
78
81
|
"vite": "^7.0.0",
|
|
79
|
-
"vite-plugin-dts": "^4.0.0"
|
|
82
|
+
"vite-plugin-dts": "^4.0.0",
|
|
83
|
+
"vitest": "^4.0.17"
|
|
80
84
|
},
|
|
81
85
|
"publishConfig": {
|
|
82
86
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolve author display from element attributes.
|
|
3
|
-
* Prefer author-name; contributor-name is deprecated.
|
|
4
|
-
*/
|
|
5
|
-
export interface AuthorAttribution {
|
|
6
|
-
authorName: string;
|
|
7
|
-
authorSlug?: string;
|
|
8
|
-
}
|
|
9
|
-
export declare function readAuthorAttribution(element: HTMLElement): AuthorAttribution | null;
|
|
10
|
-
/**
|
|
11
|
-
* Footer HTML: "By {authorName}", linked when authorSlug is set.
|
|
12
|
-
*/
|
|
13
|
-
export declare function formatAuthorAttributionHtml(authorName: string, authorSlug?: string): string;
|
|
14
|
-
export declare function formatContributorIdFallback(contributorId: string): string;
|
|
15
|
-
export declare function resolveAuthorFooterHtml(element: HTMLElement, contributorId: string): string;
|
|
16
|
-
//# sourceMappingURL=author-attribution.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"author-attribution.d.ts","sourceRoot":"","sources":["../../src/utils/author-attribution.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,WAAW,GACnB,iBAAiB,GAAG,IAAI,CAY1B;AAUD;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,MAAM,GAClB,MAAM,CAMR;AAED,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAKzE;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,WAAW,EACpB,aAAa,EAAE,MAAM,GACpB,MAAM,CASR"}
|