@teambit/workspace 0.0.554 → 0.0.558

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 (89) hide show
  1. package/dist/build-graph-from-fs.d.ts +30 -0
  2. package/dist/build-graph-from-fs.js +4 -1
  3. package/dist/build-graph-from-fs.js.map +1 -1
  4. package/dist/install.cmd.d.ts +17 -3
  5. package/dist/install.cmd.js.map +1 -1
  6. package/dist/link/link.cmd.d.ts +15 -1
  7. package/dist/types.d.ts +21 -0
  8. package/dist/ui/workspace/workspace-model.d.ts +32 -1
  9. package/dist/ui/workspace/workspace-provider.d.ts +9 -0
  10. package/dist/ui/workspace/workspace.d.ts +3 -0
  11. package/dist/watch/output-formatter.d.ts +6 -0
  12. package/dist/watch/watch.cmd.d.ts +22 -1
  13. package/dist/watch/watcher.d.ts +9 -0
  14. package/dist/workspace-component/component-status.d.ts +57 -1
  15. package/dist/workspace-component/workspace-component-loader.d.ts +7 -0
  16. package/dist/workspace-component/workspace-component.d.ts +36 -1
  17. package/dist/workspace.d.ts +236 -3
  18. package/dist/workspace.js +6 -0
  19. package/dist/workspace.js.map +1 -1
  20. package/dist/workspace.ui-root.d.ts +18 -1
  21. package/dist/workspace.ui.runtime.d.ts +32 -1
  22. package/package.json +61 -53
  23. package/tsconfig.json +1 -2
  24. package/build-graph-from-fs.ts +0 -160
  25. package/capsule.cmd.ts +0 -136
  26. package/component-config-file/component-config-file.ts +0 -98
  27. package/component-config-file/exceptions/already-exists.ts +0 -7
  28. package/component-config-file/exceptions/index.ts +0 -1
  29. package/component-config-file/index.ts +0 -2
  30. package/component-tree.widget.tsx +0 -16
  31. package/constants.ts +0 -1
  32. package/eject-conf.cmd.tsx +0 -62
  33. package/events/index.ts +0 -3
  34. package/events/on-component-add-event.ts +0 -14
  35. package/events/on-component-change-event.ts +0 -14
  36. package/events/on-component-removed-event.ts +0 -14
  37. package/exceptions/dependency-type-not-supported-in-policy.ts +0 -7
  38. package/exceptions/incorrect-env-aspect.ts +0 -8
  39. package/exceptions/index.ts +0 -1
  40. package/index.ts +0 -19
  41. package/install.cmd.tsx +0 -67
  42. package/link/component-list-links.ts +0 -50
  43. package/link/core-aspects-links.ts +0 -50
  44. package/link/get-package-name-from-target.ts +0 -5
  45. package/link/index.ts +0 -1
  46. package/link/link-row.ts +0 -20
  47. package/link/link-to-dir.ts +0 -13
  48. package/link/link.cmd.ts +0 -96
  49. package/link/nested-deps-in-nm-links.ts +0 -47
  50. package/link/rewire-row.ts +0 -17
  51. package/list.cmd.tsx +0 -30
  52. package/on-component-events.ts +0 -14
  53. package/package-tar/teambit-workspace-0.0.554.tgz +0 -0
  54. package/tag-cmd.ts +0 -247
  55. package/types/asset.d.ts +0 -29
  56. package/types/style.d.ts +0 -42
  57. package/types.ts +0 -40
  58. package/ui/index.ts +0 -1
  59. package/ui/workspace/default-component.ts +0 -7
  60. package/ui/workspace/index.ts +0 -1
  61. package/ui/workspace/use-workspace.ts +0 -193
  62. package/ui/workspace/workspace-context.tsx +0 -5
  63. package/ui/workspace/workspace-model.ts +0 -66
  64. package/ui/workspace/workspace-overview/index.ts +0 -1
  65. package/ui/workspace/workspace-overview/workspace-overview.module.scss +0 -6
  66. package/ui/workspace/workspace-overview/workspace-overview.tsx +0 -21
  67. package/ui/workspace/workspace-provider.tsx +0 -23
  68. package/ui/workspace/workspace.module.scss +0 -40
  69. package/ui/workspace/workspace.tsx +0 -99
  70. package/ui/workspace-components-drawer/index.ts +0 -1
  71. package/ui/workspace-components-drawer/workspace-components-drawer.module.scss +0 -4
  72. package/ui/workspace-components-drawer/workspace-components.drawer.tsx +0 -49
  73. package/watch/REFACTOR_GUIDE.md +0 -14
  74. package/watch/check-types.ts +0 -5
  75. package/watch/output-formatter.ts +0 -50
  76. package/watch/watch.cmd.tsx +0 -142
  77. package/watch/watcher.ts +0 -289
  78. package/workspace-component/component-status.ts +0 -67
  79. package/workspace-component/index.ts +0 -2
  80. package/workspace-component/workspace-component-loader.ts +0 -276
  81. package/workspace-component/workspace-component.ts +0 -51
  82. package/workspace-section.ts +0 -14
  83. package/workspace.aspect.ts +0 -9
  84. package/workspace.graphql.ts +0 -133
  85. package/workspace.main.runtime.ts +0 -50
  86. package/workspace.provider.ts +0 -218
  87. package/workspace.ts +0 -1534
  88. package/workspace.ui-root.ts +0 -64
  89. package/workspace.ui.runtime.tsx +0 -215
@@ -1,64 +0,0 @@
1
- import { BundlerMain } from '@teambit/bundler';
2
- import { Component, ComponentID } from '@teambit/component';
3
- import { UIRoot } from '@teambit/ui';
4
- import { GetBitMapComponentOptions } from '@teambit/legacy/dist/consumer/bit-map/bit-map';
5
- import { PathOsBased } from '@teambit/legacy/dist/utils/path';
6
-
7
- import { Workspace } from './workspace';
8
-
9
- export class WorkspaceUIRoot implements UIRoot {
10
- constructor(
11
- /**
12
- * workspace extension.
13
- */
14
- private workspace: Workspace,
15
-
16
- /**
17
- * bundler extension
18
- */
19
- private bundler: BundlerMain
20
- ) {}
21
-
22
- priority = true;
23
-
24
- get name() {
25
- return this.workspace.name;
26
- }
27
-
28
- get path() {
29
- return this.workspace.path;
30
- }
31
-
32
- get configFile() {
33
- return 'workspace.json';
34
- }
35
-
36
- buildOptions = {
37
- ssr: false,
38
- launchBrowserOnStart: true,
39
- };
40
-
41
- async resolveAspects(runtimeName: string) {
42
- return this.workspace.resolveAspects(runtimeName);
43
- }
44
-
45
- // TODO: @gilad please implement with variants.
46
- resolvePattern(pattern: string): Promise<Component[]> {
47
- return this.workspace.byPattern(pattern);
48
- }
49
-
50
- getConfig() {
51
- return {};
52
- }
53
-
54
- /**
55
- * proxy to `workspace.componentDir()`
56
- */
57
- componentDir(
58
- componentId: ComponentID,
59
- bitMapOptions?: GetBitMapComponentOptions,
60
- options = { relative: false }
61
- ): PathOsBased {
62
- return this.workspace.componentDir(componentId, bitMapOptions, options);
63
- }
64
- }
@@ -1,215 +0,0 @@
1
- import { ComponentAspect, ComponentUI, ComponentModel } from '@teambit/component';
2
- import { ComponentTreeAspect, ComponentTreeUI, ComponentTreeNode } from '@teambit/component-tree';
3
- import { Slot, SlotRegistry } from '@teambit/harmony';
4
- import ReactRouterAspect, { ReactRouterUI } from '@teambit/react-router';
5
- import { RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';
6
- import { Menu } from '@teambit/ui-foundation.ui.menu';
7
- import SidebarAspect, { SidebarUI, SidebarItem, SidebarItemSlot } from '@teambit/sidebar';
8
- import { MenuItemSlot, MenuItem } from '@teambit/ui-foundation.ui.main-dropdown';
9
- import { UIAspect, UIRootUI as UIRoot, UIRuntime, UiUI } from '@teambit/ui';
10
- import { GraphAspect, GraphUI } from '@teambit/graph';
11
- import React from 'react';
12
- import { RouteProps } from 'react-router-dom';
13
- import CommandBarAspect, { CommandBarUI, ComponentSearcher, CommandHandler } from '@teambit/command-bar';
14
- import { MenuLinkItem } from '@teambit/design.ui.surfaces.menu.link-item';
15
- import { WorkspaceComponentsDrawer } from './ui/workspace-components-drawer';
16
- import { ComponentTreeWidget } from './component-tree.widget';
17
- import { Workspace } from './ui';
18
- import { WorkspaceAspect } from './workspace.aspect';
19
-
20
- export type SidebarWidgetSlot = SlotRegistry<ComponentTreeNode>;
21
-
22
- export class WorkspaceUI {
23
- constructor(
24
- /**
25
- * route slot.
26
- */
27
- private routeSlot: RouteSlot,
28
-
29
- /**
30
- * component ui extension.
31
- */
32
- private componentUi: ComponentUI,
33
-
34
- /**
35
- * menu slot
36
- */
37
- private menuSlot: RouteSlot,
38
-
39
- private menuItemSlot: MenuItemSlot,
40
-
41
- private sidebar: SidebarUI,
42
-
43
- private sidebarSlot: SidebarWidgetSlot,
44
-
45
- /**
46
- * sidebar link slot
47
- */
48
- private sidebarItemSlot: SidebarItemSlot,
49
-
50
- private commandBarUI: CommandBarUI,
51
-
52
- reactRouterUI: ReactRouterUI
53
- ) {
54
- this.componentSearcher = new ComponentSearcher(reactRouterUI.navigateTo);
55
- }
56
-
57
- private setKeyBindHandler: (updated: CommandHandler) => void = () => {};
58
-
59
- /**
60
- * register a route to the workspace.
61
- */
62
- registerRoute(route: RouteProps) {
63
- this.routeSlot.register(route);
64
- return this;
65
- }
66
-
67
- registerSidebarWidget(componentTreeNode: ComponentTreeNode) {
68
- this.sidebarSlot.register(componentTreeNode);
69
- return this;
70
- }
71
-
72
- registerMenuItem = (menuItems: MenuItem[]) => {
73
- this.menuItemSlot.register(menuItems);
74
- };
75
-
76
- setComponents = (components: ComponentModel[]) => {
77
- this.componentSearcher.update(components);
78
- };
79
-
80
- registerSidebarLink = (...links: SidebarItem[]) => {
81
- this.sidebarItemSlot.register(links);
82
- };
83
-
84
- componentSearcher: ComponentSearcher;
85
-
86
- uiRoot(): UIRoot {
87
- this.sidebar.registerDrawer(new WorkspaceComponentsDrawer(this.sidebarSlot));
88
- this.commandBarUI.addSearcher(this.componentSearcher);
89
- const [setKeyBindHandler] = this.commandBarUI.addCommand({
90
- id: 'sidebar.toggle', // TODO - extract to a component!
91
- handler: () => {},
92
- displayName: 'Toggle component list',
93
- keybinding: 'alt+s',
94
- });
95
- this.setKeyBindHandler = setKeyBindHandler;
96
-
97
- return {
98
- routes: [
99
- {
100
- path: '/',
101
- children: (
102
- <Workspace
103
- menuSlot={this.menuSlot}
104
- routeSlot={this.routeSlot}
105
- sidebar={<this.sidebar.render itemSlot={this.sidebarItemSlot} />}
106
- workspaceUI={this}
107
- onSidebarTogglerChange={this.setKeyBindHandler}
108
- />
109
- ),
110
- },
111
- ],
112
- };
113
- }
114
-
115
- private menuItems: MenuItem[] = [
116
- {
117
- category: 'general',
118
- title: 'Open command bar',
119
- keyChar: 'mod+k',
120
- handler: () => this.commandBarUI?.run('command-bar.open'),
121
- },
122
- {
123
- category: 'general',
124
- title: 'Toggle component list',
125
- keyChar: 'alt+s',
126
- handler: () => this.commandBarUI?.run('sidebar.toggle'),
127
- },
128
- ];
129
-
130
- static dependencies = [
131
- UIAspect,
132
- ComponentAspect,
133
- SidebarAspect,
134
- ComponentTreeAspect,
135
- CommandBarAspect,
136
- ReactRouterAspect,
137
- GraphAspect,
138
- ];
139
-
140
- static runtime = UIRuntime;
141
-
142
- static slots = [
143
- Slot.withType<RouteProps>(),
144
- Slot.withType<RouteProps>(),
145
- Slot.withType<ComponentTreeNode>(),
146
- Slot.withType<MenuItemSlot>(),
147
- Slot.withType<SidebarItemSlot>(),
148
- ];
149
-
150
- static async provider(
151
- [ui, componentUi, sidebar, componentTree, commandBarUI, reactRouterUI, graphUI]: [
152
- UiUI,
153
- ComponentUI,
154
- SidebarUI,
155
- ComponentTreeUI,
156
- CommandBarUI,
157
- ReactRouterUI,
158
- GraphUI
159
- ],
160
- config,
161
- [routeSlot, menuSlot, menuItemSlot, sidebarSlot, sidebarItemSlot]: [
162
- RouteSlot,
163
- RouteSlot,
164
- MenuItemSlot,
165
- SidebarWidgetSlot,
166
- SidebarItemSlot
167
- ]
168
- ) {
169
- componentTree.registerTreeNode(new ComponentTreeWidget());
170
- sidebarSlot.register(new ComponentTreeWidget());
171
- graphUI.registerComponentWidget(new ComponentTreeWidget().widget);
172
-
173
- const workspaceUI = new WorkspaceUI(
174
- routeSlot,
175
- componentUi,
176
- menuSlot,
177
- menuItemSlot,
178
- sidebar,
179
- sidebarSlot,
180
- sidebarItemSlot,
181
- commandBarUI,
182
- reactRouterUI
183
- );
184
- ui.registerRoot(workspaceUI.uiRoot.bind(workspaceUI));
185
- workspaceUI.registerMenuItem(workspaceUI.menuItems);
186
-
187
- workspaceUI.registerSidebarLink(() => (
188
- <MenuLinkItem exact href="/" icon="comps">
189
- Gallery
190
- </MenuLinkItem>
191
- ));
192
-
193
- workspaceUI.menuSlot.register([
194
- {
195
- exact: true,
196
- path: '/',
197
- children: <Menu menuItemSlot={workspaceUI.menuItemSlot} />,
198
- },
199
- {
200
- path: workspaceUI.componentUi.routePath,
201
- children: workspaceUI.componentUi.getMenu(WorkspaceAspect.id),
202
- },
203
- ]);
204
-
205
- workspaceUI.routeSlot.register({
206
- path: workspaceUI.componentUi.routePath,
207
- children: workspaceUI.componentUi.getComponentUI(WorkspaceAspect.id),
208
- });
209
- return workspaceUI;
210
- }
211
- }
212
-
213
- export default WorkspaceUI;
214
-
215
- WorkspaceAspect.addRuntime(WorkspaceUI);