@teambit/component 0.0.694 → 0.0.697

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.
@@ -217,7 +217,7 @@ function VersionRelatedDropdowns({
217
217
  const location = (0, _baseUiRouting().useLocation)();
218
218
  const isNew = component.tags.isEmpty();
219
219
  const lanesContext = (0, _lanesUi().useLanesContext)();
220
- const currentLane = lanesContext === null || lanesContext === void 0 ? void 0 : lanesContext.currentLane;
220
+ const currentLane = lanesContext === null || lanesContext === void 0 ? void 0 : lanesContext.viewedLane;
221
221
  const {
222
222
  logs
223
223
  } = component;
@@ -225,7 +225,7 @@ function VersionRelatedDropdowns({
225
225
  const snaps = (0, _react().useMemo)(() => {
226
226
  return (logs || []).filter(log => !log.tag).map(snap => _objectSpread(_objectSpread({}, snap), {}, {
227
227
  version: snap.hash
228
- }));
228
+ })).reverse();
229
229
  }, [logs]);
230
230
  const tags = (0, _react().useMemo)(() => {
231
231
  var _component$tags;
@@ -1 +1 @@
1
- {"version":3,"sources":["menu.tsx"],"names":["Menu","navigationSlot","widgetSlot","className","host","menuItemSlot","consumeMethodSlot","component","mainMenuItems","values","styles","topBar","leftSide","rightSide","widgets","VersionRelatedDropdowns","consumeMethods","location","isNew","tags","isEmpty","lanesContext","currentLane","logs","isWorkspace","snaps","filter","log","tag","map","snap","version","hash","tagLookup","Map","forEach","set","toArray","reverse","get","lanes","getLanesByComponentId","id","localVersion","currentVersion","search","includes","methods","useConsumeMethods","length","useBox","name","latest","componentModel","method","x","Component","Title"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;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;;AAA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AAY,EAAEG,YAJhB;AAKE,IAAA,cAAc,EAAEC,cALlB;AAME,IAAA,aAAa,EAAErC,SAAS,CAAC6C,MAN3B;AAOE,IAAA,WAAW,EAAE9B;AAPf,IARF,CADF;AAoBD;;AAED,SAAS0B,iBAAT,CACEhC,cADF,EAEEqC,cAFF,EAGE/B,WAHF,EAImB;AACjB,SAAO,sBACL,MACE,uBAAQN,cAAc,CAACP,MAAf,EAAR,EACGoB,GADH,CACQyB,MAAD,IAAY;AACf,WAAOA,MAAP,aAAOA,MAAP,uBAAOA,MAAM,CAAGD,cAAH,EAAmB;AAAE/B,MAAAA;AAAF,KAAnB,CAAb;AACD,GAHH,EAIGI,MAJH,CAIW6B,CAAD,IAAO,CAAC,CAACA,CAAF,IAAOA,CAAC,CAACC,SAAT,IAAsBD,CAAC,CAACE,KAJzC,CAFG,EAOL,CAACzC,cAAD,EAAiBqC,cAAjB,EAAiC/B,WAAjC,CAPK,CAAP;AASD","sourcesContent":["import { MainDropdown, MenuItemSlot } from '@teambit/ui-foundation.ui.main-dropdown';\nimport { VersionDropdown } from '@teambit/component.ui.version-dropdown';\nimport { FullLoader } from '@teambit/ui-foundation.ui.full-loader';\nimport type { ConsumeMethod } from '@teambit/ui-foundation.ui.use-box.menu';\nimport { useLocation } from '@teambit/base-ui.routing.routing-provider';\nimport { flatten, groupBy, compact } from 'lodash';\nimport classnames from 'classnames';\nimport React, { useMemo } from 'react';\nimport { UseBoxDropdown } from '@teambit/ui-foundation.ui.use-box.dropdown';\nimport { Menu as ConsumeMethodsMenu } from '@teambit/ui-foundation.ui.use-box.menu';\nimport { LaneModel, useLanesContext } from '@teambit/lanes.ui.lanes';\nimport { LegacyComponentLog } from '@teambit/legacy-component-log';\nimport type { ComponentModel } from '../component-model';\nimport { useComponent } from '../use-component';\nimport { MenuNav } from './menu-nav';\nimport { MobileMenuNav } from './mobile-menu-nav';\nimport styles from './menu.module.scss';\nimport { OrderedNavigationSlot, ConsumeMethodSlot } from './nav-plugin';\n\nexport type MenuProps = {\n className?: string;\n /**\n * slot for top bar menu nav items\n */\n navigationSlot: OrderedNavigationSlot;\n /**\n * right side menu item slot\n */\n widgetSlot: OrderedNavigationSlot;\n host: string;\n /**\n * main dropdown item slot\n */\n menuItemSlot: MenuItemSlot;\n\n consumeMethodSlot: ConsumeMethodSlot;\n};\n\n/**\n * top bar menu.\n */\nexport function Menu({ navigationSlot, widgetSlot, className, host, menuItemSlot, consumeMethodSlot }: MenuProps) {\n const { component } = useComponent(host);\n const mainMenuItems = useMemo(() => groupBy(flatten(menuItemSlot.values()), 'category'), [menuItemSlot]);\n if (!component) return <FullLoader />;\n return (\n <div className={classnames(styles.topBar, className)}>\n <div className={styles.leftSide}>\n <MenuNav navigationSlot={navigationSlot} />\n <MobileMenuNav navigationSlot={navigationSlot} widgetSlot={widgetSlot} />\n </div>\n <div className={styles.rightSide}>\n <div className={styles.widgets}>\n <MenuNav navigationSlot={widgetSlot} />\n </div>\n <VersionRelatedDropdowns component={component} consumeMethods={consumeMethodSlot} host={host} />\n <MainDropdown menuItems={mainMenuItems} />\n </div>\n </div>\n );\n}\n\nfunction VersionRelatedDropdowns({\n component,\n consumeMethods,\n host,\n}: {\n component: ComponentModel;\n consumeMethods: ConsumeMethodSlot;\n host: string;\n}) {\n const location = useLocation();\n const isNew = component.tags.isEmpty();\n const lanesContext = useLanesContext();\n const currentLane = lanesContext?.currentLane;\n const { logs } = component;\n const isWorkspace = host === 'teambit.workspace/workspace';\n\n const snaps = useMemo(() => {\n return (logs || []).filter((log) => !log.tag).map((snap) => ({ ...snap, version: snap.hash }));\n }, [logs]);\n\n const tags = useMemo(() => {\n const tagLookup = new Map<string, LegacyComponentLog>();\n (logs || [])\n .filter((log) => log.tag)\n .forEach((tag) => {\n tagLookup.set(tag?.tag as string, tag);\n });\n return compact(\n component.tags\n ?.toArray()\n .reverse()\n .map((tag) => tagLookup.get(tag.version.version))\n ).map((tag) => ({ ...tag, version: tag.tag as string }));\n }, [logs]);\n\n const lanes = lanesContext?.getLanesByComponentId(component.id) || [];\n const localVersion = isWorkspace && !isNew && !currentLane;\n\n const currentVersion =\n isWorkspace && !isNew && !location.search.includes('version') ? 'workspace' : component.version;\n\n const methods = useConsumeMethods(consumeMethods, component, currentLane);\n return (\n <>\n {tags.length > 0 && (\n <UseBoxDropdown\n position=\"bottom-end\"\n className={styles.useBox}\n Menu={<ConsumeMethodsMenu methods={methods} componentName={component.id.name} />}\n />\n )}\n <VersionDropdown\n tags={tags}\n snaps={snaps}\n lanes={lanes}\n localVersion={localVersion}\n currentVersion={currentVersion}\n latestVersion={component.latest}\n currentLane={currentLane}\n />\n </>\n );\n}\n\nfunction useConsumeMethods(\n consumeMethods: ConsumeMethodSlot,\n componentModel: ComponentModel,\n currentLane?: LaneModel\n): ConsumeMethod[] {\n return useMemo(\n () =>\n flatten(consumeMethods.values())\n .map((method) => {\n return method?.(componentModel, { currentLane });\n })\n .filter((x) => !!x && x.Component && x.Title) as ConsumeMethod[],\n [consumeMethods, componentModel, currentLane]\n );\n}\n"]}
1
+ {"version":3,"sources":["menu.tsx"],"names":["Menu","navigationSlot","widgetSlot","className","host","menuItemSlot","consumeMethodSlot","component","mainMenuItems","values","styles","topBar","leftSide","rightSide","widgets","VersionRelatedDropdowns","consumeMethods","location","isNew","tags","isEmpty","lanesContext","currentLane","viewedLane","logs","isWorkspace","snaps","filter","log","tag","map","snap","version","hash","reverse","tagLookup","Map","forEach","set","toArray","get","lanes","getLanesByComponentId","id","localVersion","currentVersion","search","includes","methods","useConsumeMethods","length","useBox","name","latest","componentModel","method","x","Component","Title"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;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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AAEe,KAHT;AAIE,IAAA,YAAY,EAAEG,YAJhB;AAKE,IAAA,cAAc,EAAEC,cALlB;AAME,IAAA,aAAa,EAAEtC,SAAS,CAAC8C,MAN3B;AAOE,IAAA,WAAW,EAAE/B;AAPf,IARF,CADF;AAoBD;;AAED,SAAS2B,iBAAT,CACEjC,cADF,EAEEsC,cAFF,EAGEhC,WAHF,EAImB;AACjB,SAAO,sBACL,MACE,uBAAQN,cAAc,CAACP,MAAf,EAAR,EACGqB,GADH,CACQyB,MAAD,IAAY;AACf,WAAOA,MAAP,aAAOA,MAAP,uBAAOA,MAAM,CAAGD,cAAH,EAAmB;AAAEhC,MAAAA;AAAF,KAAnB,CAAb;AACD,GAHH,EAIGK,MAJH,CAIW6B,CAAD,IAAO,CAAC,CAACA,CAAF,IAAOA,CAAC,CAACC,SAAT,IAAsBD,CAAC,CAACE,KAJzC,CAFG,EAOL,CAAC1C,cAAD,EAAiBsC,cAAjB,EAAiChC,WAAjC,CAPK,CAAP;AASD","sourcesContent":["import { MainDropdown, MenuItemSlot } from '@teambit/ui-foundation.ui.main-dropdown';\nimport { VersionDropdown } from '@teambit/component.ui.version-dropdown';\nimport { FullLoader } from '@teambit/ui-foundation.ui.full-loader';\nimport type { ConsumeMethod } from '@teambit/ui-foundation.ui.use-box.menu';\nimport { useLocation } from '@teambit/base-ui.routing.routing-provider';\nimport { flatten, groupBy, compact } from 'lodash';\nimport classnames from 'classnames';\nimport React, { useMemo } from 'react';\nimport { UseBoxDropdown } from '@teambit/ui-foundation.ui.use-box.dropdown';\nimport { Menu as ConsumeMethodsMenu } from '@teambit/ui-foundation.ui.use-box.menu';\nimport { LaneModel, useLanesContext } from '@teambit/lanes.ui.lanes';\nimport { LegacyComponentLog } from '@teambit/legacy-component-log';\nimport type { ComponentModel } from '../component-model';\nimport { useComponent } from '../use-component';\nimport { MenuNav } from './menu-nav';\nimport { MobileMenuNav } from './mobile-menu-nav';\nimport styles from './menu.module.scss';\nimport { OrderedNavigationSlot, ConsumeMethodSlot } from './nav-plugin';\n\nexport type MenuProps = {\n className?: string;\n /**\n * slot for top bar menu nav items\n */\n navigationSlot: OrderedNavigationSlot;\n /**\n * right side menu item slot\n */\n widgetSlot: OrderedNavigationSlot;\n host: string;\n /**\n * main dropdown item slot\n */\n menuItemSlot: MenuItemSlot;\n\n consumeMethodSlot: ConsumeMethodSlot;\n};\n\n/**\n * top bar menu.\n */\nexport function Menu({ navigationSlot, widgetSlot, className, host, menuItemSlot, consumeMethodSlot }: MenuProps) {\n const { component } = useComponent(host);\n const mainMenuItems = useMemo(() => groupBy(flatten(menuItemSlot.values()), 'category'), [menuItemSlot]);\n if (!component) return <FullLoader />;\n return (\n <div className={classnames(styles.topBar, className)}>\n <div className={styles.leftSide}>\n <MenuNav navigationSlot={navigationSlot} />\n <MobileMenuNav navigationSlot={navigationSlot} widgetSlot={widgetSlot} />\n </div>\n <div className={styles.rightSide}>\n <div className={styles.widgets}>\n <MenuNav navigationSlot={widgetSlot} />\n </div>\n <VersionRelatedDropdowns component={component} consumeMethods={consumeMethodSlot} host={host} />\n <MainDropdown menuItems={mainMenuItems} />\n </div>\n </div>\n );\n}\n\nfunction VersionRelatedDropdowns({\n component,\n consumeMethods,\n host,\n}: {\n component: ComponentModel;\n consumeMethods: ConsumeMethodSlot;\n host: string;\n}) {\n const location = useLocation();\n const isNew = component.tags.isEmpty();\n const lanesContext = useLanesContext();\n const currentLane = lanesContext?.viewedLane;\n const { logs } = component;\n const isWorkspace = host === 'teambit.workspace/workspace';\n\n const snaps = useMemo(() => {\n return (logs || [])\n .filter((log) => !log.tag)\n .map((snap) => ({ ...snap, version: snap.hash }))\n .reverse();\n }, [logs]);\n\n const tags = useMemo(() => {\n const tagLookup = new Map<string, LegacyComponentLog>();\n (logs || [])\n .filter((log) => log.tag)\n .forEach((tag) => {\n tagLookup.set(tag?.tag as string, tag);\n });\n return compact(\n component.tags\n ?.toArray()\n .reverse()\n .map((tag) => tagLookup.get(tag.version.version))\n ).map((tag) => ({ ...tag, version: tag.tag as string }));\n }, [logs]);\n\n const lanes = lanesContext?.getLanesByComponentId(component.id) || [];\n const localVersion = isWorkspace && !isNew && !currentLane;\n\n const currentVersion =\n isWorkspace && !isNew && !location.search.includes('version') ? 'workspace' : component.version;\n\n const methods = useConsumeMethods(consumeMethods, component, currentLane);\n return (\n <>\n {tags.length > 0 && (\n <UseBoxDropdown\n position=\"bottom-end\"\n className={styles.useBox}\n Menu={<ConsumeMethodsMenu methods={methods} componentName={component.id.name} />}\n />\n )}\n <VersionDropdown\n tags={tags}\n snaps={snaps}\n lanes={lanes}\n localVersion={localVersion}\n currentVersion={currentVersion}\n latestVersion={component.latest}\n currentLane={currentLane}\n />\n </>\n );\n}\n\nfunction useConsumeMethods(\n consumeMethods: ConsumeMethodSlot,\n componentModel: ComponentModel,\n currentLane?: LaneModel\n): ConsumeMethod[] {\n return useMemo(\n () =>\n flatten(consumeMethods.values())\n .map((method) => {\n return method?.(componentModel, { currentLane });\n })\n .filter((x) => !!x && x.Component && x.Title) as ConsumeMethod[],\n [consumeMethods, componentModel, currentLane]\n );\n}\n"]}
@@ -46,7 +46,7 @@ function _useComponentQuery() {
46
46
  }
47
47
 
48
48
  function useComponent(host, id) {
49
- var _lanesContext$current, _lanesContext$current2;
49
+ var _lanesContext$viewedL, _lanesContext$viewedL2;
50
50
 
51
51
  const {
52
52
  params: {
@@ -60,9 +60,9 @@ function useComponent(host, id) {
60
60
  ignoreVersion: true
61
61
  })) || componentId;
62
62
  if (!targetId) throw new TypeError('useComponent received no component id');
63
- const currentLane = lanesContext === null || lanesContext === void 0 ? void 0 : lanesContext.currentLane; // when on a lane, always fetch all the logs starting from the 'head' version
63
+ const currentLane = lanesContext === null || lanesContext === void 0 ? void 0 : lanesContext.viewedLane; // when on a lane, always fetch all the logs starting from the 'head' version
64
64
 
65
- const logHead = lanesContext === null || lanesContext === void 0 ? void 0 : (_lanesContext$current = lanesContext.currentLane) === null || _lanesContext$current === void 0 ? void 0 : (_lanesContext$current2 = _lanesContext$current.components.find(component => component.model.id.fullName === targetId)) === null || _lanesContext$current2 === void 0 ? void 0 : _lanesContext$current2.model.id.version;
65
+ const logHead = lanesContext === null || lanesContext === void 0 ? void 0 : (_lanesContext$viewedL = lanesContext.viewedLane) === null || _lanesContext$viewedL === void 0 ? void 0 : (_lanesContext$viewedL2 = _lanesContext$viewedL.components.find(component => component.model.id.fullName === targetId)) === null || _lanesContext$viewedL2 === void 0 ? void 0 : _lanesContext$viewedL2.model.id.version;
66
66
  const logFilters = currentLane ? {
67
67
  log: {
68
68
  logHead
@@ -1 +1 @@
1
- {"version":3,"sources":["use-component.tsx"],"names":["useComponent","host","id","params","componentId","query","version","get","undefined","lanesContext","targetId","toString","ignoreVersion","TypeError","currentLane","logHead","components","find","component","model","fullName","logFilters","log","withVersion","includes"],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAYO,SAASA,YAAT,CAAsBC,IAAtB,EAAoCC,EAApC,EAAiE;AAAA;;AACtE,QAAM;AACJC,IAAAA,MAAM,EAAE;AAAEC,MAAAA;AAAF;AADJ,MAEF,sCAFJ;AAGA,QAAMC,KAAK,GAAG,4CAAd;AACA,QAAMC,OAAO,GAAGD,KAAK,CAACE,GAAN,CAAU,SAAV,KAAwBC,SAAxC;AACA,QAAMC,YAAY,GAAG,iCAArB;AACA,QAAMC,QAAQ,GAAG,CAAAR,EAAE,SAAF,IAAAA,EAAE,WAAF,YAAAA,EAAE,CAAES,QAAJ,CAAa;AAAEC,IAAAA,aAAa,EAAE;AAAjB,GAAb,MAAyCR,WAA1D;AACA,MAAI,CAACM,QAAL,EAAe,MAAM,IAAIG,SAAJ,CAAc,uCAAd,CAAN;AACf,QAAMC,WAAW,GAAGL,YAAH,aAAGA,YAAH,uBAAGA,YAAY,CAAEK,WAAlC,CATsE,CAUtE;;AACA,QAAMC,OAAO,GAAGN,YAAH,aAAGA,YAAH,gDAAGA,YAAY,CAAEK,WAAjB,oFAAG,sBAA2BE,UAA3B,CAAsCC,IAAtC,CAA4CC,SAAD,IAAeA,SAAS,CAACC,KAAV,CAAgBjB,EAAhB,CAAmBkB,QAAnB,KAAgCV,QAA1F,CAAH,2DAAG,uBACZS,KADY,CACNjB,EADM,CACHI,OADb;AAEA,QAAMe,UAAU,GAAGP,WAAW,GAC1B;AACEQ,IAAAA,GAAG,EAAE;AACHP,MAAAA;AADG;AADP,GAD0B,GAM1BP,SANJ;AAQA,SAAO,4CAAkBe,WAAW,CAACb,QAAD,EAAWJ,OAAX,CAA7B,EAAkDL,IAAlD,EAAwDoB,UAAxD,CAAP;AACD;;AAED,SAASE,WAAT,CAAqBrB,EAArB,EAAiCI,OAAjC,EAAmD;AACjD,MAAI,CAACA,OAAL,EAAc,OAAOJ,EAAP;AACd,MAAIA,EAAE,CAACsB,QAAH,CAAY,GAAZ,CAAJ,EAAsB,OAAOtB,EAAP;AACtB,SAAQ,GAAEA,EAAG,IAAGI,OAAQ,EAAxB;AACD","sourcesContent":["import { useRouteMatch } from 'react-router-dom';\nimport { ComponentID } from '@teambit/component-id';\nimport { useQuery } from '@teambit/ui-foundation.ui.react-router.use-query';\nimport { ComponentDescriptor } from '@teambit/component-descriptor';\nimport { useLanesContext } from '@teambit/lanes.ui.lanes';\nimport { ComponentModel } from './component-model';\nimport { ComponentError } from './component-error';\nimport { useComponentQuery } from './use-component-query';\n\nexport type Component = {\n component?: ComponentModel;\n error?: ComponentError;\n componentDescriptor?: ComponentDescriptor;\n};\n\ntype ComponentRoute = {\n componentId?: string;\n};\n\nexport function useComponent(host: string, id?: ComponentID): Component {\n const {\n params: { componentId },\n } = useRouteMatch<ComponentRoute>();\n const query = useQuery();\n const version = query.get('version') || undefined;\n const lanesContext = useLanesContext();\n const targetId = id?.toString({ ignoreVersion: true }) || componentId;\n if (!targetId) throw new TypeError('useComponent received no component id');\n const currentLane = lanesContext?.currentLane;\n // when on a lane, always fetch all the logs starting from the 'head' version\n const logHead = lanesContext?.currentLane?.components.find((component) => component.model.id.fullName === targetId)\n ?.model.id.version;\n const logFilters = currentLane\n ? {\n log: {\n logHead,\n },\n }\n : undefined;\n\n return useComponentQuery(withVersion(targetId, version), host, logFilters);\n}\n\nfunction withVersion(id: string, version?: string) {\n if (!version) return id;\n if (id.includes('@')) return id;\n return `${id}@${version}`;\n}\n"]}
1
+ {"version":3,"sources":["use-component.tsx"],"names":["useComponent","host","id","params","componentId","query","version","get","undefined","lanesContext","targetId","toString","ignoreVersion","TypeError","currentLane","viewedLane","logHead","components","find","component","model","fullName","logFilters","log","withVersion","includes"],"mappings":";;;;;;;AAAA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAEA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAGA;AAAA;;AAAA;AAAA;AAAA;;AAAA;AAAA;;AAYO,SAASA,YAAT,CAAsBC,IAAtB,EAAoCC,EAApC,EAAiE;AAAA;;AACtE,QAAM;AACJC,IAAAA,MAAM,EAAE;AAAEC,MAAAA;AAAF;AADJ,MAEF,sCAFJ;AAGA,QAAMC,KAAK,GAAG,4CAAd;AACA,QAAMC,OAAO,GAAGD,KAAK,CAACE,GAAN,CAAU,SAAV,KAAwBC,SAAxC;AACA,QAAMC,YAAY,GAAG,iCAArB;AACA,QAAMC,QAAQ,GAAG,CAAAR,EAAE,SAAF,IAAAA,EAAE,WAAF,YAAAA,EAAE,CAAES,QAAJ,CAAa;AAAEC,IAAAA,aAAa,EAAE;AAAjB,GAAb,MAAyCR,WAA1D;AACA,MAAI,CAACM,QAAL,EAAe,MAAM,IAAIG,SAAJ,CAAc,uCAAd,CAAN;AACf,QAAMC,WAAW,GAAGL,YAAH,aAAGA,YAAH,uBAAGA,YAAY,CAAEM,UAAlC,CATsE,CAUtE;;AACA,QAAMC,OAAO,GAAGP,YAAH,aAAGA,YAAH,gDAAGA,YAAY,CAAEM,UAAjB,oFAAG,sBAA0BE,UAA1B,CAAqCC,IAArC,CAA2CC,SAAD,IAAeA,SAAS,CAACC,KAAV,CAAgBlB,EAAhB,CAAmBmB,QAAnB,KAAgCX,QAAzF,CAAH,2DAAG,uBACZU,KADY,CACNlB,EADM,CACHI,OADb;AAEA,QAAMgB,UAAU,GAAGR,WAAW,GAC1B;AACES,IAAAA,GAAG,EAAE;AACHP,MAAAA;AADG;AADP,GAD0B,GAM1BR,SANJ;AAQA,SAAO,4CAAkBgB,WAAW,CAACd,QAAD,EAAWJ,OAAX,CAA7B,EAAkDL,IAAlD,EAAwDqB,UAAxD,CAAP;AACD;;AAED,SAASE,WAAT,CAAqBtB,EAArB,EAAiCI,OAAjC,EAAmD;AACjD,MAAI,CAACA,OAAL,EAAc,OAAOJ,EAAP;AACd,MAAIA,EAAE,CAACuB,QAAH,CAAY,GAAZ,CAAJ,EAAsB,OAAOvB,EAAP;AACtB,SAAQ,GAAEA,EAAG,IAAGI,OAAQ,EAAxB;AACD","sourcesContent":["import { useRouteMatch } from 'react-router-dom';\nimport { ComponentID } from '@teambit/component-id';\nimport { useQuery } from '@teambit/ui-foundation.ui.react-router.use-query';\nimport { ComponentDescriptor } from '@teambit/component-descriptor';\nimport { useLanesContext } from '@teambit/lanes.ui.lanes';\nimport { ComponentModel } from './component-model';\nimport { ComponentError } from './component-error';\nimport { useComponentQuery } from './use-component-query';\n\nexport type Component = {\n component?: ComponentModel;\n error?: ComponentError;\n componentDescriptor?: ComponentDescriptor;\n};\n\ntype ComponentRoute = {\n componentId?: string;\n};\n\nexport function useComponent(host: string, id?: ComponentID): Component {\n const {\n params: { componentId },\n } = useRouteMatch<ComponentRoute>();\n const query = useQuery();\n const version = query.get('version') || undefined;\n const lanesContext = useLanesContext();\n const targetId = id?.toString({ ignoreVersion: true }) || componentId;\n if (!targetId) throw new TypeError('useComponent received no component id');\n const currentLane = lanesContext?.viewedLane;\n // when on a lane, always fetch all the logs starting from the 'head' version\n const logHead = lanesContext?.viewedLane?.components.find((component) => component.model.id.fullName === targetId)\n ?.model.id.version;\n const logFilters = currentLane\n ? {\n log: {\n logHead,\n },\n }\n : undefined;\n\n return useComponentQuery(withVersion(targetId, version), host, logFilters);\n}\n\nfunction withVersion(id: string, version?: string) {\n if (!version) return id;\n if (id.includes('@')) return id;\n return `${id}@${version}`;\n}\n"]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/component",
3
- "version": "0.0.694",
3
+ "version": "0.0.697",
4
4
  "homepage": "https://bit.dev/teambit/component/component",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "component",
9
- "version": "0.0.694"
9
+ "version": "0.0.697"
10
10
  },
11
11
  "dependencies": {
12
12
  "@teambit/any-fs": "0.0.5",
@@ -32,41 +32,41 @@
32
32
  "@teambit/design.inputs.dropdown": "0.0.7",
33
33
  "@teambit/component-id": "0.0.402",
34
34
  "@teambit/ui-foundation.ui.menu-widget-icon": "0.0.488",
35
- "@teambit/aspect-loader": "0.0.694",
35
+ "@teambit/aspect-loader": "0.0.697",
36
36
  "@teambit/legacy-bit-id": "0.0.399",
37
37
  "@teambit/toolbox.string.capitalize": "0.0.483",
38
- "@teambit/cli": "0.0.464",
39
- "@teambit/config": "0.0.477",
40
- "@teambit/express": "0.0.560",
41
- "@teambit/graphql": "0.0.694",
38
+ "@teambit/cli": "0.0.465",
39
+ "@teambit/config": "0.0.478",
40
+ "@teambit/express": "0.0.561",
41
+ "@teambit/graphql": "0.0.697",
42
42
  "@teambit/bit-error": "0.0.394",
43
- "@teambit/command-bar": "0.0.694",
44
- "@teambit/preview": "0.0.694",
45
- "@teambit/pubsub": "0.0.694",
43
+ "@teambit/command-bar": "0.0.697",
44
+ "@teambit/preview": "0.0.697",
45
+ "@teambit/pubsub": "0.0.697",
46
46
  "@teambit/ui-foundation.ui.is-browser": "0.0.486",
47
47
  "@teambit/ui-foundation.ui.main-dropdown": "0.0.486",
48
48
  "@teambit/ui-foundation.ui.react-router.slot-router": "0.0.488",
49
49
  "@teambit/ui-foundation.ui.use-box.menu": "0.0.114",
50
- "@teambit/ui": "0.0.694",
50
+ "@teambit/ui": "0.0.697",
51
51
  "@teambit/component-issues": "0.0.49",
52
52
  "@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.487",
53
53
  "@teambit/cli-table": "0.0.33",
54
- "@teambit/component-descriptor": "0.0.28",
55
- "@teambit/lanes.ui.lanes": "0.0.28",
54
+ "@teambit/component-descriptor": "0.0.29",
55
+ "@teambit/lanes.ui.lanes": "0.0.31",
56
56
  "@teambit/ui-foundation.ui.react-router.use-query": "0.0.486",
57
57
  "@teambit/design.ui.empty-box": "0.0.353",
58
58
  "@teambit/harmony.ui.aspect-box": "0.0.486",
59
59
  "@teambit/design.ui.pages.not-found": "0.0.354",
60
60
  "@teambit/design.ui.pages.server-error": "0.0.354",
61
- "@teambit/compositions": "0.0.694",
62
- "@teambit/deprecation": "0.0.694",
63
- "@teambit/envs": "0.0.694",
61
+ "@teambit/compositions": "0.0.697",
62
+ "@teambit/deprecation": "0.0.697",
63
+ "@teambit/envs": "0.0.697",
64
64
  "@teambit/legacy-component-log": "0.0.392",
65
- "@teambit/component.ui.version-dropdown": "0.0.513",
65
+ "@teambit/ui-foundation.ui.react-router.extend-path": "0.0.486",
66
+ "@teambit/component.ui.version-dropdown": "0.0.516",
66
67
  "@teambit/ui-foundation.ui.full-loader": "0.0.486",
67
68
  "@teambit/ui-foundation.ui.use-box.dropdown": "0.0.114",
68
- "@teambit/ui-foundation.ui.constants.z-indexes": "0.0.487",
69
- "@teambit/ui-foundation.ui.react-router.extend-path": "0.0.486"
69
+ "@teambit/ui-foundation.ui.constants.z-indexes": "0.0.487"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@types/react": "^17.0.8",
@@ -85,7 +85,7 @@
85
85
  },
86
86
  "peerDependencies": {
87
87
  "@apollo/client": "^3.0.0",
88
- "@teambit/legacy": "1.0.242",
88
+ "@teambit/legacy": "1.0.243",
89
89
  "react-dom": "^16.8.0 || ^17.0.0",
90
90
  "react": "^16.8.0 || ^17.0.0"
91
91
  },
@@ -113,7 +113,7 @@
113
113
  "react": "-"
114
114
  },
115
115
  "peerDependencies": {
116
- "@teambit/legacy": "1.0.242",
116
+ "@teambit/legacy": "1.0.243",
117
117
  "react-dom": "^16.8.0 || ^17.0.0",
118
118
  "react": "^16.8.0 || ^17.0.0"
119
119
  }
@@ -1,2 +1,2 @@
1
- export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.694/dist/component.composition.js')]
2
- export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.694/dist/component.docs.mdx')]
1
+ export const compositions = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.697/dist/component.composition.js')]
2
+ export const overview = [require('/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.697/dist/component.docs.mdx')]
package/ui/menu/menu.tsx CHANGED
@@ -72,12 +72,15 @@ function VersionRelatedDropdowns({
72
72
  const location = useLocation();
73
73
  const isNew = component.tags.isEmpty();
74
74
  const lanesContext = useLanesContext();
75
- const currentLane = lanesContext?.currentLane;
75
+ const currentLane = lanesContext?.viewedLane;
76
76
  const { logs } = component;
77
77
  const isWorkspace = host === 'teambit.workspace/workspace';
78
78
 
79
79
  const snaps = useMemo(() => {
80
- return (logs || []).filter((log) => !log.tag).map((snap) => ({ ...snap, version: snap.hash }));
80
+ return (logs || [])
81
+ .filter((log) => !log.tag)
82
+ .map((snap) => ({ ...snap, version: snap.hash }))
83
+ .reverse();
81
84
  }, [logs]);
82
85
 
83
86
  const tags = useMemo(() => {
@@ -26,9 +26,9 @@ export function useComponent(host: string, id?: ComponentID): Component {
26
26
  const lanesContext = useLanesContext();
27
27
  const targetId = id?.toString({ ignoreVersion: true }) || componentId;
28
28
  if (!targetId) throw new TypeError('useComponent received no component id');
29
- const currentLane = lanesContext?.currentLane;
29
+ const currentLane = lanesContext?.viewedLane;
30
30
  // when on a lane, always fetch all the logs starting from the 'head' version
31
- const logHead = lanesContext?.currentLane?.components.find((component) => component.model.id.fullName === targetId)
31
+ const logHead = lanesContext?.viewedLane?.components.find((component) => component.model.id.fullName === targetId)
32
32
  ?.model.id.version;
33
33
  const logFilters = currentLane
34
34
  ? {