@teambit/scope 0.0.881 → 0.0.883
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/dist/exceptions/component-not-found.js +0 -6
- package/dist/exceptions/component-not-found.js.map +1 -1
- package/dist/exceptions/index.js +0 -6
- package/dist/exceptions/index.js.map +1 -1
- package/dist/exceptions/no-id-match-pattern.js +0 -6
- package/dist/exceptions/no-id-match-pattern.js.map +1 -1
- package/dist/index.js +0 -14
- package/dist/index.js.map +1 -1
- package/dist/routes/action.route.js +2 -19
- package/dist/routes/action.route.js.map +1 -1
- package/dist/routes/delete.route.js +0 -11
- package/dist/routes/delete.route.js.map +1 -1
- package/dist/routes/fetch.route.js +0 -27
- package/dist/routes/fetch.route.js.map +1 -1
- package/dist/routes/index.js +0 -12
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/put.route.js +0 -18
- package/dist/routes/put.route.js.map +1 -1
- package/dist/scope-cmd.js +0 -13
- package/dist/scope-cmd.js.map +1 -1
- package/dist/scope-component-loader.js +18 -69
- package/dist/scope-component-loader.js.map +1 -1
- package/dist/scope.aspect.js +0 -5
- package/dist/scope.aspect.js.map +1 -1
- package/dist/scope.composition.js +0 -6
- package/dist/scope.composition.js.map +1 -1
- package/dist/scope.graphql.js +4 -23
- package/dist/scope.graphql.js.map +1 -1
- package/dist/scope.main.runtime.js +71 -349
- package/dist/scope.main.runtime.js.map +1 -1
- package/dist/scope.ui-root.js +0 -14
- package/dist/scope.ui-root.js.map +1 -1
- package/dist/scope.ui.drawer.js +5 -38
- package/dist/scope.ui.drawer.js.map +1 -1
- package/dist/scope.ui.runtime.js +11 -97
- package/dist/scope.ui.runtime.js.map +1 -1
- package/dist/staged-config.js +0 -35
- package/dist/staged-config.js.map +1 -1
- package/dist/ui/menu/index.js +0 -3
- package/dist/ui/menu/index.js.map +1 -1
- package/dist/ui/menu/menu.js +3 -35
- package/dist/ui/menu/menu.js.map +1 -1
- package/dist/ui/scope-overview/index.js +0 -2
- package/dist/ui/scope-overview/index.js.map +1 -1
- package/dist/ui/scope-overview/scope-overview.js +0 -32
- package/dist/ui/scope-overview/scope-overview.js.map +1 -1
- package/dist/ui/scope.js +0 -57
- package/dist/ui/scope.js.map +1 -1
- package/package-tar/teambit-scope-0.0.883.tgz +0 -0
- package/package.json +16 -16
- package/{preview-1666409808293.js → preview-1666582798766.js} +2 -2
- package/package-tar/teambit-scope-0.0.881.tgz +0 -0
package/dist/scope.ui.drawer.js
CHANGED
|
@@ -1,86 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.scopeDrawer = void 0;
|
|
9
|
-
|
|
10
8
|
function _extends2() {
|
|
11
9
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
|
-
|
|
13
10
|
_extends2 = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
function _react() {
|
|
21
16
|
const data = _interopRequireWildcard(require("react"));
|
|
22
|
-
|
|
23
17
|
_react = function () {
|
|
24
18
|
return data;
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
return data;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
function _componentUi() {
|
|
31
23
|
const data = require("@teambit/component.ui.component-drawer");
|
|
32
|
-
|
|
33
24
|
_componentUi = function () {
|
|
34
25
|
return data;
|
|
35
26
|
};
|
|
36
|
-
|
|
37
27
|
return data;
|
|
38
28
|
}
|
|
39
|
-
|
|
40
29
|
function _uiFoundationUi() {
|
|
41
30
|
const data = require("@teambit/ui-foundation.ui.side-bar");
|
|
42
|
-
|
|
43
31
|
_uiFoundationUi = function () {
|
|
44
32
|
return data;
|
|
45
33
|
};
|
|
46
|
-
|
|
47
34
|
return data;
|
|
48
35
|
}
|
|
49
|
-
|
|
50
36
|
function _lanesHooks() {
|
|
51
37
|
const data = require("@teambit/lanes.hooks.use-lanes");
|
|
52
|
-
|
|
53
38
|
_lanesHooks = function () {
|
|
54
39
|
return data;
|
|
55
40
|
};
|
|
56
|
-
|
|
57
41
|
return data;
|
|
58
42
|
}
|
|
59
|
-
|
|
60
43
|
function _lanesHooks2() {
|
|
61
44
|
const data = require("@teambit/lanes.hooks.use-lane-components");
|
|
62
|
-
|
|
63
45
|
_lanesHooks2 = function () {
|
|
64
46
|
return data;
|
|
65
47
|
};
|
|
66
|
-
|
|
67
48
|
return data;
|
|
68
49
|
}
|
|
69
|
-
|
|
70
50
|
function _scopeUiHooks() {
|
|
71
51
|
const data = require("@teambit/scope.ui.hooks.scope-context");
|
|
72
|
-
|
|
73
52
|
_scopeUiHooks = function () {
|
|
74
53
|
return data;
|
|
75
54
|
};
|
|
76
|
-
|
|
77
55
|
return data;
|
|
78
56
|
}
|
|
79
|
-
|
|
80
57
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
81
|
-
|
|
82
58
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
83
|
-
|
|
84
59
|
const scopeDrawer = ({
|
|
85
60
|
treeWidgets,
|
|
86
61
|
filtersSlot,
|
|
@@ -92,31 +67,29 @@ const scopeDrawer = ({
|
|
|
92
67
|
const children = props.node.children;
|
|
93
68
|
if (!children) return /*#__PURE__*/_react().default.createElement(_uiFoundationUi().ComponentView, (0, _extends2().default)({}, props, {
|
|
94
69
|
treeNodeSlot: treeNodeSlot
|
|
95
|
-
}));
|
|
70
|
+
}));
|
|
96
71
|
|
|
72
|
+
// skip over scope node and render only children
|
|
97
73
|
if (props.node.payload instanceof _uiFoundationUi().ScopePayload) {
|
|
98
74
|
const scopeNameFromNode = props.node.id.slice(0, -1);
|
|
99
75
|
const scope = host === null || host === void 0 ? void 0 : host.name;
|
|
76
|
+
|
|
100
77
|
/**
|
|
101
78
|
* this is only valid when viewing component from a lane
|
|
102
79
|
* if the lane component is from a different scope than the current scope
|
|
103
80
|
* show the scope node
|
|
104
81
|
*/
|
|
105
|
-
|
|
106
82
|
if (scopeNameFromNode !== scope) {
|
|
107
83
|
return /*#__PURE__*/_react().default.createElement(_uiFoundationUi().ScopeTreeNode, props);
|
|
108
84
|
}
|
|
109
|
-
|
|
110
85
|
return /*#__PURE__*/_react().default.createElement(_react().default.Fragment, null, children.map(childNode => /*#__PURE__*/_react().default.createElement(TreeNode, (0, _extends2().default)({
|
|
111
86
|
key: childNode.id
|
|
112
87
|
}, props, {
|
|
113
88
|
node: childNode
|
|
114
89
|
}))));
|
|
115
90
|
}
|
|
116
|
-
|
|
117
91
|
return /*#__PURE__*/_react().default.createElement(_uiFoundationUi().NamespaceTreeNode, props);
|
|
118
92
|
};
|
|
119
|
-
|
|
120
93
|
return new (_componentUi().ComponentsDrawer)({
|
|
121
94
|
assumeScopeInUrl,
|
|
122
95
|
order: 0,
|
|
@@ -136,26 +109,22 @@ const scopeDrawer = ({
|
|
|
136
109
|
transformTree: host => {
|
|
137
110
|
return rootNode => {
|
|
138
111
|
var _rootNode$children;
|
|
139
|
-
|
|
140
112
|
const thisScopeIndex = (_rootNode$children = rootNode.children) === null || _rootNode$children === void 0 ? void 0 : _rootNode$children.findIndex(node => {
|
|
141
113
|
if (!(node.payload instanceof _uiFoundationUi().ScopePayload)) return undefined;
|
|
142
114
|
const scopeNameFromNode = node.id.slice(0, -1);
|
|
143
115
|
return scopeNameFromNode === (host === null || host === void 0 ? void 0 : host.name);
|
|
144
116
|
});
|
|
145
117
|
const thisScope = rootNode.children && thisScopeIndex !== undefined ? rootNode.children[thisScopeIndex] : undefined;
|
|
146
|
-
|
|
147
118
|
if (thisScope && thisScope.children && rootNode.children) {
|
|
148
119
|
delete rootNode.children[thisScopeIndex];
|
|
149
120
|
const children = rootNode.children.concat(thisScope.children);
|
|
150
121
|
rootNode.children = children;
|
|
151
122
|
}
|
|
152
|
-
|
|
153
123
|
return rootNode;
|
|
154
124
|
};
|
|
155
125
|
},
|
|
156
126
|
useComponents: overrideUseComponents || (() => {
|
|
157
127
|
var _lanesModel$viewedLan;
|
|
158
|
-
|
|
159
128
|
const {
|
|
160
129
|
lanesModel,
|
|
161
130
|
loading: lanesLoading
|
|
@@ -167,8 +136,8 @@ const scopeDrawer = ({
|
|
|
167
136
|
} = (0, _lanesHooks2().useLaneComponents)(viewedLaneId !== null && viewedLaneId !== void 0 && viewedLaneId.isDefault() ? undefined : viewedLaneId);
|
|
168
137
|
const {
|
|
169
138
|
components: mainComponents
|
|
170
|
-
} = (0, _react().useContext)(_scopeUiHooks().ScopeContext);
|
|
171
|
-
|
|
139
|
+
} = (0, _react().useContext)(_scopeUiHooks().ScopeContext);
|
|
140
|
+
// lane components + main components
|
|
172
141
|
const components = mergeComponents(mainComponents, laneComponents);
|
|
173
142
|
return {
|
|
174
143
|
loading: lanesLoading || laneCompsLoading,
|
|
@@ -177,9 +146,7 @@ const scopeDrawer = ({
|
|
|
177
146
|
})
|
|
178
147
|
});
|
|
179
148
|
};
|
|
180
|
-
|
|
181
149
|
exports.scopeDrawer = scopeDrawer;
|
|
182
|
-
|
|
183
150
|
function mergeComponents(mainComponents, laneComponents) {
|
|
184
151
|
const mainComponentsThatAreNotOnLane = mainComponents.filter(mainComponent => {
|
|
185
152
|
return !laneComponents.find(laneComponent => laneComponent.id.toStringWithoutVersion() === mainComponent.id.toStringWithoutVersion());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["scopeDrawer","treeWidgets","filtersSlot","drawerWidgetSlot","assumeScopeInUrl","overrideUseComponents","customScopeTreeNodeRenderer","treeNodeSlot","host","TreeNode","props","children","node","payload","ScopePayload","scopeNameFromNode","id","slice","scope","name","map","childNode","ComponentsDrawer","order","plugins","tree","widgets","customRenderer","filters","drawerWidgets","useHost","useScope","emptyMessage","transformTree","rootNode","thisScopeIndex","findIndex","undefined","thisScope","concat","useComponents","lanesModel","loading","lanesLoading","useLanes","viewedLaneId","viewedLane","components","laneComponents","laneCompsLoading","useLaneComponents","isDefault","mainComponents","useContext","ScopeContext","mergeComponents","mainComponentsThatAreNotOnLane","filter","mainComponent","find","laneComponent","toStringWithoutVersion"],"sources":["scope.ui.drawer.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { ComponentsDrawer, ComponentFiltersSlot, DrawerWidgetSlot } from '@teambit/component.ui.component-drawer';\nimport {\n ComponentView,\n NamespaceTreeNode,\n PayloadType,\n ScopePayload,\n ScopeTreeNode,\n} from '@teambit/ui-foundation.ui.side-bar';\nimport { TreeNode as TreeNodeType, TreeNodeProps } from '@teambit/design.ui.tree';\nimport { useLanes } from '@teambit/lanes.hooks.use-lanes';\nimport { useLaneComponents } from '@teambit/lanes.hooks.use-lane-components';\nimport { ComponentModel } from '@teambit/component';\nimport { useScope, ScopeContext } from '@teambit/scope.ui.hooks.scope-context';\n// import { WorkspaceModel } from '@teambit/workspace';\nimport { SidebarSlot } from './scope.ui.runtime';\n\nexport type ScopeDrawerProps = {\n treeWidgets: SidebarSlot;\n filtersSlot: ComponentFiltersSlot;\n drawerWidgetSlot: DrawerWidgetSlot;\n assumeScopeInUrl?: boolean;\n overrideUseComponents?: () => { components: ComponentModel[] };\n};\n\nexport const scopeDrawer = ({\n treeWidgets,\n filtersSlot,\n drawerWidgetSlot,\n assumeScopeInUrl = false,\n overrideUseComponents,\n}: ScopeDrawerProps) => {\n const customScopeTreeNodeRenderer = (treeNodeSlot, host?: any) =>\n function TreeNode(props: TreeNodeProps<PayloadType>) {\n const children = props.node.children;\n\n if (!children) return <ComponentView {...props} treeNodeSlot={treeNodeSlot} />;\n\n // skip over scope node and render only children\n if (props.node.payload instanceof ScopePayload) {\n const scopeNameFromNode = props.node.id.slice(0, -1);\n const scope = host?.name;\n\n /**\n * this is only valid when viewing component from a lane\n * if the lane component is from a different scope than the current scope\n * show the scope node\n */\n if (scopeNameFromNode !== scope) {\n return <ScopeTreeNode {...props} />;\n }\n\n return (\n <>\n {children.map((childNode) => (\n <TreeNode key={childNode.id} {...props} node={childNode}></TreeNode>\n ))}\n </>\n );\n }\n\n return <NamespaceTreeNode {...props} />;\n };\n\n return new ComponentsDrawer({\n assumeScopeInUrl,\n order: 0,\n id: 'scope-components-drawer',\n name: 'COMPONENTS',\n plugins: {\n tree: {\n widgets: treeWidgets,\n customRenderer: customScopeTreeNodeRenderer,\n },\n filters: filtersSlot,\n drawerWidgets: drawerWidgetSlot,\n },\n useHost: () => useScope(),\n emptyMessage: 'Scope is empty',\n // TODO: create an interface for Component host.\n transformTree: (host?: any) => {\n return (rootNode: TreeNodeType) => {\n const thisScopeIndex = rootNode.children?.findIndex((node) => {\n if (!(node.payload instanceof ScopePayload)) return undefined;\n const scopeNameFromNode = node.id.slice(0, -1);\n return scopeNameFromNode === host?.name;\n });\n\n const thisScope =\n rootNode.children && thisScopeIndex !== undefined ? rootNode.children[thisScopeIndex] : undefined;\n\n if (thisScope && thisScope.children && rootNode.children) {\n delete rootNode.children[thisScopeIndex as number];\n const children = rootNode.children.concat(thisScope.children);\n rootNode.children = children;\n }\n\n return rootNode;\n };\n },\n useComponents:\n overrideUseComponents ||\n (() => {\n const { lanesModel, loading: lanesLoading } = useLanes();\n const viewedLaneId = lanesModel?.viewedLane?.id;\n\n const { components: laneComponents = [], loading: laneCompsLoading } = useLaneComponents(\n viewedLaneId?.isDefault() ? undefined : viewedLaneId\n );\n const { components: mainComponents } = useContext(ScopeContext);\n // lane components + main components\n const components = mergeComponents(mainComponents, laneComponents);\n\n return {\n loading: lanesLoading || laneCompsLoading,\n components,\n };\n }),\n });\n};\n\nfunction mergeComponents(mainComponents: ComponentModel[], laneComponents: ComponentModel[]): ComponentModel[] {\n const mainComponentsThatAreNotOnLane = mainComponents.filter((mainComponent) => {\n return !laneComponents.find(\n (laneComponent) => laneComponent.id.toStringWithoutVersion() === mainComponent.id.toStringWithoutVersion()\n );\n });\n return laneComponents.concat(mainComponentsThatAreNotOnLane);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["scopeDrawer","treeWidgets","filtersSlot","drawerWidgetSlot","assumeScopeInUrl","overrideUseComponents","customScopeTreeNodeRenderer","treeNodeSlot","host","TreeNode","props","children","node","payload","ScopePayload","scopeNameFromNode","id","slice","scope","name","map","childNode","ComponentsDrawer","order","plugins","tree","widgets","customRenderer","filters","drawerWidgets","useHost","useScope","emptyMessage","transformTree","rootNode","thisScopeIndex","findIndex","undefined","thisScope","concat","useComponents","lanesModel","loading","lanesLoading","useLanes","viewedLaneId","viewedLane","components","laneComponents","laneCompsLoading","useLaneComponents","isDefault","mainComponents","useContext","ScopeContext","mergeComponents","mainComponentsThatAreNotOnLane","filter","mainComponent","find","laneComponent","toStringWithoutVersion"],"sources":["scope.ui.drawer.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { ComponentsDrawer, ComponentFiltersSlot, DrawerWidgetSlot } from '@teambit/component.ui.component-drawer';\nimport {\n ComponentView,\n NamespaceTreeNode,\n PayloadType,\n ScopePayload,\n ScopeTreeNode,\n} from '@teambit/ui-foundation.ui.side-bar';\nimport { TreeNode as TreeNodeType, TreeNodeProps } from '@teambit/design.ui.tree';\nimport { useLanes } from '@teambit/lanes.hooks.use-lanes';\nimport { useLaneComponents } from '@teambit/lanes.hooks.use-lane-components';\nimport { ComponentModel } from '@teambit/component';\nimport { useScope, ScopeContext } from '@teambit/scope.ui.hooks.scope-context';\n// import { WorkspaceModel } from '@teambit/workspace';\nimport { SidebarSlot } from './scope.ui.runtime';\n\nexport type ScopeDrawerProps = {\n treeWidgets: SidebarSlot;\n filtersSlot: ComponentFiltersSlot;\n drawerWidgetSlot: DrawerWidgetSlot;\n assumeScopeInUrl?: boolean;\n overrideUseComponents?: () => { components: ComponentModel[] };\n};\n\nexport const scopeDrawer = ({\n treeWidgets,\n filtersSlot,\n drawerWidgetSlot,\n assumeScopeInUrl = false,\n overrideUseComponents,\n}: ScopeDrawerProps) => {\n const customScopeTreeNodeRenderer = (treeNodeSlot, host?: any) =>\n function TreeNode(props: TreeNodeProps<PayloadType>) {\n const children = props.node.children;\n\n if (!children) return <ComponentView {...props} treeNodeSlot={treeNodeSlot} />;\n\n // skip over scope node and render only children\n if (props.node.payload instanceof ScopePayload) {\n const scopeNameFromNode = props.node.id.slice(0, -1);\n const scope = host?.name;\n\n /**\n * this is only valid when viewing component from a lane\n * if the lane component is from a different scope than the current scope\n * show the scope node\n */\n if (scopeNameFromNode !== scope) {\n return <ScopeTreeNode {...props} />;\n }\n\n return (\n <>\n {children.map((childNode) => (\n <TreeNode key={childNode.id} {...props} node={childNode}></TreeNode>\n ))}\n </>\n );\n }\n\n return <NamespaceTreeNode {...props} />;\n };\n\n return new ComponentsDrawer({\n assumeScopeInUrl,\n order: 0,\n id: 'scope-components-drawer',\n name: 'COMPONENTS',\n plugins: {\n tree: {\n widgets: treeWidgets,\n customRenderer: customScopeTreeNodeRenderer,\n },\n filters: filtersSlot,\n drawerWidgets: drawerWidgetSlot,\n },\n useHost: () => useScope(),\n emptyMessage: 'Scope is empty',\n // TODO: create an interface for Component host.\n transformTree: (host?: any) => {\n return (rootNode: TreeNodeType) => {\n const thisScopeIndex = rootNode.children?.findIndex((node) => {\n if (!(node.payload instanceof ScopePayload)) return undefined;\n const scopeNameFromNode = node.id.slice(0, -1);\n return scopeNameFromNode === host?.name;\n });\n\n const thisScope =\n rootNode.children && thisScopeIndex !== undefined ? rootNode.children[thisScopeIndex] : undefined;\n\n if (thisScope && thisScope.children && rootNode.children) {\n delete rootNode.children[thisScopeIndex as number];\n const children = rootNode.children.concat(thisScope.children);\n rootNode.children = children;\n }\n\n return rootNode;\n };\n },\n useComponents:\n overrideUseComponents ||\n (() => {\n const { lanesModel, loading: lanesLoading } = useLanes();\n const viewedLaneId = lanesModel?.viewedLane?.id;\n\n const { components: laneComponents = [], loading: laneCompsLoading } = useLaneComponents(\n viewedLaneId?.isDefault() ? undefined : viewedLaneId\n );\n const { components: mainComponents } = useContext(ScopeContext);\n // lane components + main components\n const components = mergeComponents(mainComponents, laneComponents);\n\n return {\n loading: lanesLoading || laneCompsLoading,\n components,\n };\n }),\n });\n};\n\nfunction mergeComponents(mainComponents: ComponentModel[], laneComponents: ComponentModel[]): ComponentModel[] {\n const mainComponentsThatAreNotOnLane = mainComponents.filter((mainComponent) => {\n return !laneComponents.find(\n (laneComponent) => laneComponent.id.toStringWithoutVersion() === mainComponent.id.toStringWithoutVersion()\n );\n });\n return laneComponents.concat(mainComponentsThatAreNotOnLane);\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAQA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA+E;AAAA;AAYxE,MAAMA,WAAW,GAAG,CAAC;EAC1BC,WAAW;EACXC,WAAW;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AU,EAAEC,cAAc,GAAG,EAAE;QAAEN,OAAO,EAAEO;MAAiB,CAAC,GAAG,IAAAC,gCAAiB,EACtFL,YAAY,aAAZA,YAAY,eAAZA,YAAY,CAAEM,SAAS,EAAE,GAAGd,SAAS,GAAGQ,YAAY,CACrD;MACD,MAAM;QAAEE,UAAU,EAAEK;MAAe,CAAC,GAAG,IAAAC,mBAAU,EAACC,4BAAY,CAAC;MAC/D;MACA,MAAMP,UAAU,GAAGQ,eAAe,CAACH,cAAc,EAAEJ,cAAc,CAAC;MAElE,OAAO;QACLN,OAAO,EAAEC,YAAY,IAAIM,gBAAgB;QACzCF;MACF,CAAC;IACH,CAAC;EACL,CAAC,CAAC;AACJ,CAAC;AAAC;AAEF,SAASQ,eAAe,CAACH,cAAgC,EAAEJ,cAAgC,EAAoB;EAC7G,MAAMQ,8BAA8B,GAAGJ,cAAc,CAACK,MAAM,CAAEC,aAAa,IAAK;IAC9E,OAAO,CAACV,cAAc,CAACW,IAAI,CACxBC,aAAa,IAAKA,aAAa,CAAC5C,EAAE,CAAC6C,sBAAsB,EAAE,KAAKH,aAAa,CAAC1C,EAAE,CAAC6C,sBAAsB,EAAE,CAC3G;EACH,CAAC,CAAC;EACF,OAAOb,cAAc,CAACT,MAAM,CAACiB,8BAA8B,CAAC;AAC9D"}
|
package/dist/scope.ui.runtime.js
CHANGED
|
@@ -1,198 +1,139 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.array.sort.js");
|
|
8
|
-
|
|
9
6
|
require("core-js/modules/es.promise.js");
|
|
10
|
-
|
|
11
7
|
Object.defineProperty(exports, "__esModule", {
|
|
12
8
|
value: true
|
|
13
9
|
});
|
|
14
10
|
exports.default = exports.ScopeUI = void 0;
|
|
15
|
-
|
|
16
11
|
function _defineProperty2() {
|
|
17
12
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
18
|
-
|
|
19
13
|
_defineProperty2 = function () {
|
|
20
14
|
return data;
|
|
21
15
|
};
|
|
22
|
-
|
|
23
16
|
return data;
|
|
24
17
|
}
|
|
25
|
-
|
|
26
18
|
function _lodash() {
|
|
27
19
|
const data = require("lodash");
|
|
28
|
-
|
|
29
20
|
_lodash = function () {
|
|
30
21
|
return data;
|
|
31
22
|
};
|
|
32
|
-
|
|
33
23
|
return data;
|
|
34
24
|
}
|
|
35
|
-
|
|
36
25
|
function _component() {
|
|
37
26
|
const data = require("@teambit/component");
|
|
38
|
-
|
|
39
27
|
_component = function () {
|
|
40
28
|
return data;
|
|
41
29
|
};
|
|
42
|
-
|
|
43
30
|
return data;
|
|
44
31
|
}
|
|
45
|
-
|
|
46
32
|
function _harmony() {
|
|
47
33
|
const data = require("@teambit/harmony");
|
|
48
|
-
|
|
49
34
|
_harmony = function () {
|
|
50
35
|
return data;
|
|
51
36
|
};
|
|
52
|
-
|
|
53
37
|
return data;
|
|
54
38
|
}
|
|
55
|
-
|
|
56
39
|
function _sidebar() {
|
|
57
40
|
const data = require("@teambit/sidebar");
|
|
58
|
-
|
|
59
41
|
_sidebar = function () {
|
|
60
42
|
return data;
|
|
61
43
|
};
|
|
62
|
-
|
|
63
44
|
return data;
|
|
64
45
|
}
|
|
65
|
-
|
|
66
46
|
function _ui() {
|
|
67
47
|
const data = require("@teambit/ui");
|
|
68
|
-
|
|
69
48
|
_ui = function () {
|
|
70
49
|
return data;
|
|
71
50
|
};
|
|
72
|
-
|
|
73
51
|
return data;
|
|
74
52
|
}
|
|
75
|
-
|
|
76
53
|
function _react() {
|
|
77
54
|
const data = _interopRequireDefault(require("react"));
|
|
78
|
-
|
|
79
55
|
_react = function () {
|
|
80
56
|
return data;
|
|
81
57
|
};
|
|
82
|
-
|
|
83
58
|
return data;
|
|
84
59
|
}
|
|
85
|
-
|
|
86
60
|
function _designUiSurfacesMenu() {
|
|
87
61
|
const data = require("@teambit/design.ui.surfaces.menu.link-item");
|
|
88
|
-
|
|
89
62
|
_designUiSurfacesMenu = function () {
|
|
90
63
|
return data;
|
|
91
64
|
};
|
|
92
|
-
|
|
93
65
|
return data;
|
|
94
66
|
}
|
|
95
|
-
|
|
96
67
|
function _commandBar() {
|
|
97
68
|
const data = _interopRequireDefault(require("@teambit/command-bar"));
|
|
98
|
-
|
|
99
69
|
_commandBar = function () {
|
|
100
70
|
return data;
|
|
101
71
|
};
|
|
102
|
-
|
|
103
72
|
return data;
|
|
104
73
|
}
|
|
105
|
-
|
|
106
74
|
function _componentUi() {
|
|
107
75
|
const data = require("@teambit/component.ui.component-drawer");
|
|
108
|
-
|
|
109
76
|
_componentUi = function () {
|
|
110
77
|
return data;
|
|
111
78
|
};
|
|
112
|
-
|
|
113
79
|
return data;
|
|
114
80
|
}
|
|
115
|
-
|
|
116
81
|
function _componentUiComponentFilters() {
|
|
117
82
|
const data = require("@teambit/component.ui.component-filters.deprecate-filter");
|
|
118
|
-
|
|
119
83
|
_componentUiComponentFilters = function () {
|
|
120
84
|
return data;
|
|
121
85
|
};
|
|
122
|
-
|
|
123
86
|
return data;
|
|
124
87
|
}
|
|
125
|
-
|
|
126
88
|
function _componentUiComponentFilters2() {
|
|
127
89
|
const data = require("@teambit/component.ui.component-filters.env-filter");
|
|
128
|
-
|
|
129
90
|
_componentUiComponentFilters2 = function () {
|
|
130
91
|
return data;
|
|
131
92
|
};
|
|
132
|
-
|
|
133
93
|
return data;
|
|
134
94
|
}
|
|
135
|
-
|
|
136
95
|
function _componentModules() {
|
|
137
96
|
const data = require("@teambit/component.modules.component-url");
|
|
138
|
-
|
|
139
97
|
_componentModules = function () {
|
|
140
98
|
return data;
|
|
141
99
|
};
|
|
142
|
-
|
|
143
100
|
return data;
|
|
144
101
|
}
|
|
145
|
-
|
|
146
102
|
function _componentUiComponentFilters3() {
|
|
147
103
|
const data = require("@teambit/component.ui.component-filters.show-main-filter");
|
|
148
|
-
|
|
149
104
|
_componentUiComponentFilters3 = function () {
|
|
150
105
|
return data;
|
|
151
106
|
};
|
|
152
|
-
|
|
153
107
|
return data;
|
|
154
108
|
}
|
|
155
|
-
|
|
156
109
|
function _menu() {
|
|
157
110
|
const data = require("./ui/menu");
|
|
158
|
-
|
|
159
111
|
_menu = function () {
|
|
160
112
|
return data;
|
|
161
113
|
};
|
|
162
|
-
|
|
163
114
|
return data;
|
|
164
115
|
}
|
|
165
|
-
|
|
166
116
|
function _scope() {
|
|
167
117
|
const data = require("./scope.aspect");
|
|
168
|
-
|
|
169
118
|
_scope = function () {
|
|
170
119
|
return data;
|
|
171
120
|
};
|
|
172
|
-
|
|
173
121
|
return data;
|
|
174
122
|
}
|
|
175
|
-
|
|
176
123
|
function _scope2() {
|
|
177
124
|
const data = require("./ui/scope");
|
|
178
|
-
|
|
179
125
|
_scope2 = function () {
|
|
180
126
|
return data;
|
|
181
127
|
};
|
|
182
|
-
|
|
183
128
|
return data;
|
|
184
129
|
}
|
|
185
|
-
|
|
186
130
|
function _scopeUi() {
|
|
187
131
|
const data = require("./scope.ui.drawer");
|
|
188
|
-
|
|
189
132
|
_scopeUi = function () {
|
|
190
133
|
return data;
|
|
191
134
|
};
|
|
192
|
-
|
|
193
135
|
return data;
|
|
194
136
|
}
|
|
195
|
-
|
|
196
137
|
class ScopeUI {
|
|
197
138
|
constructor(
|
|
198
139
|
/**
|
|
@@ -277,7 +218,6 @@ class ScopeUI {
|
|
|
277
218
|
keyChar: 'mod+k',
|
|
278
219
|
handler: () => {
|
|
279
220
|
var _this$commandBarUI;
|
|
280
|
-
|
|
281
221
|
return (_this$commandBarUI = this.commandBarUI) === null || _this$commandBarUI === void 0 ? void 0 : _this$commandBarUI.run('command-bar.open');
|
|
282
222
|
}
|
|
283
223
|
}, {
|
|
@@ -286,12 +226,10 @@ class ScopeUI {
|
|
|
286
226
|
keyChar: 'alt+s',
|
|
287
227
|
handler: () => {
|
|
288
228
|
var _this$commandBarUI2;
|
|
289
|
-
|
|
290
229
|
return (_this$commandBarUI2 = this.commandBarUI) === null || _this$commandBarUI2 === void 0 ? void 0 : _this$commandBarUI2.run('sidebar.toggle');
|
|
291
230
|
}
|
|
292
231
|
}]);
|
|
293
232
|
}
|
|
294
|
-
|
|
295
233
|
/**
|
|
296
234
|
* register a new badge into the scope overview.
|
|
297
235
|
*/
|
|
@@ -299,7 +237,6 @@ class ScopeUI {
|
|
|
299
237
|
this.scopeBadgeSlot.register(badges);
|
|
300
238
|
return this;
|
|
301
239
|
}
|
|
302
|
-
|
|
303
240
|
getScope(options) {
|
|
304
241
|
return /*#__PURE__*/_react().default.createElement(_scope2().Scope, {
|
|
305
242
|
TargetScopeOverview: options.TargetScopeOverview,
|
|
@@ -321,25 +258,22 @@ class ScopeUI {
|
|
|
321
258
|
PaneWrapper: options.PaneWrapper
|
|
322
259
|
});
|
|
323
260
|
}
|
|
261
|
+
|
|
324
262
|
/**
|
|
325
263
|
* register a new line beneath the scope overview section.
|
|
326
264
|
*/
|
|
327
|
-
|
|
328
|
-
|
|
329
265
|
registerOverviewLine(...lines) {
|
|
330
266
|
this.overviewSlot.register(lines);
|
|
331
267
|
return this;
|
|
332
268
|
}
|
|
269
|
+
|
|
333
270
|
/**
|
|
334
271
|
* register a route to the scope.
|
|
335
272
|
*/
|
|
336
|
-
|
|
337
|
-
|
|
338
273
|
registerRoutes(routes) {
|
|
339
274
|
this.routeSlot.register(routes);
|
|
340
275
|
return this;
|
|
341
276
|
}
|
|
342
|
-
|
|
343
277
|
applyMenuRoutes() {
|
|
344
278
|
this.registerMenuRoutes([{
|
|
345
279
|
path: this.componentUi.routePath,
|
|
@@ -349,14 +283,12 @@ class ScopeUI {
|
|
|
349
283
|
element: this.getScopeMenu()
|
|
350
284
|
}]);
|
|
351
285
|
}
|
|
352
|
-
|
|
353
286
|
getScopeMenu() {
|
|
354
287
|
return /*#__PURE__*/_react().default.createElement(_menu().ScopeMenu, {
|
|
355
288
|
widgetSlot: this.menuWidgetSlot,
|
|
356
289
|
menuItemSlot: this.menuItemSlot
|
|
357
290
|
});
|
|
358
291
|
}
|
|
359
|
-
|
|
360
292
|
registerExplicitRoutes() {
|
|
361
293
|
this.applyMenuRoutes();
|
|
362
294
|
this.registerRoutes([{
|
|
@@ -364,72 +296,59 @@ class ScopeUI {
|
|
|
364
296
|
element: this.componentUi.getComponentUI(_scope().ScopeAspect.id)
|
|
365
297
|
}]);
|
|
366
298
|
}
|
|
367
|
-
|
|
368
299
|
registerMenuWidget(...menuItems) {
|
|
369
300
|
this.menuWidgetSlot.register(menuItems);
|
|
370
301
|
}
|
|
371
|
-
|
|
372
302
|
registerCorner(corner) {
|
|
373
303
|
this.cornerSlot.register(corner);
|
|
374
304
|
}
|
|
375
|
-
|
|
376
305
|
registerComponentUrl(func) {
|
|
377
306
|
this.componentUrlFunc = func;
|
|
378
307
|
}
|
|
308
|
+
|
|
379
309
|
/**
|
|
380
310
|
* register a scope overview.
|
|
381
311
|
*/
|
|
382
|
-
|
|
383
|
-
|
|
384
312
|
replaceOverview() {}
|
|
313
|
+
|
|
385
314
|
/**
|
|
386
315
|
* register description.
|
|
387
316
|
*/
|
|
388
|
-
|
|
389
|
-
|
|
390
317
|
replaceDescription() {}
|
|
318
|
+
|
|
391
319
|
/**
|
|
392
320
|
* register metadata section.
|
|
393
321
|
*/
|
|
394
|
-
|
|
395
|
-
|
|
396
322
|
replaceMetadataSection() {}
|
|
323
|
+
|
|
397
324
|
/**
|
|
398
325
|
* register a metadata item.
|
|
399
326
|
*/
|
|
400
|
-
|
|
401
|
-
|
|
402
327
|
registerMetadataItem() {}
|
|
403
|
-
|
|
404
328
|
replaceComponentGrid() {}
|
|
329
|
+
|
|
405
330
|
/**
|
|
406
331
|
* register metadata.
|
|
407
332
|
*/
|
|
408
|
-
|
|
409
|
-
|
|
410
333
|
registerMetadata() {}
|
|
334
|
+
|
|
411
335
|
/**
|
|
412
336
|
* add a new context to the scope.
|
|
413
337
|
*/
|
|
414
|
-
|
|
415
|
-
|
|
416
338
|
addContext(...context) {
|
|
417
339
|
this.contextSlot.register(context);
|
|
418
340
|
return this;
|
|
419
341
|
}
|
|
420
|
-
|
|
421
342
|
getContext() {
|
|
422
|
-
const contexts = this.contextSlot.values();
|
|
423
|
-
|
|
343
|
+
const contexts = this.contextSlot.values();
|
|
344
|
+
// eslint-disable-next-line react/prop-types
|
|
424
345
|
const ComponentUrlFuncProvider = ({
|
|
425
346
|
children
|
|
426
347
|
}) => /*#__PURE__*/_react().default.createElement(_componentModules().ComponentUrlProvider, {
|
|
427
348
|
value: this.componentUrlFunc
|
|
428
349
|
}, children);
|
|
429
|
-
|
|
430
350
|
return (0, _lodash().flatten)(contexts).concat(ComponentUrlFuncProvider);
|
|
431
351
|
}
|
|
432
|
-
|
|
433
352
|
registerDefaultDrawers(assumeScopeInUrl = false, overrideUseComponents) {
|
|
434
353
|
this.sidebar.registerDrawer((0, _scopeUi().scopeDrawer)({
|
|
435
354
|
treeWidgets: this.sidebarSlot,
|
|
@@ -439,7 +358,6 @@ class ScopeUI {
|
|
|
439
358
|
overrideUseComponents
|
|
440
359
|
}));
|
|
441
360
|
}
|
|
442
|
-
|
|
443
361
|
uiRoot() {
|
|
444
362
|
this.registerDefaultDrawers();
|
|
445
363
|
const [setKeyBindHandler] = this.commandBarUI.addCommand({
|
|
@@ -469,7 +387,6 @@ class ScopeUI {
|
|
|
469
387
|
}]
|
|
470
388
|
};
|
|
471
389
|
}
|
|
472
|
-
|
|
473
390
|
listSidebarLinks() {
|
|
474
391
|
const links = (0, _lodash().flatten)(this.sidebarItemSlot.values());
|
|
475
392
|
const sorted = links.sort((a, b) => {
|
|
@@ -481,8 +398,8 @@ class ScopeUI {
|
|
|
481
398
|
return link.component;
|
|
482
399
|
}));
|
|
483
400
|
}
|
|
484
|
-
/** registers available components */
|
|
485
401
|
|
|
402
|
+
/** registers available components */
|
|
486
403
|
|
|
487
404
|
static async provider([ui, componentUi, sidebar, commandBarUI], config, [routeSlot, menuSlot, sidebarSlot, scopeBadgeSlot, menuWidgetSlot, menuItemSlot, sidebarItemSlot, cornerSlot, overviewSlot, contextSlot, drawerWidgetSlot, componentFiltersSlot]) {
|
|
488
405
|
const scopeUi = new ScopeUI(routeSlot, componentUi, menuSlot, sidebar, sidebarSlot, commandBarUI, scopeBadgeSlot, menuWidgetSlot, sidebarItemSlot, menuItemSlot, cornerSlot, overviewSlot, contextSlot, drawerWidgetSlot, componentFiltersSlot);
|
|
@@ -507,9 +424,7 @@ class ScopeUI {
|
|
|
507
424
|
if (ui) scopeUi.registerExplicitRoutes();
|
|
508
425
|
return scopeUi;
|
|
509
426
|
}
|
|
510
|
-
|
|
511
427
|
}
|
|
512
|
-
|
|
513
428
|
exports.ScopeUI = ScopeUI;
|
|
514
429
|
(0, _defineProperty2().default)(ScopeUI, "dependencies", [_ui().UIAspect, _component().ComponentAspect, _sidebar().SidebarAspect, _commandBar().default]);
|
|
515
430
|
(0, _defineProperty2().default)(ScopeUI, "runtime", _ui().UIRuntime);
|
|
@@ -519,7 +434,6 @@ exports.ScopeUI = ScopeUI;
|
|
|
519
434
|
});
|
|
520
435
|
var _default = ScopeUI;
|
|
521
436
|
exports.default = _default;
|
|
522
|
-
|
|
523
437
|
_scope().ScopeAspect.addRuntime(ScopeUI);
|
|
524
438
|
|
|
525
439
|
//# sourceMappingURL=scope.ui.runtime.js.map
|