@grida/hud 0.2.3 → 0.3.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.
@@ -1,4 +1,4 @@
1
- import { a as HUDPaintStripes, f as HUDSemanticGroup, r as HUDPaint, t as HUDDraw } from "./types-3wwFisZs.mjs";
1
+ import { a as HUDPaintStripes, f as HUDSemanticGroup, r as HUDPaint, s as HUDPolyline, t as HUDDraw, u as HUDScreenRect } from "./types-3wwFisZs.mjs";
2
2
  import { i as RotationCorner, n as CursorRenderer, r as ResizeDirection, t as CursorIcon } from "./cursor-CxS8EMvm.mjs";
3
3
  import cmath from "@grida/cmath";
4
4
  import { Measurement } from "@grida/cmath/_measurement";
@@ -384,8 +384,22 @@ type SurfaceGesture = {
384
384
  * AABB + matrix so resize math runs in the rotated/skewed local frame.
385
385
  */
386
386
  initial_shape: SelectionShape; /** Anchor (pointer-down) in document-space. */
387
- anchor_doc: cmath.Vector2; /** Current shape during the gesture. Same kind as `initial_shape`. */
387
+ anchor_doc: cmath.Vector2;
388
+ /** Most-recent pointer position in document-space (= `anchor_doc`
389
+ * until the first move). Lets a mid-drag modifier toggle recompute
390
+ * `preview_shape` from the live delta without a pointer move. */
391
+ last_doc: cmath.Vector2;
392
+ /** Current shape during the gesture. Same kind as `initial_shape`.
393
+ * Opposite-anchored — feeds the emitted `resize` intent (move +
394
+ * commit). The host derives its own anchor (e.g. Alt → center)
395
+ * from these dims, so this MUST stay opposite-anchored. */
388
396
  current_shape: SelectionShape;
397
+ /** Shape to DRAW for the dashed preview. Equals `current_shape`
398
+ * except under Alt, where it is symmetric about the initial
399
+ * center so the dashed box matches where a center-anchoring host
400
+ * lands the artwork (otherwise the preview visibly lags the
401
+ * actual result). Visual only — never emitted on an intent. */
402
+ preview_shape: SelectionShape;
389
403
  } | {
390
404
  kind: "rotate";
391
405
  ids: NodeId[];
@@ -2820,6 +2834,109 @@ declare function buildTransformBox(input: {
2820
2834
  active_op?: TransformBoxActiveOp;
2821
2835
  }): OverlayElement[];
2822
2836
  //#endregion
2837
+ //#region classes/text-edit/input.d.ts
2838
+ /**
2839
+ * Caret as two LOCAL endpoints (top, bottom) — NOT a position + height. Two
2840
+ * endpoints let the `transform` tilt/scale the caret as a true affine of a
2841
+ * line segment, which a `{x, top, height}` triple cannot. This is the honest
2842
+ * shape for rotated text and the future per-run textPath case; the common
2843
+ * axis-aligned caret maps trivially (`top=[x, m.top]`, `bottom=[x, m.top+h]`).
2844
+ *
2845
+ * @unstable
2846
+ */
2847
+ interface TextEditCaret {
2848
+ /** Caret top endpoint, local space. */
2849
+ top: cmath.Vector2;
2850
+ /** Caret bottom endpoint, local space. */
2851
+ bottom: cmath.Vector2;
2852
+ }
2853
+ /** One selection-highlight rect in LOCAL space. @unstable */
2854
+ interface TextEditSelectionRect {
2855
+ x: number;
2856
+ y: number;
2857
+ width: number;
2858
+ height: number;
2859
+ }
2860
+ /** Optional visual overrides; the builder supplies defaults when absent. @unstable */
2861
+ interface TextEditChromeStyle {
2862
+ /** Caret fill color. Default `#2563eb`. */
2863
+ caretColor?: string;
2864
+ /** Caret on-screen thickness in CSS px (zoom-independent). Default 1.5. */
2865
+ caretScreenWidth?: number;
2866
+ /** Selection fill color. Default `#2563eb`. */
2867
+ selectionColor?: string;
2868
+ /** Selection fill opacity, 0–1. Default 0.25. */
2869
+ selectionOpacity?: number;
2870
+ }
2871
+ /**
2872
+ * Host-pushed text-edit chrome (caret + selection highlights). All geometry
2873
+ * is LOCAL; `transform` maps local → world/doc. The HUD composes `transform`
2874
+ * with its own camera (world → screen) at draw time, so the chrome places
2875
+ * correctly under arbitrary affines (rotated text, nested `<g>` transforms).
2876
+ *
2877
+ * This is the focused generalization that anticipates `<textPath>` WITHOUT
2878
+ * per-glyph path-following: a textPath host emits per-run caret/rects in each
2879
+ * run's local frame and the same composition applies. A single affine cannot
2880
+ * express a curved baseline — that remains out of scope.
2881
+ *
2882
+ * Schema-level feature flag — pass `null` to `setTextEditChrome` to disable.
2883
+ * The caret blinks via the host re-pushing with a flipped `caretVisible`.
2884
+ *
2885
+ * @unstable
2886
+ */
2887
+ interface TextEditChromeInput {
2888
+ /** local → world/doc affine. cmath.Transform is a full 2×3 (carries shear). */
2889
+ transform: cmath.Transform;
2890
+ /** Caret geometry; omit when there is no caret (e.g. read-only highlight). */
2891
+ caret?: TextEditCaret;
2892
+ /** Caret blink/visibility. The caret draws only when `caret` is set AND this is true. */
2893
+ caretVisible?: boolean;
2894
+ /** Selection-highlight rects, local space. Empty/omitted = no selection. */
2895
+ selectionRects?: readonly TextEditSelectionRect[];
2896
+ /** Visual overrides; builder defaults when absent. */
2897
+ style?: TextEditChromeStyle;
2898
+ /**
2899
+ * Optional semantic group for the visibility policy. Stamped on every
2900
+ * emitted primitive so a host can suppress the whole chrome atomically.
2901
+ * Default: always rendered while set (the active edit locus has no gesture
2902
+ * during which you'd want it hidden).
2903
+ */
2904
+ group?: HUDSemanticGroup;
2905
+ }
2906
+ //#endregion
2907
+ //#region classes/text-edit/surface.d.ts
2908
+ /** On-screen caret thickness in CSS px — zoom-independent by construction. */
2909
+ declare const DEFAULT_CARET_SCREEN_WIDTH = 1.5;
2910
+ /**
2911
+ * The primitives the text-edit chrome contributes to a frame. Decoration-only,
2912
+ * so this is raw draw primitives (not `OverlayElement`s with hit regions):
2913
+ *
2914
+ * - `polylines` — selection fills, doc-space polygons (the HUD applies the
2915
+ * camera). Merge into the decoration `polylines` band.
2916
+ * - `screenRects` — the caret, a screen-sized rect anchored at a doc point.
2917
+ * Merge into the `screenRects` band (above the selection box → never occluded).
2918
+ */
2919
+ interface TextEditChromeDraw {
2920
+ polylines: HUDPolyline[];
2921
+ screenRects: HUDScreenRect[];
2922
+ }
2923
+ /**
2924
+ * Build the per-frame text-edit chrome.
2925
+ *
2926
+ * Composition mirrors `chrome.ts:pushTransformedChrome`:
2927
+ * `local_to_screen = multiply(camera, chrome.transform)`. The selection rects
2928
+ * project to doc space via `chrome.transform` (the HUD applies the camera when
2929
+ * painting); the caret anchor projects the same way, while its on-screen
2930
+ * length + angle come from `local_to_screen` so the bar tracks the projected
2931
+ * glyph height and rotates with the text.
2932
+ *
2933
+ * @param camera the HUD's world→screen transform (`state.getTransform()`).
2934
+ */
2935
+ declare function buildTextEditChrome(input: {
2936
+ chrome: TextEditChromeInput;
2937
+ camera: cmath.Transform;
2938
+ }): TextEditChromeDraw;
2939
+ //#endregion
2823
2940
  //#region surface/surface.d.ts
2824
2941
  interface SurfaceVisibilityContext {
2825
2942
  gesture: SurfaceGesture;
@@ -2976,6 +3093,12 @@ declare class Surface {
2976
3093
  * `setPaddingOverlay`.
2977
3094
  */
2978
3095
  private paddingOverlay;
3096
+ /**
3097
+ * Text-edit chrome input (caret + selection). `null` = no chrome drawn.
3098
+ * Hosts push on inline content-edit (and on every caret move / blink tick /
3099
+ * selection change / camera change); clear on exit. See `setTextEditChrome`.
3100
+ */
3101
+ private textEditChrome;
2979
3102
  private colorOverride;
2980
3103
  private width;
2981
3104
  private height;
@@ -3078,6 +3201,26 @@ declare class Surface {
3078
3201
  * paint/hit/priority details.
3079
3202
  */
3080
3203
  setPaddingOverlay(input: PaddingOverlayInput | null): void;
3204
+ /**
3205
+ * Configure or clear the built-in text-edit chrome — caret + selection
3206
+ * highlights for inline text content-edit. `null` = no chrome drawn
3207
+ * (schema-level feature flag).
3208
+ *
3209
+ * One atomic setter (not separate setCaret / setSelection): caret and
3210
+ * selection are one visual state of one editing session, and a blink tick
3211
+ * only flips `caretVisible` while the selection is unchanged — re-pushing
3212
+ * the whole struct keeps the two from tearing across frames and matches the
3213
+ * Skia `TextEditingDecorations` model. Re-push on every caret move /
3214
+ * selection change / blink tick / camera change. The host owns redraw
3215
+ * timing (this only stores state; `draw()` paints it next frame).
3216
+ *
3217
+ * The caret is drawn ABOVE the selection box (it's a screen-sized rect in
3218
+ * the screenRects band) at a constant on-screen thickness, so it is never
3219
+ * occluded and never scales with zoom. See `@grida/hud/classes/text-edit`.
3220
+ *
3221
+ * @unstable
3222
+ */
3223
+ setTextEditChrome(input: TextEditChromeInput | null): void;
3081
3224
  /**
3082
3225
  * Push a transform-box input — the `transform-box` named class for
3083
3226
  * a 2×3 affine transform manipulated via quad outline + 4 corners +
@@ -3212,4 +3355,4 @@ declare class Surface {
3212
3355
  private registerParametricHandleHitRegions;
3213
3356
  }
3214
3357
  //#endregion
3215
- export { ResolvedPaint as $, DEFAULT_RULER_OVERLAP_THRESHOLD as $t, TransformBoxHover as A, cornerRadiusLayoutGroups as At, Modifiers as B, TransformBoxCorners as Bt, MIN_CHROME_VISIBLE_SIZE as C, DEFAULT_CORNER_RADIUS_HANDLE_SIZE as Ct, VectorHover as D, cornerRadiusAnchorSign as Dt, RenderShape as E, computeCornerRadiusLayout as Et, TapHandler as F, SurfaceGesture as Ft, lassoToHUDDraw as G, getTransformBoxCorners as Gt, PointerButton as H, compose as Ht, TapOutcome as I, SelectionGroup as It, snapGuideToHUDDraw as J, DEFAULT_RULER_ACCENT_COLOR as Jt, marqueeToHUDDraw as K, reduceTransformBox as Kt, Intent as L, SelectionShape as Lt, PaddingHover as M, resolveCenterDragAnchor as Mt, PaddingOverlayInput as N, resolveCornerDragAnchor as Nt, VectorSubSelection as O, cornerRadiusHandlePosLine as Ot, HUDStyle as P, Rect as Pt, DEFAULT_STRIPES_THICKNESS_PX as Q, DEFAULT_RULER_FONT as Qt, IntentPhase as R, AffineTransform as Rt, HitShape as S, DEFAULT_CORNER_RADIUS_HANDLE_INSET as St, OverlayElement as T, DrawCornerRadiusParams as Tt, SurfaceEvent as U, cornersToBoxTransform as Ut, NO_MODS as V, TransformBoxOptions as Vt, SurfaceResponse as W, decompose as Wt, DEFAULT_STRIPES_ANGLE_DEG as X, DEFAULT_RULER_COLOR as Xt, filterHUDDrawByGroup as Y, DEFAULT_RULER_BACKGROUND as Yt, DEFAULT_STRIPES_SPACING_PX as Z, DEFAULT_RULER_DRAG_THRESHOLD as Zt, PADDING_HANDLE_PRIORITY as _, resolveParametricHandleByDirection as _t, SurfaceVisibilityPolicy as a, RulerAxis as an, DEFAULT_PARAMETRIC_HANDLE_INSET as at, VectorOverlay as b, CornerRadiusInput as bt, VectorSelectionMode as c, RulerRange as cn, DrawParametricHandlesParams as ct, TRANSFORM_BOX_CORNER_HIT_SIZE as d, DEFAULT_PIXEL_GRID_STEPS as dn, ParametricHandleInput as dt, DEFAULT_RULER_STEPS as en, buildStripesTile as et, TRANSFORM_BOX_CORNER_PRIORITY as f, DrawPixelGridParams as fn, ParametricHandleLayout as ft, PADDING_HANDLE_LENGTH as g, projectParametricHandleValue as gt, buildPaddingOverlay as h, parametricHandleLayoutGroups as ht, SurfaceVisibilityContext as i, DrawRulerParams as in, HUDCanvasOptions as it, TransformBoxInput as j, drawCornerRadius as jt, TransformBoxActiveOp as k, cornerRadiusHandlePosRect as kt, buildTransformBox as l, drawRuler as ln, ParametricHandle as lt, TRANSFORM_BOX_SIDE_PRIORITY as m, drawPixelGrid as mn, drawParametricHandles as mt, SurfaceOptions as n, DEFAULT_RULER_TEXT_SIDE_OFFSET as nn, resolvePaint as nt, VectorBendMode as o, RulerConfig as on, DEFAULT_PARAMETRIC_HANDLE_SIZE as ot, TRANSFORM_BOX_SIDE_HIT_THICKNESS as p, PixelGridConfig as pn, computeParametricHandleLayout as pt, measurementToHUDDraw as q, DEFAULT_RULER_ACCENT_BACKGROUND as qt, SurfaceVisibility as r, DEFAULT_RULER_TICK_HEIGHT as rn, HUDCanvas as rt, VectorInsertionMode as s, RulerMark as sn, DEFAULT_PARAMETRIC_HIT_SIZE as st, Surface as t, DEFAULT_RULER_STRIP as tn, computeStripesTileGeometry as tt, TRANSFORM_BOX_BODY_PRIORITY as u, DEFAULT_PIXEL_GRID_COLOR as un, ParametricHandleGroup as ut, PADDING_HANDLE_THICKNESS as v, CornerRadiusAnchor as vt, MIN_HIT_SIZE as w, DEFAULT_CORNER_RADIUS_HIT_SIZE as wt, SurfaceChromeGroups as x, CornerRadiusRectangular as xt, PADDING_REGION_PRIORITY as y, CornerRadiusHandleLayout as yt, SelectMode as z, TransformBoxAction as zt };
3358
+ export { marqueeToHUDDraw as $, reduceTransformBox as $t, MIN_CHROME_VISIBLE_SIZE as A, DEFAULT_CORNER_RADIUS_HANDLE_SIZE as At, PaddingOverlayInput as B, resolveCornerDragAnchor as Bt, PADDING_HANDLE_LENGTH as C, projectParametricHandleValue as Ct, VectorOverlay as D, CornerRadiusInput as Dt, PADDING_REGION_PRIORITY as E, CornerRadiusHandleLayout as Et, VectorSubSelection as F, cornerRadiusHandlePosLine as Ft, IntentPhase as G, AffineTransform as Gt, TapHandler as H, SurfaceGesture as Ht, TransformBoxActiveOp as I, cornerRadiusHandlePosRect as It, NO_MODS as J, TransformBoxOptions as Jt, SelectMode as K, TransformBoxAction as Kt, TransformBoxHover as L, cornerRadiusLayoutGroups as Lt, OverlayElement as M, DrawCornerRadiusParams as Mt, RenderShape as N, computeCornerRadiusLayout as Nt, SurfaceChromeGroups as O, CornerRadiusRectangular as Ot, VectorHover as P, cornerRadiusAnchorSign as Pt, lassoToHUDDraw as Q, getTransformBoxCorners as Qt, TransformBoxInput as R, drawCornerRadius as Rt, buildPaddingOverlay as S, parametricHandleLayoutGroups as St, PADDING_HANDLE_THICKNESS as T, CornerRadiusAnchor as Tt, TapOutcome as U, SelectionGroup as Ut, HUDStyle as V, Rect as Vt, Intent as W, SelectionShape as Wt, SurfaceEvent as X, cornersToBoxTransform as Xt, PointerButton as Y, compose as Yt, SurfaceResponse as Z, decompose as Zt, TRANSFORM_BOX_BODY_PRIORITY as _, DEFAULT_PIXEL_GRID_COLOR as _n, ParametricHandleGroup as _t, SurfaceVisibilityPolicy as a, DEFAULT_RULER_FONT as an, DEFAULT_STRIPES_THICKNESS_PX as at, TRANSFORM_BOX_SIDE_HIT_THICKNESS as b, PixelGridConfig as bn, computeParametricHandleLayout as bt, VectorSelectionMode as c, DEFAULT_RULER_STRIP as cn, computeStripesTileGeometry as ct, buildTextEditChrome as d, DrawRulerParams as dn, HUDCanvasOptions as dt, DEFAULT_RULER_ACCENT_BACKGROUND as en, measurementToHUDDraw as et, TextEditCaret as f, RulerAxis as fn, DEFAULT_PARAMETRIC_HANDLE_INSET as ft, buildTransformBox as g, drawRuler as gn, ParametricHandle as gt, TextEditSelectionRect as h, RulerRange as hn, DrawParametricHandlesParams as ht, SurfaceVisibilityContext as i, DEFAULT_RULER_DRAG_THRESHOLD as in, DEFAULT_STRIPES_SPACING_PX as it, MIN_HIT_SIZE as j, DEFAULT_CORNER_RADIUS_HIT_SIZE as jt, HitShape as k, DEFAULT_CORNER_RADIUS_HANDLE_INSET as kt, DEFAULT_CARET_SCREEN_WIDTH as l, DEFAULT_RULER_TEXT_SIDE_OFFSET as ln, resolvePaint as lt, TextEditChromeStyle as m, RulerMark as mn, DEFAULT_PARAMETRIC_HIT_SIZE as mt, SurfaceOptions as n, DEFAULT_RULER_BACKGROUND as nn, filterHUDDrawByGroup as nt, VectorBendMode as o, DEFAULT_RULER_OVERLAP_THRESHOLD as on, ResolvedPaint as ot, TextEditChromeInput as p, RulerConfig as pn, DEFAULT_PARAMETRIC_HANDLE_SIZE as pt, Modifiers as q, TransformBoxCorners as qt, SurfaceVisibility as r, DEFAULT_RULER_COLOR as rn, DEFAULT_STRIPES_ANGLE_DEG as rt, VectorInsertionMode as s, DEFAULT_RULER_STEPS as sn, buildStripesTile as st, Surface as t, DEFAULT_RULER_ACCENT_COLOR as tn, snapGuideToHUDDraw as tt, TextEditChromeDraw as u, DEFAULT_RULER_TICK_HEIGHT as un, HUDCanvas as ut, TRANSFORM_BOX_CORNER_HIT_SIZE as v, DEFAULT_PIXEL_GRID_STEPS as vn, ParametricHandleInput as vt, PADDING_HANDLE_PRIORITY as w, resolveParametricHandleByDirection as wt, TRANSFORM_BOX_SIDE_PRIORITY as x, drawPixelGrid as xn, drawParametricHandles as xt, TRANSFORM_BOX_CORNER_PRIORITY as y, DrawPixelGridParams as yn, ParametricHandleLayout as yt, PaddingHover as z, resolveCenterDragAnchor as zt };
@@ -1,4 +1,4 @@
1
- import { a as HUDPaintStripes, f as HUDSemanticGroup, r as HUDPaint, t as HUDDraw } from "./types-3wwFisZs.js";
1
+ import { a as HUDPaintStripes, f as HUDSemanticGroup, r as HUDPaint, s as HUDPolyline, t as HUDDraw, u as HUDScreenRect } from "./types-3wwFisZs.js";
2
2
  import { i as RotationCorner, n as CursorRenderer, r as ResizeDirection, t as CursorIcon } from "./cursor-CxS8EMvm.js";
3
3
  import cmath from "@grida/cmath";
4
4
  import { guide } from "@grida/cmath/_snap";
@@ -384,8 +384,22 @@ type SurfaceGesture = {
384
384
  * AABB + matrix so resize math runs in the rotated/skewed local frame.
385
385
  */
386
386
  initial_shape: SelectionShape; /** Anchor (pointer-down) in document-space. */
387
- anchor_doc: cmath.Vector2; /** Current shape during the gesture. Same kind as `initial_shape`. */
387
+ anchor_doc: cmath.Vector2;
388
+ /** Most-recent pointer position in document-space (= `anchor_doc`
389
+ * until the first move). Lets a mid-drag modifier toggle recompute
390
+ * `preview_shape` from the live delta without a pointer move. */
391
+ last_doc: cmath.Vector2;
392
+ /** Current shape during the gesture. Same kind as `initial_shape`.
393
+ * Opposite-anchored — feeds the emitted `resize` intent (move +
394
+ * commit). The host derives its own anchor (e.g. Alt → center)
395
+ * from these dims, so this MUST stay opposite-anchored. */
388
396
  current_shape: SelectionShape;
397
+ /** Shape to DRAW for the dashed preview. Equals `current_shape`
398
+ * except under Alt, where it is symmetric about the initial
399
+ * center so the dashed box matches where a center-anchoring host
400
+ * lands the artwork (otherwise the preview visibly lags the
401
+ * actual result). Visual only — never emitted on an intent. */
402
+ preview_shape: SelectionShape;
389
403
  } | {
390
404
  kind: "rotate";
391
405
  ids: NodeId[];
@@ -2820,6 +2834,109 @@ declare function buildTransformBox(input: {
2820
2834
  active_op?: TransformBoxActiveOp;
2821
2835
  }): OverlayElement[];
2822
2836
  //#endregion
2837
+ //#region classes/text-edit/input.d.ts
2838
+ /**
2839
+ * Caret as two LOCAL endpoints (top, bottom) — NOT a position + height. Two
2840
+ * endpoints let the `transform` tilt/scale the caret as a true affine of a
2841
+ * line segment, which a `{x, top, height}` triple cannot. This is the honest
2842
+ * shape for rotated text and the future per-run textPath case; the common
2843
+ * axis-aligned caret maps trivially (`top=[x, m.top]`, `bottom=[x, m.top+h]`).
2844
+ *
2845
+ * @unstable
2846
+ */
2847
+ interface TextEditCaret {
2848
+ /** Caret top endpoint, local space. */
2849
+ top: cmath.Vector2;
2850
+ /** Caret bottom endpoint, local space. */
2851
+ bottom: cmath.Vector2;
2852
+ }
2853
+ /** One selection-highlight rect in LOCAL space. @unstable */
2854
+ interface TextEditSelectionRect {
2855
+ x: number;
2856
+ y: number;
2857
+ width: number;
2858
+ height: number;
2859
+ }
2860
+ /** Optional visual overrides; the builder supplies defaults when absent. @unstable */
2861
+ interface TextEditChromeStyle {
2862
+ /** Caret fill color. Default `#2563eb`. */
2863
+ caretColor?: string;
2864
+ /** Caret on-screen thickness in CSS px (zoom-independent). Default 1.5. */
2865
+ caretScreenWidth?: number;
2866
+ /** Selection fill color. Default `#2563eb`. */
2867
+ selectionColor?: string;
2868
+ /** Selection fill opacity, 0–1. Default 0.25. */
2869
+ selectionOpacity?: number;
2870
+ }
2871
+ /**
2872
+ * Host-pushed text-edit chrome (caret + selection highlights). All geometry
2873
+ * is LOCAL; `transform` maps local → world/doc. The HUD composes `transform`
2874
+ * with its own camera (world → screen) at draw time, so the chrome places
2875
+ * correctly under arbitrary affines (rotated text, nested `<g>` transforms).
2876
+ *
2877
+ * This is the focused generalization that anticipates `<textPath>` WITHOUT
2878
+ * per-glyph path-following: a textPath host emits per-run caret/rects in each
2879
+ * run's local frame and the same composition applies. A single affine cannot
2880
+ * express a curved baseline — that remains out of scope.
2881
+ *
2882
+ * Schema-level feature flag — pass `null` to `setTextEditChrome` to disable.
2883
+ * The caret blinks via the host re-pushing with a flipped `caretVisible`.
2884
+ *
2885
+ * @unstable
2886
+ */
2887
+ interface TextEditChromeInput {
2888
+ /** local → world/doc affine. cmath.Transform is a full 2×3 (carries shear). */
2889
+ transform: cmath.Transform;
2890
+ /** Caret geometry; omit when there is no caret (e.g. read-only highlight). */
2891
+ caret?: TextEditCaret;
2892
+ /** Caret blink/visibility. The caret draws only when `caret` is set AND this is true. */
2893
+ caretVisible?: boolean;
2894
+ /** Selection-highlight rects, local space. Empty/omitted = no selection. */
2895
+ selectionRects?: readonly TextEditSelectionRect[];
2896
+ /** Visual overrides; builder defaults when absent. */
2897
+ style?: TextEditChromeStyle;
2898
+ /**
2899
+ * Optional semantic group for the visibility policy. Stamped on every
2900
+ * emitted primitive so a host can suppress the whole chrome atomically.
2901
+ * Default: always rendered while set (the active edit locus has no gesture
2902
+ * during which you'd want it hidden).
2903
+ */
2904
+ group?: HUDSemanticGroup;
2905
+ }
2906
+ //#endregion
2907
+ //#region classes/text-edit/surface.d.ts
2908
+ /** On-screen caret thickness in CSS px — zoom-independent by construction. */
2909
+ declare const DEFAULT_CARET_SCREEN_WIDTH = 1.5;
2910
+ /**
2911
+ * The primitives the text-edit chrome contributes to a frame. Decoration-only,
2912
+ * so this is raw draw primitives (not `OverlayElement`s with hit regions):
2913
+ *
2914
+ * - `polylines` — selection fills, doc-space polygons (the HUD applies the
2915
+ * camera). Merge into the decoration `polylines` band.
2916
+ * - `screenRects` — the caret, a screen-sized rect anchored at a doc point.
2917
+ * Merge into the `screenRects` band (above the selection box → never occluded).
2918
+ */
2919
+ interface TextEditChromeDraw {
2920
+ polylines: HUDPolyline[];
2921
+ screenRects: HUDScreenRect[];
2922
+ }
2923
+ /**
2924
+ * Build the per-frame text-edit chrome.
2925
+ *
2926
+ * Composition mirrors `chrome.ts:pushTransformedChrome`:
2927
+ * `local_to_screen = multiply(camera, chrome.transform)`. The selection rects
2928
+ * project to doc space via `chrome.transform` (the HUD applies the camera when
2929
+ * painting); the caret anchor projects the same way, while its on-screen
2930
+ * length + angle come from `local_to_screen` so the bar tracks the projected
2931
+ * glyph height and rotates with the text.
2932
+ *
2933
+ * @param camera the HUD's world→screen transform (`state.getTransform()`).
2934
+ */
2935
+ declare function buildTextEditChrome(input: {
2936
+ chrome: TextEditChromeInput;
2937
+ camera: cmath.Transform;
2938
+ }): TextEditChromeDraw;
2939
+ //#endregion
2823
2940
  //#region surface/surface.d.ts
2824
2941
  interface SurfaceVisibilityContext {
2825
2942
  gesture: SurfaceGesture;
@@ -2976,6 +3093,12 @@ declare class Surface {
2976
3093
  * `setPaddingOverlay`.
2977
3094
  */
2978
3095
  private paddingOverlay;
3096
+ /**
3097
+ * Text-edit chrome input (caret + selection). `null` = no chrome drawn.
3098
+ * Hosts push on inline content-edit (and on every caret move / blink tick /
3099
+ * selection change / camera change); clear on exit. See `setTextEditChrome`.
3100
+ */
3101
+ private textEditChrome;
2979
3102
  private colorOverride;
2980
3103
  private width;
2981
3104
  private height;
@@ -3078,6 +3201,26 @@ declare class Surface {
3078
3201
  * paint/hit/priority details.
3079
3202
  */
3080
3203
  setPaddingOverlay(input: PaddingOverlayInput | null): void;
3204
+ /**
3205
+ * Configure or clear the built-in text-edit chrome — caret + selection
3206
+ * highlights for inline text content-edit. `null` = no chrome drawn
3207
+ * (schema-level feature flag).
3208
+ *
3209
+ * One atomic setter (not separate setCaret / setSelection): caret and
3210
+ * selection are one visual state of one editing session, and a blink tick
3211
+ * only flips `caretVisible` while the selection is unchanged — re-pushing
3212
+ * the whole struct keeps the two from tearing across frames and matches the
3213
+ * Skia `TextEditingDecorations` model. Re-push on every caret move /
3214
+ * selection change / blink tick / camera change. The host owns redraw
3215
+ * timing (this only stores state; `draw()` paints it next frame).
3216
+ *
3217
+ * The caret is drawn ABOVE the selection box (it's a screen-sized rect in
3218
+ * the screenRects band) at a constant on-screen thickness, so it is never
3219
+ * occluded and never scales with zoom. See `@grida/hud/classes/text-edit`.
3220
+ *
3221
+ * @unstable
3222
+ */
3223
+ setTextEditChrome(input: TextEditChromeInput | null): void;
3081
3224
  /**
3082
3225
  * Push a transform-box input — the `transform-box` named class for
3083
3226
  * a 2×3 affine transform manipulated via quad outline + 4 corners +
@@ -3212,4 +3355,4 @@ declare class Surface {
3212
3355
  private registerParametricHandleHitRegions;
3213
3356
  }
3214
3357
  //#endregion
3215
- export { ResolvedPaint as $, DEFAULT_RULER_OVERLAP_THRESHOLD as $t, TransformBoxHover as A, cornerRadiusLayoutGroups as At, Modifiers as B, TransformBoxCorners as Bt, MIN_CHROME_VISIBLE_SIZE as C, DEFAULT_CORNER_RADIUS_HANDLE_SIZE as Ct, VectorHover as D, cornerRadiusAnchorSign as Dt, RenderShape as E, computeCornerRadiusLayout as Et, TapHandler as F, SurfaceGesture as Ft, lassoToHUDDraw as G, getTransformBoxCorners as Gt, PointerButton as H, compose as Ht, TapOutcome as I, SelectionGroup as It, snapGuideToHUDDraw as J, DEFAULT_RULER_ACCENT_COLOR as Jt, marqueeToHUDDraw as K, reduceTransformBox as Kt, Intent as L, SelectionShape as Lt, PaddingHover as M, resolveCenterDragAnchor as Mt, PaddingOverlayInput as N, resolveCornerDragAnchor as Nt, VectorSubSelection as O, cornerRadiusHandlePosLine as Ot, HUDStyle as P, Rect as Pt, DEFAULT_STRIPES_THICKNESS_PX as Q, DEFAULT_RULER_FONT as Qt, IntentPhase as R, AffineTransform as Rt, HitShape as S, DEFAULT_CORNER_RADIUS_HANDLE_INSET as St, OverlayElement as T, DrawCornerRadiusParams as Tt, SurfaceEvent as U, cornersToBoxTransform as Ut, NO_MODS as V, TransformBoxOptions as Vt, SurfaceResponse as W, decompose as Wt, DEFAULT_STRIPES_ANGLE_DEG as X, DEFAULT_RULER_COLOR as Xt, filterHUDDrawByGroup as Y, DEFAULT_RULER_BACKGROUND as Yt, DEFAULT_STRIPES_SPACING_PX as Z, DEFAULT_RULER_DRAG_THRESHOLD as Zt, PADDING_HANDLE_PRIORITY as _, resolveParametricHandleByDirection as _t, SurfaceVisibilityPolicy as a, RulerAxis as an, DEFAULT_PARAMETRIC_HANDLE_INSET as at, VectorOverlay as b, CornerRadiusInput as bt, VectorSelectionMode as c, RulerRange as cn, DrawParametricHandlesParams as ct, TRANSFORM_BOX_CORNER_HIT_SIZE as d, DEFAULT_PIXEL_GRID_STEPS as dn, ParametricHandleInput as dt, DEFAULT_RULER_STEPS as en, buildStripesTile as et, TRANSFORM_BOX_CORNER_PRIORITY as f, DrawPixelGridParams as fn, ParametricHandleLayout as ft, PADDING_HANDLE_LENGTH as g, projectParametricHandleValue as gt, buildPaddingOverlay as h, parametricHandleLayoutGroups as ht, SurfaceVisibilityContext as i, DrawRulerParams as in, HUDCanvasOptions as it, TransformBoxInput as j, drawCornerRadius as jt, TransformBoxActiveOp as k, cornerRadiusHandlePosRect as kt, buildTransformBox as l, drawRuler as ln, ParametricHandle as lt, TRANSFORM_BOX_SIDE_PRIORITY as m, drawPixelGrid as mn, drawParametricHandles as mt, SurfaceOptions as n, DEFAULT_RULER_TEXT_SIDE_OFFSET as nn, resolvePaint as nt, VectorBendMode as o, RulerConfig as on, DEFAULT_PARAMETRIC_HANDLE_SIZE as ot, TRANSFORM_BOX_SIDE_HIT_THICKNESS as p, PixelGridConfig as pn, computeParametricHandleLayout as pt, measurementToHUDDraw as q, DEFAULT_RULER_ACCENT_BACKGROUND as qt, SurfaceVisibility as r, DEFAULT_RULER_TICK_HEIGHT as rn, HUDCanvas as rt, VectorInsertionMode as s, RulerMark as sn, DEFAULT_PARAMETRIC_HIT_SIZE as st, Surface as t, DEFAULT_RULER_STRIP as tn, computeStripesTileGeometry as tt, TRANSFORM_BOX_BODY_PRIORITY as u, DEFAULT_PIXEL_GRID_COLOR as un, ParametricHandleGroup as ut, PADDING_HANDLE_THICKNESS as v, CornerRadiusAnchor as vt, MIN_HIT_SIZE as w, DEFAULT_CORNER_RADIUS_HIT_SIZE as wt, SurfaceChromeGroups as x, CornerRadiusRectangular as xt, PADDING_REGION_PRIORITY as y, CornerRadiusHandleLayout as yt, SelectMode as z, TransformBoxAction as zt };
3358
+ export { marqueeToHUDDraw as $, reduceTransformBox as $t, MIN_CHROME_VISIBLE_SIZE as A, DEFAULT_CORNER_RADIUS_HANDLE_SIZE as At, PaddingOverlayInput as B, resolveCornerDragAnchor as Bt, PADDING_HANDLE_LENGTH as C, projectParametricHandleValue as Ct, VectorOverlay as D, CornerRadiusInput as Dt, PADDING_REGION_PRIORITY as E, CornerRadiusHandleLayout as Et, VectorSubSelection as F, cornerRadiusHandlePosLine as Ft, IntentPhase as G, AffineTransform as Gt, TapHandler as H, SurfaceGesture as Ht, TransformBoxActiveOp as I, cornerRadiusHandlePosRect as It, NO_MODS as J, TransformBoxOptions as Jt, SelectMode as K, TransformBoxAction as Kt, TransformBoxHover as L, cornerRadiusLayoutGroups as Lt, OverlayElement as M, DrawCornerRadiusParams as Mt, RenderShape as N, computeCornerRadiusLayout as Nt, SurfaceChromeGroups as O, CornerRadiusRectangular as Ot, VectorHover as P, cornerRadiusAnchorSign as Pt, lassoToHUDDraw as Q, getTransformBoxCorners as Qt, TransformBoxInput as R, drawCornerRadius as Rt, buildPaddingOverlay as S, parametricHandleLayoutGroups as St, PADDING_HANDLE_THICKNESS as T, CornerRadiusAnchor as Tt, TapOutcome as U, SelectionGroup as Ut, HUDStyle as V, Rect as Vt, Intent as W, SelectionShape as Wt, SurfaceEvent as X, cornersToBoxTransform as Xt, PointerButton as Y, compose as Yt, SurfaceResponse as Z, decompose as Zt, TRANSFORM_BOX_BODY_PRIORITY as _, DEFAULT_PIXEL_GRID_COLOR as _n, ParametricHandleGroup as _t, SurfaceVisibilityPolicy as a, DEFAULT_RULER_FONT as an, DEFAULT_STRIPES_THICKNESS_PX as at, TRANSFORM_BOX_SIDE_HIT_THICKNESS as b, PixelGridConfig as bn, computeParametricHandleLayout as bt, VectorSelectionMode as c, DEFAULT_RULER_STRIP as cn, computeStripesTileGeometry as ct, buildTextEditChrome as d, DrawRulerParams as dn, HUDCanvasOptions as dt, DEFAULT_RULER_ACCENT_BACKGROUND as en, measurementToHUDDraw as et, TextEditCaret as f, RulerAxis as fn, DEFAULT_PARAMETRIC_HANDLE_INSET as ft, buildTransformBox as g, drawRuler as gn, ParametricHandle as gt, TextEditSelectionRect as h, RulerRange as hn, DrawParametricHandlesParams as ht, SurfaceVisibilityContext as i, DEFAULT_RULER_DRAG_THRESHOLD as in, DEFAULT_STRIPES_SPACING_PX as it, MIN_HIT_SIZE as j, DEFAULT_CORNER_RADIUS_HIT_SIZE as jt, HitShape as k, DEFAULT_CORNER_RADIUS_HANDLE_INSET as kt, DEFAULT_CARET_SCREEN_WIDTH as l, DEFAULT_RULER_TEXT_SIDE_OFFSET as ln, resolvePaint as lt, TextEditChromeStyle as m, RulerMark as mn, DEFAULT_PARAMETRIC_HIT_SIZE as mt, SurfaceOptions as n, DEFAULT_RULER_BACKGROUND as nn, filterHUDDrawByGroup as nt, VectorBendMode as o, DEFAULT_RULER_OVERLAP_THRESHOLD as on, ResolvedPaint as ot, TextEditChromeInput as p, RulerConfig as pn, DEFAULT_PARAMETRIC_HANDLE_SIZE as pt, Modifiers as q, TransformBoxCorners as qt, SurfaceVisibility as r, DEFAULT_RULER_COLOR as rn, DEFAULT_STRIPES_ANGLE_DEG as rt, VectorInsertionMode as s, DEFAULT_RULER_STEPS as sn, buildStripesTile as st, Surface as t, DEFAULT_RULER_ACCENT_COLOR as tn, snapGuideToHUDDraw as tt, TextEditChromeDraw as u, DEFAULT_RULER_TICK_HEIGHT as un, HUDCanvas as ut, TRANSFORM_BOX_CORNER_HIT_SIZE as v, DEFAULT_PIXEL_GRID_STEPS as vn, ParametricHandleInput as vt, PADDING_HANDLE_PRIORITY as w, resolveParametricHandleByDirection as wt, TRANSFORM_BOX_SIDE_PRIORITY as x, drawPixelGrid as xn, drawParametricHandles as xt, TRANSFORM_BOX_CORNER_PRIORITY as y, DrawPixelGridParams as yn, ParametricHandleLayout as yt, PaddingHover as z, resolveCenterDragAnchor as zt };
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as HUDPaintStripes, c as HUDRect, d as HUDSemantic, f as HUDSemanticGroup, i as HUDPaintSolid, l as HUDRule, n as HUDLine, o as HUDPoint, r as HUDPaint, s as HUDPolyline, t as HUDDraw, u as HUDScreenRect } from "./types-3wwFisZs.mjs";
2
2
  import { a as cursorEquals, i as RotationCorner, n as CursorRenderer, o as cursorToCss, r as ResizeDirection, t as CursorIcon } from "./cursor-CxS8EMvm.mjs";
3
- import { $ as ResolvedPaint, $t as DEFAULT_RULER_OVERLAP_THRESHOLD, A as TransformBoxHover, At as cornerRadiusLayoutGroups, B as Modifiers, Bt as TransformBoxCorners, C as MIN_CHROME_VISIBLE_SIZE, Ct as DEFAULT_CORNER_RADIUS_HANDLE_SIZE, D as VectorHover, Dt as cornerRadiusAnchorSign, E as RenderShape, Et as computeCornerRadiusLayout, F as TapHandler, Ft as SurfaceGesture, G as lassoToHUDDraw, Gt as getTransformBoxCorners, H as PointerButton, Ht as compose, I as TapOutcome, It as SelectionGroup, J as snapGuideToHUDDraw, Jt as DEFAULT_RULER_ACCENT_COLOR, K as marqueeToHUDDraw, Kt as reduceTransformBox, L as Intent, Lt as SelectionShape, M as PaddingHover, Mt as resolveCenterDragAnchor, N as PaddingOverlayInput, Nt as resolveCornerDragAnchor, O as VectorSubSelection, Ot as cornerRadiusHandlePosLine, P as HUDStyle, Pt as Rect, Q as DEFAULT_STRIPES_THICKNESS_PX, Qt as DEFAULT_RULER_FONT, R as IntentPhase, Rt as AffineTransform, S as HitShape, St as DEFAULT_CORNER_RADIUS_HANDLE_INSET, T as OverlayElement, Tt as DrawCornerRadiusParams, U as SurfaceEvent, Ut as cornersToBoxTransform, V as NO_MODS, Vt as TransformBoxOptions, W as SurfaceResponse, Wt as decompose, X as DEFAULT_STRIPES_ANGLE_DEG, Xt as DEFAULT_RULER_COLOR, Y as filterHUDDrawByGroup, Yt as DEFAULT_RULER_BACKGROUND, Z as DEFAULT_STRIPES_SPACING_PX, Zt as DEFAULT_RULER_DRAG_THRESHOLD, _ as PADDING_HANDLE_PRIORITY, _t as resolveParametricHandleByDirection, a as SurfaceVisibilityPolicy, an as RulerAxis, at as DEFAULT_PARAMETRIC_HANDLE_INSET, b as VectorOverlay, bt as CornerRadiusInput, c as VectorSelectionMode, cn as RulerRange, ct as DrawParametricHandlesParams, d as TRANSFORM_BOX_CORNER_HIT_SIZE, dn as DEFAULT_PIXEL_GRID_STEPS, dt as ParametricHandleInput, en as DEFAULT_RULER_STEPS, et as buildStripesTile, f as TRANSFORM_BOX_CORNER_PRIORITY, fn as DrawPixelGridParams, ft as ParametricHandleLayout, g as PADDING_HANDLE_LENGTH, gt as projectParametricHandleValue, h as buildPaddingOverlay, ht as parametricHandleLayoutGroups, i as SurfaceVisibilityContext, in as DrawRulerParams, it as HUDCanvasOptions, j as TransformBoxInput, jt as drawCornerRadius, k as TransformBoxActiveOp, kt as cornerRadiusHandlePosRect, l as buildTransformBox, ln as drawRuler, lt as ParametricHandle, m as TRANSFORM_BOX_SIDE_PRIORITY, mn as drawPixelGrid, mt as drawParametricHandles, n as SurfaceOptions, nn as DEFAULT_RULER_TEXT_SIDE_OFFSET, nt as resolvePaint, o as VectorBendMode, on as RulerConfig, ot as DEFAULT_PARAMETRIC_HANDLE_SIZE, p as TRANSFORM_BOX_SIDE_HIT_THICKNESS, pn as PixelGridConfig, pt as computeParametricHandleLayout, q as measurementToHUDDraw, qt as DEFAULT_RULER_ACCENT_BACKGROUND, r as SurfaceVisibility, rn as DEFAULT_RULER_TICK_HEIGHT, rt as HUDCanvas, s as VectorInsertionMode, sn as RulerMark, st as DEFAULT_PARAMETRIC_HIT_SIZE, t as Surface, tn as DEFAULT_RULER_STRIP, tt as computeStripesTileGeometry, u as TRANSFORM_BOX_BODY_PRIORITY, un as DEFAULT_PIXEL_GRID_COLOR, ut as ParametricHandleGroup, v as PADDING_HANDLE_THICKNESS, vt as CornerRadiusAnchor, w as MIN_HIT_SIZE, wt as DEFAULT_CORNER_RADIUS_HIT_SIZE, x as SurfaceChromeGroups, xt as CornerRadiusRectangular, y as PADDING_REGION_PRIORITY, yt as CornerRadiusHandleLayout, z as SelectMode, zt as TransformBoxAction } from "./index-BQtDtpHM.mjs";
3
+ import { $ as marqueeToHUDDraw, $t as reduceTransformBox, A as MIN_CHROME_VISIBLE_SIZE, At as DEFAULT_CORNER_RADIUS_HANDLE_SIZE, B as PaddingOverlayInput, Bt as resolveCornerDragAnchor, C as PADDING_HANDLE_LENGTH, Ct as projectParametricHandleValue, D as VectorOverlay, Dt as CornerRadiusInput, E as PADDING_REGION_PRIORITY, Et as CornerRadiusHandleLayout, F as VectorSubSelection, Ft as cornerRadiusHandlePosLine, G as IntentPhase, Gt as AffineTransform, H as TapHandler, Ht as SurfaceGesture, I as TransformBoxActiveOp, It as cornerRadiusHandlePosRect, J as NO_MODS, Jt as TransformBoxOptions, K as SelectMode, Kt as TransformBoxAction, L as TransformBoxHover, Lt as cornerRadiusLayoutGroups, M as OverlayElement, Mt as DrawCornerRadiusParams, N as RenderShape, Nt as computeCornerRadiusLayout, O as SurfaceChromeGroups, Ot as CornerRadiusRectangular, P as VectorHover, Pt as cornerRadiusAnchorSign, Q as lassoToHUDDraw, Qt as getTransformBoxCorners, R as TransformBoxInput, Rt as drawCornerRadius, S as buildPaddingOverlay, St as parametricHandleLayoutGroups, T as PADDING_HANDLE_THICKNESS, Tt as CornerRadiusAnchor, U as TapOutcome, Ut as SelectionGroup, V as HUDStyle, Vt as Rect, W as Intent, Wt as SelectionShape, X as SurfaceEvent, Xt as cornersToBoxTransform, Y as PointerButton, Yt as compose, Z as SurfaceResponse, Zt as decompose, _ as TRANSFORM_BOX_BODY_PRIORITY, _n as DEFAULT_PIXEL_GRID_COLOR, _t as ParametricHandleGroup, a as SurfaceVisibilityPolicy, an as DEFAULT_RULER_FONT, at as DEFAULT_STRIPES_THICKNESS_PX, b as TRANSFORM_BOX_SIDE_HIT_THICKNESS, bn as PixelGridConfig, bt as computeParametricHandleLayout, c as VectorSelectionMode, cn as DEFAULT_RULER_STRIP, ct as computeStripesTileGeometry, d as buildTextEditChrome, dn as DrawRulerParams, dt as HUDCanvasOptions, en as DEFAULT_RULER_ACCENT_BACKGROUND, et as measurementToHUDDraw, f as TextEditCaret, fn as RulerAxis, ft as DEFAULT_PARAMETRIC_HANDLE_INSET, g as buildTransformBox, gn as drawRuler, gt as ParametricHandle, h as TextEditSelectionRect, hn as RulerRange, ht as DrawParametricHandlesParams, i as SurfaceVisibilityContext, in as DEFAULT_RULER_DRAG_THRESHOLD, it as DEFAULT_STRIPES_SPACING_PX, j as MIN_HIT_SIZE, jt as DEFAULT_CORNER_RADIUS_HIT_SIZE, k as HitShape, kt as DEFAULT_CORNER_RADIUS_HANDLE_INSET, l as DEFAULT_CARET_SCREEN_WIDTH, ln as DEFAULT_RULER_TEXT_SIDE_OFFSET, lt as resolvePaint, m as TextEditChromeStyle, mn as RulerMark, mt as DEFAULT_PARAMETRIC_HIT_SIZE, n as SurfaceOptions, nn as DEFAULT_RULER_BACKGROUND, nt as filterHUDDrawByGroup, o as VectorBendMode, on as DEFAULT_RULER_OVERLAP_THRESHOLD, ot as ResolvedPaint, p as TextEditChromeInput, pn as RulerConfig, pt as DEFAULT_PARAMETRIC_HANDLE_SIZE, q as Modifiers, qt as TransformBoxCorners, r as SurfaceVisibility, rn as DEFAULT_RULER_COLOR, rt as DEFAULT_STRIPES_ANGLE_DEG, s as VectorInsertionMode, sn as DEFAULT_RULER_STEPS, st as buildStripesTile, t as Surface, tn as DEFAULT_RULER_ACCENT_COLOR, tt as snapGuideToHUDDraw, u as TextEditChromeDraw, un as DEFAULT_RULER_TICK_HEIGHT, ut as HUDCanvas, v as TRANSFORM_BOX_CORNER_HIT_SIZE, vn as DEFAULT_PIXEL_GRID_STEPS, vt as ParametricHandleInput, w as PADDING_HANDLE_PRIORITY, wt as resolveParametricHandleByDirection, x as TRANSFORM_BOX_SIDE_PRIORITY, xn as drawPixelGrid, xt as drawParametricHandles, y as TRANSFORM_BOX_CORNER_PRIORITY, yn as DrawPixelGridParams, yt as ParametricHandleLayout, z as PaddingHover, zt as resolveCenterDragAnchor } from "./index-Df4QB6Yr.mjs";
4
4
 
5
5
  //#region event/selection-controls.d.ts
6
6
  declare const HUDHitPriority: {
@@ -104,4 +104,4 @@ declare function computeSelectionControlLayout(rect_screen: Rect, opts: {
104
104
  show_rotation: boolean;
105
105
  }): SelectionControlLayout;
106
106
  //#endregion
107
- export { type AffineTransform, BODY_FLIP_THRESHOLD, type CornerRadiusAnchor, type CornerRadiusHandleLayout, type CornerRadiusInput, type CornerRadiusRectangular, type CursorIcon, type CursorRenderer, DEFAULT_CORNER_RADIUS_HANDLE_INSET, DEFAULT_CORNER_RADIUS_HANDLE_SIZE, DEFAULT_CORNER_RADIUS_HIT_SIZE, DEFAULT_PARAMETRIC_HANDLE_INSET, DEFAULT_PARAMETRIC_HANDLE_SIZE, DEFAULT_PARAMETRIC_HIT_SIZE, DEFAULT_PIXEL_GRID_COLOR, DEFAULT_PIXEL_GRID_STEPS, DEFAULT_RULER_ACCENT_BACKGROUND, DEFAULT_RULER_ACCENT_COLOR, DEFAULT_RULER_BACKGROUND, DEFAULT_RULER_COLOR, DEFAULT_RULER_DRAG_THRESHOLD, DEFAULT_RULER_FONT, DEFAULT_RULER_OVERLAP_THRESHOLD, DEFAULT_RULER_STEPS, DEFAULT_RULER_STRIP, DEFAULT_RULER_TEXT_SIDE_OFFSET, DEFAULT_RULER_TICK_HEIGHT, DEFAULT_STRIPES_ANGLE_DEG, DEFAULT_STRIPES_SPACING_PX, DEFAULT_STRIPES_THICKNESS_PX, type DrawCornerRadiusParams, type DrawParametricHandlesParams, type DrawPixelGridParams, type DrawRulerParams, HUDCanvas, type HUDCanvasOptions, type HUDDraw, HUDHitPriority, type HUDLine, type HUDPaint, type HUDPaintSolid, type HUDPaintStripes, type HUDPoint, type HUDPolyline, type HUDRect, type HUDRule, type HUDScreenRect, type HUDSemantic, type HUDSemanticGroup, type HUDStyle, type HitShape, type Intent, type IntentPhase, MIN_CHROME_VISIBLE_SIZE, MIN_GUARANTEED_INTERACTIVE_DIM, MIN_HIT_SIZE, type Modifiers, NO_MODS, type OverlayElement, PADDING_HANDLE_LENGTH, PADDING_HANDLE_PRIORITY, PADDING_HANDLE_THICKNESS, PADDING_REGION_PRIORITY, type PaddingHover, type PaddingOverlayInput, type ParametricHandle, type ParametricHandleGroup, type ParametricHandleInput, type ParametricHandleLayout, type PixelGridConfig, type PointerButton, type RenderShape, type ResizeDirection, type ResolvedPaint, type RotationCorner, type RulerAxis, type RulerConfig, type RulerMark, type RulerRange, type SelectMode, type SelectionControlLayout, type SelectionControlRole, type SelectionControlZone, type SelectionGroup, type SelectionShape, Surface, type SurfaceChromeGroups, type SurfaceEvent, type SurfaceGesture, type SurfaceOptions, type SurfaceResponse, type SurfaceVisibility, type SurfaceVisibilityContext, type SurfaceVisibilityPolicy, TRANSFORM_BOX_BODY_PRIORITY, TRANSFORM_BOX_CORNER_HIT_SIZE, TRANSFORM_BOX_CORNER_PRIORITY, TRANSFORM_BOX_SIDE_HIT_THICKNESS, TRANSFORM_BOX_SIDE_PRIORITY, type TapHandler, type TapOutcome, type TransformBoxAction, type TransformBoxActiveOp, type TransformBoxCorners, type TransformBoxHover, type TransformBoxInput, type TransformBoxOptions, type VectorBendMode, type VectorHover, type VectorInsertionMode, type VectorOverlay, type VectorSelectionMode, type VectorSubSelection, buildPaddingOverlay, buildStripesTile, buildTransformBox, compose as composeTransformBox, computeCornerRadiusLayout, computeParametricHandleLayout, computeSelectionControlLayout, computeStripesTileGeometry, cornerRadiusAnchorSign, cornerRadiusHandlePosLine, cornerRadiusHandlePosRect, cornerRadiusLayoutGroups, cornersToBoxTransform, cursorEquals, cursorToCss, decompose as decomposeTransformBox, drawCornerRadius, drawParametricHandles, drawPixelGrid, drawRuler, filterHUDDrawByGroup, getTransformBoxCorners, lassoToHUDDraw, marqueeToHUDDraw, measurementToHUDDraw, negotiateAxis, parametricHandleLayoutGroups, projectParametricHandleValue, reduceTransformBox, resolveCenterDragAnchor, resolveCornerDragAnchor, resolvePaint, resolveParametricHandleByDirection, snapGuideToHUDDraw };
107
+ export { type AffineTransform, BODY_FLIP_THRESHOLD, type CornerRadiusAnchor, type CornerRadiusHandleLayout, type CornerRadiusInput, type CornerRadiusRectangular, type CursorIcon, type CursorRenderer, DEFAULT_CARET_SCREEN_WIDTH, DEFAULT_CORNER_RADIUS_HANDLE_INSET, DEFAULT_CORNER_RADIUS_HANDLE_SIZE, DEFAULT_CORNER_RADIUS_HIT_SIZE, DEFAULT_PARAMETRIC_HANDLE_INSET, DEFAULT_PARAMETRIC_HANDLE_SIZE, DEFAULT_PARAMETRIC_HIT_SIZE, DEFAULT_PIXEL_GRID_COLOR, DEFAULT_PIXEL_GRID_STEPS, DEFAULT_RULER_ACCENT_BACKGROUND, DEFAULT_RULER_ACCENT_COLOR, DEFAULT_RULER_BACKGROUND, DEFAULT_RULER_COLOR, DEFAULT_RULER_DRAG_THRESHOLD, DEFAULT_RULER_FONT, DEFAULT_RULER_OVERLAP_THRESHOLD, DEFAULT_RULER_STEPS, DEFAULT_RULER_STRIP, DEFAULT_RULER_TEXT_SIDE_OFFSET, DEFAULT_RULER_TICK_HEIGHT, DEFAULT_STRIPES_ANGLE_DEG, DEFAULT_STRIPES_SPACING_PX, DEFAULT_STRIPES_THICKNESS_PX, type DrawCornerRadiusParams, type DrawParametricHandlesParams, type DrawPixelGridParams, type DrawRulerParams, HUDCanvas, type HUDCanvasOptions, type HUDDraw, HUDHitPriority, type HUDLine, type HUDPaint, type HUDPaintSolid, type HUDPaintStripes, type HUDPoint, type HUDPolyline, type HUDRect, type HUDRule, type HUDScreenRect, type HUDSemantic, type HUDSemanticGroup, type HUDStyle, type HitShape, type Intent, type IntentPhase, MIN_CHROME_VISIBLE_SIZE, MIN_GUARANTEED_INTERACTIVE_DIM, MIN_HIT_SIZE, type Modifiers, NO_MODS, type OverlayElement, PADDING_HANDLE_LENGTH, PADDING_HANDLE_PRIORITY, PADDING_HANDLE_THICKNESS, PADDING_REGION_PRIORITY, type PaddingHover, type PaddingOverlayInput, type ParametricHandle, type ParametricHandleGroup, type ParametricHandleInput, type ParametricHandleLayout, type PixelGridConfig, type PointerButton, type RenderShape, type ResizeDirection, type ResolvedPaint, type RotationCorner, type RulerAxis, type RulerConfig, type RulerMark, type RulerRange, type SelectMode, type SelectionControlLayout, type SelectionControlRole, type SelectionControlZone, type SelectionGroup, type SelectionShape, Surface, type SurfaceChromeGroups, type SurfaceEvent, type SurfaceGesture, type SurfaceOptions, type SurfaceResponse, type SurfaceVisibility, type SurfaceVisibilityContext, type SurfaceVisibilityPolicy, TRANSFORM_BOX_BODY_PRIORITY, TRANSFORM_BOX_CORNER_HIT_SIZE, TRANSFORM_BOX_CORNER_PRIORITY, TRANSFORM_BOX_SIDE_HIT_THICKNESS, TRANSFORM_BOX_SIDE_PRIORITY, type TapHandler, type TapOutcome, type TextEditCaret, type TextEditChromeDraw, type TextEditChromeInput, type TextEditChromeStyle, type TextEditSelectionRect, type TransformBoxAction, type TransformBoxActiveOp, type TransformBoxCorners, type TransformBoxHover, type TransformBoxInput, type TransformBoxOptions, type VectorBendMode, type VectorHover, type VectorInsertionMode, type VectorOverlay, type VectorSelectionMode, type VectorSubSelection, buildPaddingOverlay, buildStripesTile, buildTextEditChrome, buildTransformBox, compose as composeTransformBox, computeCornerRadiusLayout, computeParametricHandleLayout, computeSelectionControlLayout, computeStripesTileGeometry, cornerRadiusAnchorSign, cornerRadiusHandlePosLine, cornerRadiusHandlePosRect, cornerRadiusLayoutGroups, cornersToBoxTransform, cursorEquals, cursorToCss, decompose as decomposeTransformBox, drawCornerRadius, drawParametricHandles, drawPixelGrid, drawRuler, filterHUDDrawByGroup, getTransformBoxCorners, lassoToHUDDraw, marqueeToHUDDraw, measurementToHUDDraw, negotiateAxis, parametricHandleLayoutGroups, projectParametricHandleValue, reduceTransformBox, resolveCenterDragAnchor, resolveCornerDragAnchor, resolvePaint, resolveParametricHandleByDirection, snapGuideToHUDDraw };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as HUDPaintStripes, c as HUDRect, d as HUDSemantic, f as HUDSemanticGroup, i as HUDPaintSolid, l as HUDRule, n as HUDLine, o as HUDPoint, r as HUDPaint, s as HUDPolyline, t as HUDDraw, u as HUDScreenRect } from "./types-3wwFisZs.js";
2
2
  import { a as cursorEquals, i as RotationCorner, n as CursorRenderer, o as cursorToCss, r as ResizeDirection, t as CursorIcon } from "./cursor-CxS8EMvm.js";
3
- import { $ as ResolvedPaint, $t as DEFAULT_RULER_OVERLAP_THRESHOLD, A as TransformBoxHover, At as cornerRadiusLayoutGroups, B as Modifiers, Bt as TransformBoxCorners, C as MIN_CHROME_VISIBLE_SIZE, Ct as DEFAULT_CORNER_RADIUS_HANDLE_SIZE, D as VectorHover, Dt as cornerRadiusAnchorSign, E as RenderShape, Et as computeCornerRadiusLayout, F as TapHandler, Ft as SurfaceGesture, G as lassoToHUDDraw, Gt as getTransformBoxCorners, H as PointerButton, Ht as compose, I as TapOutcome, It as SelectionGroup, J as snapGuideToHUDDraw, Jt as DEFAULT_RULER_ACCENT_COLOR, K as marqueeToHUDDraw, Kt as reduceTransformBox, L as Intent, Lt as SelectionShape, M as PaddingHover, Mt as resolveCenterDragAnchor, N as PaddingOverlayInput, Nt as resolveCornerDragAnchor, O as VectorSubSelection, Ot as cornerRadiusHandlePosLine, P as HUDStyle, Pt as Rect, Q as DEFAULT_STRIPES_THICKNESS_PX, Qt as DEFAULT_RULER_FONT, R as IntentPhase, Rt as AffineTransform, S as HitShape, St as DEFAULT_CORNER_RADIUS_HANDLE_INSET, T as OverlayElement, Tt as DrawCornerRadiusParams, U as SurfaceEvent, Ut as cornersToBoxTransform, V as NO_MODS, Vt as TransformBoxOptions, W as SurfaceResponse, Wt as decompose, X as DEFAULT_STRIPES_ANGLE_DEG, Xt as DEFAULT_RULER_COLOR, Y as filterHUDDrawByGroup, Yt as DEFAULT_RULER_BACKGROUND, Z as DEFAULT_STRIPES_SPACING_PX, Zt as DEFAULT_RULER_DRAG_THRESHOLD, _ as PADDING_HANDLE_PRIORITY, _t as resolveParametricHandleByDirection, a as SurfaceVisibilityPolicy, an as RulerAxis, at as DEFAULT_PARAMETRIC_HANDLE_INSET, b as VectorOverlay, bt as CornerRadiusInput, c as VectorSelectionMode, cn as RulerRange, ct as DrawParametricHandlesParams, d as TRANSFORM_BOX_CORNER_HIT_SIZE, dn as DEFAULT_PIXEL_GRID_STEPS, dt as ParametricHandleInput, en as DEFAULT_RULER_STEPS, et as buildStripesTile, f as TRANSFORM_BOX_CORNER_PRIORITY, fn as DrawPixelGridParams, ft as ParametricHandleLayout, g as PADDING_HANDLE_LENGTH, gt as projectParametricHandleValue, h as buildPaddingOverlay, ht as parametricHandleLayoutGroups, i as SurfaceVisibilityContext, in as DrawRulerParams, it as HUDCanvasOptions, j as TransformBoxInput, jt as drawCornerRadius, k as TransformBoxActiveOp, kt as cornerRadiusHandlePosRect, l as buildTransformBox, ln as drawRuler, lt as ParametricHandle, m as TRANSFORM_BOX_SIDE_PRIORITY, mn as drawPixelGrid, mt as drawParametricHandles, n as SurfaceOptions, nn as DEFAULT_RULER_TEXT_SIDE_OFFSET, nt as resolvePaint, o as VectorBendMode, on as RulerConfig, ot as DEFAULT_PARAMETRIC_HANDLE_SIZE, p as TRANSFORM_BOX_SIDE_HIT_THICKNESS, pn as PixelGridConfig, pt as computeParametricHandleLayout, q as measurementToHUDDraw, qt as DEFAULT_RULER_ACCENT_BACKGROUND, r as SurfaceVisibility, rn as DEFAULT_RULER_TICK_HEIGHT, rt as HUDCanvas, s as VectorInsertionMode, sn as RulerMark, st as DEFAULT_PARAMETRIC_HIT_SIZE, t as Surface, tn as DEFAULT_RULER_STRIP, tt as computeStripesTileGeometry, u as TRANSFORM_BOX_BODY_PRIORITY, un as DEFAULT_PIXEL_GRID_COLOR, ut as ParametricHandleGroup, v as PADDING_HANDLE_THICKNESS, vt as CornerRadiusAnchor, w as MIN_HIT_SIZE, wt as DEFAULT_CORNER_RADIUS_HIT_SIZE, x as SurfaceChromeGroups, xt as CornerRadiusRectangular, y as PADDING_REGION_PRIORITY, yt as CornerRadiusHandleLayout, z as SelectMode, zt as TransformBoxAction } from "./index-BlfZbeEJ.js";
3
+ import { $ as marqueeToHUDDraw, $t as reduceTransformBox, A as MIN_CHROME_VISIBLE_SIZE, At as DEFAULT_CORNER_RADIUS_HANDLE_SIZE, B as PaddingOverlayInput, Bt as resolveCornerDragAnchor, C as PADDING_HANDLE_LENGTH, Ct as projectParametricHandleValue, D as VectorOverlay, Dt as CornerRadiusInput, E as PADDING_REGION_PRIORITY, Et as CornerRadiusHandleLayout, F as VectorSubSelection, Ft as cornerRadiusHandlePosLine, G as IntentPhase, Gt as AffineTransform, H as TapHandler, Ht as SurfaceGesture, I as TransformBoxActiveOp, It as cornerRadiusHandlePosRect, J as NO_MODS, Jt as TransformBoxOptions, K as SelectMode, Kt as TransformBoxAction, L as TransformBoxHover, Lt as cornerRadiusLayoutGroups, M as OverlayElement, Mt as DrawCornerRadiusParams, N as RenderShape, Nt as computeCornerRadiusLayout, O as SurfaceChromeGroups, Ot as CornerRadiusRectangular, P as VectorHover, Pt as cornerRadiusAnchorSign, Q as lassoToHUDDraw, Qt as getTransformBoxCorners, R as TransformBoxInput, Rt as drawCornerRadius, S as buildPaddingOverlay, St as parametricHandleLayoutGroups, T as PADDING_HANDLE_THICKNESS, Tt as CornerRadiusAnchor, U as TapOutcome, Ut as SelectionGroup, V as HUDStyle, Vt as Rect, W as Intent, Wt as SelectionShape, X as SurfaceEvent, Xt as cornersToBoxTransform, Y as PointerButton, Yt as compose, Z as SurfaceResponse, Zt as decompose, _ as TRANSFORM_BOX_BODY_PRIORITY, _n as DEFAULT_PIXEL_GRID_COLOR, _t as ParametricHandleGroup, a as SurfaceVisibilityPolicy, an as DEFAULT_RULER_FONT, at as DEFAULT_STRIPES_THICKNESS_PX, b as TRANSFORM_BOX_SIDE_HIT_THICKNESS, bn as PixelGridConfig, bt as computeParametricHandleLayout, c as VectorSelectionMode, cn as DEFAULT_RULER_STRIP, ct as computeStripesTileGeometry, d as buildTextEditChrome, dn as DrawRulerParams, dt as HUDCanvasOptions, en as DEFAULT_RULER_ACCENT_BACKGROUND, et as measurementToHUDDraw, f as TextEditCaret, fn as RulerAxis, ft as DEFAULT_PARAMETRIC_HANDLE_INSET, g as buildTransformBox, gn as drawRuler, gt as ParametricHandle, h as TextEditSelectionRect, hn as RulerRange, ht as DrawParametricHandlesParams, i as SurfaceVisibilityContext, in as DEFAULT_RULER_DRAG_THRESHOLD, it as DEFAULT_STRIPES_SPACING_PX, j as MIN_HIT_SIZE, jt as DEFAULT_CORNER_RADIUS_HIT_SIZE, k as HitShape, kt as DEFAULT_CORNER_RADIUS_HANDLE_INSET, l as DEFAULT_CARET_SCREEN_WIDTH, ln as DEFAULT_RULER_TEXT_SIDE_OFFSET, lt as resolvePaint, m as TextEditChromeStyle, mn as RulerMark, mt as DEFAULT_PARAMETRIC_HIT_SIZE, n as SurfaceOptions, nn as DEFAULT_RULER_BACKGROUND, nt as filterHUDDrawByGroup, o as VectorBendMode, on as DEFAULT_RULER_OVERLAP_THRESHOLD, ot as ResolvedPaint, p as TextEditChromeInput, pn as RulerConfig, pt as DEFAULT_PARAMETRIC_HANDLE_SIZE, q as Modifiers, qt as TransformBoxCorners, r as SurfaceVisibility, rn as DEFAULT_RULER_COLOR, rt as DEFAULT_STRIPES_ANGLE_DEG, s as VectorInsertionMode, sn as DEFAULT_RULER_STEPS, st as buildStripesTile, t as Surface, tn as DEFAULT_RULER_ACCENT_COLOR, tt as snapGuideToHUDDraw, u as TextEditChromeDraw, un as DEFAULT_RULER_TICK_HEIGHT, ut as HUDCanvas, v as TRANSFORM_BOX_CORNER_HIT_SIZE, vn as DEFAULT_PIXEL_GRID_STEPS, vt as ParametricHandleInput, w as PADDING_HANDLE_PRIORITY, wt as resolveParametricHandleByDirection, x as TRANSFORM_BOX_SIDE_PRIORITY, xn as drawPixelGrid, xt as drawParametricHandles, y as TRANSFORM_BOX_CORNER_PRIORITY, yn as DrawPixelGridParams, yt as ParametricHandleLayout, z as PaddingHover, zt as resolveCenterDragAnchor } from "./index-E7n0yPim.js";
4
4
 
5
5
  //#region event/selection-controls.d.ts
6
6
  declare const HUDHitPriority: {
@@ -104,4 +104,4 @@ declare function computeSelectionControlLayout(rect_screen: Rect, opts: {
104
104
  show_rotation: boolean;
105
105
  }): SelectionControlLayout;
106
106
  //#endregion
107
- export { type AffineTransform, BODY_FLIP_THRESHOLD, type CornerRadiusAnchor, type CornerRadiusHandleLayout, type CornerRadiusInput, type CornerRadiusRectangular, type CursorIcon, type CursorRenderer, DEFAULT_CORNER_RADIUS_HANDLE_INSET, DEFAULT_CORNER_RADIUS_HANDLE_SIZE, DEFAULT_CORNER_RADIUS_HIT_SIZE, DEFAULT_PARAMETRIC_HANDLE_INSET, DEFAULT_PARAMETRIC_HANDLE_SIZE, DEFAULT_PARAMETRIC_HIT_SIZE, DEFAULT_PIXEL_GRID_COLOR, DEFAULT_PIXEL_GRID_STEPS, DEFAULT_RULER_ACCENT_BACKGROUND, DEFAULT_RULER_ACCENT_COLOR, DEFAULT_RULER_BACKGROUND, DEFAULT_RULER_COLOR, DEFAULT_RULER_DRAG_THRESHOLD, DEFAULT_RULER_FONT, DEFAULT_RULER_OVERLAP_THRESHOLD, DEFAULT_RULER_STEPS, DEFAULT_RULER_STRIP, DEFAULT_RULER_TEXT_SIDE_OFFSET, DEFAULT_RULER_TICK_HEIGHT, DEFAULT_STRIPES_ANGLE_DEG, DEFAULT_STRIPES_SPACING_PX, DEFAULT_STRIPES_THICKNESS_PX, type DrawCornerRadiusParams, type DrawParametricHandlesParams, type DrawPixelGridParams, type DrawRulerParams, HUDCanvas, type HUDCanvasOptions, type HUDDraw, HUDHitPriority, type HUDLine, type HUDPaint, type HUDPaintSolid, type HUDPaintStripes, type HUDPoint, type HUDPolyline, type HUDRect, type HUDRule, type HUDScreenRect, type HUDSemantic, type HUDSemanticGroup, type HUDStyle, type HitShape, type Intent, type IntentPhase, MIN_CHROME_VISIBLE_SIZE, MIN_GUARANTEED_INTERACTIVE_DIM, MIN_HIT_SIZE, type Modifiers, NO_MODS, type OverlayElement, PADDING_HANDLE_LENGTH, PADDING_HANDLE_PRIORITY, PADDING_HANDLE_THICKNESS, PADDING_REGION_PRIORITY, type PaddingHover, type PaddingOverlayInput, type ParametricHandle, type ParametricHandleGroup, type ParametricHandleInput, type ParametricHandleLayout, type PixelGridConfig, type PointerButton, type RenderShape, type ResizeDirection, type ResolvedPaint, type RotationCorner, type RulerAxis, type RulerConfig, type RulerMark, type RulerRange, type SelectMode, type SelectionControlLayout, type SelectionControlRole, type SelectionControlZone, type SelectionGroup, type SelectionShape, Surface, type SurfaceChromeGroups, type SurfaceEvent, type SurfaceGesture, type SurfaceOptions, type SurfaceResponse, type SurfaceVisibility, type SurfaceVisibilityContext, type SurfaceVisibilityPolicy, TRANSFORM_BOX_BODY_PRIORITY, TRANSFORM_BOX_CORNER_HIT_SIZE, TRANSFORM_BOX_CORNER_PRIORITY, TRANSFORM_BOX_SIDE_HIT_THICKNESS, TRANSFORM_BOX_SIDE_PRIORITY, type TapHandler, type TapOutcome, type TransformBoxAction, type TransformBoxActiveOp, type TransformBoxCorners, type TransformBoxHover, type TransformBoxInput, type TransformBoxOptions, type VectorBendMode, type VectorHover, type VectorInsertionMode, type VectorOverlay, type VectorSelectionMode, type VectorSubSelection, buildPaddingOverlay, buildStripesTile, buildTransformBox, compose as composeTransformBox, computeCornerRadiusLayout, computeParametricHandleLayout, computeSelectionControlLayout, computeStripesTileGeometry, cornerRadiusAnchorSign, cornerRadiusHandlePosLine, cornerRadiusHandlePosRect, cornerRadiusLayoutGroups, cornersToBoxTransform, cursorEquals, cursorToCss, decompose as decomposeTransformBox, drawCornerRadius, drawParametricHandles, drawPixelGrid, drawRuler, filterHUDDrawByGroup, getTransformBoxCorners, lassoToHUDDraw, marqueeToHUDDraw, measurementToHUDDraw, negotiateAxis, parametricHandleLayoutGroups, projectParametricHandleValue, reduceTransformBox, resolveCenterDragAnchor, resolveCornerDragAnchor, resolvePaint, resolveParametricHandleByDirection, snapGuideToHUDDraw };
107
+ export { type AffineTransform, BODY_FLIP_THRESHOLD, type CornerRadiusAnchor, type CornerRadiusHandleLayout, type CornerRadiusInput, type CornerRadiusRectangular, type CursorIcon, type CursorRenderer, DEFAULT_CARET_SCREEN_WIDTH, DEFAULT_CORNER_RADIUS_HANDLE_INSET, DEFAULT_CORNER_RADIUS_HANDLE_SIZE, DEFAULT_CORNER_RADIUS_HIT_SIZE, DEFAULT_PARAMETRIC_HANDLE_INSET, DEFAULT_PARAMETRIC_HANDLE_SIZE, DEFAULT_PARAMETRIC_HIT_SIZE, DEFAULT_PIXEL_GRID_COLOR, DEFAULT_PIXEL_GRID_STEPS, DEFAULT_RULER_ACCENT_BACKGROUND, DEFAULT_RULER_ACCENT_COLOR, DEFAULT_RULER_BACKGROUND, DEFAULT_RULER_COLOR, DEFAULT_RULER_DRAG_THRESHOLD, DEFAULT_RULER_FONT, DEFAULT_RULER_OVERLAP_THRESHOLD, DEFAULT_RULER_STEPS, DEFAULT_RULER_STRIP, DEFAULT_RULER_TEXT_SIDE_OFFSET, DEFAULT_RULER_TICK_HEIGHT, DEFAULT_STRIPES_ANGLE_DEG, DEFAULT_STRIPES_SPACING_PX, DEFAULT_STRIPES_THICKNESS_PX, type DrawCornerRadiusParams, type DrawParametricHandlesParams, type DrawPixelGridParams, type DrawRulerParams, HUDCanvas, type HUDCanvasOptions, type HUDDraw, HUDHitPriority, type HUDLine, type HUDPaint, type HUDPaintSolid, type HUDPaintStripes, type HUDPoint, type HUDPolyline, type HUDRect, type HUDRule, type HUDScreenRect, type HUDSemantic, type HUDSemanticGroup, type HUDStyle, type HitShape, type Intent, type IntentPhase, MIN_CHROME_VISIBLE_SIZE, MIN_GUARANTEED_INTERACTIVE_DIM, MIN_HIT_SIZE, type Modifiers, NO_MODS, type OverlayElement, PADDING_HANDLE_LENGTH, PADDING_HANDLE_PRIORITY, PADDING_HANDLE_THICKNESS, PADDING_REGION_PRIORITY, type PaddingHover, type PaddingOverlayInput, type ParametricHandle, type ParametricHandleGroup, type ParametricHandleInput, type ParametricHandleLayout, type PixelGridConfig, type PointerButton, type RenderShape, type ResizeDirection, type ResolvedPaint, type RotationCorner, type RulerAxis, type RulerConfig, type RulerMark, type RulerRange, type SelectMode, type SelectionControlLayout, type SelectionControlRole, type SelectionControlZone, type SelectionGroup, type SelectionShape, Surface, type SurfaceChromeGroups, type SurfaceEvent, type SurfaceGesture, type SurfaceOptions, type SurfaceResponse, type SurfaceVisibility, type SurfaceVisibilityContext, type SurfaceVisibilityPolicy, TRANSFORM_BOX_BODY_PRIORITY, TRANSFORM_BOX_CORNER_HIT_SIZE, TRANSFORM_BOX_CORNER_PRIORITY, TRANSFORM_BOX_SIDE_HIT_THICKNESS, TRANSFORM_BOX_SIDE_PRIORITY, type TapHandler, type TapOutcome, type TextEditCaret, type TextEditChromeDraw, type TextEditChromeInput, type TextEditChromeStyle, type TextEditSelectionRect, type TransformBoxAction, type TransformBoxActiveOp, type TransformBoxCorners, type TransformBoxHover, type TransformBoxInput, type TransformBoxOptions, type VectorBendMode, type VectorHover, type VectorInsertionMode, type VectorOverlay, type VectorSelectionMode, type VectorSubSelection, buildPaddingOverlay, buildStripesTile, buildTextEditChrome, buildTransformBox, compose as composeTransformBox, computeCornerRadiusLayout, computeParametricHandleLayout, computeSelectionControlLayout, computeStripesTileGeometry, cornerRadiusAnchorSign, cornerRadiusHandlePosLine, cornerRadiusHandlePosRect, cornerRadiusLayoutGroups, cornersToBoxTransform, cursorEquals, cursorToCss, decompose as decomposeTransformBox, drawCornerRadius, drawParametricHandles, drawPixelGrid, drawRuler, filterHUDDrawByGroup, getTransformBoxCorners, lassoToHUDDraw, marqueeToHUDDraw, measurementToHUDDraw, negotiateAxis, parametricHandleLayoutGroups, projectParametricHandleValue, reduceTransformBox, resolveCenterDragAnchor, resolveCornerDragAnchor, resolvePaint, resolveParametricHandleByDirection, snapGuideToHUDDraw };
package/dist/index.js CHANGED
@@ -1,7 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_surface = require("./surface-D-Kt_jKx.js");
2
+ const require_surface = require("./surface-Bd6zw8O0.js");
3
3
  const require_cursor = require("./cursor-FGiJBdU-.js");
4
4
  exports.BODY_FLIP_THRESHOLD = require_surface.BODY_FLIP_THRESHOLD;
5
+ exports.DEFAULT_CARET_SCREEN_WIDTH = require_surface.DEFAULT_CARET_SCREEN_WIDTH;
5
6
  exports.DEFAULT_CORNER_RADIUS_HANDLE_INSET = require_surface.DEFAULT_CORNER_RADIUS_HANDLE_INSET;
6
7
  exports.DEFAULT_CORNER_RADIUS_HANDLE_SIZE = require_surface.DEFAULT_CORNER_RADIUS_HANDLE_SIZE;
7
8
  exports.DEFAULT_CORNER_RADIUS_HIT_SIZE = require_surface.DEFAULT_CORNER_RADIUS_HIT_SIZE;
@@ -42,6 +43,7 @@ exports.TRANSFORM_BOX_SIDE_HIT_THICKNESS = require_surface.TRANSFORM_BOX_SIDE_HI
42
43
  exports.TRANSFORM_BOX_SIDE_PRIORITY = require_surface.TRANSFORM_BOX_SIDE_PRIORITY;
43
44
  exports.buildPaddingOverlay = require_surface.buildPaddingOverlay;
44
45
  exports.buildStripesTile = require_surface.buildStripesTile;
46
+ exports.buildTextEditChrome = require_surface.buildTextEditChrome;
45
47
  exports.buildTransformBox = require_surface.buildTransformBox;
46
48
  exports.composeTransformBox = require_surface.compose;
47
49
  exports.computeCornerRadiusLayout = require_surface.computeCornerRadiusLayout;
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { $ as DEFAULT_RULER_BACKGROUND, A as filterHUDDrawByGroup, B as drawCornerRadius, C as PADDING_REGION_PRIORITY, D as marqueeToHUDDraw, E as lassoToHUDDraw, F as computeCornerRadiusLayout, G as DEFAULT_PARAMETRIC_HIT_SIZE, H as resolveCornerDragAnchor, I as cornerRadiusAnchorSign, J as parametricHandleLayoutGroups, K as computeParametricHandleLayout, L as cornerRadiusHandlePosLine, M as DEFAULT_CORNER_RADIUS_HANDLE_INSET, N as DEFAULT_CORNER_RADIUS_HANDLE_SIZE, O as measurementToHUDDraw, P as DEFAULT_CORNER_RADIUS_HIT_SIZE, Q as DEFAULT_RULER_ACCENT_COLOR, R as cornerRadiusHandlePosRect, S as PADDING_HANDLE_THICKNESS, T as MIN_HIT_SIZE, U as DEFAULT_PARAMETRIC_HANDLE_INSET, V as resolveCenterDragAnchor, W as DEFAULT_PARAMETRIC_HANDLE_SIZE, X as resolveParametricHandleByDirection, Y as projectParametricHandleValue, Z as DEFAULT_RULER_ACCENT_BACKGROUND, _ as getTransformBoxCorners, _t as resolvePaint, a as computeSelectionControlLayout, at as DEFAULT_RULER_STRIP, b as PADDING_HANDLE_LENGTH, c as buildTransformBox, ct as drawRuler, d as TRANSFORM_BOX_CORNER_PRIORITY, dt as drawPixelGrid, et as DEFAULT_RULER_COLOR, f as TRANSFORM_BOX_SIDE_HIT_THICKNESS, ft as DEFAULT_STRIPES_ANGLE_DEG, g as decompose, gt as computeStripesTileGeometry, h as cornersToBoxTransform, ht as buildStripesTile, i as MIN_GUARANTEED_INTERACTIVE_DIM, it as DEFAULT_RULER_STEPS, j as HUDCanvas, k as snapGuideToHUDDraw, l as TRANSFORM_BOX_BODY_PRIORITY, lt as DEFAULT_PIXEL_GRID_COLOR, m as compose, mt as DEFAULT_STRIPES_THICKNESS_PX, n as BODY_FLIP_THRESHOLD, nt as DEFAULT_RULER_FONT, o as negotiateAxis, ot as DEFAULT_RULER_TEXT_SIDE_OFFSET, p as TRANSFORM_BOX_SIDE_PRIORITY, pt as DEFAULT_STRIPES_SPACING_PX, q as drawParametricHandles, r as HUDHitPriority, rt as DEFAULT_RULER_OVERLAP_THRESHOLD, s as NO_MODS, st as DEFAULT_RULER_TICK_HEIGHT, t as Surface, tt as DEFAULT_RULER_DRAG_THRESHOLD, u as TRANSFORM_BOX_CORNER_HIT_SIZE, ut as DEFAULT_PIXEL_GRID_STEPS, v as reduceTransformBox, w as MIN_CHROME_VISIBLE_SIZE, x as PADDING_HANDLE_PRIORITY, y as buildPaddingOverlay, z as cornerRadiusLayoutGroups } from "./surface-DFo9q3y7.mjs";
1
+ import { $ as DEFAULT_RULER_ACCENT_BACKGROUND, A as measurementToHUDDraw, B as cornerRadiusHandlePosRect, C as PADDING_HANDLE_PRIORITY, D as MIN_HIT_SIZE, E as MIN_CHROME_VISIBLE_SIZE, F as DEFAULT_CORNER_RADIUS_HANDLE_SIZE, G as DEFAULT_PARAMETRIC_HANDLE_INSET, H as drawCornerRadius, I as DEFAULT_CORNER_RADIUS_HIT_SIZE, J as computeParametricHandleLayout, K as DEFAULT_PARAMETRIC_HANDLE_SIZE, L as computeCornerRadiusLayout, M as filterHUDDrawByGroup, N as HUDCanvas, O as lassoToHUDDraw, P as DEFAULT_CORNER_RADIUS_HANDLE_INSET, Q as resolveParametricHandleByDirection, R as cornerRadiusAnchorSign, S as PADDING_HANDLE_LENGTH, T as PADDING_REGION_PRIORITY, U as resolveCenterDragAnchor, V as cornerRadiusLayoutGroups, W as resolveCornerDragAnchor, X as parametricHandleLayoutGroups, Y as drawParametricHandles, Z as projectParametricHandleValue, _ as cornersToBoxTransform, _t as buildStripesTile, a as HUDHitPriority, at as DEFAULT_RULER_OVERLAP_THRESHOLD, b as reduceTransformBox, c as negotiateAxis, ct as DEFAULT_RULER_TEXT_SIDE_OFFSET, d as TRANSFORM_BOX_BODY_PRIORITY, dt as DEFAULT_PIXEL_GRID_COLOR, et as DEFAULT_RULER_ACCENT_COLOR, f as TRANSFORM_BOX_CORNER_HIT_SIZE, ft as DEFAULT_PIXEL_GRID_STEPS, g as compose, gt as DEFAULT_STRIPES_THICKNESS_PX, h as TRANSFORM_BOX_SIDE_PRIORITY, ht as DEFAULT_STRIPES_SPACING_PX, i as BODY_FLIP_THRESHOLD, it as DEFAULT_RULER_FONT, j as snapGuideToHUDDraw, k as marqueeToHUDDraw, l as NO_MODS, lt as DEFAULT_RULER_TICK_HEIGHT, m as TRANSFORM_BOX_SIDE_HIT_THICKNESS, mt as DEFAULT_STRIPES_ANGLE_DEG, n as DEFAULT_CARET_SCREEN_WIDTH, nt as DEFAULT_RULER_COLOR, o as MIN_GUARANTEED_INTERACTIVE_DIM, ot as DEFAULT_RULER_STEPS, p as TRANSFORM_BOX_CORNER_PRIORITY, pt as drawPixelGrid, q as DEFAULT_PARAMETRIC_HIT_SIZE, r as buildTextEditChrome, rt as DEFAULT_RULER_DRAG_THRESHOLD, s as computeSelectionControlLayout, st as DEFAULT_RULER_STRIP, t as Surface, tt as DEFAULT_RULER_BACKGROUND, u as buildTransformBox, ut as drawRuler, v as decompose, vt as computeStripesTileGeometry, w as PADDING_HANDLE_THICKNESS, x as buildPaddingOverlay, y as getTransformBoxCorners, yt as resolvePaint, z as cornerRadiusHandlePosLine } from "./surface-CNF9XW6b.mjs";
2
2
  import { i as cursorToCss, r as cursorEquals } from "./cursor-DW-uAPVE.mjs";
3
- export { BODY_FLIP_THRESHOLD, DEFAULT_CORNER_RADIUS_HANDLE_INSET, DEFAULT_CORNER_RADIUS_HANDLE_SIZE, DEFAULT_CORNER_RADIUS_HIT_SIZE, DEFAULT_PARAMETRIC_HANDLE_INSET, DEFAULT_PARAMETRIC_HANDLE_SIZE, DEFAULT_PARAMETRIC_HIT_SIZE, DEFAULT_PIXEL_GRID_COLOR, DEFAULT_PIXEL_GRID_STEPS, DEFAULT_RULER_ACCENT_BACKGROUND, DEFAULT_RULER_ACCENT_COLOR, DEFAULT_RULER_BACKGROUND, DEFAULT_RULER_COLOR, DEFAULT_RULER_DRAG_THRESHOLD, DEFAULT_RULER_FONT, DEFAULT_RULER_OVERLAP_THRESHOLD, DEFAULT_RULER_STEPS, DEFAULT_RULER_STRIP, DEFAULT_RULER_TEXT_SIDE_OFFSET, DEFAULT_RULER_TICK_HEIGHT, DEFAULT_STRIPES_ANGLE_DEG, DEFAULT_STRIPES_SPACING_PX, DEFAULT_STRIPES_THICKNESS_PX, HUDCanvas, HUDHitPriority, MIN_CHROME_VISIBLE_SIZE, MIN_GUARANTEED_INTERACTIVE_DIM, MIN_HIT_SIZE, NO_MODS, PADDING_HANDLE_LENGTH, PADDING_HANDLE_PRIORITY, PADDING_HANDLE_THICKNESS, PADDING_REGION_PRIORITY, Surface, TRANSFORM_BOX_BODY_PRIORITY, TRANSFORM_BOX_CORNER_HIT_SIZE, TRANSFORM_BOX_CORNER_PRIORITY, TRANSFORM_BOX_SIDE_HIT_THICKNESS, TRANSFORM_BOX_SIDE_PRIORITY, buildPaddingOverlay, buildStripesTile, buildTransformBox, compose as composeTransformBox, computeCornerRadiusLayout, computeParametricHandleLayout, computeSelectionControlLayout, computeStripesTileGeometry, cornerRadiusAnchorSign, cornerRadiusHandlePosLine, cornerRadiusHandlePosRect, cornerRadiusLayoutGroups, cornersToBoxTransform, cursorEquals, cursorToCss, decompose as decomposeTransformBox, drawCornerRadius, drawParametricHandles, drawPixelGrid, drawRuler, filterHUDDrawByGroup, getTransformBoxCorners, lassoToHUDDraw, marqueeToHUDDraw, measurementToHUDDraw, negotiateAxis, parametricHandleLayoutGroups, projectParametricHandleValue, reduceTransformBox, resolveCenterDragAnchor, resolveCornerDragAnchor, resolvePaint, resolveParametricHandleByDirection, snapGuideToHUDDraw };
3
+ export { BODY_FLIP_THRESHOLD, DEFAULT_CARET_SCREEN_WIDTH, DEFAULT_CORNER_RADIUS_HANDLE_INSET, DEFAULT_CORNER_RADIUS_HANDLE_SIZE, DEFAULT_CORNER_RADIUS_HIT_SIZE, DEFAULT_PARAMETRIC_HANDLE_INSET, DEFAULT_PARAMETRIC_HANDLE_SIZE, DEFAULT_PARAMETRIC_HIT_SIZE, DEFAULT_PIXEL_GRID_COLOR, DEFAULT_PIXEL_GRID_STEPS, DEFAULT_RULER_ACCENT_BACKGROUND, DEFAULT_RULER_ACCENT_COLOR, DEFAULT_RULER_BACKGROUND, DEFAULT_RULER_COLOR, DEFAULT_RULER_DRAG_THRESHOLD, DEFAULT_RULER_FONT, DEFAULT_RULER_OVERLAP_THRESHOLD, DEFAULT_RULER_STEPS, DEFAULT_RULER_STRIP, DEFAULT_RULER_TEXT_SIDE_OFFSET, DEFAULT_RULER_TICK_HEIGHT, DEFAULT_STRIPES_ANGLE_DEG, DEFAULT_STRIPES_SPACING_PX, DEFAULT_STRIPES_THICKNESS_PX, HUDCanvas, HUDHitPriority, MIN_CHROME_VISIBLE_SIZE, MIN_GUARANTEED_INTERACTIVE_DIM, MIN_HIT_SIZE, NO_MODS, PADDING_HANDLE_LENGTH, PADDING_HANDLE_PRIORITY, PADDING_HANDLE_THICKNESS, PADDING_REGION_PRIORITY, Surface, TRANSFORM_BOX_BODY_PRIORITY, TRANSFORM_BOX_CORNER_HIT_SIZE, TRANSFORM_BOX_CORNER_PRIORITY, TRANSFORM_BOX_SIDE_HIT_THICKNESS, TRANSFORM_BOX_SIDE_PRIORITY, buildPaddingOverlay, buildStripesTile, buildTextEditChrome, buildTransformBox, compose as composeTransformBox, computeCornerRadiusLayout, computeParametricHandleLayout, computeSelectionControlLayout, computeStripesTileGeometry, cornerRadiusAnchorSign, cornerRadiusHandlePosLine, cornerRadiusHandlePosRect, cornerRadiusLayoutGroups, cornersToBoxTransform, cursorEquals, cursorToCss, decompose as decomposeTransformBox, drawCornerRadius, drawParametricHandles, drawPixelGrid, drawRuler, filterHUDDrawByGroup, getTransformBoxCorners, lassoToHUDDraw, marqueeToHUDDraw, measurementToHUDDraw, negotiateAxis, parametricHandleLayoutGroups, projectParametricHandleValue, reduceTransformBox, resolveCenterDragAnchor, resolveCornerDragAnchor, resolvePaint, resolveParametricHandleByDirection, snapGuideToHUDDraw };
package/dist/react.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as HUDDraw } from "./types-3wwFisZs.mjs";
2
- import { n as SurfaceOptions, t as Surface } from "./index-BQtDtpHM.mjs";
2
+ import { n as SurfaceOptions, t as Surface } from "./index-Df4QB6Yr.mjs";
3
3
  import cmath from "@grida/cmath";
4
4
  import { Measurement } from "@grida/cmath/_measurement";
5
5
  import * as React from "react";
package/dist/react.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as HUDDraw } from "./types-3wwFisZs.js";
2
- import { n as SurfaceOptions, t as Surface } from "./index-BlfZbeEJ.js";
2
+ import { n as SurfaceOptions, t as Surface } from "./index-E7n0yPim.js";
3
3
  import cmath from "@grida/cmath";
4
4
  import { SnapResult } from "@grida/cmath/_snap";
5
5
  import { Measurement } from "@grida/cmath/_measurement";
package/dist/react.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const require_surface = require("./surface-D-Kt_jKx.js");
3
+ const require_surface = require("./surface-Bd6zw8O0.js");
4
4
  let react = require("react");
5
5
  react = require_surface.__toESM(react);
6
6
  let _grida_cmath__snap = require("@grida/cmath/_snap");
package/dist/react.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { D as marqueeToHUDDraw, E as lassoToHUDDraw, O as measurementToHUDDraw, j as HUDCanvas, k as snapGuideToHUDDraw, t as Surface } from "./surface-DFo9q3y7.mjs";
2
+ import { A as measurementToHUDDraw, N as HUDCanvas, O as lassoToHUDDraw, j as snapGuideToHUDDraw, k as marqueeToHUDDraw, t as Surface } from "./surface-CNF9XW6b.mjs";
3
3
  import * as React from "react";
4
4
  import { guide } from "@grida/cmath/_snap";
5
5
  import { jsx } from "react/jsx-runtime";
@@ -2718,10 +2718,11 @@ function rectFromPoints(a, b) {
2718
2718
  * No constraints: width/height can go negative — host is responsible for
2719
2719
  * normalizing if it cares (most callers clamp to a min-size).
2720
2720
  */
2721
- function applyResize(initial, direction, dx, dy) {
2721
+ function applyResize(initial, direction, dx, dy, opts) {
2722
+ const fromCenter = opts?.fromCenter ?? false;
2722
2723
  if (initial.kind === "rect") return {
2723
2724
  kind: "rect",
2724
- rect: applyResizeRect(initial.rect, direction, dx, dy)
2725
+ rect: applyResizeRect(initial.rect, direction, dx, dy, fromCenter)
2725
2726
  };
2726
2727
  if (initial.kind === "transformed") {
2727
2728
  const m = initial.matrix;
@@ -2738,49 +2739,42 @@ function applyResize(initial, direction, dx, dy) {
2738
2739
  const [ldx, ldy] = _grida_cmath.default.vector2.transform([dx, dy], inv_linear);
2739
2740
  return {
2740
2741
  kind: "transformed",
2741
- local: applyResizeRect(initial.local, direction, ldx, ldy),
2742
+ local: applyResizeRect(initial.local, direction, ldx, ldy, fromCenter),
2742
2743
  matrix: m
2743
2744
  };
2744
2745
  }
2745
2746
  return initial;
2746
2747
  }
2747
- function applyResizeRect(initial, direction, dx, dy) {
2748
+ /**
2749
+ * Resize a rect by dragging `direction`'s edge/corner by `(dx, dy)`.
2750
+ *
2751
+ * Default anchors the OPPOSITE edge/corner (far side pinned). With
2752
+ * `fromCenter` (Alt), the resize is symmetric about the rect's center:
2753
+ * the dragged edge moves by the delta and the opposite edge mirrors it,
2754
+ * so the size delta doubles and the center stays put.
2755
+ */
2756
+ function applyResizeRect(initial, direction, dx, dy, fromCenter = false) {
2748
2757
  let { x, y, width, height } = initial;
2749
- switch (direction) {
2750
- case "n":
2751
- y += dy;
2752
- height -= dy;
2753
- break;
2754
- case "s":
2755
- height += dy;
2756
- break;
2757
- case "e":
2758
- width += dx;
2759
- break;
2760
- case "w":
2761
- x += dx;
2762
- width -= dx;
2763
- break;
2764
- case "ne":
2765
- y += dy;
2766
- height -= dy;
2767
- width += dx;
2768
- break;
2769
- case "nw":
2770
- y += dy;
2771
- height -= dy;
2772
- x += dx;
2773
- width -= dx;
2774
- break;
2775
- case "se":
2776
- width += dx;
2777
- height += dy;
2778
- break;
2779
- case "sw":
2780
- x += dx;
2781
- width -= dx;
2782
- height += dy;
2783
- break;
2758
+ const k = fromCenter ? 2 : 1;
2759
+ const hasN = direction === "n" || direction === "ne" || direction === "nw";
2760
+ const hasS = direction === "s" || direction === "se" || direction === "sw";
2761
+ const hasE = direction === "e" || direction === "ne" || direction === "se";
2762
+ const hasW = direction === "w" || direction === "nw" || direction === "sw";
2763
+ if (hasE) {
2764
+ width += k * dx;
2765
+ if (fromCenter) x -= dx;
2766
+ }
2767
+ if (hasW) {
2768
+ x += dx;
2769
+ width -= k * dx;
2770
+ }
2771
+ if (hasS) {
2772
+ height += k * dy;
2773
+ if (fromCenter) y -= dy;
2774
+ }
2775
+ if (hasN) {
2776
+ y += dy;
2777
+ height -= k * dy;
2784
2778
  }
2785
2779
  return {
2786
2780
  x,
@@ -3606,12 +3600,31 @@ var SurfaceState = class {
3606
3600
  return this.onPointerUp(event.x, event.y, event.button, deps);
3607
3601
  case "modifiers":
3608
3602
  this.modifiers = event.mods;
3603
+ if (this.gesture.kind === "resize") {
3604
+ const g = this.gesture;
3605
+ const dx = g.last_doc[0] - g.anchor_doc[0];
3606
+ const dy = g.last_doc[1] - g.anchor_doc[1];
3607
+ this.gesture = {
3608
+ ...g,
3609
+ preview_shape: this.resizePreviewShape(g, dx, dy, g.current_shape)
3610
+ };
3611
+ const response = emptyResponse();
3612
+ response.needsRedraw = true;
3613
+ return response;
3614
+ }
3609
3615
  return emptyResponse();
3610
3616
  case "wheel":
3611
3617
  case "key": return emptyResponse();
3612
3618
  case "blur": return this.onBlur(deps);
3613
3619
  }
3614
3620
  }
3621
+ /** The dashed-preview shape for a resize: center-symmetric under Alt,
3622
+ * else the opposite-anchored `opposite` shape (which the intent carries).
3623
+ * One rule, shared by the pointer-move handler and the modifier-toggle
3624
+ * refresh so the preview can't go stale on a mid-drag Alt flip. */
3625
+ resizePreviewShape(g, dx, dy, opposite) {
3626
+ return this.modifiers.alt ? applyResize(g.initial_shape, g.direction, dx, dy, { fromCenter: true }) : opposite;
3627
+ }
3615
3628
  onPointerMove(sx, sy, mods, deps) {
3616
3629
  this.modifiers = mods;
3617
3630
  const response = emptyResponse();
@@ -3779,9 +3792,12 @@ var SurfaceState = class {
3779
3792
  const dx = point_doc[0] - g.anchor_doc[0];
3780
3793
  const dy = point_doc[1] - g.anchor_doc[1];
3781
3794
  const next_shape = applyResize(g.initial_shape, g.direction, dx, dy);
3795
+ const preview_shape = this.resizePreviewShape(g, dx, dy, next_shape);
3782
3796
  this.gesture = {
3783
3797
  ...g,
3784
- current_shape: next_shape
3798
+ current_shape: next_shape,
3799
+ preview_shape,
3800
+ last_doc: point_doc
3785
3801
  };
3786
3802
  deps.emitIntent({
3787
3803
  kind: "resize",
@@ -4250,7 +4266,9 @@ var SurfaceState = class {
4250
4266
  direction: decision.direction,
4251
4267
  initial_shape: decision.initial_shape,
4252
4268
  anchor_doc: point_doc,
4253
- current_shape: decision.initial_shape
4269
+ last_doc: point_doc,
4270
+ current_shape: decision.initial_shape,
4271
+ preview_shape: decision.initial_shape
4254
4272
  };
4255
4273
  response.needsRedraw = true;
4256
4274
  return response;
@@ -5485,7 +5503,7 @@ function buildChrome(input) {
5485
5503
  });
5486
5504
  }
5487
5505
  if (state.gesture.kind === "resize") {
5488
- const shape = state.gesture.current_shape;
5506
+ const shape = state.gesture.preview_shape;
5489
5507
  if (shape.kind === "transformed") {
5490
5508
  const corners = _grida_cmath.default.rect.toCorners(shape.local).map((p) => _grida_cmath.default.vector2.transform(p, shape.matrix));
5491
5509
  decoration_polylines.push({
@@ -6428,6 +6446,83 @@ function emit_tangent_handle(args) {
6428
6446
  });
6429
6447
  }
6430
6448
  //#endregion
6449
+ //#region classes/text-edit/surface.ts
6450
+ /** On-screen caret thickness in CSS px — zoom-independent by construction. */
6451
+ const DEFAULT_CARET_SCREEN_WIDTH = 1.5;
6452
+ const DEFAULT_CARET_COLOR = "#2563eb";
6453
+ const DEFAULT_SELECTION_COLOR = "#2563eb";
6454
+ const DEFAULT_SELECTION_OPACITY = .25;
6455
+ /**
6456
+ * Build the per-frame text-edit chrome.
6457
+ *
6458
+ * Composition mirrors `chrome.ts:pushTransformedChrome`:
6459
+ * `local_to_screen = multiply(camera, chrome.transform)`. The selection rects
6460
+ * project to doc space via `chrome.transform` (the HUD applies the camera when
6461
+ * painting); the caret anchor projects the same way, while its on-screen
6462
+ * length + angle come from `local_to_screen` so the bar tracks the projected
6463
+ * glyph height and rotates with the text.
6464
+ *
6465
+ * @param camera the HUD's world→screen transform (`state.getTransform()`).
6466
+ */
6467
+ function buildTextEditChrome(input) {
6468
+ const { chrome, camera } = input;
6469
+ const style = chrome.style ?? {};
6470
+ const caretColor = style.caretColor ?? DEFAULT_CARET_COLOR;
6471
+ const caretScreenWidth = style.caretScreenWidth ?? 1.5;
6472
+ const selectionColor = style.selectionColor ?? DEFAULT_SELECTION_COLOR;
6473
+ const selectionOpacity = style.selectionOpacity ?? DEFAULT_SELECTION_OPACITY;
6474
+ const { group } = chrome;
6475
+ const polylines = [];
6476
+ const screenRects = [];
6477
+ const local_to_screen = _grida_cmath.default.transform.multiply(camera, chrome.transform);
6478
+ for (const r of chrome.selectionRects ?? []) {
6479
+ const corners = _grida_cmath.default.rect.toCorners({
6480
+ x: r.x,
6481
+ y: r.y,
6482
+ width: r.width,
6483
+ height: r.height
6484
+ }).map((p) => _grida_cmath.default.vector2.transform(p, chrome.transform));
6485
+ polylines.push({
6486
+ points: [...corners, corners[0]],
6487
+ stroke: false,
6488
+ fill: true,
6489
+ fillPaint: {
6490
+ kind: "solid",
6491
+ color: selectionColor,
6492
+ opacity: selectionOpacity
6493
+ },
6494
+ group
6495
+ });
6496
+ }
6497
+ if (chrome.caret && chrome.caretVisible) {
6498
+ const { top, bottom } = chrome.caret;
6499
+ const mid_local = [(top[0] + bottom[0]) / 2, (top[1] + bottom[1]) / 2];
6500
+ const anchor_doc = _grida_cmath.default.vector2.transform(mid_local, chrome.transform);
6501
+ const top_screen = _grida_cmath.default.vector2.transform(top, local_to_screen);
6502
+ const bottom_screen = _grida_cmath.default.vector2.transform(bottom, local_to_screen);
6503
+ const dx = bottom_screen[0] - top_screen[0];
6504
+ const dy = bottom_screen[1] - top_screen[1];
6505
+ const screen_len = Math.hypot(dx, dy);
6506
+ const angle_rad = Math.atan2(dy, dx) - Math.PI / 2;
6507
+ screenRects.push({
6508
+ x: anchor_doc[0],
6509
+ y: anchor_doc[1],
6510
+ width: caretScreenWidth,
6511
+ height: screen_len,
6512
+ anchor: "center",
6513
+ angle: angle_rad,
6514
+ fill: true,
6515
+ stroke: false,
6516
+ fillColor: caretColor,
6517
+ group
6518
+ });
6519
+ }
6520
+ return {
6521
+ polylines,
6522
+ screenRects
6523
+ };
6524
+ }
6525
+ //#endregion
6431
6526
  //#region surface/surface.ts
6432
6527
  /**
6433
6528
  * Top-level wired surface.
@@ -6442,6 +6537,7 @@ var Surface = class {
6442
6537
  this.cornerRadius = [];
6443
6538
  this.parametricHandles = [];
6444
6539
  this.paddingOverlay = null;
6540
+ this.textEditChrome = null;
6445
6541
  this.width = 0;
6446
6542
  this.height = 0;
6447
6543
  this.cursor_renderer = null;
@@ -6581,6 +6677,28 @@ var Surface = class {
6581
6677
  this.paddingOverlay = input;
6582
6678
  }
6583
6679
  /**
6680
+ * Configure or clear the built-in text-edit chrome — caret + selection
6681
+ * highlights for inline text content-edit. `null` = no chrome drawn
6682
+ * (schema-level feature flag).
6683
+ *
6684
+ * One atomic setter (not separate setCaret / setSelection): caret and
6685
+ * selection are one visual state of one editing session, and a blink tick
6686
+ * only flips `caretVisible` while the selection is unchanged — re-pushing
6687
+ * the whole struct keeps the two from tearing across frames and matches the
6688
+ * Skia `TextEditingDecorations` model. Re-push on every caret move /
6689
+ * selection change / blink tick / camera change. The host owns redraw
6690
+ * timing (this only stores state; `draw()` paints it next frame).
6691
+ *
6692
+ * The caret is drawn ABOVE the selection box (it's a screen-sized rect in
6693
+ * the screenRects band) at a constant on-screen thickness, so it is never
6694
+ * occluded and never scales with zoom. See `@grida/hud/classes/text-edit`.
6695
+ *
6696
+ * @unstable
6697
+ */
6698
+ setTextEditChrome(input) {
6699
+ this.textEditChrome = input;
6700
+ }
6701
+ /**
6584
6702
  * Push a transform-box input — the `transform-box` named class for
6585
6703
  * a 2×3 affine transform manipulated via quad outline + 4 corners +
6586
6704
  * 4 sides + body. `null` = no chrome drawn (schema-level feature
@@ -6757,12 +6875,18 @@ var Surface = class {
6757
6875
  }
6758
6876
  this.hudCanvas.setParametricHandles(all_parametric);
6759
6877
  } else this.hudCanvas.setParametricHandles(null);
6760
- const decoration_with_extras = lines.length > 0 || polylines.length > 0 ? {
6878
+ const text_edit = this.textEditChrome ? buildTextEditChrome({
6879
+ chrome: this.textEditChrome,
6880
+ camera: this.state.getTransform()
6881
+ }) : null;
6882
+ const all_polylines = text_edit ? [...polylines, ...text_edit.polylines] : polylines;
6883
+ const decoration_with_extras = lines.length > 0 || all_polylines.length > 0 ? {
6761
6884
  ...decoration,
6762
6885
  lines: lines.length > 0 ? [...decoration.lines ?? [], ...lines] : decoration.lines,
6763
- polylines: polylines.length > 0 ? [...decoration.polylines ?? [], ...polylines] : decoration.polylines
6886
+ polylines: all_polylines.length > 0 ? [...decoration.polylines ?? [], ...all_polylines] : decoration.polylines
6764
6887
  } : decoration;
6765
- this.hudCanvas.draw(filterHUDDrawByGroup(mergeDraws(decoration_with_extras, extra, screenRects), { hidden }));
6888
+ const all_screenRects = text_edit ? [...screenRects, ...text_edit.screenRects] : screenRects;
6889
+ this.hudCanvas.draw(filterHUDDrawByGroup(mergeDraws(decoration_with_extras, extra, all_screenRects), { hidden }));
6766
6890
  }
6767
6891
  /** Convenience: clear the canvas (e.g. when the host stops the surface). */
6768
6892
  clear() {
@@ -6972,6 +7096,12 @@ Object.defineProperty(exports, "BODY_FLIP_THRESHOLD", {
6972
7096
  return BODY_FLIP_THRESHOLD;
6973
7097
  }
6974
7098
  });
7099
+ Object.defineProperty(exports, "DEFAULT_CARET_SCREEN_WIDTH", {
7100
+ enumerable: true,
7101
+ get: function() {
7102
+ return DEFAULT_CARET_SCREEN_WIDTH;
7103
+ }
7104
+ });
6975
7105
  Object.defineProperty(exports, "DEFAULT_CORNER_RADIUS_HANDLE_INSET", {
6976
7106
  enumerable: true,
6977
7107
  get: function() {
@@ -7218,6 +7348,12 @@ Object.defineProperty(exports, "buildStripesTile", {
7218
7348
  return buildStripesTile;
7219
7349
  }
7220
7350
  });
7351
+ Object.defineProperty(exports, "buildTextEditChrome", {
7352
+ enumerable: true,
7353
+ get: function() {
7354
+ return buildTextEditChrome;
7355
+ }
7356
+ });
7221
7357
  Object.defineProperty(exports, "buildTransformBox", {
7222
7358
  enumerable: true,
7223
7359
  get: function() {
@@ -2695,10 +2695,11 @@ function rectFromPoints(a, b) {
2695
2695
  * No constraints: width/height can go negative — host is responsible for
2696
2696
  * normalizing if it cares (most callers clamp to a min-size).
2697
2697
  */
2698
- function applyResize(initial, direction, dx, dy) {
2698
+ function applyResize(initial, direction, dx, dy, opts) {
2699
+ const fromCenter = opts?.fromCenter ?? false;
2699
2700
  if (initial.kind === "rect") return {
2700
2701
  kind: "rect",
2701
- rect: applyResizeRect(initial.rect, direction, dx, dy)
2702
+ rect: applyResizeRect(initial.rect, direction, dx, dy, fromCenter)
2702
2703
  };
2703
2704
  if (initial.kind === "transformed") {
2704
2705
  const m = initial.matrix;
@@ -2715,49 +2716,42 @@ function applyResize(initial, direction, dx, dy) {
2715
2716
  const [ldx, ldy] = cmath.vector2.transform([dx, dy], inv_linear);
2716
2717
  return {
2717
2718
  kind: "transformed",
2718
- local: applyResizeRect(initial.local, direction, ldx, ldy),
2719
+ local: applyResizeRect(initial.local, direction, ldx, ldy, fromCenter),
2719
2720
  matrix: m
2720
2721
  };
2721
2722
  }
2722
2723
  return initial;
2723
2724
  }
2724
- function applyResizeRect(initial, direction, dx, dy) {
2725
+ /**
2726
+ * Resize a rect by dragging `direction`'s edge/corner by `(dx, dy)`.
2727
+ *
2728
+ * Default anchors the OPPOSITE edge/corner (far side pinned). With
2729
+ * `fromCenter` (Alt), the resize is symmetric about the rect's center:
2730
+ * the dragged edge moves by the delta and the opposite edge mirrors it,
2731
+ * so the size delta doubles and the center stays put.
2732
+ */
2733
+ function applyResizeRect(initial, direction, dx, dy, fromCenter = false) {
2725
2734
  let { x, y, width, height } = initial;
2726
- switch (direction) {
2727
- case "n":
2728
- y += dy;
2729
- height -= dy;
2730
- break;
2731
- case "s":
2732
- height += dy;
2733
- break;
2734
- case "e":
2735
- width += dx;
2736
- break;
2737
- case "w":
2738
- x += dx;
2739
- width -= dx;
2740
- break;
2741
- case "ne":
2742
- y += dy;
2743
- height -= dy;
2744
- width += dx;
2745
- break;
2746
- case "nw":
2747
- y += dy;
2748
- height -= dy;
2749
- x += dx;
2750
- width -= dx;
2751
- break;
2752
- case "se":
2753
- width += dx;
2754
- height += dy;
2755
- break;
2756
- case "sw":
2757
- x += dx;
2758
- width -= dx;
2759
- height += dy;
2760
- break;
2735
+ const k = fromCenter ? 2 : 1;
2736
+ const hasN = direction === "n" || direction === "ne" || direction === "nw";
2737
+ const hasS = direction === "s" || direction === "se" || direction === "sw";
2738
+ const hasE = direction === "e" || direction === "ne" || direction === "se";
2739
+ const hasW = direction === "w" || direction === "nw" || direction === "sw";
2740
+ if (hasE) {
2741
+ width += k * dx;
2742
+ if (fromCenter) x -= dx;
2743
+ }
2744
+ if (hasW) {
2745
+ x += dx;
2746
+ width -= k * dx;
2747
+ }
2748
+ if (hasS) {
2749
+ height += k * dy;
2750
+ if (fromCenter) y -= dy;
2751
+ }
2752
+ if (hasN) {
2753
+ y += dy;
2754
+ height -= k * dy;
2761
2755
  }
2762
2756
  return {
2763
2757
  x,
@@ -3583,12 +3577,31 @@ var SurfaceState = class {
3583
3577
  return this.onPointerUp(event.x, event.y, event.button, deps);
3584
3578
  case "modifiers":
3585
3579
  this.modifiers = event.mods;
3580
+ if (this.gesture.kind === "resize") {
3581
+ const g = this.gesture;
3582
+ const dx = g.last_doc[0] - g.anchor_doc[0];
3583
+ const dy = g.last_doc[1] - g.anchor_doc[1];
3584
+ this.gesture = {
3585
+ ...g,
3586
+ preview_shape: this.resizePreviewShape(g, dx, dy, g.current_shape)
3587
+ };
3588
+ const response = emptyResponse();
3589
+ response.needsRedraw = true;
3590
+ return response;
3591
+ }
3586
3592
  return emptyResponse();
3587
3593
  case "wheel":
3588
3594
  case "key": return emptyResponse();
3589
3595
  case "blur": return this.onBlur(deps);
3590
3596
  }
3591
3597
  }
3598
+ /** The dashed-preview shape for a resize: center-symmetric under Alt,
3599
+ * else the opposite-anchored `opposite` shape (which the intent carries).
3600
+ * One rule, shared by the pointer-move handler and the modifier-toggle
3601
+ * refresh so the preview can't go stale on a mid-drag Alt flip. */
3602
+ resizePreviewShape(g, dx, dy, opposite) {
3603
+ return this.modifiers.alt ? applyResize(g.initial_shape, g.direction, dx, dy, { fromCenter: true }) : opposite;
3604
+ }
3592
3605
  onPointerMove(sx, sy, mods, deps) {
3593
3606
  this.modifiers = mods;
3594
3607
  const response = emptyResponse();
@@ -3756,9 +3769,12 @@ var SurfaceState = class {
3756
3769
  const dx = point_doc[0] - g.anchor_doc[0];
3757
3770
  const dy = point_doc[1] - g.anchor_doc[1];
3758
3771
  const next_shape = applyResize(g.initial_shape, g.direction, dx, dy);
3772
+ const preview_shape = this.resizePreviewShape(g, dx, dy, next_shape);
3759
3773
  this.gesture = {
3760
3774
  ...g,
3761
- current_shape: next_shape
3775
+ current_shape: next_shape,
3776
+ preview_shape,
3777
+ last_doc: point_doc
3762
3778
  };
3763
3779
  deps.emitIntent({
3764
3780
  kind: "resize",
@@ -4227,7 +4243,9 @@ var SurfaceState = class {
4227
4243
  direction: decision.direction,
4228
4244
  initial_shape: decision.initial_shape,
4229
4245
  anchor_doc: point_doc,
4230
- current_shape: decision.initial_shape
4246
+ last_doc: point_doc,
4247
+ current_shape: decision.initial_shape,
4248
+ preview_shape: decision.initial_shape
4231
4249
  };
4232
4250
  response.needsRedraw = true;
4233
4251
  return response;
@@ -5462,7 +5480,7 @@ function buildChrome(input) {
5462
5480
  });
5463
5481
  }
5464
5482
  if (state.gesture.kind === "resize") {
5465
- const shape = state.gesture.current_shape;
5483
+ const shape = state.gesture.preview_shape;
5466
5484
  if (shape.kind === "transformed") {
5467
5485
  const corners = cmath.rect.toCorners(shape.local).map((p) => cmath.vector2.transform(p, shape.matrix));
5468
5486
  decoration_polylines.push({
@@ -6405,6 +6423,83 @@ function emit_tangent_handle(args) {
6405
6423
  });
6406
6424
  }
6407
6425
  //#endregion
6426
+ //#region classes/text-edit/surface.ts
6427
+ /** On-screen caret thickness in CSS px — zoom-independent by construction. */
6428
+ const DEFAULT_CARET_SCREEN_WIDTH = 1.5;
6429
+ const DEFAULT_CARET_COLOR = "#2563eb";
6430
+ const DEFAULT_SELECTION_COLOR = "#2563eb";
6431
+ const DEFAULT_SELECTION_OPACITY = .25;
6432
+ /**
6433
+ * Build the per-frame text-edit chrome.
6434
+ *
6435
+ * Composition mirrors `chrome.ts:pushTransformedChrome`:
6436
+ * `local_to_screen = multiply(camera, chrome.transform)`. The selection rects
6437
+ * project to doc space via `chrome.transform` (the HUD applies the camera when
6438
+ * painting); the caret anchor projects the same way, while its on-screen
6439
+ * length + angle come from `local_to_screen` so the bar tracks the projected
6440
+ * glyph height and rotates with the text.
6441
+ *
6442
+ * @param camera the HUD's world→screen transform (`state.getTransform()`).
6443
+ */
6444
+ function buildTextEditChrome(input) {
6445
+ const { chrome, camera } = input;
6446
+ const style = chrome.style ?? {};
6447
+ const caretColor = style.caretColor ?? DEFAULT_CARET_COLOR;
6448
+ const caretScreenWidth = style.caretScreenWidth ?? 1.5;
6449
+ const selectionColor = style.selectionColor ?? DEFAULT_SELECTION_COLOR;
6450
+ const selectionOpacity = style.selectionOpacity ?? DEFAULT_SELECTION_OPACITY;
6451
+ const { group } = chrome;
6452
+ const polylines = [];
6453
+ const screenRects = [];
6454
+ const local_to_screen = cmath.transform.multiply(camera, chrome.transform);
6455
+ for (const r of chrome.selectionRects ?? []) {
6456
+ const corners = cmath.rect.toCorners({
6457
+ x: r.x,
6458
+ y: r.y,
6459
+ width: r.width,
6460
+ height: r.height
6461
+ }).map((p) => cmath.vector2.transform(p, chrome.transform));
6462
+ polylines.push({
6463
+ points: [...corners, corners[0]],
6464
+ stroke: false,
6465
+ fill: true,
6466
+ fillPaint: {
6467
+ kind: "solid",
6468
+ color: selectionColor,
6469
+ opacity: selectionOpacity
6470
+ },
6471
+ group
6472
+ });
6473
+ }
6474
+ if (chrome.caret && chrome.caretVisible) {
6475
+ const { top, bottom } = chrome.caret;
6476
+ const mid_local = [(top[0] + bottom[0]) / 2, (top[1] + bottom[1]) / 2];
6477
+ const anchor_doc = cmath.vector2.transform(mid_local, chrome.transform);
6478
+ const top_screen = cmath.vector2.transform(top, local_to_screen);
6479
+ const bottom_screen = cmath.vector2.transform(bottom, local_to_screen);
6480
+ const dx = bottom_screen[0] - top_screen[0];
6481
+ const dy = bottom_screen[1] - top_screen[1];
6482
+ const screen_len = Math.hypot(dx, dy);
6483
+ const angle_rad = Math.atan2(dy, dx) - Math.PI / 2;
6484
+ screenRects.push({
6485
+ x: anchor_doc[0],
6486
+ y: anchor_doc[1],
6487
+ width: caretScreenWidth,
6488
+ height: screen_len,
6489
+ anchor: "center",
6490
+ angle: angle_rad,
6491
+ fill: true,
6492
+ stroke: false,
6493
+ fillColor: caretColor,
6494
+ group
6495
+ });
6496
+ }
6497
+ return {
6498
+ polylines,
6499
+ screenRects
6500
+ };
6501
+ }
6502
+ //#endregion
6408
6503
  //#region surface/surface.ts
6409
6504
  /**
6410
6505
  * Top-level wired surface.
@@ -6419,6 +6514,7 @@ var Surface = class {
6419
6514
  this.cornerRadius = [];
6420
6515
  this.parametricHandles = [];
6421
6516
  this.paddingOverlay = null;
6517
+ this.textEditChrome = null;
6422
6518
  this.width = 0;
6423
6519
  this.height = 0;
6424
6520
  this.cursor_renderer = null;
@@ -6558,6 +6654,28 @@ var Surface = class {
6558
6654
  this.paddingOverlay = input;
6559
6655
  }
6560
6656
  /**
6657
+ * Configure or clear the built-in text-edit chrome — caret + selection
6658
+ * highlights for inline text content-edit. `null` = no chrome drawn
6659
+ * (schema-level feature flag).
6660
+ *
6661
+ * One atomic setter (not separate setCaret / setSelection): caret and
6662
+ * selection are one visual state of one editing session, and a blink tick
6663
+ * only flips `caretVisible` while the selection is unchanged — re-pushing
6664
+ * the whole struct keeps the two from tearing across frames and matches the
6665
+ * Skia `TextEditingDecorations` model. Re-push on every caret move /
6666
+ * selection change / blink tick / camera change. The host owns redraw
6667
+ * timing (this only stores state; `draw()` paints it next frame).
6668
+ *
6669
+ * The caret is drawn ABOVE the selection box (it's a screen-sized rect in
6670
+ * the screenRects band) at a constant on-screen thickness, so it is never
6671
+ * occluded and never scales with zoom. See `@grida/hud/classes/text-edit`.
6672
+ *
6673
+ * @unstable
6674
+ */
6675
+ setTextEditChrome(input) {
6676
+ this.textEditChrome = input;
6677
+ }
6678
+ /**
6561
6679
  * Push a transform-box input — the `transform-box` named class for
6562
6680
  * a 2×3 affine transform manipulated via quad outline + 4 corners +
6563
6681
  * 4 sides + body. `null` = no chrome drawn (schema-level feature
@@ -6734,12 +6852,18 @@ var Surface = class {
6734
6852
  }
6735
6853
  this.hudCanvas.setParametricHandles(all_parametric);
6736
6854
  } else this.hudCanvas.setParametricHandles(null);
6737
- const decoration_with_extras = lines.length > 0 || polylines.length > 0 ? {
6855
+ const text_edit = this.textEditChrome ? buildTextEditChrome({
6856
+ chrome: this.textEditChrome,
6857
+ camera: this.state.getTransform()
6858
+ }) : null;
6859
+ const all_polylines = text_edit ? [...polylines, ...text_edit.polylines] : polylines;
6860
+ const decoration_with_extras = lines.length > 0 || all_polylines.length > 0 ? {
6738
6861
  ...decoration,
6739
6862
  lines: lines.length > 0 ? [...decoration.lines ?? [], ...lines] : decoration.lines,
6740
- polylines: polylines.length > 0 ? [...decoration.polylines ?? [], ...polylines] : decoration.polylines
6863
+ polylines: all_polylines.length > 0 ? [...decoration.polylines ?? [], ...all_polylines] : decoration.polylines
6741
6864
  } : decoration;
6742
- this.hudCanvas.draw(filterHUDDrawByGroup(mergeDraws(decoration_with_extras, extra, screenRects), { hidden }));
6865
+ const all_screenRects = text_edit ? [...screenRects, ...text_edit.screenRects] : screenRects;
6866
+ this.hudCanvas.draw(filterHUDDrawByGroup(mergeDraws(decoration_with_extras, extra, all_screenRects), { hidden }));
6743
6867
  }
6744
6868
  /** Convenience: clear the canvas (e.g. when the host stops the surface). */
6745
6869
  clear() {
@@ -6943,4 +7067,4 @@ function filterOverlaysByGroup(overlays, hidden) {
6943
7067
  });
6944
7068
  }
6945
7069
  //#endregion
6946
- export { DEFAULT_RULER_BACKGROUND as $, filterHUDDrawByGroup as A, drawCornerRadius as B, PADDING_REGION_PRIORITY as C, marqueeToHUDDraw as D, lassoToHUDDraw as E, computeCornerRadiusLayout as F, DEFAULT_PARAMETRIC_HIT_SIZE as G, resolveCornerDragAnchor$1 as H, cornerRadiusAnchorSign as I, parametricHandleLayoutGroups as J, computeParametricHandleLayout as K, cornerRadiusHandlePosLine as L, DEFAULT_CORNER_RADIUS_HANDLE_INSET as M, DEFAULT_CORNER_RADIUS_HANDLE_SIZE as N, measurementToHUDDraw as O, DEFAULT_CORNER_RADIUS_HIT_SIZE as P, DEFAULT_RULER_ACCENT_COLOR as Q, cornerRadiusHandlePosRect as R, PADDING_HANDLE_THICKNESS as S, MIN_HIT_SIZE as T, DEFAULT_PARAMETRIC_HANDLE_INSET as U, resolveCenterDragAnchor as V, DEFAULT_PARAMETRIC_HANDLE_SIZE as W, resolveParametricHandleByDirection as X, projectParametricHandleValue as Y, DEFAULT_RULER_ACCENT_BACKGROUND as Z, getTransformBoxCorners as _, resolvePaint as _t, computeSelectionControlLayout as a, DEFAULT_RULER_STRIP as at, PADDING_HANDLE_LENGTH as b, buildTransformBox as c, drawRuler as ct, TRANSFORM_BOX_CORNER_PRIORITY as d, drawPixelGrid as dt, DEFAULT_RULER_COLOR as et, TRANSFORM_BOX_SIDE_HIT_THICKNESS as f, DEFAULT_STRIPES_ANGLE_DEG as ft, decompose as g, computeStripesTileGeometry as gt, cornersToBoxTransform as h, buildStripesTile as ht, MIN_GUARANTEED_INTERACTIVE_DIM as i, DEFAULT_RULER_STEPS as it, HUDCanvas as j, snapGuideToHUDDraw as k, TRANSFORM_BOX_BODY_PRIORITY as l, DEFAULT_PIXEL_GRID_COLOR as lt, compose as m, DEFAULT_STRIPES_THICKNESS_PX as mt, BODY_FLIP_THRESHOLD as n, DEFAULT_RULER_FONT as nt, negotiateAxis as o, DEFAULT_RULER_TEXT_SIDE_OFFSET as ot, TRANSFORM_BOX_SIDE_PRIORITY as p, DEFAULT_STRIPES_SPACING_PX as pt, drawParametricHandles as q, HUDHitPriority as r, DEFAULT_RULER_OVERLAP_THRESHOLD as rt, NO_MODS as s, DEFAULT_RULER_TICK_HEIGHT as st, Surface as t, DEFAULT_RULER_DRAG_THRESHOLD as tt, TRANSFORM_BOX_CORNER_HIT_SIZE as u, DEFAULT_PIXEL_GRID_STEPS as ut, reduceTransformBox as v, MIN_CHROME_VISIBLE_SIZE as w, PADDING_HANDLE_PRIORITY as x, buildPaddingOverlay as y, cornerRadiusLayoutGroups as z };
7070
+ export { DEFAULT_RULER_ACCENT_BACKGROUND as $, measurementToHUDDraw as A, cornerRadiusHandlePosRect as B, PADDING_HANDLE_PRIORITY as C, MIN_HIT_SIZE as D, MIN_CHROME_VISIBLE_SIZE as E, DEFAULT_CORNER_RADIUS_HANDLE_SIZE as F, DEFAULT_PARAMETRIC_HANDLE_INSET as G, drawCornerRadius as H, DEFAULT_CORNER_RADIUS_HIT_SIZE as I, computeParametricHandleLayout as J, DEFAULT_PARAMETRIC_HANDLE_SIZE as K, computeCornerRadiusLayout as L, filterHUDDrawByGroup as M, HUDCanvas as N, lassoToHUDDraw as O, DEFAULT_CORNER_RADIUS_HANDLE_INSET as P, resolveParametricHandleByDirection as Q, cornerRadiusAnchorSign as R, PADDING_HANDLE_LENGTH as S, PADDING_REGION_PRIORITY as T, resolveCenterDragAnchor as U, cornerRadiusLayoutGroups as V, resolveCornerDragAnchor$1 as W, parametricHandleLayoutGroups as X, drawParametricHandles as Y, projectParametricHandleValue as Z, cornersToBoxTransform as _, buildStripesTile as _t, HUDHitPriority as a, DEFAULT_RULER_OVERLAP_THRESHOLD as at, reduceTransformBox as b, negotiateAxis as c, DEFAULT_RULER_TEXT_SIDE_OFFSET as ct, TRANSFORM_BOX_BODY_PRIORITY as d, DEFAULT_PIXEL_GRID_COLOR as dt, DEFAULT_RULER_ACCENT_COLOR as et, TRANSFORM_BOX_CORNER_HIT_SIZE as f, DEFAULT_PIXEL_GRID_STEPS as ft, compose as g, DEFAULT_STRIPES_THICKNESS_PX as gt, TRANSFORM_BOX_SIDE_PRIORITY as h, DEFAULT_STRIPES_SPACING_PX as ht, BODY_FLIP_THRESHOLD as i, DEFAULT_RULER_FONT as it, snapGuideToHUDDraw as j, marqueeToHUDDraw as k, NO_MODS as l, DEFAULT_RULER_TICK_HEIGHT as lt, TRANSFORM_BOX_SIDE_HIT_THICKNESS as m, DEFAULT_STRIPES_ANGLE_DEG as mt, DEFAULT_CARET_SCREEN_WIDTH as n, DEFAULT_RULER_COLOR as nt, MIN_GUARANTEED_INTERACTIVE_DIM as o, DEFAULT_RULER_STEPS as ot, TRANSFORM_BOX_CORNER_PRIORITY as p, drawPixelGrid as pt, DEFAULT_PARAMETRIC_HIT_SIZE as q, buildTextEditChrome as r, DEFAULT_RULER_DRAG_THRESHOLD as rt, computeSelectionControlLayout as s, DEFAULT_RULER_STRIP as st, Surface as t, DEFAULT_RULER_BACKGROUND as tt, buildTransformBox as u, drawRuler as ut, decompose as v, computeStripesTileGeometry as vt, PADDING_HANDLE_THICKNESS as w, buildPaddingOverlay as x, getTransformBoxCorners as y, resolvePaint as yt, cornerRadiusHandlePosLine as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grida/hud",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "private": false,
5
5
  "description": "Canvas-based heads-up display for the Grida editor viewport",
6
6
  "keywords": [