Skip to content

Commit f4f2506

Browse files
authored
Merge branch 'main' into fil/summary-table
2 parents e57b1a0 + 2a54e8e commit f4f2506

File tree

442 files changed

+118598
-16920
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

442 files changed

+118598
-16920
lines changed

.github/workflows/deploy.yml

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
workflow_dispatch: {}
55
push:
66
branches: [main]
7+
schedule:
8+
- cron: "15 10 * * *"
79

810
jobs:
911
deploy:
@@ -19,59 +21,16 @@ jobs:
1921
with:
2022
node-version: 20
2123
cache: 'yarn'
22-
cache-dependency-path: |
23-
yarn.lock
24-
'examples/*/yarn.lock'
2524
- run: yarn --frozen-lockfile
2625
- id: date
2726
run: echo "date=$(TZ=America/Los_Angeles date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
2827
- id: cache-data
2928
uses: actions/cache@v4
3029
with:
31-
path: |
32-
docs/.observablehq/cache
33-
examples/*/docs/.observablehq/cache
34-
key: data-${{ hashFiles('docs/data/*', 'examples/*/docs/data/*') }}-${{ steps.date.outputs.date }}
35-
- if: steps.cache-data.outputs.cache-hit == 'true'
36-
run: find docs/.observablehq/cache examples/*/docs/.observablehq/cache -type f -exec touch {} +
30+
path: docs/.observablehq/cache
31+
key: data-${{ hashFiles('docs/data/*') }}-${{ steps.date.outputs.date }}
3732
- run: yarn build
3833
- run: yarn docs:build
39-
- name: Build example "api"
40-
run: yarn --frozen-lockfile && yarn build
41-
working-directory: examples/api
42-
- name: Build example "chess"
43-
run: yarn --frozen-lockfile && yarn build
44-
working-directory: examples/chess
45-
- name: Build example "eia"
46-
run: yarn --frozen-lockfile && yarn build
47-
working-directory: examples/eia
48-
env:
49-
EIA_KEY: ${{ secrets.EIA_KEY }}
50-
- name: Build example "google-analytics"
51-
run: yarn --frozen-lockfile && yarn build
52-
working-directory: examples/google-analytics
53-
env:
54-
GA_PROPERTY_ID: ${{ vars.GA_PROPERTY_ID }}
55-
GA_CLIENT_EMAIL: ${{ secrets.GA_CLIENT_EMAIL }}
56-
GA_PRIVATE_KEY: ${{ secrets.GA_PRIVATE_KEY }}
57-
- name: Build example "hello-world"
58-
run: yarn --frozen-lockfile && yarn build
59-
working-directory: examples/hello-world
60-
- name: Build example "mortgage-rates"
61-
run: yarn --frozen-lockfile && yarn build
62-
working-directory: examples/mortgage-rates
63-
- name: Build example "penguin-classification"
64-
run: |
65-
python -m pip install --upgrade pip
66-
pip install -r requirements.txt
67-
yarn --frozen-lockfile && yarn build
68-
working-directory: examples/penguin-classification
69-
- name: Build example "plot"
70-
run: yarn --frozen-lockfile && yarn build
71-
working-directory: examples/plot
72-
env:
73-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74-
- run: mkdir docs/.observablehq/dist/examples && for i in examples/*; do if [ -d $i/dist ]; then mv -v $i/dist docs/.observablehq/dist/examples/$(basename $i); fi; done
7534
- uses: cloudflare/pages-action@1
7635
with:
7736
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}

README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Observable Framework
22

3-
- [Documentation](https://observablehq.com/framework/)
4-
- [Changelog](https://github.com/observablehq/framework/releases)
5-
- [Issues](https://github.com/observablehq/framework/issues)
3+
[**Observable Framework**](https://observablehq.com/framework/) is a free, [open-source](./LICENSE), static site generator for data apps, dashboards, reports, and more. Framework combines JavaScript on the front-end for interactive graphics with any language on the back-end for data analysis. Framework features [data loaders](https://observablehq.com/framework/loaders) that precompute static snapshots of data at build time for dashboards that load instantly.
4+
5+
## Documentation 📚
6+
7+
https://observablehq.com/framework/
8+
9+
## Examples 🖼️
10+
11+
https://github.com/observablehq/framework/tree/main/examples
12+
13+
## Releases (changelog) 🚀
14+
15+
https://github.com/observablehq/framework/releases
16+
17+
## Getting help 🏠
18+
19+
Please [open a discussion](https://github.com/observablehq/framework/discussions) if you’d like help. We also recommend [searching issues](https://github.com/observablehq/framework/issues). You can also ask on the [Observable forum](https://talk.observablehq.com/) or [Observable community Slack](https://observablehq.com/slack/join).
20+
21+
## Contributing 🙏
22+
23+
See [`CONTRIBUTING.md`](./CONTRIBUTING.md).

docs/assets/mortgage-rates-dark.webp

18.8 KB
Binary file not shown.

docs/assets/mortgage-rates.webp

19.2 KB
Binary file not shown.

docs/assets/mosaic.webp

82.8 KB
Binary file not shown.
File renamed without changes.

docs/config.md

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The following options are supported.
2121

2222
## root
2323

24-
The path to the source root; defaults to `docs`.
24+
The path to the source root; defaults to `src`. (Prior to <a href="https://github.com/observablehq/framework/releases/tag/v1.7.0" class="observablehq-version-badge" data-version="^1.7.0" title="Added in 1.7.0"></a>, the default was `docs`.)
2525

2626
## output
2727

@@ -67,9 +67,9 @@ See the [list of available themes](./themes) for more.
6767

6868
## style
6969

70-
The path to a custom stylesheet, relative to the source root. This option takes precedence over the [theme option](#theme) (if any), providing more control by allowing you to remove or alter the default stylesheet and define a custom theme.
70+
The path to a custom stylesheet, relative to the source root (typically `src`). This option takes precedence over the [theme option](#theme) (if any), providing more control by allowing you to remove or alter the default stylesheet and define a custom theme.
7171

72-
The custom stylesheet should typically import `observablehq:default.css` to build on the default styles. You can also import any of the built-in themes. For example, to create a stylesheet that builds up on the `air` theme, create a `custom-style.css` file in the `docs` folder, then set the style option to `custom-style.css`:
72+
The custom stylesheet should typically import `observablehq:default.css` to build on the default styles. You can also import any of the built-in themes. For example, to create a stylesheet that builds up on the `air` theme, create a `custom-style.css` file in the source root, then set the style option to `custom-style.css`:
7373

7474
```css
7575
@import url("observablehq:default.css");
@@ -114,7 +114,11 @@ Whether to show the sidebar. Defaults to true if **pages** is not empty.
114114

115115
An array containing pages and sections. If not specified, it defaults to all Markdown files found in the source root in directory listing order.
116116

117-
Both pages and sections have a **name**, which typically corresponds to the page’s title. The name gets displayed in the sidebar. Clicking on a page navigates to the corresponding **path**, which should start with a leading slash and be relative to the root; the path can also be specified as a full URL to navigate to an external site. Clicking on a section header opens or closes that section. Each section must specify an array of **pages**, and optionally whether the section is **open** by default. If **open** is not set, it defaults to true. If **open** is false, the section is closed unless the current page belongs to that section.
117+
Both pages and sections have a **name**, which typically corresponds to the page’s title. The name gets displayed in the sidebar. Clicking on a page navigates to the corresponding **path**, which should start with a leading slash and be relative to the root; the path can also be specified as a full URL to navigate to an external site. Each section must specify an array of **pages**.
118+
119+
Sections may be **collapsible**. <a href="https://github.com/observablehq/framework/releases/tag/v1.6.0" class="observablehq-version-badge" data-version="^1.6.0" title="Added in 1.6.0"></a> If the **open** option is set, the **collapsible** option defaults to true; otherwise it defaults to false. If the section is not collapsible, the **open** option is ignored and the section is always open; otherwise, the **open** option defaults to true. When a section is collapsible, clicking on a section header opens or closes that section. A section will always be open if the current page belongs to that section.
120+
121+
Pages and sections may also have a **pager** field <a href="https://github.com/observablehq/framework/pull/1306" class="observablehq-version-badge" data-version="prerelease" title="Added in #1306"></a> which specifies the name of the page group; this determines which pages are linked to via the previous and next pager buttons. If the **pager** field is not specified, it defaults the current section’s **pager** field, or to `main` for top-level pages and sections. (The home page is always in the `main` pager group.) The **pager** field can be also set to `null` to disable the pager on a specific page or section, causing adjacent pages to skip the page.
118122

119123
For example, here **pages** specifies two sections and a total of four pages:
120124

@@ -160,16 +164,6 @@ An HTML fragment to add to the header. Defaults to the empty string.
160164

161165
An HTML fragment to add to the footer. Defaults to “Built with Observable.”
162166

163-
## scripts
164-
165-
Additional scripts to add to the head, such as for analytics. Unlike the **head** option, this allows you to reference a local script in the source root.
166-
167-
```js run=false
168-
export default {
169-
scripts: [{type: "module", async: true, src: "analytics.js"}]
170-
};
171-
```
172-
173167
## base
174168

175169
The base path when serving the site. Currently this only affects the custom 404 page, if any.
@@ -251,13 +245,24 @@ export default {
251245

252246
## markdownIt <a href="https://github.com/observablehq/framework/releases/tag/v1.1.0" class="observablehq-version-badge" data-version="^1.1.0" title="Added in v1.1.0"></a>
253247

254-
A hook for registering additional [markdown-it](https://github.com/markdown-it/markdown-it) plugins. For example, to use [markdown-it-footnote](https://github.com/markdown-it/markdown-it-footnote):
248+
A hook for registering additional [markdown-it](https://github.com/markdown-it/markdown-it) plugins. For example, to use [markdown-it-footnote](https://github.com/markdown-it/markdown-it-footnote), first install the plugin with either `npm add markdown-it-footnote` or `yarn add markdown-it-footnote`, then register it like so:
255249

256250
```js run=false
257-
import type MarkdownIt from "markdown-it";
258251
import MarkdownItFootnote from "markdown-it-footnote";
259252

260253
export default {
261-
markdownIt: (md: MarkdownIt) => md.use(MarkdownItFootnote);
254+
markdownIt: (md) => md.use(MarkdownItFootnote)
262255
};
263256
```
257+
258+
## typographer <a href="https://github.com/observablehq/framework/releases/tag/v1.7.0" class="observablehq-version-badge" data-version="^1.7.0" title="Added in 1.7.0"></a>
259+
260+
If true, enables simple typographic replacements in Markdown, such as replacing `(c)` with `©` and converting straight quotes to curly quotes. See also the [quotes](#quotes) option, which should be set for non-English languages if the **typographer** option is enabled. For the full list of replacements, see [markdown-it](https://github.com/markdown-it/markdown-it/blob/master/lib/rules_core/replacements.mjs). Defaults to false.
261+
262+
## quotes <a href="https://github.com/observablehq/framework/releases/tag/v1.7.0" class="observablehq-version-badge" data-version="^1.7.0" title="Added in 1.7.0"></a>
263+
264+
The set of replacements for straight double and single quotes used when the [**typographer** option](#typographer) is enabled. Defaults to `["“", "”", "‘", "’"]` which is suitable for English. For example, you can use `["«", "»", "„", "“"]` for Russian, `["„", "“", "‚", "‘"]` for German, and `["«\xa0", "\xa0»", "‹\xa0", "\xa0›"]` for French.
265+
266+
## linkify <a href="https://github.com/observablehq/framework/releases/tag/v1.7.0" class="observablehq-version-badge" data-version="^1.7.0" title="Added in 1.7.0"></a>
267+
268+
If true (the default), automatically convert URL-like text to links in Markdown.

docs/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ yarn dev
1616

1717
Lastly visit <http://127.0.0.1:3000>.
1818

19-
The local preview server restarts automatically if you edit any of the TypeScript files, though you may need to reload. The default page is [docs/index.md](https://github.com/observablehq/framework/blob/main/docs/index.md?plain=1); if you edit that file and save changes, the live preview in the browser will automatically update.
19+
The local preview server restarts automatically if you edit any of the TypeScript files, though you may need to reload. The default page is [`docs/index.md`](https://github.com/observablehq/framework/blob/main/docs/index.md?plain=1); if you edit that file and save changes, the live preview in the browser will automatically update.
2020

2121
To generate the static site:
2222

docs/css/card.md

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,3 @@
1-
# CSS: Card
1+
<meta http-equiv="refresh" content="0; url=../markdown#cards">
22

3-
The `card` class is used to group and delineate content. The `card` classes applies a background and border (with colors determined by the current [theme](../themes)). A card can have a title and subtitle using <code>h2</code> and <code>h3</code> elements, respectively.
4-
5-
```html echo
6-
<div class="card" style="max-width: 640px;">
7-
<h2>It gets hotter during summer</h2>
8-
<h3>And months have 28–31 days</h3>
9-
${Plot.cell(weather.slice(-365), {x: (d) => d.date.getUTCDate(), y: (d) => d.date.getUTCMonth(), fill: "temp_max", tip: true, inset: 0.5}).plot({marginTop: 0, height: 240, padding: 0})}
10-
</div>
11-
```
12-
13-
<div class="tip"><a href="../lib/plot">Observable Plot</a>’s <b>title</b> and <b>subtitle</b> options generate <code>h2</code> and <code>h3</code> elements, respectively, and so will inherit these card styles.</div>
14-
15-
Cards can be used on their own, but they most often exist in a [grid](./grid). Cards can contain whatever you like, including text, images, charts, tables, inputs, and more.
16-
17-
```html echo
18-
<div class="grid grid-cols-2">
19-
<div class="card">
20-
<h2>Lorem ipsum</h2>
21-
<p>Id ornare arcu odio ut sem nulla pharetra. Aliquet lectus proin nibh nisl condimentum id venenatis a. Feugiat sed lectus vestibulum mattis ullamcorper velit. Aliquet nec ullamcorper sit amet. Sit amet tellus cras adipiscing. Condimentum id venenatis a condimentum vitae. Semper eget duis at tellus. Ut faucibus pulvinar elementum integer enim.</p>
22-
<p>Et malesuada fames ac turpis. Integer vitae justo eget magna fermentum iaculis eu non diam. Aliquet risus feugiat in ante metus dictum at. Consectetur purus ut faucibus pulvinar.</p>
23-
</div>
24-
<div class="card" style="padding: 0;">
25-
${Inputs.table(industries)}
26-
</div>
27-
</div>
28-
```
29-
30-
<div class="tip">Remove the padding from a card if it contains only a table.</div>
31-
32-
To place an input inside a card, first declare a detached input as a [top-level variable](../javascript/reactivity#top-level-variables) and use [`Generators.input`](../lib/generators#inputelement) to expose its reactive value:
33-
34-
```js echo
35-
const industryInput = Inputs.select(industries.map((d) => d.industry), {unique: true, sort: true, label: "Industry:"});
36-
const industry = Generators.input(industryInput);
37-
```
38-
39-
Then, insert the input into the card:
40-
41-
```html echo
42-
<div class="card" style="display: flex; flex-direction: column; gap: 1rem;">
43-
${industryInput}
44-
${resize((width) => Plot.plot({
45-
width,
46-
y: {grid: true, label: "Unemployed (thousands)"},
47-
marks: [
48-
Plot.areaY(industries.filter((d) => d.industry === industry), {x: "date", y: "unemployed", fill: "var(--theme-foreground-muted)", curve: "step"}),
49-
Plot.lineY(industries.filter((d) => d.industry === industry), {x: "date", y: "unemployed", curve: "step"}),
50-
Plot.ruleY([0])
51-
]
52-
}))}
53-
</div>
54-
```
3+
Moved to [Layout: Cards](../markdown#cards).

docs/css/color.md

Lines changed: 2 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,3 @@
1-
# CSS: Color
1+
<meta http-equiv="refresh" content="0; url=../themes#colors">
22

3-
The following custom properties are defined by the current [theme](../themes):
4-
5-
<table>
6-
<thead>
7-
<tr>
8-
<th>Name</th>
9-
<th>Color</th>
10-
<th>Description</th>
11-
</tr>
12-
</thead>
13-
<tbody>
14-
<tr>
15-
<td><code>--theme-foreground</code></td>
16-
<td><div style="background-color: var(--theme-foreground); width: 2rem; height: 1rem;"></div></td>
17-
<td>page foreground color</td>
18-
</tr>
19-
<tr>
20-
<td><code>--theme-background</code></td>
21-
<td><div style="background-color: var(--theme-background); width: 2rem; height: 1rem;"></div></td>
22-
<td>page background color</td>
23-
</tr>
24-
<tr>
25-
<td><code>--theme-background-alt</code></td>
26-
<td><div style="background-color: var(--theme-background-alt); width: 2rem; height: 1rem;"></div></td>
27-
<td>block background color</td>
28-
</tr>
29-
<tr>
30-
<td><code>--theme-foreground-alt</code></td>
31-
<td><div style="background-color: var(--theme-foreground-alt); width: 2rem; height: 1rem;"></div></td>
32-
<td>heading foreground color</td>
33-
</tr>
34-
<tr>
35-
<td><code>--theme-foreground-muted</code></td>
36-
<td><div style="background-color: var(--theme-foreground-muted); width: 2rem; height: 1rem;"></div></td>
37-
<td>secondary text foreground color</td>
38-
</tr>
39-
<tr>
40-
<td><code>--theme-foreground-faint</code></td>
41-
<td><div style="background-color: var(--theme-foreground-faint); width: 2rem; height: 1rem;"></div></td>
42-
<td>faint border color</td>
43-
</tr>
44-
<tr>
45-
<td><code>--theme-foreground-fainter</code></td>
46-
<td><div style="background-color: var(--theme-foreground-fainter); width: 2rem; height: 1rem;"></div></td>
47-
<td>fainter border color</td>
48-
</tr>
49-
<tr>
50-
<td><code>--theme-foreground-faintest</code></td>
51-
<td><div style="background-color: var(--theme-foreground-faintest); width: 2rem; height: 1rem;"></div></td>
52-
<td>faintest border color</td>
53-
</tr>
54-
<tr>
55-
<td><code>--theme-foreground-focus</code></td>
56-
<td><div style="background-color: var(--theme-foreground-focus); width: 2rem; height: 1rem;"></div></td>
57-
<td>emphasis foreground color</td>
58-
</tr>
59-
</tbody>
60-
</table>
61-
62-
You can use these properties anywhere you like. For example, to style a line chart to match the focus color:
63-
64-
```js echo
65-
Plot.lineY(aapl, {x: "Date", y: "Close", stroke: "var(--theme-foreground-focus)"}).plot()
66-
```
67-
68-
A handful of color classes are also provided:
69-
70-
```html echo
71-
<div class="red">I am red text.</div>
72-
```
73-
74-
```html echo
75-
<div class="yellow">I am yellow text.</div>
76-
```
77-
78-
```html echo
79-
<div class="green">I am green text.</div>
80-
```
81-
82-
```html echo
83-
<div class="blue">I am blue text.</div>
84-
```
85-
86-
```html echo
87-
<div class="muted">I am muted text.</div>
88-
```
3+
Moved to [Themes: Colors](../themes#colors).

0 commit comments

Comments
 (0)