@weasel-js/core 1.4.0 → 1.4.1

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.
@@ -5,7 +5,7 @@ import { CapabilityTag } from '@weasel-js/modes';
5
5
  import * as React from 'react';
6
6
  import { MutableRefObject, ReactNode, ReactElement } from 'react';
7
7
  import { GestureSpec, IngestItem, InputEvent } from '@weasel-js/gestures';
8
- import { D as DrawCommand } from './DrawCommand-b-z1bCT-.js';
8
+ import { D as DrawCommand } from './DrawCommand-Ch8W63oQ.js';
9
9
  import { B as Bounds, P as PoseProjection, F as FitViewToBoundsOptions, V as ViewportDims } from './geometry-Dtt_k6Dq.js';
10
10
  import { FillStyle, Stroke } from '@weasel-js/paint';
11
11
  import { CursorSpec } from '@weasel-js/cursor';
@@ -1478,6 +1478,58 @@ interface ContentHandlerEntry {
1478
1478
  /** Register a content handler. Returns a disposer that removes it. */
1479
1479
  declare function registerContentHandler(entry: ContentHandlerEntry): () => void;
1480
1480
 
1481
+ /** Per-axis limits on a view's position. Any side may be left open. */
1482
+ interface PanBounds {
1483
+ minX?: number;
1484
+ maxX?: number;
1485
+ minY?: number;
1486
+ maxY?: number;
1487
+ }
1488
+ /** Momentum settings for a pan: how quickly a flung view slows, when it stops,
1489
+ * and what happens at the pan limits. The `DecayLoopConfig` fields a caller
1490
+ * chooses up front, without the per-gesture `velocity` / `onTick`. */
1491
+ interface InertiaConfig {
1492
+ friction?: number;
1493
+ minSpeed?: number;
1494
+ /** What to do when inertial pan reaches `bounds`. Default: no clamping. */
1495
+ boundary?: 'stop' | 'bounce' | 'spring';
1496
+ /** View-coordinate limits for boundary clamping. Requires `boundary` to take effect. */
1497
+ bounds?: PanBounds;
1498
+ }
1499
+ /** How a decay should run: its starting velocity, how fast it slows, and what
1500
+ * happens if it reaches the pan limits. */
1501
+ interface DecayLoopConfig {
1502
+ velocity: {
1503
+ vx: number;
1504
+ vy: number;
1505
+ };
1506
+ friction?: number;
1507
+ minSpeed?: number;
1508
+ /** Bounds for boundary clamping. Requires `boundary` to take effect. */
1509
+ viewBounds?: PanBounds;
1510
+ /**
1511
+ * What to do when the accumulated position hits `viewBounds`. Default: no clamping.
1512
+ * - `'stop'`: clamp at boundary, kill velocity component.
1513
+ * - `'bounce'`: linear reflection — flip velocity sign, magnitude preserved.
1514
+ * - `'spring'`: damped reflection — flip velocity sign and shrink magnitude
1515
+ * by `SPRING_DAMPING` per bounce so the motion settles naturally.
1516
+ */
1517
+ boundary?: 'stop' | 'bounce' | 'spring';
1518
+ /** Starting position for internal boundary tracking. Required when `viewBounds` is set. */
1519
+ initialPosition?: {
1520
+ x: number;
1521
+ y: number;
1522
+ };
1523
+ onTick: (dx: number, dy: number) => void;
1524
+ onEnd?: () => void;
1525
+ }
1526
+ /** A rAF loop that coasts a value to a stop under friction, reporting the
1527
+ * per-frame delta. What turns a released pan drag into momentum scrolling. */
1528
+ declare function useDecayLoop(): {
1529
+ start: (config: DecayLoopConfig) => void;
1530
+ cancel: () => void;
1531
+ };
1532
+
1481
1533
  /** Which of a node's two per-anchor color arrays an override applies to. */
1482
1534
  type VertexColorChannel = 'fill' | 'stroke';
1483
1535
  /** Function-form override: receives the consumer-supplied base color
@@ -2408,6 +2460,11 @@ interface ViewApi {
2408
2460
  /** Where an in-flight camera animation is heading, or null. Compute the next
2409
2461
  * discrete step from this so repeated presses compound. */
2410
2462
  animationTarget?(): View | null;
2463
+ /** Optional momentum decay. `<SceneCanvas>` wires this from `useDecayLoop`;
2464
+ * a consumer publishing their own `view` dep need not, and `viewport.dragPan`
2465
+ * simply lands the pan without coasting. */
2466
+ decay?(config: DecayLoopConfig): void;
2467
+ stopDecay?(): void;
2411
2468
  }
2412
2469
  /**
2413
2470
  * Adapter dep for `areaSelectAction`.
@@ -3139,15 +3196,12 @@ interface ToolDef<TScratch = void> {
3139
3196
  * authoring signal that a tool pans/zooms the view rather than the scene. */
3140
3197
  type ViewportToolDef<TScratch = void> = ToolDef<TScratch>;
3141
3198
 
3142
- /** Modifier-key snapshot at event dispatch time. `space` is included
3143
- * because tools commonly use space as a hotkey-slot trigger and may
3144
- * also want to read it as a flag mid-gesture. */
3199
+ /** Modifier-key snapshot at event dispatch time. */
3145
3200
  interface ToolModifiers {
3146
3201
  alt: boolean;
3147
3202
  shift: boolean;
3148
3203
  meta: boolean;
3149
3204
  ctrl: boolean;
3150
- space: boolean;
3151
3205
  }
3152
3206
  /** Per-event context passed to every channel handler. `scratch` is typed
3153
3207
  * via the tool's `TScratch` parameter; it survives across a single
@@ -3790,7 +3844,13 @@ type ActionsProp = null | Record<string, ActionEntry>;
3790
3844
  * Imperative API exposed by `useActionsRegistry()`.
3791
3845
  */
3792
3846
  interface ActionsRegistry {
3847
+ /** Add an action and return its release. Registrants for one id stack,
3848
+ * newest live, so releasing yours uncovers whoever you displaced. Call it
3849
+ * from an effect and release it in that effect's cleanup — registering from
3850
+ * a render body pushes an entry per render and releases none. */
3793
3851
  register(action: Action): () => void;
3852
+ /** Drop every registrant of `id`. This is the "this action should not exist"
3853
+ * door, not a release — for that, call what `register` returned. */
3794
3854
  unregister(id: string): void;
3795
3855
  list(): readonly Action[];
3796
3856
  /** Fire an immediate-invoker action by id. The optional `params` arg is
@@ -3850,4 +3910,4 @@ declare function useActionsRegistry(): ActionsRegistry | null;
3850
3910
  */
3851
3911
  declare function useAction(action: Action): void;
3852
3912
 
3853
- export { type ActionDeps as $, type Action as A, type BuiltinShapeToolId as B, type Condition as C, type Dims as D, ColorOverrideRegistry as E, type BooleansAdapter as F, type GeometryProjection as G, type HotkeyTrigger as H, type InsertExtras as I, type UseAnimatorOptions as J, type SpringPresetName as K, type LayerHit as L, type EasingSpec as M, type AnimationHandle as N, type OverlayPosition as O, type VertexColorChannel as P, type SampledTrack as Q, type RenderLayer as R, type SliceDep as S, type Tool as T, type UseSelectionOptions as U, type VisibilityRules as V, type Eligibility as W, type BindingScope as X, type Contribution as Y, type ScopedBinding as Z, ALWAYS as _, type DeviceProfile as a, type PoseComposition as a$, ActionDisabledReason as a0, type ActionEnabledResult as a1, type ActionEntry as a2, ActionsProvider as a3, ActiveToolContextProvider as a4, ActiveToolContextProviderIfRoot as a5, type ActiveToolContextProviderProps as a6, type ActiveToolContextValue as a7, type AnimateToBoundsOptions as a8, type AreaSelectDep as a9, type IngestCtx as aA, type IngestionDep as aB, type InsertDep as aC, type Interpolate as aD, type InterpolatorFactory as aE, type InvocationCtx as aF, type Invoker as aG, KIT_SHAPE_KINDS as aH, type Keyframe as aI, type LassoSelectDep as aJ, type LayerCommandCache as aK, type LayoutDep as aL, type LoopFactory as aM, type LoopOptions as aN, type MatchResult as aO, NEVER as aP, type NestedTimeline as aQ, type NodeAtPointDep as aR, type OngoingHandle as aS, type OngoingInvoker as aT, type PhysicsHandle as aU, type PhysicsOptions as aV, type Point2 as aW, PointerContextProvider as aX, type PointerContextValue as aY, type PointerWorldPos as aZ, type PoseAdapter as a_, type BezierEasing as aa, type BindingOpts as ab, type BooleanOp as ac, type BooleanOpResult as ad, type BoundGesture as ae, type BuildRuleCtxArgs as af, type ClaimableGesture as ag, type ClipboardDep as ah, type ClipboardIngestCtx as ai, type ColorOverride as aj, type ColorOverrideFn as ak, type CustomPaintContext as al, type DecayOptions as am, type DepName as an, type DepRegistry as ao, DepRegistryProvider as ap, type DispatcherContext as aq, type DragSample as ar, EASINGS as as, type EasingFn as at, type EasingName as au, type EditAnchorsDep as av, type EventTrack as aw, type GestureBinding as ax, IDENTITY_POSE_COMPOSITION as ay, type ImmediateInvoker as az, type DetectedDeviceFacts as b, easeInOutQuart as b$, type ResizePolicy as b0, type ResolveAllOptions as b1, type ResolveOnlyResult as b2, type ResolvedCandidate as b3, SPRING_PRESETS as b4, type SelectionExtendKey as b5, type SelectionMode as b6, type Selector as b7, type SnapDep as b8, type SpringOptions as b9, applyBooleanOp as bA, buildRuleCtx as bB, clipboardCopyAction as bC, clipboardCutAction as bD, composeRectPose as bE, composeWorldPose as bF, createDispatcher as bG, cubicBezierEasing as bH, decomposeRectPose as bI, describeRule as bJ, drawLayers as bK, drawOneLayer as bL, easeIn as bM, easeInBack as bN, easeInBounce as bO, easeInCirc as bP, easeInCubic as bQ, easeInElastic as bR, easeInExpo as bS, easeInOut as bT, easeInOutBack as bU, easeInOutBounce as bV, easeInOutCirc as bW, easeInOutCubic as bX, easeInOutElastic as bY, easeInOutExpo as bZ, easeInOutQuad as b_, type SpringPreset as ba, type StaggerBuilder as bb, type StaggerDelay as bc, type StaggerFactory as bd, type StaggerOptions as be, type StaggerPerItem as bf, type StaggerSpringPoseOptions as bg, type StaggerTweenOptions as bh, type SvgUnpacker as bi, type TextEditDep as bj, type TimelineHandle as bk, type TimelineOptions as bl, type TimelineTrack as bm, type ToolCtx as bn, type ToolModifiers as bo, type ToolPresentation as bp, type ToolSlot as bq, type Track as br, type TweenLoopOptions as bs, type TweenOptions as bt, type UiOngoingControl as bu, VIEW_ANIMATION_KEY as bv, type ViewAnimationApi as bw, type ViewApi as bx, type ViewChannel as by, actionBindings as bz, type Rule as c, easeInOutQuint as c0, easeInOutSine as c1, easeInQuad as c2, easeInQuart as c3, easeInQuint as c4, easeInSine as c5, easeOut as c6, easeOutBack as c7, easeOutBounce as c8, easeOutCirc as c9, useOptionalDepRegistry as cA, usePointerContext as cB, useSelection as cC, useViewAnimation as cD, worldPoseLookup as cE, easeOutCubic as ca, easeOutElastic as cb, easeOutExpo as cc, easeOutQuad as cd, easeOutQuart as ce, easeOutQuint as cf, easeOutSine as cg, enterTextEditAction as ch, evaluate as ci, evaluateEnabled as cj, isLayerPainted as ck, isLayerVisible as cl, linear as cm, rebaseLocalPose as cn, registerContentHandler as co, resolveEasing as cp, resolveParams as cq, sliceAction as cr, specificity as cs, translateRectPose as ct, useAction as cu, useActionsRegistry as cv, useActiveToolContext as cw, useDepRegistry as cx, useDepSource as cy, useOptionalActiveToolContext as cz, type RuleCtx as d, type ChromeCtx as e, type ChromeId as f, type ViewAnimationOptions as g, type DepSchema as h, type ActionsRegistry as i, type AffordanceHit as j, type Dispatcher as k, type ToolDef as l, type ViewportToolDef as m, type AnyTool as n, type ToolKeybinding as o, type OngoingOverlay as p, type ChromeState as q, type SelectionApi as r, type ContentHandlerEntry as s, type SvgIngestOptions as t, type ActionsProp as u, type Animator as v, type Affordance as w, type AffordanceRegion as x, type AffordanceBinding as y, type CommonAffordanceScratch as z };
3913
+ export { type ScopedBinding as $, type Action as A, type BuiltinShapeToolId as B, type Condition as C, type Dims as D, type CommonAffordanceScratch as E, ColorOverrideRegistry as F, type GeometryProjection as G, type HotkeyTrigger as H, type InertiaConfig as I, type BooleansAdapter as J, type UseAnimatorOptions as K, type LayerHit as L, type SpringPresetName as M, type EasingSpec as N, type OverlayPosition as O, type PanBounds as P, type AnimationHandle as Q, type RenderLayer as R, type SliceDep as S, type Tool as T, type UseSelectionOptions as U, type VisibilityRules as V, type VertexColorChannel as W, type SampledTrack as X, type Eligibility as Y, type BindingScope as Z, type Contribution as _, type DeviceProfile as a, type PointerContextValue as a$, ALWAYS as a0, type ActionDeps as a1, ActionDisabledReason as a2, type ActionEnabledResult as a3, type ActionEntry as a4, ActionsProvider as a5, ActiveToolContextProvider as a6, ActiveToolContextProviderIfRoot as a7, type ActiveToolContextProviderProps as a8, type ActiveToolContextValue as a9, type GestureBinding as aA, IDENTITY_POSE_COMPOSITION as aB, type ImmediateInvoker as aC, type IngestCtx as aD, type IngestionDep as aE, type InsertDep as aF, type Interpolate as aG, type InterpolatorFactory as aH, type InvocationCtx as aI, type Invoker as aJ, KIT_SHAPE_KINDS as aK, type Keyframe as aL, type LassoSelectDep as aM, type LayerCommandCache as aN, type LayoutDep as aO, type LoopFactory as aP, type LoopOptions as aQ, type MatchResult as aR, NEVER as aS, type NestedTimeline as aT, type NodeAtPointDep as aU, type OngoingHandle as aV, type OngoingInvoker as aW, type PhysicsHandle as aX, type PhysicsOptions as aY, type Point2 as aZ, PointerContextProvider as a_, type AnimateToBoundsOptions as aa, type AreaSelectDep as ab, type BezierEasing as ac, type BindingOpts as ad, type BooleanOp as ae, type BooleanOpResult as af, type BoundGesture as ag, type BuildRuleCtxArgs as ah, type ClaimableGesture as ai, type ClipboardDep as aj, type ClipboardIngestCtx as ak, type ColorOverride as al, type ColorOverrideFn as am, type CustomPaintContext as an, type DecayLoopConfig as ao, type DecayOptions as ap, type DepName as aq, type DepRegistry as ar, DepRegistryProvider as as, type DispatcherContext as at, type DragSample as au, EASINGS as av, type EasingFn as aw, type EasingName as ax, type EditAnchorsDep as ay, type EventTrack as az, type DetectedDeviceFacts as b, easeInOutElastic as b$, type PointerWorldPos as b0, type PoseAdapter as b1, type PoseComposition as b2, type ResizePolicy as b3, type ResolveAllOptions as b4, type ResolveOnlyResult as b5, type ResolvedCandidate as b6, SPRING_PRESETS as b7, type SelectionExtendKey as b8, type SelectionMode as b9, type ViewApi as bA, type ViewChannel as bB, actionBindings as bC, applyBooleanOp as bD, buildRuleCtx as bE, clipboardCopyAction as bF, clipboardCutAction as bG, composeRectPose as bH, composeWorldPose as bI, createDispatcher as bJ, cubicBezierEasing as bK, decomposeRectPose as bL, describeRule as bM, drawLayers as bN, drawOneLayer as bO, easeIn as bP, easeInBack as bQ, easeInBounce as bR, easeInCirc as bS, easeInCubic as bT, easeInElastic as bU, easeInExpo as bV, easeInOut as bW, easeInOutBack as bX, easeInOutBounce as bY, easeInOutCirc as bZ, easeInOutCubic as b_, type Selector as ba, type SnapDep as bb, type SpringOptions as bc, type SpringPreset as bd, type StaggerBuilder as be, type StaggerDelay as bf, type StaggerFactory as bg, type StaggerOptions as bh, type StaggerPerItem as bi, type StaggerSpringPoseOptions as bj, type StaggerTweenOptions as bk, type SvgUnpacker as bl, type TextEditDep as bm, type TimelineHandle as bn, type TimelineOptions as bo, type TimelineTrack as bp, type ToolCtx as bq, type ToolModifiers as br, type ToolPresentation as bs, type ToolSlot as bt, type Track as bu, type TweenLoopOptions as bv, type TweenOptions as bw, type UiOngoingControl as bx, VIEW_ANIMATION_KEY as by, type ViewAnimationApi as bz, type Rule as c, easeInOutExpo as c0, easeInOutQuad as c1, easeInOutQuart as c2, easeInOutQuint as c3, easeInOutSine as c4, easeInQuad as c5, easeInQuart as c6, easeInQuint as c7, easeInSine as c8, easeOut as c9, useDecayLoop as cA, useDepRegistry as cB, useDepSource as cC, useOptionalActiveToolContext as cD, useOptionalDepRegistry as cE, usePointerContext as cF, useSelection as cG, useViewAnimation as cH, worldPoseLookup as cI, easeOutBack as ca, easeOutBounce as cb, easeOutCirc as cc, easeOutCubic as cd, easeOutElastic as ce, easeOutExpo as cf, easeOutQuad as cg, easeOutQuart as ch, easeOutQuint as ci, easeOutSine as cj, enterTextEditAction as ck, evaluate as cl, evaluateEnabled as cm, isLayerPainted as cn, isLayerVisible as co, linear as cp, rebaseLocalPose as cq, registerContentHandler as cr, resolveEasing as cs, resolveParams as ct, sliceAction as cu, specificity as cv, translateRectPose as cw, useAction as cx, useActionsRegistry as cy, useActiveToolContext as cz, type RuleCtx as d, type ChromeCtx as e, type ChromeId as f, type ViewAnimationOptions as g, type DepSchema as h, type ActionsRegistry as i, type AffordanceHit as j, type Dispatcher as k, type ToolDef as l, type ViewportToolDef as m, type AnyTool as n, type ToolKeybinding as o, type OngoingOverlay as p, type ChromeState as q, type SelectionApi as r, type InsertExtras as s, type ContentHandlerEntry as t, type SvgIngestOptions as u, type ActionsProp as v, type Animator as w, type Affordance as x, type AffordanceRegion as y, type AffordanceBinding as z };
@@ -1,6 +1,6 @@
1
- import { M as Mesh } from './stroke-B_BxktoE.js';
2
- export { I as IDENTITY_COLOR_MATRIX, a as ImageMinification, R as RenderTarget, S as ShaderCompileError, b as SpriteSheet, c as StrokeOptions, V as ViewLike, W as WeaselRenderer, d as WeaselRendererOptions, e as buildGradientRamp, f as frameRect, t as tessellateStroke, v as viewToMat3 } from './stroke-B_BxktoE.js';
3
- export { D as DrawCommand, G as GroupDrawCommand, I as ImageDrawCommand, M as Mat3, P as PathDrawCommand, S as ShaderDrawCommand, a as ShaderProgramHandle, b as ShaderUniform, c as SolidPaint, T as TextDrawCommand, m as mat3, r as registerProgram } from './DrawCommand-b-z1bCT-.js';
1
+ import { M as Mesh } from './stroke-Dq8nL4A2.js';
2
+ export { I as IDENTITY_COLOR_MATRIX, a as ImageMinification, R as RenderTarget, S as ShaderCompileError, b as SpriteSheet, c as StrokeOptions, V as ViewLike, W as WeaselRenderer, d as WeaselRendererOptions, e as buildGradientRamp, f as frameRect, t as tessellateStroke, v as viewToMat3 } from './stroke-Dq8nL4A2.js';
3
+ export { D as DrawCommand, G as GroupDrawCommand, I as ImageDrawCommand, M as Mat3, P as PathDrawCommand, S as SPRITE_STRIDE, a as ShaderDrawCommand, b as ShaderProgramHandle, c as ShaderUniform, d as SolidPaint, e as SpritesDrawCommand, T as TextDrawCommand, m as mat3, r as registerProgram } from './DrawCommand-Ch8W63oQ.js';
4
4
  import { P as Path } from './path-JEV2c5If.js';
5
5
  export { canQueryLocalFonts, enableLocalFontOutlines, hasFontOutlines, isCanvasFont, listFontOutlines, outlineStatus, registerCanvasFont, registerFont, registerFontOutlines, subscribeGlyphReady, unregisterCanvasFont, unregisterFontOutlines } from '@weasel-js/font';
6
6
  import { TextureHandle } from '@weasel-js/paint';
package/dist/renderer.js CHANGED
@@ -1,5 +1,5 @@
1
- export { IDENTITY_COLOR_MATRIX, OUTLINE_MIN_SCREEN_PX, ShaderCompileError, WeaselRenderer, buildGradientRamp, canQueryLocalFonts, enableLocalFontOutlines, frameRect, hasFontOutlines, isCanvasFont, listFontOutlines, mat3, outlineStatus, registerCanvasFont, registerFont, registerFontOutlines, registerProgram, subscribeGlyphReady, tessellate, tessellateStroke, unregisterCanvasFont, unregisterFontOutlines, viewToMat3 } from './chunk-HYJL7OOJ.js';
2
- import './chunk-UTIFY2UU.js';
1
+ export { IDENTITY_COLOR_MATRIX, OUTLINE_MIN_SCREEN_PX, SPRITE_STRIDE, ShaderCompileError, WeaselRenderer, buildGradientRamp, canQueryLocalFonts, enableLocalFontOutlines, frameRect, hasFontOutlines, isCanvasFont, listFontOutlines, mat3, outlineStatus, registerCanvasFont, registerFont, registerFontOutlines, registerProgram, subscribeGlyphReady, tessellate, tessellateStroke, unregisterCanvasFont, unregisterFontOutlines, viewToMat3 } from './chunk-NU7D64RL.js';
2
+ import './chunk-TORKRNFY.js';
3
3
  import './chunk-Y5KS66G7.js';
4
4
  import './chunk-BLJNRMKB.js';
5
5
  import './chunk-SBFC6J3C.js';
package/dist/routing.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ParsedModifiers, GestureName, GestureSpec } from '@weasel-js/gestures';
2
2
  export { ChannelRef, DescribeRouteOptions, GESTURE_DESCRIPTORS, GestureArgSpec, GestureDescriptor, GestureName, ModRequirement, ModifierKey, ParsedModifiers, ParsedRoute, PhaseAtom, RESERVED_ID_NAMES, RESERVED_ID_PREFIXES, ROUTE_FIELD_DEFINITIONS, ROUTE_TERMS, RouteDescriptionPart, RouteFieldName, RouteTermLabel, canonicalModifiers, collapseShiftPairs, describeRoute, describeRouteParts, formatPhaseAtom, formatRoute, getGestureDescriptor, isKnownGestureName, parseRoute } from '@weasel-js/gestures';
3
- import { T as Tool } from './registry-CxSEyDka.js';
3
+ import { T as Tool } from './registry-BwY_DxJM.js';
4
4
  import './types-DIQAisSG.js';
5
5
  import '@weasel-js/history';
6
6
  import './path-JEV2c5If.js';
@@ -9,7 +9,7 @@ import './types-XBcDEp3Y.js';
9
9
  import './view-DSQgxBJB.js';
10
10
  import '@weasel-js/modes';
11
11
  import 'react';
12
- import './DrawCommand-b-z1bCT-.js';
12
+ import './DrawCommand-Ch8W63oQ.js';
13
13
  import '@weasel-js/paint';
14
14
  import '@weasel-js/text';
15
15
  import './geometry-Dtt_k6Dq.js';
package/dist/routing.js CHANGED
@@ -1,3 +1,3 @@
1
- export { GESTURE_DESCRIPTORS, PREDICATE_TARGET, RESERVED_ID_NAMES, RESERVED_ID_PREFIXES, ROUTE_FIELD_DEFINITIONS, ROUTE_TERMS, buildRouteRegistry, canonicalModifiers, collapseShiftPairs, describeRoute, describeRouteParts, findConflicts, formatPhaseAtom, formatRoute, getGestureDescriptor, isKnownGestureName, parseRoute, routeGestureForSpecKind, routesForSpec } from './chunk-UTIFY2UU.js';
1
+ export { GESTURE_DESCRIPTORS, PREDICATE_TARGET, RESERVED_ID_NAMES, RESERVED_ID_PREFIXES, ROUTE_FIELD_DEFINITIONS, ROUTE_TERMS, buildRouteRegistry, canonicalModifiers, collapseShiftPairs, describeRoute, describeRouteParts, findConflicts, formatPhaseAtom, formatRoute, getGestureDescriptor, isKnownGestureName, parseRoute, routeGestureForSpecKind, routesForSpec } from './chunk-TORKRNFY.js';
2
2
  //# sourceMappingURL=routing.js.map
3
3
  //# sourceMappingURL=routing.js.map
@@ -1,5 +1,5 @@
1
1
  import { GradStop, Stroke } from '@weasel-js/paint';
2
- import { M as Mat3, a as ShaderProgramHandle, D as DrawCommand } from './DrawCommand-b-z1bCT-.js';
2
+ import { M as Mat3, b as ShaderProgramHandle, D as DrawCommand } from './DrawCommand-Ch8W63oQ.js';
3
3
  import { P as Path } from './path-JEV2c5If.js';
4
4
 
5
5
  /**
@@ -343,6 +343,67 @@ declare class SolidBatch {
343
343
  private deleteSet;
344
344
  }
345
345
 
346
+ /**
347
+ * Growable vertex staging for consecutive image quads.
348
+ *
349
+ * Geometry only: `draw.ts` owns when a run starts, what breaks it, and the
350
+ * uniforms the flush draws under. The counterpart to `SolidBatch`, and the same
351
+ * two tricks — the model transform is applied here rather than uploaded, so
352
+ * quads under different group transforms still share a draw, and opacity rides
353
+ * the vertices, so quads under different opacities do too. What it cannot
354
+ * absorb is the texture: a batch samples one, which is why an atlas is what
355
+ * makes a large run coalesce at all.
356
+ *
357
+ * Every run is quads, so a slot's index buffer is written once at creation and
358
+ * never again: the pattern for N quads is a prefix of the pattern for any
359
+ * larger N, so the pattern for a slot's capacity serves every flush it takes.
360
+ * `SolidBatch` carries meshes, whose indices are rebased per flush, and has to
361
+ * re-upload; this does not.
362
+ */
363
+
364
+ declare class ImageBatch {
365
+ private readonly gl;
366
+ private readonly aPos;
367
+ private readonly aUv;
368
+ private readonly aOpacity;
369
+ /** One ring per tier, cycled per flush. Slots are created on first use, so a
370
+ * renderer that flushes rarely allocates as few as it flushes. */
371
+ private readonly rings;
372
+ private readonly nextInRing;
373
+ /** For flushes past the largest tier; these sets grow to fit. */
374
+ private readonly largeRing;
375
+ private nextLarge;
376
+ private verts;
377
+ private nQuads;
378
+ constructor(gl: WebGL2RenderingContext, prog: ShaderProgram);
379
+ /** Indices staged — what a caller passes to `drawElements`. */
380
+ get length(): number;
381
+ get quads(): number;
382
+ /** Whether staging one more quad would put the run past the per-flush cap. */
383
+ wouldOverflow(): boolean;
384
+ /**
385
+ * Append one image quad: the destination rect `(x, y, w, h)` mapped through
386
+ * `m`, sampling `(u0, v0)`-`(u1, v1)`, every corner carrying `opacity`.
387
+ *
388
+ * An affine maps a rect to a parallelogram, so two triangles still cover it
389
+ * and the batch draws at `u_model` identity. Corners wind top-left,
390
+ * top-right, bottom-right, bottom-left, with UVs following — the flips a
391
+ * command asks for are already in the `u`/`v` the caller passes.
392
+ */
393
+ pushQuad(x: number, y: number, w: number, h: number, m: Mat3, u0: number, v0: number, u1: number, v1: number, opacity: number): void;
394
+ /** Upload the staged geometry into the next set of buffers and bind its VAO.
395
+ * Returns the index count for the caller's `drawElements`. */
396
+ uploadAndBind(): number;
397
+ reset(): void;
398
+ dispose(): void;
399
+ /** Grow the CPU arrays so one more quad fits. */
400
+ private reserve;
401
+ private nextRingSlot;
402
+ private nextLargeSlot;
403
+ private createSet;
404
+ private deleteSet;
405
+ }
406
+
346
407
  /** How to construct a `WeaselRenderer`: the GL context or canvas to draw
347
408
  * into, the output size, and the quality knobs that separate screen
348
409
  * rendering from print. */
@@ -412,6 +473,7 @@ declare class WeaselRenderer {
412
473
  private textSdf;
413
474
  private textSdfR8;
414
475
  private imageFill;
476
+ private imageFillVOpacity;
415
477
  private gradFill;
416
478
  private patternFill;
417
479
  private meshCache;
@@ -422,6 +484,7 @@ declare class WeaselRenderer {
422
484
  private quadVbo;
423
485
  private quadIbo;
424
486
  private solidBatch;
487
+ private imageBatch;
425
488
  private readonly groupState;
426
489
  private widthCss;
427
490
  private heightCss;
@@ -515,9 +578,11 @@ declare class WeaselRenderer {
515
578
  /** @internal */ _pathFill(): ShaderProgram;
516
579
  /** @internal */ _pathFillVColor(): ShaderProgram;
517
580
  /** @internal */ _solidBatch(): SolidBatch;
581
+ /** @internal */ _imageBatch(): ImageBatch;
518
582
  /** @internal */ _textSdf(): ShaderProgram;
519
583
  /** @internal */ _textSdfR8(): ShaderProgram;
520
584
  /** @internal */ _imageFill(): ShaderProgram;
585
+ /** @internal */ _imageFillVOpacity(): ShaderProgram;
521
586
  /** @internal */ _gradFill(): ShaderProgram;
522
587
  /** @internal */ _patternFill(): ShaderProgram;
523
588
  /** @internal */ _meshCache(): GLMeshCache;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weasel-js/core",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
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",
@@ -72,16 +72,16 @@
72
72
  },
73
73
  "peerDependencies": {
74
74
  "react": ">=18",
75
- "@weasel-js/font": "1.4.0"
75
+ "@weasel-js/font": "1.4.1"
76
76
  },
77
77
  "dependencies": {
78
- "@weasel-js/cursor": "1.4.0",
79
- "@weasel-js/geom": "1.4.0",
80
- "@weasel-js/gestures": "1.4.0",
81
- "@weasel-js/history": "1.4.0",
82
- "@weasel-js/modes": "1.4.0",
83
- "@weasel-js/paint": "1.4.0",
84
- "@weasel-js/text": "1.4.0",
78
+ "@weasel-js/cursor": "1.4.1",
79
+ "@weasel-js/geom": "1.4.1",
80
+ "@weasel-js/gestures": "1.4.1",
81
+ "@weasel-js/history": "1.4.1",
82
+ "@weasel-js/modes": "1.4.1",
83
+ "@weasel-js/paint": "1.4.1",
84
+ "@weasel-js/text": "1.4.1",
85
85
  "earcut": "2.2.4",
86
86
  "polygon-clipping": "^0.15.7"
87
87
  },