@ai-matrx/rich-content 0.2.32 → 0.2.34

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.34
4
+
5
+ - `applet_build_result` joins the FE-synthesized and shape block types: the Applet builder's answer (`applets.build` / `applets.fix`) is a registered kind now, and its host renders it through one compiled component instead of the generic viewer's raw JSON.
6
+
7
+ **Consumer action:** none (matrx-frontend registers the `applet_build_result` dispatch entry).
8
+
9
+ ## 0.2.33
10
+
11
+ - The interactive diagram's two PNG exports (`handleExportImage` and the viewport-fallback export) take a picture through Alchemy's `renderElement` (html-to-image: native SVG edges, transforms, modern colours) instead of the html2canvas `captureElement` (AP-2 capture rule: pictures of surfaces use `renderElement`, documents use html2canvas). `table-source` reads the author's edge pipes and a delimiter cell through `@ai-matrx/content-ir/source`.
12
+
13
+ **Consumer action:** none.
14
+
3
15
  ## 0.2.32
4
16
  ### CopySplitButton: moreOnly
5
17
 
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { captureElement } from "@ai-matrx/alchemy/operate/capture";
3
+ import { renderElement } from "@ai-matrx/alchemy/operate/capture";
4
4
  import { downloadFile, downloadUrl } from "@ai-matrx/kit/download";
5
5
  import { Button, Chip } from "@ai-matrx/design-system/controls";
6
6
  import {
@@ -1046,15 +1046,12 @@ const DiagramFlow = ({
1046
1046
  }
1047
1047
  exportContainer.appendChild(cloned);
1048
1048
  document.body.appendChild(exportContainer);
1049
- captureElement(exportContainer, {
1049
+ renderElement(exportContainer, {
1050
1050
  backgroundColor: bgColor,
1051
- scale: 2,
1052
- useCORS: true,
1053
- allowTaint: true,
1051
+ pixelRatio: 2,
1054
1052
  width: imageWidth,
1055
1053
  height: imageHeight,
1056
- safeColors: { dark: isDark },
1057
- ignoreElements: (el) => el.classList.contains("react-flow__controls") || el.classList.contains("react-flow__minimap") || el.classList.contains("react-flow__panel")
1054
+ filter: (node) => !(node.classList?.contains("react-flow__controls") || node.classList?.contains("react-flow__minimap") || node.classList?.contains("react-flow__panel"))
1058
1055
  }).then((canvas) => {
1059
1056
  downloadUrl(
1060
1057
  canvas.toDataURL("image/png"),
@@ -2113,11 +2110,9 @@ const InteractiveDiagramBlock = ({
2113
2110
  );
2114
2111
  if (!viewport) return;
2115
2112
  const isDark = document.documentElement.classList.contains("dark") || window.matchMedia("(prefers-color-scheme: dark)").matches;
2116
- captureElement(viewport, {
2113
+ renderElement(viewport, {
2117
2114
  backgroundColor: isDark ? "#111827" : "#ffffff",
2118
- scale: 2,
2119
- useCORS: true,
2120
- safeColors: { dark: isDark }
2115
+ pixelRatio: 2
2121
2116
  }).then((canvas) => {
2122
2117
  downloadUrl(
2123
2118
  canvas.toDataURL("image/png"),
@@ -320,7 +320,7 @@ export declare function isBlockLoading(block: {
320
320
  * hid impossible to miss: an UNDECLARED column type (never a synonym for
321
321
  * "string") and a SILENT truncation.
322
322
  */
323
- export type FeSynthesizedBlockType = "directive_receipt" | "decision_questions" | "speech_script" | "input_remarks" | "media_block" | "video_prompt_options" | "map_topic_proposal" | "pr_play_menu" | "news_monitor_kind" | "decision_answers" | "list_change_proposal" | "keyword_research" | "keyword_classification_batch" | "keyword_serp_intent_analysis" | "seo_keyword_research_result" | "page_brief" | "media_chapters" | "generated_image_set" | "generated_video_set" | "generated_audio" | "podcast_episode" | "media_asset" | "memory_aid" | "memory_hint" | "episode_title_options" | "masterwork_checkup_finding" | "masterwork_result" | "serial_observation_timeline" | "case_disclosure" | "unfolding_ruling" | "refusal" | "agent_result" | "node_outcome" | "run_result" | "seo_package" | "plan_page_research" | "plan_page_outline" | "plan_page_draft" | "plan_page_review" | "cms_page_build" | "cms_html_page_result" | "ingested_sources" | "study_notes" | "lesson_scripts" | "study_pack" | "scraped_page" | "scraper_batch_result" | "scraper_crawl_result" | "page_link" | "link_buckets" | "page_image" | "page_video" | "page_audio" | "page_heading" | "page_section" | "page_list" | "page_block" | "code_block" | "redirect_hop" | "content_fingerprint" | "page_metadata" | "page_removal" | "page_cleaning_report" | "web_search_results" | "web_result" | "news_result" | "video_result" | "faq_item" | "discussion_result" | "local_place" | "entity_card" | "ai_answer" | "rating" | "opening_hours" | "postal_address" | "geo_coordinates" | "seo_rank_serp_landscape" | "serp_placement" | "seo_rank_reading" | "seo_rank_target" | "seo_rank_portfolio" | "seo_rank_target_removal" | "provider_run_receipt" | "intake_photo_grouping" | "item_vision_extraction" | "lot_detection" | "product_research" | "value_assessment" | "asset_grading" | "media_list_ranking_result" | "media_candidate_verdict" | "enrichment_verification" | "pricing_proposal" | "listing_draft" | "review_verdict" | "publish_preflight" | "lulu_print_cost_calculation" | "lulu_shipping_options" | "lulu_cover_dimensions" | "lulu_print_job" | "lulu_print_product_matches" | "data_table" | "source_ref" | "retrieved_chunk" | "rag_search_result" | "rag_cross_doc_search_result" | "rag_synthesize_result" | "web_analysis_item" | "flow_step_result" | "collection_result" | "file_operation_result" | "value_result" | "google_workspace_result" | "google_marketing_result" | "platform_record" | "relation" | "pick_list" | "seo_ruling_keyword" | "seo_ruling_example" | "seo_ruling_dimension" | "seo_ruling_matcher_hit" | "seo_ruling_correction" | "seo_ruling_confirmation" | "seo_ruling_matcher" | "seo_ruling_keyword_set" | "seo_ruling_example_set" | "seo_ruling_dimension_catalog" | "seo_ruling_matcher_hit_set" | "seo_ruling_correction_set" | "seo_ruling_confirmation_set" | "seo_ruling_matcher_set" | "agent_factory_contract" | "agent_factory_tool_choice" | "agent_factory_instructions" | "agent_factory_proof_review" | "agent_factory_build" | "markdown_stream" | typeof GENERIC_STRUCTURED_COMPONENT_KEY | typeof DB_KIND_COMPONENT_KEY;
323
+ export type FeSynthesizedBlockType = "directive_receipt" | "decision_questions" | "speech_script" | "input_remarks" | "media_block" | "video_prompt_options" | "map_topic_proposal" | "pr_play_menu" | "news_monitor_kind" | "decision_answers" | "list_change_proposal" | "keyword_research" | "keyword_classification_batch" | "keyword_serp_intent_analysis" | "seo_keyword_research_result" | "page_brief" | "media_chapters" | "generated_image_set" | "generated_video_set" | "generated_audio" | "podcast_episode" | "media_asset" | "memory_aid" | "memory_hint" | "episode_title_options" | "masterwork_checkup_finding" | "masterwork_result" | "serial_observation_timeline" | "case_disclosure" | "unfolding_ruling" | "refusal" | "agent_result" | "node_outcome" | "run_result" | "seo_package" | "plan_page_research" | "plan_page_outline" | "plan_page_draft" | "plan_page_review" | "cms_page_build" | "cms_html_page_result" | "ingested_sources" | "study_notes" | "lesson_scripts" | "study_pack" | "scraped_page" | "scraper_batch_result" | "scraper_crawl_result" | "page_link" | "link_buckets" | "page_image" | "page_video" | "page_audio" | "page_heading" | "page_section" | "page_list" | "page_block" | "code_block" | "redirect_hop" | "content_fingerprint" | "page_metadata" | "page_removal" | "page_cleaning_report" | "web_search_results" | "web_result" | "news_result" | "video_result" | "faq_item" | "discussion_result" | "local_place" | "entity_card" | "ai_answer" | "rating" | "opening_hours" | "postal_address" | "geo_coordinates" | "seo_rank_serp_landscape" | "serp_placement" | "seo_rank_reading" | "seo_rank_target" | "seo_rank_portfolio" | "seo_rank_target_removal" | "provider_run_receipt" | "intake_photo_grouping" | "item_vision_extraction" | "lot_detection" | "product_research" | "value_assessment" | "asset_grading" | "media_list_ranking_result" | "media_candidate_verdict" | "enrichment_verification" | "pricing_proposal" | "listing_draft" | "review_verdict" | "publish_preflight" | "lulu_print_cost_calculation" | "lulu_shipping_options" | "lulu_cover_dimensions" | "lulu_print_job" | "lulu_print_product_matches" | "data_table" | "source_ref" | "retrieved_chunk" | "rag_search_result" | "rag_cross_doc_search_result" | "rag_synthesize_result" | "web_analysis_item" | "flow_step_result" | "collection_result" | "file_operation_result" | "value_result" | "google_workspace_result" | "google_marketing_result" | "platform_record" | "relation" | "pick_list" | "seo_ruling_keyword" | "seo_ruling_example" | "seo_ruling_dimension" | "seo_ruling_matcher_hit" | "seo_ruling_correction" | "seo_ruling_confirmation" | "seo_ruling_matcher" | "seo_ruling_keyword_set" | "seo_ruling_example_set" | "seo_ruling_dimension_catalog" | "seo_ruling_matcher_hit_set" | "seo_ruling_correction_set" | "seo_ruling_confirmation_set" | "seo_ruling_matcher_set" | "agent_factory_contract" | "agent_factory_tool_choice" | "agent_factory_instructions" | "agent_factory_proof_review" | "agent_factory_build" | "applet_build_result" | "markdown_stream" | typeof GENERIC_STRUCTURED_COMPONENT_KEY | typeof DB_KIND_COMPONENT_KEY;
324
324
  /**
325
325
  * Detector-owned protocol tokens (crosswalk rows sourced ONLY from the
326
326
  * splitter/accumulator ATTR_XML_TAGS tables — no TS render-block union
@@ -332,7 +332,7 @@ export type ProtocolBlockType = ServerProtocolRenderBlock["type"] | "directive_r
332
332
  /** Crosswalk classification: scalar_generic — text/code/table/media primitives. */
333
333
  export type ScalarGenericBlockType = ServerScalarGenericRenderBlock["type"] | "text" | "code" | "table" | "image" | "video" | "tree" | "accent-divider" | "heavy-divider" | "audio" | "youtube" | "svg" | "media_block";
334
334
  /** Crosswalk classification: shape — structured content (kinds + candidates). */
335
- export type ShapeBlockType = ServerShapeRenderBlock["type"] | "decision_questions" | "speech_script" | "input_remarks" | "flashcards" | "quiz" | "presentation" | "cooking_recipe" | "timeline" | "progress_tracker" | "comparison_table" | "troubleshooting" | "resources" | "decision_tree" | "research" | "diagram" | "mermaid" | "math_problem" | "questionnaire" | "tasks" | "transcript" | "structured_info" | "item_presentation" | "video_prompt_options" | "map_topic_proposal" | "pr_play_menu" | "news_monitor_kind" | "decision_answers" | "list_change_proposal" | "keyword_research" | "keyword_classification_batch" | "keyword_serp_intent_analysis" | "seo_keyword_research_result" | "page_brief" | "media_chapters" | "generated_image_set" | "generated_video_set" | "generated_audio" | "podcast_episode" | "media_asset" | "memory_aid" | "memory_hint" | "episode_title_options" | "masterwork_checkup_finding" | "masterwork_result" | "serial_observation_timeline" | "case_disclosure" | "unfolding_ruling" | "refusal" | "agent_result" | "node_outcome" | "run_result" | "seo_package" | "plan_page_research" | "plan_page_outline" | "plan_page_draft" | "plan_page_review" | "cms_page_build" | "cms_html_page_result" | "ingested_sources" | "study_notes" | "lesson_scripts" | "study_pack" | "scraped_page" | "scraper_batch_result" | "scraper_crawl_result" | "page_link" | "link_buckets" | "page_image" | "page_video" | "page_audio" | "page_heading" | "page_section" | "page_list" | "page_block" | "code_block" | "redirect_hop" | "content_fingerprint" | "page_metadata" | "page_removal" | "page_cleaning_report" | "web_search_results" | "web_result" | "news_result" | "video_result" | "faq_item" | "discussion_result" | "local_place" | "entity_card" | "ai_answer" | "rating" | "opening_hours" | "postal_address" | "geo_coordinates" | "seo_rank_serp_landscape" | "serp_placement" | "seo_rank_reading" | "seo_rank_target" | "seo_rank_portfolio" | "seo_rank_target_removal" | "provider_run_receipt" | "intake_photo_grouping" | "item_vision_extraction" | "lot_detection" | "product_research" | "value_assessment" | "asset_grading" | "media_list_ranking_result" | "media_candidate_verdict" | "enrichment_verification" | "pricing_proposal" | "listing_draft" | "review_verdict" | "publish_preflight" | "lulu_print_cost_calculation" | "lulu_shipping_options" | "lulu_cover_dimensions" | "lulu_print_job" | "lulu_print_product_matches" | "data_table" | "source_ref" | "retrieved_chunk" | "rag_search_result" | "rag_cross_doc_search_result" | "rag_synthesize_result" | "chart" | "map" | "stats" | "diff" | "web_analysis_item" | "flow_step_result" | "collection_result" | "file_operation_result" | "value_result" | "google_workspace_result" | "google_marketing_result" | "platform_record" | "relation" | "pick_list" | "seo_ruling_keyword" | "seo_ruling_example" | "seo_ruling_dimension" | "seo_ruling_matcher_hit" | "seo_ruling_correction" | "seo_ruling_confirmation" | "seo_ruling_matcher" | "seo_ruling_keyword_set" | "seo_ruling_example_set" | "seo_ruling_dimension_catalog" | "seo_ruling_matcher_hit_set" | "seo_ruling_correction_set" | "seo_ruling_confirmation_set" | "seo_ruling_matcher_set" | "agent_factory_contract" | "agent_factory_tool_choice" | "agent_factory_instructions" | "agent_factory_proof_review" | "agent_factory_build" | "markdown_stream" | typeof GENERIC_STRUCTURED_COMPONENT_KEY | typeof DB_KIND_COMPONENT_KEY;
335
+ export type ShapeBlockType = ServerShapeRenderBlock["type"] | "decision_questions" | "speech_script" | "input_remarks" | "flashcards" | "quiz" | "presentation" | "cooking_recipe" | "timeline" | "progress_tracker" | "comparison_table" | "troubleshooting" | "resources" | "decision_tree" | "research" | "diagram" | "mermaid" | "math_problem" | "questionnaire" | "tasks" | "transcript" | "structured_info" | "item_presentation" | "video_prompt_options" | "map_topic_proposal" | "pr_play_menu" | "news_monitor_kind" | "decision_answers" | "list_change_proposal" | "keyword_research" | "keyword_classification_batch" | "keyword_serp_intent_analysis" | "seo_keyword_research_result" | "page_brief" | "media_chapters" | "generated_image_set" | "generated_video_set" | "generated_audio" | "podcast_episode" | "media_asset" | "memory_aid" | "memory_hint" | "episode_title_options" | "masterwork_checkup_finding" | "masterwork_result" | "serial_observation_timeline" | "case_disclosure" | "unfolding_ruling" | "refusal" | "agent_result" | "node_outcome" | "run_result" | "seo_package" | "plan_page_research" | "plan_page_outline" | "plan_page_draft" | "plan_page_review" | "cms_page_build" | "cms_html_page_result" | "ingested_sources" | "study_notes" | "lesson_scripts" | "study_pack" | "scraped_page" | "scraper_batch_result" | "scraper_crawl_result" | "page_link" | "link_buckets" | "page_image" | "page_video" | "page_audio" | "page_heading" | "page_section" | "page_list" | "page_block" | "code_block" | "redirect_hop" | "content_fingerprint" | "page_metadata" | "page_removal" | "page_cleaning_report" | "web_search_results" | "web_result" | "news_result" | "video_result" | "faq_item" | "discussion_result" | "local_place" | "entity_card" | "ai_answer" | "rating" | "opening_hours" | "postal_address" | "geo_coordinates" | "seo_rank_serp_landscape" | "serp_placement" | "seo_rank_reading" | "seo_rank_target" | "seo_rank_portfolio" | "seo_rank_target_removal" | "provider_run_receipt" | "intake_photo_grouping" | "item_vision_extraction" | "lot_detection" | "product_research" | "value_assessment" | "asset_grading" | "media_list_ranking_result" | "media_candidate_verdict" | "enrichment_verification" | "pricing_proposal" | "listing_draft" | "review_verdict" | "publish_preflight" | "lulu_print_cost_calculation" | "lulu_shipping_options" | "lulu_cover_dimensions" | "lulu_print_job" | "lulu_print_product_matches" | "data_table" | "source_ref" | "retrieved_chunk" | "rag_search_result" | "rag_cross_doc_search_result" | "rag_synthesize_result" | "chart" | "map" | "stats" | "diff" | "web_analysis_item" | "flow_step_result" | "collection_result" | "file_operation_result" | "value_result" | "google_workspace_result" | "google_marketing_result" | "platform_record" | "relation" | "pick_list" | "seo_ruling_keyword" | "seo_ruling_example" | "seo_ruling_dimension" | "seo_ruling_matcher_hit" | "seo_ruling_correction" | "seo_ruling_confirmation" | "seo_ruling_matcher" | "seo_ruling_keyword_set" | "seo_ruling_example_set" | "seo_ruling_dimension_catalog" | "seo_ruling_matcher_hit_set" | "seo_ruling_correction_set" | "seo_ruling_confirmation_set" | "seo_ruling_matcher_set" | "agent_factory_contract" | "agent_factory_tool_choice" | "agent_factory_instructions" | "agent_factory_proof_review" | "agent_factory_build" | "applet_build_result" | "markdown_stream" | typeof GENERIC_STRUCTURED_COMPONENT_KEY | typeof DB_KIND_COMPONENT_KEY;
336
336
  /** Crosswalk classification: intentionally_opaque — deliberately untyped. */
337
337
  export type OpaqueBlockType = ServerOpaqueRenderBlock["type"];
338
338
  export type KnownBlockType = ProtocolBlockType | ScalarGenericBlockType | ShapeBlockType | OpaqueBlockType;
@@ -1,5 +1,5 @@
1
1
  import { lexGfmBlocks } from "./gfm-lexer.js";
2
- import { rowCells, splitRowSegments, unescapeCellPipes } from "@ai-matrx/content-ir/source";
2
+ import { isGfmDelimiterRow, rowCells, splitRowSegments, unescapeCellPipes } from "@ai-matrx/content-ir/source";
3
3
  import { rowCells as rowCells2, splitRowSegments as splitRowSegments2 } from "@ai-matrx/content-ir/source";
4
4
  function backslashRunBefore(text, index) {
5
5
  let run = 0;
@@ -112,7 +112,7 @@ function respliceRow(segs, stored, texts) {
112
112
  }
113
113
  function freshRow(texts, lead = true, trail = true) {
114
114
  const cells = texts.map((text) => freshCell(text).trim());
115
- const needLead = lead || !cells.every((cell) => /^:?-+:?$/.test(cell));
115
+ const needLead = lead || !cells.every((cell) => isGfmDelimiterRow(`|${cell}|`));
116
116
  const needTrail = trail || cells[cells.length - 1] === "" || endsInEscape(cells[cells.length - 1] ?? "");
117
117
  const line = `${needLead ? "| " : ""}${cells.join(" | ")}${needTrail ? " |" : ""}`;
118
118
  return assertRowReadsBack(line, cells);
@@ -140,8 +140,9 @@ function rewriteTableSource(original, grid) {
140
140
  return [freshRow(grid.headers), freshRow(grid.headers.map(() => "---")), ...grid.rows.map((row) => freshRow(row))].join("\n");
141
141
  }
142
142
  const headerLine = lines[headerAt] ?? "";
143
- const lead = headerLine.trimStart().startsWith("|");
144
- const trail = headerLine.trimEnd().endsWith("|");
143
+ const headerSegments = splitRowSegments(headerLine);
144
+ const lead = headerSegments.length > 1 && (headerSegments[0] ?? "").trim() === "";
145
+ const trail = headerSegments.length > 1 && (headerSegments[headerSegments.length - 1] ?? "").trim() === "";
145
146
  const width = rowCells(headerLine).length;
146
147
  const columnsChanged = grid.headers.length !== width;
147
148
  const out = [...lines];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-matrx/rich-content",
3
- "version": "0.2.32",
3
+ "version": "0.2.34",
4
4
  "description": "The AI Matrx formatted-text engine: the one markdown renderer, streaming markdown, the block splitter and renderer, the generic blocks, <RichContent> levels, the rich-document action registry and menus, copy, and the selection toolbar — as portable React.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -139,12 +139,12 @@
139
139
  "@ai-matrx/design-system": "latest",
140
140
  "@ai-matrx/diff": "latest",
141
141
  "@ai-matrx/icons": "latest",
142
+ "@ai-matrx/kit": "latest",
142
143
  "@ai-matrx/print": "latest",
143
144
  "@ai-matrx/records": "latest",
144
- "@ai-matrx/media": "latest",
145
145
  "@ai-matrx/records-ui": "latest",
146
146
  "@ai-matrx/tap-target": "latest",
147
- "@ai-matrx/kit": "latest"
147
+ "@ai-matrx/media": "latest"
148
148
  },
149
149
  "peerDependencies": {
150
150
  "react": ">=19.0.0",