@teambit/component 1.0.107 → 1.0.109
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/artifacts/preview/static/css/teambit.component/component-preview.8360f74e.css +55 -0
- package/artifacts/preview/static/images/348e1dfebd0d5a35a5e6.png +0 -0
- package/artifacts/preview/static/images/37978a86e2f81f41863e.png +0 -0
- package/artifacts/preview/teambit_component_component-preview.js +2 -0
- package/dist/aspect-entry.d.ts +4 -4
- package/dist/aspect-entry.js +1 -2
- package/dist/aspect-entry.js.map +1 -1
- package/dist/aspect-list.js +2 -2
- package/dist/aspect-list.js.map +1 -1
- package/dist/aspect.section.d.ts +3 -3
- package/dist/component-factory.d.ts +3 -3
- package/dist/component-interface.d.ts +1 -1
- package/dist/component-map/component-map.d.ts +2 -2
- package/dist/component.composition.d.ts +2 -2
- package/dist/component.d.ts +3 -3
- package/dist/component.graphql.d.ts +13 -13
- package/dist/component.graphql.js +3 -6
- package/dist/component.graphql.js.map +1 -1
- package/dist/component.js +5 -9
- package/dist/component.js.map +1 -1
- package/dist/component.main.runtime.d.ts +2 -2
- package/dist/component.route.d.ts +2 -2
- package/dist/component.ui.runtime.d.ts +7 -7
- package/dist/component.ui.runtime.js +12 -27
- package/dist/component.ui.runtime.js.map +1 -1
- package/dist/get-component-opts.d.ts +1 -1
- package/dist/hash.d.ts +1 -1
- package/dist/{preview-1703590665075.js → preview-1703698405864.js} +2 -2
- package/dist/snap/author.d.ts +1 -1
- package/dist/snap/snap.d.ts +1 -1
- package/dist/tag/tag.d.ts +1 -1
- package/dist/tag-map.d.ts +1 -1
- package/dist/ui/aspect-page/aspect-page.d.ts +2 -2
- package/dist/ui/aspect-page/aspect-page.js +1 -2
- package/dist/ui/aspect-page/aspect-page.js.map +1 -1
- package/dist/ui/component-error/component-error.d.ts +4 -4
- package/dist/ui/component-model/component-model.d.ts +21 -21
- package/dist/ui/component-model/component-model.js +1 -1
- package/dist/ui/component-model/component-model.js.map +1 -1
- package/dist/ui/component-searcher/component-result.d.ts +4 -4
- package/dist/ui/component-searcher/component-result.js +2 -2
- package/dist/ui/component-searcher/component-result.js.map +1 -1
- package/dist/ui/component-searcher/component-searcher.d.ts +2 -2
- package/dist/ui/component.d.ts +5 -5
- package/dist/ui/component.js +6 -6
- package/dist/ui/component.js.map +1 -1
- package/dist/ui/context/component-context.d.ts +1 -1
- package/dist/ui/context/component-provider.d.ts +5 -5
- package/dist/ui/menu/menu-nav.d.ts +2 -2
- package/dist/ui/menu/menu-nav.js +5 -5
- package/dist/ui/menu/menu-nav.js.map +1 -1
- package/dist/ui/menu/menu.d.ts +9 -9
- package/dist/ui/menu/menu.js +28 -31
- package/dist/ui/menu/menu.js.map +1 -1
- package/dist/ui/menu/nav-plugin.d.ts +7 -7
- package/dist/ui/top-bar-nav/top-bar-nav.d.ts +2 -2
- package/dist/ui/use-component-from-location.js +1 -1
- package/dist/ui/use-component-from-location.js.map +1 -1
- package/dist/ui/use-component-logs.d.ts +7 -7
- package/dist/ui/use-component-logs.js +5 -6
- package/dist/ui/use-component-logs.js.map +1 -1
- package/dist/ui/use-component-query.js +13 -17
- package/dist/ui/use-component-query.js.map +1 -1
- package/dist/ui/use-component.model.d.ts +7 -7
- package/package.json +33 -40
- package/tsconfig.json +16 -21
- package/types/asset.d.ts +15 -3
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { ComponentLogsResult, Filters } from './use-component.model';
|
|
2
2
|
export declare function useComponentLogs(componentId: string, host: string, filters?: Filters, skipFromProps?: boolean): ComponentLogsResult;
|
|
3
3
|
export declare function useComponentLogsInit(componentId: string, host: string, filters?: Filters, skip?: boolean): {
|
|
4
|
-
logOffset: number
|
|
4
|
+
logOffset: number;
|
|
5
5
|
variables: {
|
|
6
6
|
id: string;
|
|
7
7
|
extensionId: string;
|
|
8
8
|
logOffset: any;
|
|
9
|
-
logLimit: number
|
|
10
|
-
logType: string
|
|
11
|
-
logHead: string
|
|
12
|
-
logSort: string
|
|
13
|
-
logTakeHeadFromComponent: boolean
|
|
9
|
+
logLimit: number;
|
|
10
|
+
logType: string;
|
|
11
|
+
logHead: string;
|
|
12
|
+
logSort: string;
|
|
13
|
+
logTakeHeadFromComponent: boolean;
|
|
14
14
|
};
|
|
15
|
-
skip: boolean
|
|
15
|
+
skip: boolean;
|
|
16
16
|
};
|
|
@@ -48,7 +48,6 @@ function _() {
|
|
|
48
48
|
return data;
|
|
49
49
|
}
|
|
50
50
|
function useComponentLogs(componentId, host, filters, skipFromProps) {
|
|
51
|
-
var _data$getHost, _rawComponent$id, _rawComponent$id2, _rawComponent$id3;
|
|
52
51
|
const {
|
|
53
52
|
variables,
|
|
54
53
|
skip
|
|
@@ -62,16 +61,16 @@ function useComponentLogs(componentId, host, filters, skipFromProps) {
|
|
|
62
61
|
skip,
|
|
63
62
|
errorPolicy: 'all'
|
|
64
63
|
});
|
|
65
|
-
const rawComponent = data
|
|
66
|
-
const rawCompLogs = rawComponent
|
|
64
|
+
const rawComponent = data?.getHost?.get;
|
|
65
|
+
const rawCompLogs = rawComponent?.logs;
|
|
67
66
|
const componentError = error && !data ? new (_componentError().ComponentError)(500, error.message) : !rawComponent && !loading && new (_componentError().ComponentError)(404) || undefined;
|
|
68
|
-
const idDepKey = rawComponent
|
|
67
|
+
const idDepKey = rawComponent?.id ? `${rawComponent?.id?.scope}/${rawComponent?.id?.name}@${rawComponent?.id?.version}}` : undefined;
|
|
69
68
|
const id = (0, _react().useMemo)(() => rawComponent ? _().ComponentID.fromObject(rawComponent.id) : undefined, [idDepKey]);
|
|
70
69
|
return {
|
|
71
70
|
loading,
|
|
72
71
|
id,
|
|
73
|
-
packageName: rawComponent
|
|
74
|
-
latest: rawComponent
|
|
72
|
+
packageName: rawComponent?.packageName,
|
|
73
|
+
latest: rawComponent?.latest,
|
|
75
74
|
error: componentError,
|
|
76
75
|
componentLogs: {
|
|
77
76
|
logs: rawCompLogs,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","data","require","_uiFoundationUiHooks","_useComponent","_componentError","_useComponent2","_","useComponentLogs","componentId","host","filters","skipFromProps","
|
|
1
|
+
{"version":3,"names":["_react","data","require","_uiFoundationUiHooks","_useComponent","_componentError","_useComponent2","_","useComponentLogs","componentId","host","filters","skipFromProps","variables","skip","useComponentLogsInit","error","loading","useDataQuery","GET_COMPONENT_WITH_LOGS","errorPolicy","rawComponent","getHost","get","rawCompLogs","logs","componentError","ComponentError","message","undefined","idDepKey","id","scope","name","version","useMemo","ComponentID","fromObject","packageName","latest","componentLogs","log","head","logHead","offset","logOffset","sort","logSort","limit","logLimit","type","logType","takeHeadFromComponent","logTakeHeadFromComponent","extensionId","getOffsetValue"],"sources":["use-component-logs.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { LegacyComponentLog } from '@teambit/legacy-component-log';\nimport { useDataQuery } from '@teambit/ui-foundation.ui.hooks.use-data-query';\nimport { ComponentLogsResult, Filters } from './use-component.model';\nimport { GET_COMPONENT_WITH_LOGS } from './use-component.fragments';\nimport { ComponentError } from './component-error';\nimport { getOffsetValue } from './use-component.utils';\nimport { ComponentID } from '..';\n\nexport function useComponentLogs(\n componentId: string,\n host: string,\n filters?: Filters,\n skipFromProps?: boolean\n): ComponentLogsResult {\n const { variables, skip } = useComponentLogsInit(componentId, host, filters, skipFromProps);\n\n const { data, error, loading } = useDataQuery(GET_COMPONENT_WITH_LOGS, {\n variables,\n skip,\n errorPolicy: 'all',\n });\n\n const rawComponent = data?.getHost?.get;\n const rawCompLogs: Array<LegacyComponentLog> = rawComponent?.logs;\n\n const componentError =\n error && !data\n ? new ComponentError(500, error.message)\n : (!rawComponent && !loading && new ComponentError(404)) || undefined;\n\n const idDepKey = rawComponent?.id\n ? `${rawComponent?.id?.scope}/${rawComponent?.id?.name}@${rawComponent?.id?.version}}`\n : undefined;\n\n const id: ComponentID | undefined = useMemo(\n () => (rawComponent ? ComponentID.fromObject(rawComponent.id) : undefined),\n [idDepKey]\n );\n\n return {\n loading,\n id,\n packageName: rawComponent?.packageName,\n latest: rawComponent?.latest,\n error: componentError,\n componentLogs: {\n logs: rawCompLogs,\n loading,\n },\n };\n}\n\nexport function useComponentLogsInit(componentId: string, host: string, filters?: Filters, skip?: boolean) {\n const { log } = filters || {};\n const {\n head: logHead,\n offset: logOffset,\n sort: logSort,\n limit: logLimit,\n type: logType,\n takeHeadFromComponent: logTakeHeadFromComponent,\n } = log || {};\n const variables = {\n id: componentId,\n extensionId: host,\n logOffset: getOffsetValue(logOffset, logLimit),\n logLimit,\n logType,\n logHead,\n logSort,\n logTakeHeadFromComponent,\n };\n return {\n logOffset,\n variables,\n skip,\n };\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,qBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,oBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,cAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,aAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,gBAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,eAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,eAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,cAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,EAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,CAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,SAASO,gBAAgBA,CAC9BC,WAA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BA,CAACN,WAAmB,EAAEC,IAAY,EAAEC,OAAiB,EAAEG,IAAc,EAAE;EACzG,MAAM;IAAE2B;EAAI,CAAC,GAAG9B,OAAO,IAAI,CAAC,CAAC;EAC7B,MAAM;IACJ+B,IAAI,EAAEC,OAAO;IACbC,MAAM,EAAEC,SAAS;IACjBC,IAAI,EAAEC,OAAO;IACbC,KAAK,EAAEC,QAAQ;IACfC,IAAI,EAAEC,OAAO;IACbC,qBAAqB,EAAEC;EACzB,CAAC,GAAGZ,GAAG,IAAI,CAAC,CAAC;EACb,MAAM5B,SAAS,GAAG;IAChBkB,EAAE,EAAEtB,WAAW;IACf6C,WAAW,EAAE5C,IAAI;IACjBmC,SAAS,EAAE,IAAAU,+BAAc,EAACV,SAAS,EAAEI,QAAQ,CAAC;IAC9CA,QAAQ;IACRE,OAAO;IACPR,OAAO;IACPI,OAAO;IACPM;EACF,CAAC;EACD,OAAO;IACLR,SAAS;IACThC,SAAS;IACTC;EACF,CAAC;AACH"}
|
|
@@ -67,7 +67,6 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
67
67
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
68
68
|
/** provides data to component ui page, making sure both variables and return value are safely typed and memoized */
|
|
69
69
|
function useComponentQuery(componentId, host, filters, skip) {
|
|
70
|
-
var _data$getHost, _rawComponent$id, _rawComponent$id2, _rawComponent$id3;
|
|
71
70
|
const idRef = (0, _react().useRef)(componentId);
|
|
72
71
|
idRef.current = componentId;
|
|
73
72
|
const variables = {
|
|
@@ -90,7 +89,7 @@ function useComponentQuery(componentId, host, filters, skip) {
|
|
|
90
89
|
logs
|
|
91
90
|
} = {}
|
|
92
91
|
} = (0, _useComponentLogs().useComponentLogs)(componentId, host, filters, skip);
|
|
93
|
-
const rawComponent = data
|
|
92
|
+
const rawComponent = data?.getHost?.get;
|
|
94
93
|
(0, _react().useEffect)(() => {
|
|
95
94
|
// @TODO @Kutner fix subscription for scope
|
|
96
95
|
if (host !== 'teambit.workspace/workspace') {
|
|
@@ -101,9 +100,8 @@ function useComponentQuery(componentId, host, filters, skip) {
|
|
|
101
100
|
updateQuery: (prev, {
|
|
102
101
|
subscriptionData
|
|
103
102
|
}) => {
|
|
104
|
-
|
|
105
|
-
const
|
|
106
|
-
const addedComponent = subscriptionData === null || subscriptionData === void 0 || (_subscriptionData$dat = subscriptionData.data) === null || _subscriptionData$dat === void 0 || (_subscriptionData$dat = _subscriptionData$dat.componentAdded) === null || _subscriptionData$dat === void 0 ? void 0 : _subscriptionData$dat.component;
|
|
103
|
+
const prevComponent = prev?.getHost?.get;
|
|
104
|
+
const addedComponent = subscriptionData?.data?.componentAdded?.component;
|
|
107
105
|
if (!addedComponent || prevComponent) return prev;
|
|
108
106
|
if (idRef.current === addedComponent.id.name) {
|
|
109
107
|
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
@@ -120,11 +118,10 @@ function useComponentQuery(componentId, host, filters, skip) {
|
|
|
120
118
|
updateQuery: (prev, {
|
|
121
119
|
subscriptionData
|
|
122
120
|
}) => {
|
|
123
|
-
var _prev$getHost2, _subscriptionData$dat2;
|
|
124
121
|
if (!subscriptionData.data) return prev;
|
|
125
|
-
const prevComponent = prev
|
|
126
|
-
const updatedComponent = subscriptionData
|
|
127
|
-
const isUpdated = updatedComponent && _componentId().ComponentID.isEqualObj(prevComponent
|
|
122
|
+
const prevComponent = prev?.getHost?.get;
|
|
123
|
+
const updatedComponent = subscriptionData?.data?.componentChanged?.component;
|
|
124
|
+
const isUpdated = updatedComponent && _componentId().ComponentID.isEqualObj(prevComponent?.id, updatedComponent?.id);
|
|
128
125
|
if (isUpdated) {
|
|
129
126
|
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
130
127
|
getHost: _objectSpread(_objectSpread({}, prev.getHost), {}, {
|
|
@@ -140,11 +137,10 @@ function useComponentQuery(componentId, host, filters, skip) {
|
|
|
140
137
|
updateQuery: (prev, {
|
|
141
138
|
subscriptionData
|
|
142
139
|
}) => {
|
|
143
|
-
var _prev$getHost3, _subscriptionData$dat3;
|
|
144
140
|
if (!subscriptionData.data) return prev;
|
|
145
|
-
const prevComponent = prev
|
|
146
|
-
const removedIds = subscriptionData
|
|
147
|
-
if (!prevComponent || !
|
|
141
|
+
const prevComponent = prev?.getHost?.get;
|
|
142
|
+
const removedIds = subscriptionData?.data?.componentRemoved?.componentIds;
|
|
143
|
+
if (!prevComponent || !removedIds?.length) return prev;
|
|
148
144
|
const isRemoved = removedIds.some(removedId => _componentId().ComponentID.isEqualObj(removedId, prevComponent.id));
|
|
149
145
|
if (isRemoved) {
|
|
150
146
|
return _objectSpread(_objectSpread({}, prev), {}, {
|
|
@@ -162,16 +158,16 @@ function useComponentQuery(componentId, host, filters, skip) {
|
|
|
162
158
|
unsubRemoval();
|
|
163
159
|
};
|
|
164
160
|
}, []);
|
|
165
|
-
const idDepKey = rawComponent
|
|
161
|
+
const idDepKey = rawComponent?.id ? `${rawComponent?.id?.scope}/${rawComponent?.id?.name}@${rawComponent?.id?.version}}` : undefined;
|
|
166
162
|
const id = (0, _react().useMemo)(() => rawComponent ? _componentId().ComponentID.fromObject(rawComponent.id) : undefined, [idDepKey]);
|
|
167
163
|
const componentError = error && !data ? new (_componentError().ComponentError)(500, error.message) : !rawComponent && !loading && new (_componentError().ComponentError)(404) || undefined;
|
|
168
164
|
const component = (0, _react().useMemo)(() => rawComponent ? _componentModel().ComponentModel.from(_objectSpread(_objectSpread({}, rawComponent), {}, {
|
|
169
165
|
host,
|
|
170
166
|
logs
|
|
171
|
-
})) : undefined, [id
|
|
167
|
+
})) : undefined, [id?.toString(), logs]);
|
|
172
168
|
const componentDescriptor = (0, _react().useMemo)(() => {
|
|
173
169
|
const aspectList = {
|
|
174
|
-
entries: rawComponent
|
|
170
|
+
entries: rawComponent?.aspects.map(aspectObject => {
|
|
175
171
|
return _objectSpread(_objectSpread({}, aspectObject), {}, {
|
|
176
172
|
aspectId: aspectObject.id,
|
|
177
173
|
aspectData: aspectObject.data
|
|
@@ -182,7 +178,7 @@ function useComponentQuery(componentId, host, filters, skip) {
|
|
|
182
178
|
id: id.toString(),
|
|
183
179
|
aspectList
|
|
184
180
|
}) : undefined;
|
|
185
|
-
}, [id
|
|
181
|
+
}, [id?.toString()]);
|
|
186
182
|
return (0, _react().useMemo)(() => {
|
|
187
183
|
return {
|
|
188
184
|
componentDescriptor,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","data","require","_uiFoundationUiHooks","_componentId","_componentDescriptor","_componentModel","_useComponent","_useComponentLogs","_componentError","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","obj","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","String","Symbol","toPrimitive","call","TypeError","Number","useComponentQuery","componentId","host","filters","skip","_data$getHost","_rawComponent$id","_rawComponent$id2","_rawComponent$id3","idRef","useRef","current","variables","id","extensionId","error","loading","subscribeToMore","useDataQuery","GET_COMPONENT","errorPolicy","loadingLogs","componentLogs","logs","useComponentLogs","rawComponent","getHost","get","useEffect","unsubAddition","document","SUB_SUBSCRIPTION_ADDED","updateQuery","prev","subscriptionData","_prev$getHost","_subscriptionData$dat","prevComponent","addedComponent","componentAdded","component","name","unsubChanges","SUB_COMPONENT_CHANGED","_prev$getHost2","_subscriptionData$dat2","updatedComponent","componentChanged","isUpdated","ComponentID","isEqualObj","unsubRemoval","SUB_COMPONENT_REMOVED","_prev$getHost3","_subscriptionData$dat3","removedIds","componentRemoved","componentIds","isRemoved","some","removedId","idDepKey","scope","version","undefined","useMemo","fromObject","componentError","ComponentError","message","ComponentModel","from","toString","componentDescriptor","aspectList","entries","aspects","map","aspectObject","aspectId","aspectData","ComponentDescriptor"],"sources":["use-component-query.ts"],"sourcesContent":["import { useMemo, useEffect, useRef } from 'react';\nimport { useDataQuery } from '@teambit/ui-foundation.ui.hooks.use-data-query';\nimport { ComponentID, ComponentIdObj } from '@teambit/component-id';\nimport { ComponentDescriptor } from '@teambit/component-descriptor';\nimport { ComponentModel } from './component-model';\nimport { ComponentQueryResult, Filters } from './use-component.model';\nimport {\n GET_COMPONENT,\n SUB_COMPONENT_CHANGED,\n SUB_COMPONENT_REMOVED,\n SUB_SUBSCRIPTION_ADDED,\n} from './use-component.fragments';\nimport { useComponentLogs } from './use-component-logs';\nimport { ComponentError } from './component-error';\n\n/** provides data to component ui page, making sure both variables and return value are safely typed and memoized */\nexport function useComponentQuery(\n componentId: string,\n host: string,\n filters?: Filters,\n skip?: boolean\n): ComponentQueryResult {\n const idRef = useRef(componentId);\n idRef.current = componentId;\n const variables = {\n id: componentId,\n extensionId: host,\n };\n\n const { data, error, loading, subscribeToMore } = useDataQuery(GET_COMPONENT, {\n variables,\n skip,\n errorPolicy: 'all',\n });\n\n const { loading: loadingLogs, componentLogs: { logs } = {} } = useComponentLogs(componentId, host, filters, skip);\n\n const rawComponent = data?.getHost?.get;\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 idDepKey = rawComponent?.id\n ? `${rawComponent?.id?.scope}/${rawComponent?.id?.name}@${rawComponent?.id?.version}}`\n : undefined;\n\n const id: ComponentID | undefined = useMemo(\n () => (rawComponent ? ComponentID.fromObject(rawComponent.id) : undefined),\n [idDepKey]\n );\n\n const componentError =\n error && !data\n ? new ComponentError(500, error.message)\n : (!rawComponent && !loading && new ComponentError(404)) || undefined;\n\n const component = useMemo(\n () => (rawComponent ? ComponentModel.from({ ...rawComponent, host, logs }) : undefined),\n [id?.toString(), logs]\n );\n\n const componentDescriptor = 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\n return id ? ComponentDescriptor.fromObject({ id: id.toString(), aspectList }) : undefined;\n }, [id?.toString()]);\n\n return useMemo(() => {\n return {\n componentDescriptor,\n component,\n componentLogs: {\n loading: loadingLogs,\n logs,\n },\n error: componentError || undefined,\n loading,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AAC;MACDR,KAAK,EAAEoD,cAAc,IAAIH,SAAS;MAClChD;IACF,CAAC;EACH,CAAC,EAAE,CAACd,IAAI,EAAEsC,SAAS,EAAEiC,mBAAmB,EAAEN,cAAc,CAAC,CAAC;AAC5D"}
|
|
1
|
+
{"version":3,"names":["_react","data","require","_uiFoundationUiHooks","_componentId","_componentDescriptor","_componentModel","_useComponent","_useComponentLogs","_componentError","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","obj","key","value","_toPropertyKey","configurable","writable","i","_toPrimitive","String","Symbol","toPrimitive","call","TypeError","Number","useComponentQuery","componentId","host","filters","skip","idRef","useRef","current","variables","id","extensionId","error","loading","subscribeToMore","useDataQuery","GET_COMPONENT","errorPolicy","loadingLogs","componentLogs","logs","useComponentLogs","rawComponent","getHost","get","useEffect","unsubAddition","document","SUB_SUBSCRIPTION_ADDED","updateQuery","prev","subscriptionData","prevComponent","addedComponent","componentAdded","component","name","unsubChanges","SUB_COMPONENT_CHANGED","updatedComponent","componentChanged","isUpdated","ComponentID","isEqualObj","unsubRemoval","SUB_COMPONENT_REMOVED","removedIds","componentRemoved","componentIds","isRemoved","some","removedId","idDepKey","scope","version","undefined","useMemo","fromObject","componentError","ComponentError","message","ComponentModel","from","toString","componentDescriptor","aspectList","entries","aspects","map","aspectObject","aspectId","aspectData","ComponentDescriptor"],"sources":["use-component-query.ts"],"sourcesContent":["import { useMemo, useEffect, useRef } from 'react';\nimport { useDataQuery } from '@teambit/ui-foundation.ui.hooks.use-data-query';\nimport { ComponentID, ComponentIdObj } from '@teambit/component-id';\nimport { ComponentDescriptor } from '@teambit/component-descriptor';\nimport { ComponentModel } from './component-model';\nimport { ComponentQueryResult, Filters } from './use-component.model';\nimport {\n GET_COMPONENT,\n SUB_COMPONENT_CHANGED,\n SUB_COMPONENT_REMOVED,\n SUB_SUBSCRIPTION_ADDED,\n} from './use-component.fragments';\nimport { useComponentLogs } from './use-component-logs';\nimport { ComponentError } from './component-error';\n\n/** provides data to component ui page, making sure both variables and return value are safely typed and memoized */\nexport function useComponentQuery(\n componentId: string,\n host: string,\n filters?: Filters,\n skip?: boolean\n): ComponentQueryResult {\n const idRef = useRef(componentId);\n idRef.current = componentId;\n const variables = {\n id: componentId,\n extensionId: host,\n };\n\n const { data, error, loading, subscribeToMore } = useDataQuery(GET_COMPONENT, {\n variables,\n skip,\n errorPolicy: 'all',\n });\n\n const { loading: loadingLogs, componentLogs: { logs } = {} } = useComponentLogs(componentId, host, filters, skip);\n\n const rawComponent = data?.getHost?.get;\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 idDepKey = rawComponent?.id\n ? `${rawComponent?.id?.scope}/${rawComponent?.id?.name}@${rawComponent?.id?.version}}`\n : undefined;\n\n const id: ComponentID | undefined = useMemo(\n () => (rawComponent ? ComponentID.fromObject(rawComponent.id) : undefined),\n [idDepKey]\n );\n\n const componentError =\n error && !data\n ? new ComponentError(500, error.message)\n : (!rawComponent && !loading && new ComponentError(404)) || undefined;\n\n const component = useMemo(\n () => (rawComponent ? ComponentModel.from({ ...rawComponent, host, logs }) : undefined),\n [id?.toString(), logs]\n );\n\n const componentDescriptor = 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\n return id ? ComponentDescriptor.fromObject({ id: id.toString(), aspectList }) : undefined;\n }, [id?.toString()]);\n\n return useMemo(() => {\n return {\n componentDescriptor,\n component,\n componentLogs: {\n loading: loadingLogs,\n logs,\n },\n error: componentError || undefined,\n loading,\n };\n }, [host, component, componentDescriptor, componentError]);\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,qBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,oBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,aAAA;EAAA,MAAAH,IAAA,GAA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AAA,CAAAA,aAAA,KAAM2C,YAAY;IAAEnB,IAAI;IAAEiB;EAAI,EAAE,CAAC,GAAGmC,SAAU,EACvF,CAAC7C,EAAE,EAAEqD,QAAQ,CAAC,CAAC,EAAE3C,IAAI,CACvB,CAAC;EAED,MAAM4C,mBAAmB,GAAG,IAAAR,gBAAO,EAAC,MAAM;IACxC,MAAMS,UAAU,GAAG;MACjBC,OAAO,EAAE5C,YAAY,EAAE6C,OAAO,CAACC,GAAG,CAAEC,YAAY,IAAK;QACnD,OAAA1F,aAAA,CAAAA,aAAA,KACK0F,YAAY;UACfC,QAAQ,EAAED,YAAY,CAAC3D,EAAE;UACzB6D,UAAU,EAAEF,YAAY,CAAChH;QAAI;MAEjC,CAAC;IACH,CAAC;IAED,OAAOqD,EAAE,GAAG8D,0CAAmB,CAACf,UAAU,CAAC;MAAE/C,EAAE,EAAEA,EAAE,CAACqD,QAAQ,CAAC,CAAC;MAAEE;IAAW,CAAC,CAAC,GAAGV,SAAS;EAC3F,CAAC,EAAE,CAAC7C,EAAE,EAAEqD,QAAQ,CAAC,CAAC,CAAC,CAAC;EAEpB,OAAO,IAAAP,gBAAO,EAAC,MAAM;IACnB,OAAO;MACLQ,mBAAmB;MACnB7B,SAAS;MACThB,aAAa,EAAE;QACbN,OAAO,EAAEK,WAAW;QACpBE;MACF,CAAC;MACDR,KAAK,EAAE8C,cAAc,IAAIH,SAAS;MAClC1C;IACF,CAAC;EACH,CAAC,EAAE,CAACV,IAAI,EAAEgC,SAAS,EAAE6B,mBAAmB,EAAEN,cAAc,CAAC,CAAC;AAC5D"}
|
|
@@ -3,33 +3,33 @@ import { LegacyComponentLog } from '@teambit/legacy-component-log';
|
|
|
3
3
|
import { ComponentID } from '../';
|
|
4
4
|
import { ComponentError } from './component-error';
|
|
5
5
|
import { ComponentModel } from './component-model';
|
|
6
|
-
export
|
|
6
|
+
export type LogFilter = {
|
|
7
7
|
offset?: number;
|
|
8
8
|
limit?: number;
|
|
9
9
|
head?: string;
|
|
10
10
|
sort?: string;
|
|
11
11
|
takeHeadFromComponent?: boolean;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type Filters = {
|
|
14
14
|
log?: LogFilter & {
|
|
15
15
|
type?: string;
|
|
16
16
|
};
|
|
17
17
|
loading?: boolean;
|
|
18
18
|
};
|
|
19
|
-
export
|
|
19
|
+
export type UseComponentOptions = {
|
|
20
20
|
version?: string;
|
|
21
21
|
logFilters?: Filters;
|
|
22
22
|
customUseComponent?: UseComponentType;
|
|
23
23
|
skip?: boolean;
|
|
24
24
|
};
|
|
25
|
-
export
|
|
25
|
+
export type ComponentQueryResult = {
|
|
26
26
|
component?: ComponentModel;
|
|
27
27
|
componentDescriptor?: ComponentDescriptor;
|
|
28
28
|
componentLogs?: ComponentLogs;
|
|
29
29
|
loading?: boolean;
|
|
30
30
|
error?: ComponentError;
|
|
31
31
|
};
|
|
32
|
-
export
|
|
32
|
+
export type ComponentLogsResult = {
|
|
33
33
|
id?: ComponentID;
|
|
34
34
|
componentLogs?: ComponentLogs;
|
|
35
35
|
latest?: string;
|
|
@@ -37,8 +37,8 @@ export declare type ComponentLogsResult = {
|
|
|
37
37
|
error?: ComponentError;
|
|
38
38
|
loading?: boolean;
|
|
39
39
|
};
|
|
40
|
-
export
|
|
40
|
+
export type ComponentLogs = {
|
|
41
41
|
logs?: LegacyComponentLog[];
|
|
42
42
|
loading?: boolean;
|
|
43
43
|
};
|
|
44
|
-
export
|
|
44
|
+
export type UseComponentType = (id: string, host: string, filters?: Filters, skip?: boolean) => ComponentQueryResult;
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/component",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.109",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/component/component",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.component",
|
|
8
8
|
"name": "component",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.109"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@teambit/any-fs": "0.0.5",
|
|
@@ -19,8 +19,6 @@
|
|
|
19
19
|
"lodash.flatten": "4.4.0",
|
|
20
20
|
"classnames": "2.2.6",
|
|
21
21
|
"lodash.compact": "3.0.1",
|
|
22
|
-
"core-js": "^3.0.0",
|
|
23
|
-
"@babel/runtime": "7.20.0",
|
|
24
22
|
"@teambit/component-id": "1.2.0",
|
|
25
23
|
"@teambit/ui-foundation.ui.menu-widget-icon": "0.0.502",
|
|
26
24
|
"@teambit/graph.cleargraph": "0.0.1",
|
|
@@ -35,61 +33,59 @@
|
|
|
35
33
|
"@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.505",
|
|
36
34
|
"@teambit/legacy-component-log": "0.0.402",
|
|
37
35
|
"@teambit/ui-foundation.ui.react-router.use-query": "0.0.501",
|
|
38
|
-
"@teambit/design.ui.pages.not-found": "0.0.366",
|
|
39
|
-
"@teambit/design.ui.pages.server-error": "0.0.366",
|
|
40
36
|
"@teambit/design.ui.empty-box": "0.0.363",
|
|
41
37
|
"@teambit/documenter.ui.heading": "4.1.1",
|
|
42
38
|
"@teambit/documenter.ui.separator": "4.1.1",
|
|
43
39
|
"@teambit/design.ui.styles.ellipsis": "0.0.357",
|
|
44
40
|
"@teambit/explorer.ui.command-bar": "2.0.14",
|
|
41
|
+
"@teambit/design.ui.pages.not-found": "0.0.366",
|
|
42
|
+
"@teambit/design.ui.pages.server-error": "0.0.366",
|
|
45
43
|
"@teambit/design.navigation.responsive-navbar": "0.0.7",
|
|
46
44
|
"@teambit/base-ui.layout.breakpoints": "1.0.0",
|
|
47
45
|
"@teambit/component.ui.version-dropdown": "0.0.852",
|
|
48
46
|
"@teambit/lanes.hooks.use-lanes": "0.0.254",
|
|
49
47
|
"@teambit/lanes.ui.models.lanes-model": "0.0.207",
|
|
50
48
|
"@teambit/ui-foundation.ui.use-box.dropdown": "0.0.141",
|
|
51
|
-
"@teambit/aspect-loader": "1.0.
|
|
52
|
-
"@teambit/graph": "1.0.
|
|
49
|
+
"@teambit/aspect-loader": "1.0.109",
|
|
50
|
+
"@teambit/graph": "1.0.109",
|
|
53
51
|
"@teambit/toolbox.path.match-patterns": "0.0.13",
|
|
54
52
|
"@teambit/toolbox.string.capitalize": "0.0.494",
|
|
55
|
-
"@teambit/cli": "0.0.
|
|
56
|
-
"@teambit/express": "0.0.
|
|
57
|
-
"@teambit/graphql": "1.0.
|
|
58
|
-
"@teambit/command-bar": "1.0.
|
|
59
|
-
"@teambit/component-package-version": "0.0.
|
|
60
|
-
"@teambit/preview": "1.0.
|
|
61
|
-
"@teambit/pubsub": "1.0.
|
|
62
|
-
"@teambit/react-router": "1.0.
|
|
63
|
-
"@teambit/ui": "1.0.
|
|
64
|
-
"@teambit/component-issues": "0.0.
|
|
65
|
-
"@teambit/cli-table": "0.0.
|
|
66
|
-
"@teambit/component-descriptor": "0.0.
|
|
53
|
+
"@teambit/cli": "0.0.841",
|
|
54
|
+
"@teambit/express": "0.0.940",
|
|
55
|
+
"@teambit/graphql": "1.0.109",
|
|
56
|
+
"@teambit/command-bar": "1.0.109",
|
|
57
|
+
"@teambit/component-package-version": "0.0.431",
|
|
58
|
+
"@teambit/preview": "1.0.109",
|
|
59
|
+
"@teambit/pubsub": "1.0.109",
|
|
60
|
+
"@teambit/react-router": "1.0.109",
|
|
61
|
+
"@teambit/ui": "1.0.109",
|
|
62
|
+
"@teambit/component-issues": "0.0.138",
|
|
63
|
+
"@teambit/cli-table": "0.0.46",
|
|
64
|
+
"@teambit/component-descriptor": "0.0.409",
|
|
67
65
|
"@teambit/harmony.ui.aspect-box": "0.0.505",
|
|
68
|
-
"@teambit/
|
|
69
|
-
"@teambit/
|
|
70
|
-
"@teambit/
|
|
71
|
-
"@teambit/envs
|
|
66
|
+
"@teambit/envs.ui.env-icon": "0.0.503",
|
|
67
|
+
"@teambit/compositions": "1.0.109",
|
|
68
|
+
"@teambit/deprecation": "1.0.109",
|
|
69
|
+
"@teambit/envs": "1.0.109"
|
|
72
70
|
},
|
|
73
71
|
"devDependencies": {
|
|
74
|
-
"@types/react": "^17.0.8",
|
|
75
72
|
"@types/lodash": "4.14.165",
|
|
76
73
|
"@types/semver": "7.3.4",
|
|
77
74
|
"@types/lodash.flatten": "4.4.6",
|
|
78
75
|
"@types/classnames": "2.2.11",
|
|
79
76
|
"@types/lodash.compact": "3.0.6",
|
|
80
77
|
"@types/mocha": "9.1.0",
|
|
81
|
-
"@types/
|
|
82
|
-
"@types/
|
|
83
|
-
"@
|
|
84
|
-
"@
|
|
85
|
-
"@teambit/component.content.component-overview": "1.95.0"
|
|
78
|
+
"@types/jest": "^29.2.2",
|
|
79
|
+
"@types/testing-library__jest-dom": "^5.9.5",
|
|
80
|
+
"@teambit/component.content.component-overview": "1.95.0",
|
|
81
|
+
"@teambit/harmony.envs.core-aspect-env": "0.0.14"
|
|
86
82
|
},
|
|
87
83
|
"peerDependencies": {
|
|
88
84
|
"@apollo/client": "^3.6.0",
|
|
89
|
-
"react
|
|
90
|
-
"
|
|
91
|
-
"react": "^
|
|
92
|
-
"
|
|
85
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
86
|
+
"react-router-dom": "^6.8.1",
|
|
87
|
+
"@types/react": "^18.2.12",
|
|
88
|
+
"@teambit/legacy": "1.0.624"
|
|
93
89
|
},
|
|
94
90
|
"license": "Apache-2.0",
|
|
95
91
|
"optionalDependencies": {},
|
|
@@ -103,7 +99,7 @@
|
|
|
103
99
|
},
|
|
104
100
|
"private": false,
|
|
105
101
|
"engines": {
|
|
106
|
-
"node": ">=
|
|
102
|
+
"node": ">=16.0.0"
|
|
107
103
|
},
|
|
108
104
|
"repository": {
|
|
109
105
|
"type": "git",
|
|
@@ -112,12 +108,9 @@
|
|
|
112
108
|
"keywords": [
|
|
113
109
|
"bit",
|
|
114
110
|
"bit-aspect",
|
|
111
|
+
"bit-core-aspect",
|
|
115
112
|
"components",
|
|
116
113
|
"collaboration",
|
|
117
|
-
"web"
|
|
118
|
-
"react",
|
|
119
|
-
"react-components",
|
|
120
|
-
"angular",
|
|
121
|
-
"angular-components"
|
|
114
|
+
"web"
|
|
122
115
|
]
|
|
123
116
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,38 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"lib": [
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"DOM.Iterable",
|
|
8
|
-
"ScriptHost"
|
|
4
|
+
"esnext",
|
|
5
|
+
"dom",
|
|
6
|
+
"dom.Iterable"
|
|
9
7
|
],
|
|
10
|
-
"target": "
|
|
11
|
-
"module": "
|
|
12
|
-
"jsx": "react",
|
|
13
|
-
"allowJs": true,
|
|
14
|
-
"composite": true,
|
|
8
|
+
"target": "es2020",
|
|
9
|
+
"module": "es2020",
|
|
10
|
+
"jsx": "react-jsx",
|
|
15
11
|
"declaration": true,
|
|
16
12
|
"sourceMap": true,
|
|
17
|
-
"skipLibCheck": true,
|
|
18
13
|
"experimentalDecorators": true,
|
|
19
|
-
"
|
|
14
|
+
"skipLibCheck": true,
|
|
20
15
|
"moduleResolution": "node",
|
|
21
16
|
"esModuleInterop": true,
|
|
22
|
-
"rootDir": ".",
|
|
23
17
|
"resolveJsonModule": true,
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"strictPropertyInitialization": false,
|
|
28
|
-
"strict": true,
|
|
29
|
-
"noImplicitAny": false,
|
|
30
|
-
"preserveConstEnums": true
|
|
18
|
+
"allowJs": true,
|
|
19
|
+
"outDir": "dist",
|
|
20
|
+
"emitDeclarationOnly": true
|
|
31
21
|
},
|
|
32
22
|
"exclude": [
|
|
23
|
+
"artifacts",
|
|
24
|
+
"public",
|
|
33
25
|
"dist",
|
|
26
|
+
"node_modules",
|
|
27
|
+
"package.json",
|
|
34
28
|
"esm.mjs",
|
|
35
|
-
"
|
|
29
|
+
"**/*.cjs",
|
|
30
|
+
"./dist"
|
|
36
31
|
],
|
|
37
32
|
"include": [
|
|
38
33
|
"**/*",
|
package/types/asset.d.ts
CHANGED
|
@@ -5,12 +5,12 @@ declare module '*.png' {
|
|
|
5
5
|
declare module '*.svg' {
|
|
6
6
|
import type { FunctionComponent, SVGProps } from 'react';
|
|
7
7
|
|
|
8
|
-
export const ReactComponent: FunctionComponent<
|
|
8
|
+
export const ReactComponent: FunctionComponent<
|
|
9
|
+
SVGProps<SVGSVGElement> & { title?: string }
|
|
10
|
+
>;
|
|
9
11
|
const src: string;
|
|
10
12
|
export default src;
|
|
11
13
|
}
|
|
12
|
-
|
|
13
|
-
// @TODO Gilad
|
|
14
14
|
declare module '*.jpg' {
|
|
15
15
|
const value: any;
|
|
16
16
|
export = value;
|
|
@@ -27,3 +27,15 @@ declare module '*.bmp' {
|
|
|
27
27
|
const value: any;
|
|
28
28
|
export = value;
|
|
29
29
|
}
|
|
30
|
+
declare module '*.otf' {
|
|
31
|
+
const value: any;
|
|
32
|
+
export = value;
|
|
33
|
+
}
|
|
34
|
+
declare module '*.woff' {
|
|
35
|
+
const value: any;
|
|
36
|
+
export = value;
|
|
37
|
+
}
|
|
38
|
+
declare module '*.woff2' {
|
|
39
|
+
const value: any;
|
|
40
|
+
export = value;
|
|
41
|
+
}
|