@cogenta/theme-canonical 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/dist/src/index.d.ts +21 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +21 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/render/actions.d.ts +17 -0
- package/dist/src/render/actions.d.ts.map +1 -0
- package/dist/src/render/actions.js +43 -0
- package/dist/src/render/actions.js.map +1 -0
- package/dist/src/render/blocks/collection-list.d.ts +16 -0
- package/dist/src/render/blocks/collection-list.d.ts.map +1 -0
- package/dist/src/render/blocks/collection-list.js +54 -0
- package/dist/src/render/blocks/collection-list.js.map +1 -0
- package/dist/src/render/blocks/cta.d.ts +5 -0
- package/dist/src/render/blocks/cta.d.ts.map +1 -0
- package/dist/src/render/blocks/cta.js +10 -0
- package/dist/src/render/blocks/cta.js.map +1 -0
- package/dist/src/render/blocks/embed.d.ts +5 -0
- package/dist/src/render/blocks/embed.d.ts.map +1 -0
- package/dist/src/render/blocks/embed.js +88 -0
- package/dist/src/render/blocks/embed.js.map +1 -0
- package/dist/src/render/blocks/faq.d.ts +5 -0
- package/dist/src/render/blocks/faq.d.ts.map +1 -0
- package/dist/src/render/blocks/faq.js +21 -0
- package/dist/src/render/blocks/faq.js.map +1 -0
- package/dist/src/render/blocks/feature-grid.d.ts +5 -0
- package/dist/src/render/blocks/feature-grid.d.ts.map +1 -0
- package/dist/src/render/blocks/feature-grid.js +27 -0
- package/dist/src/render/blocks/feature-grid.js.map +1 -0
- package/dist/src/render/blocks/gallery.d.ts +15 -0
- package/dist/src/render/blocks/gallery.d.ts.map +1 -0
- package/dist/src/render/blocks/gallery.js +28 -0
- package/dist/src/render/blocks/gallery.js.map +1 -0
- package/dist/src/render/blocks/hero.d.ts +12 -0
- package/dist/src/render/blocks/hero.d.ts.map +1 -0
- package/dist/src/render/blocks/hero.js +25 -0
- package/dist/src/render/blocks/hero.js.map +1 -0
- package/dist/src/render/blocks/logos.d.ts +5 -0
- package/dist/src/render/blocks/logos.d.ts.map +1 -0
- package/dist/src/render/blocks/logos.js +25 -0
- package/dist/src/render/blocks/logos.js.map +1 -0
- package/dist/src/render/blocks/media-figure.d.ts +15 -0
- package/dist/src/render/blocks/media-figure.d.ts.map +1 -0
- package/dist/src/render/blocks/media-figure.js +30 -0
- package/dist/src/render/blocks/media-figure.js.map +1 -0
- package/dist/src/render/blocks/prose.d.ts +10 -0
- package/dist/src/render/blocks/prose.d.ts.map +1 -0
- package/dist/src/render/blocks/prose.js +11 -0
- package/dist/src/render/blocks/prose.js.map +1 -0
- package/dist/src/render/blocks/quote.d.ts +14 -0
- package/dist/src/render/blocks/quote.d.ts.map +1 -0
- package/dist/src/render/blocks/quote.js +25 -0
- package/dist/src/render/blocks/quote.js.map +1 -0
- package/dist/src/render/blocks/stats.d.ts +5 -0
- package/dist/src/render/blocks/stats.d.ts.map +1 -0
- package/dist/src/render/blocks/stats.js +23 -0
- package/dist/src/render/blocks/stats.js.map +1 -0
- package/dist/src/render/entry.d.ts +7 -0
- package/dist/src/render/entry.d.ts.map +1 -0
- package/dist/src/render/entry.js +35 -0
- package/dist/src/render/entry.js.map +1 -0
- package/dist/src/render/heading.d.ts +14 -0
- package/dist/src/render/heading.d.ts.map +1 -0
- package/dist/src/render/heading.js +34 -0
- package/dist/src/render/heading.js.map +1 -0
- package/dist/src/render/html.d.ts +44 -0
- package/dist/src/render/html.d.ts.map +1 -0
- package/dist/src/render/html.js +96 -0
- package/dist/src/render/html.js.map +1 -0
- package/dist/src/render/media.d.ts +32 -0
- package/dist/src/render/media.d.ts.map +1 -0
- package/dist/src/render/media.js +42 -0
- package/dist/src/render/media.js.map +1 -0
- package/dist/src/render/render-block.d.ts +26 -0
- package/dist/src/render/render-block.d.ts.map +1 -0
- package/dist/src/render/render-block.js +66 -0
- package/dist/src/render/render-block.js.map +1 -0
- package/dist/src/render/rich-text.d.ts +5 -0
- package/dist/src/render/rich-text.d.ts.map +1 -0
- package/dist/src/render/rich-text.js +105 -0
- package/dist/src/render/rich-text.js.map +1 -0
- package/dist/src/theme-contract.d.ts +165 -0
- package/dist/src/theme-contract.d.ts.map +1 -0
- package/dist/src/theme-contract.js +21 -0
- package/dist/src/theme-contract.js.map +1 -0
- package/dist/theme.config.d.ts +31 -0
- package/dist/theme.config.d.ts.map +1 -0
- package/dist/theme.config.js +42 -0
- package/dist/theme.config.js.map +1 -0
- package/package.json +57 -0
- package/src/blocks/CollectionList.astro +20 -0
- package/src/blocks/Cta.astro +11 -0
- package/src/blocks/Embed.astro +18 -0
- package/src/blocks/Faq.astro +16 -0
- package/src/blocks/FeatureGrid.astro +11 -0
- package/src/blocks/Gallery.astro +17 -0
- package/src/blocks/Hero.astro +25 -0
- package/src/blocks/Logos.astro +11 -0
- package/src/blocks/MediaFigure.astro +11 -0
- package/src/blocks/Prose.astro +11 -0
- package/src/blocks/Quote.astro +11 -0
- package/src/blocks/Stats.astro +11 -0
- package/src/components/BlockZone.astro +62 -0
- package/src/index.ts +20 -0
- package/src/layouts/Base.astro +63 -0
- package/src/render/actions.ts +57 -0
- package/src/render/blocks/collection-list.ts +98 -0
- package/src/render/blocks/cta.ts +17 -0
- package/src/render/blocks/embed.ts +111 -0
- package/src/render/blocks/faq.ts +42 -0
- package/src/render/blocks/feature-grid.ts +54 -0
- package/src/render/blocks/gallery.ts +49 -0
- package/src/render/blocks/hero.ts +42 -0
- package/src/render/blocks/logos.ts +45 -0
- package/src/render/blocks/media-figure.ts +42 -0
- package/src/render/blocks/prose.ts +17 -0
- package/src/render/blocks/quote.ts +39 -0
- package/src/render/blocks/stats.ts +41 -0
- package/src/render/entry.ts +40 -0
- package/src/render/heading.ts +44 -0
- package/src/render/html.ts +122 -0
- package/src/render/media.ts +62 -0
- package/src/render/render-block.ts +97 -0
- package/src/render/rich-text.ts +150 -0
- package/src/styles/theme.css +606 -0
- package/src/theme-contract.ts +159 -0
- package/tokens.json +36 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from './render/actions.js';
|
|
2
|
+
export * from './render/blocks/collection-list.js';
|
|
3
|
+
export * from './render/blocks/cta.js';
|
|
4
|
+
export * from './render/blocks/embed.js';
|
|
5
|
+
export * from './render/blocks/faq.js';
|
|
6
|
+
export * from './render/blocks/feature-grid.js';
|
|
7
|
+
export * from './render/blocks/gallery.js';
|
|
8
|
+
export * from './render/blocks/hero.js';
|
|
9
|
+
export * from './render/blocks/logos.js';
|
|
10
|
+
export * from './render/blocks/media-figure.js';
|
|
11
|
+
export * from './render/blocks/prose.js';
|
|
12
|
+
export * from './render/blocks/quote.js';
|
|
13
|
+
export * from './render/blocks/stats.js';
|
|
14
|
+
export * from './render/entry.js';
|
|
15
|
+
export * from './render/heading.js';
|
|
16
|
+
export * from './render/html.js';
|
|
17
|
+
export * from './render/media.js';
|
|
18
|
+
export * from './render/render-block.js';
|
|
19
|
+
export * from './render/rich-text.js';
|
|
20
|
+
export * from './theme-contract.js';
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,oCAAoC,CAAA;AAClD,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,0BAA0B,CAAA;AACxC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from './render/actions.js';
|
|
2
|
+
export * from './render/blocks/collection-list.js';
|
|
3
|
+
export * from './render/blocks/cta.js';
|
|
4
|
+
export * from './render/blocks/embed.js';
|
|
5
|
+
export * from './render/blocks/faq.js';
|
|
6
|
+
export * from './render/blocks/feature-grid.js';
|
|
7
|
+
export * from './render/blocks/gallery.js';
|
|
8
|
+
export * from './render/blocks/hero.js';
|
|
9
|
+
export * from './render/blocks/logos.js';
|
|
10
|
+
export * from './render/blocks/media-figure.js';
|
|
11
|
+
export * from './render/blocks/prose.js';
|
|
12
|
+
export * from './render/blocks/quote.js';
|
|
13
|
+
export * from './render/blocks/stats.js';
|
|
14
|
+
export * from './render/entry.js';
|
|
15
|
+
export * from './render/heading.js';
|
|
16
|
+
export * from './render/html.js';
|
|
17
|
+
export * from './render/media.js';
|
|
18
|
+
export * from './render/render-block.js';
|
|
19
|
+
export * from './render/rich-text.js';
|
|
20
|
+
export * from './theme-contract.js';
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,oCAAoC,CAAA;AAClD,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,0BAA0B,CAAA;AACxC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Action, LinkTarget } from '@cogenta/blocks';
|
|
2
|
+
import type { RenderContext } from '../theme-contract.js';
|
|
3
|
+
import { type HtmlElement } from './html.js';
|
|
4
|
+
/**
|
|
5
|
+
* A target is resolved through `ctx.link` in every case, including an external
|
|
6
|
+
* `href`: the context is the only thing that knows the locale prefix and the
|
|
7
|
+
* site's base URL, and duplicating that reasoning here is how a theme starts
|
|
8
|
+
* emitting broken links in a sub-path deployment.
|
|
9
|
+
*/
|
|
10
|
+
export declare function href(ctx: RenderContext, target: LinkTarget): string;
|
|
11
|
+
export declare function actionLink(ctx: RenderContext, action: Action): HtmlElement;
|
|
12
|
+
/**
|
|
13
|
+
* A list, not a row of loose anchors: a screen reader then announces "list, 2
|
|
14
|
+
* items" and the actions are navigable as a group.
|
|
15
|
+
*/
|
|
16
|
+
export declare function actionList(ctx: RenderContext, actions: readonly Action[] | undefined, label: string): HtmlElement | null;
|
|
17
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/render/actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,KAAK,WAAW,EAAK,MAAM,WAAW,CAAA;AAE/C;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,CAEnE;AAWD,wBAAgB,UAAU,CAAC,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CAgB1E;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EACtC,KAAK,EAAE,MAAM,GACZ,WAAW,GAAG,IAAI,CAOpB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { h } from './html.js';
|
|
2
|
+
/**
|
|
3
|
+
* A target is resolved through `ctx.link` in every case, including an external
|
|
4
|
+
* `href`: the context is the only thing that knows the locale prefix and the
|
|
5
|
+
* site's base URL, and duplicating that reasoning here is how a theme starts
|
|
6
|
+
* emitting broken links in a sub-path deployment.
|
|
7
|
+
*/
|
|
8
|
+
export function href(ctx, target) {
|
|
9
|
+
return 'href' in target ? ctx.link(target.href) : ctx.link(target);
|
|
10
|
+
}
|
|
11
|
+
/** A link that leaves the site gets the protection; a same-site one must not. */
|
|
12
|
+
function isExternal(ctx, url) {
|
|
13
|
+
if (!/^[a-z][a-z0-9+.-]*:/i.test(url))
|
|
14
|
+
return false;
|
|
15
|
+
const site = URL.parse(ctx.site.url);
|
|
16
|
+
const target = URL.parse(url);
|
|
17
|
+
if (site === null || target === null)
|
|
18
|
+
return false;
|
|
19
|
+
return site.host !== target.host;
|
|
20
|
+
}
|
|
21
|
+
export function actionLink(ctx, action) {
|
|
22
|
+
const url = href(ctx, action.target);
|
|
23
|
+
const external = isExternal(ctx, url);
|
|
24
|
+
return h('a', {
|
|
25
|
+
class: 'cg-action',
|
|
26
|
+
// `emphasis` is a semantic intent, so it stays an attribute the skin reads
|
|
27
|
+
// rather than a class the block dictated. Default `secondary`: promoting
|
|
28
|
+
// an unstated action to primary is a decision the editor did not make.
|
|
29
|
+
'data-emphasis': action.emphasis ?? 'secondary',
|
|
30
|
+
href: url,
|
|
31
|
+
rel: external ? 'noopener noreferrer' : undefined,
|
|
32
|
+
}, action.label);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A list, not a row of loose anchors: a screen reader then announces "list, 2
|
|
36
|
+
* items" and the actions are navigable as a group.
|
|
37
|
+
*/
|
|
38
|
+
export function actionList(ctx, actions, label) {
|
|
39
|
+
if (actions === undefined || actions.length === 0)
|
|
40
|
+
return null;
|
|
41
|
+
return h('ul', { class: 'cg-actions', 'aria-label': label }, actions.map((action) => h('li', {}, actionLink(ctx, action))));
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../src/render/actions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,CAAC,EAAE,MAAM,WAAW,CAAA;AAE/C;;;;;GAKG;AACH,MAAM,UAAU,IAAI,CAAC,GAAkB,EAAE,MAAkB;IACzD,OAAO,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AACpE,CAAC;AAED,iFAAiF;AACjF,SAAS,UAAU,CAAC,GAAkB,EAAE,GAAW;IACjD,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAA;IACnD,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACpC,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC7B,IAAI,IAAI,KAAK,IAAI,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,KAAK,CAAA;IAClD,OAAO,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,CAAA;AAClC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAkB,EAAE,MAAc;IAC3D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;IACpC,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACrC,OAAO,CAAC,CACN,GAAG,EACH;QACE,KAAK,EAAE,WAAW;QAClB,2EAA2E;QAC3E,yEAAyE;QACzE,uEAAuE;QACvE,eAAe,EAAE,MAAM,CAAC,QAAQ,IAAI,WAAW;QAC/C,IAAI,EAAE,GAAG;QACT,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS;KAClD,EACD,MAAM,CAAC,KAAK,CACb,CAAA;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU,CACxB,GAAkB,EAClB,OAAsC,EACtC,KAAa;IAEb,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IAC9D,OAAO,CAAC,CACN,IAAI,EACJ,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,EAC5C,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,CAC9D,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CollectionListBlock } from '@cogenta/blocks';
|
|
2
|
+
import type { ContentEntry, QueryRequest, RenderContext } from '../../theme-contract.js';
|
|
3
|
+
import { type HtmlElement } from '../html.js';
|
|
4
|
+
/**
|
|
5
|
+
* The only block of the twelve that reads data at render time — contract B
|
|
6
|
+
* marks it `runtime: 'server'` for that reason.
|
|
7
|
+
*
|
|
8
|
+
* The read is *not* done here. `query` builds the request, the `.astro`
|
|
9
|
+
* component awaits `ctx.content.list(...)` in its frontmatter, and this
|
|
10
|
+
* function stays a pure function of the entries it is handed. That keeps the
|
|
11
|
+
* markup snapshot-testable and keeps the theme's single door to data — the
|
|
12
|
+
* read-only content client — in one visible place.
|
|
13
|
+
*/
|
|
14
|
+
export declare function query(block: CollectionListBlock): QueryRequest;
|
|
15
|
+
export declare function renderCollectionList(block: CollectionListBlock, ctx: RenderContext, entries: readonly ContentEntry[]): HtmlElement;
|
|
16
|
+
//# sourceMappingURL=collection-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-list.d.ts","sourceRoot":"","sources":["../../../../src/render/blocks/collection-list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAGxF,OAAO,EAAE,KAAK,WAAW,EAAK,MAAM,YAAY,CAAA;AAEhD;;;;;;;;;GASG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,mBAAmB,GAAG,YAAY,CAQ9D;AA8BD,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,mBAAmB,EAC1B,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,SAAS,YAAY,EAAE,GAC/B,WAAW,CAuCb"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { entryDate, entryExcerpt, entryHref, entryTitle } from '../entry.js';
|
|
2
|
+
import { blockHeadingTag, heading, nestedHeadingTag } from '../heading.js';
|
|
3
|
+
import { h } from '../html.js';
|
|
4
|
+
/**
|
|
5
|
+
* The only block of the twelve that reads data at render time — contract B
|
|
6
|
+
* marks it `runtime: 'server'` for that reason.
|
|
7
|
+
*
|
|
8
|
+
* The read is *not* done here. `query` builds the request, the `.astro`
|
|
9
|
+
* component awaits `ctx.content.list(...)` in its frontmatter, and this
|
|
10
|
+
* function stays a pure function of the entries it is handed. That keeps the
|
|
11
|
+
* markup snapshot-testable and keeps the theme's single door to data — the
|
|
12
|
+
* read-only content client — in one visible place.
|
|
13
|
+
*/
|
|
14
|
+
export function query(block) {
|
|
15
|
+
return {
|
|
16
|
+
collection: block.collection,
|
|
17
|
+
...(block.filter === undefined ? {} : { filter: block.filter }),
|
|
18
|
+
...(block.sort === undefined ? {} : { sort: block.sort }),
|
|
19
|
+
// Capped by contract B at 100; an absent limit still must not mean "all".
|
|
20
|
+
limit: block.limit ?? 10,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function renderEntry(entry, ctx, tag) {
|
|
24
|
+
const date = entryDate(entry);
|
|
25
|
+
const excerpt = entryExcerpt(entry);
|
|
26
|
+
return h('li', { class: 'cg-entry' }, h('article', { class: 'cg-entry__body' }, heading(tag, { class: 'cg-entry__title' }, h('a', { class: 'cg-entry__link', href: entryHref(entry, ctx) }, entryTitle(entry, ctx))), date === undefined
|
|
27
|
+
? null
|
|
28
|
+
: h('time', { class: 'cg-entry__date', datetime: date },
|
|
29
|
+
// Formatted in the rendered locale rather than left as an ISO
|
|
30
|
+
// string: the machine-readable form is already in `datetime`.
|
|
31
|
+
new Intl.DateTimeFormat(ctx.locale, { dateStyle: 'long' }).format(new Date(date))), excerpt === undefined ? null : h('p', { class: 'cg-entry__excerpt' }, excerpt)));
|
|
32
|
+
}
|
|
33
|
+
export function renderCollectionList(block, ctx, entries) {
|
|
34
|
+
const hasTitle = block.title !== undefined;
|
|
35
|
+
const entryTag = nestedHeadingTag('collectionList', hasTitle);
|
|
36
|
+
const items = entries.length === 0
|
|
37
|
+
? h('p', { class: 'cg-collection__empty' }, ctx.t('collection.empty'))
|
|
38
|
+
: h('ul', { class: 'cg-collection__items' }, entries.map((entry) => renderEntry(entry, ctx, entryTag)));
|
|
39
|
+
return h('section', {
|
|
40
|
+
class: 'cg-block cg-collection',
|
|
41
|
+
'data-block': 'collectionList',
|
|
42
|
+
'data-layout': block.layout,
|
|
43
|
+
}, hasTitle
|
|
44
|
+
? heading(blockHeadingTag('collectionList') ?? 'h2', { class: 'cg-collection__title' }, block.title ?? '')
|
|
45
|
+
: null, block.layout === 'carousel'
|
|
46
|
+
? h('div', {
|
|
47
|
+
class: 'cg-collection__viewport',
|
|
48
|
+
role: 'region',
|
|
49
|
+
'aria-label': block.title ?? ctx.t('collection.carousel'),
|
|
50
|
+
tabindex: '0',
|
|
51
|
+
}, items)
|
|
52
|
+
: items);
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=collection-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collection-list.js","sourceRoot":"","sources":["../../../../src/render/blocks/collection-list.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC5E,OAAO,EAAE,eAAe,EAAmB,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAC3F,OAAO,EAAoB,CAAC,EAAE,MAAM,YAAY,CAAA;AAEhD;;;;;;;;;GASG;AACH,MAAM,UAAU,KAAK,CAAC,KAA0B;IAC9C,OAAO;QACL,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;QAC/D,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;QACzD,0EAA0E;QAC1E,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,EAAE;KACzB,CAAA;AACH,CAAC;AAED,SAAS,WAAW,CAAC,KAAmB,EAAE,GAAkB,EAAE,GAAe;IAC3E,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;IAC7B,MAAM,OAAO,GAAG,YAAY,CAAC,KAAK,CAAC,CAAA;IACnC,OAAO,CAAC,CACN,IAAI,EACJ,EAAE,KAAK,EAAE,UAAU,EAAE,EACrB,CAAC,CACC,SAAS,EACT,EAAE,KA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GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC,CAC1D,CAAA;IAEP,OAAO,CAAC,CACN,SAAS,EACT;QACE,KAAK,EAAE,wBAAwB;QAC/B,YAAY,EAAE,gBAAgB;QAC9B,aAAa,EAAE,KAAK,CAAC,MAAM;KAC5B,EACD,QAAQ;QACN,CAAC,CAAC,OAAO,CACL,eAAe,CAAC,gBAAgB,CAAC,IAAI,IAAI,EACzC,EAAE,KAAK,EAAE,sBAAsB,EAAE,EACjC,KAAK,CAAC,KAAK,IAAI,EAAE,CAClB;QACH,CAAC,CAAC,IAAI,EACR,KAAK,CAAC,MAAM,KAAK,UAAU;QACzB,CAAC,CAAC,CAAC,CACC,KAAK,EACL;YACE,KAAK,EAAE,yBAAyB;YAChC,IAAI,EAAE,QAAQ;YACd,YAAY,EAAE,KAAK,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC,qBAAqB,CAAC;YACzD,QAAQ,EAAE,GAAG;SACd,EACD,KAAK,CACN;QACH,CAAC,CAAC,KAAK,CACV,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CtaBlock } from '@cogenta/blocks';
|
|
2
|
+
import type { RenderContext } from '../../theme-contract.js';
|
|
3
|
+
import { type HtmlElement } from '../html.js';
|
|
4
|
+
export declare function renderCta(block: CtaBlock, ctx: RenderContext): HtmlElement;
|
|
5
|
+
//# sourceMappingURL=cta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cta.d.ts","sourceRoot":"","sources":["../../../../src/render/blocks/cta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAG5D,OAAO,EAAE,KAAK,WAAW,EAAK,MAAM,YAAY,CAAA;AAEhD,wBAAgB,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,aAAa,GAAG,WAAW,CAU1E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { actionList } from '../actions.js';
|
|
2
|
+
import { blockHeadingTag, heading } from '../heading.js';
|
|
3
|
+
import { h } from '../html.js';
|
|
4
|
+
export function renderCta(block, ctx) {
|
|
5
|
+
return h('section', { class: 'cg-block cg-cta', 'data-block': 'cta' }, heading(blockHeadingTag('cta') ?? 'h2', { class: 'cg-cta__title' }, block.title), block.text === undefined ? null : h('p', { class: 'cg-cta__text' }, block.text),
|
|
6
|
+
// `actions` is required and non-empty for a `cta`, so the list is always
|
|
7
|
+
// rendered; the null branch stays reachable only through invalid data.
|
|
8
|
+
actionList(ctx, block.actions, block.title));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=cta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cta.js","sourceRoot":"","sources":["../../../../src/render/blocks/cta.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACxD,OAAO,EAAoB,CAAC,EAAE,MAAM,YAAY,CAAA;AAEhD,MAAM,UAAU,SAAS,CAAC,KAAe,EAAE,GAAkB;IAC3D,OAAO,CAAC,CACN,SAAS,EACT,EAAE,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,KAAK,EAAE,EACjD,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE,KAAK,EAAE,eAAe,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,EAChF,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC;IAC/E,yEAAyE;IACzE,uEAAuE;IACvE,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAC5C,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { EmbedBlock } from '@cogenta/blocks';
|
|
2
|
+
import type { RenderContext } from '../../theme-contract.js';
|
|
3
|
+
import { type HtmlElement } from '../html.js';
|
|
4
|
+
export declare function renderEmbed(block: EmbedBlock, ctx: RenderContext): HtmlElement;
|
|
5
|
+
//# sourceMappingURL=embed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../../../../src/render/blocks/embed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,KAAK,WAAW,EAAK,MAAM,YAAY,CAAA;AAyEhD,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,aAAa,GAAG,WAAW,CAmC9E"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { h } from '../html.js';
|
|
2
|
+
import { aspectRatio } from '../media.js';
|
|
3
|
+
/**
|
|
4
|
+
* Nothing here contacts a third party before the visitor has consented.
|
|
5
|
+
*
|
|
6
|
+
* When `consentRequired` is true the block renders a self-contained card and an
|
|
7
|
+
* outbound link — no `<iframe>`, no `<script>`, no preconnect, no poster image
|
|
8
|
+
* fetched from the provider. An embed that "only" loads a thumbnail has already
|
|
9
|
+
* handed the visitor's IP address and a cookie to the provider, which is the
|
|
10
|
+
* exact transfer consent was supposed to gate.
|
|
11
|
+
*
|
|
12
|
+
* The theme ships no consent *button*, because it ships no JavaScript: granting
|
|
13
|
+
* consent is a site-wide decision that belongs to the consent layer, not to a
|
|
14
|
+
* block. Until that layer exists, the card is the honest rendering — it says
|
|
15
|
+
* what would be loaded and lets the visitor go there deliberately.
|
|
16
|
+
*/
|
|
17
|
+
/** `null` means "this provider has no embeddable frame we trust". */
|
|
18
|
+
function frameSource(provider, rawUrl) {
|
|
19
|
+
const url = URL.parse(rawUrl);
|
|
20
|
+
if (url === null)
|
|
21
|
+
return null;
|
|
22
|
+
const segments = url.pathname.split('/').filter((segment) => segment !== '');
|
|
23
|
+
switch (provider) {
|
|
24
|
+
case 'youtube': {
|
|
25
|
+
// `youtube-nocookie.com` is the privacy-preserving host, and the only one
|
|
26
|
+
// this theme will point an iframe at.
|
|
27
|
+
const id = url.hostname.endsWith('youtu.be')
|
|
28
|
+
? segments[0]
|
|
29
|
+
: (url.searchParams.get('v') ?? segments[1]);
|
|
30
|
+
return id === undefined || id === null ? null : `https://www.youtube-nocookie.com/embed/${id}`;
|
|
31
|
+
}
|
|
32
|
+
case 'vimeo': {
|
|
33
|
+
const id = segments.find((segment) => /^\d+$/.test(segment));
|
|
34
|
+
return id === undefined ? null : `https://player.vimeo.com/video/${id}`;
|
|
35
|
+
}
|
|
36
|
+
case 'dailymotion': {
|
|
37
|
+
const id = url.hostname.endsWith('dai.ly') ? segments[0] : segments[segments.length - 1];
|
|
38
|
+
return id === undefined ? null : `https://geo.dailymotion.com/player.html?video=${id}`;
|
|
39
|
+
}
|
|
40
|
+
case 'spotify': {
|
|
41
|
+
const [kind, id] = segments;
|
|
42
|
+
return kind === undefined || id === undefined
|
|
43
|
+
? null
|
|
44
|
+
: `https://open.spotify.com/embed/${kind}/${id}`;
|
|
45
|
+
}
|
|
46
|
+
case 'soundcloud':
|
|
47
|
+
return `https://w.soundcloud.com/player/?url=${encodeURIComponent(rawUrl)}`;
|
|
48
|
+
default:
|
|
49
|
+
// bluesky, mastodon, other: a post embed is a script tag, which this theme
|
|
50
|
+
// does not load. The link card is the rendering.
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function consentCard(block, ctx, reason) {
|
|
55
|
+
return h('div', { class: 'cg-embed__placeholder' }, h('p', { class: 'cg-embed__notice' }, reason), h('a', {
|
|
56
|
+
class: 'cg-embed__link',
|
|
57
|
+
href: ctx.link(block.url),
|
|
58
|
+
rel: 'noopener noreferrer nofollow',
|
|
59
|
+
}, ctx.t('embed.open', { provider: block.provider })));
|
|
60
|
+
}
|
|
61
|
+
export function renderEmbed(block, ctx) {
|
|
62
|
+
const source = block.consentRequired ? null : frameSource(block.provider, block.url);
|
|
63
|
+
// Video providers are 16:9 unless the editor framed them otherwise; without a
|
|
64
|
+
// ratio the frame would collapse and shift the layout as it loads.
|
|
65
|
+
const ratio = aspectRatio(block.ratio) ?? '16 / 9';
|
|
66
|
+
return h('div', {
|
|
67
|
+
class: 'cg-block cg-embed',
|
|
68
|
+
'data-block': 'embed',
|
|
69
|
+
'data-provider': block.provider,
|
|
70
|
+
'data-consent': block.consentRequired ? 'required' : 'not-required',
|
|
71
|
+
style: `--cg-ratio:${ratio}`,
|
|
72
|
+
}, source === null
|
|
73
|
+
? consentCard(block, ctx, block.consentRequired
|
|
74
|
+
? ctx.t('embed.consentRequired', { provider: block.provider })
|
|
75
|
+
: ctx.t('embed.unsupported', { provider: block.provider }))
|
|
76
|
+
: h('iframe', {
|
|
77
|
+
class: 'cg-embed__frame',
|
|
78
|
+
src: source,
|
|
79
|
+
// An iframe with no accessible name is announced as "frame" and
|
|
80
|
+
// nothing else. WCAG 4.1.2, and the single most common embed defect.
|
|
81
|
+
title: ctx.t('embed.title', { provider: block.provider }),
|
|
82
|
+
loading: 'lazy',
|
|
83
|
+
referrerpolicy: 'strict-origin-when-cross-origin',
|
|
84
|
+
allow: 'accelerometer; clipboard-write; encrypted-media; picture-in-picture; fullscreen',
|
|
85
|
+
allowfullscreen: true,
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=embed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed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 +1,5 @@
|
|
|
1
|
+
import type { FaqBlock } from '@cogenta/blocks';
|
|
2
|
+
import type { RenderContext } from '../../theme-contract.js';
|
|
3
|
+
import { type HtmlElement } from '../html.js';
|
|
4
|
+
export declare function renderFaq(block: FaqBlock, ctx: RenderContext): HtmlElement;
|
|
5
|
+
//# sourceMappingURL=faq.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"faq.d.ts","sourceRoot":"","sources":["../../../../src/render/blocks/faq.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAW,MAAM,iBAAiB,CAAA;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAE5D,OAAO,EAAE,KAAK,WAAW,EAAK,MAAM,YAAY,CAAA;AAyBhD,wBAAgB,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,aAAa,GAAG,WAAW,CAa1E"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { blockHeadingTag, heading } from '../heading.js';
|
|
2
|
+
import { h } from '../html.js';
|
|
3
|
+
import { renderRichText } from '../rich-text.js';
|
|
4
|
+
/**
|
|
5
|
+
* `<details>`/`<summary>` rather than a scripted accordion: expanding, keyboard
|
|
6
|
+
* operation, the expanded state announced to assistive technology and in-page
|
|
7
|
+
* search all come from the browser, at zero bytes of JavaScript.
|
|
8
|
+
*
|
|
9
|
+
* The question is plain text inside `<summary>`, not a heading: a heading
|
|
10
|
+
* nested in a summary is rendered inconsistently across screen readers, and the
|
|
11
|
+
* questions are already reachable as a list under the block's own heading.
|
|
12
|
+
*/
|
|
13
|
+
function renderItem(item, ctx) {
|
|
14
|
+
return h('li', { class: 'cg-faq__item' }, h('details', { class: 'cg-faq__details' }, h('summary', { class: 'cg-faq__question' }, item.question), h('div', { class: 'cg-faq__answer' }, renderRichText(ctx, item.answer))));
|
|
15
|
+
}
|
|
16
|
+
export function renderFaq(block, ctx) {
|
|
17
|
+
return h('section', { class: 'cg-block cg-faq', 'data-block': 'faq' }, block.title === undefined
|
|
18
|
+
? null
|
|
19
|
+
: heading(blockHeadingTag('faq') ?? 'h2', { class: 'cg-faq__title' }, block.title), h('ul', { class: 'cg-faq__items' }, block.items.map((item) => renderItem(item, ctx))));
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=faq.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"faq.js","sourceRoot":"","sources":["../../../../src/render/blocks/faq.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACxD,OAAO,EAAoB,CAAC,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD;;;;;;;;GAQG;AACH,SAAS,UAAU,CAAC,IAAa,EAAE,GAAkB;IACnD,OAAO,CAAC,CACN,IAAI,EACJ,EAAE,KAAK,EAAE,cAAc,EAAE,EACzB,CAAC,CACC,SAAS,EACT,EAAE,KAAK,EAAE,iBAAiB,EAAE,EAC5B,CAAC,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,kBAAkB,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,EAC1D,CAAC,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,cAAc,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CACxE,CACF,CAAA;AACH,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAAe,EAAE,GAAkB;IAC3D,OAAO,CAAC,CACN,SAAS,EACT,EAAE,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,KAAK,EAAE,EACjD,KAAK,CAAC,KAAK,KAAK,SAAS;QACvB,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE,KAAK,EAAE,eAAe,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,EACpF,CAAC,CACC,IAAI,EACJ,EAAE,KAAK,EAAE,eAAe,EAAE,EAC1B,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CACjD,CACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { FeatureGridBlock } from '@cogenta/blocks';
|
|
2
|
+
import type { RenderContext } from '../../theme-contract.js';
|
|
3
|
+
import { type HtmlElement } from '../html.js';
|
|
4
|
+
export declare function renderFeatureGrid(block: FeatureGridBlock, ctx: RenderContext): HtmlElement;
|
|
5
|
+
//# sourceMappingURL=feature-grid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-grid.d.ts","sourceRoot":"","sources":["../../../../src/render/blocks/feature-grid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAe,MAAM,iBAAiB,CAAA;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAG5D,OAAO,EAAE,KAAK,WAAW,EAAK,MAAM,YAAY,CAAA;AA8BhD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,aAAa,GAAG,WAAW,CAmB1F"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { href } from '../actions.js';
|
|
2
|
+
import { blockHeadingTag, heading, nestedHeadingTag } from '../heading.js';
|
|
3
|
+
import { h } from '../html.js';
|
|
4
|
+
/**
|
|
5
|
+
* The item's title is the link, so the link's accessible name is the feature's
|
|
6
|
+
* name. A bare "learn more" repeated six times is the classic failure of
|
|
7
|
+
* WCAG 2.4.4, and the block carries no label field to write one anyway.
|
|
8
|
+
*
|
|
9
|
+
* `icon` names a symbol, never markup: it is exposed as a data attribute for
|
|
10
|
+
* the skin and marked `aria-hidden`, since the title already names the feature.
|
|
11
|
+
*/
|
|
12
|
+
function renderItem(item, ctx, tag) {
|
|
13
|
+
const title = item.link === undefined
|
|
14
|
+
? heading(tag, { class: 'cg-feature__title' }, item.title)
|
|
15
|
+
: heading(tag, { class: 'cg-feature__title' }, h('a', { class: 'cg-feature__link', href: href(ctx, item.link) }, item.title));
|
|
16
|
+
return h('li', { class: 'cg-feature' }, item.icon === undefined
|
|
17
|
+
? null
|
|
18
|
+
: h('span', { class: 'cg-feature__icon', 'data-icon': item.icon, 'aria-hidden': 'true' }), title, item.text === undefined ? null : h('p', { class: 'cg-feature__text' }, item.text));
|
|
19
|
+
}
|
|
20
|
+
export function renderFeatureGrid(block, ctx) {
|
|
21
|
+
const hasTitle = block.title !== undefined;
|
|
22
|
+
const itemTag = nestedHeadingTag('featureGrid', hasTitle);
|
|
23
|
+
return h('section', { class: 'cg-block cg-features', 'data-block': 'featureGrid' }, hasTitle
|
|
24
|
+
? heading(blockHeadingTag('featureGrid') ?? 'h2', { class: 'cg-features__title' }, block.title ?? '')
|
|
25
|
+
: null, h('ul', { class: 'cg-features__items' }, block.items.map((item) => renderItem(item, ctx, itemTag))));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=feature-grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-grid.js","sourceRoot":"","sources":["../../../../src/render/blocks/feature-grid.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,EAAE,eAAe,EAAmB,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAC3F,OAAO,EAAoB,CAAC,EAAE,MAAM,YAAY,CAAA;AAEhD;;;;;;;GAOG;AACH,SAAS,UAAU,CAAC,IAAiB,EAAE,GAAkB,EAAE,GAAe;IACxE,MAAM,KAAK,GACT,IAAI,CAAC,IAAI,KAAK,SAAS;QACrB,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,E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R,CAAC,CACC,IAAI,EACJ,EAAE,KAAK,EAAE,oBAAoB,EAAE,EAC/B,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC,CAC1D,CACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { GalleryBlock } from '@cogenta/blocks';
|
|
2
|
+
import type { RenderContext } from '../../theme-contract.js';
|
|
3
|
+
import { type HtmlElement } from '../html.js';
|
|
4
|
+
/**
|
|
5
|
+
* The carousel ships **no JavaScript**. It is a scroll-snapping list, which
|
|
6
|
+
* gives touch swiping, trackpad scrolling and — because the list is focusable
|
|
7
|
+
* and labelled — arrow-key scrolling, with none of the failure modes of a
|
|
8
|
+
* scripted carousel: no auto-advance to fight (WCAG 2.2.2), no focus stolen
|
|
9
|
+
* from an off-screen slide, and it still works before hydration.
|
|
10
|
+
*
|
|
11
|
+
* A focusable scrollable region needs an accessible name, or a screen reader
|
|
12
|
+
* announces an unlabelled tab stop; that is WCAG 2.4.3 and 4.1.2 both.
|
|
13
|
+
*/
|
|
14
|
+
export declare function renderGallery(block: GalleryBlock, ctx: RenderContext): HtmlElement;
|
|
15
|
+
//# sourceMappingURL=gallery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gallery.d.ts","sourceRoot":"","sources":["../../../../src/render/blocks/gallery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,KAAK,WAAW,EAAK,MAAM,YAAY,CAAA;AAGhD;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,GAAG,WAAW,CAiClF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { h } from '../html.js';
|
|
2
|
+
import { image } from '../media.js';
|
|
3
|
+
/**
|
|
4
|
+
* The carousel ships **no JavaScript**. It is a scroll-snapping list, which
|
|
5
|
+
* gives touch swiping, trackpad scrolling and — because the list is focusable
|
|
6
|
+
* and labelled — arrow-key scrolling, with none of the failure modes of a
|
|
7
|
+
* scripted carousel: no auto-advance to fight (WCAG 2.2.2), no focus stolen
|
|
8
|
+
* from an off-screen slide, and it still works before hydration.
|
|
9
|
+
*
|
|
10
|
+
* A focusable scrollable region needs an accessible name, or a screen reader
|
|
11
|
+
* announces an unlabelled tab stop; that is WCAG 2.4.3 and 4.1.2 both.
|
|
12
|
+
*/
|
|
13
|
+
export function renderGallery(block, ctx) {
|
|
14
|
+
const items = h('ul', { class: 'cg-gallery__items' }, block.items.map((item) => h('li', { class: 'cg-gallery__item' }, image(ctx, item.media, { sizes: '(min-width: 45rem) 20rem, 60vw' }))));
|
|
15
|
+
return h('section', {
|
|
16
|
+
class: 'cg-block cg-gallery',
|
|
17
|
+
'data-block': 'gallery',
|
|
18
|
+
'data-layout': block.layout,
|
|
19
|
+
}, block.layout === 'carousel'
|
|
20
|
+
? h('div', {
|
|
21
|
+
class: 'cg-gallery__viewport',
|
|
22
|
+
role: 'region',
|
|
23
|
+
'aria-label': ctx.t('gallery.carousel'),
|
|
24
|
+
tabindex: '0',
|
|
25
|
+
}, items)
|
|
26
|
+
: items);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=gallery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gallery.js","sourceRoot":"","sources":["../../../../src/render/blocks/gallery.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,CAAC,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnC;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAC,KAAmB,EAAE,GAAkB;IACnE,MAAM,KAAK,GAAG,CAAC,CACb,IAAI,EACJ,EAAE,KAAK,EAAE,mBAAmB,EAAE,EAC9B,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACvB,CAAC,CACC,IAAI,EACJ,EAAE,KAAK,EAAE,kBAAkB,EAAE,EAC7B,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,gCAAgC,EAAE,CAAC,CACpE,CACF,CACF,CAAA;IAED,OAAO,CAAC,CACN,SAAS,EACT;QACE,KAAK,EAAE,qBAAqB;QAC5B,YAAY,EAAE,SAAS;QACvB,aAAa,EAAE,KAAK,CAAC,MAAM;KAC5B,EACD,KAAK,CAAC,MAAM,KAAK,UAAU;QACzB,CAAC,CAAC,CAAC,CACC,KAAK,EACL;YACE,KAAK,EAAE,sBAAsB;YAC7B,IAAI,EAAE,QAAQ;YACd,YAAY,EAAE,GAAG,CAAC,CAAC,CAAC,kBAAkB,CAAC;YACvC,QAAQ,EAAE,GAAG;SACd,EACD,KAAK,CACN;QACH,CAAC,CAAC,KAAK,CACV,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HeroBlock } from '@cogenta/blocks';
|
|
2
|
+
import type { RenderContext } from '../../theme-contract.js';
|
|
3
|
+
import { type HtmlElement } from '../html.js';
|
|
4
|
+
/**
|
|
5
|
+
* The hero carries the page's `h1` — contract B declares `headingLevel: 'h1'`
|
|
6
|
+
* for it, and `renderPage` relies on that to avoid emitting a second one.
|
|
7
|
+
*
|
|
8
|
+
* The eyebrow is a paragraph, not a small heading: it labels the page, and
|
|
9
|
+
* turning it into a heading would put an `h*` above the `h1` in the outline.
|
|
10
|
+
*/
|
|
11
|
+
export declare function renderHero(block: HeroBlock, ctx: RenderContext): HtmlElement;
|
|
12
|
+
//# sourceMappingURL=hero.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hero.d.ts","sourceRoot":"","sources":["../../../../src/render/blocks/hero.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAG5D,OAAO,EAAE,KAAK,WAAW,EAAK,MAAM,YAAY,CAAA;AAGhD;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,aAAa,GAAG,WAAW,CA2B5E"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { actionList } from '../actions.js';
|
|
2
|
+
import { blockHeadingTag, heading } from '../heading.js';
|
|
3
|
+
import { h } from '../html.js';
|
|
4
|
+
import { image } from '../media.js';
|
|
5
|
+
/**
|
|
6
|
+
* The hero carries the page's `h1` — contract B declares `headingLevel: 'h1'`
|
|
7
|
+
* for it, and `renderPage` relies on that to avoid emitting a second one.
|
|
8
|
+
*
|
|
9
|
+
* The eyebrow is a paragraph, not a small heading: it labels the page, and
|
|
10
|
+
* turning it into a heading would put an `h*` above the `h1` in the outline.
|
|
11
|
+
*/
|
|
12
|
+
export function renderHero(block, ctx) {
|
|
13
|
+
const tag = blockHeadingTag('hero') ?? 'h1';
|
|
14
|
+
return h('section', { class: 'cg-block cg-hero', 'data-block': 'hero' }, h('div', { class: 'cg-hero__body' }, block.eyebrow === undefined ? null : h('p', { class: 'cg-hero__eyebrow' }, block.eyebrow), heading(tag, { class: 'cg-hero__title' }, block.title), block.subtitle === undefined ? null : h('p', { class: 'cg-hero__subtitle' }, block.subtitle), actionList(ctx, block.actions, ctx.t('hero.actions'))), block.media === undefined
|
|
15
|
+
? null
|
|
16
|
+
: h('div', { class: 'cg-hero__media' },
|
|
17
|
+
// The only image on the page that is above the fold by construction,
|
|
18
|
+
// so the only one that must not be lazy: lazy-loading the LCP element
|
|
19
|
+
// is a measured Lighthouse regression, not a theoretical one.
|
|
20
|
+
image(ctx, block.media, {
|
|
21
|
+
loading: 'eager',
|
|
22
|
+
sizes: '(min-width: 60rem) 50vw, 100vw',
|
|
23
|
+
})));
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=hero.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hero.js","sourceRoot":"","sources":["../../../../src/render/blocks/hero.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACxD,OAAO,EAAoB,CAAC,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnC;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,KAAgB,EAAE,GAAkB;IAC7D,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,IAAI,IAAI,CAAA;IAC3C,OAAO,CAAC,CACN,SAAS,EACT,EAAE,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,EAAE,EACnD,CAAC,CACC,KAAK,EACL,EAAE,KAAK,EAAE,eAAe,EAAE,EAC1B,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,kBAAkB,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,EACzF,OAAO,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,EACtD,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,mBAAmB,EAAE,EAAE,KAAK,CAAC,QAAQ,CAAC,EAC5F,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CACtD,EACD,KAAK,CAAC,KAAK,KAAK,SAAS;QACvB,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,CAAC,CACC,KAAK,EACL,EAAE,KAAK,EAAE,gBAAgB,EAAE;QAC3B,qEAAqE;QACrE,sEAAsE;QACtE,8DAA8D;QAC9D,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,EAAE;YACtB,OAAO,EAAE,OAAO;YAChB,KAAK,EAAE,gCAAgC;SACxC,CAAC,CACH,CACN,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { LogosBlock } from '@cogenta/blocks';
|
|
2
|
+
import type { RenderContext } from '../../theme-contract.js';
|
|
3
|
+
import { type HtmlElement } from '../html.js';
|
|
4
|
+
export declare function renderLogos(block: LogosBlock, ctx: RenderContext): HtmlElement;
|
|
5
|
+
//# sourceMappingURL=logos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logos.d.ts","sourceRoot":"","sources":["../../../../src/render/blocks/logos.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAE5D,OAAO,EAAE,KAAK,WAAW,EAAK,MAAM,YAAY,CAAA;AA4BhD,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,aAAa,GAAG,WAAW,CAa9E"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { blockHeadingTag, heading } from '../heading.js';
|
|
2
|
+
import { h } from '../html.js';
|
|
3
|
+
import { image } from '../media.js';
|
|
4
|
+
/**
|
|
5
|
+
* Contract B says the organisation's name **is** the accessible name of the
|
|
6
|
+
* link. So the logo image carries it as alt text when the media entity has
|
|
7
|
+
* none, and no visually hidden duplicate is added: a link whose only content is
|
|
8
|
+
* an image with alt text is already named.
|
|
9
|
+
*/
|
|
10
|
+
function renderItem(item, ctx) {
|
|
11
|
+
const logo = image(ctx, item.media, {
|
|
12
|
+
className: 'cg-logo__image',
|
|
13
|
+
altFrom: item.name,
|
|
14
|
+
variant: { fit: 'contain' },
|
|
15
|
+
});
|
|
16
|
+
return h('li', { class: 'cg-logo' }, item.url === undefined
|
|
17
|
+
? logo
|
|
18
|
+
: h('a', { class: 'cg-logo__link', href: ctx.link(item.url), rel: 'noopener noreferrer' }, logo));
|
|
19
|
+
}
|
|
20
|
+
export function renderLogos(block, ctx) {
|
|
21
|
+
return h('section', { class: 'cg-block cg-logos', 'data-block': 'logos' }, block.title === undefined
|
|
22
|
+
? null
|
|
23
|
+
: heading(blockHeadingTag('logos') ?? 'h2', { class: 'cg-logos__title' }, block.title), h('ul', { class: 'cg-logos__items' }, block.items.map((item) => renderItem(item, ctx))));
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=logos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logos.js","sourceRoot":"","sources":["../../../../src/render/blocks/logos.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACxD,OAAO,EAAoB,CAAC,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnC;;;;;GAKG;AACH,SAAS,UAAU,CAAC,IAAc,EAAE,GAAkB;IACpD,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,EAAE;QAClC,SAAS,EAAE,gBAAgB;QAC3B,OAAO,EAAE,IAAI,CAAC,IAAI;QAClB,OAAO,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE;KAC5B,CAAC,CAAA;IACF,OAAO,CAAC,CACN,IAAI,EACJ,EAAE,KAAK,EAAE,SAAS,EAAE,EACpB,IAAI,CAAC,GAAG,KAAK,SAAS;QACpB,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,CAAC,CACC,GAAG,EACH,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,qBAAqB,EAAE,EAChF,IAAI,CACL,CACN,CAAA;AACH,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAiB,EAAE,GAAkB;IAC/D,OAAO,CAAC,CACN,SAAS,EACT,EAAE,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,OAAO,EAAE,EACrD,KAAK,CAAC,KAAK,KAAK,SAAS;QACvB,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,EACxF,CAAC,CACC,IAAI,EACJ,EAAE,KAAK,EAAE,iBAAiB,EAAE,EAC5B,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CACjD,CACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { MediaFigureBlock } from '@cogenta/blocks';
|
|
2
|
+
import type { RenderContext } from '../../theme-contract.js';
|
|
3
|
+
import { type HtmlElement } from '../html.js';
|
|
4
|
+
/**
|
|
5
|
+
* `<figure>`/`<figcaption>` rather than a div and a paragraph: the association
|
|
6
|
+
* between the picture and its caption is then in the markup, and a screen
|
|
7
|
+
* reader announces the caption as belonging to the image instead of as loose
|
|
8
|
+
* text after it.
|
|
9
|
+
*
|
|
10
|
+
* `align` is written as a data attribute, never as a class: contract B's values
|
|
11
|
+
* are `start`/`end`, an intent that mirrors in right-to-left locales, and the
|
|
12
|
+
* skin decides what it means.
|
|
13
|
+
*/
|
|
14
|
+
export declare function renderMediaFigure(block: MediaFigureBlock, ctx: RenderContext): HtmlElement;
|
|
15
|
+
//# sourceMappingURL=media-figure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-figure.d.ts","sourceRoot":"","sources":["../../../../src/render/blocks/media-figure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,KAAK,WAAW,EAAK,MAAM,YAAY,CAAA;AAGhD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,aAAa,GAAG,WAAW,CA0B1F"}
|