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