@cogenta/theme-portfolio 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 +9 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +10 -1
- 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 +10 -18
- package/dist/src/render/blocks/accordion.js.map +1 -1
- package/dist/src/render/blocks/collection-list.d.ts +0 -20
- package/dist/src/render/blocks/collection-list.d.ts.map +1 -1
- package/dist/src/render/blocks/collection-list.js +59 -66
- package/dist/src/render/blocks/collection-list.js.map +1 -1
- package/dist/src/render/blocks/cta.d.ts +4 -4
- package/dist/src/render/blocks/cta.d.ts.map +1 -1
- package/dist/src/render/blocks/cta.js +15 -10
- 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 +16 -31
- 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 +12 -17
- 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 +26 -23
- package/dist/src/render/blocks/feature-grid.js.map +1 -1
- package/dist/src/render/blocks/gallery.d.ts +0 -14
- package/dist/src/render/blocks/gallery.d.ts.map +1 -1
- package/dist/src/render/blocks/gallery.js +29 -21
- package/dist/src/render/blocks/gallery.js.map +1 -1
- package/dist/src/render/blocks/hero.d.ts +8 -8
- package/dist/src/render/blocks/hero.d.ts.map +1 -1
- package/dist/src/render/blocks/hero.js +17 -18
- 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 +9 -14
- 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 +14 -19
- package/dist/src/render/blocks/logos.js.map +1 -1
- package/dist/src/render/blocks/media-figure.d.ts +8 -12
- package/dist/src/render/blocks/media-figure.d.ts.map +1 -1
- package/dist/src/render/blocks/media-figure.js +20 -20
- 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 -20
- package/dist/src/render/blocks/pricing-table.js.map +1 -1
- package/dist/src/render/blocks/prose.d.ts +10 -9
- package/dist/src/render/blocks/prose.d.ts.map +1 -1
- package/dist/src/render/blocks/prose.js +29 -10
- package/dist/src/render/blocks/prose.js.map +1 -1
- package/dist/src/render/blocks/quote.d.ts +5 -12
- package/dist/src/render/blocks/quote.d.ts.map +1 -1
- package/dist/src/render/blocks/quote.js +9 -15
- 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 +10 -12
- 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 +7 -15
- package/dist/src/render/blocks/stats.js.map +1 -1
- package/dist/src/render/blocks/testimonial.d.ts +4 -14
- package/dist/src/render/blocks/testimonial.d.ts.map +1 -1
- package/dist/src/render/blocks/testimonial.js +9 -18
- 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 +93 -90
- package/dist/src/render/chrome.js.map +1 -1
- package/dist/src/render/layout.d.ts +61 -0
- package/dist/src/render/layout.d.ts.map +1 -0
- package/dist/src/render/layout.js +134 -0
- package/dist/src/render/layout.js.map +1 -0
- package/dist/src/render/project.d.ts +27 -0
- package/dist/src/render/project.d.ts.map +1 -0
- package/dist/src/render/project.js +82 -0
- package/dist/src/render/project.js.map +1 -0
- package/dist/src/render/render-block.d.ts +17 -7
- package/dist/src/render/render-block.d.ts.map +1 -1
- package/dist/src/render/render-block.js +47 -34
- package/dist/src/render/render-block.js.map +1 -1
- package/dist/src/render/term-archive.d.ts +0 -11
- package/dist/src/render/term-archive.d.ts.map +1 -1
- package/dist/src/render/term-archive.js +36 -24
- package/dist/src/render/term-archive.js.map +1 -1
- package/dist/src/render/widget-areas.d.ts +14 -0
- package/dist/src/render/widget-areas.d.ts.map +1 -0
- package/dist/src/render/widget-areas.js +21 -0
- package/dist/src/render/widget-areas.js.map +1 -0
- package/dist/src/render/work.d.ts +37 -0
- package/dist/src/render/work.d.ts.map +1 -0
- package/dist/src/render/work.js +49 -0
- package/dist/src/render/work.js.map +1 -0
- package/dist/theme.config.d.ts +4 -7
- package/dist/theme.config.d.ts.map +1 -1
- package/dist/theme.config.js +6 -9
- package/dist/theme.config.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +10 -1
- package/src/render/blocks/accordion.ts +22 -42
- package/src/render/blocks/collection-list.ts +83 -137
- package/src/render/blocks/cta.ts +24 -12
- package/src/render/blocks/embed.ts +39 -47
- package/src/render/blocks/faq.ts +24 -33
- package/src/render/blocks/feature-grid.ts +38 -41
- package/src/render/blocks/gallery.ts +34 -28
- package/src/render/blocks/hero.ts +31 -28
- package/src/render/blocks/logo-strip.ts +18 -20
- package/src/render/blocks/logos.ts +22 -43
- package/src/render/blocks/media-figure.ts +28 -20
- package/src/render/blocks/pricing-table.ts +31 -32
- package/src/render/blocks/prose.ts +38 -13
- package/src/render/blocks/quote.ts +18 -18
- package/src/render/blocks/stat-counter.ts +19 -37
- package/src/render/blocks/stats.ts +18 -33
- package/src/render/blocks/testimonial.ts +16 -22
- package/src/render/chrome.ts +99 -97
- package/src/render/layout.ts +177 -0
- package/src/render/project.ts +140 -0
- package/src/render/render-block.ts +49 -45
- package/src/render/term-archive.ts +92 -70
- package/src/render/widget-areas.ts +25 -0
- package/src/render/work.ts +124 -0
- package/src/styles/archive.css +61 -21
- package/src/styles/base.css +763 -648
- package/src/styles/blocks.css +697 -1093
- package/src/styles/theme.css +22 -10
- package/src/styles/tokens.css +174 -252
- package/src/styles/widgets.css +948 -0
- package/src/styles/work.css +405 -0
- package/tokens.json +19 -19
|
@@ -1,36 +1,48 @@
|
|
|
1
|
-
import { h } from '@cogenta/theme-kit';
|
|
1
|
+
import { h, } from '@cogenta/theme-kit';
|
|
2
|
+
import { taxonomyLabel, yearOf } from './layout.js';
|
|
3
|
+
import { renderIndexRow } from './work.js';
|
|
2
4
|
/**
|
|
3
|
-
* The taxonomy
|
|
4
|
-
*
|
|
5
|
-
* taxonomy name as a kicker above it, and the entries as the same numbered
|
|
6
|
-
* `cg-entry` rows `collectionList` already renders here — an index, not a
|
|
7
|
-
* card grid.
|
|
5
|
+
* The page of one taxonomy term (contract D `theme@1.3`): every project filed
|
|
6
|
+
* under a discipline, a client or a member of the team.
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* It is set as the studio's index, not as a grid: an archive entry carries no
|
|
9
|
+
* picture (`TermArchiveEntry` has none), and a grid of empty frames is worse
|
|
10
|
+
* than a well-set list. The taxonomy's own name sits above the term in the
|
|
11
|
+
* caption size; the term itself is the page's one `h1`, very large; each
|
|
12
|
+
* project is a ruled row with its title, its statement when it has one, and
|
|
13
|
+
* its year; sub-terms and the pager are
|
|
14
|
+
* underlined words, the pager's arrows drawn by the stylesheet.
|
|
12
15
|
*/
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
: h('nav', { class: 'cg-archive__breadcrumb', 'aria-label': input.labels.breadcrumb }, h('ol', {}, ...input.ancestors.map((l) => h('li', {}, h('a', { href: l.href }, l.label))))), h('p', { class: 'cg-collection__title' }, input.taxonomyName), h('h1', { class: 'cg-page__title' }, input.term.label), input.children.length === 0
|
|
22
|
-
? null
|
|
23
|
-
: h('ul', { class: 'cg-archive__children', 'aria-label': input.labels.subterms }, ...input.children.map((c) => h('li', {}, h('a', { href: c.href }, c.label)))), items.length === 0
|
|
24
|
-
? h('p', { class: 'cg-collection__empty' }, input.labels.empty)
|
|
25
|
-
: h('ul', { class: 'cg-collection__items' }, ...items), pager(input));
|
|
16
|
+
function workFromArchive(entry) {
|
|
17
|
+
const year = entry.publishedAt === null ? undefined : yearOf(entry.publishedAt);
|
|
18
|
+
return {
|
|
19
|
+
href: entry.href,
|
|
20
|
+
title: entry.title,
|
|
21
|
+
caption: year === undefined ? {} : { year },
|
|
22
|
+
...(entry.summary === null ? {} : { summary: entry.summary }),
|
|
23
|
+
};
|
|
26
24
|
}
|
|
27
25
|
function pager(input) {
|
|
28
26
|
if (input.page.previousHref === null && input.page.nextHref === null)
|
|
29
27
|
return null;
|
|
30
28
|
return h('nav', { class: 'cg-archive__pager', 'aria-label': input.labels.pagination }, input.page.previousHref === null
|
|
31
29
|
? null
|
|
32
|
-
: h('a', {
|
|
30
|
+
: h('a', {
|
|
31
|
+
class: 'cg-arrow-link',
|
|
32
|
+
'data-direction': 'back',
|
|
33
|
+
rel: 'prev',
|
|
34
|
+
href: input.page.previousHref,
|
|
35
|
+
}, input.labels.previous), input.page.nextHref === null
|
|
36
|
+
? null
|
|
37
|
+
: h('a', { class: 'cg-arrow-link', rel: 'next', href: input.page.nextHref }, input.labels.next));
|
|
38
|
+
}
|
|
39
|
+
export function renderTermArchive(input) {
|
|
40
|
+
return h('main', { class: 'cg-main cg-archive', id: 'cg-main' }, h('header', { class: 'cg-archive__head' }, h('div', { class: 'cg-container cg-archive__head-inner' }, input.ancestors.length === 0
|
|
41
|
+
? null
|
|
42
|
+
: h('nav', { class: 'cg-archive__breadcrumb', 'aria-label': input.labels.breadcrumb }, h('ol', { class: 'cg-archive__trail' }, input.ancestors.map((link) => h('li', {}, h('a', { href: link.href }, link.label))))), h('p', { class: 'cg-archive__kicker' }, taxonomyLabel(input.taxonomyName, input.locale)), h('h1', { class: 'cg-archive__title' }, input.term.label), input.children.length === 0
|
|
33
43
|
? null
|
|
34
|
-
: h('
|
|
44
|
+
: h('ul', { class: 'cg-archive__children', 'aria-label': input.labels.subterms }, input.children.map((child) => h('li', {}, h('a', { class: 'cg-arrow-link', href: child.href }, child.label)))))), h('section', { class: 'cg-section cg-collection', 'data-form': 'index' }, h('div', { class: 'cg-container cg-collection__inner' }, input.entries.length === 0
|
|
45
|
+
? h('p', { class: 'cg-empty' }, input.labels.empty)
|
|
46
|
+
: h('ol', { class: 'cg-index', 'data-count': String(input.entries.length) }, input.entries.map((entry) => renderIndexRow(workFromArchive(entry), 'h2'))), pager(input))));
|
|
35
47
|
}
|
|
36
48
|
//# 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,
|
|
1
|
+
{"version":3,"file":"term-archive.js","sourceRoot":"","sources":["../../../src/render/term-archive.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,CAAC,GAGF,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACnD,OAAO,EAAE,cAAc,EAAa,MAAM,WAAW,CAAA;AAErD;;;;;;;;;;;GAWG;AACH,SAAS,eAAe,CAAC,KAAuB;IAC9C,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;IAC/E,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,OAAO,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE;QAC3C,GAAG,CAAC,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WAAW,EAAE,OAAO,EAAE,EAC3D,CAAC,CACC,KAAK,EACL,EAAE,KAAK,EAAE,mCAAmC,EAAE,EAC9C,KAAK,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC;QACxB,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;QACnD,CAAC,CAAC,CAAC,CACC,IAAI,EACJ,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EACjE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC,CAC3E,EACL,KAAK,CAAC,KAAK,CAAC,CACb,CACF,CACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
* colophon, on the footer's twelve columns; the page areas are placed by the
|
|
5
|
+
* host in the shared `cg-sidebar-layout` markup, which `styles/widgets.css`
|
|
6
|
+
* sets on the page's own grid: the column beside the content takes the last
|
|
7
|
+
* columns of the twelve, the way the header's navigation does.
|
|
8
|
+
*/
|
|
9
|
+
export declare const widgetAreas: readonly {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly label: string;
|
|
12
|
+
readonly description?: string;
|
|
13
|
+
}[];
|
|
14
|
+
//# 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;;;;;;;GAOG;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,EAYA,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
* colophon, on the footer's twelve columns; the page areas are placed by the
|
|
5
|
+
* host in the shared `cg-sidebar-layout` markup, which `styles/widgets.css`
|
|
6
|
+
* sets on the page's own grid: the column beside the content takes the last
|
|
7
|
+
* columns of the twelve, the way the header's navigation does.
|
|
8
|
+
*/
|
|
9
|
+
export const widgetAreas = [
|
|
10
|
+
{
|
|
11
|
+
id: 'sidebar',
|
|
12
|
+
label: 'Beside the page',
|
|
13
|
+
description: 'Beside an index of work (a discipline, a client, a member of the team) and search results.',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: 'content-after',
|
|
17
|
+
label: 'After the work',
|
|
18
|
+
description: 'Under a project or a page, before the footer: more work, a way to get in touch.',
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
//# 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;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,WAAW,GAIlB;IACJ;QACE,EAAE,EAAE,SAAS;QACb,KAAK,EAAE,iBAAiB;QACxB,WAAW,EACT,4FAA4F;KAC/F;IACD;QACE,EAAE,EAAE,eAAe;QACnB,KAAK,EAAE,gBAAgB;QACvB,WAAW,EAAE,iFAAiF;KAC/F;CACF,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type ContentEntry, type HeadingTag, type HtmlElement, type ImageSource, type RenderContext } from '@cogenta/theme-kit';
|
|
2
|
+
import { type WorkCaption } from './layout.js';
|
|
3
|
+
/**
|
|
4
|
+
* One piece of work as a listing sets it: the image, square-cornered and
|
|
5
|
+
* edge to edge within its columns, then the title and the caption line
|
|
6
|
+
* (client, discipline, year). The grid, the strip and the index all build
|
|
7
|
+
* their rows from this one unit.
|
|
8
|
+
*
|
|
9
|
+
* The title is the one link. The image links to the same page but is taken
|
|
10
|
+
* out of the tab order and hidden from assistive technology, so a keyboard or
|
|
11
|
+
* screen-reader user meets each project once.
|
|
12
|
+
*/
|
|
13
|
+
export interface Work {
|
|
14
|
+
readonly href: string | null;
|
|
15
|
+
readonly title: string;
|
|
16
|
+
readonly caption: WorkCaption;
|
|
17
|
+
readonly image?: ImageSource;
|
|
18
|
+
/** A sentence about the work, when the source carries one and the slot shows it (the archive index). */
|
|
19
|
+
readonly summary?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function workFromEntry(entry: ContentEntry, ctx: RenderContext): Work;
|
|
22
|
+
export interface WorkCardOptions {
|
|
23
|
+
readonly tag: HeadingTag;
|
|
24
|
+
readonly sizes: string;
|
|
25
|
+
readonly loading?: 'eager' | 'lazy';
|
|
26
|
+
}
|
|
27
|
+
export declare function renderWorkCard(work: Work, options: WorkCardOptions): HtmlElement;
|
|
28
|
+
/**
|
|
29
|
+
* A row of the index: the title, then the client, the discipline and the
|
|
30
|
+
* year in their own columns, a hairline under each. The columns carry no
|
|
31
|
+
* header row: a header is words, and a theme has no translation for them.
|
|
32
|
+
* The client and the discipline share one wrapper, so on a phone they read
|
|
33
|
+
* as one line under the title; on a wide screen the wrapper steps aside
|
|
34
|
+
* (`display: contents`) and each takes its column.
|
|
35
|
+
*/
|
|
36
|
+
export declare function renderIndexRow(work: Work, tag: HeadingTag): HtmlElement;
|
|
37
|
+
//# sourceMappingURL=work.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"work.d.ts","sourceRoot":"","sources":["../../../src/render/work.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAIjB,KAAK,UAAU,EACf,KAAK,WAAW,EAGhB,KAAK,WAAW,EAChB,KAAK,aAAa,EAEnB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAA6C,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzF;;;;;;;;;GASG;AACH,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAA;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,CAAA;IAC5B,wGAAwG;IACxG,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAC1B;AAKD,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CAY3E;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CACpC;AAYD,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,eAAe,GAAG,WAAW,CA0BhF;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,GAAG,WAAW,CAoBvE"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { entryHref, entryImage, entryTitle, h, heading, renderImageSource, } from '@cogenta/theme-kit';
|
|
2
|
+
import { captionUnder, entryCaption, renderCaption } from './layout.js';
|
|
3
|
+
/** Covers are drawn at 3:2; a listing never asks for another shape, so no card is cropped differently from its neighbour. */
|
|
4
|
+
const COVER_WIDTH = 2000;
|
|
5
|
+
export function workFromEntry(entry, ctx) {
|
|
6
|
+
const image = entryImage(entry, ctx, {
|
|
7
|
+
width: COVER_WIDTH,
|
|
8
|
+
height: Math.round((COVER_WIDTH * 2) / 3),
|
|
9
|
+
fit: 'cover',
|
|
10
|
+
});
|
|
11
|
+
return {
|
|
12
|
+
href: entryHref(entry, ctx),
|
|
13
|
+
title: entryTitle(entry, ctx),
|
|
14
|
+
caption: entryCaption(entry),
|
|
15
|
+
...(image === undefined || image.kind !== 'image' ? {} : { image }),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function titleOf(work, tag, className) {
|
|
19
|
+
return heading(tag, { class: className }, work.href === null
|
|
20
|
+
? work.title
|
|
21
|
+
: h('a', { class: 'cg-work__link', href: work.href }, work.title));
|
|
22
|
+
}
|
|
23
|
+
export function renderWorkCard(work, options) {
|
|
24
|
+
const picture = work.image === undefined
|
|
25
|
+
? h('div', { class: 'cg-work__media', 'data-empty': 'true' })
|
|
26
|
+
: h(work.href === null ? 'div' : 'a', work.href === null
|
|
27
|
+
? { class: 'cg-work__media' }
|
|
28
|
+
: { class: 'cg-work__media', href: work.href, tabindex: '-1', 'aria-hidden': 'true' }, renderImageSource(work.image, {
|
|
29
|
+
className: 'cg-work__image',
|
|
30
|
+
sizes: options.sizes,
|
|
31
|
+
loading: options.loading ?? 'lazy',
|
|
32
|
+
}));
|
|
33
|
+
return h('article', { class: 'cg-work' }, picture, h('div', { class: 'cg-work__text' }, titleOf(work, options.tag, 'cg-work__title'), renderCaption(captionUnder(work.caption, work.title), 'cg-work__caption')));
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A row of the index: the title, then the client, the discipline and the
|
|
37
|
+
* year in their own columns, a hairline under each. The columns carry no
|
|
38
|
+
* header row: a header is words, and a theme has no translation for them.
|
|
39
|
+
* The client and the discipline share one wrapper, so on a phone they read
|
|
40
|
+
* as one line under the title; on a wide screen the wrapper steps aside
|
|
41
|
+
* (`display: contents`) and each takes its column.
|
|
42
|
+
*/
|
|
43
|
+
export function renderIndexRow(work, tag) {
|
|
44
|
+
const { client, discipline, year } = work.caption;
|
|
45
|
+
return h('li', { class: 'cg-index__row' }, titleOf(work, tag, 'cg-index__title'), work.summary === undefined
|
|
46
|
+
? h('span', { class: 'cg-index__meta' }, h('span', { class: 'cg-index__cell', 'data-part': 'client' }, client ?? ''), h('span', { class: 'cg-index__cell', 'data-part': 'discipline' }, discipline ?? ''))
|
|
47
|
+
: h('span', { class: 'cg-index__meta' }, h('span', { class: 'cg-index__summary' }, work.summary)), h('span', { class: 'cg-index__cell', 'data-part': 'year' }, year ?? ''));
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=work.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"work.js","sourceRoot":"","sources":["../../../src/render/work.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,UAAU,EACV,UAAU,EAGV,CAAC,EACD,OAAO,EAGP,iBAAiB,GAClB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAoB,MAAM,aAAa,CAAA;AAqBzF,6HAA6H;AAC7H,MAAM,WAAW,GAAG,IAAI,CAAA;AAExB,MAAM,UAAU,aAAa,CAAC,KAAmB,EAAE,GAAkB;IACnE,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,EAAE,GAAG,EAAE;QACnC,KAAK,EAAE,WAAW;QAClB,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;QACzC,GAAG,EAAE,OAAO;KACb,CAAC,CAAA;IACF,OAAO;QACL,IAAI,EAAE,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC;QAC3B,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC;QAC7B,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC;QAC5B,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,I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CHANGED
|
@@ -13,13 +13,10 @@
|
|
|
13
13
|
* `a11y.verified` is a claim this package has to keep true: the tests assert
|
|
14
14
|
* the heading outline, the mandatory `alt`, and zero client JavaScript.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* full-bleed cover card instead of the plain numbered row; dark-mode
|
|
21
|
-
* elevation was rebuilt from an accent-tinted glow into a flat, zero-blur
|
|
22
|
-
* offset shadow (D5, binding).
|
|
16
|
+
* L27 studio redesign: Archivo on its width axis, black and white with one
|
|
17
|
+
* signal colour, an asymmetric work grid of 3:2 covers, a project page with
|
|
18
|
+
* its lead visual and fact sheet, every block redrawn with hairlines and
|
|
19
|
+
* space rather than boxes.
|
|
23
20
|
*/
|
|
24
21
|
declare const _default: import("@cogenta/theme-kit").ThemeManifest;
|
|
25
22
|
export default _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.config.d.ts","sourceRoot":"","sources":["../theme.config.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"theme.config.d.ts","sourceRoot":"","sources":["../theme.config.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG"}
|
package/dist/theme.config.js
CHANGED
|
@@ -14,18 +14,15 @@ import { defineTheme } from '@cogenta/theme-kit';
|
|
|
14
14
|
* `a11y.verified` is a claim this package has to keep true: the tests assert
|
|
15
15
|
* the heading outline, the mandatory `alt`, and zero client JavaScript.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* full-bleed cover card instead of the plain numbered row; dark-mode
|
|
22
|
-
* elevation was rebuilt from an accent-tinted glow into a flat, zero-blur
|
|
23
|
-
* offset shadow (D5, binding).
|
|
17
|
+
* L27 studio redesign: Archivo on its width axis, black and white with one
|
|
18
|
+
* signal colour, an asymmetric work grid of 3:2 covers, a project page with
|
|
19
|
+
* its lead visual and fact sheet, every block redrawn with hairlines and
|
|
20
|
+
* space rather than boxes.
|
|
24
21
|
*/
|
|
25
22
|
export default defineTheme({
|
|
26
23
|
name: 'portfolio',
|
|
27
|
-
version: '1.
|
|
28
|
-
description: '
|
|
24
|
+
version: '1.3.0',
|
|
25
|
+
description: 'A theme for an independent design studio: work shown large on an asymmetric grid, Archivo set wide for display, black and white with one signal colour, zero client JavaScript.',
|
|
29
26
|
author: 'Cogenta',
|
|
30
27
|
engine: '^1.0.0',
|
|
31
28
|
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,oBAAoB,CAAA;AAEhD
|
|
1
|
+
{"version":3,"file":"theme.config.js","sourceRoot":"","sources":["../theme.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAe,WAAW,CAAC;IACzB,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,OAAO;IAChB,WAAW,EACT,iLAAiL;IACnL,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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cogenta/theme-portfolio",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "An ultra-modern creative-portfolio theme for Cogenta: brutalist-meets-editorial typography, an oversized display scale, and zero client JavaScript.",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"directory": "packages/theme-portfolio"
|
|
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
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
// The shared contract D primitives every theme package implements against
|
|
1
|
+
// The shared contract D primitives every theme package implements against,
|
|
2
2
|
// re-exported so a consumer of this package never has to know they live in
|
|
3
3
|
// `@cogenta/theme-kit` to use them alongside this theme's own blocks.
|
|
4
4
|
export * from '@cogenta/theme-kit'
|
|
5
|
+
export * from './render/blocks/accordion.js'
|
|
5
6
|
export * from './render/blocks/collection-list.js'
|
|
6
7
|
export * from './render/blocks/cta.js'
|
|
7
8
|
export * from './render/blocks/embed.js'
|
|
@@ -9,11 +10,19 @@ export * from './render/blocks/faq.js'
|
|
|
9
10
|
export * from './render/blocks/feature-grid.js'
|
|
10
11
|
export * from './render/blocks/gallery.js'
|
|
11
12
|
export * from './render/blocks/hero.js'
|
|
13
|
+
export * from './render/blocks/logo-strip.js'
|
|
12
14
|
export * from './render/blocks/logos.js'
|
|
13
15
|
export * from './render/blocks/media-figure.js'
|
|
16
|
+
export * from './render/blocks/pricing-table.js'
|
|
14
17
|
export * from './render/blocks/prose.js'
|
|
15
18
|
export * from './render/blocks/quote.js'
|
|
19
|
+
export * from './render/blocks/stat-counter.js'
|
|
16
20
|
export * from './render/blocks/stats.js'
|
|
21
|
+
export * from './render/blocks/testimonial.js'
|
|
17
22
|
export * from './render/chrome.js'
|
|
23
|
+
export * from './render/layout.js'
|
|
24
|
+
export * from './render/project.js'
|
|
18
25
|
export * from './render/render-block.js'
|
|
19
26
|
export * from './render/term-archive.js'
|
|
27
|
+
export * from './render/widget-areas.js'
|
|
28
|
+
export * from './render/work.js'
|
|
@@ -1,64 +1,44 @@
|
|
|
1
1
|
import type { AccordionBlock, AccordionItem } from '@cogenta/blocks'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
type HtmlElement,
|
|
5
|
-
h,
|
|
6
|
-
heading,
|
|
7
|
-
type RenderContext,
|
|
8
|
-
renderRichText,
|
|
9
|
-
} from '@cogenta/theme-kit'
|
|
2
|
+
import { type HtmlElement, h, type RenderContext, renderRichText } from '@cogenta/theme-kit'
|
|
3
|
+
import { section, sectionHead } from '../layout.js'
|
|
10
4
|
|
|
11
5
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* treats them as two distinct editorial intents sharing one data shape; this
|
|
18
|
-
* package keeps that distinction in its markup too.
|
|
19
|
-
*
|
|
20
|
-
* The marker here is a plain rotating caret rather than `faq.ts`'s plus/
|
|
21
|
-
* cross, and questions sit in a numbered ledger the same way `logos.ts`'s
|
|
22
|
-
* items do — an accordion reads as an indexed list of topics, not a wall of
|
|
23
|
-
* frequently-asked questions.
|
|
6
|
+
* Collapsible notes on a ruled list, from the fourth column: each question on
|
|
7
|
+
* its own row in the display width, a plus drawn from two bars that loses its
|
|
8
|
+
* upright when the row is open, and the answer at the reading measure.
|
|
9
|
+
* Opening, keyboard behaviour and the announced state are all native
|
|
10
|
+
* `<details>`. No script.
|
|
24
11
|
*/
|
|
25
|
-
function renderItem(item: AccordionItem, ctx: RenderContext
|
|
12
|
+
function renderItem(item: AccordionItem, ctx: RenderContext): HtmlElement {
|
|
26
13
|
return h(
|
|
27
14
|
'li',
|
|
28
|
-
{ class: 'cg-
|
|
15
|
+
{ class: 'cg-notes__item' },
|
|
29
16
|
h(
|
|
30
17
|
'details',
|
|
31
|
-
{ class: 'cg-
|
|
18
|
+
{ class: 'cg-notes__details' },
|
|
32
19
|
h(
|
|
33
20
|
'summary',
|
|
34
|
-
{ class: 'cg-
|
|
35
|
-
h(
|
|
36
|
-
|
|
37
|
-
{ class: 'cg-accordion__index', 'aria-hidden': 'true' },
|
|
38
|
-
String(index + 1).padStart(2, '0'),
|
|
39
|
-
),
|
|
40
|
-
h('span', { class: 'cg-accordion__label' }, item.question),
|
|
21
|
+
{ class: 'cg-notes__question' },
|
|
22
|
+
h('span', { class: 'cg-notes__question-text' }, item.question),
|
|
23
|
+
h('span', { class: 'cg-notes__mark', 'aria-hidden': 'true' }),
|
|
41
24
|
),
|
|
42
|
-
h('div', { class: 'cg-
|
|
25
|
+
h('div', { class: 'cg-notes__answer' }, renderRichText(ctx, item.answer)),
|
|
43
26
|
),
|
|
44
27
|
)
|
|
45
28
|
}
|
|
46
29
|
|
|
47
30
|
export function renderAccordion(block: AccordionBlock, ctx: RenderContext): HtmlElement {
|
|
48
|
-
return
|
|
31
|
+
return section(
|
|
49
32
|
'section',
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
{ class: 'cg-accordion__title', 'data-field': 'title' },
|
|
56
|
-
block.title,
|
|
57
|
-
),
|
|
33
|
+
'accordion',
|
|
34
|
+
'cg-notes cg-split',
|
|
35
|
+
{ 'data-titled': block.title === undefined ? 'false' : 'true' },
|
|
36
|
+
'div',
|
|
37
|
+
sectionHead('accordion', block.title),
|
|
58
38
|
h(
|
|
59
39
|
'ul',
|
|
60
|
-
{ class: 'cg-
|
|
61
|
-
block.items.map((item
|
|
40
|
+
{ class: 'cg-notes__items' },
|
|
41
|
+
block.items.map((item) => renderItem(item, ctx)),
|
|
62
42
|
),
|
|
63
43
|
)
|
|
64
44
|
}
|