@skhema/embed 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/embed.min.js +1 -1
- package/dist/embed.min.js.map +1 -1
- package/dist/index.cjs +46 -240
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +4 -197
- package/dist/index.es.js.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/validation-CNWaQfh_.cjs +231 -0
- package/dist/validation-CNWaQfh_.cjs.map +1 -0
- package/dist/validation-MSiRF5Wt.js +232 -0
- package/dist/validation-MSiRF5Wt.js.map +1 -0
- package/package.json +10 -4
package/dist/index.es.js
CHANGED
|
@@ -1,125 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
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 SHARED_CARD_STYLES = `
|
|
30
|
-
/* Monospace acronym badge */
|
|
31
|
-
.skhema-acronym-badge {
|
|
32
|
-
display: inline-flex;
|
|
33
|
-
align-items: center;
|
|
34
|
-
font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
|
|
35
|
-
font-size: 10px;
|
|
36
|
-
font-weight: 600;
|
|
37
|
-
padding: 2px 6px;
|
|
38
|
-
border-radius: 2px;
|
|
39
|
-
letter-spacing: 0.02em;
|
|
40
|
-
flex-shrink: 0;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/* Footer attribution tagline */
|
|
44
|
-
.skhema-footer-attribution {
|
|
45
|
-
font-size: 11px;
|
|
46
|
-
color: var(--skhema-text-muted);
|
|
47
|
-
line-height: 1.4;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.skhema-footer-attribution a {
|
|
51
|
-
color: var(--skhema-text-muted);
|
|
52
|
-
text-decoration: underline;
|
|
53
|
-
text-decoration-color: var(--skhema-border);
|
|
54
|
-
text-underline-offset: 2px;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.skhema-footer-attribution a:hover {
|
|
58
|
-
color: var(--skhema-text);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/* Contributor line in footer */
|
|
62
|
-
.skhema-contributor-line {
|
|
63
|
-
display: flex;
|
|
64
|
-
align-items: center;
|
|
65
|
-
gap: 6px;
|
|
66
|
-
font-size: 12px;
|
|
67
|
-
color: var(--skhema-text-muted);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.skhema-contributor-line svg {
|
|
71
|
-
width: 14px;
|
|
72
|
-
height: 14px;
|
|
73
|
-
flex-shrink: 0;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.skhema-author-link {
|
|
77
|
-
color: inherit;
|
|
78
|
-
text-decoration: none;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.skhema-author-link:hover {
|
|
82
|
-
color: var(--skhema-text);
|
|
83
|
-
text-decoration: underline;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/* Save button — primary brand color */
|
|
87
|
-
.skhema-save-btn {
|
|
88
|
-
display: inline-flex;
|
|
89
|
-
align-items: center;
|
|
90
|
-
gap: 6px;
|
|
91
|
-
background: var(--skhema-primary);
|
|
92
|
-
color: white;
|
|
93
|
-
border: none;
|
|
94
|
-
padding: 6px 14px;
|
|
95
|
-
border-radius: calc(var(--skhema-radius) + 2px);
|
|
96
|
-
font-size: 12px;
|
|
97
|
-
font-weight: 500;
|
|
98
|
-
text-decoration: none;
|
|
99
|
-
cursor: pointer;
|
|
100
|
-
transition: background 0.15s ease;
|
|
101
|
-
white-space: nowrap;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.skhema-save-btn:hover {
|
|
105
|
-
background: var(--skhema-primary-hover);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.skhema-save-btn:active {
|
|
109
|
-
background: var(--skhema-primary-pressed);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.skhema-save-btn:focus {
|
|
113
|
-
outline: 2px solid var(--skhema-primary);
|
|
114
|
-
outline-offset: 2px;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.skhema-save-btn::after {
|
|
118
|
-
content: '\\2192';
|
|
119
|
-
font-size: 13px;
|
|
120
|
-
}
|
|
121
|
-
`;
|
|
122
|
-
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>`;
|
|
1
|
+
import { d as getElementTypeLabel, b as getComponentTypeLabel, i as isValidComponentType, v as validateElementBelongsToComponent, e as getElementTypesForComponent, g as getComponentTypeAcronym, a as COMPONENT_COLORS, S as SHARED_CARD_STYLES, U as USER_ICON_SVG, h as validateAttributes, r as resolveComponentType } from "./validation-MSiRF5Wt.js";
|
|
2
|
+
import { c, f } from "./validation-MSiRF5Wt.js";
|
|
123
3
|
function readAuthorAttribution(element) {
|
|
124
4
|
const authorName = element.getAttribute("author-name") || element.getAttribute("contributor-name");
|
|
125
5
|
if (!authorName?.trim()) {
|
|
@@ -527,43 +407,6 @@ function shouldTrackAnalytics(element) {
|
|
|
527
407
|
const trackAnalytics = element.getAttribute("track-analytics");
|
|
528
408
|
return trackAnalytics !== "false";
|
|
529
409
|
}
|
|
530
|
-
function isValidComponentType(componentType) {
|
|
531
|
-
const validTypes = Object.values(COMPONENT_TYPES).map((t) => t.value);
|
|
532
|
-
return validTypes.includes(componentType);
|
|
533
|
-
}
|
|
534
|
-
function validateElementBelongsToComponent(elementType, componentType) {
|
|
535
|
-
if (!isValidComponentType(componentType)) return false;
|
|
536
|
-
const validElements = SKHEMA_MAPPING.elementFlow[componentType];
|
|
537
|
-
if (!validElements) return false;
|
|
538
|
-
return validElements.some((e) => e.value === elementType);
|
|
539
|
-
}
|
|
540
|
-
function getComponentTypeLabel(componentType) {
|
|
541
|
-
const type = Object.values(COMPONENT_TYPES).find(
|
|
542
|
-
(t) => t.value === componentType
|
|
543
|
-
);
|
|
544
|
-
return type?.label || componentType;
|
|
545
|
-
}
|
|
546
|
-
function getComponentTypeAcronym(componentType) {
|
|
547
|
-
const type = Object.values(COMPONENT_TYPES).find(
|
|
548
|
-
(t) => t.value === componentType
|
|
549
|
-
);
|
|
550
|
-
return type?.acronym || componentType.substring(0, 2).toUpperCase();
|
|
551
|
-
}
|
|
552
|
-
function resolveComponentType(elementType) {
|
|
553
|
-
for (const [componentValue, elements] of Object.entries(
|
|
554
|
-
SKHEMA_MAPPING.elementFlow
|
|
555
|
-
)) {
|
|
556
|
-
if (elements.some((e) => e.value === elementType)) {
|
|
557
|
-
return componentValue;
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
return "diagnosis";
|
|
561
|
-
}
|
|
562
|
-
function getElementTypesForComponent(componentType) {
|
|
563
|
-
if (!isValidComponentType(componentType)) return [];
|
|
564
|
-
const elements = SKHEMA_MAPPING.elementFlow[componentType];
|
|
565
|
-
return elements?.map((e) => e.value) || [];
|
|
566
|
-
}
|
|
567
410
|
function generateContentHash(content) {
|
|
568
411
|
let hash = 0;
|
|
569
412
|
const cleanContent = content.trim().substring(0, 200);
|
|
@@ -652,42 +495,6 @@ function validateContentSecurity(content) {
|
|
|
652
495
|
issues
|
|
653
496
|
};
|
|
654
497
|
}
|
|
655
|
-
function isValidElementType(elementType) {
|
|
656
|
-
const validTypes = Object.values(ELEMENT_TYPES).map((type) => type.value);
|
|
657
|
-
return validTypes.includes(elementType);
|
|
658
|
-
}
|
|
659
|
-
function validateAttributes(element) {
|
|
660
|
-
const errors = [];
|
|
661
|
-
const elementType = element.getAttribute("element-type");
|
|
662
|
-
const contributorId = element.getAttribute("contributor-id");
|
|
663
|
-
if (!elementType) {
|
|
664
|
-
errors.push("Missing required attribute: element-type");
|
|
665
|
-
} else if (!isValidElementType(elementType)) {
|
|
666
|
-
const validTypes = Object.values(ELEMENT_TYPES).map((t) => t.value).join(", ");
|
|
667
|
-
errors.push(
|
|
668
|
-
`Invalid element-type "${elementType}". Valid types: ${validTypes}`
|
|
669
|
-
);
|
|
670
|
-
}
|
|
671
|
-
if (!contributorId) {
|
|
672
|
-
errors.push("Missing required attribute: contributor-id");
|
|
673
|
-
} else if (contributorId.trim().length === 0) {
|
|
674
|
-
errors.push("contributor-id cannot be empty");
|
|
675
|
-
}
|
|
676
|
-
return {
|
|
677
|
-
isValid: errors.length === 0,
|
|
678
|
-
errors,
|
|
679
|
-
elementType: isValidElementType(elementType || "") ? elementType : void 0,
|
|
680
|
-
contributorId: contributorId || void 0
|
|
681
|
-
};
|
|
682
|
-
}
|
|
683
|
-
function getElementTypeLabel(elementType) {
|
|
684
|
-
const type = Object.values(ELEMENT_TYPES).find((t) => t.value === elementType);
|
|
685
|
-
return type?.label || elementType;
|
|
686
|
-
}
|
|
687
|
-
function getElementTypeAcronym(elementType) {
|
|
688
|
-
const type = Object.values(ELEMENT_TYPES).find((t) => t.value === elementType);
|
|
689
|
-
return type?.acronym || elementType.substring(0, 2).toUpperCase();
|
|
690
|
-
}
|
|
691
498
|
function generateStructuredData(content, elementType, contributorId, sourceUrl) {
|
|
692
499
|
return {
|
|
693
500
|
"@context": "https://schema.org",
|
|
@@ -2174,10 +1981,10 @@ export {
|
|
|
2174
1981
|
generateStructuredData,
|
|
2175
1982
|
getComponentTypeAcronym,
|
|
2176
1983
|
getComponentTypeLabel,
|
|
2177
|
-
getElementTypeAcronym,
|
|
1984
|
+
c as getElementTypeAcronym,
|
|
2178
1985
|
getElementTypeLabel,
|
|
2179
1986
|
isValidComponentType,
|
|
2180
|
-
isValidElementType,
|
|
1987
|
+
f as isValidElementType,
|
|
2181
1988
|
registerSkhemaComponent,
|
|
2182
1989
|
registerSkhemaElement,
|
|
2183
1990
|
resolveComponentType,
|