@x-plat/design-system 0.16.1 → 0.16.3
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/components/Tour/index.cjs +105 -26
- package/dist/components/Tour/index.css +28 -5
- package/dist/components/Tour/index.d.cts +6 -0
- package/dist/components/Tour/index.d.ts +6 -0
- package/dist/components/Tour/index.js +105 -26
- package/dist/components/index.cjs +125 -44
- package/dist/components/index.css +28 -5
- package/dist/components/index.js +125 -44
- package/dist/index.cjs +130 -49
- package/dist/index.css +28 -5
- package/dist/index.js +130 -49
- package/guidelines/components/tour.md +31 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -12119,7 +12119,51 @@ Tooltip.displayName = "Tooltip";
|
|
|
12119
12119
|
var Tooltip_default = Tooltip;
|
|
12120
12120
|
|
|
12121
12121
|
// src/components/Tour/Tour.tsx
|
|
12122
|
+
var import_react45 = __toESM(require("react"), 1);
|
|
12123
|
+
|
|
12124
|
+
// src/tokens/hooks/useScrollLock.ts
|
|
12122
12125
|
var import_react44 = __toESM(require("react"), 1);
|
|
12126
|
+
var SCROLL_KEYS = /* @__PURE__ */ new Set([
|
|
12127
|
+
" ",
|
|
12128
|
+
"PageUp",
|
|
12129
|
+
"PageDown",
|
|
12130
|
+
"Home",
|
|
12131
|
+
"End",
|
|
12132
|
+
"ArrowUp",
|
|
12133
|
+
"ArrowDown",
|
|
12134
|
+
"ArrowLeft",
|
|
12135
|
+
"ArrowRight"
|
|
12136
|
+
]);
|
|
12137
|
+
var useScrollLock = (enabled, allowRef) => {
|
|
12138
|
+
import_react44.default.useEffect(() => {
|
|
12139
|
+
if (!enabled) return;
|
|
12140
|
+
const allowed = (target) => target instanceof Node && !!allowRef?.current?.contains(target);
|
|
12141
|
+
const block = (e) => {
|
|
12142
|
+
if (allowed(e.target)) return;
|
|
12143
|
+
e.preventDefault();
|
|
12144
|
+
};
|
|
12145
|
+
const onKey = (e) => {
|
|
12146
|
+
if (!SCROLL_KEYS.has(e.key)) return;
|
|
12147
|
+
if (allowed(e.target)) return;
|
|
12148
|
+
const el = e.target;
|
|
12149
|
+
const tag = el?.tagName;
|
|
12150
|
+
if (tag === "INPUT" || tag === "TEXTAREA" || el?.isContentEditable) return;
|
|
12151
|
+
e.preventDefault();
|
|
12152
|
+
};
|
|
12153
|
+
const opts = { passive: false, capture: true };
|
|
12154
|
+
window.addEventListener("wheel", block, opts);
|
|
12155
|
+
window.addEventListener("touchmove", block, opts);
|
|
12156
|
+
window.addEventListener("keydown", onKey, opts);
|
|
12157
|
+
return () => {
|
|
12158
|
+
window.removeEventListener("wheel", block, true);
|
|
12159
|
+
window.removeEventListener("touchmove", block, true);
|
|
12160
|
+
window.removeEventListener("keydown", onKey, true);
|
|
12161
|
+
};
|
|
12162
|
+
}, [enabled, allowRef]);
|
|
12163
|
+
};
|
|
12164
|
+
var useScrollLock_default = useScrollLock;
|
|
12165
|
+
|
|
12166
|
+
// src/components/Tour/Tour.tsx
|
|
12123
12167
|
var import_jsx_runtime355 = require("react/jsx-runtime");
|
|
12124
12168
|
var VIEWPORT_MARGIN = 16;
|
|
12125
12169
|
var DEFAULT_PADDING = 8;
|
|
@@ -12135,19 +12179,20 @@ var Tour = (props) => {
|
|
|
12135
12179
|
onClose,
|
|
12136
12180
|
current,
|
|
12137
12181
|
onStepChange,
|
|
12182
|
+
width = 380,
|
|
12138
12183
|
nextLabel = "\uB2E4\uC74C",
|
|
12139
12184
|
prevLabel = "\uC774\uC804",
|
|
12140
12185
|
skipLabel = "\uAC74\uB108\uB6F0\uAE30",
|
|
12141
12186
|
doneLabel = "\uB2E4 \uBD24\uC5B4\uC694"
|
|
12142
12187
|
} = props;
|
|
12143
|
-
const [uncontrolled, setUncontrolled] =
|
|
12188
|
+
const [uncontrolled, setUncontrolled] = import_react45.default.useState(0);
|
|
12144
12189
|
const index = current ?? uncontrolled;
|
|
12145
12190
|
const step = steps[index];
|
|
12146
12191
|
const isLast = index === steps.length - 1;
|
|
12147
|
-
const spotRef =
|
|
12148
|
-
const cardRef =
|
|
12149
|
-
const [targetFound, setTargetFound] =
|
|
12150
|
-
const goTo =
|
|
12192
|
+
const spotRef = import_react45.default.useRef(null);
|
|
12193
|
+
const cardRef = import_react45.default.useRef(null);
|
|
12194
|
+
const [targetFound, setTargetFound] = import_react45.default.useState(true);
|
|
12195
|
+
const goTo = import_react45.default.useCallback(
|
|
12151
12196
|
(next) => {
|
|
12152
12197
|
if (current === void 0) setUncontrolled(next);
|
|
12153
12198
|
onStepChange?.(next);
|
|
@@ -12156,13 +12201,35 @@ var Tour = (props) => {
|
|
|
12156
12201
|
);
|
|
12157
12202
|
useEscapeKey(open, () => onClose("skip"));
|
|
12158
12203
|
useFocusTrap(cardRef, open, { trap: true });
|
|
12159
|
-
|
|
12160
|
-
|
|
12161
|
-
|
|
12162
|
-
|
|
12163
|
-
|
|
12164
|
-
|
|
12165
|
-
|
|
12204
|
+
useScrollLock_default(open, cardRef);
|
|
12205
|
+
const stepsRef = import_react45.default.useRef(steps);
|
|
12206
|
+
stepsRef.current = steps;
|
|
12207
|
+
import_react45.default.useEffect(() => {
|
|
12208
|
+
if (!open) return;
|
|
12209
|
+
const target = stepsRef.current[index]?.target;
|
|
12210
|
+
if (!target) return;
|
|
12211
|
+
let stop = false;
|
|
12212
|
+
let tries = 0;
|
|
12213
|
+
const look = () => {
|
|
12214
|
+
if (stop) return;
|
|
12215
|
+
const el = resolve(target);
|
|
12216
|
+
if (el) {
|
|
12217
|
+
setTargetFound(true);
|
|
12218
|
+
el.scrollIntoView({ block: "center", inline: "nearest", behavior: "smooth" });
|
|
12219
|
+
return;
|
|
12220
|
+
}
|
|
12221
|
+
setTargetFound(false);
|
|
12222
|
+
if (tries < 60) {
|
|
12223
|
+
tries += 1;
|
|
12224
|
+
requestAnimationFrame(look);
|
|
12225
|
+
}
|
|
12226
|
+
};
|
|
12227
|
+
look();
|
|
12228
|
+
return () => {
|
|
12229
|
+
stop = true;
|
|
12230
|
+
};
|
|
12231
|
+
}, [open, index]);
|
|
12232
|
+
const place = import_react45.default.useCallback(() => {
|
|
12166
12233
|
const spot = spotRef.current;
|
|
12167
12234
|
const card = cardRef.current;
|
|
12168
12235
|
if (!spot || !card || !step) return;
|
|
@@ -12203,19 +12270,30 @@ var Tour = (props) => {
|
|
|
12203
12270
|
}
|
|
12204
12271
|
);
|
|
12205
12272
|
const limit = window.innerHeight - VIEWPORT_MARGIN * 2;
|
|
12206
|
-
const cardH = Math.min(
|
|
12273
|
+
const cardH = Math.min(card.scrollHeight, limit);
|
|
12207
12274
|
const cardW = card.offsetWidth;
|
|
12208
|
-
card.style.maxHeight = `${
|
|
12275
|
+
card.style.maxHeight = `${limit}px`;
|
|
12209
12276
|
card.style.top = `${clamp(placed.top, VIEWPORT_MARGIN, window.innerHeight - VIEWPORT_MARGIN - cardH)}px`;
|
|
12210
12277
|
card.style.left = `${clamp(placed.left, VIEWPORT_MARGIN, window.innerWidth - VIEWPORT_MARGIN - cardW)}px`;
|
|
12211
12278
|
}, [step]);
|
|
12212
|
-
|
|
12279
|
+
import_react45.default.useLayoutEffect(() => {
|
|
12213
12280
|
if (!open) return;
|
|
12214
12281
|
place();
|
|
12215
|
-
|
|
12216
|
-
|
|
12217
|
-
|
|
12218
|
-
|
|
12282
|
+
let raf = 0;
|
|
12283
|
+
let settled = 0;
|
|
12284
|
+
let last = "";
|
|
12285
|
+
const follow = () => {
|
|
12286
|
+
const el = resolve(stepsRef.current[index]?.target ?? "");
|
|
12287
|
+
const now = el ? JSON.stringify(el.getBoundingClientRect()) : "";
|
|
12288
|
+
settled = now === last ? settled + 1 : 0;
|
|
12289
|
+
last = now;
|
|
12290
|
+
place();
|
|
12291
|
+
if (settled < 3) raf = requestAnimationFrame(follow);
|
|
12292
|
+
};
|
|
12293
|
+
raf = requestAnimationFrame(follow);
|
|
12294
|
+
return () => cancelAnimationFrame(raf);
|
|
12295
|
+
}, [open, index, place]);
|
|
12296
|
+
import_react45.default.useEffect(() => {
|
|
12219
12297
|
if (!open) return;
|
|
12220
12298
|
const onMove = () => place();
|
|
12221
12299
|
window.addEventListener("scroll", onMove, { passive: true, capture: true });
|
|
@@ -12234,17 +12312,20 @@ var Tour = (props) => {
|
|
|
12234
12312
|
{
|
|
12235
12313
|
ref: cardRef,
|
|
12236
12314
|
className: "lib-xplat-tour-card",
|
|
12315
|
+
style: { "--tour-card-width": typeof width === "number" ? `${width}px` : width },
|
|
12237
12316
|
role: "dialog",
|
|
12238
12317
|
"aria-modal": "true",
|
|
12239
12318
|
"aria-label": typeof step.title === "string" ? step.title : "\uD654\uBA74 \uC548\uB0B4",
|
|
12240
12319
|
children: [
|
|
12241
|
-
/* @__PURE__ */ (0, import_jsx_runtime355.jsxs)("div", { className: "tour-card-
|
|
12242
|
-
|
|
12243
|
-
|
|
12244
|
-
|
|
12320
|
+
/* @__PURE__ */ (0, import_jsx_runtime355.jsxs)("div", { className: "tour-card-head", children: [
|
|
12321
|
+
/* @__PURE__ */ (0, import_jsx_runtime355.jsxs)("div", { className: "tour-card-progress", "aria-hidden": true, children: [
|
|
12322
|
+
index + 1,
|
|
12323
|
+
" / ",
|
|
12324
|
+
steps.length
|
|
12325
|
+
] }),
|
|
12326
|
+
step.title && /* @__PURE__ */ (0, import_jsx_runtime355.jsx)("div", { className: "tour-card-title", children: step.title })
|
|
12245
12327
|
] }),
|
|
12246
|
-
step.
|
|
12247
|
-
step.description && /* @__PURE__ */ (0, import_jsx_runtime355.jsx)("div", { className: "tour-card-description", children: step.description }),
|
|
12328
|
+
/* @__PURE__ */ (0, import_jsx_runtime355.jsx)("div", { className: "tour-card-body", children: step.description && /* @__PURE__ */ (0, import_jsx_runtime355.jsx)("div", { className: "tour-card-description", children: step.description }) }),
|
|
12248
12329
|
/* @__PURE__ */ (0, import_jsx_runtime355.jsxs)("div", { className: "tour-card-actions", children: [
|
|
12249
12330
|
/* @__PURE__ */ (0, import_jsx_runtime355.jsx)("button", { type: "button", className: "tour-skip", onClick: () => onClose("skip"), children: skipLabel }),
|
|
12250
12331
|
/* @__PURE__ */ (0, import_jsx_runtime355.jsxs)("div", { className: "tour-card-nav", children: [
|
|
@@ -12277,7 +12358,7 @@ Tour.displayName = "Tour";
|
|
|
12277
12358
|
var Tour_default = Tour;
|
|
12278
12359
|
|
|
12279
12360
|
// src/components/Video/Video.tsx
|
|
12280
|
-
var
|
|
12361
|
+
var import_react46 = __toESM(require("react"), 1);
|
|
12281
12362
|
var import_jsx_runtime356 = require("react/jsx-runtime");
|
|
12282
12363
|
var PipIcon = () => /* @__PURE__ */ (0, import_jsx_runtime356.jsxs)("svg", { viewBox: "0 0 24 24", width: "1em", height: "1em", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
12283
12364
|
/* @__PURE__ */ (0, import_jsx_runtime356.jsx)("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
@@ -12289,7 +12370,7 @@ var formatTime = (sec) => {
|
|
|
12289
12370
|
const s = Math.floor(sec % 60);
|
|
12290
12371
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
12291
12372
|
};
|
|
12292
|
-
var Video =
|
|
12373
|
+
var Video = import_react46.default.forwardRef((props, ref) => {
|
|
12293
12374
|
const {
|
|
12294
12375
|
src,
|
|
12295
12376
|
poster,
|
|
@@ -12313,21 +12394,21 @@ var Video = import_react45.default.forwardRef((props, ref) => {
|
|
|
12313
12394
|
children,
|
|
12314
12395
|
...rest
|
|
12315
12396
|
} = props;
|
|
12316
|
-
const containerRef =
|
|
12317
|
-
const videoRef =
|
|
12318
|
-
const [isPlaying, setIsPlaying] =
|
|
12319
|
-
const [isLoaded, setIsLoaded] =
|
|
12320
|
-
const [currentTime, setCurrentTime] =
|
|
12321
|
-
const [duration, setDuration] =
|
|
12322
|
-
const [buffered, setBuffered] =
|
|
12323
|
-
const [volume, setVolume] =
|
|
12324
|
-
const [isMuted, setIsMuted] =
|
|
12325
|
-
const [isFullscreen, setIsFullscreen] =
|
|
12326
|
-
const [playbackRate, setPlaybackRate] =
|
|
12327
|
-
const [rateMenuOpen, setRateMenuOpen] =
|
|
12328
|
-
const [captionsOn, setCaptionsOn] =
|
|
12329
|
-
const [isPip, setIsPip] =
|
|
12330
|
-
const setRefs =
|
|
12397
|
+
const containerRef = import_react46.default.useRef(null);
|
|
12398
|
+
const videoRef = import_react46.default.useRef(null);
|
|
12399
|
+
const [isPlaying, setIsPlaying] = import_react46.default.useState(Boolean(autoPlay));
|
|
12400
|
+
const [isLoaded, setIsLoaded] = import_react46.default.useState(false);
|
|
12401
|
+
const [currentTime, setCurrentTime] = import_react46.default.useState(0);
|
|
12402
|
+
const [duration, setDuration] = import_react46.default.useState(0);
|
|
12403
|
+
const [buffered, setBuffered] = import_react46.default.useState(0);
|
|
12404
|
+
const [volume, setVolume] = import_react46.default.useState(1);
|
|
12405
|
+
const [isMuted, setIsMuted] = import_react46.default.useState(Boolean(muted));
|
|
12406
|
+
const [isFullscreen, setIsFullscreen] = import_react46.default.useState(false);
|
|
12407
|
+
const [playbackRate, setPlaybackRate] = import_react46.default.useState(1);
|
|
12408
|
+
const [rateMenuOpen, setRateMenuOpen] = import_react46.default.useState(false);
|
|
12409
|
+
const [captionsOn, setCaptionsOn] = import_react46.default.useState(false);
|
|
12410
|
+
const [isPip, setIsPip] = import_react46.default.useState(false);
|
|
12411
|
+
const setRefs = import_react46.default.useCallback(
|
|
12331
12412
|
(el) => {
|
|
12332
12413
|
videoRef.current = el;
|
|
12333
12414
|
if (typeof ref === "function") ref(el);
|
|
@@ -12335,14 +12416,14 @@ var Video = import_react45.default.forwardRef((props, ref) => {
|
|
|
12335
12416
|
},
|
|
12336
12417
|
[ref]
|
|
12337
12418
|
);
|
|
12338
|
-
|
|
12419
|
+
import_react46.default.useEffect(() => {
|
|
12339
12420
|
const onFsChange = () => {
|
|
12340
12421
|
setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
12341
12422
|
};
|
|
12342
12423
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
12343
12424
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
12344
12425
|
}, []);
|
|
12345
|
-
|
|
12426
|
+
import_react46.default.useEffect(() => {
|
|
12346
12427
|
const v = videoRef.current;
|
|
12347
12428
|
if (!v) return;
|
|
12348
12429
|
const onEnter = () => setIsPip(true);
|
|
@@ -12732,13 +12813,13 @@ Layout.displayName = "Layout";
|
|
|
12732
12813
|
var Layout_default = Layout;
|
|
12733
12814
|
|
|
12734
12815
|
// src/layout/SideBar/SideBar.tsx
|
|
12735
|
-
var
|
|
12816
|
+
var import_react48 = __toESM(require("react"), 1);
|
|
12736
12817
|
|
|
12737
12818
|
// src/layout/SideBar/SideBarContext.tsx
|
|
12738
|
-
var
|
|
12739
|
-
var SideBarContext =
|
|
12819
|
+
var import_react47 = __toESM(require("react"), 1);
|
|
12820
|
+
var SideBarContext = import_react47.default.createContext(null);
|
|
12740
12821
|
var useSideBarContext = () => {
|
|
12741
|
-
const ctx =
|
|
12822
|
+
const ctx = import_react47.default.useContext(SideBarContext);
|
|
12742
12823
|
if (!ctx) throw new Error("Error");
|
|
12743
12824
|
return ctx;
|
|
12744
12825
|
};
|
|
@@ -12748,7 +12829,7 @@ var SideBarContext_default = SideBarContext;
|
|
|
12748
12829
|
var import_jsx_runtime362 = require("react/jsx-runtime");
|
|
12749
12830
|
var SideBar = (props) => {
|
|
12750
12831
|
const { children, className } = props;
|
|
12751
|
-
const [isOpen, setIsOpen] =
|
|
12832
|
+
const [isOpen, setIsOpen] = import_react48.default.useState(true);
|
|
12752
12833
|
const handleSwitchSideBar = () => {
|
|
12753
12834
|
setIsOpen((prev) => !prev);
|
|
12754
12835
|
};
|
package/dist/index.css
CHANGED
|
@@ -5899,14 +5899,39 @@
|
|
|
5899
5899
|
position: fixed;
|
|
5900
5900
|
pointer-events: auto;
|
|
5901
5901
|
box-sizing: border-box;
|
|
5902
|
-
width:
|
|
5902
|
+
width: var(--tour-card-width, 380px);
|
|
5903
5903
|
max-width: calc(100vw - var(--spacing-space-8));
|
|
5904
|
-
|
|
5905
|
-
|
|
5904
|
+
display: flex;
|
|
5905
|
+
flex-direction: column;
|
|
5906
|
+
overflow: hidden;
|
|
5906
5907
|
border-radius: var(--spacing-radius-md);
|
|
5907
5908
|
background-color: var(--semantic-surface-neutral-primary);
|
|
5908
5909
|
box-shadow: var(--semantic-shadow-lg);
|
|
5909
5910
|
}
|
|
5911
|
+
.lib-xplat-tour-card > .tour-card-head,
|
|
5912
|
+
.lib-xplat-tour-card > .tour-card-body,
|
|
5913
|
+
.lib-xplat-tour-card > .tour-card-actions {
|
|
5914
|
+
padding-left: var(--spacing-space-4);
|
|
5915
|
+
padding-right: var(--spacing-space-4);
|
|
5916
|
+
}
|
|
5917
|
+
.lib-xplat-tour-card > .tour-card-head {
|
|
5918
|
+
padding-top: var(--spacing-space-4);
|
|
5919
|
+
flex: 0 0 auto;
|
|
5920
|
+
}
|
|
5921
|
+
.lib-xplat-tour-card {
|
|
5922
|
+
}
|
|
5923
|
+
.lib-xplat-tour-card > .tour-card-body {
|
|
5924
|
+
flex: 1 1 auto;
|
|
5925
|
+
min-height: 0;
|
|
5926
|
+
overflow-y: auto;
|
|
5927
|
+
padding-top: var(--spacing-space-2);
|
|
5928
|
+
padding-bottom: var(--spacing-space-2);
|
|
5929
|
+
}
|
|
5930
|
+
.lib-xplat-tour-card > .tour-card-actions {
|
|
5931
|
+
flex: 0 0 auto;
|
|
5932
|
+
padding-bottom: var(--spacing-space-4);
|
|
5933
|
+
padding-top: var(--spacing-space-2);
|
|
5934
|
+
}
|
|
5910
5935
|
.lib-xplat-tour-card .tour-card-progress {
|
|
5911
5936
|
font-family: var(--semantic-typo-caption-2-r-font);
|
|
5912
5937
|
font-size: var(--semantic-typo-caption-2-r-size);
|
|
@@ -5923,7 +5948,6 @@
|
|
|
5923
5948
|
font-weight: var(--semantic-typo-label-1-sb-weight);
|
|
5924
5949
|
letter-spacing: var(--semantic-typo-label-1-sb-ls);
|
|
5925
5950
|
color: var(--semantic-text-primary);
|
|
5926
|
-
margin-bottom: var(--spacing-space-2);
|
|
5927
5951
|
}
|
|
5928
5952
|
.lib-xplat-tour-card .tour-card-description {
|
|
5929
5953
|
font-family: var(--semantic-typo-caption-1-r-font);
|
|
@@ -5939,7 +5963,6 @@
|
|
|
5939
5963
|
align-items: center;
|
|
5940
5964
|
justify-content: space-between;
|
|
5941
5965
|
gap: var(--spacing-space-2);
|
|
5942
|
-
margin-top: var(--spacing-space-4);
|
|
5943
5966
|
}
|
|
5944
5967
|
.lib-xplat-tour-card .tour-card-nav {
|
|
5945
5968
|
display: flex;
|
package/dist/index.js
CHANGED
|
@@ -11707,7 +11707,51 @@ Tooltip.displayName = "Tooltip";
|
|
|
11707
11707
|
var Tooltip_default = Tooltip;
|
|
11708
11708
|
|
|
11709
11709
|
// src/components/Tour/Tour.tsx
|
|
11710
|
+
import React45 from "react";
|
|
11711
|
+
|
|
11712
|
+
// src/tokens/hooks/useScrollLock.ts
|
|
11710
11713
|
import React44 from "react";
|
|
11714
|
+
var SCROLL_KEYS = /* @__PURE__ */ new Set([
|
|
11715
|
+
" ",
|
|
11716
|
+
"PageUp",
|
|
11717
|
+
"PageDown",
|
|
11718
|
+
"Home",
|
|
11719
|
+
"End",
|
|
11720
|
+
"ArrowUp",
|
|
11721
|
+
"ArrowDown",
|
|
11722
|
+
"ArrowLeft",
|
|
11723
|
+
"ArrowRight"
|
|
11724
|
+
]);
|
|
11725
|
+
var useScrollLock = (enabled, allowRef) => {
|
|
11726
|
+
React44.useEffect(() => {
|
|
11727
|
+
if (!enabled) return;
|
|
11728
|
+
const allowed = (target) => target instanceof Node && !!allowRef?.current?.contains(target);
|
|
11729
|
+
const block = (e) => {
|
|
11730
|
+
if (allowed(e.target)) return;
|
|
11731
|
+
e.preventDefault();
|
|
11732
|
+
};
|
|
11733
|
+
const onKey = (e) => {
|
|
11734
|
+
if (!SCROLL_KEYS.has(e.key)) return;
|
|
11735
|
+
if (allowed(e.target)) return;
|
|
11736
|
+
const el = e.target;
|
|
11737
|
+
const tag = el?.tagName;
|
|
11738
|
+
if (tag === "INPUT" || tag === "TEXTAREA" || el?.isContentEditable) return;
|
|
11739
|
+
e.preventDefault();
|
|
11740
|
+
};
|
|
11741
|
+
const opts = { passive: false, capture: true };
|
|
11742
|
+
window.addEventListener("wheel", block, opts);
|
|
11743
|
+
window.addEventListener("touchmove", block, opts);
|
|
11744
|
+
window.addEventListener("keydown", onKey, opts);
|
|
11745
|
+
return () => {
|
|
11746
|
+
window.removeEventListener("wheel", block, true);
|
|
11747
|
+
window.removeEventListener("touchmove", block, true);
|
|
11748
|
+
window.removeEventListener("keydown", onKey, true);
|
|
11749
|
+
};
|
|
11750
|
+
}, [enabled, allowRef]);
|
|
11751
|
+
};
|
|
11752
|
+
var useScrollLock_default = useScrollLock;
|
|
11753
|
+
|
|
11754
|
+
// src/components/Tour/Tour.tsx
|
|
11711
11755
|
import { jsx as jsx355, jsxs as jsxs225 } from "react/jsx-runtime";
|
|
11712
11756
|
var VIEWPORT_MARGIN = 16;
|
|
11713
11757
|
var DEFAULT_PADDING = 8;
|
|
@@ -11723,19 +11767,20 @@ var Tour = (props) => {
|
|
|
11723
11767
|
onClose,
|
|
11724
11768
|
current,
|
|
11725
11769
|
onStepChange,
|
|
11770
|
+
width = 380,
|
|
11726
11771
|
nextLabel = "\uB2E4\uC74C",
|
|
11727
11772
|
prevLabel = "\uC774\uC804",
|
|
11728
11773
|
skipLabel = "\uAC74\uB108\uB6F0\uAE30",
|
|
11729
11774
|
doneLabel = "\uB2E4 \uBD24\uC5B4\uC694"
|
|
11730
11775
|
} = props;
|
|
11731
|
-
const [uncontrolled, setUncontrolled] =
|
|
11776
|
+
const [uncontrolled, setUncontrolled] = React45.useState(0);
|
|
11732
11777
|
const index = current ?? uncontrolled;
|
|
11733
11778
|
const step = steps[index];
|
|
11734
11779
|
const isLast = index === steps.length - 1;
|
|
11735
|
-
const spotRef =
|
|
11736
|
-
const cardRef =
|
|
11737
|
-
const [targetFound, setTargetFound] =
|
|
11738
|
-
const goTo =
|
|
11780
|
+
const spotRef = React45.useRef(null);
|
|
11781
|
+
const cardRef = React45.useRef(null);
|
|
11782
|
+
const [targetFound, setTargetFound] = React45.useState(true);
|
|
11783
|
+
const goTo = React45.useCallback(
|
|
11739
11784
|
(next) => {
|
|
11740
11785
|
if (current === void 0) setUncontrolled(next);
|
|
11741
11786
|
onStepChange?.(next);
|
|
@@ -11744,13 +11789,35 @@ var Tour = (props) => {
|
|
|
11744
11789
|
);
|
|
11745
11790
|
useEscapeKey(open, () => onClose("skip"));
|
|
11746
11791
|
useFocusTrap(cardRef, open, { trap: true });
|
|
11747
|
-
|
|
11748
|
-
|
|
11749
|
-
|
|
11750
|
-
|
|
11751
|
-
|
|
11752
|
-
|
|
11753
|
-
|
|
11792
|
+
useScrollLock_default(open, cardRef);
|
|
11793
|
+
const stepsRef = React45.useRef(steps);
|
|
11794
|
+
stepsRef.current = steps;
|
|
11795
|
+
React45.useEffect(() => {
|
|
11796
|
+
if (!open) return;
|
|
11797
|
+
const target = stepsRef.current[index]?.target;
|
|
11798
|
+
if (!target) return;
|
|
11799
|
+
let stop = false;
|
|
11800
|
+
let tries = 0;
|
|
11801
|
+
const look = () => {
|
|
11802
|
+
if (stop) return;
|
|
11803
|
+
const el = resolve(target);
|
|
11804
|
+
if (el) {
|
|
11805
|
+
setTargetFound(true);
|
|
11806
|
+
el.scrollIntoView({ block: "center", inline: "nearest", behavior: "smooth" });
|
|
11807
|
+
return;
|
|
11808
|
+
}
|
|
11809
|
+
setTargetFound(false);
|
|
11810
|
+
if (tries < 60) {
|
|
11811
|
+
tries += 1;
|
|
11812
|
+
requestAnimationFrame(look);
|
|
11813
|
+
}
|
|
11814
|
+
};
|
|
11815
|
+
look();
|
|
11816
|
+
return () => {
|
|
11817
|
+
stop = true;
|
|
11818
|
+
};
|
|
11819
|
+
}, [open, index]);
|
|
11820
|
+
const place = React45.useCallback(() => {
|
|
11754
11821
|
const spot = spotRef.current;
|
|
11755
11822
|
const card = cardRef.current;
|
|
11756
11823
|
if (!spot || !card || !step) return;
|
|
@@ -11791,19 +11858,30 @@ var Tour = (props) => {
|
|
|
11791
11858
|
}
|
|
11792
11859
|
);
|
|
11793
11860
|
const limit = window.innerHeight - VIEWPORT_MARGIN * 2;
|
|
11794
|
-
const cardH = Math.min(
|
|
11861
|
+
const cardH = Math.min(card.scrollHeight, limit);
|
|
11795
11862
|
const cardW = card.offsetWidth;
|
|
11796
|
-
card.style.maxHeight = `${
|
|
11863
|
+
card.style.maxHeight = `${limit}px`;
|
|
11797
11864
|
card.style.top = `${clamp(placed.top, VIEWPORT_MARGIN, window.innerHeight - VIEWPORT_MARGIN - cardH)}px`;
|
|
11798
11865
|
card.style.left = `${clamp(placed.left, VIEWPORT_MARGIN, window.innerWidth - VIEWPORT_MARGIN - cardW)}px`;
|
|
11799
11866
|
}, [step]);
|
|
11800
|
-
|
|
11867
|
+
React45.useLayoutEffect(() => {
|
|
11801
11868
|
if (!open) return;
|
|
11802
11869
|
place();
|
|
11803
|
-
|
|
11804
|
-
|
|
11805
|
-
|
|
11806
|
-
|
|
11870
|
+
let raf = 0;
|
|
11871
|
+
let settled = 0;
|
|
11872
|
+
let last = "";
|
|
11873
|
+
const follow = () => {
|
|
11874
|
+
const el = resolve(stepsRef.current[index]?.target ?? "");
|
|
11875
|
+
const now = el ? JSON.stringify(el.getBoundingClientRect()) : "";
|
|
11876
|
+
settled = now === last ? settled + 1 : 0;
|
|
11877
|
+
last = now;
|
|
11878
|
+
place();
|
|
11879
|
+
if (settled < 3) raf = requestAnimationFrame(follow);
|
|
11880
|
+
};
|
|
11881
|
+
raf = requestAnimationFrame(follow);
|
|
11882
|
+
return () => cancelAnimationFrame(raf);
|
|
11883
|
+
}, [open, index, place]);
|
|
11884
|
+
React45.useEffect(() => {
|
|
11807
11885
|
if (!open) return;
|
|
11808
11886
|
const onMove = () => place();
|
|
11809
11887
|
window.addEventListener("scroll", onMove, { passive: true, capture: true });
|
|
@@ -11822,17 +11900,20 @@ var Tour = (props) => {
|
|
|
11822
11900
|
{
|
|
11823
11901
|
ref: cardRef,
|
|
11824
11902
|
className: "lib-xplat-tour-card",
|
|
11903
|
+
style: { "--tour-card-width": typeof width === "number" ? `${width}px` : width },
|
|
11825
11904
|
role: "dialog",
|
|
11826
11905
|
"aria-modal": "true",
|
|
11827
11906
|
"aria-label": typeof step.title === "string" ? step.title : "\uD654\uBA74 \uC548\uB0B4",
|
|
11828
11907
|
children: [
|
|
11829
|
-
/* @__PURE__ */ jsxs225("div", { className: "tour-card-
|
|
11830
|
-
|
|
11831
|
-
|
|
11832
|
-
|
|
11908
|
+
/* @__PURE__ */ jsxs225("div", { className: "tour-card-head", children: [
|
|
11909
|
+
/* @__PURE__ */ jsxs225("div", { className: "tour-card-progress", "aria-hidden": true, children: [
|
|
11910
|
+
index + 1,
|
|
11911
|
+
" / ",
|
|
11912
|
+
steps.length
|
|
11913
|
+
] }),
|
|
11914
|
+
step.title && /* @__PURE__ */ jsx355("div", { className: "tour-card-title", children: step.title })
|
|
11833
11915
|
] }),
|
|
11834
|
-
step.
|
|
11835
|
-
step.description && /* @__PURE__ */ jsx355("div", { className: "tour-card-description", children: step.description }),
|
|
11916
|
+
/* @__PURE__ */ jsx355("div", { className: "tour-card-body", children: step.description && /* @__PURE__ */ jsx355("div", { className: "tour-card-description", children: step.description }) }),
|
|
11836
11917
|
/* @__PURE__ */ jsxs225("div", { className: "tour-card-actions", children: [
|
|
11837
11918
|
/* @__PURE__ */ jsx355("button", { type: "button", className: "tour-skip", onClick: () => onClose("skip"), children: skipLabel }),
|
|
11838
11919
|
/* @__PURE__ */ jsxs225("div", { className: "tour-card-nav", children: [
|
|
@@ -11865,7 +11946,7 @@ Tour.displayName = "Tour";
|
|
|
11865
11946
|
var Tour_default = Tour;
|
|
11866
11947
|
|
|
11867
11948
|
// src/components/Video/Video.tsx
|
|
11868
|
-
import
|
|
11949
|
+
import React46 from "react";
|
|
11869
11950
|
import { jsx as jsx356, jsxs as jsxs226 } from "react/jsx-runtime";
|
|
11870
11951
|
var PipIcon = () => /* @__PURE__ */ jsxs226("svg", { viewBox: "0 0 24 24", width: "1em", height: "1em", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
11871
11952
|
/* @__PURE__ */ jsx356("rect", { x: "3", y: "5", width: "18", height: "14", rx: "2" }),
|
|
@@ -11877,7 +11958,7 @@ var formatTime = (sec) => {
|
|
|
11877
11958
|
const s = Math.floor(sec % 60);
|
|
11878
11959
|
return `${m}:${s.toString().padStart(2, "0")}`;
|
|
11879
11960
|
};
|
|
11880
|
-
var Video =
|
|
11961
|
+
var Video = React46.forwardRef((props, ref) => {
|
|
11881
11962
|
const {
|
|
11882
11963
|
src,
|
|
11883
11964
|
poster,
|
|
@@ -11901,21 +11982,21 @@ var Video = React45.forwardRef((props, ref) => {
|
|
|
11901
11982
|
children,
|
|
11902
11983
|
...rest
|
|
11903
11984
|
} = props;
|
|
11904
|
-
const containerRef =
|
|
11905
|
-
const videoRef =
|
|
11906
|
-
const [isPlaying, setIsPlaying] =
|
|
11907
|
-
const [isLoaded, setIsLoaded] =
|
|
11908
|
-
const [currentTime, setCurrentTime] =
|
|
11909
|
-
const [duration, setDuration] =
|
|
11910
|
-
const [buffered, setBuffered] =
|
|
11911
|
-
const [volume, setVolume] =
|
|
11912
|
-
const [isMuted, setIsMuted] =
|
|
11913
|
-
const [isFullscreen, setIsFullscreen] =
|
|
11914
|
-
const [playbackRate, setPlaybackRate] =
|
|
11915
|
-
const [rateMenuOpen, setRateMenuOpen] =
|
|
11916
|
-
const [captionsOn, setCaptionsOn] =
|
|
11917
|
-
const [isPip, setIsPip] =
|
|
11918
|
-
const setRefs =
|
|
11985
|
+
const containerRef = React46.useRef(null);
|
|
11986
|
+
const videoRef = React46.useRef(null);
|
|
11987
|
+
const [isPlaying, setIsPlaying] = React46.useState(Boolean(autoPlay));
|
|
11988
|
+
const [isLoaded, setIsLoaded] = React46.useState(false);
|
|
11989
|
+
const [currentTime, setCurrentTime] = React46.useState(0);
|
|
11990
|
+
const [duration, setDuration] = React46.useState(0);
|
|
11991
|
+
const [buffered, setBuffered] = React46.useState(0);
|
|
11992
|
+
const [volume, setVolume] = React46.useState(1);
|
|
11993
|
+
const [isMuted, setIsMuted] = React46.useState(Boolean(muted));
|
|
11994
|
+
const [isFullscreen, setIsFullscreen] = React46.useState(false);
|
|
11995
|
+
const [playbackRate, setPlaybackRate] = React46.useState(1);
|
|
11996
|
+
const [rateMenuOpen, setRateMenuOpen] = React46.useState(false);
|
|
11997
|
+
const [captionsOn, setCaptionsOn] = React46.useState(false);
|
|
11998
|
+
const [isPip, setIsPip] = React46.useState(false);
|
|
11999
|
+
const setRefs = React46.useCallback(
|
|
11919
12000
|
(el) => {
|
|
11920
12001
|
videoRef.current = el;
|
|
11921
12002
|
if (typeof ref === "function") ref(el);
|
|
@@ -11923,14 +12004,14 @@ var Video = React45.forwardRef((props, ref) => {
|
|
|
11923
12004
|
},
|
|
11924
12005
|
[ref]
|
|
11925
12006
|
);
|
|
11926
|
-
|
|
12007
|
+
React46.useEffect(() => {
|
|
11927
12008
|
const onFsChange = () => {
|
|
11928
12009
|
setIsFullscreen(document.fullscreenElement === containerRef.current);
|
|
11929
12010
|
};
|
|
11930
12011
|
document.addEventListener("fullscreenchange", onFsChange);
|
|
11931
12012
|
return () => document.removeEventListener("fullscreenchange", onFsChange);
|
|
11932
12013
|
}, []);
|
|
11933
|
-
|
|
12014
|
+
React46.useEffect(() => {
|
|
11934
12015
|
const v = videoRef.current;
|
|
11935
12016
|
if (!v) return;
|
|
11936
12017
|
const onEnter = () => setIsPip(true);
|
|
@@ -12320,13 +12401,13 @@ Layout.displayName = "Layout";
|
|
|
12320
12401
|
var Layout_default = Layout;
|
|
12321
12402
|
|
|
12322
12403
|
// src/layout/SideBar/SideBar.tsx
|
|
12323
|
-
import
|
|
12404
|
+
import React48 from "react";
|
|
12324
12405
|
|
|
12325
12406
|
// src/layout/SideBar/SideBarContext.tsx
|
|
12326
|
-
import
|
|
12327
|
-
var SideBarContext =
|
|
12407
|
+
import React47 from "react";
|
|
12408
|
+
var SideBarContext = React47.createContext(null);
|
|
12328
12409
|
var useSideBarContext = () => {
|
|
12329
|
-
const ctx =
|
|
12410
|
+
const ctx = React47.useContext(SideBarContext);
|
|
12330
12411
|
if (!ctx) throw new Error("Error");
|
|
12331
12412
|
return ctx;
|
|
12332
12413
|
};
|
|
@@ -12336,7 +12417,7 @@ var SideBarContext_default = SideBarContext;
|
|
|
12336
12417
|
import { jsx as jsx362 } from "react/jsx-runtime";
|
|
12337
12418
|
var SideBar = (props) => {
|
|
12338
12419
|
const { children, className } = props;
|
|
12339
|
-
const [isOpen, setIsOpen] =
|
|
12420
|
+
const [isOpen, setIsOpen] = React48.useState(true);
|
|
12340
12421
|
const handleSwitchSideBar = () => {
|
|
12341
12422
|
setIsOpen((prev) => !prev);
|
|
12342
12423
|
};
|