@pathscale/ui 2.10.0 → 2.11.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.
@@ -3,6 +3,12 @@
3
3
  align-items: flex-start;
4
4
  gap: 1rem;
5
5
  padding: 0.875rem;
6
+ /*
7
+ * Named, so the `auto` rules below measure this component rather than the
8
+ * window. The wheel usually sits in a side panel, and a panel narrow enough
9
+ * to need stacking is common on a wide screen.
10
+ */
11
+ container: complex-color-wheel / inline-size;
6
12
  }
7
13
 
8
14
  .complex-color-wheel__adjustments {
@@ -13,6 +19,49 @@
13
19
  gap: 0.875rem;
14
20
  }
15
21
 
22
+ /* Stacked: the wheel above, every axis in one column under it. */
23
+ .complex-color-wheel--layout-stacked {
24
+ flex-direction: column;
25
+ align-items: stretch;
26
+ }
27
+
28
+ /*
29
+ * Beside: the rows sit next to the wheel and pack two to a line. `auto-fit`
30
+ * rather than a fixed two, so the last row spans the full width instead of
31
+ * leaving a hole, and a container too narrow for two columns gets one.
32
+ */
33
+ .complex-color-wheel--layout-beside .complex-color-wheel__adjustments {
34
+ display: grid;
35
+ grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
36
+ gap: 0.875rem 1.25rem;
37
+ align-content: start;
38
+ }
39
+
40
+ /* The action sits alone on its own line above the axes it resets. */
41
+ .complex-color-wheel--layout-beside .complex-color-wheel__action {
42
+ grid-column: 1 / -1;
43
+ }
44
+
45
+ @container complex-color-wheel (min-width: 30rem) {
46
+ .complex-color-wheel--layout-auto .complex-color-wheel__adjustments {
47
+ display: grid;
48
+ grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
49
+ gap: 0.875rem 1.25rem;
50
+ align-content: start;
51
+ }
52
+
53
+ .complex-color-wheel--layout-auto .complex-color-wheel__action {
54
+ grid-column: 1 / -1;
55
+ }
56
+ }
57
+
58
+ @container complex-color-wheel (max-width: 30rem) {
59
+ .complex-color-wheel--layout-auto {
60
+ flex-direction: column;
61
+ align-items: stretch;
62
+ }
63
+ }
64
+
16
65
  .complex-color-wheel__action {
17
66
  display: flex;
18
67
  justify-content: flex-end;
@@ -27,5 +27,14 @@ export interface ComplexColorWheelProps extends ColorWheelProps {
27
27
  material?: CardMaterial;
28
28
  action?: JSX.Element;
29
29
  adjustmentsClass?: string;
30
+ /**
31
+ * Where the axes sit: `beside` the wheel and two to a line, `stacked` in one
32
+ * column under it, or `auto` to choose by the width this component is given.
33
+ *
34
+ * `auto` measures the component rather than the viewport, because the wheel
35
+ * is usually in a side panel and a narrow panel on a wide screen still wants
36
+ * the stacked reading.
37
+ */
38
+ layout?: "auto" | "beside" | "stacked";
30
39
  }
31
40
  export declare const ComplexColorWheelLayout: __LayoutComponent<ComplexColorWheelProps>;
@@ -35,4 +35,24 @@ export declare const complexColorWheel: import("solid-layouts/solid-2").Recipe<{
35
35
  readonly base: "complex-color-wheel__hint";
36
36
  };
37
37
  };
38
+ readonly props: {
39
+ /**
40
+ * Where the adjustment rows sit relative to the wheel, and to each other.
41
+ *
42
+ * `beside` is the wide reading: the rows sit to the right of the wheel and
43
+ * pack two to a line once there is room for them. `stacked` is the narrow
44
+ * one, everything in a single column. `auto` picks by the width the
45
+ * component is actually given rather than by the viewport, so a wheel in a
46
+ * narrow panel stacks on a wide screen, which is the case that matters:
47
+ * this lives in a side panel more often than on a page.
48
+ */
49
+ readonly layout: {
50
+ readonly auto: "complex-color-wheel--layout-auto";
51
+ readonly beside: "complex-color-wheel--layout-beside";
52
+ readonly stacked: "complex-color-wheel--layout-stacked";
53
+ };
54
+ };
55
+ readonly defaults: {
56
+ readonly layout: "auto";
57
+ };
38
58
  }>;
@@ -36,11 +36,27 @@ const complexColorWheel = recipe({
36
36
  base: "complex-color-wheel__hint"
37
37
  }
38
38
  },
39
+ props: {
40
+ layout: {
41
+ auto: "complex-color-wheel--layout-auto",
42
+ beside: "complex-color-wheel--layout-beside",
43
+ stacked: "complex-color-wheel--layout-stacked"
44
+ }
45
+ },
46
+ defaults: {
47
+ layout: "auto"
48
+ },
39
49
  _layouts: {
40
50
  slots: {
41
51
  root: {
42
52
  base: "complex-color-wheel",
43
- axes: {}
53
+ axes: {
54
+ layout: {
55
+ auto: "complex-color-wheel--layout-auto",
56
+ beside: "complex-color-wheel--layout-beside",
57
+ stacked: "complex-color-wheel--layout-stacked"
58
+ }
59
+ }
44
60
  },
45
61
  adjustments: {
46
62
  base: "complex-color-wheel__adjustments",
@@ -24,10 +24,6 @@
24
24
  inset: 0;
25
25
  }
26
26
 
27
- .color-wheel-flower__ring-shell--outer {
28
- transform: scale(1.1);
29
- }
30
-
31
27
  .color-wheel-flower__ring-shell--inner {
32
28
  transform: scale(0.9);
33
29
  }
@@ -38,10 +34,6 @@
38
34
  border-radius: var(--radius-pill, 9999px);
39
35
  }
40
36
 
41
- .color-wheel-flower__ring--outer {
42
- will-change: transform, opacity, box-shadow, background;
43
- }
44
-
45
37
  .color-wheel-flower__ring--inner {
46
38
  background: #0b1012;
47
39
  }
@@ -12,7 +12,7 @@ import { resolveColorWheelFlowerPalette } from "./ColorWheelFlower.palette.js";
12
12
  import { motionDistances, motionDurations, motionEasings, prefersReducedMotion, runMotion } from "../../motion/index.js";
13
13
  import { CLASSES, componentRecipe } from "./ColorWheelFlower.recipe.js";
14
14
  import { flowerPetalPosition } from "./ColorWheelFlower.geometry.js";
15
- var _tmpl$ = /*#__PURE__*/ template("<div><div><div><div></div></div><div><div>"), _tmpl$2 = /*#__PURE__*/ template("<div><div><div><span></span><span>");
15
+ var _tmpl$ = /*#__PURE__*/ template("<div><div><div><div>"), _tmpl$2 = /*#__PURE__*/ template("<div><div><div><span></span><span>");
16
16
  const parseRgbToHsl = (rgbString)=>{
17
17
  const match = rgbString.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
18
18
  if (!match) return {
@@ -317,27 +317,14 @@ const __solidLayoutColorWheelFlower = (_stable, p)=>{
317
317
  }
318
318
  const mode = ()=>p.mode ?? currentTheme();
319
319
  const colors = createMemo(()=>buildColors(resolveColorWheelFlowerPalette(mode(), p.palette)));
320
- const rainbowGradient = ()=>{
321
- const outer = colors().slice(0, 12);
322
- const stops = outer.map((item, index)=>`${item.rgb} ${index / outer.length * 360}deg`);
323
- stops.push(`${outer[0].rgb} 360deg`);
324
- return `conic-gradient(from 0deg, ${stops.join(", ")})`;
325
- };
326
320
  const reduceMotion = prefersReducedMotion();
327
- const ringTransition = reduceMotion ? {
328
- duration: 0
329
- } : {
330
- duration: motionDurations.slow,
331
- easing: motionEasings.inOut
332
- };
321
+ reduceMotion || (motionDurations.slow, motionEasings.inOut);
333
322
  const hoverLift = reduceMotion ? 0 : motionDistances.sm;
334
323
  const pressScale = 0.96;
335
324
  const pulseScale = 1.12;
336
325
  let containerRef;
337
326
  let pointerTimeout;
338
327
  let pulseTimeout;
339
- let outerRingRef;
340
- let outerRingControl = null;
341
328
  const closestIndex = createMemo(()=>{
342
329
  const current = context.color();
343
330
  const items = colors();
@@ -437,51 +424,12 @@ const __solidLayoutColorWheelFlower = (_stable, p)=>{
437
424
  setHoveredIndex(null);
438
425
  if (void 0 !== pointerTimeout) clearTimeout(pointerTimeout);
439
426
  };
440
- const outerRingBackground = ()=>{
441
- const selected = selectedIndex();
442
- if (null === selected) return rainbowGradient();
443
- const color = colors()[selected];
444
- return `conic-gradient(${color.rgb}, ${color.rgb})`;
445
- };
446
- const outerRingTarget = createMemo(()=>{
447
- if (context.disabled()) return {
448
- opacity: 0.5,
449
- scale: 1
450
- };
451
- if (null !== selectedIndex()) return {
452
- opacity: 1,
453
- scale: 1
454
- };
455
- if (null !== hoveredIndex()) return {
456
- opacity: 0.98,
457
- scale: 0.84
458
- };
459
- return {
460
- opacity: 0.92,
461
- scale: 0.84
462
- };
463
- });
464
- const outerRingGlow = createMemo(()=>{
465
- if (context.disabled()) return "none";
466
- const index = hoveredIndex() ?? selectedIndex();
467
- if (null === index) return "0 0 10px rgba(255,255,255,0.08)";
468
- const color = colors()[index].rgb;
469
- return `0 0 10px rgba(255,255,255,0.16), 0 0 20px ${toRgba(color, 0.35)}`;
470
- });
471
- createTrackedEffect(()=>{
472
- const node = outerRingRef;
473
- if (!node) return;
474
- const target = outerRingTarget();
475
- outerRingControl?.stop();
476
- outerRingControl = runMotion(node, readMotionState(node), target, ringTransition);
477
- });
478
427
  onCleanup(()=>{
479
- outerRingControl?.stop();
480
428
  if (void 0 !== pulseTimeout) clearTimeout(pulseTimeout);
481
429
  if (void 0 !== pointerTimeout) clearTimeout(pointerTimeout);
482
430
  });
483
431
  const pickerValue = ()=>colors()[visualSelectedIndex()]?.hex;
484
- var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild, _el$5 = _el$3.nextSibling, _el$6 = _el$5.firstChild;
432
+ var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.firstChild;
485
433
  var _ref$ = containerRef;
486
434
  "function" == typeof _ref$ || Array.isArray(_ref$) ? ref(()=>_ref$, _el$) : containerRef = _el$;
487
435
  spread(_el$, mergeProps(()=>({
@@ -503,25 +451,9 @@ const __solidLayoutColorWheelFlower = (_stable, p)=>{
503
451
  class: CLASSES.rings
504
452
  })), true);
505
453
  spread(_el$3, mergeProps(()=>({
506
- class: twMerge(CLASSES.ringShell.base, CLASSES.ringShell.outer)
507
- })), true);
508
- var _ref$2 = outerRingRef;
509
- "function" == typeof _ref$2 || Array.isArray(_ref$2) ? ref(()=>_ref$2, _el$4) : outerRingRef = _el$4;
510
- spread(_el$4, mergeProps(()=>({
511
- class: twMerge(CLASSES.ring.base, CLASSES.ring.outer)
512
- }), {
513
- get style () {
514
- return {
515
- background: outerRingBackground(),
516
- "box-shadow": outerRingGlow(),
517
- transition: reduceMotion ? "none" : "background 450ms ease-in-out, box-shadow 300ms ease-out"
518
- };
519
- }
520
- }), false);
521
- spread(_el$5, mergeProps(()=>({
522
454
  class: twMerge(CLASSES.ringShell.base, CLASSES.ringShell.inner)
523
455
  })), true);
524
- spread(_el$6, mergeProps(()=>({
456
+ spread(_el$4, mergeProps(()=>({
525
457
  class: twMerge(CLASSES.ring.base, CLASSES.ring.inner)
526
458
  })), false);
527
459
  insert(_el$, createComponent(color_swatch_picker, mergeProps(()=>({
@@ -638,24 +570,24 @@ const __solidLayoutColorWheelFlower = (_stable, p)=>{
638
570
  onCleanup(()=>{
639
571
  dotControl?.stop();
640
572
  });
641
- var _el$7 = _tmpl$2(), _el$8 = _el$7.firstChild, _el$9 = _el$8.firstChild, _el$0 = _el$9.firstChild, _el$1 = _el$0.nextSibling;
642
- spread(_el$7, mergeProps(()=>({
573
+ var _el$5 = _tmpl$2(), _el$6 = _el$5.firstChild, _el$7 = _el$6.firstChild, _el$8 = _el$7.firstChild, _el$9 = _el$8.nextSibling;
574
+ spread(_el$5, mergeProps(()=>({
643
575
  class: CLASSES.dot.base
644
576
  }), {
645
577
  get style () {
646
578
  return flowerPetalPosition(item.offsetX, item.offsetY);
647
579
  }
648
580
  }), true);
649
- spread(_el$8, mergeProps(()=>({
581
+ spread(_el$6, mergeProps(()=>({
650
582
  class: CLASSES.dot.frame
651
583
  })), true);
652
584
  ref(()=>(el)=>{
653
585
  motionRef = el;
654
- }, _el$9);
655
- spread(_el$9, mergeProps(()=>({
586
+ }, _el$7);
587
+ spread(_el$7, mergeProps(()=>({
656
588
  class: CLASSES.dot.motion
657
589
  })), true);
658
- spread(_el$0, mergeProps(()=>({
590
+ spread(_el$8, mergeProps(()=>({
659
591
  class: CLASSES.halo
660
592
  }), {
661
593
  get style () {
@@ -666,7 +598,7 @@ const __solidLayoutColorWheelFlower = (_stable, p)=>{
666
598
  };
667
599
  }
668
600
  }), false);
669
- insert(_el$9, createComponent(color_swatch, mergeProps({
601
+ insert(_el$7, createComponent(color_swatch, mergeProps({
670
602
  get color () {
671
603
  return item.hex;
672
604
  },
@@ -704,11 +636,11 @@ const __solidLayoutColorWheelFlower = (_stable, p)=>{
704
636
  onPointerCancel: ()=>{
705
637
  if (!context.disabled()) setPressedIndex(null);
706
638
  }
707
- })), _el$1);
708
- spread(_el$1, mergeProps(()=>({
639
+ })), _el$9);
640
+ spread(_el$9, mergeProps(()=>({
709
641
  class: clsx(CLASSES.highlight.base, isHovered() && CLASSES.highlight.hovered, isPulsing() && CLASSES.highlight.pulsing)
710
642
  })), false);
711
- return _el$7;
643
+ return _el$5;
712
644
  }
713
645
  });
714
646
  }
@@ -6,12 +6,10 @@ export declare const CLASSES: {
6
6
  readonly rings: "color-wheel-flower__rings";
7
7
  readonly ringShell: {
8
8
  readonly base: "color-wheel-flower__ring-shell";
9
- readonly outer: "color-wheel-flower__ring-shell--outer";
10
9
  readonly inner: "color-wheel-flower__ring-shell--inner";
11
10
  };
12
11
  readonly ring: {
13
12
  readonly base: "color-wheel-flower__ring";
14
- readonly outer: "color-wheel-flower__ring--outer";
15
13
  readonly inner: "color-wheel-flower__ring--inner";
16
14
  };
17
15
  readonly picker: "color-wheel-flower__picker";
@@ -7,12 +7,10 @@ const CLASSES = {
7
7
  rings: "color-wheel-flower__rings",
8
8
  ringShell: {
9
9
  base: "color-wheel-flower__ring-shell",
10
- outer: "color-wheel-flower__ring-shell--outer",
11
10
  inner: "color-wheel-flower__ring-shell--inner"
12
11
  },
13
12
  ring: {
14
13
  base: "color-wheel-flower__ring",
15
- outer: "color-wheel-flower__ring--outer",
16
14
  inner: "color-wheel-flower__ring--inner"
17
15
  },
18
16
  picker: "color-wheel-flower__picker",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "format": "solid-layouts-library-v2",
3
3
  "package": "@pathscale/ui",
4
- "version": "2.10.0",
4
+ "version": "2.11.0",
5
5
  "components": {
6
6
  "Accordion": {
7
7
  "kind": "embedded"
@@ -15263,9 +15263,6 @@
15263
15263
  "base": [
15264
15264
  "color-wheel-flower__ring-shell"
15265
15265
  ],
15266
- "outer": [
15267
- "color-wheel-flower__ring-shell--outer"
15268
- ],
15269
15266
  "inner": [
15270
15267
  "color-wheel-flower__ring-shell--inner"
15271
15268
  ]
@@ -15274,9 +15271,6 @@
15274
15271
  "base": [
15275
15272
  "color-wheel-flower__ring"
15276
15273
  ],
15277
- "outer": [
15278
- "color-wheel-flower__ring--outer"
15279
- ],
15280
15274
  "inner": [
15281
15275
  "color-wheel-flower__ring--inner"
15282
15276
  ]
@@ -15331,10 +15325,8 @@
15331
15325
  ".color-wheel-flower__picker",
15332
15326
  ".color-wheel-flower__ring",
15333
15327
  ".color-wheel-flower__ring--inner",
15334
- ".color-wheel-flower__ring--outer",
15335
15328
  ".color-wheel-flower__ring-shell",
15336
15329
  ".color-wheel-flower__ring-shell--inner",
15337
- ".color-wheel-flower__ring-shell--outer",
15338
15330
  ".color-wheel-flower__rings",
15339
15331
  ".color-wheel-flower__swatch",
15340
15332
  ".color-wheel-flower__swatch--center",
@@ -19620,12 +19612,6 @@
19620
19612
  "ColorWheelFlower"
19621
19613
  ]
19622
19614
  },
19623
- {
19624
- "selector": ".color-wheel-flower__ring--outer",
19625
- "components": [
19626
- "ColorWheelFlower"
19627
- ]
19628
- },
19629
19615
  {
19630
19616
  "selector": ".color-wheel-flower__ring-shell",
19631
19617
  "components": [
@@ -19638,12 +19624,6 @@
19638
19624
  "ColorWheelFlower"
19639
19625
  ]
19640
19626
  },
19641
- {
19642
- "selector": ".color-wheel-flower__ring-shell--outer",
19643
- "components": [
19644
- "ColorWheelFlower"
19645
- ]
19646
- },
19647
19627
  {
19648
19628
  "selector": ".color-wheel-flower__rings",
19649
19629
  "components": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pathscale/ui",
3
- "version": "2.10.0",
3
+ "version": "2.11.0",
4
4
  "author": "pathscale",
5
5
  "repository": {
6
6
  "type": "git",