@live-change/vue3-ssr 0.2.1 → 0.2.5
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/Api.js +8 -6
- package/index.js +18 -26
- package/package.json +9 -7
package/Api.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as LcDao from '@live-change/dao'
|
|
2
|
+
const { DaoProxy, DaoPrerenderCache, DaoCache, Path } = LcDao // hack for vite
|
|
2
3
|
import validators from '@live-change/framework/lib/utils/validators.js'
|
|
3
4
|
import { hashCode, encodeNumber, uidGenerator, randomString } from '@live-change/uid'
|
|
4
5
|
import { ref, computed, watch } from "vue"
|
|
@@ -16,10 +17,10 @@ class Api extends DaoProxy {
|
|
|
16
17
|
this.preFetchComponents = []
|
|
17
18
|
this.afterPreFetch = []
|
|
18
19
|
|
|
19
|
-
this.validators = validators
|
|
20
|
+
this.validators = { ...validators }
|
|
20
21
|
|
|
21
22
|
this.globals = {
|
|
22
|
-
$validators: validators
|
|
23
|
+
$validators: this.validators
|
|
23
24
|
}
|
|
24
25
|
this.globalInstances = []
|
|
25
26
|
}
|
|
@@ -101,8 +102,8 @@ class Api extends DaoProxy {
|
|
|
101
102
|
apiInfo = this.prerenderCache.cache.get(cachePath)
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
|
-
console.trace("GENERATE API SERVICES!")
|
|
105
|
-
console.log("GENERATE SERVICES API", apiInfo)
|
|
105
|
+
//console.trace("GENERATE API SERVICES!")
|
|
106
|
+
//console.log("GENERATE SERVICES API", apiInfo)
|
|
106
107
|
const definitions = apiInfo?.services
|
|
107
108
|
if(JSON.stringify(definitions) == JSON.stringify(api.servicesApiDefinitions)) return
|
|
108
109
|
if(!definitions) throw new Error("API DEFINITIONS NOT FOUND! UNABLE TO GENERATE API!")
|
|
@@ -219,7 +220,8 @@ class Api extends DaoProxy {
|
|
|
219
220
|
|
|
220
221
|
command(method, args = {}) {
|
|
221
222
|
const _commandId = args._commandId || this.uidGenerator()
|
|
222
|
-
console.trace("COMMAND "+_commandId+":"+JSON.stringify(method))
|
|
223
|
+
//console.trace("COMMAND "+_commandId+":"+JSON.stringify(method))
|
|
224
|
+
console.log("COMMAND "+_commandId+":"+JSON.stringify(method)+"("+JSON.stringify(args)+")")
|
|
223
225
|
return this.request(method, { ...args, _commandId })
|
|
224
226
|
}
|
|
225
227
|
|
package/index.js
CHANGED
|
@@ -1,37 +1,31 @@
|
|
|
1
1
|
import { getCurrentInstance, onUnmounted } from 'vue'
|
|
2
2
|
import { live as d3live, RangeBuckets } from '@live-change/dao-vue3'
|
|
3
3
|
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
return
|
|
4
|
+
function api(context) {
|
|
5
|
+
context = context || getCurrentInstance().appContext
|
|
6
|
+
return context.config.globalProperties.$lc
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
return app.appContext.config.globalProperties.$lc
|
|
9
|
+
function path(context) {
|
|
10
|
+
return api(context).fetch
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
function view(
|
|
15
|
-
|
|
16
|
-
return app.appContext.config.globalProperties.$lc.view
|
|
13
|
+
function view(context) {
|
|
14
|
+
return api(context).view
|
|
17
15
|
}
|
|
18
16
|
|
|
19
|
-
function actions(
|
|
20
|
-
|
|
21
|
-
return app.appContext.config.globalProperties.$lc.actions
|
|
17
|
+
function actions(context) {
|
|
18
|
+
return api(context).actions
|
|
22
19
|
}
|
|
23
20
|
|
|
24
21
|
function live(path) {
|
|
25
|
-
|
|
26
|
-
const api = app.appContext.config.globalProperties.$lc
|
|
27
|
-
return d3live(api, path)
|
|
22
|
+
return d3live(api(), path)
|
|
28
23
|
}
|
|
29
24
|
|
|
30
|
-
async function rangeBuckets(pathFunction, options, app) {
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const buckets = new RangeBuckets(api, extendedPathFunction, options)
|
|
25
|
+
async function rangeBuckets(pathFunction, options, app = getCurrentInstance()) {
|
|
26
|
+
const lc = api()
|
|
27
|
+
const extendedPathFunction = (range) => pathFunction(range, lc.fetch)
|
|
28
|
+
const buckets = new RangeBuckets(lc, extendedPathFunction, options)
|
|
35
29
|
if(app) {
|
|
36
30
|
onUnmounted(() => {
|
|
37
31
|
buckets.dispose()
|
|
@@ -62,14 +56,12 @@ function reverseRange(range) {
|
|
|
62
56
|
}
|
|
63
57
|
}
|
|
64
58
|
|
|
65
|
-
function client(
|
|
66
|
-
|
|
67
|
-
return app.appContext.config.globalProperties.$lc.client
|
|
59
|
+
function client(context) {
|
|
60
|
+
return api(context).client
|
|
68
61
|
}
|
|
69
62
|
|
|
70
|
-
function uid(
|
|
71
|
-
|
|
72
|
-
return app.appContext.config.globalProperties.$lc.uid
|
|
63
|
+
function uid(context) {
|
|
64
|
+
return api(context).uid
|
|
73
65
|
}
|
|
74
66
|
|
|
75
67
|
export { path, api, view, actions, live, client, uid, rangeBuckets, reverseRange }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/vue3-ssr",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Live Change Framework - vue components",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/live-change/vue3
|
|
11
|
+
"url": "git+https://github.com/live-change/live-change-framework-vue3.git"
|
|
12
12
|
},
|
|
13
13
|
"author": {
|
|
14
14
|
"email": "m8@em8.pl",
|
|
@@ -17,12 +17,14 @@
|
|
|
17
17
|
},
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"bugs": {
|
|
20
|
-
"url": "https://github.com/live-change/vue3
|
|
20
|
+
"url": "https://github.com/live-change/live-change-framework-vue3/issues"
|
|
21
21
|
},
|
|
22
|
-
"homepage": "https://github.com/live-change/vue3
|
|
22
|
+
"homepage": "https://github.com/live-change/live-change-framework-vue3",
|
|
23
23
|
"dependencies": {
|
|
24
|
+
"@live-change/uid": "0.5.20",
|
|
25
|
+
"@vueuse/core": "^8.1.2",
|
|
24
26
|
"debug": "^4.3.2",
|
|
25
|
-
"vue": "^3.2.
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
"vue": "^3.2.31"
|
|
28
|
+
},
|
|
29
|
+
"gitHead": "923504c224dd1e3cc5b6bb8296f0963965cd4d10"
|
|
28
30
|
}
|