@teambit/component 1.0.227 → 1.0.229
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/artifacts/__bit_junit.xml +1 -1
- package/artifacts/preview/teambit_component_component-preview.js +1 -1
- package/artifacts/schema.json +1643 -695
- package/dist/aspect-entry.d.ts +39 -0
- package/dist/aspect-list.d.ts +43 -0
- package/dist/aspect.section.d.ts +13 -0
- package/dist/component-factory.d.ts +150 -0
- package/dist/component-factory.js.map +1 -1
- package/dist/component-fs.d.ts +34 -0
- package/dist/component-interface.d.ts +22 -0
- package/dist/component-map/component-map.d.ts +63 -0
- package/dist/component-map/index.d.ts +1 -0
- package/dist/component-meta.d.ts +22 -0
- package/dist/component.aspect.d.ts +3 -0
- package/dist/component.composition.d.ts +1 -0
- package/dist/component.d.ts +183 -0
- package/dist/component.graphql.d.ts +83 -0
- package/dist/component.js +3 -0
- package/dist/component.js.map +1 -1
- package/dist/component.main.runtime.d.ts +75 -0
- package/dist/component.route.d.ts +18 -0
- package/dist/component.ui.runtime.d.ts +104 -0
- package/dist/config.d.ts +18 -0
- package/dist/dependencies/dependencies.d.ts +43 -0
- package/dist/dependencies/index.d.ts +1 -0
- package/dist/exceptions/could-not-find-latest.d.ts +4 -0
- package/dist/exceptions/host-not-found.d.ts +12 -0
- package/dist/exceptions/index.d.ts +4 -0
- package/dist/exceptions/main-file-not-found.d.ts +14 -0
- package/dist/exceptions/nothing-to-snap.d.ts +2 -0
- package/dist/get-component-opts.d.ts +13 -0
- package/dist/hash.d.ts +4 -0
- package/dist/head.d.ts +0 -0
- package/dist/history-graph.d.ts +2 -0
- package/dist/host/component-host-model.d.ts +7 -0
- package/dist/host/index.d.ts +2 -0
- package/dist/host/use-component-host.d.ts +6 -0
- package/dist/index.d.ts +37 -0
- package/dist/on-load.d.ts +0 -0
- package/dist/{preview-1712719054377.js → preview-1712822929999.js} +2 -2
- package/dist/section/index.d.ts +1 -0
- package/dist/section/section.d.ts +11 -0
- package/dist/show/extensions.fragment.d.ts +13 -0
- package/dist/show/files.fragment.d.ts +14 -0
- package/dist/show/id.fragment.d.ts +13 -0
- package/dist/show/index.d.ts +8 -0
- package/dist/show/main-file.fragment.d.ts +9 -0
- package/dist/show/name.fragment.d.ts +9 -0
- package/dist/show/scope.fragment.d.ts +10 -0
- package/dist/show/show-fragment.d.ts +37 -0
- package/dist/show/show.cmd.d.ts +26 -0
- package/dist/snap/author.d.ts +17 -0
- package/dist/snap/index.d.ts +2 -0
- package/dist/snap/snap.d.ts +56 -0
- package/dist/state.d.ts +65 -0
- package/dist/store.d.ts +3 -0
- package/dist/tag/index.d.ts +1 -0
- package/dist/tag/tag.d.ts +32 -0
- package/dist/tag-map.d.ts +35 -0
- package/dist/ui/aspect-page/aspect-page.d.ts +1 -0
- package/dist/ui/aspect-page/index.d.ts +1 -0
- package/dist/ui/component-error/component-error.d.ts +20 -0
- package/dist/ui/component-error/index.d.ts +1 -0
- package/dist/ui/component-model/component-model.d.ts +186 -0
- package/dist/ui/component-model/index.d.ts +1 -0
- package/dist/ui/component-searcher/component-result.d.ts +16 -0
- package/dist/ui/component-searcher/component-searcher.d.ts +22 -0
- package/dist/ui/component-searcher/index.d.ts +2 -0
- package/dist/ui/component.d.ts +26 -0
- package/dist/ui/context/component-context.d.ts +6 -0
- package/dist/ui/context/component-provider.d.ts +25 -0
- package/dist/ui/context/index.d.ts +3 -0
- package/dist/ui/index.d.ts +12 -0
- package/dist/ui/menu/index.d.ts +3 -0
- package/dist/ui/menu/menu-nav.d.ts +23 -0
- package/dist/ui/menu/menu.d.ts +97 -0
- package/dist/ui/menu/nav-plugin.d.ts +28 -0
- package/dist/ui/top-bar-nav/index.d.ts +1 -0
- package/dist/ui/top-bar-nav/top-bar-nav.d.ts +2 -0
- package/dist/ui/use-component-from-location.d.ts +1 -0
- package/dist/ui/use-component-logs.d.ts +16 -0
- package/dist/ui/use-component-query.d.ts +3 -0
- package/dist/ui/use-component.d.ts +3 -0
- package/dist/ui/use-component.fragments.d.ts +10 -0
- package/dist/ui/use-component.model.d.ts +44 -0
- package/dist/ui/use-component.utils.d.ts +1 -0
- package/package.json +20 -20
- package/tsconfig.json +1 -46
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ShowFragment } from './show-fragment';
|
|
2
|
+
import { Component } from '../component';
|
|
3
|
+
export declare class FilesFragment implements ShowFragment {
|
|
4
|
+
renderRow(component: Component): Promise<{
|
|
5
|
+
title: string;
|
|
6
|
+
content: string;
|
|
7
|
+
}>;
|
|
8
|
+
json(component: Component): Promise<{
|
|
9
|
+
title: string;
|
|
10
|
+
json: string[];
|
|
11
|
+
}>;
|
|
12
|
+
private getRelativePaths;
|
|
13
|
+
weight: number;
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ShowFragment } from './show-fragment';
|
|
2
|
+
import { Component } from '../component';
|
|
3
|
+
export declare class IDFragment implements ShowFragment {
|
|
4
|
+
renderRow(component: Component): Promise<{
|
|
5
|
+
title: string;
|
|
6
|
+
content: string;
|
|
7
|
+
}>;
|
|
8
|
+
json(component: Component): Promise<{
|
|
9
|
+
title: string;
|
|
10
|
+
json: string;
|
|
11
|
+
}>;
|
|
12
|
+
weight: number;
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { ShowFragment, ShowRow, JSONRow as ShowJSONRow } from './show-fragment';
|
|
2
|
+
export { ShowCmd } from './show.cmd';
|
|
3
|
+
export { MainFileFragment } from './main-file.fragment';
|
|
4
|
+
export { NameFragment } from './name.fragment';
|
|
5
|
+
export { IDFragment } from './id.fragment';
|
|
6
|
+
export { ScopeFragment } from './scope.fragment';
|
|
7
|
+
export { FilesFragment } from './files.fragment';
|
|
8
|
+
export { ExtensionsFragment } from './extensions.fragment';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ShowFragment } from './show-fragment';
|
|
2
|
+
import { Component } from '../component';
|
|
3
|
+
export declare class ScopeFragment implements ShowFragment {
|
|
4
|
+
renderRow(component: Component): Promise<{
|
|
5
|
+
title: string;
|
|
6
|
+
content: string;
|
|
7
|
+
}>;
|
|
8
|
+
getRow(): void;
|
|
9
|
+
weight: number;
|
|
10
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Component } from '../component';
|
|
2
|
+
export interface ShowFragment {
|
|
3
|
+
/**
|
|
4
|
+
* render a row into the `show` CLI.
|
|
5
|
+
*/
|
|
6
|
+
renderRow(component: Component): Promise<ShowRow>;
|
|
7
|
+
/**
|
|
8
|
+
* return a json output.
|
|
9
|
+
*/
|
|
10
|
+
json?(component: Component): Promise<JSONRow>;
|
|
11
|
+
/**
|
|
12
|
+
* weight is used to determine the position of the fragment
|
|
13
|
+
* within the `show` table.
|
|
14
|
+
*/
|
|
15
|
+
weight?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface JSONRow {
|
|
18
|
+
/**
|
|
19
|
+
* name of the field.
|
|
20
|
+
*/
|
|
21
|
+
title: string;
|
|
22
|
+
/**
|
|
23
|
+
* json content.
|
|
24
|
+
* TODO: change this from any to a more structured type (e.g. Serializable).
|
|
25
|
+
*/
|
|
26
|
+
json: any;
|
|
27
|
+
}
|
|
28
|
+
export interface ShowRow {
|
|
29
|
+
/**
|
|
30
|
+
* title of the fragment
|
|
31
|
+
*/
|
|
32
|
+
title: string;
|
|
33
|
+
/**
|
|
34
|
+
* content to render within the fragment.
|
|
35
|
+
*/
|
|
36
|
+
content: string;
|
|
37
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Command, CommandOptions } from '@teambit/cli';
|
|
2
|
+
import { ComponentMain } from '../component.main.runtime';
|
|
3
|
+
export declare class ShowCmd implements Command {
|
|
4
|
+
private component;
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
alias: string;
|
|
8
|
+
group: string;
|
|
9
|
+
arguments: {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
}[];
|
|
13
|
+
options: CommandOptions;
|
|
14
|
+
constructor(component: ComponentMain);
|
|
15
|
+
private getComponent;
|
|
16
|
+
useLegacy(id: string, json?: boolean, remote?: boolean, compare?: boolean): Promise<string>;
|
|
17
|
+
report([idStr]: [string], { legacy, remote, compare }: {
|
|
18
|
+
legacy: boolean;
|
|
19
|
+
remote: boolean;
|
|
20
|
+
compare: boolean;
|
|
21
|
+
}): Promise<string>;
|
|
22
|
+
json([idStr]: [string], { remote, legacy }: {
|
|
23
|
+
remote: boolean;
|
|
24
|
+
legacy: boolean;
|
|
25
|
+
}): Promise<any>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* author type.
|
|
3
|
+
*/
|
|
4
|
+
export type Author = {
|
|
5
|
+
/**
|
|
6
|
+
* author full name (for example: "Ran Mizrahi")
|
|
7
|
+
*/
|
|
8
|
+
displayName: string;
|
|
9
|
+
/**
|
|
10
|
+
* author username (for example: "ranm8")
|
|
11
|
+
*/
|
|
12
|
+
name?: string;
|
|
13
|
+
/**
|
|
14
|
+
* author email in a proper format (e.g. "ran@bit.dev")
|
|
15
|
+
*/
|
|
16
|
+
email: string;
|
|
17
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Author } from './author';
|
|
2
|
+
export type SnapProps = {
|
|
3
|
+
hash: string;
|
|
4
|
+
timestamp: string;
|
|
5
|
+
parents: string[];
|
|
6
|
+
author: Author;
|
|
7
|
+
message: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* `Snap` represents a sealed state of the component in the working tree.
|
|
11
|
+
*/
|
|
12
|
+
export declare class Snap {
|
|
13
|
+
/**
|
|
14
|
+
* hash of the snap.
|
|
15
|
+
*/
|
|
16
|
+
readonly hash: string;
|
|
17
|
+
/**
|
|
18
|
+
* date time of the snap.
|
|
19
|
+
*/
|
|
20
|
+
readonly timestamp: Date;
|
|
21
|
+
/**
|
|
22
|
+
* parent snap
|
|
23
|
+
*/
|
|
24
|
+
readonly parents: string[];
|
|
25
|
+
/**
|
|
26
|
+
* author of the component `Snap`.
|
|
27
|
+
*/
|
|
28
|
+
readonly author: Author;
|
|
29
|
+
/**
|
|
30
|
+
* message added by the `Snap` author.
|
|
31
|
+
*/
|
|
32
|
+
readonly message: string;
|
|
33
|
+
constructor(
|
|
34
|
+
/**
|
|
35
|
+
* hash of the snap.
|
|
36
|
+
*/
|
|
37
|
+
hash: string,
|
|
38
|
+
/**
|
|
39
|
+
* date time of the snap.
|
|
40
|
+
*/
|
|
41
|
+
timestamp: Date,
|
|
42
|
+
/**
|
|
43
|
+
* parent snap
|
|
44
|
+
*/
|
|
45
|
+
parents: string[],
|
|
46
|
+
/**
|
|
47
|
+
* author of the component `Snap`.
|
|
48
|
+
*/
|
|
49
|
+
author: Author,
|
|
50
|
+
/**
|
|
51
|
+
* message added by the `Snap` author.
|
|
52
|
+
*/
|
|
53
|
+
message: string);
|
|
54
|
+
static fromObject(snapObject: SnapProps): Snap;
|
|
55
|
+
toObject(): SnapProps;
|
|
56
|
+
}
|
package/dist/state.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { IssuesList } from '@teambit/component-issues';
|
|
2
|
+
import ComponentFS from './component-fs';
|
|
3
|
+
import { Config } from './config';
|
|
4
|
+
import { AspectList } from './aspect-list';
|
|
5
|
+
export declare class State {
|
|
6
|
+
/**
|
|
7
|
+
* component configuration which is later generated to a component `package.json` and `bit.json`.
|
|
8
|
+
* @deprecated please use `aspects` instead.
|
|
9
|
+
*/
|
|
10
|
+
readonly config: Config;
|
|
11
|
+
/**
|
|
12
|
+
* list of aspects configured on the component.
|
|
13
|
+
*/
|
|
14
|
+
private _aspects;
|
|
15
|
+
/**
|
|
16
|
+
* in-memory representation of the component current filesystem.
|
|
17
|
+
*/
|
|
18
|
+
readonly filesystem: ComponentFS;
|
|
19
|
+
/**
|
|
20
|
+
* dependency graph of the component current. ideally package dependencies would be also placed here.
|
|
21
|
+
*/
|
|
22
|
+
readonly dependencies: any;
|
|
23
|
+
/**
|
|
24
|
+
* instance of legacy consumer component.
|
|
25
|
+
*/
|
|
26
|
+
readonly _consumer: any;
|
|
27
|
+
constructor(
|
|
28
|
+
/**
|
|
29
|
+
* component configuration which is later generated to a component `package.json` and `bit.json`.
|
|
30
|
+
* @deprecated please use `aspects` instead.
|
|
31
|
+
*/
|
|
32
|
+
config: Config,
|
|
33
|
+
/**
|
|
34
|
+
* list of aspects configured on the component.
|
|
35
|
+
*/
|
|
36
|
+
_aspects: AspectList,
|
|
37
|
+
/**
|
|
38
|
+
* in-memory representation of the component current filesystem.
|
|
39
|
+
*/
|
|
40
|
+
filesystem: ComponentFS,
|
|
41
|
+
/**
|
|
42
|
+
* dependency graph of the component current. ideally package dependencies would be also placed here.
|
|
43
|
+
*/
|
|
44
|
+
dependencies: any,
|
|
45
|
+
/**
|
|
46
|
+
* instance of legacy consumer component.
|
|
47
|
+
*/
|
|
48
|
+
_consumer: any);
|
|
49
|
+
/**
|
|
50
|
+
* get the main file of the component.
|
|
51
|
+
*/
|
|
52
|
+
get mainFile(): import("@teambit/legacy/dist/consumer/component/sources").AbstractVinyl;
|
|
53
|
+
/**
|
|
54
|
+
* calculate the hash of this state
|
|
55
|
+
*/
|
|
56
|
+
get hash(): string;
|
|
57
|
+
get issues(): IssuesList;
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated please use `component.isModified`.
|
|
60
|
+
* the way it's implemented here is unreliable and will only work if in the legacy the "isModified" was calculated.
|
|
61
|
+
*/
|
|
62
|
+
get isModified(): boolean;
|
|
63
|
+
get aspects(): AspectList;
|
|
64
|
+
set aspects(aspects: AspectList);
|
|
65
|
+
}
|
package/dist/store.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Tag } from './tag';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { SemVer } from 'semver';
|
|
2
|
+
export type TagProps = {
|
|
3
|
+
hash: string;
|
|
4
|
+
version: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* `Tag` provides a sematic reference to a specific state `Snap` in the working tree.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Tag {
|
|
10
|
+
/**
|
|
11
|
+
* tag hash, can be used to load it by component-factory.getSnap
|
|
12
|
+
*/
|
|
13
|
+
readonly hash: string;
|
|
14
|
+
/**
|
|
15
|
+
* sematic version of the snap.
|
|
16
|
+
*/
|
|
17
|
+
readonly version: SemVer;
|
|
18
|
+
constructor(
|
|
19
|
+
/**
|
|
20
|
+
* tag hash, can be used to load it by component-factory.getSnap
|
|
21
|
+
*/
|
|
22
|
+
hash: string,
|
|
23
|
+
/**
|
|
24
|
+
* sematic version of the snap.
|
|
25
|
+
*/
|
|
26
|
+
version: SemVer);
|
|
27
|
+
/**
|
|
28
|
+
* create a plain tag object.
|
|
29
|
+
*/
|
|
30
|
+
toObject(): TagProps;
|
|
31
|
+
static fromObject(tag: TagProps): Tag;
|
|
32
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SemVer } from 'semver';
|
|
2
|
+
import { Hash } from './hash';
|
|
3
|
+
import { Tag } from './tag';
|
|
4
|
+
export declare class TagMap extends Map<SemVer, Tag> {
|
|
5
|
+
/**
|
|
6
|
+
* get snap by hash.
|
|
7
|
+
*/
|
|
8
|
+
byHash(hash: Hash): Tag | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* e.g.
|
|
11
|
+
* {
|
|
12
|
+
* alpha: '1.0.0-alpha.5',
|
|
13
|
+
* dev: '2.2.4-dev.37
|
|
14
|
+
* }
|
|
15
|
+
*/
|
|
16
|
+
getPreReleaseLatestTags(): {
|
|
17
|
+
[preRelease: string]: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Get a map that map snap hash to tag
|
|
21
|
+
*/
|
|
22
|
+
getHashMap(): Map<Hash, Tag>;
|
|
23
|
+
/**
|
|
24
|
+
* get the latest semver from the tag map.
|
|
25
|
+
*/
|
|
26
|
+
getLatest(): string;
|
|
27
|
+
isEmpty(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* get an array of all tags.
|
|
30
|
+
*/
|
|
31
|
+
toArray(): Tag[];
|
|
32
|
+
byVersion(version: string): Tag | undefined;
|
|
33
|
+
static fromArray(tags: Tag[]): TagMap;
|
|
34
|
+
static empty(): TagMap;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function AspectPage(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AspectPage } from './aspect-page';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare class ComponentError {
|
|
2
|
+
/**
|
|
3
|
+
* http status code of error
|
|
4
|
+
*/
|
|
5
|
+
readonly code: number;
|
|
6
|
+
/**
|
|
7
|
+
* error message of the error
|
|
8
|
+
*/
|
|
9
|
+
readonly message?: string | undefined;
|
|
10
|
+
constructor(
|
|
11
|
+
/**
|
|
12
|
+
* http status code of error
|
|
13
|
+
*/
|
|
14
|
+
code: number,
|
|
15
|
+
/**
|
|
16
|
+
* error message of the error
|
|
17
|
+
*/
|
|
18
|
+
message?: string | undefined);
|
|
19
|
+
renderError(): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ComponentError } from './component-error';
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { Composition, CompositionProps } from '@teambit/compositions';
|
|
2
|
+
import { DeprecationInfo } from '@teambit/deprecation';
|
|
3
|
+
import { Descriptor } from '@teambit/envs';
|
|
4
|
+
import { ComponentID, ComponentIdObj } from '@teambit/component-id';
|
|
5
|
+
import { LegacyComponentLog } from '@teambit/legacy-component-log';
|
|
6
|
+
import { ComponentPreviewSize } from '@teambit/preview';
|
|
7
|
+
import { TagMap } from '../../tag-map';
|
|
8
|
+
import { TagProps } from '../../tag/tag';
|
|
9
|
+
export type ComponentModelProps = {
|
|
10
|
+
id: ComponentIdObj;
|
|
11
|
+
description: string;
|
|
12
|
+
buildStatus?: string;
|
|
13
|
+
server?: ComponentServer;
|
|
14
|
+
displayName: string;
|
|
15
|
+
packageName: string;
|
|
16
|
+
compositions?: CompositionProps[];
|
|
17
|
+
tags?: TagProps[];
|
|
18
|
+
issuesCount?: number;
|
|
19
|
+
status?: any;
|
|
20
|
+
deprecation?: DeprecationInfo;
|
|
21
|
+
env?: Descriptor;
|
|
22
|
+
labels?: string[];
|
|
23
|
+
host?: string;
|
|
24
|
+
latest?: string;
|
|
25
|
+
preview?: ComponentPreview;
|
|
26
|
+
logs?: LegacyComponentLog[];
|
|
27
|
+
size?: ComponentPreviewSize;
|
|
28
|
+
};
|
|
29
|
+
export type ComponentPreview = {
|
|
30
|
+
includesEnvTemplate?: boolean;
|
|
31
|
+
isScaling?: boolean;
|
|
32
|
+
onlyOverview?: boolean;
|
|
33
|
+
legacyHeader?: boolean;
|
|
34
|
+
useNameParam?: boolean;
|
|
35
|
+
skipIncludes?: boolean;
|
|
36
|
+
};
|
|
37
|
+
export type ComponentServer = {
|
|
38
|
+
env: string;
|
|
39
|
+
/**
|
|
40
|
+
* Full dev server url.
|
|
41
|
+
*/
|
|
42
|
+
url?: string;
|
|
43
|
+
/**
|
|
44
|
+
* host of the component server (used mostly by cloud providers for remote scopes)
|
|
45
|
+
*/
|
|
46
|
+
host?: string;
|
|
47
|
+
/**
|
|
48
|
+
* This is used mostly by cloud to proxy requests to the correct scope.
|
|
49
|
+
*/
|
|
50
|
+
basePath?: string;
|
|
51
|
+
};
|
|
52
|
+
export declare class ComponentModel {
|
|
53
|
+
/**
|
|
54
|
+
* id of the component
|
|
55
|
+
*/
|
|
56
|
+
readonly id: ComponentID;
|
|
57
|
+
/**
|
|
58
|
+
* display name of the component.
|
|
59
|
+
*/
|
|
60
|
+
readonly displayName: string;
|
|
61
|
+
/**
|
|
62
|
+
* package name of the component.
|
|
63
|
+
*/
|
|
64
|
+
readonly packageName: string;
|
|
65
|
+
/**
|
|
66
|
+
* the component server.
|
|
67
|
+
*/
|
|
68
|
+
readonly server: ComponentServer | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* array of compositions
|
|
71
|
+
*/
|
|
72
|
+
readonly compositions: Composition[];
|
|
73
|
+
/**
|
|
74
|
+
* tags of the component.
|
|
75
|
+
*/
|
|
76
|
+
readonly tags: TagMap;
|
|
77
|
+
/**
|
|
78
|
+
* component build status
|
|
79
|
+
*/
|
|
80
|
+
readonly buildStatus?: string | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* issues of component.
|
|
83
|
+
*/
|
|
84
|
+
readonly issuesCount?: number | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* status of component.
|
|
87
|
+
*/
|
|
88
|
+
readonly status?: any;
|
|
89
|
+
/**
|
|
90
|
+
* deprecation info of the component.
|
|
91
|
+
*/
|
|
92
|
+
readonly deprecation?: DeprecationInfo | undefined;
|
|
93
|
+
/**
|
|
94
|
+
* env descriptor.
|
|
95
|
+
*/
|
|
96
|
+
readonly environment?: Descriptor | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* description of the component.
|
|
99
|
+
*/
|
|
100
|
+
readonly description: string;
|
|
101
|
+
readonly labels: string[];
|
|
102
|
+
/**
|
|
103
|
+
* host of the component
|
|
104
|
+
*/
|
|
105
|
+
readonly host?: string | undefined;
|
|
106
|
+
/**
|
|
107
|
+
*
|
|
108
|
+
* size preview
|
|
109
|
+
*/
|
|
110
|
+
readonly size?: ComponentPreviewSize | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* latest version of component
|
|
113
|
+
*/
|
|
114
|
+
readonly latest?: string | undefined;
|
|
115
|
+
readonly preview?: ComponentPreview | undefined;
|
|
116
|
+
readonly logs?: LegacyComponentLog[] | undefined;
|
|
117
|
+
constructor(
|
|
118
|
+
/**
|
|
119
|
+
* id of the component
|
|
120
|
+
*/
|
|
121
|
+
id: ComponentID,
|
|
122
|
+
/**
|
|
123
|
+
* display name of the component.
|
|
124
|
+
*/
|
|
125
|
+
displayName: string,
|
|
126
|
+
/**
|
|
127
|
+
* package name of the component.
|
|
128
|
+
*/
|
|
129
|
+
packageName: string,
|
|
130
|
+
/**
|
|
131
|
+
* the component server.
|
|
132
|
+
*/
|
|
133
|
+
server: ComponentServer | undefined,
|
|
134
|
+
/**
|
|
135
|
+
* array of compositions
|
|
136
|
+
*/
|
|
137
|
+
compositions: Composition[],
|
|
138
|
+
/**
|
|
139
|
+
* tags of the component.
|
|
140
|
+
*/
|
|
141
|
+
tags: TagMap,
|
|
142
|
+
/**
|
|
143
|
+
* component build status
|
|
144
|
+
*/
|
|
145
|
+
buildStatus?: string | undefined,
|
|
146
|
+
/**
|
|
147
|
+
* issues of component.
|
|
148
|
+
*/
|
|
149
|
+
issuesCount?: number | undefined,
|
|
150
|
+
/**
|
|
151
|
+
* status of component.
|
|
152
|
+
*/
|
|
153
|
+
status?: any,
|
|
154
|
+
/**
|
|
155
|
+
* deprecation info of the component.
|
|
156
|
+
*/
|
|
157
|
+
deprecation?: DeprecationInfo | undefined,
|
|
158
|
+
/**
|
|
159
|
+
* env descriptor.
|
|
160
|
+
*/
|
|
161
|
+
environment?: Descriptor | undefined,
|
|
162
|
+
/**
|
|
163
|
+
* description of the component.
|
|
164
|
+
*/
|
|
165
|
+
description?: string, labels?: string[],
|
|
166
|
+
/**
|
|
167
|
+
* host of the component
|
|
168
|
+
*/
|
|
169
|
+
host?: string | undefined,
|
|
170
|
+
/**
|
|
171
|
+
*
|
|
172
|
+
* size preview
|
|
173
|
+
*/
|
|
174
|
+
size?: ComponentPreviewSize | undefined,
|
|
175
|
+
/**
|
|
176
|
+
* latest version of component
|
|
177
|
+
*/
|
|
178
|
+
latest?: string | undefined, preview?: ComponentPreview | undefined, logs?: LegacyComponentLog[] | undefined);
|
|
179
|
+
get version(): string;
|
|
180
|
+
/**
|
|
181
|
+
* create an instance of a component from a plain object.
|
|
182
|
+
*/
|
|
183
|
+
static from({ id, server, displayName, compositions, packageName, tags, deprecation, buildStatus, env, status, issuesCount, description, labels, host, latest, preview, size, logs, }: ComponentModelProps): ComponentModel;
|
|
184
|
+
static fromArray(componentsProps: ComponentModelProps[]): ComponentModel[];
|
|
185
|
+
static empty(): ComponentModel;
|
|
186
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ComponentModel, ComponentModelProps } from './component-model';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React, { ComponentType } from 'react';
|
|
2
|
+
import { ComponentModel } from '../component-model';
|
|
3
|
+
export type ComponentPluginProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
component: ComponentModel;
|
|
5
|
+
};
|
|
6
|
+
export type ComponentResultPlugin = {
|
|
7
|
+
key: string;
|
|
8
|
+
start?: ComponentType<ComponentPluginProps>;
|
|
9
|
+
end?: ComponentType<ComponentPluginProps>;
|
|
10
|
+
};
|
|
11
|
+
type ComponentResultProps = {
|
|
12
|
+
component: ComponentModel;
|
|
13
|
+
plugins?: ComponentResultPlugin[];
|
|
14
|
+
};
|
|
15
|
+
export declare function ComponentResult({ component, plugins }: ComponentResultProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SearchResult, FuzzySearchItem, FuzzySearcher } from '@teambit/explorer.ui.command-bar';
|
|
2
|
+
import type { SearchProvider } from '@teambit/command-bar';
|
|
3
|
+
import { ComponentResultPlugin } from './component-result';
|
|
4
|
+
import { ComponentModel } from '../component-model';
|
|
5
|
+
export type { ComponentResultPlugin };
|
|
6
|
+
type ComponentSearchIdx = {
|
|
7
|
+
name: string;
|
|
8
|
+
displayName: string;
|
|
9
|
+
component: ComponentModel;
|
|
10
|
+
};
|
|
11
|
+
type ComponentSearcherOptions = {
|
|
12
|
+
navigate: (path: string) => void;
|
|
13
|
+
resultPlugins?: ComponentResultPlugin[];
|
|
14
|
+
};
|
|
15
|
+
export declare class ComponentSearcher extends FuzzySearcher<ComponentModel, ComponentSearchIdx> implements SearchProvider {
|
|
16
|
+
options: ComponentSearcherOptions;
|
|
17
|
+
constructor(options: ComponentSearcherOptions);
|
|
18
|
+
updatePlugins(plugins: ComponentResultPlugin[]): void;
|
|
19
|
+
test(term: string): boolean;
|
|
20
|
+
protected toSearchableItem(item: ComponentModel): ComponentSearchIdx;
|
|
21
|
+
protected toSearchResult: ({ item }: FuzzySearchItem<ComponentSearchIdx>) => SearchResult;
|
|
22
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { RouteProps } from 'react-router-dom';
|
|
3
|
+
import type { RouteSlot } from '@teambit/ui-foundation.ui.react-router.slot-router';
|
|
4
|
+
import { SlotRegistry } from '@teambit/harmony';
|
|
5
|
+
import { UseComponentType, Filters } from './use-component';
|
|
6
|
+
import { ComponentModel } from './component-model';
|
|
7
|
+
export type ComponentPageSlot = SlotRegistry<ComponentPageElement[]>;
|
|
8
|
+
export type ComponentPageElement = {
|
|
9
|
+
type: 'before' | 'after';
|
|
10
|
+
content: ReactNode;
|
|
11
|
+
};
|
|
12
|
+
export type ComponentProps = {
|
|
13
|
+
containerSlot?: ComponentPageSlot;
|
|
14
|
+
routeSlot: RouteSlot;
|
|
15
|
+
overriddenRoutes?: RouteProps[];
|
|
16
|
+
host: string;
|
|
17
|
+
onComponentChange?: (activeComponent?: ComponentModel) => void;
|
|
18
|
+
useComponent?: UseComponentType;
|
|
19
|
+
useComponentFilters?: () => Filters;
|
|
20
|
+
path?: string;
|
|
21
|
+
componentIdStr?: string | (() => string | undefined);
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* main UI component of the Component extension.
|
|
25
|
+
*/
|
|
26
|
+
export declare function Component({ routeSlot, overriddenRoutes, containerSlot, host, onComponentChange, componentIdStr, useComponent, path, useComponentFilters, }: ComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ComponentDescriptor } from '@teambit/component-descriptor';
|
|
3
|
+
import { ComponentModel } from '../component-model';
|
|
4
|
+
export declare const ComponentContext: React.Context<ComponentModel>;
|
|
5
|
+
export declare const ComponentDescriptorContext: React.Context<ComponentDescriptor | undefined>;
|
|
6
|
+
export declare const useComponentDescriptor: () => ComponentDescriptor | undefined;
|