@kolkrabbi/kol-component 0.345.0 → 0.346.0
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/package.json +2 -2
- package/src/utilities/ProsePreview.jsx +50 -33
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-component",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.346.0",
|
|
4
4
|
"description": "The core component library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"embla-carousel-react": "^8.6.0",
|
|
30
30
|
"pdfjs-dist": "^6.3.289",
|
|
31
31
|
"react-syntax-highlighter": "^16.1.1",
|
|
32
|
-
"@kolkrabbi/kol-search": "^0.3.0",
|
|
33
32
|
"@kolkrabbi/kol-markdown": "^0.2.0",
|
|
33
|
+
"@kolkrabbi/kol-search": "^0.3.0",
|
|
34
34
|
"@kolkrabbi/kol-growth": "^0.5.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
@@ -1,49 +1,66 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ProsePreview —
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* ProsePreview — A style collection in one view: every block a reading surface draws, set in ONE named collection's
|
|
3
|
+
* styles, so the collection can be reviewed end to end. Built from the collection's own parts — its text roles, its pull
|
|
4
|
+
* quote, its indent and its code block are the theme's named classes; no style is written in this file
|
|
5
|
+
* (plan-2026-11-07-figma-library-tiers 2.8, the user: *"should it not be made from other components? f.e. text style
|
|
6
|
+
* component, pull quote component, spacer component … it could be great and display workshop style, document style"*).
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* collection="prose" (default) — the long-form stylesheet: `.kol-prose` element styles (H1–H4, p, blockquote, pre,
|
|
9
|
+
* lists) with `.kol-prose-indented` and `.kol-prose-pullout`. Today's view.
|
|
10
|
+
* collection="doc" — the documentation roles the workshop's DocumentationReader and the doc pages read:
|
|
11
|
+
* `kol-doc-heading` · `-section-title` · `-lede` · `-body` · `-code` · `-caption`
|
|
12
|
+
* (kol-type-roles.css), with the doc callout for the quote.
|
|
11
13
|
*
|
|
14
|
+
* A utility (`utilities/`): it wears the theme's sets and imports no molecule. A collection is a map, block → class, in
|
|
15
|
+
* COLLECTIONS below — a new collection is a new row, never new styling.
|
|
16
|
+
*
|
|
17
|
+
* @param {'prose'|'doc'} collection which style set (default `prose`)
|
|
12
18
|
* @param {string} h1 trailing text of the H1 (rendered as `H1 — {h1}`)
|
|
13
19
|
* @param {string} paragraph body paragraph text
|
|
14
|
-
* @param {string} code contents of the
|
|
20
|
+
* @param {string} code contents of the code block
|
|
15
21
|
* @param {string} pullout trailing text of the pullout (rendered as `Pullout — {pullout}`)
|
|
16
22
|
* @param {string} quote blockquote text
|
|
17
23
|
*/
|
|
18
|
-
|
|
24
|
+
|
|
25
|
+
const LEDE = 'Section lede — a larger paragraph used to introduce a section and establish tone before the body copy begins.'
|
|
26
|
+
const INDENT = 'Indented passage. Used for tangential copy, contextual notes, or nested argument that supports the main line.'
|
|
27
|
+
|
|
28
|
+
/* block → the collection's own class. `null` = the collection styles the bare element (prose's element sheet). */
|
|
29
|
+
const COLLECTIONS = {
|
|
30
|
+
prose: {
|
|
31
|
+
/* carried through verbatim from the one-block version, so `prose` renders exactly as before */
|
|
32
|
+
root: 'kol-prose', h1: null, h2: null, h3: null, h4: null, lede: 'kol-sans-body-01 text-strong mb-6', body: null,
|
|
33
|
+
quote: null, indent: 'kol-prose-indented', code: 'bg-fg-04 border border-fg-08',
|
|
34
|
+
pullout: 'kol-prose-pullout kol-helper-12 tracking-widest text-body', list: null,
|
|
35
|
+
},
|
|
36
|
+
doc: {
|
|
37
|
+
root: 'kol-doc-page', h1: 'kol-doc-heading', h2: 'kol-doc-section-title', h3: 'kol-doc-section-title', h4: 'kol-doc-eyebrow',
|
|
38
|
+
lede: 'kol-doc-lede', body: 'kol-doc-body', quote: 'docs-callout kol-doc-body', indent: 'kol-prose-indented kol-doc-body',
|
|
39
|
+
code: 'kol-doc-code', pullout: 'kol-doc-caption', list: 'kol-doc-body',
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default function ProsePreview({ collection = 'prose', h1, paragraph, code, pullout, quote = 'Above as below — justice is a starfield.' }) {
|
|
44
|
+
const c = COLLECTIONS[collection] ?? COLLECTIONS.prose
|
|
45
|
+
const k = (block) => c[block] ?? undefined
|
|
19
46
|
return (
|
|
20
|
-
<div className=
|
|
21
|
-
<h1>H1 — {h1}</h1>
|
|
22
|
-
<h2>H2 — Section title</h2>
|
|
23
|
-
<h3>H3 — Subsection</h3>
|
|
24
|
-
<h4>H4 — Block title</h4>
|
|
25
|
-
<p className=
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</p>
|
|
29
|
-
<
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
<p>
|
|
33
|
-
Indented passage. Used for tangential copy, contextual notes, or
|
|
34
|
-
nested argument that supports the main line.
|
|
35
|
-
</p>
|
|
36
|
-
</div>
|
|
37
|
-
<pre className="bg-fg-04 border border-fg-08"><code>{code}</code></pre>
|
|
38
|
-
<p className="kol-prose-pullout kol-helper-12 tracking-widest text-body">
|
|
39
|
-
Pullout — {pullout}
|
|
40
|
-
</p>
|
|
41
|
-
<ul>
|
|
47
|
+
<div className={c.root} data-collection={collection}>
|
|
48
|
+
<h1 className={k('h1')}>H1 — {h1}</h1>
|
|
49
|
+
<h2 className={k('h2')}>H2 — Section title</h2>
|
|
50
|
+
<h3 className={k('h3')}>H3 — Subsection</h3>
|
|
51
|
+
<h4 className={k('h4')}>H4 — Block title</h4>
|
|
52
|
+
<p className={k('lede')}>{LEDE}</p>
|
|
53
|
+
<p className={k('body')}>{paragraph}</p>
|
|
54
|
+
<blockquote className={k('quote')}><p>{quote}</p></blockquote>
|
|
55
|
+
<div className={k('indent')}><p>{INDENT}</p></div>
|
|
56
|
+
<pre className={k('code')}><code>{code}</code></pre>
|
|
57
|
+
<p className={k('pullout')}>Pullout — {pullout}</p>
|
|
58
|
+
<ul className={k('list')}>
|
|
42
59
|
<li>Unordered list — item one</li>
|
|
43
60
|
<li>Item two</li>
|
|
44
61
|
<li>Item three</li>
|
|
45
62
|
</ul>
|
|
46
|
-
<ol>
|
|
63
|
+
<ol className={k('list')}>
|
|
47
64
|
<li>Ordered list — item one</li>
|
|
48
65
|
<li>Item two</li>
|
|
49
66
|
<li>Item three</li>
|