@teambit/component 0.0.553 → 0.0.557

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 (101) hide show
  1. package/dist/aspect-list.d.ts +18 -0
  2. package/dist/component-factory.d.ts +49 -0
  3. package/dist/component-fs.d.ts +20 -1
  4. package/dist/component-map/component-map.d.ts +32 -0
  5. package/dist/component-meta.d.ts +11 -1
  6. package/dist/component.d.ts +96 -1
  7. package/dist/component.main.runtime.d.ts +30 -1
  8. package/dist/component.ui.runtime.d.ts +21 -1
  9. package/dist/config.d.ts +18 -1
  10. package/dist/dependencies/dependencies.d.ts +18 -0
  11. package/dist/exceptions/host-not-found.d.ts +8 -1
  12. package/dist/hash.d.ts +3 -0
  13. package/dist/show/show-fragment.d.ts +23 -0
  14. package/dist/snap/author.d.ts +12 -0
  15. package/dist/snap/snap.d.ts +39 -1
  16. package/dist/state.d.ts +44 -1
  17. package/dist/tag/tag.d.ts +21 -1
  18. package/dist/tag-map.d.ts +19 -0
  19. package/dist/ui/component-error/component-error.d.ts +15 -1
  20. package/dist/ui/component-model/component-model.d.ts +102 -1
  21. package/dist/ui/component.d.ts +3 -0
  22. package/dist/ui/context/component-provider.d.ts +6 -0
  23. package/dist/ui/menu/menu.d.ts +12 -0
  24. package/dist/ui/use-component-query.d.ts +1 -0
  25. package/package.json +42 -34
  26. package/tsconfig.json +1 -2
  27. package/aspect-entry.ts +0 -67
  28. package/aspect-list.ts +0 -100
  29. package/aspect.section.tsx +0 -16
  30. package/component-factory.ts +0 -106
  31. package/component-fs.ts +0 -60
  32. package/component-map/component-map.ts +0 -106
  33. package/component-map/index.ts +0 -1
  34. package/component-meta.ts +0 -29
  35. package/component.aspect.ts +0 -9
  36. package/component.docs.mdx +0 -8
  37. package/component.graphql.ts +0 -202
  38. package/component.main.runtime.ts +0 -162
  39. package/component.route.ts +0 -26
  40. package/component.ts +0 -278
  41. package/component.ui.runtime.tsx +0 -216
  42. package/config.ts +0 -34
  43. package/dependencies/dependencies.ts +0 -74
  44. package/dependencies/index.ts +0 -1
  45. package/exceptions/could-not-find-latest.ts +0 -8
  46. package/exceptions/host-not-found.ts +0 -14
  47. package/exceptions/index.ts +0 -4
  48. package/exceptions/nothing-to-snap.ts +0 -1
  49. package/hash.ts +0 -4
  50. package/head.ts +0 -0
  51. package/history-graph.ts +0 -1
  52. package/host/component-host-model.ts +0 -9
  53. package/host/index.ts +0 -2
  54. package/host/use-component-host.ts +0 -39
  55. package/index.ts +0 -32
  56. package/on-load.ts +0 -0
  57. package/package-tar/teambit-component-0.0.553.tgz +0 -0
  58. package/section/index.ts +0 -1
  59. package/section/section.tsx +0 -8
  60. package/show/extensions.fragment.ts +0 -23
  61. package/show/files.fragment.ts +0 -24
  62. package/show/id.fragment.ts +0 -20
  63. package/show/index.ts +0 -8
  64. package/show/main-file.fragment.ts +0 -13
  65. package/show/name.fragment.ts +0 -13
  66. package/show/scope.fragment.ts +0 -15
  67. package/show/show-fragment.ts +0 -44
  68. package/show/show.cmd.ts +0 -85
  69. package/snap/author.ts +0 -19
  70. package/snap/index.ts +0 -2
  71. package/snap/snap.ts +0 -63
  72. package/state.ts +0 -73
  73. package/store.ts +0 -3
  74. package/tag/index.ts +0 -1
  75. package/tag/tag.ts +0 -37
  76. package/tag-map.ts +0 -87
  77. package/types/asset.d.ts +0 -29
  78. package/types/style.d.ts +0 -42
  79. package/ui/aspect-page/aspect-page.module.scss +0 -20
  80. package/ui/aspect-page/aspect-page.tsx +0 -64
  81. package/ui/aspect-page/index.ts +0 -1
  82. package/ui/component-error/component-error.tsx +0 -22
  83. package/ui/component-error/index.ts +0 -1
  84. package/ui/component-model/component-model.ts +0 -169
  85. package/ui/component-model/index.ts +0 -1
  86. package/ui/component.module.scss +0 -7
  87. package/ui/component.tsx +0 -48
  88. package/ui/context/component-context.ts +0 -5
  89. package/ui/context/component-provider.tsx +0 -20
  90. package/ui/context/index.ts +0 -2
  91. package/ui/index.ts +0 -3
  92. package/ui/menu/index.ts +0 -2
  93. package/ui/menu/menu-nav.tsx +0 -37
  94. package/ui/menu/menu.module.scss +0 -62
  95. package/ui/menu/menu.tsx +0 -94
  96. package/ui/menu/nav-plugin.tsx +0 -9
  97. package/ui/top-bar-nav/index.ts +0 -1
  98. package/ui/top-bar-nav/top-bar-nav.module.scss +0 -52
  99. package/ui/top-bar-nav/top-bar-nav.tsx +0 -26
  100. package/ui/use-component-query.ts +0 -195
  101. package/ui/use-component.tsx +0 -34
@@ -1,14 +1,32 @@
1
1
  import { ExtensionDataList } from '@teambit/legacy/dist/consumer/config/extension-data';
2
2
  import { ComponentID } from '@teambit/component-id';
3
3
  import { AspectEntry, SerializableMap } from './aspect-entry';
4
+ /**
5
+ * list of aspects, each may have data and artifacts saved per component.
6
+ */
4
7
  export declare class AspectList {
5
8
  readonly entries: AspectEntry[];
6
9
  constructor(entries: AspectEntry[]);
7
10
  addEntry(aspectId: ComponentID, data?: SerializableMap): AspectEntry;
11
+ /**
12
+ * get all ids as strings from the aspect list.
13
+ */
8
14
  get ids(): string[];
15
+ /**
16
+ * get an aspect from the list using a serialized ID.
17
+ */
9
18
  get(id: string): AspectEntry | undefined;
19
+ /**
20
+ * find aspect by component ID.
21
+ */
10
22
  find(id: ComponentID, ignoreVersion?: boolean): AspectEntry | undefined;
23
+ /**
24
+ * transform an aspect list into a new one.
25
+ */
11
26
  map(predicate: (entry: AspectEntry) => AspectEntry): AspectList;
27
+ /**
28
+ * transform an aspect list into a new one.
29
+ */
12
30
  pmap(predicate: (entry: AspectEntry) => Promise<AspectEntry>): Promise<AspectList>;
13
31
  toConfigObject(): {};
14
32
  serialize(): {
@@ -8,28 +8,77 @@ import { Component, InvalidComponent } from './component';
8
8
  import { State } from './state';
9
9
  import { Snap } from './snap';
10
10
  export interface ComponentFactory {
11
+ /**
12
+ * name of the component host.
13
+ */
11
14
  name: string;
15
+ /**
16
+ * path to the component host.
17
+ */
12
18
  path: string;
13
19
  isLegacy: boolean;
20
+ /**
21
+ * resolve a `string` component ID to an instance of a ComponentID.
22
+ */
14
23
  resolveComponentId(id: string | ComponentID | BitId): Promise<ComponentID>;
24
+ /**
25
+ * resolve multiple `string` component ID to an instance of a ComponentID.
26
+ */
15
27
  resolveMultipleComponentIds(ids: (string | ComponentID | BitId)[]): Promise<ComponentID[]>;
28
+ /**
29
+ * returns a component by ID.
30
+ */
16
31
  get(id: ComponentID | string, withState?: boolean, consumerComponent?: ConsumerComponent): Promise<Component | undefined>;
32
+ /**
33
+ * returns many components by ids.
34
+ */
17
35
  getMany(ids: ComponentID[]): Promise<Component[]>;
36
+ /**
37
+ * returns many components by their legacy representation.
38
+ */
18
39
  getManyByLegacy(components: ConsumerComponent[]): Promise<Component[]>;
40
+ /**
41
+ * get a component from a remote without importing it
42
+ */
19
43
  getRemoteComponent?: (id: ComponentID) => Promise<Component>;
20
44
  getLegacyGraph(ids?: ComponentID[]): Promise<LegacyGraph>;
21
45
  getLogs(id: ComponentID): Promise<ComponentLog[]>;
46
+ /**
47
+ * returns a specific state of a component by hash or semver.
48
+ */
22
49
  getState(id: ComponentID, snapId: string): Promise<State>;
50
+ /**
51
+ * returns a specific snap of a component by hash.
52
+ */
23
53
  getSnap(id: ComponentID, snapId: string): Promise<Snap>;
54
+ /**
55
+ * load extension.
56
+ */
24
57
  loadAspects: (ids: string[], throwOnError: boolean) => Promise<void>;
58
+ /**
59
+ * Resolve dirs for aspects
60
+ */
25
61
  resolveAspects: (runtimeName?: string, componentIds?: ComponentID[]) => Promise<AspectDefinition[]>;
62
+ /**
63
+ * list all components in the host.
64
+ */
26
65
  list(filter?: {
27
66
  offset: number;
28
67
  limit: number;
29
68
  }): Promise<Component[]>;
69
+ /**
70
+ * list invalid components, such as components with missing files on the fs.
71
+ */
30
72
  listInvalid(): Promise<InvalidComponent[]>;
31
73
  listIds(): Promise<ComponentID[]>;
32
74
  hasId(componentId: ComponentID): Promise<boolean>;
75
+ /**
76
+ * Check if the host has the id, if no, search for the id in inner host (for example, workspace will search in the scope)
77
+ * @param componentId
78
+ */
33
79
  hasIdNested(componentId: ComponentID, includeCache?: boolean): Promise<boolean>;
80
+ /**
81
+ * determine whether host should be the prior one in case multiple hosts persist.
82
+ */
34
83
  priority?: boolean;
35
84
  }
@@ -1,10 +1,29 @@
1
1
  import { MemoryFS } from '@teambit/any-fs';
2
2
  import type { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';
3
+ /**
4
+ * The virtual component filesystem
5
+ */
3
6
  export default class ComponentFS extends MemoryFS {
7
+ /**
8
+ * array of all fs files.
9
+ */
4
10
  readonly files: AbstractVinyl[];
5
- constructor(files: AbstractVinyl[]);
11
+ constructor(
12
+ /**
13
+ * array of all fs files.
14
+ */
15
+ files: AbstractVinyl[]);
16
+ /**
17
+ * hash to represent all contents within this filesystem volume.
18
+ */
6
19
  get hash(): string;
20
+ /**
21
+ * filter all component files by regex.
22
+ */
7
23
  byRegex(extension: RegExp): AbstractVinyl[];
24
+ /**
25
+ * filter all files using an array of glob patterns.
26
+ */
8
27
  byGlob(patterns: string[]): AbstractVinyl[];
9
28
  toObject(): void;
10
29
  toJSON(): void;
@@ -1,17 +1,49 @@
1
1
  import { ComponentID } from '@teambit/component-id';
2
2
  import { Component } from '../component';
3
+ /**
4
+ * allows to index components -> values.
5
+ */
3
6
  export declare class ComponentMap<T> {
4
7
  readonly hashMap: Map<string, [Component, T]>;
5
8
  constructor(hashMap: Map<string, [Component, T]>);
9
+ /**
10
+ * @deprecated please use `get` instead
11
+ */
6
12
  byComponent(component: Component): [Component, T] | undefined;
7
13
  get components(): Component[];
14
+ /**
15
+ * get a value for a component.
16
+ */
8
17
  get(component: Component): [Component, T] | undefined;
18
+ /**
19
+ * get a value by the component-id
20
+ */
9
21
  getValueByComponentId(componentId: ComponentID): T | null;
22
+ /**
23
+ * returns an array.
24
+ */
10
25
  toArray(): [Component, T][];
26
+ /**
27
+ * map entries and return a new component map.
28
+ */
11
29
  map<NewType>(predicate: (value: T, component: Component) => NewType): ComponentMap<NewType>;
30
+ /**
31
+ * flatten values of all components into a single array.
32
+ */
12
33
  flattenValue(): T[];
34
+ /**
35
+ * filter all components with empty values and return a new map.
36
+ */
13
37
  filter(predicate: (value: T) => boolean): ComponentMap<T>;
38
+ /**
39
+ * get all component ids.
40
+ */
14
41
  keys(): IterableIterator<string>;
15
42
  static create<U>(rawMap: [Component, U][]): ComponentMap<U>;
43
+ /**
44
+ * create a component map from components and a value predicate.
45
+ * @param components components to zip into the map.
46
+ * @param predicate predicate for returning desired value.
47
+ */
16
48
  static as<U>(components: Component[], predicate: (component: Component) => U): ComponentMap<U>;
17
49
  }
@@ -1,7 +1,17 @@
1
1
  import { ComponentID } from '@teambit/component-id';
2
2
  export declare class ComponentMeta {
3
+ /**
4
+ * id the component.
5
+ */
3
6
  readonly id: ComponentID;
4
- constructor(id: ComponentID);
7
+ constructor(
8
+ /**
9
+ * id the component.
10
+ */
11
+ id: ComponentID);
12
+ /**
13
+ * display name of the component.
14
+ */
5
15
  get displayName(): string;
6
16
  toObject(): {
7
17
  id: import("@teambit/component-id").ComponentIdObj;
@@ -17,32 +17,127 @@ export declare type InvalidComponent = {
17
17
  id: ComponentID;
18
18
  err: Error;
19
19
  };
20
+ /**
21
+ * in-memory representation of a component.
22
+ */
20
23
  export declare class Component {
24
+ /**
25
+ * component ID represented by the `ComponentId` type.
26
+ */
21
27
  readonly id: ComponentID;
28
+ /**
29
+ * head version of the component. can be `null` for new components.
30
+ */
22
31
  readonly head: Snap | null;
32
+ /**
33
+ * state of the component.
34
+ */
23
35
  private _state;
36
+ /**
37
+ * tags of the component.
38
+ */
24
39
  readonly tags: TagMap;
40
+ /**
41
+ * the component factory
42
+ */
25
43
  private factory;
26
- constructor(id: ComponentID, head: Snap | null, _state: State, tags: TagMap, factory: ComponentFactory);
44
+ constructor(
45
+ /**
46
+ * component ID represented by the `ComponentId` type.
47
+ */
48
+ id: ComponentID,
49
+ /**
50
+ * head version of the component. can be `null` for new components.
51
+ */
52
+ head: Snap | null,
53
+ /**
54
+ * state of the component.
55
+ */
56
+ _state: State,
57
+ /**
58
+ * tags of the component.
59
+ */
60
+ tags: TagMap,
61
+ /**
62
+ * the component factory
63
+ */
64
+ factory: ComponentFactory);
27
65
  get state(): State;
28
66
  set state(state: State);
67
+ /**
68
+ * component configuration which is later generated to a component `package.json` and `bit.json`.
69
+ */
29
70
  get config(): ComponentConfig;
71
+ /**
72
+ * in-memory representation of the component current filesystem.
73
+ */
30
74
  get filesystem(): ComponentFS;
75
+ /**
76
+ * build status of the component
77
+ */
31
78
  get buildStatus(): BuildStatus;
32
79
  get headTag(): Tag | undefined;
33
80
  get latest(): string | undefined;
34
81
  stringify(): string;
82
+ /**
83
+ * record component changes in the `Scope`.
84
+ */
85
+ /**
86
+ * display name of the component.
87
+ */
35
88
  get displayName(): string;
89
+ /**
90
+ * tag a component `Snap` with a semantic version. we follow SemVer specs as defined [here](https://semver.org/)).
91
+ */
36
92
  tag(version: SemVer): void;
93
+ /**
94
+ * determines whether this component is modified in the workspace.
95
+ */
37
96
  isModified(): Promise<boolean>;
97
+ /**
98
+ * is component isOutdated
99
+ */
38
100
  isOutdated(): boolean;
101
+ /**
102
+ * determines whether this component is new.
103
+ */
39
104
  isNew(): Promise<boolean>;
40
105
  loadState(snapId: string): Promise<State>;
41
106
  loadSnap(snapId?: string): Promise<Snap>;
107
+ /**
108
+ * Get iterable which iterate over snap parents lazily
109
+ * @param snapId
110
+ * @param options
111
+ */
42
112
  snapsIterable(snapId?: string, options?: SnapsIterableOpts): AsyncIterable<Snap>;
113
+ /**
114
+ * traverse recursively from the provided snap (or head) upwards until it finds a tag
115
+ * @param snapToStartFrom
116
+ */
43
117
  getClosestTag(snapToStartFrom?: string): Promise<Tag | undefined>;
118
+ /**
119
+ * checkout the component to a different version in its working tree.
120
+ */
44
121
  checkout(version: SemVer): void;
122
+ /**
123
+ * examine difference between two components.
124
+ */
125
+ /**
126
+ * merge two different components
127
+ */
128
+ /**
129
+ * write a component to a given file system.
130
+ * @param path root path to write the component
131
+ * @param fs instance of any fs to use.
132
+ */
45
133
  write(path: string, fs?: AnyFS): void;
134
+ /**
135
+ *
136
+ * Check if 2 components are equal
137
+ * @param {Component} component
138
+ * @returns {boolean}
139
+ * @memberof Component
140
+ */
46
141
  equals(component: Component): boolean;
47
142
  }
48
143
  export {};
@@ -12,20 +12,49 @@ import { ShowFragment } from './show';
12
12
  export declare type ComponentHostSlot = SlotRegistry<ComponentFactory>;
13
13
  export declare type ShowFragmentSlot = SlotRegistry<ShowFragment[]>;
14
14
  export declare class ComponentMain {
15
+ /**
16
+ * slot for component hosts to register.
17
+ */
15
18
  private hostSlot;
19
+ /**
20
+ * Express Extension
21
+ */
16
22
  private express;
17
23
  private showFragmentSlot;
18
- constructor(hostSlot: ComponentHostSlot, express: ExpressMain, showFragmentSlot: ShowFragmentSlot);
24
+ constructor(
25
+ /**
26
+ * slot for component hosts to register.
27
+ */
28
+ hostSlot: ComponentHostSlot,
29
+ /**
30
+ * Express Extension
31
+ */
32
+ express: ExpressMain, showFragmentSlot: ShowFragmentSlot);
33
+ /**
34
+ * register a new component host.
35
+ */
19
36
  registerHost(host: ComponentFactory): this;
20
37
  createAspectList(legacyExtensionDataList: ExtensionDataList, scope?: string): AspectList;
21
38
  createAspectListFromEntries(entries: AspectEntry[]): AspectList;
22
39
  registerRoute(routes: Route[]): this;
40
+ /**
41
+ * set the prior host.
42
+ */
23
43
  setHostPriority(id: string): this;
44
+ /**
45
+ * get component host by extension ID.
46
+ */
24
47
  getHost(id?: string): ComponentFactory;
25
48
  getRoute(id: ComponentID, routeName: string): string;
49
+ /**
50
+ * get the prior host.
51
+ */
26
52
  private getPriorHost;
27
53
  getShowFragments(): ShowFragment[];
28
54
  isHost(name: string): boolean;
55
+ /**
56
+ * register a show fragment to display further information in the `bit show` command.
57
+ */
29
58
  registerShowFragments(showFragments: ShowFragment[]): this;
30
59
  private _priorHost;
31
60
  static slots: (((registerFn: () => string) => SlotRegistry<Route[]>) | ((registerFn: () => string) => SlotRegistry<ComponentFactory>) | ((registerFn: () => string) => SlotRegistry<ShowFragment[]>))[];
@@ -16,17 +16,37 @@ export declare type ComponentMeta = {
16
16
  };
17
17
  export declare const componentIdUrlRegex = "[\\w\\/-]*[\\w-]";
18
18
  export declare class ComponentUI {
19
+ /**
20
+ * Pubsub aspects
21
+ */
19
22
  private pubsub;
20
23
  private routeSlot;
21
24
  private navSlot;
25
+ /**
26
+ * slot for registering a new widget to the menu.
27
+ */
22
28
  private widgetSlot;
23
29
  private menuItemSlot;
24
30
  private pageItemSlot;
25
31
  private commandBarUI;
26
32
  readonly routePath: string;
27
- constructor(pubsub: PubsubUI, routeSlot: RouteSlot, navSlot: OrderedNavigationSlot, widgetSlot: OrderedNavigationSlot, menuItemSlot: MenuItemSlot, pageItemSlot: ComponentPageSlot, commandBarUI: CommandBarUI);
33
+ constructor(
34
+ /**
35
+ * Pubsub aspects
36
+ */
37
+ pubsub: PubsubUI, routeSlot: RouteSlot, navSlot: OrderedNavigationSlot,
38
+ /**
39
+ * slot for registering a new widget to the menu.
40
+ */
41
+ widgetSlot: OrderedNavigationSlot, menuItemSlot: MenuItemSlot, pageItemSlot: ComponentPageSlot, commandBarUI: CommandBarUI);
42
+ /**
43
+ * the current visible component
44
+ */
28
45
  private activeComponent?;
29
46
  private copyNpmId;
47
+ /**
48
+ * key bindings used by component aspect
49
+ */
30
50
  private keyBindings;
31
51
  private menuItems;
32
52
  registerPubSub(): void;
package/dist/config.d.ts CHANGED
@@ -10,10 +10,27 @@ declare type LegacyConfigProps = {
10
10
  extensions?: ExtensionDataList;
11
11
  overrides?: ComponentOverridesData;
12
12
  };
13
+ /**
14
+ * in-memory representation of the component configuration.
15
+ */
13
16
  export default class Config {
17
+ /**
18
+ * version main file
19
+ */
14
20
  readonly main: PathLinux;
21
+ /**
22
+ * configured extensions
23
+ */
15
24
  readonly extensions: ExtensionDataList;
16
25
  readonly legacyProperties?: LegacyConfigProps | undefined;
17
- constructor(main: PathLinux, extensions: ExtensionDataList, legacyProperties?: LegacyConfigProps | undefined);
26
+ constructor(
27
+ /**
28
+ * version main file
29
+ */
30
+ main: PathLinux,
31
+ /**
32
+ * configured extensions
33
+ */
34
+ extensions: ExtensionDataList, legacyProperties?: LegacyConfigProps | undefined);
18
35
  }
19
36
  export {};
@@ -10,6 +10,12 @@ export declare class PackageDependency extends Dependency {
10
10
  export declare class ComponentDependency extends Dependency {
11
11
  }
12
12
  export declare class DependencyList extends Array<Dependency> {
13
+ /**
14
+ * Get only package dependencies
15
+ *
16
+ * @readonly
17
+ * @memberof DependencyList
18
+ */
13
19
  get packages(): PackageDependency[];
14
20
  get components(): ComponentDependency[];
15
21
  static fromArray(dependencies: Dependency[]): DependencyList;
@@ -20,6 +26,18 @@ export declare class Dependencies {
20
26
  peer: DependencyList;
21
27
  constructor(runtime: DependencyList, dev: DependencyList, peer: DependencyList);
22
28
  private getByEnvironment;
29
+ /**
30
+ * Get dependencies needed for development environnement such as runtime, dev and peer
31
+ *
32
+ * @returns {DependencyList}
33
+ * @memberof Dependencies
34
+ */
23
35
  computeDev(): DependencyList;
36
+ /**
37
+ * Get dependencies needed for runtime environnement such as runtime and peer
38
+ *
39
+ * @returns {DependencyList}
40
+ * @memberof Dependencies
41
+ */
24
42
  computeRuntime(): DependencyList;
25
43
  }
@@ -1,5 +1,12 @@
1
1
  export declare class HostNotFound extends Error {
2
+ /**
3
+ * name of the host.
4
+ */
2
5
  private hostName;
3
- constructor(hostName: string);
6
+ constructor(
7
+ /**
8
+ * name of the host.
9
+ */
10
+ hostName: string);
4
11
  toString(): string;
5
12
  }
package/dist/hash.d.ts CHANGED
@@ -1 +1,4 @@
1
+ /**
2
+ * type for representing content-addressable filesystem hashes.
3
+ */
1
4
  export declare type Hash = string;
@@ -1,14 +1,37 @@
1
1
  import { Component } from '../component';
2
2
  export interface ShowFragment {
3
+ /**
4
+ * render a row into the `show` CLI.
5
+ */
3
6
  renderRow(component: Component): Promise<ShowRow>;
7
+ /**
8
+ * return a json output.
9
+ */
4
10
  json?(component: Component): Promise<JSONRow>;
11
+ /**
12
+ * weight is used to determine the position of the fragment
13
+ * within the `show` table.
14
+ */
5
15
  weight?: number;
6
16
  }
7
17
  export interface JSONRow {
18
+ /**
19
+ * name of the field.
20
+ */
8
21
  title: string;
22
+ /**
23
+ * json content.
24
+ * TODO: change this from any to a more structured type (e.g. Serializable).
25
+ */
9
26
  json: any;
10
27
  }
11
28
  export interface ShowRow {
29
+ /**
30
+ * title of the fragment
31
+ */
12
32
  title: string;
33
+ /**
34
+ * content to render within the fragment.
35
+ */
13
36
  content: string;
14
37
  }
@@ -1,5 +1,17 @@
1
+ /**
2
+ * author type.
3
+ */
1
4
  export declare type Author = {
5
+ /**
6
+ * author full name (for example: "Ran Mizrahi")
7
+ */
2
8
  displayName: string;
9
+ /**
10
+ * author username (for example: "ranm8")
11
+ */
3
12
  name?: string;
13
+ /**
14
+ * author email in a proper format (e.g. "ran@bit.dev")
15
+ */
4
16
  email: string;
5
17
  };
@@ -6,13 +6,51 @@ export declare type SnapProps = {
6
6
  author: Author;
7
7
  message: string;
8
8
  };
9
+ /**
10
+ * `Snap` represents a sealed state of the component in the working tree.
11
+ */
9
12
  export declare class Snap {
13
+ /**
14
+ * hash of the snap.
15
+ */
10
16
  readonly hash: string;
17
+ /**
18
+ * date time of the snap.
19
+ */
11
20
  readonly timestamp: Date;
21
+ /**
22
+ * parent snap
23
+ */
12
24
  readonly parents: string[];
25
+ /**
26
+ * author of the component `Snap`.
27
+ */
13
28
  readonly author: Author;
29
+ /**
30
+ * message added by the `Snap` author.
31
+ */
14
32
  readonly message: string;
15
- constructor(hash: string, timestamp: Date, parents: string[], author: Author, 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);
16
54
  static fromObject(snapObject: SnapProps): Snap;
17
55
  toObject(): SnapProps;
18
56
  }
package/dist/state.d.ts CHANGED
@@ -3,14 +3,57 @@ import ComponentFS from './component-fs';
3
3
  import Config from './config';
4
4
  import { AspectList } from './aspect-list';
5
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
+ */
6
10
  readonly config: Config;
11
+ /**
12
+ * list of aspects configured on the component.
13
+ */
7
14
  private _aspects;
15
+ /**
16
+ * in-memory representation of the component current filesystem.
17
+ */
8
18
  readonly filesystem: ComponentFS;
19
+ /**
20
+ * dependency graph of the component current. ideally package dependencies would be also placed here.
21
+ */
9
22
  readonly dependencies: any;
23
+ /**
24
+ * instance of legacy consumer component.
25
+ */
10
26
  readonly _consumer: any;
11
- constructor(config: Config, _aspects: AspectList, filesystem: ComponentFS, dependencies: any, _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
+ * calculate the hash of this state
51
+ */
12
52
  get hash(): string;
13
53
  get issues(): IssuesList;
54
+ /**
55
+ * is modified
56
+ */
14
57
  get isModified(): boolean;
15
58
  get aspects(): AspectList;
16
59
  set aspects(aspects: AspectList);