dn-react-router-toolkit 0.1.7 → 0.1.9
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/components/client_env.d.mts +7 -0
- package/dist/components/client_env.d.ts +7 -0
- package/dist/{seo-kit/seo_loader.js → components/client_env.js} +17 -35
- package/dist/components/client_env.mjs +19 -0
- package/dist/seo-kit/seo.d.mts +19 -51
- package/dist/seo-kit/seo.d.ts +19 -51
- package/dist/seo-kit/seo.js +246 -238
- package/dist/seo-kit/seo.mjs +246 -238
- package/package.json +1 -1
- package/dist/seo-kit/index.d.mts +0 -6
- package/dist/seo-kit/index.d.ts +0 -6
- package/dist/seo-kit/index.js +0 -321
- package/dist/seo-kit/index.mjs +0 -282
- package/dist/seo-kit/loader.d.mts +0 -7
- package/dist/seo-kit/loader.d.ts +0 -7
- package/dist/seo-kit/loader.js +0 -43
- package/dist/seo-kit/loader.mjs +0 -18
- package/dist/seo-kit/seo_loader.d.mts +0 -16
- package/dist/seo-kit/seo_loader.d.ts +0 -16
- package/dist/seo-kit/seo_loader.mjs +0 -31
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { LoaderFn } from './loader.js';
|
|
2
|
-
import * as react_router from 'react-router';
|
|
3
|
-
import React, { JSX } from 'react';
|
|
4
|
-
import { SEO } from './seo.js';
|
|
5
|
-
import 'schema-dts';
|
|
6
|
-
|
|
7
|
-
declare function createSEOLoader<T, U extends JSX.IntrinsicAttributes & {
|
|
8
|
-
seo: SEO;
|
|
9
|
-
}>(fn?: LoaderFn<T, U>): {
|
|
10
|
-
meta: (props: T) => Promise<react_router.MetaFunction<unknown, Record<string, unknown>>>;
|
|
11
|
-
Page(Fc: React.FC<U>): (props: T) => Promise<JSX.Element>;
|
|
12
|
-
getData(): U;
|
|
13
|
-
wrap<V>(mapper: (props: U) => V | Promise<V>): (props: T) => Promise<V>;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export { createSEOLoader };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// src/seo-kit/loader.ts
|
|
2
|
-
function createLoader(fn = () => ({})) {
|
|
3
|
-
let loadedData;
|
|
4
|
-
return {
|
|
5
|
-
getData() {
|
|
6
|
-
return loadedData;
|
|
7
|
-
},
|
|
8
|
-
wrap(mapper) {
|
|
9
|
-
return async function Thing(props) {
|
|
10
|
-
loadedData = await fn(props);
|
|
11
|
-
return mapper(loadedData);
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// src/seo-kit/seo_loader.tsx
|
|
18
|
-
import React from "react";
|
|
19
|
-
function createSEOLoader(fn = () => ({})) {
|
|
20
|
-
const loader = createLoader(fn);
|
|
21
|
-
return {
|
|
22
|
-
...loader,
|
|
23
|
-
meta: loader.wrap((data) => data.seo.meta),
|
|
24
|
-
Page(Fc) {
|
|
25
|
-
return loader.wrap((data) => /* @__PURE__ */ React.createElement(React.Fragment, null, data.seo?.generateJSONLD(), /* @__PURE__ */ React.createElement(Fc, { ...data })));
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
export {
|
|
30
|
-
createSEOLoader
|
|
31
|
-
};
|