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"; /** * action() results used as event handlers in JSX. action() is an * opaque origin but handler results are typically used directly * (no property access), so opaque classification doesn't affect them. */ import { action, pattern, UI, Writable } from "commonfabric"; const define = undefined; const runtimeDeps = undefined; const __cfAmdHooks = undefined; interface State { label: string; } const __cfHandler_1 = __cfHelpers.handler(false as const satisfies __cfHelpers.JSONSchema, { type: "object", properties: { count: { type: "number", asCell: ["cell"] } }, required: ["count"] } as const satisfies __cfHelpers.JSONSchema, (_, { count }) => { count.set(count.get() + 1); }); const __cfHandler_2 = __cfHelpers.handler(false as const satisfies __cfHelpers.JSONSchema, { type: "object", properties: { count: { type: "number", asCell: ["cell"] } }, required: ["count"] } as const satisfies __cfHelpers.JSONSchema, (_, { count }) => { count.set(count.get() - 1); }); // FIXTURE: action-result-not-opaque // Verifies: action() results used as JSX event handlers are not marked asOpaque in the output // action(() => count.set(...)) → handler(false, { count: { asCell } }, (_, { count }) => ...)({ count }) // Context: action() is an opaque origin, but handler results are used directly (no property access) export default pattern((__cf_pattern_input) => { const label = __cf_pattern_input.key("label"); const count = new Writable(0, { type: "number" } as const satisfies __cfHelpers.JSONSchema).for("count", true); const increment = __cfHandler_1({ count: count }).for({ stream: "increment" }, true); const decrement = __cfHandler_2({ count: count }).for({ stream: "decrement" }, true); return { [UI]: (