@tarsis/toolkit 0.5.8-beta.4 → 0.6.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.
@@ -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-iVv-r1r7.js';
2
2
 
3
3
  /*
4
4
  object-assign
@@ -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-ZUvQTjLa.cjs');
6
6
 
7
7
  /*
8
8
  object-assign
@@ -1,4 +1,4 @@
1
- import { g as getDefaultExportFromCjs } from './index-BsoUKX1n.js';
1
+ import { g as getDefaultExportFromCjs } from './index-iVv-r1r7.js';
2
2
 
3
3
  function _mergeNamespaces(n, m) {
4
4
  for (var i = 0; i < m.length; i++) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index$2 = require('./index-By8OxZ_D.cjs');
3
+ const index$2 = require('./index-ZUvQTjLa.cjs');
4
4
 
5
5
  function _mergeNamespaces(n, m) {
6
6
  for (var i = 0; i < m.length; i++) {
@@ -52114,11 +52114,11 @@ const BubblyParticlesButton = () => {
52114
52114
  return /* @__PURE__ */ jsxRuntime.jsx("button", { className: styles$4H.root, onClick: handleClick, children: "Click me!" });
52115
52115
  };
52116
52116
 
52117
- const root$4i = "_root_se9py_1";
52118
- const button$o = "_button_se9py_13";
52119
- const p$1 = "_p_se9py_26";
52120
- const text$z = "_text_se9py_26";
52121
- const effects = "_effects_se9py_240";
52117
+ const root$4i = "_root_1gkhg_1";
52118
+ const button$o = "_button_1gkhg_13";
52119
+ const p$1 = "_p_1gkhg_26";
52120
+ const text$z = "_text_1gkhg_26";
52121
+ const effects = "_effects_1gkhg_240";
52122
52122
  const styles$4G = {
52123
52123
  root: root$4i,
52124
52124
  button: button$o,
@@ -68248,9 +68248,9 @@ const NeonButton = ({ className = "", ...rest }) => {
68248
68248
  return /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", ...rest, className: clsx(styles$48.root, className), children: "Neon" });
68249
68249
  };
68250
68250
 
68251
- const root$3P = "_root_1fe3u_2";
68252
- const i$6 = "_i_1fe3u_22";
68253
- const text$s = "_text_1fe3u_482";
68251
+ const root$3P = "_root_1453i_2";
68252
+ const i$6 = "_i_1453i_22";
68253
+ const text$s = "_text_1453i_482";
68254
68254
  const styles$47 = {
68255
68255
  root: root$3P,
68256
68256
  i: i$6,
@@ -78374,6 +78374,18 @@ const styles$2S = {
78374
78374
  tooltipContent: tooltipContent
78375
78375
  };
78376
78376
 
78377
+ const getExitOffset = (placement, offsetValue) => {
78378
+ switch (placement) {
78379
+ case "top":
78380
+ return { x: 0, y: offsetValue };
78381
+ case "bottom":
78382
+ return { x: 0, y: -offsetValue };
78383
+ case "left":
78384
+ return { x: offsetValue, y: 0 };
78385
+ case "right":
78386
+ return { x: -offsetValue, y: 0 };
78387
+ }
78388
+ };
78377
78389
  const Tooltip = ({
78378
78390
  children,
78379
78391
  label,
@@ -78386,34 +78398,40 @@ const Tooltip = ({
78386
78398
  }) => {
78387
78399
  const [isOpen, setIsOpen] = React.useState(false);
78388
78400
  const [clicked, setClicked] = React.useState(false);
78401
+ const [isPositioned, setIsPositioned] = React.useState(false);
78389
78402
  const shouldReduceMotion = useReducedMotion();
78390
78403
  const hasFinePointer = useWindowReady.useMatchMedia("(pointer: fine)");
78391
78404
  const isMobile = hasFinePointer === false;
78392
78405
  const timeoutRef = React.useRef(null);
78393
- const variants = shouldReduceMotion ? void 0 : {
78394
- initial: {
78395
- scale: animate ? 0.6 : 1,
78396
- opacity: animate ? 0.8 : 1
78397
- },
78398
- animate: {
78399
- scale: 1,
78400
- opacity: 1,
78401
- transition: {
78402
- type: "spring",
78403
- stiffness: 280,
78404
- damping: 22,
78405
- mass: 0.9
78406
+ const rafRef = React.useRef(null);
78407
+ const variants = React.useMemo(
78408
+ () => shouldReduceMotion ? void 0 : {
78409
+ initial: {
78410
+ scale: animate ? 0.6 : 1,
78411
+ opacity: animate ? 0.8 : 1
78412
+ },
78413
+ animate: {
78414
+ scale: 1,
78415
+ opacity: 1,
78416
+ transition: {
78417
+ type: "spring",
78418
+ stiffness: 280,
78419
+ damping: 22,
78420
+ mass: 0.9
78421
+ }
78422
+ },
78423
+ exit: {
78424
+ scale: 0.3,
78425
+ opacity: 0,
78426
+ ...getExitOffset(placement, offsetValue),
78427
+ transition: {
78428
+ duration: 0.2,
78429
+ ease: [0.33, 1, 0.68, 1]
78430
+ }
78406
78431
  }
78407
78432
  },
78408
- exit: {
78409
- scale: animate ? 0.4 : 1,
78410
- opacity: animate ? 0.8 : 1,
78411
- transition: {
78412
- duration: 0.1,
78413
- ease: "easeIn"
78414
- }
78415
- }
78416
- };
78433
+ [shouldReduceMotion, animate, placement, offsetValue]
78434
+ );
78417
78435
  const { refs, floatingStyles, context } = useFloating({
78418
78436
  open: isOpen,
78419
78437
  onOpenChange: setIsOpen,
@@ -78423,7 +78441,7 @@ const Tooltip = ({
78423
78441
  whileElementsMounted: autoUpdate
78424
78442
  });
78425
78443
  const hover = useHover(context, {
78426
- delay: { open: delay, close: delay },
78444
+ delay: shouldReduceMotion ? 0 : { open: delay, close: delay },
78427
78445
  move: false,
78428
78446
  enabled: disableOnClick ? !clicked : true
78429
78447
  });
@@ -78453,7 +78471,82 @@ const Tooltip = ({
78453
78471
  }
78454
78472
  };
78455
78473
  }, [isOpen, isMobile]);
78456
- const handleClick = (_e) => {
78474
+ React.useEffect(() => {
78475
+ if (!isOpen) {
78476
+ setIsPositioned(false);
78477
+ return;
78478
+ }
78479
+ if (!shouldReduceMotion) {
78480
+ setIsPositioned(true);
78481
+ return;
78482
+ }
78483
+ let attempts = 0;
78484
+ const maxAttempts = 10;
78485
+ const checkPosition = () => {
78486
+ const element = refs.floating.current;
78487
+ if (element) {
78488
+ const rect = element.getBoundingClientRect();
78489
+ if (rect.width > 0 && rect.height > 0 && (rect.left !== 0 || rect.top !== 0)) {
78490
+ setIsPositioned(true);
78491
+ rafRef.current = null;
78492
+ return;
78493
+ }
78494
+ }
78495
+ attempts += 1;
78496
+ if (attempts < maxAttempts) {
78497
+ rafRef.current = requestAnimationFrame(checkPosition);
78498
+ } else {
78499
+ setIsPositioned(true);
78500
+ rafRef.current = null;
78501
+ }
78502
+ };
78503
+ rafRef.current = requestAnimationFrame(checkPosition);
78504
+ return () => {
78505
+ if (rafRef.current !== null) {
78506
+ cancelAnimationFrame(rafRef.current);
78507
+ rafRef.current = null;
78508
+ }
78509
+ };
78510
+ }, [isOpen, shouldReduceMotion]);
78511
+ const tooltipContent = React.useMemo(() => {
78512
+ if (!isOpen) return null;
78513
+ const tooltipWrapper = /* @__PURE__ */ jsxRuntime.jsx(
78514
+ "div",
78515
+ {
78516
+ ref: refs.setFloating,
78517
+ style: {
78518
+ ...floatingStyles,
78519
+ ...shouldReduceMotion && !isPositioned ? { visibility: "hidden" } : {}
78520
+ },
78521
+ ...getFloatingProps(),
78522
+ className: styles$2S.tooltip,
78523
+ children: shouldReduceMotion ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx(styles$2S.tooltipContent, className), children: label }) : /* @__PURE__ */ jsxRuntime.jsx(
78524
+ motion.div,
78525
+ {
78526
+ className: clsx(styles$2S.tooltipContent, className),
78527
+ variants,
78528
+ initial: "initial",
78529
+ animate: "animate",
78530
+ exit: "exit",
78531
+ children: label
78532
+ }
78533
+ )
78534
+ },
78535
+ "tooltip"
78536
+ );
78537
+ return /* @__PURE__ */ jsxRuntime.jsx(FloatingPortal, { children: shouldReduceMotion ? tooltipWrapper : /* @__PURE__ */ jsxRuntime.jsx(AnimatePresence, { mode: "wait", children: tooltipWrapper }) });
78538
+ }, [
78539
+ isOpen,
78540
+ shouldReduceMotion,
78541
+ isPositioned,
78542
+ refs.setFloating,
78543
+ floatingStyles,
78544
+ getFloatingProps,
78545
+ className,
78546
+ label,
78547
+ variants
78548
+ ]);
78549
+ const handleClick = React.useCallback(() => {
78457
78550
  if (disableOnClick) {
78458
78551
  setClicked(true);
78459
78552
  setIsOpen(false);
@@ -78461,25 +78554,30 @@ const Tooltip = ({
78461
78554
  if (isMobile) {
78462
78555
  setIsOpen(true);
78463
78556
  }
78464
- };
78465
- const handleMouseLeave = (_e) => {
78557
+ }, [disableOnClick, isMobile]);
78558
+ const handleMouseLeave = React.useCallback(() => {
78466
78559
  if (disableOnClick) {
78467
78560
  setClicked(false);
78468
78561
  }
78469
- };
78470
- const mergeEventHandler = (childHandler, tooltipHandler) => {
78471
- return (e) => {
78472
- childHandler?.(e);
78473
- tooltipHandler?.(e);
78474
- };
78475
- };
78476
- const childRef = React.isValidElement(children) && children.props && children.props.ref ? children.props.ref : null;
78562
+ }, [disableOnClick]);
78563
+ const mergeEventHandler = React.useCallback(
78564
+ (childHandler, tooltipHandler) => {
78565
+ return (e) => {
78566
+ childHandler?.(e);
78567
+ tooltipHandler?.(e);
78568
+ };
78569
+ },
78570
+ []
78571
+ );
78572
+ const childRef = React.useMemo(() => {
78573
+ if (!React.isValidElement(children)) return null;
78574
+ const props = children.props;
78575
+ return props?.ref ?? null;
78576
+ }, [children]);
78477
78577
  const mergedRef = useMergeRefs([refs.setReference, childRef]);
78478
- if (React.isValidElement(children)) {
78479
- const childElement = children;
78480
- const childProps = childElement.props;
78481
- const tooltipProps = getReferenceProps();
78482
- const mergedProps = {
78578
+ const tooltipProps = React.useMemo(() => getReferenceProps(), [getReferenceProps]);
78579
+ const createMergedProps = React.useCallback(
78580
+ (childProps) => ({
78483
78581
  ...childProps,
78484
78582
  ref: mergedRef,
78485
78583
  onClick: mergeEventHandler(
@@ -78505,30 +78603,39 @@ const Tooltip = ({
78505
78603
  childProps.onBlur,
78506
78604
  tooltipProps.onBlur
78507
78605
  )
78508
- };
78606
+ }),
78607
+ [
78608
+ mergedRef,
78609
+ mergeEventHandler,
78610
+ handleClick,
78611
+ handleMouseLeave,
78612
+ tooltipProps.onMouseEnter,
78613
+ tooltipProps.onMouseLeave,
78614
+ tooltipProps.onFocus,
78615
+ tooltipProps.onBlur
78616
+ ]
78617
+ );
78618
+ const spanProps = React.useMemo(
78619
+ () => ({
78620
+ ...tooltipProps,
78621
+ onClick: mergeEventHandler(
78622
+ tooltipProps.onClick,
78623
+ handleClick
78624
+ ),
78625
+ onMouseLeave: mergeEventHandler(
78626
+ tooltipProps.onMouseLeave,
78627
+ handleMouseLeave
78628
+ )
78629
+ }),
78630
+ [tooltipProps, mergeEventHandler, handleClick, handleMouseLeave]
78631
+ );
78632
+ if (React.isValidElement(children)) {
78633
+ const childElement = children;
78634
+ const childProps = childElement.props;
78635
+ const mergedProps = createMergedProps(childProps);
78509
78636
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
78510
78637
  React.cloneElement(childElement, mergedProps),
78511
- /* @__PURE__ */ jsxRuntime.jsx(FloatingPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(AnimatePresence, { mode: "wait", children: isOpen && /* @__PURE__ */ jsxRuntime.jsx(
78512
- "div",
78513
- {
78514
- ref: refs.setFloating,
78515
- style: floatingStyles,
78516
- ...getFloatingProps(),
78517
- className: styles$2S.tooltip,
78518
- children: /* @__PURE__ */ jsxRuntime.jsx(
78519
- motion.div,
78520
- {
78521
- className: clsx(styles$2S.tooltipContent, className),
78522
- variants,
78523
- initial: shouldReduceMotion ? void 0 : "initial",
78524
- animate: shouldReduceMotion ? void 0 : "animate",
78525
- exit: shouldReduceMotion ? void 0 : "exit",
78526
- children: label
78527
- }
78528
- )
78529
- },
78530
- "tooltip"
78531
- ) }) })
78638
+ tooltipContent
78532
78639
  ] });
78533
78640
  }
78534
78641
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
@@ -78536,37 +78643,12 @@ const Tooltip = ({
78536
78643
  "span",
78537
78644
  {
78538
78645
  ref: refs.setReference,
78539
- ...getReferenceProps(),
78540
- onClick: handleClick,
78541
- onMouseLeave: mergeEventHandler(
78542
- getReferenceProps().onMouseLeave,
78543
- handleMouseLeave
78544
- ),
78646
+ ...spanProps,
78545
78647
  style: { display: "contents" },
78546
78648
  children
78547
78649
  }
78548
78650
  ),
78549
- /* @__PURE__ */ jsxRuntime.jsx(FloatingPortal, { children: /* @__PURE__ */ jsxRuntime.jsx(AnimatePresence, { mode: "wait", children: isOpen && /* @__PURE__ */ jsxRuntime.jsx(
78550
- "div",
78551
- {
78552
- ref: refs.setFloating,
78553
- style: floatingStyles,
78554
- ...getFloatingProps(),
78555
- className: styles$2S.tooltip,
78556
- children: /* @__PURE__ */ jsxRuntime.jsx(
78557
- motion.div,
78558
- {
78559
- className: clsx(styles$2S.tooltipContent, className),
78560
- variants,
78561
- initial: shouldReduceMotion ? void 0 : "initial",
78562
- animate: shouldReduceMotion ? void 0 : "animate",
78563
- exit: shouldReduceMotion ? void 0 : "exit",
78564
- children: label
78565
- }
78566
- )
78567
- },
78568
- "tooltip"
78569
- ) }) })
78651
+ tooltipContent
78570
78652
  ] });
78571
78653
  };
78572
78654
 
@@ -78812,14 +78894,17 @@ const DockMotionItem = (props) => {
78812
78894
  hover === true && prefersReducedMotion === false
78813
78895
  // maybe add `& isInteractive`
78814
78896
  );
78815
- const contentStyle = React.useMemo(
78816
- () => ({
78897
+ const contentStyle = React.useMemo(() => {
78898
+ return prefersReducedMotion ? {
78899
+ width: baseWidth * targetMultiplier,
78900
+ height: baseWidth,
78901
+ originX: "center"
78902
+ } : {
78817
78903
  width: dynamicWidth,
78818
78904
  height: size,
78819
78905
  originX: "center"
78820
- }),
78821
- [dynamicWidth, size]
78822
- );
78906
+ };
78907
+ }, [dynamicWidth, size, prefersReducedMotion, targetMultiplier]);
78823
78908
  const ContentElement = React.useMemo(() => {
78824
78909
  if (rest.use && typeof rest.use !== "string") {
78825
78910
  return motion.create(rest.use);
@@ -78848,7 +78933,7 @@ const DockMotionItem = (props) => {
78848
78933
  {
78849
78934
  ref: scope,
78850
78935
  layoutId: itemId,
78851
- layout: true,
78936
+ layout: prefersReducedMotion ? false : true,
78852
78937
  className: clsx(styles$2Q.item, className),
78853
78938
  onMouseEnter,
78854
78939
  style: contentStyle,
@@ -78861,12 +78946,6 @@ const DockMotionItem = (props) => {
78861
78946
  }
78862
78947
  event.currentTarget.blur();
78863
78948
  },
78864
- drag: true,
78865
- dragConstraints: { top: -12, bottom: 12, left: -12, right: 12 },
78866
- dragElastic: 0,
78867
- dragTransition: { bounceStiffness: 300, bounceDamping: 20 },
78868
- dragSnapToOrigin: true,
78869
- whileDrag: { zIndex: 1 },
78870
78949
  ...linkProps,
78871
78950
  children: [
78872
78951
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles$2Q.gloss }),
@@ -78876,6 +78955,14 @@ const DockMotionItem = (props) => {
78876
78955
  ref: contentRef,
78877
78956
  className: styles$2Q.content,
78878
78957
  style: { filter: blurFilter },
78958
+ whileTap: prefersReducedMotion ? void 0 : {
78959
+ scale: 0.75,
78960
+ transition: {
78961
+ type: "spring",
78962
+ stiffness: 350,
78963
+ damping: 20
78964
+ }
78965
+ },
78879
78966
  children
78880
78967
  }
78881
78968
  )
@@ -81034,7 +81121,7 @@ const EndlessLoader = ({ container }) => {
81034
81121
  return;
81035
81122
  }
81036
81123
  try {
81037
- const GLModule = await Promise.resolve().then(() => require('./gl-BWeWNwfK.cjs'));
81124
+ const GLModule = await Promise.resolve().then(() => require('./gl-DgFYXJsQ.cjs'));
81038
81125
  if (!isActiveRef.current) {
81039
81126
  return;
81040
81127
  }
@@ -86942,11 +87029,11 @@ const ScrambledText = ({ children, reveal = false }) => {
86942
87029
  );
86943
87030
  };
86944
87031
 
86945
- const root$Y = "_root_n0oie_1";
86946
- const line = "_line_n0oie_9";
86947
- const word$1 = "_word_n0oie_14";
86948
- const link = "_link_n0oie_18";
86949
- const letter = "_letter_n0oie_22";
87032
+ const root$Y = "_root_1b6o2_1";
87033
+ const line = "_line_1b6o2_9";
87034
+ const word$1 = "_word_1b6o2_14";
87035
+ const link = "_link_1b6o2_18";
87036
+ const letter = "_letter_1b6o2_22";
86950
87037
  const styles$11 = {
86951
87038
  root: root$Y,
86952
87039
  line: line,
@@ -96900,7 +96987,7 @@ const Lock = () => {
96900
96987
  }
96901
96988
  };
96902
96989
  const asynchronously = async () => {
96903
- const Flickity = await Promise.resolve().then(() => require('./index-BHvZMLod.cjs')).then(n => n.index).then((m) => m.default);
96990
+ const Flickity = await Promise.resolve().then(() => require('./index-C5pCwB7N.cjs')).then(n => n.index).then((m) => m.default);
96904
96991
  if (!rowsRef.current || !window) return;
96905
96992
  const rows = rowsRef.current.children;
96906
96993
  for (let i = 0, len = rows.length; i < len; i++) {