@omerdlw/base-framework 2.0.0 → 3.0.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.
- package/README.md +4 -1
- package/dist/{chunk-XASQT4CQ.js → chunk-66EYJBIP.js} +47 -27
- package/dist/chunk-66EYJBIP.js.map +1 -0
- package/dist/{chunk-65ZB4QTQ.js → chunk-CYU6SGAL.js} +3 -3
- package/dist/{chunk-65ZB4QTQ.js.map → chunk-CYU6SGAL.js.map} +1 -1
- package/dist/{chunk-6SG7V77J.js → chunk-HHWRTQKQ.js} +100 -67
- package/dist/chunk-HHWRTQKQ.js.map +1 -0
- package/dist/chunk-HLL5EHXC.js +485 -0
- package/dist/chunk-HLL5EHXC.js.map +1 -0
- package/dist/{chunk-3MSK4XGK.js → chunk-JIXBFFRD.js} +258 -405
- package/dist/chunk-JIXBFFRD.js.map +1 -0
- package/dist/{chunk-KKQT46TP.js → chunk-M57SNWXK.js} +8 -6
- package/dist/chunk-M57SNWXK.js.map +1 -0
- package/dist/chunk-RIOKLMYM.js +145 -0
- package/dist/chunk-RIOKLMYM.js.map +1 -0
- package/dist/{chunk-QXR55VVS.js → chunk-TG6NMHXI.js} +241 -162
- package/dist/chunk-TG6NMHXI.js.map +1 -0
- package/dist/index.js +7 -5
- package/dist/modules/ambient/analyze.d.ts +18 -3
- package/dist/modules/ambient/analyze.d.ts.map +1 -1
- package/dist/modules/ambient/dom.d.ts +14 -1
- package/dist/modules/ambient/dom.d.ts.map +1 -1
- package/dist/modules/ambient/hooks.d.ts.map +1 -1
- package/dist/modules/ambient/index.d.ts +2 -2
- package/dist/modules/ambient/index.d.ts.map +1 -1
- package/dist/modules/ambient/index.js +1 -1
- package/dist/modules/ambient/server/index.d.ts +1 -1
- package/dist/modules/ambient/server/index.d.ts.map +1 -1
- package/dist/modules/ambient/server/index.js +2 -2
- package/dist/modules/ambient/server/index.js.map +1 -1
- package/dist/modules/ambient/settings.d.ts +1 -0
- package/dist/modules/ambient/settings.d.ts.map +1 -1
- package/dist/modules/ambient/types.d.ts +13 -0
- package/dist/modules/ambient/types.d.ts.map +1 -1
- package/dist/modules/ambient/worker/index.js +1 -1
- package/dist/modules/context-menu/index.js +4 -3
- package/dist/modules/dock/cards.d.ts +3 -0
- package/dist/modules/dock/cards.d.ts.map +1 -1
- package/dist/modules/dock/constants.d.ts +1 -20
- package/dist/modules/dock/constants.d.ts.map +1 -1
- package/dist/modules/dock/index.js +3 -2
- package/dist/modules/dock/layout.d.ts.map +1 -1
- package/dist/modules/dock/motion.d.ts +6 -0
- package/dist/modules/dock/motion.d.ts.map +1 -1
- package/dist/modules/dock/overlay.d.ts +1 -1
- package/dist/modules/dock/overlay.d.ts.map +1 -1
- package/dist/modules/dock/routing/guards.d.ts +1 -1
- package/dist/modules/dock/routing/navigation.d.ts +7 -4
- package/dist/modules/dock/routing/navigation.d.ts.map +1 -1
- package/dist/modules/dock/runtime/display.d.ts +31 -2
- package/dist/modules/dock/runtime/display.d.ts.map +1 -1
- package/dist/modules/dock/runtime/dock.d.ts +2 -2
- package/dist/modules/dock/runtime/dock.d.ts.map +1 -1
- package/dist/modules/dock/surface/view-model.d.ts.map +1 -1
- package/dist/modules/dock/types.d.ts +9 -27
- package/dist/modules/dock/types.d.ts.map +1 -1
- package/dist/modules/index.d.ts +3 -2
- package/dist/modules/index.d.ts.map +1 -1
- package/dist/modules/index.js +7 -5
- package/dist/modules/loading/context.d.ts.map +1 -1
- package/dist/modules/loading/index.js +1 -1
- package/dist/modules/navigation/constants.d.ts +37 -0
- package/dist/modules/navigation/constants.d.ts.map +1 -0
- package/dist/modules/navigation/context.d.ts +10 -0
- package/dist/modules/navigation/context.d.ts.map +1 -0
- package/dist/modules/navigation/hooks.d.ts +29 -0
- package/dist/modules/navigation/hooks.d.ts.map +1 -0
- package/dist/modules/navigation/index.d.ts +10 -0
- package/dist/modules/navigation/index.d.ts.map +1 -0
- package/dist/modules/navigation/index.js +81 -0
- package/dist/modules/navigation/index.js.map +1 -0
- package/dist/modules/navigation/listeners.d.ts +15 -0
- package/dist/modules/navigation/listeners.d.ts.map +1 -0
- package/dist/modules/navigation/module.d.ts +25 -0
- package/dist/modules/navigation/module.d.ts.map +1 -0
- package/dist/modules/navigation/navigator.d.ts +8 -0
- package/dist/modules/navigation/navigator.d.ts.map +1 -0
- package/dist/modules/navigation/settings.d.ts +10 -0
- package/dist/modules/navigation/settings.d.ts.map +1 -0
- package/dist/modules/navigation/state.d.ts +20 -0
- package/dist/modules/navigation/state.d.ts.map +1 -0
- package/dist/modules/navigation/types.d.ts +168 -0
- package/dist/modules/navigation/types.d.ts.map +1 -0
- package/dist/modules/navigation/utils.d.ts +11 -0
- package/dist/modules/navigation/utils.d.ts.map +1 -0
- package/docs/getting-started.md +2 -0
- package/docs/modules/README.md +5 -1
- package/docs/modules/ambient.md +9 -6
- package/docs/modules/dock.md +13 -11
- package/docs/modules/loading.md +2 -2
- package/docs/modules/navigation.md +216 -0
- package/docs/proposals/navigation.md +209 -0
- package/package.json +6 -1
- package/templates/AGENTS.md +2 -0
- package/dist/chunk-3MSK4XGK.js.map +0 -1
- package/dist/chunk-6SG7V77J.js.map +0 -1
- package/dist/chunk-KKQT46TP.js.map +0 -1
- package/dist/chunk-QXR55VVS.js.map +0 -1
- package/dist/chunk-XASQT4CQ.js.map +0 -1
- package/dist/modules/dock/routing/transactions.d.ts +0 -21
- package/dist/modules/dock/routing/transactions.d.ts.map +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { NAVIGATION_STATUS, createNavigator } from './chunk-HLL5EHXC.js';
|
|
1
2
|
import { Z_INDEX } from './chunk-QI3ALLIB.js';
|
|
2
3
|
import { useNotificationVisible } from './chunk-SYAVGTOX.js';
|
|
3
4
|
import { useOptionalMediaState, useOptionalMediaActions } from './chunk-R2YGFJDJ.js';
|
|
4
|
-
import { useOptionalLoadingActions, useOptionalLoadingState } from './chunk-
|
|
5
|
+
import { useOptionalLoadingActions, useOptionalLoadingState } from './chunk-66EYJBIP.js';
|
|
5
6
|
import { defineThemeSpec, useModuleMotion, useTheme, cssTransition, staggerDelay, gpuTransform, useOptionalModuleMotion } from './chunk-7TAVYJ3A.js';
|
|
6
|
-
import { getOrCreateGlobalContext, defineModule, useRegistryEntries, useModuleRegistration } from './chunk-GF7TUX5I.js';
|
|
7
|
+
import { getOrCreateGlobalContext, defineModule, useModule, useRegistryEntries, useModuleRegistration } from './chunk-GF7TUX5I.js';
|
|
7
8
|
import { createStore, cn, isImageIconSource, clamp, useIsomorphicLayoutEffect, isObject, isPlainObject, trimToNull, shallowEqual, useGlobalEvent, useRequiredContext, globalEvents, toArray, useIsFullscreenStateActive, useClickOutside, report, normalizePath, useStore, createScheduler, EVENT_TYPES, toUserMessage } from './chunk-TV3WEF5G.js';
|
|
8
9
|
import { Tooltip, Icon, Button, Spinner } from './chunk-3BUP64Q6.js';
|
|
9
10
|
import React, { createContext, memo, createElement, isValidElement, cloneElement, Suspense, useEffect, useState, useCallback, useMemo, use, useSyncExternalStore, useRef, useLayoutEffect, useReducer, lazy, useContext, useId } from 'react';
|
|
@@ -436,27 +437,8 @@ var DOCK_CARD_LAYOUT = Object.freeze({
|
|
|
436
437
|
actionGap: DOCK_CARD_DIMENSIONS.actionGap,
|
|
437
438
|
baseHeight: DOCK_CARD_DIMENSIONS.height
|
|
438
439
|
});
|
|
439
|
-
var DOCK_TRANSACTION_EVENTS = Object.freeze({
|
|
440
|
-
START: "START",
|
|
441
|
-
COMPLETE: "COMPLETE",
|
|
442
|
-
CANCEL: "CANCEL",
|
|
443
|
-
FAIL: "FAIL",
|
|
444
|
-
TIME_OUT: "TIME_OUT"
|
|
445
|
-
});
|
|
446
|
-
var DOCK_TRANSACTION_STATUS = Object.freeze({
|
|
447
|
-
PENDING: "pending",
|
|
448
|
-
COMPLETED: "completed",
|
|
449
|
-
CANCELLED: "cancelled",
|
|
450
|
-
FAILED: "failed",
|
|
451
|
-
TIMED_OUT: "timed-out"
|
|
452
|
-
});
|
|
453
|
-
var DOCK_TRANSACTION_REASON = Object.freeze({
|
|
454
|
-
GUARD: "guard",
|
|
455
|
-
SUPERSEDED: "superseded",
|
|
456
|
-
TIME_OUT: "time-out"
|
|
457
|
-
});
|
|
458
|
-
var DOCK_TRANSACTION_TIMEOUT_MS = 15e3;
|
|
459
440
|
var DOCK_PREFETCH_INTENT_DELAY_MS = 90;
|
|
441
|
+
var DOCK_PENDING_ROUTE_HOLD_MS = 2500;
|
|
460
442
|
var DOCK_CONTINUITY_EVENTS = Object.freeze({
|
|
461
443
|
CLEAR: "CLEAR",
|
|
462
444
|
CONSUME_RETURN: "CONSUME_RETURN",
|
|
@@ -1608,6 +1590,10 @@ var DOCK_COMPOSITOR_STYLE = Object.freeze({
|
|
|
1608
1590
|
backfaceVisibility: "hidden",
|
|
1609
1591
|
transform: "translateZ(0)"
|
|
1610
1592
|
});
|
|
1593
|
+
var DOCK_UNSEEN_EXIT = Object.freeze({
|
|
1594
|
+
opacity: 0,
|
|
1595
|
+
transition: Object.freeze({ duration: 0 })
|
|
1596
|
+
});
|
|
1611
1597
|
var DOCK_SURFACE_DRAG_CONSTRAINTS = Object.freeze({
|
|
1612
1598
|
top: 0,
|
|
1613
1599
|
bottom: 0
|
|
@@ -2796,7 +2782,6 @@ function useDockHeightController({
|
|
|
2796
2782
|
const heightRef = useRef({ content: 0 });
|
|
2797
2783
|
const rafRef = useRef(null);
|
|
2798
2784
|
const isHudRef = useRef(isHud);
|
|
2799
|
-
const surfacePhaseRef = useRef(surfacePhase);
|
|
2800
2785
|
const lastAppliedContainerHeightRef = useRef(
|
|
2801
2786
|
isHud ? DOCK_CARD_LAYOUT.hudHeight : DOCK_CARD_LAYOUT.baseHeight
|
|
2802
2787
|
);
|
|
@@ -2805,19 +2790,15 @@ function useDockHeightController({
|
|
|
2805
2790
|
);
|
|
2806
2791
|
useIsomorphicLayoutEffect(() => {
|
|
2807
2792
|
isHudRef.current = isHud;
|
|
2808
|
-
|
|
2809
|
-
}, [isHud, surfacePhase]);
|
|
2793
|
+
}, [isHud]);
|
|
2810
2794
|
const applyHeight = useCallback(() => {
|
|
2811
2795
|
if (rafRef.current !== null) {
|
|
2812
2796
|
cancelAnimationFrame(rafRef.current);
|
|
2813
2797
|
rafRef.current = null;
|
|
2814
2798
|
}
|
|
2815
2799
|
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
2800
|
const height = getContainerHeight({
|
|
2820
|
-
cardContentHeight:
|
|
2801
|
+
cardContentHeight: content,
|
|
2821
2802
|
isHud: isHudRef.current
|
|
2822
2803
|
});
|
|
2823
2804
|
const totalSpacerHeight = height + DOCK_HEIGHT_BUFFER;
|
|
@@ -3028,210 +3009,6 @@ function openDockGuardConfirmation({
|
|
|
3028
3009
|
}
|
|
3029
3010
|
});
|
|
3030
3011
|
}
|
|
3031
|
-
function createDockTransactionState() {
|
|
3032
|
-
return { active: null, last: null };
|
|
3033
|
-
}
|
|
3034
|
-
function createDockTransaction({
|
|
3035
|
-
from = "",
|
|
3036
|
-
id,
|
|
3037
|
-
source = "dock",
|
|
3038
|
-
startedAt = Date.now(),
|
|
3039
|
-
to = ""
|
|
3040
|
-
}) {
|
|
3041
|
-
return {
|
|
3042
|
-
from: String(from || ""),
|
|
3043
|
-
id,
|
|
3044
|
-
source,
|
|
3045
|
-
startedAt,
|
|
3046
|
-
status: DOCK_TRANSACTION_STATUS.PENDING,
|
|
3047
|
-
to: String(to || "")
|
|
3048
|
-
};
|
|
3049
|
-
}
|
|
3050
|
-
function settleDockTransaction(transaction, action, status) {
|
|
3051
|
-
return {
|
|
3052
|
-
...transaction,
|
|
3053
|
-
endedAt: action.endedAt ?? Date.now(),
|
|
3054
|
-
error: action.error ?? null,
|
|
3055
|
-
reason: action.reason ?? null,
|
|
3056
|
-
status
|
|
3057
|
-
};
|
|
3058
|
-
}
|
|
3059
|
-
var TRANSACTION_STATUS_MAP = Object.freeze({
|
|
3060
|
-
[DOCK_TRANSACTION_EVENTS.COMPLETE]: DOCK_TRANSACTION_STATUS.COMPLETED,
|
|
3061
|
-
[DOCK_TRANSACTION_EVENTS.CANCEL]: DOCK_TRANSACTION_STATUS.CANCELLED,
|
|
3062
|
-
[DOCK_TRANSACTION_EVENTS.FAIL]: DOCK_TRANSACTION_STATUS.FAILED,
|
|
3063
|
-
[DOCK_TRANSACTION_EVENTS.TIME_OUT]: DOCK_TRANSACTION_STATUS.TIMED_OUT
|
|
3064
|
-
});
|
|
3065
|
-
function dockTransactionReducer(state, action) {
|
|
3066
|
-
if (action?.type === DOCK_TRANSACTION_EVENTS.START) {
|
|
3067
|
-
const nextTransaction = action.transaction;
|
|
3068
|
-
if (nextTransaction?.id == null) return state;
|
|
3069
|
-
const supersededTransaction = state.active ? settleDockTransaction(
|
|
3070
|
-
state.active,
|
|
3071
|
-
{ reason: DOCK_TRANSACTION_REASON.SUPERSEDED },
|
|
3072
|
-
DOCK_TRANSACTION_STATUS.CANCELLED
|
|
3073
|
-
) : state.last;
|
|
3074
|
-
return { active: nextTransaction, last: supersededTransaction };
|
|
3075
|
-
}
|
|
3076
|
-
const newStatus = action ? TRANSACTION_STATUS_MAP[action.type] : void 0;
|
|
3077
|
-
if (newStatus && action && state.active && state.active.id === action.id) {
|
|
3078
|
-
return {
|
|
3079
|
-
active: null,
|
|
3080
|
-
last: settleDockTransaction(state.active, action, newStatus)
|
|
3081
|
-
};
|
|
3082
|
-
}
|
|
3083
|
-
return state;
|
|
3084
|
-
}
|
|
3085
|
-
function useDockTransactions({
|
|
3086
|
-
onTransactionEvent = null,
|
|
3087
|
-
onTimeout = null,
|
|
3088
|
-
timeoutMs = DOCK_TRANSACTION_TIMEOUT_MS
|
|
3089
|
-
} = {}) {
|
|
3090
|
-
const [state, dispatch] = useReducer(
|
|
3091
|
-
dockTransactionReducer,
|
|
3092
|
-
void 0,
|
|
3093
|
-
createDockTransactionState
|
|
3094
|
-
);
|
|
3095
|
-
const activeTransactionRef = useRef(null);
|
|
3096
|
-
const nextTransactionIdRef = useRef(0);
|
|
3097
|
-
const timeoutRef = useRef(null);
|
|
3098
|
-
const onTimeoutRef = useRef(onTimeout);
|
|
3099
|
-
const onTransactionEventRef = useRef(onTransactionEvent);
|
|
3100
|
-
useEffect(() => {
|
|
3101
|
-
onTimeoutRef.current = onTimeout;
|
|
3102
|
-
}, [onTimeout]);
|
|
3103
|
-
useEffect(() => {
|
|
3104
|
-
onTransactionEventRef.current = onTransactionEvent;
|
|
3105
|
-
}, [onTransactionEvent]);
|
|
3106
|
-
const clearTransactionTimeout = useCallback(() => {
|
|
3107
|
-
if (timeoutRef.current !== null) {
|
|
3108
|
-
clearTimeout(timeoutRef.current);
|
|
3109
|
-
timeoutRef.current = null;
|
|
3110
|
-
}
|
|
3111
|
-
}, []);
|
|
3112
|
-
const settleTransaction = useCallback(
|
|
3113
|
-
(id, type, details = {}) => {
|
|
3114
|
-
const activeTransaction = activeTransactionRef.current;
|
|
3115
|
-
if (!activeTransaction || activeTransaction.id !== id) return false;
|
|
3116
|
-
clearTransactionTimeout();
|
|
3117
|
-
activeTransactionRef.current = null;
|
|
3118
|
-
const event = { ...details, endedAt: Date.now(), id, type };
|
|
3119
|
-
const settledTransaction = settleDockTransaction(
|
|
3120
|
-
activeTransaction,
|
|
3121
|
-
event,
|
|
3122
|
-
TRANSACTION_STATUS_MAP[type] || DOCK_TRANSACTION_STATUS.TIMED_OUT
|
|
3123
|
-
);
|
|
3124
|
-
dispatch(event);
|
|
3125
|
-
onTransactionEventRef.current?.({
|
|
3126
|
-
transaction: settledTransaction,
|
|
3127
|
-
type
|
|
3128
|
-
});
|
|
3129
|
-
return true;
|
|
3130
|
-
},
|
|
3131
|
-
[clearTransactionTimeout]
|
|
3132
|
-
);
|
|
3133
|
-
const beginTransaction = useCallback(
|
|
3134
|
-
({
|
|
3135
|
-
from,
|
|
3136
|
-
source,
|
|
3137
|
-
to
|
|
3138
|
-
} = {}) => {
|
|
3139
|
-
const activeTransaction = activeTransactionRef.current;
|
|
3140
|
-
if (activeTransaction) {
|
|
3141
|
-
settleTransaction(
|
|
3142
|
-
activeTransaction.id,
|
|
3143
|
-
DOCK_TRANSACTION_EVENTS.CANCEL,
|
|
3144
|
-
{ reason: DOCK_TRANSACTION_REASON.SUPERSEDED }
|
|
3145
|
-
);
|
|
3146
|
-
}
|
|
3147
|
-
const transaction = createDockTransaction({
|
|
3148
|
-
from,
|
|
3149
|
-
id: ++nextTransactionIdRef.current,
|
|
3150
|
-
source,
|
|
3151
|
-
to
|
|
3152
|
-
});
|
|
3153
|
-
activeTransactionRef.current = transaction;
|
|
3154
|
-
dispatch({ transaction, type: DOCK_TRANSACTION_EVENTS.START });
|
|
3155
|
-
onTransactionEventRef.current?.({
|
|
3156
|
-
transaction,
|
|
3157
|
-
type: DOCK_TRANSACTION_EVENTS.START
|
|
3158
|
-
});
|
|
3159
|
-
const safeTimeout = Number(timeoutMs);
|
|
3160
|
-
if (Number.isFinite(safeTimeout) && safeTimeout > 0) {
|
|
3161
|
-
timeoutRef.current = setTimeout(() => {
|
|
3162
|
-
if (!settleTransaction(
|
|
3163
|
-
transaction.id,
|
|
3164
|
-
DOCK_TRANSACTION_EVENTS.TIME_OUT,
|
|
3165
|
-
{ reason: DOCK_TRANSACTION_REASON.TIME_OUT }
|
|
3166
|
-
))
|
|
3167
|
-
return;
|
|
3168
|
-
onTimeoutRef.current?.(transaction);
|
|
3169
|
-
}, safeTimeout);
|
|
3170
|
-
}
|
|
3171
|
-
return transaction;
|
|
3172
|
-
},
|
|
3173
|
-
[settleTransaction, timeoutMs]
|
|
3174
|
-
);
|
|
3175
|
-
const completeTransaction = useCallback(
|
|
3176
|
-
(id) => settleTransaction(id, DOCK_TRANSACTION_EVENTS.COMPLETE),
|
|
3177
|
-
[settleTransaction]
|
|
3178
|
-
);
|
|
3179
|
-
const cancelTransaction = useCallback(
|
|
3180
|
-
(id, reason = null) => settleTransaction(id, DOCK_TRANSACTION_EVENTS.CANCEL, { reason }),
|
|
3181
|
-
[settleTransaction]
|
|
3182
|
-
);
|
|
3183
|
-
const cancelActiveTransaction = useCallback(
|
|
3184
|
-
(reason = null) => activeTransactionRef.current ? cancelTransaction(activeTransactionRef.current.id, reason) : false,
|
|
3185
|
-
[cancelTransaction]
|
|
3186
|
-
);
|
|
3187
|
-
const failTransaction = useCallback(
|
|
3188
|
-
(id, error) => settleTransaction(id, DOCK_TRANSACTION_EVENTS.FAIL, { error }),
|
|
3189
|
-
[settleTransaction]
|
|
3190
|
-
);
|
|
3191
|
-
const completeTransactionForPath = useCallback(
|
|
3192
|
-
(pathname) => {
|
|
3193
|
-
const activeTransaction = activeTransactionRef.current;
|
|
3194
|
-
if (!activeTransaction || !isSamePath(activeTransaction.to, pathname))
|
|
3195
|
-
return false;
|
|
3196
|
-
return completeTransaction(activeTransaction.id);
|
|
3197
|
-
},
|
|
3198
|
-
[completeTransaction]
|
|
3199
|
-
);
|
|
3200
|
-
const isTransactionCurrent = useCallback(
|
|
3201
|
-
(id) => activeTransactionRef.current?.id === id,
|
|
3202
|
-
[]
|
|
3203
|
-
);
|
|
3204
|
-
useEffect(() => {
|
|
3205
|
-
return () => {
|
|
3206
|
-
clearTransactionTimeout();
|
|
3207
|
-
activeTransactionRef.current = null;
|
|
3208
|
-
};
|
|
3209
|
-
}, [clearTransactionTimeout]);
|
|
3210
|
-
return useMemo(
|
|
3211
|
-
() => ({
|
|
3212
|
-
activeTransaction: state.active,
|
|
3213
|
-
beginTransaction,
|
|
3214
|
-
cancelActiveTransaction,
|
|
3215
|
-
cancelTransaction,
|
|
3216
|
-
completeTransaction,
|
|
3217
|
-
completeTransactionForPath,
|
|
3218
|
-
failTransaction,
|
|
3219
|
-
isTransactionCurrent,
|
|
3220
|
-
lastTransaction: state.last
|
|
3221
|
-
}),
|
|
3222
|
-
[
|
|
3223
|
-
state.active,
|
|
3224
|
-
state.last,
|
|
3225
|
-
beginTransaction,
|
|
3226
|
-
cancelActiveTransaction,
|
|
3227
|
-
cancelTransaction,
|
|
3228
|
-
completeTransaction,
|
|
3229
|
-
completeTransactionForPath,
|
|
3230
|
-
failTransaction,
|
|
3231
|
-
isTransactionCurrent
|
|
3232
|
-
]
|
|
3233
|
-
);
|
|
3234
|
-
}
|
|
3235
3012
|
|
|
3236
3013
|
// src/modules/dock/routing/navigation.ts
|
|
3237
3014
|
function getRoutePolicyOverrides(item) {
|
|
@@ -3306,7 +3083,8 @@ function createDockTopology(items = [], { pathname = "" } = {}) {
|
|
|
3306
3083
|
};
|
|
3307
3084
|
}
|
|
3308
3085
|
function useRoutePrefetch(router, {
|
|
3309
|
-
intentDelayMs = DOCK_PREFETCH_INTENT_DELAY_MS
|
|
3086
|
+
intentDelayMs = DOCK_PREFETCH_INTENT_DELAY_MS,
|
|
3087
|
+
navigator: navigator2 = null
|
|
3310
3088
|
} = {}) {
|
|
3311
3089
|
const routeStatesRef = useRef(/* @__PURE__ */ new Map());
|
|
3312
3090
|
const cancelRoutePrefetch = useCallback((href) => {
|
|
@@ -3318,7 +3096,7 @@ function useRoutePrefetch(router, {
|
|
|
3318
3096
|
}, []);
|
|
3319
3097
|
const prefetchRoute = useCallback(
|
|
3320
3098
|
(href, { immediate = false } = {}) => {
|
|
3321
|
-
if (!isSafeInternalHref(href) || typeof router?.prefetch !== "function")
|
|
3099
|
+
if (!isSafeInternalHref(href) || !navigator2 && typeof router?.prefetch !== "function")
|
|
3322
3100
|
return false;
|
|
3323
3101
|
const routeState = routeStatesRef.current.get(href);
|
|
3324
3102
|
if (routeState?.isPrefetched || routeState?.timeoutId != null)
|
|
@@ -3327,6 +3105,11 @@ function useRoutePrefetch(router, {
|
|
|
3327
3105
|
const currentState = routeStatesRef.current.get(href);
|
|
3328
3106
|
if (!currentState) return;
|
|
3329
3107
|
currentState.timeoutId = null;
|
|
3108
|
+
if (navigator2) {
|
|
3109
|
+
routeStatesRef.current.delete(href);
|
|
3110
|
+
navigator2.prefetch(href);
|
|
3111
|
+
return;
|
|
3112
|
+
}
|
|
3330
3113
|
currentState.isPrefetched = true;
|
|
3331
3114
|
try {
|
|
3332
3115
|
router.prefetch(href, {
|
|
@@ -3353,7 +3136,7 @@ function useRoutePrefetch(router, {
|
|
|
3353
3136
|
else nextState.timeoutId = setTimeout(startPrefetch, delay);
|
|
3354
3137
|
return true;
|
|
3355
3138
|
},
|
|
3356
|
-
[intentDelayMs, router]
|
|
3139
|
+
[intentDelayMs, navigator2, router]
|
|
3357
3140
|
);
|
|
3358
3141
|
useEffect(() => {
|
|
3359
3142
|
const routeStates = routeStatesRef.current;
|
|
@@ -3431,6 +3214,25 @@ function emitDockEvent(eventType, data = {}) {
|
|
|
3431
3214
|
...data
|
|
3432
3215
|
});
|
|
3433
3216
|
}
|
|
3217
|
+
function useDockNavigator(router) {
|
|
3218
|
+
const shared = useModule("navigation");
|
|
3219
|
+
const [own] = useState(
|
|
3220
|
+
() => shared ? null : createNavigator({ router })
|
|
3221
|
+
);
|
|
3222
|
+
useEffect(() => {
|
|
3223
|
+
own?.setRouter(router);
|
|
3224
|
+
}, [own, router]);
|
|
3225
|
+
useEffect(() => own ? () => own.dispose() : void 0, [own]);
|
|
3226
|
+
return useMemo(
|
|
3227
|
+
() => own ?? { ...shared.actions, dispose: () => {
|
|
3228
|
+
}, store: shared.store },
|
|
3229
|
+
[own, shared]
|
|
3230
|
+
);
|
|
3231
|
+
}
|
|
3232
|
+
var selectTrips = (state) => ({
|
|
3233
|
+
active: state.active,
|
|
3234
|
+
last: state.last
|
|
3235
|
+
});
|
|
3434
3236
|
function useDockNavigation() {
|
|
3435
3237
|
const pathname = usePathname();
|
|
3436
3238
|
const { locationKey, syncLocationKey } = useDockLocationKey();
|
|
@@ -3447,95 +3249,78 @@ function useDockNavigation() {
|
|
|
3447
3249
|
"useDockNavigation",
|
|
3448
3250
|
"DockProvider"
|
|
3449
3251
|
);
|
|
3252
|
+
const navigator2 = useDockNavigator(router);
|
|
3253
|
+
const { active: activeTransaction, last: lastTransaction } = useStore(
|
|
3254
|
+
navigator2.store,
|
|
3255
|
+
selectTrips,
|
|
3256
|
+
shallowEqual
|
|
3257
|
+
);
|
|
3450
3258
|
const previousLocationKeyRef = useRef(locationKey);
|
|
3451
|
-
const
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
lastTransaction
|
|
3464
|
-
} = useDockTransactions({
|
|
3465
|
-
onTimeout: handleTransactionTimeout
|
|
3466
|
-
});
|
|
3259
|
+
const settledTripRef = useRef(lastTransaction);
|
|
3260
|
+
useEffect(() => {
|
|
3261
|
+
if (settledTripRef.current === lastTransaction) return;
|
|
3262
|
+
settledTripRef.current = lastTransaction;
|
|
3263
|
+
if (!lastTransaction) return;
|
|
3264
|
+
if (lastTransaction.status === NAVIGATION_STATUS.COMPLETED) {
|
|
3265
|
+
syncLocationKey();
|
|
3266
|
+
} else if (lastTransaction.status === NAVIGATION_STATUS.TIMED_OUT || lastTransaction.status === NAVIGATION_STATUS.FAILED) {
|
|
3267
|
+
clearPreparedRouteReset();
|
|
3268
|
+
stopLoading();
|
|
3269
|
+
}
|
|
3270
|
+
}, [clearPreparedRouteReset, lastTransaction, stopLoading, syncLocationKey]);
|
|
3467
3271
|
const cancelDock = useCallback(
|
|
3468
3272
|
(reason = "guard") => {
|
|
3469
|
-
|
|
3273
|
+
navigator2.cancel(reason);
|
|
3470
3274
|
clearPreparedRouteReset();
|
|
3471
3275
|
closeSurface({ cancelled: true, reason, success: false });
|
|
3472
3276
|
},
|
|
3473
|
-
[
|
|
3277
|
+
[clearPreparedRouteReset, closeSurface, navigator2]
|
|
3474
3278
|
);
|
|
3475
3279
|
const commitDock = useCallback(
|
|
3476
|
-
({
|
|
3280
|
+
async ({
|
|
3281
|
+
force = false,
|
|
3477
3282
|
from,
|
|
3478
3283
|
href,
|
|
3284
|
+
item,
|
|
3479
3285
|
routePolicy,
|
|
3480
|
-
source = "dock"
|
|
3481
|
-
transaction = null
|
|
3286
|
+
source = "dock"
|
|
3482
3287
|
}) => {
|
|
3483
|
-
const
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3288
|
+
const result = await navigator2.navigate(href, {
|
|
3289
|
+
force,
|
|
3290
|
+
guard: guards.count() > 0 ? () => guards.check(href, from) : void 0,
|
|
3291
|
+
onCommit: () => {
|
|
3292
|
+
continuity?.remember?.(from);
|
|
3293
|
+
blurActiveElement();
|
|
3294
|
+
prepareRouteReset(routePolicy);
|
|
3295
|
+
emitDockEvent(DOCK_EVENTS.NAVIGATE_START, { from, to: href });
|
|
3296
|
+
},
|
|
3297
|
+
source
|
|
3298
|
+
});
|
|
3299
|
+
if (result.ok) {
|
|
3300
|
+
emitDockEvent(DOCK_EVENTS.NAVIGATE, { from, item, to: href });
|
|
3301
|
+
return true;
|
|
3302
|
+
}
|
|
3303
|
+
if (result.blocked) {
|
|
3487
3304
|
blurActiveElement();
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3305
|
+
openDockGuardConfirmation({
|
|
3306
|
+
closeSurface,
|
|
3307
|
+
commit: (confirmed) => void commitDock({ ...confirmed, force: true }).catch(
|
|
3308
|
+
(error) => report("Dock route transition", error)
|
|
3309
|
+
),
|
|
3492
3310
|
from,
|
|
3493
|
-
|
|
3494
|
-
|
|
3311
|
+
href,
|
|
3312
|
+
message: result.blocked.message,
|
|
3313
|
+
routePolicy
|
|
3495
3314
|
});
|
|
3496
|
-
if (typeof window !== "undefined") {
|
|
3497
|
-
const currentUrl = new URL(window.location.href);
|
|
3498
|
-
const destinationUrl = new URL(href, window.location.origin);
|
|
3499
|
-
if (normalizePath(currentUrl.pathname) === normalizePath(destinationUrl.pathname)) {
|
|
3500
|
-
window.requestAnimationFrame(() => {
|
|
3501
|
-
const currentLocKey = getDockLocationKey({
|
|
3502
|
-
hash: window.location.hash,
|
|
3503
|
-
pathname: window.location.pathname,
|
|
3504
|
-
search: window.location.search
|
|
3505
|
-
});
|
|
3506
|
-
if (!isSamePath(currentLocKey, href) || !completeTransactionForPath(currentLocKey))
|
|
3507
|
-
return;
|
|
3508
|
-
emitDockEvent(DOCK_EVENTS.NAVIGATE_END, {
|
|
3509
|
-
duration: void 0,
|
|
3510
|
-
from,
|
|
3511
|
-
to: currentLocKey
|
|
3512
|
-
});
|
|
3513
|
-
previousLocationKeyRef.current = currentLocKey;
|
|
3514
|
-
syncLocationKey();
|
|
3515
|
-
stopLoading();
|
|
3516
|
-
});
|
|
3517
|
-
}
|
|
3518
|
-
}
|
|
3519
|
-
return true;
|
|
3520
|
-
} catch (error) {
|
|
3521
|
-
clearPreparedRouteReset();
|
|
3522
|
-
failTransaction(activeRouteTransaction.id, error);
|
|
3523
|
-
stopLoading();
|
|
3524
|
-
report("Dock route transition", error);
|
|
3525
|
-
return false;
|
|
3526
3315
|
}
|
|
3316
|
+
return false;
|
|
3527
3317
|
},
|
|
3528
3318
|
[
|
|
3529
|
-
|
|
3530
|
-
clearPreparedRouteReset,
|
|
3531
|
-
completeTransactionForPath,
|
|
3319
|
+
closeSurface,
|
|
3532
3320
|
continuity,
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
prepareRouteReset
|
|
3536
|
-
router,
|
|
3537
|
-
stopLoading,
|
|
3538
|
-
syncLocationKey
|
|
3321
|
+
guards,
|
|
3322
|
+
navigator2,
|
|
3323
|
+
prepareRouteReset
|
|
3539
3324
|
]
|
|
3540
3325
|
);
|
|
3541
3326
|
const navigate = useCallback(
|
|
@@ -3551,62 +3336,27 @@ function useDockNavigation() {
|
|
|
3551
3336
|
return false;
|
|
3552
3337
|
}
|
|
3553
3338
|
if (isSamePath(href, from)) return false;
|
|
3554
|
-
const transaction = beginTransaction({ from, source, to: href });
|
|
3555
3339
|
try {
|
|
3556
|
-
|
|
3557
|
-
const guardResult = await guards.check(href, from);
|
|
3558
|
-
if (!isTransactionCurrent(transaction.id)) return false;
|
|
3559
|
-
if (guardResult.blocked) {
|
|
3560
|
-
cancelTransaction(transaction.id, "guard");
|
|
3561
|
-
blurActiveElement();
|
|
3562
|
-
openDockGuardConfirmation({
|
|
3563
|
-
closeSurface,
|
|
3564
|
-
commit: commitDock,
|
|
3565
|
-
from,
|
|
3566
|
-
href,
|
|
3567
|
-
message: guardResult.message,
|
|
3568
|
-
routePolicy
|
|
3569
|
-
});
|
|
3570
|
-
return false;
|
|
3571
|
-
}
|
|
3572
|
-
}
|
|
3573
|
-
return commitDock({
|
|
3574
|
-
from,
|
|
3575
|
-
href,
|
|
3576
|
-
routePolicy,
|
|
3577
|
-
source,
|
|
3578
|
-
transaction
|
|
3579
|
-
});
|
|
3340
|
+
return await commitDock({ force, from, href, routePolicy, source });
|
|
3580
3341
|
} catch (error) {
|
|
3581
|
-
failTransaction(transaction.id, error);
|
|
3582
3342
|
stopLoading();
|
|
3583
|
-
report("Dock navigation
|
|
3343
|
+
report("Dock navigation", error);
|
|
3584
3344
|
return false;
|
|
3585
3345
|
}
|
|
3586
3346
|
},
|
|
3587
|
-
[
|
|
3588
|
-
guards,
|
|
3589
|
-
beginTransaction,
|
|
3590
|
-
cancelTransaction,
|
|
3591
|
-
commitDock,
|
|
3592
|
-
failTransaction,
|
|
3593
|
-
isTransactionCurrent,
|
|
3594
|
-
closeSurface,
|
|
3595
|
-
locationKey,
|
|
3596
|
-
stopLoading
|
|
3597
|
-
]
|
|
3347
|
+
[commitDock, locationKey, stopLoading]
|
|
3598
3348
|
);
|
|
3599
3349
|
useEffect(() => {
|
|
3350
|
+
navigator2.arrive(locationKey);
|
|
3600
3351
|
if (previousLocationKeyRef.current === locationKey) return;
|
|
3601
3352
|
emitDockEvent(DOCK_EVENTS.NAVIGATE_END, {
|
|
3602
3353
|
duration: void 0,
|
|
3603
3354
|
from: previousLocationKeyRef.current,
|
|
3604
3355
|
to: locationKey
|
|
3605
3356
|
});
|
|
3606
|
-
completeTransactionForPath(locationKey);
|
|
3607
3357
|
previousLocationKeyRef.current = locationKey;
|
|
3608
3358
|
stopLoading();
|
|
3609
|
-
}, [
|
|
3359
|
+
}, [locationKey, navigator2, stopLoading]);
|
|
3610
3360
|
return {
|
|
3611
3361
|
activeTransaction,
|
|
3612
3362
|
cancelDock,
|
|
@@ -3672,6 +3422,16 @@ function sortToolbarActionsByOrder(actions) {
|
|
|
3672
3422
|
(left, right) => (right.order ?? 0) - (left.order ?? 0)
|
|
3673
3423
|
);
|
|
3674
3424
|
}
|
|
3425
|
+
var PAGE_FACING_SURFACE_PHASES = /* @__PURE__ */ new Set([
|
|
3426
|
+
DOCK_SURFACE_PHASE.DISMISSING_ACTION,
|
|
3427
|
+
DOCK_SURFACE_PHASE.COLLAPSING_BODY,
|
|
3428
|
+
DOCK_SURFACE_PHASE.RESTORING_HEADER
|
|
3429
|
+
]);
|
|
3430
|
+
function isSurfaceLayerShown(item) {
|
|
3431
|
+
return Boolean(
|
|
3432
|
+
item?.isSurface && !PAGE_FACING_SURFACE_PHASES.has(item.surfacePhase ?? "")
|
|
3433
|
+
);
|
|
3434
|
+
}
|
|
3675
3435
|
function isActionlessDockItem(activeItem) {
|
|
3676
3436
|
const isSurfaceActive = Boolean(
|
|
3677
3437
|
activeItem?.isSurface && activeItem?.surfacePhase !== DOCK_SURFACE_PHASE.RESTORING_HEADER
|
|
@@ -3784,10 +3544,13 @@ function ownsPathname(path, pathname) {
|
|
|
3784
3544
|
return !path || isInlineActionPathMatch(path, pathname);
|
|
3785
3545
|
}
|
|
3786
3546
|
function useActionSlot(item, pathname, { isTop = false } = {}) {
|
|
3787
|
-
const {
|
|
3547
|
+
const { isLoading, path, isStatus, isSurface, surfacePhase } = item;
|
|
3548
|
+
const isOverlay = Boolean(item.isOverlay && !isSurface);
|
|
3549
|
+
const action = isSurface ? item.restingAction : item.action;
|
|
3550
|
+
const showsSurface = isSurfaceLayerShown({ isSurface, surfacePhase });
|
|
3788
3551
|
const hasMedia = useDockHasMedia();
|
|
3789
3552
|
return useMemo(() => {
|
|
3790
|
-
if (isLoading || isOverlay && !isStatus ||
|
|
3553
|
+
if (isLoading || isOverlay && !isStatus || showsSurface) return null;
|
|
3791
3554
|
if (isStatus) {
|
|
3792
3555
|
return action && isRenderableAction(action) ? { kind: "action", action } : null;
|
|
3793
3556
|
}
|
|
@@ -3806,7 +3569,7 @@ function useActionSlot(item, pathname, { isTop = false } = {}) {
|
|
|
3806
3569
|
isLoading,
|
|
3807
3570
|
isOverlay,
|
|
3808
3571
|
isStatus,
|
|
3809
|
-
|
|
3572
|
+
showsSurface,
|
|
3810
3573
|
isTop,
|
|
3811
3574
|
hasMedia,
|
|
3812
3575
|
path,
|
|
@@ -3890,7 +3653,10 @@ function useDockCardItemModel({
|
|
|
3890
3653
|
const [isHovered, setIsHovered] = useState(false);
|
|
3891
3654
|
const pathname = usePathname();
|
|
3892
3655
|
const router = useRouter();
|
|
3893
|
-
const
|
|
3656
|
+
const navigation = useModule("navigation");
|
|
3657
|
+
const { cancelRoutePrefetch, prefetchRoute } = useRoutePrefetch(router, {
|
|
3658
|
+
navigator: navigation?.actions
|
|
3659
|
+
});
|
|
3894
3660
|
const hasMedia = useDockHasMedia();
|
|
3895
3661
|
const isTopHudActive = Boolean(isTop && isHudActive);
|
|
3896
3662
|
const isCurrentActive = Boolean(
|
|
@@ -3956,9 +3722,13 @@ function useDockCardItemModel({
|
|
|
3956
3722
|
}
|
|
3957
3723
|
};
|
|
3958
3724
|
}, [effectiveStyle, isActive, isStatusCard, showBorder, theme]);
|
|
3959
|
-
const
|
|
3725
|
+
const showsSurfaceLayer = isSurfaceLayerShown(item);
|
|
3726
|
+
const renderedActionSlot = showsSurfaceLayer || isTopHudActive ? null : actionSlot;
|
|
3727
|
+
const isActionDismissed = Boolean(
|
|
3728
|
+
item.isSurface && item.surfacePhase === DOCK_SURFACE_PHASE.DISMISSING_ACTION
|
|
3729
|
+
);
|
|
3960
3730
|
const hasNestedInteractiveContent = Boolean(
|
|
3961
|
-
renderedActionSlot ||
|
|
3731
|
+
renderedActionSlot || showsSurfaceLayer
|
|
3962
3732
|
);
|
|
3963
3733
|
const dockMotion = useDockMotion();
|
|
3964
3734
|
const headerRestoreVariants = useMemo(() => {
|
|
@@ -4066,6 +3836,8 @@ function useDockCardItemModel({
|
|
|
4066
3836
|
cardContentRef,
|
|
4067
3837
|
itemStyle,
|
|
4068
3838
|
renderedActionSlot,
|
|
3839
|
+
isActionDismissed,
|
|
3840
|
+
showsSurfaceLayer,
|
|
4069
3841
|
hasNestedInteractiveContent,
|
|
4070
3842
|
headerRestoreVariants,
|
|
4071
3843
|
handleMouseEnter,
|
|
@@ -5163,6 +4935,7 @@ function applySurfaceToDockItem(item, rawSurfaceEntry, options = {}) {
|
|
|
5163
4935
|
isSurface: true,
|
|
5164
4936
|
isOverlay: true,
|
|
5165
4937
|
...activeSurface,
|
|
4938
|
+
restingAction: item.action ?? null,
|
|
5166
4939
|
restingWidth: item.width ?? null,
|
|
5167
4940
|
surfacePhase,
|
|
5168
4941
|
actions: null,
|
|
@@ -6034,27 +5807,31 @@ function buildDockItems({
|
|
|
6034
5807
|
return filterDockItems(flattenedItems, searchQuery);
|
|
6035
5808
|
return flattenedItems;
|
|
6036
5809
|
}
|
|
6037
|
-
function
|
|
5810
|
+
function resolveBaseActiveItemMatch({
|
|
6038
5811
|
rawItems,
|
|
6039
5812
|
dockItems,
|
|
6040
5813
|
pathname,
|
|
6041
5814
|
isNotFoundPage
|
|
6042
5815
|
}) {
|
|
6043
5816
|
const normalizedPathname = normalizePath(pathname);
|
|
5817
|
+
const matched = (item) => ({
|
|
5818
|
+
item,
|
|
5819
|
+
isFallback: false
|
|
5820
|
+
});
|
|
6044
5821
|
const selectedDataSource = dockItems.find(
|
|
6045
5822
|
(item) => item.isDataSource && item.isSelected
|
|
6046
5823
|
);
|
|
6047
|
-
if (selectedDataSource) return selectedDataSource;
|
|
5824
|
+
if (selectedDataSource) return matched(selectedDataSource);
|
|
6048
5825
|
if (isNotFoundPage)
|
|
6049
|
-
return rawItems.find(isNotFoundItem) || rawItems[0] || null;
|
|
5826
|
+
return matched(rawItems.find(isNotFoundItem) || rawItems[0] || null);
|
|
6050
5827
|
const matchInDock = dockItems.find(
|
|
6051
5828
|
(item) => isSamePath(item.path, normalizedPathname) || item.targetPath && isSamePath(item.targetPath, normalizedPathname)
|
|
6052
5829
|
);
|
|
6053
|
-
if (matchInDock) return matchInDock;
|
|
5830
|
+
if (matchInDock) return matched(matchInDock);
|
|
6054
5831
|
const matchInRaw = rawItems.find(
|
|
6055
5832
|
(item) => isSamePath(item.path, normalizedPathname) || item.targetPath && isSamePath(item.targetPath, normalizedPathname)
|
|
6056
5833
|
);
|
|
6057
|
-
if (matchInRaw) return matchInRaw;
|
|
5834
|
+
if (matchInRaw) return matched(matchInRaw);
|
|
6058
5835
|
let prefixMatchedRawItem = null;
|
|
6059
5836
|
let longestPrefixLength = -1;
|
|
6060
5837
|
for (let i = 0; i < rawItems.length; i++) {
|
|
@@ -6065,11 +5842,65 @@ function resolveBaseActiveItem({
|
|
|
6065
5842
|
}
|
|
6066
5843
|
}
|
|
6067
5844
|
if (prefixMatchedRawItem) {
|
|
6068
|
-
|
|
5845
|
+
const item = dockItems.find(
|
|
6069
5846
|
(entry) => isSamePath(entry?.path, prefixMatchedRawItem?.path) || entry?.name && entry.name === prefixMatchedRawItem?.name
|
|
6070
5847
|
) || prefixMatchedRawItem;
|
|
5848
|
+
return {
|
|
5849
|
+
item,
|
|
5850
|
+
isFallback: normalizePath(prefixMatchedRawItem.path) === "/"
|
|
5851
|
+
};
|
|
5852
|
+
}
|
|
5853
|
+
return { item: rawItems[0] || null, isFallback: true };
|
|
5854
|
+
}
|
|
5855
|
+
function selectPendingRouteItem({
|
|
5856
|
+
match,
|
|
5857
|
+
heldItem,
|
|
5858
|
+
pathname,
|
|
5859
|
+
isHolding
|
|
5860
|
+
}) {
|
|
5861
|
+
if (!match.isFallback || !isHolding || !heldItem) return match.item;
|
|
5862
|
+
if (heldItem.path && isSamePath(heldItem.path, pathname)) return match.item;
|
|
5863
|
+
return heldItem;
|
|
5864
|
+
}
|
|
5865
|
+
function usePendingRouteHold(pathname, match, {
|
|
5866
|
+
holdMs = DOCK_PENDING_ROUTE_HOLD_MS,
|
|
5867
|
+
isNavigating = false
|
|
5868
|
+
} = {}) {
|
|
5869
|
+
const normalizedPathname = normalizePath(pathname);
|
|
5870
|
+
const [lastMatched, setLastMatched] = useState(
|
|
5871
|
+
() => match.isFallback ? null : match.item
|
|
5872
|
+
);
|
|
5873
|
+
const [hold, setHold] = useState(() => ({
|
|
5874
|
+
isOpen: false,
|
|
5875
|
+
pathname: normalizedPathname
|
|
5876
|
+
}));
|
|
5877
|
+
if (!match.isFallback && match.item !== lastMatched) {
|
|
5878
|
+
setLastMatched(match.item);
|
|
5879
|
+
}
|
|
5880
|
+
if (hold.pathname !== normalizedPathname) {
|
|
5881
|
+
setHold({ isOpen: true, pathname: normalizedPathname });
|
|
6071
5882
|
}
|
|
6072
|
-
|
|
5883
|
+
useEffect(() => {
|
|
5884
|
+
if (!hold.isOpen || isNavigating) return;
|
|
5885
|
+
const timer = setTimeout(
|
|
5886
|
+
() => setHold(
|
|
5887
|
+
(current) => current.pathname === hold.pathname ? { ...current, isOpen: false } : current
|
|
5888
|
+
),
|
|
5889
|
+
holdMs
|
|
5890
|
+
);
|
|
5891
|
+
return () => clearTimeout(timer);
|
|
5892
|
+
}, [hold, holdMs, isNavigating]);
|
|
5893
|
+
const selected = selectPendingRouteItem({
|
|
5894
|
+
heldItem: lastMatched,
|
|
5895
|
+
isHolding: hold.isOpen && hold.pathname === normalizedPathname,
|
|
5896
|
+
match,
|
|
5897
|
+
pathname: normalizedPathname
|
|
5898
|
+
});
|
|
5899
|
+
const isHeld = selected !== match.item;
|
|
5900
|
+
return useMemo(
|
|
5901
|
+
() => isHeld && selected ? { ...selected, isRoutePending: true } : selected,
|
|
5902
|
+
[isHeld, selected]
|
|
5903
|
+
);
|
|
6073
5904
|
}
|
|
6074
5905
|
function resolveActiveItem({
|
|
6075
5906
|
rawItems,
|
|
@@ -6084,14 +5915,15 @@ function resolveActiveItem({
|
|
|
6084
5915
|
actionStackClass,
|
|
6085
5916
|
surfaceActions,
|
|
6086
5917
|
isPageLoading,
|
|
6087
|
-
attention
|
|
5918
|
+
attention,
|
|
5919
|
+
baseActiveItem: resolvedBaseActiveItem
|
|
6088
5920
|
}) {
|
|
6089
|
-
const baseActiveItem =
|
|
5921
|
+
const baseActiveItem = resolvedBaseActiveItem !== void 0 ? resolvedBaseActiveItem : resolveBaseActiveItemMatch({
|
|
6090
5922
|
rawItems,
|
|
6091
5923
|
dockItems,
|
|
6092
5924
|
pathname,
|
|
6093
5925
|
isNotFoundPage
|
|
6094
|
-
});
|
|
5926
|
+
}).item;
|
|
6095
5927
|
if (!baseActiveItem) return null;
|
|
6096
5928
|
if (attention?.kind === DOCK_ATTENTION_KIND.SURFACE)
|
|
6097
5929
|
return applySurfaceToDockItem(
|
|
@@ -6143,7 +5975,7 @@ function useDockItems() {
|
|
|
6143
5975
|
);
|
|
6144
5976
|
return { rawItems };
|
|
6145
5977
|
}
|
|
6146
|
-
function useDockDisplay(overridePathname) {
|
|
5978
|
+
function useDockDisplay(overridePathname, { isNavigating = false } = {}) {
|
|
6147
5979
|
const routerPathname = usePathname();
|
|
6148
5980
|
const pathname = overridePathname || routerPathname;
|
|
6149
5981
|
const loadingState = useDockLoadingState();
|
|
@@ -6223,8 +6055,21 @@ function useDockDisplay(overridePathname) {
|
|
|
6223
6055
|
() => buildDockItems({ rawItems, expanded, searchQuery, isNotFoundPage }),
|
|
6224
6056
|
[rawItems, expanded, searchQuery, isNotFoundPage]
|
|
6225
6057
|
);
|
|
6058
|
+
const baseMatch = useMemo(
|
|
6059
|
+
() => resolveBaseActiveItemMatch({
|
|
6060
|
+
rawItems,
|
|
6061
|
+
dockItems,
|
|
6062
|
+
pathname,
|
|
6063
|
+
isNotFoundPage
|
|
6064
|
+
}),
|
|
6065
|
+
[rawItems, dockItems, pathname, isNotFoundPage]
|
|
6066
|
+
);
|
|
6067
|
+
const baseActiveItem = usePendingRouteHold(pathname, baseMatch, {
|
|
6068
|
+
isNavigating
|
|
6069
|
+
});
|
|
6226
6070
|
const activeItem = useMemo(
|
|
6227
6071
|
() => resolveActiveItem({
|
|
6072
|
+
baseActiveItem,
|
|
6228
6073
|
rawItems,
|
|
6229
6074
|
dockItems,
|
|
6230
6075
|
pathname,
|
|
@@ -6249,6 +6094,7 @@ function useDockDisplay(overridePathname) {
|
|
|
6249
6094
|
attention
|
|
6250
6095
|
}),
|
|
6251
6096
|
[
|
|
6097
|
+
baseActiveItem,
|
|
6252
6098
|
rawItems,
|
|
6253
6099
|
dockItems,
|
|
6254
6100
|
pathname,
|
|
@@ -6301,8 +6147,15 @@ function useDockLayout({
|
|
|
6301
6147
|
const routePathname = usePathname();
|
|
6302
6148
|
const pathname = overridePathname || routePathname;
|
|
6303
6149
|
const { displayItems, displayActiveIndex } = useMemo(() => {
|
|
6304
|
-
const
|
|
6305
|
-
const
|
|
6150
|
+
const registeredItems = dockItems || [];
|
|
6151
|
+
const registeredIndex = findDockItemIndex(
|
|
6152
|
+
registeredItems,
|
|
6153
|
+
activeItem ?? null,
|
|
6154
|
+
pathname
|
|
6155
|
+
);
|
|
6156
|
+
const isHeldOutsideStack = registeredIndex === -1 && Boolean(activeItem?.isRoutePending);
|
|
6157
|
+
const items = isHeldOutsideStack ? [activeItem, ...registeredItems] : registeredItems;
|
|
6158
|
+
const activeIndex = isHeldOutsideStack ? 0 : registeredIndex;
|
|
6306
6159
|
const itemsWithActiveItem = replaceActiveItem(
|
|
6307
6160
|
items,
|
|
6308
6161
|
activeIndex,
|
|
@@ -6357,7 +6210,9 @@ function useDock() {
|
|
|
6357
6210
|
pathname
|
|
6358
6211
|
} = core;
|
|
6359
6212
|
const effectivePathname = activeTransaction?.to ? normalizePath(activeTransaction.to) : pathname;
|
|
6360
|
-
const display = useDockDisplay(effectivePathname
|
|
6213
|
+
const display = useDockDisplay(effectivePathname, {
|
|
6214
|
+
isNavigating: Boolean(activeTransaction)
|
|
6215
|
+
});
|
|
6361
6216
|
const { dockItems, activeItem, statusState, attention, topology } = display;
|
|
6362
6217
|
const isHudModeActive = attention?.kind === DOCK_ATTENTION_KIND.HUD || attention?.kind === DOCK_ATTENTION_KIND.OPERATION;
|
|
6363
6218
|
const isSurfaceActive = Boolean(activeItem?.isSurface);
|
|
@@ -7834,6 +7689,7 @@ function StandardItemContent({
|
|
|
7834
7689
|
badge,
|
|
7835
7690
|
isActive = false,
|
|
7836
7691
|
footerNode,
|
|
7692
|
+
isActionDismissed = false,
|
|
7837
7693
|
isHudActive = false,
|
|
7838
7694
|
hud = null,
|
|
7839
7695
|
clearHud = null,
|
|
@@ -7841,6 +7697,13 @@ function StandardItemContent({
|
|
|
7841
7697
|
pathname
|
|
7842
7698
|
}) {
|
|
7843
7699
|
const dockMotion = useDockMotion();
|
|
7700
|
+
const actionVariants = useMemo(
|
|
7701
|
+
() => ({
|
|
7702
|
+
...dockMotion.variants.textCrossfade,
|
|
7703
|
+
dismissed: dockMotion.variants.actionDismiss.exit
|
|
7704
|
+
}),
|
|
7705
|
+
[dockMotion]
|
|
7706
|
+
);
|
|
7844
7707
|
const {
|
|
7845
7708
|
item,
|
|
7846
7709
|
isPlaying,
|
|
@@ -7913,15 +7776,27 @@ function StandardItemContent({
|
|
|
7913
7776
|
contextCommands
|
|
7914
7777
|
}
|
|
7915
7778
|
),
|
|
7916
|
-
footerNode ? /* @__PURE__ */ jsx(
|
|
7917
|
-
|
|
7779
|
+
/* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", initial: false, children: footerNode ? /* @__PURE__ */ jsx(
|
|
7780
|
+
motion.div,
|
|
7918
7781
|
{
|
|
7782
|
+
variants: actionVariants,
|
|
7783
|
+
initial: "hidden",
|
|
7784
|
+
animate: isActionDismissed ? "dismissed" : "visible",
|
|
7785
|
+
exit: "exit",
|
|
7786
|
+
transition: isActionDismissed ? dockMotion.transitions.actionDismiss : dockMotion.transitions.fade,
|
|
7919
7787
|
className: theme.slots.cardFooter,
|
|
7920
7788
|
style: theme.styles.cardFooter,
|
|
7921
|
-
children:
|
|
7789
|
+
children: /* @__PURE__ */ jsx(
|
|
7790
|
+
"div",
|
|
7791
|
+
{
|
|
7792
|
+
className: theme.slots.cardAction,
|
|
7793
|
+
onClick: stopPropagationOnly,
|
|
7794
|
+
children: footerNode
|
|
7795
|
+
}
|
|
7796
|
+
)
|
|
7922
7797
|
},
|
|
7923
|
-
"dock-
|
|
7924
|
-
) : null
|
|
7798
|
+
"dock-card-footer"
|
|
7799
|
+
) : null })
|
|
7925
7800
|
]
|
|
7926
7801
|
},
|
|
7927
7802
|
"dock-standard-content"
|
|
@@ -7964,6 +7839,8 @@ var DockCardItem = memo(function DockCardItem2({
|
|
|
7964
7839
|
cardContentRef,
|
|
7965
7840
|
itemStyle,
|
|
7966
7841
|
renderedActionSlot,
|
|
7842
|
+
isActionDismissed,
|
|
7843
|
+
showsSurfaceLayer,
|
|
7967
7844
|
hasNestedInteractiveContent,
|
|
7968
7845
|
headerRestoreVariants,
|
|
7969
7846
|
handleMouseEnter,
|
|
@@ -8005,6 +7882,7 @@ var DockCardItem = memo(function DockCardItem2({
|
|
|
8005
7882
|
});
|
|
8006
7883
|
const theme = useDockTheme();
|
|
8007
7884
|
const renderedActionNode = renderActionSlot(renderedActionSlot);
|
|
7885
|
+
const layerExit = isCollapsedBackgroundCard ? DOCK_UNSEEN_EXIT : "exit";
|
|
8008
7886
|
if (isCollapsedGhostCard) {
|
|
8009
7887
|
return /* @__PURE__ */ jsx(
|
|
8010
7888
|
motion.div,
|
|
@@ -8105,13 +7983,13 @@ var DockCardItem = memo(function DockCardItem2({
|
|
|
8105
7983
|
willChange: "transform",
|
|
8106
7984
|
pointerEvents: !expanded && position > 0 && !isExtensionShelf ? "none" : "auto"
|
|
8107
7985
|
},
|
|
8108
|
-
children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", initial: false, children:
|
|
7986
|
+
children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", initial: false, children: showsSurfaceLayer ? /* @__PURE__ */ jsx(
|
|
8109
7987
|
motion.div,
|
|
8110
7988
|
{
|
|
8111
7989
|
variants: dockMotion.variants.headerSwap,
|
|
8112
7990
|
initial: "hidden",
|
|
8113
7991
|
animate: "visible",
|
|
8114
|
-
exit:
|
|
7992
|
+
exit: layerExit,
|
|
8115
7993
|
transition: dockMotion.transitions.headerSwap,
|
|
8116
7994
|
style: DOCK_COMPOSITOR_STYLE,
|
|
8117
7995
|
className: theme.slots.cardSurface,
|
|
@@ -8124,7 +8002,7 @@ var DockCardItem = memo(function DockCardItem2({
|
|
|
8124
8002
|
variants: dockMotion.variants.extensionShelf,
|
|
8125
8003
|
initial: "hidden",
|
|
8126
8004
|
animate: "visible",
|
|
8127
|
-
exit:
|
|
8005
|
+
exit: layerExit,
|
|
8128
8006
|
transition: dockMotion.transitions.headerSwap,
|
|
8129
8007
|
style: DOCK_COMPOSITOR_STYLE,
|
|
8130
8008
|
className: theme.slots.cardShelf,
|
|
@@ -8137,7 +8015,7 @@ var DockCardItem = memo(function DockCardItem2({
|
|
|
8137
8015
|
variants: headerRestoreVariants,
|
|
8138
8016
|
initial: "hidden",
|
|
8139
8017
|
animate: item.surfacePhase === DOCK_SURFACE_PHASE.DISMISSING_ACTION ? "hidden" : "visible",
|
|
8140
|
-
exit:
|
|
8018
|
+
exit: layerExit,
|
|
8141
8019
|
transition: item.surfacePhase === DOCK_SURFACE_PHASE.DISMISSING_ACTION ? dockMotion.transitions.anticipation : dockMotion.transitions.headerSwap,
|
|
8142
8020
|
style: { ...DOCK_COMPOSITOR_STYLE, willChange: "transform" },
|
|
8143
8021
|
className: theme.slots.cardStandard,
|
|
@@ -8155,33 +8033,8 @@ var DockCardItem = memo(function DockCardItem2({
|
|
|
8155
8033
|
clearHud,
|
|
8156
8034
|
contextCommands,
|
|
8157
8035
|
pathname,
|
|
8158
|
-
footerNode: renderedActionNode ? /* @__PURE__ */ jsx(
|
|
8159
|
-
|
|
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
|
|
8036
|
+
footerNode: renderedActionNode ? /* @__PURE__ */ jsx(Suspense, { children: renderedActionNode }) : null,
|
|
8037
|
+
isActionDismissed
|
|
8185
8038
|
}
|
|
8186
8039
|
)
|
|
8187
8040
|
},
|
|
@@ -9868,7 +9721,7 @@ var dockModule = defineModule({
|
|
|
9868
9721
|
context: DockContext,
|
|
9869
9722
|
Provider: DockModuleProvider,
|
|
9870
9723
|
Overlay: Dock,
|
|
9871
|
-
uses: ["loading", "media", "notification"],
|
|
9724
|
+
uses: ["loading", "media", "navigation", "notification"],
|
|
9872
9725
|
registry: {
|
|
9873
9726
|
cleanupDelayMs: 600,
|
|
9874
9727
|
keyPolicy: "path",
|
|
@@ -9884,5 +9737,5 @@ var dockModule = defineModule({
|
|
|
9884
9737
|
});
|
|
9885
9738
|
|
|
9886
9739
|
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-
|
|
9888
|
-
//# sourceMappingURL=chunk-
|
|
9740
|
+
//# sourceMappingURL=chunk-JIXBFFRD.js.map
|
|
9741
|
+
//# sourceMappingURL=chunk-JIXBFFRD.js.map
|