@dialpad/dialtone 10.0.0 → 10.0.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 (30) hide show
  1. package/README.md +3 -3
  2. package/dist/tokens/doc.json +1 -1
  3. package/dist/tokens/themes/config-no-layers.cjs +1 -0
  4. package/dist/tokens/themes/config-no-layers.js +12 -0
  5. package/dist/tokens/themes/config.cjs +2 -2
  6. package/dist/tokens/themes/config.js +71 -58
  7. package/dist/tokens/themes/materials.cjs +1 -0
  8. package/dist/tokens/themes/materials.js +30 -0
  9. package/dist/tokens/types/themes/config-no-layers.d.ts +5 -0
  10. package/dist/tokens/types/themes/config-no-layers.d.ts.map +1 -0
  11. package/dist/tokens/types/themes/config.d.ts +1 -0
  12. package/dist/tokens/types/themes/config.d.ts.map +1 -1
  13. package/dist/tokens/types/themes/materials.d.ts +28 -0
  14. package/dist/tokens/types/themes/materials.d.ts.map +1 -0
  15. package/dist/vue3/{RichTextEditor-DKpulIyi.js → RichTextEditor-CzMY0oVT.js} +10 -17
  16. package/dist/vue3/{RichTextEditor-DKpulIyi.js.map → RichTextEditor-CzMY0oVT.js.map} +1 -1
  17. package/dist/vue3/{RichTextEditor-BVQ99ytl.cjs → RichTextEditor-n42FPkjs.cjs} +3 -4
  18. package/dist/vue3/{RichTextEditor-BVQ99ytl.cjs.map → RichTextEditor-n42FPkjs.cjs.map} +1 -1
  19. package/dist/vue3/components/Popover/Popover.vue.d.ts.map +1 -1
  20. package/dist/vue3/dialtone-vue.cjs +1 -1
  21. package/dist/vue3/dialtone-vue.js +1 -1
  22. package/dist/vue3/lib/popover/popover.cjs +1 -1
  23. package/dist/vue3/lib/popover/popover.cjs.map +1 -1
  24. package/dist/vue3/lib/popover/popover.js +14 -2
  25. package/dist/vue3/lib/popover/popover.js.map +1 -1
  26. package/dist/vue3/lib/rich-text-editor/index.cjs +1 -1
  27. package/dist/vue3/lib/rich-text-editor/index.js +1 -1
  28. package/dist/vue3/lib/rich-text-editor/rich-text-editor.cjs +1 -1
  29. package/dist/vue3/lib/rich-text-editor/rich-text-editor.js +1 -1
  30. package/package.json +2 -2
package/README.md CHANGED
@@ -73,14 +73,14 @@ import {
73
73
  import Tmo from '@dialpad/dialtone/themes/tmo';
74
74
  import HighContrast from '@dialpad/dialtone/themes/high-contrast';
75
75
 
76
- setMode('dark'); // toggles data-dt-mode
76
+ setMode('dark'); // toggles data-dt-mode, no injection
77
77
  setBrand(Tmo); // injects brand CSS, sets data-dt-brand
78
- setMaterial('steel'); // toggles data-dt-material
78
+ setMaterial('steel'); // injects material CSS, sets data-dt-material
79
79
  setContrast(HighContrast); // injects contrast CSS, sets data-dt-contrast
80
80
  setContrast(null); // remove contrast override
81
81
  ```
82
82
 
83
- `setMode` and `setMaterial` toggle attributes against pre-bundled CSS — no injection. `setBrand` and `setContrast` inject per-theme override CSS.
83
+ `setMode` toggles an attribute against pre-bundled CSS — no injection. `setBrand`, `setMaterial`, and `setContrast` inject per-theme override CSS.
84
84
 
85
85
  ---
86
86
 
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/tokens/doc.json
3
3
  size: 104434071 bytes
4
- sha256: 4e1162baffab836992530150f9e5235e06e6b5f91fee37ef7d5a5008eb516663
4
+ sha256: 4fcdea21b81d927ccebd8ab5c2d9ddc2aeccbd39e9ac88eebdff6818ecdcc073
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./core-no-layers.cjs`),t=require(`./config.cjs`);function n(n,r=`light`,i=document.documentElement,a={}){return t.initDialtoneTheme(n,r,i,{...a,layers:!1,core:e})}exports.initDialtoneThemeNoLayers=n;
@@ -0,0 +1,12 @@
1
+ import e from "./core-no-layers.js";
2
+ import { initDialtoneTheme as t } from "./config.js";
3
+ //#region themes/config-no-layers.js
4
+ function n(n, r = "light", i = document.documentElement, a = {}) {
5
+ return t(n, r, i, {
6
+ ...a,
7
+ layers: !1,
8
+ core: e
9
+ });
10
+ }
11
+ //#endregion
12
+ export { n as initDialtoneThemeNoLayers };
@@ -1,3 +1,3 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./core.cjs`);var t=Object.freeze([`sandstone`,`steel`,`graphite`,`iron`,`amethyst`,`jade`]),n=new Set(t),r=!1,i=0,a=null;function o(e,t=document.documentElement,n=null){if(t instanceof ShadowRoot){console.warn(`[Dialtone] You passed a ShadowRoot directly to setBrand(). Please pass the host element instead. The function will access shadowRoot automatically.`);return}if(e===null){d(`dialtone-css-brand`,t?.shadowRoot??t),a&&(t?.setAttribute(`data-dt-brand`,a.brand),t?.setAttribute(`data-dt-material`,a.material??`sandstone`));return}return e.base?s(e,t,n):c(e,t)}function s(e,t=document.documentElement,n=null){t?.setAttribute(`data-dt-theme`,e.base.name),t?.setAttribute(`data-dt-brand`,e.brand.name);let r=t?.shadowRoot??t;u(`dialtone-css-theme`,e.base.css,r),u(`dialtone-css-brand`,e.brand.css,r),n?(u(`dialtone-css-contrast`,n.css,r),t?.setAttribute(`data-dt-contrast`,`high`)):(d(`dialtone-css-contrast`,r),t?.setAttribute(`data-dt-contrast`,`default`))}function c(e,t=document.documentElement){let n=t?.shadowRoot??t;if(e.core&&!r&&(u(`dialtone-css-core`,e.core,n),r=!0),e.baseColors&&!n?.querySelector(`#dialtone-css-base-colors`)&&u(`dialtone-css-base-colors`,e.baseColors,n),e.brand){let r=a?.brand;r&&e.brand.name===r?(d(`dialtone-css-brand`,n),t?.setAttribute(`data-dt-brand`,r),t?.setAttribute(`data-dt-material`,a?.material??`sandstone`)):(u(`dialtone-css-brand`,e.brand.css,n),t?.setAttribute(`data-dt-brand`,e.brand.name),m(e,t))}e.contrast&&(u(`dialtone-css-contrast`,e.contrast.css,n),t?.setAttribute(`data-dt-contrast`,e.contrast.name))}function l(t,n){let a=++i;t?(u(`dialtone-css-core`,e.core,n),r=!0):(u(`dialtone-css-core`,``,n),Promise.resolve().then(()=>require(`./core-no-layers.cjs`)).then(({default:e})=>{a===i&&(u(`dialtone-css-core`,e.core,n),r=!0)}).catch(e=>{a===i&&console.error(`[Dialtone] initDialtoneTheme: failed to load no-layers core tokens.`,e)}))}function u(e,t,n,r=null){if(n?.querySelector(`#`+e)){let r=n.querySelector(`#`+e);r.innerHTML=t}else{let i=document.createElement(`style`);i.setAttribute(`type`,`text/css`),i.setAttribute(`id`,e),i.innerHTML=t;let a=n?.querySelector(`head`)??n,o=r?n?.querySelector(`#`+r):null;o&&o.parentNode===a?a.insertBefore(i,o):a?.appendChild(i)}}function d(e,t){t?.querySelector(`#`+e)?.remove()}function f(e,t=document.documentElement){if(e!==`light`&&e!==`dark`){console.warn(`Invalid mode: ${e}. Must be 'light' or 'dark'`);return}if(t instanceof ShadowRoot){console.warn(`[Dialtone] You passed a ShadowRoot directly to setMode(). Please pass the host element instead. The function will access shadowRoot automatically.`);return}t?.setAttribute(`data-dt-mode`,e)}function p(e,t=document.documentElement){if(!e||typeof e!=`object`)throw TypeError(`[Dialtone] setBaseBrand: brandTheme must be an object. Import a brand theme like: import Dp from '@dialpad/dialtone-tokens/themes/dp';`);if(!e.brand||typeof e.brand!=`object`)throw TypeError(`[Dialtone] setBaseBrand: brandTheme.brand must be an object with {name, css} properties.`);if(typeof e.brand.name!=`string`||!e.brand.name||typeof e.brand.css!=`string`)throw TypeError(`[Dialtone] setBaseBrand: brandTheme.brand.name must be a non-empty string and brandTheme.brand.css must be a string.`);if(t instanceof ShadowRoot){console.warn(`[Dialtone] You passed a ShadowRoot directly to setBaseBrand(). Please pass the host element instead. The function will access shadowRoot automatically.`);return}let n=t?.shadowRoot??t;u(`dialtone-css-brand-base`,e.brand.css,n),t?.setAttribute(`data-dt-brand`,e.brand.name),m(e,t),d(`dialtone-css-brand`,n),a&&(a.brand=e.brand.name,a.material=v(e)??`sandstone`)}function m(e,t){let r=e.material?.name;if(r){if(n.has(r)){t?.setAttribute(`data-dt-material`,r);return}console.warn(`[Dialtone] setBaseBrand: brand '${e.brand.name}' declares unknown material '${r}'; falling back to sandstone.`),t?.setAttribute(`data-dt-material`,`sandstone`)}}function h(e,t=document.documentElement){if(t instanceof ShadowRoot){console.warn(`[Dialtone] You passed a ShadowRoot directly to setContrast(). Please pass the host element instead. The function will access shadowRoot automatically.`);return}let n=t?.shadowRoot??t;e&&e.contrast?(u(`dialtone-css-contrast`,e.contrast.css,n),t?.setAttribute(`data-dt-contrast`,e.contrast.name)):(d(`dialtone-css-contrast`,n),t?.setAttribute(`data-dt-contrast`,`default`))}function g(e,t=document.documentElement){if(e!=null&&typeof e!=`string`)throw TypeError(`[Dialtone] setMaterial: expected a string material name or null.`);if(t instanceof ShadowRoot){console.warn(`[Dialtone] You passed a ShadowRoot directly to setMaterial(). Please pass the host element instead. The function will access shadowRoot automatically.`);return}let r=e||`sandstone`;if(!n.has(r)){console.warn(`[Dialtone] setMaterial: unknown material '${e}'; falling back to sandstone.`),t?.setAttribute(`data-dt-material`,`sandstone`);return}t?.setAttribute(`data-dt-material`,r)}function _(t,n=`light`,r=document.documentElement,i={}){let{layers:o=!0}=i;if(!t||typeof t!=`object`)throw TypeError(`[Dialtone] initDialtoneTheme: brandTheme must be an object. Import a brand theme like: import Dp from '@dialpad/dialtone-tokens/themes/dp';`);if(!t.brand||typeof t.brand!=`object`)throw TypeError(`[Dialtone] initDialtoneTheme: brandTheme.brand must be an object with {name, css} properties. Ensure you're importing a valid brand theme.`);if(typeof t.brand.name!=`string`||!t.brand.name||typeof t.brand.css!=`string`)throw TypeError(`[Dialtone] initDialtoneTheme: brandTheme.brand.name must be a non-empty string and brandTheme.brand.css must be a string.`);if(n!==`light`&&n!==`dark`)throw TypeError(`[Dialtone] initDialtoneTheme: mode must be 'light' or 'dark', got '${n}'.`);if(!r||typeof r!=`object`)throw TypeError(`[Dialtone] initDialtoneTheme: rootNode must be an HTMLElement or host element with shadowRoot.`);if(r instanceof ShadowRoot){console.warn(`[Dialtone] You passed a ShadowRoot directly to initDialtoneTheme(). Please pass the host element instead. The function will access shadowRoot automatically.
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./materials.cjs`),t=require(`./core.cjs`);var n=Object.freeze([`sandstone`,`steel`,`graphite`,`iron`,`amethyst`,`jade`]),r=new Set(n),i=!1,a=0,o=null;function s(e,t=document.documentElement,n=null){if(t instanceof ShadowRoot){console.warn(`[Dialtone] You passed a ShadowRoot directly to setBrand(). Please pass the host element instead. The function will access shadowRoot automatically.`);return}if(e===null){f(`dialtone-css-brand`,t?.shadowRoot??t),o&&(t?.setAttribute(`data-dt-brand`,o.brand),g(o.material??`sandstone`,t));return}return e.base?c(e,t,n):l(e,t)}function c(e,t=document.documentElement,n=null){t?.setAttribute(`data-dt-theme`,e.base.name),t?.setAttribute(`data-dt-brand`,e.brand.name);let r=t?.shadowRoot??t;d(`dialtone-css-theme`,e.base.css,r),d(`dialtone-css-brand`,e.brand.css,r),n?(d(`dialtone-css-contrast`,n.css,r),t?.setAttribute(`data-dt-contrast`,`high`)):(f(`dialtone-css-contrast`,r),t?.setAttribute(`data-dt-contrast`,`default`))}function l(e,t=document.documentElement){let n=t?.shadowRoot??t;if(e.core&&!i&&(d(`dialtone-css-core`,e.core,n),i=!0),e.baseColors&&!n?.querySelector(`#dialtone-css-base-colors`)&&d(`dialtone-css-base-colors`,e.baseColors,n),e.brand){let r=o?.brand;r&&e.brand.name===r?(f(`dialtone-css-brand`,n),t?.setAttribute(`data-dt-brand`,r),g(o?.material??`sandstone`,t)):(d(`dialtone-css-brand`,e.brand.css,n),t?.setAttribute(`data-dt-brand`,e.brand.name),h(e,t))}e.contrast&&(d(`dialtone-css-contrast`,e.contrast.css,n),t?.setAttribute(`data-dt-contrast`,e.contrast.name))}function u(e,n,r=null){let o=++a;if(e){d(`dialtone-css-core`,t.core,n),i=!0;return}if(r){d(`dialtone-css-core`,r.core,n),i=!0;return}d(`dialtone-css-core`,``,n),Promise.resolve().then(()=>require(`./core-no-layers.cjs`)).then(({default:e})=>{o===a&&(d(`dialtone-css-core`,e.core,n),i=!0)}).catch(e=>{o===a&&console.error(`[Dialtone] initDialtoneTheme: failed to load no-layers core tokens.`,e)})}function d(e,t,n,r=null){if(n?.querySelector(`#`+e)){let r=n.querySelector(`#`+e);r.innerHTML=t}else{let i=document.createElement(`style`);i.setAttribute(`type`,`text/css`),i.setAttribute(`id`,e),i.innerHTML=t;let a=n?.querySelector(`head`)??n,o=r?n?.querySelector(`#`+r):null;o&&o.parentNode===a?a.insertBefore(i,o):a?.appendChild(i)}}function f(e,t){t?.querySelector(`#`+e)?.remove()}function p(e,t=document.documentElement){if(e!==`light`&&e!==`dark`){console.warn(`Invalid mode: ${e}. Must be 'light' or 'dark'`);return}if(t instanceof ShadowRoot){console.warn(`[Dialtone] You passed a ShadowRoot directly to setMode(). Please pass the host element instead. The function will access shadowRoot automatically.`);return}t?.setAttribute(`data-dt-mode`,e)}function m(e,t=document.documentElement){if(!e||typeof e!=`object`)throw TypeError(`[Dialtone] setBaseBrand: brandTheme must be an object. Import a brand theme like: import Dp from '@dialpad/dialtone-tokens/themes/dp';`);if(!e.brand||typeof e.brand!=`object`)throw TypeError(`[Dialtone] setBaseBrand: brandTheme.brand must be an object with {name, css} properties.`);if(typeof e.brand.name!=`string`||!e.brand.name||typeof e.brand.css!=`string`)throw TypeError(`[Dialtone] setBaseBrand: brandTheme.brand.name must be a non-empty string and brandTheme.brand.css must be a string.`);if(t instanceof ShadowRoot){console.warn(`[Dialtone] You passed a ShadowRoot directly to setBaseBrand(). Please pass the host element instead. The function will access shadowRoot automatically.`);return}let n=t?.shadowRoot??t;d(`dialtone-css-brand-base`,e.brand.css,n),t?.setAttribute(`data-dt-brand`,e.brand.name),h(e,t),f(`dialtone-css-brand`,n),o&&(o.brand=e.brand.name,o.material=b(e)??`sandstone`)}function h(e,t){let n=e.material?.name;if(n){if(r.has(n)){g(n,t);return}console.warn(`[Dialtone] setBaseBrand: brand '${e.brand.name}' declares unknown material '${n}'; falling back to sandstone.`),g(`sandstone`,t)}}function g(t,n){let r=n?.shadowRoot??n,i=e[t];i?d(`dialtone-css-material`,i.css,r):f(`dialtone-css-material`,r),n?.setAttribute(`data-dt-material`,t)}function _(e,t=document.documentElement){if(t instanceof ShadowRoot){console.warn(`[Dialtone] You passed a ShadowRoot directly to setContrast(). Please pass the host element instead. The function will access shadowRoot automatically.`);return}let n=t?.shadowRoot??t;e&&e.contrast?(d(`dialtone-css-contrast`,e.contrast.css,n),t?.setAttribute(`data-dt-contrast`,e.contrast.name)):(f(`dialtone-css-contrast`,n),t?.setAttribute(`data-dt-contrast`,`default`))}function v(e,t=document.documentElement){if(e!=null&&typeof e!=`string`)throw TypeError(`[Dialtone] setMaterial: expected a string material name or null.`);if(t instanceof ShadowRoot){console.warn(`[Dialtone] You passed a ShadowRoot directly to setMaterial(). Please pass the host element instead. The function will access shadowRoot automatically.`);return}let n=e||`sandstone`;if(!r.has(n)){console.warn(`[Dialtone] setMaterial: unknown material '${e}'; falling back to sandstone.`),g(`sandstone`,t);return}g(n,t)}function y(e,n=`light`,r=document.documentElement,i={}){let{layers:a=!0,core:s=null}=i;if(!e||typeof e!=`object`)throw TypeError(`[Dialtone] initDialtoneTheme: brandTheme must be an object. Import a brand theme like: import Dp from '@dialpad/dialtone-tokens/themes/dp';`);if(!e.brand||typeof e.brand!=`object`)throw TypeError(`[Dialtone] initDialtoneTheme: brandTheme.brand must be an object with {name, css} properties. Ensure you're importing a valid brand theme.`);if(typeof e.brand.name!=`string`||!e.brand.name||typeof e.brand.css!=`string`)throw TypeError(`[Dialtone] initDialtoneTheme: brandTheme.brand.name must be a non-empty string and brandTheme.brand.css must be a string.`);if(n!==`light`&&n!==`dark`)throw TypeError(`[Dialtone] initDialtoneTheme: mode must be 'light' or 'dark', got '${n}'.`);if(!r||typeof r!=`object`)throw TypeError(`[Dialtone] initDialtoneTheme: rootNode must be an HTMLElement or host element with shadowRoot.`);if(r instanceof ShadowRoot){console.warn(`[Dialtone] You passed a ShadowRoot directly to initDialtoneTheme(). Please pass the host element instead. The function will access shadowRoot automatically.
2
2
  Correct: initDialtoneTheme(brand, mode, hostElement)
3
- Incorrect: initDialtoneTheme(brand, mode, hostElement.shadowRoot)`);return}let s=r?.shadowRoot??r;if(r===document.documentElement&&document.querySelector(`#dialtone-css-core`)!==null)throw Error(`[Dialtone] Cannot initialize theme on document.documentElement because theme styles already exist. You are likely in an embedded app/micro-frontend. You MUST pass your own container element as the rootNode parameter. Example: initDialtoneTheme(brandTheme, mode, myAppContainerElement)`);let c=a;if(c)if(c.brand===t.brand.name&&c.mode===n){if(c.layers===o){console.warn(`[Dialtone] Theme already initialized with brand '${t.brand.name}' and mode '${n}'. Re-applying the same theme may be unnecessary. If you need to switch themes dynamically, use setBaseBrand() or setMode() instead of calling initDialtoneTheme() again.`);return}console.warn(`[Dialtone] Theme already initialized with brand '${t.brand.name}' and mode '${n}' using layers=${c.layers}. Reloading core tokens with layers=${o}.`),l(o,s),a.layers=o;return}else{console.warn(`[Dialtone] Theme already initialized. Previous: brand='${c.brand}', mode='${c.mode}'. New: brand='${t.brand.name}', mode='${n}'. Re-initializing with different parameters. Consider using setBaseBrand()/setMode() for dynamic switching.`);return}l(o,s),u(`dialtone-css-base-colors`,e.baseColors,s),f(n,r),r?.setAttribute(`data-dt-contrast`,`default`),r?.setAttribute(`data-dt-material`,`sandstone`),p(t,r),a={brand:t.brand.name,mode:n,contrast:`default`,material:v(t)??`sandstone`,layers:o}}function v(e){return e?.material?.name??null}var y=e=>v(e)!==null,b=o,x=S;function S(e=document.documentElement){if(e instanceof ShadowRoot){console.warn(`[Dialtone] You passed a ShadowRoot directly to resetBrand(). Please pass the host element instead. The function will access shadowRoot automatically.`);return}let t=e?.shadowRoot??e;a=null,r=!1,i++,d(`dialtone-css-core`,t),d(`dialtone-css-base-colors`,t),d(`dialtone-css-material`,t),d(`dialtone-css-brand-base`,t),d(`dialtone-css-brand`,t),d(`dialtone-css-contrast`,t),e?.removeAttribute(`data-dt-mode`),e?.removeAttribute(`data-dt-brand`),e?.removeAttribute(`data-dt-contrast`),e?.removeAttribute(`data-dt-material`)}exports.VALID_MATERIALS=t,exports.getBrandMaterial=v,exports.hasBrandMaterialLock=y,exports.initDialtoneTheme=_,exports.resetBrand=S,exports.resetTheme=x,exports.setBaseBrand=p,exports.setBrand=o,exports.setContrast=h,exports.setMaterial=g,exports.setMode=f,exports.setTheme=b;
3
+ Incorrect: initDialtoneTheme(brand, mode, hostElement.shadowRoot)`);return}let c=r?.shadowRoot??r;if(r===document.documentElement&&document.querySelector(`#dialtone-css-core`)!==null)throw Error(`[Dialtone] Cannot initialize theme on document.documentElement because theme styles already exist. You are likely in an embedded app/micro-frontend. You MUST pass your own container element as the rootNode parameter. Example: initDialtoneTheme(brandTheme, mode, myAppContainerElement)`);let l=o;if(l)if(l.brand===e.brand.name&&l.mode===n){if(l.layers===a){console.warn(`[Dialtone] Theme already initialized with brand '${e.brand.name}' and mode '${n}'. Re-applying the same theme may be unnecessary. If you need to switch themes dynamically, use setBaseBrand() or setMode() instead of calling initDialtoneTheme() again.`);return}console.warn(`[Dialtone] Theme already initialized with brand '${e.brand.name}' and mode '${n}' using layers=${l.layers}. Reloading core tokens with layers=${a}.`),u(a,c,s),o.layers=a;return}else{console.warn(`[Dialtone] Theme already initialized. Previous: brand='${l.brand}', mode='${l.mode}'. New: brand='${e.brand.name}', mode='${n}'. Re-initializing with different parameters. Consider using setBaseBrand()/setMode() for dynamic switching.`);return}u(a,c,s),d(`dialtone-css-base-colors`,t.baseColors,c),p(n,r),r?.setAttribute(`data-dt-contrast`,`default`),r?.setAttribute(`data-dt-material`,`sandstone`),m(e,r),o={brand:e.brand.name,mode:n,contrast:`default`,material:b(e)??`sandstone`,layers:a}}function b(e){return e?.material?.name??null}var x=e=>b(e)!==null,S=s,C=w;function w(e=document.documentElement){if(e instanceof ShadowRoot){console.warn(`[Dialtone] You passed a ShadowRoot directly to resetBrand(). Please pass the host element instead. The function will access shadowRoot automatically.`);return}let t=e?.shadowRoot??e;o=null,i=!1,a++,f(`dialtone-css-core`,t),f(`dialtone-css-base-colors`,t),f(`dialtone-css-material`,t),f(`dialtone-css-brand-base`,t),f(`dialtone-css-brand`,t),f(`dialtone-css-contrast`,t),e?.removeAttribute(`data-dt-mode`),e?.removeAttribute(`data-dt-brand`),e?.removeAttribute(`data-dt-contrast`),e?.removeAttribute(`data-dt-material`)}exports.VALID_MATERIALS=n,exports.getBrandMaterial=b,exports.hasBrandMaterialLock=x,exports.initDialtoneTheme=y,exports.resetBrand=w,exports.resetTheme=C,exports.setBaseBrand=m,exports.setBrand=s,exports.setContrast=_,exports.setMaterial=v,exports.setMode=p,exports.setTheme=S;
@@ -1,46 +1,55 @@
1
- import e from "./core.js";
1
+ import e from "./materials.js";
2
+ import t from "./core.js";
2
3
  //#region themes/config.js
3
- var t = Object.freeze([
4
+ var n = Object.freeze([
4
5
  "sandstone",
5
6
  "steel",
6
7
  "graphite",
7
8
  "iron",
8
9
  "amethyst",
9
10
  "jade"
10
- ]), n = new Set(t), r = !1, i = 0, a = null;
11
- function o(e, t = document.documentElement, n = null) {
11
+ ]), r = new Set(n), i = !1, a = 0, o = null;
12
+ function s(e, t = document.documentElement, n = null) {
12
13
  if (t instanceof ShadowRoot) {
13
14
  console.warn("[Dialtone] You passed a ShadowRoot directly to setBrand(). Please pass the host element instead. The function will access shadowRoot automatically.");
14
15
  return;
15
16
  }
16
17
  if (e === null) {
17
- d("dialtone-css-brand", t?.shadowRoot ?? t), a && (t?.setAttribute("data-dt-brand", a.brand), t?.setAttribute("data-dt-material", a.material ?? "sandstone"));
18
+ f("dialtone-css-brand", t?.shadowRoot ?? t), o && (t?.setAttribute("data-dt-brand", o.brand), g(o.material ?? "sandstone", t));
18
19
  return;
19
20
  }
20
- return e.base ? s(e, t, n) : c(e, t);
21
+ return e.base ? c(e, t, n) : l(e, t);
21
22
  }
22
- function s(e, t = document.documentElement, n = null) {
23
+ function c(e, t = document.documentElement, n = null) {
23
24
  t?.setAttribute("data-dt-theme", e.base.name), t?.setAttribute("data-dt-brand", e.brand.name);
24
25
  let r = t?.shadowRoot ?? t;
25
- u("dialtone-css-theme", e.base.css, r), u("dialtone-css-brand", e.brand.css, r), n ? (u("dialtone-css-contrast", n.css, r), t?.setAttribute("data-dt-contrast", "high")) : (d("dialtone-css-contrast", r), t?.setAttribute("data-dt-contrast", "default"));
26
+ d("dialtone-css-theme", e.base.css, r), d("dialtone-css-brand", e.brand.css, r), n ? (d("dialtone-css-contrast", n.css, r), t?.setAttribute("data-dt-contrast", "high")) : (f("dialtone-css-contrast", r), t?.setAttribute("data-dt-contrast", "default"));
26
27
  }
27
- function c(e, t = document.documentElement) {
28
+ function l(e, t = document.documentElement) {
28
29
  let n = t?.shadowRoot ?? t;
29
- if (e.core && !r && (u("dialtone-css-core", e.core, n), r = !0), e.baseColors && !n?.querySelector("#dialtone-css-base-colors") && u("dialtone-css-base-colors", e.baseColors, n), e.brand) {
30
- let r = a?.brand;
31
- r && e.brand.name === r ? (d("dialtone-css-brand", n), t?.setAttribute("data-dt-brand", r), t?.setAttribute("data-dt-material", a?.material ?? "sandstone")) : (u("dialtone-css-brand", e.brand.css, n), t?.setAttribute("data-dt-brand", e.brand.name), m(e, t));
30
+ if (e.core && !i && (d("dialtone-css-core", e.core, n), i = !0), e.baseColors && !n?.querySelector("#dialtone-css-base-colors") && d("dialtone-css-base-colors", e.baseColors, n), e.brand) {
31
+ let r = o?.brand;
32
+ r && e.brand.name === r ? (f("dialtone-css-brand", n), t?.setAttribute("data-dt-brand", r), g(o?.material ?? "sandstone", t)) : (d("dialtone-css-brand", e.brand.css, n), t?.setAttribute("data-dt-brand", e.brand.name), h(e, t));
32
33
  }
33
- e.contrast && (u("dialtone-css-contrast", e.contrast.css, n), t?.setAttribute("data-dt-contrast", e.contrast.name));
34
+ e.contrast && (d("dialtone-css-contrast", e.contrast.css, n), t?.setAttribute("data-dt-contrast", e.contrast.name));
34
35
  }
35
- function l(t, n) {
36
- let a = ++i;
37
- t ? (u("dialtone-css-core", e.core, n), r = !0) : (u("dialtone-css-core", "", n), import("./core-no-layers.js").then(({ default: e }) => {
38
- a === i && (u("dialtone-css-core", e.core, n), r = !0);
36
+ function u(e, n, r = null) {
37
+ let o = ++a;
38
+ if (e) {
39
+ d("dialtone-css-core", t.core, n), i = !0;
40
+ return;
41
+ }
42
+ if (r) {
43
+ d("dialtone-css-core", r.core, n), i = !0;
44
+ return;
45
+ }
46
+ d("dialtone-css-core", "", n), import("./core-no-layers.js").then(({ default: e }) => {
47
+ o === a && (d("dialtone-css-core", e.core, n), i = !0);
39
48
  }).catch((e) => {
40
- a === i && console.error("[Dialtone] initDialtoneTheme: failed to load no-layers core tokens.", e);
41
- }));
49
+ o === a && console.error("[Dialtone] initDialtoneTheme: failed to load no-layers core tokens.", e);
50
+ });
42
51
  }
43
- function u(e, t, n, r = null) {
52
+ function d(e, t, n, r = null) {
44
53
  if (n?.querySelector("#" + e)) {
45
54
  let r = n.querySelector("#" + e);
46
55
  r.innerHTML = t;
@@ -51,10 +60,10 @@ function u(e, t, n, r = null) {
51
60
  o && o.parentNode === a ? a.insertBefore(i, o) : a?.appendChild(i);
52
61
  }
53
62
  }
54
- function d(e, t) {
63
+ function f(e, t) {
55
64
  t?.querySelector("#" + e)?.remove();
56
65
  }
57
- function f(e, t = document.documentElement) {
66
+ function p(e, t = document.documentElement) {
58
67
  if (e !== "light" && e !== "dark") {
59
68
  console.warn(`Invalid mode: ${e}. Must be 'light' or 'dark'`);
60
69
  return;
@@ -65,7 +74,7 @@ function f(e, t = document.documentElement) {
65
74
  }
66
75
  t?.setAttribute("data-dt-mode", e);
67
76
  }
68
- function p(e, t = document.documentElement) {
77
+ function m(e, t = document.documentElement) {
69
78
  if (!e || typeof e != "object") throw TypeError("[Dialtone] setBaseBrand: brandTheme must be an object. Import a brand theme like: import Dp from '@dialpad/dialtone-tokens/themes/dp';");
70
79
  if (!e.brand || typeof e.brand != "object") throw TypeError("[Dialtone] setBaseBrand: brandTheme.brand must be an object with {name, css} properties.");
71
80
  if (typeof e.brand.name != "string" || !e.brand.name || typeof e.brand.css != "string") throw TypeError("[Dialtone] setBaseBrand: brandTheme.brand.name must be a non-empty string and brandTheme.brand.css must be a string.");
@@ -74,83 +83,87 @@ function p(e, t = document.documentElement) {
74
83
  return;
75
84
  }
76
85
  let n = t?.shadowRoot ?? t;
77
- u("dialtone-css-brand-base", e.brand.css, n), t?.setAttribute("data-dt-brand", e.brand.name), m(e, t), d("dialtone-css-brand", n), a && (a.brand = e.brand.name, a.material = v(e) ?? "sandstone");
86
+ d("dialtone-css-brand-base", e.brand.css, n), t?.setAttribute("data-dt-brand", e.brand.name), h(e, t), f("dialtone-css-brand", n), o && (o.brand = e.brand.name, o.material = b(e) ?? "sandstone");
78
87
  }
79
- function m(e, t) {
80
- let r = e.material?.name;
81
- if (r) {
82
- if (n.has(r)) {
83
- t?.setAttribute("data-dt-material", r);
88
+ function h(e, t) {
89
+ let n = e.material?.name;
90
+ if (n) {
91
+ if (r.has(n)) {
92
+ g(n, t);
84
93
  return;
85
94
  }
86
- console.warn(`[Dialtone] setBaseBrand: brand '${e.brand.name}' declares unknown material '${r}'; falling back to sandstone.`), t?.setAttribute("data-dt-material", "sandstone");
95
+ console.warn(`[Dialtone] setBaseBrand: brand '${e.brand.name}' declares unknown material '${n}'; falling back to sandstone.`), g("sandstone", t);
87
96
  }
88
97
  }
89
- function h(e, t = document.documentElement) {
98
+ function g(t, n) {
99
+ let r = n?.shadowRoot ?? n, i = e[t];
100
+ i ? d("dialtone-css-material", i.css, r) : f("dialtone-css-material", r), n?.setAttribute("data-dt-material", t);
101
+ }
102
+ function _(e, t = document.documentElement) {
90
103
  if (t instanceof ShadowRoot) {
91
104
  console.warn("[Dialtone] You passed a ShadowRoot directly to setContrast(). Please pass the host element instead. The function will access shadowRoot automatically.");
92
105
  return;
93
106
  }
94
107
  let n = t?.shadowRoot ?? t;
95
- e && e.contrast ? (u("dialtone-css-contrast", e.contrast.css, n), t?.setAttribute("data-dt-contrast", e.contrast.name)) : (d("dialtone-css-contrast", n), t?.setAttribute("data-dt-contrast", "default"));
108
+ e && e.contrast ? (d("dialtone-css-contrast", e.contrast.css, n), t?.setAttribute("data-dt-contrast", e.contrast.name)) : (f("dialtone-css-contrast", n), t?.setAttribute("data-dt-contrast", "default"));
96
109
  }
97
- function g(e, t = document.documentElement) {
110
+ function v(e, t = document.documentElement) {
98
111
  if (e != null && typeof e != "string") throw TypeError("[Dialtone] setMaterial: expected a string material name or null.");
99
112
  if (t instanceof ShadowRoot) {
100
113
  console.warn("[Dialtone] You passed a ShadowRoot directly to setMaterial(). Please pass the host element instead. The function will access shadowRoot automatically.");
101
114
  return;
102
115
  }
103
- let r = e || "sandstone";
104
- if (!n.has(r)) {
105
- console.warn(`[Dialtone] setMaterial: unknown material '${e}'; falling back to sandstone.`), t?.setAttribute("data-dt-material", "sandstone");
116
+ let n = e || "sandstone";
117
+ if (!r.has(n)) {
118
+ console.warn(`[Dialtone] setMaterial: unknown material '${e}'; falling back to sandstone.`), g("sandstone", t);
106
119
  return;
107
120
  }
108
- t?.setAttribute("data-dt-material", r);
121
+ g(n, t);
109
122
  }
110
- function _(t, n = "light", r = document.documentElement, i = {}) {
111
- let { layers: o = !0 } = i;
112
- if (!t || typeof t != "object") throw TypeError("[Dialtone] initDialtoneTheme: brandTheme must be an object. Import a brand theme like: import Dp from '@dialpad/dialtone-tokens/themes/dp';");
113
- if (!t.brand || typeof t.brand != "object") throw TypeError("[Dialtone] initDialtoneTheme: brandTheme.brand must be an object with {name, css} properties. Ensure you're importing a valid brand theme.");
114
- if (typeof t.brand.name != "string" || !t.brand.name || typeof t.brand.css != "string") throw TypeError("[Dialtone] initDialtoneTheme: brandTheme.brand.name must be a non-empty string and brandTheme.brand.css must be a string.");
123
+ function y(e, n = "light", r = document.documentElement, i = {}) {
124
+ let { layers: a = !0, core: s = null } = i;
125
+ if (!e || typeof e != "object") throw TypeError("[Dialtone] initDialtoneTheme: brandTheme must be an object. Import a brand theme like: import Dp from '@dialpad/dialtone-tokens/themes/dp';");
126
+ if (!e.brand || typeof e.brand != "object") throw TypeError("[Dialtone] initDialtoneTheme: brandTheme.brand must be an object with {name, css} properties. Ensure you're importing a valid brand theme.");
127
+ if (typeof e.brand.name != "string" || !e.brand.name || typeof e.brand.css != "string") throw TypeError("[Dialtone] initDialtoneTheme: brandTheme.brand.name must be a non-empty string and brandTheme.brand.css must be a string.");
115
128
  if (n !== "light" && n !== "dark") throw TypeError(`[Dialtone] initDialtoneTheme: mode must be 'light' or 'dark', got '${n}'.`);
116
129
  if (!r || typeof r != "object") throw TypeError("[Dialtone] initDialtoneTheme: rootNode must be an HTMLElement or host element with shadowRoot.");
117
130
  if (r instanceof ShadowRoot) {
118
131
  console.warn("[Dialtone] You passed a ShadowRoot directly to initDialtoneTheme(). Please pass the host element instead. The function will access shadowRoot automatically.\nCorrect: initDialtoneTheme(brand, mode, hostElement)\nIncorrect: initDialtoneTheme(brand, mode, hostElement.shadowRoot)");
119
132
  return;
120
133
  }
121
- let s = r?.shadowRoot ?? r;
134
+ let c = r?.shadowRoot ?? r;
122
135
  if (r === document.documentElement && document.querySelector("#dialtone-css-core") !== null) throw Error("[Dialtone] Cannot initialize theme on document.documentElement because theme styles already exist. You are likely in an embedded app/micro-frontend. You MUST pass your own container element as the rootNode parameter. Example: initDialtoneTheme(brandTheme, mode, myAppContainerElement)");
123
- let c = a;
124
- if (c) if (c.brand === t.brand.name && c.mode === n) {
125
- if (c.layers === o) {
126
- console.warn(`[Dialtone] Theme already initialized with brand '${t.brand.name}' and mode '${n}'. Re-applying the same theme may be unnecessary. If you need to switch themes dynamically, use setBaseBrand() or setMode() instead of calling initDialtoneTheme() again.`);
136
+ let l = o;
137
+ if (l) if (l.brand === e.brand.name && l.mode === n) {
138
+ if (l.layers === a) {
139
+ console.warn(`[Dialtone] Theme already initialized with brand '${e.brand.name}' and mode '${n}'. Re-applying the same theme may be unnecessary. If you need to switch themes dynamically, use setBaseBrand() or setMode() instead of calling initDialtoneTheme() again.`);
127
140
  return;
128
141
  }
129
- console.warn(`[Dialtone] Theme already initialized with brand '${t.brand.name}' and mode '${n}' using layers=${c.layers}. Reloading core tokens with layers=${o}.`), l(o, s), a.layers = o;
142
+ console.warn(`[Dialtone] Theme already initialized with brand '${e.brand.name}' and mode '${n}' using layers=${l.layers}. Reloading core tokens with layers=${a}.`), u(a, c, s), o.layers = a;
130
143
  return;
131
144
  } else {
132
- console.warn(`[Dialtone] Theme already initialized. Previous: brand='${c.brand}', mode='${c.mode}'. New: brand='${t.brand.name}', mode='${n}'. Re-initializing with different parameters. Consider using setBaseBrand()/setMode() for dynamic switching.`);
145
+ console.warn(`[Dialtone] Theme already initialized. Previous: brand='${l.brand}', mode='${l.mode}'. New: brand='${e.brand.name}', mode='${n}'. Re-initializing with different parameters. Consider using setBaseBrand()/setMode() for dynamic switching.`);
133
146
  return;
134
147
  }
135
- l(o, s), u("dialtone-css-base-colors", e.baseColors, s), f(n, r), r?.setAttribute("data-dt-contrast", "default"), r?.setAttribute("data-dt-material", "sandstone"), p(t, r), a = {
136
- brand: t.brand.name,
148
+ u(a, c, s), d("dialtone-css-base-colors", t.baseColors, c), p(n, r), r?.setAttribute("data-dt-contrast", "default"), r?.setAttribute("data-dt-material", "sandstone"), m(e, r), o = {
149
+ brand: e.brand.name,
137
150
  mode: n,
138
151
  contrast: "default",
139
- material: v(t) ?? "sandstone",
140
- layers: o
152
+ material: b(e) ?? "sandstone",
153
+ layers: a
141
154
  };
142
155
  }
143
- function v(e) {
156
+ function b(e) {
144
157
  return e?.material?.name ?? null;
145
158
  }
146
- var y = (e) => v(e) !== null, b = o, x = S;
147
- function S(e = document.documentElement) {
159
+ var x = (e) => b(e) !== null, S = s, C = w;
160
+ function w(e = document.documentElement) {
148
161
  if (e instanceof ShadowRoot) {
149
162
  console.warn("[Dialtone] You passed a ShadowRoot directly to resetBrand(). Please pass the host element instead. The function will access shadowRoot automatically.");
150
163
  return;
151
164
  }
152
165
  let t = e?.shadowRoot ?? e;
153
- a = null, r = !1, i++, d("dialtone-css-core", t), d("dialtone-css-base-colors", t), d("dialtone-css-material", t), d("dialtone-css-brand-base", t), d("dialtone-css-brand", t), d("dialtone-css-contrast", t), e?.removeAttribute("data-dt-mode"), e?.removeAttribute("data-dt-brand"), e?.removeAttribute("data-dt-contrast"), e?.removeAttribute("data-dt-material");
166
+ o = null, i = !1, a++, f("dialtone-css-core", t), f("dialtone-css-base-colors", t), f("dialtone-css-material", t), f("dialtone-css-brand-base", t), f("dialtone-css-brand", t), f("dialtone-css-contrast", t), e?.removeAttribute("data-dt-mode"), e?.removeAttribute("data-dt-brand"), e?.removeAttribute("data-dt-contrast"), e?.removeAttribute("data-dt-material");
154
167
  }
155
168
  //#endregion
156
- export { t as VALID_MATERIALS, v as getBrandMaterial, y as hasBrandMaterialLock, _ as initDialtoneTheme, S as resetBrand, x as resetTheme, p as setBaseBrand, o as setBrand, h as setContrast, g as setMaterial, f as setMode, b as setTheme };
169
+ export { n as VALID_MATERIALS, b as getBrandMaterial, x as hasBrandMaterialLock, y as initDialtoneTheme, w as resetBrand, C as resetTheme, m as setBaseBrand, s as setBrand, _ as setContrast, v as setMaterial, p as setMode, S as setTheme };
@@ -0,0 +1 @@
1
+ const e=require(`./chunks/chunk-qndmjIgv.js`);let t=require(`@dialpad/dialtone-tokens/layered/material/tokens-amethyst.css?inline`);t=e.t(t);let n=require(`@dialpad/dialtone-tokens/layered/material/tokens-graphite.css?inline`);n=e.t(n);let r=require(`@dialpad/dialtone-tokens/layered/material/tokens-iron.css?inline`);r=e.t(r);let i=require(`@dialpad/dialtone-tokens/layered/material/tokens-jade.css?inline`);i=e.t(i);let a=require(`@dialpad/dialtone-tokens/layered/material/tokens-steel.css?inline`);a=e.t(a);var o={amethyst:{name:`amethyst`,css:t.default},graphite:{name:`graphite`,css:n.default},iron:{name:`iron`,css:r.default},jade:{name:`jade`,css:i.default},steel:{name:`steel`,css:a.default}};module.exports=o;
@@ -0,0 +1,30 @@
1
+ import e from "@dialpad/dialtone-tokens/layered/material/tokens-amethyst.css?inline";
2
+ import t from "@dialpad/dialtone-tokens/layered/material/tokens-graphite.css?inline";
3
+ import n from "@dialpad/dialtone-tokens/layered/material/tokens-iron.css?inline";
4
+ import r from "@dialpad/dialtone-tokens/layered/material/tokens-jade.css?inline";
5
+ import i from "@dialpad/dialtone-tokens/layered/material/tokens-steel.css?inline";
6
+ //#region themes/materials.js
7
+ var a = {
8
+ amethyst: {
9
+ name: "amethyst",
10
+ css: e
11
+ },
12
+ graphite: {
13
+ name: "graphite",
14
+ css: t
15
+ },
16
+ iron: {
17
+ name: "iron",
18
+ css: n
19
+ },
20
+ jade: {
21
+ name: "jade",
22
+ css: r
23
+ },
24
+ steel: {
25
+ name: "steel",
26
+ css: i
27
+ }
28
+ };
29
+ //#endregion
30
+ export { a as default };
@@ -0,0 +1,5 @@
1
+ export function initDialtoneThemeNoLayers(brandTheme: BrandTheme, mode?: Mode, rootNode?: ThemeRootNode, options?: Object): void;
2
+ export type BrandTheme = import('./config.js').BrandTheme;
3
+ export type Mode = import('./config.js').Mode;
4
+ export type ThemeRootNode = import('./config.js').ThemeRootNode;
5
+ //# sourceMappingURL=config-no-layers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config-no-layers.d.ts","sourceRoot":"","sources":["../../../themes/config-no-layers.js"],"names":[],"mappings":"AAgCA,sDAZW,UAAU,SACV,IAAI,aACJ,aAAa,YACb,MAAM,QAWhB;yBA9BY,OAAO,aAAa,EAAE,UAAU;mBAChC,OAAO,aAAa,EAAE,IAAI;4BAC1B,OAAO,aAAa,EAAE,aAAa"}
@@ -5,6 +5,7 @@ export function setContrast(contrastTheme: ContrastTheme | null, rootNode?: Them
5
5
  export function setMaterial(name: MaterialName | null, rootNode?: ThemeRootNode): void;
6
6
  export function initDialtoneTheme(brandTheme: BrandTheme, mode?: Mode, rootNode?: ThemeRootNode, options?: {
7
7
  layers?: boolean | undefined;
8
+ core?: CoreTheme | undefined;
8
9
  }): void;
9
10
  export function getBrandMaterial(brandTheme: BrandTheme): string | null;
10
11
  export function resetBrand(rootNode?: HTMLElement): void;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../themes/config.js"],"names":[],"mappings":"AA4GA,gCAzBW,MAAM,GAAC,IAAI,aACX,aAAa,kBACb,MAAM,GAAC,IAAI,QAmDrB;AAmKD,8BAhBW,IAAI,aACJ,aAAa,QA+BvB;AAyBD,yCAjBW,UAAU,aACV,aAAa,QA6DvB;AAiDD,2CArBW,aAAa,GAAC,IAAI,aAClB,aAAa,QAsCvB;AAqBD,kCAPW,YAAY,GAAC,IAAI,aACjB,aAAa,QA+BvB;AAuDD,8CA7CW,UAAU,SACV,IAAI,aACJ,aAAa,YAErB;IAA0B,MAAM;CAMhC,QA8JF;AAMD,6CAHW,UAAU,GACR,MAAM,GAAC,IAAI,CAIvB;AAuCD,yDAiCC;AAvuBD,gDAA6G;AAqqBtG,iDAHI,UAAU,GACR,OAAO,CAEqE;AAtkBzF,gCAzBW,MAAM,GAAC,IAAI,aACX,aAAa,kBACb,MAAM,GAAC,IAAI,QAmDrB;AA2kBD,yDAiCC;mBAntBY,OAAO,GAAC,MAAM;4BAKd,WAAW,GAAC,UAAU;;UAOrB,MAAM;gBACN,MAAM;;;WAOjB;QAAyB,IAAI,EAAlB,MAAM;QACQ,GAAG,EAAjB,MAAM;KACjB;;;;;;cAQA;QAA4B,IAAI,EAArB,MAAM;QACW,GAAG,EAApB,MAAM;KACnB;;2BAGY,WAAW,GAAC,OAAO,GAAC,UAAU,GAAC,MAAM,GAAC,UAAU,GAAC,MAAM"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../themes/config.js"],"names":[],"mappings":"AAgHA,gCAzBW,MAAM,GAAC,IAAI,aACX,aAAa,kBACb,MAAM,GAAC,IAAI,QAmDrB;AAkLD,8BAhBW,IAAI,aACJ,aAAa,QA+BvB;AAyBD,yCAjBW,UAAU,aACV,aAAa,QA6DvB;AAmED,2CArBW,aAAa,GAAC,IAAI,aAClB,aAAa,QAsCvB;AAyBD,kCAPW,YAAY,GAAC,IAAI,aACjB,aAAa,QA+BvB;AAkED,8CAxDW,UAAU,SACV,IAAI,aACJ,aAAa,YAErB;IAA0B,MAAM;IASJ,IAAI;CAGhC,QAmKF;AAMD,6CAHW,UAAU,GACR,MAAM,GAAC,IAAI,CAIvB;AAuCD,yDAgCC;AAtxBD,gDAA6G;AAqtBtG,iDAHI,UAAU,GACR,OAAO,CAEqE;AAtnBzF,gCAzBW,MAAM,GAAC,IAAI,aACX,aAAa,kBACb,MAAM,GAAC,IAAI,QAmDrB;AA2nBD,yDAgCC;mBAlwBY,OAAO,GAAC,MAAM;4BAKd,WAAW,GAAC,UAAU;;UAOrB,MAAM;gBACN,MAAM;;;WAOjB;QAAyB,IAAI,EAAlB,MAAM;QACQ,GAAG,EAAjB,MAAM;KACjB;;;;;;cAQA;QAA4B,IAAI,EAArB,MAAM;QACW,GAAG,EAApB,MAAM;KACnB;;2BAGY,WAAW,GAAC,OAAO,GAAC,UAAU,GAAC,MAAM,GAAC,UAAU,GAAC,MAAM"}
@@ -0,0 +1,28 @@
1
+ declare namespace _default {
2
+ namespace amethyst {
3
+ export let name: string;
4
+ export { MaterialAmethyst as css };
5
+ }
6
+ namespace graphite {
7
+ let name_1: string;
8
+ export { name_1 as name };
9
+ export { MaterialGraphite as css };
10
+ }
11
+ namespace iron {
12
+ let name_2: string;
13
+ export { name_2 as name };
14
+ export { MaterialIron as css };
15
+ }
16
+ namespace jade {
17
+ let name_3: string;
18
+ export { name_3 as name };
19
+ export { MaterialJade as css };
20
+ }
21
+ namespace steel {
22
+ let name_4: string;
23
+ export { name_4 as name };
24
+ export { MaterialSteel as css };
25
+ }
26
+ }
27
+ export default _default;
28
+ //# sourceMappingURL=materials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"materials.d.ts","sourceRoot":"","sources":["../../../themes/materials.js"],"names":[],"mappings":""}
@@ -2733,25 +2733,18 @@ var Bi = {
2733
2733
  return {
2734
2734
  ...this.parent?.(),
2735
2735
  toggleCodeBlock: (e = {}) => ({ state: t, chain: n, commands: r }) => {
2736
- let i = t.schema.nodes[this.name], { $from: a } = t.selection;
2737
- if (a.parent.type === i) {
2738
- let e = t.schema.nodes.paragraph, r = a.parent.textContent.split("\n"), i = a.before(), o = a.parent;
2739
- return n().command(({ tr: n }) => {
2740
- let a = r.map((n) => e.create({}, n ? [t.schema.text(n)] : []));
2741
- return n.replaceWith(i, i + o.nodeSize, a), !0;
2742
- }).run();
2743
- }
2744
- let { from: o, to: s } = t.selection, c = [];
2745
- if (t.doc.nodesBetween(o, s, (e, t) => {
2746
- if (e.isTextblock) return c.push({
2736
+ let i = t.schema.nodes[this.name], { $from: a, $to: o } = t.selection, s = [];
2737
+ return t.doc.nodesBetween(a.pos, o.pos, (e, t) => {
2738
+ if (e.isTextblock) return s.push({
2747
2739
  node: e,
2748
2740
  pos: t
2749
2741
  }), !1;
2750
- }), c.length <= 1) return r.setNode(this.name, e);
2751
- let l = c.map(({ node: e }) => e.textContent).join("\n"), u = c[0].pos, d = c[c.length - 1], f = d.pos + d.node.nodeSize;
2752
- return n().command(({ tr: n }) => {
2753
- let r = l.length ? [t.schema.text(l)] : [];
2754
- return n.replaceWith(u, f, i.create(e, r)), !0;
2742
+ }), s.length <= 1 ? r.toggleNode(this.name, "paragraph", e) : s.every(({ node: e }) => e.type === i) ? r.toggleNode(this.name, "paragraph") : n().setNode(this.name, e).command(({ tr: e }) => {
2743
+ for (let n = s.length - 1; n > 0; n--) {
2744
+ let r = e.mapping.map(s[n].pos), a = r - 1;
2745
+ e.doc.resolve(a).parent.type === i && e.replaceWith(a, r + 1, t.schema.text("\n"));
2746
+ }
2747
+ return !0;
2755
2748
  }).run();
2756
2749
  }
2757
2750
  };
@@ -3080,4 +3073,4 @@ var Wi = /* @__PURE__ */ i(Vi, [["render", Ui]]);
3080
3073
  //#endregion
3081
3074
  export { Wi as t };
3082
3075
 
3083
- //# sourceMappingURL=RichTextEditor-DKpulIyi.js.map
3076
+ //# sourceMappingURL=RichTextEditor-CzMY0oVT.js.map