1681-engine 0.5.9 → 0.6.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/CHANGELOG.md +92 -1
- package/README.md +15 -6
- package/dist/1681-engine.js +588 -465
- package/dist/ai/behaviorTree.js +198 -0
- package/dist/ai/buildTree.js +54 -0
- package/dist/ambient/life/Birds.js +73 -0
- package/dist/ambient/life/Butterflies.js +43 -0
- package/dist/ambient/life/ChimneySmoke.js +50 -0
- package/dist/ambient/life/Drift.js +75 -0
- package/dist/ambient/life/Fireflies.js +52 -0
- package/dist/ambient/life/lifeMotion.js +49 -0
- package/dist/assets/AssetLoader.js +115 -70
- package/dist/assets/Prepainter.js +61 -0
- package/dist/assets/workerPainter.js +39 -0
- package/dist/audio/spatial.js +118 -0
- package/dist/cjs/electron/electronLike.d.ts +55 -0
- package/dist/cjs/electron/electronLike.js +7 -0
- package/dist/cjs/electron/index.d.ts +14 -0
- package/dist/cjs/electron/index.js +20 -0
- package/dist/cjs/electron/lockdown.d.ts +33 -0
- package/dist/cjs/electron/lockdown.js +69 -0
- package/dist/cjs/electron/lockdownRules.d.ts +28 -0
- package/dist/cjs/electron/lockdownRules.js +61 -0
- package/dist/cjs/electron/sessionStore.d.ts +40 -0
- package/dist/cjs/electron/sessionStore.js +77 -0
- package/dist/cjs/electron/shellId.d.ts +22 -0
- package/dist/cjs/electron/shellId.js +31 -0
- package/dist/cjs/electron/webFiles.d.ts +13 -0
- package/dist/cjs/electron/webFiles.js +52 -0
- package/dist/cjs/electron/webPatcher.d.ts +83 -0
- package/dist/cjs/electron/webPatcher.js +223 -0
- package/dist/cjs/electron/webPointers.d.ts +19 -0
- package/dist/cjs/electron/webPointers.js +35 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/updates/index.d.ts +8 -0
- package/dist/cjs/updates/index.js +21 -0
- package/dist/cjs/updates/manifest.d.ts +73 -0
- package/dist/cjs/updates/manifest.js +67 -0
- package/dist/cjs/updates/pickUpdate.d.ts +42 -0
- package/dist/cjs/updates/pickUpdate.js +52 -0
- package/dist/cjs/updates/webPlan.d.ts +20 -0
- package/dist/cjs/updates/webPlan.js +34 -0
- package/dist/dialogue/DialogueRunner.js +173 -0
- package/dist/dialogue/expr.js +137 -0
- package/dist/dialogue/validateDialogue.js +52 -0
- package/dist/ecs/prefab.js +94 -0
- package/dist/electron/lockdown.js +31 -0
- package/dist/electron/lockdownRules.js +42 -0
- package/dist/electron/sessionStore.js +48 -0
- package/dist/electron/shellId.js +18 -0
- package/dist/electron/webFiles.js +36 -0
- package/dist/electron/webPatcher.js +153 -0
- package/dist/electron/webPointers.js +25 -0
- package/dist/electron.js +19 -0
- package/dist/input/Actions.js +58 -27
- package/dist/input/InputCapture.js +98 -0
- package/dist/input/Keymap.js +32 -26
- package/dist/input/haptics.js +50 -0
- package/dist/input/inputTape.js +68 -0
- package/dist/mobile/backButton.js +40 -0
- package/dist/mobile/capacitor.js +48 -0
- package/dist/mobile/screen.js +31 -0
- package/dist/mobile.js +12 -0
- package/dist/nav/flowField.js +58 -0
- package/dist/nav/steering.js +77 -0
- package/dist/net/ApiClient.js +96 -0
- package/dist/net/InterpolationBuffer.js +30 -23
- package/dist/net/LagCompensator.js +100 -0
- package/dist/net/Room.js +122 -43
- package/dist/net/RoomHost.js +13 -4
- package/dist/net/SpatialHash.js +66 -0
- package/dist/pixel/lifeArt.js +83 -0
- package/dist/pixel.js +63 -58
- package/dist/react/ConfirmButton.js +24 -0
- package/dist/react/baseCss.js +1 -0
- package/dist/react/labels.js +7 -6
- package/dist/react/useJsonSelector.js +13 -0
- package/dist/react.js +73 -68
- package/dist/tilemap/TilemapView.js +57 -32
- package/dist/tilemap/autotile.js +103 -0
- package/dist/tilemap/collision.js +29 -18
- package/dist/tilemap/ldtk.js +21 -0
- package/dist/tilemap/ldtkParse.js +191 -0
- package/dist/types/ai/behaviorTree.d.ts +133 -0
- package/dist/types/ai/behaviorTree.d.ts.map +1 -0
- package/dist/types/ai/buildTree.d.ts +55 -0
- package/dist/types/ai/buildTree.d.ts.map +1 -0
- package/dist/types/ambient/life/Birds.d.ts +50 -0
- package/dist/types/ambient/life/Birds.d.ts.map +1 -0
- package/dist/types/ambient/life/Butterflies.d.ts +32 -0
- package/dist/types/ambient/life/Butterflies.d.ts.map +1 -0
- package/dist/types/ambient/life/ChimneySmoke.d.ts +37 -0
- package/dist/types/ambient/life/ChimneySmoke.d.ts.map +1 -0
- package/dist/types/ambient/life/Drift.d.ts +58 -0
- package/dist/types/ambient/life/Drift.d.ts.map +1 -0
- package/dist/types/ambient/life/Fireflies.d.ts +43 -0
- package/dist/types/ambient/life/Fireflies.d.ts.map +1 -0
- package/dist/types/ambient/life/lifeMotion.d.ts +63 -0
- package/dist/types/ambient/life/lifeMotion.d.ts.map +1 -0
- package/dist/types/assets/AssetLoader.d.ts +20 -0
- package/dist/types/assets/AssetLoader.d.ts.map +1 -1
- package/dist/types/assets/Prepainter.d.ts +64 -0
- package/dist/types/assets/Prepainter.d.ts.map +1 -0
- package/dist/types/assets/workerPainter.d.ts +21 -0
- package/dist/types/assets/workerPainter.d.ts.map +1 -0
- package/dist/types/audio/spatial.d.ts +107 -0
- package/dist/types/audio/spatial.d.ts.map +1 -0
- package/dist/types/dialogue/DialogueRunner.d.ts +78 -0
- package/dist/types/dialogue/DialogueRunner.d.ts.map +1 -0
- package/dist/types/dialogue/expr.d.ts +12 -0
- package/dist/types/dialogue/expr.d.ts.map +1 -0
- package/dist/types/dialogue/script.d.ts +78 -0
- package/dist/types/dialogue/script.d.ts.map +1 -0
- package/dist/types/dialogue/validateDialogue.d.ts +21 -0
- package/dist/types/dialogue/validateDialogue.d.ts.map +1 -0
- package/dist/types/ecs/prefab.d.ts +84 -0
- package/dist/types/ecs/prefab.d.ts.map +1 -0
- package/dist/types/electron/electronLike.d.ts +56 -0
- package/dist/types/electron/electronLike.d.ts.map +1 -0
- package/dist/types/electron/index.d.ts +15 -0
- package/dist/types/electron/index.d.ts.map +1 -0
- package/dist/types/electron/lockdown.d.ts +34 -0
- package/dist/types/electron/lockdown.d.ts.map +1 -0
- package/dist/types/electron/lockdownRules.d.ts +29 -0
- package/dist/types/electron/lockdownRules.d.ts.map +1 -0
- package/dist/types/electron/sessionStore.d.ts +41 -0
- package/dist/types/electron/sessionStore.d.ts.map +1 -0
- package/dist/types/electron/shellId.d.ts +23 -0
- package/dist/types/electron/shellId.d.ts.map +1 -0
- package/dist/types/electron/webFiles.d.ts +14 -0
- package/dist/types/electron/webFiles.d.ts.map +1 -0
- package/dist/types/electron/webPatcher.d.ts +84 -0
- package/dist/types/electron/webPatcher.d.ts.map +1 -0
- package/dist/types/electron/webPointers.d.ts +20 -0
- package/dist/types/electron/webPointers.d.ts.map +1 -0
- package/dist/types/index.d.ts +30 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/input/Actions.d.ts +14 -0
- package/dist/types/input/Actions.d.ts.map +1 -1
- package/dist/types/input/InputCapture.d.ts +53 -0
- package/dist/types/input/InputCapture.d.ts.map +1 -0
- package/dist/types/input/Keymap.d.ts +12 -6
- package/dist/types/input/Keymap.d.ts.map +1 -1
- package/dist/types/input/haptics.d.ts +42 -0
- package/dist/types/input/haptics.d.ts.map +1 -0
- package/dist/types/input/inputTape.d.ts +66 -0
- package/dist/types/input/inputTape.d.ts.map +1 -0
- package/dist/types/mobile/backButton.d.ts +30 -0
- package/dist/types/mobile/backButton.d.ts.map +1 -0
- package/dist/types/mobile/capacitor.d.ts +62 -0
- package/dist/types/mobile/capacitor.d.ts.map +1 -0
- package/dist/types/mobile/index.d.ts +4 -0
- package/dist/types/mobile/index.d.ts.map +1 -0
- package/dist/types/mobile/screen.d.ts +27 -0
- package/dist/types/mobile/screen.d.ts.map +1 -0
- package/dist/types/nav/flowField.d.ts +31 -0
- package/dist/types/nav/flowField.d.ts.map +1 -0
- package/dist/types/nav/steering.d.ts +47 -0
- package/dist/types/nav/steering.d.ts.map +1 -0
- package/dist/types/net/ApiClient.d.ts +74 -0
- package/dist/types/net/ApiClient.d.ts.map +1 -0
- package/dist/types/net/InterpolationBuffer.d.ts +5 -0
- package/dist/types/net/InterpolationBuffer.d.ts.map +1 -1
- package/dist/types/net/LagCompensator.d.ts +70 -0
- package/dist/types/net/LagCompensator.d.ts.map +1 -0
- package/dist/types/net/Room.d.ts +72 -3
- package/dist/types/net/Room.d.ts.map +1 -1
- package/dist/types/net/RoomHost.d.ts +8 -3
- package/dist/types/net/RoomHost.d.ts.map +1 -1
- package/dist/types/net/SpatialHash.d.ts +25 -0
- package/dist/types/net/SpatialHash.d.ts.map +1 -0
- package/dist/types/pixel/index.d.ts +1 -0
- package/dist/types/pixel/index.d.ts.map +1 -1
- package/dist/types/pixel/lifeArt.d.ts +63 -0
- package/dist/types/pixel/lifeArt.d.ts.map +1 -0
- package/dist/types/react/ConfirmButton.d.ts +26 -0
- package/dist/types/react/ConfirmButton.d.ts.map +1 -0
- package/dist/types/react/baseCss.d.ts +1 -1
- package/dist/types/react/baseCss.d.ts.map +1 -1
- package/dist/types/react/index.d.ts +2 -0
- package/dist/types/react/index.d.ts.map +1 -1
- package/dist/types/react/labels.d.ts +2 -0
- package/dist/types/react/labels.d.ts.map +1 -1
- package/dist/types/react/useJsonSelector.d.ts +13 -0
- package/dist/types/react/useJsonSelector.d.ts.map +1 -0
- package/dist/types/tilemap/TilemapView.d.ts +17 -0
- package/dist/types/tilemap/TilemapView.d.ts.map +1 -1
- package/dist/types/tilemap/autotile.d.ts +95 -0
- package/dist/types/tilemap/autotile.d.ts.map +1 -0
- package/dist/types/tilemap/collision.d.ts +8 -0
- package/dist/types/tilemap/collision.d.ts.map +1 -1
- package/dist/types/tilemap/ldtk.d.ts +97 -0
- package/dist/types/tilemap/ldtk.d.ts.map +1 -0
- package/dist/types/tilemap/ldtkParse.d.ts +26 -0
- package/dist/types/tilemap/ldtkParse.d.ts.map +1 -0
- package/dist/types/ui/ScrollView.d.ts.map +1 -1
- package/dist/types/updates/index.d.ts +9 -0
- package/dist/types/updates/index.d.ts.map +1 -0
- package/dist/types/updates/manifest.d.ts +74 -0
- package/dist/types/updates/manifest.d.ts.map +1 -0
- package/dist/types/updates/pickUpdate.d.ts +43 -0
- package/dist/types/updates/pickUpdate.d.ts.map +1 -0
- package/dist/types/updates/webPlan.d.ts +21 -0
- package/dist/types/updates/webPlan.d.ts.map +1 -0
- package/dist/ui/ScrollView.js +10 -8
- package/dist/updates/manifest.js +35 -0
- package/dist/updates/pickUpdate.js +27 -0
- package/dist/updates/webPlan.js +14 -0
- package/dist/updates.js +15 -0
- package/package.json +35 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type CollisionGrid, type CollisionGridOptions } from '../net/movement.js';
|
|
2
|
+
import type { LdtkIntGrid } from './ldtk.js';
|
|
2
3
|
import { type TileMap } from './tiled.js';
|
|
3
4
|
export interface TiledCollisionOptions extends Omit<CollisionGridOptions, 'ground'> {
|
|
4
5
|
/**
|
|
@@ -13,4 +14,11 @@ export interface TiledCollisionOptions extends Omit<CollisionGridOptions, 'groun
|
|
|
13
14
|
}
|
|
14
15
|
/** The `CollisionGrid` of a Tiled map, for `stepMover`; cells are the map's tiles. */
|
|
15
16
|
export declare function collisionFromTiled(map: TileMap, options?: TiledCollisionOptions): CollisionGrid;
|
|
17
|
+
/** Which IntGrid cells are solid: a list of values, or a test given the value and the name LDtk gives it. */
|
|
18
|
+
export type IntGridSolid = readonly number[] | ((value: number, name: string | undefined) => boolean);
|
|
19
|
+
/**
|
|
20
|
+
* The `CollisionGrid` of an LDtk IntGrid layer, for `stepMover`: the same grid `collisionFromTiled` builds, so movement,
|
|
21
|
+
* `navGridFromCollision` and `tileBodiesFromGrid` treat both editors' maps alike. `solid` says which values block.
|
|
22
|
+
*/
|
|
23
|
+
export declare function collisionFromIntGrid(grid: LdtkIntGrid, solid: IntGridSolid, options?: Omit<CollisionGridOptions, 'ground'>): CollisionGrid;
|
|
16
24
|
//# sourceMappingURL=collision.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collision.d.ts","sourceRoot":"","sources":["../../../src/tilemap/collision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACrG,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AAEtD,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,oBAAoB,EAAE,QAAQ,CAAC;IACjF;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CACvC;AAED,sFAAsF;AACtF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,GAAE,qBAA0B,GAAG,aAAa,CAsBnG"}
|
|
1
|
+
{"version":3,"file":"collision.d.ts","sourceRoot":"","sources":["../../../src/tilemap/collision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACrG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AAEtD,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,oBAAoB,EAAE,QAAQ,CAAC;IACjF;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CACvC;AAED,sFAAsF;AACtF,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,GAAE,qBAA0B,GAAG,aAAa,CAsBnG;AAED,6GAA6G;AAC7G,MAAM,MAAM,YAAY,GAAG,SAAS,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,KAAK,OAAO,CAAC,CAAC;AAEtG;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,GAAE,IAAI,CAAC,oBAAoB,EAAE,QAAQ,CAAM,GAAG,aAAa,CAW9I"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Projects made in LDtk (https://ldtk.io), read into the same `TileMap` a Tiled map becomes, so `TilemapView` draws
|
|
3
|
+
* an LDtk level and `collisionFromTiled` / `objectsOf` work on it unchanged. What LDtk has and Tiled has not —
|
|
4
|
+
* IntGrid values, entity fields with their full JSON, world positions — rides beside the map on `LdtkLevel`.
|
|
5
|
+
*
|
|
6
|
+
* Pure: no Pixi, no DOM. The parser is `parseLdtk` (in `ldtkParse.ts`); this file holds the model and its helpers.
|
|
7
|
+
*/
|
|
8
|
+
import type { TileMap, Tileset } from './tiled.js';
|
|
9
|
+
/** A field's value as LDtk exports it: a number, string, boolean, null, a point `{ cx, cy }`, an entity ref, an array… */
|
|
10
|
+
export type LdtkFieldValue = unknown;
|
|
11
|
+
/** `Free` and `GridVania` place levels by hand; the `Linear*` layouts line them up in order. */
|
|
12
|
+
export type LdtkWorldLayout = 'Free' | 'GridVania' | 'LinearHorizontal' | 'LinearVertical';
|
|
13
|
+
/** One IntGrid layer's values: what a level says each cell is (wall, water, ladder…), drawn or not. */
|
|
14
|
+
export interface LdtkIntGrid {
|
|
15
|
+
name: string;
|
|
16
|
+
width: number;
|
|
17
|
+
height: number;
|
|
18
|
+
gridSize: number;
|
|
19
|
+
/** Row-major values, 0 = empty. */
|
|
20
|
+
values: Int32Array;
|
|
21
|
+
/** The identifier LDtk gives each value (`1 → "wall"`); values named nothing are absent. */
|
|
22
|
+
names: Map<number, string>;
|
|
23
|
+
offsetX: number;
|
|
24
|
+
offsetY: number;
|
|
25
|
+
}
|
|
26
|
+
export interface LdtkEntity {
|
|
27
|
+
iid: string;
|
|
28
|
+
/** The entity definition's identifier (`Player`, `Chest`…). */
|
|
29
|
+
identifier: string;
|
|
30
|
+
/** The pivot point in level px (the layer's offset included): where LDtk shows the entity standing. */
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
pivotX: number;
|
|
36
|
+
pivotY: number;
|
|
37
|
+
/** The grid cell it stands in. */
|
|
38
|
+
cx: number;
|
|
39
|
+
cy: number;
|
|
40
|
+
tags: string[];
|
|
41
|
+
/** Every field instance by identifier, as exported (`Point`s, arrays and entity refs included). */
|
|
42
|
+
fields: Record<string, LdtkFieldValue>;
|
|
43
|
+
/** The layer it was placed on. */
|
|
44
|
+
layer: string;
|
|
45
|
+
}
|
|
46
|
+
export interface LdtkLevel {
|
|
47
|
+
identifier: string;
|
|
48
|
+
iid: string;
|
|
49
|
+
uid: number;
|
|
50
|
+
/** The level's top-left corner in world px (worked out for the `Linear*` layouts, which store -1). */
|
|
51
|
+
worldX: number;
|
|
52
|
+
worldY: number;
|
|
53
|
+
worldDepth: number;
|
|
54
|
+
pxWidth: number;
|
|
55
|
+
pxHeight: number;
|
|
56
|
+
bgColor: string;
|
|
57
|
+
fields: Record<string, LdtkFieldValue>;
|
|
58
|
+
/**
|
|
59
|
+
* The level as a `TileMap`: one tile layer per Tiles, AutoLayer and auto-tiled IntGrid layer (a layer stacking
|
|
60
|
+
* several tiles in a cell is split into `name`, `name#1`… drawn above it), one object layer per Entities layer, in
|
|
61
|
+
* draw order (LDtk lists its layers top first; here the bottom comes first, as in Tiled).
|
|
62
|
+
*/
|
|
63
|
+
map: TileMap;
|
|
64
|
+
intGrids: Map<string, LdtkIntGrid>;
|
|
65
|
+
entities: LdtkEntity[];
|
|
66
|
+
/** The separate `.ldtkl` file this level lives in, relative to the project, when the project saves levels apart. */
|
|
67
|
+
externalRelPath?: string;
|
|
68
|
+
/** False for an external level whose file was not handed to `parseLdtk`: everything but its layers is known. */
|
|
69
|
+
loaded: boolean;
|
|
70
|
+
}
|
|
71
|
+
export interface LdtkWorld {
|
|
72
|
+
identifier: string;
|
|
73
|
+
iid: string;
|
|
74
|
+
layout: LdtkWorldLayout;
|
|
75
|
+
gridWidth: number;
|
|
76
|
+
gridHeight: number;
|
|
77
|
+
levels: LdtkLevel[];
|
|
78
|
+
}
|
|
79
|
+
export interface LdtkProject {
|
|
80
|
+
jsonVersion: string;
|
|
81
|
+
defaultGridSize: number;
|
|
82
|
+
bgColor: string;
|
|
83
|
+
/** Every tileset with an image, gids allotted in definition order (the same in every level's `map`). */
|
|
84
|
+
tilesets: Tileset[];
|
|
85
|
+
/** One world, or several in a multi-worlds project. */
|
|
86
|
+
worlds: LdtkWorld[];
|
|
87
|
+
/** Every level of every world. */
|
|
88
|
+
levels: LdtkLevel[];
|
|
89
|
+
}
|
|
90
|
+
export declare function levelByName(project: LdtkProject, identifier: string): LdtkLevel | undefined;
|
|
91
|
+
/** The level whose rectangle holds world point (x, y), the deepest-listed first; null between levels. */
|
|
92
|
+
export declare function levelAt(levels: readonly LdtkLevel[], x: number, y: number, depth?: number): LdtkLevel | null;
|
|
93
|
+
/** An IntGrid cell's value; 0 outside the grid. */
|
|
94
|
+
export declare function intGridAt(grid: LdtkIntGrid, cx: number, cy: number): number;
|
|
95
|
+
/** Every entity of a level (optionally only one identifier). */
|
|
96
|
+
export declare function entitiesOf(level: LdtkLevel, identifier?: string): LdtkEntity[];
|
|
97
|
+
//# sourceMappingURL=ldtk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ldtk.d.ts","sourceRoot":"","sources":["../../../src/tilemap/ldtk.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEhD,0HAA0H;AAC1H,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC;AAErC,gGAAgG;AAChG,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,WAAW,GAAG,kBAAkB,GAAG,gBAAgB,CA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AAU,EAAE,CAE9E"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The LDtk reader: a project's JSON (and its `.ldtkl` level files, when it saves levels apart) into `LdtkProject`.
|
|
3
|
+
* Supported: IntGrid, AutoLayer, Tiles and Entities layers; tilesets with an image; tile custom data and enum tags
|
|
4
|
+
* (as tile properties); entity and level fields; Free, GridVania and Linear world layouts; multi-worlds projects.
|
|
5
|
+
* Not drawn: the IntGrid colours of a layer with no tileset, the embedded icon atlas, level backgrounds.
|
|
6
|
+
*
|
|
7
|
+
* Pure: no Pixi, no DOM.
|
|
8
|
+
*/
|
|
9
|
+
import type { LdtkLevel, LdtkProject } from './ldtk.js';
|
|
10
|
+
/** The `.ldtkl` files a project saves its levels in, relative to the project file; empty when levels are inline. */
|
|
11
|
+
export declare function ldtkExternalLevels(json: unknown): string[];
|
|
12
|
+
export interface LdtkParseOptions {
|
|
13
|
+
/**
|
|
14
|
+
* The parsed JSON of each external level file, by the `externalRelPath` the project names it with
|
|
15
|
+
* (`ldtkExternalLevels` lists them). A level left out stays `loaded: false`, so levels can be streamed in later.
|
|
16
|
+
*/
|
|
17
|
+
levels?: Record<string, unknown> | ((relPath: string) => unknown);
|
|
18
|
+
}
|
|
19
|
+
/** Reads an LDtk project (already `JSON.parse`d). Throws an `LDtk project: …` error saying what is wrong. */
|
|
20
|
+
export declare function parseLdtk(json: unknown, options?: LdtkParseOptions): LdtkProject;
|
|
21
|
+
/**
|
|
22
|
+
* Reads one external level file into a level `parseLdtk` left unloaded (`loaded: false`), for projects that stream
|
|
23
|
+
* their levels. Returns the same level, now loaded.
|
|
24
|
+
*/
|
|
25
|
+
export declare function loadLdtkLevel(project: LdtkProject, projectJson: unknown, level: LdtkLevel, levelJson: unknown): LdtkLevel;
|
|
26
|
+
//# sourceMappingURL=ldtkParse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ldtkParse.d.ts","sourceRoot":"","sources":["../../../src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AQ;IAahB,OAAO,CAAC,OAAO;IAef,SAAS,CAAC,MAAM,IAAI,IAAI;CA0BzB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `1681-engine/updates`: file-by-file web updates from a release store, the pure half — the feed's shapes, which web
|
|
3
|
+
* to take, and what to copy or download to build it. No Node, DOM or Electron: shared by the desktop shell
|
|
4
|
+
* (`1681-engine/electron`), a browser build and the phone apps.
|
|
5
|
+
*/
|
|
6
|
+
export { isNewer, safePath, isSha256, validManifest, fileUrl, type WebFile, type WebManifest, type LatestJson, type ReleaseFile, } from './manifest.js';
|
|
7
|
+
export { planWeb, type WebPlan } from './webPlan.js';
|
|
8
|
+
export { pickWebUpdate, apkUpdateOf, pluginEntries, heldBundle, type WebBundle, type NewerRelease, type PluginEntry } from './pickUpdate.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/updates/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,OAAO,EACP,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,WAAW,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shapes of a release store's feed for file-by-file web updates, and the rules for trusting one. One definition
|
|
3
|
+
* for every client that reads it: the desktop shell's patcher (`1681-engine/electron`), a browser build and the phone
|
|
4
|
+
* apps' over-the-air updater. A publish script writes, per channel:
|
|
5
|
+
*
|
|
6
|
+
* - `<channel>/latest.json` ({@link LatestJson}): the newest build and where its pieces lie, as paths under the channel,
|
|
7
|
+
* written last so a client never reads a release that is half up;
|
|
8
|
+
* - `<channel>/web/<version>.json` ({@link WebManifest}): every file of the built web with its sha256;
|
|
9
|
+
* - `<channel>/files/<sha256>`: each content once, so a release uploads and a client downloads only what is new.
|
|
10
|
+
*
|
|
11
|
+
* Kept pure (no Node, no DOM, no Electron) so a phone's web view and an Electron main process share it.
|
|
12
|
+
*/
|
|
13
|
+
/** One file of a built web, as the manifest lists it. */
|
|
14
|
+
export interface WebFile {
|
|
15
|
+
/** Relative to the web's root, forward slashes (`assets/index-3f2a.js`). */
|
|
16
|
+
path: string;
|
|
17
|
+
/** Lower-case hex sha256 of the content; also its name under `<channel>/files/`. */
|
|
18
|
+
sha256: string;
|
|
19
|
+
size: number;
|
|
20
|
+
}
|
|
21
|
+
/** `<channel>/web/<version>.json`. */
|
|
22
|
+
export interface WebManifest {
|
|
23
|
+
version: string;
|
|
24
|
+
/**
|
|
25
|
+
* The desktop shell this web needs (`shellId` in `1681-engine/electron`): a web talks to its shell through a
|
|
26
|
+
* preload script and may need what a newer shell adds, so any other shell takes the installer instead.
|
|
27
|
+
*/
|
|
28
|
+
shell: string;
|
|
29
|
+
/** The lowest native build of the phone apps this web needs: a web calling a plugin the app lacks must never reach it. */
|
|
30
|
+
minNative: number;
|
|
31
|
+
files: WebFile[];
|
|
32
|
+
}
|
|
33
|
+
/** A packaged download listed in `latest.json` (an APK, an installer). */
|
|
34
|
+
export interface ReleaseFile {
|
|
35
|
+
file: string;
|
|
36
|
+
size: number;
|
|
37
|
+
sha256?: string;
|
|
38
|
+
}
|
|
39
|
+
/** `<channel>/latest.json`. */
|
|
40
|
+
export interface LatestJson {
|
|
41
|
+
version: string;
|
|
42
|
+
date?: string;
|
|
43
|
+
/** The build's web: its manifest's path under the channel, the shell and native build it needs. */
|
|
44
|
+
web?: {
|
|
45
|
+
manifest: string;
|
|
46
|
+
shell: string;
|
|
47
|
+
minNative: number;
|
|
48
|
+
};
|
|
49
|
+
/** The Android package, when the channel publishes one. */
|
|
50
|
+
apk?: {
|
|
51
|
+
file: string;
|
|
52
|
+
size: number;
|
|
53
|
+
sha256: string;
|
|
54
|
+
};
|
|
55
|
+
/** Desktop installers by platform key (the publisher names the keys, e.g. `win`, `macArm`, `macX64`). */
|
|
56
|
+
desktop?: Record<string, ReleaseFile | undefined>;
|
|
57
|
+
}
|
|
58
|
+
/** Whether version `a` ("0.5.23", "v0.5.23") is newer than `b`, number by number; a missing part counts 0. */
|
|
59
|
+
export declare function isNewer(a: string, b: string): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* A path a manifest may name: relative, forward slashes, no `.` or `..` segment, no NUL — nothing that could write
|
|
62
|
+
* outside the web's own folder once joined to it.
|
|
63
|
+
*/
|
|
64
|
+
export declare function safePath(p: string): boolean;
|
|
65
|
+
/** Whether `s` is a lower-case hex sha256. */
|
|
66
|
+
export declare function isSha256(s: unknown): s is string;
|
|
67
|
+
/**
|
|
68
|
+
* A manifest whose shape may be trusted: every path safe and listed once, every hash a sha256, every size a number,
|
|
69
|
+
* and an `index.html` (a web without one cannot be loaded, and a truncated upload is the usual way to get one).
|
|
70
|
+
*/
|
|
71
|
+
export declare function validManifest(m: unknown): m is WebManifest;
|
|
72
|
+
/** Where a content lies in the store: `<channelUrl>/files/<sha256>`. */
|
|
73
|
+
export declare function fileUrl(channelUrl: string, sha256: string): string;
|
|
74
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/updates/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,yDAAyD;AACzD,MAAM,WAAW,OAAO;IACtB,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC;IACb,oFAAoF;IACpF,MAAM,EAAE,MAAM,CAAC;IACf,I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AAgB,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAElE"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type LatestJson } from './manifest.js';
|
|
2
|
+
/** A web a client may take: its version, its manifest's full URL and the native build it needs. */
|
|
3
|
+
export interface WebBundle {
|
|
4
|
+
version: string;
|
|
5
|
+
manifestUrl: string;
|
|
6
|
+
minNative: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The web to take from `latest`: newer than the web running (`webVersion`), and needing no native code this app lacks
|
|
10
|
+
* (`nativeBuild` ≥ the web's `minNative`). A browser or desktop build with no native layer passes `Infinity`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function pickWebUpdate(latest: LatestJson, channelUrl: string, webVersion: string, nativeBuild: number): WebBundle | null;
|
|
13
|
+
/** A newer build than this one, and where its Android package downloads from. */
|
|
14
|
+
export interface NewerRelease {
|
|
15
|
+
version: string;
|
|
16
|
+
apkUrl: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The build's APK, when it is newer than this client and its web cannot come over the air instead (`webBundle` is
|
|
20
|
+
* what {@link pickWebUpdate} found): the package is the slow road, for native changes.
|
|
21
|
+
*/
|
|
22
|
+
export declare function apkUpdateOf(latest: LatestJson, channelUrl: string, clientVersion: string, webBundle: WebBundle | null): NewerRelease | null;
|
|
23
|
+
/** One entry of a multi-file bundle download, in the shape `@capgo/capacitor-updater`'s `ManifestEntry` takes. */
|
|
24
|
+
export interface PluginEntry {
|
|
25
|
+
file_name: string;
|
|
26
|
+
file_hash: string;
|
|
27
|
+
download_url: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A phone updater's download list for `manifest`, or null when the manifest is not one to trust (another version, an
|
|
31
|
+
* unsafe or repeated path, a bad hash, no `index.html`). The updater checks each file against its hash and reuses
|
|
32
|
+
* every file it already holds, so only new content is fetched.
|
|
33
|
+
*/
|
|
34
|
+
export declare function pluginEntries(manifest: unknown, version: string, channelUrl: string): PluginEntry[] | null;
|
|
35
|
+
/**
|
|
36
|
+
* A copy of `bundle` the updater already holds whole (downloaded and checked, applied or waiting), so asking again —
|
|
37
|
+
* a settings screen's check after the login screen's — takes it instead of downloading the same files twice.
|
|
38
|
+
*/
|
|
39
|
+
export declare function heldBundle<T extends {
|
|
40
|
+
version: string;
|
|
41
|
+
status: string;
|
|
42
|
+
}>(held: readonly T[], bundle: WebBundle): T | null;
|
|
43
|
+
//# sourceMappingURL=pickUpdate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pickUpdate.d.ts","sourceRoot":"","sources":["../../../src/updates/pickUpdate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,KAAK,UAAU,EAAoB,MAAM,YAAY,CAAC;AAErG,mGAAmG;AACnG,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAI/H;AAED,iFAAiF;AACjF,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,GAAG,YAAY,GAAG,IAAI,CAG3I;AAED,kHAAkH;AAClH,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,WAAW,EAAE,GAAG,IAAI,CAW1G;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,GAAG,CAAC,GAAG,IAAI,CAEzH"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { WebFile, WebManifest } from './manifest.js';
|
|
2
|
+
/** What building a new web takes, given the files a client already holds. */
|
|
3
|
+
export interface WebPlan {
|
|
4
|
+
/** Files taken from the web held now: `from` is their path there. */
|
|
5
|
+
copy: {
|
|
6
|
+
path: string;
|
|
7
|
+
from: string;
|
|
8
|
+
}[];
|
|
9
|
+
/** Files to fetch from `<channel>/files/<sha256>`; content shared by several paths appears once per path. */
|
|
10
|
+
download: WebFile[];
|
|
11
|
+
/** Bytes to download, each distinct content counted once. */
|
|
12
|
+
bytes: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* What to copy and what to download for `target`, given the web held now (`have`: path → sha256): a file whose path
|
|
16
|
+
* holds the same content is copied from there, one whose content lies under another path (a bundler renamed it) is
|
|
17
|
+
* copied from that path, and only content found nowhere is downloaded — once, however many paths share it. This is
|
|
18
|
+
* what makes a patch cost only what changed, the way a game launcher patches.
|
|
19
|
+
*/
|
|
20
|
+
export declare function planWeb(target: WebManifest, have: ReadonlyMap<string, string>): WebPlan;
|
|
21
|
+
//# sourceMappingURL=webPlan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webPlan.d.ts","sourceRoot":"","sources":["../../../src/updates/webPlan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEvD,6EAA6E;AAC7E,MAAM,WAAW,OAAO;IACtB,qEAAqE;IACrE,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACvC,6GAA6G;IAC7G,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,6DAA6D;IAC7D,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAoBvF"}
|
package/dist/ui/ScrollView.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Sprite as a, Texture as l, Rectangle as
|
|
1
|
+
import { Sprite as a, Texture as l, Rectangle as n, Container as c, Graphics as f } from "pixi.js";
|
|
2
2
|
import { clampScroll as p, scrollIntoView as d, stepFling as g, maxScroll as u } from "./layout/scroll.js";
|
|
3
|
-
import { Widget as
|
|
4
|
-
class w extends
|
|
3
|
+
import { Widget as r } from "./Widget.js";
|
|
4
|
+
class w extends r {
|
|
5
5
|
constructor(t) {
|
|
6
6
|
super(), this.options = t, this.addChild(this.content, this.clip), this.content.mask = this.clip;
|
|
7
7
|
const s = t.barColor === void 0 ? 16777215 : t.barColor;
|
|
8
|
-
this.bar = s === null ? null : new a(l.WHITE), this.bar && (this.bar.tint = s, this.bar.alpha = 0.4, this.addChild(this.bar)), this.makeInteractive(), this.hitArea = new
|
|
8
|
+
this.bar = s === null ? null : new a(l.WHITE), this.bar && (this.bar.tint = s, this.bar.alpha = 0.4, this.addChild(this.bar)), this.makeInteractive(), this.hitArea = new n(0, 0, 0, 0), this.on("wheel", (i) => {
|
|
9
9
|
const o = t.wheelStep ?? 48, e = Math.max(-o, Math.min(o, i.deltaY));
|
|
10
10
|
this.scrollTo(this.offset + e) && i.stopPropagation();
|
|
11
11
|
}), this.on("pointerdown", (i) => this.dragStart(i)), this.resize(t.width, t.height);
|
|
@@ -40,8 +40,10 @@ class w extends n {
|
|
|
40
40
|
}
|
|
41
41
|
/** Measures the content's drawn height; call after filling it. */
|
|
42
42
|
measure() {
|
|
43
|
-
const t = this.content.
|
|
44
|
-
|
|
43
|
+
const t = this.content.mask;
|
|
44
|
+
this.content.mask = null;
|
|
45
|
+
const s = this.content.getLocalBounds();
|
|
46
|
+
return this.content.mask = t, this.setContentHeight(s.maxY);
|
|
45
47
|
}
|
|
46
48
|
/** Scrolls to `y`, kept in range; true when it moved. */
|
|
47
49
|
scrollTo(t) {
|
|
@@ -50,7 +52,7 @@ class w extends n {
|
|
|
50
52
|
}
|
|
51
53
|
/** Brings a child into view (the focus manager calls it when a widget inside is focused). */
|
|
52
54
|
reveal(t) {
|
|
53
|
-
const s = this.content.toLocal(t.getGlobalPosition()).y, i = t instanceof
|
|
55
|
+
const s = this.content.toLocal(t.getGlobalPosition()).y, i = t instanceof r ? t.boxHeight : t.getLocalBounds().maxY;
|
|
54
56
|
this.velocity = 0, this.scrollTo(d(this.offset, s, i, this.boxH, this.contentH));
|
|
55
57
|
}
|
|
56
58
|
tick(t) {
|
|
@@ -79,7 +81,7 @@ class w extends n {
|
|
|
79
81
|
}
|
|
80
82
|
redraw() {
|
|
81
83
|
const t = this.boxW, s = this.boxH;
|
|
82
|
-
(t !== this.clipW || s !== this.clipH) && (this.clipW = t, this.clipH = s, this.clip.clear().rect(0, 0, t, s).fill(16777215)), this.hitArea instanceof
|
|
84
|
+
(t !== this.clipW || s !== this.clipH) && (this.clipW = t, this.clipH = s, this.clip.clear().rect(0, 0, t, s).fill(16777215)), this.hitArea instanceof n && (this.hitArea.width = t, this.hitArea.height = s);
|
|
83
85
|
const i = this.host?.pixelPerfect ?? !1;
|
|
84
86
|
if (this.content.y = i ? -Math.round(this.offset) : -this.offset, this.bar) {
|
|
85
87
|
const o = u(this.contentH, s);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
function u(t, e) {
|
|
2
|
+
const r = (s) => s.replace(/^v/, "").split(".").map((i) => Number.parseInt(i, 10) || 0), n = r(t), f = r(e);
|
|
3
|
+
for (let s = 0; s < Math.max(n.length, f.length); s++) {
|
|
4
|
+
const i = (n[s] ?? 0) - (f[s] ?? 0);
|
|
5
|
+
if (i !== 0) return i > 0;
|
|
6
|
+
}
|
|
7
|
+
return !1;
|
|
8
|
+
}
|
|
9
|
+
function a(t) {
|
|
10
|
+
return !t || t.startsWith("/") || t.includes("\\") || t.includes("\0") ? !1 : t.split("/").every((e) => e !== "" && e !== "." && e !== "..");
|
|
11
|
+
}
|
|
12
|
+
const o = /^[0-9a-f]{64}$/;
|
|
13
|
+
function l(t) {
|
|
14
|
+
return typeof t == "string" && o.test(t);
|
|
15
|
+
}
|
|
16
|
+
function c(t) {
|
|
17
|
+
const e = t;
|
|
18
|
+
if (!e || typeof e.version != "string" || typeof e.shell != "string" || !Array.isArray(e.files)) return !1;
|
|
19
|
+
const r = /* @__PURE__ */ new Set();
|
|
20
|
+
for (const n of e.files) {
|
|
21
|
+
if (!n || typeof n.path != "string" || !a(n.path) || r.has(n.path) || !l(n.sha256) || typeof n.size != "number") return !1;
|
|
22
|
+
r.add(n.path);
|
|
23
|
+
}
|
|
24
|
+
return r.has("index.html");
|
|
25
|
+
}
|
|
26
|
+
function h(t, e) {
|
|
27
|
+
return `${t}/files/${e}`;
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
h as fileUrl,
|
|
31
|
+
u as isNewer,
|
|
32
|
+
l as isSha256,
|
|
33
|
+
a as safePath,
|
|
34
|
+
c as validManifest
|
|
35
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { isNewer as o, safePath as u, isSha256 as f, fileUrl as l } from "./manifest.js";
|
|
2
|
+
function h(n, s, e, r) {
|
|
3
|
+
const t = n.web;
|
|
4
|
+
return !t || !o(n.version, e) || r < t.minNative ? null : { version: n.version, manifestUrl: `${s}/${t.manifest}`, minNative: t.minNative };
|
|
5
|
+
}
|
|
6
|
+
function c(n, s, e, r) {
|
|
7
|
+
return r || !n.apk || !o(n.version, e) ? null : { version: n.version, apkUrl: `${s}/${n.apk.file}` };
|
|
8
|
+
}
|
|
9
|
+
function v(n, s, e) {
|
|
10
|
+
const r = n;
|
|
11
|
+
if (!r || r.version !== s || !Array.isArray(r.files)) return null;
|
|
12
|
+
const t = [], a = /* @__PURE__ */ new Set();
|
|
13
|
+
for (const i of r.files) {
|
|
14
|
+
if (!i || typeof i.path != "string" || !u(i.path) || a.has(i.path) || !f(i.sha256)) return null;
|
|
15
|
+
a.add(i.path), t.push({ file_name: i.path, file_hash: i.sha256, download_url: l(e, i.sha256) });
|
|
16
|
+
}
|
|
17
|
+
return a.has("index.html") ? t : null;
|
|
18
|
+
}
|
|
19
|
+
function d(n, s) {
|
|
20
|
+
return n.find((e) => e.version === s.version && (e.status === "pending" || e.status === "success")) ?? null;
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
c as apkUpdateOf,
|
|
24
|
+
d as heldBundle,
|
|
25
|
+
h as pickWebUpdate,
|
|
26
|
+
v as pluginEntries
|
|
27
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
function c(p, o) {
|
|
2
|
+
const e = /* @__PURE__ */ new Map();
|
|
3
|
+
for (const [t, s] of o) e.has(s) || e.set(s, t);
|
|
4
|
+
const h = [], a = [], f = /* @__PURE__ */ new Set();
|
|
5
|
+
let n = 0;
|
|
6
|
+
for (const t of p.files) {
|
|
7
|
+
const s = e.get(t.sha256);
|
|
8
|
+
o.get(t.path) === t.sha256 ? h.push({ path: t.path, from: t.path }) : s !== void 0 ? h.push({ path: t.path, from: s }) : (a.push(t), f.has(t.sha256) || (f.add(t.sha256), n += t.size));
|
|
9
|
+
}
|
|
10
|
+
return { copy: h, download: a, bytes: n };
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
c as planWeb
|
|
14
|
+
};
|
package/dist/updates.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { fileUrl as p, isNewer as r, isSha256 as i, safePath as t, validManifest as f } from "./updates/manifest.js";
|
|
2
|
+
import { planWeb as o } from "./updates/webPlan.js";
|
|
3
|
+
import { apkUpdateOf as n, heldBundle as s, pickWebUpdate as h, pluginEntries as m } from "./updates/pickUpdate.js";
|
|
4
|
+
export {
|
|
5
|
+
n as apkUpdateOf,
|
|
6
|
+
p as fileUrl,
|
|
7
|
+
s as heldBundle,
|
|
8
|
+
r as isNewer,
|
|
9
|
+
i as isSha256,
|
|
10
|
+
h as pickWebUpdate,
|
|
11
|
+
o as planWeb,
|
|
12
|
+
m as pluginEntries,
|
|
13
|
+
t as safePath,
|
|
14
|
+
f as validManifest
|
|
15
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "1681-engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "A 2D game engine on PixiJS 8 for any art style: scenes and a fast ECS, a fixed-step loop, asset loading, Tiled maps, sprite animation, input actions, camera follow, audio and deterministic, server-replayable movement, plus Dither, an optional pixel-art module (pixel-perfect effects, dithered lighting).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|
|
@@ -33,14 +33,39 @@
|
|
|
33
33
|
"types": "./dist/types/pixel/pixelPaint.d.ts",
|
|
34
34
|
"import": "./dist/pixel/pixelPaint.js"
|
|
35
35
|
},
|
|
36
|
+
"./updates": {
|
|
37
|
+
"import": {
|
|
38
|
+
"types": "./dist/types/updates/index.d.ts",
|
|
39
|
+
"default": "./dist/updates.js"
|
|
40
|
+
},
|
|
41
|
+
"require": {
|
|
42
|
+
"types": "./dist/cjs/updates/index.d.ts",
|
|
43
|
+
"default": "./dist/cjs/updates/index.js"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"./electron": {
|
|
47
|
+
"import": {
|
|
48
|
+
"types": "./dist/types/electron/index.d.ts",
|
|
49
|
+
"default": "./dist/electron.js"
|
|
50
|
+
},
|
|
51
|
+
"require": {
|
|
52
|
+
"types": "./dist/cjs/electron/index.d.ts",
|
|
53
|
+
"default": "./dist/cjs/electron/index.js"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"./mobile": {
|
|
57
|
+
"types": "./dist/types/mobile/index.d.ts",
|
|
58
|
+
"import": "./dist/mobile.js"
|
|
59
|
+
},
|
|
36
60
|
"./package.json": "./package.json"
|
|
37
61
|
},
|
|
38
62
|
"scripts": {
|
|
39
63
|
"dev": "vite",
|
|
40
|
-
"build": "npm run clean && vite build && tsc -p tsconfig.build.json && node scripts/fix-dts-extensions.mjs",
|
|
64
|
+
"build": "npm run clean && vite build && tsc -p tsconfig.build.json && node scripts/fix-dts-extensions.mjs && tsc -p tsconfig.cjs.json && node scripts/mark-cjs.mjs",
|
|
41
65
|
"clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
42
66
|
"typecheck": "tsc --noEmit && tsc -p tsconfig.test.json",
|
|
43
67
|
"test": "node scripts/test.mjs",
|
|
68
|
+
"test:browser": "vitest run --config vitest.browser.config.ts",
|
|
44
69
|
"check": "npm run typecheck && npm test && npm run build",
|
|
45
70
|
"prepublishOnly": "npm run check",
|
|
46
71
|
"bench": "node --expose-gc --import tsx bench/ecs.bench.ts",
|
|
@@ -57,7 +82,9 @@
|
|
|
57
82
|
"@types/react": "^19.3.0",
|
|
58
83
|
"@types/react-dom": "^19.3.0",
|
|
59
84
|
"@types/ws": "^8.18.2",
|
|
85
|
+
"@vitest/browser-playwright": "^4.1.11",
|
|
60
86
|
"pixi.js": "^8.21.0",
|
|
87
|
+
"playwright": "^1.64.0",
|
|
61
88
|
"react": "^19.3.0",
|
|
62
89
|
"react-dom": "^19.3.0",
|
|
63
90
|
"tsx": "^4.20.5",
|
|
@@ -67,6 +94,7 @@
|
|
|
67
94
|
"typescript": "^5.9.2",
|
|
68
95
|
"vite": "^7.1.4",
|
|
69
96
|
"vitepress": "^1.6.4",
|
|
97
|
+
"vitest": "^4.1.11",
|
|
70
98
|
"ws": "^8.22.0"
|
|
71
99
|
},
|
|
72
100
|
"license": "MIT",
|
|
@@ -92,7 +120,8 @@
|
|
|
92
120
|
"peerDependencies": {
|
|
93
121
|
"pixi.js": "^8.6.0",
|
|
94
122
|
"react": "^19.0.0",
|
|
95
|
-
"react-dom": "^19.0.0"
|
|
123
|
+
"react-dom": "^19.0.0",
|
|
124
|
+
"electron": ">=28.0.0"
|
|
96
125
|
},
|
|
97
126
|
"peerDependenciesMeta": {
|
|
98
127
|
"react": {
|
|
@@ -100,6 +129,9 @@
|
|
|
100
129
|
},
|
|
101
130
|
"react-dom": {
|
|
102
131
|
"optional": true
|
|
132
|
+
},
|
|
133
|
+
"electron": {
|
|
134
|
+
"optional": true
|
|
103
135
|
}
|
|
104
136
|
},
|
|
105
137
|
"repository": {
|