@kubohiroya/turbowarp-extension-data-editor 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -6
- package/dist/build-info.json +4 -4
- package/dist/fixed-input-branches.d.ts +12 -0
- package/dist/fixed-input-branches.js +180 -0
- package/dist/fixed-input-editor.d.ts +39 -0
- package/dist/fixed-input-editor.js +538 -0
- package/dist/fixed-input-schema.d.ts +15 -0
- package/dist/fixed-input-schema.js +21 -0
- package/dist/fixed-input-snapshot.d.ts +7 -0
- package/dist/fixed-input-snapshot.js +180 -0
- package/dist/fixed-input-types.d.ts +138 -0
- package/dist/fixed-input-types.js +23 -0
- package/dist/fixed-input-view.d.ts +14 -0
- package/dist/fixed-input-view.js +168 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +4 -0
- package/dist/react.css +42 -0
- package/dist/react.d.ts +3 -0
- package/dist/react.js +10 -1
- package/dist/registry.d.ts +4 -0
- package/dist/registry.js +45 -7
- package/dist/rjsf.d.ts +24 -1
- package/dist/rjsf.js +22 -2
- package/dist/schema.d.ts +2 -0
- package/dist/schema.js +1 -0
- package/dist/session.d.ts +3 -1
- package/dist/session.js +205 -7
- package/dist/turbowarp/bridge.d.ts +2 -1
- package/dist/turbowarp/bridge.js +34 -5
- package/dist/turbowarp/fixed-fields.d.ts +82 -0
- package/dist/turbowarp/fixed-fields.js +311 -0
- package/dist/turbowarp/fixed-transaction.d.ts +18 -0
- package/dist/turbowarp/fixed-transaction.js +460 -0
- package/dist/turbowarp/host.d.ts +3 -8
- package/dist/turbowarp/host.js +68 -1
- package/dist/turbowarp.d.ts +4 -0
- package/dist/turbowarp.js +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/view.js +4 -0
- package/dist/webpack4/index.js +22 -5
- package/dist/webpack4/metafile.json +588 -319
- package/dist/webpack4/react.js +9 -1
- package/dist/webpack4/react.js.map +2 -2
- package/dist/webpack4/rjsf.js +249 -34
- package/dist/webpack4/rjsf.js.map +4 -4
- package/dist/webpack4/schema.js +6 -3
- package/dist/webpack4/{shared-KQOUMWJ4.js → shared-75QIWLZY.js} +1129 -1244
- package/dist/webpack4/{shared-KQOUMWJ4.js.map → shared-75QIWLZY.js.map} +4 -4
- package/dist/webpack4/shared-FYUILHED.js +1 -0
- package/dist/webpack4/shared-GQLPPRT2.js +210 -0
- package/dist/webpack4/shared-GQLPPRT2.js.map +7 -0
- package/dist/webpack4/shared-P2JBRZFP.js +2206 -0
- package/dist/webpack4/shared-P2JBRZFP.js.map +7 -0
- package/dist/webpack4/turbowarp.js +910 -9
- package/dist/webpack4/turbowarp.js.map +4 -4
- package/docs/fixed-input-contracts.md +77 -0
- package/docs/stage-2-publication.ja.md +6 -0
- package/package.json +8 -1
- package/dist/webpack4/shared-CQB3NG2A.js +0 -1
- package/dist/webpack4/shared-MRPGBJIH.js +0 -75
- package/dist/webpack4/shared-MRPGBJIH.js.map +0 -7
- package/dist/webpack4/shared-N6YQE2X6.js +0 -1029
- package/dist/webpack4/shared-N6YQE2X6.js.map +0 -7
- /package/dist/webpack4/{shared-CQB3NG2A.js.map → shared-FYUILHED.js.map} +0 -0
package/dist/webpack4/react.js
CHANGED
|
@@ -317,6 +317,14 @@ var BlockEditorDialog = class extends React.Component {
|
|
|
317
317
|
const { styles, messages, ModalComponent, session } = this.props;
|
|
318
318
|
const saving = this.state.status === "saving";
|
|
319
319
|
const hierarchy = typeof session.getNodes === "function";
|
|
320
|
+
let fixed = false;
|
|
321
|
+
if (session.getFixedInputView && (this.state.status === "editing" || saving)) {
|
|
322
|
+
try {
|
|
323
|
+
fixed = Boolean(session.getFixedInputView());
|
|
324
|
+
} catch (_a) {
|
|
325
|
+
fixed = true;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
320
328
|
return React.createElement(
|
|
321
329
|
ModalComponent,
|
|
322
330
|
{ className: `${styles.modalContent || ""} ${hierarchy ? styles.hierarchyModal : ""} ${this.props.className || ""}`, contentLabel: messages.title, id: "blockEditorModal", onRequestClose: this.handleClose },
|
|
@@ -340,7 +348,7 @@ var BlockEditorDialog = class extends React.Component {
|
|
|
340
348
|
"div",
|
|
341
349
|
{ "aria-live": "polite", className: styles.errors, role: "status" },
|
|
342
350
|
saving ? messages.saving : null,
|
|
343
|
-
this.state.issues.map((issue, index) => {
|
|
351
|
+
fixed && this.state.issues.length ? React.createElement("p", null, messages.invalidInput || messages.failed) : this.state.issues.map((issue, index) => {
|
|
344
352
|
var _a;
|
|
345
353
|
return hierarchy && "reference" in issue ? React.createElement(
|
|
346
354
|
"button",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../field-errors.js", "../react.js"],
|
|
4
|
-
"sourcesContent": ["// RJSF owns validation and messages; this adapter only decorates its rendered errors.\nconst bindBlockEditorFieldErrors = (container) => {\n const originals = new Map();\n const originalValue = (element, name) => {\n const values = originals.get(element);\n const previous = values && values.get(name);\n const current = element.getAttribute(name);\n return previous && current === previous.applied ? previous.original : current;\n };\n const setAttribute = (element, name, value) => {\n if (element.getAttribute(name) === value)\n return;\n const original = originalValue(element, name);\n if (!originals.has(element))\n originals.set(element, new Map());\n originals.get(element).set(name, { original, applied: value });\n element.setAttribute(name, value);\n };\n const restore = (element) => {\n for (const [name, { original, applied }] of originals.get(element)) {\n // Do not overwrite attributes subsequently changed by RJSF or a custom widget.\n if (element.getAttribute(name) !== applied)\n continue;\n if (original === null)\n element.removeAttribute(name);\n else\n element.setAttribute(name, original);\n }\n originals.delete(element);\n };\n const sync = () => {\n const invalid = new Set();\n const decorate = (element, messages, group = false) => {\n invalid.add(element);\n setAttribute(element, 'aria-invalid', 'true');\n setAttribute(element, 'data-block-editor-invalid', group ? 'group' : 'true');\n const descriptions = new Set((originalValue(element, 'aria-describedby') || '')\n .split(/\\s+/).filter(Boolean));\n for (const message of messages)\n descriptions.add(message.id);\n setAttribute(element, 'aria-describedby', [...descriptions].join(' '));\n if (group && !originalValue(element, 'role'))\n setAttribute(element, 'role', 'group');\n if (group && !element.hasAttribute('aria-label') && !originalValue(element, 'aria-labelledby')) {\n const titles = messages.map(message => message.id.replace(/__error$/, '__title'))\n .filter(id => {\n const title = element.ownerDocument.getElementById(id);\n return title && element.contains(title);\n });\n if (titles.length)\n setAttribute(element, 'aria-labelledby', titles.join(' '));\n }\n };\n for (const field of container.querySelectorAll('.rjsf .field.has-error')) {\n const messages = [...field.querySelectorAll('.error-detail[id]')].filter(message => { var _a; return message.closest('.field') === field && ((_a = message.textContent) === null || _a === void 0 ? void 0 : _a.trim()); });\n if (!messages.length)\n continue;\n if (field.classList.contains('field-object') || field.classList.contains('field-array')) {\n // Group constraints must not mark otherwise valid descendant controls as invalid.\n decorate(field, messages, true);\n continue;\n }\n for (const control of field.querySelectorAll('input:not([type=\"hidden\"]), select, textarea')) {\n if (control.closest('.field') !== field)\n continue;\n const descriptions = (control.getAttribute('aria-describedby') || '').split(/\\s+/);\n const ownMessages = messages.filter(message => descriptions.includes(message.id) ||\n message.id === `${control.id}__error`);\n if (ownMessages.length)\n decorate(control, ownMessages);\n }\n }\n for (const element of originals.keys()) {\n if (!invalid.has(element))\n restore(element);\n }\n };\n const observer = new container.ownerDocument.defaultView.MutationObserver(sync);\n observer.observe(container, { childList: true,\n subtree: true,\n characterData: true,\n attributes: true,\n attributeFilter: ['class', 'id'] });\n sync();\n return () => {\n observer.disconnect();\n for (const element of originals.keys())\n restore(element);\n };\n};\nexport default bindBlockEditorFieldErrors;\n", "import bindBlockEditorFieldErrors from './field-errors.js';\nexport { default as bindBlockEditorFieldErrors } from './field-errors.js';\nimport * as React from 'react';\nimport { BlockEditorConflictError } from './types.js';\nimport { BlockEditorStructureError } from './descendant-types.js';\nclass NodeBody extends React.Component {\n constructor() {\n super(...arguments);\n this.body = null;\n }\n componentDidMount() {\n try {\n this.unmountBody = this.props.editor.mount(this.body);\n }\n catch (error) {\n this.props.onError(error);\n }\n }\n componentWillUnmount() {\n var _a;\n try {\n (_a = this.unmountBody) === null || _a === void 0 ? void 0 : _a.call(this);\n }\n catch (error) {\n this.props.onError(error);\n }\n }\n render() { return React.createElement(\"div\", { ref: body => { this.body = body; } }); }\n}\nlet nextBodyId = 0;\nclass DescendantTree extends React.Component {\n constructor(props) {\n super(props);\n this.nodes = this.props.session.getNodes();\n this.children = new Map();\n this.sections = new Map();\n this.bodyIds = new Map();\n for (const node of this.nodes) {\n const path = node.inputPath;\n const parent = path.length ? path[path.length - 1].blockId : null;\n if (!this.children.has(parent))\n this.children.set(parent, []);\n this.children.get(parent).push(node);\n this.bodyIds.set(node.reference.blockId, `block-editor-node-${++nextBodyId}`);\n }\n this.state = { failedIcons: new Set(), expanded: new Set(this.nodes.filter(node => this.nodes.length <= 30 || node.inputPath.length === 0).map(node => node.reference.blockId)) };\n }\n componentWillUnmount() {\n if (this.focusFrame !== undefined)\n cancelAnimationFrame(this.focusFrame);\n }\n reveal(issue) {\n if (!issue || !('reference' in issue))\n return;\n const expanded = new Set(this.state.expanded);\n for (const step of issue.inputPath)\n expanded.add(step.blockId);\n expanded.add(issue.reference.blockId);\n this.setState({ expanded }, () => {\n if (this.focusFrame !== undefined)\n cancelAnimationFrame(this.focusFrame);\n this.focusFrame = requestAnimationFrame(() => {\n var _a;\n const section = this.sections.get(issue.reference.blockId);\n if (!section)\n return;\n const controls = [...section.querySelectorAll('input, textarea, select')];\n const path = (issue.path || '').replace(/^\\./, '').replace(/\\[(\\d+)\\]/g, '_$1').replace(/\\./g, '_');\n const field = controls.find(control => path && control.id.endsWith(`_${path}`)) || controls[0];\n const target = field || section.querySelector('button');\n target === null || target === void 0 ? void 0 : target.focus();\n (_a = target === null || target === void 0 ? void 0 : target.scrollIntoView) === null || _a === void 0 ? void 0 : _a.call(target, { block: 'nearest' });\n });\n });\n }\n toggle(id) {\n const expanded = new Set(this.state.expanded);\n if (expanded.has(id))\n expanded.delete(id);\n else\n expanded.add(id);\n this.setState({ expanded });\n }\n renderNode(node) {\n var _a, _b, _c;\n const { styles, session, messages } = this.props;\n const id = node.reference.blockId;\n const expanded = this.state.expanded.has(id);\n const editor = (_a = session.getEditor) === null || _a === void 0 ? void 0 : _a.call(session, id);\n const step = node.inputPath[node.inputPath.length - 1];\n const appearance = ((_b = this.props.nodeAppearances) === null || _b === void 0 ? void 0 : _b[id]) || {};\n const label = appearance.name || ((_c = this.props.nodeLabels) === null || _c === void 0 ? void 0 : _c[id]) || node.opcode;\n const style = {\n '--block-editor-node-colour': appearance.colour,\n '--block-editor-node-tint': appearance.tint\n };\n return React.createElement(\"section\", { className: styles.treeNode, \"data-block-editor-node\": id, key: id, style: style, ref: section => { if (section)\n this.sections.set(id, section);\n else\n this.sections.delete(id); } },\n React.createElement(\"h3\", { className: styles.nodeHeading },\n React.createElement(\"button\", { \"aria-controls\": this.bodyIds.get(id), \"aria-expanded\": expanded, \"data-block-editor-toggle\": id, disabled: this.props.disabled, type: \"button\", onClick: () => this.toggle(id) },\n React.createElement(\"span\", { \"aria-hidden\": \"true\" }, expanded ? '\u25BE ' : '\u25B8 '),\n appearance.iconURI && !this.state.failedIcons.has(id) ? React.createElement(\"img\", { alt: \"\", \"aria-hidden\": \"true\", className: styles.nodeIcon, \"data-block-editor-node-icon\": id, draggable: false, src: appearance.iconURI, onError: () => this.setState(state => ({ failedIcons: new Set([...state.failedIcons, id]) })) }) : null,\n React.createElement(\"span\", { className: styles.nodeCaption },\n React.createElement(\"span\", { \"data-block-editor-node-name\": id }, label),\n React.createElement(\"span\", { className: styles.nodeIdentity },\n step ? React.createElement(\"span\", { className: styles.branchName }, `${step.input} \u00B7 ${step.index + 1}: `) : null,\n id)))),\n React.createElement(\"div\", { hidden: !expanded, id: this.bodyIds.get(id) }, expanded ? React.createElement(React.Fragment, null,\n editor ? React.createElement(NodeBody, { editor: editor, onError: this.props.onError }) :\n React.createElement(\"p\", { className: styles.structuralNode }, messages.structuralNode),\n (this.children.get(id) || []).map(child => this.renderNode(child))) : null));\n }\n render() {\n return React.createElement(\"div\", { className: this.props.styles.tree }, (this.children.get(null) || []).map(node => this.renderNode(node)));\n }\n}\n/** The host injects its modal, localized strings and stylesheet mapping; no GUI imports are needed. */\nexport class BlockEditorDialog extends React.Component {\n constructor(props) {\n super(props);\n this.mounted = false;\n this.unmounting = false;\n this.composing = false;\n this.body = null;\n this.tree = null;\n this.removeListener = () => { };\n this.handleBody = (body) => {\n this.body = body;\n if (this.mounted)\n this.mountBody();\n };\n this.handleMountError = (error) => {\n var _a, _b;\n (_b = (_a = this.props).onError) === null || _b === void 0 ? void 0 : _b.call(_a, error);\n if (!this.unmounting)\n this.setState({ mountFailed: true });\n };\n this.handleClose = () => {\n if (this.props.session.cancel())\n return;\n if (this.props.session.getState().status !== 'saving')\n this.props.onClose();\n };\n this.handleSave = async () => {\n var _a;\n const result = await this.props.session.save();\n if (result.status === 'saved')\n this.props.onClose();\n if (result.status === 'invalid')\n (_a = this.tree) === null || _a === void 0 ? void 0 : _a.reveal(result.issues[0]);\n };\n this.state = { ...props.session.getState(), mountFailed: false };\n }\n componentDidMount() {\n this.mounted = true;\n this.removeListener = this.props.session.subscribe(() => {\n const state = this.props.session.getState();\n this.setState(state);\n if (['cancelled', 'disposed', 'invalidated'].includes(state.status))\n this.props.onClose();\n });\n this.mountBody();\n }\n componentWillUnmount() {\n var _a, _b, _c, _d;\n this.unmounting = true;\n this.mounted = false;\n if (this.focusFrame !== undefined)\n cancelAnimationFrame(this.focusFrame);\n this.removeListener();\n (_a = this.stopFieldErrors) === null || _a === void 0 ? void 0 : _a.call(this);\n try {\n (_b = this.unmountBody) === null || _b === void 0 ? void 0 : _b.call(this);\n }\n catch (error) {\n (_d = (_c = this.props).onError) === null || _d === void 0 ? void 0 : _d.call(_c, error);\n }\n finally {\n this.props.session.dispose();\n }\n }\n mountBody() {\n if (!this.body || this.unmountBody || this.state.mountFailed)\n return;\n try {\n if (!this.stopFieldErrors)\n this.stopFieldErrors = bindBlockEditorFieldErrors(this.body);\n if (typeof this.props.session.getNodes !== 'function')\n this.unmountBody = this.props.session.mount(this.body);\n // The modal establishes its focus scope after creating the portal.\n this.focusFrame = requestAnimationFrame(() => {\n if (!this.mounted)\n return;\n const first = this.body.querySelector('input, textarea, select') ||\n this.body.querySelector('button, [tabindex=\"0\"]');\n first === null || first === void 0 ? void 0 : first.focus();\n });\n }\n catch (error) {\n this.handleMountError(error);\n }\n }\n render() {\n const { styles, messages, ModalComponent, session } = this.props;\n const saving = this.state.status === 'saving';\n const hierarchy = typeof session.getNodes === 'function';\n return React.createElement(ModalComponent, { className: `${styles.modalContent || ''} ${hierarchy ? styles.hierarchyModal : ''} ${this.props.className || ''}`, contentLabel: messages.title, id: \"blockEditorModal\", onRequestClose: this.handleClose },\n React.createElement(\"div\", { \"aria-busy\": saving, className: styles.body, onCompositionStart: () => { this.composing = true; }, onCompositionEnd: () => { this.composing = false; }, onKeyDownCapture: event => {\n if (this.composing || event.nativeEvent.isComposing || event.keyCode === 229)\n event.stopPropagation();\n } },\n React.createElement(\"div\", { className: styles.editorBody },\n React.createElement(\"div\", { ref: this.handleBody }, hierarchy ? React.createElement(DescendantTree, { session: session, styles: styles, messages: messages, disabled: saving, nodeAppearances: this.props.nodeAppearances, nodeLabels: this.props.nodeLabels, onError: this.handleMountError, ref: tree => { this.tree = tree; } }) : null),\n React.createElement(\"div\", { \"aria-live\": \"polite\", className: styles.errors, role: \"status\" },\n saving ? messages.saving : null,\n this.state.issues.map((issue, index) => {\n var _a;\n return hierarchy && 'reference' in issue ?\n React.createElement(\"button\", { className: styles.nodeError, \"data-block-editor-issue\": index, disabled: saving, key: index, type: \"button\", onClick: () => { var _a; return (_a = this.tree) === null || _a === void 0 ? void 0 : _a.reveal(issue); } },\n ((_a = this.props.nodeLabels) === null || _a === void 0 ? void 0 : _a[issue.reference.blockId]) || issue.reference.blockId,\n ': ',\n issue.message) : React.createElement(\"p\", { key: index }, issue.message);\n }),\n this.state.error instanceof BlockEditorStructureError ? messages.structureError :\n this.state.error instanceof BlockEditorConflictError ? messages.conflict :\n (this.state.error || this.state.mountFailed) ? messages.failed : null)),\n React.createElement(\"div\", { className: styles.buttons },\n React.createElement(\"button\", { disabled: saving, type: \"button\", onClick: this.handleClose }, messages.cancel),\n React.createElement(\"button\", { \"data-block-editor-save\": \"\", disabled: !this.state.canSave || this.state.mountFailed, type: \"button\", onClick: this.handleSave }, saving ? messages.saving : hierarchy ? messages.saveAll : messages.save))));\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;AACA,IAAM,6BAA6B,CAAC,cAAc;AAC9C,QAAM,YAAY,oBAAI,IAAI;AAC1B,QAAM,gBAAgB,CAAC,SAAS,SAAS;AACrC,UAAM,SAAS,UAAU,IAAI,OAAO;AACpC,UAAM,WAAW,UAAU,OAAO,IAAI,IAAI;AAC1C,UAAM,UAAU,QAAQ,aAAa,IAAI;AACzC,WAAO,YAAY,YAAY,SAAS,UAAU,SAAS,WAAW;AAAA,EAC1E;AACA,QAAM,eAAe,CAAC,SAAS,MAAM,UAAU;AAC3C,QAAI,QAAQ,aAAa,IAAI,MAAM;AAC/B;AACJ,UAAM,WAAW,cAAc,SAAS,IAAI;AAC5C,QAAI,CAAC,UAAU,IAAI,OAAO;AACtB,gBAAU,IAAI,SAAS,oBAAI,IAAI,CAAC;AACpC,cAAU,IAAI,OAAO,EAAE,IAAI,MAAM,EAAE,UAAU,SAAS,MAAM,CAAC;AAC7D,YAAQ,aAAa,MAAM,KAAK;AAAA,EACpC;AACA,QAAM,UAAU,CAAC,YAAY;AACzB,eAAW,CAAC,MAAM,EAAE,UAAU,QAAQ,CAAC,KAAK,UAAU,IAAI,OAAO,GAAG;AAEhE,UAAI,QAAQ,aAAa,IAAI,MAAM;AAC/B;AACJ,UAAI,aAAa;AACb,gBAAQ,gBAAgB,IAAI;AAAA;AAE5B,gBAAQ,aAAa,MAAM,QAAQ;AAAA,IAC3C;AACA,cAAU,OAAO,OAAO;AAAA,EAC5B;AACA,QAAM,OAAO,MAAM;AACf,UAA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AAM,iBAAiB,2BAA2B,SAAS,WAC3D,KAAK,MAAM,SAAS,KAAK,MAAM,cAAe,SAAS,SAAS;AAAA,UAAI;AAAA,QAAC;AAAA,QAChF;AAAA,UAAc;AAAA,UAAO,EAAE,WAAW,OAAO,QAAQ;AAAA,UAC7C,oBAAc,UAAU,EAAE,UAAU,QAAQ,MAAM,UAAU,SAAS,KAAK,YAAY,GAAG,SAAS,MAAM;AAAA,UACxG,oBAAc,UAAU,EAAE,0BAA0B,IAAI,UAAU,CAAC,KAAK,MAAM,WAAW,KAAK,MAAM,aAAa,MAAM,UAAU,SAAS,KAAK,WAAW,GAAG,SAAS,SAAS,SAAS,YAAY,SAAS,UAAU,SAAS,IAAI;AAAA,QAAC;AAAA,MAAC;AAAA,IAAC;AAAA,EAC7P;AACJ;",
|
|
4
|
+
"sourcesContent": ["// RJSF owns validation and messages; this adapter only decorates its rendered errors.\nconst bindBlockEditorFieldErrors = (container) => {\n const originals = new Map();\n const originalValue = (element, name) => {\n const values = originals.get(element);\n const previous = values && values.get(name);\n const current = element.getAttribute(name);\n return previous && current === previous.applied ? previous.original : current;\n };\n const setAttribute = (element, name, value) => {\n if (element.getAttribute(name) === value)\n return;\n const original = originalValue(element, name);\n if (!originals.has(element))\n originals.set(element, new Map());\n originals.get(element).set(name, { original, applied: value });\n element.setAttribute(name, value);\n };\n const restore = (element) => {\n for (const [name, { original, applied }] of originals.get(element)) {\n // Do not overwrite attributes subsequently changed by RJSF or a custom widget.\n if (element.getAttribute(name) !== applied)\n continue;\n if (original === null)\n element.removeAttribute(name);\n else\n element.setAttribute(name, original);\n }\n originals.delete(element);\n };\n const sync = () => {\n const invalid = new Set();\n const decorate = (element, messages, group = false) => {\n invalid.add(element);\n setAttribute(element, 'aria-invalid', 'true');\n setAttribute(element, 'data-block-editor-invalid', group ? 'group' : 'true');\n const descriptions = new Set((originalValue(element, 'aria-describedby') || '')\n .split(/\\s+/).filter(Boolean));\n for (const message of messages)\n descriptions.add(message.id);\n setAttribute(element, 'aria-describedby', [...descriptions].join(' '));\n if (group && !originalValue(element, 'role'))\n setAttribute(element, 'role', 'group');\n if (group && !element.hasAttribute('aria-label') && !originalValue(element, 'aria-labelledby')) {\n const titles = messages.map(message => message.id.replace(/__error$/, '__title'))\n .filter(id => {\n const title = element.ownerDocument.getElementById(id);\n return title && element.contains(title);\n });\n if (titles.length)\n setAttribute(element, 'aria-labelledby', titles.join(' '));\n }\n };\n for (const field of container.querySelectorAll('.rjsf .field.has-error')) {\n const messages = [...field.querySelectorAll('.error-detail[id]')].filter(message => { var _a; return message.closest('.field') === field && ((_a = message.textContent) === null || _a === void 0 ? void 0 : _a.trim()); });\n if (!messages.length)\n continue;\n if (field.classList.contains('field-object') || field.classList.contains('field-array')) {\n // Group constraints must not mark otherwise valid descendant controls as invalid.\n decorate(field, messages, true);\n continue;\n }\n for (const control of field.querySelectorAll('input:not([type=\"hidden\"]), select, textarea')) {\n if (control.closest('.field') !== field)\n continue;\n const descriptions = (control.getAttribute('aria-describedby') || '').split(/\\s+/);\n const ownMessages = messages.filter(message => descriptions.includes(message.id) ||\n message.id === `${control.id}__error`);\n if (ownMessages.length)\n decorate(control, ownMessages);\n }\n }\n for (const element of originals.keys()) {\n if (!invalid.has(element))\n restore(element);\n }\n };\n const observer = new container.ownerDocument.defaultView.MutationObserver(sync);\n observer.observe(container, { childList: true,\n subtree: true,\n characterData: true,\n attributes: true,\n attributeFilter: ['class', 'id'] });\n sync();\n return () => {\n observer.disconnect();\n for (const element of originals.keys())\n restore(element);\n };\n};\nexport default bindBlockEditorFieldErrors;\n", "import bindBlockEditorFieldErrors from './field-errors.js';\nexport { default as bindBlockEditorFieldErrors } from './field-errors.js';\nimport * as React from 'react';\nimport { BlockEditorConflictError } from './types.js';\nimport { BlockEditorStructureError } from './descendant-types.js';\nclass NodeBody extends React.Component {\n constructor() {\n super(...arguments);\n this.body = null;\n }\n componentDidMount() {\n try {\n this.unmountBody = this.props.editor.mount(this.body);\n }\n catch (error) {\n this.props.onError(error);\n }\n }\n componentWillUnmount() {\n var _a;\n try {\n (_a = this.unmountBody) === null || _a === void 0 ? void 0 : _a.call(this);\n }\n catch (error) {\n this.props.onError(error);\n }\n }\n render() { return React.createElement(\"div\", { ref: body => { this.body = body; } }); }\n}\nlet nextBodyId = 0;\nclass DescendantTree extends React.Component {\n constructor(props) {\n super(props);\n this.nodes = this.props.session.getNodes();\n this.children = new Map();\n this.sections = new Map();\n this.bodyIds = new Map();\n for (const node of this.nodes) {\n const path = node.inputPath;\n const parent = path.length ? path[path.length - 1].blockId : null;\n if (!this.children.has(parent))\n this.children.set(parent, []);\n this.children.get(parent).push(node);\n this.bodyIds.set(node.reference.blockId, `block-editor-node-${++nextBodyId}`);\n }\n this.state = { failedIcons: new Set(), expanded: new Set(this.nodes.filter(node => this.nodes.length <= 30 || node.inputPath.length === 0).map(node => node.reference.blockId)) };\n }\n componentWillUnmount() {\n if (this.focusFrame !== undefined)\n cancelAnimationFrame(this.focusFrame);\n }\n reveal(issue) {\n if (!issue || !('reference' in issue))\n return;\n const expanded = new Set(this.state.expanded);\n for (const step of issue.inputPath)\n expanded.add(step.blockId);\n expanded.add(issue.reference.blockId);\n this.setState({ expanded }, () => {\n if (this.focusFrame !== undefined)\n cancelAnimationFrame(this.focusFrame);\n this.focusFrame = requestAnimationFrame(() => {\n var _a;\n const section = this.sections.get(issue.reference.blockId);\n if (!section)\n return;\n const controls = [...section.querySelectorAll('input, textarea, select')];\n const path = (issue.path || '').replace(/^\\./, '').replace(/\\[(\\d+)\\]/g, '_$1').replace(/\\./g, '_');\n const field = controls.find(control => path && control.id.endsWith(`_${path}`)) || controls[0];\n const target = field || section.querySelector('button');\n target === null || target === void 0 ? void 0 : target.focus();\n (_a = target === null || target === void 0 ? void 0 : target.scrollIntoView) === null || _a === void 0 ? void 0 : _a.call(target, { block: 'nearest' });\n });\n });\n }\n toggle(id) {\n const expanded = new Set(this.state.expanded);\n if (expanded.has(id))\n expanded.delete(id);\n else\n expanded.add(id);\n this.setState({ expanded });\n }\n renderNode(node) {\n var _a, _b, _c;\n const { styles, session, messages } = this.props;\n const id = node.reference.blockId;\n const expanded = this.state.expanded.has(id);\n const editor = (_a = session.getEditor) === null || _a === void 0 ? void 0 : _a.call(session, id);\n const step = node.inputPath[node.inputPath.length - 1];\n const appearance = ((_b = this.props.nodeAppearances) === null || _b === void 0 ? void 0 : _b[id]) || {};\n const label = appearance.name || ((_c = this.props.nodeLabels) === null || _c === void 0 ? void 0 : _c[id]) || node.opcode;\n const style = {\n '--block-editor-node-colour': appearance.colour,\n '--block-editor-node-tint': appearance.tint\n };\n return React.createElement(\"section\", { className: styles.treeNode, \"data-block-editor-node\": id, key: id, style: style, ref: section => { if (section)\n this.sections.set(id, section);\n else\n this.sections.delete(id); } },\n React.createElement(\"h3\", { className: styles.nodeHeading },\n React.createElement(\"button\", { \"aria-controls\": this.bodyIds.get(id), \"aria-expanded\": expanded, \"data-block-editor-toggle\": id, disabled: this.props.disabled, type: \"button\", onClick: () => this.toggle(id) },\n React.createElement(\"span\", { \"aria-hidden\": \"true\" }, expanded ? '\u25BE ' : '\u25B8 '),\n appearance.iconURI && !this.state.failedIcons.has(id) ? React.createElement(\"img\", { alt: \"\", \"aria-hidden\": \"true\", className: styles.nodeIcon, \"data-block-editor-node-icon\": id, draggable: false, src: appearance.iconURI, onError: () => this.setState(state => ({ failedIcons: new Set([...state.failedIcons, id]) })) }) : null,\n React.createElement(\"span\", { className: styles.nodeCaption },\n React.createElement(\"span\", { \"data-block-editor-node-name\": id }, label),\n React.createElement(\"span\", { className: styles.nodeIdentity },\n step ? React.createElement(\"span\", { className: styles.branchName }, `${step.input} \u00B7 ${step.index + 1}: `) : null,\n id)))),\n React.createElement(\"div\", { hidden: !expanded, id: this.bodyIds.get(id) }, expanded ? React.createElement(React.Fragment, null,\n editor ? React.createElement(NodeBody, { editor: editor, onError: this.props.onError }) :\n React.createElement(\"p\", { className: styles.structuralNode }, messages.structuralNode),\n (this.children.get(id) || []).map(child => this.renderNode(child))) : null));\n }\n render() {\n return React.createElement(\"div\", { className: this.props.styles.tree }, (this.children.get(null) || []).map(node => this.renderNode(node)));\n }\n}\n/** The host injects its modal, localized strings and stylesheet mapping; no GUI imports are needed. */\nexport class BlockEditorDialog extends React.Component {\n constructor(props) {\n super(props);\n this.mounted = false;\n this.unmounting = false;\n this.composing = false;\n this.body = null;\n this.tree = null;\n this.removeListener = () => { };\n this.handleBody = (body) => {\n this.body = body;\n if (this.mounted)\n this.mountBody();\n };\n this.handleMountError = (error) => {\n var _a, _b;\n (_b = (_a = this.props).onError) === null || _b === void 0 ? void 0 : _b.call(_a, error);\n if (!this.unmounting)\n this.setState({ mountFailed: true });\n };\n this.handleClose = () => {\n if (this.props.session.cancel())\n return;\n if (this.props.session.getState().status !== 'saving')\n this.props.onClose();\n };\n this.handleSave = async () => {\n var _a;\n const result = await this.props.session.save();\n if (result.status === 'saved')\n this.props.onClose();\n if (result.status === 'invalid')\n (_a = this.tree) === null || _a === void 0 ? void 0 : _a.reveal(result.issues[0]);\n };\n this.state = { ...props.session.getState(), mountFailed: false };\n }\n componentDidMount() {\n this.mounted = true;\n this.removeListener = this.props.session.subscribe(() => {\n const state = this.props.session.getState();\n this.setState(state);\n if (['cancelled', 'disposed', 'invalidated'].includes(state.status))\n this.props.onClose();\n });\n this.mountBody();\n }\n componentWillUnmount() {\n var _a, _b, _c, _d;\n this.unmounting = true;\n this.mounted = false;\n if (this.focusFrame !== undefined)\n cancelAnimationFrame(this.focusFrame);\n this.removeListener();\n (_a = this.stopFieldErrors) === null || _a === void 0 ? void 0 : _a.call(this);\n try {\n (_b = this.unmountBody) === null || _b === void 0 ? void 0 : _b.call(this);\n }\n catch (error) {\n (_d = (_c = this.props).onError) === null || _d === void 0 ? void 0 : _d.call(_c, error);\n }\n finally {\n this.props.session.dispose();\n }\n }\n mountBody() {\n if (!this.body || this.unmountBody || this.state.mountFailed)\n return;\n try {\n if (!this.stopFieldErrors)\n this.stopFieldErrors = bindBlockEditorFieldErrors(this.body);\n if (typeof this.props.session.getNodes !== 'function')\n this.unmountBody = this.props.session.mount(this.body);\n // The modal establishes its focus scope after creating the portal.\n this.focusFrame = requestAnimationFrame(() => {\n if (!this.mounted)\n return;\n const first = this.body.querySelector('input, textarea, select') ||\n this.body.querySelector('button, [tabindex=\"0\"]');\n first === null || first === void 0 ? void 0 : first.focus();\n });\n }\n catch (error) {\n this.handleMountError(error);\n }\n }\n render() {\n const { styles, messages, ModalComponent, session } = this.props;\n const saving = this.state.status === 'saving';\n const hierarchy = typeof session.getNodes === 'function';\n let fixed = false;\n if (session.getFixedInputView && (this.state.status === 'editing' || saving)) {\n try {\n fixed = Boolean(session.getFixedInputView());\n }\n catch (_a) {\n fixed = true;\n }\n }\n return React.createElement(ModalComponent, { className: `${styles.modalContent || ''} ${hierarchy ? styles.hierarchyModal : ''} ${this.props.className || ''}`, contentLabel: messages.title, id: \"blockEditorModal\", onRequestClose: this.handleClose },\n React.createElement(\"div\", { \"aria-busy\": saving, className: styles.body, onCompositionStart: () => { this.composing = true; }, onCompositionEnd: () => { this.composing = false; }, onKeyDownCapture: event => {\n if (this.composing || event.nativeEvent.isComposing || event.keyCode === 229)\n event.stopPropagation();\n } },\n React.createElement(\"div\", { className: styles.editorBody },\n React.createElement(\"div\", { ref: this.handleBody }, hierarchy ? React.createElement(DescendantTree, { session: session, styles: styles, messages: messages, disabled: saving, nodeAppearances: this.props.nodeAppearances, nodeLabels: this.props.nodeLabels, onError: this.handleMountError, ref: tree => { this.tree = tree; } }) : null),\n React.createElement(\"div\", { \"aria-live\": \"polite\", className: styles.errors, role: \"status\" },\n saving ? messages.saving : null,\n fixed && this.state.issues.length ? React.createElement(\"p\", null, messages.invalidInput || messages.failed) : this.state.issues.map((issue, index) => {\n var _a;\n return hierarchy && 'reference' in issue ?\n React.createElement(\"button\", { className: styles.nodeError, \"data-block-editor-issue\": index, disabled: saving, key: index, type: \"button\", onClick: () => { var _a; return (_a = this.tree) === null || _a === void 0 ? void 0 : _a.reveal(issue); } },\n ((_a = this.props.nodeLabels) === null || _a === void 0 ? void 0 : _a[issue.reference.blockId]) || issue.reference.blockId,\n ': ',\n issue.message) : React.createElement(\"p\", { key: index }, issue.message);\n }),\n this.state.error instanceof BlockEditorStructureError ? messages.structureError :\n this.state.error instanceof BlockEditorConflictError ? messages.conflict :\n (this.state.error || this.state.mountFailed) ? messages.failed : null)),\n React.createElement(\"div\", { className: styles.buttons },\n React.createElement(\"button\", { disabled: saving, type: \"button\", onClick: this.handleClose }, messages.cancel),\n React.createElement(\"button\", { \"data-block-editor-save\": \"\", disabled: !this.state.canSave || this.state.mountFailed, type: \"button\", onClick: this.handleSave }, saving ? messages.saving : hierarchy ? messages.saveAll : messages.save))));\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;AACA,IAAM,6BAA6B,CAAC,cAAc;AAC9C,QAAM,YAAY,oBAAI,IAAI;AAC1B,QAAM,gBAAgB,CAAC,SAAS,SAAS;AACrC,UAAM,SAAS,UAAU,IAAI,OAAO;AACpC,UAAM,WAAW,UAAU,OAAO,IAAI,IAAI;AAC1C,UAAM,UAAU,QAAQ,aAAa,IAAI;AACzC,WAAO,YAAY,YAAY,SAAS,UAAU,SAAS,WAAW;AAAA,EAC1E;AACA,QAAM,eAAe,CAAC,SAAS,MAAM,UAAU;AAC3C,QAAI,QAAQ,aAAa,IAAI,MAAM;AAC/B;AACJ,UAAM,WAAW,cAAc,SAAS,IAAI;AAC5C,QAAI,CAAC,UAAU,IAAI,OAAO;AACtB,gBAAU,IAAI,SAAS,oBAAI,IAAI,CAAC;AACpC,cAAU,IAAI,OAAO,EAAE,IAAI,MAAM,EAAE,UAAU,SAAS,MAAM,CAAC;AAC7D,YAAQ,aAAa,MAAM,KAAK;AAAA,EACpC;AACA,QAAM,UAAU,CAAC,YAAY;AACzB,eAAW,CAAC,MAAM,EAAE,UAAU,QAAQ,CAAC,KAAK,UAAU,IAAI,OAAO,GAAG;AAEhE,UAAI,QAAQ,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
|
EDITOR_API_VERSION
|
|
7
8
|
} from "./shared-BKTRZUZH.js";
|
|
9
|
+
import {
|
|
10
|
+
toValidationIssues,
|
|
11
|
+
validateSchemaInput
|
|
12
|
+
} from "./shared-GQLPPRT2.js";
|
|
8
13
|
import {
|
|
9
14
|
compileSchemaBundle,
|
|
15
|
+
isJsonRecord,
|
|
16
|
+
parseFixedNumberInput,
|
|
10
17
|
prepare,
|
|
11
18
|
require__,
|
|
12
19
|
require_ajv,
|
|
13
20
|
require_dist,
|
|
14
21
|
require_fast_uri,
|
|
15
|
-
toValidationIssues,
|
|
16
|
-
validateSchemaInput
|
|
17
|
-
} from "./shared-KQOUMWJ4.js";
|
|
18
|
-
import {
|
|
19
|
-
isJsonRecord,
|
|
20
22
|
snapshotJson
|
|
21
|
-
} from "./shared-
|
|
23
|
+
} from "./shared-75QIWLZY.js";
|
|
22
24
|
import {
|
|
23
25
|
__commonJS,
|
|
24
26
|
__export,
|
|
@@ -4915,7 +4917,7 @@ var require_react_is_development = __commonJS({
|
|
|
4915
4917
|
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
4916
4918
|
var Element = REACT_ELEMENT_TYPE;
|
|
4917
4919
|
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
4918
|
-
var
|
|
4920
|
+
var Fragment3 = REACT_FRAGMENT_TYPE;
|
|
4919
4921
|
var Lazy = REACT_LAZY_TYPE;
|
|
4920
4922
|
var Memo = REACT_MEMO_TYPE;
|
|
4921
4923
|
var Portal = REACT_PORTAL_TYPE;
|
|
@@ -4983,7 +4985,7 @@ var require_react_is_development = __commonJS({
|
|
|
4983
4985
|
exports2.ContextProvider = ContextProvider;
|
|
4984
4986
|
exports2.Element = Element;
|
|
4985
4987
|
exports2.ForwardRef = ForwardRef;
|
|
4986
|
-
exports2.Fragment =
|
|
4988
|
+
exports2.Fragment = Fragment3;
|
|
4987
4989
|
exports2.Lazy = Lazy;
|
|
4988
4990
|
exports2.Memo = Memo;
|
|
4989
4991
|
exports2.Portal = Portal;
|
|
@@ -5025,7 +5027,7 @@ var require_react_is = __commonJS({
|
|
|
5025
5027
|
});
|
|
5026
5028
|
|
|
5027
5029
|
// dist/rjsf.js
|
|
5028
|
-
import * as
|
|
5030
|
+
import * as React3 from "react";
|
|
5029
5031
|
|
|
5030
5032
|
// node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/browser/dist/nodes/identity.js
|
|
5031
5033
|
var ALIAS = /* @__PURE__ */ Symbol.for("yaml.alias");
|
|
@@ -11939,11 +11941,11 @@ function Tree({ value, path, schema: schema4, ui, variant, invalidNumbers, chang
|
|
|
11939
11941
|
const type = typeOf(value);
|
|
11940
11942
|
let field;
|
|
11941
11943
|
if (choices) {
|
|
11942
|
-
const
|
|
11944
|
+
const serialized2 = JSON.stringify(value);
|
|
11943
11945
|
const options = choices.map((item) => JSON.stringify(item));
|
|
11944
|
-
if (!options.includes(
|
|
11945
|
-
options.unshift(
|
|
11946
|
-
field = React.createElement("select", { ...props, value:
|
|
11946
|
+
if (!options.includes(serialized2))
|
|
11947
|
+
options.unshift(serialized2);
|
|
11948
|
+
field = React.createElement("select", { ...props, value: serialized2, onChange: (e2) => change(JSON.parse(e2.target.value)) }, options.map((item) => React.createElement("option", { key: item, value: item }, item)));
|
|
11947
11949
|
} else if (typeof value === "string") {
|
|
11948
11950
|
field = React.createElement("textarea", { ...props, value, onChange: (e2) => change(e2.target.value) });
|
|
11949
11951
|
} else if (typeof value === "number") {
|
|
@@ -12381,8 +12383,200 @@ function createSourceEditor(options) {
|
|
|
12381
12383
|
});
|
|
12382
12384
|
}
|
|
12383
12385
|
|
|
12384
|
-
// dist/
|
|
12386
|
+
// dist/fixed-input-view.js
|
|
12387
|
+
import * as React2 from "react";
|
|
12385
12388
|
import * as ReactDOM2 from "react-dom";
|
|
12389
|
+
var defaultMessages = Object.freeze({
|
|
12390
|
+
reset: "Reset",
|
|
12391
|
+
readOnly: "This input cannot be edited safely.",
|
|
12392
|
+
unverified: "The expression is retained without evaluation. Its runtime validity has not been checked.",
|
|
12393
|
+
currentValue: "Current value",
|
|
12394
|
+
colorPicker: "color picker",
|
|
12395
|
+
invalidValue: "Check this value before saving.",
|
|
12396
|
+
inactiveDraft: "Hidden edits are retained in this dialog and will not be saved while hidden."
|
|
12397
|
+
});
|
|
12398
|
+
function captureFixedInputMessages(input) {
|
|
12399
|
+
if (input === void 0)
|
|
12400
|
+
return defaultMessages;
|
|
12401
|
+
if (!input || typeof input !== "object" || Array.isArray(input) || Object.getPrototypeOf(input) !== Object.prototype && Object.getPrototypeOf(input) !== null || Object.getOwnPropertySymbols(input).length)
|
|
12402
|
+
throw new TypeError("Invalid fixed form messages.");
|
|
12403
|
+
const result = { ...defaultMessages };
|
|
12404
|
+
for (const key of Object.getOwnPropertyNames(input)) {
|
|
12405
|
+
const descriptor = Object.getOwnPropertyDescriptor(input, key);
|
|
12406
|
+
if (!Object.hasOwn(defaultMessages, key) || !("value" in descriptor) || typeof descriptor.value !== "string" || !descriptor.value)
|
|
12407
|
+
throw new TypeError("Invalid fixed form messages.");
|
|
12408
|
+
Object.defineProperty(result, key, { value: descriptor.value, enumerable: true });
|
|
12409
|
+
}
|
|
12410
|
+
return Object.freeze(result);
|
|
12411
|
+
}
|
|
12412
|
+
function resolveFixedInputMessages(source) {
|
|
12413
|
+
const value = typeof source === "function" ? source() : source;
|
|
12414
|
+
try {
|
|
12415
|
+
return captureFixedInputMessages(value);
|
|
12416
|
+
} catch (error) {
|
|
12417
|
+
try {
|
|
12418
|
+
void Promise.prototype.then.call(value, () => void 0, () => void 0);
|
|
12419
|
+
} catch (_a) {
|
|
12420
|
+
}
|
|
12421
|
+
throw error;
|
|
12422
|
+
}
|
|
12423
|
+
}
|
|
12424
|
+
var record3 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
12425
|
+
var display = (value) => typeof value === "string" ? value : typeof value === "number" && Object.is(value, -0) ? "-0" : value === void 0 ? "" : JSON.stringify(value);
|
|
12426
|
+
var serialized = (value) => value === void 0 ? "unavailable" : JSON.stringify(value);
|
|
12427
|
+
function preview(value) {
|
|
12428
|
+
if (/^#[\da-f]{6}$/iu.test(value))
|
|
12429
|
+
return value.toLowerCase();
|
|
12430
|
+
return /^#[\da-f]{3}$/iu.test(value) ? `#${value.slice(1).split("").map((part) => part + part).join("").toLowerCase()}` : void 0;
|
|
12431
|
+
}
|
|
12432
|
+
function describe(context) {
|
|
12433
|
+
if (typeof context.getFixedInputView !== "function")
|
|
12434
|
+
throw new TypeError("A fixed form requires a fixed session.");
|
|
12435
|
+
const result = context.getFixedInputView();
|
|
12436
|
+
if (!result)
|
|
12437
|
+
throw new TypeError("A fixed form requires a fixed session.");
|
|
12438
|
+
return result;
|
|
12439
|
+
}
|
|
12440
|
+
var nextFixedViewId = 0;
|
|
12441
|
+
function FixedInputView({ context, messages }) {
|
|
12442
|
+
const [, redraw] = React2.useState(0);
|
|
12443
|
+
const [viewId] = React2.useState(() => `block-editor-fixed-${++nextFixedViewId}`);
|
|
12444
|
+
React2.useEffect(() => {
|
|
12445
|
+
const stop = context.subscribe(() => redraw((value) => value + 1));
|
|
12446
|
+
if (context.getState().status === "editing" && !context.getState().issues.length) {
|
|
12447
|
+
context.setValidationIssues(describe(context).issues);
|
|
12448
|
+
}
|
|
12449
|
+
return stop;
|
|
12450
|
+
}, [context]);
|
|
12451
|
+
const state = context.getState();
|
|
12452
|
+
if (state.status !== "editing" && state.status !== "saving")
|
|
12453
|
+
return React2.createElement(React2.Fragment, null);
|
|
12454
|
+
const description = describe(context);
|
|
12455
|
+
const draft = context.getDraft();
|
|
12456
|
+
const inputs = record3(draft.inputs) ? draft.inputs : {};
|
|
12457
|
+
const update = (argument, value, buffer) => {
|
|
12458
|
+
if (context.getState().status !== "editing")
|
|
12459
|
+
return;
|
|
12460
|
+
const latest = describe(context).inputs[argument];
|
|
12461
|
+
if (!latest || latest.state !== "editable")
|
|
12462
|
+
return;
|
|
12463
|
+
const next = context.getDraft();
|
|
12464
|
+
if (!record3(next.inputs))
|
|
12465
|
+
throw new TypeError("Invalid fixed form draft.");
|
|
12466
|
+
const previous = next.inputs[argument];
|
|
12467
|
+
const entry = { value, changed: true };
|
|
12468
|
+
if (buffer !== void 0)
|
|
12469
|
+
entry.buffer = buffer;
|
|
12470
|
+
if (record3(previous) && (previous.readOnly === true || previous.repair === true))
|
|
12471
|
+
entry.repair = true;
|
|
12472
|
+
Object.defineProperty(next.inputs, argument, { value: entry, enumerable: true, configurable: true, writable: true });
|
|
12473
|
+
context.setDraft(next);
|
|
12474
|
+
context.setValidationIssues(describe(context).issues);
|
|
12475
|
+
};
|
|
12476
|
+
const hasInactiveEdits = Object.entries(description.inputs).some(([argument, input]) => input.state === "hidden" && record3(inputs[argument]) && inputs[argument].changed === true);
|
|
12477
|
+
return React2.createElement(
|
|
12478
|
+
"div",
|
|
12479
|
+
{ className: "block-editor-fixed-inputs" },
|
|
12480
|
+
hasInactiveEdits && React2.createElement("p", { className: "block-editor-fixed-inactive", "data-fixed-inactive-draft": "", role: "status" }, messages.inactiveDraft),
|
|
12481
|
+
Object.entries(description.inputs).map(([argument, input], index) => {
|
|
12482
|
+
var _a, _b, _c, _d, _e2;
|
|
12483
|
+
if (input.state === "hidden")
|
|
12484
|
+
return null;
|
|
12485
|
+
const entry = record3(inputs[argument]) ? inputs[argument] : {};
|
|
12486
|
+
const value = Object.hasOwn(entry, "value") ? entry.value : void 0;
|
|
12487
|
+
const label = (_a = input.label) !== null && _a !== void 0 ? _a : argument;
|
|
12488
|
+
const text = typeof entry.buffer === "string" ? entry.buffer : value === void 0 ? (_b = input.rawDisplay) !== null && _b !== void 0 ? _b : "" : display(value);
|
|
12489
|
+
const disabled = state.status !== "editing" || input.state !== "editable";
|
|
12490
|
+
const path = `/${argument.replace(/~/g, "~0").replace(/\//g, "~1")}`;
|
|
12491
|
+
const invalid = [...state.issues, ...description.issues].some((issue2) => {
|
|
12492
|
+
var _a2;
|
|
12493
|
+
return issue2.path === path || ((_a2 = issue2.path) === null || _a2 === void 0 ? void 0 : _a2.startsWith(`${path}/`));
|
|
12494
|
+
});
|
|
12495
|
+
const errorId2 = `${viewId}-${index}-error`;
|
|
12496
|
+
const reasonId = `${viewId}-${index}-reason`;
|
|
12497
|
+
const unverifiedId = `${viewId}-${index}-unverified`;
|
|
12498
|
+
const originalId = `${viewId}-${index}-original`;
|
|
12499
|
+
const showOriginal = input.control === "enum" && input.rawDisplay !== void 0 && entry.changed !== true && input.rawDisplay !== display(value);
|
|
12500
|
+
const descriptions = [input.state === "readonly" ? reasonId : "", invalid ? errorId2 : "", input.unverified ? unverifiedId : "", showOriginal ? originalId : ""].filter(Boolean).join(" ");
|
|
12501
|
+
const attributes = {
|
|
12502
|
+
"aria-invalid": invalid || void 0,
|
|
12503
|
+
"data-block-editor-invalid": invalid ? "true" : void 0,
|
|
12504
|
+
"aria-describedby": descriptions || void 0
|
|
12505
|
+
};
|
|
12506
|
+
let control;
|
|
12507
|
+
if (input.state === "readonly") {
|
|
12508
|
+
control = React2.createElement(
|
|
12509
|
+
React2.Fragment,
|
|
12510
|
+
null,
|
|
12511
|
+
React2.createElement("output", { "aria-label": label, ...attributes }, (_c = input.rawDisplay) !== null && _c !== void 0 ? _c : text),
|
|
12512
|
+
React2.createElement("p", { id: reasonId, className: "block-editor-fixed-readonly" }, messages.readOnly)
|
|
12513
|
+
);
|
|
12514
|
+
} else if (input.control === "enum") {
|
|
12515
|
+
const choices = (_d = input.choices) !== null && _d !== void 0 ? _d : [];
|
|
12516
|
+
const current = serialized(value);
|
|
12517
|
+
const known = choices.some((choice) => serialized(choice.value) === current);
|
|
12518
|
+
control = React2.createElement(
|
|
12519
|
+
"select",
|
|
12520
|
+
{ "aria-label": label, ...attributes, value: known ? current : "existing-raw", disabled, onChange: (event) => {
|
|
12521
|
+
const choice = choices.find((item) => serialized(item.value) === event.target.value);
|
|
12522
|
+
if (choice)
|
|
12523
|
+
update(argument, choice.value);
|
|
12524
|
+
} },
|
|
12525
|
+
!known && React2.createElement("option", { value: "existing-raw", disabled: true }, ((_e2 = input.rawDisplay) !== null && _e2 !== void 0 ? _e2 : text) || messages.currentValue),
|
|
12526
|
+
choices.map((choice, index2) => {
|
|
12527
|
+
var _a2;
|
|
12528
|
+
return React2.createElement("option", { key: index2, value: serialized(choice.value) }, (_a2 = choice.label) !== null && _a2 !== void 0 ? _a2 : display(choice.value));
|
|
12529
|
+
})
|
|
12530
|
+
);
|
|
12531
|
+
} else if (input.control === "number") {
|
|
12532
|
+
control = React2.createElement("input", { "aria-label": label, ...attributes, type: "text", inputMode: "decimal", value: text, disabled, onChange: (event) => {
|
|
12533
|
+
const buffer = event.target.value;
|
|
12534
|
+
if (input.valueType === "string" || input.valueType === void 0 && typeof value === "string") {
|
|
12535
|
+
update(argument, buffer);
|
|
12536
|
+
} else {
|
|
12537
|
+
const parsed = parseFixedNumberInput(buffer);
|
|
12538
|
+
update(argument, parsed.kind === "valid" ? parsed.value : value !== null && value !== void 0 ? value : null, buffer);
|
|
12539
|
+
}
|
|
12540
|
+
} });
|
|
12541
|
+
} else if (input.control === "color") {
|
|
12542
|
+
const color = preview(text);
|
|
12543
|
+
control = React2.createElement(
|
|
12544
|
+
"div",
|
|
12545
|
+
{ className: "block-editor-fixed-color" },
|
|
12546
|
+
React2.createElement("input", { "aria-label": label, ...attributes, type: "text", value: text, disabled, onChange: (event) => update(argument, event.target.value) }),
|
|
12547
|
+
color !== void 0 && React2.createElement("input", { type: "color", "aria-label": `${label} ${messages.colorPicker}`, ...attributes, value: color, disabled, onChange: (event) => update(argument, event.target.value) })
|
|
12548
|
+
);
|
|
12549
|
+
} else
|
|
12550
|
+
control = React2.createElement("textarea", { "aria-label": label, ...attributes, value: text, disabled, onChange: (event) => update(argument, event.target.value) });
|
|
12551
|
+
return React2.createElement(
|
|
12552
|
+
"fieldset",
|
|
12553
|
+
{ key: argument, "data-fixed-argument": argument, disabled },
|
|
12554
|
+
React2.createElement("legend", null, label),
|
|
12555
|
+
control,
|
|
12556
|
+
input.state === "editable" && input.reset !== void 0 && React2.createElement("button", { type: "button", disabled, "aria-label": `${label} ${messages.reset}`, onClick: () => update(argument, input.reset) }, messages.reset),
|
|
12557
|
+
showOriginal && React2.createElement(
|
|
12558
|
+
"p",
|
|
12559
|
+
{ id: originalId, className: "block-editor-fixed-original", "data-fixed-original-value": "" },
|
|
12560
|
+
messages.currentValue,
|
|
12561
|
+
": ",
|
|
12562
|
+
React2.createElement("output", null, input.rawDisplay)
|
|
12563
|
+
),
|
|
12564
|
+
invalid && React2.createElement("p", { id: errorId2, className: "block-editor-fixed-error" }, messages.invalidValue),
|
|
12565
|
+
input.unverified && React2.createElement("p", { id: unverifiedId, className: "block-editor-fixed-unverified" }, messages.unverified)
|
|
12566
|
+
);
|
|
12567
|
+
})
|
|
12568
|
+
);
|
|
12569
|
+
}
|
|
12570
|
+
function mountFixedInputView(container, context, messages = defaultMessages) {
|
|
12571
|
+
describe(context);
|
|
12572
|
+
ReactDOM2.render(React2.createElement(FixedInputView, { context, messages }), container);
|
|
12573
|
+
return () => {
|
|
12574
|
+
ReactDOM2.unmountComponentAtNode(container);
|
|
12575
|
+
};
|
|
12576
|
+
}
|
|
12577
|
+
|
|
12578
|
+
// dist/rjsf.js
|
|
12579
|
+
import * as ReactDOM3 from "react-dom";
|
|
12386
12580
|
|
|
12387
12581
|
// node_modules/.pnpm/@rjsf+core@5.24.13_@rjsf+utils@5.24.13_react@16.14.0__react@16.14.0/node_modules/@rjsf/core/lib/index.js
|
|
12388
12582
|
var lib_exports2 = {};
|
|
@@ -17031,7 +17225,7 @@ function getTemplate(name, registry, uiOptions = {}) {
|
|
|
17031
17225
|
// node_modules/.pnpm/@rjsf+utils@5.24.13_react@16.14.0/node_modules/@rjsf/utils/lib/getWidget.js
|
|
17032
17226
|
var import_react_is = __toESM(require_react_is());
|
|
17033
17227
|
import { jsx as _jsx } from "react/jsx-runtime.js";
|
|
17034
|
-
import { createElement as
|
|
17228
|
+
import { createElement as createElement3 } from "react";
|
|
17035
17229
|
var widgetMap = {
|
|
17036
17230
|
boolean: {
|
|
17037
17231
|
checkbox: "CheckboxWidget",
|
|
@@ -17097,7 +17291,7 @@ function mergeWidgetOptions(AWidget) {
|
|
|
17097
17291
|
}
|
|
17098
17292
|
function getWidget(schema4, widget, registeredWidgets = {}) {
|
|
17099
17293
|
const type = getSchemaType(schema4);
|
|
17100
|
-
if (typeof widget === "function" || widget && import_react_is.default.isForwardRef(
|
|
17294
|
+
if (typeof widget === "function" || widget && import_react_is.default.isForwardRef(createElement3(widget)) || import_react_is.default.isMemo(widget)) {
|
|
17101
17295
|
return mergeWidgetOptions(widget);
|
|
17102
17296
|
}
|
|
17103
17297
|
if (typeof widget !== "string") {
|
|
@@ -18410,12 +18604,12 @@ var MultiSchemaField_default = AnyOfField;
|
|
|
18410
18604
|
|
|
18411
18605
|
// node_modules/.pnpm/@rjsf+core@5.24.13_@rjsf+utils@5.24.13_react@16.14.0__react@16.14.0/node_modules/@rjsf/core/lib/components/fields/NumberField.js
|
|
18412
18606
|
import { jsx as _jsx5 } from "react/jsx-runtime.js";
|
|
18413
|
-
import { useState as
|
|
18607
|
+
import { useState as useState3, useCallback } from "react";
|
|
18414
18608
|
var trailingCharMatcherWithPrefix = /\.([0-9]*0)*$/;
|
|
18415
18609
|
var trailingCharMatcher = /[0.]0*$/;
|
|
18416
18610
|
function NumberField(props) {
|
|
18417
18611
|
const { registry, onChange, formData, value: initialValue } = props;
|
|
18418
|
-
const [lastValue, setLastValue] =
|
|
18612
|
+
const [lastValue, setLastValue] = useState3(initialValue);
|
|
18419
18613
|
const { StringField: StringField2 } = registry.fields;
|
|
18420
18614
|
let value = formData;
|
|
18421
18615
|
const handleChange = useCallback((value2, errorSchema, id) => {
|
|
@@ -19244,10 +19438,10 @@ function StringField(props) {
|
|
|
19244
19438
|
var StringField_default = StringField;
|
|
19245
19439
|
|
|
19246
19440
|
// node_modules/.pnpm/@rjsf+core@5.24.13_@rjsf+utils@5.24.13_react@16.14.0__react@16.14.0/node_modules/@rjsf/core/lib/components/fields/NullField.js
|
|
19247
|
-
import { useEffect as
|
|
19441
|
+
import { useEffect as useEffect3 } from "react";
|
|
19248
19442
|
function NullField(props) {
|
|
19249
19443
|
const { formData, onChange } = props;
|
|
19250
|
-
|
|
19444
|
+
useEffect3(() => {
|
|
19251
19445
|
if (formData === void 0) {
|
|
19252
19446
|
onChange(null);
|
|
19253
19447
|
}
|
|
@@ -19588,7 +19782,7 @@ var templates_default = templates;
|
|
|
19588
19782
|
|
|
19589
19783
|
// node_modules/.pnpm/@rjsf+core@5.24.13_@rjsf+utils@5.24.13_react@16.14.0__react@16.14.0/node_modules/@rjsf/core/lib/components/widgets/AltDateWidget.js
|
|
19590
19784
|
import { jsx as _jsx27, jsxs as _jsxs14 } from "react/jsx-runtime.js";
|
|
19591
|
-
import { useCallback as useCallback4, useEffect as
|
|
19785
|
+
import { useCallback as useCallback4, useEffect as useEffect4, useReducer, useState as useState4 } from "react";
|
|
19592
19786
|
function readyForChange(state) {
|
|
19593
19787
|
return Object.values(state).every((value) => value !== -1);
|
|
19594
19788
|
}
|
|
@@ -19599,11 +19793,11 @@ function DateElement({ type, range, value, select, rootId, name, disabled, reado
|
|
|
19599
19793
|
}
|
|
19600
19794
|
function AltDateWidget({ time = false, disabled = false, readonly = false, autofocus = false, options, id, name, registry, onBlur, onFocus, onChange, value }) {
|
|
19601
19795
|
const { translateString } = registry;
|
|
19602
|
-
const [lastValue, setLastValue] =
|
|
19796
|
+
const [lastValue, setLastValue] = useState4(value);
|
|
19603
19797
|
const [state, setState] = useReducer((state2, action) => {
|
|
19604
19798
|
return { ...state2, ...action };
|
|
19605
19799
|
}, parseDateString(value, time));
|
|
19606
|
-
|
|
19800
|
+
useEffect4(() => {
|
|
19607
19801
|
const stateValue = toDateString(state, time);
|
|
19608
19802
|
if (readyForChange(state) && stateValue !== value) {
|
|
19609
19803
|
onChange(stateValue);
|
|
@@ -19764,7 +19958,7 @@ function FileInfoPreview({ fileInfo, registry }) {
|
|
|
19764
19958
|
}
|
|
19765
19959
|
return _jsxs17(_Fragment3, { children: [" ", _jsx35("a", { download: `preview-${name}`, href: dataURL, className: "file-download", children: translateString(TranslatableString.PreviewLabel) })] });
|
|
19766
19960
|
}
|
|
19767
|
-
function FilesInfo({ filesInfo, registry, preview, onRemove, options }) {
|
|
19961
|
+
function FilesInfo({ filesInfo, registry, preview: preview2, onRemove, options }) {
|
|
19768
19962
|
if (filesInfo.length === 0) {
|
|
19769
19963
|
return null;
|
|
19770
19964
|
}
|
|
@@ -19773,7 +19967,7 @@ function FilesInfo({ filesInfo, registry, preview, onRemove, options }) {
|
|
|
19773
19967
|
return _jsx35("ul", { className: "file-info", children: filesInfo.map((fileInfo, key) => {
|
|
19774
19968
|
const { name, size, type } = fileInfo;
|
|
19775
19969
|
const handleRemove = () => onRemove(key);
|
|
19776
|
-
return _jsxs17("li", { children: [_jsx35(index_modern_default, { children: translateString(TranslatableString.FilesInfo, [name, type, String(size)]) }),
|
|
19970
|
+
return _jsxs17("li", { children: [_jsx35(index_modern_default, { children: translateString(TranslatableString.FilesInfo, [name, type, String(size)]) }), preview2 && _jsx35(FileInfoPreview, { fileInfo, registry }), _jsx35(RemoveButton2, { onClick: handleRemove, registry })] }, key);
|
|
19777
19971
|
}) });
|
|
19778
19972
|
}
|
|
19779
19973
|
function extractFileInfo(dataURLs) {
|
|
@@ -21164,14 +21358,34 @@ function createSchemaBundleEditor(options) {
|
|
|
21164
21358
|
...validateData === void 0 ? {} : { validateData }
|
|
21165
21359
|
}, { issuesFor, dialect: result.validator.dialect });
|
|
21166
21360
|
}
|
|
21167
|
-
function createBlockEditorService() {
|
|
21361
|
+
function createBlockEditorService(options) {
|
|
21362
|
+
if ((options === null || options === void 0 ? void 0 : options.fixedInputs) !== void 0 && typeof options.fixedInputs !== "boolean")
|
|
21363
|
+
throw new TypeError("Invalid fixed input capability option.");
|
|
21364
|
+
const messageSource = options === null || options === void 0 ? void 0 : options.fixedInputMessages;
|
|
21365
|
+
const fixedMessages = typeof messageSource === "function" ? messageSource : captureFixedInputMessages(messageSource);
|
|
21168
21366
|
const registry = new EditorRegistry();
|
|
21169
21367
|
const listeners = /* @__PURE__ */ new Set();
|
|
21170
21368
|
const notify = () => {
|
|
21171
21369
|
for (const listener of [...listeners])
|
|
21172
21370
|
listener();
|
|
21173
21371
|
};
|
|
21372
|
+
const fixed = (options === null || options === void 0 ? void 0 : options.fixedInputs) === true ? {
|
|
21373
|
+
registerFixedInputEditor: (definition) => {
|
|
21374
|
+
const fixedDefinition = createFixedInputEditor(definition);
|
|
21375
|
+
const remove = registry.registerFixed({ ...fixedDefinition, mount: (container, context) => mountFixedInputView(container, context, resolveFixedInputMessages(fixedMessages)) });
|
|
21376
|
+
notify();
|
|
21377
|
+
let active = true;
|
|
21378
|
+
return () => {
|
|
21379
|
+
if (active) {
|
|
21380
|
+
active = false;
|
|
21381
|
+
remove();
|
|
21382
|
+
notify();
|
|
21383
|
+
}
|
|
21384
|
+
};
|
|
21385
|
+
}
|
|
21386
|
+
} : {};
|
|
21174
21387
|
const api = Object.freeze({
|
|
21388
|
+
...fixed,
|
|
21175
21389
|
apiVersion: EDITOR_API_VERSION,
|
|
21176
21390
|
register: (definition) => {
|
|
21177
21391
|
const custom = definition;
|
|
@@ -21284,7 +21498,7 @@ function createSchemaEditorImpl(options, bundle) {
|
|
|
21284
21498
|
if (context.getState().issues.length === 0) {
|
|
21285
21499
|
context.setValidationIssues(issuesFor(dataFor(context.getDraft())));
|
|
21286
21500
|
}
|
|
21287
|
-
const
|
|
21501
|
+
const render4 = () => {
|
|
21288
21502
|
if (!active)
|
|
21289
21503
|
return;
|
|
21290
21504
|
const state = context.getState();
|
|
@@ -21313,7 +21527,7 @@ function createSchemaEditorImpl(options, bundle) {
|
|
|
21313
21527
|
context.setValidationIssues(issuesFor(data));
|
|
21314
21528
|
}
|
|
21315
21529
|
};
|
|
21316
|
-
|
|
21530
|
+
ReactDOM3.render(React3.createElement(Form2, props, React3.createElement("span", { hidden: true })), container);
|
|
21317
21531
|
};
|
|
21318
21532
|
const schedule = () => {
|
|
21319
21533
|
if (scheduled || !active)
|
|
@@ -21322,28 +21536,29 @@ function createSchemaEditorImpl(options, bundle) {
|
|
|
21322
21536
|
void Promise.resolve().then(() => {
|
|
21323
21537
|
scheduled = false;
|
|
21324
21538
|
if (active)
|
|
21325
|
-
|
|
21539
|
+
render4();
|
|
21326
21540
|
});
|
|
21327
21541
|
};
|
|
21328
21542
|
unsubscribe = context.subscribe(schedule);
|
|
21329
21543
|
try {
|
|
21330
|
-
|
|
21544
|
+
render4();
|
|
21331
21545
|
} catch (error) {
|
|
21332
21546
|
active = false;
|
|
21333
21547
|
unsubscribe();
|
|
21334
|
-
|
|
21548
|
+
ReactDOM3.unmountComponentAtNode(container);
|
|
21335
21549
|
throw error;
|
|
21336
21550
|
}
|
|
21337
21551
|
return () => {
|
|
21338
21552
|
active = false;
|
|
21339
21553
|
unsubscribe();
|
|
21340
|
-
|
|
21554
|
+
ReactDOM3.unmountComponentAtNode(container);
|
|
21341
21555
|
};
|
|
21342
21556
|
}
|
|
21343
21557
|
};
|
|
21344
21558
|
}
|
|
21345
21559
|
export {
|
|
21346
21560
|
createBlockEditorService,
|
|
21561
|
+
createFixedInputEditor,
|
|
21347
21562
|
createSchemaBundleEditor,
|
|
21348
21563
|
createSchemaEditor,
|
|
21349
21564
|
createSourceEditor
|