@weasel-js/core 1.1.0 → 1.3.0-pre.0
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/CHANGELOG.md +1988 -0
- package/dist/{DrawCommand-BbPrSTra.d.ts → DrawCommand-BnZyQaDc.d.ts} +29 -189
- package/dist/chunk-2KKYDDDD.js +121 -0
- package/dist/chunk-2KKYDDDD.js.map +1 -0
- package/dist/{chunk-J7LUY47N.js → chunk-3FB44DBC.js} +3 -3
- package/dist/{chunk-J7LUY47N.js.map → chunk-3FB44DBC.js.map} +1 -1
- package/dist/{chunk-J3YC3GVF.js → chunk-3ZV53ZW2.js} +51 -14
- package/dist/chunk-3ZV53ZW2.js.map +1 -0
- package/dist/{chunk-JOSUVS6C.js → chunk-67KE7SDP.js} +4 -4
- package/dist/chunk-67KE7SDP.js.map +1 -0
- package/dist/{chunk-CSMF654J.js → chunk-AQS4JGRA.js} +50 -7
- package/dist/chunk-AQS4JGRA.js.map +1 -0
- package/dist/{chunk-HGF5X6MZ.js → chunk-BJN5ZRIJ.js} +2 -2
- package/dist/chunk-BJN5ZRIJ.js.map +1 -0
- package/dist/{chunk-4Z6J4IVH.js → chunk-F74NVEHT.js} +14 -46
- package/dist/chunk-F74NVEHT.js.map +1 -0
- package/dist/{chunk-3B4QEB2G.js → chunk-IFOVTYAK.js} +26291 -24809
- package/dist/chunk-IFOVTYAK.js.map +1 -0
- package/dist/{chunk-UGFFCMQP.js → chunk-MXFSHJOM.js} +4 -4
- package/dist/{chunk-UGFFCMQP.js.map → chunk-MXFSHJOM.js.map} +1 -1
- package/dist/{chunk-BHVYVFGV.js → chunk-ZB7UYJVG.js} +3 -3
- package/dist/{chunk-BHVYVFGV.js.map → chunk-ZB7UYJVG.js.map} +1 -1
- package/dist/clipboard.d.ts +3 -3
- package/dist/clipboard.js +3 -3
- package/dist/clone.d.ts +2 -2
- package/dist/clone.js +3 -3
- package/dist/{geometry-C56YbnfD.d.ts → geometry-Dtt_k6Dq.d.ts} +1 -1
- package/dist/{grid-DqOi0Vgi.d.ts → grid-nnXU4VjN.d.ts} +1 -1
- package/dist/index.d.ts +1929 -1342
- package/dist/index.js +10 -10
- package/dist/insert.d.ts +3 -3
- package/dist/insert.js +1 -1
- package/dist/move.d.ts +4 -4
- package/dist/move.js +3 -3
- package/dist/{options-C6HYCKP7.d.ts → options-CdFl510T.d.ts} +1 -1
- package/dist/{path-B6MMiodD.d.ts → path-JEV2c5If.d.ts} +2 -13
- package/dist/patterns-builtin.d.ts +1 -1
- package/dist/patterns-builtin.js +1 -1
- package/dist/{pointSnapToGrid-BBtn5bus.d.ts → pointSnapToGrid-Dmthv94u.d.ts} +2 -2
- package/dist/{registry-DGBrjGbB.d.ts → registry-BU1_3L_C.d.ts} +691 -38
- package/dist/renderer.d.ts +38 -83
- package/dist/renderer.js +10 -10
- package/dist/resize.d.ts +4 -4
- package/dist/resize.js +2 -2
- package/dist/routing.d.ts +35 -9
- package/dist/routing.js +1 -1
- package/dist/stroke-5pBwOm9s.d.ts +190 -0
- package/dist/{types-vqxpCFVp.d.ts → types-DIQAisSG.d.ts} +107 -5
- package/dist/{types-DbysOO-2.d.ts → types-XBcDEp3Y.d.ts} +14 -9
- package/dist/{types-BhrifbZ1.d.ts → types-miXHGrZM.d.ts} +1 -1
- package/package.json +8 -6
- package/dist/chunk-3B4QEB2G.js.map +0 -1
- package/dist/chunk-4Z6J4IVH.js.map +0 -1
- package/dist/chunk-CSMF654J.js.map +0 -1
- package/dist/chunk-GVCNT7UH.js +0 -47
- package/dist/chunk-GVCNT7UH.js.map +0 -1
- package/dist/chunk-HGF5X6MZ.js.map +0 -1
- package/dist/chunk-J3YC3GVF.js.map +0 -1
- package/dist/chunk-JOSUVS6C.js.map +0 -1
- package/dist/paint-types-CnLIzqq1.d.ts +0 -261
- package/dist/viewToMat3-CQW_YqDw.d.ts +0 -67
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/applyOps.ts","../src/debug/flag.ts","../src/features/pointer/PointerContext.tsx","../src/interactions/actions/clipboard/wireFormat.ts","../src/interactions/actions/clipboard/materializePaste.ts","../src/interactions/actions/clipboard/clipboardOps.ts"],"names":["useRef"],"mappings":";;;;;;AAYO,SAAS,UAAA,CAAc,OAAA,EAAY,GAAA,EAAW,MAAA,EAAuB;AAC1E,EAAA,KAAA,MAAW,EAAA,IAAM,GAAA,EAAK,EAAA,CAAG,KAAA,CAAM,OAAO,CAAA;AACxC;AAOO,SAAS,kBAAA,CACd,OAAA,EACA,GAAA,EACA,KAAA,EACM;AACN,EAAA,MAAM,CAAA,GAAI,OAAA;AACV,EAAA,IAAI,CAAA,CAAE,QAAA,EAAU,CAAA,CAAE,QAAA,CAAS,KAAK,KAAK,CAAA;AAAA,OAChC,UAAA,CAAW,OAAA,EAAS,GAAU,CAAA;AACrC;;;ACFA,IAAM,IAAA,GAAO,CAAC,cAAA,EAAgB,kBAAkB,CAAA;AAOhD,IAAI,MAAA,GAAwB,IAAA;AAE5B,SAAS,IAAA,GAAe;AACtB,EAAA,MAAM,QAAgB,EAAE,GAAA,EAAK,OAAO,GAAA,kBAAK,IAAI,KAAI,EAAE;AACnD,EAAA,IAAI,OAAO,YAAA,KAAiB,WAAA,EAAa,OAAO,KAAA;AAChD,EAAA,IAAI;AACF,IAAA,KAAA,MAAW,KAAK,IAAA,EAAM;AACpB,MAAA,MAAM,CAAA,GAAI,YAAA,CAAa,OAAA,CAAQ,CAAC,CAAA;AAChC,MAAA,IAAI,CAAA,IAAK,IAAA,IAAQ,CAAA,KAAM,EAAA,EAAI;AAC3B,MAAA,IAAI,CAAA,KAAM,GAAA,IAAO,CAAA,KAAM,MAAA,IAAU,CAAA,KAAM,GAAA,EAAK,OAAO,EAAE,GAAA,EAAK,IAAA,EAAM,GAAA,kBAAK,IAAI,KAAI,EAAE;AAC/E,MAAA,OAAO,EAAE,GAAA,EAAK,KAAA,EAAO,GAAA,EAAK,IAAI,GAAA,CAAI,CAAA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,CAAC,CAAA;AAAA,IACnC,SAAS,GAAA,EAAK;AACZ,MAAA,KAAA,CAAM,WAAA,EAAa,CAAA,kEAAA,EAAgE,MAAA,CAAO,GAAG,CAAC,CAAA,CAAE,CAAA;AAAA,IAClG;AAAA,EACF;AACF","file":"chunk-JOSUVS6C.js","sourcesContent":["import type { Op } from './ops/types';\n\n/**\n * Default `applyOps` implementation: apply each op in order against\n * `adapter`. Used by hooks when an adapter omits `applyOps`. Apps that\n * need history integration (checkpoint + push entry) supply their own\n * `applyOps` instead.\n *\n * The `_label` parameter mirrors the `applyOps(ops, label)` signature so\n * call-sites can dispatch through `(adapter.applyOps ?? applyOpsTo)` with\n * matching arguments. The default ignores it.\n */\nexport function applyOpsTo<A>(adapter: A, ops: Op[], _label?: string): void {\n for (const op of ops) op.apply(adapter);\n}\n\n/**\n * Dispatcher: invokes `adapter.applyOps` if present, otherwise falls back\n * to `applyOpsTo`. Convenience for hooks so they don't repeat the\n * `?? applyOpsTo` pattern at every call site.\n */\nexport function dispatchApplyBatch<A>(\n adapter: A,\n ops: Op[],\n label?: string,\n): void {\n const a = adapter as { applyOps?: (ops: Op[], label?: string) => void };\n if (a.applyOps) a.applyOps(ops, label);\n else applyOpsTo(adapter, ops, label);\n}\n","/**\n * Namespaced, opt-in console tracing for the kit.\n *\n * Enable in the browser:\n *\n * localStorage.setItem('weasel.debug', '*') // all namespaces\n * localStorage.setItem('weasel.debug', 'tools,dispatch') // specific ones\n * localStorage.setItem('weasel.debug', '1') // legacy \"all\"\n *\n * Each call site picks a stable namespace string. Off by default; the flag\n * is read once and cached per page session — reload to pick up a change.\n *\n * Mirrors `packages/ui/src/dlog.ts`. The two impls live in separate\n * packages because weasel-ui doesn't depend on the kit, but both read the\n * same localStorage keys so behavior is uniform from a debugger's POV.\n *\n * Known kit namespaces:\n * - tools — active-tool + hotkey transitions (useTools)\n * - dispatch — gesture start / end / cancel (dispatcher)\n * - drag-rect — useDragRect lifecycle\n * - drag-radial — useDragRadial lifecycle\n * - scene — restored-op replay gaps (history persistence)\n * - scene-canvas — SceneCanvas mount / unmount; adapter paste-translation warnings\n * - history — applyOps push, no-op suppression, serialize/restore\n * - clipboard — OS clipboard write/read failures, malformed payloads\n */\n\nconst KEYS = ['weasel.debug', 'weaseldraw.debug'] as const;\n\ninterface Cached {\n all: boolean;\n set: Set<string>;\n}\n\nlet cached: Cached | null = null;\n\nfunction read(): Cached {\n const empty: Cached = { all: false, set: new Set() };\n if (typeof localStorage === 'undefined') return empty;\n try {\n for (const k of KEYS) {\n const v = localStorage.getItem(k);\n if (v == null || v === '') continue;\n if (v === '1' || v === 'true' || v === '*') return { all: true, set: new Set() };\n return { all: false, set: new Set(v.split(/[\\s,]+/).filter(Boolean)) };\n }\n return empty;\n } catch {\n return empty;\n }\n}\n\nfunction get(): Cached {\n if (cached === null) cached = read();\n return cached;\n}\n\n/** True when `namespace` (or `*`) is enabled. Pass no argument to test\n * whether *any* namespace is on (legacy global-flag semantics). */\nexport function isDebugEnabled(namespace?: string): boolean {\n const c = get();\n if (c.all) return true;\n if (namespace === undefined) return c.set.size > 0;\n return c.set.has(namespace);\n}\n\n/** Conditional `console.debug` — no-op unless `namespace` (or `*`) is enabled.\n * Each call is prefixed with `[namespace]` so the source is searchable. */\nexport function dlog(namespace: string, ...args: unknown[]): void {\n if (!isDebugEnabled(namespace)) return;\n // eslint-disable-next-line no-console\n console.debug(`[${namespace}]`, ...args);\n}\n\n/** Conditional `console.warn` — like `dlog` but at warn level. Use for\n * diagnostics that indicate something worth surfacing during debugging\n * (e.g. no-op op batches suppressed). */\nexport function dwarn(namespace: string, ...args: unknown[]): void {\n if (!isDebugEnabled(namespace)) return;\n // eslint-disable-next-line no-console\n console.warn(`[${namespace}]`, ...args);\n}\n","/**\n * @experimental\n * PointerContext — a tiny ambient context that publishes the world-space\n * position of the canvas pointer, refreshed on every `pointermove` over\n * the canvas. Cleared (set to `null`) on `pointerleave`.\n *\n * Why ref-based and not state-based: cursor moves fire dozens of times per\n * second; routing those through React state would re-render every consumer\n * in the tree. The context exposes a stable `pointerRef` whose `.current`\n * is mutated directly by the publisher, plus a thunk `getDropPoint()` that\n * reads it on demand. Consumers (e.g. `useClipboard`) pull via the thunk\n * inside their callbacks — no subscription, no re-render.\n *\n * `<SceneCanvas>` publishes automatically. `useClipboardOps` consumes when\n * the caller didn't pass an explicit `getDropPoint` option. Other future\n * hit-on-cursor consumers (drop-zone hover, context-menu anchor) can reuse\n * the same context.\n */\nimport { createContext, useContext, useMemo, useRef, type MutableRefObject, type ReactNode } from 'react';\n\n/** @experimental World-space pointer position, or `null` when the pointer\n * isn't over the publishing canvas. */\nexport type PointerWorldPos = { worldX: number; worldY: number } | null;\n\n/** @experimental */\nexport interface PointerContextValue {\n /** Live ref — mutate to publish, read for the latest snapshot. The\n * identity is stable for the lifetime of the provider. */\n readonly pointerRef: MutableRefObject<PointerWorldPos>;\n /** Convenience thunk equivalent to `() => pointerRef.current`. Stable\n * identity for the lifetime of the provider; safe to pass to hooks. */\n readonly getDropPoint: () => PointerWorldPos;\n}\n\nconst PointerContext = createContext<PointerContextValue | null>(null);\n\n/**\n * @experimental\n * Wrap the part of the React tree that should share a pointer-position\n * context. Usually placed at the demo / app root, alongside\n * `<ActionsProvider>` and `<SelectionContextProvider>`.\n *\n * Most consumers don't need to mount this directly — `<SceneCanvas>` mounts\n * an internal provider when no parent provider is in scope, so child hooks\n * (`useClipboard` without an explicit `getDropPoint`) read the canvas's\n * tracked pointer for free.\n */\nexport function PointerContextProvider({ children }: { children: ReactNode }): ReactNode {\n const pointerRef = useRef<PointerWorldPos>(null);\n const value = useMemo<PointerContextValue>(() => ({\n pointerRef,\n getDropPoint: () => pointerRef.current,\n }), []);\n return <PointerContext.Provider value={value}>{children}</PointerContext.Provider>;\n}\n\n/** @experimental Read the surrounding pointer-context value, or `null` when\n * no provider is in scope. */\nexport function usePointerContext(): PointerContextValue | null {\n return useContext(PointerContext);\n}\n","import { dwarn } from 'debug/flag';\n\n/** MIME type the kit writes its full-fidelity clipboard payload under, so a\n * copy/paste between two weasel canvases round-trips scene nodes rather than\n * the SVG or text flavors other apps read. */\nexport const WEASEL_CLIPBOARD_MIME = 'application/x-weasel-clipboard+json';\n/** Chromium's async-clipboard spelling for custom formats. */\nexport const WEASEL_CLIPBOARD_MIME_WEB = `web ${WEASEL_CLIPBOARD_MIME}`;\n\ninterface WeaselClipboardPayload { weaselClipboard: 1; nodes: unknown[] }\n\ntype Replacer = (key: string, value: unknown) => unknown;\ntype Reviver = (key: string, value: unknown) => unknown;\n\n/** Serialize snapshot items into the versioned wire text.\n *\n * Function-valued fields (e.g. a container's `clipFromPose`) are dropped by\n * JSON serialization — OS-pasted clip containers arrive unclipped.\n * Consumers who need clips to survive the OS round-trip can translate\n * function ↔ registry key in their `jsonReplacer`/reviver pair (the\n * scene-serialization `clipFromPoseKey` precedent). */\nexport function buildWeaselClipboardText(items: unknown[], replacer?: Replacer): string {\n const payload: WeaselClipboardPayload = { weaselClipboard: 1, nodes: items };\n return JSON.stringify(payload, replacer as Parameters<typeof JSON.stringify>[1]);\n}\n\n/** Cheap check: could this text be a weasel clipboard payload? Substring\n * pre-check, then a guarded parse + marker/version test. */\nexport function sniffWeaselClipboardText(text: string): boolean {\n if (!text.includes('\"weaselClipboard\"')) return false;\n try {\n const parsed = JSON.parse(text) as Partial<WeaselClipboardPayload> | null;\n return !!parsed && parsed.weaselClipboard === 1;\n } catch {\n return false;\n }\n}\n\n// Opening `<svg ...>` tag of a serialized document. `[^>]*` is safe for OUR\n// serializer's output (attribute values are XML-escaped, so no raw `>` can\n// appear inside the tag) — see embedWeaselMetadataInSvg's contract note.\nconst SVG_OPEN_TAG = /<svg(?:\\s[^>]*)?>/i;\n\n/**\n * Embed a weasel clipboard payload in an SVG document as a `<metadata>`\n * child of the root — legal SVG 1.1, ignored by external tools — so one\n * `text/plain` flavor serves both audiences: external tools parse the SVG,\n * weasel extracts the JSON for full fidelity on draw→draw DOM paste.\n *\n * The payload rides in CDATA so JSON's `<` / `&` need no entity escaping; a\n * literal `]]>` inside the payload is split across CDATA sections\n * (`]]]]><![CDATA[>`), which {@link extractWeaselClipboardFromSvg} rejoins.\n *\n * Intended for OUR serializer's output only (`serializeSvg` — single\n * `<svg ...>` open tag, XML-escaped attributes). When no open tag is found\n * the input is returned unchanged with a debug warning.\n */\nexport function embedWeaselMetadataInSvg(svgText: string, payloadText: string): string {\n const open = SVG_OPEN_TAG.exec(svgText);\n if (!open) {\n dwarn('clipboard', 'embedWeaselMetadataInSvg: no <svg ...> open tag found — returning input unchanged');\n return svgText;\n }\n const cdata = `<![CDATA[${payloadText.replaceAll(']]>', ']]]]><![CDATA[>')}]]>`;\n const at = open.index + open[0].length;\n return `${svgText.slice(0, at)}<metadata>${cdata}</metadata>${svgText.slice(at)}`;\n}\n\n/**\n * Recover an embedded weasel clipboard payload from SVG text: read the first\n * `<metadata>` block, rejoin its CDATA sections (concatenation restores the\n * `]]>` split by {@link embedWeaselMetadataInSvg}; plain non-CDATA content\n * passes through as-is), and return the payload text iff it sniffs as the\n * weasel wire format — else null (external/non-weasel metadata declines).\n *\n * A text scan, not an XML parse — the payload is small and ours.\n */\nexport function extractWeaselClipboardFromSvg(svgText: string): string | null {\n const block = /<metadata(?:\\s[^>]*)?>([\\s\\S]*?)<\\/metadata>/i.exec(svgText);\n if (!block) return null;\n const inner = block[1];\n const payload = inner.includes('<![CDATA[')\n ? Array.from(inner.matchAll(/<!\\[CDATA\\[([\\s\\S]*?)\\]\\]>/g), (m) => m[1]).join('')\n : inner;\n return sniffWeaselClipboardText(payload) ? payload : null;\n}\n\n/** Parse wire text to snapshot items, or null when malformed/mismatched\n * (callers decline to the next content handler). */\nexport function parseWeaselClipboardText(text: string, reviver?: Reviver): unknown[] | null {\n try {\n const parsed = JSON.parse(text, reviver as Parameters<typeof JSON.parse>[1]) as\n Partial<WeaselClipboardPayload> | null;\n if (!parsed || parsed.weaselClipboard !== 1 || !Array.isArray(parsed.nodes)) return null;\n return parsed.nodes;\n } catch (err) {\n dwarn('clipboard', `weasel payload failed to parse: ${String(err)}`);\n return null;\n }\n}\n","/**\n * Shared paste materialization — the one place the paste recipe lives:\n * offset policy → `commitPaste` → the op batch (InsertOps parents-first +\n * a SetSelectionOp). Both `useClipboardOps.paste` (in-memory paste) and the\n * kit weasel-JSON content handler (OS-clipboard paste) dispatch exactly this\n * batch, so the two arrival paths stay indistinguishable in history.\n *\n * Pure: no dispatching here — callers own how the ops are applied\n * (`dispatchApplyBatch` vs `IngestCtx.applyOps`) and any post-paste\n * bookkeeping (the hook's cascade re-snapshot, the handler's selection set).\n */\nimport { createInsertOp } from 'core/ops/create';\nimport { createSetSelectionOp } from 'core/ops/select';\nimport type { Op } from 'core/ops/types';\nimport type { NodeId } from 'core/scene/types';\nimport type { ClipboardSnapshot, InsertAdapter } from 'core/adapters/types';\n\n/** Shared paste materialization: offset policy → commitPaste → the op batch\n * both the in-memory paste and the OS-paste handler dispatch. Returns null\n * when the adapter can't paste or nothing was created. */\nexport function materializePaste<TNode extends { id: string }>(\n adapter: InsertAdapter<TNode>,\n snapshot: ClipboardSnapshot,\n opts: {\n currentSelection: string[];\n dropPoint?: { worldX: number; worldY: number } | null;\n },\n): { ops: Op[]; newIds: string[]; created: TNode[] } | null {\n const commitPaste = adapter.commitPaste;\n if (!commitPaste) return null;\n const offset = adapter.getPasteOffset?.(snapshot) ?? { dx: 0, dy: 0 };\n const ctx = opts.dropPoint != null ? { dropPoint: opts.dropPoint } : undefined;\n const created = commitPaste.call(adapter, snapshot, offset, ctx);\n if (created.length === 0) return null;\n const newIds = created.map((o) => o.id);\n const ops: Op[] = [\n ...created.map((o) => createInsertOp({ node: o })),\n createSetSelectionOp({ from: opts.currentSelection as NodeId[], to: newIds as NodeId[] }),\n ];\n return { ops, newIds, created };\n}\n","import { useCallback, useRef } from 'react';\nimport type { NodeId } from 'core/scene/types';\nimport { dispatchApplyBatch } from 'core/applyOps';\nimport type { InsertAdapter } from 'core/adapters/types';\nimport type { ClipboardSnapshot } from './types';\nimport { usePointerContext } from 'features/pointer/PointerContext';\nimport { dwarn } from 'debug/flag';\nimport { materializePaste } from './materializePaste';\nimport { WEASEL_CLIPBOARD_MIME, buildWeaselClipboardText } from './wireFormat';\n\ntype Replacer = (key: string, value: unknown) => unknown;\n\n/** Options for `useClipboardOps`. */\nexport interface UseClipboardOpsOptions {\n /** How the hook reads \"current selection\" for copy. The kit doesn't assume\n * a global selection store; each consumer wires this. */\n getSelection: () => NodeId[];\n /** Called after a successful paste with the ids of the newly inserted objects. */\n onPaste?: (newIds: NodeId[]) => void;\n /** Label for the history entry produced by paste. Default 'Paste'. */\n pasteLabel?: string;\n /** Pulled once per paste() call. When non-null, threaded to commitPaste\n * as `ctx.dropPoint`; adapters typically use it as the cluster origin\n * (ignoring `offset`). When null/undefined, the hook falls back to the\n * existing cascade-offset behavior. */\n getDropPoint?: () => { worldX: number; worldY: number } | null;\n /** Produce the OS-clipboard flavor map for a copied snapshot. Keys are MIME\n * types, values the serialized payload. The kit default emits\n * `application/x-weasel-clipboard+json` plus `text/plain` carrying the\n * same JSON. Apps override to add richer flavors (e.g. real SVG) or to\n * replace the text flavor. Return an empty object to skip the OS write\n * entirely. */\n produceFlavors?: (snapshot: ClipboardSnapshot) => Record<string, string>;\n /** Replacer for the kit-default JSON flavor (typed arrays etc.). Ignored\n * when `produceFlavors` is supplied. */\n jsonReplacer?: Replacer;\n}\n\n/** Return shape of `useClipboardOps`: imperative `copy`, `paste`, and `isEmpty` functions. */\nexport interface UseClipboardOpsReturn {\n copy(): void;\n paste(): void;\n isEmpty(): boolean;\n}\n\nconst EMPTY: ClipboardSnapshot = { items: [] };\n\n/** In-memory copy/paste of selections via `InsertAdapter.snapshotSelection` / `commitPaste`. */\nexport function useClipboardOps<TNode extends { id: string }>(\n adapter: InsertAdapter<TNode>,\n options: UseClipboardOpsOptions,\n): UseClipboardOpsReturn {\n const { getSelection, onPaste, pasteLabel = 'Paste', getDropPoint, produceFlavors, jsonReplacer } = options;\n // Fall back to the ambient pointer context (auto-published by SceneCanvas)\n // when the caller didn't supply an explicit `getDropPoint`. Null context\n // (no provider in scope) and no caller-supplied thunk together mean\n // \"no drop point\" — paste uses the cascade offset instead.\n const pointerCtx = usePointerContext();\n const effectiveGetDropPoint = getDropPoint ?? pointerCtx?.getDropPoint;\n const clipboardRef = useRef<ClipboardSnapshot>(EMPTY);\n // Keep callbacks stable across renders.\n const adapterRef = useRef(adapter);\n adapterRef.current = adapter;\n const optsRef = useRef({\n getSelection, onPaste, pasteLabel, getDropPoint: effectiveGetDropPoint, produceFlavors, jsonReplacer,\n });\n optsRef.current = {\n getSelection, onPaste, pasteLabel, getDropPoint: effectiveGetDropPoint, produceFlavors, jsonReplacer,\n };\n\n const copy = useCallback(() => {\n const ids = optsRef.current.getSelection();\n if (ids.length === 0) return;\n const snap = adapterRef.current.snapshotSelection;\n if (!snap) return;\n clipboardRef.current = snap(ids);\n // Best-effort OS write. Never blocks or throws — the in-memory ref is\n // already set, and OS clipboard support varies (custom formats are\n // Chromium-only via the \"web \" prefix; jsdom/non-secure contexts have\n // no API at all). The flavor producer itself is untrusted consumer code\n // (`produceFlavors`), so guard its call too — a throwing producer must\n // not break `copy()`, it just skips the OS write.\n let flavors: Record<string, string> | null = null;\n try {\n flavors = optsRef.current.produceFlavors?.(clipboardRef.current)\n ?? defaultFlavors(clipboardRef.current, optsRef.current.jsonReplacer);\n } catch (err) {\n dwarn('clipboard', `flavor producer threw — skipping OS write: ${String(err)}`);\n }\n if (flavors) void writeOsClipboard(flavors);\n }, []);\n\n const paste = useCallback(() => {\n const cb = clipboardRef.current;\n if (cb.items.length === 0) return;\n const a = adapterRef.current;\n const result = materializePaste(a, cb, {\n currentSelection: optsRef.current.getSelection(),\n dropPoint: optsRef.current.getDropPoint?.(),\n });\n if (!result) return;\n dispatchApplyBatch(a, result.ops, optsRef.current.pasteLabel);\n // Use the just-created objects as the next cascade source. Re-snapshotting\n // via `adapter.snapshotSelection(newIds)` would read adapter state, but\n // React-state adapters haven't flushed yet — `itemsRef.current` still\n // points at the pre-insert array, so the snapshot would come back empty\n // and the next paste would no-op.\n clipboardRef.current = { items: result.created };\n optsRef.current.onPaste?.(result.newIds as NodeId[]);\n }, []);\n\n const isEmpty = useCallback(() => clipboardRef.current.items.length === 0, []);\n\n return { copy, paste, isEmpty };\n}\n\nfunction defaultFlavors(snapshot: ClipboardSnapshot, replacer?: Replacer): Record<string, string> {\n const text = buildWeaselClipboardText(snapshot.items, replacer);\n return { [WEASEL_CLIPBOARD_MIME]: text, 'text/plain': text };\n}\n\n/** MIME types the async Clipboard API accepts unprefixed. Every other type\n * (including our own custom MIME, and app-supplied flavors like\n * `image/svg+xml`) must carry Chromium's `web ` prefix or `ClipboardItem`'s\n * constructor throws. */\nconst WELL_KNOWN_CLIPBOARD_MIMES = new Set(['text/plain', 'text/html', 'image/png']);\n\n/** Degradation ladder: full map (every non-well-known MIME web-prefixed) →\n * well-known-only → give up with a dwarn.\n * @internal test seam — exported so unit tests can await the fire-and-forget\n * write directly; tests should still exercise this at least once through\n * the public `copy()` (see clipboardOps.test.tsx). */\nexport async function writeOsClipboard(flavors: Record<string, string>): Promise<void> {\n const entries = Object.entries(flavors);\n if (entries.length === 0) return;\n const cb = typeof navigator !== 'undefined' ? navigator.clipboard : undefined;\n if (!cb?.write || typeof ClipboardItem === 'undefined') return;\n const wireMime = (mime: string) => (WELL_KNOWN_CLIPBOARD_MIMES.has(mime) ? mime : `web ${mime}`);\n const toItem = (fs: [string, string][]) => new ClipboardItem(Object.fromEntries(\n fs.map(([mime, text]) => {\n const wire = wireMime(mime);\n return [wire, new Blob([text], { type: wire })];\n }),\n ));\n try {\n await cb.write([toItem(entries)]);\n } catch {\n const standard = entries.filter(([mime]) => WELL_KNOWN_CLIPBOARD_MIMES.has(mime));\n if (standard.length === 0) { dwarn('clipboard', 'OS write failed; no standard flavors to fall back to'); return; }\n try {\n await cb.write([toItem(standard)]);\n } catch (err) {\n dwarn('clipboard', `OS clipboard write failed twice — copy stays in-memory only: ${String(err)}`);\n }\n }\n}\n"]}
|
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* registerTexture — accepts an image source, assigns an opaque id, stores in
|
|
3
|
-
* a module-level registry. Actual GL upload happens lazily at draw time in
|
|
4
|
-
* drawShader() via GLTextureCache.upload (which is idempotent).
|
|
5
|
-
*
|
|
6
|
-
* Lifecycle: textures live for the renderer's lifetime. No unregister in v1.
|
|
7
|
-
*
|
|
8
|
-
* Convention §9: this registry stores image data only — no per-renderer state.
|
|
9
|
-
* Each WeaselRenderer's GLTextureCache does its own dedup via has(id).
|
|
10
|
-
*/
|
|
11
|
-
interface TextureHandle {
|
|
12
|
-
readonly id: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Register an image for use as a shader texture uniform.
|
|
16
|
-
*
|
|
17
|
-
* Returns a TextureHandle whose `id` can be passed as a ShaderUniform value.
|
|
18
|
-
* The handle is valid for the lifetime of the renderer it will be used with.
|
|
19
|
-
*
|
|
20
|
-
* @param image The image to register. HTMLImageElement must be fully loaded.
|
|
21
|
-
* @returns Opaque TextureHandle.
|
|
22
|
-
*/
|
|
23
|
-
declare function registerTexture(image: HTMLImageElement | ImageBitmap): TextureHandle;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* FillStyle and Stroke types — the unified shape for "what color or texture
|
|
27
|
-
* paints these pixels," modeled on SVG's paint-server concept.
|
|
28
|
-
*
|
|
29
|
-
* - `FillStyle` is a tagged union: solid color, pattern, or gradient. Used
|
|
30
|
-
* wherever a kit option previously took `fillStyle: string`.
|
|
31
|
-
* - `Stroke` pairs a `FillStyle` with structural stroke parameters (width, dash,
|
|
32
|
-
* line cap/join, alignment).
|
|
33
|
-
* - These types are consumed by the GL renderer's DrawCommand path fills
|
|
34
|
-
* and strokes.
|
|
35
|
-
*
|
|
36
|
-
* The 2D `applyPaint` / `applyStroke` / `renderFilledRegion` helpers that
|
|
37
|
-
* formerly lived alongside these types were deleted with the 2D backend in
|
|
38
|
-
* Step 10. `alignedStrokeRect` survives as a pure geometry helper used by
|
|
39
|
-
* path tessellation and the selection overlay.
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Color/texture strategy for fills (and, via `Stroke.paint`, strokes).
|
|
44
|
-
*
|
|
45
|
-
* `fill` is optional and defaults to `'solid'` — `{ color: '#abc' }` is
|
|
46
|
-
* equivalent to `{ fill: 'solid', color: '#abc' }`. Pattern paints must set
|
|
47
|
-
* `fill: 'pattern'` explicitly.
|
|
48
|
-
*
|
|
49
|
-
* The `'pattern'` variant's payload is either a `TilePatternSpec` — plain
|
|
50
|
-
* data naming one of the built-in tiles, which survives serialization — or a
|
|
51
|
-
* `TextureHandle` for a tile the consumer built itself via
|
|
52
|
-
* `createTilePattern()`. A handle is a session-scoped registry key, so a
|
|
53
|
-
* paint carrying one cannot be persisted or exported; prefer the spec.
|
|
54
|
-
*
|
|
55
|
-
* `units` on a pattern names the space the tile's origin and scale live in,
|
|
56
|
-
* not the space of any geometry (a pattern has none). Under `'bounds'` the
|
|
57
|
-
* tile anchors to the painted node's box, so the pattern travels with the
|
|
58
|
-
* node and a resize reveals more tiles rather than stretching them;
|
|
59
|
-
* `fillInPoseFrame` resolves that to a `'local'` paint with an explicit
|
|
60
|
-
* `origin` before the renderer sees it.
|
|
61
|
-
*/
|
|
62
|
-
type FillStyle = {
|
|
63
|
-
fill?: 'solid';
|
|
64
|
-
color: string;
|
|
65
|
-
opacity?: number;
|
|
66
|
-
} | {
|
|
67
|
-
fill: 'pattern';
|
|
68
|
-
pattern: TextureHandle | TilePatternSpec;
|
|
69
|
-
units?: GradientUnits;
|
|
70
|
-
origin?: {
|
|
71
|
-
x: number;
|
|
72
|
-
y: number;
|
|
73
|
-
};
|
|
74
|
-
opacity?: number;
|
|
75
|
-
} | {
|
|
76
|
-
fill: 'linear-gradient';
|
|
77
|
-
from: {
|
|
78
|
-
x: number;
|
|
79
|
-
y: number;
|
|
80
|
-
};
|
|
81
|
-
to: {
|
|
82
|
-
x: number;
|
|
83
|
-
y: number;
|
|
84
|
-
};
|
|
85
|
-
stops: GradStop[];
|
|
86
|
-
units?: GradientUnits;
|
|
87
|
-
opacity?: number;
|
|
88
|
-
} | {
|
|
89
|
-
fill: 'radial-gradient';
|
|
90
|
-
center: {
|
|
91
|
-
x: number;
|
|
92
|
-
y: number;
|
|
93
|
-
};
|
|
94
|
-
radius: number;
|
|
95
|
-
stops: GradStop[];
|
|
96
|
-
units?: GradientUnits;
|
|
97
|
-
opacity?: number;
|
|
98
|
-
} | {
|
|
99
|
-
fill: 'conic-gradient';
|
|
100
|
-
center: {
|
|
101
|
-
x: number;
|
|
102
|
-
y: number;
|
|
103
|
-
};
|
|
104
|
-
angle: number;
|
|
105
|
-
stops: GradStop[];
|
|
106
|
-
units?: GradientUnits;
|
|
107
|
-
opacity?: number;
|
|
108
|
-
};
|
|
109
|
-
/**
|
|
110
|
-
* Which coordinate space a gradient's geometry (`from`/`to`, `center`,
|
|
111
|
-
* `radius`) is expressed in. SVG's `gradientUnits`, plus an option for
|
|
112
|
-
* paints that are themselves viewport furniture.
|
|
113
|
-
*
|
|
114
|
-
* - `'bounds'`: fractions of the painted node's bounding box, `0..1` on each
|
|
115
|
-
* axis — SVG `objectBoundingBox`. Resolved by the node painter, before the
|
|
116
|
-
* renderer sees it, so the paint follows the node through moves, resizes
|
|
117
|
-
* and rotation. What a gradient on a scene node wants.
|
|
118
|
-
* - `'local'`: the coordinate space the geometry was handed to the renderer
|
|
119
|
-
* in — the enclosing group's frame. For draw commands a consumer builds
|
|
120
|
-
* itself, where "the coordinates I just wrote" is the useful frame.
|
|
121
|
-
* - `'world'`: scene coordinates. The paint stays put under pan and zoom
|
|
122
|
-
* while the geometry moves through it. SVG `userSpaceOnUse`. Requires the
|
|
123
|
-
* renderer to have been handed a view matrix; falls back to `'screen'`
|
|
124
|
-
* when it has not.
|
|
125
|
-
* - `'screen'`: CSS pixels of the drawing surface. For overlays and
|
|
126
|
-
* viewport-fixed washes that should not move with the content at all.
|
|
127
|
-
*
|
|
128
|
-
* Defaults to `'screen'`, which is the behavior every gradient had before
|
|
129
|
-
* this field existed.
|
|
130
|
-
*/
|
|
131
|
-
type GradientUnits = 'bounds' | 'local' | 'world' | 'screen';
|
|
132
|
-
/**
|
|
133
|
-
* A built-in tile, described as plain data. The serializable half of the
|
|
134
|
-
* pattern paint: `resolvePatternSpec()` turns one into a `TextureHandle`
|
|
135
|
-
* at paint time, memoized so identical specs share a texture.
|
|
136
|
-
*
|
|
137
|
-
* `size` is the tile's edge length, and doubles as its extent in paint
|
|
138
|
-
* space — a bigger `size` rasterizes a bigger tile rather than magnifying
|
|
139
|
-
* a small one, which is why there is no separate scale field.
|
|
140
|
-
*/
|
|
141
|
-
interface TilePatternSpec {
|
|
142
|
-
tile: 'hatch' | 'crosshatch' | 'dots' | 'chunks';
|
|
143
|
-
color: string;
|
|
144
|
-
/** `chunks` only — omit for a transparent tile background. */
|
|
145
|
-
bg?: string;
|
|
146
|
-
size?: number;
|
|
147
|
-
/** `hatch` / `crosshatch`. */
|
|
148
|
-
lineWidth?: number;
|
|
149
|
-
/** `dots`. */
|
|
150
|
-
radius?: number;
|
|
151
|
-
/** `chunks`. */
|
|
152
|
-
density?: number;
|
|
153
|
-
chunkSize?: number;
|
|
154
|
-
seed?: number;
|
|
155
|
-
}
|
|
156
|
-
/** A single color stop within a gradient. `offset` is in 0..1. */
|
|
157
|
-
interface GradStop {
|
|
158
|
-
offset: number;
|
|
159
|
-
color: string;
|
|
160
|
-
}
|
|
161
|
-
/** The gradient members of `FillStyle`, as one type. What a gradient editor
|
|
162
|
-
* edits, and what the gradient-specific helpers accept. */
|
|
163
|
-
type GradientFill = Extract<FillStyle, {
|
|
164
|
-
fill: 'linear-gradient' | 'radial-gradient' | 'conic-gradient';
|
|
165
|
-
}>;
|
|
166
|
-
/** `GradientFill['fill']` — the three gradient discriminants on their own. */
|
|
167
|
-
type GradientKind = GradientFill['fill'];
|
|
168
|
-
/**
|
|
169
|
-
* Where a stroke sits relative to the geometric edge it strokes.
|
|
170
|
-
*
|
|
171
|
-
* - `'center'` (default): canvas-native — half the stroke width sits inside
|
|
172
|
-
* the geometry, half outside.
|
|
173
|
-
* - `'inner'`: the entire stroke lies inside the geometry. The outer edge of
|
|
174
|
-
* the stroke coincides with the geometric edge.
|
|
175
|
-
* - `'outer'`: the entire stroke lies outside the geometry. The inner edge
|
|
176
|
-
* of the stroke coincides with the geometric edge.
|
|
177
|
-
*
|
|
178
|
-
* Mirrors the (proposed) SVG `stroke-alignment` property. Honoring `inner`
|
|
179
|
-
* or `outer` is the renderer's responsibility — for axis-aligned rects, the
|
|
180
|
-
* kit shifts coordinates by `width / 2`. For arbitrary paths, renderers
|
|
181
|
-
* typically use a stencil mask of the stroked path against the geometry.
|
|
182
|
-
*/
|
|
183
|
-
type StrokeAlign = 'center' | 'inner' | 'outer';
|
|
184
|
-
/** Stroke style: a FillStyle plus structural line parameters. */
|
|
185
|
-
interface Stroke {
|
|
186
|
-
paint: FillStyle;
|
|
187
|
-
width?: number;
|
|
188
|
-
/** Per `CanvasRenderingContext2D.setLineDash` — empty/omitted = solid. */
|
|
189
|
-
dash?: number[];
|
|
190
|
-
cap?: 'butt' | 'round' | 'square';
|
|
191
|
-
join?: 'miter' | 'round' | 'bevel';
|
|
192
|
-
/**
|
|
193
|
-
* Miter join fallback threshold. When the miter length exceeds
|
|
194
|
-
* `miterLimit * width / 2`, the join falls back to a bevel. Default 10
|
|
195
|
-
* (matching Canvas2D). SVG's default is 4; consumers that want SVG
|
|
196
|
-
* fidelity should set this explicitly when constructing strokes from
|
|
197
|
-
* SVG sources where the attribute was omitted.
|
|
198
|
-
*/
|
|
199
|
-
miterLimit?: number;
|
|
200
|
-
/** Where the stroke sits relative to the geometric edge. Default `'center'`. */
|
|
201
|
-
align?: StrokeAlign;
|
|
202
|
-
/**
|
|
203
|
-
* Per-anchor RGBA, flat (length = 4 × countPathAnchors(path)). Each
|
|
204
|
-
* value in 0..1. Arc-length interpolated across the tessellated ribbon
|
|
205
|
-
* between consecutive anchors. When set, `paint` is still required —
|
|
206
|
-
* its `opacity` (and color, as a placeholder) flow through the shader.
|
|
207
|
-
*/
|
|
208
|
-
vertexColors?: number[];
|
|
209
|
-
/**
|
|
210
|
-
* Per-anchor stroke width (length = `countPathAnchors(path)`). When set,
|
|
211
|
-
* the tessellator interpolates half-widths along each segment to produce
|
|
212
|
-
* a tapered ribbon. `width` is used as the fallback for any anchor whose
|
|
213
|
-
* entry is missing or non-finite. Pressure-driven pencil strokes use
|
|
214
|
-
* this; pair with `pressureToWidth` to derive widths from stylus input.
|
|
215
|
-
*
|
|
216
|
-
* Joins between adjacent segments whose widths differ by more than
|
|
217
|
-
* `varyingWidthJoinThreshold` (default 1.5×) are forced to bevel
|
|
218
|
-
* regardless of the `join` setting — miter math is unstable when widths
|
|
219
|
-
* vary across the corner; smooth round joins with mismatched widths
|
|
220
|
-
* are a future enhancement.
|
|
221
|
-
*/
|
|
222
|
-
vertexWidths?: number[];
|
|
223
|
-
/**
|
|
224
|
-
* Max width ratio (greater / lesser) at which a non-bevel join is
|
|
225
|
-
* preserved when `vertexWidths` causes adjacent segments to differ.
|
|
226
|
-
* Beyond this ratio the join falls back to bevel. Default 1.5. Ignored
|
|
227
|
-
* when `vertexWidths` is absent.
|
|
228
|
-
*/
|
|
229
|
-
varyingWidthJoinThreshold?: number;
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Inflate (positive) or deflate (negative) a rect to honor `align` when
|
|
233
|
-
* stroking it. Returns the rect to pass to a stroked-rect renderer. `width`
|
|
234
|
-
* is the stroke width (defaults to 1 to match canvas).
|
|
235
|
-
*
|
|
236
|
-
* Pure geometry helper — no rendering side effects. Used by path
|
|
237
|
-
* tessellation and the selection overlay to produce a rect whose
|
|
238
|
-
* center-aligned stroke visually coincides with the requested
|
|
239
|
-
* inner/outer-aligned stroke of the original rect.
|
|
240
|
-
*/
|
|
241
|
-
declare function alignedStrokeRect(rect: {
|
|
242
|
-
x: number;
|
|
243
|
-
y: number;
|
|
244
|
-
width: number;
|
|
245
|
-
height: number;
|
|
246
|
-
}, align: StrokeAlign, width?: number): {
|
|
247
|
-
x: number;
|
|
248
|
-
y: number;
|
|
249
|
-
width: number;
|
|
250
|
-
height: number;
|
|
251
|
-
};
|
|
252
|
-
/** Region a fill is clipped to. */
|
|
253
|
-
interface Region {
|
|
254
|
-
x: number;
|
|
255
|
-
y: number;
|
|
256
|
-
w: number;
|
|
257
|
-
h: number;
|
|
258
|
-
shape: 'rectangle' | 'circle';
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
export { type FillStyle as F, type GradStop as G, type Region as R, type Stroke as S, type TilePatternSpec as T, type TextureHandle as a, type GradientKind as b, type GradientFill as c, type GradientUnits as d, type StrokeAlign as e, alignedStrokeRect as f, registerTexture as r };
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { M as Mat3 } from './DrawCommand-BbPrSTra.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* GL texture upload cache for ImageBitmap objects.
|
|
5
|
-
*
|
|
6
|
-
* Key: ImageBitmap (or pattern source object) identity (WeakMap) — lets GC
|
|
7
|
-
* reclaim unreferenced bitmaps. The GL textures are NOT freed when the source
|
|
8
|
-
* is gc'd; deferred to v2.
|
|
9
|
-
*
|
|
10
|
-
* Wrapping is set once at upload time per the `repetition` parameter:
|
|
11
|
-
* - undefined / 'no-repeat' → CLAMP_TO_EDGE
|
|
12
|
-
* - 'repeat' → REPEAT (both axes)
|
|
13
|
-
* - 'repeat-x' → REPEAT on S, CLAMP on T
|
|
14
|
-
* - 'repeat-y' → CLAMP on S, REPEAT on T
|
|
15
|
-
*
|
|
16
|
-
* Convention §2: texels stored straight; shader premultiplies.
|
|
17
|
-
*/
|
|
18
|
-
type PatternRepetition = 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat';
|
|
19
|
-
/** MIN_FILTER strategy for uploaded textures. */
|
|
20
|
-
type ImageMinification = 'linear' | 'mipmap';
|
|
21
|
-
type TexSource = ImageBitmap | ImageData | HTMLCanvasElement | HTMLImageElement;
|
|
22
|
-
declare class GLImageCache {
|
|
23
|
-
private readonly gl;
|
|
24
|
-
private readonly minification;
|
|
25
|
-
private readonly map;
|
|
26
|
-
/** `minification` selects the MIN_FILTER strategy for uploaded textures.
|
|
27
|
-
* `'linear'` (default) is the screen path's existing behavior. `'mipmap'`
|
|
28
|
-
* generates mipmaps and filters LINEAR_MIPMAP_LINEAR — required for
|
|
29
|
-
* quality minification when a large source bitmap is drawn small (the
|
|
30
|
-
* headless print/export path); bilinear-only minification undersamples
|
|
31
|
-
* and produces moiré. */
|
|
32
|
-
constructor(gl: WebGL2RenderingContext, minification?: ImageMinification);
|
|
33
|
-
upload(key: object, source: TexSource, repetition?: PatternRepetition): WebGLTexture;
|
|
34
|
-
bind(key: object, unit: number): void;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* View → Mat3 helper for layer `draw` implementations on world-space layers.
|
|
39
|
-
*
|
|
40
|
-
* The kit's main package ships a `View` type at
|
|
41
|
-
* `src/core/viewport/view.ts`; we re-declare a structurally compatible
|
|
42
|
-
* shape here to avoid a runtime cross-package import. Exported as
|
|
43
|
-
* `ViewLike` from the package barrel.
|
|
44
|
-
*/
|
|
45
|
-
|
|
46
|
-
/** A weasel View — `{x, y, scale: {x, y}}`. Local type to avoid a cross-package import. */
|
|
47
|
-
interface View {
|
|
48
|
-
x: number;
|
|
49
|
-
y: number;
|
|
50
|
-
scale: {
|
|
51
|
-
x: number;
|
|
52
|
-
y: number;
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Build the world→screen transform matrix for a `View`.
|
|
57
|
-
* Use as the `transform` field of a `kind: 'group'` DrawCommand to wrap
|
|
58
|
-
* world-space content emitted from a layer `draw` implementation.
|
|
59
|
-
*
|
|
60
|
-
* Mapping: `screen = (world − {view.x, view.y}) × {view.scale.x, view.scale.y}`.
|
|
61
|
-
*
|
|
62
|
-
* Column-major layout (matches `mat3.identity()`):
|
|
63
|
-
* `[scale.x, 0, 0, 0, scale.y, 0, -view.x*scale.x, -view.y*scale.y, 1]`.
|
|
64
|
-
*/
|
|
65
|
-
declare function viewToMat3(view: View): Mat3;
|
|
66
|
-
|
|
67
|
-
export { GLImageCache as G, type ImageMinification as I, type View as V, viewToMat3 as v };
|