@moku-labs/game 0.15.26 → 0.15.28

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 (32) hide show
  1. package/dist/app/page.d.mts +1 -1
  2. package/dist/app/page.mjs +1 -1
  3. package/dist/app/system.d.mts +3 -3
  4. package/dist/app.d.mts +3 -3
  5. package/dist/app.mjs +1 -1
  6. package/dist/assets.d.mts +1 -1
  7. package/dist/{commands-KWKfdywA.d.mts → commands-BJ4gG5WZ.d.mts} +5 -5
  8. package/dist/control.d.mts +4 -4
  9. package/dist/{define-uiyy88hF.d.mts → define-CVYadV_I.d.mts} +2 -2
  10. package/dist/{headless-PssyKRFN.d.mts → headless-DBYmnluy.d.mts} +1 -1
  11. package/dist/{index-CM1goGHf.d.mts → index-Dn_v0Fqs.d.mts} +7 -5
  12. package/dist/index.d.mts +5 -5
  13. package/dist/index.mjs +3 -3
  14. package/dist/inspect.d.mts +6 -6
  15. package/dist/inspect.mjs +1 -1
  16. package/dist/jsx-dev-runtime.d.mts +1 -1
  17. package/dist/jsx-runtime.d.mts +1 -1
  18. package/dist/{runtime-C0YaA9fC.d.mts → runtime-DnjJ4Zo9.d.mts} +1 -1
  19. package/dist/{sources-Dpc4NXvG.mjs → sources-ncFMQIus.mjs} +1 -1
  20. package/dist/{src-DWYFupNb.mjs → src-DPvSTM8O.mjs} +485 -78
  21. package/dist/testing.d.mts +4 -4
  22. package/dist/testing.mjs +1 -1
  23. package/dist/{types-BdLJ4lTA.d.mts → types-Bsa1nFyU.d.mts} +4 -4
  24. package/dist/{types-C-wAHgpD.d.mts → types-C76NQm-h.d.mts} +119 -20
  25. package/dist/{types-ChZ4Ej7O.d.mts → types-C_nC_M4p.d.mts} +73 -11
  26. package/dist/{types-sfaYGg9l.d.mts → types-DTetCcBC.d.mts} +2 -2
  27. package/dist/{types-_OQ6H8WL.d.mts → types-bEJEga5m.d.mts} +21 -3
  28. package/dist/{visual-DmDWJEzs.d.mts → visual-BMRHt4IB.d.mts} +6 -6
  29. package/dist/{visual-kEC9nb-o.mjs → visual-ClVRMUAi.mjs} +35 -5
  30. package/dist/visual.d.mts +1 -1
  31. package/dist/visual.mjs +1 -1
  32. package/package.json +1 -1
@@ -259,13 +259,14 @@ const spriteDefaults = {
259
259
  const Transform = /*#__PURE__*/ component("Transform", transformDefaults);
260
260
  /**
261
261
  * One textured quad. `texture` is an asset key, resolved through the texture providers; a size
262
- * and a `fit` draw it into a box.
262
+ * and a `fit` draw it into a box. `blend: "add"` or `"screen"` lays it over what is under it.
263
263
  */
264
264
  const Sprite = /*#__PURE__*/ component("Sprite", spriteDefaults);
265
265
  /**
266
266
  * A stretchable panel, sized in reference units, with its own alpha and tint. `debug: true` draws
267
267
  * the slice outline over it. `clip: true` masks the children of the entity to the panel box.
268
- * `hollow: true` draws its rim alone, never the centre cell.
268
+ * `hollow: true` draws its rim alone, never the centre cell. `blend: "add"` or `"screen"` lays it over what is under
269
+ * it.
269
270
  */
270
271
  const NineSlice = /*#__PURE__*/ component("NineSlice", {
271
272
  texture: "",
@@ -1213,6 +1214,32 @@ function hollowOf(element, hollow) {
1213
1214
  }
1214
1215
  return element.hollowed === true ? { hollow: false } : {};
1215
1216
  }
1217
+ /** What an element that never blended spreads into its visual: no field at all. */
1218
+ const NO_BLEND = Object.freeze({});
1219
+ /** What an element that blended once spreads once its style no longer blends: the glow turned off. */
1220
+ const NORMAL_BLEND = Object.freeze({ blend: "normal" });
1221
+ /** What an element spreads while its style blends, one frozen object per mode. */
1222
+ const BLENDS = Object.freeze({
1223
+ add: Object.freeze({ blend: "add" }),
1224
+ screen: Object.freeze({ blend: "screen" })
1225
+ });
1226
+ /**
1227
+ * How an image or a nine-slice lays its pixels over what is under it: the style's blend while it
1228
+ * says one, `"normal"` once it did and no longer does (a live element is patched, so the old blend
1229
+ * would stay), and no field on an element that never blended, so a game's describe and saved
1230
+ * values stay as they were without it. Each answer is a frozen module constant: nothing is built.
1231
+ *
1232
+ * @param element - The element drawn with the sprite or the nine-slice.
1233
+ * @param blend - The style's `blend`.
1234
+ * @returns `{ blend }`, or nothing.
1235
+ */
1236
+ function blendOf(element, blend) {
1237
+ if (blend !== void 0) {
1238
+ element.blended = true;
1239
+ return BLENDS[blend];
1240
+ }
1241
+ return element.blended === true ? NORMAL_BLEND : NO_BLEND;
1242
+ }
1216
1243
  /**
1217
1244
  * The box a text wraps at: its laid-out width while it wraps at it, 0 once it fits again, so a
1218
1245
  * text that wrapped draws on one line, and no field on a text that never wrapped.
@@ -1230,7 +1257,8 @@ function boxOf(element) {
1230
1257
  /**
1231
1258
  * The visual component of an element: a sprite for an image or an icon, the text for a text (with
1232
1259
  * its laid-out width as the box a `"box"` style wraps at), the nine-slice of its style (outlined
1233
- * when the style sets `debug`, its rim alone when it sets `hollow`), or a rounded rectangle, a triangle with `shape: "triangle"`, its
1260
+ * when the style sets `debug`, its rim alone when it sets `hollow`; the sprite and the nine-slice
1261
+ * blended by the style's `blend`), or a rounded rectangle, a triangle with `shape: "triangle"`, its
1234
1262
  * stroke dashed with `dash`, or an arc with `shape: "arc"`
1235
1263
  * over the `sweep` of its style, ended by its `cap`. A clipping element (`scroll`,
1236
1264
  * `overflow: "hidden"`) keeps the rectangle, which carries the clip; a text field's rectangle
@@ -1257,7 +1285,8 @@ function visualOf(element) {
1257
1285
  },
1258
1286
  width: rect.w,
1259
1287
  height: rect.h,
1260
- fit: spriteFitOf(node.props)
1288
+ fit: spriteFitOf(node.props),
1289
+ ...blendOf(element, style.blend)
1261
1290
  })];
1262
1291
  if (type === "text") {
1263
1292
  const styleKey = typeof node.props.style === "string" ? node.props.style : "body";
@@ -1281,7 +1310,8 @@ function visualOf(element) {
1281
1310
  tint,
1282
1311
  debug: style.debug ?? false,
1283
1312
  clip: type === "input",
1284
- ...hollowOf(element, style.hollow)
1313
+ ...hollowOf(element, style.hollow),
1314
+ ...blendOf(element, style.blend)
1285
1315
  })];
1286
1316
  const filled = style.fill !== void 0 || style.stroke !== void 0;
1287
1317
  const invisible = isContainer(type) && !filled;
package/dist/visual.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as VisualApp, c as VisualRenderer, d as VisualStart, f as VisualStep, h as VisualTolerance, i as CheckpointResult, l as VisualReport, m as VisualTestResult, n as runVisualTests, o as VisualOptions, p as VisualTest, r as defineVisualTest, s as VisualPage, t as parseVisualArgv, u as VisualSetup } from "./visual-DmDWJEzs.mjs";
1
+ import { a as VisualApp, c as VisualRenderer, d as VisualStart, f as VisualStep, h as VisualTolerance, i as CheckpointResult, l as VisualReport, m as VisualTestResult, n as runVisualTests, o as VisualOptions, p as VisualTest, r as defineVisualTest, s as VisualPage, t as parseVisualArgv, u as VisualSetup } from "./visual-BMRHt4IB.mjs";
2
2
  export { type CheckpointResult, type VisualApp, type VisualOptions, type VisualPage, type VisualRenderer, type VisualReport, type VisualSetup, type VisualStart, type VisualStep, type VisualTest, type VisualTestResult, type VisualTolerance, defineVisualTest, parseVisualArgv, runVisualTests };
package/dist/visual.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as read, t as sources } from "./sources-Dpc4NXvG.mjs";
1
+ import { n as read, t as sources } from "./sources-ncFMQIus.mjs";
2
2
  import { n as commands, t as run } from "./run-DRcc2SKF.mjs";
3
3
  import path from "node:path";
4
4
  import { createBrandConsole } from "@moku-labs/common/cli";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moku-labs/game",
3
- "version": "0.15.26",
3
+ "version": "0.15.28",
4
4
  "description": "2D puzzle game engine on TypeScript and PixiJS, built on @moku-labs/core.",
5
5
  "type": "module",
6
6
  "sideEffects": [