@cogenta/theme-docs 0.3.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/dist/src/index.d.ts +2 -0
  2. package/dist/src/index.d.ts.map +1 -1
  3. package/dist/src/index.js +2 -0
  4. package/dist/src/index.js.map +1 -1
  5. package/dist/src/render/blocks/accordion.d.ts +8 -0
  6. package/dist/src/render/blocks/accordion.d.ts.map +1 -1
  7. package/dist/src/render/blocks/accordion.js +10 -10
  8. package/dist/src/render/blocks/accordion.js.map +1 -1
  9. package/dist/src/render/blocks/collection-list.d.ts +3 -11
  10. package/dist/src/render/blocks/collection-list.d.ts.map +1 -1
  11. package/dist/src/render/blocks/collection-list.js +69 -68
  12. package/dist/src/render/blocks/collection-list.js.map +1 -1
  13. package/dist/src/render/blocks/cta.d.ts +6 -0
  14. package/dist/src/render/blocks/cta.d.ts.map +1 -1
  15. package/dist/src/render/blocks/cta.js +9 -4
  16. package/dist/src/render/blocks/cta.js.map +1 -1
  17. package/dist/src/render/blocks/embed.d.ts.map +1 -1
  18. package/dist/src/render/blocks/embed.js +14 -13
  19. package/dist/src/render/blocks/embed.js.map +1 -1
  20. package/dist/src/render/blocks/faq.d.ts +7 -0
  21. package/dist/src/render/blocks/faq.d.ts.map +1 -1
  22. package/dist/src/render/blocks/faq.js +10 -10
  23. package/dist/src/render/blocks/faq.js.map +1 -1
  24. package/dist/src/render/blocks/feature-grid.d.ts.map +1 -1
  25. package/dist/src/render/blocks/feature-grid.js +19 -19
  26. package/dist/src/render/blocks/feature-grid.js.map +1 -1
  27. package/dist/src/render/blocks/gallery.d.ts +8 -4
  28. package/dist/src/render/blocks/gallery.d.ts.map +1 -1
  29. package/dist/src/render/blocks/gallery.js +19 -13
  30. package/dist/src/render/blocks/gallery.js.map +1 -1
  31. package/dist/src/render/blocks/hero.d.ts +12 -9
  32. package/dist/src/render/blocks/hero.d.ts.map +1 -1
  33. package/dist/src/render/blocks/hero.js +22 -20
  34. package/dist/src/render/blocks/hero.js.map +1 -1
  35. package/dist/src/render/blocks/logo-strip.d.ts +6 -0
  36. package/dist/src/render/blocks/logo-strip.d.ts.map +1 -1
  37. package/dist/src/render/blocks/logo-strip.js +6 -10
  38. package/dist/src/render/blocks/logo-strip.js.map +1 -1
  39. package/dist/src/render/blocks/logos.d.ts +10 -0
  40. package/dist/src/render/blocks/logos.d.ts.map +1 -1
  41. package/dist/src/render/blocks/logos.js +20 -17
  42. package/dist/src/render/blocks/logos.js.map +1 -1
  43. package/dist/src/render/blocks/media-figure.d.ts +0 -6
  44. package/dist/src/render/blocks/media-figure.d.ts.map +1 -1
  45. package/dist/src/render/blocks/media-figure.js +28 -16
  46. package/dist/src/render/blocks/media-figure.js.map +1 -1
  47. package/dist/src/render/blocks/pricing-table.d.ts.map +1 -1
  48. package/dist/src/render/blocks/pricing-table.js +16 -20
  49. package/dist/src/render/blocks/pricing-table.js.map +1 -1
  50. package/dist/src/render/blocks/prose.d.ts +13 -1
  51. package/dist/src/render/blocks/prose.d.ts.map +1 -1
  52. package/dist/src/render/blocks/prose.js +12 -31
  53. package/dist/src/render/blocks/prose.js.map +1 -1
  54. package/dist/src/render/blocks/quote.d.ts +5 -3
  55. package/dist/src/render/blocks/quote.d.ts.map +1 -1
  56. package/dist/src/render/blocks/quote.js +10 -14
  57. package/dist/src/render/blocks/quote.js.map +1 -1
  58. package/dist/src/render/blocks/stat-counter.d.ts +5 -0
  59. package/dist/src/render/blocks/stat-counter.d.ts.map +1 -1
  60. package/dist/src/render/blocks/stat-counter.js +6 -10
  61. package/dist/src/render/blocks/stat-counter.js.map +1 -1
  62. package/dist/src/render/blocks/stats.d.ts +10 -0
  63. package/dist/src/render/blocks/stats.d.ts.map +1 -1
  64. package/dist/src/render/blocks/stats.js +13 -8
  65. package/dist/src/render/blocks/stats.js.map +1 -1
  66. package/dist/src/render/blocks/testimonial.d.ts +4 -5
  67. package/dist/src/render/blocks/testimonial.d.ts.map +1 -1
  68. package/dist/src/render/blocks/testimonial.js +9 -13
  69. package/dist/src/render/blocks/testimonial.js.map +1 -1
  70. package/dist/src/render/chrome.d.ts +36 -1
  71. package/dist/src/render/chrome.d.ts.map +1 -1
  72. package/dist/src/render/chrome.js +122 -80
  73. package/dist/src/render/chrome.js.map +1 -1
  74. package/dist/src/render/doc-index.d.ts +25 -0
  75. package/dist/src/render/doc-index.d.ts.map +1 -0
  76. package/dist/src/render/doc-index.js +49 -0
  77. package/dist/src/render/doc-index.js.map +1 -0
  78. package/dist/src/render/doc-page.d.ts +6 -0
  79. package/dist/src/render/doc-page.d.ts.map +1 -0
  80. package/dist/src/render/doc-page.js +127 -0
  81. package/dist/src/render/doc-page.js.map +1 -0
  82. package/dist/src/render/layout.d.ts +23 -0
  83. package/dist/src/render/layout.d.ts.map +1 -0
  84. package/dist/src/render/layout.js +40 -0
  85. package/dist/src/render/layout.js.map +1 -0
  86. package/dist/src/render/render-block.d.ts +9 -6
  87. package/dist/src/render/render-block.d.ts.map +1 -1
  88. package/dist/src/render/render-block.js +47 -100
  89. package/dist/src/render/render-block.js.map +1 -1
  90. package/dist/src/render/rich-text.d.ts +26 -0
  91. package/dist/src/render/rich-text.d.ts.map +1 -0
  92. package/dist/src/render/rich-text.js +325 -0
  93. package/dist/src/render/rich-text.js.map +1 -0
  94. package/dist/src/render/search.d.ts +15 -0
  95. package/dist/src/render/search.d.ts.map +1 -0
  96. package/dist/src/render/search.js +31 -0
  97. package/dist/src/render/search.js.map +1 -0
  98. package/dist/src/render/strings.d.ts +51 -0
  99. package/dist/src/render/strings.d.ts.map +1 -0
  100. package/dist/src/render/strings.js +60 -0
  101. package/dist/src/render/strings.js.map +1 -0
  102. package/dist/src/render/term-archive.d.ts +5 -5
  103. package/dist/src/render/term-archive.d.ts.map +1 -1
  104. package/dist/src/render/term-archive.js +27 -16
  105. package/dist/src/render/term-archive.js.map +1 -1
  106. package/dist/src/render/widget-areas.d.ts +22 -0
  107. package/dist/src/render/widget-areas.d.ts.map +1 -0
  108. package/dist/src/render/widget-areas.js +29 -0
  109. package/dist/src/render/widget-areas.js.map +1 -0
  110. package/package.json +4 -4
  111. package/src/index.ts +2 -0
  112. package/src/render/blocks/accordion.ts +31 -42
  113. package/src/render/blocks/collection-list.ts +132 -123
  114. package/src/render/blocks/cta.ts +23 -18
  115. package/src/render/blocks/embed.ts +37 -28
  116. package/src/render/blocks/faq.ts +26 -37
  117. package/src/render/blocks/feature-grid.ts +34 -42
  118. package/src/render/blocks/gallery.ts +33 -29
  119. package/src/render/blocks/hero.ts +41 -45
  120. package/src/render/blocks/logo-strip.ts +21 -21
  121. package/src/render/blocks/logos.ts +32 -42
  122. package/src/render/blocks/media-figure.ts +47 -25
  123. package/src/render/blocks/pricing-table.ts +34 -41
  124. package/src/render/blocks/prose.ts +25 -40
  125. package/src/render/blocks/quote.ts +25 -19
  126. package/src/render/blocks/stat-counter.ts +27 -29
  127. package/src/render/blocks/stats.ts +35 -32
  128. package/src/render/blocks/testimonial.ts +18 -19
  129. package/src/render/chrome.ts +170 -83
  130. package/src/render/doc-index.ts +65 -0
  131. package/src/render/doc-page.ts +303 -0
  132. package/src/render/layout.ts +73 -0
  133. package/src/render/render-block.ts +67 -191
  134. package/src/render/rich-text.ts +446 -0
  135. package/src/render/search.ts +41 -0
  136. package/src/render/strings.ts +67 -0
  137. package/src/render/term-archive.ts +62 -38
  138. package/src/render/widget-areas.ts +33 -0
  139. package/src/styles/archive.css +21 -27
  140. package/src/styles/base.css +438 -838
  141. package/src/styles/blocks.css +658 -916
  142. package/src/styles/chrome.css +439 -0
  143. package/src/styles/docs.css +404 -0
  144. package/src/styles/rich.css +337 -0
  145. package/src/styles/theme.css +28 -23
  146. package/src/styles/tokens.css +209 -215
  147. package/src/styles/widgets.css +890 -0
  148. package/tokens.json +15 -15
@@ -1,65 +1,71 @@
1
1
  import { type HtmlElement, h, type TermArchiveInput } from '@cogenta/theme-kit'
2
+ import { longDate } from './layout.js'
2
3
 
3
4
  /**
4
- * The taxonomy-term archive (contract D `theme@1.3`) — a simple titled list,
5
- * deliberately: a documentation site's own information architecture is the
6
- * sidebar (`section`/`order`, plain fields), not a taxonomy, so this page is
7
- * the plain fallback for a term an editor still chooses to classify content
8
- * under, not a second navigation surface competing with the sidebar.
5
+ * The taxonomy-term archive (contract D `theme@1.3`): a titled index of
6
+ * ruled rows on the reading width. A documentation site's own information
7
+ * architecture is the sidebar (`section` and `order`), not a taxonomy, so
8
+ * this page is the plain, well-set fallback for a term an editor still
9
+ * classifies pages under, not a second navigation competing with it.
9
10
  */
10
11
  export function renderTermArchive(input: TermArchiveInput): HtmlElement {
11
12
  const rows = input.entries.map((entry) =>
12
13
  h(
13
14
  'li',
14
- { class: 'cg-list__row' },
15
+ { class: 'cd-index__item' },
15
16
  h(
16
17
  'div',
17
- { class: 'cg-list__body' },
18
+ { class: 'cd-index__words' },
18
19
  h(
19
20
  'h2',
20
- { class: 'cg-list__title' },
21
+ { class: 'cd-index__title' },
21
22
  entry.href === null
22
23
  ? entry.title
23
- : h('a', { class: 'cg-list__link', href: entry.href }, entry.title),
24
+ : h('a', { class: 'cd-index__link', href: entry.href }, entry.title),
24
25
  ),
25
- entry.summary === null ? null : h('p', { class: 'cg-list__excerpt' }, entry.summary),
26
+ entry.summary === null ? null : h('p', { class: 'cd-index__text' }, entry.summary),
26
27
  ),
27
28
  entry.publishedAt === null
28
29
  ? null
29
30
  : h(
30
31
  'time',
31
- { class: 'cg-list__date', datetime: entry.publishedAt },
32
- entry.publishedAt.slice(0, 10),
32
+ { class: 'cd-index__date', datetime: entry.publishedAt },
33
+ longDate(entry.publishedAt, input.locale),
33
34
  ),
34
35
  ),
35
36
  )
36
37
 
37
38
  return h(
38
39
  'main',
39
- { class: 'cg-main cg-archive', id: 'cg-main' },
40
- input.ancestors.length === 0
41
- ? null
42
- : h(
43
- 'nav',
44
- { class: 'cg-archive__breadcrumb', 'aria-label': input.labels.breadcrumb },
45
- h(
46
- 'ol',
47
- {},
48
- ...input.ancestors.map((l) => h('li', {}, h('a', { href: l.href }, l.label))),
40
+ { class: 'cg-main cd-archive', id: 'cg-main' },
41
+ h(
42
+ 'div',
43
+ { class: 'cd-archive__inner' },
44
+ input.ancestors.length === 0
45
+ ? null
46
+ : h(
47
+ 'nav',
48
+ { class: 'cd-breadcrumb', 'aria-label': input.labels.breadcrumb },
49
+ h(
50
+ 'ol',
51
+ { class: 'cd-breadcrumb__items' },
52
+ input.ancestors.map((link) => h('li', {}, h('a', { href: link.href }, link.label))),
53
+ h('li', { 'aria-current': 'page' }, input.term.label),
54
+ ),
49
55
  ),
50
- ),
51
- h('h1', { class: 'cg-page__title' }, input.term.label),
52
- input.children.length === 0
53
- ? null
54
- : h(
55
- 'ul',
56
- { class: 'cg-archive__children', 'aria-label': input.labels.subterms },
57
- ...input.children.map((c) => h('li', {}, h('a', { href: c.href }, c.label))),
58
- ),
59
- rows.length === 0
60
- ? h('p', { class: 'cg-list__empty' }, input.labels.empty)
61
- : h('ul', { class: 'cg-list__items' }, ...rows),
62
- pager(input),
56
+ h('h1', { class: 'cd-archive__title' }, input.term.label),
57
+ input.children.length === 0
58
+ ? null
59
+ : h(
60
+ 'ul',
61
+ { class: 'cd-archive__children', 'aria-label': input.labels.subterms },
62
+ input.children.map((child) => h('li', {}, h('a', { href: child.href }, child.label))),
63
+ ),
64
+ rows.length === 0
65
+ ? h('p', { class: 'cd-empty' }, input.labels.empty)
66
+ : h('ul', { class: 'cd-index' }, rows),
67
+ pager(input),
68
+ ),
63
69
  )
64
70
  }
65
71
 
@@ -67,12 +73,30 @@ function pager(input: TermArchiveInput): HtmlElement | null {
67
73
  if (input.page.previousHref === null && input.page.nextHref === null) return null
68
74
  return h(
69
75
  'nav',
70
- { class: 'cg-archive__pager', 'aria-label': input.labels.pagination },
76
+ { class: 'cd-pager', 'aria-label': input.labels.pagination },
71
77
  input.page.previousHref === null
72
78
  ? null
73
- : h('a', { rel: 'prev', href: input.page.previousHref }, input.labels.previous),
79
+ : h(
80
+ 'a',
81
+ {
82
+ class: 'cd-pager__link',
83
+ 'data-direction': 'previous',
84
+ rel: 'prev',
85
+ href: input.page.previousHref,
86
+ },
87
+ h('span', { class: 'cd-pager__title' }, input.labels.previous),
88
+ ),
74
89
  input.page.nextHref === null
75
90
  ? null
76
- : h('a', { rel: 'next', href: input.page.nextHref }, input.labels.next),
91
+ : h(
92
+ 'a',
93
+ {
94
+ class: 'cd-pager__link',
95
+ 'data-direction': 'next',
96
+ rel: 'next',
97
+ href: input.page.nextHref,
98
+ },
99
+ h('span', { class: 'cd-pager__title' }, input.labels.next),
100
+ ),
77
101
  )
78
102
  }
@@ -0,0 +1,33 @@
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 on this theme's
6
+ * own documentation grid.
7
+ *
8
+ * A documentation page already has two columns of its own beside the
9
+ * article: the navigation on the left and "On this page" on the right. The
10
+ * sidebar never becomes a fourth column next to them. It is the right-hand
11
+ * rail, shared with "On this page": the contents stay in view while the page
12
+ * is read, and the widgets sit at the foot of the rail, level with the end of
13
+ * the article, where a reader who finished the page looks for help and for
14
+ * what comes next. On a page without its own contents, and beside search
15
+ * results or an archive, the widgets are the rail.
16
+ */
17
+ export const widgetAreas: readonly {
18
+ readonly id: string
19
+ readonly label: string
20
+ readonly description?: string
21
+ }[] = [
22
+ {
23
+ id: 'sidebar',
24
+ label: 'Page rail',
25
+ description:
26
+ 'The right-hand rail: under “On this page” and level with the end of a documentation page, beside search results and archives.',
27
+ },
28
+ {
29
+ id: 'content-after',
30
+ label: 'After the page',
31
+ description: 'In the reading column, after a page and its previous and next links.',
32
+ },
33
+ ]
@@ -1,39 +1,33 @@
1
1
  /*
2
- * The taxonomy-term archive (contract D `theme@1.3`) — a simple titled list.
3
- *
4
- * Only the three things an archive adds beyond what `collectionList` already
5
- * styles — a breadcrumb, a sub-term row, a prev/next pager. The entry list
6
- * itself reuses `cg-list__items`/`cg-list__row`, on purpose: an archive of
7
- * entries must look like this theme's own list of entries.
2
+ * The taxonomy-term archive: a titled index on the reading width, with its
3
+ * breadcrumb, its sub-terms and its pager in the documentation's own
4
+ * furniture (`docs.css` draws the breadcrumb and the pager).
8
5
  */
9
6
 
10
- .cg-archive {
11
- max-inline-size: var(--cg-page);
12
- margin-inline: auto;
13
- padding: var(--cg-s10) var(--cg-gutter);
7
+ .cd-archive__inner {
8
+ --cd-edge: max(var(--cd-gutter), calc((100% - var(--cd-page)) / 2));
9
+ inline-size: 100%;
10
+ padding-block: calc(var(--cd-section) * 0.5) var(--cd-section);
11
+ padding-inline: var(--cd-edge) max(var(--cd-gutter), calc(100% - var(--cd-edge) - 52rem));
14
12
  }
15
13
 
16
- .cg-archive__breadcrumb ol,
17
- .cg-archive__children {
14
+ .cd-archive__title {
15
+ margin-block: var(--cd-s3) var(--cd-s8);
16
+ font-size: var(--cd-size-title);
17
+ line-height: var(--cd-leading-display);
18
+ letter-spacing: var(--cd-tracking-display);
19
+ }
20
+
21
+ .cd-archive__children {
18
22
  display: flex;
19
23
  flex-wrap: wrap;
20
- gap: var(--cg-s3);
21
- margin: 0 0 var(--cg-s4);
24
+ gap: var(--cd-s2) var(--cd-s5);
25
+ margin: 0 0 var(--cd-s8);
22
26
  padding: 0;
23
27
  list-style: none;
24
- font-size: var(--cg-text-sm);
28
+ font-size: var(--cd-text-ui);
25
29
  }
26
30
 
27
- .cg-archive__children {
28
- margin-block: var(--cg-s4) var(--cg-s8);
29
- }
30
-
31
- .cg-archive__pager {
32
- display: flex;
33
- justify-content: space-between;
34
- gap: var(--cg-s4);
35
- margin-block-start: var(--cg-s10);
36
- padding-block-start: var(--cg-s5);
37
- border-block-start: 1px solid var(--cg-line-soft);
38
- font-weight: var(--cg-weight-semibold);
31
+ .cd-archive .cd-pager {
32
+ margin-block-start: var(--cd-s10);
39
33
  }