@patternmode/swatch 0.9.0 → 0.9.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.
package/README.md CHANGED
@@ -7,27 +7,27 @@ import { DistributionBar, Swatch } from "@patternmode/swatch";
7
7
  import "@patternmode/swatch/styles.css";
8
8
 
9
9
  export function Example() {
10
- return (
11
- <>
12
- <Swatch
13
- aria-label="Palette"
14
- colors={[
15
- { color: "#315c4b", ratio: 60 },
16
- { color: "#e1ebe5", ratio: 40 },
17
- ]}
18
- shape="pill"
19
- size="2xl"
20
- />
21
- <DistributionBar
22
- aria-label="Finish distribution"
23
- segments={[
24
- { id: "evergreen", color: "#315c4b", label: "Evergreen", value: 48 },
25
- { id: "saffron", color: "#d9a441", label: "Saffron", value: 30 },
26
- { id: "oxblood", color: "#9b3d32", label: "Oxblood", value: 22 },
27
- ]}
28
- />
29
- </>
30
- );
10
+ return (
11
+ <>
12
+ <Swatch
13
+ aria-label="Palette"
14
+ colors={[
15
+ { color: "#315c4b", ratio: 60 },
16
+ { color: "#e1ebe5", ratio: 40 },
17
+ ]}
18
+ shape="pill"
19
+ size="2xl"
20
+ />
21
+ <DistributionBar
22
+ aria-label="Finish distribution"
23
+ segments={[
24
+ { id: "evergreen", color: "#315c4b", label: "Evergreen", value: 48 },
25
+ { id: "saffron", color: "#d9a441", label: "Saffron", value: 30 },
26
+ { id: "oxblood", color: "#9b3d32", label: "Oxblood", value: 22 },
27
+ ]}
28
+ />
29
+ </>
30
+ );
31
31
  }
32
32
  ```
33
33
 
@@ -1 +1 @@
1
- {"version":3,"file":"DistributionBarMath.d.ts","sourceRoot":"","sources":["../../src/DistributionBar/DistributionBarMath.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,4BAA4B,GAAG,OAAO,CACjD,IAAI,CAAC,sBAAsB,EAAE,OAAO,CAAC,CACrC,GAAG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,wBAAgB,oBAAoB,CACnC,QAAQ,EAAE,sBAAsB,EAAE,GAChC,MAAM,CAKR;AAED,wBAAgB,8BAA8B,CAC7C,QAAQ,EAAE,sBAAsB,EAAE,EAClC,aAAa,EAAE,MAAM,GACnB,MAAM,CAUR;AAED,wBAAgB,wBAAwB,CACvC,QAAQ,EAAE,sBAAsB,EAAE,EAClC,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACd,sBAAsB,EAAE,CAyB1B;AAED,wBAAgB,yBAAyB,CACxC,QAAQ,EAAE,sBAAsB,EAAE,EAClC,SAAS,EAAE,MAAM,GACf,sBAAsB,EAAE,CAmC1B;AAED,wBAAgB,yBAAyB,CACxC,QAAQ,EAAE,sBAAsB,EAAE,EAClC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,4BAA4B,GAClC,sBAAsB,EAAE,CAI1B"}
1
+ {"version":3,"file":"DistributionBarMath.d.ts","sourceRoot":"","sources":["../../src/DistributionBar/DistributionBarMath.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,4BAA4B,GAAG,OAAO,CAChD,IAAI,CAAC,sBAAsB,EAAE,OAAO,CAAC,CACtC,GAAG;IACF,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC;AAEF,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,sBAAsB,EAAE,GACjC,MAAM,CAKR;AAED,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,sBAAsB,EAAE,EAClC,a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,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAChD,cAAc,CAAC,mBAAmB,CAAC,EACnC,UAAU,CACX;IACC,iFAAiF;IACjF,MAAM,CAAC,EAAE,UAAU,GAAG,KAAK,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,sBAAsB,EAAE,KAAK,IAAI,CAAC;IACxD,QAAQ,EAAE,sBAAsB,EAAE,CAAC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,mBAAmB,CAAC,EAClC,YAAY,EAAE,SAAS,EACvB,aAA0B,EAC1B,SAAS,EACT,UAAyB,EACzB,UAAc,EACd,MAAmB,EACnB,eAAe,EACf,QAAQ,EACR,iBAAiB,EACjB,GAAG,KAAK,EACT,EAAE,wBAAwB,2CAmE1B;AAED,wBAAgB,eAAe,CAAC,EAC9B,YAAY,EAAE,SAAS,EACvB,SAAS,EACT,MAAmB,EACnB,QAAY,EACZ,QAAQ,EACR,QAAQ,EACR,IAAQ,EACR,GAAG,KAAK,EACT,EAAE,oBAAoB,2CA8FtB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DistributionBar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,8BAA8B,EAC9B,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,GACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,eAAe,EACf,KAAK,oBAAoB,EACzB,mBAAmB,EACnB,KAAK,wBAAwB,GAC7B,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DistributionBar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,8BAA8B,EAC9B,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,eAAe,EACf,KAAK,oBAAoB,EACzB,mBAAmB,EACnB,KAAK,wBAAwB,GAC9B,MAAM,uBAAuB,CAAC"}
@@ -6,9 +6,9 @@ export interface SwatchAtmosphereOptions {
6
6
  gravity?: number;
7
7
  }
8
8
  /**
9
- * Build a soft, layered radial "atmosphere" background from weighted color
10
- * stops — a stack of overlapping elliptical pools rather than a flat or linear
11
- * fill. Density controls how far each pool reaches; gravity shifts the pools
9
+ * Build a soft, layered radial "atmosphere" background from color stops — a
10
+ * stack of overlapping elliptical pools rather than a flat or linear fill.
11
+ * Density controls how far each pool reaches; gravity shifts the pools
12
12
  * vertically. Returns `undefined` when there are no colors.
13
13
  */
14
14
  export declare function getSwatchAtmosphereBackground(colors: SwatchColorStop[] | undefined, options?: SwatchAtmosphereOptions): string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"SwatchAtmosphere.d.ts","sourceRoot":"","sources":["../../src/Swatch/SwatchAtmosphere.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,WAAW,uBAAuB;IACvC,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAmBD;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC5C,MAAM,EAAE,eAAe,EAAE,GAAG,SAAS,EACrC,OAAO,GAAE,uBAA4B,GACnC,MAAM,GAAG,SAAS,CA0BpB"}
1
+ {"version":3,"file":"SwatchAtmosphere.d.ts","sourceRoot":"","sources":["../../src/Swatch/SwatchAtmosphere.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,WAAW,uBAAuB;IACtC,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAmBD;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,eAAe,EAAE,GAAG,SAAS,EACrC,OAAO,GAAE,uBAA4B,GACpC,MAAM,GAAG,SAAS,CA0BpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"SwatchColors.d.ts","sourceRoot":"","sources":["../../src/Swatch/SwatchColors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAWnD;AAED,wBAAgB,yBAAyB,CACxC,MAAM,EAAE,eAAe,EAAE,GAAG,SAAS,GACnC,MAAM,GAAG,SAAS,CAyBpB"}
1
+ {"version":3,"file":"SwatchColors.d.ts","sourceRoot":"","sources":["../../src/Swatch/SwatchColors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAWnD;AAED,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,eAAe,EAAE,GAAG,SAAS,GACpC,MAAM,GAAG,SAAS,CAyBpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"SwatchRoot.d.ts","sourceRoot":"","sources":["../../src/Swatch/SwatchRoot.tsx"],"names":[],"mappings":"AAKA,OAAO,EAA8B,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAE7E,wBAAgB,MAAM,CAAC,EACtB,YAAY,EAAE,SAAS,EACvB,UAAU,EACV,QAAQ,EACR,SAAS,EACT,KAAK,EACL,MAAM,EACN,OAAO,EACP,IAAY,EACZ,OAAO,EACP,IAAI,EAAE,IAAI,EACV,OAAO,EACP,SAAS,EACT,cAAc,EACd,QAAQ,EACR,MAAc,EACd,WAAW,EACX,IAAI,EAAE,KAAK,EACX,QAAgB,EAChB,KAAgB,EAChB,QAAe,EACf,IAAa,EACb,KAAK,EACL,OAAO,EACP,WAAmB,EACnB,GAAG,KAAK,EACR,EAAE,WAAW,2CAwGb"}
1
+ {"version":3,"file":"SwatchRoot.d.ts","sourceRoot":"","sources":["../../src/Swatch/SwatchRoot.tsx"],"names":[],"mappings":"AAKA,OAAO,EAA8B,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAE7E,wBAAgB,MAAM,CAAC,EACrB,YAAY,EAAE,SAAS,EACvB,UAAU,EACV,QAAQ,EACR,SAAS,EACT,KAAK,EACL,MAAM,EACN,OAAO,EACP,IAAY,EACZ,OAAO,EACP,IAAI,EAAE,IAAI,EACV,OAAO,EACP,SAAS,EACT,cAAc,EACd,QAAQ,EACR,MAAc,EACd,WAAW,EACX,IAAI,EAAE,KAAK,EACX,QAAgB,EAChB,KAAgB,EAChB,QAAe,EACf,IAAa,EACb,KAAK,EACL,OAAO,EACP,WAAmB,EACnB,GAAG,KAAK,EACT,EAAE,WAAW,2CAuGb"}
@@ -58,9 +58,9 @@ export interface SwatchProps extends HTMLAttributes<HTMLElement> {
58
58
  showRing?: boolean;
59
59
  size?: SwatchSize;
60
60
  /**
61
- * Render `colors` as a soft, layered radial atmosphere — overlapping color
62
- * pools — instead of the default linear gradient. Pair with `density` and
63
- * `gravity` to shape the pools.
61
+ * Render supplied colors as a soft, layered radial atmosphere — overlapping
62
+ * color pools — instead of a ratio-encoded weighted palette. Pair with
63
+ * `density` and `gravity` to shape the pools.
64
64
  */
65
65
  texture?: SwatchTexture;
66
66
  unavailable?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"SwatchTypes.d.ts","sourceRoot":"","sources":["../../src/Swatch/SwatchTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,SAAS,EAGd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EA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EACN,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,yBAAyB,GACzB,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,mBAAmB,EACnB,KAAK,wBAAwB,EAC7B,8BAA8B,EAC9B,oBAAoB,EACpB,6BAA6B,EAC7B,yBAAyB,EACzB,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,MAAM,EACN,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,yBAAyB,GAC1B,MAAM,UAAU,CAAC"}
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { PATTERNMODE_SIZES, PATTERNMODE_SIZE_VALUES, getObjectSizingStyle, joinClassNames } from "@patternmode/system";
2
- import { motion } from "motion/react";
2
+ import { LazyMotion, domMax, m } from "motion/react";
3
3
  import { useRef } from "react";
4
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
5
  //#region src/DistributionBar/DistributionBarMath.ts
@@ -112,12 +112,11 @@ function DistributionDisplay({ "aria-label": ariaLabel, assignedLabel = "assigne
112
112
  className: sharedClassName,
113
113
  "data-slot": "distribution-display",
114
114
  children: content
115
- }) : /* @__PURE__ */ jsx("div", {
115
+ }) : /* @__PURE__ */ jsx("figure", {
116
116
  ...props,
117
117
  "aria-label": accessibleLabel,
118
118
  className: sharedClassName,
119
119
  "data-slot": "distribution-display",
120
- role: "img",
121
120
  children: content
122
121
  });
123
122
  }
@@ -268,20 +267,23 @@ function getRenderableDistributionValue(value) {
268
267
  return Number.isFinite(value) ? Math.max(0, value) : 0;
269
268
  }
270
269
  function DistributionBarHandle({ "aria-label": ariaLabel, boundaryPercent, onDrag, onDragEnd, onDragStart, onKeyDown }) {
271
- return /* @__PURE__ */ jsx(motion.button, {
272
- "aria-label": ariaLabel,
273
- className: "patternmode-distribution-bar__handle",
274
- drag: "x",
275
- dragElastic: 0,
276
- dragMomentum: false,
277
- dragSnapToOrigin: true,
278
- onDrag: (_event, info) => onDrag(info),
279
- onDragEnd: (_event, info) => onDragEnd(info),
280
- onDragStart,
281
- onKeyDown,
282
- style: { left: `calc(${boundaryPercent}% - 1.375rem)` },
283
- transformTemplate: () => "none",
284
- type: "button"
270
+ return /* @__PURE__ */ jsx(LazyMotion, {
271
+ features: domMax,
272
+ children: /* @__PURE__ */ jsx(m.button, {
273
+ "aria-label": ariaLabel,
274
+ className: "patternmode-distribution-bar__handle",
275
+ drag: "x",
276
+ dragElastic: 0,
277
+ dragMomentum: false,
278
+ dragSnapToOrigin: true,
279
+ onDrag: (_event, info) => onDrag(info),
280
+ onDragEnd: (_event, info) => onDragEnd(info),
281
+ onDragStart,
282
+ onKeyDown,
283
+ style: { left: `calc(${boundaryPercent}% - 1.375rem)` },
284
+ transformTemplate: () => "none",
285
+ type: "button"
286
+ })
285
287
  });
286
288
  }
287
289
  //#endregion
@@ -339,9 +341,9 @@ const POOLS = [
339
341
  ]
340
342
  ];
341
343
  /**
342
- * Build a soft, layered radial "atmosphere" background from weighted color
343
- * stops — a stack of overlapping elliptical pools rather than a flat or linear
344
- * fill. Density controls how far each pool reaches; gravity shifts the pools
344
+ * Build a soft, layered radial "atmosphere" background from color stops — a
345
+ * stack of overlapping elliptical pools rather than a flat or linear fill.
346
+ * Density controls how far each pool reaches; gravity shifts the pools
345
347
  * vertically. Returns `undefined` when there are no colors.
346
348
  */
347
349
  function getSwatchAtmosphereBackground(colors, options = {}) {
@@ -367,7 +369,7 @@ function withAlpha(color, alpha) {
367
369
  }
368
370
  function normalizeHex$1(color) {
369
371
  const value = color.trim().replace(/^#/, "");
370
- if (/^[\da-f]{3}$/i.test(value)) return value.split("").map((part) => part + part).join("");
372
+ if (/^[\da-f]{3}$/i.test(value)) return [...value].map((part) => part + part).join("");
371
373
  if (/^[\da-f]{6}$/i.test(value)) return value;
372
374
  return null;
373
375
  }
@@ -403,7 +405,7 @@ function getSwatchColorsBackground(colors) {
403
405
  }
404
406
  function normalizeHex(hex) {
405
407
  const value = hex.trim().replace(/^#/, "");
406
- if (/^[\da-f]{3}$/i.test(value)) return value.split("").map((part) => part + part).join("");
408
+ if (/^[\da-f]{3}$/i.test(value)) return [...value].map((part) => part + part).join("");
407
409
  if (/^[\da-f]{6}$/i.test(value)) return value;
408
410
  return null;
409
411
  }
@@ -520,7 +522,7 @@ function Swatch({ "aria-label": ariaLabel, background, children, className, colo
520
522
  })
521
523
  })]
522
524
  });
523
- return /* @__PURE__ */ jsx("span", {
525
+ return /* @__PURE__ */ jsx("figure", {
524
526
  ...props,
525
527
  "aria-label": ariaLabel,
526
528
  className: joinClassNames("patternmode-swatch", className),
@@ -533,7 +535,6 @@ function Swatch({ "aria-label": ariaLabel, background, children, className, colo
533
535
  "data-slot": "swatch",
534
536
  "data-tone": light ? "light" : "dark",
535
537
  "data-unavailable": unavailable ? "true" : void 0,
536
- role: "img",
537
538
  style: rootStyle,
538
539
  children: swatchContent
539
540
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["clamp","normalizeHex"],"sources":["../src/DistributionBar/DistributionBarMath.ts","../src/DistributionBar/DistributionBarRoot.tsx","../src/Swatch/SwatchAtmosphere.ts","../src/Swatch/SwatchColors.ts","../src/Swatch/SwatchTypes.ts","../src/Swatch/SwatchRoot.tsx"],"sourcesContent":["export interface DistributionBarSegment {\n\tcolor: string;\n\tid: string;\n\tlabel?: string;\n\tvalue: number;\n}\n\nexport type DistributionBarSegmentUpdate = Partial<\n\tOmit<DistributionBarSegment, \"value\">\n> & {\n\tvalue?: never;\n};\n\nexport function getDistributionTotal(\n\tsegments: DistributionBarSegment[],\n): number {\n\treturn segments.reduce(\n\t\t(sum, segment) => sum + sanitizeValue(segment.value),\n\t\t0,\n\t);\n}\n\nexport function getDistributionBoundaryPercent(\n\tsegments: DistributionBarSegment[],\n\tboundaryIndex: number,\n): number {\n\tconst total = getDistributionTotal(segments);\n\tif (total <= 0) {\n\t\treturn 0;\n\t}\n\n\tconst boundaryValue = segments\n\t\t.slice(0, boundaryIndex + 1)\n\t\t.reduce((sum, segment) => sum + sanitizeValue(segment.value), 0);\n\treturn roundValue((boundaryValue / total) * 100);\n}\n\nexport function moveDistributionBoundary(\n\tsegments: DistributionBarSegment[],\n\tboundaryIndex: number,\n\tdeltaValue: number,\n\tminValue: number,\n): DistributionBarSegment[] {\n\tconst left = segments[boundaryIndex];\n\tconst right = segments[boundaryIndex + 1];\n\tif (!(left && right)) {\n\t\treturn segments;\n\t}\n\n\tconst pairTotal = sanitizeValue(left.value) + sanitizeValue(right.value);\n\tconst clampedMin = Math.max(0, Math.min(minValue, pairTotal / 2));\n\tconst nextLeft = clamp(\n\t\tsanitizeValue(left.value) + deltaValue,\n\t\tclampedMin,\n\t\tpairTotal - clampedMin,\n\t);\n\tconst nextRight = pairTotal - nextLeft;\n\n\treturn segments.map((segment, index) => {\n\t\tif (index === boundaryIndex) {\n\t\t\treturn { ...segment, value: roundValue(nextLeft) };\n\t\t}\n\t\tif (index === boundaryIndex + 1) {\n\t\t\treturn { ...segment, value: roundValue(nextRight) };\n\t\t}\n\t\treturn segment;\n\t});\n}\n\nexport function removeDistributionSegment(\n\tsegments: DistributionBarSegment[],\n\tsegmentId: string,\n): DistributionBarSegment[] {\n\tif (segments.length <= 1) {\n\t\treturn segments;\n\t}\n\n\tconst removed = segments.find((segment) => segment.id === segmentId);\n\tif (!removed) {\n\t\treturn segments;\n\t}\n\n\tconst remaining = segments.filter((segment) => segment.id !== segmentId);\n\tconst removedValue = sanitizeValue(removed.value);\n\tconst remainingTotal = getDistributionTotal(remaining);\n\tif (remainingTotal <= 0) {\n\t\tconst equalValue = removedValue / remaining.length;\n\t\treturn remaining.map((segment) => ({\n\t\t\t...segment,\n\t\t\tvalue: roundValue(equalValue),\n\t\t}));\n\t}\n\n\tlet assignedValue = 0;\n\tconst originalTotal = getDistributionTotal(segments);\n\treturn remaining.map((segment, index) => {\n\t\tif (index === remaining.length - 1) {\n\t\t\treturn { ...segment, value: roundValue(originalTotal - assignedValue) };\n\t\t}\n\n\t\tconst nextValue = roundValue(\n\t\t\tsanitizeValue(segment.value) +\n\t\t\t\t(removedValue * sanitizeValue(segment.value)) / remainingTotal,\n\t\t);\n\t\tassignedValue += nextValue;\n\t\treturn { ...segment, value: nextValue };\n\t});\n}\n\nexport function updateDistributionSegment(\n\tsegments: DistributionBarSegment[],\n\tsegmentId: string,\n\tupdate: DistributionBarSegmentUpdate,\n): DistributionBarSegment[] {\n\treturn segments.map((segment) =>\n\t\tsegment.id === segmentId ? { ...segment, ...update } : segment,\n\t);\n}\n\nfunction sanitizeValue(value: number): number {\n\treturn Number.isFinite(value) ? Math.max(0, value) : 0;\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n\treturn Math.min(Math.max(value, min), max);\n}\n\nfunction roundValue(value: number): number {\n\treturn Number(value.toFixed(1));\n}\n","import { joinClassNames } from \"@patternmode/system\";\nimport { motion, type PanInfo } from \"motion/react\";\nimport type { CSSProperties, HTMLAttributes, KeyboardEvent } from \"react\";\nimport { useRef } from \"react\";\n\nimport {\n\ttype DistributionBarSegment,\n\tgetDistributionBoundaryPercent,\n\tgetDistributionTotal,\n\tmoveDistributionBoundary,\n} from \"./DistributionBarMath\";\n\nexport interface DistributionDisplayProps\n\textends Omit<HTMLAttributes<HTMLDivElement>, \"role\" | \"onSelect\"> {\n\tassignedLabel?: string;\n\temptyLabel?: string;\n\temptyValue?: number;\n\tlegend?: \"segments\" | \"summary\" | false;\n\t/**\n\t * When provided, each segment renders as a button and selecting one\n\t * invokes this callback. Pair with `selectedSegmentId` to mark a segment\n\t * as selected (renders a ring). Read-only by default.\n\t */\n\tonSegmentSelect?: (segment: DistributionBarSegment) => void;\n\tsegments: DistributionBarSegment[];\n\t/** Id of the selected segment — renders a ring on that segment. */\n\tselectedSegmentId?: string;\n}\n\nexport interface DistributionBarProps\n\textends Omit<HTMLAttributes<HTMLFieldSetElement>, \"onChange\"> {\n\t/** Show the per-segment legend below the bar, or hide it. Default \"segments\". */\n\tlegend?: \"segments\" | false;\n\tminValue?: number;\n\tonChange?: (segments: DistributionBarSegment[]) => void;\n\tsegments: DistributionBarSegment[];\n\tstep?: number;\n}\n\nexport function DistributionDisplay({\n\t\"aria-label\": ariaLabel,\n\tassignedLabel = \"assigned\",\n\tclassName,\n\temptyLabel = \"unassigned\",\n\temptyValue = 0,\n\tlegend = \"segments\",\n\tonSegmentSelect,\n\tsegments,\n\tselectedSegmentId,\n\t...props\n}: DistributionDisplayProps) {\n\tconst total = getDistributionDisplayTotal(segments, emptyValue);\n\tconst interactive = Boolean(onSegmentSelect);\n\tconst accessibleLabel =\n\t\tariaLabel ??\n\t\tgetDistributionDisplayAccessibleLabel(\n\t\t\tsegments,\n\t\t\temptyValue,\n\t\t\temptyLabel,\n\t\t\ttotal,\n\t\t);\n\n\tconst content = (\n\t\t<>\n\t\t\t<div className=\"patternmode-distribution-bar__track\">\n\t\t\t\t<DistributionSegments\n\t\t\t\t\temptyValue={emptyValue}\n\t\t\t\t\tonSegmentSelect={onSegmentSelect}\n\t\t\t\t\tsegments={segments}\n\t\t\t\t\tselectedSegmentId={selectedSegmentId}\n\t\t\t\t\ttotal={total}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t{legend === \"segments\" ? (\n\t\t\t\t<DistributionSegmentLegend\n\t\t\t\t\temptyLabel={emptyLabel}\n\t\t\t\t\temptyValue={emptyValue}\n\t\t\t\t\tsegments={segments}\n\t\t\t\t\ttotal={total}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t\t{legend === \"summary\" ? (\n\t\t\t\t<DistributionSummaryLegend\n\t\t\t\t\tassignedLabel={assignedLabel}\n\t\t\t\t\temptyLabel={emptyLabel}\n\t\t\t\t\temptyValue={emptyValue}\n\t\t\t\t\ttotal={total}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t</>\n\t);\n\tconst sharedClassName = joinClassNames(\n\t\t\"patternmode-distribution-display\",\n\t\tclassName,\n\t);\n\n\t// A selectable distribution is a group of buttons (fieldset → implicit\n\t// group role); a read-only one is an image. Static elements (not a ternary\n\t// role on one node) so a11y lint can verify aria support.\n\treturn interactive ? (\n\t\t<fieldset\n\t\t\t{...(props as HTMLAttributes<HTMLFieldSetElement>)}\n\t\t\taria-label={accessibleLabel}\n\t\t\tclassName={sharedClassName}\n\t\t\tdata-slot=\"distribution-display\"\n\t\t>\n\t\t\t{content}\n\t\t</fieldset>\n\t) : (\n\t\t<div\n\t\t\t{...props}\n\t\t\taria-label={accessibleLabel}\n\t\t\tclassName={sharedClassName}\n\t\t\tdata-slot=\"distribution-display\"\n\t\t\trole=\"img\"\n\t\t>\n\t\t\t{content}\n\t\t</div>\n\t);\n}\n\nexport function DistributionBar({\n\t\"aria-label\": ariaLabel,\n\tclassName,\n\tlegend = \"segments\",\n\tminValue = 4,\n\tonChange,\n\tsegments,\n\tstep = 1,\n\t...props\n}: DistributionBarProps) {\n\tconst trackRef = useRef<HTMLDivElement>(null);\n\tconst dragStartSegmentsRef = useRef<DistributionBarSegment[] | null>(null);\n\tconst total = getDistributionTotal(segments);\n\n\tfunction moveBoundary(\n\t\tboundaryIndex: number,\n\t\tdeltaValue: number,\n\t\tsourceSegments = segments,\n\t) {\n\t\tonChange?.(\n\t\t\tmoveDistributionBoundary(\n\t\t\t\tsourceSegments,\n\t\t\t\tboundaryIndex,\n\t\t\t\tdeltaValue,\n\t\t\t\tminValue,\n\t\t\t),\n\t\t);\n\t}\n\n\tfunction handleDragStart() {\n\t\tdragStartSegmentsRef.current = segments;\n\t}\n\n\tfunction handleDrag(boundaryIndex: number, info: PanInfo) {\n\t\tconst sourceSegments = dragStartSegmentsRef.current ?? segments;\n\t\tconst sourceTotal = getDistributionTotal(sourceSegments);\n\t\tconst trackWidth = trackRef.current?.getBoundingClientRect().width ?? 0;\n\t\tif (!(trackWidth > 0 && sourceTotal > 0)) {\n\t\t\treturn;\n\t\t}\n\n\t\tmoveBoundary(\n\t\t\tboundaryIndex,\n\t\t\t(info.offset.x / trackWidth) * sourceTotal,\n\t\t\tsourceSegments,\n\t\t);\n\t}\n\n\tfunction handleDragEnd(boundaryIndex: number, info: PanInfo) {\n\t\thandleDrag(boundaryIndex, info);\n\t\tdragStartSegmentsRef.current = null;\n\t}\n\n\tfunction handleKeyDown(\n\t\tevent: KeyboardEvent<HTMLButtonElement>,\n\t\tboundaryIndex: number,\n\t) {\n\t\tif (event.key === \"ArrowLeft\") {\n\t\t\tevent.preventDefault();\n\t\t\tmoveBoundary(boundaryIndex, -step);\n\t\t}\n\t\tif (event.key === \"ArrowRight\") {\n\t\t\tevent.preventDefault();\n\t\t\tmoveBoundary(boundaryIndex, step);\n\t\t}\n\t}\n\n\treturn (\n\t\t<fieldset\n\t\t\t{...props}\n\t\t\taria-label={ariaLabel}\n\t\t\tclassName={joinClassNames(\"patternmode-distribution-bar\", className)}\n\t\t\tdata-slot=\"distribution-bar\"\n\t\t>\n\t\t\t<div className=\"patternmode-distribution-bar__track\" ref={trackRef}>\n\t\t\t\t<DistributionSegments segments={segments} total={total} />\n\t\t\t\t{segments.slice(0, -1).map((segment, boundaryIndex) => {\n\t\t\t\t\tconst nextSegment = segments[boundaryIndex + 1];\n\t\t\t\t\tconst boundaryPercent = getDistributionBoundaryPercent(\n\t\t\t\t\t\tsegments,\n\t\t\t\t\t\tboundaryIndex,\n\t\t\t\t\t);\n\t\t\t\t\tconst label = `Adjust ${segment.label ?? segment.id} and ${\n\t\t\t\t\t\tnextSegment?.label ?? nextSegment?.id\n\t\t\t\t\t} distribution`;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<DistributionBarHandle\n\t\t\t\t\t\t\taria-label={label}\n\t\t\t\t\t\t\tboundaryPercent={boundaryPercent}\n\t\t\t\t\t\t\tkey={`${segment.id}-${nextSegment?.id ?? \"end\"}`}\n\t\t\t\t\t\t\tonDrag={(info) => handleDrag(boundaryIndex, info)}\n\t\t\t\t\t\t\tonDragEnd={(info) => handleDragEnd(boundaryIndex, info)}\n\t\t\t\t\t\t\tonDragStart={handleDragStart}\n\t\t\t\t\t\t\tonKeyDown={(event) => handleKeyDown(event, boundaryIndex)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</div>\n\t\t\t{legend === \"segments\" ? (\n\t\t\t\t<DistributionSegmentLegend segments={segments} total={total} />\n\t\t\t) : null}\n\t\t</fieldset>\n\t);\n}\n\ninterface DistributionSegmentsProps {\n\temptyValue?: number;\n\tonSegmentSelect?: (segment: DistributionBarSegment) => void;\n\tsegments: DistributionBarSegment[];\n\tselectedSegmentId?: string;\n\ttotal: number;\n}\n\nfunction DistributionSegments({\n\temptyValue = 0,\n\tonSegmentSelect,\n\tsegments,\n\tselectedSegmentId,\n\ttotal,\n}: DistributionSegmentsProps) {\n\treturn (\n\t\t<div className=\"patternmode-distribution-bar__segments\">\n\t\t\t{segments.map((segment) => {\n\t\t\t\tconst segmentStyle = {\n\t\t\t\t\t\"--patternmode-distribution-segment-color\": segment.color,\n\t\t\t\t\twidth:\n\t\t\t\t\t\ttotal > 0\n\t\t\t\t\t\t\t? `${(getRenderableDistributionValue(segment.value) / total) * 100}%`\n\t\t\t\t\t\t\t: \"0%\",\n\t\t\t\t} as CSSProperties;\n\t\t\t\tconst isSelected = selectedSegmentId === segment.id;\n\n\t\t\t\tif (onSegmentSelect) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\taria-label={`${segment.label ?? segment.id} ${getDerivedDistributionPercentage(segment.value, total)}%`}\n\t\t\t\t\t\t\taria-pressed={isSelected}\n\t\t\t\t\t\t\tclassName=\"patternmode-distribution-bar__segment\"\n\t\t\t\t\t\t\tdata-selected={isSelected ? \"true\" : undefined}\n\t\t\t\t\t\t\tkey={segment.id}\n\t\t\t\t\t\t\tonClick={() => onSegmentSelect(segment)}\n\t\t\t\t\t\t\tstyle={segmentStyle}\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<div\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tclassName=\"patternmode-distribution-bar__segment\"\n\t\t\t\t\t\tdata-selected={isSelected ? \"true\" : undefined}\n\t\t\t\t\t\tkey={segment.id}\n\t\t\t\t\t\tstyle={segmentStyle}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t})}\n\t\t\t{emptyValue > 0 ? (\n\t\t\t\t<div\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tclassName=\"patternmode-distribution-bar__segment patternmode-distribution-bar__segment--empty\"\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\twidth:\n\t\t\t\t\t\t\ttotal > 0\n\t\t\t\t\t\t\t\t? `${(getRenderableDistributionValue(emptyValue) / total) * 100}%`\n\t\t\t\t\t\t\t\t: \"0%\",\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t</div>\n\t);\n}\n\ninterface DistributionSegmentLegendProps {\n\temptyLabel?: string;\n\temptyValue?: number;\n\tsegments: DistributionBarSegment[];\n\ttotal: number;\n}\n\nfunction DistributionSegmentLegend({\n\temptyLabel,\n\temptyValue = 0,\n\tsegments,\n\ttotal,\n}: DistributionSegmentLegendProps) {\n\treturn (\n\t\t<div className=\"patternmode-distribution-bar__legend\">\n\t\t\t{segments.map((segment) => (\n\t\t\t\t<span key={segment.id}>\n\t\t\t\t\t<span\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tclassName=\"patternmode-distribution-bar__swatch\"\n\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\"--patternmode-distribution-segment-color\": segment.color,\n\t\t\t\t\t\t\t} as CSSProperties\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t{segment.label ?? segment.id}{\" \"}\n\t\t\t\t\t{getDerivedDistributionPercentage(segment.value, total)}%\n\t\t\t\t</span>\n\t\t\t))}\n\t\t\t{emptyValue > 0 && emptyLabel ? (\n\t\t\t\t<span>\n\t\t\t\t\t<span\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tclassName=\"patternmode-distribution-bar__swatch patternmode-distribution-bar__swatch--empty\"\n\t\t\t\t\t/>\n\t\t\t\t\t{emptyLabel} {getDerivedDistributionPercentage(emptyValue, total)}%\n\t\t\t\t</span>\n\t\t\t) : null}\n\t\t</div>\n\t);\n}\n\ninterface DistributionSummaryLegendProps {\n\tassignedLabel: string;\n\temptyLabel: string;\n\temptyValue: number;\n\ttotal: number;\n}\n\nfunction DistributionSummaryLegend({\n\tassignedLabel,\n\temptyLabel,\n\temptyValue,\n\ttotal,\n}: DistributionSummaryLegendProps) {\n\tconst emptyPercentage = getDerivedDistributionPercentage(emptyValue, total);\n\n\treturn (\n\t\t<div className=\"patternmode-distribution-bar__legend\">\n\t\t\t<span>\n\t\t\t\t{Math.max(0, 100 - emptyPercentage)}% {assignedLabel}\n\t\t\t</span>\n\t\t\t{emptyValue > 0 ? (\n\t\t\t\t<span>\n\t\t\t\t\t{emptyPercentage}% {emptyLabel}\n\t\t\t\t</span>\n\t\t\t) : null}\n\t\t</div>\n\t);\n}\n\nfunction getDistributionDisplayTotal(\n\tsegments: DistributionBarSegment[],\n\temptyValue: number,\n): number {\n\treturn (\n\t\tgetDistributionTotal(segments) + getRenderableDistributionValue(emptyValue)\n\t);\n}\n\nfunction getDistributionDisplayAccessibleLabel(\n\tsegments: DistributionBarSegment[],\n\temptyValue: number,\n\temptyLabel: string,\n\ttotal: number,\n): string {\n\tconst segmentLabels = segments.map(\n\t\t(segment) =>\n\t\t\t`${segment.label ?? segment.id} ${getDerivedDistributionPercentage(\n\t\t\t\tsegment.value,\n\t\t\t\ttotal,\n\t\t\t)}%`,\n\t);\n\tif (emptyValue > 0) {\n\t\tsegmentLabels.push(\n\t\t\t`${emptyLabel} ${getDerivedDistributionPercentage(emptyValue, total)}%`,\n\t\t);\n\t}\n\n\treturn segmentLabels.join(\", \");\n}\n\nfunction getDerivedDistributionPercentage(\n\tvalue: number,\n\ttotal: number,\n): number {\n\tif (!(total > 0 && Number.isFinite(value))) {\n\t\treturn 0;\n\t}\n\n\treturn Math.round((Math.max(0, value) / total) * 100);\n}\n\nfunction getRenderableDistributionValue(value: number): number {\n\treturn Number.isFinite(value) ? Math.max(0, value) : 0;\n}\n\ninterface DistributionBarHandleProps {\n\t\"aria-label\": string;\n\tboundaryPercent: number;\n\tonDrag: (info: PanInfo) => void;\n\tonDragEnd: (info: PanInfo) => void;\n\tonDragStart: () => void;\n\tonKeyDown: (event: KeyboardEvent<HTMLButtonElement>) => void;\n}\n\nfunction DistributionBarHandle({\n\t\"aria-label\": ariaLabel,\n\tboundaryPercent,\n\tonDrag,\n\tonDragEnd,\n\tonDragStart,\n\tonKeyDown,\n}: DistributionBarHandleProps) {\n\treturn (\n\t\t<motion.button\n\t\t\taria-label={ariaLabel}\n\t\t\tclassName=\"patternmode-distribution-bar__handle\"\n\t\t\tdrag=\"x\"\n\t\t\tdragElastic={0}\n\t\t\tdragMomentum={false}\n\t\t\tdragSnapToOrigin\n\t\t\tonDrag={(_event, info) => onDrag(info)}\n\t\t\tonDragEnd={(_event, info) => onDragEnd(info)}\n\t\t\tonDragStart={onDragStart}\n\t\t\tonKeyDown={onKeyDown}\n\t\t\tstyle={{ left: `calc(${boundaryPercent}% - 1.375rem)` }}\n\t\t\ttransformTemplate={() => \"none\"}\n\t\t\ttype=\"button\"\n\t\t/>\n\t);\n}\n","import type { SwatchColorStop } from \"./SwatchTypes\";\n\nexport interface SwatchAtmosphereOptions {\n\t/** 0 = diffuse, wide wash · 1 = dense, tight pools. Default 0.5. */\n\tdensity?: number;\n\t/** -1 = grounds (pools sink) · 1 = lifts (pools rise). Default 0. */\n\tgravity?: number;\n}\n\n/**\n * Per-pool layout for the atmosphere fill:\n * `[focal x%, focal y%, base alpha (0-255), radius delta %, gravity sign]`.\n *\n * The first three entries reproduce the original three-pool blend identity\n * gradient exactly; further entries extend the pattern for palettes with\n * more than three colors.\n */\nconst POOLS: ReadonlyArray<readonly [number, number, number, number, number]> = [\n\t[30, 42, 0xcc, 0, -1],\n\t[72, 58, 0x99, -5, 1],\n\t[45, 65, 0x77, 8, -1],\n\t[62, 32, 0x66, 3, 1],\n\t[24, 72, 0x55, -3, -1],\n\t[80, 40, 0x44, 6, 1],\n];\n\n/**\n * Build a soft, layered radial \"atmosphere\" background from weighted color\n * stops — a stack of overlapping elliptical pools rather than a flat or linear\n * fill. Density controls how far each pool reaches; gravity shifts the pools\n * vertically. Returns `undefined` when there are no colors.\n */\nexport function getSwatchAtmosphereBackground(\n\tcolors: SwatchColorStop[] | undefined,\n\toptions: SwatchAtmosphereOptions = {},\n): string | undefined {\n\tif (!colors || colors.length === 0) {\n\t\treturn undefined;\n\t}\n\n\tconst density = clamp(options.density ?? 0.5, 0, 1);\n\tconst gravity = clamp(options.gravity ?? 0, -1, 1);\n\tconst gy = Math.round(gravity * 8);\n\tconst reach = Math.round(50 + (1 - density) * 15);\n\n\tconst layers = colors.map((stop, index) => {\n\t\tconst color = typeof stop === \"string\" ? stop : stop.color;\n\t\tconst pool = POOLS[index % POOLS.length] as (typeof POOLS)[number];\n\t\tconst [x, y, baseAlpha, radiusDelta, gravitySign] = pool;\n\t\t// Each wrap past the palette length fades the extra pools further back.\n\t\tconst cycle = Math.floor(index / POOLS.length);\n\t\tconst alpha = Math.max(0x22, baseAlpha - cycle * 0x22);\n\t\tconst focalY = clamp(y + gravitySign * gy, 0, 100);\n\t\tconst radius = Math.max(8, reach + radiusDelta);\n\t\treturn `radial-gradient(ellipse at ${x}% ${focalY}%, ${withAlpha(\n\t\t\tcolor,\n\t\t\talpha,\n\t\t)} 0%, transparent ${radius}%)`;\n\t});\n\n\treturn layers.join(\", \");\n}\n\nfunction withAlpha(color: string, alpha: number): string {\n\tconst hex = normalizeHex(color);\n\tif (hex) {\n\t\tconst suffix = Math.round(clamp(alpha, 0, 255))\n\t\t\t.toString(16)\n\t\t\t.padStart(2, \"0\");\n\t\treturn `#${hex}${suffix}`;\n\t}\n\tconst percent = Math.round((clamp(alpha, 0, 255) / 255) * 100);\n\treturn `color-mix(in srgb, ${color} ${percent}%, transparent)`;\n}\n\nfunction normalizeHex(color: string): string | null {\n\tconst value = color.trim().replace(/^#/, \"\");\n\tif (/^[\\da-f]{3}$/i.test(value)) {\n\t\treturn value\n\t\t\t.split(\"\")\n\t\t\t.map((part) => part + part)\n\t\t\t.join(\"\");\n\t}\n\tif (/^[\\da-f]{6}$/i.test(value)) {\n\t\treturn value;\n\t}\n\treturn null;\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n\treturn Math.min(max, Math.max(min, value));\n}\n","import type { SwatchColorStop } from \"./SwatchTypes\";\n\nexport function isLightColor(color: string): boolean {\n\tconst normalized = normalizeHex(color);\n\tif (!normalized) {\n\t\treturn false;\n\t}\n\n\tconst red = Number.parseInt(normalized.slice(0, 2), 16);\n\tconst green = Number.parseInt(normalized.slice(2, 4), 16);\n\tconst blue = Number.parseInt(normalized.slice(4, 6), 16);\n\tconst luminance = (0.299 * red + 0.587 * green + 0.114 * blue) / 255;\n\treturn luminance > 0.62;\n}\n\nexport function getSwatchColorsBackground(\n\tcolors: SwatchColorStop[] | undefined,\n): string | undefined {\n\tif (!colors || colors.length === 0) {\n\t\treturn undefined;\n\t}\n\n\tif (colors.length === 1) {\n\t\treturn toColorStop(colors[0] as SwatchColorStop).color;\n\t}\n\n\tconst stops = colors.map(toColorStop);\n\tconst weights = stops.map((stop) => getRatioWeight(stop.ratio));\n\tconst rawTotal = weights.reduce((sum, ratio) => sum + ratio, 0);\n\tconst useEqualWeights = rawTotal <= 0;\n\tconst total = useEqualWeights ? stops.length : rawTotal;\n\tlet cursor = 0;\n\tconst parts = stops.map((stop, index) => {\n\t\tconst ratio = useEqualWeights ? 1 : (weights[index] ?? 0);\n\t\tconst start = cursor;\n\t\tconst end =\n\t\t\tindex === stops.length - 1 ? 100 : cursor + (ratio / total) * 100;\n\t\tcursor = end;\n\t\treturn `${stop.color} ${formatPercent(start)} ${formatPercent(end)}`;\n\t});\n\n\treturn `linear-gradient(90deg, ${parts.join(\", \")})`;\n}\n\nfunction normalizeHex(hex: string): string | null {\n\tconst value = hex.trim().replace(/^#/, \"\");\n\tif (/^[\\da-f]{3}$/i.test(value)) {\n\t\treturn value\n\t\t\t.split(\"\")\n\t\t\t.map((part) => part + part)\n\t\t\t.join(\"\");\n\t}\n\tif (/^[\\da-f]{6}$/i.test(value)) {\n\t\treturn value;\n\t}\n\treturn null;\n}\n\nfunction toColorStop(stop: SwatchColorStop): { color: string; ratio?: number } {\n\treturn typeof stop === \"string\" ? { color: stop } : stop;\n}\n\nfunction getRatioWeight(ratio: number | undefined): number {\n\tif (ratio === undefined) {\n\t\treturn 1;\n\t}\n\n\treturn Number.isFinite(ratio) ? Math.max(0, ratio) : 0;\n}\n\nfunction formatPercent(value: number): string {\n\treturn `${Number.isInteger(value) ? value : Number(value.toFixed(2))}%`;\n}\n","import {\n\ttype ObjectFit,\n\tPATTERNMODE_SIZE_VALUES,\n\tPATTERNMODE_SIZES,\n} from \"@patternmode/system\";\nimport type { ComponentType, HTMLAttributes, SVGProps } from \"react\";\n\nexport const SWATCH_SIZES = [\n\t...PATTERNMODE_SIZES,\n\t\"4xl\",\n\t\"5xl\",\n\t\"6xl\",\n\t\"7xl\",\n] as const;\n\nexport const SWATCH_SIZE_VALUES = {\n\t...PATTERNMODE_SIZE_VALUES,\n\t\"4xl\": \"4.5rem\",\n\t\"5xl\": \"5rem\",\n\t\"6xl\": \"5.5rem\",\n\t\"7xl\": \"6rem\",\n} as const satisfies Record<SwatchSize, string>;\n\nexport const SWATCH_SHAPES = [\"circle\", \"pill\", \"square\", \"block\"] as const;\n\nexport const SWATCH_TEXTURES = [\"atmosphere\"] as const;\n\nexport type SwatchSize = (typeof SWATCH_SIZES)[number];\nexport type SwatchShape = (typeof SWATCH_SHAPES)[number];\nexport type SwatchTexture = (typeof SWATCH_TEXTURES)[number];\nexport type SwatchColorStop = string | { color: string; ratio?: number };\ntype SwatchIcon = ComponentType<SVGProps<SVGSVGElement>>;\n\nexport function getSwatchSizeVariableStyle(\n\tsize: SwatchSize,\n\tvariableName = \"--patternmode-swatch-size\",\n): Record<string, string> {\n\treturn {\n\t\t[variableName]: SWATCH_SIZE_VALUES[size],\n\t};\n}\n\nexport interface SwatchProps extends HTMLAttributes<HTMLElement> {\n\tbackground?: string;\n\tcolor?: string;\n\tcolors?: SwatchColorStop[];\n\t/**\n\t * Atmosphere density (0 = diffuse wash, 1 = dense pools). Only applies when\n\t * `texture=\"atmosphere\"`. Default 0.5.\n\t */\n\tdensity?: number;\n\t/**\n\t * Render a precise, flat color block: no top-to-bottom scrim gradient and\n\t * no drop shadow. Use for data visualisation where the fill must read as\n\t * the exact color value.\n\t */\n\tflat?: boolean;\n\t/**\n\t * Atmosphere gravity (-1 = pools sink, 1 = pools rise). Only applies when\n\t * `texture=\"atmosphere\"`. Default 0.\n\t */\n\tgravity?: number;\n\ticon?: SwatchIcon;\n\tisLight?: boolean;\n\tobjectFit?: ObjectFit;\n\tobjectPosition?: string;\n\tonRemove?: () => void;\n\traised?: boolean;\n\tremoveLabel?: string;\n\tselected?: boolean;\n\tshape?: SwatchShape;\n\tshowRing?: boolean;\n\tsize?: SwatchSize;\n\t/**\n\t * Render `colors` as a soft, layered radial atmosphere — overlapping color\n\t * pools — instead of the default linear gradient. Pair with `density` and\n\t * `gravity` to shape the pools.\n\t */\n\ttexture?: SwatchTexture;\n\tunavailable?: boolean;\n}\n","import { getObjectSizingStyle, joinClassNames } from \"@patternmode/system\";\nimport type { CSSProperties, MouseEvent } from \"react\";\n\nimport { getSwatchAtmosphereBackground } from \"./SwatchAtmosphere\";\nimport { getSwatchColorsBackground, isLightColor } from \"./SwatchColors\";\nimport { getSwatchSizeVariableStyle, type SwatchProps } from \"./SwatchTypes\";\n\nexport function Swatch({\n\t\"aria-label\": ariaLabel,\n\tbackground,\n\tchildren,\n\tclassName,\n\tcolor,\n\tcolors,\n\tdensity,\n\tflat = false,\n\tgravity,\n\ticon: Icon,\n\tisLight,\n\tobjectFit,\n\tobjectPosition,\n\tonRemove,\n\traised = false,\n\tremoveLabel,\n\trole: _role,\n\tselected = false,\n\tshape = \"circle\",\n\tshowRing = true,\n\tsize = \"base\",\n\tstyle,\n\ttexture,\n\tunavailable = false,\n\t...props\n}: SwatchProps) {\n\tconst colorsBackground = getSwatchColorsBackground(colors);\n\tconst atmosphereBackground =\n\t\ttexture === \"atmosphere\"\n\t\t\t? getSwatchAtmosphereBackground(colors, { density, gravity })\n\t\t\t: undefined;\n\tconst fill = background ?? atmosphereBackground ?? colorsBackground ?? color;\n\tconst light =\n\t\tisLight ??\n\t\t(color && !background && !colorsBackground\n\t\t\t? isLightColor(color as string)\n\t\t\t: false);\n\tconst resolvedRemoveLabel =\n\t\tremoveLabel ?? (ariaLabel ? `Remove ${ariaLabel}` : \"Remove\");\n\n\tconst rootStyle = {\n\t\t...getSwatchSizeVariableStyle(size),\n\t\t\"--patternmode-swatch-fill\": fill,\n\t\t...style,\n\t} as CSSProperties;\n\tconst mediaStyle = getObjectSizingStyle({\n\t\tfit: objectFit,\n\t\tposition: objectPosition,\n\t}) as CSSProperties;\n\n\tfunction handleRemove(event: MouseEvent<HTMLButtonElement>) {\n\t\tevent.stopPropagation();\n\t\tonRemove?.();\n\t}\n\n\tconst swatchContent = (\n\t\t<>\n\t\t\t<span aria-hidden=\"true\" className=\"patternmode-swatch__fill\" />\n\t\t\t{children ? (\n\t\t\t\t<span className=\"patternmode-swatch__media\" style={mediaStyle}>\n\t\t\t\t\t{children}\n\t\t\t\t</span>\n\t\t\t) : null}\n\t\t\t{flat ? null : (\n\t\t\t\t<span aria-hidden=\"true\" className=\"patternmode-swatch__scrim\" />\n\t\t\t)}\n\t\t\t{selected && Icon ? (\n\t\t\t\t<span className=\"patternmode-swatch__icon\">\n\t\t\t\t\t<Icon aria-hidden=\"true\" focusable=\"false\" />\n\t\t\t\t</span>\n\t\t\t) : null}\n\t\t\t{unavailable ? (\n\t\t\t\t<span aria-hidden=\"true\" className=\"patternmode-swatch__slash\" />\n\t\t\t) : null}\n\t\t</>\n\t);\n\n\tif (onRemove) {\n\t\treturn (\n\t\t\t<fieldset\n\t\t\t\t{...props}\n\t\t\t\taria-label={ariaLabel}\n\t\t\t\tclassName={joinClassNames(\"patternmode-swatch\", className)}\n\t\t\t\tdata-flat={flat ? \"true\" : undefined}\n\t\t\t\tdata-raised={raised ? \"true\" : undefined}\n\t\t\t\tdata-selected={selected ? \"true\" : undefined}\n\t\t\t\tdata-shape={shape}\n\t\t\t\tdata-show-ring={showRing ? \"true\" : \"false\"}\n\t\t\t\tdata-size={size}\n\t\t\t\tdata-slot=\"swatch\"\n\t\t\t\tdata-tone={light ? \"light\" : \"dark\"}\n\t\t\t\tdata-unavailable={unavailable ? \"true\" : undefined}\n\t\t\t\tstyle={rootStyle}\n\t\t\t>\n\t\t\t\t{swatchContent}\n\t\t\t\t<button\n\t\t\t\t\taria-label={resolvedRemoveLabel}\n\t\t\t\t\tclassName=\"patternmode-swatch__remove\"\n\t\t\t\t\tonClick={handleRemove}\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t>\n\t\t\t\t\t<svg aria-hidden=\"true\" fill=\"none\" viewBox=\"0 0 20 20\">\n\t\t\t\t\t\t<path d=\"M5.5 5.5l9 9M14.5 5.5l-9 9\" />\n\t\t\t\t\t</svg>\n\t\t\t\t</button>\n\t\t\t</fieldset>\n\t\t);\n\t}\n\n\treturn (\n\t\t<span\n\t\t\t{...props}\n\t\t\taria-label={ariaLabel}\n\t\t\tclassName={joinClassNames(\"patternmode-swatch\", className)}\n\t\t\tdata-flat={flat ? \"true\" : undefined}\n\t\t\tdata-raised={raised ? \"true\" : undefined}\n\t\t\tdata-selected={selected ? \"true\" : undefined}\n\t\t\tdata-shape={shape}\n\t\t\tdata-show-ring={showRing ? \"true\" : \"false\"}\n\t\t\tdata-size={size}\n\t\t\tdata-slot=\"swatch\"\n\t\t\tdata-tone={light ? \"light\" : \"dark\"}\n\t\t\tdata-unavailable={unavailable ? \"true\" : undefined}\n\t\t\trole=\"img\"\n\t\t\tstyle={rootStyle}\n\t\t>\n\t\t\t{swatchContent}\n\t\t</span>\n\t);\n}\n"],"mappings":";;;;;AAaA,SAAgB,qBACf,UACS;CACT,OAAO,SAAS,QACd,KAAK,YAAY,MAAM,cAAc,QAAQ,KAAK,GACnD,CACD;AACD;AAEA,SAAgB,+BACf,UACA,eACS;CACT,MAAM,QAAQ,qBAAqB,QAAQ;CAC3C,IAAI,SAAS,GACZ,OAAO;CAMR,OAAO,WAHe,SACpB,MAAM,GAAG,gBAAgB,CAAC,EAC1B,QAAQ,KAAK,YAAY,MAAM,cAAc,QAAQ,KAAK,GAAG,CAChC,IAAI,QAAS,GAAG;AAChD;AAEA,SAAgB,yBACf,UACA,eACA,YACA,UAC2B;CAC3B,MAAM,OAAO,SAAS;CACtB,MAAM,QAAQ,SAAS,gBAAgB;CACvC,IAAI,EAAE,QAAQ,QACb,OAAO;CAGR,MAAM,YAAY,cAAc,KAAK,KAAK,IAAI,cAAc,MAAM,KAAK;CACvE,MAAM,aAAa,KAAK,IAAI,GAAG,KAAK,IAAI,UAAU,YAAY,CAAC,CAAC;CAChE,MAAM,WAAWA,QAChB,cAAc,KAAK,KAAK,IAAI,YAC5B,YACA,YAAY,UACb;CACA,MAAM,YAAY,YAAY;CAE9B,OAAO,SAAS,KAAK,SAAS,UAAU;EACvC,IAAI,UAAU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AAC,YAAD;EACC,GAAI;EACJ,cAAY;EACZ,WAAW,eAAe,sBAAsB,SAAS;EACzD,aAAW,OAAO,SAAS,KAAA;EAC3B,eAAa,SAAS,SAAS,KAAA;EAC/B,iBAAe,WAAW,SAAS,KAAA;EACnC,cAAY;EACZ,kBAAgB,WAAW,SAAS;EACpC,aAAW;EACX,aAAU;EACV,aAAW,QAAQ,UAAU;EAC7B,oBAAkB,cAAc,SAAS,KAAA;EACzC,OAAO;YAbR,CAeE,eACD,oBAAC,UAAD;GACC,cAAY;GACZ,WAAU;GACV,SAAS;GACT,MAAK;aAEL,oBAAC,OAAD;IAAK,eAAY;IAAO,MAAK;IAAO,SAAQ;cAC3C,oBAAC,QAAD,EAAM,GAAE,6BAA8B,CAAA;GAClC,CAAA;EACE,CAAA,CACC;;CAIZ,OACC,oBAAC,QAAD;EACC,GAAI;EACJ,cAAY;EACZ,WAAW,eAAe,sBAAsB,SAAS;EACzD,aAAW,OAAO,SAAS,KAAA;EAC3B,eAAa,SAAS,SAAS,KAAA;EAC/B,iBAAe,WAAW,SAAS,KAAA;EACnC,cAAY;EACZ,kBAAgB,WAAW,SAAS;EACpC,aAAW;EACX,aAAU;EACV,aAAW,QAAQ,UAAU;EAC7B,oBAAkB,cAAc,SAAS,KAAA;EACzC,MAAK;EACL,OAAO;YAEN;CACI,CAAA;AAER"}
1
+ {"version":3,"file":"index.mjs","names":["clamp","normalizeHex"],"sources":["../src/DistributionBar/DistributionBarMath.ts","../src/DistributionBar/DistributionBarRoot.tsx","../src/Swatch/SwatchAtmosphere.ts","../src/Swatch/SwatchColors.ts","../src/Swatch/SwatchTypes.ts","../src/Swatch/SwatchRoot.tsx"],"sourcesContent":["export interface DistributionBarSegment {\n color: string;\n id: string;\n label?: string;\n value: number;\n}\n\nexport type DistributionBarSegmentUpdate = Partial<\n Omit<DistributionBarSegment, \"value\">\n> & {\n value?: never;\n};\n\nexport function getDistributionTotal(\n segments: DistributionBarSegment[]\n): number {\n return segments.reduce(\n (sum, segment) => sum + sanitizeValue(segment.value),\n 0\n );\n}\n\nexport function getDistributionBoundaryPercent(\n segments: DistributionBarSegment[],\n boundaryIndex: number\n): number {\n const total = getDistributionTotal(segments);\n if (total <= 0) {\n return 0;\n }\n\n const boundaryValue = segments\n .slice(0, boundaryIndex + 1)\n .reduce((sum, segment) => sum + sanitizeValue(segment.value), 0);\n return roundValue((boundaryValue / total) * 100);\n}\n\nexport function moveDistributionBoundary(\n segments: DistributionBarSegment[],\n boundaryIndex: number,\n deltaValue: number,\n minValue: number\n): DistributionBarSegment[] {\n const left = segments[boundaryIndex];\n const right = segments[boundaryIndex + 1];\n if (!(left && right)) {\n return segments;\n }\n\n const pairTotal = sanitizeValue(left.value) + sanitizeValue(right.value);\n const clampedMin = Math.max(0, Math.min(minValue, pairTotal / 2));\n const nextLeft = clamp(\n sanitizeValue(left.value) + deltaValue,\n clampedMin,\n pairTotal - clampedMin\n );\n const nextRight = pairTotal - nextLeft;\n\n return segments.map((segment, index) => {\n if (index === boundaryIndex) {\n return { ...segment, value: roundValue(nextLeft) };\n }\n if (index === boundaryIndex + 1) {\n return { ...segment, value: roundValue(nextRight) };\n }\n return segment;\n });\n}\n\nexport function removeDistributionSegment(\n segments: DistributionBarSegment[],\n segmentId: string\n): DistributionBarSegment[] {\n if (segments.length <= 1) {\n return segments;\n }\n\n const removed = segments.find((segment) => segment.id === segmentId);\n if (!removed) {\n return segments;\n }\n\n const remaining = segments.filter((segment) => segment.id !== segmentId);\n const removedValue = sanitizeValue(removed.value);\n const remainingTotal = getDistributionTotal(remaining);\n if (remainingTotal <= 0) {\n const equalValue = removedValue / remaining.length;\n return remaining.map((segment) => ({\n ...segment,\n value: roundValue(equalValue),\n }));\n }\n\n let assignedValue = 0;\n const originalTotal = getDistributionTotal(segments);\n return remaining.map((segment, index) => {\n if (index === remaining.length - 1) {\n return { ...segment, value: roundValue(originalTotal - assignedValue) };\n }\n\n const nextValue = roundValue(\n sanitizeValue(segment.value) +\n (removedValue * sanitizeValue(segment.value)) / remainingTotal\n );\n assignedValue += nextValue;\n return { ...segment, value: nextValue };\n });\n}\n\nexport function updateDistributionSegment(\n segments: DistributionBarSegment[],\n segmentId: string,\n update: DistributionBarSegmentUpdate\n): DistributionBarSegment[] {\n return segments.map((segment) =>\n segment.id === segmentId ? { ...segment, ...update } : segment\n );\n}\n\nfunction sanitizeValue(value: number): number {\n return Number.isFinite(value) ? Math.max(0, value) : 0;\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n\nfunction roundValue(value: number): number {\n return Number(value.toFixed(1));\n}\n","import { joinClassNames } from \"@patternmode/system\";\nimport { domMax, LazyMotion, m, type PanInfo } from \"motion/react\";\nimport type { CSSProperties, HTMLAttributes, KeyboardEvent } from \"react\";\nimport { useRef } from \"react\";\n\nimport {\n type DistributionBarSegment,\n getDistributionBoundaryPercent,\n getDistributionTotal,\n moveDistributionBoundary,\n} from \"./DistributionBarMath\";\n\nexport interface DistributionDisplayProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n \"role\" | \"onSelect\"\n> {\n assignedLabel?: string;\n emptyLabel?: string;\n emptyValue?: number;\n legend?: \"segments\" | \"summary\" | false;\n /**\n * When provided, each segment renders as a button and selecting one\n * invokes this callback. Pair with `selectedSegmentId` to mark a segment\n * as selected (renders a ring). Read-only by default.\n */\n onSegmentSelect?: (segment: DistributionBarSegment) => void;\n segments: DistributionBarSegment[];\n /** Id of the selected segment — renders a ring on that segment. */\n selectedSegmentId?: string;\n}\n\nexport interface DistributionBarProps extends Omit<\n HTMLAttributes<HTMLFieldSetElement>,\n \"onChange\"\n> {\n /** Show the per-segment legend below the bar, or hide it. Default \"segments\". */\n legend?: \"segments\" | false;\n minValue?: number;\n onChange?: (segments: DistributionBarSegment[]) => void;\n segments: DistributionBarSegment[];\n step?: number;\n}\n\nexport function DistributionDisplay({\n \"aria-label\": ariaLabel,\n assignedLabel = \"assigned\",\n className,\n emptyLabel = \"unassigned\",\n emptyValue = 0,\n legend = \"segments\",\n onSegmentSelect,\n segments,\n selectedSegmentId,\n ...props\n}: DistributionDisplayProps) {\n const total = getDistributionDisplayTotal(segments, emptyValue);\n const interactive = Boolean(onSegmentSelect);\n const accessibleLabel =\n ariaLabel ??\n getDistributionDisplayAccessibleLabel(\n segments,\n emptyValue,\n emptyLabel,\n total\n );\n\n const content = (\n <>\n <div className=\"patternmode-distribution-bar__track\">\n <DistributionSegments\n emptyValue={emptyValue}\n onSegmentSelect={onSegmentSelect}\n segments={segments}\n selectedSegmentId={selectedSegmentId}\n total={total}\n />\n </div>\n {legend === \"segments\" ? (\n <DistributionSegmentLegend\n emptyLabel={emptyLabel}\n emptyValue={emptyValue}\n segments={segments}\n total={total}\n />\n ) : null}\n {legend === \"summary\" ? (\n <DistributionSummaryLegend\n assignedLabel={assignedLabel}\n emptyLabel={emptyLabel}\n emptyValue={emptyValue}\n total={total}\n />\n ) : null}\n </>\n );\n const sharedClassName = joinClassNames(\n \"patternmode-distribution-display\",\n className\n );\n\n // A selectable distribution is a group of buttons (fieldset → implicit\n // group role); a read-only one keeps the label on the display wrapper.\n return interactive ? (\n <fieldset\n {...(props as HTMLAttributes<HTMLFieldSetElement>)}\n aria-label={accessibleLabel}\n className={sharedClassName}\n data-slot=\"distribution-display\"\n >\n {content}\n </fieldset>\n ) : (\n <figure\n {...props}\n aria-label={accessibleLabel}\n className={sharedClassName}\n data-slot=\"distribution-display\"\n >\n {content}\n </figure>\n );\n}\n\nexport function DistributionBar({\n \"aria-label\": ariaLabel,\n className,\n legend = \"segments\",\n minValue = 4,\n onChange,\n segments,\n step = 1,\n ...props\n}: DistributionBarProps) {\n const trackRef = useRef<HTMLDivElement>(null);\n const dragStartSegmentsRef = useRef<DistributionBarSegment[] | null>(null);\n const total = getDistributionTotal(segments);\n\n function moveBoundary(\n boundaryIndex: number,\n deltaValue: number,\n sourceSegments = segments\n ) {\n onChange?.(\n moveDistributionBoundary(\n sourceSegments,\n boundaryIndex,\n deltaValue,\n minValue\n )\n );\n }\n\n function handleDragStart() {\n dragStartSegmentsRef.current = segments;\n }\n\n function handleDrag(boundaryIndex: number, info: PanInfo) {\n const sourceSegments = dragStartSegmentsRef.current ?? segments;\n const sourceTotal = getDistributionTotal(sourceSegments);\n const trackWidth = trackRef.current?.getBoundingClientRect().width ?? 0;\n if (!(trackWidth > 0 && sourceTotal > 0)) {\n return;\n }\n\n moveBoundary(\n boundaryIndex,\n (info.offset.x / trackWidth) * sourceTotal,\n sourceSegments\n );\n }\n\n function handleDragEnd(boundaryIndex: number, info: PanInfo) {\n handleDrag(boundaryIndex, info);\n dragStartSegmentsRef.current = null;\n }\n\n function handleKeyDown(\n event: KeyboardEvent<HTMLButtonElement>,\n boundaryIndex: number\n ) {\n if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n moveBoundary(boundaryIndex, -step);\n }\n if (event.key === \"ArrowRight\") {\n event.preventDefault();\n moveBoundary(boundaryIndex, step);\n }\n }\n\n return (\n <fieldset\n {...props}\n aria-label={ariaLabel}\n className={joinClassNames(\"patternmode-distribution-bar\", className)}\n data-slot=\"distribution-bar\"\n >\n <div className=\"patternmode-distribution-bar__track\" ref={trackRef}>\n <DistributionSegments segments={segments} total={total} />\n {segments.slice(0, -1).map((segment, boundaryIndex) => {\n const nextSegment = segments[boundaryIndex + 1];\n const boundaryPercent = getDistributionBoundaryPercent(\n segments,\n boundaryIndex\n );\n const label = `Adjust ${segment.label ?? segment.id} and ${\n nextSegment?.label ?? nextSegment?.id\n } distribution`;\n return (\n <DistributionBarHandle\n aria-label={label}\n boundaryPercent={boundaryPercent}\n key={`${segment.id}-${nextSegment?.id ?? \"end\"}`}\n onDrag={(info) => handleDrag(boundaryIndex, info)}\n onDragEnd={(info) => handleDragEnd(boundaryIndex, info)}\n onDragStart={handleDragStart}\n onKeyDown={(event) => handleKeyDown(event, boundaryIndex)}\n />\n );\n })}\n </div>\n {legend === \"segments\" ? (\n <DistributionSegmentLegend segments={segments} total={total} />\n ) : null}\n </fieldset>\n );\n}\n\ninterface DistributionSegmentsProps {\n emptyValue?: number;\n onSegmentSelect?: (segment: DistributionBarSegment) => void;\n segments: DistributionBarSegment[];\n selectedSegmentId?: string;\n total: number;\n}\n\nfunction DistributionSegments({\n emptyValue = 0,\n onSegmentSelect,\n segments,\n selectedSegmentId,\n total,\n}: DistributionSegmentsProps) {\n return (\n <div className=\"patternmode-distribution-bar__segments\">\n {segments.map((segment) => {\n const segmentStyle = {\n \"--patternmode-distribution-segment-color\": segment.color,\n width:\n total > 0\n ? `${(getRenderableDistributionValue(segment.value) / total) * 100}%`\n : \"0%\",\n } as CSSProperties;\n const isSelected = selectedSegmentId === segment.id;\n\n if (onSegmentSelect) {\n return (\n <button\n aria-label={`${segment.label ?? segment.id} ${getDerivedDistributionPercentage(segment.value, total)}%`}\n aria-pressed={isSelected}\n className=\"patternmode-distribution-bar__segment\"\n data-selected={isSelected ? \"true\" : undefined}\n key={segment.id}\n onClick={() => onSegmentSelect(segment)}\n style={segmentStyle}\n type=\"button\"\n />\n );\n }\n\n return (\n <div\n aria-hidden=\"true\"\n className=\"patternmode-distribution-bar__segment\"\n data-selected={isSelected ? \"true\" : undefined}\n key={segment.id}\n style={segmentStyle}\n />\n );\n })}\n {emptyValue > 0 ? (\n <div\n aria-hidden=\"true\"\n className=\"patternmode-distribution-bar__segment patternmode-distribution-bar__segment--empty\"\n style={{\n width:\n total > 0\n ? `${(getRenderableDistributionValue(emptyValue) / total) * 100}%`\n : \"0%\",\n }}\n />\n ) : null}\n </div>\n );\n}\n\ninterface DistributionSegmentLegendProps {\n emptyLabel?: string;\n emptyValue?: number;\n segments: DistributionBarSegment[];\n total: number;\n}\n\nfunction DistributionSegmentLegend({\n emptyLabel,\n emptyValue = 0,\n segments,\n total,\n}: DistributionSegmentLegendProps) {\n return (\n <div className=\"patternmode-distribution-bar__legend\">\n {segments.map((segment) => (\n <span key={segment.id}>\n <span\n aria-hidden=\"true\"\n className=\"patternmode-distribution-bar__swatch\"\n style={\n {\n \"--patternmode-distribution-segment-color\": segment.color,\n } as CSSProperties\n }\n />\n {segment.label ?? segment.id}{\" \"}\n {getDerivedDistributionPercentage(segment.value, total)}%\n </span>\n ))}\n {emptyValue > 0 && emptyLabel ? (\n <span>\n <span\n aria-hidden=\"true\"\n className=\"patternmode-distribution-bar__swatch patternmode-distribution-bar__swatch--empty\"\n />\n {emptyLabel} {getDerivedDistributionPercentage(emptyValue, total)}%\n </span>\n ) : null}\n </div>\n );\n}\n\ninterface DistributionSummaryLegendProps {\n assignedLabel: string;\n emptyLabel: string;\n emptyValue: number;\n total: number;\n}\n\nfunction DistributionSummaryLegend({\n assignedLabel,\n emptyLabel,\n emptyValue,\n total,\n}: DistributionSummaryLegendProps) {\n const emptyPercentage = getDerivedDistributionPercentage(emptyValue, total);\n\n return (\n <div className=\"patternmode-distribution-bar__legend\">\n <span>\n {Math.max(0, 100 - emptyPercentage)}% {assignedLabel}\n </span>\n {emptyValue > 0 ? (\n <span>\n {emptyPercentage}% {emptyLabel}\n </span>\n ) : null}\n </div>\n );\n}\n\nfunction getDistributionDisplayTotal(\n segments: DistributionBarSegment[],\n emptyValue: number\n): number {\n return (\n getDistributionTotal(segments) + getRenderableDistributionValue(emptyValue)\n );\n}\n\nfunction getDistributionDisplayAccessibleLabel(\n segments: DistributionBarSegment[],\n emptyValue: number,\n emptyLabel: string,\n total: number\n): string {\n const segmentLabels = segments.map(\n (segment) =>\n `${segment.label ?? segment.id} ${getDerivedDistributionPercentage(\n segment.value,\n total\n )}%`\n );\n if (emptyValue > 0) {\n segmentLabels.push(\n `${emptyLabel} ${getDerivedDistributionPercentage(emptyValue, total)}%`\n );\n }\n\n return segmentLabels.join(\", \");\n}\n\nfunction getDerivedDistributionPercentage(\n value: number,\n total: number\n): number {\n if (!(total > 0 && Number.isFinite(value))) {\n return 0;\n }\n\n return Math.round((Math.max(0, value) / total) * 100);\n}\n\nfunction getRenderableDistributionValue(value: number): number {\n return Number.isFinite(value) ? Math.max(0, value) : 0;\n}\n\ninterface DistributionBarHandleProps {\n \"aria-label\": string;\n boundaryPercent: number;\n onDrag: (info: PanInfo) => void;\n onDragEnd: (info: PanInfo) => void;\n onDragStart: () => void;\n onKeyDown: (event: KeyboardEvent<HTMLButtonElement>) => void;\n}\n\nfunction DistributionBarHandle({\n \"aria-label\": ariaLabel,\n boundaryPercent,\n onDrag,\n onDragEnd,\n onDragStart,\n onKeyDown,\n}: DistributionBarHandleProps) {\n return (\n <LazyMotion features={domMax}>\n <m.button\n aria-label={ariaLabel}\n className=\"patternmode-distribution-bar__handle\"\n drag=\"x\"\n dragElastic={0}\n dragMomentum={false}\n dragSnapToOrigin\n onDrag={(_event, info) => onDrag(info)}\n onDragEnd={(_event, info) => onDragEnd(info)}\n onDragStart={onDragStart}\n onKeyDown={onKeyDown}\n style={{ left: `calc(${boundaryPercent}% - 1.375rem)` }}\n transformTemplate={() => \"none\"}\n type=\"button\"\n />\n </LazyMotion>\n );\n}\n","import type { SwatchColorStop } from \"./SwatchTypes\";\n\nexport interface SwatchAtmosphereOptions {\n /** 0 = diffuse, wide wash · 1 = dense, tight pools. Default 0.5. */\n density?: number;\n /** -1 = grounds (pools sink) · 1 = lifts (pools rise). Default 0. */\n gravity?: number;\n}\n\n/**\n * Per-pool layout for the atmosphere fill:\n * `[focal x%, focal y%, base alpha (0-255), radius delta %, gravity sign]`.\n *\n * The first three entries reproduce the original three-pool blend identity\n * gradient exactly; further entries extend the pattern for palettes with\n * more than three colors.\n */\nconst POOLS: readonly (readonly [number, number, number, number, number])[] = [\n [30, 42, 0xcc, 0, -1],\n [72, 58, 0x99, -5, 1],\n [45, 65, 0x77, 8, -1],\n [62, 32, 0x66, 3, 1],\n [24, 72, 0x55, -3, -1],\n [80, 40, 0x44, 6, 1],\n];\n\n/**\n * Build a soft, layered radial \"atmosphere\" background from color stops — a\n * stack of overlapping elliptical pools rather than a flat or linear fill.\n * Density controls how far each pool reaches; gravity shifts the pools\n * vertically. Returns `undefined` when there are no colors.\n */\nexport function getSwatchAtmosphereBackground(\n colors: SwatchColorStop[] | undefined,\n options: SwatchAtmosphereOptions = {}\n): string | undefined {\n if (!colors || colors.length === 0) {\n return undefined;\n }\n\n const density = clamp(options.density ?? 0.5, 0, 1);\n const gravity = clamp(options.gravity ?? 0, -1, 1);\n const gy = Math.round(gravity * 8);\n const reach = Math.round(50 + (1 - density) * 15);\n\n const layers = colors.map((stop, index) => {\n const color = typeof stop === \"string\" ? stop : stop.color;\n const pool = POOLS[index % POOLS.length] as (typeof POOLS)[number];\n const [x, y, baseAlpha, radiusDelta, gravitySign] = pool;\n // Each wrap past the palette length fades the extra pools further back.\n const cycle = Math.floor(index / POOLS.length);\n const alpha = Math.max(0x22, baseAlpha - cycle * 0x22);\n const focalY = clamp(y + gravitySign * gy, 0, 100);\n const radius = Math.max(8, reach + radiusDelta);\n return `radial-gradient(ellipse at ${x}% ${focalY}%, ${withAlpha(\n color,\n alpha\n )} 0%, transparent ${radius}%)`;\n });\n\n return layers.join(\", \");\n}\n\nfunction withAlpha(color: string, alpha: number): string {\n const hex = normalizeHex(color);\n if (hex) {\n const suffix = Math.round(clamp(alpha, 0, 255))\n .toString(16)\n .padStart(2, \"0\");\n return `#${hex}${suffix}`;\n }\n const percent = Math.round((clamp(alpha, 0, 255) / 255) * 100);\n return `color-mix(in srgb, ${color} ${percent}%, transparent)`;\n}\n\nfunction normalizeHex(color: string): string | null {\n const value = color.trim().replace(/^#/, \"\");\n if (/^[\\da-f]{3}$/i.test(value)) {\n return [...value].map((part) => part + part).join(\"\");\n }\n if (/^[\\da-f]{6}$/i.test(value)) {\n return value;\n }\n return null;\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(max, Math.max(min, value));\n}\n","import type { SwatchColorStop } from \"./SwatchTypes\";\n\nexport function isLightColor(color: string): boolean {\n const normalized = normalizeHex(color);\n if (!normalized) {\n return false;\n }\n\n const red = Number.parseInt(normalized.slice(0, 2), 16);\n const green = Number.parseInt(normalized.slice(2, 4), 16);\n const blue = Number.parseInt(normalized.slice(4, 6), 16);\n const luminance = (0.299 * red + 0.587 * green + 0.114 * blue) / 255;\n return luminance > 0.62;\n}\n\nexport function getSwatchColorsBackground(\n colors: SwatchColorStop[] | undefined\n): string | undefined {\n if (!colors || colors.length === 0) {\n return undefined;\n }\n\n if (colors.length === 1) {\n return toColorStop(colors[0] as SwatchColorStop).color;\n }\n\n const stops = colors.map(toColorStop);\n const weights = stops.map((stop) => getRatioWeight(stop.ratio));\n const rawTotal = weights.reduce((sum, ratio) => sum + ratio, 0);\n const useEqualWeights = rawTotal <= 0;\n const total = useEqualWeights ? stops.length : rawTotal;\n let cursor = 0;\n const parts = stops.map((stop, index) => {\n const ratio = useEqualWeights ? 1 : (weights[index] ?? 0);\n const start = cursor;\n const end =\n index === stops.length - 1 ? 100 : cursor + (ratio / total) * 100;\n cursor = end;\n return `${stop.color} ${formatPercent(start)} ${formatPercent(end)}`;\n });\n\n return `linear-gradient(90deg, ${parts.join(\", \")})`;\n}\n\nfunction normalizeHex(hex: string): string | null {\n const value = hex.trim().replace(/^#/, \"\");\n if (/^[\\da-f]{3}$/i.test(value)) {\n return [...value].map((part) => part + part).join(\"\");\n }\n if (/^[\\da-f]{6}$/i.test(value)) {\n return value;\n }\n return null;\n}\n\nfunction toColorStop(stop: SwatchColorStop): { color: string; ratio?: number } {\n return typeof stop === \"string\" ? { color: stop } : stop;\n}\n\nfunction getRatioWeight(ratio: number | undefined): number {\n if (ratio === undefined) {\n return 1;\n }\n\n return Number.isFinite(ratio) ? Math.max(0, ratio) : 0;\n}\n\nfunction formatPercent(value: number): string {\n return `${Number.isInteger(value) ? value : Number(value.toFixed(2))}%`;\n}\n","import {\n type ObjectFit,\n PATTERNMODE_SIZE_VALUES,\n PATTERNMODE_SIZES,\n} from \"@patternmode/system\";\nimport type { ComponentType, HTMLAttributes, SVGProps } from \"react\";\n\nexport const SWATCH_SIZES = [\n ...PATTERNMODE_SIZES,\n \"4xl\",\n \"5xl\",\n \"6xl\",\n \"7xl\",\n] as const;\n\nexport const SWATCH_SIZE_VALUES = {\n ...PATTERNMODE_SIZE_VALUES,\n \"4xl\": \"4.5rem\",\n \"5xl\": \"5rem\",\n \"6xl\": \"5.5rem\",\n \"7xl\": \"6rem\",\n} as const satisfies Record<SwatchSize, string>;\n\nexport const SWATCH_SHAPES = [\"circle\", \"pill\", \"square\", \"block\"] as const;\n\nexport const SWATCH_TEXTURES = [\"atmosphere\"] as const;\n\nexport type SwatchSize = (typeof SWATCH_SIZES)[number];\nexport type SwatchShape = (typeof SWATCH_SHAPES)[number];\nexport type SwatchTexture = (typeof SWATCH_TEXTURES)[number];\nexport type SwatchColorStop = string | { color: string; ratio?: number };\ntype SwatchIcon = ComponentType<SVGProps<SVGSVGElement>>;\n\nexport function getSwatchSizeVariableStyle(\n size: SwatchSize,\n variableName = \"--patternmode-swatch-size\"\n): Record<string, string> {\n return {\n [variableName]: SWATCH_SIZE_VALUES[size],\n };\n}\n\nexport interface SwatchProps extends HTMLAttributes<HTMLElement> {\n background?: string;\n color?: string;\n colors?: SwatchColorStop[];\n /**\n * Atmosphere density (0 = diffuse wash, 1 = dense pools). Only applies when\n * `texture=\"atmosphere\"`. Default 0.5.\n */\n density?: number;\n /**\n * Render a precise, flat color block: no top-to-bottom scrim gradient and\n * no drop shadow. Use for data visualisation where the fill must read as\n * the exact color value.\n */\n flat?: boolean;\n /**\n * Atmosphere gravity (-1 = pools sink, 1 = pools rise). Only applies when\n * `texture=\"atmosphere\"`. Default 0.\n */\n gravity?: number;\n icon?: SwatchIcon;\n isLight?: boolean;\n objectFit?: ObjectFit;\n objectPosition?: string;\n onRemove?: () => void;\n raised?: boolean;\n removeLabel?: string;\n selected?: boolean;\n shape?: SwatchShape;\n showRing?: boolean;\n size?: SwatchSize;\n /**\n * Render supplied colors as a soft, layered radial atmosphere — overlapping\n * color pools — instead of a ratio-encoded weighted palette. Pair with\n * `density` and `gravity` to shape the pools.\n */\n texture?: SwatchTexture;\n unavailable?: boolean;\n}\n","import { getObjectSizingStyle, joinClassNames } from \"@patternmode/system\";\nimport type { CSSProperties, MouseEvent } from \"react\";\n\nimport { getSwatchAtmosphereBackground } from \"./SwatchAtmosphere\";\nimport { getSwatchColorsBackground, isLightColor } from \"./SwatchColors\";\nimport { getSwatchSizeVariableStyle, type SwatchProps } from \"./SwatchTypes\";\n\nexport function Swatch({\n \"aria-label\": ariaLabel,\n background,\n children,\n className,\n color,\n colors,\n density,\n flat = false,\n gravity,\n icon: Icon,\n isLight,\n objectFit,\n objectPosition,\n onRemove,\n raised = false,\n removeLabel,\n role: _role,\n selected = false,\n shape = \"circle\",\n showRing = true,\n size = \"base\",\n style,\n texture,\n unavailable = false,\n ...props\n}: SwatchProps) {\n const colorsBackground = getSwatchColorsBackground(colors);\n const atmosphereBackground =\n texture === \"atmosphere\"\n ? getSwatchAtmosphereBackground(colors, { density, gravity })\n : undefined;\n const fill = background ?? atmosphereBackground ?? colorsBackground ?? color;\n const light =\n isLight ??\n (color && !background && !colorsBackground\n ? isLightColor(color as string)\n : false);\n const resolvedRemoveLabel =\n removeLabel ?? (ariaLabel ? `Remove ${ariaLabel}` : \"Remove\");\n\n const rootStyle = {\n ...getSwatchSizeVariableStyle(size),\n \"--patternmode-swatch-fill\": fill,\n ...style,\n } as CSSProperties;\n const mediaStyle = getObjectSizingStyle({\n fit: objectFit,\n position: objectPosition,\n }) as CSSProperties;\n\n function handleRemove(event: MouseEvent<HTMLButtonElement>) {\n event.stopPropagation();\n onRemove?.();\n }\n\n const swatchContent = (\n <>\n <span aria-hidden=\"true\" className=\"patternmode-swatch__fill\" />\n {children ? (\n <span className=\"patternmode-swatch__media\" style={mediaStyle}>\n {children}\n </span>\n ) : null}\n {flat ? null : (\n <span aria-hidden=\"true\" className=\"patternmode-swatch__scrim\" />\n )}\n {selected && Icon ? (\n <span className=\"patternmode-swatch__icon\">\n <Icon aria-hidden=\"true\" focusable=\"false\" />\n </span>\n ) : null}\n {unavailable ? (\n <span aria-hidden=\"true\" className=\"patternmode-swatch__slash\" />\n ) : null}\n </>\n );\n\n if (onRemove) {\n return (\n <fieldset\n {...props}\n aria-label={ariaLabel}\n className={joinClassNames(\"patternmode-swatch\", className)}\n data-flat={flat ? \"true\" : undefined}\n data-raised={raised ? \"true\" : undefined}\n data-selected={selected ? \"true\" : undefined}\n data-shape={shape}\n data-show-ring={showRing ? \"true\" : \"false\"}\n data-size={size}\n data-slot=\"swatch\"\n data-tone={light ? \"light\" : \"dark\"}\n data-unavailable={unavailable ? \"true\" : undefined}\n style={rootStyle}\n >\n {swatchContent}\n <button\n aria-label={resolvedRemoveLabel}\n className=\"patternmode-swatch__remove\"\n onClick={handleRemove}\n type=\"button\"\n >\n <svg aria-hidden=\"true\" fill=\"none\" viewBox=\"0 0 20 20\">\n <path d=\"M5.5 5.5l9 9M14.5 5.5l-9 9\" />\n </svg>\n </button>\n </fieldset>\n );\n }\n\n return (\n <figure\n {...props}\n aria-label={ariaLabel}\n className={joinClassNames(\"patternmode-swatch\", className)}\n data-flat={flat ? \"true\" : undefined}\n data-raised={raised ? \"true\" : undefined}\n data-selected={selected ? \"true\" : undefined}\n data-shape={shape}\n data-show-ring={showRing ? \"true\" : \"false\"}\n data-size={size}\n data-slot=\"swatch\"\n data-tone={light ? \"light\" : \"dark\"}\n data-unavailable={unavailable ? \"true\" : undefined}\n style={rootStyle}\n >\n {swatchContent}\n </figure>\n );\n}\n"],"mappings":";;;;;AAaA,SAAgB,qBACd,UACQ;CACR,OAAO,SAAS,QACb,KAAK,YAAY,MAAM,cAAc,QAAQ,KAAK,GACnD,CACF;AACF;AAEA,SAAgB,+BACd,UACA,eACQ;CACR,MAAM,QAAQ,qBAAqB,QAAQ;CAC3C,IAAI,SAAS,GACX,OAAO;CAMT,OAAO,WAHe,SACnB,MAAM,GAAG,gBAAgB,CAAC,EAC1B,QAAQ,KAAK,YAAY,MAAM,cAAc,QAAQ,KAAK,GAAG,CACjC,IAAI,QAAS,GAAG;AACjD;AAEA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AAkB,cAAc,SAAS,KAAA;EACzC,OAAO;YAEN;CACK,CAAA;AAEZ"}
package/dist/styles.css CHANGED
@@ -1 +1 @@
1
- @layer components{.patternmode-swatch{--patternmode-swatch-size:2rem;--patternmode-swatch-fill:#e3e1dc;--patternmode-swatch-radius:999px;aspect-ratio:1;border-radius:var(--patternmode-swatch-radius);color:#fff;height:var(--patternmode-swatch-size);vertical-align:middle;min-inline-size:0;width:var(--patternmode-swatch-size);border:0;justify-content:center;align-items:center;margin:0;padding:0;transition:box-shadow .14s,opacity .14s,transform .14s;display:inline-flex;position:relative;box-shadow:0 1px 2px #1118271a}.patternmode-swatch[data-tone=light]{color:#1d1d1b}.patternmode-swatch[data-shape=pill]{--patternmode-swatch-radius:999px;aspect-ratio:auto;width:calc(var(--patternmode-swatch-size) * 3)}.patternmode-swatch[data-shape=square]{--patternmode-swatch-radius:7px}.patternmode-swatch[data-shape=block]{--patternmode-swatch-radius:.25rem;aspect-ratio:auto;width:100%;height:100%;display:block}.patternmode-swatch[data-raised=true]{box-shadow:0 1px 2px #1118271a, 0 0 0 2px var(--surface,#fff)}.patternmode-swatch[data-selected=true][data-show-ring=true]{box-shadow:0 1px 2px #1118271a, 0 0 0 2px var(--surface,#fff), 0 0 0 4px var(--accent,#315c4b)}.patternmode-swatch[data-unavailable=true]{opacity:.5}.patternmode-swatch[data-flat=true]{box-shadow:none}.patternmode-swatch__fill,.patternmode-swatch__media,.patternmode-swatch__scrim{border-radius:inherit;position:absolute;inset:0;overflow:hidden}.patternmode-swatch__fill{background:var(--patternmode-swatch-fill)}.patternmode-swatch__media>*{object-fit:inherit;object-position:inherit;width:100%;height:100%;display:block}.patternmode-swatch__scrim{pointer-events:none;background:linear-gradient(#0000 0%,#0003 100%)}.patternmode-swatch__icon{justify-content:center;align-items:center;display:inline-flex;position:absolute;inset:0}.patternmode-swatch__icon svg{stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:2.4px;width:48%;height:48%;display:block}.patternmode-swatch__slash{background:currentColor;border-radius:999px;width:112%;height:2px;position:absolute;transform:rotate(-45deg)}.patternmode-swatch__remove{color:var(--surface,#fff);cursor:pointer;opacity:0;background:0 0;border:0;border-radius:999px;justify-content:center;align-items:center;width:2.75rem;height:2.75rem;padding:0;transition:opacity .14s;display:inline-flex;position:absolute;top:-1.1rem;right:-1.1rem}.patternmode-swatch__remove:before{background:var(--ink,#1d1d1b);border-radius:inherit;content:"";width:1.25rem;height:1.25rem;transition:background .14s;position:absolute}.patternmode-swatch__remove:focus-visible{opacity:1}@media (hover:hover){.patternmode-swatch:hover .patternmode-swatch__remove{opacity:1}.patternmode-swatch__remove:hover:before{background:var(--accent,#315c4b)}}.patternmode-swatch__remove:focus-visible{outline:2px solid var(--accent,#315c4b);outline-offset:2px}.patternmode-swatch__remove svg{stroke:currentColor;stroke-linecap:round;stroke-width:2px;z-index:1;width:.8rem;height:.8rem}@media (prefers-reduced-motion:reduce){.patternmode-swatch,.patternmode-swatch__remove,.patternmode-swatch__remove:before{transition:none}}.patternmode-distribution-bar,.patternmode-distribution-display{min-inline-size:0;border:0;gap:10px;width:100%;margin:0;padding:0;display:grid}.patternmode-distribution-bar__track{height:var(--patternmode-distribution-height,40px);width:100%;position:relative}.patternmode-distribution-bar .patternmode-distribution-bar__track{touch-action:none}.patternmode-distribution-bar__segments{border:1px solid var(--border-soft,#1118271f);border-radius:var(--patternmode-distribution-radius,999px);width:100%;height:100%;display:flex;overflow:hidden}.patternmode-distribution-bar__segment{background:var(--patternmode-distribution-segment-color);border:0;min-width:0;height:100%;margin:0;padding:0;transition:width .48s cubic-bezier(.2,0,0,1)}button.patternmode-distribution-bar__segment{cursor:pointer}button.patternmode-distribution-bar__segment:focus-visible{outline:2px solid var(--accent,#315c4b);outline-offset:-2px;z-index:2}.patternmode-distribution-bar__segment[data-selected=true]{box-shadow:inset 0 0 0 2px var(--accent,#315c4b);z-index:2}@media (prefers-reduced-motion:reduce){.patternmode-distribution-bar__segment{transition:none}}.patternmode-distribution-bar__segment--empty{background-color:var(--surface-soft,#f7f5f0);background-image:repeating-linear-gradient(45deg, transparent, transparent 3px, var(--border-soft,#1118271f) 3px, var(--border-soft,#1118271f) 4px)}.patternmode-distribution-bar__segment+.patternmode-distribution-bar__segment{box-shadow:inset 1px 0 #fff9}.patternmode-distribution-bar__handle{cursor:ew-resize;z-index:1;background:0 0;border:0;border-radius:999px;justify-content:center;align-items:center;width:2.75rem;height:2.75rem;padding:0;display:inline-flex;position:absolute;top:calc(50% - 1.375rem)}.patternmode-distribution-bar__handle:before{background:var(--surface,#fff);content:"";border-radius:999px;width:.62rem;height:.62rem;transition:box-shadow .12s,transform .12s;box-shadow:0 1px 4px #1118272e,0 0 0 1px #11182733}.patternmode-distribution-bar__handle:focus-visible{outline:2px solid var(--accent,#315c4b);outline-offset:-4px}@media (hover:hover){.patternmode-distribution-bar__handle:hover:before{transform:scale(1.15);box-shadow:0 5px 14px #1118274d,0 0 0 1px #11182738}}.patternmode-distribution-bar__legend{flex-wrap:wrap;gap:8px 14px;display:flex}.patternmode-distribution-bar__legend>span{color:var(--muted,#595853);align-items:center;gap:6px;font-size:.68rem;font-weight:500;display:inline-flex}.patternmode-distribution-bar__swatch{background:var(--patternmode-distribution-segment-color);border-radius:999px;width:.55rem;height:.55rem;display:inline-flex}.patternmode-distribution-bar__swatch--empty{background-color:var(--surface-soft,#f7f5f0);background-image:repeating-linear-gradient(45deg, transparent, transparent 2px, var(--border-soft,#1118271f) 2px, var(--border-soft,#1118271f) 3px);box-shadow:inset 0 0 0 1px var(--border-soft,#1118271f)}@media (prefers-reduced-motion:reduce){.patternmode-distribution-bar__handle:before{transition:none}}}
1
+ @layer components{.patternmode-swatch{--patternmode-swatch-size:2rem;--patternmode-swatch-fill:#e3e1dc;--patternmode-swatch-radius:999px;aspect-ratio:1;border-radius:var(--patternmode-swatch-radius);color:#fff;height:var(--patternmode-swatch-size);vertical-align:middle;min-inline-size:0;width:var(--patternmode-swatch-size);border:0;justify-content:center;align-items:center;margin:0;padding:0;transition:box-shadow .14s,opacity .14s,transform .14s;display:inline-flex;position:relative;box-shadow:0 1px 2px #1118271a}.patternmode-swatch[data-tone=light]{color:#1d1d1b}.patternmode-swatch[data-shape=pill]{--patternmode-swatch-radius:999px;aspect-ratio:auto;width:calc(var(--patternmode-swatch-size) * 3)}.patternmode-swatch[data-shape=square]{--patternmode-swatch-radius:7px}.patternmode-swatch[data-shape=block]{--patternmode-swatch-radius:.25rem;aspect-ratio:auto;width:100%;height:100%;display:block}.patternmode-swatch[data-raised=true]{box-shadow:0 1px 2px #1118271a, 0 0 0 2px var(--surface,#fff)}.patternmode-swatch[data-selected=true][data-show-ring=true]{box-shadow:0 1px 2px #1118271a, 0 0 0 2px var(--surface,#fff), 0 0 0 4px var(--accent,#315c4b)}.patternmode-swatch[data-unavailable=true]{opacity:.5}.patternmode-swatch[data-flat=true]{box-shadow:none}.patternmode-swatch__fill,.patternmode-swatch__media,.patternmode-swatch__scrim{border-radius:inherit;position:absolute;inset:0;overflow:hidden}.patternmode-swatch__fill{background:var(--patternmode-swatch-fill)}.patternmode-swatch__media>*{object-fit:inherit;object-position:inherit;width:100%;height:100%;display:block}.patternmode-swatch__scrim{pointer-events:none;background:linear-gradient(#0000 0%,#0003 100%)}.patternmode-swatch__icon{justify-content:center;align-items:center;display:inline-flex;position:absolute;inset:0}.patternmode-swatch__icon svg{stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:2.4px;width:48%;height:48%;display:block}.patternmode-swatch__slash{background:currentColor;border-radius:999px;width:112%;height:2px;position:absolute;transform:rotate(-45deg)}.patternmode-swatch__remove{color:var(--surface,#fff);cursor:pointer;opacity:0;background:0 0;border:0;border-radius:999px;justify-content:center;align-items:center;width:2.75rem;height:2.75rem;padding:0;transition:opacity .14s;display:inline-flex;position:absolute;top:-1.1rem;right:-1.1rem}.patternmode-swatch__remove:before{background:var(--ink,#1d1d1b);border-radius:inherit;content:"";width:1.25rem;height:1.25rem;transition:background .14s;position:absolute}.patternmode-swatch__remove:focus-visible{opacity:1}@media (hover:hover){.patternmode-swatch:hover .patternmode-swatch__remove{opacity:1}.patternmode-swatch__remove:hover:before{background:var(--accent,#315c4b)}}.patternmode-swatch__remove:focus-visible{outline:2px solid var(--accent,#315c4b);outline-offset:2px}.patternmode-swatch__remove svg{stroke:currentColor;stroke-linecap:round;stroke-width:2px;z-index:1;width:.8rem;height:.8rem}@media (prefers-reduced-motion:reduce){.patternmode-swatch,.patternmode-swatch__remove,.patternmode-swatch__remove:before{transition:none}}.patternmode-distribution-bar,.patternmode-distribution-display{min-inline-size:0;border:0;gap:10px;width:100%;margin:0;padding:0;display:grid}.patternmode-distribution-bar__track{height:var(--patternmode-distribution-height,40px);width:100%;position:relative}.patternmode-distribution-bar .patternmode-distribution-bar__track{touch-action:none}.patternmode-distribution-bar__segments{border:1px solid var(--border-soft,#1118271f);border-radius:var(--patternmode-distribution-radius,999px);width:100%;height:100%;display:flex;overflow:hidden}.patternmode-distribution-bar__segment{background:var(--patternmode-distribution-segment-color);border:0;min-width:0;height:100%;margin:0;padding:0;transition:width .48s cubic-bezier(.2,0,0,1)}button.patternmode-distribution-bar__segment{cursor:pointer}button.patternmode-distribution-bar__segment:focus-visible{outline:2px solid var(--accent,#315c4b);outline-offset:-2px;z-index:2}.patternmode-distribution-bar__segment+.patternmode-distribution-bar__segment{box-shadow:inset 1px 0 #fff9}.patternmode-distribution-bar__segment[data-selected=true]{box-shadow:inset 0 0 0 2px var(--accent,#315c4b);z-index:2}@media (prefers-reduced-motion:reduce){.patternmode-distribution-bar__segment{transition:none}}.patternmode-distribution-bar__segment--empty{background-color:var(--surface-soft,#f7f5f0);background-image:repeating-linear-gradient(45deg, transparent, transparent 3px, var(--border-soft,#1118271f) 3px, var(--border-soft,#1118271f) 4px)}.patternmode-distribution-bar__handle{cursor:ew-resize;z-index:1;background:0 0;border:0;border-radius:999px;justify-content:center;align-items:center;width:2.75rem;height:2.75rem;padding:0;display:inline-flex;position:absolute;top:calc(50% - 1.375rem)}.patternmode-distribution-bar__handle:before{background:var(--surface,#fff);content:"";border-radius:999px;width:.62rem;height:.62rem;transition:box-shadow .12s,transform .12s;box-shadow:0 1px 4px #1118272e,0 0 0 1px #11182733}.patternmode-distribution-bar__handle:focus-visible{outline:2px solid var(--accent,#315c4b);outline-offset:-4px}@media (hover:hover){.patternmode-distribution-bar__handle:hover:before{transform:scale(1.15);box-shadow:0 5px 14px #1118274d,0 0 0 1px #11182738}}.patternmode-distribution-bar__legend{flex-wrap:wrap;gap:8px 14px;display:flex}.patternmode-distribution-bar__legend>span{color:var(--muted,#595853);align-items:center;gap:6px;font-size:.68rem;font-weight:500;display:inline-flex}.patternmode-distribution-bar__swatch{background:var(--patternmode-distribution-segment-color);border-radius:999px;width:.55rem;height:.55rem;display:inline-flex}.patternmode-distribution-bar__swatch--empty{background-color:var(--surface-soft,#f7f5f0);background-image:repeating-linear-gradient(45deg, transparent, transparent 2px, var(--border-soft,#1118271f) 2px, var(--border-soft,#1118271f) 3px);box-shadow:inset 0 0 0 1px var(--border-soft,#1118271f)}@media (prefers-reduced-motion:reduce){.patternmode-distribution-bar__handle:before{transition:none}}}
@@ -1 +1 @@
1
- {"version":3,"file":"swatch.d.ts","sourceRoot":"","sources":["../src/swatch.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,mBAAmB,EACnB,KAAK,wBAAwB,EAC7B,8BAA8B,EAC9B,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,GACzB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,6BAA6B,EAC7B,KAAK,uBAAuB,GAC5B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACN,0BAA0B,EAC1B,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,GAClB,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"swatch.d.ts","sourceRoot":"","sources":["../src/swatch.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,mBAAmB,EACnB,KAAK,wBAAwB,EAC7B,8BAA8B,EAC9B,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,6BAA6B,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,0BAA0B,EAC1B,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,GACnB,MAAM,sBAAsB,CAAC"}
package/package.json CHANGED
@@ -1,12 +1,20 @@
1
1
  {
2
2
  "name": "@patternmode/swatch",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "private": false,
5
5
  "description": "Color, gradient, image, and palette swatch primitives for Patternmode interfaces.",
6
- "type": "module",
7
- "sideEffects": [
8
- "**/*.css"
6
+ "keywords": [
7
+ "color",
8
+ "component",
9
+ "palette",
10
+ "patternmode",
11
+ "react",
12
+ "swatch"
9
13
  ],
14
+ "homepage": "https://github.com/howells/patternmode/tree/main/packages/swatch#readme",
15
+ "bugs": {
16
+ "url": "https://github.com/howells/patternmode/issues"
17
+ },
10
18
  "license": "MIT",
11
19
  "author": "Daniel Howells",
12
20
  "repository": {
@@ -14,13 +22,13 @@
14
22
  "url": "git+ssh://git@github.com/howells/patternmode.git",
15
23
  "directory": "packages/swatch"
16
24
  },
17
- "bugs": {
18
- "url": "https://github.com/howells/patternmode/issues"
19
- },
20
- "homepage": "https://github.com/howells/patternmode/tree/main/packages/swatch#readme",
21
25
  "files": [
22
26
  "dist"
23
27
  ],
28
+ "type": "module",
29
+ "sideEffects": [
30
+ "**/*.css"
31
+ ],
24
32
  "exports": {
25
33
  ".": {
26
34
  "types": "./dist/index.d.ts",
@@ -32,27 +40,12 @@
32
40
  "publishConfig": {
33
41
  "access": "public"
34
42
  },
35
- "engines": {
36
- "node": ">=20"
37
- },
38
- "keywords": [
39
- "swatch",
40
- "palette",
41
- "color",
42
- "react",
43
- "component",
44
- "patternmode"
45
- ],
46
43
  "dependencies": {
47
44
  "motion": "^12.38.0",
48
- "@patternmode/system": "0.2.0"
49
- },
50
- "peerDependencies": {
51
- "react": "^18.0.0 || ^19.0.0",
52
- "react-dom": "^18.0.0 || ^19.0.0"
45
+ "@patternmode/system": "0.2.2"
53
46
  },
54
47
  "devDependencies": {
55
- "@howells/lint": "^0.1.7",
48
+ "@howells/lint": "^0.2.0",
56
49
  "@howells/typescript-config": "^0.1.2",
57
50
  "@tailwindcss/cli": "^4.3.0",
58
51
  "@testing-library/jest-dom": "^6.9.1",
@@ -62,11 +55,20 @@
62
55
  "@types/react-dom": "^19.2.3",
63
56
  "concurrently": "^9.2.1",
64
57
  "jsdom": "^29.1.1",
58
+ "react": "^19.2.3",
59
+ "react-dom": "^19.2.3",
65
60
  "tailwindcss": "^4.3.0",
66
61
  "tsdown": "^0.22.0",
67
62
  "typescript": "^6.0.3",
68
63
  "vitest": "^4.1.6"
69
64
  },
65
+ "peerDependencies": {
66
+ "react": "^18.0.0 || ^19.0.0",
67
+ "react-dom": "^18.0.0 || ^19.0.0"
68
+ },
69
+ "engines": {
70
+ "node": ">=20"
71
+ },
70
72
  "scripts": {
71
73
  "build": "tsdown && tsc --emitDeclarationOnly --declaration --declarationMap --outDir dist --noEmit false && pnpm build:styles",
72
74
  "build:styles": "tailwindcss -i ./src/styles.css -o ./dist/styles.css --minify",
@@ -75,7 +77,8 @@
75
77
  "dev:js": "tsdown --watch",
76
78
  "dev:styles": "tailwindcss -i ./src/styles.css -o ./dist/styles.css --watch",
77
79
  "dev:types": "tsc --emitDeclarationOnly --declaration --declarationMap --outDir dist --noEmit false --watch --preserveWatchOutput",
78
- "lint:check": "find src -type f \\( -name '*.ts' -o -name '*.tsx' \\) -print0 | xargs -0 howells-biome check",
80
+ "lint": "howells-ox-check .",
81
+ "lint:fix": "howells-ox-fix .",
79
82
  "test": "vitest run",
80
83
  "typecheck": "tsc --noEmit"
81
84
  }
@@ -1,6 +0,0 @@
1
- export { DistributionBar, type DistributionBarProps, type DistributionBarSegment, type DistributionBarSegmentUpdate, DistributionDisplay, type DistributionDisplayProps, getDistributionBoundaryPercent, getDistributionTotal, moveDistributionBoundary, removeDistributionSegment, updateDistributionSegment, } from "../DistributionBar";
2
- export { getSwatchAtmosphereBackground, type SwatchAtmosphereOptions, } from "./SwatchAtmosphere";
3
- export { getSwatchColorsBackground } from "./SwatchColors";
4
- export { Swatch } from "./SwatchRoot";
5
- export { getSwatchSizeVariableStyle, SWATCH_SHAPES, SWATCH_SIZE_VALUES, SWATCH_SIZES, SWATCH_TEXTURES, type SwatchColorStop, type SwatchProps, type SwatchShape, type SwatchSize, type SwatchTexture, } from "./SwatchTypes";
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Swatch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,mBAAmB,EACnB,KAAK,wBAAwB,EAC7B,8BAA8B,EAC9B,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,EACzB,yBAAyB,GACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,6BAA6B,EAC7B,KAAK,uBAAuB,GAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EACN,0BAA0B,EAC1B,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,aAAa,GAClB,MAAM,eAAe,CAAC"}