@datamoc/mw_games 0.7.0 → 0.7.1

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 (41) hide show
  1. package/README.md +18 -3
  2. package/dist/mw_games.global.js +25 -25
  3. package/dist/mwl/actors.d.ts.map +1 -1
  4. package/dist/mwl/actors.js +10 -2
  5. package/dist/mwl/actors.js.map +1 -1
  6. package/dist/mwl/catalog.d.ts.map +1 -1
  7. package/dist/mwl/catalog.js +18 -3
  8. package/dist/mwl/catalog.js.map +1 -1
  9. package/dist/mwl/compiler.d.ts +6 -0
  10. package/dist/mwl/compiler.d.ts.map +1 -1
  11. package/dist/mwl/compiler.js +53 -3
  12. package/dist/mwl/compiler.js.map +1 -1
  13. package/dist/mwl/content.d.ts +36 -0
  14. package/dist/mwl/content.d.ts.map +1 -1
  15. package/dist/mwl/content.js +49 -0
  16. package/dist/mwl/content.js.map +1 -1
  17. package/dist/mwl/expression.d.ts.map +1 -1
  18. package/dist/mwl/expression.js +16 -6
  19. package/dist/mwl/expression.js.map +1 -1
  20. package/dist/mwl/hooks.d.ts.map +1 -1
  21. package/dist/mwl/hooks.js.map +1 -1
  22. package/dist/mwl/index.d.ts +4 -4
  23. package/dist/mwl/index.d.ts.map +1 -1
  24. package/dist/mwl/index.js +1 -1
  25. package/dist/mwl/index.js.map +1 -1
  26. package/dist/mwl/persistence.d.ts.map +1 -1
  27. package/dist/mwl/persistence.js +10 -2
  28. package/dist/mwl/persistence.js.map +1 -1
  29. package/dist/mwl/runtime.d.ts +28 -1
  30. package/dist/mwl/runtime.d.ts.map +1 -1
  31. package/dist/mwl/runtime.js +80 -12
  32. package/dist/mwl/runtime.js.map +1 -1
  33. package/dist/mwl/schema.d.ts.map +1 -1
  34. package/dist/mwl/schema.js +30 -2
  35. package/dist/mwl/schema.js.map +1 -1
  36. package/dist/version.d.ts +1 -1
  37. package/dist/version.js +1 -1
  38. package/package.json +9 -4
  39. package/tools/extract-html.d.mts +18 -0
  40. package/tools/extract-html.mjs +235 -0
  41. package/tools/mwl.mjs +55 -11
package/README.md CHANGED
@@ -11,7 +11,7 @@ of their own; improvements to `mwg`'s own files are shared back.
11
11
  **[Live examples and API docs](https://datamoc.github.io/mwg/)**: every example below,
12
12
  playable in the browser with no download, plus the generated API reference.
13
13
 
14
- > **Status: pre-alpha (v0.7.0).** Every module in the shared floor below, plus optional
14
+ > **Status: pre-alpha (v0.7.1).** Every module in the shared floor below, plus optional
15
15
  > 3D, mobile (Capacitor) and desktop (WebView2) packaging, is built and tested - see
16
16
  > [ROADMAP.md](ROADMAP.md) for the full, numbered history.
17
17
  >
@@ -394,14 +394,29 @@ npm run mwl -- extract-i18n game.mwl -o generated/i18n.json
394
394
  npm run mwl -- hooks game.mwl --manifest hooks.json -o generated/hooks.mjs
395
395
  ```
396
396
 
397
+ The input may also be a content directory. `mwl build content/ -o generated/`
398
+ reads every `.mwl` file recursively in stable path order and emits one merged,
399
+ validated catalog. Diagnostics retain each source file and line, so a game can
400
+ organize assets, units, items, scenarios, dialogue, and AI data as separate files.
401
+
397
402
  `mwl build` is the normal game command: it produces `game-data.ts`, `i18n.json`,
398
403
  and `assets.json` in one build-time step. The game imports the generated module;
399
404
  it never calls `Mwl.compile()` at runtime. MWG also provides generic helpers for
400
405
  turning item effects into `actors` modifiers and for versioned, migratable MWL
401
406
  saves. Asset attributes such as `image`, `image_icon`, `profile`, `icon`, `file`,
402
407
  `sound`, and `*_sound` are collected into the manifest, including comma-separated
403
- sound lists and Wesnoth `~` image modifiers. Item slots, formulas, hooks, and
404
- business rules remain defined by the game.
408
+ sound lists, Wesnoth sound ranges such as `human-hit-[1~5].ogg`, and image
409
+ modifiers. Nested transform arguments are not mistaken for separate assets.
410
+ Item slots, formulas, hooks, and business rules remain defined by the game.
411
+
412
+ For a large self-contained HTML page, `npm run extract:html -- page.html -o extracted/`
413
+ writes a rewritten `index.html`, an `assets/` directory, and a deterministic
414
+ `manifest.json`. Inline scripts, styles, and supported `data:` URLs are extracted in
415
+ source order. The original page is never overwritten, and unsupported data forms are
416
+ reported as warnings. The output directory is safe to regenerate: its extracted
417
+ `assets/` directory is replaced, while unrelated files are kept.
418
+ CSS `url(data:...)` values and HTML `srcset` candidates are handled too, including
419
+ their density descriptors.
405
420
 
406
421
  Translation messages are the values marked `_ "..."` in the source; the
407
422
  extracted catalog matches `@datamoc/mw_games/i18n`. Hooks are referenced as