@razaman2/reactive-view 0.0.25 → 0.0.27
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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -15
- package/dist/index.mjs +14 -15
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -159,12 +159,12 @@ 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.27";
|
|
163
163
|
|
|
164
164
|
// src/ReactiveView.ts
|
|
165
165
|
var setup = {
|
|
166
166
|
type: Function,
|
|
167
|
-
default: (parent = {}) =>
|
|
167
|
+
default: (parent = {}, self = {}) => self
|
|
168
168
|
};
|
|
169
169
|
var ReactiveView_default = {
|
|
170
170
|
props: {
|
|
@@ -205,11 +205,11 @@ var ReactiveView_default = {
|
|
|
205
205
|
},
|
|
206
206
|
setup(props, context) {
|
|
207
207
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
208
|
-
const template = (component2,
|
|
208
|
+
const template = (component2, vue2) => {
|
|
209
209
|
return context.slots.default ? (0, import_vue.createVNode)(
|
|
210
210
|
"div",
|
|
211
211
|
context.attrs,
|
|
212
|
-
context.slots.default({ vue, component: component2, props, context })
|
|
212
|
+
context.slots.default({ vue: vue2, component: component2, props, context })
|
|
213
213
|
) : (0, import_vue.createVNode)("div", __spreadValues({
|
|
214
214
|
style: {
|
|
215
215
|
color: "red",
|
|
@@ -219,26 +219,26 @@ var ReactiveView_default = {
|
|
|
219
219
|
};
|
|
220
220
|
const isValid = (0, import_vue.ref)(false);
|
|
221
221
|
const ready = (0, import_vue.ref)(false);
|
|
222
|
-
const
|
|
222
|
+
const vue = (0, import_vue.getCurrentInstance)();
|
|
223
223
|
const deferred = (0, import_vue.ref)(typeof props.defer === "function" ? props.defer() : props.defer);
|
|
224
224
|
const data = typeof props.data === "function" ? props.data() : props.data;
|
|
225
225
|
const async = data instanceof Promise;
|
|
226
226
|
if (props.debug) {
|
|
227
|
-
console.log("[ReactiveView]:", { props, context, isValid, ready,
|
|
227
|
+
console.log("[ReactiveView]:", { props, context, isValid, ready, vue, deferred, data, async });
|
|
228
228
|
}
|
|
229
|
-
if (async && !((_a =
|
|
229
|
+
if (async && !((_a = vue.vnode.props) == null ? void 0 : _a.hasOwnProperty("defaultData"))) {
|
|
230
230
|
console.error("[ReactiveView]: defaultData is required for async data.");
|
|
231
231
|
}
|
|
232
232
|
if (props.loading && !props.defer) {
|
|
233
233
|
console.warn("[ReactiveView]: loading prop should be used with defer prop.");
|
|
234
234
|
}
|
|
235
235
|
const defaultData = props.getDefaultData(
|
|
236
|
-
((_b =
|
|
236
|
+
((_b = vue.vnode.props) == null ? void 0 : _b.hasOwnProperty("defaultData")) ? vue.vnode.props.defaultData : typeof ((_c = vue.vnode.props) == null ? void 0 : _c.data) === "object" ? Array.isArray(vue.vnode.props.data) ? [] : {} : ((_d = vue.vnode.props) == null ? void 0 : _d.hasOwnProperty("data")) ? (_e = vue.vnode.props) == null ? void 0 : _e.data : {}
|
|
237
237
|
);
|
|
238
238
|
const datatype = Array.isArray(defaultData) ? [] : {};
|
|
239
239
|
const config = {
|
|
240
240
|
data: (0, import_vue.reactive)(
|
|
241
|
-
import_object_manager.default.on(async ? datatype : ((_f =
|
|
241
|
+
import_object_manager.default.on(async ? datatype : ((_f = vue.vnode.props) == null ? void 0 : _f.hasOwnProperty("data")) ? data : datatype).clone()
|
|
242
242
|
),
|
|
243
243
|
defaultData: import_object_manager.default.on(defaultData).clone(),
|
|
244
244
|
notifications: props.notifications,
|
|
@@ -297,14 +297,13 @@ var ReactiveView_default = {
|
|
|
297
297
|
config2.callback(diff, model);
|
|
298
298
|
}, config2.options);
|
|
299
299
|
}
|
|
300
|
-
const component = (0, import_vue.ref)({ parent: { self:
|
|
300
|
+
const component = (0, import_vue.ref)({ parent: { self: vue.proxy }, self: { template, model, isValid } });
|
|
301
301
|
if (access(component).ReactiveView) {
|
|
302
302
|
component.value = [access(component)].reduce((options, parent) => {
|
|
303
|
-
var _a2
|
|
303
|
+
var _a2;
|
|
304
304
|
while (parent) {
|
|
305
305
|
if (typeof parent.setup === "function") {
|
|
306
|
-
|
|
307
|
-
options = { parent: options, self: (_b2 = (_a2 = ups.value) != null ? _a2 : ups) != null ? _b2 : {} };
|
|
306
|
+
options = { parent: options, self: (_a2 = parent.setup(component, options)) != null ? _a2 : {} };
|
|
308
307
|
if (access(parent.$parent).ReactiveView) {
|
|
309
308
|
break;
|
|
310
309
|
} else {
|
|
@@ -318,9 +317,9 @@ var ReactiveView_default = {
|
|
|
318
317
|
}, component.value);
|
|
319
318
|
}
|
|
320
319
|
props.instance.value = component.value;
|
|
321
|
-
return (
|
|
320
|
+
return (vue2) => {
|
|
322
321
|
if (ready.value) {
|
|
323
|
-
return access(component).template(component,
|
|
322
|
+
return access(component).template(component, vue2);
|
|
324
323
|
} else {
|
|
325
324
|
return props.loading;
|
|
326
325
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -119,12 +119,12 @@ import { ref, reactive, watch, isRef, isReactive, createVNode, getCurrentInstanc
|
|
|
119
119
|
|
|
120
120
|
// package.json
|
|
121
121
|
var name = "@razaman2/reactive-view";
|
|
122
|
-
var version = "0.0.
|
|
122
|
+
var version = "0.0.27";
|
|
123
123
|
|
|
124
124
|
// src/ReactiveView.ts
|
|
125
125
|
var setup = {
|
|
126
126
|
type: Function,
|
|
127
|
-
default: (parent = {}) =>
|
|
127
|
+
default: (parent = {}, self = {}) => self
|
|
128
128
|
};
|
|
129
129
|
var ReactiveView_default = {
|
|
130
130
|
props: {
|
|
@@ -165,11 +165,11 @@ var ReactiveView_default = {
|
|
|
165
165
|
},
|
|
166
166
|
setup(props, context) {
|
|
167
167
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
168
|
-
const template = (component2,
|
|
168
|
+
const template = (component2, vue2) => {
|
|
169
169
|
return context.slots.default ? createVNode(
|
|
170
170
|
"div",
|
|
171
171
|
context.attrs,
|
|
172
|
-
context.slots.default({ vue, component: component2, props, context })
|
|
172
|
+
context.slots.default({ vue: vue2, component: component2, props, context })
|
|
173
173
|
) : createVNode("div", __spreadValues({
|
|
174
174
|
style: {
|
|
175
175
|
color: "red",
|
|
@@ -179,26 +179,26 @@ var ReactiveView_default = {
|
|
|
179
179
|
};
|
|
180
180
|
const isValid = ref(false);
|
|
181
181
|
const ready = ref(false);
|
|
182
|
-
const
|
|
182
|
+
const vue = getCurrentInstance();
|
|
183
183
|
const deferred = ref(typeof props.defer === "function" ? props.defer() : props.defer);
|
|
184
184
|
const data = typeof props.data === "function" ? props.data() : props.data;
|
|
185
185
|
const async = data instanceof Promise;
|
|
186
186
|
if (props.debug) {
|
|
187
|
-
console.log("[ReactiveView]:", { props, context, isValid, ready,
|
|
187
|
+
console.log("[ReactiveView]:", { props, context, isValid, ready, vue, deferred, data, async });
|
|
188
188
|
}
|
|
189
|
-
if (async && !((_a =
|
|
189
|
+
if (async && !((_a = vue.vnode.props) == null ? void 0 : _a.hasOwnProperty("defaultData"))) {
|
|
190
190
|
console.error("[ReactiveView]: defaultData is required for async data.");
|
|
191
191
|
}
|
|
192
192
|
if (props.loading && !props.defer) {
|
|
193
193
|
console.warn("[ReactiveView]: loading prop should be used with defer prop.");
|
|
194
194
|
}
|
|
195
195
|
const defaultData = props.getDefaultData(
|
|
196
|
-
((_b =
|
|
196
|
+
((_b = vue.vnode.props) == null ? void 0 : _b.hasOwnProperty("defaultData")) ? vue.vnode.props.defaultData : typeof ((_c = vue.vnode.props) == null ? void 0 : _c.data) === "object" ? Array.isArray(vue.vnode.props.data) ? [] : {} : ((_d = vue.vnode.props) == null ? void 0 : _d.hasOwnProperty("data")) ? (_e = vue.vnode.props) == null ? void 0 : _e.data : {}
|
|
197
197
|
);
|
|
198
198
|
const datatype = Array.isArray(defaultData) ? [] : {};
|
|
199
199
|
const config = {
|
|
200
200
|
data: reactive(
|
|
201
|
-
ObjectManager.on(async ? datatype : ((_f =
|
|
201
|
+
ObjectManager.on(async ? datatype : ((_f = vue.vnode.props) == null ? void 0 : _f.hasOwnProperty("data")) ? data : datatype).clone()
|
|
202
202
|
),
|
|
203
203
|
defaultData: ObjectManager.on(defaultData).clone(),
|
|
204
204
|
notifications: props.notifications,
|
|
@@ -257,14 +257,13 @@ var ReactiveView_default = {
|
|
|
257
257
|
config2.callback(diff, model);
|
|
258
258
|
}, config2.options);
|
|
259
259
|
}
|
|
260
|
-
const component = ref({ parent: { self:
|
|
260
|
+
const component = ref({ parent: { self: vue.proxy }, self: { template, model, isValid } });
|
|
261
261
|
if (access(component).ReactiveView) {
|
|
262
262
|
component.value = [access(component)].reduce((options, parent) => {
|
|
263
|
-
var _a2
|
|
263
|
+
var _a2;
|
|
264
264
|
while (parent) {
|
|
265
265
|
if (typeof parent.setup === "function") {
|
|
266
|
-
|
|
267
|
-
options = { parent: options, self: (_b2 = (_a2 = ups.value) != null ? _a2 : ups) != null ? _b2 : {} };
|
|
266
|
+
options = { parent: options, self: (_a2 = parent.setup(component, options)) != null ? _a2 : {} };
|
|
268
267
|
if (access(parent.$parent).ReactiveView) {
|
|
269
268
|
break;
|
|
270
269
|
} else {
|
|
@@ -278,9 +277,9 @@ var ReactiveView_default = {
|
|
|
278
277
|
}, component.value);
|
|
279
278
|
}
|
|
280
279
|
props.instance.value = component.value;
|
|
281
|
-
return (
|
|
280
|
+
return (vue2) => {
|
|
282
281
|
if (ready.value) {
|
|
283
|
-
return access(component).template(component,
|
|
282
|
+
return access(component).template(component, vue2);
|
|
284
283
|
} else {
|
|
285
284
|
return props.loading;
|
|
286
285
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@razaman2/reactive-view",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.27",
|
|
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",
|