@omnipad/vue 0.4.5 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,126 +1,164 @@
1
- import { Registry as pe, ElementObserver as ne, WindowManager as ye, CONTEXT as ie, CMP_TYPES as I, InputZoneCore as me, RootLayerCore as ge, TargetZoneCore as Pe, ButtonCore as be, DPadCore as he, TrackpadCore as Ce, JoystickCore as _e, setGlobalSignalHandler as we, ACTION_TYPES as se } from "@omnipad/core";
2
- import { getObjectDiff as Re, createCachedProvider as ke, createPointerBridge as $e, generateUID as De, getBusinessProps as ae, resolveLayoutStyle as q, supportsContainerQueries as Q, remap as G, reclaimFocusAtPos as Ne, dispatchPointerEventAtPos as Ie, dispatchKeyboardEvent as ce } from "@omnipad/core/utils";
3
- import { defineComponent as B, h as Te, shallowRef as Ee, ref as M, computed as $, watch as le, onMounted as Ae, onUnmounted as Se, readonly as X, openBlock as w, createElementBlock as E, Fragment as xe, renderList as Ue, createBlock as Z, resolveDynamicComponent as ee, renderSlot as h, inject as Be, provide as Le, useSlots as Oe, nextTick as Ve, normalizeStyle as O, normalizeClass as D, unref as o, createVNode as H, withCtx as N, createElementVNode as T, createCommentVNode as Y, Transition as Me, toDisplayString as Ye, normalizeProps as x, guardReactiveProps as U, watchEffect as de } from "vue";
4
- const j = {};
5
- function F(e, n) {
6
- j[e] = n;
1
+ import { Registry as pe, CONTEXT as se, CMP_TYPES as T, InputZoneCore as ye, RootLayerCore as me, TargetZoneCore as ge, ButtonCore as Pe, DPadCore as be, TrackpadCore as he, JoystickCore as Ce, setGlobalSignalHandler as ke, ACTION_TYPES as ae } from "@omnipad/core";
2
+ import { createWebStickyProvider as Re, ElementObserver as j, WindowManager as _e, createPointerBridge as we, supportsContainerQueries as Q, reclaimFocusAtPos as De, dispatchPointerEventAtPos as $e, dispatchKeyboardEvent as le } from "@omnipad/core/dom";
3
+ import { defineComponent as B, h as Ie, shallowRef as Ne, ref as M, watch as te, onMounted as Te, onUnmounted as Ee, computed as D, readonly as ee, openBlock as R, createElementBlock as S, Fragment as Se, renderList as Ae, createBlock as Z, resolveDynamicComponent as oe, renderSlot as b, inject as xe, provide as Ue, useSlots as Le, nextTick as Be, normalizeStyle as O, normalizeClass as $, unref as o, createVNode as X, withCtx as I, createElementVNode as E, createCommentVNode as Y, Transition as Oe, toDisplayString as Ve, normalizeProps as U, guardReactiveProps as L, watchEffect as ue } from "vue";
4
+ import { getObjectDiff as Me, createCachedProvider as Ye, resolveStickyLayout as Ze, generateUID as Ke, getBusinessProps as re, resolveLayoutStyle as J, remap as H } from "@omnipad/core/utils";
5
+ const q = {};
6
+ function K(e, n) {
7
+ q[e] = n;
7
8
  }
8
- function ue(e) {
9
- const n = j[e];
9
+ function de(e) {
10
+ const n = q[e];
10
11
  return n || B({
11
- render: () => Te("div", { style: "color:red" }, `[Unknown: ${e}]`)
12
+ render: () => Ie("div", { style: "color:red" }, `[Unknown: ${e}]`)
12
13
  });
13
14
  }
14
- function re(e) {
15
- return !e || !j[e] ? null : j[e];
15
+ function ce(e) {
16
+ return !e || !q[e] ? null : q[e];
16
17
  }
17
- function Pt(e) {
18
- return e ? !!j[e] : !1;
18
+ function Ct(e) {
19
+ return e ? !!q[e] : !1;
19
20
  }
20
- function K(e, n, d = {}, s) {
21
- const t = e(), r = Ee(), b = M(), i = M(), l = $(() => i.value?.layout), a = M(null), f = (y) => {
22
- r.value && "bindDelegate" in r.value && Object.entries(y).forEach(([u, m]) => {
23
- r.value.bindDelegate(u, m);
24
- });
21
+ function F(e, n, f = {}, c) {
22
+ const t = e(), l = Ne(), P = M(), i = M(), u = M(null);
23
+ let s;
24
+ const p = M(0), h = () => {
25
+ p.value = p.value % 65535 + 1;
25
26
  };
27
+ te(
28
+ // 1. 精确定义依赖源:只有这个字符串变了,才触发回调
29
+ () => i.value?.layout?.stickySelector,
30
+ (a, d, g) => {
31
+ if (!a) {
32
+ s = null, h();
33
+ return;
34
+ }
35
+ let v = !1;
36
+ if (s ? v = s.updateSelector(a) : (s = Re(a), v = !0), !v) return;
37
+ const r = s.getTarget();
38
+ if (!r) return;
39
+ const N = t.uid + "-sticky";
40
+ j.getInstance().observeResize(N, r, () => {
41
+ s?.markDirty(), t.markRectDirty();
42
+ }), j.getInstance().observeIntersect(N, r, (y) => {
43
+ y || t.reset();
44
+ }), h(), g(() => {
45
+ j.getInstance().disconnect(N);
46
+ });
47
+ },
48
+ { immediate: !0 }
49
+ // 必须开启,以处理初始配置即存在吸附的情况
50
+ );
26
51
  let _ = { ...n.value };
27
- le(
52
+ te(
28
53
  n,
29
- (y) => {
30
- if (!r.value) return;
31
- const u = Re(_, y);
32
- Object.keys(u).length > 0 && r.value.updateConfig(u), _ = { ...n.value };
54
+ (a) => {
55
+ if (!l.value) return;
56
+ const d = Me(_, a);
57
+ Object.keys(d).length > 0 && l.value.updateConfig(d), _ = { ...n.value };
33
58
  },
34
59
  { deep: !0 }
35
- ), Ae(() => {
36
- r.value = t, pe.getInstance().register(t), "subscribeState" in t && t.subscribeState((u) => b.value = u), "subscribeConfig" in t && t.subscribeConfig((u) => i.value = u), s && f(s);
37
- let y = null;
38
- if (a.value && (a.value instanceof Element ? y = a.value : a.value.$el instanceof Element && (y = a.value.$el)), y instanceof Element) {
39
- const u = ne.getInstance();
60
+ );
61
+ const w = (a) => {
62
+ l.value && "bindDelegate" in l.value && Object.entries(a).forEach(([d, g]) => {
63
+ l.value.bindDelegate(d, g);
64
+ });
65
+ };
66
+ Te(() => {
67
+ l.value = t, pe.getInstance().register(t), "subscribeState" in t && t.subscribeState((d) => P.value = d), "subscribeConfig" in t && t.subscribeConfig((d) => i.value = d), c && w(c);
68
+ let a = null;
69
+ if (u.value && (u.value instanceof Element ? a = u.value : u.value.$el instanceof Element && (a = u.value.$el)), a instanceof Element) {
70
+ const d = j.getInstance();
40
71
  if ("bindRectProvider" in t) {
41
- const m = ke(() => y.getBoundingClientRect());
42
- t.bindRectProvider(m.get, m.markDirty), u.observeResize(t.uid, y, () => {
72
+ const g = Ye(() => a.getBoundingClientRect());
73
+ t.bindRectProvider(g.get, () => {
74
+ g.markDirty(), s && (s.markDirty(), h());
75
+ }), d.observeResize(t.uid, a, () => {
43
76
  t.markRectDirty();
44
77
  });
45
78
  }
46
- u.observeIntersect(t.uid, y, (m) => {
47
- m || t.reset();
79
+ d.observeIntersect(t.uid, a, (g) => {
80
+ g || t.reset();
48
81
  });
49
82
  }
50
- ye.getInstance().init();
51
- }), Se(() => {
52
- ne.getInstance().disconnect(t.uid), r.value && r.value.destroy();
83
+ _e.getInstance().init();
84
+ }), Ee(() => {
85
+ j.getInstance().disconnect(t.uid), j.getInstance().disconnect(t.uid + "-sticky"), l.value && l.value.destroy();
86
+ });
87
+ const k = "onPointerDown" in t ? we(t, f) : {}, C = D(() => {
88
+ const a = i.value?.layout;
89
+ if (!s || !p.value) return a;
90
+ const d = s.getRect();
91
+ return d ? Ze(a, d) : a;
53
92
  });
54
- const R = "onPointerDown" in t ? $e(t, d) : {};
55
93
  return {
56
- core: X(r),
57
- state: X(b),
58
- domEvents: R,
59
- effectiveConfig: X(i),
60
- effectiveLayout: l,
61
- elementRef: a,
62
- bindDelegates: f
94
+ core: ee(l),
95
+ state: ee(P),
96
+ domEvents: k,
97
+ effectiveConfig: ee(i),
98
+ effectiveLayout: C,
99
+ elementRef: u,
100
+ bindDelegates: w
63
101
  };
64
102
  }
65
- const Ze = { class: "omnipad-virtual-layer-base omnipad-prevent" }, Fe = /* @__PURE__ */ B({
103
+ const Fe = { class: "omnipad-virtual-layer-base omnipad-prevent" }, ze = /* @__PURE__ */ B({
66
104
  __name: "VirtualLayerBase",
67
105
  props: {
68
106
  nodes: {}
69
107
  },
70
108
  setup(e) {
71
- const n = e, d = $(() => (n.nodes || []).map((s) => {
72
- let t = re(s.type);
73
- return !t && s.config?.baseType && (t = re(s.config.baseType)), t || (t = ue(s.type)), {
74
- node: s,
109
+ const n = e, f = D(() => (n.nodes || []).map((c) => {
110
+ let t = ce(c.type);
111
+ return !t && c.config?.baseType && (t = ce(c.config.baseType)), t || (t = de(c.type)), {
112
+ node: c,
75
113
  component: t
76
114
  };
77
115
  }));
78
- return (s, t) => (w(), E("div", Ze, [
79
- (w(!0), E(xe, null, Ue(d.value, (r) => (w(), Z(ee(r.component), {
80
- key: r.node.uid,
81
- "tree-node": r.node
116
+ return (c, t) => (R(), S("div", Fe, [
117
+ (R(!0), S(Se, null, Ae(f.value, (l) => (R(), Z(oe(l.component), {
118
+ key: l.node.uid,
119
+ "tree-node": l.node
82
120
  }, null, 8, ["tree-node"]))), 128)),
83
- h(s.$slots, "default", {}, void 0, !0)
121
+ b(c.$slots, "default", {}, void 0, !0)
84
122
  ]));
85
123
  }
86
124
  }), V = (e, n) => {
87
- const d = e.__vccOpts || e;
88
- for (const [s, t] of n)
89
- d[s] = t;
90
- return d;
91
- }, ve = /* @__PURE__ */ V(Fe, [["__scopeId", "data-v-d67cc501"]]), Ke = ["treeNode", "widgetId", "parentId"];
92
- function z(e, n, d = {}, s = []) {
93
- const t = n.treeNode, r = t && t.config?.baseType === e || t?.type === e ? t : void 0;
94
- t && !r && console.warn(
125
+ const f = e.__vccOpts || e;
126
+ for (const [c, t] of n)
127
+ f[c] = t;
128
+ return f;
129
+ }, ve = /* @__PURE__ */ V(ze, [["__scopeId", "data-v-a172c7c0"]]), We = ["treeNode", "widgetId", "parentId"];
130
+ function z(e, n, f = {}, c = []) {
131
+ const t = n.treeNode, l = t && t.config?.baseType === e || t?.type === e ? t : void 0;
132
+ t && !l && console.warn(
95
133
  `[OmniPad-Validation] Type mismatch! Component expected "${e}", but received "${t.type}". Config ignored.`
96
134
  );
97
- const b = Be(ie.PARENT_ID_KEY, M(void 0)), i = $(() => n.parentId || r?.config?.parentId || b.value), l = n.widgetId || r?.uid || De(e);
98
- Le(ie.PARENT_ID_KEY, l);
99
- const a = /* @__PURE__ */ new Set([...Ke, ...s]), f = r?.config || {}, _ = ae(n, a), R = {
100
- ...d,
135
+ const P = xe(se.PARENT_ID_KEY, M(void 0)), i = D(() => n.parentId || l?.config?.parentId || P.value), u = D(() => n.widgetId || l?.uid || Ke(e));
136
+ Ue(se.PARENT_ID_KEY, u);
137
+ const s = /* @__PURE__ */ new Set([...We, ...c]), p = l?.config || {}, h = re(n, s), _ = D(() => ({
101
138
  ...f,
102
- ..._,
103
- id: l,
139
+ ...p,
140
+ ...h,
141
+ id: u.value,
104
142
  baseType: e,
105
143
  parentId: i.value,
106
144
  // 特殊处理 Layout:深度合并,确保即便只传了 { width: 100 } 也不丢失原来的 left/top
107
145
  layout: {
108
- ...d.layout || {},
109
146
  ...f.layout || {},
110
- ..._.layout || {}
147
+ ...p.layout || {},
148
+ ...h.layout || {}
111
149
  }
112
- }, y = $(() => {
113
- const u = ae(n, a);
150
+ })), w = D(() => {
151
+ const k = re(n, s);
114
152
  return {
115
- ...u,
153
+ ...k,
116
154
  parentId: i.value,
117
- layout: u.layout || void 0
155
+ layout: k.layout || void 0
118
156
  // 只有当传入了新的 layout 时才包裹
119
157
  };
120
158
  });
121
- return { uid: l, initialConfig: R, reactiveConfig: y };
159
+ return { uid: u, initialConfig: _, reactiveConfig: w };
122
160
  }
123
- const ze = ["id"], We = /* @__PURE__ */ B({
161
+ const je = ["id"], qe = /* @__PURE__ */ B({
124
162
  __name: "InputZone",
125
163
  props: {
126
164
  treeNode: {},
@@ -129,111 +167,111 @@ const ze = ["id"], We = /* @__PURE__ */ B({
129
167
  preventFocusLoss: {}
130
168
  },
131
169
  setup(e) {
132
- const n = e, d = Oe(), s = M(null), { uid: t, initialConfig: r, reactiveConfig: b } = z(
133
- I.INPUT_ZONE,
170
+ const n = e, f = Le(), c = M(null), { uid: t, initialConfig: l, reactiveConfig: P } = z(
171
+ T.INPUT_ZONE,
134
172
  n
135
- ), { core: i, state: l, domEvents: a, effectiveConfig: f, effectiveLayout: _, elementRef: R, bindDelegates: y } = K(
136
- () => new me(t, r, n.treeNode?.type),
137
- b,
173
+ ), { core: i, state: u, domEvents: s, effectiveConfig: p, effectiveLayout: h, elementRef: _, bindDelegates: w } = F(
174
+ () => new ye(t.value, l.value, n.treeNode?.type),
175
+ P,
138
176
  {
139
177
  requireDirectHit: !0
140
178
  }
141
- ), u = $(() => {
142
- const p = n.treeNode?.config?.dynamicWidgetId;
143
- return n.treeNode?.children?.filter((A) => A.uid !== p) || [];
144
- }), m = $(() => {
145
- const A = (d.dynamicWidget?.() || []).filter((J) => !(J.type === Comment || J.type === Text)), S = n.treeNode?.children?.find(
146
- (J) => J.uid === n.treeNode?.config?.dynamicWidgetId
179
+ ), k = D(() => {
180
+ const m = n.treeNode?.config?.dynamicWidgetId;
181
+ return n.treeNode?.children?.filter((A) => A.uid !== m) || [];
182
+ }), C = D(() => {
183
+ const A = (f.dynamicWidget?.() || []).filter((G) => !(G.type === Comment || G.type === Text)), x = n.treeNode?.children?.find(
184
+ (G) => G.uid === n.treeNode?.config?.dynamicWidgetId
147
185
  ), W = A.length > 0;
148
186
  return A.length > 1 && console.error(
149
187
  `[OmniPad-Validation] InputZone ${t} has multiple dynamic widgets in slot. Only the first one will be activated.`
150
- ), W && S && console.warn(
188
+ ), W && x && console.warn(
151
189
  `[OmniPad-Validation] InputZone ${t} has both Slot and Config dynamic widgets. Config ignored.`
152
190
  ), {
153
- nodeToRender: W ? A[0] : S || null,
191
+ nodeToRender: W ? A[0] : x || null,
154
192
  isFromSlot: W
155
193
  };
156
- }), P = $(() => {
157
- const p = m.value.nodeToRender;
158
- return ue(p.config?.baseType || p.type);
194
+ }), a = D(() => {
195
+ const m = C.value.nodeToRender;
196
+ return de(m.config?.baseType || m.type);
159
197
  });
160
- le(
161
- s,
162
- (p) => {
163
- Ve(() => {
164
- p && p?.uid && (i.value?.updateConfig({
165
- dynamicWidgetId: p.uid
166
- }), y({
198
+ te(
199
+ c,
200
+ (m) => {
201
+ Be(() => {
202
+ m && m?.uid && (i.value?.updateConfig({
203
+ dynamicWidgetId: m.uid
204
+ }), w({
167
205
  dynamicWidgetPointerDown: (A) => {
168
- p.markRectDirty?.(), p.onPointerDown?.(A);
206
+ m.markRectDirty?.(), m.onPointerDown?.(A);
169
207
  },
170
- dynamicWidgetPointerMove: p.onPointerMove,
171
- dynamicWidgetPointerUp: p.onPointerUp,
172
- dynamicWidgetPointerCancel: p.onPointerCancel
208
+ dynamicWidgetPointerMove: m.onPointerMove,
209
+ dynamicWidgetPointerUp: m.onPointerUp,
210
+ dynamicWidgetPointerCancel: m.onPointerCancel
173
211
  }));
174
212
  });
175
213
  },
176
214
  { immediate: !0 }
177
215
  );
178
- const C = $(() => _.value ? q(_.value) : {}), k = Q(), v = $(() => {
179
- if (!l.value) return { display: "none" };
180
- if (!l.value?.isDynamicActive) return { visibility: "hidden", opacity: 0 };
181
- let p, A;
182
- const S = l?.value?.dynamicPosition;
183
- if (k)
184
- p = `${S.x}cqw`, A = `${S.y}cqh`;
216
+ const d = D(() => h.value ? J(h.value) : {}), g = Q(), v = D(() => {
217
+ if (!u.value) return { display: "none" };
218
+ if (!u.value?.isDynamicActive) return { visibility: "hidden", opacity: 0 };
219
+ let m, A;
220
+ const x = u?.value?.dynamicPosition;
221
+ if (g)
222
+ m = `${x.x}cqw`, A = `${x.y}cqh`;
185
223
  else {
186
224
  const W = i?.value?.rect;
187
- p = `${G(S?.x || 0, 0, 100, 0, W?.width || 0)}px`, A = `${G(S?.y || 0, 0, 100, 0, W?.height || 0)}px`;
225
+ m = `${H(x?.x || 0, 0, 100, 0, W?.width || 0)}px`, A = `${H(x?.y || 0, 0, 100, 0, W?.height || 0)}px`;
188
226
  }
189
227
  return {
190
228
  zIndex: 100,
191
- "--dynamic-widget-mount-x": p,
229
+ "--dynamic-widget-mount-x": m,
192
230
  "--dynamic-widget-mount-y": A,
193
231
  visibility: "visible",
194
232
  opacity: 1,
195
233
  pointerEvents: "auto"
196
234
  };
197
- }), c = (p) => a?.onPointerDown?.(p), L = (p) => a?.onPointerMove?.(p), g = (p) => a?.onPointerUp?.(p), oe = (p) => a?.onPointerCancel?.(p);
198
- return (p, A) => (w(), E("div", {
235
+ }), r = (m) => s?.onPointerDown?.(m), N = (m) => s?.onPointerMove?.(m), y = (m) => s?.onPointerUp?.(m), ie = (m) => s?.onPointerCancel?.(m);
236
+ return (m, A) => (R(), S("div", {
199
237
  id: o(t),
200
238
  ref_key: "elementRef",
201
- ref: R,
202
- class: D(["omnipad-input-zone omnipad-prevent", o(f)?.cssClasses]),
203
- style: O(C.value)
239
+ ref: _,
240
+ class: $(["omnipad-input-zone omnipad-prevent", o(p)?.cssClass]),
241
+ style: O(d.value)
204
242
  }, [
205
- H(ve, { nodes: u.value }, {
206
- default: N(() => [
207
- h(p.$slots, "default", {}, void 0, !0)
243
+ X(ve, { nodes: k.value }, {
244
+ default: I(() => [
245
+ b(m.$slots, "default", {}, void 0, !0)
208
246
  ]),
209
247
  _: 3
210
248
  }, 8, ["nodes"]),
211
- m.value.nodeToRender || o(i)?.isInterceptorRequired ? (w(), E("div", {
249
+ C.value.nodeToRender || o(i)?.isInterceptorRequired ? (R(), S("div", {
212
250
  key: 0,
213
251
  class: "omnipad-input-zone-trigger omnipad-prevent",
214
- onPointerdown: c,
215
- onPointermove: L,
216
- onPointerup: g,
217
- onPointercancel: oe,
218
- onLostpointercapture: oe
252
+ onPointerdown: r,
253
+ onPointermove: N,
254
+ onPointerup: y,
255
+ onPointercancel: ie,
256
+ onLostpointercapture: ie
219
257
  }, [
220
- T("div", {
258
+ E("div", {
221
259
  class: "dynamic-widget-mount",
222
260
  style: O(v.value)
223
261
  }, [
224
- m.value.isFromSlot ? (w(), Z(ee(m.value.nodeToRender), {
262
+ C.value.isFromSlot ? (R(), Z(oe(C.value.nodeToRender), {
225
263
  key: 0,
226
- ref: (S) => s.value = S
227
- }, null, 512)) : m.value.nodeToRender ? (w(), Z(ee(P.value), {
264
+ ref: (x) => c.value = x
265
+ }, null, 512)) : C.value.nodeToRender ? (R(), Z(oe(a.value), {
228
266
  key: 1,
229
- ref: (S) => s.value = S,
230
- "tree-node": m.value.nodeToRender
267
+ ref: (x) => c.value = x,
268
+ "tree-node": C.value.nodeToRender
231
269
  }, null, 8, ["tree-node"])) : Y("", !0)
232
270
  ], 4)
233
271
  ], 32)) : Y("", !0)
234
- ], 14, ze));
272
+ ], 14, je));
235
273
  }
236
- }), je = /* @__PURE__ */ V(We, [["__scopeId", "data-v-8b58e8ce"]]), qe = ["id"], Qe = /* @__PURE__ */ B({
274
+ }), Qe = /* @__PURE__ */ V(qe, [["__scopeId", "data-v-2f22290e"]]), Je = ["id"], Ge = /* @__PURE__ */ B({
237
275
  __name: "RootLayer",
238
276
  props: {
239
277
  treeNode: {},
@@ -241,34 +279,34 @@ const ze = ["id"], We = /* @__PURE__ */ B({
241
279
  layout: {}
242
280
  },
243
281
  setup(e) {
244
- const n = e, { uid: d, initialConfig: s, reactiveConfig: t } = z(
245
- I.ROOT_LAYER,
282
+ const n = e, { uid: f, initialConfig: c, reactiveConfig: t } = z(
283
+ T.ROOT_LAYER,
246
284
  n
247
- ), { effectiveConfig: r, effectiveLayout: b, elementRef: i } = K(
248
- () => new ge(d, s, n.treeNode?.type),
285
+ ), { effectiveConfig: l, effectiveLayout: P, elementRef: i } = F(
286
+ () => new me(f.value, c.value, n.treeNode?.type),
249
287
  t
250
- ), l = $(() => b.value ? q(b.value) : {});
251
- return (a, f) => (w(), E("div", {
252
- id: o(d),
288
+ ), u = D(() => P.value ? J(P.value) : {});
289
+ return (s, p) => (R(), S("div", {
290
+ id: o(f),
253
291
  ref_key: "elementRef",
254
292
  ref: i,
255
- class: D(["omnipad-root-layer omnipad-prevent", o(r)?.cssClasses]),
256
- style: O(l.value)
293
+ class: $(["omnipad-root-layer omnipad-prevent", o(l)?.cssClass]),
294
+ style: O(u.value)
257
295
  }, [
258
- H(ve, {
296
+ X(ve, {
259
297
  nodes: e.treeNode?.children || []
260
298
  }, {
261
- default: N(() => [
262
- h(a.$slots, "default", {}, void 0, !0)
299
+ default: I(() => [
300
+ b(s.$slots, "default", {}, void 0, !0)
263
301
  ]),
264
302
  _: 3
265
303
  }, 8, ["nodes"])
266
- ], 14, qe));
304
+ ], 14, Je));
267
305
  }
268
- }), Je = /* @__PURE__ */ V(Qe, [["__scopeId", "data-v-2e1f7fa1"]]), Ge = ["id"], He = {
306
+ }), He = /* @__PURE__ */ V(Ge, [["__scopeId", "data-v-ad8f02d4"]]), Xe = ["id"], et = {
269
307
  key: 0,
270
308
  class: "omnipad-default-focus-border-feedback"
271
- }, Xe = /* @__PURE__ */ B({
309
+ }, tt = /* @__PURE__ */ B({
272
310
  __name: "TargetZone",
273
311
  props: {
274
312
  treeNode: {},
@@ -278,101 +316,101 @@ const ze = ["id"], We = /* @__PURE__ */ B({
278
316
  layout: {}
279
317
  },
280
318
  setup(e) {
281
- const n = e, d = {
319
+ const n = e, f = {
282
320
  cursorAutoDelay: 2500
283
- }, { uid: s, initialConfig: t, reactiveConfig: r } = z(
284
- I.TARGET_ZONE,
321
+ }, { uid: c, initialConfig: t, reactiveConfig: l } = z(
322
+ T.TARGET_ZONE,
285
323
  n,
286
- d
287
- ), { core: b, state: i, domEvents: l, effectiveConfig: a, effectiveLayout: f, elementRef: _ } = K(
288
- () => new Pe(s, t, n.treeNode?.type),
289
- r,
324
+ f
325
+ ), { core: P, state: i, domEvents: u, effectiveConfig: s, effectiveLayout: p, elementRef: h } = F(
326
+ () => new ge(c.value, t.value, n.treeNode?.type),
327
+ l,
290
328
  {},
291
329
  {
292
- dispatchKeyboardEvent: ce,
293
- dispatchPointerEventAtPos: Ie,
294
- reclaimFocusAtPos: Ne
330
+ dispatchKeyboardEvent: le,
331
+ dispatchPointerEventAtPos: $e,
332
+ reclaimFocusAtPos: De
295
333
  }
296
- ), R = $(() => f.value ? q(f.value) : {}), y = Q(), u = $(() => {
334
+ ), _ = D(() => p.value ? J(p.value) : {}), w = Q(), k = D(() => {
297
335
  if (!i.value) return { display: "none" };
298
- let v, c;
299
- const L = i?.value?.position;
300
- if (y)
301
- v = `${L.x}cqw`, c = `${L.y}cqh`;
336
+ let v, r;
337
+ const N = i?.value?.position;
338
+ if (w)
339
+ v = `${N.x}cqw`, r = `${N.y}cqh`;
302
340
  else {
303
- const g = b?.value?.rect;
304
- v = `${G(L?.x || 0, 0, 100, 0, g?.width || 0)}px`, c = `${G(L?.y || 0, 0, 100, 0, g?.height || 0)}px`;
341
+ const y = P?.value?.rect;
342
+ v = `${H(N?.x || 0, 0, 100, 0, y?.width || 0)}px`, r = `${H(N?.y || 0, 0, 100, 0, y?.height || 0)}px`;
305
343
  }
306
344
  return {
307
345
  "--omnipad-virtual-cursor-x": v,
308
- "--omnipad-virtual-cursor-y": c,
346
+ "--omnipad-virtual-cursor-y": r,
309
347
  opacity: i.value.isVisible ? 1 : 0
310
348
  };
311
- }), m = (v) => l?.onPointerDown?.(v), P = (v) => l?.onPointerMove?.(v), C = (v) => l?.onPointerUp?.(v), k = (v) => l?.onPointerCancel?.(v);
312
- return (v, c) => (w(), E("div", {
313
- id: o(s),
349
+ }), C = (v) => u?.onPointerDown?.(v), a = (v) => u?.onPointerMove?.(v), d = (v) => u?.onPointerUp?.(v), g = (v) => u?.onPointerCancel?.(v);
350
+ return (v, r) => (R(), S("div", {
351
+ id: o(c),
314
352
  ref_key: "elementRef",
315
- ref: _,
316
- class: D(["omnipad-target-zone omnipad-prevent", o(a)?.cssClasses]),
317
- style: O(R.value),
318
- onPointerdown: m,
319
- onPointermove: P,
320
- onPointerup: C,
321
- onPointercancel: k,
322
- onLostpointercapture: k
353
+ ref: h,
354
+ class: $(["omnipad-target-zone omnipad-prevent", o(s)?.cssClass]),
355
+ style: O(_.value),
356
+ onPointerdown: C,
357
+ onPointermove: a,
358
+ onPointerup: d,
359
+ onPointercancel: g,
360
+ onLostpointercapture: g
323
361
  }, [
324
- h(v.$slots, "focus-feedback", {
362
+ b(v.$slots, "focus-feedback", {
325
363
  state: o(i),
326
364
  isReturning: o(i)?.isFocusReturning,
327
365
  cursorPos: o(i)?.position
328
366
  }, () => [
329
- H(Me, { name: "omnipad-default-focus-fade" }, {
330
- default: N(() => [
331
- o(i)?.isFocusReturning ? (w(), E("div", He)) : Y("", !0)
367
+ X(Oe, { name: "omnipad-default-focus-fade" }, {
368
+ default: I(() => [
369
+ o(i)?.isFocusReturning ? (R(), S("div", et)) : Y("", !0)
332
370
  ]),
333
371
  _: 1
334
372
  })
335
373
  ], !0),
336
- o(a)?.cursorEnabled ? (w(), E("div", {
374
+ o(s)?.cursorEnabled ? (R(), S("div", {
337
375
  key: 0,
338
376
  class: "omnipad-virtual-cursor",
339
- style: O(u.value)
377
+ style: O(k.value)
340
378
  }, [
341
- h(v.$slots, "cursor", {
379
+ b(v.$slots, "cursor", {
342
380
  state: o(i),
343
381
  isDown: o(i)?.isPointerDown,
344
382
  isReturning: o(i)?.isFocusReturning,
345
383
  cursorPos: o(i)?.position
346
384
  }, () => [
347
- T("div", {
348
- class: D(["omnipad-default-cursor-dot", { "is-down": o(i)?.isPointerDown }])
385
+ E("div", {
386
+ class: $(["omnipad-default-cursor-dot", { "is-down": o(i)?.isPointerDown }])
349
387
  }, null, 2)
350
388
  ], !0)
351
389
  ], 4)) : Y("", !0),
352
- o(a)?.cursorEnabled ? (w(), E("div", {
390
+ o(s)?.cursorEnabled ? (R(), S("div", {
353
391
  key: 1,
354
392
  class: "omnipad-virtual-cursor",
355
- style: O(u.value)
393
+ style: O(k.value)
356
394
  }, [
357
- h(v.$slots, "with-cursor", {
395
+ b(v.$slots, "with-cursor", {
358
396
  state: o(i),
359
397
  isDown: o(i)?.isPointerDown,
360
398
  isReturning: o(i)?.isFocusReturning,
361
399
  cursorPos: o(i)?.position
362
400
  }, void 0, !0)
363
401
  ], 4)) : Y("", !0),
364
- h(v.$slots, "default", {
402
+ b(v.$slots, "default", {
365
403
  state: o(i),
366
404
  isDown: o(i)?.isPointerDown,
367
405
  isReturning: o(i)?.isFocusReturning,
368
406
  cursorPos: o(i)?.position
369
407
  }, void 0, !0)
370
- ], 46, Ge));
408
+ ], 46, Xe));
371
409
  }
372
- }), et = /* @__PURE__ */ V(Xe, [["__scopeId", "data-v-ef213f3f"]]), tt = { class: "omnipad-button-content-layer" }, ot = {
410
+ }), ot = /* @__PURE__ */ V(tt, [["__scopeId", "data-v-b1782723"]]), nt = { class: "omnipad-button-content-layer" }, it = {
373
411
  key: 0,
374
412
  class: "omnipad-default-button-label"
375
- }, nt = /* @__PURE__ */ B({
413
+ }, st = /* @__PURE__ */ B({
376
414
  __name: "VirtualButtonBase",
377
415
  props: {
378
416
  layout: {},
@@ -380,31 +418,31 @@ const ze = ["id"], We = /* @__PURE__ */ B({
380
418
  label: {}
381
419
  },
382
420
  setup(e) {
383
- const n = e, d = $(() => n.layout ? q(n.layout) : {});
384
- return (s, t) => (w(), E("div", {
421
+ const n = e, f = D(() => n.layout ? J(n.layout) : {});
422
+ return (c, t) => (R(), S("div", {
385
423
  class: "omnipad-button-base omnipad-prevent",
386
- style: O(d.value),
424
+ style: O(f.value),
387
425
  tabindex: "-1"
388
426
  }, [
389
- h(s.$slots, "base", {
427
+ b(c.$slots, "base", {
390
428
  isActive: e.isActive,
391
429
  label: e.label
392
430
  }, () => [
393
- T("div", {
394
- class: D(["omnipad-default-button-base", { "is-active": e.isActive }])
431
+ E("div", {
432
+ class: $(["omnipad-default-button-base", { "is-active": e.isActive }])
395
433
  }, null, 2)
396
434
  ], !0),
397
- T("div", tt, [
398
- h(s.$slots, "default", {
435
+ E("div", nt, [
436
+ b(c.$slots, "default", {
399
437
  isActive: e.isActive,
400
438
  label: e.label
401
439
  }, () => [
402
- e.label ? (w(), E("span", ot, Ye(e.label), 1)) : Y("", !0)
440
+ e.label ? (R(), S("span", it, Ve(e.label), 1)) : Y("", !0)
403
441
  ], !0)
404
442
  ])
405
443
  ], 4));
406
444
  }
407
- }), te = /* @__PURE__ */ V(nt, [["__scopeId", "data-v-f6a6e082"]]), it = /* @__PURE__ */ B({
445
+ }), ne = /* @__PURE__ */ V(st, [["__scopeId", "data-v-f6a6e082"]]), at = /* @__PURE__ */ B({
408
446
  __name: "VirtualButton",
409
447
  props: {
410
448
  treeNode: {},
@@ -415,43 +453,43 @@ const ze = ["id"], We = /* @__PURE__ */ B({
415
453
  layout: {}
416
454
  },
417
455
  setup(e, { expose: n }) {
418
- const d = e, s = {
456
+ const f = e, c = {
419
457
  label: "BTN"
420
- }, { uid: t, initialConfig: r, reactiveConfig: b } = z(
421
- I.BUTTON,
422
- d,
423
- s
424
- ), { core: i, state: l, domEvents: a, effectiveConfig: f, effectiveLayout: _, elementRef: R } = K(() => new be(t, r, d.treeNode?.type), b), y = (C) => a?.onPointerDown?.(C), u = (C) => a?.onPointerMove?.(C), m = (C) => a?.onPointerUp?.(C), P = (C) => a?.onPointerCancel?.(C);
458
+ }, { uid: t, initialConfig: l, reactiveConfig: P } = z(
459
+ T.BUTTON,
460
+ f,
461
+ c
462
+ ), { core: i, state: u, domEvents: s, effectiveConfig: p, effectiveLayout: h, elementRef: _ } = F(() => new Pe(t.value, l.value, f.treeNode?.type), P), w = (d) => s?.onPointerDown?.(d), k = (d) => s?.onPointerMove?.(d), C = (d) => s?.onPointerUp?.(d), a = (d) => s?.onPointerCancel?.(d);
425
463
  return n({
426
464
  uid: t,
427
- onPointerDown: y,
428
- onPointerMove: u,
429
- onPointerUp: m,
430
- onPointerCancel: P,
465
+ onPointerDown: w,
466
+ onPointerMove: k,
467
+ onPointerUp: C,
468
+ onPointerCancel: a,
431
469
  markRectDirty: () => i.value?.markRectDirty
432
- }), (C, k) => (w(), Z(te, {
470
+ }), (d, g) => (R(), Z(ne, {
433
471
  id: o(t),
434
472
  ref_key: "elementRef",
435
- ref: R,
436
- class: D(["omnipad-button omnipad-prevent", o(f)?.cssClasses]),
437
- layout: o(_),
438
- label: o(f)?.label,
439
- "is-active": o(l)?.isPressed,
440
- onPointerdown: y,
441
- onPointerup: m,
442
- onPointercancel: P,
443
- onLostpointercapture: P
473
+ ref: _,
474
+ class: $(["omnipad-button omnipad-prevent", o(p)?.cssClass]),
475
+ layout: o(h),
476
+ label: o(p)?.label,
477
+ "is-active": o(u)?.isPressed,
478
+ onPointerdown: w,
479
+ onPointerup: C,
480
+ onPointercancel: a,
481
+ onLostpointercapture: a
444
482
  }, {
445
- base: N((v) => [
446
- h(C.$slots, "base", x(U(v)))
483
+ base: I((v) => [
484
+ b(d.$slots, "base", U(L(v)))
447
485
  ]),
448
- default: N((v) => [
449
- h(C.$slots, "default", x(U(v)))
486
+ default: I((v) => [
487
+ b(d.$slots, "default", U(L(v)))
450
488
  ]),
451
489
  _: 3
452
490
  }, 8, ["id", "class", "layout", "label", "is-active"]));
453
491
  }
454
- }), st = { class: "omnipad-axis-bg" }, at = { class: "omnipad-axis-content-layer" }, rt = /* @__PURE__ */ B({
492
+ }), rt = { class: "omnipad-axis-bg" }, ct = { class: "omnipad-axis-content-layer" }, lt = /* @__PURE__ */ B({
455
493
  __name: "VirtualAxisBase",
456
494
  props: {
457
495
  layout: {},
@@ -461,51 +499,51 @@ const ze = ["id"], We = /* @__PURE__ */ B({
461
499
  baseRadius: {}
462
500
  },
463
501
  setup(e) {
464
- const n = e, d = $(() => n.layout ? q(n.layout) : {}), s = Q(), t = $(() => {
465
- const r = n.vector?.x || 0, b = n.vector?.y || 0, i = n.baseRadius?.x || 0, l = n.baseRadius?.y || 0, a = s ? `${r * 50}cqw` : `${r * i}px`, f = s ? `${b * 50}cqh` : `${b * l}px`, _ = s ? "100cqw" : `${i * 2}px`, R = s ? "100cqh" : `${l * 2}px`;
502
+ const n = e, f = D(() => n.layout ? J(n.layout) : {}), c = Q(), t = D(() => {
503
+ const l = n.vector?.x || 0, P = n.vector?.y || 0, i = n.baseRadius?.x || 0, u = n.baseRadius?.y || 0, s = c ? `${l * 50}cqw` : `${l * i}px`, p = c ? `${P * 50}cqh` : `${P * u}px`, h = c ? "100cqw" : `${i * 2}px`, _ = c ? "100cqh" : `${u * 2}px`;
466
504
  return {
467
- "--omnipad-axis-stick-container-x": a,
468
- "--omnipad-axis-stick-container-y": f,
469
- "--omnipad-axis-stick-width": _,
470
- "--omnipad-axis-stick-height": R,
505
+ "--omnipad-axis-stick-container-x": s,
506
+ "--omnipad-axis-stick-container-y": p,
507
+ "--omnipad-axis-stick-width": h,
508
+ "--omnipad-axis-stick-height": _,
471
509
  // 松手时加一点回弹过渡,活动时取消过渡保证绝对跟手
472
510
  transition: n.isActive ? "none" : "transform 0.1s ease-out"
473
511
  };
474
512
  });
475
- return (r, b) => (w(), E("div", {
476
- class: D(["omnipad-axis-base omnipad-prevent", { "is-active": e.isActive }]),
477
- style: O(d.value),
513
+ return (l, P) => (R(), S("div", {
514
+ class: $(["omnipad-axis-base omnipad-prevent", { "is-active": e.isActive }]),
515
+ style: O(f.value),
478
516
  tabindex: "-1"
479
517
  }, [
480
- T("div", st, [
481
- h(r.$slots, "base", {
518
+ E("div", rt, [
519
+ b(l.$slots, "base", {
482
520
  isActive: e.isActive,
483
521
  vector: e.vector
484
522
  }, void 0, !0)
485
523
  ]),
486
- e.showStick ? (w(), E("div", {
524
+ e.showStick ? (R(), S("div", {
487
525
  key: 0,
488
526
  class: "omnipad-axis-stick-container",
489
527
  style: O(t.value)
490
528
  }, [
491
- h(r.$slots, "stick", {
529
+ b(l.$slots, "stick", {
492
530
  isActive: e.isActive,
493
531
  vector: e.vector
494
532
  }, () => [
495
- T("div", {
496
- class: D(["omnipad-default-axis-stick", { "is-active": e.isActive }])
533
+ E("div", {
534
+ class: $(["omnipad-default-axis-stick", { "is-active": e.isActive }])
497
535
  }, null, 2)
498
536
  ], !0)
499
537
  ], 4)) : Y("", !0),
500
- T("div", at, [
501
- h(r.$slots, "default", {
538
+ E("div", ct, [
539
+ b(l.$slots, "default", {
502
540
  isActive: e.isActive,
503
541
  vector: e.vector
504
542
  }, void 0, !0)
505
543
  ])
506
544
  ], 6));
507
545
  }
508
- }), fe = /* @__PURE__ */ V(rt, [["__scopeId", "data-v-95bb429e"]]), ct = { class: "omnipad-dpad-cross-bg" }, lt = /* @__PURE__ */ B({
546
+ }), fe = /* @__PURE__ */ V(lt, [["__scopeId", "data-v-6ae17f17"]]), ut = { class: "omnipad-dpad-cross-bg" }, dt = /* @__PURE__ */ B({
509
547
  __name: "VirtualDPad",
510
548
  props: {
511
549
  treeNode: {},
@@ -517,70 +555,70 @@ const ze = ["id"], We = /* @__PURE__ */ B({
517
555
  layout: {}
518
556
  },
519
557
  setup(e, { expose: n }) {
520
- const d = e, s = {
558
+ const f = e, c = {
521
559
  showStick: !1,
522
560
  threshold: 0.3
523
- }, { uid: t, initialConfig: r, reactiveConfig: b } = z(
524
- I.D_PAD,
525
- d,
526
- s
527
- ), { core: i, state: l, domEvents: a, effectiveConfig: f, effectiveLayout: _, elementRef: R } = K(() => new he(t, r, d.treeNode?.type), b), y = Q(), u = M({ x: 0, y: 0 }), m = de(() => {
528
- const c = i.value?.rect;
529
- c && (u.value = { x: c.width / 2, y: c.height / 2 });
561
+ }, { uid: t, initialConfig: l, reactiveConfig: P } = z(
562
+ T.D_PAD,
563
+ f,
564
+ c
565
+ ), { core: i, state: u, domEvents: s, effectiveConfig: p, effectiveLayout: h, elementRef: _ } = F(() => new be(t.value, l.value, f.treeNode?.type), P), w = Q(), k = M({ x: 0, y: 0 }), C = ue(() => {
566
+ const r = i.value?.rect;
567
+ r && (k.value = { x: r.width / 2, y: r.height / 2 });
530
568
  });
531
- y && m();
532
- const P = (c) => a?.onPointerDown?.(c), C = (c) => a?.onPointerMove?.(c), k = (c) => a?.onPointerUp?.(c), v = (c) => a?.onPointerCancel?.(c);
569
+ w && C();
570
+ const a = (r) => s?.onPointerDown?.(r), d = (r) => s?.onPointerMove?.(r), g = (r) => s?.onPointerUp?.(r), v = (r) => s?.onPointerCancel?.(r);
533
571
  return n({
534
572
  uid: t,
535
- onPointerDown: P,
536
- onPointerMove: C,
537
- onPointerUp: k,
573
+ onPointerDown: a,
574
+ onPointerMove: d,
575
+ onPointerUp: g,
538
576
  onPointerCancel: v,
539
577
  markRectDirty: () => i.value?.markRectDirty()
540
- }), (c, L) => (w(), Z(fe, {
578
+ }), (r, N) => (R(), Z(fe, {
541
579
  ref_key: "elementRef",
542
- ref: R,
543
- class: D(["omnipad-dpad omnipad-prevent", o(f)?.cssClasses]),
544
- layout: o(_),
545
- "is-active": o(l)?.isActive,
546
- vector: o(l)?.vector,
547
- "show-stick": o(f)?.showStick,
548
- "base-radius": u.value,
549
- onPointerdown: P,
550
- onPointermove: C,
551
- onPointerup: k,
580
+ ref: _,
581
+ class: $(["omnipad-dpad omnipad-prevent", o(p)?.cssClass]),
582
+ layout: o(h),
583
+ "is-active": o(u)?.isActive,
584
+ vector: o(u)?.vector,
585
+ "show-stick": o(p)?.showStick,
586
+ "base-radius": k.value,
587
+ onPointerdown: a,
588
+ onPointermove: d,
589
+ onPointerup: g,
552
590
  onPointercancel: v,
553
591
  onLostpointercapture: v
554
592
  }, {
555
- base: N((g) => [
556
- h(c.$slots, "base", x(U(g)), () => [
557
- T("div", ct, [
558
- T("div", {
559
- class: D(["dpad-arm top", { on: g.vector && g.vector.y < -o(f)?.threshold }])
593
+ base: I((y) => [
594
+ b(r.$slots, "base", U(L(y)), () => [
595
+ E("div", ut, [
596
+ E("div", {
597
+ class: $(["dpad-arm top", { on: y.vector && y.vector.y < -o(p)?.threshold }])
560
598
  }, null, 2),
561
- T("div", {
562
- class: D(["dpad-arm bottom", { on: g.vector && g.vector.y > o(f)?.threshold }])
599
+ E("div", {
600
+ class: $(["dpad-arm bottom", { on: y.vector && y.vector.y > o(p)?.threshold }])
563
601
  }, null, 2),
564
- T("div", {
565
- class: D(["dpad-arm left", { on: g.vector && g.vector.x < -o(f)?.threshold }])
602
+ E("div", {
603
+ class: $(["dpad-arm left", { on: y.vector && y.vector.x < -o(p)?.threshold }])
566
604
  }, null, 2),
567
- T("div", {
568
- class: D(["dpad-arm right", { on: g.vector && g.vector.x > o(f)?.threshold }])
605
+ E("div", {
606
+ class: $(["dpad-arm right", { on: y.vector && y.vector.x > o(p)?.threshold }])
569
607
  }, null, 2),
570
- L[0] || (L[0] = T("div", { class: "dpad-center" }, null, -1))
608
+ N[0] || (N[0] = E("div", { class: "dpad-center" }, null, -1))
571
609
  ])
572
610
  ], !0)
573
611
  ]),
574
- stick: N((g) => [
575
- h(c.$slots, "stick", x(U(g)), void 0, !0)
612
+ stick: I((y) => [
613
+ b(r.$slots, "stick", U(L(y)), void 0, !0)
576
614
  ]),
577
- default: N((g) => [
578
- h(c.$slots, "default", x(U(g)), void 0, !0)
615
+ default: I((y) => [
616
+ b(r.$slots, "default", U(L(y)), void 0, !0)
579
617
  ]),
580
618
  _: 3
581
619
  }, 8, ["class", "layout", "is-active", "vector", "show-stick", "base-radius"]));
582
620
  }
583
- }), dt = /* @__PURE__ */ V(lt, [["__scopeId", "data-v-1bf11a90"]]), ut = /* @__PURE__ */ B({
621
+ }), vt = /* @__PURE__ */ V(dt, [["__scopeId", "data-v-8c030849"]]), ft = /* @__PURE__ */ B({
584
622
  __name: "VirtualTrackpad",
585
623
  props: {
586
624
  treeNode: {},
@@ -592,45 +630,45 @@ const ze = ["id"], We = /* @__PURE__ */ B({
592
630
  layout: {}
593
631
  },
594
632
  setup(e, { expose: n }) {
595
- const d = e, { uid: s, initialConfig: t, reactiveConfig: r } = z(
596
- I.TRACKPAD,
597
- d,
633
+ const f = e, { uid: c, initialConfig: t, reactiveConfig: l } = z(
634
+ T.TRACKPAD,
635
+ f,
598
636
  {
599
637
  label: "TRACKPAD",
600
638
  sensitivity: 1
601
639
  }
602
- ), { core: b, state: i, domEvents: l, effectiveConfig: a, effectiveLayout: f, elementRef: _ } = K(() => new Ce(s, t, d.treeNode?.type), r), R = (P) => l?.onPointerDown?.(P), y = (P) => l?.onPointerMove?.(P), u = (P) => l?.onPointerUp?.(P), m = (P) => l?.onPointerCancel?.(P);
640
+ ), { core: P, state: i, domEvents: u, effectiveConfig: s, effectiveLayout: p, elementRef: h } = F(() => new he(c.value, t.value, f.treeNode?.type), l), _ = (a) => u?.onPointerDown?.(a), w = (a) => u?.onPointerMove?.(a), k = (a) => u?.onPointerUp?.(a), C = (a) => u?.onPointerCancel?.(a);
603
641
  return n({
604
- uid: s,
605
- onPointerDown: R,
606
- onPointerMove: y,
607
- onPointerUp: u,
608
- onPointerCancel: m,
609
- markRectDirty: () => b.value?.markRectDirty
610
- }), (P, C) => (w(), Z(te, {
611
- id: o(s),
642
+ uid: c,
643
+ onPointerDown: _,
644
+ onPointerMove: w,
645
+ onPointerUp: k,
646
+ onPointerCancel: C,
647
+ markRectDirty: () => P.value?.markRectDirty
648
+ }), (a, d) => (R(), Z(ne, {
649
+ id: o(c),
612
650
  ref_key: "elementRef",
613
- ref: _,
614
- class: D(["omnipad-trackpad omnipad-prevent", o(a)?.cssClasses]),
615
- layout: o(f),
616
- label: o(a)?.label,
651
+ ref: h,
652
+ class: $(["omnipad-trackpad omnipad-prevent", o(s)?.cssClass]),
653
+ layout: o(p),
654
+ label: o(s)?.label,
617
655
  "is-active": o(i)?.isPressed,
618
- onPointerdown: R,
619
- onPointermove: y,
620
- onPointerup: u,
621
- onPointercancel: m,
622
- onLostpointercapture: m
656
+ onPointerdown: _,
657
+ onPointermove: w,
658
+ onPointerup: k,
659
+ onPointercancel: C,
660
+ onLostpointercapture: C
623
661
  }, {
624
- base: N((k) => [
625
- h(P.$slots, "base", x(U(k)), void 0, !0)
662
+ base: I((g) => [
663
+ b(a.$slots, "base", U(L(g)), void 0, !0)
626
664
  ]),
627
- default: N((k) => [
628
- h(P.$slots, "default", x(U(k)), void 0, !0)
665
+ default: I((g) => [
666
+ b(a.$slots, "default", U(L(g)), void 0, !0)
629
667
  ]),
630
668
  _: 3
631
669
  }, 8, ["id", "class", "layout", "label", "is-active"]));
632
670
  }
633
- }), vt = /* @__PURE__ */ V(ut, [["__scopeId", "data-v-e9f8b8d7"]]), ft = /* @__PURE__ */ B({
671
+ }), pt = /* @__PURE__ */ V(ft, [["__scopeId", "data-v-bacab613"]]), yt = /* @__PURE__ */ B({
634
672
  __name: "VirtualJoystick",
635
673
  props: {
636
674
  treeNode: {},
@@ -644,88 +682,88 @@ const ze = ["id"], We = /* @__PURE__ */ B({
644
682
  layout: {}
645
683
  },
646
684
  setup(e, { expose: n }) {
647
- const d = e, s = {
685
+ const f = e, c = {
648
686
  label: "PUSH",
649
687
  threshold: 0.2,
650
688
  cursorMode: !1,
651
689
  cursorSensitivity: 1
652
- }, { uid: t, initialConfig: r, reactiveConfig: b } = z(
653
- I.JOYSTICK,
654
- d,
655
- s
656
- ), { core: i, state: l, domEvents: a, effectiveConfig: f, effectiveLayout: _, elementRef: R } = K(() => new _e(t, r, d.treeNode?.type), b), y = Q(), u = M({ x: 0, y: 0 }), m = de(() => {
657
- const c = i.value?.rect;
658
- c && (u.value = { x: c.width / 2, y: c.height / 2 });
690
+ }, { uid: t, initialConfig: l, reactiveConfig: P } = z(
691
+ T.JOYSTICK,
692
+ f,
693
+ c
694
+ ), { core: i, state: u, domEvents: s, effectiveConfig: p, effectiveLayout: h, elementRef: _ } = F(() => new Ce(t.value, l.value, f.treeNode?.type), P), w = Q(), k = M({ x: 0, y: 0 }), C = ue(() => {
695
+ const r = i.value?.rect;
696
+ r && (k.value = { x: r.width / 2, y: r.height / 2 });
659
697
  });
660
- y && m();
661
- const P = (c) => a?.onPointerDown?.(c), C = (c) => a?.onPointerMove?.(c), k = (c) => a?.onPointerUp?.(c), v = (c) => a?.onPointerCancel?.(c);
698
+ w && C();
699
+ const a = (r) => s?.onPointerDown?.(r), d = (r) => s?.onPointerMove?.(r), g = (r) => s?.onPointerUp?.(r), v = (r) => s?.onPointerCancel?.(r);
662
700
  return n({
663
701
  uid: t,
664
- onPointerDown: P,
665
- onPointerMove: C,
666
- onPointerUp: k,
702
+ onPointerDown: a,
703
+ onPointerMove: d,
704
+ onPointerUp: g,
667
705
  onPointerCancel: v,
668
706
  markRectDirty: () => i.value?.markRectDirty
669
- }), (c, L) => (w(), Z(fe, {
707
+ }), (r, N) => (R(), Z(fe, {
670
708
  ref_key: "elementRef",
671
- ref: R,
672
- class: D(["omnipad-joystick omnipad-prevent", o(f)?.cssClasses]),
673
- layout: o(_),
674
- "is-active": o(l)?.isActive,
675
- vector: o(l)?.vector,
709
+ ref: _,
710
+ class: $(["omnipad-joystick omnipad-prevent", o(p)?.cssClass]),
711
+ layout: o(h),
712
+ "is-active": o(u)?.isActive,
713
+ vector: o(u)?.vector,
676
714
  "show-stick": "",
677
- "base-radius": u.value,
678
- onPointerdown: P,
679
- onPointermove: C,
680
- onPointerup: k,
715
+ "base-radius": k.value,
716
+ onPointerdown: a,
717
+ onPointermove: d,
718
+ onPointerup: g,
681
719
  onPointercancel: v,
682
720
  onLostpointercapture: v
683
721
  }, {
684
- base: N((g) => [
685
- h(c.$slots, "base", x(U(g)), void 0, !0)
722
+ base: I((y) => [
723
+ b(r.$slots, "base", U(L(y)), void 0, !0)
686
724
  ]),
687
- stick: N(() => [
688
- H(te, {
725
+ stick: I(() => [
726
+ X(ne, {
689
727
  layout: { height: "100%", width: "100%" },
690
- "is-active": o(l)?.isPressed,
691
- label: o(f)?.label
728
+ "is-active": o(u)?.isPressed,
729
+ label: o(p)?.label
692
730
  }, {
693
- base: N((g) => [
694
- h(c.$slots, "stick-base", x(U(g)), void 0, !0)
731
+ base: I((y) => [
732
+ b(r.$slots, "stick-base", U(L(y)), void 0, !0)
695
733
  ]),
696
- default: N((g) => [
697
- h(c.$slots, "stick", x(U(g)), void 0, !0)
734
+ default: I((y) => [
735
+ b(r.$slots, "stick", U(L(y)), void 0, !0)
698
736
  ]),
699
737
  _: 3
700
738
  }, 8, ["is-active", "label"])
701
739
  ]),
702
- default: N((g) => [
703
- h(c.$slots, "default", x(U(g)), void 0, !0)
740
+ default: I((y) => [
741
+ b(r.$slots, "default", U(L(y)), void 0, !0)
704
742
  ]),
705
743
  _: 3
706
744
  }, 8, ["class", "layout", "is-active", "vector", "base-radius"]));
707
745
  }
708
- }), pt = /* @__PURE__ */ V(ft, [["__scopeId", "data-v-ec529d0c"]]);
709
- F(I.BUTTON, it);
710
- F(I.INPUT_ZONE, je);
711
- F(I.ROOT_LAYER, Je);
712
- F(I.TARGET_ZONE, et);
713
- F(I.TRACKPAD, vt);
714
- F(I.D_PAD, dt);
715
- F(I.JOYSTICK, pt);
716
- we((e) => {
717
- (e.type === se.KEYDOWN || e.type === se.KEYUP) && ce(e.type, e.payload);
746
+ }), mt = /* @__PURE__ */ V(yt, [["__scopeId", "data-v-ae628e53"]]);
747
+ K(T.BUTTON, at);
748
+ K(T.INPUT_ZONE, Qe);
749
+ K(T.ROOT_LAYER, He);
750
+ K(T.TARGET_ZONE, ot);
751
+ K(T.TRACKPAD, pt);
752
+ K(T.D_PAD, vt);
753
+ K(T.JOYSTICK, mt);
754
+ ke((e) => {
755
+ (e.type === ae.KEYDOWN || e.type === ae.KEYUP) && le(e.type, e.payload);
718
756
  });
719
757
  export {
720
- je as InputZone,
721
- Je as RootLayer,
722
- et as TargetZone,
723
- it as VirtualButton,
724
- dt as VirtualDPad,
725
- pt as VirtualJoystick,
726
- vt as VirtualTrackpad,
727
- ue as getComponent,
728
- re as getComponentSafe,
729
- Pt as hasRegisteredComponent,
730
- F as registerComponent
758
+ Qe as InputZone,
759
+ He as RootLayer,
760
+ ot as TargetZone,
761
+ at as VirtualButton,
762
+ vt as VirtualDPad,
763
+ mt as VirtualJoystick,
764
+ pt as VirtualTrackpad,
765
+ de as getComponent,
766
+ ce as getComponentSafe,
767
+ Ct as hasRegisteredComponent,
768
+ K as registerComponent
731
769
  };