@dataengineeringformachinelearning/viking-ui 4.0.6 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4203 +0,0 @@
1
- // src/web/core/base.ts
2
- var attachShadowStyles = (shadow, css) => {
3
- if ("adoptedStyleSheets" in Document.prototype && "replaceSync" in CSSStyleSheet.prototype) {
4
- const sheet = new CSSStyleSheet();
5
- sheet.replaceSync(css);
6
- shadow.adoptedStyleSheets = [sheet];
7
- return;
8
- }
9
- const style = document.createElement("style");
10
- style.textContent = css;
11
- shadow.append(style);
12
- };
13
- var readBoolAttr = (el, name) => el.hasAttribute(name) && el.getAttribute(name) !== "false";
14
- var setFormValue = (internals, value) => {
15
- if (internals && typeof internals.setFormValue === "function") {
16
- internals.setFormValue(value);
17
- }
18
- };
19
- var attachElementInternals = (el) => {
20
- const attachInternals = el.attachInternals;
21
- return typeof attachInternals === "function" ? attachInternals.call(el) : null;
22
- };
23
- var showModalDialog = (dialog) => {
24
- if (dialog && typeof dialog.showModal === "function" && !dialog.open) {
25
- dialog.showModal();
26
- }
27
- };
28
- var closeModalDialog = (dialog) => {
29
- if (dialog && typeof dialog.close === "function" && dialog.open) {
30
- dialog.close();
31
- }
32
- };
33
-
34
- // src/web/core/dom.ts
35
- var HTMLElementBase = typeof HTMLElement === "undefined" ? class {
36
- } : HTMLElement;
37
- var vikingWcUid = (prefix) => `${prefix}-${Math.random().toString(36).slice(2, 9)}`;
38
- var escapeHtml = (value) => {
39
- const entities = {
40
- "&": "&",
41
- "<": "&lt;",
42
- ">": "&gt;",
43
- '"': "&quot;",
44
- "'": "&#39;"
45
- };
46
- return value.replace(
47
- /[&<>"']/g,
48
- (character) => entities[character] ?? character
49
- );
50
- };
51
- var modKeyLabel = () => typeof navigator !== "undefined" && /Mac|iPhone|iPad/i.test(navigator.platform) ? "\u2318" : "Ctrl";
52
- var defineCustomElement = (tag, ctor) => {
53
- if (typeof customElements === "undefined" || customElements.get(tag)) {
54
- return;
55
- }
56
- customElements.define(tag, ctor);
57
- };
58
- var defineCustomElementAlias = (tag, ctor) => {
59
- if (typeof customElements === "undefined" || customElements.get(tag)) {
60
- return;
61
- }
62
- customElements.define(tag, class extends ctor {
63
- });
64
- };
65
-
66
- // src/lib/core/lucide-paths.generated.ts
67
- var LUCIDE_ICON_PATHS = {
68
- "alert-circle": '<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>',
69
- "alert-triangle": '<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>',
70
- "arrow-left": '<path d="m12 19-7-7 7-7"/><path d="M19 12H5"/>',
71
- "arrow-right": '<path d="M5 12h14"/><path d="m12 5 7 7-7 7"/>',
72
- "arrow-up-right": '<path d="M7 7h10v10"/><path d="M7 17 17 7"/>',
73
- "bar-chart": '<path d="M3 3v16a2 2 0 0 0 2 2h16"/><path d="M18 17V9"/><path d="M13 17V5"/><path d="M8 17v-3"/>',
74
- bell: '<path d="M10.268 21a2 2 0 0 0 3.464 0"/><path d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"/>',
75
- bold: '<path d="M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8"/>',
76
- bolt: '<path d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"/>',
77
- brain: '<path d="M12 18V5"/><path d="M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4"/><path d="M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5"/><path d="M17.997 5.125a4 4 0 0 1 2.526 5.77"/><path d="M18 18a4 4 0 0 0 2-7.464"/><path d="M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517"/><path d="M6 18a4 4 0 0 1-2-7.464"/><path d="M6.003 5.125a4 4 0 0 0-2.526 5.77"/>',
78
- bug: '<path d="M12 20v-9"/><path d="M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z"/><path d="M14.12 3.88 16 2"/><path d="M21 21a4 4 0 0 0-3.81-4"/><path d="M21 5a4 4 0 0 1-3.55 3.97"/><path d="M22 13h-4"/><path d="M3 21a4 4 0 0 1 3.81-4"/><path d="M3 5a4 4 0 0 0 3.55 3.97"/><path d="M6 13H2"/><path d="m8 2 1.88 1.88"/><path d="M9 7.13V6a3 3 0 1 1 6 0v1.13"/>',
79
- building: '<path d="M12 10h.01"/><path d="M12 14h.01"/><path d="M12 6h.01"/><path d="M16 10h.01"/><path d="M16 14h.01"/><path d="M16 6h.01"/><path d="M8 10h.01"/><path d="M8 14h.01"/><path d="M8 6h.01"/><path d="M9 22v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"/><rect x="4" y="2" width="16" height="20" rx="2"/>',
80
- calendar: '<path d="M8 2v4"/><path d="M16 2v4"/><rect width="18" height="18" x="3" y="4" rx="2"/><path d="M3 10h18"/>',
81
- check: '<path d="M20 6 9 17l-5-5"/>',
82
- "check-circle": '<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>',
83
- "chevron-down": '<path d="m6 9 6 6 6-6"/>',
84
- "chevron-left": '<path d="m15 18-6-6 6-6"/>',
85
- "chevron-right": '<path d="m9 18 6-6-6-6"/>',
86
- "chevron-up": '<path d="m18 15-6-6-6 6"/>',
87
- chip: '<path d="M12 20v2"/><path d="M12 2v2"/><path d="M17 20v2"/><path d="M17 2v2"/><path d="M2 12h2"/><path d="M2 17h2"/><path d="M2 7h2"/><path d="M20 12h2"/><path d="M20 17h2"/><path d="M20 7h2"/><path d="M7 20v2"/><path d="M7 2v2"/><rect x="4" y="4" width="16" height="16" rx="2"/><rect x="8" y="8" width="8" height="8" rx="1"/>',
88
- clock: '<circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>',
89
- cloud: '<path d="M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"/>',
90
- cookie: '<path d="M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5"/><path d="M8.5 8.5v.01"/><path d="M16 15.5v.01"/><path d="M12 12v.01"/><path d="M11 17v.01"/><path d="M7 14v.01"/>',
91
- copy: '<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',
92
- "dots-horizontal": '<circle cx="12" cy="12" r="1" fill="currentColor" stroke="none"/><circle cx="19" cy="12" r="1" fill="currentColor" stroke="none"/><circle cx="5" cy="12" r="1" fill="currentColor" stroke="none"/>',
93
- "dots-vertical": '<circle cx="12" cy="12" r="1" fill="currentColor" stroke="none"/><circle cx="12" cy="5" r="1" fill="currentColor" stroke="none"/><circle cx="12" cy="19" r="1" fill="currentColor" stroke="none"/>',
94
- download: '<path d="M12 15V3"/><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/>',
95
- external: '<path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>',
96
- eye: '<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>',
97
- "eye-off": '<path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"/><path d="M14.084 14.158a3 3 0 0 1-4.242-4.242"/><path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"/><path d="m2 2 20 20"/>',
98
- file: '<path d="M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/>',
99
- filter: '<path d="M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"/>',
100
- fingerprint: '<path d="M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4"/><path d="M14 13.12c0 2.38 0 6.38-1 8.88"/><path d="M17.29 21.02c.12-.6.43-2.3.5-3.02"/><path d="M2 12a10 10 0 0 1 18-6"/><path d="M2 16h.01"/><path d="M21.8 16c.2-2 .131-5.354 0-6"/><path d="M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2"/><path d="M8.65 22c.21-.66.45-1.32.57-2"/><path d="M9 6.8a6 6 0 0 1 9 5.2v2"/>',
101
- folder: '<path d="M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z"/>',
102
- globe: '<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>',
103
- "grip-vertical": '<circle cx="9" cy="12" r="1" fill="currentColor" stroke="none"/><circle cx="9" cy="5" r="1" fill="currentColor" stroke="none"/><circle cx="9" cy="19" r="1" fill="currentColor" stroke="none"/><circle cx="15" cy="12" r="1" fill="currentColor" stroke="none"/><circle cx="15" cy="5" r="1" fill="currentColor" stroke="none"/><circle cx="15" cy="19" r="1" fill="currentColor" stroke="none"/>',
104
- heart: '<path d="M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"/>',
105
- home: '<path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"/><path d="M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"/>',
106
- image: '<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>',
107
- info: '<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>',
108
- insights: '<path d="M3 3v16a2 2 0 0 0 2 2h16"/><path d="m19 9-5 5-4-4-3 3"/>',
109
- italic: '<line x1="19" x2="10" y1="4" y2="4"/><line x1="14" x2="5" y1="20" y2="20"/><line x1="15" x2="9" y1="4" y2="20"/>',
110
- key: '<path d="M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z"/><circle cx="16.5" cy="7.5" r=".5" fill="currentColor"/>',
111
- link: '<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>',
112
- list: '<path d="M3 5h.01"/><path d="M3 12h.01"/><path d="M3 19h.01"/><path d="M8 5h13"/><path d="M8 12h13"/><path d="M8 19h13"/>',
113
- "list-ordered": '<path d="M11 5h10"/><path d="M11 12h10"/><path d="M11 19h10"/><path d="M4 4h1v5"/><path d="M4 9h2"/><path d="M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02"/>',
114
- loader: '<path d="M21 12a9 9 0 1 1-6.219-8.56"/>',
115
- lock: '<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>',
116
- "log-in": '<path d="m10 17 5-5-5-5"/><path d="M15 12H3"/><path d="M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4"/>',
117
- "log-out": '<path d="m16 17 5-5-5-5"/><path d="M21 12H9"/><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/>',
118
- mail: '<path d="m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7"/><rect x="2" y="4" width="20" height="16" rx="2"/>',
119
- menu: '<path d="M4 5h16"/><path d="M4 12h16"/><path d="M4 19h16"/>',
120
- minus: '<path d="M5 12h14"/>',
121
- moon: '<path d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"/>',
122
- network: '<rect x="16" y="16" width="6" height="6" rx="1"/><rect x="2" y="16" width="6" height="6" rx="1"/><rect x="9" y="2" width="6" height="6" rx="1"/><path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3"/><path d="M12 12V8"/>',
123
- paperclip: '<path d="m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551"/>',
124
- pencil: '<path d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"/><path d="m15 5 4 4"/>',
125
- phone: '<path d="M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"/>',
126
- play: '<path d="M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z" fill="currentColor" stroke="none"/>',
127
- plus: '<path d="M5 12h14"/><path d="M12 5v14"/>',
128
- policy: '<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="m9 12 2 2 4-4"/>',
129
- refresh: '<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/>',
130
- rocket: '<path d="M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"/><path d="M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09"/><path d="M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z"/><path d="M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05"/>',
131
- search: '<path d="m21 21-4.34-4.34"/><circle cx="11" cy="11" r="8"/>',
132
- "search-off": '<path d="m13.5 8.5-5 5"/><path d="m8.5 8.5 5 5"/><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>',
133
- send: '<path d="M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z"/><path d="m21.854 2.147-10.94 10.939"/>',
134
- server: '<rect width="20" height="8" x="2" y="2" rx="2" ry="2"/><rect width="20" height="8" x="2" y="14" rx="2" ry="2"/><line x1="6" x2="6.01" y1="6" y2="6"/><line x1="6" x2="6.01" y1="18" y2="18"/>',
135
- settings: '<path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915"/><circle cx="12" cy="12" r="3"/>',
136
- shield: '<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/>',
137
- ship: '<path d="M12 10.189V14"/><path d="M12 2v3"/><path d="M19 13V7a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v6"/><path d="M19.38 20A11.6 11.6 0 0 0 21 14l-8.188-3.639a2 2 0 0 0-1.624 0L3 14a11.6 11.6 0 0 0 2.81 7.76"/><path d="M2 21c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1s1.2 1 2.5 1c2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1"/>',
138
- sparkle: '<path d="M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z"/><path d="M20 2v4"/><path d="M22 4h-4"/><circle cx="4" cy="20" r="2"/>',
139
- speed: '<path d="m12 14 4-4"/><path d="M3.34 19a10 10 0 1 1 17.32 0"/>',
140
- star: '<path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"/>',
141
- sun: '<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>',
142
- terminal: '<path d="M12 19h8"/><path d="m4 17 6-6-6-6"/>',
143
- trash: '<path d="M10 11v6"/><path d="M14 11v6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M3 6h18"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>',
144
- "trending-up": '<path d="M16 7h6v6"/><path d="m22 7-8.5 8.5-5-5L2 17"/>',
145
- underline: '<path d="M6 4v6a6 6 0 0 0 12 0V4"/><line x1="4" x2="20" y1="20" y2="20"/>',
146
- upload: '<path d="M12 3v12"/><path d="m17 8-5-5-5 5"/><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>',
147
- user: '<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>',
148
- "user-shield": '<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="M6.376 18.91a6 6 0 0 1 11.249.003"/><circle cx="12" cy="11" r="4"/>',
149
- x: '<path d="M18 6 6 18"/><path d="m6 6 12 12"/>'
150
- };
151
-
152
- // src/lib/core/brand-icons.ts
153
- var VIKING_BRAND_ICON_PATHS = {
154
- /** Primary bar-chart mark in rounded frame (outline). */
155
- deml: '<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M8 17V13M12 17V8M16 17V11"/>',
156
- /** Compact monogram for favicons and dense Drakkar shell. */
157
- "deml-compact": '<rect x="4" y="4" width="16" height="16" rx="3"/><path d="M9 16V12M12 16V9M15 16V13"/>',
158
- /** Lockup mark with baseline accent bar. */
159
- "deml-lockup": '<rect x="3" y="3" width="18" height="14" rx="2"/><path d="M8 17V13M12 17V8M16 17V11"/><path d="M3 20h18"/>'
160
- };
161
- var VIKING_DRAKKAR_ICON_PATHS = {
162
- /** Primary Drakkar longship mark (outline). */
163
- drakkar: '<path d="M12 10.189V14"/><path d="M12 2v3"/><path d="M19 13V7a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v6"/><path d="M19.38 20A11.6 11.6 0 0 0 21 14l-8.188-3.639a2 2 0 0 0-1.624 0L3 14a11.6 11.6 0 0 0 2.81 7.76"/><path d="M2 21c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1s1.2 1 2.5 1c2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1"/>',
164
- /** Compact tile for favicons and dense navbar chrome. */
165
- "drakkar-compact": '<rect x="3" y="3" width="18" height="18" rx="2"/><path d="M12 10.189V14"/><path d="M12 2v3"/><path d="M19 13V7a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v6"/><path d="M19.38 20A11.6 11.6 0 0 0 21 14l-8.188-3.639a2 2 0 0 0-1.624 0L3 14a11.6 11.6 0 0 0 2.81 7.76"/><path d="M2 21c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1s1.2 1 2.5 1c2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1"/>',
166
- /** Lockup mark with baseline accent bar. */
167
- "drakkar-lockup": '<path d="M12 10.189V14"/><path d="M12 2v3"/><path d="M19 13V7a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v6"/><path d="M19.38 20A11.6 11.6 0 0 0 21 14l-8.188-3.639a2 2 0 0 0-1.624 0L3 14a11.6 11.6 0 0 0 2.81 7.76"/><path d="M2 21c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1s1.2 1 2.5 1c2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1"/><path d="M3 21h18"/>'
168
- };
169
- var VIKING_BRAND_ICON_FILLED_PATHS = {
170
- deml: '<path d="M5 4a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V4zM8 13h2.5v4H8v-4zM12 8h2.5v9H12V8zM16 11h2.5v6H16v-6z"/>',
171
- "deml-compact": '<path d="M6 5a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V5zM9 12h1.5v4H9v-4zM12 9h1.5v7H12V9zM15 11h1.5v5H15v-5z"/>',
172
- "deml-lockup": '<path d="M4 4a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V4zM8 13h2.5v4H8v-4zM12 8h2.5v9H12V8zM16 11h2.5v6H16v-6z"/><rect x="3" y="19" width="18" height="2" rx="1"/>'
173
- };
174
- var VIKING_DRAKKAR_ICON_FILLED_PATHS = {
175
- drakkar: '<path d="M7 5h10a2 2 0 0 1 2 2v3.5L20.8 14.2l-7.8-3.5a1.8 1.8 0 0 0-1.4 0L3.2 14.2a10.5 10.5 0 0 0 2.6 7.2L5.2 13V7a2 2 0 0 0-2-2z"/><rect x="10.85" y="2" width="2.3" height="12" rx="0.4"/>',
176
- "drakkar-compact": '<path d="M3 3h18a2 2 0 0 1 2 2v18a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z"/><path d="M7.5 12.5 12 9.8l4.5 2.7v2.2c0 .8-.5 1.4-1.2 1.7L12 17.8l-3.3-1.6c-.7-.3-1.2-.9-1.2-1.7v-2.2z"/><rect x="11" y="6" width="2" height="5.5" rx="0.35"/>',
177
- "drakkar-lockup": '<path d="M7 5h10a2 2 0 0 1 2 2v3.5L20.8 14.2l-7.8-3.5a1.8 1.8 0 0 0-1.4 0L3.2 14.2a10.5 10.5 0 0 0 2.6 7.2L5.2 13V7a2 2 0 0 0-2-2z"/><rect x="10.85" y="2" width="2.3" height="12" rx="0.4"/><rect x="3" y="20" width="18" height="2" rx="1"/>'
178
- };
179
- var VIKING_BRAND_ICON_NAMES_LIST = Object.keys(
180
- VIKING_BRAND_ICON_PATHS
181
- );
182
- var VIKING_DRAKKAR_ICON_NAMES_LIST = Object.keys(
183
- VIKING_DRAKKAR_ICON_PATHS
184
- );
185
-
186
- // src/lib/core/integration-brand-icons.ts
187
- var VIKING_INTEGRATION_BRAND_COLORS = {
188
- kubernetes: "#326CE5",
189
- tensorflow: "#FF6F00",
190
- pytorch: "#EE4C2C",
191
- "apache-spark": "#E25A1C",
192
- databricks: "#FF3621",
193
- "aws-redshift": "#8C4FFF"
194
- };
195
- var VIKING_INTEGRATION_BRAND_NAMES = Object.keys(
196
- VIKING_INTEGRATION_BRAND_COLORS
197
- );
198
- var VIKING_INTEGRATION_BRAND_PATHS = {
199
- kubernetes: "M10.204 14.35l.007.01-.999 2.413a5.171 5.171 0 0 1-2.075-2.597l2.578-.437.004.005a.44.44 0 0 1 .484.606zm-.833-2.129a.44.44 0 0 0 .173-.756l.002-.011L7.585 9.7a5.143 5.143 0 0 0-.73 3.255l2.514-.725.002-.009zm1.145-1.98a.44.44 0 0 0 .699-.337l.01-.005.15-2.62a5.144 5.144 0 0 0-3.01 1.442l2.147 1.523.004-.002zm.76 2.75l.723.349.722-.347.18-.78-.5-.623h-.804l-.5.623.179.779zm1.5-3.095a.44.44 0 0 0 .7.336l.008.003 2.134-1.513a5.188 5.188 0 0 0-2.992-1.442l.148 2.615.002.001zm10.876 5.97l-5.773 7.181a1.6 1.6 0 0 1-1.248.594l-9.261.003a1.6 1.6 0 0 1-1.247-.596l-5.776-7.18a1.583 1.583 0 0 1-.307-1.34L2.1 5.573c.108-.47.425-.864.863-1.073L11.305.513a1.606 1.606 0 0 1 1.385 0l8.345 3.985c.438.209.755.604.863 1.073l2.062 8.955c.108.47-.005.963-.308 1.34zm-3.289-2.057c-.042-.01-.103-.026-.145-.034-.174-.033-.315-.025-.479-.038-.35-.037-.638-.067-.895-.148-.105-.04-.18-.165-.216-.216l-.201-.059a6.45 6.45 0 0 0-.105-2.332 6.465 6.465 0 0 0-.936-2.163c.052-.047.15-.133.177-.159.008-.09.001-.183.094-.282.197-.185.444-.338.743-.522.142-.084.273-.137.415-.242.032-.024.076-.062.11-.089.24-.191.295-.52.123-.736-.172-.216-.506-.236-.745-.045-.034.027-.08.062-.111.088-.134.116-.217.23-.33.35-.246.25-.45.458-.673.609-.097.056-.239.037-.303.033l-.19.135a6.545 6.545 0 0 0-4.146-2.003l-.012-.223c-.065-.062-.143-.115-.163-.25-.022-.268.015-.557.057-.905.023-.163.061-.298.068-.475.001-.04-.001-.099-.001-.142 0-.306-.224-.555-.5-.555-.275 0-.499.249-.499.555l.001.014c0 .041-.002.092 0 .128.006.177.044.312.067.475.042.348.078.637.056.906a.545.545 0 0 1-.162.258l-.012.211a6.424 6.424 0 0 0-4.166 2.003 8.373 8.373 0 0 1-.18-.128c-.09.012-.18.04-.297-.029-.223-.15-.427-.358-.673-.608-.113-.12-.195-.234-.329-.349-.03-.026-.077-.062-.111-.088a.594.594 0 0 0-.348-.132.481.481 0 0 0-.398.176c-.172.216-.117.546.123.737l.007.005.104.083c.142.105.272.159.414.242.299.185.546.338.743.522.076.082.09.226.1.288l.16.143a6.462 6.462 0 0 0-1.02 4.506l-.208.06c-.055.072-.133.184-.215.217-.257.081-.546.11-.895.147-.164.014-.305.006-.48.039-.037.007-.09.02-.133.03l-.004.002-.007.002c-.295.071-.484.342-.423.608.061.267.349.429.645.365l.007-.001.01-.003.129-.029c.17-.046.294-.113.448-.172.33-.118.604-.217.87-.256.112-.009.23.069.288.101l.217-.037a6.5 6.5 0 0 0 2.88 3.596l-.09.218c.033.084.069.199.044.282-.097.252-.263.517-.452.813-.091.136-.185.242-.268.399-.02.037-.045.095-.064.134-.128.275-.034.591.213.71.248.12.556-.007.69-.282v-.002c.02-.039.046-.09.062-.127.07-.162.094-.301.144-.458.132-.332.205-.68.387-.897.05-.06.13-.082.215-.105l.113-.205a6.453 6.453 0 0 0 4.609.012l.106.192c.086.028.18.042.256.155.136.232.229.507.342.84.05.156.074.295.145.457.016.037.043.09.062.129.133.276.442.402.69.282.247-.118.341-.435.213-.71-.02-.039-.045-.096-.065-.134-.083-.156-.177-.261-.268-.398-.19-.296-.346-.541-.443-.793-.04-.13.007-.21.038-.294-.018-.022-.059-.144-.083-.202a6.499 6.499 0 0 0 2.88-3.622c.064.01.176.03.213.038.075-.05.144-.114.28-.104.266.039.54.138.87.256.154.06.277.128.448.173.036.01.088.019.13.028l.009.003.007.001c.297.064.584-.098.645-.365.06-.266-.128-.537-.423-.608zM16.4 9.701l-1.95 1.746v.005a.44.44 0 0 0 .173.757l.003.01 2.526.728a5.199 5.199 0 0 0-.108-1.674A5.208 5.208 0 0 0 16.4 9.7zm-4.013 5.325a.437.437 0 0 0-.404-.232.44.44 0 0 0-.372.233h-.002l-1.268 2.292a5.164 5.164 0 0 0 3.326.003l-1.27-2.296h-.01zm1.888-1.293a.44.44 0 0 0-.27.036.44.44 0 0 0-.214.572l-.003.004 1.01 2.438a5.15 5.15 0 0 0 2.081-2.615l-2.6-.44-.004.005z",
200
- tensorflow: "M1.292 5.856L11.54 0v24l-4.095-2.378V7.603l-6.168 3.564.015-5.31zm21.43 5.311l-.014-5.31L12.46 0v24l4.095-2.378V14.87l3.092 1.788-.018-4.618-3.074-1.756V7.603l6.168 3.564z",
201
- pytorch: "M12.005 0L4.952 7.053a9.865 9.865 0 000 14.022 9.866 9.866 0 0014.022 0c3.984-3.9 3.986-10.205.085-14.023l-1.744 1.743c2.904 2.905 2.904 7.634 0 10.538s-7.634 2.904-10.538 0-2.904-7.634 0-10.538l4.647-4.646.582-.665zm3.568 3.899a1.327 1.327 0 00-1.327 1.327 1.327 1.327 0 001.327 1.328A1.327 1.327 0 0016.9 5.226 1.327 1.327 0 0015.573 3.9z",
202
- "apache-spark": "M10.812 0c-.425.013-.845.215-1.196.605a3.593 3.593 0 00-.493.722c-.355.667-.425 1.415-.556 2.143a551.9 551.9 0 00-.726 4.087c-.027.16-.096.227-.244.273C5.83 8.386 4.06 8.94 2.3 9.514c-.387.125-.773.289-1.114.506-1.042.665-1.196 1.753-.415 2.71.346.422.79.715 1.284.936 1.1.49 2.202.976 3.3 1.47.019.01.036.013.053.019h-.004l1.306.535c0 .023.002.045 0 .073-.2 2.03-.39 4.063-.58 6.095-.04.419-.012.831.134 1.23.317.87 1.065 1.148 1.881.701.372-.204.666-.497.937-.818 1.372-1.623 2.746-3.244 4.113-4.872.111-.133.205-.15.363-.098.349.117.697.231 1.045.347h.001c.02.012.045.02.073.03l.142.042c1.248.416 2.68.775 3.929 1.19.4.132.622.164 1.045.098.311-.048.592-.062.828-.236.602-.33.995-.957.988-1.682-.005-.427-.154-.813-.35-1.186-.82-1.556-1.637-3.113-2.461-4.666-.078-.148-.076-.243.037-.375 1.381-1.615 2.756-3.236 4.133-4.855.272-.32.513-.658.653-1.058.308-.878-.09-1.57-1-1.741a2.783 2.783 0 00-1.235.069c-1.974.521-3.947 1.041-5.918 1.57-.175.047-.26.015-.355-.144a353.08 353.08 0 00-2.421-4.018 4.61 4.61 0 00-.652-.849c-.371-.37-.802-.549-1.227-.536zm.172 3.703a.592.592 0 01.189.211c.87 1.446 1.742 2.89 2.609 4.338.07.118.135.16.277.121 1.525-.41 3.052-.813 4.579-1.217.367-.098.735-.193 1.103-.289a.399.399 0 01-.1.2c-1.259 1.48-2.516 2.962-3.779 4.438-.11.13-.12.22-.04.37.937 1.803 1.768 3.309 2.498 4.76l-3.696-1.019c-.538-.18-1.077-.358-1.615-.539-.163-.055-.25-.03-.36.1-1.248 1.488-2.504 2.97-3.759 4.454a.398.398 0 01-.18.132c.035-.378.068-.757.104-1.136.149-1.572.297-3.144.451-4.716-.03-.318.117-.405-.322-.545-1.493-.593-3.346-1.321-4.816-1.905a.595.595 0 01.24-.134c1.797-.57 3.595-1.14 5.394-1.705.127-.04.199-.092.211-.233.013-.148.05-.294.076-.441.241-1.363.483-2.726.726-4.088.068-.386.14-.771.21-1.157z",
203
- databricks: "M.95 14.184L12 20.403l9.919-5.55v2.21L12 22.662l-10.484-5.96-.565.308v.77L12 24l11.05-6.218v-4.317l-.515-.309L12 19.118l-9.867-5.653v-2.21L12 16.805l11.05-6.218V6.32l-.515-.308L12 11.974 2.647 6.681 12 1.388l7.76 4.368.668-.411v-.566L12 0 .95 6.27v.72L12 13.207l9.919-5.55v2.26L12 15.52 1.516 9.56l-.565.308Z",
204
- "aws-redshift": "M16.639 9.932a.822.822 0 0 1-.822-.82.823.823 0 0 1 1.645 0c0 .452-.37.82-.823.82m-2.086 4.994a.823.823 0 0 1-.822-.822.822.822 0 0 1 1.645 0 .822.822 0 0 1-.823.822m-5.004-.833a.822.822 0 1 1 .002-1.644.822.822 0 0 1-.002 1.644m-2.083 4.578a.823.823 0 0 1-.823-.82.823.823 0 0 1 1.645 0c0 .452-.37.82-.822.82m9.173-11.236a1.68 1.68 0 0 0-1.68 1.676c0 .566.285 1.066.718 1.37l-.782 1.982a1.674 1.674 0 0 0-1.923 1.104l-1.753-.398a1.675 1.675 0 0 0-3.348.103c0 .432.169.823.438 1.12l-.764 1.79c-.028-.001-.053-.008-.08-.008a1.68 1.68 0 0 0-1.68 1.676 1.68 1.68 0 0 0 3.36 0c0-.593-.312-1.112-.778-1.41l.674-1.579c.161.052.33.088.508.088.661 0 1.228-.386 1.502-.94l1.856.42a1.68 1.68 0 0 0 3.327-.325c0-.5-.224-.943-.574-1.25l.822-2.083c.053.005.104.016.157.016a1.68 1.68 0 0 0 1.68-1.676 1.68 1.68 0 0 0-1.68-1.676M12 23.145c-4.17 0-7.286-1.252-7.286-2.37V4.79C6.14 5.938 9.131 6.547 12 6.547c2.869 0 5.86-.609 7.286-1.756v15.983c0 1.12-3.116 2.37-7.286 2.37M12 .856c4.293 0 7.286 1.274 7.286 2.419 0 1.143-2.993 2.418-7.286 2.418-4.293 0-7.286-1.275-7.286-2.418C4.714 2.129 7.707.855 12 .855m8.143 2.419C20.143 1.147 15.947 0 12 0 8.052 0 3.857 1.147 3.857 3.274l.002.01h-.002v17.49C3.857 22.87 8.052 24 12 24c3.947 0 8.143-1.13 8.143-3.226V3.284h-.002l.002-.01"
205
- };
206
- var integrationBrandSvg = (name) => {
207
- const fill = VIKING_INTEGRATION_BRAND_COLORS[name];
208
- const d = VIKING_INTEGRATION_BRAND_PATHS[name];
209
- return `<path fill="${fill}" d="${d}"/>`;
210
- };
211
- var VIKING_INTEGRATION_BRAND_SVGS = {
212
- kubernetes: integrationBrandSvg("kubernetes"),
213
- tensorflow: integrationBrandSvg("tensorflow"),
214
- pytorch: integrationBrandSvg("pytorch"),
215
- "apache-spark": integrationBrandSvg("apache-spark"),
216
- databricks: integrationBrandSvg("databricks"),
217
- "aws-redshift": integrationBrandSvg("aws-redshift")
218
- };
219
- var VIKING_INTEGRATION_ICON_PATHS = Object.fromEntries(
220
- Object.entries(VIKING_INTEGRATION_BRAND_PATHS).map(([name, d]) => [name, `<path d="${d}"/>`])
221
- );
222
-
223
- // src/lib/core/icons.ts
224
- var VIKING_CUSTOM_ICON_PATHS = {
225
- hub: '<circle cx="12" cy="12" r="3"/><path d="M12 3v3M12 18v3M3 12h3M18 12h3M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M18.4 5.6l-2.1 2.1M7.7 16.3l-2.1 2.1"/>',
226
- model: '<rect x="4" y="8" width="16" height="10" rx="2"/><path d="M8 8V6a4 4 0 0 1 8 0v2"/>',
227
- google: '<path d="M12 11.2v2.4h6.6c-.3 1.5-1.8 4.4-6.6 4.4-4 0-7.2-3.3-7.2-7.3S8 3.4 12 3.4c2.3 0 3.9 1 4.8 1.8l3.2-3.1C17.5.8 14.9 0 12 0 5.4 0 0 5.4 0 12s5.4 12 12 12c6.9 0 11.5-4.8 11.5-11.6 0-.8-.1-1.4-.2-1.9H12z"/>',
228
- apple: '<path d="M16.365 12.14c.02 2.53 2.21 3.38 2.23 3.39-.02.07-.35 1.21-1.16 2.4-.7 1.02-1.43 2.03-2.58 2.05-1.13.02-1.49-.67-2.78-.67-1.29 0-1.69.65-2.75.69-1.11.04-1.95-1.12-2.66-2.13-1.44-2.08-2.54-5.87-1.07-8.43.73-1.27 2.04-2.08 3.46-2.1 1.08-.02 2.1.72 2.78.72.67 0 2.14-.89 3.61-.76.61.03 2.33.25 3.44 1.88-.09.06-2.05 1.2-2.03 3.55M13.75 3.64c.59-.71 1-1.7.89-2.68-.86.03-1.9.57-2.52 1.28-.55.63-1.03 1.65-.9 2.62.95.07 1.92-.49 2.53-1.22"/>'
229
- };
230
- var VIKING_ICON_PATHS = {
231
- ...LUCIDE_ICON_PATHS,
232
- ...VIKING_BRAND_ICON_PATHS,
233
- ...VIKING_DRAKKAR_ICON_PATHS,
234
- ...VIKING_INTEGRATION_ICON_PATHS,
235
- ...VIKING_CUSTOM_ICON_PATHS
236
- };
237
- var VIKING_ICON_FILLED_PATHS = {
238
- ...VIKING_BRAND_ICON_FILLED_PATHS,
239
- ...VIKING_DRAKKAR_ICON_FILLED_PATHS
240
- };
241
- var MATERIAL_ICON_ALIASES = {
242
- analytics: "deml",
243
- security: "shield",
244
- link: "link",
245
- visibility: "eye",
246
- shield: "shield",
247
- trending_up: "trending-up",
248
- lock: "lock",
249
- fingerprint: "fingerprint",
250
- gpp_maybe: "shield",
251
- verified_user: "user-shield",
252
- bolt: "bolt",
253
- cloud: "cloud",
254
- lan: "network",
255
- hub: "hub",
256
- speed: "speed",
257
- rocket_launch: "rocket",
258
- insights: "insights",
259
- check: "check",
260
- description: "file",
261
- vpn_key: "key",
262
- policy: "policy",
263
- bug_report: "bug",
264
- search: "search",
265
- chevron_left: "chevron-left",
266
- chevron_right: "chevron-right",
267
- verified: "check-circle",
268
- warning: "alert-triangle",
269
- close: "x",
270
- account_balance: "building",
271
- send: "send",
272
- check_circle: "check-circle",
273
- play_circle: "play",
274
- input: "terminal",
275
- model_training: "model",
276
- auto_awesome: "sparkle",
277
- error_outline: "alert-circle",
278
- home: "home",
279
- cookie: "cookie",
280
- search_off: "search-off",
281
- person_add: "user",
282
- storage: "aws-redshift",
283
- data_object: "aws-redshift",
284
- memory: "tensorflow",
285
- psychology: "pytorch",
286
- dns: "server",
287
- login: "log-in"
288
- };
289
- var VIKING_FILLED_ICON_NAMES = [
290
- "play",
291
- "dots-horizontal",
292
- "dots-vertical",
293
- "grip-vertical"
294
- ];
295
- var VIKING_BRAND_ICON_NAMES = [
296
- "google",
297
- "apple",
298
- ...VIKING_BRAND_ICON_NAMES_LIST
299
- ];
300
- var VIKING_ICON_PATH_KEYS = new Set(Object.keys(VIKING_ICON_PATHS));
301
- var resolveVikingIcon = (name) => {
302
- const normalized = name.trim().toLowerCase().replace(/\s+/g, "_");
303
- if (VIKING_ICON_PATH_KEYS.has(normalized)) {
304
- return normalized;
305
- }
306
- const alias = MATERIAL_ICON_ALIASES[normalized];
307
- if (alias) {
308
- return alias;
309
- }
310
- return "info";
311
- };
312
- var VIKING_ICON_NAMES = Object.keys(
313
- VIKING_ICON_PATHS
314
- );
315
- var VIKING_LUCIDE_ICON_NAMES = Object.keys(
316
- LUCIDE_ICON_PATHS
317
- );
318
-
319
- // src/web/core/icons-inline.ts
320
- var FILLED_ICON_SET = new Set(VIKING_FILLED_ICON_NAMES);
321
- var renderInlineIcon = (name, size = 16, className = "viking-wc-icon") => {
322
- const resolved = resolveVikingIcon(name);
323
- const filled = FILLED_ICON_SET.has(resolved);
324
- const paths = filled ? VIKING_ICON_FILLED_PATHS[resolved] ?? VIKING_ICON_PATHS[resolved] : VIKING_ICON_PATHS[resolved];
325
- if (filled) {
326
- return `<svg class="${className}" width="${size}" height="${size}" viewBox="0 0 24 24" fill="currentColor" fill-rule="evenodd" aria-hidden="true">${paths}</svg>`;
327
- }
328
- return `<svg class="${className}" width="${size}" height="${size}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${paths}</svg>`;
329
- };
330
- var TONE_ICON_NAMES = {
331
- accent: "info",
332
- secondary: "info",
333
- success: "check-circle",
334
- warning: "alert-triangle",
335
- danger: "alert-circle",
336
- info: "info",
337
- muted: "info",
338
- subtle: "info"
339
- };
340
-
341
- // src/web/core/styles.ts
342
- var VIKING_BUTTON_STYLES = `
343
- :host {
344
- display: inline-flex;
345
- font-family: var(--viking-font-family);
346
- }
347
-
348
- :host([full-width]) {
349
- display: flex;
350
- width: 100%;
351
- }
352
-
353
- :host([full-width]) .viking-btn {
354
- width: 100%;
355
- min-width: 0;
356
- }
357
-
358
- :host([compact]) .viking-btn {
359
- min-width: 0;
360
- }
361
-
362
- :host([square]) {
363
- flex: 0 0 auto;
364
- }
365
-
366
- .viking-btn {
367
- --viking-btn-depth-shadow: var(--viking-shadow-sm);
368
- --viking-btn-hover-shadow: var(--viking-shadow-hover);
369
- --viking-btn-press-shadow:
370
- inset 0 1px 2px color-mix(in srgb, var(--viking-black) 28%, transparent),
371
- var(--viking-shadow-xs);
372
-
373
- font-family: inherit;
374
- font-size: var(--viking-font-size-ui, var(--viking-font-size-sm));
375
- font-weight: var(--viking-font-weight-semibold);
376
- letter-spacing: var(--viking-letter-spacing-wide);
377
- line-height: var(--viking-line-height-snug);
378
- display: inline-flex;
379
- align-items: center;
380
- justify-content: center;
381
- gap: var(--viking-space-1-5);
382
- min-height: var(--viking-control-height);
383
- padding: var(--viking-space-half) var(--viking-control-padding-x);
384
- border-radius: var(--viking-radius-md);
385
- border: 1px solid transparent;
386
- cursor: pointer;
387
- text-decoration: none;
388
- transition: var(--viking-transition-interactive);
389
- width: auto;
390
- min-width: var(--viking-btn-min-width, 120px);
391
- white-space: nowrap;
392
- position: relative;
393
- background-clip: padding-box;
394
- isolation: isolate;
395
- user-select: none;
396
- -webkit-tap-highlight-color: transparent;
397
- box-sizing: border-box;
398
- overflow: hidden;
399
- box-shadow: var(--viking-btn-depth-shadow);
400
- }
401
-
402
- .viking-btn::before {
403
- content: "";
404
- position: absolute;
405
- inset: 1px 1px auto;
406
- height: 1px;
407
- background: linear-gradient(
408
- 90deg,
409
- transparent,
410
- color-mix(in srgb, var(--viking-metallic-100) 45%, transparent),
411
- transparent
412
- );
413
- pointer-events: none;
414
- opacity: 0.88;
415
- transition: var(--viking-transition-interactive);
416
- }
417
-
418
- .viking-btn:focus-visible {
419
- outline: var(--viking-ring-width) solid var(--viking-ring);
420
- outline-offset: var(--viking-ring-offset);
421
- z-index: 1;
422
- }
423
-
424
- .viking-btn:disabled,
425
- .viking-btn[aria-busy='true'] {
426
- opacity: var(--viking-state-disabled-opacity);
427
- cursor: not-allowed;
428
- transform: none !important;
429
- box-shadow: none !important;
430
- }
431
-
432
- .viking-btn[aria-busy='true'] {
433
- cursor: wait;
434
- }
435
-
436
- .viking-btn[aria-busy='true']::before,
437
- .viking-btn[aria-busy='true'] .viking-btn-label {
438
- opacity: 0.78;
439
- transform: translateY(1px);
440
- }
441
-
442
- .viking-btn[aria-busy='true'] .viking-btn-spinner {
443
- opacity: 0.85;
444
- }
445
-
446
- .viking-btn::after {
447
- content: "";
448
- position: absolute;
449
- inset: auto 0 0 0;
450
- height: 1px;
451
- background: linear-gradient(
452
- 90deg,
453
- transparent,
454
- color-mix(
455
- in srgb,
456
- var(--viking-metallic-100) 18%,
457
- transparent
458
- ),
459
- transparent
460
- );
461
- pointer-events: none;
462
- opacity: 0.45;
463
- transition: var(--viking-transition-interactive);
464
- }
465
-
466
- .viking-btn-sm {
467
- min-height: var(--viking-control-height-sm);
468
- padding: 0 var(--viking-space-2);
469
- font-size: var(--viking-font-size-xs);
470
- min-width: auto;
471
- }
472
-
473
- .viking-btn-xs {
474
- min-height: var(--viking-control-height-xs);
475
- padding: 0 var(--viking-space-1);
476
- font-size: var(--viking-font-size-xs);
477
- min-width: auto;
478
- }
479
-
480
- .viking-btn-square {
481
- display: inline-grid;
482
- place-items: center;
483
- width: var(--viking-control-height);
484
- min-width: var(--viking-control-height);
485
- max-width: var(--viking-control-height);
486
- height: var(--viking-control-height);
487
- min-height: var(--viking-control-height);
488
- padding: 0;
489
- line-height: 1;
490
- }
491
-
492
- .viking-btn-square.viking-btn-sm {
493
- width: var(--viking-control-height-sm);
494
- min-width: var(--viking-control-height-sm);
495
- max-width: var(--viking-control-height-sm);
496
- height: var(--viking-control-height-sm);
497
- min-height: var(--viking-control-height-sm);
498
- }
499
-
500
- .viking-btn-square.viking-btn-xs {
501
- width: var(--viking-control-height-xs);
502
- min-width: var(--viking-control-height-xs);
503
- max-width: var(--viking-control-height-xs);
504
- height: var(--viking-control-height-xs);
505
- min-height: var(--viking-control-height-xs);
506
- }
507
-
508
- .viking-btn-square .viking-btn-label {
509
- display: inline-grid;
510
- place-items: center;
511
- width: 100%;
512
- height: 100%;
513
- line-height: 1;
514
- }
515
-
516
- .viking-btn-square ::slotted(*) {
517
- display: inline-flex;
518
- align-items: center;
519
- justify-content: center;
520
- margin: 0;
521
- line-height: 1;
522
- }
523
-
524
- .viking-btn-square ::slotted(svg),
525
- .viking-btn-square ::slotted([data-viking-icon]) {
526
- width: var(--viking-icon-size-md, 20px);
527
- height: var(--viking-icon-size-md, 20px);
528
- }
529
-
530
- ::slotted(viking-icon),
531
- ::slotted(.viking-icon),
532
- ::slotted([data-viking-icon]) {
533
- display: inline-flex;
534
- align-items: center;
535
- justify-content: center;
536
- width: var(--viking-icon-size-md);
537
- height: var(--viking-icon-size-md);
538
- line-height: 1;
539
- flex-shrink: 0;
540
- pointer-events: none;
541
- flex: 0 0 auto;
542
- margin-block: calc(var(--viking-space-half) * -1);
543
- }
544
-
545
- .viking-btn-outline {
546
- background: var(--viking-surface);
547
- color: var(--viking-text);
548
- border-color: var(--viking-border-strong);
549
- box-shadow: var(--viking-btn-depth-shadow);
550
- }
551
-
552
- .viking-btn-outline:hover:not(:disabled):not([aria-busy='true']) {
553
- background: color-mix(in srgb, var(--viking-accent) 5%, var(--viking-surface-alt));
554
- border-color: color-mix(in srgb, var(--viking-accent) 45%, var(--viking-border-strong));
555
- box-shadow: var(--viking-btn-hover-shadow);
556
- transform: translateY(var(--viking-state-hover-lift));
557
- }
558
-
559
- .viking-btn-outline:active:not(:disabled):not([aria-busy='true']) {
560
- transform: translateY(0) scale(var(--viking-state-active-scale));
561
- box-shadow: var(--viking-btn-press-shadow);
562
- border-color: var(--viking-border-strong);
563
- }
564
-
565
- .viking-btn-primary {
566
- background: var(--viking-accent);
567
- color: var(--viking-accent-content);
568
- border-color: color-mix(in srgb, var(--viking-accent) 82%, var(--viking-black));
569
- box-shadow:
570
- var(--viking-btn-depth-shadow),
571
- inset 0 1px 0 color-mix(in srgb, var(--viking-white-pure) 12%, transparent);
572
- }
573
-
574
- .viking-btn-primary:hover:not(:disabled):not([aria-busy='true']) {
575
- background: var(--viking-accent-hover);
576
- border-color: var(--viking-accent-hover);
577
- box-shadow: var(--viking-btn-hover-shadow);
578
- transform: translateY(var(--viking-state-hover-lift));
579
- }
580
-
581
- .viking-btn-primary:active:not(:disabled):not([aria-busy='true']) {
582
- transform: translateY(0) scale(var(--viking-state-active-scale));
583
- box-shadow: var(--viking-btn-press-shadow);
584
- border-color: color-mix(in srgb, var(--viking-accent) 82%, var(--viking-black));
585
- }
586
-
587
- .viking-btn-secondary {
588
- background: var(--viking-accent-secondary);
589
- color: var(--viking-accent-secondary-content);
590
- border-color: color-mix(in srgb, var(--viking-accent-secondary) 82%, var(--viking-black));
591
- box-shadow:
592
- var(--viking-btn-depth-shadow),
593
- inset 0 1px 0 color-mix(in srgb, var(--viking-white-pure) 10%, transparent);
594
- }
595
-
596
- .viking-btn-secondary:hover:not(:disabled):not([aria-busy='true']) {
597
- background: var(--viking-accent-secondary-hover);
598
- border-color: var(--viking-accent-secondary-hover);
599
- box-shadow: var(--viking-btn-hover-shadow);
600
- transform: translateY(var(--viking-state-hover-lift));
601
- }
602
-
603
- .viking-btn-secondary:active:not(:disabled):not([aria-busy='true']) {
604
- transform: translateY(0) scale(var(--viking-state-active-scale));
605
- box-shadow: var(--viking-btn-press-shadow);
606
- border-color: color-mix(in srgb, var(--viking-accent-secondary) 82%, var(--viking-black));
607
- }
608
-
609
- .viking-btn-filled {
610
- background: var(--viking-surface-alt);
611
- color: var(--viking-text);
612
- border-color: var(--viking-border);
613
- box-shadow: var(--viking-shadow-xs);
614
- }
615
-
616
- .viking-btn-filled:hover:not(:disabled):not([aria-busy='true']) {
617
- border-color: color-mix(in srgb, var(--viking-accent) 45%, var(--viking-border));
618
- background: color-mix(in srgb, var(--viking-accent) 8%, var(--viking-surface-alt));
619
- box-shadow: var(--viking-btn-depth-shadow);
620
- transform: translateY(var(--viking-state-hover-lift));
621
- }
622
-
623
- .viking-btn-filled:active:not(:disabled):not([aria-busy='true']) {
624
- transform: translateY(0) scale(var(--viking-state-active-scale));
625
- box-shadow: var(--viking-btn-press-shadow);
626
- border-color: color-mix(in srgb, var(--viking-accent) 20%, var(--viking-border));
627
- background: color-mix(in srgb, var(--viking-surface-alt) 84%, var(--viking-accent));
628
- }
629
-
630
- .viking-btn-danger {
631
- background: var(--viking-danger);
632
- color: var(--viking-on-danger);
633
- border-color: color-mix(in srgb, var(--viking-danger) 85%, var(--viking-black));
634
- box-shadow:
635
- var(--viking-btn-depth-shadow),
636
- inset 0 1px 0 color-mix(in srgb, var(--viking-white-pure) 10%, transparent);
637
- }
638
-
639
- .viking-btn-danger:hover:not(:disabled):not([aria-busy='true']) {
640
- background: color-mix(in srgb, var(--viking-danger) 88%, var(--viking-white));
641
- border-color: color-mix(in srgb, var(--viking-danger) 92%, var(--viking-white));
642
- box-shadow: var(--viking-btn-hover-shadow);
643
- transform: translateY(var(--viking-state-hover-lift));
644
- }
645
-
646
- .viking-btn-danger:active:not(:disabled):not([aria-busy='true']) {
647
- transform: translateY(0) scale(var(--viking-state-active-scale));
648
- border-color: color-mix(in srgb, var(--viking-danger) 72%, var(--viking-black));
649
- background: color-mix(in srgb, var(--viking-danger) 84%, var(--viking-black));
650
- box-shadow: var(--viking-btn-press-shadow);
651
- }
652
-
653
- .viking-btn-ghost {
654
- background: transparent;
655
- color: var(--viking-text);
656
- min-width: auto;
657
- box-shadow: none;
658
- border-color: transparent;
659
- }
660
-
661
- .viking-btn-ghost:hover:not(:disabled):not([aria-busy='true']) {
662
- background: var(--viking-accent-soft);
663
- color: var(--viking-accent-strong);
664
- border-color: var(--viking-border-subtle);
665
- transform: translateY(var(--viking-state-hover-lift));
666
- }
667
-
668
- .viking-btn-ghost:active:not(:disabled):not([aria-busy='true']) {
669
- transform: translateY(0) scale(var(--viking-state-active-scale));
670
- background: var(--viking-accent-soft);
671
- color: var(--viking-accent-strong);
672
- }
673
-
674
- .viking-btn-subtle {
675
- background: transparent;
676
- color: var(--viking-text-muted);
677
- border-color: var(--viking-border-subtle);
678
- min-width: auto;
679
- box-shadow: none;
680
- }
681
-
682
- .viking-btn-subtle:hover:not(:disabled):not([aria-busy='true']) {
683
- color: var(--viking-text);
684
- background: var(--viking-accent-soft);
685
- border-color: var(--viking-border-strong);
686
- }
687
-
688
- .viking-btn-subtle:active:not(:disabled):not([aria-busy='true']) {
689
- transform: translateY(0) scale(var(--viking-state-active-scale));
690
- border-color: var(--viking-border);
691
- background: color-mix(in srgb, var(--viking-accent-soft) 70%, var(--viking-surface));
692
- box-shadow: inset 0 1px 2px color-mix(in srgb, var(--viking-black) 24%, transparent);
693
- }
694
-
695
- .viking-btn:active:not(:disabled):not([aria-busy='true']) {
696
- transform: translateY(0) scale(var(--viking-state-active-scale));
697
- }
698
-
699
- .viking-btn-label {
700
- display: inline-flex;
701
- align-items: center;
702
- gap: var(--viking-space-1);
703
- line-height: 1.2;
704
- min-width: 0;
705
- justify-content: center;
706
- text-align: center;
707
- white-space: nowrap;
708
- }
709
-
710
- .viking-btn-spinner {
711
- flex: 0 0 auto;
712
- width: var(--viking-icon-size-sm, 18px);
713
- height: var(--viking-icon-size-sm, 18px);
714
- border: 2px solid currentColor;
715
- border-right-color: transparent;
716
- border-radius: var(--viking-radius-pill);
717
- animation: viking-spin 0.8s linear infinite;
718
- }
719
-
720
- @keyframes viking-spin {
721
- to { transform: rotate(360deg); }
722
- }
723
-
724
- @media (prefers-reduced-motion: reduce) {
725
- .viking-btn-spinner { animation-duration: 0.01ms; }
726
- .viking-btn { transition-duration: 0.01ms; }
727
- }
728
- `;
729
- var VIKING_INPUT_STYLES = `
730
- :host {
731
- display: block;
732
- font-family: var(--viking-font-family);
733
- }
734
-
735
- .viking-input-shell {
736
- display: flex;
737
- align-items: center;
738
- gap: var(--viking-space-1);
739
- min-height: var(--viking-control-height);
740
- padding: 0 var(--viking-space-2);
741
- font-family: inherit;
742
- font-size: var(--viking-font-size);
743
- color: var(--viking-text);
744
- background: var(--viking-surface-alt);
745
- border: 1px solid var(--viking-border);
746
- border-radius: var(--viking-radius-sm);
747
- box-shadow: var(--viking-shadow-xs);
748
- transition: var(--viking-transition-interactive);
749
- width: 100%;
750
- min-width: 0;
751
- box-sizing: border-box;
752
- }
753
-
754
- .viking-input-shell:hover:not(.viking-disabled):not(.viking-loading) {
755
- border-color: color-mix(in srgb, var(--viking-accent) 35%, var(--viking-border-strong));
756
- box-shadow: var(--viking-shadow-sm);
757
- }
758
-
759
- .viking-input-shell:focus-within:not(.viking-loading) {
760
- outline: var(--viking-ring-width) solid var(--viking-ring);
761
- outline-offset: var(--viking-ring-offset);
762
- border-color: var(--viking-accent);
763
- box-shadow: var(--viking-shadow-sm);
764
- }
765
-
766
- .viking-input-shell.viking-disabled,
767
- .viking-input-shell.viking-loading {
768
- opacity: var(--viking-state-disabled-opacity);
769
- }
770
-
771
- .viking-input-shell.viking-loading {
772
- cursor: wait;
773
- }
774
-
775
- .viking-input-native {
776
- flex: 1;
777
- min-width: 0;
778
- width: 100%;
779
- border: none;
780
- outline: none !important;
781
- background: transparent;
782
- color: var(--viking-text);
783
- font-family: inherit;
784
- font-size: inherit;
785
- padding: 0;
786
- }
787
-
788
- .viking-input-native::placeholder {
789
- color: var(--viking-text-muted);
790
- }
791
-
792
- input {
793
- flex: 1;
794
- min-width: 0;
795
- border: none;
796
- outline: none !important;
797
- background: transparent;
798
- color: var(--viking-text);
799
- font-family: inherit;
800
- font-size: inherit;
801
- padding: 0;
802
- }
803
-
804
- input::placeholder {
805
- color: var(--viking-text-muted);
806
- }
807
-
808
- input:disabled {
809
- cursor: not-allowed;
810
- }
811
-
812
- .viking-input-clear {
813
- display: inline-flex;
814
- align-items: center;
815
- justify-content: center;
816
- min-width: var(--viking-touch-target-comfort, 44px);
817
- min-height: var(--viking-touch-target-comfort, 44px);
818
- border: none;
819
- background: transparent;
820
- color: var(--viking-text-muted);
821
- cursor: pointer;
822
- padding: var(--viking-space-half);
823
- border-radius: var(--viking-radius-pill);
824
- transition: var(--viking-transition-interactive);
825
- flex-shrink: 0;
826
- -webkit-tap-highlight-color: transparent;
827
- }
828
-
829
- .viking-input-clear:hover {
830
- color: var(--viking-text);
831
- background: var(--viking-accent-soft);
832
- }
833
-
834
- .viking-input-clear:focus-visible {
835
- outline: var(--viking-ring-width) solid var(--viking-ring);
836
- outline-offset: var(--viking-ring-offset);
837
- }
838
-
839
- .viking-input-spinner {
840
- width: 1rem;
841
- height: 1rem;
842
- border: 2px solid var(--viking-text-muted);
843
- border-right-color: transparent;
844
- border-radius: 50%;
845
- animation: viking-spin 0.8s linear infinite;
846
- flex-shrink: 0;
847
- }
848
-
849
- @keyframes viking-spin {
850
- to { transform: rotate(360deg); }
851
- }
852
- `;
853
- var VIKING_FIELD_STYLES = `
854
- :host {
855
- display: block;
856
- font-family: var(--viking-font-family);
857
- color: var(--viking-text);
858
- min-width: 0;
859
- }
860
-
861
- :host([hidden]) {
862
- display: none;
863
- }
864
-
865
- :host([width='full']) {
866
- width: 100%;
867
- }
868
-
869
- :host([width='half']) {
870
- width: 100%;
871
- max-width: var(--viking-select-half-max-width, min(100%, 24rem));
872
- }
873
-
874
- .viking-field {
875
- display: flex;
876
- flex-direction: column;
877
- gap: var(--viking-space-1);
878
- }
879
-
880
- .viking-field-label-row {
881
- display: flex;
882
- align-items: baseline;
883
- justify-content: space-between;
884
- gap: var(--viking-space-2);
885
- }
886
-
887
- .viking-field-label {
888
- display: inline-flex;
889
- align-items: center;
890
- gap: var(--viking-space-half);
891
- font-size: var(--viking-font-size-ui);
892
- font-weight: var(--viking-font-weight-bold);
893
- color: var(--viking-text);
894
- line-height: var(--viking-line-height-snug);
895
- cursor: pointer;
896
- }
897
-
898
- .viking-field-required {
899
- color: var(--viking-danger-text);
900
- }
901
-
902
- .viking-field-control {
903
- min-width: 0;
904
- }
905
-
906
- .viking-field-description,
907
- .viking-field-error {
908
- margin: 0;
909
- font-size: var(--viking-font-size-xs);
910
- line-height: var(--viking-line-height-relaxed);
911
- }
912
-
913
- .viking-field-description {
914
- color: var(--viking-text-muted);
915
- }
916
-
917
- .viking-field-error {
918
- color: var(--viking-danger-text);
919
- }
920
- `;
921
- var VIKING_BADGE_STYLES = `
922
- :host {
923
- display: inline-flex;
924
- align-items: center;
925
- gap: var(--viking-space-half);
926
- padding: var(--viking-space-half) var(--viking-space-1);
927
- font-family: var(--viking-font-family);
928
- font-size: var(--viking-font-size-xs);
929
- font-weight: var(--viking-font-weight-semibold);
930
- letter-spacing: var(--viking-letter-spacing-wide);
931
- line-height: var(--viking-line-height-snug);
932
- border-radius: var(--viking-radius-pill);
933
- border: 1px solid var(--viking-border);
934
- background: var(--viking-surface-alt);
935
- color: var(--viking-text);
936
- white-space: nowrap;
937
- transition: var(--viking-transition-interactive);
938
- box-shadow: var(--viking-shadow-xs);
939
- }
940
-
941
- :host([size='sm']) {
942
- padding: 0 var(--viking-space-1);
943
- font-size: var(--viking-font-size-2xs);
944
- }
945
-
946
- :host([tone='accent']) {
947
- background: var(--viking-accent);
948
- border-color: color-mix(in srgb, var(--viking-accent) 80%, var(--viking-black));
949
- color: var(--viking-accent-content);
950
- box-shadow: var(--viking-shadow-sm);
951
- }
952
-
953
- :host([tone='secondary']) {
954
- background: color-mix(in srgb, var(--viking-accent-secondary) 16%, var(--viking-surface));
955
- border-color: color-mix(in srgb, var(--viking-accent-secondary) 55%, transparent);
956
- color: var(--viking-accent-secondary);
957
- }
958
-
959
- :host([tone='success']) {
960
- background: color-mix(in srgb, var(--viking-success) 16%, var(--viking-surface));
961
- border-color: color-mix(in srgb, var(--viking-success) 55%, transparent);
962
- color: var(--viking-success);
963
- }
964
-
965
- :host([tone='warning']) {
966
- background: color-mix(in srgb, var(--viking-warning) 18%, var(--viking-surface));
967
- border-color: color-mix(in srgb, var(--viking-warning) 55%, transparent);
968
- color: var(--viking-warning);
969
- }
970
-
971
- :host([tone='danger']) {
972
- background: color-mix(in srgb, var(--viking-danger) 14%, var(--viking-surface));
973
- border-color: color-mix(in srgb, var(--viking-danger) 50%, transparent);
974
- color: var(--viking-danger-text);
975
- }
976
-
977
- :host([tone='info']) {
978
- background: color-mix(in srgb, var(--viking-info) 14%, var(--viking-surface));
979
- border-color: color-mix(in srgb, var(--viking-info) 50%, transparent);
980
- color: var(--viking-info);
981
- }
982
-
983
- :host([tone='muted']),
984
- :host([tone='subtle']) {
985
- color: var(--viking-text-muted);
986
- background: var(--viking-surface);
987
- border-color: var(--viking-border-subtle);
988
- }
989
-
990
- .viking-wc-icon {
991
- flex-shrink: 0;
992
- }
993
-
994
- .viking-badge-remove {
995
- display: inline-flex;
996
- align-items: center;
997
- justify-content: center;
998
- min-width: var(--viking-touch-target-comfort, 44px);
999
- min-height: var(--viking-touch-target-comfort, 44px);
1000
- border: none;
1001
- background: transparent;
1002
- color: currentColor;
1003
- cursor: pointer;
1004
- padding: var(--viking-space-half);
1005
- border-radius: var(--viking-radius-pill);
1006
- transition: var(--viking-transition-interactive);
1007
- margin-left: calc(var(--viking-space-half) * -1);
1008
- }
1009
-
1010
- .viking-badge-remove:hover {
1011
- background: color-mix(in srgb, currentColor 12%, transparent);
1012
- }
1013
-
1014
- .viking-badge-remove:focus-visible {
1015
- outline: var(--viking-ring-width) solid var(--viking-ring);
1016
- outline-offset: var(--viking-ring-offset);
1017
- }
1018
- `;
1019
- var VIKING_CALLOUT_STYLES = `
1020
- :host {
1021
- display: block;
1022
- font-family: var(--viking-font-family);
1023
- }
1024
-
1025
- :host([hidden]) {
1026
- display: none;
1027
- }
1028
-
1029
- .viking-callout {
1030
- display: flex;
1031
- align-items: flex-start;
1032
- gap: var(--viking-space-2);
1033
- padding: var(--viking-space-2);
1034
- border-radius: var(--viking-radius-lg);
1035
- border: 1px solid var(--viking-border);
1036
- border-left-width: 3px;
1037
- background: var(--viking-surface-alt);
1038
- color: var(--viking-text);
1039
- font-size: var(--viking-font-size-sm);
1040
- box-shadow: var(--viking-shadow-sm);
1041
- }
1042
-
1043
- .viking-callout-icon {
1044
- flex-shrink: 0;
1045
- margin-top: 2px;
1046
- color: var(--viking-text-muted);
1047
- }
1048
-
1049
- .viking-callout-body {
1050
- flex: 1;
1051
- min-width: 0;
1052
- }
1053
-
1054
- .viking-callout-heading {
1055
- margin: 0 0 var(--viking-space-half);
1056
- font-size: var(--viking-font-size-ui);
1057
- font-weight: var(--viking-font-weight-bold);
1058
- color: var(--viking-text);
1059
- }
1060
-
1061
- .viking-callout-text {
1062
- margin: 0;
1063
- color: var(--viking-text);
1064
- line-height: var(--viking-line-height-relaxed);
1065
- }
1066
-
1067
- .viking-callout-close {
1068
- display: inline-flex;
1069
- align-items: center;
1070
- justify-content: center;
1071
- min-width: var(--viking-touch-target-comfort, 44px);
1072
- min-height: var(--viking-touch-target-comfort, 44px);
1073
- border: none;
1074
- background: transparent;
1075
- color: var(--viking-text-muted);
1076
- cursor: pointer;
1077
- padding: var(--viking-space-half);
1078
- border-radius: var(--viking-radius);
1079
- transition: var(--viking-transition-interactive);
1080
- flex-shrink: 0;
1081
- }
1082
-
1083
- .viking-callout-close:hover {
1084
- color: var(--viking-text);
1085
- background: color-mix(in srgb, currentColor 8%, transparent);
1086
- }
1087
-
1088
- .viking-callout-close:focus-visible {
1089
- outline: var(--viking-ring-width) solid var(--viking-ring);
1090
- outline-offset: var(--viking-ring-offset);
1091
- }
1092
-
1093
- .viking-callout-accent {
1094
- border-color: var(--viking-accent);
1095
- border-left-color: var(--viking-accent);
1096
- background: var(--viking-accent-soft);
1097
- }
1098
-
1099
- .viking-callout-accent .viking-callout-icon {
1100
- color: var(--viking-accent);
1101
- }
1102
-
1103
- .viking-callout-secondary {
1104
- border-color: color-mix(in srgb, var(--viking-accent-secondary) 45%, transparent);
1105
- border-left-color: var(--viking-accent-secondary);
1106
- background: var(--viking-accent-secondary-soft);
1107
- }
1108
-
1109
- .viking-callout-secondary .viking-callout-icon {
1110
- color: var(--viking-accent-secondary);
1111
- }
1112
-
1113
- .viking-callout-info {
1114
- border-color: color-mix(in srgb, var(--viking-info) 45%, transparent);
1115
- border-left-color: var(--viking-info);
1116
- background: color-mix(in srgb, var(--viking-info) 10%, var(--viking-surface));
1117
- }
1118
-
1119
- .viking-callout-info .viking-callout-icon {
1120
- color: var(--viking-info);
1121
- }
1122
-
1123
- .viking-callout-success {
1124
- border-color: color-mix(in srgb, var(--viking-success) 45%, transparent);
1125
- border-left-color: var(--viking-success);
1126
- background: color-mix(in srgb, var(--viking-success) 10%, var(--viking-surface));
1127
- }
1128
-
1129
- .viking-callout-success .viking-callout-icon {
1130
- color: var(--viking-success);
1131
- }
1132
-
1133
- .viking-callout-warning {
1134
- border-color: color-mix(in srgb, var(--viking-warning) 45%, transparent);
1135
- border-left-color: var(--viking-warning);
1136
- background: color-mix(in srgb, var(--viking-warning) 12%, var(--viking-surface));
1137
- }
1138
-
1139
- .viking-callout-warning .viking-callout-icon {
1140
- color: var(--viking-warning);
1141
- }
1142
-
1143
- .viking-callout-danger {
1144
- border-color: var(--viking-danger);
1145
- border-left-color: var(--viking-danger);
1146
- background: color-mix(in srgb, var(--viking-crimson-600) 22%, var(--viking-surface));
1147
- color: var(--viking-white);
1148
- }
1149
-
1150
- .viking-callout-danger .viking-callout-icon {
1151
- color: var(--viking-crimson-400);
1152
- }
1153
-
1154
- .viking-callout-danger .viking-callout-text {
1155
- color: var(--viking-white);
1156
- }
1157
- `;
1158
- var VIKING_SELECT_STYLES = `
1159
- :host {
1160
- display: block;
1161
- font-family: var(--viking-font-family);
1162
- min-width: 0;
1163
- }
1164
-
1165
- :host([width='full']) {
1166
- width: 100%;
1167
- }
1168
-
1169
- :host([width='half']) {
1170
- width: 100%;
1171
- max-width: var(--viking-select-half-max-width, min(100%, 24rem));
1172
- }
1173
-
1174
- .viking-field {
1175
- display: flex;
1176
- flex-direction: column;
1177
- gap: var(--viking-space-1);
1178
- }
1179
-
1180
- .viking-field-label {
1181
- font-size: var(--viking-font-size-ui);
1182
- font-weight: var(--viking-font-weight-bold);
1183
- color: var(--viking-text);
1184
- }
1185
-
1186
- .viking-field-description {
1187
- margin: 0;
1188
- font-size: var(--viking-font-size-xs);
1189
- color: var(--viking-text-muted);
1190
- }
1191
-
1192
- .viking-field-error {
1193
- margin: 0;
1194
- font-size: var(--viking-font-size-xs);
1195
- color: var(--viking-danger);
1196
- }
1197
-
1198
- .viking-select-native {
1199
- width: 100%;
1200
- min-height: var(--viking-control-height);
1201
- padding: 0 var(--viking-space-2);
1202
- border: 1px solid var(--viking-border-strong);
1203
- border-radius: var(--viking-radius);
1204
- background: var(--viking-surface);
1205
- color: var(--viking-text);
1206
- font-family: inherit;
1207
- font-size: var(--viking-font-size);
1208
- cursor: pointer;
1209
- transition: var(--viking-transition-interactive);
1210
- box-shadow: var(--viking-shadow-sm);
1211
- }
1212
-
1213
- .viking-select-native:hover:not(:disabled) {
1214
- border-color: var(--viking-accent-strong);
1215
- box-shadow: var(--viking-shadow-md);
1216
- }
1217
-
1218
- .viking-select-native:focus-visible {
1219
- outline: var(--viking-ring-width) solid var(--viking-ring);
1220
- outline-offset: var(--viking-ring-offset);
1221
- }
1222
-
1223
- .viking-select-native:disabled {
1224
- opacity: var(--viking-state-disabled-opacity);
1225
- cursor: not-allowed;
1226
- }
1227
-
1228
- .viking-select-native[aria-invalid='true'] {
1229
- border-color: var(--viking-danger);
1230
- }
1231
- `;
1232
- var VIKING_MODAL_STYLES = `
1233
- :host {
1234
- display: contents;
1235
- }
1236
-
1237
- .viking-modal-backdrop {
1238
- position: fixed;
1239
- inset: 0;
1240
- z-index: var(--viking-z-overlay, 10001);
1241
- display: flex;
1242
- align-items: center;
1243
- justify-content: center;
1244
- padding: var(--viking-space-3);
1245
- background: var(--viking-overlay-backdrop);
1246
- backdrop-filter: blur(8px);
1247
- -webkit-backdrop-filter: blur(8px);
1248
- border: none;
1249
- animation: viking-backdrop-in var(--viking-duration-fast) var(--viking-ease-out);
1250
- }
1251
-
1252
- .viking-modal-panel {
1253
- display: flex;
1254
- flex-direction: column;
1255
- gap: var(--viking-space-2);
1256
- width: min(522px, calc(100vw - var(--viking-space-4)));
1257
- max-height: calc(100vh - var(--viking-space-6));
1258
- padding: var(--viking-space-3);
1259
- border: 1px solid var(--viking-border-strong);
1260
- border-radius: var(--viking-radius-lg);
1261
- background: var(--viking-surface);
1262
- color: var(--viking-text);
1263
- box-shadow: var(--viking-shadow-lg);
1264
- font-family: var(--viking-font-family);
1265
- position: relative;
1266
- overflow: hidden;
1267
- animation: viking-modal-in var(--viking-duration) var(--viking-ease-default);
1268
- }
1269
-
1270
- .viking-modal-panel::before {
1271
- content: '';
1272
- position: absolute;
1273
- inset: 0 0 auto;
1274
- height: 1px;
1275
- background: linear-gradient(
1276
- 90deg,
1277
- transparent,
1278
- color-mix(in srgb, var(--viking-metallic-200) 22%, transparent),
1279
- transparent
1280
- );
1281
- pointer-events: none;
1282
- }
1283
-
1284
- .viking-modal-header {
1285
- display: flex;
1286
- align-items: flex-start;
1287
- justify-content: space-between;
1288
- gap: var(--viking-space-2);
1289
- padding-bottom: var(--viking-space-1);
1290
- border-bottom: 1px solid var(--viking-border-subtle);
1291
- }
1292
-
1293
- .viking-modal-heading {
1294
- margin: 0;
1295
- font-size: var(--viking-font-size-md);
1296
- font-weight: var(--viking-font-weight-bold);
1297
- letter-spacing: var(--viking-letter-spacing-tight);
1298
- color: var(--viking-text);
1299
- line-height: var(--viking-line-height-tight);
1300
- }
1301
-
1302
- .viking-modal-close {
1303
- display: inline-flex;
1304
- align-items: center;
1305
- justify-content: center;
1306
- min-width: var(--viking-touch-target-comfort, 44px);
1307
- min-height: var(--viking-touch-target-comfort, 44px);
1308
- border: 1px solid transparent;
1309
- background: transparent;
1310
- color: var(--viking-text-muted);
1311
- cursor: pointer;
1312
- border-radius: var(--viking-radius);
1313
- transition: var(--viking-transition-interactive);
1314
- flex-shrink: 0;
1315
- }
1316
-
1317
- .viking-modal-close:hover {
1318
- color: var(--viking-text);
1319
- background: var(--viking-accent-soft);
1320
- border-color: var(--viking-border-subtle);
1321
- }
1322
-
1323
- .viking-modal-close:focus-visible {
1324
- outline: var(--viking-ring-width) solid var(--viking-ring);
1325
- outline-offset: var(--viking-ring-offset);
1326
- }
1327
-
1328
- .viking-modal-body {
1329
- overflow-y: auto;
1330
- color: var(--viking-text-muted);
1331
- font-size: var(--viking-font-size);
1332
- line-height: var(--viking-line-height-relaxed);
1333
- }
1334
-
1335
- .viking-modal-footer {
1336
- display: flex;
1337
- flex-wrap: wrap;
1338
- gap: var(--viking-space-2);
1339
- justify-content: flex-end;
1340
- padding-top: var(--viking-space-2);
1341
- border-top: 1px solid var(--viking-border-subtle);
1342
- }
1343
-
1344
- .viking-modal-footer:empty {
1345
- display: none;
1346
- }
1347
-
1348
- @keyframes viking-backdrop-in {
1349
- from { opacity: 0; }
1350
- to { opacity: 1; }
1351
- }
1352
-
1353
- @keyframes viking-modal-in {
1354
- from {
1355
- opacity: 0;
1356
- transform: translateY(var(--viking-space-1)) scale(0.98);
1357
- }
1358
- to {
1359
- opacity: 1;
1360
- transform: translateY(0) scale(1);
1361
- }
1362
- }
1363
-
1364
- @media (prefers-reduced-motion: reduce) {
1365
- .viking-modal-backdrop,
1366
- .viking-modal-panel {
1367
- animation: none;
1368
- }
1369
- }
1370
- `;
1371
- var VIKING_SEARCH_PALETTE_STYLES = `
1372
- :host {
1373
- display: contents;
1374
- }
1375
-
1376
- .viking-search-palette-backdrop {
1377
- position: fixed;
1378
- inset: 0;
1379
- z-index: var(--viking-z-overlay, 10001);
1380
- display: flex;
1381
- align-items: flex-start;
1382
- justify-content: center;
1383
- padding: 10vh var(--viking-space-2) var(--viking-space-2);
1384
- background: var(--viking-overlay-backdrop);
1385
- backdrop-filter: blur(8px);
1386
- -webkit-backdrop-filter: blur(8px);
1387
- border: none;
1388
- animation: viking-backdrop-in var(--viking-duration-fast) var(--viking-ease-out);
1389
- }
1390
-
1391
- .viking-search-palette-backdrop:not([open]) {
1392
- display: none !important;
1393
- pointer-events: none;
1394
- }
1395
-
1396
- .viking-search-palette {
1397
- display: flex;
1398
- flex-direction: column;
1399
- background: var(--viking-surface-raised, var(--viking-surface));
1400
- border: 1px solid var(--viking-border-strong);
1401
- border-radius: var(--viking-radius-lg);
1402
- box-shadow: var(--viking-shadow-lg);
1403
- overflow: hidden;
1404
- max-width: 600px;
1405
- width: min(100%, 600px);
1406
- margin: 0 auto;
1407
- font-family: var(--viking-font-family);
1408
- color: var(--viking-text);
1409
- animation: viking-modal-in var(--viking-duration) var(--viking-ease-default);
1410
- position: relative;
1411
- isolation: isolate;
1412
- }
1413
-
1414
- .viking-search-palette::before {
1415
- content: '';
1416
- position: absolute;
1417
- inset: 0 0 auto;
1418
- height: 1px;
1419
- background: linear-gradient(
1420
- 90deg,
1421
- transparent,
1422
- color-mix(in srgb, var(--viking-metallic-200) 22%, transparent),
1423
- transparent
1424
- );
1425
- pointer-events: none;
1426
- z-index: 1;
1427
- }
1428
-
1429
- .viking-search-palette-header {
1430
- display: flex;
1431
- align-items: center;
1432
- padding: var(--viking-space-2);
1433
- border-bottom: 1px solid var(--viking-border);
1434
- gap: var(--viking-space-1);
1435
- background: color-mix(in srgb, var(--viking-bg) 26%, var(--viking-surface-raised));
1436
- }
1437
-
1438
- .viking-search-palette-header:focus-within {
1439
- border-bottom-color: var(--viking-accent);
1440
- box-shadow: inset 0 -2px 0 var(--viking-accent-soft);
1441
- }
1442
-
1443
- .viking-search-palette-icon {
1444
- color: var(--viking-text-muted);
1445
- flex-shrink: 0;
1446
- }
1447
-
1448
- .viking-search-palette-input {
1449
- flex: 1;
1450
- background: none;
1451
- border: none;
1452
- outline: none;
1453
- font-size: calc(var(--viking-font-size) * 1.05);
1454
- color: var(--viking-text);
1455
- font-family: inherit;
1456
- min-width: 0;
1457
- }
1458
-
1459
- .viking-search-palette-input::placeholder {
1460
- color: var(--viking-text-muted);
1461
- }
1462
-
1463
- .viking-search-palette-close {
1464
- display: inline-flex;
1465
- align-items: center;
1466
- justify-content: center;
1467
- min-width: var(--viking-touch-target-comfort, 44px);
1468
- min-height: var(--viking-touch-target-comfort, 44px);
1469
- border: none;
1470
- background: transparent;
1471
- color: var(--viking-text-muted);
1472
- cursor: pointer;
1473
- padding: var(--viking-space-half);
1474
- border-radius: var(--viking-radius);
1475
- transition: var(--viking-transition-interactive);
1476
- flex-shrink: 0;
1477
- }
1478
-
1479
- .viking-search-palette-close:hover {
1480
- color: var(--viking-text);
1481
- background: var(--viking-accent-soft);
1482
- }
1483
-
1484
- .viking-search-palette-close:focus-visible {
1485
- outline: var(--viking-ring-width) solid var(--viking-ring);
1486
- outline-offset: var(--viking-ring-offset);
1487
- }
1488
-
1489
- .viking-search-palette-body {
1490
- max-height: 50vh;
1491
- overflow-y: auto;
1492
- padding: var(--viking-space-2);
1493
- }
1494
-
1495
- .viking-search-palette-footer {
1496
- display: flex;
1497
- align-items: center;
1498
- justify-content: center;
1499
- gap: var(--viking-space-1);
1500
- padding: var(--viking-space-1) var(--viking-space-2);
1501
- border-top: 1px solid var(--viking-border);
1502
- font-size: calc(var(--viking-font-size) * 0.85);
1503
- color: var(--viking-text-muted);
1504
- }
1505
-
1506
- .viking-kbd {
1507
- display: inline-flex;
1508
- align-items: center;
1509
- justify-content: center;
1510
- min-width: 1.5rem;
1511
- padding: 2px 6px;
1512
- font-family: inherit;
1513
- font-size: calc(var(--viking-font-size) * 0.75);
1514
- border-radius: calc(var(--viking-radius) / 2);
1515
- border: 1px solid var(--viking-border);
1516
- background: var(--viking-surface-alt);
1517
- }
1518
-
1519
- .viking-search-results {
1520
- display: flex;
1521
- flex-direction: column;
1522
- gap: var(--viking-space-1);
1523
- }
1524
-
1525
- .viking-search-group-label {
1526
- margin: var(--viking-space-1) 0 var(--viking-space-half);
1527
- padding: 0 var(--viking-space-1);
1528
- font-size: var(--viking-font-size-2xs);
1529
- font-weight: var(--viking-font-weight-semibold);
1530
- letter-spacing: var(--viking-letter-spacing-caps);
1531
- text-transform: uppercase;
1532
- color: var(--viking-text-muted);
1533
- }
1534
-
1535
- .viking-search-result {
1536
- display: flex;
1537
- align-items: center;
1538
- min-height: var(--viking-control-height-sm, 36px);
1539
- padding: var(--viking-space-1) var(--viking-space-2);
1540
- border-radius: var(--viking-radius);
1541
- background: var(--viking-surface-alt);
1542
- border: 1px solid var(--viking-border-subtle);
1543
- cursor: pointer;
1544
- transition: var(--viking-transition-interactive);
1545
- gap: var(--viking-space-1);
1546
- text-decoration: none;
1547
- color: inherit;
1548
- }
1549
-
1550
- .viking-search-result:hover,
1551
- .viking-search-result.is-selected {
1552
- background: color-mix(in srgb, var(--viking-accent) 10%, var(--viking-surface-alt));
1553
- border-color: color-mix(in srgb, var(--viking-accent) 42%, var(--viking-border-strong));
1554
- box-shadow: var(--viking-shadow-sm);
1555
- }
1556
-
1557
- .viking-search-result:focus-visible {
1558
- outline: var(--viking-ring-width) solid var(--viking-ring);
1559
- outline-offset: var(--viking-ring-offset);
1560
- }
1561
-
1562
- .viking-search-result-title {
1563
- font-size: var(--viking-font-size-sm);
1564
- font-weight: var(--viking-font-weight-semibold);
1565
- color: var(--viking-text);
1566
- }
1567
-
1568
- .viking-search-result-snippet {
1569
- font-size: var(--viking-font-size-xs);
1570
- color: var(--viking-text-muted);
1571
- }
1572
-
1573
- .viking-search-empty {
1574
- padding: var(--viking-space-3);
1575
- text-align: center;
1576
- color: var(--viking-text-muted);
1577
- font-size: var(--viking-font-size-sm);
1578
- }
1579
-
1580
- @keyframes viking-backdrop-in {
1581
- from { opacity: 0; }
1582
- to { opacity: 1; }
1583
- }
1584
-
1585
- @keyframes viking-modal-in {
1586
- from {
1587
- opacity: 0;
1588
- transform: translateY(var(--viking-space-1)) scale(0.98);
1589
- }
1590
- to {
1591
- opacity: 1;
1592
- transform: translateY(0) scale(1);
1593
- }
1594
- }
1595
-
1596
- @media (prefers-reduced-motion: reduce) {
1597
- .viking-search-palette-backdrop,
1598
- .viking-search-palette {
1599
- animation: none;
1600
- }
1601
- }
1602
- `;
1603
-
1604
- // src/web/badge/viking-badge-wc.ts
1605
- var TONES = /* @__PURE__ */ new Set([
1606
- "accent",
1607
- "secondary",
1608
- "success",
1609
- "warning",
1610
- "danger",
1611
- "info",
1612
- "muted",
1613
- "subtle"
1614
- ]);
1615
- var VikingBadgeWc = class extends HTMLElementBase {
1616
- static tag = "viking-badge";
1617
- static legacyTag = "viking-badge-wc";
1618
- static get observedAttributes() {
1619
- return ["tone", "size", "icon", "removable"];
1620
- }
1621
- shadow;
1622
- constructor() {
1623
- super();
1624
- this.shadow = this.attachShadow({ mode: "open" });
1625
- attachShadowStyles(this.shadow, VIKING_BADGE_STYLES);
1626
- }
1627
- connectedCallback() {
1628
- this.render();
1629
- }
1630
- attributeChangedCallback() {
1631
- if (this.isConnected) {
1632
- this.render();
1633
- }
1634
- }
1635
- get tone() {
1636
- const value = this.getAttribute("tone") ?? "";
1637
- return TONES.has(value) ? value : null;
1638
- }
1639
- get size() {
1640
- return this.getAttribute("size") === "sm" ? "sm" : null;
1641
- }
1642
- get removable() {
1643
- return this.hasAttribute("removable") && this.getAttribute("removable") !== "false";
1644
- }
1645
- onRemove = () => {
1646
- this.dispatchEvent(
1647
- new CustomEvent("viking-removed", { bubbles: true, composed: true })
1648
- );
1649
- };
1650
- render() {
1651
- const tone = this.tone;
1652
- if (tone && this.getAttribute("tone") !== tone) {
1653
- this.setAttribute("tone", tone);
1654
- } else if (!tone && this.hasAttribute("tone")) {
1655
- this.removeAttribute("tone");
1656
- }
1657
- const size = this.size;
1658
- if (size && this.getAttribute("size") !== size) {
1659
- this.setAttribute("size", size);
1660
- } else if (!size && this.hasAttribute("size")) {
1661
- this.removeAttribute("size");
1662
- }
1663
- const iconName = this.getAttribute("icon") ?? (tone ? TONE_ICON_NAMES[tone] : null);
1664
- const iconMarkup = iconName ? renderInlineIcon(iconName, 16) : "";
1665
- this.shadow.innerHTML = `
1666
- ${iconMarkup}
1667
- <span part="label"><slot></slot></span>
1668
- ${this.removable ? `<button type="button" class="viking-badge-remove" part="remove" aria-label="Remove">${renderInlineIcon("x", 14)}</button>` : ""}
1669
- `;
1670
- this.shadow.querySelector(".viking-badge-remove")?.addEventListener("click", this.onRemove);
1671
- }
1672
- };
1673
- var registerVikingBadgeWc = () => {
1674
- defineCustomElement(VikingBadgeWc.tag, VikingBadgeWc);
1675
- defineCustomElementAlias(VikingBadgeWc.legacyTag, VikingBadgeWc);
1676
- };
1677
-
1678
- // src/web/button/viking-button-wc.ts
1679
- var VARIANTS = /* @__PURE__ */ new Set([
1680
- "outline",
1681
- "primary",
1682
- "secondary",
1683
- "filled",
1684
- "danger",
1685
- "ghost",
1686
- "subtle"
1687
- ]);
1688
- var SIZES = /* @__PURE__ */ new Set(["sm", "xs"]);
1689
- var VikingButtonWc = class extends HTMLElementBase {
1690
- static tag = "viking-button";
1691
- static legacyTag = "viking-button-wc";
1692
- static get observedAttributes() {
1693
- return [
1694
- "variant",
1695
- "size",
1696
- "type",
1697
- "disabled",
1698
- "loading",
1699
- "href",
1700
- "target",
1701
- "aria-label",
1702
- "aria-busy",
1703
- "square",
1704
- "full-width",
1705
- "compact"
1706
- ];
1707
- }
1708
- shadow;
1709
- control = null;
1710
- constructor() {
1711
- super();
1712
- this.shadow = this.attachShadow({ mode: "open" });
1713
- attachShadowStyles(this.shadow, VIKING_BUTTON_STYLES);
1714
- }
1715
- connectedCallback() {
1716
- this.render();
1717
- this.syncHostSemantics();
1718
- this.control?.addEventListener("click", this.onClick);
1719
- }
1720
- disconnectedCallback() {
1721
- this.control?.removeEventListener("click", this.onClick);
1722
- }
1723
- attributeChangedCallback() {
1724
- if (this.isConnected) {
1725
- this.render();
1726
- this.syncHostSemantics();
1727
- }
1728
- }
1729
- onClick = (event) => {
1730
- if (this.disabled || this.loading) {
1731
- event.preventDefault();
1732
- event.stopPropagation();
1733
- return;
1734
- }
1735
- this.dispatchEvent(
1736
- new CustomEvent("viking-press", {
1737
- bubbles: true,
1738
- composed: true,
1739
- detail: event
1740
- })
1741
- );
1742
- };
1743
- get variant() {
1744
- const value = this.getAttribute("variant") ?? "outline";
1745
- return VARIANTS.has(value) ? value : "outline";
1746
- }
1747
- get size() {
1748
- const value = this.getAttribute("size");
1749
- return value && SIZES.has(value) ? value : null;
1750
- }
1751
- get disabled() {
1752
- return readBoolAttr(this, "disabled");
1753
- }
1754
- get loading() {
1755
- return readBoolAttr(this, "loading");
1756
- }
1757
- get square() {
1758
- return readBoolAttr(this, "square");
1759
- }
1760
- syncHostSemantics() {
1761
- if (!this.hasAttribute("role")) {
1762
- this.setAttribute("role", this.getAttribute("href") ? "link" : "button");
1763
- }
1764
- }
1765
- render() {
1766
- const href = this.getAttribute("href");
1767
- const isLink = Boolean(href);
1768
- const tag = isLink ? "a" : "button";
1769
- const classes = [
1770
- "viking-btn",
1771
- `viking-btn-${this.variant}`,
1772
- this.size ? `viking-btn-${this.size}` : "",
1773
- this.square ? "viking-btn-square" : ""
1774
- ].filter(Boolean).join(" ");
1775
- const label = this.getAttribute("aria-label") ?? "";
1776
- const busy = this.getAttribute("aria-busy") === "true" || this.loading ? "true" : null;
1777
- const type = escapeHtml(this.getAttribute("type") ?? "button");
1778
- const hrefValue = href ? escapeHtml(href) : "";
1779
- const target = this.getAttribute("target");
1780
- const safeTarget = target ? escapeHtml(target) : "";
1781
- this.shadow.innerHTML = `
1782
- <${tag}
1783
- class="${classes}"
1784
- part="control"
1785
- ${isLink ? `href="${hrefValue}"` : `type="${type}"`}
1786
- ${isLink && safeTarget ? `target="${safeTarget}"` : ""}
1787
- ${isLink && target === "_blank" ? 'rel="noopener noreferrer"' : ""}
1788
- ${this.disabled || this.loading ? "disabled" : ""}
1789
- ${label ? `aria-label="${escapeHtml(label)}"` : ""}
1790
- ${busy ? `aria-busy="${busy}"` : ""}
1791
- ${this.disabled && isLink ? 'aria-disabled="true" tabindex="-1"' : ""}
1792
- >
1793
- ${this.loading ? '<span class="viking-btn-spinner" aria-hidden="true"></span>' : ""}
1794
- <span class="viking-btn-label" part="label"><slot></slot></span>
1795
- </${tag}>
1796
- `;
1797
- this.control = this.shadow.querySelector(tag);
1798
- }
1799
- };
1800
- var registerVikingButtonWc = () => {
1801
- defineCustomElement(VikingButtonWc.tag, VikingButtonWc);
1802
- defineCustomElementAlias(VikingButtonWc.legacyTag, VikingButtonWc);
1803
- };
1804
-
1805
- // src/web/callout/viking-callout-wc.ts
1806
- var TONES2 = /* @__PURE__ */ new Set([
1807
- "accent",
1808
- "secondary",
1809
- "success",
1810
- "warning",
1811
- "danger",
1812
- "info",
1813
- "muted"
1814
- ]);
1815
- var VikingCalloutWc = class extends HTMLElementBase {
1816
- static tag = "viking-callout";
1817
- static legacyTag = "viking-callout-wc";
1818
- static get observedAttributes() {
1819
- return ["tone", "heading", "icon", "dismissible", "hidden"];
1820
- }
1821
- shadow;
1822
- constructor() {
1823
- super();
1824
- this.shadow = this.attachShadow({ mode: "open" });
1825
- attachShadowStyles(this.shadow, VIKING_CALLOUT_STYLES);
1826
- }
1827
- connectedCallback() {
1828
- this.render();
1829
- }
1830
- attributeChangedCallback() {
1831
- if (this.isConnected) {
1832
- this.render();
1833
- }
1834
- }
1835
- get tone() {
1836
- const value = this.getAttribute("tone") ?? "info";
1837
- return TONES2.has(value) ? value : "info";
1838
- }
1839
- get dismissible() {
1840
- return this.hasAttribute("dismissible") && this.getAttribute("dismissible") !== "false";
1841
- }
1842
- onDismiss = () => {
1843
- this.setAttribute("hidden", "");
1844
- this.dispatchEvent(
1845
- new CustomEvent("viking-close", { bubbles: true, composed: true })
1846
- );
1847
- };
1848
- render() {
1849
- const heading = this.getAttribute("heading") ?? "";
1850
- const iconName = this.getAttribute("icon") ?? TONE_ICON_NAMES[this.tone] ?? "info";
1851
- const iconMarkup = renderInlineIcon(iconName, 22, "viking-callout-icon");
1852
- this.shadow.innerHTML = `
1853
- <div class="viking-callout viking-callout-${this.tone}" role="note" part="surface">
1854
- <span part="icon">${iconMarkup}</span>
1855
- <div class="viking-callout-body" part="body">
1856
- ${heading ? `<p class="viking-callout-heading" part="heading">${escapeHtml(heading)}</p>` : ""}
1857
- <div class="viking-callout-text" part="text"><slot></slot></div>
1858
- </div>
1859
- ${this.dismissible ? `<button type="button" class="viking-callout-close" part="close" aria-label="Dismiss">${renderInlineIcon("x", 18)}</button>` : ""}
1860
- </div>
1861
- `;
1862
- this.shadow.querySelector(".viking-callout-close")?.addEventListener("click", this.onDismiss);
1863
- }
1864
- };
1865
- var registerVikingCalloutWc = () => {
1866
- defineCustomElement(VikingCalloutWc.tag, VikingCalloutWc);
1867
- defineCustomElementAlias(VikingCalloutWc.legacyTag, VikingCalloutWc);
1868
- };
1869
-
1870
- // src/web/card/viking-card-wc.ts
1871
- var VikingCardWc = class extends HTMLElementBase {
1872
- static tag = "viking-card";
1873
- static legacyTag = "viking-card-wc";
1874
- static get observedAttributes() {
1875
- return ["compact", "interactive", "title", "loading"];
1876
- }
1877
- connectedCallback() {
1878
- this.syncClasses();
1879
- }
1880
- attributeChangedCallback() {
1881
- if (this.isConnected) {
1882
- this.syncClasses();
1883
- }
1884
- }
1885
- syncClasses() {
1886
- this.classList.add("viking-card");
1887
- this.classList.toggle("viking-card-compact", this.hasAttribute("compact"));
1888
- this.classList.toggle(
1889
- "viking-card-interactive",
1890
- this.hasAttribute("interactive")
1891
- );
1892
- this.classList.toggle("viking-card-loading", this.hasAttribute("loading"));
1893
- const title = this.getAttribute("title");
1894
- if (title) {
1895
- this.setAttribute("role", "region");
1896
- this.setAttribute("aria-label", title);
1897
- } else {
1898
- this.removeAttribute("role");
1899
- this.removeAttribute("aria-label");
1900
- }
1901
- }
1902
- };
1903
- var registerVikingCardWc = () => {
1904
- defineCustomElement(VikingCardWc.tag, VikingCardWc);
1905
- defineCustomElementAlias(VikingCardWc.legacyTag, VikingCardWc);
1906
- };
1907
-
1908
- // src/web/field/viking-field-wc.ts
1909
- var VikingFieldWc = class extends HTMLElementBase {
1910
- static tag = "viking-field";
1911
- static legacyTag = "viking-field-wc";
1912
- static get observedAttributes() {
1913
- return ["label", "description", "error", "required", "width"];
1914
- }
1915
- shadow;
1916
- labelId = vikingWcUid("viking-field-label");
1917
- descriptionId = vikingWcUid("viking-field-description");
1918
- errorId = vikingWcUid("viking-field-error");
1919
- slotEl = null;
1920
- constructor() {
1921
- super();
1922
- this.shadow = this.attachShadow({ mode: "open" });
1923
- attachShadowStyles(this.shadow, VIKING_FIELD_STYLES);
1924
- }
1925
- connectedCallback() {
1926
- this.render();
1927
- this.syncControlA11y();
1928
- }
1929
- disconnectedCallback() {
1930
- this.slotEl?.removeEventListener("slotchange", this.syncControlA11y);
1931
- }
1932
- attributeChangedCallback() {
1933
- if (this.isConnected) {
1934
- this.render();
1935
- this.syncControlA11y();
1936
- }
1937
- }
1938
- get control() {
1939
- const assigned = this.slotEl?.assignedElements({ flatten: true }) ?? [];
1940
- return assigned.find(
1941
- (node) => node instanceof HTMLElement
1942
- ) ?? null;
1943
- }
1944
- focusControl = () => {
1945
- const control = this.control;
1946
- control?.focus?.();
1947
- };
1948
- syncControlA11y = () => {
1949
- const control = this.control;
1950
- if (!control) {
1951
- return;
1952
- }
1953
- const description = [
1954
- this.getAttribute("description") ?? "",
1955
- this.getAttribute("error") ?? ""
1956
- ].filter(Boolean).join(" ");
1957
- const label = this.getAttribute("label") ?? "";
1958
- if (label && !control.hasAttribute("aria-label")) {
1959
- control.setAttribute("aria-label", label);
1960
- }
1961
- if (description) {
1962
- control.setAttribute("aria-description", description);
1963
- } else {
1964
- control.removeAttribute("aria-description");
1965
- }
1966
- if (this.getAttribute("error")) {
1967
- control.setAttribute("aria-invalid", "true");
1968
- control.setAttribute("error", this.getAttribute("error") ?? "");
1969
- } else {
1970
- control.removeAttribute("aria-invalid");
1971
- if (control.getAttribute("error") === "") {
1972
- control.removeAttribute("error");
1973
- }
1974
- }
1975
- if (readBoolAttr(this, "required")) {
1976
- control.setAttribute("required", "");
1977
- }
1978
- };
1979
- render() {
1980
- const label = this.getAttribute("label") ?? "";
1981
- const description = this.getAttribute("description") ?? "";
1982
- const error = this.getAttribute("error") ?? "";
1983
- const required = readBoolAttr(this, "required");
1984
- this.shadow.innerHTML = `
1985
- <div class="viking-field" part="field" role="group" aria-labelledby="${this.labelId}">
1986
- ${label ? `<div class="viking-field-label-row" part="label-row">
1987
- <span class="viking-field-label" part="label" id="${this.labelId}">
1988
- <span>${escapeHtml(label)}</span>
1989
- ${required ? `<span class="viking-field-required" aria-label="required">*</span>` : ""}
1990
- </span>
1991
- </div>` : `<span id="${this.labelId}" hidden>Form field</span>`}
1992
- <div class="viking-field-control" part="control"><slot></slot></div>
1993
- ${description ? `<p id="${this.descriptionId}" class="viking-field-description" part="description">${escapeHtml(description)}</p>` : ""}
1994
- ${error ? `<p id="${this.errorId}" class="viking-field-error" part="error" role="alert">${escapeHtml(error)}</p>` : ""}
1995
- </div>
1996
- `;
1997
- this.slotEl = this.shadow.querySelector("slot");
1998
- this.slotEl?.addEventListener("slotchange", this.syncControlA11y);
1999
- this.shadow.querySelector(".viking-field-label")?.addEventListener("click", this.focusControl);
2000
- }
2001
- };
2002
- var registerVikingFieldWc = () => {
2003
- defineCustomElement(VikingFieldWc.tag, VikingFieldWc);
2004
- defineCustomElementAlias(VikingFieldWc.legacyTag, VikingFieldWc);
2005
- };
2006
-
2007
- // src/web/input/viking-input-wc.ts
2008
- var VikingInputWc = class extends HTMLElementBase {
2009
- static formAssociated = true;
2010
- static tag = "viking-input";
2011
- static legacyTag = "viking-input-wc";
2012
- static get observedAttributes() {
2013
- return [
2014
- "type",
2015
- "placeholder",
2016
- "value",
2017
- "disabled",
2018
- "loading",
2019
- "clearable",
2020
- "name",
2021
- "autocomplete",
2022
- "required",
2023
- "readonly",
2024
- "minlength",
2025
- "maxlength",
2026
- "pattern",
2027
- "error",
2028
- "aria-label",
2029
- "aria-describedby",
2030
- "bare"
2031
- ];
2032
- }
2033
- shadow;
2034
- internals;
2035
- input = null;
2036
- constructor() {
2037
- super();
2038
- this.shadow = this.attachShadow({ mode: "open" });
2039
- this.internals = attachElementInternals(this);
2040
- attachShadowStyles(this.shadow, VIKING_INPUT_STYLES);
2041
- }
2042
- connectedCallback() {
2043
- this.render();
2044
- this.syncFormValue();
2045
- }
2046
- attributeChangedCallback(name) {
2047
- if (!this.isConnected) {
2048
- return;
2049
- }
2050
- if (name === "value" && this.input) {
2051
- this.input.value = this.getAttribute("value") ?? "";
2052
- this.syncFormValue();
2053
- return;
2054
- }
2055
- this.render();
2056
- }
2057
- get value() {
2058
- return this.input?.value ?? this.getAttribute("value") ?? "";
2059
- }
2060
- set value(next) {
2061
- const normalized = next ?? "";
2062
- this.setAttribute("value", normalized);
2063
- if (this.input) {
2064
- this.input.value = normalized;
2065
- }
2066
- this.syncFormValue();
2067
- }
2068
- get disabled() {
2069
- return readBoolAttr(this, "disabled");
2070
- }
2071
- get loading() {
2072
- return readBoolAttr(this, "loading");
2073
- }
2074
- get clearable() {
2075
- return readBoolAttr(this, "clearable");
2076
- }
2077
- get bare() {
2078
- return readBoolAttr(this, "bare");
2079
- }
2080
- onInput = () => {
2081
- const next = this.input?.value ?? "";
2082
- this.setAttribute("value", next);
2083
- this.syncFormValue();
2084
- this.dispatchEvent(new Event("input", { bubbles: true, composed: true }));
2085
- this.dispatchEvent(new Event("change", { bubbles: true, composed: true }));
2086
- };
2087
- onBlur = () => {
2088
- this.dispatchEvent(new Event("blur", { bubbles: true, composed: true }));
2089
- };
2090
- onClear = () => {
2091
- this.value = "";
2092
- this.input?.focus();
2093
- this.dispatchEvent(
2094
- new CustomEvent("viking-cleared", { bubbles: true, composed: true })
2095
- );
2096
- this.dispatchEvent(new Event("input", { bubbles: true, composed: true }));
2097
- };
2098
- syncFormValue() {
2099
- setFormValue(this.internals, this.value);
2100
- }
2101
- render() {
2102
- const shellClasses = [
2103
- "viking-input-shell",
2104
- this.disabled ? "viking-disabled" : "",
2105
- this.loading ? "viking-loading" : ""
2106
- ].filter(Boolean).join(" ");
2107
- const type = escapeHtml(this.getAttribute("type") ?? "text");
2108
- const rawPlaceholder = this.getAttribute("placeholder") ?? "";
2109
- const placeholder = escapeHtml(rawPlaceholder);
2110
- const value = escapeHtml(this.getAttribute("value") ?? "");
2111
- const label = this.getAttribute("aria-label") ?? (rawPlaceholder || "Text input");
2112
- const autocomplete = escapeHtml(this.getAttribute("autocomplete") ?? "");
2113
- const describedBy = escapeHtml(this.getAttribute("aria-describedby") ?? "");
2114
- const minLength = escapeHtml(this.getAttribute("minlength") ?? "");
2115
- const maxLength = escapeHtml(this.getAttribute("maxlength") ?? "");
2116
- const pattern = escapeHtml(this.getAttribute("pattern") ?? "");
2117
- const error = this.getAttribute("error") ?? "";
2118
- const required = readBoolAttr(this, "required");
2119
- const readonly = readBoolAttr(this, "readonly");
2120
- const showClear = this.clearable && value.length > 0 && !this.loading && !this.bare;
2121
- const nativeAttrs = `
2122
- ${this.disabled || this.loading ? "disabled" : ""}
2123
- ${required ? "required" : ""}
2124
- ${readonly ? "readonly" : ""}
2125
- aria-label="${escapeHtml(label)}"
2126
- ${describedBy ? `aria-describedby="${describedBy}"` : ""}
2127
- ${this.loading ? 'aria-busy="true"' : ""}
2128
- ${error ? 'aria-invalid="true"' : ""}
2129
- ${autocomplete ? `autocomplete="${autocomplete}"` : ""}
2130
- ${minLength ? `minlength="${minLength}"` : ""}
2131
- ${maxLength ? `maxlength="${maxLength}"` : ""}
2132
- ${pattern ? `pattern="${pattern}"` : ""}
2133
- `;
2134
- if (this.bare) {
2135
- this.shadow.innerHTML = `
2136
- <input
2137
- part="input"
2138
- class="viking-input-native"
2139
- type="${type}"
2140
- placeholder="${placeholder}"
2141
- value="${value}"
2142
- ${nativeAttrs}
2143
- />
2144
- `;
2145
- } else {
2146
- this.shadow.innerHTML = `
2147
- <div class="${shellClasses}" part="shell">
2148
- <slot name="leading"></slot>
2149
- <input
2150
- part="input"
2151
- type="${type}"
2152
- placeholder="${placeholder}"
2153
- value="${value}"
2154
- ${nativeAttrs}
2155
- />
2156
- ${this.loading ? '<span class="viking-input-spinner" aria-hidden="true"></span>' : ""}
2157
- ${showClear ? '<button type="button" class="viking-input-clear" aria-label="Clear input" part="clear">\xD7</button>' : ""}
2158
- <slot name="trailing"></slot>
2159
- </div>
2160
- `;
2161
- }
2162
- this.input = this.shadow.querySelector("input");
2163
- this.input?.addEventListener("input", this.onInput);
2164
- this.input?.addEventListener("blur", this.onBlur);
2165
- const clearBtn = this.shadow.querySelector(".viking-input-clear");
2166
- clearBtn?.addEventListener("click", this.onClear);
2167
- }
2168
- };
2169
- var registerVikingInputWc = () => {
2170
- defineCustomElement(VikingInputWc.tag, VikingInputWc);
2171
- defineCustomElementAlias(VikingInputWc.legacyTag, VikingInputWc);
2172
- };
2173
-
2174
- // src/web/modal/viking-modal-wc.ts
2175
- var VikingModalWc = class extends HTMLElementBase {
2176
- static tag = "viking-modal";
2177
- static legacyTag = "viking-modal-wc";
2178
- static dialogTag = "viking-dialog";
2179
- static get observedAttributes() {
2180
- return ["open", "title", "dismissible"];
2181
- }
2182
- shadow;
2183
- dialogEl = null;
2184
- constructor() {
2185
- super();
2186
- this.shadow = this.attachShadow({ mode: "open" });
2187
- attachShadowStyles(this.shadow, VIKING_MODAL_STYLES);
2188
- }
2189
- connectedCallback() {
2190
- this.render();
2191
- this.syncOpen();
2192
- this.dialogEl?.addEventListener("close", this.onClose);
2193
- this.dialogEl?.addEventListener("click", this.onBackdropClick);
2194
- }
2195
- disconnectedCallback() {
2196
- this.dialogEl?.removeEventListener("close", this.onClose);
2197
- this.dialogEl?.removeEventListener("click", this.onBackdropClick);
2198
- }
2199
- attributeChangedCallback(name) {
2200
- if (!this.isConnected) {
2201
- return;
2202
- }
2203
- if (name === "open") {
2204
- this.syncOpen();
2205
- return;
2206
- }
2207
- if (name === "title") {
2208
- this.updateTitle();
2209
- return;
2210
- }
2211
- if (name === "dismissible") {
2212
- this.render();
2213
- this.syncOpen();
2214
- }
2215
- }
2216
- /** Opens the modal dialog. */
2217
- openModal() {
2218
- this.setAttribute("open", "");
2219
- this.syncOpen();
2220
- }
2221
- /** Closes the modal dialog. */
2222
- closeModal() {
2223
- this.removeAttribute("open");
2224
- closeModalDialog(this.dialogEl);
2225
- }
2226
- /** @deprecated Use openModal() */
2227
- open() {
2228
- this.openModal();
2229
- }
2230
- /** @deprecated Use closeModal() */
2231
- close() {
2232
- this.closeModal();
2233
- }
2234
- get dismissible() {
2235
- return this.getAttribute("dismissible") !== "false";
2236
- }
2237
- onClose = () => {
2238
- this.removeAttribute("open");
2239
- this.dispatchEvent(
2240
- new CustomEvent("viking-close", { bubbles: true, composed: true })
2241
- );
2242
- };
2243
- onBackdropClick = (event) => {
2244
- if (!this.dismissible) {
2245
- return;
2246
- }
2247
- if (event.target === this.dialogEl) {
2248
- this.closeModal();
2249
- }
2250
- };
2251
- syncOpen() {
2252
- if (!this.dialogEl) {
2253
- return;
2254
- }
2255
- const shouldOpen = this.hasAttribute("open");
2256
- if (shouldOpen && !this.dialogEl.open) {
2257
- showModalDialog(this.dialogEl);
2258
- queueMicrotask(() => {
2259
- const closeBtn = this.shadow.querySelector(
2260
- ".viking-modal-close"
2261
- );
2262
- (closeBtn ?? this.dialogEl)?.focus();
2263
- });
2264
- } else if (!shouldOpen && this.dialogEl.open) {
2265
- closeModalDialog(this.dialogEl);
2266
- }
2267
- }
2268
- updateTitle() {
2269
- const title = this.getAttribute("title") ?? "Dialog";
2270
- const heading = this.shadow.querySelector(".viking-modal-heading");
2271
- if (heading) {
2272
- heading.textContent = title;
2273
- }
2274
- this.dialogEl?.setAttribute("aria-label", title);
2275
- }
2276
- render() {
2277
- const title = this.getAttribute("title") ?? "Dialog";
2278
- this.shadow.innerHTML = `
2279
- <dialog class="viking-modal-backdrop" aria-label="${escapeHtml(title)}" aria-modal="true">
2280
- <div class="viking-modal-panel" part="panel" role="document">
2281
- <header class="viking-modal-header" part="header">
2282
- <h2 class="viking-modal-heading" part="title">${escapeHtml(title)}</h2>
2283
- ${this.dismissible ? `<button type="button" class="viking-modal-close" part="close" aria-label="Close dialog">${renderInlineIcon("x", 20)}</button>` : ""}
2284
- </header>
2285
- <div class="viking-modal-body" part="body"><slot></slot></div>
2286
- <footer class="viking-modal-footer" part="footer"><slot name="actions"></slot></footer>
2287
- </div>
2288
- </dialog>
2289
- `;
2290
- this.dialogEl = this.shadow.querySelector("dialog");
2291
- this.shadow.querySelector(".viking-modal-close")?.addEventListener("click", () => this.closeModal());
2292
- this.dialogEl?.addEventListener("keydown", (event) => {
2293
- if (event.key === "Escape" && this.dismissible) {
2294
- event.preventDefault();
2295
- this.closeModal();
2296
- }
2297
- });
2298
- }
2299
- };
2300
- var registerVikingModalWc = () => {
2301
- defineCustomElement(VikingModalWc.tag, VikingModalWc);
2302
- defineCustomElementAlias(VikingModalWc.legacyTag, VikingModalWc);
2303
- defineCustomElementAlias(VikingModalWc.dialogTag, VikingModalWc);
2304
- };
2305
-
2306
- // src/web/search-palette/viking-search-palette-wc.ts
2307
- var parseItems = (el) => {
2308
- const raw = el.getAttribute("items");
2309
- if (!raw) {
2310
- return [];
2311
- }
2312
- try {
2313
- const parsed = JSON.parse(raw);
2314
- return Array.isArray(parsed) ? parsed : [];
2315
- } catch {
2316
- return [];
2317
- }
2318
- };
2319
- var matchesQuery = (item, query) => {
2320
- const haystack = [
2321
- item.title,
2322
- item.snippet ?? "",
2323
- item.group ?? "",
2324
- item.href,
2325
- ...item.keywords ?? []
2326
- ].join(" ").toLowerCase();
2327
- return haystack.includes(query);
2328
- };
2329
- var filterItems = (items, query) => {
2330
- const q = query.trim().toLowerCase();
2331
- if (!q) {
2332
- return items;
2333
- }
2334
- return items.filter((item) => matchesQuery(item, q));
2335
- };
2336
- var groupItems = (items) => {
2337
- const groups = /* @__PURE__ */ new Map();
2338
- items.forEach((item) => {
2339
- const key = item.group ?? null;
2340
- const bucket = groups.get(key) ?? [];
2341
- bucket.push(item);
2342
- groups.set(key, bucket);
2343
- });
2344
- return Array.from(groups.entries()).map(([group, grouped]) => ({
2345
- group,
2346
- items: grouped
2347
- }));
2348
- };
2349
- var VikingSearchPaletteWc = class extends HTMLElementBase {
2350
- static tag = "viking-command-palette";
2351
- static searchTag = "viking-search-palette";
2352
- static legacyTag = "viking-search-palette-wc";
2353
- static get observedAttributes() {
2354
- return ["open", "placeholder", "items", "global-shortcut"];
2355
- }
2356
- shadow;
2357
- dialogEl = null;
2358
- inputEl = null;
2359
- resultsEl = null;
2360
- globalKeyHandler = null;
2361
- resultsId = vikingWcUid("viking-search-results");
2362
- inputId = vikingWcUid("viking-search-input");
2363
- query = "";
2364
- activeIndex = 0;
2365
- flatResults = [];
2366
- constructor() {
2367
- super();
2368
- this.shadow = this.attachShadow({ mode: "open" });
2369
- attachShadowStyles(this.shadow, VIKING_SEARCH_PALETTE_STYLES);
2370
- }
2371
- connectedCallback() {
2372
- this.render();
2373
- this.removeAttribute("open");
2374
- this.syncOpen();
2375
- this.bindGlobalShortcut();
2376
- this.dialogEl?.addEventListener("close", this.onClose);
2377
- this.dialogEl?.addEventListener("click", this.onBackdropClick);
2378
- this.inputEl?.addEventListener("input", this.onInput);
2379
- this.inputEl?.addEventListener("keydown", this.onInputKeydown);
2380
- }
2381
- disconnectedCallback() {
2382
- this.dialogEl?.removeEventListener("close", this.onClose);
2383
- this.dialogEl?.removeEventListener("click", this.onBackdropClick);
2384
- this.inputEl?.removeEventListener("input", this.onInput);
2385
- this.inputEl?.removeEventListener("keydown", this.onInputKeydown);
2386
- this.unbindGlobalShortcut();
2387
- }
2388
- attributeChangedCallback(name) {
2389
- if (!this.isConnected) {
2390
- return;
2391
- }
2392
- if (name === "open") {
2393
- this.syncOpen();
2394
- }
2395
- if (name === "global-shortcut") {
2396
- this.unbindGlobalShortcut();
2397
- this.bindGlobalShortcut();
2398
- }
2399
- if (name === "items" || name === "placeholder") {
2400
- if (name === "placeholder" && this.inputEl) {
2401
- const placeholder = this.getAttribute("placeholder") ?? "Search documentation, dashboard, API\u2026";
2402
- this.inputEl.placeholder = placeholder;
2403
- this.inputEl.setAttribute("aria-label", placeholder);
2404
- } else {
2405
- this.renderResults();
2406
- }
2407
- }
2408
- }
2409
- /** Opens the command palette. */
2410
- openPalette() {
2411
- this.setAttribute("open", "");
2412
- this.syncOpen();
2413
- }
2414
- /** Closes the command palette. */
2415
- closePalette() {
2416
- this.removeAttribute("open");
2417
- closeModalDialog(this.dialogEl);
2418
- }
2419
- /** Sets the query string and re-renders filtered results. */
2420
- search(query) {
2421
- this.query = query;
2422
- if (this.inputEl) {
2423
- this.inputEl.value = query;
2424
- }
2425
- this.activeIndex = 0;
2426
- this.renderResults();
2427
- this.dispatchEvent(
2428
- new CustomEvent("viking-query", {
2429
- bubbles: true,
2430
- composed: true,
2431
- detail: { query: this.query }
2432
- })
2433
- );
2434
- }
2435
- onClose = () => {
2436
- this.removeAttribute("open");
2437
- this.query = "";
2438
- this.activeIndex = 0;
2439
- if (this.inputEl) {
2440
- this.inputEl.value = "";
2441
- }
2442
- this.dispatchEvent(
2443
- new CustomEvent("viking-close", { bubbles: true, composed: true })
2444
- );
2445
- };
2446
- onBackdropClick = (event) => {
2447
- if (event.target === this.dialogEl) {
2448
- this.closePalette();
2449
- }
2450
- };
2451
- onInput = (event) => {
2452
- this.query = event.target.value ?? this.inputEl?.value ?? "";
2453
- this.activeIndex = 0;
2454
- this.renderResults();
2455
- this.dispatchEvent(
2456
- new CustomEvent("viking-query", {
2457
- bubbles: true,
2458
- composed: true,
2459
- detail: { query: this.query }
2460
- })
2461
- );
2462
- };
2463
- onInputKeydown = (event) => {
2464
- if (this.flatResults.length === 0) {
2465
- if (event.key === "Escape") {
2466
- event.preventDefault();
2467
- this.closePalette();
2468
- }
2469
- return;
2470
- }
2471
- if (event.key === "ArrowDown") {
2472
- event.preventDefault();
2473
- this.activeIndex = Math.min(
2474
- this.flatResults.length - 1,
2475
- this.activeIndex + 1
2476
- );
2477
- this.renderResults();
2478
- this.scrollActiveIntoView();
2479
- return;
2480
- }
2481
- if (event.key === "ArrowUp") {
2482
- event.preventDefault();
2483
- this.activeIndex = Math.max(0, this.activeIndex - 1);
2484
- this.renderResults();
2485
- this.scrollActiveIntoView();
2486
- return;
2487
- }
2488
- if (event.key === "Enter") {
2489
- event.preventDefault();
2490
- const item = this.flatResults[this.activeIndex];
2491
- if (item) {
2492
- this.activateItem(item);
2493
- }
2494
- }
2495
- };
2496
- bindGlobalShortcut() {
2497
- if (!readBoolAttr(this, "global-shortcut")) {
2498
- return;
2499
- }
2500
- this.globalKeyHandler = (event) => {
2501
- if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "k") {
2502
- event.preventDefault();
2503
- if (this.hasAttribute("open")) {
2504
- this.closePalette();
2505
- } else {
2506
- this.openPalette();
2507
- }
2508
- }
2509
- };
2510
- document.addEventListener("keydown", this.globalKeyHandler);
2511
- }
2512
- unbindGlobalShortcut() {
2513
- if (this.globalKeyHandler) {
2514
- document.removeEventListener("keydown", this.globalKeyHandler);
2515
- this.globalKeyHandler = null;
2516
- }
2517
- }
2518
- syncOpen() {
2519
- if (!this.dialogEl) {
2520
- return;
2521
- }
2522
- const shouldOpen = this.hasAttribute("open");
2523
- if (shouldOpen && !this.dialogEl.open) {
2524
- this.dialogEl.removeAttribute("aria-hidden");
2525
- showModalDialog(this.dialogEl);
2526
- this.activeIndex = 0;
2527
- this.renderResults();
2528
- queueMicrotask(() => this.inputEl?.focus());
2529
- } else if (!shouldOpen && this.dialogEl.open) {
2530
- closeModalDialog(this.dialogEl);
2531
- this.dialogEl.setAttribute("aria-hidden", "true");
2532
- } else if (!shouldOpen) {
2533
- this.dialogEl.setAttribute("aria-hidden", "true");
2534
- }
2535
- }
2536
- scrollActiveIntoView() {
2537
- const active = this.resultsEl?.querySelector(
2538
- ".viking-search-result.is-selected"
2539
- );
2540
- active?.scrollIntoView({ block: "nearest" });
2541
- }
2542
- activateItem(item) {
2543
- this.dispatchEvent(
2544
- new CustomEvent("viking-select", {
2545
- bubbles: true,
2546
- composed: true,
2547
- detail: { item }
2548
- })
2549
- );
2550
- this.closePalette();
2551
- if (item.action === "cookie-settings") {
2552
- const widgets = globalThis.DemlWidgets;
2553
- widgets?.openCookieSettings?.();
2554
- return;
2555
- }
2556
- if (item.action === "bug-report") {
2557
- const widgets = globalThis.DemlWidgets;
2558
- if (widgets?.openBugReport) {
2559
- widgets.openBugReport();
2560
- return;
2561
- }
2562
- }
2563
- if (item.href && item.href !== "#") {
2564
- window.location.assign(item.href);
2565
- }
2566
- }
2567
- renderResults() {
2568
- if (!this.resultsEl) {
2569
- return;
2570
- }
2571
- const items = parseItems(this);
2572
- const q = this.query.trim().toLowerCase();
2573
- const filtered = filterItems(items, q);
2574
- this.flatResults = filtered;
2575
- if (filtered.length === 0) {
2576
- const q2 = this.query.trim();
2577
- this.resultsEl.innerHTML = `<p class="viking-search-empty" role="status">${q2 ? "No results found" : "Start typing to search\u2026"}</p>`;
2578
- this.inputEl?.removeAttribute("aria-activedescendant");
2579
- return;
2580
- }
2581
- if (this.activeIndex >= filtered.length) {
2582
- this.activeIndex = filtered.length - 1;
2583
- }
2584
- let resultIndex = 0;
2585
- const grouped = groupItems(filtered);
2586
- const markup = grouped.map(({ group, items: groupItemsList }) => {
2587
- const groupLabel = group ? `<p class="viking-search-group-label" role="presentation">${escapeHtml(group)}</p>` : "";
2588
- const rows = groupItemsList.map((item) => {
2589
- const id = `${this.resultsId}-result-${resultIndex}`;
2590
- const selected = resultIndex === this.activeIndex;
2591
- resultIndex += 1;
2592
- return `
2593
- <a
2594
- id="${id}"
2595
- class="viking-search-result${selected ? " is-selected" : ""}"
2596
- role="option"
2597
- aria-selected="${selected}"
2598
- href="${escapeHtml(item.href)}"
2599
- part="result"
2600
- data-index="${resultIndex - 1}"
2601
- >
2602
- <div>
2603
- <div class="viking-search-result-title">${escapeHtml(item.title)}</div>
2604
- ${item.snippet ? `<div class="viking-search-result-snippet">${escapeHtml(item.snippet)}</div>` : ""}
2605
- </div>
2606
- </a>`;
2607
- }).join("");
2608
- return `${groupLabel}${rows}`;
2609
- }).join("");
2610
- this.resultsEl.innerHTML = `<div class="viking-search-results" id="${this.resultsId}" role="listbox" aria-label="Search results">${markup}</div>`;
2611
- const activeId = `${this.resultsId}-result-${this.activeIndex}`;
2612
- this.inputEl?.setAttribute("aria-activedescendant", activeId);
2613
- this.inputEl?.setAttribute("role", "combobox");
2614
- this.inputEl?.setAttribute("aria-expanded", "true");
2615
- this.inputEl?.setAttribute("aria-controls", this.resultsId);
2616
- this.resultsEl.querySelectorAll(".viking-search-result").forEach((node) => {
2617
- node.addEventListener("click", (event) => {
2618
- event.preventDefault();
2619
- const index = Number(node.dataset["index"] ?? 0);
2620
- const item = this.flatResults[index];
2621
- if (item) {
2622
- this.activateItem(item);
2623
- }
2624
- });
2625
- node.addEventListener("mouseenter", () => {
2626
- const index = Number(node.dataset["index"] ?? 0);
2627
- this.activeIndex = index;
2628
- this.renderResults();
2629
- });
2630
- });
2631
- }
2632
- render() {
2633
- const placeholder = this.getAttribute("placeholder") ?? "Search documentation, dashboard, API\u2026";
2634
- const mod = modKeyLabel();
2635
- this.shadow.innerHTML = `
2636
- <dialog class="viking-search-palette-backdrop" aria-label="Search" aria-hidden="true">
2637
- <div class="viking-search-palette" part="panel" role="document">
2638
- <div class="viking-search-palette-header" part="header">
2639
- <span class="viking-search-palette-icon" aria-hidden="true">${renderInlineIcon("search", 24)}</span>
2640
- <input
2641
- id="${this.inputId}"
2642
- type="search"
2643
- class="viking-search-palette-input"
2644
- part="input"
2645
- placeholder="${escapeHtml(placeholder)}"
2646
- aria-label="${escapeHtml(placeholder)}"
2647
- aria-autocomplete="list"
2648
- autocomplete="off"
2649
- spellcheck="false"
2650
- />
2651
- <button type="button" class="viking-search-palette-close" part="close" aria-label="Close search">${renderInlineIcon("x", 20)}</button>
2652
- </div>
2653
- <div class="viking-search-palette-body" part="body">
2654
- <slot></slot>
2655
- <div class="viking-search-results-host"></div>
2656
- </div>
2657
- <footer class="viking-search-palette-footer" part="footer">
2658
- <span class="viking-kbd">${mod}</span><span class="viking-kbd">K</span> toggle \xB7
2659
- <span class="viking-kbd">\u2191</span><span class="viking-kbd">\u2193</span> navigate \xB7
2660
- <span class="viking-kbd">Enter</span> open \xB7
2661
- <span class="viking-kbd">Esc</span> close
2662
- </footer>
2663
- </div>
2664
- </dialog>
2665
- `;
2666
- this.dialogEl = this.shadow.querySelector("dialog");
2667
- this.inputEl = this.shadow.querySelector("input");
2668
- this.resultsEl = this.shadow.querySelector(".viking-search-results-host");
2669
- this.shadow.querySelector(".viking-search-palette-close")?.addEventListener("click", () => this.closePalette());
2670
- this.dialogEl?.addEventListener("keydown", (event) => {
2671
- if (event.key === "Escape") {
2672
- event.preventDefault();
2673
- this.closePalette();
2674
- }
2675
- });
2676
- }
2677
- };
2678
- var registerVikingSearchPaletteWc = () => {
2679
- defineCustomElement(VikingSearchPaletteWc.tag, VikingSearchPaletteWc);
2680
- defineCustomElementAlias(
2681
- VikingSearchPaletteWc.searchTag,
2682
- VikingSearchPaletteWc
2683
- );
2684
- defineCustomElementAlias(
2685
- VikingSearchPaletteWc.legacyTag,
2686
- VikingSearchPaletteWc
2687
- );
2688
- };
2689
-
2690
- // src/lib/site-drakkar/site-drakkar.config.ts
2691
- var SITE_NAV_LINKS = [
2692
- {
2693
- id: "explore",
2694
- label: "Explore",
2695
- icon: "globe",
2696
- appHref: "/explore",
2697
- marketingHref: "/explore",
2698
- platform: true
2699
- },
2700
- {
2701
- id: "documentation",
2702
- label: "Documentation",
2703
- icon: "file",
2704
- appHref: "https://dataengineeringformachinelearning.com/documentation/",
2705
- marketingHref: "/documentation"
2706
- },
2707
- {
2708
- id: "dashboard",
2709
- label: "Dashboard",
2710
- icon: "home",
2711
- appHref: "/dashboard",
2712
- marketingHref: "/dashboard",
2713
- requireAuth: true,
2714
- platform: true
2715
- },
2716
- {
2717
- id: "sites",
2718
- label: "Sites",
2719
- icon: "building",
2720
- appHref: "/settings",
2721
- marketingHref: "/settings",
2722
- requireAuth: true,
2723
- platform: true
2724
- },
2725
- {
2726
- id: "account",
2727
- label: "Account",
2728
- icon: "user",
2729
- appHref: "/account",
2730
- marketingHref: "/account",
2731
- requireAuth: true,
2732
- platform: true
2733
- }
2734
- ];
2735
- var SITE_FOOTER_COLUMNS = [
2736
- {
2737
- title: "Platform",
2738
- links: [
2739
- {
2740
- label: "Explore",
2741
- appHref: "/explore",
2742
- marketingHref: "/explore",
2743
- platform: true
2744
- },
2745
- {
2746
- label: "Dashboard",
2747
- appHref: "/dashboard",
2748
- marketingHref: "/dashboard",
2749
- platform: true
2750
- },
2751
- {
2752
- label: "Sites",
2753
- appHref: "/settings",
2754
- marketingHref: "/settings",
2755
- platform: true
2756
- },
2757
- {
2758
- label: "Account",
2759
- appHref: "/account",
2760
- marketingHref: "/account",
2761
- platform: true
2762
- },
2763
- {
2764
- label: "Platform Status",
2765
- appHref: "/status/platform-status",
2766
- marketingHref: "/status/platform-status",
2767
- platform: true
2768
- }
2769
- ]
2770
- },
2771
- {
2772
- title: "Resources",
2773
- links: [
2774
- {
2775
- label: "Documentation",
2776
- appHref: "https://dataengineeringformachinelearning.com/documentation/",
2777
- marketingHref: "/documentation"
2778
- },
2779
- {
2780
- label: "Whitepaper",
2781
- appHref: "https://dataengineeringformachinelearning.com/whitepaper/",
2782
- marketingHref: "/whitepaper"
2783
- },
2784
- {
2785
- label: "Book",
2786
- appHref: "https://dataengineeringformachinelearning.com/book/",
2787
- marketingHref: "/book"
2788
- }
2789
- ]
2790
- },
2791
- {
2792
- title: "Support",
2793
- links: [
2794
- {
2795
- label: "Platform Status",
2796
- appHref: "/status/platform-status",
2797
- marketingHref: "/status/platform-status",
2798
- platform: true
2799
- },
2800
- {
2801
- label: "Report a Bug",
2802
- appHref: "#",
2803
- marketingHref: "#",
2804
- action: "bug-report"
2805
- }
2806
- ]
2807
- },
2808
- {
2809
- title: "Legal & Compliance",
2810
- links: [
2811
- {
2812
- label: "Privacy Policy",
2813
- appHref: "https://dataengineeringformachinelearning.com/privacy/",
2814
- marketingHref: "/privacy"
2815
- },
2816
- {
2817
- label: "Terms of Service",
2818
- appHref: "https://dataengineeringformachinelearning.com/terms/",
2819
- marketingHref: "/terms"
2820
- },
2821
- {
2822
- label: "SOC2 Compliance",
2823
- appHref: "https://dataengineeringformachinelearning.com/compliance/",
2824
- marketingHref: "/compliance"
2825
- },
2826
- {
2827
- label: "GDPR Compliance",
2828
- appHref: "https://dataengineeringformachinelearning.com/privacy/#gdpr",
2829
- marketingHref: "/privacy#gdpr"
2830
- },
2831
- {
2832
- label: "Cookie Settings",
2833
- appHref: "#",
2834
- marketingHref: "#",
2835
- action: "cookie-settings"
2836
- }
2837
- ]
2838
- }
2839
- ];
2840
- var BUG_REPORT_QUERY = "reportBug=1";
2841
- var COOKIE_SETTINGS_QUERY = "cookieSettings=1";
2842
- var isAbsoluteUrl = (href) => /^https?:\/\//i.test(href);
2843
- var joinBase = (base, path) => {
2844
- if (isAbsoluteUrl(path)) {
2845
- return path;
2846
- }
2847
- const normalizedBase = base.replace(/\/$/, "");
2848
- const normalizedPath = path.startsWith("/") ? path : `/${path}`;
2849
- return `${normalizedBase}${normalizedPath}`;
2850
- };
2851
- var bugReportHref = (urls) => `${joinBase(urls.app, "/")}?${BUG_REPORT_QUERY}`;
2852
- var cookieSettingsHref = (urls) => `${joinBase(urls.marketing, "/")}?${COOKIE_SETTINGS_QUERY}`;
2853
- var resolveMarketingContentHref = (href, urls) => {
2854
- if (isAbsoluteUrl(href)) {
2855
- return href;
2856
- }
2857
- if (href.startsWith("mailto:")) {
2858
- return href;
2859
- }
2860
- return href.startsWith("/") ? href : joinBase(urls.marketing, href);
2861
- };
2862
- var resolvePlatformHref = (href, context, urls) => {
2863
- if (context === "app") {
2864
- return href;
2865
- }
2866
- return joinBase(urls.app, href);
2867
- };
2868
- var resolveNavHref = (link, context, urls) => {
2869
- if (link.platform) {
2870
- return resolvePlatformHref(link.appHref, context, urls);
2871
- }
2872
- if (context === "app") {
2873
- return link.appHref;
2874
- }
2875
- return resolveMarketingContentHref(link.marketingHref, urls);
2876
- };
2877
- var resolveFooterHref = (link, context, urls) => {
2878
- if (link.action === "bug-report") {
2879
- return context === "app" ? "#" : bugReportHref(urls);
2880
- }
2881
- if (link.action === "cookie-settings") {
2882
- return cookieSettingsHref(urls);
2883
- }
2884
- if (link.platform) {
2885
- return resolvePlatformHref(link.appHref, context, urls);
2886
- }
2887
- if (context === "app") {
2888
- return link.appHref;
2889
- }
2890
- return resolveMarketingContentHref(link.marketingHref, urls);
2891
- };
2892
- var resolveBrandHref = (context, urls) => {
2893
- if (context === "marketing") {
2894
- return "/";
2895
- }
2896
- return urls.marketing;
2897
- };
2898
- var visibleNavLinks = (links, isAuthenticated = false) => links.filter((link) => !link.requireAuth || isAuthenticated);
2899
- var DEFAULT_SITE_URLS = {
2900
- app: "https://deml.app",
2901
- marketing: "https://dataengineeringformachinelearning.com",
2902
- backend: "https://backend.deml.app"
2903
- };
2904
-
2905
- // src/lib/site-drakkar/suite-search-items.ts
2906
- var dedupeItems = (items) => {
2907
- const seen = /* @__PURE__ */ new Set();
2908
- return items.filter((item) => {
2909
- const key = `${item.title}:${item.href}:${item.action ?? ""}`;
2910
- if (seen.has(key)) {
2911
- return false;
2912
- }
2913
- seen.add(key);
2914
- return true;
2915
- });
2916
- };
2917
- var navItem = (link, context, urls) => ({
2918
- title: link.label,
2919
- href: resolveNavHref(link, context, urls),
2920
- snippet: `Open ${link.label}`,
2921
- group: "Platform",
2922
- keywords: [link.id, link.label.toLowerCase(), "navigate", "go"]
2923
- });
2924
- var footerItem = (link, columnTitle, context, urls) => {
2925
- if (link.action === "cookie-settings") {
2926
- return {
2927
- title: link.label,
2928
- href: cookieSettingsHref(urls),
2929
- snippet: "Manage analytics and cookie preferences",
2930
- group: columnTitle,
2931
- keywords: ["cookies", "consent", "privacy", "gdpr"],
2932
- action: "cookie-settings"
2933
- };
2934
- }
2935
- if (link.action === "bug-report") {
2936
- return {
2937
- title: link.label,
2938
- href: context === "app" ? "#" : bugReportHref(urls),
2939
- snippet: "Submit a product issue or regression",
2940
- group: columnTitle,
2941
- keywords: ["bug", "issue", "support", "feedback"],
2942
- action: "bug-report"
2943
- };
2944
- }
2945
- return {
2946
- title: link.label,
2947
- href: resolveFooterHref(link, context, urls),
2948
- snippet: `Open ${link.label}`,
2949
- group: columnTitle,
2950
- keywords: [link.label.toLowerCase(), columnTitle.toLowerCase()]
2951
- };
2952
- };
2953
- var SUITE_SEARCH_EXTRAS = [
2954
- {
2955
- title: "Viking-UI Components",
2956
- snippet: "Browse the design system showcase",
2957
- group: "Resources",
2958
- keywords: ["viking", "ui", "design system", "components", "showcase"]
2959
- },
2960
- {
2961
- title: "Design tokens",
2962
- snippet: "Canonical --viking-* token matrix",
2963
- group: "Resources",
2964
- keywords: ["tokens", "theme", "css", "variables"]
2965
- },
2966
- {
2967
- title: "API reference",
2968
- snippet: "OpenAPI schema and REST endpoints",
2969
- group: "Resources",
2970
- keywords: ["api", "openapi", "swagger", "rest"]
2971
- }
2972
- ];
2973
- var resolveExtraHref = (extra, context, urls) => {
2974
- switch (extra.title) {
2975
- case "Viking-UI Components":
2976
- return "https://ui.dataengineeringformachinelearning.com/components";
2977
- case "Design tokens":
2978
- return "https://ui.dataengineeringformachinelearning.com/tokens";
2979
- case "API reference":
2980
- return `${urls.backend.replace(/\/$/, "")}/api/docs`;
2981
- default:
2982
- return context === "app" ? urls.app : urls.marketing;
2983
- }
2984
- };
2985
- var DOCS_SEARCH_EXTRAS = [
2986
- {
2987
- title: "Components",
2988
- href: "/components",
2989
- snippet: "Browse all documented primitives",
2990
- group: "Viking-UI",
2991
- keywords: ["components", "showcase", "registry"]
2992
- },
2993
- {
2994
- title: "Playground",
2995
- href: "/playground",
2996
- snippet: "Live Web Component sandbox",
2997
- group: "Viking-UI",
2998
- keywords: ["playground", "sandbox", "demo"]
2999
- },
3000
- {
3001
- title: "Architecture",
3002
- href: "/architecture",
3003
- snippet: "CSS + WC + Angular layers",
3004
- group: "Viking-UI",
3005
- keywords: ["architecture", "layers", "web component"]
3006
- },
3007
- {
3008
- title: "Design tokens",
3009
- href: "/tokens",
3010
- snippet: "Canonical --viking-* token matrix",
3011
- group: "Viking-UI",
3012
- keywords: ["tokens", "theme", "css", "variables"]
3013
- },
3014
- {
3015
- title: "Theming",
3016
- href: "/theming",
3017
- snippet: "Light/dark mode and sync pipeline",
3018
- group: "Viking-UI",
3019
- keywords: ["theming", "dark", "light", "mode"]
3020
- },
3021
- {
3022
- title: "Framework guides",
3023
- href: "/frameworks",
3024
- snippet: "Angular, Astro, Django setup",
3025
- group: "Viking-UI",
3026
- keywords: ["frameworks", "angular", "astro", "django"]
3027
- },
3028
- {
3029
- title: "Contributing",
3030
- href: "/contributing",
3031
- snippet: "Extend the Viking-UI kit",
3032
- group: "Viking-UI",
3033
- keywords: ["contributing", "extend", "primitives"]
3034
- }
3035
- ];
3036
- var resolveDocsHref = (href, docsOrigin) => href.startsWith("http") ? href : `${docsOrigin.replace(/\/$/, "")}${href.startsWith("/") ? href : `/${href}`}`;
3037
- var buildSuiteSearchItems = (context, urls, options) => {
3038
- const paletteContext = context === "docs" ? "marketing" : context;
3039
- const items = [
3040
- ...SITE_NAV_LINKS.map((link) => navItem(link, paletteContext, urls)),
3041
- ...SITE_FOOTER_COLUMNS.flatMap(
3042
- (column) => column.links.map(
3043
- (link) => footerItem(link, column.title, paletteContext, urls)
3044
- )
3045
- ),
3046
- ...SUITE_SEARCH_EXTRAS.map((extra) => ({
3047
- ...extra,
3048
- href: resolveExtraHref(extra, paletteContext, urls)
3049
- }))
3050
- ];
3051
- if (context === "app") {
3052
- items.push(
3053
- {
3054
- title: "Settings",
3055
- href: "/settings",
3056
- snippet: "Workspace domains, billing, and security",
3057
- group: "Platform",
3058
- keywords: ["settings", "sites", "workspace", "configuration"]
3059
- },
3060
- {
3061
- title: "Billing & subscription",
3062
- href: "/settings/billing",
3063
- snippet: "Manage plan, invoices, and payment methods",
3064
- group: "Platform",
3065
- keywords: ["billing", "stripe", "subscription", "payment"]
3066
- },
3067
- {
3068
- title: "Security settings",
3069
- href: "/settings/security",
3070
- snippet: "Keys, sessions, and access controls",
3071
- group: "Platform",
3072
- keywords: ["security", "keys", "auth", "rbac"]
3073
- }
3074
- );
3075
- }
3076
- if (context === "docs") {
3077
- const docsOrigin = options?.docsOrigin ?? "https://ui.dataengineeringformachinelearning.com";
3078
- items.push(
3079
- ...DOCS_SEARCH_EXTRAS.map((extra) => ({
3080
- ...extra,
3081
- href: resolveDocsHref(extra.href, docsOrigin)
3082
- }))
3083
- );
3084
- }
3085
- return dedupeItems(items);
3086
- };
3087
-
3088
- // src/web/suite-search-palette/viking-suite-search-palette-wc.ts
3089
- var VALID_CONTEXTS = /* @__PURE__ */ new Set([
3090
- "app",
3091
- "marketing",
3092
- "backend",
3093
- "docs"
3094
- ]);
3095
- var detectContext = () => {
3096
- const explicit = document.documentElement.getAttribute("data-deml-context");
3097
- if (explicit && VALID_CONTEXTS.has(explicit)) {
3098
- return explicit;
3099
- }
3100
- const host = window.location.hostname;
3101
- if (host.startsWith("ui.")) {
3102
- return "docs";
3103
- }
3104
- if (host.includes("deml.app") && !host.startsWith("backend.")) {
3105
- return "app";
3106
- }
3107
- if (host.startsWith("backend.")) {
3108
- return "backend";
3109
- }
3110
- return "marketing";
3111
- };
3112
- var readUrls = (el) => {
3113
- const env = globalThis.__DEML ?? {};
3114
- return {
3115
- app: el.getAttribute("app-url") ?? env.app ?? DEFAULT_SITE_URLS.app,
3116
- marketing: el.getAttribute("marketing-url") ?? env.marketing ?? DEFAULT_SITE_URLS.marketing,
3117
- backend: el.getAttribute("backend-url") ?? env.backend ?? DEFAULT_SITE_URLS.backend
3118
- };
3119
- };
3120
- var readContext = (el) => {
3121
- const raw = el.getAttribute("context");
3122
- if (raw && VALID_CONTEXTS.has(raw)) {
3123
- return raw;
3124
- }
3125
- return detectContext();
3126
- };
3127
- var VikingSuiteSearchPaletteWc = class extends HTMLElementBase {
3128
- static tag = "viking-suite-command-palette";
3129
- static searchTag = "viking-suite-search-palette";
3130
- static legacyTag = "viking-suite-search-palette-wc";
3131
- static get observedAttributes() {
3132
- return [
3133
- "context",
3134
- "app-url",
3135
- "marketing-url",
3136
- "backend-url",
3137
- "placeholder",
3138
- "global-shortcut"
3139
- ];
3140
- }
3141
- paletteEl = null;
3142
- itemsLoaded = false;
3143
- connectedCallback() {
3144
- registerVikingSearchPaletteWc();
3145
- this.ensurePalette();
3146
- void this.loadItems();
3147
- }
3148
- attributeChangedCallback(name) {
3149
- if (!this.isConnected) {
3150
- return;
3151
- }
3152
- if (name === "placeholder" && this.paletteEl) {
3153
- const placeholder = this.getAttribute("placeholder") ?? "Search documentation, dashboard, settings\u2026";
3154
- this.paletteEl.setAttribute("placeholder", placeholder);
3155
- return;
3156
- }
3157
- if (name === "global-shortcut" && this.paletteEl) {
3158
- if (readBoolAttr(this, "global-shortcut") || !this.hasAttribute("global-shortcut")) {
3159
- this.paletteEl.setAttribute("global-shortcut", "");
3160
- } else {
3161
- this.paletteEl.removeAttribute("global-shortcut");
3162
- }
3163
- return;
3164
- }
3165
- if (name === "context" || name === "app-url" || name === "marketing-url" || name === "backend-url") {
3166
- void this.loadItems(true);
3167
- }
3168
- }
3169
- /** Opens the unified command palette. */
3170
- openPalette() {
3171
- this.ensurePalette();
3172
- void this.loadItems().then(() => this.paletteEl?.openPalette());
3173
- }
3174
- /** Closes the unified command palette. */
3175
- closePalette() {
3176
- this.paletteEl?.closePalette();
3177
- }
3178
- ensurePalette() {
3179
- if (this.paletteEl) {
3180
- return;
3181
- }
3182
- this.paletteEl = document.createElement(
3183
- "viking-command-palette"
3184
- );
3185
- this.paletteEl.id = "deml-command-palette";
3186
- const placeholder = this.getAttribute("placeholder") ?? "Search documentation, dashboard, settings\u2026";
3187
- this.paletteEl.setAttribute("placeholder", placeholder);
3188
- if (readBoolAttr(this, "global-shortcut") || !this.hasAttribute("global-shortcut")) {
3189
- this.paletteEl.setAttribute("global-shortcut", "");
3190
- }
3191
- this.append(this.paletteEl);
3192
- }
3193
- async loadItems(force = false) {
3194
- if (!this.paletteEl || this.itemsLoaded && !force) {
3195
- return;
3196
- }
3197
- const context = readContext(this);
3198
- const urls = readUrls(this);
3199
- let items = buildSuiteSearchItems(
3200
- context,
3201
- urls,
3202
- {
3203
- docsOrigin: window.location.origin
3204
- }
3205
- );
3206
- try {
3207
- const response = await fetch("/assets/site-drakkar.json", {
3208
- cache: "no-cache"
3209
- });
3210
- if (response.ok) {
3211
- const drakkar = await response.json();
3212
- if (drakkar.navLinks?.length || drakkar.footerColumns?.length) {
3213
- items = buildSuiteSearchItems(context, urls, {
3214
- docsOrigin: window.location.origin
3215
- });
3216
- }
3217
- }
3218
- } catch {
3219
- }
3220
- this.paletteEl.setAttribute("items", JSON.stringify(items));
3221
- this.itemsLoaded = true;
3222
- }
3223
- };
3224
- var registerVikingSuiteSearchPaletteWc = () => {
3225
- defineCustomElement(
3226
- VikingSuiteSearchPaletteWc.tag,
3227
- VikingSuiteSearchPaletteWc
3228
- );
3229
- defineCustomElementAlias(
3230
- VikingSuiteSearchPaletteWc.searchTag,
3231
- VikingSuiteSearchPaletteWc
3232
- );
3233
- defineCustomElementAlias(
3234
- VikingSuiteSearchPaletteWc.legacyTag,
3235
- VikingSuiteSearchPaletteWc
3236
- );
3237
- };
3238
-
3239
- // src/web/theme-toggle/viking-theme-toggle-wc.ts
3240
- var VIKING_THEME_TOGGLE_STYLES = `
3241
- :host {
3242
- display: inline-flex;
3243
- }
3244
-
3245
- .theme-toggle-btn {
3246
- display: inline-flex;
3247
- align-items: center;
3248
- justify-content: center;
3249
- flex-shrink: 0;
3250
- width: var(--viking-control-height, 40px);
3251
- height: var(--viking-control-height, 40px);
3252
- min-width: var(--viking-control-height, 40px);
3253
- padding: 0;
3254
- border: 1px solid color-mix(in srgb, var(--viking-accent, var(--viking-accent)) 32%, var(--viking-border-strong, var(--viking-border)));
3255
- border-radius: var(--viking-radius);
3256
- background: color-mix(in srgb, var(--viking-accent, var(--viking-accent)) 8%, var(--viking-surface));
3257
- color: var(--viking-accent-strong, var(--viking-ring));
3258
- box-shadow: var(--viking-shadow-sm);
3259
- cursor: pointer;
3260
- transition: var(--viking-transition-interactive);
3261
- -webkit-tap-highlight-color: transparent;
3262
- }
3263
-
3264
- .theme-toggle-btn:hover {
3265
- border-color: var(--viking-accent-strong, var(--viking-ring));
3266
- background: color-mix(in srgb, var(--viking-accent, var(--viking-accent)) 14%, var(--viking-surface-alt));
3267
- color: var(--viking-accent-strong, var(--viking-ring));
3268
- box-shadow: var(--viking-shadow-md);
3269
- }
3270
-
3271
- .theme-toggle-btn:focus-visible {
3272
- outline: var(--viking-ring-width, 2px) solid var(--viking-ring);
3273
- outline-offset: var(--viking-ring-offset, 2px);
3274
- }
3275
-
3276
- .theme-toggle-btn:active {
3277
- transform: scale(var(--viking-state-active-scale, 0.98));
3278
- }
3279
-
3280
- .theme-icon {
3281
- display: none;
3282
- }
3283
-
3284
- .theme-icon.is-visible {
3285
- display: block;
3286
- }
3287
- `;
3288
- var applyTheme = (theme) => {
3289
- document.documentElement.setAttribute("data-theme", theme);
3290
- document.documentElement.classList.toggle("dark", theme === "dark");
3291
- localStorage.setItem("theme", theme);
3292
- };
3293
- var readTheme = () => {
3294
- const saved = localStorage.getItem("theme");
3295
- if (saved === "light" || saved === "dark") return saved;
3296
- return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
3297
- };
3298
- var VikingThemeToggleWc = class extends HTMLElementBase {
3299
- static tag = "viking-theme-toggle-wc";
3300
- shadow;
3301
- button = null;
3302
- sunIcon = null;
3303
- moonIcon = null;
3304
- constructor() {
3305
- super();
3306
- this.shadow = this.attachShadow({ mode: "open" });
3307
- attachShadowStyles(this.shadow, VIKING_THEME_TOGGLE_STYLES);
3308
- }
3309
- connectedCallback() {
3310
- if (!this.hasAttribute("role")) {
3311
- this.setAttribute("role", "button");
3312
- }
3313
- this.render();
3314
- this.syncIcons();
3315
- this.button?.addEventListener("click", this.onClick);
3316
- }
3317
- disconnectedCallback() {
3318
- this.button?.removeEventListener("click", this.onClick);
3319
- }
3320
- onClick = () => {
3321
- const next = readTheme() === "light" ? "dark" : "light";
3322
- applyTheme(next);
3323
- this.syncIcons();
3324
- this.dispatchEvent(
3325
- new CustomEvent("viking-theme-change", {
3326
- bubbles: true,
3327
- composed: true,
3328
- detail: { theme: next }
3329
- })
3330
- );
3331
- };
3332
- syncIcons = () => {
3333
- const isLight = readTheme() === "light";
3334
- this.sunIcon?.classList.toggle("is-visible", isLight);
3335
- this.moonIcon?.classList.toggle("is-visible", !isLight);
3336
- };
3337
- render() {
3338
- const label = this.getAttribute("aria-label") ?? "Toggle light and dark theme";
3339
- this.shadow.innerHTML = `
3340
- <button type="button" class="theme-toggle-btn" part="control" aria-label="${label}">
3341
- <svg class="theme-icon theme-icon-sun" width="20" height="20" viewBox="0 0 24 24" aria-hidden="true">
3342
- <circle cx="12" cy="12" r="4" fill="none" stroke="currentColor" stroke-width="2"/>
3343
- <path stroke="currentColor" stroke-width="2" d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"/>
3344
- </svg>
3345
- <svg class="theme-icon theme-icon-moon" width="20" height="20" viewBox="0 0 24 24" aria-hidden="true">
3346
- <path fill="currentColor" d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"/>
3347
- </svg>
3348
- </button>
3349
- `;
3350
- this.button = this.shadow.querySelector("button");
3351
- this.sunIcon = this.shadow.querySelector(".theme-icon-sun");
3352
- this.moonIcon = this.shadow.querySelector(".theme-icon-moon");
3353
- }
3354
- };
3355
- var registerVikingThemeToggleWc = () => {
3356
- defineCustomElement(VikingThemeToggleWc.tag, VikingThemeToggleWc);
3357
- };
3358
-
3359
- // src/web/suite-header/viking-suite-header-wc.ts
3360
- var VALID_CONTEXTS2 = /* @__PURE__ */ new Set([
3361
- "app",
3362
- "marketing",
3363
- "backend",
3364
- "docs"
3365
- ]);
3366
- var VIKING_SUITE_HEADER_STYLES = `
3367
- :host {
3368
- display: block;
3369
- position: sticky;
3370
- top: 0;
3371
- z-index: var(--viking-z-sticky, 50);
3372
- color: var(--viking-text);
3373
- font-family: var(--viking-font-family);
3374
- }
3375
-
3376
- * {
3377
- box-sizing: border-box;
3378
- }
3379
-
3380
- .suite-header {
3381
- width: 100%;
3382
- min-height: var(--viking-navbar-height, var(--viking-space-8));
3383
- background: var(--viking-surface);
3384
- border-bottom: var(--viking-border-width, 1px) solid var(--viking-border);
3385
- box-shadow: var(--viking-shadow-xs);
3386
- isolation: isolate;
3387
- }
3388
-
3389
- .suite-header__bar {
3390
- display: grid;
3391
- grid-template-columns: minmax(max-content, auto) minmax(0, 1fr) max-content;
3392
- align-items: center;
3393
- gap: var(--viking-space-1);
3394
- width: 100%;
3395
- max-width: var(--viking-container-max-width);
3396
- min-height: var(--viking-navbar-height, var(--viking-space-8));
3397
- margin-inline: auto;
3398
- padding-inline: var(--viking-page-gutter);
3399
- }
3400
-
3401
- .suite-header__brand {
3402
- display: inline-flex;
3403
- align-items: center;
3404
- justify-content: center;
3405
- gap: var(--viking-space-1);
3406
- min-width: 0;
3407
- min-height: var(--viking-control-height);
3408
- color: var(--viking-text);
3409
- text-decoration: none;
3410
- border-radius: var(--viking-radius);
3411
- }
3412
-
3413
- .suite-header__brand:focus-visible,
3414
- .suite-header__link:focus-visible,
3415
- .suite-header__icon-button:focus-visible,
3416
- .suite-header__auth-link:focus-visible,
3417
- .suite-header__user-trigger:focus-visible,
3418
- .suite-header__menu-link:focus-visible,
3419
- .suite-header__menu-button:focus-visible {
3420
- outline: var(--viking-ring-width) solid var(--viking-ring);
3421
- outline-offset: var(--viking-ring-offset);
3422
- }
3423
-
3424
- .suite-header__mark {
3425
- display: inline-flex;
3426
- align-items: center;
3427
- justify-content: center;
3428
- width: var(--viking-space-4);
3429
- height: var(--viking-space-4);
3430
- color: var(--viking-accent);
3431
- flex: 0 0 auto;
3432
- }
3433
-
3434
- .suite-header__lockup {
3435
- display: none;
3436
- min-width: 0;
3437
- color: var(--viking-text);
3438
- font-size: var(--viking-font-size-sm);
3439
- font-weight: var(--viking-font-weight-bold);
3440
- line-height: var(--viking-line-height-tight);
3441
- letter-spacing: var(--viking-letter-spacing-caps);
3442
- text-transform: uppercase;
3443
- white-space: nowrap;
3444
- }
3445
-
3446
- .suite-header__nav {
3447
- display: none;
3448
- align-items: center;
3449
- justify-content: center;
3450
- gap: var(--viking-space-half);
3451
- min-width: 0;
3452
- overflow: hidden;
3453
- }
3454
-
3455
- .suite-header__link {
3456
- display: inline-flex;
3457
- align-items: center;
3458
- justify-content: center;
3459
- gap: var(--viking-space-half);
3460
- min-width: 0;
3461
- height: var(--viking-control-height);
3462
- padding-inline: var(--viking-space-1-5);
3463
- color: var(--viking-text-muted);
3464
- border-radius: var(--viking-radius) var(--viking-radius) 0 0;
3465
- font-size: var(--viking-font-size-sm);
3466
- font-weight: var(--viking-font-weight-semibold);
3467
- line-height: var(--viking-line-height-none);
3468
- letter-spacing: var(--viking-letter-spacing-caps);
3469
- text-decoration: none;
3470
- text-transform: uppercase;
3471
- white-space: nowrap;
3472
- transition: var(--viking-transition-interactive);
3473
- }
3474
-
3475
- .suite-header__link:hover,
3476
- .suite-header__link[aria-current='page'] {
3477
- color: var(--viking-text);
3478
- background: var(--viking-surface-alt);
3479
- }
3480
-
3481
- .suite-header__actions {
3482
- display: inline-flex;
3483
- align-items: center;
3484
- justify-content: flex-end;
3485
- gap: var(--viking-space-1);
3486
- min-width: 0;
3487
- }
3488
-
3489
- .suite-header__icon-button,
3490
- .suite-header__menu-button,
3491
- .suite-header__user-trigger,
3492
- .suite-header__auth-link {
3493
- min-height: var(--viking-control-height);
3494
- border: var(--viking-border-width, 1px) solid var(--viking-border-strong);
3495
- border-radius: var(--viking-radius);
3496
- background: var(--viking-surface);
3497
- color: var(--viking-text);
3498
- box-shadow: var(--viking-shadow-sm);
3499
- cursor: pointer;
3500
- font-family: inherit;
3501
- transition: var(--viking-transition-interactive);
3502
- -webkit-tap-highlight-color: transparent;
3503
- }
3504
-
3505
- .suite-header__icon-button,
3506
- .suite-header__menu-button {
3507
- display: inline-flex;
3508
- align-items: center;
3509
- justify-content: center;
3510
- width: var(--viking-control-height);
3511
- min-width: var(--viking-control-height);
3512
- padding: 0;
3513
- }
3514
-
3515
- .suite-header__icon-button:hover,
3516
- .suite-header__menu-button:hover,
3517
- .suite-header__user-trigger:hover,
3518
- .suite-header__auth-link:hover {
3519
- border-color: var(--viking-accent-strong);
3520
- background: var(--viking-surface-alt);
3521
- box-shadow: var(--viking-shadow-md);
3522
- }
3523
-
3524
- .suite-header__auth-link {
3525
- display: none;
3526
- align-items: center;
3527
- justify-content: center;
3528
- gap: var(--viking-space-half);
3529
- min-width: max-content;
3530
- padding-inline: var(--viking-space-2);
3531
- background: var(--viking-accent);
3532
- border-color: var(--viking-accent);
3533
- color: var(--viking-accent-content);
3534
- font-size: var(--viking-font-size-sm);
3535
- font-weight: var(--viking-font-weight-bold);
3536
- line-height: var(--viking-line-height-none);
3537
- letter-spacing: var(--viking-letter-spacing-caps);
3538
- text-decoration: none;
3539
- text-transform: uppercase;
3540
- }
3541
-
3542
- .suite-header__auth-icon,
3543
- .suite-header__menu-icon,
3544
- .suite-header__action-icon,
3545
- .suite-header__avatar-icon,
3546
- .suite-header__chevron {
3547
- display: inline-flex;
3548
- align-items: center;
3549
- justify-content: center;
3550
- flex-shrink: 0;
3551
- }
3552
-
3553
- .suite-header__auth-link:hover {
3554
- background: var(--viking-accent-hover);
3555
- color: var(--viking-accent-content);
3556
- }
3557
-
3558
- .suite-header__user {
3559
- position: relative;
3560
- display: none;
3561
- }
3562
-
3563
- .suite-header__user-trigger {
3564
- display: inline-flex;
3565
- align-items: center;
3566
- justify-content: center;
3567
- gap: var(--viking-space-1);
3568
- min-width: max-content;
3569
- padding-inline: var(--viking-space-1);
3570
- }
3571
-
3572
- .suite-header__avatar {
3573
- display: inline-flex;
3574
- align-items: center;
3575
- justify-content: center;
3576
- width: var(--viking-space-3);
3577
- height: var(--viking-space-3);
3578
- border-radius: var(--viking-radius-full);
3579
- background: var(--viking-accent-soft);
3580
- color: var(--viking-accent-strong);
3581
- }
3582
-
3583
- .suite-header__user-text {
3584
- display: none;
3585
- max-width: var(--viking-space-16);
3586
- overflow: hidden;
3587
- color: var(--viking-text);
3588
- font-size: var(--viking-font-size-sm);
3589
- font-weight: var(--viking-font-weight-semibold);
3590
- line-height: var(--viking-line-height-tight);
3591
- text-overflow: ellipsis;
3592
- white-space: nowrap;
3593
- }
3594
-
3595
- .suite-header__menu {
3596
- position: absolute;
3597
- inset-block-start: calc(100% + var(--viking-space-1));
3598
- inset-inline-end: 0;
3599
- display: none;
3600
- min-width: var(--viking-space-24);
3601
- padding: var(--viking-space-1);
3602
- background: var(--viking-surface);
3603
- border: var(--viking-border-width, 1px) solid var(--viking-border-strong);
3604
- border-radius: var(--viking-radius);
3605
- box-shadow: var(--viking-shadow-lg);
3606
- }
3607
-
3608
- .suite-header__user[data-open='true'] .suite-header__menu {
3609
- display: grid;
3610
- gap: var(--viking-space-half);
3611
- }
3612
-
3613
- .suite-header__menu-label {
3614
- padding: var(--viking-space-1);
3615
- color: var(--viking-text-muted);
3616
- font-size: var(--viking-font-size-xs);
3617
- line-height: var(--viking-line-height-tight);
3618
- }
3619
-
3620
- .suite-header__menu-label strong {
3621
- display: block;
3622
- color: var(--viking-text);
3623
- font-size: var(--viking-font-size-sm);
3624
- }
3625
-
3626
- .suite-header__menu-link,
3627
- .suite-header__menu-button {
3628
- display: inline-flex;
3629
- align-items: center;
3630
- justify-content: flex-start;
3631
- gap: var(--viking-space-1);
3632
- width: 100%;
3633
- min-height: var(--viking-control-height);
3634
- padding-inline: var(--viking-space-1);
3635
- background: transparent;
3636
- border: 0;
3637
- border-radius: var(--viking-radius-sm);
3638
- box-shadow: none;
3639
- color: var(--viking-text);
3640
- font: inherit;
3641
- text-align: start;
3642
- text-decoration: none;
3643
- }
3644
-
3645
- .suite-header__menu-link:hover,
3646
- .suite-header__menu-button:hover {
3647
- background: var(--viking-surface-alt);
3648
- }
3649
-
3650
- .suite-header__mobile {
3651
- display: none;
3652
- width: 100%;
3653
- max-width: var(--viking-container-max-width);
3654
- margin-inline: auto;
3655
- padding: 0 var(--viking-page-gutter) var(--viking-space-2);
3656
- }
3657
-
3658
- .suite-header[data-menu-open='true'] .suite-header__mobile {
3659
- display: grid;
3660
- gap: var(--viking-space-1);
3661
- }
3662
-
3663
- .suite-header__mobile .suite-header__link,
3664
- .suite-header__mobile .suite-header__auth-link,
3665
- .suite-header__mobile .suite-header__menu-button {
3666
- display: inline-flex;
3667
- justify-content: flex-start;
3668
- width: 100%;
3669
- border-radius: var(--viking-radius);
3670
- }
3671
-
3672
- .suite-header__mobile .suite-header__auth-link {
3673
- justify-content: center;
3674
- margin-block-start: var(--viking-space-1);
3675
- }
3676
-
3677
- viking-suite-command-palette {
3678
- display: contents;
3679
- }
3680
-
3681
- @media (min-width: 520px) {
3682
- .suite-header__lockup,
3683
- .suite-header__user-text {
3684
- display: inline;
3685
- }
3686
- }
3687
-
3688
- @media (min-width: 768px) {
3689
- .suite-header__bar {
3690
- padding-inline: var(--viking-page-gutter-lg);
3691
- }
3692
-
3693
- .suite-header__nav {
3694
- display: flex;
3695
- }
3696
-
3697
- .suite-header__auth-link,
3698
- .suite-header__user {
3699
- display: inline-flex;
3700
- }
3701
-
3702
- .suite-header__menu-button {
3703
- display: none;
3704
- }
3705
-
3706
- .suite-header[data-menu-open='true'] .suite-header__mobile {
3707
- display: none;
3708
- }
3709
- }
3710
- `;
3711
- var detectContext2 = () => {
3712
- const explicit = document.documentElement.getAttribute("data-deml-context");
3713
- if (explicit && VALID_CONTEXTS2.has(explicit)) {
3714
- return explicit;
3715
- }
3716
- const host = window.location.hostname;
3717
- if (host.startsWith("ui.")) {
3718
- return "docs";
3719
- }
3720
- if (host.startsWith("backend.")) {
3721
- return "backend";
3722
- }
3723
- if (host.includes("deml.app")) {
3724
- return "app";
3725
- }
3726
- return "marketing";
3727
- };
3728
- var readContext2 = (el) => {
3729
- const raw = el.getAttribute("context");
3730
- if (raw && VALID_CONTEXTS2.has(raw)) {
3731
- return raw;
3732
- }
3733
- return detectContext2();
3734
- };
3735
- var readUrls2 = (el) => {
3736
- const env = globalThis.__DEML ?? {};
3737
- return {
3738
- app: el.getAttribute("app-url") ?? env.app ?? DEFAULT_SITE_URLS.app,
3739
- marketing: el.getAttribute("marketing-url") ?? env.marketing ?? DEFAULT_SITE_URLS.marketing,
3740
- backend: el.getAttribute("backend-url") ?? env.backend ?? DEFAULT_SITE_URLS.backend
3741
- };
3742
- };
3743
- var isCurrentHref = (href) => {
3744
- try {
3745
- const url = new URL(href, window.location.origin);
3746
- return url.origin === window.location.origin && url.pathname === window.location.pathname;
3747
- } catch {
3748
- return false;
3749
- }
3750
- };
3751
- var VikingSuiteHeaderWc = class extends HTMLElementBase {
3752
- static tag = "viking-suite-header";
3753
- static get observedAttributes() {
3754
- return [
3755
- "context",
3756
- "app-url",
3757
- "marketing-url",
3758
- "backend-url",
3759
- "authenticated",
3760
- "user-name",
3761
- "user-email",
3762
- "sign-in-href",
3763
- "dashboard-href"
3764
- ];
3765
- }
3766
- shadow;
3767
- menuOpen = false;
3768
- userMenuOpen = false;
3769
- paletteEl = null;
3770
- constructor() {
3771
- super();
3772
- this.shadow = this.attachShadow({ mode: "open" });
3773
- attachShadowStyles(this.shadow, VIKING_SUITE_HEADER_STYLES);
3774
- }
3775
- connectedCallback() {
3776
- registerVikingThemeToggleWc();
3777
- registerVikingSuiteSearchPaletteWc();
3778
- this.render();
3779
- document.addEventListener("click", this.onDocumentClick);
3780
- }
3781
- disconnectedCallback() {
3782
- document.removeEventListener("click", this.onDocumentClick);
3783
- }
3784
- attributeChangedCallback() {
3785
- if (this.isConnected) {
3786
- this.render();
3787
- }
3788
- }
3789
- openSearch() {
3790
- this.paletteEl?.openPalette();
3791
- this.dispatchEvent(
3792
- new CustomEvent("viking-search-open", { bubbles: true, composed: true })
3793
- );
3794
- }
3795
- onDocumentClick = (event) => {
3796
- if (event.composedPath().includes(this)) {
3797
- return;
3798
- }
3799
- if (this.menuOpen || this.userMenuOpen) {
3800
- this.menuOpen = false;
3801
- this.userMenuOpen = false;
3802
- this.syncOpenState();
3803
- }
3804
- };
3805
- onSearchClick = () => {
3806
- this.openSearch();
3807
- };
3808
- onMenuClick = () => {
3809
- this.menuOpen = !this.menuOpen;
3810
- this.syncOpenState();
3811
- };
3812
- onUserClick = () => {
3813
- this.userMenuOpen = !this.userMenuOpen;
3814
- this.syncOpenState();
3815
- };
3816
- onSignInClick = (event) => {
3817
- const signInEvent = new CustomEvent("viking-sign-in", {
3818
- bubbles: true,
3819
- cancelable: true,
3820
- composed: true,
3821
- detail: event
3822
- });
3823
- this.dispatchEvent(signInEvent);
3824
- if (signInEvent.defaultPrevented) {
3825
- event.preventDefault();
3826
- }
3827
- };
3828
- onSignOutClick = () => {
3829
- this.userMenuOpen = false;
3830
- this.menuOpen = false;
3831
- this.syncOpenState();
3832
- this.dispatchEvent(
3833
- new CustomEvent("viking-sign-out", { bubbles: true, composed: true })
3834
- );
3835
- };
3836
- syncOpenState() {
3837
- const header = this.shadow.querySelector(".suite-header");
3838
- const menuButton = this.shadow.querySelector("[data-menu-toggle]");
3839
- const user = this.shadow.querySelector(".suite-header__user");
3840
- const userButton = this.shadow.querySelector("[data-user-toggle]");
3841
- header?.setAttribute("data-menu-open", String(this.menuOpen));
3842
- menuButton?.setAttribute("aria-expanded", String(this.menuOpen));
3843
- user?.setAttribute("data-open", String(this.userMenuOpen));
3844
- userButton?.setAttribute("aria-expanded", String(this.userMenuOpen));
3845
- }
3846
- renderNavLinks(context, urls, authenticated) {
3847
- return visibleNavLinks(SITE_NAV_LINKS, authenticated).map((link) => {
3848
- const href = resolveNavHref(link, context, urls);
3849
- const current = isCurrentHref(href) ? ' aria-current="page"' : "";
3850
- return `
3851
- <a class="suite-header__link" href="${escapeHtml(href)}"${current}>
3852
- ${renderInlineIcon(link.icon, 16, "suite-header__link-icon")}
3853
- <span>${escapeHtml(link.label)}</span>
3854
- </a>
3855
- `;
3856
- }).join("");
3857
- }
3858
- renderAuth(urls, authenticated, mobile = false) {
3859
- if (!authenticated) {
3860
- const signInHref = this.getAttribute("sign-in-href") ?? `${urls.app}/login`;
3861
- return `
3862
- <a class="suite-header__auth-link" href="${escapeHtml(signInHref)}" data-sign-in>
3863
- <span>Sign In</span>
3864
- ${renderInlineIcon("arrow-right", 16, "suite-header__auth-icon")}
3865
- </a>
3866
- `;
3867
- }
3868
- if (mobile) {
3869
- return `
3870
- <a class="suite-header__menu-link" href="${escapeHtml(this.getDashboardHref(urls))}">
3871
- ${renderInlineIcon("home", 16, "suite-header__menu-icon")}
3872
- <span>Dashboard</span>
3873
- </a>
3874
- <button class="suite-header__menu-button" type="button" data-sign-out>
3875
- ${renderInlineIcon("log-out", 16, "suite-header__menu-icon")}
3876
- <span>Sign Out</span>
3877
- </button>
3878
- `;
3879
- }
3880
- const userName = this.getAttribute("user-name") ?? "Account";
3881
- const userEmail = this.getAttribute("user-email") ?? "";
3882
- return `
3883
- <div class="suite-header__user" data-open="${String(this.userMenuOpen)}">
3884
- <button
3885
- class="suite-header__user-trigger"
3886
- type="button"
3887
- aria-haspopup="menu"
3888
- aria-expanded="${String(this.userMenuOpen)}"
3889
- data-user-toggle
3890
- >
3891
- <span class="suite-header__avatar" aria-hidden="true">
3892
- ${renderInlineIcon("user", 16, "suite-header__avatar-icon")}
3893
- </span>
3894
- <span class="suite-header__user-text">${escapeHtml(userName)}</span>
3895
- ${renderInlineIcon("chevron-down", 16, "suite-header__chevron")}
3896
- </button>
3897
- <div class="suite-header__menu" role="menu">
3898
- <div class="suite-header__menu-label">
3899
- <strong>${escapeHtml(userName)}</strong>
3900
- ${userEmail ? `<span>${escapeHtml(userEmail)}</span>` : ""}
3901
- </div>
3902
- <a class="suite-header__menu-link" role="menuitem" href="${escapeHtml(
3903
- this.getDashboardHref(urls)
3904
- )}">
3905
- ${renderInlineIcon("home", 16, "suite-header__menu-icon")}
3906
- <span>Dashboard</span>
3907
- </a>
3908
- <button class="suite-header__menu-button" type="button" role="menuitem" data-sign-out>
3909
- ${renderInlineIcon("log-out", 16, "suite-header__menu-icon")}
3910
- <span>Sign Out</span>
3911
- </button>
3912
- </div>
3913
- </div>
3914
- `;
3915
- }
3916
- getDashboardHref(urls) {
3917
- return this.getAttribute("dashboard-href") ?? `${urls.app}/dashboard`;
3918
- }
3919
- render() {
3920
- const context = readContext2(this);
3921
- const urls = readUrls2(this);
3922
- const authenticated = readBoolAttr(this, "authenticated");
3923
- const navLinks = this.renderNavLinks(context, urls, authenticated);
3924
- const brandHref = resolveBrandHref(context, urls);
3925
- const shortcut = `${modKeyLabel()}K`;
3926
- this.shadow.innerHTML = `
3927
- <header class="suite-header" data-menu-open="${String(this.menuOpen)}">
3928
- <div class="suite-header__bar">
3929
- <a class="suite-header__brand" href="${escapeHtml(
3930
- brandHref
3931
- )}" aria-label="Data Engineering for Machine Learning home">
3932
- <span class="suite-header__mark" aria-hidden="true">
3933
- ${renderInlineIcon("drakkar", 28, "suite-header__brand-icon")}
3934
- </span>
3935
- <span class="suite-header__lockup">DEML</span>
3936
- </a>
3937
-
3938
- <nav class="suite-header__nav" aria-label="Main navigation">
3939
- ${navLinks}
3940
- </nav>
3941
-
3942
- <div class="suite-header__actions">
3943
- <button
3944
- class="suite-header__icon-button"
3945
- type="button"
3946
- aria-label="Open command palette (${shortcut})"
3947
- title="Open command palette (${shortcut})"
3948
- data-search-trigger
3949
- >
3950
- ${renderInlineIcon("search", 18, "suite-header__action-icon")}
3951
- </button>
3952
- ${this.renderAuth(urls, authenticated)}
3953
- <viking-theme-toggle-wc></viking-theme-toggle-wc>
3954
- <button
3955
- class="suite-header__menu-button"
3956
- type="button"
3957
- aria-label="Toggle navigation menu"
3958
- aria-expanded="${String(this.menuOpen)}"
3959
- data-menu-toggle
3960
- >
3961
- ${renderInlineIcon(this.menuOpen ? "x" : "menu", 18, "suite-header__action-icon")}
3962
- </button>
3963
- </div>
3964
- </div>
3965
-
3966
- <nav class="suite-header__mobile" aria-label="Mobile navigation">
3967
- ${navLinks}
3968
- ${this.renderAuth(urls, authenticated, true)}
3969
- </nav>
3970
- </header>
3971
- <viking-suite-command-palette
3972
- context="${context}"
3973
- app-url="${escapeHtml(urls.app)}"
3974
- marketing-url="${escapeHtml(urls.marketing)}"
3975
- backend-url="${escapeHtml(urls.backend)}"
3976
- global-shortcut
3977
- ></viking-suite-command-palette>
3978
- `;
3979
- this.paletteEl = this.shadow.querySelector("viking-suite-command-palette");
3980
- this.shadow.querySelector("[data-search-trigger]")?.addEventListener("click", this.onSearchClick);
3981
- this.shadow.querySelector("[data-menu-toggle]")?.addEventListener("click", this.onMenuClick);
3982
- this.shadow.querySelector("[data-user-toggle]")?.addEventListener("click", this.onUserClick);
3983
- this.shadow.querySelectorAll("[data-sign-in]").forEach(
3984
- (control) => control.addEventListener("click", this.onSignInClick)
3985
- );
3986
- this.shadow.querySelectorAll("[data-sign-out]").forEach(
3987
- (control) => control.addEventListener("click", this.onSignOutClick)
3988
- );
3989
- }
3990
- };
3991
- var registerVikingSuiteHeaderWc = () => {
3992
- defineCustomElement(VikingSuiteHeaderWc.tag, VikingSuiteHeaderWc);
3993
- };
3994
-
3995
- // src/web/select/viking-select-wc.ts
3996
- var VikingSelectWc = class extends HTMLElementBase {
3997
- static formAssociated = true;
3998
- static tag = "viking-select";
3999
- static legacyTag = "viking-select-wc";
4000
- static get observedAttributes() {
4001
- return [
4002
- "label",
4003
- "name",
4004
- "value",
4005
- "placeholder",
4006
- "description",
4007
- "error",
4008
- "width",
4009
- "disabled",
4010
- "required"
4011
- ];
4012
- }
4013
- shadow;
4014
- internals;
4015
- selectEl = null;
4016
- optionObserver = null;
4017
- controlId = vikingWcUid("viking-select");
4018
- constructor() {
4019
- super();
4020
- this.shadow = this.attachShadow({ mode: "open" });
4021
- this.internals = attachElementInternals(this);
4022
- attachShadowStyles(this.shadow, VIKING_SELECT_STYLES);
4023
- }
4024
- connectedCallback() {
4025
- this.render();
4026
- this.syncOptions();
4027
- this.observeOptions();
4028
- this.selectEl?.addEventListener("change", this.onChange);
4029
- }
4030
- disconnectedCallback() {
4031
- this.selectEl?.removeEventListener("change", this.onChange);
4032
- this.optionObserver?.disconnect();
4033
- this.optionObserver = null;
4034
- }
4035
- attributeChangedCallback(name) {
4036
- if (!this.isConnected) {
4037
- return;
4038
- }
4039
- if (name === "value" && this.selectEl) {
4040
- this.selectEl.value = this.getAttribute("value") ?? "";
4041
- this.syncFormValue();
4042
- return;
4043
- }
4044
- if (name === "error" || name === "description" || name === "label") {
4045
- this.render();
4046
- this.syncOptions();
4047
- return;
4048
- }
4049
- this.render();
4050
- this.syncOptions();
4051
- }
4052
- get value() {
4053
- return this.selectEl?.value ?? this.getAttribute("value") ?? "";
4054
- }
4055
- set value(next) {
4056
- this.setAttribute("value", next);
4057
- if (this.selectEl) {
4058
- this.selectEl.value = next;
4059
- }
4060
- this.syncFormValue();
4061
- }
4062
- onChange = () => {
4063
- const value = this.selectEl?.value ?? "";
4064
- this.setAttribute("value", value);
4065
- this.syncFormValue();
4066
- this.dispatchEvent(
4067
- new CustomEvent("viking-change", {
4068
- bubbles: true,
4069
- composed: true,
4070
- detail: { value }
4071
- })
4072
- );
4073
- };
4074
- syncFormValue() {
4075
- setFormValue(this.internals, this.value);
4076
- }
4077
- observeOptions() {
4078
- this.optionObserver?.disconnect();
4079
- this.optionObserver = new MutationObserver(() => this.syncOptions());
4080
- this.optionObserver.observe(this, {
4081
- childList: true,
4082
- subtree: true,
4083
- characterData: true
4084
- });
4085
- }
4086
- render() {
4087
- const label = this.getAttribute("label") ?? "";
4088
- const name = this.getAttribute("name") ?? "";
4089
- const disabled = this.hasAttribute("disabled");
4090
- const required = this.hasAttribute("required");
4091
- const error = this.getAttribute("error") ?? "";
4092
- const description = this.getAttribute("description") ?? "";
4093
- const describedBy = [
4094
- description && `${this.controlId}-desc`,
4095
- error && `${this.controlId}-error`
4096
- ].filter(Boolean).join(" ");
4097
- this.shadow.innerHTML = `
4098
- <div class="viking-field" part="field">
4099
- ${label ? `<label class="viking-field-label" part="label" for="${this.controlId}">${escapeHtml(label)}</label>` : ""}
4100
- <select
4101
- id="${this.controlId}"
4102
- class="viking-select-native"
4103
- part="control"
4104
- ${name ? `name="${escapeHtml(name)}"` : ""}
4105
- ${disabled ? "disabled" : ""}
4106
- ${required ? "required" : ""}
4107
- ${error ? 'aria-invalid="true"' : ""}
4108
- ${describedBy ? `aria-describedby="${describedBy}"` : ""}
4109
- ></select>
4110
- ${description ? `<p id="${this.controlId}-desc" class="viking-field-description" part="description">${escapeHtml(description)}</p>` : ""}
4111
- ${error ? `<p id="${this.controlId}-error" class="viking-field-error" part="error" role="alert">${escapeHtml(error)}</p>` : ""}
4112
- </div>
4113
- `;
4114
- this.selectEl = this.shadow.querySelector("select");
4115
- const value = this.getAttribute("value");
4116
- if (this.selectEl && value) {
4117
- this.selectEl.value = value;
4118
- }
4119
- this.syncFormValue();
4120
- }
4121
- syncOptions() {
4122
- if (!this.selectEl) {
4123
- return;
4124
- }
4125
- const currentValue = this.selectEl.value;
4126
- this.selectEl.innerHTML = "";
4127
- const options = this.querySelectorAll("option");
4128
- if (options.length === 0) {
4129
- const placeholder = this.getAttribute("placeholder") ?? "Select\u2026";
4130
- const opt = document.createElement("option");
4131
- opt.value = "";
4132
- opt.textContent = placeholder;
4133
- opt.disabled = true;
4134
- opt.selected = !this.getAttribute("value");
4135
- this.selectEl.append(opt);
4136
- return;
4137
- }
4138
- options.forEach((opt) => {
4139
- this.selectEl?.append(opt.cloneNode(true));
4140
- });
4141
- const value = this.getAttribute("value");
4142
- if (value) {
4143
- this.selectEl.value = value;
4144
- } else if (currentValue) {
4145
- this.selectEl.value = currentValue;
4146
- }
4147
- this.syncFormValue();
4148
- }
4149
- };
4150
- var registerVikingSelectWc = () => {
4151
- defineCustomElement(VikingSelectWc.tag, VikingSelectWc);
4152
- defineCustomElementAlias(VikingSelectWc.legacyTag, VikingSelectWc);
4153
- };
4154
-
4155
- // src/web/index.ts
4156
- var registerVikingElements = () => {
4157
- registerVikingButtonWc();
4158
- registerVikingFieldWc();
4159
- registerVikingInputWc();
4160
- registerVikingBadgeWc();
4161
- registerVikingCalloutWc();
4162
- registerVikingCardWc();
4163
- registerVikingSelectWc();
4164
- registerVikingModalWc();
4165
- registerVikingSearchPaletteWc();
4166
- registerVikingSuiteHeaderWc();
4167
- registerVikingSuiteSearchPaletteWc();
4168
- registerVikingThemeToggleWc();
4169
- };
4170
- if (typeof globalThis !== "undefined" && typeof document !== "undefined") {
4171
- if (document.readyState === "loading") {
4172
- document.addEventListener("DOMContentLoaded", registerVikingElements);
4173
- } else {
4174
- registerVikingElements();
4175
- }
4176
- }
4177
- export {
4178
- VikingBadgeWc,
4179
- VikingButtonWc,
4180
- VikingCalloutWc,
4181
- VikingCardWc,
4182
- VikingFieldWc,
4183
- VikingInputWc,
4184
- VikingModalWc,
4185
- VikingSearchPaletteWc,
4186
- VikingSelectWc,
4187
- VikingSuiteHeaderWc,
4188
- VikingSuiteSearchPaletteWc,
4189
- VikingThemeToggleWc,
4190
- registerVikingBadgeWc,
4191
- registerVikingButtonWc,
4192
- registerVikingCalloutWc,
4193
- registerVikingCardWc,
4194
- registerVikingElements,
4195
- registerVikingFieldWc,
4196
- registerVikingInputWc,
4197
- registerVikingModalWc,
4198
- registerVikingSearchPaletteWc,
4199
- registerVikingSelectWc,
4200
- registerVikingSuiteHeaderWc,
4201
- registerVikingSuiteSearchPaletteWc,
4202
- registerVikingThemeToggleWc
4203
- };