@blueprint-ts/core 3.0.0 → 4.0.0-beta.1

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 (206) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +25 -1
  3. package/docs/.vitepress/config.ts +80 -23
  4. package/docs/index.md +6 -63
  5. package/docs/{services/laravel → laravel}/pagination.md +19 -6
  6. package/docs/{services/laravel → laravel}/requests.md +2 -2
  7. package/docs/services/pagination/index.md +46 -0
  8. package/docs/services/pagination/infinite-scroller.md +19 -0
  9. package/docs/services/pagination/page-aware.md +46 -0
  10. package/docs/services/pagination/state-pagination.md +77 -0
  11. package/docs/services/pagination/updating-rows.md +36 -0
  12. package/docs/services/persistence/index.md +46 -0
  13. package/docs/services/requests/abort-requests.md +25 -0
  14. package/docs/services/requests/bulk-requests.md +70 -0
  15. package/docs/services/requests/drivers.md +50 -0
  16. package/docs/services/requests/error-handling.md +137 -0
  17. package/docs/services/requests/events.md +31 -0
  18. package/docs/services/requests/getting-started.md +201 -0
  19. package/docs/services/requests/headers.md +40 -0
  20. package/docs/services/requests/loading.md +63 -0
  21. package/docs/services/requests/request-bodies.md +59 -0
  22. package/docs/services/requests/responses.md +34 -0
  23. package/docs/services/support/deferred-promise.md +63 -0
  24. package/docs/services/support/helpers.md +77 -0
  25. package/docs/services/support/index.md +6 -0
  26. package/docs/upgrading/v1-to-v2.md +64 -0
  27. package/docs/upgrading/v2-to-v3.md +52 -0
  28. package/docs/upgrading/v3-to-v4.md +171 -0
  29. package/docs/upgrading.md +0 -0
  30. package/docs/vue/composables/use-confirm-dialog.md +96 -0
  31. package/docs/vue/composables/use-global-checkbox.md +73 -0
  32. package/docs/vue/composables/use-is-empty.md +26 -0
  33. package/docs/vue/composables/use-is-open-from-var.md +32 -0
  34. package/docs/vue/composables/use-is-open.md +28 -0
  35. package/docs/vue/composables/use-model-wrapper.md +29 -0
  36. package/docs/vue/composables/use-on-open.md +26 -0
  37. package/docs/vue/forms/arrays.md +45 -0
  38. package/docs/vue/forms/errors.md +52 -0
  39. package/docs/vue/forms/index.md +99 -0
  40. package/docs/vue/forms/payloads.md +99 -0
  41. package/docs/vue/forms/persistence.md +19 -0
  42. package/docs/vue/forms/state-and-properties.md +26 -0
  43. package/docs/vue/forms/utilities.md +27 -0
  44. package/docs/vue/forms/validation.md +189 -0
  45. package/docs/vue/requests/loading.md +51 -0
  46. package/docs/vue/{requests → router}/route-resource-binding.md +33 -27
  47. package/docs/vue/state.md +27 -11
  48. package/package.json +9 -10
  49. package/release-tool.json +22 -3
  50. package/src/{service/bulkRequests → bulkRequests}/BulkRequestSender.ts +29 -17
  51. package/src/{service/bulkRequests → bulkRequests}/BulkRequestWrapper.ts +5 -5
  52. package/src/laravel/pagination/dataDrivers/RequestDriver.ts +30 -0
  53. package/src/laravel/pagination/index.ts +6 -0
  54. package/src/{service/pagination → pagination}/BasePaginator.ts +35 -0
  55. package/src/{service/pagination → pagination}/InfiniteScroller.ts +1 -0
  56. package/src/{service/pagination → pagination}/PageAwarePaginator.ts +19 -21
  57. package/src/{service/pagination → pagination}/StatePaginator.ts +2 -8
  58. package/src/{service/pagination → pagination}/index.ts +1 -1
  59. package/src/{service/requests → requests}/BaseRequest.ts +2 -2
  60. package/src/requests/ErrorHandler.ts +144 -0
  61. package/src/requests/RequestErrorRouter.ts +89 -0
  62. package/src/{service/requests → requests}/bodies/FormDataBody.ts +10 -6
  63. package/src/requests/exceptions/BadGatewayException.ts +3 -0
  64. package/src/requests/exceptions/BadRequestException.ts +3 -0
  65. package/src/requests/exceptions/ConflictException.ts +3 -0
  66. package/src/requests/exceptions/ForbiddenException.ts +3 -0
  67. package/src/requests/exceptions/GatewayTimeoutException.ts +3 -0
  68. package/src/requests/exceptions/GoneException.ts +3 -0
  69. package/src/requests/exceptions/InvalidJsonException.ts +15 -0
  70. package/src/requests/exceptions/LockedException.ts +3 -0
  71. package/src/requests/exceptions/MethodNotAllowedException.ts +3 -0
  72. package/src/requests/exceptions/NotImplementedException.ts +3 -0
  73. package/src/requests/exceptions/PayloadTooLargeException.ts +3 -0
  74. package/src/requests/exceptions/PreconditionFailedException.ts +3 -0
  75. package/src/requests/exceptions/RequestTimeoutException.ts +3 -0
  76. package/src/requests/exceptions/ServiceUnavailableException.ts +3 -0
  77. package/src/requests/exceptions/TooManyRequestsException.ts +3 -0
  78. package/src/requests/exceptions/UnsupportedMediaTypeException.ts +3 -0
  79. package/src/requests/exceptions/index.ts +51 -0
  80. package/src/requests/factories/FormDataFactory.ts +14 -0
  81. package/src/{service/requests → requests}/index.ts +2 -2
  82. package/src/{service/support → support}/DeferredPromise.ts +1 -1
  83. package/src/support/index.ts +4 -0
  84. package/src/vue/composables/useConfirmDialog.ts +5 -1
  85. package/src/vue/composables/useModelWrapper.ts +3 -0
  86. package/src/vue/forms/BaseForm.ts +491 -393
  87. package/src/vue/forms/PropertyAwareArray.ts +2 -2
  88. package/src/vue/forms/index.ts +4 -4
  89. package/src/vue/forms/validation/index.ts +5 -2
  90. package/src/vue/forms/validation/rules/ConfirmedRule.ts +3 -3
  91. package/src/vue/forms/validation/rules/EmailRule.ts +23 -0
  92. package/src/vue/forms/validation/rules/JsonRule.ts +28 -0
  93. package/src/vue/forms/validation/types/BidirectionalRule.ts +2 -2
  94. package/src/vue/forms/validation/types/ValidationRules.ts +15 -0
  95. package/src/vue/index.ts +3 -3
  96. package/src/vue/requests/factories/VueRequestLoaderFactory.ts +3 -2
  97. package/src/vue/requests/loaders/VueRequestBatchLoader.ts +6 -1
  98. package/src/vue/requests/loaders/VueRequestLoader.ts +1 -1
  99. package/src/vue/router/routeResourceBinding/types.ts +3 -3
  100. package/src/vue/state/State.ts +38 -50
  101. package/tests/service/helpers/mergeDeep.test.ts +1 -1
  102. package/tests/service/laravel/pagination/dataDrivers/RequestDriver.test.ts +3 -3
  103. package/tests/service/laravel/requests/JsonBaseRequest.test.ts +4 -4
  104. package/tests/service/laravel/requests/PaginationJsonBaseRequest.test.ts +3 -3
  105. package/tests/service/laravel/requests/responses/JsonResponse.test.ts +2 -2
  106. package/tests/service/laravel/requests/responses/PaginationResponse.test.ts +2 -2
  107. package/tests/service/pagination/dtos/PaginationDataDto.test.ts +1 -1
  108. package/tests/service/pagination/factories/VuePaginationDriverFactory.test.ts +2 -2
  109. package/tests/service/pagination/frontendDrivers/VuePaginationDriver.test.ts +1 -1
  110. package/tests/service/requests/ErrorHandler.test.ts +61 -58
  111. package/tests/service/requests/FormDataBody.test.ts +1 -1
  112. package/tests/vue/forms/BaseForm.behavior.test.ts +98 -0
  113. package/docs/.vitepress/theme/Layout.vue +0 -14
  114. package/docs/.vitepress/theme/components/VersionSelector.vue +0 -64
  115. package/docs/.vitepress/theme/index.js +0 -13
  116. package/docs/services/requests/index.md +0 -74
  117. package/docs/vue/forms.md +0 -477
  118. package/examples/files/7z2404-x64.exe +0 -0
  119. package/examples/index.html +0 -14
  120. package/examples/js/app.js +0 -8
  121. package/examples/js/router.js +0 -22
  122. package/examples/js/view/App.vue +0 -49
  123. package/examples/js/view/layout/DemoPage.vue +0 -28
  124. package/examples/js/view/pagination/Pagination.vue +0 -28
  125. package/examples/js/view/pagination/components/errorPagination/ErrorPagination.vue +0 -71
  126. package/examples/js/view/pagination/components/errorPagination/GetProductsRequest.ts +0 -54
  127. package/examples/js/view/pagination/components/infiniteScrolling/GetProductsRequest.ts +0 -50
  128. package/examples/js/view/pagination/components/infiniteScrolling/InfiniteScrolling.vue +0 -57
  129. package/examples/js/view/pagination/components/tablePagination/GetProductsRequest.ts +0 -50
  130. package/examples/js/view/pagination/components/tablePagination/TablePagination.vue +0 -63
  131. package/examples/js/view/requests/Requests.vue +0 -34
  132. package/examples/js/view/requests/components/abortableRequest/AbortableRequest.vue +0 -36
  133. package/examples/js/view/requests/components/abortableRequest/GetProductsRequest.ts +0 -25
  134. package/examples/js/view/requests/components/fileDownloadRequest/DownloadFileRequest.ts +0 -15
  135. package/examples/js/view/requests/components/fileDownloadRequest/FileDownloadRequest.vue +0 -44
  136. package/examples/js/view/requests/components/getRequestWithDynamicParams/GetProductsRequest.ts +0 -34
  137. package/examples/js/view/requests/components/getRequestWithDynamicParams/GetRequestWithDynamicParams.vue +0 -59
  138. package/examples/js/view/requests/components/serverErrorRequest/ServerErrorRequest.ts +0 -21
  139. package/examples/js/view/requests/components/serverErrorRequest/ServerErrorRequest.vue +0 -53
  140. package/src/service/laravel/pagination/contracts/PaginationParamsContract.ts +0 -4
  141. package/src/service/laravel/pagination/dataDrivers/RequestDriver.ts +0 -32
  142. package/src/service/laravel/pagination/index.ts +0 -7
  143. package/src/service/requests/ErrorHandler.ts +0 -64
  144. package/src/service/requests/exceptions/index.ts +0 -19
  145. package/src/service/requests/factories/FormDataFactory.ts +0 -9
  146. package/src/service/support/index.ts +0 -3
  147. /package/src/{service/bulkRequests → bulkRequests}/BulkRequestEvent.enum.ts +0 -0
  148. /package/src/{service/bulkRequests → bulkRequests}/index.ts +0 -0
  149. /package/src/{service/laravel → laravel}/pagination/contracts/PaginationResponseBodyContract.ts +0 -0
  150. /package/src/{service/laravel → laravel}/requests/JsonBaseRequest.ts +0 -0
  151. /package/src/{service/laravel → laravel}/requests/PaginationJsonBaseRequest.ts +0 -0
  152. /package/src/{service/laravel → laravel}/requests/index.ts +0 -0
  153. /package/src/{service/laravel → laravel}/requests/responses/JsonResponse.ts +0 -0
  154. /package/src/{service/laravel → laravel}/requests/responses/PaginationResponse.ts +0 -0
  155. /package/src/{service/pagination → pagination}/Paginator.ts +0 -0
  156. /package/src/{service/pagination → pagination}/contracts/BaseViewDriverContract.ts +0 -0
  157. /package/src/{service/pagination → pagination}/contracts/BaseViewDriverFactoryContract.ts +0 -0
  158. /package/src/{service/pagination → pagination}/contracts/PaginateableRequestContract.ts +0 -0
  159. /package/src/{service/pagination → pagination}/contracts/PaginationDataDriverContract.ts +0 -0
  160. /package/src/{service/pagination → pagination}/contracts/PaginationResponseContract.ts +0 -0
  161. /package/src/{service/pagination → pagination}/contracts/PaginatorLoadDataOptions.ts +0 -0
  162. /package/src/{service/pagination → pagination}/contracts/StatePaginationDataDriverContract.ts +0 -0
  163. /package/src/{service/pagination → pagination}/contracts/ViewDriverContract.ts +0 -0
  164. /package/src/{service/pagination → pagination}/contracts/ViewDriverFactoryContract.ts +0 -0
  165. /package/src/{service/pagination → pagination}/dataDrivers/ArrayDriver.ts +0 -0
  166. /package/src/{service/pagination → pagination}/dtos/PaginationDataDto.ts +0 -0
  167. /package/src/{service/pagination → pagination}/dtos/StatePaginationDataDto.ts +0 -0
  168. /package/src/{service/pagination → pagination}/factories/VueBaseViewDriverFactory.ts +0 -0
  169. /package/src/{service/pagination → pagination}/factories/VuePaginationDriverFactory.ts +0 -0
  170. /package/src/{service/pagination → pagination}/frontendDrivers/VueBaseViewDriver.ts +0 -0
  171. /package/src/{service/pagination → pagination}/frontendDrivers/VuePaginationDriver.ts +0 -0
  172. /package/src/{service/persistenceDrivers → persistenceDrivers}/LocalStorageDriver.ts +0 -0
  173. /package/src/{service/persistenceDrivers → persistenceDrivers}/NonPersistentDriver.ts +0 -0
  174. /package/src/{service/persistenceDrivers → persistenceDrivers}/SessionStorageDriver.ts +0 -0
  175. /package/src/{service/persistenceDrivers → persistenceDrivers}/index.ts +0 -0
  176. /package/src/{service/persistenceDrivers → persistenceDrivers}/types/PersistenceDriver.ts +0 -0
  177. /package/src/{service/requests → requests}/RequestEvents.enum.ts +0 -0
  178. /package/src/{service/requests → requests}/RequestMethod.enum.ts +0 -0
  179. /package/src/{service/requests → requests}/bodies/JsonBody.ts +0 -0
  180. /package/src/{service/requests → requests}/contracts/AbortableRequestContract.ts +0 -0
  181. /package/src/{service/requests → requests}/contracts/BaseRequestContract.ts +0 -0
  182. /package/src/{service/requests → requests}/contracts/BodyContract.ts +0 -0
  183. /package/src/{service/requests → requests}/contracts/BodyFactoryContract.ts +0 -0
  184. /package/src/{service/requests → requests}/contracts/DriverConfigContract.ts +0 -0
  185. /package/src/{service/requests → requests}/contracts/HeadersContract.ts +0 -0
  186. /package/src/{service/requests → requests}/contracts/RequestDriverContract.ts +0 -0
  187. /package/src/{service/requests → requests}/contracts/RequestLoaderContract.ts +0 -0
  188. /package/src/{service/requests → requests}/contracts/RequestLoaderFactoryContract.ts +0 -0
  189. /package/src/{service/requests → requests}/contracts/ResponseContract.ts +0 -0
  190. /package/src/{service/requests → requests}/drivers/contracts/ResponseHandlerContract.ts +0 -0
  191. /package/src/{service/requests → requests}/drivers/fetch/FetchDriver.ts +0 -0
  192. /package/src/{service/requests → requests}/drivers/fetch/FetchResponse.ts +0 -0
  193. /package/src/{service/requests → requests}/exceptions/NoResponseReceivedException.ts +0 -0
  194. /package/src/{service/requests → requests}/exceptions/NotFoundException.ts +0 -0
  195. /package/src/{service/requests → requests}/exceptions/PageExpiredException.ts +0 -0
  196. /package/src/{service/requests → requests}/exceptions/ResponseBodyException.ts +0 -0
  197. /package/src/{service/requests → requests}/exceptions/ResponseException.ts +0 -0
  198. /package/src/{service/requests → requests}/exceptions/ServerErrorException.ts +0 -0
  199. /package/src/{service/requests → requests}/exceptions/UnauthorizedException.ts +0 -0
  200. /package/src/{service/requests → requests}/exceptions/ValidationException.ts +0 -0
  201. /package/src/{service/requests → requests}/factories/JsonBodyFactory.ts +0 -0
  202. /package/src/{service/requests → requests}/responses/BaseResponse.ts +0 -0
  203. /package/src/{service/requests → requests}/responses/BlobResponse.ts +0 -0
  204. /package/src/{service/requests → requests}/responses/JsonResponse.ts +0 -0
  205. /package/src/{service/requests → requests}/responses/PlainTextResponse.ts +0 -0
  206. /package/src/{helpers.ts → support/helpers.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,23 @@
1
+ ## v4.0.0-beta.1 - 2026-02-26 (beta)
2
+
3
+ # [4.0.0-beta.1](/compare/v3.0.1...v4.0.0-beta.1) (2026-02-26)
4
+
5
+
6
+ ### Features
7
+
8
+ * Added abortBatch to VueRequestBatchLoader; Improved documentation for loading 9701045
9
+ * Added multiple exceptions; Improved request error handling docs a6e4559
10
+ * Improved BaseForm fdda88c
11
+ * Improved documentation for supprt and helpers; Moved helpers into support namespace f92edef
12
+ * Improved Laravel docs; Removed obsolte code 415273c
13
+ * Improved laravel documentation; Moved laravel code outside of service directory bb9a708
14
+ * Improved pagination docs; Refactored paginator ee1b901
15
+ * Improved state class ffe3b03
16
+ * Removed service namespace and moved core items directly under core namespace 3def966
17
+ * Updated docs and introduced minor changes 2d51524
18
+ ## v3.0.1 - 2026-02-21
19
+
20
+ ## [3.0.1](/compare/v3.0.0...v3.0.1) (2026-02-21)
1
21
  ## v3.0.0 - 2026-02-19
2
22
 
3
23
  # [3.0.0](/compare/v2.0.0...v3.0.0) (2026-02-19)
package/README.md CHANGED
@@ -1 +1,25 @@
1
- Docs: https://hank-it.github.io/ui/latest
1
+ # @blueprint-ts/core
2
+
3
+ A core library for TypeScript projects, providing a robust foundation for building modern web applications. It offers a suite of utilities for form management, API requests, pagination, and seamless Vue integration.
4
+
5
+ ## Documentation
6
+
7
+ Full documentation is available at [https://hank-it.github.io/blueprint-ts-core/](https://hank-it.github.io/blueprint-ts-core/).
8
+
9
+ ## Installation
10
+
11
+ Install the package via npm:
12
+
13
+ ```bash
14
+ npm i @blueprint-ts/core
15
+ ```
16
+
17
+ Package details can be found on [npm](https://www.npmjs.com/package/@blueprint-ts/core).
18
+
19
+ ## Support
20
+
21
+ Only the latest version of `@blueprint-ts/core` is supported. I recommend keeping your project updated to the latest version.
22
+
23
+ ## License
24
+
25
+ This project is licensed under the [MIT License](LICENSE).
@@ -1,10 +1,10 @@
1
1
  import { defineConfig } from 'vitepress'
2
2
 
3
3
  export default defineConfig({
4
- title: '@hank-it/ui',
5
- description: 'Documentation for the @hank-it/ui library',
4
+ title: '@blueprint-ts/core',
5
+ description: 'Documentation for the @blueprint-ts/core library',
6
6
 
7
- base: process.env['DOCS_BASE'] || '/ui/latest/',
7
+ base: process.env['DOCS_BASE'] || '/blueprint-ts-core/',
8
8
 
9
9
  themeConfig: {
10
10
  sidebar: [
@@ -16,50 +16,107 @@ export default defineConfig({
16
16
  text: 'Services',
17
17
  collapsed: false,
18
18
  items: [
19
- { text: 'Requests', link: '/services/requests' },
20
- //{ text: 'Pagination', link: '/services/pagination' },
21
- //{ text: 'Support', link: '/services/support' },
22
- //{ text: 'Persistence Drivers', link: '/services/persistence-drivers' },
23
19
  {
24
- text: 'Laravel Integration',
25
- collapsed: true,
20
+ text: 'Requests',
21
+ items: [
22
+ { text: 'Getting Started', link: '/services/requests/getting-started' },
23
+ { text: 'Loading', link: '/services/requests/loading' },
24
+ { text: 'Drivers', link: '/services/requests/drivers' },
25
+ { text: 'Responses', link: '/services/requests/responses' },
26
+ { text: 'Request Bodies', link: '/services/requests/request-bodies' },
27
+ { text: 'Headers', link: '/services/requests/headers' },
28
+ { text: 'Aborting Requests', link: '/services/requests/abort-requests' },
29
+ { text: 'Events', link: '/services/requests/events' },
30
+ { text: 'Bulk Requests', link: '/services/requests/bulk-requests' },
31
+ { text: 'Error Handling', link: '/services/requests/error-handling' }
32
+ ]
33
+ },
34
+ {
35
+ text: 'Pagination',
36
+ items: [
37
+ { text: 'Overview', link: '/services/pagination/' },
38
+ { text: 'Page-Aware', link: '/services/pagination/page-aware' },
39
+ { text: 'Infinite Scroller', link: '/services/pagination/infinite-scroller' },
40
+ { text: 'State/Cursor', link: '/services/pagination/state-pagination' },
41
+ { text: 'Updating Rows', link: '/services/pagination/updating-rows' }
42
+ ]
43
+ },
44
+ {
45
+ text: 'Support',
26
46
  items: [
27
- { text: 'Laravel Requests', link: '/services/laravel/requests' },
28
- { text: 'Laravel Pagination', link: '/services/laravel/pagination' }
47
+ { text: 'Overview', link: '/services/support/' },
48
+ { text: 'Helpers', link: '/services/support/helpers' },
49
+ { text: 'DeferredPromise', link: '/services/support/deferred-promise' }
29
50
  ]
51
+ },
52
+ {
53
+ text: 'Persistence',
54
+ link: '/services/persistence/'
30
55
  }
31
56
  ]
32
57
  },
58
+ {
59
+ text: 'Laravel',
60
+ collapsed: false,
61
+ items: [
62
+ { text: 'Requests', link: '/laravel/requests' },
63
+ { text: 'Pagination', link: '/laravel/pagination' }
64
+ ]
65
+ },
33
66
  {
34
67
  text: 'Vue',
35
68
  collapsed: false,
36
69
  items: [
37
70
  { text: 'State', link: '/vue/state/' },
71
+ {
72
+ text: 'Composables',
73
+ items: [
74
+ { text: 'useConfirmDialog', link: '/vue/composables/use-confirm-dialog' },
75
+ { text: 'useGlobalCheckbox', link: '/vue/composables/use-global-checkbox' },
76
+ { text: 'useIsEmpty', link: '/vue/composables/use-is-empty' },
77
+ { text: 'useIsOpen', link: '/vue/composables/use-is-open' },
78
+ { text: 'useIsOpenFromVar', link: '/vue/composables/use-is-open-from-var' },
79
+ { text: 'useModelWrapper', link: '/vue/composables/use-model-wrapper' },
80
+ { text: 'useOnOpen', link: '/vue/composables/use-on-open' }
81
+ ]
82
+ },
38
83
  {
39
84
  text: 'Forms',
40
- link: '/vue/forms'
85
+ items: [
86
+ { text: 'Overview', link: '/vue/forms/' },
87
+ { text: 'State And Properties', link: '/vue/forms/state-and-properties' },
88
+ { text: 'Validation', link: '/vue/forms/validation' },
89
+ { text: 'Building Payloads', link: '/vue/forms/payloads' },
90
+ { text: 'Errors', link: '/vue/forms/errors' },
91
+ { text: 'Persistence', link: '/vue/forms/persistence' },
92
+ { text: 'Arrays', link: '/vue/forms/arrays' },
93
+ { text: 'Utilities', link: '/vue/forms/utilities' }
94
+ ]
41
95
  },
42
96
  {
43
97
  text: 'Requests',
44
98
  items: [
45
- /*{ text: 'Usage with Composition API', link: '/vue/requests/composition' },
46
- { text: 'Loading States', link: '/vue/requests/loading' },
47
- { text: 'Error Handling', link: '/vue/requests/errors' },*/
48
- { text: 'Route Resource Binding', link: '/vue/requests/route-resource-binding' }
99
+ { text: 'Loading', link: '/vue/requests/loading' }
49
100
  ]
101
+ },
102
+ {
103
+ text: 'Router',
104
+ items: [{ text: 'Route Resource Binding', link: '/vue/router/route-resource-binding' }]
50
105
  }
51
106
  ]
52
- }
53
- /*{
54
- text: 'Helpers',
107
+ },
108
+ {
109
+ text: 'Upgrading',
55
110
  items: [
56
- { text: 'Utility Functions', link: '/helpers/' }
111
+ { text: 'v1 to v2', link: '/upgrading/v1-to-v2' },
112
+ { text: 'v2 to v3', link: '/upgrading/v2-to-v3' },
113
+ { text: 'v3 to v4', link: '/upgrading/v3-to-v4' }
57
114
  ]
58
- }*/
115
+ }
59
116
  ],
60
117
  nav: [
61
118
  { text: 'Home', link: '/' },
62
- { text: 'GitHub', link: 'https://github.com/Hank-IT/ui' }
119
+ { text: 'GitHub', link: 'https://github.com/Hank-IT/blueprint-ts-core' }
63
120
  ]
64
121
  }
65
- })
122
+ })
package/docs/index.md CHANGED
@@ -1,70 +1,13 @@
1
1
  # Getting Started
2
2
 
3
- This library can be integrated with any frontend framework. It comes with built-in support for Vue 3, which is assumed
4
- throughout the documentation.
3
+ This library may be integrated with any frontend framework. It comes with built-in support for Vue 3, which is assumed
4
+ throughout the documentation. It also has features which are Vue-specific, such as form handling and validation.
5
5
 
6
6
  ````bash
7
- npm install @hank-it/ui --save
7
+ npm install @blueprint-ts/core --save
8
8
  ````
9
9
 
10
- ## Request Handling
10
+ ## Versioning
11
11
 
12
- The library leverages a fetch-based driver to perform HTTP requests. The following sections explain how to initialize
13
- the request driver and define custom requests.
14
-
15
- ## Initializing the Request Driver
16
-
17
- Before making any requests, you must initialize the appropriate request driver. This is done during your application's
18
- boot process by using the static `setRequestDriver` method.
19
-
20
- ### Using the Fetch Driver
21
-
22
- To set up the fetch driver, import `BaseRequest` and `FetchDriver` from '@hank-it/ui/service/requests' and initialize
23
- the driver as shown:
24
-
25
- ```typescript
26
- import { BaseRequest, FetchDriver } from '@hank-it/ui/service/requests'
27
-
28
- BaseRequest.setRequestDriver(new FetchDriver())
29
- ```
30
-
31
- ### Enabling Credential Support
32
-
33
- If your requests need to include credentials (e.g., cookies for cross-origin requests), enable credential support as
34
- follows:
35
-
36
- ```typescript
37
- BaseRequest.setRequestDriver(new FetchDriver({
38
- corsWithCredentials: true,
39
- }))
40
- ```
41
-
42
- ### Adding Global Headers
43
-
44
- To include headers such as a CSRF token with every request, define them globally:
45
-
46
- ```typescript
47
- BaseRequest.setRequestDriver(new FetchDriver({
48
- headers: {
49
- 'X-XSRF-TOKEN': "<token>",
50
- },
51
- }))
52
- ```
53
-
54
- Sometimes you want to refetch the header when the request is sent. You may specify a callback for this:
55
-
56
- ```typescript
57
- BaseRequest.setRequestDriver(new FetchDriver({
58
- headers: {
59
- 'X-XSRF-TOKEN': () => getCookie('XSRF-TOKEN')
60
- },
61
- }))
62
- ```
63
-
64
- ### Specifying a Base URL
65
-
66
- In case your backend lives on a separate domain, you may specify a default base url, which is prepended to every request url:
67
-
68
- ```typescript
69
- BaseRequest.setDefaultBaseUrl('https://example.com')
70
- ```
12
+ Blueprint TS follows [Semantic Versioning](https://semver.org/). Upgrading from one major version to another may require
13
+ some changes to your code, which will be documented in the Upgrading section of this documentation.
@@ -1,11 +1,18 @@
1
1
  # Working with Laravel Pagination
2
2
  The `PaginationJsonBaseRequest` class extends the functionality to handle Laravel's pagination response format.
3
3
 
4
+ ## RequestDriver
5
+
6
+ Use the Laravel `RequestDriver` to turn a `PaginationJsonBaseRequest` into a pagination data driver for the core
7
+ paginator classes.
8
+
4
9
  ## Example: Paginated Users List
5
10
 
6
11
  ````typescript
7
- import { PaginationJsonBaseRequest } from '@hank-it/ui/service/laravel/requests'
8
- import { PaginationResponse } from '@hank-it/ui/service/laravel/requests/responses'
12
+ import { PaginationJsonBaseRequest } from '@blueprint-ts/core/laravel/requests'
13
+ import { PaginationResponse } from '@blueprint-ts/core/laravel/requests/responses'
14
+ import { RequestDriver } from '@blueprint-ts/core/laravel/pagination'
15
+ import { PageAwarePaginator } from '@blueprint-ts/core/pagination'
9
16
 
10
17
  export interface UserListParams {
11
18
  search?: string
@@ -38,17 +45,23 @@ And now we send the request using the paginator:
38
45
  ````typescript
39
46
  const request = new UserIndexRequest()
40
47
 
41
- const paginator = new Paginator(new RequestDriver(request))
48
+ const paginator = new PageAwarePaginator(new RequestDriver(request))
42
49
 
43
50
  // Fetch the initial data
44
- paginator.init(1, 10)
51
+ paginator.load(1)
45
52
 
46
53
  // Get current page data
47
54
  paginator.getPageData()
48
55
 
49
56
  // Change page
50
- paginator.setPageSize(value)
57
+ await paginator.setPageSize(value).load()
51
58
 
52
59
  // Get current page size
53
60
  paginator.getPageSize()
54
- ````
61
+ ````
62
+
63
+ ## Types
64
+
65
+ For stricter typing, the Laravel pagination package also exports:
66
+
67
+ - `PaginationResponseBodyContract` for the expected pagination response body shape
@@ -9,7 +9,7 @@ The `JsonBaseRequest` class is designed to work with Laravel's JSON responses, a
9
9
  We assume that Laravel's resources are used which output the requested data on the `data` json key.
10
10
 
11
11
  ````typescript
12
- import { JsonBaseRequest } from '@hank-it/ui/service/laravel/requests'
12
+ import { JsonBaseRequest } from '@blueprint-ts/core/laravel/requests'
13
13
 
14
14
  export interface LaravelErrorResponse {
15
15
  message: string;
@@ -59,4 +59,4 @@ const request = new UserShowRequest()
59
59
  const response: JsonResponse<UserResource> = await request.send()
60
60
 
61
61
  const data: UserResource[] = response.getData()
62
- ```
62
+ ```
@@ -0,0 +1,46 @@
1
+ # Pagination
2
+
3
+ Pagination is built around three parts:
4
+
5
+ 1. **Data drivers** fetch pages and return a `PaginationDataDto`.
6
+ 2. **View drivers** store pagination state (page, size, total) and expose page data.
7
+ 3. **Paginators** orchestrate loading and state updates.
8
+
9
+ ## Drivers
10
+
11
+ Pagination uses two kinds of drivers:
12
+
13
+ - **Data drivers** fetch pages and return a `PaginationDataDto`.
14
+ - **View drivers** store pagination state (page, size, total) and expose page data.
15
+
16
+ You can implement your own drivers by following these contracts:
17
+
18
+ - `PaginationDataDriverContract` or `StatePaginationDataDriverContract` for data drivers
19
+ - `ViewDriverFactoryContract` or `BaseViewDriverFactoryContract` for view drivers
20
+
21
+ If you are using Vue, the library provides `VuePaginationDriverFactory` and `VueBaseViewDriverFactory`.
22
+
23
+ ### Built-in Data Drivers
24
+
25
+ - `ArrayDriver`: paginate an in-memory array.
26
+ - `RequestDriver`: paginate using a request. See the Laravel pagination integration for usage details.
27
+
28
+ ## Paginators
29
+
30
+ - [Page-Aware Pagination](./page-aware)
31
+ - [Infinite Scroll](./infinite-scroller)
32
+ - [State/Cursor Pagination](./state-pagination)
33
+
34
+ ## Load Options
35
+
36
+ `load()` accepts `PaginatorLoadDataOptions`:
37
+
38
+ - `flush`: clears existing data before applying the next page
39
+ - `replace`: replaces existing data instead of appending (useful for infinite scroll)
40
+
41
+ `updateRows` is available on all paginators. See [Updating Rows](./updating-rows).
42
+
43
+ ## Using Laravel Pagination
44
+
45
+ If you use Laravel pagination responses, see the Laravel pagination docs for the `PaginationJsonBaseRequest` and
46
+ `RequestDriver` integration.
@@ -0,0 +1,19 @@
1
+ # Infinite Scroll
2
+
3
+ Use `InfiniteScroller` when you want to append pages to the existing list:
4
+
5
+ ```typescript
6
+ import { InfiniteScroller } from '@blueprint-ts/core/pagination'
7
+
8
+ const scroller = new InfiniteScroller(dataDriver, 1, 10)
9
+
10
+ await scroller.load()
11
+ await scroller.toNextPage()
12
+ ```
13
+
14
+ `InfiniteScroller` uses the same view driver factory as `PageAwarePaginator`. You can pass `{ flush: true }` or
15
+ `{ replace: true }` to `load()` or `setPageNumber()` to control how data is merged.
16
+
17
+ ## Scroll Detection Helper
18
+
19
+ See the Support Helpers docs for `isAtBottom` usage.
@@ -0,0 +1,46 @@
1
+ # Page-Aware Pagination
2
+
3
+ Use `PageAwarePaginator` for classic page/size pagination. It requires a view driver factory:
4
+
5
+ ```typescript
6
+ import { PageAwarePaginator, ArrayDriver, type ViewDriverFactoryContract } from '@blueprint-ts/core/pagination'
7
+
8
+ class MyViewDriverFactory implements ViewDriverFactoryContract {
9
+ public make<ResourceInterface>(pageNumber: number, pageSize: number) {
10
+ // Return a ViewDriverContract<ResourceInterface[]> implementation.
11
+ throw new Error('Not implemented')
12
+ }
13
+ }
14
+
15
+ PageAwarePaginator.setViewDriverFactory(new MyViewDriverFactory())
16
+
17
+ const dataDriver = new ArrayDriver(users)
18
+ const paginator = new PageAwarePaginator(dataDriver, 1, 10)
19
+
20
+ await paginator.load()
21
+
22
+ const pageData = paginator.getPageData()
23
+ const total = paginator.getTotal()
24
+ const pages = paginator.getPages()
25
+ ```
26
+
27
+ `dataDriver` must implement `PaginationDataDriverContract` and return a `PaginationDataDto`.
28
+ If you are using Vue, the library provides `VuePaginationDriverFactory`.
29
+
30
+ ## Changing Page or Page Size
31
+
32
+ `setPageNumber()` and `setPageSize()` only update state. Call `load()` to fetch data:
33
+
34
+ ```typescript
35
+ await paginator.setPageNumber(2).load()
36
+
37
+ await paginator.setPageSize(25).load()
38
+ ```
39
+
40
+ Page navigation helpers (`toNextPage`, `toPreviousPage`, `toFirstPage`, `toLastPage`) update the page number and load
41
+ the new page in one call.
42
+
43
+
44
+ ## Updating Rows
45
+
46
+ `updateRows` is available on all paginators. See [Updating Rows](./updating-rows) for details.
@@ -0,0 +1,77 @@
1
+ # State/Cursor Pagination
2
+
3
+ Use `StatePaginator` for cursor-based APIs that return a next-state token. It requires a base view driver factory:
4
+
5
+ ```typescript
6
+ import { StatePaginator, type BaseViewDriverFactoryContract } from '@blueprint-ts/core/pagination'
7
+
8
+ class MyBaseViewDriverFactory implements BaseViewDriverFactoryContract {
9
+ public make<ResourceInterface>() {
10
+ // Return a BaseViewDriverContract<ResourceInterface[]> implementation.
11
+ throw new Error('Not implemented')
12
+ }
13
+ }
14
+
15
+ StatePaginator.setViewDriverFactory(new MyBaseViewDriverFactory())
16
+
17
+ const paginator = new StatePaginator(dataDriver)
18
+
19
+ await paginator.load()
20
+ await paginator.loadNext()
21
+ ```
22
+
23
+ `dataDriver` must implement `StatePaginationDataDriverContract` and return a `StatePaginationDataDto`.
24
+ If you are using Vue, the library provides `VueBaseViewDriverFactory`.
25
+
26
+ ## Example Driver
27
+
28
+ ```typescript
29
+ import { type StatePaginationDataDriverContract, StatePaginationDataDto } from '@blueprint-ts/core/pagination'
30
+ import { type MailListResource } from '@/types/MailListResource.ts'
31
+ import { MailIndexRequest, type MailIndexRequestRequestParams } from '@/requests/MailIndexRequest.ts'
32
+ import { RequestEvents } from '@blueprint-ts/core/requests'
33
+
34
+ export class MailPaginationDataDriver implements StatePaginationDataDriverContract<MailListResource[]> {
35
+ public constructor(
36
+ protected accountId: string,
37
+ protected filters?: MailIndexRequestRequestParams['filter']
38
+ ) {}
39
+
40
+ public get(state?: string | null): Promise<StatePaginationDataDto<MailListResource[]>> {
41
+ const request = new MailIndexRequest(this.accountId)
42
+
43
+ request.setParams({
44
+ state: state || undefined,
45
+ filter: this.filters
46
+ })
47
+
48
+ return request
49
+ .send()
50
+ .then((response) => {
51
+ const data = response.getData() || []
52
+ const body = response.getBody() as unknown as { meta?: { state?: string; total?: number } }
53
+ const nextState = body.meta?.state || null
54
+ const total = body.meta?.total || data.length
55
+
56
+ return new StatePaginationDataDto(data, total, nextState)
57
+ })
58
+ }
59
+ }
60
+
61
+ const paginator = new StatePaginator(new MailPaginationDataDriver(props.accountId))
62
+
63
+ function loadMails() {
64
+ paginator.flush()
65
+ paginator.load().catch((error) => {
66
+ console.error(error)
67
+ })
68
+ }
69
+
70
+ function loadMoreMails() {
71
+ if (!paginator.hasNextPage()) return
72
+
73
+ paginator.loadNext().catch((error) => {
74
+ console.error(error)
75
+ })
76
+ }
77
+ ```
@@ -0,0 +1,36 @@
1
+ # Updating Rows
2
+
3
+ All paginators (including `InfiniteScroller`) inherit `updateRows` from `BasePaginator`. It lets you update items in the
4
+ current page data without reloading.
5
+
6
+ ## Usage
7
+
8
+ `updateRows` accepts:
9
+
10
+ - a predicate to select rows
11
+ - an updater to mutate or replace them
12
+
13
+ ```typescript
14
+ // Mark a single item as selected
15
+ paginator.updateRows(
16
+ (row) => row.id === targetId,
17
+ (row) => {
18
+ row.selected = true
19
+ }
20
+ )
21
+
22
+ // Replace matching items with new objects
23
+ paginator.updateRows(
24
+ (row) => row.status === 'draft',
25
+ (row) => ({ ...row, status: 'published' })
26
+ )
27
+ ```
28
+
29
+ It returns the number of rows updated:
30
+
31
+ ```typescript
32
+ const updated = paginator.updateRows(
33
+ (row) => row.id === targetId,
34
+ (row) => ({ ...row, updatedAt: new Date().toISOString() })
35
+ )
36
+ ```
@@ -0,0 +1,46 @@
1
+ # Persistence
2
+
3
+ This service provides simple persistence drivers that implement a common `PersistenceDriver` interface. It is used by `BaseForm`, but can also be used directly.
4
+
5
+ ## Available Drivers
6
+
7
+ - `NonPersistentDriver` — no persistence (default for `BaseForm`)
8
+ - `SessionStorageDriver` — uses `sessionStorage`
9
+ - `LocalStorageDriver` — uses `localStorage`
10
+
11
+ All drivers are exported from `@blueprint-ts/core/persistenceDrivers`.
12
+
13
+ ## Using A Driver
14
+
15
+ ```ts
16
+ import { LocalStorageDriver } from '@blueprint-ts/core/persistenceDrivers'
17
+
18
+ const driver = new LocalStorageDriver('optional-suffix')
19
+
20
+ driver.set('my-key', { value: 123 })
21
+ const value = driver.get<{ value: number }>('my-key')
22
+ ```
23
+
24
+ ## Implementing A Custom Driver
25
+
26
+ Implement the `PersistenceDriver` interface:
27
+
28
+ ```ts
29
+ import { type PersistenceDriver } from '@blueprint-ts/core/persistenceDrivers'
30
+
31
+ export class MemoryDriver implements PersistenceDriver {
32
+ private store = new Map<string, unknown>()
33
+
34
+ get<T>(key: string): T | null {
35
+ return (this.store.get(key) as T) ?? null
36
+ }
37
+
38
+ set<T>(key: string, state: T): void {
39
+ this.store.set(key, state)
40
+ }
41
+
42
+ remove(key: string): void {
43
+ this.store.delete(key)
44
+ }
45
+ }
46
+ ```
@@ -0,0 +1,25 @@
1
+ # Aborting Requests
2
+
3
+ Requests can be aborted by passing an `AbortSignal` to the request.
4
+
5
+ ## Using AbortController
6
+
7
+ ```typescript
8
+ const controller = new AbortController()
9
+
10
+ const request = new ExpenseIndexRequest()
11
+ .setAbortSignal(controller.signal)
12
+
13
+ const promise = request.send()
14
+
15
+ // Later, when you want to abort:
16
+ controller.abort()
17
+ ```
18
+
19
+ ## Bulk Requests
20
+
21
+ `BulkRequestSender` internally manages an `AbortController` for its requests. You can abort the entire bulk operation:
22
+
23
+ ```typescript
24
+ bulkRequestSenderInstance.abort()
25
+ ```