@omnipad/vue 0.1.1-alpha.1 → 0.2.0-alpha.2
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.
- package/dist/index.d.ts +202 -7
- package/dist/omnipad-vue.css +1 -1
- package/dist/omnipad-vue.mjs +285 -188
- package/dist/omnipad-vue.umd.js +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { ComponentProvideOptions } from 'vue';
|
|
|
9
9
|
import { ComponentPublicInstance } from 'vue';
|
|
10
10
|
import { ComputedRef } from 'vue';
|
|
11
11
|
import { ConfigTreeNode } from '@omnipad/core';
|
|
12
|
+
import { CursorState } from '@omnipad/core';
|
|
12
13
|
import { DebuggerEvent } from 'vue';
|
|
13
14
|
import { DefineComponent } from 'vue';
|
|
14
15
|
import { GlobalComponents } from 'vue';
|
|
@@ -20,6 +21,7 @@ import { OnCleanup } from '@vue/reactivity';
|
|
|
20
21
|
import { PublicProps } from 'vue';
|
|
21
22
|
import { ShallowUnwrapRef } from 'vue';
|
|
22
23
|
import { Slot } from 'vue';
|
|
24
|
+
import { Vec2 } from '@omnipad/core';
|
|
23
25
|
import { VNodeProps } from 'vue';
|
|
24
26
|
import { WatchOptions } from 'vue';
|
|
25
27
|
import { WatchStopHandle } from 'vue';
|
|
@@ -32,6 +34,10 @@ declare const __VLS_component_2: DefineComponent<__VLS_Props, {}, {}, {}, {}, Co
|
|
|
32
34
|
elementRef: HTMLDivElement;
|
|
33
35
|
}, HTMLDivElement>;
|
|
34
36
|
|
|
37
|
+
declare const __VLS_component_3: DefineComponent<TargetZoneProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<TargetZoneProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
38
|
+
elementRef: HTMLDivElement;
|
|
39
|
+
}, HTMLDivElement>;
|
|
40
|
+
|
|
35
41
|
declare type __VLS_Props = {
|
|
36
42
|
/** The runtime tree node for auto-configuration. */
|
|
37
43
|
treeNode?: ConfigTreeNode;
|
|
@@ -61,10 +67,32 @@ declare function __VLS_template_2(): {
|
|
|
61
67
|
rootEl: HTMLDivElement;
|
|
62
68
|
};
|
|
63
69
|
|
|
70
|
+
declare function __VLS_template_3(): {
|
|
71
|
+
attrs: Partial<{}>;
|
|
72
|
+
slots: {
|
|
73
|
+
'focus-feedback'?(_: {
|
|
74
|
+
state: CursorState | undefined;
|
|
75
|
+
isReturning: boolean | undefined;
|
|
76
|
+
cursorPos: Vec2 | undefined;
|
|
77
|
+
}): any;
|
|
78
|
+
cursor?(_: {
|
|
79
|
+
state: CursorState | undefined;
|
|
80
|
+
isDown: boolean | undefined;
|
|
81
|
+
cursorPos: Vec2 | undefined;
|
|
82
|
+
}): any;
|
|
83
|
+
};
|
|
84
|
+
refs: {
|
|
85
|
+
elementRef: HTMLDivElement;
|
|
86
|
+
};
|
|
87
|
+
rootEl: HTMLDivElement;
|
|
88
|
+
};
|
|
89
|
+
|
|
64
90
|
declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
65
91
|
|
|
66
92
|
declare type __VLS_TemplateResult_2 = ReturnType<typeof __VLS_template_2>;
|
|
67
93
|
|
|
94
|
+
declare type __VLS_TemplateResult_3 = ReturnType<typeof __VLS_template_3>;
|
|
95
|
+
|
|
68
96
|
declare type __VLS_WithTemplateSlots<T, S> = T & {
|
|
69
97
|
new (): {
|
|
70
98
|
$slots: S;
|
|
@@ -77,6 +105,12 @@ declare type __VLS_WithTemplateSlots_2<T, S> = T & {
|
|
|
77
105
|
};
|
|
78
106
|
};
|
|
79
107
|
|
|
108
|
+
declare type __VLS_WithTemplateSlots_3<T, S> = T & {
|
|
109
|
+
new (): {
|
|
110
|
+
$slots: S;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
|
|
80
114
|
export declare const InputZone: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
81
115
|
|
|
82
116
|
declare interface InputZoneProps {
|
|
@@ -97,9 +131,7 @@ export declare function registerComponent(type: string, component: Component): v
|
|
|
97
131
|
|
|
98
132
|
export declare const RootLayer: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
|
|
99
133
|
|
|
100
|
-
export declare const TargetZone:
|
|
101
|
-
elementRef: HTMLDivElement;
|
|
102
|
-
}, HTMLDivElement>;
|
|
134
|
+
export declare const TargetZone: __VLS_WithTemplateSlots_3<typeof __VLS_component_3, __VLS_TemplateResult_3["slots"]>;
|
|
103
135
|
|
|
104
136
|
declare interface TargetZoneProps {
|
|
105
137
|
/** The runtime tree node for automatic setup. */
|
|
@@ -114,11 +146,12 @@ declare interface TargetZoneProps {
|
|
|
114
146
|
layout?: LayoutBox;
|
|
115
147
|
}
|
|
116
148
|
|
|
117
|
-
export declare const VirtualKeyboardButton: DefineComponent<
|
|
149
|
+
export declare const VirtualKeyboardButton: DefineComponent<VirtualKeyButtonProps, {
|
|
118
150
|
uid: ComputedRef<any>;
|
|
119
151
|
onPointerDown: (e: PointerEvent) => void | undefined;
|
|
120
152
|
onPointerUp: (e: PointerEvent) => void | undefined;
|
|
121
|
-
|
|
153
|
+
onPointerCancel: (e: PointerEvent) => void | undefined;
|
|
154
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<VirtualKeyButtonProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
122
155
|
elementRef: ({
|
|
123
156
|
$: ComponentInternalInstance;
|
|
124
157
|
$data: {};
|
|
@@ -176,10 +209,10 @@ default?(_: {}): any;
|
|
|
176
209
|
}) | null;
|
|
177
210
|
}, HTMLDivElement>;
|
|
178
211
|
|
|
179
|
-
declare interface
|
|
212
|
+
declare interface VirtualKeyButtonProps {
|
|
180
213
|
/** The runtime tree node for automatic setup. */
|
|
181
214
|
treeNode?: ConfigTreeNode;
|
|
182
|
-
/** Unique configuration ID (CID) for this
|
|
215
|
+
/** Unique configuration ID (CID) for this button. Used for profile serialization. */
|
|
183
216
|
widgetId?: string;
|
|
184
217
|
/** The text or symbol displayed on the button surface. */
|
|
185
218
|
label?: string;
|
|
@@ -194,4 +227,166 @@ declare interface VirtualKeyButtonButtonProps {
|
|
|
194
227
|
layout?: LayoutBox;
|
|
195
228
|
}
|
|
196
229
|
|
|
230
|
+
export declare const VirtualMouseButton: DefineComponent<VirtualMouseButtonProps, {
|
|
231
|
+
uid: ComputedRef<any>;
|
|
232
|
+
onPointerDown: (e: PointerEvent) => void | undefined;
|
|
233
|
+
onPointerUp: (e: PointerEvent) => void | undefined;
|
|
234
|
+
onPointerCancel: (e: PointerEvent) => void | undefined;
|
|
235
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<VirtualMouseButtonProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
236
|
+
elementRef: ({
|
|
237
|
+
$: ComponentInternalInstance;
|
|
238
|
+
$data: {};
|
|
239
|
+
$props: {
|
|
240
|
+
readonly layout?: LayoutBox | undefined;
|
|
241
|
+
readonly isActive?: boolean | undefined;
|
|
242
|
+
readonly label?: string | undefined;
|
|
243
|
+
} & VNodeProps & AllowedComponentProps & ComponentCustomProps;
|
|
244
|
+
$attrs: {
|
|
245
|
+
[x: string]: unknown;
|
|
246
|
+
};
|
|
247
|
+
$refs: {
|
|
248
|
+
[x: string]: unknown;
|
|
249
|
+
};
|
|
250
|
+
$slots: Readonly<{
|
|
251
|
+
[name: string]: Slot<any> | undefined;
|
|
252
|
+
}>;
|
|
253
|
+
$root: ComponentPublicInstance | null;
|
|
254
|
+
$parent: ComponentPublicInstance | null;
|
|
255
|
+
$host: Element | null;
|
|
256
|
+
$emit: (event: string, ...args: any[]) => void;
|
|
257
|
+
$el: HTMLDivElement;
|
|
258
|
+
$options: ComponentOptionsBase<Readonly<{
|
|
259
|
+
layout?: LayoutBox;
|
|
260
|
+
isActive?: boolean;
|
|
261
|
+
label?: string;
|
|
262
|
+
}> & Readonly<{}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {}, {}, string, {}, GlobalComponents, GlobalDirectives, string, ComponentProvideOptions> & {
|
|
263
|
+
beforeCreate?: (() => void) | (() => void)[];
|
|
264
|
+
created?: (() => void) | (() => void)[];
|
|
265
|
+
beforeMount?: (() => void) | (() => void)[];
|
|
266
|
+
mounted?: (() => void) | (() => void)[];
|
|
267
|
+
beforeUpdate?: (() => void) | (() => void)[];
|
|
268
|
+
updated?: (() => void) | (() => void)[];
|
|
269
|
+
activated?: (() => void) | (() => void)[];
|
|
270
|
+
deactivated?: (() => void) | (() => void)[];
|
|
271
|
+
beforeDestroy?: (() => void) | (() => void)[];
|
|
272
|
+
beforeUnmount?: (() => void) | (() => void)[];
|
|
273
|
+
destroyed?: (() => void) | (() => void)[];
|
|
274
|
+
unmounted?: (() => void) | (() => void)[];
|
|
275
|
+
renderTracked?: ((e: DebuggerEvent) => void) | ((e: DebuggerEvent) => void)[];
|
|
276
|
+
renderTriggered?: ((e: DebuggerEvent) => void) | ((e: DebuggerEvent) => void)[];
|
|
277
|
+
errorCaptured?: ((err: unknown, instance: ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
278
|
+
};
|
|
279
|
+
$forceUpdate: () => void;
|
|
280
|
+
$nextTick: nextTick;
|
|
281
|
+
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, OnCleanup]) => any : (...args: [any, any, OnCleanup]) => any, options?: WatchOptions): WatchStopHandle;
|
|
282
|
+
} & Readonly<{}> & Omit<Readonly<{
|
|
283
|
+
layout?: LayoutBox;
|
|
284
|
+
isActive?: boolean;
|
|
285
|
+
label?: string;
|
|
286
|
+
}> & Readonly<{}>, never> & ShallowUnwrapRef< {}> & {} & ComponentCustomProperties & {} & {
|
|
287
|
+
$slots: {
|
|
288
|
+
default?(_: {}): any;
|
|
289
|
+
};
|
|
290
|
+
}) | null;
|
|
291
|
+
}, HTMLDivElement>;
|
|
292
|
+
|
|
293
|
+
declare interface VirtualMouseButtonProps {
|
|
294
|
+
/** The runtime tree node for automatic setup. */
|
|
295
|
+
treeNode?: ConfigTreeNode;
|
|
296
|
+
/** Unique configuration ID (CID) for this button. Used for profile serialization. */
|
|
297
|
+
widgetId?: string;
|
|
298
|
+
/** The text or symbol displayed on the button surface. */
|
|
299
|
+
label?: string;
|
|
300
|
+
/** The ID (CID) of the TargetZone this button sends signals to. */
|
|
301
|
+
targetStageId?: string;
|
|
302
|
+
/** 0: Left, 1: Middle, 2: Right */
|
|
303
|
+
button?: 0 | 1 | 2;
|
|
304
|
+
/**
|
|
305
|
+
* Fixed coordinate to click on (0-100 percentage).
|
|
306
|
+
* Example: { x: 95, y: 5 } for a pause button in the corner.
|
|
307
|
+
*/
|
|
308
|
+
fixedPoint?: Vec2;
|
|
309
|
+
/** Spatial layout configuration relative to its parent zone. */
|
|
310
|
+
layout?: LayoutBox;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
export declare const VirtualTrackpad: DefineComponent<VirtualTrackpadProps, {
|
|
314
|
+
uid: ComputedRef<any>;
|
|
315
|
+
onPointerDown: (e: PointerEvent) => void | undefined;
|
|
316
|
+
onPointerMove: (e: PointerEvent) => void | undefined;
|
|
317
|
+
onPointerUp: (e: PointerEvent) => void | undefined;
|
|
318
|
+
onPointerCancel: (e: PointerEvent) => void | undefined;
|
|
319
|
+
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<VirtualTrackpadProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
320
|
+
elementRef: ({
|
|
321
|
+
$: ComponentInternalInstance;
|
|
322
|
+
$data: {};
|
|
323
|
+
$props: {
|
|
324
|
+
readonly layout?: LayoutBox | undefined;
|
|
325
|
+
readonly isActive?: boolean | undefined;
|
|
326
|
+
readonly label?: string | undefined;
|
|
327
|
+
} & VNodeProps & AllowedComponentProps & ComponentCustomProps;
|
|
328
|
+
$attrs: {
|
|
329
|
+
[x: string]: unknown;
|
|
330
|
+
};
|
|
331
|
+
$refs: {
|
|
332
|
+
[x: string]: unknown;
|
|
333
|
+
};
|
|
334
|
+
$slots: Readonly<{
|
|
335
|
+
[name: string]: Slot<any> | undefined;
|
|
336
|
+
}>;
|
|
337
|
+
$root: ComponentPublicInstance | null;
|
|
338
|
+
$parent: ComponentPublicInstance | null;
|
|
339
|
+
$host: Element | null;
|
|
340
|
+
$emit: (event: string, ...args: any[]) => void;
|
|
341
|
+
$el: HTMLDivElement;
|
|
342
|
+
$options: ComponentOptionsBase<Readonly<{
|
|
343
|
+
layout?: LayoutBox;
|
|
344
|
+
isActive?: boolean;
|
|
345
|
+
label?: string;
|
|
346
|
+
}> & Readonly<{}>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {}, {}, string, {}, GlobalComponents, GlobalDirectives, string, ComponentProvideOptions> & {
|
|
347
|
+
beforeCreate?: (() => void) | (() => void)[];
|
|
348
|
+
created?: (() => void) | (() => void)[];
|
|
349
|
+
beforeMount?: (() => void) | (() => void)[];
|
|
350
|
+
mounted?: (() => void) | (() => void)[];
|
|
351
|
+
beforeUpdate?: (() => void) | (() => void)[];
|
|
352
|
+
updated?: (() => void) | (() => void)[];
|
|
353
|
+
activated?: (() => void) | (() => void)[];
|
|
354
|
+
deactivated?: (() => void) | (() => void)[];
|
|
355
|
+
beforeDestroy?: (() => void) | (() => void)[];
|
|
356
|
+
beforeUnmount?: (() => void) | (() => void)[];
|
|
357
|
+
destroyed?: (() => void) | (() => void)[];
|
|
358
|
+
unmounted?: (() => void) | (() => void)[];
|
|
359
|
+
renderTracked?: ((e: DebuggerEvent) => void) | ((e: DebuggerEvent) => void)[];
|
|
360
|
+
renderTriggered?: ((e: DebuggerEvent) => void) | ((e: DebuggerEvent) => void)[];
|
|
361
|
+
errorCaptured?: ((err: unknown, instance: ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: ComponentPublicInstance | null, info: string) => boolean | void)[];
|
|
362
|
+
};
|
|
363
|
+
$forceUpdate: () => void;
|
|
364
|
+
$nextTick: nextTick;
|
|
365
|
+
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, OnCleanup]) => any : (...args: [any, any, OnCleanup]) => any, options?: WatchOptions): WatchStopHandle;
|
|
366
|
+
} & Readonly<{}> & Omit<Readonly<{
|
|
367
|
+
layout?: LayoutBox;
|
|
368
|
+
isActive?: boolean;
|
|
369
|
+
label?: string;
|
|
370
|
+
}> & Readonly<{}>, never> & ShallowUnwrapRef< {}> & {} & ComponentCustomProperties & {} & {
|
|
371
|
+
$slots: {
|
|
372
|
+
default?(_: {}): any;
|
|
373
|
+
};
|
|
374
|
+
}) | null;
|
|
375
|
+
}, HTMLDivElement>;
|
|
376
|
+
|
|
377
|
+
declare interface VirtualTrackpadProps {
|
|
378
|
+
/** The runtime tree node for automatic setup. */
|
|
379
|
+
treeNode?: ConfigTreeNode;
|
|
380
|
+
/** Unique configuration ID (CID) for this trackpad. Used for profile serialization. */
|
|
381
|
+
widgetId?: string;
|
|
382
|
+
/** The text or symbol displayed on the trackpad surface. */
|
|
383
|
+
label?: string;
|
|
384
|
+
/** Determines the mapping ratio between the physical displacement of the trackpad and the movement of the screen cursor. */
|
|
385
|
+
sensitivity?: number;
|
|
386
|
+
/** The ID (CID) of the TargetZone this trackpad sends signals to. */
|
|
387
|
+
targetStageId?: string;
|
|
388
|
+
/** Spatial layout configuration relative to its parent zone. */
|
|
389
|
+
layout?: LayoutBox;
|
|
390
|
+
}
|
|
391
|
+
|
|
197
392
|
export { }
|
package/dist/omnipad-vue.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--omnipad-btn-bg: rgba(255, 255, 255, .2);--omnipad-btn-border-color: rgba(255, 255, 255, .4);--omnipad-btn-border-width: 2px;--omnipad-btn-border-style: solid;--omnipad-btn-radius: 8px;--omnipad-btn-label-color: #ffffff;--omnipad-btn-font-family: "Upheaval", "monacoregular", sans-serif;--omnipad-btn-font-size: 18px;--omnipad-btn-font-weight: bold;--omnipad-btn-pressed-bg: rgba(255, 186, 67, .6);--omnipad-btn-pressed-border-color: #ffba43;--omnipad-btn-pressed-scale: .92;--omnipad-btn-pressed-opacity: 1;--omnipad-btn-transition-duration: .1s;--omnipad-btn-transition-timing: ease-out}.omnipad-button-base{background:var(--omnipad-btn-bg);border:var(--omnipad-btn-border-width) var(--omnipad-btn-border-style) var(--omnipad-btn-border-color);border-radius:var(--omnipad-btn-radius);display:flex;align-items:center;justify-content:center;transition:all var(--omnipad-btn-transition-duration) var(--omnipad-btn-transition-timing)}.omnipad-button-label-hollow{font-family:var(--omnipad-btn-font-family);font-size:var(--omnipad-btn-font-size);color:var(--omnipad-btn-label-color);font-weight:var(--omnipad-btn-font-weight);background:inherit;-webkit-background-clip:text;background-clip:text;color:transparent;filter:invert(1) grayscale(1) contrast(9);mix-blend-mode:destination-out}.omnipad-prevent{touch-action:none;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent}.omnipad-virtual-layer-base[data-v-6f1860f6]{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:1000}[data-v-6f1860f6] .omnipad-input-zone,[data-v-6f1860f6] .omnipad-button{pointer-events:auto}.omnipad-input-zone[data-v-
|
|
1
|
+
:root{--omnipad-btn-bg: rgba(255, 255, 255, .2);--omnipad-btn-border-color: rgba(255, 255, 255, .4);--omnipad-btn-border-width: 2px;--omnipad-btn-border-style: solid;--omnipad-btn-radius: 8px;--omnipad-btn-label-color: #ffffff;--omnipad-btn-font-family: "Upheaval", "monacoregular", sans-serif;--omnipad-btn-font-size: 18px;--omnipad-btn-font-weight: bold;--omnipad-btn-pressed-bg: rgba(255, 186, 67, .6);--omnipad-btn-pressed-border-color: #ffba43;--omnipad-btn-pressed-scale: .92;--omnipad-btn-pressed-opacity: 1;--omnipad-btn-transition-duration: .1s;--omnipad-btn-transition-timing: ease-out;--omnipad-default-cursor-height: 20px;--omnipad-default-cursor-width: 20px;--omnipad-default-cursor-transition: var(--omnipad-default-cursor-transition-mode) var(--omnipad-default-cursor-transition-time);--omnipad-default-cursor-transition-mode: opacity;--omnipad-default-cursor-transition-time: .2s;--omnipad-default-cursor-dot-background: #ff000080;--omnipad-default-cursor-dot-border-color: #ffffff;--omnipad-default-cursor-dot-border-radius: 50%;--omnipad-default-cursor-dot-border-style: solid;--omnipad-default-cursor-dot-border-width: 2px;--omnipad-default-cursor-dot-down-background: #ff0000;--omnipad-default-cursor-dot-down-scale: .8;--omnipad-focus-color: rgba(100, 200, 255, .8);--omnipad-focus-bg-color: rgba(100, 200, 255, .05);--omnipad-trackpad-bg: rgba(255, 255, 255, .05);--omnipad-trackpad-border-style: dashed;--omnipad-trackpad-cursor: crosshair}.omnipad-button-base{background:var(--omnipad-btn-bg);border:var(--omnipad-btn-border-width) var(--omnipad-btn-border-style) var(--omnipad-btn-border-color);border-radius:var(--omnipad-btn-radius);display:flex;align-items:center;justify-content:center;transition:all var(--omnipad-btn-transition-duration) var(--omnipad-btn-transition-timing)}.omnipad-button-label-hollow{font-family:var(--omnipad-btn-font-family);font-size:var(--omnipad-btn-font-size);color:var(--omnipad-btn-label-color);font-weight:var(--omnipad-btn-font-weight);background:inherit;-webkit-background-clip:text;background-clip:text;color:transparent;filter:invert(1) grayscale(1) contrast(9);mix-blend-mode:destination-out}.omnipad-default-cursor-dot{width:100%;height:100%;border-width:var(--omnipad-default-cursor-dot-border-width);border-style:var(--omnipad-default-cursor-dot-border-style);border-color:var(--omnipad-default-cursor-dot-border-color);border-radius:var(--omnipad-default-cursor-dot-border-radius);background:var(--omnipad-default-cursor-dot-background)}.omnipad-default-cursor-dot.is-down{transform:scale(var(--omnipad-default-cursor-dot-down-scale));background:var(--omnipad-default-cursor-dot-down-background)}.omnipad-default-focus-border-feedback{position:absolute;inset:0;pointer-events:none;z-index:5;border:2px solid var(--omnipad-focus-color);background-color:var(--omnipad-focus-bg-color);box-shadow:inset 0 0 10px var(--omnipad-focus-color);box-sizing:border-box}.omnipad-default-focus-fade-enter-active{transition:opacity .05s ease-in}.omnipad-default-focus-fade-leave-active{transition:opacity .2s ease-out}.omnipad-default-focus-fade-enter-from,.omnipad-default-focus-fade-leave-to{opacity:0}.omnipad-prevent{touch-action:none;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent}.omnipad-trackpad:before{content:"";position:absolute;inset:10px;background-image:radial-gradient(rgba(255,255,255,.1) 1px,transparent 1px);background-size:20px 20px;pointer-events:none}.omnipad-virtual-layer-base[data-v-6f1860f6]{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:1000}[data-v-6f1860f6] .omnipad-input-zone,[data-v-6f1860f6] .omnipad-button{pointer-events:auto}.omnipad-input-zone[data-v-e0c28ebd]{position:absolute;pointer-events:none;-webkit-user-select:none;user-select:none;touch-action:none}.omnipad-input-zone-trigger[data-v-e0c28ebd]{position:absolute;inset:0;pointer-events:auto;background:transparent;touch-action:none}.dynamic-widget-mount[data-v-e0c28ebd]{pointer-events:none}.omnipad-virtual-layer[data-v-9e46ef9c]{position:relative;height:100%;width:100%;pointer-events:none}.omnipad-target-zone[data-v-70b706ac]{-webkit-user-select:none;user-select:none;touch-action:none;pointer-events:auto;overflow:hidden}.omnipad-virtual-cursor[data-v-70b706ac]{position:absolute;width:var(--omnipad-default-cursor-width);height:var(--omnipad-default-cursor-height);transform:translate(-50%,-50%);pointer-events:none;transition:var(--omnipad-default-cursor-transition);z-index:10}.omnipad-button-base[data-v-3db6d4f9]{-webkit-user-select:none;user-select:none;touch-action:none;overflow:hidden;box-sizing:border-box;pointer-events:auto}.omnipad-button-base.is-active[data-v-3db6d4f9]{background:var(--omnipad-btn-pressed-bg);border-color:var(--omnipad-btn-pressed-border-color);opacity:var(--omnipad-btn-pressed-opacity);filter:brightness(1.2)}.omnipad-button-label[data-v-3db6d4f9]{font-family:var(--omnipad-btn-font-family);font-size:var(--omnipad-btn-font-size);color:var(--omnipad-btn-label-color);font-weight:var(--omnipad-btn-font-weight)}.omnipad-trackpad[data-v-c28e3a2e]{-webkit-user-select:none;user-select:none;touch-action:none;overflow:hidden;--omnipad-btn-border-style: var(--omnipad-trackpad-border-style);--omnipad-btn-bg: var(--omnipad-trackpad-bg);cursor:var(--omnipad-trackpad-cursor)}
|
package/dist/omnipad-vue.mjs
CHANGED
|
@@ -1,85 +1,81 @@
|
|
|
1
|
-
import { Registry as
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
|
|
1
|
+
import { Registry as G, CONTEXT as K, generateUID as X, CMP_TYPES as P, resolveLayoutStyle as S, InputZoneCore as H, RootLayerCore as J, TargetZoneCore as Q, KeyboardButtonCore as q, MouseButtonCore as ee, TrackpadCore as te } from "@omnipad/core";
|
|
2
|
+
import { defineComponent as b, h as oe, shallowRef as ne, ref as O, onMounted as ae, onUnmounted as ie, openBlock as p, createElementBlock as g, Fragment as re, renderList as le, createBlock as T, resolveDynamicComponent as A, unref as l, renderSlot as I, inject as se, computed as _, provide as ue, useSlots as ce, watch as de, nextTick as ve, normalizeStyle as $, createVNode as x, withCtx as V, createElementVNode as Y, createCommentVNode as B, Transition as pe, normalizeClass as z, toDisplayString as fe } from "vue";
|
|
3
|
+
const F = {};
|
|
4
|
+
function N(n, o) {
|
|
5
|
+
F[n] = o;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
const
|
|
9
|
-
return
|
|
10
|
-
render: () =>
|
|
7
|
+
function W(n) {
|
|
8
|
+
const o = F[n];
|
|
9
|
+
return o || b({
|
|
10
|
+
render: () => oe("div", { style: "color:red" }, `[Unknown: ${n}]`)
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
const
|
|
15
|
-
|
|
13
|
+
function D(n) {
|
|
14
|
+
const o = ne(), s = O(), e = O(null), i = (a) => {
|
|
15
|
+
s.value = a;
|
|
16
16
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
t
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
o.updateRect(v.target.getBoundingClientRect());
|
|
25
|
-
}), i.observe(l), o.updateRect(l.getBoundingClientRect()));
|
|
26
|
-
}), te(() => {
|
|
27
|
-
i && i.disconnect(), t.value && t.value.destroy();
|
|
17
|
+
return ae(() => {
|
|
18
|
+
const a = n();
|
|
19
|
+
o.value = a, G.getInstance().register(a), "subscribe" in a && a.subscribe(i);
|
|
20
|
+
let t = null;
|
|
21
|
+
e.value && (e.value instanceof Element ? t = e.value : e.value.$el instanceof Element && (t = e.value.$el)), t && "bindRectProvider" in a && a.bindRectProvider(() => t.getBoundingClientRect());
|
|
22
|
+
}), ie(() => {
|
|
23
|
+
o.value && o.value.destroy();
|
|
28
24
|
}), {
|
|
29
|
-
core:
|
|
30
|
-
state:
|
|
25
|
+
core: o,
|
|
26
|
+
state: s,
|
|
31
27
|
elementRef: e
|
|
32
28
|
};
|
|
33
29
|
}
|
|
34
|
-
const
|
|
30
|
+
const me = { class: "omnipad-virtual-layer-base omnipad-prevent" }, ye = /* @__PURE__ */ b({
|
|
35
31
|
__name: "VirtualLayerBase",
|
|
36
32
|
props: {
|
|
37
33
|
nodes: {}
|
|
38
34
|
},
|
|
39
35
|
setup(n) {
|
|
40
|
-
return (
|
|
41
|
-
(
|
|
36
|
+
return (o, s) => (p(), g("div", me, [
|
|
37
|
+
(p(!0), g(re, null, le(n.nodes || [], (e) => (p(), T(A(l(W)(e.type)), {
|
|
42
38
|
key: e.uid,
|
|
43
39
|
"tree-node": e
|
|
44
40
|
}, null, 8, ["tree-node"]))), 128)),
|
|
45
|
-
|
|
41
|
+
I(o.$slots, "default", {}, void 0, !0)
|
|
46
42
|
]));
|
|
47
43
|
}
|
|
48
|
-
}),
|
|
49
|
-
const
|
|
50
|
-
for (const [e,
|
|
51
|
-
|
|
52
|
-
return
|
|
53
|
-
},
|
|
54
|
-
function
|
|
55
|
-
const e =
|
|
44
|
+
}), h = (n, o) => {
|
|
45
|
+
const s = n.__vccOpts || n;
|
|
46
|
+
for (const [e, i] of o)
|
|
47
|
+
s[e] = i;
|
|
48
|
+
return s;
|
|
49
|
+
}, j = /* @__PURE__ */ h(ye, [["__scopeId", "data-v-6f1860f6"]]);
|
|
50
|
+
function E(n, o, s = {}) {
|
|
51
|
+
const e = o.treeNode, i = e && e.type === n ? e : void 0;
|
|
56
52
|
e && e.type !== n && console.warn(
|
|
57
53
|
`[OmniPad-Validation] Type mismatch! Component expected "${n}", but received "${e.type}". Config ignored.`
|
|
58
54
|
);
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
Object.entries(
|
|
55
|
+
const a = se(K.PARENT_ID_KEY, O(void 0)), t = _(() => o.parentId || i?.config?.parentId || a.value), d = _(() => o.widgetId || i?.uid || X(n));
|
|
56
|
+
ue(K.PARENT_ID_KEY, d);
|
|
57
|
+
const m = _(() => {
|
|
58
|
+
const f = i?.config || {}, u = Object.fromEntries(
|
|
59
|
+
Object.entries(o).filter(([v, r]) => r !== void 0 && v !== "treeNode" && v !== "widgetId")
|
|
64
60
|
);
|
|
65
61
|
return {
|
|
66
|
-
...
|
|
67
|
-
...
|
|
68
|
-
...
|
|
69
|
-
id:
|
|
62
|
+
...s,
|
|
63
|
+
...f,
|
|
64
|
+
...u,
|
|
65
|
+
id: d.value,
|
|
70
66
|
type: n,
|
|
71
|
-
parentId:
|
|
67
|
+
parentId: t.value,
|
|
72
68
|
// 特殊处理 Layout:深度合并,确保即便只传了 { width: 100 } 也不丢失原来的 left/top
|
|
73
69
|
layout: {
|
|
74
|
-
...
|
|
75
|
-
...
|
|
76
|
-
...
|
|
70
|
+
...s.layout || {},
|
|
71
|
+
...f.layout || {},
|
|
72
|
+
...u.layout || {}
|
|
77
73
|
}
|
|
78
74
|
};
|
|
79
75
|
});
|
|
80
|
-
return { uid:
|
|
76
|
+
return { uid: d, config: m };
|
|
81
77
|
}
|
|
82
|
-
const
|
|
78
|
+
const Pe = ["id"], _e = /* @__PURE__ */ b({
|
|
83
79
|
__name: "InputZone",
|
|
84
80
|
props: {
|
|
85
81
|
treeNode: {},
|
|
@@ -88,112 +84,116 @@ const fe = ["id"], pe = /* @__PURE__ */ g({
|
|
|
88
84
|
preventFocusLoss: {}
|
|
89
85
|
},
|
|
90
86
|
setup(n) {
|
|
91
|
-
const
|
|
92
|
-
() => new
|
|
93
|
-
),
|
|
94
|
-
const
|
|
95
|
-
return
|
|
96
|
-
}),
|
|
97
|
-
const
|
|
98
|
-
(
|
|
99
|
-
),
|
|
100
|
-
return
|
|
101
|
-
`[OmniPad-Validation] InputZone ${
|
|
102
|
-
),
|
|
103
|
-
`[OmniPad-Validation] InputZone ${
|
|
87
|
+
const o = n, s = ce(), e = O(null), { uid: i, config: a } = E(P.INPUT_ZONE, o), { core: t, state: d, elementRef: m } = D(
|
|
88
|
+
() => new H(i.value, a.value)
|
|
89
|
+
), f = _(() => {
|
|
90
|
+
const c = o.treeNode?.config?.dynamicWidgetId;
|
|
91
|
+
return o.treeNode?.children?.filter((w) => w.uid !== c) || [];
|
|
92
|
+
}), u = _(() => {
|
|
93
|
+
const w = (s.dynamicWidget?.() || []).filter((k) => !(k.type === Comment || k.type === Text)), C = o.treeNode?.children?.find(
|
|
94
|
+
(k) => k.uid === o.treeNode?.config?.dynamicWidgetId
|
|
95
|
+
), U = w.length > 0;
|
|
96
|
+
return w.length > 1 && console.error(
|
|
97
|
+
`[OmniPad-Validation] InputZone ${i.value} has multiple dynamic widgets in slot. Only the first one will be activated.`
|
|
98
|
+
), U && C && console.warn(
|
|
99
|
+
`[OmniPad-Validation] InputZone ${i.value} has both Slot and Config dynamic widgets. Config ignored.`
|
|
104
100
|
), {
|
|
105
|
-
nodeToRender:
|
|
106
|
-
isFromSlot:
|
|
101
|
+
nodeToRender: U ? w[0] : C || null,
|
|
102
|
+
isFromSlot: U
|
|
107
103
|
};
|
|
108
104
|
});
|
|
109
|
-
|
|
105
|
+
de(
|
|
110
106
|
e,
|
|
111
|
-
(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
dynamicWidgetId:
|
|
107
|
+
(c) => {
|
|
108
|
+
ve(() => {
|
|
109
|
+
c && c?.uid && t.value?.updateConfig({
|
|
110
|
+
dynamicWidgetId: c.uid
|
|
115
111
|
});
|
|
116
112
|
});
|
|
117
113
|
},
|
|
118
114
|
{ immediate: !0 }
|
|
119
115
|
);
|
|
120
|
-
const
|
|
116
|
+
const v = _(() => S(a.value.layout)), r = _(() => d.value?.isDynamicActive ? {
|
|
121
117
|
position: "absolute",
|
|
122
|
-
left: `${
|
|
123
|
-
top: `${
|
|
118
|
+
left: `${d.value.dynamicPosition.x}%`,
|
|
119
|
+
top: `${d.value.dynamicPosition.y}%`,
|
|
124
120
|
zIndex: 100,
|
|
125
121
|
pointerEvents: "auto"
|
|
126
|
-
} : { display: "none" }),
|
|
127
|
-
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
},
|
|
131
|
-
|
|
122
|
+
} : { display: "none" }), R = (c) => {
|
|
123
|
+
t.value && (t.value.onPointerDown(c), d.value?.isDynamicActive && e.value && typeof e.value.onPointerDown == "function" && e.value.onPointerDown(c));
|
|
124
|
+
}, y = (c) => {
|
|
125
|
+
t.value && (t.value.onPointerMove(c), d.value?.isDynamicActive && e.value && typeof e.value.onPointerMove == "function" && e.value.onPointerMove(c));
|
|
126
|
+
}, M = (c) => {
|
|
127
|
+
d.value?.isDynamicActive && e.value && typeof e.value.onPointerUp == "function" && e.value.onPointerUp(c), t.value && t.value.onPointerUp(c);
|
|
128
|
+
}, Z = (c) => {
|
|
129
|
+
d.value?.isDynamicActive && e.value && typeof e.value.onPointerCancel == "function" && e.value.onPointerCancel(c), t.value && t.value.onPointerCancel(c);
|
|
132
130
|
};
|
|
133
|
-
return (
|
|
134
|
-
id:
|
|
131
|
+
return (c, w) => (p(), g("div", {
|
|
132
|
+
id: l(i),
|
|
135
133
|
ref_key: "elementRef",
|
|
136
|
-
ref:
|
|
134
|
+
ref: m,
|
|
137
135
|
class: "omnipad-input-zone omnipad-prevent",
|
|
138
|
-
style:
|
|
136
|
+
style: $(v.value)
|
|
139
137
|
}, [
|
|
140
|
-
x(
|
|
141
|
-
default:
|
|
142
|
-
|
|
138
|
+
x(j, { nodes: f.value }, {
|
|
139
|
+
default: V(() => [
|
|
140
|
+
I(c.$slots, "default", {}, void 0, !0)
|
|
143
141
|
]),
|
|
144
142
|
_: 3
|
|
145
143
|
}, 8, ["nodes"]),
|
|
146
|
-
u(
|
|
144
|
+
u.value.nodeToRender || l(t)?.isInterceptorRequired ? (p(), g("div", {
|
|
147
145
|
key: 0,
|
|
148
146
|
class: "omnipad-input-zone-trigger",
|
|
149
|
-
onPointerdown:
|
|
150
|
-
onPointermove:
|
|
151
|
-
onPointerup:
|
|
152
|
-
onPointercancel:
|
|
153
|
-
onLostpointercapture:
|
|
154
|
-
onPointerleave: T
|
|
147
|
+
onPointerdown: R,
|
|
148
|
+
onPointermove: y,
|
|
149
|
+
onPointerup: M,
|
|
150
|
+
onPointercancel: Z,
|
|
151
|
+
onLostpointercapture: Z
|
|
155
152
|
}, [
|
|
156
|
-
|
|
153
|
+
Y("div", {
|
|
157
154
|
class: "dynamic-widget-mount",
|
|
158
|
-
style:
|
|
155
|
+
style: $(r.value)
|
|
159
156
|
}, [
|
|
160
|
-
|
|
157
|
+
u.value.isFromSlot ? (p(), T(A(u.value.nodeToRender), {
|
|
161
158
|
key: 0,
|
|
162
|
-
ref: (
|
|
163
|
-
}, null, 512)) :
|
|
159
|
+
ref: (C) => e.value = C
|
|
160
|
+
}, null, 512)) : u.value.nodeToRender ? (p(), T(A(l(W)(u.value.nodeToRender.type)), {
|
|
164
161
|
key: 1,
|
|
165
|
-
ref: (
|
|
166
|
-
"tree-node":
|
|
167
|
-
}, null, 8, ["tree-node"])) :
|
|
162
|
+
ref: (C) => e.value = C,
|
|
163
|
+
"tree-node": u.value.nodeToRender
|
|
164
|
+
}, null, 8, ["tree-node"])) : B("", !0)
|
|
168
165
|
], 4)
|
|
169
|
-
], 32)) :
|
|
170
|
-
], 12,
|
|
166
|
+
], 32)) : B("", !0)
|
|
167
|
+
], 12, Pe));
|
|
171
168
|
}
|
|
172
|
-
}),
|
|
169
|
+
}), ge = /* @__PURE__ */ h(_e, [["__scopeId", "data-v-e0c28ebd"]]), be = ["id"], Re = /* @__PURE__ */ b({
|
|
173
170
|
__name: "RootLayer",
|
|
174
171
|
props: {
|
|
175
172
|
treeNode: {},
|
|
176
173
|
widgetId: {}
|
|
177
174
|
},
|
|
178
175
|
setup(n) {
|
|
179
|
-
const
|
|
180
|
-
return (
|
|
181
|
-
id:
|
|
176
|
+
const o = n, { uid: s, config: e } = E(P.ROOT_LAYER, o), { elementRef: i } = D(() => new J(s.value, e.value));
|
|
177
|
+
return (a, t) => (p(), g("div", {
|
|
178
|
+
id: l(s),
|
|
182
179
|
ref_key: "elementRef",
|
|
183
|
-
ref:
|
|
180
|
+
ref: i,
|
|
184
181
|
class: "omnipad-virtual-layer"
|
|
185
182
|
}, [
|
|
186
|
-
x(
|
|
183
|
+
x(j, {
|
|
187
184
|
nodes: n.treeNode?.children || []
|
|
188
185
|
}, {
|
|
189
|
-
default:
|
|
190
|
-
|
|
186
|
+
default: V(() => [
|
|
187
|
+
I(a.$slots, "default", {}, void 0, !0)
|
|
191
188
|
]),
|
|
192
189
|
_: 3
|
|
193
190
|
}, 8, ["nodes"])
|
|
194
|
-
], 8,
|
|
191
|
+
], 8, be));
|
|
195
192
|
}
|
|
196
|
-
}),
|
|
193
|
+
}), we = /* @__PURE__ */ h(Re, [["__scopeId", "data-v-9e46ef9c"]]), Ce = ["id"], Te = {
|
|
194
|
+
key: 0,
|
|
195
|
+
class: "omnipad-default-focus-border-feedback"
|
|
196
|
+
}, Ie = /* @__PURE__ */ b({
|
|
197
197
|
__name: "TargetZone",
|
|
198
198
|
props: {
|
|
199
199
|
treeNode: {},
|
|
@@ -203,50 +203,64 @@ const fe = ["id"], pe = /* @__PURE__ */ g({
|
|
|
203
203
|
layout: {}
|
|
204
204
|
},
|
|
205
205
|
setup(n) {
|
|
206
|
-
const
|
|
206
|
+
const o = n, s = {
|
|
207
207
|
cursorAutoDelay: 2500
|
|
208
|
-
}, { uid: e, config:
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
208
|
+
}, { uid: e, config: i } = E(
|
|
209
|
+
P.TARGET_ZONE,
|
|
210
|
+
o,
|
|
211
|
+
s
|
|
212
|
+
), { core: a, state: t, elementRef: d } = D(
|
|
213
|
+
() => new Q(e.value, i.value)
|
|
214
|
+
), m = _(() => S(i.value.layout)), f = _(() => t.value ? {
|
|
215
|
+
left: `${t.value.position.x}%`,
|
|
216
|
+
top: `${t.value.position.y}%`,
|
|
217
|
+
opacity: t.value.isVisible ? 1 : 0
|
|
218
|
+
} : { display: "none" }), u = (y) => a.value?.onPointerDown(y), v = (y) => a.value?.onPointerMove(y), r = (y) => a.value?.onPointerUp(y), R = (y) => a.value?.onPointerCancel(y);
|
|
219
|
+
return (y, M) => (p(), g("div", {
|
|
220
|
+
id: l(e),
|
|
217
221
|
ref_key: "elementRef",
|
|
218
|
-
ref:
|
|
222
|
+
ref: d,
|
|
219
223
|
class: "omnipad-target-zone",
|
|
220
|
-
style:
|
|
224
|
+
style: $(m.value),
|
|
225
|
+
onPointerdown: u,
|
|
226
|
+
onPointermove: v,
|
|
227
|
+
onPointerup: r,
|
|
228
|
+
onPointercancel: R,
|
|
229
|
+
onLostpointercapture: R
|
|
221
230
|
}, [
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
u(a).cursorEnabled ? (d(), p("div", {
|
|
231
|
+
I(y.$slots, "focus-feedback", {
|
|
232
|
+
state: l(t),
|
|
233
|
+
isReturning: l(t)?.isFocusReturning,
|
|
234
|
+
cursorPos: l(t)?.position
|
|
235
|
+
}, () => [
|
|
236
|
+
x(pe, { name: "omnipad-default-focus-fade" }, {
|
|
237
|
+
default: V(() => [
|
|
238
|
+
l(t)?.isFocusReturning ? (p(), g("div", Te)) : B("", !0)
|
|
239
|
+
]),
|
|
240
|
+
_: 1
|
|
241
|
+
})
|
|
242
|
+
], !0),
|
|
243
|
+
l(i).cursorEnabled ? (p(), g("div", {
|
|
236
244
|
key: 0,
|
|
237
245
|
class: "omnipad-virtual-cursor",
|
|
238
|
-
style:
|
|
246
|
+
style: $(f.value)
|
|
239
247
|
}, [
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
248
|
+
I(y.$slots, "cursor", {
|
|
249
|
+
state: l(t),
|
|
250
|
+
isDown: l(t)?.isPointerDown,
|
|
251
|
+
cursorPos: l(t)?.position
|
|
252
|
+
}, () => [
|
|
253
|
+
Y("div", {
|
|
254
|
+
class: z(["omnipad-default-cursor-dot", { "is-down": l(t)?.isPointerDown }])
|
|
255
|
+
}, null, 2)
|
|
256
|
+
], !0)
|
|
257
|
+
], 4)) : B("", !0)
|
|
258
|
+
], 44, Ce));
|
|
245
259
|
}
|
|
246
|
-
}),
|
|
260
|
+
}), Ne = /* @__PURE__ */ h(Ie, [["__scopeId", "data-v-70b706ac"]]), De = {
|
|
247
261
|
key: 0,
|
|
248
262
|
class: "omnipad-button-label"
|
|
249
|
-
},
|
|
263
|
+
}, he = /* @__PURE__ */ b({
|
|
250
264
|
__name: "VirtualButtonBase",
|
|
251
265
|
props: {
|
|
252
266
|
layout: {},
|
|
@@ -254,18 +268,18 @@ const fe = ["id"], pe = /* @__PURE__ */ g({
|
|
|
254
268
|
label: {}
|
|
255
269
|
},
|
|
256
270
|
setup(n) {
|
|
257
|
-
const
|
|
258
|
-
return (e,
|
|
259
|
-
class:
|
|
260
|
-
style:
|
|
271
|
+
const o = n, s = _(() => o.layout ? S(o.layout) : {});
|
|
272
|
+
return (e, i) => (p(), g("div", {
|
|
273
|
+
class: z(["omnipad-button-base", { "is-active": n.isActive }]),
|
|
274
|
+
style: $(s.value),
|
|
261
275
|
tabindex: "-1"
|
|
262
276
|
}, [
|
|
263
|
-
|
|
264
|
-
n.label ? (
|
|
277
|
+
I(e.$slots, "default", {}, () => [
|
|
278
|
+
n.label ? (p(), g("span", De, fe(n.label), 1)) : B("", !0)
|
|
265
279
|
], !0)
|
|
266
280
|
], 6));
|
|
267
281
|
}
|
|
268
|
-
}),
|
|
282
|
+
}), L = /* @__PURE__ */ h(he, [["__scopeId", "data-v-3db6d4f9"]]), Ee = /* @__PURE__ */ b({
|
|
269
283
|
__name: "VirtualKeyboardButton",
|
|
270
284
|
props: {
|
|
271
285
|
treeNode: {},
|
|
@@ -275,42 +289,125 @@ const fe = ["id"], pe = /* @__PURE__ */ g({
|
|
|
275
289
|
mapping: {},
|
|
276
290
|
layout: {}
|
|
277
291
|
},
|
|
278
|
-
setup(n, { expose:
|
|
279
|
-
const
|
|
292
|
+
setup(n, { expose: o }) {
|
|
293
|
+
const s = n, e = {
|
|
280
294
|
label: "BTN"
|
|
281
|
-
}, { uid:
|
|
282
|
-
|
|
283
|
-
|
|
295
|
+
}, { uid: i, config: a } = E(
|
|
296
|
+
P.KEYBOARD_BUTTON,
|
|
297
|
+
s,
|
|
298
|
+
e
|
|
299
|
+
), { core: t, state: d, elementRef: m } = D(
|
|
300
|
+
() => new q(i.value, a.value)
|
|
301
|
+
), f = (r) => t.value?.onPointerDown(r), u = (r) => t.value?.onPointerUp(r), v = (r) => t.value?.onPointerCancel(r);
|
|
302
|
+
return o({
|
|
303
|
+
uid: i,
|
|
304
|
+
onPointerDown: f,
|
|
305
|
+
onPointerUp: u,
|
|
306
|
+
onPointerCancel: v
|
|
307
|
+
}), (r, R) => (p(), T(L, {
|
|
308
|
+
id: l(i),
|
|
309
|
+
ref_key: "elementRef",
|
|
310
|
+
ref: m,
|
|
311
|
+
layout: l(a).layout,
|
|
312
|
+
label: l(a).label,
|
|
313
|
+
"is-active": l(d)?.isPressed,
|
|
314
|
+
onPointerdown: f,
|
|
315
|
+
onPointerup: u,
|
|
316
|
+
onPointercancel: v,
|
|
317
|
+
onLostpointercapture: v
|
|
318
|
+
}, null, 8, ["id", "layout", "label", "is-active"]));
|
|
319
|
+
}
|
|
320
|
+
}), $e = /* @__PURE__ */ b({
|
|
321
|
+
__name: "VirtualMouseButton",
|
|
322
|
+
props: {
|
|
323
|
+
treeNode: {},
|
|
324
|
+
widgetId: {},
|
|
325
|
+
label: {},
|
|
326
|
+
targetStageId: {},
|
|
327
|
+
button: {},
|
|
328
|
+
fixedPoint: {},
|
|
329
|
+
layout: {}
|
|
330
|
+
},
|
|
331
|
+
setup(n, { expose: o }) {
|
|
332
|
+
const s = n, e = {
|
|
333
|
+
label: "LMB",
|
|
334
|
+
button: 0
|
|
335
|
+
}, { uid: i, config: a } = E(
|
|
336
|
+
P.MOUSE_BUTTON,
|
|
337
|
+
s,
|
|
284
338
|
e
|
|
285
|
-
), { core:
|
|
286
|
-
() => new
|
|
287
|
-
),
|
|
288
|
-
return
|
|
289
|
-
uid:
|
|
290
|
-
onPointerDown:
|
|
291
|
-
onPointerUp:
|
|
292
|
-
|
|
293
|
-
|
|
339
|
+
), { core: t, state: d, elementRef: m } = D(
|
|
340
|
+
() => new ee(i.value, a.value)
|
|
341
|
+
), f = (r) => t.value?.onPointerDown(r), u = (r) => t.value?.onPointerUp(r), v = (r) => t.value?.onPointerCancel(r);
|
|
342
|
+
return o({
|
|
343
|
+
uid: i,
|
|
344
|
+
onPointerDown: f,
|
|
345
|
+
onPointerUp: u,
|
|
346
|
+
onPointerCancel: v
|
|
347
|
+
}), (r, R) => (p(), T(L, {
|
|
348
|
+
id: l(i),
|
|
349
|
+
ref_key: "elementRef",
|
|
350
|
+
ref: m,
|
|
351
|
+
layout: l(a).layout,
|
|
352
|
+
label: l(a).label,
|
|
353
|
+
"is-active": l(d)?.isPressed,
|
|
354
|
+
onPointerdown: f,
|
|
355
|
+
onPointerup: u,
|
|
356
|
+
onPointercancel: v,
|
|
357
|
+
onLostpointercapture: v
|
|
358
|
+
}, null, 8, ["id", "layout", "label", "is-active"]));
|
|
359
|
+
}
|
|
360
|
+
}), Be = /* @__PURE__ */ b({
|
|
361
|
+
__name: "VirtualTrackpad",
|
|
362
|
+
props: {
|
|
363
|
+
treeNode: {},
|
|
364
|
+
widgetId: {},
|
|
365
|
+
label: {},
|
|
366
|
+
sensitivity: {},
|
|
367
|
+
targetStageId: {},
|
|
368
|
+
layout: {}
|
|
369
|
+
},
|
|
370
|
+
setup(n, { expose: o }) {
|
|
371
|
+
const s = n, { uid: e, config: i } = E(P.TRACKPAD, s, {
|
|
372
|
+
label: "TRACKPAD",
|
|
373
|
+
sensitivity: 1
|
|
374
|
+
}), { core: a, state: t, elementRef: d } = D(
|
|
375
|
+
() => new te(e.value, i.value)
|
|
376
|
+
), m = (r) => a.value?.onPointerDown(r), f = (r) => a.value?.onPointerMove(r), u = (r) => a.value?.onPointerUp(r), v = (r) => a.value?.onPointerCancel(r);
|
|
377
|
+
return o({
|
|
378
|
+
uid: e,
|
|
379
|
+
onPointerDown: m,
|
|
380
|
+
onPointerMove: f,
|
|
381
|
+
onPointerUp: u,
|
|
382
|
+
onPointerCancel: v
|
|
383
|
+
}), (r, R) => (p(), T(L, {
|
|
384
|
+
id: l(e),
|
|
294
385
|
ref_key: "elementRef",
|
|
295
|
-
ref:
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
386
|
+
ref: d,
|
|
387
|
+
class: "omnipad-trackpad",
|
|
388
|
+
layout: l(i).layout,
|
|
389
|
+
label: l(i).label,
|
|
390
|
+
"is-active": l(t)?.isPressed,
|
|
391
|
+
onPointerdown: m,
|
|
392
|
+
onPointermove: f,
|
|
393
|
+
onPointerup: u,
|
|
394
|
+
onPointercancel: v,
|
|
395
|
+
onLostpointercapture: v
|
|
303
396
|
}, null, 8, ["id", "layout", "label", "is-active"]));
|
|
304
397
|
}
|
|
305
|
-
});
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
398
|
+
}), ke = /* @__PURE__ */ h(Be, [["__scopeId", "data-v-c28e3a2e"]]);
|
|
399
|
+
N(P.INPUT_ZONE, ge);
|
|
400
|
+
N(P.ROOT_LAYER, we);
|
|
401
|
+
N(P.TARGET_ZONE, Ne);
|
|
402
|
+
N(P.KEYBOARD_BUTTON, Ee);
|
|
403
|
+
N(P.MOUSE_BUTTON, $e);
|
|
404
|
+
N(P.TRACKPAD, ke);
|
|
310
405
|
export {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
406
|
+
ge as InputZone,
|
|
407
|
+
we as RootLayer,
|
|
408
|
+
Ne as TargetZone,
|
|
409
|
+
Ee as VirtualKeyboardButton,
|
|
410
|
+
$e as VirtualMouseButton,
|
|
411
|
+
ke as VirtualTrackpad,
|
|
412
|
+
N as registerComponent
|
|
316
413
|
};
|
package/dist/omnipad-vue.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(f,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@omnipad/core"),require("vue")):typeof define=="function"&&define.amd?define(["exports","@omnipad/core","vue"],a):(f=typeof globalThis<"u"?globalThis:f||self,a(f.OmnipadVue={},f.OmniPadCore,f.Vue))})(this,(function(f,a,e){"use strict";const b={};function P(o,n){b[o]=n}function S(o){const n=b[o];return n||e.defineComponent({render:()=>e.h("div",{style:"color:red"},`[Unknown: ${o}]`)})}function E(o){const n=e.shallowRef(),c=e.ref(),t=e.ref(null),l=i=>{c.value=i};let r=null;return e.onMounted(()=>{const i=o();n.value=i,a.Registry.getInstance().register(i),"subscribe"in i&&i.subscribe(l);let s=null;t.value&&(t.value instanceof Element?s=t.value:t.value.$el instanceof Element&&(s=t.value.$el)),s&&"updateRect"in i&&(r=new ResizeObserver(m=>{for(const p of m)i.updateRect(p.target.getBoundingClientRect())}),r.observe(s),i.updateRect(s.getBoundingClientRect()))}),e.onUnmounted(()=>{r&&r.disconnect(),n.value&&n.value.destroy()}),{core:n,state:c,elementRef:t}}const v={class:"omnipad-virtual-layer-base omnipad-prevent"},D=e.defineComponent({__name:"VirtualLayerBase",props:{nodes:{}},setup(o){return(n,c)=>(e.openBlock(),e.createElementBlock("div",v,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.nodes||[],t=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(S)(t.type)),{key:t.uid,"tree-node":t},null,8,["tree-node"]))),128)),e.renderSlot(n.$slots,"default",{},void 0,!0)]))}}),B=(o,n)=>{const c=o.__vccOpts||o;for(const[t,l]of n)c[t]=l;return c},I=B(D,[["__scopeId","data-v-6f1860f6"]]);function C(o,n,c={}){const t=n.treeNode,l=t&&t.type===o?t:void 0;t&&t.type!==o&&console.warn(`[OmniPad-Validation] Type mismatch! Component expected "${o}", but received "${t.type}". Config ignored.`);const r=e.inject(a.CONTEXT.PARENT_ID_KEY,e.ref(void 0)),i=e.computed(()=>n.parentId||l?.config?.parentId||r.value),s=e.computed(()=>n.widgetId||l?.uid||a.generateUID(o));e.provide(a.CONTEXT.PARENT_ID_KEY,s);const m=e.computed(()=>{const p=l?.config||{},u=Object.fromEntries(Object.entries(n).filter(([y,k])=>k!==void 0&&y!=="treeNode"&&y!=="widgetId"));return{...c,...p,...u,id:s.value,type:o,parentId:i.value,layout:{...c.layout||{},...p.layout||{},...u.layout||{}}}});return{uid:s,config:m}}const V=["id"],$=B(e.defineComponent({__name:"InputZone",props:{treeNode:{},widgetId:{},layout:{},preventFocusLoss:{}},setup(o){const n=o,c=e.useSlots(),t=e.ref(null),{uid:l,config:r}=C(a.TYPES.INPUT_ZONE,n),{core:i,state:s,elementRef:m}=E(()=>new a.InputZoneCore(l.value,r.value)),p=e.computed(()=>{const d=n.treeNode?.config?.dynamicWidgetId;return n.treeNode?.children?.filter(_=>_.uid!==d)||[]}),u=e.computed(()=>{const _=(c.dynamicWidget?.()||[]).filter(N=>!(N.type===Comment||N.type===Text)),g=n.treeNode?.children?.find(N=>N.uid===n.treeNode?.config?.dynamicWidgetId),R=_.length>0;return _.length>1&&console.error(`[OmniPad-Validation] InputZone ${l.value} has multiple dynamic widgets in slot. Only the first one will be activated.`),R&&g&&console.warn(`[OmniPad-Validation] InputZone ${l.value} has both Slot and Config dynamic widgets. Config ignored.`),{nodeToRender:R?_[0]:g||null,isFromSlot:R}});e.watch(t,d=>{e.nextTick(()=>{d&&d?.uid&&i.value?.updateConfig({dynamicWidgetId:d.uid})})},{immediate:!0});const y=e.computed(()=>a.resolveLayoutStyle(r.value.layout)),k=e.computed(()=>s.value?.isDynamicActive?{position:"absolute",left:`${s.value.dynamicPosition.x}%`,top:`${s.value.dynamicPosition.y}%`,zIndex:100,pointerEvents:"auto"}:{display:"none"}),U=d=>{i.value&&(i.value.onPointerDown(d),s.value?.isDynamicActive&&t.value&&typeof t.value.onPointerDown=="function"&&t.value.onPointerDown(d))},Y=d=>{i.value&&(i.value.onPointerMove(d),s.value?.isDynamicActive&&t.value&&typeof t.value.onPointerMove=="function"&&t.value.onPointerMove(d))},T=d=>{s.value?.isDynamicActive&&t.value&&typeof t.value.onPointerUp=="function"&&t.value.onPointerUp(d),i.value&&i.value.onPointerUp(d)};return(d,_)=>(e.openBlock(),e.createElementBlock("div",{id:e.unref(l),ref_key:"elementRef",ref:m,class:"omnipad-input-zone omnipad-prevent",style:e.normalizeStyle(y.value)},[e.createVNode(I,{nodes:p.value},{default:e.withCtx(()=>[e.renderSlot(d.$slots,"default",{},void 0,!0)]),_:3},8,["nodes"]),e.unref(i)?.isInterceptorRequired?(e.openBlock(),e.createElementBlock("div",{key:0,class:"omnipad-input-zone-trigger",onPointerdown:U,onPointermove:Y,onPointerup:T,onPointercancel:T,onLostpointercapture:T,onPointerleave:T},[e.createElementVNode("div",{class:"dynamic-widget-mount",style:e.normalizeStyle(k.value)},[u.value.isFromSlot?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.value.nodeToRender),{key:0,ref:g=>t.value=g},null,512)):u.value.nodeToRender?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(S)(u.value.nodeToRender.type)),{key:1,ref:g=>t.value=g,"tree-node":u.value.nodeToRender},null,8,["tree-node"])):e.createCommentVNode("",!0)],4)],32)):e.createCommentVNode("",!0)],12,V))}}),[["__scopeId","data-v-02669919"]]),A=["id"],h=B(e.defineComponent({__name:"RootLayer",props:{treeNode:{},widgetId:{}},setup(o){const n=o,{uid:c,config:t}=C(a.TYPES.ROOT_LAYER,n),{elementRef:l}=E(()=>new a.RootLayerCore(c.value,t.value));return(r,i)=>(e.openBlock(),e.createElementBlock("div",{id:e.unref(c),ref_key:"elementRef",ref:l,class:"omnipad-virtual-layer"},[e.createVNode(I,{nodes:o.treeNode?.children||[]},{default:e.withCtx(()=>[e.renderSlot(r.$slots,"default",{},void 0,!0)]),_:3},8,["nodes"])],8,A))}}),[["__scopeId","data-v-a509fd6e"]]),L=["id"],w=B(e.defineComponent({__name:"TargetZone",props:{treeNode:{},widgetId:{},cursorEnabled:{type:Boolean},cursorAutoDelay:{},layout:{}},setup(o){const n=o,c={cursorAutoDelay:2500},{uid:t,config:l}=C(a.TYPES.TARGET_ZONE,n,c),{state:r,elementRef:i}=E(()=>new a.TargetZoneCore(t.value,l.value)),s=e.computed(()=>a.resolveLayoutStyle(l.value.layout)),m=e.computed(()=>r.value?{left:`${r.value.position.x}%`,top:`${r.value.position.y}%`,opacity:r.value.isVisible?1:0}:{display:"none"});return(p,u)=>(e.openBlock(),e.createElementBlock("div",{id:e.unref(t),ref_key:"elementRef",ref:i,class:"omnipad-target-zone",style:e.normalizeStyle(s.value)},[e.createVNode(e.Transition,{name:"pulse"},{default:e.withCtx(()=>[e.unref(r)?.isFocusReturning?(e.openBlock(),e.createElementBlock("div",{key:0,class:"focus-feedback-ring",style:e.normalizeStyle({left:`${e.unref(r).position.x}%`,top:`${e.unref(r).position.y}%`})},null,4)):e.createCommentVNode("",!0)]),_:1}),e.unref(l).cursorEnabled?(e.openBlock(),e.createElementBlock("div",{key:0,class:"omnipad-virtual-cursor",style:e.normalizeStyle(m.value)},[e.createElementVNode("div",{class:e.normalizeClass(["cursor-dot",{"is-down":e.unref(r)?.isPointerDown}])},null,2)],4)):e.createCommentVNode("",!0)],12,L))}}),[["__scopeId","data-v-b9d49b97"]]),x={key:0,class:"omnipad-button-label"},z=B(e.defineComponent({__name:"VirtualButtonBase",props:{layout:{},isActive:{type:Boolean},label:{}},setup(o){const n=o,c=e.computed(()=>n.layout?a.resolveLayoutStyle(n.layout):{});return(t,l)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["omnipad-button-base",{"omnipad-is-active":o.isActive}]),style:e.normalizeStyle(c.value),tabindex:"-1"},[e.renderSlot(t.$slots,"default",{},()=>[o.label?(e.openBlock(),e.createElementBlock("span",x,e.toDisplayString(o.label),1)):e.createCommentVNode("",!0)],!0)],6))}}),[["__scopeId","data-v-6cbe805c"]]),O=e.defineComponent({__name:"VirtualKeyboardButton",props:{treeNode:{},widgetId:{},label:{},targetStageId:{},mapping:{},layout:{}},setup(o,{expose:n}){const c=o,t={label:"BTN"},{uid:l,config:r}=C(a.TYPES.KEYBOARD_BUTTON,c,t),{core:i,state:s,elementRef:m}=E(()=>new a.KeyboardButtonCore(l.value,r.value)),p=y=>i.value?.onPointerDown(y),u=y=>i.value?.onPointerUp(y);return n({uid:l,onPointerDown:p,onPointerUp:u}),(y,k)=>(e.openBlock(),e.createBlock(z,{id:e.unref(l),ref_key:"elementRef",ref:m,layout:e.unref(r).layout,label:e.unref(r).label,"is-active":e.unref(s)?.isPressed,onPointerdown:p,onPointerup:u,onPointercancel:u,onLostpointercapture:u},null,8,["id","layout","label","is-active"]))}});P(a.TYPES.INPUT_ZONE,$),P(a.TYPES.ROOT_LAYER,h),P(a.TYPES.TARGET_ZONE,w),P(a.TYPES.KEYBOARD_BUTTON,O),f.InputZone=$,f.RootLayer=h,f.TargetZone=w,f.VirtualKeyboardButton=O,f.registerComponent=P,Object.defineProperty(f,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(y,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("@omnipad/core"),require("vue")):typeof define=="function"&&define.amd?define(["exports","@omnipad/core","vue"],l):(y=typeof globalThis<"u"?globalThis:y||self,l(y.OmnipadVue={},y.OmniPadCore,y.Vue))})(this,(function(y,l,e){"use strict";const N={};function C(r,t){N[r]=t}function v(r){const t=N[r];return t||e.defineComponent({render:()=>e.h("div",{style:"color:red"},`[Unknown: ${r}]`)})}function T(r){const t=e.shallowRef(),s=e.ref(),n=e.ref(null),i=a=>{s.value=a};return e.onMounted(()=>{const a=r();t.value=a,l.Registry.getInstance().register(a),"subscribe"in a&&a.subscribe(i);let o=null;n.value&&(n.value instanceof Element?o=n.value:n.value.$el instanceof Element&&(o=n.value.$el)),o&&"bindRectProvider"in a&&a.bindRectProvider(()=>o.getBoundingClientRect())}),e.onUnmounted(()=>{t.value&&t.value.destroy()}),{core:t,state:s,elementRef:n}}const L={class:"omnipad-virtual-layer-base omnipad-prevent"},Y=e.defineComponent({__name:"VirtualLayerBase",props:{nodes:{}},setup(r){return(t,s)=>(e.openBlock(),e.createElementBlock("div",L,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.nodes||[],n=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(v)(n.type)),{key:n.uid,"tree-node":n},null,8,["tree-node"]))),128)),e.renderSlot(t.$slots,"default",{},void 0,!0)]))}}),B=(r,t)=>{const s=r.__vccOpts||r;for(const[n,i]of t)s[n]=i;return s},I=B(Y,[["__scopeId","data-v-6f1860f6"]]);function k(r,t,s={}){const n=t.treeNode,i=n&&n.type===r?n:void 0;n&&n.type!==r&&console.warn(`[OmniPad-Validation] Type mismatch! Component expected "${r}", but received "${n.type}". Config ignored.`);const a=e.inject(l.CONTEXT.PARENT_ID_KEY,e.ref(void 0)),o=e.computed(()=>t.parentId||i?.config?.parentId||a.value),f=e.computed(()=>t.widgetId||i?.uid||l.generateUID(r));e.provide(l.CONTEXT.PARENT_ID_KEY,f);const P=e.computed(()=>{const m=i?.config||{},d=Object.fromEntries(Object.entries(t).filter(([p,c])=>c!==void 0&&p!=="treeNode"&&p!=="widgetId"));return{...s,...m,...d,id:f.value,type:r,parentId:o.value,layout:{...s.layout||{},...m.layout||{},...d.layout||{}}}});return{uid:f,config:P}}const x=["id"],$=B(e.defineComponent({__name:"InputZone",props:{treeNode:{},widgetId:{},layout:{},preventFocusLoss:{}},setup(r){const t=r,s=e.useSlots(),n=e.ref(null),{uid:i,config:a}=k(l.CMP_TYPES.INPUT_ZONE,t),{core:o,state:f,elementRef:P}=T(()=>new l.InputZoneCore(i.value,a.value)),m=e.computed(()=>{const u=t.treeNode?.config?.dynamicWidgetId;return t.treeNode?.children?.filter(b=>b.uid!==u)||[]}),d=e.computed(()=>{const b=(s.dynamicWidget?.()||[]).filter(w=>!(w.type===Comment||w.type===Text)),E=t.treeNode?.children?.find(w=>w.uid===t.treeNode?.config?.dynamicWidgetId),S=b.length>0;return b.length>1&&console.error(`[OmniPad-Validation] InputZone ${i.value} has multiple dynamic widgets in slot. Only the first one will be activated.`),S&&E&&console.warn(`[OmniPad-Validation] InputZone ${i.value} has both Slot and Config dynamic widgets. Config ignored.`),{nodeToRender:S?b[0]:E||null,isFromSlot:S}});e.watch(n,u=>{e.nextTick(()=>{u&&u?.uid&&o.value?.updateConfig({dynamicWidgetId:u.uid})})},{immediate:!0});const p=e.computed(()=>l.resolveLayoutStyle(a.value.layout)),c=e.computed(()=>f.value?.isDynamicActive?{position:"absolute",left:`${f.value.dynamicPosition.x}%`,top:`${f.value.dynamicPosition.y}%`,zIndex:100,pointerEvents:"auto"}:{display:"none"}),g=u=>{o.value&&(o.value.onPointerDown(u),f.value?.isDynamicActive&&n.value&&typeof n.value.onPointerDown=="function"&&n.value.onPointerDown(u))},_=u=>{o.value&&(o.value.onPointerMove(u),f.value?.isDynamicActive&&n.value&&typeof n.value.onPointerMove=="function"&&n.value.onPointerMove(u))},U=u=>{f.value?.isDynamicActive&&n.value&&typeof n.value.onPointerUp=="function"&&n.value.onPointerUp(u),o.value&&o.value.onPointerUp(u)},A=u=>{f.value?.isDynamicActive&&n.value&&typeof n.value.onPointerCancel=="function"&&n.value.onPointerCancel(u),o.value&&o.value.onPointerCancel(u)};return(u,b)=>(e.openBlock(),e.createElementBlock("div",{id:e.unref(i),ref_key:"elementRef",ref:P,class:"omnipad-input-zone omnipad-prevent",style:e.normalizeStyle(p.value)},[e.createVNode(I,{nodes:m.value},{default:e.withCtx(()=>[e.renderSlot(u.$slots,"default",{},void 0,!0)]),_:3},8,["nodes"]),d.value.nodeToRender||e.unref(o)?.isInterceptorRequired?(e.openBlock(),e.createElementBlock("div",{key:0,class:"omnipad-input-zone-trigger",onPointerdown:g,onPointermove:_,onPointerup:U,onPointercancel:A,onLostpointercapture:A},[e.createElementVNode("div",{class:"dynamic-widget-mount",style:e.normalizeStyle(c.value)},[d.value.isFromSlot?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.value.nodeToRender),{key:0,ref:E=>n.value=E},null,512)):d.value.nodeToRender?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(v)(d.value.nodeToRender.type)),{key:1,ref:E=>n.value=E,"tree-node":d.value.nodeToRender},null,8,["tree-node"])):e.createCommentVNode("",!0)],4)],32)):e.createCommentVNode("",!0)],12,x))}}),[["__scopeId","data-v-e0c28ebd"]]),Z=["id"],h=B(e.defineComponent({__name:"RootLayer",props:{treeNode:{},widgetId:{}},setup(r){const t=r,{uid:s,config:n}=k(l.CMP_TYPES.ROOT_LAYER,t),{elementRef:i}=T(()=>new l.RootLayerCore(s.value,n.value));return(a,o)=>(e.openBlock(),e.createElementBlock("div",{id:e.unref(s),ref_key:"elementRef",ref:i,class:"omnipad-virtual-layer"},[e.createVNode(I,{nodes:r.treeNode?.children||[]},{default:e.withCtx(()=>[e.renderSlot(a.$slots,"default",{},void 0,!0)]),_:3},8,["nodes"])],8,Z))}}),[["__scopeId","data-v-9e46ef9c"]]),z=["id"],K={key:0,class:"omnipad-default-focus-border-feedback"},D=B(e.defineComponent({__name:"TargetZone",props:{treeNode:{},widgetId:{},cursorEnabled:{type:Boolean},cursorAutoDelay:{},layout:{}},setup(r){const t=r,s={cursorAutoDelay:2500},{uid:n,config:i}=k(l.CMP_TYPES.TARGET_ZONE,t,s),{core:a,state:o,elementRef:f}=T(()=>new l.TargetZoneCore(n.value,i.value)),P=e.computed(()=>l.resolveLayoutStyle(i.value.layout)),m=e.computed(()=>o.value?{left:`${o.value.position.x}%`,top:`${o.value.position.y}%`,opacity:o.value.isVisible?1:0}:{display:"none"}),d=_=>a.value?.onPointerDown(_),p=_=>a.value?.onPointerMove(_),c=_=>a.value?.onPointerUp(_),g=_=>a.value?.onPointerCancel(_);return(_,U)=>(e.openBlock(),e.createElementBlock("div",{id:e.unref(n),ref_key:"elementRef",ref:f,class:"omnipad-target-zone",style:e.normalizeStyle(P.value),onPointerdown:d,onPointermove:p,onPointerup:c,onPointercancel:g,onLostpointercapture:g},[e.renderSlot(_.$slots,"focus-feedback",{state:e.unref(o),isReturning:e.unref(o)?.isFocusReturning,cursorPos:e.unref(o)?.position},()=>[e.createVNode(e.Transition,{name:"omnipad-default-focus-fade"},{default:e.withCtx(()=>[e.unref(o)?.isFocusReturning?(e.openBlock(),e.createElementBlock("div",K)):e.createCommentVNode("",!0)]),_:1})],!0),e.unref(i).cursorEnabled?(e.openBlock(),e.createElementBlock("div",{key:0,class:"omnipad-virtual-cursor",style:e.normalizeStyle(m.value)},[e.renderSlot(_.$slots,"cursor",{state:e.unref(o),isDown:e.unref(o)?.isPointerDown,cursorPos:e.unref(o)?.position},()=>[e.createElementVNode("div",{class:e.normalizeClass(["omnipad-default-cursor-dot",{"is-down":e.unref(o)?.isPointerDown}])},null,2)],!0)],4)):e.createCommentVNode("",!0)],44,z))}}),[["__scopeId","data-v-70b706ac"]]),j={key:0,class:"omnipad-button-label"},R=B(e.defineComponent({__name:"VirtualButtonBase",props:{layout:{},isActive:{type:Boolean},label:{}},setup(r){const t=r,s=e.computed(()=>t.layout?l.resolveLayoutStyle(t.layout):{});return(n,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["omnipad-button-base",{"is-active":r.isActive}]),style:e.normalizeStyle(s.value),tabindex:"-1"},[e.renderSlot(n.$slots,"default",{},()=>[r.label?(e.openBlock(),e.createElementBlock("span",j,e.toDisplayString(r.label),1)):e.createCommentVNode("",!0)],!0)],6))}}),[["__scopeId","data-v-3db6d4f9"]]),M=e.defineComponent({__name:"VirtualKeyboardButton",props:{treeNode:{},widgetId:{},label:{},targetStageId:{},mapping:{},layout:{}},setup(r,{expose:t}){const s=r,n={label:"BTN"},{uid:i,config:a}=k(l.CMP_TYPES.KEYBOARD_BUTTON,s,n),{core:o,state:f,elementRef:P}=T(()=>new l.KeyboardButtonCore(i.value,a.value)),m=c=>o.value?.onPointerDown(c),d=c=>o.value?.onPointerUp(c),p=c=>o.value?.onPointerCancel(c);return t({uid:i,onPointerDown:m,onPointerUp:d,onPointerCancel:p}),(c,g)=>(e.openBlock(),e.createBlock(R,{id:e.unref(i),ref_key:"elementRef",ref:P,layout:e.unref(a).layout,label:e.unref(a).label,"is-active":e.unref(f)?.isPressed,onPointerdown:m,onPointerup:d,onPointercancel:p,onLostpointercapture:p},null,8,["id","layout","label","is-active"]))}}),O=e.defineComponent({__name:"VirtualMouseButton",props:{treeNode:{},widgetId:{},label:{},targetStageId:{},button:{},fixedPoint:{},layout:{}},setup(r,{expose:t}){const s=r,n={label:"LMB",button:0},{uid:i,config:a}=k(l.CMP_TYPES.MOUSE_BUTTON,s,n),{core:o,state:f,elementRef:P}=T(()=>new l.MouseButtonCore(i.value,a.value)),m=c=>o.value?.onPointerDown(c),d=c=>o.value?.onPointerUp(c),p=c=>o.value?.onPointerCancel(c);return t({uid:i,onPointerDown:m,onPointerUp:d,onPointerCancel:p}),(c,g)=>(e.openBlock(),e.createBlock(R,{id:e.unref(i),ref_key:"elementRef",ref:P,layout:e.unref(a).layout,label:e.unref(a).label,"is-active":e.unref(f)?.isPressed,onPointerdown:m,onPointerup:d,onPointercancel:p,onLostpointercapture:p},null,8,["id","layout","label","is-active"]))}}),V=B(e.defineComponent({__name:"VirtualTrackpad",props:{treeNode:{},widgetId:{},label:{},sensitivity:{},targetStageId:{},layout:{}},setup(r,{expose:t}){const s=r,{uid:n,config:i}=k(l.CMP_TYPES.TRACKPAD,s,{label:"TRACKPAD",sensitivity:1}),{core:a,state:o,elementRef:f}=T(()=>new l.TrackpadCore(n.value,i.value)),P=c=>a.value?.onPointerDown(c),m=c=>a.value?.onPointerMove(c),d=c=>a.value?.onPointerUp(c),p=c=>a.value?.onPointerCancel(c);return t({uid:n,onPointerDown:P,onPointerMove:m,onPointerUp:d,onPointerCancel:p}),(c,g)=>(e.openBlock(),e.createBlock(R,{id:e.unref(n),ref_key:"elementRef",ref:f,class:"omnipad-trackpad",layout:e.unref(i).layout,label:e.unref(i).label,"is-active":e.unref(o)?.isPressed,onPointerdown:P,onPointermove:m,onPointerup:d,onPointercancel:p,onLostpointercapture:p},null,8,["id","layout","label","is-active"]))}}),[["__scopeId","data-v-c28e3a2e"]]);C(l.CMP_TYPES.INPUT_ZONE,$),C(l.CMP_TYPES.ROOT_LAYER,h),C(l.CMP_TYPES.TARGET_ZONE,D),C(l.CMP_TYPES.KEYBOARD_BUTTON,M),C(l.CMP_TYPES.MOUSE_BUTTON,O),C(l.CMP_TYPES.TRACKPAD,V),y.InputZone=$,y.RootLayer=h,y.TargetZone=D,y.VirtualKeyboardButton=M,y.VirtualMouseButton=O,y.VirtualTrackpad=V,y.registerComponent=C,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnipad/vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-alpha.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/omnipad-vue.umd.js",
|
|
6
6
|
"module": "./dist/omnipad-vue.mjs",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"vue": "^3.5.27"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@omnipad/core": "0.
|
|
30
|
+
"@omnipad/core": "0.2.0-alpha.2"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public",
|