@omerdlw/base-framework 3.0.0 → 3.0.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.
@@ -410,27 +410,13 @@ var DOCK_SURFACE_PHASE = Object.freeze({
410
410
  });
411
411
  var VIEWPORT_MARGIN = 24;
412
412
  var DOCK_CARD_DIMENSIONS = Object.freeze({
413
- expandedY: -72,
414
413
  chromeHeight: 20,
415
- collapsedY: -10,
416
- extensionShelfY: -42,
417
- extensionShelfScale: 0.94,
418
414
  extensionShelfHeight: 45,
419
415
  hudHeight: 52,
420
416
  actionGap: 10,
421
417
  height: 68
422
418
  });
423
419
  var DOCK_CARD_LAYOUT = Object.freeze({
424
- collapsed: Object.freeze({
425
- offsetY: DOCK_CARD_DIMENSIONS.collapsedY,
426
- scale: 0.88
427
- }),
428
- expanded: Object.freeze({
429
- offsetY: DOCK_CARD_DIMENSIONS.expandedY,
430
- scale: 1
431
- }),
432
- extensionShelfY: DOCK_CARD_DIMENSIONS.extensionShelfY,
433
- extensionShelfScale: DOCK_CARD_DIMENSIONS.extensionShelfScale,
434
420
  extensionShelfHeight: DOCK_CARD_DIMENSIONS.extensionShelfHeight,
435
421
  chromeHeight: DOCK_CARD_DIMENSIONS.chromeHeight,
436
422
  hudHeight: DOCK_CARD_DIMENSIONS.hudHeight,
@@ -499,7 +485,6 @@ var STATUS_CLEAR_DURATION = 4500;
499
485
  var API_ERROR_BATCH_DELAY = 300;
500
486
  var DOCK_HEIGHT_BUFFER = 16;
501
487
  var HEIGHT_EPSILON = 0.5;
502
- var MAX_VISIBLE_STACKED_CARDS = 3;
503
488
  var dockTheme = defineThemeSpec("dock");
504
489
  var DockContext = getOrCreateGlobalContext(
505
490
  "DockContext",
@@ -1598,10 +1583,6 @@ var DOCK_SURFACE_DRAG_CONSTRAINTS = Object.freeze({
1598
1583
  top: 0,
1599
1584
  bottom: 0
1600
1585
  });
1601
- var DOCK_SURFACE_DRAG_THRESHOLDS = Object.freeze({
1602
- DISMISS_OFFSET_Y: 65,
1603
- DISMISS_VELOCITY_Y: 400
1604
- });
1605
1586
  function toGpuTransform(y = 0, scale = 1, x = 0) {
1606
1587
  return gpuTransform(y, scale, x);
1607
1588
  }
@@ -1637,42 +1618,37 @@ function getDockMediaVolumeThumbAnimateProps(motion2, { isDragging = false } = {
1637
1618
  function getDockMediaVolumeThumbPositionTransition(motion2, { isDragging = false } = {}) {
1638
1619
  return isDragging ? "none" : cssTransition("left", motion2.transitions.mediaVolume);
1639
1620
  }
1640
- function getDockSurfaceStackScale(motion2, surfacePhase) {
1641
- if (surfacePhase === DOCK_SURFACE_PHASE.DISMISSING_ACTION) {
1642
- return motion2.deck.compress.open;
1643
- }
1644
- if (surfacePhase === DOCK_SURFACE_PHASE.CLOSING_ANTICIPATION) {
1645
- return motion2.deck.compress.close;
1646
- }
1647
- return 1;
1621
+ var SURFACE_PHASE_KEYS = Object.freeze({
1622
+ [DOCK_SURFACE_PHASE.IDLE]: "idle",
1623
+ [DOCK_SURFACE_PHASE.DISMISSING_ACTION]: "dismissAction",
1624
+ [DOCK_SURFACE_PHASE.EXPANDING_BODY]: "expandBody",
1625
+ [DOCK_SURFACE_PHASE.OPEN]: "open",
1626
+ [DOCK_SURFACE_PHASE.CLOSING_ANTICIPATION]: "anticipation",
1627
+ [DOCK_SURFACE_PHASE.COLLAPSING_BODY]: "collapseBody",
1628
+ [DOCK_SURFACE_PHASE.RESTORING_HEADER]: "restoreHeader"
1629
+ });
1630
+ function getDockPhaseMotion(motion2, surfacePhase) {
1631
+ const key = surfacePhase && SURFACE_PHASE_KEYS[surfacePhase] || "idle";
1632
+ return motion2.phases[key];
1648
1633
  }
1649
1634
  function getDockStackTransformTransition(motion2, surfacePhase, fallbackTransition) {
1650
- if (surfacePhase === DOCK_SURFACE_PHASE.EXPANDING_BODY) {
1651
- return motion2.transitions.surfaceArrival;
1652
- }
1653
- if (surfacePhase === DOCK_SURFACE_PHASE.DISMISSING_ACTION || surfacePhase === DOCK_SURFACE_PHASE.CLOSING_ANTICIPATION) {
1654
- return motion2.transitions.anticipation;
1655
- }
1656
- return fallbackTransition;
1635
+ return getDockPhaseMotion(motion2, surfacePhase).transform ?? fallbackTransition;
1657
1636
  }
1658
1637
  function getDockStackTransition(motion2, {
1659
1638
  expanded = false,
1660
1639
  resizeDistance = 0,
1661
1640
  surfacePhase = null
1662
1641
  } = {}) {
1663
- if (surfacePhase === DOCK_SURFACE_PHASE.EXPANDING_BODY) {
1664
- return motion2.transitions.expand;
1665
- }
1666
- if (surfacePhase === DOCK_SURFACE_PHASE.OPEN || surfacePhase === DOCK_SURFACE_PHASE.CLOSING_ANTICIPATION) {
1667
- return motion2.transitions.surfaceResize(
1668
- resizeDistance > 0 ? resizeDistance : 260
1669
- );
1670
- }
1671
- if (surfacePhase === DOCK_SURFACE_PHASE.COLLAPSING_BODY || surfacePhase === DOCK_SURFACE_PHASE.RESTORING_HEADER) {
1672
- return motion2.transitions.expand;
1642
+ const { deck } = getDockPhaseMotion(motion2, surfacePhase);
1643
+ if (typeof deck === "function") {
1644
+ return deck(resizeDistance > 0 ? resizeDistance : motion2.deck.resizeFallback);
1673
1645
  }
1646
+ if (deck) return deck;
1674
1647
  return expanded ? motion2.transitions.expand : motion2.transitions.stack;
1675
1648
  }
1649
+ function getDockLayoutTransition(motion2) {
1650
+ return { layout: motion2.transitions.layout };
1651
+ }
1676
1652
  function getDockStackAnimateProps(motion2, {
1677
1653
  width,
1678
1654
  height,
@@ -1683,7 +1659,7 @@ function getDockStackAnimateProps(motion2, {
1683
1659
  }) {
1684
1660
  const safeWidth = Number(width);
1685
1661
  const safeHeight = Number(height);
1686
- const liftAmount = isBreadcrumbsVisible ? -44 : 0;
1662
+ const liftAmount = isBreadcrumbsVisible ? motion2.deck.breadcrumbOffset : 0;
1687
1663
  return {
1688
1664
  width: Math.max(0, Math.round(Number.isFinite(safeWidth) ? safeWidth : 0)),
1689
1665
  height: Math.max(
@@ -1692,9 +1668,9 @@ function getDockStackAnimateProps(motion2, {
1692
1668
  ),
1693
1669
  transform: toGpuTransform(
1694
1670
  liftAmount,
1695
- getDockSurfaceStackScale(motion2, surfacePhase)
1671
+ getDockPhaseMotion(motion2, surfacePhase).scale
1696
1672
  ),
1697
- opacity: isFullscreen ? 0 : 1,
1673
+ opacity: isFullscreen ? motion2.deck.fullscreenOpacity : 1,
1698
1674
  boxShadow: isSurfaceActive ? motion2.deck.elevation.elevated : motion2.deck.elevation.rest,
1699
1675
  pointerEvents: isFullscreen ? "none" : "auto"
1700
1676
  };
@@ -1759,7 +1735,7 @@ function getDockItemExitValues(motion2, {
1759
1735
  return motion2.deck.exit({
1760
1736
  position: safePosition,
1761
1737
  scale: motionValues && Number.isFinite(motionValues.scale) ? motionValues.scale : null,
1762
- y: motionValues && Number.isFinite(motionValues.y) ? motionValues.y : safePosition * DOCK_CARD_DIMENSIONS.collapsedY
1738
+ y: motionValues && Number.isFinite(motionValues.y) ? motionValues.y : safePosition * motion2.deck.stacking.collapsed.offsetY
1763
1739
  });
1764
1740
  }
1765
1741
  function getDockCardContentAnimateProps(motion2, {
@@ -2203,7 +2179,8 @@ function useDockSurfaceShellModel({
2203
2179
  const handleDragEnd = (_event, info) => {
2204
2180
  if (!isActive || !allowSwipeDismiss || typeof onClose !== "function" || !isFullyOpen)
2205
2181
  return;
2206
- if (info.offset.y > DOCK_SURFACE_DRAG_THRESHOLDS.DISMISS_OFFSET_Y || info.velocity.y > DOCK_SURFACE_DRAG_THRESHOLDS.DISMISS_VELOCITY_Y) {
2182
+ const { dismiss } = dockMotion.drag;
2183
+ if (info.offset.y > dismiss.offset || info.velocity.y > dismiss.velocity) {
2207
2184
  onClose();
2208
2185
  }
2209
2186
  };
@@ -2228,12 +2205,12 @@ function useDockSurfaceShellModel({
2228
2205
  const resolvedSurfaceId = surfaceId || "active";
2229
2206
  const bodyVariants = useMemo(() => {
2230
2207
  const { surfaceBody } = dockMotion.variants;
2231
- const { surfaceEnter, surfaceExit, surfaceStep } = dockMotion.transitions;
2208
+ const { surfaceExit } = dockMotion.transitions;
2232
2209
  return {
2233
2210
  hidden: surfaceBody.hidden,
2234
2211
  visible: {
2235
2212
  ...surfaceBody.visible,
2236
- transition: surfacePhase === DOCK_SURFACE_PHASE.EXPANDING_BODY ? surfaceEnter : surfaceStep
2213
+ transition: getDockPhaseMotion(dockMotion, surfacePhase).body
2237
2214
  },
2238
2215
  exit: {
2239
2216
  ...surfaceBody.exit,
@@ -2329,11 +2306,12 @@ function getDockItemCardProps({
2329
2306
  hasExtensions = false,
2330
2307
  isAnchoredToBottom,
2331
2308
  position,
2309
+ stacking,
2332
2310
  theme,
2333
- visibleCount = 3
2311
+ visibleCount = stacking.visible.stack
2334
2312
  }) {
2335
- const { offsetY: collapsedOffsetY, scale: collapsedScale } = DOCK_CARD_LAYOUT.collapsed;
2336
- const { offsetY: expandedOffsetY } = DOCK_CARD_LAYOUT.expanded;
2313
+ const { offsetY: collapsedOffsetY, scale: collapsedScale } = stacking.collapsed;
2314
+ const { offsetY: expandedOffsetY } = stacking.expanded;
2337
2315
  const safeCardStyle = { ...cardStyle };
2338
2316
  delete safeCardStyle.scale;
2339
2317
  delete safeCardStyle.className;
@@ -2341,10 +2319,12 @@ function getDockItemCardProps({
2341
2319
  const isShelf = !expanded && position === 1 && hasExtensions;
2342
2320
  const isHeavyBlur = position < visibleCount || expanded || isShelf;
2343
2321
  const collapsedScaleValue = collapsedScale ** position;
2344
- const y = expanded ? position * expandedOffsetY : isShelf ? DOCK_CARD_LAYOUT.extensionShelfY : position * collapsedOffsetY;
2345
- const shelfScale = DOCK_CARD_LAYOUT.extensionShelfScale ?? 0.94;
2346
- const scale = expanded ? cardScale || 1 : isShelf ? shelfScale : collapsedScaleValue;
2347
- const collapsedOpacity = Math.max(0.1, +(1 - position * 0.2).toFixed(2));
2322
+ const y = expanded ? position * expandedOffsetY : isShelf ? stacking.shelf.offsetY : position * collapsedOffsetY;
2323
+ const scale = expanded ? cardScale || 1 : isShelf ? stacking.shelf.scale : collapsedScaleValue;
2324
+ const collapsedOpacity = Math.max(
2325
+ stacking.collapsed.opacityMin,
2326
+ +(1 - position * stacking.collapsed.opacityStep).toFixed(2)
2327
+ );
2348
2328
  const opacity = expanded || isShelf ? 1 : position < visibleCount ? collapsedOpacity : 0;
2349
2329
  return {
2350
2330
  className: cn(theme.slots.card, cardStyle?.className),
@@ -2626,6 +2606,10 @@ function removeInactiveLoadingItems(items = [], activeItem = null) {
2626
2606
  (item) => !item?.isLoading || isSameItem(item, activeItem)
2627
2607
  );
2628
2608
  }
2609
+ function stackRank(item) {
2610
+ if (typeof item.stackOrder === "number") return item.stackOrder;
2611
+ return item.path === "/" ? Number.POSITIVE_INFINITY : 0;
2612
+ }
2629
2613
  function reorderItemsWithActiveFirst(items, activeIndex) {
2630
2614
  if (activeIndex === -1) return items;
2631
2615
  const active = items[activeIndex];
@@ -2633,7 +2617,7 @@ function reorderItemsWithActiveFirst(items, activeIndex) {
2633
2617
  ...items.slice(0, activeIndex),
2634
2618
  ...items.slice(activeIndex + 1)
2635
2619
  ];
2636
- rest.sort((a, b) => a.path === "/" ? 1 : b.path === "/" ? -1 : 0);
2620
+ rest.sort((a, b) => stackRank(a) - stackRank(b));
2637
2621
  return [active, ...rest];
2638
2622
  }
2639
2623
  function shouldRenderInlineAction({
@@ -3738,7 +3722,7 @@ function useDockCardItemModel({
3738
3722
  hidden: headerRestore.hidden,
3739
3723
  visible: {
3740
3724
  ...visible,
3741
- transition: item.surfacePhase === DOCK_SURFACE_PHASE.COLLAPSING_BODY ? dockMotion.transitions.surfaceEnter : visible.transition
3725
+ transition: getDockPhaseMotion(dockMotion, item.surfacePhase).headerReturn ?? visible.transition
3742
3726
  },
3743
3727
  exit: headerRestore.exit
3744
3728
  };
@@ -3802,7 +3786,7 @@ function useDockCardItemModel({
3802
3786
  !expanded && position > 0 && !isExtensionShelf
3803
3787
  );
3804
3788
  const isCollapsedGhostCard = Boolean(
3805
- !expanded && position >= MAX_VISIBLE_STACKED_CARDS && !isExtensionShelf
3789
+ !expanded && position >= dockMotion.deck.stacking.visible.stack && !isExtensionShelf
3806
3790
  );
3807
3791
  const {
3808
3792
  className: cardClassName,
@@ -3816,7 +3800,8 @@ function useDockCardItemModel({
3816
3800
  cardScale: itemStyle.scale,
3817
3801
  theme,
3818
3802
  isAnchoredToBottom: item.isSurface,
3819
- visibleCount: item.isStatus && !isStackHovered ? 1 : hasExtensions && !expanded ? 2 : 3,
3803
+ stacking: dockMotion.deck.stacking,
3804
+ visibleCount: item.isStatus && !isStackHovered ? dockMotion.deck.stacking.visible.status : hasExtensions && !expanded ? dockMotion.deck.stacking.visible.extensions : dockMotion.deck.stacking.visible.stack,
3820
3805
  hasExtensions
3821
3806
  });
3822
3807
  const cardDelay = useMemo(
@@ -6180,8 +6165,7 @@ function useDockLayout({
6180
6165
  }, [pathname, dockItems, activeItem]);
6181
6166
  return {
6182
6167
  displayItems,
6183
- activeIndex: displayActiveIndex,
6184
- MAX_VISIBLE_STACKED_CARDS
6168
+ activeIndex: displayActiveIndex
6185
6169
  };
6186
6170
  }
6187
6171
  function useDock() {
@@ -6665,7 +6649,7 @@ var DockCardBanner = memo(function DockCardBanner2({
6665
6649
  const resolvedPosition = bannerPosition || bannerObj?.position || bannerObj?.bannerPosition || "center 45%";
6666
6650
  const resolvedSize = bannerSize || bannerObj?.size || bannerObj?.bannerSize || "cover";
6667
6651
  const resolvedRepeat = bannerRepeat || bannerObj?.repeat || bannerObj?.bannerRepeat || "no-repeat";
6668
- const resolvedOpacity = bannerOpacity ?? bannerObj?.opacity ?? bannerObj?.bannerOpacity ?? 0.95;
6652
+ const resolvedOpacity = bannerOpacity ?? bannerObj?.opacity ?? bannerObj?.bannerOpacity ?? dockMotion.opacity.banner;
6669
6653
  return /* @__PURE__ */ jsxs(
6670
6654
  motion.div,
6671
6655
  {
@@ -6807,9 +6791,9 @@ var DockDescription = memo(function DockDescription2({
6807
6791
  const theme = useDockTheme();
6808
6792
  if (text == null || text === "") return null;
6809
6793
  const { className, inlineStyle } = splitStyle(style);
6810
- const { opacity = 0.7, ...restStyle } = inlineStyle;
6794
+ const { opacity = dockMotion.opacity.description, ...restStyle } = inlineStyle;
6811
6795
  const isMultiline = Number(maxLines) > 1;
6812
- const targetOpacity = typeof opacity === "number" ? opacity : 0.7;
6796
+ const targetOpacity = typeof opacity === "number" ? opacity : dockMotion.opacity.description;
6813
6797
  const sharedClass = cn(theme.slots.descriptionText, className);
6814
6798
  const sharedStyle = {
6815
6799
  opacity: targetOpacity,
@@ -7373,7 +7357,7 @@ var DockSurfaceControls = memo(function DockSurfaceControls2({
7373
7357
  const isControlsVisible = Boolean(
7374
7358
  isBodyVisible && (activeItem ? activeItem.isSurface !== false : true) && activeControlKeys.length > 0
7375
7359
  );
7376
- const targetY = hasExtensions ? DOCK_CARD_LAYOUT.extensionShelfY - DOCK_CARD_LAYOUT.collapsed.offsetY : 0;
7360
+ const targetY = hasExtensions ? dockMotion.deck.stacking.shelf.offsetY - dockMotion.deck.stacking.collapsed.offsetY : 0;
7377
7361
  return /* @__PURE__ */ jsx(AnimatePresence, { children: isControlsVisible && /* @__PURE__ */ jsx(
7378
7362
  motion.div,
7379
7363
  {
@@ -7442,6 +7426,7 @@ var DockSurfaceControls = memo(function DockSurfaceControls2({
7442
7426
  motion.div,
7443
7427
  {
7444
7428
  layout: "position",
7429
+ transition: getDockLayoutTransition(dockMotion),
7445
7430
  variants: dockMotion.variants.controlsClose,
7446
7431
  initial: "hidden",
7447
7432
  animate: "visible",
@@ -8016,7 +8001,7 @@ var DockCardItem = memo(function DockCardItem2({
8016
8001
  initial: "hidden",
8017
8002
  animate: item.surfacePhase === DOCK_SURFACE_PHASE.DISMISSING_ACTION ? "hidden" : "visible",
8018
8003
  exit: layerExit,
8019
- transition: item.surfacePhase === DOCK_SURFACE_PHASE.DISMISSING_ACTION ? dockMotion.transitions.anticipation : dockMotion.transitions.headerSwap,
8004
+ transition: getDockPhaseMotion(dockMotion, item.surfacePhase).header,
8020
8005
  style: { ...DOCK_COMPOSITOR_STYLE, willChange: "transform" },
8021
8006
  className: theme.slots.cardStandard,
8022
8007
  children: item.isLoading ? /* @__PURE__ */ jsx(LoadingItemContent, {}) : /* @__PURE__ */ jsx(
@@ -8253,6 +8238,7 @@ var DockBreadcrumbsCard = memo(function DockBreadcrumbsCard2({
8253
8238
  motion.div,
8254
8239
  {
8255
8240
  layout: "position",
8241
+ transition: getDockLayoutTransition(dockMotion),
8256
8242
  className: theme.slots.breadcrumbsItem,
8257
8243
  children: [
8258
8244
  isLast ? /* @__PURE__ */ jsx("span", { className: theme.slots.breadcrumbsCurrent, children: crumb.title }) : /* @__PURE__ */ jsx(
@@ -8332,7 +8318,7 @@ function Dock() {
8332
8318
  "data-controls-hidden": expanded || activeItem?.isSurface ? "true" : "false",
8333
8319
  style: {
8334
8320
  ...theme.styles.stack,
8335
- transformOrigin: "50% 100%"
8321
+ transformOrigin: dockMotion.deck.origin
8336
8322
  },
8337
8323
  initial: false,
8338
8324
  animate: getDockStackAnimateProps(dockMotion, {
@@ -9737,5 +9723,5 @@ var dockModule = defineModule({
9737
9723
  });
9738
9724
 
9739
9725
  export { DOCK_EVENTS, DOCK_HUD_PRIORITY, DOCK_HUD_RENDER_MODE, DOCK_HUD_VARIANT, Dock, DockCardBanner, DockCardHeader, DockDescription, DockIcon, DockProvider, DockSurfaceAction, DockSurfaceExtension, DockSurfaceHeaderButton, DockTitle, ErrorActions, GuardActions, createDockGuardRegistry, createErrorStatus, createGuardStatus, createInlineSurfaceEntry, createSurfaceEntryDefinition, createSurfaceFlowBuilder, defineBreadcrumb, defineDockAction, defineHud, defineStepSurface, defineSurface, dockModule, dockTheme, isValidBannerUrl, useDock, useDockActionClass, useDockActions, useDockBanner, useDockConfig, useDockContextActions, useDockDimensions, useDockGuard, useDockHeight, useDockHud, useDockMotion, useDockRegistration, useDockSelector, useDockState, useDockTheme, useHud, useOptionalDockActions, useOptionalDockState, useSurface, useSurfaceAction, useSurfaceDimensions, useSurfaceFlow, useSurfaceHeader, useSurfaceId, useSurfaceReturn, useSurfaceStep };
9740
- //# sourceMappingURL=chunk-JIXBFFRD.js.map
9741
- //# sourceMappingURL=chunk-JIXBFFRD.js.map
9726
+ //# sourceMappingURL=chunk-WVRMABDN.js.map
9727
+ //# sourceMappingURL=chunk-WVRMABDN.js.map