@kupola/kupola 2.0.0-beta.6 → 2.0.0-beta.8
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/kupola-core.cjs +1 -0
- package/dist/kupola-core.esm.js +1 -1
- package/package.json +52 -52
- package/packages/core/package.json +52 -52
- package/packages/core/src/devtools.js +303 -0
- package/packages/core/src/effect.js +6 -1
- package/packages/core/src/index.js +6 -0
- package/packages/core/src/lazy.js +128 -0
- package/packages/core/src/signal.js +3 -0
- package/dist/kupola-core.cjs.js +0 -1
- /package/dist/{kupola-core-alert.cjs.js → kupola-core-alert.cjs} +0 -0
- /package/dist/{kupola-core-avatar.cjs.js → kupola-core-avatar.cjs} +0 -0
- /package/dist/{kupola-core-badge.cjs.js → kupola-core-badge.cjs} +0 -0
- /package/dist/{kupola-core-breadcrumb.cjs.js → kupola-core-breadcrumb.cjs} +0 -0
- /package/dist/{kupola-core-calendar.cjs.js → kupola-core-calendar.cjs} +0 -0
- /package/dist/{kupola-core-carousel.cjs.js → kupola-core-carousel.cjs} +0 -0
- /package/dist/{kupola-core-checkbox.cjs.js → kupola-core-checkbox.cjs} +0 -0
- /package/dist/{kupola-core-collapse.cjs.js → kupola-core-collapse.cjs} +0 -0
- /package/dist/{kupola-core-colorpicker.cjs.js → kupola-core-colorpicker.cjs} +0 -0
- /package/dist/{kupola-core-countdown.cjs.js → kupola-core-countdown.cjs} +0 -0
- /package/dist/{kupola-core-datepicker.cjs.js → kupola-core-datepicker.cjs} +0 -0
- /package/dist/{kupola-core-dialog.cjs.js → kupola-core-dialog.cjs} +0 -0
- /package/dist/{kupola-core-directives.cjs.js → kupola-core-directives.cjs} +0 -0
- /package/dist/{kupola-core-divider.cjs.js → kupola-core-divider.cjs} +0 -0
- /package/dist/{kupola-core-drawer.cjs.js → kupola-core-drawer.cjs} +0 -0
- /package/dist/{kupola-core-dropdown.cjs.js → kupola-core-dropdown.cjs} +0 -0
- /package/dist/{kupola-core-dynamictags.cjs.js → kupola-core-dynamictags.cjs} +0 -0
- /package/dist/{kupola-core-empty.cjs.js → kupola-core-empty.cjs} +0 -0
- /package/dist/{kupola-core-fileupload.cjs.js → kupola-core-fileupload.cjs} +0 -0
- /package/dist/{kupola-core-form.cjs.js → kupola-core-form.cjs} +0 -0
- /package/dist/{kupola-core-heatmap.cjs.js → kupola-core-heatmap.cjs} +0 -0
- /package/dist/{kupola-core-i18n.cjs.js → kupola-core-i18n.cjs} +0 -0
- /package/dist/{kupola-core-icons.cjs.js → kupola-core-icons.cjs} +0 -0
- /package/dist/{kupola-core-imagepreview.cjs.js → kupola-core-imagepreview.cjs} +0 -0
- /package/dist/{kupola-core-input.cjs.js → kupola-core-input.cjs} +0 -0
- /package/dist/{kupola-core-kbd.cjs.js → kupola-core-kbd.cjs} +0 -0
- /package/dist/{kupola-core-menu.cjs.js → kupola-core-menu.cjs} +0 -0
- /package/dist/{kupola-core-message.cjs.js → kupola-core-message.cjs} +0 -0
- /package/dist/{kupola-core-modal.cjs.js → kupola-core-modal.cjs} +0 -0
- /package/dist/{kupola-core-notification.cjs.js → kupola-core-notification.cjs} +0 -0
- /package/dist/{kupola-core-numberinput.cjs.js → kupola-core-numberinput.cjs} +0 -0
- /package/dist/{kupola-core-pagination.cjs.js → kupola-core-pagination.cjs} +0 -0
- /package/dist/{kupola-core-progress.cjs.js → kupola-core-progress.cjs} +0 -0
- /package/dist/{kupola-core-radio.cjs.js → kupola-core-radio.cjs} +0 -0
- /package/dist/{kupola-core-select.cjs.js → kupola-core-select.cjs} +0 -0
- /package/dist/{kupola-core-server.cjs.js → kupola-core-server.cjs} +0 -0
- /package/dist/{kupola-core-skeleton.cjs.js → kupola-core-skeleton.cjs} +0 -0
- /package/dist/{kupola-core-slider.cjs.js → kupola-core-slider.cjs} +0 -0
- /package/dist/{kupola-core-spin.cjs.js → kupola-core-spin.cjs} +0 -0
- /package/dist/{kupola-core-statcard.cjs.js → kupola-core-statcard.cjs} +0 -0
- /package/dist/{kupola-core-switch.cjs.js → kupola-core-switch.cjs} +0 -0
- /package/dist/{kupola-core-table.cjs.js → kupola-core-table.cjs} +0 -0
- /package/dist/{kupola-core-tabs.cjs.js → kupola-core-tabs.cjs} +0 -0
- /package/dist/{kupola-core-tag.cjs.js → kupola-core-tag.cjs} +0 -0
- /package/dist/{kupola-core-textarea.cjs.js → kupola-core-textarea.cjs} +0 -0
- /package/dist/{kupola-core-timeline.cjs.js → kupola-core-timeline.cjs} +0 -0
- /package/dist/{kupola-core-timepicker.cjs.js → kupola-core-timepicker.cjs} +0 -0
- /package/dist/{kupola-core-tooltip.cjs.js → kupola-core-tooltip.cjs} +0 -0
- /package/dist/{kupola-core-tree.cjs.js → kupola-core-tree.cjs} +0 -0
- /package/dist/{kupola-core-validation.cjs.js → kupola-core-validation.cjs} +0 -0
- /package/dist/{kupola-core-virtuallist.cjs.js → kupola-core-virtuallist.cjs} +0 -0
|
@@ -3,214 +3,214 @@
|
|
|
3
3
|
"version": "2.0.0-alpha.1",
|
|
4
4
|
"description": "Kupola core reactivity engine — Signal, computed, effect, batch, template, SSR, components.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "dist/core.cjs
|
|
6
|
+
"main": "dist/core.cjs",
|
|
7
7
|
"module": "dist/core.esm.js",
|
|
8
8
|
"types": "dist/types/core.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"import": "./dist/core.esm.js",
|
|
12
|
-
"require": "./dist/core.cjs
|
|
12
|
+
"require": "./dist/core.cjs",
|
|
13
13
|
"types": "./dist/types/core.d.ts"
|
|
14
14
|
},
|
|
15
15
|
"./server": {
|
|
16
16
|
"import": "./dist/kupola-core-server.esm.js",
|
|
17
|
-
"require": "./dist/kupola-core-server.cjs
|
|
17
|
+
"require": "./dist/kupola-core-server.cjs"
|
|
18
18
|
},
|
|
19
19
|
"./directives": {
|
|
20
20
|
"import": "./dist/kupola-core-directives.esm.js",
|
|
21
|
-
"require": "./dist/kupola-core-directives.cjs
|
|
21
|
+
"require": "./dist/kupola-core-directives.cjs"
|
|
22
22
|
},
|
|
23
23
|
"./components/modal": {
|
|
24
24
|
"import": "./dist/kupola-core-modal.esm.js",
|
|
25
|
-
"require": "./dist/kupola-core-modal.cjs
|
|
25
|
+
"require": "./dist/kupola-core-modal.cjs"
|
|
26
26
|
},
|
|
27
27
|
"./components/dropdown": {
|
|
28
28
|
"import": "./dist/kupola-core-dropdown.esm.js",
|
|
29
|
-
"require": "./dist/kupola-core-dropdown.cjs
|
|
29
|
+
"require": "./dist/kupola-core-dropdown.cjs"
|
|
30
30
|
},
|
|
31
31
|
"./components/drawer": {
|
|
32
32
|
"import": "./dist/kupola-core-drawer.esm.js",
|
|
33
|
-
"require": "./dist/kupola-core-drawer.cjs
|
|
33
|
+
"require": "./dist/kupola-core-drawer.cjs"
|
|
34
34
|
},
|
|
35
35
|
"./components/collapse": {
|
|
36
36
|
"import": "./dist/kupola-core-collapse.esm.js",
|
|
37
|
-
"require": "./dist/kupola-core-collapse.cjs
|
|
37
|
+
"require": "./dist/kupola-core-collapse.cjs"
|
|
38
38
|
},
|
|
39
39
|
"./components/tabs": {
|
|
40
40
|
"import": "./dist/kupola-core-tabs.esm.js",
|
|
41
|
-
"require": "./dist/kupola-core-tabs.cjs
|
|
41
|
+
"require": "./dist/kupola-core-tabs.cjs"
|
|
42
42
|
},
|
|
43
43
|
"./components/select": {
|
|
44
44
|
"import": "./dist/kupola-core-select.esm.js",
|
|
45
|
-
"require": "./dist/kupola-core-select.cjs
|
|
45
|
+
"require": "./dist/kupola-core-select.cjs"
|
|
46
46
|
},
|
|
47
47
|
"./components/pagination": {
|
|
48
48
|
"import": "./dist/kupola-core-pagination.esm.js",
|
|
49
|
-
"require": "./dist/kupola-core-pagination.cjs
|
|
49
|
+
"require": "./dist/kupola-core-pagination.cjs"
|
|
50
50
|
},
|
|
51
51
|
"./components/datepicker": {
|
|
52
52
|
"import": "./dist/kupola-core-datepicker.esm.js",
|
|
53
|
-
"require": "./dist/kupola-core-datepicker.cjs
|
|
53
|
+
"require": "./dist/kupola-core-datepicker.cjs"
|
|
54
54
|
},
|
|
55
55
|
"./components/dialog": {
|
|
56
56
|
"import": "./dist/kupola-core-dialog.esm.js",
|
|
57
|
-
"require": "./dist/kupola-core-dialog.cjs
|
|
57
|
+
"require": "./dist/kupola-core-dialog.cjs"
|
|
58
58
|
},
|
|
59
59
|
"./components/notification": {
|
|
60
60
|
"import": "./dist/kupola-core-notification.esm.js",
|
|
61
|
-
"require": "./dist/kupola-core-notification.cjs
|
|
61
|
+
"require": "./dist/kupola-core-notification.cjs"
|
|
62
62
|
},
|
|
63
63
|
"./components/tooltip": {
|
|
64
64
|
"import": "./dist/kupola-core-tooltip.esm.js",
|
|
65
|
-
"require": "./dist/kupola-core-tooltip.cjs
|
|
65
|
+
"require": "./dist/kupola-core-tooltip.cjs"
|
|
66
66
|
},
|
|
67
67
|
"./components/alert": {
|
|
68
68
|
"import": "./dist/kupola-core-alert.esm.js",
|
|
69
|
-
"require": "./dist/kupola-core-alert.cjs
|
|
69
|
+
"require": "./dist/kupola-core-alert.cjs"
|
|
70
70
|
},
|
|
71
71
|
"./components/switch": {
|
|
72
72
|
"import": "./dist/kupola-core-switch.esm.js",
|
|
73
|
-
"require": "./dist/kupola-core-switch.cjs
|
|
73
|
+
"require": "./dist/kupola-core-switch.cjs"
|
|
74
74
|
},
|
|
75
75
|
"./components/progress": {
|
|
76
76
|
"import": "./dist/kupola-core-progress.esm.js",
|
|
77
|
-
"require": "./dist/kupola-core-progress.cjs
|
|
77
|
+
"require": "./dist/kupola-core-progress.cjs"
|
|
78
78
|
},
|
|
79
79
|
"./components/tag": {
|
|
80
80
|
"import": "./dist/kupola-core-tag.esm.js",
|
|
81
|
-
"require": "./dist/kupola-core-tag.cjs
|
|
81
|
+
"require": "./dist/kupola-core-tag.cjs"
|
|
82
82
|
},
|
|
83
83
|
"./components/badge": {
|
|
84
84
|
"import": "./dist/kupola-core-badge.esm.js",
|
|
85
|
-
"require": "./dist/kupola-core-badge.cjs
|
|
85
|
+
"require": "./dist/kupola-core-badge.cjs"
|
|
86
86
|
},
|
|
87
87
|
"./components/divider": {
|
|
88
88
|
"import": "./dist/kupola-core-divider.esm.js",
|
|
89
|
-
"require": "./dist/kupola-core-divider.cjs
|
|
89
|
+
"require": "./dist/kupola-core-divider.cjs"
|
|
90
90
|
},
|
|
91
91
|
"./components/skeleton": {
|
|
92
92
|
"import": "./dist/kupola-core-skeleton.esm.js",
|
|
93
|
-
"require": "./dist/kupola-core-skeleton.cjs
|
|
93
|
+
"require": "./dist/kupola-core-skeleton.cjs"
|
|
94
94
|
},
|
|
95
95
|
"./components/spin": {
|
|
96
96
|
"import": "./dist/kupola-core-spin.esm.js",
|
|
97
|
-
"require": "./dist/kupola-core-spin.cjs
|
|
97
|
+
"require": "./dist/kupola-core-spin.cjs"
|
|
98
98
|
},
|
|
99
99
|
"./components/empty": {
|
|
100
100
|
"import": "./dist/kupola-core-empty.esm.js",
|
|
101
|
-
"require": "./dist/kupola-core-empty.cjs
|
|
101
|
+
"require": "./dist/kupola-core-empty.cjs"
|
|
102
102
|
},
|
|
103
103
|
"./components/timeline": {
|
|
104
104
|
"import": "./dist/kupola-core-timeline.esm.js",
|
|
105
|
-
"require": "./dist/kupola-core-timeline.cjs
|
|
105
|
+
"require": "./dist/kupola-core-timeline.cjs"
|
|
106
106
|
},
|
|
107
107
|
"./components/kbd": {
|
|
108
108
|
"import": "./dist/kupola-core-kbd.esm.js",
|
|
109
|
-
"require": "./dist/kupola-core-kbd.cjs
|
|
109
|
+
"require": "./dist/kupola-core-kbd.cjs"
|
|
110
110
|
},
|
|
111
111
|
"./components/countdown": {
|
|
112
112
|
"import": "./dist/kupola-core-countdown.esm.js",
|
|
113
|
-
"require": "./dist/kupola-core-countdown.cjs
|
|
113
|
+
"require": "./dist/kupola-core-countdown.cjs"
|
|
114
114
|
},
|
|
115
115
|
"./components/breadcrumb": {
|
|
116
116
|
"import": "./dist/kupola-core-breadcrumb.esm.js",
|
|
117
|
-
"require": "./dist/kupola-core-breadcrumb.cjs
|
|
117
|
+
"require": "./dist/kupola-core-breadcrumb.cjs"
|
|
118
118
|
},
|
|
119
119
|
"./components/checkbox": {
|
|
120
120
|
"import": "./dist/kupola-core-checkbox.esm.js",
|
|
121
|
-
"require": "./dist/kupola-core-checkbox.cjs
|
|
121
|
+
"require": "./dist/kupola-core-checkbox.cjs"
|
|
122
122
|
},
|
|
123
123
|
"./components/radio": {
|
|
124
124
|
"import": "./dist/kupola-core-radio.esm.js",
|
|
125
|
-
"require": "./dist/kupola-core-radio.cjs
|
|
125
|
+
"require": "./dist/kupola-core-radio.cjs"
|
|
126
126
|
},
|
|
127
127
|
"./components/input": {
|
|
128
128
|
"import": "./dist/kupola-core-input.esm.js",
|
|
129
|
-
"require": "./dist/kupola-core-input.cjs
|
|
129
|
+
"require": "./dist/kupola-core-input.cjs"
|
|
130
130
|
},
|
|
131
131
|
"./components/avatar": {
|
|
132
132
|
"import": "./dist/kupola-core-avatar.esm.js",
|
|
133
|
-
"require": "./dist/kupola-core-avatar.cjs
|
|
133
|
+
"require": "./dist/kupola-core-avatar.cjs"
|
|
134
134
|
},
|
|
135
135
|
"./components/slider": {
|
|
136
136
|
"import": "./dist/kupola-core-slider.esm.js",
|
|
137
|
-
"require": "./dist/kupola-core-slider.cjs
|
|
137
|
+
"require": "./dist/kupola-core-slider.cjs"
|
|
138
138
|
},
|
|
139
139
|
"./components/numberinput": {
|
|
140
140
|
"import": "./dist/kupola-core-numberinput.esm.js",
|
|
141
|
-
"require": "./dist/kupola-core-numberinput.cjs
|
|
141
|
+
"require": "./dist/kupola-core-numberinput.cjs"
|
|
142
142
|
},
|
|
143
143
|
"./components/textarea": {
|
|
144
144
|
"import": "./dist/kupola-core-textarea.esm.js",
|
|
145
|
-
"require": "./dist/kupola-core-textarea.cjs
|
|
145
|
+
"require": "./dist/kupola-core-textarea.cjs"
|
|
146
146
|
},
|
|
147
147
|
"./components/statcard": {
|
|
148
148
|
"import": "./dist/kupola-core-statcard.esm.js",
|
|
149
|
-
"require": "./dist/kupola-core-statcard.cjs
|
|
149
|
+
"require": "./dist/kupola-core-statcard.cjs"
|
|
150
150
|
},
|
|
151
151
|
"./components/timepicker": {
|
|
152
152
|
"import": "./dist/kupola-core-timepicker.esm.js",
|
|
153
|
-
"require": "./dist/kupola-core-timepicker.cjs
|
|
153
|
+
"require": "./dist/kupola-core-timepicker.cjs"
|
|
154
154
|
},
|
|
155
155
|
"./components/carousel": {
|
|
156
156
|
"import": "./dist/kupola-core-carousel.esm.js",
|
|
157
|
-
"require": "./dist/kupola-core-carousel.cjs
|
|
157
|
+
"require": "./dist/kupola-core-carousel.cjs"
|
|
158
158
|
},
|
|
159
159
|
"./components/tree": {
|
|
160
160
|
"import": "./dist/kupola-core-tree.esm.js",
|
|
161
|
-
"require": "./dist/kupola-core-tree.cjs
|
|
161
|
+
"require": "./dist/kupola-core-tree.cjs"
|
|
162
162
|
},
|
|
163
163
|
"./components/menu": {
|
|
164
164
|
"import": "./dist/kupola-core-menu.esm.js",
|
|
165
|
-
"require": "./dist/kupola-core-menu.cjs
|
|
165
|
+
"require": "./dist/kupola-core-menu.cjs"
|
|
166
166
|
},
|
|
167
167
|
"./components/fileupload": {
|
|
168
168
|
"import": "./dist/kupola-core-fileupload.esm.js",
|
|
169
|
-
"require": "./dist/kupola-core-fileupload.cjs
|
|
169
|
+
"require": "./dist/kupola-core-fileupload.cjs"
|
|
170
170
|
},
|
|
171
171
|
"./components/dynamictags": {
|
|
172
172
|
"import": "./dist/kupola-core-dynamictags.esm.js",
|
|
173
|
-
"require": "./dist/kupola-core-dynamictags.cjs
|
|
173
|
+
"require": "./dist/kupola-core-dynamictags.cjs"
|
|
174
174
|
},
|
|
175
175
|
"./components/imagepreview": {
|
|
176
176
|
"import": "./dist/kupola-core-imagepreview.esm.js",
|
|
177
|
-
"require": "./dist/kupola-core-imagepreview.cjs
|
|
177
|
+
"require": "./dist/kupola-core-imagepreview.cjs"
|
|
178
178
|
},
|
|
179
179
|
"./components/colorpicker": {
|
|
180
180
|
"import": "./dist/kupola-core-colorpicker.esm.js",
|
|
181
|
-
"require": "./dist/kupola-core-colorpicker.cjs
|
|
181
|
+
"require": "./dist/kupola-core-colorpicker.cjs"
|
|
182
182
|
},
|
|
183
183
|
"./components/virtuallist": {
|
|
184
184
|
"import": "./dist/kupola-core-virtuallist.esm.js",
|
|
185
|
-
"require": "./dist/kupola-core-virtuallist.cjs
|
|
185
|
+
"require": "./dist/kupola-core-virtuallist.cjs"
|
|
186
186
|
},
|
|
187
187
|
"./components/icons": {
|
|
188
188
|
"import": "./dist/kupola-core-icons.esm.js",
|
|
189
|
-
"require": "./dist/kupola-core-icons.cjs
|
|
189
|
+
"require": "./dist/kupola-core-icons.cjs"
|
|
190
190
|
},
|
|
191
191
|
"./components/message": {
|
|
192
192
|
"import": "./dist/kupola-core-message.esm.js",
|
|
193
|
-
"require": "./dist/kupola-core-message.cjs
|
|
193
|
+
"require": "./dist/kupola-core-message.cjs"
|
|
194
194
|
},
|
|
195
195
|
"./components/heatmap": {
|
|
196
196
|
"import": "./dist/kupola-core-heatmap.esm.js",
|
|
197
|
-
"require": "./dist/kupola-core-heatmap.cjs
|
|
197
|
+
"require": "./dist/kupola-core-heatmap.cjs"
|
|
198
198
|
},
|
|
199
199
|
"./components/calendar": {
|
|
200
200
|
"import": "./dist/kupola-core-calendar.esm.js",
|
|
201
|
-
"require": "./dist/kupola-core-calendar.cjs
|
|
201
|
+
"require": "./dist/kupola-core-calendar.cjs"
|
|
202
202
|
},
|
|
203
203
|
"./components/validation": {
|
|
204
204
|
"import": "./dist/kupola-core-validation.esm.js",
|
|
205
|
-
"require": "./dist/kupola-core-validation.cjs
|
|
205
|
+
"require": "./dist/kupola-core-validation.cjs"
|
|
206
206
|
},
|
|
207
207
|
"./components/form": {
|
|
208
208
|
"import": "./dist/kupola-core-form.esm.js",
|
|
209
|
-
"require": "./dist/kupola-core-form.cjs
|
|
209
|
+
"require": "./dist/kupola-core-form.cjs"
|
|
210
210
|
},
|
|
211
211
|
"./components/table": {
|
|
212
212
|
"import": "./dist/kupola-core-table.esm.js",
|
|
213
|
-
"require": "./dist/kupola-core-table.cjs
|
|
213
|
+
"require": "./dist/kupola-core-table.cjs"
|
|
214
214
|
}
|
|
215
215
|
},
|
|
216
216
|
"files": [
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
/**
|
|
3
|
+
* @kupola/core — DevTools: Signal reactivity profiler.
|
|
4
|
+
*
|
|
5
|
+
* Provides performance profiling for the Kupola reactivity system.
|
|
6
|
+
* Tracks signal reads, writes, effect runs, and computed recomputes.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* ```js
|
|
10
|
+
* import { enableProfiler, getProfileReport, resetProfiler } from '@kupola/kupola/devtools';
|
|
11
|
+
*
|
|
12
|
+
* enableProfiler();
|
|
13
|
+
* // ... run your app ...
|
|
14
|
+
* const report = getProfileReport();
|
|
15
|
+
* console.table(report.signals);
|
|
16
|
+
* console.table(report.effects);
|
|
17
|
+
* resetProfiler();
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @module devtools
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
// ── Profiler state ──────────────────────────────────────────────────────────
|
|
24
|
+
|
|
25
|
+
let _enabled = false;
|
|
26
|
+
let _startTime = 0;
|
|
27
|
+
|
|
28
|
+
/** @type {Map<number, {reads: number, writes: number, triggers: number, label: string}>} */
|
|
29
|
+
const _signalStats = new Map();
|
|
30
|
+
|
|
31
|
+
/** @type {Map<number, {runs: number, totalTime: number, maxTime: number, label: string}>} */
|
|
32
|
+
const _effectStats = new Map();
|
|
33
|
+
|
|
34
|
+
/** @type {Map<number, {recomputes: number, totalTime: number, maxTime: number, label: string}>} */
|
|
35
|
+
const _computedStats = new Map();
|
|
36
|
+
|
|
37
|
+
let _nextSignalId = 0;
|
|
38
|
+
let _nextEffectId = 0;
|
|
39
|
+
let _nextComputedId = 0;
|
|
40
|
+
|
|
41
|
+
/** @type {number} Total trigger count across all signals. */
|
|
42
|
+
let _totalTriggers = 0;
|
|
43
|
+
|
|
44
|
+
/** @type {number} Total effect runs. */
|
|
45
|
+
let _totalEffectRuns = 0;
|
|
46
|
+
|
|
47
|
+
/** @type {number} Total computed recomputes. */
|
|
48
|
+
let _totalComputedRecomputes = 0;
|
|
49
|
+
|
|
50
|
+
// ── Signal ID registry ──────────────────────────────────────────────────────
|
|
51
|
+
|
|
52
|
+
/** @type {WeakMap<Object, number>} Maps signal/computed/effect instances to IDs. */
|
|
53
|
+
const _idMap = new WeakMap();
|
|
54
|
+
|
|
55
|
+
function getOrCreateId(obj, counter) {
|
|
56
|
+
if (!_idMap.has(obj)) {
|
|
57
|
+
_idMap.set(obj, counter);
|
|
58
|
+
return counter;
|
|
59
|
+
}
|
|
60
|
+
return _idMap.get(obj);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// ── Public API ──────────────────────────────────────────────────────────────
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Enable the reactivity profiler. Call this before running your application
|
|
67
|
+
* to start collecting performance data.
|
|
68
|
+
*
|
|
69
|
+
* @param {Object} [options]
|
|
70
|
+
* @param {boolean} [options.console=false] Log events to console in real-time
|
|
71
|
+
*/
|
|
72
|
+
export function enableProfiler(options = {}) {
|
|
73
|
+
_enabled = true;
|
|
74
|
+
_startTime = performance.now();
|
|
75
|
+
_signalStats.clear();
|
|
76
|
+
_effectStats.clear();
|
|
77
|
+
_computedStats.clear();
|
|
78
|
+
_nextSignalId = 0;
|
|
79
|
+
_nextEffectId = 0;
|
|
80
|
+
_nextComputedId = 0;
|
|
81
|
+
_totalTriggers = 0;
|
|
82
|
+
_totalEffectRuns = 0;
|
|
83
|
+
_totalComputedRecomputes = 0;
|
|
84
|
+
if (options.console) {
|
|
85
|
+
console.log('[Kupola Profiler] Enabled');
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Disable the profiler and stop collecting data.
|
|
91
|
+
*/
|
|
92
|
+
export function disableProfiler() {
|
|
93
|
+
_enabled = false;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Reset all profiler data. Call between profiling sessions.
|
|
98
|
+
*/
|
|
99
|
+
export function resetProfiler() {
|
|
100
|
+
_enabled = false;
|
|
101
|
+
_startTime = 0;
|
|
102
|
+
_signalStats.clear();
|
|
103
|
+
_effectStats.clear();
|
|
104
|
+
_computedStats.clear();
|
|
105
|
+
_totalTriggers = 0;
|
|
106
|
+
_totalEffectRuns = 0;
|
|
107
|
+
_totalComputedRecomputes = 0;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Check if profiler is enabled.
|
|
112
|
+
* @returns {boolean}
|
|
113
|
+
*/
|
|
114
|
+
export function isProfilerEnabled() {
|
|
115
|
+
return _enabled;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// ── Tracking functions (called by signal/effect/computed internals) ──────────
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Record a signal write (set .value).
|
|
122
|
+
* @param {Object} sig The Signal instance
|
|
123
|
+
* @param {string} [label] Optional label for the signal
|
|
124
|
+
*/
|
|
125
|
+
export function profileSignalWrite(sig, label) {
|
|
126
|
+
if (!_enabled) {return;}
|
|
127
|
+
const id = getOrCreateId(sig, _nextSignalId);
|
|
128
|
+
if (!_signalStats.has(id)) {
|
|
129
|
+
_signalStats.set(id, { reads: 0, writes: 0, triggers: 0, label: label || `signal#${id}` });
|
|
130
|
+
if (id >= _nextSignalId) {_nextSignalId = id + 1;}
|
|
131
|
+
}
|
|
132
|
+
const stats = _signalStats.get(id);
|
|
133
|
+
stats.writes++;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Record a signal read (get .value inside effect).
|
|
138
|
+
* @param {Object} sig The Signal instance
|
|
139
|
+
* @param {string} [label] Optional label
|
|
140
|
+
*/
|
|
141
|
+
export function profileSignalRead(sig, label) {
|
|
142
|
+
if (!_enabled) {return;}
|
|
143
|
+
const id = getOrCreateId(sig, _nextSignalId);
|
|
144
|
+
if (!_signalStats.has(id)) {
|
|
145
|
+
_signalStats.set(id, { reads: 0, writes: 0, triggers: 0, label: label || `signal#${id}` });
|
|
146
|
+
if (id >= _nextSignalId) {_nextSignalId = id + 1;}
|
|
147
|
+
}
|
|
148
|
+
_signalStats.get(id).reads++;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Record a trigger (signal notifying subscribers).
|
|
153
|
+
* @param {Object} sig The Signal instance
|
|
154
|
+
* @param {number} subscriberCount Number of subscribers notified
|
|
155
|
+
*/
|
|
156
|
+
export function profileTrigger(sig, subscriberCount) {
|
|
157
|
+
if (!_enabled) {return;}
|
|
158
|
+
const id = getOrCreateId(sig, _nextSignalId);
|
|
159
|
+
if (_signalStats.has(id)) {
|
|
160
|
+
_signalStats.get(id).triggers += subscriberCount;
|
|
161
|
+
}
|
|
162
|
+
_totalTriggers += subscriberCount;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Record an effect execution with timing.
|
|
167
|
+
* @param {Object} eff The EffectRecord
|
|
168
|
+
* @param {Function} fn The effect function to run
|
|
169
|
+
* @param {string} [label] Optional label
|
|
170
|
+
* @returns {*} The return value of fn
|
|
171
|
+
*/
|
|
172
|
+
export function profileEffectRun(eff, fn, label) {
|
|
173
|
+
if (!_enabled) {
|
|
174
|
+
return fn();
|
|
175
|
+
}
|
|
176
|
+
const id = getOrCreateId(eff, _nextEffectId);
|
|
177
|
+
if (!_effectStats.has(id)) {
|
|
178
|
+
_effectStats.set(id, { runs: 0, totalTime: 0, maxTime: 0, label: label || `effect#${id}` });
|
|
179
|
+
if (id >= _nextEffectId) {_nextEffectId = id + 1;}
|
|
180
|
+
}
|
|
181
|
+
const stats = _effectStats.get(id);
|
|
182
|
+
const t0 = performance.now();
|
|
183
|
+
const result = fn();
|
|
184
|
+
const elapsed = performance.now() - t0;
|
|
185
|
+
stats.runs++;
|
|
186
|
+
stats.totalTime += elapsed;
|
|
187
|
+
if (elapsed > stats.maxTime) {stats.maxTime = elapsed;}
|
|
188
|
+
_totalEffectRuns++;
|
|
189
|
+
return result;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Record a computed recomputation with timing.
|
|
194
|
+
* @param {Object} comp The computed instance
|
|
195
|
+
* @param {Function} fn The compute function
|
|
196
|
+
* @param {string} [label] Optional label
|
|
197
|
+
* @returns {*} The computed result
|
|
198
|
+
*/
|
|
199
|
+
export function profileComputedRun(comp, fn, label) {
|
|
200
|
+
if (!_enabled) {
|
|
201
|
+
return fn();
|
|
202
|
+
}
|
|
203
|
+
const id = getOrCreateId(comp, _nextComputedId);
|
|
204
|
+
if (!_computedStats.has(id)) {
|
|
205
|
+
_computedStats.set(id, { recomputes: 0, totalTime: 0, maxTime: 0, label: label || `computed#${id}` });
|
|
206
|
+
if (id >= _nextComputedId) {_nextComputedId = id + 1;}
|
|
207
|
+
}
|
|
208
|
+
const stats = _computedStats.get(id);
|
|
209
|
+
const t0 = performance.now();
|
|
210
|
+
const result = fn();
|
|
211
|
+
const elapsed = performance.now() - t0;
|
|
212
|
+
stats.recomputes++;
|
|
213
|
+
stats.totalTime += elapsed;
|
|
214
|
+
if (elapsed > stats.maxTime) {stats.maxTime = elapsed;}
|
|
215
|
+
_totalComputedRecomputes++;
|
|
216
|
+
return result;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// ── Report generation ───────────────────────────────────────────────────────
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Generate a profiling report.
|
|
223
|
+
*
|
|
224
|
+
* @returns {{
|
|
225
|
+
* duration: number,
|
|
226
|
+
* totalTriggers: number,
|
|
227
|
+
* totalEffectRuns: number,
|
|
228
|
+
* totalComputedRecomputes: number,
|
|
229
|
+
* signals: Array<{label: string, reads: number, writes: number, triggers: number}>,
|
|
230
|
+
* effects: Array<{label: string, runs: number, totalTime: string, maxTime: string, avgTime: string}>,
|
|
231
|
+
* computeds: Array<{label: string, recomputes: number, totalTime: string, maxTime: string, avgTime: string}>,
|
|
232
|
+
* }}
|
|
233
|
+
*/
|
|
234
|
+
export function getProfileReport() {
|
|
235
|
+
const duration = _startTime > 0 ? performance.now() - _startTime : 0;
|
|
236
|
+
|
|
237
|
+
const signals = [];
|
|
238
|
+
for (const [, s] of _signalStats) {
|
|
239
|
+
signals.push({ label: s.label, reads: s.reads, writes: s.writes, triggers: s.triggers });
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const effects = [];
|
|
243
|
+
for (const [, s] of _effectStats) {
|
|
244
|
+
const avg = s.runs > 0 ? s.totalTime / s.runs : 0;
|
|
245
|
+
effects.push({
|
|
246
|
+
label: s.label,
|
|
247
|
+
runs: s.runs,
|
|
248
|
+
totalTime: s.totalTime.toFixed(2) + 'ms',
|
|
249
|
+
maxTime: s.maxTime.toFixed(3) + 'ms',
|
|
250
|
+
avgTime: avg.toFixed(3) + 'ms',
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const computeds = [];
|
|
255
|
+
for (const [, s] of _computedStats) {
|
|
256
|
+
const avg = s.recomputes > 0 ? s.totalTime / s.recomputes : 0;
|
|
257
|
+
computeds.push({
|
|
258
|
+
label: s.label,
|
|
259
|
+
recomputes: s.recomputes,
|
|
260
|
+
totalTime: s.totalTime.toFixed(2) + 'ms',
|
|
261
|
+
maxTime: s.maxTime.toFixed(3) + 'ms',
|
|
262
|
+
avgTime: avg.toFixed(3) + 'ms',
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
return {
|
|
267
|
+
duration: Math.round(duration),
|
|
268
|
+
totalTriggers: _totalTriggers,
|
|
269
|
+
totalEffectRuns: _totalEffectRuns,
|
|
270
|
+
totalComputedRecomputes: _totalComputedRecomputes,
|
|
271
|
+
signals,
|
|
272
|
+
effects,
|
|
273
|
+
computeds,
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Print a human-readable profiling summary to the console.
|
|
279
|
+
*/
|
|
280
|
+
export function printProfileReport() {
|
|
281
|
+
const report = getProfileReport();
|
|
282
|
+
console.log('═══════════════════════════════════════════════════════');
|
|
283
|
+
console.log(' Kupola Reactivity Profile Report');
|
|
284
|
+
console.log('═══════════════════════════════════════════════════════');
|
|
285
|
+
console.log(` Duration: ${report.duration}ms`);
|
|
286
|
+
console.log(` Total triggers: ${report.totalTriggers}`);
|
|
287
|
+
console.log(` Total effect runs: ${report.totalEffectRuns}`);
|
|
288
|
+
console.log(` Total recomputes: ${report.totalComputedRecomputes}`);
|
|
289
|
+
console.log('───────────────────────────────────────────────────────');
|
|
290
|
+
if (report.signals.length > 0) {
|
|
291
|
+
console.log(' Signals:');
|
|
292
|
+
console.table(report.signals);
|
|
293
|
+
}
|
|
294
|
+
if (report.effects.length > 0) {
|
|
295
|
+
console.log(' Effects:');
|
|
296
|
+
console.table(report.effects);
|
|
297
|
+
}
|
|
298
|
+
if (report.computeds.length > 0) {
|
|
299
|
+
console.log(' Computeds:');
|
|
300
|
+
console.table(report.computeds);
|
|
301
|
+
}
|
|
302
|
+
console.log('═══════════════════════════════════════════════════════');
|
|
303
|
+
}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { pushEffect, popEffect } from './signal.js';
|
|
12
|
+
import { isProfilerEnabled, profileEffectRun } from './devtools.js';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* @typedef {Object} EffectRecord
|
|
@@ -70,7 +71,11 @@ function runEffect(eff) {
|
|
|
70
71
|
|
|
71
72
|
pushEffect(eff);
|
|
72
73
|
try {
|
|
73
|
-
|
|
74
|
+
if (isProfilerEnabled()) {
|
|
75
|
+
profileEffectRun(eff, eff._fn);
|
|
76
|
+
} else {
|
|
77
|
+
eff._fn();
|
|
78
|
+
}
|
|
74
79
|
} finally {
|
|
75
80
|
popEffect();
|
|
76
81
|
}
|
|
@@ -43,3 +43,9 @@ export { setLocale, getLocale, t, addMessages } from './i18n.js';
|
|
|
43
43
|
|
|
44
44
|
// ── Error Boundary ───────────────────────────────────────────────────────────
|
|
45
45
|
export { ErrorBoundary } from './errors.js';
|
|
46
|
+
|
|
47
|
+
// ── DevTools (profiler) ──────────────────────────────────────────────────────
|
|
48
|
+
export { enableProfiler, disableProfiler, resetProfiler, getProfileReport, printProfileReport } from './devtools.js';
|
|
49
|
+
|
|
50
|
+
// ── Lazy Load ────────────────────────────────────────────────────────────────
|
|
51
|
+
export { lazyComponent, preloadComponent } from './lazy.js';
|