@cogenta/theme-restaurant 0.3.2 → 0.5.3
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 +807 -554
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-block.d.ts","sourceRoot":"","sources":["../../../src/render/render-block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAoB,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAC5F,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,WAAW,EAEhB,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"render-block.d.ts","sourceRoot":"","sources":["../../../src/render/render-block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAoB,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAC5F,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,WAAW,EAEhB,KAAK,WAAW,EAGhB,KAAK,aAAa,EAInB,MAAM,oBAAoB,CAAA;AAoB3B,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,CAAA;AAE3C,wBAAgB,WAAW,CACzB,KAAK,EAAE,eAAe,EACtB,GAAG,EAAE,aAAa,EAClB,OAAO,GAAE,cAAmB,EAC5B,QAAQ,CAAC,EAAE,aAAa,GACvB,WAAW,GAAG,IAAI,CAepB;AAiED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,aAAa,EAClB,OAAO,GAAE,cAAmB,EAC5B,QAAQ,CAAC,EAAE,aAAa,GACvB,WAAW,CAuBb"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VOCABULARY_NAMES } from '@cogenta/blocks';
|
|
2
|
-
import { h, pageHasOwnHeading,
|
|
2
|
+
import { h, pageHasOwnHeading, providedBlockNode, resolveBlockForRender, withBlockKey, withBlockVariant, } from '@cogenta/theme-kit';
|
|
3
3
|
import { renderAccordion } from './blocks/accordion.js';
|
|
4
4
|
import { renderCollectionList } from './blocks/collection-list.js';
|
|
5
5
|
import { renderCta } from './blocks/cta.js';
|
|
@@ -17,15 +17,23 @@ import { renderQuote } from './blocks/quote.js';
|
|
|
17
17
|
import { renderStatCounter } from './blocks/stat-counter.js';
|
|
18
18
|
import { renderStats } from './blocks/stats.js';
|
|
19
19
|
import { renderTestimonial } from './blocks/testimonial.js';
|
|
20
|
+
import { isDishPage, renderDishHeader, renderPageHeader } from './dish.js';
|
|
20
21
|
export function renderBlock(block, ctx, entries = {}, registry) {
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
|
|
22
|
+
// A block a plugin provides arrives already rendered by the host, in a
|
|
23
|
+
// process of its own (contract D theme@1.7). Nothing else in this theme
|
|
24
|
+
// needs to know such blocks exist.
|
|
25
|
+
const provided = providedBlockNode(block, ctx);
|
|
26
|
+
if (provided !== null)
|
|
27
|
+
return withBlockVariant(provided, block.variant);
|
|
28
|
+
// A stored block is not always literally one of the shared vocabulary:
|
|
29
|
+
// resolving here turns an unimplemented theme-private block into its
|
|
30
|
+
// declared fallback instead of a silently blank slot.
|
|
25
31
|
const resolved = resolveBlockForRender(block, VOCABULARY_NAMES, registry);
|
|
26
32
|
if (resolved === null)
|
|
27
33
|
return null;
|
|
28
34
|
const known = resolved;
|
|
35
|
+
// `variant` is envelope data every block carries identically, applied once
|
|
36
|
+
// here rather than by each of the seventeen renderers.
|
|
29
37
|
return withBlockVariant(renderKnownBlock(known, ctx, entries), known.variant);
|
|
30
38
|
}
|
|
31
39
|
function renderKnownBlock(known, ctx, entries) {
|
|
@@ -65,9 +73,9 @@ function renderKnownBlock(known, ctx, entries) {
|
|
|
65
73
|
case 'logoStrip':
|
|
66
74
|
return renderLogoStrip(known, ctx);
|
|
67
75
|
default: {
|
|
68
|
-
// Exhaustive over contract B
|
|
69
|
-
//
|
|
70
|
-
// is.
|
|
76
|
+
// Exhaustive over contract B: `known` is `never` here, so a block this
|
|
77
|
+
// package does not implement stops it compiling until it is. `null`
|
|
78
|
+
// rather than a throw: choosing a fallback is the render layer's job.
|
|
71
79
|
const unreachable = known;
|
|
72
80
|
void unreachable;
|
|
73
81
|
return null;
|
|
@@ -75,44 +83,47 @@ function renderKnownBlock(known, ctx, entries) {
|
|
|
75
83
|
}
|
|
76
84
|
}
|
|
77
85
|
/**
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* `
|
|
82
|
-
*
|
|
83
|
-
* the rendered iframe back to the block that produced it.
|
|
84
|
-
*
|
|
85
|
-
* A routed collection with no `blocks` field of its own — this theme's
|
|
86
|
-
* `menu_item`, in particular — reaches here with an empty block list, so
|
|
87
|
-
* `page.entry` (contract D `theme@1.4`) is what carries its furniture:
|
|
88
|
-
* `renderEntryHeader` draws the title, excerpt (the dish's own
|
|
89
|
-
* `description`, via `entryExcerpt`'s field-name convention) and cover
|
|
90
|
-
* photo. `PageEntryMeta` has no room for a schema-specific field such as
|
|
91
|
-
* `price`/`category`, so a menu item's own page cannot show them without a
|
|
92
|
-
* contract D change — the theme's real, honest limit; the price and
|
|
93
|
-
* category chip the brief also asks for are exactly what the home page's
|
|
94
|
-
* `collectionList` menu already renders for every dish, and the item page
|
|
95
|
-
* still links back there.
|
|
96
|
-
*/
|
|
97
|
-
/**
|
|
98
|
-
* A second, theme-local stamp beside `withBlockKey`'s own `data-block-key`:
|
|
99
|
-
* a real `id` attribute, so this theme's single-page navigation (the
|
|
100
|
-
* blueprint's header/footer links into `#home-menu`/`#home-story`/etc.) has
|
|
101
|
-
* something to scroll to. Contract B's `_key` is already guaranteed unique
|
|
102
|
-
* within one page's block list (the reorder/diff identity every block
|
|
103
|
-
* carries), so reusing it as the DOM id can never collide on a page this
|
|
104
|
-
* theme rendered — safe to do generically, for every block, not only the
|
|
105
|
-
* ones a blueprint happens to link to.
|
|
86
|
+
* A real `id` beside `withBlockKey`'s `data-block-key`, so a menu link to
|
|
87
|
+
* `/#<key>` still has somewhere to land: sites built on this theme before its
|
|
88
|
+
* multi-page blueprint linked their header straight into home page blocks.
|
|
89
|
+
* Contract B's `_key` is unique within one page's block list, so it can never
|
|
90
|
+
* collide on a page this theme rendered.
|
|
106
91
|
*/
|
|
107
92
|
function withAnchorId(element, key) {
|
|
108
93
|
if (element === null)
|
|
109
94
|
return null;
|
|
110
95
|
return { ...element, attrs: { ...element.attrs, id: key } };
|
|
111
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* `<main id="cg-main">` is mandatory: it is the skip link's target, written
|
|
99
|
+
* by the host outside any theme's control.
|
|
100
|
+
*
|
|
101
|
+
* Three openings, and exactly one `h1` in each:
|
|
102
|
+
*
|
|
103
|
+
* - a page whose blocks include a `hero` lets the hero carry the title;
|
|
104
|
+
* - a dish (`isDishPage`: its `theme@1.5` fields carry a price) gets the dish
|
|
105
|
+
* sheet: photograph, section, name, description, price, details;
|
|
106
|
+
* - anything else gets its title set large on the grid.
|
|
107
|
+
*
|
|
108
|
+
* A host older than `theme@1.5` sends no fields, so its dish pages open like
|
|
109
|
+
* any other page: title and description, never a price read from somewhere
|
|
110
|
+
* it was not given. A host older than `theme@1.4` sends no entry at all, and
|
|
111
|
+
* the page opens on its bare title.
|
|
112
|
+
*
|
|
113
|
+
* `withBlockKey` stamps every rendered block with its contract-B `_key`, so
|
|
114
|
+
* the visual page builder (L16) can map a clicked element back to its block.
|
|
115
|
+
*/
|
|
112
116
|
export function renderPage(page, ctx, entries = {}, registry) {
|
|
113
|
-
const
|
|
117
|
+
const ownHeading = pageHasOwnHeading(page.blocks);
|
|
118
|
+
const dish = !ownHeading && isDishPage(page.entry) ? page.entry : undefined;
|
|
119
|
+
const opening = ownHeading
|
|
114
120
|
? null
|
|
115
|
-
:
|
|
116
|
-
|
|
121
|
+
: dish !== undefined
|
|
122
|
+
? renderDishHeader(page, dish, ctx)
|
|
123
|
+
: renderPageHeader(page, ctx);
|
|
124
|
+
return h('main', {
|
|
125
|
+
class: dish === undefined ? 'cg-main cr-main' : 'cg-main cr-main cr-main--dish',
|
|
126
|
+
id: 'cg-main',
|
|
127
|
+
}, opening, page.blocks.map((block) => withAnchorId(withBlockKey(renderBlock(block, ctx, entries, registry), block._key), block._key)));
|
|
117
128
|
}
|
|
118
129
|
//# sourceMappingURL=render-block.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-block.js","sourceRoot":"","sources":["../../../src/render/render-block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,gBAAgB,EAAwB,MAAM,iBAAiB,CAAA;AAC5F,OAAO,EAGL,CAAC,EAED,iBAAiB,
|
|
1
|
+
{"version":3,"file":"render-block.js","sourceRoot":"","sources":["../../../src/render/render-block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,gBAAgB,EAAwB,MAAM,iBAAiB,CAAA;AAC5F,OAAO,EAGL,CAAC,EAED,iBAAiB,EACjB,iBAAiB,EAEjB,qBAAqB,EACrB,YAAY,EACZ,gBAAgB,GACjB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAA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,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC;YACnC,CAAC,CAAC,gBAAgB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAEjC,OAAO,CAAC,CACN,MAAM,EACN;QACE,KAAK,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,+BAA+B;QAC/E,EAAE,EAAE,SAAS;KACd,EACD,OAAO,EACP,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACxB,YAAY,CACV,YAAY,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,EACpE,KAAK,CAAC,IAAI,CACX,CACF,CACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The few words a restaurant's own pages need that the shared vocabulary
|
|
3
|
+
* does not: the labels of a dish's details, and the word a menu prints beside
|
|
4
|
+
* a vegetarian dish.
|
|
5
|
+
*
|
|
6
|
+
* `@cogenta/theme-kit`'s `THEME_STRINGS` carries the dozen strings every
|
|
7
|
+
* theme's blocks share; these belong to one register (a menu and a dish
|
|
8
|
+
* page), so they live with the theme that draws them, in the two languages
|
|
9
|
+
* the shared table knows. A locale the table does not know reads English, the
|
|
10
|
+
* same rule `createThemeTranslator` follows.
|
|
11
|
+
*/
|
|
12
|
+
type MenuStringKey = 'price' | 'vegetarian' | 'details' | 'sourcing' | 'allergens' | 'pairing';
|
|
13
|
+
export declare function menuString(locale: string, key: MenuStringKey, values?: Readonly<Record<string, string | number>>): string;
|
|
14
|
+
export type { MenuStringKey };
|
|
15
|
+
//# sourceMappingURL=strings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../../src/render/strings.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,KAAK,aAAa,GAAG,OAAO,GAAG,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,CAAA;AAqB9F,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,aAAa,EAClB,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC,GACjD,MAAM,CAER;AAED,YAAY,EAAE,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { interpolate, themeLocaleFor } from '@cogenta/theme-kit';
|
|
2
|
+
const STRINGS = {
|
|
3
|
+
en: {
|
|
4
|
+
price: 'Price',
|
|
5
|
+
vegetarian: 'Vegetarian',
|
|
6
|
+
details: 'About the dish',
|
|
7
|
+
sourcing: 'From',
|
|
8
|
+
allergens: 'Allergens',
|
|
9
|
+
pairing: 'To drink',
|
|
10
|
+
},
|
|
11
|
+
fr: {
|
|
12
|
+
price: 'Prix',
|
|
13
|
+
vegetarian: 'Végétarien',
|
|
14
|
+
details: 'À propos du plat',
|
|
15
|
+
sourcing: 'Provenance',
|
|
16
|
+
allergens: 'Allergènes',
|
|
17
|
+
pairing: 'À boire',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
export function menuString(locale, key, values) {
|
|
21
|
+
return interpolate(STRINGS[themeLocaleFor(locale)][key], values);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=strings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strings.js","sourceRoot":"","sources":["../../../src/render/strings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAgBhE,MAAM,OAAO,GAA2E;IACtF,EAAE,EAAE;QACF,KAAK,EAAE,OAAO;QACd,UAAU,EAAE,YAAY;QACxB,OAAO,EAAE,gBAAgB;QACzB,QAAQ,EAAE,MAAM;QAChB,SAAS,EAAE,WAAW;QACtB,OAAO,EAAE,UAAU;KACpB;IACD,EAAE,EAAE;QACF,KAAK,EAAE,MAAM;QACb,UAAU,EAAE,YAAY;QACxB,OAAO,EAAE,kBAAkB;QAC3B,QAAQ,EAAE,YAAY;QACtB,SAAS,EAAE,YAAY;QACvB,OAAO,EAAE,SAAS;KACnB;CACF,CAAA;AAED,MAAM,UAAU,UAAU,CACxB,MAAc,EACd,GAAkB,EAClB,MAAkD;IAElD,OAAO,WAAW,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAA;AAClE,CAAC"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { type HtmlElement, type TermArchiveInput } from '@cogenta/theme-kit';
|
|
2
2
|
/**
|
|
3
|
-
* The taxonomy-term archive (contract D `theme@1.3`)
|
|
3
|
+
* The taxonomy-term archive (contract D `theme@1.3`), set in the dining
|
|
4
|
+
* room's own register: a breadcrumb in small words, the term as the page
|
|
5
|
+
* title in the display serif, its sub-terms as a ruled line of links, then
|
|
6
|
+
* the classified entries as ruled rows of titles and summaries, and a pager
|
|
7
|
+
* of two arrow links.
|
|
4
8
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
9
|
+
* `TermArchiveEntry` carries no picture and no price, so an archive cannot be
|
|
10
|
+
* a menu or a band of plates; it is an index, drawn like one, rather than a
|
|
11
|
+
* menu of dishes with their prices missing. A restaurant that wants a priced
|
|
12
|
+
* section of its menu on a page of its own builds it from a
|
|
13
|
+
* `collectionList`, which carries both.
|
|
8
14
|
*/
|
|
9
15
|
export declare function renderTermArchive(input: TermArchiveInput): HtmlElement;
|
|
10
16
|
//# sourceMappingURL=term-archive.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"term-archive.d.ts","sourceRoot":"","sources":["../../../src/render/term-archive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAK,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE/E
|
|
1
|
+
{"version":3,"file":"term-archive.d.ts","sourceRoot":"","sources":["../../../src/render/term-archive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAK,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE/E;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG,WAAW,CAqEtE"}
|
|
@@ -1,32 +1,41 @@
|
|
|
1
1
|
import { h } from '@cogenta/theme-kit';
|
|
2
2
|
/**
|
|
3
|
-
* The taxonomy-term archive (contract D `theme@1.3`)
|
|
3
|
+
* The taxonomy-term archive (contract D `theme@1.3`), set in the dining
|
|
4
|
+
* room's own register: a breadcrumb in small words, the term as the page
|
|
5
|
+
* title in the display serif, its sub-terms as a ruled line of links, then
|
|
6
|
+
* the classified entries as ruled rows of titles and summaries, and a pager
|
|
7
|
+
* of two arrow links.
|
|
4
8
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
9
|
+
* `TermArchiveEntry` carries no picture and no price, so an archive cannot be
|
|
10
|
+
* a menu or a band of plates; it is an index, drawn like one, rather than a
|
|
11
|
+
* menu of dishes with their prices missing. A restaurant that wants a priced
|
|
12
|
+
* section of its menu on a page of its own builds it from a
|
|
13
|
+
* `collectionList`, which carries both.
|
|
8
14
|
*/
|
|
9
15
|
export function renderTermArchive(input) {
|
|
10
|
-
const rows = input.entries.map((entry) => h('li', { class: '
|
|
11
|
-
? null
|
|
12
|
-
: h('time', { class: 'cg-index__date', datetime: entry.publishedAt }, entry.publishedAt.slice(0, 10)), h('div', { class: 'cg-index__body' }, h('h2', { class: 'cg-index__title' }, entry.href === null
|
|
16
|
+
const rows = input.entries.map((entry) => h('li', { class: 'cr-index__item' }, h('h2', { class: 'cr-index__name' }, entry.href === null
|
|
13
17
|
? entry.title
|
|
14
|
-
: h('a', { class: '
|
|
15
|
-
return h('main', { class: 'cg-main
|
|
18
|
+
: h('a', { class: 'cr-index__link', href: entry.href }, entry.title)), entry.summary === null ? null : h('p', { class: 'cr-index__text' }, entry.summary)));
|
|
19
|
+
return h('main', { class: 'cg-main cr-main cr-archive', id: 'cg-main' }, h('header', { class: 'cr-page-head' }, h('div', { class: 'cr-container cr-page-head__inner' }, input.ancestors.length === 0
|
|
16
20
|
? null
|
|
17
|
-
: h('nav', { class: '
|
|
21
|
+
: h('nav', { class: 'cr-archive__breadcrumb', 'aria-label': input.labels.breadcrumb }, h('ol', { class: 'cr-archive__trail' }, input.ancestors.map((link) => h('li', {}, h('a', { href: link.href }, link.label))))), h('h1', { class: 'cr-page-head__title' }, input.term.label))), input.children.length === 0
|
|
18
22
|
? null
|
|
19
|
-
: h('
|
|
20
|
-
? h('p', { class: '
|
|
21
|
-
: h('ul', { class: '
|
|
23
|
+
: h('div', { class: 'cr-section cr-archive__children' }, h('div', { class: 'cr-container' }, h('ul', { class: 'cr-archive__terms', 'aria-label': input.labels.subterms }, input.children.map((child) => h('li', { class: 'cr-archive__term' }, h('a', { href: child.href }, child.label)))))), h('section', { class: 'cr-section cr-list', 'data-shape': rows.length === 0 ? 'empty' : 'index' }, h('div', { class: 'cr-container cr-list__inner' }, rows.length === 0
|
|
24
|
+
? h('p', { class: 'cr-empty' }, input.labels.empty)
|
|
25
|
+
: h('ul', { class: 'cr-list__items cr-index' }, rows), pager(input))));
|
|
22
26
|
}
|
|
23
27
|
function pager(input) {
|
|
24
28
|
if (input.page.previousHref === null && input.page.nextHref === null)
|
|
25
29
|
return null;
|
|
26
|
-
return h('nav', { class: '
|
|
30
|
+
return h('nav', { class: 'cr-archive__pager', 'aria-label': input.labels.pagination }, input.page.previousHref === null
|
|
27
31
|
? null
|
|
28
|
-
: h('a', {
|
|
32
|
+
: h('a', {
|
|
33
|
+
class: 'cr-arrow-link',
|
|
34
|
+
'data-direction': 'back',
|
|
35
|
+
rel: 'prev',
|
|
36
|
+
href: input.page.previousHref,
|
|
37
|
+
}, input.labels.previous), input.page.nextHref === null
|
|
29
38
|
? null
|
|
30
|
-
: h('a', { rel: 'next', href: input.page.nextHref }, input.labels.next));
|
|
39
|
+
: h('a', { class: 'cr-arrow-link', rel: 'next', href: input.page.nextHref }, input.labels.next));
|
|
31
40
|
}
|
|
32
41
|
//# sourceMappingURL=term-archive.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"term-archive.js","sourceRoot":"","sources":["../../../src/render/term-archive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,CAAC,EAAyB,MAAM,oBAAoB,CAAA;AAE/E
|
|
1
|
+
{"version":3,"file":"term-archive.js","sourceRoot":"","sources":["../../../src/render/term-archive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,CAAC,EAAyB,MAAM,oBAAoB,CAAA;AAE/E;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAuB;IACvD,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACvC,CAAC,CACC,IAAI,EACJ,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAC3B,CAAC,CACC,IAAI,EACJ,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAC3B,KAAK,CAAC,IAAI,KAAK,IAAI;QACjB,CAAC,CAAC,KAAK,CAAC,KAAK;QACb,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,CACvE,EACD,KAAK,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,CACnF,CACF,CAAA;IAED,OAAO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I,CAAC,QAAQ,KAAK,IAAI;QAC1B,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,CAAC,CACC,GAAG,EACH,EAAE,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,EAClE,KAAK,CAAC,MAAM,CAAC,IAAI,CAClB,CACN,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The widget areas this theme names (contract D `theme@1.6`). Declaring them
|
|
3
|
+
* is what tells the host this theme draws the footer columns inside its own
|
|
4
|
+
* charcoal footer, on the footer's own twelve columns; the page areas are
|
|
5
|
+
* placed by the host in the shared `cg-sidebar-layout` markup, which
|
|
6
|
+
* `styles/widgets.css` sets as the margin of a printed menu card.
|
|
7
|
+
*/
|
|
8
|
+
export declare const widgetAreas: readonly {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly label: string;
|
|
11
|
+
readonly description?: string;
|
|
12
|
+
}[];
|
|
13
|
+
//# sourceMappingURL=widget-areas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget-areas.d.ts","sourceRoot":"","sources":["../../../src/render/widget-areas.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAC9B,EAWA,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The widget areas this theme names (contract D `theme@1.6`). Declaring them
|
|
3
|
+
* is what tells the host this theme draws the footer columns inside its own
|
|
4
|
+
* charcoal footer, on the footer's own twelve columns; the page areas are
|
|
5
|
+
* placed by the host in the shared `cg-sidebar-layout` markup, which
|
|
6
|
+
* `styles/widgets.css` sets as the margin of a printed menu card.
|
|
7
|
+
*/
|
|
8
|
+
export const widgetAreas = [
|
|
9
|
+
{
|
|
10
|
+
id: 'sidebar',
|
|
11
|
+
label: 'Beside the page',
|
|
12
|
+
description: 'Beside a dish, a page that opens on its title, and search results.',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: 'content-after',
|
|
16
|
+
label: 'Under the page',
|
|
17
|
+
description: 'After a dish or a page, before the footer.',
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
//# sourceMappingURL=widget-areas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget-areas.js","sourceRoot":"","sources":["../../../src/render/widget-areas.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAIlB;IACJ;QACE,EAAE,EAAE,SAAS;QACb,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,oEAAoE;KAClF;IACD;QACE,EAAE,EAAE,eAAe;QACnB,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,4CAA4C;KAC1D;CACF,CAAA"}
|
package/dist/theme.config.d.ts
CHANGED
package/dist/theme.config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineTheme } from '@cogenta/render';
|
|
2
2
|
/**
|
|
3
|
-
* Contract D — Theme, `theme@1.
|
|
3
|
+
* Contract D — Theme, `theme@1.5`.
|
|
4
4
|
*
|
|
5
5
|
* `implements` lists the seventeen blocks of contract B (`blocks@2.0`, RFC
|
|
6
6
|
* 0001) in the order the contract lists them — see
|
|
@@ -10,7 +10,7 @@ import { defineTheme } from '@cogenta/render';
|
|
|
10
10
|
export default defineTheme({
|
|
11
11
|
name: 'restaurant',
|
|
12
12
|
version: '1.0.0',
|
|
13
|
-
description: '
|
|
13
|
+
description: 'A contemporary bistro: the room across the window, a typographic menu grouped by section with prices, dish pages, and an evening palette.',
|
|
14
14
|
author: 'Cogenta',
|
|
15
15
|
engine: '^1.0.0',
|
|
16
16
|
blocks: '^2.0.0',
|
package/dist/theme.config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.config.js","sourceRoot":"","sources":["../theme.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C;;;;;;;GAOG;AACH,eAAe,WAAW,CAAC;IACzB,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,OAAO;IAChB,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"theme.config.js","sourceRoot":"","sources":["../theme.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7C;;;;;;;GAOG;AACH,eAAe,WAAW,CAAC;IACzB,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,OAAO;IAChB,WAAW,EACT,2IAA2I;IAC7I,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE;QACV,MAAM;QACN,OAAO;QACP,aAAa;QACb,aAAa;QACb,KAAK;QACL,SAAS;QACT,OAAO;QACP,KAAK;QACL,OAAO;QACP,OAAO;QACP,gBAAgB;QAChB,OAAO;QACP,aAAa;QACb,cAAc;QACd,WAAW;QACX,aAAa;QACb,WAAW;KACZ;IACD,WAAW,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC;IAClC,OAAO,EAAE,QAAQ;IACjB,MAAM,EAAE,eAAe;IACvB,IAAI,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE;CAClC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cogenta/theme-restaurant",
|
|
3
|
-
"version": "0.3
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.5.3",
|
|
4
|
+
"description": "A Cogenta theme for a contemporary bistro: the room across the window, a typographic menu with prices grouped by section, dish pages, and a designed evening palette.",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"directory": "packages/theme-restaurant"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@cogenta/blocks": "1.
|
|
40
|
-
"@cogenta/
|
|
41
|
-
"@cogenta/
|
|
39
|
+
"@cogenta/blocks": "1.1.3",
|
|
40
|
+
"@cogenta/theme-kit": "0.5.3",
|
|
41
|
+
"@cogenta/render": "0.3.5"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"astro": "^7.2.1"
|
package/src/index.ts
CHANGED
|
@@ -20,5 +20,8 @@ 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'
|
|
@@ -1,57 +1,28 @@
|
|
|
1
|
-
import type { AccordionBlock
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
h,
|
|
6
|
-
heading,
|
|
7
|
-
type RenderContext,
|
|
8
|
-
renderRichText,
|
|
9
|
-
} from '@cogenta/theme-kit'
|
|
1
|
+
import type { AccordionBlock } from '@cogenta/blocks'
|
|
2
|
+
import { type HtmlElement, h, type RenderContext } from '@cogenta/theme-kit'
|
|
3
|
+
import { section, sectionHead } from '../layout.js'
|
|
4
|
+
import { answerItem } from './faq.js'
|
|
10
5
|
|
|
11
6
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* rather than a wall of text under the menu.
|
|
18
|
-
*
|
|
19
|
-
* A thin plus/minus mark, drawn from two CSS borders rather than an icon
|
|
20
|
-
* font, rotates to a single line when the panel is open.
|
|
7
|
+
* Collapsible notes: allergens, what a deposit covers, how a group menu is
|
|
8
|
+
* chosen. The same `<details>` rows as `faq`, drawn in the same register, but
|
|
9
|
+
* set in one narrower column under their title (the third to the tenth),
|
|
10
|
+
* because an accordion usually sits inside running text rather than as a
|
|
11
|
+
* section of its own.
|
|
21
12
|
*/
|
|
22
|
-
function renderItem(item: AccordionItem, ctx: RenderContext): HtmlElement {
|
|
23
|
-
return h(
|
|
24
|
-
'li',
|
|
25
|
-
{ class: 'cg-hours__item' },
|
|
26
|
-
h(
|
|
27
|
-
'details',
|
|
28
|
-
{ class: 'cg-hours__details' },
|
|
29
|
-
h(
|
|
30
|
-
'summary',
|
|
31
|
-
{ class: 'cg-hours__question' },
|
|
32
|
-
h('span', { class: 'cg-hours__question-text' }, item.question),
|
|
33
|
-
h('span', { class: 'cg-hours__mark', 'aria-hidden': 'true' }),
|
|
34
|
-
),
|
|
35
|
-
h('div', { class: 'cg-hours__answer' }, renderRichText(ctx, item.answer)),
|
|
36
|
-
),
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
13
|
export function renderAccordion(block: AccordionBlock, ctx: RenderContext): HtmlElement {
|
|
41
|
-
|
|
14
|
+
const titled = block.title !== undefined
|
|
15
|
+
return section(
|
|
42
16
|
'section',
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
{ class: 'cg-hours__title', 'data-field': 'title' },
|
|
49
|
-
block.title,
|
|
50
|
-
),
|
|
17
|
+
'accordion',
|
|
18
|
+
'cr-answers',
|
|
19
|
+
{ 'data-titled': String(titled), 'data-variant': 'notes' },
|
|
20
|
+
'div',
|
|
21
|
+
sectionHead('accordion', block.title),
|
|
51
22
|
h(
|
|
52
23
|
'ul',
|
|
53
|
-
{ class: '
|
|
54
|
-
block.items.map((item) =>
|
|
24
|
+
{ class: 'cr-answers__items' },
|
|
25
|
+
block.items.map((item) => answerItem(item, ctx, 'accordion', titled)),
|
|
55
26
|
),
|
|
56
27
|
)
|
|
57
28
|
}
|