@webstudio-is/react-sdk 0.5.1 → 0.6.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.
@@ -0,0 +1,8 @@
1
+ import { Outlet as DefaultOutlet } from "@remix-run/react";
2
+ /**
3
+ * We are using Outlet prop from index layout when user renders site from a subdomain.
4
+ */
5
+ export declare const Root: ({ Outlet, }: {
6
+ Outlet: typeof DefaultOutlet;
7
+ }) => JSX.Element;
8
+ //# sourceMappingURL=canvas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canvas.d.ts","sourceRoot":"","sources":["../../src/canvas/canvas.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,MAAM,IAAI,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGxE;;GAEG;AACH,eAAO,MAAM,IAAI;YAGP,oBAAoB;iBAgB7B,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Root = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("@remix-run/react");
6
+ const __1 = require("..");
7
+ /**
8
+ * We are using Outlet prop from index layout when user renders site from a subdomain.
9
+ */
10
+ const Root = ({ Outlet = react_1.Outlet, }) => {
11
+ return ((0, jsx_runtime_1.jsxs)("html", { lang: "en", children: [(0, jsx_runtime_1.jsxs)("head", { children: [(0, jsx_runtime_1.jsx)("meta", { charSet: "utf-8" }), (0, jsx_runtime_1.jsx)("meta", { name: "viewport", content: "width=device-width,initial-scale=1" }), (0, jsx_runtime_1.jsx)("link", { rel: "icon", href: "/favicon.ico", type: "image/x-icon" }), (0, jsx_runtime_1.jsx)("link", { rel: "shortcut icon", href: "/favicon.ico", type: "image/x-icon" }), (0, jsx_runtime_1.jsx)(react_1.Meta, {}), (0, jsx_runtime_1.jsx)(react_1.Links, {}), (0, jsx_runtime_1.jsx)(__1.CriticalCss, {})] }), (0, jsx_runtime_1.jsx)(Outlet, {})] }));
12
+ };
13
+ exports.Root = Root;
@@ -0,0 +1,2 @@
1
+ export * from "./canvas";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/canvas/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./canvas"), exports);
@@ -1,7 +1,7 @@
1
1
  export declare const categories: {
2
2
  layout: {
3
3
  label: string;
4
- properties: readonly ["display", "flexDirection", "flexWrap", "alignItems", "justifyContent", "placeContent", "justifyItems", "alignContent", "rowGap", "columnGap", "gridAutoFlow", "gridAutoRows", "gridAutoColumns", "gridTemplateColumns", "gridTemplateRows", "gridTemplateAreas"];
4
+ properties: readonly ["display", "flexDirection", "flexWrap", "alignItems", "justifyContent", "alignContent", "placeContent", "justifyItems", "rowGap", "columnGap", "gridAutoFlow", "gridAutoRows", "gridAutoColumns", "gridTemplateColumns", "gridTemplateRows", "gridTemplateAreas"];
5
5
  moreFrom: string;
6
6
  };
7
7
  flexChild: {
@@ -9,10 +9,10 @@ const layout = [
9
9
  // Flex or grid
10
10
  "alignItems",
11
11
  "justifyContent",
12
+ "alignContent",
12
13
  // Grid
13
14
  "placeContent",
14
15
  "justifyItems",
15
- "alignContent",
16
16
  "rowGap",
17
17
  "columnGap",
18
18
  "gridAutoFlow",
@@ -838,8 +838,9 @@ export declare const properties: {
838
838
  readonly columnGap: {
839
839
  readonly inherited: false;
840
840
  readonly initial: {
841
- readonly type: "keyword";
842
- readonly value: "normal";
841
+ readonly type: "unit";
842
+ readonly value: 0;
843
+ readonly unit: "px";
843
844
  };
844
845
  readonly popularity: 0.09282422;
845
846
  readonly appliesTo: "multiColumnElementsFlexContainersGridContainers";
@@ -2413,8 +2414,9 @@ export declare const properties: {
2413
2414
  readonly rowGap: {
2414
2415
  readonly inherited: false;
2415
2416
  readonly initial: {
2416
- readonly type: "keyword";
2417
- readonly value: "normal";
2417
+ readonly type: "unit";
2418
+ readonly value: 0;
2419
+ readonly unit: "px";
2418
2420
  };
2419
2421
  readonly popularity: 0.01955862;
2420
2422
  readonly appliesTo: "multiColumnElementsFlexContainersGridContainers";
@@ -1 +1 @@
1
- {"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../src/css/properties.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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"keyword",
846
- "value": "normal"
845
+ "type": "unit",
846
+ "value": 0,
847
+ "unit": "px"
847
848
  },
848
849
  "popularity": 0.09282422,
849
850
  "appliesTo": "multiColumnElementsFlexContainersGridContainers"
@@ -2417,8 +2418,9 @@ exports.properties = {
2417
2418
  "rowGap": {
2418
2419
  "inherited": false,
2419
2420
  "initial": {
2420
- "type": "keyword",
2421
- "value": "normal"
2421
+ "type": "unit",
2422
+ "value": 0,
2423
+ "unit": "px"
2422
2424
  },
2423
2425
  "popularity": 0.01955862,
2424
2426
  "appliesTo": "multiColumnElementsFlexContainersGridContainers"
package/lib/index.d.ts CHANGED
@@ -6,4 +6,5 @@ export * as componentsMeta from "./components/meta";
6
6
  export * from "./user-props";
7
7
  export * from "./pubsub";
8
8
  export * from "./db";
9
+ export * from "./canvas";
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,cAAc,MAAM,mBAAmB,CAAC;AACpD,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,cAAc,MAAM,mBAAmB,CAAC;AACpD,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,MAAM,CAAC;AACrB,cAAc,UAAU,CAAC"}
package/lib/index.js CHANGED
@@ -35,3 +35,4 @@ exports.componentsMeta = __importStar(require("./components/meta"));
35
35
  __exportStar(require("./user-props"), exports);
36
36
  __exportStar(require("./pubsub"), exports);
37
37
  __exportStar(require("./db"), exports);
38
+ __exportStar(require("./canvas"), exports);
@@ -0,0 +1,28 @@
1
+ /// <reference types="react" />
2
+ export declare const createPubsub: <PublishMap>() => {
3
+ /**
4
+ * To publish a postMessage event on the current window and parent window from the iframe.
5
+ */
6
+ publish<Type extends keyof PublishMap>(action: undefined extends PublishMap[Type] ? {
7
+ type: Type;
8
+ payload?: PublishMap[Type] | undefined;
9
+ } : {
10
+ type: Type;
11
+ payload: PublishMap[Type];
12
+ }): void;
13
+ /**
14
+ * To publish a postMessage event on the iframe and parent window from the parent window.
15
+ */
16
+ usePublish(): readonly [<Type_1 extends keyof PublishMap>(action: undefined extends PublishMap[Type_1] ? {
17
+ type: Type_1;
18
+ payload?: PublishMap[Type_1] | undefined;
19
+ } : {
20
+ type: Type_1;
21
+ payload: PublishMap[Type_1];
22
+ }) => void, import("react").MutableRefObject<HTMLIFrameElement | null>];
23
+ /**
24
+ * To subscribe a message event on the current window.
25
+ */
26
+ useSubscribe<Type_2 extends keyof PublishMap>(type: Type_2, onAction: (payload: PublishMap[Type_2]) => void): void;
27
+ };
28
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/pubsub/create.ts"],"names":[],"mappings":";AAGA,eAAO,MAAM,YAAY;IA0BrB;;OAEG;;;;;;;;IAMH;;OAEG;;;;;;;;IAeH;;OAEG;2GAGwC,IAAI;CAUlD,CAAC"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createPubsub = void 0;
7
+ const mitt_1 = __importDefault(require("mitt"));
8
+ const react_1 = require("react");
9
+ const createPubsub = () => {
10
+ // `mitt` has a somewhat annoying overload for `*` type that makes it hard to wrap in a generic context
11
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
+ const emitter = (0, mitt_1.default)();
13
+ if (typeof window === "object") {
14
+ window.addEventListener("message", (event) => {
15
+ // @todo this has no type safety built in, could be anything from any source.
16
+ // we could potentially maintain a list of valid event types at runtime
17
+ // at the very least we could add a brand property or something to our events
18
+ if (typeof event.data?.type === "string") {
19
+ emitter.emit(event.data.type, event.data.payload);
20
+ }
21
+ }, false);
22
+ }
23
+ return {
24
+ /**
25
+ * To publish a postMessage event on the current window and parent window from the iframe.
26
+ */
27
+ publish(action) {
28
+ window.parent.postMessage(action, "*");
29
+ window.postMessage(action, "*");
30
+ },
31
+ /**
32
+ * To publish a postMessage event on the iframe and parent window from the parent window.
33
+ */
34
+ usePublish() {
35
+ const iframeRef = (0, react_1.useRef)(null);
36
+ const publishCallback = (0, react_1.useCallback)((action) => {
37
+ const element = iframeRef.current;
38
+ if (element?.contentWindow == null)
39
+ return;
40
+ element.contentWindow.postMessage(action, "*");
41
+ window.postMessage(action, "*");
42
+ }, [iframeRef]);
43
+ return [publishCallback, iframeRef];
44
+ },
45
+ /**
46
+ * To subscribe a message event on the current window.
47
+ */
48
+ useSubscribe(type, onAction) {
49
+ (0, react_1.useEffect)(() => {
50
+ emitter.on(type, onAction);
51
+ return () => {
52
+ emitter.off(type, onAction);
53
+ };
54
+ }, [type, onAction]);
55
+ },
56
+ };
57
+ };
58
+ exports.createPubsub = createPubsub;
@@ -1,3 +1,2 @@
1
- export * from "./publish";
2
- export * from "./subscribe";
1
+ export * from "./create";
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pubsub/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pubsub/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -14,5 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./publish"), exports);
18
- __exportStar(require("./subscribe"), exports);
17
+ __exportStar(require("./create"), exports);
@@ -11,6 +11,6 @@ declare type RootProps = {
11
11
  data: Data;
12
12
  Component?: (props: WrapperComponentProps) => JSX.Element;
13
13
  };
14
- export declare const Root: ({ data, Component }: RootProps) => JSX.Element | null;
14
+ export declare const InstanceRoot: ({ data, Component, }: RootProps) => JSX.Element | null;
15
15
  export {};
16
16
  //# sourceMappingURL=root.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/tree/root.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAGzC,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,qBAAqB,CAAC;AAE7B,oBAAY,IAAI,GAAG;IACjB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC/B,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,YAAY,cAIvB,CAAC;AAEH,aAAK,SAAS,GAAG;IACf,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,GAAG,CAAC,OAAO,CAAC;CAC3D,CAAC;AAEF,eAAO,MAAM,IAAI,wBAAyB,SAAS,KAAG,WAAW,GAAG,IAYnE,CAAC"}
1
+ {"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/tree/root.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAGzC,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,qBAAqB,CAAC;AAE7B,oBAAY,IAAI,GAAG;IACjB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,WAAW,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC/B,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,YAAY,cAIvB,CAAC;AAEH,aAAK,SAAS,GAAG;IACf,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,GAAG,CAAC,OAAO,CAAC;CAC3D,CAAC;AAEF,eAAO,MAAM,YAAY,yBAGtB,SAAS,KAAG,WAAW,GAAG,IAY5B,CAAC"}
package/lib/tree/root.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Root = exports.globalStyles = void 0;
3
+ exports.InstanceRoot = exports.globalStyles = void 0;
4
4
  const user_props_1 = require("../user-props/");
5
5
  const stitches_1 = require("../stitches");
6
6
  const create_elements_tree_1 = require("./create-elements-tree");
@@ -10,7 +10,7 @@ exports.globalStyles = (0, stitches_1.globalCss)({
10
10
  height: "100%",
11
11
  },
12
12
  });
13
- const Root = ({ data, Component }) => {
13
+ const InstanceRoot = ({ data, Component, }) => {
14
14
  if (data.tree === null) {
15
15
  throw new Error("Tree is null");
16
16
  }
@@ -23,4 +23,4 @@ const Root = ({ data, Component }) => {
23
23
  Component: Component ?? wrapper_component_1.WrapperComponent,
24
24
  });
25
25
  };
26
- exports.Root = Root;
26
+ exports.InstanceRoot = InstanceRoot;
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@webstudio-is/react-sdk",
3
- "version": "0.5.1",
3
+ "version": "0.6.1",
4
4
  "description": "Webstudio JavaScript / TypeScript API",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
7
7
  "scripts": {
8
8
  "dev": "tsup src/index.ts --format esm,cjs --watch --out-dir=lib",
9
9
  "build": "yarn build:mdn-data && yarn build:args && yarn build:lib",
10
- "build:mdn-data": "node --experimental-loader esbuild-node-loader ./bin/mdn-data.ts ./src/css",
11
- "build:args": "node --experimental-loader esbuild-node-loader ./bin/generate-arg-types.ts './src/components/*.tsx !./src/**/*.stories.tsx !./src/**/*.ws.tsx'",
10
+ "build:mdn-data": "tsx ./bin/mdn-data.ts ./src/css",
11
+ "build:args": "tsx ./bin/generate-arg-types.ts './src/components/*.tsx !./src/**/*.stories.tsx !./src/**/*.ws.tsx'",
12
12
  "typecheck": "tsc --noEmit",
13
13
  "build:lib": "rm -fr lib && tsc",
14
14
  "test": "jest",
@@ -20,6 +20,7 @@
20
20
  },
21
21
  "devDependencies": {
22
22
  "@babel/core": "^7.17.12",
23
+ "@esbuild-kit/esm-loader": "^2.4.2",
23
24
  "@remix-run/react": "^1.2.3",
24
25
  "@remix-run/server-runtime": "^1.2.3",
25
26
  "@storybook/addon-actions": "^6.5.6",
@@ -33,20 +34,20 @@
33
34
  "@types/css-tree": "^1.0.7",
34
35
  "@types/fs-extra": "^9.0.13",
35
36
  "@types/node": "^17.0.21",
37
+ "@webstudio-is/jest-config": "*",
38
+ "@webstudio-is/prisma-client": "*",
36
39
  "babel-loader": "^8.2.5",
37
40
  "camelcase": "^6.3.0",
38
41
  "css-tree": "^2.1.0",
39
42
  "esbuild": "^0.14.25",
40
43
  "esbuild-node-externals": "^1.4.1",
41
- "esbuild-node-loader": "^0.8.0",
42
- "@webstudio-is/jest-config": "*",
43
44
  "mdn-data": "2.0.23",
44
45
  "react": "^17.0.2",
45
46
  "react-docgen-typescript": "^2.2.2",
46
47
  "react-dom": "^17.0.2",
47
- "@webstudio-is/prisma-client": "*",
48
48
  "tsup": "^6.1.3",
49
- "typescript": "^4.6.2"
49
+ "tsx": "^3.9.0",
50
+ "typescript": "4.7.4"
50
51
  },
51
52
  "peerDependencies": {
52
53
  "@remix-run/react": "^1.2.3",
@@ -58,10 +59,10 @@
58
59
  "dependencies": {
59
60
  "@stitches/core": "^1.2.7",
60
61
  "@webstudio-is/icons": "*",
62
+ "@webstudio-is/jest-config": "*",
61
63
  "immer": "^9.0.12",
62
64
  "mitt": "^3.0.0",
63
65
  "react-nano-state": "^0.4.0",
64
- "@webstudio-is/jest-config": "*",
65
66
  "zod": "^3.17.3"
66
67
  },
67
68
  "main": "lib/index.js",
@@ -1,17 +0,0 @@
1
- import { MutableRefObject } from "react";
2
- declare type Action<Type, Payload> = {
3
- type: Type;
4
- payload?: Payload;
5
- };
6
- export declare type Publish = <Type, Payload = undefined>(action: Action<Type, Payload>) => void;
7
- declare type UsePublish = [Publish, MutableRefObject<HTMLIFrameElement | null>];
8
- /**
9
- * To publish a postMessage event on the iframe and parent window from the parent window.
10
- */
11
- export declare const usePublish: () => UsePublish;
12
- /**
13
- * To publish a postMessage event on the current window and parent window from the iframe.
14
- */
15
- export declare const publish: <Type extends string, Payload = undefined>(action: Action<Type, Payload>) => void;
16
- export {};
17
- //# sourceMappingURL=publish.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../src/pubsub/publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAE9D,aAAK,MAAM,CAAC,IAAI,EAAE,OAAO,IAAI;IAC3B,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,oBAAY,OAAO,GAAG,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,EAC9C,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,KAC1B,IAAI,CAAC;AAEV,aAAK,UAAU,GAAG,CAAC,OAAO,EAAE,gBAAgB,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,UAAU,kBAYtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,mFAKnB,CAAC"}
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.publish = exports.usePublish = void 0;
4
- const react_1 = require("react");
5
- /**
6
- * To publish a postMessage event on the iframe and parent window from the parent window.
7
- */
8
- const usePublish = () => {
9
- const iframeRef = (0, react_1.useRef)(null);
10
- const publishCallback = (0, react_1.useCallback)((action) => {
11
- const element = iframeRef.current;
12
- if (element?.contentWindow == null)
13
- return;
14
- element.contentWindow.postMessage(action, "*");
15
- window.postMessage(action, "*");
16
- }, [iframeRef]);
17
- return [publishCallback, iframeRef];
18
- };
19
- exports.usePublish = usePublish;
20
- /**
21
- * To publish a postMessage event on the current window and parent window from the iframe.
22
- */
23
- const publish = (action) => {
24
- window.parent.postMessage(action, "*");
25
- window.postMessage(action, "*");
26
- };
27
- exports.publish = publish;
@@ -1,8 +0,0 @@
1
- declare type Events = Record<string, any>;
2
- export declare const emitter: import("mitt").Emitter<Events>;
3
- /**
4
- * To subscribe a message event on the current window.
5
- */
6
- export declare const useSubscribe: <Type extends string, Payload = undefined>(type: Type, onAction: (payload: Payload) => void) => void;
7
- export {};
8
- //# sourceMappingURL=subscribe.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subscribe.d.ts","sourceRoot":"","sources":["../../src/pubsub/subscribe.ts"],"names":[],"mappings":"AAQA,aAAK,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAElC,eAAO,MAAM,OAAO,gCAAiB,CAAC;AAgBtC;;GAEG;AACH,eAAO,MAAM,YAAY,yFAES,IAAI,SAQrC,CAAC"}
@@ -1,30 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.useSubscribe = exports.emitter = void 0;
7
- const mitt_1 = __importDefault(require("mitt"));
8
- const react_1 = require("react");
9
- exports.emitter = (0, mitt_1.default)();
10
- if (typeof window === "object") {
11
- window.addEventListener("message", (event) => {
12
- // @todo this has no type safety built in, could be anything from any source.
13
- // we could potentially maintain a list of valid event types, but see prior contra points.
14
- if (typeof event.data?.type === "string") {
15
- exports.emitter.emit(event.data.type, event.data.payload);
16
- }
17
- }, false);
18
- }
19
- /**
20
- * To subscribe a message event on the current window.
21
- */
22
- const useSubscribe = (type, onAction) => {
23
- (0, react_1.useEffect)(() => {
24
- exports.emitter.on(type, onAction);
25
- return () => {
26
- exports.emitter.off(type, onAction);
27
- };
28
- }, [type, onAction]);
29
- };
30
- exports.useSubscribe = useSubscribe;