@elytracms/next 0.0.1 → 0.0.3
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/client.js +1 -44
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +14 -1548
- package/dist/index.js +33 -3579
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/dist/client.js
CHANGED
|
@@ -1,47 +1,4 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
|
|
3
|
-
import { jsx } from 'react/jsx-runtime';
|
|
4
|
-
|
|
5
|
-
var ContentClientContext = createContext(null);
|
|
6
|
-
function ContentClientProvider({ client, children }) {
|
|
7
|
-
return createElement(ContentClientContext.Provider, { value: client }, children);
|
|
8
|
-
}
|
|
9
|
-
function useContentClient() {
|
|
10
|
-
return useContext(ContentClientContext);
|
|
11
|
-
}
|
|
12
|
-
function createFixtureContentClient(fixtures) {
|
|
13
|
-
const docs = fixtures.documents ?? [];
|
|
14
|
-
const assets = new Map((fixtures.assets ?? []).map((a) => [a.id, a]));
|
|
15
|
-
return {
|
|
16
|
-
getDocument: (collection, id) => docs.find((d) => d.collection === collection && d.id === id),
|
|
17
|
-
listDocuments: (query) => {
|
|
18
|
-
const matched = docs.filter((d) => d.collection === query.collection);
|
|
19
|
-
return query.limit === void 0 ? matched : matched.slice(0, query.limit);
|
|
20
|
-
},
|
|
21
|
-
resolveAsset: (id) => assets.get(id)
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
function RenderErrorFallback(props) {
|
|
25
|
-
return jsx("div", { "data-ec-fallback": "render-error", "data-ec-node-id": props.nodeId, children: props.message ? `Render error in node ${props.nodeId}: ${props.message}` : `Render error in node ${props.nodeId}` });
|
|
26
|
-
}
|
|
27
|
-
var RenderErrorBoundary = class extends Component {
|
|
28
|
-
constructor(props) {
|
|
29
|
-
super(props);
|
|
30
|
-
this.state = { error: null };
|
|
31
|
-
}
|
|
32
|
-
static getDerivedStateFromError(error) {
|
|
33
|
-
return { error };
|
|
34
|
-
}
|
|
35
|
-
componentDidCatch(_error, _info) {
|
|
36
|
-
}
|
|
37
|
-
render() {
|
|
38
|
-
if (this.state.error) {
|
|
39
|
-
return jsx(RenderErrorFallback, { nodeId: this.props.nodeId, message: this.state.error.message });
|
|
40
|
-
}
|
|
41
|
-
return this.props.children;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export { ContentClientProvider, RenderErrorBoundary, RenderErrorFallback, createFixtureContentClient, useContentClient };
|
|
2
|
+
export { ContentClientProvider, RenderErrorBoundary, RenderErrorFallback, createFixtureContentClient, useContentClient } from '@elytracms/runtime-renderer/client';
|
|
46
3
|
//# sourceMappingURL=client.js.map
|
|
47
4
|
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"client.js","sourcesContent":[]}
|