@zuzjs/flare 0.2.13 → 0.2.15
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/README.md +32 -0
- package/dist/index-DQHYN410.d.cts +1322 -0
- package/dist/index-DQHYN410.d.ts +1322 -0
- package/dist/index.d.cts +3 -1321
- package/dist/index.d.ts +3 -1321
- package/dist/react.cjs +2 -0
- package/dist/react.d.cts +21 -0
- package/dist/react.d.ts +21 -0
- package/dist/react.js +1 -0
- package/package.json +14 -1
package/dist/react.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var react=require('react');/* ZuzFlare Client */
|
|
2
|
+
var q=E=>{let{query:i,options:l,onData:m,forceReadyOnFirstEmission:d=true}=E,y=react.useRef(null),f=react.useRef(null),p=react.useRef(""),h=react.useRef(0),S=react.useRef(false),b=react.useRef(m),o=react.useRef(i??null),n=react.useRef(l),C=react.useRef(d),s=(...g)=>{};react.useEffect(()=>{b.current=m;},[m]),react.useEffect(()=>{o.current=i??null;},[i]),react.useEffect(()=>{n.current=l;},[l]),react.useEffect(()=>{C.current=d;},[d]);let a=react.useCallback(()=>{f.current?.(),y.current?.close(),f.current=null,S.current=false,p.current="";},[]),Q=react.useCallback(g=>{a(),h.current+=1,g&&(o.current=g),o.current&&(y.current=o.current.stream({flushMs:n.current?.flushMs??20,maxBatchSize:n.current?.maxBatchSize??20,insertAt:n.current?.insertAt??"end",maxDocs:n.current?.maxDocs??50}),f.current=y.current.subscribe((e,t)=>{let $=e.map(c=>`${c?.id??""}:${c?.updatedAt??c?.updated_at??c?.mtime??""}`).join(","),D=`${h.current}:${t?.ready?1:0}:${$}`;if(D===p.current){s("[Sidebar] Skipping duplicate boards stream payload",{size:e.length,meta:t.ready});return}if(p.current=D,!S.current){S.current=true,b.current(e,{ready:C.current?true:!!t?.ready}),s("Stream first payload",{size:e.length,meta:t});return}s("[Sidebar] Boards stream update",{size:e.length,meta:t.ready}),b.current(e,{ready:!!t?.ready});}));},[a]);return react.useEffect(()=>()=>{a();},[a]),{buildStream:Q,closeStream:a}};exports.useLiveQuery=q;
|
package/dist/react.d.cts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { o as CollectionQuery } from './index-DQHYN410.cjs';
|
|
2
|
+
import '@zuzjs/auth';
|
|
3
|
+
|
|
4
|
+
declare const useLiveQuery: (data: {
|
|
5
|
+
query?: CollectionQuery<any, {}>;
|
|
6
|
+
onData: (rows: readonly any[], meta: {
|
|
7
|
+
ready: boolean;
|
|
8
|
+
}) => void;
|
|
9
|
+
options?: {
|
|
10
|
+
flushMs: number;
|
|
11
|
+
maxBatchSize: number;
|
|
12
|
+
insertAt: "end" | "start";
|
|
13
|
+
maxDocs: number;
|
|
14
|
+
};
|
|
15
|
+
forceReadyOnFirstEmission?: boolean;
|
|
16
|
+
}) => {
|
|
17
|
+
buildStream: (queryOverride?: CollectionQuery<any, {}>) => void;
|
|
18
|
+
closeStream: () => void;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { useLiveQuery };
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { o as CollectionQuery } from './index-DQHYN410.js';
|
|
2
|
+
import '@zuzjs/auth';
|
|
3
|
+
|
|
4
|
+
declare const useLiveQuery: (data: {
|
|
5
|
+
query?: CollectionQuery<any, {}>;
|
|
6
|
+
onData: (rows: readonly any[], meta: {
|
|
7
|
+
ready: boolean;
|
|
8
|
+
}) => void;
|
|
9
|
+
options?: {
|
|
10
|
+
flushMs: number;
|
|
11
|
+
maxBatchSize: number;
|
|
12
|
+
insertAt: "end" | "start";
|
|
13
|
+
maxDocs: number;
|
|
14
|
+
};
|
|
15
|
+
forceReadyOnFirstEmission?: boolean;
|
|
16
|
+
}) => {
|
|
17
|
+
buildStream: (queryOverride?: CollectionQuery<any, {}>) => void;
|
|
18
|
+
closeStream: () => void;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { useLiveQuery };
|
package/dist/react.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {useRef,useEffect,useCallback}from'react';var F=E=>{let{query:i,options:l,onData:m,forceReadyOnFirstEmission:d=true}=E,y=useRef(null),f=useRef(null),p=useRef(""),h=useRef(0),S=useRef(false),b=useRef(m),o=useRef(i??null),n=useRef(l),C=useRef(d),s=(...g)=>{};useEffect(()=>{b.current=m;},[m]),useEffect(()=>{o.current=i??null;},[i]),useEffect(()=>{n.current=l;},[l]),useEffect(()=>{C.current=d;},[d]);let a=useCallback(()=>{f.current?.(),y.current?.close(),f.current=null,S.current=false,p.current="";},[]),Q=useCallback(g=>{a(),h.current+=1,g&&(o.current=g),o.current&&(y.current=o.current.stream({flushMs:n.current?.flushMs??20,maxBatchSize:n.current?.maxBatchSize??20,insertAt:n.current?.insertAt??"end",maxDocs:n.current?.maxDocs??50}),f.current=y.current.subscribe((e,t)=>{let $=e.map(c=>`${c?.id??""}:${c?.updatedAt??c?.updated_at??c?.mtime??""}`).join(","),D=`${h.current}:${t?.ready?1:0}:${$}`;if(D===p.current){s("[Sidebar] Skipping duplicate boards stream payload",{size:e.length,meta:t.ready});return}if(p.current=D,!S.current){S.current=true,b.current(e,{ready:C.current?true:!!t?.ready}),s("Stream first payload",{size:e.length,meta:t});return}s("[Sidebar] Boards stream update",{size:e.length,meta:t.ready}),b.current(e,{ready:!!t?.ready});}));},[a]);return useEffect(()=>()=>{a();},[a]),{buildStream:Q,closeStream:a}};export{F as useLiveQuery};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zuzjs/flare",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.15",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"core",
|
|
6
6
|
"zuz",
|
|
@@ -29,6 +29,11 @@
|
|
|
29
29
|
"types": "./dist/index.d.ts",
|
|
30
30
|
"import": "./dist/index.js",
|
|
31
31
|
"require": "./dist/index.cjs"
|
|
32
|
+
},
|
|
33
|
+
"./react": {
|
|
34
|
+
"types": "./dist/react.d.ts",
|
|
35
|
+
"import": "./dist/react.js",
|
|
36
|
+
"require": "./dist/react.cjs"
|
|
32
37
|
}
|
|
33
38
|
},
|
|
34
39
|
"files": [
|
|
@@ -43,5 +48,13 @@
|
|
|
43
48
|
"dependencies": {
|
|
44
49
|
"@zuzjs/auth": "^0.1.9",
|
|
45
50
|
"@zuzjs/core": "^0.3.17"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"react": "^19.2.3"
|
|
54
|
+
},
|
|
55
|
+
"peerDependenciesMeta": {
|
|
56
|
+
"react": {
|
|
57
|
+
"optional": true
|
|
58
|
+
}
|
|
46
59
|
}
|
|
47
60
|
}
|