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.
Files changed (157) hide show
  1. package/.babelrc.json +14 -0
  2. package/.eslintrc.cjs +24 -0
  3. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  4. package/.idea/compiler.xml +7 -0
  5. package/.idea/infinite-vue.iml +10 -0
  6. package/.idea/inspectionProfiles/Project_Default.xml +11 -0
  7. package/.idea/modules.xml +8 -0
  8. package/.idea/php.xml +20 -0
  9. package/.idea/vcs.xml +6 -0
  10. package/.vscode/extensions.json +3 -0
  11. package/LICENSE +19 -0
  12. package/README.md +31 -0
  13. package/demo/App.vue +72 -0
  14. package/demo/components/IVueTest.vue +298 -0
  15. package/demo/components/PreComponent.vue +13 -0
  16. package/demo/components/SubComponent2.vue +45 -0
  17. package/demo/components/TraitsComponent.vue +120 -0
  18. package/demo/components/useIVueTest.vue +136 -0
  19. package/demo/main.ts +21 -0
  20. package/demo/router/index.ts +14 -0
  21. package/demo/tests/IVueTests.ts +255 -0
  22. package/demo/tests/Mouse.ts +79 -0
  23. package/demo/tests/ParentIVueTests.ts +36 -0
  24. package/demo/tests/TApp.ts +15 -0
  25. package/demo/tests/TAuth.ts +23 -0
  26. package/demo/tests/TField.ts +84 -0
  27. package/demo/tests/TMessage.ts +52 -0
  28. package/demo/tests/TRouter.ts +18 -0
  29. package/demo/tests/TUser.ts +19 -0
  30. package/demo/tests/Test.ts +86 -0
  31. package/demo/tests/useField.ts +82 -0
  32. package/demo/tests/useIVueTests.ts +57 -0
  33. package/demo/vite.config.ts +13 -0
  34. package/dist/favicon.ico +0 -0
  35. package/dist/index.es.js +518 -0
  36. package/dist/index.umd.js +1 -0
  37. package/dist/src/behavior.d.ts +72 -0
  38. package/dist/src/config.d.ts +6 -0
  39. package/dist/src/index.d.ts +21 -0
  40. package/dist/src/ivue.d.ts +35 -0
  41. package/dist/src/kernel.d.ts +182 -0
  42. package/dist/src/traits/UseCapsule.d.ts +9 -0
  43. package/dist/src/traits/UseEmit.d.ts +3 -0
  44. package/dist/src/traits/UseInstance.d.ts +6 -0
  45. package/dist/src/traits/UseMounting.d.ts +11 -0
  46. package/dist/src/traits/UseRefs.d.ts +8 -0
  47. package/dist/src/traits/UseRoute.d.ts +3 -0
  48. package/dist/src/traits/UseRouter.d.ts +3 -0
  49. package/dist/src/traits/UseRouting.d.ts +6 -0
  50. package/dist/src/traits/UseTick.d.ts +4 -0
  51. package/dist/src/traits/UseVue.d.ts +13 -0
  52. package/dist/src/types/core.d.ts +46 -0
  53. package/dist/src/utils/dispose-garbage.d.ts +12 -0
  54. package/dist/src/utils/extend.d.ts +12 -0
  55. package/dist/src/utils/getters.d.ts +21 -0
  56. package/dist/src/utils/index.d.ts +7 -0
  57. package/dist/src/utils/is.d.ts +14 -0
  58. package/dist/src/utils/pre.d.ts +9 -0
  59. package/dist/src/utils/raw.d.ts +12 -0
  60. package/dist/src/utils/safe-class-name.d.ts +7 -0
  61. package/dist/src/utils/traits.d.ts +41 -0
  62. package/env.d.ts +1 -0
  63. package/index.html +13 -0
  64. package/package-lock.json +14305 -0
  65. package/package.json +89 -10
  66. package/public/favicon.ico +0 -0
  67. package/src/App/App.ts +27 -0
  68. package/src/App/Auth/Auth.ts +105 -0
  69. package/src/App/Auth/Auth.vue +98 -0
  70. package/src/App/Auth/Logout.vue +14 -0
  71. package/src/App/Auth/User.ts +6 -0
  72. package/src/App/BlackBox.ts +75 -0
  73. package/src/App/Config.ts +6 -0
  74. package/src/App/Generators/generators.ts +47 -0
  75. package/src/App/Home/Home.vue +16 -0
  76. package/src/App/Services/Http/FakeHttp.ts +8 -0
  77. package/src/App/Services/Http/Http.ts +51 -0
  78. package/src/App/Services/Message/Message.ts +49 -0
  79. package/src/App/Services/Message/Message.vue +15 -0
  80. package/src/App/Services/Navigation/Navigation.ts +83 -0
  81. package/src/App/Services/Navigation/Navigation.vue +59 -0
  82. package/src/App/Services/Routing/FakeRouter.ts +7 -0
  83. package/src/App/Services/Routing/NotFoundRoute.vue +13 -0
  84. package/src/App/Services/Routing/Router.ts +262 -0
  85. package/src/App/Services/Routing/Routes.ts +49 -0
  86. package/src/App/Stubs/SingleBookResultStub.ts +13 -0
  87. package/src/App/Traits/UseApp.ts +6 -0
  88. package/src/App/Traits/UseBlackline.ts +0 -0
  89. package/src/App/Traits/UseQuasar.ts +8 -0
  90. package/src/behavior.ts +269 -0
  91. package/src/config.ts +15 -0
  92. package/src/dev/dev-utils.ts +78 -0
  93. package/src/index.ts +83 -0
  94. package/src/ivue.ts +296 -0
  95. package/src/kernel.ts +810 -0
  96. package/src/tests/auth.spec.ts +48 -0
  97. package/src/traits/UseCapsule.ts +28 -0
  98. package/src/traits/UseEmit.ts +3 -0
  99. package/src/traits/UseInstance.ts +17 -0
  100. package/src/traits/UseMounting.ts +23 -0
  101. package/src/traits/UseRefs.ts +17 -0
  102. package/src/traits/UseRoute.ts +6 -0
  103. package/src/traits/UseRouter.ts +5 -0
  104. package/src/traits/UseRouting.ts +7 -0
  105. package/src/traits/UseTick.ts +5 -0
  106. package/src/traits/UseVue.ts +38 -0
  107. package/src/types/core.ts +64 -0
  108. package/src/utils/dispose-garbage.ts +34 -0
  109. package/src/utils/extend.ts +85 -0
  110. package/src/utils/getters.ts +62 -0
  111. package/src/utils/index.ts +16 -0
  112. package/src/utils/is.ts +22 -0
  113. package/src/utils/pre.ts +29 -0
  114. package/src/utils/raw.ts +19 -0
  115. package/src/utils/safe-class-name.ts +15 -0
  116. package/src/utils/traits.ts +121 -0
  117. package/tsconfig.app.json +47 -0
  118. package/tsconfig.json +14 -0
  119. package/tsconfig.node.json +14 -0
  120. package/tsconfig.vitest.json +9 -0
  121. package/vite.config.ts +55 -0
  122. package/vitest.config.ts +18 -0
  123. package/dist/index.js +0 -218
  124. package/docs/index.html +0 -195
  125. package/docs/index.json +0 -3
  126. package/docs/input.html +0 -41
  127. package/docs/items.html +0 -42
  128. package/gulpfile.js +0 -5
  129. package/src/components/checkbox.js +0 -47
  130. package/src/components/data.js +0 -6
  131. package/src/components/file.js +0 -40
  132. package/src/components/form.js +0 -7
  133. package/src/components/index.js +0 -15
  134. package/src/components/input.js +0 -80
  135. package/src/components/items.js +0 -65
  136. package/src/components/modal.js +0 -42
  137. package/src/components/paginate-old.js +0 -88
  138. package/src/components/paginate.js +0 -35
  139. package/src/components/select-search.js +0 -152
  140. package/src/components/select.js +0 -62
  141. package/src/components/submit.js +0 -10
  142. package/src/components/textarea.js +0 -72
  143. package/src/components/upload.js +0 -49
  144. package/src/directives/href.js +0 -10
  145. package/src/directives/index.js +0 -1
  146. package/src/filters/date.js +0 -3
  147. package/src/filters/datetime.js +0 -3
  148. package/src/filters/index.js +0 -4
  149. package/src/filters/json.js +0 -3
  150. package/src/filters/money.js +0 -3
  151. package/src/index.js +0 -4
  152. package/src/mixins/data.js +0 -13
  153. package/src/mixins/form.js +0 -85
  154. package/src/mixins/resource.js +0 -31
  155. package/src/services/client.js +0 -32
  156. package/src/services/flash.js +0 -17
  157. package/src/services/index.js +0 -2
@@ -0,0 +1,84 @@
1
+ import { watch, onMounted, onUnmounted } from "vue";
2
+ import { IVUE } from "@/index";
3
+ import { use, init } from "@/index";
4
+ import { App } from "@/App/App";
5
+ import { TRouter } from "./TRouter";
6
+ import { TApp } from "./TApp";
7
+
8
+ export class Mouse {
9
+
10
+ x = 0
11
+ y = 0
12
+
13
+ init () {
14
+ const update = (e) => this.update(e)
15
+ onMounted(() => window.addEventListener('mousemove', update))
16
+ onUnmounted(() => window.removeEventListener('mousemove', update))
17
+ return this
18
+ }
19
+
20
+ update (event) {
21
+ this.x = event.pageX
22
+ this.y = event.pageY
23
+ }
24
+ }
25
+
26
+ export class TField {
27
+
28
+ get app () { return use(TApp) }
29
+
30
+ get router () { return use(TRouter) }
31
+
32
+ _prop = 0
33
+ // static behavior: any = {
34
+ // init: IVUE.SCOPED_INTERCEPT,
35
+ // runWithIntercept: IVUE.INTERCEPT
36
+ // }
37
+
38
+ // constructor (private _prop: number, private buildMouse = true) {}
39
+
40
+
41
+ get prop () {
42
+ return this._prop
43
+ }
44
+
45
+ set prop (v) {
46
+ this._prop = v
47
+ }
48
+
49
+ get email () {
50
+ return this.app.user.email
51
+ }
52
+
53
+ x: number = 0
54
+
55
+ y: number = 0
56
+
57
+ update: (event) => {}
58
+
59
+
60
+ init() {
61
+ watch(() => this.x, n => {
62
+ console.log('n', n)
63
+ })
64
+ }
65
+
66
+ interceptableValue = 'testing'
67
+ runWithInterceptResult = ''
68
+
69
+ runWithIntercept (variable = '') {
70
+ return this.interceptableValue
71
+ }
72
+
73
+ interceptable () {
74
+ console.log('interceptable')
75
+ }
76
+
77
+ increase () {
78
+ this._prop++
79
+ }
80
+
81
+ private privateFunc () {
82
+ alert('hey')
83
+ }
84
+ }
@@ -0,0 +1,52 @@
1
+ import { use } from '@/index'
2
+ import type { Null } from '@/types/core'
3
+
4
+ export class $TMessage {
5
+
6
+ appMessages: Null<any[]> = null
7
+
8
+ clientMessages: Null<any[]> = null
9
+
10
+ constructor () {
11
+ this.reset()
12
+ }
13
+
14
+ reset () {
15
+ this.appMessages = []
16
+ this.clientMessages = []
17
+ }
18
+
19
+ unpack (dto: any) {
20
+ return {
21
+ success: dto.success,
22
+ serverMessage: dto.result.message
23
+ }
24
+ }
25
+ }
26
+
27
+ export class TMessage {
28
+
29
+ get $ () { return use($TMessage) }
30
+
31
+ showWarning: Null<boolean> = null
32
+
33
+ init () {
34
+ this.showWarning = false
35
+ this.reset()
36
+ }
37
+
38
+ reset () {}
39
+
40
+ get appMessages () {
41
+ return this.$.appMessages
42
+ }
43
+
44
+ get clientMessages () {
45
+ return this.$.clientMessages
46
+ }
47
+
48
+ unpack (pm: any, userMessage: any) {
49
+ this.showWarning = !pm.success
50
+ this.$.appMessages = pm.success ? [userMessage] : [pm.serverMessage]
51
+ }
52
+ }
@@ -0,0 +1,18 @@
1
+ import { TMessage } from './TMessage'
2
+ import { TUser } from './TUser'
3
+ import { use } from '@/index'
4
+
5
+ export class $TRouter {
6
+
7
+ get user () { return use(TUser) }
8
+
9
+ get message () { return use(TMessage) }
10
+
11
+ }
12
+
13
+ export class TRouter {
14
+
15
+ get $ () { return use($TRouter) }
16
+
17
+ test = 1
18
+ }
@@ -0,0 +1,19 @@
1
+ import { use } from '@/kernel'
2
+ import { TApp } from "./TApp";
3
+
4
+ export class TUser {
5
+
6
+ get app () { return use(TApp) }
7
+
8
+ email = 'a'
9
+ token = ''
10
+
11
+ get upperCaseEmail () {
12
+ return String(this.email).toUpperCase()
13
+ }
14
+
15
+ get dashedUppercaseEmail () {
16
+ return this.upperCaseEmail.split('')
17
+ }
18
+
19
+ }
@@ -0,0 +1,86 @@
1
+
2
+ import { onActivated, onDeactivated, onMounted, onUnmounted, onUpdated, watch } from 'vue';
3
+ import { init, use, Traits } from '@/index';
4
+ import { UseApp } from '@/App/Traits/UseApp';
5
+ import { UseCapsule } from '@/traits/UseCapsule';
6
+ import { UseQuasar } from '@/App/Traits/UseQuasar';
7
+ import { UseEmit } from '@/traits/UseEmit';
8
+ import { UseMounting } from '@/traits/UseMounting';
9
+ import { UseVue } from '@/traits/UseVue';
10
+ import { UseRouting } from '@/traits/UseRouting';
11
+ import { UseRouter } from '@/traits/UseRouter';
12
+ import { Mouse } from './Mouse'
13
+
14
+
15
+ export class $Test {
16
+
17
+ constructor (public self: Test) {}
18
+
19
+ mouse!: Mouse
20
+ init () {
21
+
22
+ // const { x, y } = useMouse()
23
+
24
+ ({ x: this.x, y: this.y } = use(Mouse).toRefs())
25
+ // ({ x: this.x, y: this.y } = refs(use(Mouse)))
26
+ this.mouse = use(Mouse)
27
+
28
+ // this.mouse = use(Mouse)
29
+ }
30
+
31
+ words = 'saying some words...'
32
+
33
+ say (i: number) {
34
+ console.log(this.words)
35
+ }
36
+
37
+
38
+ // get x () { return this.mouse.x }
39
+
40
+ // get y () { return this.mouse.y }
41
+
42
+ x = 0
43
+ y = 0
44
+ }
45
+ Traits($Test, [UseApp])
46
+ export interface $Test extends UseApp {}
47
+
48
+
49
+ export class Test {
50
+
51
+ capsule = $Test // detached
52
+ constructor (emit: any, private n: number) {
53
+ this.useCapsule(arguments)
54
+ this.$emit = emit
55
+ }
56
+
57
+ async init () {
58
+ watch(this, newValue => {
59
+ console.log('newValue', newValue)
60
+ })
61
+ }
62
+
63
+ get x () {
64
+ console.log('this.$.x', this.$.x)
65
+ return this.$.mouse.x
66
+ }
67
+
68
+ get y () {
69
+ console.log('this.$.y', this.$.y)
70
+ return this.$.mouse.y
71
+ }
72
+
73
+ get email () {
74
+ return this.$.app.router.$.user.email
75
+ }
76
+
77
+ beforeMount () {
78
+ console.log('# ' + this.n + ' before mounting...')
79
+ }
80
+
81
+ mounted () {
82
+ console.log('mounted!!!')
83
+ }
84
+ }
85
+ Traits(Test, [UseCapsule, UseMounting, UseEmit])
86
+ export interface Test extends UseCapsule, UseMounting, UseEmit {}
@@ -0,0 +1,82 @@
1
+ import { watch, onMounted, onUnmounted, ref, computed } from "vue";
2
+ import { App } from "@/App/App";
3
+ import { TRouter } from "./TRouter";
4
+
5
+ import { use, init } from "@/index";
6
+ import { TApp } from "./TApp";
7
+
8
+ export const useField = () => {
9
+
10
+ const app = computed(() => {
11
+ return use(TApp)
12
+ })
13
+
14
+ const router = computed(() => {
15
+ return use(TRouter)
16
+ })
17
+
18
+ const _prop = ref(0)
19
+
20
+ const x = ref(0)
21
+ const y = ref(1)
22
+
23
+ const interceptableValue = ref('testing')
24
+ const runWithInterceptResult = ref('')
25
+
26
+ function runWithIntercept (variable = '') {
27
+ return interceptableValue.value
28
+ }
29
+
30
+ function interceptable () {
31
+ console.log('interceptable')
32
+ }
33
+
34
+ function increase () {
35
+ _prop.value++
36
+ }
37
+
38
+ const email = computed(() => {
39
+ return app.value.user.email
40
+ })
41
+
42
+ const prop = computed({
43
+ get () {
44
+ _prop.value
45
+ },
46
+ set (v) {
47
+ _prop.value = v
48
+ }
49
+ })
50
+
51
+ const update = function (event) {
52
+
53
+ }
54
+
55
+ function init () {}
56
+
57
+
58
+ function privateFunc () {
59
+ alert(prop.value)
60
+ }
61
+
62
+ watch(() => x.value, n => {
63
+ console.log('n', n)
64
+ })
65
+
66
+ return {
67
+ app,
68
+ router,
69
+ _prop,
70
+ prop,
71
+ x,
72
+ y,
73
+ interceptable,
74
+ runWithInterceptResult,
75
+ runWithIntercept,
76
+ increase,
77
+ privateFunc,
78
+ update,
79
+ init,
80
+ email
81
+ }
82
+ }
@@ -0,0 +1,57 @@
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, computed, ref } from "vue";
8
+ import { generateHugeArray } from "@/App/Generators/generators";
9
+ import { TField } from "./TField";
10
+ import { use, init, IVUE, unraw, before } from "@/index";
11
+ import { useField } from './useField'
12
+ import { App } from '@/App/App';
13
+
14
+
15
+ export function useIVueTests () {
16
+
17
+ const app = use(TApp)
18
+ const transientFields = ref([])
19
+
20
+ const timeTaken = ref(0)
21
+
22
+ timeTaken.value = 0
23
+
24
+ const start = Date.now();
25
+
26
+ // setTimeout(() => {
27
+
28
+ for (let i = 0; i < 50_000; i++) {
29
+ transientFields.value.push(useField())
30
+ }
31
+
32
+ timeTaken.value = Date.now() - start;
33
+
34
+ setInterval(() => {
35
+ transientFields.value[10].x++
36
+ }, 1000)
37
+ // })
38
+
39
+ function msToTime (ms: number) {
40
+ const seconds = (ms / 1000)
41
+ const minutes = (ms / (1000 * 60));
42
+ const hours = (ms / (1000 * 60 * 60));
43
+ const days = (ms / (1000 * 60 * 60 * 24));
44
+
45
+ if (seconds < 60) return seconds.toFixed(3) + " Seconds";
46
+ else if (minutes < 60) return minutes.toFixed(1) + " Minutes";
47
+ else if (hours < 24) return hours.toFixed(1) + " Hrs";
48
+ else return days.toFixed(1) + " Days"
49
+ }
50
+
51
+ return {
52
+ app,
53
+ transientFields,
54
+ timeTaken,
55
+ msToTime
56
+ }
57
+ }
@@ -0,0 +1,13 @@
1
+ import { defineConfig } from "vite";
2
+ import vue from "@vitejs/plugin-vue";
3
+
4
+
5
+ export default defineConfig({
6
+ root: "./",
7
+ // keep the same name as your github repos
8
+ mode: "production",
9
+ plugins: [vue()],
10
+ build: {
11
+ outDir: "./dist-demo",
12
+ },
13
+ });
Binary file