@webitel/ui-sdk 25.12.26 → 25.12.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "25.12.26",
3
+ "version": "25.12.27",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "make-all": "npm version patch --git-tag-version false && npm run build && (npm run build:types || true) && (npm run lint:fix || true) && npm run publish-lib",
@@ -35,8 +35,7 @@
35
35
 
36
36
  <script lang="ts" setup>
37
37
  import type { ButtonProps } from 'primevue';
38
- import {computed, defineEmits, defineProps, ref, useAttrs, watch} from 'vue';
39
- import {useStore} from "vuex";
38
+ import { computed, defineEmits, defineProps, inject,ref, useAttrs, watch } from 'vue';
40
39
 
41
40
  import { ButtonColor, ButtonVariant, ComponentSize, } from '../../enums';
42
41
 
@@ -81,9 +80,34 @@ const emit = defineEmits(['click']);
81
80
  const attrs = useAttrs();
82
81
 
83
82
  const showLoader = ref(false);
84
- const store = useStore();
85
83
 
86
- const darkMode = computed(() => store.getters['appearance/DARK_MODE']);
84
+ // @Ler24
85
+ // Compatibility mode for Vuex (old mode) and when there is no Vuex in project (new mode)
86
+ const store = ref(null);
87
+
88
+ const initStore = async () => {
89
+ try {
90
+ const vuex = await import('vuex');
91
+ store.value = vuex.useStore();
92
+ } catch (e) {
93
+ store.value = null;
94
+ }
95
+ }
96
+ initStore();
97
+
98
+ const injectDarkMode = inject('darkMode');
99
+
100
+ const darkMode = computed(() => {
101
+ if (injectDarkMode?.value) {
102
+ return injectDarkMode.value;
103
+ }
104
+
105
+ if (store?.value?.getters) {
106
+ return store?.value?.getters['appearance/DARK_MODE'] ?? false;
107
+ }
108
+
109
+ return false;
110
+ });
87
111
 
88
112
  /**
89
113
  * @author: @Opelsandr Palonnyi
@@ -1,29 +0,0 @@
1
- var f = (i) => {
2
- throw TypeError(i);
3
- };
4
- var c = (i, t, s) => t.has(i) || f("Cannot " + s);
5
- var r = (i, t, s) => (c(i, t, "read from private field"), s ? s.call(i) : t.get(i)), e = (i, t, s) => t.has(i) ? f("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, s), h = (i, t, s, u) => (c(i, t, "write to private field"), u ? u.call(i, s) : t.set(i, s), s), m = (i, t, s) => (c(i, t, "access private method"), s);
6
- import { k as l, u as p } from "./install-CrrAB4P5.js";
7
- var o, a, n, d;
8
- class F {
9
- constructor(t) {
10
- e(this, n);
11
- e(this, o);
12
- e(this, a);
13
- h(this, a, t);
14
- }
15
- start() {
16
- l(r(this, o)) && m(this, n, d).call(this);
17
- }
18
- stop() {
19
- p(r(this, o)) && window.cancelAnimationFrame(r(this, o)), h(this, o, void 0);
20
- }
21
- }
22
- o = new WeakMap(), a = new WeakMap(), n = new WeakSet(), d = function() {
23
- h(this, o, window.requestAnimationFrame(() => {
24
- l(r(this, o)) || (r(this, a).call(this), m(this, n, d).call(this));
25
- }));
26
- };
27
- export {
28
- F as R
29
- };