@agent-native/core 0.42.0 → 0.44.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.
Files changed (139) hide show
  1. package/README.md +17 -56
  2. package/dist/chat-threads/store.d.ts.map +1 -1
  3. package/dist/chat-threads/store.js +71 -10
  4. package/dist/chat-threads/store.js.map +1 -1
  5. package/dist/cli/pr-visual-recap-workflow.d.ts +1 -1
  6. package/dist/cli/pr-visual-recap-workflow.d.ts.map +1 -1
  7. package/dist/cli/pr-visual-recap-workflow.js +1 -1
  8. package/dist/cli/pr-visual-recap-workflow.js.map +1 -1
  9. package/dist/cli/recap.d.ts.map +1 -1
  10. package/dist/cli/recap.js +13 -13
  11. package/dist/cli/recap.js.map +1 -1
  12. package/dist/cli/skills.d.ts +2 -6
  13. package/dist/cli/skills.d.ts.map +1 -1
  14. package/dist/cli/skills.js +21 -79
  15. package/dist/cli/skills.js.map +1 -1
  16. package/dist/client/AssistantChat.d.ts.map +1 -1
  17. package/dist/client/AssistantChat.js +76 -18
  18. package/dist/client/AssistantChat.js.map +1 -1
  19. package/dist/client/blocks/index.d.ts +9 -0
  20. package/dist/client/blocks/index.d.ts.map +1 -1
  21. package/dist/client/blocks/index.js +9 -0
  22. package/dist/client/blocks/index.js.map +1 -1
  23. package/dist/client/blocks/library/AnnotatedCodeBlock.d.ts.map +1 -1
  24. package/dist/client/blocks/library/AnnotatedCodeBlock.js +3 -3
  25. package/dist/client/blocks/library/AnnotatedCodeBlock.js.map +1 -1
  26. package/dist/client/blocks/library/ApiEndpointBlock.d.ts.map +1 -1
  27. package/dist/client/blocks/library/ApiEndpointBlock.js +1 -1
  28. package/dist/client/blocks/library/ApiEndpointBlock.js.map +1 -1
  29. package/dist/client/blocks/library/DiffBlock.d.ts.map +1 -1
  30. package/dist/client/blocks/library/DiffBlock.js +128 -19
  31. package/dist/client/blocks/library/DiffBlock.js.map +1 -1
  32. package/dist/client/blocks/library/FileTreeBlock.d.ts.map +1 -1
  33. package/dist/client/blocks/library/FileTreeBlock.js +31 -4
  34. package/dist/client/blocks/library/FileTreeBlock.js.map +1 -1
  35. package/dist/client/blocks/library/JsonExplorerBlock.js +1 -1
  36. package/dist/client/blocks/library/JsonExplorerBlock.js.map +1 -1
  37. package/dist/client/blocks/library/MermaidBlock.js +1 -1
  38. package/dist/client/blocks/library/MermaidBlock.js.map +1 -1
  39. package/dist/client/blocks/library/callout.config.d.ts +29 -0
  40. package/dist/client/blocks/library/callout.config.d.ts.map +1 -0
  41. package/dist/client/blocks/library/callout.config.js +33 -0
  42. package/dist/client/blocks/library/callout.config.js.map +1 -0
  43. package/dist/client/blocks/library/callout.d.ts +20 -0
  44. package/dist/client/blocks/library/callout.d.ts.map +1 -0
  45. package/dist/client/blocks/library/callout.js +61 -0
  46. package/dist/client/blocks/library/callout.js.map +1 -0
  47. package/dist/client/blocks/library/checklist.d.ts.map +1 -1
  48. package/dist/client/blocks/library/checklist.js +3 -3
  49. package/dist/client/blocks/library/checklist.js.map +1 -1
  50. package/dist/client/blocks/library/code-tabs.js +1 -1
  51. package/dist/client/blocks/library/code-tabs.js.map +1 -1
  52. package/dist/client/blocks/library/diagram.config.d.ts +64 -0
  53. package/dist/client/blocks/library/diagram.config.d.ts.map +1 -0
  54. package/dist/client/blocks/library/diagram.config.js +111 -0
  55. package/dist/client/blocks/library/diagram.config.js.map +1 -0
  56. package/dist/client/blocks/library/diagram.d.ts +16 -0
  57. package/dist/client/blocks/library/diagram.d.ts.map +1 -0
  58. package/dist/client/blocks/library/diagram.js +261 -0
  59. package/dist/client/blocks/library/diagram.js.map +1 -0
  60. package/dist/client/blocks/library/question-form.config.d.ts +69 -0
  61. package/dist/client/blocks/library/question-form.config.d.ts.map +1 -0
  62. package/dist/client/blocks/library/question-form.config.js +58 -0
  63. package/dist/client/blocks/library/question-form.config.js.map +1 -0
  64. package/dist/client/blocks/library/question-form.d.ts +20 -0
  65. package/dist/client/blocks/library/question-form.d.ts.map +1 -0
  66. package/dist/client/blocks/library/question-form.js +286 -0
  67. package/dist/client/blocks/library/question-form.js.map +1 -0
  68. package/dist/client/blocks/library/sanitize-html.d.ts +5 -0
  69. package/dist/client/blocks/library/sanitize-html.d.ts.map +1 -0
  70. package/dist/client/blocks/library/sanitize-html.js +240 -0
  71. package/dist/client/blocks/library/sanitize-html.js.map +1 -0
  72. package/dist/client/blocks/library/server-specs.d.ts.map +1 -1
  73. package/dist/client/blocks/library/server-specs.js +49 -0
  74. package/dist/client/blocks/library/server-specs.js.map +1 -1
  75. package/dist/client/blocks/library/specs.d.ts.map +1 -1
  76. package/dist/client/blocks/library/specs.js +9 -0
  77. package/dist/client/blocks/library/specs.js.map +1 -1
  78. package/dist/client/blocks/library/tabs.d.ts.map +1 -1
  79. package/dist/client/blocks/library/tabs.js +12 -12
  80. package/dist/client/blocks/library/tabs.js.map +1 -1
  81. package/dist/client/blocks/library/wireframe-kit.d.ts +260 -0
  82. package/dist/client/blocks/library/wireframe-kit.d.ts.map +1 -0
  83. package/dist/client/blocks/library/wireframe-kit.js +920 -0
  84. package/dist/client/blocks/library/wireframe-kit.js.map +1 -0
  85. package/dist/client/blocks/library/wireframe.config.d.ts +123 -0
  86. package/dist/client/blocks/library/wireframe.config.d.ts.map +1 -0
  87. package/dist/client/blocks/library/wireframe.config.js +311 -0
  88. package/dist/client/blocks/library/wireframe.config.js.map +1 -0
  89. package/dist/client/blocks/library/wireframe.d.ts +15 -0
  90. package/dist/client/blocks/library/wireframe.d.ts.map +1 -0
  91. package/dist/client/blocks/library/wireframe.js +206 -0
  92. package/dist/client/blocks/library/wireframe.js.map +1 -0
  93. package/dist/client/blocks/mdx.d.ts.map +1 -1
  94. package/dist/client/blocks/mdx.js +11 -0
  95. package/dist/client/blocks/mdx.js.map +1 -1
  96. package/dist/client/blocks/registry.d.ts +9 -0
  97. package/dist/client/blocks/registry.d.ts.map +1 -1
  98. package/dist/client/blocks/registry.js +12 -5
  99. package/dist/client/blocks/registry.js.map +1 -1
  100. package/dist/client/blocks/server.d.ts +1 -0
  101. package/dist/client/blocks/server.d.ts.map +1 -1
  102. package/dist/client/blocks/server.js +1 -0
  103. package/dist/client/blocks/server.js.map +1 -1
  104. package/dist/client/blocks/types.d.ts +8 -0
  105. package/dist/client/blocks/types.d.ts.map +1 -1
  106. package/dist/client/blocks/types.js.map +1 -1
  107. package/dist/client/rich-markdown-editor/DragHandle.d.ts.map +1 -1
  108. package/dist/client/rich-markdown-editor/DragHandle.js +112 -84
  109. package/dist/client/rich-markdown-editor/DragHandle.js.map +1 -1
  110. package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts.map +1 -1
  111. package/dist/client/rich-markdown-editor/RegistryBlockNode.js +1 -1
  112. package/dist/client/rich-markdown-editor/RegistryBlockNode.js.map +1 -1
  113. package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts +9 -1
  114. package/dist/client/rich-markdown-editor/SharedRichEditor.d.ts.map +1 -1
  115. package/dist/client/rich-markdown-editor/SharedRichEditor.js +3 -1
  116. package/dist/client/rich-markdown-editor/SharedRichEditor.js.map +1 -1
  117. package/dist/client/rich-markdown-editor/extensions.d.ts +13 -1
  118. package/dist/client/rich-markdown-editor/extensions.d.ts.map +1 -1
  119. package/dist/client/rich-markdown-editor/extensions.js +4 -2
  120. package/dist/client/rich-markdown-editor/extensions.js.map +1 -1
  121. package/dist/client/rich-markdown-editor/useCollabReconcile.d.ts.map +1 -1
  122. package/dist/client/rich-markdown-editor/useCollabReconcile.js +11 -1
  123. package/dist/client/rich-markdown-editor/useCollabReconcile.js.map +1 -1
  124. package/dist/server/poll.d.ts.map +1 -1
  125. package/dist/server/poll.js +30 -14
  126. package/dist/server/poll.js.map +1 -1
  127. package/dist/styles/agent-native.css +1 -0
  128. package/dist/styles/blocks.css +1388 -0
  129. package/dist/templates/default/.agents/skills/storing-data/SKILL.md +2 -0
  130. package/dist/templates/workspace-core/.agents/skills/performance/SKILL.md +141 -0
  131. package/dist/templates/workspace-core/.agents/skills/storing-data/SKILL.md +2 -0
  132. package/docs/content/plan-plugin.md +8 -8
  133. package/docs/content/pr-visual-recap.md +2 -2
  134. package/docs/content/template-plan.md +94 -17
  135. package/package.json +2 -1
  136. package/src/templates/default/.agents/skills/storing-data/SKILL.md +2 -0
  137. package/src/templates/workspace-core/.agents/skills/performance/SKILL.md +141 -0
  138. package/src/templates/workspace-core/.agents/skills/storing-data/SKILL.md +2 -0
  139. package/docs/content/visual-plans.md +0 -82
@@ -0,0 +1,240 @@
1
+ /*
2
+ * Render-layer sanitizer for model-authored wireframe HTML.
3
+ *
4
+ * The HTML artboard injects model HTML via dangerouslySetInnerHTML into the LIVE
5
+ * page DOM (it can't be iframe-sandboxed because the rough overlay must measure
6
+ * the laid-out elements). The schema's regex guard is necessary but not
7
+ * sufficient — obfuscated schemes (java\tscript:, javascript:) slip past
8
+ * string matching. This neutralizes the html at the render point using the
9
+ * browser's OWN parser/URL normalization, which decodes entities and collapses
10
+ * whitespace, so obfuscation can't survive:
11
+ * - drops dangerous elements (script/style/iframe/object/embed/...);
12
+ * - strips every on* event-handler attribute;
13
+ * - removes url attributes whose RESOLVED scheme isn't safe;
14
+ * - removes inline styles carrying expression()/javascript:/data:text/html.
15
+ * Defense-in-depth: stored content should also be sanitized server-side, but
16
+ * this guarantees the live DOM never carries an executable payload.
17
+ */
18
+ const BLOCKED_TAGS = "script,style,iframe,object,embed,link,meta,base,form,noscript,frame,frameset,applet,marquee,portal";
19
+ const DIAGRAM_BLOCKED_TAGS = `${BLOCKED_TAGS},math,foreignObject,foreignobject`;
20
+ const URL_ATTRS = new Set([
21
+ "href",
22
+ "src",
23
+ "xlink:href",
24
+ "srcdoc",
25
+ "action",
26
+ "formaction",
27
+ "background",
28
+ "poster",
29
+ "data",
30
+ "ping",
31
+ ]);
32
+ const SAFE_SCHEMES = new Set(["http:", "https:", "mailto:", "tel:", "ftp:"]);
33
+ const WHITESPACE = /\s+/g;
34
+ const HAS_SCHEME = /^[a-z][a-z0-9+.-]*:/i;
35
+ const SAFE_DATA_IMAGE = /^data:image\/(png|jpe?g|gif|webp);/i;
36
+ function isSafeUrl(value) {
37
+ // Strip whitespace for scheme detection ONLY (the browser collapses these when
38
+ // resolving too, so obfuscated schemes like "java\tscript:" can't hide). The
39
+ // original attribute is left untouched unless we decide to drop it.
40
+ const v = (value || "").replace(WHITESPACE, "");
41
+ if (v === "" ||
42
+ v.startsWith("#") ||
43
+ v.startsWith("/") ||
44
+ v.startsWith("./") ||
45
+ v.startsWith("../")) {
46
+ return true;
47
+ }
48
+ if (!HAS_SCHEME.test(v))
49
+ return true; // no scheme => relative, safe
50
+ try {
51
+ const a = document.createElement("a");
52
+ a.href = v; // browser decodes the scheme + normalizes
53
+ const proto = a.protocol.toLowerCase();
54
+ // Allow only safe raster data images; block data:image/svg+xml (can script)
55
+ // and data:text/html.
56
+ if (proto === "data:")
57
+ return SAFE_DATA_IMAGE.test(a.href);
58
+ return SAFE_SCHEMES.has(proto);
59
+ }
60
+ catch {
61
+ return false;
62
+ }
63
+ }
64
+ const DANGEROUS_STYLE = /(expression\s*\(|javascript:|vbscript:|url\s*\(\s*['"]?\s*(?:javascript|vbscript|data:text\/html))/i;
65
+ const DANGEROUS_CSS = /(@(?:import|font-face|keyframes|page|namespace|charset)\b|expression\s*\(|javascript:|vbscript:|data:text\/html|data:image\/svg\+xml|<\/?\s*(?:script|style)\b)/i;
66
+ const DANGEROUS_VIEWPORT_CSS = /(?:^|[;{\s])position\s*:\s*(?:fixed|sticky)\b|(?:^|[;{\s])z-index\s*:\s*[1-9]\d{4,}\b/i;
67
+ function decodeCssSafetyEscapes(value) {
68
+ return value.replace(/\\([0-9a-fA-F]{1,6}\s?|.)/g, (_match, escaped) => {
69
+ const hex = String(escaped).match(/^[0-9a-fA-F]{1,6}/)?.[0];
70
+ if (hex) {
71
+ const point = Number.parseInt(hex, 16);
72
+ return Number.isFinite(point) ? String.fromCodePoint(point) : "";
73
+ }
74
+ return String(escaped)[0] ?? "";
75
+ });
76
+ }
77
+ function cssSafetyText(value) {
78
+ return decodeCssSafetyEscapes(value)
79
+ .toLowerCase()
80
+ .replace(/[\u0000-\u0020]+/g, "");
81
+ }
82
+ /** Conservative no-DOM fallback for any non-browser code path (SSR). */
83
+ function fallbackStrip(html) {
84
+ // Drop the whole url attribute if its value (whitespace/control-stripped)
85
+ // carries a dangerous scheme. Mirrors the DOM path for the rare no-DOMParser
86
+ // case; entity-obfuscation isn't decoded here (the live DOM path handles it).
87
+ const stripScheme = (m, dq, sq, uq) => {
88
+ const v = (dq ?? sq ?? uq ?? "").replace(/[\s\u0000-\u001f]+/g, "");
89
+ return /^(?:javascript|vbscript):|^data:text\/html/i.test(v) ? "" : m;
90
+ };
91
+ return html
92
+ .replace(/<\/?(?:script|style|iframe|object|embed|link|meta|base|form|noscript|frame|frameset|applet|marquee|portal)\b[^>]*>/gi, "")
93
+ .replace(/\son[a-z][\w:-]*\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi, "")
94
+ .replace(/\s(?:href|src|xlink:href|action|formaction|poster|background|data|ping)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/gi, stripScheme)
95
+ .replace(/\sstyle\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi, (m) => DANGEROUS_STYLE.test(m) ? "" : m);
96
+ }
97
+ export function sanitizeWireframeHtml(html) {
98
+ if (!html)
99
+ return "";
100
+ if (typeof DOMParser === "undefined" || typeof document === "undefined") {
101
+ return fallbackStrip(html);
102
+ }
103
+ const doc = new DOMParser().parseFromString(html, "text/html");
104
+ doc.querySelectorAll(BLOCKED_TAGS).forEach((el) => el.remove());
105
+ sanitizeElementAttributes(doc.body);
106
+ return doc.body.innerHTML;
107
+ }
108
+ export function sanitizeDiagramHtml(html) {
109
+ if (!html)
110
+ return "";
111
+ if (typeof DOMParser === "undefined" || typeof document === "undefined") {
112
+ return fallbackStrip(html)
113
+ .replace(/<\/?\s*(?:math|foreignObject|foreignobject)\b[^>]*>/gi, "")
114
+ .replace(/\s(?:@[\w:.-]+|x-on:[\w:.-]+|:on[\w:.-]+|x-bind:on[\w:.-]+|:style|x-bind:style)\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/gi, "");
115
+ }
116
+ const doc = new DOMParser().parseFromString(html, "text/html");
117
+ doc.querySelectorAll(DIAGRAM_BLOCKED_TAGS).forEach((el) => el.remove());
118
+ sanitizeElementAttributes(doc.body, { stripRuntimeDirectives: true });
119
+ return doc.body.innerHTML;
120
+ }
121
+ export function sanitizeWireframeCss(css) {
122
+ if (!css)
123
+ return "";
124
+ return css
125
+ .split("\n")
126
+ .filter((line) => {
127
+ const decoded = decodeCssSafetyEscapes(line);
128
+ const compact = cssSafetyText(line);
129
+ return !(DANGEROUS_CSS.test(line) ||
130
+ DANGEROUS_CSS.test(decoded) ||
131
+ DANGEROUS_VIEWPORT_CSS.test(decoded) ||
132
+ /(?:javascript|vbscript):|data:(?:text\/html|image\/svg\+xml)|expression\(|url\(['"]?(?:javascript|vbscript|data:(?:text\/html|image\/svg\+xml))/.test(compact));
133
+ })
134
+ .join("\n")
135
+ .replace(/\bjava\s*script\s*:/gi, "")
136
+ .replace(/\bvb\s*script\s*:/gi, "")
137
+ .replace(/\bdata\s*:\s*(?:text\/html|image\/svg\+xml)/gi, "");
138
+ }
139
+ export function scopeDesignCss(css, scopeSelector) {
140
+ if (!css.trim())
141
+ return "";
142
+ return css.replace(/(^|[{}])\s*([^@{}][^{}]*)\{/g, (_match, boundary, selectors) => {
143
+ const scoped = splitSelectorList(selectors)
144
+ .map((selector) => selector.trim())
145
+ .filter(Boolean)
146
+ .map((selector) => {
147
+ if (selector.startsWith(scopeSelector))
148
+ return selector;
149
+ if (selector === ":root" ||
150
+ selector === "html" ||
151
+ selector === "body")
152
+ return scopeSelector;
153
+ return `${scopeSelector} ${selector}`;
154
+ })
155
+ .join(", ");
156
+ return `${boundary} ${scoped} {`;
157
+ });
158
+ }
159
+ function splitSelectorList(selectors) {
160
+ const parts = [];
161
+ let current = "";
162
+ let parenDepth = 0;
163
+ let bracketDepth = 0;
164
+ let quote = null;
165
+ let escaped = false;
166
+ for (const char of selectors) {
167
+ current += char;
168
+ if (escaped) {
169
+ escaped = false;
170
+ continue;
171
+ }
172
+ if (char === "\\") {
173
+ escaped = true;
174
+ continue;
175
+ }
176
+ if (quote) {
177
+ if (char === quote)
178
+ quote = null;
179
+ continue;
180
+ }
181
+ if (char === '"' || char === "'") {
182
+ quote = char;
183
+ continue;
184
+ }
185
+ if (char === "[") {
186
+ bracketDepth += 1;
187
+ continue;
188
+ }
189
+ if (char === "]") {
190
+ bracketDepth = Math.max(0, bracketDepth - 1);
191
+ continue;
192
+ }
193
+ if (char === "(") {
194
+ parenDepth += 1;
195
+ continue;
196
+ }
197
+ if (char === ")") {
198
+ parenDepth = Math.max(0, parenDepth - 1);
199
+ continue;
200
+ }
201
+ if (char === "," && parenDepth === 0 && bracketDepth === 0) {
202
+ parts.push(current.slice(0, -1));
203
+ current = "";
204
+ }
205
+ }
206
+ parts.push(current);
207
+ return parts;
208
+ }
209
+ function sanitizeElementAttributes(root, options) {
210
+ root.querySelectorAll("*").forEach((el) => {
211
+ for (const attr of Array.from(el.attributes)) {
212
+ const name = attr.name.toLowerCase();
213
+ if (name.startsWith("on")) {
214
+ el.removeAttribute(attr.name);
215
+ continue;
216
+ }
217
+ if (options?.stripRuntimeDirectives &&
218
+ (name.startsWith("@") ||
219
+ name.startsWith("x-on:") ||
220
+ name.startsWith(":on") ||
221
+ name.startsWith("x-bind:on") ||
222
+ name === ":style" ||
223
+ name === "x-bind:style")) {
224
+ el.removeAttribute(attr.name);
225
+ continue;
226
+ }
227
+ if (URL_ATTRS.has(name) && !isSafeUrl(attr.value)) {
228
+ el.removeAttribute(attr.name);
229
+ continue;
230
+ }
231
+ if (name === "style" && DANGEROUS_STYLE.test(attr.value)) {
232
+ el.removeAttribute(attr.name);
233
+ }
234
+ }
235
+ if (el instanceof HTMLTemplateElement) {
236
+ sanitizeElementAttributes(el.content, options);
237
+ }
238
+ });
239
+ }
240
+ //# sourceMappingURL=sanitize-html.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sanitize-html.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/sanitize-html.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,YAAY,GAChB,oGAAoG,CAAC;AACvG,MAAM,oBAAoB,GAAG,GAAG,YAAY,mCAAmC,CAAC;AAEhF,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC;IACxB,MAAM;IACN,KAAK;IACL,YAAY;IACZ,QAAQ;IACR,QAAQ;IACR,YAAY;IACZ,YAAY;IACZ,QAAQ;IACR,MAAM;IACN,MAAM;CACP,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAE7E,MAAM,UAAU,GAAG,MAAM,CAAC;AAC1B,MAAM,UAAU,GAAG,sBAAsB,CAAC;AAC1C,MAAM,eAAe,GAAG,qCAAqC,CAAC;AAE9D,SAAS,SAAS,CAAC,KAAa;IAC9B,+EAA+E;IAC/E,6EAA6E;IAC7E,oEAAoE;IACpE,MAAM,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAChD,IACE,CAAC,KAAK,EAAE;QACR,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC;QACjB,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC;QACjB,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC;QAClB,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,EACnB,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC,CAAC,8BAA8B;IACpE,IAAI,CAAC;QACH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gBACzD,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;QACD,IAAI,EAAE,YAAY,mBAAmB,EAAE,CAAC;YACtC,yBAAyB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACjD,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/*\n * Render-layer sanitizer for model-authored wireframe HTML.\n *\n * The HTML artboard injects model HTML via dangerouslySetInnerHTML into the LIVE\n * page DOM (it can't be iframe-sandboxed because the rough overlay must measure\n * the laid-out elements). The schema's regex guard is necessary but not\n * sufficient — obfuscated schemes (java\\tscript:, &#106;avascript:) slip past\n * string matching. This neutralizes the html at the render point using the\n * browser's OWN parser/URL normalization, which decodes entities and collapses\n * whitespace, so obfuscation can't survive:\n * - drops dangerous elements (script/style/iframe/object/embed/...);\n * - strips every on* event-handler attribute;\n * - removes url attributes whose RESOLVED scheme isn't safe;\n * - removes inline styles carrying expression()/javascript:/data:text/html.\n * Defense-in-depth: stored content should also be sanitized server-side, but\n * this guarantees the live DOM never carries an executable payload.\n */\n\nconst BLOCKED_TAGS =\n \"script,style,iframe,object,embed,link,meta,base,form,noscript,frame,frameset,applet,marquee,portal\";\nconst DIAGRAM_BLOCKED_TAGS = `${BLOCKED_TAGS},math,foreignObject,foreignobject`;\n\nconst URL_ATTRS = new Set([\n \"href\",\n \"src\",\n \"xlink:href\",\n \"srcdoc\",\n \"action\",\n \"formaction\",\n \"background\",\n \"poster\",\n \"data\",\n \"ping\",\n]);\n\nconst SAFE_SCHEMES = new Set([\"http:\", \"https:\", \"mailto:\", \"tel:\", \"ftp:\"]);\n\nconst WHITESPACE = /\\s+/g;\nconst HAS_SCHEME = /^[a-z][a-z0-9+.-]*:/i;\nconst SAFE_DATA_IMAGE = /^data:image\\/(png|jpe?g|gif|webp);/i;\n\nfunction isSafeUrl(value: string): boolean {\n // Strip whitespace for scheme detection ONLY (the browser collapses these when\n // resolving too, so obfuscated schemes like \"java\\tscript:\" can't hide). The\n // original attribute is left untouched unless we decide to drop it.\n const v = (value || \"\").replace(WHITESPACE, \"\");\n if (\n v === \"\" ||\n v.startsWith(\"#\") ||\n v.startsWith(\"/\") ||\n v.startsWith(\"./\") ||\n v.startsWith(\"../\")\n ) {\n return true;\n }\n if (!HAS_SCHEME.test(v)) return true; // no scheme => relative, safe\n try {\n const a = document.createElement(\"a\");\n a.href = v; // browser decodes the scheme + normalizes\n const proto = a.protocol.toLowerCase();\n // Allow only safe raster data images; block data:image/svg+xml (can script)\n // and data:text/html.\n if (proto === \"data:\") return SAFE_DATA_IMAGE.test(a.href);\n return SAFE_SCHEMES.has(proto);\n } catch {\n return false;\n }\n}\n\nconst DANGEROUS_STYLE =\n /(expression\\s*\\(|javascript:|vbscript:|url\\s*\\(\\s*['\"]?\\s*(?:javascript|vbscript|data:text\\/html))/i;\nconst DANGEROUS_CSS =\n /(@(?:import|font-face|keyframes|page|namespace|charset)\\b|expression\\s*\\(|javascript:|vbscript:|data:text\\/html|data:image\\/svg\\+xml|<\\/?\\s*(?:script|style)\\b)/i;\nconst DANGEROUS_VIEWPORT_CSS =\n /(?:^|[;{\\s])position\\s*:\\s*(?:fixed|sticky)\\b|(?:^|[;{\\s])z-index\\s*:\\s*[1-9]\\d{4,}\\b/i;\n\nfunction decodeCssSafetyEscapes(value: string): string {\n return value.replace(/\\\\([0-9a-fA-F]{1,6}\\s?|.)/g, (_match, escaped) => {\n const hex = String(escaped).match(/^[0-9a-fA-F]{1,6}/)?.[0];\n if (hex) {\n const point = Number.parseInt(hex, 16);\n return Number.isFinite(point) ? String.fromCodePoint(point) : \"\";\n }\n return String(escaped)[0] ?? \"\";\n });\n}\n\nfunction cssSafetyText(value: string): string {\n return decodeCssSafetyEscapes(value)\n .toLowerCase()\n .replace(/[\\u0000-\\u0020]+/g, \"\");\n}\n\n/** Conservative no-DOM fallback for any non-browser code path (SSR). */\nfunction fallbackStrip(html: string): string {\n // Drop the whole url attribute if its value (whitespace/control-stripped)\n // carries a dangerous scheme. Mirrors the DOM path for the rare no-DOMParser\n // case; entity-obfuscation isn't decoded here (the live DOM path handles it).\n const stripScheme = (m: string, dq?: string, sq?: string, uq?: string) => {\n const v = (dq ?? sq ?? uq ?? \"\").replace(/[\\s\\u0000-\\u001f]+/g, \"\");\n return /^(?:javascript|vbscript):|^data:text\\/html/i.test(v) ? \"\" : m;\n };\n return html\n .replace(\n /<\\/?(?:script|style|iframe|object|embed|link|meta|base|form|noscript|frame|frameset|applet|marquee|portal)\\b[^>]*>/gi,\n \"\",\n )\n .replace(/\\son[a-z][\\w:-]*\\s*=\\s*(\"[^\"]*\"|'[^']*'|[^\\s>]+)/gi, \"\")\n .replace(\n /\\s(?:href|src|xlink:href|action|formaction|poster|background|data|ping)\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\s>]+))/gi,\n stripScheme,\n )\n .replace(/\\sstyle\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s>]+)/gi, (m) =>\n DANGEROUS_STYLE.test(m) ? \"\" : m,\n );\n}\n\nexport function sanitizeWireframeHtml(html: string | undefined): string {\n if (!html) return \"\";\n if (typeof DOMParser === \"undefined\" || typeof document === \"undefined\") {\n return fallbackStrip(html);\n }\n const doc = new DOMParser().parseFromString(html, \"text/html\");\n doc.querySelectorAll(BLOCKED_TAGS).forEach((el) => el.remove());\n sanitizeElementAttributes(doc.body);\n return doc.body.innerHTML;\n}\n\nexport function sanitizeDiagramHtml(html: string | undefined): string {\n if (!html) return \"\";\n if (typeof DOMParser === \"undefined\" || typeof document === \"undefined\") {\n return fallbackStrip(html)\n .replace(/<\\/?\\s*(?:math|foreignObject|foreignobject)\\b[^>]*>/gi, \"\")\n .replace(\n /\\s(?:@[\\w:.-]+|x-on:[\\w:.-]+|:on[\\w:.-]+|x-bind:on[\\w:.-]+|:style|x-bind:style)\\s*=\\s*(\"[^\"]*\"|'[^']*'|[^\\s>]+)/gi,\n \"\",\n );\n }\n const doc = new DOMParser().parseFromString(html, \"text/html\");\n doc.querySelectorAll(DIAGRAM_BLOCKED_TAGS).forEach((el) => el.remove());\n sanitizeElementAttributes(doc.body, { stripRuntimeDirectives: true });\n return doc.body.innerHTML;\n}\n\nexport function sanitizeWireframeCss(css: string | undefined): string {\n if (!css) return \"\";\n return css\n .split(\"\\n\")\n .filter((line) => {\n const decoded = decodeCssSafetyEscapes(line);\n const compact = cssSafetyText(line);\n return !(\n DANGEROUS_CSS.test(line) ||\n DANGEROUS_CSS.test(decoded) ||\n DANGEROUS_VIEWPORT_CSS.test(decoded) ||\n /(?:javascript|vbscript):|data:(?:text\\/html|image\\/svg\\+xml)|expression\\(|url\\(['\"]?(?:javascript|vbscript|data:(?:text\\/html|image\\/svg\\+xml))/.test(\n compact,\n )\n );\n })\n .join(\"\\n\")\n .replace(/\\bjava\\s*script\\s*:/gi, \"\")\n .replace(/\\bvb\\s*script\\s*:/gi, \"\")\n .replace(/\\bdata\\s*:\\s*(?:text\\/html|image\\/svg\\+xml)/gi, \"\");\n}\n\nexport function scopeDesignCss(css: string, scopeSelector: string): string {\n if (!css.trim()) return \"\";\n return css.replace(\n /(^|[{}])\\s*([^@{}][^{}]*)\\{/g,\n (_match, boundary: string, selectors: string) => {\n const scoped = splitSelectorList(selectors)\n .map((selector) => selector.trim())\n .filter(Boolean)\n .map((selector) => {\n if (selector.startsWith(scopeSelector)) return selector;\n if (\n selector === \":root\" ||\n selector === \"html\" ||\n selector === \"body\"\n )\n return scopeSelector;\n return `${scopeSelector} ${selector}`;\n })\n .join(\", \");\n return `${boundary} ${scoped} {`;\n },\n );\n}\n\nfunction splitSelectorList(selectors: string): string[] {\n const parts: string[] = [];\n let current = \"\";\n let parenDepth = 0;\n let bracketDepth = 0;\n let quote: '\"' | \"'\" | null = null;\n let escaped = false;\n\n for (const char of selectors) {\n current += char;\n if (escaped) {\n escaped = false;\n continue;\n }\n if (char === \"\\\\\") {\n escaped = true;\n continue;\n }\n if (quote) {\n if (char === quote) quote = null;\n continue;\n }\n if (char === '\"' || char === \"'\") {\n quote = char;\n continue;\n }\n if (char === \"[\") {\n bracketDepth += 1;\n continue;\n }\n if (char === \"]\") {\n bracketDepth = Math.max(0, bracketDepth - 1);\n continue;\n }\n if (char === \"(\") {\n parenDepth += 1;\n continue;\n }\n if (char === \")\") {\n parenDepth = Math.max(0, parenDepth - 1);\n continue;\n }\n if (char === \",\" && parenDepth === 0 && bracketDepth === 0) {\n parts.push(current.slice(0, -1));\n current = \"\";\n }\n }\n\n parts.push(current);\n return parts;\n}\n\nfunction sanitizeElementAttributes(\n root: ParentNode,\n options?: { stripRuntimeDirectives?: boolean },\n) {\n root.querySelectorAll<HTMLElement>(\"*\").forEach((el) => {\n for (const attr of Array.from(el.attributes)) {\n const name = attr.name.toLowerCase();\n if (name.startsWith(\"on\")) {\n el.removeAttribute(attr.name);\n continue;\n }\n if (\n options?.stripRuntimeDirectives &&\n (name.startsWith(\"@\") ||\n name.startsWith(\"x-on:\") ||\n name.startsWith(\":on\") ||\n name.startsWith(\"x-bind:on\") ||\n name === \":style\" ||\n name === \"x-bind:style\")\n ) {\n el.removeAttribute(attr.name);\n continue;\n }\n if (URL_ATTRS.has(name) && !isSafeUrl(attr.value)) {\n el.removeAttribute(attr.name);\n continue;\n }\n if (name === \"style\" && DANGEROUS_STYLE.test(attr.value)) {\n el.removeAttribute(attr.name);\n }\n }\n if (el instanceof HTMLTemplateElement) {\n sanitizeElementAttributes(el.content, options);\n }\n });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"server-specs.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/server-specs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAgEpE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,CAAC,GAAG,CAAC,EA0J/C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG,MAAM,CAC9C,MAAM,EACN,OAAO,CACL,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,kBAAkB,CAAC,CAC5E,CACF,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,aAAa,EACvB,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,2BAA2B,CAAA;CAAO,GACxD,IAAI,CAON"}
1
+ {"version":3,"file":"server-specs.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/server-specs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAuFpE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,CAAC,GAAG,CAAC,EA4M/C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG,MAAM,CAC9C,MAAM,EACN,OAAO,CACL,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,kBAAkB,CAAC,CAC5E,CACF,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,aAAa,EACvB,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,2BAA2B,CAAA;CAAO,GACxD,IAAI,CAON"}
@@ -10,6 +10,10 @@ import { codeTabsSchema, codeTabsMdx, } from "./code-tabs.config.js";
10
10
  import { htmlSchema, htmlMdx } from "./html.config.js";
11
11
  import { tabsSchema, tabsMdx } from "./tabs.config.js";
12
12
  import { columnsSchema, columnsMdx, } from "./columns.config.js";
13
+ import { calloutSchema, calloutMdx, } from "./callout.config.js";
14
+ import { questionFormSchema, questionFormMdx, visualQuestionsSchema, visualQuestionsMdx, } from "./question-form.config.js";
15
+ import { diagramSchema, diagramMdx, } from "./diagram.config.js";
16
+ import { wireframeSchema, wireframeMdx, } from "./wireframe.config.js";
13
17
  import { mermaidSchema, mermaidMdx, } from "./mermaid.config.js";
14
18
  import { apiEndpointSchema, apiEndpointMdx, } from "./api-endpoint.config.js";
15
19
  import { openApiSpecSchema, openApiSpecMdx, } from "./openapi-spec.config.js";
@@ -101,6 +105,51 @@ export const libraryBlockConfigs = [
101
105
  label: "Columns",
102
106
  description: "A multi-column side-by-side layout container; each column holds its own list of blocks. Ideal for before/after or current/target comparisons.",
103
107
  }),
108
+ defineBlock({
109
+ type: "callout",
110
+ schema: calloutSchema,
111
+ mdx: calloutMdx,
112
+ Read: ServerReadStub,
113
+ placement: ["block"],
114
+ label: "Callout",
115
+ description: "An emphasized note with a tone (info/decision/risk/warning/success) and a markdown body.",
116
+ }),
117
+ defineBlock({
118
+ type: "question-form",
119
+ schema: questionFormSchema,
120
+ mdx: questionFormMdx,
121
+ Read: ServerReadStub,
122
+ placement: ["block"],
123
+ label: "Question form",
124
+ description: "An interactive respondent-facing form block for open questions, single-choice or multi-choice option rows, freeform answers, recommended options, and optional wireframe/diagram previews.",
125
+ }),
126
+ defineBlock({
127
+ type: "visual-questions",
128
+ schema: visualQuestionsSchema,
129
+ mdx: visualQuestionsMdx,
130
+ Read: ServerReadStub,
131
+ placement: ["block"],
132
+ label: "Visual questions",
133
+ description: "A visual-intake question block with the same editable question/option shape as question-form.",
134
+ }),
135
+ defineBlock({
136
+ type: "diagram",
137
+ schema: diagramSchema,
138
+ mdx: diagramMdx,
139
+ Read: ServerReadStub,
140
+ placement: ["block"],
141
+ label: "Diagram",
142
+ description: "A flexible inline architecture/code diagram. Prefer html/css with SVG or semantic HTML for polished two-dimensional layouts; use .diagram-* primitives and --wf-* tokens for theme/sketch compatibility. Legacy nodes/edges are only for simple previews.",
143
+ }),
144
+ defineBlock({
145
+ type: "wireframe",
146
+ schema: wireframeSchema,
147
+ mdx: wireframeMdx,
148
+ Read: ServerReadStub,
149
+ placement: ["block"],
150
+ label: "Wireframe",
151
+ description: "A sketch wireframe of one screen built from kit primitives (or an HTML mockup), rendered in a chosen surface frame (desktop/mobile/popover/panel/browser).",
152
+ }),
104
153
  defineBlock({
105
154
  type: "mermaid",
106
155
  schema: mermaidSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"server-specs.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/server-specs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAsB,MAAM,gBAAgB,CAAC;AAEpE,8EAA8E;AAC9E,iFAAiF;AACjF,iFAAiF;AACjF,OAAO,EACL,eAAe,EACf,YAAY,GAEb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAkB,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,OAAO,EAAiB,MAAM,kBAAkB,CAAC;AACtE,OAAO,EACL,cAAc,EACd,WAAW,GAEZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,OAAO,EAAsB,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,OAAO,EAAiB,MAAM,kBAAkB,CAAC;AACtE,OAAO,EACL,aAAa,EACb,UAAU,GAEX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,aAAa,EACb,UAAU,GAEX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,iBAAiB,EACjB,cAAc,GAEf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,iBAAiB,EACjB,cAAc,GAEf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,eAAe,EACf,YAAY,GAEb,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAiB,MAAM,kBAAkB,CAAC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UAAuD,EAAE;IAEzD,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;IAC1C,MAAM,KAAK,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC7C,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,OAAO,QAAQ,CAAC,CAAC,CAAE,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,EAAqB,CAAC,CAAC,CAAC,IAAI,CAAC;IACxE,CAAC,CAAC,CAAC;IACH,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAClC,CAAC","sourcesContent":["import { defineBlock, type BlockSpec } from \"../types.js\";\nimport { registerBlocks, type BlockRegistry } from \"../registry.js\";\n\n// React-free schema + MDX config for the standard library. The matching React\n// `Read`/`Edit` live in the full client entry; the server path only ever touches\n// `spec.schema` / `spec.mdx`, so these configs register with a render-only stub.\nimport {\n checklistSchema,\n checklistMdx,\n type ChecklistData,\n} from \"./checklist.config.js\";\nimport { tableSchema, tableMdx, type TableData } from \"./table.config.js\";\nimport { codeSchema, codeMdx, type CodeData } from \"./code.config.js\";\nimport {\n codeTabsSchema,\n codeTabsMdx,\n type CodeTabsData,\n} from \"./code-tabs.config.js\";\nimport { htmlSchema, htmlMdx, type HtmlBlockData } from \"./html.config.js\";\nimport { tabsSchema, tabsMdx, type TabsData } from \"./tabs.config.js\";\nimport {\n columnsSchema,\n columnsMdx,\n type ColumnsData,\n} from \"./columns.config.js\";\nimport {\n mermaidSchema,\n mermaidMdx,\n type MermaidData,\n} from \"./mermaid.config.js\";\nimport {\n apiEndpointSchema,\n apiEndpointMdx,\n type ApiEndpointData,\n} from \"./api-endpoint.config.js\";\nimport {\n openApiSpecSchema,\n openApiSpecMdx,\n type OpenApiSpecData,\n} from \"./openapi-spec.config.js\";\nimport {\n dataModelSchema,\n dataModelMdx,\n type DataModelData,\n} from \"./data-model.config.js\";\nimport { diffSchema, diffMdx, type DiffData } from \"./diff.config.js\";\nimport {\n fileTreeSchema,\n fileTreeMdx,\n type FileTreeData,\n} from \"./file-tree.config.js\";\nimport {\n jsonExplorerSchema,\n jsonExplorerMdx,\n type JsonExplorerData,\n} from \"./json-explorer.config.js\";\nimport {\n annotatedCodeSchema,\n annotatedCodeMdx,\n type AnnotatedCodeData,\n} from \"./annotated-code.config.js\";\n\n/** Render-only stub for server / agent registries (never invoked off-browser). */\nconst ServerReadStub = () => null;\n\n/**\n * Canonical React-free specs for the standard library, used by BOTH apps' server\n * / shared registries (`plan-block-registry.ts`, `nfm-registry.ts`). Each carries\n * only the parts the server path touches — `schema` + `mdx` + metadata for the\n * agent schema export — with a render-only `Read` stub. The full client specs\n * (with real React `Read`/`Edit`) live in `./specs.tsx`; both share the identical\n * `schema`/`mdx` config so inline source can never drift from what renders.\n *\n * `table` keeps the core default `type` here; content's server registry renames\n * it to `table-block` via {@link LibraryBlockConfigOverrides}. The descriptions\n * are the neutral agent-schema phrasing; an app that curates a longer\n * description for a block (e.g. plan's hand-drawn Mermaid, plan's detailed file\n * tree) passes an override rather than re-authoring the spec.\n */\nexport const libraryBlockConfigs: BlockSpec<any>[] = [\n defineBlock<ChecklistData>({\n type: \"checklist\",\n schema: checklistSchema,\n mdx: checklistMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n notionCompatible: true,\n label: \"Checklist\",\n description:\n \"A list of toggleable items, each with a label and an optional note.\",\n }),\n defineBlock<TableData>({\n type: \"table\",\n schema: tableSchema,\n mdx: tableMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n notionCompatible: true,\n label: \"Table\",\n description:\n \"A simple grid with header columns and string rows for comparisons, parameters, or structured lists.\",\n }),\n defineBlock<CodeData>({\n type: \"code\",\n schema: codeSchema,\n mdx: codeMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n notionCompatible: true,\n label: \"Code\",\n description:\n \"A single syntax-highlighted code snippet (Notion-style: one border, hover language switcher + copy, collapse-to-N lines). Put several in a `tabs` block for a file rail.\",\n }),\n defineBlock<CodeTabsData>({\n type: \"code-tabs\",\n schema: codeTabsSchema,\n mdx: codeTabsMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Code tabs\",\n description:\n \"A vertical file tab rail of syntax-highlighted code snippets, one tab per file with an optional language and caption.\",\n }),\n defineBlock<HtmlBlockData>({\n type: \"custom-html\",\n schema: htmlSchema,\n mdx: htmlMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"HTML / Tailwind\",\n description:\n \"An author-supplied HTML (with optional CSS) fragment rendered in a sandboxed iframe, with inline source editing.\",\n }),\n defineBlock<TabsData>({\n type: \"tabs\",\n schema: tabsSchema,\n mdx: tabsMdx,\n Read: ServerReadStub,\n placement: [\"block\", \"inline\"],\n label: \"Tabs\",\n description:\n \"A top or side tab container; each tab holds its own list of blocks.\",\n }),\n defineBlock<ColumnsData>({\n type: \"columns\",\n schema: columnsSchema,\n mdx: columnsMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Columns\",\n description:\n \"A multi-column side-by-side layout container; each column holds its own list of blocks. Ideal for before/after or current/target comparisons.\",\n }),\n defineBlock<MermaidData>({\n type: \"mermaid\",\n schema: mermaidSchema,\n mdx: mermaidMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Diagram (Mermaid)\",\n description:\n \"A Mermaid diagram (flowchart, sequence, etc.) defined as text and rendered as a diagram.\",\n }),\n defineBlock<ApiEndpointData>({\n type: \"api-endpoint\",\n schema: apiEndpointSchema,\n mdx: apiEndpointMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"API endpoint\",\n description:\n \"A Swagger-style API endpoint reference: a colored method pill + path, collapsed by default, expanding to params, request body, and per-status response examples.\",\n }),\n defineBlock<OpenApiSpecData>({\n type: \"openapi-spec\",\n schema: openApiSpecSchema,\n mdx: openApiSpecMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"OpenAPI spec\",\n description:\n \"A whole-document API specification / Redoc / Swagger-UI-style API reference rendered from a complete OpenAPI 3 / Swagger 2 spec (JSON).\",\n }),\n defineBlock<DataModelData>({\n type: \"data-model\",\n schema: dataModelSchema,\n mdx: dataModelMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Data model\",\n description:\n \"A schema modeling / ERD / dbdiagram-style data model: entity cards with typed fields (PK/FK/nullable flags) and interactive foreign-key relations.\",\n }),\n defineBlock<DiffData>({\n type: \"diff\",\n schema: diffSchema,\n mdx: diffMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Diff\",\n description:\n \"A GitHub-style before/after line diff for a file, with unified or split view and added/removed line highlighting.\",\n }),\n defineBlock<FileTreeData>({\n type: \"file-tree\",\n schema: fileTreeSchema,\n mdx: fileTreeMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"File tree\",\n description:\n \"A VS Code / GitHub-explorer file and change tree with per-file change badges, notes, and code snippets.\",\n }),\n defineBlock<JsonExplorerData>({\n type: \"json-explorer\",\n schema: jsonExplorerSchema,\n mdx: jsonExplorerMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"JSON explorer\",\n description:\n \"A collapsible browser-devtools / Postman-style JSON tree with type-colored values and expand/collapse.\",\n }),\n defineBlock<AnnotatedCodeData>({\n type: \"annotated-code\",\n schema: annotatedCodeSchema,\n mdx: annotatedCodeMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Annotated code\",\n description:\n \"A line-numbered code walkthrough whose line ranges carry anchored explanatory notes.\",\n }),\n];\n\n/**\n * Per-block overrides for {@link registerLibraryBlockConfigs}, keyed by canonical\n * `type`. Servers tweak only the agent-facing fields that legitimately differ:\n * content re-types `table` → `table-block`; plan curates a longer Mermaid and\n * file-tree description. The `schema` / `mdx` config always stays shared.\n */\nexport type LibraryBlockConfigOverrides = Record<\n string,\n Partial<\n Pick<BlockSpec<any>, \"type\" | \"label\" | \"description\" | \"notionCompatible\">\n >\n>;\n\n/**\n * Register the React-free standard-library config stubs into a server / shared\n * {@link BlockRegistry}. Both `plan-block-registry.ts` and `nfm-registry.ts` call\n * this, then register only their app-specific block configs (plan adds callout /\n * diagram / wireframe / question-form) on top — so the shared library lives in\n * exactly one place across browser AND server registries.\n */\nexport function registerLibraryBlockConfigs(\n registry: BlockRegistry,\n options: { overrides?: LibraryBlockConfigOverrides } = {},\n): void {\n const overrides = options.overrides ?? {};\n const specs = libraryBlockConfigs.map((spec) => {\n const override = overrides[spec.type];\n return override ? ({ ...spec, ...override } as BlockSpec<any>) : spec;\n });\n registerBlocks(registry, specs);\n}\n"]}
1
+ {"version":3,"file":"server-specs.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/server-specs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAsB,MAAM,gBAAgB,CAAC;AAEpE,8EAA8E;AAC9E,iFAAiF;AACjF,iFAAiF;AACjF,OAAO,EACL,eAAe,EACf,YAAY,GAEb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAkB,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,OAAO,EAAiB,MAAM,kBAAkB,CAAC;AACtE,OAAO,EACL,cAAc,EACd,WAAW,GAEZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,OAAO,EAAsB,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,OAAO,EAAiB,MAAM,kBAAkB,CAAC;AACtE,OAAO,EACL,aAAa,EACb,UAAU,GAEX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,aAAa,EACb,UAAU,GAEX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,kBAAkB,GAGnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,aAAa,EACb,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B,MAAM,EAAE,mBAAmB;QAC3B,GAAG,EAAE,gBAAgB;QACrB,IAAI,EAAE,cAAc;QACpB,SAAS,EAAE,CAAC,OAAO,CAAC;QACpB,KAAK,EAAE,gBAAgB;QACvB,WAAW,EACT,sFAAsF;KACzF,CAAC;CACH,CAAC;AAeF;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CACzC,QAAuB,EACvB,UAAuD,EAAE;IAEzD,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;IAC1C,MAAM,KAAK,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC7C,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,OAAO,QAAQ,CAAC,CAAC,CAAE,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,EAAqB,CAAC,CAAC,CAAC,IAAI,CAAC;IACxE,CAAC,CAAC,CAAC;IACH,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAClC,CAAC","sourcesContent":["import { defineBlock, type BlockSpec } from \"../types.js\";\nimport { registerBlocks, type BlockRegistry } from \"../registry.js\";\n\n// React-free schema + MDX config for the standard library. The matching React\n// `Read`/`Edit` live in the full client entry; the server path only ever touches\n// `spec.schema` / `spec.mdx`, so these configs register with a render-only stub.\nimport {\n checklistSchema,\n checklistMdx,\n type ChecklistData,\n} from \"./checklist.config.js\";\nimport { tableSchema, tableMdx, type TableData } from \"./table.config.js\";\nimport { codeSchema, codeMdx, type CodeData } from \"./code.config.js\";\nimport {\n codeTabsSchema,\n codeTabsMdx,\n type CodeTabsData,\n} from \"./code-tabs.config.js\";\nimport { htmlSchema, htmlMdx, type HtmlBlockData } from \"./html.config.js\";\nimport { tabsSchema, tabsMdx, type TabsData } from \"./tabs.config.js\";\nimport {\n columnsSchema,\n columnsMdx,\n type ColumnsData,\n} from \"./columns.config.js\";\nimport {\n calloutSchema,\n calloutMdx,\n type CalloutData,\n} from \"./callout.config.js\";\nimport {\n questionFormSchema,\n questionFormMdx,\n visualQuestionsSchema,\n visualQuestionsMdx,\n type QuestionFormData,\n type VisualQuestionsData,\n} from \"./question-form.config.js\";\nimport {\n diagramSchema,\n diagramMdx,\n type DiagramData,\n} from \"./diagram.config.js\";\nimport {\n wireframeSchema,\n wireframeMdx,\n type WireframeData,\n} from \"./wireframe.config.js\";\nimport {\n mermaidSchema,\n mermaidMdx,\n type MermaidData,\n} from \"./mermaid.config.js\";\nimport {\n apiEndpointSchema,\n apiEndpointMdx,\n type ApiEndpointData,\n} from \"./api-endpoint.config.js\";\nimport {\n openApiSpecSchema,\n openApiSpecMdx,\n type OpenApiSpecData,\n} from \"./openapi-spec.config.js\";\nimport {\n dataModelSchema,\n dataModelMdx,\n type DataModelData,\n} from \"./data-model.config.js\";\nimport { diffSchema, diffMdx, type DiffData } from \"./diff.config.js\";\nimport {\n fileTreeSchema,\n fileTreeMdx,\n type FileTreeData,\n} from \"./file-tree.config.js\";\nimport {\n jsonExplorerSchema,\n jsonExplorerMdx,\n type JsonExplorerData,\n} from \"./json-explorer.config.js\";\nimport {\n annotatedCodeSchema,\n annotatedCodeMdx,\n type AnnotatedCodeData,\n} from \"./annotated-code.config.js\";\n\n/** Render-only stub for server / agent registries (never invoked off-browser). */\nconst ServerReadStub = () => null;\n\n/**\n * Canonical React-free specs for the standard library, used by BOTH apps' server\n * / shared registries (`plan-block-registry.ts`, `nfm-registry.ts`). Each carries\n * only the parts the server path touches — `schema` + `mdx` + metadata for the\n * agent schema export — with a render-only `Read` stub. The full client specs\n * (with real React `Read`/`Edit`) live in `./specs.tsx`; both share the identical\n * `schema`/`mdx` config so inline source can never drift from what renders.\n *\n * `table` keeps the core default `type` here; content's server registry renames\n * it to `table-block` via {@link LibraryBlockConfigOverrides}. The descriptions\n * are the neutral agent-schema phrasing; an app that curates a longer\n * description for a block (e.g. plan's hand-drawn Mermaid, plan's detailed file\n * tree) passes an override rather than re-authoring the spec.\n */\nexport const libraryBlockConfigs: BlockSpec<any>[] = [\n defineBlock<ChecklistData>({\n type: \"checklist\",\n schema: checklistSchema,\n mdx: checklistMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n notionCompatible: true,\n label: \"Checklist\",\n description:\n \"A list of toggleable items, each with a label and an optional note.\",\n }),\n defineBlock<TableData>({\n type: \"table\",\n schema: tableSchema,\n mdx: tableMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n notionCompatible: true,\n label: \"Table\",\n description:\n \"A simple grid with header columns and string rows for comparisons, parameters, or structured lists.\",\n }),\n defineBlock<CodeData>({\n type: \"code\",\n schema: codeSchema,\n mdx: codeMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n notionCompatible: true,\n label: \"Code\",\n description:\n \"A single syntax-highlighted code snippet (Notion-style: one border, hover language switcher + copy, collapse-to-N lines). Put several in a `tabs` block for a file rail.\",\n }),\n defineBlock<CodeTabsData>({\n type: \"code-tabs\",\n schema: codeTabsSchema,\n mdx: codeTabsMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Code tabs\",\n description:\n \"A vertical file tab rail of syntax-highlighted code snippets, one tab per file with an optional language and caption.\",\n }),\n defineBlock<HtmlBlockData>({\n type: \"custom-html\",\n schema: htmlSchema,\n mdx: htmlMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"HTML / Tailwind\",\n description:\n \"An author-supplied HTML (with optional CSS) fragment rendered in a sandboxed iframe, with inline source editing.\",\n }),\n defineBlock<TabsData>({\n type: \"tabs\",\n schema: tabsSchema,\n mdx: tabsMdx,\n Read: ServerReadStub,\n placement: [\"block\", \"inline\"],\n label: \"Tabs\",\n description:\n \"A top or side tab container; each tab holds its own list of blocks.\",\n }),\n defineBlock<ColumnsData>({\n type: \"columns\",\n schema: columnsSchema,\n mdx: columnsMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Columns\",\n description:\n \"A multi-column side-by-side layout container; each column holds its own list of blocks. Ideal for before/after or current/target comparisons.\",\n }),\n defineBlock<CalloutData>({\n type: \"callout\",\n schema: calloutSchema,\n mdx: calloutMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Callout\",\n description:\n \"An emphasized note with a tone (info/decision/risk/warning/success) and a markdown body.\",\n }),\n defineBlock<QuestionFormData>({\n type: \"question-form\",\n schema: questionFormSchema,\n mdx: questionFormMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Question form\",\n description:\n \"An interactive respondent-facing form block for open questions, single-choice or multi-choice option rows, freeform answers, recommended options, and optional wireframe/diagram previews.\",\n }),\n defineBlock<VisualQuestionsData>({\n type: \"visual-questions\",\n schema: visualQuestionsSchema,\n mdx: visualQuestionsMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Visual questions\",\n description:\n \"A visual-intake question block with the same editable question/option shape as question-form.\",\n }),\n defineBlock<DiagramData>({\n type: \"diagram\",\n schema: diagramSchema,\n mdx: diagramMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Diagram\",\n description:\n \"A flexible inline architecture/code diagram. Prefer html/css with SVG or semantic HTML for polished two-dimensional layouts; use .diagram-* primitives and --wf-* tokens for theme/sketch compatibility. Legacy nodes/edges are only for simple previews.\",\n }),\n defineBlock<WireframeData>({\n type: \"wireframe\",\n schema: wireframeSchema,\n mdx: wireframeMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Wireframe\",\n description:\n \"A sketch wireframe of one screen built from kit primitives (or an HTML mockup), rendered in a chosen surface frame (desktop/mobile/popover/panel/browser).\",\n }),\n defineBlock<MermaidData>({\n type: \"mermaid\",\n schema: mermaidSchema,\n mdx: mermaidMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Diagram (Mermaid)\",\n description:\n \"A Mermaid diagram (flowchart, sequence, etc.) defined as text and rendered as a diagram.\",\n }),\n defineBlock<ApiEndpointData>({\n type: \"api-endpoint\",\n schema: apiEndpointSchema,\n mdx: apiEndpointMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"API endpoint\",\n description:\n \"A Swagger-style API endpoint reference: a colored method pill + path, collapsed by default, expanding to params, request body, and per-status response examples.\",\n }),\n defineBlock<OpenApiSpecData>({\n type: \"openapi-spec\",\n schema: openApiSpecSchema,\n mdx: openApiSpecMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"OpenAPI spec\",\n description:\n \"A whole-document API specification / Redoc / Swagger-UI-style API reference rendered from a complete OpenAPI 3 / Swagger 2 spec (JSON).\",\n }),\n defineBlock<DataModelData>({\n type: \"data-model\",\n schema: dataModelSchema,\n mdx: dataModelMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Data model\",\n description:\n \"A schema modeling / ERD / dbdiagram-style data model: entity cards with typed fields (PK/FK/nullable flags) and interactive foreign-key relations.\",\n }),\n defineBlock<DiffData>({\n type: \"diff\",\n schema: diffSchema,\n mdx: diffMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Diff\",\n description:\n \"A GitHub-style before/after line diff for a file, with unified or split view and added/removed line highlighting.\",\n }),\n defineBlock<FileTreeData>({\n type: \"file-tree\",\n schema: fileTreeSchema,\n mdx: fileTreeMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"File tree\",\n description:\n \"A VS Code / GitHub-explorer file and change tree with per-file change badges, notes, and code snippets.\",\n }),\n defineBlock<JsonExplorerData>({\n type: \"json-explorer\",\n schema: jsonExplorerSchema,\n mdx: jsonExplorerMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"JSON explorer\",\n description:\n \"A collapsible browser-devtools / Postman-style JSON tree with type-colored values and expand/collapse.\",\n }),\n defineBlock<AnnotatedCodeData>({\n type: \"annotated-code\",\n schema: annotatedCodeSchema,\n mdx: annotatedCodeMdx,\n Read: ServerReadStub,\n placement: [\"block\"],\n label: \"Annotated code\",\n description:\n \"A line-numbered code walkthrough whose line ranges carry anchored explanatory notes.\",\n }),\n];\n\n/**\n * Per-block overrides for {@link registerLibraryBlockConfigs}, keyed by canonical\n * `type`. Servers tweak only the agent-facing fields that legitimately differ:\n * content re-types `table` → `table-block`; plan curates a longer Mermaid and\n * file-tree description. The `schema` / `mdx` config always stays shared.\n */\nexport type LibraryBlockConfigOverrides = Record<\n string,\n Partial<\n Pick<BlockSpec<any>, \"type\" | \"label\" | \"description\" | \"notionCompatible\">\n >\n>;\n\n/**\n * Register the React-free standard-library config stubs into a server / shared\n * {@link BlockRegistry}. Both `plan-block-registry.ts` and `nfm-registry.ts` call\n * this, then register only their app-specific block configs (plan adds callout /\n * diagram / wireframe / question-form) on top — so the shared library lives in\n * exactly one place across browser AND server registries.\n */\nexport function registerLibraryBlockConfigs(\n registry: BlockRegistry,\n options: { overrides?: LibraryBlockConfigOverrides } = {},\n): void {\n const overrides = options.overrides ?? {};\n const specs = libraryBlockConfigs.map((spec) => {\n const override = overrides[spec.type];\n return override ? ({ ...spec, ...override } as BlockSpec<any>) : spec;\n });\n registerBlocks(registry, specs);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"specs.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/specs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AA4PpE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,CAAC,GAAG,CAAC,EAS7C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,CACxC,MAAM,EACN,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,OAAO,CAAC,CAAC,CAC1E,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,aAAa,EACvB,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,qBAAqB,CAAA;CAAO,GAClD,IAAI,CAON"}
1
+ {"version":3,"file":"specs.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/specs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAgQpE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,CAAC,GAAG,CAAC,EAc7C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,CACxC,MAAM,EACN,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,OAAO,CAAC,CAAC,CAC1E,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,aAAa,EACvB,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,qBAAqB,CAAA;CAAO,GAClD,IAAI,CAON"}
@@ -8,6 +8,10 @@ import { codeTabsBlock } from "./code-tabs.js";
8
8
  import { htmlBlock } from "./html.js";
9
9
  import { tabsBlock } from "./tabs.js";
10
10
  import { columnsBlock } from "./columns.js";
11
+ import { calloutBlock } from "./callout.js";
12
+ import { questionFormBlock, visualQuestionsBlock } from "./question-form.js";
13
+ import { diagramBlock } from "./diagram.js";
14
+ import { wireframeBlock } from "./wireframe.js";
11
15
  // Dev-doc blocks: React-free schema + MDX config paired with the shared React
12
16
  // Read/Edit renderers. Composed into full specs below with canonical metadata.
13
17
  import { mermaidSchema, mermaidMdx, } from "./mermaid.config.js";
@@ -215,6 +219,11 @@ export const libraryBlockSpecs = [
215
219
  htmlBlock,
216
220
  tabsBlock,
217
221
  columnsBlock,
222
+ calloutBlock,
223
+ questionFormBlock,
224
+ visualQuestionsBlock,
225
+ diagramBlock,
226
+ wireframeBlock,
218
227
  ...devDocBlockSpecs,
219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,CAAC,CAAC,IAAI,EAAE,EAAE;QAC3C,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,OAAO,QAAQ,CAAC,CAAC,CAAE,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,EAAqB,CAAC,CAAC,CAAC,IAAI,CAAC;IACxE,CAAC,CAAC,CAAC;IACH,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAClC,CAAC","sourcesContent":["import { defineBlock, type BlockSpec } from \"../types.js\";\nimport { registerBlocks, type BlockRegistry } from \"../registry.js\";\n\n// Pre-built standard library specs (schema + mdx + React Read/Edit all bundled).\nimport { checklistBlock } from \"./checklist.js\";\nimport { tableBlock } from \"./table.js\";\nimport { codeBlock } from \"./code.js\";\nimport { codeTabsBlock } from \"./code-tabs.js\";\nimport { htmlBlock } from \"./html.js\";\nimport { tabsBlock } from \"./tabs.js\";\nimport { columnsBlock } from \"./columns.js\";\n\n// Dev-doc blocks: React-free schema + MDX config paired with the shared React\n// Read/Edit renderers. Composed into full specs below with canonical metadata.\nimport {\n mermaidSchema,\n mermaidMdx,\n type MermaidData,\n} from \"./mermaid.config.js\";\nimport { MermaidRead, MermaidEdit } from \"./MermaidBlock.js\";\nimport {\n apiEndpointSchema,\n apiEndpointMdx,\n type ApiEndpointData,\n} from \"./api-endpoint.config.js\";\nimport { ApiEndpointRead, ApiEndpointEdit } from \"./ApiEndpointBlock.js\";\nimport {\n openApiSpecSchema,\n openApiSpecMdx,\n type OpenApiSpecData,\n} from \"./openapi-spec.config.js\";\nimport { OpenApiSpecRead, OpenApiSpecEdit } from \"./OpenApiSpecBlock.js\";\nimport {\n dataModelSchema,\n dataModelMdx,\n type DataModelData,\n} from \"./data-model.config.js\";\nimport { DataModelRead, DataModelEdit } from \"./DataModelBlock.js\";\nimport { diffSchema, diffMdx, type DiffData } from \"./diff.config.js\";\nimport { DiffRead, DiffEdit } from \"./DiffBlock.js\";\nimport {\n fileTreeSchema,\n fileTreeMdx,\n type FileTreeData,\n} from \"./file-tree.config.js\";\nimport { FileTreeRead, FileTreeEdit } from \"./FileTreeBlock.js\";\nimport {\n jsonExplorerSchema,\n jsonExplorerMdx,\n JSON_EXPLORER_DEFAULT_COLLAPSED_DEPTH,\n type JsonExplorerData,\n} from \"./json-explorer.config.js\";\nimport { JsonExplorerRead, JsonExplorerEdit } from \"./JsonExplorerBlock.js\";\nimport {\n annotatedCodeSchema,\n annotatedCodeMdx,\n type AnnotatedCodeData,\n} from \"./annotated-code.config.js\";\nimport { AnnotatedCodeRead, AnnotatedCodeEdit } from \"./AnnotatedCodeBlock.js\";\n\n/**\n * Canonical specs for the standard library's dev-doc blocks (Mermaid, API\n * endpoint, OpenAPI spec, data model, diff, file tree, JSON explorer,\n * annotated code).\n * Each pairs the shared React-free schema/MDX config\n * with the shared React `Read`/`Edit` renderers and the canonical\n * label/description/editSurface/empty metadata. Apps that need a slightly\n * different label/description/empty for a block pass an override to\n * {@link registerLibraryBlocks} rather than re-authoring the whole spec.\n *\n * The six fully pre-built standard specs (checklist, table, code-tabs, html,\n * tabs, columns) already bundle their metadata in their own modules, so they are appended\n * by {@link libraryBlockSpecs} rather than re-declared here.\n */\n// Typed `BlockSpec<any>[]` (not `BlockSpec<unknown>[]`) so the per-block generic\n// data types coexist in one array — mirroring `registerBlocks`' own signature,\n// where `childrenField: keyof TData` would otherwise collapse to `never`.\nconst devDocBlockSpecs: BlockSpec<any>[] = [\n defineBlock<MermaidData>({\n type: \"mermaid\",\n schema: mermaidSchema,\n mdx: mermaidMdx,\n Read: MermaidRead,\n Edit: MermaidEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"Diagram (Mermaid)\",\n description:\n \"A Mermaid diagram (flowchart, sequence, etc.) defined as text and rendered as a diagram.\",\n empty: () => ({\n source:\n \"flowchart TD\\n A[Start] --> B{Decision}\\n B -->|Yes| C[Do it]\\n B -->|No| D[Skip]\",\n }),\n }),\n defineBlock<ApiEndpointData>({\n type: \"api-endpoint\",\n schema: apiEndpointSchema,\n mdx: apiEndpointMdx,\n Read: ApiEndpointRead,\n Edit: ApiEndpointEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"API endpoint\",\n description:\n \"A Swagger-style API endpoint reference: a colored method pill + path, collapsed by default, expanding to params, request body, and per-status response examples.\",\n empty: () => ({ method: \"GET\", path: \"/api/resource\" }),\n }),\n defineBlock<OpenApiSpecData>({\n type: \"openapi-spec\",\n schema: openApiSpecSchema,\n mdx: openApiSpecMdx,\n Read: OpenApiSpecRead,\n Edit: OpenApiSpecEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"OpenAPI spec\",\n description:\n \"A whole-document API specification / Redoc / Swagger-UI-style API reference rendered from a complete OpenAPI 3 / Swagger 2 spec (JSON): operations grouped by tag, each a collapsible row expanding to params, request body, and per-status responses, with $ref models resolved.\",\n empty: () => ({\n spec: JSON.stringify(\n {\n openapi: \"3.0.0\",\n info: { title: \"Example API\", version: \"1.0.0\" },\n tags: [{ name: \"widgets\", description: \"Manage widgets\" }],\n paths: {\n \"/widgets\": {\n get: {\n tags: [\"widgets\"],\n summary: \"List widgets\",\n responses: { \"200\": { description: \"OK\" } },\n },\n },\n },\n },\n null,\n 2,\n ),\n }),\n }),\n defineBlock<DataModelData>({\n type: \"data-model\",\n schema: dataModelSchema,\n mdx: dataModelMdx,\n Read: DataModelRead,\n Edit: DataModelEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"Data model\",\n description:\n \"A schema modeling / ERD / dbdiagram-style data model: entity cards with typed fields (PK/FK/nullable flags) and interactive foreign-key relations.\",\n empty: () => ({\n entities: [\n {\n id: \"e_user\",\n name: \"User\",\n fields: [\n { name: \"id\", type: \"uuid\", pk: true },\n { name: \"email\", type: \"text\" },\n ],\n },\n ],\n }),\n }),\n defineBlock<DiffData>({\n type: \"diff\",\n schema: diffSchema,\n mdx: diffMdx,\n Read: DiffRead,\n Edit: DiffEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"Diff\",\n description:\n \"A GitHub-style before/after line diff for a file, with unified or split (side-by-side) view, added/removed line highlighting, and collapsible unchanged runs.\",\n empty: () => ({\n before: \"function add(a, b) {\\n return a + b;\\n}\",\n after: \"function add(a: number, b: number): number {\\n return a + b;\\n}\",\n language: \"ts\",\n }),\n }),\n defineBlock<FileTreeData>({\n type: \"file-tree\",\n schema: fileTreeSchema,\n mdx: fileTreeMdx,\n Read: FileTreeRead,\n Edit: FileTreeEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"File tree\",\n description:\n \"A VS Code / GitHub-explorer file and change tree derived from slash-delimited paths, with per-file change badges (added/modified/removed/renamed), notes, and code snippets.\",\n empty: () => ({\n entries: [\n {\n path: \"src/index.ts\",\n change: \"modified\",\n note: \"Wire the new route here.\",\n },\n { path: \"src/routes/git.ts\", change: \"added\" },\n ],\n }),\n }),\n defineBlock<JsonExplorerData>({\n type: \"json-explorer\",\n schema: jsonExplorerSchema,\n mdx: jsonExplorerMdx,\n Read: JsonExplorerRead,\n Edit: JsonExplorerEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"JSON explorer\",\n description:\n \"A collapsible browser-devtools / Postman-style JSON tree with type-colored values and expand/collapse.\",\n empty: () => ({\n json: JSON.stringify(\n {\n id: \"abc123\",\n active: true,\n tags: [\"alpha\", \"beta\"],\n meta: { count: 2, owner: null },\n },\n null,\n 2,\n ),\n collapsedDepth: JSON_EXPLORER_DEFAULT_COLLAPSED_DEPTH,\n }),\n }),\n defineBlock<AnnotatedCodeData>({\n type: \"annotated-code\",\n schema: annotatedCodeSchema,\n mdx: annotatedCodeMdx,\n Read: AnnotatedCodeRead,\n Edit: AnnotatedCodeEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"Annotated code\",\n description:\n \"A line-numbered code walkthrough whose line ranges carry anchored explanatory notes (Stripe-docs / Sourcegraph explain-this-code style).\",\n empty: () => ({\n filename: \"src/server/auth.ts\",\n language: \"ts\",\n code: \"export function resolveAuth(provider: string) {\\n const cfg = providers[provider];\\n return cfg.token;\\n}\",\n annotations: [\n {\n lines: \"2\",\n label: \"Lookup\",\n note: \"Resolves the provider config by key.\",\n },\n ],\n }),\n }),\n];\n\n/**\n * The full standard library spec set, in registration order: the fully pre-built\n * specs (checklist, table, code-tabs, html, tabs, columns) followed by the eight\n * dev-doc specs. This is the single list both the plan and content browser\n * registries register — adding a library block here lands in both apps.\n */\nexport const libraryBlockSpecs: BlockSpec<any>[] = [\n checklistBlock,\n tableBlock,\n codeBlock,\n codeTabsBlock,\n htmlBlock,\n tabsBlock,\n columnsBlock,\n ...devDocBlockSpecs,\n];\n\n/**\n * Per-block metadata overrides for {@link registerLibraryBlocks}, keyed by the\n * canonical block `type`. Lets an app tweak the few fields that legitimately\n * differ (a `type` rename, a tweaked `description` or `empty` seed) without\n * re-authoring the spec. Anything omitted keeps the canonical value, so the\n * schema / MDX config and the React `Read`/`Edit` renderers always stay shared.\n */\nexport type LibraryBlockOverrides = Record<\n string,\n Partial<Pick<BlockSpec<any>, \"type\" | \"label\" | \"description\" | \"empty\">>\n>;\n\n/**\n * Register the standard library block specs into a {@link BlockRegistry}. Both\n * the plan and content browser registries call this, then register only their\n * own app-specific blocks on top — so the shared library lives in exactly one\n * place. Pass `overrides` (keyed by canonical `type`) for the small per-app\n * differences (content re-types `table` → `table-block`; each app phrases the\n * Mermaid description and seeds the OpenAPI example a little differently).\n */\nexport function registerLibraryBlocks(\n registry: BlockRegistry,\n options: { overrides?: LibraryBlockOverrides } = {},\n): void {\n const overrides = options.overrides ?? {};\n const specs = libraryBlockSpecs.map((spec) => {\n const override = overrides[spec.type];\n return override ? ({ ...spec, ...override } as BlockSpec<any>) : spec;\n });\n registerBlocks(registry, specs);\n}\n"]}
1
+ {"version":3,"file":"specs.js","sourceRoot":"","sources":["../../../../src/client/blocks/library/specs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,aAAa,C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uB,EACvB,UAAiD,EAAE;IAEnD,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;IAC1C,MAAM,KAAK,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC3C,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtC,OAAO,QAAQ,CAAC,CAAC,CAAE,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,EAAqB,CAAC,CAAC,CAAC,IAAI,CAAC;IACxE,CAAC,CAAC,CAAC;IACH,cAAc,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAClC,CAAC","sourcesContent":["import { defineBlock, type BlockSpec } from \"../types.js\";\nimport { registerBlocks, type BlockRegistry } from \"../registry.js\";\n\n// Pre-built standard library specs (schema + mdx + React Read/Edit all bundled).\nimport { checklistBlock } from \"./checklist.js\";\nimport { tableBlock } from \"./table.js\";\nimport { codeBlock } from \"./code.js\";\nimport { codeTabsBlock } from \"./code-tabs.js\";\nimport { htmlBlock } from \"./html.js\";\nimport { tabsBlock } from \"./tabs.js\";\nimport { columnsBlock } from \"./columns.js\";\nimport { calloutBlock } from \"./callout.js\";\nimport { questionFormBlock, visualQuestionsBlock } from \"./question-form.js\";\nimport { diagramBlock } from \"./diagram.js\";\nimport { wireframeBlock } from \"./wireframe.js\";\n\n// Dev-doc blocks: React-free schema + MDX config paired with the shared React\n// Read/Edit renderers. Composed into full specs below with canonical metadata.\nimport {\n mermaidSchema,\n mermaidMdx,\n type MermaidData,\n} from \"./mermaid.config.js\";\nimport { MermaidRead, MermaidEdit } from \"./MermaidBlock.js\";\nimport {\n apiEndpointSchema,\n apiEndpointMdx,\n type ApiEndpointData,\n} from \"./api-endpoint.config.js\";\nimport { ApiEndpointRead, ApiEndpointEdit } from \"./ApiEndpointBlock.js\";\nimport {\n openApiSpecSchema,\n openApiSpecMdx,\n type OpenApiSpecData,\n} from \"./openapi-spec.config.js\";\nimport { OpenApiSpecRead, OpenApiSpecEdit } from \"./OpenApiSpecBlock.js\";\nimport {\n dataModelSchema,\n dataModelMdx,\n type DataModelData,\n} from \"./data-model.config.js\";\nimport { DataModelRead, DataModelEdit } from \"./DataModelBlock.js\";\nimport { diffSchema, diffMdx, type DiffData } from \"./diff.config.js\";\nimport { DiffRead, DiffEdit } from \"./DiffBlock.js\";\nimport {\n fileTreeSchema,\n fileTreeMdx,\n type FileTreeData,\n} from \"./file-tree.config.js\";\nimport { FileTreeRead, FileTreeEdit } from \"./FileTreeBlock.js\";\nimport {\n jsonExplorerSchema,\n jsonExplorerMdx,\n JSON_EXPLORER_DEFAULT_COLLAPSED_DEPTH,\n type JsonExplorerData,\n} from \"./json-explorer.config.js\";\nimport { JsonExplorerRead, JsonExplorerEdit } from \"./JsonExplorerBlock.js\";\nimport {\n annotatedCodeSchema,\n annotatedCodeMdx,\n type AnnotatedCodeData,\n} from \"./annotated-code.config.js\";\nimport { AnnotatedCodeRead, AnnotatedCodeEdit } from \"./AnnotatedCodeBlock.js\";\n\n/**\n * Canonical specs for the standard library's dev-doc blocks (Mermaid, API\n * endpoint, OpenAPI spec, data model, diff, file tree, JSON explorer,\n * annotated code).\n * Each pairs the shared React-free schema/MDX config\n * with the shared React `Read`/`Edit` renderers and the canonical\n * label/description/editSurface/empty metadata. Apps that need a slightly\n * different label/description/empty for a block pass an override to\n * {@link registerLibraryBlocks} rather than re-authoring the whole spec.\n *\n * The six fully pre-built standard specs (checklist, table, code-tabs, html,\n * tabs, columns) already bundle their metadata in their own modules, so they are appended\n * by {@link libraryBlockSpecs} rather than re-declared here.\n */\n// Typed `BlockSpec<any>[]` (not `BlockSpec<unknown>[]`) so the per-block generic\n// data types coexist in one array — mirroring `registerBlocks`' own signature,\n// where `childrenField: keyof TData` would otherwise collapse to `never`.\nconst devDocBlockSpecs: BlockSpec<any>[] = [\n defineBlock<MermaidData>({\n type: \"mermaid\",\n schema: mermaidSchema,\n mdx: mermaidMdx,\n Read: MermaidRead,\n Edit: MermaidEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"Diagram (Mermaid)\",\n description:\n \"A Mermaid diagram (flowchart, sequence, etc.) defined as text and rendered as a diagram.\",\n empty: () => ({\n source:\n \"flowchart TD\\n A[Start] --> B{Decision}\\n B -->|Yes| C[Do it]\\n B -->|No| D[Skip]\",\n }),\n }),\n defineBlock<ApiEndpointData>({\n type: \"api-endpoint\",\n schema: apiEndpointSchema,\n mdx: apiEndpointMdx,\n Read: ApiEndpointRead,\n Edit: ApiEndpointEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"API endpoint\",\n description:\n \"A Swagger-style API endpoint reference: a colored method pill + path, collapsed by default, expanding to params, request body, and per-status response examples.\",\n empty: () => ({ method: \"GET\", path: \"/api/resource\" }),\n }),\n defineBlock<OpenApiSpecData>({\n type: \"openapi-spec\",\n schema: openApiSpecSchema,\n mdx: openApiSpecMdx,\n Read: OpenApiSpecRead,\n Edit: OpenApiSpecEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"OpenAPI spec\",\n description:\n \"A whole-document API specification / Redoc / Swagger-UI-style API reference rendered from a complete OpenAPI 3 / Swagger 2 spec (JSON): operations grouped by tag, each a collapsible row expanding to params, request body, and per-status responses, with $ref models resolved.\",\n empty: () => ({\n spec: JSON.stringify(\n {\n openapi: \"3.0.0\",\n info: { title: \"Example API\", version: \"1.0.0\" },\n tags: [{ name: \"widgets\", description: \"Manage widgets\" }],\n paths: {\n \"/widgets\": {\n get: {\n tags: [\"widgets\"],\n summary: \"List widgets\",\n responses: { \"200\": { description: \"OK\" } },\n },\n },\n },\n },\n null,\n 2,\n ),\n }),\n }),\n defineBlock<DataModelData>({\n type: \"data-model\",\n schema: dataModelSchema,\n mdx: dataModelMdx,\n Read: DataModelRead,\n Edit: DataModelEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"Data model\",\n description:\n \"A schema modeling / ERD / dbdiagram-style data model: entity cards with typed fields (PK/FK/nullable flags) and interactive foreign-key relations.\",\n empty: () => ({\n entities: [\n {\n id: \"e_user\",\n name: \"User\",\n fields: [\n { name: \"id\", type: \"uuid\", pk: true },\n { name: \"email\", type: \"text\" },\n ],\n },\n ],\n }),\n }),\n defineBlock<DiffData>({\n type: \"diff\",\n schema: diffSchema,\n mdx: diffMdx,\n Read: DiffRead,\n Edit: DiffEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"Diff\",\n description:\n \"A GitHub-style before/after line diff for a file, with unified or split (side-by-side) view, added/removed line highlighting, and collapsible unchanged runs.\",\n empty: () => ({\n before: \"function add(a, b) {\\n return a + b;\\n}\",\n after: \"function add(a: number, b: number): number {\\n return a + b;\\n}\",\n language: \"ts\",\n }),\n }),\n defineBlock<FileTreeData>({\n type: \"file-tree\",\n schema: fileTreeSchema,\n mdx: fileTreeMdx,\n Read: FileTreeRead,\n Edit: FileTreeEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"File tree\",\n description:\n \"A VS Code / GitHub-explorer file and change tree derived from slash-delimited paths, with per-file change badges (added/modified/removed/renamed), notes, and code snippets.\",\n empty: () => ({\n entries: [\n {\n path: \"src/index.ts\",\n change: \"modified\",\n note: \"Wire the new route here.\",\n },\n { path: \"src/routes/git.ts\", change: \"added\" },\n ],\n }),\n }),\n defineBlock<JsonExplorerData>({\n type: \"json-explorer\",\n schema: jsonExplorerSchema,\n mdx: jsonExplorerMdx,\n Read: JsonExplorerRead,\n Edit: JsonExplorerEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"JSON explorer\",\n description:\n \"A collapsible browser-devtools / Postman-style JSON tree with type-colored values and expand/collapse.\",\n empty: () => ({\n json: JSON.stringify(\n {\n id: \"abc123\",\n active: true,\n tags: [\"alpha\", \"beta\"],\n meta: { count: 2, owner: null },\n },\n null,\n 2,\n ),\n collapsedDepth: JSON_EXPLORER_DEFAULT_COLLAPSED_DEPTH,\n }),\n }),\n defineBlock<AnnotatedCodeData>({\n type: \"annotated-code\",\n schema: annotatedCodeSchema,\n mdx: annotatedCodeMdx,\n Read: AnnotatedCodeRead,\n Edit: AnnotatedCodeEdit,\n placement: [\"block\"],\n editSurface: \"panel\",\n label: \"Annotated code\",\n description:\n \"A line-numbered code walkthrough whose line ranges carry anchored explanatory notes (Stripe-docs / Sourcegraph explain-this-code style).\",\n empty: () => ({\n filename: \"src/server/auth.ts\",\n language: \"ts\",\n code: \"export function resolveAuth(provider: string) {\\n const cfg = providers[provider];\\n return cfg.token;\\n}\",\n annotations: [\n {\n lines: \"2\",\n label: \"Lookup\",\n note: \"Resolves the provider config by key.\",\n },\n ],\n }),\n }),\n];\n\n/**\n * The full standard library spec set, in registration order: the fully pre-built\n * specs (checklist, table, code-tabs, html, tabs, columns) followed by the eight\n * dev-doc specs. This is the single list both the plan and content browser\n * registries register — adding a library block here lands in both apps.\n */\nexport const libraryBlockSpecs: BlockSpec<any>[] = [\n checklistBlock,\n tableBlock,\n codeBlock,\n codeTabsBlock,\n htmlBlock,\n tabsBlock,\n columnsBlock,\n calloutBlock,\n questionFormBlock,\n visualQuestionsBlock,\n diagramBlock,\n wireframeBlock,\n ...devDocBlockSpecs,\n];\n\n/**\n * Per-block metadata overrides for {@link registerLibraryBlocks}, keyed by the\n * canonical block `type`. Lets an app tweak the few fields that legitimately\n * differ (a `type` rename, a tweaked `description` or `empty` seed) without\n * re-authoring the spec. Anything omitted keeps the canonical value, so the\n * schema / MDX config and the React `Read`/`Edit` renderers always stay shared.\n */\nexport type LibraryBlockOverrides = Record<\n string,\n Partial<Pick<BlockSpec<any>, \"type\" | \"label\" | \"description\" | \"empty\">>\n>;\n\n/**\n * Register the standard library block specs into a {@link BlockRegistry}. Both\n * the plan and content browser registries call this, then register only their\n * own app-specific blocks on top — so the shared library lives in exactly one\n * place. Pass `overrides` (keyed by canonical `type`) for the small per-app\n * differences (content re-types `table` → `table-block`; each app phrases the\n * Mermaid description and seeds the OpenAPI example a little differently).\n */\nexport function registerLibraryBlocks(\n registry: BlockRegistry,\n options: { overrides?: LibraryBlockOverrides } = {},\n): void {\n const overrides = options.overrides ?? {};\n const specs = libraryBlockSpecs.map((spec) => {\n const override = overrides[spec.type];\n return override ? ({ ...spec, ...override } as BlockSpec<any>) : spec;\n });\n registerBlocks(registry, specs);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/tabs.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAEV,cAAc,EACd,cAAc,EAEf,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,KAAK,QAAQ,EAGd,MAAM,kBAAkB,CAAC;AAuG1B,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,OAAO,EACP,KAAK,EACL,GAAG,GACJ,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAqC1B;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,KAAK,EACL,GAAG,GACJ,EAAE,cAAc,CAAC,QAAQ,CAAC,2CA6L1B;AAuLD;;;;;GAKG;AACH,eAAO,MAAM,SAAS,2CA0BpB,CAAC"}
1
+ {"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../../src/client/blocks/library/tabs.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAEV,cAAc,EACd,cAAc,EAEf,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,KAAK,QAAQ,EAGd,MAAM,kBAAkB,CAAC;AAuG1B,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,OAAO,EACP,KAAK,EACL,GAAG,GACJ,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAuC1B;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,KAAK,EACL,GAAG,GACJ,EAAE,cAAc,CAAC,QAAQ,CAAC,2CAgM1B;AAuLD;;;;;GAKG;AACH,eAAO,MAAM,SAAS,2CA0BpB,CAAC"}
@@ -39,7 +39,7 @@ function tabsWith(data, tabs) {
39
39
  }
40
40
  function tabButtonClass(selected, orientation) {
41
41
  return cn("rounded-lg border border-transparent text-sm font-semibold transition-colors", orientation === "vertical"
42
- ? "min-w-0 max-w-72 shrink-0 px-3 py-2 text-left md:w-full md:max-w-none"
42
+ ? "min-w-0 max-w-72 shrink-0 px-3 py-2 text-left @xl/tabs:w-full @xl/tabs:max-w-none"
43
43
  : "shrink-0 whitespace-nowrap px-4 py-2", selected
44
44
  ? "bg-primary/5 text-foreground dark:bg-primary/10"
45
45
  : "text-muted-foreground hover:bg-muted/40 hover:text-foreground");
@@ -51,7 +51,7 @@ function tabLabelClass(orientation) {
51
51
  function TabRail({ tabs, activeId, onSelect, orientation, }) {
52
52
  const vertical = orientation === "vertical";
53
53
  return (_jsx("div", { className: cn(vertical
54
- ? "mb-5 flex w-full min-w-0 max-w-full flex-nowrap gap-1 overflow-x-auto md:mb-0 md:max-h-[62vh] md:flex-col md:overflow-x-hidden md:overflow-y-auto md:pr-2"
54
+ ? "mb-5 flex w-full min-w-0 max-w-full flex-nowrap gap-1 overflow-x-auto @xl/tabs:mb-0 @xl/tabs:max-h-[62vh] @xl/tabs:flex-col @xl/tabs:overflow-x-hidden @xl/tabs:overflow-y-auto @xl/tabs:pr-2"
55
55
  : "mb-8 flex w-full min-w-0 max-w-full flex-nowrap gap-1 overflow-x-auto"), role: "tablist", "aria-orientation": orientation, "data-plan-interactive": true, children: tabs.map((tab) => {
56
56
  const selected = tab.id === activeId;
57
57
  return (_jsx("button", { type: "button", role: "tab", "aria-selected": selected, onClick: () => onSelect(tab.id), className: tabButtonClass(selected, orientation), children: _jsx("span", { className: tabLabelClass(orientation), children: tab.label }) }, tab.id));
@@ -64,12 +64,12 @@ export function TabsBlockReader({ data, blockId, title, ctx, }) {
64
64
  const compact = isCompact(title);
65
65
  const orientation = tabOrientation(data);
66
66
  const vertical = orientation === "vertical";
67
- return (_jsxs("section", { className: "plan-block", "data-block-id": blockId, children: [title && _jsx("div", { className: "plan-block-label", children: title }), _jsxs("div", { className: cn(vertical &&
68
- "grid min-w-0 gap-5 md:grid-cols-[minmax(10rem,14rem)_minmax(0,1fr)] md:items-start"), children: [_jsx(TabRail, { tabs: data.tabs, activeId: active?.id, onSelect: setActiveId, orientation: orientation }), active && (_jsx("div", { className: cn(vertical && "min-w-0"), children: active.blocks.map((child) => (_jsx("div", { children: ctx.renderBlock?.({
69
- block: child,
70
- editing: false,
71
- compactVisuals: compact,
72
- }) }, child.id))) }))] })] }));
67
+ return (_jsxs("section", { className: "plan-block", "data-block-id": blockId, children: [title && _jsx("div", { className: "plan-block-label", children: title }), _jsx("div", { className: cn(vertical && "@container/tabs"), children: _jsxs("div", { className: cn(vertical &&
68
+ "grid min-w-0 gap-5 @xl/tabs:grid-cols-[minmax(10rem,14rem)_minmax(0,1fr)] @xl/tabs:items-start"), children: [_jsx(TabRail, { tabs: data.tabs, activeId: active?.id, onSelect: setActiveId, orientation: orientation }), active && (_jsx("div", { className: cn(vertical && "min-w-0"), children: active.blocks.map((child) => (_jsx("div", { children: ctx.renderBlock?.({
69
+ block: child,
70
+ editing: false,
71
+ compactVisuals: compact,
72
+ }) }, child.id))) }))] }) })] }));
73
73
  }
74
74
  /**
75
75
  * Editor: pill tabs plus tab management (add/remove/rename), with child blocks
@@ -119,9 +119,9 @@ export function TabsBlockEditor({ data, onChange, editable, blockId, title, ctx,
119
119
  // section, so wrapping again here would double-nest. The read renderer
120
120
  // (`TabsBlockReader`) owns its own section because read mode renders the spec
121
121
  // directly.
122
- return (_jsx("div", { className: "min-w-0", "data-tabs-edit-block": blockId, children: _jsxs("div", { className: cn(vertical &&
123
- "grid min-w-0 gap-5 md:grid-cols-[minmax(10rem,14rem)_minmax(0,1fr)] md:items-start"), children: [_jsxs("div", { className: cn("flex min-w-0 items-start gap-2", vertical ? "mb-5 md:mb-0" : "mb-8 w-full"), children: [_jsx("div", { className: cn("flex min-w-0 flex-1 gap-1", vertical
124
- ? "flex-nowrap overflow-x-auto md:max-h-[62vh] md:flex-col md:overflow-x-hidden md:overflow-y-auto md:pr-2"
122
+ return (_jsx("div", { className: cn("min-w-0", vertical && "@container/tabs"), "data-tabs-edit-block": blockId, children: _jsxs("div", { className: cn(vertical &&
123
+ "grid min-w-0 gap-5 @xl/tabs:grid-cols-[minmax(10rem,14rem)_minmax(0,1fr)] @xl/tabs:items-start"), children: [_jsxs("div", { className: cn("flex min-w-0 items-start gap-2", vertical ? "mb-5 @xl/tabs:mb-0" : "mb-8 w-full"), children: [_jsx("div", { className: cn("flex min-w-0 flex-1 gap-1", vertical
124
+ ? "flex-nowrap overflow-x-auto @xl/tabs:max-h-[62vh] @xl/tabs:flex-col @xl/tabs:overflow-x-hidden @xl/tabs:overflow-y-auto @xl/tabs:pr-2"
125
125
  : "w-full flex-nowrap items-center overflow-x-auto"), role: "tablist", "aria-orientation": orientation, "data-plan-interactive": true, children: data.tabs.map((tab) => {
126
126
  const selected = tab.id === active?.id;
127
127
  const tabLabel = (_jsx("span", { className: tabLabelClass(orientation), children: tab.label }));
@@ -129,7 +129,7 @@ export function TabsBlockEditor({ data, onChange, editable, blockId, title, ctx,
129
129
  return (_jsx("button", { type: "button", role: "tab", "aria-selected": selected, onClick: () => setActiveId(tab.id), className: tabButtonClass(selected, orientation), children: tabLabel }, tab.id));
130
130
  }
131
131
  const tabButton = (_jsx("button", { type: "button", role: "tab", "aria-selected": selected, onClick: () => setActiveId(tab.id), className: cn(tabButtonClass(selected, orientation), vertical && editable && selected && "pr-9"), children: tabLabel }));
132
- return (_jsxs("div", { className: "group/tab relative flex min-w-0 max-w-72 shrink-0 md:w-full md:max-w-none", children: [tabButton, editable && selected && (_jsx(TabsSettingsPopover, { active: active, orientation: orientation, tabs: data.tabs, triggerClassName: "pointer-events-none absolute right-1.5 top-1/2 -translate-y-1/2 opacity-0 transition-opacity group-hover/tab:pointer-events-auto group-hover/tab:opacity-100 group-focus-within/tab:pointer-events-auto group-focus-within/tab:opacity-100 data-[state=open]:pointer-events-auto data-[state=open]:opacity-100", onRename: renameTab, onOrientationChange: setOrientation, onAdd: addTab, onRemove: removeTab }))] }, tab.id));
132
+ return (_jsxs("div", { className: "group/tab relative flex min-w-0 max-w-72 shrink-0 @xl/tabs:w-full @xl/tabs:max-w-none", children: [tabButton, editable && selected && (_jsx(TabsSettingsPopover, { active: active, orientation: orientation, tabs: data.tabs, triggerClassName: "pointer-events-none absolute right-1.5 top-1/2 -translate-y-1/2 opacity-0 transition-opacity group-hover/tab:pointer-events-auto group-hover/tab:opacity-100 group-focus-within/tab:pointer-events-auto group-focus-within/tab:opacity-100 data-[state=open]:pointer-events-auto data-[state=open]:opacity-100", onRename: renameTab, onOrientationChange: setOrientation, onAdd: addTab, onRemove: removeTab }))] }, tab.id));
133
133
  }) }), editable && !vertical && (_jsx(TabsSettingsPopover, { active: active, orientation: orientation, tabs: data.tabs, onRename: renameTab, onOrientationChange: setOrientation, onAdd: addTab, onRemove: removeTab }))] }), active && (_jsx("div", { className: cn(vertical && "min-w-0"), children: ctx.renderBlocksEditor
134
134
  ? ctx.renderBlocksEditor({
135
135
  blocks: active.blocks,