@teambit/scope.models.scope-model 0.0.0-027ea6b0401ff005f8a5da4f086b1bcf199c1b66
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/index.d.ts +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/scope.model.d.ts +65 -0
- package/dist/scope.model.js +79 -0
- package/dist/scope.model.js.map +1 -0
- package/index.ts +1 -0
- package/package.json +48 -0
- package/scope.model.ts +67 -0
- package/types/asset.d.ts +41 -0
- package/types/style.d.ts +42 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ScopeModel } from './scope.model';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ScopeModel", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _scope().ScopeModel;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
function _scope() {
|
|
13
|
+
const data = require("./scope.model");
|
|
14
|
+
_scope = function () {
|
|
15
|
+
return data;
|
|
16
|
+
};
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_scope","data","require"],"sources":["index.ts"],"sourcesContent":["export { ScopeModel } from './scope.model';\n"],"mappings":";;;;;;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ComponentModelProps } from '@teambit/component';
|
|
2
|
+
import { ComponentModel } from '@teambit/component';
|
|
3
|
+
import { ComponentDescriptor } from '@teambit/component-descriptor';
|
|
4
|
+
export type ScopeModelProps = {
|
|
5
|
+
name: string;
|
|
6
|
+
icon: string;
|
|
7
|
+
backgroundIconColor: string;
|
|
8
|
+
description: string;
|
|
9
|
+
components: ComponentModelProps[];
|
|
10
|
+
};
|
|
11
|
+
export declare class ScopeModel {
|
|
12
|
+
/**
|
|
13
|
+
* the scope name.
|
|
14
|
+
*/
|
|
15
|
+
readonly name: string;
|
|
16
|
+
/**
|
|
17
|
+
* the scope icon.
|
|
18
|
+
*/
|
|
19
|
+
readonly icon: string;
|
|
20
|
+
/**
|
|
21
|
+
* background icon color
|
|
22
|
+
*/
|
|
23
|
+
readonly backgroundIconColor: string;
|
|
24
|
+
/**
|
|
25
|
+
* description of the scope
|
|
26
|
+
*/
|
|
27
|
+
readonly description: string;
|
|
28
|
+
/**
|
|
29
|
+
* components contained in the scope.
|
|
30
|
+
*/
|
|
31
|
+
readonly components: ComponentModel[];
|
|
32
|
+
/**
|
|
33
|
+
* components contained in the scope.
|
|
34
|
+
*/
|
|
35
|
+
readonly componentDescriptors: ComponentDescriptor[];
|
|
36
|
+
constructor(
|
|
37
|
+
/**
|
|
38
|
+
* the scope name.
|
|
39
|
+
*/
|
|
40
|
+
name: string,
|
|
41
|
+
/**
|
|
42
|
+
* the scope icon.
|
|
43
|
+
*/
|
|
44
|
+
icon: string,
|
|
45
|
+
/**
|
|
46
|
+
* background icon color
|
|
47
|
+
*/
|
|
48
|
+
backgroundIconColor: string,
|
|
49
|
+
/**
|
|
50
|
+
* description of the scope
|
|
51
|
+
*/
|
|
52
|
+
description: string,
|
|
53
|
+
/**
|
|
54
|
+
* components contained in the scope.
|
|
55
|
+
*/
|
|
56
|
+
components: ComponentModel[],
|
|
57
|
+
/**
|
|
58
|
+
* components contained in the scope.
|
|
59
|
+
*/
|
|
60
|
+
componentDescriptors: ComponentDescriptor[]);
|
|
61
|
+
static from({ scope }: {
|
|
62
|
+
scope: ScopeModelProps;
|
|
63
|
+
}): ScopeModel;
|
|
64
|
+
static empty(): ScopeModel;
|
|
65
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ScopeModel = void 0;
|
|
7
|
+
function _component() {
|
|
8
|
+
const data = require("@teambit/component");
|
|
9
|
+
_component = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
function _componentDescriptor() {
|
|
15
|
+
const data = require("@teambit/component-descriptor");
|
|
16
|
+
_componentDescriptor = function () {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
21
|
+
function _componentId() {
|
|
22
|
+
const data = require("@teambit/component-id");
|
|
23
|
+
_componentId = function () {
|
|
24
|
+
return data;
|
|
25
|
+
};
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
class ScopeModel {
|
|
29
|
+
constructor(
|
|
30
|
+
/**
|
|
31
|
+
* the scope name.
|
|
32
|
+
*/
|
|
33
|
+
name,
|
|
34
|
+
/**
|
|
35
|
+
* the scope icon.
|
|
36
|
+
*/
|
|
37
|
+
icon,
|
|
38
|
+
/**
|
|
39
|
+
* background icon color
|
|
40
|
+
*/
|
|
41
|
+
backgroundIconColor,
|
|
42
|
+
/**
|
|
43
|
+
* description of the scope
|
|
44
|
+
*/
|
|
45
|
+
description,
|
|
46
|
+
/**
|
|
47
|
+
* components contained in the scope.
|
|
48
|
+
*/
|
|
49
|
+
components,
|
|
50
|
+
/**
|
|
51
|
+
* components contained in the scope.
|
|
52
|
+
*/
|
|
53
|
+
componentDescriptors) {
|
|
54
|
+
this.name = name;
|
|
55
|
+
this.icon = icon;
|
|
56
|
+
this.backgroundIconColor = backgroundIconColor;
|
|
57
|
+
this.description = description;
|
|
58
|
+
this.components = components;
|
|
59
|
+
this.componentDescriptors = componentDescriptors;
|
|
60
|
+
}
|
|
61
|
+
static from({
|
|
62
|
+
scope
|
|
63
|
+
}) {
|
|
64
|
+
const components = scope.components || [];
|
|
65
|
+
const componentDescriptors = scope.components.map(component => {
|
|
66
|
+
const id = _componentId().ComponentID.fromObject(component.id);
|
|
67
|
+
return _componentDescriptor().ComponentDescriptor.fromObject({
|
|
68
|
+
id: id.toString()
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
return new ScopeModel(scope.name, scope.icon, scope.backgroundIconColor, scope.description, components.map(component => _component().ComponentModel.from(component)), componentDescriptors);
|
|
72
|
+
}
|
|
73
|
+
static empty() {
|
|
74
|
+
return new ScopeModel('', '', '', '', [], []);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.ScopeModel = ScopeModel;
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=scope.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_component","data","require","_componentDescriptor","_componentId","ScopeModel","constructor","name","icon","backgroundIconColor","description","components","componentDescriptors","from","scope","map","component","id","ComponentID","fromObject","ComponentDescriptor","toString","ComponentModel","empty","exports"],"sources":["scope.model.ts"],"sourcesContent":["import type { ComponentModelProps } from '@teambit/component';\nimport { ComponentModel } from '@teambit/component';\nimport { ComponentDescriptor } from '@teambit/component-descriptor';\nimport { ComponentID } from '@teambit/component-id';\n\nexport type ScopeModelProps = {\n name: string;\n icon: string;\n backgroundIconColor: string;\n description: string;\n components: ComponentModelProps[];\n};\n\nexport class ScopeModel {\n constructor(\n /**\n * the scope name.\n */\n readonly name: string,\n\n /**\n * the scope icon.\n */\n readonly icon: string,\n\n /**\n * background icon color\n */\n readonly backgroundIconColor: string,\n\n /**\n * description of the scope\n */\n readonly description: string,\n\n /**\n * components contained in the scope.\n */\n readonly components: ComponentModel[],\n\n /**\n * components contained in the scope.\n */\n readonly componentDescriptors: ComponentDescriptor[]\n ) {}\n\n static from({ scope }: { scope: ScopeModelProps }) {\n const components = scope.components || [];\n const componentDescriptors = scope.components.map((component) => {\n const id = ComponentID.fromObject(component.id);\n return ComponentDescriptor.fromObject({ id: id.toString() });\n });\n\n return new ScopeModel(\n scope.name,\n scope.icon,\n scope.backgroundIconColor,\n scope.description,\n components.map((component) => ComponentModel.from(component)),\n componentDescriptors\n );\n }\n\n static empty() {\n return new ScopeModel('', '', '', '', [], []);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,WAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,UAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,qBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,oBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,YAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAUO,MAAMI,UAAU,CAAC;EACtBC,WAAWA;EACT;AACJ;AACA;EACaC,IAAY;EAErB;AACJ;AACA;EACaC,IAAY;EAErB;AACJ;AACA;EACaC,mBAA2B;EAEpC;AACJ;AACA;EACaC,WAAmB;EAE5B;AACJ;AACA;EACaC,UAA4B;EAErC;AACJ;AACA;EACaC,oBAA2C,EACpD;IAAA,KA1BSL,IAAY,GAAZA,IAAY;IAAA,KAKZC,IAAY,GAAZA,IAAY;IAAA,KAKZC,mBAA2B,GAA3BA,mBAA2B;IAAA,KAK3BC,WAAmB,GAAnBA,WAAmB;IAAA,KAKnBC,UAA4B,GAA5BA,UAA4B;IAAA,KAK5BC,oBAA2C,GAA3CA,oBAA2C;EACnD;EAEH,OAAOC,IAAIA,CAAC;IAAEC;EAAkC,CAAC,EAAE;IACjD,MAAMH,UAAU,GAAGG,KAAK,CAACH,UAAU,IAAI,EAAE;IACzC,MAAMC,oBAAoB,GAAGE,KAAK,CAACH,UAAU,CAACI,GAAG,CAAEC,SAAS,IAAK;MAC/D,MAAMC,EAAE,GAAGC,0BAAW,CAACC,UAAU,CAACH,SAAS,CAACC,EAAE,CAAC;MAC/C,OAAOG,0CAAmB,CAACD,UAAU,CAAC;QAAEF,EAAE,EAAEA,EAAE,CAACI,QAAQ,CAAC;MAAE,CAAC,CAAC;IAC9D,CAAC,CAAC;IAEF,OAAO,IAAIhB,UAAU,CACnBS,KAAK,CAACP,IAAI,EACVO,KAAK,CAACN,IAAI,EACVM,KAAK,CAACL,mBAAmB,EACzBK,KAAK,CAACJ,WAAW,EACjBC,UAAU,CAACI,GAAG,CAAEC,SAAS,IAAKM,2BAAc,CAACT,IAAI,CAACG,SAAS,CAAC,CAAC,EAC7DJ,oBACF,CAAC;EACH;EAEA,OAAOW,KAAKA,CAAA,EAAG;IACb,OAAO,IAAIlB,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;EAC/C;AACF;AAACmB,OAAA,CAAAnB,UAAA,GAAAA,UAAA","ignoreList":[]}
|
package/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ScopeModel } from './scope.model';
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@teambit/scope.models.scope-model",
|
|
3
|
+
"version": "0.0.0-027ea6b0401ff005f8a5da4f086b1bcf199c1b66",
|
|
4
|
+
"homepage": "https://bit.cloud/teambit/scope/models/scope-model",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"componentId": {
|
|
7
|
+
"scope": "teambit.scope",
|
|
8
|
+
"name": "models/scope-model",
|
|
9
|
+
"version": "027ea6b0401ff005f8a5da4f086b1bcf199c1b66"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@teambit/component-id": "1.2.4",
|
|
13
|
+
"@teambit/component-descriptor": "0.0.0-b522f0e2c2180a563ee80beb3b2e5f48fc33d2ef"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@types/mocha": "9.1.0",
|
|
17
|
+
"chai": "4.3.0",
|
|
18
|
+
"@teambit/node.envs.node-babel-mocha": "0.2.0"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {},
|
|
21
|
+
"license": "Apache-2.0",
|
|
22
|
+
"optionalDependencies": {},
|
|
23
|
+
"peerDependenciesMeta": {},
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"require": "./dist/index.js",
|
|
27
|
+
"import": "./dist/esm.mjs"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"private": false,
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=12.22.0"
|
|
33
|
+
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "https://github.com/teambit/bit"
|
|
37
|
+
},
|
|
38
|
+
"keywords": [
|
|
39
|
+
"bit",
|
|
40
|
+
"components",
|
|
41
|
+
"collaboration",
|
|
42
|
+
"web",
|
|
43
|
+
"react",
|
|
44
|
+
"react-components",
|
|
45
|
+
"angular",
|
|
46
|
+
"angular-components"
|
|
47
|
+
]
|
|
48
|
+
}
|
package/scope.model.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { ComponentModelProps } from '@teambit/component';
|
|
2
|
+
import { ComponentModel } from '@teambit/component';
|
|
3
|
+
import { ComponentDescriptor } from '@teambit/component-descriptor';
|
|
4
|
+
import { ComponentID } from '@teambit/component-id';
|
|
5
|
+
|
|
6
|
+
export type ScopeModelProps = {
|
|
7
|
+
name: string;
|
|
8
|
+
icon: string;
|
|
9
|
+
backgroundIconColor: string;
|
|
10
|
+
description: string;
|
|
11
|
+
components: ComponentModelProps[];
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export class ScopeModel {
|
|
15
|
+
constructor(
|
|
16
|
+
/**
|
|
17
|
+
* the scope name.
|
|
18
|
+
*/
|
|
19
|
+
readonly name: string,
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* the scope icon.
|
|
23
|
+
*/
|
|
24
|
+
readonly icon: string,
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* background icon color
|
|
28
|
+
*/
|
|
29
|
+
readonly backgroundIconColor: string,
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* description of the scope
|
|
33
|
+
*/
|
|
34
|
+
readonly description: string,
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* components contained in the scope.
|
|
38
|
+
*/
|
|
39
|
+
readonly components: ComponentModel[],
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* components contained in the scope.
|
|
43
|
+
*/
|
|
44
|
+
readonly componentDescriptors: ComponentDescriptor[]
|
|
45
|
+
) {}
|
|
46
|
+
|
|
47
|
+
static from({ scope }: { scope: ScopeModelProps }) {
|
|
48
|
+
const components = scope.components || [];
|
|
49
|
+
const componentDescriptors = scope.components.map((component) => {
|
|
50
|
+
const id = ComponentID.fromObject(component.id);
|
|
51
|
+
return ComponentDescriptor.fromObject({ id: id.toString() });
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return new ScopeModel(
|
|
55
|
+
scope.name,
|
|
56
|
+
scope.icon,
|
|
57
|
+
scope.backgroundIconColor,
|
|
58
|
+
scope.description,
|
|
59
|
+
components.map((component) => ComponentModel.from(component)),
|
|
60
|
+
componentDescriptors
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static empty() {
|
|
65
|
+
return new ScopeModel('', '', '', '', [], []);
|
|
66
|
+
}
|
|
67
|
+
}
|
package/types/asset.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
declare module '*.png' {
|
|
2
|
+
const value: any;
|
|
3
|
+
export = value;
|
|
4
|
+
}
|
|
5
|
+
declare module '*.svg' {
|
|
6
|
+
import type { FunctionComponent, SVGProps } from 'react';
|
|
7
|
+
|
|
8
|
+
export const ReactComponent: FunctionComponent<
|
|
9
|
+
SVGProps<SVGSVGElement> & { title?: string }
|
|
10
|
+
>;
|
|
11
|
+
const src: string;
|
|
12
|
+
export default src;
|
|
13
|
+
}
|
|
14
|
+
declare module '*.jpg' {
|
|
15
|
+
const value: any;
|
|
16
|
+
export = value;
|
|
17
|
+
}
|
|
18
|
+
declare module '*.jpeg' {
|
|
19
|
+
const value: any;
|
|
20
|
+
export = value;
|
|
21
|
+
}
|
|
22
|
+
declare module '*.gif' {
|
|
23
|
+
const value: any;
|
|
24
|
+
export = value;
|
|
25
|
+
}
|
|
26
|
+
declare module '*.bmp' {
|
|
27
|
+
const value: any;
|
|
28
|
+
export = value;
|
|
29
|
+
}
|
|
30
|
+
declare module '*.otf' {
|
|
31
|
+
const value: any;
|
|
32
|
+
export = value;
|
|
33
|
+
}
|
|
34
|
+
declare module '*.woff' {
|
|
35
|
+
const value: any;
|
|
36
|
+
export = value;
|
|
37
|
+
}
|
|
38
|
+
declare module '*.woff2' {
|
|
39
|
+
const value: any;
|
|
40
|
+
export = value;
|
|
41
|
+
}
|
package/types/style.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
declare module '*.module.css' {
|
|
2
|
+
const classes: { readonly [key: string]: string };
|
|
3
|
+
export default classes;
|
|
4
|
+
}
|
|
5
|
+
declare module '*.module.scss' {
|
|
6
|
+
const classes: { readonly [key: string]: string };
|
|
7
|
+
export default classes;
|
|
8
|
+
}
|
|
9
|
+
declare module '*.module.sass' {
|
|
10
|
+
const classes: { readonly [key: string]: string };
|
|
11
|
+
export default classes;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare module '*.module.less' {
|
|
15
|
+
const classes: { readonly [key: string]: string };
|
|
16
|
+
export default classes;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare module '*.less' {
|
|
20
|
+
const classes: { readonly [key: string]: string };
|
|
21
|
+
export default classes;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare module '*.css' {
|
|
25
|
+
const classes: { readonly [key: string]: string };
|
|
26
|
+
export default classes;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare module '*.sass' {
|
|
30
|
+
const classes: { readonly [key: string]: string };
|
|
31
|
+
export default classes;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare module '*.scss' {
|
|
35
|
+
const classes: { readonly [key: string]: string };
|
|
36
|
+
export default classes;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare module '*.mdx' {
|
|
40
|
+
const component: any;
|
|
41
|
+
export default component;
|
|
42
|
+
}
|