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

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 (211) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/README.md +25 -1
  3. package/docs/.vitepress/config.ts +81 -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 +20 -0
  9. package/docs/services/pagination/page-aware.md +51 -0
  10. package/docs/services/pagination/state-pagination.md +77 -0
  11. package/docs/services/pagination/updating-rows.md +52 -0
  12. package/docs/services/persistence/index.md +46 -0
  13. package/docs/services/requests/abort-requests.md +29 -0
  14. package/docs/services/requests/bulk-requests.md +70 -0
  15. package/docs/services/requests/concurrency.md +58 -0
  16. package/docs/services/requests/drivers.md +50 -0
  17. package/docs/services/requests/error-handling.md +153 -0
  18. package/docs/services/requests/events.md +31 -0
  19. package/docs/services/requests/getting-started.md +201 -0
  20. package/docs/services/requests/headers.md +40 -0
  21. package/docs/services/requests/loading.md +63 -0
  22. package/docs/services/requests/request-bodies.md +59 -0
  23. package/docs/services/requests/responses.md +34 -0
  24. package/docs/services/support/deferred-promise.md +63 -0
  25. package/docs/services/support/helpers.md +77 -0
  26. package/docs/services/support/index.md +6 -0
  27. package/docs/upgrading/v1-to-v2.md +64 -0
  28. package/docs/upgrading/v2-to-v3.md +52 -0
  29. package/docs/upgrading/v3-to-v4.md +214 -0
  30. package/docs/upgrading.md +0 -0
  31. package/docs/vue/composables/use-confirm-dialog.md +96 -0
  32. package/docs/vue/composables/use-global-checkbox.md +73 -0
  33. package/docs/vue/composables/use-is-empty.md +26 -0
  34. package/docs/vue/composables/use-is-open-from-var.md +32 -0
  35. package/docs/vue/composables/use-is-open.md +28 -0
  36. package/docs/vue/composables/use-model-wrapper.md +29 -0
  37. package/docs/vue/composables/use-on-open.md +26 -0
  38. package/docs/vue/forms/arrays.md +102 -0
  39. package/docs/vue/forms/errors.md +52 -0
  40. package/docs/vue/forms/index.md +99 -0
  41. package/docs/vue/forms/payloads.md +99 -0
  42. package/docs/vue/forms/persistence.md +19 -0
  43. package/docs/vue/forms/state-and-properties.md +26 -0
  44. package/docs/vue/forms/utilities.md +27 -0
  45. package/docs/vue/forms/validation.md +189 -0
  46. package/docs/vue/requests/loading.md +51 -0
  47. package/docs/vue/{requests → router}/route-resource-binding.md +33 -27
  48. package/docs/vue/state.md +27 -11
  49. package/package.json +12 -13
  50. package/release-tool.json +22 -3
  51. package/src/{service/bulkRequests → bulkRequests}/BulkRequestSender.ts +29 -17
  52. package/src/{service/bulkRequests → bulkRequests}/BulkRequestWrapper.ts +5 -5
  53. package/src/laravel/pagination/dataDrivers/RequestDriver.ts +30 -0
  54. package/src/laravel/pagination/index.ts +6 -0
  55. package/src/pagination/BasePaginator.ts +94 -0
  56. package/src/{service/pagination → pagination}/InfiniteScroller.ts +1 -0
  57. package/src/{service/pagination → pagination}/PageAwarePaginator.ts +34 -26
  58. package/src/{service/pagination → pagination}/StatePaginator.ts +2 -8
  59. package/src/{service/pagination → pagination}/index.ts +1 -3
  60. package/src/{service/requests → requests}/BaseRequest.ts +89 -4
  61. package/src/requests/ErrorHandler.ts +144 -0
  62. package/src/requests/RequestConcurrencyMode.enum.ts +6 -0
  63. package/src/requests/RequestErrorRouter.ts +89 -0
  64. package/src/{service/requests → requests}/bodies/FormDataBody.ts +10 -6
  65. package/src/{service/requests → requests}/contracts/BaseRequestContract.ts +3 -0
  66. package/src/requests/exceptions/BadGatewayException.ts +3 -0
  67. package/src/requests/exceptions/BadRequestException.ts +3 -0
  68. package/src/requests/exceptions/ConflictException.ts +3 -0
  69. package/src/requests/exceptions/ForbiddenException.ts +3 -0
  70. package/src/requests/exceptions/GatewayTimeoutException.ts +3 -0
  71. package/src/requests/exceptions/GoneException.ts +3 -0
  72. package/src/requests/exceptions/InvalidJsonException.ts +15 -0
  73. package/src/requests/exceptions/LockedException.ts +3 -0
  74. package/src/requests/exceptions/MethodNotAllowedException.ts +3 -0
  75. package/src/requests/exceptions/NotImplementedException.ts +3 -0
  76. package/src/requests/exceptions/PayloadTooLargeException.ts +3 -0
  77. package/src/requests/exceptions/PreconditionFailedException.ts +3 -0
  78. package/src/requests/exceptions/RequestTimeoutException.ts +3 -0
  79. package/src/requests/exceptions/ServiceUnavailableException.ts +3 -0
  80. package/src/requests/exceptions/StaleResponseException.ts +13 -0
  81. package/src/requests/exceptions/TooManyRequestsException.ts +3 -0
  82. package/src/requests/exceptions/UnsupportedMediaTypeException.ts +3 -0
  83. package/src/requests/exceptions/index.ts +51 -0
  84. package/src/requests/factories/FormDataFactory.ts +17 -0
  85. package/src/{service/requests → requests}/index.ts +9 -3
  86. package/src/requests/types/RequestConcurrencyOptions.ts +6 -0
  87. package/src/{service/support → support}/DeferredPromise.ts +1 -1
  88. package/src/support/index.ts +4 -0
  89. package/src/vue/composables/useConfirmDialog.ts +5 -1
  90. package/src/vue/composables/useModelWrapper.ts +3 -0
  91. package/src/vue/forms/BaseForm.ts +512 -399
  92. package/src/vue/forms/PropertyAwareArray.ts +6 -2
  93. package/src/vue/forms/index.ts +4 -4
  94. package/src/vue/forms/validation/index.ts +5 -2
  95. package/src/vue/forms/validation/rules/ConfirmedRule.ts +3 -3
  96. package/src/vue/forms/validation/rules/EmailRule.ts +23 -0
  97. package/src/vue/forms/validation/rules/JsonRule.ts +28 -0
  98. package/src/vue/forms/validation/types/BidirectionalRule.ts +2 -2
  99. package/src/vue/forms/validation/types/ValidationRules.ts +15 -0
  100. package/src/vue/index.ts +3 -3
  101. package/src/vue/requests/factories/VueRequestLoaderFactory.ts +3 -2
  102. package/src/vue/requests/loaders/VueRequestBatchLoader.ts +6 -1
  103. package/src/vue/requests/loaders/VueRequestLoader.ts +1 -1
  104. package/src/vue/router/routeResourceBinding/types.ts +3 -3
  105. package/src/vue/state/State.ts +38 -50
  106. package/tests/service/helpers/mergeDeep.test.ts +1 -1
  107. package/tests/service/laravel/pagination/dataDrivers/RequestDriver.test.ts +3 -3
  108. package/tests/service/laravel/requests/JsonBaseRequest.test.ts +4 -4
  109. package/tests/service/laravel/requests/PaginationJsonBaseRequest.test.ts +3 -3
  110. package/tests/service/laravel/requests/responses/JsonResponse.test.ts +2 -2
  111. package/tests/service/laravel/requests/responses/PaginationResponse.test.ts +2 -2
  112. package/tests/service/pagination/dtos/PaginationDataDto.test.ts +1 -1
  113. package/tests/service/pagination/factories/VuePaginationDriverFactory.test.ts +2 -2
  114. package/tests/service/pagination/frontendDrivers/VuePaginationDriver.test.ts +1 -1
  115. package/tests/service/requests/ErrorHandler.test.ts +61 -58
  116. package/tests/service/requests/FormDataBody.test.ts +1 -1
  117. package/tests/vue/forms/BaseForm.behavior.test.ts +98 -0
  118. package/docs/.vitepress/theme/Layout.vue +0 -14
  119. package/docs/.vitepress/theme/components/VersionSelector.vue +0 -64
  120. package/docs/.vitepress/theme/index.js +0 -13
  121. package/docs/services/requests/index.md +0 -74
  122. package/docs/vue/forms.md +0 -477
  123. package/examples/files/7z2404-x64.exe +0 -0
  124. package/examples/index.html +0 -14
  125. package/examples/js/app.js +0 -8
  126. package/examples/js/router.js +0 -22
  127. package/examples/js/view/App.vue +0 -49
  128. package/examples/js/view/layout/DemoPage.vue +0 -28
  129. package/examples/js/view/pagination/Pagination.vue +0 -28
  130. package/examples/js/view/pagination/components/errorPagination/ErrorPagination.vue +0 -71
  131. package/examples/js/view/pagination/components/errorPagination/GetProductsRequest.ts +0 -54
  132. package/examples/js/view/pagination/components/infiniteScrolling/GetProductsRequest.ts +0 -50
  133. package/examples/js/view/pagination/components/infiniteScrolling/InfiniteScrolling.vue +0 -57
  134. package/examples/js/view/pagination/components/tablePagination/GetProductsRequest.ts +0 -50
  135. package/examples/js/view/pagination/components/tablePagination/TablePagination.vue +0 -63
  136. package/examples/js/view/requests/Requests.vue +0 -34
  137. package/examples/js/view/requests/components/abortableRequest/AbortableRequest.vue +0 -36
  138. package/examples/js/view/requests/components/abortableRequest/GetProductsRequest.ts +0 -25
  139. package/examples/js/view/requests/components/fileDownloadRequest/DownloadFileRequest.ts +0 -15
  140. package/examples/js/view/requests/components/fileDownloadRequest/FileDownloadRequest.vue +0 -44
  141. package/examples/js/view/requests/components/getRequestWithDynamicParams/GetProductsRequest.ts +0 -34
  142. package/examples/js/view/requests/components/getRequestWithDynamicParams/GetRequestWithDynamicParams.vue +0 -59
  143. package/examples/js/view/requests/components/serverErrorRequest/ServerErrorRequest.ts +0 -21
  144. package/examples/js/view/requests/components/serverErrorRequest/ServerErrorRequest.vue +0 -53
  145. package/src/service/laravel/pagination/contracts/PaginationParamsContract.ts +0 -4
  146. package/src/service/laravel/pagination/dataDrivers/RequestDriver.ts +0 -32
  147. package/src/service/laravel/pagination/index.ts +0 -7
  148. package/src/service/pagination/BasePaginator.ts +0 -36
  149. package/src/service/pagination/Paginator.ts +0 -11
  150. package/src/service/requests/ErrorHandler.ts +0 -64
  151. package/src/service/requests/exceptions/index.ts +0 -19
  152. package/src/service/requests/factories/FormDataFactory.ts +0 -9
  153. package/src/service/support/index.ts +0 -3
  154. /package/src/{service/bulkRequests → bulkRequests}/BulkRequestEvent.enum.ts +0 -0
  155. /package/src/{service/bulkRequests → bulkRequests}/index.ts +0 -0
  156. /package/src/{service/laravel → laravel}/pagination/contracts/PaginationResponseBodyContract.ts +0 -0
  157. /package/src/{service/laravel → laravel}/requests/JsonBaseRequest.ts +0 -0
  158. /package/src/{service/laravel → laravel}/requests/PaginationJsonBaseRequest.ts +0 -0
  159. /package/src/{service/laravel → laravel}/requests/index.ts +0 -0
  160. /package/src/{service/laravel → laravel}/requests/responses/JsonResponse.ts +0 -0
  161. /package/src/{service/laravel → laravel}/requests/responses/PaginationResponse.ts +0 -0
  162. /package/src/{service/pagination → pagination}/contracts/BaseViewDriverContract.ts +0 -0
  163. /package/src/{service/pagination → pagination}/contracts/BaseViewDriverFactoryContract.ts +0 -0
  164. /package/src/{service/pagination → pagination}/contracts/PaginateableRequestContract.ts +0 -0
  165. /package/src/{service/pagination → pagination}/contracts/PaginationDataDriverContract.ts +0 -0
  166. /package/src/{service/pagination → pagination}/contracts/PaginationResponseContract.ts +0 -0
  167. /package/src/{service/pagination → pagination}/contracts/PaginatorLoadDataOptions.ts +0 -0
  168. /package/src/{service/pagination → pagination}/contracts/StatePaginationDataDriverContract.ts +0 -0
  169. /package/src/{service/pagination → pagination}/contracts/ViewDriverContract.ts +0 -0
  170. /package/src/{service/pagination → pagination}/contracts/ViewDriverFactoryContract.ts +0 -0
  171. /package/src/{service/pagination → pagination}/dataDrivers/ArrayDriver.ts +0 -0
  172. /package/src/{service/pagination → pagination}/dtos/PaginationDataDto.ts +0 -0
  173. /package/src/{service/pagination → pagination}/dtos/StatePaginationDataDto.ts +0 -0
  174. /package/src/{service/pagination → pagination}/factories/VueBaseViewDriverFactory.ts +0 -0
  175. /package/src/{service/pagination → pagination}/factories/VuePaginationDriverFactory.ts +0 -0
  176. /package/src/{service/pagination → pagination}/frontendDrivers/VueBaseViewDriver.ts +0 -0
  177. /package/src/{service/pagination → pagination}/frontendDrivers/VuePaginationDriver.ts +0 -0
  178. /package/src/{service/persistenceDrivers → persistenceDrivers}/LocalStorageDriver.ts +0 -0
  179. /package/src/{service/persistenceDrivers → persistenceDrivers}/NonPersistentDriver.ts +0 -0
  180. /package/src/{service/persistenceDrivers → persistenceDrivers}/SessionStorageDriver.ts +0 -0
  181. /package/src/{service/persistenceDrivers → persistenceDrivers}/index.ts +0 -0
  182. /package/src/{service/persistenceDrivers → persistenceDrivers}/types/PersistenceDriver.ts +0 -0
  183. /package/src/{service/requests → requests}/RequestEvents.enum.ts +0 -0
  184. /package/src/{service/requests → requests}/RequestMethod.enum.ts +0 -0
  185. /package/src/{service/requests → requests}/bodies/JsonBody.ts +0 -0
  186. /package/src/{service/requests → requests}/contracts/AbortableRequestContract.ts +0 -0
  187. /package/src/{service/requests → requests}/contracts/BodyContract.ts +0 -0
  188. /package/src/{service/requests → requests}/contracts/BodyFactoryContract.ts +0 -0
  189. /package/src/{service/requests → requests}/contracts/DriverConfigContract.ts +0 -0
  190. /package/src/{service/requests → requests}/contracts/HeadersContract.ts +0 -0
  191. /package/src/{service/requests → requests}/contracts/RequestDriverContract.ts +0 -0
  192. /package/src/{service/requests → requests}/contracts/RequestLoaderContract.ts +0 -0
  193. /package/src/{service/requests → requests}/contracts/RequestLoaderFactoryContract.ts +0 -0
  194. /package/src/{service/requests → requests}/contracts/ResponseContract.ts +0 -0
  195. /package/src/{service/requests → requests}/drivers/contracts/ResponseHandlerContract.ts +0 -0
  196. /package/src/{service/requests → requests}/drivers/fetch/FetchDriver.ts +0 -0
  197. /package/src/{service/requests → requests}/drivers/fetch/FetchResponse.ts +0 -0
  198. /package/src/{service/requests → requests}/exceptions/NoResponseReceivedException.ts +0 -0
  199. /package/src/{service/requests → requests}/exceptions/NotFoundException.ts +0 -0
  200. /package/src/{service/requests → requests}/exceptions/PageExpiredException.ts +0 -0
  201. /package/src/{service/requests → requests}/exceptions/ResponseBodyException.ts +0 -0
  202. /package/src/{service/requests → requests}/exceptions/ResponseException.ts +0 -0
  203. /package/src/{service/requests → requests}/exceptions/ServerErrorException.ts +0 -0
  204. /package/src/{service/requests → requests}/exceptions/UnauthorizedException.ts +0 -0
  205. /package/src/{service/requests → requests}/exceptions/ValidationException.ts +0 -0
  206. /package/src/{service/requests → requests}/factories/JsonBodyFactory.ts +0 -0
  207. /package/src/{service/requests → requests}/responses/BaseResponse.ts +0 -0
  208. /package/src/{service/requests → requests}/responses/BlobResponse.ts +0 -0
  209. /package/src/{service/requests → requests}/responses/JsonResponse.ts +0 -0
  210. /package/src/{service/requests → requests}/responses/PlainTextResponse.ts +0 -0
  211. /package/src/{helpers.ts → support/helpers.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,97 @@
1
+ ## v4.0.0-beta.10 - 2026-02-28 (beta)
2
+
3
+ # [4.0.0-beta.10](/compare/v4.0.0-beta.9...v4.0.0-beta.10) (2026-02-28)
4
+
5
+
6
+ ### Features
7
+
8
+ * **pagination:** support local row removal without reload 3a66689
9
+ ## v4.0.0-beta.9 - 2026-02-28 (beta)
10
+
11
+ # [4.0.0-beta.9](/compare/v4.0.0-beta.8...v4.0.0-beta.9) (2026-02-28)
12
+ ## v4.0.0-beta.8 - 2026-02-28 (beta)
13
+
14
+ # [4.0.0-beta.8](/compare/v4.0.0-beta.7...v4.0.0-beta.8) (2026-02-28)
15
+
16
+
17
+ ### Features
18
+
19
+ * **requests:** add concurrency policy, stale-response handling, and docs 5feb49d
20
+ ## v4.0.0-beta.7 - 2026-02-27 (beta)
21
+
22
+ # [4.0.0-beta.7](/compare/v4.0.0-beta.6...v4.0.0-beta.7) (2026-02-27)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * Make cause public in InvalidJsonException 3aab192
28
+ ## v4.0.0-beta.6 - 2026-02-27 (beta)
29
+
30
+ # [4.0.0-beta.6](/compare/v4.0.0-beta.5...v4.0.0-beta.6) (2026-02-27)
31
+
32
+
33
+ ### Bug Fixes
34
+
35
+ * bind BaseForm getters to preserve this 5e44296
36
+ * Type propertyAwareToRaw properly 1fe2f28
37
+
38
+
39
+ ### Features
40
+
41
+ * Make state protected readonly in BaseForm e6e2f81
42
+ * Removed deprecated Paginator alias 7f07617
43
+ ## v4.0.0-beta.5 - 2026-02-27 (beta)
44
+
45
+ # [4.0.0-beta.5](/compare/v4.0.0-beta.4...v4.0.0-beta.5) (2026-02-27)
46
+
47
+
48
+ ### Bug Fixes
49
+
50
+ * satisfy paginator updater typing and type-only import in VueRequestLoaderFactory 6468368
51
+ ## v4.0.0-beta.4 - 2026-02-26 (beta)
52
+
53
+ # [4.0.0-beta.4](/compare/v4.0.0-beta.3...v4.0.0-beta.4) (2026-02-26)
54
+
55
+
56
+ ### Bug Fixes
57
+
58
+ * Use WritableComputedRef for field models 3cdb7dc
59
+ ## v4.0.0-beta.3 - 2026-02-26 (beta)
60
+
61
+ # [4.0.0-beta.3](/compare/v4.0.0-beta.2...v4.0.0-beta.3) (2026-02-26)
62
+
63
+
64
+ ### Bug Fixes
65
+
66
+ * Make PropertyAwareArray nominal to avoid array type confusion b68b6fe
67
+ ## v4.0.0-beta.2 - 2026-02-26 (beta)
68
+
69
+ # [4.0.0-beta.2](/compare/v4.0.0-beta.1...v4.0.0-beta.2) (2026-02-26)
70
+
71
+
72
+ ### Bug Fixes
73
+
74
+ * Loosen typeing in FormDataFactory.ts fed4475
75
+ ## v4.0.0-beta.1 - 2026-02-26 (beta)
76
+
77
+ # [4.0.0-beta.1](/compare/v3.0.1...v4.0.0-beta.1) (2026-02-26)
78
+
79
+
80
+ ### Features
81
+
82
+ * Added abortBatch to VueRequestBatchLoader; Improved documentation for loading 9701045
83
+ * Added multiple exceptions; Improved request error handling docs a6e4559
84
+ * Improved BaseForm fdda88c
85
+ * Improved documentation for supprt and helpers; Moved helpers into support namespace f92edef
86
+ * Improved Laravel docs; Removed obsolte code 415273c
87
+ * Improved laravel documentation; Moved laravel code outside of service directory bb9a708
88
+ * Improved pagination docs; Refactored paginator ee1b901
89
+ * Improved state class ffe3b03
90
+ * Removed service namespace and moved core items directly under core namespace 3def966
91
+ * Updated docs and introduced minor changes 2d51524
92
+ ## v3.0.1 - 2026-02-21
93
+
94
+ ## [3.0.1](/compare/v3.0.0...v3.0.1) (2026-02-21)
1
95
  ## v3.0.0 - 2026-02-19
2
96
 
3
97
  # [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,108 @@ 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: 'Concurrency', link: '/services/requests/concurrency' },
29
+ { text: 'Aborting Requests', link: '/services/requests/abort-requests' },
30
+ { text: 'Events', link: '/services/requests/events' },
31
+ { text: 'Bulk Requests', link: '/services/requests/bulk-requests' },
32
+ { text: 'Error Handling', link: '/services/requests/error-handling' }
33
+ ]
34
+ },
35
+ {
36
+ text: 'Pagination',
37
+ items: [
38
+ { text: 'Overview', link: '/services/pagination/' },
39
+ { text: 'Page-Aware', link: '/services/pagination/page-aware' },
40
+ { text: 'Infinite Scroller', link: '/services/pagination/infinite-scroller' },
41
+ { text: 'State/Cursor', link: '/services/pagination/state-pagination' },
42
+ { text: 'Updating Rows', link: '/services/pagination/updating-rows' }
43
+ ]
44
+ },
45
+ {
46
+ text: 'Support',
26
47
  items: [
27
- { text: 'Laravel Requests', link: '/services/laravel/requests' },
28
- { text: 'Laravel Pagination', link: '/services/laravel/pagination' }
48
+ { text: 'Overview', link: '/services/support/' },
49
+ { text: 'Helpers', link: '/services/support/helpers' },
50
+ { text: 'DeferredPromise', link: '/services/support/deferred-promise' }
29
51
  ]
52
+ },
53
+ {
54
+ text: 'Persistence',
55
+ link: '/services/persistence/'
30
56
  }
31
57
  ]
32
58
  },
59
+ {
60
+ text: 'Laravel',
61
+ collapsed: false,
62
+ items: [
63
+ { text: 'Requests', link: '/laravel/requests' },
64
+ { text: 'Pagination', link: '/laravel/pagination' }
65
+ ]
66
+ },
33
67
  {
34
68
  text: 'Vue',
35
69
  collapsed: false,
36
70
  items: [
37
71
  { text: 'State', link: '/vue/state/' },
72
+ {
73
+ text: 'Composables',
74
+ items: [
75
+ { text: 'useConfirmDialog', link: '/vue/composables/use-confirm-dialog' },
76
+ { text: 'useGlobalCheckbox', link: '/vue/composables/use-global-checkbox' },
77
+ { text: 'useIsEmpty', link: '/vue/composables/use-is-empty' },
78
+ { text: 'useIsOpen', link: '/vue/composables/use-is-open' },
79
+ { text: 'useIsOpenFromVar', link: '/vue/composables/use-is-open-from-var' },
80
+ { text: 'useModelWrapper', link: '/vue/composables/use-model-wrapper' },
81
+ { text: 'useOnOpen', link: '/vue/composables/use-on-open' }
82
+ ]
83
+ },
38
84
  {
39
85
  text: 'Forms',
40
- link: '/vue/forms'
86
+ items: [
87
+ { text: 'Overview', link: '/vue/forms/' },
88
+ { text: 'State And Properties', link: '/vue/forms/state-and-properties' },
89
+ { text: 'Validation', link: '/vue/forms/validation' },
90
+ { text: 'Building Payloads', link: '/vue/forms/payloads' },
91
+ { text: 'Errors', link: '/vue/forms/errors' },
92
+ { text: 'Persistence', link: '/vue/forms/persistence' },
93
+ { text: 'Arrays', link: '/vue/forms/arrays' },
94
+ { text: 'Utilities', link: '/vue/forms/utilities' }
95
+ ]
41
96
  },
42
97
  {
43
98
  text: 'Requests',
44
99
  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' }
100
+ { text: 'Loading', link: '/vue/requests/loading' }
49
101
  ]
102
+ },
103
+ {
104
+ text: 'Router',
105
+ items: [{ text: 'Route Resource Binding', link: '/vue/router/route-resource-binding' }]
50
106
  }
51
107
  ]
52
- }
53
- /*{
54
- text: 'Helpers',
108
+ },
109
+ {
110
+ text: 'Upgrading',
55
111
  items: [
56
- { text: 'Utility Functions', link: '/helpers/' }
112
+ { text: 'v1 to v2', link: '/upgrading/v1-to-v2' },
113
+ { text: 'v2 to v3', link: '/upgrading/v2-to-v3' },
114
+ { text: 'v3 to v4', link: '/upgrading/v3-to-v4' }
57
115
  ]
58
- }*/
116
+ }
59
117
  ],
60
118
  nav: [
61
119
  { text: 'Home', link: '/' },
62
- { text: 'GitHub', link: 'https://github.com/Hank-IT/ui' }
120
+ { text: 'GitHub', link: 'https://github.com/Hank-IT/blueprint-ts-core' }
63
121
  ]
64
122
  }
65
- })
123
+ })
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` and `removeRows` are 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,20 @@
1
+ # Infinite Scroll
2
+
3
+ Use `InfiniteScroller` when you want to append pages to the existing list. It extends `PageAwarePaginator`, so all
4
+ page-aware features and helpers are available.
5
+
6
+ ```typescript
7
+ import { InfiniteScroller } from '@blueprint-ts/core/pagination'
8
+
9
+ const scroller = new InfiniteScroller(dataDriver, 1, 10)
10
+
11
+ await scroller.load()
12
+ await scroller.toNextPage()
13
+ ```
14
+
15
+ You can pass `{ flush: true }` to clear existing data before loading a page. In addition, `InfiniteScroller` supports
16
+ `{ replace: true }` to replace the current list instead of appending.
17
+
18
+ ## Scroll Detection Helper
19
+
20
+ See the Support Helpers docs for `isAtBottom` usage.
@@ -0,0 +1,51 @@
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
+ ## Concurrency
44
+
45
+ If the underlying request uses concurrency mode `LATEST` or `REPLACE_LATEST`, stale responses are ignored. In that case,
46
+ `load()` resolves with the current page data without updating the view, so older responses cannot overwrite newer ones.
47
+
48
+
49
+ ## Updating Rows
50
+
51
+ `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,52 @@
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
+ ```
37
+
38
+ ## Removing Rows
39
+
40
+ Use `removeRows` to delete items from the current page data without reloading. By default it also decrements `total`
41
+ by the number of removed rows. Set `adjustTotal: false` to skip that behavior.
42
+
43
+ ```typescript
44
+ // Remove a single item
45
+ const removed = paginator.removeRows((row) => row.id === targetId)
46
+
47
+ // Remove all drafts without adjusting total
48
+ const removedDrafts = paginator.removeRows(
49
+ (row) => row.status === 'draft',
50
+ { adjustTotal: false }
51
+ )
52
+ ```