@razaman2/reactive-view 0.0.34-beta.2 → 0.0.34-beta.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 +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +23 -24
- package/dist/index.mjs +23 -24
- package/package.json +3 -2
package/dist/index.d.mts
CHANGED
|
@@ -53,7 +53,9 @@ declare const _default: {
|
|
|
53
53
|
notifications: ObjectConstructor;
|
|
54
54
|
subscriptions: ObjectConstructor;
|
|
55
55
|
beforeSetData: FunctionConstructor;
|
|
56
|
-
data: {
|
|
56
|
+
data: {
|
|
57
|
+
default: () => {};
|
|
58
|
+
};
|
|
57
59
|
defaultData: {};
|
|
58
60
|
getDefaultData: {
|
|
59
61
|
type: FunctionConstructor;
|
package/dist/index.d.ts
CHANGED
|
@@ -53,7 +53,9 @@ declare const _default: {
|
|
|
53
53
|
notifications: ObjectConstructor;
|
|
54
54
|
subscriptions: ObjectConstructor;
|
|
55
55
|
beforeSetData: FunctionConstructor;
|
|
56
|
-
data: {
|
|
56
|
+
data: {
|
|
57
|
+
default: () => {};
|
|
58
|
+
};
|
|
57
59
|
defaultData: {};
|
|
58
60
|
getDefaultData: {
|
|
59
61
|
type: FunctionConstructor;
|
package/dist/index.js
CHANGED
|
@@ -168,7 +168,7 @@ var import_vue = require("vue");
|
|
|
168
168
|
|
|
169
169
|
// package.json
|
|
170
170
|
var name = "@razaman2/reactive-view";
|
|
171
|
-
var version = "0.0.34-beta.
|
|
171
|
+
var version = "0.0.34-beta.4";
|
|
172
172
|
|
|
173
173
|
// src/ReactiveView.ts
|
|
174
174
|
var setup = {
|
|
@@ -189,7 +189,9 @@ var ReactiveView_default = {
|
|
|
189
189
|
notifications: Object,
|
|
190
190
|
subscriptions: Object,
|
|
191
191
|
beforeSetData: Function,
|
|
192
|
-
data: {
|
|
192
|
+
data: {
|
|
193
|
+
default: () => ({})
|
|
194
|
+
},
|
|
193
195
|
defaultData: {},
|
|
194
196
|
getDefaultData: {
|
|
195
197
|
type: Function,
|
|
@@ -212,7 +214,7 @@ var ReactiveView_default = {
|
|
|
212
214
|
}
|
|
213
215
|
},
|
|
214
216
|
setup(props, context) {
|
|
215
|
-
var _a, _b, _c, _d, _e, _f
|
|
217
|
+
var _a, _b, _c, _d, _e, _f;
|
|
216
218
|
const template = (component2, vue2) => {
|
|
217
219
|
return (0, import_vue.createVNode)(
|
|
218
220
|
"div",
|
|
@@ -224,21 +226,21 @@ var ReactiveView_default = {
|
|
|
224
226
|
};
|
|
225
227
|
const isValid = (0, import_vue.ref)(false);
|
|
226
228
|
const isReady = (0, import_vue.ref)(false);
|
|
227
|
-
const isFunctionData = ["Function"].includes(
|
|
228
|
-
const isAsyncFunctionData = ["AsyncFunction"].includes(
|
|
229
|
-
const isPromiseData = ["Promise"].includes(
|
|
229
|
+
const isFunctionData = ["Function"].includes(props.data.constructor.name);
|
|
230
|
+
const isAsyncFunctionData = ["AsyncFunction"].includes(props.data.constructor.name);
|
|
231
|
+
const isPromiseData = ["Promise"].includes(props.data.constructor.name) || isAsyncFunctionData;
|
|
230
232
|
const defer = (0, import_vue.ref)(typeof props.defer === "function" ? props.defer() : props.defer);
|
|
231
233
|
const vue = (0, import_vue.getCurrentInstance)();
|
|
232
234
|
if ((isPromiseData || isFunctionData) && !("defaultData" in vue.vnode.props)) {
|
|
233
235
|
console.error("[ReactiveView]: defaultData is required for promise or async function data.");
|
|
234
236
|
}
|
|
235
237
|
const defaultData = props.getDefaultData(
|
|
236
|
-
((
|
|
238
|
+
((_a = vue.vnode.props) == null ? void 0 : _a.hasOwnProperty("defaultData")) ? vue.vnode.props.defaultData : ((_b = vue.vnode.props) == null ? void 0 : _b.hasOwnProperty("data")) ? Array.isArray(vue.vnode.props.data) ? [] : {} : {}
|
|
237
239
|
);
|
|
238
240
|
const datatype = Array.isArray(defaultData) ? [] : {};
|
|
239
241
|
const config = {
|
|
240
242
|
data: (0, import_vue.reactive)(import_object_manager.default.on(
|
|
241
|
-
isPromiseData || isFunctionData || (0, import_vue.isRef)(props.data) || (0, import_vue.isReactive)(props.data) ? datatype : ((
|
|
243
|
+
isPromiseData || isFunctionData || (0, import_vue.isRef)(props.data) || (0, import_vue.isReactive)(props.data) ? datatype : ((_c = vue.vnode.props) == null ? void 0 : _c.hasOwnProperty("data")) ? props.data : datatype
|
|
242
244
|
).clone()),
|
|
243
245
|
defaultData: import_object_manager.default.on(defaultData).clone(),
|
|
244
246
|
notifications: props.notifications,
|
|
@@ -295,9 +297,9 @@ var ReactiveView_default = {
|
|
|
295
297
|
const config2 = typeof context.attrs["onUpdate:model"] === "function" ? {
|
|
296
298
|
callback: context.attrs["onUpdate:model"],
|
|
297
299
|
options: Object.assign(__spreadValues(__spreadValues({
|
|
298
|
-
deep: (
|
|
299
|
-
}, context.attrs["model:immediate"] ? { immediate: context.attrs["model:immediate"] } : {}), context.attrs["model:once"] ? { once: context.attrs["model:once"] } : {}), ((
|
|
300
|
-
} : (
|
|
300
|
+
deep: (_d = context.attrs["model:deep"]) != null ? _d : true
|
|
301
|
+
}, context.attrs["model:immediate"] ? { immediate: context.attrs["model:immediate"] } : {}), context.attrs["model:once"] ? { once: context.attrs["model:once"] } : {}), ((_e = context.attrs["onUpdate:model"]) != null ? _e : {}).options)
|
|
302
|
+
} : (_f = context.attrs["onUpdate:model"]) != null ? _f : {};
|
|
301
303
|
if (context.attrs["model:log"]) {
|
|
302
304
|
console.log(`[ReactiveView]:model`, { config: config2 });
|
|
303
305
|
}
|
|
@@ -346,6 +348,7 @@ var ReactiveView_default = {
|
|
|
346
348
|
// src/index.ts
|
|
347
349
|
var import_vue2 = require("vue");
|
|
348
350
|
var import_date_fns_tz = require("date-fns-tz");
|
|
351
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
349
352
|
var index_default = ReactiveView_default;
|
|
350
353
|
function safeRequest(request) {
|
|
351
354
|
return new Promise(async (resolve) => {
|
|
@@ -375,7 +378,7 @@ function safeRequest(request) {
|
|
|
375
378
|
}
|
|
376
379
|
});
|
|
377
380
|
}
|
|
378
|
-
function getProps(props, param2) {
|
|
381
|
+
function getProps(props = {}, param2) {
|
|
379
382
|
var _a;
|
|
380
383
|
const exclude = Array.isArray(param2) || typeof param2 === "string" ? param2 : param2.exclude;
|
|
381
384
|
const exclusions = (Array.isArray(exclude) ? exclude : [exclude]).join("|");
|
|
@@ -527,22 +530,18 @@ var extendVnode = (component, element) => {
|
|
|
527
530
|
return (props = {}, slots) => {
|
|
528
531
|
var _a;
|
|
529
532
|
const _b = getProps((_a = vnode.props) != null ? _a : {}, []), { class: classes, style: styles } = _b, rest = __objRest(_b, ["class", "style"]);
|
|
530
|
-
const finalClasses = MergeStyles(classes, typeof props.class === "function" ? props.class(classes) : props.class);
|
|
533
|
+
const finalClasses = (0, import_tailwind_merge.twMerge)(MergeStyles(classes).string, MergeStyles(typeof props.class === "function" ? props.class(classes) : props.class).string);
|
|
534
|
+
const finalStyles = MergeStyles(styles, typeof props.style === "function" ? props.style(styles) : props.style);
|
|
531
535
|
const functionalProps = Object.entries(props).reduce((props2, [key2, value]) => {
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
].includes(key2) && typeof value === "function") {
|
|
536
|
-
props2[key2] = value(vnode.props[key2]);
|
|
536
|
+
var _a2;
|
|
537
|
+
if (!["class", "style"].includes(key2) && typeof value === "function") {
|
|
538
|
+
props2[key2] = value((_a2 = vnode.props) == null ? void 0 : _a2[key2]);
|
|
537
539
|
}
|
|
538
540
|
return props2;
|
|
539
541
|
}, props);
|
|
540
|
-
const finalProps = Object.assign(rest, functionalProps, {
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
});
|
|
544
|
-
const finalSlots = typeof slots === "function" ? slots(vnode.children) : vnode.children;
|
|
545
|
-
return (0, import_vue2.h)(["string", "undefined"].includes(typeof element) ? vnode : element, finalProps, finalSlots);
|
|
542
|
+
const finalProps = Object.assign(rest, functionalProps, { class: finalClasses, style: finalStyles });
|
|
543
|
+
const finalSlots = slots ? typeof slots === "function" ? slots(vnode.children) : slots : vnode.children;
|
|
544
|
+
return (0, import_vue2.h)(["undefined"].includes(typeof element) ? vnode.type : element, finalProps, finalSlots);
|
|
546
545
|
};
|
|
547
546
|
}
|
|
548
547
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -125,7 +125,7 @@ import { ref, reactive, watch, isRef, isReactive, createVNode, getCurrentInstanc
|
|
|
125
125
|
|
|
126
126
|
// package.json
|
|
127
127
|
var name = "@razaman2/reactive-view";
|
|
128
|
-
var version = "0.0.34-beta.
|
|
128
|
+
var version = "0.0.34-beta.4";
|
|
129
129
|
|
|
130
130
|
// src/ReactiveView.ts
|
|
131
131
|
var setup = {
|
|
@@ -146,7 +146,9 @@ var ReactiveView_default = {
|
|
|
146
146
|
notifications: Object,
|
|
147
147
|
subscriptions: Object,
|
|
148
148
|
beforeSetData: Function,
|
|
149
|
-
data: {
|
|
149
|
+
data: {
|
|
150
|
+
default: () => ({})
|
|
151
|
+
},
|
|
150
152
|
defaultData: {},
|
|
151
153
|
getDefaultData: {
|
|
152
154
|
type: Function,
|
|
@@ -169,7 +171,7 @@ var ReactiveView_default = {
|
|
|
169
171
|
}
|
|
170
172
|
},
|
|
171
173
|
setup(props, context) {
|
|
172
|
-
var _a, _b, _c, _d, _e, _f
|
|
174
|
+
var _a, _b, _c, _d, _e, _f;
|
|
173
175
|
const template = (component2, vue2) => {
|
|
174
176
|
return createVNode(
|
|
175
177
|
"div",
|
|
@@ -181,21 +183,21 @@ var ReactiveView_default = {
|
|
|
181
183
|
};
|
|
182
184
|
const isValid = ref(false);
|
|
183
185
|
const isReady = ref(false);
|
|
184
|
-
const isFunctionData = ["Function"].includes(
|
|
185
|
-
const isAsyncFunctionData = ["AsyncFunction"].includes(
|
|
186
|
-
const isPromiseData = ["Promise"].includes(
|
|
186
|
+
const isFunctionData = ["Function"].includes(props.data.constructor.name);
|
|
187
|
+
const isAsyncFunctionData = ["AsyncFunction"].includes(props.data.constructor.name);
|
|
188
|
+
const isPromiseData = ["Promise"].includes(props.data.constructor.name) || isAsyncFunctionData;
|
|
187
189
|
const defer = ref(typeof props.defer === "function" ? props.defer() : props.defer);
|
|
188
190
|
const vue = getCurrentInstance();
|
|
189
191
|
if ((isPromiseData || isFunctionData) && !("defaultData" in vue.vnode.props)) {
|
|
190
192
|
console.error("[ReactiveView]: defaultData is required for promise or async function data.");
|
|
191
193
|
}
|
|
192
194
|
const defaultData = props.getDefaultData(
|
|
193
|
-
((
|
|
195
|
+
((_a = vue.vnode.props) == null ? void 0 : _a.hasOwnProperty("defaultData")) ? vue.vnode.props.defaultData : ((_b = vue.vnode.props) == null ? void 0 : _b.hasOwnProperty("data")) ? Array.isArray(vue.vnode.props.data) ? [] : {} : {}
|
|
194
196
|
);
|
|
195
197
|
const datatype = Array.isArray(defaultData) ? [] : {};
|
|
196
198
|
const config = {
|
|
197
199
|
data: reactive(ObjectManager.on(
|
|
198
|
-
isPromiseData || isFunctionData || isRef(props.data) || isReactive(props.data) ? datatype : ((
|
|
200
|
+
isPromiseData || isFunctionData || isRef(props.data) || isReactive(props.data) ? datatype : ((_c = vue.vnode.props) == null ? void 0 : _c.hasOwnProperty("data")) ? props.data : datatype
|
|
199
201
|
).clone()),
|
|
200
202
|
defaultData: ObjectManager.on(defaultData).clone(),
|
|
201
203
|
notifications: props.notifications,
|
|
@@ -252,9 +254,9 @@ var ReactiveView_default = {
|
|
|
252
254
|
const config2 = typeof context.attrs["onUpdate:model"] === "function" ? {
|
|
253
255
|
callback: context.attrs["onUpdate:model"],
|
|
254
256
|
options: Object.assign(__spreadValues(__spreadValues({
|
|
255
|
-
deep: (
|
|
256
|
-
}, context.attrs["model:immediate"] ? { immediate: context.attrs["model:immediate"] } : {}), context.attrs["model:once"] ? { once: context.attrs["model:once"] } : {}), ((
|
|
257
|
-
} : (
|
|
257
|
+
deep: (_d = context.attrs["model:deep"]) != null ? _d : true
|
|
258
|
+
}, context.attrs["model:immediate"] ? { immediate: context.attrs["model:immediate"] } : {}), context.attrs["model:once"] ? { once: context.attrs["model:once"] } : {}), ((_e = context.attrs["onUpdate:model"]) != null ? _e : {}).options)
|
|
259
|
+
} : (_f = context.attrs["onUpdate:model"]) != null ? _f : {};
|
|
258
260
|
if (context.attrs["model:log"]) {
|
|
259
261
|
console.log(`[ReactiveView]:model`, { config: config2 });
|
|
260
262
|
}
|
|
@@ -303,6 +305,7 @@ var ReactiveView_default = {
|
|
|
303
305
|
// src/index.ts
|
|
304
306
|
import { createVNode as createVNode2, isRef as isRef2, h } from "vue";
|
|
305
307
|
import { formatInTimeZone } from "date-fns-tz";
|
|
308
|
+
import { twMerge } from "tailwind-merge";
|
|
306
309
|
var index_default = ReactiveView_default;
|
|
307
310
|
function safeRequest(request) {
|
|
308
311
|
return new Promise(async (resolve) => {
|
|
@@ -332,7 +335,7 @@ function safeRequest(request) {
|
|
|
332
335
|
}
|
|
333
336
|
});
|
|
334
337
|
}
|
|
335
|
-
function getProps(props, param2) {
|
|
338
|
+
function getProps(props = {}, param2) {
|
|
336
339
|
var _a;
|
|
337
340
|
const exclude = Array.isArray(param2) || typeof param2 === "string" ? param2 : param2.exclude;
|
|
338
341
|
const exclusions = (Array.isArray(exclude) ? exclude : [exclude]).join("|");
|
|
@@ -484,22 +487,18 @@ var extendVnode = (component, element) => {
|
|
|
484
487
|
return (props = {}, slots) => {
|
|
485
488
|
var _a;
|
|
486
489
|
const _b = getProps((_a = vnode.props) != null ? _a : {}, []), { class: classes, style: styles } = _b, rest = __objRest(_b, ["class", "style"]);
|
|
487
|
-
const finalClasses = MergeStyles(classes, typeof props.class === "function" ? props.class(classes) : props.class);
|
|
490
|
+
const finalClasses = twMerge(MergeStyles(classes).string, MergeStyles(typeof props.class === "function" ? props.class(classes) : props.class).string);
|
|
491
|
+
const finalStyles = MergeStyles(styles, typeof props.style === "function" ? props.style(styles) : props.style);
|
|
488
492
|
const functionalProps = Object.entries(props).reduce((props2, [key2, value]) => {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
].includes(key2) && typeof value === "function") {
|
|
493
|
-
props2[key2] = value(vnode.props[key2]);
|
|
493
|
+
var _a2;
|
|
494
|
+
if (!["class", "style"].includes(key2) && typeof value === "function") {
|
|
495
|
+
props2[key2] = value((_a2 = vnode.props) == null ? void 0 : _a2[key2]);
|
|
494
496
|
}
|
|
495
497
|
return props2;
|
|
496
498
|
}, props);
|
|
497
|
-
const finalProps = Object.assign(rest, functionalProps, {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
});
|
|
501
|
-
const finalSlots = typeof slots === "function" ? slots(vnode.children) : vnode.children;
|
|
502
|
-
return h(["string", "undefined"].includes(typeof element) ? vnode : element, finalProps, finalSlots);
|
|
499
|
+
const finalProps = Object.assign(rest, functionalProps, { class: finalClasses, style: finalStyles });
|
|
500
|
+
const finalSlots = slots ? typeof slots === "function" ? slots(vnode.children) : slots : vnode.children;
|
|
501
|
+
return h(["undefined"].includes(typeof element) ? vnode.type : element, finalProps, finalSlots);
|
|
503
502
|
};
|
|
504
503
|
}
|
|
505
504
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@razaman2/reactive-view",
|
|
3
|
-
"version": "0.0.34-beta.
|
|
3
|
+
"version": "0.0.34-beta.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",
|
|
@@ -26,10 +26,11 @@
|
|
|
26
26
|
"@razaman2/object-manager": "^3.4.2",
|
|
27
27
|
"date-fns": "^4.1.0",
|
|
28
28
|
"date-fns-tz": "^3.2.0",
|
|
29
|
+
"tailwind-merge": "^3.3.1",
|
|
29
30
|
"uuid": "^11.1.0"
|
|
30
31
|
},
|
|
31
32
|
"peerDependencies": {
|
|
32
|
-
"vue": "^3.5.
|
|
33
|
+
"vue": "^3.5.19"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@types/uuid": "^10.0.0",
|