@cmodjs/core 4.3.3 → 4.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/commands.md CHANGED
@@ -62,7 +62,7 @@ Runs every check this machine can run on the mod at `path` (default: the current
62
62
  5. Prints the permissions the person grants at install and can grant later, as the person reads them ([permissions.md](permissions.md)). It adds `"approve": true` when the mod allows or asks on the permission check and `hooks/register.ts` calls `registerPermissionCheck`. It fails a mod whose `src/` hears permissions while `register.ts` does not call `registerPermissionCheck`.
63
63
  6. Reads the metadata of every file in the mod, and names each file whose metadata cmod cannot read.
64
64
  7. Writes the options `defineMod` declares into `.claude-plugin/plugin.json` `userConfig`, and its hotkeys into `package.json` `"cmod"` `hotkeys`, keeping each file's own formatting, so Claude Code shows the options in `/config` ([options.md](options.md)). It loads `hooks/register.ts` to read them, without starting the mod.
65
- 8. Writes the `cmod` dependency in `.claude-plugin/plugin.json` as `>=` the version of the `@cmodjs/core` the mod installed, such as `>=4.0.0`, so every newer cmod runs the mod. A mod still on `@cmodjs/core` 3 keeps its own range ([dependencies.md](dependencies.md#call-the-methods-mod-dependencies)).
65
+ 8. Writes the `cmod` dependency in `.claude-plugin/plugin.json` as `>=` the version of the `@cmodjs/core` the mod installed, such as `>=4.0.0`, so every newer cmod runs the mod. A mod still on `@cmodjs/core` 3 keeps its own range ([dependencies.md](dependencies.md#call-the-methods-mod-dependencies)). Claude Code turns a mod off when its cmod is older than that dependency, so `cmod check` first compares it with every cmod plugin Claude Code installed on this machine. When an installed copy is older, it updates them as `cmod update cmod` does. When one is still older, as when your `@cmodjs/core` is newer than every published cmod, the check fails, keeps the old dependency, and names the `@cmodjs/core` to install instead. When a cmod linked from a checkout is older, the check fails the same way and says to pull that checkout, because no update reaches it. On a machine without Claude Code or without a cmod plugin, such as CI, it writes the dependency at once.
66
66
  9. Checks its imports.
67
67
  10. Looks for prebuilt binaries outside `cli/`.
68
68
  11. Builds the release in a temporary folder as `cmod publish` builds it, with its `"files"` list and its bundled hooks module, and validates the release with Claude Code, `claude plugin validate --strict`. So it fails on a path `plugin.json` names that `"files"` leaves out, a `"files"` path that matches no file in the mod, and each reason a bundle fails, and prints every line the validator writes. Then it deletes the folder.
@@ -72,7 +72,7 @@ Runs every check this machine can run on the mod at `path` (default: the current
72
72
  15. Runs, with `claude plugin test`, the test files that import `claude-code/testing`. It skips this when none does.
73
73
  16. Checks its name against other plugins. Only a project plugin, in `.claude/skills/<name>/` of a repository, runs this check: it fails when an installed or linked plugin has the same name and hides the project plugin. Any other mod passes it at once.
74
74
 
75
- `cmod check` fetches `tsc` 7.0.2 and `oxlint` 1.86.0 into the cmod store the first time. It ends with a count of passed, failed, and skipped checks, and exits 1 when one failed.
75
+ `cmod check` fetches `tsc` 7.0.2 and `oxlint` 1.86.0 into the cmod store the first time. A check it cannot run, such as one that needs Claude Code on a machine without it, fails with the reason, and the later checks still run. It ends with a count of passed, failed, and skipped checks, and exits 1 when one failed.
76
76
 
77
77
  ### cmod try
78
78
 
package/docs/ui.md CHANGED
@@ -382,7 +382,7 @@ Each kind of markdown block of a reply is a kind of its own. `ui/markdown.js` ex
382
382
  - `ThematicBreak`: a `---` line.
383
383
  - `HtmlBlock`: an HTML block, with `value`.
384
384
 
385
- Every block's props hold `text`, its plain text, one line per list item, table row, or quoted line, and `source`, its markdown. `Default` draws the block as Claude Code would, and `<Default source="…" />` draws other markdown in its place. A style may call `Default` once per part, such as once per list item, quoted line, or table cell. In a pane, where the mod draws a `Markdown` element with a `key` through its own styles, the first `Default` takes that key and each later one takes it with `:1`, `:2`, and so on, because Claude Code refuses two `Markdown` elements with one key. While a reply streams in, Claude Code draws a block that is not finished yet, and the mod draws it once it is.
385
+ Every block's props hold `text`, its plain text, one line per list item, table row, or quoted line, and `source`, its markdown. `Default` draws the block as Claude Code would, and `<Default source="…" />` draws other markdown in its place. A style may call `Default` once per part, such as once per list item, quoted line, or table cell. Each part, and each `Markdown` a style draws itself, keeps the `dimColor`, `onLinkPress`, and `pressableLinks` of the `Markdown` element that holds the block unless it sets them itself, so a dim element stays dim and its links still run its `onLinkPress`, in a pane, a page, or a widget, whichever mod's style draws it. When that element has a `key`, the first of them without a key of its own takes that key and each later one takes it with `:1`, `:2`, and so on, because Claude Code refuses two `Markdown` elements with one key and needs a key on each one with `onLinkPress`. While a reply streams in, Claude Code draws a block that is not finished yet, and the mod draws it once it is.
386
386
 
387
387
  A markdown style draws wherever markdown shows: in Claude's replies and in every `Markdown` element any mod or cmod draws, in panes, pages, widgets, the Dashboard, Settings, and changelogs. A `Markdown` element goes through the styles of the mod that draws it first, then through each other mod's, in the order the mods added their first markdown style. A mod that removes its last markdown style and adds one again moves to the end. Another mod's style shows as soon as that mod has drawn the block, and Claude Code's drawing shows until then. When that mod does not answer, Claude Code's drawing stays, and cmod reports `The markdown style of <mod> drew nothing` to the Log, with the reason.
388
388
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmodjs/core",
3
- "version": "4.3.3",
3
+ "version": "4.3.4",
4
4
  "description": "Build Claude Code mods: hooks, panes, permissions, checks, and an install that just works.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/records.d.ts CHANGED
@@ -103,7 +103,7 @@ export type Preferences = {
103
103
  };
104
104
  export declare function parsePreferences(value: unknown, path: string): Preferences;
105
105
  export declare function parseConsent(value: unknown, path: string): Record<string, string[]>;
106
- export declare const coreVersion = "4.3.3";
106
+ export declare const coreVersion = "4.3.4";
107
107
  export declare function hotkeyCommand(mod: string, hotkey: string): string;
108
108
  export declare function hotkeyBindings(mod: string, hotkeys: Hotkeys | undefined): Record<string, string>;
109
109
  export declare function boundCombos(keybindings: unknown): Map<string, string>;
package/records.js CHANGED
@@ -294,7 +294,7 @@ function readHotkeys(hotkeys) {
294
294
  throw new Error(`package.json "cmod.hotkeys" is not a map of hotkeys to their title and optional default combo. ${fix}`);
295
295
  return { hotkeys: checkHotkeys('package.json "cmod"', hotkeys) };
296
296
  }
297
- export const coreVersion = '4.3.3';
297
+ export const coreVersion = '4.3.4';
298
298
  export function hotkeyCommand(mod, hotkey) {
299
299
  return `${mod}--${hotkey}`;
300
300
  }
package/runtime/ui.d.ts CHANGED
@@ -88,6 +88,7 @@ export type ShownPages = {
88
88
  readonly shown: string | null;
89
89
  readonly isFocused: boolean;
90
90
  };
91
+ export declare function inheriting(props: MarkdownProps, draw: (drawn: MarkdownProps) => RenderElement, laterKey?: () => string | undefined): (left: MarkdownProps) => RenderElement;
91
92
  export declare function merged(updates: readonly PartsUpdate[]): PartsUpdate;
92
93
  export type UiOptions<State extends object> = {
93
94
  readonly name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/runtime/ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAgB,aAAa,EAAE,MAAM,aAAa,CAAA;AACzG,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAE1C,OAAO,EAAW,KAAK,IAAI,EAAmC,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAGrG,OAAO,EAAwG,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC5K,OAAO,EAA8C,KAAK,QAAQ,EAAkB,MAAM,iBAAiB,CAAA;AAG3G,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C,eAAO,MAAM,WAAW;aACtB,IAAI,EAAE,YAAY;aAClB,IAAI,EAAE,WAAW;aACjB,KAAK,EAAE,YAAY;aACnB,KAAK,EAAE,YAAY;aACnB,OAAO,EAAE,mBAAmB;aAC5B,OAAO,EAAE,sBAAsB;CACvB,CAAA;AAEV,eAAO,MAA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AS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAgjBnJ"}
package/runtime/ui.js CHANGED
@@ -42,6 +42,27 @@ function pieceProps(props, given, isFirst) {
42
42
  const merged = { ...props, ...given };
43
43
  return isFirst || !('isFirstOfReply' in merged) ? merged : { ...merged, isFirstOfReply: false };
44
44
  }
45
+ function laterKeys(key) {
46
+ let used = 0;
47
+ return () => (key === undefined ? undefined : `${key}:${(used += 1)}`);
48
+ }
49
+ export function inheriting(props, draw, laterKey = laterKeys(props.key)) {
50
+ const { dimColor, onLinkPress, pressableLinks } = props;
51
+ const inherited = { ...(dimColor === undefined ? {} : { dimColor }), ...(onLinkPress === undefined ? {} : { onLinkPress }), ...(pressableLinks === undefined ? {} : { pressableLinks }) };
52
+ let isKeyTaken = false;
53
+ const keyOf = (left) => {
54
+ if (left.key !== undefined)
55
+ return left.key;
56
+ if (isKeyTaken)
57
+ return laterKey();
58
+ isKeyTaken = true;
59
+ return props.key;
60
+ };
61
+ return (left) => {
62
+ const key = keyOf(left);
63
+ return draw({ ...inherited, ...(key === undefined ? {} : { key }), ...left });
64
+ };
65
+ }
45
66
  function threw(error) {
46
67
  return `threw, so Claude Code draws its own: ${messageOf(error)}`;
47
68
  }
@@ -242,18 +263,18 @@ export function createUi({ name, claude, router, report, announce, mod, borrowed
242
263
  const renderOf = (type) => markdownRenders.get(type);
243
264
  const drawnBlock = (piece, at, drawClaudes, keyPrefix, table) => {
244
265
  if ('text' in piece)
245
- return drawClaudes(piece.text);
266
+ return drawClaudes({ text: piece.text });
246
267
  const { render, props: block } = piece;
247
- const draw = () => drawKeyed(keyPrefix, () => render.Component({ ...block, ...at, Default: ({ source = block.source }) => drawClaudes(source) }));
268
+ const draw = () => drawKeyed(keyPrefix, () => render.Component({ ...block, ...at, Default: ({ source = block.source }) => drawClaudes({ text: source }) }));
248
269
  try {
249
- return table === undefined ? draw() : drawWith(table, draw);
270
+ return table === undefined ? draw() : drawWith(table, draw, drawClaudes);
250
271
  }
251
272
  catch (error) {
252
273
  render.log(threw(error));
253
- return drawClaudes(block.source);
274
+ return drawClaudes({ text: block.source });
254
275
  }
255
276
  };
256
- const othersFrom = (table, at, from, unkeyedScope) => (props) => {
277
+ const othersFrom = (table, at, from, unkeyedScope) => (props, laterKey = laterKeys(props.key)) => {
257
278
  if (from >= stylers.length)
258
279
  return table.Markdown(props);
259
280
  const scope = props.key ?? unkeyedScope();
@@ -261,7 +282,8 @@ export function createUi({ name, claude, router, report, announce, mod, borrowed
261
282
  if (index < from)
262
283
  continue;
263
284
  const cached = `${stylersSeen}\u0000${at.surface}\u0000${at.columns}\u0000${props.text}`;
264
- const drawn = drawWith(table, () => borrowed(styler, cached, { markdown: props.text, ...at }, scope), othersFrom(table, at, index + 1, unkeyedScope));
285
+ const next = othersFrom(table, at, index + 1, unkeyedScope);
286
+ const drawn = drawWith(table, () => borrowed(styler, cached, { markdown: props.text, ...at }, scope), inheriting(props, (part) => next(part, laterKey), laterKey));
265
287
  if (drawn !== undefined)
266
288
  return drawn;
267
289
  }
@@ -279,11 +301,8 @@ export function createUi({ name, claude, router, report, announce, mod, borrowed
279
301
  if (pieces.every((piece) => 'text' in piece))
280
302
  return others(props);
281
303
  const scope = props.key ?? unkeyedScope();
282
- let drawn = 0;
283
- const drawClaudes = (text) => {
284
- const index = drawn++;
285
- return others(index === 0 || props.key === undefined ? { ...props, text } : { ...props, text, key: `${props.key}:${index}` });
286
- };
304
+ const laterKey = laterKeys(props.key);
305
+ const drawClaudes = inheriting(props, (part) => others(part, laterKey), laterKey);
287
306
  const drawings = pieces.map((piece, index) => drawnBlock(piece, at, drawClaudes, `${scope}:${index}:`, table));
288
307
  return drawPieces(drawings.map((drawing) => ({ drawing, isClaudesRow: false })), 'pane');
289
308
  };
@@ -292,7 +311,7 @@ export function createUi({ name, claude, router, report, announce, mod, borrowed
292
311
  const pieces = read === undefined ? [] : read(text, renderOf);
293
312
  if (pieces.every((piece) => 'text' in piece))
294
313
  return Markdown({ text });
295
- return drawPieces(pieces.map((piece, index) => ({ drawing: drawnBlock(piece, at, (source) => Markdown({ text: source }), `${index}:`), isClaudesRow: false })), 'pane');
314
+ return drawPieces(pieces.map((piece, index) => ({ drawing: drawnBlock(piece, at, Markdown, `${index}:`), isClaudesRow: false })), 'pane');
296
315
  };
297
316
  const routeMarkdown = (createReader) => {
298
317
  if (read !== undefined)
package/src/records.ts CHANGED
@@ -339,7 +339,7 @@ function readHotkeys(hotkeys: unknown): Steps {
339
339
  return { hotkeys: checkHotkeys('package.json "cmod"', hotkeys as Record<string, HotkeyInit>) }
340
340
  }
341
341
 
342
- export const coreVersion = '4.3.3'
342
+ export const coreVersion = '4.3.4'
343
343
 
344
344
  export function hotkeyCommand(mod: string, hotkey: string): string {
345
345
  return `${mod}--${hotkey}`
package/src/runtime/ui.ts CHANGED
@@ -91,6 +91,27 @@ function pieceProps(props: object, given: object, isFirst: boolean): object {
91
91
  return isFirst || !('isFirstOfReply' in merged) ? merged : { ...merged, isFirstOfReply: false }
92
92
  }
93
93
 
94
+ function laterKeys(key: string | undefined): () => string | undefined {
95
+ let used = 0
96
+ return () => (key === undefined ? undefined : `${key}:${(used += 1)}`)
97
+ }
98
+
99
+ export function inheriting(props: MarkdownProps, draw: (drawn: MarkdownProps) => RenderElement, laterKey = laterKeys(props.key)): (left: MarkdownProps) => RenderElement {
100
+ const { dimColor, onLinkPress, pressableLinks } = props
101
+ const inherited = { ...(dimColor === undefined ? {} : { dimColor }), ...(onLinkPress === undefined ? {} : { onLinkPress }), ...(pressableLinks === undefined ? {} : { pressableLinks }) }
102
+ let isKeyTaken = false
103
+ const keyOf = (left: MarkdownProps) => {
104
+ if (left.key !== undefined) return left.key
105
+ if (isKeyTaken) return laterKey()
106
+ isKeyTaken = true
107
+ return props.key
108
+ }
109
+ return (left) => {
110
+ const key = keyOf(left)
111
+ return draw({ ...inherited, ...(key === undefined ? {} : { key }), ...left })
112
+ }
113
+ }
114
+
94
115
  function threw(error: unknown): string {
95
116
  return `threw, so Claude Code draws its own: ${messageOf(error)}`
96
117
  }
@@ -324,27 +345,28 @@ export function createUi<State extends object>({ name, claude, router, report, a
324
345
 
325
346
  const renderOf = (type: string) => markdownRenders.get(type)
326
347
 
327
- const drawnBlock = (piece: MarkdownPiece<MarkdownRender>, at: StyledAt, drawClaudes: (text: string) => RenderElement, keyPrefix: string, table?: ElementTable): RenderElement => {
328
- if ('text' in piece) return drawClaudes(piece.text)
348
+ const drawnBlock = (piece: MarkdownPiece<MarkdownRender>, at: StyledAt, drawClaudes: (part: MarkdownProps) => RenderElement, keyPrefix: string, table?: ElementTable): RenderElement => {
349
+ if ('text' in piece) return drawClaudes({ text: piece.text })
329
350
  const { render, props: block } = piece
330
- const draw = () => drawKeyed(keyPrefix, () => render.Component({ ...block, ...at, Default: ({ source = block.source }: { readonly source?: string }) => drawClaudes(source) }))
351
+ const draw = () => drawKeyed(keyPrefix, () => render.Component({ ...block, ...at, Default: ({ source = block.source }: { readonly source?: string }) => drawClaudes({ text: source }) }))
331
352
  try {
332
- return table === undefined ? draw() : drawWith(table, draw)
353
+ return table === undefined ? draw() : drawWith(table, draw, drawClaudes)
333
354
  } catch (error) {
334
355
  render.log(threw(error))
335
- return drawClaudes(block.source)
356
+ return drawClaudes({ text: block.source })
336
357
  }
337
358
  }
338
359
 
339
360
  const othersFrom =
340
361
  (table: ElementTable, at: StyledAt, from: number, unkeyedScope: () => string) =>
341
- (props: MarkdownProps): RenderElement => {
362
+ (props: MarkdownProps, laterKey = laterKeys(props.key)): RenderElement => {
342
363
  if (from >= stylers.length) return table.Markdown(props)
343
364
  const scope = props.key ?? unkeyedScope()
344
365
  for (const [index, styler] of stylers.entries()) {
345
366
  if (index < from) continue
346
367
  const cached = `${stylersSeen}\u0000${at.surface}\u0000${at.columns}\u0000${props.text}`
347
- const drawn = drawWith(table, () => borrowed(styler, cached, { markdown: props.text, ...at }, scope), othersFrom(table, at, index + 1, unkeyedScope))
368
+ const next = othersFrom(table, at, index + 1, unkeyedScope)
369
+ const drawn = drawWith(table, () => borrowed(styler, cached, { markdown: props.text, ...at }, scope), inheriting(props, (part) => next(part, laterKey), laterKey))
348
370
  if (drawn !== undefined) return drawn
349
371
  }
350
372
  return table.Markdown(props)
@@ -360,11 +382,8 @@ export function createUi<State extends object>({ name, claude, router, report, a
360
382
  const pieces = reader(props.text, renderOf)
361
383
  if (pieces.every((piece) => 'text' in piece)) return others(props)
362
384
  const scope = props.key ?? unkeyedScope()
363
- let drawn = 0
364
- const drawClaudes = (text: string) => {
365
- const index = drawn++
366
- return others(index === 0 || props.key === undefined ? { ...props, text } : { ...props, text, key: `${props.key}:${index}` })
367
- }
385
+ const laterKey = laterKeys(props.key)
386
+ const drawClaudes = inheriting(props, (part) => others(part, laterKey), laterKey)
368
387
  const drawings = pieces.map((piece, index) => drawnBlock(piece, at, drawClaudes, `${scope}:${index}:`, table))
369
388
  return drawPieces(drawings.map((drawing) => ({ drawing, isClaudesRow: false })), 'pane')
370
389
  }
@@ -373,7 +392,7 @@ export function createUi<State extends object>({ name, claude, router, report, a
373
392
  const markdownDrawing = (text: string, at: StyledAt): RenderElement => {
374
393
  const pieces = read === undefined ? [] : read(text, renderOf)
375
394
  if (pieces.every((piece) => 'text' in piece)) return Markdown({ text })
376
- return drawPieces(pieces.map((piece, index) => ({ drawing: drawnBlock(piece, at, (source) => Markdown({ text: source }), `${index}:`), isClaudesRow: false })), 'pane')
395
+ return drawPieces(pieces.map((piece, index) => ({ drawing: drawnBlock(piece, at, Markdown, `${index}:`), isClaudesRow: false })), 'pane')
377
396
  }
378
397
 
379
398
  const routeMarkdown = (createReader: () => MarkdownReader) => {
package/src/testing.ts CHANGED
@@ -56,7 +56,7 @@ import { drawnParts } from './runtime/parts.js'
56
56
  import { serveWidgets, type Widgets } from './runtime/widgets.js'
57
57
  import { engineOf } from './runtime/engine.js'
58
58
  import { pagesOf, servePages } from './runtime/pages.js'
59
- import { partMethods, type DrawnPart, type PageRequest, type PartPress, type PartsUpdate } from './runtime/ui.js'
59
+ import { inheriting, partMethods, type DrawnPart, type PageRequest, type PartPress, type PartsUpdate } from './runtime/ui.js'
60
60
 
61
61
  export type { Fakes, TestCall } from './testing/fake-claude.js'
62
62
  export type { FakeSession, MessageDraft, StartedTask } from './testing/fake-sessions.js'
@@ -236,7 +236,7 @@ export function testMod<State extends object, Declared extends Options = Options
236
236
  if (drawn === undefined) missedMarkdown.set(drawnAt, { markdown: props.text, ...at })
237
237
  if (drawn === undefined || drawn === null || drawn.tree === null) return table.Markdown(props)
238
238
  const { draw, tree } = drawn
239
- return drawWith(table, () => elementOf(tree, keyPrefix, (handler, args) => void pressPart({ draw, handler, args }))) as RenderElement
239
+ return drawWith(table, () => elementOf(tree, keyPrefix, (handler, args) => void pressPart({ draw, handler, args })), inheriting(props, table.Markdown)) as RenderElement
240
240
  }
241
241
  }
242
242
  const withOwnMarkdown = async <Drawn>(draw: () => Promise<Drawn>): Promise<Drawn> => {
package/testing.js CHANGED
@@ -28,7 +28,7 @@ import { drawnParts } from './runtime/parts.js';
28
28
  import { serveWidgets } from './runtime/widgets.js';
29
29
  import { engineOf } from './runtime/engine.js';
30
30
  import { pagesOf, servePages } from './runtime/pages.js';
31
- import { partMethods } from './runtime/ui.js';
31
+ import { inheriting, partMethods } from './runtime/ui.js';
32
32
  const defaultColumns = 80;
33
33
  const defaultRows = 24;
34
34
  const presentation = { isFullscreen: false, columns: defaultColumns };
@@ -136,7 +136,7 @@ export function testMod(definition, options = {}) {
136
136
  if (drawn === undefined || drawn === null || drawn.tree === null)
137
137
  return table.Markdown(props);
138
138
  const { draw, tree } = drawn;
139
- return drawWith(table, () => elementOf(tree, keyPrefix, (handler, args) => void pressPart({ draw, handler, args })));
139
+ return drawWith(table, () => elementOf(tree, keyPrefix, (handler, args) => void pressPart({ draw, handler, args })), inheriting(props, table.Markdown));
140
140
  };
141
141
  };
142
142
  const withOwnMarkdown = async (draw) => {