@maz-ui/themes 4.7.0 → 4.7.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.
package/dist/plugin.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { setupTheme } from "./utils/setup-theme.js";
|
|
2
2
|
import { injectThemeState } from "./utils/inject.js";
|
|
3
3
|
const MazUiTheme = {
|
|
4
|
-
|
|
5
|
-
const { themeState } =
|
|
4
|
+
install(app, options) {
|
|
5
|
+
const { themeState } = setupTheme(options);
|
|
6
6
|
injectThemeState({ app, themeState });
|
|
7
7
|
}
|
|
8
8
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ref } from 'vue';
|
|
2
2
|
import { MazUiThemeOptions } from '../plugin';
|
|
3
|
-
import {
|
|
3
|
+
import { ThemeState } from '../types';
|
|
4
4
|
export declare const defaultOptions: {
|
|
5
5
|
strategy: "hybrid";
|
|
6
6
|
overrides: {};
|
|
@@ -20,11 +20,9 @@ export interface SetupThemeReturn {
|
|
|
20
20
|
* Sets up the theme state, CSS injection, and watchers without binding to a Vue app.
|
|
21
21
|
* The caller is responsible for calling `app.provide()` and setting `app.config.globalProperties`.
|
|
22
22
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
23
|
+
* Always returns synchronously with a populated themeState ref.
|
|
24
|
+
* When no preset object is provided, the default preset is resolved asynchronously
|
|
25
|
+
* in the background and the themeState is updated reactively (causes FOUC).
|
|
25
26
|
*/
|
|
26
|
-
export declare function setupTheme(options: MazUiThemeOptions
|
|
27
|
-
preset: ThemePreset;
|
|
28
|
-
}): SetupThemeReturn;
|
|
29
|
-
export declare function setupTheme(options: MazUiThemeOptions): Promise<SetupThemeReturn>;
|
|
27
|
+
export declare function setupTheme(options: MazUiThemeOptions): SetupThemeReturn;
|
|
30
28
|
//# sourceMappingURL=setup-theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-theme.d.ts","sourceRoot":"","sources":["../../src/utils/setup-theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"setup-theme.d.ts","sourceRoot":"","sources":["../../src/utils/setup-theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,UAAU,CAAA;AAqEvD,eAAO,MAAM,cAAc;;;;;;;;;;CAUgE,CAAA;AAE3F,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,CAAA;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAkED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,CAWvE"}
|
|
@@ -127,7 +127,8 @@ function finalizeTheme(themeState, preset, config) {
|
|
|
127
127
|
}
|
|
128
128
|
function setupTheme(options) {
|
|
129
129
|
const config = resolveConfig(options), themeState = createThemeState(options, config);
|
|
130
|
-
return typeof config.preset
|
|
130
|
+
return config.preset && typeof config.preset != "string" || config.strategy === "buildtime" ? finalizeTheme(themeState, config.preset, config) : (getPreset(config.preset).then((preset) => finalizeTheme(themeState, preset, config)), { themeState, cleanup: () => {
|
|
131
|
+
} });
|
|
131
132
|
}
|
|
132
133
|
export {
|
|
133
134
|
defaultOptions,
|
package/package.json
CHANGED