@aethervtt/shard-dice 0.2.1 → 0.2.2

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.
Files changed (3) hide show
  1. package/README.md +34 -1
  2. package/dist/table.js +2 -4
  3. package/package.json +15 -15
package/README.md CHANGED
@@ -1,3 +1,36 @@
1
1
  # @aethervtt/shard-dice
2
2
 
3
- Part of [Shard](https://github.com/aethervtt/shard), a WebGPU-first 2D/3D game engine in TypeScript. See the repository for documentation.
3
+ Install the dice package together with Shard's runtime, transform and render packages. Add
4
+ `TransformPlugin`, `renderPlugin`, `forwardPlugin` and `dicePlugin` to the app.
5
+
6
+ For browser physics, pass `diceWorker` from `@aethervtt/shard-dice/worker` to
7
+ `dicePlugin({ worker: diceWorker })`. Workers are ES modules with lazy physics chunks.
8
+ Vite 6/Rollup production builds require ES worker output for these split chunks. Vite 8 can
9
+ inline IIFE workers, but ES output retains lazy chunks and works with both versions:
10
+
11
+ ```ts
12
+ import { defineConfig } from 'vite'
13
+
14
+ export default defineConfig({
15
+ worker: { format: 'es' },
16
+ optimizeDeps: {
17
+ include: ['@aethervtt/shard-texture > jpeg-js'],
18
+ exclude: [
19
+ '@aethervtt/shard-dice',
20
+ '@aethervtt/shard-gpu-webgl2',
21
+ '@aethervtt/shard-texture',
22
+ '@aethervtt/shard-noise',
23
+ ],
24
+ },
25
+ })
26
+ ```
27
+
28
+ The development exclusions preserve package-relative worker and shader WASM URLs. The texture
29
+ and noise exclusions are needed when those codecs/kernels execute in Vite development mode;
30
+ prebundling would move their relative asset URLs into `.vite/deps`. Keep the nested `jpeg-js`
31
+ dependency included so Vite converts its CommonJS module, even without hoisting. Webpack 5
32
+ recognizes Shard's module worker directly; no Node externals workaround is required for the
33
+ browser codec/importer graph. Serve emitted JS/WASM assets with their correct content types.
34
+
35
+ `worker: 'inline'` runs physics on the calling thread where workers are unavailable. It is an
36
+ explicit fallback, not the recommended browser configuration.
package/dist/table.js CHANGED
@@ -603,10 +603,8 @@ class DiceTableState {
603
603
  dropped: d.dropped,
604
604
  entrance: run ? i : void 0
605
605
  });
606
- if (run) {
607
- run.material = material;
608
- world.resource(Materials).get(material)?.set({ result: 0, resultTime: 0 });
609
- }
606
+ world.resource(Materials).get(material)?.set({ fade: 1, result: 0, resultTime: 0 });
607
+ if (run) run.material = material;
610
608
  const s = d.scale;
611
609
  p.entities.push(
612
610
  world.spawn(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aethervtt/shard-dice",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -20,19 +20,19 @@
20
20
  "README.md"
21
21
  ],
22
22
  "dependencies": {
23
- "@aethervtt/shard-assets": "0.2.1",
24
- "@aethervtt/shard-audio": "0.2.1",
25
- "@aethervtt/shard-core": "0.2.1",
26
- "@aethervtt/shard-gpu": "0.2.1",
27
- "@aethervtt/shard-mesh": "0.2.1",
28
- "@aethervtt/shard-particles": "0.2.1",
29
- "@aethervtt/shard-physics": "0.2.1",
30
- "@aethervtt/shard-protocol": "0.2.1",
31
- "@aethervtt/shard-render": "0.2.1",
32
- "@aethervtt/shard-runtime": "0.2.1",
33
- "@aethervtt/shard-text": "0.2.1",
34
- "@aethervtt/shard-texture": "0.2.1",
35
- "@aethervtt/shard-transform": "0.2.1"
23
+ "@aethervtt/shard-assets": "0.2.2",
24
+ "@aethervtt/shard-audio": "0.2.2",
25
+ "@aethervtt/shard-core": "0.2.2",
26
+ "@aethervtt/shard-gpu": "0.2.2",
27
+ "@aethervtt/shard-mesh": "0.2.2",
28
+ "@aethervtt/shard-particles": "0.2.2",
29
+ "@aethervtt/shard-physics": "0.2.2",
30
+ "@aethervtt/shard-protocol": "0.2.2",
31
+ "@aethervtt/shard-render": "0.2.2",
32
+ "@aethervtt/shard-runtime": "0.2.2",
33
+ "@aethervtt/shard-text": "0.2.2",
34
+ "@aethervtt/shard-texture": "0.2.2",
35
+ "@aethervtt/shard-transform": "0.2.2"
36
36
  },
37
37
  "repository": {
38
38
  "type": "git",
@@ -44,6 +44,6 @@
44
44
  "provenance": true
45
45
  },
46
46
  "shard": {
47
- "buildSha": "772eb0d2b8a5fc499105708f4ae92c58788cc9ea"
47
+ "buildSha": "c92ccf813334ab40ce73d5f4ad98680bf1dcf9e4"
48
48
  }
49
49
  }