@coreui/vue-pro 4.9.0-beta.1 → 4.9.0-beta.2

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 CHANGED
@@ -46,7 +46,7 @@
46
46
 
47
47
  Several quick start options are available:
48
48
 
49
- - [Download the latest release](https://github.com/coreui/coreui-vue-pro/archive/v4.9.0-beta.1.zip)
49
+ - [Download the latest release](https://github.com/coreui/coreui-vue-pro/archive/v4.9.0-beta.2.zip)
50
50
  - Clone the repo: `git clone https://github.com/coreui/coreui-vue-pro.git`
51
51
  - Install with [npm](https://www.npmjs.com/): `npm install @coreui/vue-pro`
52
52
  - Install with [yarn](https://yarnpkg.com/): `yarn add @coreui/vue-pro`
@@ -1,5 +1,5 @@
1
1
  export declare const useColorModes: (localStorageItemName?: string) => {
2
- getColorMode: () => string;
2
+ getColorMode: () => string | undefined;
3
3
  isColorModeSet: () => boolean;
4
4
  setColorMode: (mode: string) => void;
5
5
  };
@@ -1,5 +1,6 @@
1
1
  import { DirectiveBinding } from 'vue';
2
2
  declare const _default: {
3
+ name: string;
3
4
  mounted(el: HTMLElement, binding: DirectiveBinding): void;
4
5
  beforeUnmount(_el: HTMLElement, binding: DirectiveBinding): void;
5
6
  };
package/dist/index.es.js CHANGED
@@ -12877,7 +12877,12 @@ const CPopoverPlugin = {
12877
12877
  },
12878
12878
  };
12879
12879
 
12880
- const isOnMobile = (element) => Boolean(getComputedStyle(element).getPropertyValue('--cui-is-mobile'));
12880
+ const isOnMobile = (element) => {
12881
+ if (!element) {
12882
+ return;
12883
+ }
12884
+ return Boolean(getComputedStyle(element).getPropertyValue('--cui-is-mobile'));
12885
+ };
12881
12886
  const CSidebar = defineComponent({
12882
12887
  name: 'CSidebar',
12883
12888
  props: {
@@ -16348,6 +16353,7 @@ const toggleTooltipElement = (tooltip, el, popperOptions) => {
16348
16353
  addTooltipElement(tooltip, el, popperOptions);
16349
16354
  };
16350
16355
  var vCTooltip = {
16356
+ name: 'c-tooltip',
16351
16357
  mounted(el, binding) {
16352
16358
  const value = binding.value;
16353
16359
  const content = typeof value === 'string' ? value : value.content ?? '';
@@ -16403,9 +16409,12 @@ var Directives = /*#__PURE__*/Object.freeze({
16403
16409
  vctooltip: vCTooltip
16404
16410
  });
16405
16411
 
16406
- const getStoredTheme = (localStorageItemName) => localStorage.getItem(localStorageItemName);
16412
+ const getStoredTheme = (localStorageItemName) => typeof window !== 'undefined' && localStorage.getItem(localStorageItemName);
16407
16413
  const setStoredTheme = (localStorageItemName, colorMode) => localStorage.setItem(localStorageItemName, colorMode);
16408
16414
  const getPreferredColorScheme = (localStorageItemName) => {
16415
+ if (typeof window === 'undefined') {
16416
+ return;
16417
+ }
16409
16418
  const storedTheme = getStoredTheme(localStorageItemName);
16410
16419
  if (storedTheme) {
16411
16420
  return storedTheme;
@@ -16423,20 +16432,21 @@ const setTheme = (colorMode) => {
16423
16432
  const useColorModes = (localStorageItemName = 'coreui-vue-color-scheme') => {
16424
16433
  const colorMode = ref(getPreferredColorScheme(localStorageItemName));
16425
16434
  watch(colorMode, () => {
16426
- setStoredTheme(localStorageItemName, colorMode.value);
16427
- setTheme(colorMode.value);
16435
+ if (colorMode.value) {
16436
+ setStoredTheme(localStorageItemName, colorMode.value);
16437
+ setTheme(colorMode.value);
16438
+ }
16428
16439
  });
16429
16440
  onBeforeMount(() => {
16430
- if (typeof getStoredTheme(localStorageItemName) === 'string') {
16441
+ if (typeof getStoredTheme(localStorageItemName) === 'string' && colorMode.value) {
16431
16442
  setTheme(colorMode.value);
16432
16443
  }
16433
16444
  window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
16434
16445
  const storedTheme = getStoredTheme(localStorageItemName);
16435
- if (storedTheme !== 'light' && storedTheme !== 'dark') {
16446
+ if (storedTheme !== 'light' && storedTheme !== 'dark' && colorMode.value) {
16436
16447
  setTheme(colorMode.value);
16437
16448
  }
16438
16449
  });
16439
- watch(colorMode, () => setTheme(colorMode.value));
16440
16450
  });
16441
16451
  return {
16442
16452
  getColorMode: () => colorMode.value,
@@ -16453,7 +16463,7 @@ const CoreuiVue = {
16453
16463
  app.component(key, Components[key]);
16454
16464
  }
16455
16465
  for (const key in Directives) {
16456
- app.directive(key, Directives[key]);
16466
+ app.directive(Directives[key]['name'], Directives[key]);
16457
16467
  }
16458
16468
  },
16459
16469
  };