@tarsis/toolkit 0.5.8-beta.4 → 0.6.1

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
4
 
5
- const index = require('./index-By8OxZ_D.cjs');
5
+ const index = require('./index-CG1347-V.cjs');
6
6
 
7
7
  /*
8
8
  object-assign
@@ -1,4 +1,4 @@
1
- import { c as commonjsGlobal, a as getAugmentedNamespace, g as getDefaultExportFromCjs, W as WebGLRenderer, P as PerspectiveCamera, S as Scene, T as THREE$1, C as Clock, b as TextureLoader, R as RawShaderMaterial, D as DoubleSide, d as WebGLRenderTarget, e as Color, M as Mesh, f as TorusKnotGeometry, h as ShaderMaterial } from './index-BsoUKX1n.js';
1
+ import { c as commonjsGlobal, a as getAugmentedNamespace, g as getDefaultExportFromCjs, W as WebGLRenderer, P as PerspectiveCamera, S as Scene, T as THREE$1, C as Clock, b as TextureLoader, R as RawShaderMaterial, D as DoubleSide, d as WebGLRenderTarget, e as Color, M as Mesh, f as TorusKnotGeometry, h as ShaderMaterial } from './index-7A_TZGdO.js';
2
2
 
3
3
  /*
4
4
  object-assign
@@ -52094,11 +52094,11 @@ const BubblyParticlesButton = () => {
52094
52094
  return /* @__PURE__ */ jsx("button", { className: styles$4H.root, onClick: handleClick, children: "Click me!" });
52095
52095
  };
52096
52096
 
52097
- const root$4i = "_root_se9py_1";
52098
- const button$o = "_button_se9py_13";
52099
- const p$1 = "_p_se9py_26";
52100
- const text$z = "_text_se9py_26";
52101
- const effects = "_effects_se9py_240";
52097
+ const root$4i = "_root_1841q_1";
52098
+ const button$o = "_button_1841q_13";
52099
+ const p$1 = "_p_1841q_26";
52100
+ const text$z = "_text_1841q_26";
52101
+ const effects = "_effects_1841q_240";
52102
52102
  const styles$4G = {
52103
52103
  root: root$4i,
52104
52104
  button: button$o,
@@ -68228,9 +68228,9 @@ const NeonButton = ({ className = "", ...rest }) => {
68228
68228
  return /* @__PURE__ */ jsx("button", { type: "button", ...rest, className: clsx(styles$48.root, className), children: "Neon" });
68229
68229
  };
68230
68230
 
68231
- const root$3P = "_root_1fe3u_2";
68232
- const i$6 = "_i_1fe3u_22";
68233
- const text$s = "_text_1fe3u_482";
68231
+ const root$3P = "_root_3d624_2";
68232
+ const i$6 = "_i_3d624_22";
68233
+ const text$s = "_text_3d624_482";
68234
68234
  const styles$47 = {
68235
68235
  root: root$3P,
68236
68236
  i: i$6,
@@ -78354,6 +78354,18 @@ const styles$2S = {
78354
78354
  tooltipContent: tooltipContent
78355
78355
  };
78356
78356
 
78357
+ const getExitOffset = (placement, offsetValue) => {
78358
+ switch (placement) {
78359
+ case "top":
78360
+ return { x: 0, y: offsetValue };
78361
+ case "bottom":
78362
+ return { x: 0, y: -offsetValue };
78363
+ case "left":
78364
+ return { x: offsetValue, y: 0 };
78365
+ case "right":
78366
+ return { x: -offsetValue, y: 0 };
78367
+ }
78368
+ };
78357
78369
  const Tooltip = ({
78358
78370
  children,
78359
78371
  label,
@@ -78366,34 +78378,40 @@ const Tooltip = ({
78366
78378
  }) => {
78367
78379
  const [isOpen, setIsOpen] = useState(false);
78368
78380
  const [clicked, setClicked] = useState(false);
78381
+ const [isPositioned, setIsPositioned] = useState(false);
78369
78382
  const shouldReduceMotion = useReducedMotion();
78370
78383
  const hasFinePointer = useMatchMedia("(pointer: fine)");
78371
78384
  const isMobile = hasFinePointer === false;
78372
78385
  const timeoutRef = useRef(null);
78373
- const variants = shouldReduceMotion ? void 0 : {
78374
- initial: {
78375
- scale: animate ? 0.6 : 1,
78376
- opacity: animate ? 0.8 : 1
78377
- },
78378
- animate: {
78379
- scale: 1,
78380
- opacity: 1,
78381
- transition: {
78382
- type: "spring",
78383
- stiffness: 280,
78384
- damping: 22,
78385
- mass: 0.9
78386
+ const rafRef = useRef(null);
78387
+ const variants = useMemo(
78388
+ () => shouldReduceMotion ? void 0 : {
78389
+ initial: {
78390
+ scale: animate ? 0.6 : 1,
78391
+ opacity: animate ? 0.8 : 1
78392
+ },
78393
+ animate: {
78394
+ scale: 1,
78395
+ opacity: 1,
78396
+ transition: {
78397
+ type: "spring",
78398
+ stiffness: 280,
78399
+ damping: 22,
78400
+ mass: 0.9
78401
+ }
78402
+ },
78403
+ exit: {
78404
+ scale: 0.3,
78405
+ opacity: 0,
78406
+ ...getExitOffset(placement, offsetValue),
78407
+ transition: {
78408
+ duration: 0.2,
78409
+ ease: [0.33, 1, 0.68, 1]
78410
+ }
78386
78411
  }
78387
78412
  },
78388
- exit: {
78389
- scale: animate ? 0.4 : 1,
78390
- opacity: animate ? 0.8 : 1,
78391
- transition: {
78392
- duration: 0.1,
78393
- ease: "easeIn"
78394
- }
78395
- }
78396
- };
78413
+ [shouldReduceMotion, animate, placement, offsetValue]
78414
+ );
78397
78415
  const { refs, floatingStyles, context } = useFloating({
78398
78416
  open: isOpen,
78399
78417
  onOpenChange: setIsOpen,
@@ -78403,7 +78421,7 @@ const Tooltip = ({
78403
78421
  whileElementsMounted: autoUpdate
78404
78422
  });
78405
78423
  const hover = useHover(context, {
78406
- delay: { open: delay, close: delay },
78424
+ delay: shouldReduceMotion ? 0 : { open: delay, close: delay },
78407
78425
  move: false,
78408
78426
  enabled: disableOnClick ? !clicked : true
78409
78427
  });
@@ -78433,7 +78451,94 @@ const Tooltip = ({
78433
78451
  }
78434
78452
  };
78435
78453
  }, [isOpen, isMobile]);
78436
- const handleClick = (_e) => {
78454
+ useEffect(() => {
78455
+ if (!isOpen) {
78456
+ setIsPositioned(false);
78457
+ return;
78458
+ }
78459
+ if (!shouldReduceMotion) {
78460
+ setIsPositioned(true);
78461
+ return;
78462
+ }
78463
+ let attempts = 0;
78464
+ const maxAttempts = 10;
78465
+ const checkPosition = () => {
78466
+ const element = refs.floating.current;
78467
+ if (element) {
78468
+ const rect = element.getBoundingClientRect();
78469
+ if (rect.width > 0 && rect.height > 0 && (rect.left !== 0 || rect.top !== 0)) {
78470
+ setIsPositioned(true);
78471
+ rafRef.current = null;
78472
+ return;
78473
+ }
78474
+ }
78475
+ attempts += 1;
78476
+ if (attempts < maxAttempts) {
78477
+ rafRef.current = requestAnimationFrame(checkPosition);
78478
+ } else {
78479
+ setIsPositioned(true);
78480
+ rafRef.current = null;
78481
+ }
78482
+ };
78483
+ rafRef.current = requestAnimationFrame(checkPosition);
78484
+ return () => {
78485
+ if (rafRef.current !== null) {
78486
+ cancelAnimationFrame(rafRef.current);
78487
+ rafRef.current = null;
78488
+ }
78489
+ };
78490
+ }, [isOpen, shouldReduceMotion]);
78491
+ const tooltipContent = useMemo(() => {
78492
+ if (shouldReduceMotion) {
78493
+ return isOpen ? /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(
78494
+ "div",
78495
+ {
78496
+ ref: refs.setFloating,
78497
+ style: {
78498
+ ...floatingStyles,
78499
+ ...!isPositioned ? { visibility: "hidden" } : {}
78500
+ },
78501
+ ...getFloatingProps(),
78502
+ className: styles$2S.tooltip,
78503
+ children: /* @__PURE__ */ jsx("div", { className: clsx(styles$2S.tooltipContent, className), children: label })
78504
+ },
78505
+ "tooltip"
78506
+ ) }) : null;
78507
+ }
78508
+ const tooltipWrapper = isOpen ? /* @__PURE__ */ jsx(
78509
+ "div",
78510
+ {
78511
+ ref: refs.setFloating,
78512
+ style: floatingStyles,
78513
+ ...getFloatingProps(),
78514
+ className: styles$2S.tooltip,
78515
+ children: /* @__PURE__ */ jsx(
78516
+ motion.div,
78517
+ {
78518
+ className: clsx(styles$2S.tooltipContent, className),
78519
+ variants,
78520
+ initial: "initial",
78521
+ animate: "animate",
78522
+ exit: "exit",
78523
+ children: label
78524
+ }
78525
+ )
78526
+ },
78527
+ "tooltip"
78528
+ ) : null;
78529
+ return /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: tooltipWrapper }) });
78530
+ }, [
78531
+ isOpen,
78532
+ shouldReduceMotion,
78533
+ isPositioned,
78534
+ refs.setFloating,
78535
+ floatingStyles,
78536
+ getFloatingProps,
78537
+ className,
78538
+ label,
78539
+ variants
78540
+ ]);
78541
+ const handleClick = useCallback(() => {
78437
78542
  if (disableOnClick) {
78438
78543
  setClicked(true);
78439
78544
  setIsOpen(false);
@@ -78441,25 +78546,30 @@ const Tooltip = ({
78441
78546
  if (isMobile) {
78442
78547
  setIsOpen(true);
78443
78548
  }
78444
- };
78445
- const handleMouseLeave = (_e) => {
78549
+ }, [disableOnClick, isMobile]);
78550
+ const handleMouseLeave = useCallback(() => {
78446
78551
  if (disableOnClick) {
78447
78552
  setClicked(false);
78448
78553
  }
78449
- };
78450
- const mergeEventHandler = (childHandler, tooltipHandler) => {
78451
- return (e) => {
78452
- childHandler?.(e);
78453
- tooltipHandler?.(e);
78454
- };
78455
- };
78456
- const childRef = isValidElement(children) && children.props && children.props.ref ? children.props.ref : null;
78554
+ }, [disableOnClick]);
78555
+ const mergeEventHandler = useCallback(
78556
+ (childHandler, tooltipHandler) => {
78557
+ return (e) => {
78558
+ childHandler?.(e);
78559
+ tooltipHandler?.(e);
78560
+ };
78561
+ },
78562
+ []
78563
+ );
78564
+ const childRef = useMemo(() => {
78565
+ if (!isValidElement(children)) return null;
78566
+ const props = children.props;
78567
+ return props?.ref ?? null;
78568
+ }, [children]);
78457
78569
  const mergedRef = useMergeRefs([refs.setReference, childRef]);
78458
- if (isValidElement(children)) {
78459
- const childElement = children;
78460
- const childProps = childElement.props;
78461
- const tooltipProps = getReferenceProps();
78462
- const mergedProps = {
78570
+ const tooltipProps = useMemo(() => getReferenceProps(), [getReferenceProps]);
78571
+ const createMergedProps = useCallback(
78572
+ (childProps) => ({
78463
78573
  ...childProps,
78464
78574
  ref: mergedRef,
78465
78575
  onClick: mergeEventHandler(
@@ -78485,30 +78595,39 @@ const Tooltip = ({
78485
78595
  childProps.onBlur,
78486
78596
  tooltipProps.onBlur
78487
78597
  )
78488
- };
78598
+ }),
78599
+ [
78600
+ mergedRef,
78601
+ mergeEventHandler,
78602
+ handleClick,
78603
+ handleMouseLeave,
78604
+ tooltipProps.onMouseEnter,
78605
+ tooltipProps.onMouseLeave,
78606
+ tooltipProps.onFocus,
78607
+ tooltipProps.onBlur
78608
+ ]
78609
+ );
78610
+ const spanProps = useMemo(
78611
+ () => ({
78612
+ ...tooltipProps,
78613
+ onClick: mergeEventHandler(
78614
+ tooltipProps.onClick,
78615
+ handleClick
78616
+ ),
78617
+ onMouseLeave: mergeEventHandler(
78618
+ tooltipProps.onMouseLeave,
78619
+ handleMouseLeave
78620
+ )
78621
+ }),
78622
+ [tooltipProps, mergeEventHandler, handleClick, handleMouseLeave]
78623
+ );
78624
+ if (isValidElement(children)) {
78625
+ const childElement = children;
78626
+ const childProps = childElement.props;
78627
+ const mergedProps = createMergedProps(childProps);
78489
78628
  return /* @__PURE__ */ jsxs(Fragment, { children: [
78490
78629
  cloneElement(childElement, mergedProps),
78491
- /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: isOpen && /* @__PURE__ */ jsx(
78492
- "div",
78493
- {
78494
- ref: refs.setFloating,
78495
- style: floatingStyles,
78496
- ...getFloatingProps(),
78497
- className: styles$2S.tooltip,
78498
- children: /* @__PURE__ */ jsx(
78499
- motion.div,
78500
- {
78501
- className: clsx(styles$2S.tooltipContent, className),
78502
- variants,
78503
- initial: shouldReduceMotion ? void 0 : "initial",
78504
- animate: shouldReduceMotion ? void 0 : "animate",
78505
- exit: shouldReduceMotion ? void 0 : "exit",
78506
- children: label
78507
- }
78508
- )
78509
- },
78510
- "tooltip"
78511
- ) }) })
78630
+ tooltipContent
78512
78631
  ] });
78513
78632
  }
78514
78633
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -78516,37 +78635,12 @@ const Tooltip = ({
78516
78635
  "span",
78517
78636
  {
78518
78637
  ref: refs.setReference,
78519
- ...getReferenceProps(),
78520
- onClick: handleClick,
78521
- onMouseLeave: mergeEventHandler(
78522
- getReferenceProps().onMouseLeave,
78523
- handleMouseLeave
78524
- ),
78638
+ ...spanProps,
78525
78639
  style: { display: "contents" },
78526
78640
  children
78527
78641
  }
78528
78642
  ),
78529
- /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: isOpen && /* @__PURE__ */ jsx(
78530
- "div",
78531
- {
78532
- ref: refs.setFloating,
78533
- style: floatingStyles,
78534
- ...getFloatingProps(),
78535
- className: styles$2S.tooltip,
78536
- children: /* @__PURE__ */ jsx(
78537
- motion.div,
78538
- {
78539
- className: clsx(styles$2S.tooltipContent, className),
78540
- variants,
78541
- initial: shouldReduceMotion ? void 0 : "initial",
78542
- animate: shouldReduceMotion ? void 0 : "animate",
78543
- exit: shouldReduceMotion ? void 0 : "exit",
78544
- children: label
78545
- }
78546
- )
78547
- },
78548
- "tooltip"
78549
- ) }) })
78643
+ tooltipContent
78550
78644
  ] });
78551
78645
  };
78552
78646
 
@@ -78672,7 +78766,7 @@ const DockMotionItem = (props) => {
78672
78766
  mouseX,
78673
78767
  tooltip = null,
78674
78768
  tooltipOptions,
78675
- interaction,
78769
+ interaction = "possible",
78676
78770
  expansion,
78677
78771
  mute = false,
78678
78772
  className,
@@ -78727,55 +78821,49 @@ const DockMotionItem = (props) => {
78727
78821
  unsubscribe();
78728
78822
  };
78729
78823
  }, [scale]);
78730
- const playAudio$1 = useCallback(
78731
- (interactionState = "possible") => {
78732
- if (!isInteractive || mute) {
78733
- return;
78824
+ const playAudio$1 = useCallback(() => {
78825
+ if (!isInteractive || mute) {
78826
+ return;
78827
+ }
78828
+ const audioSrc = interaction === "possible" ? "/audio/click.wav" : "/audio/hover.mp3";
78829
+ playAudio(audioSrc, (error) => {
78830
+ if (interaction === "impossible") {
78831
+ console.warn(`Failed to play ${audioSrc}:`, error);
78734
78832
  }
78735
- const audioSrc = interactionState === "possible" ? "/audio/click.wav" : "/audio/hover.mp3";
78736
- playAudio(audioSrc, (error) => {
78737
- if (interactionState === "impossible") {
78738
- console.warn(`Failed to play ${audioSrc}:`, error);
78833
+ });
78834
+ }, [interaction, isInteractive, mute]);
78835
+ const playAnimation = useCallback(() => {
78836
+ if (prefersReducedMotion || !contentRef.current) {
78837
+ return;
78838
+ }
78839
+ if (interaction === "impossible") {
78840
+ animate(
78841
+ contentRef.current,
78842
+ { x: [0, -3, 3, -3, 3, -2, 2, 0] },
78843
+ {
78844
+ duration: 0.5,
78845
+ ease: [0.33, 1, 0.68, 1]
78739
78846
  }
78740
- });
78741
- },
78742
- [isInteractive, mute]
78743
- );
78744
- const playAnimation = useCallback(
78745
- (interactionState = "possible") => {
78746
- if (prefersReducedMotion || !contentRef.current) {
78747
- return;
78748
- }
78749
- if (interactionState === "impossible") {
78750
- animate(
78847
+ );
78848
+ } else {
78849
+ animate([
78850
+ [
78851
+ contentRef.current,
78852
+ { scale: 0.75 },
78853
+ { duration: 0.15, ease: "easeOut" }
78854
+ ],
78855
+ [
78751
78856
  contentRef.current,
78752
- { x: [0, -3, 3, -3, 3, -2, 2, 0] },
78857
+ { scale: 1 },
78753
78858
  {
78754
- duration: 0.5,
78755
- ease: [0.33, 1, 0.68, 1]
78859
+ type: "spring",
78860
+ stiffness: 300,
78861
+ damping: 25
78756
78862
  }
78757
- );
78758
- } else {
78759
- animate([
78760
- [
78761
- contentRef.current,
78762
- { scale: 0.75 },
78763
- { duration: 0.15, ease: "easeOut" }
78764
- ],
78765
- [
78766
- contentRef.current,
78767
- { scale: 1 },
78768
- {
78769
- type: "spring",
78770
- stiffness: 300,
78771
- damping: 25
78772
- }
78773
- ]
78774
- ]);
78775
- }
78776
- },
78777
- [prefersReducedMotion, animate]
78778
- );
78863
+ ]
78864
+ ]);
78865
+ }
78866
+ }, [prefersReducedMotion, interaction, animate]);
78779
78867
  useRaf(
78780
78868
  () => {
78781
78869
  const el = scope.current;
@@ -78792,14 +78880,17 @@ const DockMotionItem = (props) => {
78792
78880
  hover === true && prefersReducedMotion === false
78793
78881
  // maybe add `& isInteractive`
78794
78882
  );
78795
- const contentStyle = useMemo(
78796
- () => ({
78883
+ const contentStyle = useMemo(() => {
78884
+ return prefersReducedMotion ? {
78885
+ width: baseWidth * targetMultiplier,
78886
+ height: baseWidth,
78887
+ originX: "center"
78888
+ } : {
78797
78889
  width: dynamicWidth,
78798
78890
  height: size,
78799
78891
  originX: "center"
78800
- }),
78801
- [dynamicWidth, size]
78802
- );
78892
+ };
78893
+ }, [dynamicWidth, size, prefersReducedMotion, targetMultiplier]);
78803
78894
  const ContentElement = useMemo(() => {
78804
78895
  if (rest.use && typeof rest.use !== "string") {
78805
78896
  return motion.create(rest.use);
@@ -78828,25 +78919,19 @@ const DockMotionItem = (props) => {
78828
78919
  {
78829
78920
  ref: scope,
78830
78921
  layoutId: itemId,
78831
- layout: true,
78922
+ layout: prefersReducedMotion ? false : true,
78832
78923
  className: clsx(styles$2Q.item, className),
78833
78924
  onMouseEnter,
78834
78925
  style: contentStyle,
78835
78926
  "data-action": isInteractive,
78836
78927
  onClick: async (event) => {
78837
- playAudio$1(interaction);
78838
- playAnimation(interaction);
78928
+ playAudio$1();
78929
+ playAnimation();
78839
78930
  if (interaction === "possible") {
78840
78931
  rest.onClick?.(event);
78841
78932
  }
78842
78933
  event.currentTarget.blur();
78843
78934
  },
78844
- drag: true,
78845
- dragConstraints: { top: -12, bottom: 12, left: -12, right: 12 },
78846
- dragElastic: 0,
78847
- dragTransition: { bounceStiffness: 300, bounceDamping: 20 },
78848
- dragSnapToOrigin: true,
78849
- whileDrag: { zIndex: 1 },
78850
78935
  ...linkProps,
78851
78936
  children: [
78852
78937
  /* @__PURE__ */ jsx("div", { className: styles$2Q.gloss }),
@@ -78856,6 +78941,14 @@ const DockMotionItem = (props) => {
78856
78941
  ref: contentRef,
78857
78942
  className: styles$2Q.content,
78858
78943
  style: { filter: blurFilter },
78944
+ whileTap: prefersReducedMotion ? void 0 : {
78945
+ scale: 0.75,
78946
+ transition: {
78947
+ type: "spring",
78948
+ stiffness: 350,
78949
+ damping: 20
78950
+ }
78951
+ },
78859
78952
  children
78860
78953
  }
78861
78954
  )
@@ -81014,7 +81107,7 @@ const EndlessLoader = ({ container }) => {
81014
81107
  return;
81015
81108
  }
81016
81109
  try {
81017
- const GLModule = await import('./gl-BhrwxIv3.js');
81110
+ const GLModule = await import('./gl-sW-Butaq.js');
81018
81111
  if (!isActiveRef.current) {
81019
81112
  return;
81020
81113
  }
@@ -86922,11 +87015,11 @@ const ScrambledText = ({ children, reveal = false }) => {
86922
87015
  );
86923
87016
  };
86924
87017
 
86925
- const root$Y = "_root_n0oie_1";
86926
- const line = "_line_n0oie_9";
86927
- const word$1 = "_word_n0oie_14";
86928
- const link = "_link_n0oie_18";
86929
- const letter = "_letter_n0oie_22";
87018
+ const root$Y = "_root_xdbex_1";
87019
+ const line = "_line_xdbex_9";
87020
+ const word$1 = "_word_xdbex_14";
87021
+ const link = "_link_xdbex_18";
87022
+ const letter = "_letter_xdbex_22";
86930
87023
  const styles$11 = {
86931
87024
  root: root$Y,
86932
87025
  line: line,
@@ -96880,7 +96973,7 @@ const Lock = () => {
96880
96973
  }
96881
96974
  };
96882
96975
  const asynchronously = async () => {
96883
- const Flickity = await import('./index-CU61Vouw.js').then(n => n.i).then((m) => m.default);
96976
+ const Flickity = await import('./index-DXiWfDd0.js').then(n => n.i).then((m) => m.default);
96884
96977
  if (!rowsRef.current || !window) return;
96885
96978
  const rows = rowsRef.current.children;
96886
96979
  for (let i = 0, len = rows.length; i < len; i++) {