native-document 1.0.15 → 1.0.16-8.2

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 (649) hide show
  1. package/.npmrc.example +1 -0
  2. package/.vitepress/config.js +166 -0
  3. package/CHANGELOG.md +153 -0
  4. package/cdn.js +19 -0
  5. package/components.d.ts +2 -0
  6. package/components.js +30 -0
  7. package/devtools/ComponentRegistry.js +113 -0
  8. package/devtools/index.js +8 -0
  9. package/devtools/plugin/dev-tools-plugin.js +15 -0
  10. package/devtools/transformers/nd-vite-devtools.js +55 -0
  11. package/devtools/transformers/src/transformComponentForHrm.js +73 -0
  12. package/devtools/transformers/src/transformJsFile.js +9 -0
  13. package/devtools/transformers/src/utils.js +79 -0
  14. package/devtools/transformers/templates/hrm.hook.template.js +46 -0
  15. package/devtools/transformers/templates/hrm.orbservable.hook.template.js +76 -0
  16. package/devtools/widget/Widget.js +49 -0
  17. package/devtools/widget/widget.css +81 -0
  18. package/devtools/widget.js +23 -0
  19. package/dist/native-document.components.min.css +1 -0
  20. package/dist/native-document.components.min.js +23847 -0
  21. package/dist/native-document.dev.js +8421 -1492
  22. package/dist/native-document.dev.js.map +1 -0
  23. package/dist/native-document.devtools.min.js +1 -0
  24. package/dist/native-document.min.js +1 -1
  25. package/docs/advanced-components.md +419 -0
  26. package/docs/anchor.md +181 -257
  27. package/docs/cache.md +180 -0
  28. package/docs/cli.md +179 -0
  29. package/docs/components/accordion.md +172 -0
  30. package/docs/components/alert.md +99 -0
  31. package/docs/components/avatar.md +160 -0
  32. package/docs/components/badge.md +102 -0
  33. package/docs/components/breadcrumb.md +89 -0
  34. package/docs/components/button.md +183 -0
  35. package/docs/components/card.md +69 -0
  36. package/docs/components/context-menu.md +118 -0
  37. package/docs/components/data-table.md +345 -0
  38. package/docs/components/dropdown.md +214 -0
  39. package/docs/components/form/autocomplete-field.md +81 -0
  40. package/docs/components/form/checkbox-field.md +41 -0
  41. package/docs/components/form/checkbox-group-field.md +54 -0
  42. package/docs/components/form/color-field.md +64 -0
  43. package/docs/components/form/date-field.md +92 -0
  44. package/docs/components/form/field-collection.md +63 -0
  45. package/docs/components/form/file-field.md +203 -0
  46. package/docs/components/form/form-control.md +87 -0
  47. package/docs/components/form/image-field.md +90 -0
  48. package/docs/components/form/index.md +115 -0
  49. package/docs/components/form/number-field.md +65 -0
  50. package/docs/components/form/radio-field.md +51 -0
  51. package/docs/components/form/select-field.md +123 -0
  52. package/docs/components/form/slider.md +136 -0
  53. package/docs/components/form/string-field.md +134 -0
  54. package/docs/components/form/textarea-field.md +65 -0
  55. package/docs/components/form-fields.md +372 -0
  56. package/docs/components/getting-started.md +264 -0
  57. package/docs/components/index.md +337 -0
  58. package/docs/components/layout.md +279 -0
  59. package/docs/components/list.md +73 -0
  60. package/docs/components/menu.md +215 -0
  61. package/docs/components/modal.md +156 -0
  62. package/docs/components/pagination.md +95 -0
  63. package/docs/components/popover.md +131 -0
  64. package/docs/components/progress.md +111 -0
  65. package/docs/components/shortcut-manager.md +221 -0
  66. package/docs/components/simple-table.md +107 -0
  67. package/docs/components/skeleton.md +155 -0
  68. package/docs/components/spinner.md +100 -0
  69. package/docs/components/splitter.md +133 -0
  70. package/docs/components/stepper.md +163 -0
  71. package/docs/components/switch.md +113 -0
  72. package/docs/components/tabs.md +153 -0
  73. package/docs/components/toast.md +119 -0
  74. package/docs/components/tooltip.md +151 -0
  75. package/docs/components/traits.md +261 -0
  76. package/docs/conditional-rendering.md +177 -502
  77. package/docs/contributing.md +300 -25
  78. package/docs/core-concepts.md +207 -366
  79. package/docs/elements.md +266 -254
  80. package/docs/extending-native-document-element.md +259 -0
  81. package/docs/filters.md +247 -0
  82. package/docs/getting-started.md +195 -257
  83. package/docs/i18n.md +241 -0
  84. package/docs/index.md +76 -0
  85. package/docs/lifecycle-events.md +146 -67
  86. package/docs/list-rendering.md +240 -460
  87. package/docs/memory-management.md +135 -46
  88. package/docs/native-document-element.md +487 -0
  89. package/docs/native-fetch.md +213 -0
  90. package/docs/observable-resource.md +364 -0
  91. package/docs/observables.md +690 -357
  92. package/docs/routing.md +246 -646
  93. package/docs/state-management.md +213 -306
  94. package/docs/svg-elements.md +231 -0
  95. package/docs/theming.md +409 -0
  96. package/docs/tutorials/.gitkeep +0 -0
  97. package/docs/validation.md +98 -91
  98. package/docs/vitepress-conventions.md +219 -0
  99. package/elements.d.ts +7 -0
  100. package/elements.js +3 -4
  101. package/eslint.config.js +35 -0
  102. package/i18n.js +1 -0
  103. package/i18n.ts +2 -0
  104. package/index.d.ts +21 -0
  105. package/index.def.js +1086 -0
  106. package/index.js +19 -13
  107. package/package.json +59 -9
  108. package/readme.md +296 -93
  109. package/rollup.config.js +52 -3
  110. package/router.d.ts +7 -0
  111. package/router.js +0 -0
  112. package/src/components/$traits/has-draggable/HasDraggable.d.ts +4 -0
  113. package/src/components/$traits/has-draggable/HasDraggable.js +82 -0
  114. package/src/components/$traits/has-draggable/has-draggable.css +8 -0
  115. package/src/components/$traits/has-items/HasItems.d.ts +9 -0
  116. package/src/components/$traits/has-items/HasItems.js +64 -0
  117. package/src/components/$traits/has-position/HasFullPosition.d.ts +14 -0
  118. package/src/components/$traits/has-position/HasFullPosition.js +95 -0
  119. package/src/components/$traits/has-position/HasPosition.d.ts +7 -0
  120. package/src/components/$traits/has-position/HasPosition.js +45 -0
  121. package/src/components/$traits/has-resizable/HasResizable.d.ts +13 -0
  122. package/src/components/$traits/has-resizable/HasResizable.js +122 -0
  123. package/src/components/$traits/has-resizable/has-resizable.css +121 -0
  124. package/src/components/$traits/has-validation/HasValidation.d.ts +17 -0
  125. package/src/components/$traits/has-validation/HasValidation.js +133 -0
  126. package/src/components/BaseComponent.d.ts +32 -0
  127. package/src/components/BaseComponent.js +247 -0
  128. package/src/components/accordion/Accordion.js +268 -0
  129. package/src/components/accordion/AccordionItem.js +233 -0
  130. package/src/components/accordion/index.js +7 -0
  131. package/src/components/accordion/types/Accordion.d.ts +47 -0
  132. package/src/components/accordion/types/AccordionItem.d.ts +48 -0
  133. package/src/components/alert/Alert.js +350 -0
  134. package/src/components/alert/index.js +6 -0
  135. package/src/components/alert/types/Alert.d.ts +62 -0
  136. package/src/components/avatar/Avatar.js +430 -0
  137. package/src/components/avatar/AvatarGroup.js +97 -0
  138. package/src/components/avatar/index.js +7 -0
  139. package/src/components/avatar/types/Avatar.d.ts +74 -0
  140. package/src/components/avatar/types/AvatarGroup.d.ts +32 -0
  141. package/src/components/badge/Badge.js +245 -0
  142. package/src/components/badge/index.js +6 -0
  143. package/src/components/badge/types/Badge.d.ts +51 -0
  144. package/src/components/base-component.css +0 -0
  145. package/src/components/breadcrumb/BreadCrumb.js +138 -0
  146. package/src/components/breadcrumb/index.js +5 -0
  147. package/src/components/breadcrumb/types/BreadCrumb.d.ts +42 -0
  148. package/src/components/button/Button.js +320 -0
  149. package/src/components/button/index.js +5 -0
  150. package/src/components/button/types/Button.d.ts +62 -0
  151. package/src/components/card/Card.js +282 -0
  152. package/src/components/card/index.js +5 -0
  153. package/src/components/card/types/Card.d.ts +42 -0
  154. package/src/components/context-menu/ContextMenu.js +127 -0
  155. package/src/components/context-menu/ContextMenuGroup.js +29 -0
  156. package/src/components/context-menu/ContextMenuItem.js +28 -0
  157. package/src/components/context-menu/index.js +10 -0
  158. package/src/components/context-menu/types/ContextMenu.d.ts +30 -0
  159. package/src/components/context-menu/types/ContextMenuGroup.d.ts +18 -0
  160. package/src/components/context-menu/types/ContextMenuItem.d.ts +18 -0
  161. package/src/components/divider/Divider.js +256 -0
  162. package/src/components/divider/index.js +6 -0
  163. package/src/components/divider/types/Divider.d.ts +55 -0
  164. package/src/components/dropdown/Dropdown.js +531 -0
  165. package/src/components/dropdown/DropdownDivider.js +45 -0
  166. package/src/components/dropdown/DropdownGroup.js +83 -0
  167. package/src/components/dropdown/DropdownItem.js +150 -0
  168. package/src/components/dropdown/DropdownTrigger.js +93 -0
  169. package/src/components/dropdown/helpers.js +53 -0
  170. package/src/components/dropdown/index.js +13 -0
  171. package/src/components/dropdown/types/Dropdown.d.ts +88 -0
  172. package/src/components/dropdown/types/DropdownDivider.d.ts +20 -0
  173. package/src/components/dropdown/types/DropdownGroup.d.ts +25 -0
  174. package/src/components/dropdown/types/DropdownItem.d.ts +41 -0
  175. package/src/components/dropdown/types/DropdownTrigger.d.ts +32 -0
  176. package/src/components/form/FormControl.js +498 -0
  177. package/src/components/form/field/Field.js +419 -0
  178. package/src/components/form/field/FieldCollection.js +292 -0
  179. package/src/components/form/field/types/AutocompleteField.js +168 -0
  180. package/src/components/form/field/types/CheckboxField.js +77 -0
  181. package/src/components/form/field/types/CheckboxGroupField.js +171 -0
  182. package/src/components/form/field/types/ColorField.js +102 -0
  183. package/src/components/form/field/types/DateField.js +315 -0
  184. package/src/components/form/field/types/EmailField.js +104 -0
  185. package/src/components/form/field/types/FileField.js +276 -0
  186. package/src/components/form/field/types/HiddenField.js +44 -0
  187. package/src/components/form/field/types/ImageField.js +138 -0
  188. package/src/components/form/field/types/NumberField.js +177 -0
  189. package/src/components/form/field/types/PasswordField.js +200 -0
  190. package/src/components/form/field/types/RadioField.js +145 -0
  191. package/src/components/form/field/types/RangeField.js +117 -0
  192. package/src/components/form/field/types/SearchField.js +66 -0
  193. package/src/components/form/field/types/SelectField.js +247 -0
  194. package/src/components/form/field/types/StringField.js +148 -0
  195. package/src/components/form/field/types/TelField.js +98 -0
  196. package/src/components/form/field/types/TextAreaField.js +142 -0
  197. package/src/components/form/field/types/TimeField.js +215 -0
  198. package/src/components/form/field/types/UrlField.js +115 -0
  199. package/src/components/form/field/types/file-field-mode/FileAvatarMode.js +183 -0
  200. package/src/components/form/field/types/file-field-mode/FileDropzoneMode.js +117 -0
  201. package/src/components/form/field/types/file-field-mode/FileItemPreview.js +150 -0
  202. package/src/components/form/field/types/file-field-mode/FileNativeMode.js +43 -0
  203. package/src/components/form/field/types/file-field-mode/FileUploadButtonMode.js +120 -0
  204. package/src/components/form/field/types/file-field-mode/FileWallMode.js +106 -0
  205. package/src/components/form/index.js +61 -0
  206. package/src/components/form/merge +0 -0
  207. package/src/components/form/types/Field.d.ts +73 -0
  208. package/src/components/form/types/FieldCollection.d.ts +53 -0
  209. package/src/components/form/types/FormControl.d.ts +64 -0
  210. package/src/components/form/types/fields/AutocompleteField.d.ts +48 -0
  211. package/src/components/form/types/fields/CheckboxField.d.ts +33 -0
  212. package/src/components/form/types/fields/CheckboxGroupField.d.ts +49 -0
  213. package/src/components/form/types/fields/ColorField.d.ts +37 -0
  214. package/src/components/form/types/fields/DateField.d.ts +70 -0
  215. package/src/components/form/types/fields/EmailField.d.ts +35 -0
  216. package/src/components/form/types/fields/FileAvatarMode.d.ts +46 -0
  217. package/src/components/form/types/fields/FileDropzoneMode.d.ts +28 -0
  218. package/src/components/form/types/fields/FileField.d.ts +56 -0
  219. package/src/components/form/types/fields/FileItemPreview.d.ts +35 -0
  220. package/src/components/form/types/fields/FileNativeMode.d.ts +21 -0
  221. package/src/components/form/types/fields/FileUploadButtonMode.d.ts +34 -0
  222. package/src/components/form/types/fields/FileWallMode.d.ts +32 -0
  223. package/src/components/form/types/fields/HiddenField.d.ts +26 -0
  224. package/src/components/form/types/fields/ImageField.d.ts +45 -0
  225. package/src/components/form/types/fields/NumberField.d.ts +48 -0
  226. package/src/components/form/types/fields/PasswordField.d.ts +46 -0
  227. package/src/components/form/types/fields/RadioField.d.ts +48 -0
  228. package/src/components/form/types/fields/RangeField.d.ts +44 -0
  229. package/src/components/form/types/fields/SearchField.d.ts +34 -0
  230. package/src/components/form/types/fields/SelectField.d.ts +71 -0
  231. package/src/components/form/types/fields/StringField.d.ts +48 -0
  232. package/src/components/form/types/fields/TelField.d.ts +37 -0
  233. package/src/components/form/types/fields/TextAreaField.d.ts +44 -0
  234. package/src/components/form/types/fields/TimeField.d.ts +51 -0
  235. package/src/components/form/types/fields/UrlField.d.ts +35 -0
  236. package/src/components/form/utils.js +17 -0
  237. package/src/components/form/validation/Validation.js +565 -0
  238. package/src/components/index.d.ts +160 -0
  239. package/src/components/list/HasListItem.js +171 -0
  240. package/src/components/list/List.js +125 -0
  241. package/src/components/list/ListDivider.js +39 -0
  242. package/src/components/list/ListGroup.js +135 -0
  243. package/src/components/list/ListItem.js +212 -0
  244. package/src/components/list/index.js +12 -0
  245. package/src/components/list/types/List.d.ts +43 -0
  246. package/src/components/list/types/ListGroup.d.ts +37 -0
  247. package/src/components/list/types/ListItem.d.ts +53 -0
  248. package/src/components/menu/HasMenuItem.js +182 -0
  249. package/src/components/menu/Menu.js +227 -0
  250. package/src/components/menu/MenuDivider.js +37 -0
  251. package/src/components/menu/MenuGroup.js +126 -0
  252. package/src/components/menu/MenuItem.js +190 -0
  253. package/src/components/menu/MenuLink.js +51 -0
  254. package/src/components/menu/index.js +14 -0
  255. package/src/components/menu/types/Menu.d.ts +60 -0
  256. package/src/components/menu/types/MenuDivider.d.ts +19 -0
  257. package/src/components/menu/types/MenuGroup.d.ts +44 -0
  258. package/src/components/menu/types/MenuItem.d.ts +46 -0
  259. package/src/components/menu/types/MenuLink.d.ts +16 -0
  260. package/src/components/modal/Modal.js +524 -0
  261. package/src/components/modal/index.js +5 -0
  262. package/src/components/modal/types/Modal.d.ts +94 -0
  263. package/src/components/pagination/Pagination.js +411 -0
  264. package/src/components/pagination/index.js +5 -0
  265. package/src/components/pagination/types/Pagination.d.ts +68 -0
  266. package/src/components/popover/Popover.js +459 -0
  267. package/src/components/popover/PopoverFooter.js +61 -0
  268. package/src/components/popover/PopoverHeader.js +68 -0
  269. package/src/components/popover/index.js +10 -0
  270. package/src/components/popover/types/Popover.d.ts +83 -0
  271. package/src/components/popover/types/PopoverFooter.d.ts +24 -0
  272. package/src/components/popover/types/PopoverHeader.d.ts +26 -0
  273. package/src/components/progress/Progress.js +401 -0
  274. package/src/components/progress/index.js +6 -0
  275. package/src/components/progress/types/Progress.d.ts +77 -0
  276. package/src/components/skeleton/Skeleton.js +228 -0
  277. package/src/components/skeleton/index.js +6 -0
  278. package/src/components/skeleton/types/Skeleton.d.ts +55 -0
  279. package/src/components/slider/Slider.js +406 -0
  280. package/src/components/slider/index.js +5 -0
  281. package/src/components/slider/types/Slider.d.ts +82 -0
  282. package/src/components/spacer/Spacer.js +27 -0
  283. package/src/components/spacer/index.js +5 -0
  284. package/src/components/spacer/types/Spacer.d.ts +19 -0
  285. package/src/components/spinner/Spinner.js +350 -0
  286. package/src/components/spinner/index.js +5 -0
  287. package/src/components/spinner/types/Spinner.d.ts +71 -0
  288. package/src/components/splitter/Splitter.js +164 -0
  289. package/src/components/splitter/SplitterGutter.js +140 -0
  290. package/src/components/splitter/SplitterPanel.js +143 -0
  291. package/src/components/splitter/index.js +10 -0
  292. package/src/components/splitter/types/Splitter.d.ts +38 -0
  293. package/src/components/splitter/types/SplitterGutter.d.ts +38 -0
  294. package/src/components/splitter/types/SplitterPanel.d.ts +41 -0
  295. package/src/components/stacks/AbsoluteStack.js +53 -0
  296. package/src/components/stacks/FixedStack.js +53 -0
  297. package/src/components/stacks/HStack.js +54 -0
  298. package/src/components/stacks/PositionStack.js +254 -0
  299. package/src/components/stacks/RelativeStack.js +53 -0
  300. package/src/components/stacks/Stack.js +166 -0
  301. package/src/components/stacks/VStack.js +55 -0
  302. package/src/components/stacks/index.js +21 -0
  303. package/src/components/stacks/types/AbsoluteStack.d.ts +16 -0
  304. package/src/components/stacks/types/FixedStack.d.ts +16 -0
  305. package/src/components/stacks/types/HStack.d.ts +16 -0
  306. package/src/components/stacks/types/PositionStack.d.ts +54 -0
  307. package/src/components/stacks/types/RelativeStack.d.ts +17 -0
  308. package/src/components/stacks/types/Stack.d.ts +39 -0
  309. package/src/components/stacks/types/VStack.d.ts +16 -0
  310. package/src/components/stepper/Stepper.js +461 -0
  311. package/src/components/stepper/StepperStep.js +241 -0
  312. package/src/components/stepper/index.js +8 -0
  313. package/src/components/stepper/types/Stepper.d.ts +68 -0
  314. package/src/components/stepper/types/StepperStep.d.ts +54 -0
  315. package/src/components/switch/Switch.js +266 -0
  316. package/src/components/switch/index.js +6 -0
  317. package/src/components/switch/types/Switch.d.ts +55 -0
  318. package/src/components/table/Column.js +212 -0
  319. package/src/components/table/ColumnGroup.js +90 -0
  320. package/src/components/table/DataTable.js +720 -0
  321. package/src/components/table/SimpleTable.js +139 -0
  322. package/src/components/table/index.js +7 -0
  323. package/src/components/table/types/Column.d.ts +49 -0
  324. package/src/components/table/types/ColumnGroup.d.ts +28 -0
  325. package/src/components/table/types/DataTable.d.ts +97 -0
  326. package/src/components/table/types/SimpleTable.d.ts +40 -0
  327. package/src/components/tabs/Tabs.js +395 -0
  328. package/src/components/tabs/index.js +6 -0
  329. package/src/components/tabs/types/Tabs.d.ts +78 -0
  330. package/src/components/toast/Toast.js +262 -0
  331. package/src/components/toast/ToastError.js +0 -0
  332. package/src/components/toast/ToastInfo.js +0 -0
  333. package/src/components/toast/ToastSuccess.js +0 -0
  334. package/src/components/toast/ToastWarning.js +0 -0
  335. package/src/components/toast/index.js +5 -0
  336. package/src/components/toast/types/Toast.d.ts +57 -0
  337. package/src/components/toast/types/ToastError.d.ts +7 -0
  338. package/src/components/toast/types/ToastInfo.d.ts +7 -0
  339. package/src/components/toast/types/ToastSuccess.d.ts +7 -0
  340. package/src/components/toast/types/ToastWarning.d.ts +7 -0
  341. package/src/components/tooltip/Tooltip.js +359 -0
  342. package/src/components/tooltip/index.js +5 -0
  343. package/src/components/tooltip/prototypes.js +6 -0
  344. package/src/components/tooltip/types/Tooltip.d.ts +65 -0
  345. package/src/{data → core/data}/MemoryManager.js +2 -3
  346. package/src/core/data/Observable.js +227 -0
  347. package/src/core/data/ObservableArray.js +522 -0
  348. package/src/core/data/ObservableChecker.js +39 -0
  349. package/src/core/data/ObservableItem.js +611 -0
  350. package/src/core/data/ObservableObject.js +274 -0
  351. package/src/core/data/ObservableResource.js +315 -0
  352. package/src/core/data/ObservableWhen.js +54 -0
  353. package/src/core/data/Store.js +520 -0
  354. package/src/core/data/observable-helpers/observable.is-to.js +390 -0
  355. package/src/core/data/observable-helpers/observable.prototypes.js +145 -0
  356. package/src/core/elements/anchor/anchor-with-sentinel.js +66 -0
  357. package/src/core/elements/anchor/anchor.js +210 -0
  358. package/src/core/elements/anchor/one-child-anchor-overwriting.js +66 -0
  359. package/src/core/elements/content-formatter.js +169 -0
  360. package/src/core/elements/control/for-each-array.js +292 -0
  361. package/src/{elements → core/elements}/control/for-each.js +42 -23
  362. package/src/core/elements/control/show-if.js +94 -0
  363. package/src/core/elements/control/show-when.js +54 -0
  364. package/src/core/elements/control/switch.js +141 -0
  365. package/src/core/elements/description-list.js +19 -0
  366. package/src/core/elements/form.js +255 -0
  367. package/src/core/elements/fragment.js +8 -0
  368. package/src/core/elements/html5-semantics.js +55 -0
  369. package/src/core/elements/img.js +59 -0
  370. package/src/{elements → core/elements}/index.js +4 -4
  371. package/src/core/elements/interactive.js +25 -0
  372. package/src/core/elements/list.js +37 -0
  373. package/src/core/elements/medias.js +37 -0
  374. package/src/core/elements/meta-data.js +43 -0
  375. package/src/core/elements/svg.js +61 -0
  376. package/src/core/elements/table.js +73 -0
  377. package/src/{errors → core/errors}/ArgTypesError.js +1 -1
  378. package/src/{errors → core/errors}/NativeDocumentError.js +0 -0
  379. package/src/core/utils/HasEventEmitter.js +85 -0
  380. package/src/core/utils/args-types.js +140 -0
  381. package/src/core/utils/cache.js +5 -0
  382. package/src/core/utils/callback-handler.js +50 -0
  383. package/src/core/utils/debug-manager.js +40 -0
  384. package/src/core/utils/events.js +148 -0
  385. package/src/core/utils/filters/date.js +178 -0
  386. package/src/core/utils/filters/index.js +4 -0
  387. package/src/core/utils/filters/standard.js +263 -0
  388. package/src/core/utils/filters/strings.js +67 -0
  389. package/src/core/utils/filters/utils.js +77 -0
  390. package/src/core/utils/formatters.js +90 -0
  391. package/src/core/utils/helpers.js +144 -0
  392. package/src/core/utils/localstorage.js +57 -0
  393. package/src/core/utils/memoize.js +115 -0
  394. package/src/core/utils/plugins-manager.js +81 -0
  395. package/src/core/utils/property-accumulator.js +72 -0
  396. package/src/core/utils/prototypes.js +44 -0
  397. package/src/core/utils/shortcut-manager.js +242 -0
  398. package/src/{utils → core/utils}/validator.js +58 -22
  399. package/src/core/wrappers/AttributesWrapper.js +98 -0
  400. package/src/core/wrappers/DocumentObserver.js +182 -0
  401. package/src/core/wrappers/ElementCreator.js +120 -0
  402. package/src/core/wrappers/HtmlElementWrapper.js +98 -0
  403. package/src/core/wrappers/NDElement.js +613 -0
  404. package/src/core/wrappers/NdPrototype.js +233 -0
  405. package/src/core/wrappers/SingletonView.js +99 -0
  406. package/src/core/wrappers/SvgElementWrapper.js +15 -0
  407. package/src/core/wrappers/TemplateBinding.js +7 -0
  408. package/src/core/wrappers/constants.js +66 -0
  409. package/src/core/wrappers/prototypes/attributes-extensions.js +179 -0
  410. package/src/core/wrappers/prototypes/bind-class-extensions.js +0 -0
  411. package/src/core/wrappers/prototypes/nd-element-extensions.js +157 -0
  412. package/src/core/wrappers/prototypes/nd-element.transition.extensions.js +127 -0
  413. package/src/core/wrappers/template-cloner/NodeCloner.js +209 -0
  414. package/src/core/wrappers/template-cloner/TemplateCloner.js +192 -0
  415. package/src/core/wrappers/template-cloner/attributes-hydrator.js +142 -0
  416. package/src/core/wrappers/template-cloner/utils.js +173 -0
  417. package/src/fetch/NativeFetch.js +89 -0
  418. package/src/i18n/bin/scan.js +132 -0
  419. package/src/i18n/index.d.ts +2 -0
  420. package/src/i18n/service/I18nService.d.ts +27 -0
  421. package/src/i18n/service/I18nService.js +46 -0
  422. package/src/i18n/service/functions.d.ts +22 -0
  423. package/src/i18n/service/functions.js +29 -0
  424. package/src/router/Route.js +33 -8
  425. package/src/router/RouteGroupHelper.js +10 -2
  426. package/src/router/Router.js +63 -22
  427. package/src/router/RouterComponent.js +114 -6
  428. package/src/{errors → router/errors}/RouterError.js +0 -1
  429. package/src/router/link.js +9 -10
  430. package/src/router/modes/HashRouter.js +2 -2
  431. package/src/router/modes/HistoryRouter.js +2 -3
  432. package/src/router/modes/MemoryRouter.js +1 -1
  433. package/src/ui/components/accordion/AccordionItemRender.js +63 -0
  434. package/src/ui/components/accordion/AccordionRender.js +35 -0
  435. package/src/ui/components/accordion/accordion.css +121 -0
  436. package/src/ui/components/alert/AlertRender.js +81 -0
  437. package/src/ui/components/alert/alert.css +163 -0
  438. package/src/ui/components/avatar/avata-group/AvatarGroupRender.js +50 -0
  439. package/src/ui/components/avatar/avata-group/avatar-group.css +38 -0
  440. package/src/ui/components/avatar/avatar/AvatarRender.js +87 -0
  441. package/src/ui/components/avatar/avatar/avatar.css +189 -0
  442. package/src/ui/components/badge/BadgeRender.js +25 -0
  443. package/src/ui/components/badge/badge.css +168 -0
  444. package/src/ui/components/breadcrumb/BreadcrumbRender.js +44 -0
  445. package/src/ui/components/breadcrumb/breadcrumb.css +55 -0
  446. package/src/ui/components/button/ButtonRender.js +65 -0
  447. package/src/ui/components/button/button.css +296 -0
  448. package/src/ui/components/card/CardRender.js +133 -0
  449. package/src/ui/components/card/card.css +169 -0
  450. package/src/ui/components/contextmenu/ContextmenuRender.js +68 -0
  451. package/src/ui/components/contextmenu/contextmenu.css +36 -0
  452. package/src/ui/components/divider/DividerRender.js +70 -0
  453. package/src/ui/components/divider/divider.css +70 -0
  454. package/src/ui/components/dropdown/DropdownRender.js +92 -0
  455. package/src/ui/components/dropdown/divider/DropdownDividerRender.js +9 -0
  456. package/src/ui/components/dropdown/divider/dropdown-divider.css +0 -0
  457. package/src/ui/components/dropdown/dropdown.css +179 -0
  458. package/src/ui/components/dropdown/group/DropdownGroupRender.js +23 -0
  459. package/src/ui/components/dropdown/group/dropdown-group.css +0 -0
  460. package/src/ui/components/dropdown/item/DropdownItemRender.js +29 -0
  461. package/src/ui/components/dropdown/item/dropdown-item.css +0 -0
  462. package/src/ui/components/form/FieldCollectionRender.js +110 -0
  463. package/src/ui/components/form/FormControlRender.js +85 -0
  464. package/src/ui/components/form/field-collection.css +55 -0
  465. package/src/ui/components/form/fields/AutocompleteFieldRender.js +143 -0
  466. package/src/ui/components/form/fields/CheckboxFieldRender.js +59 -0
  467. package/src/ui/components/form/fields/CheckboxGroupFieldRender.js +92 -0
  468. package/src/ui/components/form/fields/ColorFieldRender.js +30 -0
  469. package/src/ui/components/form/fields/DateFieldRender.js +155 -0
  470. package/src/ui/components/form/fields/EmailFieldRender.js +5 -0
  471. package/src/ui/components/form/fields/FieldRender.js +118 -0
  472. package/src/ui/components/form/fields/FileFieldRender.js +41 -0
  473. package/src/ui/components/form/fields/HiddenFieldRender.js +13 -0
  474. package/src/ui/components/form/fields/ImageFieldRender.js +0 -0
  475. package/src/ui/components/form/fields/NumberFieldRender.js +52 -0
  476. package/src/ui/components/form/fields/PasswordFieldRender.js +65 -0
  477. package/src/ui/components/form/fields/RadioFieldRender.js +77 -0
  478. package/src/ui/components/form/fields/RangeFieldRender.js +122 -0
  479. package/src/ui/components/form/fields/SelectFieldRender.js +248 -0
  480. package/src/ui/components/form/fields/SliderFieldRender.js +359 -0
  481. package/src/ui/components/form/fields/StringFieldRender.js +6 -0
  482. package/src/ui/components/form/fields/TelFieldRender.js +6 -0
  483. package/src/ui/components/form/fields/TextAreaFieldRender.js +96 -0
  484. package/src/ui/components/form/fields/TimeFieldRender.js +142 -0
  485. package/src/ui/components/form/fields/UrlFieldRender.js +6 -0
  486. package/src/ui/components/form/fields/date-field.css +32 -0
  487. package/src/ui/components/form/fields/field.css +402 -0
  488. package/src/ui/components/form/fields/file-field.css +79 -0
  489. package/src/ui/components/form/fields/password-field.css +50 -0
  490. package/src/ui/components/form/fields/range-field.css +120 -0
  491. package/src/ui/components/form/fields/slider.css +195 -0
  492. package/src/ui/components/form/file-upload-mode/FileAvatarModeRender.js +143 -0
  493. package/src/ui/components/form/file-upload-mode/FileDropzoneModeRender.js +108 -0
  494. package/src/ui/components/form/file-upload-mode/FileNativeModeRender.js +22 -0
  495. package/src/ui/components/form/file-upload-mode/FileUploadButtonModeRender.js +89 -0
  496. package/src/ui/components/form/file-upload-mode/FileWallModeRender.js +90 -0
  497. package/src/ui/components/form/file-upload-mode/file-avatar-mode.css +139 -0
  498. package/src/ui/components/form/file-upload-mode/file-dropzone-mode.css +88 -0
  499. package/src/ui/components/form/file-upload-mode/file-upload-button-mode.css +44 -0
  500. package/src/ui/components/form/file-upload-mode/file-wall-mode.css +88 -0
  501. package/src/ui/components/form/form-control.css +40 -0
  502. package/src/ui/components/form/helpers.js +111 -0
  503. package/src/ui/components/form/index.js +27 -0
  504. package/src/ui/components/list/ListRender.js +18 -0
  505. package/src/ui/components/list/divider/ListDividerRender.js +10 -0
  506. package/src/ui/components/list/divider/list-divider.css +12 -0
  507. package/src/ui/components/list/group/ListGroupRender.js +61 -0
  508. package/src/ui/components/list/group/list-group.css +62 -0
  509. package/src/ui/components/list/item/ListItemRender.js +238 -0
  510. package/src/ui/components/list/item/list-item.css +191 -0
  511. package/src/ui/components/list/list.css +24 -0
  512. package/src/ui/components/menu/MenuDividerRender.js +12 -0
  513. package/src/ui/components/menu/MenuGroupRender.js +59 -0
  514. package/src/ui/components/menu/MenuItemRender.js +57 -0
  515. package/src/ui/components/menu/MenuLinkRender.js +55 -0
  516. package/src/ui/components/menu/MenuRender.js +22 -0
  517. package/src/ui/components/menu/helpers.js +121 -0
  518. package/src/ui/components/menu/menu.css +308 -0
  519. package/src/ui/components/modal/ModalRender.js +118 -0
  520. package/src/ui/components/modal/modal.css +156 -0
  521. package/src/ui/components/pagination/PaginationRender.js +112 -0
  522. package/src/ui/components/pagination/pagination.css +63 -0
  523. package/src/ui/components/popover/PopoverRender.js +233 -0
  524. package/src/ui/components/popover/popover.css +139 -0
  525. package/src/ui/components/progress/ProgressRender.js +168 -0
  526. package/src/ui/components/progress/progress.css +197 -0
  527. package/src/ui/components/skeleton/SkeletonRender.js +136 -0
  528. package/src/ui/components/skeleton/skeleton.css +154 -0
  529. package/src/ui/components/spacer/SpacerRender.js +10 -0
  530. package/src/ui/components/spinner/SpinnerRender.js +47 -0
  531. package/src/ui/components/spinner/spinner.css +152 -0
  532. package/src/ui/components/splitter/SplitterGutterRender.js +94 -0
  533. package/src/ui/components/splitter/SplitterPanelRender.js +38 -0
  534. package/src/ui/components/splitter/SplitterRender.js +75 -0
  535. package/src/ui/components/splitter/splitter.css +128 -0
  536. package/src/ui/components/stacks/PositionStackRender.js +39 -0
  537. package/src/ui/components/stacks/StackRender.js +41 -0
  538. package/src/ui/components/stacks/absolute-stack/AbsoluteStackRender.js +5 -0
  539. package/src/ui/components/stacks/fixed-stack/FixedStackRender.js +5 -0
  540. package/src/ui/components/stacks/h-stack/HStackRender.js +7 -0
  541. package/src/ui/components/stacks/h-stack/h-stack.css +4 -0
  542. package/src/ui/components/stacks/index.js +5 -0
  543. package/src/ui/components/stacks/position-stack.css +62 -0
  544. package/src/ui/components/stacks/relative-stack/RelativeStackRender.js +7 -0
  545. package/src/ui/components/stacks/relative-stack/relative-stack.css +3 -0
  546. package/src/ui/components/stacks/stack.css +78 -0
  547. package/src/ui/components/stacks/v-stack/VStackRender.js +6 -0
  548. package/src/ui/components/stacks/v-stack/v-stack.css +4 -0
  549. package/src/ui/components/stepper/StepperRender.js +71 -0
  550. package/src/ui/components/stepper/StepperStepRender.js +67 -0
  551. package/src/ui/components/stepper/stepper.css +359 -0
  552. package/src/ui/components/switch/SwitchRender.js +83 -0
  553. package/src/ui/components/switch/switch.css +143 -0
  554. package/src/ui/components/table/data-table/DataTableRender.js +50 -0
  555. package/src/ui/components/table/data-table/bulk-actions.js +34 -0
  556. package/src/ui/components/table/data-table/data-table.css +246 -0
  557. package/src/ui/components/table/data-table/pagination.js +56 -0
  558. package/src/ui/components/table/data-table/tables.js +368 -0
  559. package/src/ui/components/table/data-table/toolbar.js +67 -0
  560. package/src/ui/components/table/simple-table/SimpleTableRender.js +203 -0
  561. package/src/ui/components/table/simple-table/simple-table.css +50 -0
  562. package/src/ui/components/tabs/TabsRender.js +226 -0
  563. package/src/ui/components/tabs/tabs.css +253 -0
  564. package/src/ui/components/toast/ToastRender.js +99 -0
  565. package/src/ui/components/toast/toast.css +201 -0
  566. package/src/ui/components/tooltip/TooltipRender.js +8 -0
  567. package/src/ui/components/tooltip/tooltip.css +113 -0
  568. package/src/ui/index.js +47 -0
  569. package/src/ui/theme.js +0 -0
  570. package/src/ui/theme.scss +1 -0
  571. package/src/ui/tokens/animation.scss +36 -0
  572. package/src/ui/tokens/colors-dark.scss +58 -0
  573. package/src/ui/tokens/colors.scss +54 -0
  574. package/src/ui/tokens/components.scss +32 -0
  575. package/src/ui/tokens/fonts.scss +57 -0
  576. package/src/ui/tokens/glass.scss +10 -0
  577. package/src/ui/tokens/index.scss +38 -0
  578. package/src/ui/tokens/layouts.scss +228 -0
  579. package/src/ui/tokens/opacity.scss +21 -0
  580. package/src/ui/tokens/others.scss +11 -0
  581. package/src/ui/tokens/radius.scss +6 -0
  582. package/src/ui/tokens/reset.scss +51 -0
  583. package/src/ui/tokens/shadows.scss +29 -0
  584. package/src/ui/tokens/spacings.scss +13 -0
  585. package/src/ui/tokens/vars.scss +35 -0
  586. package/src/ui/tokens/viewports.scss +30 -0
  587. package/types/args-types.d.ts +58 -0
  588. package/types/control-flow.d.ts +62 -0
  589. package/types/elements.d.ts +231 -0
  590. package/types/filters/dates.d.ts +43 -0
  591. package/types/filters/index.d.ts +4 -0
  592. package/types/filters/standard.d.ts +70 -0
  593. package/types/filters/strings.d.ts +21 -0
  594. package/types/filters/types.d.ts +20 -0
  595. package/types/forms.d.ts +84 -0
  596. package/types/globals.d.ts +543 -0
  597. package/types/images.d.ts +23 -0
  598. package/types/localStorage.ts +102 -0
  599. package/types/memoize.d.ts +26 -0
  600. package/types/native-fetch.d.ts +72 -0
  601. package/types/nd-element.d.ts +407 -0
  602. package/types/observable-resource.d.ts +3 -0
  603. package/types/observable.d.ts +227 -0
  604. package/types/plugins-manager.d.ts +65 -0
  605. package/types/polyfill.d.ts +18 -0
  606. package/types/property-accumulator.d.ts +33 -0
  607. package/types/router.d.ts +85 -0
  608. package/types/service.d.ts +23 -0
  609. package/types/singleton.d.ts +19 -0
  610. package/types/store.d.ts +63 -0
  611. package/types/template-cloner.ts +43 -0
  612. package/types/validator.ts +66 -0
  613. package/ui.js +1 -0
  614. package/utils.d.ts +4 -0
  615. package/utils.js +12 -0
  616. package/src/data/Observable.js +0 -55
  617. package/src/data/ObservableChecker.js +0 -39
  618. package/src/data/ObservableItem.js +0 -195
  619. package/src/data/Store.js +0 -74
  620. package/src/data/observable-helpers/array.js +0 -74
  621. package/src/data/observable-helpers/batch.js +0 -22
  622. package/src/data/observable-helpers/computed.js +0 -28
  623. package/src/data/observable-helpers/object.js +0 -111
  624. package/src/elements/anchor.js +0 -129
  625. package/src/elements/content-formatter.js +0 -32
  626. package/src/elements/control/for-each-array.js +0 -280
  627. package/src/elements/control/show-if.js +0 -79
  628. package/src/elements/control/switch.js +0 -98
  629. package/src/elements/description-list.js +0 -5
  630. package/src/elements/form.js +0 -71
  631. package/src/elements/html5-semantics.js +0 -12
  632. package/src/elements/img.js +0 -45
  633. package/src/elements/interactive.js +0 -7
  634. package/src/elements/list.js +0 -10
  635. package/src/elements/medias.js +0 -8
  636. package/src/elements/meta-data.js +0 -9
  637. package/src/elements/table.js +0 -14
  638. package/src/utils/args-types.js +0 -100
  639. package/src/utils/debug-manager.js +0 -31
  640. package/src/utils/helpers.js +0 -60
  641. package/src/utils/plugins-manager.js +0 -12
  642. package/src/utils/prototypes.js +0 -45
  643. package/src/wrappers/AttributesWrapper.js +0 -144
  644. package/src/wrappers/DocumentObserver.js +0 -80
  645. package/src/wrappers/ElementCreator.js +0 -114
  646. package/src/wrappers/HtmlElementEventsWrapper.js +0 -64
  647. package/src/wrappers/HtmlElementWrapper.js +0 -50
  648. package/src/wrappers/NdPrototype.js +0 -109
  649. package/src/wrappers/constants.js +0 -2
@@ -0,0 +1,62 @@
1
+ import type { ValidChild } from '../../../../types/elements';
2
+ import type { ObservableItem } from '../../../../types/observable';
3
+ import type { BaseComponent } from '../../BaseComponent';
4
+ import type { GlobalAttributes } from '../../../../types/globals';
5
+
6
+ export type AlertDescription = {
7
+ title: ValidChild | null;
8
+ content: ValidChild;
9
+ outline: boolean | null;
10
+ appearance: 'filled' | 'bordered' | null;
11
+ variant: 'info' | 'success' | 'warning' | 'error' | 'danger' | string;
12
+ closable: boolean;
13
+ autoDismiss: number | null;
14
+ icon: ValidChild | null;
15
+ showIcon: boolean;
16
+ actions: Array<{ label: ValidChild; handler: (() => void) | null; variant: string | null }>;
17
+ props: GlobalAttributes;
18
+ };
19
+
20
+ export interface AlertInterface extends BaseComponent {
21
+ variant(variant: 'info' | 'success' | 'warning' | 'error' | 'danger' | string): this;
22
+ info(): this;
23
+ success(): this;
24
+ warning(): this;
25
+ error(): this;
26
+ danger(): this;
27
+ appearance(appearance: 'filled' | 'bordered'): this;
28
+ filled(): this;
29
+ bordered(): this;
30
+ outline(outline?: boolean): this;
31
+ title(title: ValidChild): this;
32
+ content(content: ValidChild): this;
33
+ renderTitle(callback: (desc: AlertDescription, instance: AlertInterface) => ValidChild): this;
34
+ renderContent(callback: (desc: AlertDescription, instance: AlertInterface) => ValidChild): this;
35
+ renderFooter(callback: (desc: AlertDescription, instance: AlertInterface) => ValidChild): this;
36
+ clearActions(): this;
37
+ action(label: ValidChild, handler?: () => void, variant?: string | null): this;
38
+ layout(layoutFn: (desc: AlertDescription, instance: AlertInterface) => ValidChild): this;
39
+ icon(icon: ValidChild): this;
40
+ showIcon(show?: boolean): this;
41
+ closable(closable?: boolean): this;
42
+ dismissible(dismissible?: boolean): this;
43
+ autoDismiss(delay: number): this;
44
+ close(): this;
45
+ show(): this;
46
+ hide(): this;
47
+ onClose(handler: () => void): this;
48
+ onShow(handler: () => void): this;
49
+ render(template: (description: AlertDescription, instance: AlertInterface) => ValidChild): this;
50
+ }
51
+
52
+
53
+ export declare function Alert(content: ValidChild, props?: Record<string, unknown>): AlertInterface;
54
+ export declare namespace Alert {
55
+
56
+
57
+ function use(template: (description: AlertDescription, instance: AlertInterface) => ValidChild): void;
58
+ function preset(name: string, callback: (instance: AlertInterface) => AlertInterface): void;
59
+ function presets(presets: Record<string, (instance: AlertInterface) => AlertInterface>): void;
60
+
61
+
62
+ }
@@ -0,0 +1,430 @@
1
+ import BaseComponent from '../BaseComponent';
2
+ import DebugManager from '../../core/utils/debug-manager';
3
+
4
+ /**
5
+ * Displays a user avatar with image, initials, or icon fallback. Supports status indicators, badges, shape, and size variants.
6
+ *
7
+ *
8
+ * @example
9
+ * const avatar = new Avatar('https://example.com/photo.jpg')
10
+ * .alt('Jane Doe')
11
+ * .name('Jane Doe')
12
+ * .size('large')
13
+ * .shape('circle')
14
+ * .status('online')
15
+ * .statusAtTopTrailing();
16
+ *
17
+ * Avatar.use((description, instance) => {
18
+ * return Img({ src: description.src, alt: description.alt });
19
+ * });
20
+ *
21
+ * @constructor
22
+ * @param {string|Observable<string>} [source]
23
+ * @param {GlobalAttributes} [props={}]
24
+ */
25
+ export default function Avatar(source, props = {}) {
26
+ if (!(this instanceof Avatar)) {
27
+ return new Avatar(source, props);
28
+ }
29
+
30
+ this.$description = {
31
+ src: source ? BaseComponent.obs(source) : null,
32
+ alt: null,
33
+ name: null,
34
+ initials: null,
35
+ icon: null,
36
+ size: 'medium',
37
+ shape: 'circle',
38
+ variant: null,
39
+ color: null,
40
+ textColor: null,
41
+ status: null,
42
+ render: null,
43
+ props,
44
+ };
45
+ }
46
+
47
+ BaseComponent.extends(Avatar);
48
+
49
+ Avatar.defaultTemplate = null;
50
+
51
+
52
+ /**
53
+ * Registers the render template for Avatar.
54
+ * @param {(description: {
55
+ * src: Observable<string>|null,
56
+ * alt: string|null,
57
+ * name: string|null,
58
+ * initials: string|null,
59
+ * icon: NdChild|null,
60
+ * size: 'extra-small'|'small'|'medium'|'large'|'extra-large'|string|number,
61
+ * shape: 'circle'|'square'|'rounded',
62
+ * variant: string|null,
63
+ * color: string|null,
64
+ * textColor: string|null,
65
+ * status: Observable<string>|string|null,
66
+ * render: ((desc: *, instance: Avatar) => NdChild)|null,
67
+ * props: GlobalAttributes,
68
+ * }, instance: Avatar) => NdChild} template
69
+ */
70
+ Avatar.use = function(template) {
71
+ Avatar.defaultTemplate = template;
72
+ };
73
+
74
+ /**
75
+ * @param {string} name
76
+ * @param {(a: Avatar) => Avatar} callback
77
+ */
78
+ Avatar.preset = function(name, callback) {
79
+ if (Avatar.prototype[name] || Avatar[name]) {
80
+ DebugManager.warn(`Warning: the ${name} method already exists in Avatar.`);
81
+ return;
82
+ }
83
+ Avatar[name] = (label, props) => callback(new Avatar(label, props));
84
+ };
85
+
86
+ /**
87
+ * @param {Record<string, (a: Avatar) => Avatar>} presets
88
+ */
89
+ Avatar.presets = function(presets) {
90
+ for (const name in presets) {
91
+ Avatar.preset(name, presets[name]);
92
+ }
93
+ };
94
+
95
+
96
+ /**
97
+ * Registers a handler for the error event
98
+ * @param {(error: Error, avatar: Avatar) => void} handler - The event handler
99
+ * @returns {Avatar}
100
+ */
101
+ Avatar.prototype.onError = function(handler) {};
102
+
103
+ /**
104
+ * Sets the source URL for the avatar image
105
+ * @param {string} src - The image source URL
106
+ * @returns {Avatar}
107
+ */
108
+ Avatar.prototype.src = function(src) {
109
+ this.$description.src.set(src);
110
+ return this;
111
+ };
112
+
113
+ /**
114
+ * Sets the alt text for the avatar image
115
+ * @param {string} alt - The alt text
116
+ * @returns {Avatar}
117
+ */
118
+ Avatar.prototype.alt = function(alt) {
119
+ this.$description.alt = alt;
120
+ return this;
121
+ };
122
+
123
+ /**
124
+ * Sets the name associated with the avatar
125
+ * @param {string} name - The name
126
+ * @returns {Avatar}
127
+ */
128
+ Avatar.prototype.name = function(name) {
129
+ this.$description.name = name;
130
+ if(!this.$description.initials) {
131
+ this.$description.initials = name.split(' ').map(n => n[0]).join('');
132
+ }
133
+ return this;
134
+ };
135
+
136
+ /**
137
+ * Sets the initials to display
138
+ * @param {string} initials - The initials text
139
+ * @returns {Avatar}
140
+ */
141
+ Avatar.prototype.initials = function(initials) {
142
+ this.$description.initials = initials;
143
+ return this;
144
+ };
145
+
146
+ /**
147
+ * Sets the icon for the avatar
148
+ * @param {ValidChildren} icon - The icon to display
149
+ * @returns {Avatar}
150
+ */
151
+ Avatar.prototype.icon = function(icon) {
152
+ this.$description.icon = icon;
153
+ return this;
154
+ };
155
+
156
+ /**
157
+ * Sets the size of the avatar
158
+ * @param {string|number} size - The size value (preset name or custom value)
159
+ * @returns {Avatar}
160
+ */
161
+ Avatar.prototype.size = function(size) {
162
+ this.$description.size = size;
163
+ return this;
164
+ };
165
+
166
+ /**
167
+ * Sets the avatar size to 'extra-small'
168
+ * @returns {Avatar}
169
+ */
170
+ Avatar.prototype.extraSmall = function() {
171
+ return this.size('extra-small');
172
+ };
173
+
174
+ /**
175
+ * Sets the avatar size to 'small'
176
+ * @returns {Avatar}
177
+ */
178
+ Avatar.prototype.small = function() {
179
+ return this.size('small');
180
+ };
181
+
182
+ /**
183
+ * Sets the avatar size to 'medium'
184
+ * @returns {Avatar}
185
+ */
186
+ Avatar.prototype.medium = function() {
187
+ return this.size('medium');
188
+ };
189
+
190
+ /**
191
+ * Sets the avatar size to 'large'
192
+ * @returns {Avatar}
193
+ */
194
+ Avatar.prototype.large = function() {
195
+ return this.size('large');
196
+ };
197
+
198
+ /**
199
+ * Sets the avatar size to 'extra-large'
200
+ * @returns {Avatar}
201
+ */
202
+ Avatar.prototype.extraLarge = function() {
203
+ return this.size('extra-large');
204
+ };
205
+
206
+ /**
207
+ * Sets the shape of the avatar
208
+ * @param {string} shape - The shape name (circle, square, rounded)
209
+ * @returns {Avatar}
210
+ */
211
+ Avatar.prototype.shape = function(shape) {
212
+ this.$description.shape = shape;
213
+ return this;
214
+ };
215
+
216
+ /**
217
+ * Sets the avatar shape to 'circle'
218
+ * @returns {Avatar}
219
+ */
220
+ Avatar.prototype.circle = function() {
221
+ return this.shape('circle');
222
+ };
223
+
224
+ /**
225
+ * Sets the avatar shape to 'square'
226
+ * @returns {Avatar}
227
+ */
228
+ Avatar.prototype.square = function() {
229
+ return this.shape('square');
230
+ };
231
+
232
+ /**
233
+ * Sets the avatar shape to 'rounded'
234
+ * @returns {Avatar}
235
+ */
236
+ Avatar.prototype.rounded = function() {
237
+ return this.shape('rounded');
238
+ };
239
+
240
+ /**
241
+ * Sets the variant style for the avatar
242
+ * @param {string} variant - The variant name (primary, secondary, success, danger, warning, info)
243
+ * @returns {Avatar}
244
+ */
245
+ Avatar.prototype.variant = function(variant) {
246
+ this.$description.variant = variant;
247
+ return this;
248
+ }; // 'primary' | 'secondary' | 'success' | etc.
249
+
250
+ /**
251
+ * Sets the avatar variant to 'primary'
252
+ * @returns {Avatar}
253
+ */
254
+ Avatar.prototype.primary = function() {
255
+ return this.variant('primary');
256
+ };
257
+
258
+ /**
259
+ * Sets the avatar variant to 'secondary'
260
+ * @returns {Avatar}
261
+ */
262
+ Avatar.prototype.secondary = function() {
263
+ return this.variant('secondary');
264
+ };
265
+
266
+ /**
267
+ * Sets the avatar variant to 'success'
268
+ * @returns {Avatar}
269
+ */
270
+ Avatar.prototype.success = function() {
271
+ return this.variant('success');
272
+ };
273
+
274
+ /**
275
+ * Sets the avatar variant to 'danger'
276
+ * @returns {Avatar}
277
+ */
278
+ Avatar.prototype.danger = function() {
279
+ return this.variant('danger');
280
+ };
281
+
282
+ /**
283
+ * Sets the avatar variant to 'warning'
284
+ * @returns {Avatar}
285
+ */
286
+ Avatar.prototype.warning = function() {
287
+ return this.variant('warning');
288
+ };
289
+
290
+ /**
291
+ * Sets the avatar variant to 'info'
292
+ * @returns {Avatar}
293
+ */
294
+ Avatar.prototype.info = function() {
295
+ return this.variant('info');
296
+ };
297
+
298
+ /**
299
+ * Sets the background color of the avatar
300
+ * @param {string} color - The color value
301
+ * @returns {Avatar}
302
+ */
303
+ Avatar.prototype.color = function(color) {
304
+ this.$description.color = color;
305
+ return this;
306
+ };
307
+
308
+ /**
309
+ * Sets the text color of the avatar
310
+ * @param {string} color - The color value
311
+ * @returns {Avatar}
312
+ */
313
+ Avatar.prototype.textColor = function(color) {
314
+ this.$description.textColor = color;
315
+ return this;
316
+ };
317
+
318
+ /**
319
+ * Sets the status indicator for the avatar
320
+ * @param {string} status - The status value
321
+ * @returns {Avatar}
322
+ */
323
+ Avatar.prototype.status = function(status) {
324
+ this.$description.status = BaseComponent.obs(status);
325
+ return this;
326
+ };
327
+
328
+ /**
329
+ * Sets the position of the status indicator
330
+ * @param {string} position - The position (top-trailing, bottom-trailing, top-leading, bottom-leading)
331
+ * @returns {Avatar}
332
+ */
333
+ Avatar.prototype.statusPosition = function(position) {
334
+ this.$description.statusPosition = position;
335
+ }; // 'top-right' | 'bottom-right' | etc.
336
+
337
+ /**
338
+ * Positions the status indicator at top-leading
339
+ * @returns {Avatar}
340
+ */
341
+ Avatar.prototype.statusAtTopLeading = function() {
342
+ return this.statusPosition('top-leading');
343
+ };
344
+
345
+ /**
346
+ * Positions the status indicator at bottom-leading
347
+ * @returns {Avatar}
348
+ */
349
+ Avatar.prototype.statusAtBottomLeading = function() {
350
+ return this.statusPosition('bottom-leading');
351
+ };
352
+
353
+ /**
354
+ * Positions the status indicator at top-trailing
355
+ * @returns {Avatar}
356
+ */
357
+ Avatar.prototype.statusAtTopTrailing = function() {
358
+ return this.statusPosition('top-trailing');
359
+ };
360
+
361
+ /**
362
+ * Positions the status indicator at bottom-trailing
363
+ * @returns {Avatar}
364
+ */
365
+ Avatar.prototype.statusAtBottomTrailing = function() {
366
+ return this.statusPosition('bottom-trailing');
367
+ };
368
+
369
+ /**
370
+ * Shows or hides the status indicator
371
+ * @param {boolean} [show=true] - Whether to show the status
372
+ * @returns {Avatar}
373
+ */
374
+ Avatar.prototype.showStatus = function(show = true) {
375
+ this.$description.showStatus = show;
376
+ return this;
377
+ };
378
+
379
+ /**
380
+ * Sets the badge content for the avatar
381
+ * @param {ValidChildren} content - The badge content
382
+ * @returns {Avatar}
383
+ */
384
+ Avatar.prototype.badge = function(content) {
385
+ this.$description.badge = content;
386
+ return this;
387
+ };
388
+
389
+ /**
390
+ * Sets the position of the badge
391
+ * @param {string} position - The position (top-leading, bottom-leading, top-trailing, bottom-trailing)
392
+ * @returns {Avatar}
393
+ */
394
+ Avatar.prototype.badgePosition = function(position) {
395
+ this.$description.badgePosition = position;
396
+ return this;
397
+ };
398
+
399
+ /**
400
+ * Positions the badge at top-leading
401
+ * @returns {Avatar}
402
+ */
403
+ Avatar.prototype.badgeAtTopLeading = function() {
404
+ return this.badgePosition('top-leading');
405
+ };
406
+
407
+ /**
408
+ * Positions the badge at bottom-leading
409
+ * @returns {Avatar}
410
+ */
411
+ Avatar.prototype.badgeAtBottomLeading = function() {
412
+ return this.badgePosition('bottom-leading');
413
+ };
414
+
415
+ /**
416
+ * Positions the badge at top-trailing
417
+ * @returns {Avatar}
418
+ */
419
+ Avatar.prototype.badgeAtTopTrailing = function() {
420
+ return this.badgePosition('top-trailing');
421
+ };
422
+
423
+ /**
424
+ * Positions the badge at bottom-trailing
425
+ * @returns {Avatar}
426
+ */
427
+ Avatar.prototype.badgeAtBottomTrailing = function() {
428
+ return this.badgePosition('bottom-trailing');
429
+ };
430
+
@@ -0,0 +1,97 @@
1
+ import BaseComponent from '../BaseComponent';
2
+
3
+ /**
4
+ * Renders a group of overlapping Avatar components with a "+N" overflow indicator.
5
+ *
6
+ *
7
+ * @example
8
+ * const group = new AvatarGroup()
9
+ * .items([
10
+ * new Avatar('user1.jpg').name('Alice'),
11
+ * new Avatar('user2.jpg').name('Bob'),
12
+ * new Avatar('user3.jpg').name('Carol'),
13
+ * ])
14
+ * .max(3)
15
+ * .overlap(8)
16
+ * .onMoreClick((count) => console.log(\`\${count} more users\`));
17
+ *
18
+ * @constructor
19
+ * @param {GlobalAttributes} [props]
20
+ */
21
+ export default function AvatarGroup(props = {}) {
22
+ if(!(this instanceof AvatarGroup)) {
23
+ return new AvatarGroup(props);
24
+ }
25
+
26
+ this.$description = {
27
+ items: [],
28
+ overlap: 0,
29
+ max: 0,
30
+ onMoreClick: null,
31
+ props,
32
+ };
33
+
34
+ };
35
+
36
+ BaseComponent.extends(AvatarGroup);
37
+
38
+ AvatarGroup.defaultTemplate = null;
39
+
40
+ /**
41
+ * Registers the render template for AvatarGroup.
42
+ * @param {(description: {
43
+ * items: Avatar[],
44
+ * overlap: number,
45
+ * max: number,
46
+ * onMoreClick: ((count: number) => void)|null,
47
+ * props: GlobalAttributes,
48
+ * }, instance: AvatarGroup) => NdChild} template
49
+ */
50
+ AvatarGroup.use = function(template) {
51
+ AvatarGroup.defaultTemplate = template;
52
+ };
53
+
54
+ /**
55
+ * @param {Avatar[]} items
56
+ * @returns {this}
57
+ */
58
+ AvatarGroup.prototype.items = function(items) {
59
+ this.$description.items = items;
60
+ return this;
61
+ };
62
+
63
+ /**
64
+ * @param {Avatar} item
65
+ * @returns {this}
66
+ */
67
+ AvatarGroup.prototype.item = function(item) {
68
+ this.$description.items.push(item);
69
+ return this;
70
+ };
71
+
72
+ /**
73
+ * @param {number} value
74
+ * @returns {this}
75
+ */
76
+ AvatarGroup.prototype.overlap = function(value) {
77
+ this.$description.overlap = value;
78
+ return this;
79
+ };
80
+
81
+ /**
82
+ * @param {number} max
83
+ * @returns {this}
84
+ */
85
+ AvatarGroup.prototype.max = function(max) {
86
+ this.$description.max = max;
87
+ return this;
88
+ };
89
+
90
+ /**
91
+ * @param {(count: number) => void} handler
92
+ * @returns {this}
93
+ */
94
+ AvatarGroup.prototype.onMoreClick = function(handler) {
95
+ this.$description.onMoreClick = handler;
96
+ return this;
97
+ };
@@ -0,0 +1,7 @@
1
+ import Avatar from './Avatar';
2
+ import AvatarGroup from './AvatarGroup';
3
+
4
+ export {
5
+ Avatar,
6
+ AvatarGroup,
7
+ };
@@ -0,0 +1,74 @@
1
+ import type { ValidChild } from '../../../../types/elements';
2
+ import type { ObservableItem } from '../../../../types/observable';
3
+ import type { BaseComponent } from '../../BaseComponent';
4
+ import type { GlobalAttributes } from '../../../../types/globals';
5
+
6
+ export type AvatarDescription = {
7
+ src: ObservableItem<string> | null;
8
+ alt: string | null;
9
+ name: string | null;
10
+ initials: string | null;
11
+ icon: ValidChild | null;
12
+ size: 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large' | string | number;
13
+ shape: 'circle' | 'square' | 'rounded';
14
+ variant: string | null;
15
+ color: string | null;
16
+ textColor: string | null;
17
+ status: ObservableItem<string> | string | null;
18
+ render: ((desc: AvatarDescription, instance: AvatarInterface) => ValidChild) | null;
19
+ props: GlobalAttributes;
20
+ };
21
+
22
+ export interface AvatarInterface extends BaseComponent {
23
+ onError(handler: (error: Error, avatar: AvatarInterface) => void): this;
24
+ src(src: string | ObservableItem<string>): this;
25
+ alt(alt: string): this;
26
+ name(name: string): this;
27
+ initials(initials: string): this;
28
+ icon(icon: ValidChild): this;
29
+ size(size: 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large' | string | number): this;
30
+ extraSmall(): this;
31
+ small(): this;
32
+ medium(): this;
33
+ large(): this;
34
+ extraLarge(): this;
35
+ shape(shape: 'circle' | 'square' | 'rounded'): this;
36
+ circle(): this;
37
+ square(): this;
38
+ rounded(): this;
39
+ variant(variant: string): this;
40
+ primary(): this;
41
+ secondary(): this;
42
+ success(): this;
43
+ danger(): this;
44
+ warning(): this;
45
+ info(): this;
46
+ color(color: string): this;
47
+ textColor(color: string): this;
48
+ status(status: string | ObservableItem<string>): this;
49
+ statusPosition(position: 'top-leading' | 'top-trailing' | 'bottom-leading' | 'bottom-trailing'): this;
50
+ statusAtTopLeading(): this;
51
+ statusAtBottomLeading(): this;
52
+ statusAtTopTrailing(): this;
53
+ statusAtBottomTrailing(): this;
54
+ showStatus(show?: boolean): this;
55
+ badge(content: ValidChild): this;
56
+ badgePosition(position: 'top-leading' | 'top-trailing' | 'bottom-leading' | 'bottom-trailing'): this;
57
+ badgeAtTopLeading(): this;
58
+ badgeAtBottomLeading(): this;
59
+ badgeAtTopTrailing(): this;
60
+ badgeAtBottomTrailing(): this;
61
+ render(template: (description: AvatarDescription, instance: AvatarInterface) => ValidChild): this;
62
+ }
63
+
64
+
65
+ export declare function Avatar(source?: string | ObservableItem<string>, props?: Record<string, unknown>): AvatarInterface;
66
+ export declare namespace Avatar {
67
+
68
+
69
+ function use(template: (description: AvatarDescription, instance: AvatarInterface) => ValidChild): void;
70
+ function preset(name: string, callback: (instance: AvatarInterface) => AvatarInterface): void;
71
+ function presets(presets: Record<string, (instance: AvatarInterface) => AvatarInterface>): void;
72
+
73
+
74
+ }
@@ -0,0 +1,32 @@
1
+ import type { ValidChild } from '../../../../types/elements';
2
+ import type { ObservableItem } from '../../../../types/observable';
3
+ import type { BaseComponent } from '../../BaseComponent';
4
+ import type { AvatarInterface } from './Avatar';
5
+ import type { GlobalAttributes } from '../../../../types/globals';
6
+
7
+ export type AvatarGroupDescription = {
8
+ items: AvatarInterface[];
9
+ overlap: number;
10
+ max: number;
11
+ onMoreClick: ((count: number) => void) | null;
12
+ props: GlobalAttributes;
13
+ };
14
+
15
+ export interface AvatarGroupInterface extends BaseComponent {
16
+ items(items: AvatarInterface[]): this;
17
+ item(item: AvatarInterface): this;
18
+ overlap(value: number): this;
19
+ max(max: number): this;
20
+ onMoreClick(handler: (count: number) => void): this;
21
+ render(template: (description: AvatarGroupDescription, instance: AvatarGroupInterface) => ValidChild): this;
22
+ }
23
+
24
+
25
+ export declare function AvatarGroup(props?: Record<string, unknown>): AvatarGroupInterface;
26
+ export declare namespace AvatarGroup {
27
+
28
+
29
+ function use(template: (description: AvatarGroupDescription, instance: AvatarGroupInterface) => ValidChild): void;
30
+
31
+
32
+ }