@enigmax/primitives 0.25.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-2RIO4VDV.js +121 -0
- package/dist/{chunk-DZMHY3SU.js → chunk-CPJJ3FPW.js} +17 -7
- package/dist/chunk-EYZ366LP.js +189 -0
- package/dist/chunk-HUUINHPR.js +135 -0
- package/dist/chunk-JLZDS6CV.js +177 -0
- package/dist/chunk-O2UJ5ZIX.js +387 -0
- package/dist/chunk-PVDU6AZU.js +953 -0
- package/dist/{chunk-Z3VDE7OA.js → chunk-YQV5XZIA.js} +2 -2
- package/dist/clipboard-menu-eemzEBqB.d.ts +93 -0
- package/dist/context-DR1dpO8b.d.ts +54 -0
- package/dist/{clipboard-menu-B_ouitfS.d.ts → context-menu-qqpGBkny.d.ts} +7 -91
- package/dist/index.d.ts +292 -2
- package/dist/index.js +5 -3
- package/dist/menu-52PXC5PL.js +33 -0
- package/dist/menu-YIGMPFUP.js +58 -0
- package/dist/next/index.d.ts +6 -2
- package/dist/next/index.js +12 -8
- package/dist/react/context-menu.d.ts +15 -55
- package/dist/react/context-menu.js +2 -2
- package/dist/react/image.d.ts +112 -0
- package/dist/react/image.js +3 -0
- package/dist/react/index.d.ts +6 -2
- package/dist/react/index.js +12 -8
- package/dist/react/input.js +1 -1
- package/dist/react/video.d.ts +126 -0
- package/dist/react/video.js +3 -0
- package/dist/react-router/index.d.ts +6 -2
- package/dist/react-router/index.js +12 -8
- package/dist/viewer-N5WLFB24.js +3 -0
- package/package.json +15 -2
- package/recipes/context-menu/styles.css +8 -1
- package/recipes/image/styles.css +182 -0
- package/recipes/video/styles.css +154 -0
- package/registry.json +486 -5
- package/src/core/context-menu.ts +22 -3
- package/src/core/image-viewer.ts +269 -0
- package/src/core/player.ts +345 -0
- package/src/index.ts +55 -0
- package/src/react/context-menu/root.tsx +27 -5
- package/src/react/context-menu/styles.ts +8 -1
- package/src/react/image/icons.tsx +59 -0
- package/src/react/image/index.tsx +185 -0
- package/src/react/image/menu.tsx +80 -0
- package/src/react/image/styles.ts +213 -0
- package/src/react/image/types.ts +116 -0
- package/src/react/image/viewer.tsx +571 -0
- package/src/react/index.ts +3 -0
- package/src/react/video/icons.tsx +135 -0
- package/src/react/video/index.tsx +731 -0
- package/src/react/video/menu.tsx +66 -0
- package/src/react/video/rail.tsx +99 -0
- package/src/react/video/styles.ts +161 -0
- package/src/react/video/types.ts +141 -0
- /package/dist/{chunk-3MGBZOAU.js → chunk-RMNXVWQ4.js} +0 -0
- /package/dist/{chunk-MSOCCQGH.js → chunk-T7I6WJSN.js} +0 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Download, NewTab, MenuButton } from './chunk-O2UJ5ZIX.js';
|
|
2
|
+
import { downloadFile, openInNewTab } from './chunk-HUUINHPR.js';
|
|
3
|
+
import { ContextMenu, useContextMenuContext } from './chunk-CPJJ3FPW.js';
|
|
4
|
+
import './chunk-EYZ366LP.js';
|
|
5
|
+
import './chunk-YQV5XZIA.js';
|
|
6
|
+
import './chunk-4VUHQFAT.js';
|
|
7
|
+
import './chunk-HS3X3XCW.js';
|
|
8
|
+
import './chunk-4ZPMP47J.js';
|
|
9
|
+
import { useRef } from 'react';
|
|
10
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
11
|
+
|
|
12
|
+
function ImageMenu({ item, index, options, labels }) {
|
|
13
|
+
const rows = [];
|
|
14
|
+
if (options.download !== false) {
|
|
15
|
+
rows.push({ id: "download", label: labels.download ?? "Download", icon: /* @__PURE__ */ jsx(Download, {}) });
|
|
16
|
+
}
|
|
17
|
+
if (options.newTab !== false) {
|
|
18
|
+
rows.push({ id: "new-tab", label: labels.newTab ?? "Open in a new tab", icon: /* @__PURE__ */ jsx(NewTab, {}) });
|
|
19
|
+
}
|
|
20
|
+
if (options.items?.length) {
|
|
21
|
+
if (rows.length > 0) rows.push({ type: "separator" });
|
|
22
|
+
rows.push(...options.items);
|
|
23
|
+
}
|
|
24
|
+
return /* @__PURE__ */ jsxs(
|
|
25
|
+
ContextMenu.Root,
|
|
26
|
+
{
|
|
27
|
+
items: rows,
|
|
28
|
+
clipboard: false,
|
|
29
|
+
onSelect: (row) => {
|
|
30
|
+
if (row.id === "download") void downloadFile(item.download ?? item.src, item.filename);
|
|
31
|
+
if (row.id === "new-tab") openInNewTab(item.src);
|
|
32
|
+
options.onSelect?.(row.id, item, index);
|
|
33
|
+
},
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ jsx(Trigger, { label: labels.menu ?? "More" }),
|
|
36
|
+
/* @__PURE__ */ jsx(ContextMenu.Content, {})
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
function Trigger({ label }) {
|
|
42
|
+
const menu = useContextMenuContext("Image.Menu");
|
|
43
|
+
const ref = useRef(null);
|
|
44
|
+
return /* @__PURE__ */ jsx("span", { ref, style: { display: "contents" }, children: /* @__PURE__ */ jsx(
|
|
45
|
+
MenuButton,
|
|
46
|
+
{
|
|
47
|
+
label,
|
|
48
|
+
expanded: menu.state.open,
|
|
49
|
+
onPress: () => {
|
|
50
|
+
const box = ref.current?.firstElementChild?.getBoundingClientRect();
|
|
51
|
+
if (!box) return;
|
|
52
|
+
menu.open({ x: box.right, y: box.bottom + 6 });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
) });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { ImageMenu };
|
package/dist/next/index.d.ts
CHANGED
|
@@ -23,11 +23,15 @@ export { PaletteContent, PaletteContextValue, PaletteField, PaletteFooter, Palet
|
|
|
23
23
|
export { R as RecentEntry, b as RecentStore, e as createRecentStore, g as groupRows, i as isPaletteShortcut, m as moveActive, r as recentKey, s as shortcutLabel } from '../palette-D7iuQh_T.js';
|
|
24
24
|
export { Select, SelectContent, SelectContextValue, SelectItem, SelectList, SelectMultipleProps, SelectOptionRow, SelectProps, SelectRoot, SelectRootProps, SelectSearch, SelectSingleProps, SelectTrigger, SelectValue, useSelectContext } from '../react/select.js';
|
|
25
25
|
export { a as SelectInstance, c as SelectOption, d as SelectOptions, e as SelectState, f as createSelect } from '../select-ClSy-J1f.js';
|
|
26
|
-
export { ContextMenu, ContextMenuContent, ContextMenuContentProps,
|
|
27
|
-
export { C as CLIPBOARD_PREFIX,
|
|
26
|
+
export { ContextMenu, ContextMenuContent, ContextMenuContentProps, ContextMenuList, ContextMenuPanel, ContextMenuProps, ContextMenuRoot, ContextMenuRootProps, ContextMenuRow, ContextMenuSearch, ContextMenuTrigger, ContextMenuTriggerProps } from '../react/context-menu.js';
|
|
27
|
+
export { C as CLIPBOARD_PREFIX, a as ClipboardAction, b as ClipboardMenuLabels, c as ClipboardMenuOptions, d as ClipboardTarget, e as clipboardAction, f as clipboardEntries, g as clipboardHasText, i as inspectClipboardTarget, p as performClipboardAction } from '../clipboard-menu-eemzEBqB.js';
|
|
28
|
+
export { a as ContextMenuAction, b as ContextMenuEntry, c as ContextMenuInstance, g as ContextMenuOptions, j as ContextMenuState, k as createContextMenu, l as isAction } from '../context-menu-qqpGBkny.js';
|
|
28
29
|
export { MarqueeRect, SelectionList, SelectionListProps, SelectionRenderer, SelectionRowRender, UseSelectionOptions, UseSelectionResult, useSelection } from '../react/selection.js';
|
|
29
30
|
export { D as DEFAULT_SELECTION_SHORTCUTS, a as SelectionCommand, b as SelectionCommandEvent, c as SelectionCommandName, d as SelectionInstance, e as SelectionOptions, f as SelectionShortcuts, g as SelectionState, h as createSelection } from '../selection-B_pmzHpy.js';
|
|
30
31
|
export { S as Shortcut, b as ShortcutSpec, i as isApplePlatform, m as matchesShortcut, p as parseShortcut, e as shortcutText, f as shortcutTokens } from '../keys-D2zJs1uB.js';
|
|
32
|
+
export { Image, ImageItem, ImageLabels, ImageMenuOptions, ImageProps, ImageSource, ZoomOptions } from '../react/image.js';
|
|
33
|
+
export { Video, VideoControls, VideoLabels, VideoProps, VideoSource, VideoTrack } from '../react/video.js';
|
|
34
|
+
export { C as ContextMenuContextValue, a as ContextMenuItem, b as ContextMenuNode, u as useContextMenuContext } from '../context-DR1dpO8b.js';
|
|
31
35
|
|
|
32
36
|
/**
|
|
33
37
|
* The Next.js entry. Same components, wired to `next/link`.
|
package/dist/next/index.js
CHANGED
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { useInput } from '../chunk-
|
|
2
|
+
export { useInput } from '../chunk-T7I6WJSN.js';
|
|
3
|
+
export { useSearch } from '../chunk-45UHLZYT.js';
|
|
4
|
+
export { useNetworkState } from '../chunk-S653GLSF.js';
|
|
3
5
|
export { RelativeTime } from '../chunk-OCMI7R6H.js';
|
|
4
6
|
export { PasswordStrength } from '../chunk-XQHCZAPJ.js';
|
|
5
|
-
export { ContextMenu, ContextMenuContent, ContextMenuList, ContextMenuPanel, ContextMenuRoot, ContextMenuRow, ContextMenuSearch, ContextMenuTrigger, useContextMenuContext } from '../chunk-
|
|
7
|
+
export { ContextMenu, ContextMenuContent, ContextMenuList, ContextMenuPanel, ContextMenuRoot, ContextMenuRow, ContextMenuSearch, ContextMenuTrigger, useContextMenuContext } from '../chunk-CPJJ3FPW.js';
|
|
6
8
|
export { SelectionList, useSelection } from '../chunk-N6PDHMAX.js';
|
|
9
|
+
export { Image } from '../chunk-2RIO4VDV.js';
|
|
10
|
+
import '../chunk-EYZ366LP.js';
|
|
11
|
+
export { Video } from '../chunk-PVDU6AZU.js';
|
|
7
12
|
import { Button } from '../chunk-6BGBYUSZ.js';
|
|
8
13
|
export { getLinkComponent, setLinkComponent, useButton } from '../chunk-6BGBYUSZ.js';
|
|
9
14
|
export { Flag } from '../chunk-NPHRS2Q7.js';
|
|
10
15
|
export { Toaster, toast, useSonner } from '../chunk-WPTBURIC.js';
|
|
11
16
|
export { createNotificationQueue, defaultQueue, useNotifications } from '../chunk-QYMUIW5I.js';
|
|
12
17
|
export { useMarquee } from '../chunk-ZWR2EXHQ.js';
|
|
13
|
-
export { useSearch } from '../chunk-45UHLZYT.js';
|
|
14
|
-
export { useNetworkState } from '../chunk-S653GLSF.js';
|
|
15
18
|
import '../chunk-KJINGUQN.js';
|
|
19
|
+
export { colorEquals, formatColor, hslToRgb, hsvToRgb, parseColor, rgbToHsl, rgbToHsv, toHex } from '../chunk-S2FPN5ID.js';
|
|
20
|
+
import '../chunk-2QFTRNAZ.js';
|
|
16
21
|
import '../chunk-IXVMRVD4.js';
|
|
17
22
|
export { estimatePasswordStrength, generatePassword } from '../chunk-HC2ME5PU.js';
|
|
18
|
-
export {
|
|
19
|
-
export { CLIPBOARD_PREFIX, clipboardAction, clipboardEntries, clipboardHasText, createContextMenu, inspectClipboardTarget, isAction, performClipboardAction } from '../chunk-Z3VDE7OA.js';
|
|
23
|
+
export { CLIPBOARD_PREFIX, clipboardAction, clipboardEntries, clipboardHasText, createContextMenu, inspectClipboardTarget, isAction, performClipboardAction } from '../chunk-YQV5XZIA.js';
|
|
20
24
|
export { DEFAULT_SELECTION_SHORTCUTS, createSelection } from '../chunk-WSQC3PCC.js';
|
|
25
|
+
import '../chunk-JLZDS6CV.js';
|
|
21
26
|
import '../chunk-MMQPZGSU.js';
|
|
22
27
|
export { configureFlags, flagAttributes, flagName, flagSrc, flagView, normalizeFlagCode } from '../chunk-LMZJBOZG.js';
|
|
23
28
|
import '../chunk-SNYUBXWQ.js';
|
|
24
29
|
import '../chunk-UOSSNUSC.js';
|
|
25
|
-
|
|
26
|
-
export { Input } from '../chunk-3MGBZOAU.js';
|
|
30
|
+
export { Input } from '../chunk-RMNXVWQ4.js';
|
|
27
31
|
import '../chunk-KVLSOQTI.js';
|
|
28
32
|
import '../chunk-F25CGNQC.js';
|
|
29
33
|
export { PaletteContent, PaletteField, PaletteFooter, PaletteItem, PaletteList, PaletteRoot, PaletteTrigger, SearchPalette, usePaletteContext } from '../chunk-FGBIZDV2.js';
|
|
@@ -1,59 +1,13 @@
|
|
|
1
|
-
import { ReactNode,
|
|
2
|
-
import {
|
|
3
|
-
export { C as
|
|
1
|
+
import { ReactNode, ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { b as ContextMenuNode, a as ContextMenuItem } from '../context-DR1dpO8b.js';
|
|
3
|
+
export { C as ContextMenuContextValue, u as useContextMenuContext } from '../context-DR1dpO8b.js';
|
|
4
|
+
import { c as ClipboardMenuOptions } from '../clipboard-menu-eemzEBqB.js';
|
|
5
|
+
export { C as CLIPBOARD_PREFIX, a as ClipboardAction, b as ClipboardMenuLabels, d as ClipboardTarget, e as clipboardAction, f as clipboardEntries, g as clipboardHasText, i as inspectClipboardTarget, p as performClipboardAction } from '../clipboard-menu-eemzEBqB.js';
|
|
6
|
+
import { g as ContextMenuOptions, b as ContextMenuEntry } from '../context-menu-qqpGBkny.js';
|
|
7
|
+
export { C as CONTEXT_MENU_SEARCH_KEYS, a as ContextMenuAction, c as ContextMenuInstance, d as ContextMenuLabel, e as ContextMenuLevel, f as ContextMenuMoveKey, h as ContextMenuPoint, i as ContextMenuSeparator, j as ContextMenuState, k as createContextMenu, l as isAction } from '../context-menu-qqpGBkny.js';
|
|
4
8
|
export { S as Shortcut, b as ShortcutSpec, m as matchesShortcut, p as parseShortcut, e as shortcutText, f as shortcutTokens } from '../keys-D2zJs1uB.js';
|
|
5
9
|
import '../search-DYgqRp37.js';
|
|
6
10
|
|
|
7
|
-
/**
|
|
8
|
-
* One row, as React draws it. The core carries `icon` as `unknown` because it cannot know
|
|
9
|
-
* what a node is; here it is one.
|
|
10
|
-
*/
|
|
11
|
-
interface ContextMenuItem extends Omit<ContextMenuAction, "icon" | "items"> {
|
|
12
|
-
icon?: ReactNode;
|
|
13
|
-
items?: readonly ContextMenuNode[];
|
|
14
|
-
}
|
|
15
|
-
/** Anything that can appear in a menu, with React's icon type. */
|
|
16
|
-
type ContextMenuNode = ContextMenuItem | Exclude<ContextMenuEntry, ContextMenuAction>;
|
|
17
|
-
interface ContextMenuContextValue {
|
|
18
|
-
instance: ContextMenuInstance;
|
|
19
|
-
state: ContextMenuState;
|
|
20
|
-
/**
|
|
21
|
-
* Open at a point, over what the press landed on. False when there was nothing to show,
|
|
22
|
-
* so the press is left alone.
|
|
23
|
-
*
|
|
24
|
-
* `target` is what the clipboard rows are built from - the field or the selection under
|
|
25
|
-
* the pointer - and a caller that leaves it out gets a menu with none of them, which is
|
|
26
|
-
* the right answer for a menu opened from somewhere that is not a press.
|
|
27
|
-
*/
|
|
28
|
-
open: (point: ContextMenuPoint, target?: EventTarget | null) => boolean;
|
|
29
|
-
close: () => void;
|
|
30
|
-
/** ids the parts need to point at each other. */
|
|
31
|
-
ids: {
|
|
32
|
-
trigger: string;
|
|
33
|
-
};
|
|
34
|
-
panelId: (level: number) => string;
|
|
35
|
-
itemId: (level: number, index: number) => string;
|
|
36
|
-
triggerRef: RefObject<HTMLElement | null>;
|
|
37
|
-
/** Which panel the keyboard is in. Always the deepest open one. */
|
|
38
|
-
onMenuKeyDown: (event: React.KeyboardEvent) => void;
|
|
39
|
-
/** How long the pointer must rest on a row before its submenu opens, and before one closes. */
|
|
40
|
-
delays: {
|
|
41
|
-
open: number;
|
|
42
|
-
close: number;
|
|
43
|
-
};
|
|
44
|
-
/** Drop the pending close, wherever it was scheduled. Called wherever the pointer lands. */
|
|
45
|
-
cancelClose: () => void;
|
|
46
|
-
/** Close everything below `level`, after the beat - replacing any close already waiting. */
|
|
47
|
-
scheduleClose: (level: number) => void;
|
|
48
|
-
/** Draw a row instead of the default icon / label / shortcut. */
|
|
49
|
-
renderItem?: (item: ContextMenuItem, level: number, index: number) => ReactNode;
|
|
50
|
-
/** Shown while a fetched submenu has not answered. */
|
|
51
|
-
loadingLabel: ReactNode;
|
|
52
|
-
/** Shown when a filter matched nothing, or a fetched submenu came back with nothing. */
|
|
53
|
-
emptyLabel: ReactNode;
|
|
54
|
-
}
|
|
55
|
-
declare function useContextMenuContext(part: string): ContextMenuContextValue;
|
|
56
|
-
|
|
57
11
|
interface ContextMenuRootProps {
|
|
58
12
|
/** The rows. A list with nothing selectable in it opens no menu at all. */
|
|
59
13
|
items: readonly ContextMenuNode[];
|
|
@@ -74,6 +28,12 @@ interface ContextMenuRootProps {
|
|
|
74
28
|
* selection, Cut over a selection in something writable, Paste in anything writable.
|
|
75
29
|
*/
|
|
76
30
|
clipboard?: boolean | ClipboardMenuOptions;
|
|
31
|
+
/**
|
|
32
|
+
* A filter field over the rows. `"auto"` (the default) grows one only once there are
|
|
33
|
+
* enough rows to be worth filtering; `true` asks for one whatever the count - which is
|
|
34
|
+
* what a menu whose rows are fetched wants - and `false` never draws one.
|
|
35
|
+
*/
|
|
36
|
+
searchable?: boolean | "auto";
|
|
77
37
|
/** Fuse.js's constructor, for fuzzy filtering. Omit it for the built-in matcher. */
|
|
78
38
|
fuse?: ContextMenuOptions["fuse"];
|
|
79
39
|
fuseOptions?: Record<string, unknown>;
|
|
@@ -170,7 +130,7 @@ declare function ContextMenuRow({ level, index, entry, children, ...props }: Con
|
|
|
170
130
|
* is PREPENDED to `<head>`, so anything the document already has wins on source order at
|
|
171
131
|
* equal specificity.
|
|
172
132
|
*/
|
|
173
|
-
declare const CONTEXT_MENU_STYLES = "\n:root {\n --enigma-menu-bg: #1c1c1c;\n --enigma-menu-border: #333333;\n --enigma-menu-radius: 0.625rem;\n --enigma-menu-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);\n --enigma-menu-text: #f5f5f5;\n --enigma-menu-muted: #a3a3a3;\n --enigma-menu-font-size: 0.8125rem;\n --enigma-menu-min-width: 12rem;\n --enigma-menu-max-height: 20rem;\n\n --enigma-menu-active-bg: #2a2a2a;\n --enigma-menu-accent: #fbbf24;\n --enigma-menu-danger: #f87171;\n --enigma-menu-danger-bg: rgba(248, 113, 113, 0.12);\n}\n\n@media (prefers-color-scheme: light) {\n :root {\n --enigma-menu-bg: #ffffff;\n --enigma-menu-border: #e5e5e5;\n --enigma-menu-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);\n --enigma-menu-text: #171717;\n --enigma-menu-muted: #737373;\n --enigma-menu-active-bg: #f5f5f5;\n --enigma-menu-accent: #b45309;\n --enigma-menu-danger: #b91c1c;\n --enigma-menu-danger-bg: rgba(185, 28, 28, 0.08);\n }\n}\n\n/* Every panel is positioned in VIEWPORT coordinates, which is what a pointer event reports\n and what a menu opened at the pointer needs. Fixed rather than absolute so a scrolling\n ancestor cannot drag it away from the place it was opened. */\n[data-enigma-menu-panel] {\n position: fixed; z-index:
|
|
133
|
+
declare const CONTEXT_MENU_STYLES = "\n:root {\n --enigma-menu-bg: #1c1c1c;\n --enigma-menu-border: #333333;\n --enigma-menu-radius: 0.625rem;\n --enigma-menu-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);\n --enigma-menu-text: #f5f5f5;\n --enigma-menu-muted: #a3a3a3;\n --enigma-menu-font-size: 0.8125rem;\n --enigma-menu-min-width: 12rem;\n --enigma-menu-max-height: 20rem;\n\n --enigma-menu-active-bg: #2a2a2a;\n --enigma-menu-accent: #fbbf24;\n --enigma-menu-danger: #f87171;\n --enigma-menu-danger-bg: rgba(248, 113, 113, 0.12);\n\n /* Above the lightbox, which sits at 9999, because a menu is opened FROM whatever is on\n top: the image viewer's own three-dot menu was portalled to the same body and painted\n underneath it, so its rows could be neither seen nor pressed. A menu is the topmost\n transient surface on a page, and this is the number that says so. It belongs here and\n not in the light-scheme block, or half the readers get an invalid z-index. */\n --enigma-menu-z: 10000;\n}\n\n@media (prefers-color-scheme: light) {\n :root {\n --enigma-menu-bg: #ffffff;\n --enigma-menu-border: #e5e5e5;\n --enigma-menu-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);\n --enigma-menu-text: #171717;\n --enigma-menu-muted: #737373;\n --enigma-menu-active-bg: #f5f5f5;\n --enigma-menu-accent: #b45309;\n --enigma-menu-danger: #b91c1c;\n --enigma-menu-danger-bg: rgba(185, 28, 28, 0.08);\n }\n}\n\n/* Every panel is positioned in VIEWPORT coordinates, which is what a pointer event reports\n and what a menu opened at the pointer needs. Fixed rather than absolute so a scrolling\n ancestor cannot drag it away from the place it was opened. */\n[data-enigma-menu-panel] {\n position: fixed; z-index: var(--enigma-menu-z);\n box-sizing: border-box;\n min-width: var(--enigma-menu-min-width);\n max-width: min(22rem, calc(100vw - 1rem));\n padding: 0.25rem;\n color: var(--enigma-menu-text);\n background: var(--enigma-menu-bg);\n border: 1px solid var(--enigma-menu-border);\n border-radius: var(--enigma-menu-radius);\n box-shadow: var(--enigma-menu-shadow);\n font-size: var(--enigma-menu-font-size);\n animation: enigma-menu-in 90ms ease-out;\n /* Measured before it is placed, and placed before it is seen: without this the panel is\n painted at 0,0 for one frame and jumps to the pointer on the next. */\n visibility: hidden;\n}\n[data-enigma-menu-panel][data-placed] { visibility: visible; }\n/* No focus ring around the panel. It takes focus so the keyboard has somewhere to be, not\n because it is a control: what MOVES is the highlighted row, drawn by [data-active] and\n announced through aria-activedescendant. A ring around the whole menu says the menu is the\n thing focused, which is not what is happening - and it appears the moment you press an\n arrow, over a surface that was already showing you where you are. Nothing is lost by\n removing it, because nothing inside is reachable by Tab: the menu owns that key. */\n[data-enigma-menu-panel]:focus,\n[data-enigma-menu-panel]:focus-visible { outline: none; }\n@keyframes enigma-menu-in {\n from { opacity: 0; transform: scale(0.98); }\n to { opacity: 1; transform: none; }\n}\n@media (prefers-reduced-motion: reduce) {\n [data-enigma-menu-panel] { animation: none; }\n}\n\n/* The heading: what the menu is acting ON. A long file name is cut rather than allowed to\n set the panel's width, and the full one stays reachable through its title attribute. */\n[data-enigma-menu-title] {\n margin: 0; padding: 0.375rem 0.5rem 0.25rem;\n font-size: 0.6875rem; font-weight: 600;\n color: var(--enigma-menu-muted);\n overflow: hidden; white-space: nowrap; text-overflow: ellipsis;\n}\n\n[data-enigma-menu-search] {\n width: 100%; box-sizing: border-box;\n padding: 0.375rem 0.5rem 0.5rem;\n font: inherit; font-size: var(--enigma-menu-font-size);\n color: var(--enigma-menu-text); background: transparent;\n border: 0; border-bottom: 1px solid var(--enigma-menu-border);\n outline: none;\n}\n[data-enigma-menu-search]::-webkit-search-cancel-button,\n[data-enigma-menu-search]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }\n\n[data-enigma-menu-list] {\n max-height: var(--enigma-menu-max-height);\n overflow-y: auto; overscroll-behavior: contain;\n}\n\n[data-enigma-menu-item] {\n display: flex; align-items: center; gap: 0.5rem;\n padding: 0.3125rem 0.5rem; border-radius: 0.375rem;\n line-height: 1.4;\n color: var(--enigma-menu-text);\n /* The hand, not the arrow. A native menu uses the arrow because the whole surface is\n drawn by the OS and nothing on a page looks like it; here the rows sit on a web page,\n where the hand is what says \"this is a thing you press\". */\n cursor: pointer; user-select: none;\n}\n[data-enigma-menu-item][data-active] { background: var(--enigma-menu-active-bg); }\n[data-enigma-menu-item][data-disabled] { opacity: 0.45; cursor: not-allowed; }\n[data-enigma-menu-item][data-destructive] { color: var(--enigma-menu-danger); }\n[data-enigma-menu-item][data-destructive][data-active] { background: var(--enigma-menu-danger-bg); }\n\n[data-enigma-menu-item-text] { display: grid; min-width: 0; }\n[data-enigma-menu-item-label] { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }\n[data-enigma-menu-item-description] {\n font-size: 0.6875rem; color: var(--enigma-menu-muted);\n overflow: hidden; white-space: nowrap; text-overflow: ellipsis;\n}\n\n[data-enigma-menu-icon] { display: inline-flex; align-items: center; flex: none; width: 1rem; max-height: 1.25em; line-height: 0; }\n\n/* The shortcut, on the right, the way every desktop menu prints it. margin-left: auto is\n what pushes it there, and flex: none is what stops a long label squashing it. */\n[data-enigma-menu-shortcut] {\n display: flex; align-items: center; gap: 0.125rem;\n flex: none; margin-left: auto; padding-left: 1.5rem;\n font-size: 0.6875rem; color: var(--enigma-menu-muted);\n font-variant-numeric: tabular-nums;\n}\n[data-enigma-menu-shortcut] kbd { font: inherit; }\n\n/* The submenu arrow shares the shortcut's slot, so a row never has both pushed apart. */\n[data-enigma-menu-arrow] {\n flex: none; margin-left: auto;\n width: 0.35rem; height: 0.35rem;\n border-right: 1.5px solid currentColor; border-top: 1.5px solid currentColor;\n transform: rotate(45deg);\n opacity: 0.6;\n}\n[data-enigma-menu-shortcut] + [data-enigma-menu-arrow] { margin-left: 0.5rem; }\n\n/* Check and radio: drawn rather than loaded, and reserving their space either way so\n choosing a row does not shift the label under the pointer. */\n[data-enigma-menu-check] {\n flex: none; width: 1rem; height: 1rem;\n display: grid; place-items: center;\n color: var(--enigma-menu-accent);\n}\n[data-enigma-menu-check]::after { content: \"\"; width: 0.35rem; height: 0.6rem; opacity: 0; }\n[data-enigma-menu-item][aria-checked=\"true\"] [data-enigma-menu-check]::after {\n opacity: 1;\n border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;\n transform: rotate(45deg) translate(-0.05rem, -0.05rem);\n}\n[data-enigma-menu-item][role=\"menuitemradio\"] [data-enigma-menu-check]::after {\n width: 0.4rem; height: 0.4rem; border-radius: 999px; background: currentColor;\n transform: none; border: 0;\n}\n\n[data-enigma-menu-separator] {\n height: 1px; margin: 0.25rem 0.25rem;\n background: var(--enigma-menu-border);\n}\n\n[data-enigma-menu-label] {\n margin: 0.375rem 0 0.125rem; padding: 0 0.5rem;\n font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;\n color: var(--enigma-menu-muted);\n}\n\n[data-enigma-menu-status] {\n margin: 0; padding: 0.625rem 0.5rem;\n font-size: var(--enigma-menu-font-size); color: var(--enigma-menu-muted);\n /* The quoted query is cut in the text as well, but a pasted string with no spaces has no\n break opportunity at all - so this is what stops it stretching the panel. */\n overflow-wrap: anywhere;\n}\n[data-enigma-menu-status][data-error] { color: var(--enigma-menu-danger); }\n\n/* The end-of-window marker: one pixel, so it has a box to be scrolled into. */\n[data-enigma-menu-more] { height: 1px; }\n";
|
|
174
134
|
|
|
175
135
|
type ContextMenuProps = ContextMenuRootProps & {
|
|
176
136
|
/** How many rows to put in the document at once. `Infinity` renders the lot. */
|
|
@@ -216,4 +176,4 @@ declare namespace ContextMenu {
|
|
|
216
176
|
var Item: typeof ContextMenuRow;
|
|
217
177
|
}
|
|
218
178
|
|
|
219
|
-
export { CONTEXT_MENU_STYLES, ClipboardMenuOptions, ContextMenu,
|
|
179
|
+
export { CONTEXT_MENU_STYLES, ClipboardMenuOptions, ContextMenu, ContextMenuContent, type ContextMenuContentProps, ContextMenuEntry, ContextMenuItem, ContextMenuList, type ContextMenuListProps, ContextMenuNode, ContextMenuOptions, ContextMenuPanel, type ContextMenuPanelProps, type ContextMenuProps, ContextMenuRoot, type ContextMenuRootProps, ContextMenuRow, type ContextMenuRowProps, ContextMenuSearch, type ContextMenuSearchProps, ContextMenuTrigger, type ContextMenuTriggerProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { CONTEXT_MENU_STYLES, ContextMenu, ContextMenuContent, ContextMenuList, ContextMenuPanel, ContextMenuRoot, ContextMenuRow, ContextMenuSearch, ContextMenuTrigger, useContextMenuContext } from '../chunk-
|
|
3
|
-
export { CLIPBOARD_PREFIX, CONTEXT_MENU_SEARCH_KEYS, clipboardAction, clipboardEntries, clipboardHasText, createContextMenu, inspectClipboardTarget, isAction, performClipboardAction } from '../chunk-
|
|
2
|
+
export { CONTEXT_MENU_STYLES, ContextMenu, ContextMenuContent, ContextMenuList, ContextMenuPanel, ContextMenuRoot, ContextMenuRow, ContextMenuSearch, ContextMenuTrigger, useContextMenuContext } from '../chunk-CPJJ3FPW.js';
|
|
3
|
+
export { CLIPBOARD_PREFIX, CONTEXT_MENU_SEARCH_KEYS, clipboardAction, clipboardEntries, clipboardHasText, createContextMenu, inspectClipboardTarget, isAction, performClipboardAction } from '../chunk-YQV5XZIA.js';
|
|
4
4
|
export { matchesShortcut, parseShortcut, shortcutText, shortcutTokens } from '../chunk-4VUHQFAT.js';
|
|
5
5
|
import '../chunk-HS3X3XCW.js';
|
|
6
6
|
import '../chunk-4ZPMP47J.js';
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
import { b as ContextMenuNode } from '../context-DR1dpO8b.js';
|
|
3
|
+
import '../context-menu-qqpGBkny.js';
|
|
4
|
+
import '../search-DYgqRp37.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The prop shapes for `<Image>`, split from the component so the viewer's chunk can import
|
|
8
|
+
* them without pulling the component in - the same arrangement `<Input>` is in.
|
|
9
|
+
*
|
|
10
|
+
* WHAT IS ON BY DEFAULT is the whole design of this API: an image that opens and zooms, and
|
|
11
|
+
* nothing else. A gallery's arrows, its thumbnails, a menu and a discard action are each a
|
|
12
|
+
* decision about the page they sit in, so each is a prop you turn on rather than one you
|
|
13
|
+
* remember to turn off.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** One image in a set: a URL, or the URL plus what is known about it. */
|
|
17
|
+
type ImageSource = string | ImageItem;
|
|
18
|
+
interface ImageItem {
|
|
19
|
+
src: string;
|
|
20
|
+
alt?: string;
|
|
21
|
+
/** A smaller file for the strip and for the frame while the full one loads. */
|
|
22
|
+
thumbnail?: string;
|
|
23
|
+
/** The URL to save, when the file to download is not the one being shown. */
|
|
24
|
+
download?: string;
|
|
25
|
+
/** Saved under this name instead of the one in the URL. */
|
|
26
|
+
filename?: string;
|
|
27
|
+
caption?: ReactNode;
|
|
28
|
+
}
|
|
29
|
+
interface ZoomOptions {
|
|
30
|
+
/** How far out. 1 is the fitted image; below it the picture is smaller than its frame. */
|
|
31
|
+
min?: number;
|
|
32
|
+
max?: number;
|
|
33
|
+
/** Zoom on the wheel. On by default - it is the gesture every image viewer answers. */
|
|
34
|
+
wheel?: boolean;
|
|
35
|
+
/** A double press toggles between fitted and this. `false` leaves the gesture alone. */
|
|
36
|
+
doubleClick?: boolean;
|
|
37
|
+
}
|
|
38
|
+
interface ImageMenuOptions {
|
|
39
|
+
/** The download row. On whenever the menu is. */
|
|
40
|
+
download?: boolean;
|
|
41
|
+
/** The row that opens the picture on its own, in another tab. On whenever the menu is. */
|
|
42
|
+
newTab?: boolean;
|
|
43
|
+
/** Rows of your own, after the built-in ones. */
|
|
44
|
+
items?: readonly ContextMenuNode[];
|
|
45
|
+
onSelect?: (id: string, item: ImageItem, index: number) => void;
|
|
46
|
+
}
|
|
47
|
+
/** Every string the viewer says, for a UI that is not in English. */
|
|
48
|
+
interface ImageLabels {
|
|
49
|
+
open?: string;
|
|
50
|
+
close?: string;
|
|
51
|
+
zoomIn?: string;
|
|
52
|
+
zoomOut?: string;
|
|
53
|
+
reset?: string;
|
|
54
|
+
previous?: string;
|
|
55
|
+
next?: string;
|
|
56
|
+
menu?: string;
|
|
57
|
+
download?: string;
|
|
58
|
+
newTab?: string;
|
|
59
|
+
discard?: string;
|
|
60
|
+
thumbnails?: string;
|
|
61
|
+
/** The frame itself, announced as the dialog's name. Default "Image viewer". */
|
|
62
|
+
viewer?: string;
|
|
63
|
+
/** `{index}` and `{total}` are replaced. Default "{index} of {total}". */
|
|
64
|
+
counter?: string;
|
|
65
|
+
}
|
|
66
|
+
interface ImageProps extends Omit<ComponentPropsWithoutRef<"img">, "children" | "onSelect"> {
|
|
67
|
+
src: string;
|
|
68
|
+
alt: string;
|
|
69
|
+
/**
|
|
70
|
+
* The set this image belongs to. Without it the viewer shows this one image; with it the
|
|
71
|
+
* arrows, the strip and the discard action have something to move through.
|
|
72
|
+
*/
|
|
73
|
+
images?: readonly ImageSource[];
|
|
74
|
+
/** Where in `images` this one is. Found by `src` when it is left out. */
|
|
75
|
+
index?: number;
|
|
76
|
+
/** Click to see it larger. ON by default: it is what an image in a page is expected to do. */
|
|
77
|
+
lightbox?: boolean;
|
|
78
|
+
/** Zoom, with the wheel and the keyboard. ON by default. */
|
|
79
|
+
zoom?: boolean | ZoomOptions;
|
|
80
|
+
/**
|
|
81
|
+
* The picture flies out of the page into the viewer, and back into it on the way out. ON
|
|
82
|
+
* by default, and skipped anyway for a reader who has asked for less movement.
|
|
83
|
+
*/
|
|
84
|
+
animate?: boolean;
|
|
85
|
+
/** Arrows, the counter, and Left/Right on the keyboard. Off by default. */
|
|
86
|
+
navigation?: boolean;
|
|
87
|
+
/** The strip of previews along the bottom. Off by default. */
|
|
88
|
+
thumbnails?: boolean;
|
|
89
|
+
/** The three dots, and what is under them. Off by default. */
|
|
90
|
+
menu?: boolean | ImageMenuOptions;
|
|
91
|
+
/**
|
|
92
|
+
* Take an image out of the set and move to the next one. Off by default, because it is
|
|
93
|
+
* destructive and only the caller knows whether it means anything on their page.
|
|
94
|
+
*/
|
|
95
|
+
discardable?: boolean;
|
|
96
|
+
onDiscard?: (item: ImageItem, index: number) => void;
|
|
97
|
+
/** Whether the arrows and the strip wrap around at the ends. On by default. */
|
|
98
|
+
loop?: boolean;
|
|
99
|
+
/** The caption under the frame, when the item carries none of its own. */
|
|
100
|
+
caption?: ReactNode;
|
|
101
|
+
onOpenChange?: (open: boolean) => void;
|
|
102
|
+
onIndexChange?: (index: number, item: ImageItem) => void;
|
|
103
|
+
/** The viewer's stylesheet, injected once. There is no useful unstyled lightbox. */
|
|
104
|
+
styles?: boolean;
|
|
105
|
+
labels?: ImageLabels;
|
|
106
|
+
/** Props for the element wrapping the thumbnail - this is what you position. */
|
|
107
|
+
wrapperProps?: ComponentPropsWithoutRef<"span">;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
declare function Image(props: ImageProps): ReactNode;
|
|
111
|
+
|
|
112
|
+
export { Image, type ImageItem, type ImageLabels, type ImageMenuOptions, type ImageProps, type ImageSource, type ZoomOptions };
|
package/dist/react/index.d.ts
CHANGED
|
@@ -25,11 +25,15 @@ export { PaletteContent, PaletteContextValue, PaletteField, PaletteFooter, Palet
|
|
|
25
25
|
export { R as RecentEntry, b as RecentStore, e as createRecentStore, g as groupRows, i as isPaletteShortcut, m as moveActive, r as recentKey, s as shortcutLabel } from '../palette-D7iuQh_T.js';
|
|
26
26
|
export { Select, SelectContent, SelectContextValue, SelectItem, SelectList, SelectMultipleProps, SelectOptionRow, SelectProps, SelectRoot, SelectRootProps, SelectSearch, SelectSingleProps, SelectTrigger, SelectValue, useSelectContext } from './select.js';
|
|
27
27
|
export { a as SelectInstance, c as SelectOption, d as SelectOptions, e as SelectState, f as createSelect } from '../select-ClSy-J1f.js';
|
|
28
|
-
export { ContextMenu, ContextMenuContent, ContextMenuContentProps,
|
|
29
|
-
export { C as CLIPBOARD_PREFIX,
|
|
28
|
+
export { ContextMenu, ContextMenuContent, ContextMenuContentProps, ContextMenuList, ContextMenuPanel, ContextMenuProps, ContextMenuRoot, ContextMenuRootProps, ContextMenuRow, ContextMenuSearch, ContextMenuTrigger, ContextMenuTriggerProps } from './context-menu.js';
|
|
29
|
+
export { C as CLIPBOARD_PREFIX, a as ClipboardAction, b as ClipboardMenuLabels, c as ClipboardMenuOptions, d as ClipboardTarget, e as clipboardAction, f as clipboardEntries, g as clipboardHasText, i as inspectClipboardTarget, p as performClipboardAction } from '../clipboard-menu-eemzEBqB.js';
|
|
30
|
+
export { a as ContextMenuAction, b as ContextMenuEntry, c as ContextMenuInstance, g as ContextMenuOptions, j as ContextMenuState, k as createContextMenu, l as isAction } from '../context-menu-qqpGBkny.js';
|
|
30
31
|
export { MarqueeRect, SelectionList, SelectionListProps, SelectionRenderer, SelectionRowRender, UseSelectionOptions, UseSelectionResult, useSelection } from './selection.js';
|
|
31
32
|
export { D as DEFAULT_SELECTION_SHORTCUTS, a as SelectionCommand, b as SelectionCommandEvent, c as SelectionCommandName, d as SelectionInstance, e as SelectionOptions, f as SelectionShortcuts, g as SelectionState, h as createSelection } from '../selection-B_pmzHpy.js';
|
|
32
33
|
export { S as Shortcut, b as ShortcutSpec, i as isApplePlatform, m as matchesShortcut, p as parseShortcut, e as shortcutText, f as shortcutTokens } from '../keys-D2zJs1uB.js';
|
|
34
|
+
export { Image, ImageItem, ImageLabels, ImageMenuOptions, ImageProps, ImageSource, ZoomOptions } from './image.js';
|
|
35
|
+
export { Video, VideoControls, VideoLabels, VideoProps, VideoSource, VideoTrack } from './video.js';
|
|
36
|
+
export { C as ContextMenuContextValue, a as ContextMenuItem, b as ContextMenuNode, u as useContextMenuContext } from '../context-DR1dpO8b.js';
|
|
33
37
|
|
|
34
38
|
interface UseInputResult {
|
|
35
39
|
/** Attach to the `<input>`. */
|
package/dist/react/index.js
CHANGED
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { useInput } from '../chunk-
|
|
2
|
+
export { useInput } from '../chunk-T7I6WJSN.js';
|
|
3
|
+
export { useSearch } from '../chunk-45UHLZYT.js';
|
|
4
|
+
export { useNetworkState } from '../chunk-S653GLSF.js';
|
|
3
5
|
export { RelativeTime } from '../chunk-OCMI7R6H.js';
|
|
4
6
|
export { PasswordStrength } from '../chunk-XQHCZAPJ.js';
|
|
5
|
-
export { ContextMenu, ContextMenuContent, ContextMenuList, ContextMenuPanel, ContextMenuRoot, ContextMenuRow, ContextMenuSearch, ContextMenuTrigger, useContextMenuContext } from '../chunk-
|
|
7
|
+
export { ContextMenu, ContextMenuContent, ContextMenuList, ContextMenuPanel, ContextMenuRoot, ContextMenuRow, ContextMenuSearch, ContextMenuTrigger, useContextMenuContext } from '../chunk-CPJJ3FPW.js';
|
|
6
8
|
export { SelectionList, useSelection } from '../chunk-N6PDHMAX.js';
|
|
9
|
+
export { Image } from '../chunk-2RIO4VDV.js';
|
|
10
|
+
import '../chunk-EYZ366LP.js';
|
|
11
|
+
export { Video } from '../chunk-PVDU6AZU.js';
|
|
7
12
|
export { Button, getLinkComponent, setLinkComponent, useButton } from '../chunk-6BGBYUSZ.js';
|
|
8
13
|
export { Flag } from '../chunk-NPHRS2Q7.js';
|
|
9
14
|
export { Toaster, toast, useSonner } from '../chunk-WPTBURIC.js';
|
|
10
15
|
export { createNotificationQueue, defaultQueue, useNotifications } from '../chunk-QYMUIW5I.js';
|
|
11
16
|
export { useMarquee } from '../chunk-ZWR2EXHQ.js';
|
|
12
|
-
export { useSearch } from '../chunk-45UHLZYT.js';
|
|
13
|
-
export { useNetworkState } from '../chunk-S653GLSF.js';
|
|
14
17
|
import '../chunk-KJINGUQN.js';
|
|
18
|
+
export { colorEquals, formatColor, hslToRgb, hsvToRgb, parseColor, rgbToHsl, rgbToHsv, toHex } from '../chunk-S2FPN5ID.js';
|
|
19
|
+
import '../chunk-2QFTRNAZ.js';
|
|
15
20
|
import '../chunk-IXVMRVD4.js';
|
|
16
21
|
export { estimatePasswordStrength, generatePassword } from '../chunk-HC2ME5PU.js';
|
|
17
|
-
export {
|
|
18
|
-
export { CLIPBOARD_PREFIX, clipboardAction, clipboardEntries, clipboardHasText, createContextMenu, inspectClipboardTarget, isAction, performClipboardAction } from '../chunk-Z3VDE7OA.js';
|
|
22
|
+
export { CLIPBOARD_PREFIX, clipboardAction, clipboardEntries, clipboardHasText, createContextMenu, inspectClipboardTarget, isAction, performClipboardAction } from '../chunk-YQV5XZIA.js';
|
|
19
23
|
export { DEFAULT_SELECTION_SHORTCUTS, createSelection } from '../chunk-WSQC3PCC.js';
|
|
24
|
+
import '../chunk-JLZDS6CV.js';
|
|
20
25
|
import '../chunk-MMQPZGSU.js';
|
|
21
26
|
export { configureFlags, flagAttributes, flagName, flagSrc, flagView, normalizeFlagCode } from '../chunk-LMZJBOZG.js';
|
|
22
27
|
import '../chunk-SNYUBXWQ.js';
|
|
23
28
|
import '../chunk-UOSSNUSC.js';
|
|
24
|
-
|
|
25
|
-
export { Input } from '../chunk-3MGBZOAU.js';
|
|
29
|
+
export { Input } from '../chunk-RMNXVWQ4.js';
|
|
26
30
|
import '../chunk-KVLSOQTI.js';
|
|
27
31
|
import '../chunk-F25CGNQC.js';
|
|
28
32
|
export { PaletteContent, PaletteField, PaletteFooter, PaletteItem, PaletteList, PaletteRoot, PaletteTrigger, SearchPalette, usePaletteContext } from '../chunk-FGBIZDV2.js';
|
package/dist/react/input.js
CHANGED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
import { b as ContextMenuNode, a as ContextMenuItem } from '../context-DR1dpO8b.js';
|
|
3
|
+
import '../context-menu-qqpGBkny.js';
|
|
4
|
+
import '../search-DYgqRp37.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The prop shapes for `<Video>`.
|
|
8
|
+
*
|
|
9
|
+
* Shaped after Plyr, which is the player this one is measured against: the same control set,
|
|
10
|
+
* the same shortcuts, the same auto-hiding bar. What differs is that the controls are the
|
|
11
|
+
* component's own markup rather than a string of HTML it parses, so a project styles them
|
|
12
|
+
* with the attributes below instead of overriding a stylesheet it did not write.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
interface VideoSource {
|
|
16
|
+
src: string;
|
|
17
|
+
/**
|
|
18
|
+
* `video/mp4`, `video/webm`. The browser picks the first one it can play.
|
|
19
|
+
*
|
|
20
|
+
* Inferred from the file extension when it is left out, and left off entirely when the
|
|
21
|
+
* extension means nothing - the browser then fetches and sniffs, which always works. A
|
|
22
|
+
* WRONG type is the expensive mistake: the source is skipped without being tried.
|
|
23
|
+
*/
|
|
24
|
+
type?: string;
|
|
25
|
+
}
|
|
26
|
+
interface VideoTrack {
|
|
27
|
+
src: string;
|
|
28
|
+
/** BCP 47: `en`, `es-419`. */
|
|
29
|
+
srcLang: string;
|
|
30
|
+
label: string;
|
|
31
|
+
kind?: "subtitles" | "captions" | "descriptions" | "chapters" | "metadata";
|
|
32
|
+
default?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/** Which controls the bar carries. Everything is on except `download`, as Plyr has it. */
|
|
35
|
+
interface VideoControls {
|
|
36
|
+
play?: boolean;
|
|
37
|
+
progress?: boolean;
|
|
38
|
+
currentTime?: boolean;
|
|
39
|
+
duration?: boolean;
|
|
40
|
+
volume?: boolean;
|
|
41
|
+
captions?: boolean;
|
|
42
|
+
settings?: boolean;
|
|
43
|
+
pip?: boolean;
|
|
44
|
+
/** Play on a TV. Feature-detected, and absent until the browser reports a screen to cast to. */
|
|
45
|
+
cast?: boolean;
|
|
46
|
+
fullscreen?: boolean;
|
|
47
|
+
/** Off by default: a video a page shows is not always one it means to hand over. */
|
|
48
|
+
download?: boolean;
|
|
49
|
+
}
|
|
50
|
+
interface VideoLabels {
|
|
51
|
+
play?: string;
|
|
52
|
+
pause?: string;
|
|
53
|
+
mute?: string;
|
|
54
|
+
unmute?: string;
|
|
55
|
+
volume?: string;
|
|
56
|
+
seek?: string;
|
|
57
|
+
captions?: string;
|
|
58
|
+
/** The row that turns subtitles off. Default "Off". */
|
|
59
|
+
captionsOff?: string;
|
|
60
|
+
/** The heading over the language rows. Default "Subtitles". */
|
|
61
|
+
subtitles?: string;
|
|
62
|
+
settings?: string;
|
|
63
|
+
speed?: string;
|
|
64
|
+
normal?: string;
|
|
65
|
+
pip?: string;
|
|
66
|
+
cast?: string;
|
|
67
|
+
/** While it is playing on the other screen. Default "Stop casting". */
|
|
68
|
+
stopCast?: string;
|
|
69
|
+
/** The context menu's rows. */
|
|
70
|
+
loop?: string;
|
|
71
|
+
copyUrl?: string;
|
|
72
|
+
copyUrlAtTime?: string;
|
|
73
|
+
enterFullscreen?: string;
|
|
74
|
+
exitFullscreen?: string;
|
|
75
|
+
download?: string;
|
|
76
|
+
/** The player itself, as a screen reader announces the region. Default "Video player". */
|
|
77
|
+
player?: string;
|
|
78
|
+
}
|
|
79
|
+
interface VideoProps extends Omit<ComponentPropsWithoutRef<"video">, "controls" | "children" | "src" | "contextMenu"> {
|
|
80
|
+
/** One file, or the list the browser should choose from. */
|
|
81
|
+
src?: string | readonly VideoSource[];
|
|
82
|
+
poster?: string;
|
|
83
|
+
tracks?: readonly VideoTrack[];
|
|
84
|
+
/** The control bar. `false` leaves a bare `<video>` with nothing over it. */
|
|
85
|
+
controls?: boolean | VideoControls;
|
|
86
|
+
/** Rates the settings menu offers. Defaults to Plyr's 0.5 through 2. */
|
|
87
|
+
speeds?: readonly number[];
|
|
88
|
+
/** Space, arrows, M, F, C and the digits. On by default, and never while typing. */
|
|
89
|
+
keyboard?: boolean;
|
|
90
|
+
/** A press on the picture plays and pauses. On by default. */
|
|
91
|
+
clickToPlay?: boolean;
|
|
92
|
+
/** Hide the bar while playing, until the pointer moves. On by default. */
|
|
93
|
+
autoHide?: boolean;
|
|
94
|
+
/** How long the pointer has to be still before the bar goes, in ms. Default 2600. */
|
|
95
|
+
autoHideDelay?: number;
|
|
96
|
+
/**
|
|
97
|
+
* The menu a right-click opens, shaped the way YouTube's is. ON by default.
|
|
98
|
+
*
|
|
99
|
+
* `false` gives the browser's own menu back - which is what a page wants when the point of
|
|
100
|
+
* the video is that it can be saved from the native menu.
|
|
101
|
+
*/
|
|
102
|
+
contextMenu?: boolean | VideoContextMenuOptions;
|
|
103
|
+
/** The player's stylesheet, injected once. There is no useful unstyled player. */
|
|
104
|
+
styles?: boolean;
|
|
105
|
+
labels?: VideoLabels;
|
|
106
|
+
/** The URL the download control saves. Defaults to what is playing. */
|
|
107
|
+
download?: string;
|
|
108
|
+
/** Rendered over the picture, under the controls - a title, a badge, your own overlay. */
|
|
109
|
+
children?: ReactNode;
|
|
110
|
+
/** Props for the element wrapping the video and its controls; this is what you size. */
|
|
111
|
+
wrapperProps?: ComponentPropsWithoutRef<"div">;
|
|
112
|
+
}
|
|
113
|
+
interface VideoContextMenuOptions {
|
|
114
|
+
/** Rows of your own, after the built-in ones. */
|
|
115
|
+
items?: readonly ContextMenuNode[];
|
|
116
|
+
/** A row was invoked - yours, or one of the built-in ids. */
|
|
117
|
+
onSelect?: (item: ContextMenuItem) => void;
|
|
118
|
+
/** The two "copy the link" rows. On whenever the menu is, where there is a URL to copy. */
|
|
119
|
+
copyUrl?: boolean;
|
|
120
|
+
/** The heading over the rows, naming what the menu is acting on. */
|
|
121
|
+
title?: string;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
declare function Video(props: VideoProps): ReactNode;
|
|
125
|
+
|
|
126
|
+
export { Video, type VideoContextMenuOptions, type VideoControls, type VideoLabels, type VideoProps, type VideoSource, type VideoTrack };
|
|
@@ -23,11 +23,15 @@ export { PaletteContent, PaletteContextValue, PaletteField, PaletteFooter, Palet
|
|
|
23
23
|
export { R as RecentEntry, b as RecentStore, e as createRecentStore, g as groupRows, i as isPaletteShortcut, m as moveActive, r as recentKey, s as shortcutLabel } from '../palette-D7iuQh_T.js';
|
|
24
24
|
export { Select, SelectContent, SelectContextValue, SelectItem, SelectList, SelectMultipleProps, SelectOptionRow, SelectProps, SelectRoot, SelectRootProps, SelectSearch, SelectSingleProps, SelectTrigger, SelectValue, useSelectContext } from '../react/select.js';
|
|
25
25
|
export { a as SelectInstance, c as SelectOption, d as SelectOptions, e as SelectState, f as createSelect } from '../select-ClSy-J1f.js';
|
|
26
|
-
export { ContextMenu, ContextMenuContent, ContextMenuContentProps,
|
|
27
|
-
export { C as CLIPBOARD_PREFIX,
|
|
26
|
+
export { ContextMenu, ContextMenuContent, ContextMenuContentProps, ContextMenuList, ContextMenuPanel, ContextMenuProps, ContextMenuRoot, ContextMenuRootProps, ContextMenuRow, ContextMenuSearch, ContextMenuTrigger, ContextMenuTriggerProps } from '../react/context-menu.js';
|
|
27
|
+
export { C as CLIPBOARD_PREFIX, a as ClipboardAction, b as ClipboardMenuLabels, c as ClipboardMenuOptions, d as ClipboardTarget, e as clipboardAction, f as clipboardEntries, g as clipboardHasText, i as inspectClipboardTarget, p as performClipboardAction } from '../clipboard-menu-eemzEBqB.js';
|
|
28
|
+
export { a as ContextMenuAction, b as ContextMenuEntry, c as ContextMenuInstance, g as ContextMenuOptions, j as ContextMenuState, k as createContextMenu, l as isAction } from '../context-menu-qqpGBkny.js';
|
|
28
29
|
export { MarqueeRect, SelectionList, SelectionListProps, SelectionRenderer, SelectionRowRender, UseSelectionOptions, UseSelectionResult, useSelection } from '../react/selection.js';
|
|
29
30
|
export { D as DEFAULT_SELECTION_SHORTCUTS, a as SelectionCommand, b as SelectionCommandEvent, c as SelectionCommandName, d as SelectionInstance, e as SelectionOptions, f as SelectionShortcuts, g as SelectionState, h as createSelection } from '../selection-B_pmzHpy.js';
|
|
30
31
|
export { S as Shortcut, b as ShortcutSpec, i as isApplePlatform, m as matchesShortcut, p as parseShortcut, e as shortcutText, f as shortcutTokens } from '../keys-D2zJs1uB.js';
|
|
32
|
+
export { Image, ImageItem, ImageLabels, ImageMenuOptions, ImageProps, ImageSource, ZoomOptions } from '../react/image.js';
|
|
33
|
+
export { Video, VideoControls, VideoLabels, VideoProps, VideoSource, VideoTrack } from '../react/video.js';
|
|
34
|
+
export { C as ContextMenuContextValue, a as ContextMenuItem, b as ContextMenuNode, u as useContextMenuContext } from '../context-DR1dpO8b.js';
|
|
31
35
|
|
|
32
36
|
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLElement>>;
|
|
33
37
|
|