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