@omerdlw/base-framework 2.0.0 → 2.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.
@@ -1,8 +1,8 @@
1
1
  import { modalModule } from './chunk-FIMPHODX.js';
2
2
  import { ambientModule } from './chunk-QXR55VVS.js';
3
3
  import { backgroundModule } from './chunk-CGHZSSFR.js';
4
- import { contextMenuModule } from './chunk-65ZB4QTQ.js';
5
- import { dockModule } from './chunk-3MSK4XGK.js';
4
+ import { contextMenuModule } from './chunk-SKBITB5X.js';
5
+ import { dockModule } from './chunk-A5RE3F6O.js';
6
6
  import { notificationModule } from './chunk-SYAVGTOX.js';
7
7
  import { mediaModule } from './chunk-R2YGFJDJ.js';
8
8
  import { controlsModule } from './chunk-4GMQKD6F.js';
@@ -22,5 +22,5 @@ var defaultModules = Object.freeze([
22
22
  ]);
23
23
 
24
24
  export { defaultModules };
25
- //# sourceMappingURL=chunk-KKQT46TP.js.map
26
- //# sourceMappingURL=chunk-KKQT46TP.js.map
25
+ //# sourceMappingURL=chunk-6ZJVLUBE.js.map
26
+ //# sourceMappingURL=chunk-6ZJVLUBE.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAsBO,IAAM,cAAA,GAAiB,OAAO,MAAA,CAAO;AAAA,EAC1C,gBAAA;AAAA,EACA,aAAA;AAAA,EACA,UAAA;AAAA,EACA,cAAA;AAAA,EACA,iBAAA;AAAA,EACA,aAAA;AAAA,EACA,WAAA;AAAA,EACA,WAAA;AAAA,EACA;AACF,CAAU","file":"chunk-KKQT46TP.js","sourcesContent":["import { ambientModule } from \"./ambient/module\";\nimport { backgroundModule } from \"./background/module\";\nimport { contextMenuModule } from \"./context-menu/module\";\nimport { controlsModule } from \"./controls/module\";\nimport { dockModule } from \"./dock/module\";\nimport { loadingModule } from \"./loading/module\";\nimport { mediaModule } from \"./media/module\";\nimport { modalModule } from \"./modal/module\";\nimport { notificationModule } from \"./notification/module\";\n\nexport {\n ambientModule,\n backgroundModule,\n contextMenuModule,\n controlsModule,\n dockModule,\n loadingModule,\n mediaModule,\n modalModule,\n notificationModule,\n};\n\nexport const defaultModules = Object.freeze([\n backgroundModule,\n ambientModule,\n dockModule,\n controlsModule,\n contextMenuModule,\n loadingModule,\n mediaModule,\n modalModule,\n notificationModule,\n] as const);\n"]}
1
+ {"version":3,"sources":["../src/modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAsBO,IAAM,cAAA,GAAiB,OAAO,MAAA,CAAO;AAAA,EAC1C,gBAAA;AAAA,EACA,aAAA;AAAA,EACA,UAAA;AAAA,EACA,cAAA;AAAA,EACA,iBAAA;AAAA,EACA,aAAA;AAAA,EACA,WAAA;AAAA,EACA,WAAA;AAAA,EACA;AACF,CAAU","file":"chunk-6ZJVLUBE.js","sourcesContent":["import { ambientModule } from \"./ambient/module\";\nimport { backgroundModule } from \"./background/module\";\nimport { contextMenuModule } from \"./context-menu/module\";\nimport { controlsModule } from \"./controls/module\";\nimport { dockModule } from \"./dock/module\";\nimport { loadingModule } from \"./loading/module\";\nimport { mediaModule } from \"./media/module\";\nimport { modalModule } from \"./modal/module\";\nimport { notificationModule } from \"./notification/module\";\n\nexport {\n ambientModule,\n backgroundModule,\n contextMenuModule,\n controlsModule,\n dockModule,\n loadingModule,\n mediaModule,\n modalModule,\n notificationModule,\n};\n\nexport const defaultModules = Object.freeze([\n backgroundModule,\n ambientModule,\n dockModule,\n controlsModule,\n contextMenuModule,\n loadingModule,\n mediaModule,\n modalModule,\n notificationModule,\n] as const);\n"]}
@@ -1608,6 +1608,10 @@ var DOCK_COMPOSITOR_STYLE = Object.freeze({
1608
1608
  backfaceVisibility: "hidden",
1609
1609
  transform: "translateZ(0)"
1610
1610
  });
1611
+ var DOCK_UNSEEN_EXIT = Object.freeze({
1612
+ opacity: 0,
1613
+ transition: Object.freeze({ duration: 0 })
1614
+ });
1611
1615
  var DOCK_SURFACE_DRAG_CONSTRAINTS = Object.freeze({
1612
1616
  top: 0,
1613
1617
  bottom: 0
@@ -2796,7 +2800,6 @@ function useDockHeightController({
2796
2800
  const heightRef = useRef({ content: 0 });
2797
2801
  const rafRef = useRef(null);
2798
2802
  const isHudRef = useRef(isHud);
2799
- const surfacePhaseRef = useRef(surfacePhase);
2800
2803
  const lastAppliedContainerHeightRef = useRef(
2801
2804
  isHud ? DOCK_CARD_LAYOUT.hudHeight : DOCK_CARD_LAYOUT.baseHeight
2802
2805
  );
@@ -2805,19 +2808,15 @@ function useDockHeightController({
2805
2808
  );
2806
2809
  useIsomorphicLayoutEffect(() => {
2807
2810
  isHudRef.current = isHud;
2808
- surfacePhaseRef.current = surfacePhase;
2809
- }, [isHud, surfacePhase]);
2811
+ }, [isHud]);
2810
2812
  const applyHeight = useCallback(() => {
2811
2813
  if (rafRef.current !== null) {
2812
2814
  cancelAnimationFrame(rafRef.current);
2813
2815
  rafRef.current = null;
2814
2816
  }
2815
2817
  const { content } = heightRef.current;
2816
- const currentPhase = surfacePhaseRef.current;
2817
- const isLockedToBaseHeight = currentPhase === DOCK_SURFACE_PHASE.DISMISSING_ACTION || currentPhase === DOCK_SURFACE_PHASE.COLLAPSING_BODY || currentPhase === DOCK_SURFACE_PHASE.RESTORING_HEADER;
2818
- const computedContentHeight = isLockedToBaseHeight ? 0 : content;
2819
2818
  const height = getContainerHeight({
2820
- cardContentHeight: computedContentHeight,
2819
+ cardContentHeight: content,
2821
2820
  isHud: isHudRef.current
2822
2821
  });
2823
2822
  const totalSpacerHeight = height + DOCK_HEIGHT_BUFFER;
@@ -3672,6 +3671,16 @@ function sortToolbarActionsByOrder(actions) {
3672
3671
  (left, right) => (right.order ?? 0) - (left.order ?? 0)
3673
3672
  );
3674
3673
  }
3674
+ var PAGE_FACING_SURFACE_PHASES = /* @__PURE__ */ new Set([
3675
+ DOCK_SURFACE_PHASE.DISMISSING_ACTION,
3676
+ DOCK_SURFACE_PHASE.COLLAPSING_BODY,
3677
+ DOCK_SURFACE_PHASE.RESTORING_HEADER
3678
+ ]);
3679
+ function isSurfaceLayerShown(item) {
3680
+ return Boolean(
3681
+ item?.isSurface && !PAGE_FACING_SURFACE_PHASES.has(item.surfacePhase ?? "")
3682
+ );
3683
+ }
3675
3684
  function isActionlessDockItem(activeItem) {
3676
3685
  const isSurfaceActive = Boolean(
3677
3686
  activeItem?.isSurface && activeItem?.surfacePhase !== DOCK_SURFACE_PHASE.RESTORING_HEADER
@@ -3784,10 +3793,13 @@ function ownsPathname(path, pathname) {
3784
3793
  return !path || isInlineActionPathMatch(path, pathname);
3785
3794
  }
3786
3795
  function useActionSlot(item, pathname, { isTop = false } = {}) {
3787
- const { action, isLoading, isOverlay, path, isStatus, isSurface } = item;
3796
+ const { isLoading, path, isStatus, isSurface, surfacePhase } = item;
3797
+ const isOverlay = Boolean(item.isOverlay && !isSurface);
3798
+ const action = isSurface ? item.restingAction : item.action;
3799
+ const showsSurface = isSurfaceLayerShown({ isSurface, surfacePhase });
3788
3800
  const hasMedia = useDockHasMedia();
3789
3801
  return useMemo(() => {
3790
- if (isLoading || isOverlay && !isStatus || isSurface) return null;
3802
+ if (isLoading || isOverlay && !isStatus || showsSurface) return null;
3791
3803
  if (isStatus) {
3792
3804
  return action && isRenderableAction(action) ? { kind: "action", action } : null;
3793
3805
  }
@@ -3806,7 +3818,7 @@ function useActionSlot(item, pathname, { isTop = false } = {}) {
3806
3818
  isLoading,
3807
3819
  isOverlay,
3808
3820
  isStatus,
3809
- isSurface,
3821
+ showsSurface,
3810
3822
  isTop,
3811
3823
  hasMedia,
3812
3824
  path,
@@ -3956,9 +3968,13 @@ function useDockCardItemModel({
3956
3968
  }
3957
3969
  };
3958
3970
  }, [effectiveStyle, isActive, isStatusCard, showBorder, theme]);
3959
- const renderedActionSlot = item.isSurface && !isHeaderRestoring || isTopHudActive ? null : actionSlot;
3971
+ const showsSurfaceLayer = isSurfaceLayerShown(item);
3972
+ const renderedActionSlot = showsSurfaceLayer || isTopHudActive ? null : actionSlot;
3973
+ const isActionDismissed = Boolean(
3974
+ item.isSurface && item.surfacePhase === DOCK_SURFACE_PHASE.DISMISSING_ACTION
3975
+ );
3960
3976
  const hasNestedInteractiveContent = Boolean(
3961
- renderedActionSlot || item.isSurface && !isHeaderRestoring
3977
+ renderedActionSlot || showsSurfaceLayer
3962
3978
  );
3963
3979
  const dockMotion = useDockMotion();
3964
3980
  const headerRestoreVariants = useMemo(() => {
@@ -4066,6 +4082,8 @@ function useDockCardItemModel({
4066
4082
  cardContentRef,
4067
4083
  itemStyle,
4068
4084
  renderedActionSlot,
4085
+ isActionDismissed,
4086
+ showsSurfaceLayer,
4069
4087
  hasNestedInteractiveContent,
4070
4088
  headerRestoreVariants,
4071
4089
  handleMouseEnter,
@@ -5163,6 +5181,7 @@ function applySurfaceToDockItem(item, rawSurfaceEntry, options = {}) {
5163
5181
  isSurface: true,
5164
5182
  isOverlay: true,
5165
5183
  ...activeSurface,
5184
+ restingAction: item.action ?? null,
5166
5185
  restingWidth: item.width ?? null,
5167
5186
  surfacePhase,
5168
5187
  actions: null,
@@ -7834,6 +7853,7 @@ function StandardItemContent({
7834
7853
  badge,
7835
7854
  isActive = false,
7836
7855
  footerNode,
7856
+ isActionDismissed = false,
7837
7857
  isHudActive = false,
7838
7858
  hud = null,
7839
7859
  clearHud = null,
@@ -7841,6 +7861,13 @@ function StandardItemContent({
7841
7861
  pathname
7842
7862
  }) {
7843
7863
  const dockMotion = useDockMotion();
7864
+ const actionVariants = useMemo(
7865
+ () => ({
7866
+ ...dockMotion.variants.textCrossfade,
7867
+ dismissed: dockMotion.variants.actionDismiss.exit
7868
+ }),
7869
+ [dockMotion]
7870
+ );
7844
7871
  const {
7845
7872
  item,
7846
7873
  isPlaying,
@@ -7913,15 +7940,27 @@ function StandardItemContent({
7913
7940
  contextCommands
7914
7941
  }
7915
7942
  ),
7916
- footerNode ? /* @__PURE__ */ jsx(
7917
- "div",
7943
+ /* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", initial: false, children: footerNode ? /* @__PURE__ */ jsx(
7944
+ motion.div,
7918
7945
  {
7946
+ variants: actionVariants,
7947
+ initial: "hidden",
7948
+ animate: isActionDismissed ? "dismissed" : "visible",
7949
+ exit: "exit",
7950
+ transition: isActionDismissed ? dockMotion.transitions.actionDismiss : dockMotion.transitions.fade,
7919
7951
  className: theme.slots.cardFooter,
7920
7952
  style: theme.styles.cardFooter,
7921
- children: footerNode
7953
+ children: /* @__PURE__ */ jsx(
7954
+ "div",
7955
+ {
7956
+ className: theme.slots.cardAction,
7957
+ onClick: stopPropagationOnly,
7958
+ children: footerNode
7959
+ }
7960
+ )
7922
7961
  },
7923
- "dock-surface-footer"
7924
- ) : null
7962
+ "dock-card-footer"
7963
+ ) : null })
7925
7964
  ]
7926
7965
  },
7927
7966
  "dock-standard-content"
@@ -7964,6 +8003,8 @@ var DockCardItem = memo(function DockCardItem2({
7964
8003
  cardContentRef,
7965
8004
  itemStyle,
7966
8005
  renderedActionSlot,
8006
+ isActionDismissed,
8007
+ showsSurfaceLayer,
7967
8008
  hasNestedInteractiveContent,
7968
8009
  headerRestoreVariants,
7969
8010
  handleMouseEnter,
@@ -8005,6 +8046,7 @@ var DockCardItem = memo(function DockCardItem2({
8005
8046
  });
8006
8047
  const theme = useDockTheme();
8007
8048
  const renderedActionNode = renderActionSlot(renderedActionSlot);
8049
+ const layerExit = isCollapsedBackgroundCard ? DOCK_UNSEEN_EXIT : "exit";
8008
8050
  if (isCollapsedGhostCard) {
8009
8051
  return /* @__PURE__ */ jsx(
8010
8052
  motion.div,
@@ -8105,13 +8147,13 @@ var DockCardItem = memo(function DockCardItem2({
8105
8147
  willChange: "transform",
8106
8148
  pointerEvents: !expanded && position > 0 && !isExtensionShelf ? "none" : "auto"
8107
8149
  },
8108
- children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", initial: false, children: item.isSurface && item.surfacePhase !== DOCK_SURFACE_PHASE.DISMISSING_ACTION && item.surfacePhase !== DOCK_SURFACE_PHASE.COLLAPSING_BODY && item.surfacePhase !== DOCK_SURFACE_PHASE.RESTORING_HEADER ? /* @__PURE__ */ jsx(
8150
+ children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", initial: false, children: showsSurfaceLayer ? /* @__PURE__ */ jsx(
8109
8151
  motion.div,
8110
8152
  {
8111
8153
  variants: dockMotion.variants.headerSwap,
8112
8154
  initial: "hidden",
8113
8155
  animate: "visible",
8114
- exit: "exit",
8156
+ exit: layerExit,
8115
8157
  transition: dockMotion.transitions.headerSwap,
8116
8158
  style: DOCK_COMPOSITOR_STYLE,
8117
8159
  className: theme.slots.cardSurface,
@@ -8124,7 +8166,7 @@ var DockCardItem = memo(function DockCardItem2({
8124
8166
  variants: dockMotion.variants.extensionShelf,
8125
8167
  initial: "hidden",
8126
8168
  animate: "visible",
8127
- exit: "exit",
8169
+ exit: layerExit,
8128
8170
  transition: dockMotion.transitions.headerSwap,
8129
8171
  style: DOCK_COMPOSITOR_STYLE,
8130
8172
  className: theme.slots.cardShelf,
@@ -8137,7 +8179,7 @@ var DockCardItem = memo(function DockCardItem2({
8137
8179
  variants: headerRestoreVariants,
8138
8180
  initial: "hidden",
8139
8181
  animate: item.surfacePhase === DOCK_SURFACE_PHASE.DISMISSING_ACTION ? "hidden" : "visible",
8140
- exit: "exit",
8182
+ exit: layerExit,
8141
8183
  transition: item.surfacePhase === DOCK_SURFACE_PHASE.DISMISSING_ACTION ? dockMotion.transitions.anticipation : dockMotion.transitions.headerSwap,
8142
8184
  style: { ...DOCK_COMPOSITOR_STYLE, willChange: "transform" },
8143
8185
  className: theme.slots.cardStandard,
@@ -8155,33 +8197,8 @@ var DockCardItem = memo(function DockCardItem2({
8155
8197
  clearHud,
8156
8198
  contextCommands,
8157
8199
  pathname,
8158
- footerNode: renderedActionNode ? /* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", initial: false, children: item.surfacePhase === DOCK_SURFACE_PHASE.DISMISSING_ACTION ? /* @__PURE__ */ jsx(
8159
- motion.div,
8160
- {
8161
- variants: dockMotion.variants.actionDismiss,
8162
- initial: "visible",
8163
- animate: "exit",
8164
- exit: "exit",
8165
- transition: dockMotion.transitions.actionDismiss,
8166
- className: theme.slots.cardAction,
8167
- onClick: stopPropagationOnly,
8168
- children: /* @__PURE__ */ jsx(Suspense, { children: renderedActionNode })
8169
- },
8170
- "dock-action-component-dismiss"
8171
- ) : /* @__PURE__ */ jsx(
8172
- motion.div,
8173
- {
8174
- variants: dockMotion.variants.textCrossfade,
8175
- initial: "hidden",
8176
- animate: "visible",
8177
- exit: "exit",
8178
- transition: dockMotion.transitions.fade,
8179
- className: theme.slots.cardAction,
8180
- onClick: stopPropagationOnly,
8181
- children: /* @__PURE__ */ jsx(Suspense, { children: renderedActionNode })
8182
- },
8183
- "dock-action-component"
8184
- ) }) : null
8200
+ footerNode: renderedActionNode ? /* @__PURE__ */ jsx(Suspense, { children: renderedActionNode }) : null,
8201
+ isActionDismissed
8185
8202
  }
8186
8203
  )
8187
8204
  },
@@ -9884,5 +9901,5 @@ var dockModule = defineModule({
9884
9901
  });
9885
9902
 
9886
9903
  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 };
9887
- //# sourceMappingURL=chunk-3MSK4XGK.js.map
9888
- //# sourceMappingURL=chunk-3MSK4XGK.js.map
9904
+ //# sourceMappingURL=chunk-A5RE3F6O.js.map
9905
+ //# sourceMappingURL=chunk-A5RE3F6O.js.map