responsive-media 1.0.3 → 1.0.5
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/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/vue-responsive.js +3 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/vue-responsive.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { inject,
|
|
1
|
+
import { inject, reactive } from '@vue/runtime-core';
|
|
2
2
|
import { responsiveState, setResponsiveConfig } from './create-responsive';
|
|
3
3
|
const RESPONSIVE_KEY = Symbol('responsiveState');
|
|
4
4
|
let vueReactiveState = null;
|
|
5
5
|
export function useResponsive() {
|
|
6
|
-
// Получаем реактивный объект из provide/inject или создаём локально
|
|
7
6
|
const injected = inject(RESPONSIVE_KEY);
|
|
8
7
|
if (injected)
|
|
9
8
|
return injected;
|
|
10
9
|
if (!vueReactiveState) {
|
|
11
|
-
vueReactiveState =
|
|
12
|
-
// Синхронизируем с изменениями responsiveState
|
|
10
|
+
vueReactiveState = reactive({ ...responsiveState.proxy });
|
|
13
11
|
responsiveState.subscribe((state) => {
|
|
14
12
|
Object.keys(state).forEach(key => {
|
|
15
13
|
// @ts-ignore
|
|
@@ -25,7 +23,7 @@ export const ResponsivePlugin = {
|
|
|
25
23
|
setResponsiveConfig(config);
|
|
26
24
|
}
|
|
27
25
|
if (!vueReactiveState) {
|
|
28
|
-
vueReactiveState =
|
|
26
|
+
vueReactiveState = reactive({ ...responsiveState.proxy });
|
|
29
27
|
responsiveState.subscribe((state) => {
|
|
30
28
|
Object.keys(state).forEach(key => {
|
|
31
29
|
// @ts-ignore
|
package/package.json
CHANGED