@mittwald/ext-bridge 0.2.0-alpha.106 → 0.2.0-alpha.112

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Mittwald CM Service GmbH & Co. KG and contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,12 +1,19 @@
1
1
  import { loadingApi } from './loading.mjs';
2
2
 
3
- const isAlreadyDefined = typeof globalThis.mwExtBridge !== "undefined";
3
+ const isAlreadyDefined = typeof globalThis.mittwald?.extBridge !== "undefined";
4
4
  if (isAlreadyDefined) {
5
5
  console.warn(
6
- "mwExtBridge is already defined. The @mittwald/ext-bridge package is probably installed multiple times."
6
+ "mittwald.extBridge is already defined. The @mittwald/ext-bridge package is probably installed multiple times."
7
7
  );
8
8
  }
9
- globalThis.mwExtBridge = {
9
+ const extBridge = {
10
10
  ...loadingApi
11
11
  };
12
+ if (typeof globalThis.mittwald === "undefined") {
13
+ globalThis.mittwald = {
14
+ extBridge
15
+ };
16
+ } else {
17
+ globalThis.mittwald.extBridge = extBridge;
18
+ }
12
19
  //# sourceMappingURL=global.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"global.mjs","sources":["../../src/global.ts"],"sourcesContent":["import { loadingApi } from \"@/loading\";\nimport type { ExtBridge } from \"@/types\";\n\nconst isAlreadyDefined = typeof globalThis.mwExtBridge !== \"undefined\";\n\nif (isAlreadyDefined) {\n console.warn(\n \"mwExtBridge is already defined. The @mittwald/ext-bridge package is probably installed multiple times.\",\n );\n}\n\nglobalThis.mwExtBridge = {\n ...loadingApi,\n} as ExtBridge;\n"],"names":[],"mappings":";;AAGA,MAAM,gBAAA,GAAmB,OAAO,UAAA,CAAW,WAAgB,KAAA,WAAA;AAE3D,IAAI,gBAAkB,EAAA;AACpB,EAAQ,OAAA,CAAA,IAAA;AAAA,IACN;AAAA,GACF;AACF;AAEA,UAAA,CAAW,WAAc,GAAA;AAAA,EACvB,GAAG;AACL,CAAA"}
1
+ {"version":3,"file":"global.mjs","sources":["../../src/global.ts"],"sourcesContent":["import { loadingApi } from \"@/loading\";\nimport type { ExtBridge } from \"@/types\";\n\nconst isAlreadyDefined = typeof globalThis.mittwald?.extBridge !== \"undefined\";\n\nif (isAlreadyDefined) {\n console.warn(\n \"mittwald.extBridge is already defined. The @mittwald/ext-bridge package is probably installed multiple times.\",\n );\n}\n\nconst extBridge = {\n ...loadingApi,\n} as ExtBridge;\n\nif (typeof globalThis.mittwald === \"undefined\") {\n globalThis.mittwald = {\n extBridge,\n };\n} else {\n globalThis.mittwald.extBridge = extBridge;\n}\n"],"names":[],"mappings":";;AAGA,MAAM,gBAAmB,GAAA,OAAO,UAAW,CAAA,QAAA,EAAU,SAAc,KAAA,WAAA;AAEnE,IAAI,gBAAkB,EAAA;AACpB,EAAQ,OAAA,CAAA,IAAA;AAAA,IACN;AAAA,GACF;AACF;AAEA,MAAM,SAAY,GAAA;AAAA,EAChB,GAAG;AACL,CAAA;AAEA,IAAI,OAAO,UAAW,CAAA,QAAA,KAAa,WAAa,EAAA;AAC9C,EAAA,UAAA,CAAW,QAAW,GAAA;AAAA,IACpB;AAAA,GACF;AACF,CAAO,MAAA;AACL,EAAA,UAAA,CAAW,SAAS,SAAY,GAAA,SAAA;AAClC"}
@@ -9,8 +9,8 @@ const loadingApi = {
9
9
  resolveReadyPromise = res;
10
10
  }),
11
11
  setIsReady: async () => {
12
- const config = await mwExtBridge.getConfig();
13
- mwExtBridge.config = parseConfig(config);
12
+ const config = await mittwald.extBridge.getConfig();
13
+ mittwald.extBridge.config = parseConfig(config);
14
14
  resolveReadyPromise();
15
15
  }
16
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"loading.mjs","sources":["../../src/loading.ts"],"sourcesContent":["import { parseConfig } from \"@/config/parse\";\nimport { ExtBridgeError } from \"@/error\";\n\nlet resolveReadyPromise: () => void = () => {\n throw new ExtBridgeError(\"Unexpected call of resolveReadyPromise()\");\n};\n\nexport const loadingApi = {\n ready: new Promise<void>((res) => {\n resolveReadyPromise = res;\n }),\n setIsReady: async () => {\n const config = await mwExtBridge.getConfig();\n mwExtBridge.config = parseConfig(config);\n resolveReadyPromise();\n },\n} as const;\n"],"names":[],"mappings":";;;AAGA,IAAI,sBAAkC,MAAM;AAC1C,EAAM,MAAA,IAAI,eAAe,0CAA0C,CAAA;AACrE,CAAA;AAEO,MAAM,UAAa,GAAA;AAAA,EACxB,KAAO,EAAA,IAAI,OAAc,CAAA,CAAC,GAAQ,KAAA;AAChC,IAAsB,mBAAA,GAAA,GAAA;AAAA,GACvB,CAAA;AAAA,EACD,YAAY,YAAY;AACtB,IAAM,MAAA,MAAA,GAAS,MAAM,WAAA,CAAY,SAAU,EAAA;AAC3C,IAAY,WAAA,CAAA,MAAA,GAAS,YAAY,MAAM,CAAA;AACvC,IAAoB,mBAAA,EAAA;AAAA;AAExB;;;;"}
1
+ {"version":3,"file":"loading.mjs","sources":["../../src/loading.ts"],"sourcesContent":["import { parseConfig } from \"@/config/parse\";\nimport { ExtBridgeError } from \"@/error\";\n\nlet resolveReadyPromise: () => void = () => {\n throw new ExtBridgeError(\"Unexpected call of resolveReadyPromise()\");\n};\n\nexport const loadingApi = {\n ready: new Promise<void>((res) => {\n resolveReadyPromise = res;\n }),\n setIsReady: async () => {\n const config = await mittwald.extBridge.getConfig();\n mittwald.extBridge.config = parseConfig(config);\n resolveReadyPromise();\n },\n} as const;\n"],"names":[],"mappings":";;;AAGA,IAAI,sBAAkC,MAAM;AAC1C,EAAM,MAAA,IAAI,eAAe,0CAA0C,CAAA;AACrE,CAAA;AAEO,MAAM,UAAa,GAAA;AAAA,EACxB,KAAO,EAAA,IAAI,OAAc,CAAA,CAAC,GAAQ,KAAA;AAChC,IAAsB,mBAAA,GAAA,GAAA;AAAA,GACvB,CAAA;AAAA,EACD,YAAY,YAAY;AACtB,IAAA,MAAM,MAAS,GAAA,MAAM,QAAS,CAAA,SAAA,CAAU,SAAU,EAAA;AAClD,IAAS,QAAA,CAAA,SAAA,CAAU,MAAS,GAAA,WAAA,CAAY,MAAM,CAAA;AAC9C,IAAoB,mBAAA,EAAA;AAAA;AAExB;;;;"}
@@ -1,8 +1,8 @@
1
1
  import { usePromise } from '@mittwald/react-use-promise';
2
2
 
3
3
  const useExtBridge = () => usePromise(async () => {
4
- await globalThis.mwExtBridge.ready;
5
- return globalThis.mwExtBridge;
4
+ await globalThis.mittwald.extBridge.ready;
5
+ return globalThis.mittwald.extBridge;
6
6
  }, []);
7
7
 
8
8
  export { useExtBridge };
@@ -1 +1 @@
1
- {"version":3,"file":"useExtBridge.mjs","sources":["../../../../src/react/hooks/useExtBridge.ts"],"sourcesContent":["import { usePromise } from \"@mittwald/react-use-promise\";\n\nexport const useExtBridge = () =>\n usePromise(async () => {\n await globalThis.mwExtBridge.ready;\n return globalThis.mwExtBridge;\n }, []);\n"],"names":[],"mappings":";;AAEa,MAAA,YAAA,GAAe,MAC1B,UAAA,CAAW,YAAY;AACrB,EAAA,MAAM,WAAW,WAAY,CAAA,KAAA;AAC7B,EAAA,OAAO,UAAW,CAAA,WAAA;AACpB,CAAA,EAAG,EAAE;;;;"}
1
+ {"version":3,"file":"useExtBridge.mjs","sources":["../../../../src/react/hooks/useExtBridge.ts"],"sourcesContent":["import { usePromise } from \"@mittwald/react-use-promise\";\n\nexport const useExtBridge = () =>\n usePromise(async () => {\n await globalThis.mittwald.extBridge.ready;\n return globalThis.mittwald.extBridge;\n }, []);\n"],"names":[],"mappings":";;AAEa,MAAA,YAAA,GAAe,MAC1B,UAAA,CAAW,YAAY;AACrB,EAAM,MAAA,UAAA,CAAW,SAAS,SAAU,CAAA,KAAA;AACpC,EAAA,OAAO,WAAW,QAAS,CAAA,SAAA;AAC7B,CAAA,EAAG,EAAE;;;;"}
@@ -10,6 +10,9 @@ export interface ExtBridge extends ExtBridgeRemoteApi, LoadingApi {
10
10
  config: ExtBridgeConfig;
11
11
  }
12
12
  declare global {
13
- var mwExtBridge: ExtBridge;
13
+ interface mittwald {
14
+ extBridge: ExtBridge;
15
+ }
16
+ var mittwald: mittwald;
14
17
  }
15
18
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,KAAK,UAAU,GAAG,OAAO,UAAU,CAAC;AAEpC,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACvC,SAAS,EAAE,MAAM,OAAO,CAAC,eAAe,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,SAAU,SAAQ,kBAAkB,EAAE,UAAU;IAC/D,MAAM,EAAE,eAAe,CAAC;CACzB;AAED,OAAO,CAAC,MAAM,CAAC;IAEb,IAAI,WAAW,EAAE,SAAS,CAAC;CAC5B"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,KAAK,UAAU,GAAG,OAAO,UAAU,CAAC;AAEpC,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACvC,SAAS,EAAE,MAAM,OAAO,CAAC,eAAe,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,SAAU,SAAQ,kBAAkB,EAAE,UAAU;IAC/D,MAAM,EAAE,eAAe,CAAC;CACzB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,QAAQ;QAChB,SAAS,EAAE,SAAS,CAAC;KACtB;IAGD,IAAI,QAAQ,EAAE,QAAQ,CAAC;CACxB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/ext-bridge",
3
- "version": "0.2.0-alpha.106",
3
+ "version": "0.2.0-alpha.112",
4
4
  "type": "module",
5
5
  "description": "Bridge for mStudio embedded frontend extensions",
6
6
  "homepage": "https://mittwald.github.io/flow",
@@ -62,5 +62,6 @@
62
62
  "react-dom": {
63
63
  "optional": true
64
64
  }
65
- }
65
+ },
66
+ "gitHead": "b422c13d2bbbafca1cfae36e1e2b6789e73abd6e"
66
67
  }