@aperture-browser/session-react 0.0.0-nightly.153.6c19cc53471e → 0.0.0-nightly.155.c6f3ca7db4db
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/headless.d.ts +5 -2
- package/dist/headless.js +21 -5
- package/dist/headless.js.map +1 -1
- package/dist/index.d.ts +22 -7
- package/dist/index.js +228 -67
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/headless.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from "react";
|
|
2
|
-
import { ConnectOptions, HeldTab, Member, Recording, Role, Screenshot, Session, SessionError, Snapshot, StartRecording, Target, Uploaded, connect } from "@aperture-browser/session-client";
|
|
2
|
+
import { ConnectOptions, EditRecording, HeldTab, Member, Recording, Role, Screenshot, Session, SessionError, Snapshot, StartRecording, Target, Uploaded, connect } from "@aperture-browser/session-client";
|
|
3
3
|
export type * from "@aperture-browser/session-client";
|
|
4
4
|
|
|
5
5
|
//#region \0rolldown/runtime.js
|
|
@@ -84,7 +84,10 @@ interface RecordingsControl {
|
|
|
84
84
|
readonly refresh: () => void;
|
|
85
85
|
/** Rejects with what the session answered. */
|
|
86
86
|
readonly start: (options?: StartRecording) => Promise<Recording>;
|
|
87
|
-
|
|
87
|
+
/** Stops a recording; its edit is made with `options`. */
|
|
88
|
+
readonly stop: (id: string, options?: EditRecording) => Promise<Recording>;
|
|
89
|
+
/** Makes the edit of a stopped recording again, with other options. */
|
|
90
|
+
readonly edit: (id: string, options?: EditRecording) => Promise<Recording>;
|
|
88
91
|
/** Takes a screenshot of a target and keeps it in the session's files. */
|
|
89
92
|
readonly takeScreenshot: (tab: number) => Promise<Screenshot>;
|
|
90
93
|
}
|
package/dist/headless.js
CHANGED
|
@@ -495,15 +495,22 @@ function useRecordings(enabled = true) {
|
|
|
495
495
|
refresh();
|
|
496
496
|
}
|
|
497
497
|
}, [session, refresh]),
|
|
498
|
-
stop: useCallback(async (id) => {
|
|
498
|
+
stop: useCallback(async (id, options) => {
|
|
499
499
|
setBusy(true);
|
|
500
500
|
try {
|
|
501
|
-
return await session.recordings.stop(id);
|
|
501
|
+
return await session.recordings.stop(id, options);
|
|
502
502
|
} finally {
|
|
503
503
|
setBusy(false);
|
|
504
504
|
refresh();
|
|
505
505
|
}
|
|
506
506
|
}, [session, refresh]),
|
|
507
|
+
edit: useCallback(async (id, options) => {
|
|
508
|
+
try {
|
|
509
|
+
return await session.recordings.edit(id, options);
|
|
510
|
+
} finally {
|
|
511
|
+
refresh();
|
|
512
|
+
}
|
|
513
|
+
}, [session, refresh]),
|
|
507
514
|
takeScreenshot: useCallback(async (tab) => {
|
|
508
515
|
try {
|
|
509
516
|
return await session.screenshots.take(tab);
|
|
@@ -597,19 +604,28 @@ const isTimeline = (value) => {
|
|
|
597
604
|
function useRecordingTimeline(recording) {
|
|
598
605
|
const session = useSession();
|
|
599
606
|
const file = recording?.edit?.timeline ?? void 0;
|
|
607
|
+
const made = recording?.edit?.made_at_ms ?? 0;
|
|
600
608
|
const [read, setRead] = useState();
|
|
601
609
|
useEffect(() => {
|
|
602
610
|
if (file === void 0) return;
|
|
603
611
|
const asking = new AbortController();
|
|
604
|
-
fetch(session.fileUrl(file), {
|
|
612
|
+
fetch(session.fileUrl(file), {
|
|
613
|
+
signal: asking.signal,
|
|
614
|
+
cache: "no-store"
|
|
615
|
+
}).then((answer) => answer.ok ? answer.json() : void 0).then((timeline) => {
|
|
605
616
|
if (isTimeline(timeline)) setRead({
|
|
606
617
|
file,
|
|
618
|
+
made,
|
|
607
619
|
timeline
|
|
608
620
|
});
|
|
609
621
|
}, () => {});
|
|
610
622
|
return () => asking.abort();
|
|
611
|
-
}, [
|
|
612
|
-
|
|
623
|
+
}, [
|
|
624
|
+
session,
|
|
625
|
+
file,
|
|
626
|
+
made
|
|
627
|
+
]);
|
|
628
|
+
return read?.file === file && read?.made === made ? read?.timeline : void 0;
|
|
613
629
|
}
|
|
614
630
|
//#endregion
|
|
615
631
|
export { SessionError, SessionProvider, SessionViewport, addressOf, connect, keptOf, pictureBox, recordingIsEdited, recordingRuns, useAddress, useConnectedSession, useInputState, useLease, useReconnect, useRecordingTimeline, useRecordings, useRememberedFit, useSession, useSessionSnapshot, useStored, useTabSound, useUploads, useWatchedTarget };
|
package/dist/headless.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headless.js","names":["connect"],"sources":["../src/session.tsx","../src/components/session-viewport.tsx","../src/hooks/use-actions.ts","../src/hooks/use-address.ts","../src/hooks/use-stored.ts","../src/hooks/use-fit.ts","../src/hooks/use-recordings.ts","../src/hooks/use-uploads.ts","../src/hooks/use-timeline.ts"],"sourcesContent":["import {\n createContext,\n useContext,\n useEffect,\n useMemo,\n useState,\n useSyncExternalStore,\n type ReactNode,\n} from \"react\";\nimport {\n connect,\n type ConnectOptions,\n type HeldTab,\n type Member,\n type Role,\n type Session,\n type Snapshot,\n type Target,\n} from \"@aperture-browser/session-client\";\n\nexport interface SessionConnection {\n /** None until the page has mounted, and none between two connections. */\n readonly session: Session | null;\n /** Ends the connection there is and makes a new one: a closed connection does not come back. */\n readonly reconnect: () => void;\n}\n\n/**\n * Connects to a session for as long as the component is mounted. Another address, name or\n * first way of the picture makes another connection.\n */\nexport function useConnectedSession({\n url,\n token,\n name,\n pixels,\n}: ConnectOptions): SessionConnection {\n const [session, setSession] = useState<Session | null>(null);\n const [attempt, setAttempt] = useState(0);\n\n useEffect(() => {\n const connected = connect({ url, token, name, pixels });\n setSession(connected);\n return () => {\n setSession(null);\n connected.close();\n };\n }, [url, token, name, pixels, attempt]);\n\n return useMemo(\n () => ({\n session,\n reconnect: () => setAttempt((current) => current + 1),\n }),\n [session],\n );\n}\n\ninterface SessionContextValue {\n readonly session: Session;\n readonly reconnect: (() => void) | undefined;\n}\n\nconst SessionContext = createContext<SessionContextValue | null>(null);\n\nexport interface SessionProviderProps {\n readonly session: Session;\n /** Offered where the connection is closed, when there is a way to make another. */\n readonly reconnect?: (() => void) | undefined;\n readonly children?: ReactNode;\n}\n\nexport function SessionProvider({ session, reconnect, children }: SessionProviderProps) {\n const value = useMemo(() => ({ session, reconnect }), [session, reconnect]);\n return <SessionContext.Provider value={value}>{children}</SessionContext.Provider>;\n}\n\nfunction useSessionContext(): SessionContextValue {\n const value = useContext(SessionContext);\n if (value === null) {\n throw new Error(\"The session's components are used outside a SessionProvider\");\n }\n return value;\n}\n\nexport function useSession(): Session {\n return useSessionContext().session;\n}\n\nexport function useReconnect(): (() => void) | undefined {\n return useSessionContext().reconnect;\n}\n\nexport function useSessionSnapshot(): Snapshot {\n const session = useSession();\n return useSyncExternalStore(session.subscribe, session.getSnapshot, session.getSnapshot);\n}\n\n/** The target that is watched. */\nexport function useWatchedTarget(): Target | undefined {\n const snapshot = useSessionSnapshot();\n return snapshot.targets.find((target) => target.tab === snapshot.selected);\n}\n\nexport type LeaseState =\n /** The role lets this member watch only. */\n | \"view-only\"\n /** Nobody holds the watched tab: whoever gives it input holds it. */\n | \"free\"\n | \"yours\"\n /** This member holds the tab and another asks for it. */\n | \"asked-of-you\"\n | \"theirs\"\n /** Another holds the tab and this member has asked for it. */\n | \"you-asked\"\n /** Another holds the tab and a third member has asked for it. */\n | \"theirs-asked\";\n\nexport interface Lease {\n readonly state: LeaseState;\n /** The member this client is, once the session told. */\n readonly you: Member | undefined;\n readonly role: Role | undefined;\n /** Whether this member's role lets it give input and change the session's tabs. */\n readonly givesInput: boolean;\n readonly held: HeldTab | undefined;\n readonly holder: Member | undefined;\n readonly asker: Member | undefined;\n}\n\n/** Who holds the lease of the watched tab, and what this member may do about it. */\nexport function useLease(): Lease {\n const snapshot = useSessionSnapshot();\n const { presence } = snapshot;\n const watched = snapshot.targets.find((target) => target.tab === snapshot.selected);\n const you = presence?.members.find((member) => member.id === presence.you);\n const held = presence?.held.find((one) => one.tab === watched?.tab);\n const holder = presence?.members.find((member) => member.id === held?.holder);\n const asker = presence?.members.find((member) => member.id === held?.askedBy);\n const role = you?.role;\n // A member whose role the session has not told yet is not held back: the session refuses\n // what the role does not allow.\n const givesInput = role !== \"view\";\n\n let state: LeaseState = \"free\";\n if (!givesInput) {\n state = \"view-only\";\n } else if (held === undefined || presence === undefined) {\n state = \"free\";\n } else if (held.holder === presence.you) {\n state = held.askedBy === undefined ? \"yours\" : \"asked-of-you\";\n } else if (held.askedBy === presence.you) {\n state = \"you-asked\";\n } else {\n state = held.askedBy === undefined ? \"theirs\" : \"theirs-asked\";\n }\n\n return { state, you, role, givesInput, held, holder, asker };\n}\n","import { useEffect, useRef, useState, type CSSProperties, type ReactNode } from \"react\";\nimport { useSession, useSessionSnapshot } from \"../session.tsx\";\n\nexport interface SessionViewportProps {\n readonly className?: string | undefined;\n readonly style?: CSSProperties | undefined;\n /** Laid over the picture, such as the connection's state. */\n readonly children?: ReactNode;\n}\n\nconst PICTURE_WITHIN_MS = 1000;\n/** How long after the room for the picture last changed it counts as still changing. */\nconst RESIZED_AFTER_MS = 200;\nconst SETTLING_BLUR_PX = 6;\nconst SETTLING_FADE_MS = 160;\n\ninterface Size {\n readonly width: number;\n readonly height: number;\n}\n\n/**\n * The watched target's picture, and its input: the pointer, the wheel, the keyboard, the\n * clipboard and what is dropped on it. The picture is shown at the target's own size, and\n * smaller where the stage has no room for that.\n */\nexport function SessionViewport({ className, style, children }: SessionViewportProps) {\n const session = useSession();\n const snapshot = useSessionSnapshot();\n const stageRef = useRef<HTMLDivElement>(null);\n const videoRef = useRef<HTMLVideoElement>(null);\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const keysRef = useRef<HTMLTextAreaElement>(null);\n const [stage, setStage] = useState<Size>({ width: 0, height: 0 });\n /** The size of the picture that is drawn now, in its own pixels. */\n const [drawn, setDrawn] = useState<Size>({ width: 0, height: 0 });\n /** Whether the room for the picture is being changed, as by dragging the window's edge. */\n const [resizing, setResizing] = useState(false);\n const way = snapshot.picture.way;\n\n useEffect(() => {\n const surfaces = {\n video: videoRef.current,\n canvas: canvasRef.current,\n keys: keysRef.current,\n stage: stageRef.current,\n };\n if (\n surfaces.video === null ||\n surfaces.canvas === null ||\n surfaces.keys === null ||\n surfaces.stage === null\n ) {\n return undefined;\n }\n return session.attach({\n video: surfaces.video,\n canvas: surfaces.canvas,\n keys: surfaces.keys,\n stage: surfaces.stage,\n });\n }, [session]);\n\n useEffect(() => {\n const element = stageRef.current;\n if (element === null) {\n return undefined;\n }\n let settling: ReturnType<typeof setTimeout> | undefined;\n const measure = () => {\n const next = { width: element.clientWidth, height: element.clientHeight };\n setStage((before) => {\n // The first measure is no change of size, and neither is one that measures the same.\n if (before.width > 0 && (before.width !== next.width || before.height !== next.height)) {\n setResizing(true);\n clearTimeout(settling);\n settling = setTimeout(() => setResizing(false), RESIZED_AFTER_MS);\n }\n return next;\n });\n };\n measure();\n const sizes = new ResizeObserver(measure);\n sizes.observe(element);\n return () => {\n sizes.disconnect();\n clearTimeout(settling);\n };\n }, []);\n\n useEffect(() => {\n const video = videoRef.current;\n const canvas = canvasRef.current;\n if (video === null || canvas === null) {\n return undefined;\n }\n const measure = () => {\n const size =\n way === \"video\"\n ? { width: video.videoWidth, height: video.videoHeight }\n : { width: canvas.width, height: canvas.height };\n setDrawn((before) =>\n before.width === size.width && before.height === size.height ? before : size,\n );\n };\n measure();\n video.addEventListener(\"resize\", measure);\n video.addEventListener(\"loadedmetadata\", measure);\n // A canvas says nothing when what is drawn into it changes its size.\n const sizes = new MutationObserver(measure);\n sizes.observe(canvas, { attributes: true, attributeFilter: [\"width\", \"height\"] });\n return () => {\n video.removeEventListener(\"resize\", measure);\n video.removeEventListener(\"loadedmetadata\", measure);\n sizes.disconnect();\n };\n }, [way]);\n\n const watched = snapshot.targets.find((target) => target.tab === snapshot.selected);\n const shown = watched === undefined ? undefined : way;\n // The picture of another tab, or of this one at another size, comes a moment after the\n // session says which tab is watched and how large it is. Until what is drawn has the\n // shape of what is watched, the picture has the place of what is drawn: a window that\n // is dragged larger is some sizes ahead of its picture all the while, and a place kept\n // from before the drag would hold each picture that comes to the shape of the first.\n const agrees = watched !== undefined && drawn.width > 0 && sameShape(drawn, watched);\n /** The picture's pixels to a logical pixel of its target, when the two last agreed. */\n const density = useRef(1);\n if (agrees) {\n density.current = drawn.width / watched.width;\n }\n const awaited =\n watched !== undefined && drawn.width > 0 && !agrees\n ? `${watched.id} ${watched.width}x${watched.height}`\n : undefined;\n // A picture that does not come is not waited for longer than this.\n const [overdue, setOverdue] = useState<string | undefined>(undefined);\n useEffect(() => {\n if (awaited === undefined) {\n return undefined;\n }\n const waiting = setTimeout(() => setOverdue(awaited), PICTURE_WITHIN_MS);\n return () => clearTimeout(waiting);\n }, [awaited]);\n const settled = awaited === undefined || awaited === overdue;\n const box =\n watched === undefined\n ? undefined\n : pictureBox(\n stage,\n settled\n ? watched\n : {\n width: drawn.width / density.current,\n height: drawn.height / density.current,\n },\n );\n\n const picture = (visible: boolean): CSSProperties => ({\n display: visible ? \"block\" : \"none\",\n flex: \"none\",\n width: box?.width,\n height: box?.height,\n outline: \"none\",\n // A touch that drags is the session's pointer, not a scroll of this page.\n touchAction: \"none\",\n cursor: snapshot.cursor,\n // While its room changes and until the picture of the new size is there, what is\n // drawn is stretched or stale: softened, it reads as settling and not as broken.\n filter: resizing || !settled ? `blur(${SETTLING_BLUR_PX}px)` : \"none\",\n transition: `filter ${SETTLING_FADE_MS}ms ease-out`,\n });\n\n return (\n <div\n ref={stageRef}\n className={className}\n data-aperture-stage=\"\"\n // For whatever stands in for the picture until there is one.\n data-aperture-drawn={drawn.width > 0 ? \"\" : undefined}\n style={{\n position: \"relative\",\n display: \"flex\",\n flex: \"1 1 0%\",\n minWidth: 0,\n minHeight: 0,\n alignItems: \"center\",\n justifyContent: \"center\",\n overflow: \"hidden\",\n ...style,\n }}\n >\n <video\n ref={videoRef}\n data-aperture-surface=\"video\"\n tabIndex={-1}\n autoPlay\n muted\n playsInline\n style={picture(shown === \"video\")}\n />\n <canvas\n ref={canvasRef}\n data-aperture-surface=\"canvas\"\n tabIndex={-1}\n style={picture(shown === \"frames\" || shown === \"tiles\")}\n />\n <textarea\n ref={keysRef}\n data-aperture-surface=\"keys\"\n aria-label=\"Keyboard of the session\"\n autoCapitalize=\"off\"\n autoComplete=\"off\"\n autoCorrect=\"off\"\n spellCheck={false}\n style={{\n position: \"absolute\",\n left: 0,\n bottom: 0,\n width: 1,\n height: 1,\n padding: 0,\n border: 0,\n opacity: 0,\n resize: \"none\",\n // A phone zooms into a field whose text is smaller than this.\n fontSize: 16,\n }}\n />\n {children}\n </div>\n );\n}\n\n/** Whether two sizes have the same proportions, give or take a pixel's rounding. */\nfunction sameShape(one: Size, other: Size): boolean {\n if (one.height <= 0 || other.height <= 0) {\n return false;\n }\n const ratio = (one.width / one.height) * (other.height / other.width);\n return Math.abs(ratio - 1) < 0.01;\n}\n\n/** The place the picture of a target has in a stage: its own size, or smaller to fit. */\nexport function pictureBox(stage: Size, target: Size): Size {\n if (target.width <= 0 || target.height <= 0) {\n return { width: 0, height: 0 };\n }\n const scale = Math.min(1, stage.width / target.width, stage.height / target.height);\n return {\n width: Math.floor(target.width * scale),\n height: Math.floor(target.height * scale),\n };\n}\n","import { useCallback } from \"react\";\nimport type { Target } from \"@aperture-browser/session-client\";\nimport { useLease, useSession, useSessionSnapshot } from \"../session.tsx\";\n\nexport interface TabSound {\n /** The tab plays something now. */\n readonly sounds: boolean;\n /** The tab is muted for this client. */\n readonly muted: boolean;\n readonly toggle: () => void;\n}\n\n/** A tab's sound, as this client hears it. */\nexport function useTabSound(target: Target | undefined): TabSound {\n const session = useSession();\n const muted = useSessionSnapshot().muted.includes(target?.tab ?? -1);\n const tab = target?.tab;\n const toggle = useCallback(() => {\n if (tab !== undefined) {\n session.setMuted(tab, !muted);\n }\n }, [session, tab, muted]);\n return { sounds: target?.sounds ?? false, muted, toggle };\n}\n\nexport interface InputState {\n readonly open: boolean;\n /** This member may open, close and take tabs elsewhere, and give them another size. */\n readonly changes: boolean;\n /** This member may give the watched tab input. */\n readonly gives: boolean;\n}\n\n/** What this member may do in the session now. */\nexport function useInputState(): InputState {\n const snapshot = useSessionSnapshot();\n const lease = useLease();\n const open = snapshot.connection.state === \"open\";\n return {\n open,\n changes: open && snapshot.features.tabs.write,\n gives: open && lease.givesInput && snapshot.selected !== undefined,\n };\n}\n","import { useState } from \"react\";\nimport { useSession, useSessionSnapshot } from \"../session.tsx\";\n\nexport interface AddressControl {\n /** What the address field shows: what is typed, or the watched tab's address. */\n readonly value: string;\n /** Whether this member may take the watched tab elsewhere. */\n readonly navigates: boolean;\n readonly type: (value: string) => void;\n /** Lets go of what was typed and not sent. */\n readonly reset: () => void;\n /** Takes the watched tab to what was typed; false when that is nothing. */\n readonly submit: (value: string) => boolean;\n}\n\n/** The watched tab's address, as a field to type another into. */\nexport function useAddress(): AddressControl {\n const session = useSession();\n const snapshot = useSessionSnapshot();\n const watched = snapshot.targets.find((target) => target.tab === snapshot.selected);\n const [draft, setDraft] = useState<{ tab: number | undefined; url: string } | null>(null);\n // What was typed and not sent belongs to the tab it was typed for.\n const typed = draft !== null && draft.tab === watched?.tab ? draft.url : null;\n\n return {\n value: typed ?? watched?.url ?? \"\",\n navigates:\n snapshot.connection.state === \"open\" && snapshot.features.tabs.write && watched !== undefined,\n type: (url) => setDraft({ tab: watched?.tab, url }),\n reset: () => setDraft(null),\n submit: (value) => {\n const url = value.trim();\n if (url === \"\") {\n return false;\n }\n session.go({ url: addressOf(url) });\n setDraft(null);\n return true;\n },\n };\n}\n\n/** What is typed into an address field as a URL: an address as it is, anything else a search. */\nexport function addressOf(value: string): string {\n if (isLocalHost(value)) {\n return `http://${value}`;\n }\n if (\n /^[a-z][a-z0-9+.-]*:\\/\\//iu.test(value) ||\n /^(?:about|chrome|devtools|data|file|view-source):/iu.test(value)\n ) {\n return value;\n }\n if (isLikelyHost(value)) {\n return `https://${value}`;\n }\n return `https://www.google.com/search?q=${encodeURIComponent(value)}`;\n}\n\nfunction isLocalHost(value: string): boolean {\n return (\n /^localhost(?::\\d+)?(?:[/?#].*)?$/iu.test(value) ||\n /^127(?:\\.\\d{1,3}){3}(?::\\d+)?(?:[/?#].*)?$/u.test(value) ||\n /^[a-z0-9-]+:\\d+(?:[/?#].*)?$/iu.test(value)\n );\n}\n\nfunction isLikelyHost(value: string): boolean {\n return !/\\s/u.test(value) && /^[a-z0-9-]+(?:\\.[a-z0-9-]+)+(?:[/:?#].*)?$/iu.test(value);\n}\n","import { useCallback, useSyncExternalStore } from \"react\";\n\n/** What each key holds now, as it was read or last set, for all who use the key. */\nconst values = new Map<string, unknown>();\nconst listeners = new Map<string, Set<() => void>>();\n\nfunction read(key: string): unknown {\n if (!values.has(key)) {\n let stored: unknown;\n try {\n const text = window.localStorage.getItem(key);\n stored = text === null ? undefined : JSON.parse(text);\n } catch {\n // Storage that is unavailable gives the default.\n stored = undefined;\n }\n values.set(key, stored);\n }\n return values.get(key);\n}\n\n/**\n * A choice this browser remembers, the same for everything on the page that uses the key.\n * It lasts for the page where storage is unavailable.\n */\nexport function useStored<Value>(\n key: string,\n fallback: Value,\n valid: (value: unknown) => value is Value,\n): readonly [Value, (value: Value) => void] {\n const subscribe = useCallback(\n (listener: () => void) => {\n const heard = listeners.get(key) ?? new Set();\n listeners.set(key, heard);\n heard.add(listener);\n return () => {\n heard.delete(listener);\n };\n },\n [key],\n );\n const stored = useSyncExternalStore(\n subscribe,\n () => read(key),\n () => undefined,\n );\n // What another version wrote gives the default.\n const value = valid(stored) ? stored : fallback;\n\n const store = useCallback(\n (next: Value) => {\n values.set(key, next);\n try {\n window.localStorage.setItem(key, JSON.stringify(next));\n } catch {\n // Kept for this page only.\n }\n for (const listener of listeners.get(key) ?? []) {\n listener();\n }\n },\n [key],\n );\n\n return [value, store];\n}\n","import { useEffect, useRef } from \"react\";\nimport type { Session } from \"@aperture-browser/session-client\";\nimport { useSession, useSessionSnapshot } from \"../session.tsx\";\nimport { useStored } from \"./use-stored.ts\";\n\nconst FIT_KEY = \"aperture.session.fit\";\n\nconst isBoolean = (value: unknown): value is boolean => typeof value === \"boolean\";\n\n/**\n * Has the viewport fit the window, unless that was switched off when this browser was last\n * here, and remembers when it is switched on or off. `follows` is false where the embedder\n * wants targets left at the size they have.\n */\nexport function useRememberedFit(follows = true) {\n const session = useSession();\n const snapshot = useSessionSnapshot();\n const [remembered, remember] = useStored(FIT_KEY, true, isBoolean);\n const applied = useRef<Session | undefined>(undefined);\n const ready =\n follows &&\n snapshot.connection.state === \"open\" &&\n snapshot.selected !== undefined &&\n snapshot.features.tabs.write;\n\n useEffect(() => {\n if (!ready) {\n return;\n }\n if (applied.current !== session) {\n applied.current = session;\n if (remembered && !snapshot.fit) {\n // The tab may be someone's at work in it: its size waits for this member's turn.\n session.setViewport(\"fit\", { whenFree: true });\n }\n return;\n }\n if (snapshot.fit !== remembered) {\n remember(snapshot.fit);\n }\n }, [ready, session, snapshot.fit, remembered, remember]);\n}\n","import { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { Recording, Screenshot, StartRecording } from \"@aperture-browser/session-client\";\nimport { useSession, useSessionSnapshot } from \"../session.tsx\";\n\n/** How often the recordings are asked for while one is being made or edited. */\nconst BUSY_EVERY_MS = 2000;\n/** How often otherwise: a recording may be started by the session's automation too. */\nconst IDLE_EVERY_MS = 15_000;\n\nexport interface RecordingsControl {\n /** Newest first. */\n readonly recordings: readonly Recording[];\n /** Newest first. */\n readonly screenshots: readonly Screenshot[];\n /** A start or a stop is on its way. */\n readonly busy: boolean;\n readonly refresh: () => void;\n /** Rejects with what the session answered. */\n readonly start: (options?: StartRecording) => Promise<Recording>;\n readonly stop: (id: string) => Promise<Recording>;\n /** Takes a screenshot of a target and keeps it in the session's files. */\n readonly takeScreenshot: (tab: number) => Promise<Screenshot>;\n}\n\nexport const recordingRuns = (recording: Recording) => recording.state === \"recording\";\n\nexport const recordingIsEdited = (recording: Recording) => recording.edit?.state === \"editing\";\n\n/**\n * The session's recordings and screenshots. The live protocol does not tell of them, so they are asked for\n * again and again: often while one runs or is edited, seldom otherwise.\n */\nexport function useRecordings(enabled = true): RecordingsControl {\n const session = useSession();\n const open = useSessionSnapshot().connection.state === \"open\" && enabled;\n const [recordings, setRecordings] = useState<readonly Recording[]>([]);\n const [screenshots, setScreenshots] = useState<readonly Screenshot[]>([]);\n const [busy, setBusy] = useState(false);\n const [asked, setAsked] = useState(0);\n const active = recordings.some((one) => recordingRuns(one) || recordingIsEdited(one));\n const latest = useRef(0);\n\n useEffect(() => {\n if (!open) {\n return undefined;\n }\n let ended = false;\n const ask = () => {\n latest.current += 1;\n const turn = latest.current;\n session.recordings.list().then(\n (listed) => {\n // An answer that was overtaken by a later one tells what is no longer so.\n if (!ended && turn === latest.current) {\n setRecordings(listed.toSorted((a, b) => b.started_at_ms - a.started_at_ms));\n }\n },\n () => {\n // The list stays as it was: the next turn asks again.\n },\n );\n session.screenshots.list().then(\n (listed) => {\n if (!ended && turn === latest.current) {\n setScreenshots(listed);\n }\n },\n () => {},\n );\n };\n ask();\n const timer = setInterval(ask, active ? BUSY_EVERY_MS : IDLE_EVERY_MS);\n return () => {\n ended = true;\n clearInterval(timer);\n };\n }, [session, open, active, asked]);\n\n const refresh = useCallback(() => setAsked((current) => current + 1), []);\n\n const start = useCallback(\n async (options?: StartRecording) => {\n setBusy(true);\n try {\n return await session.recordings.start(options);\n } finally {\n setBusy(false);\n refresh();\n }\n },\n [session, refresh],\n );\n\n const stop = useCallback(\n async (id: string) => {\n setBusy(true);\n try {\n return await session.recordings.stop(id);\n } finally {\n setBusy(false);\n refresh();\n }\n },\n [session, refresh],\n );\n\n const takeScreenshot = useCallback(\n async (tab: number) => {\n try {\n return await session.screenshots.take(tab);\n } finally {\n refresh();\n }\n },\n [session, refresh],\n );\n\n return { recordings, screenshots, busy, refresh, start, stop, takeScreenshot };\n}\n\n/** Something the session kept of a tab: a recording that ended, or a screenshot. */\nexport type Kept =\n | {\n readonly kind: \"recording\";\n readonly id: string;\n readonly at: number;\n readonly recording: Recording;\n }\n | {\n readonly kind: \"screenshot\";\n readonly id: string;\n readonly at: number;\n readonly screenshot: Screenshot;\n };\n\n/** The recordings that ended and the screenshots as one list, newest first. */\nexport function keptOf(control: RecordingsControl): readonly Kept[] {\n const recordings = control.recordings\n .filter((recording) => !recordingRuns(recording))\n .map(\n (recording): Kept => ({\n kind: \"recording\",\n id: recording.id,\n at: recording.started_at_ms,\n recording,\n }),\n );\n const screenshots = control.screenshots.map(\n (screenshot): Kept => ({\n kind: \"screenshot\",\n id: screenshot.id,\n at: screenshot.taken_at_ms,\n screenshot,\n }),\n );\n return [...recordings, ...screenshots].toSorted((left, right) => right.at - left.at);\n}\n","import { useCallback, useEffect, useState } from \"react\";\nimport type { Uploaded } from \"@aperture-browser/session-client\";\nimport { useSession, useSessionSnapshot } from \"../session.tsx\";\n\n/** A file on its way into the session. */\nexport interface UploadInProgress {\n readonly name: string;\n readonly loaded: number;\n readonly total: number;\n}\n\nexport interface UploadsControl {\n /** The files that are in the session for its browser to take. */\n readonly uploads: readonly Uploaded[];\n readonly inProgress: readonly UploadInProgress[];\n readonly refresh: () => void;\n /**\n * Puts files into the session. Gives those that got there; `onFailure` hears of each\n * that did not.\n */\n readonly upload: (\n files: readonly File[],\n onFailure?: (file: File, cause: unknown) => void,\n ) => Promise<Uploaded[]>;\n /** Rejects with what the session answered. */\n readonly remove: (name: string) => Promise<void>;\n}\n\n/** The session's uploads. A file put there by another member shows at the next `refresh`. */\nexport function useUploads(enabled = true): UploadsControl {\n const session = useSession();\n const open = useSessionSnapshot().connection.state === \"open\" && enabled;\n const [uploads, setUploads] = useState<readonly Uploaded[]>([]);\n const [inProgress, setInProgress] = useState<readonly UploadInProgress[]>([]);\n const [asked, setAsked] = useState(0);\n\n useEffect(() => {\n if (!open) {\n return undefined;\n }\n let ended = false;\n session.uploads().then(\n (listed) => {\n if (!ended) {\n setUploads(listed.toSorted((a, b) => a.name.localeCompare(b.name)));\n }\n },\n () => {\n // The list stays as it was until it is asked for again.\n },\n );\n return () => {\n ended = true;\n };\n }, [session, open, asked]);\n\n const refresh = useCallback(() => setAsked((current) => current + 1), []);\n\n const upload = useCallback(\n async (files: readonly File[], onFailure?: (file: File, cause: unknown) => void) => {\n const put = await Promise.all(\n files.map(async (file) => {\n const progress = (loaded: number, total: number) =>\n setInProgress((current) => [\n ...current.filter((one) => one.name !== file.name),\n { name: file.name, loaded, total },\n ]);\n progress(0, file.size);\n try {\n return await session.upload(file, ({ loaded, total }) => progress(loaded, total));\n } catch (cause) {\n onFailure?.(file, cause);\n return undefined;\n } finally {\n setInProgress((current) => current.filter((one) => one.name !== file.name));\n }\n }),\n );\n refresh();\n return put.filter((one) => one !== undefined);\n },\n [session, refresh],\n );\n\n const remove = useCallback(\n async (name: string) => {\n try {\n await session.removeUpload(name);\n } finally {\n refresh();\n }\n },\n [session, refresh],\n );\n\n return { uploads, inProgress, refresh, upload, remove };\n}\n","import { useEffect, useState } from \"react\";\nimport type { Recording } from \"@aperture-browser/session-client\";\nimport { useSession } from \"../session.tsx\";\n\n/** A stretch of the raw video the edit kept, and how much faster it plays there. */\nexport interface TimelinePiece {\n readonly raw_start_ms: number;\n readonly raw_end_ms: number;\n readonly speed: number;\n readonly edited_start_ms: number;\n}\n\n/** Something that happened while the recording ran, in the raw video's time and the edit's. */\nexport interface TimelineEvent {\n /** `call` for a tool of the automation, `press`, `move`, `wheel`, `caption` and so on. */\n readonly kind: string;\n readonly at_ms: number;\n readonly end_ms: number;\n readonly edited_at_ms: number;\n readonly edited_end_ms: number;\n readonly [field: string]: unknown;\n}\n\n/** A recording's timeline, as the session writes it next to the edit. */\nexport interface RecordingTimeline {\n readonly duration_ms: number;\n readonly edited_duration_ms: number;\n /** The video's size in pixels. */\n readonly width: number;\n readonly height: number;\n readonly map: readonly TimelinePiece[];\n readonly events: readonly TimelineEvent[];\n readonly events_dropped: number;\n}\n\nconst isTimeline = (value: unknown): value is RecordingTimeline => {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n const { duration_ms, map, events } = value as Record<string, unknown>;\n return typeof duration_ms === \"number\" && Array.isArray(map) && Array.isArray(events);\n};\n\n/** The timeline of a recording whose edit is made; none before, and where there is no edit. */\nexport function useRecordingTimeline(\n recording: Recording | undefined,\n): RecordingTimeline | undefined {\n const session = useSession();\n const file = recording?.edit?.timeline ?? undefined;\n const [read, setRead] = useState<{ file: string; timeline: RecordingTimeline } | undefined>();\n\n useEffect(() => {\n if (file === undefined) {\n return undefined;\n }\n const asking = new AbortController();\n fetch(session.fileUrl(file), { signal: asking.signal })\n .then((answer) => (answer.ok ? answer.json() : undefined))\n .then(\n (timeline: unknown) => {\n if (isTimeline(timeline)) {\n setRead({ file, timeline });\n }\n },\n () => {\n // Shown without a timeline.\n },\n );\n return () => asking.abort();\n }, [session, file]);\n\n return read?.file === file ? read?.timeline : undefined;\n}\n"],"mappings":";;;;;;;;AA+BA,SAAgB,oBAAoB,EAClC,KACA,OACA,MACA,UACoC;CACpC,MAAM,CAAC,SAAS,cAAc,SAAyB,IAAI;CAC3D,MAAM,CAAC,SAAS,cAAc,SAAS,CAAC;CAExC,gBAAgB;EACd,MAAM,YAAYA,UAAQ;GAAE;GAAK;GAAO;GAAM;EAAO,CAAC;EACtD,WAAW,SAAS;EACpB,aAAa;GACX,WAAW,IAAI;GACf,UAAU,MAAM;EAClB;CACF,GAAG;EAAC;EAAK;EAAO;EAAM;EAAQ;CAAO,CAAC;CAEtC,OAAO,eACE;EACL;EACA,iBAAiB,YAAY,YAAY,UAAU,CAAC;CACtD,IACA,CAAC,OAAO,CACV;AACF;AAOA,MAAM,iBAAiB,cAA0C,IAAI;AASrE,SAAgB,gBAAgB,EAAE,SAAS,WAAW,YAAkC;CACtF,MAAM,QAAQ,eAAe;EAAE;EAAS;CAAU,IAAI,CAAC,SAAS,SAAS,CAAC;CAC1E,OAAO,oBAAC,eAAe,UAAhB;EAAgC;EAAQ;CAAkC,CAAA;AACnF;AAEA,SAAS,oBAAyC;CAChD,MAAM,QAAQ,WAAW,cAA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,GACA,CAAC,SAAS,OAAO,CAGiC;CAAE;AACxD;;;AC7DA,MAAM,cAAc,UAA+C;CACjE,IAAI,OAAO,UAAU,YAAY,UAAU,MACzC,OAAO;CAET,MAAM,EAAE,aAAa,KAAK,WAAW;CACrC,OAAO,OAAO,gBAAgB,YAAY,MAAM,QAAQ,GAAG,KAAK,MAAM,QAAQ,MAAM;AACtF;;AAGA,SAAgB,qBACd,WAC+B;CAC/B,MAAM,UAAU,WAAW;CAC3B,MAAM,OAAO,WAAW,MAAM,YAAY,KAAA;CAC1C,MAAM,CAAC,MAAM,WAAW,SAAoE;CAE5F,gBAAgB;EACd,IAAI,SAAS,KAAA,GACX;EAEF,MAAM,SAAS,IAAI,gBAAgB;EACnC,MAAM,QAAQ,QAAQ,IAAI,GAAG,EAAE,QAAQ,OAAO,OAAO,CAAC,CAAC,CACpD,MAAM,WAAY,OAAO,KAAK,OAAO,KAAK,IAAI,KAAA,CAAU,CAAC,CACzD,MACE,aAAsB;GACrB,IAAI,WAAW,QAAQ,GACrB,QAAQ;IAAE;IAAM;GAAS,CAAC;EAE9B,SACM,CAEN,CACF;EACF,aAAa,OAAO,MAAM;CAC5B,GAAG,CAAC,SAAS,IAAI,CAAC;CAElB,OAAO,MAAM,SAAS,OAAO,MAAM,WAAW,KAAA;AAChD"}
|
|
1
|
+
{"version":3,"file":"headless.js","names":["connect"],"sources":["../src/session.tsx","../src/components/session-viewport.tsx","../src/hooks/use-actions.ts","../src/hooks/use-address.ts","../src/hooks/use-stored.ts","../src/hooks/use-fit.ts","../src/hooks/use-recordings.ts","../src/hooks/use-uploads.ts","../src/hooks/use-timeline.ts"],"sourcesContent":["import {\n createContext,\n useContext,\n useEffect,\n useMemo,\n useState,\n useSyncExternalStore,\n type ReactNode,\n} from \"react\";\nimport {\n connect,\n type ConnectOptions,\n type HeldTab,\n type Member,\n type Role,\n type Session,\n type Snapshot,\n type Target,\n} from \"@aperture-browser/session-client\";\n\nexport interface SessionConnection {\n /** None until the page has mounted, and none between two connections. */\n readonly session: Session | null;\n /** Ends the connection there is and makes a new one: a closed connection does not come back. */\n readonly reconnect: () => void;\n}\n\n/**\n * Connects to a session for as long as the component is mounted. Another address, name or\n * first way of the picture makes another connection.\n */\nexport function useConnectedSession({\n url,\n token,\n name,\n pixels,\n}: ConnectOptions): SessionConnection {\n const [session, setSession] = useState<Session | null>(null);\n const [attempt, setAttempt] = useState(0);\n\n useEffect(() => {\n const connected = connect({ url, token, name, pixels });\n setSession(connected);\n return () => {\n setSession(null);\n connected.close();\n };\n }, [url, token, name, pixels, attempt]);\n\n return useMemo(\n () => ({\n session,\n reconnect: () => setAttempt((current) => current + 1),\n }),\n [session],\n );\n}\n\ninterface SessionContextValue {\n readonly session: Session;\n readonly reconnect: (() => void) | undefined;\n}\n\nconst SessionContext = createContext<SessionContextValue | null>(null);\n\nexport interface SessionProviderProps {\n readonly session: Session;\n /** Offered where the connection is closed, when there is a way to make another. */\n readonly reconnect?: (() => void) | undefined;\n readonly children?: ReactNode;\n}\n\nexport function SessionProvider({ session, reconnect, children }: SessionProviderProps) {\n const value = useMemo(() => ({ session, reconnect }), [session, reconnect]);\n return <SessionContext.Provider value={value}>{children}</SessionContext.Provider>;\n}\n\nfunction useSessionContext(): SessionContextValue {\n const value = useContext(SessionContext);\n if (value === null) {\n throw new Error(\"The session's components are used outside a SessionProvider\");\n }\n return value;\n}\n\nexport function useSession(): Session {\n return useSessionContext().session;\n}\n\nexport function useReconnect(): (() => void) | undefined {\n return useSessionContext().reconnect;\n}\n\nexport function useSessionSnapshot(): Snapshot {\n const session = useSession();\n return useSyncExternalStore(session.subscribe, session.getSnapshot, session.getSnapshot);\n}\n\n/** The target that is watched. */\nexport function useWatchedTarget(): Target | undefined {\n const snapshot = useSessionSnapshot();\n return snapshot.targets.find((target) => target.tab === snapshot.selected);\n}\n\nexport type LeaseState =\n /** The role lets this member watch only. */\n | \"view-only\"\n /** Nobody holds the watched tab: whoever gives it input holds it. */\n | \"free\"\n | \"yours\"\n /** This member holds the tab and another asks for it. */\n | \"asked-of-you\"\n | \"theirs\"\n /** Another holds the tab and this member has asked for it. */\n | \"you-asked\"\n /** Another holds the tab and a third member has asked for it. */\n | \"theirs-asked\";\n\nexport interface Lease {\n readonly state: LeaseState;\n /** The member this client is, once the session told. */\n readonly you: Member | undefined;\n readonly role: Role | undefined;\n /** Whether this member's role lets it give input and change the session's tabs. */\n readonly givesInput: boolean;\n readonly held: HeldTab | undefined;\n readonly holder: Member | undefined;\n readonly asker: Member | undefined;\n}\n\n/** Who holds the lease of the watched tab, and what this member may do about it. */\nexport function useLease(): Lease {\n const snapshot = useSessionSnapshot();\n const { presence } = snapshot;\n const watched = snapshot.targets.find((target) => target.tab === snapshot.selected);\n const you = presence?.members.find((member) => member.id === presence.you);\n const held = presence?.held.find((one) => one.tab === watched?.tab);\n const holder = presence?.members.find((member) => member.id === held?.holder);\n const asker = presence?.members.find((member) => member.id === held?.askedBy);\n const role = you?.role;\n // A member whose role the session has not told yet is not held back: the session refuses\n // what the role does not allow.\n const givesInput = role !== \"view\";\n\n let state: LeaseState = \"free\";\n if (!givesInput) {\n state = \"view-only\";\n } else if (held === undefined || presence === undefined) {\n state = \"free\";\n } else if (held.holder === presence.you) {\n state = held.askedBy === undefined ? \"yours\" : \"asked-of-you\";\n } else if (held.askedBy === presence.you) {\n state = \"you-asked\";\n } else {\n state = held.askedBy === undefined ? \"theirs\" : \"theirs-asked\";\n }\n\n return { state, you, role, givesInput, held, holder, asker };\n}\n","import { useEffect, useRef, useState, type CSSProperties, type ReactNode } from \"react\";\nimport { useSession, useSessionSnapshot } from \"../session.tsx\";\n\nexport interface SessionViewportProps {\n readonly className?: string | undefined;\n readonly style?: CSSProperties | undefined;\n /** Laid over the picture, such as the connection's state. */\n readonly children?: ReactNode;\n}\n\nconst PICTURE_WITHIN_MS = 1000;\n/** How long after the room for the picture last changed it counts as still changing. */\nconst RESIZED_AFTER_MS = 200;\nconst SETTLING_BLUR_PX = 6;\nconst SETTLING_FADE_MS = 160;\n\ninterface Size {\n readonly width: number;\n readonly height: number;\n}\n\n/**\n * The watched target's picture, and its input: the pointer, the wheel, the keyboard, the\n * clipboard and what is dropped on it. The picture is shown at the target's own size, and\n * smaller where the stage has no room for that.\n */\nexport function SessionViewport({ className, style, children }: SessionViewportProps) {\n const session = useSession();\n const snapshot = useSessionSnapshot();\n const stageRef = useRef<HTMLDivElement>(null);\n const videoRef = useRef<HTMLVideoElement>(null);\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const keysRef = useRef<HTMLTextAreaElement>(null);\n const [stage, setStage] = useState<Size>({ width: 0, height: 0 });\n /** The size of the picture that is drawn now, in its own pixels. */\n const [drawn, setDrawn] = useState<Size>({ width: 0, height: 0 });\n /** Whether the room for the picture is being changed, as by dragging the window's edge. */\n const [resizing, setResizing] = useState(false);\n const way = snapshot.picture.way;\n\n useEffect(() => {\n const surfaces = {\n video: videoRef.current,\n canvas: canvasRef.current,\n keys: keysRef.current,\n stage: stageRef.current,\n };\n if (\n surfaces.video === null ||\n surfaces.canvas === null ||\n surfaces.keys === null ||\n surfaces.stage === null\n ) {\n return undefined;\n }\n return session.attach({\n video: surfaces.video,\n canvas: surfaces.canvas,\n keys: surfaces.keys,\n stage: surfaces.stage,\n });\n }, [session]);\n\n useEffect(() => {\n const element = stageRef.current;\n if (element === null) {\n return undefined;\n }\n let settling: ReturnType<typeof setTimeout> | undefined;\n const measure = () => {\n const next = { width: element.clientWidth, height: element.clientHeight };\n setStage((before) => {\n // The first measure is no change of size, and neither is one that measures the same.\n if (before.width > 0 && (before.width !== next.width || before.height !== next.height)) {\n setResizing(true);\n clearTimeout(settling);\n settling = setTimeout(() => setResizing(false), RESIZED_AFTER_MS);\n }\n return next;\n });\n };\n measure();\n const sizes = new ResizeObserver(measure);\n sizes.observe(element);\n return () => {\n sizes.disconnect();\n clearTimeout(settling);\n };\n }, []);\n\n useEffect(() => {\n const video = videoRef.current;\n const canvas = canvasRef.current;\n if (video === null || canvas === null) {\n return undefined;\n }\n const measure = () => {\n const size =\n way === \"video\"\n ? { width: video.videoWidth, height: video.videoHeight }\n : { width: canvas.width, height: canvas.height };\n setDrawn((before) =>\n before.width === size.width && before.height === size.height ? before : size,\n );\n };\n measure();\n video.addEventListener(\"resize\", measure);\n video.addEventListener(\"loadedmetadata\", measure);\n // A canvas says nothing when what is drawn into it changes its size.\n const sizes = new MutationObserver(measure);\n sizes.observe(canvas, { attributes: true, attributeFilter: [\"width\", \"height\"] });\n return () => {\n video.removeEventListener(\"resize\", measure);\n video.removeEventListener(\"loadedmetadata\", measure);\n sizes.disconnect();\n };\n }, [way]);\n\n const watched = snapshot.targets.find((target) => target.tab === snapshot.selected);\n const shown = watched === undefined ? undefined : way;\n // The picture of another tab, or of this one at another size, comes a moment after the\n // session says which tab is watched and how large it is. Until what is drawn has the\n // shape of what is watched, the picture has the place of what is drawn: a window that\n // is dragged larger is some sizes ahead of its picture all the while, and a place kept\n // from before the drag would hold each picture that comes to the shape of the first.\n const agrees = watched !== undefined && drawn.width > 0 && sameShape(drawn, watched);\n /** The picture's pixels to a logical pixel of its target, when the two last agreed. */\n const density = useRef(1);\n if (agrees) {\n density.current = drawn.width / watched.width;\n }\n const awaited =\n watched !== undefined && drawn.width > 0 && !agrees\n ? `${watched.id} ${watched.width}x${watched.height}`\n : undefined;\n // A picture that does not come is not waited for longer than this.\n const [overdue, setOverdue] = useState<string | undefined>(undefined);\n useEffect(() => {\n if (awaited === undefined) {\n return undefined;\n }\n const waiting = setTimeout(() => setOverdue(awaited), PICTURE_WITHIN_MS);\n return () => clearTimeout(waiting);\n }, [awaited]);\n const settled = awaited === undefined || awaited === overdue;\n const box =\n watched === undefined\n ? undefined\n : pictureBox(\n stage,\n settled\n ? watched\n : {\n width: drawn.width / density.current,\n height: drawn.height / density.current,\n },\n );\n\n const picture = (visible: boolean): CSSProperties => ({\n display: visible ? \"block\" : \"none\",\n flex: \"none\",\n width: box?.width,\n height: box?.height,\n outline: \"none\",\n // A touch that drags is the session's pointer, not a scroll of this page.\n touchAction: \"none\",\n cursor: snapshot.cursor,\n // While its room changes and until the picture of the new size is there, what is\n // drawn is stretched or stale: softened, it reads as settling and not as broken.\n filter: resizing || !settled ? `blur(${SETTLING_BLUR_PX}px)` : \"none\",\n transition: `filter ${SETTLING_FADE_MS}ms ease-out`,\n });\n\n return (\n <div\n ref={stageRef}\n className={className}\n data-aperture-stage=\"\"\n // For whatever stands in for the picture until there is one.\n data-aperture-drawn={drawn.width > 0 ? \"\" : undefined}\n style={{\n position: \"relative\",\n display: \"flex\",\n flex: \"1 1 0%\",\n minWidth: 0,\n minHeight: 0,\n alignItems: \"center\",\n justifyContent: \"center\",\n overflow: \"hidden\",\n ...style,\n }}\n >\n <video\n ref={videoRef}\n data-aperture-surface=\"video\"\n tabIndex={-1}\n autoPlay\n muted\n playsInline\n style={picture(shown === \"video\")}\n />\n <canvas\n ref={canvasRef}\n data-aperture-surface=\"canvas\"\n tabIndex={-1}\n style={picture(shown === \"frames\" || shown === \"tiles\")}\n />\n <textarea\n ref={keysRef}\n data-aperture-surface=\"keys\"\n aria-label=\"Keyboard of the session\"\n autoCapitalize=\"off\"\n autoComplete=\"off\"\n autoCorrect=\"off\"\n spellCheck={false}\n style={{\n position: \"absolute\",\n left: 0,\n bottom: 0,\n width: 1,\n height: 1,\n padding: 0,\n border: 0,\n opacity: 0,\n resize: \"none\",\n // A phone zooms into a field whose text is smaller than this.\n fontSize: 16,\n }}\n />\n {children}\n </div>\n );\n}\n\n/** Whether two sizes have the same proportions, give or take a pixel's rounding. */\nfunction sameShape(one: Size, other: Size): boolean {\n if (one.height <= 0 || other.height <= 0) {\n return false;\n }\n const ratio = (one.width / one.height) * (other.height / other.width);\n return Math.abs(ratio - 1) < 0.01;\n}\n\n/** The place the picture of a target has in a stage: its own size, or smaller to fit. */\nexport function pictureBox(stage: Size, target: Size): Size {\n if (target.width <= 0 || target.height <= 0) {\n return { width: 0, height: 0 };\n }\n const scale = Math.min(1, stage.width / target.width, stage.height / target.height);\n return {\n width: Math.floor(target.width * scale),\n height: Math.floor(target.height * scale),\n };\n}\n","import { useCallback } from \"react\";\nimport type { Target } from \"@aperture-browser/session-client\";\nimport { useLease, useSession, useSessionSnapshot } from \"../session.tsx\";\n\nexport interface TabSound {\n /** The tab plays something now. */\n readonly sounds: boolean;\n /** The tab is muted for this client. */\n readonly muted: boolean;\n readonly toggle: () => void;\n}\n\n/** A tab's sound, as this client hears it. */\nexport function useTabSound(target: Target | undefined): TabSound {\n const session = useSession();\n const muted = useSessionSnapshot().muted.includes(target?.tab ?? -1);\n const tab = target?.tab;\n const toggle = useCallback(() => {\n if (tab !== undefined) {\n session.setMuted(tab, !muted);\n }\n }, [session, tab, muted]);\n return { sounds: target?.sounds ?? false, muted, toggle };\n}\n\nexport interface InputState {\n readonly open: boolean;\n /** This member may open, close and take tabs elsewhere, and give them another size. */\n readonly changes: boolean;\n /** This member may give the watched tab input. */\n readonly gives: boolean;\n}\n\n/** What this member may do in the session now. */\nexport function useInputState(): InputState {\n const snapshot = useSessionSnapshot();\n const lease = useLease();\n const open = snapshot.connection.state === \"open\";\n return {\n open,\n changes: open && snapshot.features.tabs.write,\n gives: open && lease.givesInput && snapshot.selected !== undefined,\n };\n}\n","import { useState } from \"react\";\nimport { useSession, useSessionSnapshot } from \"../session.tsx\";\n\nexport interface AddressControl {\n /** What the address field shows: what is typed, or the watched tab's address. */\n readonly value: string;\n /** Whether this member may take the watched tab elsewhere. */\n readonly navigates: boolean;\n readonly type: (value: string) => void;\n /** Lets go of what was typed and not sent. */\n readonly reset: () => void;\n /** Takes the watched tab to what was typed; false when that is nothing. */\n readonly submit: (value: string) => boolean;\n}\n\n/** The watched tab's address, as a field to type another into. */\nexport function useAddress(): AddressControl {\n const session = useSession();\n const snapshot = useSessionSnapshot();\n const watched = snapshot.targets.find((target) => target.tab === snapshot.selected);\n const [draft, setDraft] = useState<{ tab: number | undefined; url: string } | null>(null);\n // What was typed and not sent belongs to the tab it was typed for.\n const typed = draft !== null && draft.tab === watched?.tab ? draft.url : null;\n\n return {\n value: typed ?? watched?.url ?? \"\",\n navigates:\n snapshot.connection.state === \"open\" && snapshot.features.tabs.write && watched !== undefined,\n type: (url) => setDraft({ tab: watched?.tab, url }),\n reset: () => setDraft(null),\n submit: (value) => {\n const url = value.trim();\n if (url === \"\") {\n return false;\n }\n session.go({ url: addressOf(url) });\n setDraft(null);\n return true;\n },\n };\n}\n\n/** What is typed into an address field as a URL: an address as it is, anything else a search. */\nexport function addressOf(value: string): string {\n if (isLocalHost(value)) {\n return `http://${value}`;\n }\n if (\n /^[a-z][a-z0-9+.-]*:\\/\\//iu.test(value) ||\n /^(?:about|chrome|devtools|data|file|view-source):/iu.test(value)\n ) {\n return value;\n }\n if (isLikelyHost(value)) {\n return `https://${value}`;\n }\n return `https://www.google.com/search?q=${encodeURIComponent(value)}`;\n}\n\nfunction isLocalHost(value: string): boolean {\n return (\n /^localhost(?::\\d+)?(?:[/?#].*)?$/iu.test(value) ||\n /^127(?:\\.\\d{1,3}){3}(?::\\d+)?(?:[/?#].*)?$/u.test(value) ||\n /^[a-z0-9-]+:\\d+(?:[/?#].*)?$/iu.test(value)\n );\n}\n\nfunction isLikelyHost(value: string): boolean {\n return !/\\s/u.test(value) && /^[a-z0-9-]+(?:\\.[a-z0-9-]+)+(?:[/:?#].*)?$/iu.test(value);\n}\n","import { useCallback, useSyncExternalStore } from \"react\";\n\n/** What each key holds now, as it was read or last set, for all who use the key. */\nconst values = new Map<string, unknown>();\nconst listeners = new Map<string, Set<() => void>>();\n\nfunction read(key: string): unknown {\n if (!values.has(key)) {\n let stored: unknown;\n try {\n const text = window.localStorage.getItem(key);\n stored = text === null ? undefined : JSON.parse(text);\n } catch {\n // Storage that is unavailable gives the default.\n stored = undefined;\n }\n values.set(key, stored);\n }\n return values.get(key);\n}\n\n/**\n * A choice this browser remembers, the same for everything on the page that uses the key.\n * It lasts for the page where storage is unavailable.\n */\nexport function useStored<Value>(\n key: string,\n fallback: Value,\n valid: (value: unknown) => value is Value,\n): readonly [Value, (value: Value) => void] {\n const subscribe = useCallback(\n (listener: () => void) => {\n const heard = listeners.get(key) ?? new Set();\n listeners.set(key, heard);\n heard.add(listener);\n return () => {\n heard.delete(listener);\n };\n },\n [key],\n );\n const stored = useSyncExternalStore(\n subscribe,\n () => read(key),\n () => undefined,\n );\n // What another version wrote gives the default.\n const value = valid(stored) ? stored : fallback;\n\n const store = useCallback(\n (next: Value) => {\n values.set(key, next);\n try {\n window.localStorage.setItem(key, JSON.stringify(next));\n } catch {\n // Kept for this page only.\n }\n for (const listener of listeners.get(key) ?? []) {\n listener();\n }\n },\n [key],\n );\n\n return [value, store];\n}\n","import { useEffect, useRef } from \"react\";\nimport type { Session } from \"@aperture-browser/session-client\";\nimport { useSession, useSessionSnapshot } from \"../session.tsx\";\nimport { useStored } from \"./use-stored.ts\";\n\nconst FIT_KEY = \"aperture.session.fit\";\n\nconst isBoolean = (value: unknown): value is boolean => typeof value === \"boolean\";\n\n/**\n * Has the viewport fit the window, unless that was switched off when this browser was last\n * here, and remembers when it is switched on or off. `follows` is false where the embedder\n * wants targets left at the size they have.\n */\nexport function useRememberedFit(follows = true) {\n const session = useSession();\n const snapshot = useSessionSnapshot();\n const [remembered, remember] = useStored(FIT_KEY, true, isBoolean);\n const applied = useRef<Session | undefined>(undefined);\n const ready =\n follows &&\n snapshot.connection.state === \"open\" &&\n snapshot.selected !== undefined &&\n snapshot.features.tabs.write;\n\n useEffect(() => {\n if (!ready) {\n return;\n }\n if (applied.current !== session) {\n applied.current = session;\n if (remembered && !snapshot.fit) {\n // The tab may be someone's at work in it: its size waits for this member's turn.\n session.setViewport(\"fit\", { whenFree: true });\n }\n return;\n }\n if (snapshot.fit !== remembered) {\n remember(snapshot.fit);\n }\n }, [ready, session, snapshot.fit, remembered, remember]);\n}\n","import { useCallback, useEffect, useRef, useState } from \"react\";\nimport type {\n EditRecording,\n Recording,\n Screenshot,\n StartRecording,\n} from \"@aperture-browser/session-client\";\nimport { useSession, useSessionSnapshot } from \"../session.tsx\";\n\n/** How often the recordings are asked for while one is being made or edited. */\nconst BUSY_EVERY_MS = 2000;\n/** How often otherwise: a recording may be started by the session's automation too. */\nconst IDLE_EVERY_MS = 15_000;\n\nexport interface RecordingsControl {\n /** Newest first. */\n readonly recordings: readonly Recording[];\n /** Newest first. */\n readonly screenshots: readonly Screenshot[];\n /** A start or a stop is on its way. */\n readonly busy: boolean;\n readonly refresh: () => void;\n /** Rejects with what the session answered. */\n readonly start: (options?: StartRecording) => Promise<Recording>;\n /** Stops a recording; its edit is made with `options`. */\n readonly stop: (id: string, options?: EditRecording) => Promise<Recording>;\n /** Makes the edit of a stopped recording again, with other options. */\n readonly edit: (id: string, options?: EditRecording) => Promise<Recording>;\n /** Takes a screenshot of a target and keeps it in the session's files. */\n readonly takeScreenshot: (tab: number) => Promise<Screenshot>;\n}\n\nexport const recordingRuns = (recording: Recording) => recording.state === \"recording\";\n\nexport const recordingIsEdited = (recording: Recording) => recording.edit?.state === \"editing\";\n\n/**\n * The session's recordings and screenshots. The live protocol does not tell of them, so they are asked for\n * again and again: often while one runs or is edited, seldom otherwise.\n */\nexport function useRecordings(enabled = true): RecordingsControl {\n const session = useSession();\n const open = useSessionSnapshot().connection.state === \"open\" && enabled;\n const [recordings, setRecordings] = useState<readonly Recording[]>([]);\n const [screenshots, setScreenshots] = useState<readonly Screenshot[]>([]);\n const [busy, setBusy] = useState(false);\n const [asked, setAsked] = useState(0);\n const active = recordings.some((one) => recordingRuns(one) || recordingIsEdited(one));\n const latest = useRef(0);\n\n useEffect(() => {\n if (!open) {\n return undefined;\n }\n let ended = false;\n const ask = () => {\n latest.current += 1;\n const turn = latest.current;\n session.recordings.list().then(\n (listed) => {\n // An answer that was overtaken by a later one tells what is no longer so.\n if (!ended && turn === latest.current) {\n setRecordings(listed.toSorted((a, b) => b.started_at_ms - a.started_at_ms));\n }\n },\n () => {\n // The list stays as it was: the next turn asks again.\n },\n );\n session.screenshots.list().then(\n (listed) => {\n if (!ended && turn === latest.current) {\n setScreenshots(listed);\n }\n },\n () => {},\n );\n };\n ask();\n const timer = setInterval(ask, active ? BUSY_EVERY_MS : IDLE_EVERY_MS);\n return () => {\n ended = true;\n clearInterval(timer);\n };\n }, [session, open, active, asked]);\n\n const refresh = useCallback(() => setAsked((current) => current + 1), []);\n\n const start = useCallback(\n async (options?: StartRecording) => {\n setBusy(true);\n try {\n return await session.recordings.start(options);\n } finally {\n setBusy(false);\n refresh();\n }\n },\n [session, refresh],\n );\n\n const stop = useCallback(\n async (id: string, options?: EditRecording) => {\n setBusy(true);\n try {\n return await session.recordings.stop(id, options);\n } finally {\n setBusy(false);\n refresh();\n }\n },\n [session, refresh],\n );\n\n const edit = useCallback(\n async (id: string, options?: EditRecording) => {\n try {\n return await session.recordings.edit(id, options);\n } finally {\n refresh();\n }\n },\n [session, refresh],\n );\n\n const takeScreenshot = useCallback(\n async (tab: number) => {\n try {\n return await session.screenshots.take(tab);\n } finally {\n refresh();\n }\n },\n [session, refresh],\n );\n\n return { recordings, screenshots, busy, refresh, start, stop, edit, takeScreenshot };\n}\n\n/** Something the session kept of a tab: a recording that ended, or a screenshot. */\nexport type Kept =\n | {\n readonly kind: \"recording\";\n readonly id: string;\n readonly at: number;\n readonly recording: Recording;\n }\n | {\n readonly kind: \"screenshot\";\n readonly id: string;\n readonly at: number;\n readonly screenshot: Screenshot;\n };\n\n/** The recordings that ended and the screenshots as one list, newest first. */\nexport function keptOf(control: RecordingsControl): readonly Kept[] {\n const recordings = control.recordings\n .filter((recording) => !recordingRuns(recording))\n .map(\n (recording): Kept => ({\n kind: \"recording\",\n id: recording.id,\n at: recording.started_at_ms,\n recording,\n }),\n );\n const screenshots = control.screenshots.map(\n (screenshot): Kept => ({\n kind: \"screenshot\",\n id: screenshot.id,\n at: screenshot.taken_at_ms,\n screenshot,\n }),\n );\n return [...recordings, ...screenshots].toSorted((left, right) => right.at - left.at);\n}\n","import { useCallback, useEffect, useState } from \"react\";\nimport type { Uploaded } from \"@aperture-browser/session-client\";\nimport { useSession, useSessionSnapshot } from \"../session.tsx\";\n\n/** A file on its way into the session. */\nexport interface UploadInProgress {\n readonly name: string;\n readonly loaded: number;\n readonly total: number;\n}\n\nexport interface UploadsControl {\n /** The files that are in the session for its browser to take. */\n readonly uploads: readonly Uploaded[];\n readonly inProgress: readonly UploadInProgress[];\n readonly refresh: () => void;\n /**\n * Puts files into the session. Gives those that got there; `onFailure` hears of each\n * that did not.\n */\n readonly upload: (\n files: readonly File[],\n onFailure?: (file: File, cause: unknown) => void,\n ) => Promise<Uploaded[]>;\n /** Rejects with what the session answered. */\n readonly remove: (name: string) => Promise<void>;\n}\n\n/** The session's uploads. A file put there by another member shows at the next `refresh`. */\nexport function useUploads(enabled = true): UploadsControl {\n const session = useSession();\n const open = useSessionSnapshot().connection.state === \"open\" && enabled;\n const [uploads, setUploads] = useState<readonly Uploaded[]>([]);\n const [inProgress, setInProgress] = useState<readonly UploadInProgress[]>([]);\n const [asked, setAsked] = useState(0);\n\n useEffect(() => {\n if (!open) {\n return undefined;\n }\n let ended = false;\n session.uploads().then(\n (listed) => {\n if (!ended) {\n setUploads(listed.toSorted((a, b) => a.name.localeCompare(b.name)));\n }\n },\n () => {\n // The list stays as it was until it is asked for again.\n },\n );\n return () => {\n ended = true;\n };\n }, [session, open, asked]);\n\n const refresh = useCallback(() => setAsked((current) => current + 1), []);\n\n const upload = useCallback(\n async (files: readonly File[], onFailure?: (file: File, cause: unknown) => void) => {\n const put = await Promise.all(\n files.map(async (file) => {\n const progress = (loaded: number, total: number) =>\n setInProgress((current) => [\n ...current.filter((one) => one.name !== file.name),\n { name: file.name, loaded, total },\n ]);\n progress(0, file.size);\n try {\n return await session.upload(file, ({ loaded, total }) => progress(loaded, total));\n } catch (cause) {\n onFailure?.(file, cause);\n return undefined;\n } finally {\n setInProgress((current) => current.filter((one) => one.name !== file.name));\n }\n }),\n );\n refresh();\n return put.filter((one) => one !== undefined);\n },\n [session, refresh],\n );\n\n const remove = useCallback(\n async (name: string) => {\n try {\n await session.removeUpload(name);\n } finally {\n refresh();\n }\n },\n [session, refresh],\n );\n\n return { uploads, inProgress, refresh, upload, remove };\n}\n","import { useEffect, useState } from \"react\";\nimport type { Recording } from \"@aperture-browser/session-client\";\nimport { useSession } from \"../session.tsx\";\n\n/** A stretch of the raw video the edit kept, and how much faster it plays there. */\nexport interface TimelinePiece {\n readonly raw_start_ms: number;\n readonly raw_end_ms: number;\n readonly speed: number;\n readonly edited_start_ms: number;\n}\n\n/** Something that happened while the recording ran, in the raw video's time and the edit's. */\nexport interface TimelineEvent {\n /** `call` for a tool of the automation, `press`, `move`, `wheel`, `caption` and so on. */\n readonly kind: string;\n readonly at_ms: number;\n readonly end_ms: number;\n readonly edited_at_ms: number;\n readonly edited_end_ms: number;\n readonly [field: string]: unknown;\n}\n\n/** A recording's timeline, as the session writes it next to the edit. */\nexport interface RecordingTimeline {\n readonly duration_ms: number;\n readonly edited_duration_ms: number;\n /** The video's size in pixels. */\n readonly width: number;\n readonly height: number;\n readonly map: readonly TimelinePiece[];\n readonly events: readonly TimelineEvent[];\n readonly events_dropped: number;\n}\n\nconst isTimeline = (value: unknown): value is RecordingTimeline => {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n const { duration_ms, map, events } = value as Record<string, unknown>;\n return typeof duration_ms === \"number\" && Array.isArray(map) && Array.isArray(events);\n};\n\n/** The timeline of a recording whose edit is made; none before, and where there is no edit. */\nexport function useRecordingTimeline(\n recording: Recording | undefined,\n): RecordingTimeline | undefined {\n const session = useSession();\n const file = recording?.edit?.timeline ?? undefined;\n // An edit that was made again has the file of the one before.\n const made = recording?.edit?.made_at_ms ?? 0;\n const [read, setRead] = useState<\n { file: string; made: number; timeline: RecordingTimeline } | undefined\n >();\n\n useEffect(() => {\n if (file === undefined) {\n return undefined;\n }\n const asking = new AbortController();\n fetch(session.fileUrl(file), { signal: asking.signal, cache: \"no-store\" })\n .then((answer) => (answer.ok ? answer.json() : undefined))\n .then(\n (timeline: unknown) => {\n if (isTimeline(timeline)) {\n setRead({ file, made, timeline });\n }\n },\n () => {\n // Shown without a timeline.\n },\n );\n return () => asking.abort();\n }, [session, file, made]);\n\n return read?.file === file && read?.made === made ? read?.timeline : undefined;\n}\n"],"mappings":";;;;;;;;AA+BA,SAAgB,oBAAoB,EAClC,KACA,OACA,MACA,UACoC;CACpC,MAAM,CAAC,SAAS,cAAc,SAAyB,IAAI;CAC3D,MAAM,CAAC,SAAS,cAAc,SAAS,CAAC;CAExC,gBAAgB;EACd,MAAM,YAAYA,UAAQ;GAAE;GAAK;GAAO;GAAM;EAAO,CAAC;EACtD,WAAW,SAAS;EACpB,aAAa;GACX,WAAW,IAAI;GACf,UAAU,MAAM;EAClB;CACF,GAAG;EAAC;EAAK;EAAO;EAAM;EAAQ;CAAO,CAAC;CAEtC,OAAO,eACE;EACL;EACA,iBAAiB,YAAY,YAAY,UAAU,CAAC;CACtD,IACA,CAAC,OAAO,CACV;AACF;AAOA,MAAM,iBAAiB,cAA0C,IAAI;AASrE,SAAgB,gBAAgB,EAAE,SAAS,WAAW,YAAkC;CACtF,MAAM,QAAQ,eAAe;EAAE;EAAS;CAAU,IAAI,CAAC,SAAS,SAAS,CAAC;CAC1E,OAAO,oBAAC,eAAe,UAAhB;EAAgC;EAAQ;CAAkC,CAAA;AACnF;AAEA,SAAS,oBAAyC;CAChD,MAAM,QAAQ,WAAW,cAAc;CACvC,IAAI,UAAU,MACZ,MAAM,IAAI,MAAM,6DAA6D;CAE/E,OAAO;AACT;AAEA,SAAgB,aAAsB;CACpC,OAAO,kBAAkB,CAAC,CAAC;AAC7B;AAEA,SAAgB,eAAyC;CACvD,OAAO,kBAAkB,CAAC,CAAC;AAC7B;AAEA,SAAgB,qBAA+B;CAC7C,MAAM,UAAU,WAAW;CAC3B,OAAO,qBAAqB,QAAQ,WAAW,QAAQ,aAAa,QAAQ,WAAW;AACzF;;AAGA,SAAgB,mBAAuC;CACrD,MAAM,WAAW,m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AO,gBAAgB,YAAY,MAAM,QAAQ,GAAG,KAAK,MAAM,QAAQ,MAAM;AACtF;;AAGA,SAAgB,qBACd,WAC+B;CAC/B,MAAM,UAAU,WAAW;CAC3B,MAAM,OAAO,WAAW,MAAM,YAAY,KAAA;CAE1C,MAAM,OAAO,WAAW,MAAM,cAAc;CAC5C,MAAM,CAAC,MAAM,WAAW,SAEtB;CAEF,gBAAgB;EACd,IAAI,SAAS,KAAA,GACX;EAEF,MAAM,SAAS,IAAI,gBAAgB;EACnC,MAAM,QAAQ,QAAQ,IAAI,GAAG;GAAE,QAAQ,OAAO;GAAQ,OAAO;EAAW,CAAC,CAAC,CACvE,MAAM,WAAY,OAAO,KAAK,OAAO,KAAK,IAAI,KAAA,CAAU,CAAC,CACzD,MACE,aAAsB;GACrB,IAAI,WAAW,QAAQ,GACrB,QAAQ;IAAE;IAAM;IAAM;GAAS,CAAC;EAEpC,SACM,CAEN,CACF;EACF,aAAa,OAAO,MAAM;CAC5B,GAAG;EAAC;EAAS;EAAM;CAAI,CAAC;CAExB,OAAO,MAAM,SAAS,QAAQ,MAAM,SAAS,OAAO,MAAM,WAAW,KAAA;AACvE"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AddressControl, InputState, Kept, Lease, LeaseState, RecordingTimeline, RecordingsControl, SessionConnection, SessionError, SessionProvider, SessionProviderProps, SessionViewport, SessionViewportProps, TabSound, TimelineEvent, TimelinePiece, UploadInProgress, UploadsControl, addressOf, connect, keptOf, n as __reExport, pictureBox, recordingIsEdited, recordingRuns, t as __exportAll, useAddress, useConnectedSession, useInputState, useLease, useReconnect, useRecordingTimeline, useRecordings, useRememberedFit, useSession, useSessionSnapshot, useStored, useTabSound, useUploads, useWatchedTarget } from "./headless.js";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { ComponentProps, ComponentType, ReactNode } from "react";
|
|
4
|
-
import { ConnectOptions, Features, Member, Picture, Session, Target } from "@aperture-browser/session-client";
|
|
4
|
+
import { ConnectOptions, EditRecording, Features, Member, Picture, Session, Target } from "@aperture-browser/session-client";
|
|
5
5
|
import { Drawer } from "@base-ui/react/drawer";
|
|
6
6
|
import { Menu } from "@base-ui/react/menu";
|
|
7
7
|
import { ContextMenu } from "@base-ui/react/context-menu";
|
|
@@ -433,12 +433,17 @@ declare function PointersItem(): import("react").JSX.Element | null;
|
|
|
433
433
|
declare function ViewportItems(): import("react").JSX.Element;
|
|
434
434
|
//#endregion
|
|
435
435
|
//#region src/components/recording-menu.d.ts
|
|
436
|
-
/**
|
|
437
|
-
interface
|
|
436
|
+
/** How an edit is made, as the workbench offers it. */
|
|
437
|
+
interface EditSettings {
|
|
438
438
|
readonly capture: "continuous" | "bursts";
|
|
439
439
|
readonly idle: "keep" | "cut" | "speed";
|
|
440
|
-
readonly pace: "instant" | "fast" | "slow";
|
|
441
440
|
readonly ripple: boolean;
|
|
441
|
+
readonly fps: 30 | 60;
|
|
442
|
+
}
|
|
443
|
+
/** What a recording is started and stopped with, as this browser remembers it. */
|
|
444
|
+
interface RecordingSettings extends EditSettings {
|
|
445
|
+
/** A new recording goes on with whichever tab automation acts on. */
|
|
446
|
+
readonly follow: boolean;
|
|
442
447
|
}
|
|
443
448
|
declare function useRecordingSettings(): readonly [RecordingSettings, (value: RecordingSettings) => void];
|
|
444
449
|
/** Starts a recording of the watched tab. */
|
|
@@ -459,8 +464,18 @@ declare function KeptFacts({
|
|
|
459
464
|
}): import("react").JSX.Element;
|
|
460
465
|
/** Takes a screenshot of the watched tab, which the session keeps in its files. */
|
|
461
466
|
declare function ScreenshotItem(): import("react").JSX.Element;
|
|
462
|
-
/** How
|
|
467
|
+
/** How a new recording is made, and how the one that stops is edited. */
|
|
463
468
|
declare function RecordingSettingsItems(): import("react").JSX.Element;
|
|
469
|
+
/** The session's pace: how automation moves the pointer in what is recorded. */
|
|
470
|
+
declare function AutomationPaceItem(): import("react").JSX.Element | null;
|
|
471
|
+
/** How an edit is made: what a recording is stopped with, or edited again with. */
|
|
472
|
+
declare function EditSettingsItems({
|
|
473
|
+
settings,
|
|
474
|
+
onChange
|
|
475
|
+
}: {
|
|
476
|
+
settings: EditSettings;
|
|
477
|
+
onChange: (settings: EditSettings) => void;
|
|
478
|
+
}): import("react").JSX.Element;
|
|
464
479
|
//#endregion
|
|
465
480
|
//#region src/components/session-files.d.ts
|
|
466
481
|
/**
|
|
@@ -633,8 +648,8 @@ declare function WorkbenchMenuSlot({
|
|
|
633
648
|
readonly kind?: keyof typeof MENU_GROUPS;
|
|
634
649
|
}): import("react").JSX.Element[];
|
|
635
650
|
declare namespace index_d_exports {
|
|
636
|
-
export { AddressBar, AddressControl, ApertureSession, ApertureSessionFeatures, ApertureSessionProps, ApertureTheme, ApertureUIRoot, ApertureUIRootProps, Appearance, AppearanceItem, BrowserMenuAction, BrowserTabStrip, BrowserViewport, BrowserViewportProps, CompactContext, CopyItem, CopyUrlItem, Described, DrawAction, InputState, Kept, KeptFacts, KeptGallery, KeptItems, KeyboardAction, Lease, LeaseItems, LeaseOverlay, LeaseState, MemberAvatar, MemberDot, MenuButton, MuteItem, NavigationButtons, NavigationItems, PageLinkItems, PageMenu, PageModeItem, PageNavigationItems, PagePictureItems, PageTextItems, PasteItem, PhoneWorkbench, PictureAction, PictureItems, PictureSubmenuItem, PointersItem, ReconnectItem, RecordItem, RecordingAction, RecordingSettings, RecordingSettingsItems, RecordingSubmenuItem, RecordingTimeline, RecordingsControl, ResolvedSessionFeatures, RunningRecordingItems, ScreenshotItem, SelectAllItem, SessionConnection, SessionError, SessionFeatures, SessionFilesButton, SessionNotice, SessionPresence, SessionProvider, SessionProviderProps, SessionViewport, SessionViewportProps, SessionWorkbench, SessionWorkbenchProps, SettingSubTrigger, SlotProps, TabCloseItem, TabCloseOthersItem, TabCloseRightItem, TabCopyUrlItem, TabDuplicateItem, TabFavicon, TabMuteItem, TabReloadItem, TabSound, TabSwitcher, TabSwitcherProps, Thumbnail, TimelineEvent, TimelinePiece, ToolbarActions, ToolbarButton, TypeItem, UploadInProgress, UploadsControl, ViewportItems, Workbench, WorkbenchContribution, WorkbenchContributions, WorkbenchFrame, WorkbenchMenuSlot, WorkbenchProvider, WorkbenchProviderProps, WorkbenchSlot, WorkbenchSlotName, WorkbenchSlotProps, WorkbenchTitlebar, WorkbenchToolbar, addressOf, automationName, connect, copyTextHere, failureText, formatBytes, formatDuration, formatStarted, groupContributions, keptOf, keptPreview, memberColor, pasteHere, pictureBox, pictureStatus, recordingIsEdited, recordingRuns, resolveContributions, resolveSessionFeatures, showNotice, tabLabel, useAddress, useCompactToolbar, useConnectedSession, useCrowdedToolbar, useInputState, useKeyboardInset, useLease, usePhone, useReconnect, useRecordingSettings, useRecordingTimeline, useRecordings, useRememberedFit, useSession, useSessionSnapshot, useStored, useTabSound, useUploads, useWatchedTarget, useWorkbench, workbenchContributions };
|
|
651
|
+
export { AddressBar, AddressControl, ApertureSession, ApertureSessionFeatures, ApertureSessionProps, ApertureTheme, ApertureUIRoot, ApertureUIRootProps, Appearance, AppearanceItem, AutomationPaceItem, BrowserMenuAction, BrowserTabStrip, BrowserViewport, BrowserViewportProps, CompactContext, CopyItem, CopyUrlItem, Described, DrawAction, EditSettings, EditSettingsItems, InputState, Kept, KeptFacts, KeptGallery, KeptItems, KeyboardAction, Lease, LeaseItems, LeaseOverlay, LeaseState, MemberAvatar, MemberDot, MenuButton, MuteItem, NavigationButtons, NavigationItems, PageLinkItems, PageMenu, PageModeItem, PageNavigationItems, PagePictureItems, PageTextItems, PasteItem, PhoneWorkbench, PictureAction, PictureItems, PictureSubmenuItem, PointersItem, ReconnectItem, RecordItem, RecordingAction, RecordingSettings, RecordingSettingsItems, RecordingSubmenuItem, RecordingTimeline, RecordingsControl, ResolvedSessionFeatures, RunningRecordingItems, ScreenshotItem, SelectAllItem, SessionConnection, SessionError, SessionFeatures, SessionFilesButton, SessionNotice, SessionPresence, SessionProvider, SessionProviderProps, SessionViewport, SessionViewportProps, SessionWorkbench, SessionWorkbenchProps, SettingSubTrigger, SlotProps, TabCloseItem, TabCloseOthersItem, TabCloseRightItem, TabCopyUrlItem, TabDuplicateItem, TabFavicon, TabMuteItem, TabReloadItem, TabSound, TabSwitcher, TabSwitcherProps, Thumbnail, TimelineEvent, TimelinePiece, ToolbarActions, ToolbarButton, TypeItem, UploadInProgress, UploadsControl, ViewportItems, Workbench, WorkbenchContribution, WorkbenchContributions, WorkbenchFrame, WorkbenchMenuSlot, WorkbenchProvider, WorkbenchProviderProps, WorkbenchSlot, WorkbenchSlotName, WorkbenchSlotProps, WorkbenchTitlebar, WorkbenchToolbar, addressOf, automationName, connect, copyTextHere, failureText, formatBytes, formatDuration, formatStarted, groupContributions, keptOf, keptPreview, memberColor, pasteHere, pictureBox, pictureStatus, recordingIsEdited, recordingRuns, resolveContributions, resolveSessionFeatures, showNotice, tabLabel, useAddress, useCompactToolbar, useConnectedSession, useCrowdedToolbar, useInputState, useKeyboardInset, useLease, usePhone, useReconnect, useRecordingSettings, useRecordingTimeline, useRecordings, useRememberedFit, useSession, useSessionSnapshot, useStored, useTabSound, useUploads, useWatchedTarget, useWorkbench, workbenchContributions };
|
|
637
652
|
}
|
|
638
653
|
//#endregion
|
|
639
|
-
export { AddressBar, AddressControl, ApertureSession, ApertureSessionFeatures, ApertureSessionProps, ApertureTheme, ApertureUIRoot, ApertureUIRootProps, Appearance, AppearanceItem, BrowserMenuAction, BrowserTabStrip, BrowserViewport, BrowserViewportProps, CompactContext, CopyItem, CopyUrlItem, Described, DrawAction, InputState, Kept, KeptFacts, KeptGallery, KeptItems, KeyboardAction, Lease, LeaseItems, LeaseOverlay, LeaseState, MemberAvatar, MemberDot, MenuButton, MuteItem, NavigationButtons, NavigationItems, PageLinkItems, PageMenu, PageModeItem, PageNavigationItems, PagePictureItems, PageTextItems, PasteItem, PhoneWorkbench, PictureAction, PictureItems, PictureSubmenuItem, PointersItem, ReconnectItem, RecordItem, RecordingAction, type RecordingSettings, RecordingSettingsItems, RecordingSubmenuItem, RecordingTimeline, RecordingsControl, ResolvedSessionFeatures, RunningRecordingItems, ScreenshotItem, SelectAllItem, SessionConnection, SessionError, SessionFeatures, SessionFilesButton, SessionNotice, SessionPresence, SessionProvider, SessionProviderProps, SessionViewport, SessionViewportProps, SessionWorkbench, SessionWorkbenchProps, SettingSubTrigger, SlotProps, TabCloseItem, TabCloseOthersItem, TabCloseRightItem, TabCopyUrlItem, TabDuplicateItem, TabFavicon, TabMuteItem, TabReloadItem, TabSound, TabSwitcher, type TabSwitcherProps, Thumbnail, TimelineEvent, TimelinePiece, ToolbarActions, ToolbarButton, TypeItem, UploadInProgress, UploadsControl, ViewportItems, Workbench, WorkbenchContribution, WorkbenchContributions, WorkbenchFrame, WorkbenchMenuSlot, WorkbenchProvider, WorkbenchProviderProps, WorkbenchSlot, WorkbenchSlotName, WorkbenchSlotProps, WorkbenchTitlebar, WorkbenchToolbar, addressOf, automationName, connect, copyTextHere, failureText, formatBytes, formatDuration, formatStarted, groupContributions, keptOf, keptPreview, memberColor, pasteHere, pictureBox, pictureStatus, recordingIsEdited, recordingRuns, resolveContributions, resolveSessionFeatures, showNotice, tabLabel, useAddress, useCompactToolbar, useConnectedSession, useCrowdedToolbar, useInputState, useKeyboardInset, useLease, usePhone, useReconnect, useRecordingSettings, useRecordingTimeline, useRecordings, useRememberedFit, useSession, useSessionSnapshot, useStored, useTabSound, useUploads, useWatchedTarget, useWorkbench, workbenchContributions };
|
|
654
|
+
export { AddressBar, AddressControl, ApertureSession, ApertureSessionFeatures, ApertureSessionProps, ApertureTheme, ApertureUIRoot, ApertureUIRootProps, Appearance, AppearanceItem, AutomationPaceItem, BrowserMenuAction, BrowserTabStrip, BrowserViewport, BrowserViewportProps, CompactContext, CopyItem, CopyUrlItem, Described, DrawAction, type EditSettings, EditSettingsItems, InputState, Kept, KeptFacts, KeptGallery, KeptItems, KeyboardAction, Lease, LeaseItems, LeaseOverlay, LeaseState, MemberAvatar, MemberDot, MenuButton, MuteItem, NavigationButtons, NavigationItems, PageLinkItems, PageMenu, PageModeItem, PageNavigationItems, PagePictureItems, PageTextItems, PasteItem, PhoneWorkbench, PictureAction, PictureItems, PictureSubmenuItem, PointersItem, ReconnectItem, RecordItem, RecordingAction, type RecordingSettings, RecordingSettingsItems, RecordingSubmenuItem, RecordingTimeline, RecordingsControl, ResolvedSessionFeatures, RunningRecordingItems, ScreenshotItem, SelectAllItem, SessionConnection, SessionError, SessionFeatures, SessionFilesButton, SessionNotice, SessionPresence, SessionProvider, SessionProviderProps, SessionViewport, SessionViewportProps, SessionWorkbench, SessionWorkbenchProps, SettingSubTrigger, SlotProps, TabCloseItem, TabCloseOthersItem, TabCloseRightItem, TabCopyUrlItem, TabDuplicateItem, TabFavicon, TabMuteItem, TabReloadItem, TabSound, TabSwitcher, type TabSwitcherProps, Thumbnail, TimelineEvent, TimelinePiece, ToolbarActions, ToolbarButton, TypeItem, UploadInProgress, UploadsControl, ViewportItems, Workbench, WorkbenchContribution, WorkbenchContributions, WorkbenchFrame, WorkbenchMenuSlot, WorkbenchProvider, WorkbenchProviderProps, WorkbenchSlot, WorkbenchSlotName, WorkbenchSlotProps, WorkbenchTitlebar, WorkbenchToolbar, addressOf, automationName, connect, copyTextHere, failureText, formatBytes, formatDuration, formatStarted, groupContributions, keptOf, keptPreview, memberColor, pasteHere, pictureBox, pictureStatus, recordingIsEdited, recordingRuns, resolveContributions, resolveSessionFeatures, showNotice, tabLabel, useAddress, useCompactToolbar, useConnectedSession, useCrowdedToolbar, useInputState, useKeyboardInset, useLease, usePhone, useReconnect, useRecordingSettings, useRecordingTimeline, useRecordings, useRememberedFit, useSession, useSessionSnapshot, useStored, useTabSound, useUploads, useWatchedTarget, useWorkbench, workbenchContributions };
|
|
640
655
|
//# sourceMappingURL=index.d.ts.map
|