@weasel-js/core 1.7.1 → 1.7.3
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 +47 -0
- package/README.md +7 -0
- package/dist/{autoPoseDescriptor-BT_vp9FO.d.ts → autoPoseDescriptor-vCdt55xm.d.ts} +1 -1
- package/dist/{builtins-BSUfH8nU.d.ts → builtins-C-gRyVRx.d.ts} +7 -3
- package/dist/canvas/CursorCoordsHud.js +56 -29
- package/dist/canvas/CursorCoordsHud.js.map +1 -1
- package/dist/canvas/hud.module.js +3 -3
- package/dist/canvas/hud.module.js.map +1 -1
- package/dist/clipboard.d.ts +1 -1
- package/dist/clone.d.ts +2 -2
- package/dist/core/geometry/poseDescriptor.js +10 -15
- package/dist/core/geometry/poseDescriptor.js.map +1 -1
- package/dist/{cornerHandles-CDcZOV8h.d.ts → cornerHandles-BCrDp_mH.d.ts} +1 -1
- package/dist/features/paths/poseDescriptor.js +6 -11
- package/dist/features/paths/poseDescriptor.js.map +1 -1
- package/dist/index.d.ts +22 -17
- package/dist/interactions/actions/defaults/clone.js +64 -53
- package/dist/interactions/actions/defaults/clone.js.map +1 -1
- package/dist/interactions/actions/defaults/move.js +426 -322
- package/dist/interactions/actions/defaults/move.js.map +1 -1
- package/dist/interactions/actions/defaults/resize.js +75 -72
- package/dist/interactions/actions/defaults/resize.js.map +1 -1
- package/dist/interactions/actions/defaults/rotate.js +88 -85
- package/dist/interactions/actions/defaults/rotate.js.map +1 -1
- package/dist/interactions/actions/planeInput.js +82 -69
- package/dist/interactions/actions/planeInput.js.map +1 -1
- package/dist/interactions/actions/resize/autoPoseDescriptor.js +0 -1
- package/dist/interactions/actions/resize/autoPoseDescriptor.js.map +1 -1
- package/dist/{math-CUMxmZzn.d.ts → math-Drrw4ewZ.d.ts} +2 -2
- package/dist/math.d.ts +3 -3
- package/dist/move.d.ts +4 -4
- package/dist/{originProjection-BSn4xiEy.d.ts → originProjection-DEklpDc_.d.ts} +1 -1
- package/dist/{poseDescriptor-CjSXMf8X.d.ts → poseDescriptor-D-OH-tu5.d.ts} +0 -4
- package/dist/renderer.d.ts +4 -4
- package/dist/resize.d.ts +5 -5
- package/dist/style.css +2 -0
- package/dist/{types-CA54-mAZ.d.ts → types-A37hYkeR.d.ts} +4 -2
- package/dist/{types-DSjd6W3n.d.ts → types-B_9g6hMM.d.ts} +1 -1
- package/dist/version.js +1 -1
- package/package.json +16 -14
- package/dist/index.css +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planeInput.js","names":["layerOfNode","id","deps","asNodeId","selectionLayer","selection","affordance","layer","insertLayer","editingLayer","inPlane","inner","action","declared","requires","plane","livePlane","layerOf","params","wx","\"worldX\"","wy","\"worldY\"","at","toPlane","ctx","opts","planeHandle","scene","bag","viewApi","parallax","l","IDENTITY","map","p","planeMap","planeView","camera","deriveParallaxView","override","name","nodeAtPoint","fromPlane","exclude","snap","start0","pressedAt","trail","trailCarrier","m","out","c","start","current","aff","src","lastMap","same","points","i","handle","reason","ov","overlayFromPlane","pt","rectFromPlane","insertExtrasFromPlane","extras","e","r","v","\"a\"","\"b\"","\"center\"","\"radius\"","\"outerRadius\"","\"samples\"","s"],"sources":["../../../src/interactions/actions/planeInput.ts"],"sourcesContent":["/**\n * Editing a node on a parallax plane.\n *\n * The dispatcher hands every action the camera's world. A node on a layer\n * carrying `parallax` stores its pose in its plane's world, which the camera's\n * reaches through a `PlaneMap` that changes with the camera. An editing action\n * pairs the pointer with the pose it edits, so the two have to be in one world.\n *\n * `inPlane` is that one place: it wraps an action so its input is carried into\n * the plane of the layer it edits before the action reads it — pointer, drag,\n * trail, affordance pivot, and the camera it converts screen pixels through —\n * and so the chrome it publishes back comes out in the camera's world. A dep\n * that answers in world points (`nodeAtPoint`, `snap`) is the surface's, so it\n * keeps speaking the camera's world and the seam converts at its boundary.\n * The action sees the plane only as `view.plane()`, which it hands its snap\n * behaviors so they can bring the camera's guides and grid into the plane.\n *\n * The map is read afresh on every call: a camera panning under a held drag, or\n * a plane whose factors are being animated, moves the node with the pointer.\n */\nimport type {\n Action, ActionDeps, AffordanceHit, BindingOpts, DragSample, InvocationCtx, OngoingHandle,\n OngoingOverlay,\n} from '@weasel-js/routing';\nimport type { Scene } from 'core/scene/types';\nimport { asNodeId } from 'core/scene/types';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport {\n deriveParallaxView, fromPlane, planeMap, rectFromPlane, toPlane,\n type ParallaxOpts, type PlaneMap,\n} from 'core/viewport/parallax';\nimport type { View } from 'core/viewport/view';\nimport type { EditAnchorsDep, InsertDep, NodeAtPointDep, SnapDep, ViewApi } from './depSchema';\n\ntype Point = { x: number; y: number };\n\n/** Which scene layer an invocation edits, read once as it starts, from its\n * deps and — for a drag — the affordance it grabbed. `undefined` means none:\n * the action runs in the camera's world. */\nexport type EditedLayerOf = (deps: ActionDeps, affordance?: AffordanceHit) => string | undefined;\n\nconst layerOfNode = (deps: ActionDeps, id: string | null | undefined): string | undefined =>\n (id ? (deps.scene as Scene<unknown, string, unknown> | undefined)?.get(asNodeId(id))?.layer : undefined);\n\n/** The layer of the node a selection edit acts on: the affordance's target\n * when the drag grabbed one, the first selected node otherwise. A selection\n * spanning planes is edited in that one node's plane. */\nexport const selectionLayer: EditedLayerOf = (deps, affordance) => {\n const selection = deps.selection as SelectionApi | undefined;\n for (const id of [...(affordance?.targetIds ?? []), ...(selection?.get() ?? [])]) {\n const layer = layerOfNode(deps, id);\n if (layer !== undefined) return layer;\n }\n return undefined;\n};\n\n/** The layer the `insert` dep will put a new node on. */\nexport const insertLayer: EditedLayerOf = (deps) =>\n (deps.insert as InsertDep | undefined)?.layer?.();\n\n/** The layer of the path in anchor-edit mode. */\nexport const editingLayer: EditedLayerOf = (deps) =>\n layerOfNode(deps, (deps.editAnchors as EditAnchorsDep | undefined)?.editingId);\n\n/** `action`, with its input carried into the plane of the layer `layerOf`\n * names. An action on a layer with no `parallax`, or invoked with no scene or\n * view to read the plane from, runs exactly as it would unwrapped.\n *\n * An ongoing action's drag is carried as a whole. An immediate one's world\n * point is `params.worldX` / `params.worldY`, the dispatcher's convention for\n * a click; it is carried when present. */\nexport function inPlane<A extends Action>(action: A, layerOf: EditedLayerOf): A {\n const inner = action.invoker;\n if (!inner) return action;\n const declared = action.requires ?? [];\n const requires = [...new Set([...declared, 'scene', 'selection', 'view'])];\n if (inner.timing === 'immediate') {\n return {\n ...action,\n requires,\n invoker: {\n timing: 'immediate',\n run(deps: ActionDeps, params?: Record<string, unknown>): void {\n const plane = livePlane(deps, layerOf(deps), declared, null);\n if (plane === null) return inner.run(deps, params);\n const wx = params?.['worldX'];\n const wy = params?.['worldY'];\n const at = typeof wx === 'number' && typeof wy === 'number'\n ? toPlane(plane.map(), { x: wx, y: wy })\n : null;\n inner.run(plane.deps, at ? { ...params, worldX: at.x, worldY: at.y } : params);\n },\n },\n } as A;\n }\n return {\n ...action,\n requires,\n invoker: {\n timing: 'ongoing',\n start(ctx: InvocationCtx, opts?: BindingOpts): OngoingHandle {\n const plane = livePlane(\n ctx.deps, layerOf(ctx.deps, ctx.drag?.affordance), declared, ctx.drag?.start ?? null,\n );\n if (plane === null) return inner.start(ctx, opts);\n return planeHandle(inner.start(plane.carry(ctx), opts), plane);\n },\n },\n } as A;\n}\n\ninterface LivePlane {\n map(): PlaneMap;\n /** The invocation's deps, speaking the plane's world. */\n deps: ActionDeps;\n /** `ctx` in the plane's world. */\n carry(ctx: InvocationCtx): InvocationCtx;\n}\n\nfunction livePlane(\n bag: ActionDeps,\n layer: string | undefined,\n /** What the wrapped action declared. The dispatcher's dev deps bag throws\n * on any other read, so the seam converts only the deps it can see. */\n declared: readonly string[],\n /** The drag's press point in the camera's world, when there is a drag. */\n pressedAt: Point | null,\n): LivePlane | null {\n const scene = bag.scene as Scene<unknown, string, unknown> | undefined;\n const viewApi = bag.view as ViewApi | undefined;\n if (layer === undefined || !scene || !viewApi) return null;\n const parallax = (): ParallaxOpts | undefined => scene.layers.find((l) => l.id === layer)?.parallax;\n if (parallax() === undefined) return null;\n\n const IDENTITY: PlaneMap = { scale: { x: 1, y: 1 }, offset: { x: 0, y: 0 } };\n const map = (): PlaneMap => {\n const p = parallax();\n return p ? planeMap(viewApi.get(), p) : IDENTITY;\n };\n\n // A screen-pixel tolerance, and anything else an action reads off the\n // camera, has to be read at the plane's scale.\n const planeView = Object.defineProperties(Object.create(viewApi), {\n get: {\n value: (): View => {\n const p = parallax();\n const camera = viewApi.get();\n return p ? deriveParallaxView(camera, p) : camera;\n },\n },\n plane: { value: map },\n }) as ViewApi;\n\n // Over the dispatcher's bag rather than a copy of it, so every other read\n // still goes through whatever checks the bag makes.\n const deps = Object.create(bag) as typeof bag;\n const override = (name: string, value: unknown) =>\n Object.defineProperty(deps, name, { value, enumerable: true });\n override('view', planeView);\n const nodeAtPoint = declared.includes('nodeAtPoint')\n ? bag.nodeAtPoint as NodeAtPointDep | undefined\n : undefined;\n if (nodeAtPoint) {\n override('nodeAtPoint', ((p, exclude) => nodeAtPoint(fromPlane(map(), p), exclude)) as NodeAtPointDep);\n }\n const snap = declared.includes('snap') ? bag.snap as SnapDep | undefined : undefined;\n if (snap) {\n override('snap', { point: (p: Point) => toPlane(map(), snap.point(fromPlane(map(), p))) } as SnapDep);\n }\n\n // The drag's origin, fixed in the plane at the moment it was pressed: where\n // the pointer went down on the node is where the node was grabbed, whatever\n // the camera does after.\n const start0 = pressedAt ? toPlane(map(), pressedAt) : null;\n const trail = trailCarrier();\n\n return {\n map,\n deps,\n carry(c) {\n const m = map();\n const out: InvocationCtx = { ...c, world: toPlane(m, c.world) };\n if (c.drag) {\n const start = start0 ?? toPlane(m, c.drag.start);\n const current = toPlane(m, c.drag.current);\n const aff = c.drag.affordance;\n out.drag = {\n ...c.drag,\n start,\n current,\n delta: { x: current.x - start.x, y: current.y - start.y },\n ...(c.drag.points ? { points: trail(c.drag.points, m) } : {}),\n ...(aff?.fixedPoint ? { affordance: { ...aff, fixedPoint: toPlane(m, aff.fixedPoint) } } : {}),\n };\n }\n // The dispatcher hands `onMove` no deps; only `start` has any to carry.\n if (c.deps) out.deps = deps;\n return out;\n },\n };\n}\n\n/** The drag trail in the plane. The dispatcher grows its trail in place, so\n * only the samples added since the last call are mapped — unless the map\n * moved, when every sample is. */\nfunction trailCarrier(): (points: DragSample[], m: PlaneMap) => DragSample[] {\n let src: DragSample[] | null = null;\n let lastMap: PlaneMap | null = null;\n let out: DragSample[] = [];\n return (points, m) => {\n const same = lastMap !== null\n && lastMap.scale.x === m.scale.x && lastMap.scale.y === m.scale.y\n && lastMap.offset.x === m.offset.x && lastMap.offset.y === m.offset.y;\n if (points !== src || !same || points.length < out.length) {\n src = points;\n out = [];\n }\n lastMap = m;\n for (let i = out.length; i < points.length; i++) {\n out.push({ ...points[i], ...toPlane(m, points[i]) });\n }\n // A copy, so a snapshot taken on `onEnd` is not the live accumulator.\n return out.slice();\n };\n}\n\nfunction planeHandle(handle: OngoingHandle, plane: LivePlane): OngoingHandle {\n const out: OngoingHandle = { ...handle };\n if (handle.onMove) out.onMove = (c) => handle.onMove!(plane.carry(c));\n if (handle.onEnd) out.onEnd = (c, reason) => handle.onEnd!(plane.carry(c), reason);\n if (handle.overlay) {\n out.overlay = () => {\n const ov = handle.overlay!();\n return ov ? overlayFromPlane(ov, plane.map()) : ov;\n };\n }\n return out;\n}\n\n/** An overlay drawn in the plane, in the camera's world: what every painter\n * reads an overlay as. */\nfunction overlayFromPlane(ov: OngoingOverlay, m: PlaneMap): OngoingOverlay {\n const pt = (p: Point) => fromPlane(m, p);\n switch (ov.kind) {\n case 'marquee':\n return { ...ov, start: pt(ov.start), current: pt(ov.current) };\n case 'lasso':\n return { ...ov, vertices: ov.vertices.map(pt), current: pt(ov.current) };\n case 'polyline':\n return { ...ov, points: ov.points.map(pt) };\n case 'insertPreview':\n return {\n ...ov,\n bounds: rectFromPlane(m, ov.bounds),\n extras: insertExtrasFromPlane(ov.extras, m),\n ...(ov.anchorPoint ? { anchorPoint: pt(ov.anchorPoint) } : {}),\n };\n }\n}\n\n/** The geometry the kit's insert kinds carry in `extras`, in the camera's\n * world. A consumer kind's extras are opaque, and pass through. */\nfunction insertExtrasFromPlane(extras: unknown, m: PlaneMap): unknown {\n if (extras === null || typeof extras !== 'object') return extras;\n const e = extras as Record<string, unknown>;\n const pt = (p: unknown) => fromPlane(m, p as Point);\n // Radial kinds inscribe in a square, so one scale carries a radius.\n const r = (v: unknown) => (typeof v === 'number' ? v / ((m.scale.x + m.scale.y) / 2) : v);\n const out: Record<string, unknown> = { ...e };\n if (e['a'] && e['b']) { out['a'] = pt(e['a']); out['b'] = pt(e['b']); }\n if (e['center']) out['center'] = pt(e['center']);\n if ('radius' in e) out['radius'] = r(e['radius']);\n if ('outerRadius' in e) out['outerRadius'] = r(e['outerRadius']);\n if (Array.isArray(e['samples'])) {\n out['samples'] = (e['samples'] as DragSample[]).map((s) => ({ ...s, ...pt(s) }));\n }\n return out;\n}\n"],"mappings":";;;AAyCA,IAAMA,KAAe,GAAkB,MACpCC,IAAMC,EAAK,OAAuD,IAAIC,EAASF,CAAE,CAAC,CAAC,EAAE,QAAQ,KAAA,GAKnFG,KAAiC,GAAM,MAAe;CACjE,IAAMC,IAAYH,EAAK;CACvB,KAAK,IAAMD,KAAM,CAAC,GAAIK,GAAY,aAAa,CAAC,GAAI,GAAID,GAAW,IAAI,KAAK,CAAC,CAAE,GAAG;EAChF,IAAME,IAAQP,EAAYE,GAAMD,CAAE;EAClC,IAAIM,MAAU,KAAA,GAAW,OAAOA;CAClC;AAEF,GAGaC,KAA8B,MACxCN,EAAK,QAAkC,QAAQ,GAGrCO,KAA+B,MAC1CT,EAAYE,GAAOA,EAAK,aAA4C,SAAS;AAS/E,SAAgBQ,EAA0B,GAAW,GAA2B;CAC9E,IAAMC,IAAQC,EAAO;CACrB,IAAI,CAACD,GAAO,OAAOC;CACnB,IAAMC,IAAWD,EAAO,YAAY,CAAC,GAC/BE,IAAW,CAAC,mBAAG,IAAI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AAEG,CAAI,GAAG,EAAIC,IAAOR,EAAGI,EAAEI,CAAI,IAC/DJ,EAAEK,WAAW,EAAIA,SAAYT,EAAGI,EAAEK,MAAS,IAC3C,YAAYL,MAAG,EAAIM,SAAYL,EAAED,EAAEM,MAAS,IAC5C,iBAAiBN,MAAG,EAAIO,cAAiBN,EAAED,EAAEO,WAAc,IAC3D,MAAM,QAAQP,EAAEQ,OAAU,MAC5B,EAAIA,UAAcR,EAAEQ,QAA4B,KAAK,OAAO;EAAE,GAAGC;EAAG,GAAGb,EAAGa,CAAC;CAAE,EAAE,IAE1E3B;AACT"}
|
|
1
|
+
{"version":3,"file":"planeInput.js","names":["layerOfNode","id","deps","asNodeId","selectionLayer","selection","affordance","layer","insertLayer","editingLayer","planeOf","view","invertPlane","m","planeToPlane","carryPose","pose","b","d","rectToPlane","inPlane","inner","action","declared","requires","plane","livePlane","layerOf","params","wx","\"worldX\"","wy","\"worldY\"","at","toPlane","ctx","opts","planeHandle","scene","bag","viewApi","l","parallaxOf","parallax","IDENTITY","map","p","planeMap","planeView","camera","deriveParallaxView","edited","own","override","name","nodeAtPoint","fromPlane","exclude","snap","start0","pressedAt","trail","trailCarrier","out","c","start","current","aff","src","lastMap","same","points","i","handle","reason","ov","overlayFromPlane","pt","rectFromPlane","insertExtrasFromPlane","extras","e","r","v","\"a\"","\"b\"","\"center\"","\"radius\"","\"outerRadius\"","\"samples\"","s"],"sources":["../../../src/interactions/actions/planeInput.ts"],"sourcesContent":["/**\n * Editing a node on a parallax plane.\n *\n * The dispatcher hands every action the camera's world. A node on a layer\n * carrying `parallax` stores its pose in its plane's world, which the camera's\n * reaches through a `PlaneMap` that changes with the camera. An editing action\n * pairs the pointer with the pose it edits, so the two have to be in one world.\n *\n * `inPlane` is that one place: it wraps an action so its input is carried into\n * the plane of the layer it edits before the action reads it — pointer, drag,\n * trail, affordance pivot, and the camera it converts screen pixels through —\n * and so the chrome it publishes back comes out in the camera's world. A dep\n * that answers in world points (`nodeAtPoint`, `snap`) is the surface's, so it\n * keeps speaking the camera's world and the seam converts at its boundary.\n * The action sees the plane only as `view.plane()`, which it hands its snap\n * behaviors so they can bring the camera's guides and grid into the plane.\n *\n * A selection can span planes. The edit is measured in one of them, and a\n * node on another is carried into it as the gesture starts\n * (`planeOf` at press, inverted) and back out through `planeOf` as it is now,\n * so each node ends where it was drawn relative to the pointer.\n *\n * The map is read afresh on every call: a camera panning under a held drag, or\n * a plane whose factors are being animated, moves the node with the pointer.\n */\nimport type {\n Action, ActionDeps, AffordanceHit, BindingOpts, DragSample, InvocationCtx, OngoingHandle,\n OngoingOverlay,\n} from '@weasel-js/routing';\nimport type { Scene } from 'core/scene/types';\nimport { asNodeId } from 'core/scene/types';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport {\n deriveParallaxView, fromPlane, planeMap, planeToPlane, rectFromPlane, rectToPlane, toPlane,\n type ParallaxOpts, type PlaneMap,\n} from 'core/viewport/parallax';\nimport type { View } from 'core/viewport/view';\nimport type { PoseDescriptor } from 'core/geometry/poseDescriptor';\nimport type { EditAnchorsDep, InsertDep, NodeAtPointDep, SnapDep, ViewApi } from './depSchema';\n\ntype Point = { x: number; y: number };\n\n/** Which scene layer an invocation edits, read once as it starts, from its\n * deps and — for a drag — the affordance it grabbed. `undefined` means none:\n * the action runs in the camera's world. */\nexport type EditedLayerOf = (deps: ActionDeps, affordance?: AffordanceHit) => string | undefined;\n\nconst layerOfNode = (deps: ActionDeps, id: string | null | undefined): string | undefined =>\n (id ? (deps.scene as Scene<unknown, string, unknown> | undefined)?.get(asNodeId(id))?.layer : undefined);\n\n/** The layer of the node a selection edit acts on: the affordance's target\n * when the drag grabbed one, the first selected node otherwise. A selection\n * spanning planes is edited in that one node's plane. */\nexport const selectionLayer: EditedLayerOf = (deps, affordance) => {\n const selection = deps.selection as SelectionApi | undefined;\n for (const id of [...(affordance?.targetIds ?? []), ...(selection?.get() ?? [])]) {\n const layer = layerOfNode(deps, id);\n if (layer !== undefined) return layer;\n }\n return undefined;\n};\n\n/** The layer the `insert` dep will put a new node on. */\nexport const insertLayer: EditedLayerOf = (deps) =>\n (deps.insert as InsertDep | undefined)?.layer?.();\n\n/** The layer of the path in anchor-edit mode. */\nexport const editingLayer: EditedLayerOf = (deps) =>\n layerOfNode(deps, (deps.editAnchors as EditAnchorsDep | undefined)?.editingId);\n\n/** How the world an invocation edits in maps into the world `layer`'s nodes\n * are stored in, read now. Null when they are the same world. */\nexport function planeOf(view: unknown, layer: string): PlaneMap | null {\n return (view as ViewApi | undefined)?.planeOf?.(layer) ?? null;\n}\n\n/** `m` run backwards; null stays null. */\nexport function invertPlane(m: PlaneMap | null): PlaneMap | null {\n return m && planeToPlane(m, null);\n}\n\n/** `pose` carried through `m`. The map is axis-aligned, so remapping the\n * pose's bounds carries it exactly when the map scales both axes alike. */\nexport function carryPose<P>(d: PoseDescriptor<P>, pose: P, m: PlaneMap | null): P {\n if (m === null) return pose;\n const b = d.getBounds(pose);\n return d.remapBounds(pose, b, rectToPlane(m, b));\n}\n\n/** `action`, with its input carried into the plane of the layer `layerOf`\n * names. An action in a scene with no `parallax` layer, or invoked with no\n * scene or view to read a plane from, runs exactly as it would unwrapped.\n *\n * An ongoing action's drag is carried as a whole. An immediate one's world\n * point is `params.worldX` / `params.worldY`, the dispatcher's convention for\n * a click; it is carried when present. */\nexport function inPlane<A extends Action>(action: A, layerOf: EditedLayerOf): A {\n const inner = action.invoker;\n if (!inner) return action;\n const declared = action.requires ?? [];\n const requires = [...new Set([...declared, 'scene', 'selection', 'view'])];\n if (inner.timing === 'immediate') {\n return {\n ...action,\n requires,\n invoker: {\n timing: 'immediate',\n run(deps: ActionDeps, params?: Record<string, unknown>): void {\n const plane = livePlane(deps, layerOf(deps), declared, null);\n if (plane === null) return inner.run(deps, params);\n const wx = params?.['worldX'];\n const wy = params?.['worldY'];\n const at = typeof wx === 'number' && typeof wy === 'number'\n ? toPlane(plane.map(), { x: wx, y: wy })\n : null;\n inner.run(plane.deps, at ? { ...params, worldX: at.x, worldY: at.y } : params);\n },\n },\n } as A;\n }\n return {\n ...action,\n requires,\n invoker: {\n timing: 'ongoing',\n start(ctx: InvocationCtx, opts?: BindingOpts): OngoingHandle {\n const plane = livePlane(\n ctx.deps, layerOf(ctx.deps, ctx.drag?.affordance), declared, ctx.drag?.start ?? null,\n );\n if (plane === null) return inner.start(ctx, opts);\n return planeHandle(inner.start(plane.carry(ctx), opts), plane);\n },\n },\n } as A;\n}\n\ninterface LivePlane {\n map(): PlaneMap;\n /** The invocation's deps, speaking the plane's world. */\n deps: ActionDeps;\n /** `ctx` in the plane's world. */\n carry(ctx: InvocationCtx): InvocationCtx;\n}\n\nfunction livePlane(\n bag: ActionDeps,\n layer: string | undefined,\n /** What the wrapped action declared. The dispatcher's dev deps bag throws\n * on any other read, so the seam converts only the deps it can see. */\n declared: readonly string[],\n /** The drag's press point in the camera's world, when there is a drag. */\n pressedAt: Point | null,\n): LivePlane | null {\n const scene = bag.scene as Scene<unknown, string, unknown> | undefined;\n const viewApi = bag.view as ViewApi | undefined;\n if (layer === undefined || !scene || !viewApi) return null;\n if (!scene.layers.some((l) => l.parallax !== undefined)) return null;\n const parallaxOf = (id: string): ParallaxOpts | undefined => scene.layers.find((l) => l.id === id)?.parallax;\n const parallax = (): ParallaxOpts | undefined => parallaxOf(layer);\n\n const IDENTITY: PlaneMap = { scale: { x: 1, y: 1 }, offset: { x: 0, y: 0 } };\n const map = (): PlaneMap => {\n const p = parallax();\n return p ? planeMap(viewApi.get(), p) : IDENTITY;\n };\n\n // A screen-pixel tolerance, and anything else an action reads off the\n // camera, has to be read at the plane's scale.\n const planeView = Object.defineProperties(Object.create(viewApi), {\n get: {\n value: (): View => {\n const p = parallax();\n const camera = viewApi.get();\n return p ? deriveParallaxView(camera, p) : camera;\n },\n },\n plane: { value: map },\n planeOf: {\n value: (id: string): PlaneMap | null => {\n const edited = parallax();\n const own = parallaxOf(id);\n const camera = viewApi.get();\n return planeToPlane(edited ? planeMap(camera, edited) : null, own ? planeMap(camera, own) : null);\n },\n },\n }) as ViewApi;\n\n // Over the dispatcher's bag rather than a copy of it, so every other read\n // still goes through whatever checks the bag makes.\n const deps = Object.create(bag) as typeof bag;\n const override = (name: string, value: unknown) =>\n Object.defineProperty(deps, name, { value, enumerable: true });\n override('view', planeView);\n const nodeAtPoint = declared.includes('nodeAtPoint')\n ? bag.nodeAtPoint as NodeAtPointDep | undefined\n : undefined;\n if (nodeAtPoint) {\n override('nodeAtPoint', ((p, exclude) => nodeAtPoint(fromPlane(map(), p), exclude)) as NodeAtPointDep);\n }\n const snap = declared.includes('snap') ? bag.snap as SnapDep | undefined : undefined;\n if (snap) {\n override('snap', { point: (p: Point) => toPlane(map(), snap.point(fromPlane(map(), p))) } as SnapDep);\n }\n\n // The drag's origin, fixed in the plane at the moment it was pressed: where\n // the pointer went down on the node is where the node was grabbed, whatever\n // the camera does after.\n const start0 = pressedAt ? toPlane(map(), pressedAt) : null;\n const trail = trailCarrier();\n\n return {\n map,\n deps,\n carry(c) {\n const m = map();\n const out: InvocationCtx = { ...c, world: toPlane(m, c.world) };\n if (c.drag) {\n const start = start0 ?? toPlane(m, c.drag.start);\n const current = toPlane(m, c.drag.current);\n const aff = c.drag.affordance;\n out.drag = {\n ...c.drag,\n start,\n current,\n delta: { x: current.x - start.x, y: current.y - start.y },\n ...(c.drag.points ? { points: trail(c.drag.points, m) } : {}),\n ...(aff?.fixedPoint ? { affordance: { ...aff, fixedPoint: toPlane(m, aff.fixedPoint) } } : {}),\n };\n }\n // The dispatcher hands `onMove` no deps; only `start` has any to carry.\n if (c.deps) out.deps = deps;\n return out;\n },\n };\n}\n\n/** The drag trail in the plane. The dispatcher grows its trail in place, so\n * only the samples added since the last call are mapped — unless the map\n * moved, when every sample is. */\nfunction trailCarrier(): (points: DragSample[], m: PlaneMap) => DragSample[] {\n let src: DragSample[] | null = null;\n let lastMap: PlaneMap | null = null;\n let out: DragSample[] = [];\n return (points, m) => {\n const same = lastMap !== null\n && lastMap.scale.x === m.scale.x && lastMap.scale.y === m.scale.y\n && lastMap.offset.x === m.offset.x && lastMap.offset.y === m.offset.y;\n if (points !== src || !same || points.length < out.length) {\n src = points;\n out = [];\n }\n lastMap = m;\n for (let i = out.length; i < points.length; i++) {\n out.push({ ...points[i], ...toPlane(m, points[i]) });\n }\n // A copy, so a snapshot taken on `onEnd` is not the live accumulator.\n return out.slice();\n };\n}\n\nfunction planeHandle(handle: OngoingHandle, plane: LivePlane): OngoingHandle {\n const out: OngoingHandle = { ...handle };\n if (handle.onMove) out.onMove = (c) => handle.onMove!(plane.carry(c));\n if (handle.onEnd) out.onEnd = (c, reason) => handle.onEnd!(plane.carry(c), reason);\n if (handle.overlay) {\n out.overlay = () => {\n const ov = handle.overlay!();\n return ov ? overlayFromPlane(ov, plane.map()) : ov;\n };\n }\n return out;\n}\n\n/** An overlay drawn in the plane, in the camera's world: what every painter\n * reads an overlay as. */\nfunction overlayFromPlane(ov: OngoingOverlay, m: PlaneMap): OngoingOverlay {\n const pt = (p: Point) => fromPlane(m, p);\n switch (ov.kind) {\n case 'marquee':\n return { ...ov, start: pt(ov.start), current: pt(ov.current) };\n case 'lasso':\n return { ...ov, vertices: ov.vertices.map(pt), current: pt(ov.current) };\n case 'polyline':\n return { ...ov, points: ov.points.map(pt) };\n case 'insertPreview':\n return {\n ...ov,\n bounds: rectFromPlane(m, ov.bounds),\n extras: insertExtrasFromPlane(ov.extras, m),\n ...(ov.anchorPoint ? { anchorPoint: pt(ov.anchorPoint) } : {}),\n };\n }\n}\n\n/** The geometry the kit's insert kinds carry in `extras`, in the camera's\n * world. A consumer kind's extras are opaque, and pass through. */\nfunction insertExtrasFromPlane(extras: unknown, m: PlaneMap): unknown {\n if (extras === null || typeof extras !== 'object') return extras;\n const e = extras as Record<string, unknown>;\n const pt = (p: unknown) => fromPlane(m, p as Point);\n // Radial kinds inscribe in a square, so one scale carries a radius.\n const r = (v: unknown) => (typeof v === 'number' ? v / ((m.scale.x + m.scale.y) / 2) : v);\n const out: Record<string, unknown> = { ...e };\n if (e['a'] && e['b']) { out['a'] = pt(e['a']); out['b'] = pt(e['b']); }\n if (e['center']) out['center'] = pt(e['center']);\n if ('radius' in e) out['radius'] = r(e['radius']);\n if ('outerRadius' in e) out['outerRadius'] = r(e['outerRadius']);\n if (Array.isArray(e['samples'])) {\n out['samples'] = (e['samples'] as DragSample[]).map((s) => ({ ...s, ...pt(s) }));\n }\n return out;\n}\n"],"mappings":";;;AA+CA,IAAMA,KAAe,GAAkB,MACpCC,IAAMC,EAAK,OAAuD,IAAIC,EAASF,CAAE,CAAC,CAAC,EAAE,QAAQ,KAAA,GAKnFG,KAAiC,GAAM,MAAe;CACjE,IAAMC,IAAYH,EAAK;CACvB,KAAK,IAAMD,KAAM,CAAC,GAAIK,GAAY,aAAa,CAAC,GAAI,GAAID,GAAW,IAAI,KAAK,CAAC,CAAE,GAAG;EAChF,IAAME,IAAQP,EAAYE,GAAMD,CAAE;EAClC,IAAIM,MAAU,KAAA,GAAW,OAAOA;CAClC;AAEF,GAGaC,KAA8B,MACxCN,EAAK,QAAkC,QAAQ,GAGrCO,KAA+B,MAC1CT,EAAYE,GAAOA,EAAK,aAA4C,SAAS;AAI/E,SAAgBQ,EAAQ,GAAe,GAAgC;CACrE,OAAQC,GAA8B,UAAUJ,CAAK,KAAK;AAC5D;AAGA,SAAgBK,EAAY,GAAqC;CAC/D,OAAOC,KAAKC,EAAaD,GAAG,IAAI;AAClC;AAIA,SAAgBE,EAAa,GAAsB,GAAS,GAAuB;CACjF,IAAIF,MAAM,MAAM,OAAOG;CACvB,IAAMC,IAAIC,EAAE,UAAUF,CAAI;CAC1B,OAAOE,EAAE,YAAYF,GAAMC,GAAGE,EAAYN,GAAGI,CAAC,CAAC;AACjD;AASA,SAAgBG,EAA0B,GAAW,GAA2B;CAC9E,IAAMC,IAAQC,EAAO;CACrB,IAAI,CAACD,GAAO,OAAOC;CACnB,IAAMC,IAAWD,EAAO,YAAY,CAAC,GAC/BE,IAAW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AAiB,GAAsB;CACpE,IAAuB,OAAOC,KAAW,aAArCA,GAA+C,OAAOA;CAC1D,IAAMC,IAAID,GACJH,KAAM,MAAerB,EAAU3C,GAAGiC,CAAU,GAE5CoC,KAAK,MAAgB,OAAOC,KAAM,WAAWA,MAAMtE,EAAE,MAAM,IAAIA,EAAE,MAAM,KAAK,KAAKsE,GACjFpB,IAA+B,EAAE,GAAGkB,EAAE;CAQ5C,OAPIA,EAAEG,KAAQH,EAAEI,MAAQ,EAAID,IAAOP,EAAGI,EAAEG,CAAI,GAAG,EAAIC,IAAOR,EAAGI,EAAEI,CAAI,IAC/DJ,EAAEK,WAAW,EAAIA,SAAYT,EAAGI,EAAEK,MAAS,IAC3C,YAAYL,MAAG,EAAIM,SAAYL,EAAED,EAAEM,MAAS,IAC5C,iBAAiBN,MAAG,EAAIO,cAAiBN,EAAED,EAAEO,WAAc,IAC3D,MAAM,QAAQP,EAAEQ,OAAU,MAC5B,EAAIA,UAAcR,EAAEQ,QAA4B,KAAK,OAAO;EAAE,GAAGC;EAAG,GAAGb,EAAGa,CAAC;CAAE,EAAE,IAE1E3B;AACT"}
|
|
@@ -14,7 +14,6 @@ var i = {
|
|
|
14
14
|
remapBounds: (r, i, a) => n(r) ? t.remapBounds(r, i, a) : e.remapBounds(r, i, a),
|
|
15
15
|
fromBounds: (r, i) => n(i) ? t.fromBounds(r, i) : e.fromBounds(r, i),
|
|
16
16
|
translate: (r, i, a) => n(r) ? t.translate(r, i, a) : e.translate(r, i, a),
|
|
17
|
-
intersectsRect: (r, i) => n(r) ? t.intersectsRect(r, i) : e.intersectsRect(r, i),
|
|
18
17
|
getRotation: (e) => {
|
|
19
18
|
if (n(e)) return 0;
|
|
20
19
|
let t = e.rotation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autoPoseDescriptor.js","names":["isPathLike","p","isRectPose","r","AUTO_POSE_DESCRIPTOR","pathPoseDescriptor","RECT_POSE_DESCRIPTOR","src","dst","template","b","dx","dy"
|
|
1
|
+
{"version":3,"file":"autoPoseDescriptor.js","names":["isPathLike","p","isRectPose","r","AUTO_POSE_DESCRIPTOR","pathPoseDescriptor","RECT_POSE_DESCRIPTOR","src","dst","template","b","dx","dy"],"sources":["../../../../src/interactions/actions/resize/autoPoseDescriptor.ts"],"sourcesContent":["import type { Path } from '@weasel-js/geom';\nimport { pathPoseDescriptor } from 'features/paths/poseDescriptor';\nimport { RECT_POSE_DESCRIPTOR, type PoseDescriptor } from './geometry';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\n\n/** True for Path-shaped poses (`{kind: 'polygon' | 'rect'}`). Useful for\n * callers that need to fork between `pathPoseDescriptor` and\n * `RECT_POSE_DESCRIPTOR` without forcing the consumer to wire\n * `poseDescriptor` explicitly. */\nexport function isPathLike(p: unknown): p is Path {\n return !!p && typeof p === 'object' && 'kind' in p\n && ((p as { kind: unknown }).kind === 'polygon' || (p as { kind: unknown }).kind === 'rect');\n}\n\n/** True for a pose with numeric top-level `x`/`y`/`width`/`height` — the only\n * shape the rect descriptor and the kit's built-in painters can read. */\nexport function isRectPose(p: unknown): p is { x: number; y: number; width: number; height: number; rotation?: number } {\n if (!p || typeof p !== 'object') return false;\n const r = p as Record<string, unknown>;\n return typeof r.x === 'number' && typeof r.y === 'number'\n && typeof r.width === 'number' && typeof r.height === 'number';\n}\n\n/** Per-call dispatch: if the pose looks like a Path, route to\n * `pathPoseDescriptor`; otherwise treat as a plain rect pose. Avoids forcing\n * demos with Path TPose to wire `poseDescriptor={pathPoseDescriptor}`\n * explicitly. `getRotation` surfaces a `pose.rotation` field on non-Path poses\n * so demos using rect-with-rotation shapes (e.g. `RotatedPose`) don't have to\n * wire `poseDescriptor={ROTATED_POSE_DESCRIPTOR}` just to get rotated\n * selection chrome and rotation-aware corner hit-tests. */\nexport const AUTO_POSE_DESCRIPTOR: PoseDescriptor<unknown> = {\n getBounds: (p) => isPathLike(p)\n ? pathPoseDescriptor.getBounds(p)\n : RECT_POSE_DESCRIPTOR.getBounds(p as { x: number; y: number; width: number; height: number }),\n remapBounds: (p, src, dst) => isPathLike(p)\n ? pathPoseDescriptor.remapBounds(p, src, dst)\n : RECT_POSE_DESCRIPTOR.remapBounds(p as { x: number; y: number; width: number; height: number }, src, dst),\n fromBounds: (b, template) => isPathLike(template)\n ? pathPoseDescriptor.fromBounds(b, template)\n : RECT_POSE_DESCRIPTOR.fromBounds(b, template as Bounds),\n translate: (p, dx, dy) => isPathLike(p)\n ? pathPoseDescriptor.translate!(p, dx, dy)\n : RECT_POSE_DESCRIPTOR.translate!(p as { x: number; y: number; width: number; height: number }, dx, dy),\n getRotation: (p) => {\n if (isPathLike(p)) return 0;\n const r = (p as { rotation?: unknown }).rotation;\n return typeof r === 'number' ? r : 0;\n },\n // Path-shaped poses can't carry rotation (see `pathPoseDescriptor`).\n // Everything else flows through `wrapWithPoseRotation`'s x/y/w/h gate at\n // paint time, so report `true` and let the wrapper no-op for poses\n // missing AABB fields.\n supportsRotation: (p) => !isPathLike(p),\n withRotation: (p, rotation) => isPathLike(p) ? p : { ...(p as object), rotation },\n};\n"],"mappings":";;;AASA,SAAgBA,EAAW,GAAuB;CAChD,OAAO,CAAC,CAACC,KAAK,OAAOA,KAAM,YAAY,UAAUA,MAC1CA,EAAwB,SAAS,aAAcA,EAAwB,SAAS;AACzF;AAIA,SAAgBC,EAAW,GAA6F;CACtH,IAAI,CAACD,KAAK,OAAOA,KAAM,UAAU,OAAO;CACxC,IAAME,IAAIF;CACV,OAAO,OAAOE,EAAE,KAAM,YAAY,OAAOA,EAAE,KAAM,YAC5C,OAAOA,EAAE,SAAU,YAAY,OAAOA,EAAE,UAAW;AAC1D;AASA,IAAaC,IAAgD;CAC3D,YAAY,MAAMJ,EAAWC,CAAC,IAC1BI,EAAmB,UAAUJ,CAAC,IAC9BK,EAAqB,UAAUL,CAA4D;CAC/F,cAAc,GAAG,GAAK,MAAQD,EAAWC,CAAC,IACtCI,EAAmB,YAAYJ,GAAGM,GAAKC,CAAG,IAC1CF,EAAqB,YAAYL,GAA8DM,GAAKC,CAAG;CAC3G,aAAa,GAAG,MAAaR,EAAWS,CAAQ,IAC5CJ,EAAmB,WAAWK,GAAGD,CAAQ,IACzCH,EAAqB,WAAWI,GAAGD,CAAkB;CACzD,YAAY,GAAG,GAAI,MAAOT,EAAWC,CAAC,IAClCI,EAAmB,UAAWJ,GAAGU,GAAIC,CAAE,IACvCN,EAAqB,UAAWL,GAA8DU,GAAIC,CAAE;CACxG,cAAc,MAAM;EAClB,IAAIZ,EAAWC,CAAC,GAAG,OAAO;EAC1B,IAAME,IAAKF,EAA6B;EACxC,OAAO,OAAOE,KAAM,WAAWA,IAAI;CACrC;CAKA,mBAAmB,MAAM,CAACH,EAAWC,CAAC;CACtC,eAAe,GAAG,MAAaD,EAAWC,CAAC,IAAIA,IAAI;EAAE,GAAIA;EAAc;CAAS;AAClF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '@weasel-js/geom';
|
|
2
2
|
import { Bounds } from '@weasel-js/routing';
|
|
3
|
-
import { b as RotatedPose } from './poseDescriptor-
|
|
4
|
-
import './autoPoseDescriptor-
|
|
3
|
+
import { b as RotatedPose } from './poseDescriptor-D-OH-tu5.js';
|
|
4
|
+
import './autoPoseDescriptor-vCdt55xm.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Minimal node interface for the simulation primitive. Matches d3-force's
|
package/dist/math.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { DEFAULT_FLATTEN_TOLERANCE, PATH_C, PATH_CMD_LENGTHS, PATH_L, PATH_M, PATH_Q, PATH_Z, Path, PathBuilder, PathFillRule, PolygonPath, RectPath, flattenCubic, flattenCubicWithArcLen, flattenQuadratic, flattenQuadraticWithArcLen, pathCommandCoordCount, pointAlongPath, polygonFromPoints, polylineFromPoints, rectPath } from '@weasel-js/geom';
|
|
2
2
|
export { Point2 as Vec2 } from '@weasel-js/routing';
|
|
3
|
-
export { P as PoseDescriptor, t as translatePoseViaDescriptor } from './poseDescriptor-
|
|
4
|
-
export { a as Simulation, d as SimulationCore, e as SimulationForce, S as SimulationNode, f as SimulationOptions, h as createSimulation, i as rotatePoint } from './math-
|
|
5
|
-
export { A as AUTO_POSE_DESCRIPTOR } from './autoPoseDescriptor-
|
|
3
|
+
export { P as PoseDescriptor, t as translatePoseViaDescriptor } from './poseDescriptor-D-OH-tu5.js';
|
|
4
|
+
export { a as Simulation, d as SimulationCore, e as SimulationForce, S as SimulationNode, f as SimulationOptions, h as createSimulation, i as rotatePoint } from './math-Drrw4ewZ.js';
|
|
5
|
+
export { A as AUTO_POSE_DESCRIPTOR } from './autoPoseDescriptor-vCdt55xm.js';
|
package/dist/move.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { O as OriginProjection } from './originProjection-
|
|
2
|
-
export { U as UseMoveOptions } from './originProjection-
|
|
3
|
-
import { S as SnapTarget } from './types-
|
|
4
|
-
import { M as MoveBehavior } from './types-
|
|
1
|
+
import { O as OriginProjection } from './originProjection-DEklpDc_.js';
|
|
2
|
+
export { U as UseMoveOptions } from './originProjection-DEklpDc_.js';
|
|
3
|
+
import { S as SnapTarget } from './types-A37hYkeR.js';
|
|
4
|
+
import { M as MoveBehavior } from './types-B_9g6hMM.js';
|
|
5
5
|
import '@weasel-js/history';
|
|
6
6
|
import '@weasel-js/geom';
|
|
7
7
|
import '@weasel-js/routing';
|
|
@@ -27,10 +27,6 @@ interface PoseDescriptor<TPose, TNode = unknown> {
|
|
|
27
27
|
* back to a translation derived from `remapBounds` (origin shifted, no
|
|
28
28
|
* scale). Path-shaped poses should provide this for performance. */
|
|
29
29
|
translate?(pose: TPose, dx: number, dy: number): TPose;
|
|
30
|
-
/** True iff any portion of the pose's geometry intersects `rect`. Optional.
|
|
31
|
-
* Marquee and lasso do not read it: both test the node's drawn outline
|
|
32
|
-
* (`core/geometry/regionHit`). */
|
|
33
|
-
intersectsRect?(pose: TPose, rect: Bounds): boolean;
|
|
34
30
|
/** Interpolate between two poses. Optional — animation helpers fall back to
|
|
35
31
|
* rect-shape lerp when omitted (which fails for non-rect poses). */
|
|
36
32
|
lerp?(a: TPose, b: TPose, t: number): TPose;
|
package/dist/renderer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as CullRect, D as DrawCommand, E as Effect, G as GroupDrawCommand, I as IDENTITY_COLOR_MATRIX, a as ImageDrawCommand, b as ImageMinification, P as PathDrawCommand, R as RenderOptions, c as RenderSpan, d as RenderSpanStats, e as RenderStats, f as RenderTarget, S as SPRITE_STRIDE, g as ShaderDrawCommand, h as SolidPaint, i as SpriteSheet, j as SpritesDrawCommand, k as StrokeOptions, T as TextDrawCommand, W as WeaselRenderer, l as WeaselRendererOptions, m as blur, n as buildGradientRamp, o as cullDrawCommands, p as frameRect, r as registerEffect, t as tessellateStroke, v as viewToMat3, q as vignette } from './builtins-
|
|
1
|
+
export { C as CullRect, D as DrawCommand, E as Effect, G as GroupDrawCommand, I as IDENTITY_COLOR_MATRIX, a as ImageDrawCommand, b as ImageMinification, P as PathDrawCommand, R as RenderOptions, c as RenderSpan, d as RenderSpanStats, e as RenderStats, f as RenderTarget, S as SPRITE_STRIDE, g as ShaderDrawCommand, h as SolidPaint, i as SpriteSheet, j as SpritesDrawCommand, k as StrokeOptions, T as TextDrawCommand, W as WeaselRenderer, l as WeaselRendererOptions, m as blur, n as buildGradientRamp, o as cullDrawCommands, p as frameRect, r as registerEffect, t as tessellateStroke, v as viewToMat3, q as vignette } from './builtins-C-gRyVRx.js';
|
|
2
2
|
export { G as GlMat3, P as ProgramSource, S as ShaderCompileError, a as ShaderProgramHandle, b as ShaderUniform, m as mat3, p as programSourceRegistry, r as registerProgram } from './registerProgram-ateHDGjw.js';
|
|
3
3
|
export { Mesh, TessellateOptions, tessellate } from '@weasel-js/geom/tessellate';
|
|
4
4
|
export { RegisterFontOptions, canQueryLocalFonts, cssFontFamily, cssFontFamilyLoading, enableLocalFontOutlines, fontOutlineRegistry, fontRegistry, hasFontOutlines, isCanvasFont, listFontOutlines, loadFontOutlines, outlineStatus, registerCanvasFont, registerFont, registerFontOutlines, subscribeGlyphReady, unregisterCanvasFont, unregisterFontOutlines } from '@weasel-js/font';
|
|
@@ -9,11 +9,11 @@ export { View as ViewLike } from '@weasel-js/routing';
|
|
|
9
9
|
import '@weasel-js/geom';
|
|
10
10
|
import 'react';
|
|
11
11
|
import '@weasel-js/history';
|
|
12
|
-
import './types-
|
|
12
|
+
import './types-A37hYkeR.js';
|
|
13
13
|
import '@weasel-js/text';
|
|
14
|
-
import './poseDescriptor-
|
|
14
|
+
import './poseDescriptor-D-OH-tu5.js';
|
|
15
15
|
import '@weasel-js/routing/react';
|
|
16
|
-
import './types-
|
|
16
|
+
import './types-B_9g6hMM.js';
|
|
17
17
|
import '@weasel-js/cursor';
|
|
18
18
|
import '@weasel-js/gestures';
|
|
19
19
|
|
package/dist/resize.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { C as CORNER_ANCHORS, a as CornerAnchor, b as CornerHandle, U as UseResizeOptions, c as cornerPoint, d as cornerResizeHandles, f as fixedCornerOf, h as hitCornerHandle } from './cornerHandles-
|
|
2
|
-
export { P as PoseDescriptor, R as RECT_POSE_DESCRIPTOR, a as ROTATED_POSE_DESCRIPTOR, p as poseDescriptorForNode } from './poseDescriptor-
|
|
3
|
-
import { B as BoundsConstraint } from './types-
|
|
1
|
+
export { C as CORNER_ANCHORS, a as CornerAnchor, b as CornerHandle, U as UseResizeOptions, c as cornerPoint, d as cornerResizeHandles, f as fixedCornerOf, h as hitCornerHandle } from './cornerHandles-BCrDp_mH.js';
|
|
2
|
+
export { P as PoseDescriptor, R as RECT_POSE_DESCRIPTOR, a as ROTATED_POSE_DESCRIPTOR, p as poseDescriptorForNode } from './poseDescriptor-D-OH-tu5.js';
|
|
3
|
+
import { B as BoundsConstraint } from './types-B_9g6hMM.js';
|
|
4
4
|
import { Bounds, ModifierState } from '@weasel-js/routing';
|
|
5
|
-
export { A as AUTO_POSE_DESCRIPTOR, i as isPathLike, a as isRectPose } from './autoPoseDescriptor-
|
|
6
|
-
import './types-
|
|
5
|
+
export { A as AUTO_POSE_DESCRIPTOR, i as isPathLike, a as isRectPose } from './autoPoseDescriptor-vCdt55xm.js';
|
|
6
|
+
import './types-A37hYkeR.js';
|
|
7
7
|
import '@weasel-js/history';
|
|
8
8
|
import '@weasel-js/geom';
|
|
9
9
|
|
package/dist/style.css
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
._numeric_zns9n_4{font-family:var(--wzl-font-numeric);font-variant-numeric:tabular-nums}._hud_1hv8c_3{z-index:10000;color:#e8e8e8;pointer-events:none;text-align:right;background:#000000b3;border-radius:4px;padding:6px 8px;font:11px/1.4 ui-monospace,SFMono-Regular,Menlo,monospace;position:fixed}._sized_1hv8c_17{min-width:120px;max-width:260px}._readings_1hv8c_22{grid-template-columns:auto auto;column-gap:8px;margin:0;display:grid}._readings_1hv8c_22 dt{text-align:left}._readings_1hv8c_22 dd{white-space:nowrap;margin:0}._muted_1hv8c_39{color:#888}._absent_1hv8c_44{color:#888;font-style:italic}._header_1hv8c_49{margin-bottom:2px}._list_1hv8c_53{flex-direction:column;gap:1px;margin:0;padding:0;list-style:none;display:flex}._item_1hv8c_62{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}._itemBest_1hv8c_68{font-weight:700}._row_1hv8c_72{white-space:nowrap;justify-content:flex-end;gap:8px;display:flex}._stack_1hv8c_79{flex-direction:column;align-items:flex-end;display:flex}
|
|
2
|
+
/*$vite$:1*/
|
|
@@ -286,8 +286,10 @@ interface LayoutStrategy<TPose> {
|
|
|
286
286
|
* closed — and an empty array leaves the container unchanged, which snaps
|
|
287
287
|
* the child home because the drag only ever wrote previews. `null` lets
|
|
288
288
|
* the drop stand where the pointer left it, which is also what a strategy
|
|
289
|
-
* without this method gets
|
|
290
|
-
*
|
|
289
|
+
* without this method gets; dropped outside the container's body, the
|
|
290
|
+
* child then leaves it for the plain container under the drop, or the top
|
|
291
|
+
* level. The drag preview follows the pointer either way; this decides the
|
|
292
|
+
* release. */
|
|
291
293
|
releaseDrop?(container: LayoutContainer, children: ReadonlyArray<LayoutChild<TPose>>, dragged: LayoutDragged<TPose>): Op[] | null;
|
|
292
294
|
}
|
|
293
295
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SnapTarget, P as PlaneMap, M as MoveAdapter, I as InsertAdapter } from './types-
|
|
1
|
+
import { S as SnapTarget, P as PlaneMap, M as MoveAdapter, I as InsertAdapter } from './types-A37hYkeR.js';
|
|
2
2
|
import { Op } from '@weasel-js/history';
|
|
3
3
|
import { Bounds, ModifierState, View, ResizeAnchor } from '@weasel-js/routing';
|
|
4
4
|
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weasel-js/core",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.3",
|
|
4
4
|
"description": "Domain-agnostic 2D scene graph primitives for React: viewport math, drag/resize/insert/clone interactions, layered canvas rendering.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "orochi235",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"import": "./dist/index.js",
|
|
38
38
|
"types": "./dist/index.d.ts"
|
|
39
39
|
},
|
|
40
|
+
"./style.css": "./dist/style.css",
|
|
40
41
|
"./math": {
|
|
41
42
|
"import": "./dist/math.js",
|
|
42
43
|
"types": "./dist/math.d.ts"
|
|
@@ -84,21 +85,21 @@
|
|
|
84
85
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
85
86
|
},
|
|
86
87
|
"peerDependencies": {
|
|
87
|
-
"@weasel-js/font": "1.7.
|
|
88
|
+
"@weasel-js/font": "1.7.3",
|
|
88
89
|
"react": ">=18"
|
|
89
90
|
},
|
|
90
91
|
"dependencies": {
|
|
91
|
-
"@weasel-js/cursor": "1.7.
|
|
92
|
-
"@weasel-js/geom": "1.7.
|
|
93
|
-
"@weasel-js/gestures": "1.7.
|
|
94
|
-
"@weasel-js/history": "1.7.
|
|
95
|
-
"@weasel-js/modes": "1.7.
|
|
96
|
-
"@weasel-js/quantity": "1.7.
|
|
97
|
-
"@weasel-js/paint": "1.7.
|
|
98
|
-
"@weasel-js/react": "1.7.
|
|
99
|
-
"@weasel-js/registry": "1.7.
|
|
100
|
-
"@weasel-js/routing": "1.7.
|
|
101
|
-
"@weasel-js/text": "1.7.
|
|
92
|
+
"@weasel-js/cursor": "1.7.3",
|
|
93
|
+
"@weasel-js/geom": "1.7.3",
|
|
94
|
+
"@weasel-js/gestures": "1.7.3",
|
|
95
|
+
"@weasel-js/history": "1.7.3",
|
|
96
|
+
"@weasel-js/modes": "1.7.3",
|
|
97
|
+
"@weasel-js/quantity": "1.7.3",
|
|
98
|
+
"@weasel-js/paint": "1.7.3",
|
|
99
|
+
"@weasel-js/react": "1.7.3",
|
|
100
|
+
"@weasel-js/registry": "1.7.3",
|
|
101
|
+
"@weasel-js/routing": "1.7.3",
|
|
102
|
+
"@weasel-js/text": "1.7.3",
|
|
102
103
|
"earcut": "3.2.3",
|
|
103
104
|
"polygon-clipping": "^0.15.7"
|
|
104
105
|
},
|
|
@@ -116,6 +117,7 @@
|
|
|
116
117
|
"2d"
|
|
117
118
|
],
|
|
118
119
|
"devDependencies": {
|
|
119
|
-
"@weasel-js/modes": "1.7.
|
|
120
|
+
"@weasel-js/modes": "1.7.3",
|
|
121
|
+
"@weasel-js/theme": "1.7.3"
|
|
120
122
|
}
|
|
121
123
|
}
|
package/dist/index.css
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
._hud_s26ij_2{z-index:10000;color:#e8e8e8;pointer-events:none;text-align:right;background:#000000b3;border-radius:4px;padding:6px 8px;font:11px/1.4 ui-monospace,SFMono-Regular,Menlo,monospace;position:fixed}._sized_s26ij_15{min-width:120px;max-width:260px}._pre_s26ij_20{white-space:pre}._muted_s26ij_24{color:#888}._absent_s26ij_29{color:#888;font-style:italic}._header_s26ij_34{margin-bottom:2px}._list_s26ij_38{flex-direction:column;gap:1px;margin:0;padding:0;list-style:none;display:flex}._item_s26ij_47{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}._itemBest_s26ij_53{font-weight:700}._row_s26ij_57{white-space:nowrap;justify-content:flex-end;gap:8px;display:flex}._stack_s26ij_64{flex-direction:column;align-items:flex-end;display:flex}
|
|
2
|
-
/*$vite$:1*/
|