@kubohiroya/turbowarp-extension-data-editor 0.2.1 → 0.2.2
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 +2 -2
- package/dist/build-info.json +4 -4
- package/dist/react.css +126 -0
- package/dist/react.d.ts +5 -0
- package/dist/react.js +10 -2
- package/dist/rjsf-templates.d.ts +11 -0
- package/dist/rjsf-templates.js +129 -0
- package/dist/rjsf.js +13 -1
- package/dist/turbowarp/bridge.js +3 -0
- package/dist/webpack4/metafile.json +39 -15
- package/dist/webpack4/react.js +12 -6
- package/dist/webpack4/react.js.map +2 -2
- package/dist/webpack4/rjsf.js +205 -30
- package/dist/webpack4/rjsf.js.map +4 -4
- package/dist/webpack4/turbowarp.js +3 -0
- package/dist/webpack4/turbowarp.js.map +2 -2
- package/docs/api.md +7 -0
- package/docs/package-distribution.md +5 -0
- package/package.json +1 -7
|
@@ -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 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;A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AAK,MAAM,SAAS,gBAAgB,SAAS,MAAM,IAAI,KAAK,MAAM,OAAO,IAAI,CAAC,OAAO,UAAU;AACnJ,kBAAI;AACJ,qBAAO,aAAa,eAAe,QACzB;AAAA,gBAAc;AAAA,gBAAU,EAAE,WAAW,OAAO,WAAW,2BAA2B,OAAO,UAAU,QAAQ,KAAK,OAAO,MAAM,UAAU,SAAS,MAAM;AAAE,sBAAIA;AAAI,0BAAQA,MAAK,KAAK,UAAU,QAAQA,QAAO,SAAS,SAASA,IAAG,OAAO,KAAK;AAAA,gBAAG,EAAE;AAAA,kBACjP,KAAK,KAAK,MAAM,gBAAgB,QAAQ,OAAO,SAAS,SAAS,GAAG,MAAM,UAAU,OAAO,MAAM,MAAM,UAAU;AAAA,gBACnH;AAAA,gBACA,MAAM;AAAA,cAAO,IAAU,oBAAc,KAAK,EAAE,KAAK,MAAM,GAAG,MAAM,OAAO;AAAA,YACnF,CAAC;AAAA,YACD,KAAK,MAAM,iBAAiB,4BAA4B,SAAS,iBAC7D,KAAK,MAAM,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 var _a, _b, _c, _d;\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 (_e) {\n fixed = true;\n }\n }\n const root = (_a = session.getNodes) === null || _a === void 0 ? void 0 : _a.call(session).find(node => node.inputPath.length === 0);\n const rootId = ((_b = session.reference) === null || _b === void 0 ? void 0 : _b.blockId) || (root === null || root === void 0 ? void 0 : root.reference.blockId);\n const appearance = rootId ? (_c = this.props.nodeAppearances) === null || _c === void 0 ? void 0 : _c[rootId] : undefined;\n const name = (appearance === null || appearance === void 0 ? void 0 : appearance.name) || (rootId ? (_d = this.props.nodeLabels) === null || _d === void 0 ? void 0 : _d[rootId] : undefined) || (root === null || root === void 0 ? void 0 : root.opcode);\n const title = name ? messages.title.includes('{name}') ? messages.title.replace('{name}', () => name) :\n /\u30D6\u30ED\u30C3\u30AF|block/i.test(messages.title) ? messages.title.replace(/\u30D6\u30ED\u30C3\u30AF|block/i, () => name) :\n `${name}: ${messages.title}` : messages.title;\n return React.createElement(ModalComponent, { className: `${styles.modalContent || ''} ${hierarchy ? styles.hierarchyModal : ''} ${this.props.className || ''}`, contentLabel: title, ...((appearance === null || appearance === void 0 ? void 0 : appearance.iconURI) ? { headerImage: appearance.iconURI } : {}), headerClassName: styles.header, 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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Ac,KAAK,EAAE,KAAK,MAAM,GAAG,MAAM,OAAO;AAAA,YACnF,CAAC;AAAA,YACD,KAAK,MAAM,iBAAiB,4BAA4B,SAAS,iBAC7D,KAAK,MAAM,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;",
|
|
6
6
|
"names": ["_a"]
|
|
7
7
|
}
|
package/dist/webpack4/rjsf.js
CHANGED
|
@@ -4917,7 +4917,7 @@ var require_react_is_development = __commonJS({
|
|
|
4917
4917
|
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
4918
4918
|
var Element = REACT_ELEMENT_TYPE;
|
|
4919
4919
|
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
4920
|
-
var
|
|
4920
|
+
var Fragment4 = REACT_FRAGMENT_TYPE;
|
|
4921
4921
|
var Lazy = REACT_LAZY_TYPE;
|
|
4922
4922
|
var Memo = REACT_MEMO_TYPE;
|
|
4923
4923
|
var Portal = REACT_PORTAL_TYPE;
|
|
@@ -4985,7 +4985,7 @@ var require_react_is_development = __commonJS({
|
|
|
4985
4985
|
exports2.ContextProvider = ContextProvider;
|
|
4986
4986
|
exports2.Element = Element;
|
|
4987
4987
|
exports2.ForwardRef = ForwardRef;
|
|
4988
|
-
exports2.Fragment =
|
|
4988
|
+
exports2.Fragment = Fragment4;
|
|
4989
4989
|
exports2.Lazy = Lazy;
|
|
4990
4990
|
exports2.Memo = Memo;
|
|
4991
4991
|
exports2.Portal = Portal;
|
|
@@ -5027,7 +5027,7 @@ var require_react_is = __commonJS({
|
|
|
5027
5027
|
});
|
|
5028
5028
|
|
|
5029
5029
|
// dist/rjsf.js
|
|
5030
|
-
import * as
|
|
5030
|
+
import * as React4 from "react";
|
|
5031
5031
|
|
|
5032
5032
|
// node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/browser/dist/nodes/identity.js
|
|
5033
5033
|
var ALIAS = /* @__PURE__ */ Symbol.for("yaml.alias");
|
|
@@ -11634,11 +11634,11 @@ function checkYamlKeys(node) {
|
|
|
11634
11634
|
}
|
|
11635
11635
|
}
|
|
11636
11636
|
function yamlDocument(source) {
|
|
11637
|
-
const
|
|
11638
|
-
if (
|
|
11637
|
+
const document2 = parseDocument(source[0] === "\uFEFF" ? source.slice(1) : source, { keepSourceTokens: true, uniqueKeys: true, strict: true, version: "1.2", prettyErrors: false });
|
|
11638
|
+
if (document2.errors.length || document2.warnings.length)
|
|
11639
11639
|
fail();
|
|
11640
|
-
checkYamlKeys(
|
|
11641
|
-
return
|
|
11640
|
+
checkYamlKeys(document2.contents);
|
|
11641
|
+
return document2;
|
|
11642
11642
|
}
|
|
11643
11643
|
function yamlValue(source) {
|
|
11644
11644
|
return snapshot(yamlDocument(source).toJS({ maxAliasCount: 100 }));
|
|
@@ -11647,7 +11647,7 @@ function patchYaml(source, original, edited) {
|
|
|
11647
11647
|
var _a;
|
|
11648
11648
|
if (source[0] === "\uFEFF")
|
|
11649
11649
|
return "\uFEFF" + patchYaml(source.slice(1), original, edited);
|
|
11650
|
-
const
|
|
11650
|
+
const document2 = yamlDocument(source);
|
|
11651
11651
|
const patches = [];
|
|
11652
11652
|
const comments = [];
|
|
11653
11653
|
const annotations = [];
|
|
@@ -11670,7 +11670,7 @@ function patchYaml(source, original, edited) {
|
|
|
11670
11670
|
for (const child of Object.values(value))
|
|
11671
11671
|
tokens(child);
|
|
11672
11672
|
};
|
|
11673
|
-
tokens((_a =
|
|
11673
|
+
tokens((_a = document2.contents) === null || _a === void 0 ? void 0 : _a.srcToken);
|
|
11674
11674
|
const remove = (start, end) => {
|
|
11675
11675
|
if (comments.some(([a2, b2]) => a2 < end && b2 > start) || annotations.some(([a2, b2]) => a2 < end && b2 > start))
|
|
11676
11676
|
fail();
|
|
@@ -11784,7 +11784,7 @@ function patchYaml(source, original, edited) {
|
|
|
11784
11784
|
text += " ";
|
|
11785
11785
|
patches.push({ start, end, text });
|
|
11786
11786
|
};
|
|
11787
|
-
visit3(
|
|
11787
|
+
visit3(document2.contents, original, edited);
|
|
11788
11788
|
return apply(source, patches);
|
|
11789
11789
|
}
|
|
11790
11790
|
function patchSource(source, format, original, edited) {
|
|
@@ -12072,11 +12072,11 @@ function SourceView({ context, bindings }) {
|
|
|
12072
12072
|
var _a, _b;
|
|
12073
12073
|
const entry = sources[binding.argument];
|
|
12074
12074
|
const selectedCreation = Object.hasOwn(creating, binding.argument) ? creating[binding.argument] : "";
|
|
12075
|
-
let
|
|
12075
|
+
let document2;
|
|
12076
12076
|
let variant;
|
|
12077
12077
|
try {
|
|
12078
|
-
|
|
12079
|
-
variant = binding.presentationVariants.find((v2) => v2.format ===
|
|
12078
|
+
document2 = readSourceDocument(binding, entry.source);
|
|
12079
|
+
variant = binding.presentationVariants.find((v2) => v2.format === document2.format && v2.variantId === document2.variantId);
|
|
12080
12080
|
} catch (_c) {
|
|
12081
12081
|
}
|
|
12082
12082
|
if (record2(entry.creating)) {
|
|
@@ -12091,7 +12091,7 @@ function SourceView({ context, bindings }) {
|
|
|
12091
12091
|
try {
|
|
12092
12092
|
if (entry.invalidForm === true)
|
|
12093
12093
|
throw new TypeError();
|
|
12094
|
-
const source = record2(entry.creating) ? createSourceCandidate(entry.creating.format, entry.data) : entry.mode === "form" &&
|
|
12094
|
+
const source = record2(entry.creating) ? createSourceCandidate(entry.creating.format, entry.data) : entry.mode === "form" && document2 && Object.hasOwn(entry, "data") ? patchDecodedSource(document2, entry.data, (source2) => readSourceDocument(binding, source2)) : entry.source;
|
|
12095
12095
|
const next = { ...entry, mode: "source", source, invalidForm: false, invalidNumbers: {} };
|
|
12096
12096
|
delete next.creating;
|
|
12097
12097
|
update(binding.argument, next);
|
|
@@ -12119,8 +12119,8 @@ function SourceView({ context, bindings }) {
|
|
|
12119
12119
|
update(binding.argument, { mode: "form", source: entry.source, sourceEdited: true, creating: { format, variantId }, data: initial(type) });
|
|
12120
12120
|
} }, "Create document (replace source)"),
|
|
12121
12121
|
React.createElement("button", { type: "button", disabled: !variant, "aria-pressed": entry.mode === "form", onClick: () => {
|
|
12122
|
-
if (
|
|
12123
|
-
update(binding.argument, { ...entry, mode: "form", data: Object.hasOwn(entry, "data") ? entry.data :
|
|
12122
|
+
if (document2 || entry.creating)
|
|
12123
|
+
update(binding.argument, { ...entry, mode: "form", data: Object.hasOwn(entry, "data") ? entry.data : document2.data });
|
|
12124
12124
|
} }, "Form"),
|
|
12125
12125
|
entry.mode === "form" && React.createElement("button", { type: "button", onClick: () => {
|
|
12126
12126
|
var _a2;
|
|
@@ -12177,14 +12177,14 @@ function createSourceCandidate(format, data) {
|
|
|
12177
12177
|
const value = snapshotJson(data);
|
|
12178
12178
|
return format === "json" ? JSON.stringify(value, null, 2) : "---\n" + stringify3(value, { version: "1.2" });
|
|
12179
12179
|
}
|
|
12180
|
-
function patchDecodedSource(
|
|
12181
|
-
if (
|
|
12182
|
-
const body =
|
|
12183
|
-
const start =
|
|
12184
|
-
return
|
|
12180
|
+
function patchDecodedSource(document2, data, decode) {
|
|
12181
|
+
if (document2.format === "json") {
|
|
12182
|
+
const body = document2.source.trim();
|
|
12183
|
+
const start = document2.source.length - document2.source.trimStart().length;
|
|
12184
|
+
return document2.source.slice(0, start) + patchSource(body, "json", document2.data, data) + document2.source.slice(start + body.length);
|
|
12185
12185
|
}
|
|
12186
|
-
let candidate = patchSource(
|
|
12187
|
-
if (decode && decode(candidate).format !==
|
|
12186
|
+
let candidate = patchSource(document2.source, document2.format, document2.data, data);
|
|
12187
|
+
if (decode && decode(candidate).format !== document2.format) {
|
|
12188
12188
|
candidate = candidate.startsWith("\uFEFF") ? "\uFEFF---\n" + candidate.slice(1) : "---\n" + candidate;
|
|
12189
12189
|
}
|
|
12190
12190
|
return candidate;
|
|
@@ -12355,19 +12355,19 @@ function createSourceEditor(options) {
|
|
|
12355
12355
|
}
|
|
12356
12356
|
if (validation.result.diagnostics.length)
|
|
12357
12357
|
throw new TypeError();
|
|
12358
|
-
const
|
|
12359
|
-
if (isJsonRecord(entry.creating) && (
|
|
12358
|
+
const document2 = readSourceDocument(binding, candidate);
|
|
12359
|
+
if (isJsonRecord(entry.creating) && (document2.format !== entry.creating.format || document2.variantId !== entry.creating.variantId)) {
|
|
12360
12360
|
issues.push(issue("variant-unrecognized", path));
|
|
12361
12361
|
continue;
|
|
12362
12362
|
}
|
|
12363
|
-
const validator = binding.validators.get(keyFor(
|
|
12363
|
+
const validator = binding.validators.get(keyFor(document2.format, document2.variantId));
|
|
12364
12364
|
if (validator) {
|
|
12365
|
-
const result = validator.validate(
|
|
12365
|
+
const result = validator.validate(document2.data, { consumerId: context.consumerId });
|
|
12366
12366
|
if (result.kind !== "valid") {
|
|
12367
12367
|
issues.push(issue("schema-data-invalid", path));
|
|
12368
12368
|
continue;
|
|
12369
12369
|
}
|
|
12370
|
-
} else if (entry.mode === "form" || candidate !== slot.value && !((_a2 = binding.sourceOnlyVariants) === null || _a2 === void 0 ? void 0 : _a2.some((v2) => v2.variantId ===
|
|
12370
|
+
} else if (entry.mode === "form" || candidate !== slot.value && !((_a2 = binding.sourceOnlyVariants) === null || _a2 === void 0 ? void 0 : _a2.some((v2) => v2.variantId === document2.variantId && v2.format === document2.format))) {
|
|
12371
12371
|
issues.push(issue("variant-unrecognized", path));
|
|
12372
12372
|
continue;
|
|
12373
12373
|
}
|
|
@@ -21302,14 +21302,182 @@ function fieldErrors(issues) {
|
|
|
21302
21302
|
return root2;
|
|
21303
21303
|
}
|
|
21304
21304
|
|
|
21305
|
+
// dist/rjsf-templates.js
|
|
21306
|
+
import * as React3 from "react";
|
|
21307
|
+
var ItemNumber = React3.createContext(1);
|
|
21308
|
+
var PropertyKey = React3.createContext(void 0);
|
|
21309
|
+
function valueFieldTemplate(DefaultTemplate, flag) {
|
|
21310
|
+
return function ValueField2(props) {
|
|
21311
|
+
if (!(flag in props.schema))
|
|
21312
|
+
return React3.createElement(DefaultTemplate, { ...props });
|
|
21313
|
+
return React3.createElement(
|
|
21314
|
+
PropertyKey.Provider,
|
|
21315
|
+
{ value: props.label },
|
|
21316
|
+
React3.createElement(DefaultTemplate, { ...props, label: "\u5024" })
|
|
21317
|
+
);
|
|
21318
|
+
};
|
|
21319
|
+
}
|
|
21320
|
+
function numberedObjectTemplate(DefaultTemplate, flag) {
|
|
21321
|
+
return function ObjectItems2(props) {
|
|
21322
|
+
let number = 0;
|
|
21323
|
+
const properties = props.properties.map((property2) => {
|
|
21324
|
+
var _a;
|
|
21325
|
+
const schema4 = (_a = props.schema.properties) === null || _a === void 0 ? void 0 : _a[property2.name];
|
|
21326
|
+
if (!schema4 || typeof schema4 !== "object" || !(flag in schema4) || property2.hidden)
|
|
21327
|
+
return property2;
|
|
21328
|
+
return { ...property2, content: React3.createElement(ItemNumber.Provider, { key: property2.name, value: ++number }, property2.content) };
|
|
21329
|
+
});
|
|
21330
|
+
return React3.createElement(DefaultTemplate, { ...props, properties });
|
|
21331
|
+
};
|
|
21332
|
+
}
|
|
21333
|
+
function additionalItemTemplate(flag) {
|
|
21334
|
+
return function AdditionalItem2(props) {
|
|
21335
|
+
const number = React3.useContext(ItemNumber);
|
|
21336
|
+
const propertyKey = React3.useContext(PropertyKey);
|
|
21337
|
+
const { id, classNames, style, children, schema: schema4, label, disabled, readonly, onKeyChange, onDropPropertyClick } = props;
|
|
21338
|
+
if (!(flag in schema4))
|
|
21339
|
+
return React3.createElement("div", { className: classNames, style }, children);
|
|
21340
|
+
const key = propertyKey !== null && propertyKey !== void 0 ? propertyKey : label;
|
|
21341
|
+
return React3.createElement(
|
|
21342
|
+
"div",
|
|
21343
|
+
{ className: classNames, style, "data-block-editor-item": "" },
|
|
21344
|
+
React3.createElement(
|
|
21345
|
+
"div",
|
|
21346
|
+
{ "data-block-editor-item-heading": "" },
|
|
21347
|
+
React3.createElement(
|
|
21348
|
+
"span",
|
|
21349
|
+
null,
|
|
21350
|
+
"\u30FB\u9805\u76EE",
|
|
21351
|
+
number
|
|
21352
|
+
),
|
|
21353
|
+
React3.createElement(ItemMenu, { disabled: disabled || readonly, onClick: onDropPropertyClick(key) })
|
|
21354
|
+
),
|
|
21355
|
+
React3.createElement(
|
|
21356
|
+
"div",
|
|
21357
|
+
{ "data-block-editor-pair-row": "" },
|
|
21358
|
+
React3.createElement("label", { htmlFor: `${id}-key` }, "\u30AD\u30FC"),
|
|
21359
|
+
React3.createElement("input", { id: `${id}-key`, type: "text", defaultValue: key, disabled, readOnly: readonly, onBlur: (event) => onKeyChange(event.target.value) })
|
|
21360
|
+
),
|
|
21361
|
+
React3.createElement("div", { "data-block-editor-pair-row": "" }, children)
|
|
21362
|
+
);
|
|
21363
|
+
};
|
|
21364
|
+
}
|
|
21365
|
+
function ItemMenu({ disabled, onClick }) {
|
|
21366
|
+
const [open, setOpen] = React3.useState(false);
|
|
21367
|
+
const container = React3.useRef(null);
|
|
21368
|
+
const trigger = React3.useRef(null);
|
|
21369
|
+
const item = React3.useRef(null);
|
|
21370
|
+
React3.useEffect(() => {
|
|
21371
|
+
var _a;
|
|
21372
|
+
if (!open)
|
|
21373
|
+
return;
|
|
21374
|
+
(_a = item.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
21375
|
+
const closeOutside = (event) => {
|
|
21376
|
+
var _a2;
|
|
21377
|
+
if (!((_a2 = container.current) === null || _a2 === void 0 ? void 0 : _a2.contains(event.target)))
|
|
21378
|
+
setOpen(false);
|
|
21379
|
+
};
|
|
21380
|
+
const keepEscapeInMenu = (event) => {
|
|
21381
|
+
var _a2;
|
|
21382
|
+
if (event.key !== "Escape" || event.isComposing || event.keyCode === 229)
|
|
21383
|
+
return;
|
|
21384
|
+
event.preventDefault();
|
|
21385
|
+
event.stopPropagation();
|
|
21386
|
+
setOpen(false);
|
|
21387
|
+
(_a2 = trigger.current) === null || _a2 === void 0 ? void 0 : _a2.focus();
|
|
21388
|
+
};
|
|
21389
|
+
const menu = container.current;
|
|
21390
|
+
menu === null || menu === void 0 ? void 0 : menu.addEventListener("keydown", keepEscapeInMenu);
|
|
21391
|
+
document.addEventListener("mousedown", closeOutside);
|
|
21392
|
+
return () => {
|
|
21393
|
+
menu === null || menu === void 0 ? void 0 : menu.removeEventListener("keydown", keepEscapeInMenu);
|
|
21394
|
+
document.removeEventListener("mousedown", closeOutside);
|
|
21395
|
+
};
|
|
21396
|
+
}, [open]);
|
|
21397
|
+
React3.useEffect(() => {
|
|
21398
|
+
if (disabled)
|
|
21399
|
+
setOpen(false);
|
|
21400
|
+
}, [disabled]);
|
|
21401
|
+
return React3.createElement(
|
|
21402
|
+
"div",
|
|
21403
|
+
{ "data-block-editor-item-menu": "", ref: container, onBlur: (event) => {
|
|
21404
|
+
if (!event.currentTarget.contains(event.relatedTarget))
|
|
21405
|
+
setOpen(false);
|
|
21406
|
+
}, onKeyDown: (event) => {
|
|
21407
|
+
var _a, _b;
|
|
21408
|
+
if (event.key === "Escape" && open && !event.nativeEvent.isComposing && event.keyCode !== 229) {
|
|
21409
|
+
event.preventDefault();
|
|
21410
|
+
event.stopPropagation();
|
|
21411
|
+
setOpen(false);
|
|
21412
|
+
(_a = trigger.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
21413
|
+
} else if (["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key)) {
|
|
21414
|
+
event.preventDefault();
|
|
21415
|
+
if (open)
|
|
21416
|
+
(_b = item.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
21417
|
+
else if (!disabled)
|
|
21418
|
+
setOpen(true);
|
|
21419
|
+
}
|
|
21420
|
+
} },
|
|
21421
|
+
React3.createElement("button", { "aria-label": "\u9805\u76EE\u306E\u30E1\u30CB\u30E5\u30FC", "aria-haspopup": "menu", "aria-expanded": open && !disabled, disabled, ref: trigger, type: "button", onClick: () => setOpen(!open) }, "\u2026"),
|
|
21422
|
+
open && !disabled ? React3.createElement(
|
|
21423
|
+
"div",
|
|
21424
|
+
{ role: "menu", "aria-label": "\u9805\u76EE\u306E\u64CD\u4F5C" },
|
|
21425
|
+
React3.createElement("button", { ref: item, role: "menuitem", type: "button", onClick: (event) => {
|
|
21426
|
+
var _a;
|
|
21427
|
+
setOpen(false);
|
|
21428
|
+
(_a = trigger.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
21429
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
21430
|
+
} }, "\u{1F5D1}\uFE0F\u3053\u306E\u9805\u76EE\u3092\u524A\u9664")
|
|
21431
|
+
) : null
|
|
21432
|
+
);
|
|
21433
|
+
}
|
|
21434
|
+
function AddItemButton({ disabled, onClick, className }) {
|
|
21435
|
+
return React3.createElement("button", { className, "data-block-editor-add-item": "", disabled, type: "button", onClick }, "\u2795\u9805\u76EE\u3092\u8FFD\u52A0");
|
|
21436
|
+
}
|
|
21437
|
+
function ArrayItem(props) {
|
|
21438
|
+
const { children, className, disabled, readonly, index, hasMoveUp, hasMoveDown, hasCopy, hasRemove, onReorderClick, onCopyIndexClick, onDropIndexClick } = props;
|
|
21439
|
+
const locked = disabled || readonly;
|
|
21440
|
+
return React3.createElement(
|
|
21441
|
+
"div",
|
|
21442
|
+
{ className, "data-block-editor-item": "" },
|
|
21443
|
+
React3.createElement(
|
|
21444
|
+
"div",
|
|
21445
|
+
{ "data-block-editor-item-heading": "" },
|
|
21446
|
+
React3.createElement(
|
|
21447
|
+
"span",
|
|
21448
|
+
null,
|
|
21449
|
+
"\u30FB\u9805\u76EE",
|
|
21450
|
+
index + 1
|
|
21451
|
+
),
|
|
21452
|
+
React3.createElement(
|
|
21453
|
+
"div",
|
|
21454
|
+
{ "data-block-editor-item-actions": "" },
|
|
21455
|
+
hasMoveUp || hasMoveDown ? React3.createElement(
|
|
21456
|
+
React3.Fragment,
|
|
21457
|
+
null,
|
|
21458
|
+
React3.createElement("button", { "aria-label": "\u9805\u76EE\u3092\u4E0A\u3078\u79FB\u52D5", disabled: locked || !hasMoveUp, type: "button", onClick: onReorderClick(index, index - 1) }, "\u2191"),
|
|
21459
|
+
React3.createElement("button", { "aria-label": "\u9805\u76EE\u3092\u4E0B\u3078\u79FB\u52D5", disabled: locked || !hasMoveDown, type: "button", onClick: onReorderClick(index, index + 1) }, "\u2193")
|
|
21460
|
+
) : null,
|
|
21461
|
+
hasCopy ? React3.createElement("button", { disabled: locked, type: "button", onClick: onCopyIndexClick(index) }, "\u9805\u76EE\u3092\u8907\u88FD") : null,
|
|
21462
|
+
hasRemove ? React3.createElement(ItemMenu, { disabled: locked, onClick: onDropIndexClick(index) }) : null
|
|
21463
|
+
)
|
|
21464
|
+
),
|
|
21465
|
+
children
|
|
21466
|
+
);
|
|
21467
|
+
}
|
|
21468
|
+
|
|
21305
21469
|
// dist/rjsf.js
|
|
21306
21470
|
function moduleExports4(namespace) {
|
|
21307
21471
|
const fallback = namespace.default;
|
|
21308
21472
|
return fallback && typeof fallback === "object" && "__esModule" in fallback ? fallback : namespace;
|
|
21309
21473
|
}
|
|
21310
21474
|
var Form2 = moduleExports4(lib_exports2).default;
|
|
21311
|
-
var { getDefaultFormState: getDefaultFormState2 } = moduleExports4(lib_exports);
|
|
21475
|
+
var { getDefaultFormState: getDefaultFormState2, ADDITIONAL_PROPERTY_FLAG: ADDITIONAL_PROPERTY_FLAG2 } = moduleExports4(lib_exports);
|
|
21312
21476
|
var { customizeValidator: customizeValidator2 } = moduleExports4(lib_exports3);
|
|
21477
|
+
var defaultTemplates = moduleExports4(lib_exports2).getDefaultRegistry().templates;
|
|
21478
|
+
var ObjectItems = numberedObjectTemplate(defaultTemplates.ObjectFieldTemplate, ADDITIONAL_PROPERTY_FLAG2);
|
|
21479
|
+
var AdditionalItem = additionalItemTemplate(ADDITIONAL_PROPERTY_FLAG2);
|
|
21480
|
+
var ValueField = valueFieldTemplate(defaultTemplates.FieldTemplate, ADDITIONAL_PROPERTY_FLAG2);
|
|
21313
21481
|
var nextViewId = 0;
|
|
21314
21482
|
function createSchemaBundleEditor(options) {
|
|
21315
21483
|
const { schemaBundle, validationContext: provider, ownerValidate, apiVersion, extensionId, editorId, opcodes, argument, format, uiSchema, validateData } = options;
|
|
@@ -21507,6 +21675,13 @@ function createSchemaEditorImpl(options, bundle) {
|
|
|
21507
21675
|
uiSchema,
|
|
21508
21676
|
validator,
|
|
21509
21677
|
idPrefix,
|
|
21678
|
+
templates: {
|
|
21679
|
+
ArrayFieldItemTemplate: ArrayItem,
|
|
21680
|
+
ObjectFieldTemplate: ObjectItems,
|
|
21681
|
+
WrapIfAdditionalTemplate: AdditionalItem,
|
|
21682
|
+
FieldTemplate: ValueField,
|
|
21683
|
+
ButtonTemplates: { AddButton: AddItemButton, RemoveButton: ItemMenu }
|
|
21684
|
+
},
|
|
21510
21685
|
formData: dataFor(context.getDraft()),
|
|
21511
21686
|
// Defaults belong to read(), not subsequent renders or remounts.
|
|
21512
21687
|
experimental_defaultFormStateBehavior: {
|
|
@@ -21527,7 +21702,7 @@ function createSchemaEditorImpl(options, bundle) {
|
|
|
21527
21702
|
context.setValidationIssues(issuesFor(data));
|
|
21528
21703
|
}
|
|
21529
21704
|
};
|
|
21530
|
-
ReactDOM3.render(
|
|
21705
|
+
ReactDOM3.render(React4.createElement(Form2, props, React4.createElement("span", { hidden: true })), container);
|
|
21531
21706
|
};
|
|
21532
21707
|
const schedule = () => {
|
|
21533
21708
|
if (scheduled || !active)
|