1681-engine 0.5.9 → 0.5.10
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 +42 -0
- package/README.md +3 -0
- package/dist/1681-engine.js +501 -438
- 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/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 +80 -0
- package/dist/cjs/electron/webPatcher.js +216 -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/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 +147 -0
- package/dist/electron/webPointers.js +25 -0
- package/dist/electron.js +19 -0
- package/dist/input/haptics.js +50 -0
- package/dist/net/ApiClient.js +96 -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/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/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 +81 -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 +15 -2
- package/dist/types/index.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/net/ApiClient.d.ts +74 -0
- package/dist/types/net/ApiClient.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/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/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 +31 -3
package/dist/pixel.js
CHANGED
|
@@ -1,96 +1,101 @@
|
|
|
1
1
|
import { PixelLayer as i, addPixelLayer as a } from "./pixel/PixelLayer.js";
|
|
2
|
-
import { CLEAR as
|
|
3
|
-
import { P as
|
|
4
|
-
import { art as
|
|
5
|
-
import { MATERIALS as
|
|
6
|
-
import { selectiveOutline as
|
|
2
|
+
import { CLEAR as x, PixelGrid as s, PixelWindow as m, channels as l, hash2 as f, hex as h, makeSheet as n, mix as P, mulberry32 as R, rgba as L, shade as d, toCss as A, upscale as g, valueNoise as E, withAlpha as S } from "./pixel/pixel.js";
|
|
3
|
+
import { P as M } from "./pixel/palette.js";
|
|
4
|
+
import { art as T, groundShadow as _, litOutline as c, shadeBox as v } from "./pixel/propKit.js";
|
|
5
|
+
import { MATERIALS as C, RAMP_FACTOR_SET as F, hueShade as k, outlineOf as w, ramp as y, rampTones as W, registerMaterial as H } from "./pixel/ramp.js";
|
|
6
|
+
import { selectiveOutline as b } from "./pixel/selout.js";
|
|
7
7
|
import { chevronPixels as G, discRuns as V, ellipsePixels as q, ringPixels as B } from "./pixel/aimPixels.js";
|
|
8
|
-
import { PixelMarks as
|
|
8
|
+
import { PixelMarks as X } from "./pixel/PixelMarks.js";
|
|
9
9
|
import * as e from "./pixel/pixelPaint.js";
|
|
10
10
|
import * as r from "./pixel/pixelTone.js";
|
|
11
|
-
import { registerHandRamps as
|
|
12
|
-
import { paintLayer as
|
|
11
|
+
import { registerHandRamps as z } from "./pixel/pixelTone.js";
|
|
12
|
+
import { paintLayer as K } from "./pixel/paintLayer.js";
|
|
13
13
|
import { Evaporation as Y } from "./pixel/Evaporation.js";
|
|
14
14
|
import { NO_PIXELS as $, PackedPixels as ee, spritePixels as re } from "./pixel/spritePixels.js";
|
|
15
15
|
import { CARRIED_LIGHT as oe, Darkness as ie, LAMP_DIM as ae, WARM_LIGHT as pe } from "./pixel/Darkness.js";
|
|
16
|
-
import { carriedLight as
|
|
16
|
+
import { carriedLight as se, clearLights as me, flashLight as le, liveLights as fe } from "./pixel/lights.js";
|
|
17
17
|
import { NightShade as ne } from "./pixel/NightShade.js";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
18
|
+
import { LIFE_COLORS as Re, PUFF_FRAMES as Le, paintLifeArt as de, puffPixels as Ae } from "./pixel/lifeArt.js";
|
|
19
|
+
import { WEATHER_COLORS as Ee, mistPixels as Se, paintWeatherArt as ue } from "./pixel/weatherArt.js";
|
|
20
|
+
import { buildRig as Oe, complement as Te, gustAt as _e, swayOffset as ce, tileHash as ve, trunkPivot as Ie } from "./pixel/swayRig.js";
|
|
21
|
+
import { SwayProp as Fe, opaqueRowWidths as ke } from "./pixel/SwayProp.js";
|
|
22
|
+
import { heartbeat as ye, vignetteMask as We } from "./pixel/vignetteMask.js";
|
|
23
|
+
import { DitherVignette as Ne, ditherVignette as be } from "./pixel/DitherVignette.js";
|
|
24
|
+
import { FRAME_CORNERS as Ge, FRAME_TWINS as Ve, frameSvg as qe, nineSlice as Be } from "./pixel/nineSlice.js";
|
|
24
25
|
export {
|
|
25
26
|
oe as CARRIED_LIGHT,
|
|
26
|
-
|
|
27
|
+
x as CLEAR,
|
|
27
28
|
ie as Darkness,
|
|
28
|
-
|
|
29
|
+
Ne as DitherVignette,
|
|
29
30
|
Y as Evaporation,
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
Ge as FRAME_CORNERS,
|
|
32
|
+
Ve as FRAME_TWINS,
|
|
32
33
|
ae as LAMP_DIM,
|
|
33
|
-
|
|
34
|
+
Re as LIFE_COLORS,
|
|
35
|
+
C as MATERIALS,
|
|
34
36
|
$ as NO_PIXELS,
|
|
35
37
|
ne as NightShade,
|
|
36
|
-
|
|
38
|
+
M as PALETTE,
|
|
39
|
+
Le as PUFF_FRAMES,
|
|
37
40
|
ee as PackedPixels,
|
|
38
|
-
|
|
41
|
+
s as PixelGrid,
|
|
39
42
|
i as PixelLayer,
|
|
40
|
-
|
|
43
|
+
X as PixelMarks,
|
|
41
44
|
m as PixelWindow,
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
F as RAMP_FACTOR_SET,
|
|
46
|
+
Fe as SwayProp,
|
|
44
47
|
pe as WARM_LIGHT,
|
|
45
|
-
|
|
48
|
+
Ee as WEATHER_COLORS,
|
|
46
49
|
a as addPixelLayer,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
T as art,
|
|
51
|
+
Oe as buildRig,
|
|
52
|
+
se as carriedLight,
|
|
50
53
|
l as channels,
|
|
51
54
|
G as chevronPixels,
|
|
52
55
|
me as clearLights,
|
|
53
|
-
|
|
56
|
+
Te as complement,
|
|
54
57
|
V as discRuns,
|
|
55
|
-
|
|
58
|
+
be as ditherVignette,
|
|
56
59
|
q as ellipsePixels,
|
|
57
60
|
le as flashLight,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
qe as frameSvg,
|
|
62
|
+
_ as groundShadow,
|
|
63
|
+
_e as gustAt,
|
|
61
64
|
f as hash2,
|
|
62
|
-
|
|
65
|
+
ye as heartbeat,
|
|
63
66
|
h as hex,
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
k as hueShade,
|
|
68
|
+
c as litOutline,
|
|
66
69
|
fe as liveLights,
|
|
67
70
|
n as makeSheet,
|
|
68
|
-
|
|
71
|
+
Se as mistPixels,
|
|
69
72
|
P as mix,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
R as mulberry32,
|
|
74
|
+
Be as nineSlice,
|
|
75
|
+
ke as opaqueRowWidths,
|
|
76
|
+
w as outlineOf,
|
|
77
|
+
K as paintLayer,
|
|
78
|
+
de as paintLifeArt,
|
|
79
|
+
ue as paintWeatherArt,
|
|
76
80
|
e as pixelPaint,
|
|
77
81
|
r as pixelTone,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
Ae as puffPixels,
|
|
83
|
+
y as ramp,
|
|
84
|
+
W as rampTones,
|
|
85
|
+
z as registerHandRamps,
|
|
86
|
+
H as registerMaterial,
|
|
87
|
+
L as rgba,
|
|
83
88
|
B as ringPixels,
|
|
84
|
-
|
|
85
|
-
|
|
89
|
+
b as selectiveOutline,
|
|
90
|
+
d as shade,
|
|
86
91
|
v as shadeBox,
|
|
87
92
|
re as spritePixels,
|
|
88
|
-
|
|
89
|
-
|
|
93
|
+
ce as swayOffset,
|
|
94
|
+
ve as tileHash,
|
|
90
95
|
A as toCss,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
Ie as trunkPivot,
|
|
97
|
+
g as upscale,
|
|
98
|
+
E as valueNoise,
|
|
99
|
+
We as vignetteMask,
|
|
100
|
+
S as withAlpha
|
|
96
101
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import { useState as A } from "react";
|
|
3
|
+
import { useCx as C, useUi as L } from "./UiProvider.js";
|
|
4
|
+
import { DEFAULT_LABELS as h } from "./labels.js";
|
|
5
|
+
function U({ armKey: n = "armed", armed: s, setArmed: t, onConfirm: c, label: e, armedLabel: l, title: u, className: m = "small", disabled: a }) {
|
|
6
|
+
const f = C(), p = L(), [b, d] = A(null), r = t !== void 0, x = r ? s ?? null : b, i = r ? t : d, o = x === n;
|
|
7
|
+
return /* @__PURE__ */ g(
|
|
8
|
+
"button",
|
|
9
|
+
{
|
|
10
|
+
type: "button",
|
|
11
|
+
className: f("e1681-button", m, o ? "e1681-armed primary" : "ghost"),
|
|
12
|
+
disabled: a,
|
|
13
|
+
onClick: () => {
|
|
14
|
+
if (!o) return i(n);
|
|
15
|
+
c(), i(null);
|
|
16
|
+
},
|
|
17
|
+
title: u,
|
|
18
|
+
children: o ? l ?? p.labels.confirmAgain ?? h.confirmAgain : e
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
U as ConfirmButton
|
|
24
|
+
};
|
package/dist/react/baseCss.js
CHANGED
|
@@ -86,6 +86,7 @@ const o = `
|
|
|
86
86
|
.e1681-button { padding: 2px 10px; cursor: pointer; min-height: 28px; }
|
|
87
87
|
.e1681-button.small { padding: 0 6px; min-height: 22px; }
|
|
88
88
|
.e1681-button.ghost { background-color: transparent; }
|
|
89
|
+
.e1681-button.e1681-armed { color: var(--e1681-accent); }
|
|
89
90
|
.e1681-button:hover:not(:disabled) { color: var(--e1681-accent); }
|
|
90
91
|
/* pressed: the same face a pixel lower, never a transform */
|
|
91
92
|
.e1681-button:active:not(:disabled) { padding-top: 3px; padding-bottom: 1px; }
|
package/dist/react/labels.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const c = {
|
|
2
2
|
close: "Close {0}",
|
|
3
3
|
closeHint: "Close (Esc)",
|
|
4
4
|
backToList: "‹ List",
|
|
@@ -6,12 +6,13 @@ const n = {
|
|
|
6
6
|
cancel: "Cancel",
|
|
7
7
|
ok: "OK",
|
|
8
8
|
quantity: "Quantity",
|
|
9
|
-
choose: "Choose"
|
|
9
|
+
choose: "Choose",
|
|
10
|
+
confirmAgain: "Sure?"
|
|
10
11
|
};
|
|
11
|
-
function
|
|
12
|
-
return e.replace(/\{(\d+)\}/g, (o,
|
|
12
|
+
function i(e, ...n) {
|
|
13
|
+
return e.replace(/\{(\d+)\}/g, (o, t) => n[Number(t)] ?? o);
|
|
13
14
|
}
|
|
14
15
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
c as DEFAULT_LABELS,
|
|
17
|
+
i as fillLabel
|
|
17
18
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useMemo as n } from "react";
|
|
2
|
+
import { useStore as s } from "./useStore.js";
|
|
3
|
+
function u(o, r) {
|
|
4
|
+
const e = o((t) => JSON.stringify(r(t)) ?? "null");
|
|
5
|
+
return n(() => JSON.parse(e), [e]);
|
|
6
|
+
}
|
|
7
|
+
function m(o, r) {
|
|
8
|
+
return u((e) => s(o, e), r);
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
u as useJsonSelector,
|
|
12
|
+
m as useStoreJson
|
|
13
|
+
};
|
package/dist/react.js
CHANGED
|
@@ -1,77 +1,82 @@
|
|
|
1
1
|
import { UiProvider as r, defaultUiSettings as t, useCx as i, useUi as p } from "./react/UiProvider.js";
|
|
2
|
-
import { classJoiner as
|
|
3
|
-
import { DEFAULT_LABELS as
|
|
4
|
-
import { baseCss as
|
|
2
|
+
import { classJoiner as f } from "./react/classNames.js";
|
|
3
|
+
import { DEFAULT_LABELS as l, fillLabel as x } from "./react/labels.js";
|
|
4
|
+
import { baseCss as n, injectBaseCss as c } from "./react/baseCss.js";
|
|
5
5
|
import { useStore as C } from "./react/useStore.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
6
|
+
import { useJsonSelector as h, useStoreJson as y } from "./react/useJsonSelector.js";
|
|
7
|
+
import { useViewport as L } from "./react/useViewport.js";
|
|
8
|
+
import { SCROLL_CLASS as P, useFitToViewport as g } from "./react/useFitToViewport.js";
|
|
9
|
+
import { useFillSheet as k } from "./react/useFillSheet.js";
|
|
10
|
+
import { SPLIT_STACK_BELOW as A, cursorTip as B, listPlacement as E, pixelFit as U, sheetScaleStyle as _, splitModeFor as b, windowStyle as D } from "./react/placement.js";
|
|
11
|
+
import { Panel as J } from "./react/Panel.js";
|
|
12
|
+
import { TabStrip as V } from "./react/TabStrip.js";
|
|
13
|
+
import { SplitPane as K } from "./react/SplitPane.js";
|
|
14
|
+
import { pickedEntry as Q, usePicked as j } from "./react/usePicked.js";
|
|
15
|
+
import { Select as R, stepOption as W } from "./react/Select.js";
|
|
16
|
+
import { Tooltip as z } from "./react/Tooltip.js";
|
|
17
|
+
import { TitleTips as N } from "./react/TitleTips.js";
|
|
18
|
+
import { Modal as Y } from "./react/Modal.js";
|
|
19
|
+
import { ConfirmDialog as $ } from "./react/ConfirmDialog.js";
|
|
20
|
+
import { ConfirmButton as oe } from "./react/ConfirmButton.js";
|
|
21
|
+
import { answerConfirm as te, askConfirm as ie, askQuantity as pe, cancelConfirm as se, confirmStore as fe, parseQuantity as me } from "./react/confirmStore.js";
|
|
22
|
+
import { ChoiceDialog as xe } from "./react/ChoiceDialog.js";
|
|
23
|
+
import { answerChoice as ne, askChoice as ce, cancelChoice as Se, choiceStore as Ce, firstChoice as ue } from "./react/choiceStore.js";
|
|
24
|
+
import { Slider as ye, sliderKeyValue as de } from "./react/Slider.js";
|
|
25
|
+
import { PixelImage as Te } from "./react/PixelImage.js";
|
|
26
|
+
import { Glyph as ge, glyphPath as we, hasGlyph as ke, registerGlyph as Fe } from "./react/Glyph.js";
|
|
25
27
|
export {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
28
|
+
xe as ChoiceDialog,
|
|
29
|
+
oe as ConfirmButton,
|
|
30
|
+
$ as ConfirmDialog,
|
|
31
|
+
l as DEFAULT_LABELS,
|
|
32
|
+
ge as Glyph,
|
|
33
|
+
Y as Modal,
|
|
34
|
+
J as Panel,
|
|
35
|
+
Te as PixelImage,
|
|
36
|
+
P as SCROLL_CLASS,
|
|
37
|
+
A as SPLIT_STACK_BELOW,
|
|
38
|
+
R as Select,
|
|
39
|
+
ye as Slider,
|
|
40
|
+
K as SplitPane,
|
|
41
|
+
V as TabStrip,
|
|
42
|
+
N as TitleTips,
|
|
43
|
+
z as Tooltip,
|
|
41
44
|
r as UiProvider,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
ne as answerChoice,
|
|
46
|
+
te as answerConfirm,
|
|
47
|
+
ce as askChoice,
|
|
48
|
+
ie as askConfirm,
|
|
49
|
+
pe as askQuantity,
|
|
50
|
+
n as baseCss,
|
|
51
|
+
Se as cancelChoice,
|
|
52
|
+
se as cancelConfirm,
|
|
53
|
+
Ce as choiceStore,
|
|
54
|
+
f as classJoiner,
|
|
55
|
+
fe as confirmStore,
|
|
56
|
+
B as cursorTip,
|
|
54
57
|
t as defaultUiSettings,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
58
|
+
x as fillLabel,
|
|
59
|
+
ue as firstChoice,
|
|
60
|
+
we as glyphPath,
|
|
61
|
+
ke as hasGlyph,
|
|
62
|
+
c as injectBaseCss,
|
|
63
|
+
E as listPlacement,
|
|
64
|
+
me as parseQuantity,
|
|
65
|
+
Q as pickedEntry,
|
|
66
|
+
U as pixelFit,
|
|
67
|
+
Fe as registerGlyph,
|
|
68
|
+
_ as sheetScaleStyle,
|
|
69
|
+
de as sliderKeyValue,
|
|
70
|
+
b as splitModeFor,
|
|
71
|
+
W as stepOption,
|
|
69
72
|
i as useCx,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
k as useFillSheet,
|
|
74
|
+
g as useFitToViewport,
|
|
75
|
+
h as useJsonSelector,
|
|
76
|
+
j as usePicked,
|
|
73
77
|
C as useStore,
|
|
78
|
+
y as useStoreJson,
|
|
74
79
|
p as useUi,
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
L as useViewport,
|
|
81
|
+
D as windowStyle
|
|
77
82
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { Container as
|
|
2
|
-
import { tileAt as
|
|
3
|
-
let
|
|
4
|
-
class
|
|
1
|
+
import { Container as C, Sprite as F } from "pixi.js";
|
|
2
|
+
import { tileAt as I, tileRect as T, FLIP_D as P, FLIP_H as H, FLIP_V as S } from "./tiled.js";
|
|
3
|
+
let V = 0;
|
|
4
|
+
class _ {
|
|
5
5
|
constructor(s, i, e = {}) {
|
|
6
6
|
this.stage = s, this.map = i;
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
for (let
|
|
12
|
-
for (let
|
|
13
|
-
const
|
|
14
|
-
this.paintChunk(t,
|
|
7
|
+
const l = this.textureFor = e.textureFor ?? ((t) => t.name), h = this.chunkTiles = Math.max(1, e.chunkTiles ?? 32), o = e.baseDepth ?? -1e6, f = e.layers ? new Set(e.layers) : null, n = i.layers.filter((t) => t.kind === "tiles" && (f ? f.has(t.name) : t.visible)), c = e.parent ?? s.world;
|
|
8
|
+
this.originX = e.x ?? 0, this.originY = e.y ?? 0, n.forEach((t, x) => {
|
|
9
|
+
const w = typeof t.properties.depth == "number" ? t.properties.depth : o + x, r = new C();
|
|
10
|
+
r.zIndex = w, r.sortableChildren = !0, r.alpha = t.opacity, r.position.set(this.originX + t.offsetX, this.originY + t.offsetY), this.layers.set(t.name, r), this.drawn.set(t.name, t), c.addChild(r);
|
|
11
|
+
for (let d = 0; d < i.height; d += h)
|
|
12
|
+
for (let p = 0; p < i.width; p += h) {
|
|
13
|
+
const u = Math.min(h, i.width - p), m = Math.min(h, i.height - d);
|
|
14
|
+
this.paintChunk(t, r, p, d, u, m, l);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
}
|
|
@@ -20,13 +20,38 @@ class T {
|
|
|
20
20
|
/** One container per drawn tile layer, by name, each at its own depth among the bodies. */
|
|
21
21
|
layers = /* @__PURE__ */ new Map();
|
|
22
22
|
chunks = [];
|
|
23
|
-
id =
|
|
23
|
+
id = V++;
|
|
24
|
+
chunkTiles;
|
|
25
|
+
textureFor;
|
|
26
|
+
drawn = /* @__PURE__ */ new Map();
|
|
27
|
+
originX;
|
|
28
|
+
originY;
|
|
24
29
|
/** Shows only the chunks in the camera's view (plus a margin in world px). Call once a frame. */
|
|
25
30
|
update(s = 32) {
|
|
26
31
|
const i = this.stage.cameras.main.worldView;
|
|
27
32
|
for (const e of this.chunks)
|
|
28
33
|
e.sprite.visible = e.x < i.right + s && e.x + e.w > i.x - s && e.y < i.bottom + s && e.y + e.h > i.y - s;
|
|
29
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Repaints the chunks holding these cells (row-major indices) of a drawn layer, after its `data` changed: a door
|
|
37
|
+
* opening, a wall dug out, a cell autotiled again (`updateAutotile` returns exactly the indices to pass). Costs one
|
|
38
|
+
* chunk's painting per chunk touched, so keep it out of every frame.
|
|
39
|
+
*/
|
|
40
|
+
refreshTiles(s, i) {
|
|
41
|
+
const e = this.drawn.get(s), l = this.layers.get(s);
|
|
42
|
+
if (!e || !l) return;
|
|
43
|
+
const { map: h, chunkTiles: o } = this, f = /* @__PURE__ */ new Set();
|
|
44
|
+
for (const n of i)
|
|
45
|
+
n < 0 || n >= h.width * h.height || f.add(`${Math.floor(n % h.width / o) * o},${Math.floor(Math.floor(n / h.width) / o) * o}`);
|
|
46
|
+
for (const n of f) {
|
|
47
|
+
const [c, t] = n.split(",").map(Number), x = `tilemap:${this.id}:${e.name}:${c},${t}`, w = this.chunks.findIndex((r) => r.key === x);
|
|
48
|
+
if (w >= 0) {
|
|
49
|
+
const [r] = this.chunks.splice(w, 1);
|
|
50
|
+
r.sprite.destroy(), this.stage.textures.remove(x);
|
|
51
|
+
}
|
|
52
|
+
this.paintChunk(e, l, c, t, Math.min(o, h.width - c), Math.min(o, h.height - t), this.textureFor);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
30
55
|
/** World size of the map in px. */
|
|
31
56
|
get widthPx() {
|
|
32
57
|
return this.map.width * this.map.tileWidth;
|
|
@@ -40,29 +65,29 @@ class T {
|
|
|
40
65
|
for (const s of this.layers.values()) s.destroy({ children: !0 });
|
|
41
66
|
this.layers.clear();
|
|
42
67
|
}
|
|
43
|
-
paintChunk(s, i, e,
|
|
44
|
-
const { map:
|
|
45
|
-
let
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
for (let
|
|
49
|
-
for (let
|
|
50
|
-
const
|
|
51
|
-
if (!
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
54
|
-
const
|
|
55
|
-
|
|
68
|
+
paintChunk(s, i, e, l, h, o, f) {
|
|
69
|
+
const { map: n } = this, c = n.tileWidth, t = n.tileHeight;
|
|
70
|
+
let x = !1;
|
|
71
|
+
const w = `tilemap:${this.id}:${s.name}:${e},${l}`, d = Math.max(t, ...n.tilesets.map((g) => g.tileHeight)) - t, p = this.stage.textures.createCanvas(w, h * c, o * t + d), u = p.context;
|
|
72
|
+
u.imageSmoothingEnabled = !1;
|
|
73
|
+
for (let g = 0; g < o; g++)
|
|
74
|
+
for (let y = 0; y < h; y++) {
|
|
75
|
+
const M = s.data[(l + g) * n.width + (e + y)], k = I(n, M);
|
|
76
|
+
if (!k) continue;
|
|
77
|
+
const $ = this.stage.textures.exists(f(k.tileset)) ? this.stage.textures.get(f(k.tileset)).source.resource : null;
|
|
78
|
+
if (!$) continue;
|
|
79
|
+
const a = T(k.tileset, k.local), b = y * c, v = d + (g + 1) * t - a.h;
|
|
80
|
+
u.save(), u.translate(b + a.w / 2, v + a.h / 2), M & P && u.transform(0, 1, 1, 0, 0, 0), u.scale(M & H ? -1 : 1, M & S ? -1 : 1), u.drawImage($, a.x, a.y, a.w, a.h, -a.w / 2, -a.h / 2, a.w, a.h), u.restore(), x = !0;
|
|
56
81
|
}
|
|
57
|
-
if (!
|
|
58
|
-
this.stage.textures.remove(
|
|
82
|
+
if (!x) {
|
|
83
|
+
this.stage.textures.remove(w);
|
|
59
84
|
return;
|
|
60
85
|
}
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
86
|
+
p.refresh();
|
|
87
|
+
const m = new F(p.whole);
|
|
88
|
+
m.position.set(e * c, l * t - d), m.zIndex = l * n.width + e, i.addChild(m), this.chunks.push({ sprite: m, x: m.x + i.x, y: m.y + i.y, w: h * c, h: o * t + d, key: w });
|
|
64
89
|
}
|
|
65
90
|
}
|
|
66
91
|
export {
|
|
67
|
-
|
|
92
|
+
_ as TilemapView
|
|
68
93
|
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
const G = 1, d = 2, m = 4, A = 8, j = 1, T = 2, U = 4, v = 8, I = 16, F = 32, H = 64, K = 128;
|
|
2
|
+
function f(t) {
|
|
3
|
+
let n = t & 85;
|
|
4
|
+
return t & 2 && t & 1 && t & 4 && (n |= 2), t & 8 && t & 16 && t & 4 && (n |= 8), t & 32 && t & 16 && t & 64 && (n |= 32), t & 128 && t & 1 && t & 64 && (n |= 128), n;
|
|
5
|
+
}
|
|
6
|
+
const S = (() => {
|
|
7
|
+
const t = /* @__PURE__ */ new Set();
|
|
8
|
+
for (let n = 0; n < 256; n++) t.add(f(n));
|
|
9
|
+
return [...t].sort((n, e) => n - e);
|
|
10
|
+
})(), w = new Map(S.map((t, n) => [t, n]));
|
|
11
|
+
function R(t) {
|
|
12
|
+
return w.get(f(t));
|
|
13
|
+
}
|
|
14
|
+
const N = [
|
|
15
|
+
[0, -1, 1],
|
|
16
|
+
[1, -1, 2],
|
|
17
|
+
[1, 0, 4],
|
|
18
|
+
[1, 1, 8],
|
|
19
|
+
[0, 1, 16],
|
|
20
|
+
[-1, 1, 32],
|
|
21
|
+
[-1, 0, 64],
|
|
22
|
+
[-1, -1, 128]
|
|
23
|
+
];
|
|
24
|
+
function _(t, n, e, o, B) {
|
|
25
|
+
if (e < 0 || o < 0 || e >= t.width || o >= t.height) return (B.edge ?? "same") === "same";
|
|
26
|
+
const c = t.cells[o * t.width + e];
|
|
27
|
+
return B.joins ? B.joins(n, c) : c === n;
|
|
28
|
+
}
|
|
29
|
+
function a(t, n, e, o = {}) {
|
|
30
|
+
const B = t.cells[e * t.width + n];
|
|
31
|
+
return (_(t, B, n, e - 1, o) ? 1 : 0) | (_(t, B, n + 1, e, o) ? 2 : 0) | (_(t, B, n, e + 1, o) ? 4 : 0) | (_(t, B, n - 1, e, o) ? 8 : 0);
|
|
32
|
+
}
|
|
33
|
+
function W(t, n, e, o = {}) {
|
|
34
|
+
const B = t.cells[e * t.width + n];
|
|
35
|
+
let c = 0;
|
|
36
|
+
for (const [l, u, s] of N) _(t, B, n + l, e + u, o) && (c |= s);
|
|
37
|
+
return f(c);
|
|
38
|
+
}
|
|
39
|
+
function b(t, n) {
|
|
40
|
+
let e = Math.imul(t, 668265261) ^ Math.imul(n, 374761393);
|
|
41
|
+
return e ^= e >>> 15, e = Math.imul(e, 739982445), (e ^ e >>> 12) >>> 0;
|
|
42
|
+
}
|
|
43
|
+
const p = { edges: 15, blob: 255 }, h = /* @__PURE__ */ new WeakMap();
|
|
44
|
+
function D(t) {
|
|
45
|
+
let n = h.get(t);
|
|
46
|
+
if (n) return n;
|
|
47
|
+
n = /* @__PURE__ */ new Map();
|
|
48
|
+
for (const e of t.rules) {
|
|
49
|
+
const o = e.connectsTo ? new Set(e.connectsTo) : null, B = { edge: t.edge ?? "same" };
|
|
50
|
+
o && (B.joins = (c, l) => l === c || o.has(l)), n.set(e.terrain, { rule: e, options: B });
|
|
51
|
+
}
|
|
52
|
+
return h.set(t, n), n;
|
|
53
|
+
}
|
|
54
|
+
function E(t, n, e) {
|
|
55
|
+
return t === void 0 || typeof t == "number" ? t : t.length ? t[b(n, e) % t.length] : void 0;
|
|
56
|
+
}
|
|
57
|
+
function r(t, n, e, o) {
|
|
58
|
+
const B = D(n).get(t.cells[o * t.width + e]);
|
|
59
|
+
if (!B) return n.empty ?? 0;
|
|
60
|
+
const c = B.rule.mode ?? "blob", l = c === "blob" ? W(t, e, o, B.options) : a(t, e, o, B.options), { tiles: u } = B.rule;
|
|
61
|
+
return typeof u == "function" ? u(l, e, o) : E(u[l], e, o) ?? B.rule.fallback ?? E(u[p[c]], e, o) ?? n.empty ?? 0;
|
|
62
|
+
}
|
|
63
|
+
function X(t, n, e = new Uint32Array(t.width * t.height)) {
|
|
64
|
+
for (let o = 0; o < t.height; o++) for (let B = 0; B < t.width; B++) e[o * t.width + B] = r(t, n, B, o);
|
|
65
|
+
return e;
|
|
66
|
+
}
|
|
67
|
+
function M(t, n, e, o, B) {
|
|
68
|
+
const c = [];
|
|
69
|
+
for (let l = -1; l <= 1; l++)
|
|
70
|
+
for (let u = -1; u <= 1; u++) {
|
|
71
|
+
const s = o + u, i = B + l;
|
|
72
|
+
if (s < 0 || i < 0 || s >= t.width || i >= t.height) continue;
|
|
73
|
+
const L = i * t.width + s, O = r(t, n, s, i);
|
|
74
|
+
e[L] !== O && (e[L] = O, c.push(L));
|
|
75
|
+
}
|
|
76
|
+
return c;
|
|
77
|
+
}
|
|
78
|
+
function q(t, n, e, o, B, c) {
|
|
79
|
+
return o < 0 || B < 0 || o >= t.width || B >= t.height ? [] : (t.cells[B * t.width + o] = c, M(t, n, e, o, B));
|
|
80
|
+
}
|
|
81
|
+
export {
|
|
82
|
+
S as BLOB47_MASKS,
|
|
83
|
+
U as BLOB_E,
|
|
84
|
+
j as BLOB_N,
|
|
85
|
+
T as BLOB_NE,
|
|
86
|
+
K as BLOB_NW,
|
|
87
|
+
I as BLOB_S,
|
|
88
|
+
v as BLOB_SE,
|
|
89
|
+
F as BLOB_SW,
|
|
90
|
+
H as BLOB_W,
|
|
91
|
+
d as EDGE_E,
|
|
92
|
+
G as EDGE_N,
|
|
93
|
+
m as EDGE_S,
|
|
94
|
+
A as EDGE_W,
|
|
95
|
+
X as autotile,
|
|
96
|
+
r as autotileAt,
|
|
97
|
+
R as blob47Index,
|
|
98
|
+
W as blobMask,
|
|
99
|
+
a as edgeMask,
|
|
100
|
+
q as paintTerrain,
|
|
101
|
+
f as reduceBlobMask,
|
|
102
|
+
M as updateAutotile
|
|
103
|
+
};
|