@razaman2/reactive-view 0.0.1
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/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/index.d.mts +176 -0
- package/dist/index.d.ts +176 -0
- package/dist/index.js +536 -0
- package/dist/index.mjs +493 -0
- package/package.json +46 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
var __async = (__this, __arguments, generator) => {
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
var fulfilled = (value) => {
|
|
35
|
+
try {
|
|
36
|
+
step(generator.next(value));
|
|
37
|
+
} catch (e) {
|
|
38
|
+
reject(e);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var rejected = (value) => {
|
|
42
|
+
try {
|
|
43
|
+
step(generator.throw(value));
|
|
44
|
+
} catch (e) {
|
|
45
|
+
reject(e);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
49
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// src/index.ts
|
|
54
|
+
import { formatInTimeZone } from "date-fns-tz";
|
|
55
|
+
|
|
56
|
+
// src/Subscription.ts
|
|
57
|
+
var Subscription = class _Subscription {
|
|
58
|
+
constructor() {
|
|
59
|
+
this.subscriptions = [];
|
|
60
|
+
this.data = {};
|
|
61
|
+
}
|
|
62
|
+
static create() {
|
|
63
|
+
return new _Subscription();
|
|
64
|
+
}
|
|
65
|
+
subscribe(name2, handler, data) {
|
|
66
|
+
if (this.isNameAvailable(name2)) {
|
|
67
|
+
this.subscriptions.push({
|
|
68
|
+
name: name2,
|
|
69
|
+
handler
|
|
70
|
+
});
|
|
71
|
+
this.data[name2] = data;
|
|
72
|
+
}
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
replace(name2, handler, data) {
|
|
76
|
+
this.unsubscribe(name2);
|
|
77
|
+
return this.subscribe(name2, handler, data);
|
|
78
|
+
}
|
|
79
|
+
unsubscribe(subscriptions) {
|
|
80
|
+
if (!Array.isArray(subscriptions)) {
|
|
81
|
+
subscriptions = subscriptions ? [subscriptions] : [];
|
|
82
|
+
}
|
|
83
|
+
if (subscriptions.length) {
|
|
84
|
+
subscriptions.forEach((name2) => {
|
|
85
|
+
const subscription = this.find(name2);
|
|
86
|
+
if (subscription) {
|
|
87
|
+
subscription.handler();
|
|
88
|
+
this.remove(subscription);
|
|
89
|
+
console.log(`%cUnsubscribed From Subscription (${name2})`, "background-color: yellow; color: green; font-weight: bold; padding: 3px;");
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
} else {
|
|
93
|
+
this.subscriptions.forEach((subscription) => {
|
|
94
|
+
subscription.handler();
|
|
95
|
+
console.log(`%cUnsubscribed From Subscription (${subscription.name})`, "background-color: yellow; color: red; font-weight: bold; padding: 3px;");
|
|
96
|
+
});
|
|
97
|
+
this.subscriptions = [];
|
|
98
|
+
}
|
|
99
|
+
return this;
|
|
100
|
+
}
|
|
101
|
+
size() {
|
|
102
|
+
return this.subscriptions.length;
|
|
103
|
+
}
|
|
104
|
+
hasSubscription(name2) {
|
|
105
|
+
return Boolean(this.find(name2));
|
|
106
|
+
}
|
|
107
|
+
remove(subscription) {
|
|
108
|
+
this.subscriptions.splice(this.subscriptions.indexOf(subscription), 1);
|
|
109
|
+
}
|
|
110
|
+
find(name2) {
|
|
111
|
+
return this.subscriptions.find((subscription) => {
|
|
112
|
+
return subscription.name === name2;
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
isNameAvailable(name2) {
|
|
116
|
+
if (this.hasSubscription(name2)) {
|
|
117
|
+
throw new Error(`There is already a subscription called "${name2}".`);
|
|
118
|
+
} else {
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
registrations() {
|
|
123
|
+
return this.subscriptions;
|
|
124
|
+
}
|
|
125
|
+
get(name2) {
|
|
126
|
+
const subscription = this.find(name2);
|
|
127
|
+
if (subscription) {
|
|
128
|
+
return subscription;
|
|
129
|
+
} else {
|
|
130
|
+
throw new Error(`Subscription "${name2}" doesn't exist!`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// src/Subscriptions.ts
|
|
136
|
+
var _Subscriptions = class _Subscriptions extends Subscription {
|
|
137
|
+
static get() {
|
|
138
|
+
return this.subscriptions;
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
_Subscriptions.subscriptions = _Subscriptions.create();
|
|
142
|
+
var Subscriptions = _Subscriptions;
|
|
143
|
+
|
|
144
|
+
// src/ReactiveView.ts
|
|
145
|
+
import ObjectManager from "@razaman2/object-manager";
|
|
146
|
+
import DataManager from "@razaman2/data-manager";
|
|
147
|
+
import { h, ref, watch, onBeforeUnmount } from "vue";
|
|
148
|
+
|
|
149
|
+
// package.json
|
|
150
|
+
var name = "@razaman2/reactive-view";
|
|
151
|
+
var version = "0.0.1";
|
|
152
|
+
|
|
153
|
+
// src/ReactiveView.ts
|
|
154
|
+
import { v4 as uuid } from "uuid";
|
|
155
|
+
var props = {
|
|
156
|
+
defaultData: {},
|
|
157
|
+
getDefaultData: {
|
|
158
|
+
type: Function,
|
|
159
|
+
default: (data = {}) => data
|
|
160
|
+
},
|
|
161
|
+
logging: {
|
|
162
|
+
validator: (logging) => {
|
|
163
|
+
return typeof logging === "boolean";
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
model: {},
|
|
167
|
+
modelName: {
|
|
168
|
+
type: String,
|
|
169
|
+
default: "ReactiveView"
|
|
170
|
+
},
|
|
171
|
+
notifications: { type: Object },
|
|
172
|
+
root: { type: Function },
|
|
173
|
+
state: {},
|
|
174
|
+
subscriptions: {
|
|
175
|
+
type: Object,
|
|
176
|
+
default: getSubscription()
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
var setup = {
|
|
180
|
+
setup: {
|
|
181
|
+
type: Function,
|
|
182
|
+
default: (param1 = {}, param2 = {}) => {
|
|
183
|
+
return Object.assign(param1, param2);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
var ReactiveView_default = {
|
|
188
|
+
props: __spreadValues(__spreadValues({}, setup), props),
|
|
189
|
+
setup(props2, context) {
|
|
190
|
+
var _a, _b, _c, _d;
|
|
191
|
+
const template = (vue, options2) => {
|
|
192
|
+
var _a2, _b2, _c2;
|
|
193
|
+
const vnode = context.slots.default ? h(
|
|
194
|
+
"div",
|
|
195
|
+
context.attrs,
|
|
196
|
+
context.slots.default({ vue, options: options2, props: props2, context })
|
|
197
|
+
) : h("div", __spreadValues({
|
|
198
|
+
style: {
|
|
199
|
+
color: "red",
|
|
200
|
+
textAlign: "center"
|
|
201
|
+
}
|
|
202
|
+
}, context.attrs), `${props2.modelName}: ${name}@${version}`);
|
|
203
|
+
return (_c2 = (_b2 = (_a2 = context.slots).template) == null ? void 0 : _b2.call(_a2, { vue, vnode })) != null ? _c2 : vnode;
|
|
204
|
+
};
|
|
205
|
+
const isValid = ref(false);
|
|
206
|
+
const defaultData = props2.getDefaultData(
|
|
207
|
+
Array.isArray(props2.state) ? (_a = props2.defaultData) != null ? _a : [] : (_b = props2.defaultData) != null ? _b : {}
|
|
208
|
+
);
|
|
209
|
+
const defaultType = Array.isArray(defaultData) ? [] : {};
|
|
210
|
+
const stateRef = ref(DataManager.transform((_c = props2.state) != null ? _c : defaultType));
|
|
211
|
+
const config = {
|
|
212
|
+
defaultData,
|
|
213
|
+
data: stateRef.value,
|
|
214
|
+
name: props2.modelName,
|
|
215
|
+
logging: props2.logging,
|
|
216
|
+
notifications: props2.notifications
|
|
217
|
+
};
|
|
218
|
+
const getState = props2.model ? typeof props2.model === "function" ? props2.model(config) : props2.model : new DataManager(config);
|
|
219
|
+
const options = {
|
|
220
|
+
parent: { self: props2 },
|
|
221
|
+
self: { template, isValid, getState, stateRef }
|
|
222
|
+
};
|
|
223
|
+
const setup2 = (_d = props2.setup(options)) != null ? _d : options;
|
|
224
|
+
const _e = setup2, { parent = {}, self = {} } = _e, rest = __objRest(_e, ["parent", "self"]);
|
|
225
|
+
let sync = false;
|
|
226
|
+
if (context.attrs["onUpdate:modelState"]) {
|
|
227
|
+
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
|
+
const subscription = watch(() => ObjectManager.on(stateRef.value).clone(), (after, before) => {
|
|
233
|
+
var _a2;
|
|
234
|
+
const transform = (_a2 = config2.transform) != null ? _a2 : access(setup2).$transform;
|
|
235
|
+
const diff = {
|
|
236
|
+
before: (before == null ? void 0 : before.hasOwnProperty("")) ? before[""] : before,
|
|
237
|
+
after: (after == null ? void 0 : after.hasOwnProperty("")) ? after[""] : after
|
|
238
|
+
};
|
|
239
|
+
if (sync) {
|
|
240
|
+
sync = false;
|
|
241
|
+
} else {
|
|
242
|
+
config2.callback(transform ? transform(diff) : diff, getState);
|
|
243
|
+
}
|
|
244
|
+
}, config2.options);
|
|
245
|
+
props2.subscriptions.addSubscription(subscriptionName, subscription);
|
|
246
|
+
onBeforeUnmount(() => props2.subscriptions.removeSubscription(subscriptionName, false));
|
|
247
|
+
}
|
|
248
|
+
if (context.attrs["onUpdate:propsState"]) {
|
|
249
|
+
const config2 = typeof context.attrs["onUpdate:propsState"] === "function" ? { callback: context.attrs["onUpdate:propsState"] } : context.attrs["onUpdate:propsState"];
|
|
250
|
+
const subscriptionName = `
|
|
251
|
+
${props2.modelName}
|
|
252
|
+
onUpdate:propsState
|
|
253
|
+
${uuid()}`;
|
|
254
|
+
const subscription = watch(() => props2.state, (after, before) => {
|
|
255
|
+
config2.callback({ before, after }, getState);
|
|
256
|
+
sync = true;
|
|
257
|
+
}, config2.options);
|
|
258
|
+
props2.subscriptions.addSubscription(subscriptionName, subscription);
|
|
259
|
+
onBeforeUnmount(() => props2.subscriptions.removeSubscription(subscriptionName, false));
|
|
260
|
+
}
|
|
261
|
+
return ($vue) => {
|
|
262
|
+
const setup3 = { $vue, options: parent };
|
|
263
|
+
while (setup3.options) {
|
|
264
|
+
Object.defineProperties(setup3.$vue, Object.assign({
|
|
265
|
+
access: {
|
|
266
|
+
configurable: true,
|
|
267
|
+
value: () => {
|
|
268
|
+
return access({ parent, self });
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}, rest));
|
|
272
|
+
setup3.options = setup3.options.parent;
|
|
273
|
+
setup3.$vue = setup3.$vue.$parent;
|
|
274
|
+
}
|
|
275
|
+
return access($vue).template($vue, { parent, self });
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
// src/AsyncComponent.ts
|
|
281
|
+
import { h as h2, ref as ref2, watch as watch2, isRef, isReactive, onMounted } from "vue";
|
|
282
|
+
var AsyncComponent_default = {
|
|
283
|
+
props: __spreadProps(__spreadValues({}, setup), {
|
|
284
|
+
resolve: {
|
|
285
|
+
required: true
|
|
286
|
+
},
|
|
287
|
+
delay: {
|
|
288
|
+
type: Number,
|
|
289
|
+
default: 200
|
|
290
|
+
},
|
|
291
|
+
timeout: {
|
|
292
|
+
type: Number,
|
|
293
|
+
default: 2e3
|
|
294
|
+
},
|
|
295
|
+
loading: {
|
|
296
|
+
default: h2("div")
|
|
297
|
+
},
|
|
298
|
+
options: {
|
|
299
|
+
type: Object
|
|
300
|
+
},
|
|
301
|
+
error: {
|
|
302
|
+
required: false
|
|
303
|
+
}
|
|
304
|
+
}),
|
|
305
|
+
setup() {
|
|
306
|
+
return ($vue) => {
|
|
307
|
+
return h2(
|
|
308
|
+
src_default,
|
|
309
|
+
{
|
|
310
|
+
setup: (parent) => {
|
|
311
|
+
const componentRef = ref2($vue.loading);
|
|
312
|
+
const template = () => {
|
|
313
|
+
var _a, _b, _c;
|
|
314
|
+
const vnode = componentRef.value;
|
|
315
|
+
return (_c = (_b = (_a = $vue.$slots).template) == null ? void 0 : _b.call(_a, { $vue, vnode })) != null ? _c : vnode;
|
|
316
|
+
};
|
|
317
|
+
const self = { template };
|
|
318
|
+
onMounted(() => __async(this, null, function* () {
|
|
319
|
+
try {
|
|
320
|
+
if ($vue.resolve) {
|
|
321
|
+
const target = yield $vue.resolve;
|
|
322
|
+
target.hasOwnProperty("property") ? watch2(isRef(target.property) || isReactive(target.property) ? target.property : () => __async(this, null, function* () {
|
|
323
|
+
return (yield $vue.resolve).property;
|
|
324
|
+
}), (after, before) => {
|
|
325
|
+
setTimeout(() => __async(this, null, function* () {
|
|
326
|
+
return componentRef.value = yield target.onChange({ before: yield before, after: yield after });
|
|
327
|
+
}), $vue.delay);
|
|
328
|
+
}, $vue.options) : setTimeout(() => __async(this, null, function* () {
|
|
329
|
+
return componentRef.value = target;
|
|
330
|
+
}), $vue.delay);
|
|
331
|
+
}
|
|
332
|
+
} catch (error) {
|
|
333
|
+
if ($vue.error) {
|
|
334
|
+
componentRef.value = h2(yield $vue.error, { error });
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}));
|
|
338
|
+
return { parent, self };
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
);
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
// src/index.ts
|
|
347
|
+
var src_default = ReactiveView_default;
|
|
348
|
+
function ucf(string) {
|
|
349
|
+
return string.split(/\s+/).map((string2) => {
|
|
350
|
+
return string2.toLowerCase().replace(/^(\w)/, ($1) => $1.toUpperCase());
|
|
351
|
+
}).join(" ");
|
|
352
|
+
}
|
|
353
|
+
function ucfat(string, tokens) {
|
|
354
|
+
const pattern = RegExp(`(?<=(?:${tokens.join("|")}))(\\w)(\\w*)`, "g");
|
|
355
|
+
return string.replace(pattern, ($1, $2, $3) => `${$2.toUpperCase()}${$3.toLowerCase()}`);
|
|
356
|
+
}
|
|
357
|
+
function safeRequest(request) {
|
|
358
|
+
return new Promise((resolve) => __async(this, null, function* () {
|
|
359
|
+
var _a, _b, _c, _d;
|
|
360
|
+
const { message } = (_a = request.loading) != null ? _a : {};
|
|
361
|
+
if (request.loading) {
|
|
362
|
+
request.loading.status = true;
|
|
363
|
+
if (request.message) {
|
|
364
|
+
request.loading.message = request.message;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
try {
|
|
368
|
+
resolve(yield request.try());
|
|
369
|
+
} catch (e) {
|
|
370
|
+
if ((_b = request.alternative) != null ? _b : true) {
|
|
371
|
+
resolve(request.catch ? yield request.catch(e) : console.log(e));
|
|
372
|
+
}
|
|
373
|
+
} finally {
|
|
374
|
+
yield (_c = request.finally) == null ? void 0 : _c.call(request);
|
|
375
|
+
if (request.loading) {
|
|
376
|
+
request.loading.status = false;
|
|
377
|
+
}
|
|
378
|
+
if (request.loading && message) {
|
|
379
|
+
request.loading.message = message;
|
|
380
|
+
}
|
|
381
|
+
yield (_d = request.complete) == null ? void 0 : _d.call(request);
|
|
382
|
+
}
|
|
383
|
+
}));
|
|
384
|
+
}
|
|
385
|
+
function getRoot(vue) {
|
|
386
|
+
var _a, _b, _c;
|
|
387
|
+
return (_c = (_a = typeof vue.$attrs.root === "function" ? vue.$attrs.root() : vue.$attrs.root) != null ? _a : vue.$root) != null ? _c : (_b = vue.$parent) == null ? void 0 : _b.$root;
|
|
388
|
+
}
|
|
389
|
+
function getProps(props2, param2) {
|
|
390
|
+
var _a;
|
|
391
|
+
const exclude = Array.isArray(param2) || typeof param2 === "string" ? param2 : param2.exclude;
|
|
392
|
+
const exclusions = (Array.isArray(exclude) ? exclude : [exclude]).join("|");
|
|
393
|
+
const include = (_a = param2.include) != null ? _a : {};
|
|
394
|
+
return Object.entries(include).reduce((props3, [key, val]) => {
|
|
395
|
+
props3[key] = val;
|
|
396
|
+
return props3;
|
|
397
|
+
}, Object.entries(props2).reduce((props3, [key, val]) => {
|
|
398
|
+
if (!RegExp(`(^|\\|)${key}($|\\|)`, "i").test(exclusions)) {
|
|
399
|
+
props3[key] = val;
|
|
400
|
+
}
|
|
401
|
+
return props3;
|
|
402
|
+
}, {}));
|
|
403
|
+
}
|
|
404
|
+
function getDate(param1, param2) {
|
|
405
|
+
var _a, _b;
|
|
406
|
+
const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
407
|
+
const format = "MM/dd/yyyy h:mm a";
|
|
408
|
+
const options = typeof param2 === "string" ? { format: param2, timezone } : { format: (_a = param2 == null ? void 0 : param2.format) != null ? _a : format, timezone: (_b = param2 == null ? void 0 : param2.timezone) != null ? _b : timezone };
|
|
409
|
+
const datetime = () => {
|
|
410
|
+
try {
|
|
411
|
+
return param1 instanceof Date ? param1 : param1.toDate();
|
|
412
|
+
} catch (e) {
|
|
413
|
+
return /* @__PURE__ */ new Date();
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
return formatInTimeZone(datetime(), options.timezone, options.format);
|
|
417
|
+
}
|
|
418
|
+
function getRef(component, ref3) {
|
|
419
|
+
safeRequest({
|
|
420
|
+
try: () => __async(this, null, function* () {
|
|
421
|
+
return component.$props.ref.value = component;
|
|
422
|
+
}),
|
|
423
|
+
alternative: false
|
|
424
|
+
});
|
|
425
|
+
return ref3.value = component;
|
|
426
|
+
}
|
|
427
|
+
function expose(vue, props2) {
|
|
428
|
+
Object.entries(Object.getOwnPropertyDescriptors(props2)).forEach(([key, val]) => {
|
|
429
|
+
Object.defineProperty(vue, key, val);
|
|
430
|
+
});
|
|
431
|
+
return props2;
|
|
432
|
+
}
|
|
433
|
+
function getSubscription() {
|
|
434
|
+
const subscriptions = [];
|
|
435
|
+
const subscription = Subscriptions.get();
|
|
436
|
+
return {
|
|
437
|
+
addSubscription(name2, handler = () => false, data) {
|
|
438
|
+
subscription.subscribe(name2, handler, data);
|
|
439
|
+
subscriptions.push(() => subscription.unsubscribe(name2));
|
|
440
|
+
},
|
|
441
|
+
replaceSubscription(name2, handler = () => false, data) {
|
|
442
|
+
subscription.replace(name2, handler, data);
|
|
443
|
+
subscriptions.push(() => subscription.unsubscribe(name2));
|
|
444
|
+
},
|
|
445
|
+
removeSubscriptions() {
|
|
446
|
+
subscriptions.forEach((subscription2) => safeRequest({
|
|
447
|
+
try: () => subscription2()
|
|
448
|
+
}));
|
|
449
|
+
},
|
|
450
|
+
removeSubscription(name2) {
|
|
451
|
+
subscription.unsubscribe(name2);
|
|
452
|
+
},
|
|
453
|
+
hasSubscription(name2) {
|
|
454
|
+
return subscription.hasSubscription(name2);
|
|
455
|
+
},
|
|
456
|
+
subscriptions,
|
|
457
|
+
subscription
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
function access($vue = {}) {
|
|
461
|
+
var _a, _b;
|
|
462
|
+
const target = typeof $vue.access === "function" ? $vue.access() : (_b = (_a = $vue.value && typeof $vue.value.access === "function" ? $vue.value.access() : $vue.value) != null ? _a : $vue) != null ? _b : {};
|
|
463
|
+
return new Proxy(target, {
|
|
464
|
+
get(target2, key) {
|
|
465
|
+
var _a2, _b2;
|
|
466
|
+
const component = { $vue: target2 };
|
|
467
|
+
do {
|
|
468
|
+
if ((_a2 = component.$vue) == null ? void 0 : _a2[key]) {
|
|
469
|
+
return component.$vue[key];
|
|
470
|
+
} else if ((_b2 = component.$vue.self) == null ? void 0 : _b2[key]) {
|
|
471
|
+
return component.$vue.self[key];
|
|
472
|
+
} else {
|
|
473
|
+
component.$vue = component.$vue.parent;
|
|
474
|
+
}
|
|
475
|
+
} while (component.$vue);
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
export {
|
|
480
|
+
AsyncComponent_default as AsyncComponent,
|
|
481
|
+
access,
|
|
482
|
+
src_default as default,
|
|
483
|
+
expose,
|
|
484
|
+
getDate,
|
|
485
|
+
getProps,
|
|
486
|
+
getRef,
|
|
487
|
+
getRoot,
|
|
488
|
+
getSubscription,
|
|
489
|
+
safeRequest,
|
|
490
|
+
setup,
|
|
491
|
+
ucf,
|
|
492
|
+
ucfat
|
|
493
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@razaman2/reactive-view",
|
|
3
|
+
"version": "0.0.1",
|
|
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
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"vue",
|
|
15
|
+
"vue-helper",
|
|
16
|
+
"reactive-view",
|
|
17
|
+
"vue-class-component"
|
|
18
|
+
],
|
|
19
|
+
"author": "razaman2",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@razaman2/data-manager": "^3.2.5",
|
|
23
|
+
"@razaman2/collection-proxy": "^0.0.1",
|
|
24
|
+
"@razaman2/object-manager": "^3.3.7",
|
|
25
|
+
"date-fns": "^2.30.0",
|
|
26
|
+
"date-fns-tz": "^2.0.0",
|
|
27
|
+
"uuid": "^9.0.1",
|
|
28
|
+
"vue": "^3.3.13"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/uuid": "^9.0.7",
|
|
32
|
+
"tsup": "^8.0.1",
|
|
33
|
+
"typescript": "^5.3.3",
|
|
34
|
+
"vitest": "^1.1.0"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"dist"
|
|
41
|
+
],
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "https://github.com/razaman2/reactive-view.git"
|
|
45
|
+
}
|
|
46
|
+
}
|