init component
This commit is contained in:
1
node_modules/buetify/lib/composables/proxy/index.d.ts
generated
vendored
Executable file
1
node_modules/buetify/lib/composables/proxy/index.d.ts
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
export * from './useProxy';
|
||||
2
node_modules/buetify/lib/composables/proxy/index.js
generated
vendored
Executable file
2
node_modules/buetify/lib/composables/proxy/index.js
generated
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
export * from './useProxy';
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/buetify/lib/composables/proxy/index.js.map
generated
vendored
Executable file
1
node_modules/buetify/lib/composables/proxy/index.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/composables/proxy/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAd","sourcesContent":["export * from './useProxy';\n"],"sourceRoot":"","file":"index.js"}
|
||||
6
node_modules/buetify/lib/composables/proxy/useProxy.d.ts
generated
vendored
Executable file
6
node_modules/buetify/lib/composables/proxy/useProxy.d.ts
generated
vendored
Executable file
@@ -0,0 +1,6 @@
|
||||
import { FunctionN } from 'fp-ts/lib/function';
|
||||
import { Ref } from 'vue';
|
||||
export declare function useProxy<T>(ref: Ref<T>, onUpdate?: Ref<FunctionN<[T], void> | undefined> | FunctionN<[T], void>): Proxy<T>;
|
||||
export interface Proxy<T> {
|
||||
value: Ref<T>;
|
||||
}
|
||||
26
node_modules/buetify/lib/composables/proxy/useProxy.js
generated
vendored
Executable file
26
node_modules/buetify/lib/composables/proxy/useProxy.js
generated
vendored
Executable file
@@ -0,0 +1,26 @@
|
||||
import { shallowRef, watch, computed, unref } from 'vue';
|
||||
export function useProxy(ref, onUpdate) {
|
||||
const internalValue = shallowRef(ref.value);
|
||||
watch(ref, newValue => {
|
||||
internalValue.value = newValue;
|
||||
});
|
||||
const value = computed({
|
||||
get() {
|
||||
return internalValue.value;
|
||||
},
|
||||
|
||||
set(val) {
|
||||
internalValue.value = val;
|
||||
const update = unref(onUpdate);
|
||||
|
||||
if (update) {
|
||||
update(val);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
return {
|
||||
value
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=useProxy.js.map
|
||||
1
node_modules/buetify/lib/composables/proxy/useProxy.js.map
generated
vendored
Executable file
1
node_modules/buetify/lib/composables/proxy/useProxy.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/composables/proxy/useProxy.ts"],"names":[],"mappings":"AACA,SAAc,UAAd,EAA0B,KAA1B,EAAiC,QAAjC,EAA2C,KAA3C,QAAwD,KAAxD;AAEA,OAAM,SAAU,QAAV,CACJ,GADI,EAEJ,QAFI,EAEmE;AAEvE,QAAM,aAAa,GAAG,UAAU,CAAC,GAAG,CAAC,KAAL,CAAhC;AACA,EAAA,KAAK,CAAC,GAAD,EAAM,QAAQ,IAAG;AACpB,IAAA,aAAa,CAAC,KAAd,GAAsB,QAAtB;AACD,GAFI,CAAL;AAIA,QAAM,KAAK,GAAG,QAAQ,CAAC;AACrB,IAAA,GAAG,GAAA;AACD,aAAO,aAAa,CAAC,KAArB;AACD,KAHoB;;AAIrB,IAAA,GAAG,CAAC,GAAD,EAAO;AACR,MAAA,aAAa,CAAC,KAAd,GAAsB,GAAtB;AACA,YAAM,MAAM,GAAG,KAAK,CAAC,QAAD,CAApB;;AACA,UAAI,MAAJ,EAAY;AACV,QAAA,MAAM,CAAC,GAAD,CAAN;AACD;AACF;;AAVoB,GAAD,CAAtB;AAaA,SAAO;AACL,IAAA;AADK,GAAP;AAGD","sourcesContent":["import { FunctionN } from 'fp-ts/lib/function';\nimport { Ref, shallowRef, watch, computed, unref } from 'vue';\n\nexport function useProxy<T>(\n ref: Ref<T>,\n onUpdate?: Ref<FunctionN<[T], void> | undefined> | FunctionN<[T], void>\n): Proxy<T> {\n const internalValue = shallowRef(ref.value);\n watch(ref, newValue => {\n internalValue.value = newValue;\n });\n\n const value = computed({\n get() {\n return internalValue.value;\n },\n set(val: T) {\n internalValue.value = val;\n const update = unref(onUpdate);\n if (update) {\n update(val);\n }\n }\n });\n\n return {\n value\n };\n}\n\nexport interface Proxy<T> {\n value: Ref<T>;\n}\n"],"sourceRoot":"","file":"useProxy.js"}
|
||||
Reference in New Issue
Block a user