@grida/hud 0.2.1 → 0.2.2
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-BHDH6P6p.js} +30 -3
- package/dist/{surface-NHSzUR8r.mjs → surface-B_8w6VWG.mjs} +30 -3
- 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-BHDH6P6p.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-B_8w6VWG.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-BHDH6P6p.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-B_8w6VWG.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,
|
|
@@ -3414,6 +3414,7 @@ var SurfaceState = class {
|
|
|
3414
3414
|
this.hit_regions = new HitRegions();
|
|
3415
3415
|
this.click_tracker = new ClickTracker();
|
|
3416
3416
|
this.pending = null;
|
|
3417
|
+
this.tap_candidate = null;
|
|
3417
3418
|
this.vector_selection = null;
|
|
3418
3419
|
this.vector_hover = null;
|
|
3419
3420
|
this.padding_hover = null;
|
|
@@ -3598,6 +3599,11 @@ var SurfaceState = class {
|
|
|
3598
3599
|
this.modifiers = mods;
|
|
3599
3600
|
const response = emptyResponse();
|
|
3600
3601
|
const point_doc = screenToDoc(this.transform, sx, sy);
|
|
3602
|
+
if (this.tap_candidate) {
|
|
3603
|
+
const tdx = sx - this.tap_candidate.anchor_screen[0];
|
|
3604
|
+
const tdy = sy - this.tap_candidate.anchor_screen[1];
|
|
3605
|
+
if (tdx * tdx + tdy * tdy >= DRAG_THRESHOLD_PX * DRAG_THRESHOLD_PX) this.tap_candidate = null;
|
|
3606
|
+
}
|
|
3601
3607
|
if (this.pending && this.gesture.kind === "idle") {
|
|
3602
3608
|
const ax = this.pending.anchor_screen[0];
|
|
3603
3609
|
const ay = this.pending.anchor_screen[1];
|
|
@@ -4067,11 +4073,22 @@ var SurfaceState = class {
|
|
|
4067
4073
|
}
|
|
4068
4074
|
onPointerDown(sx, sy, button, deps) {
|
|
4069
4075
|
const response = emptyResponse();
|
|
4070
|
-
if (button !== "primary") return response;
|
|
4071
4076
|
const point_doc = screenToDoc(this.transform, sx, sy);
|
|
4072
4077
|
const screen = [sx, sy];
|
|
4078
|
+
let tap_hit = null;
|
|
4079
|
+
if (button !== "middle") {
|
|
4080
|
+
tap_hit = deps.pick(point_doc);
|
|
4081
|
+
this.tap_candidate = {
|
|
4082
|
+
anchor_doc: point_doc,
|
|
4083
|
+
anchor_screen: screen,
|
|
4084
|
+
button,
|
|
4085
|
+
hit: tap_hit,
|
|
4086
|
+
mods: { ...this.modifiers }
|
|
4087
|
+
};
|
|
4088
|
+
}
|
|
4089
|
+
if (button !== "primary") return response;
|
|
4073
4090
|
const ui_action = this.hit_regions.hitTest(screen);
|
|
4074
|
-
const hovered_id =
|
|
4091
|
+
const hovered_id = tap_hit;
|
|
4075
4092
|
const click_count = this.click_tracker.register(sx, sy);
|
|
4076
4093
|
if (ui_action && ui_action.kind === "corner_radius_handle") {
|
|
4077
4094
|
if (this.readonly) return response;
|
|
@@ -4395,6 +4412,14 @@ var SurfaceState = class {
|
|
|
4395
4412
|
}
|
|
4396
4413
|
onPointerUp(_sx, _sy, button, deps) {
|
|
4397
4414
|
const response = emptyResponse();
|
|
4415
|
+
const tap = this.tap_candidate;
|
|
4416
|
+
this.tap_candidate = null;
|
|
4417
|
+
if (tap && tap.button === button && this.gesture.kind === "idle") deps.emitTap?.({
|
|
4418
|
+
point: tap.anchor_doc,
|
|
4419
|
+
button: tap.button,
|
|
4420
|
+
hit: tap.hit,
|
|
4421
|
+
mods: tap.mods
|
|
4422
|
+
});
|
|
4398
4423
|
if (button !== "primary") return response;
|
|
4399
4424
|
if (this.pending && this.pending.deferred) {
|
|
4400
4425
|
const d = this.pending.deferred;
|
|
@@ -4685,6 +4710,7 @@ var SurfaceState = class {
|
|
|
4685
4710
|
onBlur(deps) {
|
|
4686
4711
|
const response = emptyResponse();
|
|
4687
4712
|
this.pending = null;
|
|
4713
|
+
this.tap_candidate = null;
|
|
4688
4714
|
if (this.gesture.kind !== "idle") {
|
|
4689
4715
|
deps.emitIntent({ kind: "cancel_gesture" });
|
|
4690
4716
|
this.gesture = IDLE;
|
|
@@ -6637,7 +6663,8 @@ var Surface = class {
|
|
|
6637
6663
|
return this.state.dispatch(event, {
|
|
6638
6664
|
pick: this.opts.pick,
|
|
6639
6665
|
shapeOf: this.opts.shapeOf,
|
|
6640
|
-
emitIntent: this.opts.onIntent
|
|
6666
|
+
emitIntent: this.opts.onIntent,
|
|
6667
|
+
emitTap: this.opts.onTap
|
|
6641
6668
|
});
|
|
6642
6669
|
}
|
|
6643
6670
|
draw(extra) {
|
|
@@ -3391,6 +3391,7 @@ var SurfaceState = class {
|
|
|
3391
3391
|
this.hit_regions = new HitRegions();
|
|
3392
3392
|
this.click_tracker = new ClickTracker();
|
|
3393
3393
|
this.pending = null;
|
|
3394
|
+
this.tap_candidate = null;
|
|
3394
3395
|
this.vector_selection = null;
|
|
3395
3396
|
this.vector_hover = null;
|
|
3396
3397
|
this.padding_hover = null;
|
|
@@ -3575,6 +3576,11 @@ var SurfaceState = class {
|
|
|
3575
3576
|
this.modifiers = mods;
|
|
3576
3577
|
const response = emptyResponse();
|
|
3577
3578
|
const point_doc = screenToDoc(this.transform, sx, sy);
|
|
3579
|
+
if (this.tap_candidate) {
|
|
3580
|
+
const tdx = sx - this.tap_candidate.anchor_screen[0];
|
|
3581
|
+
const tdy = sy - this.tap_candidate.anchor_screen[1];
|
|
3582
|
+
if (tdx * tdx + tdy * tdy >= DRAG_THRESHOLD_PX * DRAG_THRESHOLD_PX) this.tap_candidate = null;
|
|
3583
|
+
}
|
|
3578
3584
|
if (this.pending && this.gesture.kind === "idle") {
|
|
3579
3585
|
const ax = this.pending.anchor_screen[0];
|
|
3580
3586
|
const ay = this.pending.anchor_screen[1];
|
|
@@ -4044,11 +4050,22 @@ var SurfaceState = class {
|
|
|
4044
4050
|
}
|
|
4045
4051
|
onPointerDown(sx, sy, button, deps) {
|
|
4046
4052
|
const response = emptyResponse();
|
|
4047
|
-
if (button !== "primary") return response;
|
|
4048
4053
|
const point_doc = screenToDoc(this.transform, sx, sy);
|
|
4049
4054
|
const screen = [sx, sy];
|
|
4055
|
+
let tap_hit = null;
|
|
4056
|
+
if (button !== "middle") {
|
|
4057
|
+
tap_hit = deps.pick(point_doc);
|
|
4058
|
+
this.tap_candidate = {
|
|
4059
|
+
anchor_doc: point_doc,
|
|
4060
|
+
anchor_screen: screen,
|
|
4061
|
+
button,
|
|
4062
|
+
hit: tap_hit,
|
|
4063
|
+
mods: { ...this.modifiers }
|
|
4064
|
+
};
|
|
4065
|
+
}
|
|
4066
|
+
if (button !== "primary") return response;
|
|
4050
4067
|
const ui_action = this.hit_regions.hitTest(screen);
|
|
4051
|
-
const hovered_id =
|
|
4068
|
+
const hovered_id = tap_hit;
|
|
4052
4069
|
const click_count = this.click_tracker.register(sx, sy);
|
|
4053
4070
|
if (ui_action && ui_action.kind === "corner_radius_handle") {
|
|
4054
4071
|
if (this.readonly) return response;
|
|
@@ -4372,6 +4389,14 @@ var SurfaceState = class {
|
|
|
4372
4389
|
}
|
|
4373
4390
|
onPointerUp(_sx, _sy, button, deps) {
|
|
4374
4391
|
const response = emptyResponse();
|
|
4392
|
+
const tap = this.tap_candidate;
|
|
4393
|
+
this.tap_candidate = null;
|
|
4394
|
+
if (tap && tap.button === button && this.gesture.kind === "idle") deps.emitTap?.({
|
|
4395
|
+
point: tap.anchor_doc,
|
|
4396
|
+
button: tap.button,
|
|
4397
|
+
hit: tap.hit,
|
|
4398
|
+
mods: tap.mods
|
|
4399
|
+
});
|
|
4375
4400
|
if (button !== "primary") return response;
|
|
4376
4401
|
if (this.pending && this.pending.deferred) {
|
|
4377
4402
|
const d = this.pending.deferred;
|
|
@@ -4662,6 +4687,7 @@ var SurfaceState = class {
|
|
|
4662
4687
|
onBlur(deps) {
|
|
4663
4688
|
const response = emptyResponse();
|
|
4664
4689
|
this.pending = null;
|
|
4690
|
+
this.tap_candidate = null;
|
|
4665
4691
|
if (this.gesture.kind !== "idle") {
|
|
4666
4692
|
deps.emitIntent({ kind: "cancel_gesture" });
|
|
4667
4693
|
this.gesture = IDLE;
|
|
@@ -6614,7 +6640,8 @@ var Surface = class {
|
|
|
6614
6640
|
return this.state.dispatch(event, {
|
|
6615
6641
|
pick: this.opts.pick,
|
|
6616
6642
|
shapeOf: this.opts.shapeOf,
|
|
6617
|
-
emitIntent: this.opts.onIntent
|
|
6643
|
+
emitIntent: this.opts.onIntent,
|
|
6644
|
+
emitTap: this.opts.onTap
|
|
6618
6645
|
});
|
|
6619
6646
|
}
|
|
6620
6647
|
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.2",
|
|
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
|
],
|