@finema/core 3.27.0 → 3.27.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/module.d.mts CHANGED
@@ -19,8 +19,23 @@ declare const core: {
19
19
  messages: ICoreMessagesOverride;
20
20
  };
21
21
 
22
+ interface CoreColorModeOptions {
23
+ /** Initial mode. `system` follows the OS and the user can switch it. Default `system`. */
24
+ preference?: 'system' | 'light' | 'dark';
25
+ /** Mode used when the OS preference can't be detected. Default `light`. */
26
+ fallback?: 'light' | 'dark';
27
+ /** localStorage key that remembers the user's choice. */
28
+ storageKey?: string;
29
+ }
22
30
  interface ModuleOptions {
23
31
  prefix?: string;
32
+ /**
33
+ * Light/dark support. `false` (default) locks the app to light, as before.
34
+ * `true` or an options object enables colour mode (follows the OS, switchable in the app):
35
+ * `core: { colorMode: true }` or `core: { colorMode: { preference: 'dark' } }` in nuxt.config.
36
+ * The app supplies the dark values (the `.dark` class is set on <html>).
37
+ */
38
+ colorMode?: boolean | CoreColorModeOptions;
24
39
  }
25
40
  declare module '@nuxt/schema' {
26
41
  interface AppConfigInput {
@@ -30,4 +45,4 @@ declare module '@nuxt/schema' {
30
45
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
31
46
 
32
47
  export { _default as default };
33
- export type { ModuleOptions };
48
+ export type { CoreColorModeOptions, ModuleOptions };
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "3.27.0",
3
+ "version": "3.27.1",
4
4
  "configKey": "core",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.3",
package/dist/module.mjs CHANGED
@@ -4,7 +4,7 @@ import * as lodash from 'lodash-es';
4
4
  import * as theme from '../dist/runtime/theme/index.js';
5
5
 
6
6
  const name = "@finema/core";
7
- const version = "3.27.0";
7
+ const version = "3.27.1";
8
8
 
9
9
  const nuxtAppOptions = {
10
10
  head: {
@@ -92,7 +92,9 @@ const module$1 = defineNuxtModule({
92
92
  }
93
93
  }
94
94
  },
95
- defaults: {},
95
+ defaults: {
96
+ colorMode: false
97
+ },
96
98
  async setup(_options, _nuxt) {
97
99
  const { resolve } = createResolver(import.meta.url);
98
100
  const runtimeDir = resolve("./runtime");
@@ -106,7 +108,12 @@ const module$1 = defineNuxtModule({
106
108
  _nuxt.options.app = defu(nuxtAppOptions, _nuxt.options.app);
107
109
  _nuxt.options.runtimeConfig = defu(nuxtRunTimeConfigOptions, _nuxt.options.runtimeConfig);
108
110
  _nuxt.options.appConfig.core = defu(_nuxt.options.appConfig.core || {}, core);
109
- _nuxt.options.colorMode = {
111
+ const colorMode = _options.colorMode;
112
+ _nuxt.options.colorMode = colorMode ? {
113
+ preference: "system",
114
+ fallback: "light",
115
+ ...typeof colorMode === "object" ? colorMode : {}
116
+ } : {
110
117
  preference: "light"
111
118
  };
112
119
  _nuxt.options.appConfig.ui = defu(_nuxt.options.appConfig.ui || {}, theme);
package/dist/types.d.mts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { default } from './module.mjs'
2
2
 
3
- export { type ModuleOptions } from './module.mjs'
3
+ export { type CoreColorModeOptions, type ModuleOptions } from './module.mjs'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "3.27.0",
3
+ "version": "3.27.1",
4
4
  "license": "MIT",
5
5
  "author": "Finema Dev Core Team",
6
6
  "repository": "https://gitlab.finema.co/finema/ui-kit",