@kupola/kupola 1.2.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.
Files changed (354) hide show
  1. package/CHANGELOG.md +130 -0
  2. package/INTEGRATION.md +440 -0
  3. package/PROJECT_SUMMARY.md +312 -0
  4. package/README.md +286 -0
  5. package/SKILL.md +572 -0
  6. package/css/accessibility.css +119 -0
  7. package/css/animations.css +224 -0
  8. package/css/brand-themes.css +300 -0
  9. package/css/colors_and_type.css +441 -0
  10. package/css/components-ext.css +4165 -0
  11. package/css/components.css +1483 -0
  12. package/css/kupola.css +12 -0
  13. package/css/responsive.css +697 -0
  14. package/css/scaffold.css +145 -0
  15. package/css/states.css +316 -0
  16. package/css/theme-dark.css +296 -0
  17. package/css/theme-light.css +296 -0
  18. package/css/utilities.css +171 -0
  19. package/dist/css/kupola.css +12 -0
  20. package/dist/icons/icons/activity.svg +3 -0
  21. package/dist/icons/icons/alert-circle.svg +1 -0
  22. package/dist/icons/icons/alert-triangle.svg +1 -0
  23. package/dist/icons/icons/alert.d27e24.svg +1 -0
  24. package/dist/icons/icons/alert.svg +1 -0
  25. package/dist/icons/icons/apple.svg +1 -0
  26. package/dist/icons/icons/arrow-down.svg +1 -0
  27. package/dist/icons/icons/arrow-expand.svg +1 -0
  28. package/dist/icons/icons/arrow-left.svg +1 -0
  29. package/dist/icons/icons/arrow-minimize.svg +1 -0
  30. package/dist/icons/icons/arrow-right-to-line.svg +1 -0
  31. package/dist/icons/icons/arrow-right.svg +1 -0
  32. package/dist/icons/icons/arrow-up-right.svg +1 -0
  33. package/dist/icons/icons/arrow-up.0c0c0d.svg +1 -0
  34. package/dist/icons/icons/arrow-up.svg +1 -0
  35. package/dist/icons/icons/at.svg +1 -0
  36. package/dist/icons/icons/atom.0c0c0d.svg +1 -0
  37. package/dist/icons/icons/atom.svg +1 -0
  38. package/dist/icons/icons/bar-chart-2.svg +1 -0
  39. package/dist/icons/icons/bar.svg +1 -0
  40. package/dist/icons/icons/bell.svg +1 -0
  41. package/dist/icons/icons/box.svg +1 -0
  42. package/dist/icons/icons/bug.svg +1 -0
  43. package/dist/icons/icons/button.svg +1 -0
  44. package/dist/icons/icons/calendar.svg +1 -0
  45. package/dist/icons/icons/check-circle.33c192.svg +1 -0
  46. package/dist/icons/icons/check-circle.svg +1 -0
  47. package/dist/icons/icons/check-square.svg +4 -0
  48. package/dist/icons/icons/check.d1d3db.svg +1 -0
  49. package/dist/icons/icons/check.svg +1 -0
  50. package/dist/icons/icons/chevron-down.svg +1 -0
  51. package/dist/icons/icons/chevron-left.svg +1 -0
  52. package/dist/icons/icons/chevron-right.svg +1 -0
  53. package/dist/icons/icons/chevron-up.svg +1 -0
  54. package/dist/icons/icons/circle.svg +1 -0
  55. package/dist/icons/icons/clock.svg +1 -0
  56. package/dist/icons/icons/cmd.svg +1 -0
  57. package/dist/icons/icons/code.svg +1 -0
  58. package/dist/icons/icons/columns.svg +1 -0
  59. package/dist/icons/icons/copy.svg +1 -0
  60. package/dist/icons/icons/cpu.svg +1 -0
  61. package/dist/icons/icons/dashboard.0c0c0d.svg +1 -0
  62. package/dist/icons/icons/dashboard.svg +1 -0
  63. package/dist/icons/icons/dollar.svg +1 -0
  64. package/dist/icons/icons/download.svg +1 -0
  65. package/dist/icons/icons/edit.svg +1 -0
  66. package/dist/icons/icons/extensions.svg +1 -0
  67. package/dist/icons/icons/external.svg +1 -0
  68. package/dist/icons/icons/eye.svg +1 -0
  69. package/dist/icons/icons/file-text.svg +1 -0
  70. package/dist/icons/icons/file.svg +1 -0
  71. package/dist/icons/icons/files.svg +1 -0
  72. package/dist/icons/icons/filter.svg +1 -0
  73. package/dist/icons/icons/folder-open.svg +4 -0
  74. package/dist/icons/icons/folder.svg +1 -0
  75. package/dist/icons/icons/gear.svg +1 -0
  76. package/dist/icons/icons/git.svg +1 -0
  77. package/dist/icons/icons/github.svg +1 -0
  78. package/dist/icons/icons/globe.svg +1 -0
  79. package/dist/icons/icons/grid-2x2.svg +1 -0
  80. package/dist/icons/icons/hash.svg +1 -0
  81. package/dist/icons/icons/heart.svg +1 -0
  82. package/dist/icons/icons/help-circle.svg +5 -0
  83. package/dist/icons/icons/help.svg +1 -0
  84. package/dist/icons/icons/home.svg +1 -0
  85. package/dist/icons/icons/icons.svg +153 -0
  86. package/dist/icons/icons/image.svg +1 -0
  87. package/dist/icons/icons/info-circle.svg +1 -0
  88. package/dist/icons/icons/info-square.svg +1 -0
  89. package/dist/icons/icons/info.387bff.svg +1 -0
  90. package/dist/icons/icons/info.svg +1 -0
  91. package/dist/icons/icons/input.svg +1 -0
  92. package/dist/icons/icons/key.svg +1 -0
  93. package/dist/icons/icons/layers.svg +1 -0
  94. package/dist/icons/icons/layout-grid.svg +6 -0
  95. package/dist/icons/icons/layout.svg +1 -0
  96. package/dist/icons/icons/link.svg +1 -0
  97. package/dist/icons/icons/list.svg +1 -0
  98. package/dist/icons/icons/lock.svg +1 -0
  99. package/dist/icons/icons/log-out.svg +1 -0
  100. package/dist/icons/icons/logo.svg +1 -0
  101. package/dist/icons/icons/mail.svg +1 -0
  102. package/dist/icons/icons/menu.svg +1 -0
  103. package/dist/icons/icons/message-circle.svg +1 -0
  104. package/dist/icons/icons/message-plus.svg +1 -0
  105. package/dist/icons/icons/message-square.svg +1 -0
  106. package/dist/icons/icons/mic.svg +1 -0
  107. package/dist/icons/icons/minus.svg +1 -0
  108. package/dist/icons/icons/moon.svg +1 -0
  109. package/dist/icons/icons/more-h.svg +1 -0
  110. package/dist/icons/icons/mouse.svg +1 -0
  111. package/dist/icons/icons/palette.svg +1 -0
  112. package/dist/icons/icons/panel-bottom.svg +1 -0
  113. package/dist/icons/icons/pause.svg +1 -0
  114. package/dist/icons/icons/play.svg +1 -0
  115. package/dist/icons/icons/plug.svg +1 -0
  116. package/dist/icons/icons/plus.0c0c0d.svg +1 -0
  117. package/dist/icons/icons/plus.svg +1 -0
  118. package/dist/icons/icons/refresh.svg +1 -0
  119. package/dist/icons/icons/ruler.svg +1 -0
  120. package/dist/icons/icons/scroll-text.svg +1 -0
  121. package/dist/icons/icons/search-menu.svg +1 -0
  122. package/dist/icons/icons/search.svg +1 -0
  123. package/dist/icons/icons/send.0c0c0d.svg +1 -0
  124. package/dist/icons/icons/send.svg +1 -0
  125. package/dist/icons/icons/settings.0c0c0d.svg +1 -0
  126. package/dist/icons/icons/settings.svg +1 -0
  127. package/dist/icons/icons/shield.svg +1 -0
  128. package/dist/icons/icons/sidebar-left.svg +1 -0
  129. package/dist/icons/icons/sidebar-right.svg +1 -0
  130. package/dist/icons/icons/sliders.svg +1 -0
  131. package/dist/icons/icons/sparkles.32f08c.svg +1 -0
  132. package/dist/icons/icons/sparkles.svg +1 -0
  133. package/dist/icons/icons/square.svg +1 -0
  134. package/dist/icons/icons/star.svg +1 -0
  135. package/dist/icons/icons/sun.svg +1 -0
  136. package/dist/icons/icons/table.svg +1 -0
  137. package/dist/icons/icons/terminal.svg +1 -0
  138. package/dist/icons/icons/trash.svg +1 -0
  139. package/dist/icons/icons/trending-down.svg +1 -0
  140. package/dist/icons/icons/trending-up.svg +1 -0
  141. package/dist/icons/icons/type.svg +1 -0
  142. package/dist/icons/icons/upload.svg +1 -0
  143. package/dist/icons/icons/user-circle.svg +1 -0
  144. package/dist/icons/icons/user-plus.svg +6 -0
  145. package/dist/icons/icons/user.svg +1 -0
  146. package/dist/icons/icons/users.svg +1 -0
  147. package/dist/icons/icons/warning.svg +1 -0
  148. package/dist/icons/icons/wrench.svg +1 -0
  149. package/dist/icons/icons/x-circle.svg +1 -0
  150. package/dist/icons/icons/x.svg +1 -0
  151. package/dist/icons/icons/zap.0c0c0d.svg +1 -0
  152. package/dist/icons/icons/zap.svg +1 -0
  153. package/dist/kupola.cjs.js +258 -0
  154. package/dist/kupola.cjs.js.map +1 -0
  155. package/dist/kupola.esm.js +7640 -0
  156. package/dist/kupola.esm.js.map +1 -0
  157. package/dist/kupola.umd.js +258 -0
  158. package/dist/kupola.umd.js.map +1 -0
  159. package/dist/types/kupola.d.ts +1359 -0
  160. package/dist/utils/utils/Kupola.cs +77 -0
  161. package/dist/utils/utils/Kupola.java +104 -0
  162. package/dist/utils/utils/kupola.go +120 -0
  163. package/dist/utils/utils/kupola.js +63 -0
  164. package/dist/utils/utils/kupola.py +1392 -0
  165. package/dist/utils/utils/kupola.rb +69 -0
  166. package/icons/activity.svg +3 -0
  167. package/icons/alert-circle.svg +1 -0
  168. package/icons/alert-triangle.svg +1 -0
  169. package/icons/alert.d27e24.svg +1 -0
  170. package/icons/alert.svg +1 -0
  171. package/icons/apple.svg +1 -0
  172. package/icons/arrow-down.svg +1 -0
  173. package/icons/arrow-expand.svg +1 -0
  174. package/icons/arrow-left.svg +1 -0
  175. package/icons/arrow-minimize.svg +1 -0
  176. package/icons/arrow-right-to-line.svg +1 -0
  177. package/icons/arrow-right.svg +1 -0
  178. package/icons/arrow-up-right.svg +1 -0
  179. package/icons/arrow-up.0c0c0d.svg +1 -0
  180. package/icons/arrow-up.svg +1 -0
  181. package/icons/at.svg +1 -0
  182. package/icons/atom.0c0c0d.svg +1 -0
  183. package/icons/atom.svg +1 -0
  184. package/icons/bar-chart-2.svg +1 -0
  185. package/icons/bar.svg +1 -0
  186. package/icons/bell.svg +1 -0
  187. package/icons/box.svg +1 -0
  188. package/icons/bug.svg +1 -0
  189. package/icons/button.svg +1 -0
  190. package/icons/calendar.svg +1 -0
  191. package/icons/check-circle.33c192.svg +1 -0
  192. package/icons/check-circle.svg +1 -0
  193. package/icons/check-square.svg +4 -0
  194. package/icons/check.d1d3db.svg +1 -0
  195. package/icons/check.svg +1 -0
  196. package/icons/chevron-down.svg +1 -0
  197. package/icons/chevron-left.svg +1 -0
  198. package/icons/chevron-right.svg +1 -0
  199. package/icons/chevron-up.svg +1 -0
  200. package/icons/circle.svg +1 -0
  201. package/icons/clock.svg +1 -0
  202. package/icons/cmd.svg +1 -0
  203. package/icons/code.svg +1 -0
  204. package/icons/columns.svg +1 -0
  205. package/icons/copy.svg +1 -0
  206. package/icons/cpu.svg +1 -0
  207. package/icons/dashboard.0c0c0d.svg +1 -0
  208. package/icons/dashboard.svg +1 -0
  209. package/icons/dollar.svg +1 -0
  210. package/icons/download.svg +1 -0
  211. package/icons/edit.svg +1 -0
  212. package/icons/extensions.svg +1 -0
  213. package/icons/external.svg +1 -0
  214. package/icons/eye.svg +1 -0
  215. package/icons/file-text.svg +1 -0
  216. package/icons/file.svg +1 -0
  217. package/icons/files.svg +1 -0
  218. package/icons/filter.svg +1 -0
  219. package/icons/folder-open.svg +4 -0
  220. package/icons/folder.svg +1 -0
  221. package/icons/gear.svg +1 -0
  222. package/icons/git.svg +1 -0
  223. package/icons/github.svg +1 -0
  224. package/icons/globe.svg +1 -0
  225. package/icons/grid-2x2.svg +1 -0
  226. package/icons/hash.svg +1 -0
  227. package/icons/heart.svg +1 -0
  228. package/icons/help-circle.svg +5 -0
  229. package/icons/help.svg +1 -0
  230. package/icons/home.svg +1 -0
  231. package/icons/icons.svg +153 -0
  232. package/icons/image.svg +1 -0
  233. package/icons/info-circle.svg +1 -0
  234. package/icons/info-square.svg +1 -0
  235. package/icons/info.387bff.svg +1 -0
  236. package/icons/info.svg +1 -0
  237. package/icons/input.svg +1 -0
  238. package/icons/key.svg +1 -0
  239. package/icons/layers.svg +1 -0
  240. package/icons/layout-grid.svg +6 -0
  241. package/icons/layout.svg +1 -0
  242. package/icons/link.svg +1 -0
  243. package/icons/list.svg +1 -0
  244. package/icons/lock.svg +1 -0
  245. package/icons/log-out.svg +1 -0
  246. package/icons/logo.svg +1 -0
  247. package/icons/mail.svg +1 -0
  248. package/icons/menu.svg +1 -0
  249. package/icons/message-circle.svg +1 -0
  250. package/icons/message-plus.svg +1 -0
  251. package/icons/message-square.svg +1 -0
  252. package/icons/mic.svg +1 -0
  253. package/icons/minus.svg +1 -0
  254. package/icons/moon.svg +1 -0
  255. package/icons/more-h.svg +1 -0
  256. package/icons/mouse.svg +1 -0
  257. package/icons/palette.svg +1 -0
  258. package/icons/panel-bottom.svg +1 -0
  259. package/icons/pause.svg +1 -0
  260. package/icons/play.svg +1 -0
  261. package/icons/plug.svg +1 -0
  262. package/icons/plus.0c0c0d.svg +1 -0
  263. package/icons/plus.svg +1 -0
  264. package/icons/refresh.svg +1 -0
  265. package/icons/ruler.svg +1 -0
  266. package/icons/scroll-text.svg +1 -0
  267. package/icons/search-menu.svg +1 -0
  268. package/icons/search.svg +1 -0
  269. package/icons/send.0c0c0d.svg +1 -0
  270. package/icons/send.svg +1 -0
  271. package/icons/settings.0c0c0d.svg +1 -0
  272. package/icons/settings.svg +1 -0
  273. package/icons/shield.svg +1 -0
  274. package/icons/sidebar-left.svg +1 -0
  275. package/icons/sidebar-right.svg +1 -0
  276. package/icons/sliders.svg +1 -0
  277. package/icons/sparkles.32f08c.svg +1 -0
  278. package/icons/sparkles.svg +1 -0
  279. package/icons/square.svg +1 -0
  280. package/icons/star.svg +1 -0
  281. package/icons/sun.svg +1 -0
  282. package/icons/table.svg +1 -0
  283. package/icons/terminal.svg +1 -0
  284. package/icons/trash.svg +1 -0
  285. package/icons/trending-down.svg +1 -0
  286. package/icons/trending-up.svg +1 -0
  287. package/icons/type.svg +1 -0
  288. package/icons/upload.svg +1 -0
  289. package/icons/user-circle.svg +1 -0
  290. package/icons/user-plus.svg +6 -0
  291. package/icons/user.svg +1 -0
  292. package/icons/users.svg +1 -0
  293. package/icons/warning.svg +1 -0
  294. package/icons/wrench.svg +1 -0
  295. package/icons/x-circle.svg +1 -0
  296. package/icons/x.svg +1 -0
  297. package/icons/zap.0c0c0d.svg +1 -0
  298. package/icons/zap.svg +1 -0
  299. package/js/calendar.js +184 -0
  300. package/js/carousel.js +173 -0
  301. package/js/collapse.js +127 -0
  302. package/js/color-picker.js +144 -0
  303. package/js/component.js +276 -0
  304. package/js/composition-api.js +458 -0
  305. package/js/countdown.js +144 -0
  306. package/js/data-bind.js +1286 -0
  307. package/js/datepicker.js +270 -0
  308. package/js/dialog.js +131 -0
  309. package/js/drawer.js +118 -0
  310. package/js/dropdown.js +122 -0
  311. package/js/dynamic-tags.js +156 -0
  312. package/js/error-handler.js +181 -0
  313. package/js/fileupload.js +392 -0
  314. package/js/form.js +291 -0
  315. package/js/global-events.js +203 -0
  316. package/js/heatmap.js +405 -0
  317. package/js/http.js +419 -0
  318. package/js/i18n.js +228 -0
  319. package/js/icons.js +165 -0
  320. package/js/image-preview.js +218 -0
  321. package/js/initializer.js +162 -0
  322. package/js/kupola-core.js +66 -0
  323. package/js/kupola-devtools.js +598 -0
  324. package/js/kupola-lifecycle.js +510 -0
  325. package/js/message.js +60 -0
  326. package/js/modal.js +191 -0
  327. package/js/notification.js +73 -0
  328. package/js/numberinput.js +146 -0
  329. package/js/performance.js +250 -0
  330. package/js/registry.js +205 -0
  331. package/js/router.js +396 -0
  332. package/js/security.js +189 -0
  333. package/js/select.js +143 -0
  334. package/js/slide-captcha.js +504 -0
  335. package/js/slider.js +94 -0
  336. package/js/statcard.js +219 -0
  337. package/js/tag.js +83 -0
  338. package/js/test-utils.js +251 -0
  339. package/js/theme.js +363 -0
  340. package/js/timepicker.js +238 -0
  341. package/js/tooltip.js +122 -0
  342. package/js/utils.js +1458 -0
  343. package/js/validation.js +553 -0
  344. package/js/virtual-list.js +593 -0
  345. package/package.json +105 -0
  346. package/templates/base.html +30 -0
  347. package/templates/base_dashboard.html +99 -0
  348. package/types/kupola.d.ts +1359 -0
  349. package/utils/Kupola.cs +77 -0
  350. package/utils/Kupola.java +104 -0
  351. package/utils/kupola.go +120 -0
  352. package/utils/kupola.js +63 -0
  353. package/utils/kupola.py +1392 -0
  354. package/utils/kupola.rb +69 -0
package/js/modal.js ADDED
@@ -0,0 +1,191 @@
1
+ class Modal {
2
+ constructor(element) {
3
+ this.element = element;
4
+ this.mask = element.querySelector('.ds-modal-mask');
5
+ this.modal = element.querySelector('.ds-modal');
6
+ this.closeBtn = element.querySelector('.ds-modal__close');
7
+
8
+ this._keydownHandler = (e) => {
9
+ if (e.key === 'Escape' && this.isVisible()) {
10
+ this.close();
11
+ }
12
+ };
13
+
14
+ this._closeBtnClickHandler = () => this.close();
15
+
16
+ this._maskClickHandler = (e) => {
17
+ if (e.target === this.mask) {
18
+ this.close();
19
+ }
20
+ };
21
+
22
+ this.init();
23
+ }
24
+
25
+ init() {
26
+ if (this.closeBtn) {
27
+ this.closeBtn.addEventListener('click', this._closeBtnClickHandler);
28
+ }
29
+
30
+ if (this.mask) {
31
+ this.mask.addEventListener('click', this._maskClickHandler);
32
+ }
33
+
34
+ document.addEventListener('keydown', this._keydownHandler);
35
+ }
36
+
37
+ open() {
38
+ this.mask.classList.add('is-visible');
39
+ Modal._openCount = (Modal._openCount || 0) + 1;
40
+ document.body.style.overflow = 'hidden';
41
+ }
42
+
43
+ close() {
44
+ this.mask.classList.remove('is-visible');
45
+ Modal._openCount = Math.max(0, (Modal._openCount || 0) - 1);
46
+ if (Modal._openCount === 0) {
47
+ document.body.style.overflow = '';
48
+ }
49
+ }
50
+
51
+ isVisible() {
52
+ return this.mask.classList.contains('is-visible');
53
+ }
54
+
55
+ destroy() {
56
+ document.removeEventListener('keydown', this._keydownHandler);
57
+ if (this.closeBtn) {
58
+ this.closeBtn.removeEventListener('click', this._closeBtnClickHandler);
59
+ }
60
+ if (this.mask) {
61
+ this.mask.removeEventListener('click', this._maskClickHandler);
62
+ }
63
+ if (this.isVisible()) {
64
+ this.close();
65
+ }
66
+ }
67
+ }
68
+
69
+ Modal._openCount = 0;
70
+
71
+ function createModal(options = {}) {
72
+ const {
73
+ title = '',
74
+ content = '',
75
+ width = '480px',
76
+ onConfirm,
77
+ onCancel
78
+ } = options;
79
+
80
+ const container = document.createElement('div');
81
+ container.className = 'ds-modal-container';
82
+ container.innerHTML = `
83
+ <div class="ds-modal-mask">
84
+ <div class="ds-modal" style="max-width: ${width}">
85
+ <div class="ds-modal__header">
86
+ <span class="ds-modal__title"></span>
87
+ <button class="ds-modal__close" aria-label="Close">
88
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
89
+ <path d="M18 6L6 18M6 6l12 12"/>
90
+ </svg>
91
+ </button>
92
+ </div>
93
+ <div class="ds-modal__body"></div>
94
+ ${onConfirm || onCancel ? `
95
+ <div class="ds-modal__footer">
96
+ ${onCancel ? `<button class="ds-btn ds-btn--ghost" data-modal-cancel>Cancel</button>` : ''}
97
+ ${onConfirm ? `<button class="ds-btn ds-btn--brand" data-modal-confirm>OK</button>` : ''}
98
+ </div>
99
+ ` : ''}
100
+ </div>
101
+ </div>
102
+ `;
103
+
104
+ document.body.appendChild(container);
105
+
106
+ const modal = new Modal(container);
107
+
108
+ const titleEl = container.querySelector('.ds-modal__title');
109
+ if (titleEl) titleEl.textContent = title;
110
+ const bodyEl = container.querySelector('.ds-modal__body');
111
+ if (bodyEl) bodyEl.textContent = content;
112
+
113
+ const confirmBtn = container.querySelector('[data-modal-confirm]');
114
+ const cancelBtn = container.querySelector('[data-modal-cancel]');
115
+
116
+ const confirmHandler = () => {
117
+ if (onConfirm) onConfirm();
118
+ modal.close();
119
+ };
120
+
121
+ const cancelHandler = () => {
122
+ if (onCancel) onCancel();
123
+ modal.close();
124
+ };
125
+
126
+ if (confirmBtn) {
127
+ confirmBtn.addEventListener('click', confirmHandler);
128
+ }
129
+
130
+ if (cancelBtn) {
131
+ cancelBtn.addEventListener('click', cancelHandler);
132
+ }
133
+
134
+ const closeAndDestroy = () => {
135
+ setTimeout(() => {
136
+ if (confirmBtn) {
137
+ confirmBtn.removeEventListener('click', confirmHandler);
138
+ }
139
+ if (cancelBtn) {
140
+ cancelBtn.removeEventListener('click', cancelHandler);
141
+ }
142
+ modal.destroy();
143
+ container.remove();
144
+ }, 300);
145
+ };
146
+
147
+ const originalClose = modal.close.bind(modal);
148
+ modal.close = () => {
149
+ originalClose();
150
+ closeAndDestroy();
151
+ };
152
+
153
+ modal.open();
154
+
155
+ return modal;
156
+ }
157
+
158
+ function initModal(element) {
159
+ if (element.__kupolaInitialized) return;
160
+
161
+ const modal = new Modal(element);
162
+ element.__kupolaInstance = modal;
163
+ element.__kupolaInitialized = true;
164
+ }
165
+
166
+ function cleanupModal(element) {
167
+ if (!element.__kupolaInitialized || !element.__kupolaInstance) return;
168
+
169
+ const modal = element.__kupolaInstance;
170
+ modal.destroy();
171
+
172
+ element.__kupolaInstance = null;
173
+ element.__kupolaInitialized = false;
174
+ }
175
+
176
+ function initModals() {
177
+ document.querySelectorAll('.ds-modal-container').forEach(container => {
178
+ initModal(container);
179
+ });
180
+ }
181
+
182
+ if (typeof module !== 'undefined' && module.exports) {
183
+ module.exports = { Modal, initModals, initModal, cleanupModal, createModal };
184
+ } else {
185
+ window.initModal = initModal;
186
+ window.cleanupModal = cleanupModal;
187
+ }
188
+
189
+ if (window.kupolaInitializer) {
190
+ window.kupolaInitializer.register('modal', initModal, cleanupModal);
191
+ }
@@ -0,0 +1,73 @@
1
+ const Notification = {
2
+ normal: function(options) {
3
+ this.show({ ...options, type: 'normal' });
4
+ },
5
+ success: function(options) {
6
+ this.show({ ...options, type: 'success' });
7
+ },
8
+ error: function(options) {
9
+ this.show({ ...options, type: 'error' });
10
+ },
11
+ warning: function(options) {
12
+ this.show({ ...options, type: 'warning' });
13
+ },
14
+ info: function(options) {
15
+ this.show({ ...options, type: 'info' });
16
+ },
17
+ show: function(options) {
18
+ const { title, message, type = 'normal', duration = 4000 } = options;
19
+
20
+ const notification = document.createElement('div');
21
+ notification.className = `ds-notification__item ds-notification__item--${type}`;
22
+
23
+ const icons = {
24
+ normal: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>',
25
+ success: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="20 6 9 17 4 12"/></svg>',
26
+ error: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>',
27
+ warning: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>',
28
+ info: '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>'
29
+ };
30
+
31
+ notification.innerHTML = `
32
+ <div class="ds-notification__icon ds-notification__icon--${type}">${icons[type]}</div>
33
+ <div class="ds-notification__content">
34
+ ${title ? '<div class="ds-notification__title"></div>' : ''}
35
+ ${message ? '<div class="ds-notification__message"></div>' : ''}
36
+ </div>
37
+ <button class="ds-notification__close">
38
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
39
+ </button>
40
+ `;
41
+ if (title) notification.querySelector('.ds-notification__title').textContent = title;
42
+ if (message) notification.querySelector('.ds-notification__message').textContent = message;
43
+
44
+ let container = document.querySelector('.ds-notification');
45
+ if (!container) {
46
+ container = document.createElement('div');
47
+ container.className = 'ds-notification';
48
+ document.body.appendChild(container);
49
+ }
50
+
51
+ container.appendChild(notification);
52
+
53
+ setTimeout(() => {
54
+ notification.classList.add('is-visible');
55
+ }, 10);
56
+
57
+ notification.querySelector('.ds-notification__close').addEventListener('click', () => {
58
+ notification.classList.remove('is-visible');
59
+ notification.classList.add('is-exiting');
60
+ setTimeout(() => notification.remove(), 300);
61
+ });
62
+
63
+ if (duration > 0) {
64
+ setTimeout(() => {
65
+ notification.classList.remove('is-visible');
66
+ notification.classList.add('is-exiting');
67
+ setTimeout(() => notification.remove(), 300);
68
+ }, duration);
69
+ }
70
+ }
71
+ };
72
+
73
+ function initNotifications() {}
@@ -0,0 +1,146 @@
1
+ class NumberInput {
2
+ constructor(element) {
3
+ this.element = element;
4
+ this.minusBtn = element.querySelector('.ds-number-input__btn--decrease');
5
+ this.plusBtn = element.querySelector('.ds-number-input__btn--increase');
6
+ this.inputEl = element.querySelector('.ds-number-input__input');
7
+ this._listeners = [];
8
+
9
+ if (!this.minusBtn || !this.plusBtn || !this.inputEl) {
10
+ throw new Error('NumberInput: Missing required elements');
11
+ }
12
+
13
+ this.min = parseInt(this.inputEl.getAttribute('min')) || -Infinity;
14
+ this.max = parseInt(this.inputEl.getAttribute('max')) || Infinity;
15
+ this.step = parseInt(this.inputEl.getAttribute('step')) || 1;
16
+
17
+ this.init();
18
+ }
19
+
20
+ init() {
21
+ this.bindEvents();
22
+ this.updateState();
23
+ }
24
+
25
+ bindEvents() {
26
+ const minusHandler = () => this.updateValue(-this.step);
27
+ const plusHandler = () => this.updateValue(this.step);
28
+ const inputHandler = () => this.handleInput();
29
+
30
+ this.minusBtn.addEventListener('click', minusHandler);
31
+ this.plusBtn.addEventListener('click', plusHandler);
32
+ this.inputEl.addEventListener('input', inputHandler);
33
+
34
+ this._listeners.push(
35
+ { el: this.minusBtn, event: 'click', handler: minusHandler },
36
+ { el: this.plusBtn, event: 'click', handler: plusHandler },
37
+ { el: this.inputEl, event: 'input', handler: inputHandler }
38
+ );
39
+ }
40
+
41
+ updateValue(delta) {
42
+ let value = parseInt(this.inputEl.value) || 0;
43
+ value += delta;
44
+
45
+ if (value < this.min) value = this.min;
46
+ if (value > this.max) value = this.max;
47
+
48
+ this.inputEl.value = value;
49
+ this.inputEl.dispatchEvent(new Event('change'));
50
+ this.updateState();
51
+ this.dispatchChange();
52
+ }
53
+
54
+ handleInput() {
55
+ let value = parseInt(this.inputEl.value);
56
+ if (isNaN(value)) value = 0;
57
+ if (value < this.min) value = this.min;
58
+ if (value > this.max) value = this.max;
59
+ this.inputEl.value = value;
60
+ this.updateState();
61
+ this.dispatchChange();
62
+ }
63
+
64
+ updateState() {
65
+ const value = parseInt(this.inputEl.value) || 0;
66
+ this.minusBtn.disabled = value <= this.min;
67
+ this.plusBtn.disabled = value >= this.max;
68
+ }
69
+
70
+ setValue(value) {
71
+ if (value < this.min) value = this.min;
72
+ if (value > this.max) value = this.max;
73
+ this.inputEl.value = value;
74
+ this.updateState();
75
+ this.dispatchChange();
76
+ }
77
+
78
+ getValue() {
79
+ return parseInt(this.inputEl.value) || 0;
80
+ }
81
+
82
+ setRange(min, max) {
83
+ this.min = min;
84
+ this.max = max;
85
+ this.updateState();
86
+ }
87
+
88
+ dispatchChange() {
89
+ this.element.dispatchEvent(new CustomEvent('ds-number-input-change', {
90
+ detail: {
91
+ value: this.getValue()
92
+ }
93
+ }));
94
+ }
95
+
96
+ destroy() {
97
+ this._listeners.forEach(({ el, event, handler }) => {
98
+ el.removeEventListener(event, handler);
99
+ });
100
+ this._listeners = null;
101
+ this.minusBtn = null;
102
+ this.plusBtn = null;
103
+ this.inputEl = null;
104
+ this.element = null;
105
+ }
106
+ }
107
+
108
+ function initNumberInput(element) {
109
+ if (element.__kupolaInitialized) return;
110
+
111
+ try {
112
+ const instance = new NumberInput(element);
113
+ element.__kupolaInstance = instance;
114
+ element.__kupolaInitialized = true;
115
+ } catch (error) {
116
+ console.error('[NumberInput] Error initializing:', error);
117
+ }
118
+ }
119
+
120
+ function cleanupNumberInput(element) {
121
+ if (!element.__kupolaInitialized || !element.__kupolaInstance) return;
122
+
123
+ const instance = element.__kupolaInstance;
124
+ instance.destroy();
125
+
126
+ element.__kupolaInstance = null;
127
+ element.__kupolaInitialized = false;
128
+ }
129
+
130
+ function initNumberInputs() {
131
+ document.querySelectorAll('.ds-number-input').forEach(input => {
132
+ initNumberInput(input);
133
+ });
134
+ }
135
+
136
+ if (typeof module !== 'undefined' && module.exports) {
137
+ module.exports = { NumberInput, initNumberInputs, initNumberInput, cleanupNumberInput };
138
+ } else {
139
+ window.NumberInput = NumberInput;
140
+ window.initNumberInput = initNumberInput;
141
+ window.cleanupNumberInput = cleanupNumberInput;
142
+ }
143
+
144
+ if (window.kupolaInitializer) {
145
+ window.kupolaInitializer.register('number-input', initNumberInput, cleanupNumberInput);
146
+ }
@@ -0,0 +1,250 @@
1
+ class KupolaPerformance {
2
+ constructor() {
3
+ this.metrics = new Map();
4
+ this.timers = new Map();
5
+ this.observers = [];
6
+ this.enabled = false;
7
+ this.thresholds = {
8
+ render: 16,
9
+ mount: 100,
10
+ update: 50,
11
+ http: 3000
12
+ };
13
+ }
14
+
15
+ init() {
16
+ this.enabled = true;
17
+ this._setupObservers();
18
+ this._measureNavigation();
19
+ }
20
+
21
+ _setupObservers() {
22
+ if ('PerformanceObserver' in window) {
23
+ const paintObserver = new PerformanceObserver((entryList) => {
24
+ entryList.getEntries().forEach(entry => {
25
+ this._recordMetric('paint', {
26
+ name: entry.name,
27
+ startTime: entry.startTime,
28
+ duration: entry.duration
29
+ });
30
+ });
31
+ });
32
+ paintObserver.observe({ type: 'paint', buffered: true });
33
+ this.observers.push(paintObserver);
34
+
35
+ const resourceObserver = new PerformanceObserver((entryList) => {
36
+ entryList.getEntries().forEach(entry => {
37
+ this._recordMetric('resource', {
38
+ name: entry.name,
39
+ type: entry.initiatorType,
40
+ duration: entry.duration,
41
+ size: entry.transferSize,
42
+ startTime: entry.startTime
43
+ });
44
+ });
45
+ });
46
+ resourceObserver.observe({ type: 'resource', buffered: true });
47
+ this.observers.push(resourceObserver);
48
+
49
+ const longTaskObserver = new PerformanceObserver((entryList) => {
50
+ entryList.getEntries().forEach(entry => {
51
+ this._recordMetric('longtask', {
52
+ duration: entry.duration,
53
+ startTime: entry.startTime
54
+ });
55
+ });
56
+ });
57
+ longTaskObserver.observe({ type: 'longtask', buffered: true });
58
+ this.observers.push(longTaskObserver);
59
+ }
60
+ }
61
+
62
+ _measureNavigation() {
63
+ if ('performance' in window) {
64
+ const nav = performance.getEntriesByType('navigation')[0];
65
+ if (nav) {
66
+ this._recordMetric('navigation', {
67
+ domContentLoaded: nav.domContentLoadedEventEnd - nav.fetchStart,
68
+ load: nav.loadEventEnd - nav.fetchStart,
69
+ firstByte: nav.responseStart - nav.requestStart,
70
+ redirectCount: nav.redirectCount
71
+ });
72
+ }
73
+ }
74
+ }
75
+
76
+ startTimer(name, context = {}) {
77
+ if (!this.enabled) return;
78
+
79
+ this.timers.set(name, {
80
+ startTime: performance.now(),
81
+ context
82
+ });
83
+ }
84
+
85
+ stopTimer(name) {
86
+ if (!this.enabled) return null;
87
+
88
+ const timer = this.timers.get(name);
89
+ if (!timer) return null;
90
+
91
+ const duration = performance.now() - timer.startTime;
92
+ this.timers.delete(name);
93
+
94
+ this._recordMetric('timer', {
95
+ name,
96
+ duration,
97
+ ...timer.context
98
+ });
99
+
100
+ return duration;
101
+ }
102
+
103
+ _recordMetric(type, data) {
104
+ if (!this.enabled) return;
105
+
106
+ const metric = {
107
+ type,
108
+ timestamp: Date.now(),
109
+ ...data
110
+ };
111
+
112
+ if (!this.metrics.has(type)) {
113
+ this.metrics.set(type, []);
114
+ }
115
+ this.metrics.get(type).push(metric);
116
+ }
117
+
118
+ measure(fn, name, context = {}) {
119
+ if (!this.enabled) return fn();
120
+
121
+ this.startTimer(name, context);
122
+
123
+ let result;
124
+ let error;
125
+
126
+ try {
127
+ result = fn();
128
+ } catch (e) {
129
+ error = e;
130
+ }
131
+
132
+ const duration = this.stopTimer(name);
133
+
134
+ if (error) {
135
+ throw error;
136
+ }
137
+
138
+ return result;
139
+ }
140
+
141
+ measureAsync(fn, name, context = {}) {
142
+ if (!this.enabled) return fn();
143
+
144
+ this.startTimer(name, context);
145
+
146
+ return fn().then(result => {
147
+ this.stopTimer(name);
148
+ return result;
149
+ }).catch(error => {
150
+ this.stopTimer(name);
151
+ throw error;
152
+ });
153
+ }
154
+
155
+ getMetrics(type) {
156
+ if (type) {
157
+ return this.metrics.get(type) || [];
158
+ }
159
+ return Array.from(this.metrics.entries());
160
+ }
161
+
162
+ getSummary() {
163
+ const summary = {
164
+ navigation: null,
165
+ paint: null,
166
+ timers: [],
167
+ resources: [],
168
+ longTasks: []
169
+ };
170
+
171
+ if (this.metrics.has('navigation')) {
172
+ summary.navigation = this.metrics.get('navigation')[0];
173
+ }
174
+
175
+ if (this.metrics.has('paint')) {
176
+ summary.paint = this.metrics.get('paint');
177
+ }
178
+
179
+ if (this.metrics.has('timer')) {
180
+ summary.timers = this.metrics.get('timer');
181
+ }
182
+
183
+ if (this.metrics.has('resource')) {
184
+ summary.resources = this.metrics.get('resource');
185
+ }
186
+
187
+ if (this.metrics.has('longtask')) {
188
+ summary.longTasks = this.metrics.get('longtask');
189
+ }
190
+
191
+ return summary;
192
+ }
193
+
194
+ getPerformanceScore() {
195
+ const summary = this.getSummary();
196
+ let score = 100;
197
+
198
+ if (summary.navigation) {
199
+ if (summary.navigation.load > 3000) score -= 20;
200
+ else if (summary.navigation.load > 2000) score -= 10;
201
+
202
+ if (summary.navigation.domContentLoaded > 1500) score -= 15;
203
+ else if (summary.navigation.domContentLoaded > 1000) score -= 5;
204
+ }
205
+
206
+ if (summary.paint) {
207
+ const fcp = summary.paint.find(p => p.name === 'first-contentful-paint');
208
+ if (fcp && fcp.startTime > 2000) score -= 20;
209
+ else if (fcp && fcp.startTime > 1000) score -= 10;
210
+ }
211
+
212
+ if (summary.longTasks.length > 0) {
213
+ score -= summary.longTasks.length * 10;
214
+ }
215
+
216
+ return Math.max(0, score);
217
+ }
218
+
219
+ logSummary() {
220
+ const summary = this.getSummary();
221
+ const score = this.getPerformanceScore();
222
+
223
+ console.group('[KupolaPerformance] Summary');
224
+ console.log('Score:', score);
225
+ console.log('Navigation:', summary.navigation);
226
+ console.log('Paint:', summary.paint);
227
+ console.log('Long Tasks:', summary.longTasks.length);
228
+ console.groupEnd();
229
+ }
230
+
231
+ clear() {
232
+ this.metrics.clear();
233
+ this.timers.clear();
234
+ }
235
+
236
+ destroy() {
237
+ this.observers.forEach(observer => {
238
+ observer.disconnect();
239
+ });
240
+ this.observers = [];
241
+ this.clear();
242
+ this.enabled = false;
243
+ }
244
+ }
245
+
246
+ const kupolaPerformance = new KupolaPerformance();
247
+ window.kupolaPerformance = kupolaPerformance;
248
+ window.KupolaPerformance = KupolaPerformance;
249
+
250
+ export default KupolaPerformance;