@logux/client
Advanced tools
Comparing version 0.14.4 to 0.14.5
{ | ||
"name": "@logux/client", | ||
"version": "0.14.4", | ||
"version": "0.14.5", | ||
"description": "Logux base components to build web client", | ||
@@ -34,3 +34,3 @@ "keywords": [ | ||
"@nanostores/react": "^0.0.0", | ||
"@nanostores/vue": "^0.4.1", | ||
"@nanostores/vue": ">=0.5.3", | ||
"nanostores": "^0.5.0", | ||
@@ -37,0 +37,0 @@ "preact": ">=10.0.0", |
import { | ||
getCurrentInstance, | ||
onErrorCaptured, | ||
shallowRef, | ||
reactive, | ||
@@ -12,3 +13,3 @@ readonly, | ||
toRef, | ||
ref | ||
unref | ||
} from 'vue' | ||
@@ -53,3 +54,3 @@ import { useStore } from '@nanostores/vue' | ||
function useSyncStore(store) { | ||
let error = ref(null) | ||
let error = shallowRef(null) | ||
let state = useStore(store) | ||
@@ -76,6 +77,2 @@ | ||
if (typeof id === 'string') { | ||
id = ref(id) | ||
} | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -86,22 +83,27 @@ checkErrorProcessor() | ||
let client = useClient() | ||
let state = reactive({}) | ||
watch( | ||
id, | ||
() => { | ||
state.value = useSyncStore(Template(id.value, client, ...builderArgs)) | ||
}, | ||
{ immediate: true } | ||
) | ||
if (!isRef(id)) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
return readonly(useSyncStore(Template(id, client, ...builderArgs))) | ||
} | ||
return useSyncStore(Template(id, client, ...builderArgs)) | ||
} else { | ||
let state = reactive({}) | ||
if (process.env.NODE_ENV !== 'production') { | ||
return readonly(toRef(state, 'value')) | ||
watch( | ||
id, | ||
() => { | ||
state.value = useSyncStore(Template(id.value, client, ...builderArgs)) | ||
}, | ||
{ immediate: true } | ||
) | ||
if (process.env.NODE_ENV !== 'production') { | ||
return readonly(toRef(state, 'value')) | ||
} | ||
return toRef(state, 'value') | ||
} | ||
return toRef(state, 'value') | ||
} | ||
export function useFilter(Template, filter = {}, opts = {}) { | ||
if (!isRef(filter)) filter = ref(filter) | ||
if (!isRef(opts)) opts = ref(opts) | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -112,18 +114,28 @@ checkErrorProcessor() | ||
let client = useClient() | ||
let state = reactive({}) | ||
watch( | ||
[filter, opts], | ||
() => { | ||
state.value = useSyncStore( | ||
createFilter(client, Template, filter.value, opts.value) | ||
if (!isRef(filter) && !isRef(opts)) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
return readonly( | ||
useSyncStore(createFilter(client, Template, filter, opts)) | ||
) | ||
}, | ||
{ deep: true, immediate: true } | ||
) | ||
} | ||
return useSyncStore(createFilter(client, Template, filter, opts)) | ||
} else { | ||
let state = reactive({}) | ||
if (process.env.NODE_ENV !== 'production') { | ||
return readonly(toRef(state, 'value')) | ||
watch( | ||
() => ([unref(filter), unref(opts)]), | ||
() => { | ||
state.value = useSyncStore( | ||
createFilter(client, Template, { ...filter.value }, { ...opts.value }) | ||
) | ||
}, | ||
{ deep: true, immediate: true } | ||
) | ||
if (process.env.NODE_ENV !== 'production') { | ||
return readonly(toRef(state, 'value')) | ||
} | ||
return toRef(state, 'value') | ||
} | ||
return toRef(state, 'value') | ||
} | ||
@@ -134,3 +146,3 @@ | ||
setup(props, { slots }) { | ||
let error = ref(null) | ||
let error = shallowRef(null) | ||
let code = computed(() => { | ||
@@ -137,0 +149,0 @@ if (!error.value) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
144211
4814
24