tweakit 0.2.0 → 0.3.0
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 +3 -0
- package/dist/tweaks/bezier-WUBSS72H.js +1 -0
- package/dist/tweaks/chunk-DPJ7YRTN.js +1 -0
- package/dist/tweaks/chunk-GC5PWSSX.js +1 -0
- package/dist/tweaks/colour-ZTCDZ2NN.js +1 -0
- package/dist/tweaks/core.js +1 -1
- package/dist/tweaks/gradient-54DF4XNE.js +1 -0
- package/dist/tweaks/image-IR5QKXT4.js +1 -0
- package/dist/tweaks/interval-KXOP2WEL.js +1 -0
- package/dist/tweaks/monitor-5K5VMRAL.js +2 -0
- package/dist/tweaks/plot-3WWIZG7H.js +2 -0
- package/dist/tweaks/point-RPJKP5YR.js +1 -0
- package/dist/tweaks/spring-TPWZKO7B.js +1 -0
- package/dist/tweaks/tabs-AVAHPF5A.js +1 -0
- package/dist/tweaks.css +1 -1
- package/dist/tweaks.js +4 -3
- package/dist/types/tweaks/core.d.ts +4 -4
- package/dist/types/tweaks/enhance.d.ts +1 -0
- package/dist/types/tweaks/panel.d.ts +2 -0
- package/dist/types/tweaks/standalone.d.ts +3 -0
- package/dist/types/tweaks/types.d.ts +84 -2
- package/package.json +12 -8
- package/dist/tweaks/bezier-4JJDADLM.js +0 -1
- package/dist/tweaks/chunk-K6N3NNAW.js +0 -1
- package/dist/tweaks/chunk-NMISCM24.js +0 -1
- package/dist/tweaks/colour-J2FKMVZA.js +0 -1
- package/dist/tweaks/gradient-MV3DECUF.js +0 -1
- package/dist/tweaks/image-NZPSGN4W.js +0 -1
- package/dist/tweaks/interval-K4JN65W5.js +0 -1
- package/dist/tweaks/monitor-PUIUETKC.js +0 -2
- package/dist/tweaks/plot-IB2Q2LCO.js +0 -2
- package/dist/tweaks/point-UZ77545Q.js +0 -1
- package/dist/tweaks/spring-IJA5GPVX.js +0 -1
- package/dist/tweaks/tabs-IVS2Y3JA.js +0 -1
- package/dist/types/tweaks/controls/bezier.d.ts +0 -1
- package/dist/types/tweaks/controls/colour.d.ts +0 -14
- package/dist/types/tweaks/controls/gradient.d.ts +0 -1
- package/dist/types/tweaks/controls/image.d.ts +0 -1
- package/dist/types/tweaks/controls/interval.d.ts +0 -1
- package/dist/types/tweaks/controls/monitor.d.ts +0 -1
- package/dist/types/tweaks/controls/plot.d.ts +0 -1
- package/dist/types/tweaks/controls/point.d.ts +0 -1
- package/dist/types/tweaks/controls/spring.d.ts +0 -1
- package/dist/types/tweaks/controls/tabs.d.ts +0 -1
- package/dist/types/tweaks/shared.d.ts +0 -82
- package/dist/types/tweaks/single.d.ts +0 -12
- package/dist/types/wide-gamut.d.ts +0 -121
|
@@ -16,6 +16,9 @@ export type GradientInterpolation = "srgb" | "hsl" | "hwb" | "oklch" | "oklab" |
|
|
|
16
16
|
export type Get = (key: string) => unknown;
|
|
17
17
|
/** Per-control extras that can ride on any object-form value. */
|
|
18
18
|
export interface ControlOptions {
|
|
19
|
+
/** The label shown for this control, in place of the title-cased key; `""` shows no label.
|
|
20
|
+
* Honored by every verbose `{ type }` form (in a plain folder object, `label` is a child). */
|
|
21
|
+
label?: string;
|
|
19
22
|
/** Show/hide this control based on other values. */
|
|
20
23
|
render?: (get: Get) => boolean;
|
|
21
24
|
/** Grey-out + lock this control (static, or derived from other values). */
|
|
@@ -53,7 +56,6 @@ export type SchemaObject = {
|
|
|
53
56
|
} | {
|
|
54
57
|
type: "color";
|
|
55
58
|
value?: string;
|
|
56
|
-
label?: string;
|
|
57
59
|
} | {
|
|
58
60
|
type: "text";
|
|
59
61
|
value?: string;
|
|
@@ -74,6 +76,7 @@ export type SchemaObject = {
|
|
|
74
76
|
damping?: number;
|
|
75
77
|
mass?: number;
|
|
76
78
|
value?: {
|
|
79
|
+
mode?: "time" | "physics";
|
|
77
80
|
visualDuration?: number;
|
|
78
81
|
bounce?: number;
|
|
79
82
|
stiffness?: number;
|
|
@@ -101,6 +104,7 @@ export type SchemaObject = {
|
|
|
101
104
|
stops: GradientStop[];
|
|
102
105
|
interpolation?: GradientInterpolation;
|
|
103
106
|
} | Array<GradientStop | [string, number]>;
|
|
107
|
+
stops?: Array<GradientStop | [string, number]>;
|
|
104
108
|
} | {
|
|
105
109
|
type: "plot";
|
|
106
110
|
expr?: string;
|
|
@@ -111,9 +115,10 @@ export type SchemaObject = {
|
|
|
111
115
|
yMax?: number;
|
|
112
116
|
samples?: number;
|
|
113
117
|
editable?: boolean;
|
|
118
|
+
min?: number;
|
|
119
|
+
max?: number;
|
|
114
120
|
} | {
|
|
115
121
|
type: "fpsgraph";
|
|
116
|
-
label?: string;
|
|
117
122
|
} | {
|
|
118
123
|
type: "monitor";
|
|
119
124
|
get?: () => number | string;
|
|
@@ -303,4 +308,81 @@ export interface Control {
|
|
|
303
308
|
el: HTMLElement;
|
|
304
309
|
set(value: unknown): void;
|
|
305
310
|
get(): unknown;
|
|
311
|
+
/** Release any loop the control owns (the monitor's poll, the FPS graph's rAF). Only
|
|
312
|
+
* the live controls supply it; the panel calls it from `destroy()`. */
|
|
313
|
+
destroy?(): void;
|
|
314
|
+
}
|
|
315
|
+
/** Options for `mountControl(host, value, opts?)` — one control, no panel. */
|
|
316
|
+
export interface MountOptions {
|
|
317
|
+
/** The key passed to `onChange` and used to derive the label when none is given (default `"value"`). */
|
|
318
|
+
key?: string;
|
|
319
|
+
/** The label shown on the control; `""` shows none (the host page already has one). Wins over
|
|
320
|
+
* the title-cased key and over a verbose form's own `label`. */
|
|
321
|
+
label?: string;
|
|
322
|
+
/** Fired with the new value whenever the control changes — by hand or through `set()`. */
|
|
323
|
+
onChange?: (value: unknown, key: string) => void;
|
|
324
|
+
}
|
|
325
|
+
/** The handle `mountControl()` returns. */
|
|
326
|
+
export interface MountedControl {
|
|
327
|
+
/** The wrapper (`.tw-control`) the control lives in, already appended to the host and
|
|
328
|
+
* stable from creation — it carries the kit's tokens, so the control renders outside a
|
|
329
|
+
* panel. On the code-split build a lazily-loaded control fills it in once `ready` resolves. */
|
|
330
|
+
el: HTMLElement;
|
|
331
|
+
/** Apply a value — the control updates AND `onChange` fires (when the value actually
|
|
332
|
+
* changed). Before `ready`, the value is queued and applied once the control builds. */
|
|
333
|
+
set(value: unknown): void;
|
|
334
|
+
/** The current value (the queued or schema value before `ready`; `undefined` for a
|
|
335
|
+
* valueless control such as a button). */
|
|
336
|
+
get(): unknown;
|
|
337
|
+
/** Remove the control from the host and release anything it owns. */
|
|
338
|
+
destroy(): void;
|
|
339
|
+
/** Resolves with this handle once the control has built — immediately on the single-file build. */
|
|
340
|
+
ready: Promise<MountedControl>;
|
|
341
|
+
}
|
|
342
|
+
/** The notations the colour picker edits in (its mode dropdown). The emitted value follows
|
|
343
|
+
* the mode: `hex` gives `#rrggbb`, the wide-gamut modes give a CSS colour like `oklch(…)`. */
|
|
344
|
+
export type ColorMode = "hex" | "srgb" | "css" | "hsl" | "hwb" | "oklch" | "oklab" | "lch" | "lab" | "p3" | "rec2020";
|
|
345
|
+
/** Options for `createColorPicker(opts?)` — the picker body alone, no trigger row. */
|
|
346
|
+
export interface ColorPickerOptions {
|
|
347
|
+
/** The colour it opens on — any CSS colour string (default `#7c5cff`). */
|
|
348
|
+
value?: string;
|
|
349
|
+
/** The notation it opens in (default `oklch`). */
|
|
350
|
+
mode?: ColorMode;
|
|
351
|
+
/** Fired with the new colour string whenever it changes — by hand or through `set()`. */
|
|
352
|
+
onChange?: (value: string) => void;
|
|
353
|
+
}
|
|
354
|
+
/** The handle `createColorPicker()` returns. Bring your own trigger: append `el` to a popover
|
|
355
|
+
* or a panel of your own; the kit owns the editor surface and the gamut math. */
|
|
356
|
+
export interface ColorPicker {
|
|
357
|
+
/** The picker's root (`.tw-color-picker`), stable from creation; it carries the kit's tokens,
|
|
358
|
+
* so the picker renders anywhere. On the code-split build the editor fills it in once the
|
|
359
|
+
* colour chunk has loaded. */
|
|
360
|
+
el: HTMLElement;
|
|
361
|
+
/** Apply a colour — the picker updates AND `onChange` fires (when the colour actually changed). */
|
|
362
|
+
set(value: string): void;
|
|
363
|
+
/** The current colour, serialized in the picker's mode. */
|
|
364
|
+
get(): string;
|
|
365
|
+
/** The current notation. */
|
|
366
|
+
mode(): ColorMode;
|
|
367
|
+
/** Switch notation — formatting only, nothing fires. */
|
|
368
|
+
setMode(mode: ColorMode): void;
|
|
369
|
+
/** Re-rasterize and re-place the thumbs. It reflows itself a frame after creation; call
|
|
370
|
+
* this when you show it later (a popover opening) or after it resizes. */
|
|
371
|
+
reflow(): void;
|
|
372
|
+
/** Remove the picker from the DOM. */
|
|
373
|
+
destroy(): void;
|
|
374
|
+
/** Resolves with this handle once the editor has built — immediately on the single-file build. */
|
|
375
|
+
ready: Promise<ColorPicker>;
|
|
376
|
+
}
|
|
377
|
+
/** `detail` of the `tw:change` event a `[data-tw]` host dispatches (bubbling) whenever its
|
|
378
|
+
* control changes — `key` is the host's `data-key` (or its label), `value` the new value,
|
|
379
|
+
* also written to the host's `data-value`. */
|
|
380
|
+
export interface TwChangeDetail {
|
|
381
|
+
key: string;
|
|
382
|
+
value: unknown;
|
|
383
|
+
}
|
|
384
|
+
declare global {
|
|
385
|
+
interface HTMLElementEventMap {
|
|
386
|
+
"tw:change": CustomEvent<TwChangeDetail>;
|
|
387
|
+
}
|
|
306
388
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tweakit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"main": "./dist/tweaks.js",
|
|
6
|
+
"types": "./dist/types/tweaks/core.d.ts",
|
|
5
7
|
"description": "A dependency-free, code-split real-time parameter panel — sliders, toggles, a wide-gamut OKLCH colour picker, curve editors and more, from a plain schema.",
|
|
6
8
|
"license": "MIT",
|
|
7
9
|
"author": "Ryan Kiley",
|
|
@@ -30,20 +32,22 @@
|
|
|
30
32
|
"prepublishOnly": "node build.mjs && node --test \"test/*.test.mjs\"",
|
|
31
33
|
"serve": "node build.mjs && python3 -m http.server 4330 --directory dist"
|
|
32
34
|
},
|
|
33
|
-
"types": "./dist/types/tweaks/single.d.ts",
|
|
34
35
|
"exports": {
|
|
35
36
|
".": {
|
|
36
|
-
"types": "./dist/types/tweaks/
|
|
37
|
-
"import": "./dist/tweaks.js"
|
|
37
|
+
"types": "./dist/types/tweaks/core.d.ts",
|
|
38
|
+
"import": "./dist/tweaks.js",
|
|
39
|
+
"default": "./dist/tweaks.js"
|
|
38
40
|
},
|
|
39
41
|
"./core": {
|
|
40
42
|
"types": "./dist/types/tweaks/core.d.ts",
|
|
41
|
-
"import": "./dist/tweaks/core.js"
|
|
43
|
+
"import": "./dist/tweaks/core.js",
|
|
44
|
+
"default": "./dist/tweaks/core.js"
|
|
42
45
|
},
|
|
43
46
|
"./css": {
|
|
44
47
|
"types": "./dist/tweaks.css.d.ts",
|
|
45
48
|
"default": "./dist/tweaks.css"
|
|
46
|
-
}
|
|
49
|
+
},
|
|
50
|
+
"./package.json": "./package.json"
|
|
47
51
|
},
|
|
48
52
|
"files": [
|
|
49
53
|
"dist/tweaks",
|
|
@@ -55,7 +59,7 @@
|
|
|
55
59
|
],
|
|
56
60
|
"devDependencies": {
|
|
57
61
|
"esbuild": "^0.28.0",
|
|
58
|
-
"jsdom": "^
|
|
59
|
-
"typescript": "^
|
|
62
|
+
"jsdom": "^30.1.2",
|
|
63
|
+
"typescript": "^7.0.2"
|
|
60
64
|
}
|
|
61
65
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{N as K,P as O,b as N,j as C,k as a,l as L,q as k,r as q,u as J}from"./chunk-K6N3NNAW.js";function U(Y,M){let P=[.25,.1,.25,1],s=Array.isArray(Y.value)&&Y.value.length===4?Y.value.map(Number):P.slice();s.some(e=>!Number.isFinite(e))&&(s=P.slice());let d=-.25,A=1.25,R=A-d,l=8,B=C("div","tw-bezier"),b=C("div","tw-bezier-graph"),m=a("svg","tw-bezier-svg");m.setAttribute("preserveAspectRatio","none");let X=a("line","tw-bezier-guide"),G=a("line","tw-bezier-guide"),H=a("line","tw-bezier-diag"),W=a("line","tw-bezier-ctl"),S=a("line","tw-bezier-ctl"),I=a("path","tw-bezier-curve");m.append(X,G,H,W,S,I);let g=L("tw-bezier-handle");g.setAttribute("aria-label","Control point 1");let f=L("tw-bezier-handle");f.setAttribute("aria-label","Control point 2"),b.append(m,g,f);let T=C("div","tw-fields tw-bezier-fields");B.append(b,T);let p=0,z=0,$=e=>l+e*(p-2*l),F=e=>z-l-(e-d)/R*(z-2*l),w=(e,i,t,o,r)=>{e.setAttribute("x1",i),e.setAttribute("y1",t),e.setAttribute("x2",o),e.setAttribute("y2",r)},h=()=>{if(p=b.offsetWidth,z=b.offsetHeight,p<2)return;m.setAttribute("viewBox",`0 0 ${p} ${z}`);let[e,i,t,o]=s,r=$(0),n=F(0),c=$(1),u=F(1),y=$(e),x=F(i),v=$(t),D=F(o);w(X,l,n,p-l,n),w(G,l,u,p-l,u),w(H,r,n,c,u),w(W,r,n,y,x),w(S,c,u,v,D),I.setAttribute("d",`M${r},${n} C${y},${x} ${v},${D} ${c},${u}`),g.style.left=y+"px",g.style.top=x+"px",f.style.left=v+"px",f.style.top=D+"px"},E=[{label:"X1",i:0,lo:0,hi:1},{label:"Y1",i:1,lo:d,hi:A},{label:"X2",i:2,lo:0,hi:1},{label:"Y2",i:3,lo:d,hi:A}],Q=E.map(e=>{let i=K({label:e.label,value:s[e.i],step:.01,min:e.lo,max:e.hi},t=>{s[e.i]=t,h(),M(s.slice())});return T.append(i.el),i}),V=()=>Q.forEach((e,i)=>e.set(s[E[i].i])),j=(e,i)=>{let t=null,o=0,r=0,n=1;J(e,{onDown:c=>{c.preventDefault(),t=b.getBoundingClientRect(),o=b.offsetWidth||t.width,r=b.offsetHeight||t.height,n=t.width/o,e.classList.add("is-dragging"),e.focus({focusVisible:!1})},onMove:c=>{let u=(c.clientX-t.left)/n,y=(c.clientY-t.top)/n,x=N((u-l)/(o-2*l),0,1),v=N(d+(r-l-y)/(r-2*l)*R,d,A);s[i*2]=+x.toFixed(2),s[i*2+1]=+v.toFixed(2),h(),V(),M(s.slice())},onEnd:()=>{t=null,e.classList.remove("is-dragging")}})};return j(g,0),j(f,1),k(h),q(B,[[window,"resize"],[window,"tw-reflow"]],h),{el:B,set:e=>{if(Array.isArray(e)&&e.length===4){let i=e.map(Number);if(i.some(t=>!Number.isFinite(t)))return;s=i.map((t,o)=>N(t,E[o].lo,E[o].hi)),h(),V()}},get:()=>s.slice()}}O("cubicbezier",U);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var M=t=>t.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase()).trim(),v=(t,e,n)=>Math.min(n,Math.max(e,t)),tt=t=>typeof t=="string"&&(/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t.trim())||/^(oklch|oklab|rgba?|hsla?|hwb|lab|lch|color)\(/i.test(t.trim())),E=t=>{let e=String(t),n=/e-(\d+)$/i.exec(e);if(n)return Number(n[1])+(e.split("e")[0].split(".")[1]||"").length;let r=e.indexOf(".");return r===-1?0:e.length-r-1},F=(t,e,n)=>n>0?Number((e+Math.round((t-e)/n)*n).toFixed(E(n))):t,et=(t,e)=>{let n=e-t;return n<=1?.01:n<=10?.1:n<=100?1:10},nt=t=>t>=0?[0,t<=1?1:t*3||100]:[t>=-1?-1:t*3,0],L=t=>t==null?void 0:typeof t=="object"?t.value:t,I=t=>t==null?"":typeof t=="string"?M(t):typeof t=="object"?t.label??String(t.value):String(t),P="http://www.w3.org/2000/svg",p=(t,e,n)=>{let r=document.createElement(t);return e&&(r.className=e),n!=null&&(r.innerHTML=n),r},rt=(t,e)=>{let n=document.createElementNS(P,t);return e&&n.setAttribute("class",e),n},A=(t,e)=>{let n=p("button",t,e);return n.type="button",n},k=(t,e,n)=>{let r=p(t,e);return r.textContent=n,r},it=(t,e)=>getComputedStyle(t).getPropertyValue(e).trim(),st=t=>{let e=getComputedStyle(t),n=r=>e.getPropertyValue(r).trim();return n("--tw-accent")||n("--tw-text-primary")||"#fff"},N=t=>["pointerdown","pointermove","pointerup"].forEach(e=>t.addEventListener(e,n=>n.stopPropagation())),R=t=>{requestAnimationFrame(t),document.fonts&&document.fonts.ready&&document.fonts.ready.then(t)},T=(t,e,n)=>{let r=o=>{if(!t.isConnected)return i();n(o)},i=()=>e.forEach(([o,s])=>o.removeEventListener(s,r));return e.forEach(([o,s])=>o.addEventListener(s,r)),i},ot=(t,e)=>{t.addEventListener("pointerenter",()=>{t.classList.add("is-hover"),e&&e()}),t.addEventListener("pointerleave",()=>t.classList.remove("is-hover"))},y=!1;typeof document<"u"&&(document.addEventListener("pointerdown",()=>{y=!0},!0),document.addEventListener("keydown",()=>{y=!1},!0));var O=t=>{t.addEventListener("focus",()=>t.classList.toggle("tw-focus-quiet",y)),t.addEventListener("blur",()=>t.classList.remove("tw-focus-quiet"))};function $(t,{onDown:e,onMove:n,onEnd:r}={}){let i=null,o=s=>{i===null||s.pointerId!==i||(i=null,r&&r(s))};t.addEventListener("pointerdown",s=>{if(!(s.button!==0||i!==null)){i=s.pointerId;try{t.setPointerCapture(s.pointerId)}catch{}e&&e(s)}}),t.addEventListener("pointermove",s=>{if(s.pointerId===i){if(s.buttons===0)return o(s);n&&n(s)}}),t.addEventListener("pointerup",o),t.addEventListener("pointercancel",o),t.addEventListener("lostpointercapture",o)}var at=(t,e)=>$(t,{onDown:n=>{t.classList.add("is-grabbing"),e(n)},onMove:e,onEnd:()=>t.classList.remove("is-grabbing")}),ct=(t,e)=>{let n=e.getBoundingClientRect();return[v((t.clientX-n.left)/n.width,0,1),v((t.clientY-n.top)/n.height,0,1)]},dt=(t,e,n=1/0)=>{let r=t.getBoundingClientRect(),i=Math.min(window.devicePixelRatio||1,n);return t.width=r.width*i,t.height=r.height*i,e.setTransform(i,0,0,i,0,0),[r.width,r.height]},H=(t,e,{width:n,fallbackH:r=300,gap:i=6,align:o="start",prefer:s="below"}={})=>{let a=t.getBoundingClientRect();n==="match"&&(e.style.width=a.width+"px");let w=n==="match"?a.width:e.offsetWidth||n||0,m=o==="end"?a.right-w:o==="center"?a.left+a.width/2-w/2:a.left;e.style.left=Math.max(8,Math.min(m,window.innerWidth-w-8))+"px";let u=e.offsetHeight||r,l=window.innerHeight-a.bottom,d=a.top,c=u+12,f=l>=c,g=d>=c,C=(s==="above"?g||!f&&d>=l:!f&&(g||d>l))?a.top-u-i:a.bottom+i;e.style.top=v(C,i,window.innerHeight-u-i)+"px"},X={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"},_=new Set(["radius","density"]),b=t=>(t/=255,t<=.03928?t/12.92:((t+.055)/1.055)**2.4),V=t=>{t=String(t).trim();let e=/^#([0-9a-f]{3})$/i.exec(t);if(e)return e[1].split("").map(n=>parseInt(n+n,16));if(e=/^#([0-9a-f]{6})$/i.exec(t),e)return[0,2,4].map(n=>parseInt(e[1].slice(n,n+2),16));if(e=/^rgba?\(([^)]+)\)/i.exec(t),e){let n=e[1].split(/[\s,/]+/).filter(Boolean).map(parseFloat);return[n[0],n[1],n[2]]}return null},B=t=>{let e=V(t);if(!e||e.some(r=>!Number.isFinite(r)))return"#ffffff";let n=.2126*b(e[0])+.7152*b(e[1])+.0722*b(e[2]);return 1.05/(n+.05)>=(n+.05)/.0571?"#ffffff":"#161616"},lt=t=>{if(!t||typeof t!="object")return null;let e={};for(let[n,r]of Object.entries(t)){if(n.startsWith("--")){e[n]=String(r);continue}let i=X[n];i&&(e[i]=_.has(n)&&typeof r=="number"?`${r}px`:String(r))}return e["--tw-accent"]&&!e["--tw-on-accent"]&&(e["--tw-on-accent"]=B(e["--tw-accent"])),Object.keys(e).length?e:null},j=(t,e)=>{if(t){if(t._twAppliedVars)for(let n of t._twAppliedVars)t.style.removeProperty(n);if(t._twAppliedVars=e?Object.keys(e):null,e)for(let n in e)t.style.setProperty(n,e[n])}},D=(t,e)=>{let n=e?.closest('[data-tw-scheme="light"]')?"light":e?.closest('[data-tw-scheme="dark"]')?"dark":null;n?t.setAttribute("data-tw-scheme",n):t.removeAttribute("data-tw-scheme")},x=(t,e)=>{j(t,e?.closest(".tw-panel")?._twTheme),D(t,e)},h=null,ut=()=>{h&&h()};function ft(t,e,n,r={}){let i=!1,o=null;n.classList.add("tw-portal"),n.addEventListener("pointerdown",f=>e.closest(".tw-panel")?._twEditPointer?.(f),!0),N(n);let s=()=>H(e,n,{width:r.width,fallbackH:r.fallbackH,gap:r.gap,align:r.align}),a=()=>{if(i){if(!t.isConnected)return c();s(),r.onReflow&&r.onReflow()}},w=f=>{!t.contains(f.target)&&!n.contains(f.target)&&c()},m=f=>{f.key==="Escape"&&i&&(c(),e.focus())},u=()=>x(n,t),l=f=>{f.every(g=>g.target===n)||u()},d=()=>{h&&h!==c&&h(),h=c,i=!0,t.classList.add("is-open"),e.setAttribute("aria-expanded","true"),document.body.appendChild(n),x(n,t),window.addEventListener("tw-retheme",u),typeof MutationObserver=="function"&&(o=new MutationObserver(l),o.observe(document.documentElement,{subtree:!0,attributes:!0,attributeFilter:["data-tw-scheme"]})),s(),requestAnimationFrame(()=>{n.classList.add("is-open"),r.onOpen&&r.onOpen(),s()}),requestAnimationFrame(function f(){if(i){if(!t.isConnected)return c();requestAnimationFrame(f)}}),setTimeout(()=>document.addEventListener("pointerdown",w,!0),0),document.addEventListener("keydown",m),window.addEventListener("scroll",a,!0),window.addEventListener("resize",a)},c=()=>{h===c&&(h=null),n.contains(document.activeElement)&&e.focus(),i=!1,t.classList.remove("is-open"),n.classList.remove("is-open"),e.setAttribute("aria-expanded","false"),document.removeEventListener("pointerdown",w,!0),document.removeEventListener("keydown",m),window.removeEventListener("scroll",a,!0),window.removeEventListener("resize",a),window.removeEventListener("tw-retheme",u),o&&(o.disconnect(),o=null),setTimeout(()=>{i||n.remove()},200)};return e.addEventListener("click",()=>i?c():d()),{open:d,close:c,isOpen:()=>i,reflow:a}}var wt=(t,e)=>{if(t=t.toLowerCase(),t.includes(e))return!0;if(e.length<3)return!1;let n=e.length,r=t.length,i=new Array(r+1).fill(0);for(let o=1;o<=n;o++){let s=[o];for(let a=1;a<=r;a++)s[a]=Math.min(i[a]+1,s[a-1]+1,i[a-1]+(e[o-1]===t[a-1]?0:1));i=s}return Math.min(...i)<=(e.length<6?1:2)},z=typeof matchMedia=="function"?matchMedia("(prefers-reduced-motion: reduce)"):{matches:!1},G=(t,e)=>{z.matches||typeof t.animate!="function"||(t.style.transformOrigin=e>0?"left center":"right center",t.animate([{transform:"scaleX(1)"},{transform:"scaleX(1.18)"},{transform:"scaleX(1)"}],{duration:300,easing:"cubic-bezier(0.22, 1, 0.36, 1)"}))},W=(t,e,n)=>{let r=t.querySelector('[data-active="true"]');if(!r)return;let i=r.offsetLeft,o=r.offsetWidth,s=parseFloat(e.style.left);e.style.left=i+"px",e.style.width=o+"px",n&&Number.isFinite(s)&&s!==i&&G(e,i>s?1:-1)},q=(t,e)=>t.forEach(n=>{let r=n.dataset.value===String(e);n.dataset.active=String(r),n.setAttribute("aria-checked",String(r)),n.tabIndex=r?0:-1}),K=(t,e,n)=>{let r=A(t);return r.setAttribute("role","radio"),r.textContent=I(e),r.dataset.value=L(e),r._twVal=L(e),r.addEventListener("click",()=>n(r._twVal)),r},U=(t,e,n,r=0)=>{switch(t){case"ArrowRight":return(e+1)%n;case"ArrowLeft":return(e-1+n)%n;case"ArrowDown":return r<0?-1:r?e+r<n?e+r:e:(e+1)%n;case"ArrowUp":return r<0?-1:r?e-r>=0?e-r:e:(e-1+n)%n;case"Home":return 0;case"End":return n-1}return-1};function mt(t,e,n,r){let i=p("div","tw-seg");i.setAttribute("role","radiogroup"),r&&i.setAttribute("aria-label",r);let o=p("div","tw-seg-pill");i.append(o);let s=t.map(u=>{let l=K("tw-seg-btn",u,d=>m(d));return i.append(l),l}),a=u=>W(i,o,u),w=()=>{q(s,e),a(!0)},m=(u,l=!0)=>{e=u,w(),l&&n(u)};return i.addEventListener("keydown",u=>{let l=s.findIndex(c=>c.dataset.value===String(e));if(l<0)return;let d=U(u.key,l,s.length);d<0||(u.preventDefault(),m(s[d]._twVal),s[d].focus())}),w(),R(()=>{a(),i.classList.add("is-ready")}),T(i,[[window,"tw-reflow"]],()=>a()),{el:i,set:u=>m(u,!1),get:()=>e}}var pt=(t,e)=>{let n=p("div",t),r=A("tw-trigger");r.setAttribute("aria-expanded","false");let i=p("span","tw-trigger-right");return r.append(k("span","tw-trigger-label",e),i),n.append(r),{root:n,trigger:r,right:i}};function Y(){let t=null,e=0,n=0,r=0;return{show(i,o,s){t=p("div","tw-grab-guide tw-portal"),t.innerHTML='<span class="tw-grab-line"></span><span class="tw-grab-dot"></span><span class="tw-grab-arrow"></span><span class="tw-grab-bubble"></span>',e=o,n=i,r=s??i,t.children[1].style.cssText=`left:${i}px;top:${e}px`,document.body.appendChild(t)},move(i,o){t&&(t.children[0].style.cssText=`left:${Math.min(n,i)}px;top:${e}px;width:${Math.abs(i-n)}px`,t.children[2].style.cssText=`left:${i}px;top:${e}px;transform:translate(-50%,-50%) scaleX(${i>=n?1:-1})`,t.children[3].style.cssText=`left:${r}px;top:${e-16}px`,t.children[3].textContent=o)},hide(){t&&(t.remove(),t=null)}}}function Z(t,e,n,r,i,o){let s=0,a=0,w=null,m=1,u=Y();t.addEventListener("pointerdown",d=>{if(d.button!==0||w!==null)return;d.preventDefault(),w=d.pointerId,s=d.clientX,a=r(),m=1,t.classList.add("is-dragging");try{t.setPointerCapture(d.pointerId)}catch{}let c=e.getBoundingClientRect();u.show(d.clientX,c.top+c.height/2,c.left+c.width/2),u.move(d.clientX,o())}),t.addEventListener("pointermove",d=>{if(d.pointerId!==w)return;if(d.buttons===0){l(d);return}let c=d.shiftKey?10:d.altKey?.1:1;c!==m&&(m=c,s=d.clientX,a=r()),i(a+(d.clientX-s)*n*c),u.move(d.clientX,o())});let l=d=>{w===null||d.pointerId!==w||(w=null,t.classList.remove("is-dragging"),u.hide())};t.addEventListener("pointerup",l),t.addEventListener("pointercancel",l),t.addEventListener("lostpointercapture",l)}function ht(t,e){let n=Number.isFinite(+t.step)&&+t.step>0?+t.step:1,r=E(n),i=+t.min,o=+t.max;if(Number.isFinite(i)&&Number.isFinite(o)&&o<i){let c=i;i=o,o=c}let s=c=>{let f=F(c,Number.isFinite(i)?i:0,n);return t.soft||(Number.isFinite(i)&&(f=Math.max(i,f)),Number.isFinite(o)&&(f=Math.min(o,f))),f},a=s(Number.isFinite(+t.value)?+t.value:0),w=p("div",t.row?"tw-row":"tw-field"),m=p("div","tw-num-wrap"),u=p("span","tw-num-grab",J);u.setAttribute("aria-hidden","true"),u.title="Drag to adjust";let l=p("input","tw-num");l.type="text",l.inputMode="decimal",l.setAttribute("aria-label",t.label),l.value=a.toFixed(r),O(l),m.append(u,l),w.append(k("span",t.row?"tw-row-label":"tw-field-label",t.label),m);let d=(c,f=!0)=>{c=+c,Number.isFinite(c)&&(a=s(c),l.value=a.toFixed(r),f&&e&&e(a))};return l.addEventListener("change",()=>{let c=parseFloat(l.value);d(isNaN(c)?a:c)}),l.addEventListener("keydown",c=>{c.key==="Enter"&&l.blur()}),Z(u,m,n,()=>a,d,()=>l.value),{el:w,set:c=>d(c,!1),get:()=>a}}var J='<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" aria-hidden="true"><path d="M6 4v8M10 4v8"/></svg>',gt=t=>({el:t,set:()=>{},get:()=>{}}),S={},bt=(t,e)=>{S[t]=e},vt=t=>S[t];export{M as a,v as b,tt as c,E as d,F as e,et as f,nt as g,L as h,I as i,p as j,rt as k,A as l,k as m,it as n,st as o,N as p,R as q,T as r,ot as s,O as t,$ as u,at as v,ct as w,dt as x,H as y,lt as z,j as A,D as B,x as C,ut as D,ft as E,wt as F,z as G,W as H,q as I,K as J,U as K,mt as L,pt as M,ht as N,gt as O,bt as P,vt as Q};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{E as Ut,M as jt,N as qt,P as Jt,b as f,j as x,m as zt,t as Vt,v as mt,w as gt}from"./chunk-K6N3NNAW.js";var N0=180/Math.PI,xt=Math.PI/180,A=(t,e)=>[t[0][0]*e[0]+t[0][1]*e[1]+t[0][2]*e[2],t[1][0]*e[0]+t[1][1]*e[1]+t[1][2]*e[2],t[2][0]*e[0]+t[2][1]*e[1]+t[2][2]*e[2]],r0=(t,e)=>{let n=[[0,0,0],[0,0,0],[0,0,0]];for(let o=0;o<3;o++)for(let s=0;s<3;s++)n[o][s]=t[o][0]*e[0][s]+t[o][1]*e[1][s]+t[o][2]*e[2][s];return n},M=t=>t==null||Number.isNaN(t)?0:t,H0=(t,e,n)=>Math.min(n,Math.max(e,t)),ft=t=>{let e=Math.abs(t);return e<=.04045?t/12.92:Math.sign(t)*((e+.055)/1.055)**2.4},q=t=>{let e=Math.abs(t);return e<=.0031308?t*12.92:Math.sign(t)*(1.055*e**(1/2.4)-.055)},kt=1.09929682680944,c0=.018053968510807,B0=t=>{let e=Math.abs(t);return e<c0*4.5?t/4.5:Math.sign(t)*((e+kt-1)/kt)**(1/.45)},Ht=t=>{let e=Math.abs(t);return e<c0?t*4.5:Math.sign(t)*(kt*e**.45-(kt-1))},l0=1/512,D0=t=>{let e=Math.abs(t);return e<=l0*16?t/16:Math.sign(t)*e**1.8},I0=t=>{let e=Math.abs(t);return e>=l0?Math.sign(t)*e**(1/1.8):16*t},Ot=[[.41239079926595934,.357584339383878,.1804807884018343],[.21263900587151027,.715168678767756,.07219231536073371],[.01933081871559182,.11919477979462598,.9505321522496607]],ot=[[3.2409699419045226,-1.537383177570094,-.4986107602930034],[-.9692436362808796,1.8759675015077202,.04155505740717559],[.05563007969699366,-.20397695888897652,1.0569715142428786]],F0=[[.4865709486482162,.26566769316909306,.19821728523436247],[.2289745640697488,.6917385218365064,.079286914093745],[0,.04511338185890264,1.043944368900976]],Bt=[[2.493496911941425,-.9313836179191239,-.40271078445071684],[-.8294889695615747,1.7626640603183463,.023624685841943577],[.03584583024378447,-.07617238926804182,.9568845240076872]],G0=[[.6369580483012914,.14461690358620832,.16888097516417205],[.2627002120112671,.6779980715188708,.05930171646986196],[0,.028072693049087428,1.060985057710791]],Dt=[[1.7166511879712674,-.35567078377639233,-.25336628137365974],[-.6666843518324892,1.6164812366349395,.01576854581391113],[.017639857445310783,-.042770613257808524,.9421031212354738]],P0=[[.7977604896723027,.13518583717574031,.0313493495815248],[.2880711282292934,.7118432178101014,8565396060525902e-20],[0,0,.8251046025104601]],X0=[[1.3457989731028281,-.25558010007997534,-.05110628506753401],[-.5446224939028347,1.5082327413132781,.02053603239147973],[0,0,1.2119675456389454]],i0=[[1.0479298208405488,.022946793341019088,-.05019222954313557],[.029627815688159344,.990434484573249,-.01707382502938514],[-.009243058152591178,.015055144896577895,.7518742899580008]],h0=[[.9554734527042182,-.023098536874261423,.0632593086610217],[-.028369706963208136,1.0099954580058226,.021041398966943008],[.012314001688319899,-.020507696433477912,1.3303659366080753]],Y0=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],It=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],Z0=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],y=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],dt=216/24389,st=24389/27,J=[.3457/.3585,1,(1-.3457-.3585)/.3585],U=(t,e,n)=>A(n,[e(t[0]),e(t[1]),e(t[2])]),j=(t,e,n)=>{let o=A(n,t);return[e(o[0]),e(o[1]),e(o[2])]},Qt=t=>{let e=A(y,t);return A(It,[e[0]**3,e[1]**3,e[2]**3])},t0=t=>{let e=A(Y0,t);return A(Z0,[Math.cbrt(e[0]),Math.cbrt(e[1]),Math.cbrt(e[2])])};function e0(t){let[e,n,o]=t,s=(e+16)/116,a=n/500+s,r=s-o/200,u=a**3>dt?a**3:(116*a-16)/st,i=e>st*dt?s**3:e/st,p=r**3>dt?r**3:(116*r-16)/st;return A(h0,[u*J[0],i*J[1],p*J[2]])}function n0(t){let e=A(i0,t),n=r=>r>dt?Math.cbrt(r):(st*r+16)/116,o=n(e[0]/J[0]),s=n(e[1]/J[1]),a=n(e[2]/J[2]);return[116*s-16,500*(o-s),200*(s-a)]}var wt=t=>{let e=Math.hypot(t[1],t[2]),n=Math.atan2(t[2],t[1])*N0;return n<0&&(n+=360),[t[0],e,n]},Mt=t=>[t[0],t[1]*Math.cos(t[2]*xt),t[1]*Math.sin(t[2]*xt)];function u0(t){let e=((Number.isNaN(t[0])?0:t[0])%360+360)%360,n=t[1]/100,o=t[2]/100,s=a=>{let r=(a+e/30)%12,u=n*Math.min(o,1-o);return o-u*Math.max(-1,Math.min(r-3,9-r,1))};return[s(0),s(8),s(4)]}function p0(t){let e=Math.max(...t),n=Math.min(...t),o=e-n;if(o===0)return NaN;let s;return e===t[0]?s=(t[1]-t[2])/o+(t[1]<t[2]?6:0):e===t[1]?s=(t[2]-t[0])/o+2:s=(t[0]-t[1])/o+4,s*60}function W0(t){let e=Math.max(...t),n=Math.min(...t),o=(n+e)/2,s=p0(t),a=e===n||o===0||o===1?0:(e-o)/Math.min(o,1-o);return a<0&&(s+=180,a=-a),s>=360&&(s-=360),[s,a*100,o*100]}function K0(t){let e=t[1]/100,n=t[2]/100;if(e+n>=1){let a=e/(e+n);return[a,a,a]}let o=u0([t[0],100,50]),s=1-e-n;return[o[0]*s+e,o[1]*s+e,o[2]*s+e]}var z0=t=>[p0(t),Math.min(...t)*100,(1-Math.max(...t))*100];function V0(t,e){switch(e){case"srgb":return U(t,ft,Ot);case"p3":return U(t,ft,F0);case"rec2020":return U(t,B0,G0);case"prophoto-rgb":return A(h0,U(t,D0,P0));case"oklab":return Qt(t);case"oklch":return Qt(Mt(t));case"lab":return e0(t);case"lch":return e0(Mt(t));case"hsl":return U(u0(t),ft,Ot);case"hwb":return U(K0(t),ft,Ot)}}function U0(t,e){switch(e){case"srgb":return j(t,q,ot);case"p3":return j(t,q,Bt);case"rec2020":return j(t,Ht,Dt);case"prophoto-rgb":return j(A(i0,t),I0,X0);case"oklab":return t0(t);case"oklch":return wt(t0(t));case"lab":return n0(t);case"lch":return wt(n0(t));case"hsl":return W0(j(t,q,ot));case"hwb":return z0(j(t,q,ot))}}function w(t,e,n){return e===n?[t[0],t[1],t[2]]:e==="oklch"&&n==="oklab"?Mt(t):e==="oklab"&&n==="oklch"?wt(t):e==="lch"&&n==="lab"?Mt(t):e==="lab"&&n==="lch"?wt(t):U0(V0(t,e),n)}var Q=75e-6;function Nt(t,e){return w(t,"oklch",e).every(o=>o>=-Q&&o<=1+Q)}var s0=t=>t.map(e=>Math.min(1,Math.max(0,e))),o0=(t,e)=>Math.hypot(t[0]-e[0],t[1]-e[1],t[2]-e[2]);function $t(t,e){if(Nt(t,e))return w(t,"oklch",e);let n=t[0];if(n>=1)return[1,1,1];if(n<=0)return[0,0,0];let o=.02,s=1e-4,a=[t[0],t[1],t[2]],r=0,u=t[1],i=!0,p=s0(w(a,"oklch",e));if(o0(w(p,e,"oklab"),w(t,"oklch","oklab"))<o)return p;for(;u-r>s;){let h=(r+u)/2;a[1]=h;let g=w(a,"oklch",e);if(i&&g.every(_=>_>=-Q&&_<=1+Q)){r=h;continue}p=s0(g);let b=o0(w(p,e,"oklab"),w(a,"oklch","oklab"));if(b<o){if(o-b<s)return p;i=!1,r=h}else u=h}return p}function at(t,e){let n=t*xt,o=Math.cos(n),s=Math.sin(n),a=o*y[0][1]+s*y[0][2],r=o*y[1][1]+s*y[1][2],u=o*y[2][1]+s*y[2][2],i=r0(e==="p3"?Bt:e==="rec2020"?Dt:ot,It),p=e==="rec2020"?Ht:q,h=-Q,g=1+Q;return(b,_)=>{let T=b+_*a,E=b+_*r,k=b+_*u,$=T**3,v=E**3,H=k**3,C=p(i[0][0]*$+i[0][1]*v+i[0][2]*H);if(C<h||C>g)return!1;let tt=p(i[1][0]*$+i[1][1]*v+i[1][2]*H);if(tt<h||tt>g)return!1;let Z=p(i[2][0]*$+i[2][1]*v+i[2][2]*H);return Z>=h&&Z<=g}}function b0(t,e){let n=t*xt,o=Math.cos(n),s=Math.sin(n),a=o*y[0][1]+s*y[0][2],r=o*y[1][1]+s*y[1][2],u=o*y[2][1]+s*y[2][2],i=r0(e==="p3"?Bt:e==="rec2020"?Dt:ot,It),p=e==="rec2020"?Ht:q;return(h,g,b)=>{let _=h+g*a,T=h+g*r,E=h+g*u,k=_**3,$=T**3,v=E**3;b[0]=p(i[0][0]*k+i[0][1]*$+i[0][2]*v),b[1]=p(i[1][0]*k+i[1][1]*$+i[1][2]*v),b[2]=p(i[2][0]*k+i[2][1]*$+i[2][2]*v)}}function rt(t,e,n=.5){if(!t(e,0))return 0;let o=0;for(let s=0;s<16;s++){let a=(o+n)/2;t(e,a)?o=a:n=a}return o}var X=t=>Math.round(Math.min(1,Math.max(0,t))*255).toString(16).padStart(2,"0"),j0=t=>`#${X(t[0])}${X(t[1])}${X(t[2])}`,_t=(t,e,n)=>j0($t([t,e,n],"srgb"));function m0(t){let e=String(t).replace("#","").trim();if(e.length===3&&(e=e.split("").map(o=>o+o).join("")),e.length<6)return[.7,.1,280];let n=[parseInt(e.slice(0,2),16)/255,parseInt(e.slice(2,4),16)/255,parseInt(e.slice(4,6),16)/255];return w(n,"srgb","oklch").map(M)}var vt=["hex","srgb","css","hsl","hwb","oklch","oklab","lch","lab","p3","rec2020"],g0={hex:"HEX",srgb:"RGB",css:"CSS",hsl:"HSL",hwb:"HWB",oklch:"OKLCH",oklab:"OKLab",lch:"LCH",lab:"Lab",p3:"P3",rec2020:"Rec2020"},f0=["srgb","css","hsl","hwb","hex"],Ft=t=>!f0.includes(t),d0=t=>t==="hex"||t==="css"?"srgb":t,q0={hex:"srgb",srgb:"srgb",css:"srgb",hsl:"hsl",hwb:"hwb",oklch:"oklch",oklab:"oklab",lch:"lch",lab:"lab",p3:"display-p3",rec2020:"rec2020"},he=t=>q0[t]||"oklch",J0={srgb:"srgb",hsl:"hsl",hwb:"hwb",oklch:"oklch",oklab:"oklab",lch:"lch",lab:"lab","display-p3":"p3",rec2020:"rec2020"},ue=t=>J0[t]||"oklch",Q0=.5,ct={oklch:[{k:"L",min:0,max:100,step:1,scale:100},{k:"C",min:0,max:Q0,step:.01,scale:1},{k:"H",min:0,max:360,step:1,scale:1}],oklab:[{k:"L",min:0,max:100,step:1,scale:100},{k:"a",min:-.4,max:.4,step:.01,scale:1},{k:"b",min:-.4,max:.4,step:.01,scale:1}],lch:[{k:"L",min:0,max:100,step:1,scale:1},{k:"C",min:0,max:150,step:1,scale:1},{k:"H",min:0,max:360,step:1,scale:1}],lab:[{k:"L",min:0,max:100,step:1,scale:1},{k:"a",min:-125,max:125,step:1,scale:1},{k:"b",min:-125,max:125,step:1,scale:1}],srgb:[{k:"R",min:0,max:255,step:1,scale:255},{k:"G",min:0,max:255,step:1,scale:255},{k:"B",min:0,max:255,step:1,scale:255}],css:[{k:"R",min:0,max:255,step:1,scale:255},{k:"G",min:0,max:255,step:1,scale:255},{k:"B",min:0,max:255,step:1,scale:255}],hsl:[{k:"H",min:0,max:360,step:1,scale:1},{k:"S",min:0,max:100,step:1,scale:1},{k:"L",min:0,max:100,step:1,scale:1}],hwb:[{k:"H",min:0,max:360,step:1,scale:1},{k:"W",min:0,max:100,step:1,scale:1},{k:"B",min:0,max:100,step:1,scale:1}],p3:[{k:"R",min:0,max:1,step:.01,scale:1},{k:"G",min:0,max:1,step:.01,scale:1},{k:"B",min:0,max:1,step:.01,scale:1}],rec2020:[{k:"R",min:0,max:1,step:.01,scale:1},{k:"G",min:0,max:1,step:.01,scale:1},{k:"B",min:0,max:1,step:.01,scale:1}]},te=t=>t>=1?0:t>=.1?1:t>=.01?2:3,x0=(t,e,n)=>e==="oklch"?[t[0],t[1],t[2]]:f0.includes(n)?e==="srgb"?$t(t,"srgb"):w($t(t,"srgb"),"srgb",e):w(t,"oklch",e);function Ct(t,e){let n=x0(t,d0(e),e);return ct[e].map((o,s)=>{let a=M(n[s])*o.scale;return H0(Math.abs(a)<.5*o.step?0:a,o.min,o.max)})}function k0(t,e,n,o){let s=d0(e),a=x0(t,s,e).map(M);a[n]=o/ct[e][n].scale;let r=w(a,s,"oklch");return[M(r[0]),M(r[1]),M(r[2])]}function w0(t,e){if(!Ft(e))return"sRGB";let n=$t(t,"srgb");return Math.max(...n)<.03||Math.min(...n)>.97||Nt(t,"srgb")?"sRGB":Nt(t,"p3")?"P3":"wide"}function Gt(t,e){if(e==="hex")return _t(t[0],t[1],t[2]);let n=ct[e],o=Ct(t,e),s=a=>o[a].toFixed(te(n[a].step));return e==="css"?`${s(0)}, ${s(1)}, ${s(2)}`:e==="oklch"||e==="oklab"||e==="lch"||e==="lab"?`${s(0)}% ${s(1)} ${s(2)}`:e==="hsl"||e==="hwb"?`${s(0)} ${s(1)}% ${s(2)}%`:`${s(0)} ${s(1)} ${s(2)}`}var a0=(t,e)=>e==="hex"?t:e==="srgb"?`rgb(${t})`:e==="css"?`rgba(${t}, 1)`:e==="hsl"?`hsl(${t})`:e==="hwb"?`hwb(${t})`:e==="p3"?`color(display-p3 ${t})`:e==="rec2020"?`color(rec2020 ${t})`:`${e}(${t})`;function M0(t,e,n){let o=M(n);if(e==="hex")return _t(t[0],t[1],t[2])+(o<.999?X(o):"");let s=Gt(t,e);if(o>=.999)return a0(s,e);let a=+o.toFixed(3);return e==="css"?`rgba(${s}, ${a})`:a0(`${s} / ${a}`,e)}var _0=(()=>{try{return document.createElement("canvas").getContext("2d",{colorSpace:"display-p3"})?.getContextAttributes?.().colorSpace==="display-p3"}catch{return!1}})(),Pt=_0?{colorSpace:"display-p3"}:{},ee=_0?"p3":"srgb",Et=(t,e)=>{let n=t.length-1,o=Math.max(0,Math.min(n,e*n)),s=Math.floor(o),a=o-s;return t[s]*(1-a)+t[Math.min(s+1,n)]*a},ne=(t,e)=>{let n=at(t,e),o=new Float64Array(128);for(let s=0;s<128;s++)o[s]=rt(n,s/127);return o},se="repeating-conic-gradient(#6b6b6b 0% 25%, #9a9a9a 0% 50%) 0 0 / 8px 8px",oe={srgb:"srgb","display-p3":"p3",rec2020:"rec2020","prophoto-rgb":"prophoto-rgb"},$0=t=>{let e=/^([+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?)(deg|grad|rad|turn)$/i.exec(t);if(!e)return M(parseFloat(t));let n=parseFloat(e[1]);return e[2].toLowerCase()==="turn"?n*360:e[2].toLowerCase()==="grad"?n*.9:e[2].toLowerCase()==="rad"?n*180/Math.PI:n};function Y(t){if(t=String(t??"").trim(),/^#?([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)){let u=t.replace("#",""),i=1;u.length===4?(i=parseInt(u[3]+u[3],16)/255,u=u.slice(0,3)):u.length===8&&(i=parseInt(u.slice(6,8),16)/255,u=u.slice(0,6));let[p,h,g]=m0("#"+u);return[p,h,g,i]}let e=t.match(/^(oklch|oklab|lch|lab|color)\(\s*([^)]*?)\s*\)$/i);if(e){let u=e[1].toLowerCase(),[i,p]=e[2].split("/").map(k=>k.trim()),h=i.split(/\s+/).filter(Boolean),g=u;if(u==="color"&&(g=oe[(h[0]||"").toLowerCase()],h=h.slice(1),!g))return[.7,.1,280,1];let b=(k,$=1)=>!k||k==="none"?0:M(parseFloat(k))*(/%$/.test(k)?$:1),_=p?f(b(p,.01),0,1):1,T=u==="lab"?[f(b(h[0]),0,100),b(h[1],1.25),b(h[2],1.25)]:u==="lch"?[f(b(h[0]),0,100),Math.max(0,b(h[1],1.5)),$0(h[2]||"0")]:u==="color"?[b(h[0],.01),b(h[1],.01),b(h[2],.01)]:u==="oklab"?[f(b(h[0],.01),0,1),b(h[1],.004),b(h[2],.004)]:[f(b(h[0],.01),0,1),Math.max(0,b(h[1],.004)),$0(h[2]||"0")],E=g==="oklch"?T:w(T,g,"oklch");return[M(E[0]),M(E[1]),(M(E[2])%360+360)%360,_]}let n=Y._c2d||(Y._c2d=document.createElement("canvas").getContext("2d"));n.fillStyle="#000",n.fillStyle=t;let o=n.fillStyle;if(o[0]==="#")return Y(o);let s=o.match(/^rgba?\(([^)]*)\)/i),a=((s?s[1]:"").match(/-?[\d.]+(?:e[+-]?\d+)?/gi)||[0,0,0]).map(Number),r=w([a[0]/255,a[1]/255,a[2]/255],"srgb","oklch");return[M(r[0]),M(r[1]),M(r[2]),a[3]!=null?f(M(a[3]),0,1):1]}function ae(t,e){let[n,o,s,a]=Y(t.value||"#7c5cff"),r=vt.includes(t.mode)?t.mode:"oklch",u=NaN,i=null,p=[],h=NaN,g="",b=()=>M0([n,o,s],r,a),_=x("div","tw-color-body"),T=x("div","tw-wg-area"),E=document.createElement("canvas");E.className="tw-wg-canvas";let k=x("div","tw-wg-thumb");T.append(E,k);let $=x("div","tw-wg-hue"),v=document.createElement("canvas");v.className="tw-wg-hue-canvas";let H=x("div","tw-wg-hue-thumb");$.append(v,H);let C=x("div","tw-wg-alpha"),tt=x("div","tw-wg-alpha-grad"),Z=x("div","tw-wg-hue-thumb");C.append(tt,Z),C.tabIndex=0,C.setAttribute("role","slider"),C.setAttribute("aria-label","Alpha"),C.setAttribute("aria-valuemin","0"),C.setAttribute("aria-valuemax","1");let Xt=x("div","tw-color-mode-row"),B=x("select","tw-color-mode");B.setAttribute("aria-label","Color mode"),vt.forEach(c=>{let l=document.createElement("option");l.value=c,l.textContent=g0[c],B.append(l)}),B.value=r;let Yt=x("span","tw-color-gamut");Xt.append(B,Yt);let D=x("div","tw-color-channels");_.append(T,$,C,Xt,D);let L=E.getContext("2d",Pt),Zt=v.getContext("2d"),W=document.createElement("canvas"),v0=W.getContext("2d",Pt),Lt=null,lt=()=>{let c=T.getBoundingClientRect(),l=Math.round(c.width),m=Math.round(c.height);if(l<2)return;let d=window.devicePixelRatio||1,S=Ft(r)?"p3":"srgb",O=ne(s,S);i=O;let N=Math.round(l*d),ht=Math.round(m*d),F=Math.max(1,Math.round(N/4)),z=Math.max(1,Math.round(ht/4));(W.width!==F||W.height!==z)&&(W.width=F,W.height=z,Lt=new ImageData(F,z,Pt));let ut=Lt.data,S0=z>1?1/(z-1):0,R0=F>1?1/(F-1):0,A0=b0(s,ee),pt=[0,0,0];for(let G=0;G<z;G++){let bt=1-G*S0,St=Et(O,bt);for(let P=0;P<F;P++){A0(bt,P*R0*St,pt);let V=(G*F+P)*4;ut[V]=Math.round(f(pt[0],0,1)*255),ut[V+1]=Math.round(f(pt[1],0,1)*255),ut[V+2]=Math.round(f(pt[2],0,1)*255),ut[V+3]=255}}if(v0.putImageData(Lt,0,0),E.width=N,E.height=ht,L.imageSmoothingEnabled=!0,L.drawImage(W,0,0,N,ht),S!=="srgb"){let G=(bt,St,P,V)=>{let O0=at(s,bt),Rt=[];for(let R=0;R<=100;R++){let nt=R/100,At=Et(O,nt);if(At<=0)continue;let Kt=rt(O0,nt,At);Kt<=0||Rt.push([Math.min(Kt/At*N,N-P*d/2),(1-nt)*ht])}Rt.length<2||(L.save(),L.strokeStyle=St,L.lineWidth=P*d,L.lineJoin=L.lineCap="round",L.setLineDash(V.map(R=>R*d)),L.beginPath(),Rt.forEach((R,nt)=>nt?L.lineTo(R[0],R[1]):L.moveTo(R[0],R[1])),L.stroke(),L.restore())};G("srgb","rgba(255,255,255,0.7)",1.5,[]),G("p3","rgba(255,255,255,0.4)",1,[3,3])}u=s},yt=.7,Wt=0,C0=()=>{let c=$.getBoundingClientRect(),l=Math.max(1,Math.round(c.width)),m=Math.max(1,Math.round(c.height));if(l<2||l===Wt&&v.width===l)return;Wt=l,v.width=l,v.height=m;let d=yt;for(let S=0;S<l;S++){let O=S/(l-1)*360,N=w([d,rt(at(O,"srgb"),d),O],"oklch","srgb");Zt.fillStyle=`rgb(${f(N[0]*255,0,255)|0},${f(N[1]*255,0,255)|0},${f(N[2]*255,0,255)|0})`,Zt.fillRect(S,0,1,m)}},I=()=>{let c=i?Et(i,n):.4,l=d=>`${f(d,0,1)*100}%`,m=(d,S)=>{let O=f(d,0,1);return`calc(${O*100}% + ${(.5-O)*S}px)`};if(k.style.left=l(c>0?o/c:0),k.style.top=l(1-n),H.style.left=m(s/360,16),Z.style.left=m(a,16),C.setAttribute("aria-valuenow",String(+a.toFixed(2))),tt.style.background=`linear-gradient(to right, oklch(${n} ${o} ${s} / 0), oklch(${n} ${o} ${s}))`,k.style.background=`oklch(${n} ${o} ${s})`,Z.style.background=`linear-gradient(oklch(${n} ${o} ${s} / ${a}), oklch(${n} ${o} ${s} / ${a})), var(--tw-dropdown-bg)`,s!==h){let d=w([yt,rt(at(s,"srgb"),yt),s],"oklch","srgb");g=`rgb(${f(d[0]*255,0,255)|0} ${f(d[1]*255,0,255)|0} ${f(d[2]*255,0,255)|0})`,h=s}H.style.background=g},et=()=>{if(Yt.textContent=w0([n,o,s],r),r==="hex"){let c=D.querySelector(".tw-color-chan-input");c&&document.activeElement!==c&&(c.value=_t(n,o,s)+(a<.999?X(a):""))}else{let c=Ct([n,o,s],r);p.forEach((l,m)=>{l.el.contains(document.activeElement)||l.set(c[m])})}},E0=()=>{C0(),lt(),I()},K=()=>e(b()),it=c=>{c&&s!==u&<(),I(),et()},Tt=()=>{if(D.replaceChildren(),p=[],r==="hex"){D.classList.add("tw-color-channels--hex");let c=x("div","tw-color-chan"),l=x("input","tw-color-chan-input");l.type="text",l.spellcheck=!1,l.setAttribute("aria-label","Hex color"),Vt(l),l.addEventListener("change",()=>{let m=l.value.trim();/^#?([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(m)&&([n,o,s,a]=Y(m),it(!0),K())}),l.addEventListener("keydown",m=>{m.key==="Enter"&&l.blur()}),c.append(zt("span","tw-color-chan-label","HEX"),l),D.append(c)}else{D.classList.remove("tw-color-channels--hex");let c=Ct([n,o,s],r);ct[r].forEach((l,m)=>{let d=qt({label:l.k,value:c[m],min:l.min,max:l.max,step:l.step},S=>{[n,o,s]=k0([n,o,s],r,m,f(S,l.min,l.max)),it(!0),K()});p.push(d),D.append(d.el)})}et()},L0=c=>gt(c,T);mt(T,c=>{let[l,m]=L0(c);n=1-m,o=l*(i?Et(i,n):.4),I(),et(),K()});let y0=c=>gt(c,$)[0]*360;mt($,c=>{s=y0(c),it(!0),K()});let T0=c=>gt(c,C)[0];return mt(C,c=>{a=T0(c),I(),et(),K()}),C.addEventListener("keydown",c=>{let l=c.shiftKey?.1:.01,m=a;switch(c.key){case"ArrowRight":case"ArrowUp":m+=l;break;case"ArrowLeft":case"ArrowDown":m-=l;break;case"Home":m=0;break;case"End":m=1;break;default:return}c.preventDefault(),a=f(m,0,1),I(),et(),K()}),B.addEventListener("change",()=>{r=B.value,Tt(),lt(),I(),t.onMode&&t.onMode()}),Tt(),{el:_,set:c=>{let l=document.activeElement;l&&_.contains(l)&&l.blur(),[n,o,s,a]=Y(c),it(!0)},get:()=>b(),mode:()=>r,setMode:c=>{c===r||!vt.includes(c)||(r=c,B.value=c,Tt(),lt(),I())},reflow:E0,swatchCss:()=>`linear-gradient(oklch(${n} ${o} ${s} / ${a}), oklch(${n} ${o} ${s} / ${a})), ${se}`,valueText:()=>Gt([n,o,s],r)+(a<.999?r==="hex"?X(a):` / ${+a.toFixed(2)}`:"")}}function re(t,e){let{root:n,trigger:o,right:s}=jt("tw-color",t.label||"Colour"),a=x("span","tw-trigger-chip tw-color-swatch"),r=x("span","tw-trigger-value");s.append(a,r);let u=x("div","tw-color-pop"),i=()=>{a.style.background=p.swatchCss(),r.textContent=p.valueText()},p=ae({value:t.value,onMode:()=>i()},h=>{i(),e(h)});return u.append(p.el),n.append(u),Ut(n,o,u,{width:240,fallbackH:340,gap:6,onOpen:p.reflow,onReflow:p.reflow}),i(),{el:n,set:h=>{p.set(h),i()},get:()=>p.get()}}var ge=(t,e,n,o)=>o<.999?`oklch(${+t.toFixed(4)} ${+e.toFixed(4)} ${+n.toFixed(2)} / ${+o.toFixed(3)})`:`oklch(${+t.toFixed(4)} ${+e.toFixed(4)} ${+n.toFixed(2)})`;Jt("color",re);export{he as a,ue as b,se as c,Y as d,ae as e,ge as f};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as a,d as b,e as c,f as d}from"./chunk-NMISCM24.js";import"./chunk-K6N3NNAW.js";export{a as CHECKER,c as createPickerBody,d as oklchStr,b as parseColor};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as Y,b as P,c as z,d as L,e as U,f as V}from"./chunk-NMISCM24.js";import{E as j,M as K,P as N,b as p,j as g,l as D,u as X}from"./chunk-K6N3NNAW.js";var st='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg>',q=a=>a&&!Array.isArray(a)&&typeof a.interpolation=="string"?a.interpolation:null;function J(a){let C=[{color:"oklch(0.72 0.19 25)",pos:0},{color:"oklch(0.72 0.16 280)",pos:1}],s=((Array.isArray(a)?a:a&&Array.isArray(a.stops)?a.stops:null)||[]).map(c=>Array.isArray(c)?{color:String(c[0]),pos:p(+c[1]||0,0,1)}:c&&typeof c=="object"?{color:String(c.color),pos:p(+c.pos||0,0,1)}:null).filter(Boolean);return s.length>=2?s:C}function lt(a,C){let l=J(a.value),s=l[0],{root:c,trigger:Q,right:T}=K("tw-gradient",a.label||"Gradient"),R=g("span","tw-gradient-count"),F=g("span","tw-trigger-chip tw-gradient-preview");T.append(R,F);let k=g("div","tw-color-pop tw-gradient-pop"),H=g("div","tw-gradient-bar-row"),E=g("div","tw-gradient-bar"),I=g("div","tw-gradient-grad"),h=g("div","tw-gradient-rail");E.append(I,h);let m=D("tw-gradient-add",st);m.title="Add a stop after the selected one",m.setAttribute("aria-label","Add a colour stop after the selected one"),H.append(E,m);let v=()=>[...l].sort((t,o)=>t.pos-o.pos),W=()=>v().map(t=>`${t.color} ${(t.pos*100).toFixed(1)}%`).join(", "),O=()=>Y(u.mode()),Z=()=>`linear-gradient(in ${O()} to right, ${W()})`,d=()=>{let t=Z();I.style.background=t,F.style.background=`${t}, ${z}`},A=()=>{R.textContent=`${l.length} stop${l.length===1?"":"s"}`},_=()=>({stops:v().map(t=>({color:t.color,pos:+t.pos.toFixed(4)})),interpolation:O()}),w=()=>C(_()),x=t=>[...h.children].find(o=>o._stop===t),u=U({value:s.color,mode:P(q(a.value)||"oklab"),onMode:()=>{d(),w()}},t=>{s.color=t,x(s)?.style.setProperty("--stop",t),d(),w()});k.append(H,u.el),c.append(k);let tt=()=>{for(let t of h.children)t.dataset.sel=String(t._stop===s)},M=()=>{h.replaceChildren();for(let t of l){let o=D("tw-gradient-stop");o._stop=t,o.style.left=t.pos*100+"%",o.style.setProperty("--stop",t.color),o.dataset.sel=String(t===s),o.setAttribute("aria-label","Colour stop");let n=!1;X(o,{onDown:e=>{e.preventDefault(),e.stopPropagation(),o.focus({focusVisible:!1}),$(t,!1),n=!1},onMove:e=>{let r=h.getBoundingClientRect();t.pos=p((e.clientX-r.left)/(r.width||1),0,1),o.style.left=t.pos*100+"%",d(),w(),n=l.length>2&&(e.clientY<r.top-24||e.clientY>r.bottom+24),o.dataset.removing=String(n)},onEnd:()=>{n?B(t):o.dataset.removing="false"}}),o.addEventListener("dblclick",e=>{e.preventDefault(),B(t)}),o.addEventListener("keydown",e=>{let r=e.key==="ArrowLeft"?-1:e.key==="ArrowRight"?1:0;r&&(e.preventDefault(),t.pos=p(t.pos+r*(e.shiftKey?.1:.01),0,1),o.style.left=t.pos*100+"%",d(),w())}),h.append(o)}},$=(t,o)=>{t!==s&&(u.set(t.color),s=t),o?M():tt()},ot=t=>{let o=h.getBoundingClientRect();return p((t-o.left)/(o.width||1),0,1)},et=t=>{let o=v(),n=o[0],e=o[o.length-1];for(let f=0;f<o.length-1;f++)if(t>=o[f].pos&&t<=o[f+1].pos){n=o[f],e=o[f+1];break}let r=e.pos>n.pos?p((t-n.pos)/(e.pos-n.pos),0,1):0,i=L(n.color),y=L(e.color),S=f=>f[1]<1e-4,b=y[2]-i[2];b>180?b-=360:b<-180&&(b+=360),(S(i)||S(y))&&(b=0);let nt=(((S(i)&&!S(y)?y[2]:i[2])+b*r)%360+360)%360;return V(i[0]+(y[0]-i[0])*r,i[1]+(y[1]-i[1])*r,nt,i[3]+(y[3]-i[3])*r)},B=t=>{if(l.length<=2)return;let o=l.indexOf(t);if(o<0)return;l.splice(o,1);let n=s===t?l[Math.max(0,o-1)]:s;d(),$(n,!0),A(),w(),x(s)?.focus()},G=t=>{let o={color:et(t),pos:p(t,0,1)};return l.push(o),d(),$(o,!0),A(),w(),o},rt=()=>{let t=v(),o=t.indexOf(s);o<0&&(o=0);let n=o<t.length-1?(t[o].pos+t[o+1].pos)/2:o>0?(t[o-1].pos+t[o].pos)/2:p(t[o].pos+.1,0,1);G(n)};return m.addEventListener("click",t=>{t.stopPropagation(),rt()}),E.addEventListener("dblclick",t=>{t.target.closest(".tw-gradient-stop")||(t.preventDefault(),G(ot(t.clientX)))}),k.tabIndex=-1,k.addEventListener("keydown",t=>{(t.key==="Delete"||t.key==="Backspace")&&!/^(input|textarea|select)$/i.test(t.target.tagName)&&l.length>2&&(t.preventDefault(),B(s))}),j(c,Q,k,{width:260,fallbackH:392,gap:6,onOpen:()=>u.reflow(),onReflow:()=>u.reflow()}),M(),d(),A(),{el:c,set:t=>{let o=q(t);o&&u.setMode(P(o));let n=J(t).sort((e,r)=>e.pos-r.pos);if(n.length===l.length)v().forEach((e,r)=>{e.color=n[r].color,e.pos=n[r].pos;let i=x(e);i&&(i.style.left=e.pos*100+"%",i.style.setProperty("--stop",e.color))});else{let e=s.pos;l=n,s=l.reduce((r,i)=>Math.abs(i.pos-e)<Math.abs(r.pos-e)?i:r,l[0]),M()}d(),A(),u.set(s.color)},get:()=>_()}}N("gradient",lt);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{M as p,P as u,j as n}from"./chunk-K6N3NNAW.js";function m(i,f){let a=i.value||"",{root:d,trigger:t,right:v}=p("tw-image",i.label);t.removeAttribute("aria-expanded"),t.setAttribute("aria-label",`${i.label}: choose an image`);let g=n("span","tw-image-text"),s=n("span","tw-trigger-chip tw-image-thumb");v.append(g,s);let r=n("input","tw-image-input");r.type="file",r.accept="image/*",d.append(r);let o=()=>{s.dataset.set=a?"true":"false",s.style.backgroundImage=a?`url("${a}")`:"",g.textContent=a?"Replace":"Drop or choose"},c=e=>{if(!e||!e.type.startsWith("image/"))return;let l=new FileReader;l.onload=()=>{a=String(l.result),o(),f(a)},l.readAsDataURL(e)};return t.addEventListener("click",()=>r.click()),r.addEventListener("change",()=>{r.files[0]&&c(r.files[0])}),t.addEventListener("dragover",e=>{e.preventDefault(),t.dataset.over="true"}),t.addEventListener("dragleave",()=>{t.dataset.over="false"}),t.addEventListener("drop",e=>{e.preventDefault(),t.dataset.over="false",e.dataTransfer.files[0]&&c(e.dataTransfer.files[0])}),o(),{el:d,set:e=>{a=e||"",o()},get:()=>a}}u("image",m);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{P as G,b as c,d as z,e as B,f as O,j as m,m as T,q as U,r as V,s as j}from"./chunk-K6N3NNAW.js";function tt(d,J){let M=d.label,i=+d.min,n=+d.max,f=+d.step,x=+(d.value&&d.value[0]),L=+(d.value&&d.value[1]);if(Number.isFinite(i)||(i=Number.isFinite(x)?x:0),Number.isFinite(n)||(n=Number.isFinite(L)?L:1),n<i){let t=i;i=n,n=t}(!(f>0)||f>n-i)&&(f=O(i,n));let I=z(f),w=t=>B(t,i,f),s=c(w(Number.isFinite(x)?x:i),i,n),r=c(w(Number.isFinite(L)?L:n),i,n);if(s>r){let t=s;s=r,r=t}let g=m("div","tw-slider-wrap"),l=m("div","tw-slider tw-interval"),k=m("div","tw-slider-fill"),p=m("div","tw-slider-handle"),v=m("div","tw-slider-handle"),N=T("span","tw-slider-label",M),y=m("span","tw-slider-value");l.append(k,p,v,N,y),g.append(l),[["minimum",p],["maximum",v]].forEach(([t,e])=>{e.tabIndex=0,e.setAttribute("role","slider"),e.setAttribute("aria-label",`${M} ${t}`),e.setAttribute("aria-valuemin",String(i)),e.setAttribute("aria-valuemax",String(n))});let A=t=>(t-i)/(n-i||1)*100,b=()=>{let t=A(s),e=A(r);k.style.left=t+"%",k.style.width=Math.max(0,e-t)+"%",p.style.left=`clamp(5px, calc(${t}% - 1.5px), calc(100% - 9px))`,v.style.left=`clamp(5px, calc(${e}% - 1.5px), calc(100% - 9px))`,y.textContent=`${s.toFixed(I)} \u2013 ${r.toFixed(I)}`,p.setAttribute("aria-valuenow",String(s)),v.setAttribute("aria-valuenow",String(r));let a=g.offsetWidth;if(a){let o=N.offsetLeft,Y=o+N.offsetWidth,D=y.offsetLeft,Z=D+y.offsetWidth,X=_=>{let K=_/100*a,P=K-1.5,q=K+1.5;return P<Y&&q>o||P<Z&&q>D};p.classList.toggle("is-dodge",X(A(s))),v.classList.toggle("is-dodge",X(A(r)))}};b();let S=()=>J([s,r]),W=t=>{s=c(Math.min(w(t),r),i,n),b()},$=t=>{r=c(Math.max(w(t),s),i,n),b()},u=null,C=1,h=null,E=null,Q=t=>{let e=g.offsetWidth||u.width,a=c((t-u.left)/C/e,0,1);return c(i+a*(n-i),i,n)},R=t=>{let e=Q(t);h||(h=e<s?"lo":e>r?"hi":Math.abs(e-s)<=Math.abs(e-r)?"lo":"hi"),h==="lo"?W(e):$(e),S()};l.addEventListener("pointerdown",t=>{if(!(t.button!==0||u)){t.preventDefault();try{t.target.setPointerCapture(t.pointerId)}catch{}E=t.pointerId,u=g.getBoundingClientRect(),C=u.width/(g.offsetWidth||u.width),l.classList.add("is-active","is-dragging"),h=null,R(t.clientX),(h==="lo"?p:v).focus({focusVisible:!1})}}),l.addEventListener("pointermove",t=>{if(!(!u||t.pointerId!==E)){if(t.buttons===0){F();return}R(t.clientX)}});let F=t=>{t&&t.pointerId!==E||(u=null,h=null,E=null,l.classList.remove("is-active","is-dragging"))};l.addEventListener("pointerup",F),l.addEventListener("pointercancel",F),l.addEventListener("lostpointercapture",F),j(l,b),U(b),V(l,[[window,"resize"],[window,"tw-reflow"]],b);let H=t=>e=>{let a=e.shiftKey?10:1,o=t==="lo"?s:r;switch(e.key){case"ArrowRight":case"ArrowUp":o+=f*a;break;case"ArrowLeft":case"ArrowDown":o-=f*a;break;case"Home":o=t==="lo"?i:s;break;case"End":o=t==="lo"?r:n;break;default:return}e.preventDefault(),t==="lo"?W(o):$(o),S()};return p.addEventListener("keydown",H("lo")),v.addEventListener("keydown",H("hi")),{el:g,set:t=>{if(Array.isArray(t)){let e=+t[0],a=+t[1];if(!Number.isFinite(e)||!Number.isFinite(a))return;s=c(w(Math.min(e,a)),i,n),r=c(w(Math.max(e,a)),i,n),b()}},get:()=>[s,r]}}G("interval",tt);
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{O as M,P,b as R,j as I,m as L,o as q,x as S}from"./chunk-K6N3NNAW.js";function J(t){let N=I("div","tw-fps"),k=L("span","tw-fps-val","\u2014"),d=document.createElement("canvas");d.className="tw-fps-canvas",N.append(L("span","tw-fps-label",t.label||"FPS"),k,d);let s=d.getContext("2d"),m=80,i=new Array(m).fill(0),C=120,w=0,r=0,b=0,v=0,E=0,y=!1,a=()=>{[v,E]=S(d,s,2)},l=()=>{if(v){s.clearRect(0,0,v,E),s.strokeStyle=q(N),s.lineWidth=1.5,s.lineJoin="round",s.beginPath();for(let o=0;o<m;o++){let u=i[(w+o)%m],h=o/(m-1)*v,g=E-Math.min(u/C,1)*E;o?s.lineTo(h,g):s.moveTo(h,g)}s.stroke()}},p=o=>{if(!d.isConnected){if(y){window.removeEventListener("resize",a),window.removeEventListener("tw-reflow",a),b=0;return}r=0,b=requestAnimationFrame(p);return}if(y||(y=!0,a()),r){let u=1e3/(o-r);i[w]=u,w=(w+1)%m,k.textContent=Math.round(u),l()}r=o,b=requestAnimationFrame(p)};return requestAnimationFrame(()=>{a(),b=requestAnimationFrame(p)}),window.addEventListener("resize",a),window.addEventListener("tw-reflow",a),M(N)}function W(t){let N=typeof t.get=="function"?t.get:()=>t.value,k=Math.max(30,Number.isFinite(+t.interval)?+t.interval:200),d;try{d=N()}catch{}let s=typeof d=="number",m=t.view==="graph"||s&&t.graph!==!1&&t.view!=="text"&&t.rows==null,i=I("div","tw-fps tw-monitor"),C=L("span","tw-fps-val","\u2014");i.append(L("span","tw-fps-label",t.label||"Monitor"),C);let w=0,r=()=>{},b=!1,v=e=>typeof e=="number"?Number.isInteger(e)?String(e):e.toFixed(t.decimals??2):String(e),E=()=>{w&&clearInterval(w),w=0,window.removeEventListener("resize",r),window.removeEventListener("tw-reflow",r)},y=e=>{w=setInterval(()=>{if(!i.isConnected){b&&E();return}b=!0;let c;try{c=N()}catch{return}e(c)},k)};if(!m&&t.rows){C.remove();let e=Math.max(1,Math.floor(+t.rows)||1),c=I("pre","tw-monitor-buffer");c.style.setProperty("--tw-monitor-rows",e),i.append(c);let F=[];return y(z=>{for(F.push(v(z));F.length>e;)F.shift();c.textContent=F.join(`
|
|
2
|
-
`)}),M(i)}if(!m)return y(e=>{C.textContent=v(e)}),M(i);let a=document.createElement("canvas");a.className="tw-fps-canvas",i.append(a);let l=a.getContext("2d"),p=80,o=new Array(p).fill(NaN),u=0,h=0,g=0;r=()=>{[h,g]=S(a,l,2)};let T=()=>{if(h||r(),!h)return;let e=t.min,c=t.max;if(e==null||c==null){let n=1/0,f=-1/0;for(let x of o)Number.isNaN(x)||(x<n&&(n=x),x>f&&(f=x));n===1/0?(n=0,f=1):n===f&&(n-=.5,f+=.5);let A=(f-n)*.1;e==null&&(e=n-A),c==null&&(c=f+A)}let F=c-e||1;l.clearRect(0,0,h,g),l.strokeStyle=q(i),l.lineWidth=1.5,l.lineJoin="round",l.beginPath();let z=!1;for(let n=0;n<p;n++){let f=o[(u+n)%p];if(Number.isNaN(f))continue;let A=n/(p-1)*h,x=g-R((f-e)/F,0,1)*g;z?l.lineTo(A,x):(l.moveTo(A,x),z=!0)}l.stroke()};return y(e=>{typeof e=="number"&&(o[u]=e,u=(u+1)%p,C.textContent=v(e),T())}),requestAnimationFrame(()=>{r(),T()}),window.addEventListener("resize",r),window.addEventListener("tw-reflow",r),M(i)}P("fpsgraph",J);P("monitor",W);
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{P as Z,b as $,j as m,k as P,m as B,q as H,r as Y}from"./chunk-K6N3NNAW.js";var W=Object.assign(Object.create(null),{sin:Math.sin,cos:Math.cos,tan:Math.tan,asin:Math.asin,acos:Math.acos,atan:Math.atan,atan2:Math.atan2,sinh:Math.sinh,cosh:Math.cosh,tanh:Math.tanh,sqrt:Math.sqrt,cbrt:Math.cbrt,abs:Math.abs,exp:Math.exp,log:Math.log,ln:Math.log,log10:Math.log10,log2:Math.log2,floor:Math.floor,ceil:Math.ceil,round:Math.round,sign:Math.sign,trunc:Math.trunc,min:Math.min,max:Math.max,pow:Math.pow,hypot:Math.hypot,mod:(i,f)=>i%f,clamp:(i,f,o)=>Math.min(Math.max(i,f),o)}),D=Object.assign(Object.create(null),{pi:Math.PI,e:Math.E,tau:Math.PI*2,phi:(1+Math.sqrt(5))/2});function j(i){if(typeof i!="string"||!i.trim()||i.length>512)return null;let f=i,o=[],p=/\d*\.?\d+(?:[eE][+-]?\d+)?/y,x=/[A-Za-z_]\w*/y,u=0;for(;u<f.length;){let t=f[u];if(t===" "||t===" "||t===`
|
|
2
|
-
`){u++;continue}if(t>="0"&&t<="9"||t==="."&&f[u+1]>="0"&&f[u+1]<="9"){p.lastIndex=u;let n=p.exec(f);if(!n||n.index!==u)return null;o.push({t:"num",v:parseFloat(n[0])}),u=p.lastIndex;continue}if(t>="A"&&t<="Z"||t>="a"&&t<="z"||t==="_"){x.lastIndex=u;let n=x.exec(f);o.push({t:"id",v:n[0]}),u=x.lastIndex;continue}if(t==="*"&&f[u+1]==="*"){o.push({t:"op",v:"^"}),u+=2;continue}if("+-*/%^".includes(t)){o.push({t:"op",v:t}),u++;continue}if(t==="("){o.push({t:"lp"}),u++;continue}if(t===")"){o.push({t:"rp"}),u++;continue}if(t===","){o.push({t:"comma"}),u++;continue}return null}if(!o.length)return null;let b=0,e=()=>o[b],c=t=>{let n=o[b];return!n||t&&n.t!==t?null:(b++,n)},d=()=>{let t=g();if(!t)return null;for(;e()&&e().t==="op"&&(e().v==="+"||e().v==="-");){let n=c("op").v,l=g();if(!l)return null;let a=t;t=n==="+"?s=>a(s)+l(s):s=>a(s)-l(s)}return t},g=()=>{let t=M();if(!t)return null;for(;e()&&e().t==="op"&&(e().v==="*"||e().v==="/"||e().v==="%");){let n=c("op").v,l=M();if(!l)return null;let a=t;t=n==="*"?s=>a(s)*l(s):n==="/"?s=>a(s)/l(s):s=>a(s)%l(s)}return t},M=()=>{if(e()&&e().t==="op"&&(e().v==="-"||e().v==="+")){let t=c("op").v,n=M();return n?t==="-"?l=>-n(l):n:null}return k()},k=()=>{let t=I();if(!t)return null;if(e()&&e().t==="op"&&e().v==="^"){c("op");let n=M();return n?l=>Math.pow(t(l),n(l)):null}return t},I=()=>{let t=e();if(!t)return null;if(t.t==="num")return c("num"),()=>t.v;if(t.t==="lp"){c("lp");let n=d();return!n||!c("rp")?null:n}if(t.t==="id"){c("id");let n=t.v.toLowerCase();if(e()&&e().t==="lp"){let l=W[n];if(!l)return null;c("lp");let a=[];if(e()&&e().t!=="rp")do{let s=d();if(!s)return null;a.push(s)}while(c("comma"));return c("rp")?s=>l(...a.map(y=>y(s))):null}if(n==="x")return l=>l;if(n in D){let l=D[n];return()=>l}return null}return null},N=d();return N&&b===o.length?N:null}function X(i,f){let o=Number(i.xMin),p=Number(i.xMax);if(Number.isFinite(o)||(o=-10),Number.isFinite(p)||(p=10),p<o){let a=o;o=p,p=a}p===o&&(o-=1,p+=1);let x=Math.max(2,Math.min(4096,i.samples|0||256)),u=Number.isFinite(i.yMin)&&Number.isFinite(i.yMax)&&+i.yMax>+i.yMin,b=i.editable!==!1&&!i.fn,e=i.expr!=null?String(i.expr):"",c=typeof i.fn=="function"?i.fn:j(e),d=m("div","tw-plot");i.label&&d.append(B("div","tw-plot-label",i.label));let g=m("div","tw-plot-graph"),M=P("svg","tw-plot-svg");M.setAttribute("preserveAspectRatio","none");let k=P("line","tw-plot-axis"),I=P("line","tw-plot-axis"),N=P("path","tw-plot-curve");M.append(k,I,N),g.append(M),d.append(g);let t=null;if(b){let a=m("div","tw-plot-field");t=m("input","tw-plot-input"),t.type="text",t.value=e,t.spellcheck=!1,t.autocapitalize="off",t.autocomplete="off",t.setAttribute("aria-label",`${i.label||"Plot"} \u2014 expression in x`),a.append(m("span","tw-plot-fx","y ="),t),d.append(a)}let n=6,l=()=>{let a=g.getBoundingClientRect(),s=a.width,y=a.height;if(s<2)return;M.setAttribute("viewBox",`0 0 ${s} ${y}`);let O=typeof c=="function",z=[],v=1/0,A=-1/0;if(O)for(let r=0;r<x;r++){let w=o+(p-o)*(r/(x-1)),h;try{h=c(w)}catch{h=NaN}z.push(h),Number.isFinite(h)&&(h<v&&(v=h),h>A&&(A=h))}let F=i.yMin,L=i.yMax;if(!u)if(!Number.isFinite(v)||v===A){let r=Number.isFinite(v)?v:0;F=r-1,L=r+1}else{let r=(A-v)*.12;F=v-r,L=A+r}let C=r=>n+(r-o)/(p-o)*(s-2*n),E=r=>y-n-(r-F)/(L-F)*(y-2*n),_=(r,w,h,S,U,T)=>{r.style.display=T?"":"none",T&&(r.setAttribute("x1",w),r.setAttribute("y1",h),r.setAttribute("x2",S),r.setAttribute("y2",U))};_(k,n,E(0),s-n,E(0),F<=0&&L>=0),_(I,C(0),n,C(0),y-n,o<=0&&p>=0);let q="",R=!1;if(O)for(let r=0;r<x;r++){let w=z[r];if(!Number.isFinite(w)){R=!1;continue}let h=C(o+(p-o)*(r/(x-1))),S=$(E(w),-1e4,1e4);q+=(R?"L":"M")+h.toFixed(1)+","+S.toFixed(1)+" ",R=!0}N.setAttribute("d",q),d.classList.toggle("is-invalid",b&&!O)};return b&&t.addEventListener("input",()=>{e=t.value;let a=j(e);a?c=a:c=null,l(),f(e)}),H(l),Y(d,[[window,"resize"],[window,"tw-reflow"]],l),{el:d,get:()=>e,set:a=>{a!=null&&(e=String(a),t&&(t.value=e),i.fn||(c=j(e)),l())}}}Z("plot",X);export{j as compileExpr};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{E as L,M as V,N as q,P as z,b as R,d as X,j as n,k as P,v as $,w as B}from"./chunk-K6N3NNAW.js";function N(s,G){let o=s.components,{root:m,trigger:I,right:J}=V("tw-point",s.label||"Point"),Y=n("span","tw-trigger-value"),k=n("div","tw-trigger-chip tw-point-preview"),l=n("div","tw-point-preview-dot");k.append(l),J.append(Y,k);let b=n("div","tw-color-pop tw-point-pop"),h=n("div","tw-point-body");b.append(h);let E=s.pad!==!1&&o.length>=2,O=o[0],S=o[1],x=O?.min??-1,A=O?.max??1,f=S?.min??-1,F=S?.max??1,w=(t,e,c)=>c>e?R((t-e)/(c-e),0,1):.5,r=null,u=null,a=null;if(E){r=n("div","tw-pad"),u=n("div","tw-pad-thumb");let t=P("svg","tw-pad-line");t.setAttribute("viewBox","0 0 100 100"),t.setAttribute("preserveAspectRatio","none"),a=P("line"),t.append(a);let e=w(0,f,F);a.setAttribute("x1",w(0,x,A)*100),a.setAttribute("y1",(s.invertY?e:1-e)*100),r.append(n("div","tw-pad-axis tw-pad-axis-x"),n("div","tw-pad-axis tw-pad-axis-y"),t,u),h.append(r)}let D=n("div","tw-fields");h.append(D);let d=()=>{C(),M()},T=()=>G(j()),i=o.map(t=>{let e=q({label:t.label,value:t.value??0,step:t.step??1,min:t.min,max:t.max},()=>{d(),T()});return D.append(e.el),e}),j=()=>Object.fromEntries(o.map((t,e)=>[t.key,i[e].get()])),K=(t,e)=>(+t).toFixed(X(e??1)),M=()=>{Y.textContent=o.map((t,e)=>K(i[e].get(),t.step)).join(", ")},C=()=>{l.style.left="50%",l.style.top="50%"};if(E){let e=p=>`calc(${(p*100).toFixed(2)}% + ${((.5-p)*5).toFixed(2)}px)`;C=()=>{let p=w(i[0].get(),x,A),y=w(i[1].get(),f,F),v=s.invertY?y:1-y,g=p*100,H=v*100;u.style.left=g+"%",u.style.top=H+"%",l.style.left=e(p),l.style.top=e(v),a.setAttribute("x2",g),a.setAttribute("y2",H)},$(r,p=>{let[y,v]=B(p,r),g=s.invertY?v:1-v;i[0].set(x+y*(A-x)),i[1].set(f+g*(F-f)),d(),T()})}return m.append(b),L(m,I,b,{width:216,fallbackH:240,gap:6,onOpen:d}),d(),{el:m,set:t=>{t&&o.forEach((e,c)=>{t[e.key]!=null&&i[c].set(t[e.key])}),d()},get:j}}z("point",N);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{L as ss,N as I,P as ts,b as T,j as R,m as H,n as K,o as O,q as Q,r as Z,u as $}from"./chunk-K6N3NNAW.js";function os(r,P,D,h=64){let t=Math.sqrt(r/D),l=P/(2*Math.sqrt(r*D)),k=Math.min(2.2,9/Math.max(l*t,.5)),b=[];for(let g=0;g<h;g++){let m=g/(h-1)*k,u;if(l<1-1e-4){let n=t*Math.sqrt(1-l*l);u=1-Math.exp(-l*t*m)*(Math.cos(n*m)+l*t/n*Math.sin(n*m))}else if(l<=1+1e-4)u=1-Math.exp(-t*m)*(1+t*m);else{let n=Math.sqrt(l*l-1),i=t*(l+n),c=t*(l-n);u=1-(i*Math.exp(-c*m)-c*Math.exp(-i*m))/(i-c)}b.push(u)}return b}function as(r,P){let D=(s,e,o)=>Number.isFinite(+s)?Math.max(e,+s):o,h=s=>({stiffness:D(s.stiffness,1,300),damping:D(s.damping,.5,26),mass:D(s.mass,.1,1)}),t=s=>Number.isFinite(+s),b=s=>T(t(s)?+s:.5,.1,1),g=s=>T(t(s)?+s:.2,0,1),m=s=>{let e=(2*Math.PI/s.visualDuration)**2,o=1-s.bounce,d=1;return{stiffness:e,damping:2*o*Math.sqrt(e*d),mass:d}},u={stiffness:r.stiffness,damping:r.damping,mass:r.mass,visualDuration:r.visualDuration,bounce:r.bounce,...r.value||{}},n=r.mode==="time"||r.mode==="physics"?r.mode:t(u.visualDuration)||t(u.bounce)?"time":"physics",i={visualDuration:b(u.visualDuration),bounce:g(u.bounce)},c=h({stiffness:u.stiffness,damping:u.damping,mass:u.mass}),N=R("div","tw-spring"),M=R("div","tw-spring-viz"),v=document.createElement("canvas");v.className="tw-spring-canvas",M.append(v);let X=R("div","tw-fields"),C=R("div","tw-fields"),a=v.getContext("2d"),F=()=>h(n==="time"?m(i):c),f=()=>{let s=M.getBoundingClientRect(),e=Math.max(1,Math.round(s.width)),o=Math.max(1,Math.round(s.height));if(e<2)return;let d=window.devicePixelRatio||1;v.width=e*d,v.height=o*d,a.setTransform(d,0,0,d,0,0),a.clearRect(0,0,e,o);let q=F(),B=os(q.stiffness,q.damping,q.mass,Math.max(160,Math.round(e*d))),is=Math.max(1.05,...B),y=8,J=x=>y+x/(B.length-1)*(e-2*y),A=x=>o-y-x/is*(o-2*y);a.strokeStyle=K(N,"--tw-surface-active")||"rgba(255,255,255,0.1)",a.lineWidth=1,a.beginPath(),a.moveTo(y,A(1)),a.lineTo(e-y,A(1)),a.stroke(),a.strokeStyle=O(N),a.lineWidth=1.5,a.lineJoin=a.lineCap="round",a.beginPath(),B.forEach((x,E)=>E?a.lineTo(J(E),A(x)):a.moveTo(J(E),A(x))),a.stroke()},L=()=>n==="time"?{...F(),visualDuration:i.visualDuration,bounce:i.bounce}:F(),_=()=>P(L()),p={};[["stiffness","Stiffness",1],["damping","Damping",.5],["mass","Mass",.1]].forEach(([s,e,o])=>{p[s]=I({label:e,value:c[s],step:o,min:o},d=>{c[s]=d,f(),_()}),X.append(p[s].el)});let S=I({label:"Duration",value:i.visualDuration,step:.05,min:.1,max:1},s=>{i.visualDuration=b(s),f(),_()}),U=I({label:"Bounce",value:i.bounce,step:.05,min:0,max:1},s=>{i.bounce=g(s),f(),_()});C.append(S.el,U.el);let z=()=>{C.style.display=n==="time"?"":"none",X.style.display=n==="physics"?"":"none"},V=ss([{value:"time",label:"Time"},{value:"physics",label:"Physics"}],n,s=>{s!=="time"&&s!=="physics"||s===n||(n=s,z(),f(),_())},"Spring mode"),W=R("div","tw-row");W.append(H("span","tw-row-label","Mode"),V.el),N.append(M,W,X,C);let Y=1,es=500,j=1,ns=40,w=null,G=s=>{if(!w)return;let e=T((s.clientX-w.left)/w.width,0,1),o=T((s.clientY-w.top)/w.height,0,1);n==="time"?(S.set(.1+e*(1-.1)),i.visualDuration=S.get(),U.set(1-o),i.bounce=U.get()):(p.stiffness.set(Y+e*(es-Y)),c.stiffness=p.stiffness.get(),p.damping.set(j+o*(ns-j)),c.damping=p.damping.get()),f(),_()};return $(M,{onDown:s=>{s.preventDefault(),w=M.getBoundingClientRect(),M.classList.add("is-dragging"),G(s)},onMove:G,onEnd:()=>{w=null,M.classList.remove("is-dragging")}}),z(),Q(f),Z(v,[[window,"resize"],[window,"tw-reflow"],[matchMedia("(prefers-color-scheme: dark)"),"change"],[window,"tw-retheme"]],f),{el:N,set:s=>{if(!s||typeof s!="object")return;let e=t(s.visualDuration)||t(s.bounce),o=t(s.stiffness)||t(s.damping)||t(s.mass);!e&&!o||(n=e?"time":"physics",e&&(t(s.visualDuration)&&(i.visualDuration=b(s.visualDuration)),t(s.bounce)&&(i.bounce=g(s.bounce))),o&&(c=h({...c,...s})),V.set(n),S.set(i.visualDuration),U.set(i.bounce),p.stiffness.set(c.stiffness),p.damping.set(c.damping),p.mass.set(c.mass),z(),f())},get:()=>L()}}ts("spring",as);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{H as w,K as f,P as A,j as r,m as v,q as g}from"./chunk-K6N3NNAW.js";var S=0;function $(m){let d=`tw-tabs-${++S}`,b=r("div","tw-tabs"),s=r("div","tw-tabs-bar");s.setAttribute("role","tablist");let l=r("div","tw-tabs-pill");s.append(l);let u=r("div","tw-tabs-pages"),o=[],i=m.pages.map((a,e)=>{let t=v("button","tw-tabs-tab",a.title);t.type="button",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=`${d}-tab-${e}`,t.setAttribute("aria-controls",`${d}-page-${e}`);let n=r("div","tw-tabs-page tw-controls");return n.dataset.active=String(e===0),n.setAttribute("role","tabpanel"),n.id=`${d}-page-${e}`,n.setAttribute("aria-labelledby",t.id),o.push(n),u.append(n),t.addEventListener("click",()=>c(e)),s.append(t),t});b.append(s,u);let p=a=>w(s,l,a);function c(a){i.forEach((e,t)=>{e.dataset.active=String(t===a),e.setAttribute("aria-selected",String(t===a)),e.tabIndex=t===a?0:-1}),o.forEach((e,t)=>e.dataset.active=String(t===a)),p(!0),requestAnimationFrame(()=>window.dispatchEvent(new Event("tw-reflow")))}return s.addEventListener("keydown",a=>{let e=i.findIndex(n=>n.dataset.active==="true");if(e<0)return;let t=f(a.key,e,i.length,-1);t<0||(a.preventDefault(),c(t),i[t].focus())}),g(p),{el:b,bodies:o,activate:c,active:()=>i.findIndex(a=>a.dataset.active==="true")}}A("tabs",$);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
declare const CHECKER = "repeating-conic-gradient(#6b6b6b 0% 25%, #9a9a9a 0% 50%) 0 0 / 8px 8px";
|
|
2
|
-
declare function parseColor(str: any): any[];
|
|
3
|
-
declare function createPickerBody(meta: any, onChange: any): {
|
|
4
|
-
el: any;
|
|
5
|
-
set: (v: any) => void;
|
|
6
|
-
get: () => any;
|
|
7
|
-
mode: () => any;
|
|
8
|
-
setMode: (m: any) => void;
|
|
9
|
-
reflow: () => void;
|
|
10
|
-
swatchCss: () => string;
|
|
11
|
-
valueText: () => string;
|
|
12
|
-
};
|
|
13
|
-
declare const oklchStr: (L: any, C: any, H: any, A: any) => string;
|
|
14
|
-
export { createPickerBody, parseColor, oklchStr, CHECKER };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function compileExpr(src: any): any;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
declare const titleCase: (s: any) => any;
|
|
2
|
-
declare const clamp: (v: any, lo: any, hi: any) => number;
|
|
3
|
-
declare const isColorStr: (v: any) => boolean;
|
|
4
|
-
declare const stepPrecision: (step: any) => number;
|
|
5
|
-
declare const roundToStep: (v: any, min: any, step: any) => any;
|
|
6
|
-
declare const inferStep: (min: any, max: any) => 1 | 0.1 | 0.01 | 10;
|
|
7
|
-
declare const defaultRange: (v: any) => number[];
|
|
8
|
-
declare const optValue: (o: any) => any;
|
|
9
|
-
declare const optLabel: (o: any) => any;
|
|
10
|
-
declare const el: (tag: string, cls?: string, html?: string) => any;
|
|
11
|
-
declare const svgEl: (tag: string, cls?: string) => any;
|
|
12
|
-
declare const btn: (cls: string, html?: string) => any;
|
|
13
|
-
declare const txt: (tag: string, cls: string, text: any) => any;
|
|
14
|
-
declare const cssVar: (node: any, name: any) => string;
|
|
15
|
-
declare const accentColor: (node: any) => string;
|
|
16
|
-
declare const stopPointerLeak: (node: any) => void;
|
|
17
|
-
declare const onReady: (fn: any) => void;
|
|
18
|
-
declare const onLive: (owner: any, targets: Array<[any, string]>, fn: (e?: any) => void) => () => void;
|
|
19
|
-
declare const wireHoverClass: (el: any, onEnter: any) => void;
|
|
20
|
-
declare const quietFocus: (input: any) => void;
|
|
21
|
-
declare function dragGesture(node: any, { onDown, onMove, onEnd }?: {
|
|
22
|
-
onDown?: (e: any) => void;
|
|
23
|
-
onMove?: (e: any) => void;
|
|
24
|
-
onEnd?: (e: any) => void;
|
|
25
|
-
}): void;
|
|
26
|
-
declare const grabSurface: (surface: any, set: any) => void;
|
|
27
|
-
declare const boxFrac: (e: any, box: any) => number[];
|
|
28
|
-
declare const fitCanvas: (canvas: any, ctx: any, maxDpr?: number) => any[];
|
|
29
|
-
export declare const placeBelow: (trigger: any, pop: any, { width, fallbackH, gap, align, prefer }?: {
|
|
30
|
-
width?: number | "match";
|
|
31
|
-
fallbackH?: number;
|
|
32
|
-
gap?: number;
|
|
33
|
-
align?: "start" | "end" | "center";
|
|
34
|
-
prefer?: "above" | "below";
|
|
35
|
-
}) => void;
|
|
36
|
-
declare const resolveTheme: (theme: any) => {};
|
|
37
|
-
declare const applyThemeVars: (node: any, vars: any) => void;
|
|
38
|
-
declare const carryScheme: (portal: any, anchor: any) => void;
|
|
39
|
-
declare const carrySkin: (portal: any, anchor: any) => void;
|
|
40
|
-
declare const closeActivePopover: () => void;
|
|
41
|
-
declare function popover(root: any, trigger: any, pop: any, opts?: {
|
|
42
|
-
width?: number | "match";
|
|
43
|
-
fallbackH?: number;
|
|
44
|
-
gap?: number;
|
|
45
|
-
align?: "start" | "end";
|
|
46
|
-
onOpen?: () => void;
|
|
47
|
-
onReflow?: () => void;
|
|
48
|
-
}): {
|
|
49
|
-
open: () => void;
|
|
50
|
-
close: () => void;
|
|
51
|
-
isOpen: () => boolean;
|
|
52
|
-
reflow: () => void;
|
|
53
|
-
};
|
|
54
|
-
declare const fuzzyMatch: (text: any, q: any) => boolean;
|
|
55
|
-
declare const REDUCE_MOTION: any;
|
|
56
|
-
declare const measurePill: (container: any, pill: any, animate?: any) => void;
|
|
57
|
-
declare const setRadioActive: (btns: any, value: any) => any;
|
|
58
|
-
declare const radioButton: (cls: any, o: any, onPick: any) => any;
|
|
59
|
-
declare const navIndex: (key: any, i: any, n: any, cols?: number) => any;
|
|
60
|
-
declare function createSegmented(options: any, value: any, onChange: any, ariaLabel: any): {
|
|
61
|
-
el: any;
|
|
62
|
-
set: (v: any) => void;
|
|
63
|
-
get: () => any;
|
|
64
|
-
};
|
|
65
|
-
declare const triggerRow: (cls: string, label: string) => {
|
|
66
|
-
root: any;
|
|
67
|
-
trigger: any;
|
|
68
|
-
right: any;
|
|
69
|
-
};
|
|
70
|
-
declare function numField(spec: any, onChange: any): {
|
|
71
|
-
el: any;
|
|
72
|
-
set: (val: any) => void;
|
|
73
|
-
get: () => any;
|
|
74
|
-
};
|
|
75
|
-
declare const blade: (el: any) => {
|
|
76
|
-
el: any;
|
|
77
|
-
set: () => void;
|
|
78
|
-
get: () => any;
|
|
79
|
-
};
|
|
80
|
-
export declare const registerControl: (type: any, ctor: any) => void;
|
|
81
|
-
export declare const getControl: (type: any) => any;
|
|
82
|
-
export { titleCase, clamp, isColorStr, stepPrecision, roundToStep, inferStep, defaultRange, optValue, optLabel, el, btn, txt, svgEl, cssVar, accentColor, stopPointerLeak, onReady, onLive, wireHoverClass, dragGesture, boxFrac, fitCanvas, popover, closeActivePopover, resolveTheme, applyThemeVars, carryScheme, carrySkin, fuzzyMatch, setRadioActive, radioButton, navIndex, createSegmented, triggerRow, numField, blade, quietFocus, measurePill, grabSurface, REDUCE_MOTION, };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import "./controls/colour.js";
|
|
2
|
-
import "./controls/gradient.js";
|
|
3
|
-
import "./controls/interval.js";
|
|
4
|
-
import "./controls/tabs.js";
|
|
5
|
-
import "./controls/image.js";
|
|
6
|
-
import "./controls/monitor.js";
|
|
7
|
-
import "./controls/spring.js";
|
|
8
|
-
import "./controls/bezier.js";
|
|
9
|
-
import "./controls/point.js";
|
|
10
|
-
import "./controls/plot.js";
|
|
11
|
-
export { tweaks, enhance } from "./core.js";
|
|
12
|
-
export type { Schema, SchemaValue, SchemaObject, ControlOptions, Option, GradientStop, Get, TweaksOptions, Theme, Params, Panel, Control } from "./types.js";
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
export declare const num: (x: any) => any;
|
|
2
|
-
export declare function convert(coords: any, from: any, to: any): any[];
|
|
3
|
-
/** Map OKLCH into an RGB gamut (CSS Color 4 chroma reduction + local clip). */
|
|
4
|
-
export declare function toGamut(oklch: any, dest: any): any;
|
|
5
|
-
/** Fast in-gamut probe at a fixed hue — `(L,C)=>inside?` (his chroma-boundary loop). */
|
|
6
|
-
export declare function oklchGamutProbe(hue: any, gamut: any): (L: any, C: any) => boolean;
|
|
7
|
-
/** OKLCH→RGB at a fixed hue, folded for per-pixel rasterising: hoists cos/sin(hue) and
|
|
8
|
-
* collapses LMS→XYZ→RGB into one matrix once, then `(L, C, out)` writes the RGB straight
|
|
9
|
-
* into `out` (no per-pixel array alloc, no per-pixel trig). Algebraically identical to
|
|
10
|
-
* `convert([L,C,hue], "oklch", gamut)` — OKLAB_TO_LMS[i][0] is 1, so p_i = L + C·d_i, the
|
|
11
|
-
* same fold `oklchGamutProbe` ships. The picker's plane raster calls it once per repaint. */
|
|
12
|
-
export declare function oklchToRgbFn(hue: any, gamut: any): (L: any, C: any, out: any) => void;
|
|
13
|
-
/** Bisect the chroma ceiling at lightness L for an `oklchGamutProbe` — the highest
|
|
14
|
-
* in-gamut C. The picker traces its plane gamut, boundary lines, and hue strip with it. */
|
|
15
|
-
export declare function chromaCeil(probe: any, L: any, hi?: number): number;
|
|
16
|
-
/** One 0–1 channel → a 2-digit hex byte (also the alpha suffix for #RRGGBBAA). */
|
|
17
|
-
export declare const hexByte: (n: any) => string;
|
|
18
|
-
export declare const oklchToHex: (L: any, C: any, H: any) => string;
|
|
19
|
-
export declare function hexToOklch(hex: any): any[];
|
|
20
|
-
export declare const EDIT_MODES: string[];
|
|
21
|
-
export declare const MODE_LABELS: {
|
|
22
|
-
hex: string;
|
|
23
|
-
srgb: string;
|
|
24
|
-
css: string;
|
|
25
|
-
hsl: string;
|
|
26
|
-
hwb: string;
|
|
27
|
-
oklch: string;
|
|
28
|
-
oklab: string;
|
|
29
|
-
lch: string;
|
|
30
|
-
lab: string;
|
|
31
|
-
p3: string;
|
|
32
|
-
rec2020: string;
|
|
33
|
-
};
|
|
34
|
-
export declare const showsGamutBoundary: (mode: any) => boolean;
|
|
35
|
-
export declare const modeInterpolation: (mode: any) => any;
|
|
36
|
-
export declare const interpolationMode: (interp: any) => any;
|
|
37
|
-
export declare const MODE_CHANNELS: {
|
|
38
|
-
oklch: {
|
|
39
|
-
k: string;
|
|
40
|
-
min: number;
|
|
41
|
-
max: number;
|
|
42
|
-
step: number;
|
|
43
|
-
scale: number;
|
|
44
|
-
}[];
|
|
45
|
-
oklab: {
|
|
46
|
-
k: string;
|
|
47
|
-
min: number;
|
|
48
|
-
max: number;
|
|
49
|
-
step: number;
|
|
50
|
-
scale: number;
|
|
51
|
-
}[];
|
|
52
|
-
lch: {
|
|
53
|
-
k: string;
|
|
54
|
-
min: number;
|
|
55
|
-
max: number;
|
|
56
|
-
step: number;
|
|
57
|
-
scale: number;
|
|
58
|
-
}[];
|
|
59
|
-
lab: {
|
|
60
|
-
k: string;
|
|
61
|
-
min: number;
|
|
62
|
-
max: number;
|
|
63
|
-
step: number;
|
|
64
|
-
scale: number;
|
|
65
|
-
}[];
|
|
66
|
-
srgb: {
|
|
67
|
-
k: string;
|
|
68
|
-
min: number;
|
|
69
|
-
max: number;
|
|
70
|
-
step: number;
|
|
71
|
-
scale: number;
|
|
72
|
-
}[];
|
|
73
|
-
css: {
|
|
74
|
-
k: string;
|
|
75
|
-
min: number;
|
|
76
|
-
max: number;
|
|
77
|
-
step: number;
|
|
78
|
-
scale: number;
|
|
79
|
-
}[];
|
|
80
|
-
hsl: {
|
|
81
|
-
k: string;
|
|
82
|
-
min: number;
|
|
83
|
-
max: number;
|
|
84
|
-
step: number;
|
|
85
|
-
scale: number;
|
|
86
|
-
}[];
|
|
87
|
-
hwb: {
|
|
88
|
-
k: string;
|
|
89
|
-
min: number;
|
|
90
|
-
max: number;
|
|
91
|
-
step: number;
|
|
92
|
-
scale: number;
|
|
93
|
-
}[];
|
|
94
|
-
p3: {
|
|
95
|
-
k: string;
|
|
96
|
-
min: number;
|
|
97
|
-
max: number;
|
|
98
|
-
step: number;
|
|
99
|
-
scale: number;
|
|
100
|
-
}[];
|
|
101
|
-
rec2020: {
|
|
102
|
-
k: string;
|
|
103
|
-
min: number;
|
|
104
|
-
max: number;
|
|
105
|
-
step: number;
|
|
106
|
-
scale: number;
|
|
107
|
-
}[];
|
|
108
|
-
};
|
|
109
|
-
/** Display-unit channel values for `mode` from canonical OKLCH. */
|
|
110
|
-
export declare function channelValues(oklch: any, mode: any): any;
|
|
111
|
-
/** New OKLCH with channel `index` of `mode` set to `displayValue`. */
|
|
112
|
-
export declare function withChannel(oklch: any, mode: any, index: any, displayValue: any): any[];
|
|
113
|
-
/** Plain-text gamut label: sRGB / P3 / wide. */
|
|
114
|
-
export declare function gamutLabel(oklch: any, mode: any): "P3" | "sRGB" | "wide";
|
|
115
|
-
/** The collapsed-row value string for `mode` (bare channels w/ units, or hex). */
|
|
116
|
-
export declare function readout(oklch: any, mode: any): string;
|
|
117
|
-
/** The colour control's emitted CSS value — `mode`-faithful at the mode's display
|
|
118
|
-
* precision, alpha appended in that mode's own syntax. One form for opaque and
|
|
119
|
-
* translucent: a translucent rgb stays `rgb(… / a)` (it used to jump to `oklch()` at
|
|
120
|
-
* a different precision), and an opaque value reads back identically through parse. */
|
|
121
|
-
export declare function serialize(oklch: any, mode: any, alpha: any): any;
|