@teambit/ui 1.0.1212 → 1.0.1214
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/ui-bundle/public/bit/asset-manifest.json +6 -6
- package/artifacts/ui-bundle/public/bit/scope.html +1 -1
- package/artifacts/ui-bundle/public/bit/service-worker.js +1 -1
- package/artifacts/ui-bundle/public/bit/ssr/index.js +6 -6
- package/artifacts/ui-bundle/public/bit/static/css/{528.61ff347f.css → 528.0133ac1e.css} +1 -1
- package/artifacts/ui-bundle/public/bit/static/js/{528.fb38fc7c.js → 528.c5605292.js} +26 -26
- package/artifacts/ui-bundle/public/bit/workspace.html +1 -1
- package/dist/{preview-1791563417062.js → preview-1791624541512.js} +2 -2
- package/dist/ui.ui.runtime.d.ts +7 -2
- package/dist/ui.ui.runtime.js +19 -11
- package/dist/ui.ui.runtime.js.map +1 -1
- package/package.json +18 -18
- package/ui.ui.runtime.tsx +14 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><title>bit</title><script>!function(){try{var e=null,t=new URL(window.location.href).searchParams.get("theme");if(t&&(e=t),!e)try{e=sessionStorage.getItem("workspace-theme")}catch(e){}if(!e)try{e=localStorage.getItem("workspace-theme")}catch(e){}"dark"===e?(document.documentElement.dataset.theme="dark",document.documentElement.style.backgroundColor="#060414"):"light"===e&&(document.documentElement.dataset.theme="light",document.documentElement.style.backgroundColor="#fdfdff")}catch(e){}}();try{window.__REACT_DEVTOOLS_GLOBAL_HOOK__=window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__}catch{}</script><script defer src="/static/js/runtime-workspace.8653589e.js"></script><script defer src="/static/js/528.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1.0"><title>bit</title><script>!function(){try{var e=null,t=new URL(window.location.href).searchParams.get("theme");if(t&&(e=t),!e)try{e=sessionStorage.getItem("workspace-theme")}catch(e){}if(!e)try{e=localStorage.getItem("workspace-theme")}catch(e){}"dark"===e?(document.documentElement.dataset.theme="dark",document.documentElement.style.backgroundColor="#060414"):"light"===e&&(document.documentElement.dataset.theme="light",document.documentElement.style.backgroundColor="#fdfdff")}catch(e){}}();try{window.__REACT_DEVTOOLS_GLOBAL_HOOK__=window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__}catch{}</script><script defer src="/static/js/runtime-workspace.8653589e.js"></script><script defer src="/static/js/528.c5605292.js"></script><script defer src="/static/js/83.cf263ce5.js"></script><script defer src="/static/js/workspace.f4d90629.js"></script><link href="/static/css/528.0133ac1e.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.ui-foundation_ui@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.ui-foundation_ui@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.ui-foundation_ui@1.0.1214/dist/ui.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.ui-foundation_ui@1.0.1214/dist/ui.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/dist/ui.ui.runtime.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { GraphqlUI } from '@teambit/graphql';
|
|
2
|
+
import type { PubsubUI } from '@teambit/pubsub';
|
|
2
3
|
import type { SlotRegistry } from '@teambit/harmony';
|
|
3
4
|
import type { ReactRouterUI } from '@teambit/react-router';
|
|
4
5
|
import type { SsrSession, RenderPlugin, ContextProps } from '@teambit/react.rendering.ssr';
|
|
@@ -23,6 +24,8 @@ export declare class UiUI {
|
|
|
23
24
|
private hudSlot;
|
|
24
25
|
/** hooks into the ssr render process */
|
|
25
26
|
private renderPluginsSlot;
|
|
27
|
+
/** render hooks of ui's own dependencies (graphql, pubsub), rendered before the registered ones */
|
|
28
|
+
private dependenciesRenderPlugins;
|
|
26
29
|
constructor(
|
|
27
30
|
/**
|
|
28
31
|
* react-router extension.
|
|
@@ -35,7 +38,9 @@ export declare class UiUI {
|
|
|
35
38
|
/** slot for overlay ui elements */
|
|
36
39
|
hudSlot: HudSlot,
|
|
37
40
|
/** hooks into the ssr render process */
|
|
38
|
-
renderPluginsSlot: RenderPluginsSlot
|
|
41
|
+
renderPluginsSlot: RenderPluginsSlot,
|
|
42
|
+
/** render hooks of ui's own dependencies (graphql, pubsub), rendered before the registered ones */
|
|
43
|
+
dependenciesRenderPlugins: RenderPlugin<any, any>[]);
|
|
39
44
|
/** render and rehydrate client-side */
|
|
40
45
|
render(rootExtension: string): Promise<void>;
|
|
41
46
|
/** render dehydrated server-side */
|
|
@@ -54,6 +59,6 @@ export declare class UiUI {
|
|
|
54
59
|
static slots: (((registerFn: () => string) => SlotRegistry<RenderPlugin<unknown, unknown>>) | ((registerFn: () => string) => SlotRegistry<UIRootFactory>) | ((registerFn: () => string) => SlotRegistry<ReactNode>))[];
|
|
55
60
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
56
61
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
57
|
-
static provider([GraphqlUi, router]: [GraphqlUI, ReactRouterUI], config: any, [uiRootSlot, hudSlot, renderLifecycleSlot]: [UIRootRegistry, HudSlot, RenderPluginsSlot]): Promise<UiUI>;
|
|
62
|
+
static provider([GraphqlUi, router, pubsubUI]: [GraphqlUI, ReactRouterUI, PubsubUI], config: any, [uiRootSlot, hudSlot, renderLifecycleSlot]: [UIRootRegistry, HudSlot, RenderPluginsSlot]): Promise<UiUI>;
|
|
58
63
|
}
|
|
59
64
|
export {};
|
package/dist/ui.ui.runtime.js
CHANGED
|
@@ -11,6 +11,13 @@ function _graphql() {
|
|
|
11
11
|
};
|
|
12
12
|
return data;
|
|
13
13
|
}
|
|
14
|
+
function _pubsub() {
|
|
15
|
+
const data = require("@teambit/pubsub");
|
|
16
|
+
_pubsub = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
14
21
|
function _harmony() {
|
|
15
22
|
const data = require("@teambit/harmony");
|
|
16
23
|
_harmony = function () {
|
|
@@ -80,11 +87,13 @@ class UiUI {
|
|
|
80
87
|
*/
|
|
81
88
|
uiRootSlot, /** slot for overlay ui elements */
|
|
82
89
|
hudSlot, /** hooks into the ssr render process */
|
|
83
|
-
renderPluginsSlot)
|
|
90
|
+
renderPluginsSlot, /** render hooks of ui's own dependencies (graphql, pubsub), rendered before the registered ones */
|
|
91
|
+
dependenciesRenderPlugins) {
|
|
84
92
|
this.router = router;
|
|
85
93
|
this.uiRootSlot = uiRootSlot;
|
|
86
94
|
this.hudSlot = hudSlot;
|
|
87
95
|
this.renderPluginsSlot = renderPluginsSlot;
|
|
96
|
+
this.dependenciesRenderPlugins = dependenciesRenderPlugins;
|
|
88
97
|
/** adds elements to the Heads Up Display */
|
|
89
98
|
_defineProperty(this, "registerHudItem", element => {
|
|
90
99
|
this.hudSlot.register(element);
|
|
@@ -143,7 +152,7 @@ class UiUI {
|
|
|
143
152
|
return this.renderPluginsSlot.register(plugin);
|
|
144
153
|
}
|
|
145
154
|
getLifecyclePlugins() {
|
|
146
|
-
const
|
|
155
|
+
const registeredPlugins = this.renderPluginsSlot.toArray().map(([key, plugin]) => {
|
|
147
156
|
if (plugin.key) return plugin;
|
|
148
157
|
|
|
149
158
|
// for backward compatibility
|
|
@@ -151,23 +160,22 @@ class UiUI {
|
|
|
151
160
|
key
|
|
152
161
|
});
|
|
153
162
|
});
|
|
154
|
-
|
|
155
|
-
// react-router should register its plugin, when we can reverse it's dependency to depend on Ui
|
|
156
|
-
lifecyclePlugins.unshift(this.router.renderPlugin);
|
|
157
|
-
return lifecyclePlugins;
|
|
163
|
+
return [this.router.renderPlugin, ...this.dependenciesRenderPlugins, ...registeredPlugins];
|
|
158
164
|
}
|
|
159
165
|
getRoot(rootExtension) {
|
|
160
166
|
return this.uiRootSlot.get(rootExtension);
|
|
161
167
|
}
|
|
162
|
-
static async provider([GraphqlUi, router], config, [uiRootSlot, hudSlot, renderLifecycleSlot]) {
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
|
|
168
|
+
static async provider([GraphqlUi, router, pubsubUI], config, [uiRootSlot, hudSlot, renderLifecycleSlot]) {
|
|
169
|
+
const dependenciesRenderPlugins = [GraphqlUi.renderPlugins, {
|
|
170
|
+
key: _pubsub().PubsubAspect.id,
|
|
171
|
+
reactContext: pubsubUI.getPubSubContext()
|
|
172
|
+
}];
|
|
173
|
+
return new UiUI(router, uiRootSlot, hudSlot, renderLifecycleSlot, dependenciesRenderPlugins);
|
|
166
174
|
}
|
|
167
175
|
}
|
|
168
176
|
exports.UiUI = UiUI;
|
|
169
177
|
_defineProperty(UiUI, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType()]);
|
|
170
|
-
_defineProperty(UiUI, "dependencies", [_graphql().GraphqlAspect, _reactRouter().ReactRouterAspect]);
|
|
178
|
+
_defineProperty(UiUI, "dependencies", [_graphql().GraphqlAspect, _reactRouter().ReactRouterAspect, _pubsub().PubsubAspect]);
|
|
171
179
|
_defineProperty(UiUI, "runtime", _ui().UIRuntime);
|
|
172
180
|
_ui().UIAspect.addRuntime(UiUI);
|
|
173
181
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_graphql","data","require","_harmony","_reactRouter","_reactRendering","_uiFoundationUiHooks","_react","_interopRequireDefault","_ui","_clientContext","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","UiUI","constructor","router","uiRootSlot","hudSlot","renderPluginsSlot","element","register","render","rootExtension","rootFactory","getRoot","Error","uiRoot","routes","renderRoutes","hudItems","values","lifecyclePlugins","getLifecyclePlugins","reactSsr","BrowserRenderer","undefined","createElement","ClientContext","renderSsr","ssrContent","ServerRenderer","fullHtml","SSRBrowserProvider","browser","registerContext","context","reactContext","registerRoot","registerRenderHooks","plugin","toArray","map","key","unshift","renderPlugin","get","provider","GraphqlUi","config","renderLifecycleSlot","uiUi","renderPlugins","exports","Slot","withType","GraphqlAspect","ReactRouterAspect","UIRuntime","UIAspect","addRuntime"],"sources":["ui.ui.runtime.tsx"],"sourcesContent":["import type { GraphqlUI } from '@teambit/graphql';\nimport { GraphqlAspect } from '@teambit/graphql';\nimport type { SlotRegistry } from '@teambit/harmony';\nimport { Slot } from '@teambit/harmony';\nimport type { ReactRouterUI } from '@teambit/react-router';\nimport { ReactRouterAspect } from '@teambit/react-router';\nimport { ServerRenderer, BrowserRenderer } from '@teambit/react.rendering.ssr';\nimport { SSRBrowserProvider } from '@teambit/ui-foundation.ui.hooks.use-user-agent';\nimport type { SsrSession, RenderPlugin, ContextProps } from '@teambit/react.rendering.ssr';\n\nimport type { ReactNode, ComponentType } from 'react';\nimport React from 'react';\n\nimport type { UIRootFactory } from './ui-root.ui';\nimport { UIAspect, UIRuntime } from './ui.aspect';\nimport { ClientContext } from './ui/client-context';\n\ntype HudSlot = SlotRegistry<ReactNode>;\ntype RenderPluginsSlot = SlotRegistry<RenderPlugin<any, any>>;\ntype UIRootRegistry = SlotRegistry<UIRootFactory>;\n\n/**\n * extension\n */\nexport class UiUI {\n constructor(\n /**\n * react-router extension.\n */\n private router: ReactRouterUI,\n /**\n * ui root registry.\n */\n private uiRootSlot: UIRootRegistry,\n /** slot for overlay ui elements */\n private hudSlot: HudSlot,\n /** hooks into the ssr render process */\n private renderPluginsSlot: RenderPluginsSlot\n ) {}\n\n /** render and rehydrate client-side */\n async render(rootExtension: string): Promise<void> {\n const rootFactory = this.getRoot(rootExtension);\n if (!rootFactory) throw new Error(`root: ${rootExtension} was not found`);\n const uiRoot = rootFactory();\n const routes = this.router.renderRoutes(uiRoot.routes);\n const hudItems = this.hudSlot.values();\n const lifecyclePlugins = this.getLifecyclePlugins();\n\n const reactSsr = new BrowserRenderer(lifecyclePlugins, undefined, rootExtension);\n await reactSsr.render(\n <ClientContext>\n {hudItems}\n {routes}\n </ClientContext>\n );\n }\n\n /** render dehydrated server-side */\n async renderSsr(rootExtension: string, ssrContent: SsrSession): Promise<string> {\n const rootFactory = this.getRoot(rootExtension);\n if (!rootFactory) throw new Error(`root: ${rootExtension} was not found`);\n\n const uiRoot = rootFactory();\n const routes = this.router.renderRoutes(uiRoot.routes);\n const hudItems = this.hudSlot.values();\n const lifecyclePlugins = this.getLifecyclePlugins();\n\n const reactSsr = new ServerRenderer(lifecyclePlugins);\n const fullHtml = await reactSsr.render(\n // `SSRBrowserProvider` wraps `ClientContext`, not the other way round. `useUserAgent` reads\n // this context and, finding nothing, falls back to `window.navigator` - which on the server\n // throws `ReferenceError: window is not defined` and takes the whole render down (the ssr\n // middleware then silently serves the empty client shell). Anything rendered outside this\n // provider is therefore a latent server crash, and `ClientContext` renders real UI of its\n // own - icons, the theme switcher, the loader ribbon, the tooltip mount point - so it has to\n // be inside. Nesting it the other way only appeared to work while nothing in that subtree\n // happened to call `useIsMobile`.\n <SSRBrowserProvider value={ssrContent.browser}>\n <ClientContext>\n {hudItems}\n {routes}\n </ClientContext>\n </SSRBrowserProvider>,\n ssrContent\n );\n\n return fullHtml;\n }\n\n /** adds elements to the Heads Up Display */\n registerHudItem = (element: ReactNode) => {\n this.hudSlot.register(element);\n };\n\n /**\n * adds global context at the ui root\n * @deprecated replace with `.registerRenderHooks({ reactContext })`.\n */\n registerContext<T>(context: ComponentType<ContextProps<T>>) {\n this.renderPluginsSlot.register({ reactContext: context });\n }\n\n registerRoot(uiRoot: UIRootFactory) {\n return this.uiRootSlot.register(uiRoot);\n }\n\n registerRenderHooks<T, Y>(plugin: RenderPlugin<T, Y>) {\n return this.renderPluginsSlot.register(plugin);\n }\n\n private getLifecyclePlugins() {\n const lifecyclePlugins = this.renderPluginsSlot.toArray().map(([key, plugin]) => {\n if (plugin.key) return plugin;\n\n // for backward compatibility\n return { ...plugin, key };\n });\n\n // react-router should register its plugin, when we can reverse it's dependency to depend on Ui\n lifecyclePlugins.unshift(this.router.renderPlugin);\n\n return lifecyclePlugins;\n }\n\n private getRoot(rootExtension: string) {\n return this.uiRootSlot.get(rootExtension);\n }\n\n static slots = [Slot.withType<UIRootFactory>(), Slot.withType<ReactNode>(), Slot.withType<RenderPlugin>()];\n\n static dependencies = [GraphqlAspect, ReactRouterAspect];\n\n static runtime = UIRuntime;\n\n static async provider(\n [GraphqlUi, router]: [GraphqlUI, ReactRouterUI],\n config,\n [uiRootSlot, hudSlot, renderLifecycleSlot]: [UIRootRegistry, HudSlot, RenderPluginsSlot]\n ) {\n const uiUi = new UiUI(router, uiRootSlot, hudSlot, renderLifecycleSlot);\n\n if (GraphqlUi) uiUi.registerRenderHooks(GraphqlUi.renderPlugins);\n\n return uiUi;\n }\n}\n\nUIAspect.addRuntime(UiUI);\n"],"mappings":";;;;;;AACA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,gBAAA;EAAA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AAiB,CAACgC,OAAO,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAACC,GAAG,EAAEH,MAAM,CAAC,KAAK;MAC/E,IAAIA,MAAM,CAACG,GAAG,EAAE,OAAOH,MAAM;;MAE7B;MACA,OAAAxD,aAAA,CAAAA,aAAA,KAAYwD,MAAM;QAAEG;MAAG;IACzB,CAAC,CAAC;;IAEF;IACArB,gBAAgB,CAACsB,OAAO,CAAC,IAAI,CAACtC,MAAM,CAACuC,YAAY,CAAC;IAElD,OAAOvB,gBAAgB;EACzB;EAEQP,OAAOA,CAACF,aAAqB,EAAE;IACrC,OAAO,IAAI,CAACN,UAAU,CAACuC,GAAG,CAACjC,aAAa,CAAC;EAC3C;EAQA,aAAakC,QAAQA,CACnB,CAACC,SAAS,EAAE1C,MAAM,CAA6B,EAC/C2C,MAAM,EACN,CAAC1C,UAAU,EAAEC,OAAO,EAAE0C,mBAAmB,CAA+C,EACxF;IACA,MAAMC,IAAI,GAAG,IAAI/C,IAAI,CAACE,MAAM,EAAEC,UAAU,EAAEC,OAAO,EAAE0C,mBAAmB,CAAC;IAEvE,IAAIF,SAAS,EAAEG,IAAI,CAACZ,mBAAmB,CAACS,SAAS,CAACI,aAAa,CAAC;IAEhE,OAAOD,IAAI;EACb;AACF;AAACE,OAAA,CAAAjD,IAAA,GAAAA,IAAA;AAAAhB,eAAA,CA1HYgB,IAAI,WAyGA,CAACkD,eAAI,CAACC,QAAQ,CAAgB,CAAC,EAAED,eAAI,CAACC,QAAQ,CAAY,CAAC,EAAED,eAAI,CAACC,QAAQ,CAAe,CAAC,CAAC;AAAAnE,eAAA,CAzG/FgB,IAAI,kBA2GO,CAACoD,wBAAa,EAAEC,gCAAiB,CAAC;AAAArE,eAAA,CA3G7CgB,IAAI,aA6GEsD,eAAS;AAe5BC,cAAQ,CAACC,UAAU,CAACxD,IAAI,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_graphql","data","require","_pubsub","_harmony","_reactRouter","_reactRendering","_uiFoundationUiHooks","_react","_interopRequireDefault","_ui","_clientContext","e","__esModule","default","ownKeys","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","UiUI","constructor","router","uiRootSlot","hudSlot","renderPluginsSlot","dependenciesRenderPlugins","element","register","render","rootExtension","rootFactory","getRoot","Error","uiRoot","routes","renderRoutes","hudItems","values","lifecyclePlugins","getLifecyclePlugins","reactSsr","BrowserRenderer","undefined","createElement","ClientContext","renderSsr","ssrContent","ServerRenderer","fullHtml","SSRBrowserProvider","browser","registerContext","context","reactContext","registerRoot","registerRenderHooks","plugin","registeredPlugins","toArray","map","key","renderPlugin","get","provider","GraphqlUi","pubsubUI","config","renderLifecycleSlot","renderPlugins","PubsubAspect","id","getPubSubContext","exports","Slot","withType","GraphqlAspect","ReactRouterAspect","UIRuntime","UIAspect","addRuntime"],"sources":["ui.ui.runtime.tsx"],"sourcesContent":["import type { GraphqlUI } from '@teambit/graphql';\nimport { GraphqlAspect } from '@teambit/graphql';\nimport type { PubsubUI } from '@teambit/pubsub';\nimport { PubsubAspect } from '@teambit/pubsub';\nimport type { SlotRegistry } from '@teambit/harmony';\nimport { Slot } from '@teambit/harmony';\nimport type { ReactRouterUI } from '@teambit/react-router';\nimport { ReactRouterAspect } from '@teambit/react-router';\nimport { ServerRenderer, BrowserRenderer } from '@teambit/react.rendering.ssr';\nimport { SSRBrowserProvider } from '@teambit/ui-foundation.ui.hooks.use-user-agent';\nimport type { SsrSession, RenderPlugin, ContextProps } from '@teambit/react.rendering.ssr';\n\nimport type { ReactNode, ComponentType } from 'react';\nimport React from 'react';\n\nimport type { UIRootFactory } from './ui-root.ui';\nimport { UIAspect, UIRuntime } from './ui.aspect';\nimport { ClientContext } from './ui/client-context';\n\ntype HudSlot = SlotRegistry<ReactNode>;\ntype RenderPluginsSlot = SlotRegistry<RenderPlugin<any, any>>;\ntype UIRootRegistry = SlotRegistry<UIRootFactory>;\n\n/**\n * extension\n */\nexport class UiUI {\n constructor(\n /**\n * react-router extension.\n */\n private router: ReactRouterUI,\n /**\n * ui root registry.\n */\n private uiRootSlot: UIRootRegistry,\n /** slot for overlay ui elements */\n private hudSlot: HudSlot,\n /** hooks into the ssr render process */\n private renderPluginsSlot: RenderPluginsSlot,\n /** render hooks of ui's own dependencies (graphql, pubsub), rendered before the registered ones */\n private dependenciesRenderPlugins: RenderPlugin<any, any>[]\n ) {}\n\n /** render and rehydrate client-side */\n async render(rootExtension: string): Promise<void> {\n const rootFactory = this.getRoot(rootExtension);\n if (!rootFactory) throw new Error(`root: ${rootExtension} was not found`);\n const uiRoot = rootFactory();\n const routes = this.router.renderRoutes(uiRoot.routes);\n const hudItems = this.hudSlot.values();\n const lifecyclePlugins = this.getLifecyclePlugins();\n\n const reactSsr = new BrowserRenderer(lifecyclePlugins, undefined, rootExtension);\n await reactSsr.render(\n <ClientContext>\n {hudItems}\n {routes}\n </ClientContext>\n );\n }\n\n /** render dehydrated server-side */\n async renderSsr(rootExtension: string, ssrContent: SsrSession): Promise<string> {\n const rootFactory = this.getRoot(rootExtension);\n if (!rootFactory) throw new Error(`root: ${rootExtension} was not found`);\n\n const uiRoot = rootFactory();\n const routes = this.router.renderRoutes(uiRoot.routes);\n const hudItems = this.hudSlot.values();\n const lifecyclePlugins = this.getLifecyclePlugins();\n\n const reactSsr = new ServerRenderer(lifecyclePlugins);\n const fullHtml = await reactSsr.render(\n // `SSRBrowserProvider` wraps `ClientContext`, not the other way round. `useUserAgent` reads\n // this context and, finding nothing, falls back to `window.navigator` - which on the server\n // throws `ReferenceError: window is not defined` and takes the whole render down (the ssr\n // middleware then silently serves the empty client shell). Anything rendered outside this\n // provider is therefore a latent server crash, and `ClientContext` renders real UI of its\n // own - icons, the theme switcher, the loader ribbon, the tooltip mount point - so it has to\n // be inside. Nesting it the other way only appeared to work while nothing in that subtree\n // happened to call `useIsMobile`.\n <SSRBrowserProvider value={ssrContent.browser}>\n <ClientContext>\n {hudItems}\n {routes}\n </ClientContext>\n </SSRBrowserProvider>,\n ssrContent\n );\n\n return fullHtml;\n }\n\n /** adds elements to the Heads Up Display */\n registerHudItem = (element: ReactNode) => {\n this.hudSlot.register(element);\n };\n\n /**\n * adds global context at the ui root\n * @deprecated replace with `.registerRenderHooks({ reactContext })`.\n */\n registerContext<T>(context: ComponentType<ContextProps<T>>) {\n this.renderPluginsSlot.register({ reactContext: context });\n }\n\n registerRoot(uiRoot: UIRootFactory) {\n return this.uiRootSlot.register(uiRoot);\n }\n\n registerRenderHooks<T, Y>(plugin: RenderPlugin<T, Y>) {\n return this.renderPluginsSlot.register(plugin);\n }\n\n private getLifecyclePlugins() {\n const registeredPlugins = this.renderPluginsSlot.toArray().map(([key, plugin]) => {\n if (plugin.key) return plugin;\n\n // for backward compatibility\n return { ...plugin, key };\n });\n\n return [this.router.renderPlugin, ...this.dependenciesRenderPlugins, ...registeredPlugins];\n }\n\n private getRoot(rootExtension: string) {\n return this.uiRootSlot.get(rootExtension);\n }\n\n static slots = [Slot.withType<UIRootFactory>(), Slot.withType<ReactNode>(), Slot.withType<RenderPlugin>()];\n\n static dependencies = [GraphqlAspect, ReactRouterAspect, PubsubAspect];\n\n static runtime = UIRuntime;\n\n static async provider(\n [GraphqlUi, router, pubsubUI]: [GraphqlUI, ReactRouterUI, PubsubUI],\n config,\n [uiRootSlot, hudSlot, renderLifecycleSlot]: [UIRootRegistry, HudSlot, RenderPluginsSlot]\n ) {\n const dependenciesRenderPlugins = [\n GraphqlUi.renderPlugins,\n { key: PubsubAspect.id, reactContext: pubsubUI.getPubSubContext() },\n ];\n return new UiUI(router, uiRootSlot, hudSlot, renderLifecycleSlot, dependenciesRenderPlugins);\n }\n}\n\nUIAspect.addRuntime(UiUI);\n"],"mappings":";;;;;;AACA,SAAAA,SAAA;EAAA,MA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AAa,EACvB;MAAER,GAAG,EAAES,sBAAY,CAACC,EAAE;MAAEjB,YAAY,EAAEY,QAAQ,CAACM,gBAAgB,CAAC;IAAE,CAAC,CACpE;IACD,OAAO,IAAIpD,IAAI,CAACE,MAAM,EAAEC,UAAU,EAAEC,OAAO,EAAE4C,mBAAmB,EAAE1C,yBAAyB,CAAC;EAC9F;AACF;AAAC+C,OAAA,CAAArD,IAAA,GAAAA,IAAA;AAAAhB,eAAA,CAzHYgB,IAAI,WAwGA,CAACsD,eAAI,CAACC,QAAQ,CAAgB,CAAC,EAAED,eAAI,CAACC,QAAQ,CAAY,CAAC,EAAED,eAAI,CAACC,QAAQ,CAAe,CAAC,CAAC;AAAAvE,eAAA,CAxG/FgB,IAAI,kBA0GO,CAACwD,wBAAa,EAAEC,gCAAiB,EAAEP,sBAAY,CAAC;AAAAlE,eAAA,CA1G3DgB,IAAI,aA4GE0D,eAAS;AAe5BC,cAAQ,CAACC,UAAU,CAAC5D,IAAI,CAAC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1214",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/ui-foundation/ui",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.ui-foundation",
|
|
8
8
|
"name": "ui",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.1214"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"p-map-series": "2.1.0",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"@teambit/react.rendering.ssr": "1.0.5",
|
|
41
41
|
"@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.512",
|
|
42
42
|
"@teambit/bit-error": "0.0.404",
|
|
43
|
+
"@teambit/cli": "0.0.1412",
|
|
43
44
|
"@teambit/legacy.constants": "0.0.49",
|
|
44
45
|
"@teambit/express": "0.0.1504",
|
|
45
46
|
"@teambit/graphql": "1.0.1205",
|
|
@@ -49,18 +50,10 @@
|
|
|
49
50
|
"@teambit/harmony": "0.4.12",
|
|
50
51
|
"@teambit/cache": "0.0.1498",
|
|
51
52
|
"@teambit/harmony.modules.harmony-root-generator": "0.0.49",
|
|
53
|
+
"@teambit/pubsub": "1.0.1213",
|
|
52
54
|
"@teambit/toolbox.crypto.sha1": "0.0.24",
|
|
53
55
|
"@teambit/react-router": "1.0.1205",
|
|
54
56
|
"@teambit/ui-foundation.ui.hooks.use-user-agent": "0.0.200",
|
|
55
|
-
"@teambit/base-ui.loaders.loader-ribbon": "1.0.0",
|
|
56
|
-
"@teambit/base-ui.theme.fonts.roboto": "1.0.0",
|
|
57
|
-
"@teambit/design.theme.icons-font": "2.0.29",
|
|
58
|
-
"@teambit/design.ui.tooltip": "0.0.389",
|
|
59
|
-
"@teambit/ui-foundation.ui.global-loader": "0.0.502",
|
|
60
|
-
"@teambit/base-react.themes.theme-switcher": "1.1.2",
|
|
61
|
-
"@teambit/design.themes.base-theme": "0.1.60",
|
|
62
|
-
"@teambit/design.themes.dark-theme": "1.91.64",
|
|
63
|
-
"@teambit/design.themes.light-theme": "0.1.61",
|
|
64
57
|
"@teambit/api-reference.hooks.use-api-renderers": "0.0.39",
|
|
65
58
|
"@teambit/api-reference.hooks.use-api": "0.0.59",
|
|
66
59
|
"@teambit/base-ui.graph.tree.recursive-tree": "1.0.5",
|
|
@@ -72,13 +65,20 @@
|
|
|
72
65
|
"@teambit/semantics.entities.semantic-schema": "0.0.120",
|
|
73
66
|
"@teambit/webpack.modules.exclude-node-modules-js": "0.0.1",
|
|
74
67
|
"@teambit/webpack.modules.style-regexps": "1.0.37",
|
|
75
|
-
"@teambit/
|
|
76
|
-
"@teambit/
|
|
77
|
-
"@teambit/
|
|
78
|
-
"@teambit/
|
|
79
|
-
"@teambit/
|
|
80
|
-
"@teambit/
|
|
81
|
-
"@teambit/
|
|
68
|
+
"@teambit/base-ui.loaders.loader-ribbon": "1.0.0",
|
|
69
|
+
"@teambit/base-ui.theme.fonts.roboto": "1.0.0",
|
|
70
|
+
"@teambit/design.theme.icons-font": "2.0.29",
|
|
71
|
+
"@teambit/design.ui.tooltip": "0.0.389",
|
|
72
|
+
"@teambit/ui-foundation.ui.global-loader": "0.0.502",
|
|
73
|
+
"@teambit/base-react.themes.theme-switcher": "1.1.2",
|
|
74
|
+
"@teambit/design.themes.base-theme": "0.1.60",
|
|
75
|
+
"@teambit/design.themes.dark-theme": "1.91.64",
|
|
76
|
+
"@teambit/design.themes.light-theme": "0.1.61",
|
|
77
|
+
"@teambit/builder": "1.0.1214",
|
|
78
|
+
"@teambit/isolator": "1.0.1214",
|
|
79
|
+
"@teambit/aspect-loader": "1.0.1214",
|
|
80
|
+
"@teambit/bundler": "1.0.1214",
|
|
81
|
+
"@teambit/component": "1.0.1214"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@types/express": "^4.17.21",
|
package/ui.ui.runtime.tsx
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { GraphqlUI } from '@teambit/graphql';
|
|
2
2
|
import { GraphqlAspect } from '@teambit/graphql';
|
|
3
|
+
import type { PubsubUI } from '@teambit/pubsub';
|
|
4
|
+
import { PubsubAspect } from '@teambit/pubsub';
|
|
3
5
|
import type { SlotRegistry } from '@teambit/harmony';
|
|
4
6
|
import { Slot } from '@teambit/harmony';
|
|
5
7
|
import type { ReactRouterUI } from '@teambit/react-router';
|
|
@@ -35,7 +37,9 @@ export class UiUI {
|
|
|
35
37
|
/** slot for overlay ui elements */
|
|
36
38
|
private hudSlot: HudSlot,
|
|
37
39
|
/** hooks into the ssr render process */
|
|
38
|
-
private renderPluginsSlot: RenderPluginsSlot
|
|
40
|
+
private renderPluginsSlot: RenderPluginsSlot,
|
|
41
|
+
/** render hooks of ui's own dependencies (graphql, pubsub), rendered before the registered ones */
|
|
42
|
+
private dependenciesRenderPlugins: RenderPlugin<any, any>[]
|
|
39
43
|
) {}
|
|
40
44
|
|
|
41
45
|
/** render and rehydrate client-side */
|
|
@@ -110,17 +114,14 @@ export class UiUI {
|
|
|
110
114
|
}
|
|
111
115
|
|
|
112
116
|
private getLifecyclePlugins() {
|
|
113
|
-
const
|
|
117
|
+
const registeredPlugins = this.renderPluginsSlot.toArray().map(([key, plugin]) => {
|
|
114
118
|
if (plugin.key) return plugin;
|
|
115
119
|
|
|
116
120
|
// for backward compatibility
|
|
117
121
|
return { ...plugin, key };
|
|
118
122
|
});
|
|
119
123
|
|
|
120
|
-
|
|
121
|
-
lifecyclePlugins.unshift(this.router.renderPlugin);
|
|
122
|
-
|
|
123
|
-
return lifecyclePlugins;
|
|
124
|
+
return [this.router.renderPlugin, ...this.dependenciesRenderPlugins, ...registeredPlugins];
|
|
124
125
|
}
|
|
125
126
|
|
|
126
127
|
private getRoot(rootExtension: string) {
|
|
@@ -129,20 +130,20 @@ export class UiUI {
|
|
|
129
130
|
|
|
130
131
|
static slots = [Slot.withType<UIRootFactory>(), Slot.withType<ReactNode>(), Slot.withType<RenderPlugin>()];
|
|
131
132
|
|
|
132
|
-
static dependencies = [GraphqlAspect, ReactRouterAspect];
|
|
133
|
+
static dependencies = [GraphqlAspect, ReactRouterAspect, PubsubAspect];
|
|
133
134
|
|
|
134
135
|
static runtime = UIRuntime;
|
|
135
136
|
|
|
136
137
|
static async provider(
|
|
137
|
-
[GraphqlUi, router]: [GraphqlUI, ReactRouterUI],
|
|
138
|
+
[GraphqlUi, router, pubsubUI]: [GraphqlUI, ReactRouterUI, PubsubUI],
|
|
138
139
|
config,
|
|
139
140
|
[uiRootSlot, hudSlot, renderLifecycleSlot]: [UIRootRegistry, HudSlot, RenderPluginsSlot]
|
|
140
141
|
) {
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
return
|
|
142
|
+
const dependenciesRenderPlugins = [
|
|
143
|
+
GraphqlUi.renderPlugins,
|
|
144
|
+
{ key: PubsubAspect.id, reactContext: pubsubUI.getPubSubContext() },
|
|
145
|
+
];
|
|
146
|
+
return new UiUI(router, uiRootSlot, hudSlot, renderLifecycleSlot, dependenciesRenderPlugins);
|
|
146
147
|
}
|
|
147
148
|
}
|
|
148
149
|
|