@tenphi/cookbook 0.25.4 → 0.26.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/docs/authoring.mdx +30 -6
- package/package.json +3 -3
package/docs/authoring.mdx
CHANGED
|
@@ -130,6 +130,30 @@ import { Preview } from "@tenphi/cookbook/components";
|
|
|
130
130
|
css={"button { padding: 0.75rem; }"}
|
|
131
131
|
/>
|
|
132
132
|
|
|
133
|
+
To demonstrate your own library, build it into the site's public directory
|
|
134
|
+
(`public/` by default) and list the files in `scripts` by their public path,
|
|
135
|
+
without the Astro `base`. Cookbook inlines each file, in order, before
|
|
136
|
+
`javascript`, so the authored code can use what they define. Each file runs as
|
|
137
|
+
a classic script, so use a self-contained IIFE or UMD build without `import` or
|
|
138
|
+
`export`:
|
|
139
|
+
|
|
140
|
+
```mdx
|
|
141
|
+
<Preview
|
|
142
|
+
title="Library button"
|
|
143
|
+
html={"<acme-button>Save</acme-button>"}
|
|
144
|
+
scripts={["/demo/button.js"]}
|
|
145
|
+
javascript={"document.querySelector('acme-button').loading = true;"}
|
|
146
|
+
/>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Inlining keeps the preview isolated and needs no request, so the demo works in
|
|
150
|
+
`astro dev`, `astro preview`, and offline as well as on the deployed site. A
|
|
151
|
+
`<script src>` in `html` is a cross-site request from the sandboxed frame:
|
|
152
|
+
`astro dev` rejects it, and Chrome blocks it from local servers. View source
|
|
153
|
+
shows each inlined file as a `<script src>` tag. Every preview embeds its own
|
|
154
|
+
copy, so keep demo bundles small. A missing file or a path outside the public
|
|
155
|
+
directory fails the build.
|
|
156
|
+
|
|
133
157
|
## Cookbook logo
|
|
134
158
|
|
|
135
159
|
`Logo` renders the Cookbook mark. Use `label` when it carries meaning or
|
|
@@ -149,12 +173,12 @@ markers remain visible independently of their theme-aware backgrounds:
|
|
|
149
173
|
|
|
150
174
|
## Component props
|
|
151
175
|
|
|
152
|
-
| Component | Props and behavior
|
|
153
|
-
| --------- |
|
|
154
|
-
| `Card` | Optional `title` and `href`; renders an article or link with slot content
|
|
155
|
-
| `Steps` | Ordered list container; supply `li` elements
|
|
156
|
-
| `Logo` | Optional `label`, `decorative`, and root `class`; renders the Cookbook mark
|
|
157
|
-
| `Preview` | Required `title`; optional `html`, `css`, and `
|
|
176
|
+
| Component | Props and behavior |
|
|
177
|
+
| --------- | -------------------------------------------------------------------------------------------------------------------------- |
|
|
178
|
+
| `Card` | Optional `title` and `href`; renders an article or link with slot content |
|
|
179
|
+
| `Steps` | Ordered list container; supply `li` elements |
|
|
180
|
+
| `Logo` | Optional `label`, `decorative`, and root `class`; renders the Cookbook mark |
|
|
181
|
+
| `Preview` | Required `title`; optional `html`, `css`, `javascript`, and public-file `scripts`; isolates examples in a sandboxed iframe |
|
|
158
182
|
|
|
159
183
|
The public package exports each component's props type, such as `TabProps`,
|
|
160
184
|
`CalloutProps`, and `CodeGroupProps`. Styles and all named sub-elements are
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tenphi/cookbook",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.0",
|
|
4
4
|
"description": "Repository-native static documentation for Astro",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"author": "Andrey Yamanov",
|
|
69
69
|
"license": "MIT",
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@tenphi/docs": "0.
|
|
72
|
-
"@tenphi/renderer": "0.
|
|
71
|
+
"@tenphi/docs": "0.26.0",
|
|
72
|
+
"@tenphi/renderer": "0.26.0"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
75
|
"astro": "^7.3.2"
|