ooxml-core 0.14.0 → 0.14.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.
@@ -1 +1 @@
1
- {"version":3,"file":"broadcast-transport.d.ts","sourceRoot":"","sources":["../../src/collab/broadcast-transport.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAqB,MAAM,eAAe,CAAC;AAGlE,mEAAmE;AACnE,MAAM,WAAW,oBAAoB;IACpC,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,SAAS,EAAE,CAAC,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;CACvD;AACD,MAAM,MAAM,2BAA2B,GAAG,KAAK,IAAI,EAAE,MAAM,KAAK,oBAAoB,CAAC;AAErF,MAAM,WAAW,yBAAyB;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,gBAAgB,CAAC,EAAE,2BAA2B,CAAC;CAC/C;AAaD,wEAAwE;AACxE,wBAAgB,YAAY,CAAC,KAAK,GAAE,MAAmB,GAAG,OAAO,CAEhE;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,SAAS,CAmDtF"}
1
+ {"version":3,"file":"broadcast-transport.d.ts","sourceRoot":"","sources":["../../src/collab/broadcast-transport.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAqB,MAAM,eAAe,CAAC;AAGlE,mEAAmE;AACnE,MAAM,WAAW,oBAAoB;IACpC,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,SAAS,EAAE,CAAC,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;CACvD;AACD,MAAM,MAAM,2BAA2B,GAAG,KAAK,IAAI,EAAE,MAAM,KAAK,oBAAoB,CAAC;AAErF,MAAM,WAAW,yBAAyB;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,gBAAgB,CAAC,EAAE,2BAA2B,CAAC;CAC/C;AAiBD,wEAAwE;AACxE,wBAAgB,YAAY,CAAC,KAAK,GAAE,MAAmB,GAAG,OAAO,CAEhE;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,GAAG,SAAS,CAmDtF"}
@@ -487,9 +487,10 @@ function bindDocument(session, adapter, options) {
487
487
  }
488
488
 
489
489
  // src/collab/broadcast-transport.ts
490
+ var isBytes = (value) => ArrayBuffer.isView(value) && Object.prototype.toString.call(value) === "[object Uint8Array]";
490
491
  var isEnvelope = (value) => {
491
492
  const envelope = value;
492
- return !!envelope && typeof envelope.from === "string" && (envelope.kind === "hello" || envelope.kind === "data" && envelope.data instanceof Uint8Array);
493
+ return !!envelope && typeof envelope.from === "string" && (envelope.kind === "hello" || envelope.kind === "data" && isBytes(envelope.data));
493
494
  };
494
495
  function canBroadcast(scope = globalThis) {
495
496
  return typeof scope.BroadcastChannel === "function";
@@ -520,7 +521,7 @@ function createBroadcastTransport(options) {
520
521
  open.onmessage = ({ data }) => {
521
522
  if (channel !== open || !isEnvelope(data) || data.from === self) return;
522
523
  if (data.kind === "hello") handlers?.peer?.();
523
- else handlers?.message(data.data);
524
+ else handlers?.message(new Uint8Array(data.data));
524
525
  };
525
526
  next.open();
526
527
  open.postMessage({ kind: "hello", from: self });
@@ -463,9 +463,10 @@ function bindDocument(session, adapter, options) {
463
463
  }
464
464
 
465
465
  // src/collab/broadcast-transport.ts
466
+ var isBytes = (value) => ArrayBuffer.isView(value) && Object.prototype.toString.call(value) === "[object Uint8Array]";
466
467
  var isEnvelope = (value) => {
467
468
  const envelope = value;
468
- return !!envelope && typeof envelope.from === "string" && (envelope.kind === "hello" || envelope.kind === "data" && envelope.data instanceof Uint8Array);
469
+ return !!envelope && typeof envelope.from === "string" && (envelope.kind === "hello" || envelope.kind === "data" && isBytes(envelope.data));
469
470
  };
470
471
  function canBroadcast(scope = globalThis) {
471
472
  return typeof scope.BroadcastChannel === "function";
@@ -496,7 +497,7 @@ function createBroadcastTransport(options) {
496
497
  open.onmessage = ({ data }) => {
497
498
  if (channel !== open || !isEnvelope(data) || data.from === self) return;
498
499
  if (data.kind === "hello") handlers?.peer?.();
499
- else handlers?.message(data.data);
500
+ else handlers?.message(new Uint8Array(data.data));
500
501
  };
501
502
  next.open();
502
503
  open.postMessage({ kind: "hello", from: self });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ooxml-core",
3
- "version": "0.14.0",
3
+ "version": "0.14.1",
4
4
  "description": "Shared OOXML logic for the Word, PowerPoint and Excel viewers: everything except the UI",
5
5
  "keywords": [
6
6
  "charts",