@zonsh/ui 0.2.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +19 -13
- package/dist/components/alert-dialog.js +1 -1
- package/dist/components/ascii-field.d.ts +1 -1
- package/dist/components/bottom-nav.d.ts +86 -0
- package/dist/components/bottom-nav.js +175 -0
- package/dist/components/breadcrumb.d.ts +9 -0
- package/dist/components/breadcrumb.js +6 -1
- package/dist/components/button-group.d.ts +1 -1
- package/dist/components/button-group.js +2 -2
- package/dist/components/calendar.d.ts +1 -1
- package/dist/components/calendar.js +18 -3
- package/dist/components/carousel.d.ts +22 -3
- package/dist/components/carousel.js +25 -7
- package/dist/components/chart.d.ts +9 -0
- package/dist/components/chart.js +40 -3
- package/dist/components/code-block.d.ts +20 -10
- package/dist/components/code-block.js +54 -12
- package/dist/components/collapsible.js +2 -2
- package/dist/components/color-picker.d.ts +30 -8
- package/dist/components/color-picker.js +48 -27
- package/dist/components/combobox.d.ts +21 -3
- package/dist/components/combobox.js +79 -7
- package/dist/components/command.d.ts +23 -3
- package/dist/components/command.js +61 -16
- package/dist/components/conversation.d.ts +10 -1
- package/dist/components/conversation.js +14 -4
- package/dist/components/copy-button.d.ts +15 -6
- package/dist/components/copy-button.js +20 -5
- package/dist/components/data-table.d.ts +66 -6
- package/dist/components/data-table.js +376 -23
- package/dist/components/date-picker.d.ts +73 -4
- package/dist/components/date-picker.js +138 -7
- package/dist/components/dialog.d.ts +10 -1
- package/dist/components/dialog.js +6 -3
- package/dist/components/drawer.d.ts +10 -1
- package/dist/components/drawer.js +6 -3
- package/dist/components/feature-list.js +2 -2
- package/dist/components/field.d.ts +27 -8
- package/dist/components/field.js +49 -4
- package/dist/components/file-drop.d.ts +26 -4
- package/dist/components/file-drop.js +125 -64
- package/dist/components/filter-bar.d.ts +50 -3
- package/dist/components/filter-bar.js +71 -33
- package/dist/components/form.d.ts +4 -2
- package/dist/components/form.js +24 -2
- package/dist/components/graph.d.ts +41 -0
- package/dist/components/graph.js +84 -45
- package/dist/components/illustration.js +1 -1
- package/dist/components/input-group.d.ts +16 -5
- package/dist/components/input-group.js +35 -15
- package/dist/components/input.d.ts +2 -2
- package/dist/components/input.js +3 -3
- package/dist/components/kbd.d.ts +17 -0
- package/dist/components/kbd.js +8 -1
- package/dist/components/lightbox.d.ts +100 -0
- package/dist/components/lightbox.js +439 -0
- package/dist/components/locale.d.ts +44 -0
- package/dist/components/locale.js +37 -0
- package/dist/components/logo.js +1 -1
- package/dist/components/menu.js +3 -1
- package/dist/components/message.d.ts +3 -3
- package/dist/components/message.js +10 -7
- package/dist/components/meter.js +3 -1
- package/dist/components/money-input.d.ts +80 -0
- package/dist/components/money-input.js +253 -0
- package/dist/components/number-field.d.ts +21 -2
- package/dist/components/number-field.js +27 -16
- package/dist/components/otp-field.d.ts +14 -1
- package/dist/components/otp-field.js +10 -2
- package/dist/components/pagination.d.ts +13 -7
- package/dist/components/pagination.js +18 -7
- package/dist/components/pdf-viewer.d.ts +67 -2
- package/dist/components/pdf-viewer.js +88 -21
- package/dist/components/phone-input.d.ts +79 -0
- package/dist/components/phone-input.js +282 -0
- package/dist/components/popover.js +1 -1
- package/dist/components/progress.js +3 -1
- package/dist/components/prompt-input.d.ts +34 -9
- package/dist/components/prompt-input.js +28 -16
- package/dist/components/rating.d.ts +73 -0
- package/dist/components/rating.js +124 -0
- package/dist/components/reasoning.d.ts +16 -1
- package/dist/components/reasoning.js +10 -7
- package/dist/components/resizable.d.ts +10 -1
- package/dist/components/resizable.js +4 -1
- package/dist/components/response.d.ts +14 -3
- package/dist/components/response.js +36 -8
- package/dist/components/scroll-area.d.ts +1 -1
- package/dist/components/select.js +14 -3
- package/dist/components/separator.js +1 -1
- package/dist/components/sidebar.d.ts +20 -4
- package/dist/components/sidebar.js +34 -18
- package/dist/components/site-header.d.ts +46 -12
- package/dist/components/site-header.js +73 -19
- package/dist/components/slider.js +3 -1
- package/dist/components/sortable.d.ts +178 -0
- package/dist/components/sortable.js +1258 -0
- package/dist/components/sources.d.ts +17 -2
- package/dist/components/sources.js +11 -4
- package/dist/components/spinner.d.ts +13 -1
- package/dist/components/spinner.js +5 -2
- package/dist/components/stat.d.ts +91 -0
- package/dist/components/stat.js +141 -0
- package/dist/components/stepper.d.ts +71 -0
- package/dist/components/stepper.js +101 -0
- package/dist/components/switch.d.ts +2 -2
- package/dist/components/switch.js +2 -2
- package/dist/components/table.d.ts +12 -2
- package/dist/components/table.js +176 -39
- package/dist/components/tags-input.d.ts +18 -2
- package/dist/components/tags-input.js +65 -33
- package/dist/components/theme.d.ts +16 -2
- package/dist/components/theme.js +15 -7
- package/dist/components/time-field.d.ts +22 -3
- package/dist/components/time-field.js +19 -6
- package/dist/components/timeline.d.ts +18 -2
- package/dist/components/timeline.js +13 -4
- package/dist/components/tippy.d.ts +48 -0
- package/dist/components/tippy.js +648 -0
- package/dist/components/toast.d.ts +18 -2
- package/dist/components/toast.js +12 -3
- package/dist/components/tool-call.d.ts +19 -8
- package/dist/components/tool-call.js +18 -7
- package/dist/components/toolbar.js +6 -1
- package/dist/components/tour.d.ts +127 -0
- package/dist/components/tour.js +648 -0
- package/dist/components/tree.js +17 -4
- package/dist/components/video-player.d.ts +10 -2
- package/dist/components/video-player.js +73 -33
- package/dist/illustration.d.ts +2 -0
- package/dist/illustration.js +7 -0
- package/dist/index.d.ts +11 -3
- package/dist/index.js +11 -3
- package/dist/lib/code-highlight.d.ts +3 -16
- package/dist/lib/code-highlight.js +160 -10
- package/dist/lib/code-theme.js +3 -3
- package/dist/lib/digit-roll.js +8 -8
- package/dist/lib/field-errors.d.ts +28 -0
- package/dist/lib/field-errors.js +24 -0
- package/dist/lib/field-value.d.ts +13 -0
- package/dist/lib/field-value.js +44 -0
- package/dist/lib/graph-layout.js +11 -2
- package/dist/lib/money.d.ts +73 -0
- package/dist/lib/money.js +343 -0
- package/dist/lib/phone-countries.d.ts +1 -0
- package/dist/lib/phone-countries.js +281 -0
- package/dist/lib/phone.d.ts +90 -0
- package/dist/lib/phone.js +286 -0
- package/dist/lib/platform.d.ts +8 -3
- package/dist/lib/platform.js +13 -6
- package/dist/lib/row-index.d.ts +15 -0
- package/dist/lib/row-index.js +136 -0
- package/dist/lib/table-fit.js +23 -4
- package/dist/lib/theme-script.d.ts +15 -2
- package/dist/lib/theme-script.js +23 -3
- package/dist/lib/tippy/pixels.d.ts +47 -0
- package/dist/lib/tippy/pixels.js +187 -0
- package/dist/lib/tippy/sprite.d.ts +86 -0
- package/dist/lib/tippy/sprite.js +753 -0
- package/dist/messages/de.d.ts +12 -0
- package/dist/messages/de.js +326 -0
- package/dist/styles/expressive.css +20 -5
- package/dist/styles/index.css +3 -2
- package/dist/styles/material.css +7 -3
- package/dist/styles/parts/ai.css +2 -1
- package/dist/styles/parts/controls.css +62 -13
- package/dist/styles/parts/feedback.css +68 -1
- package/dist/styles/parts/foundations.css +1 -1
- package/dist/styles/parts/navigation.css +194 -2
- package/dist/styles/parts/overlays.css +7 -7
- package/dist/styles/tokens.css +12 -3
- package/dist/vite.d.ts +0 -50
- package/dist/vite.js +0 -100
- package/package.json +28 -33
- package/dist/components/code-highlight.d.ts +0 -13
- package/dist/components/code-highlight.js +0 -107
- package/dist/components/whiteboard.d.ts +0 -80
- package/dist/components/whiteboard.js +0 -389
- package/dist/styles/parts/whiteboard.css +0 -855
package/dist/components/tree.js
CHANGED
|
@@ -144,11 +144,11 @@ const TreeRow = React.memo(function TreeRow({ node, level, expanded, selected, }
|
|
|
144
144
|
const state = { expanded, selected, level };
|
|
145
145
|
const icon = typeof node.icon === "function" ? node.icon(state) : node.icon;
|
|
146
146
|
const Row = node.href ? "a" : "div";
|
|
147
|
-
return (_jsxs(Row, { "data-slot": "tree-row", "data-selected": selected ? "" : undefined, "data-current": selected ? "" : undefined, "data-disabled": node.disabled ? "" : undefined, href: node.href, tabIndex: node.href ? -1 : undefined, onClick: (event) => ctx.onRowClick(node, event), className: cn("flex w-full cursor-pointer items-center rounded-item material-row leading-none no-underline select-none",
|
|
147
|
+
return (_jsxs(Row, { "data-slot": "tree-row", "data-selected": selected ? "" : undefined, "data-current": selected ? "" : undefined, "data-disabled": node.disabled ? "" : undefined, href: node.href, tabIndex: node.href ? -1 : undefined, "aria-current": node.href && selected && ctx.selectionMode === "single" ? "page" : undefined, onClick: (event) => ctx.onRowClick(node, event), className: cn("flex w-full cursor-pointer items-center rounded-item material-row leading-none no-underline select-none",
|
|
148
148
|
// Hover lifts like a highlighted menu item; the full raised row (outer edge) is the selection.
|
|
149
149
|
"hover:not-data-current:border-control-inner-edge! hover:not-data-current:bg-none! hover:not-data-current:shadow-highlight!",
|
|
150
150
|
// The treeitem holds the focus; its own row draws the ring, never the whole subtree.
|
|
151
|
-
"[li:focus-visible>&]:outline-2 [li:focus-visible>&]:outline-offset-0 [li:focus-visible>&]:outline-control-focus [li:focus-visible>&]:outline-solid", "data-disabled:cursor-default data-disabled:opacity-50", "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", sizes[ctx.size].row), children: [branch ? (_jsx("span", { "data-slot": "tree-chevron", "aria-hidden": true, onClick: (event) => ctx.onChevronClick(node, event), className: "-my-1 flex shrink-0 items-center self-stretch text-muted-foreground", children: _jsx(ChevronRightIcon, { className: cn("transition-[rotate] duration-(--duration) ease-(--ease) rtl:-scale-x-100", expanded && "rotate-90 rtl:-rotate-90") }) })) : (_jsx("span", { "data-slot": "tree-chevron-space", "aria-hidden": true, className: "size-4 shrink-0" })), icon != null && (_jsx("span", { "data-slot": "tree-icon", "aria-hidden": true, className: cn("flex shrink-0", selected ? "text-foreground" : "text-muted-foreground"), children: icon })), _jsx("span", { "data-slot": "tree-label", className: "min-w-0 flex-1 truncate py-1 leading-5", children: node.label }), node.meta != null && (_jsx("span", { "data-slot": "tree-meta", className: "
|
|
151
|
+
"[li:focus-visible>&]:outline-2 [li:focus-visible>&]:outline-offset-0 [li:focus-visible>&]:outline-control-focus [li:focus-visible>&]:outline-solid", "data-disabled:cursor-default data-disabled:opacity-50", "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", sizes[ctx.size].row), children: [branch ? (_jsx("span", { "data-slot": "tree-chevron", "aria-hidden": true, onClick: (event) => ctx.onChevronClick(node, event), className: "-my-1 flex shrink-0 items-center self-stretch text-muted-foreground", children: _jsx(ChevronRightIcon, { className: cn("transition-[rotate] duration-(--duration) ease-(--ease) rtl:-scale-x-100", expanded && "rotate-90 rtl:-rotate-90") }) })) : (_jsx("span", { "data-slot": "tree-chevron-space", "aria-hidden": true, className: "size-4 shrink-0" })), icon != null && (_jsx("span", { "data-slot": "tree-icon", "aria-hidden": true, className: cn("flex shrink-0", selected ? "text-foreground" : "text-muted-foreground"), children: icon })), _jsx("span", { "data-slot": "tree-label", className: "min-w-0 flex-1 truncate py-1 leading-5", children: node.label }), node.meta != null && (_jsx("span", { "data-slot": "tree-meta", className: "ms-auto shrink-0 ps-2 font-mono text-xs leading-none text-muted-foreground tabular-nums", children: node.meta }))] }));
|
|
152
152
|
});
|
|
153
153
|
/**
|
|
154
154
|
* One `treeitem`: the row, and below it — once first opened — its children in a `group`. The
|
|
@@ -479,13 +479,19 @@ export function Tree({ items, size = "default", selectionMode = "single", select
|
|
|
479
479
|
// On a Mac, Ctrl-click is a right-click: it belongs to a context menu, not to the row.
|
|
480
480
|
if (event.ctrlKey && isApple())
|
|
481
481
|
return;
|
|
482
|
+
// A disabled link row is not followed, by the pointer as by Enter.
|
|
483
|
+
if (node.disabled)
|
|
484
|
+
event.preventDefault();
|
|
482
485
|
// The treeitem keeps the focus, also when a link row took it on mousedown.
|
|
483
486
|
setFocusState(node.id);
|
|
484
487
|
elements.current.get(node.id)?.focus({ preventScroll: true });
|
|
485
488
|
// ⌘ on Apple devices, Ctrl elsewhere.
|
|
486
489
|
const extend = modPressed(event);
|
|
487
|
-
if (selectionMode === "multiple" && (event.shiftKey || extend))
|
|
490
|
+
if (selectionMode === "multiple" && (event.shiftKey || extend)) {
|
|
491
|
+
// The modifier selects: it doesn't also open a link row in a new tab or window.
|
|
492
|
+
event.preventDefault();
|
|
488
493
|
select(node.id, event.shiftKey ? "range" : "toggle");
|
|
494
|
+
}
|
|
489
495
|
else {
|
|
490
496
|
select(node.id, "replace");
|
|
491
497
|
// A plain click on a branch also opens or closes it, as in a file explorer.
|
|
@@ -578,7 +584,14 @@ export function Tree({ items, size = "default", selectionMode = "single", select
|
|
|
578
584
|
break;
|
|
579
585
|
}
|
|
580
586
|
case " ":
|
|
581
|
-
|
|
587
|
+
// Shift+Space selects from the last selected row to this one (WAI-ARIA tree pattern).
|
|
588
|
+
if (multiple && event.shiftKey) {
|
|
589
|
+
if (!anchor.current || !position.has(anchor.current))
|
|
590
|
+
anchor.current = rangeEnd.current = id;
|
|
591
|
+
select(id, "range");
|
|
592
|
+
}
|
|
593
|
+
else
|
|
594
|
+
select(id, multiple ? "toggle" : "replace");
|
|
582
595
|
break;
|
|
583
596
|
case "*": {
|
|
584
597
|
// Open every sibling branch at this level.
|
|
@@ -158,9 +158,17 @@ export interface VideoPlayerProps extends Omit<React.ComponentProps<"div">, "chi
|
|
|
158
158
|
src?: string | VideoSource[];
|
|
159
159
|
/** Versions of the same video in other languages or resolutions, in place of `src`. */
|
|
160
160
|
versions?: VideoVersion[];
|
|
161
|
-
/**
|
|
161
|
+
/**
|
|
162
|
+
* The version's `audio` to start with. Defaults to the first version's. Changed later, the
|
|
163
|
+
* player switches to it from the same moment, as the audio menu does, until the viewer picks one.
|
|
164
|
+
*/
|
|
162
165
|
defaultAudio?: string;
|
|
163
|
-
/**
|
|
166
|
+
/**
|
|
167
|
+
* The version's `quality` to start with. Defaults to the first version's. Changed later (a watch
|
|
168
|
+
* party wants 1080p, a stalling connection a step down), the player switches to it from the same
|
|
169
|
+
* moment, playing or paused as it was, as the quality menu does; the viewer's own pick from the
|
|
170
|
+
* menu stays until the app changes it again. Neither calls `onQualityChange` / `onAudioChange`.
|
|
171
|
+
*/
|
|
164
172
|
defaultQuality?: string;
|
|
165
173
|
/** The image shown before the video plays. */
|
|
166
174
|
poster?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Slider as BaseSlider } from "@base-ui/react/slider";
|
|
4
|
-
import { AirplayIcon, ArrowLeftIcon, AudioLinesIcon, CaptionsIcon, CaptionsOffIcon, ChevronLeftIcon, GalleryVerticalEndIcon, LanguagesIcon, MaximizeIcon, MinimizeIcon, PauseIcon, PictureInPicture2Icon, PlayIcon, RotateCcwIcon, RotateCwIcon, SkipForwardIcon, VideoOffIcon, Volume1Icon, Volume2Icon, VolumeXIcon, } from "lucide-react";
|
|
4
|
+
import { AirplayIcon, ArrowLeftIcon, AudioLinesIcon, CaptionsIcon, CaptionsOffIcon, ChevronLeftIcon, ChevronsLeftIcon, ChevronsRightIcon, GalleryVerticalEndIcon, LanguagesIcon, MaximizeIcon, MinimizeIcon, PauseIcon, PictureInPicture2Icon, PlayIcon, RotateCcwIcon, RotateCwIcon, SkipForwardIcon, VideoOffIcon, Volume1Icon, Volume2Icon, VolumeXIcon, } from "lucide-react";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { cn } from "../lib/cn.js";
|
|
7
7
|
import { mergeRefs } from "../lib/merge-refs.js";
|
|
@@ -76,8 +76,9 @@ const LARGE_FRAME = 768;
|
|
|
76
76
|
/** How wide a timeline preview shows: the normal and the large movie layout. */
|
|
77
77
|
const PREVIEW_WIDTH = 176;
|
|
78
78
|
const PREVIEW_WIDTH_LARGE = 256;
|
|
79
|
-
/** How long the play or pause icon shows in the middle after the viewer toggles, in ms
|
|
80
|
-
|
|
79
|
+
/** How long the play or pause icon shows in the middle after the viewer toggles, in ms: an answer
|
|
80
|
+
to a press, so within the 300ms motion budget. */
|
|
81
|
+
const FLASH_MS = 300;
|
|
81
82
|
/** The last moment of a segment that still offers its skip, so it doesn't flash at the cut. */
|
|
82
83
|
const SEGMENT_TAIL = 0.5;
|
|
83
84
|
/** How long a skip stays on its own, in seconds of playback; after that it shows with the controls. */
|
|
@@ -92,8 +93,8 @@ const SCRUB_STEP = 0.1;
|
|
|
92
93
|
const MENU_CLOSE_MS = 400;
|
|
93
94
|
/** Two taps this close together are a double tap (ms). */
|
|
94
95
|
const DOUBLE_TAP_MS = 350;
|
|
95
|
-
/** A
|
|
96
|
-
const JUMP_MS =
|
|
96
|
+
/** A jump shows this long after the last press or tap, and jumps the same way within it add to it (ms). */
|
|
97
|
+
const JUMP_MS = 1000;
|
|
97
98
|
/** A subtitle file still on its way after this long gets a note where the subtitles show (ms). */
|
|
98
99
|
const SUBTITLE_SLOW_MS = 2000;
|
|
99
100
|
/** Asks for a subtitle file, and the pause between them (ms): cutting one out of a whole file can outlast a request. */
|
|
@@ -556,6 +557,28 @@ export function VideoPlayer({ src, versions = [], defaultAudio, defaultQuality,
|
|
|
556
557
|
if (next.quality !== undefined)
|
|
557
558
|
setQuality(next.quality);
|
|
558
559
|
};
|
|
560
|
+
// The app's audio and quality, like its subtitle: shown until the viewer picks one, and again
|
|
561
|
+
// whenever the app changes them. A switch carries on from the same moment, as the menus' do. A
|
|
562
|
+
// new title takes its defaults above, in the render, so this sees nothing left to switch.
|
|
563
|
+
const appVersion = React.useRef({ audio: defaultAudio, quality: defaultQuality });
|
|
564
|
+
React.useEffect(() => {
|
|
565
|
+
const before = appVersion.current;
|
|
566
|
+
appVersion.current = { audio: defaultAudio, quality: defaultQuality };
|
|
567
|
+
const next = {};
|
|
568
|
+
if (defaultAudio !== undefined &&
|
|
569
|
+
defaultAudio !== before.audio &&
|
|
570
|
+
defaultAudio !== audio &&
|
|
571
|
+
versions.some((v) => v.audio === defaultAudio))
|
|
572
|
+
next.audio = defaultAudio;
|
|
573
|
+
if (defaultQuality !== undefined &&
|
|
574
|
+
defaultQuality !== before.quality &&
|
|
575
|
+
defaultQuality !== quality &&
|
|
576
|
+
versions.some((v) => v.quality === defaultQuality))
|
|
577
|
+
next.quality = defaultQuality;
|
|
578
|
+
if (next.audio !== undefined || next.quality !== undefined)
|
|
579
|
+
switchVersion(next);
|
|
580
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- only when the app changes its choice.
|
|
581
|
+
}, [defaultAudio, defaultQuality]);
|
|
559
582
|
// Subtitles: the browser parses the track, the player draws the cue. The <track> elements are
|
|
560
583
|
// the tracks without a renderer of their own, in order.
|
|
561
584
|
const latestTracks = React.useRef(tracks);
|
|
@@ -753,6 +776,42 @@ export function VideoPlayer({ src, versions = [], defaultAudio, defaultQuality,
|
|
|
753
776
|
playhead.set({ time: el.currentTime });
|
|
754
777
|
}, [playhead]);
|
|
755
778
|
const seekBy = (delta) => seekTo((video.current?.currentTime ?? 0) + delta);
|
|
779
|
+
// A jump the viewer asked for (a key, a skip button, a double tap) shows on its side, back on the
|
|
780
|
+
// left and ahead on the right, as the timeline runs; quick ones the same way add up there.
|
|
781
|
+
const [jump, setJump] = React.useState(null);
|
|
782
|
+
const jumpBy = (delta, at = performance.now()) => {
|
|
783
|
+
seekBy(delta);
|
|
784
|
+
const side = Math.sign(delta);
|
|
785
|
+
setJump((before) => {
|
|
786
|
+
const more = before !== null && before.side === side && at - before.at < JUMP_MS;
|
|
787
|
+
return {
|
|
788
|
+
side,
|
|
789
|
+
seconds: (more ? before.seconds : 0) + Math.abs(delta),
|
|
790
|
+
at,
|
|
791
|
+
n: (before?.n ?? 0) + 1,
|
|
792
|
+
first: !more,
|
|
793
|
+
};
|
|
794
|
+
});
|
|
795
|
+
};
|
|
796
|
+
const jumpRef = React.useRef(null);
|
|
797
|
+
React.useEffect(() => {
|
|
798
|
+
const el = jumpRef.current;
|
|
799
|
+
if (!jump || !el)
|
|
800
|
+
return;
|
|
801
|
+
const still = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
802
|
+
// Each press nudges it the way it went; only the first fades in, so a run of them doesn't blink.
|
|
803
|
+
const from = jump.first ? 0 : 1;
|
|
804
|
+
const animation = el.animate(still
|
|
805
|
+
? [{ opacity: from }, { opacity: 1, offset: 0.1 }, { opacity: 1, offset: 0.65 }, { opacity: 0 }]
|
|
806
|
+
: [
|
|
807
|
+
{ opacity: from, transform: `translateX(${jump.side * -6}px) scale(0.94)` },
|
|
808
|
+
{ opacity: 1, transform: "none", offset: 0.15 },
|
|
809
|
+
{ opacity: 1, transform: "none", offset: 0.65 },
|
|
810
|
+
{ opacity: 0, transform: "none" },
|
|
811
|
+
], { duration: JUMP_MS, easing: "ease-out" });
|
|
812
|
+
animation.onfinish = () => setJump(null);
|
|
813
|
+
return () => animation.cancel();
|
|
814
|
+
}, [jump]);
|
|
756
815
|
const changeVolume = (next) => {
|
|
757
816
|
const el = video.current;
|
|
758
817
|
if (!el)
|
|
@@ -858,17 +917,17 @@ export function VideoPlayer({ src, versions = [], defaultAudio, defaultQuality,
|
|
|
858
917
|
break;
|
|
859
918
|
case "ArrowLeft":
|
|
860
919
|
if (!onSlider)
|
|
861
|
-
run(() =>
|
|
920
|
+
run(() => jumpBy(-5));
|
|
862
921
|
break;
|
|
863
922
|
case "ArrowRight":
|
|
864
923
|
if (!onSlider)
|
|
865
|
-
run(() =>
|
|
924
|
+
run(() => jumpBy(5));
|
|
866
925
|
break;
|
|
867
926
|
case "j":
|
|
868
|
-
run(() =>
|
|
927
|
+
run(() => jumpBy(-SKIP));
|
|
869
928
|
break;
|
|
870
929
|
case "l":
|
|
871
|
-
run(() =>
|
|
930
|
+
run(() => jumpBy(SKIP));
|
|
872
931
|
break;
|
|
873
932
|
case "ArrowUp":
|
|
874
933
|
if (!onSlider)
|
|
@@ -927,7 +986,6 @@ export function VideoPlayer({ src, versions = [], defaultAudio, defaultQuality,
|
|
|
927
986
|
// A click on the picture plays or pauses. A tap shows or hides the controls (play and pause wait
|
|
928
987
|
// in the middle then); quick taps on the left or right third jump back or ahead.
|
|
929
988
|
const lastTap = React.useRef(null);
|
|
930
|
-
const [jump, setJump] = React.useState(null);
|
|
931
989
|
const handleStageClick = (event) => {
|
|
932
990
|
if (event.button !== 0)
|
|
933
991
|
return;
|
|
@@ -952,13 +1010,7 @@ export function VideoPlayer({ src, versions = [], defaultAudio, defaultQuality,
|
|
|
952
1010
|
const last = lastTap.current;
|
|
953
1011
|
lastTap.current = { at: now, side };
|
|
954
1012
|
if (started && side !== 0 && last?.side === side && now - last.at < DOUBLE_TAP_MS) {
|
|
955
|
-
|
|
956
|
-
setJump((before) => ({
|
|
957
|
-
side,
|
|
958
|
-
seconds: before && before.side === side && now - before.at < JUMP_MS ? before.seconds + SKIP : SKIP,
|
|
959
|
-
at: now,
|
|
960
|
-
n: (before?.n ?? 0) + 1,
|
|
961
|
-
}));
|
|
1013
|
+
jumpBy(side * SKIP, now);
|
|
962
1014
|
return;
|
|
963
1015
|
}
|
|
964
1016
|
if (hidden)
|
|
@@ -968,18 +1020,6 @@ export function VideoPlayer({ src, versions = [], defaultAudio, defaultQuality,
|
|
|
968
1020
|
setIdle(true);
|
|
969
1021
|
}
|
|
970
1022
|
};
|
|
971
|
-
const jumpRef = React.useRef(null);
|
|
972
|
-
React.useEffect(() => {
|
|
973
|
-
const el = jumpRef.current;
|
|
974
|
-
if (!jump || !el)
|
|
975
|
-
return;
|
|
976
|
-
const animation = el.animate([{ opacity: 1 }, { opacity: 1, offset: 0.6 }, { opacity: 0 }], {
|
|
977
|
-
duration: JUMP_MS,
|
|
978
|
-
easing: "ease-out",
|
|
979
|
-
});
|
|
980
|
-
animation.onfinish = () => setJump(null);
|
|
981
|
-
return () => animation.cancel();
|
|
982
|
-
}, [jump]);
|
|
983
1023
|
const ready = duration > 0;
|
|
984
1024
|
// In full screen, popups have to live inside the player to be seen.
|
|
985
1025
|
const portal = isFullscreen ? { container: root } : undefined;
|
|
@@ -1029,7 +1069,7 @@ export function VideoPlayer({ src, versions = [], defaultAudio, defaultQuality,
|
|
|
1029
1069
|
}, [playhead, seekTo]);
|
|
1030
1070
|
/* ── The controls, placed by the layout below ── */
|
|
1031
1071
|
const playButton = (_jsx(Control, { label: ended ? labels.playAgain : playing ? labels.pause : labels.play, portal: portal, size: size, onClick: togglePlay, children: ended ? _jsx(RotateCcwIcon, {}) : playing ? _jsx(PauseIcon, {}) : _jsx(PlayIcon, {}) }));
|
|
1032
|
-
const skipButtons = (_jsxs(_Fragment, { children: [_jsx(Control, { label: labels.skipBack(SKIP), portal: portal, size: size, onClick: () =>
|
|
1072
|
+
const skipButtons = (_jsxs(_Fragment, { children: [_jsx(Control, { label: labels.skipBack(SKIP), portal: portal, size: size, onClick: () => jumpBy(-SKIP), children: _jsx(SkipIcon, { direction: "back", large: large }) }), _jsx(Control, { label: labels.skipForward(SKIP), portal: portal, size: size, onClick: () => jumpBy(SKIP), children: _jsx(SkipIcon, { direction: "forward", large: large }) })] }));
|
|
1033
1073
|
const volumeControls = (_jsxs("div", { "data-slot": "video-player-volume",
|
|
1034
1074
|
// In the movie layout's row, free to narrow: its slider gives way before anything overflows.
|
|
1035
1075
|
className: cn("flex items-center", movie ? "min-w-0" : "@max-md/video:mr-auto"), children: [_jsx(Control, { label: muted || volume === 0 ? labels.unmute : labels.mute, portal: portal, size: size, onClick: toggleMute, children: muted || volume === 0 ? _jsx(VolumeXIcon, {}) : volume < 0.5 ? _jsx(Volume1Icon, {}) : _jsx(Volume2Icon, {}) }), _jsx(BaseSlider.Root, { "data-slot": "video-player-volume-slider", value: muted ? 0 : Math.round(volume * 100), min: 0, max: 100, step: 5, onValueChange: (value) => changeVolume(value / 100),
|
|
@@ -1100,13 +1140,13 @@ export function VideoPlayer({ src, versions = [], defaultAudio, defaultQuality,
|
|
|
1100
1140
|
.filter((t) => !t.render)
|
|
1101
1141
|
.map((t) => (_jsx("track", { src: loaded[t.src] ?? t.src, label: t.label, srcLang: t.srcLang, kind: t.kind ?? "subtitles" }, loaded[t.src] ?? t.src)))] }), _jsx("div", { "aria-hidden": true, "data-slot": "video-player-stage", className: "absolute inset-0", onPointerUp: handleStageClick, onDoubleClick: () => allowFullscreen && canFullscreen && toggleFullscreen() }), movie && (_jsxs(_Fragment, { children: [_jsx("div", { hidden: failed, "aria-hidden": true, "data-slot": "video-player-scrim", "data-hidden": hidden ? "" : undefined, className: cn("pointer-events-none absolute inset-0 bg-[linear-gradient(to_bottom,rgb(0_0_0/0.55),transparent_22%,transparent_40%,rgb(0_0_0/0.85))]", "transition-opacity duration-(--duration) ease-brand data-hidden:opacity-0") }), (title || onBack) && (_jsxs("div", { "data-slot": "video-player-title", "data-hidden": hidden ? "" : undefined, ...focusProps, className: cn("theme-dark pointer-events-none absolute inset-x-0 top-0 flex items-center gap-1 bg-transparent px-5 pt-4 @2xl/video:px-7 @2xl/video:pt-6", "transition-opacity duration-(--duration) ease-brand data-hidden:opacity-0 data-hidden:*:pointer-events-none!",
|
|
1102
1142
|
// The arrow stands over the play button, in the controls' own column; the title follows it.
|
|
1103
|
-
onBack && "pt-3 pl-3 @2xl/video:pt-5 @2xl/video:pl-5", large && "[--icon-button:var(--control-h-lg)] [&_button_svg:not([class*='size-'])]:size-5", large && onBack && "pt-5! pl-7!"), children: [onBack && (_jsx(Control, { label: labels.back, portal: portal, size: size, onClick: onBack, className: "pointer-events-auto", children: _jsx(ArrowLeftIcon, {}) })), title && (_jsx("p", { className: "max-w-[min(100%,40rem)] min-w-0 truncate font-heading text-[17px] font-light text-foreground @2xl/video:text-2xl", children: title }))] }))] })), _jsx("div", { className: "theme-dark pointer-events-none absolute inset-0 flex items-center justify-center bg-transparent text-foreground", children: failed ? (_jsxs("div", { className: "flex flex-col items-center gap-4", children: [_jsxs("p", { "data-slot": "video-player-error", className: "flex items-center gap-2 font-mono text-xs text-muted-foreground", children: [_jsx(VideoOffIcon, { "aria-hidden": true, className: "size-4" }), labels.error] }), _jsxs("div", { className: "pointer-events-auto flex flex-wrap justify-center gap-2", children: [_jsx(Button, { variant: "secondary", size: "sm", onClick: retry, children: labels.retry }), nextQuality && (_jsx(Button, { variant: "ghost", size: "sm", onClick: () => {
|
|
1143
|
+
onBack && "pt-3 pl-3 @2xl/video:pt-5 @2xl/video:pl-5", large && "[--icon-button:var(--control-h-lg)] [&_button_svg:not([class*='size-'])]:size-5", large && onBack && "pt-5! pl-7!"), children: [onBack && (_jsx(Control, { label: labels.back, portal: portal, size: size, onClick: onBack, className: "pointer-events-auto", children: _jsx(ArrowLeftIcon, { className: "rtl:-scale-x-100" }) })), title && (_jsx("p", { className: "max-w-[min(100%,40rem)] min-w-0 truncate font-heading text-[17px] font-light text-foreground @2xl/video:text-2xl", children: title }))] }))] })), _jsx("div", { className: "theme-dark pointer-events-none absolute inset-0 flex items-center justify-center bg-transparent text-foreground", children: failed ? (_jsxs("div", { className: "flex flex-col items-center gap-4", children: [_jsxs("p", { "data-slot": "video-player-error", className: "flex items-center gap-2 font-mono text-xs text-muted-foreground", children: [_jsx(VideoOffIcon, { "aria-hidden": true, className: "size-4" }), labels.error] }), _jsxs("div", { className: "pointer-events-auto flex flex-wrap justify-center gap-2", children: [_jsx(Button, { variant: "secondary", size: "sm", onClick: retry, children: labels.retry }), nextQuality && (_jsx(Button, { variant: "ghost", size: "sm", onClick: () => {
|
|
1104
1144
|
switchVersion({ quality: nextQuality });
|
|
1105
1145
|
onQualityChange?.(nextQuality);
|
|
1106
1146
|
}, children: labels.tryQuality(nextQuality) }))] })] })) : preparing ? (_jsx(Spinner, { size: "lg", label: labels.loading })) : !started || ended ? (_jsx(Button, { "data-slot": "video-player-start", variant: "secondary", size: "icon", "aria-label": ended ? labels.playAgain : labels.play, onClick: togglePlay, className: "pointer-events-auto size-(--control-h-lg) [&_svg:not([class*='size-'])]:size-5", children: ended ? _jsx(RotateCcwIcon, {}) : _jsx(PlayIcon, { className: "translate-x-px" }) })) : waiting ? (_jsx(Spinner, { size: "lg", label: labels.loading })) : (_jsx(Button, { "data-slot": "video-player-center", "data-hidden": controlsHidden ? "" : undefined, variant: "secondary", size: "icon", "aria-label": playing ? labels.pause : labels.play, onClick: () => {
|
|
1107
1147
|
togglePlay();
|
|
1108
1148
|
wake();
|
|
1109
|
-
}, className: cn("pointer-events-auto hidden size-(--control-h-lg) pointer-coarse:inline-flex [&_svg:not([class*='size-'])]:size-5", "transition-opacity duration-(--duration) ease-brand data-hidden:pointer-events-none data-hidden:opacity-0"), children: playing ? _jsx(PauseIcon, {}) : _jsx(PlayIcon, { className: "translate-x-px" }) })) }), jump && (_jsx("div", { "aria-hidden": true, className: cn("theme-dark pointer-events-none absolute inset-y-0 flex w-1/3 items-center justify-center bg-transparent", jump.side < 0 ? "left-0" : "right-0"), children:
|
|
1149
|
+
}, className: cn("pointer-events-auto hidden size-(--control-h-lg) pointer-coarse:inline-flex [&_svg:not([class*='size-'])]:size-5", "transition-opacity duration-(--duration) ease-brand data-hidden:pointer-events-none data-hidden:opacity-0"), children: playing ? _jsx(PauseIcon, {}) : _jsx(PlayIcon, { className: "translate-x-px" }) })) }), jump && (_jsx("div", { "aria-hidden": true, className: cn("theme-dark pointer-events-none absolute inset-y-0 flex w-1/3 items-center justify-center bg-transparent", jump.side < 0 ? "left-0" : "right-0"), children: _jsxs("div", { ref: jumpRef, "data-slot": "video-player-jump", className: cn("flex flex-col items-center justify-center gap-1 rounded-full bg-black/50 text-foreground opacity-0", movie ? "size-20 [&_svg]:size-7" : "size-14 [&_svg]:size-5"), children: [jump.side < 0 ? (_jsx(ChevronsLeftIcon, { strokeWidth: 1.5 })) : (_jsx(ChevronsRightIcon, { strokeWidth: 1.5 })), _jsx("span", { className: cn("font-mono leading-none tabular-nums", movie ? "text-xs" : "text-[10px]"), children: labels.jumped(jump.side * jump.seconds) })] }, jump.n) })), flash && (_jsx("div", { "aria-hidden": true, className: "theme-dark pointer-events-none absolute inset-0 flex items-center justify-center bg-transparent", children: _jsx("div", { ref: flashRef, "data-slot": "video-player-flash", className: cn("flex items-center justify-center rounded-full bg-black/50 text-foreground opacity-0", movie ? "size-20 [&_svg]:size-8" : "size-14 [&_svg]:size-6"), children: flash.playing ? _jsx(PlayIcon, { className: "translate-x-0.5" }) : _jsx(PauseIcon, {}) }, flash.n) })), _jsx("div", { ref: subtitleLayer, "aria-hidden": true, "data-slot": "video-player-subtitle-layer", className: cn("pointer-events-none absolute inset-0 transition-transform duration-(--duration) ease-brand", !controlsHidden &&
|
|
1110
1150
|
(large
|
|
1111
1151
|
? "-translate-y-[calc(var(--control-h-lg)+56px)]"
|
|
1112
1152
|
: movie
|
|
@@ -1335,7 +1375,7 @@ function EpisodesMenu({ seasons, current, onSeasonOpen, onSelect, labels, portal
|
|
|
1335
1375
|
if (!playing.episodes)
|
|
1336
1376
|
onSeasonOpen?.(playing.id);
|
|
1337
1377
|
}
|
|
1338
|
-
}, children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: _jsx(MenuTrigger, { render: _jsx(Button, { variant: "ghost", size: size, "aria-label": labels.episodes, children: _jsx(GalleryVerticalEndIcon, {}) }) }) }), _jsx(TooltipContent, { portal: portal, className: "theme-dark", children: labels.episodes })] }), _jsx(MenuContent, { side: "top", align: "end", portal: portal, className: "theme-dark flex max-h-[min(36rem,var(--available-height,36rem))] w-[min(30rem,var(--available-width))] flex-col overflow-hidden", children: picking ? (_jsxs(MenuGroup, { className: "min-h-0 overflow-y-auto overscroll-contain", children: [_jsx(MenuGroupLabel, { children: labels.seasons }), _jsx(MenuRadioGroup, { value: season?.id ?? "", onValueChange: (id) => showSeason(String(id)), children: seasons.map((s) => (_jsxs(MenuRadioItem, { value: s.id, closeOnClick: false, children: [_jsx("span", { className: "flex-1", children: s.label }), countOf(s)] }, s.id))) })] })) : (_jsxs(_Fragment, { children: [seasons.length > 1 ? (_jsxs(MenuItem, { closeOnClick: false, onClick: () => setPicking(true), "aria-label": `${labels.seasons}: ${season?.label ?? ""}`, className: "shrink-0", children: [_jsx(ChevronLeftIcon, {}), header] })) : (_jsx("div", { className: "flex min-h-(--control-h) shrink-0 items-center gap-2.5 px-2.5 text-sm", children: header })), _jsx(MenuSeparator, { className: "shrink-0" }), _jsx("div", { ref: list, className: "relative min-h-0 overflow-y-auto overscroll-contain", children: _jsx(MenuGroup, { "aria-label": season?.label, "aria-busy": !season?.episodes || undefined, children: season?.episodes
|
|
1378
|
+
}, children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { render: _jsx(MenuTrigger, { render: _jsx(Button, { variant: "ghost", size: size, "aria-label": labels.episodes, children: _jsx(GalleryVerticalEndIcon, {}) }) }) }), _jsx(TooltipContent, { portal: portal, className: "theme-dark", children: labels.episodes })] }), _jsx(MenuContent, { side: "top", align: "end", portal: portal, className: "theme-dark flex max-h-[min(36rem,var(--available-height,36rem))] w-[min(30rem,var(--available-width))] flex-col overflow-hidden", children: picking ? (_jsxs(MenuGroup, { className: "min-h-0 overflow-y-auto overscroll-contain", children: [_jsx(MenuGroupLabel, { children: labels.seasons }), _jsx(MenuRadioGroup, { value: season?.id ?? "", onValueChange: (id) => showSeason(String(id)), children: seasons.map((s) => (_jsxs(MenuRadioItem, { value: s.id, closeOnClick: false, children: [_jsx("span", { className: "flex-1", children: s.label }), countOf(s)] }, s.id))) })] })) : (_jsxs(_Fragment, { children: [seasons.length > 1 ? (_jsxs(MenuItem, { closeOnClick: false, onClick: () => setPicking(true), "aria-label": `${labels.seasons}: ${season?.label ?? ""}`, className: "shrink-0", children: [_jsx(ChevronLeftIcon, { className: "rtl:-scale-x-100" }), header] })) : (_jsx("div", { className: "flex min-h-(--control-h) shrink-0 items-center gap-2.5 px-2.5 text-sm", children: header })), _jsx(MenuSeparator, { className: "shrink-0" }), _jsx("div", { ref: list, className: "relative min-h-0 overflow-y-auto overscroll-contain", children: _jsx(MenuGroup, { "aria-label": season?.label, "aria-busy": !season?.episodes || undefined, children: season?.episodes
|
|
1339
1379
|
? season.episodes.map((e) => (_jsx(EpisodeItem, { episode: e, playing: e.id === current, labels: labels, onSelect: onSelect }, e.id)))
|
|
1340
1380
|
: // Rows the size of the ones to come, so the list doesn't jump when they do.
|
|
1341
1381
|
Array.from({ length: Math.min(season?.count ?? 3, 6) }, (_, i) => (_jsxs("div", { className: "flex items-start gap-3 px-2.5 py-2", children: [_jsx(Skeleton, { shape: "item", className: "aspect-video w-28" }), _jsxs("div", { className: "flex flex-1 flex-col gap-2 py-1 text-sm", children: [_jsx(Skeleton, { className: "w-2/3" }), _jsx(Skeleton, { className: "w-full text-[13px]" }), _jsx(Skeleton, { className: "w-1/2 text-[13px]" })] })] }, i))) }) })] })) })] }));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// `@zonsh/ui/illustration`: the illustration library, an entry of its own because its editorial
|
|
2
|
+
// images are files, which a bundler copies into every build that reads the module.
|
|
3
|
+
export * from "./components/illustration.js";
|
|
4
|
+
// Plain data, named from a plain module: a server component reads it, and a client module's
|
|
5
|
+
// exports reach the server only as references. Named here, it wins over the same names re-exported
|
|
6
|
+
// by ./components/illustration.
|
|
7
|
+
export { illustrationKinds, illustrations } from "./lib/illustration-info.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export * from "./lib/cn.js";
|
|
2
|
-
export { createThemeScript, themeScript, THEME_STORAGE_KEY, type ThemeMode } from "./lib/theme-script.js";
|
|
3
|
-
export { illustrationKinds, illustrations, type IllustrationInfo } from "./lib/illustration-info.js";
|
|
2
|
+
export { createThemeScript, themeScript, PAGE_TONE, THEME_STORAGE_KEY, type ThemeMode } from "./lib/theme-script.js";
|
|
4
3
|
export { zonCodeTheme } from "./lib/code-theme.js";
|
|
5
4
|
export * from "./components/accordion.js";
|
|
6
5
|
export * from "./components/alert-dialog.js";
|
|
@@ -9,6 +8,7 @@ export * from "./components/ascii-field.js";
|
|
|
9
8
|
export * from "./components/aspect-ratio.js";
|
|
10
9
|
export * from "./components/avatar.js";
|
|
11
10
|
export * from "./components/badge.js";
|
|
11
|
+
export * from "./components/bottom-nav.js";
|
|
12
12
|
export * from "./components/breadcrumb.js";
|
|
13
13
|
export * from "./components/button-group.js";
|
|
14
14
|
export * from "./components/button.js";
|
|
@@ -30,29 +30,33 @@ export * from "./components/feature-list.js";
|
|
|
30
30
|
export * from "./components/field.js";
|
|
31
31
|
export * from "./components/file-drop.js";
|
|
32
32
|
export * from "./components/form.js";
|
|
33
|
-
export * from "./components/illustration.js";
|
|
34
33
|
export * from "./components/input-group.js";
|
|
35
34
|
export * from "./components/input.js";
|
|
36
35
|
export * from "./components/item.js";
|
|
37
36
|
export * from "./components/kbd.js";
|
|
38
37
|
export * from "./components/label.js";
|
|
39
38
|
export * from "./components/layout.js";
|
|
39
|
+
export * from "./components/lightbox.js";
|
|
40
|
+
export * from "./components/locale.js";
|
|
40
41
|
export * from "./components/logo.js";
|
|
41
42
|
export * from "./components/menu.js";
|
|
42
43
|
export * from "./components/menubar.js";
|
|
43
44
|
export * from "./components/message.js";
|
|
44
45
|
export * from "./components/meter.js";
|
|
46
|
+
export * from "./components/money-input.js";
|
|
45
47
|
export * from "./components/native-select.js";
|
|
46
48
|
export * from "./components/navigation-menu.js";
|
|
47
49
|
export * from "./components/number-field.js";
|
|
48
50
|
export * from "./components/otp-field.js";
|
|
49
51
|
export * from "./components/pagination.js";
|
|
52
|
+
export * from "./components/phone-input.js";
|
|
50
53
|
export * from "./components/popover.js";
|
|
51
54
|
export * from "./components/preview-card.js";
|
|
52
55
|
export * from "./components/progress.js";
|
|
53
56
|
export * from "./components/prompt-input.js";
|
|
54
57
|
export * from "./components/quote.js";
|
|
55
58
|
export * from "./components/radio-group.js";
|
|
59
|
+
export * from "./components/rating.js";
|
|
56
60
|
export * from "./components/reasoning.js";
|
|
57
61
|
export * from "./components/response.js";
|
|
58
62
|
export * from "./components/scroll-area.js";
|
|
@@ -62,8 +66,11 @@ export * from "./components/sidebar.js";
|
|
|
62
66
|
export * from "./components/site-header.js";
|
|
63
67
|
export * from "./components/skeleton.js";
|
|
64
68
|
export * from "./components/slider.js";
|
|
69
|
+
export * from "./components/sortable.js";
|
|
65
70
|
export * from "./components/sources.js";
|
|
66
71
|
export * from "./components/spinner.js";
|
|
72
|
+
export * from "./components/stat.js";
|
|
73
|
+
export * from "./components/stepper.js";
|
|
67
74
|
export * from "./components/suggestions.js";
|
|
68
75
|
export * from "./components/switch.js";
|
|
69
76
|
export * from "./components/table.js";
|
|
@@ -80,6 +87,7 @@ export * from "./components/toggle.js";
|
|
|
80
87
|
export * from "./components/tool-call.js";
|
|
81
88
|
export * from "./components/toolbar.js";
|
|
82
89
|
export * from "./components/tooltip.js";
|
|
90
|
+
export * from "./components/tour.js";
|
|
83
91
|
export * from "./components/tree.js";
|
|
84
92
|
export * from "./components/typography.js";
|
|
85
93
|
export * from "./components/video-player.js";
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Generated by scripts/gen-index.mjs — do not edit by hand.
|
|
2
2
|
export * from "./lib/cn.js";
|
|
3
|
-
export { createThemeScript, themeScript, THEME_STORAGE_KEY } from "./lib/theme-script.js";
|
|
4
|
-
export { illustrationKinds, illustrations } from "./lib/illustration-info.js";
|
|
3
|
+
export { createThemeScript, themeScript, PAGE_TONE, THEME_STORAGE_KEY } from "./lib/theme-script.js";
|
|
5
4
|
export { zonCodeTheme } from "./lib/code-theme.js";
|
|
6
5
|
export * from "./components/accordion.js";
|
|
7
6
|
export * from "./components/alert-dialog.js";
|
|
@@ -10,6 +9,7 @@ export * from "./components/ascii-field.js";
|
|
|
10
9
|
export * from "./components/aspect-ratio.js";
|
|
11
10
|
export * from "./components/avatar.js";
|
|
12
11
|
export * from "./components/badge.js";
|
|
12
|
+
export * from "./components/bottom-nav.js";
|
|
13
13
|
export * from "./components/breadcrumb.js";
|
|
14
14
|
export * from "./components/button-group.js";
|
|
15
15
|
export * from "./components/button.js";
|
|
@@ -31,29 +31,33 @@ export * from "./components/feature-list.js";
|
|
|
31
31
|
export * from "./components/field.js";
|
|
32
32
|
export * from "./components/file-drop.js";
|
|
33
33
|
export * from "./components/form.js";
|
|
34
|
-
export * from "./components/illustration.js";
|
|
35
34
|
export * from "./components/input-group.js";
|
|
36
35
|
export * from "./components/input.js";
|
|
37
36
|
export * from "./components/item.js";
|
|
38
37
|
export * from "./components/kbd.js";
|
|
39
38
|
export * from "./components/label.js";
|
|
40
39
|
export * from "./components/layout.js";
|
|
40
|
+
export * from "./components/lightbox.js";
|
|
41
|
+
export * from "./components/locale.js";
|
|
41
42
|
export * from "./components/logo.js";
|
|
42
43
|
export * from "./components/menu.js";
|
|
43
44
|
export * from "./components/menubar.js";
|
|
44
45
|
export * from "./components/message.js";
|
|
45
46
|
export * from "./components/meter.js";
|
|
47
|
+
export * from "./components/money-input.js";
|
|
46
48
|
export * from "./components/native-select.js";
|
|
47
49
|
export * from "./components/navigation-menu.js";
|
|
48
50
|
export * from "./components/number-field.js";
|
|
49
51
|
export * from "./components/otp-field.js";
|
|
50
52
|
export * from "./components/pagination.js";
|
|
53
|
+
export * from "./components/phone-input.js";
|
|
51
54
|
export * from "./components/popover.js";
|
|
52
55
|
export * from "./components/preview-card.js";
|
|
53
56
|
export * from "./components/progress.js";
|
|
54
57
|
export * from "./components/prompt-input.js";
|
|
55
58
|
export * from "./components/quote.js";
|
|
56
59
|
export * from "./components/radio-group.js";
|
|
60
|
+
export * from "./components/rating.js";
|
|
57
61
|
export * from "./components/reasoning.js";
|
|
58
62
|
export * from "./components/response.js";
|
|
59
63
|
export * from "./components/scroll-area.js";
|
|
@@ -63,8 +67,11 @@ export * from "./components/sidebar.js";
|
|
|
63
67
|
export * from "./components/site-header.js";
|
|
64
68
|
export * from "./components/skeleton.js";
|
|
65
69
|
export * from "./components/slider.js";
|
|
70
|
+
export * from "./components/sortable.js";
|
|
66
71
|
export * from "./components/sources.js";
|
|
67
72
|
export * from "./components/spinner.js";
|
|
73
|
+
export * from "./components/stat.js";
|
|
74
|
+
export * from "./components/stepper.js";
|
|
68
75
|
export * from "./components/suggestions.js";
|
|
69
76
|
export * from "./components/switch.js";
|
|
70
77
|
export * from "./components/table.js";
|
|
@@ -81,6 +88,7 @@ export * from "./components/toggle.js";
|
|
|
81
88
|
export * from "./components/tool-call.js";
|
|
82
89
|
export * from "./components/toolbar.js";
|
|
83
90
|
export * from "./components/tooltip.js";
|
|
91
|
+
export * from "./components/tour.js";
|
|
84
92
|
export * from "./components/tree.js";
|
|
85
93
|
export * from "./components/typography.js";
|
|
86
94
|
export * from "./components/video-player.js";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
1
|
/** One run of source text in one colour, as the highlighter splits a line. */
|
|
3
2
|
export interface CodeToken {
|
|
4
3
|
content: string;
|
|
@@ -7,23 +6,11 @@ export interface CodeToken {
|
|
|
7
6
|
/** Italic, bold and underline as Shiki's FontStyle bit flags (1, 2, 4). */
|
|
8
7
|
fontStyle?: number;
|
|
9
8
|
}
|
|
10
|
-
/**
|
|
11
|
-
* What CodeBlock needs from a highlighter: a way to load a language, then to split code into
|
|
12
|
-
* coloured tokens synchronously, so a block that changes on every frame (a streaming reply)
|
|
13
|
-
* colours as it renders. `@zonsh/ui/code-highlight` supplies one, on Shiki; the main entry only
|
|
14
|
-
* knows this shape, so it never pulls Shiki in.
|
|
15
|
-
*/
|
|
16
|
-
export interface CodeHighlighter {
|
|
17
|
-
/** Resolves `true` once `language` can be tokenised, `false` if it is unknown. */
|
|
18
|
-
load(language: string): Promise<boolean>;
|
|
19
|
-
/** The code as lines of tokens, or `null` while `language` is not loaded. */
|
|
20
|
-
tokenize(code: string, language: string): CodeToken[][] | null;
|
|
21
|
-
}
|
|
22
|
-
export declare const CodeHighlighterContext: React.Context<CodeHighlighter | null>;
|
|
23
9
|
/**
|
|
24
10
|
* The tokens for `code` once its language has loaded, and `null` until then (or when there is no
|
|
25
|
-
*
|
|
26
|
-
* `pending` is true while colours are on their way, false once they are in or
|
|
11
|
+
* language, Shiki does not know it, or `enabled` is false), so the block shows plain mono meanwhile
|
|
12
|
+
* and on the server. `pending` is true while colours are on their way, false once they are in or
|
|
13
|
+
* never will be.
|
|
27
14
|
*/
|
|
28
15
|
export declare function useCodeTokens(code: string, language: string | undefined, enabled: boolean): {
|
|
29
16
|
tokens: CodeToken[][] | null;
|