@teambit/code 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.
@@ -4,23 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = exports.CodeAspect = void 0;
7
-
8
7
  function _harmony() {
9
8
  const data = require("@teambit/harmony");
10
-
11
9
  _harmony = function () {
12
10
  return data;
13
11
  };
14
-
15
12
  return data;
16
13
  }
17
-
18
14
  const CodeAspect = _harmony().Aspect.create({
19
15
  id: 'teambit.component/code',
20
16
  dependencies: [],
21
17
  defaultConfig: {}
22
18
  });
23
-
24
19
  exports.CodeAspect = CodeAspect;
25
20
  var _default = CodeAspect;
26
21
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"names":["CodeAspect","Aspect","create","id","dependencies","defaultConfig"],"sources":["code.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const CodeAspect = Aspect.create({\n id: 'teambit.component/code',\n dependencies: [],\n defaultConfig: {},\n});\n\nexport default CodeAspect;\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,UAAU,GAAGC,iBAAA,CAAOC,MAAP,CAAc;EACtCC,EAAE,EAAE,wBADkC;EAEtCC,YAAY,EAAE,EAFwB;EAGtCC,aAAa,EAAE;AAHuB,CAAd,CAAnB;;;eAMQL,U"}
1
+ {"version":3,"names":["CodeAspect","Aspect","create","id","dependencies","defaultConfig"],"sources":["code.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const CodeAspect = Aspect.create({\n id: 'teambit.component/code',\n dependencies: [],\n defaultConfig: {},\n});\n\nexport default CodeAspect;\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,UAAU,GAAGC,iBAAM,CAACC,MAAM,CAAC;EACtCC,EAAE,EAAE,wBAAwB;EAC5BC,YAAY,EAAE,EAAE;EAChBC,aAAa,EAAE,CAAC;AAClB,CAAC,CAAC;AAAC;AAAA,eAEYL,UAAU;AAAA"}
@@ -1,42 +1,31 @@
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.CodeCompareSection = 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 _codeUi() {
31
23
  const data = require("@teambit/code.ui.code-compare");
32
-
33
24
  _codeUi = function () {
34
25
  return data;
35
26
  };
36
-
37
27
  return data;
38
28
  }
39
-
40
29
  class CodeCompareSection {
41
30
  constructor(fileIconSlot) {
42
31
  this.fileIconSlot = fileIconSlot;
@@ -52,9 +41,7 @@ class CodeCompareSection {
52
41
  })
53
42
  });
54
43
  }
55
-
56
44
  }
57
-
58
45
  exports.CodeCompareSection = CodeCompareSection;
59
46
 
60
47
  //# sourceMappingURL=code.compare.section.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CodeCompareSection","constructor","fileIconSlot","href","children","order","path","element"],"sources":["code.compare.section.tsx"],"sourcesContent":["import React from 'react';\nimport { FileIconSlot } from '@teambit/code';\nimport { Section } from '@teambit/component';\nimport { CodeCompare } from '@teambit/code.ui.code-compare';\n\nexport class CodeCompareSection implements Section {\n constructor(private fileIconSlot: FileIconSlot) {}\n\n navigationLink = {\n href: 'code',\n children: 'Code',\n order: 4,\n };\n\n route = {\n path: 'code/*',\n element: <CodeCompare fileIconSlot={this.fileIconSlot} />,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,kBAAN,CAA4C;EACjDC,WAAW,CAASC,YAAT,EAAqC;IAAA,KAA5BA,YAA4B,GAA5BA,YAA4B;IAAA,wDAE/B;MACfC,IAAI,EAAE,MADS;MAEfC,QAAQ,EAAE,MAFK;MAGfC,KAAK,EAAE;IAHQ,CAF+B;IAAA,+CAQxC;MACNC,IAAI,EAAE,QADA;MAENC,OAAO,eAAE,+BAAC,qBAAD;QAAa,YAAY,EAAE,KAAKL;MAAhC;IAFH,CARwC;EAAE;;AADD"}
1
+ {"version":3,"names":["CodeCompareSection","constructor","fileIconSlot","href","children","order","path","element"],"sources":["code.compare.section.tsx"],"sourcesContent":["import React from 'react';\nimport { FileIconSlot } from '@teambit/code';\nimport { Section } from '@teambit/component';\nimport { CodeCompare } from '@teambit/code.ui.code-compare';\n\nexport class CodeCompareSection implements Section {\n constructor(private fileIconSlot: FileIconSlot) {}\n\n navigationLink = {\n href: 'code',\n children: 'Code',\n order: 4,\n };\n\n route = {\n path: 'code/*',\n element: <CodeCompare fileIconSlot={this.fileIconSlot} />,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,kBAAkB,CAAoB;EACjDC,WAAW,CAASC,YAA0B,EAAE;IAAA,KAA5BA,YAA0B,GAA1BA,YAA0B;IAAA,wDAE7B;MACfC,IAAI,EAAE,MAAM;MACZC,QAAQ,EAAE,MAAM;MAChBC,KAAK,EAAE;IACT,CAAC;IAAA,+CAEO;MACNC,IAAI,EAAE,QAAQ;MACdC,OAAO,eAAE,+BAAC,qBAAW;QAAC,YAAY,EAAE,IAAI,CAACL;MAAa;IACxD,CAAC;EAXgD;AAYnD;AAAC"}
@@ -1,22 +1,17 @@
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.Logo = void 0;
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
  const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
21
16
  style: {
22
17
  height: '100%',
@@ -29,7 +24,6 @@ const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
29
24
  },
30
25
  src: "https://static.bit.dev/extensions-icons/code.svg"
31
26
  }));
32
-
33
27
  exports.Logo = Logo;
34
28
 
35
29
  //# sourceMappingURL=code.composition.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["code.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/code.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAV;IAAkBC,OAAO,EAAE,MAA3B;IAAmCC,cAAc,EAAE;EAAnD;AAAZ,gBACE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAT,CAAZ;EAA2B,GAAG,EAAC;AAA/B,EADF,CADK"}
1
+ {"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["code.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/code.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAG,CAAE;EAAC,GAAG,EAAC;AAAkD,EAAG,CAEvF;AAAC"}
@@ -1,42 +1,31 @@
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.CodeSection = 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 _uiFoundationUi() {
31
23
  const data = require("@teambit/ui-foundation.ui.menu-widget-icon");
32
-
33
24
  _uiFoundationUi = function () {
34
25
  return data;
35
26
  };
36
-
37
27
  return data;
38
28
  }
39
-
40
29
  class CodeSection {
41
30
  constructor(codeUI) {
42
31
  this.codeUI = codeUI;
@@ -54,9 +43,7 @@ class CodeSection {
54
43
  });
55
44
  (0, _defineProperty2().default)(this, "order", 30);
56
45
  }
57
-
58
46
  }
59
-
60
47
  exports.CodeSection = CodeSection;
61
48
 
62
49
  //# sourceMappingURL=code.section.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CodeSection","constructor","codeUI","path","element","getCodePage","href","children","displayName"],"sources":["code.section.tsx"],"sourcesContent":["import { Section } from '@teambit/component';\nimport React from 'react';\nimport { MenuWidgetIcon } from '@teambit/ui-foundation.ui.menu-widget-icon';\nimport type { CodeUI } from './code.ui.runtime';\n\nexport class CodeSection implements Section {\n constructor(private codeUI: CodeUI) {}\n route = {\n path: '~code/*',\n element: this.codeUI.getCodePage(),\n };\n navigationLink = {\n href: '~code',\n children: <MenuWidgetIcon icon=\"Code\" tooltipContent=\"Code\" />,\n displayName: 'Code',\n };\n order = 30;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,MAAMA,WAAN,CAAqC;EAC1CC,WAAW,CAASC,MAAT,EAAyB;IAAA,KAAhBA,MAAgB,GAAhBA,MAAgB;IAAA,+CAC5B;MACNC,IAAI,EAAE,SADA;MAENC,OAAO,EAAE,KAAKF,MAAL,CAAYG,WAAZ;IAFH,CAD4B;IAAA,wDAKnB;MACfC,IAAI,EAAE,OADS;MAEfC,QAAQ,eAAE,+BAAC,gCAAD;QAAgB,IAAI,EAAC,MAArB;QAA4B,cAAc,EAAC;MAA3C,EAFK;MAGfC,WAAW,EAAE;IAHE,CALmB;IAAA,+CAU5B,EAV4B;EAAE;;AADI"}
1
+ {"version":3,"names":["CodeSection","constructor","codeUI","path","element","getCodePage","href","children","displayName"],"sources":["code.section.tsx"],"sourcesContent":["import { Section } from '@teambit/component';\nimport React from 'react';\nimport { MenuWidgetIcon } from '@teambit/ui-foundation.ui.menu-widget-icon';\nimport type { CodeUI } from './code.ui.runtime';\n\nexport class CodeSection implements Section {\n constructor(private codeUI: CodeUI) {}\n route = {\n path: '~code/*',\n element: this.codeUI.getCodePage(),\n };\n navigationLink = {\n href: '~code',\n children: <MenuWidgetIcon icon=\"Code\" tooltipContent=\"Code\" />,\n displayName: 'Code',\n };\n order = 30;\n}\n"],"mappings":";;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,MAAMA,WAAW,CAAoB;EAC1CC,WAAW,CAASC,MAAc,EAAE;IAAA,KAAhBA,MAAc,GAAdA,MAAc;IAAA,+CAC1B;MACNC,IAAI,EAAE,SAAS;MACfC,OAAO,EAAE,IAAI,CAACF,MAAM,CAACG,WAAW;IAClC,CAAC;IAAA,wDACgB;MACfC,IAAI,EAAE,OAAO;MACbC,QAAQ,eAAE,+BAAC,gCAAc;QAAC,IAAI,EAAC,MAAM;QAAC,cAAc,EAAC;MAAM,EAAG;MAC9DC,WAAW,EAAE;IACf,CAAC;IAAA,+CACO,EAAE;EAV2B;AAWvC;AAAC"}
@@ -1,128 +1,90 @@
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
  require("core-js/modules/es.promise.js");
8
-
9
6
  Object.defineProperty(exports, "__esModule", {
10
7
  value: true
11
8
  });
12
9
  exports.CodeUI = void 0;
13
-
14
10
  function _defineProperty2() {
15
11
  const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
-
17
12
  _defineProperty2 = function () {
18
13
  return data;
19
14
  };
20
-
21
15
  return data;
22
16
  }
23
-
24
17
  function _component() {
25
18
  const data = require("@teambit/component");
26
-
27
19
  _component = function () {
28
20
  return data;
29
21
  };
30
-
31
22
  return data;
32
23
  }
33
-
34
24
  function _ui() {
35
25
  const data = require("@teambit/ui");
36
-
37
26
  _ui = function () {
38
27
  return data;
39
28
  };
40
-
41
29
  return data;
42
30
  }
43
-
44
31
  function _react() {
45
32
  const data = _interopRequireDefault(require("react"));
46
-
47
33
  _react = function () {
48
34
  return data;
49
35
  };
50
-
51
36
  return data;
52
37
  }
53
-
54
38
  function _harmony() {
55
39
  const data = require("@teambit/harmony");
56
-
57
40
  _harmony = function () {
58
41
  return data;
59
42
  };
60
-
61
43
  return data;
62
44
  }
63
-
64
45
  function _baseUiConstants() {
65
46
  const data = require("@teambit/base-ui.constants.storage");
66
-
67
47
  _baseUiConstants = function () {
68
48
  return data;
69
49
  };
70
-
71
50
  return data;
72
51
  }
73
-
74
52
  function _codeUi() {
75
53
  const data = require("@teambit/code.ui.code-tab-page");
76
-
77
54
  _codeUi = function () {
78
55
  return data;
79
56
  };
80
-
81
57
  return data;
82
58
  }
83
-
84
59
  function _componentCompare() {
85
60
  const data = require("@teambit/component-compare");
86
-
87
61
  _componentCompare = function () {
88
62
  return data;
89
63
  };
90
-
91
64
  return data;
92
65
  }
93
-
94
66
  function _code() {
95
67
  const data = require("./code.aspect");
96
-
97
68
  _code = function () {
98
69
  return data;
99
70
  };
100
-
101
71
  return data;
102
72
  }
103
-
104
73
  function _code2() {
105
74
  const data = require("./code.section");
106
-
107
75
  _code2 = function () {
108
76
  return data;
109
77
  };
110
-
111
78
  return data;
112
79
  }
113
-
114
80
  function _codeCompare() {
115
81
  const data = require("./code.compare.section");
116
-
117
82
  _codeCompare = function () {
118
83
  return data;
119
84
  };
120
-
121
85
  return data;
122
86
  }
123
-
124
87
  const isTsx = /\.tsx$/;
125
-
126
88
  /**
127
89
  * Component code tab aspect. Presents the code tab page and allows to control the code tab and register specific icons for each file type.
128
90
  * @example CodeUI.registerEnvFileIcon([(fileName) => (/your-regexp/.test(fileName) ? 'your.icon.url' : undefined)])
@@ -142,22 +104,19 @@ class CodeUI {
142
104
  });
143
105
  });
144
106
  }
145
-
146
107
  registerEnvFileIcon(icons) {
147
108
  var _this$fileIconSlot;
148
-
149
109
  (_this$fileIconSlot = this.fileIconSlot) === null || _this$fileIconSlot === void 0 ? void 0 : _this$fileIconSlot.register(icons);
150
110
  return this;
151
111
  }
152
-
153
112
  static async provider([component, componentCompare], _, [fileIconSlot], harmony) {
154
113
  const {
155
114
  config
156
115
  } = harmony;
157
116
  const host = String(config.get('teambit.harmony/bit'));
158
117
  const ui = new CodeUI(host, fileIconSlot);
159
- const section = new (_code2().CodeSection)(ui); // overrides the default tsx react icon with the typescript icon
160
-
118
+ const section = new (_code2().CodeSection)(ui);
119
+ // overrides the default tsx react icon with the typescript icon
161
120
  ui.registerEnvFileIcon([fileName => isTsx.test(fileName) ? `${_baseUiConstants().staticStorageUrl}/file-icons/file_type_typescript.svg` : undefined]);
162
121
  component.registerRoute([section.route]);
163
122
  component.registerWidget(section.navigationLink, section.order);
@@ -169,14 +128,11 @@ class CodeUI {
169
128
  componentCompare.registerRoutes([codeCompare.route]);
170
129
  return ui;
171
130
  }
172
-
173
131
  }
174
-
175
132
  exports.CodeUI = CodeUI;
176
133
  (0, _defineProperty2().default)(CodeUI, "dependencies", [_component().ComponentAspect, _componentCompare().ComponentCompareAspect]);
177
134
  (0, _defineProperty2().default)(CodeUI, "runtime", _ui().UIRuntime);
178
135
  (0, _defineProperty2().default)(CodeUI, "slots", [_harmony().Slot.withType()]);
179
-
180
136
  _code().CodeAspect.addRuntime(CodeUI);
181
137
 
182
138
  //# sourceMappingURL=code.ui.runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["isTsx","CodeUI","constructor","host","fileIconSlot","registerEnvFileIcon","icons","register","provider","component","componentCompare","_","harmony","config","String","get","ui","section","CodeSection","fileName","test","staticStorageUrl","undefined","registerRoute","route","registerWidget","navigationLink","order","codeCompare","CodeCompareSection","registerNavigation","props","registerRoutes","ComponentAspect","ComponentCompareAspect","UIRuntime","Slot","withType","CodeAspect","addRuntime"],"sources":["code.ui.runtime.tsx"],"sourcesContent":["import { ComponentAspect, ComponentUI } from '@teambit/component';\nimport { UIRuntime } from '@teambit/ui';\nimport React from 'react';\nimport { Harmony, SlotRegistry, Slot } from '@teambit/harmony';\nimport type { FileIconMatch } from '@teambit/code.ui.utils.get-file-icon';\nimport { staticStorageUrl } from '@teambit/base-ui.constants.storage';\nimport { CodePage } from '@teambit/code.ui.code-tab-page';\nimport { ComponentCompareUI, ComponentCompareAspect } from '@teambit/component-compare';\nimport { CodeAspect } from './code.aspect';\nimport { CodeSection } from './code.section';\nimport { CodeCompareSection } from './code.compare.section';\n\nconst isTsx = /\\.tsx$/;\n\nexport type FileIconSlot = SlotRegistry<FileIconMatch[]>;\n\n/**\n * Component code tab aspect. Presents the code tab page and allows to control the code tab and register specific icons for each file type.\n * @example CodeUI.registerEnvFileIcon([(fileName) => (/your-regexp/.test(fileName) ? 'your.icon.url' : undefined)])\n */\nexport class CodeUI {\n constructor(\n /**\n * register an icon for a specific file type. pass icon and a match method/regexp\n */\n private host: string,\n private fileIconSlot?: FileIconSlot\n ) {}\n\n getCodePage = () => {\n return <CodePage fileIconSlot={this.fileIconSlot} host={this.host} />;\n };\n\n registerEnvFileIcon(icons: FileIconMatch[]) {\n this.fileIconSlot?.register(icons);\n return this;\n }\n static dependencies = [ComponentAspect, ComponentCompareAspect];\n\n static runtime = UIRuntime;\n\n static slots = [Slot.withType<string>()];\n\n static async provider(\n [component, componentCompare]: [ComponentUI, ComponentCompareUI],\n _,\n [fileIconSlot]: [FileIconSlot],\n harmony: Harmony\n ) {\n const { config } = harmony;\n const host = String(config.get('teambit.harmony/bit'));\n const ui = new CodeUI(host, fileIconSlot);\n const section = new CodeSection(ui);\n // overrides the default tsx react icon with the typescript icon\n ui.registerEnvFileIcon([\n (fileName) => (isTsx.test(fileName) ? `${staticStorageUrl}/file-icons/file_type_typescript.svg` : undefined),\n ]);\n component.registerRoute([section.route]);\n component.registerWidget(section.navigationLink, section.order);\n const codeCompare = new CodeCompareSection(fileIconSlot);\n componentCompare.registerNavigation({\n props: codeCompare.navigationLink,\n order: codeCompare.navigationLink.order,\n });\n componentCompare.registerRoutes([codeCompare.route]);\n return ui;\n }\n}\n\nCodeAspect.addRuntime(CodeUI);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;I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IAGAb,SAAS,CAACc,aAAV,CAAwB,CAACN,OAAO,CAACO,KAAT,CAAxB;IACAf,SAAS,CAACgB,cAAV,CAAyBR,OAAO,CAACS,cAAjC,EAAiDT,OAAO,CAACU,KAAzD;IACA,MAAMC,WAAW,GAAG,KAAIC,iCAAJ,EAAuBzB,YAAvB,CAApB;IACAM,gBAAgB,CAACoB,kBAAjB,CAAoC;MAClCC,KAAK,EAAEH,WAAW,CAACF,cADe;MAElCC,KAAK,EAAEC,WAAW,CAACF,cAAZ,CAA2BC;IAFA,CAApC;IAIAjB,gBAAgB,CAACsB,cAAjB,CAAgC,CAACJ,WAAW,CAACJ,KAAb,CAAhC;IACA,OAAOR,EAAP;EACD;;AA9CiB;;;gCAAPf,M,kBAiBW,CAACgC,4BAAD,EAAkBC,0CAAlB,C;gCAjBXjC,M,aAmBMkC,e;gCAnBNlC,M,WAqBI,CAACmC,eAAA,CAAKC,QAAL,EAAD,C;;AA4BjBC,kBAAA,CAAWC,UAAX,CAAsBtC,MAAtB"}
1
+ {"version":3,"names":["isTsx","CodeUI","constructor","host","fileIconSlot","registerEnvFileIcon","icons","register","provider","component","componentCompare","_","harmony","config","String","get","ui","section","CodeSection","fileName","test","staticStorageUrl","undefined","registerRoute","route","registerWidget","navigationLink","order","codeCompare","CodeCompareSection","registerNavigation","props","registerRoutes","ComponentAspect","ComponentCompareAspect","UIRuntime","Slot","withType","CodeAspect","addRuntime"],"sources":["code.ui.runtime.tsx"],"sourcesContent":["import { ComponentAspect, ComponentUI } from '@teambit/component';\nimport { UIRuntime } from '@teambit/ui';\nimport React from 'react';\nimport { Harmony, SlotRegistry, Slot } from '@teambit/harmony';\nimport type { FileIconMatch } from '@teambit/code.ui.utils.get-file-icon';\nimport { staticStorageUrl } from '@teambit/base-ui.constants.storage';\nimport { CodePage } from '@teambit/code.ui.code-tab-page';\nimport { ComponentCompareUI, ComponentCompareAspect } from '@teambit/component-compare';\nimport { CodeAspect } from './code.aspect';\nimport { CodeSection } from './code.section';\nimport { CodeCompareSection } from './code.compare.section';\n\nconst isTsx = /\\.tsx$/;\n\nexport type FileIconSlot = SlotRegistry<FileIconMatch[]>;\n\n/**\n * Component code tab aspect. Presents the code tab page and allows to control the code tab and register specific icons for each file type.\n * @example CodeUI.registerEnvFileIcon([(fileName) => (/your-regexp/.test(fileName) ? 'your.icon.url' : undefined)])\n */\nexport class CodeUI {\n constructor(\n /**\n * register an icon for a specific file type. pass icon and a match method/regexp\n */\n private host: string,\n private fileIconSlot?: FileIconSlot\n ) {}\n\n getCodePage = () => {\n return <CodePage fileIconSlot={this.fileIconSlot} host={this.host} />;\n };\n\n registerEnvFileIcon(icons: FileIconMatch[]) {\n this.fileIconSlot?.register(icons);\n return this;\n }\n static dependencies = [ComponentAspect, ComponentCompareAspect];\n\n static runtime = UIRuntime;\n\n static slots = [Slot.withType<string>()];\n\n static async provider(\n [component, componentCompare]: [ComponentUI, ComponentCompareUI],\n _,\n [fileIconSlot]: [FileIconSlot],\n harmony: Harmony\n ) {\n const { config } = harmony;\n const host = String(config.get('teambit.harmony/bit'));\n const ui = new CodeUI(host, fileIconSlot);\n const section = new CodeSection(ui);\n // overrides the default tsx react icon with the typescript icon\n ui.registerEnvFileIcon([\n (fileName) => (isTsx.test(fileName) ? `${staticStorageUrl}/file-icons/file_type_typescript.svg` : undefined),\n ]);\n component.registerRoute([section.route]);\n component.registerWidget(section.navigationLink, section.order);\n const codeCompare = new CodeCompareSection(fileIconSlot);\n componentCompare.registerNavigation({\n props: codeCompare.navigationLink,\n order: codeCompare.navigationLink.order,\n });\n componentCompare.registerRoutes([codeCompare.route]);\n return ui;\n }\n}\n\nCodeAspect.addRuntime(CodeUI);\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;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AqC,GAAGC,SAAU,CAC7G,CAAC;IACFb,SAAS,CAACc,aAAa,CAAC,CAACN,OAAO,CAACO,KAAK,CAAC,CAAC;IACxCf,SAAS,CAACgB,cAAc,CAACR,OAAO,CAACS,cAAc,EAAET,OAAO,CAACU,KAAK,CAAC;IAC/D,MAAMC,WAAW,GAAG,KAAIC,iCAAkB,EAACzB,YAAY,CAAC;IACxDM,gBAAgB,CAACoB,kBAAkB,CAAC;MAClCC,KAAK,EAAEH,WAAW,CAACF,cAAc;MACjCC,KAAK,EAAEC,WAAW,CAACF,cAAc,CAACC;IACpC,CAAC,CAAC;IACFjB,gBAAgB,CAACsB,cAAc,CAAC,CAACJ,WAAW,CAACJ,KAAK,CAAC,CAAC;IACpD,OAAOR,EAAE;EACX;AACF;AAAC;AAAA,gCA/CYf,MAAM,kBAiBK,CAACgC,4BAAe,EAAEC,0CAAsB,CAAC;AAAA,gCAjBpDjC,MAAM,aAmBAkC,eAAS;AAAA,gCAnBflC,MAAM,WAqBF,CAACmC,eAAI,CAACC,QAAQ,EAAU,CAAC;AA4B1CC,kBAAU,CAACC,UAAU,CAACtC,MAAM,CAAC"}
package/dist/index.js CHANGED
@@ -10,19 +10,14 @@ Object.defineProperty(exports, "CodeAspect", {
10
10
  }
11
11
  });
12
12
  exports.default = void 0;
13
-
14
13
  function _code() {
15
14
  const data = require("./code.aspect");
16
-
17
15
  _code = function () {
18
16
  return data;
19
17
  };
20
-
21
18
  return data;
22
19
  }
23
-
24
20
  var _default = _code().CodeAspect;
25
-
26
21
  exports.default = _default;
27
22
 
28
23
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["CodeAspect"],"sources":["index.ts"],"sourcesContent":["import { CodeAspect } from './code.aspect';\n\nexport type { CodeUI, FileIconSlot } from './code.ui.runtime';\nexport { CodeAspect };\nexport default CodeAspect;\n"],"mappings":";;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;eAIeA,kB"}
1
+ {"version":3,"names":["CodeAspect"],"sources":["index.ts"],"sourcesContent":["import { CodeAspect } from './code.aspect';\n\nexport type { CodeUI, FileIconSlot } from './code.ui.runtime';\nexport { CodeAspect };\nexport default CodeAspect;\n"],"mappings":";;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA2C,eAI5BA,kBAAU;AAAA"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/code",
3
- "version": "0.0.881",
3
+ "version": "0.0.882",
4
4
  "homepage": "https://bit.dev/teambit/component/code",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "code",
9
- "version": "0.0.881"
9
+ "version": "0.0.882"
10
10
  },
11
11
  "dependencies": {
12
12
  "@babel/runtime": "7.12.18",
@@ -14,12 +14,12 @@
14
14
  "@teambit/harmony": "0.3.3",
15
15
  "@teambit/base-ui.constants.storage": "1.0.0",
16
16
  "@teambit/code.ui.code-compare": "0.0.105",
17
- "@teambit/component": "0.0.881",
17
+ "@teambit/component": "0.0.882",
18
18
  "@teambit/ui-foundation.ui.menu-widget-icon": "0.0.494",
19
19
  "@teambit/code.ui.code-tab-page": "0.0.593",
20
20
  "@teambit/code.ui.utils.get-file-icon": "0.0.492",
21
- "@teambit/component-compare": "0.0.129",
22
- "@teambit/ui": "0.0.881"
21
+ "@teambit/component-compare": "0.0.130",
22
+ "@teambit/ui": "0.0.882"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/react": "^17.0.8",
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_code@0.0.881/dist/code.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_code@0.0.881/dist/code.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_code@0.0.882/dist/code.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_code@0.0.882/dist/code.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];