@vuetify/v0 0.0.2 → 0.0.3
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/README.md +12 -13
- package/dist/browser/index.js +884 -808
- package/dist/components/index.d.ts +4 -4
- package/dist/components/index.js +5 -6
- package/dist/{components-Cc48kKWf.js → components-DVuB4lnH.js} +14 -187
- package/dist/composables/index.d.ts +4 -4
- package/dist/composables/index.js +6 -6
- package/dist/{composables-7Cbs2sdO.js → composables-yeVk-ULz.js} +368 -101
- package/dist/constants/index.d.ts +1 -1
- package/dist/constants/index.js +1 -1
- package/dist/factories/index.d.ts +2 -2
- package/dist/factories/index.js +2 -2
- package/dist/{factories-CPq2yMlr.js → factories-BEpawPUw.js} +32 -15
- package/dist/{globals--2b7sF4-.js → globals-DZvNEOB4.js} +1 -1
- package/dist/{index-BqrLvboW.d.ts → index-Ckt12ON6.d.ts} +38 -24
- package/dist/{index-BnsMFYhs.d.ts → index-D0L_ydyW.d.ts} +364 -375
- package/dist/{index-z_zwVNP8.d.ts → index-DVKeyWc5.d.ts} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +7 -7
- package/dist/transformers/index.js +1 -1
- package/dist/{transformers-BAeg3QJF.js → transformers-CWrxLIkw.js} +1 -1
- package/dist/{useTheme-DSYiiz0R.js → useTheme-DCXkw_kv.js} +153 -189
- package/package.json +12 -38
|
@@ -5,21 +5,35 @@ import { inject, provide } from "vue";
|
|
|
5
5
|
* A simple wrapper for tapping into a v0 namespace
|
|
6
6
|
* @param key The provided string or InjectionKey
|
|
7
7
|
* @template Z The type values for the context.
|
|
8
|
-
* @returns
|
|
8
|
+
* @returns The injected context
|
|
9
9
|
* @throws Error if namespace is not found.
|
|
10
10
|
*
|
|
11
11
|
* @see https://vuejs.org/api/composition-api-dependency-injection.html#inject
|
|
12
|
+
* @see https://0.vuetifyjs.com/composables/foundation/create-context
|
|
12
13
|
*/
|
|
13
14
|
function useContext(key) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const context = inject(key, void 0);
|
|
16
|
+
if (context === void 0) throw new Error(`Context "${String(key)}" not found. Ensure it's provided by an ancestor.`);
|
|
17
|
+
return context;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A simple wrapper for providing Vue context.
|
|
21
|
+
*
|
|
22
|
+
* @param key The provided string or InjectionKey
|
|
23
|
+
* @param context The context value to provide
|
|
24
|
+
* @param app Optional Vue app instance for global provide
|
|
25
|
+
* @returns The provided context
|
|
26
|
+
*
|
|
27
|
+
* @see https://vuejs.org/api/composition-api-dependency-injection.html#provide
|
|
28
|
+
* @see https://0.vuetifyjs.com/composables/foundation/create-context
|
|
29
|
+
*/
|
|
30
|
+
function provideContext(key, context, app) {
|
|
31
|
+
app?.provide(key, context) ?? provide(key, context);
|
|
32
|
+
return context;
|
|
19
33
|
}
|
|
20
34
|
/**
|
|
21
35
|
* A simple wrapper for Vues provide & inject systems
|
|
22
|
-
*
|
|
36
|
+
*
|
|
23
37
|
* @param key The provided string or InjectionKey
|
|
24
38
|
* @template Z The type values for the context.
|
|
25
39
|
* @returns A tuple containing provide/inject
|
|
@@ -27,12 +41,14 @@ function useContext(key) {
|
|
|
27
41
|
* @see https://vuejs.org/api/composition-api-dependency-injection.html#provide
|
|
28
42
|
* @see https://0.vuetifyjs.com/composables/foundation/create-context
|
|
29
43
|
*/
|
|
30
|
-
function createContext(
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
|
|
44
|
+
function createContext(_key) {
|
|
45
|
+
function _provideContext(context, app) {
|
|
46
|
+
return provideContext(_key, context, app);
|
|
47
|
+
}
|
|
48
|
+
function _useContext(key = _key) {
|
|
49
|
+
return useContext(key);
|
|
34
50
|
}
|
|
35
|
-
return [
|
|
51
|
+
return [_useContext, _provideContext];
|
|
36
52
|
}
|
|
37
53
|
|
|
38
54
|
//#endregion
|
|
@@ -42,6 +58,7 @@ function createContext(key) {
|
|
|
42
58
|
* @param options Configurable object with namespace and provide/setup methods
|
|
43
59
|
* @returns A Vue plugin object with install method that runs app w/ context
|
|
44
60
|
*
|
|
61
|
+
* @see https://vuejs.org/guide/reusability/plugins
|
|
45
62
|
* @see https://vuejs.org/api/application.html#app-runwithcontext
|
|
46
63
|
* @see https://0.vuetifyjs.com/factories/create-plugin
|
|
47
64
|
*/
|
|
@@ -67,13 +84,13 @@ function createPlugin(options) {
|
|
|
67
84
|
*
|
|
68
85
|
* @see https://0.vuetifyjs.com/composables/foundation/create-trinity
|
|
69
86
|
*/
|
|
70
|
-
function createTrinity(createContext$1, provideContext, context) {
|
|
87
|
+
function createTrinity(createContext$1, provideContext$1, context) {
|
|
71
88
|
return [
|
|
72
89
|
createContext$1,
|
|
73
|
-
(_context = context, app) => provideContext(_context, app),
|
|
90
|
+
(_context = context, app) => provideContext$1(_context, app),
|
|
74
91
|
context
|
|
75
92
|
];
|
|
76
93
|
}
|
|
77
94
|
|
|
78
95
|
//#endregion
|
|
79
|
-
export { createContext, createPlugin, createTrinity, useContext };
|
|
96
|
+
export { createContext, createPlugin, createTrinity, provideContext, useContext };
|
|
@@ -5,7 +5,7 @@ const SUPPORTS_MATCH_MEDIA = IN_BROWSER && "matchMedia" in window && typeof wind
|
|
|
5
5
|
const SUPPORTS_OBSERVER = IN_BROWSER && "ResizeObserver" in window;
|
|
6
6
|
const SUPPORTS_INTERSECTION_OBSERVER = IN_BROWSER && "IntersectionObserver" in window;
|
|
7
7
|
const SUPPORTS_MUTATION_OBSERVER = IN_BROWSER && "MutationObserver" in window;
|
|
8
|
-
const version = "0.0.
|
|
8
|
+
const version = "0.0.3";
|
|
9
9
|
const __LOGGER_ENABLED__ = process.env.NODE_ENV !== "production" || process.env.VITE_LOGGER_ENABLED === "true";
|
|
10
10
|
|
|
11
11
|
//#endregion
|
|
@@ -1,39 +1,33 @@
|
|
|
1
1
|
import { App, InjectionKey } from "vue";
|
|
2
2
|
|
|
3
|
-
//#region src/factories/createPlugin/index.d.ts
|
|
4
|
-
interface PluginOptions {
|
|
5
|
-
namespace: string;
|
|
6
|
-
provide: (app: App) => void;
|
|
7
|
-
setup?: (app: App) => void;
|
|
8
|
-
}
|
|
9
|
-
interface Plugin {
|
|
10
|
-
install: (app: App, ...options: any[]) => void;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* A universal plugin factory to reduce boilerplate code for Vue plugin creation
|
|
14
|
-
* @param options Configurable object with namespace and provide/setup methods
|
|
15
|
-
* @returns A Vue plugin object with install method that runs app w/ context
|
|
16
|
-
*
|
|
17
|
-
* @see https://vuejs.org/api/application.html#app-runwithcontext
|
|
18
|
-
* @see https://0.vuetifyjs.com/factories/create-plugin
|
|
19
|
-
*/
|
|
20
|
-
declare function createPlugin<Z extends Plugin = Plugin>(options: PluginOptions): Z;
|
|
21
|
-
//#endregion
|
|
22
3
|
//#region src/factories/createContext/index.d.ts
|
|
23
4
|
type ContextKey<Z> = InjectionKey<Z> | string;
|
|
24
5
|
/**
|
|
25
6
|
* A simple wrapper for tapping into a v0 namespace
|
|
26
7
|
* @param key The provided string or InjectionKey
|
|
27
8
|
* @template Z The type values for the context.
|
|
28
|
-
* @returns
|
|
9
|
+
* @returns The injected context
|
|
29
10
|
* @throws Error if namespace is not found.
|
|
30
11
|
*
|
|
31
12
|
* @see https://vuejs.org/api/composition-api-dependency-injection.html#inject
|
|
13
|
+
* @see https://0.vuetifyjs.com/composables/foundation/create-context
|
|
32
14
|
*/
|
|
33
|
-
declare function useContext<Z>(key: ContextKey<Z>): (
|
|
15
|
+
declare function useContext<Z>(key: ContextKey<Z>): Z & ({} | null);
|
|
16
|
+
/**
|
|
17
|
+
* A simple wrapper for providing Vue context.
|
|
18
|
+
*
|
|
19
|
+
* @param key The provided string or InjectionKey
|
|
20
|
+
* @param context The context value to provide
|
|
21
|
+
* @param app Optional Vue app instance for global provide
|
|
22
|
+
* @returns The provided context
|
|
23
|
+
*
|
|
24
|
+
* @see https://vuejs.org/api/composition-api-dependency-injection.html#provide
|
|
25
|
+
* @see https://0.vuetifyjs.com/composables/foundation/create-context
|
|
26
|
+
*/
|
|
27
|
+
declare function provideContext<Z>(key: ContextKey<Z>, context: Z, app?: App): Z;
|
|
34
28
|
/**
|
|
35
29
|
* A simple wrapper for Vues provide & inject systems
|
|
36
|
-
*
|
|
30
|
+
*
|
|
37
31
|
* @param key The provided string or InjectionKey
|
|
38
32
|
* @template Z The type values for the context.
|
|
39
33
|
* @returns A tuple containing provide/inject
|
|
@@ -41,7 +35,27 @@ declare function useContext<Z>(key: ContextKey<Z>): (namespace?: string) => Z;
|
|
|
41
35
|
* @see https://vuejs.org/api/composition-api-dependency-injection.html#provide
|
|
42
36
|
* @see https://0.vuetifyjs.com/composables/foundation/create-context
|
|
43
37
|
*/
|
|
44
|
-
declare function createContext<Z>(
|
|
38
|
+
declare function createContext<Z>(_key: ContextKey<Z>): readonly [(key?: ContextKey<Z>) => Z & ({} | null), (context: Z, app?: App) => Z];
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/factories/createPlugin/index.d.ts
|
|
41
|
+
interface PluginOptions {
|
|
42
|
+
namespace: string;
|
|
43
|
+
provide: (app: App) => void;
|
|
44
|
+
setup?: (app: App) => void;
|
|
45
|
+
}
|
|
46
|
+
interface Plugin {
|
|
47
|
+
install: (app: App, ...options: any[]) => void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A universal plugin factory to reduce boilerplate code for Vue plugin creation
|
|
51
|
+
* @param options Configurable object with namespace and provide/setup methods
|
|
52
|
+
* @returns A Vue plugin object with install method that runs app w/ context
|
|
53
|
+
*
|
|
54
|
+
* @see https://vuejs.org/guide/reusability/plugins
|
|
55
|
+
* @see https://vuejs.org/api/application.html#app-runwithcontext
|
|
56
|
+
* @see https://0.vuetifyjs.com/factories/create-plugin
|
|
57
|
+
*/
|
|
58
|
+
declare function createPlugin<Z extends Plugin = Plugin>(options: PluginOptions): Z;
|
|
45
59
|
//#endregion
|
|
46
60
|
//#region src/factories/createTrinity/index.d.ts
|
|
47
61
|
type ContextTrinity<Z = unknown> = readonly [() => Z, (context?: Z, app?: App) => Z, Z];
|
|
@@ -58,4 +72,4 @@ type ContextTrinity<Z = unknown> = readonly [() => Z, (context?: Z, app?: App) =
|
|
|
58
72
|
*/
|
|
59
73
|
declare function createTrinity<Z = unknown>(createContext: () => Z, provideContext: (_context?: Z, app?: App) => Z, context: Z): ContextTrinity<Z>;
|
|
60
74
|
//#endregion
|
|
61
|
-
export { ContextKey, ContextTrinity, Plugin, PluginOptions, createContext, createPlugin, createTrinity, useContext };
|
|
75
|
+
export { ContextKey, ContextTrinity, Plugin, PluginOptions, createContext, createPlugin, createTrinity, provideContext, useContext };
|