@astryxdesign/cli 0.7.7-canary.ab90555 → 0.7.7-canary.bf14580
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.
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
|
|
4
|
+
export const doc = {
|
|
5
|
+
type: 'block',
|
|
6
|
+
exampleFor: 'useOutlineFromMarkdown',
|
|
7
|
+
name: 'useOutlineFromMarkdown — Docs Article',
|
|
8
|
+
displayName: 'useOutlineFromMarkdown — Docs Article',
|
|
9
|
+
description:
|
|
10
|
+
'A docs-style article with an Outline next to it, built from the same Markdown string through useOutlineFromMarkdown. "Add section" appends a heading to the string, and a new entry that links to it appears in the outline.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
aspectRatio: 16 / 9,
|
|
13
|
+
componentsUsed: ['Markdown', 'Outline', 'ScrollableArea', 'Button', 'Layout'],
|
|
14
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {useRef, useState} from 'react';
|
|
6
|
+
import {Button} from '@astryxdesign/core/Button';
|
|
7
|
+
import {HStack, VStack} from '@astryxdesign/core/Layout';
|
|
8
|
+
import {Markdown} from '@astryxdesign/core/Markdown';
|
|
9
|
+
import {Outline, useOutlineFromMarkdown} from '@astryxdesign/core/Outline';
|
|
10
|
+
import {ScrollableArea} from '@astryxdesign/core/ScrollableArea';
|
|
11
|
+
|
|
12
|
+
const ARTICLE = `## Before you start
|
|
13
|
+
|
|
14
|
+
Check that your project builds on the current release. Commit your work, so
|
|
15
|
+
that you can compare the result of the upgrade.
|
|
16
|
+
|
|
17
|
+
## Run the upgrade
|
|
18
|
+
|
|
19
|
+
Update the packages, then rebuild the project. The upgrade changes no source
|
|
20
|
+
files.
|
|
21
|
+
|
|
22
|
+
### Update the packages
|
|
23
|
+
|
|
24
|
+
Install the new version of every package at the same time. Mixed versions fail
|
|
25
|
+
the build.
|
|
26
|
+
|
|
27
|
+
### Rebuild the project
|
|
28
|
+
|
|
29
|
+
Delete the build output first. A stale cache can hide a real error.
|
|
30
|
+
|
|
31
|
+
## Check the result
|
|
32
|
+
|
|
33
|
+
Open the pages that you use most, and compare them with the earlier build.
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
const NEW_SECTION = `
|
|
37
|
+
## New section
|
|
38
|
+
|
|
39
|
+
The button added this heading to the Markdown string.
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
export default function UseOutlineFromMarkdownHookUsage() {
|
|
43
|
+
const [markdown, setMarkdown] = useState(ARTICLE);
|
|
44
|
+
const items = useOutlineFromMarkdown(markdown);
|
|
45
|
+
const articleRef = useRef<HTMLDivElement>(null);
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<HStack gap={6} align="start" width="100%">
|
|
49
|
+
<ScrollableArea
|
|
50
|
+
ref={articleRef}
|
|
51
|
+
label="Article"
|
|
52
|
+
height={320}
|
|
53
|
+
width="100%">
|
|
54
|
+
<Markdown>{markdown}</Markdown>
|
|
55
|
+
</ScrollableArea>
|
|
56
|
+
<VStack gap={3} align="start" width={220}>
|
|
57
|
+
{/* A non-zero offset moves only the article. With 0, a click also moves
|
|
58
|
+
the page around the article. */}
|
|
59
|
+
<Outline items={items} scrollContainerRef={articleRef} offset={8} />
|
|
60
|
+
<Button
|
|
61
|
+
label="Add section"
|
|
62
|
+
variant="secondary"
|
|
63
|
+
size="sm"
|
|
64
|
+
onClick={() => setMarkdown(current => current + NEW_SECTION)}
|
|
65
|
+
/>
|
|
66
|
+
</VStack>
|
|
67
|
+
</HStack>
|
|
68
|
+
);
|
|
69
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.7.7-canary.
|
|
3
|
+
"version": "0.7.7-canary.bf14580",
|
|
4
4
|
"displayName": "CLI",
|
|
5
5
|
"description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -124,10 +124,10 @@
|
|
|
124
124
|
"zod": "^4.4.3"
|
|
125
125
|
},
|
|
126
126
|
"peerDependencies": {
|
|
127
|
-
"@astryxdesign/charts": "0.7.7-canary.
|
|
128
|
-
"@astryxdesign/core": "0.7.7-canary.
|
|
129
|
-
"@astryxdesign/lab": "0.7.7-canary.
|
|
130
|
-
"@astryxdesign/theme-neutral": "0.7.7-canary.
|
|
127
|
+
"@astryxdesign/charts": "0.7.7-canary.bf14580",
|
|
128
|
+
"@astryxdesign/core": "0.7.7-canary.bf14580",
|
|
129
|
+
"@astryxdesign/lab": "0.7.7-canary.bf14580",
|
|
130
|
+
"@astryxdesign/theme-neutral": "0.7.7-canary.bf14580"
|
|
131
131
|
},
|
|
132
132
|
"peerDependenciesMeta": {
|
|
133
133
|
"@astryxdesign/charts": {
|
|
@@ -144,10 +144,10 @@
|
|
|
144
144
|
}
|
|
145
145
|
},
|
|
146
146
|
"devDependencies": {
|
|
147
|
-
"@astryxdesign/charts": "0.7.7-canary.
|
|
148
|
-
"@astryxdesign/core": "0.7.7-canary.
|
|
149
|
-
"@astryxdesign/lab": "0.7.7-canary.
|
|
150
|
-
"@astryxdesign/theme-neutral": "0.7.7-canary.
|
|
147
|
+
"@astryxdesign/charts": "0.7.7-canary.bf14580",
|
|
148
|
+
"@astryxdesign/core": "0.7.7-canary.bf14580",
|
|
149
|
+
"@astryxdesign/lab": "0.7.7-canary.bf14580",
|
|
150
|
+
"@astryxdesign/theme-neutral": "0.7.7-canary.bf14580",
|
|
151
151
|
"@heroicons/react": "^2.2.0",
|
|
152
152
|
"@stylexjs/stylex": "^0.19.0",
|
|
153
153
|
"@types/babel__core": "^7.20.5",
|