isometrik-plugin-chat-sdk 2.0.3 → 2.0.4

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.
@@ -83,10 +83,11 @@ export class ThemeProvider {
83
83
  return normalized;
84
84
  }
85
85
  render() {
86
- return (h("div", { key: 'eda588f5d70658cdbb4d2c112b87e967e26851f4', class: `theme-provider-container theme-${this.mode}` }, h("slot", { key: '1c0c507b5f4380353fb5af4332f1873eecd84d5c' })));
86
+ return (h("div", { key: '3e4ce98aeaeefa4f96aef5846aeecff68e13e63f', class: `theme-provider-container theme-${this.mode}` }, h("slot", { key: '9730319fa5c287526a00973be782ecf7db639ecc' })));
87
87
  }
88
88
  static get is() { return "theme-provider"; }
89
89
  static get encapsulation() { return "shadow"; }
90
+ static get styles() { return ":host {\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n box-sizing: border-box;\n }\n .theme-provider-container {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n min-height: 0;\n overflow: hidden;\n box-sizing: border-box;\n }"; }
90
91
  static get properties() {
91
92
  return {
92
93
  "themePath": {
@@ -1 +1 @@
1
- {"version":3,"file":"theme-provider.js","sourceRoot":"","sources":["../../src/components/theme-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAMtF,MAAM,OAAO,aAAa;;QAuBhB,iBAAY,GAAG,8BAA8B,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;;oBAhB7B,OAAO;;gCAYpC,KAAK;4BAEO,IAAI;;IAKpD,qBAAqB,CAAC,OAAe;QACnC,IAAI,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,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;QACrD,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAGD,KAAK,CAAC,QAAQ,CAAC,IAAsB;QACnC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAGD,KAAK,CAAC,cAAc,CAAC,KAAuC;QAC1D,MAAM,UAAU,GAAG,oBAAoB,CAAC,KAAK,IAAI,SAAS,CAAC,CAAC;QAC5D,yBAAyB,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACxD,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,MAAM;QACJ,OAAO,CACL,4DAAK,KAAK,EAAE,kCAAkC,IAAI,CAAC,IAAI,EAAE;YACvD,8DAAa,CACT,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, h, State, Watch, Element, Method } from '@stencil/core';\nimport { applyThemeObjectToElement, normalizeThemeObject } from '../sdk/theme-tokens';\n\n@Component({\n tag: 'theme-provider',\n shadow: true,\n})\nexport class ThemeProvider {\n @Element() hostElement: HTMLElement;\n\n /** Path / URL to a CSS theme file (CDN or local). */\n @Prop() themePath: string;\n\n /** light | dark — drives `.theme-*` class on this host only (scoped). */\n @Prop({ mutable: true, reflect: true }) mode: 'light' | 'dark' = 'light';\n\n /**\n * Inline CSS variable overrides. Keys may be `--brand` or `brand`.\n * Applied on this host so values inherit into nested shadow trees.\n */\n @Prop() themeObject?: { [key: string]: string };\n\n /**\n * When true, also mirror mode onto <html> (legacy). Default false so\n * embeds do not restyle the host page or fight sibling chats.\n */\n @Prop() mirrorToDocument: boolean = false;\n\n @State() styleElement: HTMLLinkElement | null = null;\n\n private stylesheetId = `isometrik-theme-stylesheet-${Math.random().toString(36).slice(2, 9)}`;\n\n @Watch('themePath')\n handleThemePathChange(newPath: string) {\n if (newPath) {\n this.loadThemeFromPath(newPath);\n }\n }\n\n @Watch('mode')\n handleModeChange(newMode: 'light' | 'dark') {\n this.updateThemeClass(newMode);\n }\n\n @Watch('themeObject')\n handleThemeObjectChange(next?: { [key: string]: string }) {\n this.applyThemeObject(next);\n }\n\n @Watch('mirrorToDocument')\n handleMirrorChange() {\n this.updateThemeClass(this.mode);\n }\n\n componentDidLoad() {\n if (this.themePath) {\n this.loadThemeFromPath(this.themePath);\n }\n this.updateThemeClass(this.mode);\n this.applyThemeObject(this.themeObject);\n }\n\n disconnectedCallback() {\n if (this.styleElement?.parentNode) {\n this.styleElement.parentNode.removeChild(this.styleElement);\n this.styleElement = null;\n }\n if (this.mirrorToDocument) {\n document.documentElement.classList.remove('theme-light', 'theme-dark');\n }\n }\n\n private applyThemeObject(theme?: { [key: string]: string }) {\n applyThemeObjectToElement(this.hostElement, theme || null);\n }\n\n /** Mode class on this host only — CSS vars inherit into <web-chat> shadow. */\n private updateThemeClass(mode: 'light' | 'dark') {\n this.hostElement.classList.remove('theme-light', 'theme-dark');\n this.hostElement.classList.add(`theme-${mode}`);\n\n if (this.mirrorToDocument) {\n document.documentElement.classList.remove('theme-light', 'theme-dark');\n document.documentElement.classList.add(`theme-${mode}`);\n }\n\n this.hostElement.dispatchEvent(\n new CustomEvent('themechange', {\n detail: { mode, scoped: !this.mirrorToDocument },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private loadThemeFromPath(path: string) {\n if (this.styleElement?.parentNode) {\n this.styleElement.parentNode.removeChild(this.styleElement);\n }\n\n this.styleElement = document.createElement('link');\n this.styleElement.rel = 'stylesheet';\n this.styleElement.href = path;\n this.styleElement.id = this.stylesheetId;\n this.styleElement.setAttribute('data-isometrik-theme', '1');\n document.head.appendChild(this.styleElement);\n }\n\n @Method()\n async toggleTheme() {\n this.mode = this.mode === 'light' ? 'dark' : 'light';\n return this.mode;\n }\n\n @Method()\n async setTheme(mode: 'light' | 'dark') {\n this.mode = mode;\n return this.mode;\n }\n\n @Method()\n async setThemeObject(theme: { [key: string]: string } | null) {\n const normalized = normalizeThemeObject(theme || undefined);\n applyThemeObjectToElement(this.hostElement, normalized);\n return normalized;\n }\n\n render() {\n return (\n <div class={`theme-provider-container theme-${this.mode}`}>\n <slot></slot>\n </div>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"theme-provider.js","sourceRoot":"","sources":["../../src/components/theme-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAwBtF,MAAM,OAAO,aAAa;;QAuBhB,iBAAY,GAAG,8BAA8B,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;;oBAhB7B,OAAO;;gCAYpC,KAAK;4BAEO,IAAI;;IAKpD,qBAAqB,CAAC,OAAe;QACnC,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;IAGD,gBAAgB,CAAC,OAAyB;QACxC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IAGD,uBAAuB,CAAC,IAAgC;QACtD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAGD,kBAAkB;QAChB,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;I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AC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACxD,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,MAAM;QACJ,OAAO,CACL,4DAAK,KAAK,EAAE,kCAAkC,IAAI,CAAC,IAAI,EAAE;YACvD,8DAAa,CACT,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, h, State, Watch, Element, Method } from '@stencil/core';\nimport { applyThemeObjectToElement, normalizeThemeObject } from '../sdk/theme-tokens';\n\n@Component({\n tag: 'theme-provider',\n shadow: true,\n styles: `\n :host {\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n box-sizing: border-box;\n }\n .theme-provider-container {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n min-height: 0;\n overflow: hidden;\n box-sizing: border-box;\n }\n `,\n})\nexport class ThemeProvider {\n @Element() hostElement: HTMLElement;\n\n /** Path / URL to a CSS theme file (CDN or local). */\n @Prop() themePath: string;\n\n /** light | dark — drives `.theme-*` class on this host only (scoped). */\n @Prop({ mutable: true, reflect: true }) mode: 'light' | 'dark' = 'light';\n\n /**\n * Inline CSS variable overrides. Keys may be `--brand` or `brand`.\n * Applied on this host so values inherit into nested shadow trees.\n */\n @Prop() themeObject?: { [key: string]: string };\n\n /**\n * When true, also mirror mode onto <html> (legacy). Default false so\n * embeds do not restyle the host page or fight sibling chats.\n */\n @Prop() mirrorToDocument: boolean = false;\n\n @State() styleElement: HTMLLinkElement | null = null;\n\n private stylesheetId = `isometrik-theme-stylesheet-${Math.random().toString(36).slice(2, 9)}`;\n\n @Watch('themePath')\n handleThemePathChange(newPath: string) {\n if (newPath) {\n this.loadThemeFromPath(newPath);\n }\n }\n\n @Watch('mode')\n handleModeChange(newMode: 'light' | 'dark') {\n this.updateThemeClass(newMode);\n }\n\n @Watch('themeObject')\n handleThemeObjectChange(next?: { [key: string]: string }) {\n this.applyThemeObject(next);\n }\n\n @Watch('mirrorToDocument')\n handleMirrorChange() {\n this.updateThemeClass(this.mode);\n }\n\n componentDidLoad() {\n if (this.themePath) {\n this.loadThemeFromPath(this.themePath);\n }\n this.updateThemeClass(this.mode);\n this.applyThemeObject(this.themeObject);\n }\n\n disconnectedCallback() {\n if (this.styleElement?.parentNode) {\n this.styleElement.parentNode.removeChild(this.styleElement);\n this.styleElement = null;\n }\n if (this.mirrorToDocument) {\n document.documentElement.classList.remove('theme-light', 'theme-dark');\n }\n }\n\n private applyThemeObject(theme?: { [key: string]: string }) {\n applyThemeObjectToElement(this.hostElement, theme || null);\n }\n\n /** Mode class on this host only — CSS vars inherit into <web-chat> shadow. */\n private updateThemeClass(mode: 'light' | 'dark') {\n this.hostElement.classList.remove('theme-light', 'theme-dark');\n this.hostElement.classList.add(`theme-${mode}`);\n\n if (this.mirrorToDocument) {\n document.documentElement.classList.remove('theme-light', 'theme-dark');\n document.documentElement.classList.add(`theme-${mode}`);\n }\n\n this.hostElement.dispatchEvent(\n new CustomEvent('themechange', {\n detail: { mode, scoped: !this.mirrorToDocument },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private loadThemeFromPath(path: string) {\n if (this.styleElement?.parentNode) {\n this.styleElement.parentNode.removeChild(this.styleElement);\n }\n\n this.styleElement = document.createElement('link');\n this.styleElement.rel = 'stylesheet';\n this.styleElement.href = path;\n this.styleElement.id = this.stylesheetId;\n this.styleElement.setAttribute('data-isometrik-theme', '1');\n document.head.appendChild(this.styleElement);\n }\n\n @Method()\n async toggleTheme() {\n this.mode = this.mode === 'light' ? 'dark' : 'light';\n return this.mode;\n }\n\n @Method()\n async setTheme(mode: 'light' | 'dark') {\n this.mode = mode;\n return this.mode;\n }\n\n @Method()\n async setThemeObject(theme: { [key: string]: string } | null) {\n const normalized = normalizeThemeObject(theme || undefined);\n applyThemeObjectToElement(this.hostElement, normalized);\n return normalized;\n }\n\n render() {\n return (\n <div class={`theme-provider-container theme-${this.mode}`}>\n <slot></slot>\n </div>\n );\n }\n}\n"]}
@@ -87,7 +87,7 @@ const ThemeProvider = /*@__PURE__*/ proxyCustomElement(class ThemeProvider exten
87
87
  return normalized;
88
88
  }
89
89
  render() {
90
- return (h("div", { key: 'eda588f5d70658cdbb4d2c112b87e967e26851f4', class: `theme-provider-container theme-${this.mode}` }, h("slot", { key: '1c0c507b5f4380353fb5af4332f1873eecd84d5c' })));
90
+ return (h("div", { key: '3e4ce98aeaeefa4f96aef5846aeecff68e13e63f', class: `theme-provider-container theme-${this.mode}` }, h("slot", { key: '9730319fa5c287526a00973be782ecf7db639ecc' })));
91
91
  }
92
92
  get hostElement() { return this; }
93
93
  static get watchers() { return {
@@ -96,6 +96,7 @@ const ThemeProvider = /*@__PURE__*/ proxyCustomElement(class ThemeProvider exten
96
96
  "themeObject": ["handleThemeObjectChange"],
97
97
  "mirrorToDocument": ["handleMirrorChange"]
98
98
  }; }
99
+ static get style() { return ":host {\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n box-sizing: border-box;\n }\n .theme-provider-container {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n min-height: 0;\n overflow: hidden;\n box-sizing: border-box;\n }"; }
99
100
  }, [1, "theme-provider", {
100
101
  "themePath": [1, "theme-path"],
101
102
  "mode": [1537],
@@ -1 +1 @@
1
- {"file":"theme-provider2.js","mappings":";;;MAOa,aAAa;;;;;QAuBhB,iBAAY,GAAG,8BAA8B,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;;oBAhB7B,OAAO;;gCAYpC,KAAK;4BAEO,IAAI;;IAKpD,qBAAqB,CAAC,OAAe;QACnC,IAAI,OAAO,EAAE;YACX,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AI,CAAC,IAAI,CAAC;KAClB;IAGD,MAAM,cAAc,CAAC,KAAuC;QAC1D,MAAM,UAAU,GAAG,oBAAoB,CAAC,KAAK,IAAI,SAAS,CAAC,CAAC;QAC5D,yBAAyB,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACxD,OAAO,UAAU,CAAC;KACnB;IAED,MAAM;QACJ,QACE,4DAAK,KAAK,EAAE,kCAAkC,IAAI,CAAC,IAAI,EAAE,IACvD,8DAAa,CACT,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/theme-provider.tsx"],"sourcesContent":["import { Component, Prop, h, State, Watch, Element, Method } from '@stencil/core';\nimport { applyThemeObjectToElement, normalizeThemeObject } from '../sdk/theme-tokens';\n\n@Component({\n tag: 'theme-provider',\n shadow: true,\n})\nexport class ThemeProvider {\n @Element() hostElement: HTMLElement;\n\n /** Path / URL to a CSS theme file (CDN or local). */\n @Prop() themePath: string;\n\n /** light | dark — drives `.theme-*` class on this host only (scoped). */\n @Prop({ mutable: true, reflect: true }) mode: 'light' | 'dark' = 'light';\n\n /**\n * Inline CSS variable overrides. Keys may be `--brand` or `brand`.\n * Applied on this host so values inherit into nested shadow trees.\n */\n @Prop() themeObject?: { [key: string]: string };\n\n /**\n * When true, also mirror mode onto <html> (legacy). Default false so\n * embeds do not restyle the host page or fight sibling chats.\n */\n @Prop() mirrorToDocument: boolean = false;\n\n @State() styleElement: HTMLLinkElement | null = null;\n\n private stylesheetId = `isometrik-theme-stylesheet-${Math.random().toString(36).slice(2, 9)}`;\n\n @Watch('themePath')\n handleThemePathChange(newPath: string) {\n if (newPath) {\n this.loadThemeFromPath(newPath);\n }\n }\n\n @Watch('mode')\n handleModeChange(newMode: 'light' | 'dark') {\n this.updateThemeClass(newMode);\n }\n\n @Watch('themeObject')\n handleThemeObjectChange(next?: { [key: string]: string }) {\n this.applyThemeObject(next);\n }\n\n @Watch('mirrorToDocument')\n handleMirrorChange() {\n this.updateThemeClass(this.mode);\n }\n\n componentDidLoad() {\n if (this.themePath) {\n this.loadThemeFromPath(this.themePath);\n }\n this.updateThemeClass(this.mode);\n this.applyThemeObject(this.themeObject);\n }\n\n disconnectedCallback() {\n if (this.styleElement?.parentNode) {\n this.styleElement.parentNode.removeChild(this.styleElement);\n this.styleElement = null;\n }\n if (this.mirrorToDocument) {\n document.documentElement.classList.remove('theme-light', 'theme-dark');\n }\n }\n\n private applyThemeObject(theme?: { [key: string]: string }) {\n applyThemeObjectToElement(this.hostElement, theme || null);\n }\n\n /** Mode class on this host only — CSS vars inherit into <web-chat> shadow. */\n private updateThemeClass(mode: 'light' | 'dark') {\n this.hostElement.classList.remove('theme-light', 'theme-dark');\n this.hostElement.classList.add(`theme-${mode}`);\n\n if (this.mirrorToDocument) {\n document.documentElement.classList.remove('theme-light', 'theme-dark');\n document.documentElement.classList.add(`theme-${mode}`);\n }\n\n this.hostElement.dispatchEvent(\n new CustomEvent('themechange', {\n detail: { mode, scoped: !this.mirrorToDocument },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private loadThemeFromPath(path: string) {\n if (this.styleElement?.parentNode) {\n this.styleElement.parentNode.removeChild(this.styleElement);\n }\n\n this.styleElement = document.createElement('link');\n this.styleElement.rel = 'stylesheet';\n this.styleElement.href = path;\n this.styleElement.id = this.stylesheetId;\n this.styleElement.setAttribute('data-isometrik-theme', '1');\n document.head.appendChild(this.styleElement);\n }\n\n @Method()\n async toggleTheme() {\n this.mode = this.mode === 'light' ? 'dark' : 'light';\n return this.mode;\n }\n\n @Method()\n async setTheme(mode: 'light' | 'dark') {\n this.mode = mode;\n return this.mode;\n }\n\n @Method()\n async setThemeObject(theme: { [key: string]: string } | null) {\n const normalized = normalizeThemeObject(theme || undefined);\n applyThemeObjectToElement(this.hostElement, normalized);\n return normalized;\n }\n\n render() {\n return (\n <div class={`theme-provider-container theme-${this.mode}`}>\n <slot></slot>\n </div>\n );\n }\n}\n"],"version":3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CAAC,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;KAC9C;IAGD,MAAM,WAAW;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,KAAK,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;QACrD,OAAO,IAAI,CAAC,IAAI,CAAC;KAClB;IAGD,MAAM,QAAQ,CAAC,IAAsB;QACnC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC;KAClB;IAGD,MAAM,cAAc,CAAC,KAAuC;QAC1D,MAAM,UAAU,GAAG,oBAAoB,CAAC,KAAK,IAAI,SAAS,CAAC,CAAC;QAC5D,yBAAyB,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACxD,OAAO,UAAU,CAAC;KACnB;IAED,MAAM;QACJ,QACE,4DAAK,KAAK,EAAE,kCAAkC,IAAI,CAAC,IAAI,EAAE,IACvD,8DAAa,CACT,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/theme-provider.tsx"],"sourcesContent":["import { Component, Prop, h, State, Watch, Element, Method } from '@stencil/core';\nimport { applyThemeObjectToElement, normalizeThemeObject } from '../sdk/theme-tokens';\n\n@Component({\n tag: 'theme-provider',\n shadow: true,\n styles: `\n :host {\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n box-sizing: border-box;\n }\n .theme-provider-container {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n min-height: 0;\n overflow: hidden;\n box-sizing: border-box;\n }\n `,\n})\nexport class ThemeProvider {\n @Element() hostElement: HTMLElement;\n\n /** Path / URL to a CSS theme file (CDN or local). */\n @Prop() themePath: string;\n\n /** light | dark — drives `.theme-*` class on this host only (scoped). */\n @Prop({ mutable: true, reflect: true }) mode: 'light' | 'dark' = 'light';\n\n /**\n * Inline CSS variable overrides. Keys may be `--brand` or `brand`.\n * Applied on this host so values inherit into nested shadow trees.\n */\n @Prop() themeObject?: { [key: string]: string };\n\n /**\n * When true, also mirror mode onto <html> (legacy). Default false so\n * embeds do not restyle the host page or fight sibling chats.\n */\n @Prop() mirrorToDocument: boolean = false;\n\n @State() styleElement: HTMLLinkElement | null = null;\n\n private stylesheetId = `isometrik-theme-stylesheet-${Math.random().toString(36).slice(2, 9)}`;\n\n @Watch('themePath')\n handleThemePathChange(newPath: string) {\n if (newPath) {\n this.loadThemeFromPath(newPath);\n }\n }\n\n @Watch('mode')\n handleModeChange(newMode: 'light' | 'dark') {\n this.updateThemeClass(newMode);\n }\n\n @Watch('themeObject')\n handleThemeObjectChange(next?: { [key: string]: string }) {\n this.applyThemeObject(next);\n }\n\n @Watch('mirrorToDocument')\n handleMirrorChange() {\n this.updateThemeClass(this.mode);\n }\n\n componentDidLoad() {\n if (this.themePath) {\n this.loadThemeFromPath(this.themePath);\n }\n this.updateThemeClass(this.mode);\n this.applyThemeObject(this.themeObject);\n }\n\n disconnectedCallback() {\n if (this.styleElement?.parentNode) {\n this.styleElement.parentNode.removeChild(this.styleElement);\n this.styleElement = null;\n }\n if (this.mirrorToDocument) {\n document.documentElement.classList.remove('theme-light', 'theme-dark');\n }\n }\n\n private applyThemeObject(theme?: { [key: string]: string }) {\n applyThemeObjectToElement(this.hostElement, theme || null);\n }\n\n /** Mode class on this host only — CSS vars inherit into <web-chat> shadow. */\n private updateThemeClass(mode: 'light' | 'dark') {\n this.hostElement.classList.remove('theme-light', 'theme-dark');\n this.hostElement.classList.add(`theme-${mode}`);\n\n if (this.mirrorToDocument) {\n document.documentElement.classList.remove('theme-light', 'theme-dark');\n document.documentElement.classList.add(`theme-${mode}`);\n }\n\n this.hostElement.dispatchEvent(\n new CustomEvent('themechange', {\n detail: { mode, scoped: !this.mirrorToDocument },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private loadThemeFromPath(path: string) {\n if (this.styleElement?.parentNode) {\n this.styleElement.parentNode.removeChild(this.styleElement);\n }\n\n this.styleElement = document.createElement('link');\n this.styleElement.rel = 'stylesheet';\n this.styleElement.href = path;\n this.styleElement.id = this.stylesheetId;\n this.styleElement.setAttribute('data-isometrik-theme', '1');\n document.head.appendChild(this.styleElement);\n }\n\n @Method()\n async toggleTheme() {\n this.mode = this.mode === 'light' ? 'dark' : 'light';\n return this.mode;\n }\n\n @Method()\n async setTheme(mode: 'light' | 'dark') {\n this.mode = mode;\n return this.mode;\n }\n\n @Method()\n async setThemeObject(theme: { [key: string]: string } | null) {\n const normalized = normalizeThemeObject(theme || undefined);\n applyThemeObjectToElement(this.hostElement, normalized);\n return normalized;\n }\n\n render() {\n return (\n <div class={`theme-provider-container theme-${this.mode}`}>\n <slot></slot>\n </div>\n );\n }\n}\n"],"version":3}
@@ -142,7 +142,7 @@ const ThemeProvider = class {
142
142
  return normalized;
143
143
  }
144
144
  render() {
145
- return (h("div", { key: 'eda588f5d70658cdbb4d2c112b87e967e26851f4', class: `theme-provider-container theme-${this.mode}` }, h("slot", { key: '1c0c507b5f4380353fb5af4332f1873eecd84d5c' })));
145
+ return (h("div", { key: '3e4ce98aeaeefa4f96aef5846aeecff68e13e63f', class: `theme-provider-container theme-${this.mode}` }, h("slot", { key: '9730319fa5c287526a00973be782ecf7db639ecc' })));
146
146
  }
147
147
  get hostElement() { return getElement(this); }
148
148
  static get watchers() { return {
@@ -152,6 +152,7 @@ const ThemeProvider = class {
152
152
  "mirrorToDocument": ["handleMirrorChange"]
153
153
  }; }
154
154
  };
155
+ ThemeProvider.style = ":host {\n display: block;\n width: 100%;\n height: 100%;\n min-height: 0;\n box-sizing: border-box;\n }\n .theme-provider-container {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n min-height: 0;\n overflow: hidden;\n box-sizing: border-box;\n }";
155
156
 
156
157
  /**
157
158
  * Thin MQTT lifecycle helper around test-iso-chat-sdk's mqtt client.