@jfdevelops/react-layout-composable-copy 0.0.0-stage → 0.1.0
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 +65 -2
- package/dist/contract.cjs +28 -0
- package/dist/contract.cjs.map +1 -0
- package/dist/contract.d.cts +17 -0
- package/dist/contract.d.cts.map +1 -0
- package/dist/contract.d.mts +17 -0
- package/dist/contract.d.mts.map +1 -0
- package/dist/contract.mjs +26 -0
- package/dist/contract.mjs.map +1 -0
- package/dist/header.cjs +12 -0
- package/dist/header.cjs.map +1 -0
- package/dist/header.d.cts +11 -0
- package/dist/header.d.cts.map +1 -0
- package/dist/header.d.mts +11 -0
- package/dist/header.d.mts.map +1 -0
- package/dist/header.mjs +12 -0
- package/dist/header.mjs.map +1 -0
- package/dist/index.cjs +6 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.mjs +4 -0
- package/dist/meta.cjs +19 -0
- package/dist/meta.cjs.map +1 -0
- package/dist/meta.d.cts +16 -0
- package/dist/meta.d.cts.map +1 -0
- package/dist/meta.d.mts +16 -0
- package/dist/meta.d.mts.map +1 -0
- package/dist/meta.mjs +19 -0
- package/dist/meta.mjs.map +1 -0
- package/package.json +65 -3
package/README.md
CHANGED
|
@@ -1,3 +1,66 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Page copy composables
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Preset composables for a page's title and description. Each one ships its
|
|
4
|
+
props, so a page supplies the copy and your render callback supplies the
|
|
5
|
+
markup.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import {
|
|
9
|
+
createHeaderComposable,
|
|
10
|
+
createMetaComposable,
|
|
11
|
+
} from '@jfdevelops/react-layout-composable-copy';
|
|
12
|
+
|
|
13
|
+
composables: (create) => ({
|
|
14
|
+
Layout: create({ name: 'Layout' }),
|
|
15
|
+
...createHeaderComposable(({ eyebrow, title, description }) => (
|
|
16
|
+
<AppHeader eyebrow={eyebrow} title={title} description={description} />
|
|
17
|
+
)),
|
|
18
|
+
...createMetaComposable(({ title, description }) => (
|
|
19
|
+
<AppHead title={title} description={description} />
|
|
20
|
+
)),
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
| Factory | Component | Props |
|
|
25
|
+
| ------------------------ | --------- | --------------------------------------------------------------- |
|
|
26
|
+
| `createHeaderComposable` | `Header` | `title`, `description?`, `eyebrow?` |
|
|
27
|
+
| `createMetaComposable` | `Meta` | `title`, `description?`, `canonical?`, `image?`, `isIndexable?` |
|
|
28
|
+
|
|
29
|
+
`title` and `description` are the same definitions in both presets, so a page
|
|
30
|
+
supplies each value once and both composables receive it. Every value is text,
|
|
31
|
+
because a document title cannot be a React node.
|
|
32
|
+
|
|
33
|
+
To give one preset its own value, rename its prop. An object entry also
|
|
34
|
+
replaces the definition:
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
createHeaderComposable({
|
|
38
|
+
rename: { title: { name: 'heading', schema: reactNode() } },
|
|
39
|
+
render: ({ heading }) => <h1>{heading}</h1>,
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## The contract
|
|
44
|
+
|
|
45
|
+
Both presets are built from the copy contract, exported from the `/contract`
|
|
46
|
+
entry point with the `copyText` validator it uses:
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import {
|
|
50
|
+
copyText,
|
|
51
|
+
createCopyComposable,
|
|
52
|
+
} from '@jfdevelops/react-layout-composable-copy/contract';
|
|
53
|
+
|
|
54
|
+
export const createNoticeComposable = createCopyComposable.extend({
|
|
55
|
+
name: 'Notice',
|
|
56
|
+
props: {
|
|
57
|
+
tone: copyText.optional(),
|
|
58
|
+
isDismissible: ({ value }) => value === true,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The props are validated by plain functions, so the package needs no schema
|
|
64
|
+
library. A prop you add can be any Standard Schema or a function like the one
|
|
65
|
+
above: it receives the value as `unknown`, returns the validated value, and
|
|
66
|
+
throws to reject it.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let _jfdevelops_react_layout_composables = require("@jfdevelops/react-layout-composables");
|
|
3
|
+
|
|
4
|
+
//#region src/contract.ts
|
|
5
|
+
/**
|
|
6
|
+
* Text for a copy composable's props. Use `copyText.optional()` for a prop a
|
|
7
|
+
* page may leave out.
|
|
8
|
+
*/
|
|
9
|
+
const copyText = (0, _jfdevelops_react_layout_composables.createPropValidator)(({ value, error }) => {
|
|
10
|
+
if (typeof value !== "string") throw error("Expected text");
|
|
11
|
+
return value;
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* The page copy contract: a title and an optional description. Composables
|
|
15
|
+
* extended from it share both props, so a page supplies each value once.
|
|
16
|
+
*/
|
|
17
|
+
const createCopyComposable = (0, _jfdevelops_react_layout_composables.defineComposableComponent)({
|
|
18
|
+
name: "Copy",
|
|
19
|
+
props: {
|
|
20
|
+
title: copyText,
|
|
21
|
+
description: copyText.optional()
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
exports.copyText = copyText;
|
|
27
|
+
exports.createCopyComposable = createCopyComposable;
|
|
28
|
+
//# sourceMappingURL=contract.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.cjs","names":[],"sources":["../src/contract.ts"],"sourcesContent":["import {\n createPropValidator,\n defineComposableComponent,\n} from '@jfdevelops/react-layout-composables';\n\n/**\n * Text for a copy composable's props. Use `copyText.optional()` for a prop a\n * page may leave out.\n */\nexport const copyText = createPropValidator(({ value, error }) => {\n if (typeof value !== 'string') {\n throw error('Expected text');\n }\n\n return value;\n});\n\n/**\n * The page copy contract: a title and an optional description. Composables\n * extended from it share both props, so a page supplies each value once.\n */\nexport const createCopyComposable = defineComposableComponent({\n name: 'Copy',\n props: {\n title: copyText,\n description: copyText.optional(),\n },\n});\n"],"mappings":";;;;;;;;AASA,MAAa,0EAAgC,EAAE,OAAO,YAAY;CAChE,IAAI,OAAO,UAAU,UACnB,MAAM,MAAM,eAAe;CAG7B,OAAO;AACT,CAAC;;;;;AAMD,MAAa,2FAAiD;CAC5D,MAAM;CACN,OAAO;EACL,OAAO;EACP,aAAa,SAAS,SAAS;CACjC;AACF,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/contract.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Text for a copy composable's props. Use `copyText.optional()` for a prop a
|
|
4
|
+
* page may leave out.
|
|
5
|
+
*/
|
|
6
|
+
declare const copyText: import("@jfdevelops/react-layout-validator").PropValidatorSchema<string>;
|
|
7
|
+
/**
|
|
8
|
+
* The page copy contract: a title and an optional description. Composables
|
|
9
|
+
* extended from it share both props, so a page supplies each value once.
|
|
10
|
+
*/
|
|
11
|
+
declare const createCopyComposable: import("@jfdevelops/react-layout-composables").DefinedComposableComponentFactory<"Copy", import("@jfdevelops/react-layout-composables").NormalizeComposableProps<{
|
|
12
|
+
title: import("@jfdevelops/react-layout-validator").PropValidatorSchema<string>;
|
|
13
|
+
description: import("@jfdevelops/react-layout-validator").PropValidatorSchema<string | undefined>;
|
|
14
|
+
}>, undefined, {}>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { copyText, createCopyComposable };
|
|
17
|
+
//# sourceMappingURL=contract.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.cts","names":[],"sources":["../src/contract.ts"],"mappings":";;AASA;;;cAAa,QAAA,+CAAQ,mBAAA;AAAA;AAYrB;;;AAZqB,cAYR,oBAAA,iDAAoB,iCAAA,wDAAA,wBAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/contract.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Text for a copy composable's props. Use `copyText.optional()` for a prop a
|
|
4
|
+
* page may leave out.
|
|
5
|
+
*/
|
|
6
|
+
declare const copyText: import("@jfdevelops/react-layout-validator").PropValidatorSchema<string>;
|
|
7
|
+
/**
|
|
8
|
+
* The page copy contract: a title and an optional description. Composables
|
|
9
|
+
* extended from it share both props, so a page supplies each value once.
|
|
10
|
+
*/
|
|
11
|
+
declare const createCopyComposable: import("@jfdevelops/react-layout-composables").DefinedComposableComponentFactory<"Copy", import("@jfdevelops/react-layout-composables").NormalizeComposableProps<{
|
|
12
|
+
title: import("@jfdevelops/react-layout-validator").PropValidatorSchema<string>;
|
|
13
|
+
description: import("@jfdevelops/react-layout-validator").PropValidatorSchema<string | undefined>;
|
|
14
|
+
}>, undefined, {}>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { copyText, createCopyComposable };
|
|
17
|
+
//# sourceMappingURL=contract.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.mts","names":[],"sources":["../src/contract.ts"],"mappings":";;AASA;;;cAAa,QAAA,+CAAQ,mBAAA;AAAA;AAYrB;;;AAZqB,cAYR,oBAAA,iDAAoB,iCAAA,wDAAA,wBAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createPropValidator, defineComposableComponent } from "@jfdevelops/react-layout-composables";
|
|
2
|
+
|
|
3
|
+
//#region src/contract.ts
|
|
4
|
+
/**
|
|
5
|
+
* Text for a copy composable's props. Use `copyText.optional()` for a prop a
|
|
6
|
+
* page may leave out.
|
|
7
|
+
*/
|
|
8
|
+
const copyText = createPropValidator(({ value, error }) => {
|
|
9
|
+
if (typeof value !== "string") throw error("Expected text");
|
|
10
|
+
return value;
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* The page copy contract: a title and an optional description. Composables
|
|
14
|
+
* extended from it share both props, so a page supplies each value once.
|
|
15
|
+
*/
|
|
16
|
+
const createCopyComposable = defineComposableComponent({
|
|
17
|
+
name: "Copy",
|
|
18
|
+
props: {
|
|
19
|
+
title: copyText,
|
|
20
|
+
description: copyText.optional()
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { copyText, createCopyComposable };
|
|
26
|
+
//# sourceMappingURL=contract.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.mjs","names":[],"sources":["../src/contract.ts"],"sourcesContent":["import {\n createPropValidator,\n defineComposableComponent,\n} from '@jfdevelops/react-layout-composables';\n\n/**\n * Text for a copy composable's props. Use `copyText.optional()` for a prop a\n * page may leave out.\n */\nexport const copyText = createPropValidator(({ value, error }) => {\n if (typeof value !== 'string') {\n throw error('Expected text');\n }\n\n return value;\n});\n\n/**\n * The page copy contract: a title and an optional description. Composables\n * extended from it share both props, so a page supplies each value once.\n */\nexport const createCopyComposable = defineComposableComponent({\n name: 'Copy',\n props: {\n title: copyText,\n description: copyText.optional(),\n },\n});\n"],"mappings":";;;;;;;AASA,MAAa,WAAW,qBAAqB,EAAE,OAAO,YAAY;CAChE,IAAI,OAAO,UAAU,UACnB,MAAM,MAAM,eAAe;CAG7B,OAAO;AACT,CAAC;;;;;AAMD,MAAa,uBAAuB,0BAA0B;CAC5D,MAAM;CACN,OAAO;EACL,OAAO;EACP,aAAa,SAAS,SAAS;CACjC;AACF,CAAC"}
|
package/dist/header.cjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const require_contract = require('./contract.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/header.ts
|
|
4
|
+
/** Visible page copy: the shared title and description, and an optional eyebrow. */
|
|
5
|
+
const createHeaderComposable = require_contract.createCopyComposable.extend({
|
|
6
|
+
name: "Header",
|
|
7
|
+
props: { eyebrow: require_contract.copyText.optional() }
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.createHeaderComposable = createHeaderComposable;
|
|
12
|
+
//# sourceMappingURL=header.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.cjs","names":["createCopyComposable","copyText"],"sources":["../src/header.ts"],"sourcesContent":["import { copyText, createCopyComposable } from './contract';\n\n/** Visible page copy: the shared title and description, and an optional eyebrow. */\nexport const createHeaderComposable = createCopyComposable.extend({\n name: 'Header',\n props: {\n eyebrow: copyText.optional(),\n },\n});\n"],"mappings":";;;;AAGA,MAAa,yBAAyBA,sCAAqB,OAAO;CAChE,MAAM;CACN,OAAO,EACL,SAASC,0BAAS,SAAS,EAC7B;AACF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/header.d.ts
|
|
2
|
+
/** Visible page copy: the shared title and description, and an optional eyebrow. */
|
|
3
|
+
declare const createHeaderComposable: import("@jfdevelops/react-layout-composables").DefinedComposableComponentFactory<"Header", Omit<import("@jfdevelops/react-layout-composables").NormalizeComposableProps<{
|
|
4
|
+
title: import("@jfdevelops/react-layout-validator").PropValidatorSchema<string>;
|
|
5
|
+
description: import("@jfdevelops/react-layout-validator").PropValidatorSchema<string | undefined>;
|
|
6
|
+
}>, "eyebrow"> & import("@jfdevelops/react-layout-composables").NormalizeComposableProps<{
|
|
7
|
+
readonly eyebrow: import("@jfdevelops/react-layout-validator").PropValidatorSchema<string | undefined>;
|
|
8
|
+
}>, undefined, {}>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { createHeaderComposable };
|
|
11
|
+
//# sourceMappingURL=header.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.d.cts","names":[],"sources":["../src/header.ts"],"mappings":";;cAGa,sBAAA,iDAAsB,iCAAA,WAAA,IAAA,gDAAA,wBAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/header.d.ts
|
|
2
|
+
/** Visible page copy: the shared title and description, and an optional eyebrow. */
|
|
3
|
+
declare const createHeaderComposable: import("@jfdevelops/react-layout-composables").DefinedComposableComponentFactory<"Header", Omit<import("@jfdevelops/react-layout-composables").NormalizeComposableProps<{
|
|
4
|
+
title: import("@jfdevelops/react-layout-validator").PropValidatorSchema<string>;
|
|
5
|
+
description: import("@jfdevelops/react-layout-validator").PropValidatorSchema<string | undefined>;
|
|
6
|
+
}>, "eyebrow"> & import("@jfdevelops/react-layout-composables").NormalizeComposableProps<{
|
|
7
|
+
readonly eyebrow: import("@jfdevelops/react-layout-validator").PropValidatorSchema<string | undefined>;
|
|
8
|
+
}>, undefined, {}>;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { createHeaderComposable };
|
|
11
|
+
//# sourceMappingURL=header.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.d.mts","names":[],"sources":["../src/header.ts"],"mappings":";;cAGa,sBAAA,iDAAsB,iCAAA,WAAA,IAAA,gDAAA,wBAAA"}
|
package/dist/header.mjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { copyText, createCopyComposable } from "./contract.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/header.ts
|
|
4
|
+
/** Visible page copy: the shared title and description, and an optional eyebrow. */
|
|
5
|
+
const createHeaderComposable = createCopyComposable.extend({
|
|
6
|
+
name: "Header",
|
|
7
|
+
props: { eyebrow: copyText.optional() }
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { createHeaderComposable };
|
|
12
|
+
//# sourceMappingURL=header.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.mjs","names":[],"sources":["../src/header.ts"],"sourcesContent":["import { copyText, createCopyComposable } from './contract';\n\n/** Visible page copy: the shared title and description, and an optional eyebrow. */\nexport const createHeaderComposable = createCopyComposable.extend({\n name: 'Header',\n props: {\n eyebrow: copyText.optional(),\n },\n});\n"],"mappings":";;;;AAGA,MAAa,yBAAyB,qBAAqB,OAAO;CAChE,MAAM;CACN,OAAO,EACL,SAAS,SAAS,SAAS,EAC7B;AACF,CAAC"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_header = require('./header.cjs');
|
|
3
|
+
const require_meta = require('./meta.cjs');
|
|
4
|
+
|
|
5
|
+
exports.createHeaderComposable = require_header.createHeaderComposable;
|
|
6
|
+
exports.createMetaComposable = require_meta.createMetaComposable;
|
package/dist/index.d.cts
ADDED
package/dist/index.d.mts
ADDED
package/dist/index.mjs
ADDED
package/dist/meta.cjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const require_contract = require('./contract.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/meta.ts
|
|
4
|
+
/** Document metadata: the shared title and description, and optional head tags. */
|
|
5
|
+
const createMetaComposable = require_contract.createCopyComposable.extend({
|
|
6
|
+
name: "Meta",
|
|
7
|
+
props: {
|
|
8
|
+
canonical: require_contract.copyText.optional(),
|
|
9
|
+
image: require_contract.copyText.optional(),
|
|
10
|
+
isIndexable: ({ value, error }) => {
|
|
11
|
+
if (value !== void 0 && typeof value !== "boolean") throw error("Expected true or false");
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.createMetaComposable = createMetaComposable;
|
|
19
|
+
//# sourceMappingURL=meta.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.cjs","names":["createCopyComposable","copyText"],"sources":["../src/meta.ts"],"sourcesContent":["import { copyText, createCopyComposable } from './contract';\n\n/** Document metadata: the shared title and description, and optional head tags. */\nexport const createMetaComposable = createCopyComposable.extend({\n name: 'Meta',\n props: {\n canonical: copyText.optional(),\n image: copyText.optional(),\n isIndexable: ({ value, error }) => {\n if (value !== undefined && typeof value !== 'boolean') {\n throw error('Expected true or false');\n }\n\n return value;\n },\n },\n});\n"],"mappings":";;;;AAGA,MAAa,uBAAuBA,sCAAqB,OAAO;CAC9D,MAAM;CACN,OAAO;EACL,WAAWC,0BAAS,SAAS;EAC7B,OAAOA,0BAAS,SAAS;EACzB,cAAc,EAAE,OAAO,YAAY;GACjC,IAAI,UAAU,UAAa,OAAO,UAAU,WAC1C,MAAM,MAAM,wBAAwB;GAGtC,OAAO;EACT;CACF;AACF,CAAC"}
|
package/dist/meta.d.cts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/meta.d.ts
|
|
2
|
+
/** Document metadata: the shared title and description, and optional head tags. */
|
|
3
|
+
declare const createMetaComposable: import("@jfdevelops/react-layout-composables").DefinedComposableComponentFactory<"Meta", Omit<import("@jfdevelops/react-layout-composables").NormalizeComposableProps<{
|
|
4
|
+
title: import("@jfdevelops/react-layout-validator").PropValidatorSchema<string>;
|
|
5
|
+
description: import("@jfdevelops/react-layout-validator").PropValidatorSchema<string | undefined>;
|
|
6
|
+
}>, "canonical" | "image" | "isIndexable"> & import("@jfdevelops/react-layout-composables").NormalizeComposableProps<{
|
|
7
|
+
readonly canonical: import("@jfdevelops/react-layout-validator").PropValidatorSchema<string | undefined>;
|
|
8
|
+
readonly image: import("@jfdevelops/react-layout-validator").PropValidatorSchema<string | undefined>;
|
|
9
|
+
readonly isIndexable: ({
|
|
10
|
+
value,
|
|
11
|
+
error
|
|
12
|
+
}: import("@jfdevelops/react-layout-validator").PropValidatorContext) => boolean | undefined;
|
|
13
|
+
}>, undefined, {}>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { createMetaComposable };
|
|
16
|
+
//# sourceMappingURL=meta.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.d.cts","names":[],"sources":["../src/meta.ts"],"mappings":";;cAGa,oBAAA,iDAAoB,iCAAA,SAAA,IAAA,gDAAA,wBAAA"}
|
package/dist/meta.d.mts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/meta.d.ts
|
|
2
|
+
/** Document metadata: the shared title and description, and optional head tags. */
|
|
3
|
+
declare const createMetaComposable: import("@jfdevelops/react-layout-composables").DefinedComposableComponentFactory<"Meta", Omit<import("@jfdevelops/react-layout-composables").NormalizeComposableProps<{
|
|
4
|
+
title: import("@jfdevelops/react-layout-validator").PropValidatorSchema<string>;
|
|
5
|
+
description: import("@jfdevelops/react-layout-validator").PropValidatorSchema<string | undefined>;
|
|
6
|
+
}>, "canonical" | "image" | "isIndexable"> & import("@jfdevelops/react-layout-composables").NormalizeComposableProps<{
|
|
7
|
+
readonly canonical: import("@jfdevelops/react-layout-validator").PropValidatorSchema<string | undefined>;
|
|
8
|
+
readonly image: import("@jfdevelops/react-layout-validator").PropValidatorSchema<string | undefined>;
|
|
9
|
+
readonly isIndexable: ({
|
|
10
|
+
value,
|
|
11
|
+
error
|
|
12
|
+
}: import("@jfdevelops/react-layout-validator").PropValidatorContext) => boolean | undefined;
|
|
13
|
+
}>, undefined, {}>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { createMetaComposable };
|
|
16
|
+
//# sourceMappingURL=meta.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.d.mts","names":[],"sources":["../src/meta.ts"],"mappings":";;cAGa,oBAAA,iDAAoB,iCAAA,SAAA,IAAA,gDAAA,wBAAA"}
|
package/dist/meta.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { copyText, createCopyComposable } from "./contract.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/meta.ts
|
|
4
|
+
/** Document metadata: the shared title and description, and optional head tags. */
|
|
5
|
+
const createMetaComposable = createCopyComposable.extend({
|
|
6
|
+
name: "Meta",
|
|
7
|
+
props: {
|
|
8
|
+
canonical: copyText.optional(),
|
|
9
|
+
image: copyText.optional(),
|
|
10
|
+
isIndexable: ({ value, error }) => {
|
|
11
|
+
if (value !== void 0 && typeof value !== "boolean") throw error("Expected true or false");
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { createMetaComposable };
|
|
19
|
+
//# sourceMappingURL=meta.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.mjs","names":[],"sources":["../src/meta.ts"],"sourcesContent":["import { copyText, createCopyComposable } from './contract';\n\n/** Document metadata: the shared title and description, and optional head tags. */\nexport const createMetaComposable = createCopyComposable.extend({\n name: 'Meta',\n props: {\n canonical: copyText.optional(),\n image: copyText.optional(),\n isIndexable: ({ value, error }) => {\n if (value !== undefined && typeof value !== 'boolean') {\n throw error('Expected true or false');\n }\n\n return value;\n },\n },\n});\n"],"mappings":";;;;AAGA,MAAa,uBAAuB,qBAAqB,OAAO;CAC9D,MAAM;CACN,OAAO;EACL,WAAW,SAAS,SAAS;EAC7B,OAAO,SAAS,SAAS;EACzB,cAAc,EAAE,OAAO,YAAY;GACjC,IAAI,UAAU,UAAa,OAAO,UAAU,WAC1C,MAAM,MAAM,wBAAwB;GAGtC,OAAO;EACT;CACF;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jfdevelops/react-layout-composable-copy",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Page copy preset composables for react-layout: header, meta, and their shared contract.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/jfdevelops/react-layout.git",
|
|
8
|
+
"directory": "packages/composable-copy"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"type": "module",
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"main": "./dist/index.cjs",
|
|
16
|
+
"module": "./dist/index.mjs",
|
|
17
|
+
"types": "./dist/index.d.mts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.mts",
|
|
21
|
+
"import": "./dist/index.mjs",
|
|
22
|
+
"require": "./dist/index.cjs"
|
|
23
|
+
},
|
|
24
|
+
"./contract": {
|
|
25
|
+
"types": "./dist/contract.d.mts",
|
|
26
|
+
"import": "./dist/contract.mjs",
|
|
27
|
+
"require": "./dist/contract.cjs"
|
|
28
|
+
},
|
|
29
|
+
"./package.json": "./package.json"
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public",
|
|
33
|
+
"provenance": true
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@jfdevelops/react-layout-composables": "1.1.0",
|
|
37
|
+
"@jfdevelops/react-layout-validator": "1.1.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@testing-library/jest-dom": "6.9.1",
|
|
41
|
+
"@testing-library/react": "16.3.2",
|
|
42
|
+
"@types/node": "24.10.1",
|
|
43
|
+
"@types/react": "18.3.28",
|
|
44
|
+
"@types/react-dom": "18.3.7",
|
|
45
|
+
"@vitejs/plugin-react": "6.0.1",
|
|
46
|
+
"jsdom": "29.0.2",
|
|
47
|
+
"react": "18.3.1",
|
|
48
|
+
"react-dom": "18.3.1",
|
|
49
|
+
"tsdown": "0.22.1",
|
|
50
|
+
"unrun": "0.3.0",
|
|
51
|
+
"vite": "8.0.10",
|
|
52
|
+
"vitest": "4.1.5",
|
|
53
|
+
"zod": "^4.6.7"
|
|
54
|
+
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"react": ">=18",
|
|
57
|
+
"react-dom": ">=18"
|
|
58
|
+
},
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "tsdown",
|
|
64
|
+
"typecheck": "tsc --noEmit",
|
|
65
|
+
"test": "vitest run",
|
|
66
|
+
"test:watch": "vitest"
|
|
67
|
+
}
|
|
6
68
|
}
|