@teambit/pubsub 1.0.227 → 1.0.229
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/artifacts/__bit_junit.xml +1 -1
- package/artifacts/preview/teambit_harmony_pubsub-preview.js +1 -1
- package/artifacts/schema.json +17 -5
- package/dist/bit-base-event.d.ts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/no-parent-error.d.ts +3 -0
- package/dist/{preview-1712719054377.js → preview-1712822929999.js} +2 -2
- package/dist/pubsub-context.d.ts +14 -0
- package/dist/pubsub.aspect.d.ts +3 -0
- package/dist/pubsub.composition.d.ts +1 -0
- package/dist/pubsub.main.runtime.d.ts +10 -0
- package/dist/pubsub.preview.runtime.d.ts +16 -0
- package/dist/pubsub.ui.runtime.d.ts +36 -0
- package/dist/types.d.ts +2 -0
- package/package.json +6 -6
- package/tsconfig.json +1 -13
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<testsuites tests="0" failures="0" errors="0" skipped="0">
|
|
3
|
-
<testsuite name="teambit.harmony/pubsub@1.0.
|
|
3
|
+
<testsuite name="teambit.harmony/pubsub@1.0.229" tests="0" failures="0" errors="0" skipped="0"/>
|
|
4
4
|
</testsuites>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.harmony/pubsub-preview"]=t():e["teambit.harmony/pubsub-preview"]=t()}(self,(()=>(()=>{"use strict";var e={
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.harmony/pubsub-preview"]=t():e["teambit.harmony/pubsub-preview"]=t()}(self,(()=>(()=>{"use strict";var e={67949:(e,t,o)=>{var r={id:"teambit.harmony/pubsub@1.0.229",homepage:"https://bit.cloud/teambit/harmony/pubsub",exported:!0};function n(){const e=i(o(41594));return n=function(){return e},e}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,n.__bit_component=r,i.__bit_component=r;const p=()=>n().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},n().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/pubsub.svg"}));p.__bit_component=r,t.Logo=p},41594:e=>{e.exports=React}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{o.r(r),o.d(r,{compositions:()=>d,compositions_metadata:()=>f,overview:()=>b});var e={};o.r(e),o.d(e,{default:()=>u});var t=o(67949);o(41594);const n=MdxJsReact,i=TeambitMdxUiMdxScopeContext;var p=["components"];function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},a.apply(this,arguments)}var s={},c="wrapper";function u(e){var t=e.components,o=function(e,t){if(null==e)return{};var o,r,n=function(e,t){if(null==e)return{};var o,r,n={},i=Object.keys(e);for(r=0;r<i.length;r++)o=i[r],t.indexOf(o)>=0||(n[o]=e[o]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)o=i[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}(e,p);return(0,n.mdx)(c,a({},s,o,{components:t,mdxType:"MDXLayout"}),(0,n.mdx)(i.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"}))}u.isMDXComponent=!0;const d=[t],b=[e],f={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),r})()));
|
package/artifacts/schema.json
CHANGED
|
@@ -360,7 +360,8 @@
|
|
|
360
360
|
"line": 24,
|
|
361
361
|
"character": 39
|
|
362
362
|
},
|
|
363
|
-
"name": "Callback"
|
|
363
|
+
"name": "Callback",
|
|
364
|
+
"internalFilePath": "types.ts"
|
|
364
365
|
},
|
|
365
366
|
"isOptional": false,
|
|
366
367
|
"isSpread": false
|
|
@@ -682,7 +683,11 @@
|
|
|
682
683
|
"line": 92,
|
|
683
684
|
"character": 34
|
|
684
685
|
},
|
|
685
|
-
"name": "UiUI"
|
|
686
|
+
"name": "UiUI",
|
|
687
|
+
"componentId": {
|
|
688
|
+
"scope": "teambit.ui-foundation",
|
|
689
|
+
"name": "ui"
|
|
690
|
+
}
|
|
686
691
|
}
|
|
687
692
|
]
|
|
688
693
|
},
|
|
@@ -953,6 +958,7 @@
|
|
|
953
958
|
"character": 39
|
|
954
959
|
},
|
|
955
960
|
"name": "RefObject",
|
|
961
|
+
"packageName": "react",
|
|
956
962
|
"typeArgs": [
|
|
957
963
|
{
|
|
958
964
|
"__schema": "TypeRefSchema",
|
|
@@ -1096,7 +1102,8 @@
|
|
|
1096
1102
|
"line": 24,
|
|
1097
1103
|
"character": 39
|
|
1098
1104
|
},
|
|
1099
|
-
"name": "Callback"
|
|
1105
|
+
"name": "Callback",
|
|
1106
|
+
"internalFilePath": "types.ts"
|
|
1100
1107
|
},
|
|
1101
1108
|
"isOptional": false,
|
|
1102
1109
|
"isSpread": false
|
|
@@ -1555,7 +1562,11 @@
|
|
|
1555
1562
|
"line": 92,
|
|
1556
1563
|
"character": 34
|
|
1557
1564
|
},
|
|
1558
|
-
"name": "UiUI"
|
|
1565
|
+
"name": "UiUI",
|
|
1566
|
+
"componentId": {
|
|
1567
|
+
"scope": "teambit.ui-foundation",
|
|
1568
|
+
"name": "ui"
|
|
1569
|
+
}
|
|
1559
1570
|
}
|
|
1560
1571
|
]
|
|
1561
1572
|
},
|
|
@@ -1948,6 +1959,7 @@
|
|
|
1948
1959
|
"character": 39
|
|
1949
1960
|
},
|
|
1950
1961
|
"name": "RefObject",
|
|
1962
|
+
"packageName": "react",
|
|
1951
1963
|
"typeArgs": [
|
|
1952
1964
|
{
|
|
1953
1965
|
"__schema": "TypeRefSchema",
|
|
@@ -1984,7 +1996,7 @@
|
|
|
1984
1996
|
"componentId": {
|
|
1985
1997
|
"scope": "teambit.harmony",
|
|
1986
1998
|
"name": "pubsub",
|
|
1987
|
-
"version": "1.0.
|
|
1999
|
+
"version": "1.0.229"
|
|
1988
2000
|
},
|
|
1989
2001
|
"taggedModuleExports": []
|
|
1990
2002
|
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { PubsubAspect, PubsubAspect as default } from './pubsub.aspect';
|
|
2
|
+
export type { PubsubMain } from './pubsub.main.runtime';
|
|
3
|
+
export type { PubsubPreview } from './pubsub.preview.runtime';
|
|
4
|
+
export type { PubsubUI } from './pubsub.ui.runtime';
|
|
5
|
+
export { BitBaseEvent } from './bit-base-event';
|
|
6
|
+
export type { PubSubRegistry } from './pubsub-context';
|
|
7
|
+
export { usePubSub, usePubSubIframe } from './pubsub-context';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_pubsub@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_pubsub@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_pubsub@1.0.229/dist/pubsub.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_pubsub@1.0.229/dist/pubsub.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { RefObject, ReactNode } from 'react';
|
|
2
|
+
export interface PubSubRegistry {
|
|
3
|
+
/**
|
|
4
|
+
* starts a connection to an iframe child.
|
|
5
|
+
* Returns a destroy() function that will break the connection.
|
|
6
|
+
*/
|
|
7
|
+
connect(ref: HTMLIFrameElement): () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const pubsubRegistry: React.Context<PubSubRegistry | undefined>;
|
|
10
|
+
export declare function createProvider(pubSubContext: PubSubRegistry): ({ children }: {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function usePubSub(): PubSubRegistry | undefined;
|
|
14
|
+
export declare function usePubSubIframe(ref?: RefObject<HTMLIFrameElement>): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Logo: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BitBaseEvent } from './bit-base-event';
|
|
2
|
+
export declare class PubsubMain {
|
|
3
|
+
private topicMap;
|
|
4
|
+
private createOrGetTopic;
|
|
5
|
+
sub(topicUUID: any, callback: any): void;
|
|
6
|
+
pub(topicUUID: any, event: BitBaseEvent<any>): void;
|
|
7
|
+
unsubscribeAll(topicId: string): void;
|
|
8
|
+
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
9
|
+
static provider(): Promise<PubsubMain>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Please Notice: This file will run in the preview iframe.
|
|
3
|
+
*/
|
|
4
|
+
import { BitBaseEvent } from './bit-base-event';
|
|
5
|
+
import { Callback } from './types';
|
|
6
|
+
export declare class PubsubPreview {
|
|
7
|
+
private _parentPubsub?;
|
|
8
|
+
private events;
|
|
9
|
+
sub(topic: string, callback: Callback): () => void;
|
|
10
|
+
pub(topic: string, event: BitBaseEvent<any>): void;
|
|
11
|
+
private inIframe;
|
|
12
|
+
private connectToParentPubSub;
|
|
13
|
+
private handleMessageFromParent;
|
|
14
|
+
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
15
|
+
static provider(): Promise<PubsubPreview>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { UiUI } from '@teambit/ui';
|
|
3
|
+
import { BitBaseEvent } from './bit-base-event';
|
|
4
|
+
import { Callback } from './types';
|
|
5
|
+
type PubOptions = {
|
|
6
|
+
/** forward the event to adjacent windows (including the preview iframe) */
|
|
7
|
+
propagate?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare class PubsubUI {
|
|
10
|
+
private childApi?;
|
|
11
|
+
private events;
|
|
12
|
+
/**
|
|
13
|
+
* subscribe to events
|
|
14
|
+
*/
|
|
15
|
+
sub: (topic: string, callback: Callback) => () => void;
|
|
16
|
+
/**
|
|
17
|
+
* publish event to all subscribers, including nested iframes.
|
|
18
|
+
*/
|
|
19
|
+
pub: (topic: string, event: BitBaseEvent<any>, { propagate }?: PubOptions) => void;
|
|
20
|
+
private connectToIframe;
|
|
21
|
+
getPubSubContext(): ({ children }: {
|
|
22
|
+
children: import("react").ReactNode;
|
|
23
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
/**
|
|
25
|
+
* publish event to all subscribers in this window
|
|
26
|
+
*/
|
|
27
|
+
private emitEvent;
|
|
28
|
+
/**
|
|
29
|
+
* publish event to nested iframes
|
|
30
|
+
*/
|
|
31
|
+
private pubToChild;
|
|
32
|
+
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
33
|
+
static dependencies: import("@teambit/harmony").Aspect[];
|
|
34
|
+
static provider([uiUI]: [UiUI]): Promise<PubsubUI>;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
package/dist/types.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/pubsub",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.229",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/harmony/pubsub",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.harmony",
|
|
8
8
|
"name": "pubsub",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.229"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"eventemitter2": "6.4.4",
|
|
13
13
|
"penpal": "6.2.2",
|
|
14
14
|
"@teambit/harmony": "0.4.6",
|
|
15
|
-
"@teambit/cli": "0.0.
|
|
16
|
-
"@teambit/ui": "1.0.
|
|
15
|
+
"@teambit/cli": "0.0.862",
|
|
16
|
+
"@teambit/ui": "1.0.229"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/mocha": "9.1.0",
|
|
20
20
|
"chai": "4.3.0",
|
|
21
21
|
"@teambit/ui-foundation.ui.is-browser": "0.0.500",
|
|
22
|
-
"@teambit/harmony.envs.core-aspect-env": "0.0.
|
|
23
|
-
"@teambit/preview": "1.0.
|
|
22
|
+
"@teambit/harmony.envs.core-aspect-env": "0.0.33",
|
|
23
|
+
"@teambit/preview": "1.0.229"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"react": "^17.0.0 || ^18.0.0",
|
package/tsconfig.json
CHANGED
|
@@ -20,8 +20,7 @@
|
|
|
20
20
|
"emitDeclarationOnly": true,
|
|
21
21
|
"strict": true,
|
|
22
22
|
"strictPropertyInitialization": false,
|
|
23
|
-
"noImplicitAny": false
|
|
24
|
-
"composite": true
|
|
23
|
+
"noImplicitAny": false
|
|
25
24
|
},
|
|
26
25
|
"exclude": [
|
|
27
26
|
"artifacts",
|
|
@@ -36,16 +35,5 @@
|
|
|
36
35
|
"include": [
|
|
37
36
|
"**/*",
|
|
38
37
|
"**/*.json"
|
|
39
|
-
],
|
|
40
|
-
"references": [
|
|
41
|
-
{
|
|
42
|
-
"path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_cli@0.0.860"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.ui-foundation_ui@1.0.227"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.preview_preview@1.0.227"
|
|
49
|
-
}
|
|
50
38
|
]
|
|
51
39
|
}
|