@tdacorp/hyle-sdk 0.24.0 → 0.26.1
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 +7 -5
- package/dist/{embed-B7T--kTT.d.cts → brand-CwXvdSkk.d.ts} +14 -2
- package/dist/{embed-DavTgSU4.d.ts → brand-IuZSB9UX.d.cts} +14 -2
- package/dist/check-routes-bin.js +10 -5
- package/dist/{chunk-4REU4HJI.js → chunk-3UQGU62T.js} +22 -5
- package/dist/{chunk-SY2FMIRZ.js → chunk-IDBQSMWT.js} +1 -1
- package/dist/{chunk-5TKJH2XC.js → chunk-NUQQ6VHH.js} +267 -43
- package/dist/{chunk-Y3BACEWA.js → chunk-T4EZAQFU.js} +129 -3
- package/dist/chunk-VAR2B7S6.js +82 -0
- package/dist/{chunk-U74B7AUG.js → chunk-ZWKAEWEW.js} +22 -74
- package/dist/{client-BErei7cE.d.ts → client-B2zi_BGq.d.ts} +11 -4
- package/dist/{client-DrB2vcTi.d.cts → client-DBZTvcCh.d.cts} +11 -4
- package/dist/comments.cjs +25 -1
- package/dist/comments.js +4 -2
- package/dist/html.cjs +129 -3
- package/dist/html.js +1 -1
- package/dist/index.cjs +22 -5
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/next.cjs +674 -211
- package/dist/next.d.cts +44 -18
- package/dist/next.d.ts +44 -18
- package/dist/next.js +241 -135
- package/dist/react.cjs +401 -46
- package/dist/react.d.cts +114 -4
- package/dist/react.d.ts +114 -4
- package/dist/react.js +14 -4
- package/dist/reactions.cjs +25 -1
- package/dist/reactions.js +4 -2
- package/dist/{resolve-03IVloXU.d.cts → resolve-0nGnsIHo.d.cts} +1 -1
- package/dist/{resolve-BseM68oy.d.ts → resolve-CguSaZLa.d.ts} +1 -1
- package/dist/{revalidation-callback-BQl77tQR.d.cts → revalidation-callback-FT9ik1dh.d.cts} +11 -0
- package/dist/{revalidation-callback-BQl77tQR.d.ts → revalidation-callback-FT9ik1dh.d.ts} +11 -0
- package/dist/share-client.cjs +498 -0
- package/dist/share-client.d.cts +99 -0
- package/dist/share-client.d.ts +99 -0
- package/dist/share-client.js +390 -0
- package/dist/styles.css +176 -1
- package/dist/{types-Dx-fEiZd.d.cts → types-CdaIzSjg.d.cts} +10 -3
- package/dist/{types-Dx-fEiZd.d.ts → types-CdaIzSjg.d.ts} +10 -3
- package/dist/use-cache.cjs +10 -5
- package/dist/use-cache.d.cts +3 -3
- package/dist/use-cache.d.ts +3 -3
- package/dist/use-cache.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/react/share/share-client.tsx
|
|
22
|
+
var share_client_exports = {};
|
|
23
|
+
__export(share_client_exports, {
|
|
24
|
+
ShareDrawerClose: () => ShareDrawerClose,
|
|
25
|
+
ShareExpiryChip: () => ShareExpiryChip,
|
|
26
|
+
ShareExpiryNotice: () => ShareExpiryNotice,
|
|
27
|
+
ShareFoldButton: () => ShareFoldButton,
|
|
28
|
+
ShareFrame: () => ShareFrame,
|
|
29
|
+
ShareMenuButton: () => ShareMenuButton,
|
|
30
|
+
ShareSearch: () => ShareSearch,
|
|
31
|
+
ShareThemeMenu: () => ShareThemeMenu,
|
|
32
|
+
drawerTabWrap: () => drawerTabWrap
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(share_client_exports);
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
|
|
37
|
+
// src/react/icons.tsx
|
|
38
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
39
|
+
var SHAPES = {
|
|
40
|
+
info: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
41
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "8", cy: "8", r: "6" }),
|
|
42
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 7.3V11M8 5v.1" })
|
|
43
|
+
] }),
|
|
44
|
+
"check-circle": /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
45
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "8", cy: "8", r: "6" }),
|
|
46
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m5.3 8.3 1.9 1.9 3.5-3.9" })
|
|
47
|
+
] }),
|
|
48
|
+
alert: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 2 1.8 13h12.4zM8 6.5v3M8 11.3v.1" }),
|
|
49
|
+
"x-circle": /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
50
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "8", cy: "8", r: "6" }),
|
|
51
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m5.8 5.8 4.4 4.4M10.2 5.8l-4.4 4.4" })
|
|
52
|
+
] }),
|
|
53
|
+
calendar: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
54
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2", y: "3", width: "12", height: "11", rx: "1.3" }),
|
|
55
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2 6.5h12M5.5 1.7v2.6M10.5 1.7v2.6" })
|
|
56
|
+
] }),
|
|
57
|
+
globe: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
58
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "8", cy: "8", r: "6" }),
|
|
59
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2 8h12M8 2c2 1.7 2.8 3.7 2.8 6S10 12.3 8 14M8 2C6 3.7 5.2 5.7 5.2 8S6 12.3 8 14" })
|
|
60
|
+
] }),
|
|
61
|
+
file: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
62
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4 1.8h5l3 3v8.4a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2.8a1 1 0 0 1 1-1z" }),
|
|
63
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M9 1.8v3h3" })
|
|
64
|
+
] }),
|
|
65
|
+
chev: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m6 3.5 4.5 4.5L6 12.5" }),
|
|
66
|
+
"chev-up": /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m3.5 10 4.5-4.5L12.5 10" }),
|
|
67
|
+
"chev-down": /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m3.5 6 4.5 4.5L12.5 6" }),
|
|
68
|
+
"chev-left": /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M10 3.5 5.5 8 10 12.5" }),
|
|
69
|
+
x: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m4 4 8 8M12 4l-8 8" }),
|
|
70
|
+
important: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3 2.5h10a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H8l-3.5 2.8v-2.8H3a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1zM8 5v2.8M8 9.5v.1" }),
|
|
71
|
+
copy: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
72
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "5.5", y: "5.5", width: "8", height: "8", rx: "1.3" }),
|
|
73
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M10.5 5.5v-2a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2" })
|
|
74
|
+
] }),
|
|
75
|
+
check: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m3 8.5 3.2 3L13 4.5" }),
|
|
76
|
+
heart: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 13.5S2.2 10 2.2 6.1A3 3 0 0 1 8 5a3 3 0 0 1 5.8 1.1C13.8 10 8 13.5 8 13.5z" }),
|
|
77
|
+
reply: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6.5 3.5 2.5 7.5l4 4M2.5 7.5h6a5 5 0 0 1 5 5" }),
|
|
78
|
+
clock: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
79
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "8", cy: "8", r: "6" }),
|
|
80
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 4.5V8l2.3 1.5" })
|
|
81
|
+
] }),
|
|
82
|
+
ban: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "8", cy: "8", r: "6" }),
|
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m3.8 12.2 8.4-8.4" })
|
|
85
|
+
] }),
|
|
86
|
+
refresh: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M13 8a5 5 0 1 1-1.6-3.7M13 2.5v2.8h-2.8" }),
|
|
87
|
+
lock: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
88
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "3", y: "7", width: "10", height: "7", rx: "1.3" }),
|
|
89
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5.2 7V5a2.8 2.8 0 0 1 5.6 0v2" })
|
|
90
|
+
] }),
|
|
91
|
+
search: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
92
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "7", cy: "7", r: "4.5" }),
|
|
93
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m10.5 10.5 3.5 3.5" })
|
|
94
|
+
] }),
|
|
95
|
+
sun: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
96
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "8", cy: "8", r: "2.8" }),
|
|
97
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 1.5v1.8M8 12.7v1.8M1.5 8h1.8M12.7 8h1.8M3.4 3.4l1.3 1.3M11.3 11.3l1.3 1.3M3.4 12.6l1.3-1.3M11.3 4.7l1.3-1.3" })
|
|
98
|
+
] }),
|
|
99
|
+
moon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M13 9.4A5.6 5.6 0 0 1 6.6 3a5.6 5.6 0 1 0 6.4 6.4z" }),
|
|
100
|
+
monitor: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
101
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2", y: "3", width: "12", height: "8", rx: "1.3" }),
|
|
102
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6 14h4M8 11v3" })
|
|
103
|
+
] }),
|
|
104
|
+
sidebar: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
105
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2", y: "3", width: "12", height: "10", rx: "1.3" }),
|
|
106
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6.5 3v10" })
|
|
107
|
+
] }),
|
|
108
|
+
shield: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 1.5 2.5 3.6v4c0 3.2 2.3 5.4 5.5 6.9 3.2-1.5 5.5-3.7 5.5-6.9v-4z" }),
|
|
109
|
+
"arrow-left": /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M13 8H3M7 4 3 8l4 4" }),
|
|
110
|
+
menu: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2.5 4.5h11M2.5 8h11M2.5 11.5h11" })
|
|
111
|
+
};
|
|
112
|
+
function Icon({ name, className }) {
|
|
113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { className: className ? `hyle-ic ${className}` : "hyle-ic", viewBox: "0 0 16 16", "aria-hidden": "true", children: SHAPES[name] });
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// src/react/share/model.ts
|
|
117
|
+
var THEME_COOKIE = "hyle_theme";
|
|
118
|
+
var SIDE_COOKIE = "hyle_share_side";
|
|
119
|
+
var SOON_MS = 24 * 60 * 60 * 1e3;
|
|
120
|
+
function expiryState(expiresAt, now) {
|
|
121
|
+
if (expiresAt === null) return "none";
|
|
122
|
+
const end = Date.parse(expiresAt);
|
|
123
|
+
if (Number.isNaN(end) || now >= end) return "expired";
|
|
124
|
+
return end - now <= SOON_MS ? "soon" : "ok";
|
|
125
|
+
}
|
|
126
|
+
function nextExpiryChange(expiresAt, now) {
|
|
127
|
+
if (expiresAt === null) return null;
|
|
128
|
+
const end = Date.parse(expiresAt);
|
|
129
|
+
if (Number.isNaN(end) || now >= end) return null;
|
|
130
|
+
return end - now > SOON_MS ? end - SOON_MS : end;
|
|
131
|
+
}
|
|
132
|
+
function shareDate(iso, locale) {
|
|
133
|
+
const date = new Date(iso);
|
|
134
|
+
const text = new Intl.DateTimeFormat(locale, { dateStyle: "medium", timeStyle: "short", timeZone: "UTC" }).format(date);
|
|
135
|
+
return `${text} UTC`;
|
|
136
|
+
}
|
|
137
|
+
var SEARCH_LIMIT = 25;
|
|
138
|
+
function searchShare(docs, query) {
|
|
139
|
+
const needle = query.trim().toLowerCase();
|
|
140
|
+
if (needle === "") return [];
|
|
141
|
+
return docs.filter((d) => d.title.toLowerCase().includes(needle) || (d.description ?? "").toLowerCase().includes(needle)).slice(0, SEARCH_LIMIT);
|
|
142
|
+
}
|
|
143
|
+
function actFor(choice) {
|
|
144
|
+
return choice === "system" ? void 0 : choice;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// src/react/share/share-client.tsx
|
|
148
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
149
|
+
var YEAR_SECONDS = 365 * 24 * 60 * 60;
|
|
150
|
+
var MAX_TIMER_MS = 2 ** 31 - 1;
|
|
151
|
+
function writeCookie(name, value) {
|
|
152
|
+
const secure = location.protocol === "https:" ? "; Secure" : "";
|
|
153
|
+
document.cookie = value === null ? `${name}=; Path=/; Max-Age=0; SameSite=Lax${secure}` : `${name}=${value}; Path=/; Max-Age=${YEAR_SECONDS}; SameSite=Lax${secure}`;
|
|
154
|
+
}
|
|
155
|
+
var FrameContext = (0, import_react.createContext)(null);
|
|
156
|
+
function useFrame() {
|
|
157
|
+
const value = (0, import_react.useContext)(FrameContext);
|
|
158
|
+
if (value === null) throw new Error("a share chrome control must sit inside ShareFrame");
|
|
159
|
+
return value;
|
|
160
|
+
}
|
|
161
|
+
var DRAWER_ID = "hyle-side";
|
|
162
|
+
function setPageInert(host, on) {
|
|
163
|
+
host.querySelectorAll(":scope > :not(.hyle-share-body), .hyle-share-body > .hyle-share-main").forEach((el) => {
|
|
164
|
+
if (on) el.setAttribute("inert", "");
|
|
165
|
+
else el.removeAttribute("inert");
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
function drawerTabWrap(count, index, shift) {
|
|
169
|
+
if (count === 0) return null;
|
|
170
|
+
if (index < 0) return shift ? count - 1 : 0;
|
|
171
|
+
if (shift && index === 0) return count - 1;
|
|
172
|
+
if (!shift && index === count - 1) return 0;
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
function ShareFrame({ sidebarOpen, single, act, children, lang }) {
|
|
176
|
+
const root = (0, import_react.useRef)(null);
|
|
177
|
+
const [side, setSide] = (0, import_react.useState)(sidebarOpen ? "open" : "closed");
|
|
178
|
+
const [drawer, setDrawer] = (0, import_react.useState)(false);
|
|
179
|
+
const user = (0, import_react.useRef)(false);
|
|
180
|
+
(0, import_react.useEffect)(() => {
|
|
181
|
+
if (!user.current || single) return;
|
|
182
|
+
root.current?.querySelector(".hyle-share-body")?.setAttribute("data-side", side);
|
|
183
|
+
writeCookie(SIDE_COOKIE, side);
|
|
184
|
+
}, [side, single]);
|
|
185
|
+
(0, import_react.useEffect)(() => {
|
|
186
|
+
const list = root.current?.querySelector(".hyle-side-list");
|
|
187
|
+
const current = list?.querySelector("[aria-current]");
|
|
188
|
+
if (list && current) list.scrollTop = Math.max(0, current.offsetTop - list.clientHeight / 2);
|
|
189
|
+
}, []);
|
|
190
|
+
(0, import_react.useEffect)(() => {
|
|
191
|
+
const aside = root.current?.querySelector(`#${DRAWER_ID}`);
|
|
192
|
+
const host = root.current;
|
|
193
|
+
if (!aside || !host) return;
|
|
194
|
+
const onBeforeToggle = (event) => {
|
|
195
|
+
const open = event.newState === "open";
|
|
196
|
+
setPageInert(host, open);
|
|
197
|
+
if (open) {
|
|
198
|
+
aside.setAttribute("role", "dialog");
|
|
199
|
+
aside.setAttribute("aria-modal", "true");
|
|
200
|
+
} else {
|
|
201
|
+
aside.removeAttribute("role");
|
|
202
|
+
aside.removeAttribute("aria-modal");
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
const onToggle = (event) => {
|
|
206
|
+
const open = event.newState === "open";
|
|
207
|
+
setDrawer(open);
|
|
208
|
+
if (open) aside.querySelector(".hyle-side-x")?.focus();
|
|
209
|
+
};
|
|
210
|
+
const onKey = (event) => {
|
|
211
|
+
if (event.key !== "Tab") return;
|
|
212
|
+
const items = Array.from(aside.querySelectorAll("a[href], button:not([disabled])"));
|
|
213
|
+
const to = drawerTabWrap(items.length, items.indexOf(document.activeElement), event.shiftKey);
|
|
214
|
+
if (to !== null) {
|
|
215
|
+
event.preventDefault();
|
|
216
|
+
items[to]?.focus();
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
aside.addEventListener("beforetoggle", onBeforeToggle);
|
|
220
|
+
aside.addEventListener("toggle", onToggle);
|
|
221
|
+
aside.addEventListener("keydown", onKey);
|
|
222
|
+
const narrowMax = 760;
|
|
223
|
+
const observer = new ResizeObserver(([entry]) => {
|
|
224
|
+
if (entry && entry.contentRect.width > narrowMax && aside.matches(":popover-open")) aside.hidePopover();
|
|
225
|
+
});
|
|
226
|
+
if (root.current) observer.observe(root.current);
|
|
227
|
+
return () => {
|
|
228
|
+
aside.removeEventListener("beforetoggle", onBeforeToggle);
|
|
229
|
+
aside.removeEventListener("toggle", onToggle);
|
|
230
|
+
aside.removeEventListener("keydown", onKey);
|
|
231
|
+
observer.disconnect();
|
|
232
|
+
};
|
|
233
|
+
}, []);
|
|
234
|
+
const value = {
|
|
235
|
+
side,
|
|
236
|
+
drawer,
|
|
237
|
+
toggleSide: () => {
|
|
238
|
+
user.current = true;
|
|
239
|
+
setSide((prev) => prev === "open" ? "closed" : "open");
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(FrameContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ref: root, className: "hyle hyle-share", lang, "data-hyle-chrome": "share", ...act ? { "data-act": act } : {}, children }) });
|
|
243
|
+
}
|
|
244
|
+
function ShareMenuButton({ label }) {
|
|
245
|
+
const frame = useFrame();
|
|
246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: "hyle-bar-btn hyle-bar-menu", "aria-label": label, "aria-controls": DRAWER_ID, "aria-expanded": frame.drawer, popoverTarget: DRAWER_ID, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: "menu" }) });
|
|
247
|
+
}
|
|
248
|
+
function ShareFoldButton({ show, hide }) {
|
|
249
|
+
const frame = useFrame();
|
|
250
|
+
const open = frame.side === "open";
|
|
251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: "hyle-bar-btn hyle-bar-fold", "aria-label": open ? hide : show, "aria-controls": "hyle-side", "aria-expanded": open, onClick: frame.toggleSide, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: "sidebar" }) });
|
|
252
|
+
}
|
|
253
|
+
function ShareDrawerClose({ label }) {
|
|
254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: "hyle-bar-btn hyle-side-x", "aria-label": label, popoverTarget: DRAWER_ID, popoverTargetAction: "hide", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: "x" }) });
|
|
255
|
+
}
|
|
256
|
+
function Highlight({ text, query }) {
|
|
257
|
+
const hit = query === "" ? null : new RegExp(query.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "iu").exec(text);
|
|
258
|
+
if (hit === null) return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: text });
|
|
259
|
+
const at = hit.index;
|
|
260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
261
|
+
text.slice(0, at),
|
|
262
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("mark", { children: text.slice(at, at + hit[0].length) }),
|
|
263
|
+
text.slice(at + hit[0].length)
|
|
264
|
+
] });
|
|
265
|
+
}
|
|
266
|
+
function ShareSearch({ docs, labels, widthClass }) {
|
|
267
|
+
const [query, setQuery] = (0, import_react.useState)("");
|
|
268
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
269
|
+
const [active, setActive] = (0, import_react.useState)(0);
|
|
270
|
+
const [sheet, setSheet] = (0, import_react.useState)(false);
|
|
271
|
+
const field = (0, import_react.useRef)(null);
|
|
272
|
+
const opener = (0, import_react.useRef)(null);
|
|
273
|
+
const wrap = (0, import_react.useRef)(null);
|
|
274
|
+
(0, import_react.useEffect)(() => {
|
|
275
|
+
if (sheet) field.current?.focus();
|
|
276
|
+
}, [sheet]);
|
|
277
|
+
(0, import_react.useEffect)(() => {
|
|
278
|
+
const onKey = (event) => {
|
|
279
|
+
const target = event.target;
|
|
280
|
+
const typing = target !== null && (target.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(target.tagName));
|
|
281
|
+
if (event.key !== "/" || event.ctrlKey || event.metaKey || event.altKey || typing || document.querySelector('.hyle-share [aria-modal="true"]')) return;
|
|
282
|
+
event.preventDefault();
|
|
283
|
+
if (opener.current && getComputedStyle(opener.current).display !== "none") setSheet(true);
|
|
284
|
+
else field.current?.focus();
|
|
285
|
+
};
|
|
286
|
+
document.addEventListener("keydown", onKey);
|
|
287
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
288
|
+
}, []);
|
|
289
|
+
const needle = query.trim();
|
|
290
|
+
const shown = searchShare(docs, needle);
|
|
291
|
+
const count = needle === "" ? "" : shown.length === 1 ? labels.one : labels.count.replace("{n}", String(shown.length));
|
|
292
|
+
const expanded = open && needle !== "" && shown.length > 0;
|
|
293
|
+
const pick = Math.min(active, Math.max(0, shown.length - 1));
|
|
294
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ref: wrap, className: `hyle-search${widthClass ? ` ${widthClass}` : ""}`, role: "search", ...sheet ? { "data-sheet": "" } : {}, children: [
|
|
295
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { ref: opener, type: "button", className: "hyle-bar-btn hyle-search-open", "aria-label": labels.label, onClick: () => {
|
|
296
|
+
setSheet(true);
|
|
297
|
+
setOpen(true);
|
|
298
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: "search" }) }),
|
|
299
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "hyle-search-top", children: [
|
|
300
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", className: "hyle-bar-btn hyle-search-back", "aria-label": labels.close, onClick: () => {
|
|
301
|
+
setSheet(false);
|
|
302
|
+
setQuery("");
|
|
303
|
+
setOpen(false);
|
|
304
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: "arrow-left" }) }),
|
|
305
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "hyle-search-field", children: [
|
|
306
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: "search" }),
|
|
307
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
308
|
+
"input",
|
|
309
|
+
{
|
|
310
|
+
ref: field,
|
|
311
|
+
type: "search",
|
|
312
|
+
role: "combobox",
|
|
313
|
+
"aria-label": labels.label,
|
|
314
|
+
"aria-autocomplete": "list",
|
|
315
|
+
"aria-controls": "hyle-search-list",
|
|
316
|
+
"aria-expanded": expanded,
|
|
317
|
+
"aria-activedescendant": expanded ? `hyle-opt-${pick}` : void 0,
|
|
318
|
+
placeholder: labels.label,
|
|
319
|
+
autoComplete: "off",
|
|
320
|
+
spellCheck: false,
|
|
321
|
+
value: query,
|
|
322
|
+
onFocus: () => setOpen(true),
|
|
323
|
+
onBlur: (event) => {
|
|
324
|
+
if (!wrap.current?.contains(event.relatedTarget)) setOpen(false);
|
|
325
|
+
},
|
|
326
|
+
onChange: (event) => {
|
|
327
|
+
setQuery(event.target.value);
|
|
328
|
+
setActive(0);
|
|
329
|
+
setOpen(true);
|
|
330
|
+
},
|
|
331
|
+
onKeyDown: (event) => {
|
|
332
|
+
if (event.key === "ArrowDown" && shown.length > 0) {
|
|
333
|
+
event.preventDefault();
|
|
334
|
+
setActive((pick + 1) % shown.length);
|
|
335
|
+
} else if (event.key === "ArrowUp" && shown.length > 0) {
|
|
336
|
+
event.preventDefault();
|
|
337
|
+
setActive((pick - 1 + shown.length) % shown.length);
|
|
338
|
+
} else if (event.key === "Enter" && shown[pick]) {
|
|
339
|
+
event.preventDefault();
|
|
340
|
+
window.location.assign(shown[pick].href);
|
|
341
|
+
} else if (event.key === "Escape") {
|
|
342
|
+
if (query !== "") setQuery("");
|
|
343
|
+
else if (sheet) {
|
|
344
|
+
setSheet(false);
|
|
345
|
+
setOpen(false);
|
|
346
|
+
opener.current?.focus();
|
|
347
|
+
} else setOpen(false);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
),
|
|
352
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("kbd", { "aria-hidden": "true", children: "/" })
|
|
353
|
+
] })
|
|
354
|
+
] }),
|
|
355
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "hyle-results", id: "hyle-results", children: needle === "" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "hyle-results-note", children: [
|
|
356
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("b", { children: labels.label }),
|
|
357
|
+
labels.hint
|
|
358
|
+
] }) : shown.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "hyle-results-note", children: [
|
|
359
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("b", { children: labels.none }),
|
|
360
|
+
labels.scope
|
|
361
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { role: "listbox", id: "hyle-search-list", "aria-label": labels.label, children: shown.map((d, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("a", { id: `hyle-opt-${i}`, role: "option", href: d.href, "aria-selected": i === pick, tabIndex: -1, className: "hyle-opt", children: [
|
|
362
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "t", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Highlight, { text: d.title, query: needle }) }),
|
|
363
|
+
d.description ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "s", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Highlight, { text: d.description, query: needle }) }) : null
|
|
364
|
+
] }, d.slug)) }) }) : null,
|
|
365
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "hyle-sr", role: "status", "aria-live": "polite", children: count })
|
|
366
|
+
] });
|
|
367
|
+
}
|
|
368
|
+
var THEME_ICON = { light: "sun", dark: "moon", system: "monitor" };
|
|
369
|
+
function ShareThemeMenu({ choice, labels, htmlTheme = false }) {
|
|
370
|
+
const [current, setCurrent] = (0, import_react.useState)(choice);
|
|
371
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
372
|
+
const button = (0, import_react.useRef)(null);
|
|
373
|
+
const menu = (0, import_react.useRef)(null);
|
|
374
|
+
const names = { light: labels.light, dark: labels.dark, system: labels.system };
|
|
375
|
+
(0, import_react.useEffect)(() => {
|
|
376
|
+
if (!open) return;
|
|
377
|
+
menu.current?.querySelector("[role='menuitemradio'][aria-checked='true']")?.focus();
|
|
378
|
+
const onPress = (event) => {
|
|
379
|
+
if (!button.current?.parentElement?.contains(event.target)) setOpen(false);
|
|
380
|
+
};
|
|
381
|
+
document.addEventListener("pointerdown", onPress);
|
|
382
|
+
return () => document.removeEventListener("pointerdown", onPress);
|
|
383
|
+
}, [open]);
|
|
384
|
+
const apply = (next) => {
|
|
385
|
+
setCurrent(next);
|
|
386
|
+
setOpen(false);
|
|
387
|
+
const act = actFor(next);
|
|
388
|
+
const root = button.current?.closest(".hyle-share");
|
|
389
|
+
if (root) {
|
|
390
|
+
if (act) root.setAttribute("data-act", act);
|
|
391
|
+
else root.removeAttribute("data-act");
|
|
392
|
+
}
|
|
393
|
+
if (htmlTheme) {
|
|
394
|
+
if (act) document.documentElement.setAttribute("data-theme", act);
|
|
395
|
+
else document.documentElement.removeAttribute("data-theme");
|
|
396
|
+
}
|
|
397
|
+
writeCookie(THEME_COOKIE, next === "system" ? null : next);
|
|
398
|
+
button.current?.focus();
|
|
399
|
+
};
|
|
400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "hyle-theme", children: [
|
|
401
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
402
|
+
"button",
|
|
403
|
+
{
|
|
404
|
+
ref: button,
|
|
405
|
+
type: "button",
|
|
406
|
+
className: "hyle-bar-btn",
|
|
407
|
+
"aria-haspopup": "menu",
|
|
408
|
+
"aria-expanded": open,
|
|
409
|
+
"aria-label": `${labels.label}: ${names[current]}`,
|
|
410
|
+
title: `${labels.label}: ${names[current]}`,
|
|
411
|
+
onClick: () => setOpen((v) => !v),
|
|
412
|
+
onKeyDown: (event) => {
|
|
413
|
+
if (event.key === "Escape") setOpen(false);
|
|
414
|
+
},
|
|
415
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: THEME_ICON[current] })
|
|
416
|
+
}
|
|
417
|
+
),
|
|
418
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
419
|
+
"div",
|
|
420
|
+
{
|
|
421
|
+
ref: menu,
|
|
422
|
+
className: "hyle-menu",
|
|
423
|
+
role: "menu",
|
|
424
|
+
"aria-label": labels.label,
|
|
425
|
+
onKeyDown: (event) => {
|
|
426
|
+
const items = Array.from(menu.current?.querySelectorAll("[role='menuitemradio']") ?? []);
|
|
427
|
+
const at = items.indexOf(document.activeElement);
|
|
428
|
+
if (event.key === "Escape") {
|
|
429
|
+
setOpen(false);
|
|
430
|
+
button.current?.focus();
|
|
431
|
+
} else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
432
|
+
event.preventDefault();
|
|
433
|
+
const step = event.key === "ArrowDown" ? 1 : -1;
|
|
434
|
+
items[(at + step + items.length) % items.length]?.focus();
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
children: ["light", "dark", "system"].map((k) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("button", { type: "button", role: "menuitemradio", "aria-checked": k === current, onClick: () => apply(k), children: [
|
|
438
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: THEME_ICON[k] }),
|
|
439
|
+
names[k],
|
|
440
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "ck", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: "check" }) })
|
|
441
|
+
] }, k))
|
|
442
|
+
}
|
|
443
|
+
) : null
|
|
444
|
+
] });
|
|
445
|
+
}
|
|
446
|
+
function useExpiry(expiresAt, initial) {
|
|
447
|
+
const [state, setState] = (0, import_react.useState)(initial);
|
|
448
|
+
(0, import_react.useEffect)(() => {
|
|
449
|
+
const next = nextExpiryChange(expiresAt, Date.now());
|
|
450
|
+
if (next === null) return;
|
|
451
|
+
const timer = setTimeout(() => setState(expiryState(expiresAt, Date.now())), Math.min(MAX_TIMER_MS, Math.max(0, next - Date.now())));
|
|
452
|
+
return () => clearTimeout(timer);
|
|
453
|
+
}, [expiresAt, state]);
|
|
454
|
+
return state;
|
|
455
|
+
}
|
|
456
|
+
function ShareExpiryChip({ expiresAt, initial, locale, labels, width }) {
|
|
457
|
+
const state = useExpiry(expiresAt, initial);
|
|
458
|
+
const when = expiresAt === null ? "" : shareDate(expiresAt, locale);
|
|
459
|
+
const view = {
|
|
460
|
+
none: { icon: "lock", head: labels.protectedTag, exp: labels.noExpiry },
|
|
461
|
+
ok: { icon: "lock", head: labels.protectedTag, exp: labels.expires.replace("{when}", when) },
|
|
462
|
+
soon: { icon: "clock", head: labels.protectedTag, exp: `${labels.expiresSoon}, ${when}` },
|
|
463
|
+
expired: { icon: "x-circle", head: labels.expired, exp: "" }
|
|
464
|
+
}[state];
|
|
465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: `hyle-chip${width ? ` ${width}` : ""}`, "data-state": state, children: [
|
|
466
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: view.icon }),
|
|
467
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("b", { children: view.head }),
|
|
468
|
+
view.exp ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "exp", children: view.exp }) : null
|
|
469
|
+
] });
|
|
470
|
+
}
|
|
471
|
+
function ShareExpiryNotice({ expiresAt, initial, labels }) {
|
|
472
|
+
const state = useExpiry(expiresAt, initial);
|
|
473
|
+
if (state === "soon") {
|
|
474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "hyle-notice", "data-kind": "warn", role: "status", children: [
|
|
475
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: "clock" }),
|
|
476
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("b", { children: labels.soonNotice }) })
|
|
477
|
+
] });
|
|
478
|
+
}
|
|
479
|
+
if (state === "expired") {
|
|
480
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "hyle-notice", "data-kind": "bad", role: "alert", children: [
|
|
481
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { name: "x-circle" }),
|
|
482
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("b", { children: labels.endedNotice }) })
|
|
483
|
+
] });
|
|
484
|
+
}
|
|
485
|
+
return null;
|
|
486
|
+
}
|
|
487
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
488
|
+
0 && (module.exports = {
|
|
489
|
+
ShareDrawerClose,
|
|
490
|
+
ShareExpiryChip,
|
|
491
|
+
ShareExpiryNotice,
|
|
492
|
+
ShareFoldButton,
|
|
493
|
+
ShareFrame,
|
|
494
|
+
ShareMenuButton,
|
|
495
|
+
ShareSearch,
|
|
496
|
+
ShareThemeMenu,
|
|
497
|
+
drawerTabWrap
|
|
498
|
+
});
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/** The protected share chrome's pure parts: expiry states, dates, theme and list cookies. Shared by the server and the client islands. */
|
|
4
|
+
/** The viewer's theme choice (ADR 0040 chrome, decision 120). `system` is no cookie: the OS decides. */
|
|
5
|
+
type ShareThemeChoice = "light" | "dark" | "system";
|
|
6
|
+
type ShareExpiryState = "none" | "ok" | "soon" | "expired";
|
|
7
|
+
|
|
8
|
+
/** Where a Tab inside the open drawer goes: wraps at both ends so focus never leaves it (null lets the browser move focus). */
|
|
9
|
+
declare function drawerTabWrap(count: number, index: number, shift: boolean): number | null;
|
|
10
|
+
/**
|
|
11
|
+
* The root of the chrome. It owns the document list state (collapsed or open, saved in a cookie), the narrow drawer's state for
|
|
12
|
+
* `aria-expanded` and a close when the root stops being narrow (the narrow layout is a container query, so this watches the root's width),
|
|
13
|
+
* and the scroll of the list to the current document. The children are the server's markup.
|
|
14
|
+
*/
|
|
15
|
+
declare function ShareFrame({ sidebarOpen, single, act, children, lang }: {
|
|
16
|
+
readonly sidebarOpen: boolean;
|
|
17
|
+
readonly single: boolean;
|
|
18
|
+
readonly act: "light" | "dark" | undefined;
|
|
19
|
+
readonly children: ReactNode;
|
|
20
|
+
readonly lang: string;
|
|
21
|
+
}): ReactElement;
|
|
22
|
+
/** The narrow menu button that opens the drawer. */
|
|
23
|
+
declare function ShareMenuButton({ label }: {
|
|
24
|
+
readonly label: string;
|
|
25
|
+
}): ReactElement;
|
|
26
|
+
/** The wide button that folds the list away. */
|
|
27
|
+
declare function ShareFoldButton({ show, hide }: {
|
|
28
|
+
readonly show: string;
|
|
29
|
+
readonly hide: string;
|
|
30
|
+
}): ReactElement;
|
|
31
|
+
/** Closes the drawer from its own header (a popover hide target, no script). */
|
|
32
|
+
declare function ShareDrawerClose({ label }: {
|
|
33
|
+
readonly label: string;
|
|
34
|
+
}): ReactElement;
|
|
35
|
+
interface ShareSearchDoc {
|
|
36
|
+
readonly slug: string;
|
|
37
|
+
readonly title: string;
|
|
38
|
+
readonly description: string | null;
|
|
39
|
+
readonly href: string;
|
|
40
|
+
}
|
|
41
|
+
interface ShareSearchLabels {
|
|
42
|
+
readonly label: string;
|
|
43
|
+
readonly hint: string;
|
|
44
|
+
readonly none: string;
|
|
45
|
+
readonly scope: string;
|
|
46
|
+
readonly count: string;
|
|
47
|
+
readonly one: string;
|
|
48
|
+
readonly close: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Search over the titles and descriptions of this share's documents, and nothing else. A combobox whose options are links, so a
|
|
52
|
+
* result opens with Enter. Up and Down move, Escape clears and then closes. The count is announced in a live region.
|
|
53
|
+
*/
|
|
54
|
+
declare function ShareSearch({ docs, labels, widthClass }: {
|
|
55
|
+
readonly docs: readonly ShareSearchDoc[];
|
|
56
|
+
readonly labels: ShareSearchLabels;
|
|
57
|
+
readonly widthClass?: string;
|
|
58
|
+
}): ReactElement;
|
|
59
|
+
interface ShareThemeLabels {
|
|
60
|
+
readonly label: string;
|
|
61
|
+
readonly light: string;
|
|
62
|
+
readonly dark: string;
|
|
63
|
+
readonly system: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Light, dark or system, from a small popover. The choice is one cookie, `hyle_theme`, which hyle's own app reads on the server too.
|
|
67
|
+
* `system` clears it. On the chrome root `data-act` follows the choice (signal tokens flip on it); `htmlTheme` also sets
|
|
68
|
+
* `data-theme` on `<html>`, which hyle's own app uses (its own pages on the share origin).
|
|
69
|
+
*/
|
|
70
|
+
declare function ShareThemeMenu({ choice, labels, htmlTheme }: {
|
|
71
|
+
readonly choice: ShareThemeChoice;
|
|
72
|
+
readonly labels: ShareThemeLabels;
|
|
73
|
+
readonly htmlTheme?: boolean;
|
|
74
|
+
}): ReactElement;
|
|
75
|
+
interface ShareExpiryLabels {
|
|
76
|
+
readonly protectedTag: string;
|
|
77
|
+
readonly noExpiry: string;
|
|
78
|
+
readonly expires: string;
|
|
79
|
+
readonly expiresSoon: string;
|
|
80
|
+
readonly expired: string;
|
|
81
|
+
readonly soonNotice: string;
|
|
82
|
+
readonly endedNotice: string;
|
|
83
|
+
}
|
|
84
|
+
/** The chip in the bar (and under it on a narrow mount): the state in words, the date in text, never colour alone. */
|
|
85
|
+
declare function ShareExpiryChip({ expiresAt, initial, locale, labels, width }: {
|
|
86
|
+
readonly expiresAt: string | null;
|
|
87
|
+
readonly initial: ShareExpiryState;
|
|
88
|
+
readonly locale: string;
|
|
89
|
+
readonly labels: ShareExpiryLabels;
|
|
90
|
+
readonly width?: string;
|
|
91
|
+
}): ReactElement;
|
|
92
|
+
/** The line under the bar: 24 hours before the end, and once the share has ended. Nothing otherwise. */
|
|
93
|
+
declare function ShareExpiryNotice({ expiresAt, initial, labels }: {
|
|
94
|
+
readonly expiresAt: string | null;
|
|
95
|
+
readonly initial: ShareExpiryState;
|
|
96
|
+
readonly labels: ShareExpiryLabels;
|
|
97
|
+
}): ReactElement | null;
|
|
98
|
+
|
|
99
|
+
export { ShareDrawerClose, ShareExpiryChip, type ShareExpiryLabels, ShareExpiryNotice, ShareFoldButton, ShareFrame, ShareMenuButton, ShareSearch, type ShareSearchDoc, type ShareSearchLabels, type ShareThemeLabels, ShareThemeMenu, drawerTabWrap };
|