deictic 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/API.md +303 -0
  2. package/README.md +56 -104
  3. package/dist/annotations/index.d.ts +1 -1
  4. package/dist/astro.d.ts +1 -1
  5. package/dist/bun.d.ts +1 -1
  6. package/dist/bun.js +2 -2
  7. package/dist/client/index.d.ts +4 -2
  8. package/dist/client/index.d.ts.map +1 -1
  9. package/dist/client/index.js +130 -16
  10. package/dist/client/index.js.map +1 -1
  11. package/dist/index.d.ts +21 -218
  12. package/dist/index.js.map +1 -1
  13. package/dist/loader.js +1 -1
  14. package/dist/logs/client.d.ts +4 -0
  15. package/dist/logs/client.d.ts.map +1 -0
  16. package/dist/logs/client.js +16 -0
  17. package/dist/logs/client.js.map +1 -0
  18. package/dist/logs/index.d.ts +18 -0
  19. package/dist/logs/index.d.ts.map +1 -0
  20. package/dist/logs/index.js +21 -0
  21. package/dist/logs/index.js.map +1 -0
  22. package/dist/network/client.d.ts +4 -0
  23. package/dist/network/client.d.ts.map +1 -0
  24. package/dist/network/client.js +29 -0
  25. package/dist/network/client.js.map +1 -0
  26. package/dist/network/index.d.ts +2 -0
  27. package/dist/network/index.js +39 -0
  28. package/dist/network/index.js.map +1 -0
  29. package/dist/next.d.ts +1 -1
  30. package/dist/next.js +2 -2
  31. package/dist/recommended/index.d.ts +15 -5
  32. package/dist/recommended/index.d.ts.map +1 -1
  33. package/dist/recommended/index.js +10 -3
  34. package/dist/recommended/index.js.map +1 -1
  35. package/dist/recordings/client.d.ts +1 -1
  36. package/dist/recordings/client.d.ts.map +1 -1
  37. package/dist/recordings/client.js +177 -48
  38. package/dist/recordings/client.js.map +1 -1
  39. package/dist/recordings/index.d.ts +2 -2
  40. package/dist/recordings/index.js +3 -3
  41. package/dist/screenshots/client.d.ts +7 -1
  42. package/dist/screenshots/client.d.ts.map +1 -1
  43. package/dist/screenshots/client.js +36 -4
  44. package/dist/screenshots/client.js.map +1 -1
  45. package/dist/screenshots/dom.d.ts +1 -1
  46. package/dist/screenshots/dom.d.ts.map +1 -1
  47. package/dist/screenshots/dom.js +1 -28
  48. package/dist/screenshots/dom.js.map +1 -1
  49. package/dist/screenshots/index.d.ts +1 -1
  50. package/dist/screenshots/index.js +2 -2
  51. package/dist/screenshots/index.js.map +1 -1
  52. package/dist/screenshots/rrweb.d.ts +2 -2
  53. package/dist/screenshots/rrweb.js +5 -1
  54. package/dist/screenshots/rrweb.js.map +1 -1
  55. package/dist/{endpoints.js → shared/endpoints.js} +1 -1
  56. package/dist/shared/endpoints.js.map +1 -0
  57. package/dist/shared/index.d.ts +238 -0
  58. package/dist/shared/index.d.ts.map +1 -0
  59. package/dist/{index3.d.ts → shared/index2.d.ts} +3 -1
  60. package/dist/shared/index2.d.ts.map +1 -0
  61. package/dist/shared/index3.d.ts +112 -0
  62. package/dist/shared/index3.d.ts.map +1 -0
  63. package/dist/shared/index4.d.ts +64 -0
  64. package/dist/shared/index4.d.ts.map +1 -0
  65. package/dist/shared/index5.d.ts +220 -0
  66. package/dist/shared/index5.d.ts.map +1 -0
  67. package/dist/{index5.d.ts → shared/index6.d.ts} +2 -2
  68. package/dist/shared/index6.d.ts.map +1 -0
  69. package/dist/{integration.d.ts → shared/integration.d.ts} +4 -3
  70. package/dist/shared/integration.d.ts.map +1 -0
  71. package/dist/{integration.js → shared/integration.js} +5 -3
  72. package/dist/shared/integration.js.map +1 -0
  73. package/dist/{kept.js → shared/kept.js} +2 -2
  74. package/dist/shared/kept.js.map +1 -0
  75. package/dist/{marks.js → shared/marks.js} +6 -1
  76. package/dist/shared/marks.js.map +1 -0
  77. package/dist/shared/mask.js +107 -0
  78. package/dist/shared/mask.js.map +1 -0
  79. package/dist/{playwright.js → shared/playwright.js} +19 -4
  80. package/dist/shared/playwright.js.map +1 -0
  81. package/dist/shared/recordings.js +437 -0
  82. package/dist/shared/recordings.js.map +1 -0
  83. package/dist/shared/shortcut.js.map +1 -0
  84. package/dist/shared/tasks.js +632 -0
  85. package/dist/shared/tasks.js.map +1 -0
  86. package/dist/shared/waveform.js.map +1 -0
  87. package/dist/tailwind/client.d.ts +1 -1
  88. package/dist/tailwind/index.d.ts +1 -1
  89. package/dist/tasks/client.d.ts +1 -1
  90. package/dist/tasks/client.d.ts.map +1 -1
  91. package/dist/tasks/client.js +272 -57
  92. package/dist/tasks/client.js.map +1 -1
  93. package/dist/tasks/index.d.ts +2 -159
  94. package/dist/tasks/index.js +1 -348
  95. package/dist/vite.d.ts +11 -12
  96. package/dist/vite.d.ts.map +1 -1
  97. package/dist/vite.js +21 -4
  98. package/dist/vite.js.map +1 -1
  99. package/dist/voice/client.d.ts.map +1 -1
  100. package/dist/voice/client.js +36 -15
  101. package/dist/voice/client.js.map +1 -1
  102. package/dist/voice/index.d.ts +6 -1
  103. package/dist/voice/index.d.ts.map +1 -1
  104. package/dist/voice/index.js +13 -3
  105. package/dist/voice/index.js.map +1 -1
  106. package/dist/webpack.d.ts +1 -1
  107. package/dist/webpack.js +2 -2
  108. package/package.json +41 -2
  109. package/skills/deictic/SKILL.md +20 -14
  110. package/skills/deictic/references/install.md +32 -10
  111. package/skills/deictic/references/recordings.md +29 -0
  112. package/skills/deictic/references/tasks.md +49 -21
  113. package/skills/deictic/references/watch.md +38 -11
  114. package/skills/deictic/scripts/lib.mjs +88 -4
  115. package/skills/deictic/scripts/recording.mjs +84 -4
  116. package/skills/deictic/scripts/task.mjs +36 -7
  117. package/skills/deictic/scripts/vb.mjs +12 -0
  118. package/skills/deictic/scripts/watch.mjs +74 -10
  119. package/src/client/away.ts +105 -0
  120. package/src/client/index.ts +60 -16
  121. package/src/client/style.ts +1 -0
  122. package/src/index.ts +21 -2
  123. package/src/plugins/logs/client.ts +18 -0
  124. package/src/plugins/logs/index.ts +55 -0
  125. package/src/plugins/network/client.ts +30 -0
  126. package/src/plugins/network/index.ts +69 -0
  127. package/src/plugins/network/mask.ts +133 -0
  128. package/src/plugins/recommended/index.ts +14 -1
  129. package/src/plugins/recordings/client.ts +220 -40
  130. package/src/plugins/recordings/index.ts +111 -25
  131. package/src/plugins/recordings/marks.ts +6 -0
  132. package/src/plugins/recordings/replay.ts +159 -10
  133. package/src/plugins/screenshots/client.ts +38 -2
  134. package/src/plugins/screenshots/dom.ts +1 -32
  135. package/src/plugins/screenshots/index.ts +2 -0
  136. package/src/plugins/screenshots/playwright.ts +15 -4
  137. package/src/plugins/screenshots/rrweb.ts +2 -1
  138. package/src/plugins/tasks/client.ts +273 -41
  139. package/src/plugins/tasks/index.ts +207 -47
  140. package/src/plugins/tasks/local.ts +170 -0
  141. package/src/plugins/tasks/watchers.ts +36 -0
  142. package/src/plugins/voice/client.ts +33 -10
  143. package/src/plugins/voice/index.ts +21 -4
  144. package/src/tools/integration.ts +5 -3
  145. package/src/tools/kept.ts +2 -2
  146. package/src/vite.ts +23 -4
  147. package/dist/endpoints.js.map +0 -1
  148. package/dist/index.d.ts.map +0 -1
  149. package/dist/index2.d.ts +0 -23
  150. package/dist/index3.d.ts.map +0 -1
  151. package/dist/index4.d.ts +0 -74
  152. package/dist/index4.d.ts.map +0 -1
  153. package/dist/index5.d.ts.map +0 -1
  154. package/dist/integration.d.ts.map +0 -1
  155. package/dist/integration.js.map +0 -1
  156. package/dist/kept.js.map +0 -1
  157. package/dist/marks.js.map +0 -1
  158. package/dist/playwright.js.map +0 -1
  159. package/dist/recordings.js +0 -235
  160. package/dist/recordings.js.map +0 -1
  161. package/dist/shortcut.js.map +0 -1
  162. package/dist/tasks/index.d.ts.map +0 -1
  163. package/dist/tasks/index.js.map +0 -1
  164. package/dist/waveform.js.map +0 -1
  165. /package/dist/{shortcut.js → shared/shortcut.js} +0 -0
  166. /package/dist/{waveform.js → shared/waveform.js} +0 -0
@@ -0,0 +1,112 @@
1
+ import { record } from "rrweb";
2
+ import { a as Masking } from "./index2.js";
3
+ /**
4
+ * The custom event's tag the marks go in: the page's annotations, as an SVG in page coordinates (`svg`),
5
+ * and as the annotations themselves (`annotations`, absent from recordings made before it was added).
6
+ */
7
+ declare const MARKS = "deictic.annotations";
8
+ /** Where the replay page finds what the plugin's routes would serve it, for a page published as a file. */
9
+ interface ReplaySources {
10
+ /** The folder `player.js` and `player.css` are in (`rrweb-player`'s `rrweb-player.umd.min.cjs` and `style.css`), from the page: `..`, the routes', by default. */
11
+ player?: string;
12
+ /**
13
+ * A script, from the page, that sets `globalThis.deicticReplay` before the page asks: `recording(id)` answers the
14
+ * recording (a `Kept`) and `clip(id)` a voice clip's URL, either as a promise. The routes by default.
15
+ */
16
+ source?: string;
17
+ }
18
+ /** The replay page's HTML: the routes' as it is, or one for a page published as a file. */
19
+ declare const replayPage: ({ player, source }?: ReplaySources) => string;
20
+ /** A recording as the page knows it: its ID, where it plays back, and how long it ran, in milliseconds. */
21
+ interface Recording {
22
+ id: string;
23
+ url: string;
24
+ duration: number;
25
+ /** What the mic took while it was on, where the voice plugin is loaded. */
26
+ voice?: VoiceClip[];
27
+ }
28
+ /** A stretch of the mic in a recording: the voice plugin's clip, and when it starts in the recording, in milliseconds. */
29
+ interface VoiceClip {
30
+ id: string;
31
+ at: number;
32
+ duration: number;
33
+ }
34
+ /** The page's half, for other plugins' page halves. */
35
+ interface Recorder {
36
+ /**
37
+ * Records the page, with the toolbar, until Stop: answers the recording, kept by the dev server, or
38
+ * nothing when it's discarded. Rejects while another is going, or when it couldn't be kept. A page load
39
+ * doesn't end it: the next page of the site carries on, and `going` there answers what this would have.
40
+ */
41
+ record(): Promise<Recording | undefined>;
42
+ /** Whether one is going. */
43
+ recording(): boolean;
44
+ /** The one going, as `record` answers it: also one a page before this started, carried on here. */
45
+ going(): Promise<Recording | undefined> | undefined;
46
+ }
47
+ /** A plugin of rrweb's own, as its `record` takes them: what puts more than the page in a recording. */
48
+ type RecordPlugin = NonNullable<NonNullable<Parameters<typeof record>[0]>['plugins']>[number];
49
+ /**
50
+ * What a plugin that adds to recordings answers in the page, under its name (`logs` and `network` do): the
51
+ * recorder asks each it knows for its rrweb plugin as a recording starts, so nothing listens before, or after it stops.
52
+ */
53
+ interface Recorded {
54
+ /** `sinceLoad`: the recording was going as this page loaded, so what the page did before now is its too. */
55
+ plugin(from: {
56
+ sinceLoad: boolean;
57
+ }): Promise<RecordPlugin>;
58
+ }
59
+ /** The server's half, for other plugins' server halves. */
60
+ interface Recordings {
61
+ /** A recording's JSON, or nothing for one not kept (any more). */
62
+ read(id: string): {
63
+ data: Uint8Array<ArrayBuffer>;
64
+ name: string;
65
+ type: 'application/json';
66
+ } | undefined;
67
+ }
68
+ /** What a recording says as it begins: all of a `Kept` that's known then. */
69
+ type Meta = Omit<Kept, 'events' | 'duration' | 'voice'>;
70
+ /** What's kept: rrweb's events and what they can't say. */
71
+ interface Kept {
72
+ /** The page it started on. One that went on to others has each in its events, as rrweb's own: a `Meta`, then a snapshot. */
73
+ page: string;
74
+ viewport: {
75
+ width: number;
76
+ height: number;
77
+ };
78
+ /**
79
+ * The colour scheme the page was in, which rrweb doesn't record: the replay shows it in the same, or a
80
+ * page styled by `prefers-color-scheme` would take the replay's.
81
+ */
82
+ colorScheme?: 'light' | 'dark';
83
+ startedAt: number;
84
+ duration: number;
85
+ events: unknown[];
86
+ /** The mic's clips, played along with the replay. */
87
+ voice?: VoiceClip[];
88
+ }
89
+ declare module 'deictic' {
90
+ interface ServerApis {
91
+ recordings: Recordings;
92
+ }
93
+ interface ClientApis {
94
+ recordings: Recorder;
95
+ }
96
+ }
97
+ interface RecordingsOptions extends Masking {
98
+ /** How many recordings to keep, the latest: 20 by default. */
99
+ keep?: number;
100
+ /** Where they're kept, from the project's root: `.deictic/recordings` by default. */
101
+ dir?: string;
102
+ /**
103
+ * What a `<canvas>` draws (a chart, a map, WebGL), which is no part of the page's markup: a picture of each
104
+ * canvas that changed, `fps` times a second, 2 by default. `false` for none, and a canvas replays blank.
105
+ */
106
+ canvas?: boolean | {
107
+ fps?: number;
108
+ };
109
+ }
110
+ declare function recordings(options?: RecordingsOptions): import("deictic").ServerPlugin<never, never, never, Recordings>;
111
+ export { Recorder as a, RecordingsOptions as c, ReplaySources as d, replayPage as f, Recorded as i, VoiceClip as l, Meta as n, Recording as o, MARKS as p, RecordPlugin as r, Recordings as s, Kept as t, recordings as u };
112
+ //# sourceMappingURL=index3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index3.d.ts","names":[],"sources":["../../src/plugins/recordings/marks.ts","../../src/plugins/recordings/replay.ts","../../src/plugins/recordings/index.ts"],"mappings":";;;;;;cAIa;;UCyBI;;EAEf;;;;;EAKA;;;cAIW,eAAU,QAAA,WAA+B;;UCXrC;EACf;EACA;EACA;;EAEA,QAAQ;;;UAIO;EACf;EACA;EACA;;;UAIe;;;;;;EAMf,UAAU,QAAQ;;EAElB;;EAEA,SAAS,QAAQ;;;KAIP,eAAe,YAAY,YAAY,kBAAkB;;;;;UAMpD;;EAEf,OAAO;IAAQ;MAAuB,QAAQ;;;UAI/B;;EAEf,KAAK;IAAe,MAAM,WAAW;IAAc;IAAc;;;;KAIvD,OAAO,KAAK;;UAGP;;EAEf;EACA;IAAY;IAAe;;;;;;EAK3B;EACA;EACA;EACA;;EAEA,QAAQ;;;YAIE;IACR,YAAY;;YAEJ;IACR,YAAY;;;UAIC,0BAA0B;;EAEzC;;EAEA;;;;;EAKA;IAAqB;;;iBAmBP,WAAW,UAAS,sCAAsB,kCAAA"}
@@ -0,0 +1,64 @@
1
+ import { i as Recorded } from "./index3.js";
2
+ /**
3
+ * What a request is kept as: with what it carries that's a secret blanked, wherever a name says so. The
4
+ * names are all there is to go by, so a secret under a name that says nothing (a token in a path, a password in
5
+ * prose) isn't found: bodies and headers are kept only where asked for, and `ignore` leaves a request out whole.
6
+ */
7
+ /** A request as rrweb's network plugin has it: all this reads of one, and changes. */
8
+ interface Request {
9
+ name: string;
10
+ requestHeaders?: Record<string, string>;
11
+ responseHeaders?: Record<string, string>;
12
+ requestBody?: string | null;
13
+ responseBody?: string | null;
14
+ }
15
+ interface Masking {
16
+ /** More names whose values are blanked, as these are: a part of the name, in any case. */
17
+ mask: string[];
18
+ /** Requests left out: a part of the URL. */
19
+ ignore: string[];
20
+ }
21
+ /** What a blanked value reads as. */
22
+ declare const MASKED = "***";
23
+ declare const sensitive: (name: string, more?: readonly string[]) => boolean;
24
+ /** The URL without a name and password before its host, and with its secrets blanked: the query's, and a fragment's that reads as one. */
25
+ declare function maskUrl(url: string, more?: readonly string[]): string;
26
+ declare function maskHeaders(headers: Record<string, string>, more?: readonly string[]): Record<string, string>;
27
+ /** A body with its secrets blanked where it's JSON or a form's fields, cut where it's long: other text has no names to go by. */
28
+ declare function maskBody(body: string, more?: readonly string[]): string;
29
+ /** The request as it's kept, or nothing for one left out. */
30
+ declare function maskRequest<R extends Request>(request: R, { mask, ignore }: Masking): R | undefined;
31
+ interface NetworkOptions {
32
+ /**
33
+ * What made the requests kept, as the browser names it (a resource's `initiatorType`): `['fetch',
34
+ * 'xmlhttprequest']` by default, the page's own calls. `'img'`, `'script'`, `'css'` and the like add what it loads.
35
+ */
36
+ initiators?: string[];
37
+ /** Keeps each request's and response's headers, the secret ones blanked (`Authorization`, `Cookie`, …): not by default. */
38
+ headers?: boolean;
39
+ /**
40
+ * Keeps each request's and response's body, cut at 10,000 characters, secrets blanked by name where it's JSON or a
41
+ * form's fields: not by default. `true` is JSON, text and forms; a list names the content types, by a part of each.
42
+ */
43
+ body?: boolean | string[];
44
+ /** More names whose values are blanked, in a query, a header or a body: a part of the name, in any case (`['email']`). */
45
+ mask?: string[];
46
+ /** Requests left out whole: a part of the URL (`['/analytics', 'sentry.io']`). */
47
+ ignore?: string[];
48
+ }
49
+ /** The options as the page half gets them. */
50
+ interface Resolved {
51
+ initiators: string[];
52
+ headers: boolean;
53
+ body: false | string[];
54
+ mask: string[];
55
+ ignore: string[];
56
+ }
57
+ declare module 'deictic' {
58
+ interface ClientApis {
59
+ network: Recorded;
60
+ }
61
+ }
62
+ declare function network(options?: NetworkOptions): import("deictic").ServerPlugin<never, never, unknown, unknown>;
63
+ export { maskBody as a, maskUrl as c, MASKED as i, sensitive as l, Resolved as n, maskHeaders as o, network as r, maskRequest as s, NetworkOptions as t };
64
+ //# sourceMappingURL=index4.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index4.d.ts","names":[],"sources":["../../src/plugins/network/mask.ts","../../src/plugins/network/index.ts"],"mappings":";;;;;;;UAOiB;EACf;EACA,iBAAiB;EACjB,kBAAkB;EAClB;EACA;;UAGe;;EAEf;;EAEA;;;cAIW;cA+BA,YAAS,cAAgB;;iBAgBtB,QAAQ,aAAa;iBAsBrB,YAAY,SAAS,wBAAwB,2BAA+B;;iBAW5E,SAAS,cAAc;;iBAmBvB,YAAY,UAAU,SAAS,SAAS,KAAK,MAAM,UAAU,UAAU;UCzGtE;;;;;EAKf;;EAEA;;;;;EAKA;;EAEA;;EAEA;;;UAIe;EACf;EACA;EACA;EACA;EACA;;;YAIU;IACR,SAAS;;;iBAOG,QAAQ,UAAS,mCAAmB"}
@@ -0,0 +1,220 @@
1
+ import { Board } from "@vercel/board";
2
+ import { w as Shortcut, y as Target } from "./index.js";
3
+ import { t as Box } from "./index2.js";
4
+ interface LocalOptions {
5
+ /**
6
+ * The port it listens on, on 127.0.0.1. By default 4100, or a free one where that's taken. One named here is
7
+ * the only one tried: taken, the board doesn't start.
8
+ */
9
+ port?: number;
10
+ /** Where its log is kept, from the project's root: `.deictic/board` by default. */
11
+ dir?: string;
12
+ /** `false` for no pages of the board's own (its inspector): the panel then links its tasks nowhere. */
13
+ inspect?: boolean;
14
+ /** More arguments for `vb serve`, as it takes them: `['--tailscale', 'box.tailnet.ts.net']`. */
15
+ args?: string[];
16
+ }
17
+ /** What `local()` answers, for the tasks plugin's `board` option. */
18
+ interface LocalBoard {
19
+ local: LocalOptions;
20
+ }
21
+ /**
22
+ * The project's own board on this machine, as the tasks plugin's `board`: what it uses anyway with no
23
+ * `BOARD_URL`, here whatever the environment says, and with options.
24
+ */
25
+ declare const local: (options?: LocalOptions) => LocalBoard;
26
+ /** What the plugin uses of a board: `board()` from `@vercel/board` is one. */
27
+ type TaskBoard = Pick<Board, 'tasks' | 'thread' | 'discovery' | 'upload' | 'edit' | 'actors'>;
28
+ interface TasksOptions {
29
+ /**
30
+ * The board, as `@vercel/board`'s `board()` answers it. By default the one `BOARD_URL` names, and with none,
31
+ * one of the project's own on this machine: `vb serve`, started with the dev server and stopped with it, at
32
+ * `http://127.0.0.1:4100/api/board` (or the port `.deictic/board.json` says, where that one's taken), its log
33
+ * in `.deictic/board`. For your team's board, through `vercel login`, pass `board()`. `local()`, from here, is
34
+ * that board of the project's own whatever `BOARD_URL` says, with its port, its folder and the rest as options.
35
+ */
36
+ board?: TaskBoard | LocalBoard;
37
+ /** The channel tasks go to: `deictic` by default. */
38
+ channel?: string;
39
+ /**
40
+ * The project the tasks are about, as the `deictic.project` label, to tell them apart on a board several
41
+ * projects share: by default the `name` in the root's `package.json`, and no label where it has none.
42
+ */
43
+ project?: string;
44
+ /** Labels every task gets besides deictic's own, for whoever works them to filter by (`vb tail --label`). None by default. */
45
+ labels?: Record<string, string>;
46
+ /**
47
+ * Where the panel links the channel to, for a person to see its tasks, and with `task`, where it links
48
+ * that task's ID to. By default the board's own pages when it's one `vb serve` runs on this machine
49
+ * (`http://127.0.0.1:4100/c/deictic`, and `?thread=<id>` on it), and none for another board, whose pages
50
+ * deictic can't know.
51
+ */
52
+ link?: (channel: string, task?: string) => string | undefined;
53
+ /**
54
+ * Whether a task has the element's HTML as it rendered attached, as `element.html`, masked as a screenshot is
55
+ * (the screenshots plugin's masking, where it's loaded): what was on the page, for whoever can't open it as the
56
+ * person did. True by default: the Task tab has a box for it, ticked, to untick for a task that should go
57
+ * without. `false` takes the box away, where a page shows what the board shouldn't hold.
58
+ */
59
+ html?: boolean;
60
+ /** What opens its tab directly, beside deictic's own shortcut, which opens any: none by default. */
61
+ shortcut?: Shortcut;
62
+ }
63
+ interface Task {
64
+ id: string;
65
+ /** The first line of what was typed. */
66
+ title: string;
67
+ /** What was typed, whole: what an edit changes. */
68
+ text: string;
69
+ state: string;
70
+ /** Whether it can still be edited or deleted: no one has claimed it. */
71
+ open: boolean;
72
+ /** Its page on the board, when there's one to link to. */
73
+ link?: string;
74
+ /**
75
+ * Where it was added, where that isn't the element's place: for one of `tasks`, where the element was before
76
+ * it moved; for one of `elsewhere`, the element it's about.
77
+ */
78
+ at?: Place;
79
+ }
80
+ /** A place in the element's file: a line and a column, from 1, and the tag there as the task saw it. */
81
+ interface Place {
82
+ line: number;
83
+ column: number;
84
+ tag: string;
85
+ }
86
+ interface Model {
87
+ channel: string;
88
+ /** The channel's page, when there's one to link to. */
89
+ link?: string;
90
+ /** Tasks about this element, oldest first, canceled ones left out: also those added before it moved. */
91
+ tasks: Task[];
92
+ /** Tasks about the file's other elements, by line, canceled ones left out: each with its `at`. */
93
+ elsewhere: Task[];
94
+ /**
95
+ * Who watches the channel, by name (`claude`): the agents whose watch (the skill's `watch.mjs`) is running in
96
+ * this project, as a board can't say, and those holding a claim on one of the channel's tasks, which it can.
97
+ * Empty where none is and the board is this machine's own;
98
+ * left out where none is and the board is another, which an agent may watch from elsewhere.
99
+ */
100
+ watching?: string[];
101
+ }
102
+ /**
103
+ * What the Task tab asks for: a new task (an `Op`), other words for one it lists (`edit` is its ID), or
104
+ * that one deleted (`remove` is its ID), which cancels it on the board.
105
+ */
106
+ type Change = Op | {
107
+ edit: string;
108
+ text: string;
109
+ } | {
110
+ remove: string;
111
+ };
112
+ /** A new task: what the page knows and the source doesn't. */
113
+ interface Op {
114
+ text: string;
115
+ /** The page's URL. */
116
+ page: string;
117
+ viewport: {
118
+ width: number;
119
+ height: number;
120
+ };
121
+ /**
122
+ * What was under the pointer inside the element, where nothing marked it (a dependency's markup, or a
123
+ * shadow root's): its path from the element, and its HTML, cut short.
124
+ */
125
+ pointed?: {
126
+ path: string;
127
+ html: string;
128
+ };
129
+ /** How many elements on the page come from the same place in the source. */
130
+ count: number;
131
+ /**
132
+ * The source it rendered through, after its own place, nearest first, each a `file:line`: where the file
133
+ * before it is used. A shared component's line says nothing of which use of it this is, and these do.
134
+ */
135
+ chain?: string[];
136
+ /** The element's HTML as it rendered, to attach: cut short, and masked where the screenshots plugin is loaded. */
137
+ html?: string;
138
+ /**
139
+ * Shots the screenshots plugin took of it, to attach, where that plugin is loaded: each with where the
140
+ * element is in it, whether it's `outlined` there (dashes drawn around it, in the PNG), and the marks drawn
141
+ * on it in the panel, where there are any.
142
+ */
143
+ screenshots?: {
144
+ id: string;
145
+ box: Box;
146
+ outlined?: boolean;
147
+ marks?: Marks;
148
+ }[];
149
+ /**
150
+ * Recordings the recordings plugin made, to attach, where that plugin is loaded: how long each ran,
151
+ * where it plays back, and the voice plugin's clips of the mic in it, attached too.
152
+ */
153
+ recordings?: {
154
+ id: string;
155
+ duration: number;
156
+ replay: string;
157
+ voice?: string[];
158
+ }[];
159
+ /** Voice notes the voice plugin kept, to attach, where that plugin is loaded, and how long each runs. */
160
+ voice?: {
161
+ id: string;
162
+ duration: number;
163
+ }[];
164
+ /** The page's annotations, where that plugin is loaded and there are any: how many, and their notes' text. */
165
+ annotations?: Marks;
166
+ }
167
+ /**
168
+ * A task the Task tab just added, as the page hears of it: the `detail` of a `deictic:task` event on `window`, for a
169
+ * page that shows its own tasks (deictic's playground lists them as a board does).
170
+ */
171
+ interface TaskAdded {
172
+ id: string;
173
+ /** The first line of what was typed. */
174
+ title: string;
175
+ state: string;
176
+ channel: string;
177
+ /** The element: its file, line and column, and its tag. */
178
+ target: Target;
179
+ /** The page's URL. */
180
+ page: string;
181
+ /** How many of each were attached; `marks` counts those drawn on shots and on the page. */
182
+ attached: {
183
+ screenshots: number;
184
+ recordings: number;
185
+ voice: number;
186
+ marks: number;
187
+ };
188
+ }
189
+ /** Marks, as a task tells of them: how many, and what the notes among them say. */
190
+ interface Marks {
191
+ count: number;
192
+ notes: string[];
193
+ }
194
+ interface Added {
195
+ channel: string;
196
+ id: string;
197
+ text: string;
198
+ labels: Record<string, string>;
199
+ /** What's attached, by the board's IDs: kept, so a redo attaches the same without uploading it again. */
200
+ attachments?: string[];
201
+ }
202
+ /** A task's words changed: its message's whole text before and after. */
203
+ interface Edited {
204
+ kind: 'edited';
205
+ id: string;
206
+ before: string;
207
+ after: string;
208
+ }
209
+ /**
210
+ * A task deleted in the panel: canceled on the board, for good, as a board has it. So it's kept whole, and
211
+ * an undo adds it again, as a new task whose ID the record then has.
212
+ */
213
+ interface Removed extends Added {
214
+ kind: 'removed';
215
+ }
216
+ /** What the history keeps of a change: a task added has no `kind`, as it had none before there were others. */
217
+ type Kept = Added | Edited | Removed;
218
+ declare function tasks(options?: TasksOptions): import("deictic").ServerPlugin<Model, Change, Kept, unknown>;
219
+ export { local as _, Marks as a, Place as c, TaskAdded as d, TaskBoard as f, LocalOptions as g, LocalBoard as h, Kept as i, Removed as l, tasks as m, Change as n, Model as o, TasksOptions as p, Edited as r, Op as s, Added as t, Task as u };
220
+ //# sourceMappingURL=index5.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index5.d.ts","names":[],"sources":["../../src/plugins/tasks/local.ts","../../src/plugins/tasks/index.ts"],"mappings":";;;UAkBiB;;;;;EAKf;;EAEA;;EAEA;;EAEA;;;UAIe;EACf,OAAO;;;;;;cAOI,QAAK,UAAa,iBAAoB;;KCTvC,YAAY,KAAK;UAEZ;;;;;;;;EAQf,QAAQ,YAAY;;EAEpB;;;;;EAKA;;EAEA,SAAS;;;;;;;EAOT,QAAQ,iBAAiB;;;;;;;EAOzB;;EAEA,WAAW;;UAGI;EACf;;EAEA;;EAEA;EACA;;EAEA;;EAEA;;;;;EAKA,KAAK;;;UAIU;EACf;EACA;EACA;;UAGe;EACf;;EAEA;;EAEA,OAAO;;EAEP,WAAW;;;;;;;EAOX;;;;;;KAOU,SAAS;EAAO;EAAc;;EAAmB;;;UAG5C;EACf;;EAEA;EACA;IAAY;IAAe;;;;;;EAK3B;IAAY;IAAc;;;EAE1B;;;;;EAKA;;EAEA;;;;;;EAMA;IAAgB;IAAY,KAAK;IAAK;IAAoB,QAAQ;;;;;;EAKlE;IAAe;IAAY;IAAkB;IAAgB;;;EAE7D;IAAU;IAAY;;;EAEtB,cAAc;;;;;;UAOC;EACf;;EAEA;EACA;EACA;;EAEA,QAAQ;;EAER;;EAEA;IAAY;IAAqB;IAAoB;IAAe;;;;UAIrD;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA,QAAQ;;EAER;;;UAIe;EACf;EACA;EACA;EACA;;;;;;UAOe,gBAAgB;EAC/B;;;KAIU,OAAO,QAAQ,SAAS;iBAQpB,MAAM,UAAS,iCAAiB,aAAA,OAAA,QAAA"}
@@ -1,4 +1,4 @@
1
- import { C as Shortcut } from "./index.js";
1
+ import { w as Shortcut } from "./index.js";
2
2
  /** A class as the panel shows it. */
3
3
  interface ClassInfo {
4
4
  name: string;
@@ -67,4 +67,4 @@ interface Op {
67
67
  }
68
68
  declare function tailwind(options?: TailwindOptions): import("deictic").ServerPlugin<Model, Op, unknown, unknown>;
69
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
70
+ //# sourceMappingURL=index6.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index6.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"}
@@ -1,4 +1,4 @@
1
- import { C as Shortcut, g as ServerPlugin } from "./index.js";
1
+ import { g as ServerPlugin, w as Shortcut } from "./index.js";
2
2
  import "magic-string";
3
3
  import "oxc-parser";
4
4
  interface DeicticOptions {
@@ -12,8 +12,9 @@ interface DeicticOptions {
12
12
  }
13
13
  /**
14
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.
15
+ * in the page, with its shortcut, checked; and with `server`, a module of the page's that answers its requests
16
+ * where no dev server does.
16
17
  */
17
- declare const clientModule: (plugins: ServerPlugin[], base: string, own?: Shortcut | false) => string;
18
+ declare const clientModule: (plugins: ServerPlugin[], base: string, own?: Shortcut | false, server?: string) => string;
18
19
  export { clientModule as n, DeicticOptions as t };
19
20
  //# 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;;;;;;;cAeA,eAAY,SAAa,gBAAc,cAAc,MAAQ,kBAAgB"}
@@ -204,9 +204,10 @@ function prepare(options) {
204
204
  }
205
205
  /**
206
206
  * The client module: the overlay, started with deictic's own shortcut and each plugin that has a half
207
- * in the page, with its shortcut, checked.
207
+ * in the page, with its shortcut, checked; and with `server`, a module of the page's that answers its requests
208
+ * where no dev server does.
208
209
  */
209
- const clientModule = (plugins, base, own) => {
210
+ const clientModule = (plugins, base, own, server) => {
210
211
  const [shortcut, ...shortcuts] = checkShortcuts([{
211
212
  name: OWN$1,
212
213
  shortcut: ownShortcut(own)
@@ -221,7 +222,8 @@ const clientModule = (plugins, base, own) => {
221
222
  return [
222
223
  `import { start } from 'deictic/client';`,
223
224
  ...paged.map((p, i) => `import p${i} from ${JSON.stringify(p.client)};`),
224
- `start({ base: ${JSON.stringify(base)}, shortcut: ${JSON.stringify(shortcut) ?? "undefined"}, plugins: [${paged.map((p, i) => `{ plugin: p${i}, ...${JSON.stringify(p.rest)} }`).join(", ")}] });`
225
+ ...server === void 0 ? [] : [`import server from ${JSON.stringify(server)};`],
226
+ `start({ base: ${JSON.stringify(base)}, shortcut: ${JSON.stringify(shortcut) ?? "undefined"}, plugins: [${paged.map((p, i) => `{ plugin: p${i}, ...${JSON.stringify(p.rest)} }`).join(", ")}]${server === void 0 ? "" : ", server"} });`
225
227
  ].join("\n");
226
228
  };
227
229
  /**
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration.js","names":["OWN","OWN"],"sources":["../../src/tools/locate.ts","../../src/tools/astro.ts","../../src/tools/plugins.ts","../../src/tools/integration.ts"],"sourcesContent":["/**\n * Marks each host element in a JSX module with where its opening tag starts:\n * `<div data-deictic=\"src/App.tsx:12:5\">`. The page reads it back to know what was clicked.\n *\n * At build time and not from React's fibers at runtime: it works for any framework that compiles JSX,\n * for server components (which have no fiber in the browser), and it names the element's own tag\n * rather than the component that rendered it. Only host elements (`div`, `button`) are marked, since a\n * component may not pass the attribute on; a component's call site is reached from its elements.\n *\n * The transform must run on the source as written (`enforce: 'pre'` under Vite), so lines and columns\n * are the file's. It runs alike on the server and in the browser, so a hydrated page matches its HTML.\n */\nimport MagicString from 'magic-string';\nimport { type JSXOpeningElement, parseSync, type Program, Visitor } from 'oxc-parser';\n\nexport const ATTRIBUTE = 'data-deictic';\n/** Modules that may hold JSX: `.jsx` and `.tsx`, and plain `.js`, as many React projects write theirs. */\nexport const JSX = /\\.[cm]?(?:[jt]sx|js)$/;\n\n/** A module parsed, with JSX read in a `.js` file too, which the parser reads there only when told. */\nexport const parse = (file: string, code: string) => parseSync(file, code, /\\.[cm]?js$/.test(file) ? { lang: 'jsx' } : undefined);\n\nexport interface Located {\n code: string;\n map: ReturnType<MagicString['generateMap']>;\n}\n\n/** Whether an opening tag is a host element's, `<div>` or `<svg>`, not a component's or a namespaced one. */\nexport const isHost = (el: JSXOpeningElement) => el.name.type === 'JSXIdentifier' && /^[a-z]/.test(el.name.name);\n\n/**\n * `code` with every host element marked, `file` being its path from the project's root, and `append`\n * after it (the client's import, in the browser); nothing when there is nothing to mark, or the module\n * doesn't parse, which the framework's own transform reports better.\n */\nexport function locate(code: string, file: string, append = ''): Located | undefined {\n // No tag, no parse: most `.js` modules have none, and every one of the project's comes through here.\n if (!/<[a-z]/.test(code)) return undefined;\n const { program, errors } = parse(file, code);\n if (errors.length > 0) return undefined;\n return marked(code, file, openingsIn(program), append);\n}\n\n/** Every opening tag in a module, in its order. */\nexport function openingsIn(program: Program): JSXOpeningElement[] {\n const elements: JSXOpeningElement[] = [];\n new Visitor({ JSXOpeningElement: (el) => void elements.push(el) }).visit(program);\n return elements;\n}\n\n/**\n * `code` with a mark in each of `elements` that is a host element's and has none yet, and `append` after\n * it; nothing with none to mark.\n */\nexport function marked(code: string, file: string, elements: JSXOpeningElement[], append = ''): Located | undefined {\n const lines = lineStarts(code);\n const s = new MagicString(code);\n for (const el of elements) {\n if (!isHost(el) || el.attributes.some((a) => a.type === 'JSXAttribute' && nameOf(a.name) === ATTRIBUTE)) continue;\n const { line, column } = position(lines, el.start);\n s.appendLeft(el.name.end, ` ${ATTRIBUTE}=\"${file}:${line}:${column}\"`);\n }\n if (!s.hasChanged()) return undefined;\n if (append !== '') s.append(append);\n // A map's source is read from the module's own folder, so it's the file's name, not its path from the root.\n return { code: s.toString(), map: s.generateMap({ source: file.slice(file.lastIndexOf('/') + 1), hires: 'boundary' }) };\n}\n\nconst nameOf = (name: { type: string; name?: unknown }) => (name.type === 'JSXIdentifier' ? name.name : undefined);\n\n/** Where each line starts, by offset. */\nexport function lineStarts(code: string): number[] {\n const starts = [0];\n for (let i = code.indexOf('\\n'); i !== -1; i = code.indexOf('\\n', i + 1)) starts.push(i + 1);\n return starts;\n}\n\n/** An offset's line and column, from 1. */\nexport function position(lines: number[], offset: number): { line: number; column: number } {\n let lo = 0;\n let hi = lines.length - 1;\n while (lo < hi) {\n const mid = (lo + hi + 1) >> 1;\n if (lines[mid]! <= offset) lo = mid;\n else hi = mid - 1;\n }\n return { line: lo + 1, column: offset - lines[lo]! + 1 };\n}\n\n/** A line and column's offset, or nothing past the file's end. */\nexport function offsetOf(lines: number[], line: number, column: number): number | undefined {\n const start = lines[line - 1];\n return start === undefined ? undefined : start + column - 1;\n}\n","/**\n * `.astro` components. They aren't JSX modules, but Astro 7's own parser reads a template as JSX, into the\n * tree oxc makes (offsets in UTF-16, as ours are), so its host elements are marked as a JSX module's are,\n * before Astro compiles the file. The parser is the project's own Astro's (`@astrojs/compiler-rs`, found\n * through `astro`), so it reads a file exactly as the compiler will; an Astro before 7 has none like it,\n * and its `.astro` files are left unmarked.\n */\nimport { createRequire } from 'node:module';\nimport { join } from 'node:path';\n\nimport type { JSXOpeningElement, Program } from 'oxc-parser';\n\nimport { type Located, marked } from './locate.ts';\n\nexport const ASTRO = /\\.astro$/;\n\n/** A file parsed: its module (an `.astro` file's frontmatter), and each opening tag in it, in the file's order. */\nexport interface Parsed {\n program: Program;\n elements: JSXOpeningElement[];\n}\n\ninterface Tree {\n ast: { frontmatter: { program: Program }; body: unknown };\n diagnostics: { severity: string; text: string }[];\n}\ntype Parse = (code: string) => Tree;\n\nconst parsers = new Map<string, Parse | undefined>();\n\n/** The parser of the Astro installed for the project at `root`, loaded once; nothing without Astro 7. */\nfunction parserOf(root: string): Parse | undefined {\n if (!parsers.has(root)) parsers.set(root, load(root));\n return parsers.get(root);\n}\n\nfunction load(root: string): Parse | undefined {\n try {\n // Astro's own dependency, which a strict package manager doesn't put where the project could import it.\n const astro = createRequire(createRequire(join(root, 'package.json')).resolve('astro/package.json'));\n // An ES module, required: every Node that runs Astro 7 can, and reading a source stays synchronous.\n const compiler: { parse?: Parse } = astro('@astrojs/compiler-rs');\n return compiler.parse;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Astro gives a `<script>` or `<style>` with an attribute it doesn't know to the page as it is, unbundled and\n * unscoped, and a `<slot>` isn't an element at all: none of them can be pointed at, so none is marked.\n */\nconst OWN = new Set(['script', 'style', 'slot']);\n\nconst isOpening = (node: object): node is JSXOpeningElement => 'type' in node && node.type === 'JSXOpeningElement';\n\n/** An `.astro` file's text parsed, or the `problem` with it: no parser (an older Astro), or text that doesn't parse. */\nexport function parseAstro(root: string, code: string): Parsed | { problem: string } {\n const parse = parserOf(root);\n if (parse === undefined) return { problem: 'reading an .astro file takes Astro 7 or later, so update astro' };\n const { ast, diagnostics } = parse(code);\n const error = diagnostics.find((d) => d.severity === 'error');\n if (error !== undefined) return { problem: `fix it first (${error.text})` };\n const elements: JSXOpeningElement[] = [];\n const walk = (node: unknown): void => {\n if (Array.isArray(node)) return node.forEach(walk);\n if (node === null || typeof node !== 'object') return;\n if (isOpening(node) && !(node.name.type === 'JSXIdentifier' && OWN.has(node.name.name))) elements.push(node);\n Object.values(node).forEach(walk);\n };\n walk(ast.body);\n return { program: ast.frontmatter.program, elements };\n}\n\n/** An `.astro` file's text with every host element marked, as `locate` marks a JSX module; nothing where it can't be read. */\nexport function locateAstro(code: string, file: string, root: string): Located | undefined {\n // No tag, no parse.\n if (!/<[a-z]/.test(code)) return undefined;\n const parsed = parseAstro(root, code);\n return 'problem' in parsed ? undefined : marked(code, file, parsed.elements);\n}\n","/**\n * The plugins an integration was given: checked as it starts, so a wrong set fails the dev server with\n * what to write instead, and set up once before the endpoints answer anything.\n */\nimport type { ServerContext, ServerPlugin } from '#src/index.ts';\nimport { checkShortcuts, OWN, ownShortcut, type Shortcut } from '#src/shortcut.ts';\n\nconst NAME = /^[a-z][a-z0-9-]*$/;\n\n/** Throws what to fix in a set of plugins: names, what they need, and their shortcuts, beside deictic's own. */\nexport function checkPlugins(plugins: readonly ServerPlugin[], own?: Shortcut | false): void {\n const names = new Set<string>();\n for (const { name, client, shortcut } of plugins) {\n if (!NAME.test(name)) throw new Error(`deictic: a plugin is named \"${name}\": name it in lowercase letters, digits and -`);\n if (names.has(name)) throw new Error(`deictic: two plugins are named ${name}: load each once`);\n if (shortcut !== undefined && client === undefined)\n throw new Error(`deictic: ${name} has a shortcut but no \\`client\\` to draw its panel: give it one, or leave out its shortcut`);\n names.add(name);\n }\n for (const { name, needs = [] } of plugins) {\n const missing = needs.find((other) => !names.has(other));\n if (missing !== undefined) throw new Error(`deictic: ${name} needs the ${missing} plugin: add it to \\`plugins\\``);\n }\n checkShortcuts([{ name: OWN, shortcut: ownShortcut(own) }, ...plugins]);\n}\n\n/**\n * Runs every plugin's `setup`, all at once, and answers the context they share: `use` reads an API\n * when it's asked for, so setups may `use` each other's only after they've all run, from a route or an\n * op, never in `setup` itself.\n */\nexport async function setUp(root: string, plugins: readonly ServerPlugin[]): Promise<ServerContext> {\n const apis = new Map<string, unknown>();\n const context: ServerContext = { root, use: (name) => apis.get(name) as never };\n await Promise.all(\n plugins.map(async (p) => {\n if (p.setup !== undefined) apis.set(p.name, await p.setup(context));\n }),\n );\n return context;\n}\n","/**\n * What every bundler's integration shares: the options, the client module that starts the overlay, and\n * the transform that marks a JSX module. Each integration adds what its bundler does its own way: how a\n * module is transformed (a hook, a loader, `onLoad`), how the page loads the client (a virtual module\n * under Vite, a file in `.deictic/` elsewhere, as webpack, Turbopack and Bun have none), where the\n * endpoints are served, and what opens the editor.\n */\nimport { existsSync, readFileSync, writeFileSync } from 'node:fs';\nimport { dirname, isAbsolute, relative } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nimport type { ServerPlugin } from '#src/index.ts';\nimport { checkShortcuts, OWN, ownShortcut, type Shortcut } from '#src/shortcut.ts';\n\nimport { ASTRO, locateAstro } from './astro.ts';\nimport { keptIn } from './kept.ts';\nimport { JSX, locate, type Located } from './locate.ts';\nimport { checkPlugins } from './plugins.ts';\n\nexport interface DeicticOptions {\n /** The plugins to load, server halves: `tailwind()`, `tasks()`, your own. None by default. */\n plugins?: ServerPlugin[];\n /**\n * What opens the popup on any plugin, at the tab used last: Alt and the left button by default, or\n * `false` for none, leaving only plugins' own shortcuts.\n */\n shortcut?: Shortcut | false;\n}\n\n/** The options with their defaults, checked now, so a wrong set stops the dev server as it starts, not the page. */\nexport function prepare(options: DeicticOptions): { plugins: ServerPlugin[]; shortcut: Shortcut | false | undefined } {\n const plugins = options.plugins ?? [];\n checkPlugins(plugins, options.shortcut);\n return { plugins, shortcut: options.shortcut };\n}\n\n/**\n * The client module: the overlay, started with deictic's own shortcut and each plugin that has a half\n * in the page, with its shortcut, checked; and with `server`, a module of the page's that answers its requests\n * where no dev server does.\n */\nexport const clientModule = (plugins: ServerPlugin[], base: string, own?: Shortcut | false, server?: string) => {\n const [shortcut, ...shortcuts] = checkShortcuts([{ name: OWN, shortcut: ownShortcut(own) }, ...plugins]);\n const paged = plugins.flatMap((p, i) =>\n p.client === undefined ? [] : [{ client: p.client, rest: { shortcut: shortcuts[i], options: p.clientOptions } }],\n );\n return [\n `import { start } from 'deictic/client';`,\n ...paged.map((p, i) => `import p${i} from ${JSON.stringify(p.client)};`),\n ...(server === undefined ? [] : [`import server from ${JSON.stringify(server)};`]),\n // Its shortcut and options as JSON, where it has them: `JSON.stringify` leaves out what's undefined.\n `start({ base: ${JSON.stringify(base)}, shortcut: ${JSON.stringify(shortcut) ?? 'undefined'}, plugins: [${paged.map((p, i) => `{ plugin: p${i}, ...${JSON.stringify(p.rest)} }`).join(', ')}]${server === undefined ? '' : ', server'} });`,\n ].join('\\n');\n};\n\n/**\n * Writes the client module to `.deictic/client.js` for a bundler without virtual modules, and answers\n * its path. Its imports are bare (`deictic/client`, each plugin's), found from the project as its own\n * are. Written only when it changed, so a watching bundler doesn't rebuild for nothing.\n */\nexport function writeClient(root: string, plugins: ServerPlugin[], base: string, own?: Shortcut | false): string {\n const code = `// Written by deictic as the dev server starts: it starts the overlay in the page.\\n${clientModule(plugins, base, own)}\\n`;\n // Its own package: an ES module that runs for its effect. An app whose package.json says\n // `\"sideEffects\": false` would otherwise have webpack drop the import, which is only for its effect.\n const manifest = `${JSON.stringify({ private: true, type: 'module', sideEffects: true }, null, 2)}\\n`;\n writeIfChanged(keptIn(root, 'package.json'), manifest);\n return writeIfChanged(keptIn(root, 'client.js'), code);\n}\n\nfunction writeIfChanged(path: string, text: string): string {\n if (!existsSync(path) || readFileSync(path, 'utf8') !== text) writeFileSync(path, text);\n return path;\n}\n\n/** A module beside `url`, by its name: `.ts` from the source, `.js` from `dist`, as `url` is. */\nexport const beside = (url: string, name: string) =>\n fileURLToPath(new URL(`./${name}${url.endsWith('.ts') ? '.ts' : '.js'}`, url)).replaceAll('\\\\', '/');\n\n/**\n * The import of the written client module in the module at `from`, by a relative path with forward\n * slashes: Turbopack can't import a Windows path, and every bundler takes a relative one.\n */\nexport function importOf(path: string, from: string): string {\n const to = relative(dirname(from), path).replaceAll('\\\\', '/');\n return `\\nimport ${JSON.stringify(to.startsWith('.') ? to : `./${to}`)};\\n`;\n}\n\n/**\n * A module marked, by its absolute path: its host elements, and `append` after it (the client's import,\n * in the browser). Nothing for a file that isn't JSX, is a dependency's, or is outside the project.\n */\nexport function mark(code: string, path: string, root: string, append = ''): Located | undefined {\n const file = JSX.test(path) ? fileIn(path, root) : undefined;\n return file === undefined ? undefined : locate(code, file, append);\n}\n\n/** An `.astro` component marked, by its absolute path, as `mark` does a module. It's no module of the browser's, so nothing is appended. */\nexport function markAstro(code: string, path: string, root: string): Located | undefined {\n const file = ASTRO.test(path) ? fileIn(path, root) : undefined;\n return file === undefined ? undefined : locateAstro(code, file, root);\n}\n\n/** A project file's path from the root, as a mark has it; nothing for a dependency's or one outside the project. */\nfunction fileIn(path: string, root: string): string | undefined {\n if (/[\\\\/]node_modules[\\\\/]/.test(path) || !isAbsolute(path)) return undefined;\n const file = relative(root, path).replaceAll('\\\\', '/');\n return file.startsWith('..') || isAbsolute(file) ? undefined : file;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAeA,MAAa,YAAY;;AAEzB,MAAa,MAAM;;AAGnB,MAAa,SAAS,MAAc,SAAiB,UAAU,MAAM,MAAM,aAAa,KAAK,IAAI,IAAI,EAAE,MAAM,MAAM,IAAI,KAAA,CAAS;;AAQhI,MAAa,UAAU,OAA0B,GAAG,KAAK,SAAS,mBAAmB,SAAS,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AAA,IAAY,KAAA,IAAY,OAAO,MAAM,MAAM,MAAM;AACnE;;AAGA,SAAgB,UAAU,MAAc,MAAc,MAAmC;CACvF,MAAM,OAAO,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,IAAI,IAAI,KAAA;CACrD,OAAO,SAAS,KAAA,IAAY,KAAA,IAAY,YAAY,MAAM,MAAM,IAAI;AACtE;;AAGA,SAAS,OAAO,MAAc,MAAkC;CAC9D,IAAI,yBAAyB,KAAK,IAAI,KAAK,CAAC,WAAW,IAAI,GAAG,OAAO,KAAA;CACrE,MAAM,OAAO,SAAS,MAAM,IAAI,CAAC,CAAC,WAAW,MAAM,GAAG;CACtD,OAAO,KAAK,WAAW,IAAI,KAAK,WAAW,IAAI,IAAI,KAAA,IAAY;AACjE"}
@@ -3,8 +3,8 @@ import { join } from "node:path";
3
3
  // src/tools/kept.ts
4
4
  /**
5
5
  * Where deictic keeps what it makes for a project: `.deictic/` at its root, beside `.board/` and the like,
6
- * rather than in `node_modules`, which an install may clear. The history is there, and the shots,
7
- * recordings and voice clips plugins keep. It ignores itself in git: the history holds whole files, and
6
+ * rather than in `node_modules`, which an install may clear. The history is there, the shots,
7
+ * recordings and voice clips plugins keep, and the tasks plugin's own board. It ignores itself in git: the history holds whole files, and
8
8
  * the rest is the page as it looked, neither of which belongs in a commit.
9
9
  */
10
10
  const IGNORE = "# deictic's own: the history, and the shots, recordings and voice clips it keeps.\n*\n";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kept.js","names":[],"sources":["../../src/tools/kept.ts"],"sourcesContent":["/**\n * Where deictic keeps what it makes for a project: `.deictic/` at its root, beside `.board/` and the like,\n * rather than in `node_modules`, which an install may clear. The history is there, the shots,\n * recordings and voice clips plugins keep, and the tasks plugin's own board. It ignores itself in git: the history holds whole files, and\n * the rest is the page as it looked, neither of which belongs in a commit.\n */\nimport { existsSync, mkdirSync, writeFileSync } from 'node:fs';\nimport { join } from 'node:path';\n\nconst IGNORE = \"# deictic's own: the history, and the shots, recordings and voice clips it keeps.\\n*\\n\";\n\n/** A path under the project's `.deictic/`, made with its `.gitignore` the first time. */\nexport function keptIn(root: string, ...parts: string[]): string {\n const dir = join(root, '.deictic');\n const ignore = join(dir, '.gitignore');\n if (!existsSync(ignore)) {\n mkdirSync(dir, { recursive: true });\n writeFileSync(ignore, IGNORE);\n }\n return join(dir, ...parts);\n}\n"],"mappings":";;;;;;;;;AASA,MAAM,SAAS;;AAGf,SAAgB,OAAO,MAAc,GAAG,OAAyB;CAC/D,MAAM,MAAM,KAAK,MAAM,UAAU;CACjC,MAAM,SAAS,KAAK,KAAK,YAAY;CACrC,IAAI,CAAC,WAAW,MAAM,GAAG;EACvB,UAAU,KAAK,EAAE,WAAW,KAAK,CAAC;EAClC,cAAc,QAAQ,MAAM;CAC9B;CACA,OAAO,KAAK,KAAK,GAAG,KAAK;AAC3B"}
@@ -5,10 +5,15 @@
5
5
  */
6
6
  const MARKS = "deictic.annotations";
7
7
  /**
8
+ * The custom event for the page's address changing with no load, as a router does it (`href`, the new one): rrweb
9
+ * records what the route drew, not that the address changed. A page that loads has rrweb's own `Meta` instead.
10
+ */
11
+ const PAGE = "deictic.page";
12
+ /**
8
13
  * The custom event a recording ends with: rrweb's timeline lasts as long as its events, so without it a
9
14
  * recording of a still page (a voice-over, say) would replay as a moment, and its voice never play.
10
15
  */
11
16
  const END = "deictic.end";
12
- export { MARKS as n, END as t };
17
+ export { MARKS as n, PAGE as r, END as t };
13
18
 
14
19
  //# sourceMappingURL=marks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marks.js","names":[],"sources":["../../src/plugins/recordings/marks.ts"],"sourcesContent":["/**\n * The custom event's tag the marks go in: the page's annotations, as an SVG in page coordinates (`svg`),\n * and as the annotations themselves (`annotations`, absent from recordings made before it was added).\n */\nexport const MARKS = 'deictic.annotations';\n\n/**\n * The custom event for the page's address changing with no load, as a router does it (`href`, the new one): rrweb\n * records what the route drew, not that the address changed. A page that loads has rrweb's own `Meta` instead.\n */\nexport const PAGE = 'deictic.page';\n\n/**\n * The custom event a recording ends with: rrweb's timeline lasts as long as its events, so without it a\n * recording of a still page (a voice-over, say) would replay as a moment, and its voice never play.\n */\nexport const END = 'deictic.end';\n"],"mappings":";;;;;AAIA,MAAa,QAAQ;;;;;AAMrB,MAAa,OAAO;;;;;AAMpB,MAAa,MAAM"}