@hybridly/vue 0.1.0-alpha.7 → 0.1.0-alpha.8
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/dist/index.cjs +2 -3
- package/dist/index.d.ts +2 -4
- package/dist/index.mjs +2 -3
- package/package.json +6 -5
package/dist/index.cjs
CHANGED
|
@@ -8,6 +8,7 @@ const utils = require('@hybridly/utils');
|
|
|
8
8
|
const progressPlugin = require('@hybridly/progress-plugin');
|
|
9
9
|
const devtoolsApi = require('@vue/devtools-api');
|
|
10
10
|
const qs = require('qs');
|
|
11
|
+
const dotDiver = require('@clickbar/dot-diver');
|
|
11
12
|
const isEqual = require('lodash.isequal');
|
|
12
13
|
const hybridly = require('hybridly');
|
|
13
14
|
|
|
@@ -526,9 +527,7 @@ function useProperties() {
|
|
|
526
527
|
return vue.readonly(toReactive(vue.computed(() => state.context.value?.view.properties)));
|
|
527
528
|
}
|
|
528
529
|
function useProperty(path) {
|
|
529
|
-
return vue.computed(() =>
|
|
530
|
-
return path.split(".").reduce((o, i) => o?.[i], state.context.value?.view.properties);
|
|
531
|
-
});
|
|
530
|
+
return vue.computed(() => dotDiver.getByPath(state.context.value?.view.properties, path));
|
|
532
531
|
}
|
|
533
532
|
|
|
534
533
|
function useContext() {
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { HybridlyConfig } from '@hybridly/config';
|
|
|
8
8
|
import { ProgressOptions } from '@hybridly/progress-plugin';
|
|
9
9
|
import * as _vue_shared from '@vue/shared';
|
|
10
10
|
import { RequestData } from '@hybridly/utils';
|
|
11
|
+
import { SearchableObject, Path, PathValue } from '@clickbar/dot-diver';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Initializes Hybridly's router and context.
|
|
@@ -182,10 +183,7 @@ declare const RouterLink: vue.DefineComponent<{
|
|
|
182
183
|
/** Accesses all current properties. */
|
|
183
184
|
declare function useProperties<T extends object, Global extends GlobalHybridlyProperties>(): vue.DeepReadonly<vue.UnwrapNestedRefs<T & Global>>;
|
|
184
185
|
/** Accesses a property with a dot notation. */
|
|
185
|
-
declare function useProperty<
|
|
186
|
-
type PathImpl<T, K extends keyof T> = K extends string ? T[K] extends undefined ? undefined : NonNullable<T[K]> extends Record<string, any> ? NonNullable<T[K]> extends ArrayLike<any> ? K | `${K}.${PathImpl<NonNullable<T[K]>, Exclude<keyof NonNullable<T[K]>, keyof any[]>>}` : K | `${K}.${PathImpl<NonNullable<T[K]>, keyof NonNullable<T[K]>>}` : K : never;
|
|
187
|
-
type Path<T> = PathImpl<T, keyof T> | keyof T;
|
|
188
|
-
type PathValue<T, P extends Path<T>> = P extends `${infer K}.${infer Rest}` ? K extends keyof T ? T[K] extends undefined ? undefined : Rest extends Path<T[K]> ? PathValue<T[K], Rest> : Rest extends Path<NonNullable<T[K]>> ? PathValue<NonNullable<T[K]>, Rest> | undefined : never : never : P extends keyof T ? T[P] extends undefined ? undefined : T[P] : never;
|
|
186
|
+
declare function useProperty<T extends SearchableObject = GlobalHybridlyProperties, P extends Path<T> & string = Path<T> & string>(path: P): ComputedRef<PathValue<T, P>>;
|
|
189
187
|
|
|
190
188
|
type UrlResolvable = string | URL | Location;
|
|
191
189
|
type UrlTransformable = BaseUrlTransformable | ((string: URL) => BaseUrlTransformable);
|
package/dist/index.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import { debug, random, showDomainsDisabledErrorModal, showPageComponentErrorMod
|
|
|
5
5
|
import { progress } from '@hybridly/progress-plugin';
|
|
6
6
|
import { setupDevtoolsPlugin } from '@vue/devtools-api';
|
|
7
7
|
import qs from 'qs';
|
|
8
|
+
import { getByPath } from '@clickbar/dot-diver';
|
|
8
9
|
import isEqual from 'lodash.isequal';
|
|
9
10
|
import { router as router$1 } from 'hybridly';
|
|
10
11
|
|
|
@@ -518,9 +519,7 @@ function useProperties() {
|
|
|
518
519
|
return readonly(toReactive(computed(() => state.context.value?.view.properties)));
|
|
519
520
|
}
|
|
520
521
|
function useProperty(path) {
|
|
521
|
-
return computed(() =>
|
|
522
|
-
return path.split(".").reduce((o, i) => o?.[i], state.context.value?.view.properties);
|
|
523
|
-
});
|
|
522
|
+
return computed(() => getByPath(state.context.value?.view.properties, path));
|
|
524
523
|
}
|
|
525
524
|
|
|
526
525
|
function useContext() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hybridly/vue",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.8",
|
|
4
4
|
"description": "Vue adapter for Hybridly",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hybridly",
|
|
@@ -43,12 +43,13 @@
|
|
|
43
43
|
"lodash.isequal": "^4.5.0",
|
|
44
44
|
"nprogress": "^0.2.0",
|
|
45
45
|
"qs": "^6.11.1",
|
|
46
|
-
"@hybridly/config": "0.1.0-alpha.
|
|
47
|
-
"@hybridly/core": "0.1.0-alpha.
|
|
48
|
-
"@hybridly/progress-plugin": "0.1.0-alpha.
|
|
49
|
-
"@hybridly/utils": "0.1.0-alpha.
|
|
46
|
+
"@hybridly/config": "0.1.0-alpha.8",
|
|
47
|
+
"@hybridly/core": "0.1.0-alpha.8",
|
|
48
|
+
"@hybridly/progress-plugin": "0.1.0-alpha.8",
|
|
49
|
+
"@hybridly/utils": "0.1.0-alpha.8"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
+
"@clickbar/dot-diver": "^1.0.1",
|
|
52
53
|
"@types/lodash": "^4.14.191",
|
|
53
54
|
"@types/lodash.clonedeep": "^4.5.7",
|
|
54
55
|
"@types/lodash.isequal": "^4.5.6",
|