@flowstack-ui/brick 0.1.11 → 0.1.12
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/README.md +1 -1
- package/dist/agents/blockquote.json +68 -0
- package/dist/agents/blockquote.md +42 -0
- package/dist/agents/code-block.json +20 -4
- package/dist/agents/code-block.md +9 -4
- package/dist/agents/coverage.json +1211 -199
- package/dist/agents/em.json +57 -0
- package/dist/agents/em.md +39 -0
- package/dist/agents/highlight.json +73 -0
- package/dist/agents/highlight.md +43 -0
- package/dist/agents/interface-composition.json +14 -7
- package/dist/agents/interface-composition.md +5 -2
- package/dist/agents/kbd.json +62 -0
- package/dist/agents/kbd.md +40 -0
- package/dist/agents/layer-selection.json +125 -5
- package/dist/agents/layer-selection.md +12 -2
- package/dist/agents/manifest.json +37 -1
- package/dist/agents/mark.json +56 -0
- package/dist/agents/mark.md +38 -0
- package/dist/agents/prose.json +82 -0
- package/dist/agents/prose.md +50 -0
- package/dist/blockquote.d.ts +2 -0
- package/dist/blockquote.d.ts.map +1 -0
- package/dist/blockquote.js +2 -0
- package/dist/blockquote.js.map +1 -0
- package/dist/components/blockquote/Blockquote.d.ts +33 -0
- package/dist/components/blockquote/Blockquote.d.ts.map +1 -0
- package/dist/components/blockquote/Blockquote.js +36 -0
- package/dist/components/blockquote/Blockquote.js.map +1 -0
- package/dist/components/blockquote/index.d.ts +2 -0
- package/dist/components/blockquote/index.d.ts.map +1 -0
- package/dist/components/blockquote/index.js +2 -0
- package/dist/components/blockquote/index.js.map +1 -0
- package/dist/components/code-block/CodeBlock.d.ts +33 -0
- package/dist/components/code-block/CodeBlock.d.ts.map +1 -1
- package/dist/components/code-block/CodeBlock.js +60 -6
- package/dist/components/code-block/CodeBlock.js.map +1 -1
- package/dist/components/code-block/context.d.ts +2 -0
- package/dist/components/code-block/context.d.ts.map +1 -1
- package/dist/components/code-block/context.js.map +1 -1
- package/dist/components/code-block/index.d.ts +1 -1
- package/dist/components/code-block/index.d.ts.map +1 -1
- package/dist/components/code-block/index.js +1 -1
- package/dist/components/code-block/index.js.map +1 -1
- package/dist/components/em/Em.d.ts +9 -0
- package/dist/components/em/Em.d.ts.map +1 -0
- package/dist/components/em/Em.js +10 -0
- package/dist/components/em/Em.js.map +1 -0
- package/dist/components/em/index.d.ts +2 -0
- package/dist/components/em/index.d.ts.map +1 -0
- package/dist/components/em/index.js +2 -0
- package/dist/components/em/index.js.map +1 -0
- package/dist/components/highlight/Highlight.d.ts +9 -0
- package/dist/components/highlight/Highlight.d.ts.map +1 -0
- package/dist/components/highlight/Highlight.js +10 -0
- package/dist/components/highlight/Highlight.js.map +1 -0
- package/dist/components/highlight/index.d.ts +2 -0
- package/dist/components/highlight/index.d.ts.map +1 -0
- package/dist/components/highlight/index.js +2 -0
- package/dist/components/highlight/index.js.map +1 -0
- package/dist/components/kbd/Kbd.d.ts +13 -0
- package/dist/components/kbd/Kbd.d.ts.map +1 -0
- package/dist/components/kbd/Kbd.js +8 -0
- package/dist/components/kbd/Kbd.js.map +1 -0
- package/dist/components/kbd/index.d.ts +2 -0
- package/dist/components/kbd/index.d.ts.map +1 -0
- package/dist/components/kbd/index.js +2 -0
- package/dist/components/kbd/index.js.map +1 -0
- package/dist/components/mark/Mark.d.ts +13 -0
- package/dist/components/mark/Mark.d.ts.map +1 -0
- package/dist/components/mark/Mark.js +8 -0
- package/dist/components/mark/Mark.js.map +1 -0
- package/dist/components/mark/index.d.ts +2 -0
- package/dist/components/mark/index.d.ts.map +1 -0
- package/dist/components/mark/index.js +2 -0
- package/dist/components/mark/index.js.map +1 -0
- package/dist/components/prose/Prose.d.ts +12 -0
- package/dist/components/prose/Prose.d.ts.map +1 -0
- package/dist/components/prose/Prose.js +19 -0
- package/dist/components/prose/Prose.js.map +1 -0
- package/dist/components/prose/index.d.ts +2 -0
- package/dist/components/prose/index.d.ts.map +1 -0
- package/dist/components/prose/index.js +2 -0
- package/dist/components/prose/index.js.map +1 -0
- package/dist/em.d.ts +2 -0
- package/dist/em.d.ts.map +1 -0
- package/dist/em.js +2 -0
- package/dist/em.js.map +1 -0
- package/dist/highlight.d.ts +2 -0
- package/dist/highlight.d.ts.map +1 -0
- package/dist/highlight.js +2 -0
- package/dist/highlight.js.map +1 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/kbd.d.ts +2 -0
- package/dist/kbd.d.ts.map +1 -0
- package/dist/kbd.js +2 -0
- package/dist/kbd.js.map +1 -0
- package/dist/mark.d.ts +2 -0
- package/dist/mark.d.ts.map +1 -0
- package/dist/mark.js +2 -0
- package/dist/mark.js.map +1 -0
- package/dist/prose.d.ts +2 -0
- package/dist/prose.d.ts.map +1 -0
- package/dist/prose.js +2 -0
- package/dist/prose.js.map +1 -0
- package/dist/styles/blockquote.css +2 -0
- package/dist/styles/blockquote.css.map +1 -0
- package/dist/styles/code-block.css +1 -1
- package/dist/styles/code-block.css.map +1 -1
- package/dist/styles/dropdown-menu.css.map +1 -1
- package/dist/styles/em.css +2 -0
- package/dist/styles/em.css.map +1 -0
- package/dist/styles/highlight.css +2 -0
- package/dist/styles/highlight.css.map +1 -0
- package/dist/styles/kbd.css +2 -0
- package/dist/styles/kbd.css.map +1 -0
- package/dist/styles/mark.css +2 -0
- package/dist/styles/mark.css.map +1 -0
- package/dist/styles/menubar.css.map +1 -1
- package/dist/styles/prose.css +2 -0
- package/dist/styles/prose.css.map +1 -0
- package/dist/styles/slider.css.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/dist/theme-contract.json +1418 -100
- package/package.json +36 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": "flowstack.agent-manifest.v1",
|
|
3
3
|
"package": "@flowstack-ui/brick",
|
|
4
|
-
"packageVersion": "0.1.
|
|
4
|
+
"packageVersion": "0.1.12",
|
|
5
5
|
"components": [
|
|
6
6
|
{
|
|
7
7
|
"id": "accordion",
|
|
@@ -57,6 +57,12 @@
|
|
|
57
57
|
"json": "./bleed.json",
|
|
58
58
|
"markdown": "./bleed.md"
|
|
59
59
|
},
|
|
60
|
+
{
|
|
61
|
+
"id": "blockquote",
|
|
62
|
+
"name": "Blockquote",
|
|
63
|
+
"json": "./blockquote.json",
|
|
64
|
+
"markdown": "./blockquote.md"
|
|
65
|
+
},
|
|
60
66
|
{
|
|
61
67
|
"id": "bottom-navigation",
|
|
62
68
|
"name": "BottomNavigation",
|
|
@@ -189,6 +195,12 @@
|
|
|
189
195
|
"json": "./dropdown-menu.json",
|
|
190
196
|
"markdown": "./dropdown-menu.md"
|
|
191
197
|
},
|
|
198
|
+
{
|
|
199
|
+
"id": "em",
|
|
200
|
+
"name": "Em",
|
|
201
|
+
"json": "./em.json",
|
|
202
|
+
"markdown": "./em.md"
|
|
203
|
+
},
|
|
192
204
|
{
|
|
193
205
|
"id": "feed",
|
|
194
206
|
"name": "Feed",
|
|
@@ -243,6 +255,12 @@
|
|
|
243
255
|
"json": "./hide.json",
|
|
244
256
|
"markdown": "./hide.md"
|
|
245
257
|
},
|
|
258
|
+
{
|
|
259
|
+
"id": "highlight",
|
|
260
|
+
"name": "Highlight",
|
|
261
|
+
"json": "./highlight.json",
|
|
262
|
+
"markdown": "./highlight.md"
|
|
263
|
+
},
|
|
246
264
|
{
|
|
247
265
|
"id": "hover-card",
|
|
248
266
|
"name": "HoverCard",
|
|
@@ -273,6 +291,12 @@
|
|
|
273
291
|
"json": "./input.json",
|
|
274
292
|
"markdown": "./input.md"
|
|
275
293
|
},
|
|
294
|
+
{
|
|
295
|
+
"id": "kbd",
|
|
296
|
+
"name": "Kbd",
|
|
297
|
+
"json": "./kbd.json",
|
|
298
|
+
"markdown": "./kbd.md"
|
|
299
|
+
},
|
|
276
300
|
{
|
|
277
301
|
"id": "link-box",
|
|
278
302
|
"name": "Link Box",
|
|
@@ -291,6 +315,12 @@
|
|
|
291
315
|
"json": "./list.json",
|
|
292
316
|
"markdown": "./list.md"
|
|
293
317
|
},
|
|
318
|
+
{
|
|
319
|
+
"id": "mark",
|
|
320
|
+
"name": "Mark",
|
|
321
|
+
"json": "./mark.json",
|
|
322
|
+
"markdown": "./mark.md"
|
|
323
|
+
},
|
|
294
324
|
{
|
|
295
325
|
"id": "menubar",
|
|
296
326
|
"name": "Menubar",
|
|
@@ -357,6 +387,12 @@
|
|
|
357
387
|
"json": "./progress.json",
|
|
358
388
|
"markdown": "./progress.md"
|
|
359
389
|
},
|
|
390
|
+
{
|
|
391
|
+
"id": "prose",
|
|
392
|
+
"name": "Prose",
|
|
393
|
+
"json": "./prose.json",
|
|
394
|
+
"markdown": "./prose.md"
|
|
395
|
+
},
|
|
360
396
|
{
|
|
361
397
|
"id": "radio-group",
|
|
362
398
|
"name": "RadioGroup",
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": "flowstack.agent-component.v1",
|
|
3
|
+
"id": "mark",
|
|
4
|
+
"name": "Mark",
|
|
5
|
+
"package": "@flowstack-ui/brick",
|
|
6
|
+
"layer": "brick",
|
|
7
|
+
"kind": "component",
|
|
8
|
+
"purpose": "Render a semantically marked static passage with restrained theme-aware Brick paint.",
|
|
9
|
+
"useWhen": [
|
|
10
|
+
"Authored content needs a static marked passage whose relevance is already known."
|
|
11
|
+
],
|
|
12
|
+
"avoidWhen": [
|
|
13
|
+
{
|
|
14
|
+
"condition": "Text must be matched from a query.",
|
|
15
|
+
"useInstead": "Highlight"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"condition": "Text needs stress emphasis.",
|
|
19
|
+
"useInstead": "Em"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"composition": [
|
|
23
|
+
"Keep Mark inside the surrounding Text, heading, link, or Prose content owner."
|
|
24
|
+
],
|
|
25
|
+
"rules": [
|
|
26
|
+
{
|
|
27
|
+
"id": "mark-static",
|
|
28
|
+
"level": "must",
|
|
29
|
+
"statement": "Use Mark for authored static relevance; do not pass a query or implement search matching inside it."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"id": "mark-native",
|
|
33
|
+
"level": "must",
|
|
34
|
+
"statement": "Preserve the one native mark host and select only the documented variant and tone recipes."
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id": "mark-css",
|
|
38
|
+
"level": "must",
|
|
39
|
+
"statement": "Load styles.css or core.css plus mark.css."
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"commonMistakes": [
|
|
43
|
+
{
|
|
44
|
+
"mistake": "Mapping every search result manually through Mark.",
|
|
45
|
+
"correction": "Use Highlight when Atom-owned matching must segment text."
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
"validation": [
|
|
49
|
+
"Confirm native mark semantics, normal selection and copy, inherited typography, readable contrast, wrapping, forced colors, zoom, RTL, and CSS delivery."
|
|
50
|
+
],
|
|
51
|
+
"related": [
|
|
52
|
+
"em",
|
|
53
|
+
"text",
|
|
54
|
+
"interface-composition"
|
|
55
|
+
]
|
|
56
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Mark agent guide
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Render a semantically marked static passage with restrained theme-aware Brick paint.
|
|
6
|
+
|
|
7
|
+
## Use when
|
|
8
|
+
|
|
9
|
+
- Authored content needs a static marked passage whose relevance is already known.
|
|
10
|
+
|
|
11
|
+
## Choose something else when
|
|
12
|
+
|
|
13
|
+
- Text must be matched from a query. Use Highlight.
|
|
14
|
+
- Text needs stress emphasis. Use Em.
|
|
15
|
+
|
|
16
|
+
## Required composition
|
|
17
|
+
|
|
18
|
+
- Keep Mark inside the surrounding Text, heading, link, or Prose content owner.
|
|
19
|
+
|
|
20
|
+
## Rules
|
|
21
|
+
|
|
22
|
+
- **MUST:** Use Mark for authored static relevance; do not pass a query or implement search matching inside it.
|
|
23
|
+
- **MUST:** Preserve the one native mark host and select only the documented variant and tone recipes.
|
|
24
|
+
- **MUST:** Load styles.css or core.css plus mark.css.
|
|
25
|
+
|
|
26
|
+
## Common mistakes
|
|
27
|
+
|
|
28
|
+
- **Avoid:** Mapping every search result manually through Mark. **Instead:** Use Highlight when Atom-owned matching must segment text.
|
|
29
|
+
|
|
30
|
+
## Validation checklist
|
|
31
|
+
|
|
32
|
+
- Confirm native mark semantics, normal selection and copy, inherited typography, readable contrast, wrapping, forced colors, zoom, RTL, and CSS delivery.
|
|
33
|
+
|
|
34
|
+
## Related guidance
|
|
35
|
+
|
|
36
|
+
- `em`
|
|
37
|
+
- `text`
|
|
38
|
+
- `interface-composition`
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": "flowstack.agent-component.v1",
|
|
3
|
+
"id": "prose",
|
|
4
|
+
"name": "Prose",
|
|
5
|
+
"package": "@flowstack-ui/brick",
|
|
6
|
+
"layer": "brick",
|
|
7
|
+
"kind": "component",
|
|
8
|
+
"purpose": "Apply finished descendant typography, rhythm, and readable measure to trusted React content.",
|
|
9
|
+
"useWhen": [
|
|
10
|
+
"An application, CMS adapter, or Markdown renderer already produced trusted React children that need coherent editorial typography."
|
|
11
|
+
],
|
|
12
|
+
"avoidWhen": [
|
|
13
|
+
{
|
|
14
|
+
"condition": "Content is untrusted or still needs HTML or Markdown parsing.",
|
|
15
|
+
"useInstead": "an application-owned sanitizer and parser before Prose"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"condition": "A small explicit piece of interface copy needs one recipe.",
|
|
19
|
+
"useInstead": "Text"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"condition": "Content needs editing behavior.",
|
|
23
|
+
"useInstead": "a source-installed editor composition"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"composition": [
|
|
27
|
+
"Pass trusted native React descendants to Prose and let the application own document structure, trust, and data loading.",
|
|
28
|
+
"Use direct Brick components when richer anatomy or behavior is needed; their classes intentionally override Prose's low-specificity descendant styles."
|
|
29
|
+
],
|
|
30
|
+
"rules": [
|
|
31
|
+
{
|
|
32
|
+
"id": "prose-trust",
|
|
33
|
+
"level": "must",
|
|
34
|
+
"statement": "Sanitize and parse untrusted external content before it becomes Prose children; Prose never makes raw HTML safe."
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id": "prose-semantics",
|
|
38
|
+
"level": "must",
|
|
39
|
+
"statement": "Keep heading hierarchy, landmark choice, link destinations, table headers, language, and alternative text application-owned."
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": "prose-measure",
|
|
43
|
+
"level": "must",
|
|
44
|
+
"statement": "Use the narrow, default, wide, or none reading measure intentionally rather than adding duplicate width CSS."
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"id": "prose-components",
|
|
48
|
+
"level": "must",
|
|
49
|
+
"statement": "Use direct Link, List, Blockquote, Code Block, Table, or Image components when their richer public contract is required, including accessible preserved horizontal scrolling for source or complex tables."
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"id": "prose-css",
|
|
53
|
+
"level": "must",
|
|
54
|
+
"statement": "Load styles.css or core.css plus prose.css."
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
"commonMistakes": [
|
|
58
|
+
{
|
|
59
|
+
"mistake": "Passing unsanitized HTML through dangerouslySetInnerHTML inside Prose.",
|
|
60
|
+
"correction": "Keep trust and sanitization in the application, then render trusted React children."
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"mistake": "Using Prose as a generic spacing wrapper around interface controls.",
|
|
64
|
+
"correction": "Use Stack and Text for interface composition; reserve Prose for editorial descendants."
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
"validation": [
|
|
68
|
+
"Confirm native descendant semantics and source order remain unchanged.",
|
|
69
|
+
"Confirm size and measure, headings, lists, links, quotes, tables, code, media, dark appearance, forced colors, narrow widths, zoom, text spacing, localization, RTL, SSR, refs, and modular CSS delivery."
|
|
70
|
+
],
|
|
71
|
+
"related": [
|
|
72
|
+
"text",
|
|
73
|
+
"link",
|
|
74
|
+
"list",
|
|
75
|
+
"blockquote",
|
|
76
|
+
"code",
|
|
77
|
+
"code-block",
|
|
78
|
+
"table",
|
|
79
|
+
"image",
|
|
80
|
+
"interface-composition"
|
|
81
|
+
]
|
|
82
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Prose agent guide
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Apply finished descendant typography, rhythm, and readable measure to trusted React content.
|
|
6
|
+
|
|
7
|
+
## Use when
|
|
8
|
+
|
|
9
|
+
- An application, CMS adapter, or Markdown renderer already produced trusted React children that need coherent editorial typography.
|
|
10
|
+
|
|
11
|
+
## Choose something else when
|
|
12
|
+
|
|
13
|
+
- Content is untrusted or still needs HTML or Markdown parsing. Use an application-owned sanitizer and parser before Prose.
|
|
14
|
+
- A small explicit piece of interface copy needs one recipe. Use Text.
|
|
15
|
+
- Content needs editing behavior. Use a source-installed editor composition.
|
|
16
|
+
|
|
17
|
+
## Required composition
|
|
18
|
+
|
|
19
|
+
- Pass trusted native React descendants to Prose and let the application own document structure, trust, and data loading.
|
|
20
|
+
- Use direct Brick components when richer anatomy or behavior is needed; their classes intentionally override Prose's low-specificity descendant styles.
|
|
21
|
+
|
|
22
|
+
## Rules
|
|
23
|
+
|
|
24
|
+
- **MUST:** Sanitize and parse untrusted external content before it becomes Prose children; Prose never makes raw HTML safe.
|
|
25
|
+
- **MUST:** Keep heading hierarchy, landmark choice, link destinations, table headers, language, and alternative text application-owned.
|
|
26
|
+
- **MUST:** Use the narrow, default, wide, or none reading measure intentionally rather than adding duplicate width CSS.
|
|
27
|
+
- **MUST:** Use direct Link, List, Blockquote, Code Block, Table, or Image components when their richer public contract is required, including accessible preserved horizontal scrolling for source or complex tables.
|
|
28
|
+
- **MUST:** Load styles.css or core.css plus prose.css.
|
|
29
|
+
|
|
30
|
+
## Common mistakes
|
|
31
|
+
|
|
32
|
+
- **Avoid:** Passing unsanitized HTML through dangerouslySetInnerHTML inside Prose. **Instead:** Keep trust and sanitization in the application, then render trusted React children.
|
|
33
|
+
- **Avoid:** Using Prose as a generic spacing wrapper around interface controls. **Instead:** Use Stack and Text for interface composition; reserve Prose for editorial descendants.
|
|
34
|
+
|
|
35
|
+
## Validation checklist
|
|
36
|
+
|
|
37
|
+
- Confirm native descendant semantics and source order remain unchanged.
|
|
38
|
+
- Confirm size and measure, headings, lists, links, quotes, tables, code, media, dark appearance, forced colors, narrow widths, zoom, text spacing, localization, RTL, SSR, refs, and modular CSS delivery.
|
|
39
|
+
|
|
40
|
+
## Related guidance
|
|
41
|
+
|
|
42
|
+
- `text`
|
|
43
|
+
- `link`
|
|
44
|
+
- `list`
|
|
45
|
+
- `blockquote`
|
|
46
|
+
- `code`
|
|
47
|
+
- `code-block`
|
|
48
|
+
- `table`
|
|
49
|
+
- `image`
|
|
50
|
+
- `interface-composition`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blockquote.d.ts","sourceRoot":"","sources":["../src/blockquote.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blockquote.js","sourceRoot":"","sources":["../src/blockquote.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type BlockquoteHTMLAttributes, type HTMLAttributes } from "react";
|
|
2
|
+
export type BlockquoteVariant = "accent" | "surface" | "plain";
|
|
3
|
+
export type BlockquoteAlign = "start" | "center" | "end";
|
|
4
|
+
export interface BlockquoteRootProps extends HTMLAttributes<HTMLElement> {
|
|
5
|
+
variant?: BlockquoteVariant;
|
|
6
|
+
align?: BlockquoteAlign;
|
|
7
|
+
"data-slot"?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface BlockquoteIconProps extends HTMLAttributes<HTMLSpanElement> {
|
|
10
|
+
"data-slot"?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface BlockquoteContentProps extends BlockquoteHTMLAttributes<HTMLQuoteElement> {
|
|
13
|
+
"data-slot"?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface BlockquoteCaptionProps extends HTMLAttributes<HTMLElement> {
|
|
16
|
+
"data-slot"?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface BlockquoteCiteProps extends HTMLAttributes<HTMLElement> {
|
|
19
|
+
"data-slot"?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const BlockquoteRoot: import("react").ForwardRefExoticComponent<BlockquoteRootProps & import("react").RefAttributes<HTMLElement>>;
|
|
22
|
+
export declare const BlockquoteIcon: import("react").ForwardRefExoticComponent<BlockquoteIconProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
23
|
+
export declare const BlockquoteContent: import("react").ForwardRefExoticComponent<BlockquoteContentProps & import("react").RefAttributes<HTMLQuoteElement>>;
|
|
24
|
+
export declare const BlockquoteCaption: import("react").ForwardRefExoticComponent<BlockquoteCaptionProps & import("react").RefAttributes<HTMLElement>>;
|
|
25
|
+
export declare const BlockquoteCite: import("react").ForwardRefExoticComponent<BlockquoteCiteProps & import("react").RefAttributes<HTMLElement>>;
|
|
26
|
+
export declare const Blockquote: Readonly<{
|
|
27
|
+
Root: import("react").ForwardRefExoticComponent<BlockquoteRootProps & import("react").RefAttributes<HTMLElement>>;
|
|
28
|
+
Icon: import("react").ForwardRefExoticComponent<BlockquoteIconProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
29
|
+
Content: import("react").ForwardRefExoticComponent<BlockquoteContentProps & import("react").RefAttributes<HTMLQuoteElement>>;
|
|
30
|
+
Caption: import("react").ForwardRefExoticComponent<BlockquoteCaptionProps & import("react").RefAttributes<HTMLElement>>;
|
|
31
|
+
Cite: import("react").ForwardRefExoticComponent<BlockquoteCiteProps & import("react").RefAttributes<HTMLElement>>;
|
|
32
|
+
}>;
|
|
33
|
+
//# sourceMappingURL=Blockquote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Blockquote.d.ts","sourceRoot":"","sources":["../../../src/components/blockquote/Blockquote.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAEf,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAC/D,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEzD,MAAM,WAAW,mBAAoB,SAAQ,cAAc,CAAC,WAAW,CAAC;IACtE,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAoB,SAAQ,cAAc,CAAC,eAAe,CAAC;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,sBAAuB,SAAQ,wBAAwB,CAAC,gBAAgB,CAAC;IACxF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,sBAAuB,SAAQ,cAAc,CAAC,WAAW,CAAC;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAoB,SAAQ,cAAc,CAAC,WAAW,CAAC;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAUD,eAAO,MAAM,cAAc,6GAKzB,CAAC;AAEH,eAAO,MAAM,cAAc,iHAKzB,CAAC;AAEH,eAAO,MAAM,iBAAiB,qHAK5B,CAAC;AAEH,eAAO,MAAM,iBAAiB,gHAK5B,CAAC;AAEH,eAAO,MAAM,cAAc,6GAKzB,CAAC;AAQH,eAAO,MAAM,UAAU;;;;;;EAMrB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, } from "react";
|
|
3
|
+
function mergeClassName(base, className) {
|
|
4
|
+
return className ? `${base} ${className}` : base;
|
|
5
|
+
}
|
|
6
|
+
function slotOrDefault(slot, fallback) {
|
|
7
|
+
return slot ?? fallback;
|
|
8
|
+
}
|
|
9
|
+
export const BlockquoteRoot = forwardRef(function BlockquoteRoot({ align = "start", variant = "accent", className, "data-slot": dataSlot, ...props }, ref) {
|
|
10
|
+
return _jsx("figure", { ...props, className: mergeClassName("brick-blockquote", className), "data-align": align, "data-slot": slotOrDefault(dataSlot, "blockquote"), "data-variant": variant, ref: ref });
|
|
11
|
+
});
|
|
12
|
+
export const BlockquoteIcon = forwardRef(function BlockquoteIcon({ "aria-hidden": ariaHidden = true, children = "“", className, "data-slot": dataSlot, ...props }, ref) {
|
|
13
|
+
return _jsx("span", { ...props, "aria-hidden": ariaHidden, className: mergeClassName("brick-blockquote__icon", className), "data-slot": slotOrDefault(dataSlot, "blockquote-icon"), ref: ref, children: children });
|
|
14
|
+
});
|
|
15
|
+
export const BlockquoteContent = forwardRef(function BlockquoteContent({ className, "data-slot": dataSlot, ...props }, ref) {
|
|
16
|
+
return _jsx("blockquote", { ...props, className: mergeClassName("brick-blockquote__content", className), "data-slot": slotOrDefault(dataSlot, "blockquote-content"), ref: ref });
|
|
17
|
+
});
|
|
18
|
+
export const BlockquoteCaption = forwardRef(function BlockquoteCaption({ className, "data-slot": dataSlot, ...props }, ref) {
|
|
19
|
+
return _jsx("figcaption", { ...props, className: mergeClassName("brick-blockquote__caption", className), "data-slot": slotOrDefault(dataSlot, "blockquote-caption"), ref: ref });
|
|
20
|
+
});
|
|
21
|
+
export const BlockquoteCite = forwardRef(function BlockquoteCite({ className, "data-slot": dataSlot, ...props }, ref) {
|
|
22
|
+
return _jsx("cite", { ...props, className: mergeClassName("brick-blockquote__cite", className), "data-slot": slotOrDefault(dataSlot, "blockquote-cite"), ref: ref });
|
|
23
|
+
});
|
|
24
|
+
BlockquoteRoot.displayName = "Blockquote.Root";
|
|
25
|
+
BlockquoteIcon.displayName = "Blockquote.Icon";
|
|
26
|
+
BlockquoteContent.displayName = "Blockquote.Content";
|
|
27
|
+
BlockquoteCaption.displayName = "Blockquote.Caption";
|
|
28
|
+
BlockquoteCite.displayName = "Blockquote.Cite";
|
|
29
|
+
export const Blockquote = Object.freeze({
|
|
30
|
+
Root: BlockquoteRoot,
|
|
31
|
+
Icon: BlockquoteIcon,
|
|
32
|
+
Content: BlockquoteContent,
|
|
33
|
+
Caption: BlockquoteCaption,
|
|
34
|
+
Cite: BlockquoteCite,
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=Blockquote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Blockquote.js","sourceRoot":"","sources":["../../../src/components/blockquote/Blockquote.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,GAGX,MAAM,OAAO,CAAC;AA2Bf,SAAS,cAAc,CAAC,IAAY,EAAE,SAAkB;IACtD,OAAO,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACnD,CAAC;AAED,SAAS,aAAa,CAAC,IAAwB,EAAE,QAAgB;IAC/D,OAAO,IAAI,IAAI,QAAQ,CAAC;AAC1B,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAmC,SAAS,cAAc,CAChG,EAAE,KAAK,GAAG,OAAO,EAAE,OAAO,GAAG,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EACnF,GAAG;IAEH,OAAO,oBAAY,KAAK,EAAE,SAAS,EAAE,cAAc,CAAC,kBAAkB,EAAE,SAAS,CAAC,gBAAc,KAAK,eAAa,aAAa,CAAC,QAAQ,EAAE,YAAY,CAAC,kBAAgB,OAAO,EAAE,GAAG,EAAE,GAAG,GAAI,CAAC;AAC/L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K,EAAE,EAC9C,GAAG;IAEH,OAAO,kBAAU,KAAK,EAAE,SAAS,EAAE,cAAc,CAAC,wBAAwB,EAAE,SAAS,CAAC,eAAa,aAAa,CAAC,QAAQ,EAAE,iBAAiB,CAAC,EAAE,GAAG,EAAE,GAAG,GAAI,CAAC;AAC9J,CAAC,CAAC,CAAC;AAEH,cAAc,CAAC,WAAW,GAAG,iBAAiB,CAAC;AAC/C,cAAc,CAAC,WAAW,GAAG,iBAAiB,CAAC;AAC/C,iBAAiB,CAAC,WAAW,GAAG,oBAAoB,CAAC;AACrD,iBAAiB,CAAC,WAAW,GAAG,oBAAoB,CAAC;AACrD,cAAc,CAAC,WAAW,GAAG,iBAAiB,CAAC;AAE/C,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;IACtC,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,iBAAiB;IAC1B,OAAO,EAAE,iBAAiB;IAC1B,IAAI,EAAE,cAAc;CACrB,CAAC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { Blockquote, BlockquoteCaption, BlockquoteCite, BlockquoteContent, BlockquoteIcon, BlockquoteRoot, type BlockquoteAlign, type BlockquoteCaptionProps, type BlockquoteCiteProps, type BlockquoteContentProps, type BlockquoteIconProps, type BlockquoteRootProps, type BlockquoteVariant, } from "./Blockquote.js";
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/blockquote/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,GACvB,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/blockquote/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,cAAc,GAQf,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import { type ClipboardIndicatorProps as AtomClipboardIndicatorProps, type ClipboardRootProps as AtomClipboardRootProps, type ClipboardStatusProps as AtomClipboardStatusProps, type ClipboardTriggerProps as AtomClipboardTriggerProps } from "@flowstack-ui/atom/clipboard";
|
|
2
2
|
import { type HTMLAttributes, type ReactNode } from "react";
|
|
3
3
|
import { type ButtonProps } from "../button/index.js";
|
|
4
|
+
import { type CollapsibleContentProps, type CollapsibleRootProps, type CollapsibleTriggerProps } from "../collapsible/index.js";
|
|
4
5
|
export type CodeBlockVariant = "subtle" | "bordered" | "plain";
|
|
5
6
|
export type CodeBlockSize = "sm" | "md";
|
|
6
7
|
export type CodeBlockWrap = "scroll" | "wrap";
|
|
8
|
+
export type CodeBlockLineChange = "added" | "removed";
|
|
9
|
+
export interface CodeBlockAdapterContext {
|
|
10
|
+
value: string;
|
|
11
|
+
language?: string;
|
|
12
|
+
}
|
|
13
|
+
export type CodeBlockAdapter = (context: CodeBlockAdapterContext) => ReactNode;
|
|
7
14
|
export interface CodeBlockRootProps extends Omit<AtomClipboardRootProps, "dangerouslySetInnerHTML" | "defaultValue" | "value"> {
|
|
8
15
|
value: string;
|
|
9
16
|
language?: string;
|
|
17
|
+
adapter?: CodeBlockAdapter;
|
|
10
18
|
variant?: CodeBlockVariant;
|
|
11
19
|
size?: CodeBlockSize;
|
|
12
20
|
}
|
|
@@ -23,7 +31,18 @@ export interface CodeBlockContentProps extends Omit<SlottedProps<HTMLAttributes<
|
|
|
23
31
|
children?: ReactNode;
|
|
24
32
|
wrap?: CodeBlockWrap;
|
|
25
33
|
focusable?: boolean;
|
|
34
|
+
maxLines?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface CodeBlockLineProps extends Omit<SlottedProps<HTMLAttributes<HTMLSpanElement>>, "dangerouslySetInnerHTML"> {
|
|
37
|
+
lineNumber?: number;
|
|
38
|
+
highlighted?: boolean;
|
|
39
|
+
focused?: boolean;
|
|
40
|
+
change?: CodeBlockLineChange;
|
|
26
41
|
}
|
|
42
|
+
export type CodeBlockCollapseProps = Omit<CollapsibleRootProps, "variant">;
|
|
43
|
+
export type CodeBlockCollapsePreviewProps = SlottedProps<HTMLAttributes<HTMLDivElement>>;
|
|
44
|
+
export type CodeBlockCollapseContentProps = CollapsibleContentProps;
|
|
45
|
+
export type CodeBlockCollapseTriggerProps = Omit<CollapsibleTriggerProps, "asChild" | "render">;
|
|
27
46
|
export type CodeBlockCopyTriggerProps = Omit<AtomClipboardTriggerProps, "asChild" | "render"> & Pick<ButtonProps, "variant" | "tone" | "size" | "shape" | "startIcon" | "endIcon">;
|
|
28
47
|
export type CodeBlockCopyIndicatorProps = AtomClipboardIndicatorProps;
|
|
29
48
|
export type CodeBlockCopyStatusProps = AtomClipboardStatusProps;
|
|
@@ -39,6 +58,13 @@ export declare const CodeBlockActions: import("react").ForwardRefExoticComponent
|
|
|
39
58
|
"data-slot"?: string;
|
|
40
59
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
41
60
|
export declare const CodeBlockContent: import("react").ForwardRefExoticComponent<CodeBlockContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
61
|
+
export declare const CodeBlockLine: import("react").ForwardRefExoticComponent<CodeBlockLineProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
62
|
+
export declare const CodeBlockCollapse: import("react").ForwardRefExoticComponent<CodeBlockCollapseProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
63
|
+
export declare const CodeBlockCollapsePreview: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
64
|
+
"data-slot"?: string;
|
|
65
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
66
|
+
export declare const CodeBlockCollapseContent: import("react").ForwardRefExoticComponent<import("@flowstack-ui/atom").CollapsibleContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
67
|
+
export declare const CodeBlockCollapseTrigger: import("react").ForwardRefExoticComponent<CodeBlockCollapseTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
42
68
|
export declare const CodeBlockCopyTrigger: import("react").ForwardRefExoticComponent<Omit<AtomClipboardTriggerProps, "render" | "asChild"> & Pick<ButtonProps, "variant" | "size" | "tone" | "shape" | "startIcon" | "endIcon"> & import("react").RefAttributes<HTMLElement>>;
|
|
43
69
|
export declare const CodeBlockCopyIndicator: import("react").ForwardRefExoticComponent<AtomClipboardIndicatorProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
44
70
|
export declare const CodeBlockCopyStatus: import("react").ForwardRefExoticComponent<AtomClipboardStatusProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
@@ -55,6 +81,13 @@ export declare const CodeBlock: Readonly<{
|
|
|
55
81
|
"data-slot"?: string;
|
|
56
82
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
57
83
|
Content: import("react").ForwardRefExoticComponent<CodeBlockContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
84
|
+
Line: import("react").ForwardRefExoticComponent<CodeBlockLineProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
85
|
+
Collapse: import("react").ForwardRefExoticComponent<CodeBlockCollapseProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
86
|
+
CollapsePreview: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
87
|
+
"data-slot"?: string;
|
|
88
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
89
|
+
CollapseContent: import("react").ForwardRefExoticComponent<import("@flowstack-ui/atom").CollapsibleContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
90
|
+
CollapseTrigger: import("react").ForwardRefExoticComponent<CodeBlockCollapseTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
58
91
|
CopyTrigger: import("react").ForwardRefExoticComponent<Omit<AtomClipboardTriggerProps, "render" | "asChild"> & Pick<ButtonProps, "variant" | "size" | "tone" | "shape" | "startIcon" | "endIcon"> & import("react").RefAttributes<HTMLElement>>;
|
|
59
92
|
CopyIndicator: import("react").ForwardRefExoticComponent<AtomClipboardIndicatorProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
60
93
|
CopyStatus: import("react").ForwardRefExoticComponent<AtomClipboardStatusProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlock.d.ts","sourceRoot":"","sources":["../../../src/components/code-block/CodeBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,uBAAuB,IAAI,2BAA2B,EAC3D,KAAK,kBAAkB,IAAI,sBAAsB,EACjD,KAAK,oBAAoB,IAAI,wBAAwB,EACrD,KAAK,qBAAqB,IAAI,yBAAyB,EACxD,MAAM,8BAA8B,CAAC;AACtC,OAAO,
|
|
1
|
+
{"version":3,"file":"CodeBlock.d.ts","sourceRoot":"","sources":["../../../src/components/code-block/CodeBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,uBAAuB,IAAI,2BAA2B,EAC3D,KAAK,kBAAkB,IAAI,sBAAsB,EACjD,KAAK,oBAAoB,IAAI,wBAAwB,EACrD,KAAK,qBAAqB,IAAI,yBAAyB,EACxD,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC7B,MAAM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K7B,CAAC;AAEF,eAAO,MAAM,gBAAgB;kBAtHc,MAAM;kDA0HhD,CAAC;AAEF,eAAO,MAAM,gBAAgB,kHA6C5B,CAAC;AAEF,eAAO,MAAM,aAAa,gHAmCzB,CAAC;AAEF,eAAO,MAAM,iBAAiB,mHAY7B,CAAC;AAEF,eAAO,MAAM,wBAAwB;kBA9NM,MAAM;kDAyOhD,CAAC;AAEF,eAAO,MAAM,wBAAwB,iJAepC,CAAC;AAEF,eAAO,MAAM,wBAAwB,6HAWpC,CAAC;AAEF,eAAO,MAAM,oBAAoB,oOAahC,CAAC;AAEF,eAAO,MAAM,sBAAsB,yHAIlC,CAAC;AAEF,eAAO,MAAM,mBAAmB,sHAI/B,CAAC;AAiBF,eAAO,MAAM,SAAS;;;sBAnTqB,MAAM;;;sBAAN,MAAM;;;;sBAAN,MAAM;;;;;;sBAAN,MAAM;;;;;;;EAkU/C,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { Clipboard as AtomClipboard, } from "@flowstack-ui/atom/clipboard";
|
|
|
3
3
|
import { forwardRef, useMemo, } from "react";
|
|
4
4
|
import { Button } from "../button/index.js";
|
|
5
5
|
import { Code } from "../code/index.js";
|
|
6
|
+
import { Collapsible, } from "../collapsible/index.js";
|
|
6
7
|
import { ScrollArea } from "../scroll-area/index.js";
|
|
7
8
|
import { CodeBlockContext, useCodeBlockContext } from "./context.js";
|
|
8
9
|
function classes(base, className) {
|
|
@@ -11,14 +12,30 @@ function classes(base, className) {
|
|
|
11
12
|
function slot(value, fallback) {
|
|
12
13
|
return value ?? fallback;
|
|
13
14
|
}
|
|
15
|
+
function withoutInjectedHtml(props) {
|
|
16
|
+
const { dangerouslySetInnerHTML: _blockedHtml, ...safeProps } = props;
|
|
17
|
+
return safeProps;
|
|
18
|
+
}
|
|
14
19
|
function languageClass(language) {
|
|
15
20
|
return language && /^[A-Za-z0-9_+-]+$/.test(language)
|
|
16
21
|
? `language-${language.toLowerCase()}`
|
|
17
22
|
: undefined;
|
|
18
23
|
}
|
|
19
|
-
export const CodeBlockRoot = forwardRef(function CodeBlockRoot({ value, language, variant = "subtle", size = "md", className, children, "data-slot": dataSlot, ...props }, ref) {
|
|
20
|
-
const
|
|
21
|
-
|
|
24
|
+
export const CodeBlockRoot = forwardRef(function CodeBlockRoot({ value, language, adapter, variant = "subtle", size = "md", className, children, "data-slot": dataSlot, ...props }, ref) {
|
|
25
|
+
const safeProps = withoutInjectedHtml(props);
|
|
26
|
+
const getAdaptedContent = useMemo(() => {
|
|
27
|
+
let resolved = false;
|
|
28
|
+
let adaptedContent;
|
|
29
|
+
return () => {
|
|
30
|
+
if (!resolved) {
|
|
31
|
+
adaptedContent = adapter?.({ value, language });
|
|
32
|
+
resolved = true;
|
|
33
|
+
}
|
|
34
|
+
return adaptedContent;
|
|
35
|
+
};
|
|
36
|
+
}, [adapter, language, value]);
|
|
37
|
+
const context = useMemo(() => ({ value, language, getAdaptedContent, variant, size }), [getAdaptedContent, language, size, value, variant]);
|
|
38
|
+
return (_jsx(CodeBlockContext.Provider, { value: context, children: _jsx(AtomClipboard.Root, { ...safeProps, className: classes("brick-code-block", className), "data-language": language, "data-size": size, "data-slot": slot(dataSlot, "code-block"), "data-variant": variant, ref: ref, value: value, children: children }) }));
|
|
22
39
|
});
|
|
23
40
|
export const CodeBlockHeader = forwardRef(function CodeBlockHeader({ className, "data-slot": dataSlot, ...props }, ref) {
|
|
24
41
|
return _jsx("div", { ...props, className: classes("brick-code-block-header", className), "data-slot": slot(dataSlot, "code-block-header"), ref: ref });
|
|
@@ -33,10 +50,37 @@ export const CodeBlockLanguage = forwardRef(function CodeBlockLanguage({ classNa
|
|
|
33
50
|
export const CodeBlockActions = forwardRef(function CodeBlockActions({ className, "data-slot": dataSlot, ...props }, ref) {
|
|
34
51
|
return _jsx("div", { ...props, className: classes("brick-code-block-actions", className), "data-slot": slot(dataSlot, "code-block-actions"), ref: ref });
|
|
35
52
|
});
|
|
36
|
-
export const CodeBlockContent = forwardRef(function CodeBlockContent({ className, children, wrap = "scroll", focusable = true, dir = "ltr", "data-slot": dataSlot, ...props }, ref) {
|
|
37
|
-
const
|
|
53
|
+
export const CodeBlockContent = forwardRef(function CodeBlockContent({ className, children, wrap = "scroll", focusable = true, maxLines, dir = "ltr", style, "data-slot": dataSlot, ...props }, ref) {
|
|
54
|
+
const safeProps = withoutInjectedHtml(props);
|
|
55
|
+
const { value, language, getAdaptedContent, size } = useCodeBlockContext();
|
|
38
56
|
const syntaxClass = languageClass(language);
|
|
39
|
-
|
|
57
|
+
const boundedLines = Number.isInteger(maxLines) && Number(maxLines) > 0
|
|
58
|
+
? Number(maxLines)
|
|
59
|
+
: undefined;
|
|
60
|
+
const content = children ?? getAdaptedContent() ?? value;
|
|
61
|
+
const contentStyle = boundedLines
|
|
62
|
+
? { ...style, "--brick-code-block-max-block-size": `${boundedLines}lh` }
|
|
63
|
+
: style;
|
|
64
|
+
return (_jsx(ScrollArea.Root, { className: "brick-code-block-scroll-area", orientation: "horizontal", scrollbarVisibility: "interaction", children: _jsx(ScrollArea.Viewport, { ...safeProps, className: classes("brick-code-block-content", className), "data-language": language, "data-max-lines": boundedLines, "data-slot": slot(dataSlot, "code-block-content"), "data-wrap": wrap, dir: dir, focusable: focusable, ref: ref, style: contentStyle, children: _jsx("pre", { className: "brick-code-block-pre", "data-slot": "code-block-pre", children: _jsx(Code, { className: syntaxClass, "data-language": language, size: size, slot: "code-block-code", tone: "inherit", variant: "plain", children: content }) }) }) }));
|
|
65
|
+
});
|
|
66
|
+
export const CodeBlockLine = forwardRef(function CodeBlockLine({ change, children, className, focused = false, highlighted = false, lineNumber, "data-slot": dataSlot, ...props }, ref) {
|
|
67
|
+
const safeProps = withoutInjectedHtml(props);
|
|
68
|
+
const visibleLineNumber = Number.isInteger(lineNumber) && Number(lineNumber) > 0
|
|
69
|
+
? Number(lineNumber)
|
|
70
|
+
: undefined;
|
|
71
|
+
return (_jsx("span", { ...safeProps, className: classes("brick-code-block-line", className), "data-change": change, "data-focused": focused ? "" : undefined, "data-highlighted": highlighted ? "" : undefined, "data-line-number": visibleLineNumber, "data-slot": slot(dataSlot, "code-block-line"), ref: ref, children: _jsx("span", { className: "brick-code-block-line-content", "data-slot": "code-block-line-content", children: children }) }));
|
|
72
|
+
});
|
|
73
|
+
export const CodeBlockCollapse = forwardRef(function CodeBlockCollapse({ className, "data-slot": dataSlot, ...props }, ref) {
|
|
74
|
+
return (_jsx(Collapsible.Root, { ...props, className: classes("brick-code-block-collapse", className), "data-slot": slot(dataSlot, "code-block-collapse"), ref: ref, variant: "plain" }));
|
|
75
|
+
});
|
|
76
|
+
export const CodeBlockCollapsePreview = forwardRef(function CodeBlockCollapsePreview({ className, "data-slot": dataSlot, ...props }, ref) {
|
|
77
|
+
return (_jsx("div", { ...props, className: classes("brick-code-block-collapse-preview", className), "data-slot": slot(dataSlot, "code-block-collapse-preview"), ref: ref }));
|
|
78
|
+
});
|
|
79
|
+
export const CodeBlockCollapseContent = forwardRef(function CodeBlockCollapseContent({ children, className, "data-slot": dataSlot, ...props }, ref) {
|
|
80
|
+
return (_jsx(Collapsible.Content, { ...props, className: classes("brick-code-block-collapse-content", className), "data-slot": slot(dataSlot, "code-block-collapse-content"), ref: ref, children: _jsx(Collapsible.ContentInner, { className: "brick-code-block-collapse-content-inner", children: children }) }));
|
|
81
|
+
});
|
|
82
|
+
export const CodeBlockCollapseTrigger = forwardRef(function CodeBlockCollapseTrigger({ className, "data-slot": dataSlot, ...props }, ref) {
|
|
83
|
+
return (_jsx(Collapsible.Trigger, { ...props, className: classes("brick-code-block-collapse-trigger", className), "data-slot": slot(dataSlot, "code-block-collapse-trigger"), ref: ref }));
|
|
40
84
|
});
|
|
41
85
|
export const CodeBlockCopyTrigger = forwardRef(function CodeBlockCopyTrigger({ variant = "ghost", tone = "neutral", size = "sm", shape = "rounded", startIcon, endIcon, children, "data-slot": dataSlot, ...props }, ref) {
|
|
42
86
|
return (_jsx(AtomClipboard.Trigger, { ...props, asChild: true, "data-slot": slot(dataSlot, "code-block-copy-trigger"), ref: ref, children: _jsx(Button, { "data-slot": slot(dataSlot, "code-block-copy-trigger"), variant: variant, tone: tone, size: size, shape: shape, startIcon: startIcon, endIcon: endIcon, children: children }) }));
|
|
@@ -53,6 +97,11 @@ CodeBlockTitle.displayName = "CodeBlock.Title";
|
|
|
53
97
|
CodeBlockLanguage.displayName = "CodeBlock.Language";
|
|
54
98
|
CodeBlockActions.displayName = "CodeBlock.Actions";
|
|
55
99
|
CodeBlockContent.displayName = "CodeBlock.Content";
|
|
100
|
+
CodeBlockLine.displayName = "CodeBlock.Line";
|
|
101
|
+
CodeBlockCollapse.displayName = "CodeBlock.Collapse";
|
|
102
|
+
CodeBlockCollapsePreview.displayName = "CodeBlock.CollapsePreview";
|
|
103
|
+
CodeBlockCollapseContent.displayName = "CodeBlock.CollapseContent";
|
|
104
|
+
CodeBlockCollapseTrigger.displayName = "CodeBlock.CollapseTrigger";
|
|
56
105
|
CodeBlockCopyTrigger.displayName = "CodeBlock.CopyTrigger";
|
|
57
106
|
CodeBlockCopyIndicator.displayName = "CodeBlock.CopyIndicator";
|
|
58
107
|
CodeBlockCopyStatus.displayName = "CodeBlock.CopyStatus";
|
|
@@ -63,6 +112,11 @@ export const CodeBlock = Object.freeze({
|
|
|
63
112
|
Language: CodeBlockLanguage,
|
|
64
113
|
Actions: CodeBlockActions,
|
|
65
114
|
Content: CodeBlockContent,
|
|
115
|
+
Line: CodeBlockLine,
|
|
116
|
+
Collapse: CodeBlockCollapse,
|
|
117
|
+
CollapsePreview: CodeBlockCollapsePreview,
|
|
118
|
+
CollapseContent: CodeBlockCollapseContent,
|
|
119
|
+
CollapseTrigger: CodeBlockCollapseTrigger,
|
|
66
120
|
CopyTrigger: CodeBlockCopyTrigger,
|
|
67
121
|
CopyIndicator: CodeBlockCopyIndicator,
|
|
68
122
|
CopyStatus: CodeBlockCopyStatus,
|