@pathscale/ui 0.0.111 → 0.0.112

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +127 -46
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7148,7 +7148,7 @@ const runMotion = (el, from, to, transition, onComplete)=>{
7148
7148
  }
7149
7149
  };
7150
7150
  };
7151
- var ColorWheelFlower_tmpl$ = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)('<div><div class="absolute inset-0"><div class="absolute inset-0"><div class="absolute inset-0 rounded-full"></div></div><div class="absolute inset-0"><div class="absolute inset-0 rounded-full"></div></div></div><div class="relative z-10 w-[calc(100%-5px)] h-[calc(100%-5px)] rounded-full">'), ColorWheelFlower_tmpl$2 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)('<div class=absolute><div class="w-[32px] h-[32px]"><button type=button><span>');
7151
+ var ColorWheelFlower_tmpl$ = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)('<div><div class="absolute inset-0"><div class="absolute inset-0"><div class="absolute inset-0 rounded-full"></div></div><div class="absolute inset-0"><div class="absolute inset-0 rounded-full"></div></div></div><div class="relative z-10 w-[calc(100%-5px)] h-[calc(100%-5px)] rounded-full">'), ColorWheelFlower_tmpl$2 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)('<div class=absolute><div class="relative w-[32px] h-[32px]"><span class="absolute rounded-full pointer-events-none"></span><button type=button><span>');
7152
7152
  const parseRgbToHsl = (rgbString)=>{
7153
7153
  const match = rgbString.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);
7154
7154
  if (!match) return {
@@ -7218,6 +7218,11 @@ const getLiftOffset = (item, distance)=>{
7218
7218
  y: item.offsetY / radius * distance
7219
7219
  };
7220
7220
  };
7221
+ const easeOutBack = (overshoot = 1.4)=>(t)=>{
7222
+ const c1 = overshoot;
7223
+ const c3 = c1 + 1;
7224
+ return 1 + c3 * (t - 1) ** 3 + c1 * (t - 1) ** 2;
7225
+ };
7221
7226
  const COLORS = [
7222
7227
  createColorItem("rgb(245,245,61)", 34.641, -20),
7223
7228
  createColorItem("rgb(245,153,61)", 20, -34.641),
@@ -7239,6 +7244,8 @@ const COLORS = [
7239
7244
  createColorItem("rgb(217,240,194)", 20, 0),
7240
7245
  createColorItem("rgb(255,255,255)", 0, 0)
7241
7246
  ];
7247
+ const MAX_WAVE_DISTANCE = 2 * Math.max(...COLORS.map((item)=>Math.sqrt(item.offsetX ** 2 + item.offsetY ** 2)));
7248
+ const MAX_WAVE_DELAY = 0.12;
7242
7249
  const RAINBOW_GRADIENT = `conic-gradient(
7243
7250
  from 0deg,
7244
7251
  rgb(245,61,61) 0deg,
@@ -7254,21 +7261,17 @@ const ColorWheelFlower = (props)=>{
7254
7261
  const context = useColorPickerContext();
7255
7262
  const [selectedIndex, setSelectedIndex] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createSignal)(null);
7256
7263
  const [hoveredIndex, setHoveredIndex] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createSignal)(null);
7264
+ const [pressedIndex, setPressedIndex] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createSignal)(null);
7257
7265
  const reduceMotion = prefersReducedMotion();
7258
- const dotTransition = reduceMotion ? {
7259
- duration: 0
7260
- } : {
7261
- duration: motionDurations.fast,
7262
- easing: motionEasings.out
7263
- };
7264
7266
  const ringTransition = reduceMotion ? {
7265
7267
  duration: 0
7266
7268
  } : {
7267
- duration: motionDurations.base,
7268
- easing: motionEasings.out
7269
+ duration: motionDurations.slow,
7270
+ easing: motionEasings.inOut
7269
7271
  };
7270
- const hoverLift = reduceMotion ? 0 : motionDistances.sm / 2;
7271
- const selectLift = reduceMotion ? 0 : motionDistances.sm;
7272
+ const hoverLift = reduceMotion ? 0 : motionDistances.sm;
7273
+ const selectLift = reduceMotion ? 0 : motionDistances.md;
7274
+ const pressScale = 0.96;
7272
7275
  let outerRingRef;
7273
7276
  let outerRingControl = null;
7274
7277
  const handleDotClick = (index)=>{
@@ -7298,17 +7301,24 @@ const ColorWheelFlower = (props)=>{
7298
7301
  };
7299
7302
  if (null !== selectedIndex()) return {
7300
7303
  opacity: 1,
7301
- scale: 1.04
7304
+ scale: 1.06
7302
7305
  };
7303
7306
  if (null !== hoveredIndex()) return {
7304
- opacity: 0.96,
7305
- scale: 1.02
7307
+ opacity: 0.98,
7308
+ scale: 1.03
7306
7309
  };
7307
7310
  return {
7308
- opacity: 0.9,
7311
+ opacity: 0.92,
7309
7312
  scale: 1
7310
7313
  };
7311
7314
  });
7315
+ const outerRingGlow = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>{
7316
+ if (context.disabled()) return "none";
7317
+ const idx = hoveredIndex() ?? selectedIndex();
7318
+ if (null === idx) return "0 0 12px rgba(255,255,255,0.12)";
7319
+ const color = COLORS[idx].rgb;
7320
+ return `0 0 12px rgba(255,255,255,0.35), 0 0 28px ${color}`;
7321
+ });
7312
7322
  (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createEffect)(()=>{
7313
7323
  if (!outerRingRef) return;
7314
7324
  const target = outerRingTarget();
@@ -7323,7 +7333,7 @@ const ColorWheelFlower = (props)=>{
7323
7333
  _el$3.style.setProperty("transform", "scale(1.1)");
7324
7334
  var _ref$ = outerRingRef;
7325
7335
  "function" == typeof _ref$ ? (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.use)(_ref$, _el$4) : outerRingRef = _el$4;
7326
- _el$4.style.setProperty("transition", reduceMotion ? "none" : "background 500ms ease-out");
7336
+ _el$4.style.setProperty("transition", reduceMotion ? "none" : "background 450ms ease-in-out, box-shadow 300ms ease-out");
7327
7337
  _el$5.style.setProperty("transform", "scale(0.9)");
7328
7338
  _el$6.style.setProperty("background", "#0b1012");
7329
7339
  (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$7, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.For, {
@@ -7333,9 +7343,10 @@ const ColorWheelFlower = (props)=>{
7333
7343
  let dotControl = null;
7334
7344
  const isSelected = ()=>selectedIndex() === index();
7335
7345
  const isHovered = ()=>hoveredIndex() === index();
7346
+ const isPressed = ()=>pressedIndex() === index();
7336
7347
  const hasSelection = ()=>null !== selectedIndex();
7337
7348
  const hasHover = ()=>null !== hoveredIndex();
7338
- const dotTarget = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>{
7349
+ const dotBaseTarget = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>{
7339
7350
  if (context.disabled()) return {
7340
7351
  opacity: 0.5,
7341
7352
  scale: 1,
@@ -7361,68 +7372,131 @@ const ColorWheelFlower = (props)=>{
7361
7372
  };
7362
7373
  }
7363
7374
  if (hasSelection()) return {
7364
- opacity: 0.65,
7365
- scale: 0.92,
7375
+ opacity: 1,
7376
+ scale: 0.98,
7366
7377
  x: 0,
7367
7378
  y: 0
7368
7379
  };
7369
7380
  if (hasHover()) return {
7370
- opacity: 0.85,
7371
- scale: 0.96,
7381
+ opacity: 1,
7382
+ scale: 0.99,
7372
7383
  x: 0,
7373
7384
  y: 0
7374
7385
  };
7375
7386
  return {
7376
- opacity: 0.95,
7387
+ opacity: 1,
7377
7388
  scale: 1,
7378
7389
  x: 0,
7379
7390
  y: 0
7380
7391
  };
7381
7392
  });
7393
+ const dotTarget = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>{
7394
+ const base = dotBaseTarget();
7395
+ if (!isPressed()) return base;
7396
+ return {
7397
+ ...base,
7398
+ scale: (base.scale ?? 1) * pressScale
7399
+ };
7400
+ });
7401
+ const glowOpacity = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createMemo)(()=>{
7402
+ if (context.disabled()) return 0;
7403
+ if (isHovered()) return 1;
7404
+ if (isSelected()) return 0.75;
7405
+ return 0;
7406
+ });
7407
+ const dotTransition = ()=>{
7408
+ if (reduceMotion) return {
7409
+ duration: 0
7410
+ };
7411
+ const anchorIndex = hoveredIndex() ?? selectedIndex();
7412
+ let delay = 0;
7413
+ if (null !== anchorIndex) {
7414
+ const anchor = COLORS[anchorIndex];
7415
+ const distance = Math.sqrt((item.offsetX - anchor.offsetX) ** 2 + (item.offsetY - anchor.offsetY) ** 2);
7416
+ delay = Math.min(MAX_WAVE_DELAY, distance / MAX_WAVE_DISTANCE * MAX_WAVE_DELAY);
7417
+ }
7418
+ if (isSelected()) return {
7419
+ duration: motionDurations.fast,
7420
+ easing: easeOutBack(1.25),
7421
+ delay
7422
+ };
7423
+ if (isHovered()) return {
7424
+ duration: motionDurations.fast,
7425
+ easing: motionEasings.out,
7426
+ delay
7427
+ };
7428
+ return {
7429
+ duration: motionDurations.base,
7430
+ easing: motionEasings.out,
7431
+ delay
7432
+ };
7433
+ };
7382
7434
  (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createEffect)(()=>{
7383
7435
  if (!motionRef) return;
7384
7436
  const target = dotTarget();
7437
+ const transition = dotTransition();
7385
7438
  dotControl?.stop();
7386
- dotControl = runMotion(motionRef, readMotionState(motionRef), target, dotTransition);
7439
+ dotControl = runMotion(motionRef, readMotionState(motionRef), target, transition);
7387
7440
  });
7388
7441
  (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.onCleanup)(()=>{
7389
7442
  dotControl?.stop();
7390
7443
  });
7391
7444
  return (()=>{
7392
- var _el$8 = ColorWheelFlower_tmpl$2(), _el$9 = _el$8.firstChild, _el$0 = _el$9.firstChild, _el$1 = _el$0.firstChild;
7445
+ var _el$8 = ColorWheelFlower_tmpl$2(), _el$9 = _el$8.firstChild, _el$0 = _el$9.firstChild, _el$1 = _el$0.nextSibling, _el$10 = _el$1.firstChild;
7393
7446
  _el$8.style.setProperty("transform", "translate(-50%, -50%)");
7394
7447
  (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.use)((el)=>{
7395
7448
  motionRef = el;
7396
7449
  }, _el$9);
7397
- _el$0.addEventListener("blur", ()=>{
7450
+ _el$0.style.setProperty("top", "-5px");
7451
+ _el$0.style.setProperty("left", "-5px");
7452
+ _el$0.style.setProperty("right", "-5px");
7453
+ _el$0.style.setProperty("bottom", "-5px");
7454
+ _el$0.style.setProperty("background", "radial-gradient(circle, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0) 65%)");
7455
+ _el$0.style.setProperty("transition", reduceMotion ? "none" : "opacity 200ms ease-out, box-shadow 200ms ease-out");
7456
+ _el$1.addEventListener("pointercancel", ()=>{
7457
+ if (!context.disabled()) setPressedIndex(null);
7458
+ });
7459
+ _el$1.addEventListener("pointerleave", ()=>{
7460
+ if (!context.disabled()) setPressedIndex(null);
7461
+ });
7462
+ _el$1.$$pointerup = ()=>{
7463
+ if (!context.disabled()) setPressedIndex(null);
7464
+ };
7465
+ _el$1.$$pointerdown = ()=>{
7466
+ if (!context.disabled()) setPressedIndex(index());
7467
+ };
7468
+ _el$1.addEventListener("blur", ()=>{
7398
7469
  if (!context.disabled()) setHoveredIndex(null);
7399
7470
  });
7400
- _el$0.addEventListener("focus", ()=>{
7471
+ _el$1.addEventListener("focus", ()=>{
7401
7472
  if (!context.disabled()) setHoveredIndex(index());
7402
7473
  });
7403
- _el$0.addEventListener("mouseleave", ()=>{
7474
+ _el$1.addEventListener("mouseleave", ()=>{
7404
7475
  if (!context.disabled()) setHoveredIndex(null);
7405
7476
  });
7406
- _el$0.addEventListener("mouseenter", ()=>{
7477
+ _el$1.addEventListener("mouseenter", ()=>{
7407
7478
  if (!context.disabled()) setHoveredIndex(index());
7408
7479
  });
7409
- _el$0.$$click = ()=>handleDotClick(index());
7410
- _el$0.style.setProperty("box-shadow", "0 2px 8px rgba(0,0,0,0.3)");
7411
- _el$1.style.setProperty("mix-blend-mode", "overlay");
7480
+ _el$1.$$click = ()=>handleDotClick(index());
7481
+ _el$1.style.setProperty("transition", reduceMotion ? "none" : "box-shadow 200ms ease-out");
7482
+ _el$10.style.setProperty("mix-blend-mode", "overlay");
7412
7483
  (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.effect)((_p$)=>{
7413
- var _v$3 = `calc(50% + ${item.offsetX}px)`, _v$4 = `calc(50% + ${item.offsetY}px)`, _v$5 = context.disabled() ? -1 : 0, _v$6 = clsx("w-full h-full rounded-full", "transition-shadow duration-200 ease-out", "focus:outline-none focus:ring-2 focus:ring-white/50", "relative z-10", {
7484
+ var _v$4 = `calc(50% + ${item.offsetX}px)`, _v$5 = `calc(50% + ${item.offsetY}px)`, _v$6 = glowOpacity(), _v$7 = `0 0 16px ${item.rgb}, 0 0 6px rgba(255,255,255,0.6)`, _v$8 = context.disabled() ? -1 : 0, _v$9 = clsx("w-full h-full rounded-full", "transition-shadow duration-200 ease-out", "focus:outline-none focus:ring-2 focus:ring-white/50", "relative z-10", {
7414
7485
  "cursor-not-allowed": context.disabled(),
7415
7486
  "cursor-pointer": !context.disabled()
7416
- }), _v$7 = item.rgb, _v$8 = `Select color ${item.rgb}`, _v$9 = selectedIndex() === index(), _v$0 = clsx("absolute inset-0 rounded-full border-2 border-white", "transition-opacity duration-300 ease-out"), _v$1 = selectedIndex() === index() ? "1" : "0";
7417
- _v$3 !== _p$.e && (null != (_p$.e = _v$3) ? _el$8.style.setProperty("left", _v$3) : _el$8.style.removeProperty("left"));
7418
- _v$4 !== _p$.t && (null != (_p$.t = _v$4) ? _el$8.style.setProperty("top", _v$4) : _el$8.style.removeProperty("top"));
7419
- _v$5 !== _p$.a && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.setAttribute)(_el$0, "tabindex", _p$.a = _v$5);
7420
- _v$6 !== _p$.o && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.className)(_el$0, _p$.o = _v$6);
7421
- _v$7 !== _p$.i && (null != (_p$.i = _v$7) ? _el$0.style.setProperty("background", _v$7) : _el$0.style.removeProperty("background"));
7422
- _v$8 !== _p$.n && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.setAttribute)(_el$0, "aria-label", _p$.n = _v$8);
7423
- _v$9 !== _p$.s && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.setAttribute)(_el$0, "aria-pressed", _p$.s = _v$9);
7424
- _v$0 !== _p$.h && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.className)(_el$1, _p$.h = _v$0);
7425
- _v$1 !== _p$.r && (null != (_p$.r = _v$1) ? _el$1.style.setProperty("opacity", _v$1) : _el$1.style.removeProperty("opacity"));
7487
+ }), _v$0 = item.rgb, _v$1 = isSelected() ? "0 6px 16px rgba(0,0,0,0.35)" : isHovered() ? "0 4px 12px rgba(0,0,0,0.3)" : "0 2px 8px rgba(0,0,0,0.3)", _v$10 = `Select color ${item.rgb}`, _v$11 = selectedIndex() === index(), _v$12 = clsx("absolute inset-0 rounded-full border-2 border-white", "transition-opacity duration-300 ease-out"), _v$13 = selectedIndex() === index() ? "1" : "0";
7488
+ _v$4 !== _p$.e && (null != (_p$.e = _v$4) ? _el$8.style.setProperty("left", _v$4) : _el$8.style.removeProperty("left"));
7489
+ _v$5 !== _p$.t && (null != (_p$.t = _v$5) ? _el$8.style.setProperty("top", _v$5) : _el$8.style.removeProperty("top"));
7490
+ _v$6 !== _p$.a && (null != (_p$.a = _v$6) ? _el$0.style.setProperty("opacity", _v$6) : _el$0.style.removeProperty("opacity"));
7491
+ _v$7 !== _p$.o && (null != (_p$.o = _v$7) ? _el$0.style.setProperty("box-shadow", _v$7) : _el$0.style.removeProperty("box-shadow"));
7492
+ _v$8 !== _p$.i && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.setAttribute)(_el$1, "tabindex", _p$.i = _v$8);
7493
+ _v$9 !== _p$.n && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.className)(_el$1, _p$.n = _v$9);
7494
+ _v$0 !== _p$.s && (null != (_p$.s = _v$0) ? _el$1.style.setProperty("background", _v$0) : _el$1.style.removeProperty("background"));
7495
+ _v$1 !== _p$.h && (null != (_p$.h = _v$1) ? _el$1.style.setProperty("box-shadow", _v$1) : _el$1.style.removeProperty("box-shadow"));
7496
+ _v$10 !== _p$.r && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.setAttribute)(_el$1, "aria-label", _p$.r = _v$10);
7497
+ _v$11 !== _p$.d && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.setAttribute)(_el$1, "aria-pressed", _p$.d = _v$11);
7498
+ _v$12 !== _p$.l && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.className)(_el$10, _p$.l = _v$12);
7499
+ _v$13 !== _p$.u && (null != (_p$.u = _v$13) ? _el$10.style.setProperty("opacity", _v$13) : _el$10.style.removeProperty("opacity"));
7426
7500
  return _p$;
7427
7501
  }, {
7428
7502
  e: void 0,
@@ -7433,27 +7507,34 @@ const ColorWheelFlower = (props)=>{
7433
7507
  n: void 0,
7434
7508
  s: void 0,
7435
7509
  h: void 0,
7436
- r: void 0
7510
+ r: void 0,
7511
+ d: void 0,
7512
+ l: void 0,
7513
+ u: void 0
7437
7514
  });
7438
7515
  return _el$8;
7439
7516
  })();
7440
7517
  }
7441
7518
  }));
7442
7519
  (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.effect)((_p$)=>{
7443
- var _v$ = containerClasses(), _v$2 = outerRingBackground();
7520
+ var _v$ = containerClasses(), _v$2 = outerRingBackground(), _v$3 = outerRingGlow();
7444
7521
  _v$ !== _p$.e && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.className)(_el$, _p$.e = _v$);
7445
7522
  _v$2 !== _p$.t && (null != (_p$.t = _v$2) ? _el$4.style.setProperty("background", _v$2) : _el$4.style.removeProperty("background"));
7523
+ _v$3 !== _p$.a && (null != (_p$.a = _v$3) ? _el$4.style.setProperty("box-shadow", _v$3) : _el$4.style.removeProperty("box-shadow"));
7446
7524
  return _p$;
7447
7525
  }, {
7448
7526
  e: void 0,
7449
- t: void 0
7527
+ t: void 0,
7528
+ a: void 0
7450
7529
  });
7451
7530
  return _el$;
7452
7531
  })();
7453
7532
  };
7454
7533
  const colorpicker_ColorWheelFlower = ColorWheelFlower;
7455
7534
  (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.delegateEvents)([
7456
- "click"
7535
+ "click",
7536
+ "pointerdown",
7537
+ "pointerup"
7457
7538
  ]);
7458
7539
  const ColorPickerFlowerSelector_ColorPickerFlowerSelector = ()=>[
7459
7540
  (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(colorpicker_ColorWheelFlower, {}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pathscale/ui",
3
- "version": "0.0.111",
3
+ "version": "0.0.112",
4
4
  "author": "pathscale",
5
5
  "repository": {
6
6
  "type": "git",