@hypoth-ui/wc 0.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.
Files changed (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +60 -0
  3. package/dist/button-MKQKTC5Q.js +10 -0
  4. package/dist/button-MKQKTC5Q.js.map +1 -0
  5. package/dist/chunk-4HLM6DBG.js +910 -0
  6. package/dist/chunk-4HLM6DBG.js.map +1 -0
  7. package/dist/chunk-55ID7LJL.js +3602 -0
  8. package/dist/chunk-55ID7LJL.js.map +1 -0
  9. package/dist/chunk-66HFYJD7.js +86 -0
  10. package/dist/chunk-66HFYJD7.js.map +1 -0
  11. package/dist/chunk-CZOXIJVS.js +70 -0
  12. package/dist/chunk-CZOXIJVS.js.map +1 -0
  13. package/dist/chunk-DHUM4Q5Y.js +495 -0
  14. package/dist/chunk-DHUM4Q5Y.js.map +1 -0
  15. package/dist/chunk-DNNI5BDE.js +1842 -0
  16. package/dist/chunk-DNNI5BDE.js.map +1 -0
  17. package/dist/chunk-GXKZ6E6K.js +99 -0
  18. package/dist/chunk-GXKZ6E6K.js.map +1 -0
  19. package/dist/chunk-H4GJJZ3N.js +51 -0
  20. package/dist/chunk-H4GJJZ3N.js.map +1 -0
  21. package/dist/chunk-JMPTFALJ.js +175 -0
  22. package/dist/chunk-JMPTFALJ.js.map +1 -0
  23. package/dist/chunk-MYQWCLUJ.js +45 -0
  24. package/dist/chunk-MYQWCLUJ.js.map +1 -0
  25. package/dist/chunk-QZSPWT7L.js +183 -0
  26. package/dist/chunk-QZSPWT7L.js.map +1 -0
  27. package/dist/chunk-TSKBQCTR.js +5137 -0
  28. package/dist/chunk-TSKBQCTR.js.map +1 -0
  29. package/dist/chunk-TXIIUVL3.js +130 -0
  30. package/dist/chunk-TXIIUVL3.js.map +1 -0
  31. package/dist/chunk-UM7WRO7W.js +237 -0
  32. package/dist/chunk-UM7WRO7W.js.map +1 -0
  33. package/dist/chunk-VPXL4RB3.js +202 -0
  34. package/dist/chunk-VPXL4RB3.js.map +1 -0
  35. package/dist/chunk-VX5CKSMN.js +39 -0
  36. package/dist/chunk-VX5CKSMN.js.map +1 -0
  37. package/dist/chunk-WQ5BEP3E.js +2845 -0
  38. package/dist/chunk-WQ5BEP3E.js.map +1 -0
  39. package/dist/chunk-YDQ434UH.js +60 -0
  40. package/dist/chunk-YDQ434UH.js.map +1 -0
  41. package/dist/chunk-ZWV4VI6D.js +153 -0
  42. package/dist/chunk-ZWV4VI6D.js.map +1 -0
  43. package/dist/core.d.ts +127 -0
  44. package/dist/core.js +38 -0
  45. package/dist/core.js.map +1 -0
  46. package/dist/data-display.d.ts +872 -0
  47. package/dist/data-display.js +57 -0
  48. package/dist/data-display.js.map +1 -0
  49. package/dist/ds-element-Db0LMfxI.d.ts +43 -0
  50. package/dist/feedback.d.ts +292 -0
  51. package/dist/feedback.js +31 -0
  52. package/dist/feedback.js.map +1 -0
  53. package/dist/form-controls.d.ts +1713 -0
  54. package/dist/form-controls.js +63 -0
  55. package/dist/form-controls.js.map +1 -0
  56. package/dist/icon-7IZTJ5WT.js +8 -0
  57. package/dist/icon-7IZTJ5WT.js.map +1 -0
  58. package/dist/index.d.ts +15 -0
  59. package/dist/index.js +423 -0
  60. package/dist/index.js.map +1 -0
  61. package/dist/input-LB6UR37A.js +10 -0
  62. package/dist/input-LB6UR37A.js.map +1 -0
  63. package/dist/layout.d.ts +504 -0
  64. package/dist/layout.js +34 -0
  65. package/dist/layout.js.map +1 -0
  66. package/dist/link-NHDJ6SFY.js +9 -0
  67. package/dist/link-NHDJ6SFY.js.map +1 -0
  68. package/dist/navigation.d.ts +255 -0
  69. package/dist/navigation.js +111 -0
  70. package/dist/navigation.js.map +1 -0
  71. package/dist/overlays.d.ts +1291 -0
  72. package/dist/overlays.js +106 -0
  73. package/dist/overlays.js.map +1 -0
  74. package/dist/primitives.d.ts +230 -0
  75. package/dist/primitives.js +26 -0
  76. package/dist/primitives.js.map +1 -0
  77. package/dist/registry-Bns0t11H.d.ts +233 -0
  78. package/dist/skeleton-MUdd2029.d.ts +109 -0
  79. package/dist/spinner-BWaNlc-Y.d.ts +45 -0
  80. package/dist/spinner-UIYDUVBZ.js +8 -0
  81. package/dist/spinner-UIYDUVBZ.js.map +1 -0
  82. package/dist/stepper-CCRwcQOe.d.ts +851 -0
  83. package/dist/text-MT3S3EMU.js +8 -0
  84. package/dist/text-MT3S3EMU.js.map +1 -0
  85. package/dist/visually-hidden-MW2XY4CS.js +8 -0
  86. package/dist/visually-hidden-MW2XY4CS.js.map +1 -0
  87. package/package.json +92 -0
@@ -0,0 +1,86 @@
1
+ // src/registry/registry.ts
2
+ var registry = /* @__PURE__ */ new Map();
3
+ function initializeRegistry() {
4
+ registry.set("ds-button", {
5
+ loader: async () => {
6
+ const mod = await import("./button-MKQKTC5Q.js");
7
+ return mod.DsButton;
8
+ }
9
+ });
10
+ registry.set("ds-input", {
11
+ loader: async () => {
12
+ const mod = await import("./input-LB6UR37A.js");
13
+ return mod.DsInput;
14
+ }
15
+ });
16
+ registry.set("ds-link", {
17
+ loader: async () => {
18
+ const mod = await import("./link-NHDJ6SFY.js");
19
+ return mod.DsLink;
20
+ }
21
+ });
22
+ registry.set("ds-text", {
23
+ loader: async () => {
24
+ const mod = await import("./text-MT3S3EMU.js");
25
+ return mod.DsText;
26
+ }
27
+ });
28
+ registry.set("ds-icon", {
29
+ loader: async () => {
30
+ const mod = await import("./icon-7IZTJ5WT.js");
31
+ return mod.DsIcon;
32
+ }
33
+ });
34
+ registry.set("ds-spinner", {
35
+ loader: async () => {
36
+ const mod = await import("./spinner-UIYDUVBZ.js");
37
+ return mod.DsSpinner;
38
+ }
39
+ });
40
+ registry.set("ds-visually-hidden", {
41
+ loader: async () => {
42
+ const mod = await import("./visually-hidden-MW2XY4CS.js");
43
+ return mod.DsVisuallyHidden;
44
+ }
45
+ });
46
+ }
47
+ initializeRegistry();
48
+ function getRegisteredTags() {
49
+ return Array.from(registry.keys());
50
+ }
51
+ async function getComponentClass(tagName) {
52
+ const entry = registry.get(tagName);
53
+ if (!entry) return void 0;
54
+ if (entry.class) return entry.class;
55
+ if (entry.loader) {
56
+ const result = await entry.loader();
57
+ const componentClass = "default" in result ? result.default : result;
58
+ entry.class = componentClass;
59
+ return entry.class;
60
+ }
61
+ return void 0;
62
+ }
63
+ function getComponentClassSync(tagName) {
64
+ const entry = registry.get(tagName);
65
+ return entry?.class;
66
+ }
67
+ function registerComponent(tagName, componentClass) {
68
+ registry.set(tagName, { class: componentClass });
69
+ }
70
+ function hasComponent(tagName) {
71
+ return registry.has(tagName);
72
+ }
73
+ async function loadAllComponents() {
74
+ const tags = getRegisteredTags();
75
+ await Promise.all(tags.map((tag) => getComponentClass(tag)));
76
+ }
77
+
78
+ export {
79
+ getRegisteredTags,
80
+ getComponentClass,
81
+ getComponentClassSync,
82
+ registerComponent,
83
+ hasComponent,
84
+ loadAllComponents
85
+ };
86
+ //# sourceMappingURL=chunk-66HFYJD7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/registry/registry.ts"],"sourcesContent":["/**\n * Component Registry - Centralized mapping of tag names to component classes.\n *\n * This registry is the single source of truth for all design system component registrations.\n * Components do NOT self-register; instead, the loader uses this registry to register\n * components when the application starts.\n */\n\nimport type { DsButton } from \"../components/button/button.js\";\nimport type { DsIcon } from \"../components/icon/icon.js\";\nimport type { DsInput } from \"../components/input/input.js\";\nimport type { DsLink } from \"../components/link/link.js\";\nimport type { DsSpinner } from \"../components/spinner/spinner.js\";\nimport type { DsText } from \"../components/text/text.js\";\nimport type { DsVisuallyHidden } from \"../components/visually-hidden/visually-hidden.js\";\n\n/**\n * Custom element constructor type\n */\nexport type CustomElementConstructor = new (...args: unknown[]) => HTMLElement;\n\n/**\n * Component registry type - maps tag names to component classes\n */\nexport type ComponentRegistryType = Record<string, CustomElementConstructor>;\n\n/**\n * Valid component tag names in the design system\n */\nexport type ComponentTag =\n | \"ds-button\"\n | \"ds-input\"\n | \"ds-link\"\n | \"ds-text\"\n | \"ds-icon\"\n | \"ds-spinner\"\n | \"ds-visually-hidden\";\n\n/**\n * Lazy loader type for dynamic imports\n */\ntype ComponentLoader = () => Promise<\n { default: CustomElementConstructor } | CustomElementConstructor\n>;\n\n/**\n * Registry entry that supports lazy loading\n */\ninterface RegistryEntry {\n /** Component class (populated after loading) */\n class?: CustomElementConstructor;\n /** Lazy loader function */\n loader?: ComponentLoader;\n}\n\n/**\n * Internal registry storage\n */\nconst registry = new Map<string, RegistryEntry>();\n\n/**\n * Initialize the registry with component mappings.\n * This is called internally and populates the registry with all known components.\n */\nfunction initializeRegistry(): void {\n // Register components with lazy loaders for tree-shaking support\n registry.set(\"ds-button\", {\n loader: async () => {\n const mod = await import(\"../components/button/button.js\");\n return mod.DsButton;\n },\n });\n\n registry.set(\"ds-input\", {\n loader: async () => {\n const mod = await import(\"../components/input/input.js\");\n return mod.DsInput;\n },\n });\n\n registry.set(\"ds-link\", {\n loader: async () => {\n const mod = await import(\"../components/link/link.js\");\n return mod.DsLink;\n },\n });\n\n registry.set(\"ds-text\", {\n loader: async () => {\n const mod = await import(\"../components/text/text.js\");\n return mod.DsText;\n },\n });\n\n registry.set(\"ds-icon\", {\n loader: async () => {\n const mod = await import(\"../components/icon/icon.js\");\n return mod.DsIcon;\n },\n });\n\n registry.set(\"ds-spinner\", {\n loader: async () => {\n const mod = await import(\"../components/spinner/spinner.js\");\n return mod.DsSpinner;\n },\n });\n\n registry.set(\"ds-visually-hidden\", {\n loader: async () => {\n const mod = await import(\"../components/visually-hidden/visually-hidden.js\");\n return mod.DsVisuallyHidden;\n },\n });\n}\n\n// Initialize on module load\ninitializeRegistry();\n\n/**\n * Get all registered tag names.\n *\n * @returns Array of all tag names in the registry\n */\nexport function getRegisteredTags(): ComponentTag[] {\n return Array.from(registry.keys()) as ComponentTag[];\n}\n\n/**\n * Get component class by tag name.\n * If the component uses lazy loading, this will trigger the load.\n *\n * @param tagName - The custom element tag name\n * @returns Promise resolving to the component class or undefined if not found\n */\nexport async function getComponentClass(\n tagName: string\n): Promise<CustomElementConstructor | undefined> {\n const entry = registry.get(tagName);\n if (!entry) return undefined;\n\n // Return cached class if already loaded\n if (entry.class) return entry.class;\n\n // Load class if loader exists\n if (entry.loader) {\n const result = await entry.loader();\n const componentClass = \"default\" in result ? result.default : result;\n entry.class = componentClass as CustomElementConstructor;\n return entry.class;\n }\n\n return undefined;\n}\n\n/**\n * Get component class synchronously (only works for already-loaded components).\n *\n * @param tagName - The custom element tag name\n * @returns The component class or undefined if not loaded/found\n */\nexport function getComponentClassSync(tagName: string): CustomElementConstructor | undefined {\n const entry = registry.get(tagName);\n return entry?.class;\n}\n\n/**\n * Register a component class directly (for pre-loaded components).\n *\n * @param tagName - The custom element tag name\n * @param componentClass - The component class constructor\n */\nexport function registerComponent(tagName: string, componentClass: CustomElementConstructor): void {\n registry.set(tagName, { class: componentClass });\n}\n\n/**\n * Check if a tag name is in the registry.\n *\n * @param tagName - The custom element tag name\n * @returns True if the tag is registered\n */\nexport function hasComponent(tagName: string): boolean {\n return registry.has(tagName);\n}\n\n/**\n * Load all components in the registry.\n * This is useful for eager loading all components at once.\n *\n * @returns Promise that resolves when all components are loaded\n */\nexport async function loadAllComponents(): Promise<void> {\n const tags = getRegisteredTags();\n await Promise.all(tags.map((tag) => getComponentClass(tag)));\n}\n\n// Type declarations for components\ndeclare global {\n interface HTMLElementTagNameMap {\n \"ds-button\": DsButton;\n \"ds-input\": DsInput;\n \"ds-link\": DsLink;\n \"ds-text\": DsText;\n \"ds-icon\": DsIcon;\n \"ds-spinner\": DsSpinner;\n \"ds-visually-hidden\": DsVisuallyHidden;\n }\n}\n"],"mappings":";AA0DA,IAAM,WAAW,oBAAI,IAA2B;AAMhD,SAAS,qBAA2B;AAElC,WAAS,IAAI,aAAa;AAAA,IACxB,QAAQ,YAAY;AAClB,YAAM,MAAM,MAAM,OAAO,sBAAgC;AACzD,aAAO,IAAI;AAAA,IACb;AAAA,EACF,CAAC;AAED,WAAS,IAAI,YAAY;AAAA,IACvB,QAAQ,YAAY;AAClB,YAAM,MAAM,MAAM,OAAO,qBAA8B;AACvD,aAAO,IAAI;AAAA,IACb;AAAA,EACF,CAAC;AAED,WAAS,IAAI,WAAW;AAAA,IACtB,QAAQ,YAAY;AAClB,YAAM,MAAM,MAAM,OAAO,oBAA4B;AACrD,aAAO,IAAI;AAAA,IACb;AAAA,EACF,CAAC;AAED,WAAS,IAAI,WAAW;AAAA,IACtB,QAAQ,YAAY;AAClB,YAAM,MAAM,MAAM,OAAO,oBAA4B;AACrD,aAAO,IAAI;AAAA,IACb;AAAA,EACF,CAAC;AAED,WAAS,IAAI,WAAW;AAAA,IACtB,QAAQ,YAAY;AAClB,YAAM,MAAM,MAAM,OAAO,oBAA4B;AACrD,aAAO,IAAI;AAAA,IACb;AAAA,EACF,CAAC;AAED,WAAS,IAAI,cAAc;AAAA,IACzB,QAAQ,YAAY;AAClB,YAAM,MAAM,MAAM,OAAO,uBAAkC;AAC3D,aAAO,IAAI;AAAA,IACb;AAAA,EACF,CAAC;AAED,WAAS,IAAI,sBAAsB;AAAA,IACjC,QAAQ,YAAY;AAClB,YAAM,MAAM,MAAM,OAAO,+BAAkD;AAC3E,aAAO,IAAI;AAAA,IACb;AAAA,EACF,CAAC;AACH;AAGA,mBAAmB;AAOZ,SAAS,oBAAoC;AAClD,SAAO,MAAM,KAAK,SAAS,KAAK,CAAC;AACnC;AASA,eAAsB,kBACpB,SAC+C;AAC/C,QAAM,QAAQ,SAAS,IAAI,OAAO;AAClC,MAAI,CAAC,MAAO,QAAO;AAGnB,MAAI,MAAM,MAAO,QAAO,MAAM;AAG9B,MAAI,MAAM,QAAQ;AAChB,UAAM,SAAS,MAAM,MAAM,OAAO;AAClC,UAAM,iBAAiB,aAAa,SAAS,OAAO,UAAU;AAC9D,UAAM,QAAQ;AACd,WAAO,MAAM;AAAA,EACf;AAEA,SAAO;AACT;AAQO,SAAS,sBAAsB,SAAuD;AAC3F,QAAM,QAAQ,SAAS,IAAI,OAAO;AAClC,SAAO,OAAO;AAChB;AAQO,SAAS,kBAAkB,SAAiB,gBAAgD;AACjG,WAAS,IAAI,SAAS,EAAE,OAAO,eAAe,CAAC;AACjD;AAQO,SAAS,aAAa,SAA0B;AACrD,SAAO,SAAS,IAAI,OAAO;AAC7B;AAQA,eAAsB,oBAAmC;AACvD,QAAM,OAAO,kBAAkB;AAC/B,QAAM,QAAQ,IAAI,KAAK,IAAI,CAAC,QAAQ,kBAAkB,GAAG,CAAC,CAAC;AAC7D;","names":[]}
@@ -0,0 +1,70 @@
1
+ import {
2
+ DSElement,
3
+ __decorateClass,
4
+ define
5
+ } from "./chunk-H4GJJZ3N.js";
6
+
7
+ // src/components/text/text.ts
8
+ import { property } from "lit/decorators.js";
9
+ import { classMap } from "lit/directives/class-map.js";
10
+ import { html as staticHtml, unsafeStatic } from "lit/static-html.js";
11
+ var VALID_AS_VALUES = /* @__PURE__ */ new Set(["span", "p", "h1", "h2", "h3", "h4", "h5", "h6"]);
12
+ var DsText = class extends DSElement {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.size = "md";
16
+ this.weight = "normal";
17
+ this.variant = "default";
18
+ this.as = "span";
19
+ this.truncate = false;
20
+ }
21
+ static {
22
+ this.styles = [];
23
+ }
24
+ getValidAs() {
25
+ if (VALID_AS_VALUES.has(this.as)) {
26
+ return this.as;
27
+ }
28
+ console.warn(
29
+ `[ds-text] Invalid "as" value "${this.as}". Expected one of: ${Array.from(VALID_AS_VALUES).join(", ")}. Falling back to "span".`
30
+ );
31
+ return "span";
32
+ }
33
+ render() {
34
+ const validAs = this.getValidAs();
35
+ const tag = unsafeStatic(validAs);
36
+ const classes = {
37
+ "ds-text": true,
38
+ [`ds-text--${this.size}`]: true,
39
+ [`ds-text--${this.weight}`]: true,
40
+ [`ds-text--${this.variant}`]: true,
41
+ "ds-text--truncate": this.truncate
42
+ };
43
+ return staticHtml`
44
+ <${tag} class=${classMap(classes)}>
45
+ <slot></slot>
46
+ </${tag}>
47
+ `;
48
+ }
49
+ };
50
+ __decorateClass([
51
+ property({ type: String, reflect: true })
52
+ ], DsText.prototype, "size", 2);
53
+ __decorateClass([
54
+ property({ type: String, reflect: true })
55
+ ], DsText.prototype, "weight", 2);
56
+ __decorateClass([
57
+ property({ type: String, reflect: true })
58
+ ], DsText.prototype, "variant", 2);
59
+ __decorateClass([
60
+ property({ type: String, reflect: true })
61
+ ], DsText.prototype, "as", 2);
62
+ __decorateClass([
63
+ property({ type: Boolean, reflect: true })
64
+ ], DsText.prototype, "truncate", 2);
65
+ define("ds-text", DsText);
66
+
67
+ export {
68
+ DsText
69
+ };
70
+ //# sourceMappingURL=chunk-CZOXIJVS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/text/text.ts"],"sourcesContent":["import type { TemplateResult } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { html as staticHtml, unsafeStatic } from \"lit/static-html.js\";\nimport { DSElement } from \"../../base/ds-element.js\";\nimport { define } from \"../../registry/define.js\";\n\nexport type TextSize = \"xs\" | \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\";\nexport type TextWeight = \"normal\" | \"medium\" | \"semibold\" | \"bold\";\nexport type TextVariant = \"default\" | \"muted\" | \"success\" | \"warning\" | \"error\";\nexport type TextAs = \"span\" | \"p\" | \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n\nconst VALID_AS_VALUES = new Set<string>([\"span\", \"p\", \"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"]);\n\n/**\n * A typography component for consistent text styling.\n *\n * @element ds-text\n * @slot - Default slot for text content\n */\nexport class DsText extends DSElement {\n static override styles = [];\n\n /**\n * The text size.\n */\n @property({ type: String, reflect: true })\n size: TextSize = \"md\";\n\n /**\n * The font weight.\n */\n @property({ type: String, reflect: true })\n weight: TextWeight = \"normal\";\n\n /**\n * The color variant.\n */\n @property({ type: String, reflect: true })\n variant: TextVariant = \"default\";\n\n /**\n * The semantic element to render as.\n * Supports: span, p, h1-h6\n */\n @property({ type: String, reflect: true })\n as: TextAs = \"span\";\n\n /**\n * Whether to truncate text with ellipsis.\n */\n @property({ type: Boolean, reflect: true })\n truncate = false;\n\n private getValidAs(): TextAs {\n if (VALID_AS_VALUES.has(this.as)) {\n return this.as;\n }\n\n console.warn(\n `[ds-text] Invalid \"as\" value \"${this.as}\". Expected one of: ${Array.from(VALID_AS_VALUES).join(\", \")}. Falling back to \"span\".`\n );\n return \"span\";\n }\n\n override render(): TemplateResult {\n const validAs = this.getValidAs();\n const tag = unsafeStatic(validAs);\n\n const classes = {\n \"ds-text\": true,\n [`ds-text--${this.size}`]: true,\n [`ds-text--${this.weight}`]: true,\n [`ds-text--${this.variant}`]: true,\n \"ds-text--truncate\": this.truncate,\n };\n\n return staticHtml`\n <${tag} class=${classMap(classes)}>\n <slot></slot>\n </${tag}>\n `;\n }\n}\n\n// Register the component\ndefine(\"ds-text\", DsText);\n\n// TypeScript declaration for HTML\ndeclare global {\n interface HTMLElementTagNameMap {\n \"ds-text\": DsText;\n }\n}\n"],"mappings":";;;;;;;AACA,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,QAAQ,YAAY,oBAAoB;AASjD,IAAM,kBAAkB,oBAAI,IAAY,CAAC,QAAQ,KAAK,MAAM,MAAM,MAAM,MAAM,MAAM,IAAI,CAAC;AAQlF,IAAM,SAAN,cAAqB,UAAU;AAAA,EAA/B;AAAA;AAOL,gBAAiB;AAMjB,kBAAqB;AAMrB,mBAAuB;AAOvB,cAAa;AAMb,oBAAW;AAAA;AAAA,EA/BX;AAAA,SAAgB,SAAS,CAAC;AAAA;AAAA,EAiClB,aAAqB;AAC3B,QAAI,gBAAgB,IAAI,KAAK,EAAE,GAAG;AAChC,aAAO,KAAK;AAAA,IACd;AAEA,YAAQ;AAAA,MACN,iCAAiC,KAAK,EAAE,uBAAuB,MAAM,KAAK,eAAe,EAAE,KAAK,IAAI,CAAC;AAAA,IACvG;AACA,WAAO;AAAA,EACT;AAAA,EAES,SAAyB;AAChC,UAAM,UAAU,KAAK,WAAW;AAChC,UAAM,MAAM,aAAa,OAAO;AAEhC,UAAM,UAAU;AAAA,MACd,WAAW;AAAA,MACX,CAAC,YAAY,KAAK,IAAI,EAAE,GAAG;AAAA,MAC3B,CAAC,YAAY,KAAK,MAAM,EAAE,GAAG;AAAA,MAC7B,CAAC,YAAY,KAAK,OAAO,EAAE,GAAG;AAAA,MAC9B,qBAAqB,KAAK;AAAA,IAC5B;AAEA,WAAO;AAAA,SACF,GAAG,UAAU,SAAS,OAAO,CAAC;AAAA;AAAA,UAE7B,GAAG;AAAA;AAAA,EAEX;AACF;AAxDE;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GAN9B,OAOX;AAMA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GAZ9B,OAaX;AAMA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GAlB9B,OAmBX;AAOA;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GAzB9B,OA0BX;AAMA;AAAA,EADC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GA/B/B,OAgCX;AAkCF,OAAO,WAAW,MAAM;","names":[]}
@@ -0,0 +1,495 @@
1
+ import {
2
+ emitEvent
3
+ } from "./chunk-YDQ434UH.js";
4
+ import {
5
+ DSElement,
6
+ __decorateClass,
7
+ define
8
+ } from "./chunk-H4GJJZ3N.js";
9
+
10
+ // src/components/alert/alert.ts
11
+ import { html, nothing } from "lit";
12
+ import { property } from "lit/decorators.js";
13
+ import { classMap } from "lit/directives/class-map.js";
14
+ var VARIANT_ICONS = {
15
+ info: html`<svg class="ds-alert__icon" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
16
+ <path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z" clip-rule="evenodd" />
17
+ </svg>`,
18
+ success: html`<svg class="ds-alert__icon" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
19
+ <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd" />
20
+ </svg>`,
21
+ warning: html`<svg class="ds-alert__icon" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
22
+ <path fill-rule="evenodd" d="M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd" />
23
+ </svg>`,
24
+ error: html`<svg class="ds-alert__icon" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
25
+ <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" clip-rule="evenodd" />
26
+ </svg>`
27
+ };
28
+ var CLOSE_ICON = html`<svg class="ds-alert__close-icon" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
29
+ <path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" />
30
+ </svg>`;
31
+ var DsAlert = class extends DSElement {
32
+ constructor() {
33
+ super(...arguments);
34
+ this.variant = "info";
35
+ this.alertTitle = "";
36
+ this.closable = false;
37
+ this.hideIcon = false;
38
+ }
39
+ static {
40
+ this.styles = [];
41
+ }
42
+ handleClose() {
43
+ emitEvent(this, "ds:close", {});
44
+ }
45
+ handleKeyDown(event) {
46
+ if (event.key === "Escape" && this.closable) {
47
+ this.handleClose();
48
+ }
49
+ }
50
+ /**
51
+ * Get the ARIA role based on variant.
52
+ * Error and warning use 'alert' for immediate announcement.
53
+ * Info and success use 'status' for polite announcement.
54
+ */
55
+ getRole() {
56
+ return this.variant === "error" || this.variant === "warning" ? "alert" : "status";
57
+ }
58
+ render() {
59
+ const classes = {
60
+ "ds-alert": true
61
+ };
62
+ return html`
63
+ <div
64
+ part="alert"
65
+ class=${classMap(classes)}
66
+ role=${this.getRole()}
67
+ aria-live=${this.getRole() === "alert" ? "assertive" : "polite"}
68
+ data-variant=${this.variant}
69
+ ?data-closable=${this.closable}
70
+ @keydown=${this.handleKeyDown}
71
+ >
72
+ ${!this.hideIcon ? html`
73
+ <slot name="icon">
74
+ ${VARIANT_ICONS[this.variant]}
75
+ </slot>
76
+ ` : nothing}
77
+
78
+ <div part="content" class="ds-alert__content">
79
+ ${this.alertTitle ? html`<p part="title" class="ds-alert__title">${this.alertTitle}</p>` : nothing}
80
+
81
+ <div part="description" class="ds-alert__description">
82
+ <slot></slot>
83
+ </div>
84
+
85
+ <slot name="action" class="ds-alert__action"></slot>
86
+ </div>
87
+
88
+ ${this.closable ? html`
89
+ <button
90
+ part="close"
91
+ class="ds-alert__close"
92
+ type="button"
93
+ aria-label="Dismiss alert"
94
+ @click=${this.handleClose}
95
+ >
96
+ ${CLOSE_ICON}
97
+ </button>
98
+ ` : nothing}
99
+ </div>
100
+ `;
101
+ }
102
+ };
103
+ __decorateClass([
104
+ property({ type: String, reflect: true })
105
+ ], DsAlert.prototype, "variant", 2);
106
+ __decorateClass([
107
+ property({ type: String })
108
+ ], DsAlert.prototype, "alertTitle", 2);
109
+ __decorateClass([
110
+ property({ type: Boolean, reflect: true })
111
+ ], DsAlert.prototype, "closable", 2);
112
+ __decorateClass([
113
+ property({ type: Boolean, attribute: "hide-icon" })
114
+ ], DsAlert.prototype, "hideIcon", 2);
115
+ define("ds-alert", DsAlert);
116
+
117
+ // src/components/toast/toast.ts
118
+ import { html as html2, nothing as nothing2 } from "lit";
119
+ import { property as property2, state } from "lit/decorators.js";
120
+ import { classMap as classMap2 } from "lit/directives/class-map.js";
121
+ var VARIANT_ICONS2 = {
122
+ info: html2`<svg class="ds-toast__icon" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
123
+ <path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z" clip-rule="evenodd" />
124
+ </svg>`,
125
+ success: html2`<svg class="ds-toast__icon" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
126
+ <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd" />
127
+ </svg>`,
128
+ warning: html2`<svg class="ds-toast__icon" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
129
+ <path fill-rule="evenodd" d="M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd" />
130
+ </svg>`,
131
+ error: html2`<svg class="ds-toast__icon" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
132
+ <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" clip-rule="evenodd" />
133
+ </svg>`
134
+ };
135
+ var CLOSE_ICON2 = html2`<svg class="ds-toast__close-icon" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
136
+ <path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" />
137
+ </svg>`;
138
+ var DsToast = class extends DSElement {
139
+ constructor() {
140
+ super(...arguments);
141
+ this.toastId = "";
142
+ this.toastTitle = "";
143
+ this.description = "";
144
+ this.variant = "info";
145
+ this.toastState = "entering";
146
+ this.duration = 5e3;
147
+ this.hideIcon = false;
148
+ this.isPaused = false;
149
+ }
150
+ static {
151
+ this.styles = [];
152
+ }
153
+ handleDismiss() {
154
+ emitEvent(this, "dismiss", { detail: { id: this.toastId } });
155
+ }
156
+ handleMouseEnter() {
157
+ this.isPaused = true;
158
+ emitEvent(this, "pause", { detail: { id: this.toastId } });
159
+ }
160
+ handleMouseLeave() {
161
+ this.isPaused = false;
162
+ emitEvent(this, "resume", { detail: { id: this.toastId } });
163
+ }
164
+ render() {
165
+ const classes = {
166
+ "ds-toast": true
167
+ };
168
+ return html2`
169
+ <div
170
+ class=${classMap2(classes)}
171
+ role="status"
172
+ aria-live="polite"
173
+ aria-atomic="true"
174
+ data-variant=${this.variant}
175
+ data-state=${this.toastState}
176
+ @mouseenter=${this.handleMouseEnter}
177
+ @mouseleave=${this.handleMouseLeave}
178
+ >
179
+ ${!this.hideIcon ? VARIANT_ICONS2[this.variant] : nothing2}
180
+
181
+ <div class="ds-toast__content">
182
+ <p class="ds-toast__title">${this.toastTitle}</p>
183
+ ${this.description ? html2`<p class="ds-toast__description">${this.description}</p>` : nothing2}
184
+ <slot name="action" class="ds-toast__action"></slot>
185
+ </div>
186
+
187
+ <button
188
+ class="ds-toast__close"
189
+ type="button"
190
+ aria-label="Dismiss notification"
191
+ @click=${this.handleDismiss}
192
+ >
193
+ ${CLOSE_ICON2}
194
+ </button>
195
+
196
+ ${this.duration > 0 ? html2`
197
+ <div class="ds-toast__progress">
198
+ <div
199
+ class="ds-toast__progress-bar"
200
+ style="animation: ds-toast-progress ${this.duration}ms linear forwards; animation-play-state: ${this.isPaused ? "paused" : "running"}"
201
+ ></div>
202
+ </div>
203
+ ` : nothing2}
204
+ </div>
205
+ `;
206
+ }
207
+ };
208
+ __decorateClass([
209
+ property2({ type: String, reflect: true })
210
+ ], DsToast.prototype, "toastId", 2);
211
+ __decorateClass([
212
+ property2({ type: String })
213
+ ], DsToast.prototype, "toastTitle", 2);
214
+ __decorateClass([
215
+ property2({ type: String })
216
+ ], DsToast.prototype, "description", 2);
217
+ __decorateClass([
218
+ property2({ type: String, reflect: true })
219
+ ], DsToast.prototype, "variant", 2);
220
+ __decorateClass([
221
+ property2({ type: String, reflect: true })
222
+ ], DsToast.prototype, "toastState", 2);
223
+ __decorateClass([
224
+ property2({ type: Number })
225
+ ], DsToast.prototype, "duration", 2);
226
+ __decorateClass([
227
+ property2({ type: Boolean, attribute: "hide-icon" })
228
+ ], DsToast.prototype, "hideIcon", 2);
229
+ __decorateClass([
230
+ state()
231
+ ], DsToast.prototype, "isPaused", 2);
232
+ define("ds-toast", DsToast);
233
+
234
+ // src/components/toast/toast-controller.ts
235
+ var toastIdCounter = 0;
236
+ function generateId() {
237
+ return `toast-${++toastIdCounter}-${Date.now()}`;
238
+ }
239
+ var ToastController = class {
240
+ constructor(options = {}) {
241
+ this.toasts = [];
242
+ this.options = {
243
+ maxToasts: options.maxToasts ?? 5,
244
+ defaultDuration: options.defaultDuration ?? 5e3,
245
+ position: options.position ?? "top-right",
246
+ onUpdate: options.onUpdate ?? (() => {
247
+ })
248
+ };
249
+ }
250
+ /**
251
+ * Show a new toast
252
+ */
253
+ show(options) {
254
+ const id = generateId();
255
+ const duration = options.duration ?? this.options.defaultDuration;
256
+ const toast = {
257
+ id,
258
+ title: options.title,
259
+ description: options.description,
260
+ variant: options.variant ?? "info",
261
+ duration,
262
+ action: options.action,
263
+ state: "entering",
264
+ createdAt: Date.now()
265
+ };
266
+ this.toasts = [toast, ...this.toasts];
267
+ if (this.toasts.length > this.options.maxToasts) {
268
+ const toRemove = this.toasts.slice(this.options.maxToasts);
269
+ for (const t of toRemove) {
270
+ this.dismiss(t.id);
271
+ }
272
+ this.toasts = this.toasts.slice(0, this.options.maxToasts);
273
+ }
274
+ setTimeout(() => {
275
+ this.updateState(id, "visible");
276
+ }, 200);
277
+ if (duration > 0) {
278
+ toast.timerId = setTimeout(() => {
279
+ this.dismiss(id);
280
+ }, duration);
281
+ }
282
+ this.notify();
283
+ return id;
284
+ }
285
+ /**
286
+ * Dismiss a toast by ID
287
+ */
288
+ dismiss(id) {
289
+ const toast = this.toasts.find((t) => t.id === id);
290
+ if (!toast || toast.state === "exiting" || toast.state === "dismissed") {
291
+ return;
292
+ }
293
+ if (toast.timerId) {
294
+ clearTimeout(toast.timerId);
295
+ }
296
+ this.updateState(id, "exiting");
297
+ setTimeout(() => {
298
+ this.toasts = this.toasts.filter((t) => t.id !== id);
299
+ this.notify();
300
+ }, 150);
301
+ }
302
+ /**
303
+ * Dismiss all toasts
304
+ */
305
+ dismissAll() {
306
+ const ids = this.toasts.map((t) => t.id);
307
+ for (const id of ids) {
308
+ this.dismiss(id);
309
+ }
310
+ }
311
+ /**
312
+ * Pause auto-dismiss for a toast (e.g., on hover)
313
+ */
314
+ pause(id) {
315
+ const toast = this.toasts.find((t) => t.id === id);
316
+ if (toast?.timerId) {
317
+ clearTimeout(toast.timerId);
318
+ toast.timerId = void 0;
319
+ }
320
+ }
321
+ /**
322
+ * Resume auto-dismiss for a toast
323
+ */
324
+ resume(id) {
325
+ const toast = this.toasts.find((t) => t.id === id);
326
+ if (toast?.duration && toast.duration > 0 && toast.state === "visible") {
327
+ const elapsed = Date.now() - toast.createdAt;
328
+ const remaining = Math.max(toast.duration - elapsed, 1e3);
329
+ toast.timerId = setTimeout(() => {
330
+ this.dismiss(id);
331
+ }, remaining);
332
+ }
333
+ }
334
+ /**
335
+ * Get current toasts
336
+ */
337
+ getToasts() {
338
+ return [...this.toasts];
339
+ }
340
+ /**
341
+ * Get controller options
342
+ */
343
+ getOptions() {
344
+ return { ...this.options };
345
+ }
346
+ /**
347
+ * Update controller options
348
+ */
349
+ setOptions(options) {
350
+ this.options = { ...this.options, ...options };
351
+ }
352
+ updateState(id, state3) {
353
+ const toast = this.toasts.find((t) => t.id === id);
354
+ if (toast) {
355
+ toast.state = state3;
356
+ this.notify();
357
+ }
358
+ }
359
+ notify() {
360
+ this.options.onUpdate(this.getToasts());
361
+ }
362
+ };
363
+ var globalController = null;
364
+ function getGlobalToastController() {
365
+ if (!globalController) {
366
+ globalController = new ToastController();
367
+ }
368
+ return globalController;
369
+ }
370
+ function setGlobalToastController(controller) {
371
+ globalController = controller;
372
+ }
373
+ function dsToast(options) {
374
+ return getGlobalToastController().show(options);
375
+ }
376
+ if (typeof window !== "undefined") {
377
+ window.dsToast = dsToast;
378
+ }
379
+
380
+ // src/components/toast/toast-provider.ts
381
+ import { html as html3 } from "lit";
382
+ import { property as property3, state as state2 } from "lit/decorators.js";
383
+ import { repeat } from "lit/directives/repeat.js";
384
+ var DsToastProvider = class extends DSElement {
385
+ constructor() {
386
+ super(...arguments);
387
+ this.position = "top-right";
388
+ this.max = 5;
389
+ this.duration = 5e3;
390
+ this.toasts = [];
391
+ }
392
+ static {
393
+ this.styles = [];
394
+ }
395
+ connectedCallback() {
396
+ super.connectedCallback();
397
+ this.controller = new ToastController({
398
+ maxToasts: this.max,
399
+ defaultDuration: this.duration,
400
+ position: this.position,
401
+ onUpdate: (toasts) => {
402
+ this.toasts = toasts;
403
+ }
404
+ });
405
+ setGlobalToastController(this.controller);
406
+ }
407
+ updated(changedProperties) {
408
+ super.updated(changedProperties);
409
+ if (changedProperties.has("max") || changedProperties.has("duration") || changedProperties.has("position")) {
410
+ this.controller.setOptions({
411
+ maxToasts: this.max,
412
+ defaultDuration: this.duration,
413
+ position: this.position
414
+ });
415
+ }
416
+ }
417
+ handleDismiss(event) {
418
+ this.controller.dismiss(event.detail.id);
419
+ }
420
+ handlePause(event) {
421
+ this.controller.pause(event.detail.id);
422
+ }
423
+ handleResume(event) {
424
+ this.controller.resume(event.detail.id);
425
+ }
426
+ handleActionClick(toast) {
427
+ toast.action?.onClick();
428
+ this.controller.dismiss(toast.id);
429
+ }
430
+ render() {
431
+ return html3`
432
+ <slot></slot>
433
+
434
+ <div
435
+ class="ds-toast-viewport"
436
+ data-position=${this.position}
437
+ role="region"
438
+ aria-label="Notifications"
439
+ aria-live="polite"
440
+ >
441
+ ${repeat(
442
+ this.toasts,
443
+ (toast) => toast.id,
444
+ (toast) => html3`
445
+ <ds-toast
446
+ .toastId=${toast.id}
447
+ .toastTitle=${toast.title}
448
+ .description=${toast.description ?? ""}
449
+ .variant=${toast.variant ?? "info"}
450
+ .toastState=${toast.state}
451
+ .duration=${toast.duration ?? 0}
452
+ @ds:dismiss=${this.handleDismiss}
453
+ @ds:pause=${this.handlePause}
454
+ @ds:resume=${this.handleResume}
455
+ >
456
+ ${toast.action ? html3`
457
+ <button
458
+ slot="action"
459
+ class="ds-button ds-button--sm ds-button--ghost"
460
+ @click=${() => this.handleActionClick(toast)}
461
+ >
462
+ ${toast.action.label}
463
+ </button>
464
+ ` : null}
465
+ </ds-toast>
466
+ `
467
+ )}
468
+ </div>
469
+ `;
470
+ }
471
+ };
472
+ __decorateClass([
473
+ property3({ type: String, reflect: true })
474
+ ], DsToastProvider.prototype, "position", 2);
475
+ __decorateClass([
476
+ property3({ type: Number })
477
+ ], DsToastProvider.prototype, "max", 2);
478
+ __decorateClass([
479
+ property3({ type: Number })
480
+ ], DsToastProvider.prototype, "duration", 2);
481
+ __decorateClass([
482
+ state2()
483
+ ], DsToastProvider.prototype, "toasts", 2);
484
+ define("ds-toast-provider", DsToastProvider);
485
+
486
+ export {
487
+ DsAlert,
488
+ DsToast,
489
+ ToastController,
490
+ getGlobalToastController,
491
+ setGlobalToastController,
492
+ dsToast,
493
+ DsToastProvider
494
+ };
495
+ //# sourceMappingURL=chunk-DHUM4Q5Y.js.map