@floegence/floe-webapp-core 0.36.17 → 0.36.18

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.
@@ -9,7 +9,7 @@ export { CommandPalette } from './CommandPalette';
9
9
  export { InfiniteCanvas, type InfiniteCanvasProps, type InfiniteCanvasPoint, type InfiniteCanvasContextMenuEvent, } from './InfiniteCanvas';
10
10
  export { startPointerSession, type PointerSessionController, type PointerSessionEndEvent, type PointerSessionEndReason, type PointerSessionSnapshot, type StartPointerSessionOptions, } from './pointerSession';
11
11
  export { clientToCanvasLocal, clientToCanvasWorld, createViewportFromZoomAnchor, isPointInsideCanvasRect, localToCanvasWorld, type CanvasClientPoint, type CanvasLocalPoint, type CanvasViewportLike, type CanvasViewportRectLike, type CanvasWorldPoint, } from './canvasGeometry';
12
- export { CANVAS_WHEEL_INTERACTIVE_ATTR, DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR, LOCAL_INTERACTION_SURFACE_ATTR, DEFAULT_LOCAL_INTERACTION_SURFACE_SELECTOR, WORKBENCH_WIDGET_SHELL_ATTR, DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR, isLocalInteractionSurfaceTarget, resolveSurfaceInteractionTargetRole, resolveSurfaceWheelRouting, resolveWorkbenchWidgetEventOwnership, type SurfaceInteractionRoutingOptions, type SurfaceInteractionTargetRole, type SurfaceWheelLocalReason, type SurfaceWheelRoutingDecision, type SurfaceWheelRoutingOptions, type WorkbenchWidgetEventOwnership, type WorkbenchWidgetEventOwnershipOptions, } from './localInteractionSurface';
12
+ export { CANVAS_WHEEL_INTERACTIVE_ATTR, DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR, LOCAL_INTERACTION_SURFACE_ATTR, DEFAULT_LOCAL_INTERACTION_SURFACE_SELECTOR, WORKBENCH_WIDGET_SHELL_ATTR, DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR, isLocalInteractionSurfaceTarget, resolveSurfaceInteractionTargetRole, resolveSurfaceWheelRouting, resolveWorkbenchWidgetEventOwnership, shouldActivateWorkbenchWidgetLocalTarget, type SurfaceInteractionRoutingOptions, type SurfaceInteractionTargetRole, type SurfaceWheelLocalReason, type SurfaceWheelRoutingDecision, type SurfaceWheelRoutingOptions, type WorkbenchWidgetEventOwnership, type WorkbenchWidgetEventOwnershipOptions, type WorkbenchWidgetLocalActivationTargetOptions, } from './localInteractionSurface';
13
13
  export { DIALOG_SURFACE_HOST_ATTR, SURFACE_PORTAL_HOST_ATTR, SURFACE_PORTAL_LAYER_ATTR, DIALOG_SURFACE_BOUNDARY_ATTR, ensureSurfacePortalInteractionTracking, isSurfacePortalMode, projectSurfacePortalPosition, projectSurfacePortalRect, resolveSurfacePortalBoundaryRect, resolveSurfacePortalHost, resolveSurfacePortalMount, resolveSurfacePortalMountRect, __resetSurfacePortalScopeForTests, type ResolvedSurfacePortalHost, type SurfacePortalBoundaryRect, type SurfacePortalInteractionSnapshot, type SurfacePortalMode, type SurfacePortalRect, } from './surfacePortalScope';
14
14
  export { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, Interactive3DCard, AnimatedBorderCard, NeonCard, MorphCard, type CardProps, type CardVariant, type CardHeaderProps, type CardTitleProps, type CardDescriptionProps, type CardContentProps, type CardFooterProps, type Interactive3DCardProps, type AnimatedBorderCardProps, type NeonCardProps, type MorphCardProps, } from './Card';
15
15
  export { Tabs, TabPanel, type TabsProps, type TabPanelProps, type TabItem, type TabsFeatures, type TabsSlotClassNames, type TabsIndicatorMode, type TabsIndicatorColorToken, } from './Tabs';
@@ -26,6 +26,7 @@ export interface WorkbenchWidgetEventOwnershipOptions extends SurfaceInteraction
26
26
  widgetRoot: Element | EventTarget | null;
27
27
  shellSelector?: string;
28
28
  }
29
+ export type WorkbenchWidgetLocalActivationTargetOptions = WorkbenchWidgetEventOwnershipOptions;
29
30
  export interface SurfaceWheelRoutingOptions {
30
31
  target: EventTarget | null;
31
32
  disablePanZoom: boolean;
@@ -36,3 +37,4 @@ export declare function resolveSurfaceInteractionTargetRole(options: SurfaceInte
36
37
  export declare function resolveSurfaceWheelRouting(options: SurfaceWheelRoutingOptions): SurfaceWheelRoutingDecision;
37
38
  export declare function isLocalInteractionSurfaceTarget(options: SurfaceInteractionRoutingOptions): boolean;
38
39
  export declare function resolveWorkbenchWidgetEventOwnership(options: WorkbenchWidgetEventOwnershipOptions): WorkbenchWidgetEventOwnership;
40
+ export declare function shouldActivateWorkbenchWidgetLocalTarget(options: WorkbenchWidgetLocalActivationTargetOptions): boolean;
@@ -1,48 +1,73 @@
1
- import { isTypingElement as a } from "../../utils/dom.js";
2
- const u = "data-floe-local-interaction-surface", i = `[${u}="true"]`, f = "data-floe-canvas-wheel-interactive", E = `[${f}="true"]`, _ = "data-floe-workbench-widget-shell", T = `[${_}="true"]`;
3
- function c(e) {
1
+ import { isTypingElement as o } from "../../utils/dom.js";
2
+ const f = "data-floe-local-interaction-surface", u = `[${f}="true"]`, E = "data-floe-canvas-wheel-interactive", d = `[${E}="true"]`, _ = "data-floe-workbench-widget-shell", i = `[${_}="true"]`;
3
+ function a(e) {
4
4
  return typeof Element < "u" && e instanceof Element ? e : typeof Node < "u" && e instanceof Node ? e.parentElement : null;
5
5
  }
6
+ function T(e) {
7
+ if (!e || typeof HTMLElement > "u" || !(e instanceof HTMLElement))
8
+ return !1;
9
+ if (e.matches("button, input, select, textarea, summary") || e.matches("a[href], area[href]") || e.matches('iframe, [contenteditable="true"]')) return !0;
10
+ const t = e.getAttribute("tabindex");
11
+ return t !== null && t !== "-1";
12
+ }
13
+ function S(e, t) {
14
+ let r = e;
15
+ for (; r && r !== t; ) {
16
+ if (o(r) || T(r))
17
+ return !0;
18
+ r = r.parentElement;
19
+ }
20
+ return !1;
21
+ }
6
22
  function s(e) {
7
23
  const {
8
24
  target: t,
9
- interactiveSelector: l,
10
- panSurfaceSelector: r,
11
- localInteractionSurfaceSelector: n = i
12
- } = e, o = t instanceof Element ? t : null;
13
- return o ? o.closest(r) !== null ? "pan_surface" : a(o) || o.closest(l) !== null || o.closest(n) !== null ? "local_surface" : "canvas" : "canvas";
25
+ interactiveSelector: r,
26
+ panSurfaceSelector: c,
27
+ localInteractionSurfaceSelector: n = u
28
+ } = e, l = t instanceof Element ? t : null;
29
+ return l ? l.closest(c) !== null ? "pan_surface" : o(l) || l.closest(r) !== null || l.closest(n) !== null ? "local_surface" : "canvas" : "canvas";
14
30
  }
15
- function d(e) {
31
+ function g(e) {
16
32
  const {
17
33
  target: t,
18
- localInteractionSurfaceSelector: l = i,
19
- wheelInteractiveSelector: r = E
20
- } = e, n = c(t);
21
- return n ? a(n) ? "typing_element" : n.closest(l) !== null ? "local_interaction_surface" : n.closest(r) !== null ? "wheel_interactive" : null : null;
34
+ localInteractionSurfaceSelector: r = u,
35
+ wheelInteractiveSelector: c = d
36
+ } = e, n = a(t);
37
+ return n ? o(n) ? "typing_element" : n.closest(r) !== null ? "local_interaction_surface" : n.closest(c) !== null ? "wheel_interactive" : null : null;
22
38
  }
23
- function R(e) {
24
- const t = d(e);
39
+ function L(e) {
40
+ const t = g(e);
25
41
  return t ? { kind: "local_surface", reason: t } : e.disablePanZoom ? { kind: "ignore", reason: "pan_zoom_disabled" } : { kind: "canvas_zoom" };
26
42
  }
27
43
  function A(e) {
28
44
  return s(e) !== "canvas";
29
45
  }
30
- function L(e) {
46
+ function m(e) {
47
+ const {
48
+ widgetRoot: t,
49
+ shellSelector: r = i
50
+ } = e, c = a(t), n = a(e.target);
51
+ return !c || !n || !c.contains(n) ? "outside_widget" : s(e) !== "canvas" ? "widget_local" : n === c || n.closest(r) !== null ? "widget_shell" : "widget_local";
52
+ }
53
+ function R(e) {
31
54
  const {
32
55
  widgetRoot: t,
33
- shellSelector: l = T
34
- } = e, r = c(t), n = c(e.target);
35
- return !r || !n || !r.contains(n) ? "outside_widget" : s(e) !== "canvas" ? "widget_local" : n === r || n.closest(l) !== null ? "widget_shell" : "widget_local";
56
+ shellSelector: r = i,
57
+ localInteractionSurfaceSelector: c = u
58
+ } = e, n = a(t), l = a(e.target);
59
+ return !n || !l || !n.contains(l) || l === n || l.closest(r) !== null || l.closest(e.panSurfaceSelector) !== null || l.closest(c) !== null || S(l, n) ? !1 : m(e) === "widget_local";
36
60
  }
37
61
  export {
38
- f as CANVAS_WHEEL_INTERACTIVE_ATTR,
39
- E as DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR,
40
- i as DEFAULT_LOCAL_INTERACTION_SURFACE_SELECTOR,
41
- T as DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR,
42
- u as LOCAL_INTERACTION_SURFACE_ATTR,
62
+ E as CANVAS_WHEEL_INTERACTIVE_ATTR,
63
+ d as DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR,
64
+ u as DEFAULT_LOCAL_INTERACTION_SURFACE_SELECTOR,
65
+ i as DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR,
66
+ f as LOCAL_INTERACTION_SURFACE_ATTR,
43
67
  _ as WORKBENCH_WIDGET_SHELL_ATTR,
44
68
  A as isLocalInteractionSurfaceTarget,
45
69
  s as resolveSurfaceInteractionTargetRole,
46
- R as resolveSurfaceWheelRouting,
47
- L as resolveWorkbenchWidgetEventOwnership
70
+ L as resolveSurfaceWheelRouting,
71
+ m as resolveWorkbenchWidgetEventOwnership,
72
+ R as shouldActivateWorkbenchWidgetLocalTarget
48
73
  };
@@ -1,35 +1,51 @@
1
- import { spread as H, mergeProps as et, insert as l, createComponent as c, memo as it, template as B, use as nt, delegateEvents as ot } from "solid-js/web";
2
- import { createSignal as L, onCleanup as at, untrack as S, createMemo as _ } from "solid-js";
3
- import { startHotInteraction as O } from "../../utils/hotInteraction.js";
4
- import { X as F, Minus as N, Maximize as A, GripVertical as rt } from "../icons/index.js";
5
- import { CANVAS_WHEEL_INTERACTIVE_ATTR as dt, WORKBENCH_WIDGET_SHELL_ATTR as lt, resolveWorkbenchWidgetEventOwnership as ct } from "../ui/localInteractionSurface.js";
1
+ import { spread as L, mergeProps as at, insert as l, createComponent as c, memo as rt, template as q, use as dt, delegateEvents as lt } from "solid-js/web";
2
+ import { createSignal as C, onCleanup as ct, untrack as S, createMemo as f } from "solid-js";
3
+ import { startHotInteraction as A } from "../../utils/hotInteraction.js";
4
+ import { X as O, Minus as F, Maximize as N, GripVertical as st } from "../icons/index.js";
5
+ import { CANVAS_WHEEL_INTERACTIVE_ATTR as wt, WORKBENCH_WIDGET_SHELL_ATTR as gt, shouldActivateWorkbenchWidgetLocalTarget as ht, resolveWorkbenchWidgetEventOwnership as ut } from "../ui/localInteractionSurface.js";
6
6
  import { startPointerSession as j } from "../ui/pointerSession.js";
7
- import { createWorkbenchWidgetSurfaceMetrics as st } from "./workbenchHelpers.js";
8
- var wt = /* @__PURE__ */ B('<article class=workbench-widget data-floe-dialog-surface-host=true><header class=workbench-widget__header><span class=workbench-widget__traffic role=group aria-label="Window controls"><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--close"aria-label="Close widget"title="Close widget"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--min"aria-label="Minimize widget to overview"title="Minimize widget to overview"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--max"aria-label="Zoom widget to fit viewport"title="Zoom widget to fit viewport"data-floe-canvas-interactive=true></button></span><span class=workbench-widget__badge aria-hidden=true></span><button type=button class=workbench-widget__drag aria-label="Drag widget"data-floe-canvas-interactive=true></button><div class=workbench-widget__title-area><span class=workbench-widget__title-dot aria-hidden=true></span><span class=workbench-widget__title></span></div><span class=workbench-widget__window-controls role=group aria-label="Window controls"><button type=button class="workbench-widget__window-control workbench-widget__window-control--min"aria-label="Minimize widget to overview"title="Minimize widget to overview"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__window-control workbench-widget__window-control--max"aria-label="Zoom widget to fit viewport"title="Zoom widget to fit viewport"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__window-control workbench-widget__window-control--close"aria-label="Remove widget"title="Remove widget"data-floe-canvas-interactive=true></button></span></header><div class=workbench-widget__body data-floe-canvas-interactive=true>'), gt = /* @__PURE__ */ B('<div class=workbench-widget__resize aria-label="Resize widget"data-floe-canvas-interactive=true><svg class=workbench-widget__resize-glyph viewBox="0 0 12 12"aria-hidden=true><path d="M12 0 L0 12"></path><path d="M12 4 L4 12"></path><path d="M12 8 L8 12">');
9
- const ht = 220, ut = 160, _t = '[data-floe-canvas-interactive="true"]', ft = '[data-floe-canvas-pan-surface="true"]';
10
- function xt(t) {
11
- const [f, I] = L(null), [b, x] = L(null);
12
- let g, h, u;
13
- at(() => {
14
- g?.stop({
7
+ import { createWorkbenchWidgetSurfaceMetrics as ft } from "./workbenchHelpers.js";
8
+ var _t = /* @__PURE__ */ q('<article class=workbench-widget data-floe-dialog-surface-host=true><header class=workbench-widget__header><span class=workbench-widget__traffic role=group aria-label="Window controls"><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--close"aria-label="Close widget"title="Close widget"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--min"aria-label="Minimize widget to overview"title="Minimize widget to overview"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--max"aria-label="Zoom widget to fit viewport"title="Zoom widget to fit viewport"data-floe-canvas-interactive=true></button></span><span class=workbench-widget__badge aria-hidden=true></span><button type=button class=workbench-widget__drag aria-label="Drag widget"data-floe-canvas-interactive=true></button><div class=workbench-widget__title-area><span class=workbench-widget__title-dot aria-hidden=true></span><span class=workbench-widget__title></span></div><span class=workbench-widget__window-controls role=group aria-label="Window controls"><button type=button class="workbench-widget__window-control workbench-widget__window-control--min"aria-label="Minimize widget to overview"title="Minimize widget to overview"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__window-control workbench-widget__window-control--max"aria-label="Zoom widget to fit viewport"title="Zoom widget to fit viewport"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__window-control workbench-widget__window-control--close"aria-label="Remove widget"title="Remove widget"data-floe-canvas-interactive=true></button></span></header><div class=workbench-widget__body data-floe-canvas-interactive=true>'), bt = /* @__PURE__ */ q('<div class=workbench-widget__resize aria-label="Resize widget"data-floe-canvas-interactive=true><svg class=workbench-widget__resize-glyph viewBox="0 0 12 12"aria-hidden=true><path d="M12 0 L0 12"></path><path d="M12 4 L4 12"></path><path d="M12 8 L8 12">');
9
+ const mt = 220, vt = 160, B = '[data-floe-canvas-interactive="true"]', V = '[data-floe-canvas-pan-surface="true"]';
10
+ function Ct(t) {
11
+ const [_, I] = C(null), [b, x] = C(null), [G, Z] = C();
12
+ let h, u, g;
13
+ ct(() => {
14
+ h?.stop({
15
15
  reason: "manual_stop",
16
16
  commit: !1
17
- }), g = void 0, h?.stop({
17
+ }), h = void 0, u?.stop({
18
18
  reason: "manual_stop",
19
19
  commit: !1
20
- }), h = void 0, S(f)?.stopInteraction(), S(b)?.stopInteraction();
20
+ }), u = void 0, S(_)?.stopInteraction(), S(b)?.stopInteraction();
21
21
  });
22
- const C = () => f() !== null, W = () => b() !== null, E = (e) => ct({
22
+ const W = () => _() !== null, R = () => b() !== null, p = (e) => ut({
23
23
  target: e,
24
- widgetRoot: u ?? null,
25
- interactiveSelector: _t,
26
- panSurfaceSelector: ft
27
- }), V = (e) => {
28
- e.button === 0 && (t.onSelect(t.widgetId), t.onCommitFront(t.widgetId), E(e.target) === "widget_shell" && u?.focus({
29
- preventScroll: !0
24
+ widgetRoot: g ?? null,
25
+ interactiveSelector: B,
26
+ panSurfaceSelector: V
27
+ }), K = (e) => {
28
+ if (e.button !== 0) return;
29
+ t.onSelect(t.widgetId), t.onCommitFront(t.widgetId);
30
+ const i = p(e.target);
31
+ if (i === "widget_shell") {
32
+ g?.focus({
33
+ preventScroll: !0
34
+ });
35
+ return;
36
+ }
37
+ i === "widget_local" && ht({
38
+ target: e.target,
39
+ widgetRoot: g ?? null,
40
+ interactiveSelector: B,
41
+ panSurfaceSelector: V
42
+ }) && Z((r) => ({
43
+ seq: (r?.seq ?? 0) + 1,
44
+ source: "local_pointer",
45
+ pointerType: e.pointerType || void 0
30
46
  }));
31
- }, m = _(() => {
32
- const e = f();
47
+ }, m = f(() => {
48
+ const e = _();
33
49
  return e ? {
34
50
  x: e.worldX,
35
51
  y: e.worldY
@@ -37,7 +53,7 @@ function xt(t) {
37
53
  x: t.x,
38
54
  y: t.y
39
55
  };
40
- }), v = _(() => {
56
+ }), v = f(() => {
41
57
  const e = b();
42
58
  return e ? {
43
59
  width: e.width,
@@ -46,9 +62,9 @@ function xt(t) {
46
62
  width: t.width,
47
63
  height: t.height
48
64
  };
49
- }), R = _(() => {
65
+ }), E = f(() => {
50
66
  if (!(t.layoutMode !== "projected_surface" || !t.projectedViewport))
51
- return st({
67
+ return ft({
52
68
  widgetId: t.widgetId,
53
69
  worldX: m().x,
54
70
  worldY: m().y,
@@ -57,23 +73,23 @@ function xt(t) {
57
73
  viewport: t.projectedViewport,
58
74
  ready: t.surfaceReady ?? !0
59
75
  });
60
- }), G = _(() => {
76
+ }), U = f(() => {
61
77
  const e = t.itemSnapshot().z_index, i = Number.isFinite(e) ? Math.max(1, Math.min(99, Math.round(e))) : 1;
62
78
  return String(i).padStart(2, "0");
63
- }), z = (e) => {
79
+ }), T = (e) => {
64
80
  e.preventDefault(), e.stopPropagation(), t.onRequestOverview(t.itemSnapshot());
65
- }, T = (e) => {
81
+ }, z = (e) => {
66
82
  e.preventDefault(), e.stopPropagation(), t.onRequestFit(t.itemSnapshot());
67
83
  }, D = (e) => {
68
84
  e.preventDefault(), e.stopPropagation(), t.onRequestDelete(t.widgetId);
69
- }, Z = _(() => {
85
+ }, J = f(() => {
70
86
  const e = {
71
87
  width: `${v().width}px`,
72
88
  height: `${v().height}px`,
73
- "z-index": C() || W() || t.optimisticFront ? `${t.topRenderLayer + 1}` : `${t.renderLayer}`
89
+ "z-index": W() || R() || t.optimisticFront ? `${t.topRenderLayer + 1}` : `${t.renderLayer}`
74
90
  };
75
91
  if (t.layoutMode === "projected_surface") {
76
- const i = R()?.rect;
92
+ const i = E()?.rect;
77
93
  return {
78
94
  ...e,
79
95
  left: `${i?.screenX ?? 0}px`,
@@ -85,29 +101,29 @@ function xt(t) {
85
101
  ...e,
86
102
  transform: `translate(${m().x}px, ${m().y}px)`
87
103
  };
88
- }), q = (e) => {
89
- const i = S(f);
104
+ }), Q = (e) => {
105
+ const i = S(_);
90
106
  if (!i) return;
91
- const d = {
107
+ const r = {
92
108
  x: i.worldX,
93
109
  y: i.worldY
94
- }, r = {
110
+ }, d = {
95
111
  x: i.startWorldX,
96
112
  y: i.startWorldY
97
- }, a = e && (Math.abs(d.x - r.x) > 1 || Math.abs(d.y - r.y) > 1);
98
- t.onCommitFront(t.widgetId), a && t.onCommitMove(t.widgetId, d), i.stopInteraction(), I(null), g = void 0;
113
+ }, a = e && (Math.abs(r.x - d.x) > 1 || Math.abs(r.y - d.y) > 1);
114
+ t.onCommitFront(t.widgetId), a && t.onCommitMove(t.widgetId, r), i.stopInteraction(), I(null), h = void 0;
99
115
  }, X = (e) => {
100
116
  if (e.button !== 0 || t.locked) return;
101
- e.preventDefault(), e.stopPropagation(), g?.stop({
117
+ e.preventDefault(), e.stopPropagation(), h?.stop({
102
118
  reason: "manual_stop",
103
119
  commit: !1
104
- }), t.onSelect(t.widgetId), u?.focus({
120
+ }), t.onSelect(t.widgetId), g?.focus({
105
121
  preventScroll: !0
106
122
  }), t.onStartOptimisticFront(t.widgetId);
107
- const i = O({
123
+ const i = A({
108
124
  kind: "drag",
109
125
  cursor: "grabbing"
110
- }), d = Math.max(t.viewportScale, 1e-3);
126
+ }), r = Math.max(t.viewportScale, 1e-3);
111
127
  I({
112
128
  pointerId: e.pointerId,
113
129
  startClientX: e.clientX,
@@ -117,47 +133,47 @@ function xt(t) {
117
133
  worldX: t.x,
118
134
  worldY: t.y,
119
135
  moved: !1,
120
- scale: d,
136
+ scale: r,
121
137
  stopInteraction: i
122
138
  });
123
- const r = (a) => {
124
- I((n) => {
125
- if (!n || n.pointerId !== a.pointerId) return n;
126
- const w = n.startWorldX + (a.clientX - n.startClientX) / n.scale, s = n.startWorldY + (a.clientY - n.startClientY) / n.scale;
139
+ const d = (a) => {
140
+ I((o) => {
141
+ if (!o || o.pointerId !== a.pointerId) return o;
142
+ const w = o.startWorldX + (a.clientX - o.startClientX) / o.scale, s = o.startWorldY + (a.clientY - o.startClientY) / o.scale;
127
143
  return {
128
- ...n,
144
+ ...o,
129
145
  worldX: w,
130
146
  worldY: s,
131
- moved: n.moved || Math.abs(w - n.startWorldX) > 2 || Math.abs(s - n.startWorldY) > 2
147
+ moved: o.moved || Math.abs(w - o.startWorldX) > 2 || Math.abs(s - o.startWorldY) > 2
132
148
  };
133
149
  });
134
150
  };
135
- g = j({
151
+ h = j({
136
152
  pointerEvent: e,
137
153
  captureEl: e.currentTarget,
138
- onMove: r,
154
+ onMove: d,
139
155
  onEnd: ({
140
156
  commit: a
141
- }) => q(a)
157
+ }) => Q(a)
142
158
  });
143
- }, K = (e) => {
159
+ }, tt = (e) => {
144
160
  const i = S(b);
145
161
  if (!i) return;
146
- const d = {
162
+ const r = {
147
163
  width: i.width,
148
164
  height: i.height
149
- }, r = Math.abs(i.width - i.startWidth) > 1 || Math.abs(i.height - i.startHeight) > 1;
150
- e && r && t.onCommitResize(t.widgetId, d), i.stopInteraction(), x(null), h = void 0;
151
- }, U = (e) => {
165
+ }, d = Math.abs(i.width - i.startWidth) > 1 || Math.abs(i.height - i.startHeight) > 1;
166
+ e && d && t.onCommitResize(t.widgetId, r), i.stopInteraction(), x(null), u = void 0;
167
+ }, et = (e) => {
152
168
  if (e.button !== 0 || t.locked) return;
153
- e.preventDefault(), e.stopPropagation(), h?.stop({
169
+ e.preventDefault(), e.stopPropagation(), u?.stop({
154
170
  reason: "manual_stop",
155
171
  commit: !1
156
172
  }), t.onStartOptimisticFront(t.widgetId);
157
- const i = O({
173
+ const i = A({
158
174
  kind: "drag",
159
175
  cursor: "nwse-resize"
160
- }), d = Math.max(t.viewportScale, 1e-3);
176
+ }), r = Math.max(t.viewportScale, 1e-3);
161
177
  x({
162
178
  pointerId: e.pointerId,
163
179
  startClientX: e.clientX,
@@ -166,37 +182,37 @@ function xt(t) {
166
182
  startHeight: t.height,
167
183
  width: t.width,
168
184
  height: t.height,
169
- scale: d,
185
+ scale: r,
170
186
  stopInteraction: i
171
187
  });
172
- const r = (a) => {
173
- x((n) => {
174
- if (!n || n.pointerId !== a.pointerId) return n;
175
- const w = Math.max(ht, n.startWidth + (a.clientX - n.startClientX) / n.scale), s = Math.max(ut, n.startHeight + (a.clientY - n.startClientY) / n.scale);
188
+ const d = (a) => {
189
+ x((o) => {
190
+ if (!o || o.pointerId !== a.pointerId) return o;
191
+ const w = Math.max(mt, o.startWidth + (a.clientX - o.startClientX) / o.scale), s = Math.max(vt, o.startHeight + (a.clientY - o.startClientY) / o.scale);
176
192
  return {
177
- ...n,
193
+ ...o,
178
194
  width: w,
179
195
  height: s
180
196
  };
181
197
  });
182
198
  };
183
- h = j({
199
+ u = j({
184
200
  pointerEvent: e,
185
201
  captureEl: e.currentTarget,
186
- onMove: r,
202
+ onMove: d,
187
203
  onEnd: ({
188
204
  commit: a
189
- }) => K(a)
205
+ }) => tt(a)
190
206
  });
191
207
  };
192
208
  return (() => {
193
- var e = wt(), i = e.firstChild, d = i.firstChild, r = d.firstChild, a = r.nextSibling, n = a.nextSibling, w = d.nextSibling, s = w.nextSibling, M = s.nextSibling, J = M.firstChild, p = J.nextSibling, Q = M.nextSibling, $ = Q.firstChild, k = $.nextSibling, y = k.nextSibling, tt = i.nextSibling, P = u;
194
- return typeof P == "function" ? nt(P, e) : u = e, H(e, et({
209
+ var e = _t(), i = e.firstChild, r = i.firstChild, d = r.firstChild, a = d.nextSibling, o = a.nextSibling, w = r.nextSibling, s = w.nextSibling, y = s.nextSibling, it = y.firstChild, P = it.nextSibling, ot = y.nextSibling, $ = ot.firstChild, k = $.nextSibling, M = k.nextSibling, nt = i.nextSibling, Y = g;
210
+ return typeof Y == "function" ? dt(Y, e) : g = e, L(e, at({
195
211
  get classList() {
196
212
  return {
197
213
  "is-selected": t.selected,
198
- "is-dragging": C(),
199
- "is-resizing": W(),
214
+ "is-dragging": W(),
215
+ "is-resizing": R(),
200
216
  "is-filtered-out": t.filtered,
201
217
  "is-projected-surface": t.layoutMode === "projected_surface",
202
218
  "is-locked": t.locked
@@ -212,49 +228,49 @@ function xt(t) {
212
228
  return t.layoutMode ?? "canvas_scaled";
213
229
  }
214
230
  }, () => ({
215
- [dt]: t.selected ? "true" : void 0
231
+ [wt]: t.selected ? "true" : void 0
216
232
  }), {
217
233
  tabIndex: 0,
218
- onPointerDown: V,
234
+ onPointerDown: K,
219
235
  onFocus: () => {
220
236
  t.onSelect(t.widgetId);
221
237
  },
222
- onContextMenu: (o) => {
223
- E(o.target) === "widget_shell" && (o.preventDefault(), o.stopPropagation(), t.onContextMenu(o, t.itemSnapshot()));
238
+ onContextMenu: (n) => {
239
+ p(n.target) === "widget_shell" && (n.preventDefault(), n.stopPropagation(), t.onContextMenu(n, t.itemSnapshot()));
224
240
  },
225
241
  get style() {
226
- return Z();
242
+ return J();
227
243
  }
228
- }), !1, !0), i.$$pointerdown = X, H(i, {
229
- [lt]: "true"
230
- }, !1, !0), r.$$click = D, r.$$pointerdown = (o) => o.stopPropagation(), l(r, c(F, {
244
+ }), !1, !0), i.$$pointerdown = X, L(i, {
245
+ [gt]: "true"
246
+ }, !1, !0), d.$$click = D, d.$$pointerdown = (n) => n.stopPropagation(), l(d, c(O, {
231
247
  class: "workbench-widget__traffic-icon",
232
248
  "aria-hidden": "true"
233
- })), a.$$click = z, a.$$pointerdown = (o) => o.stopPropagation(), l(a, c(N, {
249
+ })), a.$$click = T, a.$$pointerdown = (n) => n.stopPropagation(), l(a, c(F, {
234
250
  class: "workbench-widget__traffic-icon",
235
251
  "aria-hidden": "true"
236
- })), n.$$click = T, n.$$pointerdown = (o) => o.stopPropagation(), l(n, c(A, {
252
+ })), o.$$click = z, o.$$pointerdown = (n) => n.stopPropagation(), l(o, c(N, {
237
253
  class: "workbench-widget__traffic-icon",
238
254
  "aria-hidden": "true"
239
- })), l(w, G), s.$$pointerdown = X, l(s, c(rt, {
255
+ })), l(w, U), s.$$pointerdown = X, l(s, c(st, {
240
256
  class: "w-3.5 h-3.5"
241
- })), l(M, () => {
242
- const o = t.definition.icon;
243
- return c(o, {
257
+ })), l(y, () => {
258
+ const n = t.definition.icon;
259
+ return c(n, {
244
260
  class: "w-3.5 h-3.5"
245
261
  });
246
- }, p), l(p, () => t.widgetTitle), $.$$click = z, $.$$pointerdown = (o) => o.stopPropagation(), l($, c(N, {
262
+ }, P), l(P, () => t.widgetTitle), $.$$click = T, $.$$pointerdown = (n) => n.stopPropagation(), l($, c(F, {
247
263
  class: "workbench-widget__window-control-icon",
248
264
  "aria-hidden": "true"
249
- })), k.$$click = T, k.$$pointerdown = (o) => o.stopPropagation(), l(k, c(A, {
265
+ })), k.$$click = z, k.$$pointerdown = (n) => n.stopPropagation(), l(k, c(N, {
250
266
  class: "workbench-widget__window-control-icon",
251
267
  "aria-hidden": "true"
252
- })), y.$$click = D, y.$$pointerdown = (o) => o.stopPropagation(), l(y, c(F, {
268
+ })), M.$$click = D, M.$$pointerdown = (n) => n.stopPropagation(), l(M, c(O, {
253
269
  class: "workbench-widget__window-control-icon",
254
270
  "aria-hidden": "true"
255
- })), l(tt, () => {
256
- const o = t.definition.body;
257
- return c(o, {
271
+ })), l(nt, () => {
272
+ const n = t.definition.body;
273
+ return c(n, {
258
274
  get widgetId() {
259
275
  return t.widgetId;
260
276
  },
@@ -265,19 +281,22 @@ function xt(t) {
265
281
  return t.widgetType;
266
282
  },
267
283
  get surfaceMetrics() {
268
- return R();
284
+ return E();
285
+ },
286
+ get activation() {
287
+ return G();
269
288
  }
270
289
  });
271
290
  }), l(e, (() => {
272
- var o = it(() => !!t.locked);
273
- return () => o() ? null : (() => {
274
- var Y = gt();
275
- return Y.$$pointerdown = U, Y;
291
+ var n = rt(() => !!t.locked);
292
+ return () => n() ? null : (() => {
293
+ var H = bt();
294
+ return H.$$pointerdown = et, H;
276
295
  })();
277
296
  })(), null), e;
278
297
  })();
279
298
  }
280
- ot(["pointerdown", "click"]);
299
+ lt(["pointerdown", "click"]);
281
300
  export {
282
- xt as WorkbenchWidget
301
+ Ct as WorkbenchWidget
283
302
  };
@@ -20,11 +20,18 @@ export interface WorkbenchWidgetSurfaceMetrics {
20
20
  ready: boolean;
21
21
  rect: WorkbenchProjectedRect;
22
22
  }
23
+ export type WorkbenchWidgetBodyActivationSource = 'local_pointer';
24
+ export interface WorkbenchWidgetBodyActivation {
25
+ seq: number;
26
+ source: WorkbenchWidgetBodyActivationSource;
27
+ pointerType?: string;
28
+ }
23
29
  export interface WorkbenchWidgetBodyProps<TWidgetType extends string = WorkbenchWidgetType> {
24
30
  widgetId: string;
25
31
  title: string;
26
32
  type: TWidgetType;
27
33
  surfaceMetrics?: WorkbenchWidgetSurfaceMetrics;
34
+ activation?: WorkbenchWidgetBodyActivation;
28
35
  }
29
36
  export interface WorkbenchWidgetDefinition<TWidgetType extends string = WorkbenchWidgetType> {
30
37
  type: TWidgetType;