@dataengineeringformachinelearning/viking-ui 4.0.4 → 4.0.6

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.
Files changed (246) hide show
  1. package/README.md +35 -11
  2. package/dist/README.md +35 -11
  3. package/dist/design-tokens.css +300 -85
  4. package/dist/fesm2022/dataengineeringformachinelearning-viking-ui.mjs +100 -64
  5. package/dist/fesm2022/dataengineeringformachinelearning-viking-ui.mjs.map +1 -1
  6. package/dist/icons.js +306 -0
  7. package/dist/package.json +24 -5
  8. package/{src/lib/site-drakkar/site-drakkar.config.ts → dist/site-drakkar.js} +64 -130
  9. package/dist/src/tokens/viking-tokens.json +9 -7
  10. package/dist/types/dataengineeringformachinelearning-viking-ui.d.ts +97 -3
  11. package/dist/viking-components.css +161 -70
  12. package/dist/viking-tokens.json +9 -7
  13. package/dist/viking-ui-elements.js +44 -32
  14. package/dist/viking-ui.css +1 -1
  15. package/dist/web-components.js +44 -32
  16. package/package.json +30 -8
  17. package/dist/scripts/build-web-components.mjs +0 -37
  18. package/dist/src/web/badge/viking-badge-wc.ts +0 -116
  19. package/dist/src/web/button/viking-button-wc.ts +0 -165
  20. package/dist/src/web/callout/viking-callout-wc.ts +0 -105
  21. package/dist/src/web/card/viking-card-wc.ts +0 -67
  22. package/dist/src/web/core/base.ts +0 -56
  23. package/dist/src/web/core/dom.ts +0 -53
  24. package/dist/src/web/core/icons-inline.ts +0 -44
  25. package/dist/src/web/core/styles.ts +0 -1261
  26. package/dist/src/web/core/types.ts +0 -19
  27. package/dist/src/web/field/viking-field-wc.ts +0 -154
  28. package/dist/src/web/index.ts +0 -73
  29. package/dist/src/web/input/viking-input-wc.ts +0 -211
  30. package/dist/src/web/modal/viking-modal-wc.ts +0 -187
  31. package/dist/src/web/search-palette/viking-search-palette-wc.ts +0 -495
  32. package/dist/src/web/select/viking-select-wc.ts +0 -218
  33. package/dist/src/web/suite-header/viking-suite-header-wc.ts +0 -729
  34. package/dist/src/web/suite-search-palette/viking-suite-search-palette-wc.ts +0 -234
  35. package/dist/src/web/theme-toggle/viking-theme-toggle-wc.ts +0 -139
  36. package/dist/src/web/types.ts +0 -37
  37. package/dist/src/web/web-components.spec.ts +0 -297
  38. package/src/assets/drakkar-favicon.svg +0 -17
  39. package/src/assets/fonts/inter/InterVariable-Italic.woff2 +0 -0
  40. package/src/assets/fonts/inter/InterVariable.woff2 +0 -0
  41. package/src/core/brand/deml-lockup.svg +0 -5
  42. package/src/core/brand/deml-mark-compact.svg +0 -4
  43. package/src/core/brand/deml-mark-filled.svg +0 -3
  44. package/src/core/brand/deml-mark-outline.svg +0 -4
  45. package/src/core/brand-icons.ts +0 -62
  46. package/src/core/icons.spec.ts +0 -52
  47. package/src/core/icons.ts +0 -206
  48. package/src/core/integration-brand-icons.ts +0 -77
  49. package/src/core/lucide-paths.generated.ts +0 -130
  50. package/src/core/types.ts +0 -85
  51. package/src/core/uid.ts +0 -7
  52. package/src/elements/button/viking-button.ts +0 -201
  53. package/src/elements/card/viking-card.ts +0 -60
  54. package/src/elements/core/dom.ts +0 -33
  55. package/src/elements/core/styles.ts +0 -28
  56. package/src/elements/modal/viking-modal.ts +0 -154
  57. package/src/index.ts +0 -1
  58. package/src/lib/accordion/accordion.ts +0 -126
  59. package/src/lib/app-header/app-header.scss +0 -274
  60. package/src/lib/app-header/app-header.ts +0 -43
  61. package/src/lib/app-sidebar/app-sidebar.scss +0 -415
  62. package/src/lib/app-sidebar/app-sidebar.ts +0 -29
  63. package/src/lib/auth-panel/auth-panel.spec.ts +0 -132
  64. package/src/lib/auth-panel/auth-panel.ts +0 -228
  65. package/src/lib/autocomplete/autocomplete.ts +0 -223
  66. package/src/lib/avatar/avatar.ts +0 -126
  67. package/src/lib/badge/badge.ts +0 -182
  68. package/src/lib/bar/bar.ts +0 -31
  69. package/src/lib/brand/brand.ts +0 -60
  70. package/src/lib/breadcrumbs/breadcrumbs.ts +0 -81
  71. package/src/lib/button/button-group.ts +0 -40
  72. package/src/lib/button/button.scss +0 -119
  73. package/src/lib/button/button.ts +0 -98
  74. package/src/lib/calendar/calendar.ts +0 -253
  75. package/src/lib/callout/callout.ts +0 -211
  76. package/src/lib/card/card-title.spec.ts +0 -27
  77. package/src/lib/card/card-title.ts +0 -50
  78. package/src/lib/card/card.ts +0 -200
  79. package/src/lib/carousel/carousel.ts +0 -206
  80. package/src/lib/chart/chart-zoom.spec.ts +0 -65
  81. package/src/lib/chart/chart-zoom.ts +0 -71
  82. package/src/lib/chart/chart.ts +0 -1257
  83. package/src/lib/chart-card-header/chart-card-header.ts +0 -80
  84. package/src/lib/chart-empty-state/chart-empty-state.ts +0 -146
  85. package/src/lib/chart-panel/chart-panel.ts +0 -133
  86. package/src/lib/checkbox/checkbox.ts +0 -139
  87. package/src/lib/color-picker/color-picker.ts +0 -148
  88. package/src/lib/command/command.ts +0 -260
  89. package/src/lib/composer/composer.ts +0 -180
  90. package/src/lib/confirm-dialog/confirm-dialog.ts +0 -163
  91. package/src/lib/confirm-dialog/dialog.service.ts +0 -79
  92. package/src/lib/context/context.ts +0 -75
  93. package/src/lib/core/brand-icons.ts +0 -62
  94. package/src/lib/core/cva.ts +0 -33
  95. package/src/lib/core/icons.ts +0 -206
  96. package/src/lib/core/integration-brand-icons.ts +0 -77
  97. package/src/lib/core/lucide-paths.generated.ts +0 -130
  98. package/src/lib/date-picker/date-picker.ts +0 -139
  99. package/src/lib/dropdown/dropdown.ts +0 -188
  100. package/src/lib/editor/editor.ts +0 -170
  101. package/src/lib/empty-state/empty-state.ts +0 -100
  102. package/src/lib/fab/fab.ts +0 -76
  103. package/src/lib/field/field.ts +0 -111
  104. package/src/lib/file-upload/file-upload.ts +0 -208
  105. package/src/lib/footer/footer.scss +0 -162
  106. package/src/lib/footer/footer.ts +0 -28
  107. package/src/lib/form-section/form-section.ts +0 -200
  108. package/src/lib/forms.spec.ts +0 -92
  109. package/src/lib/gauge-arc/gauge-arc.ts +0 -85
  110. package/src/lib/hud-panel/hud-panel.ts +0 -27
  111. package/src/lib/icon/icon.ts +0 -284
  112. package/src/lib/icon-badge/icon-badge.ts +0 -87
  113. package/src/lib/icon-heading/icon-heading.spec.ts +0 -32
  114. package/src/lib/icon-heading/icon-heading.ts +0 -38
  115. package/src/lib/icon-text/icon-text.ts +0 -120
  116. package/src/lib/input/input.ts +0 -119
  117. package/src/lib/kanban/kanban.ts +0 -211
  118. package/src/lib/kbd/kbd.ts +0 -32
  119. package/src/lib/label/label.ts +0 -39
  120. package/src/lib/loading-overlay/loading-overlay.ts +0 -80
  121. package/src/lib/menubar/menubar.ts +0 -77
  122. package/src/lib/metric-card/metric-card.ts +0 -33
  123. package/src/lib/modal/modal.ts +0 -207
  124. package/src/lib/native-select/native-select.ts +0 -124
  125. package/src/lib/navbar/navbar.ts +0 -124
  126. package/src/lib/navigation-menu/navigation-menu.ts +0 -116
  127. package/src/lib/otp-input/otp-input.ts +0 -164
  128. package/src/lib/page-back-link/page-back-link.ts +0 -74
  129. package/src/lib/page-header/page-header.ts +0 -70
  130. package/src/lib/pagination/pagination.ts +0 -157
  131. package/src/lib/pillbox/pillbox.ts +0 -157
  132. package/src/lib/popover/popover.ts +0 -92
  133. package/src/lib/profile/profile.ts +0 -73
  134. package/src/lib/progress/progress.ts +0 -123
  135. package/src/lib/radio/radio.ts +0 -132
  136. package/src/lib/ring-gauge/ring-gauge.ts +0 -75
  137. package/src/lib/scroll-area/scroll-area.ts +0 -57
  138. package/src/lib/search-palette/search-palette.scss +0 -288
  139. package/src/lib/search-palette/search-palette.ts +0 -114
  140. package/src/lib/select/select.ts +0 -292
  141. package/src/lib/separator/separator.ts +0 -59
  142. package/src/lib/sheet/sheet.ts +0 -192
  143. package/src/lib/sidebar-nav/sidebar-nav.scss +0 -218
  144. package/src/lib/sidebar-nav/sidebar-nav.ts +0 -158
  145. package/src/lib/site-drakkar/site-footer.ts +0 -133
  146. package/src/lib/site-drakkar/site-navbar.scss +0 -2
  147. package/src/lib/site-drakkar/site-navbar.ts +0 -286
  148. package/src/lib/site-drakkar/suite-search-items.spec.ts +0 -61
  149. package/src/lib/site-drakkar/suite-search-items.ts +0 -246
  150. package/src/lib/skeleton/skeleton.ts +0 -51
  151. package/src/lib/slider/slider.ts +0 -133
  152. package/src/lib/spinner/spinner.ts +0 -75
  153. package/src/lib/status-metric-row/status-metric-row.ts +0 -74
  154. package/src/lib/suite-search-palette/suite-search-palette.ts +0 -95
  155. package/src/lib/switch/switch.ts +0 -131
  156. package/src/lib/table/table.ts +0 -137
  157. package/src/lib/tabs/tab-panel.ts +0 -61
  158. package/src/lib/tabs/tab.ts +0 -107
  159. package/src/lib/tabs/tabs.ts +0 -109
  160. package/src/lib/textarea/textarea.ts +0 -103
  161. package/src/lib/theme-toggle/theme-toggle.spec.ts +0 -40
  162. package/src/lib/theme-toggle/theme-toggle.ts +0 -40
  163. package/src/lib/time-picker/time-picker.ts +0 -197
  164. package/src/lib/timeline/timeline.ts +0 -152
  165. package/src/lib/toast/toast.ts +0 -196
  166. package/src/lib/toggle/toggle-group.ts +0 -60
  167. package/src/lib/toggle/toggle.ts +0 -101
  168. package/src/lib/tooltip/tooltip.ts +0 -119
  169. package/src/lib/typography/heading.ts +0 -52
  170. package/src/lib/typography/text.ts +0 -51
  171. package/src/lib/uptime-bar/uptime-bar.ts +0 -55
  172. package/src/lib/verification-code-field/verification-code-field.ts +0 -149
  173. package/src/lib/whitepaper-cta/whitepaper-cta.scss +0 -130
  174. package/src/lib/whitepaper-cta/whitepaper-cta.ts +0 -78
  175. package/src/lib/wizard/wizard.ts +0 -80
  176. package/src/public-api.ts +0 -172
  177. package/src/styles/_buttons.scss +0 -386
  178. package/src/styles/_component-primitives.scss +0 -183
  179. package/src/styles/_drakkar-buttons.scss +0 -85
  180. package/src/styles/_fonts.scss +0 -22
  181. package/src/styles/_forms.scss +0 -66
  182. package/src/styles/_input.scss +0 -106
  183. package/src/styles/_layout-enforcement.scss +0 -229
  184. package/src/styles/_layout-rhythm.scss +0 -158
  185. package/src/styles/_legacy-aliases.scss +0 -212
  186. package/src/styles/_series-colors.scss +0 -24
  187. package/src/styles/_static-primitives.scss +0 -857
  188. package/src/styles/_typography.scss +0 -87
  189. package/src/styles/_variables.scss +0 -527
  190. package/src/styles/components/a11y.scss +0 -90
  191. package/src/styles/components/badges.scss +0 -102
  192. package/src/styles/components/extracted-utilities.scss +0 -459
  193. package/src/styles/components/footer.scss +0 -168
  194. package/src/styles/components/icon-heading.scss +0 -47
  195. package/src/styles/components/icon-inline.scss +0 -101
  196. package/src/styles/components/layout.scss +0 -59
  197. package/src/styles/components/utilities.scss +0 -131
  198. package/src/styles/components/viking-inspired.scss +0 -204
  199. package/src/styles/components/whitepaper-cta.scss +0 -130
  200. package/src/styles/components-bundle.scss +0 -9
  201. package/src/styles/components.scss +0 -442
  202. package/src/styles/deml-components.scss +0 -10
  203. package/src/styles/index.scss +0 -8
  204. package/src/styles/layout-shell.scss +0 -111
  205. package/src/styles/page-shell.scss +0 -859
  206. package/src/styles/static-navbar.scss +0 -1250
  207. package/src/styles/surfaces/backend.scss +0 -154
  208. package/src/styles/surfaces/docs-global.scss +0 -73
  209. package/src/styles/surfaces/docs-shell.scss +0 -437
  210. package/src/styles/surfaces/docs-showcase.scss +0 -1153
  211. package/src/styles/surfaces/marketing-cta.scss +0 -62
  212. package/src/styles/surfaces/marketing-docs-bento.scss +0 -67
  213. package/src/styles/surfaces/marketing-global.scss +0 -748
  214. package/src/styles/surfaces/marketing-landing.scss +0 -1526
  215. package/src/styles/surfaces/marketing-publication.scss +0 -535
  216. package/src/styles/surfaces/marketing-theme.scss +0 -14
  217. package/src/styles/surfaces/swagger-ui.scss +0 -1013
  218. package/src/styles/tokens-export.scss +0 -18
  219. package/src/styles/tokens.scss +0 -5
  220. package/src/styles/viking-ui-bundle.scss +0 -23
  221. package/src/styles/viking-ui.scss +0 -272
  222. package/src/tokens/series-presets.ts +0 -15
  223. package/src/tokens/tailwind.preset.js +0 -209
  224. package/src/tokens/viking-tokens.json +0 -318
  225. package/src/viking-ui.spec.ts +0 -416
  226. package/src/web/badge/viking-badge-wc.ts +0 -116
  227. package/src/web/button/viking-button-wc.ts +0 -165
  228. package/src/web/callout/viking-callout-wc.ts +0 -105
  229. package/src/web/card/viking-card-wc.ts +0 -67
  230. package/src/web/core/base.ts +0 -56
  231. package/src/web/core/dom.ts +0 -53
  232. package/src/web/core/icons-inline.ts +0 -44
  233. package/src/web/core/styles.ts +0 -1261
  234. package/src/web/core/types.ts +0 -19
  235. package/src/web/field/viking-field-wc.ts +0 -154
  236. package/src/web/index.ts +0 -73
  237. package/src/web/input/viking-input-wc.ts +0 -211
  238. package/src/web/modal/viking-modal-wc.ts +0 -187
  239. package/src/web/search-palette/viking-search-palette-wc.ts +0 -495
  240. package/src/web/select/viking-select-wc.ts +0 -218
  241. package/src/web/suite-header/viking-suite-header-wc.ts +0 -729
  242. package/src/web/suite-search-palette/viking-suite-search-palette-wc.ts +0 -234
  243. package/src/web/theme-toggle/viking-theme-toggle-wc.ts +0 -139
  244. package/src/web/types.ts +0 -37
  245. package/src/web/web-components.spec.ts +0 -297
  246. package/src/web-components/index.ts +0 -1
@@ -1,105 +0,0 @@
1
- import { attachShadowStyles } from "../core/base";
2
- import {
3
- defineCustomElement,
4
- defineCustomElementAlias,
5
- escapeHtml,
6
- HTMLElementBase,
7
- } from "../core/dom";
8
- import { renderInlineIcon, TONE_ICON_NAMES } from "../core/icons-inline";
9
- import { VIKING_CALLOUT_STYLES } from "../core/styles";
10
- import type { VikingWcTone } from "../core/types";
11
-
12
- const TONES = new Set<VikingWcTone>([
13
- "accent",
14
- "secondary",
15
- "success",
16
- "warning",
17
- "danger",
18
- "info",
19
- "muted",
20
- ]);
21
-
22
- /**
23
- * Framework-agnostic Viking callout Web Component.
24
- * Tag: `viking-callout` (legacy alias: `viking-callout-wc`)
25
- *
26
- * @attr tone - Semantic tone (default: info)
27
- * @attr heading - Bold callout title
28
- * @attr icon - Override leading icon from the Viking registry
29
- * @attr dismissible - Shows dismiss control; dispatches `viking-close`
30
- *
31
- * @example
32
- * <viking-callout-wc tone="warning" heading="Degraded worker">Lag exceeds 3s.</viking-callout-wc>
33
- */
34
- export class VikingCalloutWc extends HTMLElementBase {
35
- static readonly tag = "viking-callout";
36
- static readonly legacyTag = "viking-callout-wc";
37
-
38
- static get observedAttributes(): string[] {
39
- return ["tone", "heading", "icon", "dismissible", "hidden"];
40
- }
41
-
42
- private readonly shadow: ShadowRoot;
43
-
44
- constructor() {
45
- super();
46
- this.shadow = this.attachShadow({ mode: "open" });
47
- attachShadowStyles(this.shadow, VIKING_CALLOUT_STYLES);
48
- }
49
-
50
- connectedCallback(): void {
51
- this.render();
52
- }
53
-
54
- attributeChangedCallback(): void {
55
- if (this.isConnected) {
56
- this.render();
57
- }
58
- }
59
-
60
- private get tone(): VikingWcTone {
61
- const value = (this.getAttribute("tone") ?? "info") as VikingWcTone;
62
- return TONES.has(value) ? value : "info";
63
- }
64
-
65
- private get dismissible(): boolean {
66
- return (
67
- this.hasAttribute("dismissible") &&
68
- this.getAttribute("dismissible") !== "false"
69
- );
70
- }
71
-
72
- private readonly onDismiss = (): void => {
73
- this.setAttribute("hidden", "");
74
- this.dispatchEvent(
75
- new CustomEvent("viking-close", { bubbles: true, composed: true }),
76
- );
77
- };
78
-
79
- private render(): void {
80
- const heading = this.getAttribute("heading") ?? "";
81
- const iconName =
82
- this.getAttribute("icon") ?? TONE_ICON_NAMES[this.tone] ?? "info";
83
- const iconMarkup = renderInlineIcon(iconName, 22, "viking-callout-icon");
84
-
85
- this.shadow.innerHTML = `
86
- <div class="viking-callout viking-callout-${this.tone}" role="note" part="surface">
87
- <span part="icon">${iconMarkup}</span>
88
- <div class="viking-callout-body" part="body">
89
- ${heading ? `<p class="viking-callout-heading" part="heading">${escapeHtml(heading)}</p>` : ""}
90
- <div class="viking-callout-text" part="text"><slot></slot></div>
91
- </div>
92
- ${this.dismissible ? `<button type="button" class="viking-callout-close" part="close" aria-label="Dismiss">${renderInlineIcon("x", 18)}</button>` : ""}
93
- </div>
94
- `;
95
-
96
- this.shadow
97
- .querySelector(".viking-callout-close")
98
- ?.addEventListener("click", this.onDismiss);
99
- }
100
- }
101
-
102
- export const registerVikingCalloutWc = (): void => {
103
- defineCustomElement(VikingCalloutWc.tag, VikingCalloutWc);
104
- defineCustomElementAlias(VikingCalloutWc.legacyTag, VikingCalloutWc);
105
- };
@@ -1,67 +0,0 @@
1
- import {
2
- defineCustomElement,
3
- defineCustomElementAlias,
4
- HTMLElementBase,
5
- } from "../core/dom";
6
-
7
- /**
8
- * Framework-agnostic Viking card Web Component (light DOM — inherits global viking-card CSS).
9
- * Tag: `viking-card` (legacy alias: `viking-card-wc`)
10
- *
11
- * Uses light DOM so slotted content inherits `viking-card`, `viking-card-header`, and related
12
- * classes from the synced static CSS bundle.
13
- *
14
- * @attr compact - Applies `viking-card-compact` padding
15
- * @attr interactive - Hover lift for clickable cards
16
- * @attr title - Accessible name when the card is a landmark region
17
- *
18
- * @example
19
- * <viking-card-wc compact title="Event throughput">
20
- * <div class="viking-card-header">
21
- * <h3 class="viking-heading viking-heading-sm">Event throughput</h3>
22
- * </div>
23
- * <p class="viking-text-muted">8.2K events/sec</p>
24
- * </viking-card-wc>
25
- */
26
- export class VikingCardWc extends HTMLElementBase {
27
- static readonly tag = "viking-card";
28
- static readonly legacyTag = "viking-card-wc";
29
-
30
- static get observedAttributes(): string[] {
31
- return ["compact", "interactive", "title", "loading"];
32
- }
33
-
34
- connectedCallback(): void {
35
- this.syncClasses();
36
- }
37
-
38
- attributeChangedCallback(): void {
39
- if (this.isConnected) {
40
- this.syncClasses();
41
- }
42
- }
43
-
44
- private syncClasses(): void {
45
- this.classList.add("viking-card");
46
- this.classList.toggle("viking-card-compact", this.hasAttribute("compact"));
47
- this.classList.toggle(
48
- "viking-card-interactive",
49
- this.hasAttribute("interactive"),
50
- );
51
- this.classList.toggle("viking-card-loading", this.hasAttribute("loading"));
52
-
53
- const title = this.getAttribute("title");
54
- if (title) {
55
- this.setAttribute("role", "region");
56
- this.setAttribute("aria-label", title);
57
- } else {
58
- this.removeAttribute("role");
59
- this.removeAttribute("aria-label");
60
- }
61
- }
62
- }
63
-
64
- export const registerVikingCardWc = (): void => {
65
- defineCustomElement(VikingCardWc.tag, VikingCardWc);
66
- defineCustomElementAlias(VikingCardWc.legacyTag, VikingCardWc);
67
- };
@@ -1,56 +0,0 @@
1
- /** Attaches constructable stylesheet to a shadow root (with fallback). */
2
- export const attachShadowStyles = (shadow: ShadowRoot, css: string): void => {
3
- if (
4
- "adoptedStyleSheets" in Document.prototype &&
5
- "replaceSync" in CSSStyleSheet.prototype
6
- ) {
7
- const sheet = new CSSStyleSheet();
8
- sheet.replaceSync(css);
9
- shadow.adoptedStyleSheets = [sheet];
10
- return;
11
- }
12
-
13
- const style = document.createElement("style");
14
- style.textContent = css;
15
- shadow.append(style);
16
- };
17
-
18
- /** Reads a boolean attribute presence/value. */
19
- export const readBoolAttr = (el: HTMLElement, name: string): boolean =>
20
- el.hasAttribute(name) && el.getAttribute(name) !== "false";
21
-
22
- /** Safely sets form value when ElementInternals is fully supported (e.g. not in jsdom). */
23
- export const setFormValue = (
24
- internals: ElementInternals | null,
25
- value: string,
26
- ): void => {
27
- if (internals && typeof internals.setFormValue === "function") {
28
- internals.setFormValue(value);
29
- }
30
- };
31
-
32
- /** Attaches ElementInternals where available without breaking older WebKit or test DOMs. */
33
- export const attachElementInternals = (
34
- el: HTMLElement,
35
- ): ElementInternals | null => {
36
- const attachInternals = (
37
- el as HTMLElement & { attachInternals?: () => ElementInternals }
38
- ).attachInternals;
39
- return typeof attachInternals === "function"
40
- ? attachInternals.call(el)
41
- : null;
42
- };
43
-
44
- /** Opens a native dialog when showModal is available. */
45
- export const showModalDialog = (dialog: HTMLDialogElement | null): void => {
46
- if (dialog && typeof dialog.showModal === "function" && !dialog.open) {
47
- dialog.showModal();
48
- }
49
- };
50
-
51
- /** Closes a native dialog when close is available. */
52
- export const closeModalDialog = (dialog: HTMLDialogElement | null): void => {
53
- if (dialog && typeof dialog.close === "function" && dialog.open) {
54
- dialog.close();
55
- }
56
- };
@@ -1,53 +0,0 @@
1
- export const HTMLElementBase: typeof HTMLElement =
2
- typeof HTMLElement === "undefined"
3
- ? (class {} as unknown as typeof HTMLElement)
4
- : HTMLElement;
5
-
6
- /** Stable unique id for associating labels and controls. */
7
- export const vikingWcUid = (prefix: string): string =>
8
- `${prefix}-${Math.random().toString(36).slice(2, 9)}`;
9
-
10
- /** Escape text for safe innerHTML insertion. */
11
- export const escapeHtml = (value: string): string => {
12
- const entities: Record<string, string> = {
13
- "&": "&amp;",
14
- "<": "&lt;",
15
- ">": "&gt;",
16
- '"': "&quot;",
17
- "'": "&#39;",
18
- };
19
-
20
- return value.replace(
21
- /[&<>"']/g,
22
- (character) => entities[character] ?? character,
23
- );
24
- };
25
-
26
- /** Platform modifier label for keyboard shortcut hints. */
27
- export const modKeyLabel = (): string =>
28
- typeof navigator !== "undefined" &&
29
- /Mac|iPhone|iPad/i.test(navigator.platform)
30
- ? "⌘"
31
- : "Ctrl";
32
-
33
- /** Register a custom element when the runtime supports it (skip during SSR/prerender). */
34
- export const defineCustomElement = (
35
- tag: string,
36
- ctor: CustomElementConstructor,
37
- ): void => {
38
- if (typeof customElements === "undefined" || customElements.get(tag)) {
39
- return;
40
- }
41
- customElements.define(tag, ctor);
42
- };
43
-
44
- /** Register an alias tag with a fresh subclass; customElements disallows reusing constructors. */
45
- export const defineCustomElementAlias = <T extends CustomElementConstructor>(
46
- tag: string,
47
- ctor: T,
48
- ): void => {
49
- if (typeof customElements === "undefined" || customElements.get(tag)) {
50
- return;
51
- }
52
- customElements.define(tag, class extends ctor {});
53
- };
@@ -1,44 +0,0 @@
1
- import {
2
- resolveVikingIcon,
3
- VIKING_FILLED_ICON_NAMES,
4
- VIKING_ICON_FILLED_PATHS,
5
- VIKING_ICON_PATHS,
6
- type VikingIconName,
7
- } from "../../lib/core/icons";
8
-
9
- const FILLED_ICON_SET = new Set<string>(VIKING_FILLED_ICON_NAMES);
10
-
11
- /**
12
- * Renders a zero-dependency inline SVG icon for Web Components.
13
- * Uses the same registry as `viking-icon` in Angular.
14
- */
15
- export const renderInlineIcon = (
16
- name: string,
17
- size = 16,
18
- className = "viking-wc-icon",
19
- ): string => {
20
- const resolved = resolveVikingIcon(name);
21
- const filled = FILLED_ICON_SET.has(resolved);
22
- const paths = filled
23
- ? (VIKING_ICON_FILLED_PATHS[resolved as VikingIconName] ??
24
- VIKING_ICON_PATHS[resolved])
25
- : VIKING_ICON_PATHS[resolved];
26
-
27
- if (filled) {
28
- return `<svg class="${className}" width="${size}" height="${size}" viewBox="0 0 24 24" fill="currentColor" fill-rule="evenodd" aria-hidden="true">${paths}</svg>`;
29
- }
30
-
31
- 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>`;
32
- };
33
-
34
- /** Default tone → icon mapping shared by callout and badge surfaces. */
35
- export const TONE_ICON_NAMES: Record<string, string> = {
36
- accent: "info",
37
- secondary: "info",
38
- success: "check-circle",
39
- warning: "alert-triangle",
40
- danger: "alert-circle",
41
- info: "info",
42
- muted: "info",
43
- subtle: "info",
44
- };