@cogenta/theme-entreprise 1.1.2 → 1.3.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 +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/render/blocks/accordion.d.ts.map +1 -1
- package/dist/src/render/blocks/accordion.js +12 -15
- package/dist/src/render/blocks/accordion.js.map +1 -1
- package/dist/src/render/blocks/collection-list.d.ts +5 -7
- package/dist/src/render/blocks/collection-list.d.ts.map +1 -1
- package/dist/src/render/blocks/collection-list.js +48 -32
- package/dist/src/render/blocks/collection-list.js.map +1 -1
- package/dist/src/render/blocks/cta.d.ts +6 -6
- package/dist/src/render/blocks/cta.d.ts.map +1 -1
- package/dist/src/render/blocks/cta.js +12 -12
- 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 +22 -27
- package/dist/src/render/blocks/embed.js.map +1 -1
- package/dist/src/render/blocks/faq.d.ts.map +1 -1
- package/dist/src/render/blocks/faq.js +13 -16
- 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 +22 -22
- package/dist/src/render/blocks/feature-grid.js.map +1 -1
- package/dist/src/render/blocks/gallery.d.ts +7 -8
- package/dist/src/render/blocks/gallery.d.ts.map +1 -1
- package/dist/src/render/blocks/gallery.js +16 -14
- package/dist/src/render/blocks/gallery.js.map +1 -1
- package/dist/src/render/blocks/hero.d.ts +13 -8
- package/dist/src/render/blocks/hero.d.ts.map +1 -1
- package/dist/src/render/blocks/hero.js +27 -17
- package/dist/src/render/blocks/hero.js.map +1 -1
- package/dist/src/render/blocks/logo-strip.d.ts.map +1 -1
- package/dist/src/render/blocks/logo-strip.js +14 -11
- package/dist/src/render/blocks/logo-strip.js.map +1 -1
- package/dist/src/render/blocks/logos.d.ts.map +1 -1
- package/dist/src/render/blocks/logos.js +21 -12
- package/dist/src/render/blocks/logos.js.map +1 -1
- package/dist/src/render/blocks/media-figure.d.ts +10 -6
- package/dist/src/render/blocks/media-figure.d.ts.map +1 -1
- package/dist/src/render/blocks/media-figure.js +18 -13
- 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 +15 -11
- package/dist/src/render/blocks/pricing-table.js.map +1 -1
- package/dist/src/render/blocks/prose.d.ts +9 -3
- package/dist/src/render/blocks/prose.d.ts.map +1 -1
- package/dist/src/render/blocks/prose.js +11 -4
- package/dist/src/render/blocks/prose.js.map +1 -1
- package/dist/src/render/blocks/quote.d.ts +10 -10
- package/dist/src/render/blocks/quote.d.ts.map +1 -1
- package/dist/src/render/blocks/quote.js +14 -13
- package/dist/src/render/blocks/quote.js.map +1 -1
- package/dist/src/render/blocks/stat-counter.d.ts.map +1 -1
- package/dist/src/render/blocks/stat-counter.js +11 -13
- package/dist/src/render/blocks/stat-counter.js.map +1 -1
- package/dist/src/render/blocks/stats.d.ts.map +1 -1
- package/dist/src/render/blocks/stats.js +12 -13
- package/dist/src/render/blocks/stats.js.map +1 -1
- package/dist/src/render/blocks/testimonial.d.ts +9 -9
- package/dist/src/render/blocks/testimonial.d.ts.map +1 -1
- package/dist/src/render/blocks/testimonial.js +15 -14
- package/dist/src/render/blocks/testimonial.js.map +1 -1
- package/dist/src/render/chrome.d.ts +3 -1
- package/dist/src/render/chrome.d.ts.map +1 -1
- package/dist/src/render/chrome.js +71 -46
- package/dist/src/render/chrome.js.map +1 -1
- package/dist/src/render/layout.d.ts +26 -0
- package/dist/src/render/layout.d.ts.map +1 -0
- package/dist/src/render/layout.js +51 -0
- package/dist/src/render/layout.js.map +1 -0
- package/dist/src/render/render-block.d.ts.map +1 -1
- package/dist/src/render/render-block.js +23 -2
- package/dist/src/render/render-block.js.map +1 -1
- package/dist/src/render/term-archive.d.ts +8 -6
- package/dist/src/render/term-archive.d.ts.map +1 -1
- package/dist/src/render/term-archive.js +22 -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.js +2 -2
- package/dist/theme.config.js.map +1 -1
- package/package.json +5 -5
- package/src/index.ts +1 -0
- package/src/render/blocks/accordion.ts +32 -27
- package/src/render/blocks/collection-list.ts +84 -53
- package/src/render/blocks/cta.ts +27 -28
- package/src/render/blocks/embed.ts +46 -43
- package/src/render/blocks/faq.ts +25 -21
- package/src/render/blocks/feature-grid.ts +42 -35
- package/src/render/blocks/gallery.ts +21 -16
- package/src/render/blocks/hero.ts +40 -28
- package/src/render/blocks/logo-strip.ts +26 -16
- package/src/render/blocks/logos.ts +33 -17
- package/src/render/blocks/media-figure.ts +22 -14
- package/src/render/blocks/pricing-table.ts +26 -15
- package/src/render/blocks/prose.ts +18 -4
- package/src/render/blocks/quote.ts +18 -14
- package/src/render/blocks/stat-counter.ts +25 -20
- package/src/render/blocks/stats.ts +31 -21
- package/src/render/blocks/testimonial.ts +22 -18
- package/src/render/chrome.ts +84 -49
- package/src/render/layout.ts +67 -0
- package/src/render/render-block.ts +24 -1
- package/src/render/term-archive.ts +54 -50
- package/src/render/widget-areas.ts +23 -0
- package/src/styles/archive.css +135 -38
- package/src/styles/base.css +557 -430
- package/src/styles/blocks.css +1192 -1000
- package/src/styles/theme.css +18 -24
- package/src/styles/tokens.css +162 -192
- package/src/styles/widgets.css +913 -0
- package/tokens.json +17 -17
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VOCABULARY_NAMES } from '@cogenta/blocks';
|
|
2
|
-
import { h, pageHasOwnHeading, renderEntryHeader, resolveBlockForRender, withBlockKey, withBlockVariant, } from '@cogenta/theme-kit';
|
|
2
|
+
import { h, pageHasOwnHeading, providedBlockNode, renderEntryHeader, 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';
|
|
@@ -19,6 +19,12 @@ import { renderStats } from './blocks/stats.js';
|
|
|
19
19
|
import { renderTestimonial } from './blocks/testimonial.js';
|
|
20
20
|
export { pageHasOwnHeading, renderEntryHeader, withBlockKey };
|
|
21
21
|
export function renderBlock(block, ctx, entries = {}, registry) {
|
|
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);
|
|
22
28
|
// `block`'s type says `VocabularyBlock`, but the value crossing this
|
|
23
29
|
// boundary from stored content is not always literally one of the shared
|
|
24
30
|
// vocabulary — resolving here is what turns an unimplemented theme-private
|
|
@@ -82,6 +88,21 @@ function renderKnownBlock(known, ctx, entries) {
|
|
|
82
88
|
}
|
|
83
89
|
}
|
|
84
90
|
}
|
|
91
|
+
/** Below this, a reading time says nothing a reader can use. */
|
|
92
|
+
const MIN_READING_MINUTES_SHOWN = 3;
|
|
93
|
+
/**
|
|
94
|
+
* A practice page or a short case study announcing "1 min read" reads like a
|
|
95
|
+
* blog, not like a firm: this theme shows a reading time only for a long
|
|
96
|
+
* read. The rest of the entry furniture is passed through untouched.
|
|
97
|
+
*/
|
|
98
|
+
function withoutShortReadingTime(page) {
|
|
99
|
+
const entry = page.entry;
|
|
100
|
+
if (entry?.readingMinutes === undefined || entry.readingMinutes >= MIN_READING_MINUTES_SHOWN) {
|
|
101
|
+
return page;
|
|
102
|
+
}
|
|
103
|
+
const { readingMinutes: _short, ...rest } = entry;
|
|
104
|
+
return { ...page, entry: rest };
|
|
105
|
+
}
|
|
85
106
|
/**
|
|
86
107
|
* `<main id="cg-main">` is mandatory: it is the skip-link's target, written
|
|
87
108
|
* once by `@cogenta/cli`'s `theme-render.ts` outside any theme's control.
|
|
@@ -100,7 +121,7 @@ function renderKnownBlock(known, ctx, entries) {
|
|
|
100
121
|
* exactly as for every other one.
|
|
101
122
|
*/
|
|
102
123
|
export function renderPage(page, ctx, entries = {}, registry) {
|
|
103
|
-
const entryHeader = renderEntryHeader(page, ctx);
|
|
124
|
+
const entryHeader = renderEntryHeader(withoutShortReadingTime(page), ctx);
|
|
104
125
|
return h('main', { class: 'cg-main', id: 'cg-main' }, entryHeader, entryHeader === null && !pageHasOwnHeading(page.blocks)
|
|
105
126
|
? h('h1', { class: 'cg-page__title' }, page.title)
|
|
106
127
|
: null, page.blocks.map((block) => withBlockKey(renderBlock(block, ctx, entries, registry), block._key)));
|
|
@@ -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,EAEjB,iBAAiB,EACjB,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,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OA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,CAAC,CAAC,IAAI,EACR,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACxB,YAAY,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,CACrE,CACF,CAAA;AACH,CAAC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
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`): an index, set the way a
|
|
4
|
+
* firm lists its work by sector.
|
|
4
5
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* A breadcrumb in small capitals, the term as the page title in the display
|
|
7
|
+
* serif, its sub-terms as a ruled line of links, then one hairline row per
|
|
8
|
+
* entry: the title on the left half of the grid, the summary on the right,
|
|
9
|
+
* the date (when there is one) in the margin. `TermArchiveEntry` carries no
|
|
10
|
+
* picture, so this is a typographic index by design rather than a grid of
|
|
11
|
+
* cards with empty image slots.
|
|
10
12
|
*/
|
|
11
13
|
export declare function renderTermArchive(input: TermArchiveInput): HtmlElement;
|
|
12
14
|
//# 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;
|
|
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;AAG/E;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,gBAAgB,GAAG,WAAW,CAuDtE"}
|
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
import { h } from '@cogenta/theme-kit';
|
|
2
|
+
import { monthYear } from './layout.js';
|
|
2
3
|
/**
|
|
3
|
-
* The taxonomy-term archive (contract D `theme@1.3`)
|
|
4
|
+
* The taxonomy-term archive (contract D `theme@1.3`): an index, set the way a
|
|
5
|
+
* firm lists its work by sector.
|
|
4
6
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* A breadcrumb in small capitals, the term as the page title in the display
|
|
8
|
+
* serif, its sub-terms as a ruled line of links, then one hairline row per
|
|
9
|
+
* entry: the title on the left half of the grid, the summary on the right,
|
|
10
|
+
* the date (when there is one) in the margin. `TermArchiveEntry` carries no
|
|
11
|
+
* picture, so this is a typographic index by design rather than a grid of
|
|
12
|
+
* cards with empty image slots.
|
|
10
13
|
*/
|
|
11
14
|
export function renderTermArchive(input) {
|
|
12
|
-
const rows = input.entries.map((entry) =>
|
|
15
|
+
const rows = input.entries.map((entry) => {
|
|
16
|
+
const date = entry.publishedAt === null ? null : monthYear(entry.publishedAt, input.locale);
|
|
17
|
+
return h('li', { class: 'cg-index__row' }, h('h2', { class: 'cg-index__title' }, entry.href === null
|
|
18
|
+
? entry.title
|
|
19
|
+
: h('a', { class: 'cg-index__link', href: entry.href }, entry.title)), entry.summary === null ? null : h('p', { class: 'cg-index__summary' }, entry.summary), entry.publishedAt === null || date === null
|
|
20
|
+
? null
|
|
21
|
+
: h('time', { class: 'cg-index__date', datetime: entry.publishedAt }, date));
|
|
22
|
+
});
|
|
23
|
+
return h('main', { class: 'cg-main cg-archive', id: 'cg-main' }, h('div', { class: 'cg-container cg-archive__inner' }, input.ancestors.length === 0
|
|
13
24
|
? null
|
|
14
|
-
: h('
|
|
15
|
-
? entry.title
|
|
16
|
-
: h('a', { class: 'cg-list__link', href: entry.href }, entry.title)), entry.summary === null ? null : h('p', { class: 'cg-list__excerpt' }, entry.summary))));
|
|
17
|
-
return h('main', { class: 'cg-main cg-archive', id: 'cg-main' }, input.ancestors.length === 0
|
|
25
|
+
: h('nav', { class: 'cg-archive__breadcrumb', 'aria-label': input.labels.breadcrumb }, h('ol', {}, ...input.ancestors.map((link) => h('li', {}, h('a', { href: link.href }, link.label))))), h('h1', { class: 'cg-archive__title' }, input.term.label), input.children.length === 0
|
|
18
26
|
? null
|
|
19
|
-
: h('
|
|
20
|
-
?
|
|
21
|
-
: h('
|
|
22
|
-
? h('p', { class: 'cg-list__empty' }, input.labels.empty)
|
|
23
|
-
: h('ul', { class: 'cg-list__items' }, ...rows), pager(input));
|
|
27
|
+
: h('ul', { class: 'cg-archive__children', 'aria-label': input.labels.subterms }, ...input.children.map((child) => h('li', {}, h('a', { href: child.href }, child.label)))), rows.length === 0
|
|
28
|
+
? h('p', { class: 'cg-archive__empty' }, input.labels.empty)
|
|
29
|
+
: h('ol', { class: 'cg-index' }, ...rows), pager(input)));
|
|
24
30
|
}
|
|
25
31
|
function pager(input) {
|
|
26
32
|
if (input.page.previousHref === null && input.page.nextHref === null)
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"term-archive.js","sourceRoot":"","sources":["../../../src/render/term-archive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,CAAC,EAAyB,MAAM,oBAAoB,CAAA;AAC/E,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAuB;IACvD,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAA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AAK,CAAC,IAAI,CAAC,QAAQ,KAAK,IAAI;QAAE,OAAO,IAAI,CAAA;IACjF,OAAO,CAAC,CACN,KAAK,EACL,EAAE,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,EACrE,KAAK,CAAC,IAAI,CAAC,YAAY,KAAK,IAAI;QAC9B,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,EACjF,KAAK,CAAC,IAAI,CAAC,QAAQ,KAAK,IAAI;QAC1B,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAC1E,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
|
+
* footer; the page areas are placed by the host in the shared
|
|
5
|
+
* `cg-sidebar-layout` markup, which `styles/widgets.css` sets as the side
|
|
6
|
+
* column of a firm's report.
|
|
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
|
+
* footer; the page areas are placed by the host in the shared
|
|
5
|
+
* `cg-sidebar-layout` markup, which `styles/widgets.css` sets as the side
|
|
6
|
+
* column of a firm's report.
|
|
7
|
+
*/
|
|
8
|
+
export const widgetAreas = [
|
|
9
|
+
{
|
|
10
|
+
id: 'sidebar',
|
|
11
|
+
label: 'Side column',
|
|
12
|
+
description: 'Beside a case study, a practice, a sector and search results.',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: 'content-after',
|
|
16
|
+
label: 'Under the text',
|
|
17
|
+
description: 'After a case study, a practice or a page, before the comments.',
|
|
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,aAAa;QACpB,WAAW,EAAE,+DAA+D;KAC7E;IACD;QACE,EAAE,EAAE,eAAe;QACnB,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,gEAAgE;KAC9E;CACF,CAAA"}
|
package/dist/theme.config.js
CHANGED
|
@@ -14,8 +14,8 @@ import { defineTheme } from '@cogenta/render';
|
|
|
14
14
|
*/
|
|
15
15
|
export default defineTheme({
|
|
16
16
|
name: 'entreprise',
|
|
17
|
-
version: '1.
|
|
18
|
-
description: 'A
|
|
17
|
+
version: '1.2.0',
|
|
18
|
+
description: 'A management consultancy theme: Newsreader and Hanken Grotesk on a twelve-column grid, hairlines instead of boxes, one green accent and a designed dark mode.',
|
|
19
19
|
author: 'Cogenta',
|
|
20
20
|
engine: '^1.0.0',
|
|
21
21
|
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;;;;;;;;;;;;GAYG;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;;;;;;;;;;;;GAYG;AACH,eAAe,WAAW,CAAC;IACzB,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,OAAO;IAChB,WAAW,EACT,+JAA+J;IACjK,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,SAAS,EAAE,MAAM,CAAC;IAChC,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-entreprise",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "A
|
|
3
|
+
"version": "1.3.3",
|
|
4
|
+
"description": "A management consultancy theme for Cogenta: an editorial twelve-column grid, Newsreader and Hanken Grotesk, hairlines instead of boxes, a designed dark mode, and zero client JavaScript.",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"directory": "packages/theme-entreprise"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@cogenta/
|
|
40
|
-
"@cogenta/
|
|
41
|
-
"@cogenta/
|
|
39
|
+
"@cogenta/render": "0.3.5",
|
|
40
|
+
"@cogenta/blocks": "1.1.3",
|
|
41
|
+
"@cogenta/theme-kit": "0.5.3"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"astro": "^7.2.1"
|
package/src/index.ts
CHANGED
|
@@ -7,54 +7,59 @@ import {
|
|
|
7
7
|
type RenderContext,
|
|
8
8
|
renderRichText,
|
|
9
9
|
} from '@cogenta/theme-kit'
|
|
10
|
+
import { ordinal, section } from '../layout.js'
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
|
-
* `blocks@2.0` (RFC 0001).
|
|
13
|
-
* mechanics
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* depending on the other: "accordion" and "frequently asked question" are
|
|
18
|
-
* different editorial intents even where the underlying question/answer
|
|
19
|
-
* shape coincides.
|
|
13
|
+
* `blocks@2.0` (RFC 0001). The same zero-JavaScript `<details>`/`<summary>`
|
|
14
|
+
* mechanics as `faq`, laid out for a different intent: a specification or a
|
|
15
|
+
* method in numbered steps, across the full grid. The title sits above the
|
|
16
|
+
* list rather than beside it, each row carries its ordinal in the left
|
|
17
|
+
* column, and the open panel's text lines up with the question it answers.
|
|
20
18
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* accordion than a support page.
|
|
19
|
+
* Class names are its own (`cg-accordion`, not `cg-faq`) so the two blocks
|
|
20
|
+
* can diverge without one depending on the other.
|
|
24
21
|
*/
|
|
25
|
-
function renderItem(item: AccordionItem, ctx: RenderContext): HtmlElement {
|
|
22
|
+
function renderItem(item: AccordionItem, index: number, ctx: RenderContext): HtmlElement {
|
|
26
23
|
return h(
|
|
27
24
|
'li',
|
|
28
|
-
{ class: 'cg-
|
|
25
|
+
{ class: 'cg-accordion__item' },
|
|
29
26
|
h(
|
|
30
27
|
'details',
|
|
31
|
-
{ class: 'cg-
|
|
28
|
+
{ class: 'cg-accordion__details' },
|
|
32
29
|
h(
|
|
33
30
|
'summary',
|
|
34
|
-
{ class: 'cg-
|
|
35
|
-
h('span', { class: 'cg-
|
|
36
|
-
h('span', { class: 'cg-
|
|
31
|
+
{ class: 'cg-accordion__question' },
|
|
32
|
+
h('span', { class: 'cg-accordion__index', 'aria-hidden': 'true' }, ordinal(index)),
|
|
33
|
+
h('span', { class: 'cg-accordion__question-text' }, item.question),
|
|
34
|
+
h('span', { class: 'cg-toggle-mark', 'aria-hidden': 'true' }),
|
|
37
35
|
),
|
|
38
|
-
h('div', { class: 'cg-
|
|
36
|
+
h('div', { class: 'cg-accordion__answer' }, renderRichText(ctx, item.answer)),
|
|
39
37
|
),
|
|
40
38
|
)
|
|
41
39
|
}
|
|
42
40
|
|
|
43
41
|
export function renderAccordion(block: AccordionBlock, ctx: RenderContext): HtmlElement {
|
|
44
|
-
return
|
|
42
|
+
return section(
|
|
45
43
|
'section',
|
|
46
|
-
|
|
44
|
+
'accordion',
|
|
45
|
+
'cg-accordion',
|
|
46
|
+
{},
|
|
47
|
+
'div',
|
|
47
48
|
block.title === undefined
|
|
48
49
|
? null
|
|
49
|
-
:
|
|
50
|
-
|
|
51
|
-
{ class: 'cg-
|
|
52
|
-
|
|
50
|
+
: h(
|
|
51
|
+
'div',
|
|
52
|
+
{ class: 'cg-head' },
|
|
53
|
+
heading(
|
|
54
|
+
blockHeadingTag('accordion') ?? 'h2',
|
|
55
|
+
{ class: 'cg-head__title', 'data-field': 'title' },
|
|
56
|
+
block.title,
|
|
57
|
+
),
|
|
53
58
|
),
|
|
54
59
|
h(
|
|
55
|
-
'
|
|
56
|
-
{ class: 'cg-
|
|
57
|
-
block.items.map((item) => renderItem(item, ctx)),
|
|
60
|
+
'ol',
|
|
61
|
+
{ class: 'cg-accordion__items' },
|
|
62
|
+
block.items.map((item, index) => renderItem(item, index, ctx)),
|
|
58
63
|
),
|
|
59
64
|
)
|
|
60
65
|
}
|
|
@@ -16,62 +16,90 @@ import {
|
|
|
16
16
|
type RenderContext,
|
|
17
17
|
renderImageSource,
|
|
18
18
|
} from '@cogenta/theme-kit'
|
|
19
|
+
import { arrow, monthYear, ordinal, section } from '../layout.js'
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
|
-
* The only block of the seventeen that reads data at render time
|
|
22
|
-
* marks it `runtime: 'server'`
|
|
23
|
-
*
|
|
24
|
-
* (
|
|
25
|
-
*
|
|
26
|
-
* starts, and this function stays a pure function of the entries handed to
|
|
27
|
-
* it.
|
|
22
|
+
* The only block of the seventeen that reads data at render time (contract B
|
|
23
|
+
* marks it `runtime: 'server'`). The read is not done here: `query` builds
|
|
24
|
+
* the request from the block's own fields, the caller awaits
|
|
25
|
+
* `ctx.content.list(...)` before rendering starts, and this function stays a
|
|
26
|
+
* pure function of the entries handed to it.
|
|
28
27
|
*/
|
|
29
28
|
export { buildCollectionListQuery as query }
|
|
30
29
|
|
|
31
30
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
31
|
+
* Three designed layouts, one markup per entry:
|
|
32
|
+
*
|
|
33
|
+
* - `list` is the case-study register: alternating rows, the picture on
|
|
34
|
+
* seven columns and the text on four, swapping sides from one row to the
|
|
35
|
+
* next. An entry with no picture becomes a typographic row (title left,
|
|
36
|
+
* summary right) under the same hairline, never a row with a hole in it.
|
|
37
|
+
* - `grid` is an editorial index in three columns: a 3:2 picture, a hairline,
|
|
38
|
+
* the title in the display serif and its summary. No card border, no lift
|
|
39
|
+
* on hover.
|
|
40
|
+
* - `carousel` is the grid's item in a scroll-snapping, focusable row.
|
|
41
|
+
*
|
|
42
|
+
* The picture link is hidden from assistive technology and from the tab
|
|
43
|
+
* order: it goes where the title link goes, and one link per entry is what
|
|
44
|
+
* a keyboard or screen reader user should meet.
|
|
39
45
|
*/
|
|
40
|
-
function
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
46
|
+
function renderPicture(entry: ContentEntry, ctx: RenderContext, url: string): HtmlElement | null {
|
|
47
|
+
const picture = entryImage(entry, ctx)
|
|
48
|
+
if (picture === undefined) return null
|
|
43
49
|
return h(
|
|
44
|
-
'
|
|
45
|
-
{ class: 'cg-
|
|
46
|
-
renderImageSource(
|
|
50
|
+
'a',
|
|
51
|
+
{ class: 'cg-entry__media', href: url, tabindex: '-1', 'aria-hidden': 'true' },
|
|
52
|
+
renderImageSource(picture, {
|
|
53
|
+
className: 'cg-entry__image',
|
|
54
|
+
loading: 'lazy',
|
|
55
|
+
sizes: '(min-width: 64rem) 55vw, 100vw',
|
|
56
|
+
}),
|
|
47
57
|
)
|
|
48
58
|
}
|
|
49
59
|
|
|
50
|
-
function renderEntry(
|
|
51
|
-
|
|
60
|
+
function renderEntry(
|
|
61
|
+
entry: ContentEntry,
|
|
62
|
+
index: number,
|
|
63
|
+
ctx: RenderContext,
|
|
64
|
+
tag: HeadingTag,
|
|
65
|
+
): HtmlElement {
|
|
66
|
+
const url = entryHref(entry, ctx)
|
|
52
67
|
const excerpt = entryExcerpt(entry)
|
|
68
|
+
// Only a declared publication date is shown: `entryDate` falls back to
|
|
69
|
+
// `createdAt`, and the day a record was typed in is not a date a reader of
|
|
70
|
+
// a case study or a practice page is owed.
|
|
71
|
+
const iso = typeof entry.publishedAt === 'string' ? entryDate(entry) : undefined
|
|
72
|
+
const date = iso === undefined ? null : monthYear(iso, ctx.locale)
|
|
73
|
+
const picture = renderPicture(entry, ctx, url)
|
|
53
74
|
return h(
|
|
54
75
|
'li',
|
|
55
|
-
{ class: 'cg-
|
|
56
|
-
|
|
76
|
+
{ class: 'cg-entry', 'data-media': picture === null ? 'none' : 'present' },
|
|
77
|
+
picture,
|
|
57
78
|
h(
|
|
58
79
|
'div',
|
|
59
|
-
{ class: 'cg-
|
|
80
|
+
{ class: 'cg-entry__body' },
|
|
81
|
+
h(
|
|
82
|
+
'p',
|
|
83
|
+
{ class: 'cg-entry__meta' },
|
|
84
|
+
h('span', { class: 'cg-entry__index', 'aria-hidden': 'true' }, ordinal(index)),
|
|
85
|
+
iso === undefined || date === null
|
|
86
|
+
? null
|
|
87
|
+
: h('time', { class: 'cg-entry__date', datetime: iso }, date),
|
|
88
|
+
),
|
|
89
|
+
// The title is the link, and the arrow sits inline after its last word
|
|
90
|
+
// inside the same link: a bare arrow on a line of its own reads as a
|
|
91
|
+
// placeholder, not as a way into the case study.
|
|
60
92
|
heading(
|
|
61
93
|
tag,
|
|
62
|
-
{ class: 'cg-
|
|
63
|
-
h(
|
|
94
|
+
{ class: 'cg-entry__title' },
|
|
95
|
+
h(
|
|
96
|
+
'a',
|
|
97
|
+
{ class: 'cg-entry__link', href: url },
|
|
98
|
+
h('span', { class: 'cg-entry__link-text' }, entryTitle(entry, ctx)),
|
|
99
|
+
h('span', { class: 'cg-entry__arrow', 'aria-hidden': 'true' }, arrow()),
|
|
100
|
+
),
|
|
64
101
|
),
|
|
65
|
-
excerpt === undefined ? null : h('p', { class: 'cg-
|
|
66
|
-
date === undefined
|
|
67
|
-
? null
|
|
68
|
-
: h(
|
|
69
|
-
'time',
|
|
70
|
-
{ class: 'cg-list__date', datetime: date },
|
|
71
|
-
new Intl.DateTimeFormat(ctx.locale, { month: 'short', day: '2-digit' }).format(
|
|
72
|
-
new Date(date),
|
|
73
|
-
),
|
|
74
|
-
),
|
|
102
|
+
excerpt === undefined ? null : h('p', { class: 'cg-entry__excerpt' }, excerpt),
|
|
75
103
|
),
|
|
76
104
|
)
|
|
77
105
|
}
|
|
@@ -85,32 +113,35 @@ export function renderCollectionList(
|
|
|
85
113
|
const entryTag = nestedHeadingTag('collectionList', hasTitle)
|
|
86
114
|
const items =
|
|
87
115
|
entries.length === 0
|
|
88
|
-
? h('p', { class: 'cg-
|
|
116
|
+
? h('p', { class: 'cg-collection__empty' }, ctx.t('collection.empty'))
|
|
89
117
|
: h(
|
|
90
|
-
'ul',
|
|
91
|
-
{ class: 'cg-
|
|
92
|
-
entries.map((entry) => renderEntry(entry, ctx, entryTag)),
|
|
118
|
+
block.layout === 'list' ? 'ol' : 'ul',
|
|
119
|
+
{ class: 'cg-collection__items', 'data-count': String(Math.min(entries.length, 4)) },
|
|
120
|
+
entries.map((entry, index) => renderEntry(entry, index, ctx, entryTag)),
|
|
93
121
|
)
|
|
94
122
|
|
|
95
|
-
return
|
|
123
|
+
return section(
|
|
96
124
|
'section',
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
},
|
|
125
|
+
'collectionList',
|
|
126
|
+
'cg-collection',
|
|
127
|
+
{ 'data-layout': block.layout },
|
|
128
|
+
'div',
|
|
102
129
|
hasTitle
|
|
103
|
-
?
|
|
104
|
-
|
|
105
|
-
{ class: 'cg-
|
|
106
|
-
|
|
130
|
+
? h(
|
|
131
|
+
'div',
|
|
132
|
+
{ class: 'cg-head' },
|
|
133
|
+
heading(
|
|
134
|
+
blockHeadingTag('collectionList') ?? 'h2',
|
|
135
|
+
{ class: 'cg-head__title', 'data-field': 'title' },
|
|
136
|
+
block.title ?? '',
|
|
137
|
+
),
|
|
107
138
|
)
|
|
108
139
|
: null,
|
|
109
|
-
block.layout === 'carousel'
|
|
140
|
+
block.layout === 'carousel' && entries.length > 0
|
|
110
141
|
? h(
|
|
111
142
|
'div',
|
|
112
143
|
{
|
|
113
|
-
class: 'cg-
|
|
144
|
+
class: 'cg-collection__viewport',
|
|
114
145
|
role: 'region',
|
|
115
146
|
'aria-label': block.title ?? ctx.t('collection.carousel'),
|
|
116
147
|
tabindex: '0',
|
package/src/render/blocks/cta.ts
CHANGED
|
@@ -7,42 +7,41 @@ import {
|
|
|
7
7
|
heading,
|
|
8
8
|
type RenderContext,
|
|
9
9
|
} from '@cogenta/theme-kit'
|
|
10
|
+
import { section } from '../layout.js'
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
13
|
+
* The ink band: the one dark plane on a light page, edge to edge.
|
|
14
|
+
*
|
|
15
|
+
* The ask is set in the display serif across the left eight columns, the
|
|
16
|
+
* supporting line beneath it, and the actions sit in the right-hand columns
|
|
17
|
+
* on the band's baseline. In dark mode the band becomes the raised ink
|
|
18
|
+
* surface between two hairlines, so it keeps its role without inverting.
|
|
18
19
|
*/
|
|
19
20
|
export function renderCta(block: CtaBlock, ctx: RenderContext): HtmlElement {
|
|
20
|
-
return
|
|
21
|
+
return section(
|
|
21
22
|
'section',
|
|
22
|
-
|
|
23
|
+
'cta',
|
|
24
|
+
'cg-cta',
|
|
25
|
+
{},
|
|
26
|
+
'div',
|
|
23
27
|
h(
|
|
24
28
|
'div',
|
|
25
|
-
{ class: 'cg-
|
|
26
|
-
|
|
27
|
-
'
|
|
28
|
-
{ class: 'cg-
|
|
29
|
-
|
|
30
|
-
blockHeadingTag('cta') ?? 'h2',
|
|
31
|
-
{ class: 'cg-banner__title', 'data-field': 'title' },
|
|
32
|
-
block.title,
|
|
33
|
-
),
|
|
34
|
-
block.text === undefined
|
|
35
|
-
? null
|
|
36
|
-
: h('p', { class: 'cg-banner__text', 'data-field': 'text' }, block.text),
|
|
37
|
-
),
|
|
38
|
-
h(
|
|
39
|
-
'div',
|
|
40
|
-
{ class: 'cg-banner__actions' },
|
|
41
|
-
// `actions` is required and non-empty for a `cta`, so the list is
|
|
42
|
-
// always rendered; the null branch stays reachable only through
|
|
43
|
-
// invalid data.
|
|
44
|
-
actionList(ctx, block.actions, block.title),
|
|
29
|
+
{ class: 'cg-cta__copy' },
|
|
30
|
+
heading(
|
|
31
|
+
blockHeadingTag('cta') ?? 'h2',
|
|
32
|
+
{ class: 'cg-cta__title', 'data-field': 'title' },
|
|
33
|
+
block.title,
|
|
45
34
|
),
|
|
35
|
+
block.text === undefined
|
|
36
|
+
? null
|
|
37
|
+
: h('p', { class: 'cg-cta__text', 'data-field': 'text' }, block.text),
|
|
38
|
+
),
|
|
39
|
+
h(
|
|
40
|
+
'div',
|
|
41
|
+
{ class: 'cg-cta__actions' },
|
|
42
|
+
// `actions` is required and non-empty for a `cta`; the null branch is
|
|
43
|
+
// reachable only through invalid data.
|
|
44
|
+
actionList(ctx, block.actions, block.title),
|
|
46
45
|
),
|
|
47
46
|
)
|
|
48
47
|
}
|