@teambit/pubsub 0.0.549 → 0.0.555

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,5 +1,9 @@
1
1
  import React, { RefObject, ReactNode } from 'react';
2
2
  export interface PubSubRegistry {
3
+ /**
4
+ * starts a connection to an iframe child.
5
+ * Returns a destroy() function that will break the connection.
6
+ */
3
7
  connect(ref: HTMLIFrameElement): () => void;
4
8
  }
5
9
  export declare const pubsubRegistry: React.Context<PubSubRegistry | undefined>;
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Please Notice: This file will run in the preview iframe.
3
+ */
1
4
  import { BitBaseEvent } from './bit-base-event';
2
5
  import { Callback } from './types';
3
6
  export declare class PubsubPreview {
@@ -2,15 +2,28 @@ import { UiUI } from '@teambit/ui';
2
2
  import { BitBaseEvent } from './bit-base-event';
3
3
  import { Callback } from './types';
4
4
  declare type PubOptions = {
5
+ /** forward the event to adjacent windows (including the preview iframe) */
5
6
  propagate?: boolean;
6
7
  };
7
8
  export declare class PubsubUI {
8
9
  private childApi?;
9
10
  private events;
11
+ /**
12
+ * subscribe to events
13
+ */
10
14
  sub: (topic: string, callback: Callback) => () => void;
15
+ /**
16
+ * publish event to all subscribers, including nested iframes.
17
+ */
11
18
  pub: (topic: string, event: BitBaseEvent<any>, { propagate }?: PubOptions) => void;
12
19
  private connectToIframe;
20
+ /**
21
+ * publish event to all subscribers in this window
22
+ */
13
23
  private emitEvent;
24
+ /**
25
+ * publish event to nested iframes
26
+ */
14
27
  private pubToChild;
15
28
  static runtime: import("@teambit/harmony").RuntimeDefinition;
16
29
  static dependencies: import("@teambit/harmony").Aspect[];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/pubsub",
3
- "version": "0.0.549",
3
+ "version": "0.0.555",
4
4
  "homepage": "https://bit.dev/teambit/harmony/pubsub",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.harmony",
8
8
  "name": "pubsub",
9
- "version": "0.0.549"
9
+ "version": "0.0.555"
10
10
  },
11
11
  "dependencies": {
12
12
  "@teambit/harmony": "0.2.11",
@@ -14,10 +14,10 @@
14
14
  "penpal": "5.3.0",
15
15
  "@babel/runtime": "7.12.18",
16
16
  "core-js": "^3.0.0",
17
- "@teambit/cli": "0.0.380",
18
- "@teambit/preview": "0.0.549",
19
- "@teambit/ui-foundation.ui.is-browser": "0.0.459",
20
- "@teambit/ui": "0.0.549"
17
+ "@teambit/cli": "0.0.386",
18
+ "@teambit/preview": "0.0.555",
19
+ "@teambit/ui-foundation.ui.is-browser": "0.0.463",
20
+ "@teambit/ui": "0.0.555"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/react": "^17.0.8",
@@ -28,7 +28,7 @@
28
28
  "@types/node": "12.20.4"
29
29
  },
30
30
  "peerDependencies": {
31
- "@teambit/legacy": "1.0.76",
31
+ "@teambit/legacy": "1.0.172",
32
32
  "react-dom": "^16.8.0 || ^17.0.0",
33
33
  "react": "^16.8.0 || ^17.0.0"
34
34
  },
@@ -56,7 +56,7 @@
56
56
  "react": "-"
57
57
  },
58
58
  "peerDependencies": {
59
- "@teambit/legacy": "1.0.76",
59
+ "@teambit/legacy": "1.0.172",
60
60
  "react-dom": "^16.8.0 || ^17.0.0",
61
61
  "react": "^16.8.0 || ^17.0.0"
62
62
  }
package/tsconfig.json CHANGED
@@ -25,7 +25,6 @@
25
25
  "strict": true,
26
26
  "noImplicitAny": false,
27
27
  "rootDir": ".",
28
- "removeComments": true,
29
28
  "preserveConstEnums": true,
30
29
  "resolveJsonModule": true
31
30
  },