@teambit/component 0.0.881 → 0.0.882
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/aspect-entry.js +3 -16
- package/dist/aspect-entry.js.map +1 -1
- package/dist/aspect-list.js +6 -35
- package/dist/aspect-list.js.map +1 -1
- package/dist/aspect.section.js +0 -16
- package/dist/aspect.section.js.map +1 -1
- package/dist/component-fs.js +2 -25
- package/dist/component-fs.js.map +1 -1
- package/dist/component-map/component-map.js +10 -26
- package/dist/component-map/component-map.js.map +1 -1
- package/dist/component-map/index.js +0 -3
- package/dist/component-map/index.js.map +1 -1
- package/dist/component-meta.js +1 -14
- package/dist/component-meta.js.map +1 -1
- package/dist/component.aspect.js +0 -5
- package/dist/component.aspect.js.map +1 -1
- package/dist/component.composition.js +0 -6
- package/dist/component.composition.js.map +1 -1
- package/dist/component.graphql.js +2 -26
- package/dist/component.graphql.js.map +1 -1
- package/dist/component.js +19 -90
- package/dist/component.js.map +1 -1
- package/dist/component.main.runtime.js +6 -64
- package/dist/component.main.runtime.js.map +1 -1
- package/dist/component.route.js +2 -14
- package/dist/component.route.js.map +1 -1
- package/dist/component.ui.runtime.js +3 -83
- package/dist/component.ui.runtime.js.map +1 -1
- package/dist/config.js +0 -3
- package/dist/config.js.map +1 -1
- package/dist/dependencies/dependencies.js +7 -32
- package/dist/dependencies/dependencies.js.map +1 -1
- package/dist/dependencies/index.js +0 -3
- package/dist/dependencies/index.js.map +1 -1
- package/dist/exceptions/could-not-find-latest.js +0 -4
- package/dist/exceptions/could-not-find-latest.js.map +1 -1
- package/dist/exceptions/host-not-found.js +0 -4
- package/dist/exceptions/host-not-found.js.map +1 -1
- package/dist/exceptions/index.js +0 -13
- package/dist/exceptions/index.js.map +1 -1
- package/dist/exceptions/main-file-not-found.js +0 -4
- package/dist/exceptions/main-file-not-found.js.map +1 -1
- package/dist/exceptions/nothing-to-snap.js +0 -2
- package/dist/exceptions/nothing-to-snap.js.map +1 -1
- package/dist/history-graph.js +0 -2
- package/dist/history-graph.js.map +1 -1
- package/dist/host/component-host-model.js +0 -7
- package/dist/host/component-host-model.js.map +1 -1
- package/dist/host/index.js +0 -5
- package/dist/host/index.js.map +1 -1
- package/dist/host/use-component-host.js +0 -14
- package/dist/host/use-component-host.js.map +1 -1
- package/dist/index.js +0 -63
- package/dist/index.js.map +1 -1
- package/dist/section/index.js +0 -3
- package/dist/section/index.js.map +1 -1
- package/dist/show/extensions.fragment.js +0 -8
- package/dist/show/extensions.fragment.js.map +1 -1
- package/dist/show/files.fragment.js +0 -11
- package/dist/show/files.fragment.js.map +1 -1
- package/dist/show/id.fragment.js +0 -10
- package/dist/show/id.fragment.js.map +1 -1
- package/dist/show/index.js +0 -24
- package/dist/show/index.js.map +1 -1
- package/dist/show/main-file.fragment.js +0 -9
- package/dist/show/main-file.fragment.js.map +1 -1
- package/dist/show/name.fragment.js +0 -9
- package/dist/show/name.fragment.js.map +1 -1
- package/dist/show/scope.fragment.js +0 -10
- package/dist/show/scope.fragment.js.map +1 -1
- package/dist/show/show.cmd.js +1 -33
- package/dist/show/show.cmd.js.map +1 -1
- package/dist/snap/index.js +0 -6
- package/dist/snap/index.js.map +1 -1
- package/dist/snap/snap.js +0 -5
- package/dist/snap/snap.js.map +1 -1
- package/dist/state.js +6 -24
- package/dist/state.js.map +1 -1
- package/dist/store.js +0 -5
- package/dist/store.js.map +1 -1
- package/dist/tag/index.js +0 -3
- package/dist/tag/index.js.map +1 -1
- package/dist/tag/tag.js +1 -9
- package/dist/tag/tag.js.map +1 -1
- package/dist/tag-map.js +4 -28
- package/dist/tag-map.js.map +1 -1
- package/dist/ui/aspect-page/aspect-page.js +2 -35
- package/dist/ui/aspect-page/aspect-page.js.map +1 -1
- package/dist/ui/aspect-page/index.js +0 -3
- package/dist/ui/aspect-page/index.js.map +1 -1
- package/dist/ui/component-error/component-error.js +0 -14
- package/dist/ui/component-error/component-error.js.map +1 -1
- package/dist/ui/component-error/index.js +0 -3
- package/dist/ui/component-error/index.js.map +1 -1
- package/dist/ui/component-model/component-model.js +2 -21
- package/dist/ui/component-model/component-model.js.map +1 -1
- package/dist/ui/component-model/index.js +0 -3
- package/dist/ui/component-model/index.js.map +1 -1
- package/dist/ui/component-searcher/component-result.js +0 -20
- package/dist/ui/component-searcher/component-result.js.map +1 -1
- package/dist/ui/component-searcher/component-searcher.js +0 -22
- package/dist/ui/component-searcher/component-searcher.js.map +1 -1
- package/dist/ui/component-searcher/index.js +0 -3
- package/dist/ui/component-searcher/index.js.map +1 -1
- package/dist/ui/component.js +5 -40
- package/dist/ui/component.js.map +1 -1
- package/dist/ui/context/component-context.js +0 -9
- package/dist/ui/context/component-context.js.map +1 -1
- package/dist/ui/context/component-provider.js +0 -9
- package/dist/ui/context/component-provider.js.map +1 -1
- package/dist/ui/context/index.js +0 -6
- package/dist/ui/context/index.js.map +1 -1
- package/dist/ui/index.js +0 -21
- package/dist/ui/index.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-nav.js +4 -23
- package/dist/ui/menu/menu-nav.js.map +1 -1
- package/dist/ui/menu/menu.js +0 -70
- package/dist/ui/menu/menu.js.map +1 -1
- package/dist/ui/menu/mobile-menu-nav.js +6 -49
- package/dist/ui/menu/mobile-menu-nav.js.map +1 -1
- package/dist/ui/top-bar-nav/index.js +0 -2
- package/dist/ui/top-bar-nav/index.js.map +1 -1
- package/dist/ui/top-bar-nav/top-bar-nav.js +8 -32
- package/dist/ui/top-bar-nav/top-bar-nav.js.map +1 -1
- package/dist/ui/use-component-from-location.js +0 -9
- package/dist/ui/use-component-from-location.js.map +1 -1
- package/dist/ui/use-component-query.js +12 -60
- package/dist/ui/use-component-query.js.map +1 -1
- package/dist/ui/use-component.js +0 -11
- package/dist/ui/use-component.js.map +1 -1
- package/package-tar/teambit-component-0.0.882.tgz +0 -0
- package/package.json +12 -12
- package/{preview-1666409808293.js → preview-1666496165706.js} +2 -2
- package/package-tar/teambit-component-0.0.881.tgz +0 -0
|
@@ -1,52 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
require("core-js/modules/es.symbol.description.js");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.ComponentModel = void 0;
|
|
9
|
-
|
|
10
8
|
function _compositions() {
|
|
11
9
|
const data = require("@teambit/compositions");
|
|
12
|
-
|
|
13
10
|
_compositions = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
function _componentId() {
|
|
21
16
|
const data = require("@teambit/component-id");
|
|
22
|
-
|
|
23
17
|
_componentId = function () {
|
|
24
18
|
return data;
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
return data;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
function _tag() {
|
|
31
23
|
const data = require("../../tag");
|
|
32
|
-
|
|
33
24
|
_tag = function () {
|
|
34
25
|
return data;
|
|
35
26
|
};
|
|
36
|
-
|
|
37
27
|
return data;
|
|
38
28
|
}
|
|
39
|
-
|
|
40
29
|
function _tagMap() {
|
|
41
30
|
const data = require("../../tag-map");
|
|
42
|
-
|
|
43
31
|
_tagMap = function () {
|
|
44
32
|
return data;
|
|
45
33
|
};
|
|
46
|
-
|
|
47
34
|
return data;
|
|
48
35
|
}
|
|
49
|
-
|
|
50
36
|
class ComponentModel {
|
|
51
37
|
constructor(
|
|
52
38
|
/**
|
|
@@ -100,6 +86,7 @@ class ComponentModel {
|
|
|
100
86
|
/**
|
|
101
87
|
* description of the component.
|
|
102
88
|
*/
|
|
89
|
+
|
|
103
90
|
description = '', labels = [],
|
|
104
91
|
/**
|
|
105
92
|
* host of the component
|
|
@@ -134,16 +121,14 @@ class ComponentModel {
|
|
|
134
121
|
this.preview = preview;
|
|
135
122
|
this.logs = logs;
|
|
136
123
|
}
|
|
137
|
-
|
|
138
124
|
get version() {
|
|
139
125
|
if (!this.id.version) return 'new';
|
|
140
126
|
return this.id.version;
|
|
141
127
|
}
|
|
128
|
+
|
|
142
129
|
/**
|
|
143
130
|
* create an instance of a component from a plain object.
|
|
144
131
|
*/
|
|
145
|
-
|
|
146
|
-
|
|
147
132
|
static from({
|
|
148
133
|
id,
|
|
149
134
|
server,
|
|
@@ -167,11 +152,9 @@ class ComponentModel {
|
|
|
167
152
|
}) {
|
|
168
153
|
return new ComponentModel(_componentId().ComponentID.fromObject(id), displayName, packageName, server, _compositions().Composition.fromArray(compositions), _tagMap().TagMap.fromArray(tags.map(tag => _tag().Tag.fromObject(tag))), buildStatus, issuesCount, elementsUrl, status, deprecation, env, description, labels, host, size, latest, preview, logs);
|
|
169
154
|
}
|
|
170
|
-
|
|
171
155
|
static fromArray(componentsProps) {
|
|
172
156
|
return componentsProps.map(rawComponent => ComponentModel.from(rawComponent));
|
|
173
157
|
}
|
|
174
|
-
|
|
175
158
|
static empty() {
|
|
176
159
|
return new ComponentModel(_componentId().ComponentID.fromObject({
|
|
177
160
|
name: 'root',
|
|
@@ -181,9 +164,7 @@ class ComponentModel {
|
|
|
181
164
|
url: ''
|
|
182
165
|
}, [], _tagMap().TagMap.empty());
|
|
183
166
|
}
|
|
184
|
-
|
|
185
167
|
}
|
|
186
|
-
|
|
187
168
|
exports.ComponentModel = ComponentModel;
|
|
188
169
|
|
|
189
170
|
//# sourceMappingURL=component-model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ComponentModel","constructor","id","displayName","packageName","server","compositions","tags","buildStatus","issuesCount","elementsUrl","status","deprecation","environment","description","labels","host","size","latest","preview","logs","version","from","env","ComponentID","fromObject","Composition","fromArray","TagMap","map","tag","Tag","componentsProps","rawComponent","empty","name","scope","url"],"sources":["component-model.ts"],"sourcesContent":["import { Composition, CompositionProps } from '@teambit/compositions';\nimport { DeprecationInfo } from '@teambit/deprecation';\nimport { Descriptor } from '@teambit/envs';\nimport { ComponentID, ComponentIdObj } from '@teambit/component-id';\nimport { LegacyComponentLog } from '@teambit/legacy-component-log';\nimport { ComponentPreviewSize } from '@teambit/preview';\nimport { Tag } from '../../tag';\nimport { TagMap } from '../../tag-map';\nimport { TagProps } from '../../tag/tag';\n// import { Snap } from '../../snap';\n\n// ADDING MORE PROPERTIES HERE IS NOT ALLOWED!!! IF YOU NEED DATA PLEASE ADD A NEW\n// HOOK FROM YOUR ASPECT!!!\n// TODO: remove all properties from here to their rightful place in their aspects.\nexport type ComponentModelProps = {\n id: ComponentIdObj;\n description: string;\n buildStatus?: string;\n server?: ComponentServer;\n displayName: string;\n packageName: string; // pkg aspect\n elementsUrl?: string; // pkg aspect\n compositions?: CompositionProps[];\n tags?: TagProps[];\n issuesCount?: number; // component/issues aspect\n status?: any; // workspace aspect.\n deprecation?: DeprecationInfo; // deprecation aspect\n env?: Descriptor; // env aspect.\n labels?: string[];\n host?: string;\n latest?: string;\n preview?: ComponentPreview;\n logs?: LegacyComponentLog[];\n size?: ComponentPreviewSize;\n};\n\nexport type ComponentPreview = {\n includesEnvTemplate?: boolean;\n isScaling?: boolean;\n legacyHeader?: boolean;\n};\n\nexport type ComponentServer = {\n env: string;\n url: string;\n};\n\nexport class ComponentModel {\n constructor(\n /**\n * id of the component\n */\n readonly id: ComponentID,\n\n /**\n * display name of the component.\n */\n readonly displayName: string,\n\n /**\n * package name of the component.\n */\n readonly packageName: string,\n\n /**\n * the component server.\n */\n readonly server: ComponentServer | undefined,\n\n /**\n * array of compositions\n */\n readonly compositions: Composition[],\n\n /**\n * tags of the component.\n */\n readonly tags: TagMap,\n\n /**\n * component build status\n */\n readonly buildStatus?: string,\n\n /**\n * issues of component.\n */\n readonly issuesCount?: number,\n /**\n * elements url\n */\n readonly elementsUrl?: string,\n /**\n * status of component.\n */\n readonly status?: any,\n\n /**\n * deprecation info of the component.\n */\n readonly deprecation?: DeprecationInfo,\n\n /**\n * env descriptor.\n */\n readonly environment?: Descriptor,\n\n /**\n * description of the component.\n */\n\n readonly description = '',\n\n readonly labels: string[] = [],\n\n /**\n * host of the component\n */\n readonly host?: string,\n\n /**\n *\n * size preview\n */\n readonly size?: ComponentPreviewSize,\n\n /**\n * latest version of component\n */\n readonly latest?: string,\n\n readonly preview?: ComponentPreview,\n\n readonly logs?: LegacyComponentLog[]\n ) {}\n\n get version() {\n if (!this.id.version) return 'new';\n return this.id.version;\n }\n\n /**\n * create an instance of a component from a plain object.\n */\n static from({\n id,\n server,\n displayName,\n compositions = [],\n packageName,\n elementsUrl,\n tags = [],\n deprecation,\n buildStatus,\n env,\n status,\n issuesCount,\n description,\n labels,\n host,\n latest,\n preview,\n size,\n logs,\n }: ComponentModelProps) {\n return new ComponentModel(\n ComponentID.fromObject(id),\n displayName,\n packageName,\n server,\n Composition.fromArray(compositions),\n TagMap.fromArray(tags.map((tag) => Tag.fromObject(tag))),\n buildStatus,\n issuesCount,\n elementsUrl,\n status,\n deprecation,\n env,\n description,\n labels,\n host,\n size,\n latest,\n preview,\n logs\n );\n }\n\n static fromArray(componentsProps: ComponentModelProps[]) {\n return componentsProps.map((rawComponent) => ComponentModel.from(rawComponent));\n }\n\n static empty() {\n return new ComponentModel(\n ComponentID.fromObject({ name: 'root', scope: 'temp' }),\n '',\n '',\n { env: '', url: '' },\n [],\n TagMap.empty()\n );\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["ComponentModel","constructor","id","displayName","packageName","server","compositions","tags","buildStatus","issuesCount","elementsUrl","status","deprecation","environment","description","labels","host","size","latest","preview","logs","version","from","env","ComponentID","fromObject","Composition","fromArray","TagMap","map","tag","Tag","componentsProps","rawComponent","empty","name","scope","url"],"sources":["component-model.ts"],"sourcesContent":["import { Composition, CompositionProps } from '@teambit/compositions';\nimport { DeprecationInfo } from '@teambit/deprecation';\nimport { Descriptor } from '@teambit/envs';\nimport { ComponentID, ComponentIdObj } from '@teambit/component-id';\nimport { LegacyComponentLog } from '@teambit/legacy-component-log';\nimport { ComponentPreviewSize } from '@teambit/preview';\nimport { Tag } from '../../tag';\nimport { TagMap } from '../../tag-map';\nimport { TagProps } from '../../tag/tag';\n// import { Snap } from '../../snap';\n\n// ADDING MORE PROPERTIES HERE IS NOT ALLOWED!!! IF YOU NEED DATA PLEASE ADD A NEW\n// HOOK FROM YOUR ASPECT!!!\n// TODO: remove all properties from here to their rightful place in their aspects.\nexport type ComponentModelProps = {\n id: ComponentIdObj;\n description: string;\n buildStatus?: string;\n server?: ComponentServer;\n displayName: string;\n packageName: string; // pkg aspect\n elementsUrl?: string; // pkg aspect\n compositions?: CompositionProps[];\n tags?: TagProps[];\n issuesCount?: number; // component/issues aspect\n status?: any; // workspace aspect.\n deprecation?: DeprecationInfo; // deprecation aspect\n env?: Descriptor; // env aspect.\n labels?: string[];\n host?: string;\n latest?: string;\n preview?: ComponentPreview;\n logs?: LegacyComponentLog[];\n size?: ComponentPreviewSize;\n};\n\nexport type ComponentPreview = {\n includesEnvTemplate?: boolean;\n isScaling?: boolean;\n legacyHeader?: boolean;\n};\n\nexport type ComponentServer = {\n env: string;\n url: string;\n};\n\nexport class ComponentModel {\n constructor(\n /**\n * id of the component\n */\n readonly id: ComponentID,\n\n /**\n * display name of the component.\n */\n readonly displayName: string,\n\n /**\n * package name of the component.\n */\n readonly packageName: string,\n\n /**\n * the component server.\n */\n readonly server: ComponentServer | undefined,\n\n /**\n * array of compositions\n */\n readonly compositions: Composition[],\n\n /**\n * tags of the component.\n */\n readonly tags: TagMap,\n\n /**\n * component build status\n */\n readonly buildStatus?: string,\n\n /**\n * issues of component.\n */\n readonly issuesCount?: number,\n /**\n * elements url\n */\n readonly elementsUrl?: string,\n /**\n * status of component.\n */\n readonly status?: any,\n\n /**\n * deprecation info of the component.\n */\n readonly deprecation?: DeprecationInfo,\n\n /**\n * env descriptor.\n */\n readonly environment?: Descriptor,\n\n /**\n * description of the component.\n */\n\n readonly description = '',\n\n readonly labels: string[] = [],\n\n /**\n * host of the component\n */\n readonly host?: string,\n\n /**\n *\n * size preview\n */\n readonly size?: ComponentPreviewSize,\n\n /**\n * latest version of component\n */\n readonly latest?: string,\n\n readonly preview?: ComponentPreview,\n\n readonly logs?: LegacyComponentLog[]\n ) {}\n\n get version() {\n if (!this.id.version) return 'new';\n return this.id.version;\n }\n\n /**\n * create an instance of a component from a plain object.\n */\n static from({\n id,\n server,\n displayName,\n compositions = [],\n packageName,\n elementsUrl,\n tags = [],\n deprecation,\n buildStatus,\n env,\n status,\n issuesCount,\n description,\n labels,\n host,\n latest,\n preview,\n size,\n logs,\n }: ComponentModelProps) {\n return new ComponentModel(\n ComponentID.fromObject(id),\n displayName,\n packageName,\n server,\n Composition.fromArray(compositions),\n TagMap.fromArray(tags.map((tag) => Tag.fromObject(tag))),\n buildStatus,\n issuesCount,\n elementsUrl,\n status,\n deprecation,\n env,\n description,\n labels,\n host,\n size,\n latest,\n preview,\n logs\n );\n }\n\n static fromArray(componentsProps: ComponentModelProps[]) {\n return componentsProps.map((rawComponent) => ComponentModel.from(rawComponent));\n }\n\n static empty() {\n return new ComponentModel(\n ComponentID.fromObject({ name: 'root', scope: 'temp' }),\n '',\n '',\n { env: '', url: '' },\n [],\n TagMap.empty()\n );\n }\n}\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAwCO,MAAMA,cAAc,CAAC;EAC1BC,WAAW;EACT;AACJ;AACA;EACaC,EAAe;EAExB;AACJ;AACA;EACaC,WAAmB;EAE5B;AACJ;AACA;EACaC,WAAmB;EAE5B;AACJ;AACA;EACaC,MAAmC;EAE5C;AACJ;AACA;EACaC,YAA2B;EAEpC;AACJ;AACA;EACaC,IAAY;EAErB;AACJ;AACA;EACaC,WAAoB;EAE7B;AACJ;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,MAAM;IACNF,WAAW;IACXG,YAAY,GAAG,EAAE;IACjBF,WAAW;IACXM,WAAW;IACXH,IAAI,GAAG,EAAE;IACTK,WAAW;IACXJ,WAAW;IACXe,GAAG;IACHZ,MAAM;IACNF,WAAW;IACXK,WAAW;IACXC,MAAM;IACNC,IAAI;IACJE,MAAM;IACNC,OAAO;IACPF,IAAI;IACJG;EACmB,CAAC,EAAE;IACtB,OAAO,IAAIpB,cAAc,CACvBwB,0BAAW,CAACC,UAAU,CAACvB,EAAE,CAAC,EAC1BC,WAAW,EACXC,WAAW,EACXC,MAAM,EACNqB,2BAAW,CAACC,SAAS,CAACrB,YAAY,CAAC,EACnCsB,gBAAM,CAACD,SAAS,CAACpB,IAAI,CAACsB,GAAG,CAAEC,GAAG,IAAKC,UAAG,CAACN,UAAU,CAACK,GAAG,CAAC,CAAC,CAAC,EACxDtB,WAAW,EACXC,WAAW,EACXC,WAAW,EACXC,MAAM,EACNC,WAAW,EACXW,GAAG,EACHT,WAAW,EACXC,MAAM,EACNC,IAAI,EACJC,IAAI,EACJC,MAAM,EACNC,OAAO,EACPC,IAAI,CACL;EACH;EAEA,OAAOO,SAAS,CAACK,eAAsC,EAAE;IACvD,OAAOA,eAAe,CAACH,GAAG,CAAEI,YAAY,IAAKjC,cAAc,CAACsB,IAAI,CAACW,YAAY,CAAC,CAAC;EACjF;EAEA,OAAOC,KAAK,GAAG;IACb,OAAO,IAAIlC,cAAc,CACvBwB,0BAAW,CAACC,UAAU,CAAC;MAAEU,IAAI,EAAE,MAAM;MAAEC,KAAK,EAAE;IAAO,CAAC,CAAC,EACvD,EAAE,EACF,EAAE,EACF;MAAEb,GAAG,EAAE,EAAE;MAAEc,GAAG,EAAE;IAAG,CAAC,EACpB,EAAE,EACFT,gBAAM,CAACM,KAAK,EAAE,CACf;EACH;AACF;AAAC"}
|
|
@@ -15,14 +15,11 @@ Object.defineProperty(exports, "ComponentModelProps", {
|
|
|
15
15
|
return _componentModel().ComponentModelProps;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
|
|
19
18
|
function _componentModel() {
|
|
20
19
|
const data = require("./component-model");
|
|
21
|
-
|
|
22
20
|
_componentModel = function () {
|
|
23
21
|
return data;
|
|
24
22
|
};
|
|
25
|
-
|
|
26
23
|
return data;
|
|
27
24
|
}
|
|
28
25
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { ComponentModel, ComponentModelProps } from './component-model';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { ComponentModel, ComponentModelProps } from './component-model';\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
|
|
@@ -1,72 +1,52 @@
|
|
|
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.ComponentResult = ComponentResult;
|
|
9
|
-
|
|
10
8
|
function _react() {
|
|
11
9
|
const data = _interopRequireDefault(require("react"));
|
|
12
|
-
|
|
13
10
|
_react = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
function _lodash() {
|
|
21
16
|
const data = _interopRequireDefault(require("lodash.compact"));
|
|
22
|
-
|
|
23
17
|
_lodash = function () {
|
|
24
18
|
return data;
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
return data;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
function _designUiStyles() {
|
|
31
23
|
const data = require("@teambit/design.ui.styles.ellipsis");
|
|
32
|
-
|
|
33
24
|
_designUiStyles = function () {
|
|
34
25
|
return data;
|
|
35
26
|
};
|
|
36
|
-
|
|
37
27
|
return data;
|
|
38
28
|
}
|
|
39
|
-
|
|
40
29
|
function _envsUi() {
|
|
41
30
|
const data = require("@teambit/envs.ui.env-icon");
|
|
42
|
-
|
|
43
31
|
_envsUi = function () {
|
|
44
32
|
return data;
|
|
45
33
|
};
|
|
46
|
-
|
|
47
34
|
return data;
|
|
48
35
|
}
|
|
49
|
-
|
|
50
36
|
function _classnames() {
|
|
51
37
|
const data = _interopRequireDefault(require("classnames"));
|
|
52
|
-
|
|
53
38
|
_classnames = function () {
|
|
54
39
|
return data;
|
|
55
40
|
};
|
|
56
|
-
|
|
57
41
|
return data;
|
|
58
42
|
}
|
|
59
|
-
|
|
60
43
|
function _componentResultModule() {
|
|
61
44
|
const data = _interopRequireDefault(require("./component-result.module.scss"));
|
|
62
|
-
|
|
63
45
|
_componentResultModule = function () {
|
|
64
46
|
return data;
|
|
65
47
|
};
|
|
66
|
-
|
|
67
48
|
return data;
|
|
68
49
|
}
|
|
69
|
-
|
|
70
50
|
function ComponentResult({
|
|
71
51
|
component,
|
|
72
52
|
plugins
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ComponentResult","component","plugins","name","id","fullName","startPlugins","compact","map","plugin","start","key","endPlugins","end","styles","icon","classnames","ellipsis"],"sources":["component-result.tsx"],"sourcesContent":["import React, { ComponentType } from 'react';\nimport compact from 'lodash.compact';\nimport { ComponentModel } from '@teambit/component';\nimport { ellipsis } from '@teambit/design.ui.styles.ellipsis';\nimport { EnvIcon } from '@teambit/envs.ui.env-icon';\nimport classnames from 'classnames';\n\nimport styles from './component-result.module.scss';\n\nexport type ComponentPluginProps = React.HTMLAttributes<HTMLDivElement> & { component: ComponentModel };\n\nexport type ComponentResultPlugin = {\n key: string;\n start?: ComponentType<ComponentPluginProps>;\n end?: ComponentType<ComponentPluginProps>;\n};\ntype ComponentResultProps = {\n component: ComponentModel;\n plugins?: ComponentResultPlugin[];\n};\n\nexport function ComponentResult({ component, plugins }: ComponentResultProps) {\n const name = component.id.fullName;\n\n const startPlugins = compact(\n plugins?.map((plugin) => plugin.start && <plugin.start key={plugin.key} component={component} />)\n );\n const endPlugins = compact(\n plugins?.map((plugin) => plugin.end && <plugin.end key={plugin.key} component={component} />)\n );\n\n return (\n <>\n {startPlugins}\n <EnvIcon component={component} className={styles.icon} />\n <div className={classnames(styles.name, ellipsis)}>{name}</div>\n {endPlugins}\n </>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["ComponentResult","component","plugins","name","id","fullName","startPlugins","compact","map","plugin","start","key","endPlugins","end","styles","icon","classnames","ellipsis"],"sources":["component-result.tsx"],"sourcesContent":["import React, { ComponentType } from 'react';\nimport compact from 'lodash.compact';\nimport { ComponentModel } from '@teambit/component';\nimport { ellipsis } from '@teambit/design.ui.styles.ellipsis';\nimport { EnvIcon } from '@teambit/envs.ui.env-icon';\nimport classnames from 'classnames';\n\nimport styles from './component-result.module.scss';\n\nexport type ComponentPluginProps = React.HTMLAttributes<HTMLDivElement> & { component: ComponentModel };\n\nexport type ComponentResultPlugin = {\n key: string;\n start?: ComponentType<ComponentPluginProps>;\n end?: ComponentType<ComponentPluginProps>;\n};\ntype ComponentResultProps = {\n component: ComponentModel;\n plugins?: ComponentResultPlugin[];\n};\n\nexport function ComponentResult({ component, plugins }: ComponentResultProps) {\n const name = component.id.fullName;\n\n const startPlugins = compact(\n plugins?.map((plugin) => plugin.start && <plugin.start key={plugin.key} component={component} />)\n );\n const endPlugins = compact(\n plugins?.map((plugin) => plugin.end && <plugin.end key={plugin.key} component={component} />)\n );\n\n return (\n <>\n {startPlugins}\n <EnvIcon component={component} className={styles.icon} />\n <div className={classnames(styles.name, ellipsis)}>{name}</div>\n {endPlugins}\n </>\n );\n}\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAcO,SAASA,eAAe,CAAC;EAAEC,SAAS;EAAEC;AAA8B,CAAC,EAAE;EAC5E,MAAMC,IAAI,GAAGF,SAAS,CAACG,EAAE,CAACC,QAAQ;EAElC,MAAMC,YAAY,GAAG,IAAAC,iBAAO,EAC1BL,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEM,GAAG,CAAEC,MAAM,IAAKA,MAAM,CAACC,KAAK,iBAAI,+BAAC,MAAM,CAAC,KAAK;IAAC,GAAG,EAAED,MAAM,CAACE,GAAI;IAAC,SAAS,EAAEV;EAAU,EAAG,CAAC,CAClG;EACD,MAAMW,UAAU,GAAG,IAAAL,iBAAO,EACxBL,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEM,GAAG,CAAEC,MAAM,IAAKA,MAAM,CAACI,GAAG,iBAAI,+BAAC,MAAM,CAAC,GAAG;IAAC,GAAG,EAAEJ,MAAM,CAACE,GAAI;IAAC,SAAS,EAAEV;EAAU,EAAG,CAAC,CAC9F;EAED,oBACE,gEACGK,YAAY,eACb,+BAAC,iBAAO;IAAC,SAAS,EAAEL,SAAU;IAAC,SAAS,EAAEa,gCAAM,CAACC;EAAK,EAAG,eACzD;IAAK,SAAS,EAAE,IAAAC,qBAAU,EAACF,gCAAM,CAACX,IAAI,EAAEc,0BAAQ;EAAE,GAAEd,IAAI,CAAO,EAC9DS,UAAU,CACV;AAEP"}
|
|
@@ -1,58 +1,41 @@
|
|
|
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.ComponentSearcher = void 0;
|
|
9
|
-
|
|
10
8
|
function _defineProperty2() {
|
|
11
9
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
-
|
|
13
10
|
_defineProperty2 = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
function _react() {
|
|
21
16
|
const data = _interopRequireDefault(require("react"));
|
|
22
|
-
|
|
23
17
|
_react = function () {
|
|
24
18
|
return data;
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
return data;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
function _explorerUi() {
|
|
31
23
|
const data = require("@teambit/explorer.ui.command-bar");
|
|
32
|
-
|
|
33
24
|
_explorerUi = function () {
|
|
34
25
|
return data;
|
|
35
26
|
};
|
|
36
|
-
|
|
37
27
|
return data;
|
|
38
28
|
}
|
|
39
|
-
|
|
40
29
|
function _componentResult() {
|
|
41
30
|
const data = require("./component-result");
|
|
42
|
-
|
|
43
31
|
_componentResult = function () {
|
|
44
32
|
return data;
|
|
45
33
|
};
|
|
46
|
-
|
|
47
34
|
return data;
|
|
48
35
|
}
|
|
49
|
-
|
|
50
36
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
51
|
-
|
|
52
37
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2().default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
53
|
-
|
|
54
38
|
const searchKeys = ['displayName', 'name'];
|
|
55
|
-
|
|
56
39
|
class ComponentSearcher extends _explorerUi().FuzzySearcher {
|
|
57
40
|
constructor(options) {
|
|
58
41
|
super({
|
|
@@ -79,17 +62,14 @@ class ComponentSearcher extends _explorerUi().FuzzySearcher {
|
|
|
79
62
|
};
|
|
80
63
|
});
|
|
81
64
|
}
|
|
82
|
-
|
|
83
65
|
updatePlugins(plugins) {
|
|
84
66
|
this.options = _objectSpread(_objectSpread({}, this.options), {}, {
|
|
85
67
|
resultPlugins: plugins
|
|
86
68
|
});
|
|
87
69
|
}
|
|
88
|
-
|
|
89
70
|
test(term) {
|
|
90
71
|
return !term.startsWith('>') && term.length > 0;
|
|
91
72
|
}
|
|
92
|
-
|
|
93
73
|
toSearchableItem(item) {
|
|
94
74
|
return {
|
|
95
75
|
name: item.id.name,
|
|
@@ -97,9 +77,7 @@ class ComponentSearcher extends _explorerUi().FuzzySearcher {
|
|
|
97
77
|
component: item
|
|
98
78
|
};
|
|
99
79
|
}
|
|
100
|
-
|
|
101
80
|
}
|
|
102
|
-
|
|
103
81
|
exports.ComponentSearcher = ComponentSearcher;
|
|
104
82
|
|
|
105
83
|
//# sourceMappingURL=component-searcher.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["searchKeys","ComponentSearcher","FuzzySearcher","constructor","options","item","navigate","resultPlugins","component","id","fullName","action","children","updatePlugins","plugins","test","term","startsWith","length","toSearchableItem","name","displayName"],"sources":["component-searcher.tsx"],"sourcesContent":["import React from 'react';\n\nimport { ComponentModel } from '@teambit/component';\nimport { SearchResult, FuzzySearchItem, FuzzySearcher } from '@teambit/explorer.ui.command-bar';\nimport type { SearchProvider } from '@teambit/command-bar';\nimport { ComponentResult, ComponentResultPlugin } from './component-result';\n\nexport type { ComponentResultPlugin };\n\ntype ComponentSearchIdx = {\n name: string;\n displayName: string;\n component: ComponentModel;\n};\n\nconst searchKeys: (keyof ComponentSearchIdx)[] = ['displayName', 'name'];\n\ntype ComponentSearcherOptions = {\n navigate: (path: string) => void;\n resultPlugins?: ComponentResultPlugin[];\n};\n\nexport class ComponentSearcher extends FuzzySearcher<ComponentModel, ComponentSearchIdx> implements SearchProvider {\n constructor(public options: ComponentSearcherOptions) {\n super({ searchKeys });\n }\n\n updatePlugins(plugins: ComponentResultPlugin[]) {\n this.options = {\n ...this.options,\n resultPlugins: plugins,\n };\n }\n\n override test(term: string): boolean {\n return !term.startsWith('>') && term.length > 0;\n }\n\n protected override toSearchableItem(item: ComponentModel): ComponentSearchIdx {\n return {\n name: item.id.name,\n displayName: item.id.fullName,\n component: item,\n };\n }\n\n protected override toSearchResult = ({ item }: FuzzySearchItem<ComponentSearchIdx>): SearchResult => {\n const { navigate, resultPlugins } = this.options;\n const { component } = item;\n\n return {\n id: component.id.fullName,\n action: () => navigate(`/${component.id.fullName}`),\n children: <ComponentResult component={component} plugins={resultPlugins} />,\n };\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["searchKeys","ComponentSearcher","FuzzySearcher","constructor","options","item","navigate","resultPlugins","component","id","fullName","action","children","updatePlugins","plugins","test","term","startsWith","length","toSearchableItem","name","displayName"],"sources":["component-searcher.tsx"],"sourcesContent":["import React from 'react';\n\nimport { ComponentModel } from '@teambit/component';\nimport { SearchResult, FuzzySearchItem, FuzzySearcher } from '@teambit/explorer.ui.command-bar';\nimport type { SearchProvider } from '@teambit/command-bar';\nimport { ComponentResult, ComponentResultPlugin } from './component-result';\n\nexport type { ComponentResultPlugin };\n\ntype ComponentSearchIdx = {\n name: string;\n displayName: string;\n component: ComponentModel;\n};\n\nconst searchKeys: (keyof ComponentSearchIdx)[] = ['displayName', 'name'];\n\ntype ComponentSearcherOptions = {\n navigate: (path: string) => void;\n resultPlugins?: ComponentResultPlugin[];\n};\n\nexport class ComponentSearcher extends FuzzySearcher<ComponentModel, ComponentSearchIdx> implements SearchProvider {\n constructor(public options: ComponentSearcherOptions) {\n super({ searchKeys });\n }\n\n updatePlugins(plugins: ComponentResultPlugin[]) {\n this.options = {\n ...this.options,\n resultPlugins: plugins,\n };\n }\n\n override test(term: string): boolean {\n return !term.startsWith('>') && term.length > 0;\n }\n\n protected override toSearchableItem(item: ComponentModel): ComponentSearchIdx {\n return {\n name: item.id.name,\n displayName: item.id.fullName,\n component: item,\n };\n }\n\n protected override toSearchResult = ({ item }: FuzzySearchItem<ComponentSearchIdx>): SearchResult => {\n const { navigate, resultPlugins } = this.options;\n const { component } = item;\n\n return {\n id: component.id.fullName,\n action: () => navigate(`/${component.id.fullName}`),\n children: <ComponentResult component={component} plugins={resultPlugins} />,\n };\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA4E;AAAA;AAU5E,MAAMA,UAAwC,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC;AAOjE,MAAMC,iBAAiB,SAASC,2BAAa,CAA+D;EACjHC,WAAW,CAAQC,OAAiC,EAAE;IACpD,KAAK,CAAC;MAAEJ;IAAW,CAAC,CAAC;IAAC,KADLI,OAAiC,GAAjCA,OAAiC;IAAA,wDAuBhB,CAAC;MAAEC;IAA0C,CAAC,KAAmB;MACnG,MAAM;QAAEC,QAAQ;QAAEC;MAAc,CAAC,GAAG,IAAI,CAACH,OAAO;MAChD,MAAM;QAAEI;MAAU,CAAC,GAAGH,IAAI;MAE1B,OAAO;QACLI,EAAE,EAAED,SAAS,CAACC,EAAE,CAACC,QAAQ;QACzBC,MAAM,EAAE,MAAML,QAAQ,CAAE,IAAGE,SAAS,CAACC,EAAE,CAACC,QAAS,EAAC,CAAC;QACnDE,QAAQ,eAAE,+BAAC,kCAAe;UAAC,SAAS,EAAEJ,SAAU;UAAC,OAAO,EAAED;QAAc;MAC1E,CAAC;IACH,CAAC;EA9BD;EAEAM,aAAa,CAACC,OAAgC,EAAE;IAC9C,IAAI,CAACV,OAAO,mCACP,IAAI,CAACA,OAAO;MACfG,aAAa,EAAEO;IAAO,EACvB;EACH;EAESC,IAAI,CAACC,IAAY,EAAW;IACnC,OAAO,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC,IAAID,IAAI,CAACE,MAAM,GAAG,CAAC;EACjD;EAEmBC,gBAAgB,CAACd,IAAoB,EAAsB;IAC5E,OAAO;MACLe,IAAI,EAAEf,IAAI,CAACI,EAAE,CAACW,IAAI;MAClBC,WAAW,EAAEhB,IAAI,CAACI,EAAE,CAACC,QAAQ;MAC7BF,SAAS,EAAEH;IACb,CAAC;EACH;AAYF;AAAC"}
|
|
@@ -9,14 +9,11 @@ Object.defineProperty(exports, "ComponentSearcher", {
|
|
|
9
9
|
return _componentSearcher().ComponentSearcher;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
|
|
13
12
|
function _componentSearcher() {
|
|
14
13
|
const data = require("./component-searcher");
|
|
15
|
-
|
|
16
14
|
_componentSearcher = function () {
|
|
17
15
|
return data;
|
|
18
16
|
};
|
|
19
|
-
|
|
20
17
|
return data;
|
|
21
18
|
}
|
|
22
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { ComponentSearcher } from './component-searcher';\nexport type { ComponentResultPlugin } from './component-searcher';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { ComponentSearcher } from './component-searcher';\nexport type { ComponentResultPlugin } from './component-searcher';\n"],"mappings":";;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
|
package/dist/ui/component.js
CHANGED
|
@@ -1,117 +1,84 @@
|
|
|
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
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.Component = Component;
|
|
11
|
-
|
|
12
9
|
function _react() {
|
|
13
10
|
const data = _interopRequireWildcard(require("react"));
|
|
14
|
-
|
|
15
11
|
_react = function () {
|
|
16
12
|
return data;
|
|
17
13
|
};
|
|
18
|
-
|
|
19
14
|
return data;
|
|
20
15
|
}
|
|
21
|
-
|
|
22
16
|
function _lodash() {
|
|
23
17
|
const data = _interopRequireDefault(require("lodash.flatten"));
|
|
24
|
-
|
|
25
18
|
_lodash = function () {
|
|
26
19
|
return data;
|
|
27
20
|
};
|
|
28
|
-
|
|
29
21
|
return data;
|
|
30
22
|
}
|
|
31
|
-
|
|
32
23
|
function _uiFoundationUiReactRouter() {
|
|
33
24
|
const data = require("@teambit/ui-foundation.ui.react-router.slot-router");
|
|
34
|
-
|
|
35
25
|
_uiFoundationUiReactRouter = function () {
|
|
36
26
|
return data;
|
|
37
27
|
};
|
|
38
|
-
|
|
39
28
|
return data;
|
|
40
29
|
}
|
|
41
|
-
|
|
42
30
|
function _lodash2() {
|
|
43
31
|
const data = require("lodash");
|
|
44
|
-
|
|
45
32
|
_lodash2 = function () {
|
|
46
33
|
return data;
|
|
47
34
|
};
|
|
48
|
-
|
|
49
35
|
return data;
|
|
50
36
|
}
|
|
51
|
-
|
|
52
37
|
function _componentModule() {
|
|
53
38
|
const data = _interopRequireDefault(require("./component.module.scss"));
|
|
54
|
-
|
|
55
39
|
_componentModule = function () {
|
|
56
40
|
return data;
|
|
57
41
|
};
|
|
58
|
-
|
|
59
42
|
return data;
|
|
60
43
|
}
|
|
61
|
-
|
|
62
44
|
function _context() {
|
|
63
45
|
const data = require("./context");
|
|
64
|
-
|
|
65
46
|
_context = function () {
|
|
66
47
|
return data;
|
|
67
48
|
};
|
|
68
|
-
|
|
69
49
|
return data;
|
|
70
50
|
}
|
|
71
|
-
|
|
72
51
|
function _useComponent() {
|
|
73
52
|
const data = require("./use-component");
|
|
74
|
-
|
|
75
53
|
_useComponent = function () {
|
|
76
54
|
return data;
|
|
77
55
|
};
|
|
78
|
-
|
|
79
56
|
return data;
|
|
80
57
|
}
|
|
81
|
-
|
|
82
58
|
function _useComponentFromLocation() {
|
|
83
59
|
const data = require("./use-component-from-location");
|
|
84
|
-
|
|
85
60
|
_useComponentFromLocation = function () {
|
|
86
61
|
return data;
|
|
87
62
|
};
|
|
88
|
-
|
|
89
63
|
return data;
|
|
90
64
|
}
|
|
91
|
-
|
|
92
65
|
function _() {
|
|
93
66
|
const data = require("..");
|
|
94
|
-
|
|
95
67
|
_ = function () {
|
|
96
68
|
return data;
|
|
97
69
|
};
|
|
98
|
-
|
|
99
70
|
return data;
|
|
100
71
|
}
|
|
101
|
-
|
|
102
72
|
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); }
|
|
103
|
-
|
|
104
73
|
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; }
|
|
105
|
-
|
|
106
74
|
function getComponentIdStr(componentIdStr) {
|
|
107
75
|
if ((0, _lodash2().isFunction)(componentIdStr)) return componentIdStr();
|
|
108
76
|
return componentIdStr;
|
|
109
77
|
}
|
|
78
|
+
|
|
110
79
|
/**
|
|
111
80
|
* main UI component of the Component extension.
|
|
112
81
|
*/
|
|
113
|
-
|
|
114
|
-
|
|
115
82
|
function Component({
|
|
116
83
|
routeSlot,
|
|
117
84
|
containerSlot,
|
|
@@ -123,9 +90,7 @@ function Component({
|
|
|
123
90
|
useComponentFilters
|
|
124
91
|
}) {
|
|
125
92
|
const idFromLocation = (0, _useComponentFromLocation().useIdFromLocation)();
|
|
126
|
-
|
|
127
93
|
const _componentIdStr = getComponentIdStr(componentIdStr);
|
|
128
|
-
|
|
129
94
|
const componentId = _componentIdStr ? _().ComponentID.fromString(_componentIdStr) : undefined;
|
|
130
95
|
const resolvedComponentIdStr = path || idFromLocation;
|
|
131
96
|
const useComponentOptions = {
|
|
@@ -136,10 +101,10 @@ function Component({
|
|
|
136
101
|
component,
|
|
137
102
|
componentDescriptor,
|
|
138
103
|
error
|
|
139
|
-
} = (0, _useComponent().useComponent)(host, (componentId === null || componentId === void 0 ? void 0 : componentId.toString()) || idFromLocation, useComponentOptions);
|
|
140
|
-
|
|
141
|
-
(0, _react().useEffect)(() => onComponentChange === null || onComponentChange === void 0 ? void 0 : onComponentChange(component), [component]);
|
|
142
|
-
|
|
104
|
+
} = (0, _useComponent().useComponent)(host, (componentId === null || componentId === void 0 ? void 0 : componentId.toString()) || idFromLocation, useComponentOptions);
|
|
105
|
+
// trigger onComponentChange when component changes
|
|
106
|
+
(0, _react().useEffect)(() => onComponentChange === null || onComponentChange === void 0 ? void 0 : onComponentChange(component), [component]);
|
|
107
|
+
// cleanup when unmounting component
|
|
143
108
|
(0, _react().useEffect)(() => () => onComponentChange === null || onComponentChange === void 0 ? void 0 : onComponentChange(undefined), []);
|
|
144
109
|
const pageItems = (0, _react().useMemo)(() => (0, _lodash().default)(containerSlot === null || containerSlot === void 0 ? void 0 : containerSlot.values()), [containerSlot]);
|
|
145
110
|
const before = (0, _react().useMemo)(() => pageItems.filter(x => x.type === 'before').map(x => x.content), [pageItems]);
|
package/dist/ui/component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getComponentIdStr","componentIdStr","isFunction","Component","routeSlot","containerSlot","host","onComponentChange","useComponent","path","useComponentFilters","idFromLocation","useIdFromLocation","_componentIdStr","componentId","ComponentID","fromString","undefined","resolvedComponentIdStr","useComponentOptions","logFilters","customUseComponent","component","componentDescriptor","error","useComponentQuery","toString","useEffect","pageItems","useMemo","flatten","values","before","filter","x","type","map","content","after","renderError","styles","container"],"sources":["component.tsx"],"sourcesContent":["import React, { useEffect, ReactNode, useMemo } from 'react';\nimport flatten from 'lodash.flatten';\nimport { RouteSlot, SlotRouter } from '@teambit/ui-foundation.ui.react-router.slot-router';\nimport { SlotRegistry } from '@teambit/harmony';\nimport { isFunction } from 'lodash';\nimport styles from './component.module.scss';\nimport { ComponentProvider, ComponentDescriptorProvider } from './context';\nimport { useComponent as useComponentQuery, UseComponentType } from './use-component';\nimport { ComponentModel } from './component-model';\nimport { useIdFromLocation } from './use-component-from-location';\nimport { ComponentID } from '..';\nimport { Filters } from './use-component-query';\n\nexport type ComponentPageSlot = SlotRegistry<ComponentPageElement[]>;\nexport type ComponentPageElement = {\n type: 'before' | 'after';\n content: ReactNode;\n};\n\nexport type ComponentProps = {\n containerSlot?: ComponentPageSlot;\n routeSlot: RouteSlot;\n host: string;\n onComponentChange?: (activeComponent?: ComponentModel) => void;\n useComponent?: UseComponentType;\n useComponentFilters?: () => Filters;\n path?: string;\n componentIdStr?: string | (() => string | undefined);\n};\n\nfunction getComponentIdStr(componentIdStr?: string | (() => string | undefined)): string | undefined {\n if (isFunction(componentIdStr)) return componentIdStr();\n return componentIdStr;\n}\n\n/**\n * main UI component of the Component extension.\n */\nexport function Component({\n routeSlot,\n containerSlot,\n host,\n onComponentChange,\n componentIdStr,\n useComponent,\n path,\n useComponentFilters,\n}: ComponentProps) {\n const idFromLocation = useIdFromLocation();\n const _componentIdStr = getComponentIdStr(componentIdStr);\n const componentId = _componentIdStr ? ComponentID.fromString(_componentIdStr) : undefined;\n const resolvedComponentIdStr = path || idFromLocation;\n const useComponentOptions = {\n logFilters: useComponentFilters?.(),\n customUseComponent: useComponent,\n };\n\n const { component, componentDescriptor, error } = useComponentQuery(\n host,\n componentId?.toString() || idFromLocation,\n useComponentOptions\n );\n // trigger onComponentChange when component changes\n useEffect(() => onComponentChange?.(component), [component]);\n // cleanup when unmounting component\n useEffect(() => () => onComponentChange?.(undefined), []);\n\n const pageItems = useMemo(() => flatten(containerSlot?.values()), [containerSlot]);\n const before = useMemo(() => pageItems.filter((x) => x.type === 'before').map((x) => x.content), [pageItems]);\n const after = useMemo(() => pageItems.filter((x) => x.type === 'after').map((x) => x.content), [pageItems]);\n\n if (error) return error.renderError();\n if (!component) return <div></div>;\n\n return (\n <ComponentDescriptorProvider componentDescriptor={componentDescriptor}>\n <ComponentProvider component={component}>\n {before}\n <div className={styles.container}>\n {routeSlot && <SlotRouter parentPath={`${resolvedComponentIdStr}/*`} slot={routeSlot} />}\n </div>\n {after}\n </ComponentProvider>\n </ComponentDescriptorProvider>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["getComponentIdStr","componentIdStr","isFunction","Component","routeSlot","containerSlot","host","onComponentChange","useComponent","path","useComponentFilters","idFromLocation","useIdFromLocation","_componentIdStr","componentId","ComponentID","fromString","undefined","resolvedComponentIdStr","useComponentOptions","logFilters","customUseComponent","component","componentDescriptor","error","useComponentQuery","toString","useEffect","pageItems","useMemo","flatten","values","before","filter","x","type","map","content","after","renderError","styles","container"],"sources":["component.tsx"],"sourcesContent":["import React, { useEffect, ReactNode, useMemo } from 'react';\nimport flatten from 'lodash.flatten';\nimport { RouteSlot, SlotRouter } from '@teambit/ui-foundation.ui.react-router.slot-router';\nimport { SlotRegistry } from '@teambit/harmony';\nimport { isFunction } from 'lodash';\nimport styles from './component.module.scss';\nimport { ComponentProvider, ComponentDescriptorProvider } from './context';\nimport { useComponent as useComponentQuery, UseComponentType } from './use-component';\nimport { ComponentModel } from './component-model';\nimport { useIdFromLocation } from './use-component-from-location';\nimport { ComponentID } from '..';\nimport { Filters } from './use-component-query';\n\nexport type ComponentPageSlot = SlotRegistry<ComponentPageElement[]>;\nexport type ComponentPageElement = {\n type: 'before' | 'after';\n content: ReactNode;\n};\n\nexport type ComponentProps = {\n containerSlot?: ComponentPageSlot;\n routeSlot: RouteSlot;\n host: string;\n onComponentChange?: (activeComponent?: ComponentModel) => void;\n useComponent?: UseComponentType;\n useComponentFilters?: () => Filters;\n path?: string;\n componentIdStr?: string | (() => string | undefined);\n};\n\nfunction getComponentIdStr(componentIdStr?: string | (() => string | undefined)): string | undefined {\n if (isFunction(componentIdStr)) return componentIdStr();\n return componentIdStr;\n}\n\n/**\n * main UI component of the Component extension.\n */\nexport function Component({\n routeSlot,\n containerSlot,\n host,\n onComponentChange,\n componentIdStr,\n useComponent,\n path,\n useComponentFilters,\n}: ComponentProps) {\n const idFromLocation = useIdFromLocation();\n const _componentIdStr = getComponentIdStr(componentIdStr);\n const componentId = _componentIdStr ? ComponentID.fromString(_componentIdStr) : undefined;\n const resolvedComponentIdStr = path || idFromLocation;\n const useComponentOptions = {\n logFilters: useComponentFilters?.(),\n customUseComponent: useComponent,\n };\n\n const { component, componentDescriptor, error } = useComponentQuery(\n host,\n componentId?.toString() || idFromLocation,\n useComponentOptions\n );\n // trigger onComponentChange when component changes\n useEffect(() => onComponentChange?.(component), [component]);\n // cleanup when unmounting component\n useEffect(() => () => onComponentChange?.(undefined), []);\n\n const pageItems = useMemo(() => flatten(containerSlot?.values()), [containerSlot]);\n const before = useMemo(() => pageItems.filter((x) => x.type === 'before').map((x) => x.content), [pageItems]);\n const after = useMemo(() => pageItems.filter((x) => x.type === 'after').map((x) => x.content), [pageItems]);\n\n if (error) return error.renderError();\n if (!component) return <div></div>;\n\n return (\n <ComponentDescriptorProvider componentDescriptor={componentDescriptor}>\n <ComponentProvider component={component}>\n {before}\n <div className={styles.container}>\n {routeSlot && <SlotRouter parentPath={`${resolvedComponentId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U,GAC9BrC,SAAS,iBAAI,+BAAC,uCAAU;IAAC,UAAU,EAAG,GAAEc,sBAAuB,IAAI;IAAC,IAAI,EAAEd;EAAU,EAAG,CACpF,EACLkC,KAAK,CACY,CACQ;AAElC"}
|
|
@@ -4,34 +4,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useComponentDescriptor = exports.ComponentDescriptorContext = exports.ComponentContext = void 0;
|
|
7
|
-
|
|
8
7
|
function _react() {
|
|
9
8
|
const data = require("react");
|
|
10
|
-
|
|
11
9
|
_react = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _componentModel() {
|
|
19
15
|
const data = require("../component-model");
|
|
20
|
-
|
|
21
16
|
_componentModel = function () {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
const ComponentContext = /*#__PURE__*/(0, _react().createContext)(_componentModel().ComponentModel.empty());
|
|
29
22
|
exports.ComponentContext = ComponentContext;
|
|
30
23
|
const ComponentDescriptorContext = /*#__PURE__*/(0, _react().createContext)(undefined);
|
|
31
24
|
exports.ComponentDescriptorContext = ComponentDescriptorContext;
|
|
32
|
-
|
|
33
25
|
const useComponentDescriptor = () => (0, _react().useContext)(ComponentDescriptorContext);
|
|
34
|
-
|
|
35
26
|
exports.useComponentDescriptor = useComponentDescriptor;
|
|
36
27
|
|
|
37
28
|
//# sourceMappingURL=component-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ComponentContext","createContext","ComponentModel","empty","ComponentDescriptorContext","undefined","useComponentDescriptor","useContext"],"sources":["component-context.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\nimport type { ComponentDescriptor } from '@teambit/component-descriptor';\n\nimport { ComponentModel } from '../component-model';\n\nexport const ComponentContext: React.Context<ComponentModel> = createContext<ComponentModel>(ComponentModel.empty());\nexport const ComponentDescriptorContext: React.Context<ComponentDescriptor | undefined> = createContext<\n ComponentDescriptor | undefined\n>(undefined);\n\nexport const useComponentDescriptor = () => useContext(ComponentDescriptorContext);\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["ComponentContext","createContext","ComponentModel","empty","ComponentDescriptorContext","undefined","useComponentDescriptor","useContext"],"sources":["component-context.ts"],"sourcesContent":["import { createContext, useContext } from 'react';\nimport type { ComponentDescriptor } from '@teambit/component-descriptor';\n\nimport { ComponentModel } from '../component-model';\n\nexport const ComponentContext: React.Context<ComponentModel> = createContext<ComponentModel>(ComponentModel.empty());\nexport const ComponentDescriptorContext: React.Context<ComponentDescriptor | undefined> = createContext<\n ComponentDescriptor | undefined\n>(undefined);\n\nexport const useComponentDescriptor = () => useContext(ComponentDescriptorContext);\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,gBAA+C,gBAAG,IAAAC,sBAAa,EAAiBC,gCAAc,CAACC,KAAK,EAAE,CAAC;AAAC;AAC9G,MAAMC,0BAA0E,gBAAG,IAAAH,sBAAa,EAErGI,SAAS,CAAC;AAAC;AAEN,MAAMC,sBAAsB,GAAG,MAAM,IAAAC,mBAAU,EAACH,0BAA0B,CAAC;AAAC"}
|