@benev/tact 0.1.0-3 → 0.1.0-4
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/README.md +111 -103
- package/package.json +7 -7
- package/s/core/bindings/action.ts +14 -4
- package/s/core/bindings/parts/defaults.ts +3 -1
- package/s/core/bindings/parts/lens-algo.ts +17 -13
- package/s/core/bindings/resolver.ts +12 -12
- package/s/core/bindings/sample-map.ts +25 -0
- package/s/core/bindings/types.ts +3 -1
- package/s/core/core.test.ts +46 -34
- package/s/core/devices/auto-gamepads.ts +8 -0
- package/s/core/devices/device.ts +12 -0
- package/s/core/devices/infra/group.ts +24 -0
- package/s/core/devices/infra/sampler.ts +22 -0
- package/s/core/devices/standard/gamepad.ts +83 -0
- package/s/core/{controllers → devices}/standard/index.ts +2 -1
- package/s/core/devices/standard/keyboard.ts +31 -0
- package/s/core/{controllers → devices}/standard/pointer.ts +15 -11
- package/s/core/devices/standard/primary.ts +20 -0
- package/s/core/devices/standard/stick.ts +27 -0
- package/s/core/{controllers/standard/virtual-gamepad.ts → devices/standard/vpad.ts} +9 -9
- package/s/core/{controllers → devices}/types.ts +0 -1
- package/s/core/hub/hub.ts +78 -62
- package/s/core/hub/meta-bindings.ts +23 -0
- package/s/core/hub/parts/connected.ts +15 -0
- package/s/core/hub/port.ts +26 -0
- package/s/core/hub/types.ts +5 -6
- package/s/core/index.ts +12 -14
- package/s/core/testing/testing.ts +19 -14
- package/s/deck/deck.ts +77 -0
- package/s/deck/index.ts +14 -0
- package/s/deck/parts/catalog.ts +58 -0
- package/s/deck/parts/db.ts +66 -0
- package/s/deck/parts/device-skins/device-icons.ts +38 -0
- package/s/deck/parts/device-skins/device-skin.ts +29 -0
- package/s/deck/parts/local-storage-kv.ts +8 -0
- package/s/deck/parts/merge-bindings.ts +21 -0
- package/s/deck/parts/overlay-visibility.ts +49 -0
- package/s/deck/views/deck-overlay/component.ts +48 -0
- package/s/deck/views/deck-overlay/style.css.ts +112 -0
- package/s/deck/views/framework.ts +14 -0
- package/s/demo/game/game.ts +85 -0
- package/s/demo/game/parts/agent.ts +10 -0
- package/s/demo/game/parts/game-bindings.ts +20 -0
- package/s/demo/game/parts/logic.ts +24 -0
- package/s/demo/game/parts/player.ts +32 -0
- package/s/demo/game/parts/renderer.ts +113 -0
- package/s/demo/game/parts/state.ts +24 -0
- package/s/demo/game/parts/virtual-device.ts +13 -0
- package/s/demo/main.bundle.ts +6 -12
- package/s/demo/main.css +30 -2
- package/s/demo/ui/tact-demo/component.ts +13 -0
- package/s/demo/ui/tact-demo/style.css.ts +4 -0
- package/s/demo/ui/theater/styles.css.ts +57 -0
- package/s/demo/ui/theater/view.ts +53 -0
- package/s/demo/ui/theater/virtual/style.css.ts +43 -0
- package/s/demo/ui/theater/virtual/view.ts +31 -0
- package/s/demo/ui/utils/loader.ts +5 -0
- package/s/index.html.ts +16 -6
- package/s/index.ts +3 -1
- package/s/nubs/components.ts +14 -0
- package/s/nubs/index.ts +6 -0
- package/s/nubs/lookpad/component.ts +45 -0
- package/s/nubs/stick/component.ts +115 -0
- package/s/nubs/stick/style.css.ts +70 -0
- package/s/nubs/{virtual-gamepad/view.ts → vpad/component.ts} +21 -11
- package/s/nubs/{virtual-gamepad → vpad}/styles.css.ts +1 -0
- package/s/utils/circular-clamp.ts +15 -0
- package/s/utils/dispensers.ts +20 -0
- package/s/utils/split-axis.ts +10 -2
- package/x/core/bindings/action.d.ts +3 -1
- package/x/core/bindings/action.js +12 -4
- package/x/core/bindings/action.js.map +1 -1
- package/x/core/bindings/parts/defaults.js +3 -1
- package/x/core/bindings/parts/defaults.js.map +1 -1
- package/x/core/bindings/parts/lens-algo.js +14 -7
- package/x/core/bindings/parts/lens-algo.js.map +1 -1
- package/x/core/bindings/resolver.d.ts +5 -4
- package/x/core/bindings/resolver.js +12 -10
- package/x/core/bindings/resolver.js.map +1 -1
- package/x/core/bindings/sample-map.d.ts +7 -0
- package/x/core/bindings/sample-map.js +22 -0
- package/x/core/bindings/sample-map.js.map +1 -0
- package/x/core/bindings/types.d.ts +3 -1
- package/x/core/core.test.d.ts +5 -4
- package/x/core/core.test.js +45 -34
- package/x/core/core.test.js.map +1 -1
- package/x/core/devices/auto-gamepads.d.ts +2 -0
- package/x/core/devices/auto-gamepads.js +6 -0
- package/x/core/devices/auto-gamepads.js.map +1 -0
- package/x/core/devices/device.d.ts +5 -0
- package/x/core/devices/device.js +7 -0
- package/x/core/devices/device.js.map +1 -0
- package/x/core/devices/infra/group.d.ts +8 -0
- package/x/core/devices/infra/group.js +21 -0
- package/x/core/devices/infra/group.js.map +1 -0
- package/x/core/devices/infra/sampler.d.ts +9 -0
- package/x/core/devices/infra/sampler.js +18 -0
- package/x/core/devices/infra/sampler.js.map +1 -0
- package/x/core/devices/standard/gamepad.d.ts +11 -0
- package/x/core/devices/standard/gamepad.js +65 -0
- package/x/core/devices/standard/gamepad.js.map +1 -0
- package/x/core/{controllers → devices}/standard/index.d.ts +2 -1
- package/x/core/{controllers → devices}/standard/index.js +2 -1
- package/x/core/devices/standard/index.js.map +1 -0
- package/x/core/devices/standard/keyboard.d.ts +9 -0
- package/x/core/devices/standard/keyboard.js +28 -0
- package/x/core/devices/standard/keyboard.js.map +1 -0
- package/x/core/devices/standard/pointer.d.ts +15 -0
- package/x/core/{controllers → devices}/standard/pointer.js +14 -11
- package/x/core/devices/standard/pointer.js.map +1 -0
- package/x/core/devices/standard/primary.d.ts +10 -0
- package/x/core/devices/standard/primary.js +17 -0
- package/x/core/devices/standard/primary.js.map +1 -0
- package/x/core/devices/standard/stick.d.ts +15 -0
- package/x/core/devices/standard/stick.js +24 -0
- package/x/core/devices/standard/stick.js.map +1 -0
- package/x/core/devices/standard/vpad.d.ts +7 -0
- package/x/core/{controllers/standard/virtual-gamepad.js → devices/standard/vpad.js} +10 -10
- package/x/core/devices/standard/vpad.js.map +1 -0
- package/x/core/{controllers → devices}/types.d.ts +0 -1
- package/x/core/{controllers → devices}/types.js.map +1 -1
- package/x/core/hub/hub.d.ts +27 -23
- package/x/core/hub/hub.js +71 -61
- package/x/core/hub/hub.js.map +1 -1
- package/x/core/hub/meta-bindings.d.ts +2 -0
- package/x/core/hub/meta-bindings.js +21 -0
- package/x/core/hub/meta-bindings.js.map +1 -0
- package/x/core/hub/parts/connected.d.ts +14 -0
- package/x/core/hub/parts/connected.js +12 -0
- package/x/core/hub/parts/connected.js.map +1 -0
- package/x/core/hub/port.d.ts +10 -0
- package/x/core/hub/port.js +19 -0
- package/x/core/hub/port.js.map +1 -0
- package/x/core/hub/types.d.ts +5 -5
- package/x/core/hub/types.js +1 -1
- package/x/core/hub/types.js.map +1 -1
- package/x/core/index.d.ts +12 -12
- package/x/core/index.js +12 -12
- package/x/core/index.js.map +1 -1
- package/x/core/testing/testing.d.ts +13 -11
- package/x/core/testing/testing.js +14 -13
- package/x/core/testing/testing.js.map +1 -1
- package/x/deck/deck.d.ts +35 -0
- package/x/deck/deck.js +50 -0
- package/x/deck/deck.js.map +1 -0
- package/x/deck/index.d.ts +10 -0
- package/x/deck/index.js +11 -0
- package/x/deck/index.js.map +1 -0
- package/x/deck/parts/catalog.d.ts +23 -0
- package/x/deck/parts/catalog.js +35 -0
- package/x/deck/parts/catalog.js.map +1 -0
- package/x/deck/parts/db.d.ts +20 -0
- package/x/deck/parts/db.js +52 -0
- package/x/deck/parts/db.js.map +1 -0
- package/x/deck/parts/device-skins/device-icons.d.ts +12 -0
- package/x/deck/parts/device-skins/device-icons.js +27 -0
- package/x/deck/parts/device-skins/device-icons.js.map +1 -0
- package/x/deck/parts/device-skins/device-skin.d.ts +14 -0
- package/x/deck/parts/device-skins/device-skin.js +22 -0
- package/x/deck/parts/device-skins/device-skin.js.map +1 -0
- package/x/deck/parts/local-storage-kv.js +6 -0
- package/x/deck/parts/local-storage-kv.js.map +1 -0
- package/x/deck/parts/merge-bindings.d.ts +2 -0
- package/x/deck/parts/merge-bindings.js +15 -0
- package/x/deck/parts/merge-bindings.js.map +1 -0
- package/x/deck/parts/overlay-visibility.d.ts +21 -0
- package/x/deck/parts/overlay-visibility.js +35 -0
- package/x/deck/parts/overlay-visibility.js.map +1 -0
- package/x/deck/views/deck-overlay/component.d.ts +2 -0
- package/x/deck/views/deck-overlay/component.js +40 -0
- package/x/deck/views/deck-overlay/component.js.map +1 -0
- package/x/deck/views/deck-overlay/style.css.js +109 -0
- package/x/deck/views/deck-overlay/style.css.js.map +1 -0
- package/x/deck/views/framework.d.ts +3 -0
- package/x/deck/views/framework.js +8 -0
- package/x/deck/views/framework.js.map +1 -0
- package/x/demo/game/game.d.ts +20 -0
- package/x/demo/game/game.js +63 -0
- package/x/demo/game/game.js.map +1 -0
- package/x/demo/game/parts/agent.d.ts +7 -0
- package/x/demo/game/parts/agent.js +8 -0
- package/x/demo/game/parts/agent.js.map +1 -0
- package/x/demo/game/parts/game-bindings.d.ts +15 -0
- package/x/demo/game/parts/game-bindings.js +10 -0
- package/x/demo/game/parts/game-bindings.js.map +1 -0
- package/x/demo/game/parts/logic.d.ts +8 -0
- package/x/demo/game/parts/logic.js +21 -0
- package/x/demo/game/parts/logic.js.map +1 -0
- package/x/demo/game/parts/player.d.ts +14 -0
- package/x/demo/game/parts/player.js +26 -0
- package/x/demo/game/parts/player.js.map +1 -0
- package/x/demo/game/parts/renderer.d.ts +13 -0
- package/x/demo/game/parts/renderer.js +91 -0
- package/x/demo/game/parts/renderer.js.map +1 -0
- package/x/demo/game/parts/state.d.ts +8 -0
- package/x/demo/game/parts/state.js +20 -0
- package/x/demo/game/parts/state.js.map +1 -0
- package/x/demo/game/parts/virtual-device.d.ts +8 -0
- package/x/demo/game/parts/virtual-device.js +11 -0
- package/x/demo/game/parts/virtual-device.js.map +1 -0
- package/x/demo/main.bundle.js +4 -10
- package/x/demo/main.bundle.js.map +1 -1
- package/x/demo/main.bundle.min.js +315 -54
- package/x/demo/main.bundle.min.js.map +4 -4
- package/x/demo/main.css +30 -2
- package/x/demo/ui/tact-demo/component.d.ts +4 -0
- package/x/demo/ui/tact-demo/component.js +12 -0
- package/x/demo/ui/tact-demo/component.js.map +1 -0
- package/x/demo/ui/tact-demo/style.css.d.ts +2 -0
- package/x/demo/ui/tact-demo/style.css.js +3 -0
- package/x/demo/ui/tact-demo/style.css.js.map +1 -0
- package/x/demo/ui/theater/styles.css.js +56 -0
- package/x/demo/ui/theater/styles.css.js.map +1 -0
- package/x/demo/ui/theater/view.d.ts +2 -0
- package/x/demo/ui/theater/view.js +42 -0
- package/x/demo/ui/theater/view.js.map +1 -0
- package/x/demo/ui/theater/virtual/style.css.d.ts +2 -0
- package/x/demo/ui/theater/virtual/style.css.js +42 -0
- package/x/demo/ui/theater/virtual/style.css.js.map +1 -0
- package/x/demo/ui/theater/virtual/view.d.ts +4 -0
- package/x/demo/ui/theater/virtual/view.js +19 -0
- package/x/demo/ui/theater/virtual/view.js.map +1 -0
- package/x/demo/ui/utils/loader.d.ts +1 -0
- package/x/demo/ui/utils/loader.js +3 -0
- package/x/demo/ui/utils/loader.js.map +1 -0
- package/x/index.d.ts +3 -1
- package/x/index.html +47 -8
- package/x/index.html.js +16 -6
- package/x/index.html.js.map +1 -1
- package/x/index.js +3 -1
- package/x/index.js.map +1 -1
- package/x/nubs/components.d.ts +9 -0
- package/x/nubs/components.js +11 -0
- package/x/nubs/components.js.map +1 -0
- package/x/nubs/index.d.ts +4 -0
- package/x/nubs/index.js +5 -0
- package/x/nubs/index.js.map +1 -0
- package/x/nubs/lookpad/component.d.ts +4 -0
- package/x/nubs/lookpad/component.js +36 -0
- package/x/nubs/lookpad/component.js.map +1 -0
- package/x/nubs/stick/component.d.ts +368 -0
- package/x/nubs/stick/component.js +101 -0
- package/x/nubs/stick/component.js.map +1 -0
- package/x/nubs/stick/style.css.d.ts +2 -0
- package/x/nubs/stick/style.css.js +69 -0
- package/x/nubs/stick/style.css.js.map +1 -0
- package/x/nubs/vpad/component.d.ts +368 -0
- package/x/nubs/{virtual-gamepad/view.js → vpad/component.js} +20 -11
- package/x/nubs/vpad/component.js.map +1 -0
- package/x/nubs/vpad/styles.css.d.ts +2 -0
- package/x/nubs/vpad/styles.css.js.map +1 -0
- package/x/nubs/vpad/utils/gamepad-inputs.js.map +1 -0
- package/x/nubs/vpad/utils/prevent-default-touch-shenanigans.js.map +1 -0
- package/x/nubs/vpad/utils/touch-tracking.js.map +1 -0
- package/x/utils/circular-clamp.d.ts +2 -0
- package/x/utils/circular-clamp.js +8 -0
- package/x/utils/circular-clamp.js.map +1 -0
- package/x/utils/dispensers.d.ts +7 -0
- package/x/utils/dispensers.js +16 -0
- package/x/utils/dispensers.js.map +1 -0
- package/x/utils/split-axis.d.ts +7 -0
- package/x/utils/split-axis.js +7 -2
- package/x/utils/split-axis.js.map +1 -1
- package/s/core/controllers/controller.ts +0 -7
- package/s/core/controllers/infra/group.ts +0 -17
- package/s/core/controllers/infra/sampler.ts +0 -22
- package/s/core/controllers/standard/gamepad.ts +0 -77
- package/s/core/controllers/standard/keyboard.ts +0 -50
- package/s/core/controllers/standard/stick.ts +0 -30
- package/s/core/deck/deck.ts +0 -40
- package/s/core/deck/parts/bindings-depot.ts +0 -24
- package/s/core/deck/parts/local-storage-kv.ts +0 -7
- package/s/core/hub/auto-gamepads.ts +0 -8
- package/s/core/hub/bindings.ts +0 -18
- package/s/core/port/port.ts +0 -34
- package/s/core/port/utils/aggregate_samples_into_map.ts +0 -20
- package/s/core/port/utils/wipe_samples_map.ts +0 -8
- package/s/nubs/lookpad/utils/listeners.ts +0 -53
- package/s/nubs/lookpad/view.ts +0 -32
- package/s/nubs/stick/styles.ts +0 -22
- package/s/nubs/stick/utils/calculate_new_vector_from_pointer_position.ts +0 -27
- package/s/nubs/stick/utils/find_closest_point_on_circle.ts +0 -15
- package/s/nubs/stick/utils/make_pointer_listeners.ts +0 -50
- package/s/nubs/stick/utils/within_radius.ts +0 -6
- package/s/nubs/stick/view.ts +0 -50
- package/s/nubs/stick-graphic/styles.ts +0 -38
- package/s/nubs/stick-graphic/types/basis.ts +0 -5
- package/s/nubs/stick-graphic/utils/calculate_basis.ts +0 -19
- package/s/nubs/stick-graphic/utils/stick_vector_to_pixels.ts +0 -13
- package/s/nubs/stick-graphic/utils/transform.ts +0 -10
- package/s/nubs/stick-graphic/view.ts +0 -43
- package/x/core/controllers/controller.d.ts +0 -4
- package/x/core/controllers/controller.js +0 -3
- package/x/core/controllers/controller.js.map +0 -1
- package/x/core/controllers/infra/group.d.ts +0 -7
- package/x/core/controllers/infra/group.js +0 -13
- package/x/core/controllers/infra/group.js.map +0 -1
- package/x/core/controllers/infra/sampler.d.ts +0 -8
- package/x/core/controllers/infra/sampler.js +0 -17
- package/x/core/controllers/infra/sampler.js.map +0 -1
- package/x/core/controllers/standard/gamepad.d.ts +0 -9
- package/x/core/controllers/standard/gamepad.js +0 -66
- package/x/core/controllers/standard/gamepad.js.map +0 -1
- package/x/core/controllers/standard/index.js.map +0 -1
- package/x/core/controllers/standard/keyboard.d.ts +0 -9
- package/x/core/controllers/standard/keyboard.js +0 -39
- package/x/core/controllers/standard/keyboard.js.map +0 -1
- package/x/core/controllers/standard/pointer.d.ts +0 -11
- package/x/core/controllers/standard/pointer.js.map +0 -1
- package/x/core/controllers/standard/stick.d.ts +0 -15
- package/x/core/controllers/standard/stick.js +0 -27
- package/x/core/controllers/standard/stick.js.map +0 -1
- package/x/core/controllers/standard/virtual-gamepad.d.ts +0 -7
- package/x/core/controllers/standard/virtual-gamepad.js.map +0 -1
- package/x/core/deck/deck.d.ts +0 -16
- package/x/core/deck/deck.js +0 -31
- package/x/core/deck/deck.js.map +0 -1
- package/x/core/deck/parts/bindings-depot.d.ts +0 -9
- package/x/core/deck/parts/bindings-depot.js +0 -19
- package/x/core/deck/parts/bindings-depot.js.map +0 -1
- package/x/core/deck/parts/local-storage-kv.js +0 -5
- package/x/core/deck/parts/local-storage-kv.js.map +0 -1
- package/x/core/hub/auto-gamepads.d.ts +0 -2
- package/x/core/hub/auto-gamepads.js +0 -6
- package/x/core/hub/auto-gamepads.js.map +0 -1
- package/x/core/hub/bindings.d.ts +0 -2
- package/x/core/hub/bindings.js +0 -16
- package/x/core/hub/bindings.js.map +0 -1
- package/x/core/port/port.d.ts +0 -12
- package/x/core/port/port.js +0 -25
- package/x/core/port/port.js.map +0 -1
- package/x/core/port/utils/aggregate_samples_into_map.d.ts +0 -3
- package/x/core/port/utils/aggregate_samples_into_map.js +0 -11
- package/x/core/port/utils/aggregate_samples_into_map.js.map +0 -1
- package/x/core/port/utils/wipe_samples_map.d.ts +0 -2
- package/x/core/port/utils/wipe_samples_map.js +0 -5
- package/x/core/port/utils/wipe_samples_map.js.map +0 -1
- package/x/nubs/lookpad/utils/listeners.d.ts +0 -19
- package/x/nubs/lookpad/utils/listeners.js +0 -37
- package/x/nubs/lookpad/utils/listeners.js.map +0 -1
- package/x/nubs/lookpad/view.d.ts +0 -1
- package/x/nubs/lookpad/view.js +0 -24
- package/x/nubs/lookpad/view.js.map +0 -1
- package/x/nubs/stick/styles.d.ts +0 -1
- package/x/nubs/stick/styles.js +0 -22
- package/x/nubs/stick/styles.js.map +0 -1
- package/x/nubs/stick/utils/calculate_new_vector_from_pointer_position.d.ts +0 -3
- package/x/nubs/stick/utils/calculate_new_vector_from_pointer_position.js +0 -16
- package/x/nubs/stick/utils/calculate_new_vector_from_pointer_position.js.map +0 -1
- package/x/nubs/stick/utils/find_closest_point_on_circle.d.ts +0 -2
- package/x/nubs/stick/utils/find_closest_point_on_circle.js +0 -6
- package/x/nubs/stick/utils/find_closest_point_on_circle.js.map +0 -1
- package/x/nubs/stick/utils/make_pointer_listeners.d.ts +0 -16
- package/x/nubs/stick/utils/make_pointer_listeners.js +0 -34
- package/x/nubs/stick/utils/make_pointer_listeners.js.map +0 -1
- package/x/nubs/stick/utils/within_radius.d.ts +0 -2
- package/x/nubs/stick/utils/within_radius.js +0 -4
- package/x/nubs/stick/utils/within_radius.js.map +0 -1
- package/x/nubs/stick/view.d.ts +0 -2
- package/x/nubs/stick/view.js +0 -38
- package/x/nubs/stick/view.js.map +0 -1
- package/x/nubs/stick-graphic/styles.js +0 -38
- package/x/nubs/stick-graphic/styles.js.map +0 -1
- package/x/nubs/stick-graphic/types/basis.d.ts +0 -4
- package/x/nubs/stick-graphic/types/basis.js +0 -2
- package/x/nubs/stick-graphic/types/basis.js.map +0 -1
- package/x/nubs/stick-graphic/utils/calculate_basis.d.ts +0 -2
- package/x/nubs/stick-graphic/utils/calculate_basis.js +0 -10
- package/x/nubs/stick-graphic/utils/calculate_basis.js.map +0 -1
- package/x/nubs/stick-graphic/utils/stick_vector_to_pixels.d.ts +0 -2
- package/x/nubs/stick-graphic/utils/stick_vector_to_pixels.js +0 -7
- package/x/nubs/stick-graphic/utils/stick_vector_to_pixels.js.map +0 -1
- package/x/nubs/stick-graphic/utils/transform.d.ts +0 -2
- package/x/nubs/stick-graphic/utils/transform.js +0 -7
- package/x/nubs/stick-graphic/utils/transform.js.map +0 -1
- package/x/nubs/stick-graphic/view.d.ts +0 -3
- package/x/nubs/stick-graphic/view.js +0 -30
- package/x/nubs/stick-graphic/view.js.map +0 -1
- package/x/nubs/virtual-gamepad/styles.css.js.map +0 -1
- package/x/nubs/virtual-gamepad/utils/gamepad-inputs.js.map +0 -1
- package/x/nubs/virtual-gamepad/utils/prevent-default-touch-shenanigans.js.map +0 -1
- package/x/nubs/virtual-gamepad/utils/touch-tracking.js.map +0 -1
- package/x/nubs/virtual-gamepad/view.d.ts +0 -2
- package/x/nubs/virtual-gamepad/view.js.map +0 -1
- /package/s/nubs/{virtual-gamepad → vpad}/utils/gamepad-inputs.ts +0 -0
- /package/s/nubs/{virtual-gamepad → vpad}/utils/prevent-default-touch-shenanigans.ts +0 -0
- /package/s/nubs/{virtual-gamepad → vpad}/utils/touch-tracking.ts +0 -0
- /package/x/core/{controllers → devices}/types.js +0 -0
- /package/x/{core/deck → deck}/parts/local-storage-kv.d.ts +0 -0
- /package/x/{nubs/virtual-gamepad/styles.css.d.ts → deck/views/deck-overlay/style.css.d.ts} +0 -0
- /package/x/{nubs/stick-graphic/styles.d.ts → demo/ui/theater/styles.css.d.ts} +0 -0
- /package/x/nubs/{virtual-gamepad → vpad}/styles.css.js +0 -0
- /package/x/nubs/{virtual-gamepad → vpad}/utils/gamepad-inputs.d.ts +0 -0
- /package/x/nubs/{virtual-gamepad → vpad}/utils/gamepad-inputs.js +0 -0
- /package/x/nubs/{virtual-gamepad → vpad}/utils/prevent-default-touch-shenanigans.d.ts +0 -0
- /package/x/nubs/{virtual-gamepad → vpad}/utils/prevent-default-touch-shenanigans.js +0 -0
- /package/x/nubs/{virtual-gamepad → vpad}/utils/touch-tracking.d.ts +0 -0
- /package/x/nubs/{virtual-gamepad → vpad}/utils/touch-tracking.js +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
import {MetaBindings, metaMode} from "./types.js"
|
|
3
|
+
|
|
4
|
+
export const makeMetaBindings = (): MetaBindings => ({
|
|
5
|
+
[metaMode]: {
|
|
6
|
+
revealOverlay: ["or",
|
|
7
|
+
"Backslash",
|
|
8
|
+
"gamepad.beta",
|
|
9
|
+
"gamepad.gamma",
|
|
10
|
+
],
|
|
11
|
+
shimmyNext: ["or",
|
|
12
|
+
"BracketRight",
|
|
13
|
+
["and", ["or", "gamepad.beta", "gamepad.gamma"], "gamepad.right"],
|
|
14
|
+
["and", ["or", "gamepad.beta", "gamepad.gamma"], "gamepad.bumper.right"],
|
|
15
|
+
],
|
|
16
|
+
shimmyPrevious: ["or",
|
|
17
|
+
"BracketLeft",
|
|
18
|
+
["and", ["or", "gamepad.beta", "gamepad.gamma"], "gamepad.left"],
|
|
19
|
+
["and", ["or", "gamepad.beta", "gamepad.gamma"], "gamepad.bumper.left"],
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
})
|
|
23
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
import {Port} from "../port.js"
|
|
3
|
+
import {MetaBindings} from "../types.js"
|
|
4
|
+
import {Device} from "../../devices/device.js"
|
|
5
|
+
import {makeMetaBindings} from "../meta-bindings.js"
|
|
6
|
+
|
|
7
|
+
export class Connected {
|
|
8
|
+
metaPort: Port<MetaBindings>
|
|
9
|
+
|
|
10
|
+
constructor(public device: Device, metaB = makeMetaBindings()) {
|
|
11
|
+
this.metaPort = new Port(metaB)
|
|
12
|
+
this.metaPort.devices.add(device)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
import {SetG} from "@e280/stz"
|
|
3
|
+
import {Bindings} from "../bindings/types.js"
|
|
4
|
+
import {Resolver} from "../bindings/resolver.js"
|
|
5
|
+
import {SampleMap} from "../bindings/sample-map.js"
|
|
6
|
+
import {GroupDevice} from "../devices/infra/group.js"
|
|
7
|
+
|
|
8
|
+
export class Port<B extends Bindings> extends Resolver<B> {
|
|
9
|
+
#group = new GroupDevice()
|
|
10
|
+
|
|
11
|
+
readonly devices = this.#group.devices
|
|
12
|
+
readonly modes = new SetG<keyof B>()
|
|
13
|
+
|
|
14
|
+
constructor(bindings: B) {
|
|
15
|
+
super(bindings)
|
|
16
|
+
|
|
17
|
+
// start with all modes enabled by default
|
|
18
|
+
this.modes.adds(...Object.keys(bindings))
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
resolve(now = Date.now()) {
|
|
22
|
+
const sampleMap = new SampleMap(this.#group.samples())
|
|
23
|
+
return super.resolve(now, this.modes, sampleMap)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
package/s/core/hub/types.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
import {AsBindings, Atom
|
|
2
|
+
import {AsBindings, Atom} from "../bindings/types.js"
|
|
3
3
|
|
|
4
|
-
export const
|
|
4
|
+
export const metaMode = "meta" as const
|
|
5
5
|
|
|
6
|
-
export type
|
|
7
|
-
[
|
|
6
|
+
export type MetaBindings = AsBindings<{
|
|
7
|
+
[metaMode]: {
|
|
8
|
+
revealOverlay: Atom
|
|
8
9
|
shimmyNext: Atom
|
|
9
10
|
shimmyPrevious: Atom
|
|
10
11
|
}
|
|
11
12
|
}>
|
|
12
13
|
|
|
13
|
-
export type HubFriendlyBindings = Bindings & HubBindings
|
|
14
|
-
|
package/s/core/index.ts
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
|
|
2
2
|
export * from "./bindings/action.js"
|
|
3
|
+
export * from "./bindings/resolver.js"
|
|
4
|
+
export * from "./bindings/sample-map.js"
|
|
3
5
|
export * from "./bindings/types.js"
|
|
4
6
|
|
|
5
|
-
export *
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
10
|
-
export * from "./
|
|
7
|
+
export * from "./devices/infra/group.js"
|
|
8
|
+
export * from "./devices/infra/sampler.js"
|
|
9
|
+
export * from "./devices/standard/index.js"
|
|
10
|
+
export * as devices from "./devices/standard/index.js"
|
|
11
|
+
export * from "./devices/auto-gamepads.js"
|
|
12
|
+
export * from "./devices/device.js"
|
|
13
|
+
export * from "./devices/types.js"
|
|
11
14
|
|
|
12
|
-
export * from "./deck/parts/bindings-depot.js"
|
|
13
|
-
export * from "./deck/parts/local-storage-kv.js"
|
|
14
|
-
export * from "./deck/deck.js"
|
|
15
|
-
|
|
16
|
-
export * from "./hub/auto-gamepads.js"
|
|
17
|
-
export * from "./hub/bindings.js"
|
|
18
15
|
export * from "./hub/hub.js"
|
|
19
|
-
|
|
20
|
-
export * from "./
|
|
16
|
+
export * from "./hub/meta-bindings.js"
|
|
17
|
+
export * from "./hub/port.js"
|
|
18
|
+
export * from "./hub/types.js"
|
|
21
19
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
import {Hub} from "../hub/hub.js"
|
|
3
|
-
import {Port} from "../
|
|
3
|
+
import {Port} from "../hub/port.js"
|
|
4
|
+
import {Device} from "../devices/device.js"
|
|
4
5
|
import {asBindings} from "../bindings/types.js"
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import {Resolver} from "../bindings/resolver.js"
|
|
7
|
+
import {SampleMap} from "../bindings/sample-map.js"
|
|
8
|
+
import {SamplerDevice} from "../devices/infra/sampler.js"
|
|
8
9
|
|
|
9
10
|
export class TestTime {
|
|
10
11
|
frame = 0
|
|
@@ -23,25 +24,29 @@ export function testBindings() {
|
|
|
23
24
|
})
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
export function
|
|
27
|
-
|
|
28
|
-
return
|
|
27
|
+
export function testPlug<C extends Device>(hub: Hub<any>, device: C) {
|
|
28
|
+
hub.plug(device)
|
|
29
|
+
return device
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
export function testSetupAlpha() {
|
|
32
33
|
const time = new TestTime()
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
const device = new SamplerDevice()
|
|
35
|
+
const resolver = new Resolver(testBindings())
|
|
36
|
+
const modes = new Set(Object.keys(resolver.bindings))
|
|
37
|
+
const resolve = () => resolver.resolve(
|
|
38
|
+
time.now,
|
|
39
|
+
modes as any,
|
|
40
|
+
new SampleMap(device.samples())
|
|
41
|
+
)
|
|
42
|
+
return {device, resolver, resolve, time}
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
export function testSetupBravo() {
|
|
41
46
|
const time = new TestTime()
|
|
42
47
|
const port = () => {
|
|
43
|
-
const port = new Port(
|
|
44
|
-
port.modes.adds(
|
|
48
|
+
const port = new Port(testBindings())
|
|
49
|
+
port.modes.adds("basic")
|
|
45
50
|
return port
|
|
46
51
|
}
|
|
47
52
|
const hub = new Hub([port(), port(), port(), port()])
|
package/s/deck/deck.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
|
|
2
|
+
import {Kv} from "@e280/kv"
|
|
3
|
+
import {disposer, ob, range} from "@e280/stz"
|
|
4
|
+
|
|
5
|
+
import {Db} from "./parts/db.js"
|
|
6
|
+
import {Hub} from "../core/hub/hub.js"
|
|
7
|
+
import {Port} from "../core/hub/port.js"
|
|
8
|
+
import {Bindings} from "../core/bindings/types.js"
|
|
9
|
+
import {mergeBindings} from "./parts/merge-bindings.js"
|
|
10
|
+
import {MetaBindings, metaMode} from "../core/hub/types.js"
|
|
11
|
+
import {autoGamepads} from "../core/devices/auto-gamepads.js"
|
|
12
|
+
import {DeckOverlay} from "./views/deck-overlay/component.js"
|
|
13
|
+
import {makeMetaBindings} from "../core/hub/meta-bindings.js"
|
|
14
|
+
import {DeviceSkins} from "./parts/device-skins/device-skin.js"
|
|
15
|
+
import {OverlayVisibility} from "./parts/overlay-visibility.js"
|
|
16
|
+
import {PrimaryDevice} from "../core/devices/standard/primary.js"
|
|
17
|
+
import { dom } from "@e280/sly"
|
|
18
|
+
|
|
19
|
+
export type DeckOptions<B extends Bindings, MB extends MetaBindings = any> = {
|
|
20
|
+
kv: Kv
|
|
21
|
+
bindings: B
|
|
22
|
+
portCount: number
|
|
23
|
+
metaBindings?: MB
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export class Deck<B extends Bindings, MB extends MetaBindings = any> {
|
|
27
|
+
static async load<B extends Bindings, MB extends MetaBindings = any>(options: DeckOptions<B, MB>) {
|
|
28
|
+
const db = await Db.load(options.kv.store("catalog"))
|
|
29
|
+
|
|
30
|
+
const ports = range(options.portCount)
|
|
31
|
+
.map(index => db.$catalog().getProfileForPort(index))
|
|
32
|
+
.map(profile => mergeBindings(options.bindings, profile?.bindings))
|
|
33
|
+
.map(bindings => new Port<B>(bindings as B))
|
|
34
|
+
|
|
35
|
+
const hub = new Hub<B>(
|
|
36
|
+
ports,
|
|
37
|
+
db.$catalog().metaBindings
|
|
38
|
+
?? options.metaBindings
|
|
39
|
+
?? makeMetaBindings(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
return new this(hub, db)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
dispose = disposer()
|
|
46
|
+
deviceSkins = new DeviceSkins()
|
|
47
|
+
overlayVisibility: OverlayVisibility
|
|
48
|
+
primaryDevice = new PrimaryDevice()
|
|
49
|
+
|
|
50
|
+
views = ob({DeckOverlay}).map(fn => fn(this))
|
|
51
|
+
components = ob(this.views).map(v => v.component().props(_c => []))
|
|
52
|
+
|
|
53
|
+
registerComponents() {
|
|
54
|
+
dom.register(this.components)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
constructor(
|
|
58
|
+
public hub: Hub<B, MB>,
|
|
59
|
+
public db: Db,
|
|
60
|
+
) {
|
|
61
|
+
|
|
62
|
+
this.overlayVisibility = new OverlayVisibility(hub, this.deviceSkins)
|
|
63
|
+
|
|
64
|
+
// meta reveal overlay
|
|
65
|
+
this.dispose.schedule(
|
|
66
|
+
hub.metaPort.actions[metaMode].revealOverlay.on(action => {
|
|
67
|
+
if (action.pressed)
|
|
68
|
+
this.overlayVisibility.bump()
|
|
69
|
+
})
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
get catalog() {
|
|
74
|
+
return this.db.$catalog()
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
package/s/deck/index.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
export * from "./parts/device-skins/device-icons.js"
|
|
3
|
+
export * from "./parts/device-skins/device-skin.js"
|
|
4
|
+
export * from "./parts/catalog.js"
|
|
5
|
+
export * from "./parts/db.js"
|
|
6
|
+
export * from "./parts/local-storage-kv.js"
|
|
7
|
+
export * from "./parts/merge-bindings.js"
|
|
8
|
+
export * from "./parts/overlay-visibility.js"
|
|
9
|
+
|
|
10
|
+
export * from "./views/deck-overlay/component.js"
|
|
11
|
+
export * from "./views/deck-overlay/style.css.js"
|
|
12
|
+
|
|
13
|
+
export * from "./deck.js"
|
|
14
|
+
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
|
|
2
|
+
import {deep, MapG} from "@e280/stz"
|
|
3
|
+
import {MetaBindings} from "../../core/hub/types.js"
|
|
4
|
+
import {Bindings} from "../../core/bindings/types.js"
|
|
5
|
+
|
|
6
|
+
export type Profile = {
|
|
7
|
+
id: string
|
|
8
|
+
label: string
|
|
9
|
+
bindings: Bindings
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type CatalogData = {
|
|
13
|
+
profiles: Profile[]
|
|
14
|
+
portProfiles: (string | null)[]
|
|
15
|
+
metaBindings: MetaBindings | null
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export class Catalog {
|
|
19
|
+
profiles = new MapG<string, Profile>()
|
|
20
|
+
portProfiles: (string | null)[] = []
|
|
21
|
+
metaBindings: MetaBindings | null = null
|
|
22
|
+
|
|
23
|
+
constructor(data?: CatalogData) {
|
|
24
|
+
if (data) {
|
|
25
|
+
for (const profile of data.profiles)
|
|
26
|
+
this.profiles.set(profile.id, profile)
|
|
27
|
+
|
|
28
|
+
this.portProfiles = data.portProfiles
|
|
29
|
+
.map(id => id && (this.profiles.has(id) ?id :null))
|
|
30
|
+
|
|
31
|
+
this.metaBindings = data.metaBindings
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
toJSON(): CatalogData {
|
|
36
|
+
return deep.clone({
|
|
37
|
+
profiles: [...this.profiles.values()],
|
|
38
|
+
portProfiles: this.portProfiles,
|
|
39
|
+
metaBindings: this.metaBindings,
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
clone() {
|
|
44
|
+
return new Catalog(this.toJSON())
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
getProfile(profileId: string) {
|
|
48
|
+
return this.profiles.get(profileId)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
getProfileForPort(portIndex: number) {
|
|
52
|
+
const profileId = this.portProfiles.at(portIndex)
|
|
53
|
+
return profileId
|
|
54
|
+
? this.getProfile(profileId)
|
|
55
|
+
: undefined
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
|
|
2
|
+
import {disposer, Hex} from "@e280/stz"
|
|
3
|
+
import {signal, SignalFn} from "@e280/strata"
|
|
4
|
+
import {StorageDriver, Store} from "@e280/kv"
|
|
5
|
+
|
|
6
|
+
import {Bindings} from "../../core/bindings/types.js"
|
|
7
|
+
import {Catalog, CatalogData, Profile} from "./catalog.js"
|
|
8
|
+
|
|
9
|
+
export class Db {
|
|
10
|
+
static async load(store: Store<CatalogData>) {
|
|
11
|
+
const $catalog = signal(new Catalog(await store.get()))
|
|
12
|
+
return new this(store, $catalog)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
dispose = disposer()
|
|
16
|
+
|
|
17
|
+
constructor(
|
|
18
|
+
private store: Store<CatalogData>,
|
|
19
|
+
public $catalog: SignalFn<Catalog>,
|
|
20
|
+
) {
|
|
21
|
+
|
|
22
|
+
this.dispose.schedule(
|
|
23
|
+
StorageDriver.onStorageEvent(async() => this.reload())
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async reload() {
|
|
28
|
+
const fresh = new Catalog(await this.store.get())
|
|
29
|
+
await this.$catalog.set(fresh)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async save(catalog: Catalog) {
|
|
33
|
+
await this.store.set(catalog.toJSON())
|
|
34
|
+
await this.$catalog(catalog)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async #mutateAndSave<R>(fn: (catalog: Catalog) => R) {
|
|
38
|
+
const catalog = this.$catalog().clone()
|
|
39
|
+
const result = fn(catalog)
|
|
40
|
+
await this.store.set(catalog.toJSON())
|
|
41
|
+
await this.$catalog(catalog)
|
|
42
|
+
return result
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async createProfile(label: string, bindings: Bindings) {
|
|
46
|
+
return this.#mutateAndSave(catalog => {
|
|
47
|
+
const id = Hex.random()
|
|
48
|
+
const profile: Profile = {id, label, bindings}
|
|
49
|
+
catalog.profiles.set(id, profile)
|
|
50
|
+
return profile
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async deleteProfile(id: string) {
|
|
55
|
+
return this.#mutateAndSave(catalog => {
|
|
56
|
+
catalog.profiles.delete(id)
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async assignPortToProfile(index: number, profileId: string | null) {
|
|
61
|
+
return this.#mutateAndSave(catalog => {
|
|
62
|
+
catalog.portProfiles[index] = profileId
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
import {Content} from "@e280/sly"
|
|
3
|
+
import {Constructor} from "@e280/stz"
|
|
4
|
+
import {Device} from "../../../core/devices/device.js"
|
|
5
|
+
import {VpadDevice} from "../../../core/devices/standard/vpad.js"
|
|
6
|
+
import {PrimaryDevice} from "../../../core/devices/standard/primary.js"
|
|
7
|
+
import {GamepadDevice} from "../../../core/devices/standard/gamepad.js"
|
|
8
|
+
|
|
9
|
+
export type DeviceIconEntry = [DeviceClass: Constructor<Device>, icon: Content]
|
|
10
|
+
|
|
11
|
+
export class DeviceIcons {
|
|
12
|
+
fallback: Content = "❔"
|
|
13
|
+
#map = new Map<Constructor<Device>, Content>()
|
|
14
|
+
|
|
15
|
+
constructor(entries: DeviceIconEntry[] = [
|
|
16
|
+
[PrimaryDevice, "💻"],
|
|
17
|
+
[GamepadDevice, "🎮"],
|
|
18
|
+
[VpadDevice, "📱"],
|
|
19
|
+
]) {
|
|
20
|
+
this.add(...entries)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
get(DeviceClass: Constructor<Device>) {
|
|
24
|
+
return this.#map.get(DeviceClass) ?? this.fallback
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
add(...entries: DeviceIconEntry[]) {
|
|
28
|
+
for (const [dc, icon] of entries)
|
|
29
|
+
this.#map.set(dc, icon)
|
|
30
|
+
return this
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
clear() {
|
|
34
|
+
this.#map.clear()
|
|
35
|
+
return this
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
import {Content} from "@e280/sly"
|
|
3
|
+
import {Hex, WeakMapG} from "@e280/stz"
|
|
4
|
+
import {DeviceIcons} from "./device-icons.js"
|
|
5
|
+
import {Device} from "../../../core/devices/device.js"
|
|
6
|
+
import {ColorDispenser} from "../../../utils/dispensers.js"
|
|
7
|
+
|
|
8
|
+
export class DeviceSkin {
|
|
9
|
+
constructor(
|
|
10
|
+
public icon: Content,
|
|
11
|
+
public label: string,
|
|
12
|
+
public color: string,
|
|
13
|
+
) {}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class DeviceSkins {
|
|
17
|
+
icons = new DeviceIcons()
|
|
18
|
+
#map = new WeakMapG<Device, DeviceSkin>()
|
|
19
|
+
#colors = new ColorDispenser()
|
|
20
|
+
|
|
21
|
+
get(device: Device) {
|
|
22
|
+
return this.#map.guarantee(device, () => new DeviceSkin(
|
|
23
|
+
this.icons.get(device.constructor as any),
|
|
24
|
+
Hex.random(4),
|
|
25
|
+
this.#colors.takeFirst(),
|
|
26
|
+
))
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
import {deep} from "@e280/stz"
|
|
3
|
+
import {Bindings} from "../../core/bindings/types.js"
|
|
4
|
+
|
|
5
|
+
export function mergeBindings<B extends Bindings>(normative: B, sus?: B) {
|
|
6
|
+
const bindings = deep.clone(normative)
|
|
7
|
+
|
|
8
|
+
if (!sus)
|
|
9
|
+
return bindings
|
|
10
|
+
|
|
11
|
+
for (const [mode, bracket] of Object.entries(bindings)) {
|
|
12
|
+
for (const actionKey of Object.keys(bracket)) {
|
|
13
|
+
const susAction = sus[mode]?.[actionKey]
|
|
14
|
+
if (susAction)
|
|
15
|
+
bracket[actionKey] = susAction
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return bindings
|
|
20
|
+
}
|
|
21
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
|
|
2
|
+
import {signal} from "@e280/strata"
|
|
3
|
+
import {debounce, disposer} from "@e280/stz"
|
|
4
|
+
import {Hub} from "../../core/hub/hub.js"
|
|
5
|
+
import {DeviceSkins} from "./device-skins/device-skin.js"
|
|
6
|
+
|
|
7
|
+
export class OverlayVisibility {
|
|
8
|
+
auto = true
|
|
9
|
+
dispose = disposer()
|
|
10
|
+
|
|
11
|
+
#created = Date.now()
|
|
12
|
+
#$auto = signal(false)
|
|
13
|
+
|
|
14
|
+
/** manual override for whether the ports view should be visible */
|
|
15
|
+
readonly $manual = signal(false)
|
|
16
|
+
|
|
17
|
+
/** derived signal about whether the ports view should be visible */
|
|
18
|
+
readonly $visible = signal.derived(() => (
|
|
19
|
+
this.$manual() || (this.auto && this.#$auto())
|
|
20
|
+
))
|
|
21
|
+
|
|
22
|
+
/** whether or not to show labels in the overlay ui */
|
|
23
|
+
readonly $showLabels = signal(false)
|
|
24
|
+
|
|
25
|
+
constructor(
|
|
26
|
+
public hub: Hub<any>,
|
|
27
|
+
public deviceSkins = new DeviceSkins(),
|
|
28
|
+
) {
|
|
29
|
+
|
|
30
|
+
this.dispose.schedule(
|
|
31
|
+
hub.on(async() => {
|
|
32
|
+
const since = Date.now() - this.#created
|
|
33
|
+
if (since > 100) await this.bump()
|
|
34
|
+
})
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
#autoOff = debounce(1500, () => this.#$auto(false))
|
|
39
|
+
|
|
40
|
+
async bump() {
|
|
41
|
+
await this.#$auto(true)
|
|
42
|
+
await this.#autoOff()
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async toggle(active = !this.$manual()) {
|
|
46
|
+
return this.$manual.set(active)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
|
|
2
|
+
import {html} from "lit"
|
|
3
|
+
import {cssReset} from "@e280/sly"
|
|
4
|
+
import {Deck} from "../../deck.js"
|
|
5
|
+
import styleCss from "./style.css.js"
|
|
6
|
+
import {deckView} from "../framework.js"
|
|
7
|
+
import {Device} from "../../../core/devices/device.js"
|
|
8
|
+
|
|
9
|
+
export const DeckOverlay = deckView(deck => use => {
|
|
10
|
+
use.css(cssReset, styleCss)
|
|
11
|
+
use.attrs.string.deck = "overlay"
|
|
12
|
+
|
|
13
|
+
const {hub, deviceSkins, overlayVisibility: {$visible, $showLabels}} = deck
|
|
14
|
+
|
|
15
|
+
function renderDevice(device: Device) {
|
|
16
|
+
const skin = deviceSkins.get(device)
|
|
17
|
+
const style = `--color: ${skin.color};`
|
|
18
|
+
const next = () => hub.shimmy(device, 1)
|
|
19
|
+
const previous = () => hub.shimmy(device, -1)
|
|
20
|
+
return html`
|
|
21
|
+
<div class=device style="${style}">
|
|
22
|
+
<div class="primary row">
|
|
23
|
+
<button @click="${previous}"><</button>
|
|
24
|
+
<div class=icon>${skin.icon}</div>
|
|
25
|
+
<button @click="${next}">></button>
|
|
26
|
+
</div>
|
|
27
|
+
${$showLabels() ? html`
|
|
28
|
+
<div class="secondary row">
|
|
29
|
+
<div class=label>${skin.label}</div>
|
|
30
|
+
</div>
|
|
31
|
+
` : null}
|
|
32
|
+
</div>
|
|
33
|
+
`
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return html`
|
|
37
|
+
<div class=portlist ?data-active="${$visible()}">
|
|
38
|
+
${hub.ports.map((port, index) => html`
|
|
39
|
+
<div class=port>
|
|
40
|
+
<header>P${index + 1}</header>
|
|
41
|
+
${port.devices.array().map(renderDevice)}
|
|
42
|
+
</div>
|
|
43
|
+
`)}
|
|
44
|
+
</div>
|
|
45
|
+
`
|
|
46
|
+
|
|
47
|
+
})
|
|
48
|
+
|