@cmodjs/core 5.10.0 → 5.12.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.
@@ -1 +1 @@
1
- {"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../src/runtime/sessions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAM5D,OAAO,EAAE,UAAU,EAAE,MAAM,gDAAgD,CAAA;AAC3E,OAAO,EAAsB,KAAK,IAAI,EAAE,MAAM,iCAAiC,CAAA;AAC/E,OAAO,EAA+D,KAAK,aAAa,EAAE,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAG5K,OAAO,EAAuD,KAAK,WAAW,EAA+F,KAAK,WAAW,EAA8D,KAAK,YAAY,EAAuC,KAAK,QAAQ,EAAkB,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,KAAK,EAAE,MAAM,uBAAuB,CAAA;AACla,OAAO,EAAsC,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAC1F,OAAO,EAAkF,KAAK,KAAK,EAAE,MAAM,aAAa,CAAA;AACxH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAIzC,OAAO,EAA+B,KAAK,UAAU,EAAE,MAAM,YAAY,CAAA;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,MAAM,MAAM,QAAQ,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,CAA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C,GAAG,YAAY,CAAA;IAC7R,CAAC,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,iBAAiB,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,iBAAiB,CAAC,KAAK,OAAO,CAAC,oBAAoB,CAAC,KAAK,OAAO,CAAC,oBAAoB,CAAC,GAAG,YAAY,CAAA;CACnL,CAAA;AAED,eAAO,MAAM,QAAQ,UAAW,OAAO,KAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAqH,CAAA;AAE/L,eAAO,MAAM,OAAO,WAAY,UAAU,KAAG,UAAmG,CAAA;AAqChJ,KAAK,iBAAiB,GAAG,OAAO,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAA;AAmChE,wBAAsB,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAc1H;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,OAAO,GAAG,UAAU,CAGrF;AAkBD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC,EAAE,IAAI,EAAE,YAAY,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,UAAU,CAI7L"}
@@ -11,7 +11,7 @@ import { TaskEnd, TaskStart } from '../session/goal/task.js';
11
11
  import { beforeEvents, processEvents, Session, sessionEvents } from '../session/session.js';
12
12
  import { matches, sentMatcher } from '../utils/matcher.js';
13
13
  import { beforeAnswerKeys, foldAnswers, foldBefore, methodOf, takenAnswer } from './before.js';
14
- import { cmodPluginName } from './dependencies.js';
14
+ import { cmodPluginName, isStillInstalling } from './dependencies.js';
15
15
  import { messageOf } from '../utils/text.js';
16
16
  import { listenerOf, PassedTimeout, withinTime } from './deadline.js';
17
17
  import { callFiles } from './hooks.js';
@@ -167,7 +167,11 @@ export function createSessionsClient({ name, claude, report, hookOn, routeOn, pe
167
167
  const tree = parentsOf(session);
168
168
  if (tree instanceof Map)
169
169
  return isInScope(scope, session, change, isUnderIn(tree));
170
- return tree.then((read) => isInScope(scope, session, change, isUnderIn(read)), (error) => (report(`tasks:${session}`, 'Could not read the tasks it listens under', error), false));
170
+ return tree.then((read) => isInScope(scope, session, change, isUnderIn(read)), (error) => {
171
+ if (!isStillInstalling(cmodPluginName, error))
172
+ report(`tasks:${session}`, 'Could not read the tasks it listens under', error);
173
+ return false;
174
+ });
171
175
  };
172
176
  const remember = (session, change) => {
173
177
  if (change.type !== TaskStart)
@@ -14,6 +14,7 @@ export type Failure = {
14
14
  readonly description?: string;
15
15
  readonly retry?: () => unknown;
16
16
  readonly isCritical?: boolean;
17
+ readonly root?: string;
17
18
  };
18
19
  export type LoggedFailure = {
19
20
  readonly mod: string;
@@ -1 +1 @@
1
- {"version":3,"file":"toaster.d.ts","sourceRoot":"","sources":["../src/runtime/toaster.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAS,MAAM,aAAa,CAAA;AACpF,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAgB,SAAS,EAAE,MAAM,WAAW,CAAA;AAExE,OAAO,EAAgD,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAA;AAEzG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAIzC,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,OAAO,E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AK,EAAE,SAAS,UAAU,EAAE,CAAA;IACrC,IAAI,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAAA;CACnH,CAAA;AA6CD,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,MAAM,GAAG,SAAS,GAAG,OAAO,CAoVtG;AA2BD,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,aAAa,CAS1G;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAQhG"}
@@ -80,8 +80,10 @@ export function createToaster(claude, name, version) {
80
80
  else
81
81
  sent.delete(String(id));
82
82
  for (const entry of entries.values()) {
83
- if (id !== undefined && entry.id !== id)
83
+ if (id !== undefined && entry.id !== id && !entry.merged.has(String(id)))
84
84
  continue;
85
+ for (const merged of entry.merged.keys())
86
+ sent.delete(merged);
85
87
  disarm(entry);
86
88
  entries.delete(entry.id);
87
89
  }
@@ -98,7 +100,7 @@ export function createToaster(claude, name, version) {
98
100
  if (previous !== undefined)
99
101
  disarm(previous);
100
102
  const reporting = hides !== undefined && previous?.hides === hides ? previous.reporting : undefined;
101
- const entry = { id, type, message, options, actions, ...(hides === undefined ? {} : { hides }), at: new Date(), isOpen: previous?.isOpen ?? false, reporting, timer: undefined };
103
+ const entry = { id, type, message, options, actions, ...(hides === undefined ? {} : { hides }), merged: new Map(), count: 1, at: new Date(), isOpen: previous?.isOpen ?? false, reporting, timer: undefined };
102
104
  if (type === 'error' && previous?.message !== message)
103
105
  claude.ui.log(`${name}: ${message}${typeof options.description === 'string' ? `: ${options.description}` : ''}`, { to: 'debug' });
104
106
  entries.set(id, entry);
@@ -110,7 +112,8 @@ export function createToaster(claude, name, version) {
110
112
  dismiss(entry.id);
111
113
  if (entry.hides === undefined)
112
114
  return;
113
- hidden.set(String(entry.id), entry.hides);
115
+ for (const [id, hides] of [[String(entry.id), entry.hides], ...entry.merged])
116
+ hidden.set(id, hides);
114
117
  void claude.store.set(hiddenKey, Object.fromEntries(hidden)).catch((error) => warn('hidden:write', `${name}: could not remember the failure you hid: ${messageOf(error)}`));
115
118
  };
116
119
  const toast = Object.assign(show('default'), {
@@ -177,7 +180,7 @@ export function createToaster(claude, name, version) {
177
180
  return undefined;
178
181
  }
179
182
  };
180
- const fail = ({ id, message, error, description = error === undefined || describe(error) === message ? undefined : describe(error), retry, isCritical = false }) => {
183
+ const fail = ({ id, message, error, description = error === undefined || describe(error) === message ? undefined : describe(error), retry, isCritical = false, root = claude.plugin.root }) => {
181
184
  const hides = `${version() ?? ''}\n${message}\n${error === undefined ? '' : describe(error)}`;
182
185
  const at = new Date();
183
186
  const repeat = `${hides}\n${description ?? ''}\n${at.toISOString().slice(0, 16)}`;
@@ -189,7 +192,7 @@ export function createToaster(claude, name, version) {
189
192
  const logged = async () => {
190
193
  const contact = await contactOf(claude);
191
194
  const version = await modVersion();
192
- const failure = { mod: name, id, message, details: detailsOf(version, at, `${message}${description === undefined ? '' : `\n${description}`}${stack}`), at: at.toISOString(), isCritical, root: claude.plugin.root, ...(contact === undefined ? {} : { contact }), level: 'error', version, core: coreVersion };
195
+ const failure = { mod: name, id, message, details: detailsOf(version, at, `${message}${description === undefined ? '' : `\n${description}`}${stack}`), at: at.toISOString(), isCritical, root, ...(contact === undefined ? {} : { contact }), level: 'error', version, core: coreVersion };
193
196
  const shows = await showsToast(failure, isCritical);
194
197
  if (isCritical)
195
198
  return;
@@ -201,12 +204,19 @@ export function createToaster(claude, name, version) {
201
204
  if (hidden.get(id) === hides)
202
205
  return;
203
206
  hidden.delete(id);
204
- const shown = entries.get(id);
205
- if (shown?.hides === hides && shown.trying === undefined && shown.options.description === description) {
206
- const previous = clockTime(shown.at);
207
+ const own = entries.get(id);
208
+ const text = description ?? message;
209
+ const shown = own === undefined
210
+ ? [...entries.values()].find((entry) => entry.hides !== undefined && entry.trying === undefined && (entry.options.description ?? entry.message) === text)
211
+ : own.hides === hides && own.trying === undefined && own.options.description === description
212
+ ? own
213
+ : undefined;
214
+ if (shown !== undefined) {
215
+ if (shown !== own)
216
+ shown.merged.set(id, hides);
217
+ shown.count += 1;
207
218
  shown.at = new Date();
208
- if (clockTime(shown.at) !== previous)
209
- changed();
219
+ changed();
210
220
  return;
211
221
  }
212
222
  const actions = [...fixes, ...(retry === undefined ? [] : [{ label: 'Retry', onClick: tryAgain }]), { label: 'Report', onClick: startReporting }];
@@ -264,7 +274,7 @@ export function createToaster(claude, name, version) {
264
274
  const fixed = (child) => Box({ flexShrink: 0, children: child });
265
275
  const close = Button({ plain: true, dimColor: true, key: `toast:${entry.id}:close`, label: entry.hides === undefined ? '✕' : 'Hide', onPress: () => hide(entry) });
266
276
  const actions = entry.actions.map((action, index) => Button({ plain: true, key: `toast:${entry.id}:${index === 0 ? 'action' : `action-${index}`}`, label: action.label, onPress: press(entry, action.onClick) }));
267
- const buttons = Box({ gap: 2, flexWrap: 'wrap', children: [...actions, Text({ dimColor: true, children: clockTime(entry.at) })].map(fixed) });
277
+ const buttons = Box({ gap: 2, flexWrap: 'wrap', children: [...actions, Text({ dimColor: true, children: entry.count > 1 ? `${clockTime(entry.at)} · ${entry.count} times` : clockTime(entry.at) })].map(fixed) });
268
278
  const trying = entry.trying === undefined ? undefined : Box({ gap: 1, children: [Text({ dimColor: true, children: 'Trying again:' }), typeof entry.trying === 'string' ? Text({ dimColor: true, wrap: 'truncate-end', children: entry.trying }) : entry.trying] });
269
279
  const text = details === undefined ? [message] : [message, trying ?? details];
270
280
  const under = trying !== undefined && details === undefined ? [trying] : entry.reporting === undefined ? [buttons] : reportChoices(entry, entry.reporting);
@@ -0,0 +1,82 @@
1
+ export type SidebarTab = {
2
+ readonly key: string;
3
+ readonly label: string;
4
+ readonly isClosable: boolean;
5
+ };
6
+ export type ClosedPage = {
7
+ readonly mod: string;
8
+ readonly page: string;
9
+ readonly title: string;
10
+ };
11
+ export type SessionWait = {
12
+ readonly kind: 'permission';
13
+ readonly tool: string;
14
+ readonly input: Readonly<Record<string, unknown>>;
15
+ } | {
16
+ readonly kind: 'question';
17
+ readonly question: string;
18
+ };
19
+ export type TurnOutcome = {
20
+ readonly reason: 'answered' | 'stopped' | 'failed';
21
+ readonly at: string;
22
+ readonly failure?: string;
23
+ };
24
+ export type SessionAbout = {
25
+ readonly tabs: readonly SidebarTab[];
26
+ readonly pages: readonly ClosedPage[];
27
+ readonly isWorking?: boolean;
28
+ readonly waiting?: SessionWait;
29
+ readonly lastTurn?: TurnOutcome;
30
+ readonly contextPercent?: number;
31
+ };
32
+ export type WebView = {
33
+ readonly id: string;
34
+ readonly tab: string;
35
+ readonly columns: number;
36
+ };
37
+ export type WebInput = {
38
+ readonly draw: number;
39
+ readonly handler: number;
40
+ readonly key: string;
41
+ readonly kind: 'press' | 'change' | 'submit' | 'select' | 'link';
42
+ readonly value?: string;
43
+ readonly href?: string;
44
+ };
45
+ export type WebAction = ({
46
+ readonly type: 'press';
47
+ readonly view: string;
48
+ } & WebInput) | {
49
+ readonly type: 'open';
50
+ readonly mod: string;
51
+ readonly page: string;
52
+ } | {
53
+ readonly type: 'close';
54
+ readonly tab: string;
55
+ } | {
56
+ readonly type: 'prompt';
57
+ readonly text: string;
58
+ } | {
59
+ readonly type: 'stop';
60
+ };
61
+ export type ElementData = {
62
+ readonly $cmodElement: string;
63
+ readonly props: Readonly<Record<string, unknown>>;
64
+ };
65
+ export type HandlerData = {
66
+ readonly $cmodHandler: number;
67
+ };
68
+ export type SessionEvents = {
69
+ readonly views: readonly WebView[];
70
+ readonly actions: readonly WebAction[];
71
+ };
72
+ export type WebDrawing = {
73
+ readonly view: string;
74
+ readonly draw: number;
75
+ readonly tree: unknown;
76
+ };
77
+ export type SessionPost = {
78
+ readonly about?: SessionAbout;
79
+ readonly drawings?: readonly WebDrawing[];
80
+ };
81
+ export declare function htmlOf(tree: unknown): string;
82
+ //# sourceMappingURL=web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../src/runtime/web.ts"],"names":[],"mappings":"AA4CA,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAAA;AAEvG,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEhG,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAA;AAE9L,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;IAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAEhI,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,IAAI,EAAE,SAAS,UAAU,EAAE,CAAA;IACpC,QAAQ,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AAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAClD;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAE7B,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;CAAE,CAAA;AAE9G,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAA;AAE3D,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,OAAO,EAAE,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,CAAA;CAAE,CAAA;AAE1G,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAA;AAEjG,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,UAAU,EAAE,CAAA;CAAE,CAAA;AAEtG,wBAAgB,MAAM,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAI5C"}
package/runtime/web.js ADDED
@@ -0,0 +1,381 @@
1
+ import { fromMarkdown, gfm, gfmFromMarkdown } from '../vendor-markdown.js';
2
+ const elementKey = '$cmodElement';
3
+ const handlerKey = '$cmodHandler';
4
+ const themeKeys = new Set(['text', 'inverseText', 'inactive', 'subtle', 'suggestion', 'remember', 'success', 'error', 'warning', 'merged', 'claude', 'permission', 'planMode', 'autoAccept', 'promptBorder', 'bashBorder', 'ide', 'diffAdded', 'diffRemoved', 'diffAddedDimmed', 'diffRemovedDimmed', 'diffAddedWord', 'diffRemovedWord']);
5
+ const spaceSteps = { xs: 0.25, sm: 0.5, md: 1, lg: 1.5, xl: 2 };
6
+ const flexValues = {
7
+ flexDirection: new Set(['row', 'column', 'row-reverse', 'column-reverse']),
8
+ flexWrap: new Set(['nowrap', 'wrap', 'wrap-reverse']),
9
+ alignItems: new Set(['flex-start', 'center', 'flex-end', 'stretch']),
10
+ alignSelf: new Set(['flex-start', 'center', 'flex-end', 'auto']),
11
+ justifyContent: new Set(['flex-start', 'center', 'flex-end', 'space-between', 'space-around', 'space-evenly']),
12
+ };
13
+ const cssNames = { flexDirection: 'flex-direction', flexWrap: 'flex-wrap', alignItems: 'align-items', alignSelf: 'align-self', justifyContent: 'justify-content' };
14
+ const sides = [
15
+ ['Top', 'Y', 'down'],
16
+ ['Right', 'X', 'across'],
17
+ ['Bottom', 'Y', 'down'],
18
+ ['Left', 'X', 'across'],
19
+ ];
20
+ const linkSchemes = /^(https?:|mailto:|file:)/i;
21
+ const hotkeys = /^[0-9a-z]$/;
22
+ const base64 = /^[A-Za-z0-9+/]*={0,2}$/;
23
+ const markdownOptions = { extensions: [gfm()], mdastExtensions: [gfmFromMarkdown()] };
24
+ export function htmlOf(tree) {
25
+ const drawing = { rules: [], groups: new Map(), scopes: 0, scope: undefined };
26
+ const body = nodeHtml(tree, drawing);
27
+ return drawing.rules.length === 0 ? body : `<style>${drawing.rules.join('')}</style>${body}`;
28
+ }
29
+ function nodeHtml(tree, drawing) {
30
+ if (tree === null || tree === undefined || typeof tree === 'boolean')
31
+ return '';
32
+ if (typeof tree === 'string')
33
+ return escaped(tree);
34
+ if (typeof tree === 'number')
35
+ return String(tree);
36
+ if (Array.isArray(tree))
37
+ return tree.map((each) => nodeHtml(each, drawing)).join('');
38
+ if (typeof tree !== 'object')
39
+ return '';
40
+ const fields = tree;
41
+ const name = fields[elementKey];
42
+ if (typeof name !== 'string')
43
+ return '';
44
+ const props = (typeof fields['props'] === 'object' && fields['props'] !== null ? fields['props'] : {});
45
+ const draw = elements[name];
46
+ return draw === undefined ? `<span class="gap">${escaped(`The browser draws no ${name}.`)}</span>` : draw(props, drawing);
47
+ }
48
+ const elements = {
49
+ Box: (props, drawing) => {
50
+ const key = keyOf(props);
51
+ const own = key === undefined ? undefined : `s${drawing.scopes++}`;
52
+ const outer = drawing.scope;
53
+ const hover = hoverClasses(props['hover'], boxHover(props), drawing, own ?? outer);
54
+ const classes = ['b', ...(typeof props['borderStyle'] === 'string' ? ['bordered'] : []), ...(own === undefined ? [] : [own]), ...hover];
55
+ drawing.scope = own ?? outer;
56
+ const children = nodeHtml(props['children'], drawing);
57
+ drawing.scope = outer;
58
+ return `<div class="${classes.join(' ')}"${attribute('data-key', key)}${attribute('style', boxStyle(props))}>${children}</div>`;
59
+ },
60
+ Text: (props, drawing) => {
61
+ const hover = hoverClasses(props['hover'], textHover(props), drawing, drawing.scope);
62
+ return `<span class="${['t', ...textClasses(props), ...hover].join(' ')}"${attribute('style', textStyle(props))}${attribute('dir', props['dir'] === 'rtl' || props['dir'] === 'ltr' ? props['dir'] : undefined)}>${nodeHtml(props['children'], drawing)}</span>`;
63
+ },
64
+ Button: (props, drawing) => {
65
+ const label = typeof props['label'] === 'string' ? props['label'] : undefined;
66
+ const drawn = nodeHtml(props['children'], drawing);
67
+ const shown = drawn === '' ? escaped(label ?? '') : drawn;
68
+ const hotkey = typeof props['hotkey'] === 'string' && hotkeys.test(props['hotkey']) ? props['hotkey'] : undefined;
69
+ const prefix = props['plain'] === true && hotkey !== undefined ? `<span class="hotkey">${hotkey}</span>: ` : '';
70
+ const hover = hoverClasses(props['hover'], textHover({}), drawing, drawing.scope);
71
+ const classes = ['button', ...(props['plain'] === true ? ['plain'] : props['variant'] === 'primary' ? ['primary'] : []), ...(props['dimColor'] === true ? ['dim'] : []), ...hover];
72
+ const key = keyOf(props) ?? label ?? (typeof props['children'] === 'string' ? props['children'] : undefined);
73
+ return `<button type="button" class="${classes.join(' ')}"${attribute('aria-label', drawn === '' ? undefined : label)}${attribute('data-key', key)}${handlerAttribute('data-press', props['onPress'])}${attribute('data-hotkey', hotkey)}${props['autoFocus'] === true ? ' autofocus' : ''}>${prefix}${shown}</button>`;
74
+ },
75
+ Link: (props, drawing) => {
76
+ const href = typeof props['href'] === 'string' ? props['href'] : '';
77
+ const drawn = nodeHtml(props['children'], drawing);
78
+ const text = drawn === '' ? escaped(typeof props['label'] === 'string' ? props['label'] : href) : drawn;
79
+ return linkSchemes.test(href) ? `<a class="link" href="${escaped(href)}" target="_blank" rel="noopener noreferrer">${text}</a>` : `<span class="t">${text}</span>`;
80
+ },
81
+ Code: (props) => codeHtml(typeof props['source'] === 'string' ? props['source'] : '', typeof props['startLine'] === 'number' ? props['startLine'] : undefined, props['format'] === 'diff', props['wrap'] === 'truncate-end'),
82
+ Markdown: (props) => {
83
+ const text = typeof props['text'] === 'string' ? props['text'] : '';
84
+ const pressable = Array.isArray(props['pressableLinks']) ? props['pressableLinks'].filter((href) => typeof href === 'string') : undefined;
85
+ const blocks = fromMarkdown(text, markdownOptions).children.map((node) => blockHtml(node, { link: handlerOf(props['onLinkPress']), pressable })).join('');
86
+ return `<div class="${props['dimColor'] === true ? 'markdown dim' : 'markdown'}"${attribute('data-key', keyOf(props))}>${blocks}</div>`;
87
+ },
88
+ Input: (props) => {
89
+ const value = typeof props['value'] === 'string' ? props['value'] : '';
90
+ const rows = typeof props['rows'] === 'number' && props['rows'] > 1 ? Math.floor(props['rows']) : 1;
91
+ const shared = `${attribute('data-key', keyOf(props))}${handlerAttribute('data-input', props['onInput'])}${handlerAttribute('data-submit', props['onSubmit'])}${attribute('data-value', value)}${attribute('placeholder', typeof props['placeholder'] === 'string' ? props['placeholder'] : undefined)}${props['autoFocus'] === true ? ' autofocus' : ''}`;
92
+ const field = rows > 1 ? `<textarea class="input" rows="${rows}"${shared}>${escaped(value)}</textarea>` : `<input type="text" class="input"${shared} value="${escaped(value)}">`;
93
+ const submitLabel = typeof props['submitLabel'] === 'string' ? props['submitLabel'] : 'submit';
94
+ return `<label class="field">${labelHtml(props['label'])}${field}<span class="hint">enter: ${escaped(submitLabel)}</span></label>`;
95
+ },
96
+ Select: (props) => {
97
+ const value = typeof props['value'] === 'string' ? props['value'] : undefined;
98
+ const options = (Array.isArray(props['options']) ? props['options'] : []).flatMap((option) => {
99
+ const each = option;
100
+ if (typeof each['value'] !== 'string')
101
+ return [];
102
+ const label = typeof each['label'] === 'string' ? each['label'] : each['value'];
103
+ return [`<option value="${escaped(each['value'])}"${each['value'] === value ? ' selected' : ''}>${escaped(label)}</option>`];
104
+ });
105
+ return `<label class="field">${labelHtml(props['label'])}<select class="select"${attribute('data-key', keyOf(props))}${handlerAttribute('data-select', props['onSelect'])}${attribute('data-value', value)}${props['autoFocus'] === true ? ' autofocus' : ''}>${options.join('')}</select></label>`;
106
+ },
107
+ Image: (props) => {
108
+ const source = props['source'];
109
+ const alt = typeof props['alt'] === 'string' ? props['alt'] : '';
110
+ const size = attribute('style', `width:${across(numberOr(props['columns'], 1))};height:${down(numberOr(props['rows'], 1))}`);
111
+ if (typeof source?.['png'] === 'string' && base64.test(source['png']))
112
+ return `<img class="image" alt="${escaped(alt)}" src="data:image/png;base64,${source['png']}"${size}>`;
113
+ const [width, height] = [source?.['width'], source?.['height']];
114
+ if (typeof source?.['rgba'] === 'string' && base64.test(source['rgba']) && Number.isInteger(width) && Number.isInteger(height))
115
+ return `<canvas class="image" width="${width}" height="${height}" data-rgba="${source['rgba']}"${attribute('aria-label', alt)}${size}></canvas>`;
116
+ return `<span class="t dim"${size}>${escaped(alt)}</span>`;
117
+ },
118
+ Svg: (props) => {
119
+ const source = typeof props['source'] === 'string' ? props['source'] : '';
120
+ const size = [typeof props['width'] === 'number' ? `width:${props['width']}px` : '', typeof props['height'] === 'number' ? `height:${props['height']}px` : ''].filter((each) => each !== '').join(';');
121
+ return `<img class="svg" alt="${escaped(typeof props['alt'] === 'string' ? props['alt'] : '')}" src="data:image/svg+xml,${encodeURIComponent(source)}"${attribute('style', size === '' ? undefined : size)}>`;
122
+ },
123
+ Raster: (props) => rasterHtml(typeof props['cells'] === 'string' ? props['cells'] : '', numberOr(props['columns'], 1)),
124
+ };
125
+ function escaped(text) {
126
+ return text.replace(/[&<>"']/g, (character) => `&#${character.charCodeAt(0)};`);
127
+ }
128
+ function attribute(name, value) {
129
+ return value === undefined || value === '' ? '' : ` ${name}="${escaped(value)}"`;
130
+ }
131
+ function handlerOf(value) {
132
+ const marker = typeof value === 'object' && value !== null ? value[handlerKey] : undefined;
133
+ return typeof marker === 'number' ? marker : undefined;
134
+ }
135
+ function handlerAttribute(name, value) {
136
+ const handler = handlerOf(value);
137
+ return handler === undefined ? '' : ` ${name}="${handler}"`;
138
+ }
139
+ function keyOf(props) {
140
+ return typeof props['key'] === 'string' ? props['key'] : undefined;
141
+ }
142
+ function numberOr(value, fallback) {
143
+ return typeof value === 'number' && Number.isFinite(value) ? value : fallback;
144
+ }
145
+ function across(cells) {
146
+ return `${cells}ch`;
147
+ }
148
+ function down(cells) {
149
+ return `calc(${cells} * var(--row))`;
150
+ }
151
+ function cellsOf(value) {
152
+ if (typeof value === 'number' && Number.isFinite(value))
153
+ return value;
154
+ return typeof value === 'string' ? spaceSteps[value] : undefined;
155
+ }
156
+ function sizeOf(value, axis) {
157
+ if (typeof value === 'string' && /^\d+(\.\d+)?%$/.test(value))
158
+ return value;
159
+ const cells = typeof value === 'number' && Number.isFinite(value) ? value : undefined;
160
+ return cells === undefined ? undefined : axis === 'across' ? across(cells) : down(cells);
161
+ }
162
+ function colorOf(value) {
163
+ if (typeof value !== 'string')
164
+ return undefined;
165
+ if (themeKeys.has(value) || /^[a-z]+[A-Z][A-Za-z]*$/.test(value))
166
+ return `var(--${value})`;
167
+ return /^#[0-9a-f]{3,8}$/i.test(value) || /^(rgb|hsl)a?\([\d\s.,%]+\)$/i.test(value) || /^[a-z]+$/.test(value) ? value : undefined;
168
+ }
169
+ function dimmed(color) {
170
+ return `color-mix(in srgb, ${color} 55%, transparent)`;
171
+ }
172
+ function css(declarations, suffix = '') {
173
+ return declarations.flatMap(([name, value]) => (value === undefined ? [] : [`${name}:${value}${suffix}`])).join(';');
174
+ }
175
+ function hoverClasses(hover, declarations, drawing, scope) {
176
+ if (typeof hover !== 'object' || hover === null)
177
+ return [];
178
+ const lit = hover;
179
+ const rule = css(declarations(lit), ' !important');
180
+ const group = typeof lit['scope'] === 'string' ? (drawing.groups.get(lit['scope']) ?? `g${drawing.groups.size}`) : undefined;
181
+ if (rule === '' || (group === undefined && scope === undefined))
182
+ return [];
183
+ const name = `h${drawing.rules.length}`;
184
+ if (group === undefined) {
185
+ drawing.rules.push(`.${scope}:hover .${name},.${scope}.${name}:hover{${rule}}`);
186
+ return [name];
187
+ }
188
+ drawing.groups.set(lit['scope'], group);
189
+ drawing.rules.push(`:root:has(.${group}:hover) .${name}{${rule}}`);
190
+ return [name, group];
191
+ }
192
+ function boxHover(props) {
193
+ return (hover) => {
194
+ const offset = (side, axis) => (props['position'] === 'absolute' ? sizeOf(hover[side], axis) : undefined);
195
+ const color = colorOf(hover['borderColor'] ?? props['borderColor']) ?? 'currentColor';
196
+ const isBorderLit = typeof props['borderStyle'] === 'string' && (hover['borderColor'] !== undefined || hover['borderDimColor'] !== undefined);
197
+ return [
198
+ ['display', hover['display'] === 'flex' ? 'flex' : undefined],
199
+ ['background', colorOf(hover['backgroundColor'])],
200
+ ['--border-color', isBorderLit ? ((hover['borderDimColor'] ?? props['borderDimColor']) === true ? dimmed(color) : color) : undefined],
201
+ ['top', offset('top', 'down')],
202
+ ['left', offset('left', 'across')],
203
+ ['right', offset('right', 'across')],
204
+ ['bottom', offset('bottom', 'down')],
205
+ ];
206
+ };
207
+ }
208
+ function textHover(props) {
209
+ return (hover) => textDeclarations({ ...props, ...hover });
210
+ }
211
+ function boxStyle(props) {
212
+ const style = [];
213
+ const add = (name, value) => void style.push([name, value]);
214
+ for (const [prop, allowed] of Object.entries(flexValues))
215
+ add(cssNames[prop] ?? prop, typeof props[prop] === 'string' && allowed.has(props[prop]) ? props[prop] : undefined);
216
+ add('flex-grow', typeof props['flexGrow'] === 'number' ? String(props['flexGrow']) : undefined);
217
+ add('flex-shrink', typeof props['flexShrink'] === 'number' ? String(props['flexShrink']) : undefined);
218
+ const columnGap = cellsOf(props['columnGap'] ?? props['gap']);
219
+ const rowGap = cellsOf(props['rowGap'] ?? props['gap']);
220
+ add('column-gap', columnGap === undefined ? undefined : across(columnGap));
221
+ add('row-gap', rowGap === undefined ? undefined : down(rowGap));
222
+ add('width', sizeOf(props['width'], 'across'));
223
+ add('height', sizeOf(props['height'], 'down'));
224
+ add('min-width', sizeOf(props['minWidth'], 'across'));
225
+ add('min-height', sizeOf(props['minHeight'], 'down'));
226
+ const hasBorder = typeof props['borderStyle'] === 'string';
227
+ for (const [side, axis, unit] of sides) {
228
+ const margin = cellsOf(props[`margin${side}`] ?? props[`margin${axis}`] ?? props['margin']);
229
+ const padding = (cellsOf(props[`padding${side}`] ?? props[`padding${axis}`] ?? props['padding']) ?? 0) + (hasBorder ? 1 : 0);
230
+ add(`margin-${side.toLowerCase()}`, margin === undefined ? undefined : unit === 'across' ? across(margin) : down(margin));
231
+ if (padding > 0)
232
+ add(`padding-${side.toLowerCase()}`, unit === 'across' ? across(padding) : down(padding));
233
+ }
234
+ if (hasBorder) {
235
+ const color = colorOf(props['borderColor']) ?? 'currentColor';
236
+ add('--border-color', props['borderDimColor'] === true ? dimmed(color) : color);
237
+ add('--border-style', props['borderStyle'] === 'double' ? 'double' : props['borderStyle'] === 'classic' || props['borderStyle'] === 'dashed' ? 'dashed' : 'solid');
238
+ add('--border-radius', props['borderStyle'] === 'round' ? '0.5ch' : '0');
239
+ add('--border-width', props['borderStyle'] === 'bold' || props['borderStyle'] === 'double' ? '3px' : '1px');
240
+ }
241
+ add('background', colorOf(props['backgroundColor']));
242
+ add('overflow', props['overflow'] === 'hidden' ? 'hidden' : undefined);
243
+ add('display', props['display'] === 'none' ? 'none' : undefined);
244
+ if (props['position'] === 'absolute') {
245
+ add('position', 'absolute');
246
+ add('top', sizeOf(props['top'], 'down'));
247
+ add('bottom', sizeOf(props['bottom'], 'down'));
248
+ add('left', sizeOf(props['left'], 'across'));
249
+ add('right', sizeOf(props['right'], 'across'));
250
+ }
251
+ return css(style);
252
+ }
253
+ function textClasses(props) {
254
+ const wrap = props['wrap'];
255
+ const isCut = typeof wrap === 'string' && wrap !== 'wrap';
256
+ const size = props['size'];
257
+ return [...(isCut ? ['cut'] : []), ...(typeof size === 'string' && ['caption', 'footnote', 'heading', 'title'].includes(size) ? [`size-${size}`] : [])];
258
+ }
259
+ function textDeclarations(props) {
260
+ const color = colorOf(props['color']);
261
+ const background = colorOf(props['backgroundColor']);
262
+ const isDim = props['dimColor'] === true;
263
+ const foreground = color === undefined && !isDim ? undefined : isDim ? dimmed(color ?? 'var(--text)') : color;
264
+ const isInverse = props['inverse'] === true;
265
+ const weight = props['weight'];
266
+ const weights = { regular: '400', medium: '500', semibold: '600', bold: '700' };
267
+ const lines = [props['underline'] === true ? 'underline' : '', props['strikethrough'] === true ? 'line-through' : ''].filter((line) => line !== '');
268
+ return [
269
+ ['color', isInverse ? (background ?? 'var(--background)') : foreground],
270
+ ['background', isInverse ? (foreground ?? 'var(--text)') : background],
271
+ ['font-weight', typeof weight === 'string' && weights[weight] !== undefined ? weights[weight] : props['bold'] === true ? '700' : undefined],
272
+ ['font-style', props['italic'] === true ? 'italic' : undefined],
273
+ ['text-decoration', lines.length === 0 ? undefined : lines.join(' ')],
274
+ ['font-variant-numeric', props['tabular'] === true ? 'tabular-nums' : undefined],
275
+ ];
276
+ }
277
+ function textStyle(props) {
278
+ return css(textDeclarations(props));
279
+ }
280
+ function labelHtml(label) {
281
+ return typeof label === 'string' ? `<span class="label">${escaped(label)}</span>` : '';
282
+ }
283
+ function codeHtml(source, startLine, isDiff, isCut) {
284
+ const lines = source.split('\n');
285
+ const width = String((startLine ?? 1) + lines.length - 1).length;
286
+ const rows = lines.map((line, index) => {
287
+ const kind = !isDiff ? '' : line.startsWith('+') ? ' added' : line.startsWith('-') ? ' removed' : line.startsWith('@@') ? ' hunk' : '';
288
+ const gutter = startLine === undefined || isDiff ? '' : `<span class="gutter">${String(startLine + index).padStart(width)} </span>`;
289
+ return `<span class="line${kind}">${gutter}${escaped(line)}</span>`;
290
+ });
291
+ return `<pre class="${isCut ? 'code cut' : 'code'}">${rows.join('\n')}</pre>`;
292
+ }
293
+ function rasterHtml(cells, columns) {
294
+ if (cells.length % 4 !== 0 || !base64.test(cells))
295
+ return '<span class="gap">The browser draws no Raster whose cells are not base64.</span>';
296
+ const bytes = Uint8Array.from(atob(cells), (character) => character.charCodeAt(0));
297
+ const words = new DataView(bytes.buffer);
298
+ const colorFrom = (word) => (word === 0x01000000 ? undefined : `#${(word & 0xffffff).toString(16).padStart(6, '0')}`);
299
+ const rows = [];
300
+ let row = '';
301
+ for (let offset = 0, index = 0; offset + 12 <= bytes.length; offset += 12, index += 1) {
302
+ const glyph = String.fromCodePoint(words.getUint32(offset, true));
303
+ const style = [colorFrom(words.getUint32(offset + 4, true)), colorFrom(words.getUint32(offset + 8, true))];
304
+ const painted = [style[0] === undefined ? '' : `color:${style[0]}`, style[1] === undefined ? '' : `background:${style[1]}`].filter((each) => each !== '').join(';');
305
+ row += painted === '' ? escaped(glyph) : `<span style="${painted}">${escaped(glyph)}</span>`;
306
+ if ((index + 1) % Math.max(Math.floor(columns), 1) === 0) {
307
+ rows.push(row);
308
+ row = '';
309
+ }
310
+ }
311
+ if (row !== '')
312
+ rows.push(row);
313
+ return `<pre class="raster">${rows.join('\n')}</pre>`;
314
+ }
315
+ function linkHtml(href, inner, markdown) {
316
+ const isPressed = markdown.link !== undefined && (markdown.pressable === undefined || markdown.pressable.includes(href));
317
+ if (isPressed)
318
+ return `<a class="link" href="${escaped(href)}" data-link="${markdown.link}">${inner}</a>`;
319
+ return linkSchemes.test(href) ? `<a class="link" href="${escaped(href)}" target="_blank" rel="noopener noreferrer">${inner}</a>` : inner;
320
+ }
321
+ function inlineHtml(node, markdown) {
322
+ const inner = () => ('children' in node ? node.children.map((child) => inlineHtml(child, markdown)).join('') : '');
323
+ switch (node.type) {
324
+ case 'text':
325
+ return escaped(node.value);
326
+ case 'emphasis':
327
+ return `<em>${inner()}</em>`;
328
+ case 'strong':
329
+ return `<strong>${inner()}</strong>`;
330
+ case 'delete':
331
+ return `<del>${inner()}</del>`;
332
+ case 'inlineCode':
333
+ return `<code>${escaped(node.value)}</code>`;
334
+ case 'break':
335
+ return '<br>';
336
+ case 'link':
337
+ return linkHtml(node.url, inner(), markdown);
338
+ case 'image':
339
+ return linkHtml(node.url, escaped(node.alt ?? node.url), markdown);
340
+ case 'html':
341
+ return escaped(node.value);
342
+ default:
343
+ return inner();
344
+ }
345
+ }
346
+ function itemHtml(item, markdown) {
347
+ const check = item.checked === true ? '☑ ' : item.checked === false ? '☐ ' : '';
348
+ return `<li>${check}${item.children.map((child) => blockHtml(child, markdown)).join('')}</li>`;
349
+ }
350
+ function cellHtml(cell, tag, align, markdown) {
351
+ return `<${tag}${align === null || align === undefined ? '' : ` style="text-align:${align}"`}>${cell.children.map((child) => inlineHtml(child, markdown)).join('')}</${tag}>`;
352
+ }
353
+ function blockHtml(node, markdown) {
354
+ switch (node.type) {
355
+ case 'heading':
356
+ return `<h${node.depth}>${node.children.map((child) => inlineHtml(child, markdown)).join('')}</h${node.depth}>`;
357
+ case 'paragraph':
358
+ return `<p>${node.children.map((child) => inlineHtml(child, markdown)).join('')}</p>`;
359
+ case 'code':
360
+ return codeHtml(node.value, undefined, node.lang === 'diff', false);
361
+ case 'blockquote':
362
+ return `<blockquote>${node.children.map((child) => blockHtml(child, markdown)).join('')}</blockquote>`;
363
+ case 'list': {
364
+ const items = node.children.map((item) => itemHtml(item, markdown)).join('');
365
+ return node.ordered === true ? `<ol${node.start === null || node.start === undefined || node.start === 1 ? '' : ` start="${node.start}"`}>${items}</ol>` : `<ul>${items}</ul>`;
366
+ }
367
+ case 'table': {
368
+ const [head, ...body] = node.children;
369
+ const row = (cells, tag) => `<tr>${cells.map((cell, index) => cellHtml(cell, tag, node.align?.[index], markdown)).join('')}</tr>`;
370
+ return `<table>${head === undefined ? '' : `<thead>${row(head.children, 'th')}</thead>`}<tbody>${body.map((each) => row(each.children, 'td')).join('')}</tbody></table>`;
371
+ }
372
+ case 'thematicBreak':
373
+ return '<hr>';
374
+ case 'html':
375
+ return `<p>${escaped(node.value)}</p>`;
376
+ case 'listItem':
377
+ return itemHtml(node, markdown);
378
+ default:
379
+ return 'children' in node ? node.children.map((child) => blockHtml(child, markdown)).join('') : 'value' in node ? `<p>${escaped(String(node.value))}</p>` : '';
380
+ }
381
+ }