@teambit/component 0.0.555 → 0.0.556

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/package.json +40 -34
  2. package/aspect-entry.ts +0 -67
  3. package/aspect-list.ts +0 -100
  4. package/aspect.section.tsx +0 -16
  5. package/component-factory.ts +0 -106
  6. package/component-fs.ts +0 -60
  7. package/component-map/component-map.ts +0 -106
  8. package/component-map/index.ts +0 -1
  9. package/component-meta.ts +0 -29
  10. package/component.aspect.ts +0 -9
  11. package/component.docs.mdx +0 -8
  12. package/component.graphql.ts +0 -202
  13. package/component.main.runtime.ts +0 -162
  14. package/component.route.ts +0 -26
  15. package/component.ts +0 -278
  16. package/component.ui.runtime.tsx +0 -216
  17. package/config.ts +0 -34
  18. package/dependencies/dependencies.ts +0 -74
  19. package/dependencies/index.ts +0 -1
  20. package/exceptions/could-not-find-latest.ts +0 -8
  21. package/exceptions/host-not-found.ts +0 -14
  22. package/exceptions/index.ts +0 -4
  23. package/exceptions/nothing-to-snap.ts +0 -1
  24. package/hash.ts +0 -4
  25. package/head.ts +0 -0
  26. package/history-graph.ts +0 -1
  27. package/host/component-host-model.ts +0 -9
  28. package/host/index.ts +0 -2
  29. package/host/use-component-host.ts +0 -39
  30. package/index.ts +0 -32
  31. package/on-load.ts +0 -0
  32. package/package-tar/teambit-component-0.0.555.tgz +0 -0
  33. package/section/index.ts +0 -1
  34. package/section/section.tsx +0 -8
  35. package/show/extensions.fragment.ts +0 -23
  36. package/show/files.fragment.ts +0 -24
  37. package/show/id.fragment.ts +0 -20
  38. package/show/index.ts +0 -8
  39. package/show/main-file.fragment.ts +0 -13
  40. package/show/name.fragment.ts +0 -13
  41. package/show/scope.fragment.ts +0 -15
  42. package/show/show-fragment.ts +0 -44
  43. package/show/show.cmd.ts +0 -85
  44. package/snap/author.ts +0 -19
  45. package/snap/index.ts +0 -2
  46. package/snap/snap.ts +0 -63
  47. package/state.ts +0 -73
  48. package/store.ts +0 -3
  49. package/tag/index.ts +0 -1
  50. package/tag/tag.ts +0 -37
  51. package/tag-map.ts +0 -87
  52. package/tsconfig.json +0 -34
  53. package/types/asset.d.ts +0 -29
  54. package/types/style.d.ts +0 -42
  55. package/ui/aspect-page/aspect-page.module.scss +0 -20
  56. package/ui/aspect-page/aspect-page.tsx +0 -64
  57. package/ui/aspect-page/index.ts +0 -1
  58. package/ui/component-error/component-error.tsx +0 -22
  59. package/ui/component-error/index.ts +0 -1
  60. package/ui/component-model/component-model.ts +0 -169
  61. package/ui/component-model/index.ts +0 -1
  62. package/ui/component.module.scss +0 -7
  63. package/ui/component.tsx +0 -48
  64. package/ui/context/component-context.ts +0 -5
  65. package/ui/context/component-provider.tsx +0 -20
  66. package/ui/context/index.ts +0 -2
  67. package/ui/index.ts +0 -3
  68. package/ui/menu/index.ts +0 -2
  69. package/ui/menu/menu-nav.tsx +0 -37
  70. package/ui/menu/menu.module.scss +0 -62
  71. package/ui/menu/menu.tsx +0 -94
  72. package/ui/menu/nav-plugin.tsx +0 -9
  73. package/ui/top-bar-nav/index.ts +0 -1
  74. package/ui/top-bar-nav/top-bar-nav.module.scss +0 -52
  75. package/ui/top-bar-nav/top-bar-nav.tsx +0 -26
  76. package/ui/use-component-query.ts +0 -195
  77. package/ui/use-component.tsx +0 -34
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/component",
3
- "version": "0.0.555",
3
+ "version": "0.0.556",
4
4
  "homepage": "https://bit.dev/teambit/component/component",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "component",
9
- "version": "0.0.555"
9
+ "version": "0.0.556"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
@@ -26,38 +26,38 @@
26
26
  "@teambit/base-ui.routing.nav-link": "1.0.0",
27
27
  "@teambit/documenter.ui.heading": "4.1.1",
28
28
  "@teambit/documenter.ui.separator": "4.1.1",
29
- "@teambit/component-id": "0.0.376",
30
- "@teambit/ui-foundation.ui.menu-widget-icon": "0.0.465",
31
- "@teambit/aspect-loader": "0.0.555",
32
- "@teambit/legacy-bit-id": "0.0.375",
33
- "@teambit/toolbox.string.capitalize": "0.0.460",
34
- "@teambit/cli": "0.0.386",
35
- "@teambit/config": "0.0.397",
36
- "@teambit/express": "0.0.475",
37
- "@teambit/graphql": "0.0.555",
38
- "@teambit/bit-error": "0.0.372",
39
- "@teambit/command-bar": "0.0.555",
40
- "@teambit/preview": "0.0.555",
41
- "@teambit/pubsub": "0.0.555",
42
- "@teambit/ui-foundation.ui.is-browser": "0.0.463",
43
- "@teambit/ui-foundation.ui.main-dropdown": "0.0.463",
44
- "@teambit/ui-foundation.ui.react-router.slot-router": "0.0.465",
45
- "@teambit/ui": "0.0.555",
46
- "@teambit/component-issues": "0.0.21",
47
- "@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.464",
48
- "@teambit/cli-table": "0.0.9",
49
- "@teambit/ui-foundation.ui.react-router.use-query": "0.0.463",
29
+ "@teambit/component-id": "0.0.377",
30
+ "@teambit/ui-foundation.ui.menu-widget-icon": "0.0.466",
31
+ "@teambit/aspect-loader": "0.0.556",
32
+ "@teambit/legacy-bit-id": "0.0.376",
33
+ "@teambit/toolbox.string.capitalize": "0.0.461",
34
+ "@teambit/cli": "0.0.387",
35
+ "@teambit/config": "0.0.398",
36
+ "@teambit/express": "0.0.476",
37
+ "@teambit/graphql": "0.0.556",
38
+ "@teambit/bit-error": "0.0.373",
39
+ "@teambit/command-bar": "0.0.556",
40
+ "@teambit/preview": "0.0.556",
41
+ "@teambit/pubsub": "0.0.556",
42
+ "@teambit/ui-foundation.ui.is-browser": "0.0.464",
43
+ "@teambit/ui-foundation.ui.main-dropdown": "0.0.464",
44
+ "@teambit/ui-foundation.ui.react-router.slot-router": "0.0.466",
45
+ "@teambit/ui": "0.0.556",
46
+ "@teambit/component-issues": "0.0.22",
47
+ "@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.465",
48
+ "@teambit/cli-table": "0.0.10",
49
+ "@teambit/ui-foundation.ui.react-router.use-query": "0.0.464",
50
50
  "@teambit/design.ui.empty-box": "0.0.352",
51
- "@teambit/harmony.ui.aspect-box": "0.0.463",
51
+ "@teambit/harmony.ui.aspect-box": "0.0.464",
52
52
  "@teambit/design.ui.pages.not-found": "0.0.352",
53
53
  "@teambit/design.ui.pages.server-error": "0.0.352",
54
- "@teambit/compositions": "0.0.555",
55
- "@teambit/deprecation": "0.0.555",
56
- "@teambit/envs": "0.0.555",
57
- "@teambit/component.ui.version-dropdown": "0.0.467",
58
- "@teambit/ui-foundation.ui.use-box.dropdown": "0.0.84",
59
- "@teambit/ui-foundation.ui.use-box.menu": "0.0.84",
60
- "@teambit/ui-foundation.ui.react-router.extend-path": "0.0.463"
54
+ "@teambit/compositions": "0.0.556",
55
+ "@teambit/deprecation": "0.0.556",
56
+ "@teambit/envs": "0.0.556",
57
+ "@teambit/component.ui.version-dropdown": "0.0.468",
58
+ "@teambit/ui-foundation.ui.use-box.dropdown": "0.0.85",
59
+ "@teambit/ui-foundation.ui.use-box.menu": "0.0.85",
60
+ "@teambit/ui-foundation.ui.react-router.extend-path": "0.0.464"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/lodash": "4.14.165",
@@ -72,11 +72,11 @@
72
72
  "@types/jest": "^26.0.0",
73
73
  "@types/react-dom": "^17.0.5",
74
74
  "@types/node": "12.20.4",
75
- "@teambit/component.aspect-docs.component": "0.0.105"
75
+ "@teambit/component.aspect-docs.component": "0.0.106"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "@apollo/client": "^3.0.0",
79
- "@teambit/legacy": "1.0.172",
79
+ "@teambit/legacy": "1.0.173",
80
80
  "react-dom": "^16.8.0 || ^17.0.0",
81
81
  "react": "^16.8.0 || ^17.0.0"
82
82
  },
@@ -104,12 +104,18 @@
104
104
  "react": "-"
105
105
  },
106
106
  "peerDependencies": {
107
- "@teambit/legacy": "1.0.172",
107
+ "@teambit/legacy": "1.0.173",
108
108
  "react-dom": "^16.8.0 || ^17.0.0",
109
109
  "react": "^16.8.0 || ^17.0.0"
110
110
  }
111
111
  }
112
112
  },
113
+ "files": [
114
+ "dist",
115
+ "!dist/tsconfig.tsbuildinfo",
116
+ "README.md",
117
+ "README.mdx"
118
+ ],
113
119
  "private": false,
114
120
  "engines": {
115
121
  "node": ">=12.22.0"
package/aspect-entry.ts DELETED
@@ -1,67 +0,0 @@
1
- import { ExtensionDataEntry } from '@teambit/legacy/dist/consumer/config/extension-data';
2
- import { ComponentID } from '@teambit/component-id';
3
-
4
- export type Serializable = {
5
- toString(): string;
6
- };
7
-
8
- export type SerializableMap = {
9
- [key: string]: Serializable;
10
- };
11
-
12
- export type AspectData = {
13
- [key: string]: any;
14
- };
15
-
16
- export class AspectEntry {
17
- constructor(public id: ComponentID, private legacyEntry: ExtensionDataEntry) {}
18
-
19
- get legacy() {
20
- return this.legacyEntry;
21
- }
22
-
23
- get isLegacy(): boolean {
24
- if (this.config?.__legacy) return true;
25
- return false;
26
- }
27
-
28
- get config() {
29
- return this.legacy.config;
30
- }
31
-
32
- set config(config) {
33
- this.legacy.config = config;
34
- }
35
-
36
- get data(): { [key: string]: any } {
37
- return this.legacy.data;
38
- }
39
-
40
- get isRemoved(): boolean {
41
- return this.legacy.isRemoved;
42
- }
43
-
44
- // eslint-disable-next-line @typescript-eslint/adjacent-overload-signatures
45
- set data(val: { [key: string]: any }) {
46
- this.legacy.data = val;
47
- }
48
-
49
- transform(newData: SerializableMap): AspectEntry {
50
- const newEntry = this.clone();
51
- newEntry.data = newData;
52
- return new AspectEntry(this.id, newEntry.legacy);
53
- }
54
-
55
- clone(): AspectEntry {
56
- return new AspectEntry(this.id, this.legacyEntry.clone());
57
- }
58
-
59
- serialize() {
60
- return {
61
- id: this.id.toString(),
62
- config: this.config,
63
- data: this.data,
64
- icon: 'https://static.bit.dev/extensions-icons/default.svg', // TODO @gilad - once you connect the icon here please use this url as the default icon
65
- };
66
- }
67
- }
package/aspect-list.ts DELETED
@@ -1,100 +0,0 @@
1
- import { isEmpty } from 'lodash';
2
- import { ExtensionDataList, ExtensionDataEntry } from '@teambit/legacy/dist/consumer/config/extension-data';
3
- import { ComponentID } from '@teambit/component-id';
4
- import { AspectEntry, SerializableMap } from './aspect-entry';
5
-
6
- /**
7
- * list of aspects, each may have data and artifacts saved per component.
8
- */
9
- export class AspectList {
10
- constructor(readonly entries: AspectEntry[]) {}
11
-
12
- addEntry(aspectId: ComponentID, data: SerializableMap = {}) {
13
- const extensionDataEntry = new ExtensionDataEntry(undefined, aspectId._legacy, undefined, {}, data);
14
- const entry = new AspectEntry(aspectId, extensionDataEntry);
15
- this.entries.push(entry);
16
- return entry;
17
- }
18
-
19
- /**
20
- * get all ids as strings from the aspect list.
21
- */
22
- get ids(): string[] {
23
- const list = this.entries.map((entry) => entry.id.toString());
24
- return list;
25
- }
26
-
27
- /**
28
- * get an aspect from the list using a serialized ID.
29
- */
30
- get(id: string): AspectEntry | undefined {
31
- return this.entries.find((entry) => {
32
- return entry.legacy.stringId === id;
33
- });
34
- }
35
-
36
- /**
37
- * find aspect by component ID.
38
- */
39
- find(id: ComponentID, ignoreVersion = false): AspectEntry | undefined {
40
- return this.entries.find((aspectEntry) => {
41
- return id.isEqual(aspectEntry.id, { ignoreVersion });
42
- });
43
- }
44
-
45
- /**
46
- * transform an aspect list into a new one.
47
- */
48
- map(predicate: (entry: AspectEntry) => AspectEntry) {
49
- const entries = this.entries.map(predicate);
50
- return new AspectList(entries);
51
- }
52
-
53
- /**
54
- * transform an aspect list into a new one.
55
- */
56
- async pmap(predicate: (entry: AspectEntry) => Promise<AspectEntry>) {
57
- const entriesP = this.entries.map(predicate);
58
- const entries = await Promise.all(entriesP);
59
- return new AspectList(entries);
60
- }
61
-
62
- toConfigObject() {
63
- const res = {};
64
- this.entries.forEach((entry) => {
65
- if (entry.config && !isEmpty(entry.config)) {
66
- res[entry.id.toString()] = entry.config;
67
- }
68
- });
69
- return res;
70
- }
71
-
72
- serialize() {
73
- const serializedEntries = this.entries.map((entry) => entry.serialize());
74
- return serializedEntries;
75
- }
76
-
77
- toLegacy(): ExtensionDataList {
78
- const legacyEntries = this.entries.map((entry) => entry.legacy);
79
- return ExtensionDataList.fromArray(legacyEntries);
80
- }
81
-
82
- stringIds(): string[] {
83
- const ids = this.entries.map((entry) => entry.id.toString());
84
- return ids;
85
- }
86
-
87
- static fromLegacyExtensions(legacyDataList: ExtensionDataList, scope?: string): AspectList {
88
- const newEntries = legacyDataList.map((entry) => {
89
- return new AspectEntry(getAspectId(entry, scope), entry);
90
- });
91
-
92
- return new AspectList(newEntries);
93
- }
94
- }
95
-
96
- function getAspectId(entry: ExtensionDataEntry, scope?: string) {
97
- if (!entry.extensionId && entry.name) return ComponentID.fromString(entry.name);
98
- if (entry.extensionId) return ComponentID.fromLegacy(entry.extensionId, scope);
99
- throw new Error('aspect cannot be loaded without setting an ID');
100
- }
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import { MenuWidgetIcon } from '@teambit/ui-foundation.ui.menu-widget-icon';
3
- import { Section } from './section';
4
- import { AspectPage } from './ui/aspect-page';
5
-
6
- export class AspectSection implements Section {
7
- route = {
8
- path: '~aspect',
9
- children: <AspectPage />,
10
- };
11
- navigationLink = {
12
- href: '~aspect',
13
- children: <MenuWidgetIcon icon="configuration" tooltipContent="Configuration" />,
14
- };
15
- order = 50;
16
- }
@@ -1,106 +0,0 @@
1
- import { BitId } from '@teambit/legacy-bit-id';
2
- import LegacyGraph from '@teambit/legacy/dist/scope/graph/graph';
3
- import ConsumerComponent from '@teambit/legacy/dist/consumer/component';
4
- import type { ComponentLog } from '@teambit/legacy/dist/scope/models/model-component';
5
- import type { AspectDefinition } from '@teambit/aspect-loader';
6
- import { ComponentID } from '@teambit/component-id';
7
- import { Component, InvalidComponent } from './component';
8
- import { State } from './state';
9
- import { Snap } from './snap';
10
-
11
- export interface ComponentFactory {
12
- /**
13
- * name of the component host.
14
- */
15
- name: string;
16
-
17
- /**
18
- * path to the component host.
19
- */
20
- path: string;
21
-
22
- isLegacy: boolean;
23
-
24
- /**
25
- * resolve a `string` component ID to an instance of a ComponentID.
26
- */
27
- resolveComponentId(id: string | ComponentID | BitId): Promise<ComponentID>;
28
-
29
- /**
30
- * resolve multiple `string` component ID to an instance of a ComponentID.
31
- */
32
- resolveMultipleComponentIds(ids: (string | ComponentID | BitId)[]): Promise<ComponentID[]>;
33
-
34
- /**
35
- * returns a component by ID.
36
- */
37
- get(
38
- id: ComponentID | string,
39
- withState?: boolean,
40
- consumerComponent?: ConsumerComponent
41
- ): Promise<Component | undefined>;
42
-
43
- /**
44
- * returns many components by ids.
45
- */
46
- getMany(ids: ComponentID[]): Promise<Component[]>;
47
-
48
- /**
49
- * returns many components by their legacy representation.
50
- */
51
- getManyByLegacy(components: ConsumerComponent[]): Promise<Component[]>;
52
-
53
- /**
54
- * get a component from a remote without importing it
55
- */
56
- getRemoteComponent?: (id: ComponentID) => Promise<Component>;
57
-
58
- getLegacyGraph(ids?: ComponentID[]): Promise<LegacyGraph>;
59
-
60
- getLogs(id: ComponentID): Promise<ComponentLog[]>;
61
-
62
- /**
63
- * returns a specific state of a component by hash or semver.
64
- */
65
- getState(id: ComponentID, snapId: string): Promise<State>;
66
-
67
- /**
68
- * returns a specific snap of a component by hash.
69
- */
70
- getSnap(id: ComponentID, snapId: string): Promise<Snap>;
71
-
72
- /**
73
- * load extension.
74
- */
75
- loadAspects: (ids: string[], throwOnError: boolean) => Promise<void>;
76
-
77
- /**
78
- * Resolve dirs for aspects
79
- */
80
- resolveAspects: (runtimeName?: string, componentIds?: ComponentID[]) => Promise<AspectDefinition[]>;
81
-
82
- /**
83
- * list all components in the host.
84
- */
85
- list(filter?: { offset: number; limit: number }): Promise<Component[]>;
86
-
87
- /**
88
- * list invalid components, such as components with missing files on the fs.
89
- */
90
- listInvalid(): Promise<InvalidComponent[]>;
91
-
92
- listIds(): Promise<ComponentID[]>;
93
-
94
- hasId(componentId: ComponentID): Promise<boolean>;
95
-
96
- /**
97
- * Check if the host has the id, if no, search for the id in inner host (for example, workspace will search in the scope)
98
- * @param componentId
99
- */
100
- hasIdNested(componentId: ComponentID, includeCache?: boolean): Promise<boolean>;
101
-
102
- /**
103
- * determine whether host should be the prior one in case multiple hosts persist.
104
- */
105
- priority?: boolean;
106
- }
package/component-fs.ts DELETED
@@ -1,60 +0,0 @@
1
- import { MemoryFS } from '@teambit/any-fs';
2
- import type { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';
3
- import { auto } from '@teambit/legacy/dist/utils/eol';
4
- import path from 'path';
5
- import minimatch from 'minimatch';
6
-
7
- /**
8
- * The virtual component filesystem
9
- */
10
- export default class ComponentFS extends MemoryFS {
11
- constructor(
12
- /**
13
- * array of all fs files.
14
- */
15
- readonly files: AbstractVinyl[]
16
- ) {
17
- super();
18
- }
19
- /**
20
- * hash to represent all contents within this filesystem volume.
21
- */
22
- get hash() {
23
- return '';
24
- }
25
-
26
- /**
27
- * filter all component files by regex.
28
- */
29
- byRegex(extension: RegExp): AbstractVinyl[] {
30
- return this.files.filter((file) => file.path.match(extension));
31
- }
32
-
33
- /**
34
- * filter all files using an array of glob patterns.
35
- */
36
- byGlob(patterns: string[]) {
37
- return this.files.filter((file) => {
38
- return patterns.find((pattern) => {
39
- const match = minimatch(file.relative, pattern);
40
- return match;
41
- });
42
- });
43
- }
44
-
45
- toObject() {}
46
-
47
- toJSON() {}
48
-
49
- static fromVinyls(files: AbstractVinyl[]) {
50
- const fs = new ComponentFS(files);
51
- files.forEach((file) => {
52
- let dirPath = file.relativeDir;
53
- if (!dirPath.startsWith('/')) dirPath = path.join('/', dirPath);
54
- fs.mkdirpSync(dirPath);
55
- fs.writeFileSync(`/${file.relative}`, auto(file.contents || ''));
56
- });
57
-
58
- return fs;
59
- }
60
- }
@@ -1,106 +0,0 @@
1
- import { ComponentID } from '@teambit/component-id';
2
- import { Component } from '../component';
3
-
4
- /**
5
- * allows to index components -> values.
6
- */
7
- export class ComponentMap<T> {
8
- constructor(readonly hashMap: Map<string, [Component, T]>) {}
9
-
10
- /**
11
- * @deprecated please use `get` instead
12
- */
13
- byComponent(component: Component) {
14
- return this.hashMap.get(component.id.toString());
15
- }
16
-
17
- get components() {
18
- return this.toArray().map(([component]) => component);
19
- }
20
-
21
- /**
22
- * get a value for a component.
23
- */
24
- get(component: Component) {
25
- return this.hashMap.get(component.id.toString());
26
- }
27
-
28
- /**
29
- * get a value by the component-id
30
- */
31
- getValueByComponentId(componentId: ComponentID): T | null {
32
- const tuple = this.hashMap.get(componentId.toString());
33
- if (!tuple) return null;
34
- return tuple[1];
35
- }
36
-
37
- /**
38
- * returns an array.
39
- */
40
- toArray() {
41
- return Array.from(this.hashMap.values());
42
- }
43
-
44
- /**
45
- * map entries and return a new component map.
46
- */
47
- map<NewType>(predicate: (value: T, component: Component) => NewType): ComponentMap<NewType> {
48
- const tuples: [string, [Component, NewType]][] = this.toArray().map(([component, value]) => {
49
- const newValue = predicate(value, component);
50
- return [component.id.toString(), [component, newValue]];
51
- });
52
-
53
- return new ComponentMap(new Map(tuples));
54
- }
55
- /**
56
- * flatten values of all components into a single array.
57
- */
58
- flattenValue(): T[] {
59
- return this.toArray().reduce((acc: T[], [, value]) => {
60
- acc = acc.concat(value);
61
- return acc;
62
- }, []);
63
- }
64
-
65
- /**
66
- * filter all components with empty values and return a new map.
67
- */
68
- filter(predicate: (value: T) => boolean): ComponentMap<T> {
69
- const tuples = this.toArray().filter(([, value]) => {
70
- return predicate(value);
71
- });
72
-
73
- const asMap: [string, [Component, T]][] = tuples.map(([component, value]) => {
74
- return [component.id.toString(), [component, value]];
75
- });
76
-
77
- return new ComponentMap(new Map(asMap));
78
- }
79
-
80
- /**
81
- * get all component ids.
82
- */
83
- keys() {
84
- return this.hashMap.keys();
85
- }
86
-
87
- static create<U>(rawMap: [Component, U][]) {
88
- const newMap: [string, [Component, U]][] = rawMap.map(([component, data]) => {
89
- return [component.id.toString(), [component, data]];
90
- });
91
- return new ComponentMap(new Map(newMap));
92
- }
93
-
94
- /**
95
- * create a component map from components and a value predicate.
96
- * @param components components to zip into the map.
97
- * @param predicate predicate for returning desired value.
98
- */
99
- static as<U>(components: Component[], predicate: (component: Component) => U): ComponentMap<U> {
100
- const tuples: [string, [Component, U]][] = components.map((component) => {
101
- return [component.id.toString(), [component, predicate(component)]];
102
- });
103
-
104
- return new ComponentMap(new Map(tuples));
105
- }
106
- }
@@ -1 +0,0 @@
1
- export { ComponentMap } from './component-map';
package/component-meta.ts DELETED
@@ -1,29 +0,0 @@
1
- import { capitalize } from '@teambit/toolbox.string.capitalize';
2
- import { ComponentID } from '@teambit/component-id';
3
-
4
- export class ComponentMeta {
5
- constructor(
6
- /**
7
- * id the component.
8
- */
9
- readonly id: ComponentID
10
- ) {}
11
-
12
- /**
13
- * display name of the component.
14
- */
15
- get displayName() {
16
- const tokens = this.id.name.split('-').map((token) => capitalize(token));
17
- return tokens.join(' ');
18
- }
19
-
20
- toObject() {
21
- return {
22
- id: this.id.toObject(),
23
- };
24
- }
25
-
26
- static from(object: { [key: string]: any }) {
27
- return new ComponentMeta(ComponentID.fromObject(object.id));
28
- }
29
- }
@@ -1,9 +0,0 @@
1
- import { Aspect } from '@teambit/harmony';
2
-
3
- export const ComponentAspect = Aspect.create({
4
- id: 'teambit.component/component',
5
- dependencies: [],
6
- defaultConfig: {},
7
- });
8
-
9
- export default ComponentAspect;
@@ -1,8 +0,0 @@
1
- ---
2
- description: Component aspect for Bit components
3
- labels: ['component', 'bit', 'extension', 'aspect']
4
- ---
5
-
6
- import { Component } from '@teambit/component.aspect-docs.component';
7
-
8
- <Component />