@grida/hud 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -2
- package/dist/{index-Cmbe2X5b.d.mts → index-BQtDtpHM.d.mts} +76 -1
- package/dist/{index-BrfEdWbQ.d.ts → index-BlfZbeEJ.d.ts} +76 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +4 -1
- package/dist/react.mjs +4 -1
- package/dist/{surface-BHQVvRFC.js → surface-D-Kt_jKx.js} +49 -5
- package/dist/{surface-NHSzUR8r.mjs → surface-DFo9q3y7.mjs} +49 -5
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -266,7 +266,10 @@ const surface = new Surface(canvasElement, {
|
|
|
266
266
|
// required wiring
|
|
267
267
|
pick: (point_doc) => editor.hitTest(point_doc), // (point) => NodeId | null
|
|
268
268
|
shapeOf: (id) => editor.shapeOf(id), // (id) => SelectionShape | null
|
|
269
|
-
onIntent: (intent) => editor.commitIntent(intent), // surface → host
|
|
269
|
+
onIntent: (intent) => editor.commitIntent(intent), // surface → host (commit)
|
|
270
|
+
|
|
271
|
+
// optional wiring
|
|
272
|
+
onTap: (tap) => tool.anchorAt(tap), // surface → host (observe; see "Tap outcome")
|
|
270
273
|
|
|
271
274
|
// optional config
|
|
272
275
|
style: { chromeColor: "#2563eb", handleSize: 8 },
|
|
@@ -463,6 +466,62 @@ This package's implementation:
|
|
|
463
466
|
|
|
464
467
|
Skim the spec before changing the classifier or its dispatch.
|
|
465
468
|
|
|
469
|
+
## Tap outcome
|
|
470
|
+
|
|
471
|
+
A **tap** is the surface's observe-only report that a discrete press+release
|
|
472
|
+
landed at a document-space point over a particular node (or empty canvas),
|
|
473
|
+
WITHOUT becoming a drag. It is delivered through the optional `onTap` wiring
|
|
474
|
+
callback — a sibling of `pick` / `shapeOf` / `onIntent`, deliberately NOT an
|
|
475
|
+
`Intent`:
|
|
476
|
+
|
|
477
|
+
- An `Intent` is an **actionable change the host commits** (the surface never
|
|
478
|
+
mutates the document; the host wraps `preview`/`commit`). A tap is a **fact
|
|
479
|
+
to observe** — there is nothing to commit. Folding it into `onIntent` would
|
|
480
|
+
contradict that union's documented meaning.
|
|
481
|
+
- A tap must be able to fire **without changing selection** — most importantly
|
|
482
|
+
the secondary button, which produces a tap and nothing else. Keeping it off
|
|
483
|
+
the selection-bearing intents preserves "Not a selection store" (Anti-goals).
|
|
484
|
+
|
|
485
|
+
```ts
|
|
486
|
+
import { type TapOutcome } from "@grida/hud";
|
|
487
|
+
|
|
488
|
+
const surface = new Surface(canvas, {
|
|
489
|
+
pick,
|
|
490
|
+
shapeOf,
|
|
491
|
+
onIntent,
|
|
492
|
+
onTap: (tap: TapOutcome) => {
|
|
493
|
+
// tap.point — document-space DOWN point the tap resolved against
|
|
494
|
+
// tap.button — "primary" | "secondary" (never "middle")
|
|
495
|
+
// tap.hit — topmost pick at point, or null for empty canvas
|
|
496
|
+
// tap.mods — modifier snapshot at press time
|
|
497
|
+
},
|
|
498
|
+
});
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
**Firing rules (the contract a consumer reads from the exports):**
|
|
502
|
+
|
|
503
|
+
- Fires on the press+release of `primary` and `secondary` buttons when the
|
|
504
|
+
pointer never crosses the drag threshold (`DRAG_THRESHOLD_PX = 3`).
|
|
505
|
+
- `point` is the **pointer-down** point, never the up point. For a tap on an
|
|
506
|
+
already-selected node — where the selection commits on pointer-**up** via the
|
|
507
|
+
deferred drag-candidate path — the down and up points differ by up to the
|
|
508
|
+
threshold; the surface reports the down point because that is what the tap
|
|
509
|
+
resolved against and the only one it still holds at release.
|
|
510
|
+
- A drag past the threshold emits **no** tap (it became a gesture). A press
|
|
511
|
+
that opens a handle gesture (resize / rotate / corner-radius / …) emits no
|
|
512
|
+
tap either — it is a handle interaction, not a content tap.
|
|
513
|
+
- `middle` never taps — it is reserved for pan.
|
|
514
|
+
- A secondary tap never mutates selection; the tap is its only outcome.
|
|
515
|
+
|
|
516
|
+
`hit` is carried (host-`pick`-resolved at down time), not host-re-derived — the
|
|
517
|
+
host observes the SAME node the surface resolved the tap against, consistent
|
|
518
|
+
with `select` carrying resolved ids.
|
|
519
|
+
|
|
520
|
+
> **`@unstable`.** `TapOutcome` is marked `@unstable` per the promotion bar
|
|
521
|
+
> ("two consumers shape the contract"): it ships against one consumer today.
|
|
522
|
+
> Fields may change without a semver bump until a second consumer exercises it.
|
|
523
|
+
> There is no reader in this package; it is a contract-first producer surface.
|
|
524
|
+
|
|
466
525
|
## Coordinate model
|
|
467
526
|
|
|
468
527
|
- All `SurfaceEvent` points are **screen-space** (CSS px relative to the canvas).
|
|
@@ -872,6 +931,9 @@ Non-exhaustive index — open the test files for the full surface.
|
|
|
872
931
|
| Dblclick on vertex / tangent / segment-strip WHILE in content-edit → handler runs (no exit) | `decision.test.ts` |
|
|
873
932
|
| Marquee starts from empty-space pointer-down | `state.test.ts` |
|
|
874
933
|
| Drag past threshold cancels a deferred select (drag-vs-click discriminator) | `state.test.ts` |
|
|
934
|
+
| Tap (press+release, no drag) reports the DOWN point — incl. the deferred commit-on-up path | `state.test.ts` |
|
|
935
|
+
| Tap fires for primary + secondary, never middle (pan); drag past threshold emits no tap | `state.test.ts` |
|
|
936
|
+
| Secondary tap changes no selection; empty-canvas tap carries `hit: null` | `state.test.ts` |
|
|
875
937
|
| Tangent knob renders as a 45°-rotated square ("diamond"), smaller than vertex | `classes/vector-path/surface-extended.test.ts` |
|
|
876
938
|
| Vertex knob renders as a circle, selected fills with chrome color | `classes/vector-path/surface-extended.test.ts` |
|
|
877
939
|
| Selected tangent line is thicker than idle | `classes/vector-path/surface-extended.test.ts` |
|
|
@@ -890,7 +952,7 @@ Non-exhaustive index — open the test files for the full surface.
|
|
|
890
952
|
| `handles.test.ts` | 8 resize + 4 rotate positions; screen-space hit-test; visibility threshold |
|
|
891
953
|
| `click-tracker.test.ts` | single vs double within window; position threshold; multi-button isolation |
|
|
892
954
|
| `gesture.test.ts` | legal transitions (idle↔translate/resize/marquee/cancel; deferred selection) |
|
|
893
|
-
| `state.test.ts` | dispatch sequences: click selects, drag-empty marquees, drag-handle resizes, drag-node translates, exit-edit
|
|
955
|
+
| `state.test.ts` | dispatch sequences: click selects, drag-empty marquees, drag-handle resizes, drag-node translates, exit-edit; observe-only tap outcome (down-point fidelity, primary/secondary, middle excluded, drag emits none, empty-canvas null hit) |
|
|
894
956
|
| `intent.test.ts` | intent stream + `phase` correctness across a full drag (preview·N → commit) |
|
|
895
957
|
| `decision.test.ts` | one test per named scenario in the selection-intent classifier, including ExitEdit gating |
|
|
896
958
|
| `chrome.test.ts` | given state + bounds, assert resulting `HUDDraw` shape — primitive counts and coords |
|
|
@@ -1393,6 +1393,8 @@ interface SurfaceResponse {
|
|
|
1393
1393
|
cursorChanged: boolean;
|
|
1394
1394
|
hoverChanged: boolean;
|
|
1395
1395
|
}
|
|
1396
|
+
/** Re-export Vector2 for convenience. */
|
|
1397
|
+
type Vector2 = cmath.Vector2;
|
|
1396
1398
|
//#endregion
|
|
1397
1399
|
//#region classes/padding/intent.d.ts
|
|
1398
1400
|
/**
|
|
@@ -1772,6 +1774,63 @@ type Intent = {
|
|
|
1772
1774
|
/** Callback the host implements to receive intents. */
|
|
1773
1775
|
type IntentHandler = (intent: Intent) => void;
|
|
1774
1776
|
//#endregion
|
|
1777
|
+
//#region event/tap.d.ts
|
|
1778
|
+
/**
|
|
1779
|
+
* Observe-only outcome: a discrete **tap** resolved on the surface.
|
|
1780
|
+
*
|
|
1781
|
+
* A tap is a press + release that stayed within the drag threshold — the
|
|
1782
|
+
* surface owns the press/release stream, the camera, and the click-vs-drag
|
|
1783
|
+
* discrimination, so it is the only layer that can report this fact
|
|
1784
|
+
* authoritatively. A pointer movement that crosses the drag threshold
|
|
1785
|
+
* becomes a gesture and produces NO tap.
|
|
1786
|
+
*
|
|
1787
|
+
* This is NOT an {@link import("./intent").Intent}. An `Intent` is an
|
|
1788
|
+
* actionable change the host commits (and the surface itself never mutates
|
|
1789
|
+
* the document); a tap is a pure observation — there is nothing to commit.
|
|
1790
|
+
* It is delivered through its own `onTap` callback, a sibling of `pick` /
|
|
1791
|
+
* `shapeOf` / `onIntent`, precisely so it can fire WITHOUT changing
|
|
1792
|
+
* selection (most importantly for the secondary button, which must never
|
|
1793
|
+
* mutate selection). Keeping it off the intent stream also keeps the
|
|
1794
|
+
* "selection store lives in the host" boundary clean: a tap that selects
|
|
1795
|
+
* nothing is still a first-class outcome.
|
|
1796
|
+
*
|
|
1797
|
+
* @unstable Shape is provisional until ≥2 consumers exercise it (the
|
|
1798
|
+
* package's promotion bar — "two consumers shape the contract"). Fields may
|
|
1799
|
+
* change without a semver bump until then.
|
|
1800
|
+
*/
|
|
1801
|
+
interface TapOutcome {
|
|
1802
|
+
/**
|
|
1803
|
+
* Document-space point the tap resolved against — the **pointer-down**
|
|
1804
|
+
* point, never the pointer-up point. For the deferred path (a tap on an
|
|
1805
|
+
* already-selected node, which commits selection on pointer-up) the down
|
|
1806
|
+
* and up points differ by up to the drag threshold; the surface reports
|
|
1807
|
+
* the down point because that is the point the tap was resolved against
|
|
1808
|
+
* and the only one it still holds at release time.
|
|
1809
|
+
*/
|
|
1810
|
+
point: Vector2;
|
|
1811
|
+
/**
|
|
1812
|
+
* Which button produced the tap. `"primary"` or `"secondary"` only —
|
|
1813
|
+
* `"middle"` is reserved for pan and never produces a tap.
|
|
1814
|
+
*/
|
|
1815
|
+
button: Exclude<PointerButton, "middle">;
|
|
1816
|
+
/**
|
|
1817
|
+
* Topmost host pick at `point` at press time, or `null` for empty canvas.
|
|
1818
|
+
* Carried (not host-re-derived) so the host observes the SAME node the
|
|
1819
|
+
* surface resolved the tap against — consistent with `select` carrying
|
|
1820
|
+
* resolved ids. Resolved via the host's own `pick` callback, so it
|
|
1821
|
+
* introduces no scene-graph awareness the surface didn't already have.
|
|
1822
|
+
*/
|
|
1823
|
+
hit: NodeId | null;
|
|
1824
|
+
/** Modifier snapshot at press time — already in hand on the surface event. */
|
|
1825
|
+
mods: Modifiers;
|
|
1826
|
+
}
|
|
1827
|
+
/**
|
|
1828
|
+
* Callback the host wires to observe taps. Optional in `SurfaceOptions` /
|
|
1829
|
+
* `StateDeps` — hosts that don't run a tap-driven tool simply omit it and
|
|
1830
|
+
* pay nothing.
|
|
1831
|
+
*/
|
|
1832
|
+
type TapHandler = (tap: TapOutcome) => void;
|
|
1833
|
+
//#endregion
|
|
1775
1834
|
//#region event/transform.d.ts
|
|
1776
1835
|
/**
|
|
1777
1836
|
* Surface camera transform: axis-aligned (scale + translate only).
|
|
@@ -2793,6 +2852,22 @@ interface SurfaceOptions {
|
|
|
2793
2852
|
vectorOf?: (id: NodeId) => VectorOverlay | null;
|
|
2794
2853
|
/** Surface emits intents the host commits. */
|
|
2795
2854
|
onIntent: IntentHandler;
|
|
2855
|
+
/**
|
|
2856
|
+
* Optional observe-only tap sink. Fires once per discrete tap (press +
|
|
2857
|
+
* release within the drag threshold) for the primary and secondary
|
|
2858
|
+
* buttons — never the middle button (pan), never a drag. The outcome
|
|
2859
|
+
* carries the document-space DOWN point, the button, the topmost host
|
|
2860
|
+
* pick at that point (or `null` for empty canvas), and the modifier
|
|
2861
|
+
* snapshot.
|
|
2862
|
+
*
|
|
2863
|
+
* Distinct from `onIntent` by design: a tap is a fact to observe, not a
|
|
2864
|
+
* change to commit, and it must be able to fire WITHOUT mutating
|
|
2865
|
+
* selection (most importantly for the secondary button). Hosts that don't
|
|
2866
|
+
* run a tap-driven tool omit it and pay nothing.
|
|
2867
|
+
*
|
|
2868
|
+
* @unstable — see {@link TapOutcome}.
|
|
2869
|
+
*/
|
|
2870
|
+
onTap?: TapHandler;
|
|
2796
2871
|
/** Initial style (partial; merged with defaults). */
|
|
2797
2872
|
style?: Partial<HUDStyle>;
|
|
2798
2873
|
/** Initial readonly flag. Default `false`. */
|
|
@@ -3137,4 +3212,4 @@ declare class Surface {
|
|
|
3137
3212
|
private registerParametricHandleHitRegions;
|
|
3138
3213
|
}
|
|
3139
3214
|
//#endregion
|
|
3140
|
-
export {
|
|
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 };
|
|
@@ -1393,6 +1393,8 @@ interface SurfaceResponse {
|
|
|
1393
1393
|
cursorChanged: boolean;
|
|
1394
1394
|
hoverChanged: boolean;
|
|
1395
1395
|
}
|
|
1396
|
+
/** Re-export Vector2 for convenience. */
|
|
1397
|
+
type Vector2 = cmath.Vector2;
|
|
1396
1398
|
//#endregion
|
|
1397
1399
|
//#region classes/padding/intent.d.ts
|
|
1398
1400
|
/**
|
|
@@ -1772,6 +1774,63 @@ type Intent = {
|
|
|
1772
1774
|
/** Callback the host implements to receive intents. */
|
|
1773
1775
|
type IntentHandler = (intent: Intent) => void;
|
|
1774
1776
|
//#endregion
|
|
1777
|
+
//#region event/tap.d.ts
|
|
1778
|
+
/**
|
|
1779
|
+
* Observe-only outcome: a discrete **tap** resolved on the surface.
|
|
1780
|
+
*
|
|
1781
|
+
* A tap is a press + release that stayed within the drag threshold — the
|
|
1782
|
+
* surface owns the press/release stream, the camera, and the click-vs-drag
|
|
1783
|
+
* discrimination, so it is the only layer that can report this fact
|
|
1784
|
+
* authoritatively. A pointer movement that crosses the drag threshold
|
|
1785
|
+
* becomes a gesture and produces NO tap.
|
|
1786
|
+
*
|
|
1787
|
+
* This is NOT an {@link import("./intent").Intent}. An `Intent` is an
|
|
1788
|
+
* actionable change the host commits (and the surface itself never mutates
|
|
1789
|
+
* the document); a tap is a pure observation — there is nothing to commit.
|
|
1790
|
+
* It is delivered through its own `onTap` callback, a sibling of `pick` /
|
|
1791
|
+
* `shapeOf` / `onIntent`, precisely so it can fire WITHOUT changing
|
|
1792
|
+
* selection (most importantly for the secondary button, which must never
|
|
1793
|
+
* mutate selection). Keeping it off the intent stream also keeps the
|
|
1794
|
+
* "selection store lives in the host" boundary clean: a tap that selects
|
|
1795
|
+
* nothing is still a first-class outcome.
|
|
1796
|
+
*
|
|
1797
|
+
* @unstable Shape is provisional until ≥2 consumers exercise it (the
|
|
1798
|
+
* package's promotion bar — "two consumers shape the contract"). Fields may
|
|
1799
|
+
* change without a semver bump until then.
|
|
1800
|
+
*/
|
|
1801
|
+
interface TapOutcome {
|
|
1802
|
+
/**
|
|
1803
|
+
* Document-space point the tap resolved against — the **pointer-down**
|
|
1804
|
+
* point, never the pointer-up point. For the deferred path (a tap on an
|
|
1805
|
+
* already-selected node, which commits selection on pointer-up) the down
|
|
1806
|
+
* and up points differ by up to the drag threshold; the surface reports
|
|
1807
|
+
* the down point because that is the point the tap was resolved against
|
|
1808
|
+
* and the only one it still holds at release time.
|
|
1809
|
+
*/
|
|
1810
|
+
point: Vector2;
|
|
1811
|
+
/**
|
|
1812
|
+
* Which button produced the tap. `"primary"` or `"secondary"` only —
|
|
1813
|
+
* `"middle"` is reserved for pan and never produces a tap.
|
|
1814
|
+
*/
|
|
1815
|
+
button: Exclude<PointerButton, "middle">;
|
|
1816
|
+
/**
|
|
1817
|
+
* Topmost host pick at `point` at press time, or `null` for empty canvas.
|
|
1818
|
+
* Carried (not host-re-derived) so the host observes the SAME node the
|
|
1819
|
+
* surface resolved the tap against — consistent with `select` carrying
|
|
1820
|
+
* resolved ids. Resolved via the host's own `pick` callback, so it
|
|
1821
|
+
* introduces no scene-graph awareness the surface didn't already have.
|
|
1822
|
+
*/
|
|
1823
|
+
hit: NodeId | null;
|
|
1824
|
+
/** Modifier snapshot at press time — already in hand on the surface event. */
|
|
1825
|
+
mods: Modifiers;
|
|
1826
|
+
}
|
|
1827
|
+
/**
|
|
1828
|
+
* Callback the host wires to observe taps. Optional in `SurfaceOptions` /
|
|
1829
|
+
* `StateDeps` — hosts that don't run a tap-driven tool simply omit it and
|
|
1830
|
+
* pay nothing.
|
|
1831
|
+
*/
|
|
1832
|
+
type TapHandler = (tap: TapOutcome) => void;
|
|
1833
|
+
//#endregion
|
|
1775
1834
|
//#region event/transform.d.ts
|
|
1776
1835
|
/**
|
|
1777
1836
|
* Surface camera transform: axis-aligned (scale + translate only).
|
|
@@ -2793,6 +2852,22 @@ interface SurfaceOptions {
|
|
|
2793
2852
|
vectorOf?: (id: NodeId) => VectorOverlay | null;
|
|
2794
2853
|
/** Surface emits intents the host commits. */
|
|
2795
2854
|
onIntent: IntentHandler;
|
|
2855
|
+
/**
|
|
2856
|
+
* Optional observe-only tap sink. Fires once per discrete tap (press +
|
|
2857
|
+
* release within the drag threshold) for the primary and secondary
|
|
2858
|
+
* buttons — never the middle button (pan), never a drag. The outcome
|
|
2859
|
+
* carries the document-space DOWN point, the button, the topmost host
|
|
2860
|
+
* pick at that point (or `null` for empty canvas), and the modifier
|
|
2861
|
+
* snapshot.
|
|
2862
|
+
*
|
|
2863
|
+
* Distinct from `onIntent` by design: a tap is a fact to observe, not a
|
|
2864
|
+
* change to commit, and it must be able to fire WITHOUT mutating
|
|
2865
|
+
* selection (most importantly for the secondary button). Hosts that don't
|
|
2866
|
+
* run a tap-driven tool omit it and pay nothing.
|
|
2867
|
+
*
|
|
2868
|
+
* @unstable — see {@link TapOutcome}.
|
|
2869
|
+
*/
|
|
2870
|
+
onTap?: TapHandler;
|
|
2796
2871
|
/** Initial style (partial; merged with defaults). */
|
|
2797
2872
|
style?: Partial<HUDStyle>;
|
|
2798
2873
|
/** Initial readonly flag. Default `false`. */
|
|
@@ -3137,4 +3212,4 @@ declare class Surface {
|
|
|
3137
3212
|
private registerParametricHandleHitRegions;
|
|
3138
3213
|
}
|
|
3139
3214
|
//#endregion
|
|
3140
|
-
export {
|
|
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 };
|
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 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";
|
|
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 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_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 };
|
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 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";
|
|
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 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_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 };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_surface = require("./surface-
|
|
2
|
+
const require_surface = require("./surface-D-Kt_jKx.js");
|
|
3
3
|
const require_cursor = require("./cursor-FGiJBdU-.js");
|
|
4
4
|
exports.BODY_FLIP_THRESHOLD = require_surface.BODY_FLIP_THRESHOLD;
|
|
5
5
|
exports.DEFAULT_CORNER_RADIUS_HANDLE_INSET = require_surface.DEFAULT_CORNER_RADIUS_HANDLE_INSET;
|
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-
|
|
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";
|
|
2
2
|
import { i as cursorToCss, r as cursorEquals } from "./cursor-DW-uAPVE.mjs";
|
|
3
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 };
|
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-BQtDtpHM.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-BlfZbeEJ.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-D-Kt_jKx.js");
|
|
4
4
|
let react = require("react");
|
|
5
5
|
react = require_surface.__toESM(react);
|
|
6
6
|
let _grida_cmath__snap = require("@grida/cmath/_snap");
|
|
@@ -22,15 +22,18 @@ function useHUDSurface(canvasRef, options) {
|
|
|
22
22
|
const pickRef = react.useRef(options.pick);
|
|
23
23
|
const shapeOfRef = react.useRef(options.shapeOf);
|
|
24
24
|
const onIntentRef = react.useRef(options.onIntent);
|
|
25
|
+
const onTapRef = react.useRef(options.onTap);
|
|
25
26
|
pickRef.current = options.pick;
|
|
26
27
|
shapeOfRef.current = options.shapeOf;
|
|
27
28
|
onIntentRef.current = options.onIntent;
|
|
29
|
+
onTapRef.current = options.onTap;
|
|
28
30
|
react.useLayoutEffect(() => {
|
|
29
31
|
if (!canvasRef.current) return;
|
|
30
32
|
const s = new require_surface.Surface(canvasRef.current, {
|
|
31
33
|
pick: (p) => pickRef.current(p),
|
|
32
34
|
shapeOf: (id) => shapeOfRef.current(id),
|
|
33
35
|
onIntent: (i) => onIntentRef.current(i),
|
|
36
|
+
onTap: (t) => onTapRef.current?.(t),
|
|
34
37
|
style: options.style,
|
|
35
38
|
readonly: options.readonly,
|
|
36
39
|
color: options.color,
|
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-
|
|
2
|
+
import { D as marqueeToHUDDraw, E as lassoToHUDDraw, O as measurementToHUDDraw, j as HUDCanvas, k as snapGuideToHUDDraw, t as Surface } from "./surface-DFo9q3y7.mjs";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { guide } from "@grida/cmath/_snap";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -20,15 +20,18 @@ function useHUDSurface(canvasRef, options) {
|
|
|
20
20
|
const pickRef = React.useRef(options.pick);
|
|
21
21
|
const shapeOfRef = React.useRef(options.shapeOf);
|
|
22
22
|
const onIntentRef = React.useRef(options.onIntent);
|
|
23
|
+
const onTapRef = React.useRef(options.onTap);
|
|
23
24
|
pickRef.current = options.pick;
|
|
24
25
|
shapeOfRef.current = options.shapeOf;
|
|
25
26
|
onIntentRef.current = options.onIntent;
|
|
27
|
+
onTapRef.current = options.onTap;
|
|
26
28
|
React.useLayoutEffect(() => {
|
|
27
29
|
if (!canvasRef.current) return;
|
|
28
30
|
const s = new Surface(canvasRef.current, {
|
|
29
31
|
pick: (p) => pickRef.current(p),
|
|
30
32
|
shapeOf: (id) => shapeOfRef.current(id),
|
|
31
33
|
onIntent: (i) => onIntentRef.current(i),
|
|
34
|
+
onTap: (t) => onTapRef.current?.(t),
|
|
32
35
|
style: options.style,
|
|
33
36
|
readonly: options.readonly,
|
|
34
37
|
color: options.color,
|
|
@@ -2931,6 +2931,7 @@ var HitRegions = class {
|
|
|
2931
2931
|
*/
|
|
2932
2932
|
function classifyScenario(input) {
|
|
2933
2933
|
const { ui_action, hovered_id, selection_ids, modifiers, click_count, readonly, in_content_edit, sub_selection } = input;
|
|
2934
|
+
const meta_marquee = modifiers.meta && !in_content_edit && click_count < 2;
|
|
2934
2935
|
if (in_content_edit && click_count >= 2) {
|
|
2935
2936
|
if (!(ui_action && (ui_action.kind === "vertex_handle" || ui_action.kind === "tangent_handle" || ui_action.kind === "segment_strip" || ui_action.kind === "ghost_handle" || ui_action.kind === "region"))) return "ExitEdit";
|
|
2936
2937
|
}
|
|
@@ -2959,10 +2960,14 @@ function classifyScenario(input) {
|
|
|
2959
2960
|
case "select_node": {
|
|
2960
2961
|
const id = ui_action.id;
|
|
2961
2962
|
if (click_count >= 2) return "EnterEdit";
|
|
2963
|
+
if (meta_marquee) return "MetaSelectOrMarquee";
|
|
2962
2964
|
return classifyContent(id, selection_ids, modifiers);
|
|
2963
2965
|
}
|
|
2964
|
-
case "translate_handle":
|
|
2966
|
+
case "translate_handle":
|
|
2967
|
+
if (meta_marquee) return contentId(ui_action, hovered_id) ? "MetaSelectOrMarquee" : "MetaMarquee";
|
|
2968
|
+
return classifyBodyRegion(hovered_id, selection_ids, modifiers, click_count);
|
|
2965
2969
|
}
|
|
2970
|
+
if (meta_marquee) return hovered_id ? "MetaSelectOrMarquee" : "MetaMarquee";
|
|
2966
2971
|
if (hovered_id) {
|
|
2967
2972
|
if (click_count >= 2) return "EnterEdit";
|
|
2968
2973
|
return classifyContent(hovered_id, selection_ids, modifiers);
|
|
@@ -3307,10 +3312,22 @@ function dispatch(scenario, input) {
|
|
|
3307
3312
|
emit_on_down: "clear_vector_selection"
|
|
3308
3313
|
};
|
|
3309
3314
|
case "EmptyMarquee":
|
|
3310
|
-
case "EmptyAdditiveMarquee":
|
|
3315
|
+
case "EmptyAdditiveMarquee":
|
|
3316
|
+
case "MetaMarquee": return {
|
|
3311
3317
|
kind: "start_marquee_pend",
|
|
3312
3318
|
emit_on_down: "none"
|
|
3313
3319
|
};
|
|
3320
|
+
case "MetaSelectOrMarquee": return {
|
|
3321
|
+
kind: "pend",
|
|
3322
|
+
pending: {
|
|
3323
|
+
ids_at_down: [],
|
|
3324
|
+
deferred: {
|
|
3325
|
+
kind: "select",
|
|
3326
|
+
node_id: contentId(ui_action, hovered_id),
|
|
3327
|
+
shift: modifiers.shift
|
|
3328
|
+
}
|
|
3329
|
+
}
|
|
3330
|
+
};
|
|
3314
3331
|
}
|
|
3315
3332
|
}
|
|
3316
3333
|
/** Resolve the id that the user clicked on for content-class scenarios. */
|
|
@@ -3414,6 +3431,7 @@ var SurfaceState = class {
|
|
|
3414
3431
|
this.hit_regions = new HitRegions();
|
|
3415
3432
|
this.click_tracker = new ClickTracker();
|
|
3416
3433
|
this.pending = null;
|
|
3434
|
+
this.tap_candidate = null;
|
|
3417
3435
|
this.vector_selection = null;
|
|
3418
3436
|
this.vector_hover = null;
|
|
3419
3437
|
this.padding_hover = null;
|
|
@@ -3598,6 +3616,11 @@ var SurfaceState = class {
|
|
|
3598
3616
|
this.modifiers = mods;
|
|
3599
3617
|
const response = emptyResponse();
|
|
3600
3618
|
const point_doc = screenToDoc(this.transform, sx, sy);
|
|
3619
|
+
if (this.tap_candidate) {
|
|
3620
|
+
const tdx = sx - this.tap_candidate.anchor_screen[0];
|
|
3621
|
+
const tdy = sy - this.tap_candidate.anchor_screen[1];
|
|
3622
|
+
if (tdx * tdx + tdy * tdy >= DRAG_THRESHOLD_PX * DRAG_THRESHOLD_PX) this.tap_candidate = null;
|
|
3623
|
+
}
|
|
3601
3624
|
if (this.pending && this.gesture.kind === "idle") {
|
|
3602
3625
|
const ax = this.pending.anchor_screen[0];
|
|
3603
3626
|
const ay = this.pending.anchor_screen[1];
|
|
@@ -4067,11 +4090,22 @@ var SurfaceState = class {
|
|
|
4067
4090
|
}
|
|
4068
4091
|
onPointerDown(sx, sy, button, deps) {
|
|
4069
4092
|
const response = emptyResponse();
|
|
4070
|
-
if (button !== "primary") return response;
|
|
4071
4093
|
const point_doc = screenToDoc(this.transform, sx, sy);
|
|
4072
4094
|
const screen = [sx, sy];
|
|
4095
|
+
let tap_hit = null;
|
|
4096
|
+
if (button !== "middle") {
|
|
4097
|
+
tap_hit = deps.pick(point_doc);
|
|
4098
|
+
this.tap_candidate = {
|
|
4099
|
+
anchor_doc: point_doc,
|
|
4100
|
+
anchor_screen: screen,
|
|
4101
|
+
button,
|
|
4102
|
+
hit: tap_hit,
|
|
4103
|
+
mods: { ...this.modifiers }
|
|
4104
|
+
};
|
|
4105
|
+
}
|
|
4106
|
+
if (button !== "primary") return response;
|
|
4073
4107
|
const ui_action = this.hit_regions.hitTest(screen);
|
|
4074
|
-
const hovered_id =
|
|
4108
|
+
const hovered_id = tap_hit;
|
|
4075
4109
|
const click_count = this.click_tracker.register(sx, sy);
|
|
4076
4110
|
if (ui_action && ui_action.kind === "corner_radius_handle") {
|
|
4077
4111
|
if (this.readonly) return response;
|
|
@@ -4395,6 +4429,14 @@ var SurfaceState = class {
|
|
|
4395
4429
|
}
|
|
4396
4430
|
onPointerUp(_sx, _sy, button, deps) {
|
|
4397
4431
|
const response = emptyResponse();
|
|
4432
|
+
const tap = this.tap_candidate;
|
|
4433
|
+
this.tap_candidate = null;
|
|
4434
|
+
if (tap && tap.button === button && this.gesture.kind === "idle") deps.emitTap?.({
|
|
4435
|
+
point: tap.anchor_doc,
|
|
4436
|
+
button: tap.button,
|
|
4437
|
+
hit: tap.hit,
|
|
4438
|
+
mods: tap.mods
|
|
4439
|
+
});
|
|
4398
4440
|
if (button !== "primary") return response;
|
|
4399
4441
|
if (this.pending && this.pending.deferred) {
|
|
4400
4442
|
const d = this.pending.deferred;
|
|
@@ -4685,6 +4727,7 @@ var SurfaceState = class {
|
|
|
4685
4727
|
onBlur(deps) {
|
|
4686
4728
|
const response = emptyResponse();
|
|
4687
4729
|
this.pending = null;
|
|
4730
|
+
this.tap_candidate = null;
|
|
4688
4731
|
if (this.gesture.kind !== "idle") {
|
|
4689
4732
|
deps.emitIntent({ kind: "cancel_gesture" });
|
|
4690
4733
|
this.gesture = IDLE;
|
|
@@ -6637,7 +6680,8 @@ var Surface = class {
|
|
|
6637
6680
|
return this.state.dispatch(event, {
|
|
6638
6681
|
pick: this.opts.pick,
|
|
6639
6682
|
shapeOf: this.opts.shapeOf,
|
|
6640
|
-
emitIntent: this.opts.onIntent
|
|
6683
|
+
emitIntent: this.opts.onIntent,
|
|
6684
|
+
emitTap: this.opts.onTap
|
|
6641
6685
|
});
|
|
6642
6686
|
}
|
|
6643
6687
|
draw(extra) {
|
|
@@ -2908,6 +2908,7 @@ var HitRegions = class {
|
|
|
2908
2908
|
*/
|
|
2909
2909
|
function classifyScenario(input) {
|
|
2910
2910
|
const { ui_action, hovered_id, selection_ids, modifiers, click_count, readonly, in_content_edit, sub_selection } = input;
|
|
2911
|
+
const meta_marquee = modifiers.meta && !in_content_edit && click_count < 2;
|
|
2911
2912
|
if (in_content_edit && click_count >= 2) {
|
|
2912
2913
|
if (!(ui_action && (ui_action.kind === "vertex_handle" || ui_action.kind === "tangent_handle" || ui_action.kind === "segment_strip" || ui_action.kind === "ghost_handle" || ui_action.kind === "region"))) return "ExitEdit";
|
|
2913
2914
|
}
|
|
@@ -2936,10 +2937,14 @@ function classifyScenario(input) {
|
|
|
2936
2937
|
case "select_node": {
|
|
2937
2938
|
const id = ui_action.id;
|
|
2938
2939
|
if (click_count >= 2) return "EnterEdit";
|
|
2940
|
+
if (meta_marquee) return "MetaSelectOrMarquee";
|
|
2939
2941
|
return classifyContent(id, selection_ids, modifiers);
|
|
2940
2942
|
}
|
|
2941
|
-
case "translate_handle":
|
|
2943
|
+
case "translate_handle":
|
|
2944
|
+
if (meta_marquee) return contentId(ui_action, hovered_id) ? "MetaSelectOrMarquee" : "MetaMarquee";
|
|
2945
|
+
return classifyBodyRegion(hovered_id, selection_ids, modifiers, click_count);
|
|
2942
2946
|
}
|
|
2947
|
+
if (meta_marquee) return hovered_id ? "MetaSelectOrMarquee" : "MetaMarquee";
|
|
2943
2948
|
if (hovered_id) {
|
|
2944
2949
|
if (click_count >= 2) return "EnterEdit";
|
|
2945
2950
|
return classifyContent(hovered_id, selection_ids, modifiers);
|
|
@@ -3284,10 +3289,22 @@ function dispatch(scenario, input) {
|
|
|
3284
3289
|
emit_on_down: "clear_vector_selection"
|
|
3285
3290
|
};
|
|
3286
3291
|
case "EmptyMarquee":
|
|
3287
|
-
case "EmptyAdditiveMarquee":
|
|
3292
|
+
case "EmptyAdditiveMarquee":
|
|
3293
|
+
case "MetaMarquee": return {
|
|
3288
3294
|
kind: "start_marquee_pend",
|
|
3289
3295
|
emit_on_down: "none"
|
|
3290
3296
|
};
|
|
3297
|
+
case "MetaSelectOrMarquee": return {
|
|
3298
|
+
kind: "pend",
|
|
3299
|
+
pending: {
|
|
3300
|
+
ids_at_down: [],
|
|
3301
|
+
deferred: {
|
|
3302
|
+
kind: "select",
|
|
3303
|
+
node_id: contentId(ui_action, hovered_id),
|
|
3304
|
+
shift: modifiers.shift
|
|
3305
|
+
}
|
|
3306
|
+
}
|
|
3307
|
+
};
|
|
3291
3308
|
}
|
|
3292
3309
|
}
|
|
3293
3310
|
/** Resolve the id that the user clicked on for content-class scenarios. */
|
|
@@ -3391,6 +3408,7 @@ var SurfaceState = class {
|
|
|
3391
3408
|
this.hit_regions = new HitRegions();
|
|
3392
3409
|
this.click_tracker = new ClickTracker();
|
|
3393
3410
|
this.pending = null;
|
|
3411
|
+
this.tap_candidate = null;
|
|
3394
3412
|
this.vector_selection = null;
|
|
3395
3413
|
this.vector_hover = null;
|
|
3396
3414
|
this.padding_hover = null;
|
|
@@ -3575,6 +3593,11 @@ var SurfaceState = class {
|
|
|
3575
3593
|
this.modifiers = mods;
|
|
3576
3594
|
const response = emptyResponse();
|
|
3577
3595
|
const point_doc = screenToDoc(this.transform, sx, sy);
|
|
3596
|
+
if (this.tap_candidate) {
|
|
3597
|
+
const tdx = sx - this.tap_candidate.anchor_screen[0];
|
|
3598
|
+
const tdy = sy - this.tap_candidate.anchor_screen[1];
|
|
3599
|
+
if (tdx * tdx + tdy * tdy >= DRAG_THRESHOLD_PX * DRAG_THRESHOLD_PX) this.tap_candidate = null;
|
|
3600
|
+
}
|
|
3578
3601
|
if (this.pending && this.gesture.kind === "idle") {
|
|
3579
3602
|
const ax = this.pending.anchor_screen[0];
|
|
3580
3603
|
const ay = this.pending.anchor_screen[1];
|
|
@@ -4044,11 +4067,22 @@ var SurfaceState = class {
|
|
|
4044
4067
|
}
|
|
4045
4068
|
onPointerDown(sx, sy, button, deps) {
|
|
4046
4069
|
const response = emptyResponse();
|
|
4047
|
-
if (button !== "primary") return response;
|
|
4048
4070
|
const point_doc = screenToDoc(this.transform, sx, sy);
|
|
4049
4071
|
const screen = [sx, sy];
|
|
4072
|
+
let tap_hit = null;
|
|
4073
|
+
if (button !== "middle") {
|
|
4074
|
+
tap_hit = deps.pick(point_doc);
|
|
4075
|
+
this.tap_candidate = {
|
|
4076
|
+
anchor_doc: point_doc,
|
|
4077
|
+
anchor_screen: screen,
|
|
4078
|
+
button,
|
|
4079
|
+
hit: tap_hit,
|
|
4080
|
+
mods: { ...this.modifiers }
|
|
4081
|
+
};
|
|
4082
|
+
}
|
|
4083
|
+
if (button !== "primary") return response;
|
|
4050
4084
|
const ui_action = this.hit_regions.hitTest(screen);
|
|
4051
|
-
const hovered_id =
|
|
4085
|
+
const hovered_id = tap_hit;
|
|
4052
4086
|
const click_count = this.click_tracker.register(sx, sy);
|
|
4053
4087
|
if (ui_action && ui_action.kind === "corner_radius_handle") {
|
|
4054
4088
|
if (this.readonly) return response;
|
|
@@ -4372,6 +4406,14 @@ var SurfaceState = class {
|
|
|
4372
4406
|
}
|
|
4373
4407
|
onPointerUp(_sx, _sy, button, deps) {
|
|
4374
4408
|
const response = emptyResponse();
|
|
4409
|
+
const tap = this.tap_candidate;
|
|
4410
|
+
this.tap_candidate = null;
|
|
4411
|
+
if (tap && tap.button === button && this.gesture.kind === "idle") deps.emitTap?.({
|
|
4412
|
+
point: tap.anchor_doc,
|
|
4413
|
+
button: tap.button,
|
|
4414
|
+
hit: tap.hit,
|
|
4415
|
+
mods: tap.mods
|
|
4416
|
+
});
|
|
4375
4417
|
if (button !== "primary") return response;
|
|
4376
4418
|
if (this.pending && this.pending.deferred) {
|
|
4377
4419
|
const d = this.pending.deferred;
|
|
@@ -4662,6 +4704,7 @@ var SurfaceState = class {
|
|
|
4662
4704
|
onBlur(deps) {
|
|
4663
4705
|
const response = emptyResponse();
|
|
4664
4706
|
this.pending = null;
|
|
4707
|
+
this.tap_candidate = null;
|
|
4665
4708
|
if (this.gesture.kind !== "idle") {
|
|
4666
4709
|
deps.emitIntent({ kind: "cancel_gesture" });
|
|
4667
4710
|
this.gesture = IDLE;
|
|
@@ -6614,7 +6657,8 @@ var Surface = class {
|
|
|
6614
6657
|
return this.state.dispatch(event, {
|
|
6615
6658
|
pick: this.opts.pick,
|
|
6616
6659
|
shapeOf: this.opts.shapeOf,
|
|
6617
|
-
emitIntent: this.opts.onIntent
|
|
6660
|
+
emitIntent: this.opts.onIntent,
|
|
6661
|
+
emitTap: this.opts.onTap
|
|
6618
6662
|
});
|
|
6619
6663
|
}
|
|
6620
6664
|
draw(extra) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grida/hud",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Canvas-based heads-up display for the Grida editor viewport",
|
|
6
6
|
"keywords": [
|
|
@@ -16,7 +16,10 @@
|
|
|
16
16
|
"homepage": "https://grida.co/packages/@grida/hud",
|
|
17
17
|
"license": "MIT",
|
|
18
18
|
"author": "softmarshmallow",
|
|
19
|
-
"repository":
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/gridaco/grida"
|
|
22
|
+
},
|
|
20
23
|
"files": [
|
|
21
24
|
"dist"
|
|
22
25
|
],
|