@because-dev/astro 0.2.0 → 0.4.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/components/IdeaArticle.astro +2 -1
- package/components/IdeaShell.astro +37 -44
- package/components/IdeasIndex.astro +2 -2
- package/dist/client.d.ts +22 -0
- package/dist/client.js +22 -0
- package/dist/client.js.map +1 -0
- package/dist/helpers.d.ts +5 -1
- package/dist/helpers.js +2 -2
- package/dist/helpers.js.map +1 -1
- package/dist/index.d.ts +22 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +6 -2
- package/routes/idea.astro +5 -4
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
/** The idea's text: crawlable HTML with each question as an <h2> and its answers as links. */
|
|
3
3
|
import type { IdeaPage } from "../dist/helpers.js";
|
|
4
|
+
import { renderInline } from "@because-dev/core";
|
|
4
5
|
|
|
5
6
|
interface Props {
|
|
6
7
|
page: IdeaPage;
|
|
@@ -37,7 +38,7 @@ const { idea } = page;
|
|
|
37
38
|
{q.answers.map((a) => (
|
|
38
39
|
<div class="bc-answer">
|
|
39
40
|
<h3><a href={a.href}>{a.idea.title}</a></h3>
|
|
40
|
-
{a.idea.summary && <p
|
|
41
|
+
{a.idea.summary && <p set:html={renderInline(a.idea.teaser ?? a.idea.summary)} />}
|
|
41
42
|
</div>
|
|
42
43
|
))}
|
|
43
44
|
</section>
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Idea page with two views. On phones the map and the article are separate
|
|
4
|
+
* full-screen pages; on wider screens the map always shows and the article view
|
|
5
|
+
* opens the text in a sidebar (--bc-side, default 420px). A floating button
|
|
6
|
+
* switches; the `view` option picks which opens first. Without JavaScript there
|
|
7
|
+
* is no map, only the article.
|
|
6
8
|
*
|
|
7
9
|
* The default shell for idea pages. Styles are low-specificity (:where) and
|
|
8
10
|
* driven by --bc-* tokens, and no fonts are loaded, so a site can restyle it
|
|
@@ -11,12 +13,16 @@
|
|
|
11
13
|
interface Props {
|
|
12
14
|
title: string;
|
|
13
15
|
description?: string;
|
|
16
|
+
/** Which full-screen view opens first: the map or the article. */
|
|
17
|
+
view?: "map" | "article";
|
|
18
|
+
/** The idea's title, announced as the page heading while the article is hidden behind the map. */
|
|
19
|
+
heading?: string;
|
|
14
20
|
/** Home link in the top bar. */
|
|
15
21
|
homeHref: string;
|
|
16
22
|
homeLabel: string;
|
|
17
23
|
indexHref: string;
|
|
18
24
|
}
|
|
19
|
-
const { title, homeHref, homeLabel, indexHref } = Astro.props;
|
|
25
|
+
const { title, homeHref, homeLabel, indexHref, view = "map", heading } = Astro.props;
|
|
20
26
|
---
|
|
21
27
|
<!doctype html>
|
|
22
28
|
<html lang="en">
|
|
@@ -29,7 +35,6 @@ const { title, homeHref, homeLabel, indexHref } = Astro.props;
|
|
|
29
35
|
:where(:root) {
|
|
30
36
|
--bc-board: #eef1ef; --bc-card: #ffffff; --bc-ink: #18201d; --bc-muted: #5b6863; --bc-line: #d3dbd6;
|
|
31
37
|
--bc-accent: #1f5f4a; --bc-bar: rgba(255,255,255,.93);
|
|
32
|
-
--bc-side: 420px;
|
|
33
38
|
color-scheme: light;
|
|
34
39
|
}
|
|
35
40
|
@media (prefers-color-scheme: dark) {
|
|
@@ -56,33 +61,34 @@ const { title, homeHref, homeLabel, indexHref } = Astro.props;
|
|
|
56
61
|
:where(.bc-top .bc-home) { font-family: var(--bc-display, var(--bc-text, inherit)); font-weight: 700; font-size: 19px; letter-spacing: -0.01em; }
|
|
57
62
|
:where(.bc-top .bc-nav) { font-family: var(--bc-mono, ui-monospace, Menlo, Consolas, monospace); font-size: 12px; color: var(--bc-muted); }
|
|
58
63
|
:where(.bc-top .bc-nav:hover) { color: var(--bc-ink); }
|
|
59
|
-
:where(.bc-top .bc-toggle) { margin-left: auto; font: 12px var(--bc-mono, ui-monospace, Menlo, Consolas, monospace); color: var(--bc-ink); background: var(--bc-card);
|
|
60
|
-
border: 1px solid var(--bc-line); border-radius: 6px; padding: 5px 9px; cursor: pointer; display: none; }
|
|
61
|
-
:where(.bc-top .bc-toggle:hover) { border-color: var(--bc-muted); }
|
|
62
64
|
|
|
63
|
-
:where(.bc-shell) { flex: 1; min-height: 0; display: flex; }
|
|
65
|
+
:where(.bc-shell) { flex: 1; min-height: 0; display: flex; --bc-controls-bottom: 72px; }
|
|
64
66
|
:where(.bc-shell .bc-map-root) { display: none; }
|
|
65
|
-
:where(.bc-side) { overflow-y: auto; background: var(--bc-card); }
|
|
67
|
+
:where(.bc-side) { flex: 1; min-width: 0; overflow-y: auto; background: var(--bc-card); }
|
|
68
|
+
:where(.bc-idea) { max-width: 42rem; margin: 0 auto; }
|
|
66
69
|
|
|
67
|
-
/*
|
|
68
|
-
:where(.
|
|
69
|
-
:where(.
|
|
70
|
+
/* Phones: each view is its own full-screen page; the shell's data-because-view picks which. */
|
|
71
|
+
:where(.has-map[data-because-view="map"] .bc-map-root) { display: block; flex: 1; min-width: 0; position: relative; }
|
|
72
|
+
:where(.has-map[data-because-view="map"] .bc-side) { display: none; }
|
|
70
73
|
|
|
71
|
-
/*
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
:where(.bc-shell.has-map.text-hidden .bc-side) { display: none; }
|
|
76
|
-
|
|
77
|
-
@media (max-width: 760px) {
|
|
78
|
-
:where(body) { height: auto; min-height: 100%; }
|
|
79
|
-
:where(.has-map) { flex-direction: column; }
|
|
80
|
-
:where(.has-map .bc-map-root) { flex: none; height: 62vh; }
|
|
81
|
-
:where(.has-map .bc-side) { width: auto; border-left: 0; border-top: 1px solid var(--bc-line); overflow: visible; }
|
|
82
|
-
:where(body:has(.has-map) .bc-toggle) { display: none; }
|
|
74
|
+
/* Wider screens: the map always shows, and the article view opens the text as a sidebar. */
|
|
75
|
+
@media (min-width: 768px) {
|
|
76
|
+
:where(.has-map .bc-map-root) { display: block; flex: 1; min-width: 0; position: relative; }
|
|
77
|
+
:where(.has-map[data-because-view="article"] .bc-side) { flex: none; width: var(--bc-side, 420px); border-left: 1px solid var(--bc-line); }
|
|
83
78
|
}
|
|
84
79
|
|
|
85
|
-
|
|
80
|
+
/* While the map hides the article, keep a page heading for screen readers (visually hidden). */
|
|
81
|
+
:where(.bc-maptitle) { display: none; }
|
|
82
|
+
:where(.has-map[data-because-view="map"] .bc-maptitle) { display: block; position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
83
|
+
|
|
84
|
+
/* Floating switch between the two views, bottom right (hidden until the map mounts). */
|
|
85
|
+
:where(.bc-viewtoggle) { position: fixed; z-index: 5; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
|
|
86
|
+
min-width: 56px; height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--bc-line); background: var(--bc-ink); color: var(--bc-card);
|
|
87
|
+
font: 500 13px var(--bc-mono, ui-monospace, Menlo, Consolas, monospace); cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
|
|
88
|
+
:where(.bc-viewtoggle:hover) { background: var(--bc-accent); }
|
|
89
|
+
:where(.bc-viewtoggle[hidden]) { display: none; }
|
|
90
|
+
|
|
91
|
+
:where(.bc-idea) { padding: 22px 24px 96px; font-size: 16.5px; line-height: 1.6; }
|
|
86
92
|
:where(.bc-idea h1) { font-family: var(--bc-display, var(--bc-text, inherit)); font-weight: 700; font-size: 28px; line-height: 1.15; letter-spacing: -0.01em; margin: 6px 0 4px; text-wrap: balance; }
|
|
87
93
|
:where(.bc-idea h2) { font-family: var(--bc-display, var(--bc-text, inherit)); font-weight: 700; font-size: 15px; margin: 28px 0 6px; color: var(--qc, var(--bc-ink)); }
|
|
88
94
|
:where(.bc-idea h3) { font-family: var(--bc-display, var(--bc-text, inherit)); font-weight: 500; font-size: 16px; margin: 10px 0 0; }
|
|
@@ -101,25 +107,12 @@ const { title, homeHref, homeLabel, indexHref } = Astro.props;
|
|
|
101
107
|
<header class="bc-top">
|
|
102
108
|
<a class="bc-home" href={homeHref}>{homeLabel}</a>
|
|
103
109
|
<a class="bc-nav" href={indexHref}>All ideas</a>
|
|
104
|
-
<button type="button" class="bc-toggle" aria-pressed="false">Hide text</button>
|
|
105
110
|
</header>
|
|
106
|
-
<
|
|
111
|
+
<main class="bc-shell" data-because-views data-because-view={view}>
|
|
112
|
+
<h1 class="bc-maptitle">{heading ?? title}</h1>
|
|
107
113
|
<slot name="map" />
|
|
108
|
-
<
|
|
109
|
-
</
|
|
110
|
-
<
|
|
111
|
-
const shell = document.querySelector(".bc-shell");
|
|
112
|
-
const toggle = document.querySelector<HTMLButtonElement>(".bc-toggle");
|
|
113
|
-
const set = (hidden: boolean) => {
|
|
114
|
-
shell?.classList.toggle("text-hidden", hidden);
|
|
115
|
-
if (toggle) {
|
|
116
|
-
toggle.textContent = hidden ? "Show text" : "Hide text";
|
|
117
|
-
toggle.setAttribute("aria-pressed", String(hidden));
|
|
118
|
-
}
|
|
119
|
-
try { localStorage.setItem("bc-text-hidden", hidden ? "1" : ""); } catch {}
|
|
120
|
-
};
|
|
121
|
-
try { if (localStorage.getItem("bc-text-hidden")) set(true); } catch {}
|
|
122
|
-
toggle?.addEventListener("click", () => set(!shell?.classList.contains("text-hidden")));
|
|
123
|
-
</script>
|
|
114
|
+
<div class="bc-side"><slot /></div>
|
|
115
|
+
</main>
|
|
116
|
+
<button type="button" class="bc-viewtoggle" data-because-view-toggle hidden></button>
|
|
124
117
|
</body>
|
|
125
118
|
</html>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import Layout from "virtual:because/layout";
|
|
7
7
|
import { graph } from "virtual:because/data";
|
|
8
8
|
import { config } from "virtual:because/config";
|
|
9
|
-
import { paginate, sortedIdeas, sortedPosts } from "@because-dev/core";
|
|
9
|
+
import { paginate, renderInline, sortedIdeas, sortedPosts } from "@because-dev/core";
|
|
10
10
|
import { ideaHref, joinPath, pageTitle } from "../dist/helpers.js";
|
|
11
11
|
import Head from "./Head.astro";
|
|
12
12
|
|
|
@@ -37,7 +37,7 @@ const description = `${posts.length} posts and ${graph.ideas.length} linked idea
|
|
|
37
37
|
{pagePosts.map((p) => (
|
|
38
38
|
<div class="bc-answer">
|
|
39
39
|
<h3><a href={ideaHref(ctx, p)}>{p.title}</a></h3>
|
|
40
|
-
{p.summary && <p
|
|
40
|
+
{p.summary && <p set:html={renderInline(p.teaser ?? p.summary)} />}
|
|
41
41
|
</div>
|
|
42
42
|
))}
|
|
43
43
|
</section>
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-side entry for sites that start the map themselves (`mount: false`).
|
|
3
|
+
* Because doesn't decide how the view is stored; for example, to keep the
|
|
4
|
+
* article view in the address as `?article=1`:
|
|
5
|
+
*
|
|
6
|
+
* import { mountAll } from "@because-dev/astro/client";
|
|
7
|
+
*
|
|
8
|
+
* const isArticle = () => new URLSearchParams(location.search).get("article") === "1";
|
|
9
|
+
* const { views } = mountAll({
|
|
10
|
+
* view: isArticle() ? "article" : "map",
|
|
11
|
+
* onViewChange: (view) => {
|
|
12
|
+
* const url = new URL(location.href);
|
|
13
|
+
* if (view === "article") url.searchParams.set("article", "1");
|
|
14
|
+
* else url.searchParams.delete("article");
|
|
15
|
+
* history.replaceState(history.state, "", url);
|
|
16
|
+
* },
|
|
17
|
+
* href: (href) => (isArticle() ? `${href}?article=1` : href),
|
|
18
|
+
* });
|
|
19
|
+
* addEventListener("popstate", () => views.forEach((v) => v.set(isArticle() ? "article" : "map")));
|
|
20
|
+
*/
|
|
21
|
+
export { mountAll, mount, type MountOptions, type Mounted } from "@because-dev/core/map/mount";
|
|
22
|
+
export type { BecauseView, ViewSwitcher } from "@because-dev/core/map";
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-side entry for sites that start the map themselves (`mount: false`).
|
|
3
|
+
* Because doesn't decide how the view is stored; for example, to keep the
|
|
4
|
+
* article view in the address as `?article=1`:
|
|
5
|
+
*
|
|
6
|
+
* import { mountAll } from "@because-dev/astro/client";
|
|
7
|
+
*
|
|
8
|
+
* const isArticle = () => new URLSearchParams(location.search).get("article") === "1";
|
|
9
|
+
* const { views } = mountAll({
|
|
10
|
+
* view: isArticle() ? "article" : "map",
|
|
11
|
+
* onViewChange: (view) => {
|
|
12
|
+
* const url = new URL(location.href);
|
|
13
|
+
* if (view === "article") url.searchParams.set("article", "1");
|
|
14
|
+
* else url.searchParams.delete("article");
|
|
15
|
+
* history.replaceState(history.state, "", url);
|
|
16
|
+
* },
|
|
17
|
+
* href: (href) => (isArticle() ? `${href}?article=1` : href),
|
|
18
|
+
* });
|
|
19
|
+
* addEventListener("popstate", () => views.forEach((v) => v.set(isArticle() ? "article" : "map")));
|
|
20
|
+
*/
|
|
21
|
+
export { mountAll, mount } from "@because-dev/core/map/mount";
|
|
22
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAmC,MAAM,6BAA6B,CAAC"}
|
package/dist/helpers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Graph, type Idea, type IdeaSummary } from "@because-dev/core";
|
|
2
|
-
export { paginate, type Page } from "@because-dev/core";
|
|
2
|
+
export { paginate, renderInline, type Page } from "@because-dev/core";
|
|
3
3
|
/** Join URL path segments with single slashes; keeps a trailing slash if the last segment has one. */
|
|
4
4
|
export declare function joinPath(...parts: string[]): string;
|
|
5
5
|
export interface PageContext {
|
|
@@ -69,6 +69,8 @@ export interface PostEntry {
|
|
|
69
69
|
slug: string;
|
|
70
70
|
title: string;
|
|
71
71
|
summary: string;
|
|
72
|
+
/** Excerpt keeping inline emphasis; render with renderInline. */
|
|
73
|
+
teaser?: string;
|
|
72
74
|
/** ISO date from front matter, if any; format it however your site likes. */
|
|
73
75
|
date?: string;
|
|
74
76
|
updated?: string;
|
|
@@ -82,6 +84,8 @@ export interface IdeaEntry {
|
|
|
82
84
|
slug: string;
|
|
83
85
|
title: string;
|
|
84
86
|
summary: string;
|
|
87
|
+
/** Excerpt keeping inline emphasis; render with renderInline. */
|
|
88
|
+
teaser?: string;
|
|
85
89
|
href: string;
|
|
86
90
|
}
|
|
87
91
|
/** Posts newest first (undated last), and every other idea by title. */
|
package/dist/helpers.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { indexGraph, reachableFrom, neighbourhoodPath, questionLabel, summarizeIdea, trailTo, } from "@because-dev/core";
|
|
2
2
|
import { createRenderer } from "@because-dev/core/parser";
|
|
3
3
|
// For sites building their own paged lists from virtual:because/data.
|
|
4
|
-
export { paginate } from "@because-dev/core";
|
|
4
|
+
export { paginate, renderInline } from "@because-dev/core";
|
|
5
5
|
/** Join URL path segments with single slashes; keeps a trailing slash if the last segment has one. */
|
|
6
6
|
export function joinPath(...parts) {
|
|
7
7
|
const joined = parts.filter(Boolean).join("/").replace(/\/{2,}/g, "/");
|
|
@@ -108,7 +108,7 @@ export function ideaHead(page, siteName, site) {
|
|
|
108
108
|
/** Posts newest first (undated last), and every other idea by title. */
|
|
109
109
|
export function listings(graph, ctx) {
|
|
110
110
|
const index = indexGraph(graph);
|
|
111
|
-
const entry = (i) => ({ id: i.id, slug: i.slug, title: i.title, summary: i.summary, href: ideaHref(ctx, i) });
|
|
111
|
+
const entry = (i) => ({ id: i.id, slug: i.slug, title: i.title, summary: i.summary, ...(i.teaser ? { teaser: i.teaser } : {}), href: ideaHref(ctx, i) });
|
|
112
112
|
const posts = graph.ideas
|
|
113
113
|
.filter((i) => i.kind === "post")
|
|
114
114
|
.sort((a, b) => (b.date ?? "").localeCompare(a.date ?? ""))
|
package/dist/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,OAAO,GAIR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,sEAAsE;AACtE,OAAO,EAAE,QAAQ,EAAa,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,OAAO,GAIR,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,sEAAsE;AACtE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAa,MAAM,mBAAmB,CAAC;AAEtE,sGAAsG;AACtG,MAAM,UAAU,QAAQ,CAAC,GAAG,KAAe;IACzC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;IACvE,OAAO,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC;AACxD,CAAC;AASD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAgB,EAAE,IAAwB,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AACzH,4EAA4E;AAC5E,MAAM,CAAC,MAAM,SAAS,GAAG,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C;QACnC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5C,SAAS,EAAE,aAAa,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM;KAC7C,CAAC,CAAC,CAAC;IACN,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK;SACtB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC;SAChC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;SAC9C,GAAG,CAAC,KAAK,CAAC,CAAC;IACd,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC1B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -13,8 +13,21 @@ export interface BecauseOptions {
|
|
|
13
13
|
layout?: string;
|
|
14
14
|
/** Appended to page titles: "Idea title · <siteName>". */
|
|
15
15
|
siteName?: string;
|
|
16
|
-
/**
|
|
16
|
+
/** Give idea pages the interactive map (a full-screen map view beside the article view). Default true. */
|
|
17
17
|
map?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Which full-screen view an idea page opens in: "map" (default) or "article".
|
|
20
|
+
* Readers switch with the floating button. Because doesn't remember the
|
|
21
|
+
* choice; to keep it (e.g. in the URL), set `mount: false` and pass
|
|
22
|
+
* `view` / `onViewChange` to `mountAll()` yourself.
|
|
23
|
+
*/
|
|
24
|
+
view?: "map" | "article";
|
|
25
|
+
/**
|
|
26
|
+
* Start the map on idea pages automatically. Default true. Set false to call
|
|
27
|
+
* `mountAll()` from "@because-dev/astro/client" in your own script, e.g. to
|
|
28
|
+
* pick the starting view, store view changes or rewrite history URLs yourself.
|
|
29
|
+
*/
|
|
30
|
+
mount?: boolean;
|
|
18
31
|
/**
|
|
19
32
|
* Add the list page at `base`. Default true. Set false to write your own page
|
|
20
33
|
* there; it can read the graph from `virtual:because/data` (types:
|
|
@@ -24,9 +37,12 @@ export interface BecauseOptions {
|
|
|
24
37
|
/**
|
|
25
38
|
* Your own shell for idea pages (with the map on), relative to the project root,
|
|
26
39
|
* e.g. "./src/layouts/IdeaShell.astro". It receives `title`, `description`,
|
|
27
|
-
* `homeHref`, `homeLabel` and `
|
|
28
|
-
* tags; render it in <head>), "map" (the map's root element; give it a
|
|
29
|
-
* the default slot (the idea's article).
|
|
40
|
+
* `homeHref`, `homeLabel`, `indexHref`, `view` and `heading` (the idea's title) props and three slots: "head"
|
|
41
|
+
* (meta tags; render it in <head>), "map" (the map's root element; give it a
|
|
42
|
+
* size) and the default slot (the idea's article). For map/article switching,
|
|
43
|
+
* wrap both in an element with `data-because-views data-because-view={view}`
|
|
44
|
+
* and add a `<button data-because-view-toggle hidden>`. Defaults to the
|
|
45
|
+
* built-in full-screen shell.
|
|
30
46
|
*/
|
|
31
47
|
shell?: string;
|
|
32
48
|
/**
|
|
@@ -49,6 +65,8 @@ export interface ResolvedBecauseConfig {
|
|
|
49
65
|
base: string;
|
|
50
66
|
siteName?: string;
|
|
51
67
|
map: boolean;
|
|
68
|
+
view: "map" | "article";
|
|
69
|
+
mount: boolean;
|
|
52
70
|
styles: boolean;
|
|
53
71
|
pageSize: number;
|
|
54
72
|
}
|
package/dist/index.js
CHANGED
|
@@ -26,7 +26,7 @@ export default function because(options = {}) {
|
|
|
26
26
|
const drafts = options.drafts ?? command === "dev";
|
|
27
27
|
// Resolve now so a typo or bad custom strategy fails at startup with a clear message.
|
|
28
28
|
const strategy = resolveStrategy(options.strategy);
|
|
29
|
-
const resolved = { base, siteName: options.siteName, map: options.map ?? true, styles: options.styles ?? true, pageSize: options.pageSize ?? DEFAULT_PAGE_SIZE };
|
|
29
|
+
const resolved = { base, siteName: options.siteName, map: options.map ?? true, view: options.view ?? "map", mount: options.mount ?? true, styles: options.styles ?? true, pageSize: options.pageSize ?? DEFAULT_PAGE_SIZE };
|
|
30
30
|
const read = async () => {
|
|
31
31
|
const { graph, issues } = await loadVault(contentDir, { drafts, strategy });
|
|
32
32
|
const checks = checkGraph(graph);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAA6B,MAAM,mBAAmB,CAAC;AACjJ,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAA6B,MAAM,mBAAmB,CAAC;AACjJ,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AA0ExD,MAAM,IAAI,GAAG,sBAAsB,CAAC;AACpC,MAAM,MAAM,GAAG,wBAAwB,CAAC;AACxC,MAAM,MAAM,GAAG,wBAAwB,CAAC;AACxC,MAAM,KAAK,GAAG,uBAAuB,CAAC;AAEtC,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,aA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AAC,EAAE,OAAO,EAAE,GAAG,IAAI,mBAAmB,EAAE,UAAU,EAAE,KAAK,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;gBACjG,WAAW,CAAC,EAAE,OAAO,EAAE,GAAG,IAAI,mBAAmB,EAAE,UAAU,EAAE,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;gBACxF,WAAW,CAAC,EAAE,OAAO,EAAE,GAAG,IAAI,qBAAqB,EAAE,UAAU,EAAE,KAAK,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;YACjG,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@because-dev/astro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Astro integration: one static page per Because idea, the interactive map, and per-idea neighbourhood JSON.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -26,6 +26,10 @@
|
|
|
26
26
|
"./helpers": {
|
|
27
27
|
"types": "./dist/helpers.d.ts",
|
|
28
28
|
"import": "./dist/helpers.js"
|
|
29
|
+
},
|
|
30
|
+
"./client": {
|
|
31
|
+
"types": "./dist/client.d.ts",
|
|
32
|
+
"import": "./dist/client.js"
|
|
29
33
|
}
|
|
30
34
|
},
|
|
31
35
|
"files": [
|
|
@@ -35,7 +39,7 @@
|
|
|
35
39
|
"virtual.d.ts"
|
|
36
40
|
],
|
|
37
41
|
"dependencies": {
|
|
38
|
-
"@because-dev/core": "0.
|
|
42
|
+
"@because-dev/core": "0.4.0"
|
|
39
43
|
},
|
|
40
44
|
"peerDependencies": {
|
|
41
45
|
"astro": "^5.0.0 || ^6.0.0 || ^7.0.0"
|
package/routes/idea.astro
CHANGED
|
@@ -16,16 +16,17 @@ const site = createSite(graph, ctx);
|
|
|
16
16
|
const page = site.page(Astro.params.slug!)!;
|
|
17
17
|
const { idea } = page;
|
|
18
18
|
const { title, description, jsonLd } = ideaHead(page, config.siteName, Astro.site);
|
|
19
|
-
const shellProps = { title, description, homeHref: ctx.siteBase, homeLabel: config.siteName ?? "Home", indexHref: joinPath(ctx.siteBase, config.base, "/") };
|
|
19
|
+
const shellProps = { title, description, heading: idea.title, view: config.view, homeHref: ctx.siteBase, homeLabel: config.siteName ?? "Home", indexHref: joinPath(ctx.siteBase, config.base, "/") };
|
|
20
20
|
---
|
|
21
|
-
<!-- The full-screen map
|
|
21
|
+
<!-- The full-screen map view and article view (or the site's own shell). -->
|
|
22
22
|
<Shell {...shellProps}>
|
|
23
23
|
<Head slot="head" title={idea.title} description={description} jsonLd={jsonLd} />
|
|
24
|
-
<div slot="map" class="bc-map-root" data-because-map data-because-base={graphBase(ctx)} data-because-focus={idea.id} data-because-styles={config.styles ? undefined : "false"}></div>
|
|
24
|
+
<div slot="map" class="bc-map-root" data-because-map data-because-base={graphBase(ctx)} data-because-focus={idea.id} data-because-styles={config.styles ? undefined : "false"} data-because-mount={config.mount ? undefined : "manual"}></div>
|
|
25
25
|
<IdeaArticle page={page} neighbourhood={neighbourhoodHref(ctx, idea.id)} />
|
|
26
26
|
</Shell>
|
|
27
27
|
|
|
28
28
|
<script>
|
|
29
29
|
import { mountAll } from "@because-dev/core/map/mount";
|
|
30
|
-
|
|
30
|
+
// With mount: false the site starts the map itself (see @because-dev/astro/client).
|
|
31
|
+
if (!document.querySelector('[data-because-mount="manual"]')) mountAll();
|
|
31
32
|
</script>
|