@razaman2/reactive-view 0.0.3 → 0.0.4
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.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +15 -16
- package/dist/index.mjs +15 -16
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -191,10 +191,9 @@ var import_vue = require("vue");
|
|
|
191
191
|
|
|
192
192
|
// package.json
|
|
193
193
|
var name = "@razaman2/reactive-view";
|
|
194
|
-
var version = "0.0.
|
|
194
|
+
var version = "0.0.4";
|
|
195
195
|
|
|
196
196
|
// src/ReactiveView.ts
|
|
197
|
-
var import_uuid = require("uuid");
|
|
198
197
|
var props = {
|
|
199
198
|
defaultData: {},
|
|
200
199
|
getDefaultData: {
|
|
@@ -217,6 +216,10 @@ var props = {
|
|
|
217
216
|
subscriptions: {
|
|
218
217
|
type: Object,
|
|
219
218
|
default: getSubscription()
|
|
219
|
+
},
|
|
220
|
+
sync: {
|
|
221
|
+
type: Boolean,
|
|
222
|
+
default: true
|
|
220
223
|
}
|
|
221
224
|
};
|
|
222
225
|
var setup = {
|
|
@@ -265,13 +268,9 @@ var ReactiveView_default = {
|
|
|
265
268
|
};
|
|
266
269
|
const setup2 = (_d = props2.setup(options)) != null ? _d : options;
|
|
267
270
|
const _e = setup2, { parent = {}, self = {} } = _e, rest = __objRest(_e, ["parent", "self"]);
|
|
268
|
-
|
|
271
|
+
const sync = (0, import_vue.ref)(false);
|
|
269
272
|
if (context.attrs["onUpdate:modelState"]) {
|
|
270
273
|
const config2 = typeof context.attrs["onUpdate:modelState"] === "function" ? { callback: context.attrs["onUpdate:modelState"] } : context.attrs["onUpdate:modelState"];
|
|
271
|
-
const subscriptionName = `
|
|
272
|
-
${props2.modelName}
|
|
273
|
-
onUpdate:modelState
|
|
274
|
-
${(0, import_uuid.v4)()}`;
|
|
275
274
|
const subscription = (0, import_vue.watch)(() => import_object_manager.default.on(stateRef.value).clone(), (after, before) => {
|
|
276
275
|
var _a2;
|
|
277
276
|
const transform = (_a2 = config2.transform) != null ? _a2 : access(setup2).$transform;
|
|
@@ -279,22 +278,22 @@ ${(0, import_uuid.v4)()}`;
|
|
|
279
278
|
before: (before == null ? void 0 : before.hasOwnProperty("")) ? before[""] : before,
|
|
280
279
|
after: (after == null ? void 0 : after.hasOwnProperty("")) ? after[""] : after
|
|
281
280
|
};
|
|
282
|
-
if (sync) {
|
|
283
|
-
sync = false;
|
|
281
|
+
if (sync.value) {
|
|
282
|
+
sync.value = false;
|
|
284
283
|
} else {
|
|
285
284
|
config2.callback(transform ? transform(diff) : diff, getState);
|
|
286
285
|
}
|
|
287
286
|
}, config2.options);
|
|
288
287
|
}
|
|
289
|
-
if (context.attrs["onUpdate:propsState"]) {
|
|
288
|
+
if (context.attrs["onUpdate:propsState"] || props2.sync) {
|
|
290
289
|
const config2 = typeof context.attrs["onUpdate:propsState"] === "function" ? { callback: context.attrs["onUpdate:propsState"] } : context.attrs["onUpdate:propsState"];
|
|
291
|
-
const subscriptionName = `
|
|
292
|
-
${props2.modelName}
|
|
293
|
-
onUpdate:propsState
|
|
294
|
-
${(0, import_uuid.v4)()}`;
|
|
295
290
|
const subscription = (0, import_vue.watch)(() => props2.state, (after, before) => {
|
|
296
|
-
config2.callback
|
|
297
|
-
|
|
291
|
+
if (props2.sync && typeof config2.callback !== "function") {
|
|
292
|
+
getState.replaceData(after);
|
|
293
|
+
} else if (typeof config2.callback === "function") {
|
|
294
|
+
config2.callback({ before, after }, getState);
|
|
295
|
+
}
|
|
296
|
+
sync.value = true;
|
|
298
297
|
}, config2.options);
|
|
299
298
|
}
|
|
300
299
|
return ($vue) => {
|
package/dist/index.mjs
CHANGED
|
@@ -148,10 +148,9 @@ import { h, ref, watch } from "vue";
|
|
|
148
148
|
|
|
149
149
|
// package.json
|
|
150
150
|
var name = "@razaman2/reactive-view";
|
|
151
|
-
var version = "0.0.
|
|
151
|
+
var version = "0.0.4";
|
|
152
152
|
|
|
153
153
|
// src/ReactiveView.ts
|
|
154
|
-
import { v4 as uuid } from "uuid";
|
|
155
154
|
var props = {
|
|
156
155
|
defaultData: {},
|
|
157
156
|
getDefaultData: {
|
|
@@ -174,6 +173,10 @@ var props = {
|
|
|
174
173
|
subscriptions: {
|
|
175
174
|
type: Object,
|
|
176
175
|
default: getSubscription()
|
|
176
|
+
},
|
|
177
|
+
sync: {
|
|
178
|
+
type: Boolean,
|
|
179
|
+
default: true
|
|
177
180
|
}
|
|
178
181
|
};
|
|
179
182
|
var setup = {
|
|
@@ -222,13 +225,9 @@ var ReactiveView_default = {
|
|
|
222
225
|
};
|
|
223
226
|
const setup2 = (_d = props2.setup(options)) != null ? _d : options;
|
|
224
227
|
const _e = setup2, { parent = {}, self = {} } = _e, rest = __objRest(_e, ["parent", "self"]);
|
|
225
|
-
|
|
228
|
+
const sync = ref(false);
|
|
226
229
|
if (context.attrs["onUpdate:modelState"]) {
|
|
227
230
|
const config2 = typeof context.attrs["onUpdate:modelState"] === "function" ? { callback: context.attrs["onUpdate:modelState"] } : context.attrs["onUpdate:modelState"];
|
|
228
|
-
const subscriptionName = `
|
|
229
|
-
${props2.modelName}
|
|
230
|
-
onUpdate:modelState
|
|
231
|
-
${uuid()}`;
|
|
232
231
|
const subscription = watch(() => ObjectManager.on(stateRef.value).clone(), (after, before) => {
|
|
233
232
|
var _a2;
|
|
234
233
|
const transform = (_a2 = config2.transform) != null ? _a2 : access(setup2).$transform;
|
|
@@ -236,22 +235,22 @@ ${uuid()}`;
|
|
|
236
235
|
before: (before == null ? void 0 : before.hasOwnProperty("")) ? before[""] : before,
|
|
237
236
|
after: (after == null ? void 0 : after.hasOwnProperty("")) ? after[""] : after
|
|
238
237
|
};
|
|
239
|
-
if (sync) {
|
|
240
|
-
sync = false;
|
|
238
|
+
if (sync.value) {
|
|
239
|
+
sync.value = false;
|
|
241
240
|
} else {
|
|
242
241
|
config2.callback(transform ? transform(diff) : diff, getState);
|
|
243
242
|
}
|
|
244
243
|
}, config2.options);
|
|
245
244
|
}
|
|
246
|
-
if (context.attrs["onUpdate:propsState"]) {
|
|
245
|
+
if (context.attrs["onUpdate:propsState"] || props2.sync) {
|
|
247
246
|
const config2 = typeof context.attrs["onUpdate:propsState"] === "function" ? { callback: context.attrs["onUpdate:propsState"] } : context.attrs["onUpdate:propsState"];
|
|
248
|
-
const subscriptionName = `
|
|
249
|
-
${props2.modelName}
|
|
250
|
-
onUpdate:propsState
|
|
251
|
-
${uuid()}`;
|
|
252
247
|
const subscription = watch(() => props2.state, (after, before) => {
|
|
253
|
-
config2.callback
|
|
254
|
-
|
|
248
|
+
if (props2.sync && typeof config2.callback !== "function") {
|
|
249
|
+
getState.replaceData(after);
|
|
250
|
+
} else if (typeof config2.callback === "function") {
|
|
251
|
+
config2.callback({ before, after }, getState);
|
|
252
|
+
}
|
|
253
|
+
sync.value = true;
|
|
255
254
|
}, config2.options);
|
|
256
255
|
}
|
|
257
256
|
return ($vue) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@razaman2/reactive-view",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "This library enables you to build vue apps in an object oriented way. It provides a convenient approach to extend and override ui components. It provides a built in eventing system along with component data management.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|