next-sanity 13.0.0-cache-components.19 → 13.0.0-cache-components.20
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/dist/RefreshOnInterval.js +14 -0
- package/dist/RefreshOnInterval.js.map +1 -0
- package/dist/SanityLive.js +55 -49
- package/dist/SanityLive.js.map +1 -1
- package/dist/defineLive.d.ts +3 -121
- package/dist/defineLive.d.ts.map +1 -1
- package/dist/hooks/index.js +5 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/live/client-components/index.d.ts +19 -12
- package/dist/live/client-components/index.d.ts.map +1 -1
- package/dist/live/conditions/default/index.d.ts +3 -10
- package/dist/live/conditions/default/index.d.ts.map +1 -1
- package/dist/live/conditions/default/index.js.map +1 -1
- package/dist/live/conditions/next-js/index.d.ts +3 -2
- package/dist/live/conditions/next-js/index.d.ts.map +1 -1
- package/dist/live/conditions/next-js/index.js +10 -10
- package/dist/live/conditions/next-js/index.js.map +1 -1
- package/dist/live/conditions/react-server/index.d.ts +2 -1
- package/dist/live/conditions/react-server/index.js +11 -11
- package/dist/live/conditions/react-server/index.js.map +1 -1
- package/dist/live/server-actions/index.default.d.ts +9 -5
- package/dist/live/server-actions/index.default.d.ts.map +1 -1
- package/dist/live/server-actions/index.default.js +25 -26
- package/dist/live/server-actions/index.default.js.map +1 -1
- package/dist/live/server-actions/index.next-js.d.ts +9 -5
- package/dist/live/server-actions/index.next-js.d.ts.map +1 -1
- package/dist/live/server-actions/index.next-js.js +14 -25
- package/dist/live/server-actions/index.next-js.js.map +1 -1
- package/dist/types.d.ts +75 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +6 -6
- package/dist/LiveEvents.js +0 -43
- package/dist/LiveEvents.js.map +0 -1
- package/dist/LiveEventsIncludingDrafts.js +0 -46
- package/dist/LiveEventsIncludingDrafts.js.map +0 -1
- package/dist/PresentationComlink.js +0 -36
- package/dist/PresentationComlink.js.map +0 -1
- package/dist/context.js +0 -22
- package/dist/context.js.map +0 -1
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { c as setComlinkPerspective, o as setComlink, s as setComlinkClientConfig } from "./context.js";
|
|
2
|
-
import { t as sanitizePerspective } from "./sanitizePerspective.js";
|
|
3
|
-
import { useEffect, useEffectEvent } from "react";
|
|
4
|
-
import { createNode, createNodeMachine } from "@sanity/comlink";
|
|
5
|
-
import { createCompatibilityActors } from "@sanity/presentation-comlink";
|
|
6
|
-
function PresentationComlink(props) {
|
|
7
|
-
const { projectId, dataset } = props;
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
setComlinkClientConfig(projectId, dataset);
|
|
10
|
-
}, [dataset, projectId]);
|
|
11
|
-
const handlePerspectiveChange = useEffectEvent((perspective) => {
|
|
12
|
-
setComlinkPerspective(sanitizePerspective(perspective, "drafts"));
|
|
13
|
-
});
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
const controller = new AbortController();
|
|
16
|
-
const comlink = createNode({
|
|
17
|
-
name: "loaders",
|
|
18
|
-
connectTo: "presentation"
|
|
19
|
-
}, createNodeMachine().provide({ actors: createCompatibilityActors() }));
|
|
20
|
-
comlink.on("loader/perspective", (data) => {
|
|
21
|
-
if (controller.signal.aborted) return;
|
|
22
|
-
handlePerspectiveChange(data.perspective);
|
|
23
|
-
});
|
|
24
|
-
const stop = comlink.start();
|
|
25
|
-
setComlink(comlink);
|
|
26
|
-
return () => {
|
|
27
|
-
stop();
|
|
28
|
-
controller.abort();
|
|
29
|
-
};
|
|
30
|
-
}, []);
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
PresentationComlink.displayName = "PresentationComlink";
|
|
34
|
-
export { PresentationComlink as default };
|
|
35
|
-
|
|
36
|
-
//# sourceMappingURL=PresentationComlink.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PresentationComlink.js","names":[],"sources":["../src/live/client-components/PresentationComlink.tsx"],"sourcesContent":["import type {ClientPerspective} from '@sanity/client'\n\nimport {setComlink, setComlinkClientConfig, setComlinkPerspective} from '#live/context'\nimport {sanitizePerspective} from '#live/sanitizePerspective'\nimport {createNode, createNodeMachine} from '@sanity/comlink'\nimport {\n createCompatibilityActors,\n type LoaderControllerMsg,\n type LoaderNodeMsg,\n} from '@sanity/presentation-comlink'\nimport {useEffect, useEffectEvent} from 'react'\n\nexport default function PresentationComlink(props: {\n projectId: string\n dataset: string\n}): React.JSX.Element | null {\n const {projectId, dataset} = props\n\n useEffect(() => {\n setComlinkClientConfig(projectId, dataset)\n }, [dataset, projectId])\n\n const handlePerspectiveChange = useEffectEvent((perspective: ClientPerspective) => {\n setComlinkPerspective(sanitizePerspective(perspective, 'drafts'))\n })\n\n useEffect(() => {\n const controller = new AbortController()\n const comlink = createNode<LoaderNodeMsg, LoaderControllerMsg>(\n {name: 'loaders', connectTo: 'presentation'},\n createNodeMachine<LoaderNodeMsg, LoaderControllerMsg>().provide({\n actors: createCompatibilityActors<LoaderNodeMsg>(),\n }),\n )\n\n comlink.on('loader/perspective', (data) => {\n if (controller.signal.aborted) return\n\n handlePerspectiveChange(data.perspective)\n })\n\n const stop = comlink.start()\n setComlink(comlink)\n return () => {\n stop()\n controller.abort()\n }\n }, [])\n\n return null\n}\n\nPresentationComlink.displayName = 'PresentationComlink'\n"],"mappings":";;;;;AAYA,SAAwB,oBAAoB,OAGf;CAC3B,MAAM,EAAC,WAAW,YAAW;AAE7B,iBAAgB;AACd,yBAAuB,WAAW,QAAQ;IACzC,CAAC,SAAS,UAAU,CAAC;CAExB,MAAM,0BAA0B,gBAAgB,gBAAmC;AACjF,wBAAsB,oBAAoB,aAAa,SAAS,CAAC;GACjE;AAEF,iBAAgB;EACd,MAAM,aAAa,IAAI,iBAAiB;EACxC,MAAM,UAAU,WACd;GAAC,MAAM;GAAW,WAAW;GAAe,EAC5C,mBAAuD,CAAC,QAAQ,EAC9D,QAAQ,2BAA0C,EACnD,CAAC,CACH;AAED,UAAQ,GAAG,uBAAuB,SAAS;AACzC,OAAI,WAAW,OAAO,QAAS;AAE/B,2BAAwB,KAAK,YAAY;IACzC;EAEF,MAAM,OAAO,QAAQ,OAAO;AAC5B,aAAW,QAAQ;AACnB,eAAa;AACX,SAAM;AACN,cAAW,OAAO;;IAEnB,EAAE,CAAC;AAEN,QAAO;;AAGT,oBAAoB,cAAc"}
|
package/dist/context.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const comlinkListeners = /* @__PURE__ */ new Set();
|
|
2
|
-
let comlink = null;
|
|
3
|
-
let comlinkProjectId = null;
|
|
4
|
-
let comlinkDataset = null;
|
|
5
|
-
let comlinkPerspective = null;
|
|
6
|
-
function setComlink(nextComlink) {
|
|
7
|
-
comlink = nextComlink;
|
|
8
|
-
for (const onComlinkChange of comlinkListeners) onComlinkChange();
|
|
9
|
-
}
|
|
10
|
-
function setComlinkClientConfig(nextComlinkProjectId, nextComlinkDataset) {
|
|
11
|
-
comlinkProjectId = nextComlinkProjectId;
|
|
12
|
-
comlinkDataset = nextComlinkDataset;
|
|
13
|
-
for (const onComlinkChange of comlinkListeners) onComlinkChange();
|
|
14
|
-
}
|
|
15
|
-
function setComlinkPerspective(nextComlinkPerspective) {
|
|
16
|
-
if (comlinkPerspective?.toString() === nextComlinkPerspective?.toString()) return;
|
|
17
|
-
comlinkPerspective = nextComlinkPerspective;
|
|
18
|
-
for (const onComlinkChange of comlinkListeners) onComlinkChange();
|
|
19
|
-
}
|
|
20
|
-
export { comlinkProjectId as a, setComlinkPerspective as c, comlinkPerspective as i, comlinkDataset as n, setComlink as o, comlinkListeners as r, setComlinkClientConfig as s, comlink as t };
|
|
21
|
-
|
|
22
|
-
//# sourceMappingURL=context.js.map
|
package/dist/context.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","names":[],"sources":["../src/live/shared/context.ts"],"sourcesContent":["import type {ClientPerspective} from '@sanity/client'\nimport type {Node} from '@sanity/comlink'\nimport type {LoaderControllerMsg, LoaderNodeMsg} from '@sanity/presentation-comlink'\n\nexport const comlinkListeners: Set<() => void> = new Set()\nexport let comlink: Node<LoaderNodeMsg, LoaderControllerMsg> | null = null\nexport let comlinkProjectId: string | null = null\nexport let comlinkDataset: string | null = null\nexport let comlinkPerspective: ClientPerspective | null = null\nexport function setComlink(nextComlink: Node<LoaderNodeMsg, LoaderControllerMsg> | null): void {\n comlink = nextComlink\n for (const onComlinkChange of comlinkListeners) {\n onComlinkChange()\n }\n}\nexport function setComlinkClientConfig(\n nextComlinkProjectId: string | null,\n nextComlinkDataset: string | null,\n): void {\n comlinkProjectId = nextComlinkProjectId\n comlinkDataset = nextComlinkDataset\n for (const onComlinkChange of comlinkListeners) {\n onComlinkChange()\n }\n}\nexport function setComlinkPerspective(nextComlinkPerspective: ClientPerspective | null): void {\n if (comlinkPerspective?.toString() === nextComlinkPerspective?.toString()) return\n comlinkPerspective = nextComlinkPerspective\n for (const onComlinkChange of comlinkListeners) {\n onComlinkChange()\n }\n}\n"],"mappings":"AAIA,MAAa,mCAAoC,IAAI,KAAK;AAC1D,IAAW,UAA2D;AACtE,IAAW,mBAAkC;AAC7C,IAAW,iBAAgC;AAC3C,IAAW,qBAA+C;AAC1D,SAAgB,WAAW,aAAoE;AAC7F,WAAU;AACV,MAAK,MAAM,mBAAmB,iBAC5B,kBAAiB;;AAGrB,SAAgB,uBACd,sBACA,oBACM;AACN,oBAAmB;AACnB,kBAAiB;AACjB,MAAK,MAAM,mBAAmB,iBAC5B,kBAAiB;;AAGrB,SAAgB,sBAAsB,wBAAwD;AAC5F,KAAI,oBAAoB,UAAU,KAAK,wBAAwB,UAAU,CAAE;AAC3E,sBAAqB;AACrB,MAAK,MAAM,mBAAmB,iBAC5B,kBAAiB"}
|