@hanzo/ui 8.4.12 → 8.5.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/dist/backends/gui/band.cjs +46 -0
- package/dist/backends/gui/band.d.ts +43 -0
- package/dist/backends/gui/band.d.ts.map +1 -0
- package/dist/backends/gui/band.js +44 -0
- package/dist/backends/gui/band.js.map +1 -0
- package/dist/backends/gui/index.cjs +15 -6
- package/dist/backends/gui/index.d.ts +5 -3
- package/dist/backends/gui/index.d.ts.map +1 -1
- package/dist/backends/gui/index.js +5 -3
- package/dist/backends/gui/index.js.map +1 -1
- package/dist/backends/gui/layout.cjs +12 -2
- package/dist/backends/gui/layout.d.ts +1 -1
- package/dist/backends/gui/layout.d.ts.map +1 -1
- package/dist/backends/gui/layout.js +11 -2
- package/dist/backends/gui/layout.js.map +1 -1
- package/dist/backends/gui/link.cjs +126 -0
- package/dist/backends/gui/link.d.ts +65 -0
- package/dist/backends/gui/link.d.ts.map +1 -0
- package/dist/backends/gui/link.js +88 -0
- package/dist/backends/gui/link.js.map +1 -0
- package/dist/backends/gui/prose.cjs +33 -0
- package/dist/backends/gui/prose.d.ts +39 -0
- package/dist/backends/gui/prose.d.ts.map +1 -0
- package/dist/backends/gui/prose.js +30 -0
- package/dist/backends/gui/prose.js.map +1 -0
- package/dist/backends/gui/video.cjs +89 -0
- package/dist/backends/gui/video.d.ts +33 -0
- package/dist/backends/gui/video.d.ts.map +1 -0
- package/dist/backends/gui/video.js +53 -0
- package/dist/backends/gui/video.js.map +1 -0
- package/dist/blocks/accordian.cjs +19 -0
- package/dist/blocks/accordian.d.ts +4 -0
- package/dist/blocks/accordian.d.ts.map +1 -0
- package/dist/blocks/accordian.js +16 -0
- package/dist/blocks/accordian.js.map +1 -0
- package/dist/blocks/bullet-cards.cjs +40 -0
- package/dist/blocks/bullet-cards.d.ts +10 -0
- package/dist/blocks/bullet-cards.d.ts.map +1 -0
- package/dist/blocks/bullet-cards.js +37 -0
- package/dist/blocks/bullet-cards.js.map +1 -0
- package/dist/blocks/card.cjs +58 -0
- package/dist/blocks/card.d.ts +14 -0
- package/dist/blocks/card.d.ts.map +1 -0
- package/dist/blocks/card.js +55 -0
- package/dist/blocks/card.js.map +1 -0
- package/dist/blocks/carte-blanche.cjs +38 -0
- package/dist/blocks/carte-blanche.d.ts +13 -0
- package/dist/blocks/carte-blanche.d.ts.map +1 -0
- package/dist/blocks/carte-blanche.js +35 -0
- package/dist/blocks/carte-blanche.js.map +1 -0
- package/dist/blocks/content.cjs +65 -0
- package/dist/blocks/content.d.ts +11 -0
- package/dist/blocks/content.d.ts.map +1 -0
- package/dist/blocks/content.js +61 -0
- package/dist/blocks/content.js.map +1 -0
- package/dist/blocks/cta.cjs +103 -0
- package/dist/blocks/cta.d.ts +13 -0
- package/dist/blocks/cta.d.ts.map +1 -0
- package/dist/blocks/cta.js +67 -0
- package/dist/blocks/cta.js.map +1 -0
- package/dist/blocks/def.cjs +24 -0
- package/dist/blocks/def.d.ts +191 -0
- package/dist/blocks/def.d.ts.map +1 -0
- package/dist/blocks/def.js +22 -0
- package/dist/blocks/def.js.map +1 -0
- package/dist/blocks/enh-heading.cjs +86 -0
- package/dist/blocks/enh-heading.d.ts +7 -0
- package/dist/blocks/enh-heading.d.ts.map +1 -0
- package/dist/blocks/enh-heading.js +83 -0
- package/dist/blocks/enh-heading.js.map +1 -0
- package/dist/blocks/grid.cjs +98 -0
- package/dist/blocks/grid.d.ts +18 -0
- package/dist/blocks/grid.d.ts.map +1 -0
- package/dist/blocks/grid.js +62 -0
- package/dist/blocks/grid.js.map +1 -0
- package/dist/blocks/group.cjs +43 -0
- package/dist/blocks/group.d.ts +4 -0
- package/dist/blocks/group.d.ts.map +1 -0
- package/dist/blocks/group.js +40 -0
- package/dist/blocks/group.js.map +1 -0
- package/dist/blocks/heading.cjs +22 -0
- package/dist/blocks/heading.d.ts +4 -0
- package/dist/blocks/heading.d.ts.map +1 -0
- package/dist/blocks/heading.js +19 -0
- package/dist/blocks/heading.js.map +1 -0
- package/dist/blocks/image.cjs +54 -0
- package/dist/blocks/image.d.ts +19 -0
- package/dist/blocks/image.d.ts.map +1 -0
- package/dist/blocks/image.js +51 -0
- package/dist/blocks/image.js.map +1 -0
- package/dist/blocks/index.cjs +65 -0
- package/dist/blocks/index.d.ts +18 -0
- package/dist/blocks/index.d.ts.map +1 -0
- package/dist/blocks/index.js +30 -0
- package/dist/blocks/index.js.map +1 -0
- package/dist/blocks/screenful.cjs +139 -0
- package/dist/blocks/screenful.d.ts +18 -0
- package/dist/blocks/screenful.d.ts.map +1 -0
- package/dist/blocks/screenful.js +103 -0
- package/dist/blocks/screenful.js.map +1 -0
- package/dist/blocks/space.cjs +38 -0
- package/dist/blocks/space.d.ts +4 -0
- package/dist/blocks/space.d.ts.map +1 -0
- package/dist/blocks/space.js +35 -0
- package/dist/blocks/space.js.map +1 -0
- package/dist/blocks/spec.cjs +58 -0
- package/dist/blocks/spec.d.ts +60 -0
- package/dist/blocks/spec.d.ts.map +1 -0
- package/dist/blocks/spec.js +52 -0
- package/dist/blocks/spec.js.map +1 -0
- package/dist/blocks/video.cjs +103 -0
- package/dist/blocks/video.d.ts +22 -0
- package/dist/blocks/video.d.ts.map +1 -0
- package/dist/blocks/video.js +67 -0
- package/dist/blocks/video.js.map +1 -0
- package/dist/gallery.cjs +1 -1
- package/dist/gallery.html +104 -7
- package/dist/gallery.js +2 -2
- package/dist/gallery.js.map +1 -1
- package/dist/index.cjs +12 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.node.js +2 -2
- package/dist/primitives/ApplyTypography.cjs +8 -0
- package/dist/primitives/ApplyTypography.d.ts +2 -0
- package/dist/primitives/ApplyTypography.d.ts.map +1 -0
- package/dist/primitives/ApplyTypography.js +5 -0
- package/dist/primitives/ApplyTypography.js.map +1 -0
- package/dist/primitives/{Section.cjs → Band.cjs} +3 -3
- package/dist/primitives/Band.d.ts +2 -0
- package/dist/primitives/Band.d.ts.map +1 -0
- package/dist/primitives/{Section.js → Band.js} +2 -2
- package/dist/primitives/Band.js.map +1 -0
- package/dist/primitives/Fill.cjs +8 -0
- package/dist/primitives/Fill.d.ts +2 -0
- package/dist/primitives/Fill.d.ts.map +1 -0
- package/dist/primitives/Fill.js +5 -0
- package/dist/primitives/Fill.js.map +1 -0
- package/dist/primitives/Link.cjs +8 -0
- package/dist/primitives/Link.d.ts +2 -0
- package/dist/primitives/Link.d.ts.map +1 -0
- package/dist/primitives/Link.js +5 -0
- package/dist/primitives/Link.js.map +1 -0
- package/dist/primitives/LinkElement.cjs +8 -0
- package/dist/primitives/LinkElement.d.ts +2 -0
- package/dist/primitives/LinkElement.d.ts.map +1 -0
- package/dist/primitives/LinkElement.js +5 -0
- package/dist/primitives/LinkElement.js.map +1 -0
- package/dist/primitives/MDXLink.cjs +8 -0
- package/dist/primitives/MDXLink.d.ts +2 -0
- package/dist/primitives/MDXLink.d.ts.map +1 -0
- package/dist/primitives/MDXLink.js +5 -0
- package/dist/primitives/MDXLink.js.map +1 -0
- package/dist/primitives/Screen.cjs +8 -0
- package/dist/primitives/Screen.d.ts +2 -0
- package/dist/primitives/Screen.d.ts.map +1 -0
- package/dist/primitives/Screen.js +5 -0
- package/dist/primitives/Screen.js.map +1 -0
- package/dist/primitives/Separator.cjs +2 -2
- package/dist/primitives/Separator.d.ts +1 -1
- package/dist/primitives/Separator.d.ts.map +1 -1
- package/dist/primitives/Separator.js +1 -1
- package/dist/primitives/Separator.js.map +1 -1
- package/dist/primitives/VideoPlayer.cjs +8 -0
- package/dist/primitives/VideoPlayer.d.ts +2 -0
- package/dist/primitives/VideoPlayer.d.ts.map +1 -0
- package/dist/primitives/VideoPlayer.js +5 -0
- package/dist/primitives/VideoPlayer.js.map +1 -0
- package/dist/primitives/YouTubeEmbed.cjs +8 -0
- package/dist/primitives/YouTubeEmbed.d.ts +2 -0
- package/dist/primitives/YouTubeEmbed.d.ts.map +1 -0
- package/dist/primitives/YouTubeEmbed.js +5 -0
- package/dist/primitives/YouTubeEmbed.js.map +1 -0
- package/dist/primitives/useLink.cjs +8 -0
- package/dist/primitives/useLink.d.ts +2 -0
- package/dist/primitives/useLink.d.ts.map +1 -0
- package/dist/primitives/useLink.js +5 -0
- package/dist/primitives/useLink.js.map +1 -0
- package/dist/product/menu/items.d.ts +1 -1
- package/dist/product/menu/items.d.ts.map +1 -1
- package/dist/styles.css +101 -4
- package/dist/theme.css +101 -0
- package/dist/tw.cjs +52 -1
- package/dist/tw.d.ts.map +1 -1
- package/dist/tw.js +52 -1
- package/dist/tw.js.map +1 -1
- package/dist/types.cjs +32 -0
- package/dist/types.d.ts +136 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +30 -0
- package/dist/types.js.map +1 -0
- package/package.json +29 -17
- package/dist/backends/gui/section.cjs +0 -39
- package/dist/backends/gui/section.d.ts +0 -29
- package/dist/backends/gui/section.d.ts.map +0 -1
- package/dist/backends/gui/section.js +0 -37
- package/dist/backends/gui/section.js.map +0 -1
- package/dist/backends/gui/separator.cjs +0 -10
- package/dist/backends/gui/separator.d.ts +0 -11
- package/dist/backends/gui/separator.d.ts.map +0 -1
- package/dist/backends/gui/separator.js +0 -8
- package/dist/backends/gui/separator.js.map +0 -1
- package/dist/primitives/Section.d.ts +0 -2
- package/dist/primitives/Section.d.ts.map +0 -1
- package/dist/primitives/Section.js.map +0 -1
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { Breakpoint, BulletItem, ButtonDef, GridDef, ImageDef, LinkDef, VideoDef } from '../types.js';
|
|
3
|
+
/** Every block is at least this: a tag naming which renderer reads the rest. */
|
|
4
|
+
export interface Block {
|
|
5
|
+
blockType: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ElementBlock extends Block {
|
|
8
|
+
blockType: 'element';
|
|
9
|
+
element: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export interface HeadingBlock extends Block {
|
|
12
|
+
blockType: 'heading';
|
|
13
|
+
heading: string;
|
|
14
|
+
byline?: string;
|
|
15
|
+
level?: number;
|
|
16
|
+
bylineLevel?: number;
|
|
17
|
+
spaceBetween?: number;
|
|
18
|
+
spaceAfter?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A heading with the parts named — an optional pre-heading above it and a byline
|
|
22
|
+
* below, each with its own level and bottom margin.
|
|
23
|
+
*
|
|
24
|
+
* `level` is the heading tag: 1 renders `<h1>`, 0 renders `<p>`.
|
|
25
|
+
* `mb` is bottom margin in spacing units (4 → 1rem), applied only when the
|
|
26
|
+
* element BELOW it is present — so a heading with no byline carries no trailing
|
|
27
|
+
* space.
|
|
28
|
+
*/
|
|
29
|
+
export interface EnhHeadingBlock extends Block {
|
|
30
|
+
blockType: 'enh-heading';
|
|
31
|
+
specifiers?: string;
|
|
32
|
+
/** A node, or a url string to an asset. */
|
|
33
|
+
icon?: ReactNode;
|
|
34
|
+
/** Sizes the icon when it is given as a url. */
|
|
35
|
+
iconSize?: number;
|
|
36
|
+
preheading?: {
|
|
37
|
+
text: string;
|
|
38
|
+
level?: number;
|
|
39
|
+
mb?: number;
|
|
40
|
+
};
|
|
41
|
+
heading: {
|
|
42
|
+
text: string;
|
|
43
|
+
level?: number;
|
|
44
|
+
mb?: number;
|
|
45
|
+
};
|
|
46
|
+
byline?: {
|
|
47
|
+
text: string;
|
|
48
|
+
level?: number;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export interface ImageBlock extends Block, ImageDef {
|
|
52
|
+
blockType: 'image';
|
|
53
|
+
/**
|
|
54
|
+
* `left` (default) / `right` / `center` (needs a column parent).
|
|
55
|
+
* `mobile-no-scale` — by default an image scales to 3/4 height below `md`.
|
|
56
|
+
* `mobile-full-width` — overrides dim and fills the width, keeping the ratio.
|
|
57
|
+
*/
|
|
58
|
+
specifiers?: string;
|
|
59
|
+
/** @deprecated Use `mobile-full-width` in specifiers. */
|
|
60
|
+
fullWidthOnMobile?: boolean;
|
|
61
|
+
props?: {
|
|
62
|
+
sizes?: string;
|
|
63
|
+
/** When true, alignment specifiers are ignored. */
|
|
64
|
+
fill?: boolean;
|
|
65
|
+
style?: React.CSSProperties;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export interface VideoBlock extends VideoDef {
|
|
69
|
+
blockType: 'video';
|
|
70
|
+
}
|
|
71
|
+
export type SpaceUnit = number;
|
|
72
|
+
export type HeadingLevel = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
73
|
+
export declare const SPACE_DEFAULTS: {
|
|
74
|
+
xs: number;
|
|
75
|
+
sm: number;
|
|
76
|
+
md: number;
|
|
77
|
+
lg: number;
|
|
78
|
+
xl: number;
|
|
79
|
+
};
|
|
80
|
+
export interface SpaceBlock extends Block {
|
|
81
|
+
blockType: 'space';
|
|
82
|
+
/**
|
|
83
|
+
* Vertical space in spacing units, per rung and merged over SPACE_DEFAULTS —
|
|
84
|
+
* or one number to use at every rung.
|
|
85
|
+
*/
|
|
86
|
+
sizes?: {
|
|
87
|
+
[k in Breakpoint]?: SpaceUnit;
|
|
88
|
+
} | SpaceUnit;
|
|
89
|
+
/**
|
|
90
|
+
* The space the matching heading tag WOULD occupy, as `<ApplyTypography>`
|
|
91
|
+
* renders it, plus any gap. 0 is 1rem. Default 3.
|
|
92
|
+
*/
|
|
93
|
+
level?: HeadingLevel;
|
|
94
|
+
test?: boolean;
|
|
95
|
+
}
|
|
96
|
+
export interface GroupBlock extends Block {
|
|
97
|
+
blockType: 'group';
|
|
98
|
+
specifiers?: string;
|
|
99
|
+
elements: Block[];
|
|
100
|
+
}
|
|
101
|
+
export interface GridBlock extends Block {
|
|
102
|
+
blockType: 'grid';
|
|
103
|
+
specifiers?: string;
|
|
104
|
+
grid: GridDef;
|
|
105
|
+
/** Ignored when children are passed to the component instead. */
|
|
106
|
+
cells?: Block[];
|
|
107
|
+
}
|
|
108
|
+
export interface AccordianBlock extends Block {
|
|
109
|
+
blockType: 'accordian';
|
|
110
|
+
items: {
|
|
111
|
+
trigger: string;
|
|
112
|
+
content: ReactNode;
|
|
113
|
+
}[];
|
|
114
|
+
}
|
|
115
|
+
export interface BulletCardsBlock extends Block {
|
|
116
|
+
blockType: 'bullet-cards';
|
|
117
|
+
/** `no-card-border` · `mobile-small-text` · `borders-muted-1|3` (default 2). */
|
|
118
|
+
specifiers?: string;
|
|
119
|
+
grid: GridDef;
|
|
120
|
+
cards: BulletItem[];
|
|
121
|
+
/** In px. */
|
|
122
|
+
iconSize?: number;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* A call to action: a row of links and buttons.
|
|
126
|
+
*
|
|
127
|
+
* `fill` — the elements fill the parent width.
|
|
128
|
+
* `left` / `right` — justify at `md` and up (centred otherwise).
|
|
129
|
+
* `mobile-2-columns` — two columns on a phone instead of one per line.
|
|
130
|
+
* `mobile-center-first-if-odd` — with an odd count, centre the last one.
|
|
131
|
+
* `mobile-odd-full-width` — the centred one fills both columns.
|
|
132
|
+
*/
|
|
133
|
+
export interface CTABlock extends Block {
|
|
134
|
+
blockType: 'cta';
|
|
135
|
+
specifiers?: string;
|
|
136
|
+
elements: (LinkDef | ButtonDef)[];
|
|
137
|
+
}
|
|
138
|
+
export interface CardBlock extends Block {
|
|
139
|
+
blockType: 'card';
|
|
140
|
+
/** e.g. `media-left`, `appear-disabled`, `no-borders` — combinable. */
|
|
141
|
+
specifiers?: string;
|
|
142
|
+
title?: string;
|
|
143
|
+
byline?: string;
|
|
144
|
+
/** For the title area. */
|
|
145
|
+
icon?: ReactNode;
|
|
146
|
+
iconAfter?: boolean;
|
|
147
|
+
media?: ImageBlock | VideoBlock;
|
|
148
|
+
content?: ReactNode;
|
|
149
|
+
cta?: CTABlock;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* A free-form panel: anything above, a heading, anything below, a call to
|
|
153
|
+
* action at the foot.
|
|
154
|
+
*
|
|
155
|
+
* `big-padding` · `no-outer-borders` · `no-internal-borders` ·
|
|
156
|
+
* `style-ghost` (all three at once, and no padding).
|
|
157
|
+
*/
|
|
158
|
+
export interface CarteBlancheBlock extends Block {
|
|
159
|
+
blockType: 'carte-blanche';
|
|
160
|
+
specifiers?: string;
|
|
161
|
+
topContent?: Block[];
|
|
162
|
+
heading?: EnhHeadingBlock;
|
|
163
|
+
content?: Block[];
|
|
164
|
+
cta?: CTABlock;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* One screenful: an optional banner over one to three columns of content.
|
|
168
|
+
*
|
|
169
|
+
* A `VideoBlock` banner renders its poster on the server and lazy-loads the
|
|
170
|
+
* `<video>` on the client, playing once 75% of it is in view.
|
|
171
|
+
*/
|
|
172
|
+
export interface ScreenfulBlock extends Block {
|
|
173
|
+
blockType: 'screenful';
|
|
174
|
+
/** An image url, or a video. */
|
|
175
|
+
banner?: string | VideoBlock;
|
|
176
|
+
/** Layout hints for the block as a whole. */
|
|
177
|
+
specifiers?: string;
|
|
178
|
+
/** Layout hints for the matching column. */
|
|
179
|
+
columnSpecifiers?: string[];
|
|
180
|
+
/**
|
|
181
|
+
* The order columns appear in once stacked on a phone, overriding their
|
|
182
|
+
* written order — e.g. `[1, 0, 2]` puts the second of three on top.
|
|
183
|
+
*/
|
|
184
|
+
mobileOrder?: number[];
|
|
185
|
+
/** Content per column. More than three is allowed but rarely readable. */
|
|
186
|
+
contentColumns: Block[][];
|
|
187
|
+
footer?: ReactNode;
|
|
188
|
+
/** For linking to this screenful. */
|
|
189
|
+
anchorId?: string;
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=def.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"def.d.ts","sourceRoot":"","sources":["../../src/blocks/def.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EACV,UAAU,EACV,UAA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AAM,WAAW,cAAe,SAAQ,KAAK;IAC3C,SAAS,EAAE,WAAW,CAAA;IACtB,gCAAgC;IAChC,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,CAAA;IAC5B,6CAA6C;IAC7C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,4CAA4C;IAC5C,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,0EAA0E;IAC1E,cAAc,EAAE,KAAK,EAAE,EAAE,CAAA;IACzB,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use client';// The block vocabulary — what a site AUTHORS, with no renderer attached.
|
|
2
|
+
//
|
|
3
|
+
// A block is data: `blockType` picks the renderer, and the rest of the fields
|
|
4
|
+
// are that renderer's input. So a page is a `Block[]` that can be written in a
|
|
5
|
+
// CMS, checked into a repo, or produced by a server, and typed either way.
|
|
6
|
+
//
|
|
7
|
+
// Every `specifiers` field is a space-separated bag of layout hints read by the
|
|
8
|
+
// matching component. It is deliberately a string rather than a union: a site
|
|
9
|
+
// adds a hint by typing one, and an unrecognised hint is ignored rather than
|
|
10
|
+
// failing the build.
|
|
11
|
+
//
|
|
12
|
+
// Flat, for the reason given in ../types: the 5.x line spread these over
|
|
13
|
+
// sixteen files exporting `default`, so the imported name was never the name the
|
|
14
|
+
// file declared.
|
|
15
|
+
export const SPACE_DEFAULTS = {
|
|
16
|
+
xs: 2,
|
|
17
|
+
sm: 4,
|
|
18
|
+
md: 5,
|
|
19
|
+
lg: 6,
|
|
20
|
+
xl: 8,
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=def.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"def.js","sourceRoot":"","sources":["../../src/blocks/def.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,EAAE;AACF,8EAA8E;AAC9E,+EAA+E;AAC/E,2EAA2E;AAC3E,EAAE;AACF,gFAAgF;AAChF,8EAA8E;AAC9E,6EAA6E;AAC7E,qBAAqB;AACrB,EAAE;AACF,yEAAyE;AACzE,iFAAiF;AACjF,iBAAiB;AAkFjB,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;CACsC,CAAA"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnhHeadingBlockComponent = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const prose_1 = require("../backends/gui/prose.cjs");
|
|
6
|
+
const box_1 = require("../box.cjs");
|
|
7
|
+
const cn_1 = require("../core/cn.cjs");
|
|
8
|
+
const spec_1 = require("./spec.cjs");
|
|
9
|
+
const DEFAULT = {
|
|
10
|
+
preheading: { tag: 'h4', mb: 2 },
|
|
11
|
+
heading: { tag: 'h1', mb: 2 },
|
|
12
|
+
byline: { tag: 'h6' },
|
|
13
|
+
};
|
|
14
|
+
/** 0 is a paragraph; 1–6 are the heading tags. */
|
|
15
|
+
const tag = (level, fallback) => level === undefined ? fallback : level >= 1 && level <= 6 ? `h${level}` : 'p';
|
|
16
|
+
/** An icon given as a url is drawn at `size`; given as a node it renders as-is. */
|
|
17
|
+
const Mark = ({ icon, size, phone, }) => {
|
|
18
|
+
if (!icon)
|
|
19
|
+
return null;
|
|
20
|
+
if (typeof icon === 'string') {
|
|
21
|
+
const s = phone ? size * 0.75 : size;
|
|
22
|
+
return (0, jsx_runtime_1.jsx)(box_1.Box, { tag: "img", src: icon, width: s, height: s, alt: "" });
|
|
23
|
+
}
|
|
24
|
+
return (0, jsx_runtime_1.jsx)(box_1.Box, { children: icon });
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Where the three parts sit.
|
|
28
|
+
*
|
|
29
|
+
* The byline is tracked separately from the heading because it aligns
|
|
30
|
+
* independently — a centred heading over a left-aligned byline is a normal
|
|
31
|
+
* layout, and one value could not express it.
|
|
32
|
+
*/
|
|
33
|
+
const place = (spec, phone) => {
|
|
34
|
+
const centre = spec('center');
|
|
35
|
+
const right = spec('right');
|
|
36
|
+
const at = (c, r) => c ? 'self-center text-center' : r ? 'self-end text-right' : 'self-start text-left';
|
|
37
|
+
let heading = at(centre, right);
|
|
38
|
+
let byline = at(spec('byline-center'), spec('byline-right'));
|
|
39
|
+
if (phone) {
|
|
40
|
+
if (spec('mobile-heading-left'))
|
|
41
|
+
heading = 'self-start text-left';
|
|
42
|
+
else
|
|
43
|
+
heading = at(spec('mobile-heading-centered') || centre, right);
|
|
44
|
+
if (spec('mobile-byline-left'))
|
|
45
|
+
byline = 'self-start text-left';
|
|
46
|
+
}
|
|
47
|
+
else if (spec('mobile-heading-centered')) {
|
|
48
|
+
// Centred on a phone, and whatever was asked for from `md` up.
|
|
49
|
+
heading = `self-center text-center ${heading.split(' ').map((c) => `md:${c}`).join(' ')}`;
|
|
50
|
+
}
|
|
51
|
+
return { heading, byline };
|
|
52
|
+
};
|
|
53
|
+
const EnhHeadingBlockComponent = ({ block, className, agent, applyTypography = true, extraSpecifiers = '', }) => {
|
|
54
|
+
if (block.blockType !== 'enh-heading')
|
|
55
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "enh-heading block required" });
|
|
56
|
+
const b = block;
|
|
57
|
+
const spec = (s) => (0, spec_1.has)(`${b.specifiers ?? ''} ${extraSpecifiers}`.trim(), s);
|
|
58
|
+
const phone = agent === 'phone';
|
|
59
|
+
const at = place(spec, phone);
|
|
60
|
+
const headFont = spec('preheading-heading-font') ? 'font-heading' : '';
|
|
61
|
+
const parts = [
|
|
62
|
+
b.preheading && {
|
|
63
|
+
Tag: tag(b.preheading.level, DEFAULT.preheading.tag),
|
|
64
|
+
cls: (0, cn_1.cn)(`mb-${b.preheading.mb ?? DEFAULT.preheading.mb}`, at.heading, headFont),
|
|
65
|
+
text: b.preheading.text,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
Tag: tag(b.heading.level, DEFAULT.heading.tag),
|
|
69
|
+
cls: (0, cn_1.cn)(`mb-${b.heading.mb ?? DEFAULT.heading.mb}`, at.heading),
|
|
70
|
+
text: b.heading.text,
|
|
71
|
+
},
|
|
72
|
+
b.byline && {
|
|
73
|
+
Tag: tag(b.byline.level, DEFAULT.byline.tag),
|
|
74
|
+
cls: at.byline,
|
|
75
|
+
text: b.byline.text,
|
|
76
|
+
},
|
|
77
|
+
].filter(Boolean);
|
|
78
|
+
// The icon rides the FIRST part that renders, whichever that turns out to be.
|
|
79
|
+
const inner = parts.map(({ Tag, cls, text }, i) => b.icon && i === 0 ? ((0, jsx_runtime_1.jsxs)(box_1.Box, { className: (0, cn_1.cn)('flex flex-row items-center gap-2 sm:gap-4', cls), children: [(0, jsx_runtime_1.jsx)(Mark, { icon: b.icon, size: b.iconSize ?? 32, phone: phone }), (0, jsx_runtime_1.jsx)(box_1.Box, { tag: Tag, children: text })] }, i)) : ((0, jsx_runtime_1.jsx)(box_1.Box, { tag: Tag, className: cls, children: text }, i)));
|
|
80
|
+
// `gap-0` because each part carries its own bottom margin — a gap on the
|
|
81
|
+
// column would add to every one of them and double the spacing.
|
|
82
|
+
const cls = (0, cn_1.cn)('flex flex-col w-full gap-0', className, spec('align-middle') && 'my-auto');
|
|
83
|
+
return applyTypography ? ((0, jsx_runtime_1.jsx)(prose_1.ApplyTypography, { className: cls, children: inner })) : ((0, jsx_runtime_1.jsx)(box_1.Box, { className: cls, children: inner }));
|
|
84
|
+
};
|
|
85
|
+
exports.EnhHeadingBlockComponent = EnhHeadingBlockComponent;
|
|
86
|
+
exports.default = exports.EnhHeadingBlockComponent;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type BlockComponentProps } from './spec.js';
|
|
2
|
+
export declare const EnhHeadingBlockComponent: ({ block, className, agent, applyTypography, extraSpecifiers, }: BlockComponentProps & {
|
|
3
|
+
applyTypography?: boolean;
|
|
4
|
+
extraSpecifiers?: string;
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default EnhHeadingBlockComponent;
|
|
7
|
+
//# sourceMappingURL=enh-heading.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enh-heading.d.ts","sourceRoot":"","sources":["../../src/blocks/enh-heading.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,mBAAmB,EAAO,MAAM,QAAQ,CAAA;AA2DtD,eAAO,MAAM,wBAAwB,mEAMlC,mBAAmB,GAAG;IACvB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,4CAkDA,CAAA;eAEc,wBAAwB"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
'use client';import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ApplyTypography } from '../backends/gui/prose.js';
|
|
3
|
+
import { Box } from '../box.js';
|
|
4
|
+
import { cn } from '../core/cn.js';
|
|
5
|
+
import { has } from './spec.js';
|
|
6
|
+
const DEFAULT = {
|
|
7
|
+
preheading: { tag: 'h4', mb: 2 },
|
|
8
|
+
heading: { tag: 'h1', mb: 2 },
|
|
9
|
+
byline: { tag: 'h6' },
|
|
10
|
+
};
|
|
11
|
+
/** 0 is a paragraph; 1–6 are the heading tags. */
|
|
12
|
+
const tag = (level, fallback) => level === undefined ? fallback : level >= 1 && level <= 6 ? `h${level}` : 'p';
|
|
13
|
+
/** An icon given as a url is drawn at `size`; given as a node it renders as-is. */
|
|
14
|
+
const Mark = ({ icon, size, phone, }) => {
|
|
15
|
+
if (!icon)
|
|
16
|
+
return null;
|
|
17
|
+
if (typeof icon === 'string') {
|
|
18
|
+
const s = phone ? size * 0.75 : size;
|
|
19
|
+
return _jsx(Box, { tag: "img", src: icon, width: s, height: s, alt: "" });
|
|
20
|
+
}
|
|
21
|
+
return _jsx(Box, { children: icon });
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Where the three parts sit.
|
|
25
|
+
*
|
|
26
|
+
* The byline is tracked separately from the heading because it aligns
|
|
27
|
+
* independently — a centred heading over a left-aligned byline is a normal
|
|
28
|
+
* layout, and one value could not express it.
|
|
29
|
+
*/
|
|
30
|
+
const place = (spec, phone) => {
|
|
31
|
+
const centre = spec('center');
|
|
32
|
+
const right = spec('right');
|
|
33
|
+
const at = (c, r) => c ? 'self-center text-center' : r ? 'self-end text-right' : 'self-start text-left';
|
|
34
|
+
let heading = at(centre, right);
|
|
35
|
+
let byline = at(spec('byline-center'), spec('byline-right'));
|
|
36
|
+
if (phone) {
|
|
37
|
+
if (spec('mobile-heading-left'))
|
|
38
|
+
heading = 'self-start text-left';
|
|
39
|
+
else
|
|
40
|
+
heading = at(spec('mobile-heading-centered') || centre, right);
|
|
41
|
+
if (spec('mobile-byline-left'))
|
|
42
|
+
byline = 'self-start text-left';
|
|
43
|
+
}
|
|
44
|
+
else if (spec('mobile-heading-centered')) {
|
|
45
|
+
// Centred on a phone, and whatever was asked for from `md` up.
|
|
46
|
+
heading = `self-center text-center ${heading.split(' ').map((c) => `md:${c}`).join(' ')}`;
|
|
47
|
+
}
|
|
48
|
+
return { heading, byline };
|
|
49
|
+
};
|
|
50
|
+
export const EnhHeadingBlockComponent = ({ block, className, agent, applyTypography = true, extraSpecifiers = '', }) => {
|
|
51
|
+
if (block.blockType !== 'enh-heading')
|
|
52
|
+
return _jsx(_Fragment, { children: "enh-heading block required" });
|
|
53
|
+
const b = block;
|
|
54
|
+
const spec = (s) => has(`${b.specifiers ?? ''} ${extraSpecifiers}`.trim(), s);
|
|
55
|
+
const phone = agent === 'phone';
|
|
56
|
+
const at = place(spec, phone);
|
|
57
|
+
const headFont = spec('preheading-heading-font') ? 'font-heading' : '';
|
|
58
|
+
const parts = [
|
|
59
|
+
b.preheading && {
|
|
60
|
+
Tag: tag(b.preheading.level, DEFAULT.preheading.tag),
|
|
61
|
+
cls: cn(`mb-${b.preheading.mb ?? DEFAULT.preheading.mb}`, at.heading, headFont),
|
|
62
|
+
text: b.preheading.text,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
Tag: tag(b.heading.level, DEFAULT.heading.tag),
|
|
66
|
+
cls: cn(`mb-${b.heading.mb ?? DEFAULT.heading.mb}`, at.heading),
|
|
67
|
+
text: b.heading.text,
|
|
68
|
+
},
|
|
69
|
+
b.byline && {
|
|
70
|
+
Tag: tag(b.byline.level, DEFAULT.byline.tag),
|
|
71
|
+
cls: at.byline,
|
|
72
|
+
text: b.byline.text,
|
|
73
|
+
},
|
|
74
|
+
].filter(Boolean);
|
|
75
|
+
// The icon rides the FIRST part that renders, whichever that turns out to be.
|
|
76
|
+
const inner = parts.map(({ Tag, cls, text }, i) => b.icon && i === 0 ? (_jsxs(Box, { className: cn('flex flex-row items-center gap-2 sm:gap-4', cls), children: [_jsx(Mark, { icon: b.icon, size: b.iconSize ?? 32, phone: phone }), _jsx(Box, { tag: Tag, children: text })] }, i)) : (_jsx(Box, { tag: Tag, className: cls, children: text }, i)));
|
|
77
|
+
// `gap-0` because each part carries its own bottom margin — a gap on the
|
|
78
|
+
// column would add to every one of them and double the spacing.
|
|
79
|
+
const cls = cn('flex flex-col w-full gap-0', className, spec('align-middle') && 'my-auto');
|
|
80
|
+
return applyTypography ? (_jsx(ApplyTypography, { className: cls, children: inner })) : (_jsx(Box, { className: cls, children: inner }));
|
|
81
|
+
};
|
|
82
|
+
export default EnhHeadingBlockComponent;
|
|
83
|
+
//# sourceMappingURL=enh-heading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enh-heading.js","sourceRoot":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AC,CAAA;AAED,eAAe,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.GridBlockComponent = void 0;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const React = __importStar(require("react"));
|
|
39
|
+
const box_1 = require("../box.cjs");
|
|
40
|
+
const cn_1 = require("../core/cn.cjs");
|
|
41
|
+
const content_1 = require("./content.cjs");
|
|
42
|
+
const spec_1 = require("./spec.cjs");
|
|
43
|
+
const cols = (d, at = '') => typeof d === 'number'
|
|
44
|
+
? `${at}grid-cols-${d}`
|
|
45
|
+
: `${at}grid-cols-${d.columns} ${at}gap-${d.gap}`;
|
|
46
|
+
/**
|
|
47
|
+
* Cells drawn as a table: every cell carries its own right and bottom rule, and
|
|
48
|
+
* the edges of the whole are closed by the first row and first column adding
|
|
49
|
+
* theirs. Corners round outward only.
|
|
50
|
+
*
|
|
51
|
+
* Below `md` the grid is a single column, so the vertical rules are dropped and
|
|
52
|
+
* each cell keeps just its bottom one — which reads as a list, correctly.
|
|
53
|
+
*/
|
|
54
|
+
const table = (i, count, columns) => {
|
|
55
|
+
const first = i < columns;
|
|
56
|
+
return (0, cn_1.cn)('border-b md:border-r p-4 md:p-8 lg:p-12', first && 'border-t', i % columns === 0 && 'md:border-l', i === 0 && 'md:rounded-tl-lg', i === columns - 1 && 'md:rounded-tr-lg', i === count - columns && 'md:rounded-bl-lg', i === count - 1 && 'md:rounded-br-lg');
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Blocks laid out on a grid.
|
|
60
|
+
*
|
|
61
|
+
* Rendered with children, those replace `cells` — which is how BulletCards uses
|
|
62
|
+
* it: same layout, different cell content.
|
|
63
|
+
*
|
|
64
|
+
* The first rung in `grid.at` is written WITHOUT a prefix so the grid always has
|
|
65
|
+
* a base to fall back to, whichever rung a site chose to start at. The rest are
|
|
66
|
+
* prefixed and take over as the viewport grows.
|
|
67
|
+
*/
|
|
68
|
+
const GridBlockComponent = ({ block, className, agent, children, }) => {
|
|
69
|
+
if (block.blockType !== 'grid')
|
|
70
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "grid block required" });
|
|
71
|
+
const { cells, grid, specifiers } = block;
|
|
72
|
+
let layout = '';
|
|
73
|
+
if (agent === 'phone') {
|
|
74
|
+
layout = cols(grid.mobile ?? grid.at.xs ?? grid.at.sm ?? 1);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
let base = false;
|
|
78
|
+
for (const [rung, spec] of Object.entries(grid.at)) {
|
|
79
|
+
layout += `${cols(spec, base ? `${rung}:` : '')} `;
|
|
80
|
+
base = true;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const ruled = (0, spec_1.has)(specifiers, 'style-table-borders');
|
|
84
|
+
let cell = (_) => '';
|
|
85
|
+
if (ruled && cells?.length) {
|
|
86
|
+
const md = grid.at.md;
|
|
87
|
+
const columns = typeof md === 'number' ? md : (md?.columns ?? 1);
|
|
88
|
+
cell = (i) => table(i, cells.length, columns);
|
|
89
|
+
}
|
|
90
|
+
return ((0, jsx_runtime_1.jsx)(box_1.Box, { className: (0, cn_1.cn)('grid gap-2 md:gap-4 xl:gap-6', layout,
|
|
91
|
+
// Ruled cells own their spacing: a gap would open a gutter through the
|
|
92
|
+
// rules and the table would stop reading as one.
|
|
93
|
+
ruled && 'gap-0 md:gap-0 xl:gap-0', className), children: React.Children.count(children) > 0
|
|
94
|
+
? children
|
|
95
|
+
: cells?.map((c, i) => ((0, jsx_runtime_1.jsx)(content_1.Content, { blocks: c, agent: agent, className: cell(i) }, i))) }));
|
|
96
|
+
};
|
|
97
|
+
exports.GridBlockComponent = GridBlockComponent;
|
|
98
|
+
exports.default = exports.GridBlockComponent;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { Block, GridBlock } from './def.js';
|
|
3
|
+
import { type BlockComponentProps } from './spec.js';
|
|
4
|
+
/**
|
|
5
|
+
* Blocks laid out on a grid.
|
|
6
|
+
*
|
|
7
|
+
* Rendered with children, those replace `cells` — which is how BulletCards uses
|
|
8
|
+
* it: same layout, different cell content.
|
|
9
|
+
*
|
|
10
|
+
* The first rung in `grid.at` is written WITHOUT a prefix so the grid always has
|
|
11
|
+
* a base to fall back to, whichever rung a site chose to start at. The rest are
|
|
12
|
+
* prefixed and take over as the viewport grows.
|
|
13
|
+
*/
|
|
14
|
+
export declare const GridBlockComponent: ({ block, className, agent, children, }: Omit<BlockComponentProps, 'block'> & React.PropsWithChildren<{
|
|
15
|
+
block: Block | GridBlock;
|
|
16
|
+
}>) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default GridBlockComponent;
|
|
18
|
+
//# sourceMappingURL=grid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../src/blocks/grid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAE7C,OAAO,EAAE,KAAK,mBAAmB,EAAO,MAAM,QAAQ,CAAA;AA4BtD;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,2CAK5B,IAAI,CAAC,mBAAmB,EAAE,OAAO,CAAC,GACnC,KAAK,CAAC,iBAAiB,CAAC;IAAE,KAAK,EAAE,KAAK,GAAG,SAAS,CAAA;CAAE,CAAC,4CAyCtD,CAAA;eAEc,kBAAkB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use client';import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Box } from '../box.js';
|
|
4
|
+
import { cn } from '../core/cn.js';
|
|
5
|
+
import { Content } from './content.js';
|
|
6
|
+
import { has } from './spec.js';
|
|
7
|
+
const cols = (d, at = '') => typeof d === 'number'
|
|
8
|
+
? `${at}grid-cols-${d}`
|
|
9
|
+
: `${at}grid-cols-${d.columns} ${at}gap-${d.gap}`;
|
|
10
|
+
/**
|
|
11
|
+
* Cells drawn as a table: every cell carries its own right and bottom rule, and
|
|
12
|
+
* the edges of the whole are closed by the first row and first column adding
|
|
13
|
+
* theirs. Corners round outward only.
|
|
14
|
+
*
|
|
15
|
+
* Below `md` the grid is a single column, so the vertical rules are dropped and
|
|
16
|
+
* each cell keeps just its bottom one — which reads as a list, correctly.
|
|
17
|
+
*/
|
|
18
|
+
const table = (i, count, columns) => {
|
|
19
|
+
const first = i < columns;
|
|
20
|
+
return cn('border-b md:border-r p-4 md:p-8 lg:p-12', first && 'border-t', i % columns === 0 && 'md:border-l', i === 0 && 'md:rounded-tl-lg', i === columns - 1 && 'md:rounded-tr-lg', i === count - columns && 'md:rounded-bl-lg', i === count - 1 && 'md:rounded-br-lg');
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Blocks laid out on a grid.
|
|
24
|
+
*
|
|
25
|
+
* Rendered with children, those replace `cells` — which is how BulletCards uses
|
|
26
|
+
* it: same layout, different cell content.
|
|
27
|
+
*
|
|
28
|
+
* The first rung in `grid.at` is written WITHOUT a prefix so the grid always has
|
|
29
|
+
* a base to fall back to, whichever rung a site chose to start at. The rest are
|
|
30
|
+
* prefixed and take over as the viewport grows.
|
|
31
|
+
*/
|
|
32
|
+
export const GridBlockComponent = ({ block, className, agent, children, }) => {
|
|
33
|
+
if (block.blockType !== 'grid')
|
|
34
|
+
return _jsx(_Fragment, { children: "grid block required" });
|
|
35
|
+
const { cells, grid, specifiers } = block;
|
|
36
|
+
let layout = '';
|
|
37
|
+
if (agent === 'phone') {
|
|
38
|
+
layout = cols(grid.mobile ?? grid.at.xs ?? grid.at.sm ?? 1);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
let base = false;
|
|
42
|
+
for (const [rung, spec] of Object.entries(grid.at)) {
|
|
43
|
+
layout += `${cols(spec, base ? `${rung}:` : '')} `;
|
|
44
|
+
base = true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const ruled = has(specifiers, 'style-table-borders');
|
|
48
|
+
let cell = (_) => '';
|
|
49
|
+
if (ruled && cells?.length) {
|
|
50
|
+
const md = grid.at.md;
|
|
51
|
+
const columns = typeof md === 'number' ? md : (md?.columns ?? 1);
|
|
52
|
+
cell = (i) => table(i, cells.length, columns);
|
|
53
|
+
}
|
|
54
|
+
return (_jsx(Box, { className: cn('grid gap-2 md:gap-4 xl:gap-6', layout,
|
|
55
|
+
// Ruled cells own their spacing: a gap would open a gutter through the
|
|
56
|
+
// rules and the table would stop reading as one.
|
|
57
|
+
ruled && 'gap-0 md:gap-0 xl:gap-0', className), children: React.Children.count(children) > 0
|
|
58
|
+
? children
|
|
59
|
+
: cells?.map((c, i) => (_jsx(Content, { blocks: c, agent: agent, className: cell(i) }, i))) }));
|
|
60
|
+
};
|
|
61
|
+
export default GridBlockComponent;
|
|
62
|
+
//# sourceMappingURL=grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid.js","sourceRoot":"","sources":["../../src/blocks/grid.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AAG/B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAA4B,GAAG,EAAE,MAAM,QAAQ,CAAA;AAEtD,MAAM,IAAI,GAAG,CAAC,CAAiB,EAAE,EAAE,GAAG,EAAE,EAAU,EAAE,CAClD,OAAO,CAAC,KAAK,QAAQ;IACnB,CAAC,CAAC,GAAG,EAAE,aAAa,CAAC,EAAE;IACvB,CAAC,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC,OAAO,IAAI,EAAE,OAAO,CAAC,CAAC,GAAG,EAAE,CAAA;AAErD;;;;;;;GAOG;AACH,MAAM,KAAK,GAAG,CAAC,CAAS,EAAE,KAAa,EAAE,OAAe,EAAU,EAA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,MAAM,KAAK,GAAG,GAAG,CAAC,UAAU,EAAE,qBAAqB,CAAC,CAAA;IACpD,IAAI,IAAI,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,EAAE,CAAA;IAC5B,IAAI,KAAK,IAAI,KAAK,EAAE,MAAM,EAAE,CAAC;QAC3B,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC,EAAE,CAAA;QACrB,MAAM,OAAO,GAAG,OAAO,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,IAAI,CAAC,CAAC,CAAA;QAChE,IAAI,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACvD,CAAC;IAED,OAAO,CACL,KAAC,GAAG,IACF,SAAS,EAAE,EAAE,CACX,8BAA8B,EAC9B,MAAM;QACN,uEAAuE;QACvE,iDAAiD;QACjD,KAAK,IAAI,yBAAyB,EAClC,SAAS,CACV,YAEA,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;YACjC,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CACnB,KAAC,OAAO,IAAC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAU,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,IAArB,CAAC,CAAwB,CACjE,CAAC,GACF,CACP,CAAA;AACH,CAAC,CAAA;AAED,eAAe,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GroupBlockComponent = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const box_1 = require("../box.cjs");
|
|
6
|
+
const cn_1 = require("../core/cn.cjs");
|
|
7
|
+
const types_1 = require("../types.cjs");
|
|
8
|
+
const content_1 = require("./content.cjs");
|
|
9
|
+
/**
|
|
10
|
+
* Reads a layout hint: `layout-grid-3-starting-md` — three columns, from `md`
|
|
11
|
+
* up, one column below it.
|
|
12
|
+
*
|
|
13
|
+
* The bounds are real: one column is not a grid, and past six the cells are
|
|
14
|
+
* narrower than the words in them. Out of range returns nothing, and the block
|
|
15
|
+
* says so rather than rendering a layout nobody asked for.
|
|
16
|
+
*/
|
|
17
|
+
const layout = (specifiers) => {
|
|
18
|
+
const hint = specifiers.split(/\s+/).find((t) => t.startsWith('layout-'));
|
|
19
|
+
if (!hint)
|
|
20
|
+
return undefined;
|
|
21
|
+
const [, kind, count, , from] = hint.split('-');
|
|
22
|
+
if (kind !== 'grid')
|
|
23
|
+
return undefined;
|
|
24
|
+
const columns = parseInt(count, 10);
|
|
25
|
+
if (Number.isNaN(columns) || columns < 2 || columns > 6)
|
|
26
|
+
return undefined;
|
|
27
|
+
if (!types_1.Breakpoints.includes(from))
|
|
28
|
+
return undefined;
|
|
29
|
+
return { columns, from: from };
|
|
30
|
+
};
|
|
31
|
+
const GroupBlockComponent = ({ block, className, agent }) => {
|
|
32
|
+
if (block.blockType !== 'group')
|
|
33
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "group block required" });
|
|
34
|
+
const b = block;
|
|
35
|
+
if (!b.specifiers?.includes('layout'))
|
|
36
|
+
return null;
|
|
37
|
+
const spec = layout(b.specifiers);
|
|
38
|
+
if (!spec)
|
|
39
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "invalid or missing layout specifier in group block" });
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(box_1.Box, { className: (0, cn_1.cn)('grid grid-cols-1 gap-2 sm:gap-3', `${spec.from}:grid-cols-${spec.columns}`, className), children: (0, jsx_runtime_1.jsx)(content_1.Content, { blocks: b.elements, agent: agent }) }));
|
|
41
|
+
};
|
|
42
|
+
exports.GroupBlockComponent = GroupBlockComponent;
|
|
43
|
+
exports.default = exports.GroupBlockComponent;
|