@teambit/code 0.0.722 → 0.0.723

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.
@@ -23,9 +23,11 @@ export class CodeUI {
23
23
  */
24
24
  private fileIconSlot?: FileIconSlot
25
25
  ) {}
26
+
26
27
  getCodePage = () => {
27
28
  return <CodePage fileIconSlot={this.fileIconSlot} />;
28
29
  };
30
+
29
31
  registerEnvFileIcon(icons: FileIconMatch[]) {
30
32
  this.fileIconSlot?.register(icons);
31
33
  return this;
@@ -1 +1 @@
1
- {"version":3,"sources":["code.ui.runtime.tsx"],"names":["isTsx","CodeUI","constructor","fileIconSlot","registerEnvFileIcon","icons","register","provider","component","config","ui","section","CodeSection","fileName","test","staticStorageUrl","undefined","registerRoute","route","registerWidget","navigationLink","order","ComponentAspect","UIRuntime","Slot","withType","CodeAspect","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA,MAAMA,KAAK,GAAG,QAAd;;AAIA;AACA;AACA;AACA;AACO,MAAMC,MAAN,CAAa;AAClBC,EAAAA,WAAW;AACT;AACJ;AACA;AACYC,EAAAA,YAJC,EAKT;AAAA,SADQA,YACR,GADQA,YACR;AAAA,yDACY,MAAM;AAClB,0BAAO,+BAAC,kBAAD;AAAU,QAAA,YAAY,EAAE,KAAKA;AAA7B,QAAP;AACD,KAHC;AAAE;;AAIJC,EAAAA,mBAAmB,CAACC,KAAD,EAAyB;AAAA;;AAC1C,+BAAKF,YAAL,0EAAmBG,QAAnB,CAA4BD,KAA5B;AACA,WAAO,IAAP;AACD;;AAOoB,eAARE,QAAQ,CAAC,CAACC,SAAD,CAAD,EAA6BC,MAA7B,EAAqC,CAACN,YAAD,CAArC,EAAqE;AACxF,UAAMO,EAAE,GAAG,IAAIT,MAAJ,CAAWE,YAAX,CAAX;AACA,UAAMQ,OAAO,GAAG,KAAIC,oBAAJ,EAAgBF,EAAhB,CAAhB,CAFwF,CAIxF;;AACAA,IAAAA,EAAE,CAACN,mBAAH,CAAuB,CACpBS,QAAD,IAAeb,KAAK,CAACc,IAAN,CAAWD,QAAX,IAAwB,GAAEE,mCAAiB,sCAA3C,GAAmFC,SAD7E,CAAvB;AAGAR,IAAAA,SAAS,CAACS,aAAV,CAAwBN,OAAO,CAACO,KAAhC;AACAV,IAAAA,SAAS,CAACW,cAAV,CAAyBR,OAAO,CAACS,cAAjC,EAAiDT,OAAO,CAACU,KAAzD;AACA,WAAOX,EAAP;AACD;;AA/BiB;;;gCAAPT,M,kBAcW,CAACqB,4BAAD,C;gCAdXrB,M,aAgBMsB,e;gCAhBNtB,M,WAkBI,CAACuB,gBAAKC,QAAL,EAAD,C;;AAgBjBC,mBAAWC,UAAX,CAAsB1B,MAAtB","sourcesContent":["import { ComponentAspect, ComponentUI } from '@teambit/component';\nimport { UIRuntime } from '@teambit/ui';\nimport React from 'react';\nimport { 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 { 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 fileIconSlot?: FileIconSlot\n ) {}\n getCodePage = () => {\n return <CodePage fileIconSlot={this.fileIconSlot} />;\n };\n registerEnvFileIcon(icons: FileIconMatch[]) {\n this.fileIconSlot?.register(icons);\n return this;\n }\n static dependencies = [ComponentAspect];\n\n static runtime = UIRuntime;\n\n static slots = [Slot.withType<string>()];\n\n static async provider([component]: [ComponentUI], config, [fileIconSlot]: [FileIconSlot]) {\n const ui = new CodeUI(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 return ui;\n }\n}\n\nCodeAspect.addRuntime(CodeUI);\n"]}
1
+ {"version":3,"sources":["code.ui.runtime.tsx"],"names":["isTsx","CodeUI","constructor","fileIconSlot","registerEnvFileIcon","icons","register","provider","component","config","ui","section","CodeSection","fileName","test","staticStorageUrl","undefined","registerRoute","route","registerWidget","navigationLink","order","ComponentAspect","UIRuntime","Slot","withType","CodeAspect","addRuntime"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AACA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA,MAAMA,KAAK,GAAG,QAAd;;AAIA;AACA;AACA;AACA;AACO,MAAMC,MAAN,CAAa;AAClBC,EAAAA,WAAW;AACT;AACJ;AACA;AACYC,EAAAA,YAJC,EAKT;AAAA,SADQA,YACR,GADQA,YACR;AAAA,yDAEY,MAAM;AAClB,0BAAO,+BAAC,kBAAD;AAAU,QAAA,YAAY,EAAE,KAAKA;AAA7B,QAAP;AACD,KAJC;AAAE;;AAMJC,EAAAA,mBAAmB,CAACC,KAAD,EAAyB;AAAA;;AAC1C,+BAAKF,YAAL,0EAAmBG,QAAnB,CAA4BD,KAA5B;AACA,WAAO,IAAP;AACD;;AAOoB,eAARE,QAAQ,CAAC,CAACC,SAAD,CAAD,EAA6BC,MAA7B,EAAqC,CAACN,YAAD,CAArC,EAAqE;AACxF,UAAMO,EAAE,GAAG,IAAIT,MAAJ,CAAWE,YAAX,CAAX;AACA,UAAMQ,OAAO,GAAG,KAAIC,oBAAJ,EAAgBF,EAAhB,CAAhB,CAFwF,CAIxF;;AACAA,IAAAA,EAAE,CAACN,mBAAH,CAAuB,CACpBS,QAAD,IAAeb,KAAK,CAACc,IAAN,CAAWD,QAAX,IAAwB,GAAEE,mCAAiB,sCAA3C,GAAmFC,SAD7E,CAAvB;AAGAR,IAAAA,SAAS,CAACS,aAAV,CAAwBN,OAAO,CAACO,KAAhC;AACAV,IAAAA,SAAS,CAACW,cAAV,CAAyBR,OAAO,CAACS,cAAjC,EAAiDT,OAAO,CAACU,KAAzD;AACA,WAAOX,EAAP;AACD;;AAjCiB;;;gCAAPT,M,kBAgBW,CAACqB,4BAAD,C;gCAhBXrB,M,aAkBMsB,e;gCAlBNtB,M,WAoBI,CAACuB,gBAAKC,QAAL,EAAD,C;;AAgBjBC,mBAAWC,UAAX,CAAsB1B,MAAtB","sourcesContent":["import { ComponentAspect, ComponentUI } from '@teambit/component';\nimport { UIRuntime } from '@teambit/ui';\nimport React from 'react';\nimport { 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 { 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 fileIconSlot?: FileIconSlot\n ) {}\n\n getCodePage = () => {\n return <CodePage fileIconSlot={this.fileIconSlot} />;\n };\n \n registerEnvFileIcon(icons: FileIconMatch[]) {\n this.fileIconSlot?.register(icons);\n return this;\n }\n static dependencies = [ComponentAspect];\n\n static runtime = UIRuntime;\n\n static slots = [Slot.withType<string>()];\n\n static async provider([component]: [ComponentUI], config, [fileIconSlot]: [FileIconSlot]) {\n const ui = new CodeUI(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 return ui;\n }\n}\n\nCodeAspect.addRuntime(CodeUI);\n"]}
package/package.json CHANGED
@@ -1,23 +1,23 @@
1
1
  {
2
2
  "name": "@teambit/code",
3
- "version": "0.0.722",
3
+ "version": "0.0.723",
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.722"
9
+ "version": "0.0.723"
10
10
  },
11
11
  "dependencies": {
12
12
  "@babel/runtime": "7.12.18",
13
13
  "core-js": "^3.0.0",
14
14
  "@teambit/harmony": "0.3.3",
15
15
  "@teambit/base-ui.constants.storage": "1.0.0",
16
- "@teambit/component": "0.0.722",
16
+ "@teambit/component": "0.0.723",
17
17
  "@teambit/ui-foundation.ui.menu-widget-icon": "0.0.488",
18
18
  "@teambit/code.ui.code-tab-page": "0.0.555",
19
19
  "@teambit/code.ui.utils.get-file-icon": "0.0.486",
20
- "@teambit/ui": "0.0.722"
20
+ "@teambit/ui": "0.0.723"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/react": "^17.0.8",
@@ -1,2 +1,2 @@
1
- export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_code@0.0.722/dist/code.composition.js')]
2
- export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_code@0.0.722/dist/code.docs.mdx')]
1
+ export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_code@0.0.723/dist/code.composition.js')]
2
+ export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_code@0.0.723/dist/code.docs.mdx')]