function __cfHardenFn(fn: Function) { Object.freeze(fn); const prototype = fn.prototype; if (prototype && typeof prototype === "object") { Object.freeze(prototype); } return fn; } import { __cfHelpers } from "commonfabric"; /** * FUTURE REPRO: patternized map callbacks should follow array-destructured aliases * * Destructuring a reactive array-valued field into a local alias should still * let later computations lower through that alias. */ import { Default, pattern, UI, VNode, Writable, } from "commonfabric"; const define = undefined; const runtimeDeps = undefined; const __cfAmdHooks = undefined; interface FileEntry { name: string; tags: [ "file" | "folder", string ]; } interface Input { files: Writable>; } interface Output { [UI]: VNode; } const __cfLift_1 = __cfHelpers.lift<{ kind: string; }, boolean>(({ kind }) => kind === "folder", { type: "object", properties: { kind: { type: "string" } }, required: ["kind"] } as const satisfies __cfHelpers.JSONSchema, { type: "boolean" } as const satisfies __cfHelpers.JSONSchema); const __cfPattern_1 = __cfHelpers.pattern(__cf_pattern_input => { const file = __cf_pattern_input.key("element"); const __cf_destructure_1 = file.key("tags"), kind = __cf_destructure_1.key("0"); const isFolder = __cfLift_1({ kind: kind }).for("isFolder", true); return {__cfHelpers.ifElse({ type: "boolean" } as const satisfies __cfHelpers.JSONSchema, { type: "string" } as const satisfies __cfHelpers.JSONSchema, { type: "string" } as const satisfies __cfHelpers.JSONSchema, { type: "string" } as const satisfies __cfHelpers.JSONSchema, isFolder, file.key("name"), "locked")}; }, { type: "object", properties: { element: { $ref: "#/$defs/FileEntry" } }, required: ["element"], $defs: { FileEntry: { type: "object", properties: { name: { type: "string" }, tags: { type: "array", items: { type: "string" } } }, required: ["name", "tags"] } } } as const satisfies __cfHelpers.JSONSchema, { anyOf: [{ $ref: "https://commonfabric.org/schemas/vnode.json" }, { $ref: "#/$defs/UIRenderable" }, { type: "object", properties: {} }], $defs: { UIRenderable: { type: "object", properties: { $UI: { $ref: "https://commonfabric.org/schemas/vnode.json" } }, required: ["$UI"] } } } as const satisfies __cfHelpers.JSONSchema); export default pattern((__cf_pattern_input) => { const files = __cf_pattern_input.key("files"); return { [UI]: (
{files.mapWithPattern(__cfPattern_1, {})}
), }; }, { type: "object", properties: { files: { type: "array", items: { $ref: "#/$defs/FileEntry" }, "default": [], asCell: ["cell"] } }, required: ["files"], $defs: { FileEntry: { type: "object", properties: { name: { type: "string" }, tags: { type: "array", items: { type: "string" } } }, required: ["name", "tags"] } } } as const satisfies __cfHelpers.JSONSchema, { type: "object", properties: { $UI: { $ref: "https://commonfabric.org/schemas/vnode.json" } }, required: ["$UI"] } as const satisfies __cfHelpers.JSONSchema); // @ts-ignore: Internals function h(...args: any[]) { return __cfHelpers.h.apply(null, args); } __cfHardenFn(h); __cfReg({ __cfLift_1, __cfPattern_1 });