@teambit/code 0.0.1038 → 0.0.1040

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.
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import { ComponentAspect, ComponentUI } from '@teambit/component';
3
3
  import { UIRuntime } from '@teambit/ui';
4
- import { CodeCompare } from '@teambit/code.ui.code-compare';
4
+ import { CodeCompare, CodeCompareProps } from '@teambit/code.ui.code-compare';
5
5
  import { Harmony, SlotRegistry, Slot } from '@teambit/harmony';
6
6
  import type { FileIconMatch } from '@teambit/code.ui.utils.get-file-icon';
7
7
  import { staticStorageUrl } from '@teambit/base-ui.constants.storage';
8
- import { CodePage } from '@teambit/code.ui.code-tab-page';
8
+ import { CodePage, CodePageProps } from '@teambit/code.ui.code-tab-page';
9
9
  import { ComponentCompareUI, ComponentCompareAspect } from '@teambit/component-compare';
10
10
  import { CodeCompareSection } from '@teambit/code.ui.code-compare-section';
11
11
  import { CodeAspect } from './code.aspect';
@@ -28,12 +28,12 @@ export class CodeUI {
28
28
  private fileIconSlot?: FileIconSlot
29
29
  ) {}
30
30
 
31
- getCodePage = () => {
32
- return <CodePage fileIconSlot={this.fileIconSlot} host={this.host} />;
31
+ getCodePage = (props?: Partial<CodePageProps>) => {
32
+ return <CodePage {...(props || {})} fileIconSlot={this.fileIconSlot} host={this.host} />;
33
33
  };
34
34
 
35
- getCodeCompare = () => {
36
- return <CodeCompare fileIconSlot={this.fileIconSlot} />;
35
+ getCodeCompare = (props?: Partial<CodeCompareProps>) => {
36
+ return <CodeCompare {...(props || {})} fileIconSlot={this.fileIconSlot} />;
37
37
  };
38
38
 
39
39
  registerEnvFileIcon(icons: FileIconMatch[]) {
@@ -1,7 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import { ComponentUI } from '@teambit/component';
3
+ import { CodeCompareProps } from '@teambit/code.ui.code-compare';
3
4
  import { Harmony, SlotRegistry } from '@teambit/harmony';
4
5
  import type { FileIconMatch } from '@teambit/code.ui.utils.get-file-icon';
6
+ import { CodePageProps } from '@teambit/code.ui.code-tab-page';
5
7
  import { ComponentCompareUI } from '@teambit/component-compare';
6
8
  export declare type FileIconSlot = SlotRegistry<FileIconMatch[]>;
7
9
  /**
@@ -19,8 +21,8 @@ export declare class CodeUI {
19
21
  * register an icon for a specific file type. pass icon and a match method/regexp
20
22
  */
21
23
  host: string, fileIconSlot?: FileIconSlot | undefined);
22
- getCodePage: () => JSX.Element;
23
- getCodeCompare: () => JSX.Element;
24
+ getCodePage: (props?: Partial<CodePageProps>) => JSX.Element;
25
+ getCodeCompare: (props?: Partial<CodeCompareProps>) => JSX.Element;
24
26
  registerEnvFileIcon(icons: FileIconMatch[]): this;
25
27
  static dependencies: import("@teambit/harmony").Aspect[];
26
28
  static runtime: import("@teambit/harmony").RuntimeDefinition;
@@ -7,6 +7,13 @@ Object.defineProperty(exports, "__esModule", {
7
7
  value: true
8
8
  });
9
9
  exports.CodeUI = void 0;
10
+ function _extends2() {
11
+ const data = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
12
+ _extends2 = function () {
13
+ return data;
14
+ };
15
+ return data;
16
+ }
10
17
  function _defineProperty2() {
11
18
  const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
19
  _defineProperty2 = function () {
@@ -104,16 +111,16 @@ class CodeUI {
104
111
  host, fileIconSlot) {
105
112
  this.host = host;
106
113
  this.fileIconSlot = fileIconSlot;
107
- (0, _defineProperty2().default)(this, "getCodePage", () => {
108
- return /*#__PURE__*/_react().default.createElement(_codeUi2().CodePage, {
114
+ (0, _defineProperty2().default)(this, "getCodePage", props => {
115
+ return /*#__PURE__*/_react().default.createElement(_codeUi2().CodePage, (0, _extends2().default)({}, props || {}, {
109
116
  fileIconSlot: this.fileIconSlot,
110
117
  host: this.host
111
- });
118
+ }));
112
119
  });
113
- (0, _defineProperty2().default)(this, "getCodeCompare", () => {
114
- return /*#__PURE__*/_react().default.createElement(_codeUi().CodeCompare, {
120
+ (0, _defineProperty2().default)(this, "getCodeCompare", props => {
121
+ return /*#__PURE__*/_react().default.createElement(_codeUi().CodeCompare, (0, _extends2().default)({}, props || {}, {
115
122
  fileIconSlot: this.fileIconSlot
116
- });
123
+ }));
117
124
  });
118
125
  }
119
126
  registerEnvFileIcon(icons) {
@@ -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","registerRoutes","ComponentAspect","ComponentCompareAspect","UIRuntime","Slot","withType","CodeAspect","addRuntime"],"sources":["code.ui.runtime.tsx"],"sourcesContent":["import React from 'react';\nimport { ComponentAspect, ComponentUI } from '@teambit/component';\nimport { UIRuntime } from '@teambit/ui';\nimport { CodeCompare } from '@teambit/code.ui.code-compare';\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 { CodeCompareSection } from '@teambit/code.ui.code-compare-section';\nimport { CodeAspect } from './code.aspect';\nimport { CodeSection } from './code.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 getCodeCompare = () => {\n return <CodeCompare fileIconSlot={this.fileIconSlot} />;\n };\n\n registerEnvFileIcon(icons: FileIconMatch[]) {\n this.fileIconSlot?.register(icons);\n return this;\n }\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\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(ui);\n componentCompare.registerNavigation(codeCompare);\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;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;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;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA,MAAMA,KAAK,GAAG,QAAQ;AAItB;AACA;AACA;AACA;AACO,MAAMC,MAAM,C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AkB,EAACb,EAAE,CAAC;IAC9CN,gBAAgB,CAACoB,kBAAkB,CAACF,WAAW,CAAC;IAChDlB,gBAAgB,CAACqB,cAAc,CAAC,CAACH,WAAW,CAACJ,KAAK,CAAC,CAAC;IACpD,OAAOR,EAAE;EACX;AACF;AAAC;AAAA,gCAlDYf,MAAM,kBAsBK,CAAC+B,4BAAe,EAAEC,0CAAsB,CAAC;AAAA,gCAtBpDhC,MAAM,aAwBAiC,eAAS;AAAA,gCAxBfjC,MAAM,WA0BF,CAACkC,eAAI,CAACC,QAAQ,EAAU,CAAC;AA0B1CC,kBAAU,CAACC,UAAU,CAACrC,MAAM,CAAC"}
1
+ {"version":3,"names":["isTsx","CodeUI","constructor","host","fileIconSlot","props","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","registerRoutes","ComponentAspect","ComponentCompareAspect","UIRuntime","Slot","withType","CodeAspect","addRuntime"],"sources":["code.ui.runtime.tsx"],"sourcesContent":["import React from 'react';\nimport { ComponentAspect, ComponentUI } from '@teambit/component';\nimport { UIRuntime } from '@teambit/ui';\nimport { CodeCompare, CodeCompareProps } from '@teambit/code.ui.code-compare';\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, CodePageProps } from '@teambit/code.ui.code-tab-page';\nimport { ComponentCompareUI, ComponentCompareAspect } from '@teambit/component-compare';\nimport { CodeCompareSection } from '@teambit/code.ui.code-compare-section';\nimport { CodeAspect } from './code.aspect';\nimport { CodeSection } from './code.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 = (props?: Partial<CodePageProps>) => {\n return <CodePage {...(props || {})} fileIconSlot={this.fileIconSlot} host={this.host} />;\n };\n\n getCodeCompare = (props?: Partial<CodeCompareProps>) => {\n return <CodeCompare {...(props || {})} fileIconSlot={this.fileIconSlot} />;\n };\n\n registerEnvFileIcon(icons: FileIconMatch[]) {\n this.fileIconSlot?.register(icons);\n return this;\n }\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\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(ui);\n componentCompare.registerNavigation(codeCompare);\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;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EA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C,oBAAW,EAACF,EAAE,CAAC;;IAEnC;IACAA,EAAE,CAACX,mBAAmB,CAAC,CACpBc,QAAQ,IAAMpB,KAAK,CAACqB,IAAI,CAACD,QAAQ,CAAC,GAAI,GAAEE,mCAAiB,sCAAqC,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,6BAAkB,EAACb,EAAE,CAAC;IAC9CN,gBAAgB,CAACoB,kBAAkB,CAACF,WAAW,CAAC;IAChDlB,gBAAgB,CAACqB,cAAc,CAAC,CAACH,WAAW,CAACJ,KAAK,CAAC,CAAC;IACpD,OAAOR,EAAE;EACX;AACF;AAAC;AAAA,gCAlDYhB,MAAM,kBAsBK,CAACgC,4BAAe,EAAEC,0CAAsB,CAAC;AAAA,gCAtBpDjC,MAAM,aAwBAkC,eAAS;AAAA,gCAxBflC,MAAM,WA0BF,CAACmC,eAAI,CAACC,QAAQ,EAAU,CAAC;AA0B1CC,kBAAU,CAACC,UAAU,CAACtC,MAAM,CAAC"}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_code@0.0.1038/dist/code.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_code@0.0.1038/dist/code.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_code@0.0.1040/dist/code.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_code@0.0.1040/dist/code.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/code",
3
- "version": "0.0.1038",
3
+ "version": "0.0.1040",
4
4
  "homepage": "https://bit.cloud/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.1038"
9
+ "version": "0.0.1040"
10
10
  },
11
11
  "dependencies": {
12
12
  "core-js": "^3.0.0",
@@ -15,12 +15,12 @@
15
15
  "@teambit/base-ui.constants.storage": "1.0.0",
16
16
  "@teambit/code.ui.code-compare-section": "0.0.5",
17
17
  "@teambit/code.ui.utils.get-file-icon": "0.0.495",
18
- "@teambit/component": "0.0.1038",
18
+ "@teambit/component": "0.0.1040",
19
19
  "@teambit/ui-foundation.ui.menu-widget-icon": "0.0.497",
20
- "@teambit/code.ui.code-compare": "0.0.186",
21
- "@teambit/code.ui.code-tab-page": "0.0.611",
22
- "@teambit/component-compare": "0.0.286",
23
- "@teambit/ui": "0.0.1038"
20
+ "@teambit/code.ui.code-compare": "0.0.188",
21
+ "@teambit/code.ui.code-tab-page": "0.0.613",
22
+ "@teambit/component-compare": "0.0.288",
23
+ "@teambit/ui": "0.0.1040"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/react": "^17.0.8",
@@ -31,7 +31,7 @@
31
31
  "@types/testing-library__jest-dom": "5.9.5"
32
32
  },
33
33
  "peerDependencies": {
34
- "@teambit/legacy": "1.0.479",
34
+ "@teambit/legacy": "1.0.480",
35
35
  "react": "^16.8.0 || ^17.0.0",
36
36
  "react-dom": "^16.8.0 || ^17.0.0"
37
37
  },