@hazem3500/komo 0.9.37 → 0.9.38
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.
- package/README.md +1 -0
- package/dist/adapters/class-theme.js +1 -1
- package/dist/adapters/tailwind.js +1 -1
- package/dist/chunk-CIOHAE5J.js +1 -0
- package/dist/{chunk-CLVBIZMH.js → chunk-HHOQUW5B.js} +1 -1
- package/dist/chunk-WNJLJD4A.js +1 -0
- package/dist/design-comment-BYUC2WXI.js +1 -0
- package/dist/design-comment.d.ts +13 -1
- package/dist/{design-export-44WHYCLI.js → design-export-47CRMQ2M.js} +1 -1
- package/dist/design-mode.js +1 -1
- package/dist/{design-panel-7XSEHKNG.js → design-panel-RSY5OPUN.js} +1 -1
- package/dist/design-preview.d.ts +1 -0
- package/dist/design-system.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/{inline-text-editor-LN5QPR3P.js → inline-text-editor-ADEGBENA.js} +1 -1
- package/dist/node.mjs +1 -1
- package/dist/react-props-panel-5VXPVY3H.js +1 -0
- package/dist/react-props-panel.d.ts +2 -2
- package/dist/react.js +1 -1
- package/dist/{select-menu-ZUYNQ5VF.js → select-menu-6V2OGRHY.js} +1 -1
- package/dist/server.js +1 -1
- package/dist/setup.js +1 -1
- package/dist/token-adapter.d.ts +7 -2
- package/dist/token-picker-QETCH45O.js +1 -0
- package/dist/token-picker.d.ts +2 -3
- package/package.json +1 -1
- package/server/setup-client.txt +48 -46
- package/dist/chunk-4JLPHVWU.js +0 -1
- package/dist/design-comment-A5LYSE7M.js +0 -1
- package/dist/react-props-panel-YVEKJH4C.js +0 -1
- package/dist/token-picker-TKKRI4FY.js +0 -1
package/README.md
CHANGED
|
@@ -274,6 +274,7 @@ initKomo({ project, design: { tokens: tailwindTokens({ tokens }, { themes: [mode
|
|
|
274
274
|
- Previews replace table classes the new class fully covers, keep everything else in place, and stack; undoing restores the original `class` exactly. Classes outside the table, such as `text-[14px]`, are left alone.
|
|
275
275
|
- `tailwindSpacing({ prefix, scale, steps })` narrows the families (`p`, `px`, `py`, `pt`, `pr`, `pb`, `pl`, `m`, `mx`, …, `gap`, `gap-x`, `gap-y`), the pixels per step (default 4), and the steps (default Tailwind's 0 to 96). Paths are `spacing.<class>`, for example `spacing.p-4`.
|
|
276
276
|
- `classTheme` options take `class`, `attribute`, or both, on `target()` (default `<html>`). An option with neither is the default. With `colorScheme`, applying an option sets `color-scheme` to its `colorScheme` or id, and returning to the starting option restores the page's own value.
|
|
277
|
+
- Theme changes refresh semantic previews, field values, open token pickers and unsaved proposals without adding an edit. `classTheme` observes its target. Custom axes may provide `subscribe(listener): () => void` for host state changes; axes without it detect changes carried on `<html>` or `<body>` attributes. Custom literals and saved comment bodies keep their recorded values.
|
|
277
278
|
|
|
278
279
|
## Agent CLI
|
|
279
280
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var e=e=>(Array.isArray(e.class)?e.class:[e.class??""]).flatMap(e=>e.split(/\s+/)).filter(Boolean);function t(t){let o,r=t.target??(()=>document.documentElement),i=t=>e(t).length+Object.keys(t.attribute??{}).length,l=(t,o)=>e(o).every(e=>t.classList.contains(e))&&Object.entries(o.attribute??{}).every(([e,o])=>t.getAttribute(e)===o);function s(){let e,o=r();for(let r of t.options)l(o,r)&&(!e||i(r)>i(e))&&(e=r);return(e??t.options[0])?.id??""}return{id:t.id,...t.label?{label:t.label}:{},options:t.options.map(({id:e,label:t})=>({id:e,...t?{label:t}:{}})),current:s,subscribe(e){let t=s(),o=new MutationObserver(()=>{let o=s();o!==t&&(t=o,e())});return o.observe(r(),{attributes:!0}),()=>o.disconnect()},apply(i){let l=t.options.find(e=>e.id===i);if(!l)return;let n=r(),c=n.style;o??={option:s(),colorScheme:c?.colorScheme??""};for(let o of t.options)if(o!==l){n.classList.remove(...e(o));for(let[e,t]of Object.entries(o.attribute??{}))n.getAttribute(e)===t&&!(e in(l.attribute??{}))&&n.removeAttribute(e)}n.classList.add(...e(l));for(let[e,t]of Object.entries(l.attribute??{}))n.setAttribute(e,t);t.colorScheme&&c&&(c.colorScheme=i===o.option?o.colorScheme:l.colorScheme??l.id)}}}export{t as classTheme};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function e(e){return e instanceof HTMLElement||e instanceof SVGElement}var t=["top","right","bottom","left"],r={padding:t.map(e=>`padding-${e}`),margin:t.map(e=>`margin-${e}`),gap:["row-gap","column-gap"],"border-radius":["top-left","top-right","bottom-right","bottom-left"].map(e=>`border-${e}-radius`),"border-width":t.map(e=>`border-${e}-width`),"border-color":t.map(e=>`border-${e}-color`)},n=e=>(Array.isArray(e)?e:[e]).flatMap(e=>e.split(/\s+/)).filter(Boolean),a=e=>e.getAttribute("class"),l=e=>e.includes(":")?null:e.replace(/^!|!$/g,"");function i(e,t={}){let r,n=0;for(let[a,l]of Object.entries(e.values??{})){let e=a.split("+");e.every(e=>{let[r,n]=e.split("=");return void 0===n?Object.values(t).includes(r):t[r]===n})&&e.length>n&&([r,n]=[l,e.length])}return r??e.value??""}function s(t,s={}){let o=t.tokens.map(e=>({token:e,classes:n(e.class),covers:new Set(e.properties.flatMap(e=>[e,...r[e]??[]]))})),p=new Map;for(let e of o)for(let t of e.classes)p.set(t,e);let g=new Map(o.map(e=>[e.token.path,e])),d=!1===s.offToken?[]:s.offToken??[...new Set(t.tokens.flatMap(e=>e.properties))],c=new WeakMap,u=e=>(e??"").split(/\s+/).flatMap(e=>{let t=l(e),r=t?p.get(t):void 0;return r?[{name:e,entry:r}]:[]});function f(e,t){if(!t.stack.length)return null===t.original?e.removeAttribute("class"):e.setAttribute("class",t.original),void c.delete(e);e.setAttribute("class",t.stack.reduce((e,t)=>function(e,t,n){let a=e.split(/\s+/).filter(Boolean),i=n.classes[0],s=-1,o=a.filter((e,a)=>{let i=l(e),o=i?p.get(i):void 0,g=!!o&&(o===n||[...o.covers].every(e=>n.covers.has(e))&&(o.covers.has(t)||(r[t]??[]).some(e=>o.covers.has(e))));return g&&s<0&&(s=a),!g}),g=a.slice(0,s<0?a.length:s).filter(e=>o.includes(e)).length;return o.splice(g,0,i),o.join(" ")}(e,t.property,t.entry),t.original??""))}return{id:"tailwind",list(e){let t=e??Object.fromEntries((s.themes??[]).map(e=>[e.id,e.current()]));return o.map(({token:e,classes:r})=>({path:e.path,type:e.type,value:i(e,t),properties:[...e.properties],ref:r[0],...e.label?{label:e.label}:{},...e.group?{group:e.group}:{},...e.description?{description:e.description}:{},...e.states?{states:[...e.states]}:{}}))},resolve(t){let n,l={},i=function(e){let t=new Map;for(let r of u(e))for(let e of r.entry.covers){let n=t.get(e);(!n||r.entry.covers.size<=n.entry.covers.size)&&t.set(e,r)}for(let[e,n]of t)r[e]?.some(e=>t.get(e)?.entry!==n.entry)&&t.delete(e);return t}(a(t));if(e(t)){for(let[e,r]of i){let n=t.style.getPropertyValue(e),a=r.name.startsWith("!")||r.name.endsWith("!");n&&(!a||"important"===t.style.getPropertyPriority(e))&&i.delete(e)}for(let[e,t]of i)r[e]?.some(e=>i.get(e)?.entry!==t.entry)&&i.delete(e)}for(let[e,t]of i)l[e]={path:t.entry.token.path};for(let e of d){if(i.has(e)||r[e]?.some(e=>i.has(e)))continue;n??=getComputedStyle(t);let a=n.getPropertyValue(e);a&&(l[e]={offToken:a})}return l},preview(t,r,n){let l=g.get(n.path);if(!l)return()=>{};let i=c.get(t)??{original:a(t),stack:[],inline:new Map};c.set(t,i),e(t)&&(i.inline.has(r)||i.inline.set(r,function(e,t){let r=e.getAttribute("style"),n=e.style.cssText,a=e.style.getPropertyValue(t),l=e.style.getPropertyPriority(t),i=getComputedStyle(e).getPropertyValue(t).trim(),s=r=>{let n=e.ownerDocument.createElement("span").style;return n.cssText=r,n.setProperty(t,""),n.cssText},o=s(n);return{value:a,priority:l,computed:i,restore(){s(e.style.cssText)===o?null===r?(e.getAttribute("style"),e.removeAttribute("style")):e.setAttribute("style",r):(e.style.setProperty(t,a,l),null===r&&!e.style.length&&function(e){e.style.length||(e.getAttribute("style"),e.removeAttribute("style"))}(e))}}}(t,r)),t.style.setProperty(r,""));let s={property:r,entry:l};return i.stack.push(s),f(t,i),()=>{let e=i.stack.indexOf(s);e<0||(i.stack.splice(e,1),f(t,i),i.stack.some(e=>e.property===r)||(i.inline.get(r)?.restore(),i.inline.delete(r)))}},describe(e,t,r,n){let l=g.get(n.path)?.classes[0]??n.ref??n.path;if("path"in r){let t=g.get(r.path),n=c.get(e)?.original??a(e),i=u(n).find(e=>e.entry===t)?.name??t?.classes[0]??r.path;return i===l?`Keep class "${l}"`:`Replace class "${i}" with "${l}"`}return`Add class "${l}"`}}}var o={p:["Padding",["padding"]],px:["Padding",["padding-left","padding-right"]],py:["Padding",["padding-top","padding-bottom"]],pt:["Padding",["padding-top"]],pr:["Padding",["padding-right"]],pb:["Padding",["padding-bottom"]],pl:["Padding",["padding-left"]],m:["Margin",["margin"]],mx:["Margin",["margin-left","margin-right"]],my:["Margin",["margin-top","margin-bottom"]],mt:["Margin",["margin-top"]],mr:["Margin",["margin-right"]],mb:["Margin",["margin-bottom"]],ml:["Margin",["margin-left"]],gap:["Gap",["gap"]],"gap-x":["Gap",["column-gap"]],"gap-y":["Gap",["row-gap"]]},p=[0,.5,1,1.5,2,2.5,3,3.5,4,5,6,7,8,9,10,11,12,14,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96];function g(e={}){let t=e.scale??4,r=e.steps??p;return(e.prefix??Object.keys(o)).flatMap(e=>{let n=o[e];if(!n)throw new Error(`komo: unknown spacing prefix "${e}"`);return r.map(r=>{let a=`${e}-${r}`;return{path:`spacing.${a}`,type:"dimension",class:a,properties:n[1],value:r*t+"px",group:n[0],label:a}})})}export{p as defaultSpacingSteps,g as tailwindSpacing,s as tailwindTokens,i as tokenValue};
|
|
1
|
+
function e(e){return e instanceof HTMLElement||e instanceof SVGElement}var t=["top","right","bottom","left"],r={padding:t.map(e=>`padding-${e}`),margin:t.map(e=>`margin-${e}`),gap:["row-gap","column-gap"],"border-radius":["top-left","top-right","bottom-right","bottom-left"].map(e=>`border-${e}-radius`),"border-width":t.map(e=>`border-${e}-width`),"border-color":t.map(e=>`border-${e}-color`)},n=e=>(Array.isArray(e)?e:[e]).flatMap(e=>e.split(/\s+/)).filter(Boolean),a=e=>e.getAttribute("class"),l=e=>e.includes(":")?null:e.replace(/^!|!$/g,"");function i(e,t={}){let r,n=0;for(let[a,l]of Object.entries(e.values??{})){let e=a.split("+");e.every(e=>{let[r,n]=e.split("=");return void 0===n?Object.values(t).includes(r):t[r]===n})&&e.length>n&&([r,n]=[l,e.length])}return r??e.value??""}function s(t,s={}){let o=t.tokens.map(e=>({token:e,classes:n(e.class),covers:new Set(e.properties.flatMap(e=>[e,...r[e]??[]]))})),p=new Map;for(let e of o)for(let t of e.classes)p.set(t,e);let g=new Map(o.map(e=>[e.token.path,e])),d=!1===s.offToken?[]:s.offToken??[...new Set(t.tokens.flatMap(e=>e.properties))],c=new WeakMap,u=e=>(e??"").split(/\s+/).flatMap(e=>{let t=l(e),r=t?p.get(t):void 0;return r?[{name:e,entry:r}]:[]});function f(e,t){if(!t.stack.length)return null===t.original?e.removeAttribute("class"):e.setAttribute("class",t.original),void c.delete(e);e.setAttribute("class",t.stack.reduce((e,t)=>function(e,t,n){let a=e.split(/\s+/).filter(Boolean),i=n.classes[0],s=-1,o=a.filter((e,a)=>{let i=l(e),o=i?p.get(i):void 0,g=!!o&&(o===n||[...o.covers].every(e=>n.covers.has(e))&&(o.covers.has(t)||(r[t]??[]).some(e=>o.covers.has(e))));return g&&s<0&&(s=a),!g}),g=a.slice(0,s<0?a.length:s).filter(e=>o.includes(e)).length;return o.splice(g,0,i),o.join(" ")}(e,t.property,t.entry),t.original??""))}return{id:"tailwind",list(e){let t=e??Object.fromEntries((s.themes??[]).map(e=>[e.id,e.current()]));return o.map(({token:e,classes:r})=>({path:e.path,type:e.type,value:i(e,t),properties:[...e.properties],ref:r[0],...e.label?{label:e.label}:{},...e.group?{group:e.group}:{},...e.description?{description:e.description}:{},...e.states?{states:[...e.states]}:{}}))},resolve(t){let n,l={},i=function(e){let t=new Map;for(let r of u(e))for(let e of r.entry.covers){let n=t.get(e);(!n||r.entry.covers.size<=n.entry.covers.size)&&t.set(e,r)}for(let[e,n]of t)r[e]?.some(e=>t.get(e)?.entry!==n.entry)&&t.delete(e);return t}(a(t));if(e(t)){for(let[e,r]of i){let n=t.style.getPropertyValue(e),a=r.name.startsWith("!")||r.name.endsWith("!");n&&(!a||"important"===t.style.getPropertyPriority(e))&&i.delete(e)}for(let[e,t]of i)r[e]?.some(e=>i.get(e)?.entry!==t.entry)&&i.delete(e)}for(let[e,t]of i)l[e]={path:t.entry.token.path};for(let e of d){if(i.has(e)||r[e]?.some(e=>i.has(e)))continue;n??=getComputedStyle(t);let a=n.getPropertyValue(e);a&&(l[e]={offToken:a})}return l},preview(t,r,n){let l=g.get(n.path);if(!l)return()=>{};let i=c.get(t)??{original:a(t),stack:[],inline:new Map};c.set(t,i),e(t)&&(i.inline.has(r)||i.inline.set(r,function(e,t){let r=e.getAttribute("style"),n=e.style.cssText,a=e.style.getPropertyValue(t),l=e.style.getPropertyPriority(t),i=getComputedStyle(e).getPropertyValue(t).trim(),s=r=>{let n=e.ownerDocument.createElement("span").style;return n.cssText=r,n.setProperty(t,""),n.cssText},o=s(n);return{value:a,priority:l,computed:i,absent:null===r,restore(){s(e.style.cssText)===o?null===r?(e.getAttribute("style"),e.removeAttribute("style")):e.setAttribute("style",r):(e.style.setProperty(t,a,l),null===r&&!e.style.length&&function(e){e.style.length||(e.getAttribute("style"),e.removeAttribute("style"))}(e))}}}(t,r)),t.style.setProperty(r,""));let s={property:r,entry:l};return i.stack.push(s),f(t,i),()=>{let e=i.stack.indexOf(s);e<0||(i.stack.splice(e,1),f(t,i),i.stack.some(e=>e.property===r)||(i.inline.get(r)?.restore(),i.inline.delete(r)))}},describe(e,t,r,n){let l=g.get(n.path)?.classes[0]??n.ref??n.path;if("path"in r){let t=g.get(r.path),n=c.get(e)?.original??a(e),i=u(n).find(e=>e.entry===t)?.name??t?.classes[0]??r.path;return i===l?`Keep class "${l}"`:`Replace class "${i}" with "${l}"`}return`Add class "${l}"`}}}var o={p:["Padding",["padding"]],px:["Padding",["padding-left","padding-right"]],py:["Padding",["padding-top","padding-bottom"]],pt:["Padding",["padding-top"]],pr:["Padding",["padding-right"]],pb:["Padding",["padding-bottom"]],pl:["Padding",["padding-left"]],m:["Margin",["margin"]],mx:["Margin",["margin-left","margin-right"]],my:["Margin",["margin-top","margin-bottom"]],mt:["Margin",["margin-top"]],mr:["Margin",["margin-right"]],mb:["Margin",["margin-bottom"]],ml:["Margin",["margin-left"]],gap:["Gap",["gap"]],"gap-x":["Gap",["column-gap"]],"gap-y":["Gap",["row-gap"]]},p=[0,.5,1,1.5,2,2.5,3,3.5,4,5,6,7,8,9,10,11,12,14,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96];function g(e={}){let t=e.scale??4,r=e.steps??p;return(e.prefix??Object.keys(o)).flatMap(e=>{let n=o[e];if(!n)throw new Error(`komo: unknown spacing prefix "${e}"`);return r.map(r=>{let a=`${e}-${r}`;return{path:`spacing.${a}`,type:"dimension",class:a,properties:n[1],value:r*t+"px",group:n[0],label:a}})})}export{p as defaultSpacingSteps,g as tailwindSpacing,s as tailwindTokens,i as tokenValue};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e,g as t}from"./chunk-WNJLJD4A.js";import{a as r}from"./chunk-RPY7OOOR.js";var n=new Map,o=new Map,a=new WeakMap,s=new WeakMap,i=new Map,f=new WeakMap,l=!1;function p(e,t){let r=o.get(e);r?.delete(t),r?.size||o.delete(e)}function u(t,i,f,l,p){let u=a.get(t);if(u||a.set(t,u=new Map),(!u.has(i)||!n.has(t)&&!o.has(t))&&(u.set(i,f),r(t))){let r=s.get(t);r||s.set(t,r=new Map);let n=e(t,i),o={adapter:l,style:n,token:void 0};o.style={...n,get computed(){return o.token?.value??n.computed}},r.set(i,o)}return d(t,l,p),u.get(i)}function c(e,t){return e?a.get(e)?.get(t):void 0}function d(e,t,r){for(let[n,o]of s.get(e)??[]){if(o.adapter!==t)continue;let a=c(e,n);o.token=a&&"path"in a?r.find(e=>e.path===a.path):void 0}}function h(e,t,r){if(o.get(e)?.has(t))return{offToken:getComputedStyle(e).getPropertyValue(t).trim()};let n=N(e,t);return n?{path:n.path}:r}function g(e,t){if(!a.get(e)?.has(t))return;let r=o.get(e),n=r?.has(t)??!1,s=a.get(e)?.get(t),i=!!N(e,t)||!!s&&"path"in s;return r||o.set(e,r=new Set),r.add(t),{priority:"important",...!n&&i?{undo:()=>{p(e,t),l||(L(!0),L(!1))}}:{}}}function m(e,t){return s.get(e)?.get(t)?.style??n.get(e)?.find(e=>e.property===t)?.inline}function y(e){let t={};for(let r of e?.themes??[])try{t[r.id]=r.current()}catch{}return t}function v(e,t,r,n){if(n.aborted||!e?.themes?.length)return;let o=JSON.stringify(y(e)),a=()=>{let t=JSON.stringify(y(e));t===o||n.aborted||(o=t,r())},s=[],i=!1;for(let t of e.themes)try{t.subscribe?s.push(t.subscribe(a)):i=!0}catch{i=!0}let f=i?new MutationObserver(a):void 0;f?.observe(t.documentElement,{attributes:!0}),t.body&&f?.observe(t.body,{attributes:!0}),n.addEventListener("abort",()=>{f?.disconnect();for(let e of s)e()},{once:!0})}function k(e,t={}){let r=f.get(e);r||f.set(e,r=new Map);let n=JSON.stringify(Object.entries(t).sort()),o=r.get(n);return o||(o=Promise.resolve().then(()=>e.list(Object.keys(t).length?t:void 0)).then(e=>Array.isArray(e)?e.filter(e=>e&&"string"==typeof e.path):[]),o.catch(()=>r.delete(n)),r.set(n,o)),o}function b(e,t){return Promise.resolve().then(()=>e.resolve(t)).then(e=>e??{},()=>({}))}function w(e,t){return e.filter(e=>e.properties?.includes(t))}function $(e){let t,r=e.trim().toLowerCase().replace(/\s+/g," "),n=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/.exec(r)?.[1];if(n)t=(n.length<5?[...n].map(e=>e+e).join(""):n).match(/../g).map((e,t)=>parseInt(e,16)/(t>2?255:1));else{let e=/^rgba?\(([^)]*)\)$/.exec(r)?.[1].split(/\s*[,/]\s*|\s+/);e&&(3===e.length||4===e.length)&&e.every(e=>/^[\d.]+%?$/.test(e))&&(t=e.map((e,t)=>parseFloat(e)*(e.endsWith("%")?t>2?.01:2.55:1)))}if(!t)return r.replace(/\s*,\s*/g,",");let[o,a,s,i=1]=t.map((e,t)=>t>2?+e.toFixed(2):Math.round(e));return 1===i?`rgb(${o},${a},${s})`:`rgba(${o},${a},${s},${i})`}function M(e,t){let r=$(t);return r?e.find(e=>"string"==typeof e.value&&$(e.value)===r):void 0}function S(e){return e.label||e.path}function j(e,t=e.value,r){return[e.path,e.ref,t,r,e.states?.length?`States: ${e.states.join(", ")}`:"",e.description].filter(Boolean).join(" · ")}function O(){let e=document.createElement("span");return e.className="design-token-off",e.setAttribute("role","img"),e}function T(e,t,r){e.title=`Not from a token · ${t||"unset"}${r?` · matches ${S(r)}`:""}`,e.setAttribute("aria-label",e.title)}function A(n,o,a,s){let i=r(o)?e(o,a):void 0;try{r(o)&&o.style.setProperty(a,"");let e=n.preview?n.preview(o,a,s):t(o,a,s.value),f=!0;return()=>{f&&(f=!1,e?.(),i?.restore())}}catch{throw i?.restore(),new Error("This token could not be previewed.")}}function N(e,t){if(!o.get(e)?.has(t))return[...n.get(e)??[]].reverse().find(e=>e.property===t)?.token}function P(t,a,s,i,f,l){let u=n.get(a);u||n.set(a,u=[]);let c=u.find(e=>e.property===s),d=r(a)?e(a,s):void 0,h=o.get(a)?.has(s)??!1,g=A(t,a,s,i);return p(a,s),u.push({adapter:t,property:s,token:i,from:c?.from??f,fromToken:c?c.fromToken:l,undo:g,inline:d,customBefore:h}),()=>x(a)}function x(e){let t=n.get(e),r=t?.pop();if(r?.undo(),r?.customBefore){let t=o.get(e);t||o.set(e,t=new Set),t.add(r.property)}else r&&p(e,r.property);t&&!t.length&&n.delete(e)}function E(e){return!!n.get(e)?.length}function J(e){return!!o.get(e)?.size}function W(e){for(;n.has(e);)x(e);o.delete(e)}function B(){for(let e of[...n.keys()])W(e);o.clear(),i.clear()}function z(e){return[...new Set(n.get(e)?.map(e=>e.property))].filter(t=>!o.get(e)?.has(t))}function L(t){if(t!==l){l=t,t&&(i=new Map([...o].flatMap(([t,n])=>r(t)?[[t,new Map([...n].map(r=>[r,e(t,r)]))]]:[])));for(let[o,a]of n)if(t)for(let e of[...a].reverse())e.undo();else for(let t of a)t.customBefore&&t.inline?.restore(),r(o)&&(t.inline=e(o,t.property)),t.undo=A(t.adapter,o,t.property,t.token);if(!t){for(let e of i.values())for(let t of e.values())t.restore();i.clear()}}}function C(e,t){let r=l;r||L(!0);for(let r of new Set([...n.keys(),...o.keys()]))d(r,e,t);for(let r of n.values())for(let n of r)n.adapter===e&&(n.token=t.find(e=>e.path===n.token.path)??n.token,"path"in n.from&&(n.fromToken=t.find(e=>e.path===n.from.path)));r||L(!1)}function F(e,t){try{let r=t.adapter.describe?.(e,t.property,t.from,t.token);return r?String(r).replace(/\s+/g," ").replace(/→/g,"->").trim().slice(0,300):void 0}catch{return}}function R(e){let t=[],r=new Set;for(let a of function(e){let t=new Map;for(let r of n.get(e)??[])t.set(r.property,r);return[...t.values()].filter(t=>!(o.get(e)?.has(t.property)||"path"in t.from&&t.from.path===t.token.path))}(e)){r.add(a.adapter.id);let n="path"in a.from?`${a.fromToken?.value?`${a.fromToken.value} `:""}[${a.from.path}]`:a.from.offToken||"(unset)";t.push(`Element ${a.property}: ${n} → ${a.token.value} [${a.token.path}]`);let o=F(e,a);o&&t.push(`Apply: ${o}`)}if(t.length)return["Proposed design-token changes (preview only)",...t,`Token adapter: ${[...r].join(", ")}`].join("\n")}export{u as a,c as b,h as c,g as d,m as e,y as f,v as g,k as h,b as i,w as j,M as k,S as l,j as m,O as n,T as o,A as p,N as q,P as r,E as s,J as t,W as u,B as v,z as w,L as x,C as y,R as z};
|