@omnipad/vue 0.4.3 → 0.4.5

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