@leavepulse/ui 0.46.0 → 0.48.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.
Files changed (75) hide show
  1. package/dist/assets/HighlightText-BwC5xbqn.css +6 -0
  2. package/dist/assets/{LpCommandPalette-5miKYsb-.css → LpCommandPalette-DmQUsJqA.css} +21 -21
  3. package/dist/assets/LpKeys-BxRhfQda.css +36 -0
  4. package/dist/assets/LpPaletteFacts-B9FdVmIO.css +93 -0
  5. package/dist/assets/LpPaletteHeader-BVOu1UX5.css +70 -0
  6. package/dist/assets/LpPalettePreview-CJmAKgYW.css +43 -0
  7. package/dist/assets/LpPaletteStats-ClE-37MK.css +33 -0
  8. package/dist/assets/LpPaletteSwatches-CA0B8y2E.css +21 -0
  9. package/dist/assets/{LpShortcutsDialog-CqYX3yy6.css → LpShortcutsDialog-BUp_BX4s.css} +7 -28
  10. package/dist/assets/{LpTable-BoeA_TgK.css → LpTable-xWwI4KPZ.css} +17 -17
  11. package/dist/chunks/HighlightText-BvnYZkhi.js +27 -0
  12. package/dist/chunks/{LpAvatar-DeSb6H0c.js → LpAvatar-Cb1jtOVv.js} +21 -3
  13. package/dist/chunks/{LpLightbox-DSDahF23.js → LpLightbox-EVXzAq62.js} +3 -3
  14. package/dist/chunks/{LpMediaGallery-YKr-cQPN.js → LpMediaGallery-BnlkN_1f.js} +1 -1
  15. package/dist/chunks/LpPalettePreview-CFav_7co.js +19 -0
  16. package/dist/chunks/LpRangeSlider-C1yF9-nP.js +86 -0
  17. package/dist/chunks/LpVideoBackdrop-DN6xPUav.js +251 -0
  18. package/dist/component-names.d.ts +1 -1
  19. package/dist/components/HighlightText.vue.d.ts +7 -0
  20. package/dist/components/HighlightText.vue.js +4 -0
  21. package/dist/components/LpAvatar.vue.d.ts +12 -0
  22. package/dist/components/LpAvatar.vue.js +1 -1
  23. package/dist/components/LpCommandPalette.vue.d.ts +152 -15
  24. package/dist/components/LpCommandPalette.vue.js +178 -92
  25. package/dist/components/LpKeys.vue.d.ts +22 -0
  26. package/dist/components/LpKeys.vue.js +52 -0
  27. package/dist/components/LpLightbox.vue.js +1 -1
  28. package/dist/components/LpMediaGallery.vue.js +1 -1
  29. package/dist/components/LpPaletteFacts.vue.d.ts +25 -0
  30. package/dist/components/LpPaletteFacts.vue.js +85 -0
  31. package/dist/components/LpPaletteHeader.vue.d.ts +32 -0
  32. package/dist/components/LpPaletteHeader.vue.js +103 -0
  33. package/dist/components/LpPalettePreview.vue.d.ts +19 -0
  34. package/dist/components/LpPalettePreview.vue.js +4 -0
  35. package/dist/components/LpPaletteStats.vue.d.ts +11 -0
  36. package/dist/components/LpPaletteStats.vue.js +47 -0
  37. package/dist/components/LpPaletteSwatches.vue.d.ts +10 -0
  38. package/dist/components/LpPaletteSwatches.vue.js +34 -0
  39. package/dist/components/LpRangeSlider.vue.d.ts +39 -0
  40. package/dist/components/LpRangeSlider.vue.js +4 -0
  41. package/dist/components/LpShortcutsDialog.vue.js +8 -28
  42. package/dist/components/LpTable.vue.js +5 -3
  43. package/dist/components/LpVideoBackdrop.vue.d.ts +61 -0
  44. package/dist/components/LpVideoBackdrop.vue.js +4 -0
  45. package/dist/components/commandPalette.d.ts +157 -0
  46. package/dist/components/commandPalette.js +103 -0
  47. package/dist/components/commandSearch.d.ts +32 -0
  48. package/dist/components/commandSearch.js +48 -0
  49. package/dist/components/keys.d.ts +2 -0
  50. package/dist/components/keys.js +11 -0
  51. package/dist/components/videoBackdrop.d.ts +37 -0
  52. package/dist/components/videoBackdrop.js +40 -0
  53. package/dist/index.d.ts +16 -3
  54. package/dist/index.js +167 -134
  55. package/package.json +1 -1
  56. package/src/component-names.ts +9 -1
  57. package/src/components/HighlightText.vue +28 -0
  58. package/src/components/LpAvatar.vue +21 -2
  59. package/src/components/LpCommandPalette.vue +387 -87
  60. package/src/components/LpKeys.vue +79 -0
  61. package/src/components/LpLightbox.vue +4 -1
  62. package/src/components/LpPaletteFacts.vue +165 -0
  63. package/src/components/LpPaletteHeader.vue +155 -0
  64. package/src/components/LpPalettePreview.vue +77 -0
  65. package/src/components/LpPaletteStats.vue +81 -0
  66. package/src/components/LpPaletteSwatches.vue +56 -0
  67. package/src/components/LpRangeSlider.vue +96 -0
  68. package/src/components/LpShortcutsDialog.vue +2 -45
  69. package/src/components/LpTable.vue +6 -1
  70. package/src/components/LpVideoBackdrop.vue +303 -0
  71. package/src/components/commandPalette.ts +264 -0
  72. package/src/components/commandSearch.ts +79 -0
  73. package/src/components/keys.ts +13 -0
  74. package/src/components/videoBackdrop.ts +73 -0
  75. package/src/index.ts +16 -3
@@ -0,0 +1,157 @@
1
+ import { type CommandSearchTerms, type HighlightPart, type SearchableCommand } from "./commandSearch";
2
+ /** The fields of a command that decide whether the preview pane opens for it. */
3
+ export interface PreviewableCommand {
4
+ preview?: string;
5
+ excerpt?: string;
6
+ noPreview?: boolean;
7
+ }
8
+ /**
9
+ * Whether the pane has something to show for a row. `noPreview` on the row
10
+ * wins, then the app's `hasPreview`; without either, a row qualifies when the
11
+ * app supplied a `#preview` slot or the row carries text of its own.
12
+ */
13
+ export declare function commandHasPreview<T extends PreviewableCommand>(command: T | undefined, options: {
14
+ slot: boolean;
15
+ hasPreview?: (command: T) => boolean;
16
+ }): boolean;
17
+ /** One line of LpPaletteFacts: what it is, and what it is set to now. */
18
+ export interface PaletteFact {
19
+ /** Text, or the preview slot's `highlight(text)` to mark the query. */
20
+ label: string | HighlightPart[];
21
+ /** Right-aligned value; a change rolls in rather than swapping. */
22
+ value?: string | number;
23
+ /** A second, quieter line under the label. */
24
+ hint?: string | HighlightPart[];
25
+ icon?: string;
26
+ /** A colour dot in place of the icon: a role colour, a status. */
27
+ color?: string;
28
+ /** Marks the row that is in effect now: the current theme, the open tab. */
29
+ current?: boolean;
30
+ /** Draw the value in the monospace face: ids, paths, versions. */
31
+ mono?: boolean;
32
+ }
33
+ /** One tile of LpPaletteStats. */
34
+ export interface PaletteStat {
35
+ label: string;
36
+ /** A number counts to its new value; text rolls. */
37
+ value: number | string;
38
+ /** Abbreviate a number: 1.2k, 3.4M. */
39
+ compact?: boolean;
40
+ suffix?: string;
41
+ format?: (value: number) => string;
42
+ }
43
+ /** The fields of a command that let typing enter its mode. */
44
+ export interface PrefixedCommand {
45
+ prefix?: string;
46
+ children?: unknown;
47
+ disabled?: boolean;
48
+ }
49
+ /**
50
+ * The mode a query opens by its prefix, and the query left after it. Only a
51
+ * command with `children` and a non-empty `prefix` qualifies; letters match
52
+ * in any case, and the longest prefix wins, so "mr " and "m" can live side by
53
+ * side. Leading spaces are ignored: they are never what someone meant.
54
+ */
55
+ export declare function matchModePrefix<T extends PrefixedCommand>(query: string, commands: readonly T[]): {
56
+ command: T;
57
+ rest: string;
58
+ } | null;
59
+ /** The fields of a command that make it a "search elsewhere" row. */
60
+ export interface FallbackCommand extends SearchableCommand {
61
+ fallback?: boolean;
62
+ hidden?: boolean;
63
+ }
64
+ /**
65
+ * The fallback rows to show for a query, with their labels filled in. They
66
+ * appear only while positive words are typed, whatever those words are: the
67
+ * row offers to search somewhere else for them, so matching it against them
68
+ * would hide it exactly when it is needed. Exclusions and `in:` scopes still
69
+ * apply, to the row's own label, keywords and group. `{query}` in the label
70
+ * becomes the positive words, without the operators.
71
+ */
72
+ export declare function fallbackRows<T extends FallbackCommand>(items: readonly T[], raw: string): {
73
+ command: T;
74
+ label: string;
75
+ }[];
76
+ /**
77
+ * A remembered pick that is not a root command: one chosen inside a mode, or
78
+ * a result a search fetched. It keeps what the row needs to be drawn again
79
+ * and where it was found, so the palette can find the live command next time
80
+ * (`path` through static children, or the app's `resolveRecent`), and fall
81
+ * back to its `href` when neither can.
82
+ */
83
+ export interface RecentEntry {
84
+ id: string;
85
+ label: string;
86
+ description?: string;
87
+ icon?: string;
88
+ image?: string | {
89
+ src?: string | null;
90
+ alt?: string;
91
+ fallback?: string;
92
+ icon?: string;
93
+ shape?: "circle" | "soft" | "square";
94
+ };
95
+ href?: string;
96
+ /** Ids of the modes it was picked in, outermost first. */
97
+ path: string[];
98
+ /** The command's `recentData`, kept as given for `resolveRecent`. */
99
+ data?: unknown;
100
+ }
101
+ /** A stored history item: a root command id (the old format), or an entry. */
102
+ export type RecentItem = string | RecentEntry;
103
+ /** The fields of a command a history entry is built from and resolved to. */
104
+ export interface RecentSource {
105
+ id: string;
106
+ label: string;
107
+ description?: string;
108
+ icon?: string;
109
+ image?: RecentEntry["image"];
110
+ href?: string;
111
+ recentData?: unknown;
112
+ disabled?: boolean;
113
+ children?: unknown;
114
+ }
115
+ /** Stored history, with anything malformed dropped rather than trusted. */
116
+ export declare function readRecent(stored: unknown): RecentItem[];
117
+ /**
118
+ * The history item for a pick. A root pick stays a bare id, the format older
119
+ * versions wrote and still read; anything deeper becomes an entry with only
120
+ * the fields that survive JSON.
121
+ */
122
+ export declare function toRecentItem(command: RecentSource, path: readonly string[]): RecentItem;
123
+ /** The history with `item` first and any earlier copy of it dropped. */
124
+ export declare function pushRecent(list: readonly RecentItem[], item: RecentItem, keep: number): RecentItem[];
125
+ /**
126
+ * The live commands a history stands for, newest first. A bare id is looked
127
+ * up among the root commands; an entry is followed down its path through
128
+ * static children, then offered to `resolve` (for results a fetcher found),
129
+ * and last rebuilt from its own fields when it has an `href` to follow.
130
+ * Whatever none of these can find is skipped, so a stored history never
131
+ * resurrects something that cannot run.
132
+ */
133
+ export declare function resolveRecentItems<T extends RecentSource>(items: readonly RecentItem[], commands: readonly T[], options: {
134
+ limit: number;
135
+ resolve?: (entry: RecentEntry) => T | null | undefined;
136
+ fromEntry: (entry: RecentEntry) => T;
137
+ }): {
138
+ command: T;
139
+ path: string[];
140
+ }[];
141
+ /**
142
+ * Whether a recent row survives the operators typed so far. Recent rows show
143
+ * while no positive words are typed, so "-theme" or "in:recent" filters them
144
+ * like any other row; an `in:` scope matches the row's own group or the
145
+ * Recent heading it sits under.
146
+ */
147
+ export declare function recentVisible(command: SearchableCommand, terms: CommandSearchTerms, recentLabel: string): boolean;
148
+ /**
149
+ * The name a mode's chip shows. `modeLabel` when given; otherwise the label,
150
+ * with a `{query}` placeholder and the quotes around it taken out, since the
151
+ * words it stood for are in the box now ("Search mods for "{query}"" reads
152
+ * "Search mods").
153
+ */
154
+ export declare function modeChipLabel(command: {
155
+ label: string;
156
+ modeLabel?: string;
157
+ }): string;
@@ -0,0 +1,103 @@
1
+ import { parsePaletteQuery, applyQueryFilters } from "./commandSearch.js";
2
+ function commandHasPreview(command, options) {
3
+ if (!command || command.noPreview) return false;
4
+ if (options.hasPreview) return options.hasPreview(command);
5
+ return options.slot || !!(command.preview || command.excerpt);
6
+ }
7
+ function matchModePrefix(query, commands) {
8
+ const typed = query.trimStart().toLowerCase();
9
+ let best = null;
10
+ for (const command of commands) {
11
+ const prefix = command.prefix?.toLowerCase();
12
+ if (!prefix || !command.children || command.disabled || !typed.startsWith(prefix)) continue;
13
+ if (!best || prefix.length > (best.prefix?.length ?? 0)) best = command;
14
+ }
15
+ if (!best) return null;
16
+ return { command: best, rest: query.trimStart().slice(best.prefix.length) };
17
+ }
18
+ function fallbackRows(items, raw) {
19
+ const parsed = parsePaletteQuery(raw.trim());
20
+ if (!parsed.text) return [];
21
+ return applyQueryFilters(
22
+ items.filter((c) => c.fallback),
23
+ parsed
24
+ ).map((command) => ({ command, label: command.label.split("{query}").join(parsed.text) }));
25
+ }
26
+ function isEntry(value) {
27
+ if (!value || typeof value !== "object") return false;
28
+ const v = value;
29
+ return typeof v.id === "string" && typeof v.label === "string" && Array.isArray(v.path) && v.path.every((step) => typeof step === "string");
30
+ }
31
+ function readRecent(stored) {
32
+ if (!Array.isArray(stored)) return [];
33
+ return stored.filter((v) => typeof v === "string" || isEntry(v));
34
+ }
35
+ function recentKey(item) {
36
+ return typeof item === "string" ? item : [...item.path, item.id].join("\0");
37
+ }
38
+ function toRecentItem(command, path) {
39
+ if (!path.length) return command.id;
40
+ const entry = { id: command.id, label: command.label, path: [...path] };
41
+ if (command.description) entry.description = command.description;
42
+ if (command.icon) entry.icon = command.icon;
43
+ if (typeof command.image === "string") entry.image = command.image;
44
+ else if (command.image) {
45
+ const { src, alt, fallback, icon, shape } = command.image;
46
+ entry.image = { src, alt, fallback, icon, shape };
47
+ }
48
+ if (command.href) entry.href = command.href;
49
+ if (command.recentData !== void 0) entry.data = command.recentData;
50
+ return entry;
51
+ }
52
+ function pushRecent(list, item, keep) {
53
+ const key = recentKey(item);
54
+ return [item, ...list.filter((v) => recentKey(v) !== key)].slice(0, keep);
55
+ }
56
+ function resolveRecentItems(items, commands, options) {
57
+ const out = [];
58
+ const seen = /* @__PURE__ */ new Set();
59
+ for (const item of items) {
60
+ if (out.length >= options.limit) break;
61
+ const key = recentKey(item);
62
+ if (seen.has(key)) continue;
63
+ const found = typeof item === "string" ? commands.find((c) => c.id === item) : findEntry(item, commands, options);
64
+ if (!found || found.disabled || found.children) continue;
65
+ seen.add(key);
66
+ out.push({ command: found, path: typeof item === "string" ? [] : [...item.path] });
67
+ }
68
+ return out;
69
+ }
70
+ function findEntry(entry, commands, options) {
71
+ let level = commands;
72
+ for (const step of entry.path) {
73
+ const mode = level?.find((c) => c.id === step);
74
+ level = mode && Array.isArray(mode.children) ? mode.children : null;
75
+ }
76
+ const live = level?.find((c) => c.id === entry.id);
77
+ if (live) return live;
78
+ const resolved = options.resolve?.(entry);
79
+ if (resolved) return resolved;
80
+ return entry.href ? options.fromEntry(entry) : void 0;
81
+ }
82
+ function recentVisible(command, terms, recentLabel) {
83
+ if (!applyQueryFilters([{ ...command, group: void 0 }], { ...terms, groups: [] }).length) return false;
84
+ return terms.groups.every(
85
+ (term) => [command.group, recentLabel].some((group) => group?.toLowerCase().includes(term))
86
+ );
87
+ }
88
+ function modeChipLabel(command) {
89
+ if (command.modeLabel) return command.modeLabel;
90
+ if (!command.label.includes("{query}")) return command.label;
91
+ return command.label.replace(/\s*["'“”«»]?\{query\}["'“”«»]?/g, "").replace(/\s+(for|in|on|:)$/i, "").trim();
92
+ }
93
+ export {
94
+ commandHasPreview,
95
+ fallbackRows,
96
+ matchModePrefix,
97
+ modeChipLabel,
98
+ pushRecent,
99
+ readRecent,
100
+ recentVisible,
101
+ resolveRecentItems,
102
+ toRecentItem
103
+ };
@@ -11,3 +11,35 @@ export interface CommandSearchTerms {
11
11
  }
12
12
  export declare function parseCommandQuery(value: string): CommandSearchTerms;
13
13
  export declare function rankCommandItems<T extends SearchableCommand>(items: T[], terms: CommandSearchTerms): T[];
14
+ /**
15
+ * A query as a fetcher receives it. `text` is what a remote search should be
16
+ * sent: the positive words and phrases, in the case they were typed, without
17
+ * the operators a server would not understand. The operators come alongside
18
+ * as data, so a provider that can scope or exclude on the server may.
19
+ */
20
+ export interface PaletteQuery extends CommandSearchTerms {
21
+ /** The box as typed, operators and all. */
22
+ raw: string;
23
+ /** Positive terms joined by spaces, case kept, quotes dropped. */
24
+ text: string;
25
+ }
26
+ export declare function parsePaletteQuery(raw: string): PaletteQuery;
27
+ /**
28
+ * The operators applied to results someone else matched: a server answered
29
+ * the positive words, and `-word` and `in:group` still have to hold for what
30
+ * it sent back. Positive terms are not re-checked here; the server may match
31
+ * word forms the text does not contain.
32
+ */
33
+ export declare function applyQueryFilters<T extends SearchableCommand>(items: T[], terms: CommandSearchTerms): T[];
34
+ /** A run of text, and whether it matched the query. */
35
+ export interface HighlightPart {
36
+ text: string;
37
+ hit: boolean;
38
+ }
39
+ /**
40
+ * Text split around the terms that matched, for <mark> without v-html. Terms
41
+ * shorter than two characters are skipped (one letter would mark half the
42
+ * text), longer ones win where two start at the same place, and case is
43
+ * ignored. Pass positive terms only: an excluded word is never a match.
44
+ */
45
+ export declare function highlightParts(value: string, terms: readonly string[]): HighlightPart[];
@@ -47,7 +47,55 @@ function score(command, terms) {
47
47
  function rankCommandItems(items, terms) {
48
48
  return items.map((command) => ({ command, score: score(command, terms) })).filter((entry) => entry.score > 0).sort((a, b) => b.score - a.score || a.command.label.localeCompare(b.command.label)).map((entry) => entry.command);
49
49
  }
50
+ function parsePaletteQuery(raw) {
51
+ const terms = parseCommandQuery(raw);
52
+ const words = [];
53
+ QUERY_TOKEN.lastIndex = 0;
54
+ for (let match; match = QUERY_TOKEN.exec(raw); ) {
55
+ const text = (match[3] ?? match[4] ?? "").trim();
56
+ if (text && !match[1] && !match[2]) words.push(text);
57
+ }
58
+ return { ...terms, raw, text: words.join(" ") };
59
+ }
60
+ function applyQueryFilters(items, terms) {
61
+ if (!terms.exclude.length && !terms.groups.length) return items;
62
+ return items.filter((command) => {
63
+ const group = command.group?.toLowerCase() ?? "";
64
+ return !terms.exclude.some((term) => matches(command, term)) && terms.groups.every((term) => group.includes(term));
65
+ });
66
+ }
67
+ function highlightParts(value, terms) {
68
+ const sorted = [...new Set(terms.map((t) => t.toLowerCase()).filter((t) => t.length >= 2))].sort(
69
+ (a, b) => b.length - a.length
70
+ );
71
+ if (!value || sorted.length === 0) return value ? [{ text: value, hit: false }] : [];
72
+ const lower = value.toLowerCase();
73
+ const parts = [];
74
+ let i = 0;
75
+ while (i < value.length) {
76
+ let at = -1;
77
+ let term = "";
78
+ for (const t of sorted) {
79
+ const found = lower.indexOf(t, i);
80
+ if (found !== -1 && (at === -1 || found < at || found === at && t.length > term.length)) {
81
+ at = found;
82
+ term = t;
83
+ }
84
+ }
85
+ if (at === -1) {
86
+ parts.push({ text: value.slice(i), hit: false });
87
+ break;
88
+ }
89
+ if (at > i) parts.push({ text: value.slice(i, at), hit: false });
90
+ parts.push({ text: value.slice(at, at + term.length), hit: true });
91
+ i = at + term.length;
92
+ }
93
+ return parts;
94
+ }
50
95
  export {
96
+ applyQueryFilters,
97
+ highlightParts,
51
98
  parseCommandQuery,
99
+ parsePaletteQuery,
52
100
  rankCommandItems
53
101
  };
@@ -0,0 +1,2 @@
1
+ export declare function comboKeys(chord: string): string[];
2
+ export declare function comboSteps(combo: string): string[][];
@@ -0,0 +1,11 @@
1
+ function comboKeys(chord) {
2
+ return chord.split(/\+(?!$)/);
3
+ }
4
+ function comboSteps(combo) {
5
+ const trimmed = combo.trim();
6
+ return trimmed ? trimmed.split(/\s+/).map(comboKeys) : [];
7
+ }
8
+ export {
9
+ comboKeys,
10
+ comboSteps
11
+ };
@@ -0,0 +1,37 @@
1
+ /** The stretch of a clip that loops, and how long two passes overlap at the seam. */
2
+ export interface LoopPlan {
3
+ /** Where every pass starts, in seconds of media time. */
4
+ from: number;
5
+ /** Where every pass ends, in seconds of media time. */
6
+ to: number;
7
+ /** Media seconds over which the next pass fades in over the ending one; 0 cuts. */
8
+ fade: number;
9
+ }
10
+ /**
11
+ * The loop a backdrop plays, from what was asked and what the clip has.
12
+ *
13
+ * `start` and `end` are clamped into the clip and put in order; a stretch
14
+ * shorter than `minLength` is widened from its start (or, at the clip's end,
15
+ * backwards), since a loop of a few frames reads as a flicker. The overlap
16
+ * is at most half the stretch: a seam longer than that would have the next
17
+ * pass begin before the current one had shown anything of its own.
18
+ */
19
+ export declare function planLoop(duration: number, options?: {
20
+ start?: number;
21
+ end?: number;
22
+ crossfade?: number;
23
+ minLength?: number;
24
+ }): LoopPlan;
25
+ /** Whether the pass at `time` has reached the point where the next one must begin. */
26
+ export declare function seamReached(plan: LoopPlan, time: number): boolean;
27
+ /**
28
+ * How far the incoming pass is through the seam, 0 to 1, from its own media
29
+ * time: it starts at `from` and is fully in once it has played `fade` seconds.
30
+ * Measured on the media clock rather than the wall clock, so the fade keeps
31
+ * pace with a playback rate and holds still while playback stalls.
32
+ */
33
+ export declare function seamProgress(plan: LoopPlan, incomingTime: number): number;
34
+ /** Whether the whole clip loops with nothing cut and no overlap, which the media element does natively. */
35
+ export declare function isNativeLoop(plan: LoopPlan, duration: number): boolean;
36
+ /** "1:05", "0:07.5": a position on a clip as a range slider labels it. */
37
+ export declare function formatClipTime(seconds: number, precise?: boolean): string;
@@ -0,0 +1,40 @@
1
+ function planLoop(duration, options = {}) {
2
+ if (!Number.isFinite(duration) || duration <= 0) return { from: 0, to: 0, fade: 0 };
3
+ const clamp = (value) => Math.min(duration, Math.max(0, value));
4
+ let from = clamp(options.start ?? 0);
5
+ let to = clamp(options.end ?? duration);
6
+ if (to < from) [from, to] = [to, from];
7
+ const minLength = Math.min(duration, Math.max(0, options.minLength ?? 0.5));
8
+ if (to - from < minLength) {
9
+ to = Math.min(duration, from + minLength);
10
+ from = Math.max(0, to - minLength);
11
+ }
12
+ const fade = Math.min(Math.max(0, options.crossfade ?? 0), (to - from) / 2);
13
+ return { from, to, fade };
14
+ }
15
+ function seamReached(plan, time) {
16
+ return plan.to > plan.from && time >= plan.to - plan.fade;
17
+ }
18
+ function seamProgress(plan, incomingTime) {
19
+ if (plan.fade <= 0) return 1;
20
+ return Math.min(1, Math.max(0, (incomingTime - plan.from) / plan.fade));
21
+ }
22
+ function isNativeLoop(plan, duration) {
23
+ return plan.fade === 0 && plan.from === 0 && plan.to >= duration;
24
+ }
25
+ function formatClipTime(seconds, precise = false) {
26
+ const safe = Math.max(0, Number.isFinite(seconds) ? seconds : 0);
27
+ const minutes = Math.floor(safe / 60);
28
+ const rest = safe - minutes * 60;
29
+ const whole = Math.floor(rest);
30
+ const tenth = Math.floor((rest - whole) * 10);
31
+ const secs = String(whole).padStart(2, "0");
32
+ return precise && tenth ? `${minutes}:${secs}.${tenth}` : `${minutes}:${secs}`;
33
+ }
34
+ export {
35
+ formatClipTime,
36
+ isNativeLoop,
37
+ planLoop,
38
+ seamProgress,
39
+ seamReached
40
+ };
package/dist/index.d.ts CHANGED
@@ -35,9 +35,18 @@ export type { ColorPickerLabels } from "./components/LpColorPicker.vue";
35
35
  export { clampHsv, DEFAULT_SWATCHES, formatColor, hsvToHsl, hsvToRgb, isLight, normalizeHue, opaqueCss, parseColor, parseHex, rgbToHex, rgbToHsv, } from "./components/color";
36
36
  export type { ColorFormat, Hsv, Rgb } from "./components/color";
37
37
  export { default as LpCommandPalette } from "./components/LpCommandPalette.vue";
38
- export type { Command, PaletteLabels } from "./components/LpCommandPalette.vue";
39
- export { parseCommandQuery, rankCommandItems } from "./components/commandSearch";
40
- export type { CommandSearchTerms, SearchableCommand } from "./components/commandSearch";
38
+ export type { Command, CommandFetcher, CommandImage, PaletteLabels } from "./components/LpCommandPalette.vue";
39
+ export { applyQueryFilters, highlightParts, parseCommandQuery, parsePaletteQuery, rankCommandItems } from "./components/commandSearch";
40
+ export { commandHasPreview, pushRecent, readRecent, toRecentItem } from "./components/commandPalette";
41
+ export type { PaletteFact, PaletteStat, PreviewableCommand, RecentEntry, RecentItem } from "./components/commandPalette";
42
+ export { default as LpPalettePreview } from "./components/LpPalettePreview.vue";
43
+ export { default as LpPaletteHeader } from "./components/LpPaletteHeader.vue";
44
+ export { default as LpPaletteFacts } from "./components/LpPaletteFacts.vue";
45
+ export { default as LpPaletteStats } from "./components/LpPaletteStats.vue";
46
+ export { default as LpPaletteSwatches } from "./components/LpPaletteSwatches.vue";
47
+ export { default as LpKeys } from "./components/LpKeys.vue";
48
+ export { comboKeys, comboSteps } from "./components/keys";
49
+ export type { CommandSearchTerms, HighlightPart, PaletteQuery, SearchableCommand } from "./components/commandSearch";
41
50
  export { default as LpConfirmDialog } from "./components/LpConfirmDialog.vue";
42
51
  export type { ConfirmLabels } from "./components/LpConfirmDialog.vue";
43
52
  export { default as LpConfirmHost } from "./components/LpConfirmHost.vue";
@@ -121,6 +130,10 @@ export { default as LpSidebar } from "./components/LpSidebar.vue";
121
130
  export type { SidebarItem, SidebarSection } from "./components/LpSidebar.vue";
122
131
  export { default as LpSkeleton } from "./components/LpSkeleton.vue";
123
132
  export { default as LpSlider } from "./components/LpSlider.vue";
133
+ export { default as LpRangeSlider } from "./components/LpRangeSlider.vue";
134
+ export { default as LpVideoBackdrop } from "./components/LpVideoBackdrop.vue";
135
+ export { formatClipTime, isNativeLoop, planLoop, seamProgress, seamReached } from "./components/videoBackdrop";
136
+ export type { LoopPlan } from "./components/videoBackdrop";
124
137
  export { default as LpSparkline } from "./components/LpSparkline.vue";
125
138
  export { default as LpStat } from "./components/LpStat.vue";
126
139
  export { default as LpStepper } from "./components/LpStepper.vue";