@grida/hud 0.2.4 → 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.
- package/dist/{index-DHVvd2ak.d.mts → index-Df4QB6Yr.d.mts} +135 -2
- package/dist/{index-KI1k5HJX.d.ts → index-E7n0yPim.d.ts} +135 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -1
- package/dist/index.mjs +2 -2
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +1 -1
- package/dist/react.mjs +1 -1
- package/dist/{surface-pUdCqwPj.js → surface-Bd6zw8O0.js} +144 -5
- package/dist/{surface-Dh43cAhb.mjs → surface-CNF9XW6b.mjs} +133 -6
- package/package.json +1 -1
|
@@ -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";
|
|
@@ -385,6 +385,10 @@ type SurfaceGesture = {
|
|
|
385
385
|
*/
|
|
386
386
|
initial_shape: SelectionShape; /** Anchor (pointer-down) in document-space. */
|
|
387
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;
|
|
388
392
|
/** Current shape during the gesture. Same kind as `initial_shape`.
|
|
389
393
|
* Opposite-anchored — feeds the emitted `resize` intent (move +
|
|
390
394
|
* commit). The host derives its own anchor (e.g. Alt → center)
|
|
@@ -2830,6 +2834,109 @@ declare function buildTransformBox(input: {
|
|
|
2830
2834
|
active_op?: TransformBoxActiveOp;
|
|
2831
2835
|
}): OverlayElement[];
|
|
2832
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
|
|
2833
2940
|
//#region surface/surface.d.ts
|
|
2834
2941
|
interface SurfaceVisibilityContext {
|
|
2835
2942
|
gesture: SurfaceGesture;
|
|
@@ -2986,6 +3093,12 @@ declare class Surface {
|
|
|
2986
3093
|
* `setPaddingOverlay`.
|
|
2987
3094
|
*/
|
|
2988
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;
|
|
2989
3102
|
private colorOverride;
|
|
2990
3103
|
private width;
|
|
2991
3104
|
private height;
|
|
@@ -3088,6 +3201,26 @@ declare class Surface {
|
|
|
3088
3201
|
* paint/hit/priority details.
|
|
3089
3202
|
*/
|
|
3090
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;
|
|
3091
3224
|
/**
|
|
3092
3225
|
* Push a transform-box input — the `transform-box` named class for
|
|
3093
3226
|
* a 2×3 affine transform manipulated via quad outline + 4 corners +
|
|
@@ -3222,4 +3355,4 @@ declare class Surface {
|
|
|
3222
3355
|
private registerParametricHandleHitRegions;
|
|
3223
3356
|
}
|
|
3224
3357
|
//#endregion
|
|
3225
|
-
export {
|
|
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";
|
|
@@ -385,6 +385,10 @@ type SurfaceGesture = {
|
|
|
385
385
|
*/
|
|
386
386
|
initial_shape: SelectionShape; /** Anchor (pointer-down) in document-space. */
|
|
387
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;
|
|
388
392
|
/** Current shape during the gesture. Same kind as `initial_shape`.
|
|
389
393
|
* Opposite-anchored — feeds the emitted `resize` intent (move +
|
|
390
394
|
* commit). The host derives its own anchor (e.g. Alt → center)
|
|
@@ -2830,6 +2834,109 @@ declare function buildTransformBox(input: {
|
|
|
2830
2834
|
active_op?: TransformBoxActiveOp;
|
|
2831
2835
|
}): OverlayElement[];
|
|
2832
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
|
|
2833
2940
|
//#region surface/surface.d.ts
|
|
2834
2941
|
interface SurfaceVisibilityContext {
|
|
2835
2942
|
gesture: SurfaceGesture;
|
|
@@ -2986,6 +3093,12 @@ declare class Surface {
|
|
|
2986
3093
|
* `setPaddingOverlay`.
|
|
2987
3094
|
*/
|
|
2988
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;
|
|
2989
3102
|
private colorOverride;
|
|
2990
3103
|
private width;
|
|
2991
3104
|
private height;
|
|
@@ -3088,6 +3201,26 @@ declare class Surface {
|
|
|
3088
3201
|
* paint/hit/priority details.
|
|
3089
3202
|
*/
|
|
3090
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;
|
|
3091
3224
|
/**
|
|
3092
3225
|
* Push a transform-box input — the `transform-box` named class for
|
|
3093
3226
|
* a 2×3 affine transform manipulated via quad outline + 4 corners +
|
|
@@ -3222,4 +3355,4 @@ declare class Surface {
|
|
|
3222
3355
|
private registerParametricHandleHitRegions;
|
|
3223
3356
|
}
|
|
3224
3357
|
//#endregion
|
|
3225
|
-
export {
|
|
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
|
|
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
|
|
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-
|
|
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
|
|
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-
|
|
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-
|
|
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-
|
|
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 {
|
|
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";
|
|
@@ -3600,12 +3600,31 @@ var SurfaceState = class {
|
|
|
3600
3600
|
return this.onPointerUp(event.x, event.y, event.button, deps);
|
|
3601
3601
|
case "modifiers":
|
|
3602
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
|
+
}
|
|
3603
3615
|
return emptyResponse();
|
|
3604
3616
|
case "wheel":
|
|
3605
3617
|
case "key": return emptyResponse();
|
|
3606
3618
|
case "blur": return this.onBlur(deps);
|
|
3607
3619
|
}
|
|
3608
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
|
+
}
|
|
3609
3628
|
onPointerMove(sx, sy, mods, deps) {
|
|
3610
3629
|
this.modifiers = mods;
|
|
3611
3630
|
const response = emptyResponse();
|
|
@@ -3773,11 +3792,12 @@ var SurfaceState = class {
|
|
|
3773
3792
|
const dx = point_doc[0] - g.anchor_doc[0];
|
|
3774
3793
|
const dy = point_doc[1] - g.anchor_doc[1];
|
|
3775
3794
|
const next_shape = applyResize(g.initial_shape, g.direction, dx, dy);
|
|
3776
|
-
const preview_shape = this.
|
|
3795
|
+
const preview_shape = this.resizePreviewShape(g, dx, dy, next_shape);
|
|
3777
3796
|
this.gesture = {
|
|
3778
3797
|
...g,
|
|
3779
3798
|
current_shape: next_shape,
|
|
3780
|
-
preview_shape
|
|
3799
|
+
preview_shape,
|
|
3800
|
+
last_doc: point_doc
|
|
3781
3801
|
};
|
|
3782
3802
|
deps.emitIntent({
|
|
3783
3803
|
kind: "resize",
|
|
@@ -4246,6 +4266,7 @@ var SurfaceState = class {
|
|
|
4246
4266
|
direction: decision.direction,
|
|
4247
4267
|
initial_shape: decision.initial_shape,
|
|
4248
4268
|
anchor_doc: point_doc,
|
|
4269
|
+
last_doc: point_doc,
|
|
4249
4270
|
current_shape: decision.initial_shape,
|
|
4250
4271
|
preview_shape: decision.initial_shape
|
|
4251
4272
|
};
|
|
@@ -6425,6 +6446,83 @@ function emit_tangent_handle(args) {
|
|
|
6425
6446
|
});
|
|
6426
6447
|
}
|
|
6427
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
|
|
6428
6526
|
//#region surface/surface.ts
|
|
6429
6527
|
/**
|
|
6430
6528
|
* Top-level wired surface.
|
|
@@ -6439,6 +6537,7 @@ var Surface = class {
|
|
|
6439
6537
|
this.cornerRadius = [];
|
|
6440
6538
|
this.parametricHandles = [];
|
|
6441
6539
|
this.paddingOverlay = null;
|
|
6540
|
+
this.textEditChrome = null;
|
|
6442
6541
|
this.width = 0;
|
|
6443
6542
|
this.height = 0;
|
|
6444
6543
|
this.cursor_renderer = null;
|
|
@@ -6578,6 +6677,28 @@ var Surface = class {
|
|
|
6578
6677
|
this.paddingOverlay = input;
|
|
6579
6678
|
}
|
|
6580
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
|
+
/**
|
|
6581
6702
|
* Push a transform-box input — the `transform-box` named class for
|
|
6582
6703
|
* a 2×3 affine transform manipulated via quad outline + 4 corners +
|
|
6583
6704
|
* 4 sides + body. `null` = no chrome drawn (schema-level feature
|
|
@@ -6754,12 +6875,18 @@ var Surface = class {
|
|
|
6754
6875
|
}
|
|
6755
6876
|
this.hudCanvas.setParametricHandles(all_parametric);
|
|
6756
6877
|
} else this.hudCanvas.setParametricHandles(null);
|
|
6757
|
-
const
|
|
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 ? {
|
|
6758
6884
|
...decoration,
|
|
6759
6885
|
lines: lines.length > 0 ? [...decoration.lines ?? [], ...lines] : decoration.lines,
|
|
6760
|
-
polylines:
|
|
6886
|
+
polylines: all_polylines.length > 0 ? [...decoration.polylines ?? [], ...all_polylines] : decoration.polylines
|
|
6761
6887
|
} : decoration;
|
|
6762
|
-
|
|
6888
|
+
const all_screenRects = text_edit ? [...screenRects, ...text_edit.screenRects] : screenRects;
|
|
6889
|
+
this.hudCanvas.draw(filterHUDDrawByGroup(mergeDraws(decoration_with_extras, extra, all_screenRects), { hidden }));
|
|
6763
6890
|
}
|
|
6764
6891
|
/** Convenience: clear the canvas (e.g. when the host stops the surface). */
|
|
6765
6892
|
clear() {
|
|
@@ -6969,6 +7096,12 @@ Object.defineProperty(exports, "BODY_FLIP_THRESHOLD", {
|
|
|
6969
7096
|
return BODY_FLIP_THRESHOLD;
|
|
6970
7097
|
}
|
|
6971
7098
|
});
|
|
7099
|
+
Object.defineProperty(exports, "DEFAULT_CARET_SCREEN_WIDTH", {
|
|
7100
|
+
enumerable: true,
|
|
7101
|
+
get: function() {
|
|
7102
|
+
return DEFAULT_CARET_SCREEN_WIDTH;
|
|
7103
|
+
}
|
|
7104
|
+
});
|
|
6972
7105
|
Object.defineProperty(exports, "DEFAULT_CORNER_RADIUS_HANDLE_INSET", {
|
|
6973
7106
|
enumerable: true,
|
|
6974
7107
|
get: function() {
|
|
@@ -7215,6 +7348,12 @@ Object.defineProperty(exports, "buildStripesTile", {
|
|
|
7215
7348
|
return buildStripesTile;
|
|
7216
7349
|
}
|
|
7217
7350
|
});
|
|
7351
|
+
Object.defineProperty(exports, "buildTextEditChrome", {
|
|
7352
|
+
enumerable: true,
|
|
7353
|
+
get: function() {
|
|
7354
|
+
return buildTextEditChrome;
|
|
7355
|
+
}
|
|
7356
|
+
});
|
|
7218
7357
|
Object.defineProperty(exports, "buildTransformBox", {
|
|
7219
7358
|
enumerable: true,
|
|
7220
7359
|
get: function() {
|
|
@@ -3577,12 +3577,31 @@ var SurfaceState = class {
|
|
|
3577
3577
|
return this.onPointerUp(event.x, event.y, event.button, deps);
|
|
3578
3578
|
case "modifiers":
|
|
3579
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
|
+
}
|
|
3580
3592
|
return emptyResponse();
|
|
3581
3593
|
case "wheel":
|
|
3582
3594
|
case "key": return emptyResponse();
|
|
3583
3595
|
case "blur": return this.onBlur(deps);
|
|
3584
3596
|
}
|
|
3585
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
|
+
}
|
|
3586
3605
|
onPointerMove(sx, sy, mods, deps) {
|
|
3587
3606
|
this.modifiers = mods;
|
|
3588
3607
|
const response = emptyResponse();
|
|
@@ -3750,11 +3769,12 @@ var SurfaceState = class {
|
|
|
3750
3769
|
const dx = point_doc[0] - g.anchor_doc[0];
|
|
3751
3770
|
const dy = point_doc[1] - g.anchor_doc[1];
|
|
3752
3771
|
const next_shape = applyResize(g.initial_shape, g.direction, dx, dy);
|
|
3753
|
-
const preview_shape = this.
|
|
3772
|
+
const preview_shape = this.resizePreviewShape(g, dx, dy, next_shape);
|
|
3754
3773
|
this.gesture = {
|
|
3755
3774
|
...g,
|
|
3756
3775
|
current_shape: next_shape,
|
|
3757
|
-
preview_shape
|
|
3776
|
+
preview_shape,
|
|
3777
|
+
last_doc: point_doc
|
|
3758
3778
|
};
|
|
3759
3779
|
deps.emitIntent({
|
|
3760
3780
|
kind: "resize",
|
|
@@ -4223,6 +4243,7 @@ var SurfaceState = class {
|
|
|
4223
4243
|
direction: decision.direction,
|
|
4224
4244
|
initial_shape: decision.initial_shape,
|
|
4225
4245
|
anchor_doc: point_doc,
|
|
4246
|
+
last_doc: point_doc,
|
|
4226
4247
|
current_shape: decision.initial_shape,
|
|
4227
4248
|
preview_shape: decision.initial_shape
|
|
4228
4249
|
};
|
|
@@ -6402,6 +6423,83 @@ function emit_tangent_handle(args) {
|
|
|
6402
6423
|
});
|
|
6403
6424
|
}
|
|
6404
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
|
|
6405
6503
|
//#region surface/surface.ts
|
|
6406
6504
|
/**
|
|
6407
6505
|
* Top-level wired surface.
|
|
@@ -6416,6 +6514,7 @@ var Surface = class {
|
|
|
6416
6514
|
this.cornerRadius = [];
|
|
6417
6515
|
this.parametricHandles = [];
|
|
6418
6516
|
this.paddingOverlay = null;
|
|
6517
|
+
this.textEditChrome = null;
|
|
6419
6518
|
this.width = 0;
|
|
6420
6519
|
this.height = 0;
|
|
6421
6520
|
this.cursor_renderer = null;
|
|
@@ -6555,6 +6654,28 @@ var Surface = class {
|
|
|
6555
6654
|
this.paddingOverlay = input;
|
|
6556
6655
|
}
|
|
6557
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
|
+
/**
|
|
6558
6679
|
* Push a transform-box input — the `transform-box` named class for
|
|
6559
6680
|
* a 2×3 affine transform manipulated via quad outline + 4 corners +
|
|
6560
6681
|
* 4 sides + body. `null` = no chrome drawn (schema-level feature
|
|
@@ -6731,12 +6852,18 @@ var Surface = class {
|
|
|
6731
6852
|
}
|
|
6732
6853
|
this.hudCanvas.setParametricHandles(all_parametric);
|
|
6733
6854
|
} else this.hudCanvas.setParametricHandles(null);
|
|
6734
|
-
const
|
|
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 ? {
|
|
6735
6861
|
...decoration,
|
|
6736
6862
|
lines: lines.length > 0 ? [...decoration.lines ?? [], ...lines] : decoration.lines,
|
|
6737
|
-
polylines:
|
|
6863
|
+
polylines: all_polylines.length > 0 ? [...decoration.polylines ?? [], ...all_polylines] : decoration.polylines
|
|
6738
6864
|
} : decoration;
|
|
6739
|
-
|
|
6865
|
+
const all_screenRects = text_edit ? [...screenRects, ...text_edit.screenRects] : screenRects;
|
|
6866
|
+
this.hudCanvas.draw(filterHUDDrawByGroup(mergeDraws(decoration_with_extras, extra, all_screenRects), { hidden }));
|
|
6740
6867
|
}
|
|
6741
6868
|
/** Convenience: clear the canvas (e.g. when the host stops the surface). */
|
|
6742
6869
|
clear() {
|
|
@@ -6940,4 +7067,4 @@ function filterOverlaysByGroup(overlays, hidden) {
|
|
|
6940
7067
|
});
|
|
6941
7068
|
}
|
|
6942
7069
|
//#endregion
|
|
6943
|
-
export {
|
|
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 };
|