@brett_lamy/docstream 1.1.1 → 1.2.1
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 +147 -9
- package/package.json +3 -1
- package/src/demo/DemoViewer.tsx +213 -46
- package/src/demo/context.ts +17 -1
- package/src/demo/glob.ts +12 -4
- package/src/demo/index.ts +15 -5
- package/src/demo/markdown.ts +138 -41
- package/src/demo/types.ts +46 -2
- package/src/docs/DocsRenderer.tsx +147 -34
- package/src/docs/PageActions.tsx +9 -5
- package/src/docs/controls.tsx +4 -1
- package/src/gitbook/ast.ts +63 -4
- package/src/gitbook/flatten.ts +47 -0
- package/src/gitbook/index.ts +6 -2
- package/src/gitbook/inline.ts +49 -19
- package/src/gitbook/outline.ts +45 -0
- package/src/gitbook/package-managers.ts +98 -0
- package/src/gitbook/parse.ts +179 -8
- package/src/gitbook/serialize.ts +40 -4
- package/src/index.ts +23 -1
- package/src/playground/InlineDemoPreview.tsx +77 -0
- package/src/playground/PlaygroundStreamdown.tsx +12 -2
- package/src/playground/ReactCodePreview.tsx +67 -36
- package/src/playground/filesystem.ts +83 -1
- package/src/playground/index.ts +7 -2
- package/src/streamdown.tsx +6 -2
- package/src/styles.css +117 -8
package/src/styles.css
CHANGED
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
--gb-pill-shadow: 0 1px 2px rgba(15, 15, 35, 0.14), 0 0 0 0.5px rgba(15, 15, 35, 0.1);
|
|
25
25
|
--gb-hover: rgba(128, 128, 128, 0.12);
|
|
26
26
|
--gb-menu-shadow: 0 14px 34px -10px rgba(15, 15, 35, 0.28), 0 2px 6px rgba(15, 15, 35, 0.08);
|
|
27
|
+
/* The terminal glyph in command boxes. Its own tokens (not --gb-panel-foreground), so a host
|
|
28
|
+
that sets panel colors to currentColor still gets a visible glyph. */
|
|
29
|
+
--gb-term-bg: rgba(128, 128, 128, 0.2);
|
|
30
|
+
--gb-term-fg: var(--gb-muted-foreground);
|
|
27
31
|
|
|
28
32
|
/* Semantic hint palette — solid color plus precomputed tints. Matches the
|
|
29
33
|
editor palette in @brett_lamy/docstream-editor/styles.css. */
|
|
@@ -148,6 +152,10 @@
|
|
|
148
152
|
margin-block: 0.75em;
|
|
149
153
|
}
|
|
150
154
|
|
|
155
|
+
:is([data-docstream], .docs-article) [data-docstream-blocks] > .docs-tabs-section {
|
|
156
|
+
margin-block: 1.6em 0.9em;
|
|
157
|
+
}
|
|
158
|
+
|
|
151
159
|
:is([data-docstream], .docs-article) a {
|
|
152
160
|
color: var(--gb-primary);
|
|
153
161
|
text-decoration: underline;
|
|
@@ -1370,13 +1378,14 @@
|
|
|
1370
1378
|
margin: -3px 0;
|
|
1371
1379
|
}
|
|
1372
1380
|
|
|
1381
|
+
/* Untitled code blocks: no header bar, just the code and a copy button in its top-right corner. */
|
|
1373
1382
|
.docs-code-copy-float {
|
|
1374
1383
|
position: absolute;
|
|
1375
|
-
top:
|
|
1376
|
-
right:
|
|
1384
|
+
top: 9px;
|
|
1385
|
+
right: 9px;
|
|
1377
1386
|
z-index: 1;
|
|
1378
|
-
background:
|
|
1379
|
-
opacity: 0;
|
|
1387
|
+
background: transparent;
|
|
1388
|
+
opacity: 0.75;
|
|
1380
1389
|
}
|
|
1381
1390
|
|
|
1382
1391
|
.docs-code:hover .docs-code-copy-float,
|
|
@@ -1506,9 +1515,45 @@
|
|
|
1506
1515
|
width: 20px;
|
|
1507
1516
|
height: 20px;
|
|
1508
1517
|
border-radius: 5px;
|
|
1509
|
-
background: var(--gb-
|
|
1510
|
-
color: var(--gb-
|
|
1511
|
-
|
|
1518
|
+
background: var(--gb-term-bg, rgba(128, 128, 128, 0.2));
|
|
1519
|
+
color: var(--gb-term-fg, #71717a);
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
/* ---- Titled tabs (`{% tabs title="Installation" %}`): heading + pill switch, then the tab ---- */
|
|
1523
|
+
|
|
1524
|
+
.docs-tabs-section-head {
|
|
1525
|
+
display: flex;
|
|
1526
|
+
flex-wrap: wrap;
|
|
1527
|
+
align-items: center;
|
|
1528
|
+
justify-content: space-between;
|
|
1529
|
+
gap: 12px;
|
|
1530
|
+
margin-bottom: 12px;
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
:is([data-docstream], .docs-article) .docs-tabs-section-head .docs-tabs-section-title {
|
|
1534
|
+
margin: 0;
|
|
1535
|
+
padding-bottom: 0;
|
|
1536
|
+
border-bottom: 0;
|
|
1537
|
+
scroll-margin-top: 80px;
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
.docs-tabs-section-body {
|
|
1541
|
+
display: flex;
|
|
1542
|
+
flex-direction: column;
|
|
1543
|
+
gap: 10px;
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
.docs-tabs-section-body > [data-docstream-blocks] > * {
|
|
1547
|
+
margin-block: 0 10px;
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
.docs-tabs-section-body > [data-docstream-blocks] > :last-child {
|
|
1551
|
+
margin-bottom: 0;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
.docs-tabs-section-body > [data-docstream-blocks] > p {
|
|
1555
|
+
color: var(--gb-muted-foreground);
|
|
1556
|
+
font-size: 0.93em;
|
|
1512
1557
|
}
|
|
1513
1558
|
|
|
1514
1559
|
.docs-tabs-code-title {
|
|
@@ -1900,9 +1945,12 @@
|
|
|
1900
1945
|
opacity: 1;
|
|
1901
1946
|
}
|
|
1902
1947
|
|
|
1948
|
+
/* Block-level demo roots fill the width (place-items: center would shrink them to their
|
|
1949
|
+
content); content is centred vertically, and intrinsically sized roots horizontally. */
|
|
1903
1950
|
.docs-demo-canvas {
|
|
1904
1951
|
display: grid;
|
|
1905
|
-
|
|
1952
|
+
align-content: center;
|
|
1953
|
+
justify-items: stretch;
|
|
1906
1954
|
box-sizing: border-box;
|
|
1907
1955
|
min-height: 100%;
|
|
1908
1956
|
padding: 28px 24px;
|
|
@@ -1910,9 +1958,14 @@
|
|
|
1910
1958
|
}
|
|
1911
1959
|
|
|
1912
1960
|
.docs-demo-canvas > * {
|
|
1961
|
+
min-width: 0;
|
|
1913
1962
|
max-width: 100%;
|
|
1914
1963
|
}
|
|
1915
1964
|
|
|
1965
|
+
.docs-demo-canvas > :where(button, a, img, svg, video, canvas, input, select, textarea, label, span, code) {
|
|
1966
|
+
justify-self: center;
|
|
1967
|
+
}
|
|
1968
|
+
|
|
1916
1969
|
.docs-demo-canvas-bleed {
|
|
1917
1970
|
display: block;
|
|
1918
1971
|
place-items: normal;
|
|
@@ -1924,6 +1977,45 @@
|
|
|
1924
1977
|
max-width: none;
|
|
1925
1978
|
}
|
|
1926
1979
|
|
|
1980
|
+
/* Inline-file demos: the runtime's iframe fills the frame. */
|
|
1981
|
+
.docs-demo-canvas-runtime {
|
|
1982
|
+
display: flex;
|
|
1983
|
+
flex-direction: column;
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
.docs-demo-canvas-runtime > * {
|
|
1987
|
+
flex: 1 1 auto;
|
|
1988
|
+
min-height: 0;
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
.docs-demo-runtime-frame {
|
|
1992
|
+
display: block;
|
|
1993
|
+
width: 100%;
|
|
1994
|
+
height: 100%;
|
|
1995
|
+
min-height: 120px;
|
|
1996
|
+
border: 0;
|
|
1997
|
+
background: #fff;
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
.docs-demo-runtime-status {
|
|
2001
|
+
display: grid;
|
|
2002
|
+
place-items: center;
|
|
2003
|
+
height: 100%;
|
|
2004
|
+
min-height: 120px;
|
|
2005
|
+
color: var(--gb-muted-foreground);
|
|
2006
|
+
font-size: 12.5px;
|
|
2007
|
+
}
|
|
2008
|
+
|
|
2009
|
+
/* No runtime for an inline-file demo (or still streaming): a one-line note, then the code. */
|
|
2010
|
+
.docs-demo-note {
|
|
2011
|
+
margin: 0;
|
|
2012
|
+
padding: 8px 14px;
|
|
2013
|
+
border-bottom: 1px solid var(--gb-border);
|
|
2014
|
+
color: var(--gb-muted-foreground);
|
|
2015
|
+
font-size: 12.5px;
|
|
2016
|
+
line-height: 1.5;
|
|
2017
|
+
}
|
|
2018
|
+
|
|
1927
2019
|
.docs-demo-loading {
|
|
1928
2020
|
display: grid;
|
|
1929
2021
|
place-items: center;
|
|
@@ -2150,10 +2242,27 @@
|
|
|
2150
2242
|
}
|
|
2151
2243
|
|
|
2152
2244
|
.docs-demo-single-preview {
|
|
2245
|
+
display: grid;
|
|
2153
2246
|
min-height: 120px;
|
|
2154
2247
|
background: var(--background, var(--gb-panel));
|
|
2155
2248
|
}
|
|
2156
2249
|
|
|
2250
|
+
.docs-demo-status {
|
|
2251
|
+
flex-shrink: 0;
|
|
2252
|
+
padding: 3px 8px;
|
|
2253
|
+
border-radius: 999px;
|
|
2254
|
+
background: var(--gb-pill-track);
|
|
2255
|
+
color: var(--gb-muted-foreground);
|
|
2256
|
+
font-size: 11.5px;
|
|
2257
|
+
font-weight: 600;
|
|
2258
|
+
line-height: 1.2;
|
|
2259
|
+
white-space: nowrap;
|
|
2260
|
+
}
|
|
2261
|
+
|
|
2262
|
+
.docs-demo-variants-sized .docs-pill {
|
|
2263
|
+
flex: 1 1 0;
|
|
2264
|
+
}
|
|
2265
|
+
|
|
2157
2266
|
/* Fullscreen overlay + deep link */
|
|
2158
2267
|
|
|
2159
2268
|
.docs-demo-dialog {
|