@oidoid/void 0.1.0-7 → 0.1.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/public/index.js +19 -15
- package/dist/public/index.js.map +4 -4
- package/dist/public/preload-atlas.webp +0 -0
- package/dist/public/void-v0.1.0+20251227.1060661.html +115 -0
- package/dist/schema/config-file.v0.json +86 -15
- package/dist/schema/level-file.v0.json +423 -0
- package/dist/src/audio.d.ts +1 -0
- package/dist/src/audio.d.ts.map +1 -0
- package/dist/src/demo/assets/manifest.json +2 -2
- package/dist/src/demo/assets/void.game.json +202 -0
- package/dist/src/demo/ents/cam.d.ts +6 -0
- package/dist/src/demo/ents/cam.d.ts.map +1 -0
- package/dist/src/demo/ents/cam.js +21 -0
- package/dist/src/demo/ents/cam.js.map +1 -0
- package/dist/src/demo/ents/clock.d.ts +10 -0
- package/dist/src/demo/ents/clock.d.ts.map +1 -0
- package/dist/src/demo/ents/clock.js +16 -0
- package/dist/src/demo/ents/clock.js.map +1 -0
- package/dist/src/demo/ents/draw.d.ts +6 -0
- package/dist/src/demo/ents/draw.d.ts.map +1 -0
- package/dist/src/demo/ents/draw.js +14 -0
- package/dist/src/demo/ents/draw.js.map +1 -0
- package/dist/src/demo/ents/ent.d.ts +6 -0
- package/dist/src/demo/ents/ent.d.ts.map +1 -0
- package/dist/src/demo/ents/ent.js +2 -0
- package/dist/src/demo/ents/ent.js.map +1 -0
- package/dist/src/demo/ents/loader.d.ts +6 -0
- package/dist/src/demo/ents/loader.d.ts.map +1 -0
- package/dist/src/demo/ents/loader.js +45 -0
- package/dist/src/demo/ents/loader.js.map +1 -0
- package/dist/src/demo/ents/render-toggle.d.ts +7 -0
- package/dist/src/demo/ents/render-toggle.d.ts.map +1 -0
- package/dist/src/demo/ents/render-toggle.js +8 -0
- package/dist/src/demo/ents/render-toggle.js.map +1 -0
- package/dist/src/demo/ents/tally.d.ts +8 -0
- package/dist/src/demo/ents/tally.d.ts.map +1 -0
- package/dist/src/demo/ents/tally.js +14 -0
- package/dist/src/demo/ents/tally.js.map +1 -0
- package/dist/src/demo/index.d.ts +1 -0
- package/dist/src/demo/index.d.ts.map +1 -0
- package/dist/src/demo/index.js +12 -3
- package/dist/src/demo/index.js.map +1 -1
- package/dist/src/demo/level/level-file.json +50 -0
- package/dist/src/demo/level/level-parser.d.ts +5 -0
- package/dist/src/demo/level/level-parser.d.ts.map +1 -0
- package/dist/src/demo/level/level-parser.js +21 -0
- package/dist/src/demo/level/level-parser.js.map +1 -0
- package/dist/src/demo/level/level-schema.d.ts +4 -0
- package/dist/src/demo/level/level-schema.d.ts.map +1 -0
- package/dist/src/demo/level/level-schema.js +2 -0
- package/dist/src/demo/level/level-schema.js.map +1 -0
- package/dist/src/demo/types/decl.d.ts +30 -0
- package/dist/src/demo/types/decl.d.ts.map +1 -0
- package/dist/src/demo/types/decl.js +2 -0
- package/dist/src/demo/types/decl.js.map +1 -0
- package/dist/src/demo/void.json +8 -4
- package/dist/src/ents/button.d.ts +14 -0
- package/dist/src/ents/button.d.ts.map +1 -0
- package/dist/src/ents/button.js +59 -0
- package/dist/src/ents/button.js.map +1 -0
- package/dist/src/ents/cam.d.ts +3 -0
- package/dist/src/ents/cam.d.ts.map +1 -0
- package/dist/src/ents/cam.js +2 -0
- package/dist/src/ents/cam.js.map +1 -0
- package/dist/src/ents/cursor.d.ts +20 -0
- package/dist/src/ents/cursor.d.ts.map +1 -0
- package/dist/src/ents/cursor.js +49 -0
- package/dist/src/ents/cursor.js.map +1 -0
- package/dist/src/ents/debug-input.d.ts +8 -0
- package/dist/src/ents/debug-input.d.ts.map +1 -0
- package/dist/src/ents/debug-input.js +25 -0
- package/dist/src/ents/debug-input.js.map +1 -0
- package/dist/src/ents/draw.d.ts +3 -0
- package/dist/src/ents/draw.d.ts.map +1 -0
- package/dist/src/ents/draw.js +2 -0
- package/dist/src/ents/draw.js.map +1 -0
- package/dist/src/ents/ent-query.d.ts +26 -0
- package/dist/src/ents/ent-query.d.ts.map +1 -0
- package/dist/src/ents/ent-query.js +10 -0
- package/dist/src/ents/ent-query.js.map +1 -0
- package/dist/src/ents/ent.d.ts +92 -6
- package/dist/src/ents/ent.d.ts.map +1 -0
- package/dist/src/ents/fps.d.ts +7 -0
- package/dist/src/ents/fps.d.ts.map +1 -0
- package/dist/src/ents/fps.js +14 -0
- package/dist/src/ents/fps.js.map +1 -0
- package/dist/src/ents/hud.d.ts +14 -0
- package/dist/src/ents/hud.d.ts.map +1 -0
- package/dist/src/ents/hud.js +38 -0
- package/dist/src/ents/hud.js.map +1 -0
- package/dist/src/ents/loader.d.ts +3 -0
- package/dist/src/ents/loader.d.ts.map +1 -0
- package/dist/src/ents/loader.js +2 -0
- package/dist/src/ents/loader.js.map +1 -0
- package/dist/src/ents/nine-patch.d.ts +17 -0
- package/dist/src/ents/nine-patch.d.ts.map +1 -0
- package/dist/src/ents/nine-patch.js +99 -0
- package/dist/src/ents/nine-patch.js.map +1 -0
- package/dist/src/ents/override.d.ts +8 -0
- package/dist/src/ents/override.d.ts.map +1 -0
- package/dist/src/ents/override.js +8 -0
- package/dist/src/ents/override.js.map +1 -0
- package/dist/src/ents/sprite.d.ts +8 -0
- package/dist/src/ents/sprite.d.ts.map +1 -0
- package/dist/src/ents/sprite.js +10 -0
- package/dist/src/ents/sprite.js.map +1 -0
- package/dist/src/ents/sys.d.ts +14 -0
- package/dist/src/ents/sys.d.ts.map +1 -0
- package/dist/src/ents/sys.js +2 -0
- package/dist/src/ents/sys.js.map +1 -0
- package/dist/src/ents/text.d.ts +21 -0
- package/dist/src/ents/text.d.ts.map +1 -0
- package/dist/src/ents/text.js +118 -0
- package/dist/src/ents/text.js.map +1 -0
- package/dist/src/ents/zoo.d.ts +18 -11
- package/dist/src/ents/zoo.d.ts.map +1 -0
- package/dist/src/ents/zoo.js +75 -15
- package/dist/src/ents/zoo.js.map +1 -1
- package/dist/src/graphics/atlas-parser.d.ts +3 -1
- package/dist/src/graphics/atlas-parser.d.ts.map +1 -0
- package/dist/src/graphics/atlas-parser.js.map +1 -1
- package/dist/src/graphics/atlas.d.ts +9 -15
- package/dist/src/graphics/atlas.d.ts.map +1 -0
- package/dist/src/graphics/cam.d.ts +13 -10
- package/dist/src/graphics/cam.d.ts.map +1 -0
- package/dist/src/graphics/cam.js +23 -17
- package/dist/src/graphics/cam.js.map +1 -1
- package/dist/src/graphics/gl.d.ts +1 -8
- package/dist/src/graphics/gl.d.ts.map +1 -0
- package/dist/src/graphics/gl.js +0 -1
- package/dist/src/graphics/gl.js.map +1 -1
- package/dist/src/graphics/layer.d.ts +21 -17
- package/dist/src/graphics/layer.d.ts.map +1 -0
- package/dist/src/graphics/layer.js +23 -18
- package/dist/src/graphics/layer.js.map +1 -1
- package/dist/src/graphics/pixel-ratio-observer.d.ts +8 -0
- package/dist/src/graphics/pixel-ratio-observer.d.ts.map +1 -0
- package/dist/src/graphics/pixel-ratio-observer.js +23 -0
- package/dist/src/graphics/pixel-ratio-observer.js.map +1 -0
- package/dist/src/graphics/render-mode.d.ts +2 -0
- package/dist/src/graphics/render-mode.d.ts.map +1 -0
- package/dist/src/graphics/render-mode.js +2 -0
- package/dist/src/graphics/render-mode.js.map +1 -0
- package/dist/src/graphics/renderer.d.ts +9 -4
- package/dist/src/graphics/renderer.d.ts.map +1 -0
- package/dist/src/graphics/renderer.js +30 -13
- package/dist/src/graphics/renderer.js.map +1 -1
- package/dist/src/graphics/sprite-frag.glsl.d.ts +1 -0
- package/dist/src/graphics/sprite-frag.glsl.d.ts.map +1 -0
- package/dist/src/graphics/sprite-frag.glsl.js +3 -4
- package/dist/src/graphics/sprite-frag.glsl.js.map +1 -1
- package/dist/src/graphics/sprite-vert.glsl.d.ts +1 -0
- package/dist/src/graphics/sprite-vert.glsl.d.ts.map +1 -0
- package/dist/src/graphics/sprite-vert.glsl.js +9 -7
- package/dist/src/graphics/sprite-vert.glsl.js.map +1 -1
- package/dist/src/graphics/sprite.d.ts +54 -16
- package/dist/src/graphics/sprite.d.ts.map +1 -0
- package/dist/src/graphics/sprite.js +109 -32
- package/dist/src/graphics/sprite.js.map +1 -1
- package/dist/src/index.d.ts +31 -6
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +33 -9
- package/dist/src/index.js.map +1 -1
- package/dist/src/input/context-menu.d.ts +1 -1
- package/dist/src/input/context-menu.d.ts.map +1 -0
- package/dist/src/input/context-menu.js +0 -1
- package/dist/src/input/context-menu.js.map +1 -1
- package/dist/src/input/gamepad.d.ts +1 -1
- package/dist/src/input/gamepad.d.ts.map +1 -0
- package/dist/src/input/gamepad.js +0 -1
- package/dist/src/input/gamepad.js.map +1 -1
- package/dist/src/input/input.d.ts +30 -23
- package/dist/src/input/input.d.ts.map +1 -0
- package/dist/src/input/input.js +53 -31
- package/dist/src/input/input.js.map +1 -1
- package/dist/src/input/keyboard.d.ts +1 -0
- package/dist/src/input/keyboard.d.ts.map +1 -0
- package/dist/src/input/pointer.d.ts +1 -0
- package/dist/src/input/pointer.d.ts.map +1 -0
- package/dist/src/input/pointer.js +11 -8
- package/dist/src/input/pointer.js.map +1 -1
- package/dist/src/input/wheel.d.ts +6 -1
- package/dist/src/input/wheel.d.ts.map +1 -0
- package/dist/src/input/wheel.js +5 -1
- package/dist/src/input/wheel.js.map +1 -1
- package/dist/src/level/level-parser.d.ts +26 -0
- package/dist/src/level/level-parser.d.ts.map +1 -0
- package/dist/src/level/level-parser.js +258 -0
- package/dist/src/level/level-parser.js.map +1 -0
- package/dist/src/level/level-schema-json.d.ts +5 -0
- package/dist/src/level/level-schema-json.d.ts.map +1 -0
- package/dist/src/level/level-schema-json.js +2 -0
- package/dist/src/level/level-schema-json.js.map +1 -0
- package/dist/src/level/level-schema.d.ts +87 -0
- package/dist/src/level/level-schema.d.ts.map +1 -0
- package/dist/src/level/level-schema.js +2 -0
- package/dist/src/level/level-schema.js.map +1 -0
- package/dist/src/level/level.d.ts +8 -0
- package/dist/src/level/level.d.ts.map +1 -0
- package/dist/src/level/level.js +2 -0
- package/dist/src/level/level.js.map +1 -0
- package/dist/src/looper.d.ts +1 -0
- package/dist/src/looper.d.ts.map +1 -0
- package/dist/src/looper.js +5 -2
- package/dist/src/looper.js.map +1 -1
- package/dist/src/mem/pool-map.d.ts +6 -0
- package/dist/src/mem/pool-map.d.ts.map +1 -0
- package/dist/src/mem/pool-map.js +2 -0
- package/dist/src/mem/pool-map.js.map +1 -0
- package/dist/src/mem/pool.d.ts +5 -1
- package/dist/src/mem/pool.d.ts.map +1 -0
- package/dist/src/mem/pool.js +22 -21
- package/dist/src/mem/pool.js.map +1 -1
- package/dist/src/mem/sprite-pool.d.ts +12 -0
- package/dist/src/mem/sprite-pool.d.ts.map +1 -0
- package/dist/src/mem/sprite-pool.js +11 -0
- package/dist/src/mem/sprite-pool.js.map +1 -0
- package/dist/src/random/random.d.ts +1 -0
- package/dist/src/random/random.d.ts.map +1 -0
- package/dist/src/storage/local-storage.d.ts +2 -1
- package/dist/src/storage/local-storage.d.ts.map +1 -0
- package/dist/src/storage/local-storage.js.map +1 -1
- package/dist/src/text/font.d.ts +5 -3
- package/dist/src/text/font.d.ts.map +1 -0
- package/dist/src/text/font.js +8 -5
- package/dist/src/text/font.js.map +1 -1
- package/dist/src/text/mem-prop-5x6.json +20 -5
- package/dist/src/text/text-layout.d.ts +16 -5
- package/dist/src/text/text-layout.d.ts.map +1 -0
- package/dist/src/text/text-layout.js +46 -28
- package/dist/src/text/text-layout.js.map +1 -1
- package/dist/src/types/bundle.d.ts +10 -0
- package/dist/src/types/bundle.d.ts.map +1 -0
- package/dist/src/types/bundle.js +2 -0
- package/dist/src/types/bundle.js.map +1 -0
- package/dist/src/types/game-config.d.ts +27 -0
- package/dist/src/types/game-config.d.ts.map +1 -0
- package/dist/src/types/game-config.js +2 -0
- package/dist/src/types/game-config.js.map +1 -0
- package/dist/src/types/geo.d.ts +9 -2
- package/dist/src/types/geo.d.ts.map +1 -0
- package/dist/src/types/geo.js +16 -0
- package/dist/src/types/geo.js.map +1 -1
- package/dist/src/types/json.d.ts +1 -0
- package/dist/src/types/json.d.ts.map +1 -0
- package/dist/src/types/time.d.ts +13 -2
- package/dist/src/types/time.d.ts.map +1 -0
- package/dist/src/types/time.js +10 -0
- package/dist/src/types/time.js.map +1 -1
- package/dist/src/utils/async-util.d.ts +1 -0
- package/dist/src/utils/async-util.d.ts.map +1 -0
- package/dist/src/utils/async-util.js +2 -0
- package/dist/src/utils/async-util.js.map +1 -1
- package/dist/src/utils/canvas-util.d.ts +3 -1
- package/dist/src/utils/canvas-util.d.ts.map +1 -0
- package/dist/src/utils/canvas-util.js +7 -3
- package/dist/src/utils/canvas-util.js.map +1 -1
- package/dist/src/utils/color-util.d.ts +6 -0
- package/dist/src/utils/color-util.d.ts.map +1 -0
- package/dist/src/utils/color-util.js +12 -0
- package/dist/src/utils/color-util.js.map +1 -1
- package/dist/src/utils/debug.d.ts +1 -0
- package/dist/src/utils/debug.d.ts.map +1 -0
- package/dist/src/utils/debug.js +4 -4
- package/dist/src/utils/debug.js.map +1 -1
- package/dist/src/utils/delay-interval.d.ts +1 -0
- package/dist/src/utils/delay-interval.d.ts.map +1 -0
- package/dist/src/utils/dom-util.d.ts +3 -2
- package/dist/src/utils/dom-util.d.ts.map +1 -0
- package/dist/src/utils/dom-util.js +16 -12
- package/dist/src/utils/dom-util.js.map +1 -1
- package/dist/src/utils/fetch-util.d.ts +2 -1
- package/dist/src/utils/fetch-util.d.ts.map +1 -0
- package/dist/src/utils/fetch-util.js +2 -2
- package/dist/src/utils/math.d.ts +1 -0
- package/dist/src/utils/math.d.ts.map +1 -0
- package/dist/src/utils/math.js +1 -1
- package/dist/src/utils/math.js.map +1 -1
- package/dist/src/utils/obj-util.d.ts +7 -0
- package/dist/src/utils/obj-util.d.ts.map +1 -0
- package/dist/src/utils/obj-util.js +8 -0
- package/dist/src/utils/obj-util.js.map +1 -0
- package/dist/src/utils/str-util.d.ts +2 -0
- package/dist/src/utils/str-util.d.ts.map +1 -0
- package/dist/src/utils/str-util.js +6 -0
- package/dist/src/utils/str-util.js.map +1 -0
- package/dist/src/utils/vibrate.d.ts +1 -0
- package/dist/src/utils/vibrate.d.ts.map +1 -0
- package/dist/src/void.d.ts +42 -30
- package/dist/src/void.d.ts.map +1 -0
- package/dist/src/void.js +78 -34
- package/dist/src/void.js.map +1 -1
- package/dist/tools/atlas-pack/aseprite-json.d.ts +5 -0
- package/dist/tools/atlas-pack/aseprite-json.d.ts.map +1 -0
- package/dist/tools/atlas-pack/aseprite-json.js +2 -0
- package/dist/tools/atlas-pack/aseprite-json.js.map +1 -0
- package/dist/tools/atlas-pack/aseprite.d.ts +58 -31
- package/dist/tools/atlas-pack/aseprite.d.ts.map +1 -0
- package/dist/tools/atlas-pack/aseprite.js +1 -1
- package/dist/tools/atlas-pack/aseprite.js.map +1 -1
- package/dist/tools/atlas-pack/atlas-json-parser.d.ts +11 -10
- package/dist/tools/atlas-pack/atlas-json-parser.d.ts.map +1 -0
- package/dist/tools/atlas-pack/atlas-json-parser.js +14 -14
- package/dist/tools/atlas-pack/atlas-json-parser.js.map +1 -1
- package/dist/tools/atlas-pack/atlas-pack.d.ts +4 -2
- package/dist/tools/atlas-pack/atlas-pack.d.ts.map +1 -0
- package/dist/tools/atlas-pack/atlas-pack.js +1 -6
- package/dist/tools/atlas-pack/atlas-pack.js.map +1 -1
- package/dist/tools/bundle/bundle.d.ts +3 -3
- package/dist/tools/bundle/bundle.d.ts.map +1 -0
- package/dist/tools/bundle/bundle.js +32 -7
- package/dist/tools/bundle/bundle.js.map +1 -1
- package/dist/tools/bundle/html-plugin.d.ts +1 -0
- package/dist/tools/bundle/html-plugin.d.ts.map +1 -0
- package/dist/tools/bundle/html-plugin.js +5 -20
- package/dist/tools/bundle/html-plugin.js.map +1 -1
- package/dist/tools/tsconfig-base.json +1 -1
- package/dist/tools/tsconfig.json +1 -2
- package/dist/{schema → tools/types}/config-file.d.ts +21 -9
- package/dist/tools/types/config-file.d.ts.map +1 -0
- package/dist/{schema → tools/types}/config-file.js +18 -5
- package/dist/tools/types/config-file.js.map +1 -0
- package/dist/tools/types/config.d.ts +10 -9
- package/dist/tools/types/config.d.ts.map +1 -0
- package/dist/tools/types/config.js +23 -5
- package/dist/tools/types/config.js.map +1 -1
- package/dist/tools/types/package-json.d.ts +3 -2
- package/dist/tools/types/package-json.d.ts.map +1 -0
- package/dist/tools/utils/argv.d.ts +3 -0
- package/dist/tools/utils/argv.d.ts.map +1 -0
- package/dist/tools/utils/argv.js +1 -1
- package/dist/tools/utils/argv.js.map +1 -1
- package/dist/tools/utils/exec.d.ts +2 -1
- package/dist/tools/utils/exec.d.ts.map +1 -0
- package/dist/tools/utils/exec.js.map +1 -1
- package/dist/tools/utils/file-util.d.ts +1 -0
- package/dist/tools/utils/file-util.d.ts.map +1 -0
- package/dist/tools/utils/html-parser.d.ts +1 -0
- package/dist/tools/utils/html-parser.d.ts.map +1 -0
- package/dist/tools/void.d.ts +1 -0
- package/dist/tools/void.d.ts.map +1 -0
- package/dist/tools/void.js +3 -16
- package/dist/tools/void.js.map +1 -1
- package/package.json +18 -20
- package/readme.md +63 -1
- package/dist/meta.json +0 -1
- package/dist/package.json +0 -66
- package/dist/public/favicon/favicon16.png +0 -0
- package/dist/public/favicon/favicon192.png +0 -0
- package/dist/public/favicon/favicon32.png +0 -0
- package/dist/public/favicon/favicon48.png +0 -0
- package/dist/public/favicon/favicon64.png +0 -0
- package/dist/public/preload-atlas.png +0 -0
- package/dist/public/void-v0.1.0-6+20251020.7cdf98d.html +0 -111
- package/dist/public/void-v0.1.0-6+20251020.e4e9eef.html +0 -111
- package/dist/public/void-v0.1.0-7+20251021.7cdf98d.html +0 -111
- package/dist/schema/config-file.js.map +0 -1
- package/dist/src/demo/assets/preload-atlas.json +0 -193
- package/dist/src/demo/ents/clock-ent.d.ts +0 -11
- package/dist/src/demo/ents/clock-ent.js +0 -26
- package/dist/src/demo/ents/clock-ent.js.map +0 -1
- package/dist/src/demo/ents/render-toggle-ent.d.ts +0 -12
- package/dist/src/demo/ents/render-toggle-ent.js +0 -41
- package/dist/src/demo/ents/render-toggle-ent.js.map +0 -1
- package/dist/src/demo/ents/work-counter-ent.d.ts +0 -10
- package/dist/src/demo/ents/work-counter-ent.js +0 -20
- package/dist/src/demo/ents/work-counter-ent.js.map +0 -1
- package/dist/src/demo/game.d.ts +0 -12
- package/dist/src/demo/game.js +0 -135
- package/dist/src/demo/game.js.map +0 -1
- package/dist/src/demo/types/tag.d.ts +0 -2
- package/dist/src/demo/types/tag.js +0 -2
- package/dist/src/demo/types/tag.js.map +0 -1
- package/dist/src/ents/button-ent.d.ts +0 -39
- package/dist/src/ents/button-ent.js +0 -128
- package/dist/src/ents/button-ent.js.map +0 -1
- package/dist/src/ents/cursor-ent.d.ts +0 -18
- package/dist/src/ents/cursor-ent.js +0 -63
- package/dist/src/ents/cursor-ent.js.map +0 -1
- package/dist/src/ents/follow-cam-ent.d.ts +0 -25
- package/dist/src/ents/follow-cam-ent.js +0 -87
- package/dist/src/ents/follow-cam-ent.js.map +0 -1
- package/dist/src/ents/nine-patch-ent.d.ts +0 -43
- package/dist/src/ents/nine-patch-ent.js +0 -143
- package/dist/src/ents/nine-patch-ent.js.map +0 -1
- package/dist/src/ents/text-ent.d.ts +0 -23
- package/dist/src/ents/text-ent.js +0 -109
- package/dist/src/ents/text-ent.js.map +0 -1
- package/dist/src/types/void-version.d.ts +0 -7
- package/dist/src/types/void-version.js +0 -2
- package/dist/src/types/void-version.js.map +0 -1
- package/schema/config-file.test.ts +0 -55
- package/schema/config-file.ts +0 -69
- package/schema/config-file.v0.json +0 -68
- package/tools/atlas-pack/aseprite.ts +0 -60
- package/tools/atlas-pack/atlas-json-parser.test.ts +0 -780
- package/tools/atlas-pack/atlas-json-parser.ts +0 -159
- package/tools/atlas-pack/atlas-pack.ts +0 -51
- package/tools/bundle/bundle.ts +0 -64
- package/tools/bundle/html-plugin.ts +0 -135
- package/tools/types/config.ts +0 -65
- package/tools/types/package-json.ts +0 -4
- package/tools/utils/argv.test.ts +0 -41
- package/tools/utils/argv.ts +0 -29
- package/tools/utils/exec.ts +0 -22
- package/tools/utils/file-util.ts +0 -11
- package/tools/utils/html-parser.ts +0 -9
- package/tools/void.ts +0 -55
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { whEq, xyEq } from "../types/geo.js";
|
|
2
|
-
export class NinePatchEnt {
|
|
3
|
-
#dir;
|
|
4
|
-
#margin;
|
|
5
|
-
#invalid = true;
|
|
6
|
-
constructor(v, opts) {
|
|
7
|
-
this.#dir = {
|
|
8
|
-
w: v.sprites.alloc(),
|
|
9
|
-
nw: v.sprites.alloc(),
|
|
10
|
-
n: v.sprites.alloc(),
|
|
11
|
-
ne: v.sprites.alloc(),
|
|
12
|
-
e: v.sprites.alloc(),
|
|
13
|
-
se: v.sprites.alloc(),
|
|
14
|
-
s: v.sprites.alloc(),
|
|
15
|
-
sw: v.sprites.alloc(),
|
|
16
|
-
origin: v.sprites.alloc()
|
|
17
|
-
};
|
|
18
|
-
this.#dir.w.tag = opts.w?.tag ?? opts.e?.tag ?? opts.n.tag;
|
|
19
|
-
this.#dir.n.tag = opts.n.tag;
|
|
20
|
-
this.#dir.e.tag = opts.e?.tag ?? this.#dir.w.tag;
|
|
21
|
-
this.#dir.s.tag = opts.s?.tag ?? this.#dir.n.tag;
|
|
22
|
-
this.#dir.nw.tag = opts.nw?.tag ?? opts.se?.tag ?? opts.n.tag;
|
|
23
|
-
this.#dir.ne.tag =
|
|
24
|
-
opts.ne?.tag ?? opts.sw?.tag ?? opts.nw?.tag ?? opts.n.tag;
|
|
25
|
-
this.#dir.se.tag = opts.se?.tag ?? this.#dir.nw.tag;
|
|
26
|
-
this.#dir.sw.tag = opts.sw?.tag ?? this.#dir.ne.tag;
|
|
27
|
-
this.#dir.origin.tag = opts.origin.tag;
|
|
28
|
-
this.#dir.w.z =
|
|
29
|
-
this.#dir.nw.z =
|
|
30
|
-
this.#dir.n.z =
|
|
31
|
-
this.#dir.ne.z =
|
|
32
|
-
this.#dir.e.z =
|
|
33
|
-
this.#dir.se.z =
|
|
34
|
-
this.#dir.s.z =
|
|
35
|
-
this.#dir.sw.z =
|
|
36
|
-
this.#dir.origin.z =
|
|
37
|
-
opts.z ?? 0;
|
|
38
|
-
this.#dir.w.stretch = opts.w?.stretch ?? opts.e?.stretch ?? false;
|
|
39
|
-
this.#dir.n.stretch = opts.n.stretch ?? opts.s?.stretch ?? false;
|
|
40
|
-
this.#dir.e.stretch = opts.e?.stretch ?? this.#dir.w.stretch;
|
|
41
|
-
this.#dir.s.stretch = opts.s?.stretch ?? this.#dir.n.stretch;
|
|
42
|
-
this.#dir.nw.stretch = opts.nw?.stretch ?? opts.se?.stretch ?? false;
|
|
43
|
-
this.#dir.ne.stretch = opts.ne?.stretch ?? opts.sw?.stretch ?? false;
|
|
44
|
-
this.#dir.se.stretch = opts.se?.stretch ?? this.#dir.nw.stretch;
|
|
45
|
-
this.#dir.sw.stretch = opts.sw?.stretch ?? this.#dir.ne.stretch;
|
|
46
|
-
this.#dir.origin.stretch = opts.origin.stretch ?? false;
|
|
47
|
-
this.#dir.w.flipX = opts.w?.flip?.x ?? !opts.e?.flip?.x;
|
|
48
|
-
this.#dir.w.flipY = opts.w?.flip?.y ?? !!opts.e?.flip?.y;
|
|
49
|
-
this.#dir.n.flipX = opts.n.flip?.x ?? !!opts.s?.flip?.x;
|
|
50
|
-
this.#dir.n.flipY = opts.n.flip?.y ?? !opts.s?.flip?.y;
|
|
51
|
-
this.#dir.e.flipX = opts.e?.flip?.x ?? !this.#dir.w.flipX;
|
|
52
|
-
this.#dir.e.flipY = opts.e?.flip?.y ?? this.#dir.w.flipY;
|
|
53
|
-
this.#dir.s.flipX = opts.s?.flip?.x ?? this.#dir.n.flipX;
|
|
54
|
-
this.#dir.s.flipY = opts.s?.flip?.y ?? !this.#dir.n.flipY;
|
|
55
|
-
this.#dir.origin.flipX = !!opts.origin.flip?.x;
|
|
56
|
-
this.#dir.origin.flipY = !!opts.origin.flip?.y;
|
|
57
|
-
this.#dir.n.h = opts.border?.n ?? opts.border?.s ?? this.#dir.n.h;
|
|
58
|
-
this.#dir.w.w = opts.border?.w ?? opts.border?.e ?? this.#dir.n.h;
|
|
59
|
-
this.#dir.e.w = opts.border?.e ?? this.#dir.w.w;
|
|
60
|
-
this.#dir.s.h = opts.border?.s ?? this.#dir.n.h;
|
|
61
|
-
this.#dir.nw.w = this.#dir.w.w;
|
|
62
|
-
this.#dir.nw.h = this.#dir.n.h;
|
|
63
|
-
this.#dir.ne.w = this.#dir.e.w;
|
|
64
|
-
this.#dir.ne.h = this.#dir.n.h;
|
|
65
|
-
this.#dir.se.w = this.#dir.e.w;
|
|
66
|
-
this.#dir.se.h = this.#dir.s.h;
|
|
67
|
-
this.#dir.sw.w = this.#dir.w.w;
|
|
68
|
-
this.#dir.sw.h = this.#dir.s.h;
|
|
69
|
-
this.#margin = { w: opts.margin?.w ?? 0, h: opts.margin?.h ?? 0 };
|
|
70
|
-
const w = opts.wh?.w == null
|
|
71
|
-
? this.#dir.w.w + this.#dir.n.w + this.#dir.e.w
|
|
72
|
-
: opts.wh.w;
|
|
73
|
-
this.#dir.n.w = w - 1; // force resize
|
|
74
|
-
this.wh = {
|
|
75
|
-
w,
|
|
76
|
-
h: opts.wh?.h == null
|
|
77
|
-
? this.#dir.n.h + this.#dir.e.h + this.#dir.s.h
|
|
78
|
-
: opts.wh.h
|
|
79
|
-
};
|
|
80
|
-
this.#dir.nw.x = (opts.x ?? 0) - 1; // force move.
|
|
81
|
-
this.xy = { x: opts.x ?? 0, y: opts.y ?? 0 };
|
|
82
|
-
}
|
|
83
|
-
free(v) {
|
|
84
|
-
v.sprites.free(this.#dir.w, this.#dir.nw, this.#dir.n, this.#dir.ne, this.#dir.e, this.#dir.se, this.#dir.s, this.#dir.sw, this.#dir.origin);
|
|
85
|
-
}
|
|
86
|
-
update() {
|
|
87
|
-
if (!this.#invalid)
|
|
88
|
-
return;
|
|
89
|
-
this.#invalid = false;
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
get wh() {
|
|
93
|
-
return {
|
|
94
|
-
w: this.#dir.w.w + this.#dir.n.w + this.#dir.e.w + this.#margin.w,
|
|
95
|
-
h: this.#dir.n.h + this.#dir.w.h + this.#dir.s.h + this.#margin.h
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
set wh(wh) {
|
|
99
|
-
if (whEq(wh, this.wh))
|
|
100
|
-
return;
|
|
101
|
-
this.#dir.w.h = wh.h - this.#dir.n.h - this.#dir.s.h - this.#margin.h;
|
|
102
|
-
this.#dir.n.w = wh.w - this.#dir.w.w - this.#dir.e.w - this.#margin.w;
|
|
103
|
-
this.#dir.s.w = this.#dir.n.w;
|
|
104
|
-
this.#dir.e.h = this.#dir.w.h;
|
|
105
|
-
this.#dir.origin.w = this.#dir.n.w;
|
|
106
|
-
this.#dir.origin.h = this.#dir.e.h;
|
|
107
|
-
this.#setXYRight();
|
|
108
|
-
this.#invalid = true;
|
|
109
|
-
}
|
|
110
|
-
get xy() {
|
|
111
|
-
return {
|
|
112
|
-
x: this.#dir.nw.x - this.#margin.w / 2,
|
|
113
|
-
y: this.#dir.nw.y - this.#margin.h / 2
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
set xy(xy) {
|
|
117
|
-
if (xyEq(xy, this.xy))
|
|
118
|
-
return;
|
|
119
|
-
this.#dir.nw.x = xy.x + this.#margin.w / 2;
|
|
120
|
-
this.#dir.nw.y = xy.y + this.#margin.h / 2;
|
|
121
|
-
this.#dir.w.x = this.#dir.nw.x;
|
|
122
|
-
this.#dir.w.y = this.#dir.nw.y + this.#dir.nw.h;
|
|
123
|
-
this.#dir.n.x = this.#dir.nw.x + this.#dir.nw.w;
|
|
124
|
-
this.#dir.n.y = this.#dir.nw.y;
|
|
125
|
-
this.#dir.origin.x = this.#dir.n.x;
|
|
126
|
-
this.#dir.origin.y = this.#dir.nw.y + this.#dir.ne.h;
|
|
127
|
-
this.#setXYRight();
|
|
128
|
-
this.#invalid = true;
|
|
129
|
-
}
|
|
130
|
-
#setXYRight() {
|
|
131
|
-
this.#dir.ne.x = this.#dir.n.x + this.#dir.n.w;
|
|
132
|
-
this.#dir.ne.y = this.#dir.nw.y;
|
|
133
|
-
this.#dir.e.x = this.#dir.ne.x;
|
|
134
|
-
this.#dir.e.y = this.#dir.nw.y + this.#dir.ne.h;
|
|
135
|
-
this.#dir.se.x = this.#dir.e.x;
|
|
136
|
-
this.#dir.se.y = this.#dir.e.y + this.#dir.e.h;
|
|
137
|
-
this.#dir.s.x = this.#dir.n.x;
|
|
138
|
-
this.#dir.s.y = this.#dir.se.y;
|
|
139
|
-
this.#dir.sw.x = this.#dir.nw.x;
|
|
140
|
-
this.#dir.sw.y = this.#dir.se.y;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
//# sourceMappingURL=nine-patch-ent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nine-patch-ent.js","sourceRoot":"","sources":["../../../src/ents/nine-patch-ent.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,IAAI,EAEJ,IAAI,EACL,MAAM,iBAAiB,CAAA;AAwBxB,MAAM,OAAO,YAAY;IACd,IAAI,CAAwD;IAC5D,OAAO,CAAc;IAC9B,QAAQ,GAAY,IAAI,CAAA;IAExB,YAAY,CAAoB,EAAE,IAAkC;QAClE,IAAI,CAAC,IAAI,GAAG;YACV,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE;YACpB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE;YACrB,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE;YACpB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE;YACrB,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE;YACpB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE;YACrB,CAAC,EAAE,CAAC,C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IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;QAC/C,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;QAC9B,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;QAC9C,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;QAC7B,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;QAC9B,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;QAC/B,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;IACjC,CAAC;CACF"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { TagFormat } from '../graphics/atlas.ts';
|
|
2
|
-
import { Layer } from '../graphics/layer.ts';
|
|
3
|
-
import { type WH, type XY } from '../types/geo.ts';
|
|
4
|
-
import type { Void } from '../void.ts';
|
|
5
|
-
import type { Ent } from './ent.ts';
|
|
6
|
-
export declare class TextEnt implements Ent<TagFormat> {
|
|
7
|
-
#private;
|
|
8
|
-
free(v: Void<TagFormat, string>): void;
|
|
9
|
-
layout(v: Void<TagFormat, string>): boolean;
|
|
10
|
-
get maxW(): number;
|
|
11
|
-
set maxW(w: number);
|
|
12
|
-
get scale(): number;
|
|
13
|
-
set scale(scale: number);
|
|
14
|
-
get text(): string;
|
|
15
|
-
set text(str: string);
|
|
16
|
-
update(v: Void<TagFormat, string>): boolean | undefined;
|
|
17
|
-
get scaledLeading(): number;
|
|
18
|
-
get wh(): Readonly<WH>;
|
|
19
|
-
get xy(): Readonly<XY>;
|
|
20
|
-
set xy(xy: Readonly<XY>);
|
|
21
|
-
get z(): Layer;
|
|
22
|
-
set z(layer: Layer);
|
|
23
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { memProp5x6 } from 'mem-font';
|
|
2
|
-
import { Layer } from "../graphics/layer.js";
|
|
3
|
-
import { fontCharToTag } from "../text/font.js";
|
|
4
|
-
import { layoutText } from "../text/text-layout.js";
|
|
5
|
-
import { xyEq } from "../types/geo.js";
|
|
6
|
-
export class TextEnt {
|
|
7
|
-
#maxW = Infinity;
|
|
8
|
-
#layout = 'Outdated';
|
|
9
|
-
#z = Layer.UIA;
|
|
10
|
-
#scale = 1;
|
|
11
|
-
#sprites = [];
|
|
12
|
-
#str = '';
|
|
13
|
-
#wh = { w: 0, h: 0 };
|
|
14
|
-
#xy = { x: 0, y: 0 };
|
|
15
|
-
free(v) {
|
|
16
|
-
v.sprites.free(...this.#sprites);
|
|
17
|
-
}
|
|
18
|
-
layout(v) {
|
|
19
|
-
if (this.#layout !== 'Outdated')
|
|
20
|
-
return false;
|
|
21
|
-
let len = 0;
|
|
22
|
-
const layout = layoutText({
|
|
23
|
-
font: memProp5x6,
|
|
24
|
-
maxW: this.#maxW,
|
|
25
|
-
scale: this.#scale,
|
|
26
|
-
start: this.#xy,
|
|
27
|
-
str: this.#str
|
|
28
|
-
});
|
|
29
|
-
this.#wh = { w: layout.wh.w, h: layout.wh.h };
|
|
30
|
-
for (const [i, char] of layout.chars.entries()) {
|
|
31
|
-
if (char == null)
|
|
32
|
-
continue;
|
|
33
|
-
const sprite = (this.#sprites[len] ??= v.sprites.alloc());
|
|
34
|
-
sprite.x = char.x;
|
|
35
|
-
sprite.y = char.y;
|
|
36
|
-
sprite.tag = fontCharToTag(memProp5x6, this.#str[i]);
|
|
37
|
-
sprite.stretch = true;
|
|
38
|
-
sprite.w *= this.#scale;
|
|
39
|
-
sprite.h *= this.#scale;
|
|
40
|
-
sprite.z = this.#z;
|
|
41
|
-
len++;
|
|
42
|
-
}
|
|
43
|
-
while (this.#sprites.length > len)
|
|
44
|
-
v.sprites.free(this.#sprites.pop());
|
|
45
|
-
this.#layout = 'Updated';
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
get maxW() {
|
|
49
|
-
return this.#maxW;
|
|
50
|
-
}
|
|
51
|
-
set maxW(w) {
|
|
52
|
-
if (w === this.#maxW)
|
|
53
|
-
return;
|
|
54
|
-
this.#maxW = w;
|
|
55
|
-
this.#layout = 'Outdated';
|
|
56
|
-
}
|
|
57
|
-
get scale() {
|
|
58
|
-
return this.#scale;
|
|
59
|
-
}
|
|
60
|
-
set scale(scale) {
|
|
61
|
-
if (scale === this.#scale)
|
|
62
|
-
return;
|
|
63
|
-
this.#scale = scale;
|
|
64
|
-
this.#layout = 'Outdated';
|
|
65
|
-
}
|
|
66
|
-
get text() {
|
|
67
|
-
return this.#str;
|
|
68
|
-
}
|
|
69
|
-
set text(str) {
|
|
70
|
-
if (str === this.#str)
|
|
71
|
-
return;
|
|
72
|
-
this.#str = str;
|
|
73
|
-
this.#layout = 'Outdated';
|
|
74
|
-
}
|
|
75
|
-
update(v) {
|
|
76
|
-
if (this.#layout === 'Rendered')
|
|
77
|
-
return;
|
|
78
|
-
if (this.#layout === 'Outdated')
|
|
79
|
-
this.layout(v);
|
|
80
|
-
this.#layout = 'Rendered';
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
|
-
get scaledLeading() {
|
|
84
|
-
return memProp5x6.leading * this.#scale;
|
|
85
|
-
}
|
|
86
|
-
get wh() {
|
|
87
|
-
return this.#wh;
|
|
88
|
-
}
|
|
89
|
-
get xy() {
|
|
90
|
-
return this.#xy;
|
|
91
|
-
}
|
|
92
|
-
set xy(xy) {
|
|
93
|
-
if (xyEq(xy, this.#xy))
|
|
94
|
-
return;
|
|
95
|
-
this.#xy.x = xy.x;
|
|
96
|
-
this.#xy.y = xy.y;
|
|
97
|
-
this.#layout = 'Outdated';
|
|
98
|
-
}
|
|
99
|
-
get z() {
|
|
100
|
-
return this.#z;
|
|
101
|
-
}
|
|
102
|
-
set z(layer) {
|
|
103
|
-
if (layer === this.#z)
|
|
104
|
-
return;
|
|
105
|
-
this.#z = layer;
|
|
106
|
-
this.#layout = 'Outdated';
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
//# sourceMappingURL=text-ent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text-ent.js","sourceRoot":"","sources":["../../../src/ents/text-ent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAA;AAEnC,OAAO,EAAC,KAAK,EAAC,MAAM,sBAAsB,CAAA;AAE1C,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAC,UAAU,EAAC,MAAM,wBAAwB,CAAA;AACjD,OAAO,EAAmB,IAAI,EAAC,MAAM,iBAAiB,CAAA;AAItD,MAAM,OAAO,OAAO;IAClB,KAAK,GAAW,QAAQ,CAAA;IACxB,OAAO,GAAwC,UAAU,CAAA;IACzD,EAAE,GAAU,KAAK,CAAC,GAAG,CAAA;IACrB,MAAM,GAAW,CAAC,CAAA;IACT,QAAQ,GAAwB,EAAE,CAAA;IAC3C,IAAI,GAAW,EAAE,CAAA;IACjB,GAAG,GAAO,EAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAC,CAAA;IACb,GAAG,GAAO,EAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAC,CAAA;IAE/B,IAAI,CAAC,CAA0B;QAC7B,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAA;IAClC,CAAC;IAED,MAAM,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AAM,CAAA;IACzC,CAAC;IAED,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,GAAG,CAAA;IACjB,CAAC;IAED,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,GAAG,CAAA;IACjB,CAAC;IAED,IAAI,EAAE,CAAC,EAAgB;QACrB,IAAI,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC;YAAE,OAAM;QAC9B,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;QACjB,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;QACjB,IAAI,CAAC,OAAO,GAAG,UAAU,CAAA;IAC3B,CAAC;IAED,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,EAAE,CAAA;IAChB,CAAC;IAED,IAAI,CAAC,CAAC,KAAY;QAChB,IAAI,KAAK,KAAK,IAAI,CAAC,EAAE;YAAE,OAAM;QAC7B,IAAI,CAAC,EAAE,GAAG,KAAK,CAAA;QACf,IAAI,CAAC,OAAO,GAAG,UAAU,CAAA;IAC3B,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"void-version.js","sourceRoot":"","sources":["../../../src/types/void-version.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,WAAW,GAAgB,UAAU,CAAC,WAAW,CAAA"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert/strict'
|
|
2
|
-
import {test} from 'node:test'
|
|
3
|
-
import {type ConfigFile, type ConfigFileSchema, parse} from './config-file.ts'
|
|
4
|
-
|
|
5
|
-
test('defaults', () => {
|
|
6
|
-
const config: ConfigFileSchema = {}
|
|
7
|
-
assert.deepEqual<ConfigFile>(
|
|
8
|
-
parse('dirname/filename', JSON.stringify(config)),
|
|
9
|
-
{
|
|
10
|
-
$schema:
|
|
11
|
-
'https://raw.githubusercontent.com/oidoid/void/refs/heads/main/schema/config-file.v0.json',
|
|
12
|
-
entry: 'dirname/src/assets/index.html',
|
|
13
|
-
meta: 'dirname/dist/meta.json',
|
|
14
|
-
out: {dir: 'dirname/dist/public/', name: undefined},
|
|
15
|
-
preloadAtlas: undefined,
|
|
16
|
-
|
|
17
|
-
dirname: 'dirname',
|
|
18
|
-
filename: 'dirname/filename'
|
|
19
|
-
}
|
|
20
|
-
)
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
test('overrides', () => {
|
|
24
|
-
const config: Required<ConfigFileSchema> = {
|
|
25
|
-
$schema: '$schema',
|
|
26
|
-
entry: 'entry',
|
|
27
|
-
meta: 'meta',
|
|
28
|
-
out: {dir: 'outDir', name: 'name'},
|
|
29
|
-
preloadAtlas: {dir: 'dir/', image: 'image.webp', json: 'json.json'}
|
|
30
|
-
}
|
|
31
|
-
assert.deepEqual<ConfigFile>(
|
|
32
|
-
parse('dirname/filename', JSON.stringify(config)),
|
|
33
|
-
{
|
|
34
|
-
$schema: '$schema',
|
|
35
|
-
entry: 'dirname/entry',
|
|
36
|
-
meta: 'dirname/meta',
|
|
37
|
-
out: {dir: 'dirname/outDir', name: 'name'},
|
|
38
|
-
preloadAtlas: {
|
|
39
|
-
dir: 'dirname/dir/',
|
|
40
|
-
image: 'dirname/image.webp',
|
|
41
|
-
json: 'dirname/json.json'
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
dirname: 'dirname',
|
|
45
|
-
filename: 'dirname/filename'
|
|
46
|
-
}
|
|
47
|
-
)
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
test('overrides', () => {
|
|
51
|
-
assert.throws(
|
|
52
|
-
() => parse('dirname/filename', ''),
|
|
53
|
-
Error('config dirname/filename unparsable')
|
|
54
|
-
)
|
|
55
|
-
})
|
package/schema/config-file.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import {readFile} from 'node:fs/promises'
|
|
2
|
-
import path from 'node:path'
|
|
3
|
-
import schema from './config-file.v0.json' with {type: 'json'}
|
|
4
|
-
|
|
5
|
-
export type AtlasConfig = {dir: string; image: string; json: string}
|
|
6
|
-
|
|
7
|
-
export type ConfigFile = {
|
|
8
|
-
$schema: string
|
|
9
|
-
entry: string
|
|
10
|
-
meta: string | undefined
|
|
11
|
-
out: {dir: string; name: string | undefined}
|
|
12
|
-
preloadAtlas: AtlasConfig | undefined
|
|
13
|
-
|
|
14
|
-
/** config directory name. */
|
|
15
|
-
dirname: string
|
|
16
|
-
/** config filename. */
|
|
17
|
-
filename: string
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export type ConfigFileSchema = {
|
|
21
|
-
$schema?: string | undefined
|
|
22
|
-
entry?: string | undefined
|
|
23
|
-
meta?: string | undefined
|
|
24
|
-
out?: {dir?: string | undefined; name?: string | undefined} | undefined
|
|
25
|
-
preloadAtlas?: AtlasConfig | undefined
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export async function parseConfigFile(filename: string): Promise<ConfigFile> {
|
|
29
|
-
let str
|
|
30
|
-
try {
|
|
31
|
-
str = await readFile(filename, 'utf8')
|
|
32
|
-
} catch (err) {
|
|
33
|
-
throw Error(`config ${filename} unreadable`, {cause: err})
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return parse(filename, str)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** @internal */
|
|
40
|
-
export function parse(filename: string, str: string): ConfigFile {
|
|
41
|
-
const dirname = path.dirname(filename)
|
|
42
|
-
let json: ConfigFileSchema
|
|
43
|
-
try {
|
|
44
|
-
json = JSON.parse(str)
|
|
45
|
-
} catch (err) {
|
|
46
|
-
throw Error(`config ${filename} unparsable`, {cause: err})
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return {
|
|
50
|
-
$schema: json.$schema ?? schema.properties.$schema.default,
|
|
51
|
-
entry: path.join(dirname, json.entry ?? schema.properties.entry.default),
|
|
52
|
-
meta: path.join(dirname, json.meta ?? schema.properties.meta.default),
|
|
53
|
-
out: {
|
|
54
|
-
dir: path.join(
|
|
55
|
-
dirname,
|
|
56
|
-
json.out?.dir ?? schema.properties.out.properties.dir.default
|
|
57
|
-
),
|
|
58
|
-
name: json.out?.name
|
|
59
|
-
},
|
|
60
|
-
preloadAtlas: json.preloadAtlas && {
|
|
61
|
-
dir: path.join(dirname, json.preloadAtlas.dir),
|
|
62
|
-
image: path.join(dirname, json.preloadAtlas.image),
|
|
63
|
-
json: path.join(dirname, json.preloadAtlas.json)
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
dirname,
|
|
67
|
-
filename
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://raw.githubusercontent.com/oidoid/void/refs/heads/main/schema/config-file.v0.json",
|
|
4
|
-
"title": "void Config File Schema",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"description": "a JSON representation of a void config file.",
|
|
7
|
-
"$defs": {
|
|
8
|
-
"Atlas": {
|
|
9
|
-
"type": "object",
|
|
10
|
-
"description": "sprite sheet config.",
|
|
11
|
-
"additionalProperties": false,
|
|
12
|
-
"required": ["dir", "image", "json"],
|
|
13
|
-
"properties": {
|
|
14
|
-
"dir": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"description": "Aseprite asset root directory. all `**.aseprite` files are input.",
|
|
17
|
-
"examples": ["src/assets/atlas/", "./"]
|
|
18
|
-
},
|
|
19
|
-
"image": {
|
|
20
|
-
"type": "string",
|
|
21
|
-
"description": "sprite sheet image output.",
|
|
22
|
-
"examples": ["dist/public/atlas.webp", "atlas.png"]
|
|
23
|
-
},
|
|
24
|
-
"json": {
|
|
25
|
-
"type": "string",
|
|
26
|
-
"description": "sprite sheet JSON output.",
|
|
27
|
-
"examples": ["src/assets/atlas.json", "atlas.json"]
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"additionalProperties": false,
|
|
33
|
-
"properties": {
|
|
34
|
-
"$schema": {
|
|
35
|
-
"type": "string",
|
|
36
|
-
"description": "the configuration schema URI.",
|
|
37
|
-
"default": "https://raw.githubusercontent.com/oidoid/void/refs/heads/main/schema/config-file.v0.json"
|
|
38
|
-
},
|
|
39
|
-
"entry": {
|
|
40
|
-
"type": "string",
|
|
41
|
-
"default": "src/assets/index.html",
|
|
42
|
-
"description": "HTML entrypoint input. the file should include a script tag sourcing the TypeScript / JavaScript entrypoint."
|
|
43
|
-
},
|
|
44
|
-
"meta": {
|
|
45
|
-
"type": "string",
|
|
46
|
-
"default": "dist/meta.json",
|
|
47
|
-
"description": "esbuild bundle metadata file output."
|
|
48
|
-
},
|
|
49
|
-
"out": {
|
|
50
|
-
"type": "object",
|
|
51
|
-
"description": "output config.",
|
|
52
|
-
"additionalProperties": false,
|
|
53
|
-
"properties": {
|
|
54
|
-
"dir": {
|
|
55
|
-
"type": "string",
|
|
56
|
-
"description": "HTML and JavaScript output directory.",
|
|
57
|
-
"default": "dist/public/"
|
|
58
|
-
},
|
|
59
|
-
"name": {
|
|
60
|
-
"type": "string",
|
|
61
|
-
"description": "HTML output file stem when watch is disabled. defaults to entry.",
|
|
62
|
-
"examples": ["index", "super-patience"]
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
"preloadAtlas": {"$ref": "#/$defs/Atlas"}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type {TagFormat} from '../../src/graphics/atlas.ts'
|
|
2
|
-
import type {Box, WH} from '../../src/types/geo.ts'
|
|
3
|
-
|
|
4
|
-
/** https://github.com/aseprite/aseprite/blob/master/docs/ase-file-specs.md */
|
|
5
|
-
export type Aseprite = {meta: AsepriteMeta; frames: AsepriteFrameMap}
|
|
6
|
-
|
|
7
|
-
export type AsepriteFrameMap = {[tag: AsepriteFrameTag]: AsepriteFrame}
|
|
8
|
-
|
|
9
|
-
export type AsepriteMeta = {
|
|
10
|
-
/** `--list-tags`. */
|
|
11
|
-
frameTags: AsepriteTagSpan[]
|
|
12
|
-
size: WH
|
|
13
|
-
/** `--list-slices`. */
|
|
14
|
-
slices: AsepriteSlice[]
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/** `--filename-format='{title}--{tag}--{frame}'`. */
|
|
18
|
-
export type AsepriteFrameTag = `${TagFormat}--${bigint}`
|
|
19
|
-
|
|
20
|
-
export type AsepriteFrame = {
|
|
21
|
-
/** positive animation length in milliseconds. */
|
|
22
|
-
duration: number
|
|
23
|
-
/** bounds including padding. */
|
|
24
|
-
frame: Box
|
|
25
|
-
/** WH without padding. */
|
|
26
|
-
sourceSize: WH
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type AsepriteTagSpan = {
|
|
30
|
-
direction: AsepriteDirection | string
|
|
31
|
-
name: TagFormat | string
|
|
32
|
-
from: number
|
|
33
|
-
/** inclusive ending index, possibly equal to from. */
|
|
34
|
-
to: number
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export type AsepriteSlice = {
|
|
38
|
-
/** '#ff0000ff' is hitbox, '#00ff00ff' is hurtbox, '#0000ffff is both. */
|
|
39
|
-
color: string
|
|
40
|
-
name: TagFormat | string
|
|
41
|
-
keys: {bounds: Box}[]
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export type AsepriteDirection =
|
|
45
|
-
(typeof AsepriteDirection)[keyof typeof AsepriteDirection]
|
|
46
|
-
export const AsepriteDirection = {
|
|
47
|
-
/** animate from start to end; when looping, return to start. */
|
|
48
|
-
Forward: 'forward',
|
|
49
|
-
/** animate from end to start; when looping, return to end. */
|
|
50
|
-
Reverse: 'reverse',
|
|
51
|
-
/**
|
|
52
|
-
* animate from start to end - 1 or start, whichever is greater; when
|
|
53
|
-
* looping, change direction (initially, end to start + 1 or end, whichever
|
|
54
|
-
* is lesser. a traversal from start to end - 1 then end to start + 1 is
|
|
55
|
-
* considered a complete loop.
|
|
56
|
-
*/
|
|
57
|
-
PingPong: 'pingpong',
|
|
58
|
-
/** like pingpong but start from end - 1 or start, whichever is greater. */
|
|
59
|
-
PingPongReverse: 'pingpong_reverse'
|
|
60
|
-
} as const
|