@teambit/ui 0.0.551 → 0.0.556

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.
Files changed (53) hide show
  1. package/dist/compose.d.ts +5 -0
  2. package/dist/open-browser.d.ts +4 -0
  3. package/dist/render-lifecycle.d.ts +31 -0
  4. package/dist/ssr/request-browser.d.ts +35 -0
  5. package/dist/ssr/request-server.d.ts +3 -0
  6. package/dist/start-plugin.d.ts +7 -0
  7. package/dist/start.cmd.d.ts +8 -1
  8. package/dist/ui-build.cmd.d.ts +8 -1
  9. package/dist/ui-root.d.ts +24 -0
  10. package/dist/ui-server.d.ts +14 -0
  11. package/dist/ui.main.runtime.d.ts +141 -1
  12. package/dist/ui.ui.runtime.d.ts +31 -1
  13. package/dist/webpack/html.d.ts +1 -0
  14. package/package.json +30 -24
  15. package/compose.tsx +0 -27
  16. package/create-root.ts +0 -94
  17. package/events/index.ts +0 -1
  18. package/events/ui-server-started-event.ts +0 -14
  19. package/exceptions/index.ts +0 -2
  20. package/exceptions/unknown-build-error.ts +0 -5
  21. package/exceptions/unknown-ui.ts +0 -9
  22. package/index.ts +0 -18
  23. package/open-browser.ts +0 -128
  24. package/package-tar/teambit-ui-0.0.551.tgz +0 -0
  25. package/render-lifecycle.tsx +0 -56
  26. package/ssr/render-middleware.ts +0 -129
  27. package/ssr/request-browser.ts +0 -86
  28. package/ssr/request-server.ts +0 -10
  29. package/ssr/ssr-content.ts +0 -9
  30. package/start-plugin.ts +0 -25
  31. package/start.cmd.tsx +0 -93
  32. package/tsconfig.json +0 -35
  33. package/types/asset.d.ts +0 -29
  34. package/types/style.d.ts +0 -42
  35. package/ui/client-context.module.scss +0 -4
  36. package/ui/client-context.tsx +0 -28
  37. package/ui-build.cmd.tsx +0 -27
  38. package/ui-root.tsx +0 -59
  39. package/ui-root.ui.ts +0 -7
  40. package/ui-server.ts +0 -249
  41. package/ui.aspect.ts +0 -10
  42. package/ui.cli.rt.tsx +0 -10
  43. package/ui.docs.md +0 -118
  44. package/ui.main.runtime.ts +0 -573
  45. package/ui.route.ts +0 -0
  46. package/ui.runtime.ts +0 -21
  47. package/ui.ui.runtime.tsx +0 -277
  48. package/webpack/html.ts +0 -24
  49. package/webpack/postcss.config.ts +0 -22
  50. package/webpack/webpack.base.config.ts +0 -392
  51. package/webpack/webpack.browser.config.ts +0 -125
  52. package/webpack/webpack.dev.config.ts +0 -336
  53. package/webpack/webpack.ssr.config.ts +0 -38
package/dist/compose.d.ts CHANGED
@@ -2,8 +2,13 @@ import { ReactNode, ComponentType } from 'react';
2
2
  declare type ComponentTuple<T = any> = [Component: ComponentType<T>, props?: T];
3
3
  export declare type Wrapper<T = any> = ComponentType<T> | ComponentTuple<T>;
4
4
  interface Props<T = any> {
5
+ /** Compose these components. Can be a ReactComponent, or a [ReactComponent, Props] tuple */
5
6
  components: Wrapper<T>[];
6
7
  children?: ReactNode;
7
8
  }
9
+ /**
10
+ * A react Component composer. equivalent to `(n+1) => <a[n+1]> <Compose(a[n]) /> </a[n+1]>`.
11
+ * Component can be a React Component, or a `[Component, { ...props }]` tuple.
12
+ */
8
13
  export declare function Compose(props: Props): JSX.Element;
9
14
  export {};
@@ -8,6 +8,10 @@ export declare class OpenBrowser {
8
8
  BROWSER: number;
9
9
  SCRIPT: number;
10
10
  }>;
11
+ /**
12
+ * Reads the BROWSER environment variable and decides what to do with it. Returns
13
+ * true if it opened a browser or ran a node.js script, otherwise false.
14
+ */
11
15
  open(url: string): boolean;
12
16
  private getBrowserEnv;
13
17
  private executeNodeScript;
@@ -3,19 +3,50 @@ import { BrowserData } from './ssr/request-browser';
3
3
  import { RequestServer } from './ssr/request-server';
4
4
  import { ContextProps } from './ui.ui.runtime';
5
5
  export declare type RenderLifecycle<RenderCtx = any, Serialized = any> = {
6
+ /**
7
+ * Initialize a context state for this specific rendering.
8
+ * Context state will only be available to the current Aspect, in the other hooks, as well as a prop to the react context component.
9
+ */
6
10
  serverInit?: (state: {
7
11
  browser?: BrowserData;
8
12
  server?: RequestServer;
9
13
  }) => RenderCtx | void | undefined | Promise<RenderCtx | void | undefined>;
14
+ /**
15
+ * Executes before running ReactDOM.renderToString(). Return value will replace the existing context state.
16
+ */
10
17
  onBeforeRender?: (ctx: RenderCtx, app: ReactNode) => RenderCtx | void | undefined | Promise<RenderCtx | void | undefined>;
18
+ /**
19
+ * Produce html assets. Runs after the body is rendered, and before rendering the final html.
20
+ * @returns
21
+ * json: will be rendered to the dom as a `<script type="json"/>`.
22
+ * More assets will be available in the future.
23
+ */
11
24
  serialize?: (ctx: RenderCtx, app: ReactNode) => {
12
25
  json: string;
13
26
  } | Promise<{
14
27
  json: string;
15
28
  }> | undefined;
29
+ /**
30
+ * Converts serialized data from raw string back to structured data.
31
+ * @example deserialize: (data) => { const parsed = JSON.parse(data); return { analytics: new AnalyticsService(parsed); } }
32
+ */
16
33
  deserialize?: (data?: string) => Serialized;
34
+ /**
35
+ * Initialize the context state for client side rendering.
36
+ * Context state will only be available to the current Aspect, in the other hooks, as well as a prop to the react context component.
37
+ */
17
38
  browserInit?: (deserializedData: Serialized) => RenderCtx | void | undefined | Promise<RenderCtx | void | undefined>;
39
+ /**
40
+ * Executes before running ReactDOM.hydrate() (or .render() in case server side rendering is skipped). Receives the context produced by `deserialize()`
41
+ */
18
42
  onBeforeHydrate?: (context: RenderCtx, app: ReactNode) => RenderCtx | void | undefined | Promise<RenderCtx | void | undefined>;
43
+ /**
44
+ * Executes after browser rendering is complete. Receives context from the previous steps.
45
+ * @example onHydrate: (ref, { analytics }) => { analytics.reportPageView() }
46
+ */
19
47
  onHydrate?: (context: RenderCtx, ref: HTMLElement | null) => void;
48
+ /**
49
+ * Wraps dom with a context. Will receive render context, produced by `onBeforeRender()` (at server-side) or `deserialize()` (at the browser)
50
+ */
20
51
  reactContext?: ComponentType<ContextProps<RenderCtx>>;
21
52
  };
@@ -10,17 +10,52 @@ export declare type BrowserData = {
10
10
  headers: IncomingHttpHeaders;
11
11
  body: any;
12
12
  };
13
+ /**
14
+ * isomorphic location object, resembling the browser's window.location
15
+ */
13
16
  location: {
17
+ /** hostname + port
18
+ * @example localhost:3000
19
+ */
14
20
  host: string;
21
+ /**
22
+ * @example localhost
23
+ */
15
24
  hostname: string;
25
+ /** full url
26
+ * @example http://localhost:3000/components?q=button
27
+ */
16
28
  href: string;
29
+ /** full url without query
30
+ * @example http://localhost:3000/components
31
+ */
17
32
  origin: string;
33
+ /**
34
+ * @example /component
35
+ */
18
36
  pathname: string;
37
+ /**
38
+ * @example 3000
39
+ */
19
40
  port: number;
41
+ /**
42
+ * @example http
43
+ */
20
44
  protocol: string;
45
+ /**
46
+ * parsed search params
47
+ * @example { one: 1, two: [2,3]}
48
+ */
21
49
  query: ParsedQuery;
50
+ /**
51
+ * full resource path, including query, without hostname
52
+ * @example /components?q=button
53
+ */
22
54
  url: string;
23
55
  };
24
56
  cookie?: string;
25
57
  };
58
+ /**
59
+ * extract relevant information from Express request.
60
+ */
26
61
  export declare function requestToObj(req: Request, port: number): BrowserData;
@@ -1,4 +1,7 @@
1
1
  import type { Request, Response } from 'express';
2
+ /**
3
+ * Represents the server configuration for the current request
4
+ */
2
5
  export declare type RequestServer = {
3
6
  port: number;
4
7
  request: Request;
@@ -1,12 +1,19 @@
1
1
  import { ComponentType } from 'react';
2
2
  import { ProxyEntry } from './ui-root';
3
3
  export declare type StartPluginOptions = {
4
+ /**
5
+ * indicates whether the start in on verbose mode.
6
+ */
4
7
  verbose?: boolean;
8
+ /**
9
+ * component pattern it applies on.
10
+ */
5
11
  pattern?: string;
6
12
  };
7
13
  export interface StartPlugin {
8
14
  initiate(startOptions: StartPluginOptions): void;
9
15
  getProxy?(): ProxyEntry[];
10
16
  render: ComponentType;
17
+ /** promise that resolves when the plugin completed initiation */
11
18
  readonly whenReady: Promise<void>;
12
19
  }
@@ -12,6 +12,9 @@ declare type StartFlags = {
12
12
  skipCompilation: boolean;
13
13
  };
14
14
  export declare class StartCmd implements Command {
15
+ /**
16
+ * access to the extension instance.
17
+ */
15
18
  private ui;
16
19
  private logger;
17
20
  name: string;
@@ -20,7 +23,11 @@ export declare class StartCmd implements Command {
20
23
  group: string;
21
24
  shortDescription: string;
22
25
  options: CommandOptions;
23
- constructor(ui: UiMain, logger: Logger);
26
+ constructor(
27
+ /**
28
+ * access to the extension instance.
29
+ */
30
+ ui: UiMain, logger: Logger);
24
31
  render([uiRootName, userPattern]: StartArgs, { dev, port, rebuild, verbose, noBrowser, skipCompilation }: StartFlags): Promise<React.ReactElement>;
25
32
  }
26
33
  export {};
@@ -1,6 +1,9 @@
1
1
  import { Command } from '@teambit/cli';
2
2
  import { UiMain } from './ui.main.runtime';
3
3
  export declare class UIBuildCmd implements Command {
4
+ /**
5
+ * access to the extension instance.
6
+ */
4
7
  private ui;
5
8
  name: string;
6
9
  description: string;
@@ -8,6 +11,10 @@ export declare class UIBuildCmd implements Command {
8
11
  group: string;
9
12
  shortDescription: string;
10
13
  options: never[];
11
- constructor(ui: UiMain);
14
+ constructor(
15
+ /**
16
+ * access to the extension instance.
17
+ */
18
+ ui: UiMain);
12
19
  report([type]: [string]): Promise<string>;
13
20
  }
package/dist/ui-root.d.ts CHANGED
@@ -3,21 +3,45 @@ import { ComponentDir } from '@teambit/bundler';
3
3
  import { Component } from '@teambit/component';
4
4
  import { ProxyConfigArrayItem } from 'webpack-dev-server';
5
5
  export interface UIRoot extends ComponentDir {
6
+ /**
7
+ * unique name of the ui.
8
+ */
6
9
  name: string;
10
+ /**
11
+ * path of the ui root.
12
+ */
7
13
  path: string;
14
+ /**
15
+ * name of the UI root config file.
16
+ */
8
17
  configFile: string;
9
18
  buildOptions?: {
10
19
  ssr?: boolean;
11
20
  launchBrowserOnStart?: boolean;
12
21
  };
22
+ /**
23
+ * resolve all aspects in the UI root.
24
+ */
13
25
  resolveAspects(runtimeName: string): Promise<AspectDefinition[]>;
26
+ /**
27
+ * resolve components from a given pattern.
28
+ */
14
29
  resolvePattern?(pattern: string): Promise<Component[]>;
30
+ /**
31
+ * listener for when the dev server starts. can be used for running the watcher.
32
+ */
15
33
  postStart?(options: PostStartOptions): Promise<void>;
34
+ /**
35
+ * determine whether UI should get a priority.
36
+ */
16
37
  priority?: boolean;
17
38
  }
18
39
  export declare type ProxyEntry = ProxyConfigArrayItem & {
19
40
  context: string[];
20
41
  };
21
42
  export declare type PostStartOptions = {
43
+ /**
44
+ * pattern for selecting components in the container.
45
+ */
22
46
  pattern?: string;
23
47
  };
@@ -17,6 +17,9 @@ export declare type UIServerProps = {
17
17
  startPlugins: StartPlugin[];
18
18
  };
19
19
  export declare type StartOptions = {
20
+ /**
21
+ * port range for the UI server to bind. default is a port range of 4000-4200.
22
+ */
20
23
  portRange?: number[] | number;
21
24
  };
22
25
  export declare class UIServer {
@@ -32,20 +35,31 @@ export declare class UIServer {
32
35
  getName(): string;
33
36
  private _port;
34
37
  get port(): number;
38
+ /** the hostname for the server to listen at. Currently statically 'localhost' */
35
39
  get host(): string;
40
+ /** the server listens at this url */
36
41
  get fullUrl(): string;
37
42
  get buildOptions(): {
38
43
  ssr?: boolean | undefined;
39
44
  launchBrowserOnStart?: boolean | undefined;
40
45
  } | undefined;
46
+ /**
47
+ * get the webpack configuration of the UI server.
48
+ */
41
49
  getDevConfig(): Promise<import("@teambit/webpack").WebpackConfigWithDevServer>;
42
50
  private setReady;
43
51
  private startPromise;
44
52
  get whenReady(): Promise<void[]>;
53
+ /**
54
+ * start a UI server.
55
+ */
45
56
  start({ portRange }?: StartOptions): Promise<void>;
46
57
  getPluginsComponents(): import("react").ComponentType<{}>[];
47
58
  private setupServerSideRendering;
48
59
  private configureProxy;
60
+ /**
61
+ * start a UI dev server.
62
+ */
49
63
  dev({ portRange }?: StartOptions): Promise<WebpackDevServer>;
50
64
  private selectPort;
51
65
  private getProxyFromPlugins;
@@ -28,58 +28,198 @@ export declare type OnStartSlot = SlotRegistry<OnStart>;
28
28
  export declare type PublicDirOverwriteSlot = SlotRegistry<PublicDirOverwrite>;
29
29
  export declare type BuildMethodOverwriteSlot = SlotRegistry<BuildMethodOverwrite>;
30
30
  export declare type UIConfig = {
31
+ /**
32
+ * port for the UI root to use.
33
+ */
31
34
  port?: number;
35
+ /**
36
+ * port range for the UI root to use.
37
+ */
32
38
  portRange: [number, number];
39
+ /**
40
+ * host for the UI root
41
+ */
33
42
  host: string;
43
+ /**
44
+ * directory in workspace to use for public assets.
45
+ * always relative to the workspace root directory.
46
+ */
34
47
  publicDir: string;
48
+ /** the url to display when server is listening. Note that bit does not provide proxying to this url */
35
49
  publicUrl?: string;
36
50
  };
37
51
  export declare type RuntimeOptions = {
52
+ /**
53
+ * determine whether to initiate on verbose mode.
54
+ */
38
55
  verbose?: boolean;
56
+ /**
57
+ * name of the UI root to load.
58
+ */
39
59
  uiRootName?: string;
60
+ /**
61
+ * component selector pattern to load.
62
+ */
40
63
  pattern?: string;
64
+ /**
65
+ * determine whether to start a dev server (defaults to false).
66
+ */
41
67
  dev?: boolean;
68
+ /**
69
+ * port of the config.
70
+ */
42
71
  port?: number;
72
+ /**
73
+ * determine whether to rebuild the UI before start.
74
+ */
43
75
  rebuild?: boolean;
44
76
  };
45
77
  export declare class UiMain {
78
+ /**
79
+ * Pubsub extension.
80
+ */
46
81
  private pubsub;
47
82
  private config;
83
+ /**
84
+ * graphql extension.
85
+ */
48
86
  private graphql;
87
+ /**
88
+ * slot registry of ui roots.
89
+ */
49
90
  private uiRootSlot;
91
+ /**
92
+ * express extension.
93
+ */
50
94
  private express;
95
+ /**
96
+ * pre-start slot
97
+ */
51
98
  private preStartSlot;
99
+ /**
100
+ * on start slot
101
+ */
52
102
  private onStartSlot;
103
+ /**
104
+ * Overwrite the public dir Slot
105
+ */
53
106
  private publicDirOverwriteSlot;
107
+ /**
108
+ * Overwrite the build ui method
109
+ */
54
110
  private buildMethodOverwriteSlot;
111
+ /**
112
+ * component extension.
113
+ */
55
114
  private componentExtension;
115
+ /**
116
+ * ui logger instance.
117
+ */
56
118
  private cache;
119
+ /**
120
+ * ui logger instance.
121
+ */
57
122
  private logger;
58
123
  private harmony;
59
124
  private startPluginSlot;
60
- constructor(pubsub: PubsubMain, config: UIConfig, graphql: GraphqlMain, uiRootSlot: UIRootRegistry, express: ExpressMain, preStartSlot: PreStartSlot, onStartSlot: OnStartSlot, publicDirOverwriteSlot: PublicDirOverwriteSlot, buildMethodOverwriteSlot: BuildMethodOverwriteSlot, componentExtension: ComponentMain, cache: CacheMain, logger: Logger, harmony: Harmony, startPluginSlot: StartPluginSlot);
125
+ constructor(
126
+ /**
127
+ * Pubsub extension.
128
+ */
129
+ pubsub: PubsubMain, config: UIConfig,
130
+ /**
131
+ * graphql extension.
132
+ */
133
+ graphql: GraphqlMain,
134
+ /**
135
+ * slot registry of ui roots.
136
+ */
137
+ uiRootSlot: UIRootRegistry,
138
+ /**
139
+ * express extension.
140
+ */
141
+ express: ExpressMain,
142
+ /**
143
+ * pre-start slot
144
+ */
145
+ preStartSlot: PreStartSlot,
146
+ /**
147
+ * on start slot
148
+ */
149
+ onStartSlot: OnStartSlot,
150
+ /**
151
+ * Overwrite the public dir Slot
152
+ */
153
+ publicDirOverwriteSlot: PublicDirOverwriteSlot,
154
+ /**
155
+ * Overwrite the build ui method
156
+ */
157
+ buildMethodOverwriteSlot: BuildMethodOverwriteSlot,
158
+ /**
159
+ * component extension.
160
+ */
161
+ componentExtension: ComponentMain,
162
+ /**
163
+ * ui logger instance.
164
+ */
165
+ cache: CacheMain,
166
+ /**
167
+ * ui logger instance.
168
+ */
169
+ logger: Logger, harmony: Harmony, startPluginSlot: StartPluginSlot);
61
170
  publicDir(uiRoot: UIRoot): Promise<string>;
62
171
  private getUiByName;
172
+ /**
173
+ * create a build of the given UI root.
174
+ */
63
175
  build(uiRootName?: string): Promise<webpack.MultiStats | undefined>;
64
176
  registerStartPlugin(startPlugin: StartPlugin): this;
65
177
  private initiatePlugins;
178
+ /**
179
+ * create a Bit UI runtime.
180
+ */
66
181
  createRuntime({ uiRootName, pattern, dev, port, rebuild, verbose }: RuntimeOptions): Promise<UIServer>;
67
182
  private addSignalListener;
68
183
  getPort(port?: number): Promise<number>;
184
+ /**
185
+ * Events
186
+ */
69
187
  private createUiServerStartedEvent;
188
+ /**
189
+ * pre-start events are triggered and *completed* before the webserver started.
190
+ * (the promise is awaited)
191
+ */
70
192
  registerPreStart(preStartFn: PreStart): void;
193
+ /**
194
+ * bind to ui server start event.
195
+ */
71
196
  registerOnStart(onStartFn: OnStart): this;
197
+ /**
198
+ * overwrite the build ui function
199
+ */
72
200
  registerBuildUIOverwrite(fn: BuildMethodOverwrite): this;
201
+ /**
202
+ * overwrite the build ui function
203
+ */
73
204
  registerPublicDirOverwrite(fn: PublicDirOverwrite): this;
74
205
  private getOverwriteBuildFn;
75
206
  private getOverwritePublic;
76
207
  invokePreStart(preStartOpts: PreStartOpts): Promise<void>;
77
208
  invokeOnStart(): Promise<ComponentType[]>;
209
+ /**
210
+ * register a UI slot.
211
+ */
78
212
  registerUiRoot(uiRoot: UIRoot): void;
213
+ /**
214
+ * get a UI runtime instance.
215
+ */
79
216
  getUi(uiRootName?: string): [string, UIRoot] | undefined;
80
217
  getUiName(uiRootName?: string): string | undefined;
81
218
  private possibleUis;
82
219
  createLink(aspectDefs: AspectDefinition[], rootExtensionName: string): Promise<string>;
220
+ /**
221
+ * generate the root file of the UI runtime.
222
+ */
83
223
  generateRoot(aspectDefs: AspectDefinition[], rootExtensionName: string, runtimeName?: string, rootAspect?: string): Promise<string>;
84
224
  private selectPort;
85
225
  private buildUI;
@@ -12,15 +12,45 @@ export declare type ContextProps<T = any> = {
12
12
  declare type HudSlot = SlotRegistry<ReactNode>;
13
13
  declare type renderLifecycleSlot = SlotRegistry<RenderLifecycle>;
14
14
  declare type UIRootRegistry = SlotRegistry<UIRootFactory>;
15
+ /**
16
+ * extension
17
+ */
15
18
  export declare class UiUI {
19
+ /**
20
+ * react-router extension.
21
+ */
16
22
  private router;
23
+ /**
24
+ * ui root registry.
25
+ */
17
26
  private uiRootSlot;
27
+ /** slot for overlay ui elements */
18
28
  private hudSlot;
29
+ /** hooks into the ssr render process */
19
30
  private lifecycleSlot;
20
- constructor(router: ReactRouterUI, uiRootSlot: UIRootRegistry, hudSlot: HudSlot, lifecycleSlot: renderLifecycleSlot);
31
+ constructor(
32
+ /**
33
+ * react-router extension.
34
+ */
35
+ router: ReactRouterUI,
36
+ /**
37
+ * ui root registry.
38
+ */
39
+ uiRootSlot: UIRootRegistry,
40
+ /** slot for overlay ui elements */
41
+ hudSlot: HudSlot,
42
+ /** hooks into the ssr render process */
43
+ lifecycleSlot: renderLifecycleSlot);
44
+ /** render and rehydrate client-side */
21
45
  render(rootExtension: string): Promise<void>;
46
+ /** render dehydrated server-side */
22
47
  renderSsr(rootExtension: string, { assets, browser, server }?: SsrContent): Promise<string>;
48
+ /** adds elements to the Heads Up Display */
23
49
  registerHudItem: (element: ReactNode) => void;
50
+ /**
51
+ * adds global context at the ui root
52
+ * @deprecated replace with `.registerRenderHooks({ reactContext })`.
53
+ */
24
54
  registerContext<T>(context: ComponentType<ContextProps<T>>): void;
25
55
  registerRoot(uiRoot: UIRootFactory): void;
26
56
  registerRenderHooks<T, Y>(hooks: RenderLifecycle<T, Y>): void;
@@ -1 +1,2 @@
1
+ /** fallback html template for the main UI, in case ssr is not active */
1
2
  export declare function html(title: string, withDevTools?: boolean): () => string;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/ui",
3
- "version": "0.0.551",
3
+ "version": "0.0.556",
4
4
  "homepage": "https://bit.dev/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": "0.0.551"
9
+ "version": "0.0.556"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
@@ -53,28 +53,28 @@
53
53
  "@teambit/base-ui.loaders.loader-ribbon": "1.0.0",
54
54
  "@teambit/base-ui.theme.fonts.roboto": "1.0.0",
55
55
  "@teambit/base-ui.theme.theme-provider": "1.0.1",
56
- "@teambit/aspect-loader": "0.0.551",
57
- "@teambit/toolbox.path.to-windows-compatible-path": "0.0.456",
58
- "@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.460",
59
- "@teambit/logger": "0.0.467",
60
- "@teambit/cli": "0.0.382",
61
- "@teambit/ui-foundation.cli.ui-server-console": "0.0.461",
62
- "@teambit/bundler": "0.0.551",
63
- "@teambit/component": "0.0.551",
64
- "@teambit/express": "0.0.471",
65
- "@teambit/graphql": "0.0.551",
66
- "@teambit/toolbox.network.get-port": "0.0.86",
67
- "@teambit/aspect": "0.0.551",
68
- "@teambit/cache": "0.0.467",
69
- "@teambit/pubsub": "0.0.551",
70
- "@teambit/react-router": "0.0.551",
71
- "@teambit/ui-foundation.ui.rendering.html": "0.0.42",
56
+ "@teambit/aspect-loader": "0.0.556",
57
+ "@teambit/toolbox.path.to-windows-compatible-path": "0.0.461",
58
+ "@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.465",
59
+ "@teambit/logger": "0.0.472",
60
+ "@teambit/cli": "0.0.387",
61
+ "@teambit/ui-foundation.cli.ui-server-console": "0.0.466",
62
+ "@teambit/bundler": "0.0.556",
63
+ "@teambit/component": "0.0.556",
64
+ "@teambit/express": "0.0.476",
65
+ "@teambit/graphql": "0.0.556",
66
+ "@teambit/toolbox.network.get-port": "0.0.91",
67
+ "@teambit/aspect": "0.0.556",
68
+ "@teambit/cache": "0.0.472",
69
+ "@teambit/pubsub": "0.0.556",
70
+ "@teambit/react-router": "0.0.556",
71
+ "@teambit/ui-foundation.ui.rendering.html": "0.0.47",
72
72
  "@teambit/design.theme.icons-font": "1.0.2",
73
73
  "@teambit/design.ui.tooltip": "0.0.352",
74
- "@teambit/ui-foundation.ui.global-loader": "0.0.459",
75
- "@teambit/webpack.modules.generate-style-loaders": "0.0.76",
76
- "@teambit/webpack.modules.style-regexps": "0.0.105",
77
- "@teambit/webpack": "0.0.551"
74
+ "@teambit/ui-foundation.ui.global-loader": "0.0.464",
75
+ "@teambit/webpack.modules.generate-style-loaders": "0.0.81",
76
+ "@teambit/webpack.modules.style-regexps": "0.0.110",
77
+ "@teambit/webpack": "0.0.556"
78
78
  },
79
79
  "devDependencies": {
80
80
  "@types/react": "^17.0.8",
@@ -96,7 +96,7 @@
96
96
  },
97
97
  "peerDependencies": {
98
98
  "@apollo/client": "^3.0.0",
99
- "@teambit/legacy": "1.0.169",
99
+ "@teambit/legacy": "1.0.173",
100
100
  "react-dom": "^16.8.0 || ^17.0.0",
101
101
  "react": "^16.8.0 || ^17.0.0"
102
102
  },
@@ -141,11 +141,17 @@
141
141
  "react": "-"
142
142
  },
143
143
  "peerDependencies": {
144
- "@teambit/legacy": "1.0.169",
144
+ "@teambit/legacy": "1.0.173",
145
145
  "react-dom": "^16.8.0 || ^17.0.0",
146
146
  "react": "^16.8.0 || ^17.0.0"
147
147
  }
148
148
  }
149
149
  },
150
+ "files": [
151
+ "dist",
152
+ "!dist/tsconfig.tsbuildinfo",
153
+ "README.md",
154
+ "README.mdx"
155
+ ],
150
156
  "private": false
151
157
  }
package/compose.tsx DELETED
@@ -1,27 +0,0 @@
1
- import React, { ReactNode, ComponentType } from 'react';
2
-
3
- type ComponentTuple<T = any> = [Component: ComponentType<T>, props?: T];
4
- export type Wrapper<T = any> = ComponentType<T> | ComponentTuple<T>;
5
- interface Props<T = any> {
6
- /** Compose these components. Can be a ReactComponent, or a [ReactComponent, Props] tuple */
7
- components: Wrapper<T>[];
8
- children?: ReactNode;
9
- }
10
-
11
- /**
12
- * A react Component composer. equivalent to `(n+1) => <a[n+1]> <Compose(a[n]) /> </a[n+1]>`.
13
- * Component can be a React Component, or a `[Component, { ...props }]` tuple.
14
- */
15
- export function Compose(props: Props) {
16
- const { components = [], children } = props;
17
-
18
- const arrayified: ComponentTuple[] = components.map((tuple) => (Array.isArray(tuple) ? tuple : [tuple, undefined]));
19
-
20
- return (
21
- <>
22
- {arrayified.reduceRight((acc, [Comp, forwardProps]) => {
23
- return <Comp {...forwardProps}>{acc}</Comp>;
24
- }, children)}
25
- </>
26
- );
27
- }