morphic-blocks 0.3.0 → 0.4.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.
@@ -5,8 +5,24 @@ export type MorphicModeName = string;
5
5
  * - "text" — rendered as an HTML label; never shown in the workspace
6
6
  * - "code" — template with %N placeholders; rendered as a Blockly block in the workspace or as text in the codespace
7
7
  * - "image" — rendered as an <img> in the toolbox tile; never shown in the workspace
8
+ * - "custom" — drawn on the toolbox tile by the app's renderer (`toolbox.custom`); never shown in the workspace
8
9
  */
9
- export type MorphicElementType = "text" | "code" | "image";
10
+ export type MorphicElementType = "text" | "code" | "image" | "custom";
11
+ /** What a renderer of a `custom` element is drawing. */
12
+ export interface MorphicElementRenderContext {
13
+ /** The block's identifier. */
14
+ block: string;
15
+ /** The element's name. */
16
+ element: string;
17
+ /** The toolbox mode. */
18
+ mode: string;
19
+ }
20
+ /**
21
+ * Draws a `custom` element on a toolbox tile from the block's content for it:
22
+ * a button, a player, anything. A string is shown as text. Called again on
23
+ * every redraw of the toolbox.
24
+ */
25
+ export type MorphicElementRenderer = (content: string, context: MorphicElementRenderContext) => Node | string;
10
26
  /**
11
27
  * Configuration for a value slot's empty-state default. Keyed by slot
12
28
  * `check` in `code[element].empty[check]`, or set per-slot via
@@ -90,6 +106,13 @@ export interface MorphicCodeElementConfig {
90
106
  * leave empty bodies empty.
91
107
  */
92
108
  emptyStatement?: string;
109
+ /**
110
+ * Names written for `%1:type`, keyed by the value's type (its block's
111
+ * `output` check, or the slot's `check` while empty), e.g. Java:
112
+ * `{ "Number": "int", "String": "String", "Boolean": "boolean", "default": "var" }`.
113
+ * `default` is used when no key fits; without it nothing is written.
114
+ */
115
+ types?: Record<string, string>;
93
116
  /** Token highlighting for the codespace and preview showing this element. */
94
117
  highlighting?: MorphicHighlightDefinition;
95
118
  /**
@@ -153,12 +176,32 @@ export type MorphicInputAlign = "left" | "centre" | "right";
153
176
  * - `"=="` → value = label = `"=="`
154
177
  * - `["-", "−"]` → value `"-"`, shown as `"−"` on the block
155
178
  * - `{ value, label?, display? }` → explicit object form
179
+ *
180
+ * `label` can also be an image ({@link MorphicDropdownImage}): the block shows
181
+ * the picture, text views still write the value.
156
182
  */
157
183
  export type MorphicDropdownOption = string | [value: string, label: string] | {
158
184
  value: string;
159
- label?: string;
185
+ label?: string | MorphicDropdownImage;
160
186
  display?: Record<string, string>;
161
187
  };
188
+ /**
189
+ * A picture shown as a dropdown choice on the block: an image file (`src`) or
190
+ * a swatch the framework draws in a CSS color (`color`, e.g. `"#e53935"`).
191
+ * `alt` (what screen readers say) defaults to the option's value; the size
192
+ * defaults to 16 × 16.
193
+ */
194
+ export type MorphicDropdownImage = ({
195
+ src: string;
196
+ color?: never;
197
+ } | {
198
+ color: string;
199
+ src?: never;
200
+ }) & {
201
+ alt?: string;
202
+ width?: number;
203
+ height?: number;
204
+ };
162
205
  /**
163
206
  * A field declared directly on a block (rendered at the `%FIELDNAME` token
164
207
  * position). Lets dropdown / text / number / checkbox fields live in the
@@ -210,29 +253,39 @@ export type MorphicBlockElements = Record<string, string>;
210
253
  * is part of the preset: `toolbox` is required, and at least one editing
211
254
  * space (`workspace` or `codespace`) must be set; `preview` is optional.
212
255
  */
213
- /**
214
- * A preset's toolbox: either a bare mode name (all code elements render as
215
- * blocks) or an object that additionally overrides, per element, whether a
216
- * `code` element renders as a draggable block or as source text in the tile.
217
- */
218
- export type MorphicPresetToolbox = MorphicModeName | {
219
- mode: MorphicModeName;
220
- render?: Record<string, "block" | "text">;
221
- };
256
+ /** How a mode's code element is drawn on a tile: as a block, or as its text. */
257
+ export type MorphicTileRender = "block-based" | "text-based";
222
258
  export interface MorphicPresetDefinition {
223
259
  name: string;
224
260
  /** Display label (e.g. for buttons). Falls back to `name`. */
225
261
  label?: string;
226
- toolbox: MorphicPresetToolbox;
227
- workspace?: MorphicModeName;
228
- codespace?: MorphicModeName;
229
- preview?: MorphicModeName;
262
+ /** The mode of the toolbox tiles; the mode's `render` says how they are drawn. */
263
+ toolbox: MorphicModeName;
264
+ /**
265
+ * The code element each view shows, by view name, e.g. `{ "blocks": "concept", "code": "python" }`.
266
+ * The views it lists are the ones the preset shows; showing and hiding
267
+ * their containers is the app's job (`onPresetApplied`). Views it leaves
268
+ * out keep what they show.
269
+ */
270
+ views: Record<string, string>;
271
+ }
272
+ /** Kinds of view: blocks, or the program as text. */
273
+ export type MorphicViewKind = "workspace" | "codespace";
274
+ /** A view in the definitions' `views`, by name. A bare kind is the short form. */
275
+ export interface MorphicViewDeclaration {
276
+ kind: MorphicViewKind;
230
277
  /**
231
- * Modes of views added with `addView()`, by view name. Applying the preset
232
- * switches each listed view that exists; the app shows or hides views, as
233
- * for the built-in ones.
278
+ * Whether the program can be changed in the view. Default `true`. A
279
+ * codespace that cannot be edited shows the program as text, read only.
234
280
  */
235
- views?: Record<string, MorphicModeName>;
281
+ editable?: boolean;
282
+ /**
283
+ * Right to left (`true`) or left to right (`false`). Left out, a workspace
284
+ * follows `blockly.rtl` and a codespace the page around it.
285
+ */
286
+ rtl?: boolean;
287
+ /** How blocks are deleted in a codespace. */
288
+ delete?: MorphicCodespaceDeleteOptions;
236
289
  }
237
290
  /**
238
291
  * Declares which elements are visible for a given mode.
@@ -244,6 +297,11 @@ export interface MorphicModeDefinition {
244
297
  name: string;
245
298
  /** Element names that are visible in this mode (e.g. ["icon", "text"]). */
246
299
  elements: string[];
300
+ /**
301
+ * How the mode's code elements are drawn on toolbox tiles, by element name:
302
+ * `"block-based"` (the default) or `"text-based"`, e.g. `{ "python": "text-based" }`.
303
+ */
304
+ render?: Record<string, MorphicTileRender>;
247
305
  }
248
306
  export interface MorphicBlockDefinition {
249
307
  identifier: string;
@@ -344,6 +402,13 @@ export interface MorphicBlocksFormat {
344
402
  elementTypes?: Record<string, MorphicElementTypeEntry>;
345
403
  /** Explicit mode definitions — which elements are visible per mode. */
346
404
  modes?: MorphicModeDefinition[];
405
+ /**
406
+ * The views, by name: `{ "blocks": "workspace", "read": { "kind": "codespace", "editable": false } }`.
407
+ * `mount()` sets up each one it gets a container for. The first workspace
408
+ * with a container holds the program. Default: a `workspace` and a
409
+ * `codespace` view.
410
+ */
411
+ views?: Record<string, MorphicViewKind | MorphicViewDeclaration>;
347
412
  /** Named per-view mode configurations. Used as the mount default for `presets`. */
348
413
  presets?: MorphicPresetDefinition[];
349
414
  /**
@@ -377,14 +442,18 @@ export interface MorphicRunResult {
377
442
  export interface MorphicBehaviorContext {
378
443
  Blockly: typeof Blockly;
379
444
  workspace: Blockly.WorkspaceSvg;
380
- mode: MorphicModeName;
445
+ /** The code element the block is drawn from. */
446
+ element: string;
447
+ /** The toolbox mode, for blocks drawn in the toolbox. */
448
+ mode?: MorphicModeName;
381
449
  context: MorphicRenderContext;
382
450
  definition: MorphicBlockDefinition;
383
451
  }
384
452
  export interface MorphicBehaviorProxy {
385
453
  blockId: string;
386
454
  blockType: string;
387
- mode: MorphicModeName;
455
+ /** The code element the block is drawn from in its view. */
456
+ element: string;
388
457
  context: MorphicRenderContext;
389
458
  inputs: Record<string, string>;
390
459
  /**
@@ -419,7 +488,51 @@ export interface MorphicToolboxCategory {
419
488
  blocks?: string[];
420
489
  }
421
490
  export type MorphicToolboxLayout = "flyout" | "category";
422
- export interface MorphicToolboxConfig {
491
+ /** How the HTML toolbox shows categories and scrolls; part of both toolbox option sets. */
492
+ export interface MorphicToolboxDisplayOptions {
493
+ /**
494
+ * `"stacked"` (default): every category under its heading. `"tabs"`: a list
495
+ * of the category names and the tiles of the chosen one, the first at the
496
+ * start; `collapsed` does not apply. The container gets
497
+ * `morphic-toolbox-stacked` or `morphic-toolbox-tabs`; where the list sits
498
+ * is the app's CSS. Without categories, tiles are a flat list either way.
499
+ */
500
+ layout?: "stacked" | "tabs";
501
+ /** A heading with the category's name above its tiles. Default `true`. */
502
+ categoryHeadings?: boolean;
503
+ /** A click on a heading collapses or expands its category. Default `true`. */
504
+ collapsible?: boolean;
505
+ /**
506
+ * Categories collapsed at the start: `true` for all, or their names.
507
+ * Default: all open. The toolbox keeps the state across redraws.
508
+ */
509
+ collapsed?: boolean | string[];
510
+ /** Called when a category is collapsed or expanded, e.g. to remember it. */
511
+ onCategoryToggle?: (name: string, collapsed: boolean) => void;
512
+ /**
513
+ * Show the container's scrollbar. Default `false`: hidden, and the edges
514
+ * fade where more tiles wait. Either way the container gets the classes
515
+ * `morphic-toolbox`, `morphic-toolbox-more-above` and
516
+ * `morphic-toolbox-more-below` (while tiles are hidden there) for the
517
+ * app's own styles; the defaults have no weight (`:where()`), so any app
518
+ * rule wins. Works when the container is the element that scrolls.
519
+ */
520
+ scrollbar?: boolean;
521
+ /**
522
+ * How each `custom` element is drawn on the tiles, by element name.
523
+ * Pressing a button, link or input inside one does not drag the tile, and
524
+ * Enter or Space there does not add the block.
525
+ */
526
+ custom?: Record<string, MorphicElementRenderer>;
527
+ /**
528
+ * The element whose text names each tile for screen readers (its
529
+ * `aria-label`), e.g. a `spoken` text element no mode lists; a function
530
+ * gets the toolbox mode and returns the element's name. A block without
531
+ * that element is named by what its tile shows, as without this option.
532
+ */
533
+ label?: string | ((mode: string) => string);
534
+ }
535
+ export interface MorphicToolboxConfig extends MorphicToolboxDisplayOptions {
423
536
  kind?: "flyoutToolbox" | "categoryToolbox";
424
537
  /** Show only these blocks, in the HTML toolbox and in Blockly's own. */
425
538
  blocks?: string[];
@@ -440,7 +553,7 @@ export interface MorphicToolboxConfig {
440
553
  */
441
554
  export type MorphicToolboxModeLabel = boolean | string | ((mode: string) => string);
442
555
  /** Options for the custom HTML toolbox canvas (mountToolbox). */
443
- export interface MorphicToolboxCanvasOptions {
556
+ export interface MorphicToolboxCanvasOptions extends MorphicToolboxDisplayOptions {
444
557
  /** Header of the toolbox; see {@link MorphicToolboxModeLabel}. Defaults to "Mode: <name>". */
445
558
  modeLabel?: MorphicToolboxModeLabel;
446
559
  /**
@@ -479,35 +592,34 @@ export interface MorphicJavaScriptConfig {
479
592
  }
480
593
  export interface MorphicMountConfig {
481
594
  /**
482
- * Container for the Blockly workspace. Optional — may be omitted when only a
483
- * codespace is used. At least one of `workspaceContainer` or `codespaceContainer`
484
- * must be provided. When omitted, Blockly runs headless (offscreen) so the block
485
- * model stays available.
595
+ * The views' containers, by view name. A view without one is not set up,
596
+ * so the same definitions serve a full page and a small embed. At least one
597
+ * view needs a container. Without a workspace, Blockly runs headless
598
+ * (offscreen) so the block model stays available.
486
599
  */
600
+ containers?: Record<string, HTMLElement>;
601
+ /** Short for `containers.workspace`. */
487
602
  workspaceContainer?: HTMLElement;
488
- /**
489
- * Container for the primary text editor (codespace). Optional, but required
490
- * when a preset shows the codespace. `mount()` sets the codespace up in it.
491
- */
603
+ /** Short for `containers.codespace`. */
492
604
  codespaceContainer?: HTMLElement;
493
605
  /**
494
606
  * Container for the custom HTML toolbox. `mount()` sets the toolbox up in it,
495
607
  * which implies `canvasToolbox`.
496
608
  */
497
609
  toolboxContainer?: HTMLElement;
498
- /** Container for the read-only preview. `mount()` sets the preview up in it. */
499
- previewContainer?: HTMLElement;
500
610
  /**
501
611
  * Container for the generated JavaScript view, a developer tool. `mount()`
502
612
  * sets it up hidden; `showCodeEditor()` reveals it.
503
613
  */
504
614
  codeEditorContainer?: HTMLElement;
505
- /** Toolbar containers per pane, set up once the text editors are ready. */
506
- toolbarContainers?: Partial<Record<MorphicToolbarPane, HTMLElement>>;
507
- /** Theme for the codespace and code editor set up by `mount()`. */
615
+ /** Toolbar containers, by view name, set up once the views are ready. */
616
+ toolbars?: Record<string, HTMLElement>;
617
+ /** Theme for the text views and the code editor. */
508
618
  editorTheme?: MorphicCodeEditorTheme;
509
- /** Theme for the preview set up by `mount()`. Defaults to `editorTheme`. */
510
- previewTheme?: MorphicCodeEditorTheme;
619
+ /** Themes of single text views, by view name, in place of `editorTheme`. */
620
+ themes?: Record<string, MorphicCodeEditorTheme>;
621
+ /** The views, in place of the definitions' `views`. */
622
+ views?: Record<string, MorphicViewKind | MorphicViewDeclaration>;
511
623
  /**
512
624
  * Link block and code selection across views. On by default when `mount()`
513
625
  * sets up more than one view; `false` turns it off, an object configures it.
@@ -524,8 +636,8 @@ export interface MorphicMountConfig {
524
636
  preset?: string;
525
637
  /**
526
638
  * Called after a preset is applied — at mount and on every `applyPreset` —
527
- * so the host can lay out pane visibility (a view is shown iff its key is
528
- * present on the preset).
639
+ * so the host can lay out pane visibility (the preset shows the views its
640
+ * `views` lists).
529
641
  */
530
642
  onPresetApplied?: (preset: MorphicPresetDefinition) => void;
531
643
  /**
@@ -564,6 +676,7 @@ export interface MorphicMountConfig {
564
676
  /**
565
677
  * Options passed through to Blockly's `inject` (zoom, grid, trashcan, and so
566
678
  * on). `media` defaults to `"blockly-media/"` next to the page, filled by
679
+ * the bundler plugin (`morphic-blocks/vite` and others) or
567
680
  * `npx morphic-blocks copy-media`, so Blockly never loads from another server
568
681
  * unless the host sets it.
569
682
  */
@@ -667,6 +780,14 @@ export interface MorphicCodeGenerationResult {
667
780
  metadata: MorphicCodeMetadata;
668
781
  /** Value-slot ranges with default/set classification. Empty if no value slots emitted. */
669
782
  placeholders: MorphicPlaceholderRange[];
783
+ /**
784
+ * Line range (1-based, inclusive) of each group of connected blocks, a stack
785
+ * in the workspace, in text order. Text views mark these lines with classes.
786
+ */
787
+ groups?: {
788
+ startLine: number;
789
+ endLine: number;
790
+ }[];
670
791
  }
671
792
  /** Theme configuration for the code editor. */
672
793
  export interface MorphicCodeEditorTheme {
@@ -687,24 +808,36 @@ export interface MorphicCodeEditorTheme {
687
808
  /** Text selection highlight colour. */
688
809
  selectionBackground?: string;
689
810
  }
690
- /** Kinds of view `addView()` adds beside the ones `mount()` sets up. */
691
- export type MorphicViewKind = "preview" | "codespace" | "workspace";
811
+ /** Ways to delete blocks in a codespace, each on unless set to `false`. */
812
+ export interface MorphicCodespaceDeleteOptions {
813
+ /** The ✕ beside each line where a block starts. */
814
+ lineButtons?: boolean;
815
+ /** Delete and Backspace: the block of the cursor's line, or of every selected line. */
816
+ keys?: boolean;
817
+ /** The toolbar button that deletes the blocks of the selected lines. */
818
+ toolbarButton?: boolean;
819
+ }
692
820
  /** A view added with `engine.addView()`. */
693
821
  export interface MorphicViewOptions {
694
822
  kind: MorphicViewKind;
695
823
  /** Element the view renders into. */
696
824
  container: HTMLElement;
697
- /** Mode the view shows; a preview renders its source element. */
698
- mode: MorphicModeName;
699
- /** Unique among the engine's added views. */
825
+ /** The code element the view shows, e.g. `"python"`. */
826
+ element: string;
827
+ /** Unique among the engine's views. */
700
828
  name?: string;
701
829
  /**
702
- * An added workspace shows the program as blocks in its own mode and follows
703
- * every change of the main workspace. It is read only: `false` is the only
704
- * value for now, and the default.
705
- */
706
- editable?: false;
707
- /** Colours of a text view, like `previewTheme`. */
830
+ * Whether the program can be changed in the view. Default `true`. An added
831
+ * workspace follows every change of the one that holds the program and
832
+ * sends its own edits there; a codespace that cannot be edited shows the
833
+ * program as text, read only.
834
+ */
835
+ editable?: boolean;
836
+ /** Right to left or left to right; left out, the view follows the program's workspace or the page. */
837
+ rtl?: boolean;
838
+ /** How blocks are deleted in a codespace. */
839
+ delete?: MorphicCodespaceDeleteOptions;
840
+ /** Colours of a text view, like `editorTheme`. */
708
841
  theme?: MorphicCodeEditorTheme;
709
842
  /** A toolbar for this view, removed with it. Items default to its kind's. */
710
843
  toolbar?: {
@@ -720,8 +853,10 @@ export interface MorphicViewHandle {
720
853
  readonly name: string;
721
854
  /** Settles once the view is ready; text views load their editor in the background. */
722
855
  readonly ready: Promise<void>;
723
- getMode(): MorphicModeName;
724
- setMode(mode: MorphicModeName): void;
856
+ /** The code element the view shows. */
857
+ getElement(): string;
858
+ /** Show another code element. */
859
+ show(element: string): void;
725
860
  /** Colours of a text view, e.g. when the app switches between light and dark. No effect on a workspace. */
726
861
  setTheme(theme: MorphicCodeEditorTheme): void;
727
862
  /** Removes the view. `mount()` again removes every added view too. */
@@ -735,10 +870,17 @@ export interface MorphicCodeEditorOptions {
735
870
  extensions?: unknown[];
736
871
  /**
737
872
  * Called when the user requests to delete the block at a given 1-based line
738
- * (via Delete/Backspace on an empty selection, or a click on the gutter ✕).
873
+ * (via Delete/Backspace, or a click on the gutter ✕), or the blocks of the
874
+ * lines `line` to `lastLine` when several lines are selected.
739
875
  * When set, the editor installs a keymap and a delete gutter.
740
876
  */
741
- onDelete?: (line: number) => void;
877
+ onDelete?: (line: number, lastLine?: number) => void;
878
+ /** Called when the selected lines change (see `getSelectedLines()`). */
879
+ onLineSelection?: () => void;
880
+ /** With `onDelete`: the ✕ beside each line where a block starts. Default `true`. */
881
+ deleteButtons?: boolean;
882
+ /** With `onDelete`: Delete and Backspace delete. Default `true`. */
883
+ deleteKeys?: boolean;
742
884
  /**
743
885
  * If provided, a "grip" gutter (⋮⋮) appears on the start line of every block
744
886
  * id for which this returns `true`. Mousedown on the grip starts an HTML5
@@ -768,16 +910,11 @@ export interface MorphicCodeEditorOptions {
768
910
  }
769
911
  /** Options for `enableSelectionSync()`. */
770
912
  export interface MorphicSelectionSyncOptions {
771
- /** CSS background colour for highlighted code lines. Defaults to each editor's theme `selectionBackground`, a little lighter. */
772
- highlightColor?: string;
773
913
  /** Enable block → code direction. Defaults to true. */
774
914
  blockToCode?: boolean;
775
915
  /** Enable code → block direction. Defaults to true. */
776
916
  codeToBlock?: boolean;
777
917
  }
778
- /** Surface a toolbar binds to. Drives stateful items (undo enabled-state,
779
- * language label source, what "clear" affects). */
780
- export type MorphicToolbarPane = "workspace" | "codespace" | "preview";
781
918
  /** How items render their built-in icon + label pair. */
782
919
  export type MorphicToolbarDisplay = "icon" | "label" | "both";
783
920
  /**
@@ -787,7 +924,9 @@ export type MorphicToolbarDisplay = "icon" | "label" | "both";
787
924
  export interface MorphicToolbarCtx {
788
925
  engine: import("./MorphicBlocks").MorphicBlocks;
789
926
  /** The kind of view the toolbar acts on. */
790
- pane: MorphicToolbarPane;
927
+ kind: MorphicViewKind;
928
+ /** Whether the view shows the program without changing it. */
929
+ readOnly: boolean;
791
930
  /** The name of the view the toolbar acts on; pass it to engine methods such as `zoomPane`. */
792
931
  view: string;
793
932
  /** Current rendered text for the bound pane. Empty for workspace pane unless
@@ -824,10 +963,8 @@ export interface MorphicToolbarItem {
824
963
  }
825
964
  /** Configuration for `engine.mountToolbar(container, config)`. */
826
965
  export interface MorphicToolbarConfig {
827
- /** The view this toolbar acts on, by name: `workspace`, `codespace`, `preview`, or an added view's. */
828
- view?: string;
829
- /** Same as `view` for the views `mount()` sets up. One of `view` and `pane` is required. */
830
- pane?: MorphicToolbarPane;
966
+ /** The view this toolbar acts on, by name. */
967
+ view: string;
831
968
  /** Items to render. When omitted, the framework uses
832
969
  * `toolbarItems.defaultsFor(<kind of view>)`. To render no items, pass `[]`. */
833
970
  items?: MorphicToolbarItem[];
@@ -12,6 +12,8 @@ export interface ValidateDefinitionsArgs {
12
12
  presets?: MorphicPresetDefinition[];
13
13
  code?: Record<string, MorphicCodeElementConfig>;
14
14
  categories?: MorphicToolboxCategory[];
15
+ /** Names of the views the developer declared (not the defaults). */
16
+ views?: string[];
15
17
  }
16
18
  export interface DefinitionValidationResult {
17
19
  /** Structural problems that guarantee wrong output — the caller should throw. */
@@ -0,0 +1,13 @@
1
+ import type * as Blockly from "blockly";
2
+ import type { MorphicElementTypeEntry, MorphicInputSlotDefinition } from "./types";
3
+ /** Name prefix of the label a `%1:type` token becomes, followed by the slot number. */
4
+ export declare const VALUE_TYPE_FIELD = "MORPHIC_TYPE_";
5
+ /** Whether a field is the label of a `%1:type` token, not one of the block's own fields. */
6
+ export declare const isValueTypeLabel: (field: Blockly.Field) => boolean;
7
+ /**
8
+ * The name `%1:type` writes for the value in `slot`: the element's
9
+ * `code.types` entry for the value's type (its block's output check, or the
10
+ * slot's own check while the slot is empty and accepts one type), else
11
+ * `default`, else nothing.
12
+ */
13
+ export declare function valueTypeName(block: Blockly.Block, slot: MorphicInputSlotDefinition | undefined, elementEntry: MorphicElementTypeEntry | undefined): string;
@@ -15,3 +15,8 @@ export declare function resolveModeSourceElement(mode: MorphicModeDefinition, el
15
15
  * 4. First element in the block definition
16
16
  */
17
17
  export declare function resolveBlockView(definition: MorphicBlockDefinition, mode: MorphicModeName, elementTypes?: Record<string, MorphicElementTypeEntry>, modeDefs?: MorphicModeDefinition[]): MorphicResolvedView;
18
+ /**
19
+ * The workspace template for a block in a view that shows `element`: the
20
+ * block's own content for it, else the fallbacks of `resolveBlockView`.
21
+ */
22
+ export declare function resolveElementView(definition: MorphicBlockDefinition, element: string, elementTypes?: Record<string, MorphicElementTypeEntry>): MorphicResolvedView;