ivue 0.0.32 → 0.1.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/.babelrc.json +14 -0
- package/.eslintrc.cjs +24 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/compiler.xml +7 -0
- package/.idea/infinite-vue.iml +10 -0
- package/.idea/inspectionProfiles/Project_Default.xml +11 -0
- package/.idea/modules.xml +8 -0
- package/.idea/php.xml +20 -0
- package/.idea/vcs.xml +6 -0
- package/.vscode/extensions.json +3 -0
- package/LICENSE +19 -0
- package/README.md +31 -0
- package/demo/App.vue +72 -0
- package/demo/components/IVueTest.vue +298 -0
- package/demo/components/PreComponent.vue +13 -0
- package/demo/components/SubComponent2.vue +45 -0
- package/demo/components/TraitsComponent.vue +120 -0
- package/demo/components/useIVueTest.vue +136 -0
- package/demo/main.ts +21 -0
- package/demo/router/index.ts +14 -0
- package/demo/tests/IVueTests.ts +255 -0
- package/demo/tests/Mouse.ts +79 -0
- package/demo/tests/ParentIVueTests.ts +36 -0
- package/demo/tests/TApp.ts +15 -0
- package/demo/tests/TAuth.ts +23 -0
- package/demo/tests/TField.ts +84 -0
- package/demo/tests/TMessage.ts +52 -0
- package/demo/tests/TRouter.ts +18 -0
- package/demo/tests/TUser.ts +19 -0
- package/demo/tests/Test.ts +86 -0
- package/demo/tests/useField.ts +82 -0
- package/demo/tests/useIVueTests.ts +57 -0
- package/demo/vite.config.ts +13 -0
- package/dist/favicon.ico +0 -0
- package/dist/index.es.js +518 -0
- package/dist/index.umd.js +1 -0
- package/dist/src/behavior.d.ts +72 -0
- package/dist/src/config.d.ts +6 -0
- package/dist/src/index.d.ts +21 -0
- package/dist/src/ivue.d.ts +35 -0
- package/dist/src/kernel.d.ts +182 -0
- package/dist/src/traits/UseCapsule.d.ts +9 -0
- package/dist/src/traits/UseEmit.d.ts +3 -0
- package/dist/src/traits/UseInstance.d.ts +6 -0
- package/dist/src/traits/UseMounting.d.ts +11 -0
- package/dist/src/traits/UseRefs.d.ts +8 -0
- package/dist/src/traits/UseRoute.d.ts +3 -0
- package/dist/src/traits/UseRouter.d.ts +3 -0
- package/dist/src/traits/UseRouting.d.ts +6 -0
- package/dist/src/traits/UseTick.d.ts +4 -0
- package/dist/src/traits/UseVue.d.ts +13 -0
- package/dist/src/types/core.d.ts +46 -0
- package/dist/src/utils/dispose-garbage.d.ts +12 -0
- package/dist/src/utils/extend.d.ts +12 -0
- package/dist/src/utils/getters.d.ts +21 -0
- package/dist/src/utils/index.d.ts +7 -0
- package/dist/src/utils/is.d.ts +14 -0
- package/dist/src/utils/pre.d.ts +9 -0
- package/dist/src/utils/raw.d.ts +12 -0
- package/dist/src/utils/safe-class-name.d.ts +7 -0
- package/dist/src/utils/traits.d.ts +41 -0
- package/env.d.ts +1 -0
- package/index.html +13 -0
- package/package-lock.json +14305 -0
- package/package.json +89 -10
- package/public/favicon.ico +0 -0
- package/src/App/App.ts +27 -0
- package/src/App/Auth/Auth.ts +105 -0
- package/src/App/Auth/Auth.vue +98 -0
- package/src/App/Auth/Logout.vue +14 -0
- package/src/App/Auth/User.ts +6 -0
- package/src/App/BlackBox.ts +75 -0
- package/src/App/Config.ts +6 -0
- package/src/App/Generators/generators.ts +47 -0
- package/src/App/Home/Home.vue +16 -0
- package/src/App/Services/Http/FakeHttp.ts +8 -0
- package/src/App/Services/Http/Http.ts +51 -0
- package/src/App/Services/Message/Message.ts +49 -0
- package/src/App/Services/Message/Message.vue +15 -0
- package/src/App/Services/Navigation/Navigation.ts +83 -0
- package/src/App/Services/Navigation/Navigation.vue +59 -0
- package/src/App/Services/Routing/FakeRouter.ts +7 -0
- package/src/App/Services/Routing/NotFoundRoute.vue +13 -0
- package/src/App/Services/Routing/Router.ts +262 -0
- package/src/App/Services/Routing/Routes.ts +49 -0
- package/src/App/Stubs/SingleBookResultStub.ts +13 -0
- package/src/App/Traits/UseApp.ts +6 -0
- package/src/App/Traits/UseBlackline.ts +0 -0
- package/src/App/Traits/UseQuasar.ts +8 -0
- package/src/behavior.ts +269 -0
- package/src/config.ts +15 -0
- package/src/dev/dev-utils.ts +78 -0
- package/src/index.ts +83 -0
- package/src/ivue.ts +296 -0
- package/src/kernel.ts +810 -0
- package/src/tests/auth.spec.ts +48 -0
- package/src/traits/UseCapsule.ts +28 -0
- package/src/traits/UseEmit.ts +3 -0
- package/src/traits/UseInstance.ts +17 -0
- package/src/traits/UseMounting.ts +23 -0
- package/src/traits/UseRefs.ts +17 -0
- package/src/traits/UseRoute.ts +6 -0
- package/src/traits/UseRouter.ts +5 -0
- package/src/traits/UseRouting.ts +7 -0
- package/src/traits/UseTick.ts +5 -0
- package/src/traits/UseVue.ts +38 -0
- package/src/types/core.ts +64 -0
- package/src/utils/dispose-garbage.ts +34 -0
- package/src/utils/extend.ts +85 -0
- package/src/utils/getters.ts +62 -0
- package/src/utils/index.ts +16 -0
- package/src/utils/is.ts +22 -0
- package/src/utils/pre.ts +29 -0
- package/src/utils/raw.ts +19 -0
- package/src/utils/safe-class-name.ts +15 -0
- package/src/utils/traits.ts +121 -0
- package/tsconfig.app.json +47 -0
- package/tsconfig.json +14 -0
- package/tsconfig.node.json +14 -0
- package/tsconfig.vitest.json +9 -0
- package/vite.config.ts +55 -0
- package/vitest.config.ts +18 -0
- package/dist/index.js +0 -218
- package/docs/index.html +0 -195
- package/docs/index.json +0 -3
- package/docs/input.html +0 -41
- package/docs/items.html +0 -42
- package/gulpfile.js +0 -5
- package/src/components/checkbox.js +0 -47
- package/src/components/data.js +0 -6
- package/src/components/file.js +0 -40
- package/src/components/form.js +0 -7
- package/src/components/index.js +0 -15
- package/src/components/input.js +0 -80
- package/src/components/items.js +0 -65
- package/src/components/modal.js +0 -42
- package/src/components/paginate-old.js +0 -88
- package/src/components/paginate.js +0 -35
- package/src/components/select-search.js +0 -152
- package/src/components/select.js +0 -62
- package/src/components/submit.js +0 -10
- package/src/components/textarea.js +0 -72
- package/src/components/upload.js +0 -49
- package/src/directives/href.js +0 -10
- package/src/directives/index.js +0 -1
- package/src/filters/date.js +0 -3
- package/src/filters/datetime.js +0 -3
- package/src/filters/index.js +0 -4
- package/src/filters/json.js +0 -3
- package/src/filters/money.js +0 -3
- package/src/index.js +0 -4
- package/src/mixins/data.js +0 -13
- package/src/mixins/form.js +0 -85
- package/src/mixins/resource.js +0 -31
- package/src/services/client.js +0 -32
- package/src/services/flash.js +0 -17
- package/src/services/index.js +0 -2
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { Traits } from '@/index';
|
|
3
|
+
|
|
4
|
+
class Trait1 {
|
|
5
|
+
get prop () { return 1 }
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
class Trait2 {
|
|
9
|
+
get prop () { return 2 }
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
class Trait3 {
|
|
13
|
+
get prop () { return 3 }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
class TestTraits {
|
|
17
|
+
prop = 0
|
|
18
|
+
}
|
|
19
|
+
Traits(TestTraits, [Trait3, Trait2, Trait1])
|
|
20
|
+
const t = new TestTraits()
|
|
21
|
+
console.log('traits t.prop is 0', t.prop === 0)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class TestTraits2 {}
|
|
25
|
+
Traits(TestTraits2, [Trait3, Trait2, Trait1])
|
|
26
|
+
const t2 = new TestTraits2()
|
|
27
|
+
console.log('traits t2.prop is 3', t2.prop, t2.prop === 3)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class TestTraits3 {
|
|
31
|
+
get prop () { return 0 }
|
|
32
|
+
}
|
|
33
|
+
Traits(TestTraits3, [Trait3, Trait2, Trait1])
|
|
34
|
+
const t3 = new TestTraits3()
|
|
35
|
+
console.log('traits t3.prop is 0', t3.prop, t3.prop === 0)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class TestTraits4 {
|
|
39
|
+
set prop (v) { return v }
|
|
40
|
+
}
|
|
41
|
+
Traits(TestTraits4, [Trait3, Trait2, Trait1])
|
|
42
|
+
const t4 = new TestTraits4()
|
|
43
|
+
console.log('traits t4.prop is 3', t4.prop, t4.prop === 3)
|
|
44
|
+
|
|
45
|
+
{
|
|
46
|
+
|
|
47
|
+
class Trait1 {
|
|
48
|
+
_prop = 1
|
|
49
|
+
get prop () { return 1 }
|
|
50
|
+
set prop (v) { this._prop = v }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
class Trait2 {
|
|
54
|
+
_prop = 2
|
|
55
|
+
get prop () { return this._prop }
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
class Trait3 {
|
|
59
|
+
_prop = 3
|
|
60
|
+
get prop () { return this._prop }
|
|
61
|
+
}
|
|
62
|
+
class TestTraits5 {}
|
|
63
|
+
Traits(TestTraits5, [Trait3, Trait2, Trait1])
|
|
64
|
+
const t5 = new TestTraits5()
|
|
65
|
+
t5.prop = 5
|
|
66
|
+
console.log('traits t5.prop is 5', t5.prop, t5.prop === 5)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
{
|
|
70
|
+
class Trait1 {
|
|
71
|
+
_prop = 1
|
|
72
|
+
get prop () { return 1 }
|
|
73
|
+
set prop (v) { this._prop = v }
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
class Trait2 {
|
|
77
|
+
_prop = 2
|
|
78
|
+
get prop () { return this._prop }
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
class Trait3 {
|
|
82
|
+
_prop = 3
|
|
83
|
+
get prop () { return this._prop }
|
|
84
|
+
}
|
|
85
|
+
class TestTraits6 {
|
|
86
|
+
set prop (v) { this._prop = 6 }
|
|
87
|
+
}
|
|
88
|
+
Traits(TestTraits6, [Trait3, Trait2, Trait1])
|
|
89
|
+
const t6 = new TestTraits6()
|
|
90
|
+
t6.prop = 5 // should not set to 5 but 6
|
|
91
|
+
console.log('traits t6.prop is 6', t6.prop, t6.prop === 6)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
{
|
|
95
|
+
class Trait1 {
|
|
96
|
+
_prop = 1
|
|
97
|
+
get prop () { return 1 }
|
|
98
|
+
set prop (v) { this._prop = v }
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
class Trait2 {
|
|
102
|
+
_prop = 2
|
|
103
|
+
get prop () { return this._prop }
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
class Trait3 {
|
|
107
|
+
_prop = 3
|
|
108
|
+
get prop () { return this._prop }
|
|
109
|
+
set prop (v) { this._prop = 7 }
|
|
110
|
+
}
|
|
111
|
+
class TestTraits {}
|
|
112
|
+
Traits(TestTraits, [Trait3, Trait2, Trait1])
|
|
113
|
+
const t = new TestTraits()
|
|
114
|
+
t.prop = 5 // should not set to 5 but 7
|
|
115
|
+
console.log('traits t7.prop is 6', t.prop, t.prop === 7)
|
|
116
|
+
}
|
|
117
|
+
</script>
|
|
118
|
+
<template>
|
|
119
|
+
|
|
120
|
+
</template>
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useIVueTests } from '../tests/useIVueTests';
|
|
3
|
+
import { pre } from '@/utils';
|
|
4
|
+
let vm = useIVueTests()
|
|
5
|
+
const hugeId = 200
|
|
6
|
+
|
|
7
|
+
</script>
|
|
8
|
+
<template>
|
|
9
|
+
<div style="width:900px; margin:0 auto;">
|
|
10
|
+
|
|
11
|
+
<h1>Composable test</h1>
|
|
12
|
+
<!-- <vue-dd v-model="vm" get-all-properties/>-->
|
|
13
|
+
{{ vm.msToTime(vm.timeTaken.value) }}
|
|
14
|
+
<br />
|
|
15
|
+
{{ vm.app.router }}
|
|
16
|
+
{{ pre(vm.transientFields.value[0].app.router) }}
|
|
17
|
+
<br />
|
|
18
|
+
{{ vm.transientFields.value[10].x }}
|
|
19
|
+
<input type="text" v-model="vm.app.user.email" />
|
|
20
|
+
<br />
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
<style>
|
|
24
|
+
.rendererParent {
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 580px;
|
|
27
|
+
border: 1px solid black;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
h1,
|
|
31
|
+
h2,
|
|
32
|
+
h3,
|
|
33
|
+
h4 {
|
|
34
|
+
font-family: Arial;
|
|
35
|
+
margin: 10px 0;
|
|
36
|
+
padding: 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
h1 {
|
|
40
|
+
font-size: 24px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
h2 {
|
|
44
|
+
font-size: 18px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
h3 {
|
|
48
|
+
font-size: 16px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
h4 {
|
|
52
|
+
font-size: 14px;
|
|
53
|
+
margin: 0 5px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
body {
|
|
57
|
+
font-family: Arial;
|
|
58
|
+
font-size: 14px;
|
|
59
|
+
line-height: 200%;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.body {
|
|
63
|
+
max-width: 1000px;
|
|
64
|
+
margin: 0 auto;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.section {
|
|
68
|
+
padding: 5px 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.section-alt {
|
|
72
|
+
padding: 15px;
|
|
73
|
+
background: #edf1f6;
|
|
74
|
+
border-radius: 10px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
button {
|
|
78
|
+
color: #eee;
|
|
79
|
+
border-radius: 5px;
|
|
80
|
+
border: 0;
|
|
81
|
+
font-size: 16px;
|
|
82
|
+
background: #0075d3;
|
|
83
|
+
margin: 1px 3px;
|
|
84
|
+
padding: 4px 7px;
|
|
85
|
+
display: inline-block;
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
button:hover {
|
|
90
|
+
background: #08277a;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
button.pass:hover {
|
|
94
|
+
background: green;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
button.fail:hover {
|
|
98
|
+
background: red;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
button:active {
|
|
102
|
+
background: #294dab;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
input {
|
|
106
|
+
color: #333;
|
|
107
|
+
border-radius: 5px;
|
|
108
|
+
border: 0;
|
|
109
|
+
width: 250px;
|
|
110
|
+
font-size: 16px;
|
|
111
|
+
background: #eee;
|
|
112
|
+
border: 1px solid #0075d3;
|
|
113
|
+
margin: 1px 3px;
|
|
114
|
+
padding: 4px 7px;
|
|
115
|
+
display: inline-block;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.mr-10 {
|
|
119
|
+
margin-right: 10px;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.pass {
|
|
123
|
+
background: #00c200;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.fail {
|
|
127
|
+
background: #c00606
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
td.label {
|
|
131
|
+
text-align: right;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
td.value {
|
|
135
|
+
padding-left: 20px;
|
|
136
|
+
}</style>
|
package/demo/main.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createApp } from "vue";
|
|
2
|
+
import { VueDd } from 'vue-dd'
|
|
3
|
+
|
|
4
|
+
import { setup, use } from '@/index'
|
|
5
|
+
|
|
6
|
+
import AppComponent from "./App.vue";
|
|
7
|
+
import { App } from '@/App/App';
|
|
8
|
+
import { Auth } from '@/App/Auth/Auth';
|
|
9
|
+
|
|
10
|
+
const app = use(App).load()
|
|
11
|
+
setup({ router: app.router, debug: true })
|
|
12
|
+
|
|
13
|
+
use(Auth)
|
|
14
|
+
|
|
15
|
+
const vue = createApp(AppComponent);
|
|
16
|
+
|
|
17
|
+
vue.use(app.router)
|
|
18
|
+
|
|
19
|
+
vue.component('VueDd', VueDd)
|
|
20
|
+
|
|
21
|
+
vue.mount("#app");
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createRouter, createWebHistory } from 'vue-router'
|
|
2
|
+
|
|
3
|
+
const router = createRouter({
|
|
4
|
+
history: createWebHistory(import.meta.env.BASE_URL),
|
|
5
|
+
routes: [
|
|
6
|
+
{
|
|
7
|
+
path: '/',
|
|
8
|
+
name: 'home',
|
|
9
|
+
component: () => import('../App.vue'),
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export default router
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
|
|
2
|
+
import { TAuth } from './TAuth'
|
|
3
|
+
import { TApp } from "./TApp";
|
|
4
|
+
import { TMessage } from './TMessage'
|
|
5
|
+
import { TRouter } from './TRouter'
|
|
6
|
+
import { ParentIVueTests } from "./ParentIVueTests";
|
|
7
|
+
import { onUnmounted, toRaw, watch, onBeforeUnmount } from "vue";
|
|
8
|
+
import { generateHugeArray } from "@/App/Generators/generators";
|
|
9
|
+
import { TField } from "./TField";
|
|
10
|
+
import { use, init, IVUE, unraw, before, ivue } from "@/index";
|
|
11
|
+
|
|
12
|
+
export class IVueTests extends ParentIVueTests {
|
|
13
|
+
|
|
14
|
+
static behavior = {
|
|
15
|
+
init: IVUE.SCOPED_INTERCEPT,
|
|
16
|
+
nonReactiveProp: IVUE.OFF
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
get auth () { return use(TAuth) }
|
|
20
|
+
|
|
21
|
+
get app () { return use(TApp) }
|
|
22
|
+
|
|
23
|
+
get router () { return use(TRouter) }
|
|
24
|
+
|
|
25
|
+
private _x = 1
|
|
26
|
+
|
|
27
|
+
get x () {
|
|
28
|
+
return this._x
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
set x (v) {
|
|
32
|
+
this._x = v
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
array = [1, 2, 3]
|
|
36
|
+
|
|
37
|
+
object = {
|
|
38
|
+
prop: {
|
|
39
|
+
prop: {
|
|
40
|
+
prop: 1
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
constructor (public primitive = 100) {
|
|
46
|
+
super()
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
transientField1!: TField
|
|
50
|
+
|
|
51
|
+
transientField2!: TField
|
|
52
|
+
|
|
53
|
+
transientField3!: TField
|
|
54
|
+
|
|
55
|
+
transientFields: TField[] | null = []
|
|
56
|
+
|
|
57
|
+
init () {
|
|
58
|
+
|
|
59
|
+
watch(() => this.primitive, newValue => {
|
|
60
|
+
if (newValue === 10) {
|
|
61
|
+
console.log('watch matched value: 10 =', newValue)
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
// before(Field.prototype.init, (intercept, self) => {
|
|
66
|
+
// console.log('before init of prototype of Field', 'this', self)
|
|
67
|
+
// // return false
|
|
68
|
+
// })
|
|
69
|
+
|
|
70
|
+
// TField.behavior = {
|
|
71
|
+
// ...Field.behavior,
|
|
72
|
+
// interceptable: IVUE.INTERCEPT
|
|
73
|
+
// }
|
|
74
|
+
|
|
75
|
+
this.transientField3 = ivue(TField, 11)
|
|
76
|
+
console.log('this.transientField3', this.transientField3)
|
|
77
|
+
|
|
78
|
+
this.transientField1 = ivue(TField, 23)
|
|
79
|
+
this.transientField2 = ivue(TField, 5)
|
|
80
|
+
|
|
81
|
+
this.timeTaken = 0
|
|
82
|
+
|
|
83
|
+
const start = Date.now();
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
for (let i = 0; i < 50_000; i++) {
|
|
87
|
+
// this.transientFields.push(ivueMake(new Field(i)))
|
|
88
|
+
this.transientFields.push(init(TField))
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
console.log('this.transientFields.length', this.transientFields.length)
|
|
92
|
+
this.timeTaken = Date.now() - start;
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
const interval = setInterval(() => {
|
|
96
|
+
this.transientFields[10].x++
|
|
97
|
+
}, 1000)
|
|
98
|
+
onBeforeUnmount(() => {
|
|
99
|
+
console.log('unload the fields')
|
|
100
|
+
|
|
101
|
+
clearInterval(interval)
|
|
102
|
+
|
|
103
|
+
// if ('transientFields' in this) this.transientFields = null
|
|
104
|
+
// this.transientFields = null
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
console.log('this.transientField1', this.transientField1)
|
|
108
|
+
console.log('this.transientField2', this.transientField2)
|
|
109
|
+
|
|
110
|
+
before(this.transientField1.init, (intercept, self) => {
|
|
111
|
+
console.log('before init of Field', self)
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
// before(Field.prototype.interceptable, (intercept, self) => {
|
|
115
|
+
// console.log('before interceptable of Field', self)
|
|
116
|
+
// })
|
|
117
|
+
|
|
118
|
+
this.transientField1.interceptable()
|
|
119
|
+
|
|
120
|
+
// this.transientField1.init()
|
|
121
|
+
// this.transientField2.init()
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
// watch(this, (state) => {
|
|
125
|
+
// console.log('changed', state)
|
|
126
|
+
// })
|
|
127
|
+
|
|
128
|
+
//
|
|
129
|
+
// before(Field.prototype.runWithIntercept, (intercept, self, ...[var1]) => {
|
|
130
|
+
//
|
|
131
|
+
// intercept.return = 'Prototype intercept'
|
|
132
|
+
//
|
|
133
|
+
// self.prop++
|
|
134
|
+
// console.log('var1', var1)
|
|
135
|
+
// return false
|
|
136
|
+
// })
|
|
137
|
+
|
|
138
|
+
// before(this.transientField2.runWithIntercept, (intercept, self: Field) => {
|
|
139
|
+
// intercept.return = 'Awesome'
|
|
140
|
+
// return false
|
|
141
|
+
// })
|
|
142
|
+
//
|
|
143
|
+
// after(this.transientField2.runWithIntercept, (intercept, self: Field) => {
|
|
144
|
+
//
|
|
145
|
+
// intercept.return = intercept.return + 'Awesome!!'
|
|
146
|
+
// // return false
|
|
147
|
+
// })
|
|
148
|
+
//
|
|
149
|
+
// after(this.transientField2.runWithIntercept, (intercept, self: Field) => {
|
|
150
|
+
// // console.log('running...')
|
|
151
|
+
// intercept.return = 'Awesome2'
|
|
152
|
+
// })
|
|
153
|
+
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
get propTransient () {
|
|
157
|
+
return this.transientField1.prop
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
get computedVariable () {
|
|
161
|
+
console.log('computedVariable')
|
|
162
|
+
return this.auth.originalVariable.map(el => ({
|
|
163
|
+
test: el.test + ' computed 1', test2: el.test2 + ' computed 1'
|
|
164
|
+
}))
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
get computedUponComputedVariable () {
|
|
168
|
+
console.log('computedUponComputedVariable')
|
|
169
|
+
return this.computedVariable.map(el => ({
|
|
170
|
+
test: el.test + ' computed 2', test2: el.test2 + ' computed 2'
|
|
171
|
+
}))
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
set computedVariable (value) {
|
|
175
|
+
this.auth.originalVariable = value
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
get getComputedButMakeReactiveAgain () {
|
|
179
|
+
unraw(this.computedVariable[0])
|
|
180
|
+
return this.computedVariable[0]
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
get computedPrimitive () {
|
|
184
|
+
// console.log('compute3', this.primitive)
|
|
185
|
+
return this.primitive
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Circular computed store connectivity test.
|
|
190
|
+
*/
|
|
191
|
+
get deepEmail () {
|
|
192
|
+
//console.log('app', this.app)
|
|
193
|
+
return String(this.app.router.$.user.app.router.$.user.email).split('').join('+')
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
pushToOriginalVariableInAuthRepo () {
|
|
197
|
+
this.auth.originalVariable.push({
|
|
198
|
+
test: 'push-1',
|
|
199
|
+
test2: 'push-2'
|
|
200
|
+
})
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
loading = false
|
|
204
|
+
result: unknown = ''
|
|
205
|
+
|
|
206
|
+
async asyncFunction () {
|
|
207
|
+
return new Promise((resolve) => {
|
|
208
|
+
this.loading = true
|
|
209
|
+
setTimeout(() => {
|
|
210
|
+
resolve('hey! how do you do?')
|
|
211
|
+
this.loading = false
|
|
212
|
+
}, 2000)
|
|
213
|
+
})
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
async runAsyncFunction () {
|
|
217
|
+
this.result = ''
|
|
218
|
+
this.result = await this.asyncFunction()
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Implement abstract parent function.
|
|
223
|
+
*/
|
|
224
|
+
reset () {
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
numberOfRecords = 5000000
|
|
228
|
+
hugeArray = []
|
|
229
|
+
loadingHugeData = false
|
|
230
|
+
timeTaken = 0
|
|
231
|
+
|
|
232
|
+
loadHugeData (numberOfRecords: number) {
|
|
233
|
+
this.timeTaken = 0
|
|
234
|
+
this.loadingHugeData = true
|
|
235
|
+
const start = Date.now();
|
|
236
|
+
|
|
237
|
+
setTimeout(() => {
|
|
238
|
+
generateHugeArray(this, numberOfRecords)
|
|
239
|
+
this.loadingHugeData = false
|
|
240
|
+
this.timeTaken = Date.now() - start;
|
|
241
|
+
})
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
msToTime (ms: number) {
|
|
245
|
+
const seconds = (ms / 1000)
|
|
246
|
+
const minutes = (ms / (1000 * 60));
|
|
247
|
+
const hours = (ms / (1000 * 60 * 60));
|
|
248
|
+
const days = (ms / (1000 * 60 * 60 * 24));
|
|
249
|
+
|
|
250
|
+
if (seconds < 60) return seconds.toFixed(3) + " Seconds";
|
|
251
|
+
else if (minutes < 60) return minutes.toFixed(1) + " Minutes";
|
|
252
|
+
else if (hours < 24) return hours.toFixed(1) + " Hrs";
|
|
253
|
+
else return days.toFixed(1) + " Days"
|
|
254
|
+
}
|
|
255
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { onActivated, onBeforeUpdate, onDeactivated, onMounted, onUnmounted, onUpdated, watch } from 'vue';
|
|
2
|
+
import { init, Traits } from '@/index';
|
|
3
|
+
import { UseCapsule } from '@/traits/UseCapsule';
|
|
4
|
+
import { UseMounting } from '@/traits/UseMounting';
|
|
5
|
+
import { Auth } from '@/App/Auth/Auth';
|
|
6
|
+
import { onBeforeRouteUpdate } from 'vue-router';
|
|
7
|
+
|
|
8
|
+
const boundMap = new WeakMap()
|
|
9
|
+
|
|
10
|
+
function bound(method: Function, obj: any){
|
|
11
|
+
let bounds = boundMap.get(obj) || new WeakMap()
|
|
12
|
+
if (bounds.has(method)){
|
|
13
|
+
return method
|
|
14
|
+
} else {
|
|
15
|
+
bounds.set(method, true)
|
|
16
|
+
boundMap.set(obj, bounds)
|
|
17
|
+
return method = method.bind(obj)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class $Mouse {
|
|
22
|
+
|
|
23
|
+
x = 0
|
|
24
|
+
|
|
25
|
+
y = 0
|
|
26
|
+
|
|
27
|
+
async init () {
|
|
28
|
+
// const update = (event: MouseEvent) => {
|
|
29
|
+
// this.x = event.pageX
|
|
30
|
+
// this.y = event.pageY
|
|
31
|
+
// // console.log('x', this.x, 'y', this.y)
|
|
32
|
+
// }
|
|
33
|
+
// // console.log('mouse inited')
|
|
34
|
+
|
|
35
|
+
// onMounted(() => {
|
|
36
|
+
// console.log('---mounted')
|
|
37
|
+
// window.addEventListener('mousemove', update)
|
|
38
|
+
// })
|
|
39
|
+
// onUnmounted(() => {
|
|
40
|
+
// console.log('unmounted', update.bind(this) === update.bind(this))
|
|
41
|
+
// window.removeEventListener('mousemove', update)
|
|
42
|
+
// })
|
|
43
|
+
|
|
44
|
+
// watch(() => this.x, n => {
|
|
45
|
+
// console.log('this.x new', n)
|
|
46
|
+
// })
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
update (event: MouseEvent) {
|
|
50
|
+
this.x = event.pageX
|
|
51
|
+
this.y = event.pageY
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
mounted () {
|
|
55
|
+
// console.log('mounted---')
|
|
56
|
+
window.addEventListener('mousemove', bound(this.update, this))
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
unmounted () {
|
|
60
|
+
// console.log('unmounted---', this.update.bind(this) === this.update.bind(this))
|
|
61
|
+
window.removeEventListener('mousemove', bound(this.update, this))
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
Traits($Mouse, [UseMounting])
|
|
65
|
+
export interface $Mouse extends UseMounting {}
|
|
66
|
+
|
|
67
|
+
export class Mouse {
|
|
68
|
+
|
|
69
|
+
capsule = $Mouse // detached
|
|
70
|
+
constructor () {
|
|
71
|
+
this.initCapsule(arguments)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
get x () { return this.$.x }
|
|
75
|
+
|
|
76
|
+
get y () { return this.$.y }
|
|
77
|
+
}
|
|
78
|
+
Traits(Mouse, [UseCapsule])
|
|
79
|
+
export interface Mouse extends UseCapsule {}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Message } from "@/App/Services/Message/Message";
|
|
2
|
+
import { use } from '@/index'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export abstract class ParentIVueTests {
|
|
6
|
+
|
|
7
|
+
get message() { return use(Message) }
|
|
8
|
+
|
|
9
|
+
private parentPrivate = 111
|
|
10
|
+
|
|
11
|
+
prop = 'test'
|
|
12
|
+
|
|
13
|
+
nonReactiveProp = {
|
|
14
|
+
test: {
|
|
15
|
+
test: true
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
showWarning = null
|
|
20
|
+
|
|
21
|
+
// constructor() {}
|
|
22
|
+
|
|
23
|
+
init () {
|
|
24
|
+
this.showWarning = false
|
|
25
|
+
this.reset()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
parentValue = 'Text from parent class'
|
|
30
|
+
|
|
31
|
+
parentValueAlert () {
|
|
32
|
+
alert(this.parentValue)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
abstract reset (): void
|
|
36
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TMessage } from './TMessage'
|
|
2
|
+
import { TRouter } from './TRouter'
|
|
3
|
+
import { use } from '@/index'
|
|
4
|
+
import { TUser } from './TUser'
|
|
5
|
+
|
|
6
|
+
export class TApp {
|
|
7
|
+
|
|
8
|
+
get router () { return use(TRouter) }
|
|
9
|
+
|
|
10
|
+
get message () { return use(TMessage) }
|
|
11
|
+
|
|
12
|
+
get user () { return use(TUser) }
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { use } from '@/index'
|
|
2
|
+
import { TUser } from './TUser'
|
|
3
|
+
import { TMessage } from './TMessage'
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export class TAuth {
|
|
7
|
+
|
|
8
|
+
user = use(TUser)
|
|
9
|
+
|
|
10
|
+
message = use(TMessage)
|
|
11
|
+
|
|
12
|
+
originalVariable = [
|
|
13
|
+
{ test: 'val-1', test2: 'val-2' }
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
testVariable = [{ test1: 'test1!', test2: 'test1!', sub: { test: 'yes' } }]
|
|
17
|
+
testVariable2 = {
|
|
18
|
+
awesome: {
|
|
19
|
+
super: 'yes'
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
}
|