@chobantonov/jsonforms-react-extended-renderers 0.0.0-stage → 0.1.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 (193) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +17 -2
  3. package/lib/AgGridControlRenderer.impl-BO-Z1x0Y.js +2 -0
  4. package/lib/AgGridControlRenderer.impl-BO-Z1x0Y.js.map +1 -0
  5. package/lib/AgGridControlRenderer.impl-BZS8_ocu.mjs +429 -0
  6. package/lib/AgGridControlRenderer.impl-BZS8_ocu.mjs.map +1 -0
  7. package/lib/DynamicJSXRenderer-Cyw40Kz0.js +2 -0
  8. package/lib/DynamicJSXRenderer-Cyw40Kz0.js.map +1 -0
  9. package/lib/DynamicJSXRenderer-DyB3ZpZV.mjs +109 -0
  10. package/lib/DynamicJSXRenderer-DyB3ZpZV.mjs.map +1 -0
  11. package/lib/MarkupLabelRenderer.impl-CWfdcUuH.mjs +12 -0
  12. package/lib/MarkupLabelRenderer.impl-CWfdcUuH.mjs.map +1 -0
  13. package/lib/MarkupLabelRenderer.impl-DnuzIPQg.js +2 -0
  14. package/lib/MarkupLabelRenderer.impl-DnuzIPQg.js.map +1 -0
  15. package/lib/MonacoControlRenderer.impl-BwgLGNMK.js +3 -0
  16. package/lib/MonacoControlRenderer.impl-BwgLGNMK.js.map +1 -0
  17. package/lib/MonacoControlRenderer.impl-CyjMHbOd.mjs +186 -0
  18. package/lib/MonacoControlRenderer.impl-CyjMHbOd.mjs.map +1 -0
  19. package/lib/RactiveTemplate-7L44A38e.js +2 -0
  20. package/lib/RactiveTemplate-7L44A38e.js.map +1 -0
  21. package/lib/RactiveTemplate-Cat7CxUp.mjs +74 -0
  22. package/lib/RactiveTemplate-Cat7CxUp.mjs.map +1 -0
  23. package/lib/ajv-localizers.cjs.js +2 -0
  24. package/lib/ajv-localizers.cjs.js.map +1 -0
  25. package/lib/ajv-localizers.esm.js +7 -0
  26. package/lib/ajv-localizers.esm.js.map +1 -0
  27. package/lib/ajvI18n-2UTyJv5g.js +2 -0
  28. package/lib/ajvI18n-2UTyJv5g.js.map +1 -0
  29. package/lib/ajvI18n-DO8FFvx1.mjs +227 -0
  30. package/lib/ajvI18n-DO8FFvx1.mjs.map +1 -0
  31. package/lib/celTemplate-Cl0alaCz.js +3 -0
  32. package/lib/celTemplate-Cl0alaCz.js.map +1 -0
  33. package/lib/celTemplate-D_AGhaIL.mjs +137 -0
  34. package/lib/celTemplate-D_AGhaIL.mjs.map +1 -0
  35. package/lib/components/DynamicJSXRenderer.d.ts +7 -0
  36. package/lib/components/ExtendedJsonForms.d.ts +80 -0
  37. package/lib/components/GenericAdditionalProperties.d.ts +4 -0
  38. package/lib/components/InterpolatedText.d.ts +34 -0
  39. package/lib/components/RactiveTemplate.d.ts +37 -0
  40. package/lib/components/editorRendererTypes.d.ts +139 -0
  41. package/lib/components/elementRender.d.ts +15 -0
  42. package/lib/configNamespaces-BFclHtB8.mjs +1 -0
  43. package/lib/configNamespaces-sboXDudL.js +1 -0
  44. package/lib/core/ajv.d.ts +82 -0
  45. package/lib/core/ajvI18n/bg.d.ts +2 -0
  46. package/lib/core/ajvI18n/index.d.ts +118 -0
  47. package/lib/core/ajvI18n/localizers.d.ts +20 -0
  48. package/lib/core/dynamicDefaults.d.ts +34 -0
  49. package/lib/core/keywords.d.ts +24 -0
  50. package/lib/core/transform.d.ts +29 -0
  51. package/lib/core/uiSchema.d.ts +48 -0
  52. package/lib/elementRender-Dbp2e-Cc.js +2 -0
  53. package/lib/elementRender-Dbp2e-Cc.js.map +1 -0
  54. package/lib/elementRender-y8MK9CCE.mjs +5 -0
  55. package/lib/elementRender-y8MK9CCE.mjs.map +1 -0
  56. package/lib/index.d.ts +41 -0
  57. package/lib/jsonforms-react-extended.cjs.js +16 -0
  58. package/lib/jsonforms-react-extended.cjs.js.map +1 -0
  59. package/lib/jsonforms-react-extended.esm.js +2335 -0
  60. package/lib/jsonforms-react-extended.esm.js.map +1 -0
  61. package/lib/locale/bg.d.ts +14 -0
  62. package/lib/markdown-C_y73Q0w.mjs +123 -0
  63. package/lib/markdown-C_y73Q0w.mjs.map +1 -0
  64. package/lib/markdown-CuqtpGVd.js +2 -0
  65. package/lib/markdown-CuqtpGVd.js.map +1 -0
  66. package/lib/objectWithoutProperties-6zedhz76.js +2 -0
  67. package/lib/objectWithoutProperties-6zedhz76.js.map +1 -0
  68. package/lib/objectWithoutProperties-yjQMyZ0y.mjs +58 -0
  69. package/lib/objectWithoutProperties-yjQMyZ0y.mjs.map +1 -0
  70. package/lib/renderers/AgGridControlRenderer.d.ts +10 -0
  71. package/lib/renderers/AgGridControlRenderer.impl.d.ts +4 -0
  72. package/lib/renderers/ButtonRenderer.d.ts +83 -0
  73. package/lib/renderers/GenericMixedRenderer.d.ts +9 -0
  74. package/lib/renderers/HorizontalLayoutRenderer.d.ts +5 -0
  75. package/lib/renderers/ImageViewRenderer.d.ts +48 -0
  76. package/lib/renderers/LinkRenderer.d.ts +23 -0
  77. package/lib/renderers/MarkupLabelRenderer.d.ts +35 -0
  78. package/lib/renderers/MarkupLabelRenderer.impl.d.ts +17 -0
  79. package/lib/renderers/MonacoControlRenderer.d.ts +8 -0
  80. package/lib/renderers/MonacoControlRenderer.impl.d.ts +4 -0
  81. package/lib/renderers/RactiveTemplateLayoutRenderer.d.ts +6 -0
  82. package/lib/renderers/SeparatorRenderer.d.ts +17 -0
  83. package/lib/renderers/SlotRenderer.d.ts +5 -0
  84. package/lib/renderers/SpacerRenderer.d.ts +5 -0
  85. package/lib/renderers/SplitLayoutRenderer.d.ts +18 -0
  86. package/lib/renderers/TemplateLayoutRenderer.d.ts +13 -0
  87. package/lib/renderers/TemplateRenderer.d.ts +17 -0
  88. package/lib/renderers/TsxTemplateLayoutRenderer.d.ts +111 -0
  89. package/lib/renderers/index.d.ts +13 -0
  90. package/lib/renderers/templateEngines.d.ts +43 -0
  91. package/lib/util/actionContext.d.ts +23 -0
  92. package/lib/util/additionalErrors.d.ts +77 -0
  93. package/lib/util/celEnvironment.d.ts +23 -0
  94. package/lib/util/celTemplate.d.ts +47 -0
  95. package/lib/util/childNames.d.ts +46 -0
  96. package/lib/util/configNamespaces.d.ts +1 -0
  97. package/lib/util/cron.d.ts +122 -0
  98. package/lib/util/editorControls.d.ts +8 -0
  99. package/lib/util/editorDiagnostics.d.ts +56 -0
  100. package/lib/util/extendedControls.d.ts +4 -0
  101. package/lib/util/extendedLocale.d.ts +32 -0
  102. package/lib/util/fileFilterValue.d.ts +3 -0
  103. package/lib/util/formContext.d.ts +54 -0
  104. package/lib/util/gridColumns.d.ts +6 -0
  105. package/lib/util/horizontalLayout.d.ts +10 -0
  106. package/lib/util/i18nDefaults.d.ts +45 -0
  107. package/lib/util/interpolate.d.ts +105 -0
  108. package/lib/util/labelFilterValue.d.ts +2 -0
  109. package/lib/util/lazyControl.d.ts +36 -0
  110. package/lib/util/lazyTemplate.d.ts +18 -0
  111. package/lib/util/markdown.d.ts +55 -0
  112. package/lib/util/markdownEscape.d.ts +27 -0
  113. package/lib/util/markup.d.ts +74 -0
  114. package/lib/util/maskControls.d.ts +2 -0
  115. package/lib/util/templateLang.d.ts +87 -0
  116. package/lib/util/templateUrls.d.ts +40 -0
  117. package/lib/util/urlPolicy.d.ts +42 -0
  118. package/lib/util/useCronPicker.d.ts +24 -0
  119. package/lib/util/useDurationControl.d.ts +99 -0
  120. package/lib/util/useEditorAppearance.d.ts +21 -0
  121. package/lib/util/useExtendedTranslator.d.ts +10 -0
  122. package/lib/util/useMonacoShadowStyles.d.ts +2 -0
  123. package/package.json +110 -3
  124. package/src/components/DynamicJSXRenderer.tsx +274 -0
  125. package/src/components/ExtendedJsonForms.tsx +329 -0
  126. package/src/components/GenericAdditionalProperties.tsx +362 -0
  127. package/src/components/InterpolatedText.tsx +114 -0
  128. package/src/components/RactiveTemplate.tsx +161 -0
  129. package/src/components/editorRendererTypes.ts +135 -0
  130. package/src/components/elementRender.ts +15 -0
  131. package/src/core/ajv.ts +177 -0
  132. package/src/core/ajvI18n/bg.ts +203 -0
  133. package/src/core/ajvI18n/index.ts +267 -0
  134. package/src/core/ajvI18n/localizers.ts +25 -0
  135. package/src/core/dynamicDefaults.ts +170 -0
  136. package/src/core/keywords.ts +71 -0
  137. package/src/core/transform.ts +137 -0
  138. package/src/core/uiSchema.ts +53 -0
  139. package/src/index.tsx +196 -0
  140. package/src/locale/bg.ts +51 -0
  141. package/src/renderers/AgGridControlRenderer.impl.tsx +788 -0
  142. package/src/renderers/AgGridControlRenderer.tsx +24 -0
  143. package/src/renderers/ButtonRenderer.tsx +328 -0
  144. package/src/renderers/GenericMixedRenderer.tsx +224 -0
  145. package/src/renderers/HorizontalLayoutRenderer.tsx +93 -0
  146. package/src/renderers/ImageViewRenderer.tsx +328 -0
  147. package/src/renderers/LinkRenderer.tsx +92 -0
  148. package/src/renderers/MarkupLabelRenderer.impl.tsx +26 -0
  149. package/src/renderers/MarkupLabelRenderer.tsx +327 -0
  150. package/src/renderers/MonacoControlRenderer.impl.tsx +351 -0
  151. package/src/renderers/MonacoControlRenderer.tsx +24 -0
  152. package/src/renderers/RactiveTemplateLayoutRenderer.tsx +172 -0
  153. package/src/renderers/SeparatorRenderer.tsx +55 -0
  154. package/src/renderers/SlotRenderer.tsx +34 -0
  155. package/src/renderers/SpacerRenderer.tsx +69 -0
  156. package/src/renderers/SplitLayoutRenderer.tsx +220 -0
  157. package/src/renderers/TemplateLayoutRenderer.tsx +394 -0
  158. package/src/renderers/TemplateRenderer.tsx +71 -0
  159. package/src/renderers/TsxTemplateLayoutRenderer.tsx +258 -0
  160. package/src/renderers/index.ts +14 -0
  161. package/src/renderers/templateEngines.tsx +100 -0
  162. package/src/util/actionContext.ts +29 -0
  163. package/src/util/additionalErrors.tsx +391 -0
  164. package/src/util/celEnvironment.ts +300 -0
  165. package/src/util/celTemplate.ts +267 -0
  166. package/src/util/childNames.ts +135 -0
  167. package/src/util/configNamespaces.ts +6 -0
  168. package/src/util/cron.ts +433 -0
  169. package/src/util/editorControls.ts +58 -0
  170. package/src/util/editorDiagnostics.ts +103 -0
  171. package/src/util/extendedControls.ts +34 -0
  172. package/src/util/extendedLocale.ts +67 -0
  173. package/src/util/fileFilterValue.ts +28 -0
  174. package/src/util/formContext.ts +74 -0
  175. package/src/util/gridColumns.ts +80 -0
  176. package/src/util/horizontalLayout.ts +59 -0
  177. package/src/util/i18nDefaults.ts +80 -0
  178. package/src/util/interpolate.ts +218 -0
  179. package/src/util/labelFilterValue.ts +49 -0
  180. package/src/util/lazyControl.tsx +66 -0
  181. package/src/util/lazyTemplate.tsx +110 -0
  182. package/src/util/markdown.tsx +345 -0
  183. package/src/util/markdownEscape.ts +29 -0
  184. package/src/util/markup.ts +144 -0
  185. package/src/util/maskControls.ts +6 -0
  186. package/src/util/templateLang.ts +145 -0
  187. package/src/util/templateUrls.ts +274 -0
  188. package/src/util/urlPolicy.ts +115 -0
  189. package/src/util/useCronPicker.ts +102 -0
  190. package/src/util/useDurationControl.ts +272 -0
  191. package/src/util/useEditorAppearance.ts +86 -0
  192. package/src/util/useExtendedTranslator.ts +25 -0
  193. package/src/util/useMonacoShadowStyles.ts +47 -0
@@ -0,0 +1,14 @@
1
+ import type { ExtendedLocaleCatalog } from '../util/extendedLocale';
2
+ /**
3
+ * Bulgarian for this package's own strings.
4
+ *
5
+ * ```ts
6
+ * import { registerExtendedLocale, bgExtendedLocale } from '@chobantonov/jsonforms-react-extended-renderers';
7
+ * registerExtendedLocale('bg', bgExtendedLocale);
8
+ * ```
9
+ *
10
+ * The `color.placeholder.*` keys are deliberately absent: they are notations
11
+ * (`#RRGGBB`, `rgb(r, g, b)`), not prose, and translating them would show a
12
+ * pattern the control does not accept.
13
+ */
14
+ export declare const bgExtendedLocale: ExtendedLocaleCatalog;
@@ -0,0 +1,123 @@
1
+ import { isAllowedUrl as e } from "./jsonforms-react-extended.esm.js";
2
+ import { s as t } from "./ajvI18n-DO8FFvx1.mjs";
3
+ import n from "react";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ import i from "markdown-it";
6
+ // src/util/markdown.tsx
7
+ var a = [
8
+ "image",
9
+ "html_inline",
10
+ "html_block",
11
+ "hr"
12
+ ], o = [
13
+ "heading",
14
+ "lheading",
15
+ "blockquote",
16
+ "table",
17
+ "fence",
18
+ "code"
19
+ ], s = /* @__PURE__ */ new Set([
20
+ "p",
21
+ "br",
22
+ "strong",
23
+ "em",
24
+ "s",
25
+ "code",
26
+ "pre",
27
+ "a",
28
+ "ul",
29
+ "ol",
30
+ "li",
31
+ "blockquote",
32
+ "h1",
33
+ "h2",
34
+ "h3",
35
+ "h4",
36
+ "h5",
37
+ "h6",
38
+ "table",
39
+ "thead",
40
+ "tbody",
41
+ "tr",
42
+ "th",
43
+ "td"
44
+ ]), c = /* @__PURE__ */ new Map(), l = (e = "basic") => {
45
+ let t = c.get(e);
46
+ if (t) return t;
47
+ let n = new i({
48
+ html: !1,
49
+ linkify: !1,
50
+ breaks: !1,
51
+ typographer: !1
52
+ });
53
+ return n.disable(e === "extended" ? a : [...a, ...o], !0), n.validateLink = () => !0, c.set(e, n), n;
54
+ }, u = (i, a, o) => {
55
+ let c = [], l = [], d = (e) => (l.length ? l[l.length - 1].children : c).push(e), f = () => {
56
+ let e = l.pop();
57
+ if (e) {
58
+ if (e.tag === null) for (let t of e.children) d(t);
59
+ else d(n.createElement(e.tag, t({ key: `md-${o.next++}` }, e.props), e.children.length ? e.children : void 0));
60
+ }
61
+ };
62
+ for (let t of i) if (t.type === "inline") {
63
+ var p;
64
+ for (let e of u((p = t.children) == null ? [] : p, a, o)) d(e);
65
+ } else if (t.nesting === 1) {
66
+ if (t.type === "link_open") {
67
+ var m;
68
+ let n = String((m = t.attrGet("href")) == null ? "" : m);
69
+ if (e(n, a.urlPolicy)) l.push({
70
+ tag: "a",
71
+ props: {
72
+ href: n,
73
+ target: "_blank",
74
+ rel: "noopener noreferrer"
75
+ },
76
+ children: []
77
+ });
78
+ else {
79
+ var h;
80
+ (h = a.onRefusedUrl) == null || h.call(a, n), l.push({
81
+ tag: "span",
82
+ props: { "data-markdown-url-refused": !0 },
83
+ children: []
84
+ });
85
+ }
86
+ continue;
87
+ }
88
+ l.push({
89
+ tag: t.hidden ? null : s.has(t.tag) ? t.tag : "span",
90
+ props: {},
91
+ children: []
92
+ });
93
+ } else if (t.nesting === -1) f();
94
+ else switch (t.type) {
95
+ case "text":
96
+ t.content && d(t.content);
97
+ break;
98
+ case "softbreak":
99
+ d(" ");
100
+ break;
101
+ case "hardbreak":
102
+ d(/* @__PURE__ */ r("br", {}, `md-${o.next++}`));
103
+ break;
104
+ case "code_inline":
105
+ d(/* @__PURE__ */ r("code", { children: t.content }, `md-${o.next++}`));
106
+ break;
107
+ case "fence":
108
+ case "code_block": d(/* @__PURE__ */ r("pre", { children: /* @__PURE__ */ r("code", { children: t.content }) }, `md-${o.next++}`));
109
+ }
110
+ for (; l.length;) f();
111
+ return c;
112
+ }, d = (e, t = {}) => u(l(t.profile).parse(e, {}), t, { next: 0 }), f = (e, t) => {
113
+ let n = (e) => e.map((e) => e.children ? n(e.children) : [
114
+ "text",
115
+ "code_inline",
116
+ "code_block",
117
+ "fence"
118
+ ].includes(e.type) ? e.content : ["softbreak", "hardbreak"].includes(e.type) || e.block && e.nesting === -1 ? " " : "").join("");
119
+ return n(l(t).parse(e, {})).replace(/\s+/g, " ").trim();
120
+ };
121
+ export { d as n, f as t };
122
+
123
+ //# sourceMappingURL=markdown-C_y73Q0w.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-C_y73Q0w.mjs","names":["_objectSpread2","React","MarkdownIt","ALWAYS_OFF","EXTENDED_ONLY","ALLOWED_TAGS","parsers","markdownParser","existing","profile","md","walk","root","stack","push","node","close","frame","child","token","tokens","_token$children","context","counter","_token$attrGet","href","isAllowedUrl","_context$onRefusedUrl","renderMarkdown","markdown","markdownPlainText","collect","source"],"sources":["../src/util/markdown.tsx"],"sourcesContent":["import MarkdownIt, { type MarkdownIt as MarkdownItInstance } from 'markdown-it';\nimport React from 'react';\nimport { isAllowedUrl, UrlPolicy } from './urlPolicy';\n\n/*\n Re-exported so this module stays the one place a caller looks for Markdown\n concerns, while the function itself carries no dependency - see\n `markdownEscape.ts` for why that separation matters to the bundle.\n*/\nexport { escapeMarkdown } from './markdownEscape';\n\n/**\n * The Markdown profiles of specification section 10, rendered to React.\n *\n * ## Why a token stream rather than HTML\n *\n * Section 10 requires that Markdown output be sanitized **after** parsing.\n * `md.render()` returns an HTML string, which would have to be injected with\n * `dangerouslySetInnerHTML` and therefore sanitized first by some other\n * library. `md.parse()` returns a token stream instead, and walking that into\n * React elements means **no HTML string is ever produced**: there is nothing\n * unsanitized to sanitize, no sanitizer in the dependency chain to be\n * misconfigured, and the set of elements that can reach the page is the\n * allowlist below rather than whatever the sanitizer was talked into.\n *\n * ## Why rules are disabled rather than output filtered\n *\n * Basic excludes headings, images, tables, blockquotes and fenced code.\n * Disabling the **rule** means `# Title` renders as the literal text\n * `# Title`, which is what a profile that excludes headings should do.\n * Filtering the output instead would consume the `#` and silently promote the\n * text to a paragraph, leaving an author to wonder where their heading went.\n *\n * Disabling a rule is not the same as escaping the text, and one case shows\n * it: with `fence` off, a ``` block is claimed by the inline backtick rule\n * and comes out as inline code. Nothing is lost - the code is still the\n * content - but the construct degrades to its nearest supported neighbour\n * rather than to literal backticks.\n *\n * `html: false` means the parser never emits a raw-HTML token at all, so the\n * excluded raw HTML is excluded by construction rather than by a later pass.\n */\n\nexport type MarkdownProfile = 'basic' | 'extended';\n\n/**\n * Rules off in **both** profiles.\n *\n * `image` and `html_inline` are section 10's independently-gated constructs,\n * and neither gate is open: images are not implemented here, and raw HTML has\n * no rule to disable beyond `html: false` - these two names are belt and\n * braces should a future option turn `html` on for some other reason.\n *\n * `hr` is in neither profile's list. Basic enumerates what it supports and a\n * thematic break is not in it; extended is defined as basic *plus headings,\n * blockquotes, tables and fenced code*, which does not add one either.\n */\nconst ALWAYS_OFF = ['image', 'html_inline', 'html_block', 'hr'];\n\n/** What extended adds back, and therefore exactly what basic withholds. */\nconst EXTENDED_ONLY = [\n 'heading',\n 'lheading',\n 'blockquote',\n 'table',\n 'fence',\n 'code',\n];\n\n/**\n * The elements that may reach the page.\n *\n * Every tag markdown-it produces for the rules left enabled, and nothing\n * else. A token carrying any other tag is dropped rather than rendered, so\n * this list - not the rule configuration - is the last word on what can be\n * drawn. `reference` and `autolink` stay enabled because both produce\n * ordinary links, which the profile supports and which the URL policy\n * governs like any other.\n */\nconst ALLOWED_TAGS = new Set([\n 'p',\n 'br',\n 'strong',\n 'em',\n 's',\n 'code',\n 'pre',\n 'a',\n 'ul',\n 'ol',\n 'li',\n 'blockquote',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'table',\n 'thead',\n 'tbody',\n 'tr',\n 'th',\n 'td',\n]);\n\nconst parsers = new Map<MarkdownProfile, MarkdownItInstance>();\n\n/**\n * `linkify` is off: turning a bare URL into a link is in neither profile, and\n * it would route text the author never marked up through the URL policy.\n *\n * `breaks` is off because a single newline is not a line break in Markdown;\n * the profile's \"line breaks\" are the two-space and backslash forms, which\n * `hardbreak` carries.\n */\nexport const markdownParser = (\n profile: MarkdownProfile = 'basic',\n): MarkdownItInstance => {\n const existing = parsers.get(profile);\n if (existing) {\n return existing;\n }\n const md = new MarkdownIt({\n html: false,\n linkify: false,\n breaks: false,\n typographer: false,\n });\n md.disable(\n profile === 'extended' ? ALWAYS_OFF : [...ALWAYS_OFF, ...EXTENDED_ONLY],\n /* ignoreInvalid: a rule renamed upstream must not throw at render time. */\n true,\n );\n /*\n markdown-it carries its own scheme check, which refuses `javascript:`,\n `vbscript:`, `file:` and `data:` by turning the link back into plain text\n before a `link_open` token exists. Two reasons to take it over rather than\n leave it in front of the URL policy:\n\n - Section 10 makes the URL policy the authority on link targets. With two\n checks in series the effective policy is their intersection, so a host\n that widens `allowedSchemes` silently gets nothing for the schemes\n markdown-it happens to dislike.\n - A link refused before parsing raises no diagnostic. The author is told\n nothing, and the text keeps the raw `[go](...)` brackets.\n\n Handing every href to `isAllowedUrl` makes one check authoritative and\n every refusal reportable. It is not a loosening: the default policy allows\n https, http and mailto only, which is narrower than what markdown-it\n blocks.\n */\n md.validateLink = () => true;\n parsers.set(profile, md);\n return md;\n};\n\nexport interface MarkdownContext {\n profile?: MarkdownProfile;\n urlPolicy?: UrlPolicy;\n /** Called for a link the policy refuses, so the caller can diagnose it. */\n onRefusedUrl?: (href: string) => void;\n}\n\ninterface Frame {\n /**\n * `null` for a **transparent** frame: one that holds its children's place\n * in the walk but draws nothing of its own.\n *\n * markdown-it wraps every list item's content in a paragraph and sets\n * `hidden` on the wrapper when the list is tight, which is how `- one` ends\n * up as `<li>one</li>` rather than `<li><p>one</p></li>`. The flag has to be\n * honoured: rendering a hidden token puts a block element inside every list\n * item and spaces the list out. It is also why a frame is pushed at all for\n * such a token - the matching close must still find something to pop.\n */\n tag: string | null;\n props: Record<string, unknown>;\n children: React.ReactNode[];\n}\n\n/**\n * Walks a token stream into React nodes.\n *\n * markdown-it emits a flat list whose `nesting` is +1, 0 or -1, so the walk\n * keeps an explicit stack rather than recursing: an opening token pushes a\n * frame, a closing token pops it and appends the finished element to its\n * parent. Keying off `nesting` and `tag` rather than off each token `type`\n * is what lets the two profiles share one walk - an `h2` needs no case of\n * its own, it needs only to be in {@link ALLOWED_TAGS}.\n */\nconst walk = (\n tokens: ReturnType<MarkdownItInstance['parse']>,\n context: MarkdownContext,\n counter: { next: number },\n): React.ReactNode[] => {\n const root: React.ReactNode[] = [];\n const stack: Frame[] = [];\n const push = (node: React.ReactNode) =>\n (stack.length ? stack[stack.length - 1].children : root).push(node);\n const close = () => {\n const frame = stack.pop();\n if (!frame) {\n return;\n }\n if (frame.tag === null) {\n for (const child of frame.children) {\n push(child);\n }\n return;\n }\n push(\n React.createElement(\n frame.tag,\n { key: `md-${counter.next++}`, ...frame.props },\n frame.children.length ? frame.children : undefined,\n ),\n );\n };\n\n for (const token of tokens) {\n if (token.type === 'inline') {\n for (const node of walk(token.children ?? [], context, counter)) {\n push(node);\n }\n continue;\n }\n if (token.nesting === 1) {\n if (token.type === 'link_open') {\n const href = String(token.attrGet('href') ?? '');\n if (isAllowedUrl(href, context.urlPolicy)) {\n stack.push({\n tag: 'a',\n props: { href, target: '_blank', rel: 'noopener noreferrer' },\n children: [],\n });\n } else {\n context.onRefusedUrl?.(href);\n /*\n A refused destination keeps its text and loses its link, which is\n what the Link renderer does under the same policy. A `span` leaves\n the sentence intact without offering anywhere to click.\n */\n stack.push({\n tag: 'span',\n props: { 'data-markdown-url-refused': true },\n children: [],\n });\n }\n continue;\n }\n /*\n An unknown tag still pushes a frame, so its matching close pops this\n one and the nesting stays balanced; `span` is the inert stand-in.\n */\n stack.push({\n tag: token.hidden\n ? null\n : ALLOWED_TAGS.has(token.tag)\n ? token.tag\n : 'span',\n props: {},\n children: [],\n });\n continue;\n }\n if (token.nesting === -1) {\n close();\n continue;\n }\n switch (token.type) {\n case 'text':\n if (token.content) {\n push(token.content);\n }\n break;\n case 'softbreak':\n push(' ');\n break;\n case 'hardbreak':\n push(<br key={`md-${counter.next++}`} />);\n break;\n case 'code_inline':\n push(<code key={`md-${counter.next++}`}>{token.content}</code>);\n break;\n case 'fence':\n case 'code_block':\n /*\n No language class: the info string is author-supplied text, and a\n highlighter is not in the profile. The code is content either way.\n */\n push(\n <pre key={`md-${counter.next++}`}>\n <code>{token.content}</code>\n </pre>,\n );\n break;\n default:\n /*\n A disabled rule emits no tokens, so anything arriving here is a\n construct this profile does not draw. Dropping it is right: the text\n it carried is already in the stream as its own token.\n */\n break;\n }\n }\n /* An unbalanced stream (never seen from markdown-it) still yields its content. */\n while (stack.length) {\n close();\n }\n return root;\n};\n\n/** Parses and renders, in the requested profile. */\nexport const renderMarkdown = (\n markdown: string,\n context: MarkdownContext = {},\n): React.ReactNode[] =>\n walk(markdownParser(context.profile).parse(markdown, {}), context, {\n next: 0,\n });\n\n/** Visible text using the same Markdown profile as the renderer. */\nexport const markdownPlainText = (\n source: string,\n profile: MarkdownProfile,\n): string => {\n const collect = (tokens: any[]): string =>\n tokens\n .map((token) => {\n if (token.children) return collect(token.children);\n if (['text', 'code_inline', 'code_block', 'fence'].includes(token.type))\n return token.content;\n if (\n ['softbreak', 'hardbreak'].includes(token.type) ||\n (token.block && token.nesting === -1)\n )\n return ' ';\n return '';\n })\n .join('');\n return collect(markdownParser(profile).parse(source, {}))\n .replace(/\\s+/g, ' ')\n .trim();\n};\n"],"mappings":";;;;;;AAyDA,IAAMG,IAAa;CAAC;CAAS;CAAe;CAAc;AAAI,GAGxDC,IAAgB;CACpB;CACA;CACA;CACA;CACA;CACA;AACF,GAYMC,oBAAe,IAAI,IAAI;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,GAEKC,oBAAU,IAAI,IAAyC,GAUhDC,KACX,IAA2B,YACJ;CACvB,IAAMC,IAAWF,EAAQ,IAAIG,CAAO;CACpC,IAAID,GACF,OAAOA;CAET,IAAME,IAAK,IAAIR,EAAW;EACxB,MAAM;EACN,SAAS;EACT,QAAQ;EACR,aAAa;CACf,CAAC;CA0BD,OAzBAQ,EAAG,QACDD,MAAY,aAAaN,IAAa,CAAC,GAAGA,GAAY,GAAGC,CAAa,GAEtE,EACF,GAmBA,EAAG,qBAAqB,IACxBE,EAAQ,IAAIG,GAASC,CAAE,GAChBA;AACT,GAoCMC,KACJ,GACA,GACA,MACsB;CACtB,IAAMC,IAA0B,CAAC,GAC3BC,IAAiB,CAAC,GAClBC,KAAQ,OACXD,EAAM,SAASA,EAAMA,EAAM,SAAS,EAAE,CAAC,WAAWD,EAAA,CAAM,KAAKG,CAAI,GAC9DC,UAAc;EAClB,IAAMC,IAAQJ,EAAM,IAAI;EACxB,IAAKI,GAGL;OAAIA,EAAM,QAAQ,MAChB,KAAK,IAAMC,KAAS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EAAK,kBAAC,QAAD,EAAA,UAAoCA,EAAM,QAAc,GAA7C,MAAM,EAAQ,QAA+B,CAAC;GAC9D;EACF,KAAK;EACL,KAAK,cAKH,EACE,kBAAC,OAAD,EAAA,UACE,kBAAC,QAAD,EAAA,UAAOA,EAAM,QAAc,CAAA,EACxB,GAFK,MAAM,EAAQ,QAEnB,CACP;CASJ;CAGF,OAAON,EAAM,SACX,EAAM;CAER,OAAOD;AACT,GAGagB,KACX,GACA,IAA2B,CAAC,MAE5BjB,EAAKJ,EAAee,EAAQ,OAAO,CAAC,CAAC,MAAMO,GAAU,CAAC,CAAC,GAAGP,GAAS,EACjE,MAAM,EACR,CAAC,GAGUQ,KACX,GACA,MACW;CACX,IAAMC,KAAW,MACfX,EACG,KAAK,MACAD,EAAM,WAAiBY,EAAQZ,EAAM,QAAQ,IAC7C;EAAC;EAAQ;EAAe;EAAc;CAAO,CAAC,CAAC,SAASA,EAAM,IAAI,IAC7DA,EAAM,UAEb,CAAC,aAAa,WAAW,CAAC,CAAC,SAASA,EAAM,IAAI,KAC7CA,EAAM,SAASA,EAAM,YAAY,KAE3B,MACF,EACR,CAAC,CACD,KAAK,EAAE;CACZ,OAAOY,EAAQxB,EAAeE,CAAO,CAAC,CAAC,MAAMuB,GAAQ,CAAC,CAAC,CAAC,CAAC,CACtD,QAAQ,QAAQ,GAAG,CAAC,CACpB,KAAK;AACV"}
@@ -0,0 +1,2 @@
1
+ const e=require("./jsonforms-react-extended.cjs.js"),t=require("./ajvI18n-2UTyJv5g.js");let n=require("react");n=t.u(n);let r=require("react/jsx-runtime"),i=require("markdown-it");i=t.u(i);var a=[`image`,`html_inline`,`html_block`,`hr`],o=[`heading`,`lheading`,`blockquote`,`table`,`fence`,`code`],s=new Set([`p`,`br`,`strong`,`em`,`s`,`code`,`pre`,`a`,`ul`,`ol`,`li`,`blockquote`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`table`,`thead`,`tbody`,`tr`,`th`,`td`]),c=new Map,l=(e=`basic`)=>{let t=c.get(e);if(t)return t;let n=new i.default({html:!1,linkify:!1,breaks:!1,typographer:!1});return n.disable(e===`extended`?a:[...a,...o],!0),n.validateLink=()=>!0,c.set(e,n),n},u=(i,a,o)=>{let c=[],l=[],d=e=>(l.length?l[l.length-1].children:c).push(e),f=()=>{let e=l.pop();if(e){if(e.tag===null)for(let t of e.children)d(t);else d(n.default.createElement(e.tag,t.s({key:`md-${o.next++}`},e.props),e.children.length?e.children:void 0))}};for(let t of i)if(t.type===`inline`){var p;for(let e of u((p=t.children)==null?[]:p,a,o))d(e)}else if(t.nesting===1){if(t.type===`link_open`){var m;let n=String((m=t.attrGet(`href`))==null?``:m);if(e.isAllowedUrl(n,a.urlPolicy))l.push({tag:`a`,props:{href:n,target:`_blank`,rel:`noopener noreferrer`},children:[]});else{var h;(h=a.onRefusedUrl)==null||h.call(a,n),l.push({tag:`span`,props:{"data-markdown-url-refused":!0},children:[]})}continue}l.push({tag:t.hidden?null:s.has(t.tag)?t.tag:`span`,props:{},children:[]})}else if(t.nesting===-1)f();else switch(t.type){case`text`:t.content&&d(t.content);break;case`softbreak`:d(` `);break;case`hardbreak`:d((0,r.jsx)(`br`,{},`md-${o.next++}`));break;case`code_inline`:d((0,r.jsx)(`code`,{children:t.content},`md-${o.next++}`));break;case`fence`:case`code_block`:d((0,r.jsx)(`pre`,{children:(0,r.jsx)(`code`,{children:t.content})},`md-${o.next++}`))}for(;l.length;)f();return c},d=(e,t={})=>u(l(t.profile).parse(e,{}),t,{next:0}),f=(e,t)=>{let n=e=>e.map(e=>e.children?n(e.children):[`text`,`code_inline`,`code_block`,`fence`].includes(e.type)?e.content:[`softbreak`,`hardbreak`].includes(e.type)||e.block&&e.nesting===-1?` `:``).join(``);return n(l(t).parse(e,{})).replace(/\s+/g,` `).trim()};Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return f}});
2
+ //# sourceMappingURL=markdown-CuqtpGVd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-CuqtpGVd.js","names":["MarkdownIt","React","isAllowedUrl","require_jsonforms_react_extended","require_ajvI18n","react","react_jsx_runtime","markdown_it","ALWAYS_OFF","EXTENDED_ONLY","ALLOWED_TAGS","parsers","markdownParser","existing","profile","md","walk","root","stack","push","node","close","frame","child","token","tokens","_token$children","context","counter","_token$attrGet","href","_context$onRefusedUrl","renderMarkdown","markdown","markdownPlainText","collect","source"],"sources":["../src/util/markdown.tsx"],"sourcesContent":["import MarkdownIt, { type MarkdownIt as MarkdownItInstance } from 'markdown-it';\nimport React from 'react';\nimport { isAllowedUrl, UrlPolicy } from './urlPolicy';\n\n/*\n Re-exported so this module stays the one place a caller looks for Markdown\n concerns, while the function itself carries no dependency - see\n `markdownEscape.ts` for why that separation matters to the bundle.\n*/\nexport { escapeMarkdown } from './markdownEscape';\n\n/**\n * The Markdown profiles of specification section 10, rendered to React.\n *\n * ## Why a token stream rather than HTML\n *\n * Section 10 requires that Markdown output be sanitized **after** parsing.\n * `md.render()` returns an HTML string, which would have to be injected with\n * `dangerouslySetInnerHTML` and therefore sanitized first by some other\n * library. `md.parse()` returns a token stream instead, and walking that into\n * React elements means **no HTML string is ever produced**: there is nothing\n * unsanitized to sanitize, no sanitizer in the dependency chain to be\n * misconfigured, and the set of elements that can reach the page is the\n * allowlist below rather than whatever the sanitizer was talked into.\n *\n * ## Why rules are disabled rather than output filtered\n *\n * Basic excludes headings, images, tables, blockquotes and fenced code.\n * Disabling the **rule** means `# Title` renders as the literal text\n * `# Title`, which is what a profile that excludes headings should do.\n * Filtering the output instead would consume the `#` and silently promote the\n * text to a paragraph, leaving an author to wonder where their heading went.\n *\n * Disabling a rule is not the same as escaping the text, and one case shows\n * it: with `fence` off, a ``` block is claimed by the inline backtick rule\n * and comes out as inline code. Nothing is lost - the code is still the\n * content - but the construct degrades to its nearest supported neighbour\n * rather than to literal backticks.\n *\n * `html: false` means the parser never emits a raw-HTML token at all, so the\n * excluded raw HTML is excluded by construction rather than by a later pass.\n */\n\nexport type MarkdownProfile = 'basic' | 'extended';\n\n/**\n * Rules off in **both** profiles.\n *\n * `image` and `html_inline` are section 10's independently-gated constructs,\n * and neither gate is open: images are not implemented here, and raw HTML has\n * no rule to disable beyond `html: false` - these two names are belt and\n * braces should a future option turn `html` on for some other reason.\n *\n * `hr` is in neither profile's list. Basic enumerates what it supports and a\n * thematic break is not in it; extended is defined as basic *plus headings,\n * blockquotes, tables and fenced code*, which does not add one either.\n */\nconst ALWAYS_OFF = ['image', 'html_inline', 'html_block', 'hr'];\n\n/** What extended adds back, and therefore exactly what basic withholds. */\nconst EXTENDED_ONLY = [\n 'heading',\n 'lheading',\n 'blockquote',\n 'table',\n 'fence',\n 'code',\n];\n\n/**\n * The elements that may reach the page.\n *\n * Every tag markdown-it produces for the rules left enabled, and nothing\n * else. A token carrying any other tag is dropped rather than rendered, so\n * this list - not the rule configuration - is the last word on what can be\n * drawn. `reference` and `autolink` stay enabled because both produce\n * ordinary links, which the profile supports and which the URL policy\n * governs like any other.\n */\nconst ALLOWED_TAGS = new Set([\n 'p',\n 'br',\n 'strong',\n 'em',\n 's',\n 'code',\n 'pre',\n 'a',\n 'ul',\n 'ol',\n 'li',\n 'blockquote',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'table',\n 'thead',\n 'tbody',\n 'tr',\n 'th',\n 'td',\n]);\n\nconst parsers = new Map<MarkdownProfile, MarkdownItInstance>();\n\n/**\n * `linkify` is off: turning a bare URL into a link is in neither profile, and\n * it would route text the author never marked up through the URL policy.\n *\n * `breaks` is off because a single newline is not a line break in Markdown;\n * the profile's \"line breaks\" are the two-space and backslash forms, which\n * `hardbreak` carries.\n */\nexport const markdownParser = (\n profile: MarkdownProfile = 'basic',\n): MarkdownItInstance => {\n const existing = parsers.get(profile);\n if (existing) {\n return existing;\n }\n const md = new MarkdownIt({\n html: false,\n linkify: false,\n breaks: false,\n typographer: false,\n });\n md.disable(\n profile === 'extended' ? ALWAYS_OFF : [...ALWAYS_OFF, ...EXTENDED_ONLY],\n /* ignoreInvalid: a rule renamed upstream must not throw at render time. */\n true,\n );\n /*\n markdown-it carries its own scheme check, which refuses `javascript:`,\n `vbscript:`, `file:` and `data:` by turning the link back into plain text\n before a `link_open` token exists. Two reasons to take it over rather than\n leave it in front of the URL policy:\n\n - Section 10 makes the URL policy the authority on link targets. With two\n checks in series the effective policy is their intersection, so a host\n that widens `allowedSchemes` silently gets nothing for the schemes\n markdown-it happens to dislike.\n - A link refused before parsing raises no diagnostic. The author is told\n nothing, and the text keeps the raw `[go](...)` brackets.\n\n Handing every href to `isAllowedUrl` makes one check authoritative and\n every refusal reportable. It is not a loosening: the default policy allows\n https, http and mailto only, which is narrower than what markdown-it\n blocks.\n */\n md.validateLink = () => true;\n parsers.set(profile, md);\n return md;\n};\n\nexport interface MarkdownContext {\n profile?: MarkdownProfile;\n urlPolicy?: UrlPolicy;\n /** Called for a link the policy refuses, so the caller can diagnose it. */\n onRefusedUrl?: (href: string) => void;\n}\n\ninterface Frame {\n /**\n * `null` for a **transparent** frame: one that holds its children's place\n * in the walk but draws nothing of its own.\n *\n * markdown-it wraps every list item's content in a paragraph and sets\n * `hidden` on the wrapper when the list is tight, which is how `- one` ends\n * up as `<li>one</li>` rather than `<li><p>one</p></li>`. The flag has to be\n * honoured: rendering a hidden token puts a block element inside every list\n * item and spaces the list out. It is also why a frame is pushed at all for\n * such a token - the matching close must still find something to pop.\n */\n tag: string | null;\n props: Record<string, unknown>;\n children: React.ReactNode[];\n}\n\n/**\n * Walks a token stream into React nodes.\n *\n * markdown-it emits a flat list whose `nesting` is +1, 0 or -1, so the walk\n * keeps an explicit stack rather than recursing: an opening token pushes a\n * frame, a closing token pops it and appends the finished element to its\n * parent. Keying off `nesting` and `tag` rather than off each token `type`\n * is what lets the two profiles share one walk - an `h2` needs no case of\n * its own, it needs only to be in {@link ALLOWED_TAGS}.\n */\nconst walk = (\n tokens: ReturnType<MarkdownItInstance['parse']>,\n context: MarkdownContext,\n counter: { next: number },\n): React.ReactNode[] => {\n const root: React.ReactNode[] = [];\n const stack: Frame[] = [];\n const push = (node: React.ReactNode) =>\n (stack.length ? stack[stack.length - 1].children : root).push(node);\n const close = () => {\n const frame = stack.pop();\n if (!frame) {\n return;\n }\n if (frame.tag === null) {\n for (const child of frame.children) {\n push(child);\n }\n return;\n }\n push(\n React.createElement(\n frame.tag,\n { key: `md-${counter.next++}`, ...frame.props },\n frame.children.length ? frame.children : undefined,\n ),\n );\n };\n\n for (const token of tokens) {\n if (token.type === 'inline') {\n for (const node of walk(token.children ?? [], context, counter)) {\n push(node);\n }\n continue;\n }\n if (token.nesting === 1) {\n if (token.type === 'link_open') {\n const href = String(token.attrGet('href') ?? '');\n if (isAllowedUrl(href, context.urlPolicy)) {\n stack.push({\n tag: 'a',\n props: { href, target: '_blank', rel: 'noopener noreferrer' },\n children: [],\n });\n } else {\n context.onRefusedUrl?.(href);\n /*\n A refused destination keeps its text and loses its link, which is\n what the Link renderer does under the same policy. A `span` leaves\n the sentence intact without offering anywhere to click.\n */\n stack.push({\n tag: 'span',\n props: { 'data-markdown-url-refused': true },\n children: [],\n });\n }\n continue;\n }\n /*\n An unknown tag still pushes a frame, so its matching close pops this\n one and the nesting stays balanced; `span` is the inert stand-in.\n */\n stack.push({\n tag: token.hidden\n ? null\n : ALLOWED_TAGS.has(token.tag)\n ? token.tag\n : 'span',\n props: {},\n children: [],\n });\n continue;\n }\n if (token.nesting === -1) {\n close();\n continue;\n }\n switch (token.type) {\n case 'text':\n if (token.content) {\n push(token.content);\n }\n break;\n case 'softbreak':\n push(' ');\n break;\n case 'hardbreak':\n push(<br key={`md-${counter.next++}`} />);\n break;\n case 'code_inline':\n push(<code key={`md-${counter.next++}`}>{token.content}</code>);\n break;\n case 'fence':\n case 'code_block':\n /*\n No language class: the info string is author-supplied text, and a\n highlighter is not in the profile. The code is content either way.\n */\n push(\n <pre key={`md-${counter.next++}`}>\n <code>{token.content}</code>\n </pre>,\n );\n break;\n default:\n /*\n A disabled rule emits no tokens, so anything arriving here is a\n construct this profile does not draw. Dropping it is right: the text\n it carried is already in the stream as its own token.\n */\n break;\n }\n }\n /* An unbalanced stream (never seen from markdown-it) still yields its content. */\n while (stack.length) {\n close();\n }\n return root;\n};\n\n/** Parses and renders, in the requested profile. */\nexport const renderMarkdown = (\n markdown: string,\n context: MarkdownContext = {},\n): React.ReactNode[] =>\n walk(markdownParser(context.profile).parse(markdown, {}), context, {\n next: 0,\n });\n\n/** Visible text using the same Markdown profile as the renderer. */\nexport const markdownPlainText = (\n source: string,\n profile: MarkdownProfile,\n): string => {\n const collect = (tokens: any[]): string =>\n tokens\n .map((token) => {\n if (token.children) return collect(token.children);\n if (['text', 'code_inline', 'code_block', 'fence'].includes(token.type))\n return token.content;\n if (\n ['softbreak', 'hardbreak'].includes(token.type) ||\n (token.block && token.nesting === -1)\n )\n return ' ';\n return '';\n })\n .join('');\n return collect(markdownParser(profile).parse(source, {}))\n .replace(/\\s+/g, ' ')\n .trim();\n};\n"],"mappings":"A,6LAyDA,IAAMQ,EAAa,CAAC,QAAS,cAAe,aAAc,IAAI,EAGxDC,EAAgB,CACpB,UACA,WACA,aACA,QACA,QACA,MACF,EAYMC,EAAe,IAAI,IAAI,CAC3B,IACA,KACA,SACA,KACA,IACA,OACA,MACA,IACA,KACA,KACA,KACA,aACA,KACA,KACA,KACA,KACA,KACA,KACA,QACA,QACA,QACA,KACA,KACA,IACF,CAAC,EAEKC,EAAU,IAAI,IAUPC,GACX,EAA2B,UACJ,CACvB,IAAMC,EAAWF,EAAQ,IAAIG,CAAO,EACpC,GAAID,EACF,OAAOA,EAET,IAAME,EAAK,IAAIf,EAAAA,QAAW,CACxB,KAAM,GACN,QAAS,GACT,OAAQ,GACR,YAAa,EACf,CAAC,EA0BD,OAzBAe,EAAG,QACDD,IAAY,WAAaN,EAAa,CAAC,GAAGA,EAAY,GAAGC,CAAa,EAEtE,EACF,EAm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EAAQ,CAAC,CAAC,CAAC,CAAC,CACtD,QAAQ,OAAQ,GAAG,CAAC,CACpB,KAAK,CACV,E"}
@@ -0,0 +1,2 @@
1
+ require("./configNamespaces-sboXDudL.js");let e=require("@chobantonov/jsonforms-react-renderer-common/core/configNamespaces");var t=e=>e.replace(/[\\`*_{}[\]()#+\-.!>|~]/g,e=>`\\${e}`),n=t=>t==null?void 0:t[e.JSONFORMS_EXTENDED_CONFIG_KEY],r=e=>{var t;return(t=n(e))==null?void 0:t.markup},i=e=>{var t;let n=(t=r(e))==null?void 0:t.markdown;return(n==null?void 0:n.enabled)!==!1},a=e=>{var t;return((t=r(e))==null||(t=t.markdown)==null?void 0:t.profile)===`extended`?`extended`:`basic`},o=(e,t)=>{var n;if(typeof(e==null?void 0:e.typography)==`boolean`)return e.typography;let i=(n=r(t))==null?void 0:n.typography;return typeof i!=`boolean`||i},s=(e,t)=>{let n=e==null?void 0:e.markup,r=(e==null?void 0:e.interpolate)===!0,a=o(e,t);return n!==void 0&&n!==`plain`&&n!==`markdown`?{markdown:!1,interpolate:r,typography:a,diagnostic:`markupUnsupported`}:n===`markdown`&&!i(t)?{markdown:!1,interpolate:r,typography:a,diagnostic:`markdownDisabled`}:{markdown:n===`markdown`,interpolate:r,typography:a}},c=e=>(e==null?void 0:e.interpolate)===!0||(e==null?void 0:e.markup)!==void 0&&e.markup!==`plain`;function l(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function u(e,t){if(e==null)return{};var n,r,i=l(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
2
+ //# sourceMappingURL=objectWithoutProperties-6zedhz76.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objectWithoutProperties-6zedhz76.js","names":["JSONFORMS_EXTENDED_CONFIG_KEY","_chobantonov_jsonforms_react_renderer_common_core_configNamespaces","escapeMarkdown","text","match","namespaced","config","markupConfig","_namespaced","\"markup\"","markdownEnabled","_markupConfig","markdown","\"markdown\"","\"enabled\"","markdownProfile","_markupConfig2","\"profile\"","typographyEnabled","_markupConfig3","options","\"typography\"","fromConfig","resolveMarkup","requested","interpolate","\"interpolate\"","typography","wantsMarkup","_objectWithoutPropertiesLoose","r","t","n","e","_objectWithoutProperties","o","s"],"sources":["../src/util/markdownEscape.ts","../src/util/markup.ts"],"sourcesContent":["/**\n * Escaping a substituted value so it cannot introduce Markdown.\n *\n * A module of its own, with no dependencies, because of **where** it is\n * needed. The interpolation path has to escape values before handing them to\n * the parser, but a label that interpolates without asking for Markdown must\n * not download a parser. Leaving this in `markdown.tsx` - which imports\n * markdown-it - would have put the parser in the interpolation chunk, which\n * is exactly the coupling the lazy split exists to avoid.\n */\n\n/**\n * Escapes every character that could start a Markdown construct.\n *\n * Section 9: \"Markdown substitutions are escaped before parsing.\" The order\n * is interpolate -> escape -> parse, and swapping the last two makes the\n * escaping pointless - by then the link already exists.\n *\n * Applied to **substituted values only**, never to the whole template: the\n * author's own `**bold**` in the surrounding text has to keep working, and\n * escaping the finished string would kill it.\n *\n * `<` and `>` are deliberately absent. Raw HTML is not a Markdown construct\n * here - the parser runs with `html: false`, and the result is rendered as\n * React text nodes, which React escapes. Adding them would put visible\n * backslashes in front of ordinary punctuation for no gain.\n */\nexport const escapeMarkdown = (text: string): string =>\n text.replace(/[\\\\`*_{}[\\]()#+\\-.!>|~]/g, (match) => `\\\\${match}`);\n","import { JSONFORMS_EXTENDED_CONFIG_KEY } from './configNamespaces';\n\n/**\n * Resolving what a text element should do with its text.\n *\n * Two independent requests, and either one is enough to take the element away\n * from the plain renderer:\n *\n * - `options.markup: \"markdown\"` asks for the restricted Markdown profile.\n * - `options.interpolate: true` asks for message formatting.\n *\n * With neither, the ordinary label renderer keeps the element - there is\n * nothing here it would do differently, and replacing it would change how\n * every existing form draws its labels.\n */\n\n/** The `markup` values the model defines. */\nexport type Markup = 'plain' | 'markdown';\n\nexport type MarkupDiagnostic =\n /** `markup: \"markdown\"` while the host has the profile switched off. */\n | 'markdownDisabled'\n /** A `markup` value this implementation does not know. */\n | 'markupUnsupported';\n\nexport interface MarkupRequest {\n /** Whether Markdown should actually be parsed. */\n markdown: boolean;\n /** Whether the text should be run through message formatting. */\n interpolate: boolean;\n /** Wrap the result in the UI library's own typography components. */\n typography: boolean;\n /** Set when the request cannot be honoured; see `MarkupDiagnostic`. */\n diagnostic?: MarkupDiagnostic;\n}\n\nconst namespaced = (config: unknown): Record<string, unknown> | undefined =>\n (config as Record<string, unknown> | undefined)?.[\n JSONFORMS_EXTENDED_CONFIG_KEY\n ] as Record<string, unknown> | undefined;\n\nconst markupConfig = (config: unknown): Record<string, unknown> | undefined =>\n namespaced(config)?.['markup'] as Record<string, unknown> | undefined;\n\n/**\n * Whether the host permits Markdown at all.\n *\n * Defaults to **true**, which the recommended configuration states and which\n * differs from the other extension gates. Those gate something that executes;\n * this gates a parser that cannot execute anything, and the profile already\n * excludes raw HTML, images and embedded content.\n */\nexport const markdownEnabled = (config: unknown): boolean => {\n const markdown = markupConfig(config)?.['markdown'] as\n | Record<string, unknown>\n | undefined;\n return markdown?.['enabled'] !== false;\n};\n\n/**\n * Which Markdown profile the host has selected.\n *\n * `basic` unless the host says otherwise, and an unrecognized value falls back\n * to `basic` rather than being reported: a profile name is a host setting, not\n * an authored one, so there is no author on the page to tell about it, and the\n * safe direction for an unknown one is the smaller grammar.\n */\nexport const markdownProfile = (config: unknown): 'basic' | 'extended' =>\n (markupConfig(config)?.['markdown'] as Record<string, unknown> | undefined)?.[\n 'profile'\n ] === 'extended'\n ? 'extended'\n : 'basic';\n\n/**\n * Whether to wrap rendered text in the UI library's typography components.\n *\n * Element option first, then the namespaced default, then **true**. It is\n * switchable because those components carry their own margins, which can\n * fight a form's own spacing - the same collision a non-zero column gap\n * produces.\n */\nexport const typographyEnabled = (\n options: Record<string, unknown> | undefined,\n config: unknown,\n): boolean => {\n if (typeof options?.['typography'] === 'boolean') {\n return options['typography'] as boolean;\n }\n const fromConfig = markupConfig(config)?.['typography'];\n return typeof fromConfig === 'boolean' ? fromConfig : true;\n};\n\n/**\n * What this element is asking for, and whether it can have it.\n *\n * A refused Markdown request keeps `interpolate`: the two are independent, and\n * switching the profile off is not a reason to stop formatting a message.\n */\nexport const resolveMarkup = (\n options: Record<string, unknown> | undefined,\n config: unknown,\n): MarkupRequest => {\n const requested = options?.['markup'];\n const interpolate = options?.['interpolate'] === true;\n const typography = typographyEnabled(options, config);\n\n if (\n requested !== undefined &&\n requested !== 'plain' &&\n requested !== 'markdown'\n ) {\n return {\n markdown: false,\n interpolate,\n typography,\n diagnostic: 'markupUnsupported',\n };\n }\n if (requested === 'markdown' && !markdownEnabled(config)) {\n return {\n markdown: false,\n interpolate,\n typography,\n diagnostic: 'markdownDisabled',\n };\n }\n return { markdown: requested === 'markdown', interpolate, typography };\n};\n\n/**\n * Whether the extended renderer should take this element at all.\n *\n * Deliberately reads the **requested** markup rather than the resolved one: an\n * element asking for Markdown that the host has switched off still belongs\n * here, because the refusal has to be reported. Leaving it to the plain\n * renderer would render the source silently, which is the failure this\n * diagnostic exists to prevent.\n */\nexport const wantsMarkup = (\n options: Record<string, unknown> | undefined,\n): boolean =>\n options?.['interpolate'] === true ||\n (options?.['markup'] !== undefined && options['markup'] !== 'plain');\n"],"mappings":"A,8HA2BA,IAAaE,EAAkB,GAC7BC,EAAK,QAAQ,2BA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 -0,0 +1,58 @@
1
+ import { n as e } from "./configNamespaces-BFclHtB8.mjs";
2
+ // src/util/markdownEscape.ts
3
+ var t = (e) => e.replace(/[\\`*_{}[\]()#+\-.!>|~]/g, (e) => `\\${e}`), n = (t) => t == null ? void 0 : t[e], r = (e) => {
4
+ var t;
5
+ return (t = n(e)) == null ? void 0 : t.markup;
6
+ }, i = (e) => {
7
+ var t;
8
+ let n = (t = r(e)) == null ? void 0 : t.markdown;
9
+ return (n == null ? void 0 : n.enabled) !== !1;
10
+ }, a = (e) => {
11
+ var t;
12
+ return ((t = r(e)) == null || (t = t.markdown) == null ? void 0 : t.profile) === "extended" ? "extended" : "basic";
13
+ }, o = (e, t) => {
14
+ var n;
15
+ if (typeof (e == null ? void 0 : e.typography) == "boolean") return e.typography;
16
+ let i = (n = r(t)) == null ? void 0 : n.typography;
17
+ return typeof i != "boolean" || i;
18
+ }, s = (e, t) => {
19
+ let n = e == null ? void 0 : e.markup, r = (e == null ? void 0 : e.interpolate) === !0, a = o(e, t);
20
+ return n !== void 0 && n !== "plain" && n !== "markdown" ? {
21
+ markdown: !1,
22
+ interpolate: r,
23
+ typography: a,
24
+ diagnostic: "markupUnsupported"
25
+ } : n === "markdown" && !i(t) ? {
26
+ markdown: !1,
27
+ interpolate: r,
28
+ typography: a,
29
+ diagnostic: "markdownDisabled"
30
+ } : {
31
+ markdown: n === "markdown",
32
+ interpolate: r,
33
+ typography: a
34
+ };
35
+ }, c = (e) => (e == null ? void 0 : e.interpolate) === !0 || (e == null ? void 0 : e.markup) !== void 0 && e.markup !== "plain";
36
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/objectWithoutPropertiesLoose.js
37
+ function l(e, t) {
38
+ if (e == null) return {};
39
+ var n = {};
40
+ for (var r in e) if ({}.hasOwnProperty.call(e, r)) {
41
+ if (t.includes(r)) continue;
42
+ n[r] = e[r];
43
+ }
44
+ return n;
45
+ }
46
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/objectWithoutProperties.js
47
+ function u(e, t) {
48
+ if (e == null) return {};
49
+ var n, r, i = l(e, t);
50
+ if (Object.getOwnPropertySymbols) {
51
+ var a = Object.getOwnPropertySymbols(e);
52
+ for (r = 0; r < a.length; r++) n = a[r], t.includes(n) || {}.propertyIsEnumerable.call(e, n) && (i[n] = e[n]);
53
+ }
54
+ return i;
55
+ }
56
+ export { o as a, s as i, i as n, c as o, a as r, t as s, u as t };
57
+
58
+ //# sourceMappingURL=objectWithoutProperties-yjQMyZ0y.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objectWithoutProperties-yjQMyZ0y.mjs","names":["JSONFORMS_EXTENDED_CONFIG_KEY","escapeMarkdown","text","match","namespaced","config","markupConfig","_namespaced","\"markup\"","markdownEnabled","_markupConfig","markdown","\"markdown\"","\"enabled\"","markdownProfile","_markupConfig2","\"profile\"","typographyEnabled","_markupConfig3","options","\"typography\"","fromConfig","resolveMarkup","requested","interpolate","\"interpolate\"","typography","wantsMarkup","_objectWithoutPropertiesLoose","r","t","n","e","_objectWithoutProperties","o","s"],"sources":["../src/util/markdownEscape.ts","../src/util/markup.ts"],"sourcesContent":["/**\n * Escaping a substituted value so it cannot introduce Markdown.\n *\n * A module of its own, with no dependencies, because of **where** it is\n * needed. The interpolation path has to escape values before handing them to\n * the parser, but a label that interpolates without asking for Markdown must\n * not download a parser. Leaving this in `markdown.tsx` - which imports\n * markdown-it - would have put the parser in the interpolation chunk, which\n * is exactly the coupling the lazy split exists to avoid.\n */\n\n/**\n * Escapes every character that could start a Markdown construct.\n *\n * Section 9: \"Markdown substitutions are escaped before parsing.\" The order\n * is interpolate -> escape -> parse, and swapping the last two makes the\n * escaping pointless - by then the link already exists.\n *\n * Applied to **substituted values only**, never to the whole template: the\n * author's own `**bold**` in the surrounding text has to keep working, and\n * escaping the finished string would kill it.\n *\n * `<` and `>` are deliberately absent. Raw HTML is not a Markdown construct\n * here - the parser runs with `html: false`, and the result is rendered as\n * React text nodes, which React escapes. Adding them would put visible\n * backslashes in front of ordinary punctuation for no gain.\n */\nexport const escapeMarkdown = (text: string): string =>\n text.replace(/[\\\\`*_{}[\\]()#+\\-.!>|~]/g, (match) => `\\\\${match}`);\n","import { JSONFORMS_EXTENDED_CONFIG_KEY } from './configNamespaces';\n\n/**\n * Resolving what a text element should do with its text.\n *\n * Two independent requests, and either one is enough to take the element away\n * from the plain renderer:\n *\n * - `options.markup: \"markdown\"` asks for the restricted Markdown profile.\n * - `options.interpolate: true` asks for message formatting.\n *\n * With neither, the ordinary label renderer keeps the element - there is\n * nothing here it would do differently, and replacing it would change how\n * every existing form draws its labels.\n */\n\n/** The `markup` values the model defines. */\nexport type Markup = 'plain' | 'markdown';\n\nexport type MarkupDiagnostic =\n /** `markup: \"markdown\"` while the host has the profile switched off. */\n | 'markdownDisabled'\n /** A `markup` value this implementation does not know. */\n | 'markupUnsupported';\n\nexport interface MarkupRequest {\n /** Whether Markdown should actually be parsed. */\n markdown: boolean;\n /** Whether the text should be run through message formatting. */\n interpolate: boolean;\n /** Wrap the result in the UI library's own typography components. */\n typography: boolean;\n /** Set when the request cannot be honoured; see `MarkupDiagnostic`. */\n diagnostic?: MarkupDiagnostic;\n}\n\nconst namespaced = (config: unknown): Record<string, unknown> | undefined =>\n (config as Record<string, unknown> | undefined)?.[\n JSONFORMS_EXTENDED_CONFIG_KEY\n ] as Record<string, unknown> | undefined;\n\nconst markupConfig = (config: unknown): Record<string, unknown> | undefined =>\n namespaced(config)?.['markup'] as Record<string, unknown> | undefined;\n\n/**\n * Whether the host permits Markdown at all.\n *\n * Defaults to **true**, which the recommended configuration states and which\n * differs from the other extension gates. Those gate something that executes;\n * this gates a parser that cannot execute anything, and the profile already\n * excludes raw HTML, images and embedded content.\n */\nexport const markdownEnabled = (config: unknown): boolean => {\n const markdown = markupConfig(config)?.['markdown'] as\n | Record<string, unknown>\n | undefined;\n return markdown?.['enabled'] !== false;\n};\n\n/**\n * Which Markdown profile the host has selected.\n *\n * `basic` unless the host says otherwise, and an unrecognized value falls back\n * to `basic` rather than being reported: a profile name is a host setting, not\n * an authored one, so there is no author on the page to tell about it, and the\n * safe direction for an unknown one is the smaller grammar.\n */\nexport const markdownProfile = (config: unknown): 'basic' | 'extended' =>\n (markupConfig(config)?.['markdown'] as Record<string, unknown> | undefined)?.[\n 'profile'\n ] === 'extended'\n ? 'extended'\n : 'basic';\n\n/**\n * Whether to wrap rendered text in the UI library's typography components.\n *\n * Element option first, then the namespaced default, then **true**. It is\n * switchable because those components carry their own margins, which can\n * fight a form's own spacing - the same collision a non-zero column gap\n * produces.\n */\nexport const typographyEnabled = (\n options: Record<string, unknown> | undefined,\n config: unknown,\n): boolean => {\n if (typeof options?.['typography'] === 'boolean') {\n return options['typography'] as boolean;\n }\n const fromConfig = markupConfig(config)?.['typography'];\n return typeof fromConfig === 'boolean' ? fromConfig : true;\n};\n\n/**\n * What this element is asking for, and whether it can have it.\n *\n * A refused Markdown request keeps `interpolate`: the two are independent, and\n * switching the profile off is not a reason to stop formatting a message.\n */\nexport const resolveMarkup = (\n options: Record<string, unknown> | undefined,\n config: unknown,\n): MarkupRequest => {\n const requested = options?.['markup'];\n const interpolate = options?.['interpolate'] === true;\n const typography = typographyEnabled(options, config);\n\n if (\n requested !== undefined &&\n requested !== 'plain' &&\n requested !== 'markdown'\n ) {\n return {\n markdown: false,\n interpolate,\n typography,\n diagnostic: 'markupUnsupported',\n };\n }\n if (requested === 'markdown' && !markdownEnabled(config)) {\n return {\n markdown: false,\n interpolate,\n typography,\n diagnostic: 'markdownDisabled',\n };\n }\n return { markdown: requested === 'markdown', interpolate, typography };\n};\n\n/**\n * Whether the extended renderer should take this element at all.\n *\n * Deliberately reads the **requested** markup rather than the resolved one: an\n * element asking for Markdown that the host has switched off still belongs\n * here, because the refusal has to be reported. Leaving it to the plain\n * renderer would render the source silently, which is the failure this\n * diagnostic exists to prevent.\n */\nexport const wantsMarkup = (\n options: Record<string, unknown> | undefined,\n): boolean =>\n options?.['interpolate'] === true ||\n (options?.['markup']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,OAAA,KAAA,IAC5BA,EAAUX,YAAc,KAAA,KAAaW,EAAQX,WAAc"}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { ControlProps } from '@jsonforms/core';
3
+ import { EditorRendererComponents } from '../components/editorRendererTypes';
4
+ /**
5
+ * ag-grid-community + ag-grid-react are ~1MB; importing them here would put
6
+ * them in the main bundle for every form, so the implementation is fetched
7
+ * only once a grid control is actually rendered.
8
+ */
9
+ export declare const createAgGridControl: (components: EditorRendererComponents) => React.ComponentType<ControlProps>;
10
+ export declare const createAgGridControlRenderer: (components: EditorRendererComponents) => React.ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ControlProps } from '@jsonforms/core';
3
+ import { EditorRendererComponents } from '../components/editorRendererTypes';
4
+ export declare const createAgGridControl: ({ Button, RowDetailButton, RowErrorIndicator, EditIcon, ShowDetailsIcon, HideDetailsIcon, RowDetailFrame, AddIcon, RemoveIcon, useRemoveConfirmation, ArrayFrame, CellFrame, useEditorTheme, }: EditorRendererComponents) => (props: ControlProps) => React.JSX.Element | null;
@@ -0,0 +1,83 @@
1
+ import React from 'react';
2
+ import { BaseUISchemaElement, LayoutProps, RankedTester } from '@jsonforms/core';
3
+ import { TranslateProps } from '@jsonforms/react';
4
+ import { type ActionEvent } from '../util/actionContext';
5
+ /**
6
+ * `Button` - invoking a command, as opposed to `Link`, which navigates.
7
+ *
8
+ * Section 14 puts `label`, `icon`, `color`, `params`, `action` and `script`
9
+ * at the **top level** of the element. `options` is still read underneath
10
+ * them, because forms in this repository were authored that way.
11
+ *
12
+ * `action` and `script` are mutually exclusive. The action path hands an
13
+ * `ActionEvent` to the host and awaits it; the script path runs a string
14
+ * directly and is gated on the script-evaluation permission.
15
+ */
16
+ export type ButtonSemanticColor = 'primary' | 'secondary' | 'alternative' | 'success' | 'warning' | 'error';
17
+ /**
18
+ * A `script` written in TypeScript rather than serialized.
19
+ *
20
+ * The event arrives as the **first argument**. `this` is bound to it as well,
21
+ * so a body pasted across from the string form keeps working - but an
22
+ * argument is the idiom, because `.call()` cannot bind an arrow function's
23
+ * `this` and an arrow is what anyone writes by reflex:
24
+ *
25
+ * ```ts
26
+ * script: (event) => console.log(event.context) // works
27
+ * script: function () { console.log(this.context); } // also works
28
+ * script: () => console.log(this.context) // `this` is undefined
29
+ * ```
30
+ *
31
+ * Section 14 places function-valued scripts outside the portable model, so
32
+ * this is a build-time authoring convenience and never appears on the wire.
33
+ */
34
+ export type ButtonScript = string | ((this: ActionEvent, event: ActionEvent) => void | Promise<void>);
35
+ export type ButtonUiSchemaBase = BaseUISchemaElement & {
36
+ type: 'Button';
37
+ label?: string;
38
+ text?: string;
39
+ name?: string;
40
+ icon?: string;
41
+ color?: ButtonSemanticColor;
42
+ params?: Record<string, unknown>;
43
+ options?: {
44
+ disabled?: boolean;
45
+ fullWidth?: boolean;
46
+ [key: string]: unknown;
47
+ };
48
+ };
49
+ /**
50
+ * `action` and `script` are **mutually exclusive**, and the type says so.
51
+ *
52
+ * Section 14 states the exclusivity without saying which wins, because an
53
+ * element carrying both is an authoring mistake. The `never` members make it
54
+ * one TypeScript refuses to compile; the runtime still has to cope, because
55
+ * JSON-authored forms never pass through this type.
56
+ */
57
+ export type ButtonUiSchema = (ButtonUiSchemaBase & {
58
+ action: string;
59
+ script?: never;
60
+ }) | (ButtonUiSchemaBase & {
61
+ script: ButtonScript;
62
+ action?: never;
63
+ }) | (ButtonUiSchemaBase & {
64
+ action?: never;
65
+ script?: never;
66
+ });
67
+ export type ButtonRendererComponentProps = LayoutProps & TranslateProps & {
68
+ uischema: ButtonUiSchema;
69
+ };
70
+ export type ButtonRendererOptions = {
71
+ /** Return the component before JSON Forms prop injection for native adapter exports. */
72
+ withProps?: boolean;
73
+ ButtonComponent?: React.ComponentType<any>;
74
+ buttonProps?: Record<string, any>;
75
+ getButtonProps?: (props: ButtonRendererComponentProps & {
76
+ pending: boolean;
77
+ color?: ButtonSemanticColor;
78
+ icon?: string;
79
+ }) => Record<string, any>;
80
+ };
81
+ export declare const buttonRendererTester: RankedTester;
82
+ export declare const createButtonRenderer: ({ withProps, ButtonComponent, buttonProps, getButtonProps, }?: ButtonRendererOptions) => React.ComponentType<LayoutProps & import("@jsonforms/core").OwnPropsOfLayout> | ((props: ButtonRendererComponentProps) => React.JSX.Element | null);
83
+ export declare const ButtonRenderer: React.ComponentType<LayoutProps & import("@jsonforms/core").OwnPropsOfLayout> | ((props: ButtonRendererComponentProps) => React.JSX.Element | null);
@@ -0,0 +1,9 @@
1
+ import { ControlProps, JsonSchema, RankedTester, Scopable, TesterContext, UISchemaElement } from '@jsonforms/core';
2
+ import React from 'react';
3
+ import { type JsonDataType } from '@chobantonov/jsonforms-react-renderer-common/mixed/mixedSchema';
4
+ export declare const schemaForType: (schema: JsonSchema, type: JsonDataType, rootSchema: JsonSchema) => JsonSchema;
5
+ export declare const GenericMixedRendererComponent: ({ cells, data, enabled, handleChange, label, path, renderers, readonly, rootSchema, schema, uischema, visible, }: ControlProps) => React.JSX.Element | null;
6
+ export declare const isMixedSchema: (uischema: UISchemaElement & Scopable, schema: JsonSchema, context: TesterContext) => boolean;
7
+ export declare const isMixedControl: (uischema: UISchemaElement, schema: JsonSchema, context: TesterContext) => boolean;
8
+ export declare const genericMixedControlTester: RankedTester;
9
+ export declare const GenericMixedRenderer: React.ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
@@ -0,0 +1,5 @@
1
+ import { LayoutProps, RankedTester } from '@jsonforms/core';
2
+ import React from 'react';
3
+ export declare const horizontalColumnsLayoutTester: RankedTester;
4
+ export declare const HorizontalColumnsLayoutRendererComponent: (props: LayoutProps) => React.JSX.Element | null;
5
+ export declare const HorizontalColumnsLayoutRenderer: React.ComponentType<LayoutProps & import("@jsonforms/core").OwnPropsOfLayout>;
@@ -0,0 +1,48 @@
1
+ import { JsonSchema, LayoutProps, RankedTester, UISchemaElement } from '@jsonforms/core';
2
+ import React from 'react';
3
+ /**
4
+ * `ImageView` - a display-only image, sourced directly or from the data.
5
+ *
6
+ * Section 13 puts `src`, `scope` and `alt` at the **top level** of the
7
+ * element, not in `options`. At least one of `src` and `scope` must be
8
+ * supplied, and the two are not interchangeable fallbacks for one another: a
9
+ * defined `src` wins outright, *including the empty string*, which is how an
10
+ * author says "no image here" without removing the element.
11
+ */
12
+ export declare const imageViewRendererTester: RankedTester;
13
+ export type ImageViewElement = UISchemaElement & {
14
+ type: 'ImageView';
15
+ src?: string;
16
+ scope?: string;
17
+ alt?: string;
18
+ };
19
+ /** Stable machine-readable codes, per section 21. */
20
+ export type ImageViewDiagnosticCode = 'image.noSource' | 'image.missingAlt' | 'image.scopeNotString' | 'image.nonStringSource' | 'image.urlRefused';
21
+ export interface ImageViewDiagnostic {
22
+ code: ImageViewDiagnosticCode;
23
+ severity: 'warning' | 'error';
24
+ message: string;
25
+ values?: Record<string, unknown>;
26
+ }
27
+ export interface ResolvedImageView {
28
+ /** The URL to render, or undefined for "show no image". */
29
+ src?: string;
30
+ alt: string;
31
+ diagnostics: ImageViewDiagnostic[];
32
+ }
33
+ /**
34
+ * The whole of section 13's source resolution, with no React in it.
35
+ *
36
+ * Kept separate from the component because the precedence is the part worth
37
+ * testing directly: which of `src` and `scope` wins, when an empty value is a
38
+ * deliberate blank rather than a missing one, and which failures are silent.
39
+ */
40
+ export declare const resolveImageView: (element: ImageViewElement, args: {
41
+ schema?: JsonSchema;
42
+ rootSchema?: JsonSchema;
43
+ data?: unknown;
44
+ path?: string;
45
+ config?: unknown;
46
+ }) => ResolvedImageView;
47
+ export declare const ImageViewRendererComponent: ({ config, uischema, schema, path, visible, }: LayoutProps) => React.JSX.Element | null;
48
+ export declare const ImageViewRenderer: React.ComponentType<LayoutProps & import("@jsonforms/core").OwnPropsOfLayout>;
@@ -0,0 +1,23 @@
1
+ import { LayoutProps, RankedTester, UISchemaElement } from '@jsonforms/core';
2
+ import { TranslateProps } from '@jsonforms/react';
3
+ import React from 'react';
4
+ export type LinkElement = UISchemaElement & {
5
+ type: 'Link';
6
+ label?: string;
7
+ href?: string;
8
+ target?: '_self' | '_blank' | '_parent' | '_top';
9
+ rel?: string;
10
+ };
11
+ export declare const linkRendererTester: RankedTester;
12
+ /**
13
+ * `rel` for a link, given its target.
14
+ *
15
+ * `target="_blank"` hands the opened page a `window.opener` reference to this
16
+ * one unless `noopener` is set, which lets it navigate the form away. The
17
+ * specification makes `noopener` a MUST and `noreferrer` a SHOULD. An
18
+ * author-supplied `rel` is kept and these are added to it rather than
19
+ * replacing it.
20
+ */
21
+ export declare const linkRel: (target: string | undefined, rel: string | undefined) => string | undefined;
22
+ export declare const LinkRendererComponent: ({ uischema, visible, config, t, }: LayoutProps & TranslateProps) => React.JSX.Element | null;
23
+ export declare const LinkRenderer: (props: LayoutProps & import("@jsonforms/core").OwnPropsOfLayout) => React.JSX.Element;
@@ -0,0 +1,35 @@
1
+ import { LabelProps, RankedTester } from '@jsonforms/core';
2
+ import React from 'react';
3
+ /**
4
+ * Rank 3, above the base `Label` renderer's 1.
5
+ *
6
+ * Not 2: the antd renderer set reserves 2 for its own overrides of core
7
+ * elements, and a markup label has to beat those too.
8
+ */
9
+ export declare const markupLabelTester: RankedTester;
10
+ /**
11
+ * The UI library's own text component, if the binding package supplies one.
12
+ *
13
+ * `block` says what it is being handed. Parsed Markdown is already block
14
+ * content - paragraphs, lists - while plain text is a single run, and a
15
+ * library whose paragraph component renders an actual `<p>` must not wrap the
16
+ * former in it: `<p>` accepts phrasing content only, so a `<p>` or a `<ul>`
17
+ * inside one is invalid and the browser closes the outer tag early, leaving a
18
+ * tree that does not match what React thinks it rendered.
19
+ *
20
+ * It is one slot with a flag rather than two components because for some
21
+ * libraries the two coincide - antd's `Typography.Paragraph` renders a `div`,
22
+ * so it is safe for both - and a binding should be able to say that by
23
+ * ignoring the flag rather than by naming the same component twice.
24
+ */
25
+ export type MarkupTypography = React.ComponentType<{
26
+ block: boolean;
27
+ children?: React.ReactNode;
28
+ }>;
29
+ export interface MarkupLabelProps extends LabelProps {
30
+ typography?: MarkupTypography;
31
+ }
32
+ export declare const MarkupLabelRendererComponent: ({ uischema, text, visible, config, typography, }: MarkupLabelProps) => React.JSX.Element | null;
33
+ export declare const MarkupLabelRenderer: React.ComponentType<import("@jsonforms/core").OwnPropsOfLabel>;
34
+ /** Binds the typography slots, for a renderer set that has them. */
35
+ export declare const createMarkupLabelRenderer: (typography: MarkupTypography) => React.ComponentType<import("@jsonforms/core").OwnPropsOfLabel>;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { MarkdownProfile } from '../util/markdown';
3
+ import { UrlPolicy } from '../util/urlPolicy';
4
+ export interface MarkdownTextProps {
5
+ text: string;
6
+ profile: MarkdownProfile;
7
+ urlPolicy: UrlPolicy;
8
+ onRefusedUrl?: (href: string) => void;
9
+ }
10
+ /**
11
+ * The half of the markup label that needs the parser.
12
+ *
13
+ * Split into its own module so `import('./MarkupLabelRenderer.impl')` gives
14
+ * the bundler a seam: a form with no Markdown label never downloads
15
+ * markdown-it.
16
+ */
17
+ export declare const MarkdownText: ({ text, profile, urlPolicy, onRefusedUrl, }: MarkdownTextProps) => React.JSX.Element;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { EditorRendererComponents } from '../components/editorRendererTypes';
3
+ /**
4
+ * @monaco-editor/react pulls in the Monaco loader; importing it here would put
5
+ * it in the main bundle for every form, so the implementation is fetched only
6
+ * once a code editor control is actually rendered.
7
+ */
8
+ export declare const createMonacoControlRenderer: (components: EditorRendererComponents) => React.ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { ControlProps } from '@jsonforms/core';
3
+ import { EditorRendererComponents } from '../components/editorRendererTypes';
4
+ export declare const createMonacoControl: ({ Frame, Button, MaximizeIcon, MinimizeIcon, Surface, useEditorTheme, }: EditorRendererComponents) => (props: ControlProps) => React.JSX.Element | null;
@@ -0,0 +1,6 @@
1
+ import { LayoutProps } from '@jsonforms/core';
2
+ import React from 'react';
3
+ import { TemplateLayoutElement } from '../util/templateLang';
4
+ export declare const RactiveTemplateLayoutRenderer: (props: LayoutProps & {
5
+ uischema: TemplateLayoutElement;
6
+ }) => React.JSX.Element | null;
@@ -0,0 +1,17 @@
1
+ import { LayoutProps, RankedTester } from '@jsonforms/core';
2
+ import React from 'react';
3
+ export declare const separatorRendererTester: RankedTester;
4
+ /**
5
+ * `Separator` - a static divider that reads and writes nothing.
6
+ *
7
+ * `options.vertical` is section 13's single orientation encoding, the same
8
+ * convention `vertical` follows everywhere else in this project. An `<hr>` has
9
+ * an implicit `separator` role whose default orientation is horizontal, so a
10
+ * vertical one has to say so: `aria-orientation` is what tells a screen reader
11
+ * the sections are side by side rather than stacked.
12
+ *
13
+ * The extent comes from the layout, as the specification requires - a vertical
14
+ * separator needs usable height from its context, and supplies none itself.
15
+ */
16
+ export declare const SeparatorRendererComponent: ({ uischema, visible, }: LayoutProps) => React.JSX.Element | null;
17
+ export declare const SeparatorRenderer: React.ComponentType<LayoutProps & import("@jsonforms/core").OwnPropsOfLayout>;
@@ -0,0 +1,5 @@
1
+ import { LayoutProps, RankedTester } from '@jsonforms/core';
2
+ import React from 'react';
3
+ export declare const slotRendererTester: RankedTester;
4
+ export declare const SlotRendererComponent: (props: LayoutProps) => React.JSX.Element | null;
5
+ export declare const SlotRenderer: React.ComponentType<LayoutProps & import("@jsonforms/core").OwnPropsOfLayout>;