@flowsterix/react 0.5.0 → 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.
- package/dist/chunk-WCLT3A6G.mjs +0 -0
- package/dist/components/TourPopoverPortal.d.ts +1 -1
- package/dist/components/TourPopoverPortal.d.ts.map +1 -1
- package/dist/hooks/useHiddenTargetFallback.d.ts.map +1 -1
- package/dist/hooks/useHudState.d.ts.map +1 -1
- package/dist/hooks/useHudTargetIssue.d.ts.map +1 -1
- package/dist/hooks/useRouteMismatch.d.ts +9 -0
- package/dist/hooks/useRouteMismatch.d.ts.map +1 -0
- package/dist/index.cjs +242 -162
- package/dist/index.mjs +160 -80
- package/dist/labels.d.ts +10 -0
- package/dist/labels.d.ts.map +1 -1
- package/dist/router/index.mjs +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -72,7 +72,17 @@ var defaultLabels = {
|
|
|
72
72
|
ariaStepProgress: ({ current, total }) => `Step ${current} of ${total}`,
|
|
73
73
|
ariaTimeRemaining: ({ ms }) => `${Math.ceil(ms / 1e3)} seconds remaining`,
|
|
74
74
|
ariaDelayProgress: "Auto-advance progress",
|
|
75
|
-
formatTimeRemaining: ({ ms }) => `${Math.ceil(ms / 1e3)}s remaining
|
|
75
|
+
formatTimeRemaining: ({ ms }) => `${Math.ceil(ms / 1e3)}s remaining`,
|
|
76
|
+
targetIssue: {
|
|
77
|
+
missingTitle: "Target not visible",
|
|
78
|
+
missingBody: "The target element is not currently visible. Make sure the UI piece is mounted and displayed.",
|
|
79
|
+
missingHint: "Showing the last known position until the element returns.",
|
|
80
|
+
hiddenTitle: "Target not visible",
|
|
81
|
+
hiddenBody: "The target element is not currently visible. Make sure the UI piece is mounted and displayed.",
|
|
82
|
+
hiddenHint: "Showing the last known position until the element returns.",
|
|
83
|
+
detachedTitle: "Target left the page",
|
|
84
|
+
detachedBody: "Navigate back to the screen that contains this element or reopen it before continuing the tour."
|
|
85
|
+
}
|
|
76
86
|
};
|
|
77
87
|
var LabelsContext = (0, import_react.createContext)(defaultLabels);
|
|
78
88
|
var LabelsProvider = LabelsContext.Provider;
|
|
@@ -1663,7 +1673,7 @@ var useTourTarget = () => {
|
|
|
1663
1673
|
};
|
|
1664
1674
|
|
|
1665
1675
|
// src/hooks/useHudState.ts
|
|
1666
|
-
var
|
|
1676
|
+
var import_react10 = require("react");
|
|
1667
1677
|
|
|
1668
1678
|
// src/hooks/useAdvanceRules.ts
|
|
1669
1679
|
var import_react6 = require("react");
|
|
@@ -1925,7 +1935,8 @@ var useHiddenTargetFallback = ({
|
|
|
1925
1935
|
clearGraceTimeout();
|
|
1926
1936
|
const isHiddenOrDetached = (target.visibility === "hidden" || target.visibility === "detached") && target.status === "ready";
|
|
1927
1937
|
const isMissingWithNoRect = target.visibility === "missing" && target.status === "resolving" && target.rect === null && target.lastResolvedRect === null;
|
|
1928
|
-
const
|
|
1938
|
+
const isMissingAfterNavigation = target.visibility === "missing" && target.status === "resolving" && target.rect === null;
|
|
1939
|
+
const shouldHandleHiddenTarget = !target.isScreen && (isHiddenOrDetached || isMissingWithNoRect || isMissingAfterNavigation);
|
|
1929
1940
|
if (!shouldHandleHiddenTarget) {
|
|
1930
1941
|
setUsingScreenFallback(false);
|
|
1931
1942
|
setIsInGracePeriod(false);
|
|
@@ -1984,14 +1995,77 @@ var useHiddenTargetFallback = ({
|
|
|
1984
1995
|
};
|
|
1985
1996
|
};
|
|
1986
1997
|
|
|
1987
|
-
// src/hooks/
|
|
1998
|
+
// src/hooks/useRouteMismatch.ts
|
|
1988
1999
|
var import_react8 = require("react");
|
|
2000
|
+
|
|
2001
|
+
// src/router/utils.ts
|
|
2002
|
+
var ensurePrefix = (value, prefix) => value.startsWith(prefix) ? value : `${prefix}${value}`;
|
|
2003
|
+
var isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
|
|
2004
|
+
var toSearchString = (value) => {
|
|
2005
|
+
if (!isNonEmptyString(value)) {
|
|
2006
|
+
if (value instanceof URLSearchParams) {
|
|
2007
|
+
const serialized = value.toString();
|
|
2008
|
+
return serialized.length > 0 ? `?${serialized}` : "";
|
|
2009
|
+
}
|
|
2010
|
+
if (typeof value === "object" && value !== null) {
|
|
2011
|
+
try {
|
|
2012
|
+
const params = new URLSearchParams();
|
|
2013
|
+
for (const [key, raw] of Object.entries(
|
|
2014
|
+
value
|
|
2015
|
+
)) {
|
|
2016
|
+
if (raw === void 0 || raw === null) continue;
|
|
2017
|
+
params.set(key, String(raw));
|
|
2018
|
+
}
|
|
2019
|
+
const serialized = params.toString();
|
|
2020
|
+
return serialized.length > 0 ? `?${serialized}` : "";
|
|
2021
|
+
} catch {
|
|
2022
|
+
return "";
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
return "";
|
|
2026
|
+
}
|
|
2027
|
+
if (value === "?") return "";
|
|
2028
|
+
return value.startsWith("?") ? value : ensurePrefix(value, "?");
|
|
2029
|
+
};
|
|
2030
|
+
var toHashString = (value) => {
|
|
2031
|
+
if (!isNonEmptyString(value)) {
|
|
2032
|
+
return "";
|
|
2033
|
+
}
|
|
2034
|
+
if (value === "#") return "";
|
|
2035
|
+
return value.startsWith("#") ? value : ensurePrefix(value, "#");
|
|
2036
|
+
};
|
|
2037
|
+
var createPathString = (pathname, search, hash) => {
|
|
2038
|
+
const normalizedPath = isNonEmptyString(pathname) ? pathname.startsWith("/") ? pathname : `/${pathname}` : "/";
|
|
2039
|
+
const searchPart = toSearchString(search);
|
|
2040
|
+
const hashPart = toHashString(hash);
|
|
2041
|
+
return `${normalizedPath}${searchPart}${hashPart}`;
|
|
2042
|
+
};
|
|
2043
|
+
|
|
2044
|
+
// src/hooks/useRouteMismatch.ts
|
|
2045
|
+
var useRouteMismatch = (step) => {
|
|
2046
|
+
const [currentPath, setCurrentPath] = (0, import_react8.useState)(() => getCurrentRoutePath());
|
|
2047
|
+
(0, import_react8.useEffect)(() => {
|
|
2048
|
+
return subscribeToRouteChanges((path) => {
|
|
2049
|
+
setCurrentPath(path);
|
|
2050
|
+
});
|
|
2051
|
+
}, []);
|
|
2052
|
+
const expectedRoute = step?.route;
|
|
2053
|
+
const isRouteMismatch = step !== null && expectedRoute !== void 0 && !matchRoute({ pattern: expectedRoute, path: currentPath });
|
|
2054
|
+
return {
|
|
2055
|
+
isRouteMismatch,
|
|
2056
|
+
currentPath,
|
|
2057
|
+
expectedRoute
|
|
2058
|
+
};
|
|
2059
|
+
};
|
|
2060
|
+
|
|
2061
|
+
// src/hooks/useViewportRect.ts
|
|
2062
|
+
var import_react9 = require("react");
|
|
1989
2063
|
var useViewportRect = () => {
|
|
1990
|
-
const [viewport, setViewport] = (0,
|
|
2064
|
+
const [viewport, setViewport] = (0, import_react9.useState)(
|
|
1991
2065
|
() => getViewportRect()
|
|
1992
2066
|
);
|
|
1993
|
-
const rafRef = (0,
|
|
1994
|
-
(0,
|
|
2067
|
+
const rafRef = (0, import_react9.useRef)(null);
|
|
2068
|
+
(0, import_react9.useEffect)(() => {
|
|
1995
2069
|
if (!isBrowser) return;
|
|
1996
2070
|
const updateViewport = () => {
|
|
1997
2071
|
rafRef.current = null;
|
|
@@ -2033,12 +2107,12 @@ var normalizeFlowFilter = (value) => {
|
|
|
2033
2107
|
};
|
|
2034
2108
|
var useHudState = (options = {}) => {
|
|
2035
2109
|
const { flowId } = options;
|
|
2036
|
-
const flowFilter = (0,
|
|
2037
|
-
const { state, activeStep, activeFlowId, flows, next, complete } = useTour();
|
|
2110
|
+
const flowFilter = (0, import_react10.useMemo)(() => normalizeFlowFilter(flowId), [flowId]);
|
|
2111
|
+
const { state, activeStep, activeFlowId, flows, next, complete, pause, resume } = useTour();
|
|
2038
2112
|
const target = useTourTarget();
|
|
2039
2113
|
const viewportRect = useViewportRect();
|
|
2040
2114
|
useAdvanceRules(target);
|
|
2041
|
-
const matchesFlowFilter = (0,
|
|
2115
|
+
const matchesFlowFilter = (0, import_react10.useMemo)(() => {
|
|
2042
2116
|
if (!flowFilter || flowFilter.length === 0) return true;
|
|
2043
2117
|
if (!activeFlowId) return false;
|
|
2044
2118
|
return flowFilter.includes(activeFlowId);
|
|
@@ -2046,15 +2120,15 @@ var useHudState = (options = {}) => {
|
|
|
2046
2120
|
const isRunning = state?.status === "running";
|
|
2047
2121
|
const runningState = isRunning && matchesFlowFilter ? state : null;
|
|
2048
2122
|
const runningStep = runningState && activeStep ? activeStep : null;
|
|
2049
|
-
const [shouldRender, setShouldRender] = (0,
|
|
2123
|
+
const [shouldRender, setShouldRender] = (0, import_react10.useState)(
|
|
2050
2124
|
Boolean(runningStep)
|
|
2051
2125
|
);
|
|
2052
|
-
(0,
|
|
2126
|
+
(0, import_react10.useEffect)(() => {
|
|
2053
2127
|
if (runningStep) {
|
|
2054
2128
|
setShouldRender(true);
|
|
2055
2129
|
}
|
|
2056
2130
|
}, [runningStep?.id]);
|
|
2057
|
-
(0,
|
|
2131
|
+
(0, import_react10.useEffect)(() => {
|
|
2058
2132
|
if (!shouldRender) return;
|
|
2059
2133
|
if (runningStep) return;
|
|
2060
2134
|
if (target.status !== "idle") return;
|
|
@@ -2065,7 +2139,20 @@ var useHudState = (options = {}) => {
|
|
|
2065
2139
|
window.clearTimeout(timeoutId);
|
|
2066
2140
|
};
|
|
2067
2141
|
}, [runningStep, shouldRender, target.status]);
|
|
2068
|
-
const
|
|
2142
|
+
const { isRouteMismatch, currentPath } = useRouteMismatch(activeStep);
|
|
2143
|
+
const pausedForMissingTargetRef = (0, import_react10.useRef)(null);
|
|
2144
|
+
(0, import_react10.useEffect)(() => {
|
|
2145
|
+
if (!isRouteMismatch) return;
|
|
2146
|
+
if (!runningState || runningState.status !== "running") return;
|
|
2147
|
+
pause();
|
|
2148
|
+
}, [isRouteMismatch, runningState, pause]);
|
|
2149
|
+
(0, import_react10.useEffect)(() => {
|
|
2150
|
+
if (isRouteMismatch) return;
|
|
2151
|
+
if (pausedForMissingTargetRef.current !== null) return;
|
|
2152
|
+
if (!state || state.status !== "paused") return;
|
|
2153
|
+
resume();
|
|
2154
|
+
}, [isRouteMismatch, state, resume]);
|
|
2155
|
+
const skipHiddenStep = (0, import_react10.useCallback)(() => {
|
|
2069
2156
|
if (!runningState || runningState.status !== "running") return;
|
|
2070
2157
|
if (!activeFlowId) return;
|
|
2071
2158
|
const flow = flows.get(activeFlowId);
|
|
@@ -2083,6 +2170,35 @@ var useHudState = (options = {}) => {
|
|
|
2083
2170
|
viewportRect,
|
|
2084
2171
|
onSkip: skipHiddenStep
|
|
2085
2172
|
});
|
|
2173
|
+
(0, import_react10.useEffect)(() => {
|
|
2174
|
+
if (isRouteMismatch) return;
|
|
2175
|
+
if (activeStep?.route !== void 0) return;
|
|
2176
|
+
if (isInGracePeriod) return;
|
|
2177
|
+
if (target.visibility !== "missing") return;
|
|
2178
|
+
if (target.isScreen) return;
|
|
2179
|
+
if (!runningState || runningState.status !== "running") return;
|
|
2180
|
+
pausedForMissingTargetRef.current = currentPath;
|
|
2181
|
+
pause();
|
|
2182
|
+
}, [
|
|
2183
|
+
isRouteMismatch,
|
|
2184
|
+
activeStep?.route,
|
|
2185
|
+
isInGracePeriod,
|
|
2186
|
+
target.visibility,
|
|
2187
|
+
target.isScreen,
|
|
2188
|
+
runningState,
|
|
2189
|
+
currentPath,
|
|
2190
|
+
pause
|
|
2191
|
+
]);
|
|
2192
|
+
(0, import_react10.useEffect)(() => {
|
|
2193
|
+
if (pausedForMissingTargetRef.current === null) return;
|
|
2194
|
+
if (!state || state.status !== "paused") return;
|
|
2195
|
+
if (currentPath === pausedForMissingTargetRef.current) return;
|
|
2196
|
+
pausedForMissingTargetRef.current = null;
|
|
2197
|
+
resume();
|
|
2198
|
+
}, [currentPath, state, resume]);
|
|
2199
|
+
(0, import_react10.useEffect)(() => {
|
|
2200
|
+
pausedForMissingTargetRef.current = null;
|
|
2201
|
+
}, [activeStep?.id]);
|
|
2086
2202
|
const canRenderStep = Boolean(runningStep && runningState);
|
|
2087
2203
|
const focusTrapActive = canRenderStep;
|
|
2088
2204
|
const flowHudOptions = matchesFlowFilter && activeFlowId ? flows.get(activeFlowId)?.hud ?? null : null;
|
|
@@ -2105,24 +2221,24 @@ var useHudState = (options = {}) => {
|
|
|
2105
2221
|
};
|
|
2106
2222
|
|
|
2107
2223
|
// src/hooks/useHudDescription.ts
|
|
2108
|
-
var
|
|
2224
|
+
var import_react11 = require("react");
|
|
2109
2225
|
var sanitizeForId = (value) => {
|
|
2110
2226
|
const normalized = value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
2111
2227
|
return normalized.length > 0 ? normalized : "step";
|
|
2112
2228
|
};
|
|
2113
2229
|
var useHudDescription = (options) => {
|
|
2114
2230
|
const { step, fallbackAriaDescribedBy } = options;
|
|
2115
|
-
const targetDescription = (0,
|
|
2231
|
+
const targetDescription = (0, import_react11.useMemo)(() => {
|
|
2116
2232
|
if (!step) return null;
|
|
2117
2233
|
if (typeof step.target !== "object") return null;
|
|
2118
2234
|
const description = step.target.description;
|
|
2119
2235
|
return typeof description === "string" ? description : null;
|
|
2120
2236
|
}, [step]);
|
|
2121
|
-
const descriptionId = (0,
|
|
2237
|
+
const descriptionId = (0, import_react11.useMemo)(() => {
|
|
2122
2238
|
if (!step || !targetDescription) return void 0;
|
|
2123
2239
|
return `tour-step-${sanitizeForId(step.id)}-description`;
|
|
2124
2240
|
}, [step, targetDescription]);
|
|
2125
|
-
const combinedAriaDescribedBy = (0,
|
|
2241
|
+
const combinedAriaDescribedBy = (0, import_react11.useMemo)(() => {
|
|
2126
2242
|
const parts = [fallbackAriaDescribedBy, descriptionId].filter(Boolean);
|
|
2127
2243
|
return parts.length > 0 ? parts.join(" ") : void 0;
|
|
2128
2244
|
}, [descriptionId, fallbackAriaDescribedBy]);
|
|
@@ -2134,10 +2250,10 @@ var useHudDescription = (options) => {
|
|
|
2134
2250
|
};
|
|
2135
2251
|
|
|
2136
2252
|
// src/hooks/useHudShortcuts.ts
|
|
2137
|
-
var
|
|
2253
|
+
var import_react13 = require("react");
|
|
2138
2254
|
|
|
2139
2255
|
// src/hooks/useTourControls.ts
|
|
2140
|
-
var
|
|
2256
|
+
var import_react12 = require("react");
|
|
2141
2257
|
var hasManualAdvance = (rules) => rules.some((rule) => rule.type === "manual");
|
|
2142
2258
|
var didPreviousAdvanceViaRoute = (rules) => rules.some((rule) => rule.type === "route");
|
|
2143
2259
|
var didPreviousAdvanceViaTargetEvent = (rules) => rules.some((rule) => rule.type === "event" && rule.on === "target");
|
|
@@ -2153,7 +2269,7 @@ var useTourControls = () => {
|
|
|
2153
2269
|
flows,
|
|
2154
2270
|
activeStep
|
|
2155
2271
|
} = tour;
|
|
2156
|
-
const computed = (0,
|
|
2272
|
+
const computed = (0, import_react12.useMemo)(() => {
|
|
2157
2273
|
if (!state || state.status !== "running" || !activeStep) {
|
|
2158
2274
|
return {
|
|
2159
2275
|
isActive: false,
|
|
@@ -2202,11 +2318,11 @@ var useTourControls = () => {
|
|
|
2202
2318
|
} = computed;
|
|
2203
2319
|
const canGoBack = showBackButton && !backDisabled;
|
|
2204
2320
|
const canGoNext = showNextButton && !nextDisabled;
|
|
2205
|
-
const goBack = (0,
|
|
2321
|
+
const goBack = (0, import_react12.useCallback)(() => {
|
|
2206
2322
|
if (!canGoBack) return;
|
|
2207
2323
|
back();
|
|
2208
2324
|
}, [back, canGoBack]);
|
|
2209
|
-
const goNext = (0,
|
|
2325
|
+
const goNext = (0, import_react12.useCallback)(() => {
|
|
2210
2326
|
if (!canGoNext) return;
|
|
2211
2327
|
if (isLast) {
|
|
2212
2328
|
complete();
|
|
@@ -2214,7 +2330,7 @@ var useTourControls = () => {
|
|
|
2214
2330
|
next();
|
|
2215
2331
|
}
|
|
2216
2332
|
}, [canGoNext, complete, isLast, next]);
|
|
2217
|
-
return (0,
|
|
2333
|
+
return (0, import_react12.useMemo)(
|
|
2218
2334
|
() => ({
|
|
2219
2335
|
showBackButton,
|
|
2220
2336
|
backDisabled,
|
|
@@ -2259,7 +2375,7 @@ var useHudShortcuts = (target, options) => {
|
|
|
2259
2375
|
const escapeEnabled = options?.escape ?? true;
|
|
2260
2376
|
const { state } = useTour();
|
|
2261
2377
|
const { cancel, canGoBack, goBack, canGoNext, goNext, isActive } = useTourControls();
|
|
2262
|
-
(0,
|
|
2378
|
+
(0, import_react13.useEffect)(() => {
|
|
2263
2379
|
if (!isBrowser) return void 0;
|
|
2264
2380
|
if (!enabled) return void 0;
|
|
2265
2381
|
if (!target) return void 0;
|
|
@@ -2323,10 +2439,10 @@ var useHudShortcuts = (target, options) => {
|
|
|
2323
2439
|
};
|
|
2324
2440
|
|
|
2325
2441
|
// src/hooks/useTourHud.ts
|
|
2326
|
-
var
|
|
2442
|
+
var import_react16 = require("react");
|
|
2327
2443
|
|
|
2328
2444
|
// src/hooks/useBodyScrollLock.ts
|
|
2329
|
-
var
|
|
2445
|
+
var import_react14 = require("react");
|
|
2330
2446
|
var lockCount = 0;
|
|
2331
2447
|
var previousOverflow = null;
|
|
2332
2448
|
var acquireLock = () => {
|
|
@@ -2347,7 +2463,7 @@ var releaseLock = () => {
|
|
|
2347
2463
|
}
|
|
2348
2464
|
};
|
|
2349
2465
|
var useBodyScrollLock = (enabled) => {
|
|
2350
|
-
(0,
|
|
2466
|
+
(0, import_react14.useEffect)(() => {
|
|
2351
2467
|
if (!enabled) return;
|
|
2352
2468
|
acquireLock();
|
|
2353
2469
|
return () => {
|
|
@@ -2357,37 +2473,45 @@ var useBodyScrollLock = (enabled) => {
|
|
|
2357
2473
|
};
|
|
2358
2474
|
|
|
2359
2475
|
// src/hooks/useHudTargetIssue.ts
|
|
2360
|
-
var
|
|
2361
|
-
var deriveTargetIssue = (
|
|
2476
|
+
var import_react15 = require("react");
|
|
2477
|
+
var deriveTargetIssue = (params) => {
|
|
2478
|
+
const { target, labels } = params;
|
|
2362
2479
|
if (target.isScreen) return null;
|
|
2363
2480
|
if (target.status === "idle") return null;
|
|
2364
2481
|
switch (target.visibility) {
|
|
2365
2482
|
case "missing":
|
|
2483
|
+
return {
|
|
2484
|
+
type: "missing",
|
|
2485
|
+
title: labels.targetIssue.missingTitle,
|
|
2486
|
+
body: labels.targetIssue.missingBody,
|
|
2487
|
+
hint: target.rectSource === "stored" ? labels.targetIssue.missingHint : void 0
|
|
2488
|
+
};
|
|
2366
2489
|
case "hidden":
|
|
2367
2490
|
return {
|
|
2368
|
-
type:
|
|
2369
|
-
title:
|
|
2370
|
-
body:
|
|
2371
|
-
hint: target.rectSource === "stored" ?
|
|
2491
|
+
type: "hidden",
|
|
2492
|
+
title: labels.targetIssue.hiddenTitle,
|
|
2493
|
+
body: labels.targetIssue.hiddenBody,
|
|
2494
|
+
hint: target.rectSource === "stored" ? labels.targetIssue.hiddenHint : void 0
|
|
2372
2495
|
};
|
|
2373
2496
|
case "detached":
|
|
2374
2497
|
return {
|
|
2375
2498
|
type: "detached",
|
|
2376
|
-
title:
|
|
2377
|
-
body:
|
|
2499
|
+
title: labels.targetIssue.detachedTitle,
|
|
2500
|
+
body: labels.targetIssue.detachedBody
|
|
2378
2501
|
};
|
|
2379
2502
|
default:
|
|
2380
2503
|
return null;
|
|
2381
2504
|
}
|
|
2382
2505
|
};
|
|
2383
2506
|
var useHudTargetIssue = (target, options) => {
|
|
2507
|
+
const labels = useTourLabels();
|
|
2384
2508
|
const delayMs = Math.max(0, options?.delayMs ?? 500);
|
|
2385
|
-
const [armed, setArmed] = (0,
|
|
2386
|
-
const rawIssue = (0,
|
|
2387
|
-
() => deriveTargetIssue(target),
|
|
2388
|
-
[target.isScreen, target.rectSource, target.status, target.visibility]
|
|
2509
|
+
const [armed, setArmed] = (0, import_react15.useState)(false);
|
|
2510
|
+
const rawIssue = (0, import_react15.useMemo)(
|
|
2511
|
+
() => deriveTargetIssue({ target, labels }),
|
|
2512
|
+
[target.isScreen, target.rectSource, target.status, target.visibility, labels]
|
|
2389
2513
|
);
|
|
2390
|
-
(0,
|
|
2514
|
+
(0, import_react15.useEffect)(() => {
|
|
2391
2515
|
if (!rawIssue) {
|
|
2392
2516
|
setArmed(false);
|
|
2393
2517
|
return;
|
|
@@ -2421,7 +2545,7 @@ var useTourHud = (options = {}) => {
|
|
|
2421
2545
|
const { backdropInteraction, lockBodyScroll } = useTour();
|
|
2422
2546
|
const hudState = useHudState();
|
|
2423
2547
|
const disableDefaultHud = hudState.hudRenderMode === "none";
|
|
2424
|
-
const [popoverNode, setPopoverNode] = (0,
|
|
2548
|
+
const [popoverNode, setPopoverNode] = (0, import_react16.useState)(null);
|
|
2425
2549
|
const popoverOptions = hudState.flowHudOptions?.popover;
|
|
2426
2550
|
const description = useHudDescription({
|
|
2427
2551
|
step: hudState.runningStep,
|
|
@@ -2445,7 +2569,7 @@ var useTourHud = (options = {}) => {
|
|
|
2445
2569
|
radius: overlayRadius,
|
|
2446
2570
|
interactionMode: hudState.flowHudOptions?.backdrop?.interaction ?? backdropInteraction
|
|
2447
2571
|
};
|
|
2448
|
-
const popover = (0,
|
|
2572
|
+
const popover = (0, import_react16.useMemo)(() => {
|
|
2449
2573
|
return {
|
|
2450
2574
|
offset: popoverOptions?.offset ?? 16,
|
|
2451
2575
|
role: popoverOptions?.role ?? "dialog",
|
|
@@ -2457,13 +2581,13 @@ var useTourHud = (options = {}) => {
|
|
|
2457
2581
|
placement: hudState.runningStep?.placement
|
|
2458
2582
|
};
|
|
2459
2583
|
}, [hudState.runningStep?.placement, popoverOptions]);
|
|
2460
|
-
const descriptionResult = (0,
|
|
2584
|
+
const descriptionResult = (0, import_react16.useMemo)(() => {
|
|
2461
2585
|
return {
|
|
2462
2586
|
...description,
|
|
2463
2587
|
text: description.targetDescription
|
|
2464
2588
|
};
|
|
2465
2589
|
}, [description]);
|
|
2466
|
-
const focusManager = (0,
|
|
2590
|
+
const focusManager = (0, import_react16.useMemo)(
|
|
2467
2591
|
() => ({
|
|
2468
2592
|
active: hudState.focusTrapActive,
|
|
2469
2593
|
target: hudState.hudTarget,
|
|
@@ -2493,7 +2617,7 @@ var useTourHud = (options = {}) => {
|
|
|
2493
2617
|
};
|
|
2494
2618
|
|
|
2495
2619
|
// src/hooks/useTourOverlay.ts
|
|
2496
|
-
var
|
|
2620
|
+
var import_react17 = require("react");
|
|
2497
2621
|
var DEFAULT_PADDING = 12;
|
|
2498
2622
|
var DEFAULT_RADIUS = 12;
|
|
2499
2623
|
var DEFAULT_EDGE_BUFFER = 0;
|
|
@@ -2506,9 +2630,9 @@ var useTourOverlay = (options) => {
|
|
|
2506
2630
|
interactionMode = "passthrough",
|
|
2507
2631
|
isInGracePeriod = false
|
|
2508
2632
|
} = options;
|
|
2509
|
-
const hasShownRef = (0,
|
|
2510
|
-
const lastReadyTargetRef = (0,
|
|
2511
|
-
(0,
|
|
2633
|
+
const hasShownRef = (0, import_react17.useRef)(false);
|
|
2634
|
+
const lastReadyTargetRef = (0, import_react17.useRef)(null);
|
|
2635
|
+
(0, import_react17.useEffect)(() => {
|
|
2512
2636
|
if (!isBrowser) return;
|
|
2513
2637
|
if (target.status === "ready") {
|
|
2514
2638
|
hasShownRef.current = true;
|
|
@@ -2558,15 +2682,15 @@ var useTourOverlay = (options) => {
|
|
|
2558
2682
|
height: highlightHeight,
|
|
2559
2683
|
radius: highlightRadius
|
|
2560
2684
|
} : null;
|
|
2561
|
-
const maskCapable = (0,
|
|
2685
|
+
const maskCapable = (0, import_react17.useMemo)(() => supportsMasking(), []);
|
|
2562
2686
|
const isActive = target.status === "ready" || target.status === "resolving" && cachedTarget !== null || isInGracePeriod;
|
|
2563
2687
|
const shouldMask = maskCapable && isActive;
|
|
2564
|
-
const maskId = (0,
|
|
2688
|
+
const maskId = (0, import_react17.useMemo)(
|
|
2565
2689
|
() => `tour-overlay-mask-${Math.random().toString(36).slice(2, 10)}`,
|
|
2566
2690
|
[]
|
|
2567
2691
|
);
|
|
2568
2692
|
const maskUrl = shouldMask ? `url(#${maskId})` : void 0;
|
|
2569
|
-
const fallbackSegments = (0,
|
|
2693
|
+
const fallbackSegments = (0, import_react17.useMemo)(() => {
|
|
2570
2694
|
if (!isActive || shouldMask || !hasHighlightBounds || !highlightRect) {
|
|
2571
2695
|
return null;
|
|
2572
2696
|
}
|
|
@@ -2619,7 +2743,7 @@ var useTourOverlay = (options) => {
|
|
|
2619
2743
|
viewport.height,
|
|
2620
2744
|
viewport.width
|
|
2621
2745
|
]);
|
|
2622
|
-
const blockerSegments = (0,
|
|
2746
|
+
const blockerSegments = (0, import_react17.useMemo)(() => {
|
|
2623
2747
|
if (interactionMode !== "block") {
|
|
2624
2748
|
return null;
|
|
2625
2749
|
}
|
|
@@ -2744,12 +2868,12 @@ var useRadixDialogAdapter = (options = {}) => {
|
|
|
2744
2868
|
};
|
|
2745
2869
|
|
|
2746
2870
|
// src/hooks/useDelayAdvance.ts
|
|
2747
|
-
var
|
|
2871
|
+
var import_react18 = require("react");
|
|
2748
2872
|
var getTimestamp = () => typeof performance !== "undefined" && typeof performance.now === "function" ? performance.now() : Date.now();
|
|
2749
2873
|
var useDelayAdvance = () => {
|
|
2750
2874
|
const { delayInfo, activeStep, state } = useTour();
|
|
2751
|
-
const [now, setNow] = (0,
|
|
2752
|
-
(0,
|
|
2875
|
+
const [now, setNow] = (0, import_react18.useState)(() => getTimestamp());
|
|
2876
|
+
(0, import_react18.useEffect)(() => {
|
|
2753
2877
|
if (!delayInfo) return;
|
|
2754
2878
|
if (!activeStep || activeStep.id !== delayInfo.stepId) return;
|
|
2755
2879
|
if (!state || state.status !== "running") return;
|
|
@@ -2766,12 +2890,12 @@ var useDelayAdvance = () => {
|
|
|
2766
2890
|
}
|
|
2767
2891
|
};
|
|
2768
2892
|
}, [delayInfo, activeStep, state]);
|
|
2769
|
-
(0,
|
|
2893
|
+
(0, import_react18.useEffect)(() => {
|
|
2770
2894
|
if (!delayInfo) {
|
|
2771
2895
|
setNow(getTimestamp());
|
|
2772
2896
|
}
|
|
2773
2897
|
}, [delayInfo]);
|
|
2774
|
-
return (0,
|
|
2898
|
+
return (0, import_react18.useMemo)(() => {
|
|
2775
2899
|
const matchingStep = !!delayInfo && !!activeStep && activeStep.id === delayInfo.stepId;
|
|
2776
2900
|
const isRunning = matchingStep && state?.status === "running";
|
|
2777
2901
|
if (!delayInfo) {
|
|
@@ -2824,9 +2948,9 @@ var useDelayAdvance = () => {
|
|
|
2824
2948
|
};
|
|
2825
2949
|
|
|
2826
2950
|
// src/components/OverlayBackdrop.tsx
|
|
2827
|
-
var
|
|
2951
|
+
var import_react19 = require("react");
|
|
2828
2952
|
var import_react_dom = require("react-dom");
|
|
2829
|
-
var
|
|
2953
|
+
var import_react20 = require("motion/react");
|
|
2830
2954
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
2831
2955
|
var styles = {
|
|
2832
2956
|
root: {
|
|
@@ -2913,9 +3037,9 @@ var OverlayBackdrop = ({
|
|
|
2913
3037
|
viewport
|
|
2914
3038
|
} = overlay;
|
|
2915
3039
|
const hasHighlightBounds = Boolean(highlight.rect);
|
|
2916
|
-
const prevScreenTargetRef = (0,
|
|
3040
|
+
const prevScreenTargetRef = (0, import_react19.useRef)(null);
|
|
2917
3041
|
const shouldSnapHighlight = prevScreenTargetRef.current === true && !highlight.isScreen && hasHighlightBounds;
|
|
2918
|
-
(0,
|
|
3042
|
+
(0, import_react19.useEffect)(() => {
|
|
2919
3043
|
prevScreenTargetRef.current = highlight.isScreen;
|
|
2920
3044
|
}, [highlight.isScreen]);
|
|
2921
3045
|
const resolvedBlur = typeof blurAmount === "number" ? `${blurAmount}px` : "0px";
|
|
@@ -2983,7 +3107,7 @@ var OverlayBackdrop = ({
|
|
|
2983
3107
|
"aria-hidden": ariaHidden,
|
|
2984
3108
|
"data-tour-overlay": "",
|
|
2985
3109
|
children: [
|
|
2986
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3110
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react20.AnimatePresence, { mode: "popLayout", children: shouldMask ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2987
3111
|
MotionSvg,
|
|
2988
3112
|
{
|
|
2989
3113
|
width: "0",
|
|
@@ -3042,7 +3166,7 @@ var OverlayBackdrop = ({
|
|
|
3042
3166
|
},
|
|
3043
3167
|
"tour-mask"
|
|
3044
3168
|
) : null }),
|
|
3045
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3169
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react20.AnimatePresence, { mode: "popLayout", children: showBaseOverlay ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3046
3170
|
MotionDiv,
|
|
3047
3171
|
{
|
|
3048
3172
|
className: overlayClassName,
|
|
@@ -3070,7 +3194,7 @@ var OverlayBackdrop = ({
|
|
|
3070
3194
|
},
|
|
3071
3195
|
"tour-overlay"
|
|
3072
3196
|
) : null }),
|
|
3073
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3197
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react20.AnimatePresence, { mode: "popLayout", children: fallbackSegments ? fallbackSegments.map((segment) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3074
3198
|
MotionDiv,
|
|
3075
3199
|
{
|
|
3076
3200
|
className: segmentClassName,
|
|
@@ -3121,7 +3245,7 @@ var OverlayBackdrop = ({
|
|
|
3121
3245
|
))
|
|
3122
3246
|
}
|
|
3123
3247
|
) : null,
|
|
3124
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3248
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react20.AnimatePresence, { mode: "popLayout", children: showHighlightRing && isActive && hasHighlightBounds ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
3125
3249
|
MotionDiv,
|
|
3126
3250
|
{
|
|
3127
3251
|
className: ringClassName,
|
|
@@ -3152,7 +3276,7 @@ var OverlayBackdrop = ({
|
|
|
3152
3276
|
};
|
|
3153
3277
|
|
|
3154
3278
|
// src/components/TourPopoverPortal.tsx
|
|
3155
|
-
var
|
|
3279
|
+
var import_react21 = require("react");
|
|
3156
3280
|
var import_react_dom2 = require("react-dom");
|
|
3157
3281
|
var import_dom13 = require("@floating-ui/dom");
|
|
3158
3282
|
var FLOATING_OFFSET = 8;
|
|
@@ -3200,8 +3324,7 @@ var TourPopoverPortal = ({
|
|
|
3200
3324
|
layoutId,
|
|
3201
3325
|
containerComponent,
|
|
3202
3326
|
contentComponent,
|
|
3203
|
-
transitionsOverride
|
|
3204
|
-
isInGracePeriod = false
|
|
3327
|
+
transitionsOverride
|
|
3205
3328
|
}) => {
|
|
3206
3329
|
if (!isBrowser) return null;
|
|
3207
3330
|
const host = portalHost();
|
|
@@ -3214,12 +3337,12 @@ var TourPopoverPortal = ({
|
|
|
3214
3337
|
const popoverContentTransition = transitionsOverride?.popoverContent ?? adapter.transitions.popoverContent ?? DEFAULT_POPOVER_CONTENT_TRANSITION;
|
|
3215
3338
|
const viewport = useViewportRect();
|
|
3216
3339
|
const prefersMobileLayout = viewport.width <= MOBILE_BREAKPOINT || viewport.height <= MOBILE_HEIGHT_BREAKPOINT;
|
|
3217
|
-
const prefersMobileRef = (0,
|
|
3218
|
-
(0,
|
|
3340
|
+
const prefersMobileRef = (0, import_react21.useRef)(prefersMobileLayout);
|
|
3341
|
+
(0, import_react21.useEffect)(() => {
|
|
3219
3342
|
prefersMobileRef.current = prefersMobileLayout;
|
|
3220
3343
|
}, [prefersMobileLayout]);
|
|
3221
|
-
const lastReadyTargetRef = (0,
|
|
3222
|
-
(0,
|
|
3344
|
+
const lastReadyTargetRef = (0, import_react21.useRef)(null);
|
|
3345
|
+
(0, import_react21.useEffect)(() => {
|
|
3223
3346
|
if (target.status === "ready" && target.rect) {
|
|
3224
3347
|
lastReadyTargetRef.current = {
|
|
3225
3348
|
rect: { ...target.rect },
|
|
@@ -3232,10 +3355,10 @@ var TourPopoverPortal = ({
|
|
|
3232
3355
|
const cachedTarget = lastReadyTargetRef.current;
|
|
3233
3356
|
const resolvedRect = target.rect ?? target.lastResolvedRect ?? cachedTarget?.rect ?? null;
|
|
3234
3357
|
const resolvedIsScreen = target.status === "ready" ? target.isScreen : cachedTarget?.isScreen ?? target.isScreen;
|
|
3235
|
-
const
|
|
3358
|
+
const shouldHidePopover = !resolvedRect && !target.isScreen;
|
|
3236
3359
|
const fallbackRect = resolvedRect ?? viewport;
|
|
3237
3360
|
const fallbackIsScreen = resolvedIsScreen;
|
|
3238
|
-
const [floatingSize, setFloatingSize] = (0,
|
|
3361
|
+
const [floatingSize, setFloatingSize] = (0, import_react21.useState)(null);
|
|
3239
3362
|
const clampVertical = (value) => Math.min(viewport.height - 24, Math.max(24, value));
|
|
3240
3363
|
const clampHorizontal = (value) => Math.min(viewport.width - 24, Math.max(24, value));
|
|
3241
3364
|
const screenCenteredTop = viewport.height / 2 - (floatingSize?.height ?? 0) / 2;
|
|
@@ -3246,7 +3369,7 @@ var TourPopoverPortal = ({
|
|
|
3246
3369
|
const leftBase = fallbackIsScreen ? screenCenteredLeft : fallbackRect.left + fallbackRect.width / 2 - floatingWidth / 2;
|
|
3247
3370
|
const left = clampHorizontal(leftBase);
|
|
3248
3371
|
const fallbackTransform = "translate3d(0px, 0px, 0px)";
|
|
3249
|
-
const fallbackPosition = (0,
|
|
3372
|
+
const fallbackPosition = (0, import_react21.useMemo)(
|
|
3250
3373
|
() => ({
|
|
3251
3374
|
top,
|
|
3252
3375
|
left,
|
|
@@ -3254,7 +3377,7 @@ var TourPopoverPortal = ({
|
|
|
3254
3377
|
}),
|
|
3255
3378
|
[fallbackTransform, left, top]
|
|
3256
3379
|
);
|
|
3257
|
-
const centerInitialPosition = (0,
|
|
3380
|
+
const centerInitialPosition = (0, import_react21.useMemo)(
|
|
3258
3381
|
() => ({
|
|
3259
3382
|
top: viewport.height / 2,
|
|
3260
3383
|
left: viewport.width / 2,
|
|
@@ -3262,23 +3385,23 @@ var TourPopoverPortal = ({
|
|
|
3262
3385
|
}),
|
|
3263
3386
|
[viewport.height, viewport.width]
|
|
3264
3387
|
);
|
|
3265
|
-
const floatingRef = (0,
|
|
3266
|
-
const cachedFloatingPositionRef = (0,
|
|
3267
|
-
const appliedFloatingCacheRef = (0,
|
|
3268
|
-
const deferredScreenSnapRef = (0,
|
|
3269
|
-
const [layoutMode, setLayoutMode] = (0,
|
|
3388
|
+
const floatingRef = (0, import_react21.useRef)(null);
|
|
3389
|
+
const cachedFloatingPositionRef = (0, import_react21.useRef)(null);
|
|
3390
|
+
const appliedFloatingCacheRef = (0, import_react21.useRef)(null);
|
|
3391
|
+
const deferredScreenSnapRef = (0, import_react21.useRef)(null);
|
|
3392
|
+
const [layoutMode, setLayoutMode] = (0, import_react21.useState)(
|
|
3270
3393
|
() => prefersMobileLayout ? "mobile" : "floating"
|
|
3271
3394
|
);
|
|
3272
|
-
const [floatingPosition, setFloatingPosition] = (0,
|
|
3273
|
-
const [dragPosition, setDragPosition] = (0,
|
|
3274
|
-
const [isDragging, setIsDragging] = (0,
|
|
3275
|
-
const dragStateRef = (0,
|
|
3276
|
-
const overflowRetryRef = (0,
|
|
3395
|
+
const [floatingPosition, setFloatingPosition] = (0, import_react21.useState)(fallbackPosition);
|
|
3396
|
+
const [dragPosition, setDragPosition] = (0, import_react21.useState)(null);
|
|
3397
|
+
const [isDragging, setIsDragging] = (0, import_react21.useState)(false);
|
|
3398
|
+
const dragStateRef = (0, import_react21.useRef)(null);
|
|
3399
|
+
const overflowRetryRef = (0, import_react21.useRef)({
|
|
3277
3400
|
stepId: null,
|
|
3278
3401
|
attempts: 0
|
|
3279
3402
|
});
|
|
3280
|
-
const overflowRetryTimeoutRef = (0,
|
|
3281
|
-
(0,
|
|
3403
|
+
const overflowRetryTimeoutRef = (0, import_react21.useRef)(null);
|
|
3404
|
+
(0, import_react21.useLayoutEffect)(() => {
|
|
3282
3405
|
if (!isBrowser) return;
|
|
3283
3406
|
const node = floatingRef.current;
|
|
3284
3407
|
if (!node) return;
|
|
@@ -3297,25 +3420,25 @@ var TourPopoverPortal = ({
|
|
|
3297
3420
|
const autoAlignment = resolvedPlacement.endsWith(
|
|
3298
3421
|
"-start"
|
|
3299
3422
|
) ? "start" : resolvedPlacement.endsWith("-end") ? "end" : void 0;
|
|
3300
|
-
(0,
|
|
3423
|
+
(0, import_react21.useEffect)(() => {
|
|
3301
3424
|
setDragPosition(null);
|
|
3302
3425
|
setLayoutMode(prefersMobileRef.current ? "mobile" : "floating");
|
|
3303
3426
|
cachedFloatingPositionRef.current = null;
|
|
3304
3427
|
appliedFloatingCacheRef.current = null;
|
|
3305
3428
|
}, [target.stepId]);
|
|
3306
|
-
(0,
|
|
3429
|
+
(0, import_react21.useEffect)(() => {
|
|
3307
3430
|
if (layoutMode !== "manual") {
|
|
3308
3431
|
setDragPosition(null);
|
|
3309
3432
|
}
|
|
3310
3433
|
}, [layoutMode]);
|
|
3311
|
-
(0,
|
|
3434
|
+
(0, import_react21.useEffect)(() => {
|
|
3312
3435
|
cachedFloatingPositionRef.current = floatingPosition;
|
|
3313
3436
|
const cacheKey = getFloatingCacheKey(target);
|
|
3314
3437
|
if (cacheKey) {
|
|
3315
3438
|
floatingPositionCache.set(cacheKey, floatingPosition);
|
|
3316
3439
|
}
|
|
3317
3440
|
}, [floatingPosition, target.isScreen, target.stepId]);
|
|
3318
|
-
const dockedPosition = (0,
|
|
3441
|
+
const dockedPosition = (0, import_react21.useMemo)(
|
|
3319
3442
|
() => ({
|
|
3320
3443
|
top: viewport.height - DOCKED_MARGIN,
|
|
3321
3444
|
left: viewport.width - DOCKED_MARGIN,
|
|
@@ -3323,7 +3446,7 @@ var TourPopoverPortal = ({
|
|
|
3323
3446
|
}),
|
|
3324
3447
|
[viewport.height, viewport.width]
|
|
3325
3448
|
);
|
|
3326
|
-
const mobilePosition = (0,
|
|
3449
|
+
const mobilePosition = (0, import_react21.useMemo)(
|
|
3327
3450
|
() => ({
|
|
3328
3451
|
top: viewport.height - MOBILE_HORIZONTAL_GUTTER,
|
|
3329
3452
|
left: viewport.width / 2,
|
|
@@ -3331,17 +3454,17 @@ var TourPopoverPortal = ({
|
|
|
3331
3454
|
}),
|
|
3332
3455
|
[viewport.height, viewport.width]
|
|
3333
3456
|
);
|
|
3334
|
-
(0,
|
|
3457
|
+
(0, import_react21.useEffect)(() => {
|
|
3335
3458
|
if (layoutMode === "docked") {
|
|
3336
3459
|
setFloatingPosition(dockedPosition);
|
|
3337
3460
|
}
|
|
3338
3461
|
}, [dockedPosition, layoutMode]);
|
|
3339
|
-
(0,
|
|
3462
|
+
(0, import_react21.useEffect)(() => {
|
|
3340
3463
|
if (layoutMode === "mobile") {
|
|
3341
3464
|
setFloatingPosition(mobilePosition);
|
|
3342
3465
|
}
|
|
3343
3466
|
}, [layoutMode, mobilePosition]);
|
|
3344
|
-
(0,
|
|
3467
|
+
(0, import_react21.useEffect)(() => {
|
|
3345
3468
|
if (prefersMobileLayout) {
|
|
3346
3469
|
if (layoutMode !== "mobile") {
|
|
3347
3470
|
setLayoutMode("mobile");
|
|
@@ -3354,7 +3477,7 @@ var TourPopoverPortal = ({
|
|
|
3354
3477
|
setFloatingPosition(fallbackPosition);
|
|
3355
3478
|
}
|
|
3356
3479
|
}, [fallbackPosition, layoutMode, prefersMobileLayout]);
|
|
3357
|
-
(0,
|
|
3480
|
+
(0, import_react21.useEffect)(() => {
|
|
3358
3481
|
if (layoutMode !== "floating") return;
|
|
3359
3482
|
const stepId = target.stepId;
|
|
3360
3483
|
if (!stepId) return;
|
|
@@ -3378,7 +3501,7 @@ var TourPopoverPortal = ({
|
|
|
3378
3501
|
target.stepId
|
|
3379
3502
|
]);
|
|
3380
3503
|
const shouldDeferScreenSnap = layoutMode === "floating" && target.isScreen && Boolean(layoutId);
|
|
3381
|
-
(0,
|
|
3504
|
+
(0, import_react21.useEffect)(() => {
|
|
3382
3505
|
return () => {
|
|
3383
3506
|
if (deferredScreenSnapRef.current !== null) {
|
|
3384
3507
|
cancelAnimationFrame(deferredScreenSnapRef.current);
|
|
@@ -3386,7 +3509,7 @@ var TourPopoverPortal = ({
|
|
|
3386
3509
|
}
|
|
3387
3510
|
};
|
|
3388
3511
|
}, []);
|
|
3389
|
-
(0,
|
|
3512
|
+
(0, import_react21.useLayoutEffect)(() => {
|
|
3390
3513
|
if (layoutMode !== "floating") return;
|
|
3391
3514
|
if (target.status === "ready" && !target.isScreen) return;
|
|
3392
3515
|
if (shouldDeferScreenSnap) return;
|
|
@@ -3398,7 +3521,7 @@ var TourPopoverPortal = ({
|
|
|
3398
3521
|
target.isScreen,
|
|
3399
3522
|
target.status
|
|
3400
3523
|
]);
|
|
3401
|
-
(0,
|
|
3524
|
+
(0, import_react21.useEffect)(() => {
|
|
3402
3525
|
if (!shouldDeferScreenSnap) return;
|
|
3403
3526
|
if (deferredScreenSnapRef.current !== null) {
|
|
3404
3527
|
cancelAnimationFrame(deferredScreenSnapRef.current);
|
|
@@ -3425,14 +3548,14 @@ var TourPopoverPortal = ({
|
|
|
3425
3548
|
}
|
|
3426
3549
|
};
|
|
3427
3550
|
}, [fallbackPosition, shouldDeferScreenSnap]);
|
|
3428
|
-
(0,
|
|
3551
|
+
(0, import_react21.useEffect)(() => {
|
|
3429
3552
|
return () => {
|
|
3430
3553
|
if (overflowRetryTimeoutRef.current !== null) {
|
|
3431
3554
|
window.clearTimeout(overflowRetryTimeoutRef.current);
|
|
3432
3555
|
}
|
|
3433
3556
|
};
|
|
3434
3557
|
}, []);
|
|
3435
|
-
(0,
|
|
3558
|
+
(0, import_react21.useLayoutEffect)(() => {
|
|
3436
3559
|
if (!isBrowser) return;
|
|
3437
3560
|
const floatingEl = floatingRef.current;
|
|
3438
3561
|
const rectInfo = target.rect;
|
|
@@ -3566,7 +3689,7 @@ var TourPopoverPortal = ({
|
|
|
3566
3689
|
target.status,
|
|
3567
3690
|
target.stepId
|
|
3568
3691
|
]);
|
|
3569
|
-
(0,
|
|
3692
|
+
(0, import_react21.useLayoutEffect)(() => {
|
|
3570
3693
|
if (layoutMode !== "manual" || !dragPosition) return;
|
|
3571
3694
|
setFloatingPosition({
|
|
3572
3695
|
top: dragPosition.top,
|
|
@@ -3651,7 +3774,7 @@ var TourPopoverPortal = ({
|
|
|
3651
3774
|
}
|
|
3652
3775
|
event.preventDefault();
|
|
3653
3776
|
};
|
|
3654
|
-
(0,
|
|
3777
|
+
(0, import_react21.useEffect)(() => endDrag, []);
|
|
3655
3778
|
const shouldUseFallbackInitial = layoutMode !== "mobile" && (Boolean(target.lastResolvedRect) || Boolean(cachedTarget));
|
|
3656
3779
|
const floatingCacheKey = layoutMode === "mobile" ? null : getFloatingCacheKey(target);
|
|
3657
3780
|
const persistedFloatingInitial = floatingCacheKey && floatingPositionCache.has(floatingCacheKey) ? floatingPositionCache.get(floatingCacheKey) ?? null : null;
|
|
@@ -3738,12 +3861,12 @@ var TourPopoverPortal = ({
|
|
|
3738
3861
|
dragHandleProps,
|
|
3739
3862
|
descriptionProps
|
|
3740
3863
|
};
|
|
3741
|
-
if (
|
|
3864
|
+
if (shouldHidePopover) return null;
|
|
3742
3865
|
return (0, import_react_dom2.createPortal)(children(context), host);
|
|
3743
3866
|
};
|
|
3744
3867
|
|
|
3745
3868
|
// src/components/TourFocusManager.tsx
|
|
3746
|
-
var
|
|
3869
|
+
var import_react22 = require("react");
|
|
3747
3870
|
var import_react_dom3 = require("react-dom");
|
|
3748
3871
|
|
|
3749
3872
|
// src/utils/focus.ts
|
|
@@ -3820,18 +3943,18 @@ var TourFocusManager = ({
|
|
|
3820
3943
|
highlightRect,
|
|
3821
3944
|
guardElementFocusRing
|
|
3822
3945
|
}) => {
|
|
3823
|
-
const previousFocusRef = (0,
|
|
3824
|
-
const guardNodesRef = (0,
|
|
3946
|
+
const previousFocusRef = (0, import_react22.useRef)(null);
|
|
3947
|
+
const guardNodesRef = (0, import_react22.useRef)({
|
|
3825
3948
|
"target-start": null,
|
|
3826
3949
|
"target-end": null,
|
|
3827
3950
|
"popover-start": null,
|
|
3828
3951
|
"popover-end": null
|
|
3829
3952
|
});
|
|
3830
|
-
const lastTabDirectionRef = (0,
|
|
3831
|
-
const suppressGuardHopRef = (0,
|
|
3832
|
-
const [targetRingActive, setTargetRingActive] = (0,
|
|
3833
|
-
const [popoverRingActive, setPopoverRingActive] = (0,
|
|
3834
|
-
const [popoverRect, setPopoverRect] = (0,
|
|
3953
|
+
const lastTabDirectionRef = (0, import_react22.useRef)("forward");
|
|
3954
|
+
const suppressGuardHopRef = (0, import_react22.useRef)(null);
|
|
3955
|
+
const [targetRingActive, setTargetRingActive] = (0, import_react22.useState)(false);
|
|
3956
|
+
const [popoverRingActive, setPopoverRingActive] = (0, import_react22.useState)(false);
|
|
3957
|
+
const [popoverRect, setPopoverRect] = (0, import_react22.useState)(null);
|
|
3835
3958
|
const restoreFocus = () => {
|
|
3836
3959
|
const previous = previousFocusRef.current;
|
|
3837
3960
|
previousFocusRef.current = null;
|
|
@@ -3841,7 +3964,7 @@ var TourFocusManager = ({
|
|
|
3841
3964
|
});
|
|
3842
3965
|
}
|
|
3843
3966
|
};
|
|
3844
|
-
(0,
|
|
3967
|
+
(0, import_react22.useLayoutEffect)(() => {
|
|
3845
3968
|
if (!isBrowser) return;
|
|
3846
3969
|
if (!active) {
|
|
3847
3970
|
restoreFocus();
|
|
@@ -3857,7 +3980,7 @@ var TourFocusManager = ({
|
|
|
3857
3980
|
restoreFocus();
|
|
3858
3981
|
};
|
|
3859
3982
|
}, [active, popoverNode, target.element]);
|
|
3860
|
-
(0,
|
|
3983
|
+
(0, import_react22.useEffect)(() => {
|
|
3861
3984
|
if (!isBrowser) return;
|
|
3862
3985
|
if (!active) return;
|
|
3863
3986
|
const doc = popoverNode?.ownerDocument ?? target.element?.ownerDocument ?? document;
|
|
@@ -4051,7 +4174,7 @@ var TourFocusManager = ({
|
|
|
4051
4174
|
target.stepId,
|
|
4052
4175
|
target.visibility
|
|
4053
4176
|
]);
|
|
4054
|
-
(0,
|
|
4177
|
+
(0, import_react22.useLayoutEffect)(() => {
|
|
4055
4178
|
if (popoverRingActive && popoverNode) {
|
|
4056
4179
|
setPopoverRect(popoverNode.getBoundingClientRect());
|
|
4057
4180
|
} else {
|
|
@@ -4107,7 +4230,7 @@ var TourFocusManager = ({
|
|
|
4107
4230
|
};
|
|
4108
4231
|
|
|
4109
4232
|
// src/motion/useHudMotion.ts
|
|
4110
|
-
var
|
|
4233
|
+
var import_react23 = require("react");
|
|
4111
4234
|
var DEFAULT_HIGHLIGHT_TRANSITION2 = {
|
|
4112
4235
|
duration: 0.35,
|
|
4113
4236
|
ease: "easeOut",
|
|
@@ -4134,7 +4257,7 @@ var DEFAULT_POPOVER_CONTENT_TRANSITION2 = {
|
|
|
4134
4257
|
};
|
|
4135
4258
|
var useHudMotion = () => {
|
|
4136
4259
|
const adapter = useAnimationAdapter();
|
|
4137
|
-
return (0,
|
|
4260
|
+
return (0, import_react23.useMemo)(() => {
|
|
4138
4261
|
const components = {
|
|
4139
4262
|
...adapter.components
|
|
4140
4263
|
};
|
|
@@ -4150,49 +4273,6 @@ var useHudMotion = () => {
|
|
|
4150
4273
|
};
|
|
4151
4274
|
}, [adapter]);
|
|
4152
4275
|
};
|
|
4153
|
-
|
|
4154
|
-
// src/router/utils.ts
|
|
4155
|
-
var ensurePrefix = (value, prefix) => value.startsWith(prefix) ? value : `${prefix}${value}`;
|
|
4156
|
-
var isNonEmptyString = (value) => typeof value === "string" && value.length > 0;
|
|
4157
|
-
var toSearchString = (value) => {
|
|
4158
|
-
if (!isNonEmptyString(value)) {
|
|
4159
|
-
if (value instanceof URLSearchParams) {
|
|
4160
|
-
const serialized = value.toString();
|
|
4161
|
-
return serialized.length > 0 ? `?${serialized}` : "";
|
|
4162
|
-
}
|
|
4163
|
-
if (typeof value === "object" && value !== null) {
|
|
4164
|
-
try {
|
|
4165
|
-
const params = new URLSearchParams();
|
|
4166
|
-
for (const [key, raw] of Object.entries(
|
|
4167
|
-
value
|
|
4168
|
-
)) {
|
|
4169
|
-
if (raw === void 0 || raw === null) continue;
|
|
4170
|
-
params.set(key, String(raw));
|
|
4171
|
-
}
|
|
4172
|
-
const serialized = params.toString();
|
|
4173
|
-
return serialized.length > 0 ? `?${serialized}` : "";
|
|
4174
|
-
} catch {
|
|
4175
|
-
return "";
|
|
4176
|
-
}
|
|
4177
|
-
}
|
|
4178
|
-
return "";
|
|
4179
|
-
}
|
|
4180
|
-
if (value === "?") return "";
|
|
4181
|
-
return value.startsWith("?") ? value : ensurePrefix(value, "?");
|
|
4182
|
-
};
|
|
4183
|
-
var toHashString = (value) => {
|
|
4184
|
-
if (!isNonEmptyString(value)) {
|
|
4185
|
-
return "";
|
|
4186
|
-
}
|
|
4187
|
-
if (value === "#") return "";
|
|
4188
|
-
return value.startsWith("#") ? value : ensurePrefix(value, "#");
|
|
4189
|
-
};
|
|
4190
|
-
var createPathString = (pathname, search, hash) => {
|
|
4191
|
-
const normalizedPath = isNonEmptyString(pathname) ? pathname.startsWith("/") ? pathname : `/${pathname}` : "/";
|
|
4192
|
-
const searchPart = toSearchString(search);
|
|
4193
|
-
const hashPart = toHashString(hash);
|
|
4194
|
-
return `${normalizedPath}${searchPart}${hashPart}`;
|
|
4195
|
-
};
|
|
4196
4276
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4197
4277
|
0 && (module.exports = {
|
|
4198
4278
|
AnimationAdapterProvider,
|