@dataengineeringformachinelearning/viking-ui 1.0.2 → 3.0.0-alpha.2

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 (129) hide show
  1. package/README.md +180 -41
  2. package/dist/deml-components.css +1122 -0
  3. package/dist/design-tokens.css +688 -0
  4. package/dist/elements/button/viking-button.d.ts +14 -0
  5. package/dist/elements/card/viking-card.d.ts +8 -0
  6. package/dist/elements/core/dom.d.ts +4 -0
  7. package/dist/elements/core/styles.d.ts +2 -0
  8. package/dist/elements/modal/viking-modal.d.ts +15 -0
  9. package/dist/fonts/inter/InterVariable-Italic.woff2 +0 -0
  10. package/dist/fonts/inter/InterVariable.woff2 +0 -0
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.js +4051 -0
  13. package/dist/lib/core/brand-icons.d.ts +29 -0
  14. package/dist/lib/core/icons.d.ts +132 -0
  15. package/dist/lib/core/integration-brand-icons.d.ts +18 -0
  16. package/dist/lib/core/lucide-paths.generated.d.ts +90 -0
  17. package/dist/lib/site-drakkar/site-drakkar.config.d.ts +50 -0
  18. package/dist/lib/site-drakkar/suite-search-items.d.ts +17 -0
  19. package/dist/viking-components.css +1837 -0
  20. package/dist/viking-tokens.json +318 -0
  21. package/dist/viking-ui-elements.js +1750 -0
  22. package/dist/viking-ui.css +1 -0
  23. package/dist/web/badge/viking-badge-wc.d.ts +28 -0
  24. package/dist/web/button/viking-button-wc.d.ts +28 -0
  25. package/dist/web/callout/viking-callout-wc.d.ts +27 -0
  26. package/dist/web/card/viking-card-wc.d.ts +29 -0
  27. package/dist/web/core/base.d.ts +12 -0
  28. package/dist/web/core/dom.d.ts +11 -0
  29. package/dist/web/core/icons-inline.d.ts +7 -0
  30. package/dist/web/core/styles.d.ts +12 -0
  31. package/dist/web/core/types.d.ts +10 -0
  32. package/dist/web/field/viking-field-wc.d.ts +32 -0
  33. package/dist/web/index.d.ts +15 -0
  34. package/dist/web/input/viking-input-wc.d.ts +32 -0
  35. package/dist/web/modal/viking-modal-wc.d.ts +50 -0
  36. package/dist/web/search-palette/viking-search-palette-wc.d.ts +64 -0
  37. package/dist/web/select/viking-select-wc.d.ts +48 -0
  38. package/dist/web/suite-header/viking-suite-header-wc.d.ts +36 -0
  39. package/dist/web/suite-search-palette/viking-suite-search-palette-wc.d.ts +39 -0
  40. package/dist/web/theme-toggle/viking-theme-toggle-wc.d.ts +19 -0
  41. package/dist/web/types.d.ts +40 -0
  42. package/dist/web-components/index.d.ts +1 -0
  43. package/dist/web-components.js +1750 -0
  44. package/dist/widget.js +1182 -0
  45. package/package.json +89 -30
  46. package/src/assets/fonts/inter/InterVariable-Italic.woff2 +0 -0
  47. package/src/assets/fonts/inter/InterVariable.woff2 +0 -0
  48. package/src/elements/button/viking-button.ts +201 -0
  49. package/src/elements/card/viking-card.ts +60 -0
  50. package/src/elements/core/dom.ts +33 -0
  51. package/src/elements/core/styles.ts +28 -0
  52. package/src/elements/modal/viking-modal.ts +154 -0
  53. package/src/index.ts +1 -0
  54. package/src/lib/core/brand-icons.ts +62 -0
  55. package/src/lib/core/icons.ts +206 -0
  56. package/src/lib/core/integration-brand-icons.ts +77 -0
  57. package/src/lib/core/lucide-paths.generated.ts +130 -0
  58. package/src/lib/site-drakkar/site-drakkar.config.ts +295 -0
  59. package/src/lib/site-drakkar/suite-search-items.ts +246 -0
  60. package/src/styles/_buttons.scss +301 -0
  61. package/src/styles/_component-primitives.scss +183 -0
  62. package/src/styles/_drakkar-buttons.scss +85 -0
  63. package/src/styles/_fonts.scss +22 -0
  64. package/src/styles/_forms.scss +66 -0
  65. package/src/styles/_input.scss +106 -0
  66. package/src/styles/_layout-enforcement.scss +166 -0
  67. package/src/styles/_layout-rhythm.scss +158 -0
  68. package/src/styles/_legacy-aliases.scss +212 -0
  69. package/src/styles/_series-colors.scss +24 -0
  70. package/src/styles/_static-primitives.scss +857 -0
  71. package/src/styles/_typography.scss +87 -0
  72. package/src/styles/_variables.scss +527 -0
  73. package/src/styles/components/a11y.scss +90 -0
  74. package/src/styles/components/badges.scss +102 -0
  75. package/src/styles/components/extracted-utilities.scss +459 -0
  76. package/src/styles/components/footer.scss +155 -0
  77. package/src/styles/components/icon-heading.scss +47 -0
  78. package/src/styles/components/icon-inline.scss +78 -0
  79. package/src/styles/components/layout.scss +59 -0
  80. package/src/styles/components/utilities.scss +131 -0
  81. package/src/styles/components/viking-inspired.scss +204 -0
  82. package/src/styles/components/whitepaper-cta.scss +130 -0
  83. package/src/styles/components-bundle.scss +9 -0
  84. package/src/styles/components.scss +175 -0
  85. package/src/styles/deml-components.scss +10 -0
  86. package/src/styles/index.scss +8 -0
  87. package/src/styles/layout-shell.scss +39 -11
  88. package/src/styles/page-shell.scss +663 -33
  89. package/src/styles/static-navbar.scss +862 -146
  90. package/src/styles/surfaces/backend.scss +142 -0
  91. package/src/styles/surfaces/docs-global.scss +73 -0
  92. package/src/styles/surfaces/docs-shell.scss +412 -0
  93. package/src/styles/surfaces/docs-showcase.scss +1051 -0
  94. package/src/styles/surfaces/marketing-cta.scss +62 -0
  95. package/src/styles/surfaces/marketing-docs-bento.scss +67 -0
  96. package/src/styles/surfaces/marketing-global.scss +748 -0
  97. package/src/styles/surfaces/marketing-landing.scss +1260 -0
  98. package/src/styles/surfaces/marketing-publication.scss +535 -0
  99. package/src/styles/surfaces/marketing-theme.scss +14 -0
  100. package/src/styles/surfaces/swagger-ui.scss +921 -0
  101. package/src/styles/tokens-export.scss +18 -0
  102. package/src/styles/tokens.scss +5 -0
  103. package/src/styles/viking-ui-bundle.scss +20 -2
  104. package/src/styles/viking-ui.scss +213 -51
  105. package/src/tokens/viking-tokens.json +318 -0
  106. package/src/web/badge/viking-badge-wc.ts +116 -0
  107. package/src/web/button/viking-button-wc.ts +165 -0
  108. package/src/web/callout/viking-callout-wc.ts +105 -0
  109. package/src/web/card/viking-card-wc.ts +66 -0
  110. package/src/web/core/base.ts +56 -0
  111. package/src/web/core/dom.ts +53 -0
  112. package/src/web/core/icons-inline.ts +44 -0
  113. package/src/web/core/styles.ts +1138 -0
  114. package/src/web/core/types.ts +19 -0
  115. package/src/web/field/viking-field-wc.ts +154 -0
  116. package/src/web/index.ts +73 -0
  117. package/src/web/input/viking-input-wc.ts +211 -0
  118. package/src/web/modal/viking-modal-wc.ts +187 -0
  119. package/src/web/search-palette/viking-search-palette-wc.ts +494 -0
  120. package/src/web/select/viking-select-wc.ts +218 -0
  121. package/src/web/suite-header/viking-suite-header-wc.ts +714 -0
  122. package/src/web/suite-search-palette/viking-suite-search-palette-wc.ts +234 -0
  123. package/src/web/theme-toggle/viking-theme-toggle-wc.ts +139 -0
  124. package/src/web/types.ts +37 -0
  125. package/src/web-components/index.ts +1 -0
  126. package/fesm2022/dataengineeringformachinelearning-viking-ui.mjs +0 -6114
  127. package/fesm2022/dataengineeringformachinelearning-viking-ui.mjs.map +0 -1
  128. package/types/dataengineeringformachinelearning-viking-ui.d.ts +0 -1397
  129. package/viking.manifest.json +0 -238
@@ -0,0 +1,66 @@
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"];
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
+
52
+ const title = this.getAttribute("title");
53
+ if (title) {
54
+ this.setAttribute("role", "region");
55
+ this.setAttribute("aria-label", title);
56
+ } else {
57
+ this.removeAttribute("role");
58
+ this.removeAttribute("aria-label");
59
+ }
60
+ }
61
+ }
62
+
63
+ export const registerVikingCardWc = (): void => {
64
+ defineCustomElement(VikingCardWc.tag, VikingCardWc);
65
+ defineCustomElementAlias(VikingCardWc.legacyTag, VikingCardWc);
66
+ };
@@ -0,0 +1,56 @@
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
+ };
@@ -0,0 +1,53 @@
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
+ };
@@ -0,0 +1,44 @@
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
+ };