@bison-lab/payload-blocks 3.3.0 → 3.4.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 +119 -18
- package/dist/admin.d.mts +5 -2
- package/dist/admin.d.mts.map +1 -1
- package/dist/admin.mjs +362 -4
- package/dist/admin.mjs.map +1 -1
- package/dist/index.d.mts +101 -19
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +147 -23
- package/dist/index.mjs.map +1 -1
- package/dist/link-CnwLtm47.mjs +41 -0
- package/dist/link-CnwLtm47.mjs.map +1 -0
- package/dist/react.d.mts +19 -8
- package/dist/react.d.mts.map +1 -1
- package/dist/react.mjs +89 -86
- package/dist/react.mjs.map +1 -1
- package/dist/rich-text.d.mts +38 -14
- package/dist/rich-text.d.mts.map +1 -1
- package/dist/rich-text.mjs +81 -24
- package/dist/rich-text.mjs.map +1 -1
- package/dist/{seam-BDFZlV3F.mjs → seam-CmLb3BSo.mjs} +47 -2
- package/dist/seam-CmLb3BSo.mjs.map +1 -0
- package/dist/{types-D9rg0BoW.d.mts → types-ODMRyOpH.d.mts} +99 -17
- package/dist/types-ODMRyOpH.d.mts.map +1 -0
- package/package.json +1 -1
- package/dist/seam-BDFZlV3F.mjs.map +0 -1
- package/dist/types-D9rg0BoW.d.mts.map +0 -1
|
@@ -89,9 +89,73 @@ declare namespace DefaultBlockLink {
|
|
|
89
89
|
* Adapts the seam to the `renderLink` prop every `@bison-lab/ui` block takes.
|
|
90
90
|
* The ui blocks hand over `target`/`rel` already expanded, so `newTab` is
|
|
91
91
|
* read back off `target` to keep the flag and the attributes in step.
|
|
92
|
+
*
|
|
93
|
+
* An empty `href` is a link with no destination: a page link whose page is
|
|
94
|
+
* missing or unpublished (`resolveLink` gave `null`). It renders as text in
|
|
95
|
+
* the same place, with the same class, so a call to action never points
|
|
96
|
+
* nowhere and never throws.
|
|
92
97
|
*/
|
|
93
98
|
declare function renderLinkWith(Link: BlockLinkComponent): RenderLink;
|
|
94
99
|
//#endregion
|
|
100
|
+
//#region src/fields/link.d.ts
|
|
101
|
+
type LinkType = "page" | "external";
|
|
102
|
+
/**
|
|
103
|
+
* A page as the `page` relationship populates it: what `resolveLink` reads,
|
|
104
|
+
* and what the picker shows. A site's generated `Page` is assignable to it.
|
|
105
|
+
* `_status` is absent on a collection without drafts, which counts as
|
|
106
|
+
* published.
|
|
107
|
+
*/
|
|
108
|
+
interface LinkPageDoc {
|
|
109
|
+
id: number | string;
|
|
110
|
+
title?: string | null;
|
|
111
|
+
slug?: string | null;
|
|
112
|
+
_status?: ("draft" | "published") | null;
|
|
113
|
+
}
|
|
114
|
+
/** Where a link goes: the three fields the picker writes. */
|
|
115
|
+
interface LinkDestination {
|
|
116
|
+
/** `page` unless the editor pasted a URL. Rows saved before links had a type carry only `href`. */
|
|
117
|
+
type?: LinkType | null;
|
|
118
|
+
/** The page's id, or the page itself once a `depth >= 1` read populates it. */
|
|
119
|
+
page?: LinkPageDoc | number | string | null;
|
|
120
|
+
/** The pasted URL of an external link. */
|
|
121
|
+
href?: string | null;
|
|
122
|
+
}
|
|
123
|
+
/** The shape `linkField`/`linkFields` produce once Payload generates types. */
|
|
124
|
+
interface LinkValue extends LinkDestination {
|
|
125
|
+
label?: string | null;
|
|
126
|
+
newTab?: boolean | null;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Turns a link's destination into the `href` a renderer emits, or `null`
|
|
130
|
+
* when there is nothing to point at, in which case the renderer shows the
|
|
131
|
+
* label as text. A site passes its own (`RenderBlocks`' `resolveLink`) when
|
|
132
|
+
* a page's path is not `/<slug>`: the package has no way to know a site's
|
|
133
|
+
* routes, the same reason it takes an `imageComponent`.
|
|
134
|
+
*/
|
|
135
|
+
type ResolveLink = (link: LinkDestination) => string | null;
|
|
136
|
+
/**
|
|
137
|
+
* The package's resolver: a published, populated page is `/<slug>`; an
|
|
138
|
+
* external link is its `href` as typed.
|
|
139
|
+
*
|
|
140
|
+
* A page that did not populate is `null`: Payload hands the public read the
|
|
141
|
+
* bare id when the reader may not see the page, which is what an unpublished
|
|
142
|
+
* page looks like from the site. A populated page whose `_status` is `draft`
|
|
143
|
+
* is `null` too, for a read that can see drafts. A row from before links had
|
|
144
|
+
* a `type` is an external link by `linkTypeOf`, here, in the stock fields'
|
|
145
|
+
* conditions and in the picker alike: the site keeps rendering its `href`,
|
|
146
|
+
* the admin shows it as an External chip, and the site's migration to
|
|
147
|
+
* `type: external` only makes the stored row say what every reader already
|
|
148
|
+
* assumes.
|
|
149
|
+
*/
|
|
150
|
+
declare function resolveLink$1(link: LinkDestination | null | undefined): string | null;
|
|
151
|
+
/**
|
|
152
|
+
* Which of the two stored destinations a row is using. `type` decides; a row
|
|
153
|
+
* with no `type` yet (saved before links had one) is read by what it holds,
|
|
154
|
+
* an `href` making it external, the same reading `resolveLink` and the picker
|
|
155
|
+
* make, so all three agree on every row.
|
|
156
|
+
*/
|
|
157
|
+
declare function linkTypeOf(link: LinkDestination | null | undefined): LinkType;
|
|
158
|
+
//#endregion
|
|
95
159
|
//#region src/render-blocks.d.ts
|
|
96
160
|
/** The minimum a row must be for the dispatch to place it. */
|
|
97
161
|
interface BlockLike {
|
|
@@ -107,10 +171,11 @@ interface BlockLike {
|
|
|
107
171
|
* against the site footer, and `overlapAbove` / `overlapBelow` when the
|
|
108
172
|
* neighbour on that side floats across the seam (see `seam.ts`).
|
|
109
173
|
*
|
|
110
|
-
* `containerClassName`, `imageComponent` and `
|
|
111
|
-
* things a package block cannot decide for itself — the site's
|
|
112
|
-
* how an image gets optimised,
|
|
113
|
-
*
|
|
174
|
+
* `containerClassName`, `imageComponent`, `linkComponent` and `resolveLink`
|
|
175
|
+
* are the four things a package block cannot decide for itself — the site's
|
|
176
|
+
* page measure, how an image gets optimised, which router a link goes
|
|
177
|
+
* through, and what path a CMS page lives at. All four arrive already
|
|
178
|
+
* defaulted, so a renderer never checks them.
|
|
114
179
|
*/
|
|
115
180
|
interface BlockRendererProps<B extends BlockLike = BlockLike> {
|
|
116
181
|
block: B;
|
|
@@ -134,6 +199,8 @@ interface BlockRendererProps<B extends BlockLike = BlockLike> {
|
|
|
134
199
|
imageComponent: BlockImageComponent;
|
|
135
200
|
/** How this block turns an `href` into an element. */
|
|
136
201
|
linkComponent: BlockLinkComponent;
|
|
202
|
+
/** How this block turns a link's destination into an `href`; `null` renders the label as text. */
|
|
203
|
+
resolveLink: ResolveLink;
|
|
137
204
|
}
|
|
138
205
|
/**
|
|
139
206
|
* One renderer per block type, each typed to its own block.
|
|
@@ -149,6 +216,14 @@ type BlockRegistryFor<B extends BlockLike> = { [K in B["blockType"]]: ComponentT
|
|
|
149
216
|
}>>> };
|
|
150
217
|
/** Fallback page measure for a site that does not pass its own. */
|
|
151
218
|
declare const DEFAULT_CONTAINER = "mx-auto w-full max-w-7xl px-6";
|
|
219
|
+
/**
|
|
220
|
+
* The attribute a block editor in the Payload admin (payload-better-editor)
|
|
221
|
+
* walks up to from a click in its preview iframe, to find which row was
|
|
222
|
+
* clicked. `RenderBlocks` puts it on a wrapper around every block, so a site
|
|
223
|
+
* adopting the editor has nothing to add per block; a site's tests can assert
|
|
224
|
+
* against the name here rather than retype it.
|
|
225
|
+
*/
|
|
226
|
+
declare const BLOCK_ID_ATTRIBUTE = "data-better-editor-id";
|
|
152
227
|
interface RenderBlocksProps<B extends BlockLike> {
|
|
153
228
|
/** Pass `[...page.hero, ...page.layout]`, so the hero counts as index 0. */
|
|
154
229
|
blocks: B[];
|
|
@@ -166,10 +241,24 @@ interface RenderBlocksProps<B extends BlockLike> {
|
|
|
166
241
|
* `floats={(row) => overlapsSeam(row) || row.blockType === "bookingCard"}`.
|
|
167
242
|
*/
|
|
168
243
|
floats?: (block: B) => boolean;
|
|
244
|
+
/**
|
|
245
|
+
* Defaults to `resolveLink`, which makes a page link `/<slug>`. A site
|
|
246
|
+
* whose routes differ passes its own; like `linkComponent`, it must be
|
|
247
|
+
* exported from a client module, since a Server Component cannot hand a
|
|
248
|
+
* closure across the boundary.
|
|
249
|
+
*/
|
|
250
|
+
resolveLink?: ResolveLink;
|
|
169
251
|
}
|
|
170
252
|
/**
|
|
171
253
|
* Renders a page's blocks in order through the registry. A Server Component:
|
|
172
254
|
* it only maps and looks up, and each renderer decides its own nature.
|
|
255
|
+
*
|
|
256
|
+
* Each block sits inside an unstyled block-level `<div>` carrying
|
|
257
|
+
* `BLOCK_ID_ATTRIBUTE`, which is what a click-to-edit overlay resolves and
|
|
258
|
+
* what its hover outline paints on. A row with no `id` (a fixture, a row the
|
|
259
|
+
* form has not saved) gets no attribute: there is no form-state path for an
|
|
260
|
+
* editor to open. The band's own `<section>` and its full-bleed background
|
|
261
|
+
* are unchanged by the wrapper.
|
|
173
262
|
*/
|
|
174
263
|
declare function RenderBlocks<B extends BlockLike>({
|
|
175
264
|
blocks,
|
|
@@ -177,17 +266,10 @@ declare function RenderBlocks<B extends BlockLike>({
|
|
|
177
266
|
containerClassName,
|
|
178
267
|
imageComponent,
|
|
179
268
|
linkComponent,
|
|
180
|
-
floats
|
|
269
|
+
floats,
|
|
270
|
+
resolveLink
|
|
181
271
|
}: RenderBlocksProps<B>): ReactElement;
|
|
182
272
|
//#endregion
|
|
183
|
-
//#region src/fields/link.d.ts
|
|
184
|
-
/** The shape `linkField`/`linkFields` produce once Payload generates types. */
|
|
185
|
-
interface LinkValue {
|
|
186
|
-
label?: string | null;
|
|
187
|
-
href?: string | null;
|
|
188
|
-
newTab?: boolean | null;
|
|
189
|
-
}
|
|
190
|
-
//#endregion
|
|
191
273
|
//#region src/media.d.ts
|
|
192
274
|
/**
|
|
193
275
|
* The upload side of the boundary.
|
|
@@ -309,12 +391,12 @@ interface FaqColumnsBlockData extends BlockRow<"faqColumns"> {
|
|
|
309
391
|
title?: string | null;
|
|
310
392
|
description?: string | null;
|
|
311
393
|
items?: FaqColumnsItemData[] | null;
|
|
394
|
+
/** A link whose visible text is `linkText`, not `label`; the destination is `linkFields()`' shape. */
|
|
312
395
|
cta?: {
|
|
313
396
|
title?: string | null;
|
|
314
397
|
linkText?: string | null;
|
|
315
|
-
href?: string | null;
|
|
316
398
|
newTab?: boolean | null;
|
|
317
|
-
};
|
|
399
|
+
} & LinkDestination;
|
|
318
400
|
sticky?: boolean | null;
|
|
319
401
|
type?: ("single" | "multiple") | null;
|
|
320
402
|
collapsible?: boolean | null;
|
|
@@ -416,5 +498,5 @@ interface MegaMenuBlockData extends BlockRow<"megaMenu"> {
|
|
|
416
498
|
}
|
|
417
499
|
interface NavLinkBlockData extends BlockRow<"navLink">, LinkValue {}
|
|
418
500
|
//#endregion
|
|
419
|
-
export { BlockImageProps as C,
|
|
420
|
-
//# sourceMappingURL=types-
|
|
501
|
+
export { BlockImageProps as A, resolveLink$1 as C, newTabAttributes as D, DefaultBlockLink as E, renderLinkWith as O, linkTypeOf as S, BlockLinkProps as T, RenderBlocksProps as _, NavLinkBlockData as a, LinkValue as b, ShowcasePanelsBlockData as c, BLOCK_ID_ATTRIBUTE as d, BlockLike as f, RenderBlocks as g, DEFAULT_CONTAINER as h, NapBlockData as i, DefaultBlockImage as j, BlockImageComponent as k, StatsBandBlockData as l, BlockRendererProps as m, HeroBlockData as n, ProcessStepsBlockData as o, BlockRegistryFor as p, MegaMenuBlockData as r, RichTextBlockData as s, FaqColumnsBlockData as t, TestimonialMasonryBlockData as u, LinkDestination as v, BlockLinkComponent as w, ResolveLink as x, LinkPageDoc as y };
|
|
502
|
+
//# sourceMappingURL=types-ODMRyOpH.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-ODMRyOpH.d.mts","names":[],"sources":["../src/image.tsx","../src/link.tsx","../src/fields/link.ts","../src/render-blocks.tsx","../src/media.ts","../src/types.ts"],"mappings":";;;;;;;;;;AAkBA;;;;;;;;;;UAAiB,eAAA;EACf,GAAA;EASQ;EAPR,GAAA;EACA,KAAA;EACA,MAAA;EACA,SAAA;EAO6D;EAL7D,KAAA;EAY+B;EAV/B,QAAA;AAAA;A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;EAER,OAAA;EACA,IAAA;EACA,KAAA;EACA,OAAA;AAAA;AAAA,UAGe,iBAAA;EACf,IAAA;EACA,cAAA;EACA,SAAA;EACA,YAAA;EACA,EAAA;AAAA;AAAA,UAGe,YAAA,SAAqB,QAAA;EACpC,YAAA;EACA,YAAA;EACA,OAAA;IACE,aAAA;IACA,eAAA;IACA,aAAA;IACA,UAAA;IACA,cAAA;EAAA;EAEF,WAAA,GAAc,iBAAA;EACd,GAAA;EACA,QAAA;EACA,YAAA;EACA,UAAA;AAAA;AAAA,UAGe,gBAAA,SAAyB,SAAA;EACxC,WAAA;EH5IgD;EG8IhD,OAAA;EH7IA;EG+IA,IAAA;EACA,EAAA;AAAA;AAAA,UAGe,mBAAA;EACf,OAAA;EACA,OAAA;EACA,wBAAA;EACA,KAAA,GAAQ,gBAAA;EACR,EAAA;AAAA;AAAA,UAGe,kBAAA;EACf,KAAA;EACA,WAAA;EACA,OAAA;EACA,QAAA,GAAW,mBAAA;EACX,EAAA;AAAA;AAAA,UAGe,iBAAA,SAA0B,QAAA;EACzC,KAAA;EACA,IAAA;EACA,KAAA;IACE,QAAA;IACA,OAAA,GAAU,kBAAA;IACV,MAAA;MACE,QAAA,GAAW,SAAA;MACX,GAAA,GAAM,SAAA;IAAA;IAER,YAAA,mBF9MF;IEgNE,cAAA;EAAA;AAAA;AAAA,UAIa,gBAAA,SAAyB,QAAA,aAAqB,SAAA"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"seam-BDFZlV3F.mjs","names":[],"sources":["../src/cx.ts","../src/seam.ts"],"sourcesContent":["/**\n * Class joining, locally.\n *\n * `cn()` from `@bison-lab/ui` cannot be used here: that barrel is stamped\n * `\"use client\"`, so calling it from a Server Component throws. The renderers\n * only ever concatenate their own literals with a caller-supplied string —\n * there are no conflicting Tailwind utilities to merge — so a join is enough.\n */\nexport function cx(...parts: (string | false | null | undefined)[]): string {\n return parts.filter(Boolean).join(\" \");\n}\n","import { cx } from \"./cx\";\nimport type { BlockLike, BlockRendererProps } from \"./render-blocks\";\nimport type { StatsBandBlockData } from \"./types\";\n\n/**\n * The seam contract: how a block that floats across the join between two\n * bands gets its neighbours to make room.\n *\n * A floating block pulls itself up over the block above and down over the\n * block below with `SEAM_PULL_UP` / `SEAM_PULL_DOWN`, and each neighbour adds\n * the same distance on its own side, so the block sits across the seam\n * without covering copy. `RenderBlocks` decides which rows float (its\n * `floats` prop, defaulting to `overlapsSeam`) and hands every renderer two\n * booleans, `overlapAbove` and `overlapBelow`; a renderer's band wrapper adds\n * `seamClasses(props)` and never looks at a neighbour's row.\n *\n * The four distances are one number in two directions, which is why they all\n * live here: change 16/20 in one place.\n */\n\n/** How far a floating block pulls itself up over the block above. */\nexport const SEAM_PULL_UP = \"-mt-16 lg:-mt-20\";\n\n/** How far a floating block pulls itself down over the block below. */\nexport const SEAM_PULL_DOWN = \"-mb-16 lg:-mb-20\";\n\n/** Extra top padding for the block *below* a floating block. */\nexport const OVERLAP_ABOVE_CLEARANCE = \"pt-16 lg:pt-20\";\n\n/** Extra bottom padding for the block *above* a floating block. */\nexport const OVERLAP_BELOW_CLEARANCE = \"pb-16 lg:pb-20\";\n\n/**\n * The default `floats`: the package's stats band with `overlap` on. A site\n * with its own floating block composes it —\n * `floats={(row) => overlapsSeam(row) || row.blockType === \"bookingCard\"}`.\n */\nexport function overlapsSeam(block: BlockLike | undefined): boolean {\n return (\n block?.blockType === \"statsBand\" &&\n Boolean((block as StatsBandBlockData).overlap)\n );\n}\n\n/** The clearance a band wrapper needs for its neighbours, as one class string. */\nexport function seamClasses({\n overlapAbove,\n overlapBelow,\n}: Pick<BlockRendererProps, \"overlapAbove\" | \"overlapBelow\">): string {\n return cx(\n overlapAbove && OVERLAP_ABOVE_CLEARANCE,\n overlapBelow && OVERLAP_BELOW_CLEARANCE,\n );\n}\n"],"mappings":";;;;;;;;;;AAQA,SAAgB,GAAG,GAAG,OAAsD;AAC1E,QAAO,MAAM,OAAO,QAAQ,CAAC,KAAK,IAAI;;;;;;;;;;;;;;;;;;;;ACYxC,MAAa,eAAe;;AAG5B,MAAa,iBAAiB;;AAG9B,MAAa,0BAA0B;;AAGvC,MAAa,0BAA0B;;;;;;AAOvC,SAAgB,aAAa,OAAuC;AAClE,QACE,OAAO,cAAc,eACrB,QAAS,MAA6B,QAAQ;;;AAKlD,SAAgB,YAAY,EAC1B,cACA,gBACoE;AACpE,QAAO,GACL,gBAAA,kBACA,gBAAA,iBACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types-D9rg0BoW.d.mts","names":[],"sources":["../src/image.tsx","../src/link.tsx","../src/render-blocks.tsx","../src/fields/link.ts","../src/media.ts","../src/types.ts"],"mappings":";;;;;;;;;;AAkBA;;;;;;;;;;UAAiB,eAAA;EACf,GAAA;EASQ;EAPR,GAAA;EACA,KAAA;EACA,MAAA;EACA,SAAA;EAO6D;EAL7D,KAAA;EAY+B;EAV/B,QAAA;AAAA;AAAA,KAGU,mBAAA,GAAsB,aAAA,CAAc,eAAA;;;;;;iBAOhC,iBAAA,CAAA;EACd,GAAA;EACA,GAAA;EACA,KAAA;EACA,MAAA;EACA,SAAA;EACA,KAAA;EACA;AAAA,GACC,eAAA,GAAe,kBAAA,CAAA,GAAA,CAAA,OAAA;;;;;;;AA5BlB;;;;;;;;;;;UCAiB,cAAA,SACP,oBAAA,CAAqB,iBAAA;EAC7B,IAAA;EACA,QAAA,EAAU,SAAA;EACV,MAAA;EACA,SAAA;AAAA;AAAA,KAGU,kBAAA,GAAqB,aAAA,CAAc,cAAA;ADY/C;AAAA,iBCTgB,gBAAA,CACd,MAAA,+BACC,IAAA,CAAK,oBAAA,CAAqB,iBAAA;;;;;;iBASb,gBAAA,CAAA;EACd,IAAA;EACA,MAAA;EACA,QAAA;EAAA,GACG;AAAA,GACF,cAAA,GAAc,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,kBALD,gBAAA;EAAA,IAAgB,WAAA;AAAA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