@kubit-ui-web/react-components 2.0.0-beta.19 ā 2.0.0-beta.20
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/package.json +12 -2
- package/dist/cjs/.storybook/bundle-sizes.json +0 -13
- package/dist/cjs/assets/banner_kubit_readme.png +0 -0
- package/dist/cjs/components/table/__stories__/css/table.css +0 -1
- package/dist/cjs/lib/storybook/assets/icons/checkmark_thick.svg +0 -3
- package/dist/cjs/lib/storybook/assets/icons/icon_chevron_down.svg +0 -3
- package/dist/cjs/lib/storybook/assets/icons/icon_chevron_left.svg +0 -3
- package/dist/cjs/lib/storybook/assets/icons/icon_chevron_right.svg +0 -3
- package/dist/cjs/lib/storybook/assets/icons/icon_chevron_up.svg +0 -3
- package/dist/cjs/lib/storybook/assets/icons/icon_ds_handle.svg +0 -3
- package/dist/cjs/lib/storybook/assets/icons/icon_ghost.svg +0 -5
- package/dist/cjs/lib/storybook/assets/icons/icon_placeholder.svg +0 -3
- package/dist/cjs/lib/storybook/assets/icons/icon_x_close.svg +0 -3
- package/dist/cjs/lib/storybook/assets/icons/play_button.svg +0 -3
- package/dist/cjs/lib/storybook/assets/icons/replace.svg +0 -38
- package/dist/cjs/lib/storybook/assets/images/image_1.png +0 -0
- package/dist/cjs/lib/storybook/assets/images/image_2.png +0 -0
- package/dist/cjs/lib/storybook/assets/images/image_3.png +0 -0
- package/dist/cjs/lib/storybook/assets/images/image_4.png +0 -0
- package/dist/cjs/lib/storybook/assets/loader/loader.css +0 -1
- package/dist/cjs/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.js +0 -1
- package/dist/cjs/node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js +0 -1
- package/dist/cjs/scripts/generate-bundle-sizes.mjs +0 -236
- package/dist/cjs/scripts/new-component-web-ui.js +0 -2092
- package/dist/esm/.storybook/bundle-sizes.json +0 -13
- package/dist/esm/assets/banner_kubit_readme.png +0 -0
- package/dist/esm/components/table/__stories__/css/table.css +0 -1
- package/dist/esm/lib/storybook/assets/icons/checkmark_thick.svg +0 -3
- package/dist/esm/lib/storybook/assets/icons/icon_chevron_down.svg +0 -3
- package/dist/esm/lib/storybook/assets/icons/icon_chevron_left.svg +0 -3
- package/dist/esm/lib/storybook/assets/icons/icon_chevron_right.svg +0 -3
- package/dist/esm/lib/storybook/assets/icons/icon_chevron_up.svg +0 -3
- package/dist/esm/lib/storybook/assets/icons/icon_ds_handle.svg +0 -3
- package/dist/esm/lib/storybook/assets/icons/icon_ghost.svg +0 -5
- package/dist/esm/lib/storybook/assets/icons/icon_placeholder.svg +0 -3
- package/dist/esm/lib/storybook/assets/icons/icon_x_close.svg +0 -3
- package/dist/esm/lib/storybook/assets/icons/play_button.svg +0 -3
- package/dist/esm/lib/storybook/assets/icons/replace.svg +0 -38
- package/dist/esm/lib/storybook/assets/images/image_1.png +0 -0
- package/dist/esm/lib/storybook/assets/images/image_2.png +0 -0
- package/dist/esm/lib/storybook/assets/images/image_3.png +0 -0
- package/dist/esm/lib/storybook/assets/images/image_4.png +0 -0
- package/dist/esm/lib/storybook/assets/loader/loader.css +0 -1
- package/dist/esm/node_modules/.pnpm/react@18.3.1/node_modules/react/cjs/react-jsx-runtime.production.min.js +0 -1
- package/dist/esm/node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js +0 -1
- package/dist/esm/scripts/generate-bundle-sizes.mjs +0 -236
- package/dist/esm/scripts/new-component-web-ui.js +0 -2092
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubit-ui-web/react-components",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.20",
|
|
4
4
|
"description": "Kubit React Components is a customizable, accessible library of React web components, designed to enhance your application's user experience",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Kubit",
|
|
@@ -77,9 +77,19 @@
|
|
|
77
77
|
"!dist/cjs/lib/storybook",
|
|
78
78
|
"!dist/esm/lib/storybook",
|
|
79
79
|
"!dist/types/lib/storybook",
|
|
80
|
+
"!dist/**/.storybook",
|
|
81
|
+
"!dist/esm/.storybook",
|
|
82
|
+
"!dist/cjs/.storybook",
|
|
83
|
+
"!dist/**/assets",
|
|
84
|
+
"!dist/esm/assets",
|
|
85
|
+
"!dist/cjs/assets",
|
|
86
|
+
"!dist/**/scripts",
|
|
87
|
+
"!dist/esm/scripts",
|
|
88
|
+
"!dist/cjs/scripts",
|
|
80
89
|
"!dist/**/node_modules",
|
|
81
90
|
"!dist/**/.tsbuildinfo",
|
|
82
|
-
"!dist/**/*.map"
|
|
91
|
+
"!dist/**/*.map",
|
|
92
|
+
"!dist/**/.DS_Store"
|
|
83
93
|
],
|
|
84
94
|
"exports": {
|
|
85
95
|
".": {
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.scrollablecontainer-max-height{max-height:200px}.container-over-width{width:120%!important}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M16.788 10.277 11.74 14.78a.693.693 0 0 1-1.012 0L8.21 12.137a.769.769 0 0 1 0-1.058.693.693 0 0 1 1.011 0l2.024 2.115 4.541-3.975a.693.693 0 0 1 1.012 0 .78.78 0 0 1-.011 1.058z" fill="#EC0000"/>
|
|
3
|
-
</svg>
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M12 2C7.037 2 3 6.038 3 11V19H3.051C3.296 20.691 4.741 22 6.5 22C7.674 22 8.574 21.583 9.172 20.826C9.896 21.551 10.896 22 12 22C13.11 22 14.114 21.544 14.84 20.812C15.441 21.574 16.344 22 17.5 22C19.43 22 21 20.43 21 18.5V11C21 6.038 16.963 2 12 2ZM19 18.5C19 19.327 18.327 20 17.5 20C17.051 20 16 20 16 18V17H14V18C14 19.103 13.103 20 12 20C10.897 20 10 19.103 10 18V17H8V18C8 19.845 7.226 20 6.5 20C5.673 20 5 19.327 5 18.5V11C5 7.14 8.141 4 12 4C15.859 4 19 7.14 19 11V18.5Z" fill="#1A1A1A"/>
|
|
3
|
-
<path d="M9 12C10.1046 12 11 11.1046 11 10C11 8.89543 10.1046 8 9 8C7.89543 8 7 8.89543 7 10C7 11.1046 7.89543 12 9 12Z" fill="#1A1A1A"/>
|
|
4
|
-
<path d="M15 12C16.1046 12 17 11.1046 17 10C17 8.89543 16.1046 8 15 8C13.8954 8 13 8.89543 13 10C13 11.1046 13.8954 12 15 12Z" fill="#1A1A1A"/>
|
|
5
|
-
</svg>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.99138 2H4C2.89543 2 2 2.89543 2 4V4.99138L4.99138 2ZM2 12.0624V9.23402L9.23402 2H12.0624L2 12.0624ZM2 19.1335V16.3051L16.3051 2H19.1335L2 19.1335ZM6.20347 22H4C3.80971 22 3.62563 21.9734 3.45126 21.9238L21.9238 3.45126C21.9734 3.62563 22 3.80971 22 4V6.20347L6.20347 22ZM13.2745 22H10.4461L22 10.4461V13.2745L13.2745 22ZM20.3821 21.9635C20.2584 21.9875 20.1307 22 20 22H17.5172L22 17.5172V20C22 20.1307 21.9875 20.2584 21.9635 20.3821L20.3821 21.9635Z" fill="#1A1A1A"/>
|
|
3
|
-
</svg>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M16.192 6.34399L11.949 10.586L7.70697 6.34399L6.29297 7.75799L10.535 12L6.29297 16.242L7.70697 17.656L11.949 13.414L16.192 17.656L17.606 16.242L13.364 12L17.606 7.75799L16.192 6.34399Z" fill="#1A1A1A"/>
|
|
3
|
-
</svg>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M22 12C22 6.48633 17.5142 2 12 2C6.48584 2 2 6.48633 2 12C2 17.5137 6.48584 22 12 22C17.5142 22 22 17.5137 22 12ZM3 12C3 7.03711 7.0376 3 12 3C16.9624 3 21 7.03711 21 12C21 16.9629 16.9624 21 12 21C7.0376 21 3 16.9629 3 12ZM8.74951 6.96777C8.8785 6.8929 9.0319 6.8811 9.16903 6.93011L9.24902 6.9668L17.249 11.5664C17.4043 11.6553 17.5 11.8213 17.5 12C17.5 12.1489 17.4335 12.289 17.3215 12.383L17.249 12.4336L9.24902 17.0332C9.17188 17.0771 9.08594 17.0996 9 17.0996C8.91357 17.0996 8.82715 17.0771 8.74951 17.0322C8.62093 16.9582 8.53338 16.8312 8.50777 16.6875L8.5 16.5996V7.40039C8.5 7.22168 8.59521 7.05664 8.74951 6.96777ZM15.9971 12L9.5 15.7354V8.26465L15.9971 12Z" fill="#9747FF"/>
|
|
3
|
-
</svg>
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<rect width="48" height="48" fill="#FEF1F1"/>
|
|
3
|
-
<g id="Carousel">
|
|
4
|
-
<path d="M-639 -1539C-639 -1540.1 -638.105 -1541 -637 -1541H2991C2992.1 -1541 2993 -1540.1 2993 -1539V7853C2993 7854.1 2992.1 7855 2991 7855H-637C-638.104 7855 -639 7854.1 -639 7853V-1539Z" fill="#002B45" fill-opacity="0.05"/>
|
|
5
|
-
<path d="M-637 -1540H2991V-1542H-637V-1540ZM2992 -1539V7853H2994V-1539H2992ZM2991 7854H-637V7856H2991V7854ZM-638 7853V-1539H-640V7853H-638ZM-637 7854C-637.552 7854 -638 7853.55 -638 7853H-640C-640 7854.66 -638.657 7856 -637 7856V7854ZM2992 7853C2992 7853.55 2991.55 7854 2991 7854V7856C2992.66 7856 2994 7854.66 2994 7853H2992ZM2991 -1540C2991.55 -1540 2992 -1539.55 2992 -1539H2994C2994 -1540.66 2992.66 -1542 2991 -1542V-1540ZM-637 -1542C-638.657 -1542 -640 -1540.66 -640 -1539H-638C-638 -1539.55 -637.552 -1540 -637 -1540V-1542Z" fill="black" fill-opacity="0.1"/>
|
|
6
|
-
<g id="mbCarouselMB]" clip-path="url(#clip0_4_218)">
|
|
7
|
-
<rect width="1696" height="9196" transform="translate(-539 -1441)" fill="white"/>
|
|
8
|
-
<g id="template-fluid">
|
|
9
|
-
<g id="Anatomy">
|
|
10
|
-
<g id="Anatomy_2">
|
|
11
|
-
<g id="Frame 124">
|
|
12
|
-
<rect x="-411" y="-285" width="1440" height="683" rx="12" fill="#FAFAFA"/>
|
|
13
|
-
<g id="mbCarousel">
|
|
14
|
-
<g id="content_placeholder">
|
|
15
|
-
<path d="M-100 -82C-100 -86.4183 -96.4183 -90 -92 -90H140C144.418 -90 148 -86.4183 148 -82V182C148 186.418 144.418 190 140 190H-92C-96.4183 190 -100 186.418 -100 182V-82Z" fill="#236DF6" fill-opacity="0.1"/>
|
|
16
|
-
<g id="Button container">
|
|
17
|
-
<g id="Icon">
|
|
18
|
-
<g id="Vector">
|
|
19
|
-
<path d="M40 12C40 10.9391 39.5786 9.92172 38.8284 9.17157C38.0783 8.42143 37.0609 8 36 8H32C30.9391 8 29.9217 8.42143 29.1716 9.17157C28.4214 9.92172 28 10.9391 28 12V14C28 15.0609 28.4214 16.0783 29.1716 16.8284C29.9217 17.5786 30.9391 18 32 18H36C37.0609 18 38.0783 17.5786 38.8284 16.8284C39.5786 16.0783 40 15.0609 40 14V12Z" stroke="#236DF6" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
|
|
20
|
-
<path d="M40 30C40 28.9391 39.5786 27.9217 38.8284 27.1716C38.0783 26.4214 37.0609 26 36 26H32C30.9391 26 29.9217 26.4214 29.1716 27.1716C28.4214 27.9217 28 28.9391 28 30V36C28 37.0609 28.4214 38.0783 29.1716 38.8284C29.9217 39.5786 30.9391 40 32 40H36C37.0609 40 38.0783 39.5786 38.8284 38.8284C39.5786 38.0783 40 37.0609 40 36V30Z" stroke="#236DF6" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
|
|
21
|
-
<path d="M20 12C20 10.9391 19.5786 9.92172 18.8284 9.17157C18.0783 8.42143 17.0609 8 16 8H12C10.9391 8 9.92172 8.42143 9.17157 9.17157C8.42143 9.92172 8 10.9391 8 12V36C8 37.0609 8.42143 38.0783 9.17157 38.8284C9.92172 39.5786 10.9391 40 12 40H16C17.0609 40 18.0783 39.5786 18.8284 38.8284C19.5786 38.0783 20 37.0609 20 36V12Z" stroke="#236DF6" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
|
|
22
|
-
</g>
|
|
23
|
-
</g>
|
|
24
|
-
</g>
|
|
25
|
-
</g>
|
|
26
|
-
</g>
|
|
27
|
-
</g>
|
|
28
|
-
</g>
|
|
29
|
-
</g>
|
|
30
|
-
</g>
|
|
31
|
-
</g>
|
|
32
|
-
</g>
|
|
33
|
-
<defs>
|
|
34
|
-
<clipPath id="clip0_4_218">
|
|
35
|
-
<rect width="1696" height="9196" fill="white" transform="translate(-539 -1441)"/>
|
|
36
|
-
</clipPath>
|
|
37
|
-
</defs>
|
|
38
|
-
</svg>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.loader-wrapper{animation:spin 2s linear infinite;border:6px solid #f3f3f3;border-radius:50%;border-top-color:#3498db;height:24px;width:24px}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../../../../../_virtual/react-jsx-runtime.production.min.js"),e=require("react");var t;exports.__require=function(){if(t)return r.__exports;t=1;var o=e,_=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,u=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function p(r,e,t){var o,n={},p=null,a=null;for(o in void 0!==t&&(p=""+t),void 0!==e.key&&(p=""+e.key),void 0!==e.ref&&(a=e.ref),e)s.call(e,o)&&!i.hasOwnProperty(o)&&(n[o]=e[o]);if(r&&r.defaultProps)for(o in e=r.defaultProps)void 0===n[o]&&(n[o]=e[o]);return{$$typeof:_,type:r,key:p,ref:a,props:n,_owner:u.current}}return r.__exports.Fragment=n,r.__exports.jsx=p,r.__exports.jsxs=p,r.__exports};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../../../../../_virtual/jsx-runtime2.js"),r=require("./cjs/react-jsx-runtime.production.min.js");var t;exports.__require=function(){return t||(t=1,e.__module.exports=r.__require()),e.__module.exports};
|
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Generate bundle size information for each component
|
|
5
|
-
* This script analyzes the dist folder and generates a JSON file with size information
|
|
6
|
-
*/
|
|
7
|
-
import fs from 'fs';
|
|
8
|
-
import path from 'path';
|
|
9
|
-
import { fileURLToPath } from 'url';
|
|
10
|
-
import { gzipSync } from 'zlib';
|
|
11
|
-
|
|
12
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
13
|
-
const __dirname = path.dirname(__filename);
|
|
14
|
-
const rootDir = path.resolve(__dirname, '..');
|
|
15
|
-
|
|
16
|
-
// Paths
|
|
17
|
-
const distEsmDir = path.join(rootDir, 'dist/esm/components');
|
|
18
|
-
const outputFile = path.join(rootDir, '.storybook/bundle-sizes.json');
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Get file size in bytes
|
|
22
|
-
*/
|
|
23
|
-
function getFileSize(filePath) {
|
|
24
|
-
try {
|
|
25
|
-
const stats = fs.statSync(filePath);
|
|
26
|
-
return stats.size;
|
|
27
|
-
} catch (error) {
|
|
28
|
-
return 0;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Get gzipped size of file
|
|
34
|
-
*/
|
|
35
|
-
function getGzipSize(filePath) {
|
|
36
|
-
try {
|
|
37
|
-
const content = fs.readFileSync(filePath);
|
|
38
|
-
const gzipped = gzipSync(content);
|
|
39
|
-
return gzipped.length;
|
|
40
|
-
} catch (error) {
|
|
41
|
-
return 0;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Format bytes to human readable
|
|
47
|
-
*/
|
|
48
|
-
function formatBytes(bytes) {
|
|
49
|
-
if (bytes === 0) return '0 B';
|
|
50
|
-
const k = 1024;
|
|
51
|
-
const sizes = ['B', 'KB', 'MB'];
|
|
52
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
53
|
-
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Get component files
|
|
58
|
-
*/
|
|
59
|
-
function getComponentFiles(componentPath) {
|
|
60
|
-
const files = {
|
|
61
|
-
css: [],
|
|
62
|
-
js: [],
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
try {
|
|
66
|
-
const entries = fs.readdirSync(componentPath, { withFileTypes: true });
|
|
67
|
-
|
|
68
|
-
for (const entry of entries) {
|
|
69
|
-
const fullPath = path.join(componentPath, entry.name);
|
|
70
|
-
|
|
71
|
-
if (entry.isDirectory()) {
|
|
72
|
-
// Recursively search subdirectories
|
|
73
|
-
const subFiles = getComponentFiles(fullPath);
|
|
74
|
-
files.css.push(...subFiles.css);
|
|
75
|
-
files.js.push(...subFiles.js);
|
|
76
|
-
} else if (entry.isFile()) {
|
|
77
|
-
if (entry.name.endsWith('.css')) {
|
|
78
|
-
files.css.push(fullPath);
|
|
79
|
-
} else if (entry.name.endsWith('.js')) {
|
|
80
|
-
files.js.push(fullPath);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
} catch (error) {
|
|
85
|
-
// Directory doesn't exist
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return files;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Calculate sizes for a component
|
|
93
|
-
*/
|
|
94
|
-
function calculateComponentSizes(componentName, componentPath) {
|
|
95
|
-
const files = getComponentFiles(componentPath);
|
|
96
|
-
|
|
97
|
-
let jsSize = 0;
|
|
98
|
-
let jsGzipSize = 0;
|
|
99
|
-
let cssSize = 0;
|
|
100
|
-
let cssGzipSize = 0;
|
|
101
|
-
|
|
102
|
-
// Sum JS files
|
|
103
|
-
for (const file of files.js) {
|
|
104
|
-
jsSize += getFileSize(file);
|
|
105
|
-
jsGzipSize += getGzipSize(file);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Sum CSS files
|
|
109
|
-
for (const file of files.css) {
|
|
110
|
-
cssSize += getFileSize(file);
|
|
111
|
-
cssGzipSize += getGzipSize(file);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const totalSize = jsSize + cssSize;
|
|
115
|
-
const totalGzipSize = jsGzipSize + cssGzipSize;
|
|
116
|
-
|
|
117
|
-
return {
|
|
118
|
-
component: componentName,
|
|
119
|
-
sizes: {
|
|
120
|
-
js: {
|
|
121
|
-
raw: jsSize,
|
|
122
|
-
gzip: jsGzipSize,
|
|
123
|
-
formatted: formatBytes(jsSize),
|
|
124
|
-
gzipFormatted: formatBytes(jsGzipSize),
|
|
125
|
-
},
|
|
126
|
-
css: {
|
|
127
|
-
raw: cssSize,
|
|
128
|
-
gzip: cssGzipSize,
|
|
129
|
-
formatted: formatBytes(cssSize),
|
|
130
|
-
gzipFormatted: formatBytes(cssGzipSize),
|
|
131
|
-
},
|
|
132
|
-
total: {
|
|
133
|
-
raw: totalSize,
|
|
134
|
-
gzip: totalGzipSize,
|
|
135
|
-
formatted: formatBytes(totalSize),
|
|
136
|
-
gzipFormatted: formatBytes(totalGzipSize),
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
treeshakeable: true, // All ESM exports are treeshakeable
|
|
140
|
-
timestamp: new Date().toISOString(),
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Main function
|
|
146
|
-
*/
|
|
147
|
-
function main() {
|
|
148
|
-
console.log('š¦ Generating bundle size information...\n');
|
|
149
|
-
|
|
150
|
-
if (!fs.existsSync(distEsmDir)) {
|
|
151
|
-
console.warn('ā ļø Warning: dist/esm/components directory not found.');
|
|
152
|
-
console.warn(
|
|
153
|
-
' Creating empty bundle-sizes.json. Run `pnpm dist` to populate.\n',
|
|
154
|
-
);
|
|
155
|
-
|
|
156
|
-
// Create empty bundle sizes file
|
|
157
|
-
const emptyOutput = {
|
|
158
|
-
metadata: {
|
|
159
|
-
generated: new Date().toISOString(),
|
|
160
|
-
totalComponents: 0,
|
|
161
|
-
totalSize: {
|
|
162
|
-
raw: 0,
|
|
163
|
-
gzip: 0,
|
|
164
|
-
formatted: '0 B',
|
|
165
|
-
gzipFormatted: '0 B',
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
|
-
components: {},
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
const storybookDir = path.dirname(outputFile);
|
|
172
|
-
if (!fs.existsSync(storybookDir)) {
|
|
173
|
-
fs.mkdirSync(storybookDir, { recursive: true });
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
fs.writeFileSync(outputFile, JSON.stringify(emptyOutput, null, 2));
|
|
177
|
-
console.log('š Created empty bundle-sizes.json\n');
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const components = fs
|
|
182
|
-
.readdirSync(distEsmDir, { withFileTypes: true })
|
|
183
|
-
.filter((dirent) => dirent.isDirectory())
|
|
184
|
-
.map((dirent) => dirent.name);
|
|
185
|
-
|
|
186
|
-
const bundleSizes = {};
|
|
187
|
-
let totalComponents = 0;
|
|
188
|
-
let totalSize = 0;
|
|
189
|
-
let totalGzipSize = 0;
|
|
190
|
-
|
|
191
|
-
for (const component of components) {
|
|
192
|
-
const componentPath = path.join(distEsmDir, component);
|
|
193
|
-
const sizeInfo = calculateComponentSizes(component, componentPath);
|
|
194
|
-
|
|
195
|
-
bundleSizes[component] = sizeInfo;
|
|
196
|
-
totalComponents++;
|
|
197
|
-
totalSize += sizeInfo.sizes.total.raw;
|
|
198
|
-
totalGzipSize += sizeInfo.sizes.total.gzip;
|
|
199
|
-
|
|
200
|
-
console.log(
|
|
201
|
-
`ā ${component.padEnd(20)} ${sizeInfo.sizes.total.gzipFormatted} (gzip)`,
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// Add metadata
|
|
206
|
-
const output = {
|
|
207
|
-
metadata: {
|
|
208
|
-
generated: new Date().toISOString(),
|
|
209
|
-
totalComponents,
|
|
210
|
-
totalSize: {
|
|
211
|
-
raw: totalSize,
|
|
212
|
-
gzip: totalGzipSize,
|
|
213
|
-
formatted: formatBytes(totalSize),
|
|
214
|
-
gzipFormatted: formatBytes(totalGzipSize),
|
|
215
|
-
},
|
|
216
|
-
},
|
|
217
|
-
components: bundleSizes,
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
// Write to file
|
|
221
|
-
const storybookDir = path.dirname(outputFile);
|
|
222
|
-
if (!fs.existsSync(storybookDir)) {
|
|
223
|
-
fs.mkdirSync(storybookDir, { recursive: true });
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
fs.writeFileSync(outputFile, JSON.stringify(output, null, 2));
|
|
227
|
-
|
|
228
|
-
console.log(`\n⨠Bundle sizes generated successfully!`);
|
|
229
|
-
console.log(`š Total components: ${totalComponents}`);
|
|
230
|
-
console.log(
|
|
231
|
-
`š¦ Total size: ${formatBytes(totalSize)} (raw) / ${formatBytes(totalGzipSize)} (gzip)`,
|
|
232
|
-
);
|
|
233
|
-
console.log(`š Output: ${path.relative(rootDir, outputFile)}\n`);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
main();
|