@vectojs/markdown 0.25.0 → 0.25.1

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/README.md CHANGED
@@ -112,7 +112,17 @@ context-menu, so `role` is only needed when even a `url` must not appear in the
112
112
  a11y tree. See the [Image reference](https://vectojs.org/reference/ui-image/)
113
113
  for the full Visual Flattening trust table and `DecodedImage` lifecycle.
114
114
 
115
- > Documents @vectojs/markdown@0.23.0.
115
+ ## Projection policy — `classifyProjectionBlocks` & `applyProjectionMode`
116
+
117
+ `Markdown` documents negotiate visual projection per block:
118
+ `classifyProjectionBlocks(content)` tags top-level blocks (`prose` for
119
+ headings/paragraphs, `code` for fences, `container` for quotes/lists whose
120
+ nested prose is tagged recursively, canvas for tables/chrome), and
121
+ `applyProjectionMode(root, mode)` switches the subtree — `'canvas'` forces
122
+ canvas pixels, `'dom'` materializes prose/code, `'hybrid'` sets `'auto'`
123
+ everywhere so the engine negotiates per block.
124
+
125
+ > Documents @vectojs/markdown@0.25.0.
116
126
 
117
127
  ## Documentation
118
128
 
package/dist/index.js CHANGED
@@ -6773,10 +6773,23 @@ function classifyProjectionBlock(node, index) {
6773
6773
  }
6774
6774
  return { node, label: `${index}: ${node.constructor.name} (canvas leaf)`, domKind: "" };
6775
6775
  }
6776
+ function classifyNestedChildren(node) {
6777
+ for (const child of node.children) {
6778
+ if (child instanceof import_ui5.Text || child instanceof import_ui5.RichText) {
6779
+ child.domKind = "prose";
6780
+ } else if (child instanceof CodeBlock) {
6781
+ child.domKind = "code";
6782
+ } else if (child instanceof import_ui5.Table) {
6783
+ } else if (child.children.length > 0) {
6784
+ classifyNestedChildren(child);
6785
+ }
6786
+ }
6787
+ }
6776
6788
  function classifyProjectionBlocks(content) {
6777
6789
  const blocks = content.children.map((child, i) => classifyProjectionBlock(child, i));
6778
6790
  for (const { node, domKind } of blocks) {
6779
6791
  if (domKind) node.domKind = domKind;
6792
+ if (domKind === "container") classifyNestedChildren(node);
6780
6793
  }
6781
6794
  return blocks;
6782
6795
  }
package/dist/index.mjs CHANGED
@@ -6723,10 +6723,23 @@ function classifyProjectionBlock(node, index) {
6723
6723
  }
6724
6724
  return { node, label: `${index}: ${node.constructor.name} (canvas leaf)`, domKind: "" };
6725
6725
  }
6726
+ function classifyNestedChildren(node) {
6727
+ for (const child of node.children) {
6728
+ if (child instanceof Text2 || child instanceof RichText3) {
6729
+ child.domKind = "prose";
6730
+ } else if (child instanceof CodeBlock) {
6731
+ child.domKind = "code";
6732
+ } else if (child instanceof Table2) {
6733
+ } else if (child.children.length > 0) {
6734
+ classifyNestedChildren(child);
6735
+ }
6736
+ }
6737
+ }
6726
6738
  function classifyProjectionBlocks(content) {
6727
6739
  const blocks = content.children.map((child, i) => classifyProjectionBlock(child, i));
6728
6740
  for (const { node, domKind } of blocks) {
6729
6741
  if (domKind) node.domKind = domKind;
6742
+ if (domKind === "container") classifyNestedChildren(node);
6730
6743
  }
6731
6744
  return blocks;
6732
6745
  }
@@ -19,11 +19,13 @@ import { Stack } from '@vectojs/ui';
19
19
  * - `Table` → `''` (unsupported-kind): composite interactive widget, stays
20
20
  * canvas with a reported reason.
21
21
  * - Grouping wrappers (children present, no specific class) → `'container'`:
22
- * never materialized itself; children negotiate individually.
22
+ * never materialized itself; the pass recurses into its children so nested
23
+ * prose/code negotiates individually (r8, CTX-0608).
23
24
  * - Anything else (rules, borders, backgrounds) → `''`: canvas leaves.
24
25
  *
25
- * Kinds are assigned to top-level blocks only; nested content keeps its own
26
- * `domKind` (default `''` canvas, reported) until a finer pass tags it.
26
+ * Tables stay canvas even when nested inside a container (composite widget,
27
+ * cell text included). Grouping wrappers below the top level keep `domKind`
28
+ * `''` (reported fallback) — only nested prose/code leaves are tagged.
27
29
  */
28
30
  /** Dogfood switcher mode (RFC4 §6): forced canvas, forced dom, or negotiated. */
29
31
  export type MarkdownProjectionMode = 'canvas' | 'dom' | 'hybrid';
@@ -40,6 +42,8 @@ export declare function classifyProjectionBlock(node: Entity, index: number): Cl
40
42
  /**
41
43
  * Top-level blocks of a document's content stack, in order, with kinds
42
44
  * assigned onto the blocks (idempotent — re-running keeps prior kinds).
45
+ * Container blocks additionally have their nested prose/code tagged via
46
+ * {@link classifyNestedChildren} (idempotent for the same reason).
43
47
  */
44
48
  export declare function classifyProjectionBlocks(content: Stack): ClassifiedProjectionBlock[];
45
49
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectojs/markdown",
3
- "version": "0.25.0",
3
+ "version": "0.25.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },