@cogenta/theme-restaurant 0.3.3 → 0.5.4
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 +3 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/render/blocks/accordion.d.ts +7 -0
- package/dist/src/render/blocks/accordion.d.ts.map +1 -1
- package/dist/src/render/blocks/accordion.js +10 -16
- package/dist/src/render/blocks/accordion.js.map +1 -1
- package/dist/src/render/blocks/collection-list.d.ts +4 -11
- package/dist/src/render/blocks/collection-list.d.ts.map +1 -1
- package/dist/src/render/blocks/collection-list.js +96 -96
- package/dist/src/render/blocks/collection-list.js.map +1 -1
- package/dist/src/render/blocks/cta.d.ts +7 -4
- package/dist/src/render/blocks/cta.d.ts.map +1 -1
- package/dist/src/render/blocks/cta.js +9 -7
- package/dist/src/render/blocks/cta.js.map +1 -1
- package/dist/src/render/blocks/embed.d.ts.map +1 -1
- package/dist/src/render/blocks/embed.js +30 -28
- package/dist/src/render/blocks/embed.js.map +1 -1
- package/dist/src/render/blocks/faq.d.ts +13 -1
- package/dist/src/render/blocks/faq.d.ts.map +1 -1
- package/dist/src/render/blocks/faq.js +15 -11
- package/dist/src/render/blocks/faq.js.map +1 -1
- package/dist/src/render/blocks/feature-grid.d.ts.map +1 -1
- package/dist/src/render/blocks/feature-grid.js +43 -16
- package/dist/src/render/blocks/feature-grid.js.map +1 -1
- package/dist/src/render/blocks/gallery.d.ts +0 -7
- package/dist/src/render/blocks/gallery.d.ts.map +1 -1
- package/dist/src/render/blocks/gallery.js +28 -10
- package/dist/src/render/blocks/gallery.js.map +1 -1
- package/dist/src/render/blocks/hero.d.ts +16 -9
- package/dist/src/render/blocks/hero.d.ts.map +1 -1
- package/dist/src/render/blocks/hero.js +27 -20
- package/dist/src/render/blocks/hero.js.map +1 -1
- package/dist/src/render/blocks/logo-strip.d.ts +6 -0
- package/dist/src/render/blocks/logo-strip.d.ts.map +1 -1
- package/dist/src/render/blocks/logo-strip.js +7 -9
- package/dist/src/render/blocks/logo-strip.js.map +1 -1
- package/dist/src/render/blocks/logos.d.ts +8 -0
- package/dist/src/render/blocks/logos.d.ts.map +1 -1
- package/dist/src/render/blocks/logos.js +18 -18
- package/dist/src/render/blocks/logos.js.map +1 -1
- package/dist/src/render/blocks/media-figure.d.ts +14 -3
- package/dist/src/render/blocks/media-figure.d.ts.map +1 -1
- package/dist/src/render/blocks/media-figure.js +34 -16
- package/dist/src/render/blocks/media-figure.js.map +1 -1
- package/dist/src/render/blocks/pricing-table.d.ts.map +1 -1
- package/dist/src/render/blocks/pricing-table.js +17 -22
- package/dist/src/render/blocks/pricing-table.js.map +1 -1
- package/dist/src/render/blocks/prose.d.ts +11 -6
- package/dist/src/render/blocks/prose.d.ts.map +1 -1
- package/dist/src/render/blocks/prose.js +13 -7
- package/dist/src/render/blocks/prose.js.map +1 -1
- package/dist/src/render/blocks/quote.d.ts +6 -2
- package/dist/src/render/blocks/quote.d.ts.map +1 -1
- package/dist/src/render/blocks/quote.js +14 -12
- package/dist/src/render/blocks/quote.js.map +1 -1
- package/dist/src/render/blocks/stat-counter.d.ts +6 -0
- package/dist/src/render/blocks/stat-counter.d.ts.map +1 -1
- package/dist/src/render/blocks/stat-counter.js +7 -10
- package/dist/src/render/blocks/stat-counter.js.map +1 -1
- package/dist/src/render/blocks/stats.d.ts +7 -0
- package/dist/src/render/blocks/stats.d.ts.map +1 -1
- package/dist/src/render/blocks/stats.js +8 -16
- package/dist/src/render/blocks/stats.js.map +1 -1
- package/dist/src/render/blocks/testimonial.d.ts +5 -11
- package/dist/src/render/blocks/testimonial.d.ts.map +1 -1
- package/dist/src/render/blocks/testimonial.js +9 -17
- package/dist/src/render/blocks/testimonial.js.map +1 -1
- package/dist/src/render/chrome.d.ts.map +1 -1
- package/dist/src/render/chrome.js +101 -84
- package/dist/src/render/chrome.js.map +1 -1
- package/dist/src/render/dish.d.ts +13 -0
- package/dist/src/render/dish.d.ts.map +1 -0
- package/dist/src/render/dish.js +84 -0
- package/dist/src/render/dish.js.map +1 -0
- package/dist/src/render/layout.d.ts +23 -0
- package/dist/src/render/layout.d.ts.map +1 -0
- package/dist/src/render/layout.js +33 -0
- package/dist/src/render/layout.js.map +1 -0
- package/dist/src/render/menu.d.ts +53 -0
- package/dist/src/render/menu.d.ts.map +1 -0
- package/dist/src/render/menu.js +99 -0
- package/dist/src/render/menu.js.map +1 -0
- package/dist/src/render/render-block.d.ts +19 -0
- package/dist/src/render/render-block.d.ts.map +1 -1
- package/dist/src/render/render-block.js +50 -39
- package/dist/src/render/render-block.js.map +1 -1
- package/dist/src/render/strings.d.ts +15 -0
- package/dist/src/render/strings.d.ts.map +1 -0
- package/dist/src/render/strings.js +23 -0
- package/dist/src/render/strings.js.map +1 -0
- package/dist/src/render/term-archive.d.ts +10 -4
- package/dist/src/render/term-archive.d.ts.map +1 -1
- package/dist/src/render/term-archive.js +25 -16
- package/dist/src/render/term-archive.js.map +1 -1
- package/dist/src/render/widget-areas.d.ts +13 -0
- package/dist/src/render/widget-areas.d.ts.map +1 -0
- package/dist/src/render/widget-areas.js +20 -0
- package/dist/src/render/widget-areas.js.map +1 -0
- package/dist/theme.config.d.ts +1 -1
- package/dist/theme.config.js +2 -2
- package/dist/theme.config.js.map +1 -1
- package/package.json +5 -5
- package/src/index.ts +3 -0
- package/src/render/blocks/accordion.ts +18 -47
- package/src/render/blocks/collection-list.ts +245 -133
- package/src/render/blocks/cta.ts +20 -11
- package/src/render/blocks/embed.ts +45 -36
- package/src/render/blocks/faq.ts +32 -25
- package/src/render/blocks/feature-grid.ts +83 -33
- package/src/render/blocks/gallery.ts +39 -21
- package/src/render/blocks/hero.ts +41 -34
- package/src/render/blocks/logo-strip.ts +27 -25
- package/src/render/blocks/logos.ts +34 -43
- package/src/render/blocks/media-figure.ts +49 -24
- package/src/render/blocks/pricing-table.ts +30 -42
- package/src/render/blocks/prose.ts +18 -9
- package/src/render/blocks/quote.ts +29 -19
- package/src/render/blocks/stat-counter.ts +24 -29
- package/src/render/blocks/stats.ts +30 -40
- package/src/render/blocks/testimonial.ts +17 -22
- package/src/render/chrome.ts +113 -95
- package/src/render/dish.ts +195 -0
- package/src/render/layout.ts +64 -0
- package/src/render/menu.ts +117 -0
- package/src/render/render-block.ts +51 -40
- package/src/render/strings.ts +44 -0
- package/src/render/term-archive.ts +78 -44
- package/src/render/widget-areas.ts +23 -0
- package/src/styles/archive.css +46 -56
- package/src/styles/base.css +803 -550
- package/src/styles/blocks.css +723 -641
- package/src/styles/menu.css +482 -0
- package/src/styles/theme.css +24 -25
- package/src/styles/tokens.css +239 -225
- package/src/styles/widgets.css +853 -0
- package/tokens.json +16 -16
package/dist/src/index.d.ts
CHANGED
|
@@ -17,6 +17,9 @@ export * from './render/blocks/stat-counter.js';
|
|
|
17
17
|
export * from './render/blocks/stats.js';
|
|
18
18
|
export * from './render/blocks/testimonial.js';
|
|
19
19
|
export * from './render/chrome.js';
|
|
20
|
+
export * from './render/dish.js';
|
|
21
|
+
export * from './render/menu.js';
|
|
20
22
|
export * from './render/render-block.js';
|
|
21
23
|
export * from './render/term-archive.js';
|
|
24
|
+
export * from './render/widget-areas.js';
|
|
22
25
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,oBAAoB,CAAA;AAClC,cAAc,8BAA8B,CAAA;AAC5C,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,+BAA+B,CAAA;AAC7C,cAAc,0BAA0B,CAAA;AACxC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,kCAAkC,CAAA;AAChD,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,0BAA0B,CAAA;AACxC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,cAAc,oBAAoB,CAAA;AAClC,cAAc,8BAA8B,CAAA;AAC5C,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,+BAA+B,CAAA;AAC7C,cAAc,0BAA0B,CAAA;AACxC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,kCAAkC,CAAA;AAChD,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,0BAA0B,CAAA;AACxC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA"}
|
package/dist/src/index.js
CHANGED
|
@@ -20,6 +20,9 @@ export * from './render/blocks/stat-counter.js';
|
|
|
20
20
|
export * from './render/blocks/stats.js';
|
|
21
21
|
export * from './render/blocks/testimonial.js';
|
|
22
22
|
export * from './render/chrome.js';
|
|
23
|
+
export * from './render/dish.js';
|
|
24
|
+
export * from './render/menu.js';
|
|
23
25
|
export * from './render/render-block.js';
|
|
24
26
|
export * from './render/term-archive.js';
|
|
27
|
+
export * from './render/widget-areas.js';
|
|
25
28
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,2EAA2E;AAC3E,sEAAsE;AACtE,cAAc,oBAAoB,CAAA;AAClC,cAAc,8BAA8B,CAAA;AAC5C,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,+BAA+B,CAAA;AAC7C,cAAc,0BAA0B,CAAA;AACxC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,kCAAkC,CAAA;AAChD,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,0BAA0B,CAAA;AACxC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,2EAA2E;AAC3E,sEAAsE;AACtE,cAAc,oBAAoB,CAAA;AAClC,cAAc,8BAA8B,CAAA;AAC5C,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,+BAA+B,CAAA;AAC7C,cAAc,0BAA0B,CAAA;AACxC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,kCAAkC,CAAA;AAChD,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,0BAA0B,CAAA;AACxC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,kBAAkB,CAAA;AAChC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import type { AccordionBlock } from '@cogenta/blocks';
|
|
2
2
|
import { type HtmlElement, type RenderContext } from '@cogenta/theme-kit';
|
|
3
|
+
/**
|
|
4
|
+
* Collapsible notes: allergens, what a deposit covers, how a group menu is
|
|
5
|
+
* chosen. The same `<details>` rows as `faq`, drawn in the same register, but
|
|
6
|
+
* set in one narrower column under their title (the third to the tenth),
|
|
7
|
+
* because an accordion usually sits inside running text rather than as a
|
|
8
|
+
* section of its own.
|
|
9
|
+
*/
|
|
3
10
|
export declare function renderAccordion(block: AccordionBlock, ctx: RenderContext): HtmlElement;
|
|
4
11
|
//# sourceMappingURL=accordion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../../../src/render/blocks/accordion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../../../src/render/blocks/accordion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,KAAK,WAAW,EAAK,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAI5E;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,aAAa,GAAG,WAAW,CAetF"}
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h } from '@cogenta/theme-kit';
|
|
2
|
+
import { section, sectionHead } from '../layout.js';
|
|
3
|
+
import { answerItem } from './faq.js';
|
|
2
4
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* rather than a wall of text under the menu.
|
|
9
|
-
*
|
|
10
|
-
* A thin plus/minus mark, drawn from two CSS borders rather than an icon
|
|
11
|
-
* font, rotates to a single line when the panel is open.
|
|
5
|
+
* Collapsible notes: allergens, what a deposit covers, how a group menu is
|
|
6
|
+
* chosen. The same `<details>` rows as `faq`, drawn in the same register, but
|
|
7
|
+
* set in one narrower column under their title (the third to the tenth),
|
|
8
|
+
* because an accordion usually sits inside running text rather than as a
|
|
9
|
+
* section of its own.
|
|
12
10
|
*/
|
|
13
|
-
function renderItem(item, ctx) {
|
|
14
|
-
return h('li', { class: 'cg-hours__item' }, h('details', { class: 'cg-hours__details' }, h('summary', { class: 'cg-hours__question' }, h('span', { class: 'cg-hours__question-text' }, item.question), h('span', { class: 'cg-hours__mark', 'aria-hidden': 'true' })), h('div', { class: 'cg-hours__answer' }, renderRichText(ctx, item.answer))));
|
|
15
|
-
}
|
|
16
11
|
export function renderAccordion(block, ctx) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
: heading(blockHeadingTag('accordion') ?? 'h2', { class: 'cg-hours__title', 'data-field': 'title' }, block.title), h('ul', { class: 'cg-hours__items' }, block.items.map((item) => renderItem(item, ctx))));
|
|
12
|
+
const titled = block.title !== undefined;
|
|
13
|
+
return section('section', 'accordion', 'cr-answers', { 'data-titled': String(titled), 'data-variant': 'notes' }, 'div', sectionHead('accordion', block.title), h('ul', { class: 'cr-answers__items' }, block.items.map((item) => answerItem(item, ctx, 'accordion', titled))));
|
|
20
14
|
}
|
|
21
15
|
//# sourceMappingURL=accordion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.js","sourceRoot":"","sources":["../../../../src/render/blocks/accordion.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"accordion.js","sourceRoot":"","sources":["../../../../src/render/blocks/accordion.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,CAAC,EAAsB,MAAM,oBAAoB,CAAA;AAC5E,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErC;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,KAAqB,EAAE,GAAkB;IACvE,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,KAAK,SAAS,CAAA;IACxC,OAAO,OAAO,CACZ,SAAS,EACT,WAAW,EACX,YAAY,EACZ,EAAE,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,cAAc,EAAE,OAAO,EAAE,EAC1D,KAAK,EACL,WAAW,CAAC,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC,EACrC,CAAC,CACC,IAAI,EACJ,EAAE,KAAK,EAAE,mBAAmB,EAAE,EAC9B,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC,CACtE,CACF,CAAA;AACH,CAAC"}
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import type { CollectionListBlock } from '@cogenta/blocks';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* here: `query` builds the request from the block's own fields
|
|
7
|
-
* (`@cogenta/theme-kit`'s `buildCollectionListQuery`, shared across every
|
|
8
|
-
* theme), the caller awaits `ctx.content.list(...)` before rendering starts,
|
|
9
|
-
* and this function stays a pure function of the entries handed to it.
|
|
10
|
-
*/
|
|
11
|
-
export { buildCollectionListQuery as query };
|
|
12
|
-
export declare function renderCollectionList(block: CollectionListBlock, ctx: RenderContext, entries: readonly ContentEntry[]): HtmlElement;
|
|
2
|
+
import { type ContentEntry, type HtmlElement, type QueryRequest, type RenderContext } from '@cogenta/theme-kit';
|
|
3
|
+
export declare function renderCollectionList(block: CollectionListBlock, ctx: RenderContext, fetched: readonly ContentEntry[]): HtmlElement;
|
|
4
|
+
/** The query this block needs, fetched by the host before any markup is built. */
|
|
5
|
+
export declare function query(block: CollectionListBlock): QueryRequest;
|
|
13
6
|
//# sourceMappingURL=collection-list.d.ts.map
|
|
@@ -1 +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,EAEL,
|
|
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,EAEL,KAAK,YAAY,EAMjB,KAAK,WAAW,EAIhB,KAAK,YAAY,EACjB,KAAK,aAAa,EAEnB,MAAM,oBAAoB,CAAA;AAwP3B,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,mBAAmB,EAC1B,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,SAAS,YAAY,EAAE,GAC/B,WAAW,CA2Bb;AAED,kFAAkF;AAClF,wBAAgB,KAAK,CAAC,KAAK,EAAE,mBAAmB,GAAG,YAAY,CAE9D"}
|
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* and this function stays a pure function of the entries handed to it.
|
|
9
|
-
*/
|
|
10
|
-
export { buildCollectionListQuery as query };
|
|
11
|
-
/**
|
|
12
|
-
* The signature piece of this theme: a `collectionList` on a `menu_item`-shaped
|
|
13
|
-
* collection is rendered as a real, priced menu, not a card grid.
|
|
14
|
-
*
|
|
15
|
-
* Contract B fixes no "menu" block (a menu of dishes is a `collectionList`
|
|
16
|
-
* grouped and formatted by the theme, per `docs/lots/L25-templates-pro.md`
|
|
17
|
-
* "pièges connus" — a new block would need an RFC). Grouping reads the
|
|
18
|
-
* entry's raw `category` field directly: a theme sees a whole entry, not
|
|
19
|
-
* only the fields contract A's system columns declare, and `category` is
|
|
20
|
-
* exactly the field the `restaurant` blueprint's `menu_item` collection
|
|
21
|
-
* names for this. An entry with no `category` (or a collection that never
|
|
22
|
-
* declares one) still renders, in one unlabelled group — grouping is a
|
|
23
|
-
* presentation choice, never a requirement placed back on the schema.
|
|
24
|
-
*
|
|
25
|
-
* `price` is read as a plain number (contract A's `f.number`, not a
|
|
26
|
-
* currency type — commerce's real money lives in contract E, untouched
|
|
27
|
-
* here) and formatted with `Intl.NumberFormat`'s `currency: 'EUR'`: the
|
|
28
|
-
* currency itself is not part of what a theme's `RenderContext` carries, so
|
|
29
|
-
* EUR is this theme's own documented demo default, exactly the way the
|
|
30
|
-
* `store` blueprint's own catalogue prices need no currency conversion
|
|
31
|
-
* either. A site that prices in another currency still gets a sensibly
|
|
32
|
-
* localised number; only the currency symbol would need a real per-site
|
|
33
|
-
* setting this contract does not yet offer.
|
|
34
|
-
*/
|
|
35
|
-
function priceLabel(entry, ctx) {
|
|
36
|
-
const raw = entry.price;
|
|
37
|
-
if (typeof raw !== 'number' || !Number.isFinite(raw))
|
|
38
|
-
return null;
|
|
39
|
-
try {
|
|
40
|
-
return new Intl.NumberFormat(ctx.locale, { style: 'currency', currency: 'EUR' }).format(raw);
|
|
41
|
-
}
|
|
42
|
-
catch {
|
|
43
|
-
// An `Intl` failure (an exotic `ctx.locale`) is still a real number worth
|
|
44
|
-
// showing, just without locale-aware grouping/decimal marks.
|
|
45
|
-
return raw.toFixed(2);
|
|
1
|
+
import { buildCollectionListQuery, entryExcerpt, entryHref, entryImage, entryTitle, h, heading, nestedHeadingTag, renderImageSource, } from '@cogenta/theme-kit';
|
|
2
|
+
import { section, sectionHead } from '../layout.js';
|
|
3
|
+
import { currencyOf, formatPrice, groupBySection, isVegetarian, priceOf, sectionOf, } from '../menu.js';
|
|
4
|
+
import { menuString } from '../strings.js';
|
|
5
|
+
function shapeOf(entries, ctx, layout) {
|
|
6
|
+
if (entries.every((entry) => priceOf(entry.price) !== undefined)) {
|
|
7
|
+
return layout === 'carousel' ? 'plates' : 'menu';
|
|
46
8
|
}
|
|
9
|
+
if (entries.every((entry) => entryImage(entry, ctx) !== undefined))
|
|
10
|
+
return 'photos';
|
|
11
|
+
return 'index';
|
|
47
12
|
}
|
|
48
|
-
function
|
|
49
|
-
const
|
|
50
|
-
return
|
|
13
|
+
function price(entry, ctx, className) {
|
|
14
|
+
const amount = priceOf(entry.price);
|
|
15
|
+
return h('data', { class: className, value: String(amount) }, formatPrice(amount, currencyOf(entry.currency), ctx.locale));
|
|
51
16
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
return
|
|
17
|
+
function dish(entry, ctx) {
|
|
18
|
+
const description = entryExcerpt(entry);
|
|
19
|
+
const vegetarian = isVegetarian(entry);
|
|
20
|
+
return h('li', { class: 'cr-menu__item', 'data-vegetarian': vegetarian ? 'true' : undefined }, h('p', { class: 'cr-menu__line' }, h('a', { class: 'cr-menu__name', href: entryHref(entry, ctx) }, entryTitle(entry, ctx)), h('span', { class: 'cr-menu__leader', 'aria-hidden': 'true' }), price(entry, ctx, 'cr-menu__price')), description === undefined && !vegetarian
|
|
21
|
+
? null
|
|
22
|
+
: h('p', { class: 'cr-menu__description' }, description === undefined ? null : h('span', { class: 'cr-menu__text' }, description), vegetarian
|
|
23
|
+
? h('span', { class: 'cr-menu__diet' }, menuString(ctx.locale, 'vegetarian'))
|
|
24
|
+
: null));
|
|
56
25
|
}
|
|
57
|
-
function
|
|
58
|
-
|
|
59
|
-
const price = priceLabel(entry, ctx);
|
|
60
|
-
const photo = entryImage(entry, ctx, { width: 120, height: 120, fit: 'cover' });
|
|
61
|
-
return h('li', { class: 'cg-menu__dish' }, photo === undefined
|
|
26
|
+
function menuSection(group, ctx, tag, named) {
|
|
27
|
+
return h('div', { class: 'cr-menu__section' }, group.title === undefined || !named
|
|
62
28
|
? null
|
|
63
|
-
:
|
|
64
|
-
// Leader and price are one wrapping unit (`cg-menu__dish-tail`): on
|
|
65
|
-
// a narrow screen where the name alone fills the row, the dotted
|
|
66
|
-
// leader must move to the next line together with the price it
|
|
67
|
-
// points to — never left dangling at the end of the name's line
|
|
68
|
-
// with the price it introduces stranded on a line of its own.
|
|
69
|
-
h('span', { class: 'cg-menu__dish-tail' }, h('span', { class: 'cg-menu__dish-leader', 'aria-hidden': 'true' }), price === null ? null : h('span', { class: 'cg-menu__dish-price' }, price))), excerpt === undefined ? null : h('p', { class: 'cg-menu__dish-description' }, excerpt)));
|
|
29
|
+
: heading(tag, { class: 'cr-menu__section-title' }, group.title), h('ul', { class: 'cr-menu__items' }, group.items.map((entry) => dish(entry, ctx))));
|
|
70
30
|
}
|
|
71
|
-
function
|
|
72
|
-
const
|
|
73
|
-
|
|
31
|
+
function mediaLink(entry, ctx, className, sizes) {
|
|
32
|
+
const source = entryImage(entry, ctx);
|
|
33
|
+
if (source === undefined)
|
|
34
|
+
return null;
|
|
35
|
+
return h('a', {
|
|
36
|
+
class: `${className}__media`,
|
|
37
|
+
href: entryHref(entry, ctx),
|
|
38
|
+
tabindex: '-1',
|
|
39
|
+
'aria-hidden': 'true',
|
|
40
|
+
}, renderImageSource(source, { className: `${className}__image`, sizes }));
|
|
41
|
+
}
|
|
42
|
+
function plate(entry, ctx) {
|
|
43
|
+
const group = sectionOf(entry);
|
|
44
|
+
return h('li', { class: 'cr-plates__item', 'data-media': String(entryImage(entry, ctx) !== undefined) }, mediaLink(entry, ctx, 'cr-plates', '(min-width: 64rem) 22vw, 70vw'), h('p', { class: 'cr-plates__line' }, h('a', { class: 'cr-plates__name', href: entryHref(entry, ctx) }, entryTitle(entry, ctx)), price(entry, ctx, 'cr-plates__price')), group === undefined ? null : h('p', { class: 'cr-plates__section' }, group));
|
|
74
45
|
}
|
|
75
|
-
function
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
46
|
+
function photo(entry, ctx, tag) {
|
|
47
|
+
const excerpt = entryExcerpt(entry);
|
|
48
|
+
return h('li', { class: 'cr-photos__item' }, mediaLink(entry, ctx, 'cr-photos', '(min-width: 64rem) 28vw, 100vw'), heading(tag, { class: 'cr-photos__name' }, h('a', { class: 'cr-arrow-link', href: entryHref(entry, ctx) }, entryTitle(entry, ctx))), excerpt === undefined ? null : h('p', { class: 'cr-photos__text' }, excerpt));
|
|
49
|
+
}
|
|
50
|
+
function indexItem(entry, ctx, tag) {
|
|
51
|
+
const excerpt = entryExcerpt(entry);
|
|
52
|
+
return h('li', { class: 'cr-index__item' }, heading(tag, { class: 'cr-index__name' }, h('a', { class: 'cr-index__link', href: entryHref(entry, ctx) }, entryTitle(entry, ctx))), excerpt === undefined ? null : h('p', { class: 'cr-index__text' }, excerpt));
|
|
53
|
+
}
|
|
54
|
+
/** The entries that are not the page being rendered. */
|
|
55
|
+
function othersThanThisPage(entries, ctx) {
|
|
56
|
+
return entries.filter((entry) => entryHref(entry, ctx) !== ctx.url.pathname);
|
|
57
|
+
}
|
|
58
|
+
function body(shape, shown, block, ctx, tag) {
|
|
59
|
+
switch (shape) {
|
|
60
|
+
case 'menu': {
|
|
61
|
+
const groups = groupBySection(shown);
|
|
62
|
+
// One section under a title of its own ("The other starters") is named
|
|
63
|
+
// by that title already; printing "Starters" under it again says nothing.
|
|
64
|
+
const named = groups.length > 1 || block.title === undefined;
|
|
65
|
+
return h('div', {
|
|
66
|
+
class: 'cr-list__items cr-menu',
|
|
67
|
+
'data-sections': String(groups.length),
|
|
68
|
+
}, groups.map((group) => menuSection(group, ctx, tag, named)));
|
|
84
69
|
}
|
|
85
|
-
|
|
86
|
-
|
|
70
|
+
case 'plates':
|
|
71
|
+
return h('div', {
|
|
72
|
+
class: 'cr-list__viewport',
|
|
73
|
+
role: 'region',
|
|
74
|
+
'aria-label': block.title ?? ctx.t('collection.carousel'),
|
|
75
|
+
tabindex: '0',
|
|
76
|
+
}, h('ul', { class: 'cr-list__items cr-plates' }, shown.map((entry) => plate(entry, ctx))));
|
|
77
|
+
case 'photos': {
|
|
78
|
+
const list = h('ul', {
|
|
79
|
+
class: 'cr-list__items cr-photos',
|
|
80
|
+
'data-count': String(Math.min(shown.length, 3)),
|
|
81
|
+
}, shown.map((entry) => photo(entry, ctx, tag)));
|
|
82
|
+
return block.layout === 'carousel'
|
|
83
|
+
? h('div', {
|
|
84
|
+
class: 'cr-list__viewport',
|
|
85
|
+
role: 'region',
|
|
86
|
+
'aria-label': block.title ?? ctx.t('collection.carousel'),
|
|
87
|
+
tabindex: '0',
|
|
88
|
+
}, list)
|
|
89
|
+
: list;
|
|
87
90
|
}
|
|
91
|
+
case 'index':
|
|
92
|
+
return h('ul', { class: 'cr-list__items cr-index' }, shown.map((entry) => indexItem(entry, ctx, tag)));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
export function renderCollectionList(block, ctx, fetched) {
|
|
96
|
+
const titled = block.title !== undefined;
|
|
97
|
+
const shown = othersThanThisPage(fetched, ctx);
|
|
98
|
+
const tag = nestedHeadingTag('collectionList', titled);
|
|
99
|
+
if (shown.length === 0) {
|
|
100
|
+
return section('section', 'collectionList', 'cr-list', { 'data-layout': block.layout, 'data-shape': 'empty' }, 'div', sectionHead('collectionList', block.title), h('p', { class: 'cr-empty' }, ctx.t('collection.empty')));
|
|
88
101
|
}
|
|
89
|
-
|
|
102
|
+
const shape = shapeOf(shown, ctx, block.layout);
|
|
103
|
+
return section('section', 'collectionList', 'cr-list', { 'data-layout': block.layout, 'data-shape': shape }, 'div', sectionHead('collectionList', block.title), body(shape, shown, block, ctx, tag));
|
|
90
104
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const groups = groupByCategory(entries);
|
|
95
|
-
const body = entries.length === 0
|
|
96
|
-
? h('p', { class: 'cg-menu__empty' }, ctx.t('collection.empty'))
|
|
97
|
-
: h('div', { class: 'cg-menu__groups' }, groups.map(([category, items]) => renderGroup(category, items, ctx, groupTag)));
|
|
98
|
-
return h('section', { class: 'cg-menu', 'data-block': 'collectionList', 'data-layout': block.layout }, hasTitle
|
|
99
|
-
? heading(blockHeadingTag('collectionList') ?? 'h2', { class: 'cg-menu__title', 'data-field': 'title' }, block.title ?? '')
|
|
100
|
-
: null, block.layout === 'carousel'
|
|
101
|
-
? h('div', {
|
|
102
|
-
class: 'cg-menu__viewport',
|
|
103
|
-
role: 'region',
|
|
104
|
-
'aria-label': block.title ?? ctx.t('collection.carousel'),
|
|
105
|
-
tabindex: '0',
|
|
106
|
-
}, body)
|
|
107
|
-
: body);
|
|
105
|
+
/** The query this block needs, fetched by the host before any markup is built. */
|
|
106
|
+
export function query(block) {
|
|
107
|
+
return buildCollectionListQuery(block);
|
|
108
108
|
}
|
|
109
109
|
//# sourceMappingURL=collection-list.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection-list.js","sourceRoot":"","sources":["../../../../src/render/blocks/collection-list.ts"],"names":[],"mappings":"AACA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"collection-list.js","sourceRoot":"","sources":["../../../../src/render/blocks/collection-list.ts"],"names":[],"mappings":"AACA,OAAO,EACL,wBAAwB,EAExB,YAAY,EACZ,SAAS,EACT,UAAU,EACV,UAAU,EAGV,CAAC,EACD,OAAO,EACP,gBAAgB,EAGhB,iBAAiB,GAClB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE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AC,CAAA;IAC9C,MAAM,GAAG,GAAG,gBAAgB,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAA;IAEtD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,OAAO,CACZ,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,EAAE,aAAa,EAAE,KAAK,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,EACtD,KAAK,EACL,WAAW,CAAC,gBAAgB,EAAE,KAAK,CAAC,KAAK,CAAC,EAC1C,CAAC,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CACzD,CAAA;IACH,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IAC/C,OAAO,OAAO,CACZ,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,EAAE,aAAa,EAAE,KAAK,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,EACpD,KAAK,EACL,WAAW,CAAC,gBAAgB,EAAE,KAAK,CAAC,KAAK,CAAC,EAC1C,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,CACpC,CAAA;AACH,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,KAAK,CAAC,KAA0B;IAC9C,OAAO,wBAAwB,CAAC,KAAK,CAAC,CAAA;AACxC,CAAC"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { CtaBlock } from '@cogenta/blocks';
|
|
2
2
|
import { type HtmlElement, type RenderContext } from '@cogenta/theme-kit';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* A call to action set as a line of the page, not a coloured box: a hairline
|
|
5
|
+
* in ink across the container, the title large and light on the first seven
|
|
6
|
+
* columns, the sentence and the actions on the last four. How to book a
|
|
7
|
+
* table, the private room, a gift for someone else.
|
|
8
|
+
*
|
|
9
|
+
* A site that wants a band asks for one with the `background` variant, which
|
|
10
|
+
* lays the same line on the paper's darker stock.
|
|
8
11
|
*/
|
|
9
12
|
export declare function renderCta(block: CtaBlock, ctx: RenderContext): HtmlElement;
|
|
10
13
|
//# sourceMappingURL=cta.d.ts.map
|
|
@@ -1 +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,EAGL,KAAK,WAAW,EAGhB,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAA;
|
|
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,EAGL,KAAK,WAAW,EAGhB,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAA;AAG3B;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,aAAa,GAAG,WAAW,CAmB1E"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { actionList, blockHeadingTag, h, heading, } from '@cogenta/theme-kit';
|
|
2
|
+
import { optionalText, section } from '../layout.js';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* A call to action set as a line of the page, not a coloured box: a hairline
|
|
5
|
+
* in ink across the container, the title large and light on the first seven
|
|
6
|
+
* columns, the sentence and the actions on the last four. How to book a
|
|
7
|
+
* table, the private room, a gift for someone else.
|
|
8
|
+
*
|
|
9
|
+
* A site that wants a band asks for one with the `background` variant, which
|
|
10
|
+
* lays the same line on the paper's darker stock.
|
|
7
11
|
*/
|
|
8
12
|
export function renderCta(block, ctx) {
|
|
9
|
-
return
|
|
10
|
-
? null
|
|
11
|
-
: h('p', { class: 'cg-close__text', 'data-field': 'text' }, block.text), actionList(ctx, block.actions, block.title));
|
|
13
|
+
return section('section', 'cta', 'cr-cta', {}, 'div', heading(blockHeadingTag('cta') ?? 'h2', { class: 'cr-cta__title', 'data-field': 'title' }, block.title), h('div', { class: 'cr-cta__body' }, optionalText('p', 'cr-cta__text', block.text, { 'data-field': 'text' }), actionList(ctx, block.actions, block.title)));
|
|
12
14
|
}
|
|
13
15
|
//# sourceMappingURL=cta.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cta.js","sourceRoot":"","sources":["../../../../src/render/blocks/cta.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,eAAe,EAEf,CAAC,EACD,OAAO,GAER,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"cta.js","sourceRoot":"","sources":["../../../../src/render/blocks/cta.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,eAAe,EAEf,CAAC,EACD,OAAO,GAER,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEpD;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CAAC,KAAe,EAAE,GAAkB;IAC3D,OAAO,OAAO,CACZ,SAAS,EACT,KAAK,EACL,QAAQ,EACR,EAAE,EACF,KAAK,EACL,OAAO,CACL,eAAe,CAAC,KAAK,CAAC,IAAI,IAAI,EAC9B,EAAE,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,OAAO,EAAE,EACjD,KAAK,CAAC,KAAK,CACZ,EACD,CAAC,CACC,KAAK,EACL,EAAE,KAAK,EAAE,cAAc,EAAE,EACzB,YAAY,CAAC,GAAG,EAAE,cAAc,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,EACvE,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,CAC5C,CACF,CAAA;AACH,CAAC"}
|
|
@@ -1 +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,EAAe,KAAK,WAAW,EAAK,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAwEzF,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,aAAa,GAAG,WAAW,
|
|
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,EAAe,KAAK,WAAW,EAAK,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAwEzF,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,aAAa,GAAG,WAAW,CAwC9E"}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { aspectRatio, h } from '@cogenta/theme-kit';
|
|
2
|
+
import { section } from '../layout.js';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* (`consentRequired: true`), which this renderer never has a trusted frame
|
|
6
|
-
* source for anyway, so it always renders the honest placeholder card below.
|
|
4
|
+
* A film of the kitchen, a map, a recording from a third party, eight
|
|
5
|
+
* columns wide from the third.
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* the consent
|
|
7
|
+
* Nothing here contacts a third party before the visitor consents: when
|
|
8
|
+
* `consentRequired` is set, or the provider has no cookie-free frame (a map,
|
|
9
|
+
* a post), a notice takes the frame's place. The notice is a short ruled
|
|
10
|
+
* card, not an empty frame kept at the video's ratio: without a script there
|
|
11
|
+
* is nothing to load into that frame later, and a large blank rectangle on a
|
|
12
|
+
* page is a hole, not a placeholder. A small label in small capitals, one
|
|
13
|
+
* sentence, and one arrow link to the original. No preconnect, no poster
|
|
14
|
+
* fetched from the provider, no consent button (this theme ships no script).
|
|
16
15
|
*/
|
|
17
|
-
/** `null` means "this provider has no embeddable frame we trust". */
|
|
18
16
|
function frameSource(provider, rawUrl) {
|
|
19
17
|
const url = URL.parse(rawUrl);
|
|
20
18
|
if (url === null)
|
|
@@ -44,39 +42,43 @@ function frameSource(provider, rawUrl) {
|
|
|
44
42
|
case 'soundcloud':
|
|
45
43
|
return `https://w.soundcloud.com/player/?url=${encodeURIComponent(rawUrl)}`;
|
|
46
44
|
default:
|
|
47
|
-
// bluesky, mastodon, other
|
|
48
|
-
//
|
|
45
|
+
// bluesky, mastodon, other: a post embed is a script tag and a map is
|
|
46
|
+
// a third-party page, neither of which this theme loads. The notice is
|
|
47
|
+
// the rendering.
|
|
49
48
|
return null;
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
|
-
function
|
|
53
|
-
return h('div', { class: '
|
|
54
|
-
class: '
|
|
51
|
+
function notice(block, ctx, reason) {
|
|
52
|
+
return h('div', { class: 'cr-embed__notice' }, h('p', { class: 'cr-embed__label' }, ctx.t('embed.label')), h('p', { class: 'cr-embed__reason' }, reason), h('a', {
|
|
53
|
+
class: 'cr-arrow-link cr-embed__link',
|
|
55
54
|
href: ctx.link(block.url),
|
|
56
55
|
rel: 'noopener noreferrer nofollow',
|
|
57
|
-
},
|
|
56
|
+
}, block.provider === 'other'
|
|
57
|
+
? ctx.t('embed.openOther')
|
|
58
|
+
: ctx.t('embed.open', { provider: block.provider })));
|
|
58
59
|
}
|
|
59
60
|
export function renderEmbed(block, ctx) {
|
|
60
61
|
const source = block.consentRequired ? null : frameSource(block.provider, block.url);
|
|
62
|
+
// Without a ratio the frame would collapse and shift the layout as it loads.
|
|
61
63
|
const ratio = aspectRatio(block.ratio) ?? '16 / 9';
|
|
62
|
-
return
|
|
63
|
-
class: 'cg-embed',
|
|
64
|
-
'data-block': 'embed',
|
|
64
|
+
return section('div', 'embed', 'cr-embed', {
|
|
65
65
|
'data-provider': block.provider,
|
|
66
66
|
'data-consent': block.consentRequired ? 'required' : 'not-required',
|
|
67
|
-
|
|
68
|
-
}, source === null
|
|
69
|
-
?
|
|
67
|
+
'data-frame': source === null ? 'notice' : 'player',
|
|
68
|
+
}, 'div', source === null
|
|
69
|
+
? notice(block, ctx, block.consentRequired
|
|
70
70
|
? ctx.t('embed.consentRequired', { provider: block.provider })
|
|
71
71
|
: ctx.t('embed.unsupported', { provider: block.provider }))
|
|
72
|
-
: h('iframe', {
|
|
73
|
-
class: '
|
|
72
|
+
: h('div', { class: 'cr-embed__frame', style: `aspect-ratio:${ratio}` }, h('iframe', {
|
|
73
|
+
class: 'cr-embed__player',
|
|
74
74
|
src: source,
|
|
75
|
+
// A frame with no accessible name is announced as "frame" and
|
|
76
|
+
// nothing else (WCAG 4.1.2).
|
|
75
77
|
title: ctx.t('embed.title', { provider: block.provider }),
|
|
76
78
|
loading: 'lazy',
|
|
77
79
|
referrerpolicy: 'strict-origin-when-cross-origin',
|
|
78
80
|
allow: 'accelerometer; clipboard-write; encrypted-media; picture-in-picture; fullscreen',
|
|
79
81
|
allowfullscreen: true,
|
|
80
|
-
}));
|
|
82
|
+
})));
|
|
81
83
|
}
|
|
82
84
|
//# sourceMappingURL=embed.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed.js","sourceRoot":"","sources":["../../../../src/render/blocks/embed.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAoB,CAAC,EAAsB,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"emb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EAAE,kBAAkB;YACzB,GAAG,EAAE,MAAM;YACX,8DAA8D;YAC9D,6BAA6B;YAC7B,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,aAAa,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;YACzD,OAAO,EAAE,MAAM;YACf,cAAc,EAAE,iCAAiC;YACjD,KAAK,EACH,iFAAiF;YACnF,eAAe,EAAE,IAAI;SACtB,CAAC,CACH,CACN,CAAA;AACH,CAAC"}
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
import type { FaqBlock } from '@cogenta/blocks';
|
|
1
|
+
import type { FaqBlock, FaqItem } from '@cogenta/blocks';
|
|
2
2
|
import { type HtmlElement, type RenderContext } from '@cogenta/theme-kit';
|
|
3
|
+
/**
|
|
4
|
+
* Questions before a visit (a table for eight, a child's plate, a dog in the
|
|
5
|
+
* room), in two columns on a wide screen: the title on the first four, and
|
|
6
|
+
* the questions on the last eight, each under a hairline.
|
|
7
|
+
*
|
|
8
|
+
* Every answer is a `<details>`: it opens without a script and is found by
|
|
9
|
+
* the browser's own search. The question sits in a real heading inside the
|
|
10
|
+
* summary, so a screen reader's heading list still reaches every one of
|
|
11
|
+
* them. The plus that turns into a minus is two hairlines drawn by the
|
|
12
|
+
* stylesheet, not a glyph.
|
|
13
|
+
*/
|
|
14
|
+
export declare function answerItem(item: FaqItem, ctx: RenderContext, blockName: 'faq' | 'accordion', titled: boolean): HtmlElement;
|
|
3
15
|
export declare function renderFaq(block: FaqBlock, ctx: RenderContext): HtmlElement;
|
|
4
16
|
//# sourceMappingURL=faq.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"faq.d.ts","sourceRoot":"","sources":["../../../../src/render/blocks/faq.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"faq.d.ts","sourceRoot":"","sources":["../../../../src/render/blocks/faq.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,EACL,KAAK,WAAW,EAGhB,KAAK,aAAa,EAEnB,MAAM,oBAAoB,CAAA;AAG3B;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,aAAa,EAClB,SAAS,EAAE,KAAK,GAAG,WAAW,EAC9B,MAAM,EAAE,OAAO,GACd,WAAW,CAgBb;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,aAAa,GAAG,WAAW,CAe1E"}
|