ivue 0.1.11 → 1.0.0
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/.editorconfig +9 -0
- package/.eslintignore +7 -0
- package/.eslintrc copy.js +120 -0
- package/.eslintrc.js +120 -0
- package/.github/workflows/ci.yml +68 -0
- package/.prettierrc +5 -0
- package/LICENSE +2 -2
- package/README.md +20 -28
- package/demo/App.vue +113 -56
- package/demo/main.ts +5 -19
- package/demo/vite.config.ts +8 -1
- package/docs/.editorconfig +9 -0
- package/docs/.env +1 -0
- package/docs/.eslintignore +7 -0
- package/docs/.eslintrc.js +120 -0
- package/docs/.prettierrc +5 -0
- package/docs/docs/.vitepress/config.ts +56 -0
- package/docs/docs/api/propsWithDefaults.md +0 -0
- package/docs/docs/components/Button.vue +13 -0
- package/docs/docs/components/Component.vue +20 -0
- package/docs/docs/components/examples/Counter.vue +17 -0
- package/docs/docs/index.md +32 -0
- package/docs/docs/pages/getting-started.md +14 -0
- package/docs/docs/pages/how-it-works.md +0 -0
- package/docs/docs/pages/introduction.md +45 -0
- package/docs/docs/pages/usage.md +16 -0
- package/docs/package.json +35 -0
- package/docs/scripts/gh-pages-deploy.js +34 -0
- package/docs/vite-env.d.ts +7 -0
- package/docs/vite.config.ts +20 -0
- package/index.html +5 -4
- package/package.json +46 -61
- package/src/__tests__/ivue.vitest.spec.ts +426 -0
- package/src/index.ts +460 -80
- package/tsconfig.json +21 -11
- package/vite-env.d.ts +7 -0
- package/vite.config.ts +26 -26
- package/vitest.config.ts +13 -12
- package/.babelrc.json +0 -14
- package/.eslintrc.cjs +0 -24
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/compiler.xml +0 -7
- package/.idea/inspectionProfiles/Project_Default.xml +0 -11
- package/.idea/ivue.iml +0 -10
- package/.idea/modules.xml +0 -8
- package/.idea/php.xml +0 -20
- package/.idea/vcs.xml +0 -6
- package/.vscode/extensions.json +0 -3
- package/PLAN.md +0 -39
- package/demo/components/IVueTest.vue +0 -301
- package/demo/components/PreComponent.vue +0 -13
- package/demo/components/SubComponent2.vue +0 -45
- package/demo/components/TraitsComponent.vue +0 -120
- package/demo/components/useIVueTest.vue +0 -136
- package/demo/router/index.ts +0 -14
- package/demo/tests/IVueTests.ts +0 -265
- package/demo/tests/Mouse.ts +0 -79
- package/demo/tests/ParentIVueTests.ts +0 -36
- package/demo/tests/TApp.ts +0 -15
- package/demo/tests/TAuth.ts +0 -23
- package/demo/tests/TField.ts +0 -84
- package/demo/tests/TMessage.ts +0 -52
- package/demo/tests/TRouter.ts +0 -18
- package/demo/tests/TUser.ts +0 -19
- package/demo/tests/Test.ts +0 -86
- package/demo/tests/useField.ts +0 -82
- package/demo/tests/useIVueTests.ts +0 -57
- package/dist/favicon.ico +0 -0
- package/dist/index.es.js +0 -516
- package/dist/index.umd.js +0 -1
- package/dist/src/behavior.d.ts +0 -72
- package/dist/src/config.d.ts +0 -6
- package/dist/src/index.d.ts +0 -21
- package/dist/src/ivue.d.ts +0 -36
- package/dist/src/kernel.d.ts +0 -182
- package/dist/src/traits/UseCapsule.d.ts +0 -9
- package/dist/src/traits/UseEmit.d.ts +0 -3
- package/dist/src/traits/UseInstance.d.ts +0 -6
- package/dist/src/traits/UseMounting.d.ts +0 -11
- package/dist/src/traits/UseRefs.d.ts +0 -8
- package/dist/src/traits/UseRoute.d.ts +0 -3
- package/dist/src/traits/UseRouter.d.ts +0 -3
- package/dist/src/traits/UseRouting.d.ts +0 -6
- package/dist/src/traits/UseTick.d.ts +0 -4
- package/dist/src/traits/UseVue.d.ts +0 -13
- package/dist/src/types/core.d.ts +0 -46
- package/dist/src/utils/dispose-garbage.d.ts +0 -12
- package/dist/src/utils/extend.d.ts +0 -12
- package/dist/src/utils/getters.d.ts +0 -21
- package/dist/src/utils/index.d.ts +0 -7
- package/dist/src/utils/is.d.ts +0 -14
- package/dist/src/utils/pre.d.ts +0 -9
- package/dist/src/utils/raw.d.ts +0 -12
- package/dist/src/utils/safe-class-name.d.ts +0 -7
- package/dist/src/utils/traits.d.ts +0 -41
- package/env.d.ts +0 -1
- package/package-lock.json +0 -14305
- package/public/favicon.ico +0 -0
- package/src/App/App.ts +0 -30
- package/src/App/Auth/Auth.ts +0 -105
- package/src/App/Auth/Auth.vue +0 -98
- package/src/App/Auth/Logout.vue +0 -14
- package/src/App/Auth/User.ts +0 -6
- package/src/App/BlackBox.ts +0 -82
- package/src/App/Config.ts +0 -6
- package/src/App/Generators/generators.ts +0 -47
- package/src/App/Home/Home.vue +0 -16
- package/src/App/Services/Http/FakeHttp.ts +0 -8
- package/src/App/Services/Http/Http.ts +0 -51
- package/src/App/Services/Message/Message.ts +0 -49
- package/src/App/Services/Message/Message.vue +0 -15
- package/src/App/Services/Navigation/Navigation.ts +0 -83
- package/src/App/Services/Navigation/Navigation.vue +0 -59
- package/src/App/Services/Routing/FakeRouter.ts +0 -7
- package/src/App/Services/Routing/NotFoundRoute.vue +0 -13
- package/src/App/Services/Routing/Router.ts +0 -263
- package/src/App/Services/Routing/Routes.ts +0 -49
- package/src/App/Stubs/SingleBookResultStub.ts +0 -13
- package/src/App/Traits/UseApp.ts +0 -6
- package/src/App/Traits/UseQuasar.ts +0 -8
- package/src/behavior.ts +0 -269
- package/src/config.ts +0 -15
- package/src/dev/dev-utils.ts +0 -78
- package/src/ivue.ts +0 -299
- package/src/kernel.ts +0 -815
- package/src/tests/auth.spec.ts +0 -87
- package/src/traits/UseCapsule.ts +0 -28
- package/src/traits/UseEmit.ts +0 -3
- package/src/traits/UseInstance.ts +0 -17
- package/src/traits/UseMounting.ts +0 -23
- package/src/traits/UseRefs.ts +0 -17
- package/src/traits/UseRoute.ts +0 -6
- package/src/traits/UseRouter.ts +0 -5
- package/src/traits/UseRouting.ts +0 -7
- package/src/traits/UseTick.ts +0 -5
- package/src/traits/UseVue.ts +0 -38
- package/src/types/core.ts +0 -66
- package/src/utils/dispose-garbage.ts +0 -34
- package/src/utils/extend.ts +0 -86
- package/src/utils/getters.ts +0 -59
- package/src/utils/index.ts +0 -16
- package/src/utils/is.ts +0 -22
- package/src/utils/pre.ts +0 -29
- package/src/utils/raw.ts +0 -19
- package/src/utils/safe-class-name.ts +0 -15
- package/src/utils/traits.ts +0 -121
- package/tsconfig.app.json +0 -47
- package/tsconfig.node.json +0 -14
- package/tsconfig.vitest.json +0 -9
- /package/{src/App/Traits/UseBlackline.ts → docs/docs/api/ivue.md} +0 -0
package/dist/index.es.js
DELETED
|
@@ -1,516 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => {
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
7
|
-
import { markRaw as t, getCurrentScope as e, effectScope as n, reactive as r, computed as o, onScopeDispose as i, toRef as s, toRaw as u, getCurrentInstance as c, onBeforeMount as a, onMounted as f, onBeforeUnmount as l, onUnmounted as h, toValue as p, nextTick as b } from "vue";
|
|
8
|
-
function g(t2) {
|
|
9
|
-
delete t2.__v_skip;
|
|
10
|
-
}
|
|
11
|
-
function d(e2) {
|
|
12
|
-
return t(e2);
|
|
13
|
-
}
|
|
14
|
-
function y(t2) {
|
|
15
|
-
return t2 && "object" == typeof t2 && !Array.isArray(t2);
|
|
16
|
-
}
|
|
17
|
-
function v(t2, ...e2) {
|
|
18
|
-
return m(t2, [...e2], /* @__PURE__ */ new WeakMap());
|
|
19
|
-
}
|
|
20
|
-
function m(t2, e2, n2 = null) {
|
|
21
|
-
if (!e2.length)
|
|
22
|
-
return t2;
|
|
23
|
-
n2.set(t2, true);
|
|
24
|
-
const r2 = e2.shift();
|
|
25
|
-
if (y(t2) && y(r2))
|
|
26
|
-
for (const e3 in r2)
|
|
27
|
-
y(r2[e3]) && "Object" === r2[e3].constructor.name ? n2.has(r2[e3]) || null !== (o2 = r2[e3]) && "object" == typeof o2 && "function" == typeof o2.then && "function" == typeof o2.catch || void 0 === t2[e3] ? t2[e3] = r2[e3] : y(t2[e3]) && t2[e3].constructor === Object ? m(t2[e3], [r2[e3]], n2) : t2[e3] = r2[e3] : t2[e3] = r2[e3];
|
|
28
|
-
var o2;
|
|
29
|
-
return m(t2, e2, n2);
|
|
30
|
-
}
|
|
31
|
-
function O(t2, e2) {
|
|
32
|
-
const n2 = {}, r2 = Object.getOwnPropertyNames(t2.prototype).reduce((e3, r3) => {
|
|
33
|
-
const o3 = Object.getOwnPropertyDescriptor(t2.prototype, r3);
|
|
34
|
-
let i2 = false;
|
|
35
|
-
return (o3 == null ? void 0 : o3.set) && !(o3 == null ? void 0 : o3.get) && (n2[r3] = o3 == null ? void 0 : o3.set, i2 = true), i2 || (e3[r3] = true), e3;
|
|
36
|
-
}, {}), o2 = {};
|
|
37
|
-
e2.reverse().forEach((e3) => {
|
|
38
|
-
const i2 = new e3(t2);
|
|
39
|
-
for (const e4 in i2)
|
|
40
|
-
e4 in r2 || (o2[e4] = true), e4 in o2 && Object.defineProperty(t2.prototype, e4, { value: i2[e4], writable: true });
|
|
41
|
-
Object.getOwnPropertyNames(e3.prototype).forEach((i3) => {
|
|
42
|
-
if ("constructor" !== i3 && (i3 in r2 || (o2[i3] = true), i3 in o2)) {
|
|
43
|
-
const r3 = Object.getOwnPropertyDescriptor(e3.prototype, i3) || /* @__PURE__ */ Object.create(null);
|
|
44
|
-
(r3 == null ? void 0 : r3.set) && !(i3 in n2) && (n2[i3] = r3 == null ? void 0 : r3.set), (r3 == null ? void 0 : r3.get) && !(r3 == null ? void 0 : r3.set) && i3 in n2 && (r3.set = n2[i3]), Object.defineProperty(t2.prototype, i3, r3);
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
const w = /* @__PURE__ */ new Map();
|
|
50
|
-
function P(t2) {
|
|
51
|
-
if (w.has(t2))
|
|
52
|
-
return w.get(t2);
|
|
53
|
-
const e2 = t2, n2 = [];
|
|
54
|
-
n2.push.apply(n2, Object.entries(Object.getOwnPropertyDescriptors(t2)));
|
|
55
|
-
const r2 = /* @__PURE__ */ new Map();
|
|
56
|
-
for (let t3 = 0; t3 < n2.length; t3++)
|
|
57
|
-
"__proto__" !== n2[t3][0] && "function" == typeof n2[t3][1].get && r2.set(n2[t3][0], n2[t3][1]);
|
|
58
|
-
return w.set(e2, r2), r2;
|
|
59
|
-
}
|
|
60
|
-
function E(t2) {
|
|
61
|
-
let e2 = "";
|
|
62
|
-
try {
|
|
63
|
-
e2 = (t2 == null ? void 0 : t2.name) || String(t2);
|
|
64
|
-
} catch (t3) {
|
|
65
|
-
e2 = "Unknown[failed to convert to string]";
|
|
66
|
-
}
|
|
67
|
-
return e2;
|
|
68
|
-
}
|
|
69
|
-
function F(t2, e2 = 2) {
|
|
70
|
-
const n2 = /* @__PURE__ */ new Set();
|
|
71
|
-
return JSON.stringify(t2, function(t3, e3) {
|
|
72
|
-
if ("object" == typeof e3 && null !== e3) {
|
|
73
|
-
if (n2.has(e3))
|
|
74
|
-
try {
|
|
75
|
-
return JSON.parse(JSON.stringify(e3));
|
|
76
|
-
} catch (t4) {
|
|
77
|
-
return "[**circular**]";
|
|
78
|
-
}
|
|
79
|
-
n2.add(e3);
|
|
80
|
-
}
|
|
81
|
-
return e3;
|
|
82
|
-
}, e2);
|
|
83
|
-
}
|
|
84
|
-
let j = { router: null, debug: false };
|
|
85
|
-
function C(t2 = {}) {
|
|
86
|
-
v(j, t2);
|
|
87
|
-
}
|
|
88
|
-
const S = { before: /* @__PURE__ */ new Map(), after: /* @__PURE__ */ new Map() };
|
|
89
|
-
function k(t2, e2, n2) {
|
|
90
|
-
const r2 = S[t2].get(e2);
|
|
91
|
-
for (let t3 = 0; t3 < (r2 == null ? void 0 : r2.length); t3++)
|
|
92
|
-
if (true === r2[t3](n2, ...n2.args))
|
|
93
|
-
return n2.return;
|
|
94
|
-
}
|
|
95
|
-
function T(t2, e2, n2, r2) {
|
|
96
|
-
var _a;
|
|
97
|
-
S[t2].has(e2) ? (_a = S[t2].get(e2)) == null ? void 0 : _a[r2.top ? "unshift" : "push"](n2) : S[t2].set(e2, [n2]);
|
|
98
|
-
}
|
|
99
|
-
function N(t2, e2) {
|
|
100
|
-
var _a;
|
|
101
|
-
if (Array.isArray(t2)) {
|
|
102
|
-
if ("function" != typeof t2[0])
|
|
103
|
-
throw new Error("ivue.kernel.behavior: Cannot autobind intercept to " + t2[0] + ". Supply a valid Class to autobind behavior.");
|
|
104
|
-
if ("function" == typeof t2[1]) {
|
|
105
|
-
const n2 = t2[1].toString();
|
|
106
|
-
if (!("class" === n2.substring(0, 5))) {
|
|
107
|
-
const r2 = n2.indexOf("(");
|
|
108
|
-
n2.substring(0, r2).split(" "), t2[0].behavior = { ..."object" == typeof t2[0].behavior ? t2[0].behavior : {}, funcName: e2 ? "SCOPED_INTERCEPT" : "INTERCEPT" };
|
|
109
|
-
}
|
|
110
|
-
return t2[1];
|
|
111
|
-
}
|
|
112
|
-
throw new Error('ivue.kernel.behavior: Cannot autobind intercept "' + t2[1] + '" to ' + (((_a = t2[0]) == null ? void 0 : _a.name) ?? t2[0]));
|
|
113
|
-
}
|
|
114
|
-
return t2;
|
|
115
|
-
}
|
|
116
|
-
function _(t2, e2, n2 = { top: false, scoped: false }) {
|
|
117
|
-
T("before", N(t2, n2.scoped), e2, n2);
|
|
118
|
-
}
|
|
119
|
-
function I(t2, e2, n2 = { top: false, scoped: false }) {
|
|
120
|
-
T("after", N(t2, n2.scoped), e2, n2);
|
|
121
|
-
}
|
|
122
|
-
function M(t2, e2, n2, r2, o2) {
|
|
123
|
-
let i2 = S[t2].get(e2.constructor.prototype[n2]);
|
|
124
|
-
for (let t3 = 0; t3 < (i2 == null ? void 0 : i2.length); t3++)
|
|
125
|
-
if (true === i2[t3](o2, ...r2))
|
|
126
|
-
return true;
|
|
127
|
-
i2 = S[t2].get(e2[n2]);
|
|
128
|
-
for (let t3 = 0; t3 < (i2 == null ? void 0 : i2.length); t3++)
|
|
129
|
-
if (true === i2[t3](o2, ...r2))
|
|
130
|
-
return true;
|
|
131
|
-
}
|
|
132
|
-
var R = ((t2) => (t2.SCOPED = "SCOPED", t2.SCOPED_INTERCEPT = "SCOPED_INTERCEPT", t2.INTERCEPT = "INTERCEPT", t2.OFF = "OFF", t2))(R || {});
|
|
133
|
-
function $(t2, e2, n2, r2, o2, i2, s2) {
|
|
134
|
-
let u2;
|
|
135
|
-
if ("SCOPED" === e2)
|
|
136
|
-
return Object.defineProperty(r2, o2, { value: function(...t3) {
|
|
137
|
-
return i2.run(() => u2 = n2.bind(r2)(...t3)), u2;
|
|
138
|
-
}, writable: true, configurable: true, enumerable: false });
|
|
139
|
-
const c2 = (...e3) => (true === M("before", r2, o2, e3, s2 = { mapping: t2, self: r2, return: u2, name: o2, args: e3 }) || (u2 = n2.bind(r2)(...e3), s2.return = u2, M("after", r2, o2, e3, s2)), s2.return);
|
|
140
|
-
switch (e2) {
|
|
141
|
-
case "INTERCEPT":
|
|
142
|
-
return Object.defineProperty(r2, o2, { value: function(...t3) {
|
|
143
|
-
return c2(...t3);
|
|
144
|
-
}, writable: true, configurable: true, enumerable: false });
|
|
145
|
-
case "SCOPED_INTERCEPT":
|
|
146
|
-
return Object.defineProperty(r2, o2, { value: function(...t3) {
|
|
147
|
-
return i2.run(() => u2 = c2(...t3)), u2;
|
|
148
|
-
}, writable: true, configurable: true, enumerable: false });
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
function D(t2, ...s2) {
|
|
152
|
-
let u2 = e(), c2 = n(!!u2), a2 = P(t2.prototype), f2 = a2.size ? {} : null, l2 = new Proxy(r(new t2(...s2)), { get: (t3, e2) => {
|
|
153
|
-
var _a, _b;
|
|
154
|
-
return a2.has(e2) && ((_b = (_a = l2 == null ? void 0 : l2.constructor) == null ? void 0 : _a.behavior) == null ? void 0 : _b[e2]) !== R.OFF && f2 ? (e2 in f2 || (c2 == null ? void 0 : c2.run(() => f2[e2] = o(() => a2.get(e2).get.bind(l2)()))), f2[e2].value) : "toRefs" === e2 ? W(l2, a2, f2, c2) : t3 == null ? void 0 : t3[e2];
|
|
155
|
-
} });
|
|
156
|
-
return "init" in l2 && c2.run(() => l2.init()), u2 && i(() => {
|
|
157
|
-
let t3;
|
|
158
|
-
for (t3 in c2 == null ? void 0 : c2.stop(), l2)
|
|
159
|
-
delete l2[t3];
|
|
160
|
-
for (t3 in f2)
|
|
161
|
-
delete f2[t3];
|
|
162
|
-
u2 = c2 = a2 = f2 = l2 = t3 = null;
|
|
163
|
-
}), l2;
|
|
164
|
-
}
|
|
165
|
-
function x(t2) {
|
|
166
|
-
let o2 = e(), s2 = n(!!o2), u2 = function(t3) {
|
|
167
|
-
const e2 = /* @__PURE__ */ new Map(), n2 = Object.entries(Object.getOwnPropertyDescriptors(t3));
|
|
168
|
-
for (let t4 = 0; t4 < n2.length; t4++)
|
|
169
|
-
"function" == typeof n2[t4][1].get && "__proto__" !== n2[t4][0] && e2.set(n2[t4][0], n2[t4][1]);
|
|
170
|
-
return e2;
|
|
171
|
-
}(t2), c2 = u2.size ? {} : null, a2 = A(r(t2), u2, c2, s2);
|
|
172
|
-
return "init" in a2 && s2.run(() => a2.init()), o2 && i(() => {
|
|
173
|
-
let e2;
|
|
174
|
-
for (e2 in s2 == null ? void 0 : s2.stop(), a2)
|
|
175
|
-
delete a2[e2];
|
|
176
|
-
for (e2 in c2)
|
|
177
|
-
delete c2[e2];
|
|
178
|
-
o2 = s2 = u2 = c2 = t2 = a2 = e2 = null;
|
|
179
|
-
}), a2;
|
|
180
|
-
}
|
|
181
|
-
function A(t2, e2, n2, r2) {
|
|
182
|
-
return new Proxy(t2, { get: (i2, s2) => {
|
|
183
|
-
var _a, _b;
|
|
184
|
-
return e2.has(s2) && ((_b = (_a = t2 == null ? void 0 : t2.constructor) == null ? void 0 : _a.behavior) == null ? void 0 : _b[s2]) !== R.OFF && n2 ? (s2 in n2 || (r2 == null ? void 0 : r2.run(() => n2[s2] = o(() => {
|
|
185
|
-
var _a2;
|
|
186
|
-
return (_a2 = e2.get(s2)) == null ? void 0 : _a2.get.bind(t2)();
|
|
187
|
-
}))), n2[s2].value) : "toRefs" === s2 ? W(t2, e2, n2, r2) : i2 == null ? void 0 : i2[s2];
|
|
188
|
-
} });
|
|
189
|
-
}
|
|
190
|
-
function W(t2, e2, n2, r2) {
|
|
191
|
-
return function(i2) {
|
|
192
|
-
const u2 = {};
|
|
193
|
-
if (Array.isArray(i2) && i2.length)
|
|
194
|
-
for (let c2 = 0; c2 < i2.length; c2++) {
|
|
195
|
-
const a2 = i2[c2];
|
|
196
|
-
e2.has(a2) ? a2 in n2 ? u2[a2] = n2[a2] : r2.run(() => u2[a2] = n2[a2] = o(() => {
|
|
197
|
-
var _a;
|
|
198
|
-
return (_a = e2.get(a2)) == null ? void 0 : _a.get.bind(t2)();
|
|
199
|
-
})) : "function" == typeof t2[a2] ? u2[a2] = t2[a2].bind(t2) : u2[a2] = s(t2, a2);
|
|
200
|
-
}
|
|
201
|
-
else {
|
|
202
|
-
for (const n3 in t2)
|
|
203
|
-
e2.has(n3) || ("function" == typeof t2[n3] ? u2[n3] = t2[n3].bind(t2) : u2[n3] = s(t2, n3));
|
|
204
|
-
e2.forEach((e3, i3) => {
|
|
205
|
-
i3 in n2 ? u2[i3] = n2[i3] : r2.run(() => u2[i3] = n2[i3] = o(() => e3.get.bind(t2)()));
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
return new Proxy(t2, { get: (e3, n3) => n3 in u2 ? u2[n3] : n3 in e3 ? e3[n3].bind(t2) : void 0 });
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
const J = (t2) => {
|
|
212
|
-
let e2 = u(t2), n2 = Object.getOwnPropertyNames(e2);
|
|
213
|
-
for (let t3 = 0; t3 < n2.length; t3++)
|
|
214
|
-
delete e2[n2[t3]];
|
|
215
|
-
e2 = null, n2 = null;
|
|
216
|
-
};
|
|
217
|
-
class z {
|
|
218
|
-
constructor(t2) {
|
|
219
|
-
__publicField(this, "to");
|
|
220
|
-
__publicField(this, "scope", "singleton");
|
|
221
|
-
__publicField(this, "type", "generic");
|
|
222
|
-
__publicField(this, "onInit", K);
|
|
223
|
-
this.from = t2, this.to = t2;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
class U {
|
|
227
|
-
constructor() {
|
|
228
|
-
__publicField(this, "transients", /* @__PURE__ */ new WeakMap());
|
|
229
|
-
__publicField(this, "singletons", /* @__PURE__ */ new WeakMap());
|
|
230
|
-
__publicField(this, "instances", /* @__PURE__ */ new WeakMap());
|
|
231
|
-
__publicField(this, "subscribers", /* @__PURE__ */ new WeakMap());
|
|
232
|
-
__publicField(this, "effectScopes", /* @__PURE__ */ new WeakMap());
|
|
233
|
-
__publicField(this, "current");
|
|
234
|
-
}
|
|
235
|
-
bind(t2) {
|
|
236
|
-
return this.current = new z(t2), this;
|
|
237
|
-
}
|
|
238
|
-
to(t2) {
|
|
239
|
-
return this.current.to = t2, this;
|
|
240
|
-
}
|
|
241
|
-
singleton() {
|
|
242
|
-
return this.current.scope = "singleton", this[this.current.scope + "s"].set(this.current.from, this.current), this;
|
|
243
|
-
}
|
|
244
|
-
transient() {
|
|
245
|
-
return this.current.scope = "transient", this[this.current.scope + "s"].set(this.current.from, this.current), this;
|
|
246
|
-
}
|
|
247
|
-
type(t2) {
|
|
248
|
-
return this.current.type = t2, this;
|
|
249
|
-
}
|
|
250
|
-
ivue() {
|
|
251
|
-
return this.current.type = "ivue", this.current.onInit = () => {
|
|
252
|
-
}, this;
|
|
253
|
-
}
|
|
254
|
-
onInit(t2) {
|
|
255
|
-
return this.current.onInit = t2, this;
|
|
256
|
-
}
|
|
257
|
-
get(t2, ...e2) {
|
|
258
|
-
if (this.instances.has(t2))
|
|
259
|
-
return this.instances.get(t2);
|
|
260
|
-
let n2 = this.singletons.get(t2);
|
|
261
|
-
n2 || (this.bind(t2).singleton(), n2 = this.singletons.get(t2));
|
|
262
|
-
const r2 = n2.onInit(n2, ...e2);
|
|
263
|
-
return this.instances.set(t2, r2), r2;
|
|
264
|
-
}
|
|
265
|
-
make(t2, ...e2) {
|
|
266
|
-
let n2 = this.transients.get(t2);
|
|
267
|
-
return n2 || (this.bind(t2).transient(), n2 = this.transients.get(t2)), n2.onInit(n2, ...e2);
|
|
268
|
-
}
|
|
269
|
-
use(s2, ...u2) {
|
|
270
|
-
let a2, f2, l2, h2, p2, b2, g2, d2 = e();
|
|
271
|
-
console.log("className", s2.name);
|
|
272
|
-
if (this.subscribers.set(s2, (this.subscribers.get(s2) || 0) + 1), d2 && i(() => {
|
|
273
|
-
var _a;
|
|
274
|
-
const t2 = (this.subscribers.get(s2) || 0) - 1;
|
|
275
|
-
if (this.subscribers.set(s2, t2), this.effectScopes.has(s2) && t2 <= 0) {
|
|
276
|
-
let t3;
|
|
277
|
-
if ((_a = this.effectScopes.get(s2)) == null ? void 0 : _a.stop(), l2)
|
|
278
|
-
for (t3 in l2)
|
|
279
|
-
delete l2[t3];
|
|
280
|
-
if (p2)
|
|
281
|
-
for (t3 in p2)
|
|
282
|
-
delete p2[t3];
|
|
283
|
-
if (b2)
|
|
284
|
-
for (t3 in b2)
|
|
285
|
-
delete b2[t3];
|
|
286
|
-
if (g2)
|
|
287
|
-
for (t3 in g2)
|
|
288
|
-
delete g2[t3];
|
|
289
|
-
l2 && J(l2), d2 = a2 = f2 = l2 = p2 = b2 = g2 = t3 = null, this.effectScopes.delete(s2), this.instances.delete(s2), this.subscribers.delete(s2), j.debug && console.log("ivue.kernel: instance deleted:", s2.name);
|
|
290
|
-
}
|
|
291
|
-
}), this.instances.has(s2))
|
|
292
|
-
return this.instances.get(s2);
|
|
293
|
-
{
|
|
294
|
-
if (f2 = this.singletons.get(s2), f2) {
|
|
295
|
-
if ("ivue" !== f2.type)
|
|
296
|
-
throw new Error("ivue.kernel: use(" + E(s2) + ") method should be used only with 'ivue' mappings, use get(" + E(s2) + ") method for standard JavaScript singleton Kernel mappings.");
|
|
297
|
-
} else
|
|
298
|
-
this.bind(s2).singleton().ivue(), f2 = this.singletons.get(s2);
|
|
299
|
-
if (a2 = n(!!d2), this.effectScopes.set(s2, a2), S.before.has(f2.to) && (b2 = { mapping: f2, self: null, return: null, name: f2.to.constructor.name, args: u2 }, true === k("before", f2.to, b2)))
|
|
300
|
-
return this.instances.set(s2, b2.return), b2.return;
|
|
301
|
-
h2 = P(f2.to.prototype), p2 = h2.size ? {} : null;
|
|
302
|
-
let i2 = new Proxy(r(new s2(...u2)), { get: (t2, e2) => {
|
|
303
|
-
var _a, _b;
|
|
304
|
-
return h2.has(e2) && ((_b = (_a = i2 == null ? void 0 : i2.constructor) == null ? void 0 : _a.behavior) == null ? void 0 : _b[e2]) !== R.OFF && p2 ? (e2 in p2 || (a2 == null ? void 0 : a2.run(() => p2[e2] = o(() => h2.get(e2).get.bind(i2)()))), p2[e2].value) : "toRefs" === e2 ? W(i2, h2, p2, a2) : t2 == null ? void 0 : t2[e2];
|
|
305
|
-
} });
|
|
306
|
-
if ("behavior" in i2.constructor) {
|
|
307
|
-
for (const e2 in i2.constructor.behavior)
|
|
308
|
-
if (!h2.has(e2))
|
|
309
|
-
if ("function" == typeof i2[e2]) {
|
|
310
|
-
if (i2.constructor.behavior[e2] === R.OFF)
|
|
311
|
-
continue;
|
|
312
|
-
y(g2) || (g2 = {}), g2[e2] = i2[e2], $(f2, i2.constructor.behavior[e2], g2[e2], i2, e2, a2, b2);
|
|
313
|
-
} else
|
|
314
|
-
i2.constructor.behavior[e2] === R.OFF && (i2 == null ? void 0 : i2[e2]) && "object" == typeof i2[e2] && (i2[e2] = t(i2[e2]));
|
|
315
|
-
}
|
|
316
|
-
return S.after.has(f2.to) && (b2 = { mapping: f2, self: i2, name: f2.to.constructor.name, return: i2, args: u2 }, true === k("after", f2.to, b2)) ? (this.instances.set(s2, b2.return), b2.return) : ("init" in i2 && a2.run(() => i2.init()), this.instances.set(s2, i2), j.debug && console.log("ivue.kernel: instance created:", s2.name, "current scope", e(), "current instance", c()), i2);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
init(s2, ...u2) {
|
|
320
|
-
let c2 = this.transients.get(s2);
|
|
321
|
-
if (c2) {
|
|
322
|
-
if ("ivue" !== c2.type)
|
|
323
|
-
throw new Error("ivue.kernel: init(" + E(s2) + ") method should be used only with 'ivue' mappings, use make(" + E(s2) + ") method for standard JavaScript transient Kernel mappings.");
|
|
324
|
-
} else
|
|
325
|
-
this.bind(s2).transient().ivue(), c2 = this.transients.get(s2);
|
|
326
|
-
let a2, f2, l2, h2 = e(), p2 = n(!!h2);
|
|
327
|
-
if (S.before.has(c2.to) && (a2 = { mapping: c2, self: null, return: null, name: c2.to.constructor.name, args: u2 }, true === k("before", c2.to, a2)))
|
|
328
|
-
return a2.return;
|
|
329
|
-
let b2 = P(c2.to.prototype);
|
|
330
|
-
f2 = b2.size ? {} : null;
|
|
331
|
-
let g2 = new Proxy(r(new s2(...u2)), { get: (t2, e2) => {
|
|
332
|
-
var _a, _b;
|
|
333
|
-
return b2.has(e2) && ((_b = (_a = g2 == null ? void 0 : g2.constructor) == null ? void 0 : _a.behavior) == null ? void 0 : _b[e2]) !== R.OFF && f2 ? (e2 in f2 || (p2 == null ? void 0 : p2.run(() => f2[e2] = o(() => b2.get(e2).get.bind(g2)()))), f2[e2].value) : "toRefs" === e2 ? W(g2, b2, f2, p2) : t2 == null ? void 0 : t2[e2];
|
|
334
|
-
} });
|
|
335
|
-
if ("behavior" in g2.constructor) {
|
|
336
|
-
for (const e2 in g2.constructor.behavior)
|
|
337
|
-
if (!b2.has(e2))
|
|
338
|
-
if ("function" == typeof g2[e2]) {
|
|
339
|
-
if (g2.constructor.behavior[e2] === R.OFF)
|
|
340
|
-
continue;
|
|
341
|
-
y(l2) || (l2 = {}), l2[e2] = g2[e2], $(c2, g2.constructor.behavior[e2], l2[e2], g2, e2, p2, a2);
|
|
342
|
-
} else
|
|
343
|
-
g2.constructor.behavior[e2] === R.OFF && (g2 == null ? void 0 : g2[e2]) && "object" == typeof g2[e2] && (g2[e2] = t(g2[e2]));
|
|
344
|
-
}
|
|
345
|
-
return S.after.has(c2.to) && (a2 = { mapping: c2, self: g2, return: g2, name: c2.to.constructor.name, args: u2 }, true === k("after", c2.to, a2)) ? a2.return : ("init" in g2 && p2.run(() => g2.init()), h2 && i(() => {
|
|
346
|
-
let t2;
|
|
347
|
-
if (p2 == null ? void 0 : p2.stop(), J(g2), a2)
|
|
348
|
-
for (t2 in a2)
|
|
349
|
-
delete a2[t2];
|
|
350
|
-
if (f2)
|
|
351
|
-
for (t2 in f2)
|
|
352
|
-
delete f2[t2];
|
|
353
|
-
if (l2)
|
|
354
|
-
for (t2 in l2)
|
|
355
|
-
delete l2[t2];
|
|
356
|
-
h2 = p2 = g2 = c2 = f2 = a2 = l2 = t2 = null;
|
|
357
|
-
}), g2);
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
function K(t2, ...r2) {
|
|
361
|
-
if (S.before.has(t2.to)) {
|
|
362
|
-
const e2 = { mapping: t2, self: null, return: null, name: t2.to.constructor.name, args: r2 };
|
|
363
|
-
if (true === k("before", t2.to, e2))
|
|
364
|
-
return e2.return;
|
|
365
|
-
}
|
|
366
|
-
let o2, i2 = new t2.to(...r2);
|
|
367
|
-
const s2 = P(t2.to.prototype);
|
|
368
|
-
if ("behavior" in i2.constructor && "object" == typeof i2.constructor.behavior) {
|
|
369
|
-
for (const r3 in i2.constructor.behavior)
|
|
370
|
-
if (!s2.has(r3) && "function" == typeof i2[r3]) {
|
|
371
|
-
if (i2.constructor.behavior[r3] === R.OFF)
|
|
372
|
-
continue;
|
|
373
|
-
y(o2) || (o2 = {}), o2[r3] = i2[r3], $(t2, i2.constructor.behavior[r3], o2[r3], i2, r3, n(!!e()), void 0);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
if (S.after.has(t2.to)) {
|
|
377
|
-
const e2 = { mapping: t2, self: i2, return: i2, name: t2.to.constructor.name, args: r2 };
|
|
378
|
-
if (true === k("after", t2.to, e2))
|
|
379
|
-
return e2.return;
|
|
380
|
-
}
|
|
381
|
-
return i2;
|
|
382
|
-
}
|
|
383
|
-
function q(t2, o2, ...s2) {
|
|
384
|
-
let u2 = n(!!e()), c2 = P(Reflect.getPrototypeOf(o2)), a2 = c2.value ? {} : null, f2 = A(r(Object.create(o2)), c2, a2, u2);
|
|
385
|
-
var l2;
|
|
386
|
-
return "function" == typeof f2.init && u2.run(() => f2.init()), l2 = () => {
|
|
387
|
-
u2 == null ? void 0 : u2.stop(), J(f2), u2 = f2 = null;
|
|
388
|
-
}, e() && i(l2), f2;
|
|
389
|
-
}
|
|
390
|
-
const B = new U(), G = B.bind.bind(B), H = B.get.bind(B), L = B.make.bind(B), Q = B.use.bind(B), V = B.init.bind(B);
|
|
391
|
-
class X {
|
|
392
|
-
constructor() {
|
|
393
|
-
__publicField(this, "$");
|
|
394
|
-
__publicField(this, "capsule");
|
|
395
|
-
}
|
|
396
|
-
useCapsule(e2 = []) {
|
|
397
|
-
this.$ = Q(this.capsule, this, ...e2), t(this.$);
|
|
398
|
-
}
|
|
399
|
-
initCapsule(e2 = []) {
|
|
400
|
-
this.$ = V(this.capsule, this, ...e2), t(this.$);
|
|
401
|
-
}
|
|
402
|
-
getCapsule(t2 = []) {
|
|
403
|
-
this.$ = H(this.capsule, this, ...t2);
|
|
404
|
-
}
|
|
405
|
-
makeCapsule(t2 = []) {
|
|
406
|
-
this.$ = L(this.capsule, this, ...t2);
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
function Y(t2, e2) {
|
|
410
|
-
t2.behavior = v(t2.behavior ?? {}, { $instance: R.OFF });
|
|
411
|
-
}
|
|
412
|
-
class Z {
|
|
413
|
-
get $instance() {
|
|
414
|
-
return c();
|
|
415
|
-
}
|
|
416
|
-
constructor(t2) {
|
|
417
|
-
Y(t2);
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
function tt(t2, e2) {
|
|
421
|
-
I(t2, ({ self: t3 }) => {
|
|
422
|
-
"beforeMount" in t3 && a(() => t3.beforeMount()), "mounted" in t3 && f(() => t3.mounted()), "beforeUnmount" in t3 && l(() => t3.beforeUnmount()), "unmounted" in t3 && h(() => t3.unmounted());
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
class et {
|
|
426
|
-
constructor(t2) {
|
|
427
|
-
__publicField(this, "beforeMount", function() {
|
|
428
|
-
});
|
|
429
|
-
__publicField(this, "mounted", function() {
|
|
430
|
-
});
|
|
431
|
-
__publicField(this, "beforeUnmount", function() {
|
|
432
|
-
});
|
|
433
|
-
__publicField(this, "unmounted", function() {
|
|
434
|
-
});
|
|
435
|
-
tt(t2);
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
function nt(t2, e2) {
|
|
439
|
-
t2.behavior = v(t2.behavior ?? {}, { $refs: R.OFF });
|
|
440
|
-
}
|
|
441
|
-
class rt {
|
|
442
|
-
get $refs() {
|
|
443
|
-
var _a;
|
|
444
|
-
return (_a = c()) == null ? void 0 : _a.refs;
|
|
445
|
-
}
|
|
446
|
-
constructor(t2) {
|
|
447
|
-
nt(t2);
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
class ot {
|
|
451
|
-
get route() {
|
|
452
|
-
var _a;
|
|
453
|
-
return p((_a = j.router) == null ? void 0 : _a.currentRoute);
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
class it {
|
|
457
|
-
get router() {
|
|
458
|
-
return j.router;
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
class st {
|
|
462
|
-
}
|
|
463
|
-
O(st, [it, ot]);
|
|
464
|
-
class ut {
|
|
465
|
-
constructor() {
|
|
466
|
-
__publicField(this, "$emit", (...t2) => {
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
class ct {
|
|
471
|
-
constructor() {
|
|
472
|
-
__publicField(this, "$nextTick", b);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
class at {
|
|
476
|
-
constructor(t2) {
|
|
477
|
-
!function(t3, e2) {
|
|
478
|
-
Y(t3), nt(t3), tt(t3);
|
|
479
|
-
}(t2);
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
O(at, [st, et, ut, ct, rt, Z]);
|
|
483
|
-
export {
|
|
484
|
-
R as IVUE,
|
|
485
|
-
U as Kernel,
|
|
486
|
-
z as Mapping,
|
|
487
|
-
O as Traits,
|
|
488
|
-
X as UseCapsule,
|
|
489
|
-
ut as UseEmit,
|
|
490
|
-
Z as UseInstance,
|
|
491
|
-
et as UseMounting,
|
|
492
|
-
rt as UseRefs,
|
|
493
|
-
ot as UseRoute,
|
|
494
|
-
it as UseRouter,
|
|
495
|
-
st as UseRouting,
|
|
496
|
-
ct as UseTick,
|
|
497
|
-
at as UseVue,
|
|
498
|
-
I as after,
|
|
499
|
-
_ as before,
|
|
500
|
-
G as bind,
|
|
501
|
-
j as config,
|
|
502
|
-
v as extend,
|
|
503
|
-
H as get,
|
|
504
|
-
V as init,
|
|
505
|
-
x as iobj,
|
|
506
|
-
D as ivue,
|
|
507
|
-
q as ivueInversify,
|
|
508
|
-
A as ivueTransform,
|
|
509
|
-
B as kernel,
|
|
510
|
-
L as make,
|
|
511
|
-
F as pre,
|
|
512
|
-
d as raw,
|
|
513
|
-
C as setup,
|
|
514
|
-
g as unraw,
|
|
515
|
-
Q as use
|
|
516
|
-
};
|
package/dist/index.umd.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var __defProp=Object.defineProperty,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__publicField=(e,t,n)=>(__defNormalProp(e,"symbol"!=typeof t?t+"":t,n),n);!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ivue={},e.Vue)}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&!Array.isArray(e)}function r(e,...t){return o(e,[...t],new WeakMap)}function o(e,t,r=null){if(!t.length)return e;r.set(e,!0);const i=t.shift();if(n(e)&&n(i))for(const u in i)n(i[u])&&"Object"===i[u].constructor.name?r.has(i[u])||null!==(s=i[u])&&"object"==typeof s&&"function"==typeof s.then&&"function"==typeof s.catch||void 0===e[u]?e[u]=i[u]:n(e[u])&&e[u].constructor===Object?o(e[u],[i[u]],r):e[u]=i[u]:e[u]=i[u];var s;return o(e,t,r)}function i(e,t){const n={},r=Object.getOwnPropertyNames(e.prototype).reduce(((t,r)=>{const o=Object.getOwnPropertyDescriptor(e.prototype,r);let i=!1;return(null==o?void 0:o.set)&&!(null==o?void 0:o.get)&&(n[r]=null==o?void 0:o.set,i=!0),i||(t[r]=!0),t}),{}),o={};t.reverse().forEach((t=>{const i=new t(e);for(const n in i)n in r||(o[n]=!0),n in o&&Object.defineProperty(e.prototype,n,{value:i[n],writable:!0});Object.getOwnPropertyNames(t.prototype).forEach((i=>{if("constructor"!==i&&(i in r||(o[i]=!0),i in o)){const r=Object.getOwnPropertyDescriptor(t.prototype,i)||Object.create(null);(null==r?void 0:r.set)&&!(i in n)&&(n[i]=null==r?void 0:r.set),(null==r?void 0:r.get)&&!(null==r?void 0:r.set)&&i in n&&(r.set=n[i]),Object.defineProperty(e.prototype,i,r)}}))}))}const s=new Map;function u(e){if(s.has(e))return s.get(e);const t=e,n=[];n.push.apply(n,Object.entries(Object.getOwnPropertyDescriptors(e)));const r=new Map;for(let o=0;o<n.length;o++)"__proto__"!==n[o][0]&&"function"==typeof n[o][1].get&&r.set(n[o][0],n[o][1]);return s.set(t,r),r}function c(e){let t="";try{t=(null==e?void 0:e.name)||String(e)}catch(n){t="Unknown[failed to convert to string]"}return t}let l={router:null,debug:!1};const a={before:new Map,after:new Map};function f(e,t,n){const r=a[e].get(t);for(let o=0;o<(null==r?void 0:r.length);o++)if(!0===r[o](n,...n.args))return n.return}function p(e,t,n,r){var o;a[e].has(t)?null==(o=a[e].get(t))||o[r.top?"unshift":"push"](n):a[e].set(t,[n])}function h(e,t){var n;if(Array.isArray(e)){if("function"!=typeof e[0])throw new Error("ivue.kernel.behavior: Cannot autobind intercept to "+e[0]+". Supply a valid Class to autobind behavior.");if("function"==typeof e[1]){const n=e[1].toString();if("class"!==n.substring(0,5)){const r=n.indexOf("(");n.substring(0,r).split(" "),e[0].behavior={..."object"==typeof e[0].behavior?e[0].behavior:{},funcName:t?"SCOPED_INTERCEPT":"INTERCEPT"}}return e[1]}throw new Error('ivue.kernel.behavior: Cannot autobind intercept "'+e[1]+'" to '+((null==(n=e[0])?void 0:n.name)??e[0]))}return e}function d(e,t,n={top:!1,scoped:!1}){p("after",h(e,n.scoped),t,n)}function b(e,t,n,r,o){let i=a[e].get(t.constructor.prototype[n]);for(let s=0;s<(null==i?void 0:i.length);s++)if(!0===i[s](o,...r))return!0;i=a[e].get(t[n]);for(let s=0;s<(null==i?void 0:i.length);s++)if(!0===i[s](o,...r))return!0}var g,v=((g=v||{}).SCOPED="SCOPED",g.SCOPED_INTERCEPT="SCOPED_INTERCEPT",g.INTERCEPT="INTERCEPT",g.OFF="OFF",g);function m(e,t,n,r,o,i,s){let u;if("SCOPED"===t)return Object.defineProperty(r,o,{value:function(...e){return i.run((()=>u=n.bind(r)(...e))),u},writable:!0,configurable:!0,enumerable:!1});const c=(...t)=>(!0===b("before",r,o,t,s={mapping:e,self:r,return:u,name:o,args:t})||(u=n.bind(r)(...t),s.return=u,b("after",r,o,t,s)),s.return);switch(t){case"INTERCEPT":return Object.defineProperty(r,o,{value:function(...e){return c(...e)},writable:!0,configurable:!0,enumerable:!1});case"SCOPED_INTERCEPT":return Object.defineProperty(r,o,{value:function(...e){return i.run((()=>u=c(...e))),u},writable:!0,configurable:!0,enumerable:!1})}}function y(e,n,r,o){return new Proxy(e,{get:(i,s)=>{var u,c;return n.has(s)&&(null==(c=null==(u=null==e?void 0:e.constructor)?void 0:u.behavior)?void 0:c[s])!==v.OFF&&r?(s in r||(null==o||o.run((()=>r[s]=t.computed((()=>{var t;return null==(t=n.get(s))?void 0:t.get.bind(e)()}))))),r[s].value):"toRefs"===s?_(e,n,r,o):null==i?void 0:i[s]}})}function _(e,n,r,o){return function(i){const s={};if(Array.isArray(i)&&i.length)for(let u=0;u<i.length;u++){const c=i[u];n.has(c)?c in r?s[c]=r[c]:o.run((()=>s[c]=r[c]=t.computed((()=>{var t;return null==(t=n.get(c))?void 0:t.get.bind(e)()})))):"function"==typeof e[c]?s[c]=e[c].bind(e):s[c]=t.toRef(e,c)}else{for(const r in e)n.has(r)||("function"==typeof e[r]?s[r]=e[r].bind(e):s[r]=t.toRef(e,r));n.forEach(((n,i)=>{i in r?s[i]=r[i]:o.run((()=>s[i]=r[i]=t.computed((()=>n.get.bind(e)()))))}))}return new Proxy(e,{get:(t,n)=>n in s?s[n]:n in t?t[n].bind(e):void 0})}}const w=e=>{let n=t.toRaw(e),r=Object.getOwnPropertyNames(n);for(let t=0;t<r.length;t++)delete n[r[t]];n=null,r=null};class O{constructor(e){__publicField(this,"to"),__publicField(this,"scope","singleton"),__publicField(this,"type","generic"),__publicField(this,"onInit",S),this.from=e,this.to=e}}class F{constructor(){__publicField(this,"transients",new WeakMap),__publicField(this,"singletons",new WeakMap),__publicField(this,"instances",new WeakMap),__publicField(this,"subscribers",new WeakMap),__publicField(this,"effectScopes",new WeakMap),__publicField(this,"current")}bind(e){return this.current=new O(e),this}to(e){return this.current.to=e,this}singleton(){return this.current.scope="singleton",this[this.current.scope+"s"].set(this.current.from,this.current),this}transient(){return this.current.scope="transient",this[this.current.scope+"s"].set(this.current.from,this.current),this}type(e){return this.current.type=e,this}ivue(){return this.current.type="ivue",this.current.onInit=()=>{},this}onInit(e){return this.current.onInit=e,this}get(e,...t){if(this.instances.has(e))return this.instances.get(e);let n=this.singletons.get(e);n||(this.bind(e).singleton(),n=this.singletons.get(e));const r=n.onInit(n,...t);return this.instances.set(e,r),r}make(e,...t){let n=this.transients.get(e);return n||(this.bind(e).transient(),n=this.transients.get(e)),n.onInit(n,...t)}use(e,...r){let o,i,s,p,h,d,b,g=t.getCurrentScope();if(console.log("className",e.name),this.subscribers.set(e,(this.subscribers.get(e)||0)+1),g&&t.onScopeDispose((()=>{var t;const n=(this.subscribers.get(e)||0)-1;if(this.subscribers.set(e,n),this.effectScopes.has(e)&&n<=0){let n;if(null==(t=this.effectScopes.get(e))||t.stop(),s)for(n in s)delete s[n];if(h)for(n in h)delete h[n];if(d)for(n in d)delete d[n];if(b)for(n in b)delete b[n];s&&w(s),g=o=i=s=h=d=b=n=null,this.effectScopes.delete(e),this.instances.delete(e),this.subscribers.delete(e),l.debug&&console.log("ivue.kernel: instance deleted:",e.name)}})),this.instances.has(e))return this.instances.get(e);{if(i=this.singletons.get(e),i){if("ivue"!==i.type)throw new Error("ivue.kernel: use("+c(e)+") method should be used only with 'ivue' mappings, use get("+c(e)+") method for standard JavaScript singleton Kernel mappings.")}else this.bind(e).singleton().ivue(),i=this.singletons.get(e);if(o=t.effectScope(!!g),this.effectScopes.set(e,o),a.before.has(i.to)&&(d={mapping:i,self:null,return:null,name:i.to.constructor.name,args:r},!0===f("before",i.to,d)))return this.instances.set(e,d.return),d.return;p=u(i.to.prototype),h=p.size?{}:null;let s=new Proxy(t.reactive(new e(...r)),{get:(e,n)=>{var r,i;return p.has(n)&&(null==(i=null==(r=null==s?void 0:s.constructor)?void 0:r.behavior)?void 0:i[n])!==v.OFF&&h?(n in h||(null==o||o.run((()=>h[n]=t.computed((()=>p.get(n).get.bind(s)()))))),h[n].value):"toRefs"===n?_(s,p,h,o):null==e?void 0:e[n]}});if("behavior"in s.constructor)for(const e in s.constructor.behavior)if(!p.has(e))if("function"==typeof s[e]){if(s.constructor.behavior[e]===v.OFF)continue;n(b)||(b={}),b[e]=s[e],m(i,s.constructor.behavior[e],b[e],s,e,o,d)}else s.constructor.behavior[e]===v.OFF&&(null==s?void 0:s[e])&&"object"==typeof s[e]&&(s[e]=t.markRaw(s[e]));return a.after.has(i.to)&&(d={mapping:i,self:s,name:i.to.constructor.name,return:s,args:r},!0===f("after",i.to,d))?(this.instances.set(e,d.return),d.return):("init"in s&&o.run((()=>s.init())),this.instances.set(e,s),l.debug&&console.log("ivue.kernel: instance created:",e.name,"current scope",t.getCurrentScope(),"current instance",t.getCurrentInstance()),s)}}init(e,...r){let o=this.transients.get(e);if(o){if("ivue"!==o.type)throw new Error("ivue.kernel: init("+c(e)+") method should be used only with 'ivue' mappings, use make("+c(e)+") method for standard JavaScript transient Kernel mappings.")}else this.bind(e).transient().ivue(),o=this.transients.get(e);let i,s,l,p=t.getCurrentScope(),h=t.effectScope(!!p);if(a.before.has(o.to)&&(i={mapping:o,self:null,return:null,name:o.to.constructor.name,args:r},!0===f("before",o.to,i)))return i.return;let d=u(o.to.prototype);s=d.size?{}:null;let b=new Proxy(t.reactive(new e(...r)),{get:(e,n)=>{var r,o;return d.has(n)&&(null==(o=null==(r=null==b?void 0:b.constructor)?void 0:r.behavior)?void 0:o[n])!==v.OFF&&s?(n in s||(null==h||h.run((()=>s[n]=t.computed((()=>d.get(n).get.bind(b)()))))),s[n].value):"toRefs"===n?_(b,d,s,h):null==e?void 0:e[n]}});if("behavior"in b.constructor)for(const u in b.constructor.behavior)if(!d.has(u))if("function"==typeof b[u]){if(b.constructor.behavior[u]===v.OFF)continue;n(l)||(l={}),l[u]=b[u],m(o,b.constructor.behavior[u],l[u],b,u,h,i)}else b.constructor.behavior[u]===v.OFF&&(null==b?void 0:b[u])&&"object"==typeof b[u]&&(b[u]=t.markRaw(b[u]));return a.after.has(o.to)&&(i={mapping:o,self:b,return:b,name:o.to.constructor.name,args:r},!0===f("after",o.to,i))?i.return:("init"in b&&h.run((()=>b.init())),p&&t.onScopeDispose((()=>{let e;if(null==h||h.stop(),w(b),i)for(e in i)delete i[e];if(s)for(e in s)delete s[e];if(l)for(e in l)delete l[e];p=h=b=o=s=i=l=e=null})),b)}}function S(e,...r){if(a.before.has(e.to)){const t={mapping:e,self:null,return:null,name:e.to.constructor.name,args:r};if(!0===f("before",e.to,t))return t.return}let o,i=new e.to(...r);const s=u(e.to.prototype);if("behavior"in i.constructor&&"object"==typeof i.constructor.behavior)for(const u in i.constructor.behavior)if(!s.has(u)&&"function"==typeof i[u]){if(i.constructor.behavior[u]===v.OFF)continue;n(o)||(o={}),o[u]=i[u],m(e,i.constructor.behavior[u],o[u],i,u,t.effectScope(!!t.getCurrentScope()),void 0)}if(a.after.has(e.to)){const t={mapping:e,self:i,return:i,name:e.to.constructor.name,args:r};if(!0===f("after",e.to,t))return t.return}return i}const P=new F,C=P.bind.bind(P),E=P.get.bind(P),j=P.make.bind(P),k=P.use.bind(P),R=P.init.bind(P);function T(e,t){e.behavior=r(e.behavior??{},{$instance:v.OFF})}class I{get $instance(){return t.getCurrentInstance()}constructor(e){T(e)}}function M(e,n){d(e,(({self:e})=>{"beforeMount"in e&&t.onBeforeMount((()=>e.beforeMount())),"mounted"in e&&t.onMounted((()=>e.mounted())),"beforeUnmount"in e&&t.onBeforeUnmount((()=>e.beforeUnmount())),"unmounted"in e&&t.onUnmounted((()=>e.unmounted()))}))}class N{constructor(e){__publicField(this,"beforeMount",(function(){})),__publicField(this,"mounted",(function(){})),__publicField(this,"beforeUnmount",(function(){})),__publicField(this,"unmounted",(function(){})),M(e)}}function U(e,t){e.behavior=r(e.behavior??{},{$refs:v.OFF})}class D{get $refs(){var e;return null==(e=t.getCurrentInstance())?void 0:e.refs}constructor(e){U(e)}}class ${get route(){var e;return t.toValue(null==(e=l.router)?void 0:e.currentRoute)}}class x{get router(){return l.router}}class A{}i(A,[x,$]);class W{constructor(){__publicField(this,"$emit",((...e)=>{}))}}class J{constructor(){__publicField(this,"$nextTick",t.nextTick)}}class z{constructor(e){var t;T(t=e),U(t),M(t)}}i(z,[A,N,W,J,D,I]),e.IVUE=v,e.Kernel=F,e.Mapping=O,e.Traits=i,e.UseCapsule=class{constructor(){__publicField(this,"$"),__publicField(this,"capsule")}useCapsule(e=[]){this.$=k(this.capsule,this,...e),t.markRaw(this.$)}initCapsule(e=[]){this.$=R(this.capsule,this,...e),t.markRaw(this.$)}getCapsule(e=[]){this.$=E(this.capsule,this,...e)}makeCapsule(e=[]){this.$=j(this.capsule,this,...e)}},e.UseEmit=W,e.UseInstance=I,e.UseMounting=N,e.UseRefs=D,e.UseRoute=$,e.UseRouter=x,e.UseRouting=A,e.UseTick=J,e.UseVue=z,e.after=d,e.before=function(e,t,n={top:!1,scoped:!1}){p("before",h(e,n.scoped),t,n)},e.bind=C,e.config=l,e.extend=r,e.get=E,e.init=R,e.iobj=function(e){let n=t.getCurrentScope(),r=t.effectScope(!!n),o=function(e){const t=new Map,n=Object.entries(Object.getOwnPropertyDescriptors(e));for(let r=0;r<n.length;r++)"function"==typeof n[r][1].get&&"__proto__"!==n[r][0]&&t.set(n[r][0],n[r][1]);return t}(e),i=o.size?{}:null,s=y(t.reactive(e),o,i,r);return"init"in s&&r.run((()=>s.init())),n&&t.onScopeDispose((()=>{let t;for(t in null==r||r.stop(),s)delete s[t];for(t in i)delete i[t];n=r=o=i=e=s=t=null})),s},e.ivue=function(e,...n){let r=t.getCurrentScope(),o=t.effectScope(!!r),i=u(e.prototype),s=i.size?{}:null,c=new Proxy(t.reactive(new e(...n)),{get:(e,n)=>{var r,u;return i.has(n)&&(null==(u=null==(r=null==c?void 0:c.constructor)?void 0:r.behavior)?void 0:u[n])!==v.OFF&&s?(n in s||(null==o||o.run((()=>s[n]=t.computed((()=>i.get(n).get.bind(c)()))))),s[n].value):"toRefs"===n?_(c,i,s,o):null==e?void 0:e[n]}});return"init"in c&&o.run((()=>c.init())),r&&t.onScopeDispose((()=>{let e;for(e in null==o||o.stop(),c)delete c[e];for(e in s)delete s[e];r=o=i=s=c=e=null})),c},e.ivueInversify=function(e,n,...r){let o=t.effectScope(!!t.getCurrentScope()),i=u(Reflect.getPrototypeOf(n)),s=i.value?{}:null,c=y(t.reactive(Object.create(n)),i,s,o);var l;return"function"==typeof c.init&&o.run((()=>c.init())),l=()=>{null==o||o.stop(),w(c),o=c=null},t.getCurrentScope()&&t.onScopeDispose(l),c},e.ivueTransform=y,e.kernel=P,e.make=j,e.pre=function(e,t=2){const n=new Set;return JSON.stringify(e,(function(e,t){if("object"==typeof t&&null!==t){if(n.has(t))try{return JSON.parse(JSON.stringify(t))}catch(r){return"[**circular**]"}n.add(t)}return t}),t)},e.raw=function(e){return t.markRaw(e)},e.setup=function(e={}){r(l,e)},e.unraw=function(e){delete e.__v_skip},e.use=k,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/src/behavior.d.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { type EffectScope } from 'vue';
|
|
2
|
-
import { Mapping } from './kernel';
|
|
3
|
-
import type { AnyClass, Class } from './types/core';
|
|
4
|
-
import type { Intercept, InterceptsMap, InterceptFn, InterceptOptions, InterceptAttachTo } from './types/core';
|
|
5
|
-
/**
|
|
6
|
-
* Hash maps for all available intercept methods.
|
|
7
|
-
*/
|
|
8
|
-
export declare const intercepts: InterceptsMap;
|
|
9
|
-
/**
|
|
10
|
-
* Run intercept attached to the Class constructor.
|
|
11
|
-
*
|
|
12
|
-
* @param type
|
|
13
|
-
* @param mapping
|
|
14
|
-
* @param intercept
|
|
15
|
-
* @return
|
|
16
|
-
*/
|
|
17
|
-
export declare function interceptConstructor(type: keyof InterceptsMap, obj: any, intercept: Intercept): any;
|
|
18
|
-
/**
|
|
19
|
-
* Function to run before an interceptable method in ivue.
|
|
20
|
-
*
|
|
21
|
-
* @param fn
|
|
22
|
-
* @param callback
|
|
23
|
-
* @param opts
|
|
24
|
-
*/
|
|
25
|
-
export declare function before(to: InterceptAttachTo, callback: InterceptFn, opts?: InterceptOptions): void;
|
|
26
|
-
/**
|
|
27
|
-
* Function to run after an interceptable method in ivue.
|
|
28
|
-
*
|
|
29
|
-
* @param fn
|
|
30
|
-
* @param callback
|
|
31
|
-
* @param opts
|
|
32
|
-
*/
|
|
33
|
-
export declare function after(to: InterceptAttachTo, callback: InterceptFn, opts?: InterceptOptions): void;
|
|
34
|
-
/**
|
|
35
|
-
* Run method intercepts.
|
|
36
|
-
*
|
|
37
|
-
* @param type
|
|
38
|
-
* @param self
|
|
39
|
-
* @param prop
|
|
40
|
-
* @param args
|
|
41
|
-
* @param intercept
|
|
42
|
-
*/
|
|
43
|
-
export declare function interceptMethod(type: keyof InterceptsMap, self: Class, prop: string, args: any[], intercept: Intercept): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Behavior definitions:
|
|
46
|
-
*
|
|
47
|
-
* SCOPED: Allows watch(), computed(), watchEffect() to be auto garbage collected.
|
|
48
|
-
*
|
|
49
|
-
* SCOPED_INTERCEPT: Allows scoping AND before & after method intercepts.
|
|
50
|
-
*
|
|
51
|
-
* INTERCEPT: Allows before & after method intercepts only,
|
|
52
|
-
* watch(), computed(), watchEffect() will NOT be garbage collected.
|
|
53
|
-
*
|
|
54
|
-
* OFF: For objects -> makes them markRaw() non-reactive,
|
|
55
|
-
* For getters -> makes them non-computed normal getters.
|
|
56
|
-
*/
|
|
57
|
-
export declare enum IVUE {
|
|
58
|
-
SCOPED = "SCOPED",
|
|
59
|
-
SCOPED_INTERCEPT = "SCOPED_INTERCEPT",
|
|
60
|
-
INTERCEPT = "INTERCEPT",
|
|
61
|
-
OFF = "OFF"
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Override function depending on behavior type.
|
|
65
|
-
* @see IVUE
|
|
66
|
-
*
|
|
67
|
-
* @param type
|
|
68
|
-
* @param func
|
|
69
|
-
* @param self
|
|
70
|
-
* @param prop
|
|
71
|
-
*/
|
|
72
|
-
export declare function changeMethodBehavior<T extends AnyClass>(mapping: Mapping, type: IVUE, func: Function, self: Class, prop: string, scope: EffectScope, intercept: Intercept): Class;
|
package/dist/src/config.d.ts
DELETED
package/dist/src/index.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Null, AnyObj, AnyClass, Class, Params, IVue, IVueToRefs, IVueToRefsObj, MappingScope, MappingType, InferredArgs, Getters, InterceptsMap, Intercept, InterceptOptions, InterceptsFns, InterceptFn, InterceptAttachTo } from "./types/core";
|
|
2
|
-
import { config, setup } from "./config";
|
|
3
|
-
import { ivue, iobj, ivueTransform } from "./ivue";
|
|
4
|
-
import { Mapping, Kernel, kernel, ivueInversify, bind, get, make, use, init } from "./kernel";
|
|
5
|
-
import { IVUE, after, before } from "./behavior";
|
|
6
|
-
import { raw, unraw, Traits, extend, pre } from "./utils";
|
|
7
|
-
import { UseCapsule } from './traits/UseCapsule';
|
|
8
|
-
import { UseInstance } from './traits/UseInstance';
|
|
9
|
-
import { UseMounting } from './traits/UseMounting';
|
|
10
|
-
import { UseRefs } from './traits/UseRefs';
|
|
11
|
-
import { UseRoute } from './traits/UseRoute';
|
|
12
|
-
import { UseRouter } from './traits/UseRouter';
|
|
13
|
-
import { UseRouting } from './traits/UseRouting';
|
|
14
|
-
import { UseEmit } from './traits/UseEmit';
|
|
15
|
-
import { UseTick } from './traits/UseTick';
|
|
16
|
-
import { UseVue } from './traits/UseVue';
|
|
17
|
-
export { config, setup, ivue, iobj, ivueTransform, Mapping, // class
|
|
18
|
-
Kernel, // class
|
|
19
|
-
ivueInversify, kernel, bind, get, make, use, init, IVUE, // enum
|
|
20
|
-
before, after, UseCapsule, UseEmit, UseInstance, UseMounting, UseRefs, UseRoute, UseRouter, UseRouting, UseTick, UseVue, raw, unraw, Traits, extend, pre };
|
|
21
|
-
export type { Null, AnyObj, AnyClass, Class, Params, IVue, IVueToRefs, IVueToRefsObj, MappingScope, MappingType, InferredArgs, Getters, InterceptsMap, Intercept, InterceptOptions, InterceptsFns, InterceptFn, InterceptAttachTo, };
|