@live-change/vue3-ssr 0.2.13 → 0.2.14
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 +3 -1
- package/clientApi.js +2 -1
- package/index.js +32 -10
- package/package.json +3 -3
- package/serverApi.js +1 -0
package/Api.js
CHANGED
|
@@ -154,6 +154,8 @@ class Api extends DaoProxy {
|
|
|
154
154
|
api.globals.$actions = this.actions
|
|
155
155
|
api.globals.$fetch = this.fetch
|
|
156
156
|
|
|
157
|
+
api.windowId = this.settings.windowId || api.uid()
|
|
158
|
+
|
|
157
159
|
for(const glob of this.globalInstances) {
|
|
158
160
|
this.installInstanceProperties(glob)
|
|
159
161
|
}
|
|
@@ -245,4 +247,4 @@ class Api extends DaoProxy {
|
|
|
245
247
|
}
|
|
246
248
|
}
|
|
247
249
|
|
|
248
|
-
export default Api
|
|
250
|
+
export default Api
|
package/clientApi.js
CHANGED
|
@@ -41,6 +41,7 @@ function clientApi(settings = {}) {
|
|
|
41
41
|
api.setup({
|
|
42
42
|
ssr: true,
|
|
43
43
|
cache: true,
|
|
44
|
+
...settings,
|
|
44
45
|
createReactiveObject(definition) {
|
|
45
46
|
//console.log("CREATE REACTIVE OBJECT", definition)
|
|
46
47
|
return createReactiveObject(definition, reactiveMixin(api), reactivePrefetchMixin(api) )
|
|
@@ -54,4 +55,4 @@ function clientApi(settings = {}) {
|
|
|
54
55
|
return api
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
export { clientApi }
|
|
58
|
+
export { clientApi }
|
package/index.js
CHANGED
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
import { getCurrentInstance, onUnmounted } from 'vue'
|
|
2
2
|
import { live as d3live, fetch as d3fetch, RangeBuckets } from '@live-change/dao-vue3'
|
|
3
|
+
import { InboxReader } from '@live-change/dao'
|
|
3
4
|
|
|
4
|
-
function
|
|
5
|
+
function useApi(context) {
|
|
5
6
|
context = context || getCurrentInstance().appContext
|
|
6
7
|
return context.config.globalProperties.$lc
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
function path(context) {
|
|
10
|
-
return
|
|
11
|
+
return useApi(context).fetch
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
function view(context) {
|
|
14
|
-
return
|
|
15
|
+
return useApi(context).view
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
function actions(context) {
|
|
18
|
-
return
|
|
19
|
+
return useApi(context).actions
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
function live(path) {
|
|
22
|
-
return d3live(
|
|
23
|
+
return d3live(useApi(), path)
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
function fetch(path) {
|
|
26
|
-
return d3fetch(
|
|
27
|
+
return d3fetch(useApi(), path)
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
async function rangeBuckets(pathFunction, options, app = getCurrentInstance()) {
|
|
30
|
-
const lc =
|
|
31
|
+
const lc = useApi()
|
|
31
32
|
const extendedPathFunction = (range) => pathFunction(range, lc.fetch)
|
|
32
33
|
const buckets = new RangeBuckets(lc, extendedPathFunction, options)
|
|
33
34
|
if(app) {
|
|
@@ -60,12 +61,33 @@ function reverseRange(range) {
|
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
|
|
64
|
+
function inboxReader(pathFunction, callback, start = '', options = {}) {
|
|
65
|
+
const {
|
|
66
|
+
bucketSize = 32,
|
|
67
|
+
context = getCurrentInstance().appContext
|
|
68
|
+
} = options
|
|
69
|
+
const api = useApi(context)
|
|
70
|
+
return new InboxReader((position, bucketSize) => {
|
|
71
|
+
const path = pathFunction(position, bucketSize)
|
|
72
|
+
console.log("OBSERVE PATH", path)
|
|
73
|
+
return api.observable(path)
|
|
74
|
+
}, callback, start, bucketSize)
|
|
75
|
+
}
|
|
76
|
+
|
|
63
77
|
function client(context) {
|
|
64
|
-
return
|
|
78
|
+
return useApi(context).client
|
|
65
79
|
}
|
|
66
80
|
|
|
67
81
|
function uid(context) {
|
|
68
|
-
return
|
|
82
|
+
return useApi(context).uid
|
|
69
83
|
}
|
|
70
84
|
|
|
71
|
-
|
|
85
|
+
const api = useApi
|
|
86
|
+
|
|
87
|
+
export {
|
|
88
|
+
path, live, fetch,
|
|
89
|
+
useApi, api,
|
|
90
|
+
view, actions, client, uid,
|
|
91
|
+
rangeBuckets, reverseRange,
|
|
92
|
+
inboxReader
|
|
93
|
+
}
|
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.14",
|
|
4
4
|
"description": "Live Change Framework - vue components",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
},
|
|
22
22
|
"homepage": "https://github.com/live-change/live-change-framework-vue3",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@live-change/dao-vue3": "0.4.
|
|
24
|
+
"@live-change/dao-vue3": "0.4.13",
|
|
25
25
|
"@live-change/uid": "0.6.5",
|
|
26
26
|
"@vueuse/core": "^8.3.1",
|
|
27
27
|
"debug": "^4.3.4",
|
|
28
28
|
"vue": "^3.2.33"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "f50a4c0ce7348ff25bcc59ec2de24a1da18a3210"
|
|
31
31
|
}
|
package/serverApi.js
CHANGED