@concordance-wiki/site 0.1.0 → 0.3.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/README.md +71 -6
- package/assets/css/accessibility.css +8 -1
- package/assets/css/chrome/footer.css +5 -8
- package/assets/css/chrome/panel-handle.css +22 -17
- package/assets/css/chrome/panel.css +6 -0
- package/assets/css/reset.css +4 -0
- package/dist/build/entity-page.d.ts.map +1 -1
- package/dist/build/entity-page.js +19 -6
- package/dist/build/entity-page.js.map +1 -1
- package/dist/slots.d.ts +6 -0
- package/dist/slots.d.ts.map +1 -1
- package/dist/slots.js.map +1 -1
- package/dist/theme/default/attributes.d.ts +9 -0
- package/dist/theme/default/attributes.d.ts.map +1 -1
- package/dist/theme/default/attributes.js +15 -1
- package/dist/theme/default/attributes.js.map +1 -1
- package/dist/theme/default/document-page.d.ts.map +1 -1
- package/dist/theme/default/document-page.js +2 -1
- package/dist/theme/default/document-page.js.map +1 -1
- package/dist/theme/default/meeting-page.d.ts.map +1 -1
- package/dist/theme/default/meeting-page.js +2 -1
- package/dist/theme/default/meeting-page.js.map +1 -1
- package/package.json +13 -13
- package/dist/gallery/spaces.d.ts +0 -15
- package/dist/gallery/spaces.d.ts.map +0 -1
- package/dist/gallery/spaces.js +0 -125
- package/dist/gallery/spaces.js.map +0 -1
- package/dist/islands/trail.client.d.ts +0 -2
- package/dist/islands/trail.client.d.ts.map +0 -1
- package/dist/islands/trail.client.js +0 -12
- package/dist/islands/trail.client.js.map +0 -1
- package/dist/islands/trail.d.ts +0 -95
- package/dist/islands/trail.d.ts.map +0 -1
- package/dist/islands/trail.js +0 -223
- package/dist/islands/trail.js.map +0 -1
- package/dist/theme/default/mentions-more.d.ts +0 -22
- package/dist/theme/default/mentions-more.d.ts.map +0 -1
- package/dist/theme/default/mentions-more.js +0 -25
- package/dist/theme/default/mentions-more.js.map +0 -1
- package/dist/theme/default/trail.d.ts +0 -9
- package/dist/theme/default/trail.d.ts.map +0 -1
- package/dist/theme/default/trail.js +0 -24
- package/dist/theme/default/trail.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trail.client.d.ts","sourceRoot":"","sources":["../../src/islands/trail.client.ts"],"names":[],"mappings":""}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ISLAND_ELEMENT } from "./element.js";
|
|
2
|
-
import { wireTrail } from "./trail.js";
|
|
3
|
-
for (const element of document.querySelectorAll(`${ISLAND_ELEMENT}[data-island="trail"]`)) {
|
|
4
|
-
wireTrail(element, {
|
|
5
|
-
document,
|
|
6
|
-
location,
|
|
7
|
-
history,
|
|
8
|
-
local: localStorage,
|
|
9
|
-
session: sessionStorage,
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=trail.client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trail.client.js","sourceRoot":"","sources":["../../src/islands/trail.client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,KAAK,MAAM,OAAO,IAAI,QAAQ,CAAC,gBAAgB,CAAC,GAAG,cAAc,uBAAuB,CAAC,EAAE,CAAC;IAC1F,SAAS,CAAC,OAAO,EAAE;QACjB,QAAQ;QACR,QAAQ;QACR,OAAO;QACP,KAAK,EAAE,YAAY;QACnB,OAAO,EAAE,cAAc;KACxB,CAAC,CAAC;AACL,CAAC"}
|
package/dist/islands/trail.d.ts
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import type { TrailPage } from "../slots.js";
|
|
2
|
-
/** The key of the pinned trail in `localStorage`, and of the tab's own trail in `sessionStorage`. */
|
|
3
|
-
export declare const TRAIL_STORAGE_KEY = "concordance-trail";
|
|
4
|
-
/** The fragment parameter carrying the trail: `#trail=<id>,<id>`, each identifier URL-encoded. */
|
|
5
|
-
export declare const TRAIL_HASH_PARAMETER = "trail";
|
|
6
|
-
/** How many entries the trail lists in full; beyond, the oldest are condensed into one expandable entry. */
|
|
7
|
-
export declare const TRAIL_SHOWN_MAX = 12;
|
|
8
|
-
/** How many entries the trail keeps at all; beyond, the oldest are dropped so that the URL stays short. */
|
|
9
|
-
export declare const TRAIL_KEPT_MAX = 50;
|
|
10
|
-
/** The part of a storage the trail uses; every call may throw when storage is disabled. */
|
|
11
|
-
export interface TrailStorage {
|
|
12
|
-
getItem(key: string): string | null;
|
|
13
|
-
setItem(key: string, value: string): void;
|
|
14
|
-
removeItem(key: string): void;
|
|
15
|
-
}
|
|
16
|
-
export interface TrailLocation {
|
|
17
|
-
href: string;
|
|
18
|
-
hash: string;
|
|
19
|
-
}
|
|
20
|
-
export interface TrailHistory {
|
|
21
|
-
replaceState(data: unknown, unused: string, url: string): void;
|
|
22
|
-
}
|
|
23
|
-
/** A link of the page, as the click delegate sees it. */
|
|
24
|
-
export interface TrailAnchor {
|
|
25
|
-
/** The absolute URL the link resolves to. */
|
|
26
|
-
href: string;
|
|
27
|
-
getAttribute(name: string): string | null;
|
|
28
|
-
setAttribute(name: string, value: string): void;
|
|
29
|
-
hasAttribute(name: string): boolean;
|
|
30
|
-
}
|
|
31
|
-
/** What the trail needs from the document: creating its elements, and hearing every click of the page. */
|
|
32
|
-
export interface TrailDocument {
|
|
33
|
-
createElement<K extends keyof HTMLElementTagNameMap>(tag: K): HTMLElementTagNameMap[K];
|
|
34
|
-
addEventListener(type: "click", listener: (event: {
|
|
35
|
-
target: EventTarget | null;
|
|
36
|
-
}) => void): void;
|
|
37
|
-
}
|
|
38
|
-
export interface TrailEnvironment {
|
|
39
|
-
document: TrailDocument;
|
|
40
|
-
location: TrailLocation;
|
|
41
|
-
history: TrailHistory;
|
|
42
|
-
/** The pinned trail lives here, between visits. */
|
|
43
|
-
local: TrailStorage;
|
|
44
|
-
/** The trail of this tab lives here, so that a link keeping its own fragment does not lose it. */
|
|
45
|
-
session: TrailStorage;
|
|
46
|
-
}
|
|
47
|
-
/** The island element written at build, holding the serialised props and, once wired, the trail. */
|
|
48
|
-
export interface TrailElement {
|
|
49
|
-
getAttribute(name: string): string | null;
|
|
50
|
-
replaceChildren(...nodes: Node[]): void;
|
|
51
|
-
}
|
|
52
|
-
/** What a storage holds under the key: the pages with their titles, so that a restored trail reads. */
|
|
53
|
-
export interface StoredTrail {
|
|
54
|
-
entries: TrailPage[];
|
|
55
|
-
}
|
|
56
|
-
/** The identifiers of the trail in a fragment, or none when the fragment carries no trail. */
|
|
57
|
-
export declare function parseTrailHash(hash: string): string[] | null;
|
|
58
|
-
export declare function trailHash(ids: readonly string[]): string;
|
|
59
|
-
/** The trail a storage holds, or none when nothing valid is stored or storage cannot be read. */
|
|
60
|
-
export declare function readTrail(storage: TrailStorage): StoredTrail | null;
|
|
61
|
-
/** Stores a trail; a failing storage is ignored, the trail still lives in the page and its URL. */
|
|
62
|
-
export declare function writeTrail(storage: TrailStorage, entries: readonly TrailPage[] | null): void;
|
|
63
|
-
/** The trail with the current page at its end, once, the oldest entries dropped beyond the limit. */
|
|
64
|
-
export declare function appendPage(entries: readonly TrailPage[], current: TrailPage): TrailPage[];
|
|
65
|
-
export interface CondensedTrail {
|
|
66
|
-
/** The oldest entries, at least two when there are any, folded into one summary. */
|
|
67
|
-
earlier: TrailPage[];
|
|
68
|
-
shown: TrailPage[];
|
|
69
|
-
}
|
|
70
|
-
/** Within the limit, everything is shown; beyond, the entries over the limit and one more are condensed. */
|
|
71
|
-
export declare function condense(entries: readonly TrailPage[], max?: number): CondensedTrail;
|
|
72
|
-
export interface ResolvedTrail {
|
|
73
|
-
entries: TrailPage[];
|
|
74
|
-
/** Whether the trail read is the pinned one, so that its growth is stored as well. */
|
|
75
|
-
pinned: boolean;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* The trail of the page: the fragment first, else the tab's own, else the pinned one; the current
|
|
79
|
-
* page appended. Titles come from the storages, a page seen for the first time is named by its
|
|
80
|
-
* identifier.
|
|
81
|
-
*/
|
|
82
|
-
export declare function resolveTrail(hash: string, session: StoredTrail | null, pinned: StoredTrail | null, current: TrailPage | undefined): ResolvedTrail;
|
|
83
|
-
/**
|
|
84
|
-
* Makes an internal link carry the trail: same protocol and host, no fragment of its own (a link
|
|
85
|
-
* to a passage keeps it, the tab's storage carries the trail instead), no download.
|
|
86
|
-
*/
|
|
87
|
-
export declare function carryTrail(anchor: TrailAnchor, hash: string, location: TrailLocation): boolean;
|
|
88
|
-
/**
|
|
89
|
-
* Fills one island with the trail: the pages visited as an ordered list of links, the current one
|
|
90
|
-
* marked, and the pin button; remembers the trail in the tab, in the URL fragment when the page has
|
|
91
|
-
* no fragment of its own, and in the pinned storage when the trail is the pinned one; makes every
|
|
92
|
-
* internal link of the page carry it.
|
|
93
|
-
*/
|
|
94
|
-
export declare function wireTrail(target: TrailElement, env: TrailEnvironment): boolean;
|
|
95
|
-
//# sourceMappingURL=trail.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trail.d.ts","sourceRoot":"","sources":["../../src/islands/trail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,aAAa,CAAC;AAEzD,qGAAqG;AACrG,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAErD,kGAAkG;AAClG,eAAO,MAAM,oBAAoB,UAAU,CAAC;AAE5C,4GAA4G;AAC5G,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC,2GAA2G;AAC3G,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC,2FAA2F;AAC3F,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACpC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,MAA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BAAgB,SAAS,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAyD9E"}
|
package/dist/islands/trail.js
DELETED
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
/** The key of the pinned trail in `localStorage`, and of the tab's own trail in `sessionStorage`. */
|
|
2
|
-
export const TRAIL_STORAGE_KEY = "concordance-trail";
|
|
3
|
-
/** The fragment parameter carrying the trail: `#trail=<id>,<id>`, each identifier URL-encoded. */
|
|
4
|
-
export const TRAIL_HASH_PARAMETER = "trail";
|
|
5
|
-
/** How many entries the trail lists in full; beyond, the oldest are condensed into one expandable entry. */
|
|
6
|
-
export const TRAIL_SHOWN_MAX = 12;
|
|
7
|
-
/** How many entries the trail keeps at all; beyond, the oldest are dropped so that the URL stays short. */
|
|
8
|
-
export const TRAIL_KEPT_MAX = 50;
|
|
9
|
-
/** The identifiers of the trail in a fragment, or none when the fragment carries no trail. */
|
|
10
|
-
export function parseTrailHash(hash) {
|
|
11
|
-
const prefix = `${TRAIL_HASH_PARAMETER}=`;
|
|
12
|
-
const value = hash.replace(/^#/, "");
|
|
13
|
-
if (!value.startsWith(prefix)) {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
const ids = [];
|
|
17
|
-
for (const part of value.slice(prefix.length).split(",")) {
|
|
18
|
-
try {
|
|
19
|
-
const id = decodeURIComponent(part);
|
|
20
|
-
if (id !== "") {
|
|
21
|
-
ids.push(id);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
// A malformed escape: the entry is unreadable, the rest of the trail still is.
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return ids;
|
|
29
|
-
}
|
|
30
|
-
export function trailHash(ids) {
|
|
31
|
-
return `#${TRAIL_HASH_PARAMETER}=${ids.map((id) => encodeURIComponent(id)).join(",")}`;
|
|
32
|
-
}
|
|
33
|
-
/** The fields of a parsed JSON value, all unknown; none for anything but an object. */
|
|
34
|
-
function fields(value) {
|
|
35
|
-
if (typeof value !== "object" || value === null) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
const record = { ...value };
|
|
39
|
-
return record;
|
|
40
|
-
}
|
|
41
|
-
function isPage(value) {
|
|
42
|
-
const record = fields(value);
|
|
43
|
-
return record !== null && typeof record.id === "string" && typeof record.title === "string";
|
|
44
|
-
}
|
|
45
|
-
/** The trail a storage holds, or none when nothing valid is stored or storage cannot be read. */
|
|
46
|
-
export function readTrail(storage) {
|
|
47
|
-
try {
|
|
48
|
-
const raw = storage.getItem(TRAIL_STORAGE_KEY);
|
|
49
|
-
const entries = raw === null ? undefined : fields(JSON.parse(raw))?.entries;
|
|
50
|
-
return Array.isArray(entries) && entries.every(isPage) ? { entries } : null;
|
|
51
|
-
}
|
|
52
|
-
catch {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
/** Stores a trail; a failing storage is ignored, the trail still lives in the page and its URL. */
|
|
57
|
-
export function writeTrail(storage, entries) {
|
|
58
|
-
try {
|
|
59
|
-
if (entries === null) {
|
|
60
|
-
storage.removeItem(TRAIL_STORAGE_KEY);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
storage.setItem(TRAIL_STORAGE_KEY, JSON.stringify({ entries }));
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
catch {
|
|
67
|
-
// Storage disabled: the trail holds for this page only.
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
/** The trail with the current page at its end, once, the oldest entries dropped beyond the limit. */
|
|
71
|
-
export function appendPage(entries, current) {
|
|
72
|
-
const last = entries.at(-1);
|
|
73
|
-
const kept = last?.id === current.id ? entries.slice(0, -1) : entries;
|
|
74
|
-
return [...kept, current].slice(-TRAIL_KEPT_MAX);
|
|
75
|
-
}
|
|
76
|
-
/** Within the limit, everything is shown; beyond, the entries over the limit and one more are condensed. */
|
|
77
|
-
export function condense(entries, max = TRAIL_SHOWN_MAX) {
|
|
78
|
-
if (entries.length <= max) {
|
|
79
|
-
return { earlier: [], shown: [...entries] };
|
|
80
|
-
}
|
|
81
|
-
const cut = entries.length - (max - 1);
|
|
82
|
-
return { earlier: entries.slice(0, cut), shown: entries.slice(cut) };
|
|
83
|
-
}
|
|
84
|
-
function sameIds(entries, ids) {
|
|
85
|
-
return entries.length === ids.length && entries.every((entry, index) => entry.id === ids[index]);
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* The trail of the page: the fragment first, else the tab's own, else the pinned one; the current
|
|
89
|
-
* page appended. Titles come from the storages, a page seen for the first time is named by its
|
|
90
|
-
* identifier.
|
|
91
|
-
*/
|
|
92
|
-
export function resolveTrail(hash, session, pinned, current) {
|
|
93
|
-
const titles = new Map();
|
|
94
|
-
for (const entry of [...(pinned?.entries ?? []), ...(session?.entries ?? [])]) {
|
|
95
|
-
titles.set(entry.id, entry.title);
|
|
96
|
-
}
|
|
97
|
-
const ids = parseTrailHash(hash) ??
|
|
98
|
-
session?.entries.map((entry) => entry.id) ??
|
|
99
|
-
pinned?.entries.map((entry) => entry.id) ??
|
|
100
|
-
[];
|
|
101
|
-
const entries = ids.map((id) => ({ id, title: titles.get(id) ?? id }));
|
|
102
|
-
return {
|
|
103
|
-
entries: current === undefined ? entries : appendPage(entries, current),
|
|
104
|
-
pinned: pinned !== null && sameIds(pinned.entries, ids),
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Makes an internal link carry the trail: same protocol and host, no fragment of its own (a link
|
|
109
|
-
* to a passage keeps it, the tab's storage carries the trail instead), no download.
|
|
110
|
-
*/
|
|
111
|
-
export function carryTrail(anchor, hash, location) {
|
|
112
|
-
let target;
|
|
113
|
-
let page;
|
|
114
|
-
try {
|
|
115
|
-
target = new URL(anchor.href);
|
|
116
|
-
page = new URL(location.href);
|
|
117
|
-
}
|
|
118
|
-
catch {
|
|
119
|
-
return false;
|
|
120
|
-
}
|
|
121
|
-
if (target.protocol !== page.protocol ||
|
|
122
|
-
target.host !== page.host ||
|
|
123
|
-
target.hash !== "" ||
|
|
124
|
-
anchor.hasAttribute("download")) {
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
|
-
anchor.setAttribute("href", `${(anchor.getAttribute("href") ?? "").replace(/#$/, "")}${hash}`);
|
|
128
|
-
return true;
|
|
129
|
-
}
|
|
130
|
-
function element(doc, tag, attributes, children) {
|
|
131
|
-
const node = doc.createElement(tag);
|
|
132
|
-
for (const [name, value] of Object.entries(attributes)) {
|
|
133
|
-
node.setAttribute(name, value);
|
|
134
|
-
}
|
|
135
|
-
node.append(...children);
|
|
136
|
-
return node;
|
|
137
|
-
}
|
|
138
|
-
function list(doc, props, entries, current) {
|
|
139
|
-
return element(doc, "ol", { class: "trail-list" }, entries.map((entry) => element(doc, "li", {}, [
|
|
140
|
-
element(doc, "a", {
|
|
141
|
-
href: `${props.base}${entry.id}/index.html`,
|
|
142
|
-
...(entry === current ? { "aria-current": "page" } : {}),
|
|
143
|
-
}, [entry.title]),
|
|
144
|
-
])));
|
|
145
|
-
}
|
|
146
|
-
function trailList(doc, props, entries) {
|
|
147
|
-
const { earlier, shown } = condense(entries);
|
|
148
|
-
// The current page is the last entry when the page is an entity's; the other pages record none.
|
|
149
|
-
const current = props.current === undefined ? undefined : entries.at(-1);
|
|
150
|
-
const nodes = list(doc, props, shown, current);
|
|
151
|
-
if (earlier.length > 0) {
|
|
152
|
-
const summary = element(doc, "summary", {}, [
|
|
153
|
-
`… ${String(earlier.length)} ${props.labels.earlier}`,
|
|
154
|
-
]);
|
|
155
|
-
const details = element(doc, "details", { class: "trail-earlier" }, [
|
|
156
|
-
summary,
|
|
157
|
-
list(doc, props, earlier, current),
|
|
158
|
-
]);
|
|
159
|
-
nodes.prepend(element(doc, "li", {}, [details]));
|
|
160
|
-
}
|
|
161
|
-
return nodes;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Fills one island with the trail: the pages visited as an ordered list of links, the current one
|
|
165
|
-
* marked, and the pin button; remembers the trail in the tab, in the URL fragment when the page has
|
|
166
|
-
* no fragment of its own, and in the pinned storage when the trail is the pinned one; makes every
|
|
167
|
-
* internal link of the page carry it.
|
|
168
|
-
*/
|
|
169
|
-
export function wireTrail(target, env) {
|
|
170
|
-
// Written by island() at build: the attribute carries the props of the trail.
|
|
171
|
-
const props = JSON.parse(target.getAttribute("data-props") ?? "null");
|
|
172
|
-
if (props === null) {
|
|
173
|
-
return false;
|
|
174
|
-
}
|
|
175
|
-
const doc = env.document;
|
|
176
|
-
const resolved = resolveTrail(env.location.hash, readTrail(env.session), readTrail(env.local), props.current);
|
|
177
|
-
const { entries } = resolved;
|
|
178
|
-
let pinned = resolved.pinned;
|
|
179
|
-
const nav = element(doc, "nav", { class: "trail", "aria-label": props.labels.title }, []);
|
|
180
|
-
if (entries.length === 0) {
|
|
181
|
-
nav.append(element(doc, "p", { class: "trail-empty" }, [props.labels.empty]));
|
|
182
|
-
target.replaceChildren(nav);
|
|
183
|
-
return true;
|
|
184
|
-
}
|
|
185
|
-
const ids = entries.map((entry) => entry.id);
|
|
186
|
-
const hash = trailHash(ids);
|
|
187
|
-
writeTrail(env.session, entries);
|
|
188
|
-
if (pinned) {
|
|
189
|
-
writeTrail(env.local, entries);
|
|
190
|
-
}
|
|
191
|
-
const current = env.location.hash;
|
|
192
|
-
if (current !== hash && (current === "" || parseTrailHash(current) !== null)) {
|
|
193
|
-
try {
|
|
194
|
-
env.history.replaceState(null, "", hash);
|
|
195
|
-
}
|
|
196
|
-
catch {
|
|
197
|
-
// A history that refuses fragments: the links still carry the trail.
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
const button = element(doc, "button", { type: "button", class: "trail-pin" }, []);
|
|
201
|
-
const showPin = () => {
|
|
202
|
-
button.setAttribute("aria-pressed", pinned ? "true" : "false");
|
|
203
|
-
button.textContent = pinned ? props.labels.unpin : props.labels.pin;
|
|
204
|
-
};
|
|
205
|
-
button.addEventListener("click", () => {
|
|
206
|
-
pinned = !pinned;
|
|
207
|
-
writeTrail(env.local, pinned ? entries : null);
|
|
208
|
-
showPin();
|
|
209
|
-
});
|
|
210
|
-
showPin();
|
|
211
|
-
nav.append(trailList(doc, props, entries), button);
|
|
212
|
-
target.replaceChildren(nav);
|
|
213
|
-
doc.addEventListener("click", (event) => {
|
|
214
|
-
// The target is an element, which has `closest`, or the document, which has not; `a[href]` only yields anchors.
|
|
215
|
-
const origin = event.target;
|
|
216
|
-
const anchor = origin.closest?.("a[href]");
|
|
217
|
-
if (anchor !== undefined && anchor !== null) {
|
|
218
|
-
carryTrail(anchor, hash, env.location);
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
return true;
|
|
222
|
-
}
|
|
223
|
-
//# sourceMappingURL=trail.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trail.js","sourceRoot":"","sources":["../../src/islands/trail.ts"],"names":[],"mappings":"AAEA,qGAAqG;AACrG,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC;AAErD,kGAAkG;AAClG,MAAM,CAAC,MAAM,oBAAoB,GAAG,OAAO,CAAC;AAE5C,4GAA4G;AAC5G,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC,2GAA2G;AAC3G,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AAsDjC,8FAA8F;AAC9F,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,MAAM,GAAG,GAAG,oBAAoB,GAAG,CAAC;IAC1C,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACrC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,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
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Component, type JSX } from "preact";
|
|
2
|
-
import type { Mention } from "../../slots.js";
|
|
3
|
-
export interface MentionsMoreProps {
|
|
4
|
-
mentions: Mention[];
|
|
5
|
-
}
|
|
6
|
-
interface MentionsMoreState {
|
|
7
|
-
/** False in the served HTML and until the island mounts: the rest stays reachable in a details element. */
|
|
8
|
-
hydrated: boolean;
|
|
9
|
-
expanded: boolean;
|
|
10
|
-
}
|
|
11
|
-
/** The id of the list the button controls; one mentions panel per page, so one id. */
|
|
12
|
-
export declare const MENTIONS_MORE_LIST = "mentions-more-list";
|
|
13
|
-
/** The mentions beyond the inline threshold: a details element without JavaScript, a disclosure button once hydrated. */
|
|
14
|
-
export declare class MentionsMore extends Component<MentionsMoreProps, MentionsMoreState> {
|
|
15
|
-
state: MentionsMoreState;
|
|
16
|
-
componentDidMount(): void;
|
|
17
|
-
toggle: () => void;
|
|
18
|
-
render(props: Readonly<MentionsMoreProps>, state: Readonly<MentionsMoreState>): JSX.Element;
|
|
19
|
-
}
|
|
20
|
-
export declare const MENTIONS_ISLAND = "mentions-panel";
|
|
21
|
-
export {};
|
|
22
|
-
//# sourceMappingURL=mentions-more.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mentions-more.d.ts","sourceRoot":"","sources":["../../../src/theme/default/mentions-more.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,GAAG,EAAE,MAAM,QAAQ,CAAC;AAE7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAI9C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAED,UAAU,iBAAiB;IACzB,2GAA2G;IAC3G,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,sFAAsF;AACtF,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAEvD,yHAAyH;AACzH,qBAAa,YAAa,SAAQ,SAAS,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IACtE,KAAK,EAAE,iBAAiB,CAAwC;IAEhE,iBAAiB,IAAI,IAAI;IAIlC,MAAM,QAAO,IAAI,CAEf;IAEO,MAAM,CACb,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,EAClC,KAAK,EAAE,QAAQ,CAAC,iBAAiB,CAAC,GACjC,GAAG,CAAC,OAAO;CA4Bf;AAED,eAAO,MAAM,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "preact/jsx-runtime";
|
|
2
|
-
import { Component } from "preact";
|
|
3
|
-
import { labels } from "./labels.js";
|
|
4
|
-
import { MentionList } from "./mention-list.js";
|
|
5
|
-
/** The id of the list the button controls; one mentions panel per page, so one id. */
|
|
6
|
-
export const MENTIONS_MORE_LIST = "mentions-more-list";
|
|
7
|
-
/** The mentions beyond the inline threshold: a details element without JavaScript, a disclosure button once hydrated. */
|
|
8
|
-
export class MentionsMore extends Component {
|
|
9
|
-
state = { hydrated: false, expanded: false };
|
|
10
|
-
componentDidMount() {
|
|
11
|
-
this.setState({ hydrated: true });
|
|
12
|
-
}
|
|
13
|
-
toggle = () => {
|
|
14
|
-
this.setState((state) => ({ expanded: !state.expanded }));
|
|
15
|
-
};
|
|
16
|
-
render(props, state) {
|
|
17
|
-
const count = `(${String(props.mentions.length)})`;
|
|
18
|
-
if (!state.hydrated) {
|
|
19
|
-
return (_jsxs("details", { class: "mentions-more", children: [_jsxs("summary", { children: [labels.showRemaining, " ", count] }), _jsx(MentionList, { mentions: props.mentions })] }));
|
|
20
|
-
}
|
|
21
|
-
return (_jsxs("div", { class: "mentions-more", children: [_jsxs("button", { type: "button", "aria-expanded": state.expanded ? "true" : "false", "aria-controls": MENTIONS_MORE_LIST, onClick: this.toggle, children: [state.expanded ? labels.hideRemaining : labels.showRemaining, " ", count] }), _jsx("div", { id: MENTIONS_MORE_LIST, hidden: !state.expanded, children: _jsx(MentionList, { mentions: props.mentions }) })] }));
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
export const MENTIONS_ISLAND = "mentions-panel";
|
|
25
|
-
//# sourceMappingURL=mentions-more.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mentions-more.js","sourceRoot":"","sources":["../../../src/theme/default/mentions-more.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAY,MAAM,QAAQ,CAAC;AAG7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAYhD,sFAAsF;AACtF,MAAM,CAAC,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEvD,yHAAyH;AACzH,MAAM,OAAO,YAAa,SAAQ,SAA+C;IACtE,KAAK,GAAsB,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAEhE,iBAAiB;QACxB,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,GAAG,GAAS,EAAE;QAClB,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAC5D,CAAC,CAAC;IAEO,MAAM,CACb,KAAkC,EAClC,KAAkC;QAElC,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC;QACnD,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACpB,OAAO,CACL,mBAAS,KAAK,EAAC,eAAe,aAC5B,8BACG,MAAM,CAAC,aAAa,OAAG,KAAK,IACrB,EACV,KAAC,WAAW,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,GAAI,IACjC,CACX,CAAC;QACJ,CAAC;QACD,OAAO,CACL,eAAK,KAAK,EAAC,eAAe,aACxB,kBACE,IAAI,EAAC,QAAQ,mBACE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,mBACjC,kBAAkB,EACjC,OAAO,EAAE,IAAI,CAAC,MAAM,aAEnB,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,OAAG,KAAK,IAC9D,EACT,cAAK,EAAE,EAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,QAAQ,YAClD,KAAC,WAAW,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,GAAI,GACrC,IACF,CACP,CAAC;IACJ,CAAC;CACF;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,gBAAgB,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { JSX } from "preact";
|
|
2
|
-
import type { TrailLabels, TrailProps } from "../../slots.js";
|
|
3
|
-
export declare const TRAIL_ISLAND = "trail";
|
|
4
|
-
/** The labels of the default theme, used when the header receives no trail. */
|
|
5
|
-
export declare const defaultTrailLabels: TrailLabels;
|
|
6
|
-
export declare function Trail({ trail }: {
|
|
7
|
-
trail?: TrailProps;
|
|
8
|
-
}): JSX.Element;
|
|
9
|
-
//# sourceMappingURL=trail.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trail.d.ts","sourceRoot":"","sources":["../../../src/theme/default/trail.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAGlC,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG9D,eAAO,MAAM,YAAY,UAAU,CAAC;AAEpC,+EAA+E;AAC/E,eAAO,MAAM,kBAAkB,EAAE,WAMhC,CAAC;AAYF,wBAAgB,KAAK,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,CAAC,EAAE,UAAU,CAAA;CAAE,GAAG,GAAG,CAAC,OAAO,CAEpE"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "preact/jsx-runtime";
|
|
2
|
-
import { island } from "../../islands/island.js";
|
|
3
|
-
import { labels } from "./labels.js";
|
|
4
|
-
export const TRAIL_ISLAND = "trail";
|
|
5
|
-
/** The labels of the default theme, used when the header receives no trail. */
|
|
6
|
-
export const defaultTrailLabels = {
|
|
7
|
-
title: labels.trailTitle,
|
|
8
|
-
pin: labels.trailPin,
|
|
9
|
-
unpin: labels.trailUnpin,
|
|
10
|
-
empty: labels.trailEmpty,
|
|
11
|
-
earlier: labels.trailEarlier,
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* The island is served empty: the trail lives in the URL fragment and in the reader's storage,
|
|
15
|
-
* which only a script can read, so without JavaScript the region holds nothing and takes no space.
|
|
16
|
-
*/
|
|
17
|
-
function TrailRegion() {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
const TrailIsland = island(TRAIL_ISLAND, TrailRegion);
|
|
21
|
-
export function Trail({ trail }) {
|
|
22
|
-
return _jsx(TrailIsland, { ...(trail ?? { base: "", labels: defaultTrailLabels }) });
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=trail.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trail.js","sourceRoot":"","sources":["../../../src/theme/default/trail.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC;AAEpC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,kBAAkB,GAAgB;IAC7C,KAAK,EAAE,MAAM,CAAC,UAAU;IACxB,GAAG,EAAE,MAAM,CAAC,QAAQ;IACpB,KAAK,EAAE,MAAM,CAAC,UAAU;IACxB,KAAK,EAAE,MAAM,CAAC,UAAU;IACxB,OAAO,EAAE,MAAM,CAAC,YAAY;CAC7B,CAAC;AAEF;;;GAGG;AACH,SAAS,WAAW;IAClB,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,WAAW,GAAG,MAAM,CAAa,YAAY,EAAE,WAAW,CAAC,CAAC;AAElE,MAAM,UAAU,KAAK,CAAC,EAAE,KAAK,EAA0B;IACrD,OAAO,KAAC,WAAW,OAAK,CAAC,KAAK,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC,GAAI,CAAC;AAClF,CAAC"}
|