@blueprint-ts/core 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +65 -0
- package/docs/.vitepress/config.ts +7 -10
- package/package.json +2 -2
- package/src/vue/router/{routeModelBinding/RouteModelRequestResolver.ts → routeResourceBinding/RouteResourceRequestResolver.ts} +1 -1
- package/src/vue/router/{routeModelBinding → routeResourceBinding}/index.ts +4 -2
- package/src/vue/router/{routeModelBinding → routeResourceBinding}/installRouteInjection.ts +30 -12
- package/src/vue/router/{routeModelBinding → routeResourceBinding}/types.ts +3 -1
- package/src/vue/router/routeResourceBinding/useRouteResource.ts +14 -0
- /package/docs/vue/requests/{route-model-binding.md → route-resource-binding.md} +0 -0
- /package/src/vue/router/{routeModelBinding → routeResourceBinding}/defineRoute.ts +0 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
## v1.1.0 - 2026-01-07
|
|
2
|
+
|
|
3
|
+
# 1.1.0 (2026-01-07)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* Added BulkRequestExecutionMode enum to export a284ac8
|
|
9
|
+
* Added missing exports c90cc0b
|
|
10
|
+
* Added missing exports for types 8de86cb
|
|
11
|
+
* Added persistence enhancements and dynamic suffix support. Fix: Improved typing 614cd9d
|
|
12
|
+
* Adjust access token var name in publishing script 81efc7b
|
|
13
|
+
* Fix imports in persistenceDrivers 5ee838e
|
|
14
|
+
* Fix paths for state b5af348
|
|
15
|
+
* Fix typescript errors in state class b7c6809
|
|
16
|
+
* Import BaseRequestContract as type c639617
|
|
17
|
+
* Make BaseForm accept different types in RequestBody and FormBody 227d0e8
|
|
18
|
+
* Make request methods uppercase fac7c07
|
|
19
|
+
* Prevent subscriptions from being triggered multiple times by the same event 890d9db
|
|
20
|
+
* Recreate AbortController before sending requests 876c4e3
|
|
21
|
+
* Rename appends to append; chore: Lower type constraints for FormBody; chore: Bump up version to 2.7.1 d37e7f5
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* Added BaseForm and Array Pagination Driver def6b52
|
|
27
|
+
* Added batch loader e6a8ebb
|
|
28
|
+
* Added bulk requests feature df2055f
|
|
29
|
+
* Added checked ref to useGlobalCheckbox composable ddcceee
|
|
30
|
+
* Added ci scripts 89e8417
|
|
31
|
+
* Added DeferredPromise; feat: Added supports export ba9a1c3
|
|
32
|
+
* Added getBody method f1e7dc3
|
|
33
|
+
* Added getRequest() method to RequestDriver; feat: Added Access to dataDriver to Paginator; feat: Generate uuid per request; fix: Ensure request params arent mutated; chore: Added Tests for mergeDeep and ignore some typescript errors 8202db6
|
|
34
|
+
* Added helper for setting abort signal on request b2679c4
|
|
35
|
+
* Added initial loading state to vue request loader 6b34b82
|
|
36
|
+
* Added mode feature to BulkRequestSender; feat: Added retry feature to BulkRequestSender ea27dec
|
|
37
|
+
* Added off method to BulkRequestSender to clear event listeners 12593e3
|
|
38
|
+
* Added PropertyAwareArray class which enables the array to property conversion feature 5c23c89
|
|
39
|
+
* Added propertyAwareToRaw() helper; chore: Bump up version to 3.1.0 8a12a7e
|
|
40
|
+
* Added script for publishing docs c29d3a6
|
|
41
|
+
* Added sent state and removed semicolons 8d7b56c
|
|
42
|
+
* Added setRequests method to BulkRequestSender e377538
|
|
43
|
+
* Added some array helper methods to BaseForm 98cd03e
|
|
44
|
+
* Added State class; Added vitepress with documentation for forms and states 3f519ed
|
|
45
|
+
* Added sync value method 9ea03c1
|
|
46
|
+
* Added types for PropertyAwareArray; Bump up version to 3.2.0 137ba48
|
|
47
|
+
* Added useRouteResource composable with refresh method 60f5435
|
|
48
|
+
* Added validation to BaseForm ba5a342
|
|
49
|
+
* Added viewDriverFactory param (via options object) to paginator 63533d0
|
|
50
|
+
* Added vue route model binding feature fcf4330
|
|
51
|
+
* Allow form class to dynamically generate properties, ignore certain properties and remap errors to different fields ca65690
|
|
52
|
+
* Ignore some type errors 6f08557
|
|
53
|
+
* Improve docs building 5be5af0
|
|
54
|
+
* Improve global checkbox handling 30d2756
|
|
55
|
+
* Improve global checkbox handling 0bcf75d
|
|
56
|
+
* Improve state class 649963b
|
|
57
|
+
* Improved typing in bulk request feature edc6cc2
|
|
58
|
+
* Make PropertyAwareArray a subtype of array 9e2e05e
|
|
59
|
+
* Make VueRequestLoader track requests; fix: useIsOpenFromVar should always return a boolean as isOpenFromVar 5579aa1
|
|
60
|
+
* Move persistence drivers to own service and make them more generic dbe27a9
|
|
61
|
+
* Refactored composables cf86741
|
|
62
|
+
* Refactored library using typescript; Bump version to 2.0.0 ba17085
|
|
63
|
+
* Refactored loading feature 0f8163d
|
|
64
|
+
* Refactored PropertyAwareArray to inherit array; Adjustd BaseForm accordingly 1c85f2e
|
|
65
|
+
* Resolve callbacks in header object to string f7534bb
|
|
@@ -4,16 +4,13 @@ export default defineConfig({
|
|
|
4
4
|
title: '@hank-it/ui',
|
|
5
5
|
description: 'Documentation for the @hank-it/ui library',
|
|
6
6
|
|
|
7
|
-
base: process.env
|
|
7
|
+
base: process.env['DOCS_BASE'] || '/ui/latest/',
|
|
8
8
|
|
|
9
9
|
themeConfig: {
|
|
10
|
-
|
|
11
10
|
sidebar: [
|
|
12
11
|
{
|
|
13
12
|
text: 'Introduction',
|
|
14
|
-
items: [
|
|
15
|
-
{ text: 'Getting Started', link: '/' },
|
|
16
|
-
]
|
|
13
|
+
items: [{ text: 'Getting Started', link: '/' }]
|
|
17
14
|
},
|
|
18
15
|
{
|
|
19
16
|
text: 'Services',
|
|
@@ -30,7 +27,7 @@ export default defineConfig({
|
|
|
30
27
|
{ text: 'Laravel Requests', link: '/services/laravel/requests' },
|
|
31
28
|
{ text: 'Laravel Pagination', link: '/services/laravel/pagination' }
|
|
32
29
|
]
|
|
33
|
-
}
|
|
30
|
+
}
|
|
34
31
|
]
|
|
35
32
|
},
|
|
36
33
|
{
|
|
@@ -40,7 +37,7 @@ export default defineConfig({
|
|
|
40
37
|
{ text: 'State', link: '/vue/state/' },
|
|
41
38
|
{
|
|
42
39
|
text: 'Forms',
|
|
43
|
-
link: '/vue/forms'
|
|
40
|
+
link: '/vue/forms'
|
|
44
41
|
},
|
|
45
42
|
{
|
|
46
43
|
text: 'Requests',
|
|
@@ -48,11 +45,11 @@ export default defineConfig({
|
|
|
48
45
|
/*{ text: 'Usage with Composition API', link: '/vue/requests/composition' },
|
|
49
46
|
{ text: 'Loading States', link: '/vue/requests/loading' },
|
|
50
47
|
{ text: 'Error Handling', link: '/vue/requests/errors' },*/
|
|
51
|
-
{ text: 'Route
|
|
48
|
+
{ text: 'Route Resource Binding', link: '/vue/requests/route-resource-binding' }
|
|
52
49
|
]
|
|
53
50
|
}
|
|
54
51
|
]
|
|
55
|
-
}
|
|
52
|
+
}
|
|
56
53
|
/*{
|
|
57
54
|
text: 'Helpers',
|
|
58
55
|
items: [
|
|
@@ -64,5 +61,5 @@ export default defineConfig({
|
|
|
64
61
|
{ text: 'Home', link: '/' },
|
|
65
62
|
{ text: 'GitHub', link: 'https://github.com/Hank-IT/ui' }
|
|
66
63
|
]
|
|
67
|
-
}
|
|
64
|
+
}
|
|
68
65
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blueprint-ts/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"./vue/forms": "./src/vue/forms/index.ts",
|
|
21
21
|
"./vue/forms/validation": "./src/vue/forms/validation/index.ts",
|
|
22
22
|
"./vue/requests": "./src/vue/requests/index.ts",
|
|
23
|
-
"./vue/router/
|
|
23
|
+
"./vue/router/routeResourceBinding": "./src/vue/router/routeResourceBinding/index.ts",
|
|
24
24
|
"./vue/state": "./src/vue/state/index.ts"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type DataRequest, type Resolver } from './types'
|
|
2
2
|
|
|
3
|
-
export class
|
|
3
|
+
export class RouteResourceRequestResolver<T> implements Resolver<T> {
|
|
4
4
|
public constructor(private request: DataRequest<T>) {}
|
|
5
5
|
|
|
6
6
|
public async resolve(): Promise<T> {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { defineRoute } from './defineRoute'
|
|
2
2
|
import { installRouteInjection } from './installRouteInjection'
|
|
3
|
-
import {
|
|
3
|
+
import { RouteResourceRequestResolver } from './RouteResourceRequestResolver'
|
|
4
|
+
import { useRouteResource } from './useRouteResource'
|
|
5
|
+
|
|
4
6
|
import type { DataRequest, InjectConfig, Resolver } from './types'
|
|
5
7
|
|
|
6
|
-
export { defineRoute, installRouteInjection,
|
|
8
|
+
export { defineRoute, installRouteInjection, RouteResourceRequestResolver, useRouteResource }
|
|
7
9
|
|
|
8
10
|
export type { DataRequest, InjectConfig, Resolver }
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Router } from 'vue-router'
|
|
2
|
+
import { reactive } from 'vue'
|
|
2
3
|
|
|
3
4
|
type InjectRuntimeConfig = {
|
|
4
5
|
from: string
|
|
@@ -20,7 +21,11 @@ export function installRouteInjection(router: Router) {
|
|
|
20
21
|
router.beforeResolve(async (to) => {
|
|
21
22
|
console.log('[Route Injection] Resolving route injections...')
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
if (!to.meta._injectedProps) {
|
|
25
|
+
to.meta._injectedProps = reactive({})
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const resolvers: Record<string, () => Promise<unknown>> = {}
|
|
24
29
|
|
|
25
30
|
// Iterate through all matched route records (from parent to child)
|
|
26
31
|
for (const record of to.matched) {
|
|
@@ -52,22 +57,35 @@ export function installRouteInjection(router: Router) {
|
|
|
52
57
|
continue
|
|
53
58
|
}
|
|
54
59
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
// Define the refresh logic for this specific prop
|
|
61
|
+
const resolveProp = async () => {
|
|
62
|
+
const resolver = cfg.resolve(paramValue)
|
|
63
|
+
let payload = await resolver.resolve()
|
|
64
|
+
if (typeof cfg.getter === 'function') {
|
|
65
|
+
payload = cfg.getter(payload)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Updating the reactive object triggers the component re-render
|
|
69
|
+
;(to.meta._injectedProps as any)[propName] = payload
|
|
70
|
+
return payload
|
|
61
71
|
}
|
|
62
72
|
|
|
63
|
-
|
|
73
|
+
resolvers[propName] = resolveProp
|
|
64
74
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
)
|
|
75
|
+
await resolveProp()
|
|
76
|
+
|
|
77
|
+
console.debug(`[Route Injection] Successfully resolved prop "${propName}" for route "${record.path}"`)
|
|
68
78
|
}
|
|
69
79
|
}
|
|
70
80
|
|
|
71
|
-
to
|
|
81
|
+
// Attach the resolvers and a global refresh helper to the route meta
|
|
82
|
+
to.meta['_injectedResolvers'] = resolvers
|
|
83
|
+
to.meta['refresh'] = async (propName: string) => {
|
|
84
|
+
if (resolvers[propName]) {
|
|
85
|
+
return await resolvers[propName]()
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
console.warn(`[Route Injection] No resolver found for "${propName}"`)
|
|
89
|
+
}
|
|
72
90
|
})
|
|
73
91
|
}
|
|
@@ -40,7 +40,9 @@ export type InjectConfig<Props extends Record<string, unknown>> = {
|
|
|
40
40
|
*/
|
|
41
41
|
declare module 'vue-router' {
|
|
42
42
|
interface RouteMeta {
|
|
43
|
-
_injectedProps?: Record<string,
|
|
43
|
+
_injectedProps?: Record<string, any>
|
|
44
|
+
_injectedResolvers?: Record<string, () => Promise<any>>
|
|
45
|
+
refresh?: (propName: string) => Promise<any>
|
|
44
46
|
inject?: Record<string, unknown>
|
|
45
47
|
}
|
|
46
48
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useRoute } from 'vue-router'
|
|
2
|
+
|
|
3
|
+
export function useRouteResource() {
|
|
4
|
+
const route = useRoute()
|
|
5
|
+
|
|
6
|
+
const refresh = async (propName: string) => {
|
|
7
|
+
return await route.meta.refresh?.(propName)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// If emit is passed, we can wrap it or just provide a helper
|
|
11
|
+
// to be used like: onRefresh('product', () => ...)
|
|
12
|
+
// but the most direct way for you is:
|
|
13
|
+
return { refresh }
|
|
14
|
+
}
|
|
File without changes
|
|
File without changes
|