Skip to content

Commit a1d411e

Browse files
committed
Updated documentation
1 parent f44c683 commit a1d411e

7 files changed

Lines changed: 144 additions & 196 deletions

File tree

docs/bundle-analysis.md

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,22 @@ The default treemap view shows:
3434
### Key Metrics to Monitor
3535

3636
1. **Vendor Chunks** (largest bundles):
37-
- `vendor-charts` (~1.4MB) - Chart.js, ECharts, Leaflet
38-
- `vendor-core` (~168KB) - jQuery, Bootstrap, Popper.js
39-
- `vendor-forms` (~128KB) - Select2, Date pickers, Sliders
40-
- `vendor-ui` (~100KB) - jQuery UI, DataTables
37+
- `vendor-echarts` (~359KB gzip) - ECharts (echarts.html only)
38+
- `vendor-calendar` (~74KB gzip) - FullCalendar
39+
- `vendor-chartjs` (~68KB gzip) - Chart.js
40+
- `vendor-tables` (~63KB gzip) - DataTables core
41+
- `vendor-tables-ext` (~49KB gzip) - DataTables extensions + JSZip
42+
- `vendor-forms` (~49KB gzip) - Choices.js, nouislider, Tempus Dominus
43+
- `vendor-maps` (~42KB gzip) - Leaflet
44+
- `vendor-core` (~23KB gzip) - Bootstrap, Popper.js
4145

4246
2. **Application Code**:
43-
- `init` (~54KB) - Main initialization code
44-
- Page-specific bundles (2-3KB each)
47+
- `main-core` - Core entry point (jQuery-free)
48+
- Page-specific bundles (dynamically loaded)
4549

4650
3. **CSS Bundles**:
47-
- `init.css` (~510KB) - Main stylesheet bundle
48-
- Page-specific CSS (4-67KB each)
51+
- Main stylesheet bundle
52+
- Page-specific CSS
4953

5054
## Optimization Strategies
5155

@@ -61,10 +65,14 @@ The default treemap view shows:
6165

6266
### 3. Code Splitting Optimization
6367
Current manual chunks are optimized for:
64-
- **vendor-core**: Essential libraries loaded on every page
65-
- **vendor-charts**: Chart functionality (loaded only on chart pages)
66-
- **vendor-forms**: Form enhancements (loaded only on form pages)
67-
- **vendor-ui**: UI components (loaded as needed)/
68+
69+
- **vendor-core**: Bootstrap + Popper.js loaded on every page
70+
- **vendor-chartjs**: Chart.js (loaded only on chart pages)
71+
- **vendor-echarts**: ECharts (loaded only on echarts.html)
72+
- **vendor-forms**: Choices.js, nouislider, Tempus Dominus (form pages)
73+
- **vendor-tables**: DataTables core (table pages)
74+
- **vendor-maps**: Leaflet (map page only)
75+
- **vendor-calendar**: FullCalendar (calendar page only)
6876

6977
### 4. Dynamic Import Opportunities
7078
Consider converting large features to dynamic imports:
@@ -81,18 +89,21 @@ if (document.querySelector('.chart-container')) {
8189
## Performance Targets
8290

8391
### Current Performance (as of latest build):
84-
- **JavaScript Total**: ~2.4MB uncompressed, ~800KB gzipped
85-
- **CSS Total**: ~610KB uncompressed, ~110KB gzipped
86-
- **Page Load Impact**: Core bundle (168KB) loads on every page
92+
93+
- **Initial Bundle**: 79KB (core + styles)
94+
- **Total Page Load**: ~770KB (dashboard with all widgets)
95+
- **Page Load Impact**: Core bundle (~23KB gzip) loads on every page
8796

8897
### Recommended Targets:
89-
- **Core Bundle**: <200KB (currently 168KB ✅)
90-
- **Feature Bundles**: <150KB each (charts: 1.4MB ❌)
91-
- **Total Initial Load**: <300KB gzipped (currently ~150KB ✅)
98+
99+
- **Core Bundle**: <50KB gzip (currently ~23KB ✅)
100+
- **Feature Bundles**: <100KB gzip each (echarts: ~359KB ⚠️ - isolated to single page)
101+
- **Total Initial Load**: <100KB gzipped (currently ~79KB ✅)
92102

93103
## Bundle Size Warnings
94104

95105
The build process will warn about chunks larger than 1000KB:
96-
- This is currently triggered by the `vendor-charts` bundle
106+
107+
- This is currently triggered by the `vendor-echarts` bundle (~1,109KB uncompressed)
97108
- Consider splitting chart libraries further or using dynamic imports
98109
- Adjust the warning limit in `vite.config.js` if needed

docs/components.md

Lines changed: 56 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -159,78 +159,36 @@ const pieChart = new Chart(ctx, {
159159
});
160160
```
161161

162-
### Morris.js Charts
162+
### ECharts
163163

164-
#### Line Charts
165-
```javascript
166-
Morris.Line({
167-
element: 'line-chart',
168-
data: [
169-
{ y: '2023-01', a: 100, b: 90 },
170-
{ y: '2023-02', a: 75, b: 65 },
171-
{ y: '2023-03', a: 50, b: 40 }
172-
],
173-
xkey: 'y',
174-
ykeys: ['a', 'b'],
175-
labels: ['Series A', 'Series B']
176-
});
177-
```
178-
179-
#### Area Charts
180164
```javascript
181-
Morris.Area({
182-
element: 'area-chart',
183-
data: [
184-
{ period: '2023-01', sales: 2666, downloads: 2647 },
185-
{ period: '2023-02', sales: 2778, downloads: 2294 }
186-
],
187-
xkey: 'period',
188-
ykeys: ['sales', 'downloads'],
189-
labels: ['Sales', 'Downloads']
165+
import * as echarts from 'echarts';
166+
167+
const chart = echarts.init(document.getElementById('echart-line'));
168+
chart.setOption({
169+
xAxis: { type: 'category', data: ['Jan', 'Feb', 'Mar', 'Apr', 'May'] },
170+
yAxis: { type: 'value' },
171+
series: [{
172+
data: [820, 932, 901, 934, 1290],
173+
type: 'line',
174+
smooth: true
175+
}]
190176
});
191177
```
192178

193-
### Sparkline Charts
179+
#### Gauge Charts
194180

195181
```javascript
196-
$('.sparkline').sparkline([5,6,7,2,0,-4,-2,4], {
197-
type: 'line',
198-
width: '100%',
199-
height: '30',
200-
lineColor: '#26B99A',
201-
fillColor: 'rgba(38, 185, 154, 0.3)'
182+
const gauge = echarts.init(document.getElementById('echart-gauge'));
183+
gauge.setOption({
184+
series: [{
185+
type: 'gauge',
186+
detail: { formatter: '{value}%' },
187+
data: [{ value: 67, name: 'Progress' }]
188+
}]
202189
});
203190
```
204191

205-
### Gauge Charts
206-
207-
```javascript
208-
import Gauge from 'gauge.js';
209-
210-
const gauge = new Gauge(document.getElementById('gauge')).setOptions({
211-
angle: 0.15,
212-
lineWidth: 0.2,
213-
radiusScale: 1,
214-
pointer: {
215-
length: 0.6,
216-
strokeWidth: 0.035,
217-
color: '#000000'
218-
},
219-
limitMax: false,
220-
limitMin: false,
221-
colorStart: '#6FADCF',
222-
colorStop: '#8FC0DA',
223-
strokeColor: '#E0E0E0',
224-
generateGradient: true,
225-
highDpiSupport: true
226-
});
227-
228-
gauge.maxValue = 100;
229-
gauge.setMinValue(0);
230-
gauge.animationSpeed = 32;
231-
gauge.set(67);
232-
```
233-
234192
---
235193

236194
## Form Components
@@ -263,21 +221,24 @@ gauge.set(67);
263221

264222
### Advanced Form Components
265223

266-
#### Select2 Enhanced Dropdowns
224+
#### Choices.js Enhanced Dropdowns
225+
267226
```html
268-
<select class="form-control select2" multiple="multiple">
227+
<select class="form-control choices-select" multiple>
269228
<option value="AK">Alaska</option>
270229
<option value="HI">Hawaii</option>
271230
<option value="CA">California</option>
272231
</select>
273232
```
274233

275234
```javascript
276-
// Initialize Select2
277-
$('.select2').select2({
278-
theme: 'bootstrap-5',
279-
width: '100%',
280-
placeholder: 'Select options...'
235+
import Choices from 'choices.js';
236+
237+
new Choices('.choices-select', {
238+
removeItemButton: true,
239+
searchEnabled: true,
240+
placeholder: true,
241+
placeholderValue: 'Select options...'
281242
});
282243
```
283244

@@ -669,58 +630,40 @@ animateProgress('.progress-bar', 85);
669630

670631
## Map Components
671632

672-
### jVectorMap Integration
633+
### Leaflet Maps
634+
635+
#### Basic Map
673636

674-
#### World Map
675637
```html
676-
<div id="world-map" style="height: 400px;"></div>
638+
<div id="map" style="height: 400px;"></div>
677639
```
678640

679641
```javascript
680-
$('#world-map').vectorMap({
681-
map: 'world_mill',
682-
backgroundColor: 'transparent',
683-
regionStyle: {
684-
initial: {
685-
fill: '#73879C',
686-
"fill-opacity": 1,
687-
stroke: '#fff',
688-
"stroke-width": 1,
689-
"stroke-opacity": 1
690-
}
691-
},
692-
series: {
693-
regions: [{
694-
values: {
695-
"US": 298,
696-
"SA": 200,
697-
"AU": 760,
698-
"IN": 2000000,
699-
"GB": 120
700-
},
701-
scale: ['#26B99A', '#E74C3C'],
702-
normalizeFunction: 'polynomial'
703-
}]
704-
}
705-
});
642+
import L from 'leaflet';
643+
644+
const map = L.map('map').setView([51.505, -0.09], 13);
645+
646+
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
647+
attribution: '&copy; OpenStreetMap contributors'
648+
}).addTo(map);
649+
650+
L.marker([51.5, -0.09]).addTo(map)
651+
.bindPopup('Hello from Leaflet!')
652+
.openPopup();
706653
```
707654

708-
#### Regional Map
655+
#### Map with Multiple Markers
656+
709657
```javascript
710-
$('#usa-map').vectorMap({
711-
map: 'us_aea',
712-
backgroundColor: 'transparent',
713-
regionsSelectable: true,
714-
series: {
715-
regions: [{
716-
values: {
717-
"US-CA": 200,
718-
"US-TX": 300,
719-
"US-NY": 250
720-
},
721-
scale: ['#3498DB', '#E74C3C']
722-
}]
723-
}
658+
const locations = [
659+
{ lat: 40.7128, lng: -74.006, label: 'New York' },
660+
{ lat: 34.0522, lng: -118.2437, label: 'Los Angeles' },
661+
{ lat: 41.8781, lng: -87.6298, label: 'Chicago' }
662+
];
663+
664+
locations.forEach(loc => {
665+
L.marker([loc.lat, loc.lng]).addTo(map)
666+
.bindPopup(loc.label);
724667
});
725668
```
726669

0 commit comments

Comments
 (0)