deictic 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +143 -2
- package/dist/annotations/client.d.ts +4 -0
- package/dist/annotations/client.d.ts.map +1 -0
- package/dist/annotations/client.js +497 -0
- package/dist/annotations/client.js.map +1 -0
- package/dist/annotations/index.d.ts +110 -0
- package/dist/annotations/index.d.ts.map +1 -0
- package/dist/annotations/index.js +22 -0
- package/dist/annotations/index.js.map +1 -0
- package/dist/astro.d.ts +29 -0
- package/dist/astro.d.ts.map +1 -0
- package/dist/astro.js +24 -0
- package/dist/astro.js.map +1 -0
- package/dist/bun.d.ts +12 -0
- package/dist/bun.d.ts.map +1 -0
- package/dist/bun.js +67 -0
- package/dist/bun.js.map +1 -0
- package/dist/client/index.d.ts +93 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +1329 -0
- package/dist/client/index.js.map +1 -0
- package/dist/endpoints.js +354 -0
- package/dist/endpoints.js.map +1 -0
- package/dist/index.d.ts +220 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/index2.d.ts +23 -0
- package/dist/index3.d.ts +98 -0
- package/dist/index3.d.ts.map +1 -0
- package/dist/index4.d.ts +74 -0
- package/dist/index4.d.ts.map +1 -0
- package/dist/index5.d.ts +70 -0
- package/dist/index5.d.ts.map +1 -0
- package/dist/integration.d.ts +19 -0
- package/dist/integration.d.ts.map +1 -0
- package/dist/integration.js +277 -0
- package/dist/integration.js.map +1 -0
- package/dist/kept.js +23 -0
- package/dist/kept.js.map +1 -0
- package/dist/loader.d.ts +15 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +17 -0
- package/dist/loader.js.map +1 -0
- package/dist/marks.js +14 -0
- package/dist/marks.js.map +1 -0
- package/dist/next.d.ts +17 -0
- package/dist/next.d.ts.map +1 -0
- package/dist/next.js +150 -0
- package/dist/next.js.map +1 -0
- package/dist/playwright.js +105 -0
- package/dist/playwright.js.map +1 -0
- package/dist/recommended/index.d.ts +25 -0
- package/dist/recommended/index.d.ts.map +1 -0
- package/dist/recommended/index.js +19 -0
- package/dist/recommended/index.js.map +1 -0
- package/dist/recordings/client.d.ts +4 -0
- package/dist/recordings/client.d.ts.map +1 -0
- package/dist/recordings/client.js +376 -0
- package/dist/recordings/client.js.map +1 -0
- package/dist/recordings/index.d.ts +2 -0
- package/dist/recordings/index.js +3 -0
- package/dist/recordings.js +235 -0
- package/dist/recordings.js.map +1 -0
- package/dist/screenshots/client.d.ts +23 -0
- package/dist/screenshots/client.d.ts.map +1 -0
- package/dist/screenshots/client.js +76 -0
- package/dist/screenshots/client.js.map +1 -0
- package/dist/screenshots/dom.d.ts +4 -0
- package/dist/screenshots/dom.d.ts.map +1 -0
- package/dist/screenshots/dom.js +92 -0
- package/dist/screenshots/dom.js.map +1 -0
- package/dist/screenshots/index.d.ts +2 -0
- package/dist/screenshots/index.js +98 -0
- package/dist/screenshots/index.js.map +1 -0
- package/dist/screenshots/rrweb.d.ts +9 -0
- package/dist/screenshots/rrweb.d.ts.map +1 -0
- package/dist/screenshots/rrweb.js +60 -0
- package/dist/screenshots/rrweb.js.map +1 -0
- package/dist/shortcut.js +63 -0
- package/dist/shortcut.js.map +1 -0
- package/dist/tailwind/client.d.ts +4 -0
- package/dist/tailwind/client.d.ts.map +1 -0
- package/dist/tailwind/client.js +613 -0
- package/dist/tailwind/client.js.map +1 -0
- package/dist/tailwind/index.d.ts +2 -0
- package/dist/tailwind/index.js +557 -0
- package/dist/tailwind/index.js.map +1 -0
- package/dist/tasks/client.d.ts +6 -0
- package/dist/tasks/client.d.ts.map +1 -0
- package/dist/tasks/client.js +642 -0
- package/dist/tasks/client.js.map +1 -0
- package/dist/tasks/index.d.ts +159 -0
- package/dist/tasks/index.d.ts.map +1 -0
- package/dist/tasks/index.js +348 -0
- package/dist/tasks/index.js.map +1 -0
- package/dist/vite.d.ts +17 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +44 -0
- package/dist/vite.js.map +1 -0
- package/dist/voice/client.d.ts +4 -0
- package/dist/voice/client.d.ts.map +1 -0
- package/dist/voice/client.js +66 -0
- package/dist/voice/client.js.map +1 -0
- package/dist/voice/index.d.ts +47 -0
- package/dist/voice/index.d.ts.map +1 -0
- package/dist/voice/index.js +74 -0
- package/dist/voice/index.js.map +1 -0
- package/dist/waveform.js +93 -0
- package/dist/waveform.js.map +1 -0
- package/dist/webpack.d.ts +50 -0
- package/dist/webpack.d.ts.map +1 -0
- package/dist/webpack.js +78 -0
- package/dist/webpack.js.map +1 -0
- package/package.json +313 -4
- package/skills/deictic/SKILL.md +47 -0
- package/skills/deictic/references/install.md +81 -0
- package/skills/deictic/references/recordings.md +83 -0
- package/skills/deictic/references/tasks.md +79 -0
- package/skills/deictic/references/watch.md +43 -0
- package/skills/deictic/scripts/frame.mjs +62 -0
- package/skills/deictic/scripts/lib.mjs +193 -0
- package/skills/deictic/scripts/recording.mjs +186 -0
- package/skills/deictic/scripts/task.mjs +84 -0
- package/skills/deictic/scripts/transcribe.mjs +93 -0
- package/skills/deictic/scripts/voice.mjs +50 -0
- package/skills/deictic/scripts/watch.mjs +51 -0
- package/src/astro.ts +34 -0
- package/src/bun.ts +79 -0
- package/src/client/index.ts +833 -0
- package/src/client/lightbox.ts +256 -0
- package/src/client/style.ts +243 -0
- package/src/client/tooltip.ts +78 -0
- package/src/client/waveform.ts +98 -0
- package/src/index.ts +240 -0
- package/src/loader.ts +28 -0
- package/src/next.ts +133 -0
- package/src/plugins/annotations/client.ts +301 -0
- package/src/plugins/annotations/draw.ts +169 -0
- package/src/plugins/annotations/index.ts +105 -0
- package/src/plugins/annotations/svg.ts +61 -0
- package/src/plugins/recommended/index.ts +35 -0
- package/src/plugins/recordings/client.ts +315 -0
- package/src/plugins/recordings/index.ts +174 -0
- package/src/plugins/recordings/marks.ts +11 -0
- package/src/plugins/recordings/ours.ts +70 -0
- package/src/plugins/recordings/replay.ts +139 -0
- package/src/plugins/screenshots/client.ts +63 -0
- package/src/plugins/screenshots/dom.ts +79 -0
- package/src/plugins/screenshots/index.ts +194 -0
- package/src/plugins/screenshots/playwright.ts +119 -0
- package/src/plugins/screenshots/rrweb.ts +45 -0
- package/src/plugins/tailwind/catalog.ts +396 -0
- package/src/plugins/tailwind/client.ts +669 -0
- package/src/plugins/tailwind/index.ts +267 -0
- package/src/plugins/tasks/client.ts +622 -0
- package/src/plugins/tasks/index.ts +513 -0
- package/src/plugins/voice/client.ts +57 -0
- package/src/plugins/voice/index.ts +114 -0
- package/src/shortcut.ts +83 -0
- package/src/tools/astro.ts +81 -0
- package/src/tools/editor.ts +22 -0
- package/src/tools/endpoints.ts +163 -0
- package/src/tools/history.ts +203 -0
- package/src/tools/integration.ts +106 -0
- package/src/tools/kept.ts +21 -0
- package/src/tools/locate.ts +94 -0
- package/src/tools/plugins.ts +41 -0
- package/src/tools/source.ts +72 -0
- package/src/vite.ts +62 -0
- package/src/webpack.ts +107 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { JSXOpeningElement, Program } from "oxc-parser";
|
|
2
|
+
/**
|
|
3
|
+
* A gesture: the keys held to outline the element under the pointer, and the button that, with them
|
|
4
|
+
* held, opens the popup there. deictic's own (`MASTER` by default) opens the tab used last; a
|
|
5
|
+
* plugin's, which it takes as its `shortcut` option and has none by default, opens its tab. The
|
|
6
|
+
* bundler's plugin checks them all as it starts, so a wrong one, or two alike, fails the dev server,
|
|
7
|
+
* not the page. Both halves import it: it must
|
|
8
|
+
* stay dependency-free.
|
|
9
|
+
*/
|
|
10
|
+
/** A modifier key, as `KeyboardEvent.key` names it. */
|
|
11
|
+
type Modifier = 'Alt' | 'Control' | 'Meta' | 'Shift';
|
|
12
|
+
interface Shortcut {
|
|
13
|
+
/** Held, and no other, to outline elements. */
|
|
14
|
+
modifiers?: Modifier[];
|
|
15
|
+
/** Pressed with them to open the panel. `'left'` unset. */
|
|
16
|
+
button?: 'left' | 'middle' | 'right';
|
|
17
|
+
}
|
|
18
|
+
/** A place in the source: the file from the project's root, with `/`, and the line and column, from 1. */
|
|
19
|
+
interface Loc {
|
|
20
|
+
file: string;
|
|
21
|
+
line: number;
|
|
22
|
+
column: number;
|
|
23
|
+
}
|
|
24
|
+
/** An element the pointer picked: where its opening tag starts, and the tag, which the server checks is still there. */
|
|
25
|
+
interface Target {
|
|
26
|
+
loc: Loc;
|
|
27
|
+
tag: string;
|
|
28
|
+
}
|
|
29
|
+
/** Text in a file to replace, by UTF-16 offsets. `file` is the target's unless named, from the project's root. */
|
|
30
|
+
interface TextEdit {
|
|
31
|
+
file?: string;
|
|
32
|
+
start: number;
|
|
33
|
+
end: number;
|
|
34
|
+
text: string;
|
|
35
|
+
}
|
|
36
|
+
/** What a server half reads: the target's file, parsed, and its element. */
|
|
37
|
+
interface Source {
|
|
38
|
+
/** The target's file, from the project's root. */
|
|
39
|
+
file: string;
|
|
40
|
+
code: string;
|
|
41
|
+
/** The file's module; for an `.astro` component, its frontmatter's. */
|
|
42
|
+
program: Program;
|
|
43
|
+
/** The target's opening tag. */
|
|
44
|
+
element: JSXOpeningElement;
|
|
45
|
+
/** Another file under the project's root, for plugins whose edits go elsewhere (a locale's messages). */
|
|
46
|
+
read(file: string): string;
|
|
47
|
+
}
|
|
48
|
+
/** An op a plugin won't make. The message says why and what to do instead; the panel shows it. */
|
|
49
|
+
declare class Refusal extends Error {
|
|
50
|
+
name: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A change the plugin made itself, not to a file: what its `undo` and `redo` need to take it back and
|
|
54
|
+
* make it again. JSON, since the history keeps it on disk across restarts of the dev server.
|
|
55
|
+
*/
|
|
56
|
+
interface Done<Record = unknown> {
|
|
57
|
+
done: Record;
|
|
58
|
+
}
|
|
59
|
+
type Maybe<T> = T | Promise<T>;
|
|
60
|
+
/**
|
|
61
|
+
* Each plugin's API to the others on the server, by name. A plugin adds its own, so `use` knows its type:
|
|
62
|
+
* `declare module 'deictic' { interface ServerApis { screenshots: Screenshots } }`.
|
|
63
|
+
*/
|
|
64
|
+
interface ServerApis {}
|
|
65
|
+
/** The same, in the page: `declare module 'deictic' { interface ClientApis { screenshots: Capture } }`. */
|
|
66
|
+
interface ClientApis {}
|
|
67
|
+
/** A plugin's API, by its name: what its package declared, or `unknown` for one that declared none. */
|
|
68
|
+
type ApiOf<Apis, Name extends string> = Name extends keyof Apis ? Apis[Name] : unknown;
|
|
69
|
+
interface ServerContext {
|
|
70
|
+
/** The project's root, as an absolute path. */
|
|
71
|
+
root: string;
|
|
72
|
+
/**
|
|
73
|
+
* Another plugin's API, as its `setup` answered it, or nothing when it isn't loaded. One the plugin
|
|
74
|
+
* `needs` always is; any other may not be, so check.
|
|
75
|
+
*/
|
|
76
|
+
use: <Name extends string>(name: Name) => ApiOf<ServerApis, Name> | undefined;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A route of the plugin's own, at `/__deictic/plugins/<name>/<route>`, and below it. A `GET` must
|
|
80
|
+
* change nothing: anything else reaches it only from the page itself, which deictic checks.
|
|
81
|
+
*/
|
|
82
|
+
type Route = (request: Request, context: ServerContext) => Maybe<Response>;
|
|
83
|
+
interface ServerPlugin<Model = unknown, Op = unknown, Record = unknown, Api = unknown> {
|
|
84
|
+
/** Ties the halves together; also the label of its changes in the history, and its routes' path. Lowercase, with `-`. */
|
|
85
|
+
name: string;
|
|
86
|
+
/** The module the page loads for this plugin's half there, which default-exports its `ClientPlugin`. */
|
|
87
|
+
client?: string;
|
|
88
|
+
/** What the page half gets as `context.options`: the user's options it needs there, as JSON. */
|
|
89
|
+
clientOptions?: unknown;
|
|
90
|
+
/** What opens its panel: its own default, which its options let the user change. A plugin with no panel has none. */
|
|
91
|
+
shortcut?: Shortcut;
|
|
92
|
+
/** The plugins it can't do without, by name: the dev server won't start without them. */
|
|
93
|
+
needs?: string[];
|
|
94
|
+
/** Runs once, as the dev server starts and before it answers anything. Answers the plugin's API to the others. */
|
|
95
|
+
setup?(context: ServerContext): Maybe<Api>;
|
|
96
|
+
/** Routes of its own, by their first segment under `/__deictic/plugins/<name>/`. */
|
|
97
|
+
routes?: {
|
|
98
|
+
[route: string]: Route;
|
|
99
|
+
};
|
|
100
|
+
/** The model its panel shows for an element. Without it, the panel gets none. */
|
|
101
|
+
read?(source: Source, target: Target): Maybe<Model>;
|
|
102
|
+
/** Text edits for deictic to write, or a change the plugin made itself. */
|
|
103
|
+
apply?(source: Source, target: Target, op: Op): Maybe<TextEdit[] | Done<Record>>;
|
|
104
|
+
/**
|
|
105
|
+
* Takes back a change `apply` made itself, or throws a `Refusal` saying why it can't any more. It may
|
|
106
|
+
* answer what the next redo needs, where that differs (what it put back has a new ID).
|
|
107
|
+
*/
|
|
108
|
+
undo?(record: Record): Maybe<void | Record>;
|
|
109
|
+
/** Makes it again after an undo, and answers what the next undo needs, which may differ (a new ID). */
|
|
110
|
+
redo?(record: Record): Maybe<Record>;
|
|
111
|
+
/** Says what an op does, for the history: `className: px-2 → px-4`. */
|
|
112
|
+
describe?(op: Op, before: Model): string;
|
|
113
|
+
}
|
|
114
|
+
declare const definePlugin: <Model, Op, Record = unknown, Api = unknown>(plugin: ServerPlugin<Model, Op, Record, Api>) => ServerPlugin<Model, Op, Record, Api>;
|
|
115
|
+
interface ClientContext {
|
|
116
|
+
/** The dev server's base URL, ending in `/`. */
|
|
117
|
+
base: string;
|
|
118
|
+
/** deictic's shadow root, to draw in: neither the page's styles nor the overlay's cross over. */
|
|
119
|
+
root: ShadowRoot;
|
|
120
|
+
/** The server half's `clientOptions`, or nothing. */
|
|
121
|
+
options: unknown;
|
|
122
|
+
/** Another plugin's API in the page, as its `setup` answered it, or nothing when it isn't loaded. */
|
|
123
|
+
use: <Name extends string>(name: Name) => ApiOf<ClientApis, Name> | undefined;
|
|
124
|
+
/** Asks one of this plugin's own routes, from the page: `request('shots', { method: 'POST', body: blob })`. */
|
|
125
|
+
request: (route: string, init?: RequestInit) => Promise<Response>;
|
|
126
|
+
/**
|
|
127
|
+
* Opens the popup on an element at a plugin's tab, as its shortcut would: after a recording, say. An
|
|
128
|
+
* element rendered again since stands in for one no longer on the page. False when there's no such tab
|
|
129
|
+
* or no such element any more. Not from `setup`, which runs before the popup can open.
|
|
130
|
+
*/
|
|
131
|
+
open: (plugin: string, element: Element) => boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Shows `items` in the lightbox over everything, at `at` (the first by default), stepping between them with
|
|
134
|
+
* ← and →. With `from`, it grows out of that element (the chip clicked) and shrinks back into it on close.
|
|
135
|
+
*/
|
|
136
|
+
lightbox: (items: LightboxItem[], options?: LightboxOptions) => {
|
|
137
|
+
close: () => void;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/** What the lightbox shows: a picture, a page in a frame (a recording's replay), or a sound with its waveform. */
|
|
141
|
+
type LightboxItem = {
|
|
142
|
+
/** Its name, over it. */
|
|
143
|
+
title: string;
|
|
144
|
+
/** Buttons beside the name: each closes the lightbox and runs. */
|
|
145
|
+
actions?: LightboxAction[];
|
|
146
|
+
} & ({
|
|
147
|
+
kind: 'image';
|
|
148
|
+
url: string;
|
|
149
|
+
} | {
|
|
150
|
+
kind: 'page';
|
|
151
|
+
url: string;
|
|
152
|
+
} | {
|
|
153
|
+
kind: 'audio';
|
|
154
|
+
url: string;
|
|
155
|
+
});
|
|
156
|
+
interface LightboxAction {
|
|
157
|
+
label: string;
|
|
158
|
+
title?: string;
|
|
159
|
+
run: () => void;
|
|
160
|
+
}
|
|
161
|
+
interface LightboxOptions {
|
|
162
|
+
/** The item it opens at. */
|
|
163
|
+
at?: number;
|
|
164
|
+
/** The element it grows out of, and goes back into. */
|
|
165
|
+
from?: Element;
|
|
166
|
+
}
|
|
167
|
+
interface PanelContext<Model, Op> extends ClientContext {
|
|
168
|
+
/** The element clicked: the one the source marked, under the pointer or around what is. */
|
|
169
|
+
element: Element;
|
|
170
|
+
/**
|
|
171
|
+
* What was under the pointer, where it isn't `element` but inside it: markup nothing marked, as a
|
|
172
|
+
* dependency's, or in an open shadow root, as the popup's own on a page that shows it (`popupIn`).
|
|
173
|
+
*/
|
|
174
|
+
pointed?: Element;
|
|
175
|
+
/** Every element on the page from the same place in the source, the clicked one among them: the rows of a list. */
|
|
176
|
+
elements: Element[];
|
|
177
|
+
target: Target;
|
|
178
|
+
model: Model;
|
|
179
|
+
/** Applies an op on disk, and reads the model again. Rejects with the server's reason, which the panel also shows. */
|
|
180
|
+
apply(op: Op): Promise<Model>;
|
|
181
|
+
close: () => void;
|
|
182
|
+
/**
|
|
183
|
+
* Says there's something here that leaving would lose (words typed, a change tried on the page), and the button
|
|
184
|
+
* that keeps it: a click outside the popup then shakes that button, where it would have closed the popup.
|
|
185
|
+
* `undefined` once there's nothing to lose. Forgotten as the panel unmounts.
|
|
186
|
+
*/
|
|
187
|
+
unsaved: (action: HTMLElement | undefined) => void;
|
|
188
|
+
/**
|
|
189
|
+
* Leaves the popup to do something on the page, then comes back: closes it, runs `task` (a recording, a
|
|
190
|
+
* pick of another element), and opens it again at this tab on this element. The next mount gets
|
|
191
|
+
* `resumed`: the `state` kept now (what was typed, what's attached), and what `task` answered, or why
|
|
192
|
+
* it failed. The state stays in the page, as it is: no need for JSON.
|
|
193
|
+
*/
|
|
194
|
+
away: <T>(state: unknown, task: () => Promise<T>) => void;
|
|
195
|
+
/** Set when this mount is the panel coming back from `away`. */
|
|
196
|
+
resumed?: Resumed;
|
|
197
|
+
}
|
|
198
|
+
/** What a panel coming back from `away` gets: the state it kept, and the task's result or problem. */
|
|
199
|
+
interface Resumed {
|
|
200
|
+
state: unknown;
|
|
201
|
+
result?: unknown;
|
|
202
|
+
/** Why the task failed: its error's message. */
|
|
203
|
+
problem?: string;
|
|
204
|
+
}
|
|
205
|
+
interface ClientPlugin<Model = unknown, Op = unknown, Api = unknown> {
|
|
206
|
+
/** The server half's `name`. */
|
|
207
|
+
name: string;
|
|
208
|
+
/** Shown over the element while its shortcut's keys are held, and atop the panel. */
|
|
209
|
+
label?: string;
|
|
210
|
+
/**
|
|
211
|
+
* Runs once, as the page starts, before any panel opens (a recording starts here). Answers the
|
|
212
|
+
* plugin's API to the others in the page, at once: one that needs time keeps its promises inside it.
|
|
213
|
+
*/
|
|
214
|
+
setup?(context: ClientContext): Api;
|
|
215
|
+
/** Draws into `panel`, inside deictic's shadow root. Returns what to undo on the page when the panel closes. */
|
|
216
|
+
mount?: (panel: HTMLElement, context: PanelContext<Model, Op>) => (() => void) | void;
|
|
217
|
+
}
|
|
218
|
+
declare const defineClientPlugin: <Model, Op, Api = unknown>(plugin: ClientPlugin<Model, Op, Api>) => ClientPlugin<Model, Op, Api>;
|
|
219
|
+
export { Shortcut as C, Modifier as S, Source as _, Done as a, defineClientPlugin as b, LightboxOptions as c, Refusal as d, Resumed as f, ServerPlugin as g, ServerContext as h, ClientPlugin as i, Loc as l, ServerApis as m, ClientApis as n, LightboxAction as o, Route as p, ClientContext as r, LightboxItem as s, ApiOf as t, PanelContext as u, Target as v, definePlugin as x, TextEdit as y };
|
|
220
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/shortcut.ts","../src/index.ts"],"mappings":";;;;;;;;;;KAUY;UAEK;;EAEf,YAAY;;EAEZ;;;UCYe;EACf;EACA;EACA;;;UAIe;EACf,KAAK;EACL;;;UAIe;EACf;EACA;EACA;EACA;;;UAIe;;EAEf;EACA;;EAEA,SAAS;;EAET,SAAS;;EAET,KAAK;;;cAIM,gBAAgB;EAClB;;;;;;UAOM,KAAK;EACpB,MAAM;;KAGH,MAAM,KAAK,IAAI,QAAQ;;;;;UAOX;;UAIA;;KAGL,MAAM,MAAM,uBAAuB,mBAAmB,OAAO,KAAK;UAE7D;;EAEf;;;;;EAKA,MAAM,qBAAqB,MAAM,SAAS,MAAM,YAAY;;;;;;KAOlD,SAAS,SAAS,SAAS,SAAS,kBAAkB,MAAM;UAEvD,aAAa,iBAAiB,cAAc,kBAAkB;;EAE7E;;EAEA;;EAEA;;EAEA,WAAW;;EAEX;;EAEA,OAAO,SAAS,gBAAgB,MAAM;;EAEtC;KAAY,gBAAgB;;;EAE5B,MAAM,QAAQ,QAAQ,QAAQ,SAAS,MAAM;;EAE7C,OAAO,QAAQ,QAAQ,QAAQ,QAAQ,IAAI,KAAK,MAAM,aAAa,KAAK;;;;;EAKxE,MAAM,QAAQ,SAAS,aAAa;;EAEpC,MAAM,QAAQ,SAAS,MAAM;;EAE7B,UAAU,IAAI,IAAI,QAAQ;;cAGf,eAAgB,OAAO,IAAI,kBAAkB,eAAa,QAC7D,aAAa,OAAO,IAAI,QAAQ,SACvC,aAAa,OAAO,IAAI,QAAQ;UAElB;;EAEf;;EAEA,MAAM;;EAEN;;EAEA,MAAM,qBAAqB,MAAM,SAAS,MAAM,YAAY;;EAE5D,UAAU,eAAe,OAAO,gBAAgB,QAAQ;;;;;;EAMxD,OAAO,gBAAgB,SAAS;;;;;EAKhC,WAAW,OAAO,gBAAgB,UAAU;IAAsB;;;;KAIxD;;EAEV;;EAEA,UAAU;;EACL;EAAe;;EAAkB;EAAc;;EAAkB;EAAe;;UAEtE;EACf;EACA;EACA;;UAGe;;EAEf;;EAEA,OAAO;;UAGQ,aAAa,OAAO,YAAY;;EAE/C,SAAS;;;;;EAKT,UAAU;;EAEV,UAAU;EACV,QAAQ;EACR,OAAO;;EAEP,MAAM,IAAI,KAAK,QAAQ;EACvB;;;;;;EAMA,UAAU,QAAQ;;;;;;;EAOlB,OAAO,GAAG,gBAAgB,YAAY,QAAQ;;EAE9C,UAAU;;;UAIK;EACf;EACA;;EAEA;;UAGe,aAAa,iBAAiB,cAAc;;EAE3D;;EAEA;;;;;EAKA,OAAO,SAAS,gBAAgB;;EAEhC,SAAS,OAAO,aAAa,SAAS,aAAa,OAAO;;cAG/C,qBAAsB,OAAO,IAAI,eAAa,QAAU,aAAa,OAAO,IAAI,SAAO,aAAa,OAAO,IAAI"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
/** An op a plugin won't make. The message says why and what to do instead; the panel shows it. */
|
|
3
|
+
var Refusal = class extends Error {
|
|
4
|
+
name = "Refusal";
|
|
5
|
+
};
|
|
6
|
+
const definePlugin = (plugin) => plugin;
|
|
7
|
+
const defineClientPlugin = (plugin) => plugin;
|
|
8
|
+
export { Refusal, defineClientPlugin, definePlugin };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * `deictic`: what a plugin is. Every plugin is optional: deictic itself is the glue (the\n * transform that ties elements to source, the dev server's endpoints, the history, shortcuts and the\n * overlay's panel), and each plugin adds what it does on top.\n *\n * A plugin has two halves, each optional that meet over the dev server's endpoints (`tools/endpoints.ts`). The\n * server half runs beside the bundler and is the only one that reads source: it turns the element\n * under the pointer into a model its panel can show, and an op from that panel into text edits. It\n * never writes files; deictic does, so every plugin's changes land in one history and undo the\n * same way. A change that isn't to a file (a task added to a board) the plugin makes itself and\n * answers with what it did (`Done`): the history keeps that beside the files' changes and hands it\n * back to the plugin's own `undo` and `redo`.\n * The client half is a module the page loads, named by the server half's `client`, which draws the\n * panel and previews an op on the page before it is applied.\n *\n * A plugin may have no panel at all, only an API for others (screenshots, a recording) and routes of\n * its own on the dev server. Each half's `setup` answers its API, and `use(name)` reaches another\n * plugin's, on the same side; `needs` names the plugins it can't do without.\n *\n * Both halves import from here, so the parser is imported for its types only: the browser must not load it.\n */\nimport type { JSXOpeningElement, Program } from 'oxc-parser';\n\nimport type { Shortcut } from './shortcut.ts';\n\nexport type { Modifier, Shortcut } from './shortcut.ts';\n\n/** A place in the source: the file from the project's root, with `/`, and the line and column, from 1. */\nexport interface Loc {\n file: string;\n line: number;\n column: number;\n}\n\n/** An element the pointer picked: where its opening tag starts, and the tag, which the server checks is still there. */\nexport interface Target {\n loc: Loc;\n tag: string;\n}\n\n/** Text in a file to replace, by UTF-16 offsets. `file` is the target's unless named, from the project's root. */\nexport interface TextEdit {\n file?: string;\n start: number;\n end: number;\n text: string;\n}\n\n/** What a server half reads: the target's file, parsed, and its element. */\nexport interface Source {\n /** The target's file, from the project's root. */\n file: string;\n code: string;\n /** The file's module; for an `.astro` component, its frontmatter's. */\n program: Program;\n /** The target's opening tag. */\n element: JSXOpeningElement;\n /** Another file under the project's root, for plugins whose edits go elsewhere (a locale's messages). */\n read(file: string): string;\n}\n\n/** An op a plugin won't make. The message says why and what to do instead; the panel shows it. */\nexport class Refusal extends Error {\n override name = 'Refusal';\n}\n\n/**\n * A change the plugin made itself, not to a file: what its `undo` and `redo` need to take it back and\n * make it again. JSON, since the history keeps it on disk across restarts of the dev server.\n */\nexport interface Done<Record = unknown> {\n done: Record;\n}\n\ntype Maybe<T> = T | Promise<T>;\n\n/**\n * Each plugin's API to the others on the server, by name. A plugin adds its own, so `use` knows its type:\n * `declare module 'deictic' { interface ServerApis { screenshots: Screenshots } }`.\n */\n// oxlint-disable-next-line typescript/no-empty-interface -- filled by declaration merging\nexport interface ServerApis {}\n\n/** The same, in the page: `declare module 'deictic' { interface ClientApis { screenshots: Capture } }`. */\n// oxlint-disable-next-line typescript/no-empty-interface -- filled by declaration merging\nexport interface ClientApis {}\n\n/** A plugin's API, by its name: what its package declared, or `unknown` for one that declared none. */\nexport type ApiOf<Apis, Name extends string> = Name extends keyof Apis ? Apis[Name] : unknown;\n\nexport interface ServerContext {\n /** The project's root, as an absolute path. */\n root: string;\n /**\n * Another plugin's API, as its `setup` answered it, or nothing when it isn't loaded. One the plugin\n * `needs` always is; any other may not be, so check.\n */\n use: <Name extends string>(name: Name) => ApiOf<ServerApis, Name> | undefined;\n}\n\n/**\n * A route of the plugin's own, at `/__deictic/plugins/<name>/<route>`, and below it. A `GET` must\n * change nothing: anything else reaches it only from the page itself, which deictic checks.\n */\nexport type Route = (request: Request, context: ServerContext) => Maybe<Response>;\n\nexport interface ServerPlugin<Model = unknown, Op = unknown, Record = unknown, Api = unknown> {\n /** Ties the halves together; also the label of its changes in the history, and its routes' path. Lowercase, with `-`. */\n name: string;\n /** The module the page loads for this plugin's half there, which default-exports its `ClientPlugin`. */\n client?: string;\n /** What the page half gets as `context.options`: the user's options it needs there, as JSON. */\n clientOptions?: unknown;\n /** What opens its panel: its own default, which its options let the user change. A plugin with no panel has none. */\n shortcut?: Shortcut;\n /** The plugins it can't do without, by name: the dev server won't start without them. */\n needs?: string[];\n /** Runs once, as the dev server starts and before it answers anything. Answers the plugin's API to the others. */\n setup?(context: ServerContext): Maybe<Api>;\n /** Routes of its own, by their first segment under `/__deictic/plugins/<name>/`. */\n routes?: { [route: string]: Route };\n /** The model its panel shows for an element. Without it, the panel gets none. */\n read?(source: Source, target: Target): Maybe<Model>;\n /** Text edits for deictic to write, or a change the plugin made itself. */\n apply?(source: Source, target: Target, op: Op): Maybe<TextEdit[] | Done<Record>>;\n /**\n * Takes back a change `apply` made itself, or throws a `Refusal` saying why it can't any more. It may\n * answer what the next redo needs, where that differs (what it put back has a new ID).\n */\n undo?(record: Record): Maybe<void | Record>;\n /** Makes it again after an undo, and answers what the next undo needs, which may differ (a new ID). */\n redo?(record: Record): Maybe<Record>;\n /** Says what an op does, for the history: `className: px-2 → px-4`. */\n describe?(op: Op, before: Model): string;\n}\n\nexport const definePlugin = <Model, Op, Record = unknown, Api = unknown>(\n plugin: ServerPlugin<Model, Op, Record, Api>,\n): ServerPlugin<Model, Op, Record, Api> => plugin;\n\nexport interface ClientContext {\n /** The dev server's base URL, ending in `/`. */\n base: string;\n /** deictic's shadow root, to draw in: neither the page's styles nor the overlay's cross over. */\n root: ShadowRoot;\n /** The server half's `clientOptions`, or nothing. */\n options: unknown;\n /** Another plugin's API in the page, as its `setup` answered it, or nothing when it isn't loaded. */\n use: <Name extends string>(name: Name) => ApiOf<ClientApis, Name> | undefined;\n /** Asks one of this plugin's own routes, from the page: `request('shots', { method: 'POST', body: blob })`. */\n request: (route: string, init?: RequestInit) => Promise<Response>;\n /**\n * Opens the popup on an element at a plugin's tab, as its shortcut would: after a recording, say. An\n * element rendered again since stands in for one no longer on the page. False when there's no such tab\n * or no such element any more. Not from `setup`, which runs before the popup can open.\n */\n open: (plugin: string, element: Element) => boolean;\n /**\n * Shows `items` in the lightbox over everything, at `at` (the first by default), stepping between them with\n * ← and →. With `from`, it grows out of that element (the chip clicked) and shrinks back into it on close.\n */\n lightbox: (items: LightboxItem[], options?: LightboxOptions) => { close: () => void };\n}\n\n/** What the lightbox shows: a picture, a page in a frame (a recording's replay), or a sound with its waveform. */\nexport type LightboxItem = {\n /** Its name, over it. */\n title: string;\n /** Buttons beside the name: each closes the lightbox and runs. */\n actions?: LightboxAction[];\n} & ({ kind: 'image'; url: string } | { kind: 'page'; url: string } | { kind: 'audio'; url: string });\n\nexport interface LightboxAction {\n label: string;\n title?: string;\n run: () => void;\n}\n\nexport interface LightboxOptions {\n /** The item it opens at. */\n at?: number;\n /** The element it grows out of, and goes back into. */\n from?: Element;\n}\n\nexport interface PanelContext<Model, Op> extends ClientContext {\n /** The element clicked: the one the source marked, under the pointer or around what is. */\n element: Element;\n /**\n * What was under the pointer, where it isn't `element` but inside it: markup nothing marked, as a\n * dependency's, or in an open shadow root, as the popup's own on a page that shows it (`popupIn`).\n */\n pointed?: Element;\n /** Every element on the page from the same place in the source, the clicked one among them: the rows of a list. */\n elements: Element[];\n target: Target;\n model: Model;\n /** Applies an op on disk, and reads the model again. Rejects with the server's reason, which the panel also shows. */\n apply(op: Op): Promise<Model>;\n close: () => void;\n /**\n * Says there's something here that leaving would lose (words typed, a change tried on the page), and the button\n * that keeps it: a click outside the popup then shakes that button, where it would have closed the popup.\n * `undefined` once there's nothing to lose. Forgotten as the panel unmounts.\n */\n unsaved: (action: HTMLElement | undefined) => void;\n /**\n * Leaves the popup to do something on the page, then comes back: closes it, runs `task` (a recording, a\n * pick of another element), and opens it again at this tab on this element. The next mount gets\n * `resumed`: the `state` kept now (what was typed, what's attached), and what `task` answered, or why\n * it failed. The state stays in the page, as it is: no need for JSON.\n */\n away: <T>(state: unknown, task: () => Promise<T>) => void;\n /** Set when this mount is the panel coming back from `away`. */\n resumed?: Resumed;\n}\n\n/** What a panel coming back from `away` gets: the state it kept, and the task's result or problem. */\nexport interface Resumed {\n state: unknown;\n result?: unknown;\n /** Why the task failed: its error's message. */\n problem?: string;\n}\n\nexport interface ClientPlugin<Model = unknown, Op = unknown, Api = unknown> {\n /** The server half's `name`. */\n name: string;\n /** Shown over the element while its shortcut's keys are held, and atop the panel. */\n label?: string;\n /**\n * Runs once, as the page starts, before any panel opens (a recording starts here). Answers the\n * plugin's API to the others in the page, at once: one that needs time keeps its promises inside it.\n */\n setup?(context: ClientContext): Api;\n /** Draws into `panel`, inside deictic's shadow root. Returns what to undo on the page when the panel closes. */\n mount?: (panel: HTMLElement, context: PanelContext<Model, Op>) => (() => void) | void;\n}\n\nexport const defineClientPlugin = <Model, Op, Api = unknown>(plugin: ClientPlugin<Model, Op, Api>): ClientPlugin<Model, Op, Api> => plugin;\n"],"mappings":";;AA8DA,IAAa,UAAb,cAA6B,MAAM;CACxB,OAAO;AAClB;AAwEA,MAAa,gBACX,WACyC;AAqG3C,MAAa,sBAAgD,WAAuE"}
|
package/dist/index2.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `deictic`: what a plugin is. Every plugin is optional: deictic itself is the glue (the
|
|
3
|
+
* transform that ties elements to source, the dev server's endpoints, the history, shortcuts and the
|
|
4
|
+
* overlay's panel), and each plugin adds what it does on top.
|
|
5
|
+
*
|
|
6
|
+
* A plugin has two halves, each optional that meet over the dev server's endpoints (`tools/endpoints.ts`). The
|
|
7
|
+
* server half runs beside the bundler and is the only one that reads source: it turns the element
|
|
8
|
+
* under the pointer into a model its panel can show, and an op from that panel into text edits. It
|
|
9
|
+
* never writes files; deictic does, so every plugin's changes land in one history and undo the
|
|
10
|
+
* same way. A change that isn't to a file (a task added to a board) the plugin makes itself and
|
|
11
|
+
* answers with what it did (`Done`): the history keeps that beside the files' changes and hands it
|
|
12
|
+
* back to the plugin's own `undo` and `redo`.
|
|
13
|
+
* The client half is a module the page loads, named by the server half's `client`, which draws the
|
|
14
|
+
* panel and previews an op on the page before it is applied.
|
|
15
|
+
*
|
|
16
|
+
* A plugin may have no panel at all, only an API for others (screenshots, a recording) and routes of
|
|
17
|
+
* its own on the dev server. Each half's `setup` answers its API, and `use(name)` reaches another
|
|
18
|
+
* plugin's, on the same side; `needs` names the plugins it can't do without.
|
|
19
|
+
*
|
|
20
|
+
* Both halves import from here, so the parser is imported for its types only: the browser must not load it.
|
|
21
|
+
*/
|
|
22
|
+
import { C as Shortcut, S as Modifier, _ as Source, a as Done, b as defineClientPlugin, c as LightboxOptions, d as Refusal, f as Resumed, g as ServerPlugin, h as ServerContext, i as ClientPlugin, l as Loc, m as ServerApis, n as ClientApis, o as LightboxAction, p as Route, r as ClientContext, s as LightboxItem, t as ApiOf, u as PanelContext, v as Target, x as definePlugin, y as TextEdit } from "./index.js";
|
|
23
|
+
export { ApiOf, ClientApis, ClientContext, ClientPlugin, Done, LightboxAction, LightboxItem, LightboxOptions, Loc, type Modifier, PanelContext, Refusal, Resumed, Route, ServerApis, ServerContext, ServerPlugin, type Shortcut, Source, Target, TextEdit, defineClientPlugin, definePlugin };
|
package/dist/index3.d.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/** A rectangle in CSS pixels, from the shot's top left. */
|
|
2
|
+
interface Box {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
/** A shot as the page knows it: its ID, where the dev server serves its PNG, and where the element is in it. */
|
|
9
|
+
interface Shot {
|
|
10
|
+
id: string;
|
|
11
|
+
url: string;
|
|
12
|
+
/** The element, in the shot: nothing marks it there, as nothing of deictic's is drawn. */
|
|
13
|
+
box: Box;
|
|
14
|
+
/** The shot's size in CSS pixels; its PNG may have more, on a high-density screen. */
|
|
15
|
+
size: {
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
interface CaptureOptions {
|
|
21
|
+
/** `viewport`, what the page shows, by default; or `element`, the element alone. */
|
|
22
|
+
area?: 'viewport' | 'element';
|
|
23
|
+
}
|
|
24
|
+
/** The page's half, for other plugins' page halves. */
|
|
25
|
+
interface Capture {
|
|
26
|
+
capture(element: Element, options?: CaptureOptions): Promise<Shot>;
|
|
27
|
+
/** Keeps a PNG made of a shot (the same one with marks drawn over it, say) as a shot of its own. */
|
|
28
|
+
upload(png: Blob, of: Pick<Shot, 'box' | 'size'>): Promise<Shot>;
|
|
29
|
+
}
|
|
30
|
+
/** The server's half, for other plugins' server halves. */
|
|
31
|
+
interface Screenshots {
|
|
32
|
+
/** A shot's PNG, or nothing for one not kept (any more). */
|
|
33
|
+
read(id: string): {
|
|
34
|
+
data: Uint8Array<ArrayBuffer>;
|
|
35
|
+
name: string;
|
|
36
|
+
type: 'image/png';
|
|
37
|
+
} | undefined;
|
|
38
|
+
}
|
|
39
|
+
declare module 'deictic' {
|
|
40
|
+
interface ServerApis {
|
|
41
|
+
screenshots: Screenshots;
|
|
42
|
+
}
|
|
43
|
+
interface ClientApis {
|
|
44
|
+
screenshots: Capture;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* What a shot hides, as rrweb names it and by its defaults, so one marking in the app hides the same
|
|
49
|
+
* things from a screenshot as from an rrweb recording or snapshot.
|
|
50
|
+
*/
|
|
51
|
+
interface Masking {
|
|
52
|
+
/** Elements drawn as a blank box their size: `rr-block` by default. */
|
|
53
|
+
blockClass?: string;
|
|
54
|
+
blockSelector?: string;
|
|
55
|
+
/** Elements whose text is drawn as `*`: `rr-mask` by default. */
|
|
56
|
+
maskTextClass?: string;
|
|
57
|
+
maskTextSelector?: string;
|
|
58
|
+
/** Every field's value as `*`, not only passwords': false by default. */
|
|
59
|
+
maskAllInputs?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/** Masking with its defaults, as a renderer's page half gets it. */
|
|
62
|
+
type ResolvedMasking = Required<Pick<Masking, 'blockClass' | 'maskTextClass' | 'maskAllInputs'>> & Masking;
|
|
63
|
+
/**
|
|
64
|
+
* How shots are made. `client` is the page module that captures, default-exporting `screenshotsClient(…)`
|
|
65
|
+
* from `deictic/screenshots/client`. A page half that sends a PNG needs nothing here; one that sends
|
|
66
|
+
* something else, as JSON (a DOM snapshot), needs `render` to make the PNG of it.
|
|
67
|
+
*/
|
|
68
|
+
interface Renderer {
|
|
69
|
+
client: string;
|
|
70
|
+
/** What the page half gets, besides the masking. */
|
|
71
|
+
clientOptions?: unknown;
|
|
72
|
+
render?(input: unknown): Promise<Uint8Array>;
|
|
73
|
+
}
|
|
74
|
+
/** Where `rrweb()` finds a browser: any Chromium renders the snapshot as the page's own would. */
|
|
75
|
+
interface BrowserOptions {
|
|
76
|
+
/** A Chromium-based browser's executable. */
|
|
77
|
+
executablePath?: string;
|
|
78
|
+
/** An installed browser by Playwright's name: `chrome`, `msedge`. By default Playwright's own Chromium, then Chrome, then Edge. */
|
|
79
|
+
channel?: string;
|
|
80
|
+
}
|
|
81
|
+
/** Draws the page in the page, from its DOM (`modern-screenshot`): no server needed, but text may lay out a little differently. */
|
|
82
|
+
declare const dom: () => Renderer;
|
|
83
|
+
/**
|
|
84
|
+
* Snapshots the page's DOM in the page (`rrweb-snapshot`, masking as rrweb does) and renders it in a
|
|
85
|
+
* browser beside the dev server (`playwright-core`), so text lays out as the page's does.
|
|
86
|
+
*/
|
|
87
|
+
declare const rrweb: (options?: BrowserOptions) => Renderer;
|
|
88
|
+
interface ScreenshotsOptions extends Masking {
|
|
89
|
+
/** How shots are made: `rrweb()` by default, or `dom()` where there's no server to render on. */
|
|
90
|
+
renderer?: Renderer;
|
|
91
|
+
/** How many shots to keep, the latest: 100 by default. */
|
|
92
|
+
keep?: number;
|
|
93
|
+
/** Where they're kept, from the project's root: `.deictic/screenshots` by default. */
|
|
94
|
+
dir?: string;
|
|
95
|
+
}
|
|
96
|
+
declare function screenshots(options?: ScreenshotsOptions): import("deictic").ServerPlugin<never, never, never, Screenshots>;
|
|
97
|
+
export { Masking as a, Screenshots as c, dom as d, rrweb as f, CaptureOptions as i, ScreenshotsOptions as l, BrowserOptions as n, Renderer as o, screenshots as p, Capture as r, ResolvedMasking as s, Box as t, Shot as u };
|
|
98
|
+
//# sourceMappingURL=index3.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index3.d.ts","names":[],"sources":["../src/plugins/screenshots/index.ts"],"mappings":";UAqBiB;EACf;EACA;EACA;EACA;;;UAIe;EACf;EACA;;EAEA,KAAK;;EAEL;IAAQ;IAAe;;;UAGR;;EAEf;;;UAIe;EACf,QAAQ,SAAS,SAAS,UAAU,iBAAiB,QAAQ;;EAE7D,OAAO,KAAK,MAAM,IAAI,KAAK,wBAAwB,QAAQ;;;UAI5C;;EAEf,KAAK;IAAe,MAAM,WAAW;IAAc;IAAc;;;;YAIvD;IACR,aAAa;;YAEL;IACR,aAAa;;;;;;;UAQA;;EAEf;EACA;;EAEA;EACA;;EAEA;;;KAIU,kBAAkB,SAAS,KAAK,8DAA8D;;;;;;UAOzF;EACf;;EAEA;EACA,QAAQ,iBAAiB,QAAQ;;;UAIlB;;EAEf;;EAEA;;;cAIW,WAAU;;;;;cAMV,QAAK,UAAa,mBAAsB;UAMpC,2BAA2B;;EAE1C,WAAW;;EAEX;;EAEA;;iBAOc,YAAY,UAAS,uCAAuB,kCAAA"}
|
package/dist/index4.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { a as Masking } from "./index3.js";
|
|
2
|
+
/**
|
|
3
|
+
* The custom event's tag the marks go in: the page's annotations, as an SVG in page coordinates (`svg`),
|
|
4
|
+
* and as the annotations themselves (`annotations`, absent from recordings made before it was added).
|
|
5
|
+
*/
|
|
6
|
+
declare const MARKS = "deictic.annotations";
|
|
7
|
+
/** A recording as the page knows it: its ID, where it plays back, and how long it ran, in milliseconds. */
|
|
8
|
+
interface Recording {
|
|
9
|
+
id: string;
|
|
10
|
+
url: string;
|
|
11
|
+
duration: number;
|
|
12
|
+
/** What the mic took while it was on, where the voice plugin is loaded. */
|
|
13
|
+
voice?: VoiceClip[];
|
|
14
|
+
}
|
|
15
|
+
/** A stretch of the mic in a recording: the voice plugin's clip, and when it starts in the recording, in milliseconds. */
|
|
16
|
+
interface VoiceClip {
|
|
17
|
+
id: string;
|
|
18
|
+
at: number;
|
|
19
|
+
duration: number;
|
|
20
|
+
}
|
|
21
|
+
/** The page's half, for other plugins' page halves. */
|
|
22
|
+
interface Recorder {
|
|
23
|
+
/**
|
|
24
|
+
* Records the page, with the toolbar, until Stop: answers the recording, kept by the dev server, or
|
|
25
|
+
* nothing when it's discarded. Rejects while another is going, or when it couldn't be kept.
|
|
26
|
+
*/
|
|
27
|
+
record(): Promise<Recording | undefined>;
|
|
28
|
+
/** Whether one is going. */
|
|
29
|
+
recording(): boolean;
|
|
30
|
+
}
|
|
31
|
+
/** The server's half, for other plugins' server halves. */
|
|
32
|
+
interface Recordings {
|
|
33
|
+
/** A recording's JSON, or nothing for one not kept (any more). */
|
|
34
|
+
read(id: string): {
|
|
35
|
+
data: Uint8Array<ArrayBuffer>;
|
|
36
|
+
name: string;
|
|
37
|
+
type: 'application/json';
|
|
38
|
+
} | undefined;
|
|
39
|
+
}
|
|
40
|
+
/** What the page sends, and what's kept: rrweb's events and what they can't say. */
|
|
41
|
+
interface Kept {
|
|
42
|
+
page: string;
|
|
43
|
+
viewport: {
|
|
44
|
+
width: number;
|
|
45
|
+
height: number;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The colour scheme the page was in, which rrweb doesn't record: the replay shows it in the same, or a
|
|
49
|
+
* page styled by `prefers-color-scheme` would take the replay's.
|
|
50
|
+
*/
|
|
51
|
+
colorScheme?: 'light' | 'dark';
|
|
52
|
+
startedAt: number;
|
|
53
|
+
duration: number;
|
|
54
|
+
events: unknown[];
|
|
55
|
+
/** The mic's clips, played along with the replay. */
|
|
56
|
+
voice?: VoiceClip[];
|
|
57
|
+
}
|
|
58
|
+
declare module 'deictic' {
|
|
59
|
+
interface ServerApis {
|
|
60
|
+
recordings: Recordings;
|
|
61
|
+
}
|
|
62
|
+
interface ClientApis {
|
|
63
|
+
recordings: Recorder;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
interface RecordingsOptions extends Masking {
|
|
67
|
+
/** How many recordings to keep, the latest: 20 by default. */
|
|
68
|
+
keep?: number;
|
|
69
|
+
/** Where they're kept, from the project's root: `.deictic/recordings` by default. */
|
|
70
|
+
dir?: string;
|
|
71
|
+
}
|
|
72
|
+
declare function recordings(options?: RecordingsOptions): import("deictic").ServerPlugin<never, never, never, Recordings>;
|
|
73
|
+
export { RecordingsOptions as a, MARKS as c, Recordings as i, Recorder as n, VoiceClip as o, Recording as r, recordings as s, Kept as t };
|
|
74
|
+
//# sourceMappingURL=index4.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index4.d.ts","names":[],"sources":["../src/plugins/recordings/marks.ts","../src/plugins/recordings/index.ts"],"mappings":";;;;;cAIa;;UCkBI;EACf;EACA;EACA;;EAEA,QAAQ;;;UAIO;EACf;EACA;EACA;;;UAIe;;;;;EAKf,UAAU,QAAQ;;EAElB;;;UAIe;;EAEf,KAAK;IAAe,MAAM,WAAW;IAAc;IAAc;;;;UAIlD;EACf;EACA;IAAY;IAAe;;;;;;EAK3B;EACA;EACA;EACA;;EAEA,QAAQ;;;YAIE;IACR,YAAY;;YAEJ;IACR,YAAY;;;UAIC,0BAA0B;;EAEzC;;EAEA;;iBAiBc,WAAW,UAAS,sCAAsB,kCAAA"}
|
package/dist/index5.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { C as Shortcut } from "./index.js";
|
|
2
|
+
/** A class as the panel shows it. */
|
|
3
|
+
interface ClassInfo {
|
|
4
|
+
name: string;
|
|
5
|
+
/** Whether Tailwind makes anything of it: a class of the project's own isn't known. */
|
|
6
|
+
known: boolean;
|
|
7
|
+
/** The colour it sets, as CSS. */
|
|
8
|
+
color?: string;
|
|
9
|
+
/** What it sets its main property to, theme values resolved: `0.875rem`. */
|
|
10
|
+
value?: string;
|
|
11
|
+
/** A variant to go on typing after (`hover:`), not a class. */
|
|
12
|
+
variant?: true;
|
|
13
|
+
}
|
|
14
|
+
/** The classes of one kind, and how to write one with a value of the user's own. */
|
|
15
|
+
interface Alternatives {
|
|
16
|
+
/** The property the kind sets: `font-size`. */
|
|
17
|
+
label: string;
|
|
18
|
+
/** Whether the kind is a colour's, shown as swatches. */
|
|
19
|
+
colors: boolean;
|
|
20
|
+
items: ClassInfo[];
|
|
21
|
+
/** A custom value goes between these: `md:text-[` and `]`. None for a kind that takes no value (`flex`). */
|
|
22
|
+
custom?: {
|
|
23
|
+
before: string;
|
|
24
|
+
after: string;
|
|
25
|
+
value?: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
interface TailwindOptions {
|
|
29
|
+
/** Calls whose first argument is a class list: `cn`, `clsx`, `cx`, `twMerge`, `classNames` by default. */
|
|
30
|
+
helpers?: string[];
|
|
31
|
+
/** The attribute an element without one gets: `className`, or `class` for Solid and Preact. */
|
|
32
|
+
attribute?: 'className' | 'class';
|
|
33
|
+
/**
|
|
34
|
+
* The stylesheet that imports Tailwind and holds the theme, from the project's root: `src/index.css`. What
|
|
35
|
+
* the panel completes and shows comes from it. Tailwind's default theme without one.
|
|
36
|
+
*/
|
|
37
|
+
css?: string;
|
|
38
|
+
/** What opens its tab directly, beside deictic's own shortcut, which opens any: none by default. */
|
|
39
|
+
shortcut?: Shortcut;
|
|
40
|
+
}
|
|
41
|
+
type Model = {
|
|
42
|
+
editable: true;
|
|
43
|
+
classes: string;
|
|
44
|
+
/** The helper's other arguments, which add classes at runtime, each read as far as the source says. */
|
|
45
|
+
others?: Extra[];
|
|
46
|
+
} | {
|
|
47
|
+
editable: false;
|
|
48
|
+
source: string;
|
|
49
|
+
};
|
|
50
|
+
/** Classes a helper's argument adds: `active && 'ring'` is `ring` when `active`. */
|
|
51
|
+
interface Extra {
|
|
52
|
+
/** The argument, or the part of it these classes come from, as written. */
|
|
53
|
+
source: string;
|
|
54
|
+
/** The classes, where the source spells them out: there, or in a `const` of the file it names. */
|
|
55
|
+
classes?: string;
|
|
56
|
+
/** What must hold for them to be added, as written: `active === 'h3'`. None where they always are. */
|
|
57
|
+
when?: string;
|
|
58
|
+
/** Set where the classes are a string in this file, which an op with `at` can write. */
|
|
59
|
+
editable?: true;
|
|
60
|
+
/** The `const` the string is in, where it isn't the argument itself: other elements may use it too. */
|
|
61
|
+
shared?: string;
|
|
62
|
+
}
|
|
63
|
+
interface Op {
|
|
64
|
+
classes: string;
|
|
65
|
+
/** Which of the model's `others` the classes are for, by its place there. The element's own list without. */
|
|
66
|
+
at?: number;
|
|
67
|
+
}
|
|
68
|
+
declare function tailwind(options?: TailwindOptions): import("deictic").ServerPlugin<Model, Op, unknown, unknown>;
|
|
69
|
+
export { tailwind as a, TailwindOptions as i, Model as n, Alternatives as o, Op as r, ClassInfo as s, Extra as t };
|
|
70
|
+
//# sourceMappingURL=index5.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index5.d.ts","names":[],"sources":["../src/plugins/tailwind/catalog.ts","../src/plugins/tailwind/index.ts"],"mappings":";;UAeiB;EACf;;EAEA;;EAEA;;EAEA;;EAEA;;;UAIe;;EAEf;;EAEA;EACA,OAAO;;EAEP;IAAW;IAAgB;IAAe;;;UCf3B;;EAEf;;EAEA;;;;;EAKA;;EAEA,WAAW;;KAGD;EAEN;EACA;;EAEA,SAAS;;EAET;EAAiB;;;UAGN;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;UAGe;EACf;;EAEA;;iBASc,SAAS,UAAS,oCAAoB,aAAA,OAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { C as Shortcut, g as ServerPlugin } from "./index.js";
|
|
2
|
+
import "magic-string";
|
|
3
|
+
import "oxc-parser";
|
|
4
|
+
interface DeicticOptions {
|
|
5
|
+
/** The plugins to load, server halves: `tailwind()`, `tasks()`, your own. None by default. */
|
|
6
|
+
plugins?: ServerPlugin[];
|
|
7
|
+
/**
|
|
8
|
+
* What opens the popup on any plugin, at the tab used last: Alt and the left button by default, or
|
|
9
|
+
* `false` for none, leaving only plugins' own shortcuts.
|
|
10
|
+
*/
|
|
11
|
+
shortcut?: Shortcut | false;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The client module: the overlay, started with deictic's own shortcut and each plugin that has a half
|
|
15
|
+
* in the page, with its shortcut, checked.
|
|
16
|
+
*/
|
|
17
|
+
declare const clientModule: (plugins: ServerPlugin[], base: string, own?: Shortcut | false) => string;
|
|
18
|
+
export { clientModule as n, DeicticOptions as t };
|
|
19
|
+
//# sourceMappingURL=integration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration.d.ts","names":[],"sources":["../src/tools/integration.ts"],"mappings":";;;UAmBiB;;EAEf,UAAU;;;;;EAKV,WAAW;;;;;;cAcA,eAAY,SAAa,gBAAc,cAAc,MAAQ"}
|