@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
- async install(app, options) {
5
- const { themeState } = await setupTheme(options);
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 { ThemePreset, ThemeState } from '../types';
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
- * Synchronous when a preset object is provided directly.
24
- * Asynchronous when a preset name (string) needs to be resolved.
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,EAAE,WAAW,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;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE,GAAG,gBAAgB,CAAA;AAClG,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA"}
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 == "object" || config.strategy === "buildtime" ? finalizeTheme(themeState, config.preset, config) : getPreset(config.preset).then((preset) => finalizeTheme(themeState, preset, config));
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@maz-ui/themes",
3
3
  "type": "module",
4
- "version": "4.7.0",
4
+ "version": "4.7.1",
5
5
  "description": "Theme system for Maz-UI with TypeScript support and CSS variables",
6
6
  "author": "Louis Mazel <me@loicmazuel.com>",
7
7
  "license": "MIT",