@powerhousedao/powerhouse-vetra-packages 6.1.0-dev.2 → 6.1.0-dev.21
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/dist/browser/assets/entry-Bzani6_n.js +313 -0
- package/dist/browser/assets/projection-entry-Bpu-8SnI.js +406 -0
- package/dist/browser/{dist-DOMEWT3x.js → connect-ZnLjvmRt.js} +13013 -10302
- package/dist/browser/connect-ZnLjvmRt.js.map +1 -0
- package/dist/browser/dist-C1nRM9t2.js +3768 -0
- package/dist/browser/dist-C1nRM9t2.js.map +1 -0
- package/dist/browser/{schemas-Bqem6NRm.js → dist-CXoKspdx.js} +131 -2
- package/dist/browser/dist-CXoKspdx.js.map +1 -0
- package/dist/browser/dist-D8H48e8N.js +2692 -0
- package/dist/browser/dist-D8H48e8N.js.map +1 -0
- package/dist/browser/{dist-CC1E3l2O.js → dist-DLFI75Zd.js} +37 -9
- package/dist/browser/dist-DLFI75Zd.js.map +1 -0
- package/dist/browser/{dist-DQgJ8n4d.js → document-drive-oqv68jDU.js} +432 -290
- package/dist/browser/document-drive-oqv68jDU.js.map +1 -0
- package/dist/browser/document-models/index.js +1 -1
- package/dist/browser/{documents-Bpu0aSLb.js → documents-D4ek7Ubv.js} +3 -3
- package/dist/browser/{documents-Bpu0aSLb.js.map → documents-D4ek7Ubv.js.map} +1 -1
- package/dist/browser/{editor-B3yz7YdR.js → editor-CoTq6fqT.js} +32 -31
- package/dist/browser/editor-CoTq6fqT.js.map +1 -0
- package/dist/browser/{editor-Dm_73jiz.js → editor-DC3bigBu.js} +5 -5
- package/dist/browser/{editor-Dm_73jiz.js.map → editor-DC3bigBu.js.map} +1 -1
- package/dist/browser/editors/document-model-editor/module.js +1 -1
- package/dist/browser/editors/generic-drive-explorer/index.js +6 -6
- package/dist/browser/editors/generic-drive-explorer/index.js.map +1 -1
- package/dist/browser/editors/generic-drive-explorer/module.js +1 -1
- package/dist/browser/{folder-view-H2ov-zId.js → folder-view-DmYBf2pP.js} +13 -12
- package/dist/browser/folder-view-DmYBf2pP.js.map +1 -0
- package/dist/browser/{graphql-editor-CnaQ3XWx.js → graphql-editor-CiGd_Li7.js} +15 -7
- package/dist/browser/{graphql-editor-CnaQ3XWx.js.map → graphql-editor-CiGd_Li7.js.map} +1 -1
- package/dist/{node/hooks-Lbsf6g-v.mjs → browser/hooks-CORHBNHb.js} +6 -4
- package/dist/browser/{hooks-Beny0xpe.js.map → hooks-CORHBNHb.js.map} +1 -1
- package/dist/browser/index.js +2 -2
- package/dist/{node/json-editor-CVGgDVh2.mjs → browser/json-editor-sEqd5piI.js} +12 -4
- package/dist/browser/json-editor-sEqd5piI.js.map +1 -0
- package/dist/browser/{style-DYS_RFSN.js → linting-Dn6pXRkK.js} +7 -14
- package/dist/browser/linting-Dn6pXRkK.js.map +1 -0
- package/dist/browser/{parser-B0sh99Kk.js → parser-CkF6Qt8V.js} +1 -1
- package/dist/browser/{parser-B0sh99Kk.js.map → parser-CkF6Qt8V.js.map} +1 -1
- package/dist/browser/{schema-context-C0GpuR27.js → schema-context-DY-GEGnY.js} +4 -4
- package/dist/browser/schema-context-DY-GEGnY.js.map +1 -0
- package/dist/browser/state-schemas-DJmzG_M8.js +308 -0
- package/dist/browser/state-schemas-DJmzG_M8.js.map +1 -0
- package/dist/node/{dist-1kPMPFPD.mjs → connect-BLC4PXD9.mjs} +13953 -11229
- package/dist/node/connect-BLC4PXD9.mjs.map +1 -0
- package/dist/node/dist-BeZaEP6S.mjs +2692 -0
- package/dist/node/dist-BeZaEP6S.mjs.map +1 -0
- package/dist/node/dist-Bm05eoTg.mjs +3769 -0
- package/dist/node/dist-Bm05eoTg.mjs.map +1 -0
- package/dist/node/{tslib.es6-DwVpIYUS.mjs → dist-Cn3iExnV.mjs} +489 -3
- package/dist/node/dist-Cn3iExnV.mjs.map +1 -0
- package/dist/node/{schemas-Cb8uEF9u.mjs → dist-fA4EItr0.mjs} +131 -2
- package/dist/node/dist-fA4EItr0.mjs.map +1 -0
- package/dist/node/{dist-Bz4SgEHs.mjs → document-drive-sM33juXr.mjs} +432 -290
- package/dist/node/document-drive-sM33juXr.mjs.map +1 -0
- package/dist/node/document-models/index.mjs +1 -1
- package/dist/node/{documents-BWJpUm9f.mjs → documents-BFBPmyw1.mjs} +3 -3
- package/dist/node/{documents-BWJpUm9f.mjs.map → documents-BFBPmyw1.mjs.map} +1 -1
- package/dist/node/{editor-W8QOlGXD.mjs → editor-BFBa9nsO.mjs} +32 -31
- package/dist/node/editor-BFBa9nsO.mjs.map +1 -0
- package/dist/node/{editor-BaXuDsby.mjs → editor-BrS98lEH.mjs} +5 -5
- package/dist/node/{editor-BaXuDsby.mjs.map → editor-BrS98lEH.mjs.map} +1 -1
- package/dist/node/editors/document-model-editor/module.mjs +1 -1
- package/dist/node/editors/generic-drive-explorer/index.mjs +6 -6
- package/dist/node/editors/generic-drive-explorer/index.mjs.map +1 -1
- package/dist/node/editors/generic-drive-explorer/module.mjs +1 -1
- package/dist/node/{folder-view-B0FNXbc0.mjs → folder-view-DHph3Yuu.mjs} +13 -12
- package/dist/node/folder-view-DHph3Yuu.mjs.map +1 -0
- package/dist/node/{graphql-Du2phcBf.mjs → graphql-DskHmkMe.mjs} +2 -2
- package/dist/node/{graphql-Du2phcBf.mjs.map → graphql-DskHmkMe.mjs.map} +1 -1
- package/dist/node/{graphql-editor-D1koK5kR.mjs → graphql-editor-CPq7oIbf.mjs} +14 -6
- package/dist/node/{graphql-editor-D1koK5kR.mjs.map → graphql-editor-CPq7oIbf.mjs.map} +1 -1
- package/dist/{browser/hooks-Beny0xpe.js → node/hooks-DJrjfVaS.mjs} +6 -4
- package/dist/node/{hooks-Lbsf6g-v.mjs.map → hooks-DJrjfVaS.mjs.map} +1 -1
- package/dist/node/index.mjs +2 -2
- package/dist/{browser/json-editor-h3cffF6X.js → node/json-editor-L32CP7TS.mjs} +12 -4
- package/dist/node/json-editor-L32CP7TS.mjs.map +1 -0
- package/dist/node/{style-CxHkfyna.mjs → linting-Dx50GuLN.mjs} +7 -14
- package/dist/node/linting-Dx50GuLN.mjs.map +1 -0
- package/dist/node/{schema-context-mLgEY1Hh.mjs → schema-context-CX5ml_9t.mjs} +4 -4
- package/dist/node/schema-context-CX5ml_9t.mjs.map +1 -0
- package/dist/node/state-schemas-XTTjQZOe.mjs +309 -0
- package/dist/node/state-schemas-XTTjQZOe.mjs.map +1 -0
- package/package.json +10 -10
- package/style.css +1 -0
- package/dist/browser/connect-CKdlDSUw.js +0 -9460
- package/dist/browser/connect-CKdlDSUw.js.map +0 -1
- package/dist/browser/dist-BXygvBtd.js +0 -132
- package/dist/browser/dist-BXygvBtd.js.map +0 -1
- package/dist/browser/dist-CC1E3l2O.js.map +0 -1
- package/dist/browser/dist-DOMEWT3x.js.map +0 -1
- package/dist/browser/dist-DQgJ8n4d.js.map +0 -1
- package/dist/browser/editor-B3yz7YdR.js.map +0 -1
- package/dist/browser/folder-view-H2ov-zId.js.map +0 -1
- package/dist/browser/json-editor-h3cffF6X.js.map +0 -1
- package/dist/browser/schema-context-C0GpuR27.js.map +0 -1
- package/dist/browser/schemas-Bqem6NRm.js.map +0 -1
- package/dist/browser/state-schemas-C5NPeV6-.js +0 -674
- package/dist/browser/state-schemas-C5NPeV6-.js.map +0 -1
- package/dist/browser/style-DYS_RFSN.js.map +0 -1
- package/dist/browser/tslib.es6-DRuVAsR8.js +0 -32
- package/dist/browser/tslib.es6-DRuVAsR8.js.map +0 -1
- package/dist/node/connect-SGvLzr5K.mjs +0 -9475
- package/dist/node/connect-SGvLzr5K.mjs.map +0 -1
- package/dist/node/dist-1kPMPFPD.mjs.map +0 -1
- package/dist/node/dist-BQTIepWC.mjs +0 -132
- package/dist/node/dist-BQTIepWC.mjs.map +0 -1
- package/dist/node/dist-Bz4SgEHs.mjs.map +0 -1
- package/dist/node/dist-Cay1iRRr.mjs +0 -491
- package/dist/node/dist-Cay1iRRr.mjs.map +0 -1
- package/dist/node/editor-W8QOlGXD.mjs.map +0 -1
- package/dist/node/folder-view-B0FNXbc0.mjs.map +0 -1
- package/dist/node/json-editor-CVGgDVh2.mjs.map +0 -1
- package/dist/node/schema-context-mLgEY1Hh.mjs.map +0 -1
- package/dist/node/schemas-Cb8uEF9u.mjs.map +0 -1
- package/dist/node/state-schemas-DAthoEEk.mjs +0 -675
- package/dist/node/state-schemas-DAthoEEk.mjs.map +0 -1
- package/dist/node/style-CxHkfyna.mjs.map +0 -1
- package/dist/node/tslib.es6-DwVpIYUS.mjs.map +0 -1
- package/dist/style.css +0 -906
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editor-B3yz7YdR.js","names":["use","React","React","r","cn","e","s","i","t","o","r","e","n.parse","n.parseAsync","n.$ZodError","z.string","z\n .string","z\n .object","z\n .union","z.url","z.literal","Label","React","React","LabelPrimitive.Root","React","zodResolver","z.object","z.object","z.string"],"sources":["../../../../node_modules/.pnpm/@radix-ui+react-slot@1.2.4_@types+react@19.2.14_react@19.2.6/node_modules/@radix-ui/react-slot/dist/index.mjs","../../../../node_modules/.pnpm/@radix-ui+react-primitive@2.1.4_@types+react-dom@19.2.3_@types+react@19.2.14__@types+re_c8c8fd2647f03197dbf56370d7498033/node_modules/@radix-ui/react-primitive/dist/index.mjs","../../../../node_modules/.pnpm/clsx@2.0.0/node_modules/clsx/dist/clsx.mjs","../../../../node_modules/.pnpm/class-variance-authority@0.7.0/node_modules/class-variance-authority/dist/index.mjs","../../editors/document-model-editor/components/divider.tsx","../../../../node_modules/.pnpm/@hookform+resolvers@5.2.2_react-hook-form@7.71.2_react@19.2.6_/node_modules/@hookform/resolvers/dist/resolvers.mjs","../../../../node_modules/.pnpm/@hookform+resolvers@5.2.2_react-hook-form@7.71.2_react@19.2.6_/node_modules/@hookform/resolvers/zod/dist/zod.mjs","../../editors/document-model-editor/schemas/inputs.ts","../../editors/document-model-editor/context/form-context.ts","../../editors/document-model-editor/hooks/useFormField.ts","../../../../node_modules/.pnpm/@radix-ui+react-label@2.1.8_@types+react-dom@19.2.3_@types+react@19.2.14__@types+react@_8d35ec453e0b59eefe06771bb1432577/node_modules/@radix-ui/react-label/dist/index.mjs","../../editors/document-model-editor/components/label.tsx","../../editors/document-model-editor/components/form.tsx","../../editors/document-model-editor/components/text-area.tsx","../../editors/document-model-editor/components/text-field.tsx","../../editors/document-model-editor/components/model-metadata-form.tsx","../../editors/document-model-editor/components/module-form.tsx","../../editors/document-model-editor/components/operation-form.tsx","../../editors/document-model-editor/components/operation-description-form.tsx","../../editors/document-model-editor/components/operation-error-form.tsx","../../editors/document-model-editor/components/operation-errors.tsx","../../editors/document-model-editor/components/operation.tsx","../../editors/document-model-editor/components/operations.tsx","../../editors/document-model-editor/components/module.tsx","../../editors/document-model-editor/components/modules.tsx","../../editors/document-model-editor/config.ts","../../editors/document-model-editor/hooks/useDocumentModelDocument.ts","../../editors/document-model-editor/editor.tsx"],"sourcesContent":["// src/slot.tsx\nimport * as React from \"react\";\nimport { composeRefs } from \"@radix-ui/react-compose-refs\";\nimport { Fragment as Fragment2, jsx } from \"react/jsx-runtime\";\nvar REACT_LAZY_TYPE = Symbol.for(\"react.lazy\");\nvar use = React[\" use \".trim().toString()];\nfunction isPromiseLike(value) {\n return typeof value === \"object\" && value !== null && \"then\" in value;\n}\nfunction isLazyComponent(element) {\n return element != null && typeof element === \"object\" && \"$$typeof\" in element && element.$$typeof === REACT_LAZY_TYPE && \"_payload\" in element && isPromiseLike(element._payload);\n}\n// @__NO_SIDE_EFFECTS__\nfunction createSlot(ownerName) {\n const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);\n const Slot2 = React.forwardRef((props, forwardedRef) => {\n let { children, ...slotProps } = props;\n if (isLazyComponent(children) && typeof use === \"function\") {\n children = use(children._payload);\n }\n const childrenArray = React.Children.toArray(children);\n const slottable = childrenArray.find(isSlottable);\n if (slottable) {\n const newElement = slottable.props.children;\n const newChildren = childrenArray.map((child) => {\n if (child === slottable) {\n if (React.Children.count(newElement) > 1) return React.Children.only(null);\n return React.isValidElement(newElement) ? newElement.props.children : null;\n } else {\n return child;\n }\n });\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });\n }\n return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });\n });\n Slot2.displayName = `${ownerName}.Slot`;\n return Slot2;\n}\nvar Slot = /* @__PURE__ */ createSlot(\"Slot\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlotClone(ownerName) {\n const SlotClone = React.forwardRef((props, forwardedRef) => {\n let { children, ...slotProps } = props;\n if (isLazyComponent(children) && typeof use === \"function\") {\n children = use(children._payload);\n }\n if (React.isValidElement(children)) {\n const childrenRef = getElementRef(children);\n const props2 = mergeProps(slotProps, children.props);\n if (children.type !== React.Fragment) {\n props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;\n }\n return React.cloneElement(children, props2);\n }\n return React.Children.count(children) > 1 ? React.Children.only(null) : null;\n });\n SlotClone.displayName = `${ownerName}.SlotClone`;\n return SlotClone;\n}\nvar SLOTTABLE_IDENTIFIER = Symbol(\"radix.slottable\");\n// @__NO_SIDE_EFFECTS__\nfunction createSlottable(ownerName) {\n const Slottable2 = ({ children }) => {\n return /* @__PURE__ */ jsx(Fragment2, { children });\n };\n Slottable2.displayName = `${ownerName}.Slottable`;\n Slottable2.__radixId = SLOTTABLE_IDENTIFIER;\n return Slottable2;\n}\nvar Slottable = /* @__PURE__ */ createSlottable(\"Slottable\");\nfunction isSlottable(child) {\n return React.isValidElement(child) && typeof child.type === \"function\" && \"__radixId\" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;\n}\nfunction mergeProps(slotProps, childProps) {\n const overrideProps = { ...childProps };\n for (const propName in childProps) {\n const slotPropValue = slotProps[propName];\n const childPropValue = childProps[propName];\n const isHandler = /^on[A-Z]/.test(propName);\n if (isHandler) {\n if (slotPropValue && childPropValue) {\n overrideProps[propName] = (...args) => {\n const result = childPropValue(...args);\n slotPropValue(...args);\n return result;\n };\n } else if (slotPropValue) {\n overrideProps[propName] = slotPropValue;\n }\n } else if (propName === \"style\") {\n overrideProps[propName] = { ...slotPropValue, ...childPropValue };\n } else if (propName === \"className\") {\n overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(\" \");\n }\n }\n return { ...slotProps, ...overrideProps };\n}\nfunction getElementRef(element) {\n let getter = Object.getOwnPropertyDescriptor(element.props, \"ref\")?.get;\n let mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.ref;\n }\n getter = Object.getOwnPropertyDescriptor(element, \"ref\")?.get;\n mayWarn = getter && \"isReactWarning\" in getter && getter.isReactWarning;\n if (mayWarn) {\n return element.props.ref;\n }\n return element.props.ref || element.ref;\n}\nexport {\n Slot as Root,\n Slot,\n Slottable,\n createSlot,\n createSlottable\n};\n//# sourceMappingURL=index.mjs.map\n","// src/primitive.tsx\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { createSlot } from \"@radix-ui/react-slot\";\nimport { jsx } from \"react/jsx-runtime\";\nvar NODES = [\n \"a\",\n \"button\",\n \"div\",\n \"form\",\n \"h2\",\n \"h3\",\n \"img\",\n \"input\",\n \"label\",\n \"li\",\n \"nav\",\n \"ol\",\n \"p\",\n \"select\",\n \"span\",\n \"svg\",\n \"ul\"\n];\nvar Primitive = NODES.reduce((primitive, node) => {\n const Slot = createSlot(`Primitive.${node}`);\n const Node = React.forwardRef((props, forwardedRef) => {\n const { asChild, ...primitiveProps } = props;\n const Comp = asChild ? Slot : node;\n if (typeof window !== \"undefined\") {\n window[Symbol.for(\"radix-ui\")] = true;\n }\n return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });\n });\n Node.displayName = `Primitive.${node}`;\n return { ...primitive, [node]: Node };\n}, {});\nfunction dispatchDiscreteCustomEvent(target, event) {\n if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));\n}\nvar Root = Primitive;\nexport {\n Primitive,\n Root,\n dispatchDiscreteCustomEvent\n};\n//# sourceMappingURL=index.mjs.map\n","function r(e){var t,f,n=\"\";if(\"string\"==typeof e||\"number\"==typeof e)n+=e;else if(\"object\"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=\" \"),n+=f);else for(t in e)e[t]&&(n&&(n+=\" \"),n+=t);return n}export function clsx(){for(var e,t,f=0,n=\"\";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=\" \"),n+=t);return n}export default clsx;","import { clsx } from \"clsx\";\nconst falsyToString = (value)=>typeof value === \"boolean\" ? \"\".concat(value) : value === 0 ? \"0\" : value;\nexport const cx = clsx;\nexport const cva = (base, config)=>{\n return (props)=>{\n var ref;\n if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);\n const { variants , defaultVariants } = config;\n const getVariantClassNames = Object.keys(variants).map((variant)=>{\n const variantProp = props === null || props === void 0 ? void 0 : props[variant];\n const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];\n if (variantProp === null) return null;\n const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);\n return variants[variant][variantKey];\n });\n const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param)=>{\n let [key, value] = param;\n if (value === undefined) {\n return acc;\n }\n acc[key] = value;\n return acc;\n }, {});\n const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (ref = config.compoundVariants) === null || ref === void 0 ? void 0 : ref.reduce((acc, param1)=>{\n let { class: cvClass , className: cvClassName , ...compoundVariantOptions } = param1;\n return Object.entries(compoundVariantOptions).every((param)=>{\n let [key, value] = param;\n return Array.isArray(value) ? value.includes({\n ...defaultVariants,\n ...propsWithoutUndefined\n }[key]) : ({\n ...defaultVariants,\n ...propsWithoutUndefined\n })[key] === value;\n }) ? [\n ...acc,\n cvClass,\n cvClassName\n ] : acc;\n }, []);\n return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);\n };\n};\n\n\n//# sourceMappingURL=index.mjs.map","import { cn } from \"@powerhousedao/design-system\";\n\ntype Props = {\n className?: string;\n size?: \"sm\" | \"md\" | \"lg\";\n margin?: \"sm\" | \"md\" | \"lg\";\n};\nexport function Divider({ className, size = \"sm\", margin = \"md\" }: Props) {\n function getSize() {\n if (size === \"sm\") return \"h-px\";\n if (size === \"md\") return \"h-1\";\n return \"h-1.5\";\n }\n\n function getMargin() {\n if (margin === \"sm\") return \"my-4\";\n if (margin === \"md\") return \"my-6\";\n return \"my-8\";\n }\n\n const sizeClass = getSize();\n const marginClass = getMargin();\n return (\n <div className={cn(\"bg-gray-200\", sizeClass, marginClass, className)} />\n );\n}\n","import{get as e,set as t}from\"react-hook-form\";const r=(t,r,o)=>{if(t&&\"reportValidity\"in t){const s=e(o,r);t.setCustomValidity(s&&s.message||\"\"),t.reportValidity()}},o=(e,t)=>{for(const o in t.fields){const s=t.fields[o];s&&s.ref&&\"reportValidity\"in s.ref?r(s.ref,o,e):s&&s.refs&&s.refs.forEach(t=>r(t,o,e))}},s=(r,s)=>{s.shouldUseNativeValidation&&o(r,s);const n={};for(const o in r){const f=e(s.fields,o),c=Object.assign(r[o]||{},{ref:f&&f.ref});if(i(s.names||Object.keys(r),o)){const r=Object.assign({},e(n,o));t(r,\"root\",c),t(n,o,r)}else t(n,o,c)}return n},i=(e,t)=>{const r=n(t);return e.some(e=>n(e).match(`^${r}\\\\.\\\\d+`))};function n(e){return e.replace(/\\]|\\[/g,\"\")}export{s as toNestErrors,o as validateFieldsNatively};\n//# sourceMappingURL=resolvers.mjs.map\n","import{validateFieldsNatively as r,toNestErrors as e}from\"@hookform/resolvers\";import{appendErrors as o}from\"react-hook-form\";import*as n from\"zod/v4/core\";function t(r,e){try{var o=r()}catch(r){return e(r)}return o&&o.then?o.then(void 0,e):o}function s(r,e){for(var n={};r.length;){var t=r[0],s=t.code,i=t.message,a=t.path.join(\".\");if(!n[a])if(\"unionErrors\"in t){var u=t.unionErrors[0].errors[0];n[a]={message:u.message,type:u.code}}else n[a]={message:i,type:s};if(\"unionErrors\"in t&&t.unionErrors.forEach(function(e){return e.errors.forEach(function(e){return r.push(e)})}),e){var c=n[a].types,f=c&&c[t.code];n[a]=o(a,e,n,s,f?[].concat(f,t.message):t.message)}r.shift()}return n}function i(r,e){for(var n={};r.length;){var t=r[0],s=t.code,i=t.message,a=t.path.join(\".\");if(!n[a])if(\"invalid_union\"===t.code&&t.errors.length>0){var u=t.errors[0][0];n[a]={message:u.message,type:u.code}}else n[a]={message:i,type:s};if(\"invalid_union\"===t.code&&t.errors.forEach(function(e){return e.forEach(function(e){return r.push(e)})}),e){var c=n[a].types,f=c&&c[t.code];n[a]=o(a,e,n,s,f?[].concat(f,t.message):t.message)}r.shift()}return n}function a(o,a,u){if(void 0===u&&(u={}),function(r){return\"_def\"in r&&\"object\"==typeof r._def&&\"typeName\"in r._def}(o))return function(n,i,c){try{return Promise.resolve(t(function(){return Promise.resolve(o[\"sync\"===u.mode?\"parse\":\"parseAsync\"](n,a)).then(function(e){return c.shouldUseNativeValidation&&r({},c),{errors:{},values:u.raw?Object.assign({},n):e}})},function(r){if(function(r){return Array.isArray(null==r?void 0:r.issues)}(r))return{values:{},errors:e(s(r.errors,!c.shouldUseNativeValidation&&\"all\"===c.criteriaMode),c)};throw r}))}catch(r){return Promise.reject(r)}};if(function(r){return\"_zod\"in r&&\"object\"==typeof r._zod}(o))return function(s,c,f){try{return Promise.resolve(t(function(){return Promise.resolve((\"sync\"===u.mode?n.parse:n.parseAsync)(o,s,a)).then(function(e){return f.shouldUseNativeValidation&&r({},f),{errors:{},values:u.raw?Object.assign({},s):e}})},function(r){if(function(r){return r instanceof n.$ZodError}(r))return{values:{},errors:e(i(r.issues,!f.shouldUseNativeValidation&&\"all\"===f.criteriaMode),f)};throw r}))}catch(r){return Promise.reject(r)}};throw new Error(\"Invalid input: not a Zod schema\")}export{a as zodResolver};\n//# sourceMappingURL=zod.module.js.map\n","import { z } from \"zod\";\nimport { snakeCase, constantCase } from \"change-case\";\n\nconst isUppercase = (value: string) => !/\\p{Ll}/u.test(value);\nconst isLowercase = (value: string) => !/\\p{Lu}/u.test(value);\n\nconst whitespaceRegex = /\\s+/g;\n\nexport function containsSpaces(s: string) {\n return whitespaceRegex.test(s);\n}\n\nexport function replaceSpaces(s: string) {\n return s.replace(whitespaceRegex, \"_\");\n}\n\ntype SchemaOptions = {\n required?: boolean;\n allowEmpty?: boolean;\n unique?: string[];\n};\n\nexport function createNameSchema(options: SchemaOptions = {}) {\n const { required = false, allowEmpty = false, unique = [] } = options;\n\n const baseSchema = allowEmpty ? z.string() : z.string().min(1);\n\n const uniqueRefinement = baseSchema.refine(\n (value) => {\n if (!value && allowEmpty) return true;\n return !unique\n .map((n) => n.toLowerCase())\n .includes(value.replace(/^\\s+|\\s+$/g, \"_\").toLowerCase());\n },\n { message: \"Item with this name already exists\" },\n );\n\n if (!required) {\n return unique.length > 0\n ? z\n .string()\n .optional()\n .refine(\n (value) => {\n if (value === undefined) return true;\n if (!value && allowEmpty) return true;\n return !unique\n .map((n) => n.toLowerCase())\n .includes(value.replace(/^\\s+|\\s+$/g, \"_\").toLowerCase());\n },\n { message: \"Item with this name already exists\" },\n )\n : z.string().optional();\n }\n\n return unique.length > 0 ? uniqueRefinement : baseSchema;\n}\n\nexport function createConstantCaseSchema(options: SchemaOptions = {}) {\n return createNameSchema(options)\n .transform((value) => (value ? value.toUpperCase() : value))\n .refine((value) => !value || isUppercase(value), {\n message: \"Must be uppercase\",\n });\n}\n\nexport function createLowercaseSnakeCaseSchema(options: SchemaOptions = {}) {\n return createNameSchema(options)\n .transform((value) => (value ? value.toLowerCase() : value))\n .refine((value) => !value || isLowercase(value), {\n message: \"Must be lowercase\",\n });\n}\n\nexport function toLowercaseSnakeCase(\n value: string,\n options: SchemaOptions = {},\n) {\n return createLowercaseSnakeCaseSchema(options).parse(\n snakeCase(value),\n ) as LowercaseSnakeCase;\n}\n\nexport function toConstantCase(value: string, options: SchemaOptions = {}) {\n return createConstantCaseSchema(options).parse(\n constantCase(value),\n ) as ConstantCase;\n}\n\nexport type SnakeCase = `${string}_${string}`;\nexport type LowercaseSnakeCase = Lowercase<SnakeCase>;\nexport type ConstantCase = Uppercase<SnakeCase>;\nexport type Prettify<T> = {\n [K in keyof T]: T[K];\n} & {};\n\nexport const AuthorSchema = z\n .object({\n name: createNameSchema({ allowEmpty: true }),\n website: z\n .union([z.url(), z.literal(\"\")])\n .optional()\n .default(\"\"),\n })\n .default({\n name: \"\",\n website: \"\",\n });\n","import React from \"react\";\nimport type { FieldValues, FieldPath } from \"react-hook-form\";\n\nexport type FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> = {\n name: TName;\n};\n\nexport const FormFieldContext = React.createContext<FormFieldContextValue>(\n {} as FormFieldContextValue,\n);\n\nexport type FormItemContextValue = {\n id: string;\n};\n\nexport const FormItemContext = React.createContext<FormItemContextValue>(\n {} as FormItemContextValue,\n);\n","import React from \"react\";\nimport { useFormContext } from \"react-hook-form\";\nimport { FormFieldContext, FormItemContext } from \"../context/form-context.js\";\n\nexport const useFormField = () => {\n const fieldContext = React.useContext(FormFieldContext);\n const itemContext = React.useContext(FormItemContext);\n const { getFieldState, formState } = useFormContext();\n\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error(\"useFormField should be used within <FormField>\");\n }\n\n const { id } = itemContext;\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n","\"use client\";\n\n// src/label.tsx\nimport * as React from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { jsx } from \"react/jsx-runtime\";\nvar NAME = \"Label\";\nvar Label = React.forwardRef((props, forwardedRef) => {\n return /* @__PURE__ */ jsx(\n Primitive.label,\n {\n ...props,\n ref: forwardedRef,\n onMouseDown: (event) => {\n const target = event.target;\n if (target.closest(\"button, input, select, textarea\")) return;\n props.onMouseDown?.(event);\n if (!event.defaultPrevented && event.detail > 1) event.preventDefault();\n }\n }\n );\n});\nLabel.displayName = NAME;\nvar Root = Label;\nexport {\n Label,\n Root\n};\n//# sourceMappingURL=index.mjs.map\n","import * as React from \"react\";\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\nimport type { VariantProps } from \"class-variance-authority\";\nimport { cva } from \"class-variance-authority\";\nimport { cn } from \"../utils/style.js\";\n\nconst labelVariants = cva(\n \"text-sm leading-none font-medium peer-disabled:cursor-not-allowed peer-disabled:opacity-70\",\n);\n\nconst Label = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &\n VariantProps<typeof labelVariants>\n>(({ className, ...props }, ref) => (\n <LabelPrimitive.Root\n ref={ref}\n className={cn(labelVariants(), className)}\n {...props}\n />\n));\nLabel.displayName = LabelPrimitive.Root.displayName;\n\nexport { Label };\n","import * as React from \"react\";\nimport type * as LabelPrimitive from \"@radix-ui/react-label\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport type { ControllerProps, FieldPath, FieldValues } from \"react-hook-form\";\nimport { Controller, FormProvider } from \"react-hook-form\";\nimport { FormFieldContext, FormItemContext } from \"../context/form-context.js\";\nimport { useFormField } from \"../hooks/useFormField.js\";\nimport { cn } from \"../utils/style.js\";\nimport { Label } from \"./label.js\";\n\nconst Form = FormProvider;\n\nconst FormField = <\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\nconst FormItem = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => {\n const id = React.useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn(\"\", className)} {...props} />\n </FormItemContext.Provider>\n );\n});\nFormItem.displayName = \"FormItem\";\n\nconst FormLabel = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>\n>(({ className, ...props }, ref) => {\n const { error, formItemId } = useFormField();\n\n return (\n <Label\n ref={ref}\n className={cn(error && \"text-red-900\", className)}\n htmlFor={formItemId}\n {...props}\n />\n );\n});\nFormLabel.displayName = \"FormLabel\";\n\nconst FormControl = React.forwardRef<\n React.ElementRef<typeof Slot>,\n React.ComponentPropsWithoutRef<typeof Slot>\n>(({ ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } =\n useFormField();\n\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={\n !error ? formDescriptionId : `${formDescriptionId} ${formMessageId}`\n }\n aria-invalid={!!error}\n {...props}\n />\n );\n});\nFormControl.displayName = \"FormControl\";\n\nconst FormDescription = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField();\n\n return (\n <p\n ref={ref}\n id={formDescriptionId}\n className={cn(\"text-sm text-gray-600\", className)}\n {...props}\n />\n );\n});\nFormDescription.displayName = \"FormDescription\";\n\nconst FormMessage = React.forwardRef<\n HTMLParagraphElement,\n React.HTMLAttributes<HTMLParagraphElement>\n>(({ className, children, ...props }, ref) => {\n const { error, formMessageId } = useFormField();\n const body = error ? String(error.message) : children;\n\n if (!body) {\n return null;\n }\n\n return (\n <p\n ref={ref}\n id={formMessageId}\n className={cn(\"text-sm font-medium text-red-800\", className)}\n {...props}\n >\n {body}\n </p>\n );\n});\nFormMessage.displayName = \"FormMessage\";\n\nexport {\n Form,\n FormItem,\n FormLabel,\n FormControl,\n FormDescription,\n FormMessage,\n FormField,\n};\n","import * as React from \"react\";\nimport { forwardRef, useImperativeHandle, useRef, useCallback } from \"react\";\nimport { cn } from \"../utils/style.js\";\n\nexport interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {}\n\nexport interface TextareaHandle {\n focus: () => void;\n element: HTMLTextAreaElement | null;\n}\n\nexport const Textarea = forwardRef<TextareaHandle, TextareaProps>(\n ({ className, ...props }, ref) => {\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n const adjustHeight = useCallback((textarea: HTMLTextAreaElement) => {\n textarea.style.height = \"auto\";\n const newHeight = Math.max(textarea.scrollHeight, textarea.offsetHeight);\n textarea.style.height = `${newHeight}px`;\n }, []);\n\n const handleInput = useCallback(\n (e: React.FormEvent<HTMLTextAreaElement>) => {\n adjustHeight(e.currentTarget);\n },\n [adjustHeight],\n );\n\n React.useEffect(() => {\n if (textareaRef.current) {\n adjustHeight(textareaRef.current);\n }\n }, [adjustHeight]);\n\n useImperativeHandle(ref, () => ({\n focus: () => textareaRef.current?.focus(),\n element: textareaRef.current,\n }));\n\n return (\n <textarea\n {...props}\n className={cn(\n \"min-h-10 w-full resize-none rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-sm text-gray-800 placeholder:text-gray-600 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50\",\n className,\n )}\n ref={textareaRef}\n onInput={handleInput}\n />\n );\n },\n);\nTextarea.displayName = \"Textarea\";\n","import { zodResolver } from \"@hookform/resolvers/zod\";\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useImperativeHandle,\n useRef,\n} from \"react\";\nimport type { FieldValues, Resolver } from \"react-hook-form\";\nimport { useForm } from \"react-hook-form\";\nimport { z } from \"zod\";\nimport { createNameSchema } from \"../schemas/inputs.js\";\nimport { compareStringsWithoutWhitespace } from \"../utils/helpers.js\";\nimport {\n Form,\n FormControl,\n FormField,\n FormItem,\n FormLabel,\n FormMessage,\n} from \"./form.js\";\nimport type { TextareaHandle } from \"./text-area.js\";\nimport { Textarea } from \"./text-area.js\";\n\ntype TextFieldProps = {\n name: string;\n value: string | null | undefined;\n onSubmit: (value: string) => void;\n label?: string;\n placeholder?: string;\n className?: string;\n rows?: number;\n focusOnMount?: boolean;\n required?: boolean;\n allowEmpty?: boolean;\n unique?: string[];\n shouldReset?: boolean;\n onChange?: (value: string) => void;\n};\n\ntype TextFieldHandle = {\n focus: () => void;\n};\n\nexport const TextField = forwardRef<TextFieldHandle, TextFieldProps>(\n (\n {\n name,\n value,\n onSubmit,\n label,\n placeholder,\n unique,\n className = \"\",\n rows = 1,\n focusOnMount = false,\n required = false,\n allowEmpty = false,\n shouldReset = false,\n onChange,\n },\n ref,\n ) => {\n const textareaRef = useRef<TextareaHandle | null>(null);\n const id = useId();\n useEffect(() => {\n if (focusOnMount && textareaRef.current) {\n textareaRef.current.focus();\n }\n }, [focusOnMount]);\n\n const fieldSchema = z.object({\n [name]: createNameSchema({ required, allowEmpty, unique }),\n });\n\n const form = useForm({\n resolver: zodResolver(\n fieldSchema as unknown as Parameters<typeof zodResolver>[0],\n ) as Resolver<FieldValues>,\n defaultValues: {\n [name]: value ?? \"\",\n },\n });\n\n const handleSubmit = useCallback(\n (values: FieldValues) => {\n const newValue = values[name] as string | undefined;\n if (newValue === undefined || value === newValue) return;\n onSubmit(newValue);\n if (shouldReset) form.reset({ [name]: \"\" });\n },\n [name, value, onSubmit, form, shouldReset],\n );\n\n const handleBlur = useCallback(async () => {\n const currentValue = (form.getValues()[name] as string | undefined) ?? \"\";\n\n if (value === null || value === undefined) {\n if (!currentValue || currentValue.trim() === \"\") return;\n }\n\n if (compareStringsWithoutWhitespace(currentValue, value ?? \"\")) return;\n\n try {\n await form.trigger(); // Trigger validation\n if (form.formState.isValid) {\n await form.handleSubmit(handleSubmit)();\n }\n } catch (e) {\n // Allow blur to proceed even if validation fails\n }\n }, [form, handleSubmit, name, value]);\n\n const onEnterKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === \"Enter\") {\n e.preventDefault();\n (e.target as HTMLTextAreaElement).blur();\n }\n },\n [],\n );\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n const newValue = e.target.value;\n onChange?.(newValue);\n },\n [onChange],\n );\n\n useImperativeHandle(ref, () => ({\n focus: () => textareaRef.current?.focus(),\n }));\n\n useEffect(() => {\n form.reset({ [name]: value ?? \"\" });\n }, [form, name, value]);\n\n return (\n <Form {...form}>\n <FormField\n control={form.control}\n name={name}\n render={({ field }) => (\n <FormItem className=\"grid h-full grid-rows-[auto,1fr] gap-2 overflow-visible\">\n {!!label && (\n <FormLabel\n htmlFor={name}\n className=\"text-sm font-medium text-gray-700\"\n >\n {label}\n </FormLabel>\n )}\n <FormControl>\n <Textarea\n {...field}\n id={id}\n name={name}\n ref={(node) => {\n if (node) {\n field.ref(node.element);\n textareaRef.current = node;\n }\n }}\n placeholder={placeholder}\n onBlur={handleBlur}\n onChange={(e) => {\n field.onChange(e);\n handleChange(e);\n }}\n onKeyDown={onEnterKeyDown}\n rows={rows}\n className={className}\n />\n </FormControl>\n <FormMessage />\n </FormItem>\n )}\n />\n </Form>\n );\n },\n);\n\nTextField.displayName = \"TextField\";\n","import { useCallback } from \"react\";\nimport { z } from \"zod\";\nimport type { Scope } from \"../types/documents.js\";\nimport {\n handleModelNameChange,\n makeInitialSchemaDoc,\n renameSchemaType,\n} from \"../utils/helpers.js\";\nimport { TextField } from \"./text-field.js\";\n\nexport const MetadataFormSchema = z.object({\n name: z.string(),\n documentType: z.string(),\n extension: z.string().optional().default(\"\"),\n description: z.string(),\n authorName: z.string(),\n authorWebsite: z.string(),\n});\n\nexport type MetadataFormValues = z.infer<typeof MetadataFormSchema>;\n\ntype Props = MetadataFormValues & {\n globalStateSchema: string;\n localStateSchema: string;\n setModelName: (name: string) => void;\n setModelId: (id: string) => void;\n setModelExtension: (extension: string) => void;\n setModelDescription: (description: string) => void;\n setAuthorName: (authorName: string) => void;\n setAuthorWebsite: (authorWebsite: string) => void;\n setStateSchema: (schema: string, scope: Scope) => void;\n};\n\nexport default function ModelMetadata(props: Props) {\n return (\n <div>\n <ModelNameForm {...props} />\n <div className=\"flex h-full flex-col gap-4\">\n <div className=\"grid flex-1 grid-cols-3 items-start gap-4\">\n <div className=\"col-span-2 flex h-full flex-col gap-4\">\n <div className=\"shrink-0\">\n <DocumentTypeForm {...props} />\n </div>\n <div className=\"min-h-0 flex-1\">\n <DescriptionForm {...props} />\n </div>\n </div>\n <div className=\"col-span-1 flex flex-col gap-4\">\n <AuthorNameForm {...props} />\n <AuthorWebsiteForm {...props} />\n <ModelExtensionForm {...props} />\n </div>\n </div>\n </div>\n </div>\n );\n}\n\nexport function ModelNameForm(props: Props) {\n const {\n name,\n globalStateSchema,\n localStateSchema,\n setModelName,\n setStateSchema,\n } = props;\n\n const onSubmit = useCallback(\n (newName: string) => {\n if (name === newName) {\n return;\n }\n setModelName(newName);\n\n const hasExistingSchema = !!globalStateSchema;\n\n if (!hasExistingSchema) {\n const initialSchemaDoc = makeInitialSchemaDoc(newName, \"global\");\n setStateSchema(initialSchemaDoc, \"global\");\n return;\n }\n const newSchema = renameSchemaType(\n globalStateSchema,\n name,\n newName,\n \"global\",\n );\n setStateSchema(newSchema, \"global\");\n\n if (localStateSchema) {\n const newLocalStateSchema = renameSchemaType(\n localStateSchema,\n name,\n newName,\n \"local\",\n );\n setStateSchema(newLocalStateSchema, \"local\");\n }\n handleModelNameChange({\n oldName: name,\n newName,\n globalStateSchema,\n localStateSchema,\n setStateSchema,\n });\n },\n [name, globalStateSchema, localStateSchema, setStateSchema],\n );\n\n return (\n <TextField\n name=\"name\"\n value={name}\n onSubmit={onSubmit}\n placeholder=\"Model name\"\n className=\"border-none pl-0 text-xl font-bold text-gray-900\"\n required\n focusOnMount\n />\n );\n}\n\nexport function DocumentTypeForm(props: Props) {\n const { documentType, setModelId } = props;\n\n return (\n <TextField\n label=\"Document Type *\"\n name=\"powerhouse/document-model\"\n value={documentType}\n onSubmit={setModelId}\n placeholder=\"Document Type\"\n required\n />\n );\n}\n\nexport function ModelExtensionForm(props: Props) {\n const { extension, setModelExtension } = props;\n\n return (\n <TextField\n name=\"extension\"\n value={extension}\n onSubmit={setModelExtension}\n label=\"Model Extension\"\n placeholder=\"Example .phdm\"\n allowEmpty\n />\n );\n}\n\nexport function DescriptionForm(props: Props) {\n const { description, setModelDescription } = props;\n\n return (\n <TextField\n name=\"description\"\n label=\"Model Description\"\n value={description}\n onSubmit={setModelDescription}\n placeholder=\"Describe your document to others\"\n allowEmpty\n className=\"h-full\"\n />\n );\n}\n\nexport function AuthorNameForm(props: Props) {\n const { authorName, setAuthorName } = props;\n\n return (\n <TextField\n name=\"authorName\"\n value={authorName}\n onSubmit={setAuthorName}\n label=\"Author Name\"\n placeholder=\"Username or organisation\"\n allowEmpty\n />\n );\n}\n\nexport function AuthorWebsiteForm(props: Props) {\n const { authorWebsite, setAuthorWebsite } = props;\n\n return (\n <TextField\n name=\"authorWebsite\"\n value={authorWebsite}\n label=\"Website URL\"\n onSubmit={(newAuthorWebsite) => {\n if (!!authorWebsite && !newAuthorWebsite) return;\n setAuthorWebsite(newAuthorWebsite);\n }}\n placeholder=\"https://www.powerhouse.inc/\"\n allowEmpty\n />\n );\n}\n","import type { ModuleSpecification } from \"@powerhousedao/shared/document-model\";\nimport { toLowercaseSnakeCase } from \"../schemas/inputs.js\";\nimport { TextField } from \"./text-field.js\";\n\ntype Props = {\n modules?: ModuleSpecification[];\n module?: ModuleSpecification;\n onAddModule: (name: string) => Promise<string | undefined>;\n updateModuleName: (id: string, name: string) => void;\n};\n\nexport function ModuleForm({\n module,\n onAddModule,\n updateModuleName,\n modules = [],\n}: Props) {\n const isEdit = !!module;\n const moduleNames = modules.map((m) => m.name);\n\n const handleSubmit = async (name: string) => {\n const formattedName = toLowercaseSnakeCase(name);\n if (!formattedName.length) return;\n\n if (isEdit) {\n if (formattedName !== module.name) {\n updateModuleName(module.id, formattedName);\n }\n } else {\n await onAddModule(formattedName);\n }\n };\n\n return (\n <TextField\n key={module?.id ?? \"new\"}\n name=\"name\"\n label={isEdit ? \"Module name *\" : \"Add module *\"}\n value={module?.name}\n onSubmit={handleSubmit}\n placeholder=\"Add module\"\n unique={moduleNames}\n shouldReset={!isEdit}\n required\n />\n );\n}\n","import type { ModuleSpecification } from \"@powerhousedao/shared/document-model\";\nimport { toConstantCase } from \"../schemas/inputs.js\";\nimport { TextField } from \"./text-field.js\";\n\ntype Props = {\n module: ModuleSpecification;\n operation?: ModuleSpecification[\"operations\"][number];\n focusOnMount?: boolean;\n allOperationNames: string[];\n onAddOperationAndInitialSchema: (\n moduleId: string,\n name: string,\n ) => Promise<string | undefined>;\n updateOperationName: (id: string, name: string) => void;\n deleteOperation: (id: string) => void;\n};\n\nexport function OperationForm({\n operation,\n module,\n focusOnMount,\n allOperationNames,\n onAddOperationAndInitialSchema,\n updateOperationName,\n deleteOperation,\n}: Props) {\n const isEdit = !!operation;\n\n const handleSubmit = async (name: string) => {\n if (isEdit && name === \"\") {\n deleteOperation(operation.id);\n return;\n }\n\n const formattedName = toConstantCase(name);\n\n if (isEdit) {\n if (formattedName !== operation.name) {\n updateOperationName(operation.id, formattedName);\n }\n } else {\n await onAddOperationAndInitialSchema(module.id, formattedName);\n }\n };\n\n const handleChange = (value: string) => {\n if (isEdit && value === \"\") {\n deleteOperation(operation.id);\n }\n };\n\n return (\n <TextField\n name=\"name\"\n value={operation?.name}\n label={isEdit ? \"Operation name *\" : \"Add operation *\"}\n onSubmit={handleSubmit}\n onChange={handleChange}\n placeholder=\"Add operation\"\n required={!isEdit}\n allowEmpty={!isEdit}\n shouldReset={!isEdit}\n focusOnMount={focusOnMount}\n unique={allOperationNames}\n />\n );\n}\n","import type { ModuleSpecification } from \"@powerhousedao/shared/document-model\";\nimport { useEffect, useRef } from \"react\";\nimport { TextField } from \"./text-field.js\";\n\ntype Props = {\n operation: ModuleSpecification[\"operations\"][number];\n focusOnMount?: boolean;\n setOperationDescription: (id: string, description: string) => void;\n};\n\nexport function OperationDescriptionForm({\n operation,\n focusOnMount,\n setOperationDescription,\n}: Props) {\n const textFieldRef = useRef<{ focus: () => void } | null>(null);\n\n useEffect(() => {\n if (focusOnMount && textFieldRef.current) {\n textFieldRef.current.focus();\n }\n }, [focusOnMount]);\n\n return (\n <TextField\n ref={textFieldRef}\n name=\"description\"\n value={operation.description}\n onSubmit={(newDescription) =>\n setOperationDescription(operation.id, newDescription)\n }\n label=\"Operation description\"\n allowEmpty\n placeholder=\"Operation Description\"\n />\n );\n}\n","import type {\n ModuleSpecification,\n OperationErrorSpecification,\n} from \"@powerhousedao/shared/document-model\";\nimport { pascalCase } from \"change-case\";\nimport { useRef } from \"react\";\nimport { TextField } from \"./text-field.js\";\n\ntype Props = {\n operation: ModuleSpecification[\"operations\"][number];\n error?: OperationErrorSpecification;\n focusOnMount?: boolean;\n onSubmit?: () => void;\n onAddOperationError: (\n operationId: string,\n errorName: string,\n ) => Promise<string | undefined>;\n deleteOperationError: (id: string) => void;\n setOperationErrorName: (\n operationId: string,\n errorId: string,\n name: string,\n ) => void;\n};\n\nexport function OperationErrorForm({\n operation,\n error,\n focusOnMount,\n onSubmit,\n onAddOperationError,\n deleteOperationError,\n setOperationErrorName,\n}: Props) {\n const textFieldRef = useRef<{ focus: () => void } | null>(null);\n const isEdit = !!error;\n const allOperationErrorNames = operation.errors\n .map((o) => o.name)\n .filter((n) => n !== null);\n\n const handleSubmit = (name: string) => {\n if (isEdit && name === \"\") {\n deleteOperationError(error.id);\n return;\n }\n\n const formattedName = pascalCase(name);\n\n if (isEdit) {\n setOperationErrorName(operation.id, error.id, formattedName);\n } else {\n onAddOperationError(operation.id, formattedName);\n }\n onSubmit?.();\n };\n\n const handleChange = (value: string) => {\n if (isEdit && value === \"\") {\n deleteOperationError(error.id);\n }\n };\n\n return (\n <TextField\n ref={textFieldRef}\n name=\"name\"\n value={error?.name}\n onSubmit={handleSubmit}\n onChange={handleChange}\n placeholder=\"Add exception\"\n required={!isEdit}\n allowEmpty={!isEdit}\n shouldReset={!isEdit}\n unique={allOperationErrorNames}\n focusOnMount={focusOnMount}\n />\n );\n}\n","import type { ModuleSpecification } from \"@powerhousedao/shared/document-model\";\nimport { useCallback, useId, useState } from \"react\";\nimport { OperationErrorForm } from \"./operation-error-form.js\";\n\ntype Props = {\n operation: ModuleSpecification[\"operations\"][number];\n addOperationError: (\n operationId: string,\n errorName: string,\n ) => Promise<string | undefined>;\n deleteOperationError: (id: string) => void;\n setOperationErrorName: (\n operationId: string,\n errorId: string,\n name: string,\n ) => void;\n};\n\nexport function OperationErrors({\n operation,\n addOperationError,\n deleteOperationError,\n setOperationErrorName,\n}: Props) {\n const addErrorFormId = useId();\n const [shouldFocusAddForm, setShouldFocusAddForm] = useState(false);\n\n const onAddOperationError = useCallback(\n async (operationId: string, error: string) => {\n const errorId = await addOperationError(operationId, error);\n if (errorId) {\n setShouldFocusAddForm(true);\n }\n return errorId;\n },\n [addOperationError, setShouldFocusAddForm],\n );\n\n const onAddOperationErrorSubmit = useCallback(\n () => setShouldFocusAddForm(false),\n [setShouldFocusAddForm],\n );\n\n return (\n <ul className=\"ml-4 list-disc\">\n {operation.errors.map((error) => (\n <li key={error.id}>\n <OperationErrorForm\n error={error}\n operation={operation}\n onAddOperationError={onAddOperationError}\n deleteOperationError={deleteOperationError}\n setOperationErrorName={setOperationErrorName}\n />\n </li>\n ))}\n <li>\n <OperationErrorForm\n operation={operation}\n onAddOperationError={onAddOperationError}\n deleteOperationError={deleteOperationError}\n setOperationErrorName={setOperationErrorName}\n key={`${addErrorFormId}-${shouldFocusAddForm}`}\n focusOnMount={shouldFocusAddForm}\n onSubmit={onAddOperationErrorSubmit}\n />\n </li>\n </ul>\n );\n}\n","import type { ModuleSpecification } from \"@powerhousedao/shared/document-model\";\nimport { lazy, Suspense, useCallback } from \"react\";\nimport type { DocumentActionHandlers } from \"../types/documents.js\";\nimport { isEmptyOperationSchema } from \"../utils/helpers.js\";\nimport { ensureValidOperationSchemaInputName } from \"../utils/linting.js\";\nimport { OperationDescriptionForm } from \"./operation-description-form.js\";\nimport { OperationErrors } from \"./operation-errors.js\";\nimport { OperationForm } from \"./operation-form.js\";\nconst GraphqlEditor = lazy(() => import(\"./code-editors/graphql-editor.js\"));\nexport type WrappedHandlers = DocumentActionHandlers & {\n addOperationAndInitialSchema: (\n moduleId: string,\n name: string,\n ) => Promise<string | undefined>;\n};\ntype Props = {\n lastCreatedOperationId: string | null;\n operation: ModuleSpecification[\"operations\"][number];\n module: ModuleSpecification;\n allOperationNames: string[];\n onAddOperationAndInitialSchema: (\n moduleId: string,\n name: string,\n ) => Promise<string | undefined>;\n updateOperationName: (id: string, name: string) => void;\n deleteOperation: (id: string) => void;\n updateOperationSchema: (id: string, newDoc: string) => void;\n setOperationDescription: (id: string, description: string) => void;\n addOperationError: (\n operationId: string,\n errorName: string,\n ) => Promise<string | undefined>;\n deleteOperationError: (id: string) => void;\n setOperationErrorName: (\n operationId: string,\n errorId: string,\n name: string,\n ) => void;\n toggleNoInputRequired: (id: string, noInputRequired: boolean) => void;\n};\nexport function Operation(props: Props) {\n const {\n operation,\n module,\n allOperationNames,\n lastCreatedOperationId,\n onAddOperationAndInitialSchema,\n updateOperationName,\n deleteOperation,\n updateOperationSchema,\n setOperationDescription,\n addOperationError,\n deleteOperationError,\n setOperationErrorName,\n toggleNoInputRequired,\n } = props;\n\n const noInputRequired = isEmptyOperationSchema(operation.schema);\n\n const handleToggleNoInput = useCallback(\n (checked: boolean) => toggleNoInputRequired(operation.id, checked),\n [operation.id, toggleNoInputRequired],\n );\n\n const handleUpdateDocument = useCallback(\n (newDoc: string) => updateOperationSchema(operation.id, newDoc),\n [operation.id, updateOperationSchema],\n );\n\n const customLinter = useCallback(\n (doc: string) =>\n operation.name\n ? ensureValidOperationSchemaInputName(doc, operation.name)\n : [],\n [operation.name],\n );\n\n return (\n <div\n className=\"mt-4 grid grid-cols-2 gap-x-12\"\n style={{\n gridTemplateAreas: `\n \"left editor\"\n \"errors editor\"\n `,\n gridTemplateRows: \"auto 1fr\",\n }}\n >\n <div className=\"flex flex-col gap-2\" style={{ gridArea: \"left\" }}>\n <OperationForm\n operation={operation}\n onAddOperationAndInitialSchema={onAddOperationAndInitialSchema}\n updateOperationName={updateOperationName}\n deleteOperation={deleteOperation}\n module={module}\n allOperationNames={allOperationNames}\n />\n <OperationDescriptionForm\n operation={operation}\n focusOnMount={operation.id === lastCreatedOperationId}\n setOperationDescription={setOperationDescription}\n />\n </div>\n\n <div className=\"relative top-8\" style={{ gridArea: \"editor\" }}>\n <label className=\"mb-2 flex cursor-pointer items-center gap-2\">\n <input\n type=\"checkbox\"\n checked={noInputRequired}\n onChange={(e) => handleToggleNoInput(e.target.checked)}\n className=\"size-4 rounded-sm border-gray-300\"\n />\n <span className=\"text-sm text-gray-700\">\n Operation with no inputs\n </span>\n </label>\n {!noInputRequired && (\n <Suspense>\n <GraphqlEditor\n doc={operation.schema ?? \"\"}\n updateDocumentInModel={handleUpdateDocument}\n customLinter={customLinter}\n />\n </Suspense>\n )}\n </div>\n\n <div style={{ gridArea: \"errors\" }}>\n <h3 className=\"my-2 text-sm font-medium text-gray-700\">\n Reducer Exceptions\n </h3>\n <OperationErrors\n operation={operation}\n addOperationError={addOperationError}\n deleteOperationError={deleteOperationError}\n setOperationErrorName={setOperationErrorName}\n />\n </div>\n </div>\n );\n}\n","import { OperationForm } from \"./operation-form.js\";\nimport type { ModuleSpecification } from \"@powerhousedao/shared/document-model\";\nimport { useCallback, useId, useState } from \"react\";\nimport { Operation } from \"./operation.js\";\n\ntype Props = {\n module: ModuleSpecification;\n allOperations: ModuleSpecification[\"operations\"];\n shouldFocusNewOperation: boolean;\n updateOperationName: (id: string, name: string) => void;\n deleteOperation: (id: string) => void;\n addOperationAndInitialSchema: (\n moduleId: string,\n name: string,\n ) => Promise<string | undefined>;\n updateOperationSchema: (id: string, newDoc: string) => void;\n setOperationDescription: (id: string, description: string) => void;\n addOperationError: (\n operationId: string,\n errorName: string,\n ) => Promise<string | undefined>;\n deleteOperationError: (id: string) => void;\n setOperationErrorName: (\n operationId: string,\n errorId: string,\n name: string,\n ) => void;\n toggleNoInputRequired: (id: string, noInputRequired: boolean) => void;\n};\nexport function Operations({\n module,\n allOperations,\n shouldFocusNewOperation,\n updateOperationName,\n deleteOperation,\n addOperationAndInitialSchema,\n addOperationError,\n deleteOperationError,\n setOperationErrorName,\n updateOperationSchema,\n setOperationDescription,\n toggleNoInputRequired,\n}: Props) {\n const [lastCreatedOperationId, setLastCreatedOperationId] = useState<\n string | null\n >(null);\n const addOperationFormId = useId();\n const allOperationNames = allOperations\n .map((o) => o.name)\n .filter((n) => n !== null);\n\n const onAddOperationAndInitialSchema = useCallback(\n async (moduleId: string, name: string) => {\n const operationId = await addOperationAndInitialSchema(moduleId, name);\n if (operationId) {\n setLastCreatedOperationId(operationId);\n }\n return operationId;\n },\n [addOperationAndInitialSchema, setLastCreatedOperationId],\n );\n\n return (\n <div>\n {module.operations.map((operation) => (\n <div key={operation.id}>\n <Operation\n operation={operation}\n module={module}\n lastCreatedOperationId={lastCreatedOperationId}\n allOperationNames={allOperationNames}\n addOperationError={addOperationError}\n deleteOperationError={deleteOperationError}\n setOperationErrorName={setOperationErrorName}\n onAddOperationAndInitialSchema={onAddOperationAndInitialSchema}\n updateOperationName={updateOperationName}\n deleteOperation={deleteOperation}\n updateOperationSchema={updateOperationSchema}\n setOperationDescription={setOperationDescription}\n toggleNoInputRequired={toggleNoInputRequired}\n />\n </div>\n ))}\n <div className=\"mt-6 w-1/2 pr-6\">\n <OperationForm\n key={addOperationFormId}\n onAddOperationAndInitialSchema={onAddOperationAndInitialSchema}\n updateOperationName={updateOperationName}\n deleteOperation={deleteOperation}\n module={module}\n allOperationNames={allOperationNames}\n focusOnMount={shouldFocusNewOperation}\n />\n </div>\n </div>\n );\n}\n","import type { ModuleSpecification as TModule } from \"@powerhousedao/shared/document-model\";\nimport { ModuleForm } from \"./module-form.js\";\nimport { Operations } from \"./operations.js\";\ntype Props = {\n module?: TModule;\n modules?: TModule[];\n allOperations: TModule[\"operations\"];\n lastCreatedModuleId: string | null;\n onAddModule: (name: string) => Promise<string | undefined>;\n updateModuleName: (id: string, name: string) => void;\n deleteModule: (id: string) => void;\n updateOperationName: (id: string, name: string) => void;\n deleteOperation: (id: string) => void;\n addOperationAndInitialSchema: (\n moduleId: string,\n name: string,\n ) => Promise<string | undefined>;\n updateOperationSchema: (id: string, newDoc: string) => void;\n setOperationDescription: (id: string, description: string) => void;\n addOperationError: (\n operationId: string,\n errorName: string,\n ) => Promise<string | undefined>;\n deleteOperationError: (id: string) => void;\n setOperationErrorName: (\n operationId: string,\n errorId: string,\n name: string,\n ) => void;\n toggleNoInputRequired: (id: string, noInputRequired: boolean) => void;\n};\nexport function Module(props: Props) {\n const {\n module,\n modules,\n allOperations,\n lastCreatedModuleId,\n onAddModule,\n updateModuleName,\n deleteModule,\n updateOperationName,\n deleteOperation,\n addOperationAndInitialSchema,\n updateOperationSchema,\n setOperationDescription,\n addOperationError,\n deleteOperationError,\n setOperationErrorName,\n toggleNoInputRequired,\n } = props;\n return (\n <div className=\"relative rounded-3xl bg-gray-100 p-6\">\n <div className=\"mb-2 w-1/2 pr-6\">\n <ModuleForm\n modules={modules}\n module={module}\n onAddModule={onAddModule}\n updateModuleName={updateModuleName}\n />\n {!!module && (\n <button\n aria-label=\"Delete module\"\n tabIndex={-1}\n className=\"absolute top-1 right-1 p-2 text-gray-800 transition-colors hover:text-gray-500\"\n onClick={() => {\n deleteModule(module.id);\n }}\n >\n <svg className=\"size-6\" viewBox=\"0 0 24 24\" fill=\"currentcolor\">\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M16.9993 8.51506L15.4844 7L11.9994 10.4852L8.51497 7.00057L7 8.51562L10.4844 12.0003L7.00056 15.4843L8.51552 16.9994L11.9994 13.5153L15.4838 17L16.9988 15.4849L13.5144 12.0003L16.9993 8.51506Z\"\n />\n </svg>\n </button>\n )}\n </div>\n {!!module && (\n <Operations\n module={module}\n allOperations={allOperations}\n shouldFocusNewOperation={module.id === lastCreatedModuleId}\n updateOperationName={updateOperationName}\n deleteOperation={deleteOperation}\n addOperationAndInitialSchema={addOperationAndInitialSchema}\n updateOperationSchema={updateOperationSchema}\n setOperationDescription={setOperationDescription}\n addOperationError={addOperationError}\n deleteOperationError={deleteOperationError}\n setOperationErrorName={setOperationErrorName}\n toggleNoInputRequired={toggleNoInputRequired}\n />\n )}\n </div>\n );\n}\n","import type { ModuleSpecification as TModule } from \"@powerhousedao/shared/document-model\";\nimport { useCallback, useRef, useState } from \"react\";\nimport { Module } from \"./module.js\";\n\ntype Props = {\n modules: TModule[];\n allOperations: TModule[\"operations\"];\n addModule: (name: string) => Promise<string | undefined>;\n updateModuleName: (id: string, name: string) => void;\n deleteModule: (id: string) => void;\n updateOperationName: (id: string, name: string) => void;\n deleteOperation: (id: string) => void;\n addOperationAndInitialSchema: (\n moduleId: string,\n name: string,\n ) => Promise<string | undefined>;\n updateOperationSchema: (id: string, newDoc: string) => void;\n setOperationDescription: (id: string, description: string) => void;\n addOperationError: (\n operationId: string,\n errorName: string,\n ) => Promise<string | undefined>;\n deleteOperationError: (id: string) => void;\n setOperationErrorName: (\n operationId: string,\n errorId: string,\n name: string,\n ) => void;\n toggleNoInputRequired: (id: string, noInputRequired: boolean) => void;\n};\nexport default function Modules({\n modules,\n allOperations,\n addModule,\n updateModuleName,\n deleteModule,\n updateOperationName,\n deleteOperation,\n addOperationAndInitialSchema,\n updateOperationSchema,\n setOperationDescription,\n addOperationError,\n deleteOperationError,\n setOperationErrorName,\n toggleNoInputRequired,\n}: Props) {\n const [lastCreatedModuleId, setLastCreatedModuleId] = useState<string | null>(\n null,\n );\n const focusTrapRef = useRef<HTMLDivElement>(null);\n\n const onAddModule = useCallback(\n async (name: string) => {\n const moduleId = await addModule(name);\n if (moduleId) {\n setLastCreatedModuleId(moduleId);\n focusTrapRef.current?.focus();\n }\n return moduleId;\n },\n [addModule, setLastCreatedModuleId],\n );\n\n return (\n <div className=\"flex flex-col gap-2\">\n {modules.map((module) => (\n <Module\n key={module.id}\n module={module}\n modules={modules}\n allOperations={allOperations}\n lastCreatedModuleId={lastCreatedModuleId}\n onAddModule={onAddModule}\n updateModuleName={updateModuleName}\n deleteModule={deleteModule}\n updateOperationName={updateOperationName}\n deleteOperation={deleteOperation}\n addOperationAndInitialSchema={addOperationAndInitialSchema}\n updateOperationSchema={updateOperationSchema}\n setOperationDescription={setOperationDescription}\n addOperationError={addOperationError}\n deleteOperationError={deleteOperationError}\n setOperationErrorName={setOperationErrorName}\n toggleNoInputRequired={toggleNoInputRequired}\n />\n ))}\n <Module\n key=\"add-module\"\n modules={modules}\n allOperations={allOperations}\n lastCreatedModuleId={lastCreatedModuleId}\n onAddModule={onAddModule}\n updateModuleName={updateModuleName}\n deleteModule={deleteModule}\n updateOperationName={updateOperationName}\n deleteOperation={deleteOperation}\n addOperationAndInitialSchema={addOperationAndInitialSchema}\n updateOperationSchema={updateOperationSchema}\n setOperationDescription={setOperationDescription}\n addOperationError={addOperationError}\n deleteOperationError={deleteOperationError}\n setOperationErrorName={setOperationErrorName}\n toggleNoInputRequired={toggleNoInputRequired}\n />\n {/* Focus trap to prevent tabbing out of the editor */}\n <div\n ref={focusTrapRef}\n tabIndex={0}\n className=\"size-0 overflow-hidden\"\n aria-hidden=\"true\"\n />\n </div>\n );\n}\n","import type { PHDocumentEditorConfig } from \"@powerhousedao/reactor-browser\";\n\nexport const editorConfig: PHDocumentEditorConfig = {\n isExternalControlsEnabled: false,\n};\n","import {\n useDocumentOfType,\n useSelectedDocumentOfType,\n} from \"@powerhousedao/reactor-browser\";\nimport type {\n DocumentModelAction,\n DocumentModelDocument,\n} from \"@powerhousedao/shared/document-model\";\n\nexport function useDocumentModelDocument(\n documentId: string | undefined | null,\n): ReturnType<\n typeof useDocumentOfType<DocumentModelDocument, DocumentModelAction>\n> {\n return useDocumentOfType<DocumentModelDocument, DocumentModelAction>(\n documentId,\n \"powerhouse/document-model\",\n );\n}\n\nexport function useSelectedDocumentModelDocument(): ReturnType<\n typeof useSelectedDocumentOfType<DocumentModelDocument, DocumentModelAction>\n> {\n return useSelectedDocumentOfType<DocumentModelDocument, DocumentModelAction>(\n \"powerhouse/document-model\",\n );\n}\n","import { DocumentToolbar } from \"@powerhousedao/design-system/connect\";\nimport {\n usePHToast,\n useSetPHDocumentEditorConfig,\n} from \"@powerhousedao/reactor-browser\";\nimport { pascalCase } from \"change-case\";\nimport { generateId } from \"@powerhousedao/shared/document-model\";\nimport {\n addModule,\n addOperation,\n addOperationError,\n deleteModule,\n deleteOperation,\n deleteOperationError,\n setAuthorName,\n setAuthorWebsite,\n setInitialState,\n setModelDescription,\n setModelExtension,\n setModelId,\n setModelName,\n setModuleName,\n setOperationDescription,\n setOperationErrorName,\n setOperationName,\n setOperationSchema,\n setStateSchema,\n} from \"@powerhousedao/shared/document-model\";\nimport { lazy, Suspense, useEffect, useRef, useState } from \"react\";\nimport { Divider } from \"./components/divider.js\";\nimport ModelMetadata from \"./components/model-metadata-form.js\";\nimport Modules from \"./components/modules.js\";\nimport { editorConfig } from \"./config.js\";\nimport { SchemaContextProvider } from \"./context/schema-context.js\";\nimport { useSelectedDocumentModelDocument } from \"./hooks/useDocumentModelDocument.js\";\nimport type { Scope } from \"./types/documents.js\";\nimport {\n compareStringsWithoutWhitespace,\n initializeModelSchema,\n makeEmptyOperationSchema,\n makeOperationInitialDoc,\n} from \"./utils/helpers.js\";\nconst StateSchemas = lazy(() => import(\"./components/state-schemas.js\"));\n\nexport default function Editor() {\n useSetPHDocumentEditorConfig(editorConfig);\n const toast = usePHToast();\n const [document, dispatch] = useSelectedDocumentModelDocument();\n const [scope, setScope] = useState<Scope>(\"global\");\n const documentNodeName = document.header.name;\n const {\n name: modelName,\n id: documentType,\n extension,\n description,\n author: { name: authorName, website: authorWebsite },\n } = document.state.global;\n const {\n state: {\n global: {\n schema: globalStateSchema,\n initialValue: globalStateInitialValue,\n },\n local: { schema: localStateSchema, initialValue: localStateInitialValue },\n },\n modules,\n } = document.state.global.specifications[0];\n const operations = modules.flatMap((module) => module.operations);\n const shouldSetInitialName = useRef(\n !modelName && !!documentNodeName && operations.length === 0,\n );\n\n useEffect(() => {\n if (!shouldSetInitialName.current || !documentNodeName) return;\n\n const initialSchemaDoc = initializeModelSchema(documentNodeName);\n const actions = [\n setModelName({ name: documentNodeName }),\n setStateSchema({ schema: initialSchemaDoc, scope: \"global\" }),\n ];\n dispatch(actions);\n shouldSetInitialName.current = false;\n }, [documentNodeName, dispatch]);\n\n const operationSchemasSdl = operations\n .flatMap((operation) => operation.schema ?? [])\n .join(\"\\n\");\n\n const handleSetModelId = (id: string) => {\n if (compareStringsWithoutWhitespace(id, documentType)) return;\n dispatch([setModelId({ id })]);\n };\n\n const handleSetModelDescription = (newDescription: string) => {\n if (compareStringsWithoutWhitespace(newDescription, description)) return;\n dispatch(setModelDescription({ description: newDescription }));\n };\n\n const handleSetModelExtension = (newExtension: string) => {\n if (compareStringsWithoutWhitespace(newExtension, extension)) return;\n dispatch(setModelExtension({ extension: newExtension }));\n };\n\n const handleSetModelName = (newName: string) => {\n if (compareStringsWithoutWhitespace(newName, modelName)) return;\n dispatch(setModelName({ name: newName }));\n };\n\n const handleSetAuthorName = (newAuthorName: string) => {\n if (compareStringsWithoutWhitespace(newAuthorName, authorName)) return;\n dispatch(setAuthorName({ authorName: newAuthorName }));\n };\n\n const handleSetAuthorWebsite = (newAuthorWebsite: string) => {\n if (compareStringsWithoutWhitespace(newAuthorWebsite, authorWebsite ?? \"\"))\n return;\n dispatch(setAuthorWebsite({ authorWebsite: newAuthorWebsite }));\n };\n\n const handleSetStateSchema = (newSchema: string, scope: Scope) => {\n const oldSchema = scope === \"global\" ? globalStateSchema : localStateSchema;\n if (compareStringsWithoutWhitespace(newSchema, oldSchema)) return;\n dispatch(setStateSchema({ schema: newSchema, scope }));\n };\n\n const handleSetInitialState = (newInitialValue: string, scope: Scope) => {\n const oldInitialValue =\n scope === \"global\" ? globalStateInitialValue : localStateInitialValue;\n if (compareStringsWithoutWhitespace(newInitialValue, oldInitialValue))\n return;\n dispatch(setInitialState({ initialValue: newInitialValue, scope }));\n };\n\n const handleAddModule = (name: string): Promise<string | undefined> => {\n return new Promise((resolve) => {\n try {\n if (\n modules.some((module) =>\n compareStringsWithoutWhitespace(module.name, name),\n )\n ) {\n resolve(undefined);\n return;\n }\n const id = generateId();\n dispatch(addModule({ id, name }));\n resolve(id);\n } catch (error) {\n console.error(\"Failed to add module:\", error);\n resolve(undefined);\n }\n });\n };\n\n const handleSetModuleName = (id: string, name: string) => {\n if (\n modules.some((module) =>\n compareStringsWithoutWhitespace(module.name, name),\n )\n )\n return;\n dispatch(setModuleName({ id, name }));\n };\n\n const handleDeleteModule = (id: string) => {\n dispatch(deleteModule({ id }));\n };\n\n const handleAddOperation = (\n moduleId: string,\n name: string,\n ): Promise<string | undefined> => {\n return new Promise((resolve) => {\n const id = generateId();\n dispatch(\n addOperation({ id, moduleId, name, scope }),\n (errors) => {\n if (errors.length > 0) {\n if (toast) {\n toast(errors[0].message, { type: \"connect-warning\" });\n }\n resolve(undefined);\n } else {\n resolve(id);\n }\n },\n () => resolve(id),\n );\n });\n };\n\n const handleSetOperationName = (id: string, name: string) => {\n dispatch(setOperationName({ id, name }), (errors) => {\n if (errors.length > 0 && toast) {\n toast(errors[0].message, { type: \"connect-warning\" });\n }\n });\n };\n\n const handleSetOperationSchema = (id: string, newSchema: string) => {\n const operation = operations.find((operation) => operation.id === id);\n if (\n operation?.schema &&\n compareStringsWithoutWhitespace(newSchema, operation.schema)\n )\n return;\n dispatch(setOperationSchema({ id, schema: newSchema }));\n };\n\n const handleToggleNoInputRequired = (\n id: string,\n noInputRequired: boolean,\n ) => {\n const operation = operations.find((op) => op.id === id);\n if (!operation?.name) return;\n\n if (noInputRequired) {\n dispatch(\n setOperationSchema({\n id,\n schema: makeEmptyOperationSchema(operation.name),\n }),\n );\n } else {\n dispatch(\n setOperationSchema({\n id,\n schema: makeOperationInitialDoc(operation.name),\n }),\n );\n }\n };\n\n const handleSetOperationDescription = (\n id: string,\n newDescription: string,\n ) => {\n const operationDescription =\n operations.find((operation) => operation.id === id)?.description ?? \"\";\n if (compareStringsWithoutWhitespace(operationDescription, newDescription))\n return;\n dispatch(setOperationDescription({ id, description: newDescription }));\n };\n\n const handleDeleteOperation = (id: string) => {\n dispatch(deleteOperation({ id }));\n };\n\n const handleAddOperationError = (\n operationId: string,\n errorName: string,\n ): Promise<string | undefined> => {\n return new Promise((resolve) => {\n try {\n const operation = operations.find(\n (operation) => operation.id === operationId,\n );\n const operationErrorNames =\n operation?.errors.map((error) => error.name).filter(Boolean) ?? [];\n if (\n operationErrorNames.some((name) =>\n compareStringsWithoutWhitespace(name, errorName),\n )\n ) {\n resolve(undefined);\n return;\n }\n const id = generateId();\n const errorCode = pascalCase(errorName);\n dispatch(addOperationError({ id, operationId, errorName, errorCode }));\n resolve(id);\n } catch (error) {\n console.error(\"Failed to add operation error:\", error);\n resolve(undefined);\n }\n });\n };\n\n const handleDeleteOperationError = (id: string) => {\n dispatch(deleteOperationError({ id }));\n };\n\n const handleSetOperationErrorName = (\n operationId: string,\n errorId: string,\n errorName: string,\n ) => {\n const operation = operations.find(\n (operation) => operation.id === operationId,\n );\n const operationErrorNames =\n operation?.errors.map((error) => error.name).filter(Boolean) ?? [];\n if (\n operationErrorNames.some((name) =>\n compareStringsWithoutWhitespace(name, errorName),\n )\n )\n return;\n dispatch(setOperationErrorName({ id: errorId, errorName }));\n };\n\n const addOperationAndInitialSchema = async (\n moduleId: string,\n name: string,\n ): Promise<string | undefined> => {\n try {\n const id = await handleAddOperation(moduleId, name);\n if (!id) return undefined;\n try {\n handleSetOperationSchema(id, makeOperationInitialDoc(name));\n return id;\n } catch (error) {\n console.error(\"Failed to update operation schema:\", error);\n return undefined;\n }\n } catch (error) {\n console.error(\"Failed to add operation and schema:\", error);\n return undefined;\n }\n };\n\n return (\n <main className=\"min-h-dvh bg-gray-50 p-6\">\n <DocumentToolbar />\n <SchemaContextProvider\n globalStateSchemaSdl={globalStateSchema}\n localStateSchemaSdl={localStateSchema}\n operationSchemasSdl={operationSchemasSdl}\n >\n <div className=\"mx-auto max-w-6xl px-4 pt-8\">\n <ModelMetadata\n name={modelName}\n documentType={documentType}\n extension={extension}\n description={description}\n authorName={authorName}\n authorWebsite={authorWebsite ?? \"\"}\n globalStateSchema={globalStateSchema}\n localStateSchema={localStateSchema}\n setModelId={handleSetModelId}\n setModelDescription={handleSetModelDescription}\n setModelExtension={handleSetModelExtension}\n setModelName={handleSetModelName}\n setAuthorName={handleSetAuthorName}\n setAuthorWebsite={handleSetAuthorWebsite}\n setStateSchema={handleSetStateSchema}\n />\n <Divider />\n <div>\n <Suspense>\n <StateSchemas\n modelName={modelName}\n globalStateSchema={globalStateSchema}\n globalStateInitialValue={globalStateInitialValue}\n localStateSchema={localStateSchema}\n localStateInitialValue={localStateInitialValue}\n setStateSchema={handleSetStateSchema}\n setInitialState={handleSetInitialState}\n currentScope={scope}\n onScopeChange={setScope}\n />\n </Suspense>\n <Divider />\n <h3 className=\"mb-6 text-lg capitalize\">{scope} Operations</h3>\n <Modules\n modules={modules.map((module) => ({\n ...module,\n operations: module.operations.filter(\n (op) => op.scope === scope,\n ),\n }))}\n allOperations={operations}\n addModule={handleAddModule}\n updateModuleName={handleSetModuleName}\n deleteModule={handleDeleteModule}\n updateOperationName={handleSetOperationName}\n updateOperationSchema={handleSetOperationSchema}\n setOperationDescription={handleSetOperationDescription}\n deleteOperation={handleDeleteOperation}\n addOperationError={handleAddOperationError}\n deleteOperationError={handleDeleteOperationError}\n setOperationErrorName={handleSetOperationErrorName}\n addOperationAndInitialSchema={addOperationAndInitialSchema}\n toggleNoInputRequired={handleToggleNoInputRequired}\n />\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AgB;MAChB,CAAA;KACF,oBAAC,SAAD,EAAW,CAAA;KACX,qBAAC,OAAD,EAAA,UAAA;MACE,oBAAC,UAAD,EAAA,UACE,oBAAC,cAAD;OACa;OACQ;OACM;OACP;OACM;OACxB,gBAAgB;OAChB,iBAAiB;OACjB,cAAc;OACd,eAAe;OACf,CAAA,EACO,CAAA;MACX,oBAAC,SAAD,EAAW,CAAA;MACX,qBAAC,MAAD;OAAI,WAAU;iBAAd,CAAyC,OAAM,cAAgB;;MAC/D,oBAAC,SAAD;OACE,SAAS,QAAQ,KAAK,YAAY;QAChC,GAAG;QACH,YAAY,OAAO,WAAW,QAC3B,OAAO,GAAG,UAAU,MACtB;QACF,EAAE;OACH,eAAe;OACf,WAAW;OACX,kBAAkB;OAClB,cAAc;OACd,qBAAqB;OACrB,uBAAuB;OACvB,yBAAyB;OACzB,iBAAiB;OACjB,mBAAmB;OACnB,sBAAsB;OACtB,uBAAuB;OACO;OAC9B,uBAAuB;OACvB,CAAA;MACE,EAAA,CAAA;KACF;;GACgB,CAAA,CACnB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"folder-view-H2ov-zId.js","names":[],"sources":["../../editors/generic-drive-explorer/components/create-document.tsx","../../editors/generic-drive-explorer/components/file-content-view.tsx","../../editors/generic-drive-explorer/components/layout.tsx","../../editors/generic-drive-explorer/components/folder-view.tsx"],"sourcesContent":["import { PowerhouseButton } from \"@powerhousedao/design-system\";\nimport {\n showCreateDocumentModal,\n useDocumentModelModules,\n useUserPermissions,\n} from \"@powerhousedao/reactor-browser\";\nimport type {\n DocumentModelGlobalState,\n DocumentModelModule,\n} from \"@powerhousedao/shared/document-model\";\n\nfunction getDocumentSpec(doc: DocumentModelModule): DocumentModelGlobalState {\n return doc.documentModel.global;\n}\n\nexport function CreateDocument() {\n const { isAllowedToCreateDocuments } = useUserPermissions();\n const documentModelModules = useDocumentModelModules();\n const nonDriveDocumentModelModules = documentModelModules?.filter(\n (module) => module.documentModel.global.id !== \"powerhouse/document-drive\",\n );\n if (!isAllowedToCreateDocuments) return null;\n return (\n <div className=\"px-6 py-4\">\n <h3 className=\"mb-3 text-xl font-bold text-gray-600\">New document</h3>\n <div className=\"flex w-full flex-wrap gap-4\">\n {nonDriveDocumentModelModules?.map((doc) => {\n const spec = getDocumentSpec(doc);\n const versionLabel = doc.version ? ` v${doc.version}` : \"\";\n return (\n <PowerhouseButton\n key={`${spec.id}-v${doc.version ?? 1}`}\n color=\"light\"\n title={`${spec.name}${versionLabel}`}\n aria-description={spec.description}\n onClick={() => showCreateDocumentModal(spec.id)}\n >\n <span className=\"text-sm\">\n {spec.name}\n {versionLabel}\n </span>\n </PowerhouseButton>\n );\n })}\n </div>\n </div>\n );\n}\n","import { useWindowSize } from \"@powerhousedao/design-system\";\nimport { FileItem } from \"@powerhousedao/design-system/connect\";\nimport {\n isFileNodeKind,\n useNodesInSelectedDriveOrFolder,\n} from \"@powerhousedao/reactor-browser\";\nimport { useVirtualizer } from \"@tanstack/react-virtual\";\nimport type { FileNode } from \"@powerhousedao/shared/document-drive\";\nimport React, { useRef } from \"react\";\n\nconst GAP = 8;\nconst ITEM_WIDTH = 256;\nconst ITEM_HEIGHT = 48;\n\nconst USED_SPACE = 420;\n\nexport function FileContentView() {\n const parentRef = useRef(null);\n const windowSize = useWindowSize();\n const availableWidth = windowSize.innerWidth - USED_SPACE;\n const nodes = useNodesInSelectedDriveOrFolder();\n const fileNodes = nodes.filter((n) => isFileNodeKind(n));\n const columnCount = Math.floor(availableWidth / (ITEM_WIDTH + GAP)) || 1;\n const rowCount = Math.ceil(fileNodes.length / columnCount);\n\n const rowVirtualizer = useVirtualizer({\n count: rowCount,\n getScrollElement: () => parentRef.current,\n estimateSize: (index) => {\n if (index > 0) {\n return ITEM_HEIGHT + GAP;\n }\n return ITEM_HEIGHT;\n },\n overscan: 5,\n });\n\n const columnVirtualizer = useVirtualizer({\n horizontal: true,\n count: columnCount,\n getScrollElement: () => parentRef.current,\n estimateSize: (index) => {\n if (index > 0) {\n return ITEM_WIDTH + GAP;\n }\n return ITEM_WIDTH;\n },\n overscan: 5,\n });\n\n const getItemIndex = (rowIndex: number, columnIndex: number) =>\n rowIndex * columnCount + columnIndex;\n\n const getItem = (rowIndex: number, columnIndex: number): FileNode | null => {\n const index = getItemIndex(rowIndex, columnIndex);\n return fileNodes[index] || null;\n };\n\n if (fileNodes.length === 0) {\n return (\n <div className=\"mb-8 text-sm text-gray-400\">No documents or files 📄</div>\n );\n }\n\n const renderItem = (rowIndex: number, columnIndex: number) => {\n const fileNode = getItem(rowIndex, columnIndex);\n\n if (!fileNode) {\n return null;\n }\n\n return (\n <div\n style={{\n marginLeft: columnIndex === 0 ? 0 : GAP,\n }}\n >\n <FileItem key={fileNode.id} fileNode={fileNode} />\n </div>\n );\n };\n\n return (\n <div\n ref={parentRef}\n style={{\n width: `100%`,\n overflow: \"auto\",\n }}\n >\n <div\n style={{\n height: `${rowVirtualizer.getTotalSize()}px`,\n width: `${columnVirtualizer.getTotalSize()}px`,\n position: \"relative\",\n }}\n >\n {rowVirtualizer.getVirtualItems().map((virtualRow) => (\n <React.Fragment key={virtualRow.key}>\n {columnVirtualizer.getVirtualItems().map((virtualColumn) => (\n <div\n key={virtualColumn.key}\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n marginTop: virtualRow.index === 0 ? 0 : GAP,\n width: `${virtualColumn.size}px`,\n height: `${ITEM_HEIGHT}px`,\n overflow: \"hidden\",\n transform: `translateX(${virtualColumn.start}px) translateY(${virtualRow.start}px)`,\n }}\n >\n {renderItem(virtualRow.index, virtualColumn.index)}\n </div>\n ))}\n </React.Fragment>\n ))}\n </div>\n </div>\n );\n}\n","import { cn } from \"@powerhousedao/design-system\";\nimport type { BaseProps } from \"../utils/types.js\";\n\nexport function DriveLayout({ children, className, ...props }: BaseProps) {\n return (\n <DriveLayout.Container className={className} {...props}>\n {children}\n </DriveLayout.Container>\n );\n}\n\nDriveLayout.Container = function DriveLayoutContainer({\n children,\n className,\n containerProps,\n ...props\n}: BaseProps) {\n return (\n <div\n className={cn(\"flex grow flex-col overflow-auto\", className)}\n {...containerProps}\n {...props}\n >\n {children}\n </div>\n );\n};\n\nDriveLayout.Header = function DriveLayoutHeader({\n children,\n className,\n containerProps,\n ...props\n}: BaseProps) {\n return (\n <div className={cn(\"flex-0\", className)} {...containerProps} {...props}>\n {children}\n </div>\n );\n};\n\nDriveLayout.Content = function DriveLayoutContent({\n children,\n className,\n containerProps,\n ...props\n}: BaseProps) {\n return (\n <div\n className={cn(\"mb-5 flex-1 px-4\", className)}\n {...containerProps}\n {...props}\n >\n {children}\n </div>\n );\n};\n\nDriveLayout.ContentSection = function DriveLayoutContentSection({\n title,\n children,\n className,\n containerProps,\n ...props\n}: BaseProps & { title?: string }) {\n return (\n <div className={cn(className)} {...containerProps} {...props}>\n {title && (\n <div className=\"mb-4 text-base font-semibold text-gray-600\">\n {title}\n </div>\n )}\n <div className=\"flex flex-wrap gap-2\">{children}</div>\n </div>\n );\n};\n\nDriveLayout.Footer = function DriveLayoutFooter({\n children,\n className,\n containerProps,\n ...props\n}: BaseProps) {\n return (\n <div className={cn(\"flex-0\", className)} {...containerProps} {...props}>\n {children}\n </div>\n );\n};\n","import { FolderItem } from \"@powerhousedao/design-system/connect\";\nimport {\n isFolderNodeKind,\n useNodesInSelectedDriveOrFolder,\n} from \"@powerhousedao/reactor-browser\";\nimport { twMerge } from \"tailwind-merge\";\nimport { FileContentView } from \"./file-content-view.js\";\nimport { DriveLayout } from \"./layout.js\";\n\nexport function FolderView(props: { className?: string }) {\n const { className } = props;\n const nodes = useNodesInSelectedDriveOrFolder();\n const folderNodes = nodes.filter((n) => isFolderNodeKind(n));\n return (\n <div\n className={twMerge(\n \"rounded-md border-2 border-transparent p-2\",\n className,\n )}\n >\n <DriveLayout.ContentSection title=\"Folders\" className=\"mb-4\">\n {folderNodes.length > 0 ? (\n folderNodes.map((folderNode) => (\n <FolderItem key={folderNode.id} folderNode={folderNode} />\n ))\n ) : (\n <div className=\"mb-8 text-sm text-gray-400\">\n No documents or files 📄\n </div>\n )}\n </DriveLayout.ContentSection>\n <DriveLayout.ContentSection title=\"Documents and files\">\n <div className=\"w-full\">\n <FileContentView />\n </div>\n </DriveLayout.ContentSection>\n </div>\n );\n}\n\nexport default FolderView;\n"],"mappings":";;;;;AAWA,SAAS,gBAAgB,KAAoD;AAC3E,QAAO,IAAI,cAAc;;AAG3B,SAAgB,iBAAiB;CAC/B,MAAM,EAAE,+BAA+B,oBAAoB;CAE3D,MAAM,+BADuB,yBAAyB,EACK,QACxD,WAAW,OAAO,cAAc,OAAO,OAAO,4BAChD;AACD,KAAI,CAAC,2BAA4B,QAAO;AACxC,QACE,qBAAC,OAAD;EAAK,WAAU;YAAf,CACE,oBAAC,MAAD;GAAI,WAAU;aAAuC;GAAiB,CAAA,EACtE,oBAAC,OAAD;GAAK,WAAU;aACZ,8BAA8B,KAAK,QAAQ;IAC1C,MAAM,OAAO,gBAAgB,IAAI;IACjC,MAAM,eAAe,IAAI,UAAU,KAAK,IAAI,YAAY;AACxD,WACE,oBAAC,kBAAD;KAEE,OAAM;KACN,OAAO,GAAG,KAAK,OAAO;KACtB,oBAAkB,KAAK;KACvB,eAAe,wBAAwB,KAAK,GAAG;eAE/C,qBAAC,QAAD;MAAM,WAAU;gBAAhB,CACG,KAAK,MACL,aACI;;KACU,EAVZ,GAAG,KAAK,GAAG,IAAI,IAAI,WAAW,IAUlB;KAErB;GACE,CAAA,CACF;;;;;ACnCV,MAAM,MAAM;AACZ,MAAM,aAAa;AACnB,MAAM,cAAc;AAEpB,MAAM,aAAa;AAEnB,SAAgB,kBAAkB;CAChC,MAAM,YAAY,OAAO,KAAK;CAE9B,MAAM,iBADa,eAAe,CACA,aAAa;CAE/C,MAAM,YADQ,iCAAiC,CACvB,QAAQ,MAAM,eAAe,EAAE,CAAC;CACxD,MAAM,cAAc,KAAK,MAAM,kBAAkB,aAAa,KAAK,IAAI;CAGvE,MAAM,iBAAiB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AAgB,WAAW,OAA+B;CACxD,MAAM,EAAE,cAAc;CAEtB,MAAM,cADQ,iCAAiC,CACrB,QAAQ,MAAM,iBAAiB,EAAE,CAAC;AAC5D,QACE,qBAAC,OAAD;EACE,WAAW,QACT,8CACA,UACD;YAJH,CAME,oBAAC,YAAY,gBAAb;GAA4B,OAAM;GAAU,WAAU;aACnD,YAAY,SAAS,IACpB,YAAY,KAAK,eACf,oBAAC,YAAD,EAA4C,YAAc,EAAzC,WAAW,GAA8B,CAC1D,GAEF,oBAAC,OAAD;IAAK,WAAU;cAA6B;IAEtC,CAAA;GAEmB,CAAA,EAC7B,oBAAC,YAAY,gBAAb;GAA4B,OAAM;aAChC,oBAAC,OAAD;IAAK,WAAU;cACb,oBAAC,iBAAD,EAAmB,CAAA;IACf,CAAA;GACqB,CAAA,CACzB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json-editor-h3cffF6X.js","names":[],"sources":["../../../../node_modules/.pnpm/@lezer+json@1.0.3/node_modules/@lezer/json/dist/index.js","../../../../node_modules/.pnpm/@codemirror+lang-json@6.0.1/node_modules/@codemirror/lang-json/dist/index.js","../../editors/document-model-editor/components/code-editors/json-editor.tsx"],"sourcesContent":["import { LRParser } from '@lezer/lr';\nimport { styleTags, tags } from '@lezer/highlight';\n\nconst jsonHighlighting = styleTags({\n String: tags.string,\n Number: tags.number,\n \"True False\": tags.bool,\n PropertyName: tags.propertyName,\n Null: tags.null,\n \", :\": tags.separator,\n \"[ ]\": tags.squareBracket,\n \"{ }\": tags.brace\n});\n\n// This file was generated by lezer-generator. You probably shouldn't edit it.\nconst parser = LRParser.deserialize({\n version: 14,\n states: \"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l\",\n stateData: \"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O\",\n goto: \"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R\",\n nodeNames: \"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array\",\n maxTerm: 25,\n nodeProps: [\n [\"isolate\", -2,6,11,\"\"],\n [\"openedBy\", 7,\"{\",14,\"[\"],\n [\"closedBy\", 8,\"}\",15,\"]\"]\n ],\n propSources: [jsonHighlighting],\n skippedNodes: [0],\n repeatNodeCount: 2,\n tokenData: \"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~\",\n tokenizers: [0],\n topRules: {\"JsonText\":[0,1]},\n tokenPrec: 0\n});\n\nexport { parser };\n","import { parser } from '@lezer/json';\nimport { LRLanguage, indentNodeProp, continuedIndent, foldNodeProp, foldInside, LanguageSupport } from '@codemirror/language';\n\n/**\nCalls\n[`JSON.parse`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse)\non the document and, if that throws an error, reports it as a\nsingle diagnostic.\n*/\nconst jsonParseLinter = () => (view) => {\n try {\n JSON.parse(view.state.doc.toString());\n }\n catch (e) {\n if (!(e instanceof SyntaxError))\n throw e;\n const pos = getErrorPosition(e, view.state.doc);\n return [{\n from: pos,\n message: e.message,\n severity: 'error',\n to: pos\n }];\n }\n return [];\n};\nfunction getErrorPosition(error, doc) {\n let m;\n if (m = error.message.match(/at position (\\d+)/))\n return Math.min(+m[1], doc.length);\n if (m = error.message.match(/at line (\\d+) column (\\d+)/))\n return Math.min(doc.line(+m[1]).from + (+m[2]) - 1, doc.length);\n return 0;\n}\n\n/**\nA language provider that provides JSON parsing.\n*/\nconst jsonLanguage = /*@__PURE__*/LRLanguage.define({\n name: \"json\",\n parser: /*@__PURE__*/parser.configure({\n props: [\n /*@__PURE__*/indentNodeProp.add({\n Object: /*@__PURE__*/continuedIndent({ except: /^\\s*\\}/ }),\n Array: /*@__PURE__*/continuedIndent({ except: /^\\s*\\]/ })\n }),\n /*@__PURE__*/foldNodeProp.add({\n \"Object Array\": foldInside\n })\n ]\n }),\n languageData: {\n closeBrackets: { brackets: [\"[\", \"{\", '\"'] },\n indentOnInput: /^\\s*[\\}\\]]$/\n }\n});\n/**\nJSON language support.\n*/\nfunction json() {\n return new LanguageSupport(jsonLanguage);\n}\n\nexport { json, jsonLanguage, jsonParseLinter };\n","import { json, jsonLanguage, jsonParseLinter } from \"@codemirror/lang-json\";\nimport { forceLinting, linter } from \"@codemirror/lint\";\nimport { EditorState } from \"@codemirror/state\";\nimport { EditorView, keymap } from \"@codemirror/view\";\nimport { memo, useEffect } from \"react\";\nimport { ayuLight } from \"thememirror\";\nimport { baseEditorExtensions, baseKeymap } from \"./constants.js\";\nimport {\n makeFocusHandler,\n makePasteHandler,\n makeUpdateHandler,\n} from \"./factories.js\";\nimport {\n useDocumentSync,\n useEditorCleanup,\n useEditorRefs,\n useHandlerReconfiguration,\n} from \"./hooks.js\";\n\ntype Props = {\n doc: string;\n readonly?: boolean;\n /* Updates the document in the model, should be wrapped in `useCallback` in the parent */\n updateDocumentInModel?: (newDoc: string) => void;\n};\n\nconst JSONEditor = memo(function JSONEditor(props: Props) {\n const { doc, readonly = false, updateDocumentInModel } = props;\n const {\n editorRef,\n viewRef,\n updateListenerCompartment,\n focusHandlerCompartment,\n pasteHandlerCompartment,\n timeoutRef,\n } = useEditorRefs();\n\n useEffect(() => {\n if (!viewRef.current) {\n viewRef.current = new EditorView({\n state: EditorState.create({\n doc,\n extensions: [\n ...baseEditorExtensions,\n keymap.of(baseKeymap),\n ayuLight,\n jsonLanguage,\n json(),\n linter(jsonParseLinter()),\n updateListenerCompartment.current.of(\n makeUpdateHandler(readonly, timeoutRef, updateDocumentInModel),\n ),\n focusHandlerCompartment.current.of(\n makeFocusHandler(readonly, timeoutRef, updateDocumentInModel),\n ),\n pasteHandlerCompartment.current.of(\n makePasteHandler(readonly, timeoutRef, updateDocumentInModel),\n ),\n EditorState.readOnly.of(readonly),\n ],\n }),\n parent: editorRef.current!,\n });\n forceLinting(viewRef.current);\n }\n }, []);\n\n useEditorCleanup(viewRef);\n\n useHandlerReconfiguration(\n viewRef.current,\n readonly,\n timeoutRef,\n updateDocumentInModel,\n {\n updateListener: updateListenerCompartment.current,\n focusHandler: focusHandlerCompartment.current,\n pasteHandler: pasteHandlerCompartment.current,\n },\n );\n\n useDocumentSync(viewRef.current, doc);\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C,cAAc,wBAAwB;EACvC,CACF;AAED,iBAAgB,QAAQ,SAAS,IAAI;AAErC,QAAO,oBAAC,OAAD,EAAK,KAAK,WAAa,CAAA;EAC9B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema-context-C0GpuR27.js","names":[],"sources":["../../editors/document-model-editor/context/schema-context.tsx"],"sourcesContent":["import type { DefinitionNode, DocumentNode } from \"graphql\";\nimport { buildASTSchema, Kind, parse, printSchema } from \"graphql\";\nimport { createContext, useContext, useMemo } from \"react\";\nimport {\n hiddenQueryTypeDefDoc,\n initialSchemaStr,\n typeDefsDoc,\n} from \"../constants/documents.js\";\n\n/* Required to make the schema \"count\" as an actual schema */\nconst hiddenQueryTypeDefinitions =\n safeParseSdl(hiddenQueryTypeDefDoc)?.definitions ?? [];\n/* Scalar definitions from the Powerhouse standard library */\nconst standardLibCustomScalarDefinitions =\n safeParseSdl(typeDefsDoc)?.definitions ?? [];\n/* These are always included when building the shared schema, because they do not change */\nconst alwaysIncludedDefinitions: DefinitionNode[] = [\n ...hiddenQueryTypeDefinitions,\n ...standardLibCustomScalarDefinitions,\n];\n\n/* The shared schema is just a string to make memoization easier */\ntype TSchemaContext = {\n sharedSchema: string;\n error: Error | undefined;\n};\n\ntype TSchemaContextProps = {\n globalStateSchemaSdl: string;\n localStateSchemaSdl: string;\n operationSchemasSdl: string;\n children: React.ReactNode;\n};\n\n/*\n Combines the always-included definitions and all user SDLs into a single\n DocumentNode and builds a schema in one shot. Building atomically lets\n buildASTSchema resolve forward references between user types within the same\n document, and avoids the accumulation/staleness that a per-definition\n validate-then-merge strategy would introduce. Throws if the combined SDL is\n invalid; callers are expected to catch.\n*/\nfunction makeSharedSchemaSdl(\n globalStateSchemaSdl?: string,\n localStateSchemaSdl?: string,\n operationSchemasSdl?: string,\n): string {\n const definitions: DefinitionNode[] = [...alwaysIncludedDefinitions];\n\n for (const sdl of [\n globalStateSchemaSdl,\n localStateSchemaSdl,\n operationSchemasSdl,\n ]) {\n if (!sdl) continue;\n const ast = safeParseSdl(sdl);\n if (!ast) continue;\n definitions.push(...ast.definitions);\n }\n\n const documentNode: DocumentNode = {\n kind: Kind.DOCUMENT,\n definitions,\n };\n\n return printSchema(buildASTSchema(documentNode));\n}\n\n/*\n Parses an SDL string into an ast.\n Uses try catch and checks if the SDL is a valid document string to prevent errors from breaking the editor.\n*/\nexport function safeParseSdl(sdl: string) {\n try {\n if (!sdl) return null;\n return parse(sdl);\n } catch (error) {\n return null;\n }\n}\n\nexport const SchemaContext = createContext<TSchemaContext>({\n sharedSchema: initialSchemaStr,\n error: undefined,\n});\n\nexport function parseSharedSchemaSdl(\n globalStateSchemaSdl?: string,\n localStateSchemaSdl?: string,\n operationSchemasSdl?: string,\n): TSchemaContext {\n try {\n return {\n sharedSchema: makeSharedSchemaSdl(\n globalStateSchemaSdl,\n localStateSchemaSdl,\n operationSchemasSdl,\n ),\n error: undefined,\n };\n } catch (error) {\n // Combined SDL is invalid (duplicate type, unknown reference, parse error, etc.).\n // Fall back to the minimal base schema so the JSON initial-value validator\n // gracefully finds no state type and skips, instead of producing a misleading\n // \"Field value has an invalid value.\" The real reason is surfaced via `error`.\n return {\n sharedSchema: initialSchemaStr,\n error:\n error instanceof Error\n ? error\n : new Error(\n typeof error === \"string\" ? error : JSON.stringify(error),\n { cause: error },\n ),\n };\n }\n}\n\n/*\n Provides the shared schema to the editor.\n We use the sdl string form to make memoization easier.\n*/\nexport function SchemaContextProvider(props: TSchemaContextProps) {\n const {\n children,\n globalStateSchemaSdl,\n localStateSchemaSdl,\n operationSchemasSdl,\n } = props;\n\n const sharedSchemaSdl = useMemo(\n () =>\n parseSharedSchemaSdl(\n globalStateSchemaSdl,\n localStateSchemaSdl,\n operationSchemasSdl,\n ),\n [globalStateSchemaSdl, localStateSchemaSdl, operationSchemasSdl],\n );\n\n return (\n <SchemaContext.Provider value={sharedSchemaSdl}>\n {children}\n </SchemaContext.Provider>\n );\n}\n\nexport function useSchemaContext() {\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