@uniformdev/canvas 19.198.2-alpha.0 → 19.198.3-alpha.3

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/index.esm.js CHANGED
@@ -2705,8 +2705,34 @@ var createCanvasChannel = ({
2705
2705
  };
2706
2706
 
2707
2707
  // src/preview/createEventBus.ts
2708
+ var PUSHER_SRC = "https://js.pusher.com/7.0.3/pusher.min.js";
2709
+ async function loadPusher() {
2710
+ if (typeof document === "undefined" || typeof window === "undefined") {
2711
+ return;
2712
+ }
2713
+ if (window.Pusher) {
2714
+ return window.Pusher;
2715
+ }
2716
+ return new Promise((resolve, reject) => {
2717
+ const timeout = setTimeout(() => {
2718
+ if (window.Pusher) {
2719
+ resolve(window.Pusher);
2720
+ }
2721
+ reject(
2722
+ `Unable to load pusher.js; Uniform Canvas live preview disabled. Consider adding <script src="${PUSHER_SRC}"></script> manually.`
2723
+ );
2724
+ }, 5e3);
2725
+ const pusher = document.createElement("script");
2726
+ pusher.src = PUSHER_SRC;
2727
+ pusher.addEventListener("load", () => {
2728
+ clearTimeout(timeout);
2729
+ resolve(window.Pusher);
2730
+ });
2731
+ document.head.appendChild(pusher);
2732
+ });
2733
+ }
2708
2734
  async function createEventBus() {
2709
- const WindowPusher = window.Pusher;
2735
+ const WindowPusher = await loadPusher();
2710
2736
  if (!WindowPusher) {
2711
2737
  return;
2712
2738
  }
package/dist/index.js CHANGED
@@ -2863,8 +2863,34 @@ var createCanvasChannel = ({
2863
2863
  };
2864
2864
 
2865
2865
  // src/preview/createEventBus.ts
2866
+ var PUSHER_SRC = "https://js.pusher.com/7.0.3/pusher.min.js";
2867
+ async function loadPusher() {
2868
+ if (typeof document === "undefined" || typeof window === "undefined") {
2869
+ return;
2870
+ }
2871
+ if (window.Pusher) {
2872
+ return window.Pusher;
2873
+ }
2874
+ return new Promise((resolve, reject) => {
2875
+ const timeout = setTimeout(() => {
2876
+ if (window.Pusher) {
2877
+ resolve(window.Pusher);
2878
+ }
2879
+ reject(
2880
+ `Unable to load pusher.js; Uniform Canvas live preview disabled. Consider adding <script src="${PUSHER_SRC}"></script> manually.`
2881
+ );
2882
+ }, 5e3);
2883
+ const pusher = document.createElement("script");
2884
+ pusher.src = PUSHER_SRC;
2885
+ pusher.addEventListener("load", () => {
2886
+ clearTimeout(timeout);
2887
+ resolve(window.Pusher);
2888
+ });
2889
+ document.head.appendChild(pusher);
2890
+ });
2891
+ }
2866
2892
  async function createEventBus() {
2867
- const WindowPusher = window.Pusher;
2893
+ const WindowPusher = await loadPusher();
2868
2894
  if (!WindowPusher) {
2869
2895
  return;
2870
2896
  }
package/dist/index.mjs CHANGED
@@ -2705,8 +2705,34 @@ var createCanvasChannel = ({
2705
2705
  };
2706
2706
 
2707
2707
  // src/preview/createEventBus.ts
2708
+ var PUSHER_SRC = "https://js.pusher.com/7.0.3/pusher.min.js";
2709
+ async function loadPusher() {
2710
+ if (typeof document === "undefined" || typeof window === "undefined") {
2711
+ return;
2712
+ }
2713
+ if (window.Pusher) {
2714
+ return window.Pusher;
2715
+ }
2716
+ return new Promise((resolve, reject) => {
2717
+ const timeout = setTimeout(() => {
2718
+ if (window.Pusher) {
2719
+ resolve(window.Pusher);
2720
+ }
2721
+ reject(
2722
+ `Unable to load pusher.js; Uniform Canvas live preview disabled. Consider adding <script src="${PUSHER_SRC}"></script> manually.`
2723
+ );
2724
+ }, 5e3);
2725
+ const pusher = document.createElement("script");
2726
+ pusher.src = PUSHER_SRC;
2727
+ pusher.addEventListener("load", () => {
2728
+ clearTimeout(timeout);
2729
+ resolve(window.Pusher);
2730
+ });
2731
+ document.head.appendChild(pusher);
2732
+ });
2733
+ }
2708
2734
  async function createEventBus() {
2709
- const WindowPusher = window.Pusher;
2735
+ const WindowPusher = await loadPusher();
2710
2736
  if (!WindowPusher) {
2711
2737
  return;
2712
2738
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas",
3
- "version": "19.198.2-alpha.0+784b685d85",
3
+ "version": "19.198.3-alpha.3+841d67194f",
4
4
  "description": "Common functionality and types for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -38,9 +38,9 @@
38
38
  "pusher-js": "8.2.0"
39
39
  },
40
40
  "dependencies": {
41
- "@uniformdev/assets": "19.198.2-alpha.0+784b685d85",
42
- "@uniformdev/context": "19.198.2-alpha.0+784b685d85",
43
- "@uniformdev/richtext": "19.198.2-alpha.0+784b685d85",
41
+ "@uniformdev/assets": "19.198.3-alpha.3+841d67194f",
42
+ "@uniformdev/context": "19.198.3-alpha.3+841d67194f",
43
+ "@uniformdev/richtext": "19.198.3-alpha.3+841d67194f",
44
44
  "immer": "10.1.1"
45
45
  },
46
46
  "files": [
@@ -49,5 +49,5 @@
49
49
  "publishConfig": {
50
50
  "access": "public"
51
51
  },
52
- "gitHead": "784b685d8510a8c185bc4d57e5aeaf2ced9719c9"
52
+ "gitHead": "841d67194f69de255b50de9b3a8c17b1f9461ec5"
53
53
  }