@grida/hud 0.2.2 → 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/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_surface = require("./surface-BHDH6P6p.js");
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-B_8w6VWG.mjs";
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.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-BHDH6P6p.js");
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");
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-B_8w6VWG.mjs";
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";
@@ -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": return classifyBodyRegion(hovered_id, selection_ids, modifiers, click_count);
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": return {
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. */
@@ -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": return classifyBodyRegion(hovered_id, selection_ids, modifiers, click_count);
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": return {
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. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grida/hud",
3
- "version": "0.2.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": [