deictic 0.0.1 → 0.2.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 +167 -0
- 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 +95 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +1333 -0
- package/dist/client/index.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +10 -0
- package/dist/index.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/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/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/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/shared/endpoints.js +354 -0
- package/dist/shared/endpoints.js.map +1 -0
- package/dist/shared/index.d.ts +226 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index2.d.ts +98 -0
- package/dist/shared/index2.d.ts.map +1 -0
- package/dist/shared/index3.d.ts +86 -0
- package/dist/shared/index3.d.ts.map +1 -0
- package/dist/shared/index4.d.ts +184 -0
- package/dist/shared/index4.d.ts.map +1 -0
- package/dist/shared/index5.d.ts +70 -0
- package/dist/shared/index5.d.ts.map +1 -0
- package/dist/shared/integration.d.ts +20 -0
- package/dist/shared/integration.d.ts.map +1 -0
- package/dist/shared/integration.js +279 -0
- package/dist/shared/integration.js.map +1 -0
- package/dist/shared/kept.js +23 -0
- package/dist/shared/kept.js.map +1 -0
- package/dist/shared/marks.js +14 -0
- package/dist/shared/marks.js.map +1 -0
- package/dist/shared/playwright.js +105 -0
- package/dist/shared/playwright.js.map +1 -0
- package/dist/shared/recordings.js +246 -0
- package/dist/shared/recordings.js.map +1 -0
- package/dist/shared/shortcut.js +63 -0
- package/dist/shared/shortcut.js.map +1 -0
- package/dist/shared/tasks.js +521 -0
- package/dist/shared/tasks.js.map +1 -0
- package/dist/shared/waveform.js +93 -0
- package/dist/shared/waveform.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 +2 -0
- package/dist/tasks/index.js +1 -0
- package/dist/vite.d.ts +16 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +61 -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/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 +307 -7
- package/skills/deictic/SKILL.md +47 -0
- package/skills/deictic/references/install.md +96 -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 +211 -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 +846 -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 +247 -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 +316 -0
- package/src/plugins/recordings/index.ts +175 -0
- package/src/plugins/recordings/marks.ts +11 -0
- package/src/plugins/recordings/ours.ts +70 -0
- package/src/plugins/recordings/replay.ts +165 -0
- package/src/plugins/screenshots/client.ts +64 -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 +557 -0
- package/src/plugins/tasks/local.ts +170 -0
- package/src/plugins/voice/client.ts +58 -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 +108 -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 +81 -0
- package/src/webpack.ts +107 -0
- package/index.js +0 -1
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `deictic/annotations`: mark up the page itself. Its tab is annotate
|
|
3
|
+
* mode over the page: boxes, arrows, a pen and notes, drawn where the page is, so they stay with
|
|
4
|
+
* it as it scrolls. They're kept for the tab's session, per page, until cleared.
|
|
5
|
+
*
|
|
6
|
+
* They're data other plugins build on, through `use('annotations')` in the page: screenshots draw them
|
|
7
|
+
* over the page (`svg(area)`), tasks repeat their notes, and a recording can keep each change as it
|
|
8
|
+
* happens (`subscribe`). Nothing of it runs on the server.
|
|
9
|
+
*/
|
|
10
|
+
import { w as Shortcut } from "../shared/index.js";
|
|
11
|
+
/** A point in page coordinates: CSS pixels from the document's top left, so it stays put as the page scrolls. */
|
|
12
|
+
export interface Point {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
}
|
|
16
|
+
/** A rectangle: in page coordinates for a shape, in viewport coordinates for an area to draw. */
|
|
17
|
+
export interface Area {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
}
|
|
23
|
+
export type Shape = ({
|
|
24
|
+
kind: 'box';
|
|
25
|
+
} & Area) | {
|
|
26
|
+
kind: 'arrow';
|
|
27
|
+
from: Point;
|
|
28
|
+
to: Point;
|
|
29
|
+
} | {
|
|
30
|
+
kind: 'pen';
|
|
31
|
+
points: Point[];
|
|
32
|
+
} | {
|
|
33
|
+
kind: 'note';
|
|
34
|
+
at: Point;
|
|
35
|
+
text: string;
|
|
36
|
+
};
|
|
37
|
+
export interface Annotation {
|
|
38
|
+
id: string;
|
|
39
|
+
color: string;
|
|
40
|
+
shape: Shape;
|
|
41
|
+
/** When it was made, as `Date.now()`. */
|
|
42
|
+
at: number;
|
|
43
|
+
}
|
|
44
|
+
/** A change, as `subscribe` hears it: what a recording keeps, to show the marks as they were made. */
|
|
45
|
+
export type AnnotationEvent = {
|
|
46
|
+
type: 'add';
|
|
47
|
+
annotation: Annotation;
|
|
48
|
+
} | {
|
|
49
|
+
type: 'remove';
|
|
50
|
+
id: string;
|
|
51
|
+
} | {
|
|
52
|
+
type: 'clear';
|
|
53
|
+
};
|
|
54
|
+
/** The page's half, for other plugins' page halves. */
|
|
55
|
+
export interface Annotations {
|
|
56
|
+
/** Every annotation on this page, oldest first. */
|
|
57
|
+
list(): Annotation[];
|
|
58
|
+
add(shape: Shape, color?: string): Annotation;
|
|
59
|
+
remove(id: string): void;
|
|
60
|
+
clear(): void;
|
|
61
|
+
/** Hears every change from now on; answers what stops it. */
|
|
62
|
+
subscribe(listener: (event: AnnotationEvent) => void): () => void;
|
|
63
|
+
/**
|
|
64
|
+
* The annotations over a part of the viewport, in viewport CSS pixels, as an SVG that size: what a
|
|
65
|
+
* screenshot of that area draws over it. Nothing when there are none.
|
|
66
|
+
*/
|
|
67
|
+
svg(area: Area): string | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* Opens a picture (a screenshot, most often) over everything, with the toolbar, to draw on: answers the
|
|
70
|
+
* marks, in the picture's CSS pixels, on Save, and nothing on Cancel, Esc or `signal`. It starts from
|
|
71
|
+
* `marks`, to edit them again. They're the picture's alone, not the page's.
|
|
72
|
+
*/
|
|
73
|
+
edit(picture: Picture, marks?: readonly Annotation[], options?: {
|
|
74
|
+
signal?: AbortSignal;
|
|
75
|
+
}): Promise<Annotation[] | undefined>;
|
|
76
|
+
/** The picture with the marks drawn over it, as a PNG at the picture's own resolution. */
|
|
77
|
+
flatten(picture: Picture, marks: readonly Annotation[]): Promise<Blob>;
|
|
78
|
+
/**
|
|
79
|
+
* Annotate mode's tools, for another plugin's UI to show (a recording's toolbar): a pointer tool, picked
|
|
80
|
+
* to start with, leaves the page usable; while a drawing tool is picked, the page is drawn on. What's
|
|
81
|
+
* drawn is its own `marks`, not the page's: shown while it's open, kept by nothing, gone on `close`.
|
|
82
|
+
*/
|
|
83
|
+
tools(): {
|
|
84
|
+
element: HTMLElement;
|
|
85
|
+
marks: MarkSet;
|
|
86
|
+
close: () => void;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/** A set of marks on the page: the page's own, kept for the session, or a toolbar's, kept by nothing. */
|
|
90
|
+
export type MarkSet = Pick<Annotations, 'list' | 'add' | 'remove' | 'clear' | 'subscribe' | 'svg'>;
|
|
91
|
+
/** An image to draw on: where it loads from (the page's origin, so a canvas may read it), and its size in CSS pixels, which marks on it are in. */
|
|
92
|
+
export interface Picture {
|
|
93
|
+
url: string;
|
|
94
|
+
width: number;
|
|
95
|
+
height: number;
|
|
96
|
+
}
|
|
97
|
+
declare module 'deictic' {
|
|
98
|
+
interface ClientApis {
|
|
99
|
+
annotations: Annotations;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
export interface AnnotationsOptions {
|
|
103
|
+
/** What opens its tab directly, beside deictic's own shortcut, which opens any: none by default. */
|
|
104
|
+
shortcut?: Shortcut;
|
|
105
|
+
/** The colour marks are drawn in: a red that deictic's own green isn't. */
|
|
106
|
+
color?: string;
|
|
107
|
+
}
|
|
108
|
+
export declare function annotations(options?: AnnotationsOptions): import("deictic").ServerPlugin<unknown, unknown, unknown, unknown>;
|
|
109
|
+
export { annotations as default };
|
|
110
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/plugins/annotations/index.ts"],"mappings":";;;;;;;;;;;iBAYiB;EACf;EACA;;;iBAIe;EACf;EACA;EACA;EACA;;YAGU;EACL;IAAgB;EACjB;EAAe,MAAM;EAAO,IAAI;;EAChC;EAAa,QAAQ;;EACrB;EAAc,IAAI;EAAO;;iBAEd;EACf;EACA;EACA,OAAO;;EAEP;;;YAIU;EAAoB;EAAa,YAAY;;EAAiB;EAAgB;;EAAiB;;;iBAG1F;;EAEf,QAAQ;EACR,IAAI,OAAO,OAAO,iBAAiB;EACnC,OAAO;EACP;;EAEA,UAAU,WAAW,OAAO;;;;;EAK5B,IAAI,MAAM;;;;;;EAMV,KAAK,SAAS,SAAS,iBAAiB,cAAc;IAAY,SAAS;MAAgB,QAAQ;;EAEnG,QAAQ,SAAS,SAAS,gBAAgB,eAAe,QAAQ;;;;;;EAMjE;IAAW,SAAS;IAAa,OAAO;IAAS;;;;YAIvC,UAAU,KAAK;;iBAGV;EACf;EACA;EACA;;;YAIU;IACR,aAAa;;;iBAIA;;EAEf,WAAW;;EAEX;;wBAGc,YAAY,UAAS,uCAAuB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { definePlugin } from "../index.js";
|
|
2
|
+
// src/plugins/annotations/index.ts
|
|
3
|
+
/**
|
|
4
|
+
* `deictic/annotations`: mark up the page itself. Its tab is annotate
|
|
5
|
+
* mode over the page: boxes, arrows, a pen and notes, drawn where the page is, so they stay with
|
|
6
|
+
* it as it scrolls. They're kept for the tab's session, per page, until cleared.
|
|
7
|
+
*
|
|
8
|
+
* They're data other plugins build on, through `use('annotations')` in the page: screenshots draw them
|
|
9
|
+
* over the page (`svg(area)`), tasks repeat their notes, and a recording can keep each change as it
|
|
10
|
+
* happens (`subscribe`). Nothing of it runs on the server.
|
|
11
|
+
*/
|
|
12
|
+
function annotations(options = {}) {
|
|
13
|
+
return definePlugin({
|
|
14
|
+
name: "annotations",
|
|
15
|
+
client: "deictic/annotations/client",
|
|
16
|
+
shortcut: options.shortcut,
|
|
17
|
+
clientOptions: { color: options.color ?? "#ef4444" }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export { annotations, annotations as default };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/plugins/annotations/index.ts"],"sourcesContent":["/**\n * `deictic/annotations`: mark up the page itself. Its tab is annotate\n * mode over the page: boxes, arrows, a pen and notes, drawn where the page is, so they stay with\n * it as it scrolls. They're kept for the tab's session, per page, until cleared.\n *\n * They're data other plugins build on, through `use('annotations')` in the page: screenshots draw them\n * over the page (`svg(area)`), tasks repeat their notes, and a recording can keep each change as it\n * happens (`subscribe`). Nothing of it runs on the server.\n */\nimport { definePlugin, type Shortcut } from '#src/index.ts';\n\n/** A point in page coordinates: CSS pixels from the document's top left, so it stays put as the page scrolls. */\nexport interface Point {\n x: number;\n y: number;\n}\n\n/** A rectangle: in page coordinates for a shape, in viewport coordinates for an area to draw. */\nexport interface Area {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\nexport type Shape =\n | ({ kind: 'box' } & Area)\n | { kind: 'arrow'; from: Point; to: Point }\n | { kind: 'pen'; points: Point[] }\n | { kind: 'note'; at: Point; text: string };\n\nexport interface Annotation {\n id: string;\n color: string;\n shape: Shape;\n /** When it was made, as `Date.now()`. */\n at: number;\n}\n\n/** A change, as `subscribe` hears it: what a recording keeps, to show the marks as they were made. */\nexport type AnnotationEvent = { type: 'add'; annotation: Annotation } | { type: 'remove'; id: string } | { type: 'clear' };\n\n/** The page's half, for other plugins' page halves. */\nexport interface Annotations {\n /** Every annotation on this page, oldest first. */\n list(): Annotation[];\n add(shape: Shape, color?: string): Annotation;\n remove(id: string): void;\n clear(): void;\n /** Hears every change from now on; answers what stops it. */\n subscribe(listener: (event: AnnotationEvent) => void): () => void;\n /**\n * The annotations over a part of the viewport, in viewport CSS pixels, as an SVG that size: what a\n * screenshot of that area draws over it. Nothing when there are none.\n */\n svg(area: Area): string | undefined;\n /**\n * Opens a picture (a screenshot, most often) over everything, with the toolbar, to draw on: answers the\n * marks, in the picture's CSS pixels, on Save, and nothing on Cancel, Esc or `signal`. It starts from\n * `marks`, to edit them again. They're the picture's alone, not the page's.\n */\n edit(picture: Picture, marks?: readonly Annotation[], options?: { signal?: AbortSignal }): Promise<Annotation[] | undefined>;\n /** The picture with the marks drawn over it, as a PNG at the picture's own resolution. */\n flatten(picture: Picture, marks: readonly Annotation[]): Promise<Blob>;\n /**\n * Annotate mode's tools, for another plugin's UI to show (a recording's toolbar): a pointer tool, picked\n * to start with, leaves the page usable; while a drawing tool is picked, the page is drawn on. What's\n * drawn is its own `marks`, not the page's: shown while it's open, kept by nothing, gone on `close`.\n */\n tools(): { element: HTMLElement; marks: MarkSet; close: () => void };\n}\n\n/** A set of marks on the page: the page's own, kept for the session, or a toolbar's, kept by nothing. */\nexport type MarkSet = Pick<Annotations, 'list' | 'add' | 'remove' | 'clear' | 'subscribe' | 'svg'>;\n\n/** An image to draw on: where it loads from (the page's origin, so a canvas may read it), and its size in CSS pixels, which marks on it are in. */\nexport interface Picture {\n url: string;\n width: number;\n height: number;\n}\n\ndeclare module 'deictic' {\n interface ClientApis {\n annotations: Annotations;\n }\n}\n\nexport interface AnnotationsOptions {\n /** What opens its tab directly, beside deictic's own shortcut, which opens any: none by default. */\n shortcut?: Shortcut;\n /** The colour marks are drawn in: a red that deictic's own green isn't. */\n color?: string;\n}\n\nexport function annotations(options: AnnotationsOptions = {}) {\n return definePlugin({\n name: 'annotations',\n client: 'deictic/annotations/client',\n shortcut: options.shortcut,\n clientOptions: { color: options.color ?? '#ef4444' },\n });\n}\n\nexport default annotations;\n"],"mappings":";;;;;;;;;;;AA+FA,SAAgB,YAAY,UAA8B,CAAC,GAAG;CAC5D,OAAO,aAAa;EAClB,MAAM;EACN,QAAQ;EACR,UAAU,QAAQ;EAClB,eAAe,EAAE,OAAO,QAAQ,SAAS,UAAU;CACrD,CAAC;AACH"}
|
package/dist/astro.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `deictic/astro`: the Vite plugin (`vite.ts`) in `astro dev`, and the overlay on every page.
|
|
3
|
+
*
|
|
4
|
+
* Astro renders a page on the server and may send it with no script at all, so nothing in the browser
|
|
5
|
+
* would import the client module, which under Vite comes with the first JSX module. The integration
|
|
6
|
+
* injects it into every page instead. JSX components (React's, Preact's, Solid's) are marked, on the
|
|
7
|
+
* server and in islands, and with Astro 7, whose parser says where their tags are, `.astro` components
|
|
8
|
+
* too (`tools/astro.ts`).
|
|
9
|
+
*/
|
|
10
|
+
import { t as DeicticOptions } from "./shared/integration.js";
|
|
11
|
+
import "./vite.js";
|
|
12
|
+
/** What the integration reads of Astro's setup hook: Astro's own types, as far as they're used here. */
|
|
13
|
+
interface Setup {
|
|
14
|
+
command: 'dev' | 'build' | 'preview' | 'sync';
|
|
15
|
+
updateConfig: (config: {
|
|
16
|
+
vite: {
|
|
17
|
+
plugins: unknown[];
|
|
18
|
+
};
|
|
19
|
+
}) => void;
|
|
20
|
+
injectScript: (stage: 'page', content: string) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare function deictic(options?: DeicticOptions): {
|
|
23
|
+
name: string;
|
|
24
|
+
hooks: {
|
|
25
|
+
'astro:config:setup': ({ command, updateConfig, injectScript }: Setup) => void;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export { type DeicticOptions as DeicticIntegrationOptions, deictic as default };
|
|
29
|
+
//# sourceMappingURL=astro.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"astro.d.ts","names":[],"sources":["../src/astro.ts"],"mappings":";;;;;;;;;;;;UAcU;EACR;EACA,eAAe;IAAU;MAAQ;;;EACjC,eAAe,eAAe;;wBAGhB,QAAQ,UAAS;EAE7B;EACA;IACE,yBAAoB,SAAA,cAAA,gBAA4C"}
|
package/dist/astro.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import deictic$1, { CLIENT } from "./vite.js";
|
|
2
|
+
// src/astro.ts
|
|
3
|
+
/**
|
|
4
|
+
* `deictic/astro`: the Vite plugin (`vite.ts`) in `astro dev`, and the overlay on every page.
|
|
5
|
+
*
|
|
6
|
+
* Astro renders a page on the server and may send it with no script at all, so nothing in the browser
|
|
7
|
+
* would import the client module, which under Vite comes with the first JSX module. The integration
|
|
8
|
+
* injects it into every page instead. JSX components (React's, Preact's, Solid's) are marked, on the
|
|
9
|
+
* server and in islands, and with Astro 7, whose parser says where their tags are, `.astro` components
|
|
10
|
+
* too (`tools/astro.ts`).
|
|
11
|
+
*/
|
|
12
|
+
function deictic(options = {}) {
|
|
13
|
+
return {
|
|
14
|
+
name: "deictic",
|
|
15
|
+
hooks: { "astro:config:setup": ({ command, updateConfig, injectScript }) => {
|
|
16
|
+
if (command !== "dev") return;
|
|
17
|
+
updateConfig({ vite: { plugins: [deictic$1(options)] } });
|
|
18
|
+
injectScript("page", `import ${JSON.stringify(CLIENT)};`);
|
|
19
|
+
} }
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export { deictic as default, deictic };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=astro.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"astro.js","names":["vitePlugin"],"sources":["../src/astro.ts"],"sourcesContent":["/**\n * `deictic/astro`: the Vite plugin (`vite.ts`) in `astro dev`, and the overlay on every page.\n *\n * Astro renders a page on the server and may send it with no script at all, so nothing in the browser\n * would import the client module, which under Vite comes with the first JSX module. The integration\n * injects it into every page instead. JSX components (React's, Preact's, Solid's) are marked, on the\n * server and in islands, and with Astro 7, whose parser says where their tags are, `.astro` components\n * too (`tools/astro.ts`).\n */\nimport { CLIENT, deictic as vitePlugin, type DeicticOptions } from './vite.ts';\n\nexport type { DeicticOptions as DeicticIntegrationOptions };\n\n/** What the integration reads of Astro's setup hook: Astro's own types, as far as they're used here. */\ninterface Setup {\n command: 'dev' | 'build' | 'preview' | 'sync';\n updateConfig: (config: { vite: { plugins: unknown[] } }) => void;\n injectScript: (stage: 'page', content: string) => void;\n}\n\nexport function deictic(options: DeicticOptions = {}) {\n return {\n name: 'deictic',\n hooks: {\n 'astro:config:setup': ({ command, updateConfig, injectScript }: Setup) => {\n if (command !== 'dev') return;\n updateConfig({ vite: { plugins: [vitePlugin(options)] } });\n injectScript('page', `import ${JSON.stringify(CLIENT)};`);\n },\n },\n };\n}\n\nexport default deictic;\n"],"mappings":";;;;;;;;;;;AAoBA,SAAgB,QAAQ,UAA0B,CAAC,GAAG;CACpD,OAAO;EACL,MAAM;EACN,OAAO,EACL,uBAAuB,EAAE,SAAS,cAAc,mBAA0B;GACxE,IAAI,YAAY,OAAO;GACvB,aAAa,EAAE,MAAM,EAAE,SAAS,CAACA,UAAW,OAAO,CAAC,EAAE,EAAE,CAAC;GACzD,aAAa,QAAQ,UAAU,KAAK,UAAU,MAAM,EAAE,EAAE;EAC1D,EACF;CACF;AACF"}
|
package/dist/bun.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BunPlugin } from "bun";
|
|
2
|
+
import { t as DeicticOptions } from "./shared/integration.js";
|
|
3
|
+
export interface DeicticBunOptions extends DeicticOptions {
|
|
4
|
+
/** The project's root, which marks and edits are from: the working directory by default. */
|
|
5
|
+
root?: string;
|
|
6
|
+
}
|
|
7
|
+
export type DeicticBunPlugin = BunPlugin & {
|
|
8
|
+
/** The endpoints, as `Bun.serve` routes: `routes: { ...plugin.routes, '/*': index }`. */
|
|
9
|
+
routes: Record<string, (req: Request) => Promise<Response>>;
|
|
10
|
+
};
|
|
11
|
+
export declare function deictic(options?: DeicticBunOptions): DeicticBunPlugin;
|
|
12
|
+
//# sourceMappingURL=bun.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bun.d.ts","names":[],"sources":["../src/bun.ts"],"mappings":";;iBA0BiB,0BAA0B;;EAEzC;;YAGU,mBAAmB;;EAE7B,QAAQ,gBAAgB,KAAK,YAAY,QAAQ;;wBAGnC,QAAQ,UAAS,oBAAyB"}
|
package/dist/bun.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { t as endpoints } from "./shared/endpoints.js";
|
|
3
|
+
import { d as JSX, i as mark, o as prepare, r as importOf, s as writeClient } from "./shared/integration.js";
|
|
4
|
+
// src/bun.ts
|
|
5
|
+
/**
|
|
6
|
+
* `deictic/bun`: deictic in Bun's dev server, the bundler `Bun.serve` runs for HTML imports. Nothing
|
|
7
|
+
* runs in `Bun.build`.
|
|
8
|
+
*
|
|
9
|
+
* Named in bunfig.toml's `[serve.static] plugins`, it marks each JSX module as it loads, and in the
|
|
10
|
+
* browser appends the import of the client module, written to `.deictic/client.js`, as Bun has no
|
|
11
|
+
* virtual modules for it. A bundler plugin can't add routes to the server, so the endpoints are the
|
|
12
|
+
* plugin's `routes`, spread into `Bun.serve`'s; a place opens in the editor `Bun.openInEditor` finds.
|
|
13
|
+
*
|
|
14
|
+
* bunfig names a module whose default export is the plugin, so the plugin lives in a file of its own,
|
|
15
|
+
* which the server imports too, for its routes:
|
|
16
|
+
*
|
|
17
|
+
* // deictic.ts
|
|
18
|
+
* export default deictic({ plugins: [tailwind()] });
|
|
19
|
+
* // server.ts
|
|
20
|
+
* import tools from './deictic.ts';
|
|
21
|
+
* Bun.serve({ routes: { ...tools.routes, '/*': index }, development: true });
|
|
22
|
+
*/
|
|
23
|
+
function deictic(options = {}) {
|
|
24
|
+
const { plugins, shortcut } = prepare(options);
|
|
25
|
+
const root = resolve(options.root ?? process.cwd());
|
|
26
|
+
let handle;
|
|
27
|
+
const route = async (req) => {
|
|
28
|
+
handle ??= endpoints({
|
|
29
|
+
root,
|
|
30
|
+
plugins,
|
|
31
|
+
open: (path, { line, column }) => {
|
|
32
|
+
try {
|
|
33
|
+
Bun.openInEditor(path, {
|
|
34
|
+
line,
|
|
35
|
+
column
|
|
36
|
+
});
|
|
37
|
+
return new Response(null, { status: 204 });
|
|
38
|
+
} catch (e) {
|
|
39
|
+
return new Response(`${e instanceof Error ? e.message : String(e)}: set VISUAL or EDITOR to the editor's command`, { status: 500 });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
return await handle(req) ?? new Response(null, { status: 404 });
|
|
44
|
+
};
|
|
45
|
+
return {
|
|
46
|
+
name: "deictic",
|
|
47
|
+
routes: { "/__deictic/*": route },
|
|
48
|
+
setup(build) {
|
|
49
|
+
if ("entrypoints" in build.config) return;
|
|
50
|
+
const client = writeClient(root, plugins, "/", shortcut);
|
|
51
|
+
const forBrowser = (args) => !("side" in args) || args.side === "client";
|
|
52
|
+
build.onLoad({ filter: JSX }, async (args) => {
|
|
53
|
+
if (/[\\/]node_modules[\\/]/.test(args.path)) return void 0;
|
|
54
|
+
const code = await Bun.file(args.path).text();
|
|
55
|
+
const marked = mark(code, args.path, root, forBrowser(args) ? importOf(client, args.path) : "");
|
|
56
|
+
if (marked === void 0) return void 0;
|
|
57
|
+
return {
|
|
58
|
+
contents: marked.code,
|
|
59
|
+
loader: args.path.endsWith("tsx") ? "tsx" : "jsx"
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export { deictic };
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=bun.js.map
|
package/dist/bun.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bun.js","names":[],"sources":["../src/bun.ts"],"sourcesContent":["/**\n * `deictic/bun`: deictic in Bun's dev server, the bundler `Bun.serve` runs for HTML imports. Nothing\n * runs in `Bun.build`.\n *\n * Named in bunfig.toml's `[serve.static] plugins`, it marks each JSX module as it loads, and in the\n * browser appends the import of the client module, written to `.deictic/client.js`, as Bun has no\n * virtual modules for it. A bundler plugin can't add routes to the server, so the endpoints are the\n * plugin's `routes`, spread into `Bun.serve`'s; a place opens in the editor `Bun.openInEditor` finds.\n *\n * bunfig names a module whose default export is the plugin, so the plugin lives in a file of its own,\n * which the server imports too, for its routes:\n *\n * // deictic.ts\n * export default deictic({ plugins: [tailwind()] });\n * // server.ts\n * import tools from './deictic.ts';\n * Bun.serve({ routes: { ...tools.routes, '/*': index }, development: true });\n */\nimport { resolve } from 'node:path';\n\nimport type { BunPlugin } from 'bun';\n\nimport { endpoints } from './tools/endpoints.ts';\nimport { type DeicticOptions, importOf, mark, prepare, writeClient } from './tools/integration.ts';\nimport { JSX } from './tools/locate.ts';\n\nexport interface DeicticBunOptions extends DeicticOptions {\n /** The project's root, which marks and edits are from: the working directory by default. */\n root?: string;\n}\n\nexport type DeicticBunPlugin = BunPlugin & {\n /** The endpoints, as `Bun.serve` routes: `routes: { ...plugin.routes, '/*': index }`. */\n routes: Record<string, (req: Request) => Promise<Response>>;\n};\n\nexport function deictic(options: DeicticBunOptions = {}): DeicticBunPlugin {\n // Now, so a wrong set of plugins stops the dev server as it starts, rather than the page.\n const { plugins, shortcut } = prepare(options);\n const root = resolve(options.root ?? process.cwd());\n let handle: ((req: Request) => Promise<Response | undefined>) | undefined;\n const route = async (req: Request) => {\n handle ??= endpoints({\n root,\n plugins,\n open: (path, { line, column }) => {\n try {\n Bun.openInEditor(path, { line, column });\n return new Response(null, { status: 204 });\n } catch (e) {\n return new Response(`${e instanceof Error ? e.message : String(e)}: set VISUAL or EDITOR to the editor's command`, {\n status: 500,\n });\n }\n },\n });\n return (await handle(req)) ?? new Response(null, { status: 404 });\n };\n\n return {\n name: 'deictic',\n routes: { '/__deictic/*': route },\n setup(build) {\n // A build names its entry points; the dev server's bundler doesn't.\n if ('entrypoints' in build.config) return;\n const client = writeClient(root, plugins, '/', shortcut);\n // Bun names the side it loads a module for (undocumented, and not in Bun's types); the dev server's is the browser's.\n const forBrowser = (args: object) => !('side' in args) || args.side === 'client';\n build.onLoad({ filter: JSX }, async (args) => {\n // A dependency's is left to Bun, unread.\n if (/[\\\\/]node_modules[\\\\/]/.test(args.path)) return undefined;\n const code = await Bun.file(args.path).text();\n const marked = mark(code, args.path, root, forBrowser(args) ? importOf(client, args.path) : '');\n if (marked === undefined) return undefined;\n return { contents: marked.code, loader: args.path.endsWith('tsx') ? 'tsx' : 'jsx' };\n });\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAgB,QAAQ,UAA6B,CAAC,GAAqB;CAEzE,MAAM,EAAE,SAAS,aAAa,QAAQ,OAAO;CAC7C,MAAM,OAAO,QAAQ,QAAQ,QAAQ,QAAQ,IAAI,CAAC;CAClD,IAAI;CACJ,MAAM,QAAQ,OAAO,QAAiB;EACpC,WAAW,UAAU;GACnB;GACA;GACA,OAAO,MAAM,EAAE,MAAM,aAAa;IAChC,IAAI;KACF,IAAI,aAAa,MAAM;MAAE;MAAM;KAAO,CAAC;KACvC,OAAO,IAAI,SAAS,MAAM,EAAE,QAAQ,IAAI,CAAC;IAC3C,SAAS,GAAG;KACV,OAAO,IAAI,SAAS,GAAG,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,EAAE,iDAAiD,EACjH,QAAQ,IACV,CAAC;IACH;GACF;EACF,CAAC;EACD,OAAQ,MAAM,OAAO,GAAG,KAAM,IAAI,SAAS,MAAM,EAAE,QAAQ,IAAI,CAAC;CAClE;CAEA,OAAO;EACL,MAAM;EACN,QAAQ,EAAE,gBAAgB,MAAM;EAChC,MAAM,OAAO;GAEX,IAAI,iBAAiB,MAAM,QAAQ;GACnC,MAAM,SAAS,YAAY,MAAM,SAAS,KAAK,QAAQ;GAEvD,MAAM,cAAc,SAAiB,EAAE,UAAU,SAAS,KAAK,SAAS;GACxE,MAAM,OAAO,EAAE,QAAQ,IAAI,GAAG,OAAO,SAAS;IAE5C,IAAI,yBAAyB,KAAK,KAAK,IAAI,GAAG,OAAO,KAAA;IACrD,MAAM,OAAO,MAAM,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,KAAK;IAC5C,MAAM,SAAS,KAAK,MAAM,KAAK,MAAM,MAAM,WAAW,IAAI,IAAI,SAAS,QAAQ,KAAK,IAAI,IAAI,EAAE;IAC9F,IAAI,WAAW,KAAA,GAAW,OAAO,KAAA;IACjC,OAAO;KAAE,UAAU,OAAO;KAAM,QAAQ,KAAK,KAAK,SAAS,KAAK,IAAI,QAAQ;IAAM;GACpF,CAAC;EACH;CACF;AACF"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `deictic/client`: the overlay the page loads in dev. Hold a shortcut's keys (Alt, deictic's own,
|
|
3
|
+
* by default) and point: the element under the pointer that the source marked (`tools/locate.ts`) is
|
|
4
|
+
* outlined, with its tag, its place and how many elements share it. Press the shortcut's button to open
|
|
5
|
+
* the popup there: a tab for each plugin with a panel, at the one used last, or at a plugin's own where
|
|
6
|
+
* its shortcut was pressed.
|
|
7
|
+
*
|
|
8
|
+
* Everything drawn sits in one shadow root, so neither the page's styles nor ours cross over. A
|
|
9
|
+
* panel's undo and redo are its tab's on its element: the latest change that plugin made there.
|
|
10
|
+
*/
|
|
11
|
+
import { i as ClientPlugin, s as LightboxItem, v as Standalone, w as Shortcut, y as Target } from "../shared/index.js";
|
|
12
|
+
/**
|
|
13
|
+
* Waveforms: a clip's, read off its audio, drawn as bars with what's played in the accent; and a mic's live,
|
|
14
|
+
* a meter scrolling left as it hears. For the lightbox's player and whatever records the mic (the task
|
|
15
|
+
* panel's Voice, the recording toolbar's mic). Bars, not a line: they read at any size, and at a glance.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* How loud each of `bars` stretches of the clip at `url` is, from 0 to 1, the loudest 1, and how long it is in
|
|
19
|
+
* seconds: MediaRecorder's webm doesn't say until it's played through.
|
|
20
|
+
*/
|
|
21
|
+
export declare function peaksOf(url: string, bars: number): Promise<{
|
|
22
|
+
peaks: number[];
|
|
23
|
+
duration: number;
|
|
24
|
+
}>;
|
|
25
|
+
interface Colors {
|
|
26
|
+
/** What's played. */
|
|
27
|
+
played: string;
|
|
28
|
+
/** What isn't, yet. */
|
|
29
|
+
rest: string;
|
|
30
|
+
}
|
|
31
|
+
/** Draws `peaks` as bars across `canvas`, centred on its middle, the share `progress` (0–1) of them played. */
|
|
32
|
+
export declare function drawBars(canvas: HTMLCanvasElement, peaks: readonly number[], progress: number, colors: Colors): void;
|
|
33
|
+
/**
|
|
34
|
+
* The mic's level, live, as bars scrolling in from the right, drawn on `canvas` until the answer's called.
|
|
35
|
+
* It listens to `stream` on its own; the recording goes on as it was.
|
|
36
|
+
*/
|
|
37
|
+
export declare function liveWaveform(canvas: HTMLCanvasElement, stream: MediaStream, colors: Colors): () => void;
|
|
38
|
+
export interface StartOptions {
|
|
39
|
+
/** The dev server's base URL, ending in `/`. */
|
|
40
|
+
base: string;
|
|
41
|
+
/** deictic's own shortcut, checked: it opens the popup at the tab used last. None where it's turned off. */
|
|
42
|
+
shortcut?: Required<Shortcut>;
|
|
43
|
+
/** Each plugin with a half in the page, and its own shortcut as the bundler's plugin checked it, where it has one. */
|
|
44
|
+
plugins: {
|
|
45
|
+
plugin: ClientPlugin;
|
|
46
|
+
shortcut?: Required<Shortcut>;
|
|
47
|
+
options?: unknown;
|
|
48
|
+
}[];
|
|
49
|
+
/** What answers the requests where there's no dev server to: a `standalone` build's. */
|
|
50
|
+
server?: Standalone;
|
|
51
|
+
}
|
|
52
|
+
export declare function targetOf(el: Element): Target | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* What the page hears on `window` as the popup opens over it on an element (its `detail` a `PopupOpened`) and as
|
|
55
|
+
* it closes: for a page that moves on its own to hold still meanwhile, as deictic's site does. Not for one pinned.
|
|
56
|
+
*/
|
|
57
|
+
export declare const POPUP_OPENED = "deictic:open";
|
|
58
|
+
export declare const POPUP_CLOSED = "deictic:close";
|
|
59
|
+
export interface PopupOpened {
|
|
60
|
+
/** The element it's open on. */
|
|
61
|
+
element: Element;
|
|
62
|
+
/** The plugin whose tab it opened at. */
|
|
63
|
+
tab: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Opens the popup over the page on `element`, as deictic's own shortcut does: at `tab` (a plugin's name), or at the
|
|
67
|
+
* tab used last. For a page that opens it from a gesture of its own, as deictic's site does on a plain click.
|
|
68
|
+
* Answers whether it opened: not where no plugin has a tab, or `element` has no mark. The overlay must have started.
|
|
69
|
+
*/
|
|
70
|
+
export declare function openPopup(element: Element, { tab }?: {
|
|
71
|
+
tab?: string;
|
|
72
|
+
}): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Shows the popup in `container`, open at a tab (`tab`, a plugin's name, or the first) on `element`, where
|
|
75
|
+
* the page puts it rather than over the page: a page of the popup's states, to point at and fix, as deictic's
|
|
76
|
+
* own site does. It's the real popup, its tabs and plugins working. Closing it, or a tab's `away`, opens it
|
|
77
|
+
* again in place. It draws in `container`'s shadow root, made if there isn't one. Answers what removes it.
|
|
78
|
+
* The overlay must have started (the dev server's client module starts it), and `element` be marked.
|
|
79
|
+
*/
|
|
80
|
+
export declare function popupIn(container: Element, { tab: name, element }: {
|
|
81
|
+
tab?: string;
|
|
82
|
+
element: Element;
|
|
83
|
+
}): () => void;
|
|
84
|
+
/**
|
|
85
|
+
* Shows the lightbox in `container`, at `at`, where the page puts it rather than over everything: as `popupIn`
|
|
86
|
+
* does the popup, for a page of deictic's own states. Its items step with its arrows; there's no backdrop, close
|
|
87
|
+
* or keys, and an item's actions run without closing it. Answers what removes it.
|
|
88
|
+
*/
|
|
89
|
+
export declare function lightboxIn(container: Element, items: LightboxItem[], { at }?: {
|
|
90
|
+
at?: number;
|
|
91
|
+
}): () => void;
|
|
92
|
+
/** Starts the overlay, once per page: the client module runs again when a module importing it is replaced. */
|
|
93
|
+
export declare function start({ base, shortcut: own, plugins: given, server }: StartOptions): void;
|
|
94
|
+
export type { Colors };
|
|
95
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/client/waveform.ts","../../src/client/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;wBAUsB,QAAQ,aAAa,eAAe;EAAU;EAAiB;;UAsBpE;;EAEf;;EAEA;;;wBAIc,SAAS,QAAQ,mBAAmB,0BAA0B,kBAAkB,QAAQ;;;;;wBAoBxF,aAAa,QAAQ,mBAAmB,QAAQ,aAAa,QAAQ;iBCxCpE;;EAEf;;EAEA,WAAW,SAAS;;EAEpB;IAAW,QAAQ;IAAc,WAAW,SAAS;IAAW;;;EAEhE,SAAS;;wBA2BK,SAAS,IAAI,UAAU;;;;;qBA2C1B;qBACA;iBAEI;;EAEf,SAAS;;EAET;;;;;;;wBAQc,UAAU,SAAS,WAAW;EAAS;;;;;;;;;wBAYvC,QAAQ,WAAW,WAAW,KAAK,MAAM;EAAa;EAAc,SAAS;;;;;;;wBAkD7E,WAAW,WAAW,SAAS,OAAO,kBAAkB;EAAQ;;;wBAchE,QAAQ,MAAM,UAAU,KAAK,SAAS,OAAO,UAAU"}
|