tweakit 0.4.1 → 0.4.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 (31) hide show
  1. package/dist/tweaks/{bezier-KSA2VTVT.js → bezier-EH6GR3RN.js} +1 -1
  2. package/dist/tweaks/chunk-3GZFWFKC.js +1 -0
  3. package/dist/tweaks/{chunk-SIIHIBXV.js → chunk-5G6TFQOD.js} +1 -1
  4. package/dist/tweaks/{chunk-HWQKSB7T.js → chunk-GDMWOXFU.js} +1 -1
  5. package/dist/tweaks/colour-G6UZ5HIL.js +1 -0
  6. package/dist/tweaks/core.js +1 -1
  7. package/dist/tweaks/fold-FNCV4C7P.js +1 -0
  8. package/dist/tweaks/{gradient-AHHDJIIU.js → gradient-RKPRTDSQ.js} +1 -1
  9. package/dist/tweaks/{heavy-ZZA3NS5O.js → heavy-LD64N5S4.js} +1 -1
  10. package/dist/tweaks/{image-ZSAP6BIK.js → image-TFIUSCCY.js} +1 -1
  11. package/dist/tweaks/interval-VFQ2O75Q.js +1 -0
  12. package/dist/tweaks/{monitor-5CFBIGGT.js → monitor-EAU6GD6P.js} +1 -1
  13. package/dist/tweaks/motion-FUAKWKPW.js +1 -0
  14. package/dist/tweaks/{plot-KQGIWQHO.js → plot-AMSWXKO7.js} +2 -2
  15. package/dist/tweaks/{point-4J4HHM2Z.js → point-UF7RGMGJ.js} +1 -1
  16. package/dist/tweaks/shadow-54LEQGQ6.js +1 -0
  17. package/dist/tweaks/{sides-EI7BN5Q6.js → sides-WJF2NEGM.js} +1 -1
  18. package/dist/tweaks/{spring-JGHWZBNF.js → spring-YHAPWWTF.js} +1 -1
  19. package/dist/tweaks/tabs-C45GWZYF.js +1 -0
  20. package/dist/tweaks.js +3 -3
  21. package/dist/types/tweaks/easing.d.ts +8 -19
  22. package/dist/types/tweaks/enhance.d.ts +1 -0
  23. package/dist/types/tweaks/panel.d.ts +1 -0
  24. package/dist/types/tweaks/standalone.d.ts +2 -0
  25. package/package.json +1 -1
  26. package/dist/tweaks/chunk-WWCMYF2Q.js +0 -1
  27. package/dist/tweaks/colour-L2QYS74L.js +0 -1
  28. package/dist/tweaks/interval-4KQVZGAX.js +0 -1
  29. package/dist/tweaks/motion-5UMJIBOJ.js +0 -1
  30. package/dist/tweaks/shadow-RAXIV6FG.js +0 -1
  31. package/dist/tweaks/tabs-RM7NR6CO.js +0 -1
@@ -1,29 +1,18 @@
1
1
  import type { GradientEasing, GradientValue } from "./types.js";
2
2
  /** cubic-bezier control points [x1, y1, x2, y2]. */
3
3
  type Bez = [number, number, number, number];
4
- /** An easing's bezier control points, or null for linear. Anything unrecognised — an
5
- * unknown keyword, a malformed or non-finite `cubic-bezier()` — is null too, so bad input
6
- * degrades to today's straight blend rather than to broken CSS. x1/x2 clamp into [0,1] as
7
- * CSS requires (it keeps the sampled positions monotonic); y may overshoot like CSS allows. */
4
+ /** Bezier control points, or null for linear and anything unrecognised (bad input degrades to a
5
+ * straight blend). x1/x2 clamp into [0,1] as CSS requires; y may overshoot. */
8
6
  export declare function parseEasing(e: unknown): Bez | null;
9
- /** The name an easing is stored under: the string itself, trimmed and lowercased, when
10
- * parseEasing knows it; "linear" for linear and for anything unrecognised. */
7
+ /** The name an easing is stored under: trimmed and lowercased when parseEasing knows it, else "linear". */
11
8
  export declare const easingName: (e: unknown) => GradientEasing;
12
- /** The curve at 16 even t: [x, y] pairs — x the position within the segment (0→1), y the
13
- * blend progress, clamped to [0,1] since it becomes a color-mix percentage. */
9
+ /** The curve at 16 even t: [x, y] pairs, y clamped to [0,1] since it becomes a color-mix percentage. */
14
10
  export declare function easingSamples(b: Bez): Array<[number, number]>;
15
- /** The blend progress at a position within a segment, read off the sampled ramp — linear
16
- * between samples, exactly as the browser draws the generated stops — so a stop inserted
17
- * at x takes the colour the ramp really shows there. Null (linear) is the identity. */
11
+ /** The blend progress at a position, linear between samples exactly as the browser draws the
12
+ * stops, so a stop inserted at x takes the colour the ramp really shows. Null is the identity. */
18
13
  export declare function easingAt(b: Bez | null, x: number): number;
19
- /** A gradient value's `<color-stop-list>` — `"red 0%, color-mix(…) 8.1%, …, blue 100%"` — with
20
- * the value's easing expanded into sampled stops. Linear (or no) easing gives the plain
21
- * list. For a `linear-gradient` use gradientCss; this is for templating a conic / radial
22
- * gradient, or any other place a stop list goes. */
14
+ /** A gradient value's `<color-stop-list>` with the easing expanded; for a conic / radial gradient. */
23
15
  export declare function gradientStops(value: GradientValue): string;
24
- /** The CSS for a gradient value: `linear-gradient(in <interpolation> <direction>, <stops>)`,
25
- * easing expanded, blend space honoured — paste it straight into `background`. `direction`
26
- * is an angle in degrees or any CSS direction (`"to right"`, the default, is what the
27
- * editor's own preview draws). */
16
+ /** The `linear-gradient(…)` for a gradient value; `direction` is degrees or any CSS direction. */
28
17
  export declare function gradientCss(value: GradientValue, direction?: number | string): string;
29
18
  export {};
@@ -1 +1,2 @@
1
+ /** Bind every unbound [data-tw] host under `root` (the document by default). */
1
2
  export declare function enhance(root?: Document | Element): Promise<void>;
@@ -1,2 +1,3 @@
1
1
  import type { Schema, TweaksOptions, Panel } from "./types.js";
2
+ /** Build a panel from `schema`; the shell and API exist synchronously, lazy controls fill in on `ready`. */
2
3
  export declare function tweaks(name: string, schema: Schema, opts?: TweaksOptions): Panel;
@@ -1,3 +1,5 @@
1
1
  import type { SchemaValue, MountOptions, MountedControl, ColorPickerOptions, ColorPicker } from "./types.js";
2
+ /** One control from a schema value, into `host`; a folder or tabs set is tweaks()'s to build. */
2
3
  export declare function mountControl(host: Element, value: SchemaValue, opts?: MountOptions): MountedControl;
4
+ /** The colour editor surface alone, for a host page that brings its own swatch. */
3
5
  export declare function createColorPicker(opts?: ColorPickerOptions): ColorPicker;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tweakit",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
5
  "main": "./dist/tweaks.js",
6
6
  "types": "./dist/types/tweaks/core.d.ts",
@@ -1 +0,0 @@
1
- var S=Object.assign(Object.create(null),{ease:[.25,.1,.25,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1]}),L=e=>Math.min(1,Math.max(0,e)),x=15;function H(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();if(S[t])return S[t];let n=/^cubic-bezier\(([^()]*)\)$/.exec(t);if(!n)return null;let r=n[1].split(",").map(o=>o.trim()?Number(o):NaN);return r.length!==4||!r.every(Number.isFinite)?null:[L(r[0]),r[1],L(r[2]),r[3]]}var ue=e=>H(e)?e.trim().toLowerCase():"linear";function F(e){let t=[];for(let n=0;n<=x;n++){let r=n/x,o=1-r,s=3*o*o*r,i=3*o*r*r,a=r*r*r;t.push([s*e[0]+i*e[2]+a,L(s*e[1]+i*e[3]+a)])}return t}function de(e,t){if(t=L(t),!e)return t;let n=F(e);for(let r=1;r<n.length;r++)if(t<=n[r][0]){let[o,s]=n[r-1],[i,a]=n[r];return i>o?s+(a-s)*(t-o)/(i-o):a}return 1}var T=e=>+(e*100).toFixed(2);function O(e){let t=[...e.stops].sort((a,u)=>a.pos-u.pos),n=a=>`${a.color} ${T(a.pos)}%`,r=H(e.easing);if(!r||t.length<2)return t.map(n).join(", ");let o=F(r),s=e.interpolation||"oklch",i=[n(t[0])];for(let a=1;a<t.length;a++){let u=t[a-1],m=t[a],c=m.pos-u.pos;if(c>1e-6)for(let d=1;d<x;d++){let[f,p]=o[d];i.push(`color-mix(in ${s}, ${u.color}, ${m.color} ${T(p)}%) ${T(u.pos+c*f)}%`)}i.push(n(m))}return i.join(", ")}function $(e,t="to right"){return`linear-gradient(in ${e.interpolation||"oklch"} ${typeof t=="number"?`${t}deg`:t}, ${O(e)})`}var V=e=>e.replace(/([a-z])(?=[A-Z])|([A-Z\d])(?=[A-Z][a-z])/g,"$1$2 ").replace(/^./,t=>t.toUpperCase()).trim(),_=(e,t,n)=>Math.min(n,Math.max(t,e)),me=e=>typeof e=="string"&&(/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e.trim())||/^(oklch|oklab|rgba?|hsla?|hwb|lab|lch|color)\(/i.test(e.trim())),P=20,j=e=>{let t=String(e),n=/e-(\d+)$/i.exec(t);if(n)return Math.min(P,Number(n[1])+(t.split("e")[0].split(".")[1]||"").length);let r=t.indexOf(".");return r===-1?0:Math.min(P,t.length-r-1)},z=(e,t,n)=>{if(!(n>0))return e;let r=j(n),o=Number((+t).toFixed(r)),s=Math.round((e-o)/n);return Number.isFinite(s)?Number((o+s*n).toFixed(r)):e},we=(e,t,n,r=e)=>{let o=a=>z(a,r,n),s=Number.isFinite(e)?o(e):-1/0,i=Number.isFinite(t)?o(t):1/0;return s<e&&(s=o(s+n)),i>t&&(i=o(i-n)),s>i?[e,e]:[s,i]},I=(e,t)=>{let n=t-e;return n<=1?.01:n<=10?.1:n<=100?1:10},be=(e,t,n,r=0,o=null)=>{let s=+e,i=+t,a=+n;if(Number.isFinite(s)||(s=r),Number.isFinite(i)||(i=o??s+100),i<s){let u=s;s=i,i=u}return(!(a>0)||a>i-s)&&(a=I(s,i)),{min:s,max:i,step:a}},ge=(e,t,n,r,o,s=null)=>{let i=e.shiftKey?10:1;switch(e.key){case"ArrowRight":case"ArrowUp":return t+n*i;case"ArrowLeft":case"ArrowDown":return t-n*i;case"PageUp":return s!=null?t+s:null;case"PageDown":return s!=null?t-s:null;case"Home":return r;case"End":return o}return null},pe=(e,t,n,r,o=0)=>{let s=e.offsetLeft,i=s+e.offsetWidth,a=t.offsetLeft,u=a+t.offsetWidth;return n<i&&n+r>s||n<u+o&&n+r>a-o},he=e=>e>=0?[0,e<=1?1:e*3||100]:[e>=-1?-1:e*3,0],G=e=>e==null?void 0:typeof e=="object"?e.value:e,D=e=>{try{return JSON.stringify(e)}catch{return String(e)}},K=e=>e==null?"":typeof e=="string"?V(e):typeof e=="object"?e.label??(e.value!==void 0?String(e.value):D(e)):String(e),M=(e,t,n)=>{let r=document.createElement(e);return t&&(r.className=t),n!=null&&(r.innerHTML=n),r},Ee=(e,t)=>{let n=M("button",e,t);return n.type="button",n},W=(e,t,n)=>{let r=M(e,t);return r.textContent=n,e==="button"&&(r.type="button"),r},q=e=>["pointerdown","pointermove","pointerup"].forEach(t=>e.addEventListener(t,n=>n.stopPropagation())),X=e=>{requestAnimationFrame(e),document.fonts&&document.fonts.ready&&document.fonts.ready.then(e)},U=(e,t,n)=>{let r=e.isConnected;r||requestAnimationFrame(()=>{e.isConnected&&(r=!0)});let o=i=>{if(!e.isConnected){(r||e.closest("[data-tw-destroyed]"))&&s();return}r=!0,n(i)},s=()=>t.forEach(([i,a])=>i.removeEventListener(a,o));return t.forEach(([i,a])=>i.addEventListener(a,o)),s},ve=()=>requestAnimationFrame(()=>window.dispatchEvent(new Event("tw-reflow"))),ye=(e,t)=>{e.addEventListener("pointerenter",()=>{e.classList.add("is-hover"),t&&t()}),e.addEventListener("pointerleave",()=>e.classList.remove("is-hover"))},E=!1;typeof document<"u"&&(document.addEventListener("pointerdown",()=>{E=!0},!0),document.addEventListener("keydown",()=>{E=!1},!0));var Le=e=>{e.addEventListener("focus",()=>e.classList.toggle("tw-focus-quiet",E)),e.addEventListener("blur",()=>e.classList.remove("tw-focus-quiet"))},Z=(e,t,{width:n,fallbackH:r=300,gap:o=6,align:s="start",prefer:i="below"}={})=>{let a=e.getBoundingClientRect();n==="match"&&(t.style.width=a.width+"px");let u=n==="match"?a.width:t.offsetWidth||n||0,m=s==="end"?a.right-u:s==="center"?a.left+a.width/2-u/2:a.left;t.style.left=Math.max(8,Math.min(m,window.innerWidth-u-8))+"px";let c=t.offsetHeight||r,d=window.innerHeight-a.bottom,f=a.top,p=c+12,v=d>=p,h=f>=p,y=(i==="above"?h||!v&&f>=d:!v&&(h||f>d))?a.top-c-o:a.bottom+o;t.style.top=_(y,o,window.innerHeight-c-o)+"px"},Y=Object.assign(Object.create(null),{accent:"--tw-accent",onAccent:"--tw-on-accent",base:"--tw-base",dropdownBg:"--tw-dropdown-bg",surface:"--tw-surface",surfaceHover:"--tw-surface-hover",surfaceActive:"--tw-surface-active",border:"--tw-border",borderHover:"--tw-border-hover",selection:"--tw-selection",title:"--tw-text-root",section:"--tw-text-section",text:"--tw-text-primary",label:"--tw-text-label",textMuted:"--tw-text-secondary",textFaint:"--tw-text-tertiary",focus:"--tw-text-focus",success:"--tw-success",danger:"--tw-danger",shadow:"--tw-shadow-dropdown",shadowPanel:"--tw-shadow-panel",shadowPanelLifted:"--tw-shadow-panel-lifted",font:"--tw-font-sans",fontMono:"--tw-font-mono",radius:"--tw-radius",density:"--tw-row-height",width:"--tw-width"}),J=new Set(["radius","density","width"]),k=e=>(e/=255,e<=.03928?e/12.92:((e+.055)/1.055)**2.4),Q=e=>{e=String(e).trim();let t=/^#([0-9a-f]{3})$/i.exec(e);if(t)return t[1].split("").map(n=>parseInt(n+n,16));if(t=/^#([0-9a-f]{6})$/i.exec(e),t)return[0,2,4].map(n=>parseInt(t[1].slice(n,n+2),16));if(t=/^rgba?\(([^)]+)\)/i.exec(e),t){let n=t[1].split(/[\s,/]+/).filter(Boolean).map(parseFloat);return[n[0],n[1],n[2]]}return null},ee=e=>{let t=Q(e);if(!t||t.some(r=>!Number.isFinite(r)))return"#ffffff";let n=.2126*k(t[0])+.7152*k(t[1])+.0722*k(t[2]);return 1.05/(n+.05)>=(n+.05)/.0571?"#ffffff":"#161616"},Me=e=>{if(!e||typeof e!="object")return null;let t={};for(let[n,r]of Object.entries(e)){if(n.startsWith("--")){t[n]=String(r);continue}let o=Y[n];o&&(t[o]=J.has(n)&&typeof r=="number"?`${r}px`:String(r))}return t["--tw-accent"]&&!t["--tw-on-accent"]&&(t["--tw-on-accent"]=ee(t["--tw-accent"])),Object.keys(t).length?t:null},te=(e,t)=>{if(e){if(e._twAppliedVars)for(let n of e._twAppliedVars)e.style.removeProperty(n);if(e._twAppliedVars=t?Object.keys(t):null,t)for(let n in t)e.style.setProperty(n,t[n])}},ne=(e,t)=>{let n=t?.closest('[data-tw-scheme="light"]')?"light":t?.closest('[data-tw-scheme="dark"]')?"dark":null;n?e.setAttribute("data-tw-scheme",n):e.removeAttribute("data-tw-scheme")},N=(e,t)=>{te(e,t?.closest(".tw-panel")?._twTheme),ne(e,t)},g=null,A=null,Te=e=>{g&&(!e||e.contains(A))&&g()};function xe(e,t,n,r={}){let o=!1,s=null;n.classList.add("tw-portal"),n.inert=!0,n.addEventListener("pointerdown",l=>t.closest(".tw-panel")?._twEditPointer?.(l),!0),q(n);let i=0,a=0,u=()=>{Z(t,n,{width:r.width,fallbackH:r.fallbackH,gap:r.gap,align:r.align});let l=t.getBoundingClientRect();i=parseFloat(n.style.left)-l.left,a=parseFloat(n.style.top)-l.top},m=()=>{if(o){if(!e.isConnected)return w();u(),r.onReflow&&r.onReflow()}},c=()=>{if(!o)return;if(!e.isConnected)return w();let l=t.getBoundingClientRect();if(!(l.width||l.height)||l.bottom<0||l.top>window.innerHeight||l.right<0||l.left>window.innerWidth)return w();n.style.left=l.left+i+"px",n.style.top=l.top+a+"px"},d=l=>{!e.contains(l.target)&&!n.contains(l.target)&&w()},f=l=>{l.key==="Escape"&&o&&(w(),t.focus())},p=l=>{if(!o)return;let b=l.relatedTarget;(b?e.contains(b)||n.contains(b):E)||(w(),b&&!t.closest(".tw-panel")?.contains(b)&&setTimeout(()=>{!o&&document.activeElement===b&&t.focus()},0))};e.addEventListener("focusout",p),n.addEventListener("focusout",p);let v=()=>n.querySelector('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'),h=()=>N(n,e),C=l=>{l.every(b=>b.target===n)||h()},y=()=>{g&&g!==w&&g(),g=w,A=t,o=!0,e.classList.add("is-open"),t.setAttribute("aria-expanded","true"),n.inert=!1,document.body.appendChild(n),N(n,e),window.addEventListener("tw-retheme",h),typeof MutationObserver=="function"&&(s=new MutationObserver(C),s.observe(document.documentElement,{subtree:!0,attributes:!0,attributeFilter:["data-tw-scheme"]})),u(),requestAnimationFrame(()=>{if(o&&(n.classList.add("is-open"),r.onOpen&&r.onOpen(),u(),!n.contains(document.activeElement))){let l=r.initialFocus&&r.initialFocus()||v();l&&l.focus({focusVisible:!E})}}),requestAnimationFrame(function l(){if(o){if(!e.isConnected)return w();requestAnimationFrame(l)}}),setTimeout(()=>{o&&document.addEventListener("pointerdown",d,!0)},0),document.addEventListener("keydown",f),window.addEventListener("scroll",c,!0),window.addEventListener("resize",m)},w=()=>{g===w&&(g=null,A=null),n.contains(document.activeElement)&&t.focus(),o=!1,e.classList.remove("is-open"),n.classList.remove("is-open"),n.inert=!0,t.setAttribute("aria-expanded","false"),document.removeEventListener("pointerdown",d,!0),document.removeEventListener("keydown",f),window.removeEventListener("scroll",c,!0),window.removeEventListener("resize",m),window.removeEventListener("tw-retheme",h),s&&(s.disconnect(),s=null),setTimeout(()=>{o||n.remove()},200)};return t.addEventListener("click",()=>{t.disabled||(o?w():y())}),{open:y,close:w,isOpen:()=>o,reflow:m}}var ke=(e,t)=>{if(e=e.toLowerCase(),e.includes(t))return!0;if(t.length<3)return!1;let n=t.length,r=e.length,o=new Array(r+1).fill(0);for(let s=1;s<=n;s++){let i=[s];for(let a=1;a<=r;a++)i[a]=Math.min(o[a]+1,i[a-1]+1,o[a-1]+(t[s-1]===e[a-1]?0:1));o=i}return Math.min(...o)<=(t.length<6?1:2)},re=typeof matchMedia=="function"?matchMedia("(prefers-reduced-motion: reduce)"):{matches:!1},oe="cubic-bezier(0.22, 1, 0.36, 1)",Ae="cubic-bezier(0.34, 1.2, 0.64, 1)",se=(e,t)=>{re.matches||typeof e.animate!="function"||(e.style.transformOrigin=t>0?"left center":"right center",e.animate([{transform:"scaleX(1)"},{transform:"scaleX(1.18)"},{transform:"scaleX(1)"}],{duration:300,easing:oe}))},ie=(e,t,n)=>{let r=e.querySelector('[data-active="true"]');if(!r)return;let o=r.offsetLeft,s=r.offsetWidth,i=parseFloat(t.style.left);t.style.left=o+"px",t.style.width=s+"px",n&&Number.isFinite(i)&&i!==o&&se(t,o>i?1:-1)},Ce=(e,t)=>{e.classList.toggle("is-disabled",t);for(let n of e.children)n.classList.contains("tw-portal")||(n.inert=t)},Se=(e,t,n,r)=>{e.classList.toggle("is-collapsed",r),t.setAttribute("aria-expanded",String(!r)),n.inert=r},R=(e,t)=>{let n=e.findIndex(r=>r.dataset.value===String(t));return n<0&&e.length?0:n},ae=(e,t)=>{let n=R(e,t);e.forEach((r,o)=>{let s=r.dataset.value===String(t);r.dataset.active=String(s),r.setAttribute("aria-checked",String(s)),r.tabIndex=o===n?0:-1})},le=(e,t,n)=>{let r=W("button",e,K(t));return r.setAttribute("role","radio"),r._twVal=G(t),r.dataset.value=r._twVal,r.addEventListener("click",()=>n(r._twVal)),r},ce=(e,t,n,r=0)=>{switch(e){case"ArrowRight":return(t+1)%n;case"ArrowLeft":return(t-1+n)%n;case"ArrowDown":return r<0?-1:r?t+r<n?t+r:t:(t+1)%n;case"ArrowUp":return r<0?-1:r?t-r>=0?t-r:t:(t-1+n)%n;case"Home":return 0;case"End":return n-1}return-1};function He(e,t,n,r){let o=M("div","tw-seg");o.setAttribute("role","radiogroup"),r&&o.setAttribute("aria-label",r);let s=M("div","tw-seg-pill");o.append(s);let i=e.map(c=>{let d=le("tw-seg-btn",c,f=>m(f));return o.append(d),d}),a=c=>ie(o,s,c),u=()=>{ae(i,t),a(!0)},m=(c,d=!0)=>{c!=null&&!i.some(f=>f._twVal===c)||(t=c,u(),d&&n(c))};return o.addEventListener("keydown",c=>{let d=R(i,t);if(d<0)return;let f=ce(c.key,d,i.length);f<0||(c.preventDefault(),m(i[f]._twVal),i[f].focus())}),u(),X(()=>{a(),o.classList.add("is-ready")}),U(o,[[window,"tw-reflow"]],()=>a()),{el:o,set:c=>m(c,!1),get:()=>t}}var Fe=(e,t="",n=2,r=24)=>`<svg${t?` class="${t}"`:""} viewBox="0 0 ${r} ${r}" fill="none" stroke="currentColor" stroke-width="${n}" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${e}</svg>`,Oe=(e,t)=>({el:e,set:()=>{},get:()=>{},destroy:t}),B={},Pe=(e,t)=>{B[e]=t},Ne=e=>B[e];export{H as a,ue as b,de as c,O as d,$ as e,V as f,_ as g,me as h,j as i,z as j,we as k,I as l,be as m,ge as n,pe as o,he as p,G as q,D as r,K as s,M as t,Ee as u,W as v,q as w,X as x,U as y,ve as z,ye as A,Le as B,Z as C,Me as D,te as E,ne as F,N as G,Te as H,xe as I,ke as J,re as K,oe as L,Ae as M,ie as N,Ce as O,Se as P,R as Q,ae as R,le as S,ce as T,He as U,Fe as V,Oe as W,Pe as X,Ne as Y};
@@ -1 +0,0 @@
1
- import{c as a,d as b,e as c,f as d,g as e}from"./chunk-HWQKSB7T.js";import"./chunk-SIIHIBXV.js";import"./chunk-WWCMYF2Q.js";export{a as CHECKER,d as createPickerBody,b as isColor,e as oklchStr,c as parseColor};
@@ -1 +0,0 @@
1
- import{e as Z}from"./chunk-SIIHIBXV.js";import{A as U,X as Y,g as r,i as T,j as q,k as B,m as G,n as A,o as P,p as C,t as f,v as V,x as J,y as Q}from"./chunk-WWCMYF2Q.js";function nt(a,_){let E=a.label,w=+(a.value&&a.value[0]),x=+(a.value&&a.value[1]),N=Number.isFinite(w)?w:0,k=Number.isFinite(x)?x:1,[S,W]=[C(N),C(k)],R=t=>t!=null&&t!==""&&Number.isFinite(+t),{min:n,max:l,step:h}=G(R(a.min)?a.min:Math.min(S[0],W[0]),R(a.max)?a.max:Math.max(S[1],W[1]),a.step,N,k);[n,l]=B(n,l,h);let $=T(h),b=t=>q(t,n,h),i=r(b(Number.isFinite(w)?w:n),n,l),s=r(b(Number.isFinite(x)?x:l),n,l);if(i>s){let t=i;i=s,s=t}let v=f("div","tw-slider-wrap"),c=f("div","tw-slider tw-interval"),F=f("div","tw-slider-fill"),d=f("div","tw-slider-handle"),u=f("div","tw-slider-handle"),L=V("span","tw-slider-label",E),y=f("span","tw-slider-value");c.append(F,d,u,L,y),v.append(c),[["minimum",d],["maximum",u]].forEach(([t,e])=>{e.tabIndex=0,e.setAttribute("role","slider"),e.setAttribute("aria-label",`${E} ${t}`),e.setAttribute("aria-valuemin",String(n)),e.setAttribute("aria-valuemax",String(l))});let M=t=>(t-n)/(l-n||1)*100,D=t=>`clamp(5px, calc(${t}% - 1.5px), calc(100% - 9px))`,m=()=>{let t=M(i),e=M(s);F.style.left=t+"%",F.style.width=Math.max(0,e-t)+"%",d.style.left=D(t),u.style.left=D(e),y.textContent=`${i.toFixed($)} \u2013 ${s.toFixed($)}`,d.setAttribute("aria-valuenow",String(i)),u.setAttribute("aria-valuenow",String(s));let o=v.offsetWidth;if(o){L.style.maxWidth=Math.max(0,o-y.offsetWidth-12-8-10)+"px";let K=et=>P(L,y,et/100*o-1.5,3);d.classList.toggle("is-dodge",K(M(i))),u.classList.toggle("is-dodge",K(M(s)))}};m();let O=()=>_([i,s]),j=t=>{i=r(Math.min(b(t),s),n,l),m()},H=t=>{s=r(Math.max(b(t),i),n,l),m()},p=null,X=1,g=null,tt=t=>{let e=v.offsetWidth||p.width,o=r((t-p.left)/X/e,0,1);return r(n+o*(l-n),n,l)},z=t=>{let e=tt(t);g||(g=e<i?"lo":e>s?"hi":Math.abs(e-i)<=Math.abs(e-s)?"lo":"hi"),g==="lo"?j(e):H(e),O()};Z(c,{onDown:t=>{t.preventDefault(),p=v.getBoundingClientRect(),X=p.width/(v.offsetWidth||p.width),c.classList.add("is-active","is-dragging"),g=null,z(t.clientX),(g==="lo"?d:u).focus({focusVisible:!1})},onMove:t=>z(t.clientX),onEnd:()=>{p=null,g=null,c.classList.remove("is-active","is-dragging")}}),U(c,m),J(m),Q(c,[[window,"resize"],[window,"tw-reflow"]],m);let I=t=>e=>{let o=t==="lo"?A(e,i,h,n,s):A(e,s,h,i,l);o!=null&&(e.preventDefault(),t==="lo"?j(o):H(o),O())};return d.addEventListener("keydown",I("lo")),u.addEventListener("keydown",I("hi")),{el:v,set:t=>{if(Array.isArray(t)){let e=+t[0],o=+t[1];if(!Number.isFinite(e)||!Number.isFinite(o))return;i=r(b(Math.min(e,o)),n,l),s=r(b(Math.max(e,o)),n,l),m()}},get:()=>[i,s]}}Y("interval",nt);
@@ -1 +0,0 @@
1
- import{a as L,i as se,j as re,l as U}from"./chunk-SIIHIBXV.js";import{I as te,K as ne,U as ie,X as oe,Y as _,g as b,t as a,v as ee}from"./chunk-WWCMYF2Q.js";var X={ease:[.25,.1,.25,1],linear:[0,0,1,1],"ease-in":[.42,0,1,1],"ease-out":[0,0,.58,1],"ease-in-out":[.42,0,.58,1]},ye=300,F=1e4,he=16,ae=.9,ue=e=>!!e&&typeof e=="object",r=e=>typeof e=="number"?Number.isFinite(e):typeof e=="string"&&e.trim()!==""&&Number.isFinite(+e),q=e=>{if(typeof e=="string")return Object.prototype.hasOwnProperty.call(X,e)?X[e].slice():null;if(Array.isArray(e)&&e.length===4){let s=e.map(Number);return s.every(Number.isFinite)?s:null}return null},ce=e=>r(e.stiffness)||r(e.damping)||r(e.mass)||r(e.visualDuration)||r(e.bounce),pe=e=>{let s={mode:"time"};if(r(e.stiffness)){let w=+e.stiffness,M=r(e.mass)?+e.mass:1,g=Math.sqrt(w/M);s.visualDuration=2*Math.PI/g,r(e.damping)&&(s.bounce=b(1-+e.damping/(2*Math.sqrt(w*M)),0,ae))}return r(e.visualDuration)&&(s.visualDuration=+e.visualDuration),r(e.bounce)&&(s.bounce=b(+e.bounce,0,ae)),s},le=(e,s)=>e.mode==="spring"||e.mode==="easing"?e.mode:ce(e)?"spring":q(e.curve)?"easing":s;function ve(e,s){let w=_("cubicbezier"),M=_("spring");if(!w||!M)throw new Error("[tweaks] motion: the bezier and spring controls are not loaded");let g=ue(e.value)?e.value:{},i=le(g,"easing"),l=q(g.curve)??X.ease.slice(),y=r(g.duration)?b(+g.duration,0,F):ye,{root:R,trigger:me,right:de}=se("tw-motion",e.label??"Motion"),B=a("span","tw-trigger-chip tw-motion-chip"),E=L("svg");E.setAttribute("viewBox","0 0 100 100"),E.setAttribute("preserveAspectRatio","none");let H=L("path");E.append(H),B.append(E);let V=a("span","tw-trigger-value");de.append(B,V);let j=a("div","tw-color-pop tw-motion-pop"),W=a("div","tw-motion-body");j.append(W);let C=w({...e,type:"cubicbezier",label:"",value:l.slice()},t=>{l=t,v(),S()});l=C.get();let p=M({...e,type:"spring",label:"",value:pe(g)},()=>{v(),S()}),D=re({label:"Duration",value:y,step:10,min:0,max:F,unit:"ms"},t=>{y=b(t,0,F),v(),S()});y=D.get();let I=a("div","tw-motion-pane"),$=a("div","tw-motion-pane"),G=a("div","tw-fields");G.append(D.el),I.append(C.el,G),$.append(p.el);let c=a("div","tw-motion-stage"),h=a("div","tw-motion-box");c.append(h);let O=ie([{value:"easing",label:"Easing"},{value:"spring",label:"Spring"}],i,t=>{(t==="easing"||t==="spring")&&t!==i&&(i=t,z(),v(),S())},"Motion type"),K=a("div","tw-row");K.append(ee("span","tw-row-label","Type"),O.el),W.append(K,I,$,c),R.append(j);let P=()=>{if(i==="easing")return{mode:i,curve:l.slice(),duration:y,easing:`cubic-bezier(${l.join(", ")})`};let t=p.get(),n=7/Math.max(t.damping/(2*t.mass),.5),u=b(Math.round(n*40),48,240);return{mode:i,...t,duration:Math.round(n*1e3),easing:`linear(${U(t.stiffness,t.damping,t.mass,u,n).map(o=>+o.toFixed(3)).join(", ")})`}},S=()=>s(P()),x=!1,A=null,k=t=>{if(t)x=!x;else if(A&&A.playState==="running")return;let n=P(),u=Math.max(0,c.clientWidth-h.offsetWidth-2*he),o=`translateX(${x?0:u}px)`,m=`translateX(${x?u:0}px)`;if(ne.matches||typeof h.animate!="function"){h.style.transform=m;return}A?.cancel();let d=[{transform:o},{transform:m}];try{A=h.animate(d,{duration:n.duration,easing:n.easing,fill:"forwards"})}catch{A=h.animate(d,{duration:n.duration,fill:"forwards"})}};c.addEventListener("click",()=>k(!0)),c.tabIndex=0,c.setAttribute("role","button"),c.setAttribute("aria-label","Replay the motion"),c.addEventListener("keydown",t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),k(!0))});let ge=()=>{let t;if(i==="easing"){let[o,m,d,be]=l;t=[];for(let N=0;N<=24;N++){let f=N/24,T=1-f,Q=3*T*T*f,Y=3*T*f*f,Z=f*f*f;t.push([Q*o+Y*d+Z,Q*m+Y*be+Z])}}else{let o=p.get();t=U(o.stiffness,o.damping,o.mass,32).map((m,d)=>[d/31,m])}let n=Math.max(1,...t.map(o=>o[1])),u=Math.min(0,...t.map(o=>o[1]));return t.map(([o,m],d)=>`${d?"L":"M"}${(10+o*80).toFixed(1)},${(90-(m-u)/(n-u)*80).toFixed(1)}`).join(" ")},J=()=>{i==="easing"?C.set(l.slice()):p.set(p.get())},z=()=>{I.style.display=i==="easing"?"":"none",$.style.display=i==="spring"?"":"none",J()},fe=()=>i==="easing"?`Easing \xB7 ${y} ms`:`Spring \xB7 ${Math.round((p.get().visualDuration??0)*1e3)} ms`,v=()=>{H.setAttribute("d",ge()),V.textContent=fe(),k(!1)};return te(R,me,j,{width:240,fallbackH:380,gap:6,onOpen:()=>{O.set(i),J(),k(!0)},initialFocus:()=>O.el.querySelector('[tabindex="0"]')}),z(),v(),{el:R,set:t=>{let n=typeof t=="string"?{curve:t}:Array.isArray(t)&&t.length===4?{curve:t}:ue(t)?t:null;if(!n)return;i=le(n,i);let u=q(n.curve);u&&(C.set(u.slice()),l=C.get()),i==="easing"&&r(n.duration)&&(D.set(b(+n.duration,0,F)),y=D.get()),ce(n)&&p.set(pe(n)),O.set(i),z(),v()},get:P,destroy:()=>p.destroy&&p.destroy()}}oe("motion",ve);
@@ -1 +0,0 @@
1
- import{d as m,f as K}from"./chunk-HWQKSB7T.js";import{i as G,j as J}from"./chunk-SIIHIBXV.js";import{I as X,U as Y,V as q,X as z,t as l,u as D,v as M}from"./chunk-WWCMYF2Q.js";var b={x:0,y:8,blur:24,spread:0,color:"rgb(0 0 0 / 0.18)"},ne=t=>!!t&&typeof t=="object",w=(t,c)=>t!=null&&t!==""&&Number.isFinite(+t)?+t:c,i=t=>String(+t.toFixed(1)),oe=/#[0-9a-f]{3,8}\b|(?:oklch|oklab|rgba?|hsla?|hwb|lab|lch|color)\([^()]*\)/i,re=/^(-?\d*\.?\d+)(px)?$/,se=t=>{let c=oe.exec(t);if(!c||!m(c[0]))return null;let h=(t.slice(0,c.index)+" "+t.slice(c.index+c[0].length)).trim().split(/\s+/).filter(Boolean),p=h.includes("inset"),r=h.filter(o=>o!=="inset");if(r.length<2||r.length>4||!r.every(o=>re.test(o)))return null;let s=r.map(o=>+o.replace(/px$/,""));return{inset:p,x:s[0],y:s[1],blur:s[2]??0,spread:s[3]??0,color:c[0]}},le=q('<path d="M18 9s-4.4 6-6 6-6-6-6-6"/>',"tw-shadow-chevron",2.5);function ie(t,c){let h=e=>typeof e=="string"?se(e):ne(e)?e:null,p=h(t.value??t)||{},r=!!p.inset,s=w(p.x,b.x),o=w(p.y,b.y),u=Math.max(0,w(p.blur,b.blur)),d=w(p.spread,b.spread),{root:y,trigger:Q,right:U}=G("tw-shadow",t.label??"Shadow"),j=l("span","tw-trigger-chip tw-shadow-chip"),F=l("span","tw-shadow-chip-tile");j.append(F);let N=l("span","tw-trigger-value");U.append(j,N);let S=l("div","tw-color-pop tw-shadow-pop"),A=l("div","tw-shadow-stage"),I=l("div","tw-shadow-card");A.append(I);let L=Y([{value:"outer",label:"Outer"},{value:"inner",label:"Inner"}],r?"inner":"outer",e=>{e==="inner"!==r&&(r=e==="inner",g(),E())},"Shadow position"),T=l("div","tw-row");T.append(M("span","tw-row-label","Position"),L.el);let B=l("div","tw-fields tw-shadow-fields"),x=(e,n,Z,ee)=>{let P=J({label:e,value:n(),step:1,min:ee,unit:"px"},te=>{Z(te),g(),E()});return B.append(P.el),P},v=x("X",()=>s,e=>{s=e}),$=x("Y",()=>o,e=>{o=e}),C=x("Blur",()=>u,e=>{u=Math.max(0,e)},0),R=x("Spread",()=>d,e=>{d=e});s=v.get(),o=$.get(),u=C.get(),d=R.get();let f=D("tw-trigger tw-shadow-color");f.setAttribute("aria-expanded","false");let H=l("span","tw-trigger-chip tw-color-swatch"),V=l("span","tw-trigger-value"),k=l("span","tw-trigger-right");k.append(H,V),k.insertAdjacentHTML("beforeend",le),f.append(M("span","tw-trigger-label","Colour"),k);let a=K({value:typeof p.color=="string"&&m(p.color)?p.color:b.color,onMode:()=>g()},()=>{g(),E()});a.el.hidden=!0,f.addEventListener("click",()=>{let e=a.el.hidden;a.el.hidden=!e,f.setAttribute("aria-expanded",String(e)),W.reflow()}),S.append(A,T,B,f,a.el),y.append(S);let O=e=>`${r?"inset ":""}${i(s*e)}px ${i(o*e)}px ${i(u*e)}px ${i(d*e)}px ${a.get()}`,_=()=>({inset:r,x:+i(s),y:+i(o),blur:+i(u),spread:+i(d),color:a.get(),css:O(1)}),E=()=>c(_()),g=()=>{I.style.boxShadow=O(1),F.style.boxShadow=O(.3),N.textContent=`${r?"in ":""}${i(s)} ${i(o)} ${i(u)}${d?" "+i(d):""}`,H.style.background=a.swatchCss(),V.textContent=a.valueText()},W=X(y,Q,S,{width:260,fallbackH:300,gap:6,onOpen:a.reflow,onReflow:a.reflow});return g(),{el:y,set:e=>{let n=h(e);n&&(n.inset!=null&&(r=!!n.inset,L.set(r?"inner":"outer")),n.x!=null&&(v.set(w(n.x,s)),s=v.get()),n.y!=null&&($.set(w(n.y,o)),o=$.get()),n.blur!=null&&(C.set(w(n.blur,u)),u=C.get()),n.spread!=null&&(R.set(w(n.spread,d)),d=R.get()),typeof n.color=="string"&&m(n.color)&&a.set(n.color),g())},get:_}}z("shadow",ie);
@@ -1 +0,0 @@
1
- import{N as f,T as g,X as w,t as s,v,x as m}from"./chunk-WWCMYF2Q.js";var A=0;function x(E){let o=`tw-tabs-${++A}`,c=s("div","tw-tabs"),r=s("div","tw-tabs-bar");r.setAttribute("role","tablist");let l=s("div","tw-tabs-pill");r.append(l);let u=s("div","tw-tabs-pages"),d=[],i=E.pages.map((a,e)=>{let t=v("button","tw-tabs-tab",a.title);t.setAttribute("role","tab"),t.dataset.active=String(e===0),t.setAttribute("aria-selected",String(e===0)),t.tabIndex=e===0?0:-1,t.id=`${o}-tab-${e}`,t.setAttribute("aria-controls",`${o}-page-${e}`);let n=s("div","tw-tabs-page tw-controls");return n.dataset.active=String(e===0),n.setAttribute("role","tabpanel"),n.id=`${o}-page-${e}`,n.setAttribute("aria-labelledby",t.id),d.push(n),u.append(n),t.addEventListener("click",()=>b(e)),r.append(t),t});c.append(r,u);let p=a=>f(r,l,a);function b(a){i.forEach((e,t)=>{e.dataset.active=String(t===a),e.setAttribute("aria-selected",String(t===a)),e.tabIndex=t===a?0:-1}),d.forEach((e,t)=>e.dataset.active=String(t===a)),p(!0),requestAnimationFrame(()=>window.dispatchEvent(new Event("tw-reflow")))}return r.addEventListener("keydown",a=>{let e=i.findIndex(n=>n.dataset.active==="true");if(e<0)return;let t=g(a.key,e,i.length,-1);t<0||(a.preventDefault(),b(t),i[t].focus())}),m(p),{el:c,bodies:d,activate:b,active:()=>i.findIndex(a=>a.dataset.active==="true")}}w("tabs",x);