@bloopjs/web 0.0.105 → 0.0.107

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/dist/App.d.ts CHANGED
@@ -18,6 +18,8 @@ export type StartOptions = {
18
18
  debugUi?: boolean | DebugUiOptions;
19
19
  /** Tape recording options */
20
20
  tape?: MountOptions["tape"];
21
+ /** External canvas element to use (preserves user CSS via slot projection) */
22
+ canvas?: HTMLCanvasElement;
21
23
  };
22
24
  /** Start a bloop game on the web */
23
25
  export declare function start(opts: StartOptions): Promise<App>;
package/dist/App.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,KAAK,EACV,KAAK,eAAe,EACpB,KAAK,YAAY,EAEjB,KAAK,GAAG,EACT,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAQhE,OAAO,EAEL,KAAK,UAAU,EAChB,MAAM,kBAAkB,CAAC;AAI1B,MAAM,MAAM,YAAY,GAAG;IACzB,4BAA4B;IAC5B,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACjB,yEAAyE;IACzE,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,sDAAsD;IACtD,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,qFAAqF;IACrF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,wFAAwF;IACxF,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,OAAO,CAAC,EAAE,OAAO,GAAG,cAAc,CAAC;IACnC,6BAA6B;IAC7B,IAAI,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;CAC7B,CAAC;AAIF,oCAAoC;AACpC,wBAAsB,KAAK,CAAC,IA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AAED,iBAAS,cAAc,CAAC,CAAC,SAAS,GAAG,EAAE,KAAK;IAC1C,SAAS,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,KAAK,aAAa,CAAC;IAC7D,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IAC7B,cAAc,EAAE,aAAa,CAAC;CAC/B,CAuBA;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC;AAEvC,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC"}
@@ -6,6 +6,8 @@ export type DebugUiOptions = {
6
6
  initiallyVisible?: boolean;
7
7
  /** Container element to mount to (default: document.body) */
8
8
  container?: HTMLElement;
9
+ /** External canvas element to use (preserves user CSS via slot projection) */
10
+ canvas?: HTMLCanvasElement;
9
11
  };
10
12
  export declare class DebugUi {
11
13
  #private;
@@ -1 +1 @@
1
- {"version":3,"file":"DebugUi.d.ts","sourceRoot":"","sources":["../../src/debugui/DebugUi.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,UAAU,EAAc,MAAM,YAAY,CAAC;AAGtE,MAAM,MAAM,cAAc,GAAG;IAC3B,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,6DAA6D;IAC7D,SAAS,CAAC,EAAE,WAAW,CAAC;CACzB,CAAC;AAEF,qBAAa,OAAO;;gBAQN,OAAO,GAAE,cAAmB;IAgExC,4CAA4C;IAC5C,IAAI,MAAM,IAAI,iBAAiB,CAE9B;IAED,mDAAmD;IACnD,IAAI,KAAK,IAAI,UAAU,CAEtB;IAED,mDAAmD;IACnD,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,EAE3B;IAED,OAAO,IAAI,IAAI;CAKhB"}
1
+ {"version":3,"file":"DebugUi.d.ts","sourceRoot":"","sources":["../../src/debugui/DebugUi.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,UAAU,EAAc,MAAM,YAAY,CAAC;AAGtE,MAAM,MAAM,cAAc,GAAG;IAC3B,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,6DAA6D;IAC7D,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,8EAA8E;IAC9E,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B,CAAC;AAEF,qBAAa,OAAO;;gBAQN,OAAO,GAAE,cAAmB;IAgExC,4CAA4C;IAC5C,IAAI,MAAM,IAAI,iBAAiB,CAE9B;IAED,mDAAmD;IACnD,IAAI,KAAK,IAAI,UAAU,CAEtB;IAED,mDAAmD;IACnD,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,EAE3B;IAED,OAAO,IAAI,IAAI;CAKhB"}
@@ -1,7 +1,6 @@
1
1
  type RootProps = {
2
- canvas: HTMLCanvasElement;
3
2
  hotkey?: string;
4
3
  };
5
- export declare function Root({ canvas, hotkey }: RootProps): import("react/jsx-runtime").JSX.Element;
4
+ export declare function Root({ hotkey }: RootProps): import("react/jsx-runtime").JSX.Element;
6
5
  export {};
7
6
  //# sourceMappingURL=Root.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Root.d.ts","sourceRoot":"","sources":["../../../src/debugui/components/Root.tsx"],"names":[],"mappings":"AASA,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,iBAAiB,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAgB,IAAI,CAAC,EAAE,MAAM,EAAE,MAAiB,EAAE,EAAE,SAAS,2CAwC5D"}
1
+ {"version":3,"file":"Root.d.ts","sourceRoot":"","sources":["../../../src/debugui/components/Root.tsx"],"names":[],"mappings":"AAQA,KAAK,SAAS,GAAG;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAgB,IAAI,CAAC,EAAE,MAAiB,EAAE,EAAE,SAAS,2CAwCpD"}
package/dist/mod.js CHANGED
@@ -1504,7 +1504,7 @@ function readTapeHeader(tape) {
1504
1504
  eventCount: view.getUint16(14, true)
1505
1505
  };
1506
1506
  }
1507
- var DEFAULT_WASM_URL = new URL("https://unpkg.com/@bloopjs/engine@0.0.105/wasm/bloop.wasm");
1507
+ var DEFAULT_WASM_URL = new URL("https://unpkg.com/@bloopjs/engine@0.0.107/wasm/bloop.wasm");
1508
1508
  var MAX_ROLLBACK_FRAMES = 500;
1509
1509
  var TIME_CTX_OFFSET = 0;
1510
1510
  var INPUT_CTX_OFFSET = TIME_CTX_OFFSET + 4;
@@ -3390,7 +3390,7 @@ function readTapeHeader2(tape) {
3390
3390
  eventCount: view.getUint16(14, true)
3391
3391
  };
3392
3392
  }
3393
- var DEFAULT_WASM_URL2 = new URL("https://unpkg.com/@bloopjs/engine@0.0.105/wasm/bloop.wasm");
3393
+ var DEFAULT_WASM_URL2 = new URL("https://unpkg.com/@bloopjs/engine@0.0.107/wasm/bloop.wasm");
3394
3394
  var TIME_CTX_OFFSET2 = 0;
3395
3395
  var INPUT_CTX_OFFSET2 = TIME_CTX_OFFSET2 + 4;
3396
3396
  var EVENTS_OFFSET2 = INPUT_CTX_OFFSET2 + 4;
@@ -5623,16 +5623,14 @@ function BottomBar() {
5623
5623
  }
5624
5624
 
5625
5625
  // src/debugui/components/Root.tsx
5626
- function Root({ canvas, hotkey = "Escape" }) {
5626
+ function Root({ hotkey = "Escape" }) {
5627
5627
  const layoutMode2 = debugState.layoutMode.value;
5628
5628
  if (layoutMode2 === "off") {
5629
5629
  return /* @__PURE__ */ u4(k, {
5630
5630
  children: [
5631
5631
  /* @__PURE__ */ u4("main", {
5632
5632
  className: "fullscreen",
5633
- children: /* @__PURE__ */ u4(GameCanvas, {
5634
- canvas
5635
- }, undefined, false, undefined, this)
5633
+ children: /* @__PURE__ */ u4(CanvasSlot, {}, undefined, false, undefined, this)
5636
5634
  }, undefined, false, undefined, this),
5637
5635
  /* @__PURE__ */ u4(DebugToggle, {
5638
5636
  hotkey
@@ -5643,9 +5641,7 @@ function Root({ canvas, hotkey = "Escape" }) {
5643
5641
  if (layoutMode2 === "letterboxed") {
5644
5642
  return /* @__PURE__ */ u4(k, {
5645
5643
  children: [
5646
- /* @__PURE__ */ u4(LetterboxedLayout, {
5647
- canvas
5648
- }, undefined, false, undefined, this),
5644
+ /* @__PURE__ */ u4(LetterboxedLayout, {}, undefined, false, undefined, this),
5649
5645
  /* @__PURE__ */ u4(DebugToggle, {
5650
5646
  hotkey
5651
5647
  }, undefined, false, undefined, this)
@@ -5659,9 +5655,7 @@ function Root({ canvas, hotkey = "Escape" }) {
5659
5655
  children: [
5660
5656
  /* @__PURE__ */ u4("section", {
5661
5657
  className: "game",
5662
- children: /* @__PURE__ */ u4(GameCanvas, {
5663
- canvas
5664
- }, undefined, false, undefined, this)
5658
+ children: /* @__PURE__ */ u4(CanvasSlot, {}, undefined, false, undefined, this)
5665
5659
  }, undefined, false, undefined, this),
5666
5660
  /* @__PURE__ */ u4("section", {
5667
5661
  className: "stats",
@@ -5679,7 +5673,7 @@ function Root({ canvas, hotkey = "Escape" }) {
5679
5673
  ]
5680
5674
  }, undefined, true, undefined, this);
5681
5675
  }
5682
- function LetterboxedLayout({ canvas }) {
5676
+ function LetterboxedLayout() {
5683
5677
  const isOnline = debugState.netStatus.value.peers.length > 0;
5684
5678
  const advantage = debugState.advantage.value ?? 0;
5685
5679
  const frameTime2 = debugState.frameTime.value;
@@ -5711,9 +5705,7 @@ function LetterboxedLayout({ canvas }) {
5711
5705
  }, undefined, false, undefined, this),
5712
5706
  /* @__PURE__ */ u4("div", {
5713
5707
  className: gameClassName,
5714
- children: /* @__PURE__ */ u4(GameCanvas, {
5715
- canvas
5716
- }, undefined, false, undefined, this)
5708
+ children: /* @__PURE__ */ u4(CanvasSlot, {}, undefined, false, undefined, this)
5717
5709
  }, undefined, false, undefined, this),
5718
5710
  /* @__PURE__ */ u4(VerticalBar, {
5719
5711
  value: rightValue,
@@ -5725,18 +5717,10 @@ function LetterboxedLayout({ canvas }) {
5725
5717
  ]
5726
5718
  }, undefined, true, undefined, this);
5727
5719
  }
5728
- function GameCanvas({ canvas }) {
5729
- const containerRef = A2(null);
5730
- y2(() => {
5731
- const container = containerRef.current;
5732
- if (container && !container.contains(canvas)) {
5733
- container.appendChild(canvas);
5734
- }
5735
- return () => {};
5736
- }, [canvas]);
5720
+ function CanvasSlot() {
5737
5721
  return /* @__PURE__ */ u4("div", {
5738
5722
  className: "canvas-container",
5739
- ref: containerRef
5723
+ children: /* @__PURE__ */ u4("slot", {}, undefined, false, undefined, this)
5740
5724
  }, undefined, false, undefined, this);
5741
5725
  }
5742
5726
 
@@ -6577,7 +6561,8 @@ class DebugUi {
6577
6561
  this.#mountPoint.style.cssText = "width:100%;height:100%;";
6578
6562
  this.#shadow.appendChild(this.#mountPoint);
6579
6563
  debugState.layoutMode.value = initiallyVisible ? "letterboxed" : "off";
6580
- this.#canvas = document.createElement("canvas");
6564
+ this.#canvas = options.canvas ?? document.createElement("canvas");
6565
+ this.#host.appendChild(this.#canvas);
6581
6566
  this.#render();
6582
6567
  container.appendChild(this.#host);
6583
6568
  this.#cleanup = this.#setupHotkey();
@@ -6586,7 +6571,7 @@ class DebugUi {
6586
6571
  });
6587
6572
  }
6588
6573
  #render() {
6589
- G(Root({ canvas: this.#canvas, hotkey: this.#hotkey }), this.#mountPoint);
6574
+ G(Root({ hotkey: this.#hotkey }), this.#mountPoint);
6590
6575
  }
6591
6576
  #setupHotkey() {
6592
6577
  const handler = (e4) => {
@@ -7542,7 +7527,7 @@ async function start(opts) {
7542
7527
  });
7543
7528
  opts.sim = sim;
7544
7529
  }
7545
- const debugOpts = opts.debugUi ? typeof opts.debugUi === "boolean" ? { initiallyVisible: true } : opts.debugUi : undefined;
7530
+ const debugOpts = opts.debugUi ? typeof opts.debugUi === "boolean" ? { initiallyVisible: true, canvas: opts.canvas } : { ...opts.debugUi, canvas: opts.canvas ?? opts.debugUi.canvas } : opts.canvas ? { canvas: opts.canvas } : undefined;
7546
7531
  const app = new App(opts.sim, opts.game, opts.brokerUrl ?? DEFAULT_BROKER_URL, debugOpts);
7547
7532
  if (typeof window !== "undefined" && new URLSearchParams(window.location.search).has("e2e")) {
7548
7533
  window.__BLOOP_APP__ = app;
@@ -7892,5 +7877,5 @@ export {
7892
7877
  App
7893
7878
  };
7894
7879
 
7895
- //# debugId=0BC38D81E8CCB55464756E2164756E21
7880
+ //# debugId=7B9494D52075E71364756E2164756E21
7896
7881
  //# sourceMappingURL=mod.js.map