@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.
Files changed (46) hide show
  1. package/README.md +7 -5
  2. package/dist/{embed-B7T--kTT.d.cts → brand-CwXvdSkk.d.ts} +14 -2
  3. package/dist/{embed-DavTgSU4.d.ts → brand-IuZSB9UX.d.cts} +14 -2
  4. package/dist/check-routes-bin.js +10 -5
  5. package/dist/{chunk-4REU4HJI.js → chunk-3UQGU62T.js} +22 -5
  6. package/dist/{chunk-SY2FMIRZ.js → chunk-IDBQSMWT.js} +1 -1
  7. package/dist/{chunk-5TKJH2XC.js → chunk-NUQQ6VHH.js} +267 -43
  8. package/dist/{chunk-Y3BACEWA.js → chunk-T4EZAQFU.js} +129 -3
  9. package/dist/chunk-VAR2B7S6.js +82 -0
  10. package/dist/{chunk-U74B7AUG.js → chunk-ZWKAEWEW.js} +22 -74
  11. package/dist/{client-BErei7cE.d.ts → client-B2zi_BGq.d.ts} +11 -4
  12. package/dist/{client-DrB2vcTi.d.cts → client-DBZTvcCh.d.cts} +11 -4
  13. package/dist/comments.cjs +25 -1
  14. package/dist/comments.js +4 -2
  15. package/dist/html.cjs +129 -3
  16. package/dist/html.js +1 -1
  17. package/dist/index.cjs +22 -5
  18. package/dist/index.d.cts +4 -4
  19. package/dist/index.d.ts +4 -4
  20. package/dist/index.js +1 -1
  21. package/dist/next.cjs +674 -211
  22. package/dist/next.d.cts +44 -18
  23. package/dist/next.d.ts +44 -18
  24. package/dist/next.js +241 -135
  25. package/dist/react.cjs +401 -46
  26. package/dist/react.d.cts +114 -4
  27. package/dist/react.d.ts +114 -4
  28. package/dist/react.js +14 -4
  29. package/dist/reactions.cjs +25 -1
  30. package/dist/reactions.js +4 -2
  31. package/dist/{resolve-03IVloXU.d.cts → resolve-0nGnsIHo.d.cts} +1 -1
  32. package/dist/{resolve-BseM68oy.d.ts → resolve-CguSaZLa.d.ts} +1 -1
  33. package/dist/{revalidation-callback-BQl77tQR.d.cts → revalidation-callback-FT9ik1dh.d.cts} +11 -0
  34. package/dist/{revalidation-callback-BQl77tQR.d.ts → revalidation-callback-FT9ik1dh.d.ts} +11 -0
  35. package/dist/share-client.cjs +498 -0
  36. package/dist/share-client.d.cts +99 -0
  37. package/dist/share-client.d.ts +99 -0
  38. package/dist/share-client.js +390 -0
  39. package/dist/styles.css +176 -1
  40. package/dist/{types-Dx-fEiZd.d.cts → types-CdaIzSjg.d.cts} +10 -3
  41. package/dist/{types-Dx-fEiZd.d.ts → types-CdaIzSjg.d.ts} +10 -3
  42. package/dist/use-cache.cjs +10 -5
  43. package/dist/use-cache.d.cts +3 -3
  44. package/dist/use-cache.d.ts +3 -3
  45. package/dist/use-cache.js +2 -2
  46. package/package.json +1 -1
@@ -1,3 +1,7 @@
1
+ import {
2
+ Icon
3
+ } from "./chunk-VAR2B7S6.js";
4
+
1
5
  // src/react/comments-api.ts
2
6
  var CSRF_HEADER = "x-hyle-engage";
3
7
  var TIMEOUT_MS = 15e3;
@@ -234,64 +238,9 @@ function newestFirst(thread) {
234
238
  return [...thread.filter((n) => n.status === "held"), ...thread.filter((n) => n.status !== "held").reverse()];
235
239
  }
236
240
 
237
- // src/react/icons.tsx
238
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
239
- var SHAPES = {
240
- info: /* @__PURE__ */ jsxs(Fragment, { children: [
241
- /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6" }),
242
- /* @__PURE__ */ jsx("path", { d: "M8 7.3V11M8 5v.1" })
243
- ] }),
244
- "check-circle": /* @__PURE__ */ jsxs(Fragment, { children: [
245
- /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6" }),
246
- /* @__PURE__ */ jsx("path", { d: "m5.3 8.3 1.9 1.9 3.5-3.9" })
247
- ] }),
248
- alert: /* @__PURE__ */ jsx("path", { d: "M8 2 1.8 13h12.4zM8 6.5v3M8 11.3v.1" }),
249
- "x-circle": /* @__PURE__ */ jsxs(Fragment, { children: [
250
- /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6" }),
251
- /* @__PURE__ */ jsx("path", { d: "m5.8 5.8 4.4 4.4M10.2 5.8l-4.4 4.4" })
252
- ] }),
253
- calendar: /* @__PURE__ */ jsxs(Fragment, { children: [
254
- /* @__PURE__ */ jsx("rect", { x: "2", y: "3", width: "12", height: "11", rx: "1.3" }),
255
- /* @__PURE__ */ jsx("path", { d: "M2 6.5h12M5.5 1.7v2.6M10.5 1.7v2.6" })
256
- ] }),
257
- globe: /* @__PURE__ */ jsxs(Fragment, { children: [
258
- /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6" }),
259
- /* @__PURE__ */ 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" })
260
- ] }),
261
- file: /* @__PURE__ */ jsxs(Fragment, { children: [
262
- /* @__PURE__ */ 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" }),
263
- /* @__PURE__ */ jsx("path", { d: "M9 1.8v3h3" })
264
- ] }),
265
- chev: /* @__PURE__ */ jsx("path", { d: "m6 3.5 4.5 4.5L6 12.5" }),
266
- "chev-up": /* @__PURE__ */ jsx("path", { d: "m3.5 10 4.5-4.5L12.5 10" }),
267
- "chev-down": /* @__PURE__ */ jsx("path", { d: "m3.5 6 4.5 4.5L12.5 6" }),
268
- "chev-left": /* @__PURE__ */ jsx("path", { d: "M10 3.5 5.5 8 10 12.5" }),
269
- x: /* @__PURE__ */ jsx("path", { d: "m4 4 8 8M12 4l-8 8" }),
270
- important: /* @__PURE__ */ 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" }),
271
- copy: /* @__PURE__ */ jsxs(Fragment, { children: [
272
- /* @__PURE__ */ jsx("rect", { x: "5.5", y: "5.5", width: "8", height: "8", rx: "1.3" }),
273
- /* @__PURE__ */ 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" })
274
- ] }),
275
- check: /* @__PURE__ */ jsx("path", { d: "m3 8.5 3.2 3L13 4.5" }),
276
- heart: /* @__PURE__ */ 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" }),
277
- reply: /* @__PURE__ */ jsx("path", { d: "M6.5 3.5 2.5 7.5l4 4M2.5 7.5h6a5 5 0 0 1 5 5" }),
278
- clock: /* @__PURE__ */ jsxs(Fragment, { children: [
279
- /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6" }),
280
- /* @__PURE__ */ jsx("path", { d: "M8 4.5V8l2.3 1.5" })
281
- ] }),
282
- ban: /* @__PURE__ */ jsxs(Fragment, { children: [
283
- /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6" }),
284
- /* @__PURE__ */ jsx("path", { d: "m3.8 12.2 8.4-8.4" })
285
- ] }),
286
- refresh: /* @__PURE__ */ jsx("path", { d: "M13 8a5 5 0 1 1-1.6-3.7M13 2.5v2.8h-2.8" })
287
- };
288
- function Icon({ name, className }) {
289
- return /* @__PURE__ */ jsx("svg", { className: className ? `hyle-ic ${className}` : "hyle-ic", viewBox: "0 0 16 16", "aria-hidden": "true", children: SHAPES[name] });
290
- }
291
-
292
241
  // src/react/reaction-bar.tsx
293
242
  import { useEffect, useRef, useState } from "react";
294
- import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
243
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
295
244
  var reactionKey = (subject, kind) => `${subject}:${kind}`;
296
245
  var kindName = (s, kind) => ({ like: s.reactionLike, love: s.reactionLove, insightful: s.reactionInsightful, celebrate: s.reactionCelebrate })[kind];
297
246
  function settleReactions(overlay, pending, listing) {
@@ -344,40 +293,40 @@ function ReactionBar({ s, scope, subject, likes, counts, likedByMe, mine, overla
344
293
  const on = state?.on ?? serverOn;
345
294
  if (kind !== "like" && !open && !state && count2 === 0) return null;
346
295
  const out = access === "out";
347
- const content = kind !== "like" ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
348
- out ? /* @__PURE__ */ jsx2("span", { className: "hyle-sr", children: s.reactionSignIn }) : null,
296
+ const content = kind !== "like" ? /* @__PURE__ */ jsxs(Fragment, { children: [
297
+ out ? /* @__PURE__ */ jsx("span", { className: "hyle-sr", children: s.reactionSignIn }) : null,
349
298
  kindName(s, kind),
350
299
  " ",
351
- /* @__PURE__ */ jsx2("span", { children: count2 })
352
- ] }) : scope === "article" ? /* @__PURE__ */ jsxs2(Fragment2, { children: [
353
- /* @__PURE__ */ jsx2(Icon, { name: "heart" }),
300
+ /* @__PURE__ */ jsx("span", { children: count2 })
301
+ ] }) : scope === "article" ? /* @__PURE__ */ jsxs(Fragment, { children: [
302
+ /* @__PURE__ */ jsx(Icon, { name: "heart" }),
354
303
  out ? s.likeArticle : on ? s.likedArticle : s.likeArticle,
355
304
  " ",
356
- /* @__PURE__ */ jsx2("span", { className: "hyle-sr", children: out ? s.likeArticleSignIn : ", " }),
357
- /* @__PURE__ */ jsx2("span", { children: count2 })
358
- ] }) : /* @__PURE__ */ jsxs2(Fragment2, { children: [
359
- /* @__PURE__ */ jsx2(Icon, { name: "heart" }),
360
- /* @__PURE__ */ jsx2("span", { className: "hyle-sr", children: out ? s.likeCommentSignIn : s.likeComment }),
361
- /* @__PURE__ */ jsx2("span", { children: count2 })
305
+ /* @__PURE__ */ jsx("span", { className: "hyle-sr", children: out ? s.likeArticleSignIn : ", " }),
306
+ /* @__PURE__ */ jsx("span", { children: count2 })
307
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
308
+ /* @__PURE__ */ jsx(Icon, { name: "heart" }),
309
+ /* @__PURE__ */ jsx("span", { className: "hyle-sr", children: out ? s.likeCommentSignIn : s.likeComment }),
310
+ /* @__PURE__ */ jsx("span", { children: count2 })
362
311
  ] });
363
312
  const cls = kind === "like" ? base : `${base} chip`;
364
- if (out && signInHref) return /* @__PURE__ */ jsx2("a", { className: cls, href: signInHref, children: content }, kind);
365
- if (access !== "in") return /* @__PURE__ */ jsx2("button", { className: cls, type: "button", "aria-disabled": "true", children: content }, kind);
366
- return /* @__PURE__ */ jsx2("button", { ref: kind === "love" ? first : void 0, className: cls, type: "button", "aria-pressed": on, onClick: () => {
313
+ if (out && signInHref) return /* @__PURE__ */ jsx("a", { className: cls, href: signInHref, children: content }, kind);
314
+ if (access !== "in") return /* @__PURE__ */ jsx("button", { className: cls, type: "button", "aria-disabled": "true", children: content }, kind);
315
+ return /* @__PURE__ */ jsx("button", { ref: kind === "love" ? first : void 0, className: cls, type: "button", "aria-pressed": on, onClick: () => {
367
316
  setOpen(false);
368
317
  onToggle(kind, server, serverOn);
369
318
  }, children: content }, kind);
370
319
  }
371
- if (!counts) return /* @__PURE__ */ jsx2(Fragment2, { children: button("like") });
320
+ if (!counts) return /* @__PURE__ */ jsx(Fragment, { children: button("like") });
372
321
  const onKey = (e) => {
373
322
  if (e.key !== "Escape" || !open) return;
374
323
  e.preventDefault();
375
324
  setOpen(false);
376
325
  trigger.current?.focus();
377
326
  };
378
- return /* @__PURE__ */ jsxs2("span", { className: "hyle-reaction-set", role: "group", "aria-label": s.reactions, onKeyDown: onKey, children: [
327
+ return /* @__PURE__ */ jsxs("span", { className: "hyle-reaction-set", role: "group", "aria-label": s.reactions, onKeyDown: onKey, children: [
379
328
  REACTION_KINDS.map(button),
380
- access === "in" ? /* @__PURE__ */ jsx2("button", { ref: trigger, className: scope === "article" ? "hyle-btn" : "hyle-cm-btn", type: "button", "aria-expanded": open, onClick: () => setOpen((v) => !v), children: s.react }) : null
329
+ access === "in" ? /* @__PURE__ */ jsx("button", { ref: trigger, className: scope === "article" ? "hyle-btn" : "hyle-cm-btn", type: "button", "aria-expanded": open, onClick: () => setOpen((v) => !v), children: s.react }) : null
381
330
  ] });
382
331
  }
383
332
 
@@ -391,7 +340,6 @@ export {
391
340
  arrivesAs,
392
341
  arrangeThread,
393
342
  stillUnseen,
394
- Icon,
395
343
  kindName,
396
344
  useReactions,
397
345
  ReactionBar
@@ -1,4 +1,4 @@
1
- import { l as Resolved, h as MountsResult, H as HylePreview, e as HyleProtectedGate, d as HyleProtected } from './types-Dx-fEiZd.js';
1
+ import { m as Resolved, i as MountsResult, H as HylePreview, e as HyleProtectedGate, d as HyleProtected } from './types-CdaIzSjg.js';
2
2
 
3
3
  /** docs/cp1-spec.md section 5.3.3: `hyle.push/1`, the whole-post delivery of a path in push mode (ADR 0025). */
4
4
  declare const MAX_PUSH_BODY_BYTES: number;
@@ -193,6 +193,13 @@ interface AssetOptions {
193
193
  readonly password: string;
194
194
  };
195
195
  }
196
+ interface ProtectedReadOptions {
197
+ /**
198
+ * The visitor's address, sent to hyle as `X-Forwarded-For` so a read made for a visitor is attributable to them. Anything that is
199
+ * not an IPv4 or IPv6 literal is dropped. hyle's site read surface does not read it today (docs/cp1-spec.md section 3.10.3).
200
+ */
201
+ readonly clientIp?: string | undefined;
202
+ }
196
203
  declare function createHyleClient(options: HyleClientOptions): {
197
204
  resolve: (opts: ResolveOptions) => Promise<Resolved>;
198
205
  mounts: (opts?: MountsOptions) => Promise<MountsResult>;
@@ -202,8 +209,8 @@ declare function createHyleClient(options: HyleClientOptions): {
202
209
  readonly init?: HyleRequestInit;
203
210
  }) => Promise<PushPage>;
204
211
  preview: (token: string | undefined) => Promise<HylePreview>;
205
- protectedGate: (slug: string) => Promise<HyleProtectedGate>;
206
- protected: (slug: string, password: string, docSlug?: string) => Promise<HyleProtected>;
212
+ protectedGate: (slug: string, opts?: ProtectedReadOptions) => Promise<HyleProtectedGate>;
213
+ protected: (slug: string, password: string, docSlug?: string, opts?: ProtectedReadOptions) => Promise<HyleProtected>;
207
214
  asset: (file: string, opts?: AssetOptions) => Promise<Response>;
208
215
  theme: (opts?: {
209
216
  readonly timeoutMs?: number;
@@ -211,4 +218,4 @@ declare function createHyleClient(options: HyleClientOptions): {
211
218
  };
212
219
  type HyleClient = ReturnType<typeof createHyleClient>;
213
220
 
214
- export { type AssetOptions as A, type HyleAuth as H, MAX_PUSH_BODY_BYTES as M, type PushEvent as P, type ResolveOptions as R, type HyleClient as a, type HyleClientOptions as b, type HyleCredential as c, type HyleRequestInit as d, type MountsOptions as e, type PushEventType as f, type PushPage as g, type PushPost as h, type PushRoute as i, type PushRouteOptions as j, type PushStore as k, type ResyncOptions as l, type ResyncResult as m, createHyleClient as n, createPushRoute as o, resyncPath as r, staleAfterResync as s };
221
+ export { type AssetOptions as A, type HyleAuth as H, MAX_PUSH_BODY_BYTES as M, type ProtectedReadOptions as P, type ResolveOptions as R, type HyleClient as a, type HyleClientOptions as b, type HyleCredential as c, type HyleRequestInit as d, type MountsOptions as e, type PushEvent as f, type PushEventType as g, type PushPage as h, type PushPost as i, type PushRoute as j, type PushRouteOptions as k, type PushStore as l, type ResyncOptions as m, type ResyncResult as n, createHyleClient as o, createPushRoute as p, resyncPath as r, staleAfterResync as s };
@@ -1,4 +1,4 @@
1
- import { l as Resolved, h as MountsResult, H as HylePreview, e as HyleProtectedGate, d as HyleProtected } from './types-Dx-fEiZd.cjs';
1
+ import { m as Resolved, i as MountsResult, H as HylePreview, e as HyleProtectedGate, d as HyleProtected } from './types-CdaIzSjg.cjs';
2
2
 
3
3
  /** docs/cp1-spec.md section 5.3.3: `hyle.push/1`, the whole-post delivery of a path in push mode (ADR 0025). */
4
4
  declare const MAX_PUSH_BODY_BYTES: number;
@@ -193,6 +193,13 @@ interface AssetOptions {
193
193
  readonly password: string;
194
194
  };
195
195
  }
196
+ interface ProtectedReadOptions {
197
+ /**
198
+ * The visitor's address, sent to hyle as `X-Forwarded-For` so a read made for a visitor is attributable to them. Anything that is
199
+ * not an IPv4 or IPv6 literal is dropped. hyle's site read surface does not read it today (docs/cp1-spec.md section 3.10.3).
200
+ */
201
+ readonly clientIp?: string | undefined;
202
+ }
196
203
  declare function createHyleClient(options: HyleClientOptions): {
197
204
  resolve: (opts: ResolveOptions) => Promise<Resolved>;
198
205
  mounts: (opts?: MountsOptions) => Promise<MountsResult>;
@@ -202,8 +209,8 @@ declare function createHyleClient(options: HyleClientOptions): {
202
209
  readonly init?: HyleRequestInit;
203
210
  }) => Promise<PushPage>;
204
211
  preview: (token: string | undefined) => Promise<HylePreview>;
205
- protectedGate: (slug: string) => Promise<HyleProtectedGate>;
206
- protected: (slug: string, password: string, docSlug?: string) => Promise<HyleProtected>;
212
+ protectedGate: (slug: string, opts?: ProtectedReadOptions) => Promise<HyleProtectedGate>;
213
+ protected: (slug: string, password: string, docSlug?: string, opts?: ProtectedReadOptions) => Promise<HyleProtected>;
207
214
  asset: (file: string, opts?: AssetOptions) => Promise<Response>;
208
215
  theme: (opts?: {
209
216
  readonly timeoutMs?: number;
@@ -211,4 +218,4 @@ declare function createHyleClient(options: HyleClientOptions): {
211
218
  };
212
219
  type HyleClient = ReturnType<typeof createHyleClient>;
213
220
 
214
- export { type AssetOptions as A, type HyleAuth as H, MAX_PUSH_BODY_BYTES as M, type PushEvent as P, type ResolveOptions as R, type HyleClient as a, type HyleClientOptions as b, type HyleCredential as c, type HyleRequestInit as d, type MountsOptions as e, type PushEventType as f, type PushPage as g, type PushPost as h, type PushRoute as i, type PushRouteOptions as j, type PushStore as k, type ResyncOptions as l, type ResyncResult as m, createHyleClient as n, createPushRoute as o, resyncPath as r, staleAfterResync as s };
221
+ export { type AssetOptions as A, type HyleAuth as H, MAX_PUSH_BODY_BYTES as M, type ProtectedReadOptions as P, type ResolveOptions as R, type HyleClient as a, type HyleClientOptions as b, type HyleCredential as c, type HyleRequestInit as d, type MountsOptions as e, type PushEvent as f, type PushEventType as g, type PushPage as h, type PushPost as i, type PushRoute as j, type PushRouteOptions as k, type PushStore as l, type ResyncOptions as m, type ResyncResult as n, createHyleClient as o, createPushRoute as p, resyncPath as r, staleAfterResync as s };
package/dist/comments.cjs CHANGED
@@ -720,7 +720,31 @@ var SHAPES = {
720
720
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "8", cy: "8", r: "6" }),
721
721
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m3.8 12.2 8.4-8.4" })
722
722
  ] }),
723
- refresh: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M13 8a5 5 0 1 1-1.6-3.7M13 2.5v2.8h-2.8" })
723
+ refresh: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M13 8a5 5 0 1 1-1.6-3.7M13 2.5v2.8h-2.8" }),
724
+ lock: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
725
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { x: "3", y: "7", width: "10", height: "7", rx: "1.3" }),
726
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M5.2 7V5a2.8 2.8 0 0 1 5.6 0v2" })
727
+ ] }),
728
+ search: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
729
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "7", cy: "7", r: "4.5" }),
730
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "m10.5 10.5 3.5 3.5" })
731
+ ] }),
732
+ sun: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
733
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "8", cy: "8", r: "2.8" }),
734
+ /* @__PURE__ */ (0, import_jsx_runtime3.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" })
735
+ ] }),
736
+ moon: /* @__PURE__ */ (0, import_jsx_runtime3.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" }),
737
+ monitor: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
738
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { x: "2", y: "3", width: "12", height: "8", rx: "1.3" }),
739
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M6 14h4M8 11v3" })
740
+ ] }),
741
+ sidebar: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
742
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { x: "2", y: "3", width: "12", height: "10", rx: "1.3" }),
743
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M6.5 3v10" })
744
+ ] }),
745
+ shield: /* @__PURE__ */ (0, import_jsx_runtime3.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" }),
746
+ "arrow-left": /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M13 8H3M7 4 3 8l4 4" }),
747
+ menu: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M2.5 4.5h11M2.5 8h11M2.5 11.5h11" })
724
748
  };
725
749
  function Icon({ name, className }) {
726
750
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { className: className ? `hyle-ic ${className}` : "hyle-ic", viewBox: "0 0 16 16", "aria-hidden": "true", children: SHAPES[name] });
package/dist/comments.js CHANGED
@@ -1,6 +1,5 @@
1
1
  "use client";
2
2
  import {
3
- Icon,
4
3
  ReactionBar,
5
4
  arrangeThread,
6
5
  arrivesAs,
@@ -13,7 +12,10 @@ import {
13
12
  nextVote,
14
13
  stillUnseen,
15
14
  useReactions
16
- } from "./chunk-U74B7AUG.js";
15
+ } from "./chunk-ZWKAEWEW.js";
16
+ import {
17
+ Icon
18
+ } from "./chunk-VAR2B7S6.js";
17
19
 
18
20
  // src/react/comments.tsx
19
21
  import { useEffect as useEffect3, useId, useRef as useRef4, useState as useState4 } from "react";
package/dist/html.cjs CHANGED
@@ -724,7 +724,49 @@ var en = {
724
724
  unTitle: "This page is temporarily unavailable",
725
725
  unBody: "The content could not be loaded. Please try again in a moment.",
726
726
  viewer: VIEWER_LABELS_EN,
727
- comments: COMMENT_LABELS_EN
727
+ comments: COMMENT_LABELS_EN,
728
+ share: {
729
+ protectedTag: "Protected",
730
+ lock: "Lock",
731
+ lockTitle: "Lock this share and return to the password page",
732
+ searchLabel: "Search this share",
733
+ searchHint: "Finds words in the titles and descriptions of its documents. Nothing outside the share is searched.",
734
+ searchNone: "No documents match",
735
+ searchScope: "Search covers the titles and descriptions of this share's documents.",
736
+ searchCount: "{n} results",
737
+ searchOne: "1 result",
738
+ open: "Open",
739
+ close: "Close",
740
+ documents: "Documents",
741
+ documentCount: "{n} documents",
742
+ documentPosition: "Document {i} of {n}",
743
+ privateCopy: "Private copy. Never listed or indexed.",
744
+ noExpiry: "No expiry",
745
+ expires: "Expires {when}",
746
+ expiresSoon: "Expires soon",
747
+ expired: "Expired",
748
+ endedNotice: "This share has ended. You can finish this page, but the next one will not open.",
749
+ soonNotice: "This share expires within 24 hours.",
750
+ gateTitle: "Password required",
751
+ gateBody: "Enter the password you were given to open this page.",
752
+ gateWrong: "Wrong or expired password.",
753
+ gatePassword: "Password",
754
+ gateOpen: "Open",
755
+ locked: "Locked",
756
+ attemptsTitle: "Too many attempts",
757
+ attemptsBody: "Try again in {n} seconds.",
758
+ attemptsOne: "Try again in {n} second.",
759
+ unavailableTitle: "This page is not available",
760
+ unavailableBody: "The address may be wrong, or the share may have ended. Ask the person who sent it.",
761
+ theme: "Theme",
762
+ themeLight: "Light",
763
+ themeDark: "Dark",
764
+ themeSystem: "System",
765
+ showDocuments: "Show documents",
766
+ hideDocuments: "Hide documents",
767
+ closeDocuments: "Close documents",
768
+ skip: "Skip to content"
769
+ }
728
770
  };
729
771
  var fr = {
730
772
  toc: "Sur cette page",
@@ -784,7 +826,49 @@ var fr = {
784
826
  unTitle: "Cette page est momentan\xE9ment indisponible",
785
827
  unBody: "Le contenu n'a pas pu \xEAtre charg\xE9. R\xE9essayez dans un instant.",
786
828
  viewer: VIEWER_LABELS_FR,
787
- comments: COMMENT_LABELS_FR
829
+ comments: COMMENT_LABELS_FR,
830
+ share: {
831
+ protectedTag: "Prot\xE9g\xE9",
832
+ lock: "Verrouiller",
833
+ lockTitle: "Verrouiller ce partage et revenir \xE0 la page du mot de passe",
834
+ searchLabel: "Rechercher dans ce partage",
835
+ searchHint: "Recherche des mots dans les titres et descriptions de ses documents. Rien hors du partage n'est recherch\xE9.",
836
+ searchNone: "Aucun document ne correspond",
837
+ searchScope: "La recherche porte sur les titres et descriptions des documents de ce partage.",
838
+ searchCount: "{n} r\xE9sultats",
839
+ searchOne: "1 r\xE9sultat",
840
+ open: "Ouvrir",
841
+ close: "Fermer",
842
+ documents: "Documents",
843
+ documentCount: "{n} documents",
844
+ documentPosition: "Document {i} sur {n}",
845
+ privateCopy: "Copie priv\xE9e. Jamais list\xE9e ni index\xE9e.",
846
+ noExpiry: "Sans expiration",
847
+ expires: "Expire le {when}",
848
+ expiresSoon: "Expire bient\xF4t",
849
+ expired: "Expir\xE9",
850
+ endedNotice: "Ce partage a pris fin. Vous pouvez terminer cette page, mais la suivante ne s'ouvrira pas.",
851
+ soonNotice: "Ce partage expire dans les 24 heures.",
852
+ gateTitle: "Mot de passe requis",
853
+ gateBody: "Saisissez le mot de passe qui vous a \xE9t\xE9 donn\xE9 pour ouvrir cette page.",
854
+ gateWrong: "Mot de passe incorrect ou expir\xE9.",
855
+ gatePassword: "Mot de passe",
856
+ gateOpen: "Ouvrir",
857
+ locked: "Verrouill\xE9",
858
+ attemptsTitle: "Trop de tentatives",
859
+ attemptsBody: "R\xE9essayez dans {n} secondes.",
860
+ attemptsOne: "R\xE9essayez dans {n} seconde.",
861
+ unavailableTitle: "Cette page n'est pas disponible",
862
+ unavailableBody: "L'adresse est peut-\xEAtre erron\xE9e, ou le partage a pris fin. Demandez \xE0 la personne qui vous l'a envoy\xE9.",
863
+ theme: "Th\xE8me",
864
+ themeLight: "Clair",
865
+ themeDark: "Sombre",
866
+ themeSystem: "Syst\xE8me",
867
+ showDocuments: "Afficher les documents",
868
+ hideDocuments: "Masquer les documents",
869
+ closeDocuments: "Fermer les documents",
870
+ skip: "Aller au contenu"
871
+ }
788
872
  };
789
873
  var es = {
790
874
  toc: "En esta p\xE1gina",
@@ -844,7 +928,49 @@ var es = {
844
928
  unTitle: "Esta p\xE1gina no est\xE1 disponible por el momento",
845
929
  unBody: "No se pudo cargar el contenido. Int\xE9ntalo de nuevo en un momento.",
846
930
  viewer: VIEWER_LABELS_ES,
847
- comments: COMMENT_LABELS_ES
931
+ comments: COMMENT_LABELS_ES,
932
+ share: {
933
+ protectedTag: "Protegido",
934
+ lock: "Bloquear",
935
+ lockTitle: "Bloquear este enlace compartido y volver a la p\xE1gina de contrase\xF1a",
936
+ searchLabel: "Buscar en este enlace compartido",
937
+ searchHint: "Busca palabras en los t\xEDtulos y descripciones de sus documentos. No se busca nada fuera del enlace compartido.",
938
+ searchNone: "Ning\xFAn documento coincide",
939
+ searchScope: "La b\xFAsqueda abarca los t\xEDtulos y descripciones de los documentos de este enlace compartido.",
940
+ searchCount: "{n} resultados",
941
+ searchOne: "1 resultado",
942
+ open: "Abrir",
943
+ close: "Cerrar",
944
+ documents: "Documentos",
945
+ documentCount: "{n} documentos",
946
+ documentPosition: "Documento {i} de {n}",
947
+ privateCopy: "Copia privada. Nunca se lista ni se indexa.",
948
+ noExpiry: "Sin caducidad",
949
+ expires: "Caduca el {when}",
950
+ expiresSoon: "Caduca pronto",
951
+ expired: "Caducado",
952
+ endedNotice: "Este enlace compartido ha terminado. Puedes terminar esta p\xE1gina, pero la siguiente no se abrir\xE1.",
953
+ soonNotice: "Este enlace compartido caduca en menos de 24 horas.",
954
+ gateTitle: "Se requiere contrase\xF1a",
955
+ gateBody: "Escribe la contrase\xF1a que te han dado para abrir esta p\xE1gina.",
956
+ gateWrong: "Contrase\xF1a incorrecta o caducada.",
957
+ gatePassword: "Contrase\xF1a",
958
+ gateOpen: "Abrir",
959
+ locked: "Bloqueado",
960
+ attemptsTitle: "Demasiados intentos",
961
+ attemptsBody: "Vuelve a intentarlo en {n} segundos.",
962
+ attemptsOne: "Vuelve a intentarlo en {n} segundo.",
963
+ unavailableTitle: "Esta p\xE1gina no est\xE1 disponible",
964
+ unavailableBody: "La direcci\xF3n puede estar mal, o el enlace compartido ha terminado. Pregunta a quien te lo envi\xF3.",
965
+ theme: "Tema",
966
+ themeLight: "Claro",
967
+ themeDark: "Oscuro",
968
+ themeSystem: "Sistema",
969
+ showDocuments: "Mostrar los documentos",
970
+ hideDocuments: "Ocultar los documentos",
971
+ closeDocuments: "Cerrar los documentos",
972
+ skip: "Ir al contenido"
973
+ }
848
974
  };
849
975
  var TABLE = { en, fr, es };
850
976
  function stringsFor(locale) {
package/dist/html.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  mermaidSource,
4
4
  sanitizeHast,
5
5
  stringsFor
6
- } from "./chunk-Y3BACEWA.js";
6
+ } from "./chunk-T4EZAQFU.js";
7
7
  import "./chunk-BDFMNY76.js";
8
8
 
9
9
  // src/html.ts
package/dist/index.cjs CHANGED
@@ -121,6 +121,8 @@ function applyCredential(headers, credential, method, url) {
121
121
  headers.set("cp-workspace", workspaceId);
122
122
  });
123
123
  }
124
+ var IP_LITERAL = /^[0-9a-fA-F:.]{2,45}$/;
125
+ var visitorHeaders = ({ clientIp }) => clientIp !== void 0 && IP_LITERAL.test(clientIp) ? { "x-forwarded-for": clientIp } : {};
124
126
  var DEFAULT_TIMEOUT_MS = 1e4;
125
127
  var DEFAULT_MAX_RESPONSE_BYTES = 5 * 1024 * 1024;
126
128
  var LOOPBACK = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]"]);
@@ -182,7 +184,7 @@ function createHyleClient(options) {
182
184
  } catch {
183
185
  parsed = void 0;
184
186
  }
185
- return { parsed, status: res.status };
187
+ return { parsed, status: res.status, retryAfter: res.headers.get("retry-after") };
186
188
  }
187
189
  const failure = ({ parsed, status }) => {
188
190
  const err = parsed?.error;
@@ -230,19 +232,22 @@ function createHyleClient(options) {
230
232
  if (data?.cp !== 1 || data.kind !== "preview" || typeof data.expires_at !== "string" || article?.kind !== "article" || article.content?.format !== "hast" || !article.publication) throw failure(reply);
231
233
  return { kind: "preview", expires_at: data.expires_at, article: withAssetQuery(article, `${PREVIEW_PARAM}=${token}`) };
232
234
  }
233
- async function protectedGate(slug) {
235
+ const limited = ({ retryAfter }) => ({ kind: "limited", retryAfterSeconds: Math.min(3600, Math.max(1, Math.trunc(Number(retryAfter)) || 60)) });
236
+ async function protectedGate(slug, opts = {}) {
234
237
  if (!PROTECTED_SLUG.test(slug)) return { kind: "notfound" };
235
- const reply = await get("/cp1/read/_protected/gate", new URLSearchParams({ path: slug }), { cache: "no-store" });
238
+ const reply = await get("/cp1/read/_protected/gate", new URLSearchParams({ path: slug }), { headers: visitorHeaders(opts), cache: "no-store" });
239
+ if (reply.status === 429) return limited(reply);
236
240
  if (reply.status === 404 && reply.parsed?.error?.code === "NOT_FOUND") return { kind: "notfound" };
237
241
  const data = reply.parsed?.data;
238
242
  if (data?.cp === 1 && data.kind === "disabled") return { kind: "disabled" };
239
243
  if (data?.cp === 1 && data.kind === "gate") return { kind: "gate" };
240
244
  throw failure(reply);
241
245
  }
242
- async function protectedShare(slug, password, docSlug) {
246
+ async function protectedShare(slug, password, docSlug, opts = {}) {
243
247
  if (!PROTECTED_SLUG.test(slug) || docSlug !== void 0 && !PROTECTED_DOC_SLUG.test(docSlug) || !PROTECTED_PASSWORD.test(password)) return { kind: "notfound" };
244
248
  const path = docSlug === void 0 ? slug : `${slug}/${docSlug}`;
245
- const reply = await get("/cp1/read/_protected", new URLSearchParams({ path }), { headers: { [PROTECTED_HEADER]: password }, cache: "no-store" });
249
+ const reply = await get("/cp1/read/_protected", new URLSearchParams({ path }), { headers: { ...visitorHeaders(opts), [PROTECTED_HEADER]: password }, cache: "no-store" });
250
+ if (reply.status === 429) return limited(reply);
246
251
  if (reply.status === 404 && reply.parsed?.error?.code === "NOT_FOUND") return { kind: "notfound" };
247
252
  const data = reply.parsed?.data;
248
253
  if (data?.cp === 1 && data.kind === "disabled") return { kind: "disabled" };
@@ -426,6 +431,10 @@ async function runHook(hook, event) {
426
431
  clearTimeout(timer);
427
432
  }
428
433
  }
434
+ function parseIndexUrls(value) {
435
+ if (!Array.isArray(value)) return [];
436
+ return value.flatMap((item) => isRecord(item) && isEventPath(item.path) && isText(item.locale) ? [{ path: item.path, locale: item.locale }] : []);
437
+ }
429
438
  function createRevalidationCallbackRoute(options) {
430
439
  const dedupe = new DeliveryDedupe(options.dedupeCapacity);
431
440
  return {
@@ -478,6 +487,14 @@ function createRevalidationCallbackRoute(options) {
478
487
  const hook = options.onCommentEvent;
479
488
  const event = hook && parseCommentEvent(body);
480
489
  if (hook && event) await runHook(hook, event);
490
+ const indexUrls = parseIndexUrls(body.index_urls);
491
+ if (options.onIndexUrls && indexUrls.length > 0) {
492
+ try {
493
+ options.onIndexUrls(indexUrls);
494
+ } catch {
495
+ console.error("hyle: onIndexUrls failed");
496
+ }
497
+ }
481
498
  return okResponse(purged);
482
499
  }
483
500
  };
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- import { H as HyleAuth, a as HyleClient } from './client-DrB2vcTi.cjs';
2
- export { A as AssetOptions, b as HyleClientOptions, c as HyleCredential, d as HyleRequestInit, M as MAX_PUSH_BODY_BYTES, e as MountsOptions, P as PushEvent, f as PushEventType, g as PushPage, h as PushPost, i as PushRoute, j as PushRouteOptions, k as PushStore, R as ResolveOptions, l as ResyncOptions, m as ResyncResult, n as createHyleClient, o as createPushRoute, r as resyncPath, s as staleAfterResync } from './client-DrB2vcTi.cjs';
3
- export { A as Alternate, a as ArticleContent, B as Breadcrumb, C as CacheInfo, D as DocumentMetaFields, E as EngageComment, b as EngageHeldComment, c as EngageListing, F as Fallback, H as HylePreview, d as HyleProtected, e as HyleProtectedGate, f as HyleProtectedShare, L as ListItem, M as Mount, g as Mounts, h as MountsResult, N as NavItem, i as NavNode, j as NavTree, R as ReactionCounts, k as ReactionKind, l as Resolved, m as ResolvedArticle, n as ResolvedDisabled, o as ResolvedList, p as ResolvedNotFound, q as ResolvedRedirect, T as ThemeRef, r as TocEntry, V as VoteValue } from './types-Dx-fEiZd.cjs';
4
- export { C as CommentEvent, a as CommentEventType, R as RevalidationCallbackOptions, b as RevalidationCallbackRoute, c as RevalidationPayload, d as createRevalidationCallbackRoute, p as parseCommentEvent } from './revalidation-callback-BQl77tQR.cjs';
1
+ import { H as HyleAuth, a as HyleClient } from './client-DBZTvcCh.cjs';
2
+ export { A as AssetOptions, b as HyleClientOptions, c as HyleCredential, d as HyleRequestInit, M as MAX_PUSH_BODY_BYTES, e as MountsOptions, P as ProtectedReadOptions, f as PushEvent, g as PushEventType, h as PushPage, i as PushPost, j as PushRoute, k as PushRouteOptions, l as PushStore, R as ResolveOptions, m as ResyncOptions, n as ResyncResult, o as createHyleClient, p as createPushRoute, r as resyncPath, s as staleAfterResync } from './client-DBZTvcCh.cjs';
3
+ export { A as Alternate, a as ArticleContent, B as Breadcrumb, C as CacheInfo, D as DocumentMetaFields, E as EngageComment, b as EngageHeldComment, c as EngageListing, F as Fallback, H as HylePreview, d as HyleProtected, e as HyleProtectedGate, f as HyleProtectedLimited, g as HyleProtectedShare, L as ListItem, M as Mount, h as Mounts, i as MountsResult, N as NavItem, j as NavNode, k as NavTree, R as ReactionCounts, l as ReactionKind, m as Resolved, n as ResolvedArticle, o as ResolvedDisabled, p as ResolvedList, q as ResolvedNotFound, r as ResolvedRedirect, T as ThemeRef, s as TocEntry, V as VoteValue } from './types-CdaIzSjg.cjs';
4
+ export { C as CommentEvent, a as CommentEventType, R as RevalidationCallbackOptions, b as RevalidationCallbackRoute, c as RevalidationPayload, d as createRevalidationCallbackRoute, p as parseCommentEvent } from './revalidation-callback-FT9ik1dh.cjs';
5
5
 
6
6
  declare class Cp1ClientError extends Error {
7
7
  readonly code: string;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { H as HyleAuth, a as HyleClient } from './client-BErei7cE.js';
2
- export { A as AssetOptions, b as HyleClientOptions, c as HyleCredential, d as HyleRequestInit, M as MAX_PUSH_BODY_BYTES, e as MountsOptions, P as PushEvent, f as PushEventType, g as PushPage, h as PushPost, i as PushRoute, j as PushRouteOptions, k as PushStore, R as ResolveOptions, l as ResyncOptions, m as ResyncResult, n as createHyleClient, o as createPushRoute, r as resyncPath, s as staleAfterResync } from './client-BErei7cE.js';
3
- export { A as Alternate, a as ArticleContent, B as Breadcrumb, C as CacheInfo, D as DocumentMetaFields, E as EngageComment, b as EngageHeldComment, c as EngageListing, F as Fallback, H as HylePreview, d as HyleProtected, e as HyleProtectedGate, f as HyleProtectedShare, L as ListItem, M as Mount, g as Mounts, h as MountsResult, N as NavItem, i as NavNode, j as NavTree, R as ReactionCounts, k as ReactionKind, l as Resolved, m as ResolvedArticle, n as ResolvedDisabled, o as ResolvedList, p as ResolvedNotFound, q as ResolvedRedirect, T as ThemeRef, r as TocEntry, V as VoteValue } from './types-Dx-fEiZd.js';
4
- export { C as CommentEvent, a as CommentEventType, R as RevalidationCallbackOptions, b as RevalidationCallbackRoute, c as RevalidationPayload, d as createRevalidationCallbackRoute, p as parseCommentEvent } from './revalidation-callback-BQl77tQR.js';
1
+ import { H as HyleAuth, a as HyleClient } from './client-B2zi_BGq.js';
2
+ export { A as AssetOptions, b as HyleClientOptions, c as HyleCredential, d as HyleRequestInit, M as MAX_PUSH_BODY_BYTES, e as MountsOptions, P as ProtectedReadOptions, f as PushEvent, g as PushEventType, h as PushPage, i as PushPost, j as PushRoute, k as PushRouteOptions, l as PushStore, R as ResolveOptions, m as ResyncOptions, n as ResyncResult, o as createHyleClient, p as createPushRoute, r as resyncPath, s as staleAfterResync } from './client-B2zi_BGq.js';
3
+ export { A as Alternate, a as ArticleContent, B as Breadcrumb, C as CacheInfo, D as DocumentMetaFields, E as EngageComment, b as EngageHeldComment, c as EngageListing, F as Fallback, H as HylePreview, d as HyleProtected, e as HyleProtectedGate, f as HyleProtectedLimited, g as HyleProtectedShare, L as ListItem, M as Mount, h as Mounts, i as MountsResult, N as NavItem, j as NavNode, k as NavTree, R as ReactionCounts, l as ReactionKind, m as Resolved, n as ResolvedArticle, o as ResolvedDisabled, p as ResolvedList, q as ResolvedNotFound, r as ResolvedRedirect, T as ThemeRef, s as TocEntry, V as VoteValue } from './types-CdaIzSjg.js';
4
+ export { C as CommentEvent, a as CommentEventType, R as RevalidationCallbackOptions, b as RevalidationCallbackRoute, c as RevalidationPayload, d as createRevalidationCallbackRoute, p as parseCommentEvent } from './revalidation-callback-FT9ik1dh.js';
5
5
 
6
6
  declare class Cp1ClientError extends Error {
7
7
  readonly code: string;
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  staleAfterResync,
24
24
  syncHostReserved,
25
25
  verifyHyleSignature
26
- } from "./chunk-4REU4HJI.js";
26
+ } from "./chunk-3UQGU62T.js";
27
27
  import "./chunk-BDFMNY76.js";
28
28
  export {
29
29
  CACHE_TAG_PATTERN,