strata-react 1.0.33 → 1.0.35
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/README.md +12 -2
- package/UPGRADING.md +1 -0
- package/dist/components/conversation.d.ts +67 -0
- package/dist/components/dialog.d.ts +1 -1
- package/dist/components/folder-picker.d.ts +42 -0
- package/dist/components/lightbox.d.ts +34 -0
- package/dist/components/markable-text.d.ts +56 -0
- package/dist/components/media-group.d.ts +25 -0
- package/dist/components/media-player.d.ts +80 -2
- package/dist/components/region-editor.d.ts +55 -0
- package/dist/components/sequence-timeline.d.ts +50 -0
- package/dist/components/transcript-view.d.ts +36 -0
- package/dist/components/tree.d.ts +41 -0
- package/dist/components/waveform.d.ts +66 -0
- package/dist/{cursor-DplHNzj3.js → cursor-DDGBPiTJ.js} +2 -200
- package/dist/cursor-DDGBPiTJ.js.map +1 -0
- package/dist/field-7Z4N5r5g.js +178 -0
- package/dist/field-7Z4N5r5g.js.map +1 -0
- package/dist/format-B32-PVi2.js +201 -0
- package/dist/format-B32-PVi2.js.map +1 -0
- package/dist/hls/index.d.ts +19 -0
- package/dist/hls.js +84 -0
- package/dist/hls.js.map +1 -0
- package/dist/index.d.ts +17 -1
- package/dist/index.js +3454 -568
- package/dist/index.js.map +1 -1
- package/dist/lib/marks.d.ts +6 -0
- package/dist/lib/region.d.ts +46 -0
- package/dist/lib/rich-text.d.ts +44 -0
- package/dist/lib/sequence.d.ts +34 -0
- package/dist/lib/transcript.d.ts +28 -0
- package/dist/lib/waveform.d.ts +36 -0
- package/dist/map.js +4 -2
- package/dist/map.js.map +1 -1
- package/dist/panorama/gl.d.ts +16 -0
- package/dist/panorama/index.d.ts +2 -0
- package/dist/panorama/panorama-viewer.d.ts +56 -0
- package/dist/panorama/projection.d.ts +45 -0
- package/dist/panorama.js +657 -0
- package/dist/panorama.js.map +1 -0
- package/dist/{query-DgJMyXTT.js → query-BJcxJLhh.js} +3 -2
- package/dist/{query-DgJMyXTT.js.map → query-BJcxJLhh.js.map} +1 -1
- package/dist/{run-BqZGKhW9.js → run-DzyLrZlA.js} +23 -5
- package/dist/run-DzyLrZlA.js.map +1 -0
- package/dist/testing.js +2 -2
- package/dist/{theme-BgTOESmN.js → theme-CFNi6WUO.js} +5 -175
- package/dist/theme-CFNi6WUO.js.map +1 -0
- package/dist/value-controls-D6O9TsM6.js +356 -0
- package/dist/value-controls-D6O9TsM6.js.map +1 -0
- package/dist/visual-cli.js +1 -1
- package/dist/visual.js +1 -1
- package/package.json +19 -4
- package/dist/cursor-DplHNzj3.js.map +0 -1
- package/dist/run-BqZGKhW9.js.map +0 -1
- package/dist/theme-BgTOESmN.js.map +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** The ids from `a` to `b` inclusive, in document order whichever way round they are given. Empty when either is not in `ids`. */
|
|
2
|
+
export declare function rangeBetween(ids: readonly string[], a: string | null, b: string | null): string[];
|
|
3
|
+
/** How many ids carry each mark key. Ids with no mark are not counted. */
|
|
4
|
+
export declare function countMarks(marks: Readonly<Record<string, string | undefined>>, ids?: readonly string[]): Record<string, number>;
|
|
5
|
+
/** The id `by` places from `from` in `ids`, held to the ends; the first (or last) when `from` is not set. */
|
|
6
|
+
export declare function stepId(ids: readonly string[], from: string | null, by: number): string | null;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** A rectangle in the picture's coordinates: top-left corner and size. */
|
|
2
|
+
export type Rect = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
w: number;
|
|
6
|
+
h: number;
|
|
7
|
+
};
|
|
8
|
+
/** Which edge or corner is held: compass points. */
|
|
9
|
+
export type Handle = "n" | "s" | "e" | "w" | "ne" | "nw" | "se" | "sw";
|
|
10
|
+
/** Limits on a rectangle. `aspect` is width over height; `min` is the smallest size; `bounds` is where it may be. */
|
|
11
|
+
export type RectLimits = {
|
|
12
|
+
bounds: Rect;
|
|
13
|
+
min?: {
|
|
14
|
+
w: number;
|
|
15
|
+
h: number;
|
|
16
|
+
};
|
|
17
|
+
aspect?: number;
|
|
18
|
+
};
|
|
19
|
+
export declare const HANDLES: readonly Handle[];
|
|
20
|
+
/** Moves a rectangle by (dx, dy), stopping at the bounds (it keeps its size). */
|
|
21
|
+
export declare function moveRect(r: Rect, dx: number, dy: number, bounds: Rect): Rect;
|
|
22
|
+
/** Puts a rectangle inside the bounds and at least `min` size, keeping its aspect if one is set (shrinking it to fit). */
|
|
23
|
+
export declare function fitRect(r: Rect, { bounds, min, aspect }: RectLimits): Rect;
|
|
24
|
+
/**
|
|
25
|
+
* Drags `handle` of `r` by (dx, dy). The opposite edge or corner stays where it is. Without an
|
|
26
|
+
* aspect each edge stops at the bounds and at `min` from the edge opposite; with one the rectangle
|
|
27
|
+
* keeps its shape: a corner follows the larger of the two movements, an edge changes its own
|
|
28
|
+
* dimension and the other grows or shrinks about the middle. The result is always inside the bounds.
|
|
29
|
+
*/
|
|
30
|
+
export declare function resizeRect(r: Rect, handle: Handle, dx: number, dy: number, { bounds, min, aspect }: RectLimits): Rect;
|
|
31
|
+
/** A rectangle drawn by dragging from one corner point to another, ordered and fitted to the limits. */
|
|
32
|
+
export declare function drawRect(start: {
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
}, b: {
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
}, limits: RectLimits): Rect;
|
|
39
|
+
/** How a move between two rectangles is eased. */
|
|
40
|
+
export type Easing = "linear" | "ease-in-out";
|
|
41
|
+
/** The eased share of the way at time `t` (0 to 1). */
|
|
42
|
+
export declare function ease(t: number, easing?: Easing): number;
|
|
43
|
+
/** The rectangle part-way from `a` to `b` at time `t` (0 to 1), eased. Corner and size move together. */
|
|
44
|
+
export declare function lerpRect(a: Rect, b: Rect, t: number, easing?: Easing): Rect;
|
|
45
|
+
/** True when two rectangles are the same to the unit's thousandth. */
|
|
46
|
+
export declare const sameRect: (a: Rect, b: Rect) => boolean;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/** One id found in a text: `[start, end)` into the text and the id to open. */
|
|
2
|
+
export type EntityMatch = {
|
|
3
|
+
start: number;
|
|
4
|
+
end: number;
|
|
5
|
+
id: string;
|
|
6
|
+
};
|
|
7
|
+
/** A way to find entities in a run of text: a list of known ids, or a function that reports matches. */
|
|
8
|
+
export type EntityMatcher = readonly string[] | ((text: string) => readonly EntityMatch[]);
|
|
9
|
+
export type Inline = {
|
|
10
|
+
type: "text";
|
|
11
|
+
text: string;
|
|
12
|
+
} | {
|
|
13
|
+
type: "bold";
|
|
14
|
+
children: Inline[];
|
|
15
|
+
} | {
|
|
16
|
+
type: "code";
|
|
17
|
+
text: string;
|
|
18
|
+
} | {
|
|
19
|
+
type: "link";
|
|
20
|
+
href: string;
|
|
21
|
+
children: Inline[];
|
|
22
|
+
} | {
|
|
23
|
+
type: "entity";
|
|
24
|
+
id: string;
|
|
25
|
+
text: string;
|
|
26
|
+
};
|
|
27
|
+
export type Block = {
|
|
28
|
+
type: "paragraph";
|
|
29
|
+
children: Inline[];
|
|
30
|
+
} | {
|
|
31
|
+
type: "list";
|
|
32
|
+
ordered: boolean;
|
|
33
|
+
items: Inline[][];
|
|
34
|
+
};
|
|
35
|
+
/** Finds ids in `text`, longest first, never inside a longer word. Overlaps go to the earlier, longer match. */
|
|
36
|
+
export declare function matchEntities(text: string, matcher: EntityMatcher | undefined): EntityMatch[];
|
|
37
|
+
/** A link is safe when its scheme is http, https or mailto. */
|
|
38
|
+
export declare function safeHref(href: string): string | null;
|
|
39
|
+
/** Parses one line's inline marks. Unclosed marks stay as the text they were typed as. */
|
|
40
|
+
export declare function parseInline(text: string, matcher?: EntityMatcher): Inline[];
|
|
41
|
+
/** Parses blocks: blank-line separated paragraphs, and runs of `- ` or `1. ` lines as lists. */
|
|
42
|
+
export declare function parseRichText(text: string, matcher?: EntityMatcher): Block[];
|
|
43
|
+
/** The plain words of a text with the marks removed: what a live region announces. */
|
|
44
|
+
export declare function plainText(text: string): string;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** A grid: a step in seconds (a beat every 0.5 s from 0) or the exact times of the beats. */
|
|
2
|
+
export type Grid = number | readonly number[];
|
|
3
|
+
/** The grid point nearest to `time`, or `time` itself when there is no grid. */
|
|
4
|
+
export declare function snapToGrid(time: number, grid: Grid | undefined): number;
|
|
5
|
+
/** The next grid point after `time` in a direction (`1` later, `-1` earlier); `fallback` is the step when there is no grid. A point `time` is already on is stepped past. */
|
|
6
|
+
export declare function stepOnGrid(time: number, dir: 1 | -1, grid: Grid | undefined, fallback: number): number;
|
|
7
|
+
/** Grid points inside `[from, to]`, for drawing on a ruler. At most `limit`, so a fine grid on a long axis stays cheap. */
|
|
8
|
+
export declare function gridPoints(grid: Grid | undefined, from: number, to: number, limit?: number): number[];
|
|
9
|
+
/** What limited a cut: which side, and the reason the app gave. */
|
|
10
|
+
export type CutLimit = {
|
|
11
|
+
side: "min" | "max";
|
|
12
|
+
at: number;
|
|
13
|
+
reason?: string;
|
|
14
|
+
};
|
|
15
|
+
/** Puts `time` inside the room, and says which end held it (with the app's reason) when one did. */
|
|
16
|
+
export declare function clampToRoom(time: number, room: {
|
|
17
|
+
min: number;
|
|
18
|
+
max: number;
|
|
19
|
+
minReason?: string;
|
|
20
|
+
maxReason?: string;
|
|
21
|
+
}): {
|
|
22
|
+
time: number;
|
|
23
|
+
limit: CutLimit | null;
|
|
24
|
+
};
|
|
25
|
+
/** Where a dragged cut lands: held by the room (saying which end, if the pointer is beyond it), otherwise snapped to the grid, and never to a grid point outside the room. */
|
|
26
|
+
export declare function settleCut(wanted: number, grid: Grid | undefined, room: {
|
|
27
|
+
min: number;
|
|
28
|
+
max: number;
|
|
29
|
+
minReason?: string;
|
|
30
|
+
maxReason?: string;
|
|
31
|
+
}): {
|
|
32
|
+
time: number;
|
|
33
|
+
limit: CutLimit | null;
|
|
34
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** One word, with when it starts and ends (seconds). */
|
|
2
|
+
export type TranscriptWord = {
|
|
3
|
+
text: string;
|
|
4
|
+
start: number;
|
|
5
|
+
end: number;
|
|
6
|
+
};
|
|
7
|
+
/** A phrase: timed words, who said it, and its other texts (a translation) by mode. */
|
|
8
|
+
export type TranscriptPhrase = {
|
|
9
|
+
id: string;
|
|
10
|
+
start: number;
|
|
11
|
+
end: number;
|
|
12
|
+
words: readonly TranscriptWord[];
|
|
13
|
+
speaker?: string;
|
|
14
|
+
/** Other texts for the phrase by mode name: `{ translated: "…" }`. */
|
|
15
|
+
alt?: Readonly<Record<string, string>>;
|
|
16
|
+
};
|
|
17
|
+
/** Phrases that belong together (a clip), with a heading. */
|
|
18
|
+
export type TranscriptGroup = {
|
|
19
|
+
id: string;
|
|
20
|
+
title: string; /** Defaults to the first phrase's start. */
|
|
21
|
+
start?: number; /** Defaults to the last phrase's end. */
|
|
22
|
+
end?: number;
|
|
23
|
+
phrases: readonly TranscriptPhrase[];
|
|
24
|
+
};
|
|
25
|
+
/** The phrase being heard at `time`, as an index into `phrases` (sorted by start), or -1. A phrase is heard from its `start` up to, not including, its `end`. */
|
|
26
|
+
export declare function phraseAt(phrases: readonly Pick<TranscriptPhrase, "start" | "end">[], time: number): number;
|
|
27
|
+
/** The word being heard within a phrase at `time`: the last word that has started, until the phrase ends. -1 before the first word. */
|
|
28
|
+
export declare function wordAt(phrase: Pick<TranscriptPhrase, "words" | "end">, time: number): number;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** Peaks as an app has them: a magnitude per slice (0 to 1), or the lowest and highest sample per slice (-1 to 1). */
|
|
2
|
+
export type WaveformPeaks = ArrayLike<number> | {
|
|
3
|
+
min: ArrayLike<number>;
|
|
4
|
+
max: ArrayLike<number>;
|
|
5
|
+
};
|
|
6
|
+
/** Peaks as the lowest and highest sample of each slice. */
|
|
7
|
+
export type PeakPair = {
|
|
8
|
+
min: Float32Array;
|
|
9
|
+
max: Float32Array;
|
|
10
|
+
};
|
|
11
|
+
/** Makes the lowest and highest sample of each slice from either form. A magnitude `m` is the pair `-m` to `m`. */
|
|
12
|
+
export declare function toPeakPair(peaks: WaveformPeaks): PeakPair;
|
|
13
|
+
/** The lowest and highest of `pair` over the fraction `from` to `to` of its length (0 to 1). A slice narrower than one entry takes the entry it falls in, so zooming past the data never leaves a gap. */
|
|
14
|
+
export declare function peaksBetween(pair: PeakPair, from: number, to: number): [number, number];
|
|
15
|
+
/** Resamples peaks to `buckets` entries: each is the lowest and highest of the entries it covers. Any length in, any length out. */
|
|
16
|
+
export declare function resamplePeaks(peaks: WaveformPeaks, buckets: number): PeakPair;
|
|
17
|
+
/** What a decoded file looks like to this code: the shape of the browser's `AudioBuffer`. */
|
|
18
|
+
export type DecodedAudio = {
|
|
19
|
+
duration: number;
|
|
20
|
+
numberOfChannels: number;
|
|
21
|
+
length: number;
|
|
22
|
+
getChannelData: (channel: number) => ArrayLike<number>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Reduces decoded audio to `buckets` peaks over all channels, in chunks, calling `progress` with
|
|
26
|
+
* the buckets done and awaiting between chunks so the page stays responsive and `signal` can stop it.
|
|
27
|
+
*/
|
|
28
|
+
export declare function peaksFromAudio(audio: DecodedAudio, buckets: number, options?: {
|
|
29
|
+
signal?: AbortSignal;
|
|
30
|
+
progress?: (done: number, total: number) => void;
|
|
31
|
+
chunk?: number;
|
|
32
|
+
}): Promise<PeakPair>;
|
|
33
|
+
/** The time at the pointer, given the visible range and the width. */
|
|
34
|
+
export declare const timeAt: (px: number, width: number, from: number, to: number) => number;
|
|
35
|
+
/** Keeps a visible range of `span` seconds inside `0` to `duration`. */
|
|
36
|
+
export declare function clampView(from: number, span: number, duration: number): [number, number];
|
package/dist/map.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { a as useColorScheme, c as Tooltip$1 } from "./theme-CFNi6WUO.js";
|
|
2
|
+
import { c as cn } from "./field-7Z4N5r5g.js";
|
|
3
|
+
import { i as format } from "./format-B32-PVi2.js";
|
|
4
|
+
import { n as useSharedCursor, r as geo } from "./cursor-DDGBPiTJ.js";
|
|
3
5
|
import * as React from "react";
|
|
4
6
|
import { Button } from "react-aria-components";
|
|
5
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|