@hazem3500/komo 0.9.29 → 0.9.30
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/dist/adapters/react-fiber.js +1 -1
- package/dist/adapters/react-preview.js +1 -1
- package/dist/chunk-UZLXJJJW.js +1 -0
- package/dist/design-mode.js +1 -1
- package/dist/{inline-text-editor-OMRCO3H3.js → inline-text-editor-HKKHLSNR.js} +1 -1
- package/dist/node.mjs +1 -1
- package/dist/{react-props-panel-Y7F2P3AG.js → react-props-panel-PD6ENV6Q.js} +1 -1
- package/dist/react.js +1 -1
- package/dist/server.js +1 -1
- package/package.json +1 -1
- package/server/setup-client.txt +1 -1
- package/dist/chunk-HTMUFH7I.js +0 -1
package/package.json
CHANGED
package/server/setup-client.txt
CHANGED
|
@@ -232,7 +232,7 @@ ${a.join(`
|
|
|
232
232
|
`),c=r.filter(u=>!u.startsWith("Component: ")||!l.some(f=>f.startsWith("Component: ")));l.splice(l[1]?.startsWith("Target: ")?2:1,0,...c),s[0]=l.join(`
|
|
233
233
|
`)}return s.join(`
|
|
234
234
|
|
|
235
|
-
`)||void 0}function Fj(e,t,n,o){if(n.aborted)return;let i=L("div","morphing-menu__tooltip sidebar-tooltip");i.setAttribute("aria-hidden","true"),t.append(i);let r=0,a=()=>{clearTimeout(r),delete i.dataset.open},s=l=>{let c=l.target.closest?.("[data-tip]");if(!c||l.type==="focusin"&&!c.matches(":focus-visible"))return a();clearTimeout(r),r=window.setTimeout(()=>{if(!c.isConnected)return;let u=c.getBoundingClientRect();i.textContent=c.dataset.tip??"";let f=i.offsetWidth/2;i.style.left=`${Math.max(8+f,Math.min(document.documentElement.clientWidth-8-f,u.left+u.width/2))}px`,i.style.top=`${u.top-8-i.offsetHeight}px`,i.dataset.open="true"},i.dataset.open?0:400)};e.addEventListener("pointerover",s,{signal:n}),e.addEventListener("focusin",s,{signal:n});for(let l of["pointerleave","pointerdown","focusout"])e.addEventListener(l,a,{signal:n});n.addEventListener("abort",()=>{a(),i.remove()}),(o.type==="focusin"||e.matches(":hover"))&&s(o)}var I6=_(()=>{"use strict";_n()});function W6(e,t){let n=J1.get(e.element);if(n?.editor===t)return n.component;let o={id:e.name,name:e.name,source:e.source??"",line:0,props:t.schema},i={definition:o,preview:"adapter",releaseProps:r=>t.release?.(r),subscribe:t.subscribe?.bind(t),get props(){return F6(o,t.read())},onChange:r=>t.apply(r),setProps(r){if(t.available?.()===!1)return;let a=F6(o,r);if(Object.keys(a).length!==Object.keys(r).length||o.props.some(s=>s.kind!=="unsupported"&&s.required&&!(s.name in a)))throw new Error("Component props no longer match the editor schema.");t.apply(a)}};return J1.set(e.element,{editor:t,component:i}),i}function Zj(e){return e===void 0||typeof e=="string"||typeof e=="number"&&Number.isFinite(e)||typeof e=="boolean"}function Hg(e,t){return t===void 0?!e.required:!Zj(t)||e.kind==="unsupported"?!1:e.kind==="string"?typeof t=="string"&&t.length<=500:e.kind==="number"?typeof t=="number"&&Number.isFinite(t):e.kind==="boolean"?typeof t=="boolean":e.kind==="enum"&&(e.values??[]).includes(t)}function F6(e,t){let n={};for(let o of e.props){if(o.kind==="unsupported")continue;let i=t[o.name];Hg(o,i)&&(n[o.name]=i)}return n}function So(e){let t=e&&Wj.get(e);if(t&&e.getAttribute("data-komo-inspectable")===t.definition.id)return t;let n=e&&J1.get(e);return n&&n.editor.available?.()!==!1?n.component:null}function jg(e){for(let t=e?.parentElement;t;t=t.parentElement){let n=So(t);if(n)return{root:t,component:n}}return null}var Wj,J1,Z6=_(()=>{"use strict";Wj=new WeakMap,J1=new WeakMap});function ko(e){if(!e)return null;let t=null;for(let n of ew)(n.root===e||n.root.contains(e))&&(!t||t.root.contains(n.root))&&(t=n);return t}function cc(e,t){return e.root.ownerDocument.defaultView?.getComputedStyle(e.root).getPropertyValue(t.cssVariable).trim()??""}function tw(e,t){try{return e.root.querySelectorAll(t.impactSelector).length}catch{return 0}}function Qj(e,t,n){if(!n||n.length>160||/[{};]/.test(n)||/(?:url|expression)\s*\(/i.test(n))return!1;let i=e.root.ownerDocument.defaultView?.CSS;return!i?.supports||t.properties.some(r=>i.supports(r,n))}function J6(e,t,n,o=!1){if(!e.tokens.some(u=>u===t||u.path===t.path)||!Qj(e,t,n))return!1;let i=cc(e,t),r=e.themeEdits.get(t.path),a=e.root.style.getPropertyValue(t.cssVariable),s=r?.inlineBefore??a,l=Io.get(e)??[];if(i===n)return!0;e.root.style.setProperty(t.cssVariable,n),n===(r?.before??i)?e.themeEdits.delete(t.path):e.themeEdits.set(t.path,{before:r?.before??i,after:n,inlineBefore:s});let c=l.at(-1);return o&&c?.kind==="theme"&&c.token.path===t.path?n===c.before?l.pop():c.after=n:l.push({kind:"theme",source:e,token:t,before:i,after:n,inlineBefore:a}),Io.set(e,l),!0}function e8(e){for(let t of ew)for(let[n,o]of t.themeEdits){let i=t.tokens.find(a=>a.path===n)?.cssVariable;if(!i)continue;let r=e?o.inlineBefore:o.after;r?t.root.style.setProperty(i,r):t.root.style.removeProperty(i)}}function t8(e,t){let n=e.themeEdits.get(t.path),o=Io.get(e)??[],i=o.find(a=>a.kind==="theme"&&a.token.path===t.path),r=n?.inlineBefore??(i?.kind==="theme"?i.inlineBefore:void 0);r!==void 0&&(r?e.root.style.setProperty(t.cssVariable,r):e.root.style.removeProperty(t.cssVariable),e.themeEdits.delete(t.path),Io.set(e,o.filter(a=>a.kind!=="theme"||a.token.path!==t.path)))}function n8(e,t,n,o,i={}){if(!e.tokens.some(x=>x.path===n.path)||!n.properties.includes(o))return!1;let r=e.elementOriginals.get(t);r||e.elementOriginals.set(t,r=new Map),r.has(o)||r.set(o,{value:t.style.getPropertyValue(o),priority:t.style.getPropertyPriority(o)});let a=t.style.getPropertyValue(o),s=t.style.getPropertyPriority(o),l=`var(${n.cssVariable})`,c=e.elementBindings.get(t);c||e.elementBindings.set(t,c=new Map);let u=c.get(o);if(c.set(o,{tokenPath:n.path,initialValue:u?.initialValue??a,initialPriority:u?.initialPriority??s,mode:"token",declaredPath:u?u.declaredPath:Od(e,t,o)?.token.path}),t.style.setProperty(o,l,s),i.recordHistory===!1)return!0;let f={kind:"element",element:t,property:o,before:a,priority:s,after:l},d=Io.get(e)??[];d.push(f),Io.set(e,d);let g=Ms.get(t)??[];return g.push(f),Ms.set(t,g),!0}function nw(e,t,n,o){let i=e.elementBindings.get(t),r=i?.get(n);if(!r){let a=Od(e,t,n);if(!a)return;i||e.elementBindings.set(t,i=new Map),r={tokenPath:a.token.path,initialValue:t.style.getPropertyValue(n),initialPriority:t.style.getPropertyPriority(n),mode:"custom",declaredPath:a.token.path},i.set(n,r)}r.mode="custom",r.customValue=o}function o8(e,t,n){let o=e.elementBindings.get(t)?.get(n);if(!o)return;let i=t.style.getPropertyValue(n);if(i===o.initialValue&&t.style.getPropertyPriority(n)===o.initialPriority){e.elementBindings.get(t)?.delete(n);return}e.tokens.find(a=>a.path===o.tokenPath&&a.properties.includes(n)&&i===`var(${a.cssVariable})`)?(o.mode="token",delete o.customValue):(o.mode="custom",o.customValue=i)}function ow(e,t,n){let o=e.elementBindings.get(t)?.get(n);return o?{...o}:null}function Q6(e,t,n,o){let i=[...n.matchAll(/var\(\s*(--[\w-]+)/g)].map(a=>a[1]);if(!i.length||o&&!/^var\(\s*--[\w-]+\s*(?:,[^;{}]*)?\)$/.test(n.trim()))return;let r=e.tokens.filter(a=>a.properties.includes(t)&&i.includes(a.cssVariable));return r.length===1?r[0]:void 0}function eN(e){let t=e.replace(/:(?:where)\([^)]*\)/g,"").replace(/"[^"]*"|'[^']*'/g,""),n=t.match(/#[\w-]+/g)?.length??0,o=t.match(/\.[\w-]+|\[[^\]]*\]|:(?!:)[\w-]+/g)?.length??0,i=t.match(/(?:^|[\s>+~(])[a-z][\w-]*/gi)?.length??0;return n*1e4+o*100+i}function tN(e){let t=[],n=0,o=0;for(let i=0;i<e.length;i++){let r=e[i];r==="("||r==="["?n++:r===")"||r==="]"?n--:r===","&&n===0&&(t.push(e.slice(o,i)),o=i+1)}return t.push(e.slice(o)),t.map(i=>i.trim()).filter(Boolean)}function Od(e,t,n,o=t.style.getPropertyValue(n),i=t.style.getPropertyPriority(n)){let r=t.ownerDocument.defaultView,a=null,s=0,l=f=>{for(let d of f){s++;let g=d.media;if(g&&r?.matchMedia&&g.mediaText&&!r.matchMedia(g.mediaText).matches)continue;let x=d.style,y=d.selectorText;if(x&&y)for(let m of[n,...Jj[n]??[]]){let b=x.getPropertyValue(m).trim();if(!b)continue;let h=-1;for(let w of tN(y))try{t.matches(w)&&(h=Math.max(h,eN(w)))}catch{}if(!(h<0)){h+=x.getPropertyPriority(m)?1e9:0,(!a||h>a.rank||h===a.rank&&s>=a.order)&&(a={value:b,property:m,rank:h,order:s});break}}let E=d.cssRules;E&&!x&&l(E)}};for(let f of t.ownerDocument.styleSheets)try{f.disabled||l(f.cssRules)}catch{}let c=a;if(o&&!(c&&c.rank>=1e9&&!i)){let f=Q6(e,n,o,!0);return f?{token:f,origin:"inline"}:null}if(!c)return null;let u=Q6(e,n,c.value,c.property===n);return u?{token:u,origin:"stylesheet"}:null}function i8(e,t,n){let o=e.elementBindings.get(t)?.get(n),i=e.elementOriginals.get(t)?.get(n),r=o?.initialValue??i?.value??"",a=o?.initialPriority??i?.priority??"";r?t.style.setProperty(n,r,a):t.style.removeProperty(n),e.elementBindings.get(t)?.delete(n)}function iw(e,t){return e.tokens.filter(n=>n.properties.includes(t))}function r8(e){let t=ko(e);return!!t&&(t.themeEdits.size>0||!!Ms.get(e)?.length||!!t.elementBindings.get(e)?.size)}function a8(e){let t=ko(e);return!!t&&!!Io.get(t)?.length}function s8(e){let t=ko(e),n=t&&Io.get(t)?.pop();if(!t||!n)return;if(n.kind==="theme"){n.inlineBefore?t.root.style.setProperty(n.token.cssVariable,n.inlineBefore):t.root.style.removeProperty(n.token.cssVariable);let i=t.themeEdits.get(n.token.path);if(i&&i.after===n.after)i.before===n.before?t.themeEdits.delete(n.token.path):t.themeEdits.set(n.token.path,{...i,after:n.before});else if(!i){let r=Io.get(t).find(a=>a.kind==="theme"&&a.token.path===n.token.path);t.themeEdits.set(n.token.path,{before:n.after,after:n.before,inlineBefore:(r?.kind==="theme"?r:n).inlineBefore})}return}n.before?n.element.style.setProperty(n.property,n.before,n.priority):n.element.style.removeProperty(n.property);let o=Ms.get(n.element)??[];o.pop(),o.length||Ms.delete(n.element)}function rw(e){let t=ko(e);if(!t)return;for(let[o,i]of t.themeEdits){let r=t.tokens.find(a=>a.path===o);r&&(i.inlineBefore?t.root.style.setProperty(r.cssVariable,i.inlineBefore):t.root.style.removeProperty(r.cssVariable))}t.themeEdits.clear();let n=t.elementOriginals.get(e);for(let[o,i]of n??[])i.value?e.style.setProperty(o,i.value,i.priority):e.style.removeProperty(o);t.elementOriginals.delete(e),t.elementBindings.delete(e),Ms.delete(e),Io.set(t,(Io.get(t)??[]).filter(o=>o.kind==="element"&&o.element!==e))}function l8(){for(let e of ew){for(let t of[e.root,...e.elementOriginals.keys(),...e.elementBindings.keys()])rw(t);Io.set(e,[])}}function aw(e){let t=ko(e);if(!t)return;let n=[];for(let[o,i]of t.elementBindings.get(e)??[]){let r=t.tokens.find(l=>l.path===i.tokenPath&&l.properties.includes(o));if(!r)continue;let a=t.tokens.find(l=>l.path===i.declaredPath),s=a?`var(${a.cssVariable}) [${a.path}]`:i.initialValue||"(unset)";i.mode==="token"?a!==r&&n.push(`Element ${o}: ${s} \u2192 var(${r.cssVariable}) [${r.path}]${a?" [rebind]":""}`):n.push(`Element ${o}: ${s} \u2192 ${i.customValue||"(unset)"} [${a?"custom override":"custom value"}]`)}for(let o of Ms.get(e)??[]){if(o.kind!=="element"||t.elementBindings.get(e)?.has(o.property))continue;let i=t.tokens.find(r=>o.after===`var(${r.cssVariable})`);i&&n.push(`Element ${o.property}: ${o.before||"(unset)"} \u2192 var(${i.cssVariable}) [${i.path}]`)}for(let[o,i]of t.themeEdits){let r=t.tokens.find(a=>a.path===o);r&&n.push(`Shared theme ${o} (${r.cssVariable}): ${i.before} \u2192 ${i.after}; preview scope ${r.impactSelector} (${tw(t,r)} matching elements)`)}if(n.length)return["Proposed design-token changes (preview only)",...n,"Token references are preserved for element assignments; refresh resets previews."].join(`
|
|
235
|
+
`)||void 0}function Fj(e,t,n,o){if(n.aborted)return;let i=L("div","morphing-menu__tooltip sidebar-tooltip");i.setAttribute("aria-hidden","true"),t.append(i);let r=0,a=()=>{clearTimeout(r),delete i.dataset.open},s=l=>{let c=l.target.closest?.("[data-tip]");if(!c||l.type==="focusin"&&!c.matches(":focus-visible"))return a();clearTimeout(r),r=window.setTimeout(()=>{if(!c.isConnected)return;let u=c.getBoundingClientRect();i.textContent=c.dataset.tip??"";let f=i.offsetWidth/2;i.style.left=`${Math.max(8+f,Math.min(document.documentElement.clientWidth-8-f,u.left+u.width/2))}px`,i.style.top=`${u.top-8-i.offsetHeight}px`,i.dataset.open="true"},i.dataset.open?0:400)};e.addEventListener("pointerover",s,{signal:n}),e.addEventListener("focusin",s,{signal:n});for(let l of["pointerleave","pointerdown","focusout"])e.addEventListener(l,a,{signal:n});n.addEventListener("abort",()=>{a(),i.remove()}),(o.type==="focusin"||e.matches(":hover"))&&s(o)}var I6=_(()=>{"use strict";_n()});function W6(e,t){let n=J1.get(e.element);if(n?.editor===t)return n.component;let o={id:e.name,name:e.name,source:e.source??"",line:0,props:t.schema},i={definition:o,preview:"adapter",releaseProps:r=>t.release?.(r),subscribe:t.subscribe?.bind(t),get props(){return F6(o,t.read())},onChange:r=>t.apply(r),setProps(r){if(t.available?.()===!1)throw new Error("This component instance is no longer available.");let a=F6(o,r);if(Object.keys(a).length!==Object.keys(r).length||o.props.some(s=>s.kind!=="unsupported"&&s.required&&!(s.name in a)))throw new Error("Component props no longer match the editor schema.");t.apply(a)}};return J1.set(e.element,{editor:t,component:i}),i}function Zj(e){return e===void 0||typeof e=="string"||typeof e=="number"&&Number.isFinite(e)||typeof e=="boolean"}function Hg(e,t){return t===void 0?!e.required:!Zj(t)||e.kind==="unsupported"?!1:e.kind==="string"?typeof t=="string"&&t.length<=500:e.kind==="number"?typeof t=="number"&&Number.isFinite(t):e.kind==="boolean"?typeof t=="boolean":e.kind==="enum"&&(e.values??[]).includes(t)}function F6(e,t){let n={};for(let o of e.props){if(o.kind==="unsupported")continue;let i=t[o.name];Hg(o,i)&&(n[o.name]=i)}return n}function So(e){let t=e&&Wj.get(e);if(t&&e.getAttribute("data-komo-inspectable")===t.definition.id)return t;let n=e&&J1.get(e);return n&&n.editor.available?.()!==!1?n.component:null}function jg(e){for(let t=e?.parentElement;t;t=t.parentElement){let n=So(t);if(n)return{root:t,component:n}}return null}var Wj,J1,Z6=_(()=>{"use strict";Wj=new WeakMap,J1=new WeakMap});function ko(e){if(!e)return null;let t=null;for(let n of ew)(n.root===e||n.root.contains(e))&&(!t||t.root.contains(n.root))&&(t=n);return t}function cc(e,t){return e.root.ownerDocument.defaultView?.getComputedStyle(e.root).getPropertyValue(t.cssVariable).trim()??""}function tw(e,t){try{return e.root.querySelectorAll(t.impactSelector).length}catch{return 0}}function Qj(e,t,n){if(!n||n.length>160||/[{};]/.test(n)||/(?:url|expression)\s*\(/i.test(n))return!1;let i=e.root.ownerDocument.defaultView?.CSS;return!i?.supports||t.properties.some(r=>i.supports(r,n))}function J6(e,t,n,o=!1){if(!e.tokens.some(u=>u===t||u.path===t.path)||!Qj(e,t,n))return!1;let i=cc(e,t),r=e.themeEdits.get(t.path),a=e.root.style.getPropertyValue(t.cssVariable),s=r?.inlineBefore??a,l=Io.get(e)??[];if(i===n)return!0;e.root.style.setProperty(t.cssVariable,n),n===(r?.before??i)?e.themeEdits.delete(t.path):e.themeEdits.set(t.path,{before:r?.before??i,after:n,inlineBefore:s});let c=l.at(-1);return o&&c?.kind==="theme"&&c.token.path===t.path?n===c.before?l.pop():c.after=n:l.push({kind:"theme",source:e,token:t,before:i,after:n,inlineBefore:a}),Io.set(e,l),!0}function e8(e){for(let t of ew)for(let[n,o]of t.themeEdits){let i=t.tokens.find(a=>a.path===n)?.cssVariable;if(!i)continue;let r=e?o.inlineBefore:o.after;r?t.root.style.setProperty(i,r):t.root.style.removeProperty(i)}}function t8(e,t){let n=e.themeEdits.get(t.path),o=Io.get(e)??[],i=o.find(a=>a.kind==="theme"&&a.token.path===t.path),r=n?.inlineBefore??(i?.kind==="theme"?i.inlineBefore:void 0);r!==void 0&&(r?e.root.style.setProperty(t.cssVariable,r):e.root.style.removeProperty(t.cssVariable),e.themeEdits.delete(t.path),Io.set(e,o.filter(a=>a.kind!=="theme"||a.token.path!==t.path)))}function n8(e,t,n,o,i={}){if(!e.tokens.some(x=>x.path===n.path)||!n.properties.includes(o))return!1;let r=e.elementOriginals.get(t);r||e.elementOriginals.set(t,r=new Map),r.has(o)||r.set(o,{value:t.style.getPropertyValue(o),priority:t.style.getPropertyPriority(o)});let a=t.style.getPropertyValue(o),s=t.style.getPropertyPriority(o),l=`var(${n.cssVariable})`,c=e.elementBindings.get(t);c||e.elementBindings.set(t,c=new Map);let u=c.get(o);if(c.set(o,{tokenPath:n.path,initialValue:u?.initialValue??a,initialPriority:u?.initialPriority??s,mode:"token",declaredPath:u?u.declaredPath:Od(e,t,o)?.token.path}),t.style.setProperty(o,l,s),i.recordHistory===!1)return!0;let f={kind:"element",element:t,property:o,before:a,priority:s,after:l},d=Io.get(e)??[];d.push(f),Io.set(e,d);let g=Ms.get(t)??[];return g.push(f),Ms.set(t,g),!0}function nw(e,t,n,o){let i=e.elementBindings.get(t),r=i?.get(n);if(!r){let a=Od(e,t,n);if(!a)return;i||e.elementBindings.set(t,i=new Map),r={tokenPath:a.token.path,initialValue:t.style.getPropertyValue(n),initialPriority:t.style.getPropertyPriority(n),mode:"custom",declaredPath:a.token.path},i.set(n,r)}r.mode="custom",r.customValue=o}function o8(e,t,n){let o=e.elementBindings.get(t)?.get(n);if(!o)return;let i=t.style.getPropertyValue(n);if(i===o.initialValue&&t.style.getPropertyPriority(n)===o.initialPriority){e.elementBindings.get(t)?.delete(n);return}e.tokens.find(a=>a.path===o.tokenPath&&a.properties.includes(n)&&i===`var(${a.cssVariable})`)?(o.mode="token",delete o.customValue):(o.mode="custom",o.customValue=i)}function ow(e,t,n){let o=e.elementBindings.get(t)?.get(n);return o?{...o}:null}function Q6(e,t,n,o){let i=[...n.matchAll(/var\(\s*(--[\w-]+)/g)].map(a=>a[1]);if(!i.length||o&&!/^var\(\s*--[\w-]+\s*(?:,[^;{}]*)?\)$/.test(n.trim()))return;let r=e.tokens.filter(a=>a.properties.includes(t)&&i.includes(a.cssVariable));return r.length===1?r[0]:void 0}function eN(e){let t=e.replace(/:(?:where)\([^)]*\)/g,"").replace(/"[^"]*"|'[^']*'/g,""),n=t.match(/#[\w-]+/g)?.length??0,o=t.match(/\.[\w-]+|\[[^\]]*\]|:(?!:)[\w-]+/g)?.length??0,i=t.match(/(?:^|[\s>+~(])[a-z][\w-]*/gi)?.length??0;return n*1e4+o*100+i}function tN(e){let t=[],n=0,o=0;for(let i=0;i<e.length;i++){let r=e[i];r==="("||r==="["?n++:r===")"||r==="]"?n--:r===","&&n===0&&(t.push(e.slice(o,i)),o=i+1)}return t.push(e.slice(o)),t.map(i=>i.trim()).filter(Boolean)}function Od(e,t,n,o=t.style.getPropertyValue(n),i=t.style.getPropertyPriority(n)){let r=t.ownerDocument.defaultView,a=null,s=0,l=f=>{for(let d of f){s++;let g=d.media;if(g&&r?.matchMedia&&g.mediaText&&!r.matchMedia(g.mediaText).matches)continue;let x=d.style,y=d.selectorText;if(x&&y)for(let m of[n,...Jj[n]??[]]){let b=x.getPropertyValue(m).trim();if(!b)continue;let h=-1;for(let w of tN(y))try{t.matches(w)&&(h=Math.max(h,eN(w)))}catch{}if(!(h<0)){h+=x.getPropertyPriority(m)?1e9:0,(!a||h>a.rank||h===a.rank&&s>=a.order)&&(a={value:b,property:m,rank:h,order:s});break}}let E=d.cssRules;E&&!x&&l(E)}};for(let f of t.ownerDocument.styleSheets)try{f.disabled||l(f.cssRules)}catch{}let c=a;if(o&&!(c&&c.rank>=1e9&&!i)){let f=Q6(e,n,o,!0);return f?{token:f,origin:"inline"}:null}if(!c)return null;let u=Q6(e,n,c.value,c.property===n);return u?{token:u,origin:"stylesheet"}:null}function i8(e,t,n){let o=e.elementBindings.get(t)?.get(n),i=e.elementOriginals.get(t)?.get(n),r=o?.initialValue??i?.value??"",a=o?.initialPriority??i?.priority??"";r?t.style.setProperty(n,r,a):t.style.removeProperty(n),e.elementBindings.get(t)?.delete(n)}function iw(e,t){return e.tokens.filter(n=>n.properties.includes(t))}function r8(e){let t=ko(e);return!!t&&(t.themeEdits.size>0||!!Ms.get(e)?.length||!!t.elementBindings.get(e)?.size)}function a8(e){let t=ko(e);return!!t&&!!Io.get(t)?.length}function s8(e){let t=ko(e),n=t&&Io.get(t)?.pop();if(!t||!n)return;if(n.kind==="theme"){n.inlineBefore?t.root.style.setProperty(n.token.cssVariable,n.inlineBefore):t.root.style.removeProperty(n.token.cssVariable);let i=t.themeEdits.get(n.token.path);if(i&&i.after===n.after)i.before===n.before?t.themeEdits.delete(n.token.path):t.themeEdits.set(n.token.path,{...i,after:n.before});else if(!i){let r=Io.get(t).find(a=>a.kind==="theme"&&a.token.path===n.token.path);t.themeEdits.set(n.token.path,{before:n.after,after:n.before,inlineBefore:(r?.kind==="theme"?r:n).inlineBefore})}return}n.before?n.element.style.setProperty(n.property,n.before,n.priority):n.element.style.removeProperty(n.property);let o=Ms.get(n.element)??[];o.pop(),o.length||Ms.delete(n.element)}function rw(e){let t=ko(e);if(!t)return;for(let[o,i]of t.themeEdits){let r=t.tokens.find(a=>a.path===o);r&&(i.inlineBefore?t.root.style.setProperty(r.cssVariable,i.inlineBefore):t.root.style.removeProperty(r.cssVariable))}t.themeEdits.clear();let n=t.elementOriginals.get(e);for(let[o,i]of n??[])i.value?e.style.setProperty(o,i.value,i.priority):e.style.removeProperty(o);t.elementOriginals.delete(e),t.elementBindings.delete(e),Ms.delete(e),Io.set(t,(Io.get(t)??[]).filter(o=>o.kind==="element"&&o.element!==e))}function l8(){for(let e of ew){for(let t of[e.root,...e.elementOriginals.keys(),...e.elementBindings.keys()])rw(t);Io.set(e,[])}}function aw(e){let t=ko(e);if(!t)return;let n=[];for(let[o,i]of t.elementBindings.get(e)??[]){let r=t.tokens.find(l=>l.path===i.tokenPath&&l.properties.includes(o));if(!r)continue;let a=t.tokens.find(l=>l.path===i.declaredPath),s=a?`var(${a.cssVariable}) [${a.path}]`:i.initialValue||"(unset)";i.mode==="token"?a!==r&&n.push(`Element ${o}: ${s} \u2192 var(${r.cssVariable}) [${r.path}]${a?" [rebind]":""}`):n.push(`Element ${o}: ${s} \u2192 ${i.customValue||"(unset)"} [${a?"custom override":"custom value"}]`)}for(let o of Ms.get(e)??[]){if(o.kind!=="element"||t.elementBindings.get(e)?.has(o.property))continue;let i=t.tokens.find(r=>o.after===`var(${r.cssVariable})`);i&&n.push(`Element ${o.property}: ${o.before||"(unset)"} \u2192 var(${i.cssVariable}) [${i.path}]`)}for(let[o,i]of t.themeEdits){let r=t.tokens.find(a=>a.path===o);r&&n.push(`Shared theme ${o} (${r.cssVariable}): ${i.before} \u2192 ${i.after}; preview scope ${r.impactSelector} (${tw(t,r)} matching elements)`)}if(n.length)return["Proposed design-token changes (preview only)",...n,"Token references are preserved for element assignments; refresh resets previews."].join(`
|
|
236
236
|
`)}var ew,Ms,Io,Jj,c8=_(()=>{"use strict";ew=new Set,Ms=new WeakMap,Io=new WeakMap;Jj={"background-color":["background"],"border-color":["border"],"font-family":["font"],"font-size":["font"],"font-weight":["font"],"line-height":["font"]}});function Ng(e){let t={};for(let n of e?.themes??[])try{t[n.id]=n.current()}catch{}return t}function sw(e,t={}){let n=u8.get(e);n||u8.set(e,n=new Map);let o=JSON.stringify(Object.entries(t).sort()),i=n.get(o);return i||(i=Promise.resolve().then(()=>e.list(Object.keys(t).length?t:void 0)).then(r=>Array.isArray(r)?r.filter(a=>a&&typeof a.path=="string"):[]),i.catch(()=>n.delete(o)),n.set(o,i)),i}function f8(e,t){return Promise.resolve().then(()=>e.resolve(t)).then(n=>n??{},()=>({}))}function m8(e,t){return e.filter(n=>n.properties?.includes(t))}function p8(e){let t=e.trim().toLowerCase().replace(/\s+/g," "),n=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/.exec(t)?.[1],o;if(n)o=(n.length<5?[...n].map(c=>c+c).join(""):n).match(/../g).map((c,u)=>parseInt(c,16)/(u>2?255:1));else{let l=/^rgba?\(([^)]*)\)$/.exec(t)?.[1].split(/\s*[,/]\s*|\s+/);l&&(l.length===3||l.length===4)&&l.every(c=>/^[\d.]+%?$/.test(c))&&(o=l.map((c,u)=>parseFloat(c)*(c.endsWith("%")?u>2?.01:2.55:1)))}if(!o)return t.replace(/\s*,\s*/g,",");let[i,r,a,s=1]=o.map((l,c)=>c>2?+l.toFixed(2):Math.round(l));return s===1?`rgb(${i},${r},${a})`:`rgba(${i},${r},${a},${s})`}function lw(e,t){let n=p8(t);return n?e.find(o=>typeof o.value=="string"&&p8(o.value)===n):void 0}function Bg(e){return e.label||e.path}function cw(e){return[e.path,e.ref,e.value,e.states?.length?`States: ${e.states.join(", ")}`:"",e.description].filter(Boolean).join(" \xB7 ")}function uw(){let e=document.createElement("span");return e.className="design-token-off",e.setAttribute("role","img"),e}function dw(e,t,n){e.title=`Not from a token \xB7 ${t||"unset"}${n?` \xB7 matches ${Bg(n)}`:""}`,e.setAttribute("aria-label",e.title)}function Vg(e,t,n,o){try{if(e.preview)return e.preview(t,n,o)??(()=>{})}catch{return()=>{}}return Ss(t,n,o.value)}function pw(e,t){return[...fi.get(e)??[]].reverse().find(n=>n.property===t)?.token}function g8(e,t,n,o,i,r){let a=fi.get(t);a||fi.set(t,a=[]);let s=a.find(l=>l.property===n);return a.push({adapter:e,property:n,token:o,from:s?.from??i,fromToken:s?s.fromToken:r,undo:Vg(e,t,n,o)}),()=>h8(t)}function h8(e){let t=fi.get(e);t?.pop()?.undo(),t&&!t.length&&fi.delete(e)}function fw(e){return!!fi.get(e)?.length}function mw(e){for(;fi.has(e);)h8(e)}function b8(){for(let e of[...fi.keys()])mw(e)}function y8(e){return[...new Set(fi.get(e)?.map(t=>t.property))]}function x8(e){if(e!==d8){d8=e;for(let[t,n]of fi)if(e)for(let o of[...n].reverse())o.undo();else for(let o of n)o.undo=Vg(o.adapter,t,o.property,o.token)}}function nN(e){let t=new Map;for(let n of fi.get(e)??[])t.set(n.property,n);return[...t.values()].filter(n=>!("path"in n.from)||n.from.path!==n.token.path)}function oN(e,t){try{let n=t.adapter.describe?.(e,t.property,t.from,t.token);return n?String(n).replace(/\s+/g," ").replace(/→/g,"->").trim().slice(0,300):void 0}catch{return}}function v8(e){let t=[],n=new Set;for(let o of nN(e)){n.add(o.adapter.id);let i="path"in o.from?`${o.fromToken?.value?`${o.fromToken.value} `:""}[${o.from.path}]`:o.from.offToken||"(unset)";t.push(`Element ${o.property}: ${i} \u2192 ${o.token.value} [${o.token.path}]`);let r=oN(e,o);r&&t.push(`Apply: ${r}`)}if(t.length)return["Proposed design-token changes (preview only)",...t,`Token adapter: ${[...n].join(", ")}`].join(`
|
|
237
237
|
`)}var fi,u8,d8,w8=_(()=>{"use strict";Rd();fi=new Map,u8=new WeakMap,d8=!1});var C8={};In(C8,{isTokenPickerOpen:()=>k8,openTokenPicker:()=>A8,toggleTokenPicker:()=>cN,tokenLabel:()=>hw});function hw(e){return e.label||e.path.slice(e.path.lastIndexOf(".")+1)||e.path}function T8(e){let t=/^(-?[\d.]+)(px|r?em)?$/.exec(e.trim());return t?parseFloat(t[1])*(t[2]?t[2]==="px"?1:16:1):void 0}function aN(e){let t=e.trim().split(/\s+/),n=t.find(i=>/^(\d{3}|bold|bolder|lighter)$/.test(i)),o=t.find(i=>/^[\d.]+(px|r?em|pt|%)(\/\S+)?$/.test(i));return[n,o].filter(Boolean).join(" \xB7 ")||e}function sN(e,t){let n=document.createElement("span");n.className="komo-tokens__pv",n.setAttribute("aria-hidden","true");let o=a=>{let s=document.createElement("span");return s.className=`komo-tokens__${a}`,n.append(s),s},i=e.value??"",{type:r}=e;if(r==="color"){let a=o("sw"),s=t.map(l=>l.values.get(e.path)).filter(l=>!!l);for(let l of new Set(s).size>1?s:[i]){let c=document.createElement("span");S8(l)?c.style.background=l:(c.dataset.unresolved="",c.textContent="?"),a.append(c)}}else if(r==="dimension"||r==="letterSpacing"){let a=T8(i);if(a===void 0)return n;let s=/radius/.test(`${e.path} ${e.properties?.join(" ")}`),l=o(s?"corner":"dim");s?l.style.borderTopLeftRadius=`${Ds(a,0,12)}px`:l.style.width=`${Ds(a/2,2,24)}px`}else if(r==="shadow")o("shadow").style.boxShadow=i;else if(r==="typography"||r==="fontWeight"||r==="fontFamily"){let a=o("ag");if(a.textContent="Ag",r==="typography"){a.style.font=i;let s=T8(i.split(/\s+/).find(l=>/^[\d.]+(px|r?em)(\/|$)/.test(l))?.split("/")[0]??"");a.style.fontSize=`${Ds(s??13,10,16)}px`,a.style.lineHeight="1"}else r==="fontWeight"?a.style.fontWeight=i:a.style.fontFamily=i}return n}function S8(e){if(!e||/var\(/i.test(e))return!1;let t=document.createElement("span").style;return t.color=e,!!t.color}function lN(e,t,n,o){let i=document.createElement("div");i.id=t,i.setAttribute("role","option"),i.setAttribute("aria-selected",String(n));let r=document.createElement("span");r.className="komo-tokens__name";let a=document.createElement("span");a.textContent=hw(e),r.append(a);let s=document.createElement("span");s.className="komo-tokens__check",s.setAttribute("aria-hidden","true");let l=document.createElement("span");l.className="komo-tokens__meta";let c=e.type==="typography"?aN(e.value??""):e.value??"",u=e.type==="color"&&!S8(e.value);for(let d of[e.ref,u?`Unresolved value \xB7 ${c||"not supplied"}`:c]){if(!d)continue;let g=document.createElement("span");g.textContent=d,l.append(g)}if(i.append(sN(e,o),r,s,l),e.states?.length){let d=document.createElement("span");d.className="komo-tokens__states";for(let g of e.states){let x=document.createElement("i");x.textContent=g,d.append(x)}i.append(d)}if(e.description){let d=document.createElement("span");d.className="komo-tokens__desc",d.textContent=e.description,i.append(d)}let f=o.flatMap(d=>{let g=d.values.get(e.path);return g&&e.type==="color"?[`${d.label} ${g}`]:[]});return i.title=[e.label,e.path,e.ref,f.length>1?f.join(", "):e.value,u?"Unresolved color value; no swatch available":"",e.states?.length?`States: ${e.states.join(", ")}`:"",e.description].filter(Boolean).join(" \xB7 "),i.setAttribute("aria-label",i.title),i}function k8(e){return Ls?.trigger===e}function cN(e){k8(e.trigger)?Ls.close(!0):A8(e)}function A8(e){Ls?.close();let{trigger:t,tokens:n,property:o}=e,i=t.getRootNode();if((i instanceof ShadowRoot||i===document)&&!E8.has(i)){E8.add(i);let V=document.createElement("style");V.textContent=zg+iN,(i instanceof ShadowRoot?i:document.head).append(V)}let r=`komo-tokens-${++rN}`,a=document.createElement("div");a.className="komo-tokens";let s=document.createElement("div");s.className="komo-tokens__bar";let l=document.createElement("input");l.type="text",l.placeholder="Search tokens",l.autocomplete="off",l.spellcheck=!1,l.setAttribute("role","combobox"),l.setAttribute("aria-expanded","true"),l.setAttribute("aria-controls",r),l.setAttribute("aria-autocomplete","list"),l.setAttribute("aria-label",`Search tokens for ${o}`);let c=document.createElement("div");c.id=r,c.setAttribute("role","listbox"),c.setAttribute("aria-label",`Tokens for ${o}`);let u=n.filter(V=>V.properties?.includes(o)),f=!u.length,d=document.createElement("button");if(d.type="button",d.textContent="Show all",d.title=`Show all ${n.length} tokens, not only ${o} tokens`,s.append(l),u.length&&u.length<n.length&&s.append(d),a.append(s,c),e.onPreview){let V=document.createElement("div");V.className="komo-tokens__hint",V.textContent="\u2191\u2193 preview \xB7 Enter to apply \xB7 Esc to cancel",a.append(V)}let g=new Map(n.map(V=>[V,`${hw(V)} ${V.label??""} ${V.path} ${V.ref??""} ${V.value??""}`.toLowerCase()])),x=[],y=[],E=0,m=-1,b=c,h,w,S=-1,k=()=>{let V=w;w=void 0,S=-1,V?.()},T=V=>{for(;E<Math.min(V,y.length);E++){let{token:ue,group:se}=y[E];if(se!==h&&(h=se,b=c,se)){b=document.createElement("div"),b.setAttribute("role","group");let j=document.createElement("small");j.id=`${r}-g${E}`,j.textContent=se,b.setAttribute("aria-labelledby",j.id),b.append(j),c.append(b)}b.append(lN(ue,`${r}-${E}`,ue.path===e.current,x))}},M=V=>c.querySelector(`#${r}-${V}`),A=(V,ue=!0,se=!0)=>{if(V<0||V>=y.length)return;if(V!==S&&se){k(),S=V;let ae=y[V].token;ae.path!==e.current&&(w=e.onPreview?.(ae))}T(V+gw),M(m)?.removeAttribute("data-active"),m=V;let j=M(V);if(j.toggleAttribute("data-active",!0),l.setAttribute("aria-activedescendant",j.id),!ue)return;let X=j.offsetTop-(j.parentElement===c?0:j.parentElement.firstElementChild.offsetHeight),te=j.offsetTop+j.offsetHeight;X<c.scrollTop?c.scrollTop=X-4:te>c.scrollTop+c.clientHeight&&(c.scrollTop=te-c.clientHeight+4)},D=(V=!1)=>{k();let ue=l.value.toLowerCase().split(/\s+/).filter(Boolean),se=f?n:u,j=ue.length?se.filter(ae=>ue.every(Ae=>g.get(ae).includes(Ae))):se,X=!ue.length&&e.current?j.find(ae=>ae.path===e.current):void 0,te=new Map([["",[]]]);for(let ae of j){if(ae===X)continue;let Ae=ae.group??"";te.set(Ae,[...te.get(Ae)??[],ae])}if(y=[...X?[{token:X,group:"Current"}]:[],...[...te].flatMap(([ae,Ae])=>Ae.map(He=>({token:He,group:ae})))],c.replaceChildren(),c.scrollTop=0,E=0,m=-1,h=void 0,l.removeAttribute("aria-activedescendant"),d.setAttribute("aria-pressed",String(f)),!y.length){let ae=document.createElement("div");ae.className="komo-tokens__empty",ae.textContent=ue.length?"No matching tokens":"No tokens",c.append(ae);return}T(gw),A(0,!1,V)},H=new AbortController,{signal:Z}=H,ee=!!globalThis.matchMedia?.("(pointer:coarse)")?.matches;function Q(V=!1){Ls?.close===Q&&(Ls=void 0,k(),H.abort(),a.remove(),t.setAttribute("aria-expanded","false"),t.removeAttribute("aria-controls"),V&&t.isConnected&&t.focus({preventScroll:!0}))}Ls={trigger:t,close:Q};let N=V=>{let ue=y[V]?.token;ue&&(Q(!0),ue.path!==e.current&&e.onSelect(ue))};l.addEventListener("input",()=>D(!0),{signal:Z}),d.addEventListener("click",()=>{f=!f,D(!0),ee||l.focus({preventScroll:!0})},{signal:Z}),addEventListener("keydown",V=>{if(!t.isConnected)return Q();let ue=V.composedPath();if(!ue.includes(a)&&!ue.includes(t))return;let{key:se}=V;if(!(V.ctrlKey||V.metaKey||V.altKey)){if(se==="Escape")Q(!0);else{if(se==="Tab")return Q();if(ue[0]!==l&&ue[0]!==t)return;if(se==="ArrowDown"||se==="ArrowUp")A(Ds(m+(se==="ArrowDown"?1:-1),0,y.length-1));else if(se==="PageDown"||se==="PageUp")A(Ds(m+(se==="PageDown"?8:-8),0,y.length-1));else if(se==="Enter")N(m);else return}V.preventDefault(),V.stopImmediatePropagation()}},{capture:!0,signal:Z}),addEventListener("pointerdown",V=>{let ue=V.composedPath();!ue.includes(a)&&!ue.includes(t)&&Q()},{capture:!0,signal:Z});let le=V=>{V.target===c?c.scrollTop+c.clientHeight>c.scrollHeight-200&&T(E+gw):V.target instanceof Node&&a.contains(V.target)||Q()};addEventListener("scroll",le,{capture:!0,signal:Z}),i.addEventListener("scroll",le,{capture:!0,signal:Z}),addEventListener("resize",()=>Q(),{signal:Z}),As(t,()=>Q(),Z),c.addEventListener("mousedown",V=>V.preventDefault(),{signal:Z});let $=V=>{let ue=V.target.closest?.("[role=option]");return ue?Number(ue.id.slice(r.length+1)):-1};c.addEventListener("pointermove",V=>{let ue=$(V);ue>=0&&A(ue,!1)},{signal:Z}),a.addEventListener("click",V=>{V.target!==l&&V.preventDefault();let ue=$(V);ue>=0&&N(ue)},{signal:Z}),D();let K=t.closest(".design-field")??t.parentElement;K.append(a),t.setAttribute("aria-expanded","true"),t.setAttribute("aria-controls",r);let ve=K.getBoundingClientRect(),we=Rg(K),Ee=(a.offsetParent??K).getBoundingClientRect(),pe=Ds(we.right-we.left-8,120,340),et=we.bottom-ve.bottom-8,Ne=ve.top-we.top-8,ie=et<240&&Ne>et,re=Math.min(320,Math.max(ie?Ne:et,120));if(a.style.width=`${pe}px`,a.style.maxHeight=`${re}px`,a.style.left=`${Ds(ve.left,we.left+4,we.right-pe-4)-Ee.left}px`,a.style.top=ie?"":`${ve.bottom+4-Ee.top}px`,a.style.bottom=ie?`${Ee.bottom-ve.top+4}px`:"",a.toggleAttribute("data-up",ie),e.current){let V=y.findIndex(ue=>ue.token.path===e.current);V>=0&&A(V,!0,!1)}return ee||l.focus({preventScroll:!0}),Promise.resolve(e.themes?.()).then(V=>{if(!V||V.length<2||Ls?.trigger!==t)return;x=V;let ue=m,se=c.scrollTop,j=E;c.replaceChildren(),E=0,h=void 0,T(j),c.scrollTop=se,A(ue,!1,!1)},()=>{}),()=>Q()}var iN,E8,gw,rN,Ls,Ds,M8=_(()=>{"use strict";Rd();iN=".komo-tokens{display:flex;flex-direction:column;overflow:hidden}.komo-tokens__bar{flex:none;display:flex;gap:4px;padding:8px;background:#232323;border-bottom:1px solid #ffffff0d}.komo-tokens__bar input{flex:1;min-width:0;height:28px;box-sizing:border-box;margin:0;padding:0 8px;border:0;border-radius:6px;outline:0;box-shadow:none;background:#ffffff0a;color:#f1efeb;font:inherit}.komo-tokens__bar input::placeholder{color:#77736f}.komo-tokens__bar input:focus{outline:0;box-shadow:inset 0 0 0 1px #bda6ef}.komo-tokens__bar button{flex:none;height:28px;padding:0 8px;border:0;border-radius:6px;background:none;color:#898680;font:inherit;white-space:nowrap;cursor:pointer}.komo-tokens__bar button:hover{background:#ffffff0f;color:#f1efeb}.komo-tokens__bar button[aria-pressed=true]{background:#bda6ef24;color:#e6dcfb}.komo-tokens__bar button:focus-visible{outline:1px solid #bda6ef;outline-offset:-1px}.komo-tokens [role=listbox]{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;padding:0 4px 4px}.komo-tokens small{position:sticky;top:0;z-index:1;display:block;padding:8px 8px 4px;background:#232323;color:#77736f;font-size:10px;font-weight:500}.komo-tokens [role=option]{display:grid;grid-template-columns:20px minmax(0,1fr) 14px;align-items:center;gap:4px 8px;box-sizing:border-box;min-height:48px;padding:8px;border-radius:7px;cursor:pointer}.komo-tokens [data-active]{background:#ffffff14;color:#f1efeb}.komo-tokens [aria-selected=true] .komo-tokens__name{color:#e6dcfb}.komo-tokens__name{grid-column:2;min-width:0;font-weight:500}.komo-tokens__name>span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.komo-tokens__check{grid-column:3;justify-self:center}.komo-tokens [aria-selected=true] .komo-tokens__check{width:7px;height:3.5px;margin-top:-3px;border:solid #bda6ef;border-width:0 0 1.5px 1.5px;rotate:-45deg}.komo-tokens__meta,.komo-tokens__desc,.komo-tokens__states{grid-column:2/-1;min-width:0}.komo-tokens__meta{display:grid;gap:2px;color:#a5a19b;font-size:10px;font-variant-numeric:tabular-nums}.komo-tokens__meta span,.komo-tokens__desc{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.komo-tokens__meta span+span,.komo-tokens__desc{color:#898680;font-size:10px}.komo-tokens__states{display:flex;flex-wrap:wrap;gap:4px}.komo-tokens__states i{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:2px 5px;border-radius:4px;background:#ffffff0a;color:#aaa69f;font-size:9px;font-style:normal}.komo-tokens__pv{display:flex;align-items:center;height:16px;overflow:hidden}.komo-tokens__sw{display:flex;width:16px;height:16px;border-radius:4px;overflow:hidden;background:repeating-conic-gradient(#ffffff40 0 25%,#ffffff0d 0 50%) 0 0/8px 8px;outline:1px solid #ffffff1f;outline-offset:-1px}.komo-tokens__sw>span{flex:1}.komo-tokens__sw>[data-unresolved]{display:grid;place-items:center;background:#393939;color:#b6b1aa;font-size:10px}.komo-tokens__dim{height:4px;min-width:2px;border-radius:2px;background:#bda6ef}.komo-tokens__corner{width:12px;height:12px;box-sizing:border-box;border:solid #bda6ef;border-width:1.5px 0 0 1.5px}.komo-tokens__shadow{width:16px;height:12px;margin-left:2px;border-radius:3px;background:#f1efeb}.komo-tokens__ag{color:#f1efeb;font-size:13px;line-height:1;white-space:nowrap}.komo-tokens__hint{flex:none;padding:7px 10px;border-top:1px solid #ffffff0d;color:#aaa69f;font-size:10px}.komo-tokens__empty{padding:12px 8px;color:#77736f}@media (pointer:coarse){.komo-tokens{font-size:13px}.komo-tokens [role=option]{min-height:40px}.komo-tokens__bar input,.komo-tokens__bar button{height:36px}}",E8=new WeakSet,gw=60,rN=0;Ds=(e,t,n)=>Math.min(n,Math.max(t,e))});var Ew={};In(Ew,{attachStyleTokenControls:()=>AN,attachThemeSwitcher:()=>zN,beginReactTextEdit:()=>mN,canUndoDesignTokenEdit:()=>vN,canUndoReactProp:()=>bN,cancelReactTextEdit:()=>hN,createAdapterTokenControl:()=>$8,createDesignThemePanel:()=>CN,createElementTokenControl:()=>V8,createReactPropsPanel:()=>ON,designContext:()=>yN,finishReactTextEdit:()=>gN,hasDesignTokenEdit:()=>wN,hasReactPropChanges:()=>fN,installCommentCapture:()=>xN,noteDesignTokenOverride:()=>LN,previewReactTextEdit:()=>R8,proposedDesignChanges:()=>j8,proposedReactChanges:()=>O8,resetDesignTokenEdits:()=>TN,resetPreviews:()=>_N,resetReactProps:()=>q8,restoreThemes:()=>P8,showDesignBefore:()=>pN,syncDesignTokenBinding:()=>DN,tokenBoundProperties:()=>kN,undoDesignTokenEdit:()=>EN,undoReactProp:()=>U8});function _8(e){return e===void 0?"unset":JSON.stringify(e)??"unset"}function pN(e){if(e)for(let[t,n]of Yt){let o=So(t);o&&(bw.set(t,o.props),o.setProps({...o.props,...Object.fromEntries(n)}))}else for(let[t,n]of bw)So(t)?.setProps(n);e||bw.clear(),e8(e),x8(e)}function fN(e){return!!Yt.get(e)?.size}function mN(e){let t=So(e),n=t?.definition.textProp,o=t?.definition.props.find(a=>a.name===n);if(!t||!n||o?.kind!=="string")return null;let i=t.props[n];if(typeof i!="string"||i.length>500)return null;let r=Yt.get(e);return r||Yt.set(e,r=new Map),r.has(n)||r.set(n,i),{propName:n,before:i}}function R8(e,t,n){let o=So(e),i=o?.definition.props.find(r=>r.name===t);return!o||o.definition.textProp!==t||i?.kind!=="string"||n.length>500||!Hg(i,n)?!1:(o.setProps({...o.props,[t]:n}),!0)}function gN(e,t,n,o){if(n===o){let r=Yt.get(e);r?.get(t)===n&&!(mi.get(e)??[]).some(a=>a.propName===t)&&(r.delete(t),r.size||Yt.delete(e));return}let i=mi.get(e);i||mi.set(e,i=[]),i.push({propName:t,before:n,after:o})}function hN(e,t,n){R8(e,t,n);let o=Yt.get(e);o?.get(t)===n&&!(mi.get(e)??[]).some(i=>i.propName===t)&&(o.delete(t),o.size||Yt.delete(e))}function bN(e){return!!e&&!!mi.get(e)?.length}function O8(e){let t=Yt.get(e),n=So(e);if(!t?.size||!n)return;let o=ko(e),i=[...t].map(([r,a])=>{let l=n.definition.props.find(f=>f.name===r)?.styleProperty,c=n.props[r],u=l&&typeof c=="string"?o?.tokens.find(f=>f.properties.includes(l)&&c===`var(${f.cssVariable})`):void 0;return`- ${r}: ${_8(a)} \u2192 ${_8(c)}${u?` [${u.path}]`:" [custom value]"}`});return["Proposed React prop changes (preview only)",`Component: ${n.definition.name}`,...Nd(n)?[`Source: ${Nd(n)}`]:[],...i,"Runtime preview only; inline feedback does not write source files."].join(`
|
|
238
238
|
`)}function H8(e,t){if(So(e))return null;let n;try{n=t?.components?.identify(e)}catch{}let o=jg(e);return n?.name&&(!o||o.root!==n.element&&o.root.contains(n.element))?n:null}function yN(e,t){let n=Object.entries(Ng(t)).map(([s,l])=>`${Hd(s)}=${Hd(l)}`).join(", "),o=H8(e,t),i=So(e),r=i?{root:e,component:i}:o?void 0:jg(e);if(r){let{definition:s,props:l}=r.component;o={name:s.name,source:Nd(r.component),props:{...l,...Object.fromEntries(Yt.get(r.root)??[])}}}let a=Object.entries(o?.props??{}).filter(([,s])=>s===null||["boolean","number"].includes(typeof s)||typeof s=="string"&&s.length<=80).slice(0,12).map(([s,l])=>`${Hd(s)}=${JSON.stringify(l).replace(/→/g,"\\u2192")}`);return[n&&`Theme: ${n}`,o?.name&&`Component: ${Hd(o.name)}${o.source?` (${Hd(o.source)})`:""}`,a.length&&`Props: ${a.join(", ")}`].filter(s=>!!s)}function j8(e){return[O8(e),aw(e),v8(e)].filter(t=>!!t).join(`
|
package/dist/chunk-HTMUFH7I.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./chunk-RPY7OOOR.js";var t=new WeakMap,r=new WeakMap,n=new WeakMap;function o(e,t){let r=n.get(e.element);if(r?.editor===t)return r.component;let o={id:e.name,name:e.name,source:e.source??"",line:0,props:t.schema},i={definition:o,preview:"adapter",releaseProps:e=>t.release?.(e),subscribe:t.subscribe?.bind(t),get props(){return l(o,t.read())},onChange:e=>t.apply(e),setProps(e){if(!1===t.available?.())return;let r=l(o,e);if(Object.keys(r).length!==Object.keys(e).length||o.props.some(e=>"unsupported"!==e.kind&&e.required&&!(e.name in r)))throw new Error("Component props no longer match the editor schema.");t.apply(r)}};return n.set(e.element,{editor:t,component:i}),i}function i(e,t){return void 0===t?!e.required:!(!function(e){return void 0===e||"string"==typeof e||"number"==typeof e&&Number.isFinite(e)||"boolean"==typeof e}(t)||"unsupported"===e.kind)&&("string"===e.kind?"string"==typeof t&&t.length<=500:"number"===e.kind?"number"==typeof t&&Number.isFinite(t):"boolean"===e.kind?"boolean"==typeof t:"enum"===e.kind&&(e.values??[]).includes(t))}function l(e,t){let r={};for(let n of e.props){if("unsupported"===n.kind)continue;let e=t[n.name];i(n,e)&&(r[n.name]=e)}return r}function s(e,n,o,i){let s=n.textProp&&n.props.some(e=>e.name===n.textProp&&"string"===e.kind)?n.textProp:void 0,a=l(n,o),p=new Set,u={definition:n,props:a,onChange:i,subscribe:e=>(p.add(e),()=>{p.delete(e)}),setProps(e){let t=l(n,e);if(Object.keys(t).length===Object.keys(e).length){for(let e of n.props)if("unsupported"!==e.kind&&e.required&&!(e.name in t))return;u.props=t,u.onChange(t)}}};return t.set(e,u),e.dataset.komoInspectable=n.id,s?e.dataset.komoTextProp=s:delete e.dataset.komoTextProp,r.set(u,p),()=>{t.get(e)===u&&(t.delete(e),p.clear(),e.dataset.komoInspectable===n.id&&delete e.dataset.komoInspectable,e.dataset.komoTextProp===s&&delete e.dataset.komoTextProp)}}function a(e,n,o,i){if(!e)return;let s=t.get(e);if(!s||s.definition.id!==n.id)return;s.definition=n,s.props=l(n,o),s.onChange=i;let a=n.textProp&&n.props.some(e=>e.name===n.textProp&&"string"===e.kind)?n.textProp:void 0;a?e.dataset.komoTextProp=a:delete e.dataset.komoTextProp,r.get(s)?.forEach(e=>e())}function p(e){let r=e&&t.get(e);if(r&&e.getAttribute("data-komo-inspectable")===r.definition.id)return r;let o=e&&n.get(e);return o&&!1!==o.editor.available?.()?o.component:null}function u(e){for(let t=e?.parentElement;t;t=t.parentElement){let e=p(t);if(e)return{root:t,component:e}}return null}var f=new Set,d=new WeakMap,m=new WeakMap,c=new WeakMap,h={color:new Set(["color","background-color","border-color"]),dimension:new Set(["gap","padding","margin","border-radius","font-size","width","height"]),fontFamily:new Set(["font-family"]),fontWeight:new Set(["font-weight"]),lineHeight:new Set(["line-height"])};function g(e,t){if(t.length>100||t.some(e=>!function(e){return!!e&&"string"==typeof e.path&&e.path.length<=160&&/^--[a-zA-Z0-9_-]+$/.test(e.cssVariable)&&!!h[e.type]&&Array.isArray(e.properties)&&e.properties.length>0&&e.properties.every(t=>h[e.type].has(t))&&"string"==typeof e.impactSelector&&e.impactSelector.length<=200}(e)))throw new Error("Komo design tokens must use supported, explicit CSS-variable metadata");let r=new Set(t.map(e=>e.path)),n=new Set(t.map(e=>e.cssVariable));if(r.size!==t.length||n.size!==t.length)throw new Error("Komo design token paths and CSS variables must be unique");for(let r of t)e.querySelectorAll(r.impactSelector);let o={root:e,tokens:t.map(e=>({...e,properties:[...e.properties]})),themeEdits:new Map,elementOriginals:new Map,elementBindings:new Map,previousMarker:e.getAttribute("data-komo-design-tokens")};return d.set(e,o),f.add(o),c.set(o,[]),e.setAttribute("data-komo-design-tokens",String(t.length)),()=>{if(d.get(e)===o){for(let[t,r]of o.themeEdits){let n=o.tokens.find(e=>e.path===t);n&&(r.inlineBefore?e.style.setProperty(n.cssVariable,r.inlineBefore):e.style.removeProperty(n.cssVariable))}for(let[e,t]of o.elementOriginals)for(let[r,n]of t)n.value?e.style.setProperty(r,n.value,n.priority):e.style.removeProperty(r);o.elementBindings.clear(),f.delete(o),d.delete(e),null===o.previousMarker?e.removeAttribute("data-komo-design-tokens"):e.setAttribute("data-komo-design-tokens",o.previousMarker)}}}function y(e){if(!e)return null;let t=null;for(let r of f)(r.root===e||r.root.contains(e))&&(!t||t.root.contains(r.root))&&(t=r);return t}function k(e,t){return e.root.ownerDocument.defaultView?.getComputedStyle(e.root).getPropertyValue(t.cssVariable).trim()??""}function b(e,t){try{return e.root.querySelectorAll(t.impactSelector).length}catch{return 0}}function P(e,t,r,n=!1){if(!e.tokens.some(e=>e===t||e.path===t.path)||!function(e,t,r){if(!r||r.length>160||/[{};]/.test(r)||/(?:url|expression)\s*\(/i.test(r))return!1;let n=e.root.ownerDocument.defaultView?.CSS;return!n?.supports||t.properties.some(e=>n.supports(e,r))}(e,t,r))return!1;let o=k(e,t),i=e.themeEdits.get(t.path),l=e.root.style.getPropertyValue(t.cssVariable),s=i?.inlineBefore??l,a=c.get(e)??[];if(o===r)return!0;e.root.style.setProperty(t.cssVariable,r),r===(i?.before??o)?e.themeEdits.delete(t.path):e.themeEdits.set(t.path,{before:i?.before??o,after:r,inlineBefore:s});let p=a.at(-1);return n&&"theme"===p?.kind&&p.token.path===t.path?r===p.before?a.pop():p.after=r:a.push({kind:"theme",source:e,token:t,before:o,after:r,inlineBefore:l}),c.set(e,a),!0}function v(e){for(let t of f)for(let[r,n]of t.themeEdits){let o=t.tokens.find(e=>e.path===r)?.cssVariable;if(!o)continue;let i=e?n.inlineBefore:n.after;i?t.root.style.setProperty(o,i):t.root.style.removeProperty(o)}}function w(e,t){let r=e.themeEdits.get(t.path),n=c.get(e)??[],o=n.find(e=>"theme"===e.kind&&e.token.path===t.path),i=r?.inlineBefore??("theme"===o?.kind?o.inlineBefore:void 0);void 0!==i&&(i?e.root.style.setProperty(t.cssVariable,i):e.root.style.removeProperty(t.cssVariable),e.themeEdits.delete(t.path),c.set(e,n.filter(e=>"theme"!==e.kind||e.token.path!==t.path)))}function V(e,t,r,n,o={}){if(!e.tokens.some(e=>e.path===r.path)||!r.properties.includes(n))return!1;let i=e.elementOriginals.get(t);i||e.elementOriginals.set(t,i=new Map),i.has(n)||i.set(n,{value:t.style.getPropertyValue(n),priority:t.style.getPropertyPriority(n)});let l=t.style.getPropertyValue(n),s=t.style.getPropertyPriority(n),a=`var(${r.cssVariable})`,p=e.elementBindings.get(t);p||e.elementBindings.set(t,p=new Map);let u=p.get(n);if(p.set(n,{tokenPath:r.path,initialValue:u?.initialValue??l,initialPriority:u?.initialPriority??s,mode:"token",declaredPath:u?u.declaredPath:A(e,t,n)?.token.path}),t.style.setProperty(n,a,s),!1===o.recordHistory)return!0;let f={kind:"element",element:t,property:n,before:l,priority:s,after:a},d=c.get(e)??[];d.push(f),c.set(e,d);let h=m.get(t)??[];return h.push(f),m.set(t,h),!0}function B(e,t,r,n){let o=e.elementBindings.get(t),i=o?.get(r);if(!i){let n=A(e,t,r);if(!n)return;o||e.elementBindings.set(t,o=new Map),i={tokenPath:n.token.path,initialValue:t.style.getPropertyValue(r),initialPriority:t.style.getPropertyPriority(r),mode:"custom",declaredPath:n.token.path},o.set(r,i)}i.mode="custom",i.customValue=n}function S(e,t,r){let n=e.elementBindings.get(t)?.get(r);if(!n)return;let o=t.style.getPropertyValue(r);o!==n.initialValue||t.style.getPropertyPriority(r)!==n.initialPriority?e.tokens.find(e=>e.path===n.tokenPath&&e.properties.includes(r)&&o===`var(${e.cssVariable})`)?(n.mode="token",delete n.customValue):(n.mode="custom",n.customValue=o):e.elementBindings.get(t)?.delete(r)}function $(e,t,r){let n=e.elementBindings.get(t)?.get(r);return n?{...n}:null}var E={"background-color":["background"],"border-color":["border"],"font-family":["font"],"font-size":["font"],"font-weight":["font"],"line-height":["font"]};function x(e,t,r,n){let o=[...r.matchAll(/var\(\s*(--[\w-]+)/g)].map(e=>e[1]);if(!o.length||n&&!/^var\(\s*--[\w-]+\s*(?:,[^;{}]*)?\)$/.test(r.trim()))return;let i=e.tokens.filter(e=>e.properties.includes(t)&&o.includes(e.cssVariable));return 1===i.length?i[0]:void 0}function M(e){let t=e.replace(/:(?:where)\([^)]*\)/g,"").replace(/"[^"]*"|'[^']*'/g,"");return 1e4*(t.match(/#[\w-]+/g)?.length??0)+100*(t.match(/\.[\w-]+|\[[^\]]*\]|:(?!:)[\w-]+/g)?.length??0)+(t.match(/(?:^|[\s>+~(])[a-z][\w-]*/gi)?.length??0)}function O(e){let t=[],r=0,n=0;for(let o=0;o<e.length;o++){let i=e[o];"("===i||"["===i?r++:")"===i||"]"===i?r--:","===i&&0===r&&(t.push(e.slice(n,o)),n=o+1)}return t.push(e.slice(n)),t.map(e=>e.trim()).filter(Boolean)}function A(e,t,r,n=t.style.getPropertyValue(r),o=t.style.getPropertyPriority(r)){let i=t.ownerDocument.defaultView,l=null,s=0,a=e=>{for(let n of e){s++;let e=n.media;if(e&&i?.matchMedia&&e.mediaText&&!i.matchMedia(e.mediaText).matches)continue;let o=n.style,p=n.selectorText;if(o&&p)for(let e of[r,...E[r]??[]]){let r=o.getPropertyValue(e).trim();if(!r)continue;let n=-1;for(let e of O(p))try{t.matches(e)&&(n=Math.max(n,M(e)))}catch{}if(!(n<0)){n+=o.getPropertyPriority(e)?1e9:0,(!l||n>l.rank||n===l.rank&&s>=l.order)&&(l={value:r,property:e,rank:n,order:s});break}}let u=n.cssRules;u&&!o&&a(u)}};for(let e of t.ownerDocument.styleSheets)try{e.disabled||a(e.cssRules)}catch{}let p=l;if(n&&(!(p&&p.rank>=1e9)||o)){let t=x(e,r,n,!0);return t?{token:t,origin:"inline"}:null}if(!p)return null;let u=x(e,r,p.value,p.property===r);return u?{token:u,origin:"stylesheet"}:null}function T(e,t,r){let n=e.elementBindings.get(t)?.get(r),o=e.elementOriginals.get(t)?.get(r),i=n?.initialValue??o?.value??"",l=n?.initialPriority??o?.priority??"";i?t.style.setProperty(r,i,l):t.style.removeProperty(r),e.elementBindings.get(t)?.delete(r)}function C(e,t){return e.tokens.filter(e=>e.properties.includes(t))}function z(e){let t=y(e);return!!t&&(t.themeEdits.size>0||!!m.get(e)?.length||!!t.elementBindings.get(e)?.size)}function j(e){let t=y(e);return!!t&&!!c.get(t)?.length}function q(e){let t=y(e),r=t&&c.get(t)?.pop();if(!t||!r)return;if("theme"===r.kind){r.inlineBefore?t.root.style.setProperty(r.token.cssVariable,r.inlineBefore):t.root.style.removeProperty(r.token.cssVariable);let e=t.themeEdits.get(r.token.path);if(e&&e.after===r.after)e.before===r.before?t.themeEdits.delete(r.token.path):t.themeEdits.set(r.token.path,{...e,after:r.before});else if(!e){let e=c.get(t).find(e=>"theme"===e.kind&&e.token.path===r.token.path);t.themeEdits.set(r.token.path,{before:r.after,after:r.before,inlineBefore:("theme"===e?.kind?e:r).inlineBefore})}return}r.before?r.element.style.setProperty(r.property,r.before,r.priority):r.element.style.removeProperty(r.property);let n=m.get(r.element)??[];n.pop(),n.length||m.delete(r.element)}function W(e){let t=y(e);if(!t)return;for(let[e,r]of t.themeEdits){let n=t.tokens.find(t=>t.path===e);n&&(r.inlineBefore?t.root.style.setProperty(n.cssVariable,r.inlineBefore):t.root.style.removeProperty(n.cssVariable))}t.themeEdits.clear();let r=t.elementOriginals.get(e);for(let[t,n]of r??[])n.value?e.style.setProperty(t,n.value,n.priority):e.style.removeProperty(t);t.elementOriginals.delete(e),t.elementBindings.delete(e),m.delete(e),c.set(t,(c.get(t)??[]).filter(t=>"element"===t.kind&&t.element!==e))}function D(){for(let e of f){for(let t of[e.root,...e.elementOriginals.keys(),...e.elementBindings.keys()])W(t);c.set(e,[])}}function R(e){let t=y(e);if(!t)return;let r=[];for(let[n,o]of t.elementBindings.get(e)??[]){let e=t.tokens.find(e=>e.path===o.tokenPath&&e.properties.includes(n));if(!e)continue;let i=t.tokens.find(e=>e.path===o.declaredPath),l=i?`var(${i.cssVariable}) [${i.path}]`:o.initialValue||"(unset)";"token"===o.mode?i!==e&&r.push(`Element ${n}: ${l} → var(${e.cssVariable}) [${e.path}]${i?" [rebind]":""}`):r.push(`Element ${n}: ${l} → ${o.customValue||"(unset)"} [${i?"custom override":"custom value"}]`)}for(let n of m.get(e)??[]){if("element"!==n.kind||t.elementBindings.get(e)?.has(n.property))continue;let o=t.tokens.find(e=>n.after===`var(${e.cssVariable})`);o&&r.push(`Element ${n.property}: ${n.before||"(unset)"} → var(${o.cssVariable}) [${o.path}]`)}for(let[e,n]of t.themeEdits){let o=t.tokens.find(t=>t.path===e);o&&r.push(`Shared theme ${e} (${o.cssVariable}): ${n.before} → ${n.after}; preview scope ${o.impactSelector} (${b(t,o)} matching elements)`)}return r.length?["Proposed design-token changes (preview only)",...r,"Token references are preserved for element assignments; refresh resets previews."].join("\n"):void 0}function F(){return{id:"css-variables",list:()=>[...f].flatMap(e=>e.tokens.map(t=>function(e,t){return{path:t.path,type:t.type,value:k(e,t),properties:[...t.properties],group:t.path.split(".")[0],ref:t.cssVariable}}(e,t))),resolve(t){let r=y(t),n={};if(!r||!e(t))return n;let o=t.ownerDocument.defaultView?.getComputedStyle(t);for(let e of new Set(r.tokens.flatMap(e=>e.properties))){let i=A(r,t,e);n[e]=i?{path:i.token.path}:{offToken:o?.getPropertyValue(e).trim()??""}}return n},preview(t,r,n){let o=y(t),i=o?.tokens.find(e=>e.path===n.path);if(!o||!i||!e(t))return()=>{};let l=t.style.getPropertyValue(r),s=t.style.getPropertyPriority(r);return V(o,t,i,r,{recordHistory:!1}),()=>{l?t.style.setProperty(r,l,s):t.style.removeProperty(r),S(o,t,r)}},describe:(e,t,r,n)=>`Set ${t} to var(${n.ref})`}}export{o as a,i as b,s as c,a as d,p as e,u as f,g,y as h,k as i,b as j,P as k,v as l,w as m,V as n,B as o,S as p,$ as q,A as r,T as s,C as t,z as u,j as v,q as w,W as x,D as y,R as z,F as A};
|