@edrlab/thorium-web 1.2.0 → 1.3.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/{ThPreferencesAdapter-DrZ5_6Dv.d.mts → ThPreferencesAdapter-D0rzsGRl.d.mts} +50 -13
- package/dist/{ThSettingsWrapper-8Kx0SnH4.d.mts → ThSettingsWrapper-BXuRgdqp.d.mts} +42 -4
- package/dist/{actions-D2CHvCHu.d.mts → actions-BLAr0oaM.d.mts} +16 -4
- package/dist/{actionsReducer-kc-S130w.d.mts → actionsReducer-BhG1wicI.d.mts} +37 -12
- package/dist/chunk-3GDQP6AS.mjs +14 -0
- package/dist/chunk-3GDQP6AS.mjs.map +1 -0
- package/dist/{chunk-72XCX5TD.mjs → chunk-3LDWKC5N.mjs} +13 -8
- package/dist/chunk-3LDWKC5N.mjs.map +1 -0
- package/dist/{chunk-NYZBHYW2.mjs → chunk-4ODYHZKD.mjs} +343 -38
- package/dist/chunk-4ODYHZKD.mjs.map +1 -0
- package/dist/{chunk-34MVY33F.mjs → chunk-4TVEDX7L.mjs} +23 -32
- package/dist/chunk-4TVEDX7L.mjs.map +1 -0
- package/dist/chunk-7CGMWOZN.mjs +20 -0
- package/dist/chunk-7CGMWOZN.mjs.map +1 -0
- package/dist/{chunk-7NEQAW7J.mjs → chunk-C236BQQB.mjs} +656 -917
- package/dist/chunk-C236BQQB.mjs.map +1 -0
- package/dist/{chunk-H4J2VY7Z.mjs → chunk-D7MFLHXV.mjs} +2267 -1599
- package/dist/chunk-D7MFLHXV.mjs.map +1 -0
- package/dist/{chunk-47AIIJFO.mjs → chunk-ITDBOMY5.mjs} +3 -3
- package/dist/{chunk-47AIIJFO.mjs.map → chunk-ITDBOMY5.mjs.map} +1 -1
- package/dist/{chunk-XVSFXHYB.mjs → chunk-L4XGZAZ5.mjs} +23 -20
- package/dist/chunk-L4XGZAZ5.mjs.map +1 -0
- package/dist/chunk-OWHP7ONM.mjs +134 -0
- package/dist/chunk-OWHP7ONM.mjs.map +1 -0
- package/dist/{chunk-S4M7ED5Q.mjs → chunk-RRVLWDT3.mjs} +10 -7
- package/dist/chunk-RRVLWDT3.mjs.map +1 -0
- package/dist/chunk-T2E6MRVP.mjs +862 -0
- package/dist/chunk-T2E6MRVP.mjs.map +1 -0
- package/dist/chunk-TEZB4ULX.mjs +57 -0
- package/dist/chunk-TEZB4ULX.mjs.map +1 -0
- package/dist/chunk-UCTMVCW7.mjs +833 -0
- package/dist/chunk-UCTMVCW7.mjs.map +1 -0
- package/dist/chunk-WECWPYZB.mjs +1950 -0
- package/dist/chunk-WECWPYZB.mjs.map +1 -0
- package/dist/{chunk-4VHEHMJN.mjs → chunk-XBZWGRDM.mjs} +228 -94
- package/dist/chunk-XBZWGRDM.mjs.map +1 -0
- package/dist/{chunk-K3K7TUWM.mjs → chunk-YZ3KCMKY.mjs} +237 -83
- package/dist/chunk-YZ3KCMKY.mjs.map +1 -0
- package/dist/components/Audio/index.css +1858 -0
- package/dist/components/Audio/index.css.map +1 -0
- package/dist/components/Audio/index.d.mts +103 -0
- package/dist/components/Audio/index.mjs +23 -0
- package/dist/components/Audio/index.mjs.map +1 -0
- package/dist/components/Epub/index.css +372 -9
- package/dist/components/Epub/index.css.map +1 -1
- package/dist/components/Epub/index.d.mts +17 -19
- package/dist/components/Epub/index.mjs +15 -10
- package/dist/components/Misc/index.css +5 -2
- package/dist/components/Misc/index.css.map +1 -1
- package/dist/components/Misc/index.mjs +4 -132
- package/dist/components/Misc/index.mjs.map +1 -1
- package/dist/components/Reader/index.css +1030 -184
- package/dist/components/Reader/index.css.map +1 -1
- package/dist/components/Reader/index.d.mts +16 -16
- package/dist/components/Reader/index.mjs +121 -22
- package/dist/components/Reader/index.mjs.map +1 -1
- package/dist/components/WebPub/index.css +372 -9
- package/dist/components/WebPub/index.css.map +1 -1
- package/dist/components/WebPub/index.d.mts +16 -16
- package/dist/components/WebPub/index.mjs +15 -10
- package/dist/core/Components/index.d.mts +64 -15
- package/dist/core/Components/index.mjs +2 -1
- package/dist/core/Helpers/index.d.mts +2 -2
- package/dist/core/Helpers/index.mjs +4 -2
- package/dist/core/Hooks/index.d.mts +7 -8
- package/dist/core/Hooks/index.mjs +3 -1
- package/dist/i18n/index.mjs +4 -5
- package/dist/lib/index.d.mts +159 -15
- package/dist/lib/index.mjs +4 -2
- package/dist/lib-M3PPQDJJ.mjs +6548 -0
- package/dist/lib-M3PPQDJJ.mjs.map +1 -0
- package/dist/locales/en/thorium-shared.json +84 -0
- package/dist/locales/en/thorium-web.json +22 -0
- package/dist/locales/et/thorium-shared.json +93 -2
- package/dist/locales/fi/thorium-shared.json +68 -0
- package/dist/next-lib/index.mjs +2 -0
- package/dist/next-lib/index.mjs.map +1 -1
- package/dist/preferences/index.d.mts +111 -13
- package/dist/preferences/index.mjs +6 -3
- package/dist/{settingsReducer-C1wwCAMv.d.mts → settingsReducer-Bu1zeveu.d.mts} +1 -1
- package/dist/{ui-CamWuqOo.d.mts → ui-nBv8gfr0.d.mts} +20 -1
- package/dist/useAudioNavigator-C5aW4-eT.d.mts +133 -0
- package/dist/{useContrast-D6sjPjxy.d.mts → useContrast-2t429O9O.d.mts} +16 -8
- package/dist/usePreferences-VaBf46eP.d.mts +230 -0
- package/dist/useReaderTransitions-JDzlBFsu.d.mts +530 -0
- package/dist/{useTimeline-DyMx_aWY.d.mts → useTimeline-DCZ1qoCO.d.mts} +4 -2
- package/package.json +15 -11
- package/dist/chunk-34MVY33F.mjs.map +0 -1
- package/dist/chunk-4VHEHMJN.mjs.map +0 -1
- package/dist/chunk-72XCX5TD.mjs.map +0 -1
- package/dist/chunk-7NEQAW7J.mjs.map +0 -1
- package/dist/chunk-H4J2VY7Z.mjs.map +0 -1
- package/dist/chunk-K3K7TUWM.mjs.map +0 -1
- package/dist/chunk-NYZBHYW2.mjs.map +0 -1
- package/dist/chunk-S4M7ED5Q.mjs.map +0 -1
- package/dist/chunk-XVSFXHYB.mjs.map +0 -1
- package/dist/useEpubNavigator-CwHJfoiV.d.mts +0 -42
- package/dist/usePreferences-BXFJbval.d.mts +0 -43
- package/dist/useReaderTransitions-guT-eA-Q.d.mts +0 -365
- package/dist/useWebPubNavigator-Che8r5Wg.d.mts +0 -39
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { usePrevious } from './chunk-YZ73DHRU.mjs';
|
|
2
2
|
import { useCollapsibility } from './chunk-MLEYTQGK.mjs';
|
|
3
|
-
import {
|
|
4
|
-
import { Toolbar, TooltipTrigger, Button, Tooltip, MenuTrigger, Popover, Menu, Dialog, Modal, Heading, Form, NumberField, Label, FieldError, Input, Text, TextField, SearchField, Link, MenuItem, Keyboard, Group, RadioGroup, Radio, Slider, SliderOutput, SliderTrack, SliderThumb, Switch, SelectValue, Select, ListBox, ListBoxItem } from 'react-aria-components';
|
|
3
|
+
import React23, { createContext, useContext, useState, useEffect, useMemo, useRef, Fragment as Fragment$1, useCallback, createElement } from 'react';
|
|
5
4
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
6
|
-
import
|
|
5
|
+
import { useObjectRef, useLocale, useOverlayPosition, OverlayContainer, FocusScope, OverlayProvider, useDialog, useOverlay, useModal } from 'react-aria';
|
|
6
|
+
import { Toolbar, TooltipTrigger, Button, Tooltip, MenuTrigger, Popover, Menu, Slider, SliderTrack, SliderThumb, Dialog, Modal, Heading, Form, NumberField, Label, FieldError, Input, Text, TextField, SearchField, Link, MenuItem, Keyboard, Group, RadioGroup, Radio, SliderOutput, Switch, SelectValue, Select, ListBox, ListBoxItem } from 'react-aria-components';
|
|
7
7
|
import { createPortal } from 'react-dom';
|
|
8
8
|
import { useOverlayTriggerState } from 'react-stately';
|
|
9
9
|
import { Sheet } from 'react-modal-sheet';
|
|
@@ -76,6 +76,116 @@ var useActions = (actionMap) => {
|
|
|
76
76
|
everyOpenDocked
|
|
77
77
|
};
|
|
78
78
|
};
|
|
79
|
+
|
|
80
|
+
// src/components/Plugins/PluginRegistry.ts
|
|
81
|
+
var pluginsStore = [];
|
|
82
|
+
var PluginRegistryClass = class {
|
|
83
|
+
register(plugin) {
|
|
84
|
+
const existingPluginIndex = pluginsStore.findIndex((p) => p.id === plugin.id);
|
|
85
|
+
if (existingPluginIndex >= 0) {
|
|
86
|
+
pluginsStore[existingPluginIndex] = plugin;
|
|
87
|
+
} else {
|
|
88
|
+
pluginsStore.push(plugin);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
unregister(pluginId) {
|
|
92
|
+
const filteredPlugins = pluginsStore.filter((plugin) => plugin.id !== pluginId);
|
|
93
|
+
pluginsStore.length = 0;
|
|
94
|
+
pluginsStore.push(...filteredPlugins);
|
|
95
|
+
}
|
|
96
|
+
getPlugins() {
|
|
97
|
+
return [...pluginsStore];
|
|
98
|
+
}
|
|
99
|
+
getComponentMaps() {
|
|
100
|
+
const actionsComponentsMap = {};
|
|
101
|
+
const settingsComponentsMap = {};
|
|
102
|
+
const primaryAudioActionsMap = {};
|
|
103
|
+
[...pluginsStore].reverse().forEach((plugin) => {
|
|
104
|
+
if (plugin.components.actions) {
|
|
105
|
+
Object.entries(plugin.components.actions).forEach(([key, component]) => {
|
|
106
|
+
actionsComponentsMap[key] = component;
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
if (plugin.components.settings) {
|
|
110
|
+
Object.entries(plugin.components.settings).forEach(([key, component]) => {
|
|
111
|
+
settingsComponentsMap[key] = component;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
if (plugin.components.primaryAudioActions) {
|
|
115
|
+
Object.entries(plugin.components.primaryAudioActions).forEach(([key, component]) => {
|
|
116
|
+
primaryAudioActionsMap[key] = component;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
return {
|
|
121
|
+
actionsComponentsMap,
|
|
122
|
+
settingsComponentsMap,
|
|
123
|
+
primaryAudioActionsMap
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
var ThPluginRegistry = new PluginRegistryClass();
|
|
128
|
+
var ThPluginContext = createContext({
|
|
129
|
+
actionsComponentsMap: {},
|
|
130
|
+
settingsComponentsMap: {},
|
|
131
|
+
textSettingsComponentsMap: {},
|
|
132
|
+
spacingSettingsComponentsMap: {},
|
|
133
|
+
primaryAudioActionsMap: {},
|
|
134
|
+
registerPlugin: ThPluginRegistry.register.bind(ThPluginRegistry),
|
|
135
|
+
unregisterPlugin: ThPluginRegistry.unregister.bind(ThPluginRegistry)
|
|
136
|
+
});
|
|
137
|
+
var usePlugins = () => useContext(ThPluginContext);
|
|
138
|
+
var ThPluginProvider = ({ children }) => {
|
|
139
|
+
const [componentMaps, setComponentMaps] = useState(() => {
|
|
140
|
+
const maps = ThPluginRegistry.getComponentMaps();
|
|
141
|
+
return {
|
|
142
|
+
...maps,
|
|
143
|
+
textSettingsComponentsMap: getTypedSettingsComponents(maps.settingsComponentsMap, "text"),
|
|
144
|
+
spacingSettingsComponentsMap: getTypedSettingsComponents(maps.settingsComponentsMap, "spacing")
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
function getTypedSettingsComponents(componentsMap, type) {
|
|
148
|
+
return Object.entries(componentsMap).filter(([_, component]) => component.type === type).reduce((acc, [key, component]) => {
|
|
149
|
+
acc[key] = component;
|
|
150
|
+
return acc;
|
|
151
|
+
}, {});
|
|
152
|
+
}
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
const updateComponentMaps = () => {
|
|
155
|
+
const maps = ThPluginRegistry.getComponentMaps();
|
|
156
|
+
setComponentMaps({
|
|
157
|
+
...maps,
|
|
158
|
+
textSettingsComponentsMap: getTypedSettingsComponents(maps.settingsComponentsMap, "text"),
|
|
159
|
+
spacingSettingsComponentsMap: getTypedSettingsComponents(maps.settingsComponentsMap, "spacing")
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
updateComponentMaps();
|
|
163
|
+
}, []);
|
|
164
|
+
const registerPlugin = (plugin) => {
|
|
165
|
+
ThPluginRegistry.register(plugin);
|
|
166
|
+
};
|
|
167
|
+
const unregisterPlugin = (pluginId) => {
|
|
168
|
+
ThPluginRegistry.unregister(pluginId);
|
|
169
|
+
};
|
|
170
|
+
const value = {
|
|
171
|
+
...componentMaps,
|
|
172
|
+
registerPlugin,
|
|
173
|
+
unregisterPlugin
|
|
174
|
+
};
|
|
175
|
+
return /* @__PURE__ */ jsx(ThPluginContext.Provider, { value, children });
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
// src/core/Components/Actions/hooks/useActionComponentStatus.ts
|
|
179
|
+
function useActionComponentStatus(options) {
|
|
180
|
+
const { actionKey } = options;
|
|
181
|
+
const { actionsComponentsMap, primaryAudioActionsMap } = usePlugins();
|
|
182
|
+
return useMemo(() => {
|
|
183
|
+
const isComponentRegistered = !!actionsComponentsMap?.[actionKey] || !!primaryAudioActionsMap?.[actionKey];
|
|
184
|
+
return {
|
|
185
|
+
isComponentRegistered
|
|
186
|
+
};
|
|
187
|
+
}, [actionKey, actionsComponentsMap, primaryAudioActionsMap]);
|
|
188
|
+
}
|
|
79
189
|
var ThActionsTriggerVariant = /* @__PURE__ */ ((ThActionsTriggerVariant2) => {
|
|
80
190
|
ThActionsTriggerVariant2["button"] = "iconButton";
|
|
81
191
|
ThActionsTriggerVariant2["menu"] = "menuItem";
|
|
@@ -176,7 +286,7 @@ var ThMenu = ({
|
|
|
176
286
|
{
|
|
177
287
|
...compounds?.menuTrigger,
|
|
178
288
|
children: [
|
|
179
|
-
compounds?.button &&
|
|
289
|
+
compounds?.button && React23.isValidElement(compounds.button) ? compounds.button : /* @__PURE__ */ jsx(
|
|
180
290
|
ThMenuButton,
|
|
181
291
|
{
|
|
182
292
|
ref: buttonRef,
|
|
@@ -218,6 +328,7 @@ var ThCollapsibleActionsBar = ({
|
|
|
218
328
|
items,
|
|
219
329
|
prefs,
|
|
220
330
|
breakpoint,
|
|
331
|
+
targetPlacement = "bottom",
|
|
221
332
|
compounds,
|
|
222
333
|
...props
|
|
223
334
|
}) => {
|
|
@@ -240,10 +351,10 @@ var ThCollapsibleActionsBar = ({
|
|
|
240
351
|
},
|
|
241
352
|
`${key}-trigger`
|
|
242
353
|
),
|
|
243
|
-
Target && /* @__PURE__ */ jsx(Target, { triggerRef: resolvedRef }, `${key}-container`)
|
|
354
|
+
Target && /* @__PURE__ */ jsx(Target, { triggerRef: resolvedRef, placement: targetPlacement }, `${key}-container`)
|
|
244
355
|
] }, key)
|
|
245
356
|
),
|
|
246
|
-
|
|
357
|
+
React23.isValidElement(compounds?.menu) ? React23.cloneElement(compounds.menu, {
|
|
247
358
|
...compounds.menu.props,
|
|
248
359
|
id,
|
|
249
360
|
triggerRef: resolvedRef,
|
|
@@ -263,6 +374,157 @@ var ThCollapsibleActionsBar = ({
|
|
|
263
374
|
}
|
|
264
375
|
) });
|
|
265
376
|
};
|
|
377
|
+
var ThAudioProgress = ({
|
|
378
|
+
isDisabled,
|
|
379
|
+
currentTime,
|
|
380
|
+
duration,
|
|
381
|
+
playbackRate = 1,
|
|
382
|
+
onSeek,
|
|
383
|
+
currentChapter,
|
|
384
|
+
seekableRanges,
|
|
385
|
+
hoverLabel,
|
|
386
|
+
onHoverProgression,
|
|
387
|
+
segments,
|
|
388
|
+
compounds
|
|
389
|
+
}) => {
|
|
390
|
+
const { direction } = useLocale();
|
|
391
|
+
const anchorRef = useRef(null);
|
|
392
|
+
const overlayRef = useObjectRef(compounds?.tooltip?.ref);
|
|
393
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
394
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
395
|
+
const [dragValue, setDragValue] = useState(0);
|
|
396
|
+
const seekTargetRef = useRef(null);
|
|
397
|
+
useEffect(() => {
|
|
398
|
+
if (seekTargetRef.current === null) return;
|
|
399
|
+
if (Math.abs(currentTime - seekTargetRef.current) < 1) {
|
|
400
|
+
seekTargetRef.current = null;
|
|
401
|
+
setIsDragging(false);
|
|
402
|
+
}
|
|
403
|
+
}, [currentTime]);
|
|
404
|
+
const overlayConfig = compounds?.tooltip || {};
|
|
405
|
+
const placement = overlayConfig.placement || "top";
|
|
406
|
+
const offset = overlayConfig.offset !== void 0 ? overlayConfig.offset : 8;
|
|
407
|
+
const { overlayProps, updatePosition } = useOverlayPosition({
|
|
408
|
+
targetRef: anchorRef,
|
|
409
|
+
overlayRef,
|
|
410
|
+
placement,
|
|
411
|
+
offset,
|
|
412
|
+
isOpen
|
|
413
|
+
});
|
|
414
|
+
const displayTime = isDragging ? dragValue : currentTime;
|
|
415
|
+
const defaultElapsedTime = formatTime(displayTime / playbackRate);
|
|
416
|
+
const defaultRemainingTime = formatTime(Math.max(0, (duration - displayTime) / playbackRate));
|
|
417
|
+
function formatTime(seconds) {
|
|
418
|
+
if (isNaN(seconds) || !isFinite(seconds)) return "0:00";
|
|
419
|
+
const hrs = Math.floor(seconds / 3600);
|
|
420
|
+
const mins = Math.floor(seconds % 3600 / 60);
|
|
421
|
+
const secs = Math.floor(seconds % 60);
|
|
422
|
+
return hrs > 0 ? `${hrs}:${mins.toString().padStart(2, "0")}:${secs.toString().padStart(2, "0")}` : `${mins}:${secs.toString().padStart(2, "0")}`;
|
|
423
|
+
}
|
|
424
|
+
const validSeekableRanges = duration > 0 ? (seekableRanges ?? []).filter((r) => r.end <= duration) : [];
|
|
425
|
+
const handleTrackMouseMove = (e) => {
|
|
426
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
427
|
+
const raw = (e.clientX - rect.left) / rect.width;
|
|
428
|
+
const x = Math.max(0, Math.min(1, direction === "rtl" ? 1 - raw : raw));
|
|
429
|
+
if (anchorRef.current) {
|
|
430
|
+
const side = direction === "rtl" ? "right" : "left";
|
|
431
|
+
anchorRef.current.style.left = "";
|
|
432
|
+
anchorRef.current.style.right = "";
|
|
433
|
+
anchorRef.current.style[side] = `${x * 100}%`;
|
|
434
|
+
updatePosition();
|
|
435
|
+
}
|
|
436
|
+
if (!isOpen) setIsOpen(true);
|
|
437
|
+
onHoverProgression?.(x);
|
|
438
|
+
};
|
|
439
|
+
const handleTrackMouseLeave = () => {
|
|
440
|
+
setIsOpen(false);
|
|
441
|
+
onHoverProgression?.(null);
|
|
442
|
+
};
|
|
443
|
+
const { onMouseMove, onMouseLeave, ...trackProps } = compounds?.track ?? {};
|
|
444
|
+
return /* @__PURE__ */ jsxs("div", { ...compounds?.wrapper, children: [
|
|
445
|
+
currentChapter && /* @__PURE__ */ jsx("div", { ...compounds?.current, children: currentChapter }),
|
|
446
|
+
/* @__PURE__ */ jsx(
|
|
447
|
+
Slider,
|
|
448
|
+
{
|
|
449
|
+
value: isDragging ? dragValue : currentTime,
|
|
450
|
+
minValue: 0,
|
|
451
|
+
maxValue: duration || 0,
|
|
452
|
+
onChange: (value) => {
|
|
453
|
+
const v = Array.isArray(value) ? value[0] : value;
|
|
454
|
+
setIsDragging(true);
|
|
455
|
+
setDragValue(v);
|
|
456
|
+
},
|
|
457
|
+
onChangeEnd: (value) => {
|
|
458
|
+
const v = Array.isArray(value) ? value[0] : value;
|
|
459
|
+
seekTargetRef.current = v;
|
|
460
|
+
onSeek(v);
|
|
461
|
+
},
|
|
462
|
+
isDisabled: !!isDisabled,
|
|
463
|
+
...compounds?.slider,
|
|
464
|
+
children: /* @__PURE__ */ jsxs(
|
|
465
|
+
SliderTrack,
|
|
466
|
+
{
|
|
467
|
+
onMouseMove: (e) => {
|
|
468
|
+
handleTrackMouseMove(e);
|
|
469
|
+
onMouseMove?.(e);
|
|
470
|
+
},
|
|
471
|
+
onMouseLeave: (e) => {
|
|
472
|
+
handleTrackMouseLeave();
|
|
473
|
+
onMouseLeave?.(e);
|
|
474
|
+
},
|
|
475
|
+
...trackProps,
|
|
476
|
+
children: [
|
|
477
|
+
validSeekableRanges.map((range, i) => /* @__PURE__ */ jsx(
|
|
478
|
+
"div",
|
|
479
|
+
{
|
|
480
|
+
...compounds?.seekableRange,
|
|
481
|
+
style: {
|
|
482
|
+
[direction === "rtl" ? "right" : "left"]: `${range.start / duration * 100}%`,
|
|
483
|
+
width: `${(range.end - range.start) / duration * 100}%`,
|
|
484
|
+
...compounds?.seekableRange?.style
|
|
485
|
+
}
|
|
486
|
+
},
|
|
487
|
+
i
|
|
488
|
+
)),
|
|
489
|
+
segments?.map((segment, i) => /* @__PURE__ */ jsx(
|
|
490
|
+
"div",
|
|
491
|
+
{
|
|
492
|
+
...compounds?.fragmentTick,
|
|
493
|
+
style: {
|
|
494
|
+
position: "absolute",
|
|
495
|
+
[direction === "rtl" ? "right" : "left"]: `${segment.percentage}%`,
|
|
496
|
+
...compounds?.fragmentTick?.style
|
|
497
|
+
}
|
|
498
|
+
},
|
|
499
|
+
`segment-${i}`
|
|
500
|
+
)),
|
|
501
|
+
/* @__PURE__ */ jsx(
|
|
502
|
+
"span",
|
|
503
|
+
{
|
|
504
|
+
ref: anchorRef,
|
|
505
|
+
style: { position: "absolute", [direction === "rtl" ? "right" : "left"]: "0%", width: 0, height: "100%", top: 0 },
|
|
506
|
+
"aria-hidden": "true"
|
|
507
|
+
}
|
|
508
|
+
),
|
|
509
|
+
/* @__PURE__ */ jsx(SliderThumb, { ...compounds?.thumb })
|
|
510
|
+
]
|
|
511
|
+
}
|
|
512
|
+
)
|
|
513
|
+
}
|
|
514
|
+
),
|
|
515
|
+
isOpen && hoverLabel && /* @__PURE__ */ jsx(OverlayContainer, { ...compounds?.overlayContainer, children: /* @__PURE__ */ jsx(
|
|
516
|
+
"div",
|
|
517
|
+
{
|
|
518
|
+
ref: overlayRef,
|
|
519
|
+
...overlayConfig,
|
|
520
|
+
style: { ...overlayProps.style, ...overlayConfig.style },
|
|
521
|
+
children: hoverLabel
|
|
522
|
+
}
|
|
523
|
+
) }),
|
|
524
|
+
/* @__PURE__ */ jsx("span", { ...compounds?.elapsedTime, children: defaultElapsedTime }),
|
|
525
|
+
/* @__PURE__ */ jsx("span", { ...compounds?.remainingTime, children: defaultRemainingTime })
|
|
526
|
+
] });
|
|
527
|
+
};
|
|
266
528
|
var SvgClose = (props) => /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 -960 960 960", width: "24px", fill: "inherit", ...props, children: /* @__PURE__ */ jsx("path", { d: "m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z" }) });
|
|
267
529
|
var close_default = SvgClose;
|
|
268
530
|
var ThCloseButton = ({
|
|
@@ -335,7 +597,7 @@ var ThNavigationButton = ({
|
|
|
335
597
|
children,
|
|
336
598
|
...props
|
|
337
599
|
}) => {
|
|
338
|
-
const fallBackChildren = /* @__PURE__ */ jsxs(
|
|
600
|
+
const fallBackChildren = /* @__PURE__ */ jsxs(React23.Fragment, { children: [
|
|
339
601
|
direction === "right" ? /* @__PURE__ */ jsx(arrow_forward_default, { "aria-hidden": "true", focusable: "false" }) : /* @__PURE__ */ jsx(arrow_back_default, { "aria-hidden": "true", focusable: "false" }),
|
|
340
602
|
label
|
|
341
603
|
] });
|
|
@@ -692,7 +954,7 @@ var ThBottomSheetContainer = ({
|
|
|
692
954
|
const [Header, Body] = useMemo(() => {
|
|
693
955
|
const header = children.find((child) => child.type === ThContainerHeader);
|
|
694
956
|
const body = children.find((child) => child.type === ThContainerBody);
|
|
695
|
-
const modifiedHeader = header ?
|
|
957
|
+
const modifiedHeader = header ? React23.cloneElement(header, {
|
|
696
958
|
...header.props,
|
|
697
959
|
compounds: {
|
|
698
960
|
...header.props.compounds,
|
|
@@ -819,7 +1081,7 @@ var ThTypedComponentRenderer = ({
|
|
|
819
1081
|
if (!Component) {
|
|
820
1082
|
throw new Error(`Unsupported type: ${type}`);
|
|
821
1083
|
}
|
|
822
|
-
return
|
|
1084
|
+
return React23.createElement(Component, props, children);
|
|
823
1085
|
};
|
|
824
1086
|
var ThForm = ({
|
|
825
1087
|
ref,
|
|
@@ -835,7 +1097,7 @@ var ThForm = ({
|
|
|
835
1097
|
...props,
|
|
836
1098
|
children: [
|
|
837
1099
|
children,
|
|
838
|
-
compounds?.button &&
|
|
1100
|
+
compounds?.button && React23.isValidElement(compounds.button) ? compounds.button : /* @__PURE__ */ jsx(
|
|
839
1101
|
Button,
|
|
840
1102
|
{
|
|
841
1103
|
...compounds?.button,
|
|
@@ -849,6 +1111,7 @@ var ThForm = ({
|
|
|
849
1111
|
};
|
|
850
1112
|
var ThFormNumberField = ({
|
|
851
1113
|
ref,
|
|
1114
|
+
onInputChange,
|
|
852
1115
|
label,
|
|
853
1116
|
compounds,
|
|
854
1117
|
children,
|
|
@@ -863,7 +1126,13 @@ var ThFormNumberField = ({
|
|
|
863
1126
|
children: children ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
864
1127
|
label && /* @__PURE__ */ jsx(Label, { ...compounds?.label, children: label }),
|
|
865
1128
|
errorMessage && /* @__PURE__ */ jsx(FieldError, { ...compounds?.fieldError, children: errorMessage }),
|
|
866
|
-
/* @__PURE__ */ jsx(
|
|
1129
|
+
/* @__PURE__ */ jsx(
|
|
1130
|
+
Input,
|
|
1131
|
+
{
|
|
1132
|
+
...compounds?.input,
|
|
1133
|
+
onInput: onInputChange ? (e) => onInputChange(e.target.value) : void 0
|
|
1134
|
+
}
|
|
1135
|
+
),
|
|
867
1136
|
compounds?.description && /* @__PURE__ */ jsx(Text, { slot: "description", children: compounds?.description })
|
|
868
1137
|
] })
|
|
869
1138
|
}
|
|
@@ -910,8 +1179,8 @@ var ThFormSearchField = ({
|
|
|
910
1179
|
label && /* @__PURE__ */ jsx(Label, { ...compounds?.label, children: label }),
|
|
911
1180
|
errorMessage && /* @__PURE__ */ jsx(FieldError, { ...compounds?.fieldError, children: errorMessage }),
|
|
912
1181
|
/* @__PURE__ */ jsx(Input, { ...compounds?.input }),
|
|
913
|
-
compounds?.searchIcon &&
|
|
914
|
-
compounds?.clearButton &&
|
|
1182
|
+
compounds?.searchIcon && React23.isValidElement(compounds.searchIcon) ? compounds.searchIcon : /* @__PURE__ */ jsx("div", { ...compounds?.searchIcon, children: /* @__PURE__ */ jsx(search_default, { "aria-hidden": "true", focusable: "false" }) }),
|
|
1183
|
+
compounds?.clearButton && React23.isValidElement(compounds.clearButton) ? compounds.clearButton : /* @__PURE__ */ jsx(ThCloseButton, { ...compounds?.clearButton, type: "button" }),
|
|
915
1184
|
compounds?.description && /* @__PURE__ */ jsx(Text, { slot: "description", children: compounds?.description })
|
|
916
1185
|
] }) })
|
|
917
1186
|
}
|
|
@@ -1176,20 +1445,6 @@ var ThPagination = ({
|
|
|
1176
1445
|
}
|
|
1177
1446
|
);
|
|
1178
1447
|
};
|
|
1179
|
-
var ThProgression = ({
|
|
1180
|
-
ref,
|
|
1181
|
-
children,
|
|
1182
|
-
...props
|
|
1183
|
-
}) => {
|
|
1184
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1185
|
-
"div",
|
|
1186
|
-
{
|
|
1187
|
-
ref,
|
|
1188
|
-
...props,
|
|
1189
|
-
children
|
|
1190
|
-
}
|
|
1191
|
-
) });
|
|
1192
|
-
};
|
|
1193
1448
|
var ThRunningHead = ({
|
|
1194
1449
|
ref,
|
|
1195
1450
|
label,
|
|
@@ -1233,6 +1488,7 @@ var ThSettingsResetButton = ({
|
|
|
1233
1488
|
var ThNumberField = ({
|
|
1234
1489
|
ref,
|
|
1235
1490
|
onReset,
|
|
1491
|
+
onInputChange,
|
|
1236
1492
|
label,
|
|
1237
1493
|
placeholder,
|
|
1238
1494
|
range,
|
|
@@ -1281,7 +1537,8 @@ var ThNumberField = ({
|
|
|
1281
1537
|
{
|
|
1282
1538
|
...compounds?.input,
|
|
1283
1539
|
...isVirtualKeyboardDisabled ? { inputMode: "none" } : {},
|
|
1284
|
-
placeholder
|
|
1540
|
+
placeholder,
|
|
1541
|
+
onInput: onInputChange ? (e) => onInputChange(e.target.value) : void 0
|
|
1285
1542
|
}
|
|
1286
1543
|
),
|
|
1287
1544
|
steppers && /* @__PURE__ */ jsx(
|
|
@@ -1320,7 +1577,7 @@ var ThRadioGroup = ({
|
|
|
1320
1577
|
}
|
|
1321
1578
|
}
|
|
1322
1579
|
}, [items, value]);
|
|
1323
|
-
if (
|
|
1580
|
+
if (React23.isValidElement(children)) {
|
|
1324
1581
|
return /* @__PURE__ */ jsxs(
|
|
1325
1582
|
RadioGroup,
|
|
1326
1583
|
{
|
|
@@ -1351,7 +1608,7 @@ var ThRadioGroup = ({
|
|
|
1351
1608
|
value: item.value,
|
|
1352
1609
|
isDisabled: item.isDisabled
|
|
1353
1610
|
},
|
|
1354
|
-
/* @__PURE__ */ jsxs(
|
|
1611
|
+
/* @__PURE__ */ jsxs(React23.Fragment, { children: [
|
|
1355
1612
|
item.icon && /* @__PURE__ */ jsx(item.icon, { "aria-hidden": "true", focusable: "false" }),
|
|
1356
1613
|
/* @__PURE__ */ jsx("span", { ...compounds?.radioLabel, children: item.label })
|
|
1357
1614
|
] })
|
|
@@ -1394,7 +1651,7 @@ var ThSlider = ({
|
|
|
1394
1651
|
...props,
|
|
1395
1652
|
children: [
|
|
1396
1653
|
label && /* @__PURE__ */ jsx(Label, { ...compounds?.label, children: label }),
|
|
1397
|
-
/* @__PURE__ */ jsx(SliderOutput, { ...compounds?.output, children: value !== void 0 ?
|
|
1654
|
+
/* @__PURE__ */ jsx(SliderOutput, { ...compounds?.output, children: ({ state }) => value !== void 0 ? state.getFormattedValue(state.values[0]) : placeholder ? /* @__PURE__ */ jsx("span", { ...compounds?.placeholder, children: placeholder }) : null }),
|
|
1398
1655
|
/* @__PURE__ */ jsx(SliderTrack, { ...compounds?.track, children: /* @__PURE__ */ jsx(SliderThumb, { ...compounds?.thumb }) })
|
|
1399
1656
|
]
|
|
1400
1657
|
}
|
|
@@ -1402,6 +1659,54 @@ var ThSlider = ({
|
|
|
1402
1659
|
onReset && /* @__PURE__ */ jsx(ThSettingsResetButton, { ...compounds?.reset, onClick: handleResetWithFocus })
|
|
1403
1660
|
] }) });
|
|
1404
1661
|
};
|
|
1662
|
+
var ThSliderWithPresets = ({
|
|
1663
|
+
presets,
|
|
1664
|
+
formatValue,
|
|
1665
|
+
value,
|
|
1666
|
+
onChange,
|
|
1667
|
+
compounds,
|
|
1668
|
+
range,
|
|
1669
|
+
step,
|
|
1670
|
+
...props
|
|
1671
|
+
}) => {
|
|
1672
|
+
const currentValue = Array.isArray(value) ? value[0] : value;
|
|
1673
|
+
const handleChange = useCallback((v) => {
|
|
1674
|
+
onChange?.([parseFloat(v)]);
|
|
1675
|
+
}, [onChange]);
|
|
1676
|
+
const radioValue = currentValue !== void 0 && presets.includes(currentValue) ? String(currentValue) : "";
|
|
1677
|
+
const radioItems = presets.map((p) => ({
|
|
1678
|
+
id: String(p),
|
|
1679
|
+
value: String(p),
|
|
1680
|
+
label: formatValue ? formatValue(p) : String(p)
|
|
1681
|
+
}));
|
|
1682
|
+
return /* @__PURE__ */ jsxs("div", { ...compounds?.wrapper, children: [
|
|
1683
|
+
/* @__PURE__ */ jsx(
|
|
1684
|
+
ThSlider,
|
|
1685
|
+
{
|
|
1686
|
+
value,
|
|
1687
|
+
onChange,
|
|
1688
|
+
range,
|
|
1689
|
+
step,
|
|
1690
|
+
compounds: compounds?.slider,
|
|
1691
|
+
...props
|
|
1692
|
+
}
|
|
1693
|
+
),
|
|
1694
|
+
/* @__PURE__ */ jsx(
|
|
1695
|
+
ThRadioGroup,
|
|
1696
|
+
{
|
|
1697
|
+
...compounds?.presetsList,
|
|
1698
|
+
value: radioValue,
|
|
1699
|
+
onChange: handleChange,
|
|
1700
|
+
items: radioItems,
|
|
1701
|
+
compounds: {
|
|
1702
|
+
wrapper: compounds?.presetsWrapper,
|
|
1703
|
+
radio: compounds?.preset,
|
|
1704
|
+
radioLabel: compounds?.presetLabel
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
)
|
|
1708
|
+
] });
|
|
1709
|
+
};
|
|
1405
1710
|
var ThSwitch = ({
|
|
1406
1711
|
ref,
|
|
1407
1712
|
label,
|
|
@@ -1450,7 +1755,7 @@ var ThDropdown = ({
|
|
|
1450
1755
|
compounds,
|
|
1451
1756
|
...props
|
|
1452
1757
|
}) => {
|
|
1453
|
-
if (!items && !
|
|
1758
|
+
if (!items && !React23.isValidElement(compounds?.listbox)) {
|
|
1454
1759
|
return null;
|
|
1455
1760
|
}
|
|
1456
1761
|
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
@@ -1460,12 +1765,12 @@ var ThDropdown = ({
|
|
|
1460
1765
|
...props,
|
|
1461
1766
|
children: [
|
|
1462
1767
|
label && /* @__PURE__ */ jsx(Label, { ...compounds?.label, children: label }),
|
|
1463
|
-
compounds?.button &&
|
|
1768
|
+
compounds?.button && React23.isValidElement(compounds.button) ? compounds.button : /* @__PURE__ */ jsx(ThDropdownButton, { ...compounds?.button }),
|
|
1464
1769
|
/* @__PURE__ */ jsx(
|
|
1465
1770
|
Popover,
|
|
1466
1771
|
{
|
|
1467
1772
|
...compounds?.popover,
|
|
1468
|
-
children: compounds?.listbox &&
|
|
1773
|
+
children: compounds?.listbox && React23.isValidElement(compounds.listbox) ? compounds.listbox : /* @__PURE__ */ jsx(
|
|
1469
1774
|
ListBox,
|
|
1470
1775
|
{
|
|
1471
1776
|
items,
|
|
@@ -1528,7 +1833,7 @@ var ThSettingsWrapper = ({
|
|
|
1528
1833
|
ref,
|
|
1529
1834
|
...props,
|
|
1530
1835
|
children: [
|
|
1531
|
-
isAdvanced && (compounds?.heading &&
|
|
1836
|
+
isAdvanced && (compounds?.heading && React23.isValidElement(compounds.heading) ? compounds.heading : label && /* @__PURE__ */ jsx(Heading, { ...compounds?.heading || {}, children: label })),
|
|
1532
1837
|
main.map((key, index) => {
|
|
1533
1838
|
const match = items[key];
|
|
1534
1839
|
return match && /* @__PURE__ */ jsx(match.Comp, { standalone: !isAdvanced || index !== 0, ...props }, key);
|
|
@@ -1572,6 +1877,6 @@ var ThGrid = ({
|
|
|
1572
1877
|
);
|
|
1573
1878
|
};
|
|
1574
1879
|
|
|
1575
|
-
export { ThActionButton, ThActionsBar, ThActionsTriggerVariant, ThBackArrow, ThBottomSheet, ThCloseButton, ThCollapsibleActionsBar, ThContainerBody, ThContainerHeader, ThContainerHeaderWithClose, ThContainerHeaderWithPrevious, ThDeleteButton, ThDockedPanel, ThDragIndicatorButton, ThDropdown, ThDropdownButton, ThFooter, ThForm, ThFormNumberField, ThFormSearchField, ThFormTextField, ThGrid, ThHeader, ThHome, ThInteractiveOverlay, ThLibrary, ThLink, ThLoader, ThMenu, ThMenuButton, ThMenuItem, ThModal, ThNavigationButton, ThNumberField, ThPagination,
|
|
1576
|
-
//# sourceMappingURL=chunk-
|
|
1577
|
-
//# sourceMappingURL=chunk-
|
|
1880
|
+
export { ThActionButton, ThActionsBar, ThActionsTriggerVariant, ThAudioProgress, ThBackArrow, ThBottomSheet, ThCloseButton, ThCollapsibleActionsBar, ThContainerBody, ThContainerHeader, ThContainerHeaderWithClose, ThContainerHeaderWithPrevious, ThDeleteButton, ThDockedPanel, ThDragIndicatorButton, ThDropdown, ThDropdownButton, ThFooter, ThForm, ThFormNumberField, ThFormSearchField, ThFormTextField, ThGrid, ThHeader, ThHome, ThInteractiveOverlay, ThLibrary, ThLink, ThLoader, ThMenu, ThMenuButton, ThMenuItem, ThModal, ThNavigationButton, ThNumberField, ThPagination, ThPluginProvider, ThPluginRegistry, ThPopover, ThRadioGroup, ThRunningHead, ThSettingsResetButton, ThSettingsWrapper, ThSettingsWrapperButton, ThSlider, ThSliderWithPresets, ThSwitch, ThTypedComponentRenderer, useActionComponentStatus, useActions, useFirstFocusable, usePlugins };
|
|
1881
|
+
//# sourceMappingURL=chunk-4ODYHZKD.mjs.map
|
|
1882
|
+
//# sourceMappingURL=chunk-4ODYHZKD.mjs.map
|