@omnipad/vue 0.5.0 → 0.6.1

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,164 +1,226 @@
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;
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;
8
8
  }
9
- function de(e) {
10
- const n = q[e];
11
- return n || B({
12
- render: () => Ie("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}]`)
13
13
  });
14
14
  }
15
- function ce(e) {
16
- return !e || !q[e] ? null : q[e];
15
+ function ne(e) {
16
+ return !e || !W[e] ? null : W[e];
17
17
  }
18
- function Ct(e) {
19
- return e ? !!q[e] : !1;
18
+ function It(e) {
19
+ return e ? !!W[e] : !1;
20
20
  }
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;
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
- );
51
- let _ = { ...n.value };
52
- te(
53
- n,
54
- (a) => {
55
- if (!l.value) return;
56
- const d = Me(_, a);
57
- Object.keys(d).length > 0 && l.value.updateConfig(d), _ = { ...n.value };
58
- },
59
- { deep: !0 }
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();
71
- if ("bindRectProvider" in t) {
72
- const g = Ye(() => a.getBoundingClientRect());
73
- t.bindRectProvider(g.get, () => {
74
- g.markDirty(), s && (s.markDirty(), h());
75
- }), d.observeResize(t.uid, a, () => {
76
- t.markRectDirty();
77
- });
78
- }
79
- d.observeIntersect(t.uid, a, (g) => {
80
- g || t.reset();
81
- });
82
- }
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;
92
- });
93
- return {
94
- core: ee(l),
95
- state: ee(P),
96
- domEvents: k,
97
- effectiveConfig: ee(i),
98
- effectiveLayout: C,
99
- elementRef: u,
100
- bindDelegates: w
101
- };
102
- }
103
- const Fe = { class: "omnipad-virtual-layer-base omnipad-prevent" }, ze = /* @__PURE__ */ B({
21
+ const Je = { class: "omnipad-virtual-layer-base omnipad-prevent" }, Qe = /* @__PURE__ */ I({
104
22
  __name: "VirtualLayerBase",
105
23
  props: {
106
24
  nodes: {}
107
25
  },
108
26
  setup(e) {
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,
113
- component: t
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)), {
30
+ node: s,
31
+ component: n
114
32
  };
115
33
  }));
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
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
120
38
  }, null, 8, ["tree-node"]))), 128)),
121
- b(c.$slots, "default", {}, void 0, !0)
39
+ g(s.$slots, "default", {}, void 0, !0)
122
40
  ]));
123
41
  }
124
- }), V = (e, n) => {
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(
133
- `[OmniPad-Validation] Type mismatch! Component expected "${e}", but received "${t.type}". Config ignored.`
134
- );
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(() => ({
138
- ...f,
139
- ...p,
140
- ...h,
141
- id: u.value,
142
- baseType: e,
143
- parentId: i.value,
144
- // 特殊处理 Layout:深度合并,确保即便只传了 { width: 100 } 也不丢失原来的 left/top
145
- layout: {
146
- ...f.layout || {},
147
- ...p.layout || {},
148
- ...h.layout || {}
149
- }
150
- })), w = D(() => {
151
- const k = re(n, s);
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);
152
75
  return {
153
- ...k,
154
- parentId: i.value,
155
- layout: k.layout || void 0
76
+ ...p,
77
+ parentId: a.value,
78
+ layout: p.layout || void 0
156
79
  // 只有当传入了新的 layout 时才包裹
157
80
  };
158
81
  });
159
- return { uid: u, initialConfig: _, reactiveConfig: w };
82
+ return { uid: r, initialConfig: h, reactiveConfig: f };
83
+ }
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
+ });
160
177
  }
161
- const je = ["id"], qe = /* @__PURE__ */ B({
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({
162
224
  __name: "InputZone",
163
225
  props: {
164
226
  treeNode: {},
@@ -167,111 +229,97 @@ const je = ["id"], qe = /* @__PURE__ */ B({
167
229
  preventFocusLoss: {}
168
230
  },
169
231
  setup(e) {
170
- const n = e, f = Le(), c = M(null), { uid: t, initialConfig: l, reactiveConfig: P } = z(
171
- T.INPUT_ZONE,
172
- n
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,
176
- {
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: {
177
234
  requireDirectHit: !0
178
235
  }
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
185
- ), W = A.length > 0;
186
- return A.length > 1 && console.error(
187
- `[OmniPad-Validation] InputZone ${t} has multiple dynamic widgets in slot. Only the first one will be activated.`
188
- ), W && x && console.warn(
189
- `[OmniPad-Validation] InputZone ${t} has both Slot and Config dynamic widgets. Config ignored.`
190
- ), {
191
- nodeToRender: W ? A[0] : x || null,
192
- isFromSlot: W
193
- };
194
- }), a = D(() => {
195
- const m = C.value.nodeToRender;
196
- return de(m.config?.baseType || m.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);
197
249
  });
198
- te(
199
- c,
200
- (m) => {
201
- Be(() => {
202
- m && m?.uid && (i.value?.updateConfig({
203
- dynamicWidgetId: m.uid
204
- }), w({
205
- dynamicWidgetPointerDown: (A) => {
206
- m.markRectDirty?.(), m.onPointerDown?.(A);
250
+ J(
251
+ s,
252
+ (P) => {
253
+ Ve(() => {
254
+ P && P?.uid && (t.value?.updateConfig({
255
+ dynamicWidgetId: P.uid
256
+ }), h({
257
+ dynamicWidgetPointerDown: (K) => {
258
+ P.markRectDirty?.(), P.onPointerDown?.(K);
207
259
  },
208
- dynamicWidgetPointerMove: m.onPointerMove,
209
- dynamicWidgetPointerUp: m.onPointerUp,
210
- dynamicWidgetPointerCancel: m.onPointerCancel
260
+ dynamicWidgetPointerMove: P.onPointerMove,
261
+ dynamicWidgetPointerUp: P.onPointerUp,
262
+ dynamicWidgetPointerCancel: P.onPointerCancel
211
263
  }));
212
264
  });
213
265
  },
214
266
  { immediate: !0 }
215
267
  );
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`;
223
- else {
224
- const W = i?.value?.rect;
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`;
226
- }
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);
227
275
  return {
228
276
  zIndex: 100,
229
- "--dynamic-widget-mount-x": m,
230
- "--dynamic-widget-mount-y": A,
277
+ "--dynamic-widget-mount-x": $.x,
278
+ "--dynamic-widget-mount-y": $.y,
231
279
  visibility: "visible",
232
280
  opacity: 1,
233
281
  pointerEvents: "auto"
234
282
  };
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", {
237
- 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),
238
286
  ref_key: "elementRef",
239
- ref: _,
240
- class: $(["omnipad-input-zone omnipad-prevent", o(p)?.cssClass]),
241
- style: O(d.value)
287
+ ref: k,
288
+ class: w(["omnipad-input-zone omnipad-prevent", i(d)?.cssClass]),
289
+ style: O(c.value)
242
290
  }, [
243
- X(ve, { nodes: k.value }, {
244
- default: I(() => [
245
- b(m.$slots, "default", {}, void 0, !0)
291
+ F(ue, { nodes: f.value }, {
292
+ default: S(() => [
293
+ g(P.$slots, "default", {}, void 0, !0)
246
294
  ]),
247
295
  _: 3
248
296
  }, 8, ["nodes"]),
249
- C.value.nodeToRender || o(i)?.isInterceptorRequired ? (R(), S("div", {
297
+ p.value.nodeToRender || i(t)?.isInterceptorRequired ? (C(), E("div", {
250
298
  key: 0,
251
299
  class: "omnipad-input-zone-trigger omnipad-prevent",
252
- onPointerdown: r,
253
- onPointermove: N,
300
+ onPointerdown: l,
301
+ onPointermove: x,
254
302
  onPointerup: y,
255
- onPointercancel: ie,
256
- onLostpointercapture: ie
303
+ onPointercancel: H,
304
+ onLostpointercapture: H
257
305
  }, [
258
- E("div", {
306
+ T("div", {
259
307
  class: "dynamic-widget-mount",
260
308
  style: O(v.value)
261
309
  }, [
262
- C.value.isFromSlot ? (R(), Z(oe(C.value.nodeToRender), {
310
+ p.value.isFromSlot ? (C(), z(j(p.value.nodeToRender), {
263
311
  key: 0,
264
- ref: (x) => c.value = x
265
- }, null, 512)) : C.value.nodeToRender ? (R(), Z(oe(a.value), {
312
+ ref: ($) => s.value = $
313
+ }, null, 512)) : p.value.nodeToRender ? (C(), z(j(_.value), {
266
314
  key: 1,
267
- ref: (x) => c.value = x,
268
- "tree-node": C.value.nodeToRender
269
- }, null, 8, ["tree-node"])) : Y("", !0)
315
+ ref: ($) => s.value = $,
316
+ "tree-node": p.value.nodeToRender
317
+ }, null, 8, ["tree-node"])) : B("", !0)
270
318
  ], 4)
271
- ], 32)) : Y("", !0)
272
- ], 14, je));
319
+ ], 32)) : B("", !0)
320
+ ], 14, it));
273
321
  }
274
- }), Qe = /* @__PURE__ */ V(qe, [["__scopeId", "data-v-2f22290e"]]), Je = ["id"], Ge = /* @__PURE__ */ B({
322
+ }), rt = /* @__PURE__ */ U(st, [["__scopeId", "data-v-6543281e"]]), at = ["id"], ct = /* @__PURE__ */ I({
275
323
  __name: "RootLayer",
276
324
  props: {
277
325
  treeNode: {},
@@ -279,138 +327,122 @@ const je = ["id"], qe = /* @__PURE__ */ B({
279
327
  layout: {}
280
328
  },
281
329
  setup(e) {
282
- const n = e, { uid: f, initialConfig: c, reactiveConfig: t } = z(
283
- T.ROOT_LAYER,
284
- n
285
- ), { effectiveConfig: l, effectiveLayout: P, elementRef: i } = F(
286
- () => new me(f.value, c.value, n.treeNode?.type),
287
- t
288
- ), u = D(() => P.value ? J(P.value) : {});
289
- return (s, p) => (R(), S("div", {
290
- id: o(f),
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),
291
333
  ref_key: "elementRef",
292
- ref: i,
293
- class: $(["omnipad-root-layer omnipad-prevent", o(l)?.cssClass]),
294
- style: O(u.value)
334
+ ref: t,
335
+ class: w(["omnipad-root-layer omnipad-prevent", i(s)?.cssClass]),
336
+ style: O(a.value)
295
337
  }, [
296
- X(ve, {
338
+ F(ue, {
297
339
  nodes: e.treeNode?.children || []
298
340
  }, {
299
- default: I(() => [
300
- b(s.$slots, "default", {}, void 0, !0)
341
+ default: S(() => [
342
+ g(r.$slots, "default", {}, void 0, !0)
301
343
  ]),
302
344
  _: 3
303
345
  }, 8, ["nodes"])
304
- ], 14, Je));
346
+ ], 14, at));
305
347
  }
306
- }), He = /* @__PURE__ */ V(Ge, [["__scopeId", "data-v-ad8f02d4"]]), Xe = ["id"], et = {
348
+ }), lt = /* @__PURE__ */ U(ct, [["__scopeId", "data-v-99206012"]]), ut = ["id"], dt = {
307
349
  key: 0,
308
350
  class: "omnipad-default-focus-border-feedback"
309
- }, tt = /* @__PURE__ */ B({
351
+ }, vt = /* @__PURE__ */ I({
310
352
  __name: "TargetZone",
311
353
  props: {
312
354
  treeNode: {},
313
355
  widgetId: {},
314
- cursorEnabled: { type: Boolean },
356
+ cursorEnabled: {},
315
357
  cursorAutoDelay: {},
316
358
  layout: {}
317
359
  },
318
360
  setup(e) {
319
- const n = e, f = {
361
+ const o = e, u = {
320
362
  cursorAutoDelay: 2500
321
- }, { uid: c, initialConfig: t, reactiveConfig: l } = z(
322
- T.TARGET_ZONE,
323
- n,
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,
328
- {},
329
- {
330
- dispatchKeyboardEvent: le,
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,
331
367
  dispatchPointerEventAtPos: $e,
332
- reclaimFocusAtPos: De
333
- }
334
- ), _ = D(() => p.value ? J(p.value) : {}), w = Q(), k = D(() => {
335
- if (!i.value) return { display: "none" };
336
- let v, r;
337
- const N = i?.value?.position;
338
- if (w)
339
- v = `${N.x}cqw`, r = `${N.y}cqh`;
340
- else {
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`;
368
+ reclaimFocusAtPos: Ie
343
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);
344
376
  return {
345
- "--omnipad-virtual-cursor-x": v,
346
- "--omnipad-virtual-cursor-y": r,
347
- 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
348
380
  };
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),
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),
352
384
  ref_key: "elementRef",
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
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
361
393
  }, [
362
- b(v.$slots, "focus-feedback", {
363
- state: o(i),
364
- isReturning: o(i)?.isFocusReturning,
365
- cursorPos: o(i)?.position
394
+ g(v.$slots, "focus-feedback", {
395
+ state: i(t),
396
+ isReturning: i(t)?.isFocusReturning,
397
+ cursorPos: i(t)?.position
366
398
  }, () => [
367
- X(Oe, { name: "omnipad-default-focus-fade" }, {
368
- default: I(() => [
369
- o(i)?.isFocusReturning ? (R(), S("div", et)) : Y("", !0)
399
+ F(Ke, { name: "omnipad-default-focus-fade" }, {
400
+ default: S(() => [
401
+ i(t)?.isFocusReturning ? (C(), E("div", dt)) : B("", !0)
370
402
  ]),
371
403
  _: 1
372
404
  })
373
405
  ], !0),
374
- o(s)?.cursorEnabled ? (R(), S("div", {
406
+ i(r)?.cursorEnabled ? (C(), E("div", {
375
407
  key: 0,
376
408
  class: "omnipad-virtual-cursor",
377
- style: O(k.value)
409
+ style: O(f.value)
378
410
  }, [
379
- b(v.$slots, "cursor", {
380
- state: o(i),
381
- isDown: o(i)?.isPointerDown,
382
- isReturning: o(i)?.isFocusReturning,
383
- 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
384
416
  }, () => [
385
- E("div", {
386
- class: $(["omnipad-default-cursor-dot", { "is-down": o(i)?.isPointerDown }])
417
+ T("div", {
418
+ class: w(["omnipad-default-cursor-dot", { "is-down": i(t)?.isPointerDown }])
387
419
  }, null, 2)
388
420
  ], !0)
389
- ], 4)) : Y("", !0),
390
- o(s)?.cursorEnabled ? (R(), S("div", {
421
+ ], 4)) : B("", !0),
422
+ i(r)?.cursorEnabled ? (C(), E("div", {
391
423
  key: 1,
392
424
  class: "omnipad-virtual-cursor",
393
- style: O(k.value)
425
+ style: O(f.value)
394
426
  }, [
395
- b(v.$slots, "with-cursor", {
396
- state: o(i),
397
- isDown: o(i)?.isPointerDown,
398
- isReturning: o(i)?.isFocusReturning,
399
- 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
400
432
  }, void 0, !0)
401
- ], 4)) : Y("", !0),
402
- b(v.$slots, "default", {
403
- state: o(i),
404
- isDown: o(i)?.isPointerDown,
405
- isReturning: o(i)?.isFocusReturning,
406
- 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
407
439
  }, void 0, !0)
408
- ], 46, Xe));
440
+ ], 46, ut));
409
441
  }
410
- }), ot = /* @__PURE__ */ V(tt, [["__scopeId", "data-v-b1782723"]]), nt = { class: "omnipad-button-content-layer" }, it = {
442
+ }), ft = /* @__PURE__ */ U(vt, [["__scopeId", "data-v-8de7c4a4"]]), pt = { class: "omnipad-button-content-layer" }, mt = {
411
443
  key: 0,
412
444
  class: "omnipad-default-button-label"
413
- }, st = /* @__PURE__ */ B({
445
+ }, yt = /* @__PURE__ */ I({
414
446
  __name: "VirtualButtonBase",
415
447
  props: {
416
448
  layout: {},
@@ -418,31 +450,31 @@ const je = ["id"], qe = /* @__PURE__ */ B({
418
450
  label: {}
419
451
  },
420
452
  setup(e) {
421
- const n = e, f = D(() => n.layout ? J(n.layout) : {});
422
- return (c, t) => (R(), S("div", {
453
+ const o = e, u = R(() => o.layout ? Z(o.layout) : {});
454
+ return (s, n) => (C(), E("div", {
423
455
  class: "omnipad-button-base omnipad-prevent",
424
- style: O(f.value),
456
+ style: O(u.value),
425
457
  tabindex: "-1"
426
458
  }, [
427
- b(c.$slots, "base", {
459
+ g(s.$slots, "base", {
428
460
  isActive: e.isActive,
429
461
  label: e.label
430
462
  }, () => [
431
- E("div", {
432
- class: $(["omnipad-default-button-base", { "is-active": e.isActive }])
463
+ T("div", {
464
+ class: w(["omnipad-default-button-base", { "is-active": e.isActive }])
433
465
  }, null, 2)
434
466
  ], !0),
435
- E("div", nt, [
436
- b(c.$slots, "default", {
467
+ T("div", pt, [
468
+ g(s.$slots, "default", {
437
469
  isActive: e.isActive,
438
470
  label: e.label
439
471
  }, () => [
440
- e.label ? (R(), S("span", it, Ve(e.label), 1)) : Y("", !0)
472
+ e.label ? (C(), E("span", mt, We(e.label), 1)) : B("", !0)
441
473
  ], !0)
442
474
  ])
443
475
  ], 4));
444
476
  }
445
- }), ne = /* @__PURE__ */ V(st, [["__scopeId", "data-v-f6a6e082"]]), at = /* @__PURE__ */ B({
477
+ }), G = /* @__PURE__ */ U(yt, [["__scopeId", "data-v-f6a6e082"]]), Pt = /* @__PURE__ */ I({
446
478
  __name: "VirtualButton",
447
479
  props: {
448
480
  treeNode: {},
@@ -452,98 +484,94 @@ const je = ["id"], qe = /* @__PURE__ */ B({
452
484
  mapping: {},
453
485
  layout: {}
454
486
  },
455
- setup(e, { expose: n }) {
456
- const f = e, c = {
487
+ setup(e, { expose: o }) {
488
+ const u = e, s = {
457
489
  label: "BTN"
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);
463
- return n({
464
- uid: t,
465
- onPointerDown: w,
466
- onPointerMove: k,
467
- onPointerUp: C,
468
- onPointerCancel: a,
469
- markRectDirty: () => i.value?.markRectDirty
470
- }), (d, g) => (R(), Z(ne, {
471
- 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),
472
500
  ref_key: "elementRef",
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
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: _
482
510
  }, {
483
- base: I((v) => [
484
- b(d.$slots, "base", U(L(v)))
511
+ base: S((v) => [
512
+ g(c.$slots, "base", N(A(v)))
485
513
  ]),
486
- default: I((v) => [
487
- b(d.$slots, "default", U(L(v)))
514
+ default: S((v) => [
515
+ g(c.$slots, "default", N(A(v)))
488
516
  ]),
489
517
  _: 3
490
518
  }, 8, ["id", "class", "layout", "label", "is-active"]));
491
519
  }
492
- }), rt = { class: "omnipad-axis-bg" }, ct = { class: "omnipad-axis-content-layer" }, lt = /* @__PURE__ */ B({
520
+ }), gt = { class: "omnipad-axis-bg" }, bt = { class: "omnipad-axis-content-layer" }, Ct = /* @__PURE__ */ I({
493
521
  __name: "VirtualAxisBase",
494
522
  props: {
495
523
  layout: {},
496
524
  isActive: { type: Boolean },
497
525
  vector: {},
498
526
  showStick: { type: Boolean },
499
- baseRadius: {}
527
+ baseSize: {}
500
528
  },
501
529
  setup(e) {
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`;
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);
504
532
  return {
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": _,
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,
509
537
  // 松手时加一点回弹过渡,活动时取消过渡保证绝对跟手
510
- transition: n.isActive ? "none" : "transform 0.1s ease-out"
538
+ transition: o.isActive ? "none" : "transform 0.1s ease-out"
511
539
  };
512
540
  });
513
- return (l, P) => (R(), S("div", {
514
- class: $(["omnipad-axis-base omnipad-prevent", { "is-active": e.isActive }]),
515
- style: O(f.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),
516
544
  tabindex: "-1"
517
545
  }, [
518
- E("div", rt, [
519
- b(l.$slots, "base", {
546
+ T("div", gt, [
547
+ g(t.$slots, "base", {
520
548
  isActive: e.isActive,
521
549
  vector: e.vector
522
550
  }, void 0, !0)
523
551
  ]),
524
- e.showStick ? (R(), S("div", {
552
+ e.showStick ? (C(), E("div", {
525
553
  key: 0,
526
554
  class: "omnipad-axis-stick-container",
527
- style: O(t.value)
555
+ style: O(n.value)
528
556
  }, [
529
- b(l.$slots, "stick", {
557
+ g(t.$slots, "stick", {
530
558
  isActive: e.isActive,
531
559
  vector: e.vector
532
560
  }, () => [
533
- E("div", {
534
- class: $(["omnipad-default-axis-stick", { "is-active": e.isActive }])
561
+ T("div", {
562
+ class: w(["omnipad-default-axis-stick", { "is-active": e.isActive }])
535
563
  }, null, 2)
536
564
  ], !0)
537
- ], 4)) : Y("", !0),
538
- E("div", ct, [
539
- b(l.$slots, "default", {
565
+ ], 4)) : B("", !0),
566
+ T("div", bt, [
567
+ g(t.$slots, "default", {
540
568
  isActive: e.isActive,
541
569
  vector: e.vector
542
570
  }, void 0, !0)
543
571
  ])
544
572
  ], 6));
545
573
  }
546
- }), fe = /* @__PURE__ */ V(lt, [["__scopeId", "data-v-6ae17f17"]]), ut = { class: "omnipad-dpad-cross-bg" }, dt = /* @__PURE__ */ B({
574
+ }), de = /* @__PURE__ */ U(Ct, [["__scopeId", "data-v-9eef9626"]]), ht = { class: "omnipad-dpad-cross-bg" }, _t = /* @__PURE__ */ I({
547
575
  __name: "VirtualDPad",
548
576
  props: {
549
577
  treeNode: {},
@@ -554,71 +582,68 @@ const je = ["id"], qe = /* @__PURE__ */ B({
554
582
  showStick: {},
555
583
  layout: {}
556
584
  },
557
- setup(e, { expose: n }) {
558
- const f = e, c = {
585
+ setup(e, { expose: o }) {
586
+ const u = e, s = {
559
587
  showStick: !1,
560
588
  threshold: 0.3
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 });
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 });
568
592
  });
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);
571
- return n({
572
- uid: t,
573
- onPointerDown: a,
574
- onPointerMove: d,
575
- onPointerUp: g,
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,
576
600
  onPointerCancel: v,
577
- markRectDirty: () => i.value?.markRectDirty()
578
- }), (r, N) => (R(), Z(fe, {
601
+ markRectDirty: () => t.value?.markRectDirty()
602
+ }), (l, x) => (C(), z(de, {
603
+ id: i(n),
579
604
  ref_key: "elementRef",
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,
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,
590
615
  onPointercancel: v,
591
616
  onLostpointercapture: v
592
617
  }, {
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 }])
618
+ base: S((y) => [
619
+ g(l.$slots, "base", N(A(y)), () => [
620
+ T("div", ht, [
621
+ T("div", {
622
+ class: w(["dpad-arm top", { on: y.vector && y.vector.y < -i(d)?.threshold }])
598
623
  }, null, 2),
599
- E("div", {
600
- class: $(["dpad-arm bottom", { on: y.vector && y.vector.y > o(p)?.threshold }])
624
+ T("div", {
625
+ class: w(["dpad-arm bottom", { on: y.vector && y.vector.y > i(d)?.threshold }])
601
626
  }, null, 2),
602
- E("div", {
603
- class: $(["dpad-arm left", { on: y.vector && y.vector.x < -o(p)?.threshold }])
627
+ T("div", {
628
+ class: w(["dpad-arm left", { on: y.vector && y.vector.x < -i(d)?.threshold }])
604
629
  }, null, 2),
605
- E("div", {
606
- class: $(["dpad-arm right", { on: y.vector && y.vector.x > o(p)?.threshold }])
630
+ T("div", {
631
+ class: w(["dpad-arm right", { on: y.vector && y.vector.x > i(d)?.threshold }])
607
632
  }, null, 2),
608
- N[0] || (N[0] = E("div", { class: "dpad-center" }, null, -1))
633
+ x[0] || (x[0] = T("div", { class: "dpad-center" }, null, -1))
609
634
  ])
610
635
  ], !0)
611
636
  ]),
612
- stick: I((y) => [
613
- b(r.$slots, "stick", U(L(y)), void 0, !0)
637
+ stick: S((y) => [
638
+ g(l.$slots, "stick", N(A(y)), void 0, !0)
614
639
  ]),
615
- default: I((y) => [
616
- b(r.$slots, "default", U(L(y)), void 0, !0)
640
+ default: S((y) => [
641
+ g(l.$slots, "default", N(A(y)), void 0, !0)
617
642
  ]),
618
643
  _: 3
619
- }, 8, ["class", "layout", "is-active", "vector", "show-stick", "base-radius"]));
644
+ }, 8, ["id", "class", "layout", "is-active", "vector", "show-stick", "base-size"]));
620
645
  }
621
- }), vt = /* @__PURE__ */ V(dt, [["__scopeId", "data-v-8c030849"]]), ft = /* @__PURE__ */ B({
646
+ }), kt = /* @__PURE__ */ U(_t, [["__scopeId", "data-v-2690a0c6"]]), Rt = /* @__PURE__ */ I({
622
647
  __name: "VirtualTrackpad",
623
648
  props: {
624
649
  treeNode: {},
@@ -629,46 +654,44 @@ const je = ["id"], qe = /* @__PURE__ */ B({
629
654
  mapping: {},
630
655
  layout: {}
631
656
  },
632
- setup(e, { expose: n }) {
633
- const f = e, { uid: c, initialConfig: t, reactiveConfig: l } = z(
634
- T.TRACKPAD,
635
- f,
636
- {
637
- label: "TRACKPAD",
638
- sensitivity: 1
639
- }
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);
641
- return n({
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),
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),
650
673
  ref_key: "elementRef",
651
- ref: h,
652
- class: $(["omnipad-trackpad omnipad-prevent", o(s)?.cssClass]),
653
- layout: o(p),
654
- label: o(s)?.label,
655
- "is-active": o(i)?.isPressed,
656
- onPointerdown: _,
657
- onPointermove: w,
658
- onPointerup: k,
659
- onPointercancel: C,
660
- onLostpointercapture: C
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: _
661
684
  }, {
662
- base: I((g) => [
663
- b(a.$slots, "base", U(L(g)), void 0, !0)
685
+ base: S((v) => [
686
+ g(c.$slots, "base", N(A(v)), void 0, !0)
664
687
  ]),
665
- default: I((g) => [
666
- b(a.$slots, "default", U(L(g)), void 0, !0)
688
+ default: S((v) => [
689
+ g(c.$slots, "default", N(A(v)), void 0, !0)
667
690
  ]),
668
691
  _: 3
669
692
  }, 8, ["id", "class", "layout", "label", "is-active"]));
670
693
  }
671
- }), pt = /* @__PURE__ */ V(ft, [["__scopeId", "data-v-bacab613"]]), yt = /* @__PURE__ */ B({
694
+ }), Dt = /* @__PURE__ */ U(Rt, [["__scopeId", "data-v-55cc7ea4"]]), wt = /* @__PURE__ */ I({
672
695
  __name: "VirtualJoystick",
673
696
  props: {
674
697
  treeNode: {},
@@ -681,89 +704,88 @@ const je = ["id"], qe = /* @__PURE__ */ B({
681
704
  mapping: {},
682
705
  layout: {}
683
706
  },
684
- setup(e, { expose: n }) {
685
- const f = e, c = {
707
+ setup(e, { expose: o }) {
708
+ const u = e, s = {
686
709
  label: "PUSH",
687
710
  threshold: 0.2,
688
711
  cursorMode: !1,
689
712
  cursorSensitivity: 1
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 });
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 });
697
718
  });
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);
700
- return n({
701
- uid: t,
702
- onPointerDown: a,
703
- onPointerMove: d,
704
- onPointerUp: g,
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,
705
726
  onPointerCancel: v,
706
- markRectDirty: () => i.value?.markRectDirty
707
- }), (r, N) => (R(), Z(fe, {
727
+ markRectDirty: () => t.value?.markRectDirty
728
+ }), (l, x) => (C(), z(de, {
729
+ id: i(n),
708
730
  ref_key: "elementRef",
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,
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,
714
736
  "show-stick": "",
715
- "base-radius": k.value,
716
- onPointerdown: a,
717
- onPointermove: d,
718
- onPointerup: g,
737
+ "base-size": f.value,
738
+ onPointerdown: _,
739
+ onPointermove: c,
740
+ onPointerup: D,
719
741
  onPointercancel: v,
720
742
  onLostpointercapture: v
721
743
  }, {
722
- base: I((y) => [
723
- b(r.$slots, "base", U(L(y)), void 0, !0)
744
+ base: S((y) => [
745
+ g(l.$slots, "base", N(A(y)), void 0, !0)
724
746
  ]),
725
- stick: I(() => [
726
- X(ne, {
747
+ stick: S(() => [
748
+ F(G, {
727
749
  layout: { height: "100%", width: "100%" },
728
- "is-active": o(u)?.isPressed,
729
- label: o(p)?.label
750
+ "is-active": i(a)?.isPressed,
751
+ label: i(d)?.label
730
752
  }, {
731
- base: I((y) => [
732
- b(r.$slots, "stick-base", U(L(y)), void 0, !0)
753
+ base: S((y) => [
754
+ g(l.$slots, "stick-base", N(A(y)), void 0, !0)
733
755
  ]),
734
- default: I((y) => [
735
- b(r.$slots, "stick", U(L(y)), void 0, !0)
756
+ default: S((y) => [
757
+ g(l.$slots, "stick", N(A(y)), void 0, !0)
736
758
  ]),
737
759
  _: 3
738
760
  }, 8, ["is-active", "label"])
739
761
  ]),
740
- default: I((y) => [
741
- b(r.$slots, "default", U(L(y)), void 0, !0)
762
+ default: S((y) => [
763
+ g(l.$slots, "default", N(A(y)), void 0, !0)
742
764
  ]),
743
765
  _: 3
744
- }, 8, ["class", "layout", "is-active", "vector", "base-radius"]));
766
+ }, 8, ["id", "class", "layout", "is-active", "vector", "base-size"]));
745
767
  }
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);
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);
756
778
  });
757
779
  export {
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
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
769
791
  };