@razaman2/reactive-view 0.0.22 → 0.0.24
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 +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +71 -44
- package/dist/index.mjs +74 -47
- package/package.json +45 -45
package/dist/index.d.mts
CHANGED
|
@@ -41,10 +41,7 @@ declare const setup: {
|
|
|
41
41
|
};
|
|
42
42
|
declare const _default: {
|
|
43
43
|
props: {
|
|
44
|
-
setup: {
|
|
45
|
-
type: FunctionConstructor;
|
|
46
|
-
default: (parent?: {}) => {};
|
|
47
|
-
};
|
|
44
|
+
setup: {};
|
|
48
45
|
ReactiveView: {
|
|
49
46
|
default: boolean;
|
|
50
47
|
};
|
|
@@ -72,6 +69,10 @@ declare const _default: {
|
|
|
72
69
|
type: StringConstructor;
|
|
73
70
|
default: string;
|
|
74
71
|
};
|
|
72
|
+
debug: {
|
|
73
|
+
type: BooleanConstructor;
|
|
74
|
+
default: boolean;
|
|
75
|
+
};
|
|
75
76
|
};
|
|
76
77
|
setup(props: Record<string, any>, context: SetupContext): (vue: ComponentPublicInstance) => any;
|
|
77
78
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -41,10 +41,7 @@ declare const setup: {
|
|
|
41
41
|
};
|
|
42
42
|
declare const _default: {
|
|
43
43
|
props: {
|
|
44
|
-
setup: {
|
|
45
|
-
type: FunctionConstructor;
|
|
46
|
-
default: (parent?: {}) => {};
|
|
47
|
-
};
|
|
44
|
+
setup: {};
|
|
48
45
|
ReactiveView: {
|
|
49
46
|
default: boolean;
|
|
50
47
|
};
|
|
@@ -72,6 +69,10 @@ declare const _default: {
|
|
|
72
69
|
type: StringConstructor;
|
|
73
70
|
default: string;
|
|
74
71
|
};
|
|
72
|
+
debug: {
|
|
73
|
+
type: BooleanConstructor;
|
|
74
|
+
default: boolean;
|
|
75
|
+
};
|
|
75
76
|
};
|
|
76
77
|
setup(props: Record<string, any>, context: SetupContext): (vue: ComponentPublicInstance) => any;
|
|
77
78
|
};
|
package/dist/index.js
CHANGED
|
@@ -159,7 +159,7 @@ var import_vue = require("vue");
|
|
|
159
159
|
|
|
160
160
|
// package.json
|
|
161
161
|
var name = "@razaman2/reactive-view";
|
|
162
|
-
var version = "0.0.
|
|
162
|
+
var version = "0.0.24";
|
|
163
163
|
|
|
164
164
|
// src/ReactiveView.ts
|
|
165
165
|
var setup = {
|
|
@@ -168,7 +168,7 @@ var setup = {
|
|
|
168
168
|
};
|
|
169
169
|
var ReactiveView_default = {
|
|
170
170
|
props: {
|
|
171
|
-
setup,
|
|
171
|
+
setup: {},
|
|
172
172
|
ReactiveView: {
|
|
173
173
|
default: true
|
|
174
174
|
},
|
|
@@ -197,33 +197,37 @@ var ReactiveView_default = {
|
|
|
197
197
|
modelName: {
|
|
198
198
|
type: String,
|
|
199
199
|
default: "ReactiveView"
|
|
200
|
+
},
|
|
201
|
+
debug: {
|
|
202
|
+
type: Boolean,
|
|
203
|
+
default: false
|
|
200
204
|
}
|
|
201
205
|
},
|
|
202
206
|
setup(props, context) {
|
|
203
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
204
|
-
const template = (
|
|
205
|
-
|
|
206
|
-
const params = { vue, component: component2, props, context };
|
|
207
|
-
const vnode = context.slots.default ? (0, import_vue.createVNode)(
|
|
207
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
208
|
+
const template = (component2, vue) => {
|
|
209
|
+
return context.slots.default ? (0, import_vue.createVNode)(
|
|
208
210
|
"div",
|
|
209
211
|
context.attrs,
|
|
210
|
-
context.slots.default(
|
|
212
|
+
context.slots.default({ vue, component: component2, props, context })
|
|
211
213
|
) : (0, import_vue.createVNode)("div", __spreadValues({
|
|
212
214
|
style: {
|
|
213
215
|
color: "red",
|
|
214
216
|
textAlign: "center"
|
|
215
217
|
}
|
|
216
218
|
}, context.attrs), `${props.modelName}: ${name}@${version}`);
|
|
217
|
-
return (_c2 = (_b2 = (_a2 = context.slots).template) == null ? void 0 : _b2.call(_a2, params)) != null ? _c2 : vnode;
|
|
218
219
|
};
|
|
219
220
|
const isValid = (0, import_vue.ref)(false);
|
|
220
221
|
const ready = (0, import_vue.ref)(false);
|
|
221
222
|
const instance = (0, import_vue.getCurrentInstance)();
|
|
222
223
|
const deferred = (0, import_vue.ref)(typeof props.defer === "function" ? props.defer() : props.defer);
|
|
223
|
-
const
|
|
224
|
-
const
|
|
225
|
-
if (
|
|
226
|
-
|
|
224
|
+
const data = typeof props.data === "function" ? props.data() : props.data;
|
|
225
|
+
const async = data instanceof Promise;
|
|
226
|
+
if (props.debug) {
|
|
227
|
+
console.log("[ReactiveView]:", { props, context, isValid, ready, instance, deferred, data, async });
|
|
228
|
+
}
|
|
229
|
+
if (async && !((_a = instance.vnode.props) == null ? void 0 : _a.hasOwnProperty("defaultData"))) {
|
|
230
|
+
console.error("[ReactiveView]: defaultData is required for async data.");
|
|
227
231
|
}
|
|
228
232
|
if (props.loading && !props.defer) {
|
|
229
233
|
console.warn("[ReactiveView]: loading prop should be used with defer prop.");
|
|
@@ -232,14 +236,15 @@ var ReactiveView_default = {
|
|
|
232
236
|
((_b = instance.vnode.props) == null ? void 0 : _b.hasOwnProperty("defaultData")) ? instance.vnode.props.defaultData : typeof ((_c = instance.vnode.props) == null ? void 0 : _c.data) === "object" ? Array.isArray(instance.vnode.props.data) ? [] : {} : ((_d = instance.vnode.props) == null ? void 0 : _d.hasOwnProperty("data")) ? (_e = instance.vnode.props) == null ? void 0 : _e.data : {}
|
|
233
237
|
);
|
|
234
238
|
const datatype = Array.isArray(defaultData) ? [] : {};
|
|
235
|
-
const data = isAsyncData ? datatype : ((_f = instance.vnode.props) == null ? void 0 : _f.hasOwnProperty("data")) ? state : datatype;
|
|
236
239
|
const config = {
|
|
237
|
-
|
|
240
|
+
data: (0, import_vue.reactive)(
|
|
241
|
+
import_object_manager.default.on(async ? datatype : ((_f = instance.vnode.props) == null ? void 0 : _f.hasOwnProperty("data")) ? data : datatype).clone()
|
|
242
|
+
),
|
|
238
243
|
defaultData: import_object_manager.default.on(defaultData).clone(),
|
|
239
|
-
data: (0, import_vue.reactive)(import_object_manager.default.on(data).clone()),
|
|
240
244
|
notifications: props.notifications,
|
|
241
245
|
subscriptions: props.subscriptions,
|
|
242
|
-
logging: props.logging
|
|
246
|
+
logging: props.logging,
|
|
247
|
+
name: props.modelName
|
|
243
248
|
};
|
|
244
249
|
const model = new Proxy(props.model ? typeof props.model === "function" ? props.model(config) : props.model : new import_data_manager.default(config), {
|
|
245
250
|
get(target, key, receiver) {
|
|
@@ -248,7 +253,9 @@ var ReactiveView_default = {
|
|
|
248
253
|
var _a2;
|
|
249
254
|
const beforeSetData = (_a2 = access(component).beforeSetData) != null ? _a2 : props.beforeSetData;
|
|
250
255
|
if (typeof beforeSetData === "function") {
|
|
251
|
-
|
|
256
|
+
const after = import_object_manager.default.on(datatype).set(...params).get();
|
|
257
|
+
const before = target.getData();
|
|
258
|
+
beforeSetData({ before, after }, target);
|
|
252
259
|
} else {
|
|
253
260
|
target[key](...params);
|
|
254
261
|
}
|
|
@@ -259,12 +266,25 @@ var ReactiveView_default = {
|
|
|
259
266
|
}
|
|
260
267
|
}
|
|
261
268
|
});
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
269
|
+
const watchDataProp = (dataProp) => {
|
|
270
|
+
var _a2;
|
|
271
|
+
const config2 = typeof context.attrs["onUpdate:data"] === "function" ? {
|
|
272
|
+
callback: context.attrs["onUpdate:data"]
|
|
273
|
+
} : (_a2 = context.attrs["onUpdate:data"]) != null ? _a2 : {};
|
|
274
|
+
(0, import_vue.watch)(typeof dataProp === "function" || (0, import_vue.isRef)(dataProp) || (0, import_vue.isReactive)(dataProp) ? dataProp : () => dataProp, (after, before) => {
|
|
275
|
+
var _a3;
|
|
276
|
+
const diff = { before: import_object_manager.default.on(before).get(), after: import_object_manager.default.on(after).get() };
|
|
277
|
+
if (typeof config2.callback === "function") {
|
|
278
|
+
model.replaceData((_a3 = config2.callback(diff, model)) != null ? _a3 : after);
|
|
279
|
+
} else {
|
|
280
|
+
model.replaceData(after);
|
|
281
|
+
}
|
|
282
|
+
}, config2.options);
|
|
283
|
+
};
|
|
284
|
+
setTimeout(async () => {
|
|
285
|
+
watchDataProp(await data);
|
|
286
|
+
});
|
|
287
|
+
setTimeout(async () => {
|
|
268
288
|
var _a2;
|
|
269
289
|
ready.value = (_a2 = await deferred.value) != null ? _a2 : true;
|
|
270
290
|
});
|
|
@@ -277,29 +297,32 @@ var ReactiveView_default = {
|
|
|
277
297
|
config2.callback(diff, model);
|
|
278
298
|
}, config2.options);
|
|
279
299
|
}
|
|
280
|
-
if ((_h = context.attrs["onUpdate:data"]) != null ? _h : true) {
|
|
281
|
-
const config2 = typeof context.attrs["onUpdate:data"] === "function" ? {
|
|
282
|
-
callback: context.attrs["onUpdate:data"]
|
|
283
|
-
} : (_i = context.attrs["onUpdate:data"]) != null ? _i : {};
|
|
284
|
-
(0, import_vue.watch)(async () => typeof props.data === "function" ? await props.data() : await props.data, async (after, before) => {
|
|
285
|
-
const diff = { before: import_object_manager.default.on(await before).get(), after: import_object_manager.default.on(await after).get() };
|
|
286
|
-
if (typeof config2.callback === "function") {
|
|
287
|
-
config2.callback(diff, model);
|
|
288
|
-
} else {
|
|
289
|
-
model.replaceData(await after);
|
|
290
|
-
}
|
|
291
|
-
}, config2.options);
|
|
292
|
-
}
|
|
293
300
|
const component = (0, import_vue.ref)({ parent: { self: instance.proxy }, self: { template, model, isValid } });
|
|
294
|
-
if (
|
|
295
|
-
component.value =
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
301
|
+
if (access(component).ReactiveView) {
|
|
302
|
+
component.value = [access(component)].reduce((options, parent) => {
|
|
303
|
+
var _a2;
|
|
304
|
+
while (parent) {
|
|
305
|
+
if (typeof parent.setup === "function") {
|
|
306
|
+
options = { parent: options, self: (_a2 = parent.setup(component, options)) != null ? _a2 : {} };
|
|
307
|
+
console.log("log options:", options);
|
|
308
|
+
if (access(parent.$parent).ReactiveView) {
|
|
309
|
+
break;
|
|
310
|
+
} else {
|
|
311
|
+
parent = parent.$parent;
|
|
312
|
+
}
|
|
313
|
+
} else {
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return options;
|
|
318
|
+
}, component.value);
|
|
299
319
|
}
|
|
320
|
+
console.log("component before:", component.value);
|
|
321
|
+
props.instance.value = component.value;
|
|
322
|
+
console.log("component after:", component.value, props.instance.value);
|
|
300
323
|
return (vue) => {
|
|
301
324
|
if (ready.value) {
|
|
302
|
-
return access(component).template(
|
|
325
|
+
return access(component).template(component, vue);
|
|
303
326
|
} else {
|
|
304
327
|
return props.loading;
|
|
305
328
|
}
|
|
@@ -394,7 +417,11 @@ function access(view = {}, alternative) {
|
|
|
394
417
|
component.tree = "parent" in component.tree && component.tree.parent;
|
|
395
418
|
}
|
|
396
419
|
} while (component.tree);
|
|
397
|
-
|
|
420
|
+
try {
|
|
421
|
+
return new alternative();
|
|
422
|
+
} catch (e) {
|
|
423
|
+
return alternative;
|
|
424
|
+
}
|
|
398
425
|
}
|
|
399
426
|
});
|
|
400
427
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -110,16 +110,16 @@ _Subscriptions.subscriptions = _Subscriptions.create();
|
|
|
110
110
|
var Subscriptions = _Subscriptions;
|
|
111
111
|
|
|
112
112
|
// src/index.ts
|
|
113
|
-
import { createVNode as createVNode2, isRef } from "vue";
|
|
113
|
+
import { createVNode as createVNode2, isRef as isRef2 } from "vue";
|
|
114
114
|
|
|
115
115
|
// src/ReactiveView.ts
|
|
116
116
|
import ObjectManager from "@razaman2/object-manager";
|
|
117
117
|
import DataManager from "@razaman2/data-manager";
|
|
118
|
-
import { ref, reactive, watch,
|
|
118
|
+
import { ref, reactive, watch, isRef, isReactive, createVNode, getCurrentInstance } from "vue";
|
|
119
119
|
|
|
120
120
|
// package.json
|
|
121
121
|
var name = "@razaman2/reactive-view";
|
|
122
|
-
var version = "0.0.
|
|
122
|
+
var version = "0.0.24";
|
|
123
123
|
|
|
124
124
|
// src/ReactiveView.ts
|
|
125
125
|
var setup = {
|
|
@@ -128,7 +128,7 @@ var setup = {
|
|
|
128
128
|
};
|
|
129
129
|
var ReactiveView_default = {
|
|
130
130
|
props: {
|
|
131
|
-
setup,
|
|
131
|
+
setup: {},
|
|
132
132
|
ReactiveView: {
|
|
133
133
|
default: true
|
|
134
134
|
},
|
|
@@ -157,33 +157,37 @@ var ReactiveView_default = {
|
|
|
157
157
|
modelName: {
|
|
158
158
|
type: String,
|
|
159
159
|
default: "ReactiveView"
|
|
160
|
+
},
|
|
161
|
+
debug: {
|
|
162
|
+
type: Boolean,
|
|
163
|
+
default: false
|
|
160
164
|
}
|
|
161
165
|
},
|
|
162
166
|
setup(props, context) {
|
|
163
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
164
|
-
const template = (
|
|
165
|
-
|
|
166
|
-
const params = { vue, component: component2, props, context };
|
|
167
|
-
const vnode = context.slots.default ? createVNode(
|
|
167
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
168
|
+
const template = (component2, vue) => {
|
|
169
|
+
return context.slots.default ? createVNode(
|
|
168
170
|
"div",
|
|
169
171
|
context.attrs,
|
|
170
|
-
context.slots.default(
|
|
172
|
+
context.slots.default({ vue, component: component2, props, context })
|
|
171
173
|
) : createVNode("div", __spreadValues({
|
|
172
174
|
style: {
|
|
173
175
|
color: "red",
|
|
174
176
|
textAlign: "center"
|
|
175
177
|
}
|
|
176
178
|
}, context.attrs), `${props.modelName}: ${name}@${version}`);
|
|
177
|
-
return (_c2 = (_b2 = (_a2 = context.slots).template) == null ? void 0 : _b2.call(_a2, params)) != null ? _c2 : vnode;
|
|
178
179
|
};
|
|
179
180
|
const isValid = ref(false);
|
|
180
181
|
const ready = ref(false);
|
|
181
182
|
const instance = getCurrentInstance();
|
|
182
183
|
const deferred = ref(typeof props.defer === "function" ? props.defer() : props.defer);
|
|
183
|
-
const
|
|
184
|
-
const
|
|
185
|
-
if (
|
|
186
|
-
|
|
184
|
+
const data = typeof props.data === "function" ? props.data() : props.data;
|
|
185
|
+
const async = data instanceof Promise;
|
|
186
|
+
if (props.debug) {
|
|
187
|
+
console.log("[ReactiveView]:", { props, context, isValid, ready, instance, deferred, data, async });
|
|
188
|
+
}
|
|
189
|
+
if (async && !((_a = instance.vnode.props) == null ? void 0 : _a.hasOwnProperty("defaultData"))) {
|
|
190
|
+
console.error("[ReactiveView]: defaultData is required for async data.");
|
|
187
191
|
}
|
|
188
192
|
if (props.loading && !props.defer) {
|
|
189
193
|
console.warn("[ReactiveView]: loading prop should be used with defer prop.");
|
|
@@ -192,14 +196,15 @@ var ReactiveView_default = {
|
|
|
192
196
|
((_b = instance.vnode.props) == null ? void 0 : _b.hasOwnProperty("defaultData")) ? instance.vnode.props.defaultData : typeof ((_c = instance.vnode.props) == null ? void 0 : _c.data) === "object" ? Array.isArray(instance.vnode.props.data) ? [] : {} : ((_d = instance.vnode.props) == null ? void 0 : _d.hasOwnProperty("data")) ? (_e = instance.vnode.props) == null ? void 0 : _e.data : {}
|
|
193
197
|
);
|
|
194
198
|
const datatype = Array.isArray(defaultData) ? [] : {};
|
|
195
|
-
const data = isAsyncData ? datatype : ((_f = instance.vnode.props) == null ? void 0 : _f.hasOwnProperty("data")) ? state : datatype;
|
|
196
199
|
const config = {
|
|
197
|
-
|
|
200
|
+
data: reactive(
|
|
201
|
+
ObjectManager.on(async ? datatype : ((_f = instance.vnode.props) == null ? void 0 : _f.hasOwnProperty("data")) ? data : datatype).clone()
|
|
202
|
+
),
|
|
198
203
|
defaultData: ObjectManager.on(defaultData).clone(),
|
|
199
|
-
data: reactive(ObjectManager.on(data).clone()),
|
|
200
204
|
notifications: props.notifications,
|
|
201
205
|
subscriptions: props.subscriptions,
|
|
202
|
-
logging: props.logging
|
|
206
|
+
logging: props.logging,
|
|
207
|
+
name: props.modelName
|
|
203
208
|
};
|
|
204
209
|
const model = new Proxy(props.model ? typeof props.model === "function" ? props.model(config) : props.model : new DataManager(config), {
|
|
205
210
|
get(target, key, receiver) {
|
|
@@ -208,7 +213,9 @@ var ReactiveView_default = {
|
|
|
208
213
|
var _a2;
|
|
209
214
|
const beforeSetData = (_a2 = access(component).beforeSetData) != null ? _a2 : props.beforeSetData;
|
|
210
215
|
if (typeof beforeSetData === "function") {
|
|
211
|
-
|
|
216
|
+
const after = ObjectManager.on(datatype).set(...params).get();
|
|
217
|
+
const before = target.getData();
|
|
218
|
+
beforeSetData({ before, after }, target);
|
|
212
219
|
} else {
|
|
213
220
|
target[key](...params);
|
|
214
221
|
}
|
|
@@ -219,12 +226,25 @@ var ReactiveView_default = {
|
|
|
219
226
|
}
|
|
220
227
|
}
|
|
221
228
|
});
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
229
|
+
const watchDataProp = (dataProp) => {
|
|
230
|
+
var _a2;
|
|
231
|
+
const config2 = typeof context.attrs["onUpdate:data"] === "function" ? {
|
|
232
|
+
callback: context.attrs["onUpdate:data"]
|
|
233
|
+
} : (_a2 = context.attrs["onUpdate:data"]) != null ? _a2 : {};
|
|
234
|
+
watch(typeof dataProp === "function" || isRef(dataProp) || isReactive(dataProp) ? dataProp : () => dataProp, (after, before) => {
|
|
235
|
+
var _a3;
|
|
236
|
+
const diff = { before: ObjectManager.on(before).get(), after: ObjectManager.on(after).get() };
|
|
237
|
+
if (typeof config2.callback === "function") {
|
|
238
|
+
model.replaceData((_a3 = config2.callback(diff, model)) != null ? _a3 : after);
|
|
239
|
+
} else {
|
|
240
|
+
model.replaceData(after);
|
|
241
|
+
}
|
|
242
|
+
}, config2.options);
|
|
243
|
+
};
|
|
244
|
+
setTimeout(async () => {
|
|
245
|
+
watchDataProp(await data);
|
|
246
|
+
});
|
|
247
|
+
setTimeout(async () => {
|
|
228
248
|
var _a2;
|
|
229
249
|
ready.value = (_a2 = await deferred.value) != null ? _a2 : true;
|
|
230
250
|
});
|
|
@@ -237,29 +257,32 @@ var ReactiveView_default = {
|
|
|
237
257
|
config2.callback(diff, model);
|
|
238
258
|
}, config2.options);
|
|
239
259
|
}
|
|
240
|
-
if ((_h = context.attrs["onUpdate:data"]) != null ? _h : true) {
|
|
241
|
-
const config2 = typeof context.attrs["onUpdate:data"] === "function" ? {
|
|
242
|
-
callback: context.attrs["onUpdate:data"]
|
|
243
|
-
} : (_i = context.attrs["onUpdate:data"]) != null ? _i : {};
|
|
244
|
-
watch(async () => typeof props.data === "function" ? await props.data() : await props.data, async (after, before) => {
|
|
245
|
-
const diff = { before: ObjectManager.on(await before).get(), after: ObjectManager.on(await after).get() };
|
|
246
|
-
if (typeof config2.callback === "function") {
|
|
247
|
-
config2.callback(diff, model);
|
|
248
|
-
} else {
|
|
249
|
-
model.replaceData(await after);
|
|
250
|
-
}
|
|
251
|
-
}, config2.options);
|
|
252
|
-
}
|
|
253
260
|
const component = ref({ parent: { self: instance.proxy }, self: { template, model, isValid } });
|
|
254
|
-
if (
|
|
255
|
-
component.value =
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
261
|
+
if (access(component).ReactiveView) {
|
|
262
|
+
component.value = [access(component)].reduce((options, parent) => {
|
|
263
|
+
var _a2;
|
|
264
|
+
while (parent) {
|
|
265
|
+
if (typeof parent.setup === "function") {
|
|
266
|
+
options = { parent: options, self: (_a2 = parent.setup(component, options)) != null ? _a2 : {} };
|
|
267
|
+
console.log("log options:", options);
|
|
268
|
+
if (access(parent.$parent).ReactiveView) {
|
|
269
|
+
break;
|
|
270
|
+
} else {
|
|
271
|
+
parent = parent.$parent;
|
|
272
|
+
}
|
|
273
|
+
} else {
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return options;
|
|
278
|
+
}, component.value);
|
|
259
279
|
}
|
|
280
|
+
console.log("component before:", component.value);
|
|
281
|
+
props.instance.value = component.value;
|
|
282
|
+
console.log("component after:", component.value, props.instance.value);
|
|
260
283
|
return (vue) => {
|
|
261
284
|
if (ready.value) {
|
|
262
|
-
return access(component).template(
|
|
285
|
+
return access(component).template(component, vue);
|
|
263
286
|
} else {
|
|
264
287
|
return props.loading;
|
|
265
288
|
}
|
|
@@ -354,13 +377,17 @@ function access(view = {}, alternative) {
|
|
|
354
377
|
component.tree = "parent" in component.tree && component.tree.parent;
|
|
355
378
|
}
|
|
356
379
|
} while (component.tree);
|
|
357
|
-
|
|
380
|
+
try {
|
|
381
|
+
return new alternative();
|
|
382
|
+
} catch (e) {
|
|
383
|
+
return alternative;
|
|
384
|
+
}
|
|
358
385
|
}
|
|
359
386
|
});
|
|
360
387
|
};
|
|
361
388
|
try {
|
|
362
389
|
const component = typeof view === "function" ? view() : view;
|
|
363
|
-
const ref2 =
|
|
390
|
+
const ref2 = isRef2(component) ? component.value : component;
|
|
364
391
|
return resolve(ref2.ReactiveView ? access(ref2.instance) : ref2);
|
|
365
392
|
} catch (e) {
|
|
366
393
|
return resolve(view);
|
package/package.json
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@razaman2/reactive-view",
|
|
3
|
-
"version": "0.0.
|
|
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
|
-
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.mjs",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"scripts": {
|
|
9
|
-
"prepublishOnly": "npm run build",
|
|
10
|
-
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
11
|
-
"lint": "tsc",
|
|
12
|
-
"test": "cd tests/vue-ts && npm run dev"
|
|
13
|
-
},
|
|
14
|
-
"keywords": [
|
|
15
|
-
"vue",
|
|
16
|
-
"vue-helper",
|
|
17
|
-
"reactive-view",
|
|
18
|
-
"vue-class-component",
|
|
19
|
-
"reactive-ui"
|
|
20
|
-
],
|
|
21
|
-
"author": "razaman2",
|
|
22
|
-
"license": "MIT",
|
|
23
|
-
"dependencies": {
|
|
24
|
-
"@razaman2/data-manager": "^3.2.11",
|
|
25
|
-
"@razaman2/object-manager": "^3.4.2",
|
|
26
|
-
"date-fns": "^4.1.0",
|
|
27
|
-
"date-fns-tz": "^3.2.0",
|
|
28
|
-
"uuid": "^11.1.0"
|
|
29
|
-
},
|
|
30
|
-
"peerDependencies": {
|
|
31
|
-
"vue": "^3.5.13"
|
|
32
|
-
},
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"@types/uuid": "^10.0.0",
|
|
35
|
-
"tsup": "^8.4.0",
|
|
36
|
-
"typescript": "^5.8.
|
|
37
|
-
"vitest": "^3.1.1"
|
|
38
|
-
},
|
|
39
|
-
"publishConfig": {
|
|
40
|
-
"access": "public"
|
|
41
|
-
},
|
|
42
|
-
"files": [
|
|
43
|
-
"dist"
|
|
44
|
-
]
|
|
45
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@razaman2/reactive-view",
|
|
3
|
+
"version": "0.0.24",
|
|
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
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"prepublishOnly": "npm run build",
|
|
10
|
+
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
11
|
+
"lint": "tsc",
|
|
12
|
+
"test": "cd tests/vue-ts && npm run dev"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"vue",
|
|
16
|
+
"vue-helper",
|
|
17
|
+
"reactive-view",
|
|
18
|
+
"vue-class-component",
|
|
19
|
+
"reactive-ui"
|
|
20
|
+
],
|
|
21
|
+
"author": "razaman2",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@razaman2/data-manager": "^3.2.11",
|
|
25
|
+
"@razaman2/object-manager": "^3.4.2",
|
|
26
|
+
"date-fns": "^4.1.0",
|
|
27
|
+
"date-fns-tz": "^3.2.0",
|
|
28
|
+
"uuid": "^11.1.0"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"vue": "^3.5.13"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/uuid": "^10.0.0",
|
|
35
|
+
"tsup": "^8.4.0",
|
|
36
|
+
"typescript": "^5.8.3",
|
|
37
|
+
"vitest": "^3.1.1"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"dist"
|
|
44
|
+
]
|
|
45
|
+
}
|