@teambit/component 0.0.881 → 0.0.883
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/aspect-entry.js +3 -16
- package/dist/aspect-entry.js.map +1 -1
- package/dist/aspect-list.js +6 -35
- package/dist/aspect-list.js.map +1 -1
- package/dist/aspect.section.js +0 -16
- package/dist/aspect.section.js.map +1 -1
- package/dist/component-fs.js +2 -25
- package/dist/component-fs.js.map +1 -1
- package/dist/component-map/component-map.js +10 -26
- package/dist/component-map/component-map.js.map +1 -1
- package/dist/component-map/index.js +0 -3
- package/dist/component-map/index.js.map +1 -1
- package/dist/component-meta.js +1 -14
- package/dist/component-meta.js.map +1 -1
- package/dist/component.aspect.js +0 -5
- package/dist/component.aspect.js.map +1 -1
- package/dist/component.composition.js +0 -6
- package/dist/component.composition.js.map +1 -1
- package/dist/component.graphql.js +2 -26
- package/dist/component.graphql.js.map +1 -1
- package/dist/component.js +19 -90
- package/dist/component.js.map +1 -1
- package/dist/component.main.runtime.js +6 -64
- package/dist/component.main.runtime.js.map +1 -1
- package/dist/component.route.js +2 -14
- package/dist/component.route.js.map +1 -1
- package/dist/component.ui.runtime.js +3 -83
- package/dist/component.ui.runtime.js.map +1 -1
- package/dist/config.js +0 -3
- package/dist/config.js.map +1 -1
- package/dist/dependencies/dependencies.js +7 -32
- package/dist/dependencies/dependencies.js.map +1 -1
- package/dist/dependencies/index.js +0 -3
- package/dist/dependencies/index.js.map +1 -1
- package/dist/exceptions/could-not-find-latest.js +0 -4
- package/dist/exceptions/could-not-find-latest.js.map +1 -1
- package/dist/exceptions/host-not-found.js +0 -4
- package/dist/exceptions/host-not-found.js.map +1 -1
- package/dist/exceptions/index.js +0 -13
- package/dist/exceptions/index.js.map +1 -1
- package/dist/exceptions/main-file-not-found.js +0 -4
- package/dist/exceptions/main-file-not-found.js.map +1 -1
- package/dist/exceptions/nothing-to-snap.js +0 -2
- package/dist/exceptions/nothing-to-snap.js.map +1 -1
- package/dist/history-graph.js +0 -2
- package/dist/history-graph.js.map +1 -1
- package/dist/host/component-host-model.js +0 -7
- package/dist/host/component-host-model.js.map +1 -1
- package/dist/host/index.js +0 -5
- package/dist/host/index.js.map +1 -1
- package/dist/host/use-component-host.js +0 -14
- package/dist/host/use-component-host.js.map +1 -1
- package/dist/index.js +0 -63
- package/dist/index.js.map +1 -1
- package/dist/section/index.js +0 -3
- package/dist/section/index.js.map +1 -1
- package/dist/show/extensions.fragment.js +0 -8
- package/dist/show/extensions.fragment.js.map +1 -1
- package/dist/show/files.fragment.js +0 -11
- package/dist/show/files.fragment.js.map +1 -1
- package/dist/show/id.fragment.js +0 -10
- package/dist/show/id.fragment.js.map +1 -1
- package/dist/show/index.js +0 -24
- package/dist/show/index.js.map +1 -1
- package/dist/show/main-file.fragment.js +0 -9
- package/dist/show/main-file.fragment.js.map +1 -1
- package/dist/show/name.fragment.js +0 -9
- package/dist/show/name.fragment.js.map +1 -1
- package/dist/show/scope.fragment.js +0 -10
- package/dist/show/scope.fragment.js.map +1 -1
- package/dist/show/show.cmd.js +1 -33
- package/dist/show/show.cmd.js.map +1 -1
- package/dist/snap/index.js +0 -6
- package/dist/snap/index.js.map +1 -1
- package/dist/snap/snap.js +0 -5
- package/dist/snap/snap.js.map +1 -1
- package/dist/state.js +6 -24
- package/dist/state.js.map +1 -1
- package/dist/store.js +0 -5
- package/dist/store.js.map +1 -1
- package/dist/tag/index.js +0 -3
- package/dist/tag/index.js.map +1 -1
- package/dist/tag/tag.js +1 -9
- package/dist/tag/tag.js.map +1 -1
- package/dist/tag-map.js +4 -28
- package/dist/tag-map.js.map +1 -1
- package/dist/ui/aspect-page/aspect-page.js +2 -35
- package/dist/ui/aspect-page/aspect-page.js.map +1 -1
- package/dist/ui/aspect-page/index.js +0 -3
- package/dist/ui/aspect-page/index.js.map +1 -1
- package/dist/ui/component-error/component-error.js +0 -14
- package/dist/ui/component-error/component-error.js.map +1 -1
- package/dist/ui/component-error/index.js +0 -3
- package/dist/ui/component-error/index.js.map +1 -1
- package/dist/ui/component-model/component-model.js +2 -21
- package/dist/ui/component-model/component-model.js.map +1 -1
- package/dist/ui/component-model/index.js +0 -3
- package/dist/ui/component-model/index.js.map +1 -1
- package/dist/ui/component-searcher/component-result.js +0 -20
- package/dist/ui/component-searcher/component-result.js.map +1 -1
- package/dist/ui/component-searcher/component-searcher.js +0 -22
- package/dist/ui/component-searcher/component-searcher.js.map +1 -1
- package/dist/ui/component-searcher/index.js +0 -3
- package/dist/ui/component-searcher/index.js.map +1 -1
- package/dist/ui/component.js +5 -40
- package/dist/ui/component.js.map +1 -1
- package/dist/ui/context/component-context.js +0 -9
- package/dist/ui/context/component-context.js.map +1 -1
- package/dist/ui/context/component-provider.js +0 -9
- package/dist/ui/context/component-provider.js.map +1 -1
- package/dist/ui/context/index.js +0 -6
- package/dist/ui/context/index.js.map +1 -1
- package/dist/ui/index.js +0 -21
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/menu/index.js +0 -3
- package/dist/ui/menu/index.js.map +1 -1
- package/dist/ui/menu/menu-nav.js +4 -23
- package/dist/ui/menu/menu-nav.js.map +1 -1
- package/dist/ui/menu/menu.js +0 -70
- package/dist/ui/menu/menu.js.map +1 -1
- package/dist/ui/menu/mobile-menu-nav.js +6 -49
- package/dist/ui/menu/mobile-menu-nav.js.map +1 -1
- package/dist/ui/top-bar-nav/index.js +0 -2
- package/dist/ui/top-bar-nav/index.js.map +1 -1
- package/dist/ui/top-bar-nav/top-bar-nav.js +8 -32
- package/dist/ui/top-bar-nav/top-bar-nav.js.map +1 -1
- package/dist/ui/use-component-from-location.js +0 -9
- package/dist/ui/use-component-from-location.js.map +1 -1
- package/dist/ui/use-component-query.js +12 -60
- package/dist/ui/use-component-query.js.map +1 -1
- package/dist/ui/use-component.js +0 -11
- package/dist/ui/use-component.js.map +1 -1
- package/package-tar/teambit-component-0.0.883.tgz +0 -0
- package/package.json +12 -12
- package/{preview-1666409808293.js → preview-1666582798766.js} +2 -2
- package/package-tar/teambit-component-0.0.881.tgz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["componentIdFields","gql","componentOverviewFields","componentFields","GET_COMPONENT","SUB_SUBSCRIPTION_ADDED","SUB_COMPONENT_CHANGED","SUB_COMPONENT_REMOVED","useComponentQuery","componentId","host","filters","idRef","useRef","current","useDataQuery","variables","id","extensionId","log","data","error","loading","subscribeToMore","rest","useEffect","unsubAddition","document","updateQuery","prev","subscriptionData","prevComponent","getHost","get","addedComponent","componentAdded","component","name","unsubChanges","updatedComponent","componentChanged","isUpdated","ComponentID","isEqualObj","unsubRemoval","removedIds","componentRemoved","componentIds","length","isRemoved","some","removedId","rawComponent","useMemo","aspectList","entries","aspects","map","aspectObject","aspectId","aspectData","fromObject","componentDescriptor","ComponentDescriptor","toString","undefined","ComponentModel","from","ComponentError","message"],"sources":["use-component-query.ts"],"sourcesContent":["import { useMemo, useEffect, useRef } from 'react';\nimport { gql } from '@apollo/client';\nimport { useDataQuery } from '@teambit/ui-foundation.ui.hooks.use-data-query';\nimport { ComponentID, ComponentIdObj } from '@teambit/component-id';\nimport { ComponentDescriptor } from '@teambit/component-descriptor';\n\nimport { ComponentModel } from './component-model';\nimport { ComponentError } from './component-error';\n\nexport const componentIdFields = gql`\n fragment componentIdFields on ComponentID {\n name\n version\n scope\n }\n`;\n\nexport const componentOverviewFields = gql`\n fragment componentOverviewFields on Component {\n id {\n ...componentIdFields\n }\n aspects(include: [\"teambit.preview/preview\", \"teambit.envs/envs\"]) {\n # 'id' property in gql refers to a *global* identifier and used for caching.\n # this makes aspect data cache under the same key, even when they are under different components.\n # renaming the property fixes that.\n id\n data\n }\n elementsUrl\n description\n deprecation {\n isDeprecate\n newId\n }\n labels\n displayName\n server {\n env\n url\n }\n buildStatus\n env {\n id\n icon\n }\n size {\n compressedTotal\n }\n preview {\n includesEnvTemplate\n legacyHeader\n isScaling\n }\n compositions {\n identifier\n displayName\n }\n }\n ${componentIdFields}\n`;\n\nexport const componentFields = gql`\n fragment componentFields on Component {\n id {\n ...componentIdFields\n }\n ...componentOverviewFields\n packageName\n latest\n compositions {\n identifier\n displayName\n }\n tags {\n version\n }\n logs(type: $logType, offset: $logOffset, limit: $logLimit, head: $logHead, sort: $logSort) {\n id\n message\n username\n email\n date\n hash\n tag\n }\n }\n ${componentIdFields}\n ${componentOverviewFields}\n`;\n\nconst GET_COMPONENT = gql`\n query Component(\n $id: String!\n $extensionId: String!\n $logType: String\n $logOffset: Int\n $logLimit: Int\n $logHead: String\n $logSort: String\n ) {\n getHost(id: $extensionId) {\n id # used for GQL caching\n get(id: $id) {\n ...componentFields\n }\n }\n }\n ${componentFields}\n`;\n\nconst SUB_SUBSCRIPTION_ADDED = gql`\n subscription OnComponentAdded($logType: String, $logOffset: Int, $logLimit: Int, $logHead: String, $logSort: String) {\n componentAdded {\n component {\n ...componentFields\n }\n }\n }\n ${componentFields}\n`;\n\nconst SUB_COMPONENT_CHANGED = gql`\n subscription OnComponentChanged(\n $logType: String\n $logOffset: Int\n $logLimit: Int\n $logHead: String\n $logSort: String\n ) {\n componentChanged {\n component {\n ...componentFields\n }\n }\n }\n ${componentFields}\n`;\n\nconst SUB_COMPONENT_REMOVED = gql`\n subscription OnComponentRemoved {\n componentRemoved {\n componentIds {\n ...componentIdFields\n }\n }\n }\n ${componentIdFields}\n`;\nexport type Filters = {\n log?: { logType?: string; logOffset?: number; logLimit?: number; logHead?: string; logSort?: string };\n};\n/** provides data to component ui page, making sure both variables and return value are safely typed and memoized */\nexport function useComponentQuery(componentId: string, host: string, filters?: Filters) {\n const idRef = useRef(componentId);\n idRef.current = componentId;\n const { data, error, loading, subscribeToMore, ...rest } = useDataQuery(GET_COMPONENT, {\n variables: { id: componentId, extensionId: host, ...(filters?.log || {}) },\n });\n\n useEffect(() => {\n // @TODO @Kutner fix subscription for scope\n if (host !== 'teambit.workspace/workspace') {\n return () => {};\n }\n\n const unsubAddition = subscribeToMore({\n document: SUB_SUBSCRIPTION_ADDED,\n updateQuery: (prev, { subscriptionData }) => {\n const prevComponent = prev?.getHost?.get;\n const addedComponent = subscriptionData?.data?.componentAdded?.component;\n\n if (!addedComponent || prevComponent) return prev;\n\n if (idRef.current === addedComponent.id.name) {\n return {\n ...prev,\n getHost: {\n ...prev.getHost,\n get: addedComponent,\n },\n };\n }\n\n return prev;\n },\n });\n\n const unsubChanges = subscribeToMore({\n document: SUB_COMPONENT_CHANGED,\n updateQuery: (prev, { subscriptionData }) => {\n if (!subscriptionData.data) return prev;\n\n const prevComponent = prev?.getHost?.get;\n const updatedComponent = subscriptionData?.data?.componentChanged?.component;\n\n const isUpdated = updatedComponent && ComponentID.isEqualObj(prevComponent?.id, updatedComponent?.id);\n\n if (isUpdated) {\n return {\n ...prev,\n getHost: {\n ...prev.getHost,\n get: updatedComponent,\n },\n };\n }\n\n return prev;\n },\n });\n\n const unsubRemoval = subscribeToMore({\n document: SUB_COMPONENT_REMOVED,\n updateQuery: (prev, { subscriptionData }) => {\n if (!subscriptionData.data) return prev;\n\n const prevComponent = prev?.getHost?.get;\n const removedIds: ComponentIdObj[] | undefined = subscriptionData?.data?.componentRemoved?.componentIds;\n if (!prevComponent || !removedIds?.length) return prev;\n\n const isRemoved = removedIds.some((removedId) => ComponentID.isEqualObj(removedId, prevComponent.id));\n\n if (isRemoved) {\n return {\n ...prev,\n getHost: {\n ...prev.getHost,\n get: null,\n },\n };\n }\n\n return prev;\n },\n });\n\n return () => {\n unsubChanges();\n unsubAddition();\n unsubRemoval();\n };\n }, []);\n\n const rawComponent = data?.getHost?.get;\n return useMemo(() => {\n const aspectList = {\n entries: rawComponent?.aspects.map((aspectObject) => {\n return {\n ...aspectObject,\n aspectId: aspectObject.id,\n aspectData: aspectObject.data,\n };\n }),\n };\n const id = rawComponent && ComponentID.fromObject(rawComponent.id);\n return {\n componentDescriptor: id ? ComponentDescriptor.fromObject({ id: id.toString(), aspectList }) : undefined,\n component: rawComponent ? ComponentModel.from({ ...rawComponent, host }) : undefined,\n // eslint-disable-next-line\n error: error\n ? new ComponentError(500, error.message)\n : !rawComponent && !loading\n ? new ComponentError(404)\n : undefined,\n loading,\n ...rest,\n };\n }, [rawComponent, host, error]);\n}\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;;;;;;AAEO,MAAMA,iBAAiB,GAAG,IAAAC,aAAA,CAAI;AACrC;AACA;AACA;AACA;AACA;AACA,CANO;;AAQA,MAAMC,uBAAuB,GAAG,IAAAD,aAAA,CAAI;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAID,iBAAkB;AACtB,CA3CO;;AA6CA,MAAMG,eAAe,GAAG,IAAAF,aAAA,CAAI;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAID,iBAAkB;AACtB,IAAIE,uBAAwB;AAC5B,CA3BO;;AA6BP,MAAME,aAAa,GAAG,IAAAH,aAAA,CAAI;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIE,eAAgB;AACpB,CAlBA;AAo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CAACzC,EAFzB;UAGE2C,UAAU,EAAEF,YAAY,CAACtC;QAH3B;MAKD,CANQ;IADQ,CAAnB;;IASA,MAAMH,EAAE,GAAGmC,YAAY,IAAIV,0BAAA,CAAYmB,UAAZ,CAAuBT,YAAY,CAACnC,EAApC,CAA3B;;IACA;MACE6C,mBAAmB,EAAE7C,EAAE,GAAG8C,0CAAA,CAAoBF,UAApB,CAA+B;QAAE5C,EAAE,EAAEA,EAAE,CAAC+C,QAAH,EAAN;QAAqBV;MAArB,CAA/B,CAAH,GAAuEW,SADhG;MAEE7B,SAAS,EAAEgB,YAAY,GAAGc,gCAAA,CAAeC,IAAf,iCAAyBf,YAAzB;QAAuC1C;MAAvC,GAAH,GAAoDuD,SAF7E;MAGE;MACA5C,KAAK,EAAEA,KAAK,GACR,KAAI+C,gCAAJ,EAAmB,GAAnB,EAAwB/C,KAAK,CAACgD,OAA9B,CADQ,GAER,CAACjB,YAAD,IAAiB,CAAC9B,OAAlB,GACA,KAAI8C,gCAAJ,EAAmB,GAAnB,CADA,GAEAH,SARN;MASE3C;IATF,GAUKE,IAVL;EAYD,CAvBM,EAuBJ,CAAC4B,YAAD,EAAe1C,IAAf,EAAqBW,KAArB,CAvBI,CAAP;AAwBD"}
|
|
1
|
+
{"version":3,"names":["componentIdFields","gql","componentOverviewFields","componentFields","GET_COMPONENT","SUB_SUBSCRIPTION_ADDED","SUB_COMPONENT_CHANGED","SUB_COMPONENT_REMOVED","useComponentQuery","componentId","host","filters","idRef","useRef","current","useDataQuery","variables","id","extensionId","log","data","error","loading","subscribeToMore","rest","useEffect","unsubAddition","document","updateQuery","prev","subscriptionData","prevComponent","getHost","get","addedComponent","componentAdded","component","name","unsubChanges","updatedComponent","componentChanged","isUpdated","ComponentID","isEqualObj","unsubRemoval","removedIds","componentRemoved","componentIds","length","isRemoved","some","removedId","rawComponent","useMemo","aspectList","entries","aspects","map","aspectObject","aspectId","aspectData","fromObject","componentDescriptor","ComponentDescriptor","toString","undefined","ComponentModel","from","ComponentError","message"],"sources":["use-component-query.ts"],"sourcesContent":["import { useMemo, useEffect, useRef } from 'react';\nimport { gql } from '@apollo/client';\nimport { useDataQuery } from '@teambit/ui-foundation.ui.hooks.use-data-query';\nimport { ComponentID, ComponentIdObj } from '@teambit/component-id';\nimport { ComponentDescriptor } from '@teambit/component-descriptor';\n\nimport { ComponentModel } from './component-model';\nimport { ComponentError } from './component-error';\n\nexport const componentIdFields = gql`\n fragment componentIdFields on ComponentID {\n name\n version\n scope\n }\n`;\n\nexport const componentOverviewFields = gql`\n fragment componentOverviewFields on Component {\n id {\n ...componentIdFields\n }\n aspects(include: [\"teambit.preview/preview\", \"teambit.envs/envs\"]) {\n # 'id' property in gql refers to a *global* identifier and used for caching.\n # this makes aspect data cache under the same key, even when they are under different components.\n # renaming the property fixes that.\n id\n data\n }\n elementsUrl\n description\n deprecation {\n isDeprecate\n newId\n }\n labels\n displayName\n server {\n env\n url\n }\n buildStatus\n env {\n id\n icon\n }\n size {\n compressedTotal\n }\n preview {\n includesEnvTemplate\n legacyHeader\n isScaling\n }\n compositions {\n identifier\n displayName\n }\n }\n ${componentIdFields}\n`;\n\nexport const componentFields = gql`\n fragment componentFields on Component {\n id {\n ...componentIdFields\n }\n ...componentOverviewFields\n packageName\n latest\n compositions {\n identifier\n displayName\n }\n tags {\n version\n }\n logs(type: $logType, offset: $logOffset, limit: $logLimit, head: $logHead, sort: $logSort) {\n id\n message\n username\n email\n date\n hash\n tag\n }\n }\n ${componentIdFields}\n ${componentOverviewFields}\n`;\n\nconst GET_COMPONENT = gql`\n query Component(\n $id: String!\n $extensionId: String!\n $logType: String\n $logOffset: Int\n $logLimit: Int\n $logHead: String\n $logSort: String\n ) {\n getHost(id: $extensionId) {\n id # used for GQL caching\n get(id: $id) {\n ...componentFields\n }\n }\n }\n ${componentFields}\n`;\n\nconst SUB_SUBSCRIPTION_ADDED = gql`\n subscription OnComponentAdded($logType: String, $logOffset: Int, $logLimit: Int, $logHead: String, $logSort: String) {\n componentAdded {\n component {\n ...componentFields\n }\n }\n }\n ${componentFields}\n`;\n\nconst SUB_COMPONENT_CHANGED = gql`\n subscription OnComponentChanged(\n $logType: String\n $logOffset: Int\n $logLimit: Int\n $logHead: String\n $logSort: String\n ) {\n componentChanged {\n component {\n ...componentFields\n }\n }\n }\n ${componentFields}\n`;\n\nconst SUB_COMPONENT_REMOVED = gql`\n subscription OnComponentRemoved {\n componentRemoved {\n componentIds {\n ...componentIdFields\n }\n }\n }\n ${componentIdFields}\n`;\nexport type Filters = {\n log?: { logType?: string; logOffset?: number; logLimit?: number; logHead?: string; logSort?: string };\n};\n/** provides data to component ui page, making sure both variables and return value are safely typed and memoized */\nexport function useComponentQuery(componentId: string, host: string, filters?: Filters) {\n const idRef = useRef(componentId);\n idRef.current = componentId;\n const { data, error, loading, subscribeToMore, ...rest } = useDataQuery(GET_COMPONENT, {\n variables: { id: componentId, extensionId: host, ...(filters?.log || {}) },\n });\n\n useEffect(() => {\n // @TODO @Kutner fix subscription for scope\n if (host !== 'teambit.workspace/workspace') {\n return () => {};\n }\n\n const unsubAddition = subscribeToMore({\n document: SUB_SUBSCRIPTION_ADDED,\n updateQuery: (prev, { subscriptionData }) => {\n const prevComponent = prev?.getHost?.get;\n const addedComponent = subscriptionData?.data?.componentAdded?.component;\n\n if (!addedComponent || prevComponent) return prev;\n\n if (idRef.current === addedComponent.id.name) {\n return {\n ...prev,\n getHost: {\n ...prev.getHost,\n get: addedComponent,\n },\n };\n }\n\n return prev;\n },\n });\n\n const unsubChanges = subscribeToMore({\n document: SUB_COMPONENT_CHANGED,\n updateQuery: (prev, { subscriptionData }) => {\n if (!subscriptionData.data) return prev;\n\n const prevComponent = prev?.getHost?.get;\n const updatedComponent = subscriptionData?.data?.componentChanged?.component;\n\n const isUpdated = updatedComponent && ComponentID.isEqualObj(prevComponent?.id, updatedComponent?.id);\n\n if (isUpdated) {\n return {\n ...prev,\n getHost: {\n ...prev.getHost,\n get: updatedComponent,\n },\n };\n }\n\n return prev;\n },\n });\n\n const unsubRemoval = subscribeToMore({\n document: SUB_COMPONENT_REMOVED,\n updateQuery: (prev, { subscriptionData }) => {\n if (!subscriptionData.data) return prev;\n\n const prevComponent = prev?.getHost?.get;\n const removedIds: ComponentIdObj[] | undefined = subscriptionData?.data?.componentRemoved?.componentIds;\n if (!prevComponent || !removedIds?.length) return prev;\n\n const isRemoved = removedIds.some((removedId) => ComponentID.isEqualObj(removedId, prevComponent.id));\n\n if (isRemoved) {\n return {\n ...prev,\n getHost: {\n ...prev.getHost,\n get: null,\n },\n };\n }\n\n return prev;\n },\n });\n\n return () => {\n unsubChanges();\n unsubAddition();\n unsubRemoval();\n };\n }, []);\n\n const rawComponent = data?.getHost?.get;\n return useMemo(() => {\n const aspectList = {\n entries: rawComponent?.aspects.map((aspectObject) => {\n return {\n ...aspectObject,\n aspectId: aspectObject.id,\n aspectData: aspectObject.data,\n };\n }),\n };\n const id = rawComponent && ComponentID.fromObject(rawComponent.id);\n return {\n componentDescriptor: id ? ComponentDescriptor.fromObject({ id: id.toString(), aspectList }) : undefined,\n component: rawComponent ? ComponentModel.from({ ...rawComponent, host }) : undefined,\n // eslint-disable-next-line\n error: error\n ? new ComponentError(500, error.message)\n : !rawComponent && !loading\n ? new ComponentError(404)\n : undefined,\n loading,\n ...rest,\n };\n }, [rawComponent, host, error]);\n}\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;AAAmD;AAAA;AAE5C,MAAMA,iBAAiB,GAAG,IAAAC,aAAG,CAAC;AACrC;AACA;AACA;AACA;AACA;AACA,CAAC;AAAC;AAEK,MAAMC,uBAAuB,GAAG,IAAAD,aAAG,CAAC;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAID,iBAAkB;AACtB,CAAC;AAAC;AAEK,MAAMG,eAAe,GAAG,IAAAF,aAAG,CAAC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAID,iBAAkB;AACtB,IAAIE,uBAAwB;AAC5B,CAAC;AAAC;AAEF,MAAME,aAAa,GAAG,IAAAH,aAAG,CAAC;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIE,eAAgB;AACpB,CAAC;AAED,MAAME,sBAAsB,GAAG,IAAAJ,aAAG,CAAC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIE,eAAgB;AACpB,CAAC;AAED,MAAMG,qBAAqB,GAAG,IAAAL,aAAG,CAAC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIE,eAAgB;AACpB,CAAC;AAED,MAAMI,qBAAqB,GAAG,IAAAN,aAAG,CAAC;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAID,iBAAkB;AACtB,CAAC;AAID;AACO,SAASQ,iBAAiB,CAACC,WAAmB,EAAEC,IAAY,EAAEC,OAAiB,EAAE;EAAA;EACtF,MAAMC,KAAK,GAAG,IAAAC,eAAM,EAACJ,WAAW,CAAC;EACjCG,KAAK,CAACE,OAAO,GAAGL,WAAW;EAC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AAS;MACb3C;IAAO,GACJE,IAAI;EAEX,CAAC,EAAE,CAAC4B,YAAY,EAAE1C,IAAI,EAAEW,KAAK,CAAC,CAAC;AACjC"}
|
package/dist/ui/use-component.js
CHANGED
|
@@ -4,30 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useComponent = useComponent;
|
|
7
|
-
|
|
8
7
|
function _uiFoundationUiReactRouter() {
|
|
9
8
|
const data = require("@teambit/ui-foundation.ui.react-router.use-query");
|
|
10
|
-
|
|
11
9
|
_uiFoundationUiReactRouter = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
function _useComponentQuery() {
|
|
19
15
|
const data = require("./use-component-query");
|
|
20
|
-
|
|
21
16
|
_useComponentQuery = function () {
|
|
22
17
|
return data;
|
|
23
18
|
};
|
|
24
|
-
|
|
25
19
|
return data;
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
function useComponent(host, id, options) {
|
|
29
22
|
var _ref;
|
|
30
|
-
|
|
31
23
|
const query = (0, _uiFoundationUiReactRouter().useQuery)();
|
|
32
24
|
const {
|
|
33
25
|
version,
|
|
@@ -37,12 +29,9 @@ function useComponent(host, id, options) {
|
|
|
37
29
|
const componentVersion = (_ref = version || query.get('version')) !== null && _ref !== void 0 ? _ref : undefined;
|
|
38
30
|
if (!id) throw new TypeError('useComponent received no component id');
|
|
39
31
|
const componentIdStr = withVersion(id, componentVersion);
|
|
40
|
-
|
|
41
32
|
const targetUseComponent = customUseComponent || _useComponentQuery().useComponentQuery;
|
|
42
|
-
|
|
43
33
|
return targetUseComponent(componentIdStr, host, logFilters);
|
|
44
34
|
}
|
|
45
|
-
|
|
46
35
|
function withVersion(id, version) {
|
|
47
36
|
if (!version) return id;
|
|
48
37
|
if (id.includes('@')) return id;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useComponent","host","id","options","query","useQuery","version","logFilters","customUseComponent","componentVersion","get","undefined","TypeError","componentIdStr","withVersion","targetUseComponent","useComponentQuery","includes"],"sources":["use-component.tsx"],"sourcesContent":["import { useQuery } from '@teambit/ui-foundation.ui.react-router.use-query';\nimport { ComponentDescriptor } from '@teambit/component-descriptor';\nimport { ComponentModel } from './component-model';\nimport { ComponentError } from './component-error';\nimport { Filters, useComponentQuery } from './use-component-query';\n\nexport type Component = {\n component?: ComponentModel;\n error?: ComponentError;\n componentDescriptor?: ComponentDescriptor;\n loading?: boolean;\n};\nexport type UseComponentOptions = {\n version?: string;\n logFilters?: Filters;\n customUseComponent?: UseComponentType;\n};\n\nexport type UseComponentType = (id: string, host: string, filters?: Filters) => Component;\n\nexport function useComponent(host: string, id?: string, options?: UseComponentOptions): Component {\n const query = useQuery();\n const { version, logFilters, customUseComponent } = options || {};\n const componentVersion = (version || query.get('version')) ?? undefined;\n\n if (!id) throw new TypeError('useComponent received no component id');\n\n const componentIdStr = withVersion(id, componentVersion);\n const targetUseComponent = customUseComponent || useComponentQuery;\n\n return targetUseComponent(componentIdStr, 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"],"mappings":"
|
|
1
|
+
{"version":3,"names":["useComponent","host","id","options","query","useQuery","version","logFilters","customUseComponent","componentVersion","get","undefined","TypeError","componentIdStr","withVersion","targetUseComponent","useComponentQuery","includes"],"sources":["use-component.tsx"],"sourcesContent":["import { useQuery } from '@teambit/ui-foundation.ui.react-router.use-query';\nimport { ComponentDescriptor } from '@teambit/component-descriptor';\nimport { ComponentModel } from './component-model';\nimport { ComponentError } from './component-error';\nimport { Filters, useComponentQuery } from './use-component-query';\n\nexport type Component = {\n component?: ComponentModel;\n error?: ComponentError;\n componentDescriptor?: ComponentDescriptor;\n loading?: boolean;\n};\nexport type UseComponentOptions = {\n version?: string;\n logFilters?: Filters;\n customUseComponent?: UseComponentType;\n};\n\nexport type UseComponentType = (id: string, host: string, filters?: Filters) => Component;\n\nexport function useComponent(host: string, id?: string, options?: UseComponentOptions): Component {\n const query = useQuery();\n const { version, logFilters, customUseComponent } = options || {};\n const componentVersion = (version || query.get('version')) ?? undefined;\n\n if (!id) throw new TypeError('useComponent received no component id');\n\n const componentIdStr = withVersion(id, componentVersion);\n const targetUseComponent = customUseComponent || useComponentQuery;\n\n return targetUseComponent(componentIdStr, 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"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAgBO,SAASA,YAAY,CAACC,IAAY,EAAEC,EAAW,EAAEC,OAA6B,EAAa;EAAA;EAChG,MAAMC,KAAK,GAAG,IAAAC,qCAAQ,GAAE;EACxB,MAAM;IAAEC,OAAO;IAAEC,UAAU;IAAEC;EAAmB,CAAC,GAAGL,OAAO,IAAI,CAAC,CAAC;EACjE,MAAMM,gBAAgB,WAAIH,OAAO,IAAIF,KAAK,CAACM,GAAG,CAAC,SAAS,CAAC,uCAAKC,SAAS;EAEvE,IAAI,CAACT,EAAE,EAAE,MAAM,IAAIU,SAAS,CAAC,uCAAuC,CAAC;EAErE,MAAMC,cAAc,GAAGC,WAAW,CAACZ,EAAE,EAAEO,gBAAgB,CAAC;EACxD,MAAMM,kBAAkB,GAAGP,kBAAkB,IAAIQ,sCAAiB;EAElE,OAAOD,kBAAkB,CAACF,cAAc,EAAEZ,IAAI,EAAEM,UAAU,CAAC;AAC7D;AAEA,SAASO,WAAW,CAACZ,EAAU,EAAEI,OAAgB,EAAE;EACjD,IAAI,CAACA,OAAO,EAAE,OAAOJ,EAAE;EACvB,IAAIA,EAAE,CAACe,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAOf,EAAE;EAC/B,OAAQ,GAAEA,EAAG,IAAGI,OAAQ,EAAC;AAC3B"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/component",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.883",
|
|
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.
|
|
9
|
+
"version": "0.0.883"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@teambit/any-fs": "0.0.5",
|
|
@@ -31,24 +31,24 @@
|
|
|
31
31
|
"@teambit/design.inputs.dropdown": "0.0.7",
|
|
32
32
|
"@teambit/component-id": "0.0.418",
|
|
33
33
|
"@teambit/ui-foundation.ui.menu-widget-icon": "0.0.494",
|
|
34
|
-
"@teambit/aspect-loader": "0.0.
|
|
34
|
+
"@teambit/aspect-loader": "0.0.883",
|
|
35
35
|
"@teambit/legacy-bit-id": "0.0.414",
|
|
36
36
|
"@teambit/toolbox.path.match-patterns": "0.0.7",
|
|
37
37
|
"@teambit/toolbox.string.capitalize": "0.0.489",
|
|
38
38
|
"@teambit/cli": "0.0.591",
|
|
39
39
|
"@teambit/express": "0.0.689",
|
|
40
|
-
"@teambit/graphql": "0.0.
|
|
40
|
+
"@teambit/graphql": "0.0.883",
|
|
41
41
|
"@teambit/bit-error": "0.0.400",
|
|
42
|
-
"@teambit/command-bar": "0.0.
|
|
42
|
+
"@teambit/command-bar": "0.0.883",
|
|
43
43
|
"@teambit/component.ui.deprecation-icon": "0.0.500",
|
|
44
|
-
"@teambit/preview": "0.0.
|
|
45
|
-
"@teambit/pubsub": "0.0.
|
|
46
|
-
"@teambit/react-router": "0.0.
|
|
44
|
+
"@teambit/preview": "0.0.883",
|
|
45
|
+
"@teambit/pubsub": "0.0.883",
|
|
46
|
+
"@teambit/react-router": "0.0.883",
|
|
47
47
|
"@teambit/ui-foundation.ui.is-browser": "0.0.492",
|
|
48
48
|
"@teambit/ui-foundation.ui.main-dropdown": "0.0.493",
|
|
49
49
|
"@teambit/ui-foundation.ui.react-router.slot-router": "0.0.496",
|
|
50
50
|
"@teambit/ui-foundation.ui.use-box.menu": "0.0.122",
|
|
51
|
-
"@teambit/ui": "0.0.
|
|
51
|
+
"@teambit/ui": "0.0.883",
|
|
52
52
|
"@teambit/component-issues": "0.0.73",
|
|
53
53
|
"@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.496",
|
|
54
54
|
"@teambit/cli-table": "0.0.40",
|
|
@@ -58,9 +58,9 @@
|
|
|
58
58
|
"@teambit/harmony.ui.aspect-box": "0.0.493",
|
|
59
59
|
"@teambit/design.ui.pages.not-found": "0.0.363",
|
|
60
60
|
"@teambit/design.ui.pages.server-error": "0.0.363",
|
|
61
|
-
"@teambit/compositions": "0.0.
|
|
62
|
-
"@teambit/deprecation": "0.0.
|
|
63
|
-
"@teambit/envs": "0.0.
|
|
61
|
+
"@teambit/compositions": "0.0.883",
|
|
62
|
+
"@teambit/deprecation": "0.0.883",
|
|
63
|
+
"@teambit/envs": "0.0.883",
|
|
64
64
|
"@teambit/legacy-component-log": "0.0.398",
|
|
65
65
|
"@teambit/design.ui.styles.ellipsis": "0.0.353",
|
|
66
66
|
"@teambit/envs.ui.env-icon": "0.0.492",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.883/dist/component.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.component_component@0.0.883/dist/component.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
Binary file
|