@rsdoctor/components 1.5.17 → 1.6.0
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/components/Alert/ecma-version-check_module.css +1 -1
- package/dist/components/Alert/ecma-version-check_module.css.map +1 -1
- package/dist/components/Alerts/bundle-alert.d.ts +1 -1
- package/dist/components/Alerts/bundle-alert.mjs +82 -73
- package/dist/components/Alerts/bundle-alert.mjs.map +1 -1
- package/dist/components/Alerts/bundle.mjs +1 -2
- package/dist/components/Alerts/bundle.mjs.map +1 -1
- package/dist/components/Alerts/collapse-cjs-require.mjs +6 -14
- package/dist/components/Alerts/collapse-cjs-require.mjs.map +1 -1
- package/dist/components/Alerts/collapse-cross-chunks.mjs +3 -8
- package/dist/components/Alerts/collapse-cross-chunks.mjs.map +1 -1
- package/dist/components/Alerts/collapse-esm-cjs.mjs +6 -10
- package/dist/components/Alerts/collapse-esm-cjs.mjs.map +1 -1
- package/dist/components/Alerts/collapse-module-mixed-chunks.mjs +5 -12
- package/dist/components/Alerts/collapse-module-mixed-chunks.mjs.map +1 -1
- package/dist/components/Alerts/collapse-side-effects-only-imports.mjs +5 -12
- package/dist/components/Alerts/collapse-side-effects-only-imports.mjs.map +1 -1
- package/dist/components/Alerts/collapse.mjs +3 -10
- package/dist/components/Alerts/collapse.mjs.map +1 -1
- package/dist/components/Alerts/collapse_module.css +1 -1
- package/dist/components/Alerts/collapse_module.css.map +1 -1
- package/dist/components/Alerts/index.module.mjs +7 -0
- package/dist/components/Alerts/index.module.mjs.map +1 -0
- package/dist/components/Alerts/index_module.css +9 -0
- package/dist/components/Alerts/index_module.css.map +1 -0
- package/dist/components/Alerts/list.d.ts +1 -0
- package/dist/components/Alerts/list.mjs +13 -8
- package/dist/components/Alerts/list.mjs.map +1 -1
- package/dist/components/Alerts/list.module.mjs +2 -1
- package/dist/components/Alerts/list.module.mjs.map +1 -1
- package/dist/components/Alerts/list_module.css +8 -0
- package/dist/components/Alerts/list_module.css.map +1 -1
- package/dist/components/Card/size_module.css +0 -2
- package/dist/components/Card/size_module.css.map +1 -1
- package/dist/components/Charts/TimelineCharts/index.mjs +63 -39
- package/dist/components/Charts/TimelineCharts/index.mjs.map +1 -1
- package/dist/components/Charts/TreeMap.mjs +124 -107
- package/dist/components/Charts/TreeMap.mjs.map +1 -1
- package/dist/components/Charts/index.mjs +3 -1
- package/dist/components/Charts/index.mjs.map +1 -1
- package/dist/components/Charts/treemap_module.css +6 -5
- package/dist/components/Charts/treemap_module.css.map +1 -1
- package/dist/components/FileTree/index.css +0 -1
- package/dist/components/FileTree/index.css.map +1 -1
- package/dist/components/FileTree/index.mjs +3 -4
- package/dist/components/FileTree/index.mjs.map +1 -1
- package/dist/components/Keyword/style_module.css +0 -1
- package/dist/components/Keyword/style_module.css.map +1 -1
- package/dist/components/Layout/header.mjs +22 -6
- package/dist/components/Layout/header.mjs.map +1 -1
- package/dist/components/Layout/header.module.mjs +0 -1
- package/dist/components/Layout/header.module.mjs.map +1 -1
- package/dist/components/Layout/header_module.css +0 -6
- package/dist/components/Layout/header_module.css.map +1 -1
- package/dist/components/Layout/index.mjs +27 -8
- package/dist/components/Layout/index.mjs.map +1 -1
- package/dist/components/Layout/menus.mjs +3 -1
- package/dist/components/Layout/menus.mjs.map +1 -1
- package/dist/components/Layout/rsdoctor-title-logo-dark.mjs +2 -0
- package/dist/components/Loader/Analysis/files.mjs +16 -17
- package/dist/components/Loader/Analysis/files.mjs.map +1 -1
- package/dist/components/Loader/Analysis/style_module.css +13 -14
- package/dist/components/Loader/Analysis/style_module.css.map +1 -1
- package/dist/components/Loader/executions.mjs +5 -13
- package/dist/components/Loader/executions.mjs.map +1 -1
- package/dist/components/Opener/ide.mjs +36 -2
- package/dist/components/Opener/ide.mjs.map +1 -1
- package/dist/components/Overall/DataSummary.mjs +21 -20
- package/dist/components/Overall/DataSummary.mjs.map +1 -1
- package/dist/components/Overall/DataSummary.module.mjs +1 -12
- package/dist/components/Overall/DataSummary.module.mjs.map +1 -1
- package/dist/components/Overall/DataSummary_module.css +7 -72
- package/dist/components/Overall/DataSummary_module.css.map +1 -1
- package/dist/components/Overall/bundle_module.css +1 -4
- package/dist/components/Overall/bundle_module.css.map +1 -1
- package/dist/components/Overall/list_module.css +0 -2
- package/dist/components/Overall/list_module.css.map +1 -1
- package/dist/components/Overall/overview_module.css +1 -2
- package/dist/components/Overall/overview_module.css.map +1 -1
- package/dist/components/base/CodeViewer/index.d.ts +1 -1
- package/dist/components/base/CodeViewer/index.mjs +5 -3
- package/dist/components/base/CodeViewer/index.mjs.map +1 -1
- package/dist/components/base/CodeViewer/interface.d.ts +1 -2
- package/dist/components/base/DiffViewer/index.d.ts +1 -1
- package/dist/components/base/DiffViewer/index.mjs +4 -1
- package/dist/components/base/DiffViewer/index.mjs.map +1 -1
- package/dist/components/base/DiffViewer/interface.d.ts +1 -2
- package/dist/pages/BundleSize/components/asset-path.d.ts +7 -0
- package/dist/pages/BundleSize/components/asset-path.mjs +9 -0
- package/dist/pages/BundleSize/components/asset-path.mjs.map +1 -0
- package/dist/pages/BundleSize/components/asset-path.test.d.ts +1 -0
- package/dist/pages/BundleSize/components/asset-path.test.mjs +27 -0
- package/dist/pages/BundleSize/components/asset-path.test.mjs.map +1 -0
- package/dist/pages/BundleSize/components/asset_module.css +7 -5
- package/dist/pages/BundleSize/components/asset_module.css.map +1 -1
- package/dist/pages/BundleSize/components/card_module.css +2 -2
- package/dist/pages/BundleSize/components/card_module.css.map +1 -1
- package/dist/pages/BundleSize/components/cards.mjs +5 -6
- package/dist/pages/BundleSize/components/cards.mjs.map +1 -1
- package/dist/pages/BundleSize/components/index.mjs +15 -11
- package/dist/pages/BundleSize/components/index.mjs.map +1 -1
- package/dist/pages/BundleSize/components/index.module.mjs +1 -6
- package/dist/pages/BundleSize/components/index.module.mjs.map +1 -1
- package/dist/pages/BundleSize/components/index_module.css +0 -37
- package/dist/pages/BundleSize/components/index_module.css.map +1 -1
- package/dist/pages/BundleSize/components/search-modal.mjs +5 -5
- package/dist/pages/BundleSize/components/search-modal.mjs.map +1 -1
- package/dist/pages/BundleSize/components/search-modal.module.mjs +10 -0
- package/dist/pages/BundleSize/components/search-modal.module.mjs.map +1 -0
- package/dist/pages/BundleSize/components/search-modal_module.css +39 -0
- package/dist/pages/BundleSize/components/search-modal_module.css.map +1 -0
- package/dist/pages/BundleSize/components/tree-graph.mjs +32 -15
- package/dist/pages/BundleSize/components/tree-graph.mjs.map +1 -1
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.css +6 -2
- package/dist/pages/ModuleAnalyze/components/fileTreeCom.css.map +1 -1
- package/dist/pages/ModuleAnalyze/index.css +4 -6
- package/dist/pages/ModuleAnalyze/index.css.map +1 -1
- package/dist/pages/ModuleAnalyze/index.mjs +3 -4
- package/dist/pages/ModuleAnalyze/index.mjs.map +1 -1
- package/dist/pages/WebpackLoaders/Analysis/index.mjs +3 -3
- package/dist/pages/WebpackLoaders/Analysis/index.mjs.map +1 -1
- package/dist/pages/WebpackLoaders/Overall/index.mjs +1 -1
- package/dist/pages/WebpackLoaders/Overall/index.mjs.map +1 -1
- package/dist/static/image/rsdoctor-title-logo-dark.png +0 -0
- package/dist/utils/assets.d.ts +1 -0
- package/dist/utils/assets.mjs +17 -0
- package/dist/utils/assets.mjs.map +1 -0
- package/dist/utils/assets.test.d.ts +1 -0
- package/dist/utils/assets.test.mjs +22 -0
- package/dist/utils/assets.test.mjs.map +1 -0
- package/dist/utils/hooks.d.ts +1 -0
- package/dist/utils/hooks.mjs +6 -1
- package/dist/utils/hooks.mjs.map +1 -1
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components/base/DiffViewer/index.mjs","sources":["../../../../src/components/base/DiffViewer/index.tsx"],"sourcesContent":["import { DiffEditor, MonacoDiffEditor } from '@monaco-editor/react';\nimport { Checkbox } from 'antd';\nimport clsx from 'clsx';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { getFileName, getFilePathFormat } from '../CodeViewer/utils';\nimport styles from './index.module.scss';\nimport { DiffViewerProps } from './interface';\nimport { defineMonacoDiffOptions } from './utils';\n\nexport function DiffViewer({\n className,\n style,\n original = '',\n modified = '',\n originalFilePath = '',\n modifiedFilePath = '',\n originalLang,\n modifiedLang,\n isEmbed = false,\n isLightTheme
|
|
1
|
+
{"version":3,"file":"components/base/DiffViewer/index.mjs","sources":["../../../../src/components/base/DiffViewer/index.tsx"],"sourcesContent":["import { DiffEditor, MonacoDiffEditor } from '@monaco-editor/react';\nimport { Checkbox } from 'antd';\nimport clsx from 'clsx';\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { getFileName, getFilePathFormat } from '../CodeViewer/utils';\nimport styles from './index.module.scss';\nimport { DiffViewerProps } from './interface';\nimport { defineMonacoDiffOptions } from './utils';\nimport { useTheme } from '../../../utils';\n\nexport function DiffViewer({\n className,\n style,\n original = '',\n modified = '',\n originalFilePath = '',\n modifiedFilePath = '',\n originalLang,\n modifiedLang,\n isEmbed = false,\n isLightTheme: isLightThemeProp,\n headerVisible = true,\n}: DiffViewerProps) {\n const { isLight: isLightMode } = useTheme();\n const isLightTheme: boolean = isLightThemeProp ?? isLightMode;\n const [isSideBySide, setIsSideBySide] = useState(true);\n const editor = useRef<MonacoDiffEditor>(undefined);\n const originalLanguage = useMemo(\n () => originalLang || getFilePathFormat(originalFilePath) || 'plaintext',\n [originalLang, originalFilePath],\n );\n const modifiedLanguage = useMemo(\n () => modifiedLang || getFilePathFormat(modifiedFilePath) || 'plaintext',\n [modifiedLang, modifiedFilePath],\n );\n const options = useMemo(\n () => defineMonacoDiffOptions({ renderSideBySide: isSideBySide }),\n [isSideBySide],\n );\n const onEditorMount = useCallback((editorInstance: MonacoDiffEditor) => {\n editor.current = editorInstance;\n }, []);\n const theme = isLightTheme ? 'vs-light' : 'vs-dark';\n\n useEffect(\n () => () => {\n editor.current?.setModel(null);\n },\n [],\n );\n\n return (\n <div\n className={clsx(\n 'monaco-component',\n 'diff-viewer',\n styles['diff-viewer'],\n isEmbed && styles['embed'],\n className,\n )}\n style={style}\n >\n {headerVisible && (\n <div className={styles['header']}>\n <div>{getFileName(originalFilePath)}</div>\n <div style={{ flex: 1 }} />\n <div>\n <Checkbox\n className={styles['text']}\n title=\"side-by-side\"\n checked={isSideBySide}\n onChange={(evt) => {\n setIsSideBySide(evt.target.checked);\n }}\n >\n side-by-side\n </Checkbox>\n </div>\n </div>\n )}\n <div className={clsx(styles['content'], 'editor-wrap')}>\n <DiffEditor\n theme={theme}\n originalLanguage={originalLanguage}\n modifiedLanguage={modifiedLanguage}\n original={original}\n modified={modified}\n width=\"100%\"\n options={options}\n onMount={onEditorMount}\n />\n </div>\n </div>\n );\n}\n\nexport type { DiffViewerProps } from './interface';\nexport { useDiffDrawer } from './useDiffDrawer';\nexport { defineMonacoDiffOptions } from './utils';\n"],"names":["DiffViewer","className","style","original","modified","originalFilePath","modifiedFilePath","originalLang","modifiedLang","isEmbed","isLightThemeProp","headerVisible","isLightMode","useTheme","isLightTheme","isSideBySide","setIsSideBySide","useState","editor","useRef","undefined","originalLanguage","useMemo","getFilePathFormat","modifiedLanguage","options","defineMonacoDiffOptions","onEditorMount","useCallback","editorInstance","theme","useEffect","clsx","styles","getFileName","Checkbox","evt","DiffEditor"],"mappings":";;;;;;;;;AAUO,SAASA,WAAW,EACzBC,SAAS,EACTC,KAAK,EACLC,WAAW,EAAE,EACbC,WAAW,EAAE,EACbC,mBAAmB,EAAE,EACrBC,mBAAmB,EAAE,EACrBC,YAAY,EACZC,YAAY,EACZC,UAAU,KAAK,EACf,cAAcC,gBAAgB,EAC9BC,gBAAgB,IAAI,EACJ;IAChB,MAAM,EAAE,SAASC,WAAW,EAAE,GAAGC;IACjC,MAAMC,eAAwBJ,oBAAoBE;IAClD,MAAM,CAACG,cAAcC,gBAAgB,GAAGC,SAAS;IACjD,MAAMC,SAASC,OAAyBC;IACxC,MAAMC,mBAAmBC,QACvB,IAAMf,gBAAgBgB,kBAAkBlB,qBAAqB,aAC7D;QAACE;QAAcF;KAAiB;IAElC,MAAMmB,mBAAmBF,QACvB,IAAMd,gBAAgBe,kBAAkBjB,qBAAqB,aAC7D;QAACE;QAAcF;KAAiB;IAElC,MAAMmB,UAAUH,QACd,IAAMI,wBAAwB;YAAE,kBAAkBX;QAAa,IAC/D;QAACA;KAAa;IAEhB,MAAMY,gBAAgBC,YAAY,CAACC;QACjCX,OAAO,OAAO,GAAGW;IACnB,GAAG,EAAE;IACL,MAAMC,QAAQhB,eAAe,aAAa;IAE1CiB,UACE,IAAM;YACJb,OAAO,OAAO,EAAE,SAAS;QAC3B,GACA,EAAE;IAGJ,OAAO,WAAP,GACE,KAAC;QACC,WAAWc,KACT,oBACA,eACAC,YAAAA,CAAAA,cAAqB,EACrBxB,WAAWwB,aAAAA,KAAe,EAC1BhC;QAEF,OAAOC;;YAENS,iBAAiB,WAAjBA,GACC,KAAC;gBAAI,WAAWsB,aAAAA,MAAgB;;kCAC9B,IAAC;kCAAKC,YAAY7B;;kCAClB,IAAC;wBAAI,OAAO;4BAAE,MAAM;wBAAE;;kCACtB,IAAC;kCACC,kBAAC8B,UAAQA;4BACP,WAAWF,aAAAA,IAAc;4BACzB,OAAM;4BACN,SAASlB;4BACT,UAAU,CAACqB;gCACTpB,gBAAgBoB,IAAI,MAAM,CAAC,OAAO;4BACpC;sCACD;;;;;0BAMP,IAAC;gBAAI,WAAWJ,KAAKC,aAAAA,OAAiB,EAAE;0BACtC,kBAACI,YAAUA;oBACT,OAAOP;oBACP,kBAAkBT;oBAClB,kBAAkBG;oBAClB,UAAUrB;oBACV,UAAUC;oBACV,OAAM;oBACN,SAASqB;oBACT,SAASE;;;;;AAKnB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const normalizeAssetPath: (assetPath: string) => string;
|
|
2
|
+
export declare const createAssetPathMap: <T extends {
|
|
3
|
+
path: string;
|
|
4
|
+
}>(assets: T[]) => Map<string, T>;
|
|
5
|
+
export declare const resolveAssetFileTitleTarget: <T extends {
|
|
6
|
+
path: string;
|
|
7
|
+
}>(assetsMap: Map<string, T>, file: string, basename: string) => string | T;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const normalizeAssetPath = (assetPath)=>assetPath.replace(/\\/g, '/');
|
|
2
|
+
const createAssetPathMap = (assets)=>new Map(assets.map((asset)=>[
|
|
3
|
+
normalizeAssetPath(asset.path),
|
|
4
|
+
asset
|
|
5
|
+
]));
|
|
6
|
+
const resolveAssetFileTitleTarget = (assetsMap, file, basename)=>assetsMap.get(normalizeAssetPath(file)) ?? basename;
|
|
7
|
+
export { createAssetPathMap, normalizeAssetPath, resolveAssetFileTitleTarget };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=asset-path.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pages/BundleSize/components/asset-path.mjs","sources":["../../../../src/pages/BundleSize/components/asset-path.ts"],"sourcesContent":["export const normalizeAssetPath = (assetPath: string) =>\n assetPath.replace(/\\\\/g, '/');\n\nexport const createAssetPathMap = <T extends { path: string }>(assets: T[]) =>\n new Map(assets.map((asset) => [normalizeAssetPath(asset.path), asset]));\n\nexport const resolveAssetFileTitleTarget = <T extends { path: string }>(\n assetsMap: Map<string, T>,\n file: string,\n basename: string,\n) => assetsMap.get(normalizeAssetPath(file)) ?? basename;\n"],"names":["normalizeAssetPath","assetPath","createAssetPathMap","assets","Map","asset","resolveAssetFileTitleTarget","assetsMap","file","basename"],"mappings":"AAAO,MAAMA,qBAAqB,CAACC,YACjCA,UAAU,OAAO,CAAC,OAAO;AAEpB,MAAMC,qBAAqB,CAA6BC,SAC7D,IAAIC,IAAID,OAAO,GAAG,CAAC,CAACE,QAAU;YAACL,mBAAmBK,MAAM,IAAI;YAAGA;SAAM;AAEhE,MAAMC,8BAA8B,CACzCC,WACAC,MACAC,WACGF,UAAU,GAAG,CAACP,mBAAmBQ,UAAUC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { describe, expect, it } from "@rstest/core";
|
|
2
|
+
import { createAssetPathMap, normalizeAssetPath, resolveAssetFileTitleTarget } from "./asset-path.mjs";
|
|
3
|
+
describe('BundleSize asset path helpers', ()=>{
|
|
4
|
+
it('normalizes Windows path separators', ()=>{
|
|
5
|
+
expect(normalizeAssetPath('static\\js\\main.js')).toBe('static/js/main.js');
|
|
6
|
+
});
|
|
7
|
+
it('resolves assets using normalized tree file paths', ()=>{
|
|
8
|
+
const asset = {
|
|
9
|
+
path: 'static\\js\\main.js',
|
|
10
|
+
size: 1024
|
|
11
|
+
};
|
|
12
|
+
const assetsMap = createAssetPathMap([
|
|
13
|
+
asset
|
|
14
|
+
]);
|
|
15
|
+
expect(resolveAssetFileTitleTarget(assetsMap, 'static/js/main.js', 'main.js')).toBe(asset);
|
|
16
|
+
});
|
|
17
|
+
it('falls back to basename when the asset lookup misses', ()=>{
|
|
18
|
+
const assetsMap = createAssetPathMap([
|
|
19
|
+
{
|
|
20
|
+
path: 'static/js/main.js'
|
|
21
|
+
}
|
|
22
|
+
]);
|
|
23
|
+
expect(resolveAssetFileTitleTarget(assetsMap, 'static/css/main.css', 'main.css')).toBe('main.css');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=asset-path.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pages/BundleSize/components/asset-path.test.mjs","sources":["../../../../src/pages/BundleSize/components/asset-path.test.ts"],"sourcesContent":["import { describe, expect, it } from '@rstest/core';\nimport {\n createAssetPathMap,\n normalizeAssetPath,\n resolveAssetFileTitleTarget,\n} from './asset-path';\n\ndescribe('BundleSize asset path helpers', () => {\n it('normalizes Windows path separators', () => {\n expect(normalizeAssetPath('static\\\\js\\\\main.js')).toBe('static/js/main.js');\n });\n\n it('resolves assets using normalized tree file paths', () => {\n const asset = {\n path: 'static\\\\js\\\\main.js',\n size: 1024,\n };\n const assetsMap = createAssetPathMap([asset]);\n\n expect(\n resolveAssetFileTitleTarget(assetsMap, 'static/js/main.js', 'main.js'),\n ).toBe(asset);\n });\n\n it('falls back to basename when the asset lookup misses', () => {\n const assetsMap = createAssetPathMap([{ path: 'static/js/main.js' }]);\n\n expect(\n resolveAssetFileTitleTarget(assetsMap, 'static/css/main.css', 'main.css'),\n ).toBe('main.css');\n });\n});\n"],"names":["describe","it","expect","normalizeAssetPath","asset","assetsMap","createAssetPathMap","resolveAssetFileTitleTarget"],"mappings":";;AAOAA,SAAS,iCAAiC;IACxCC,GAAG,sCAAsC;QACvCC,OAAOC,mBAAmB,wBAAwB,IAAI,CAAC;IACzD;IAEAF,GAAG,oDAAoD;QACrD,MAAMG,QAAQ;YACZ,MAAM;YACN,MAAM;QACR;QACA,MAAMC,YAAYC,mBAAmB;YAACF;SAAM;QAE5CF,OACEK,4BAA4BF,WAAW,qBAAqB,YAC5D,IAAI,CAACD;IACT;IAEAH,GAAG,uDAAuD;QACxD,MAAMI,YAAYC,mBAAmB;YAAC;gBAAE,MAAM;YAAoB;SAAE;QAEpEJ,OACEK,4BAA4BF,WAAW,uBAAuB,aAC9D,IAAI,CAAC;IACT;AACF"}
|
|
@@ -37,13 +37,16 @@
|
|
|
37
37
|
--x-pad-minus-scrollbar: calc(var(--x-pad) - var(--scrollbar-width));
|
|
38
38
|
min-height: var(--tree-min-height);
|
|
39
39
|
padding: var(--y-pad) var(--x-pad-minus-scrollbar) var(--y-pad) var(--x-pad);
|
|
40
|
-
|
|
41
|
-
border:
|
|
42
|
-
border-radius: 8px;
|
|
40
|
+
border: 1px solid var(--color-border-secondary);
|
|
41
|
+
border-radius: var(--border-radius-lg);
|
|
43
42
|
flex: 1;
|
|
44
43
|
display: flex;
|
|
45
44
|
}
|
|
46
45
|
|
|
46
|
+
.bundleTree-ym_nR5 .ant-tree-list-scrollbar-thumb {
|
|
47
|
+
background: var(--color-scrollbar) !important;
|
|
48
|
+
}
|
|
49
|
+
|
|
47
50
|
@media (max-height: 900px) {
|
|
48
51
|
.bundleTree-ym_nR5 {
|
|
49
52
|
--tree-min-height: 450px;
|
|
@@ -84,7 +87,6 @@
|
|
|
84
87
|
.bundleTreeEntryTitle-XbeexU {
|
|
85
88
|
text-overflow: ellipsis;
|
|
86
89
|
text-wrap: nowrap;
|
|
87
|
-
color: #000000d9;
|
|
88
90
|
font-size: 14px;
|
|
89
91
|
font-weight: 400;
|
|
90
92
|
overflow: hidden;
|
|
@@ -98,7 +100,7 @@
|
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
.divider-Iq1wtJ {
|
|
101
|
-
border-bottom: 1px dashed
|
|
103
|
+
border-bottom: 1px dashed var(--color-divider);
|
|
102
104
|
flex-grow: 1;
|
|
103
105
|
min-width: 10px;
|
|
104
106
|
height: 1px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://./src/pages/BundleSize/components/asset.module.scss"],"names":[],"mappings":"AAAA;EACE,eAAe;AACjB;;AAF6D;EAK3D,cAAc;AAChB;;AANsG;EASpG,WAAW;AACb;;AAVuJ;EAarJ,iBAAiB;AACnB;;AAd0M;EAiBxM,aAAa;AACf;;AAlBsQ;EAqBpQ,2CAA2C;EAC3C,2BAA2B;AAC7B;;AAvBwV;EA0BtV,sBAAsB;EACtB,OAAO;EACP,aAAa;AACf;;AA7BsZ;EAgCpZ,wBAAwB;EACxB,aAAa;EACb,aAAa;EACb,uBAAuB;EACvB,oEAAoE;EACpE,kCAAkC;EAClC,4EAA4E;EAC5E
|
|
1
|
+
{"version":3,"sources":["webpack://./src/pages/BundleSize/components/asset.module.scss"],"names":[],"mappings":"AAAA;EACE,eAAe;AACjB;;AAF6D;EAK3D,cAAc;AAChB;;AANsG;EASpG,WAAW;AACb;;AAVuJ;EAarJ,iBAAiB;AACnB;;AAd0M;EAiBxM,aAAa;AACf;;AAlBsQ;EAqBpQ,2CAA2C;EAC3C,2BAA2B;AAC7B;;AAvBwV;EA0BtV,sBAAsB;EACtB,OAAO;EACP,aAAa;AACf;;AA7BsZ;EAgCpZ,wBAAwB;EACxB,aAAa;EACb,aAAa;EACb,uBAAuB;EACvB,oEAAoE;EACpE,kCAAkC;EAClC,4EAA4E;EAC5E,+CAA+C;EAC/C,sCAAsC;EACtC,OAAO;EACP,aAAa;AACf;;AA3C2wB;EA8CzwB,6CAA6C;AAC/C;;AA/C42B;EAA0B;IAmDl4B,wBAAwB;EAC1B;AACF;;AArD46B;EAwD16B,OAAO;EACP,kBAAkB;AACpB;;AA1Dy9B;EA6Dv9B,kBAAkB;EAClB,QAAQ;AACV;;AA/D4gC;EAkE1gC,gCAAgC;EAChC,aAAa;EACb,kBAAkB;AACpB;;AArE4lC;EAwE1lC,YAAY;EACZ,oBAAoB;AACtB;;AA1EoqC;EA6ElqC,WAAW;EACX,mBAAmB;EACnB,qDAAqD;EACrD,aAAa;EACb,kBAAkB;EAClB,MAAM;EACN,OAAO;AACT;;AApF2zC;EAuFzzC,uBAAuB;EACvB,iBAAiB;EACjB,eAAe;EACf,gBAAgB;EAChB,gBAAgB;AAClB;;AA5Fw6C;EA+Ft6C,OAAO;EACP,mBAAmB;EACnB,aAAa;EACb,gBAAgB;AAClB;;AAnGy/C;EAsGv/C,8CAA8C;EAC9C,YAAY;EACZ,eAAe;EACf,WAAW;EACX,cAAc;EACd,kBAAkB;EAClB,QAAQ;AACV","sourcesContent":[".bundle :global .rc-tree-node-content-wrapper{font-size:14px}.bundle :global .file-icon{margin-left:0}.bundle :global .ant-tree-indent-unit{width:10px}.bundle :global .ant-tree-iconEle{margin-right:2px}.bundle :global .ant-tree-node-content-wrapper{display:flex}.bundleBody{justify-content:flex-start;min-height:var(--body-min-height, initial)}.bundle,.bundleBody{display:flex;flex-direction:column;flex:1}.bundleTree{--tree-min-height: 300px;--x-pad: 20px;--y-pad: 14px;--scrollbar-width: 10px;--x-pad-minus-scrollbar: calc(var(--x-pad) - var(--scrollbar-width));display:flex;flex:1;min-height:var(--tree-min-height);padding:var(--y-pad) var(--x-pad-minus-scrollbar) var(--y-pad) var(--x-pad);border:1px solid var(--color-border-secondary);border-radius:var(--border-radius-lg)}.bundleTree :global(.ant-tree-list-scrollbar-thumb){background:var(--color-scrollbar) !important}@media(max-height: 900px){.bundleTree{--tree-min-height: 450px}}.bundleTreeViewport{flex:1;position:relative}.bundleTreeInnerViewport{position:absolute;inset:0}.bundleTreeEntry{display:flex;position:relative;height:var(--item-height, 30px)}.bundleTreeEntry :global span.ant-tag{margin:none;margin-inline-end:0px}.bundleTreeEntryContent{position:absolute;left:0;top:0;width:100%;display:flex;align-items:center;padding-inline-end:var(--x-pad-minus-scrollbar, 0px)}.bundleTreeEntryTitle{text-overflow:ellipsis;overflow:hidden;text-wrap:nowrap;font-size:14px;font-weight:400}.bundleTreeEntryTitleWrap{display:flex;flex:1;align-items:center;overflow:hidden}.divider{position:relative;top:4px;height:1px;min-width:10px;flex-grow:1;margin:0 10px;border-bottom:1px dashed var(--color-divider)}"],"sourceRoot":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
.container-wODg_6 {
|
|
2
|
-
background-color:
|
|
2
|
+
background-color: var(--color-bg-box);
|
|
3
3
|
align-items: center;
|
|
4
4
|
margin-bottom: 20px;
|
|
5
5
|
padding: 20px 0;
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
.cardTitle-xNmEfV .title-qIR7dd {
|
|
57
|
-
color:
|
|
57
|
+
color: var(--text-color);
|
|
58
58
|
font-size: 14px;
|
|
59
59
|
font-weight: 500;
|
|
60
60
|
line-height: 20px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://./src/pages/BundleSize/components/card.module.scss"],"names":[],"mappings":"AAAA;EACE,
|
|
1
|
+
{"version":3,"sources":["webpack://./src/pages/BundleSize/components/card.module.scss"],"names":[],"mappings":"AAAA;EACE,qCAAqC;EACrC,mBAAmB;EACnB,mBAAmB;EACnB,eAAe;EACf,aAAa;AACf;;AANkH;EAShH,6BAA6B;EAC7B,WAAW;EACX,aAAa;AACf;;AAZmM;EAejM,OAAO;EACP,uBAAuB;EACvB,mBAAmB;EACnB,aAAa;AACf;;AAnBoS;EAsBlS,sBAAsB;EACtB,uBAAuB;EACvB,cAAc;EACd,aAAa;AACf;;AA1BgY;EA6B9X,iBAAiB;EACjB,eAAe;EACf,gBAAgB;EAChB,iBAAiB;AACnB;;AAjCke;EAoChe,eAAe;EACf,gBAAgB;EAChB,iBAAiB;AACnB;;AAvC4iB;EA0C1iB,aAAa;EACb,eAAe;EACf,gBAAgB;EAChB,iBAAiB;AACnB;;AA9C0oB;EAiDxoB,8BAA8B;EAC9B,mBAAmB;EACnB,mBAAmB;EACnB,aAAa;AACf;;AArDsuB;EAwDpuB,wBAAwB;EACxB,eAAe;EACf,gBAAgB;EAChB,iBAAiB;AACnB","sourcesContent":[".container{display:flex;align-items:center;background-color:var(--color-bg-box);padding:20px 0;margin-bottom:20px}.container .chartsContainer{width:100%;display:flex;justify-content:space-evenly}.container .chartsContainer .chart{display:flex;align-items:center;justify-content:center;flex:1}.container .summary{display:flex;flex-direction:column;justify-content:center;margin:0 20px}.container .summary .description{font-size:20px;font-weight:500;line-height:32px;margin-right:5px}.container .summary .unit{font-size:12px;font-weight:400;line-height:32px}.container .summary .totalNumber{font-size:13px;font-weight:400;line-height:20px;margin:4px 0}.cardTitle{display:flex;justify-content:space-between;align-items:center;margin-bottom:25px}.cardTitle .title{font-size:14px;font-weight:500;line-height:20px;color:var(--text-color)}"],"sourceRoot":""}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useState } from "react";
|
|
3
|
-
import { Avatar, Divider, Segmented, Tree
|
|
3
|
+
import { Avatar, Divider, Segmented, Tree } from "antd";
|
|
4
4
|
import { SDK } from "@rsdoctor/types";
|
|
5
5
|
import { FileFilled, GoldenFilled, RightOutlined } from "@ant-design/icons";
|
|
6
|
-
import { formatSize, useDuplicatePackagesByErrors } from "../../../utils/index.mjs";
|
|
6
|
+
import { formatSize, useDuplicatePackagesByErrors, useThemeToken } from "../../../utils/index.mjs";
|
|
7
7
|
import { StatisticCard } from "../../../components/Card/statistic.mjs";
|
|
8
8
|
import { SizeCard } from "../../../components/Card/size.mjs";
|
|
9
9
|
import overview from "../../../components/Overall/overview.mjs";
|
|
@@ -12,10 +12,9 @@ import { getFiles } from "../../../components/Overall/index.mjs";
|
|
|
12
12
|
import { TextDrawer } from "../../../components/TextDrawer/index.mjs";
|
|
13
13
|
import card_module from "./card.module.mjs";
|
|
14
14
|
const { DirectoryTree: DirectoryTree } = Tree;
|
|
15
|
-
const { useToken: useToken } = theme;
|
|
16
15
|
const { innerWidth: cards_innerWidth } = window;
|
|
17
16
|
const AssetCard = ({ showProgress = false, data, total, tagBgColor, type })=>{
|
|
18
|
-
const
|
|
17
|
+
const token = useThemeToken();
|
|
19
18
|
const _tagBgColor = tagBgColor || token.colorPrimaryBorderHover;
|
|
20
19
|
return /*#__PURE__*/ jsx(SizeCard, {
|
|
21
20
|
type: type,
|
|
@@ -175,7 +174,7 @@ const BundleCards = ({ errors, summary })=>{
|
|
|
175
174
|
},
|
|
176
175
|
text: /*#__PURE__*/ jsxs("div", {
|
|
177
176
|
style: {
|
|
178
|
-
color: '
|
|
177
|
+
color: 'var(--text-color-secondary)'
|
|
179
178
|
},
|
|
180
179
|
children: [
|
|
181
180
|
/*#__PURE__*/ jsx("span", {
|
|
@@ -193,7 +192,7 @@ const BundleCards = ({ errors, summary })=>{
|
|
|
193
192
|
treeData: treeData,
|
|
194
193
|
rootStyle: {
|
|
195
194
|
minHeight: '800px',
|
|
196
|
-
border: '1px solid
|
|
195
|
+
border: '1px solid var(--color-border)'
|
|
197
196
|
}
|
|
198
197
|
})
|
|
199
198
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages/BundleSize/components/cards.mjs","sources":["../../../../src/pages/BundleSize/components/cards.tsx"],"sourcesContent":["/* rslint-disable react/jsx-key */\nimport React, { useState, useMemo } from 'react';\nimport { Divider, Segmented, theme, Avatar, Tree } from 'antd';\nimport { Client, SDK } from '@rsdoctor/types';\nimport { RightOutlined, FileFilled, GoldenFilled } from '@ant-design/icons';\n\nimport { formatSize, useDuplicatePackagesByErrors } from '../../../utils';\nimport { StatisticCard } from '../../../components/Card/statistic';\nimport { SizeCard, bgColorType } from '../../../components/Card/size';\nimport Overview from '../../../components/Overall/overview';\nimport { ServerAPIProvider } from '../../../components/Manifest';\nimport { getFiles } from '../../..//components/Overall';\nimport { TextDrawer } from '../../..//components/TextDrawer';\n\nimport styles from './card.module.scss';\n\nconst { DirectoryTree } = Tree;\nconst { useToken } = theme;\nconst { innerWidth } = window;\n\ninterface CardProps {\n showProgress?: boolean;\n data: Client.RsdoctorClientAssetsSummary['all']['total'];\n total: number;\n tagBgColor?: string;\n type?: string;\n}\n\nconst AssetCard: React.FC<CardProps> = ({\n showProgress = false,\n data,\n total,\n tagBgColor,\n type,\n}) => {\n const { token } = useToken();\n const _tagBgColor = tagBgColor || token.colorPrimaryBorderHover;\n return (\n <SizeCard\n type={type!}\n files={data.files}\n total={total}\n showProgress={showProgress}\n tagBgColor={_tagBgColor}\n />\n );\n};\n\nconst AssetCardContainer: React.FC<{\n type?: string;\n titles: string[];\n datas: CardProps[];\n bgColor?: bgColorType;\n}> = ({ titles, datas, bgColor, type }) => {\n const [selectedTitle, setSelectedTitle] = useState(titles[0]);\n const idx = useMemo(\n () => titles.indexOf(selectedTitle),\n [titles, selectedTitle],\n );\n const currentIdx = idx >= 0 ? idx : 0;\n const fileType = type || selectedTitle || titles[0];\n\n // Add bounds checking to prevent accessing undefined data\n const currentData =\n currentIdx >= 0 && currentIdx < datas.length\n ? datas[currentIdx]\n : datas[0] || {};\n\n return (\n <StatisticCard\n title={\n <div className={styles.cardTitle}>\n <div className={styles.title}>{fileType}</div>\n {titles.length > 1 ? (\n <Segmented\n defaultValue={titles[0]}\n options={titles}\n onChange={(value) => {\n setSelectedTitle(value as string);\n }}\n size=\"small\"\n style={{ transition: 'transform 0.3s ease' }}\n value={selectedTitle}\n />\n ) : null}\n </div>\n }\n value={\n <AssetCard\n type={fileType}\n {...currentData}\n tagBgColor={bgColor?.tagBgColor}\n />\n }\n boxProps={{\n style: {\n background: bgColor?.bgColor,\n width: innerWidth > 1300 ? '80%' : '95%',\n },\n }}\n />\n );\n};\n\nexport const BundleCards: React.FC<{\n cwd: string;\n errors: SDK.ErrorsData;\n summary: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetAssetsSummary>;\n}> = ({ errors, summary }) => {\n const duplicatePackages = useDuplicatePackagesByErrors(errors);\n const [totalSize, totalSizeUnit] = formatSize(summary.all.total.size).split(\n ' ',\n );\n\n const arr = [\n <AssetCardContainer\n type={'JS'}\n titles={['Total', 'Initial']}\n datas={[\n {\n data: summary.js.total,\n total: summary.all.total.size,\n showProgress: true,\n },\n {\n data: summary.js.initial,\n total: summary.all.total.size,\n showProgress: true,\n },\n ]}\n />,\n <AssetCardContainer\n type={'CSS'}\n titles={['Total', 'Initial']}\n datas={[\n {\n data: summary.css.total,\n total: summary.all.total.size,\n showProgress: true,\n },\n {\n data: summary.css.initial,\n total: summary.all.total.size,\n showProgress: true,\n },\n ]}\n />,\n <AssetCardContainer\n titles={['Images', 'Fonts', 'Media']}\n datas={[\n {\n data: summary.imgs.total,\n total: summary.all.total.size,\n showProgress: true,\n },\n {\n data: summary.fonts.total,\n total: summary.all.total.size,\n showProgress: true,\n },\n {\n data: summary.media.total,\n total: summary.all.total.size,\n showProgress: true,\n },\n ]}\n />,\n <AssetCardContainer\n type={'HTML'}\n titles={['HTML Files']}\n datas={[\n {\n data: summary.html.total,\n total: summary.all.total.size,\n showProgress: true,\n },\n ]}\n />,\n ];\n\n return (\n <ServerAPIProvider\n api={SDK.ServerAPI.API.GetAssetsSummary}\n body={{ withFileContent: false }}\n >\n {(res) => {\n const { treeData } = getFiles(res['all'].total);\n return (\n <div className={styles.container}>\n <div className={styles.summary}>\n <Overview\n title={\n <TextDrawer\n buttonProps={{\n size: 'small',\n }}\n buttonStyle={{\n fontSize: 'inherit',\n }}\n drawerProps={{\n title: 'Files',\n }}\n text={\n <div style={{ color: '#000000a6' }}>\n <span style={{ marginRight: '5px' }}>Total Files</span>\n <RightOutlined />\n </div>\n }\n >\n <DirectoryTree\n defaultExpandAll\n selectable={false}\n treeData={treeData}\n rootStyle={{\n minHeight: '800px',\n border: '1px solid rgba(235, 237, 241)',\n }}\n />\n </TextDrawer>\n }\n description={\n <>\n <span className={styles.description}>{totalSize}</span>\n <span className={styles.unit}>{totalSizeUnit}</span>\n <div className={styles.totalNumber}>\n <span style={{ marginRight: '7px' }}>\n Number of files\n </span>\n <span style={{ fontWeight: 500 }}>\n {summary.all.total.count}\n </span>\n </div>\n </>\n }\n icon={\n <Avatar\n style={{ background: '#3874F6' }}\n shape=\"circle\"\n icon={<FileFilled style={{ fontSize: '18px' }} />}\n />\n }\n style={{\n marginBottom: '12px',\n minWidth: '210px',\n }}\n />\n <Overview\n style={{ minWidth: '210px' }}\n title={\n <div style={{ margin: '4px 0' }}>\n <span style={{ marginRight: '5px' }}>\n Duplicate Packages\n </span>\n </div>\n }\n description={duplicatePackages.length}\n icon={\n <Avatar\n style={{ background: '#13C2C2' }}\n shape=\"circle\"\n icon={<GoldenFilled style={{ fontSize: '18px' }} />}\n />\n }\n />\n </div>\n <Divider style={{ height: '200px' }} type=\"vertical\" />\n <div className={styles.chartsContainer}>\n {arr.map((e, idx) => (\n <>\n <div key={idx} className={styles.chart}>\n {e}\n </div>\n {idx !== arr.length - 1 ? (\n <Divider\n key={`${idx}-divider`}\n style={{ height: '200px' }}\n type=\"vertical\"\n />\n ) : null}\n </>\n ))}\n </div>\n </div>\n );\n }}\n </ServerAPIProvider>\n );\n};\n"],"names":["DirectoryTree","Tree","useToken","theme","innerWidth","window","AssetCard","showProgress","data","total","tagBgColor","type","token","_tagBgColor","SizeCard","AssetCardContainer","titles","datas","bgColor","selectedTitle","setSelectedTitle","useState","idx","useMemo","currentIdx","fileType","currentData","StatisticCard","styles","Segmented","value","BundleCards","errors","summary","duplicatePackages","useDuplicatePackagesByErrors","totalSize","totalSizeUnit","formatSize","arr","ServerAPIProvider","SDK","res","treeData","getFiles","Overview","TextDrawer","RightOutlined","Avatar","FileFilled","GoldenFilled","Divider","e"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,EAAEA,eAAAA,aAAa,EAAE,GAAGC;AAC1B,MAAM,EAAEC,UAAAA,QAAQ,EAAE,GAAGC;AACrB,MAAM,EAAEC,YAAAA,gBAAU,EAAE,GAAGC;AAUvB,MAAMC,YAAiC,CAAC,EACtCC,eAAe,KAAK,EACpBC,IAAI,EACJC,KAAK,EACLC,UAAU,EACVC,IAAI,EACL;IACC,MAAM,EAAEC,KAAK,EAAE,GAAGV;IAClB,MAAMW,cAAcH,cAAcE,MAAM,uBAAuB;IAC/D,OAAO,WAAP,GACE,IAACE,UAAQA;QACP,MAAMH;QACN,OAAOH,KAAK,KAAK;QACjB,OAAOC;QACP,cAAcF;QACd,YAAYM;;AAGlB;AAEA,MAAME,qBAKD,CAAC,EAAEC,MAAM,EAAEC,KAAK,EAAEC,OAAO,EAAEP,IAAI,EAAE;IACpC,MAAM,CAACQ,eAAeC,iBAAiB,GAAGC,SAASL,MAAM,CAAC,EAAE;IAC5D,MAAMM,MAAMC,QACV,IAAMP,OAAO,OAAO,CAACG,gBACrB;QAACH;QAAQG;KAAc;IAEzB,MAAMK,aAAaF,OAAO,IAAIA,MAAM;IACpC,MAAMG,WAAWd,QAAQQ,iBAAiBH,MAAM,CAAC,EAAE;IAGnD,MAAMU,cACJF,cAAc,KAAKA,aAAaP,MAAM,MAAM,GACxCA,KAAK,CAACO,WAAW,GACjBP,KAAK,CAAC,EAAE,IAAI,CAAC;IAEnB,OAAO,WAAP,GACE,IAACU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a,GAAG9B,MAAAA,WAAAA,GACX;;kDACE,IAAC;wCAAc,WAAWM,YAAAA,KAAY;kDACnCwB;uCADO9B;oCAGTA,QAAQiB,IAAI,MAAM,GAAG,IAAI,WAAJ,GACpB,IAACY,SAAOA;wCAEN,OAAO;4CAAE,QAAQ;wCAAQ;wCACzB,MAAK;uCAFA,GAAG7B,IAAI,QAAQ,CAAC,IAIrB;;;;;;QAMhB;;AAGN"}
|
|
1
|
+
{"version":3,"file":"pages/BundleSize/components/cards.mjs","sources":["../../../../src/pages/BundleSize/components/cards.tsx"],"sourcesContent":["/* rslint-disable react/jsx-key */\nimport React, { useState, useMemo } from 'react';\nimport { Divider, Segmented, Avatar, Tree } from 'antd';\nimport { Client, SDK } from '@rsdoctor/types';\nimport { RightOutlined, FileFilled, GoldenFilled } from '@ant-design/icons';\n\nimport {\n formatSize,\n useDuplicatePackagesByErrors,\n useThemeToken,\n} from '../../../utils';\nimport { StatisticCard } from '../../../components/Card/statistic';\nimport { SizeCard, bgColorType } from '../../../components/Card/size';\nimport Overview from '../../../components/Overall/overview';\nimport { ServerAPIProvider } from '../../../components/Manifest';\nimport { getFiles } from '../../..//components/Overall';\nimport { TextDrawer } from '../../..//components/TextDrawer';\n\nimport styles from './card.module.scss';\n\nconst { DirectoryTree } = Tree;\nconst { innerWidth } = window;\n\ninterface CardProps {\n showProgress?: boolean;\n data: Client.RsdoctorClientAssetsSummary['all']['total'];\n total: number;\n tagBgColor?: string;\n type?: string;\n}\n\nconst AssetCard: React.FC<CardProps> = ({\n showProgress = false,\n data,\n total,\n tagBgColor,\n type,\n}) => {\n const token = useThemeToken();\n const _tagBgColor = tagBgColor || token.colorPrimaryBorderHover;\n return (\n <SizeCard\n type={type!}\n files={data.files}\n total={total}\n showProgress={showProgress}\n tagBgColor={_tagBgColor}\n />\n );\n};\n\nconst AssetCardContainer: React.FC<{\n type?: string;\n titles: string[];\n datas: CardProps[];\n bgColor?: bgColorType;\n}> = ({ titles, datas, bgColor, type }) => {\n const [selectedTitle, setSelectedTitle] = useState(titles[0]);\n const idx = useMemo(\n () => titles.indexOf(selectedTitle),\n [titles, selectedTitle],\n );\n const currentIdx = idx >= 0 ? idx : 0;\n const fileType = type || selectedTitle || titles[0];\n\n // Add bounds checking to prevent accessing undefined data\n const currentData =\n currentIdx >= 0 && currentIdx < datas.length\n ? datas[currentIdx]\n : datas[0] || {};\n\n return (\n <StatisticCard\n title={\n <div className={styles.cardTitle}>\n <div className={styles.title}>{fileType}</div>\n {titles.length > 1 ? (\n <Segmented\n defaultValue={titles[0]}\n options={titles}\n onChange={(value) => {\n setSelectedTitle(value as string);\n }}\n size=\"small\"\n style={{ transition: 'transform 0.3s ease' }}\n value={selectedTitle}\n />\n ) : null}\n </div>\n }\n value={\n <AssetCard\n type={fileType}\n {...currentData}\n tagBgColor={bgColor?.tagBgColor}\n />\n }\n boxProps={{\n style: {\n background: bgColor?.bgColor,\n width: innerWidth > 1300 ? '80%' : '95%',\n },\n }}\n />\n );\n};\n\nexport const BundleCards: React.FC<{\n cwd: string;\n errors: SDK.ErrorsData;\n summary: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetAssetsSummary>;\n}> = ({ errors, summary }) => {\n const duplicatePackages = useDuplicatePackagesByErrors(errors);\n const [totalSize, totalSizeUnit] = formatSize(summary.all.total.size).split(\n ' ',\n );\n\n const arr = [\n <AssetCardContainer\n type={'JS'}\n titles={['Total', 'Initial']}\n datas={[\n {\n data: summary.js.total,\n total: summary.all.total.size,\n showProgress: true,\n },\n {\n data: summary.js.initial,\n total: summary.all.total.size,\n showProgress: true,\n },\n ]}\n />,\n <AssetCardContainer\n type={'CSS'}\n titles={['Total', 'Initial']}\n datas={[\n {\n data: summary.css.total,\n total: summary.all.total.size,\n showProgress: true,\n },\n {\n data: summary.css.initial,\n total: summary.all.total.size,\n showProgress: true,\n },\n ]}\n />,\n <AssetCardContainer\n titles={['Images', 'Fonts', 'Media']}\n datas={[\n {\n data: summary.imgs.total,\n total: summary.all.total.size,\n showProgress: true,\n },\n {\n data: summary.fonts.total,\n total: summary.all.total.size,\n showProgress: true,\n },\n {\n data: summary.media.total,\n total: summary.all.total.size,\n showProgress: true,\n },\n ]}\n />,\n <AssetCardContainer\n type={'HTML'}\n titles={['HTML Files']}\n datas={[\n {\n data: summary.html.total,\n total: summary.all.total.size,\n showProgress: true,\n },\n ]}\n />,\n ];\n\n return (\n <ServerAPIProvider\n api={SDK.ServerAPI.API.GetAssetsSummary}\n body={{ withFileContent: false }}\n >\n {(res) => {\n const { treeData } = getFiles(res['all'].total);\n return (\n <div className={styles.container}>\n <div className={styles.summary}>\n <Overview\n title={\n <TextDrawer\n buttonProps={{\n size: 'small',\n }}\n buttonStyle={{\n fontSize: 'inherit',\n }}\n drawerProps={{\n title: 'Files',\n }}\n text={\n <div style={{ color: 'var(--text-color-secondary)' }}>\n <span style={{ marginRight: '5px' }}>Total Files</span>\n <RightOutlined />\n </div>\n }\n >\n <DirectoryTree\n defaultExpandAll\n selectable={false}\n treeData={treeData}\n rootStyle={{\n minHeight: '800px',\n border: '1px solid var(--color-border)',\n }}\n />\n </TextDrawer>\n }\n description={\n <>\n <span className={styles.description}>{totalSize}</span>\n <span className={styles.unit}>{totalSizeUnit}</span>\n <div className={styles.totalNumber}>\n <span style={{ marginRight: '7px' }}>\n Number of files\n </span>\n <span style={{ fontWeight: 500 }}>\n {summary.all.total.count}\n </span>\n </div>\n </>\n }\n icon={\n <Avatar\n style={{ background: '#3874F6' }}\n shape=\"circle\"\n icon={<FileFilled style={{ fontSize: '18px' }} />}\n />\n }\n style={{\n marginBottom: '12px',\n minWidth: '210px',\n }}\n />\n <Overview\n style={{ minWidth: '210px' }}\n title={\n <div style={{ margin: '4px 0' }}>\n <span style={{ marginRight: '5px' }}>\n Duplicate Packages\n </span>\n </div>\n }\n description={duplicatePackages.length}\n icon={\n <Avatar\n style={{ background: '#13C2C2' }}\n shape=\"circle\"\n icon={<GoldenFilled style={{ fontSize: '18px' }} />}\n />\n }\n />\n </div>\n <Divider style={{ height: '200px' }} type=\"vertical\" />\n <div className={styles.chartsContainer}>\n {arr.map((e, idx) => (\n <>\n <div key={idx} className={styles.chart}>\n {e}\n </div>\n {idx !== arr.length - 1 ? (\n <Divider\n key={`${idx}-divider`}\n style={{ height: '200px' }}\n type=\"vertical\"\n />\n ) : null}\n </>\n ))}\n </div>\n </div>\n );\n }}\n </ServerAPIProvider>\n );\n};\n"],"names":["DirectoryTree","Tree","innerWidth","window","AssetCard","showProgress","data","total","tagBgColor","type","token","useThemeToken","_tagBgColor","SizeCard","AssetCardContainer","titles","datas","bgColor","selectedTitle","setSelectedTitle","useState","idx","useMemo","currentIdx","fileType","currentData","StatisticCard","styles","Segmented","value","BundleCards","errors","summary","duplicatePackages","useDuplicatePackagesByErrors","totalSize","totalSizeUnit","formatSize","arr","ServerAPIProvider","SDK","res","treeData","getFiles","Overview","TextDrawer","RightOutlined","Avatar","FileFilled","GoldenFilled","Divider","e"],"mappings":";;;;;;;;;;;;;AAoBA,MAAM,EAAEA,eAAAA,aAAa,EAAE,GAAGC;AAC1B,MAAM,EAAEC,YAAAA,gBAAU,EAAE,GAAGC;AAUvB,MAAMC,YAAiC,CAAC,EACtCC,eAAe,KAAK,EACpBC,IAAI,EACJC,KAAK,EACLC,UAAU,EACVC,IAAI,EACL;IACC,MAAMC,QAAQC;IACd,MAAMC,cAAcJ,cAAcE,MAAM,uBAAuB;IAC/D,OAAO,WAAP,GACE,IAACG,UAAQA;QACP,MAAMJ;QACN,OAAOH,KAAK,KAAK;QACjB,OAAOC;QACP,cAAcF;QACd,YAAYO;;AAGlB;AAEA,MAAME,qBAKD,CAAC,EAAEC,MAAM,EAAEC,KAAK,EAAEC,OAAO,EAAER,IAAI,EAAE;IACpC,MAAM,CAACS,eAAeC,iBAAiB,GAAGC,SAASL,MAAM,CAAC,EAAE;IAC5D,MAAMM,MAAMC,QACV,IAAMP,OAAO,OAAO,CAACG,gBACrB;QAACH;QAAQG;KAAc;IAEzB,MA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AU;oCAC/B,OAAM;oCACN,oBAAM,IAACE,cAAYA;wCAAC,OAAO;4CAAE,UAAU;wCAAO;;;;;;kCAKtD,IAACC,SAAOA;wBAAC,OAAO;4BAAE,QAAQ;wBAAQ;wBAAG,MAAK;;kCAC1C,IAAC;wBAAI,WAAWvB,YAAAA,eAAsB;kCACnCW,IAAI,GAAG,CAAC,CAACa,GAAG9B,MAAAA,WAAAA,GACX;;kDACE,IAAC;wCAAc,WAAWM,YAAAA,KAAY;kDACnCwB;uCADO9B;oCAGTA,QAAQiB,IAAI,MAAM,GAAG,IAAI,WAAJ,GACpB,IAACY,SAAOA;wCAEN,OAAO;4CAAE,QAAQ;wCAAQ;wCACzB,MAAK;uCAFA,GAAG7B,IAAI,QAAQ,CAAC,IAIrB;;;;;;QAMhB;;AAGN"}
|
|
@@ -5,17 +5,20 @@ import { Button, Card, Col, Row, Space, Tabs, Tag, Tooltip, Typography } from "a
|
|
|
5
5
|
import react, { useId } from "react";
|
|
6
6
|
import { ServerAPIProvider } from "../../../components/Manifest/index.mjs";
|
|
7
7
|
import { useProjectInfo } from "../../../components/Layout/project-info-context.mjs";
|
|
8
|
-
import { flattenTreemapData, usePersistedState } from "../../../utils/index.mjs";
|
|
8
|
+
import { flattenTreemapData, usePersistedState, useTheme } from "../../../utils/index.mjs";
|
|
9
9
|
import { BundleCards } from "./cards.mjs";
|
|
10
10
|
import index_module from "./index.module.mjs";
|
|
11
11
|
import "./index.css";
|
|
12
12
|
import { AssetTreemapWithFilter } from "../../../components/Charts/TreeMap.mjs";
|
|
13
13
|
import { Rspack } from "@rsdoctor/utils/common";
|
|
14
14
|
import { TreeGraph } from "./tree-graph.mjs";
|
|
15
|
+
import { isJavaScriptAsset } from "../../../utils/assets.mjs";
|
|
15
16
|
const WebpackModulesOverallBase = ({ errors, cwd, summary, entryPoints })=>{
|
|
16
17
|
const [expanded, setExpanded] = usePersistedState('bundle-size-tabs-card-expanded', false);
|
|
17
18
|
const cardDomId = useId();
|
|
18
19
|
const expandActionText = expanded ? 'Shrink card' : 'Expand card';
|
|
20
|
+
const { isLight } = useTheme();
|
|
21
|
+
const treeGraphTooltipColor = isLight ? 'white' : void 0;
|
|
19
22
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
20
23
|
children: [
|
|
21
24
|
/*#__PURE__*/ jsx(react.Activity, {
|
|
@@ -64,10 +67,10 @@ const WebpackModulesOverallBase = ({ errors, cwd, summary, entryPoints })=>{
|
|
|
64
67
|
marginLeft: 16,
|
|
65
68
|
padding: 10
|
|
66
69
|
},
|
|
67
|
-
color:
|
|
70
|
+
color: treeGraphTooltipColor,
|
|
68
71
|
title: /*#__PURE__*/ jsxs(Space, {
|
|
69
72
|
direction: "vertical",
|
|
70
|
-
color:
|
|
73
|
+
color: treeGraphTooltipColor,
|
|
71
74
|
size: "middle",
|
|
72
75
|
children: [
|
|
73
76
|
/*#__PURE__*/ jsx(Row, {
|
|
@@ -110,7 +113,7 @@ const WebpackModulesOverallBase = ({ errors, cwd, summary, entryPoints })=>{
|
|
|
110
113
|
maxWidth: 408
|
|
111
114
|
},
|
|
112
115
|
placement: "bottom",
|
|
113
|
-
color:
|
|
116
|
+
color: treeGraphTooltipColor,
|
|
114
117
|
title: /*#__PURE__*/ jsx(Space, {
|
|
115
118
|
direction: "vertical",
|
|
116
119
|
color: "white",
|
|
@@ -128,11 +131,12 @@ const WebpackModulesOverallBase = ({ errors, cwd, summary, entryPoints })=>{
|
|
|
128
131
|
})
|
|
129
132
|
})
|
|
130
133
|
}),
|
|
131
|
-
children: /*#__PURE__*/ jsx(
|
|
134
|
+
children: /*#__PURE__*/ jsx(Typography.Text, {
|
|
135
|
+
type: "secondary",
|
|
132
136
|
style: {
|
|
133
|
-
color: 'rgba(0,0,0,.45)',
|
|
134
137
|
marginLeft: 4
|
|
135
|
-
}
|
|
138
|
+
},
|
|
139
|
+
children: /*#__PURE__*/ jsx(InfoCircleOutlined, {})
|
|
136
140
|
})
|
|
137
141
|
}),
|
|
138
142
|
/*#__PURE__*/ jsx(Typography.Text, {
|
|
@@ -203,7 +207,7 @@ const WebpackModulesOverallBase = ({ errors, cwd, summary, entryPoints })=>{
|
|
|
203
207
|
}),
|
|
204
208
|
children: /*#__PURE__*/ jsx(InfoCircleOutlined, {
|
|
205
209
|
style: {
|
|
206
|
-
color: '
|
|
210
|
+
color: 'var(--text-color-secondary)'
|
|
207
211
|
}
|
|
208
212
|
})
|
|
209
213
|
})
|
|
@@ -225,11 +229,11 @@ const WebpackModulesOverallBase = ({ errors, cwd, summary, entryPoints })=>{
|
|
|
225
229
|
return /*#__PURE__*/ jsx(ServerAPIProvider, {
|
|
226
230
|
api: SDK.ServerAPI.API.GetSummaryBundles,
|
|
227
231
|
children: (data)=>{
|
|
228
|
-
const
|
|
232
|
+
const isVisibleTreemapAsset = (filePath)=>{
|
|
229
233
|
const ext = filePath.toLowerCase().split('.').pop() || '';
|
|
230
|
-
return
|
|
234
|
+
return isJavaScriptAsset(filePath) || 'css' === ext || 'html' === ext;
|
|
231
235
|
};
|
|
232
|
-
const computedTreeData = data.filter((item)=>
|
|
236
|
+
const computedTreeData = data.filter((item)=>isVisibleTreemapAsset(item.asset.path)).map((item)=>{
|
|
233
237
|
const moduleTree = flattenTreemapData(item.modules);
|
|
234
238
|
const hasModules = item.modules.length > 0;
|
|
235
239
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages/BundleSize/components/index.mjs","sources":["../../../../src/pages/BundleSize/components/index.tsx"],"sourcesContent":["import {\n CodepenCircleOutlined,\n DeploymentUnitOutlined,\n InfoCircleOutlined,\n ShrinkOutlined,\n ArrowsAltOutlined,\n} from '@ant-design/icons';\nimport { type Client, SDK } from '@rsdoctor/types';\nimport {\n Button,\n Card,\n Col,\n Row,\n Space,\n Tag,\n Tooltip,\n Typography,\n Tabs,\n} from 'antd';\nimport React, { useId } from 'react';\nimport { ServerAPIProvider } from '../../../components/Manifest';\nimport { useProjectInfo } from '../../../components/Layout/project-info-context';\nimport { flattenTreemapData, usePersistedState } from '../../../utils';\nimport { BundleCards } from './cards';\nimport styles from './index.module.scss';\nimport './index.sass';\nimport {\n AssetTreemapWithFilter,\n TreeNode,\n} from 'src/components/Charts/TreeMap';\nimport { Rspack } from '@rsdoctor/utils/common';\nimport { TreeGraph } from './tree-graph';\n\ninterface WebpackModulesOverallProps {\n cwd: string;\n errors: SDK.ErrorsData;\n summary: Client.RsdoctorClientAssetsSummary;\n entryPoints: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetEntryPoints>;\n}\n\nexport const WebpackModulesOverallBase: React.FC<\n WebpackModulesOverallProps\n> = ({ errors, cwd, summary, entryPoints }) => {\n const [expanded, setExpanded] = usePersistedState(\n 'bundle-size-tabs-card-expanded',\n false,\n );\n const cardDomId = useId();\n const expandActionText = expanded ? 'Shrink card' : 'Expand card';\n return (\n <>\n <React.Activity mode={expanded ? 'hidden' : 'visible'}>\n <BundleCards cwd={cwd} errors={errors} summary={summary} />\n </React.Activity>\n <Card\n className={styles.root}\n classNames={{ body: styles.rootBody }}\n id={cardDomId}\n >\n <Tabs\n size=\"middle\"\n className={styles.tabsRoot}\n tabBarExtraContent={{\n right: (\n <Tooltip\n // the content collapses/expands, but the cursor stays at the same position (outside the button now, cause layout has shifted)\n // antd doesn't know that and keeps the tooltip open, so we need to force rerender it on every state change\n key={String(expanded)}\n title={expandActionText}\n >\n <Button\n // TODO:: does it make sense here? the content basically stays the same and we're actually controlling other elements\n aria-controls={cardDomId}\n aria-expanded={expanded}\n aria-label={expandActionText}\n onClick={() => setExpanded(!expanded)}\n icon={expanded ? <ShrinkOutlined /> : <ArrowsAltOutlined />}\n size=\"small\"\n ></Button>\n </Tooltip>\n ),\n }}\n items={[\n {\n key: 'tree',\n label: (\n <Space>\n <Typography.Text>Tree Graph</Typography.Text>\n <Tooltip\n overlayStyle={{ maxWidth: 380 }}\n overlayInnerStyle={{ marginLeft: 16, padding: 10 }}\n color=\"white\"\n title={\n <Space direction=\"vertical\" color=\"white\" size=\"middle\">\n <Row>\n <Col>\n <Tag color=\"cyan\" style={{ margin: 0 }}>\n initial\n </Tag>\n <Typography.Text style={{ marginLeft: 4 }}>\n Identify whether the chunk is an initial chunk.\n </Typography.Text>\n </Col>\n </Row>\n <Row>\n <Col>\n <Tag color=\"green\" style={{ margin: 0 }}>\n concatenated\n </Tag>\n <Typography.Text style={{ marginLeft: 4 }}>\n Identify whether the module is a concatenated\n module\n </Typography.Text>\n <Tooltip\n overlayStyle={{ maxWidth: 408 }}\n placement=\"bottom\"\n color=\"white\"\n title={\n <Space direction=\"vertical\" color=\"white\">\n <Row>\n <Col>\n <Typography.Text strong>\n Concatenated Module\n </Typography.Text>\n <Typography.Text>\n : A performance optimization where\n multiple modules are merged (or\n \"hoisted\") into a single scope instead\n of wrapping each module in separate\n function closures. This reduces the\n bundle size and improves runtime\n performance by minimizing function call\n overhead.\n </Typography.Text>\n </Col>\n </Row>\n </Space>\n }\n >\n <InfoCircleOutlined\n style={{\n color: 'rgba(0,0,0,.45)',\n marginLeft: 4,\n }}\n />\n </Tooltip>\n <Typography.Text>.</Typography.Text>\n </Col>\n </Row>\n <Row>\n <Col>\n <Button\n size=\"small\"\n icon={<CodepenCircleOutlined />}\n />\n <Typography.Text style={{ marginLeft: 4 }}>\n Open the code.\n </Typography.Text>\n </Col>\n </Row>\n <Row>\n <Col>\n <Button\n size=\"small\"\n icon={<DeploymentUnitOutlined />}\n />\n <Typography.Text style={{ marginLeft: 4 }}>\n View the module dependency, that is, module\n reasons in stats.json.\n </Typography.Text>\n </Col>\n </Row>\n <Row>\n <Col>\n <Tag color={'purple'}>{'Bundled: 15.77 KB'}</Tag>\n <Typography.Text>\n The final size of the output files after\n processing, bundling, and optimization. This is\n what is delivered to the browser.\n </Typography.Text>\n </Col>\n </Row>\n <Row>\n <Col>\n <Tag color={'orange'}>{'Source: 60.46 KB'}</Tag>\n <Typography.Text>\n The original size of your source code files before\n any processing or transformations. This is the raw\n size of your code as you wrote it.\n </Typography.Text>\n </Col>\n </Row>\n </Space>\n }\n >\n <InfoCircleOutlined style={{ color: 'rgba(0,0,0,.45)' }} />\n </Tooltip>\n </Space>\n ),\n children: (\n <TreeGraph\n entryPoints={entryPoints}\n cwd={cwd}\n summary={summary}\n />\n ),\n },\n {\n key: 'treemap',\n label: 'Treemap',\n children: (\n <ServerAPIProvider api={SDK.ServerAPI.API.GetProjectInfo}>\n {(data) => {\n const { isRspack, hasSourceMap } =\n Rspack.checkSourceMapSupport(data.configs);\n return (\n <ServerAPIProvider\n api={SDK.ServerAPI.API.GetSummaryBundles}\n >\n {(data) => {\n // Filter assets to only show JS (js, cjs, mjs), .bundle, CSS, and HTML files\n const isTargetFileType = (\n filePath: string,\n ): boolean => {\n const ext =\n filePath.toLowerCase().split('.').pop() || '';\n return (\n ext === 'js' ||\n ext === 'cjs' ||\n ext === 'mjs' ||\n ext === 'bundle' ||\n ext === 'css' ||\n ext === 'html'\n );\n };\n\n const computedTreeData: TreeNode[] = data\n .filter((item) => isTargetFileType(item.asset.path))\n .map((item) => {\n const moduleTree = flattenTreemapData(\n item.modules,\n );\n const hasModules = item.modules.length > 0;\n return {\n name: item.asset.path,\n sourceSize: hasModules\n ? (moduleTree.sourceSize ?? 0)\n : item.asset.size,\n bundledSize: item.asset.size,\n gzipSize: item.asset.gzipSize ?? 0,\n children: moduleTree.children,\n };\n });\n return (\n <AssetTreemapWithFilter\n treeData={computedTreeData}\n bundledSize={hasSourceMap || isRspack}\n />\n );\n }}\n </ServerAPIProvider>\n );\n }}\n </ServerAPIProvider>\n ),\n },\n ]}\n defaultActiveKey=\"tree\"\n />\n </Card>\n </>\n );\n};\n\nexport const WebpackModulesOverall: React.FC = () => {\n const { project } = useProjectInfo();\n\n if (!project) {\n return null;\n }\n\n const { root, errors } = project;\n return (\n <ServerAPIProvider\n api={SDK.ServerAPI.API.GetAssetsSummary}\n body={{ withFileContent: true }}\n >\n {(summary) => {\n return (\n <ServerAPIProvider api={SDK.ServerAPI.API.GetEntryPoints}>\n {(entryPoints) => (\n <WebpackModulesOverallBase\n cwd={root}\n errors={errors}\n summary={summary}\n entryPoints={entryPoints}\n />\n )}\n </ServerAPIProvider>\n );\n }}\n </ServerAPIProvider>\n );\n};\n"],"names":["WebpackModulesOverallBase","errors","cwd","summary","entryPoints","expanded","setExpanded","usePersistedState","cardDomId","useId","expandActionText","React","BundleCards","Card","styles","Tabs","Tooltip","Button","ShrinkOutlined","ArrowsAltOutlined","String","Space","Typography","Row","Col","Tag","InfoCircleOutlined","CodepenCircleOutlined","DeploymentUnitOutlined","TreeGraph","ServerAPIProvider","SDK","data","isRspack","hasSourceMap","Rspack","isTargetFileType","filePath","ext","computedTreeData","item","moduleTree","flattenTreemapData","hasModules","AssetTreemapWithFilter","WebpackModulesOverall","project","useProjectInfo","root"],"mappings":";;;;;;;;;;;;;;AAwCO,MAAMA,4BAET,CAAC,EAAEC,MAAM,EAAEC,GAAG,EAAEC,OAAO,EAAEC,WAAW,EAAE;IACxC,MAAM,CAACC,UAAUC,YAAY,GAAGC,kBAC9B,kCACA;IAEF,MAAMC,YAAYC;IAClB,MAAMC,mBAAmBL,WAAW,gBAAgB;IACpD,OAAO,WAAP,GACE;;0BACE,IAACM,MAAAA,QAAc;gBAAC,MAAMN,WAAW,WAAW;0BAC1C,kBAACO,aAAWA;oBAAC,KAAKV;oBAAK,QAAQD;oBAAQ,SAASE;;;0BAElD,IAACU,MAAIA;gBACH,WAAWC,aAAAA,IAAW;gBACtB,YAAY;oBAAE,MAAMA,aAAAA,QAAe;gBAAC;gBACpC,IAAIN;0BAEJ,kBAACO,MAAIA;oBACH,MAAK;oBACL,WAAWD,aAAAA,QAAe;oBAC1B,oBAAoB;wBAClB,OAAO,WAAP,GACE,IAACE,SAAOA;4BAIN,OAAON;sCAEP,kBAACO,QAAMA;gCAEL,iBAAeT;gCACf,iBAAeH;gCACf,cAAYK;gCACZ,SAAS,IAAMJ,YAAY,CAACD;gCAC5B,MAAMA,WAAW,WAAXA,GA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;4CAEA,MAAMC,mBAA+BP,KAClC,MAAM,CAAC,CAACQ,OAASJ,iBAAiBI,KAAK,KAAK,CAAC,IAAI,GACjD,GAAG,CAAC,CAACA;gDACJ,MAAMC,aAAaC,mBACjBF,KAAK,OAAO;gDAEd,MAAMG,aAAaH,KAAK,OAAO,CAAC,MAAM,GAAG;gDACzC,OAAO;oDACL,MAAMA,KAAK,KAAK,CAAC,IAAI;oDACrB,YAAYG,aACPF,WAAW,UAAU,IAAI,IAC1BD,KAAK,KAAK,CAAC,IAAI;oDACnB,aAAaA,KAAK,KAAK,CAAC,IAAI;oDAC5B,UAAUA,KAAK,KAAK,CAAC,QAAQ,IAAI;oDACjC,UAAUC,WAAW,QAAQ;gDAC/B;4CACF;4CACF,OAAO,WAAP,GACE,IAACG,wBAAsBA;gDACrB,UAAUL;gDACV,aAAaL,gBAAgBD;;wCAGnC;;gCAGN;;wBAGN;qBACD;oBACD,kBAAiB;;;;;AAK3B;AAEO,MAAMY,wBAAkC;IAC7C,MAAM,EAAEC,OAAO,EAAE,GAAGC;IAEpB,IAAI,CAACD,SACH,OAAO;IAGT,MAAM,EAAEE,IAAI,EAAE/C,MAAM,EAAE,GAAG6C;IACzB,OAAO,WAAP,GACE,IAAChB,mBAAiBA;QAChB,KAAKC,IAAI,SAAS,CAAC,GAAG,CAAC,gBAAgB;QACvC,MAAM;YAAE,iBAAiB;QAAK;kBAE7B,CAAC5B,UACO,WAAP,GACE,IAAC2B,mBAAiBA;gBAAC,KAAKC,IAAI,SAAS,CAAC,GAAG,CAAC,cAAc;0BACrD,CAAC3B,cAAAA,WAAAA,GACA,IAACJ,2BAAyBA;wBACxB,KAAKgD;wBACL,QAAQ/C;wBACR,SAASE;wBACT,aAAaC;;;;AAQ7B"}
|
|
1
|
+
{"version":3,"file":"pages/BundleSize/components/index.mjs","sources":["../../../../src/pages/BundleSize/components/index.tsx"],"sourcesContent":["import {\n CodepenCircleOutlined,\n DeploymentUnitOutlined,\n InfoCircleOutlined,\n ShrinkOutlined,\n ArrowsAltOutlined,\n} from '@ant-design/icons';\nimport { type Client, SDK } from '@rsdoctor/types';\nimport {\n Button,\n Card,\n Col,\n Row,\n Space,\n Tag,\n Tooltip,\n Typography,\n Tabs,\n} from 'antd';\nimport React, { useId } from 'react';\nimport { ServerAPIProvider } from '../../../components/Manifest';\nimport { useProjectInfo } from '../../../components/Layout/project-info-context';\nimport {\n flattenTreemapData,\n usePersistedState,\n useTheme,\n} from '../../../utils';\nimport { BundleCards } from './cards';\nimport styles from './index.module.scss';\nimport './index.sass';\nimport {\n AssetTreemapWithFilter,\n TreeNode,\n} from 'src/components/Charts/TreeMap';\nimport { Rspack } from '@rsdoctor/utils/common';\nimport { TreeGraph } from './tree-graph';\nimport { isJavaScriptAsset } from '../../../utils/assets';\n\ninterface WebpackModulesOverallProps {\n cwd: string;\n errors: SDK.ErrorsData;\n summary: Client.RsdoctorClientAssetsSummary;\n entryPoints: SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetEntryPoints>;\n}\n\nexport const WebpackModulesOverallBase: React.FC<\n WebpackModulesOverallProps\n> = ({ errors, cwd, summary, entryPoints }) => {\n const [expanded, setExpanded] = usePersistedState(\n 'bundle-size-tabs-card-expanded',\n false,\n );\n const cardDomId = useId();\n const expandActionText = expanded ? 'Shrink card' : 'Expand card';\n const { isLight } = useTheme();\n // In light mode the tooltip's background is dark and the text is also dark cause Typography is used inside. dark mode is ok\n const treeGraphTooltipColor = isLight ? 'white' : undefined;\n return (\n <>\n <React.Activity mode={expanded ? 'hidden' : 'visible'}>\n <BundleCards cwd={cwd} errors={errors} summary={summary} />\n </React.Activity>\n <Card\n className={styles.root}\n classNames={{ body: styles.rootBody }}\n id={cardDomId}\n >\n <Tabs\n size=\"middle\"\n className={styles.tabsRoot}\n tabBarExtraContent={{\n right: (\n <Tooltip\n // the content collapses/expands, but the cursor stays at the same position (outside the button now, cause layout has shifted)\n // antd doesn't know that and keeps the tooltip open, so we need to force rerender it on every state change\n key={String(expanded)}\n title={expandActionText}\n >\n <Button\n // TODO:: does it make sense here? the content basically stays the same and we're actually controlling other elements\n aria-controls={cardDomId}\n aria-expanded={expanded}\n aria-label={expandActionText}\n onClick={() => setExpanded(!expanded)}\n icon={expanded ? <ShrinkOutlined /> : <ArrowsAltOutlined />}\n size=\"small\"\n ></Button>\n </Tooltip>\n ),\n }}\n items={[\n {\n key: 'tree',\n label: (\n <Space>\n <Typography.Text>Tree Graph</Typography.Text>\n <Tooltip\n overlayStyle={{ maxWidth: 380 }}\n overlayInnerStyle={{ marginLeft: 16, padding: 10 }}\n color={treeGraphTooltipColor}\n title={\n <Space\n direction=\"vertical\"\n color={treeGraphTooltipColor}\n size=\"middle\"\n >\n <Row>\n <Col>\n <Tag color=\"cyan\" style={{ margin: 0 }}>\n initial\n </Tag>\n <Typography.Text style={{ marginLeft: 4 }}>\n Identify whether the chunk is an initial chunk.\n </Typography.Text>\n </Col>\n </Row>\n <Row>\n <Col>\n <Tag color=\"green\" style={{ margin: 0 }}>\n concatenated\n </Tag>\n <Typography.Text style={{ marginLeft: 4 }}>\n Identify whether the module is a concatenated\n module\n </Typography.Text>\n {/* TODO:: it's literally a tooltip inside another tooltip */}\n <Tooltip\n overlayStyle={{ maxWidth: 408 }}\n placement=\"bottom\"\n color={treeGraphTooltipColor}\n title={\n <Space direction=\"vertical\" color=\"white\">\n <Row>\n <Col>\n <Typography.Text strong>\n Concatenated Module\n </Typography.Text>\n <Typography.Text>\n : A performance optimization where\n multiple modules are merged (or\n \"hoisted\") into a single scope instead\n of wrapping each module in separate\n function closures. This reduces the\n bundle size and improves runtime\n performance by minimizing function call\n overhead.\n </Typography.Text>\n </Col>\n </Row>\n </Space>\n }\n >\n <Typography.Text\n type=\"secondary\"\n style={{ marginLeft: 4 }}\n >\n <InfoCircleOutlined />\n </Typography.Text>\n </Tooltip>\n <Typography.Text>.</Typography.Text>\n </Col>\n </Row>\n <Row>\n <Col>\n <Button\n size=\"small\"\n icon={<CodepenCircleOutlined />}\n />\n <Typography.Text style={{ marginLeft: 4 }}>\n Open the code.\n </Typography.Text>\n </Col>\n </Row>\n <Row>\n <Col>\n <Button\n size=\"small\"\n icon={<DeploymentUnitOutlined />}\n />\n <Typography.Text style={{ marginLeft: 4 }}>\n View the module dependency, that is, module\n reasons in stats.json.\n </Typography.Text>\n </Col>\n </Row>\n <Row>\n <Col>\n <Tag color={'purple'}>{'Bundled: 15.77 KB'}</Tag>\n <Typography.Text>\n The final size of the output files after\n processing, bundling, and optimization. This is\n what is delivered to the browser.\n </Typography.Text>\n </Col>\n </Row>\n <Row>\n <Col>\n <Tag color={'orange'}>{'Source: 60.46 KB'}</Tag>\n <Typography.Text>\n The original size of your source code files before\n any processing or transformations. This is the raw\n size of your code as you wrote it.\n </Typography.Text>\n </Col>\n </Row>\n </Space>\n }\n >\n <InfoCircleOutlined\n style={{ color: 'var(--text-color-secondary)' }}\n />\n </Tooltip>\n </Space>\n ),\n children: (\n <TreeGraph\n entryPoints={entryPoints}\n cwd={cwd}\n summary={summary}\n />\n ),\n },\n {\n key: 'treemap',\n label: 'Treemap',\n children: (\n <ServerAPIProvider api={SDK.ServerAPI.API.GetProjectInfo}>\n {(data) => {\n const { isRspack, hasSourceMap } =\n Rspack.checkSourceMapSupport(data.configs);\n return (\n <ServerAPIProvider\n api={SDK.ServerAPI.API.GetSummaryBundles}\n >\n {(data) => {\n // Filter assets to only show JS (js, cjs, mjs), .bundle, CSS, and HTML files\n const isVisibleTreemapAsset = (filePath: string) => {\n const ext =\n filePath.toLowerCase().split('.').pop() || '';\n return (\n isJavaScriptAsset(filePath) ||\n ext === 'css' ||\n ext === 'html'\n );\n };\n\n const computedTreeData: TreeNode[] = data\n .filter((item) =>\n isVisibleTreemapAsset(item.asset.path),\n )\n .map((item) => {\n const moduleTree = flattenTreemapData(\n item.modules,\n );\n const hasModules = item.modules.length > 0;\n return {\n name: item.asset.path,\n sourceSize: hasModules\n ? (moduleTree.sourceSize ?? 0)\n : item.asset.size,\n bundledSize: item.asset.size,\n gzipSize: item.asset.gzipSize ?? 0,\n children: moduleTree.children,\n };\n });\n return (\n <AssetTreemapWithFilter\n treeData={computedTreeData}\n bundledSize={hasSourceMap || isRspack}\n />\n );\n }}\n </ServerAPIProvider>\n );\n }}\n </ServerAPIProvider>\n ),\n },\n ]}\n defaultActiveKey=\"tree\"\n />\n </Card>\n </>\n );\n};\n\nexport const WebpackModulesOverall: React.FC = () => {\n const { project } = useProjectInfo();\n\n if (!project) {\n return null;\n }\n\n const { root, errors } = project;\n return (\n <ServerAPIProvider\n api={SDK.ServerAPI.API.GetAssetsSummary}\n body={{ withFileContent: true }}\n >\n {(summary) => {\n return (\n <ServerAPIProvider api={SDK.ServerAPI.API.GetEntryPoints}>\n {(entryPoints) => (\n <WebpackModulesOverallBase\n cwd={root}\n errors={errors}\n summary={summary}\n entryPoints={entryPoints}\n />\n )}\n </ServerAPIProvider>\n );\n }}\n </ServerAPIProvider>\n );\n};\n"],"names":["WebpackModulesOverallBase","errors","cwd","summary","entryPoints","expanded","setExpanded","usePersistedState","cardDomId","useId","expandActionText","isLight","useTheme","treeGraphTooltipColor","undefined","React","BundleCards","Card","styles","Tabs","Tooltip","Button","ShrinkOutlined","ArrowsAltOutlined","String","Space","Typography","Row","Col","Tag","InfoCircleOutlined","CodepenCircleOutlined","DeploymentUnitOutlined","TreeGraph","ServerAPIProvider","SDK","data","isRspack","hasSourceMap","Rspack","isVisibleTreemapAsset","filePath","ext","isJavaScriptAsset","computedTreeData","item","moduleTree","flattenTreemapData","hasModules","AssetTreemapWithFilter","WebpackModulesOverall","project","useProjectInfo","root"],"mappings":";;;;;;;;;;;;;;;AA6CO,MAAMA,4BAET,CAAC,EAAEC,MAAM,EAAEC,GAAG,EAAEC,OAAO,EAAEC,WAAW,EAAE;IACxC,MAAM,CAACC,UAAUC,YAAY,GAAGC,kBAC9B,kCACA;IAEF,MAAMC,YAAYC;IAClB,MAAMC,mBAAmBL,WAAW,gBAAgB;IACpD,MAAM,EAA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AAO;IAGT,MAAM,EAAEE,IAAI,EAAEpD,MAAM,EAAE,GAAGkD;IACzB,OAAO,WAAP,GACE,IAACjB,mBAAiBA;QAChB,KAAKC,IAAI,SAAS,CAAC,GAAG,CAAC,gBAAgB;QACvC,MAAM;YAAE,iBAAiB;QAAK;kBAE7B,CAAChC,UACO,WAAP,GACE,IAAC+B,mBAAiBA;gBAAC,KAAKC,IAAI,SAAS,CAAC,GAAG,CAAC,cAAc;0BACrD,CAAC/B,cAAAA,WAAAA,GACA,IAACJ,2BAAyBA;wBACxB,KAAKqD;wBACL,QAAQpD;wBACR,SAASE;wBACT,aAAaC;;;;AAQ7B"}
|
|
@@ -13,12 +13,7 @@ const index_module = {
|
|
|
13
13
|
assets: "assets-ll1P_L",
|
|
14
14
|
assetBox: "assetBox-Y8vGse",
|
|
15
15
|
fileText: "fileText-W0quVZ",
|
|
16
|
-
assetsTag: "assetsTag-eAVvyj"
|
|
17
|
-
modal: "modal-afyzYa",
|
|
18
|
-
"search-btn": "search-btn-To902q",
|
|
19
|
-
searchBtn: "search-btn-To902q",
|
|
20
|
-
"search-modal-list": "search-modal-list-G_Uxc8",
|
|
21
|
-
searchModalList: "search-modal-list-G_Uxc8"
|
|
16
|
+
assetsTag: "assetsTag-eAVvyj"
|
|
22
17
|
};
|
|
23
18
|
export default index_module;
|
|
24
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages/BundleSize/components/index.module.mjs","sources":["../../../../src/pages/BundleSize/components/index.module.scss"],"sourcesContent":["// extracted by LIB_CSS_EXTRACT_LOADER\nimport \"./index_module.css\"\nexport default {\"root\":\"root-DgXuux\",\"rootBody\":\"rootBody-xGjkG7\",\"treeGraph\":\"treeGraph-LllSyP\",\"tabsRoot\":\"tabsRoot-gPEaze\",\"assetDetailCol\":\"assetDetailCol-jwyTZJ\",\"assetDetailFileTreeRoot\":\"assetDetailFileTreeRoot-RBNnA8\",\"assetDetailFileTreeBody\":\"assetDetailFileTreeBody-kRMd_h\",\"assetDetailFileTreeViewport\":\"assetDetailFileTreeViewport-USNF6e\",\"assetDetailRoot\":\"assetDetailRoot-dgQPS5\",\"assetDetailFileTreeScrollArea\":\"assetDetailFileTreeScrollArea-IqDzT3\",\"assets\":\"assets-ll1P_L\",\"assetBox\":\"assetBox-Y8vGse\",\"fileText\":\"fileText-W0quVZ\",\"assetsTag\":\"assetsTag-eAVvyj\"
|
|
1
|
+
{"version":3,"file":"pages/BundleSize/components/index.module.mjs","sources":["../../../../src/pages/BundleSize/components/index.module.scss"],"sourcesContent":["// extracted by LIB_CSS_EXTRACT_LOADER\nimport \"./index_module.css\"\nexport default {\"root\":\"root-DgXuux\",\"rootBody\":\"rootBody-xGjkG7\",\"treeGraph\":\"treeGraph-LllSyP\",\"tabsRoot\":\"tabsRoot-gPEaze\",\"assetDetailCol\":\"assetDetailCol-jwyTZJ\",\"assetDetailFileTreeRoot\":\"assetDetailFileTreeRoot-RBNnA8\",\"assetDetailFileTreeBody\":\"assetDetailFileTreeBody-kRMd_h\",\"assetDetailFileTreeViewport\":\"assetDetailFileTreeViewport-USNF6e\",\"assetDetailRoot\":\"assetDetailRoot-dgQPS5\",\"assetDetailFileTreeScrollArea\":\"assetDetailFileTreeScrollArea-IqDzT3\",\"assets\":\"assets-ll1P_L\",\"assetBox\":\"assetBox-Y8vGse\",\"fileText\":\"fileText-W0quVZ\",\"assetsTag\":\"assetsTag-eAVvyj\"};"],"names":[],"mappings":";AAEA,qBAAe;IAAC,MAAO;IAAc,UAAW;IAAkB,WAAY;IAAmB,UAAW;IAAkB,gBAAiB;IAAwB,yBAA0B;IAAiC,yBAA0B;IAAiC,6BAA8B;IAAqC,iBAAkB;IAAyB,+BAAgC;IAAuC,QAAS;IAAgB,UAAW;IAAkB,UAAW;IAAkB,WAAY;AAAkB"}
|
|
@@ -86,42 +86,5 @@
|
|
|
86
86
|
margin-inline: 0;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
.modal-afyzYa .ant-input-affix-wrapper {
|
|
90
|
-
width: 490px;
|
|
91
|
-
padding: 4px 5px;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.search-btn-To902q {
|
|
95
|
-
color: #fff;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.search-btn-To902q > span {
|
|
99
|
-
position: relative;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.search-btn-To902q:before {
|
|
103
|
-
content: "";
|
|
104
|
-
opacity: 1;
|
|
105
|
-
border-radius: inherit;
|
|
106
|
-
background: linear-gradient(135deg, #6253e1, #04befe);
|
|
107
|
-
transition: all .3s;
|
|
108
|
-
position: absolute;
|
|
109
|
-
inset: -1px;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.search-btn-To902q:hover:before {
|
|
113
|
-
opacity: 0;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.search-modal-list-G_Uxc8 .ant-spin-container {
|
|
117
|
-
max-height: 30rem;
|
|
118
|
-
overflow: auto;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.search-modal-list-G_Uxc8 .search-list-item.clickable:hover {
|
|
122
|
-
cursor: pointer;
|
|
123
|
-
background-color: #eee;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
89
|
|
|
127
90
|
/*# sourceMappingURL=index_module.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack://./src/pages/BundleSize/components/index.module.scss"],"names":[],"mappings":"AAAA;EACE,cAAc;AAChB;;AAF8B;EAK5B,sBAAsB;EACtB,OAAO;EACP,aAAa;AACf;;AAR8B;EAW5B,sBAAsB;EACtB,OAAO;EACP,aAAa;AACf;;AAd8B;EAiB5B,sBAAsB;EACtB,OAAO;EACP,aAAa;AACf;;AApB8B;EAuB5B,sBAAsB;EACtB,OAAO;EACP,aAAa;AACf;;AA1ByU;EA6BvU,YAAY;AACd;;AA9BgW;EAiC9V,+BAA+B;EAC/B,OAAO;EACP,8BAA8B;EAC9B,aAAa;AACf;;AArCkc;EAwChc,kBAAkB;AACpB;;AAzCif;EA4C/e,kBAAkB;EAClB,QAAQ;EACR,cAAc;AAChB;;AA/CwjB;EAkDtjB,WAAW;AACb;;AAnDwmB;EAsDtmB,4BAA4B;AAC9B;;AAvDsqB;EA0DpqB,kBAAkB;EAClB,WAAW;AACb;;AA5Dk0B;EA+Dh0B,eAAe;AACjB;;AAhE49B;EAmE19B,cAAc;EACd,iBAAiB;AACnB;;AArEqnC;EAwEnnC,mBAAmB;EACnB,aAAa;AACf;;AA1EuqC;EA6ErqC,iBAAiB;AACnB;;AA9EotC;EAiFltC,YAAY;AACd;;AAlF2uC;EAqFzuC,gBAAgB;AAClB
|
|
1
|
+
{"version":3,"sources":["webpack://./src/pages/BundleSize/components/index.module.scss"],"names":[],"mappings":"AAAA;EACE,cAAc;AAChB;;AAF8B;EAK5B,sBAAsB;EACtB,OAAO;EACP,aAAa;AACf;;AAR8B;EAW5B,sBAAsB;EACtB,OAAO;EACP,aAAa;AACf;;AAd8B;EAiB5B,sBAAsB;EACtB,OAAO;EACP,aAAa;AACf;;AApB8B;EAuB5B,sBAAsB;EACtB,OAAO;EACP,aAAa;AACf;;AA1ByU;EA6BvU,YAAY;AACd;;AA9BgW;EAiC9V,+BAA+B;EAC/B,OAAO;EACP,8BAA8B;EAC9B,aAAa;AACf;;AArCkc;EAwChc,kBAAkB;AACpB;;AAzCif;EA4C/e,kBAAkB;EAClB,QAAQ;EACR,cAAc;AAChB;;AA/CwjB;EAkDtjB,WAAW;AACb;;AAnDwmB;EAsDtmB,4BAA4B;AAC9B;;AAvDsqB;EA0DpqB,kBAAkB;EAClB,WAAW;AACb;;AA5Dk0B;EA+Dh0B,eAAe;AACjB;;AAhE49B;EAmE19B,cAAc;EACd,iBAAiB;AACnB;;AArEqnC;EAwEnnC,mBAAmB;EACnB,aAAa;AACf;;AA1EuqC;EA6ErqC,iBAAiB;AACnB;;AA9EotC;EAiFltC,YAAY;AACd;;AAlF2uC;EAqFzuC,gBAAgB;AAClB","sourcesContent":[".root .rootBody{padding-top:0}.root,.rootBody,.treeGraph,.tabsRoot,.assetDetailCol,.assetDetailFileTreeRoot,.assetDetailFileTreeBody,.assetDetailFileTreeViewport,.tabsRoot :global(.ant-tabs-content-holder),.tabsRoot :global(.ant-tabs-content),.tabsRoot :global(.ant-tabs-tabpane-active){display:flex;flex-direction:column;flex:1}.treeGraph{row-gap:8px}.assetDetailRoot{display:grid;column-gap:var(--spacing-base);grid-template-columns:1fr 3fr;flex:1}.assetDetailFileTreeViewport{position:relative}.assetDetailFileTreeScrollArea{position:absolute;inset:0;overflow:auto}.assets :global .rc-tree-indent-unit{width:22px}.assets :global .rc-tree-treenode{line-height:30px !important}.assets :global .rc-tree-treenode:not(.rc-tree-treenode-switcher-open):not(.rc-tree-treenode-switcher-close) .rc-tree-switcher{position:relative;bottom:4px}.assets :global .rc-tree-treenode:not(.rc-tree-treenode-switcher-open):not(.rc-tree-treenode-switcher-close) .rc-tree-node-content-wrapper{font-size:14px}.assets :global .rc-tree-treenode:not(.rc-tree-treenode-switcher-open):not(.rc-tree-treenode-switcher-close) .file-icon{padding:10px 0 0 0;margin-left:0}.assets .assetBox{display:flex;align-items:center}.assets .assetBox .fileText{margin-right:4px}.assetsTag{height:30px}.assetsTag :global .ant-divider-vertical{margin-inline:0}"],"sourceRoot":""}
|
|
@@ -3,7 +3,7 @@ import { useCallback, useState } from "react";
|
|
|
3
3
|
import { Button, Empty, Input, List, Modal, Skeleton, Tabs, Typography } from "antd";
|
|
4
4
|
import { ServerAPIProvider } from "../../../components/index.mjs";
|
|
5
5
|
import { SDK } from "@rsdoctor/types";
|
|
6
|
-
import
|
|
6
|
+
import search_modal_module from "./search-modal.module.mjs";
|
|
7
7
|
import { SearchOutlined } from "@ant-design/icons";
|
|
8
8
|
const { Search: Search } = Input;
|
|
9
9
|
const SearchModal = ({ onModuleClick, onClose, open, setOpen, isIcon = false })=>{
|
|
@@ -32,7 +32,7 @@ const SearchModal = ({ onModuleClick, onClose, open, setOpen, isIcon = false })=
|
|
|
32
32
|
isIcon ? /*#__PURE__*/ jsx(SearchOutlined, {
|
|
33
33
|
onClick: showModal
|
|
34
34
|
}) : /*#__PURE__*/ jsx(Button, {
|
|
35
|
-
className:
|
|
35
|
+
className: search_modal_module.searchBtn,
|
|
36
36
|
color: "cyan",
|
|
37
37
|
onClick: showModal,
|
|
38
38
|
children: "Search Module"
|
|
@@ -46,7 +46,7 @@ const SearchModal = ({ onModuleClick, onClose, open, setOpen, isIcon = false })=
|
|
|
46
46
|
const defaultChunkId = Object.keys(assetsChunksList)[0];
|
|
47
47
|
return /*#__PURE__*/ jsx(Fragment, {
|
|
48
48
|
children: /*#__PURE__*/ jsxs(Modal, {
|
|
49
|
-
className:
|
|
49
|
+
className: search_modal_module.modal,
|
|
50
50
|
title: "Search Modules",
|
|
51
51
|
onOk: handleOk,
|
|
52
52
|
onCancel: handleCancel,
|
|
@@ -97,7 +97,7 @@ const ModulesModal = (searchModule, chunk, onModuleClick)=>/*#__PURE__*/ jsx(Ser
|
|
|
97
97
|
},
|
|
98
98
|
children: (modules)=>/*#__PURE__*/ jsx(Fragment, {
|
|
99
99
|
children: modules?.length !== 0 ? /*#__PURE__*/ jsx(List, {
|
|
100
|
-
className:
|
|
100
|
+
className: search_modal_module.list,
|
|
101
101
|
loading: !modules.length,
|
|
102
102
|
itemLayout: "horizontal",
|
|
103
103
|
pagination: {
|
|
@@ -108,7 +108,7 @@ const ModulesModal = (searchModule, chunk, onModuleClick)=>/*#__PURE__*/ jsx(Ser
|
|
|
108
108
|
renderItem: (item)=>{
|
|
109
109
|
const itemPathArr = item.relativePath.split(searchModule);
|
|
110
110
|
return /*#__PURE__*/ jsx(List.Item, {
|
|
111
|
-
className: onModuleClick
|
|
111
|
+
className: onModuleClick && search_modal_module.listItemInteractive,
|
|
112
112
|
onClick: onModuleClick ? ()=>onModuleClick(item) : void 0,
|
|
113
113
|
children: /*#__PURE__*/ jsx(Skeleton, {
|
|
114
114
|
avatar: true,
|