@abraca/junis 2.87.0 → 2.90.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.
Files changed (109) hide show
  1. package/dist/module.d.mts +43 -4
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +121 -6
  4. package/dist/runtime/assets/css/jun.css +2 -2
  5. package/dist/runtime/components/JunDocSurface.d.vue.ts +20 -2
  6. package/dist/runtime/components/JunDocSurface.vue +27 -2
  7. package/dist/runtime/components/JunDocSurface.vue.d.ts +20 -2
  8. package/dist/runtime/components/JunHead.vue +16 -4
  9. package/dist/runtime/components/JunNavDock.d.vue.ts +15 -0
  10. package/dist/runtime/components/JunNavDock.vue +94 -0
  11. package/dist/runtime/components/JunNavDock.vue.d.ts +15 -0
  12. package/dist/runtime/components/JunNavMenu.client.d.vue.ts +15 -0
  13. package/dist/runtime/components/JunNavMenu.client.vue +501 -0
  14. package/dist/runtime/components/JunNavMenu.client.vue.d.ts +15 -0
  15. package/dist/runtime/components/JunNavPreview.d.vue.ts +17 -0
  16. package/dist/runtime/components/JunNavPreview.vue +169 -0
  17. package/dist/runtime/components/JunNavPreview.vue.d.ts +17 -0
  18. package/dist/runtime/components/JunNavigation.d.vue.ts +4 -11
  19. package/dist/runtime/components/JunNavigation.vue +813 -138
  20. package/dist/runtime/components/JunNavigation.vue.d.ts +4 -11
  21. package/dist/runtime/components/JunNoteLinks.vue +1 -1
  22. package/dist/runtime/components/JunOfflinePanel.client.d.vue.ts +3 -0
  23. package/dist/runtime/components/JunOfflinePanel.client.vue +293 -0
  24. package/dist/runtime/components/JunOfflinePanel.client.vue.d.ts +3 -0
  25. package/dist/runtime/components/JunPageHero.vue +3 -3
  26. package/dist/runtime/components/JunSectionBar.d.vue.ts +41 -0
  27. package/dist/runtime/components/JunSectionBar.vue +144 -0
  28. package/dist/runtime/components/JunSectionBar.vue.d.ts +41 -0
  29. package/dist/runtime/components/renderers/JunConfigRenderer.vue +618 -6
  30. package/dist/runtime/components/renderers/JunEntryRenderer.vue +48 -0
  31. package/dist/runtime/composables/useJunCommands.d.ts +1 -1
  32. package/dist/runtime/composables/useJunCommands.js +14 -1
  33. package/dist/runtime/composables/useJunCreatePage.js +7 -1
  34. package/dist/runtime/composables/useJunDocPage.d.ts +28 -0
  35. package/dist/runtime/composables/useJunDocPage.js +111 -20
  36. package/dist/runtime/composables/useJunGarden.d.ts +1 -1
  37. package/dist/runtime/composables/useJunGarden.js +3 -2
  38. package/dist/runtime/composables/useJunGestures.d.ts +53 -0
  39. package/dist/runtime/composables/useJunGestures.js +89 -0
  40. package/dist/runtime/composables/useJunMenuState.d.ts +4 -0
  41. package/dist/runtime/composables/useJunMenuState.js +5 -0
  42. package/dist/runtime/composables/useJunNavItems.d.ts +50 -0
  43. package/dist/runtime/composables/useJunNavItems.js +188 -0
  44. package/dist/runtime/composables/useJunNavSettings.d.ts +58 -1
  45. package/dist/runtime/composables/useJunNavSettings.js +110 -8
  46. package/dist/runtime/composables/useJunOffline.d.ts +109 -0
  47. package/dist/runtime/composables/useJunOffline.js +294 -0
  48. package/dist/runtime/composables/useJunOptions.d.ts +1 -0
  49. package/dist/runtime/composables/useJunSettings.d.ts +1 -1
  50. package/dist/runtime/composables/useJunSettings.js +2 -0
  51. package/dist/runtime/composables/useJunSiblings.d.ts +30 -0
  52. package/dist/runtime/composables/useJunSiblings.js +38 -0
  53. package/dist/runtime/composables/useJunSiteConfig.d.ts +70 -3
  54. package/dist/runtime/composables/useJunTheme.js +4 -1
  55. package/dist/runtime/composables/useJunViewingAccent.js +10 -0
  56. package/dist/runtime/layouts/jun.vue +32 -2
  57. package/dist/runtime/pages/doc.vue +2 -0
  58. package/dist/runtime/pages/index.vue +2 -0
  59. package/dist/runtime/server/api/health.get.d.ts +15 -0
  60. package/dist/runtime/server/api/health.get.js +7 -2
  61. package/dist/runtime/server/api/links.get.js +27 -3
  62. package/dist/runtime/server/api/offline.get.d.ts +10 -0
  63. package/dist/runtime/server/api/offline.get.js +13 -0
  64. package/dist/runtime/server/api/resolve/[...slug].get.d.ts +20 -0
  65. package/dist/runtime/server/api/resolve/[...slug].get.js +31 -0
  66. package/dist/runtime/server/api/search.get.d.ts +1 -1
  67. package/dist/runtime/server/api/search.get.js +42 -39
  68. package/dist/runtime/server/api/tree.get.js +3 -1
  69. package/dist/runtime/server/janitor/junJanitorChores.d.ts +14 -7
  70. package/dist/runtime/server/janitor/junJanitorChores.js +21 -3
  71. package/dist/runtime/server/janitor/junJanitorMachine.js +36 -4
  72. package/dist/runtime/server/janitor/junJanitorPerform.d.ts +15 -1
  73. package/dist/runtime/server/janitor/junJanitorPerform.js +13 -5
  74. package/dist/runtime/server/janitor/junJanitorYText.d.ts +40 -3
  75. package/dist/runtime/server/janitor/junJanitorYText.js +60 -14
  76. package/dist/runtime/server/plugins/jun-compress.d.ts +2 -0
  77. package/dist/runtime/server/plugins/jun-compress.js +76 -0
  78. package/dist/runtime/server/plugins/jun-janitor.js +132 -81
  79. package/dist/runtime/server/routes/jun-card.png.get.d.ts +2 -0
  80. package/dist/runtime/server/routes/jun-card.png.get.js +40 -0
  81. package/dist/runtime/server/routes/jun-sw.js.get.js +66 -13
  82. package/dist/runtime/server/routes/sitemap.xml.get.js +5 -18
  83. package/dist/runtime/server/utils/junCard.d.ts +39 -0
  84. package/dist/runtime/server/utils/junCard.js +159 -0
  85. package/dist/runtime/server/utils/junIcon.d.ts +27 -2
  86. package/dist/runtime/server/utils/junIcon.js +5 -5
  87. package/dist/runtime/server/utils/junJanitorStatus.d.ts +59 -0
  88. package/dist/runtime/server/utils/junJanitorStatus.js +27 -0
  89. package/dist/runtime/server/utils/junPages.d.ts +51 -0
  90. package/dist/runtime/server/utils/junPages.js +70 -0
  91. package/dist/runtime/types.d.ts +295 -0
  92. package/dist/runtime/utils/junAdopt.d.ts +43 -0
  93. package/dist/runtime/utils/junAdopt.js +7 -0
  94. package/dist/runtime/utils/junGesture.d.ts +84 -0
  95. package/dist/runtime/utils/junGesture.js +40 -0
  96. package/dist/runtime/utils/junLetters.d.ts +86 -0
  97. package/dist/runtime/utils/junLetters.js +173 -0
  98. package/dist/runtime/utils/junNavValue.d.ts +56 -0
  99. package/dist/runtime/utils/junNavValue.js +36 -0
  100. package/dist/runtime/utils/junOffline.d.ts +138 -0
  101. package/dist/runtime/utils/junOffline.js +73 -0
  102. package/dist/runtime/utils/junSearchRank.d.ts +79 -0
  103. package/dist/runtime/utils/junSearchRank.js +73 -0
  104. package/dist/runtime/utils/junSocial.d.ts +59 -0
  105. package/dist/runtime/utils/junSocial.js +56 -0
  106. package/dist/runtime/utils/junViewSpecs.d.ts +39 -1
  107. package/dist/runtime/utils/junViewSpecs.js +92 -1
  108. package/dist/types.d.mts +1 -1
  109. package/package.json +13 -9
@@ -99,6 +99,36 @@ export interface JunFeatures {
99
99
  search?: boolean;
100
100
  /** `/feed.xml` (Atom) + `/feed.json` (JSON Feed 1.1). */
101
101
  feeds?: boolean;
102
+ /**
103
+ * Swipe gestures — page to page, and from the edge.
104
+ *
105
+ * The build-time master switch: `false` and no gesture code is wired at all.
106
+ * Per-gesture choices live in the Site Config, so an owner can turn one off
107
+ * without a redeploy.
108
+ */
109
+ gestures?: boolean;
110
+ /**
111
+ * Pin the visual viewport — `maximum-scale=1, user-scalable=no`.
112
+ *
113
+ * OFF, and it used to be hard-coded ON. The reasoning that put it there is
114
+ * about the LOCKED page types, whose fixed layers drift when the visual
115
+ * viewport scales; it was applied to the whole site, including pages that are
116
+ * nothing but prose. Blocking pinch zoom is WCAG 1.4.4, and iOS has ignored
117
+ * the flag since iOS 10 — so the cost was paid entirely by Android and
118
+ * desktop readers who wanted larger text, and the benefit was collected on
119
+ * one platform that was never listening.
120
+ */
121
+ lockZoom?: boolean;
122
+ /**
123
+ * `/jun-card.png` — a link-preview card DRAWN per page, from the site's own
124
+ * mark and accent.
125
+ *
126
+ * Only ever a fallback: a document naming its own `meta.socialImage`, or a
127
+ * site with `seoOgImage` set, keeps what it chose. Turn this off and pages
128
+ * with no image of their own simply have none, which is what they had
129
+ * before it existed.
130
+ */
131
+ socialCards?: boolean;
102
132
  /** `/sitemap.xml` from the persisted slug map. */
103
133
  sitemap?: boolean;
104
134
  /** Visitor writes over RPC v1: guestbook signing, reactions, scheduled publishing. */
@@ -324,6 +354,98 @@ export type JunNavSize = 'sm' | 'md' | 'lg';
324
354
  export type JunNavItemMode = 'text' | 'icon' | 'icon-focus' | 'icon-text' | 'icon-stack';
325
355
  /** How the ACTIVE item is marked. */
326
356
  export type JunNavActiveStyle = 'underline' | 'pill' | 'dot' | 'bold' | 'glow' | 'box' | 'bracket';
357
+ /**
358
+ * How navigation renders on a PHONE.
359
+ *
360
+ * `track` is what this navbar has always done — the same horizontally
361
+ * scrolling row of items as the desktop, narrower. It stays the default, so a
362
+ * site that upgrades and touches nothing is unchanged.
363
+ *
364
+ * The other six replace the track below `breakpoint` with a TRIGGER and an
365
+ * overlay, which is the thing a scrolling track cannot be: a list you can read
366
+ * without scrubbing, with room for child pages and the actions that live in
367
+ * the palette on desktop.
368
+ *
369
+ * - `sheet` — a bottom sheet. Thumb-reachable, drag down to dismiss.
370
+ * - `drawer-left` /
371
+ * `drawer-right` — a side panel with a scrim.
372
+ * - `fullscreen` — the whole viewport, one item per line.
373
+ * - `grid` — the whole viewport, an icon grid.
374
+ * - `dock` — no overlay at rest: a fixed bottom tab bar of icons, with
375
+ * the items that do not fit behind a `⋯` tab that opens the
376
+ * sheet. The one mode that OCCUPIES space rather than
377
+ * floating, so it publishes its height the way a rail
378
+ * publishes its width.
379
+ */
380
+ /**
381
+ * How the section bar draws itself.
382
+ *
383
+ * `row` scrolls like the main track and takes any number of pages; `segmented`
384
+ * is a pill group and stops looking like one past four or five; `tabs` is the
385
+ * documentation-site shape, underlined and quiet.
386
+ */
387
+ export type JunNavSectionMode = 'off' | 'row' | 'segmented' | 'tabs';
388
+ /**
389
+ * What a nav item's badge counts.
390
+ *
391
+ * `children` is a fact about the SITE and shows on every visit; `new` is a fact
392
+ * about the READER and shows nothing until they have a previous visit to be
393
+ * "since" — a first-time visitor with every item badged is being told the size
394
+ * of a site they have not seen, which is noise dressed as news.
395
+ */
396
+ export type JunNavCountMode = 'off' | 'children' | 'new';
397
+ export type JunNavMobileMode = 'track' | 'sheet' | 'drawer-left' | 'drawer-right' | 'fullscreen' | 'grid' | 'dock';
398
+ /**
399
+ * Where the bar itself sits on a phone, independently of the desktop choice.
400
+ *
401
+ * `inherit` keeps the site's `placement`, which is what happened before this
402
+ * existed. The other three exist because the right answer genuinely differs by
403
+ * viewport: a floating pill under the top edge is a desktop shape, and a bar
404
+ * within thumb reach is a phone one.
405
+ */
406
+ export type JunNavMobilePlacement = 'inherit' | 'top' | 'top-bar' | 'bottom';
407
+ /** The viewport width below which the MOBILE mode applies. Tailwind's scale. */
408
+ export type JunNavBreakpoint = 'sm' | 'md' | 'lg';
409
+ /**
410
+ * The width at or above which a rail is a rail. Below it the rail falls back to
411
+ * the top pill, because a vertical bar on a narrow viewport eats the page.
412
+ * `lg` is the value that was hard-coded here before it was a setting.
413
+ */
414
+ export type JunNavRailBreakpoint = 'md' | 'lg' | 'xl';
415
+ /** The glyph on the menu trigger. */
416
+ export type JunNavMenuIcon = 'menu' | 'grid' | 'dots' | 'chevron';
417
+ /** Which end of the bar the menu trigger sits at. */
418
+ export type JunNavMenuSide = 'left' | 'right';
419
+ /**
420
+ * How items render inside the mobile menu. `inherit` uses the site's
421
+ * `itemMode`, which is the right default and a poor forced choice: `icon-focus`
422
+ * is a hover mode, and a phone has no hover.
423
+ */
424
+ export type JunNavMobileItemMode = 'inherit' | JunNavItemMode;
425
+ /**
426
+ * What a horizontal track does when its items do not fit.
427
+ *
428
+ * - `scroll` — scroll them, with arrows over the edges. Today's behaviour.
429
+ * - `wrap` — a second row. Nothing hides, the bar grows.
430
+ * - `more` — the items that do not fit collapse into a `⋯` dropdown, which
431
+ * is the one option where every page is reachable without a
432
+ * gesture.
433
+ * - `shrink` — the track drops to icons rather than scrolling, and only
434
+ * scrolls if even that does not fit.
435
+ */
436
+ export type JunNavOverflow = 'scroll' | 'wrap' | 'more' | 'shrink';
437
+ /**
438
+ * Whether a nav item discloses its CHILD pages, and on what.
439
+ *
440
+ * The tree already knows them — this is the navbar finally saying so. Every
441
+ * mode is an OVERLAY, so the rule that placement never displaces content
442
+ * survives: a dropdown floats, `mega` floats wider.
443
+ */
444
+ export type JunNavChildrenMode = 'none' | 'hover' | 'click' | 'mega';
445
+ /** How the item row sits in the space it has. `center` is today's `mx-auto`. */
446
+ export type JunNavAlign = 'center' | 'start' | 'end' | 'spread';
447
+ /** The panel's maximum width. `contained` is today's `max-w-6xl`. */
448
+ export type JunNavWidth = 'contained' | 'narrow' | 'wide' | 'full';
327
449
  /**
328
450
  * What pressing the navbar's logo does.
329
451
  *
@@ -391,6 +513,61 @@ export interface JunNavigationOptions {
391
513
  * without the second, and off is the more private default for both.
392
514
  */
393
515
  travellersList?: boolean;
516
+ /**
517
+ * A second row under the navbar carrying the CURRENT SECTION — the pages
518
+ * beside this one, inside the top-level branch it belongs to.
519
+ *
520
+ * The navbar knows the whole site and the breadcrumb names the trail; nothing
521
+ * offered the reader the rest of the section they are in without going back
522
+ * up to it. `off` is what the site did before this existed.
523
+ */
524
+ section?: JunNavSectionMode;
525
+ /**
526
+ * A NUMBER on a nav item — how many pages are in it, or how many have changed
527
+ * since this browser last looked. `off` is what the navbar always did.
528
+ */
529
+ counts?: JunNavCountMode;
530
+ /** How navigation renders below `breakpoint`. `track` is what it always did. */
531
+ mobileMode?: JunNavMobileMode;
532
+ /** A phone-only placement, or `inherit` to keep the site's. */
533
+ mobilePlacement?: JunNavMobilePlacement;
534
+ /** The width below which `mobileMode` applies. */
535
+ breakpoint?: JunNavBreakpoint;
536
+ /** The glyph on the menu trigger. */
537
+ menuIcon?: JunNavMenuIcon;
538
+ /** Which end of the bar the trigger sits at. */
539
+ menuSide?: JunNavMenuSide;
540
+ /** Item rendering inside the menu, or `inherit`. */
541
+ mobileItemMode?: JunNavMobileItemMode;
542
+ /** Child pages as an accordion inside the menu. */
543
+ menuChildren?: boolean;
544
+ /** Search, theme and the studio entry inside the menu. */
545
+ menuExtras?: boolean;
546
+ /**
547
+ * Collapse the DESKTOP navbar into the same menu.
548
+ *
549
+ * For a site whose navigation is deliberately one button. Off, because a
550
+ * navbar that hides its pages behind a click is a choice and not a default.
551
+ */
552
+ desktopMenu?: boolean;
553
+ /** What the track does when the items do not fit. */
554
+ overflow?: JunNavOverflow;
555
+ /** Whether items disclose their child pages, and on what. */
556
+ children?: JunNavChildrenMode;
557
+ /** How the item row sits in the space it has. */
558
+ align?: JunNavAlign;
559
+ /** The panel's maximum width. */
560
+ width?: JunNavWidth;
561
+ /** A hairline between items. */
562
+ separators?: boolean;
563
+ /** The chevrons over the track's scrolling edges. */
564
+ scrollArrows?: boolean;
565
+ /** A gradient mask on the track's edges, so items fade rather than cut. */
566
+ edgeFade?: boolean;
567
+ /** Scroll-snap the track. Proximity, never mandatory — see `JunNavigation`. */
568
+ snap?: boolean;
569
+ /** The width at which a rail stops falling back to the top pill. */
570
+ railBreakpoint?: JunNavRailBreakpoint;
394
571
  }
395
572
  /**
396
573
  * Which corner the hearth sits in. All four are viewport-fixed and float over
@@ -569,6 +746,14 @@ export interface JunBrand {
569
746
  * The Site Config document's `seoDescription` overrides it per deployment.
570
747
  * Falls back to `tagline` when unset.
571
748
  */
749
+ /**
750
+ * The site's language, as a BCP-47 tag — `en`, `de`, `pt-BR`.
751
+ *
752
+ * `<html lang>` was hard-coded `en` in every site this module has ever built,
753
+ * which is what a screen reader announces in and what a translation tool
754
+ * trusts. The Site Config's `seoLang` overrides it per deployment.
755
+ */
756
+ lang?: string;
572
757
  seoDescription?: string;
573
758
  /**
574
759
  * The author avatar shown by the Live and Journal renderers. A public path
@@ -671,6 +856,24 @@ export interface JunSiteConfigDefaults {
671
856
  navShowIndices?: boolean;
672
857
  navKeyboardNav?: boolean;
673
858
  navFreshnessDots?: boolean;
859
+ navMobileMode?: JunNavMobileMode;
860
+ navMobilePlacement?: JunNavMobilePlacement;
861
+ navBreakpoint?: JunNavBreakpoint;
862
+ navMenuIcon?: JunNavMenuIcon;
863
+ navMenuSide?: JunNavMenuSide;
864
+ navMobileItemMode?: JunNavMobileItemMode;
865
+ navMenuChildren?: boolean;
866
+ navMenuExtras?: boolean;
867
+ navDesktopMenu?: boolean;
868
+ navOverflow?: JunNavOverflow;
869
+ navChildren?: JunNavChildrenMode;
870
+ navAlign?: JunNavAlign;
871
+ navWidth?: JunNavWidth;
872
+ navSeparators?: boolean;
873
+ navScrollArrows?: boolean;
874
+ navEdgeFade?: boolean;
875
+ navSnap?: boolean;
876
+ navRailBreakpoint?: JunNavRailBreakpoint;
674
877
  themeRadius?: 'none' | 'sm' | 'md' | 'lg' | 'xl';
675
878
  themeAccent?: string;
676
879
  themeNeutral?: 'slate' | 'zinc' | 'stone';
@@ -800,6 +1003,71 @@ export interface JunMosaicOptions {
800
1003
  */
801
1004
  maxDepth?: number;
802
1005
  }
1006
+ /**
1007
+ * What an offline copy of this site may contain — the BUILD's answer.
1008
+ *
1009
+ * Every key here is a ceiling the Site Config can lower and an owner can see;
1010
+ * none of them is a promise that anything is downloaded. The default posture is
1011
+ * the conservative one throughout: a visitor gets the pages they actually
1012
+ * opened, and everything beyond that is something they pressed a button for.
1013
+ *
1014
+ * See `runtime/utils/junOffline.ts` for the tiers themselves.
1015
+ */
1016
+ /**
1017
+ * When a link fetches the page behind it.
1018
+ *
1019
+ * - `'interaction'` — on hover or keyboard focus. The module's default.
1020
+ * - `'visibility'` — when the link scrolls into view. Nuxt's own default, and
1021
+ * the reason a jun-is site shipped 160 unasked-for chunks after first paint.
1022
+ * - `false` — never; a navigation pays its own cost.
1023
+ */
1024
+ export type JunPrefetchPolicy = 'interaction' | 'visibility';
1025
+ export interface JunOfflineOptions {
1026
+ /**
1027
+ * Offer a saved copy at all.
1028
+ *
1029
+ * Off means the panel does not exist and the worker keeps only what a
1030
+ * navigation happened to fill — which is still an offline site, just not a
1031
+ * configurable one.
1032
+ */
1033
+ enabled?: boolean;
1034
+ /**
1035
+ * What a device that has never chosen gets.
1036
+ *
1037
+ * `visited` — keep the pages this reader opens. The default, and the only
1038
+ * setting that downloads nothing on its own.
1039
+ * `off` — hold no cache at all. For a site whose readers should never have
1040
+ * its content sitting on their device.
1041
+ *
1042
+ * Note there is deliberately no `site` here: a whole-site copy is 26 MB on
1043
+ * the playground, and a DEFAULT that spends somebody's data allowance is the
1044
+ * behaviour this whole surface exists to prevent.
1045
+ */
1046
+ defaultMode?: 'off' | 'visited';
1047
+ /** May a visitor save the whole site in one press? */
1048
+ fullSite?: boolean;
1049
+ /**
1050
+ * May images be part of a saved copy?
1051
+ *
1052
+ * **Off.** This is the half that turns a copy of the writing into a copy of
1053
+ * the photographs, and its size is a property of the site's content rather
1054
+ * than of its page count — so it is the one thing here nobody can estimate
1055
+ * for an owner in advance.
1056
+ */
1057
+ media?: boolean;
1058
+ /** Ceiling on ONE saved copy, in megabytes. The save stops and says so. */
1059
+ budgetMb?: number;
1060
+ /**
1061
+ * Offer the CRDT half — every document synced into IndexedDB, so the site is
1062
+ * EDITABLE offline rather than merely readable.
1063
+ *
1064
+ * Owner-only and off by default. `@abraca/nuxt` will do this automatically
1065
+ * (`features.backgroundSync` defaults to on and its plugin calls `syncAll()`
1066
+ * on first sync); this module contributes `false` so a consumer inherits the
1067
+ * conservative half, and turns it back on for one person who asked.
1068
+ */
1069
+ docSync?: boolean;
1070
+ }
803
1071
  /**
804
1072
  * The site's house style for its renderers — page-type KEY → option key →
805
1073
  * value, e.g. `{ library: { variant: 'grid', covers: true } }`.
@@ -830,6 +1098,26 @@ export interface JunServicesOptions {
830
1098
  ttl?: number;
831
1099
  }
832
1100
  export interface JunRuntimeOptions {
1101
+ /**
1102
+ * The version of `@abraca/junis` this site was BUILT with.
1103
+ *
1104
+ * Not decoration. A deployment is an image, and an image is a commit that has
1105
+ * stopped moving: jun.is spent weeks with its janitor missing because the
1106
+ * container was restarted rather than rebuilt, so the fix sat in `main` while
1107
+ * every diagnosis was made against `main`. Stamped into the build and served
1108
+ * by `<apiBase>/health`, "is what I fixed actually running" is one curl.
1109
+ */
1110
+ version: string;
1111
+ /**
1112
+ * When `nuxt build` ran for this image, as an epoch millisecond.
1113
+ *
1114
+ * The version alone cannot catch a stale deployment BETWEEN releases — every
1115
+ * commit on a release train carries the same version, so an image built from
1116
+ * any of them answers identically. A timestamp cannot be wrong about it: a
1117
+ * restart keeps it, a rebuild moves it, and "the image is older than the fix"
1118
+ * becomes arithmetic rather than an argument.
1119
+ */
1120
+ builtAt: number;
833
1121
  brand: {
834
1122
  name: string;
835
1123
  tagline: string;
@@ -838,6 +1126,8 @@ export interface JunRuntimeOptions {
838
1126
  logoMark: JunLogoMark;
839
1127
  logoVariant: JunLogoVariant;
840
1128
  themeColor: string;
1129
+ /** BCP-47, for `<html lang>`. `en` unless a site says otherwise. */
1130
+ lang: string;
841
1131
  /** The app-icon tile. Defaults to `themeColor`; see `JunBrand`. */
842
1132
  iconBackground: string;
843
1133
  schemaType: JunBrand['schemaType'];
@@ -893,6 +1183,11 @@ export interface JunRuntimeOptions {
893
1183
  embeds: Required<JunEmbedOptions>;
894
1184
  /** Mosaic guard rails. See `JunMosaicOptions`. */
895
1185
  mosaic: Required<JunMosaicOptions>;
1186
+ /**
1187
+ * What an offline copy may contain. Read at RUNTIME by the offline panel and
1188
+ * the save routine, which cannot see module options. See `JunOfflineOptions`.
1189
+ */
1190
+ offline: Required<JunOfflineOptions>;
896
1191
  /** Enabled service adapters + their cache TTL. See `JunServicesOptions`. */
897
1192
  services: Required<JunServicesOptions>;
898
1193
  /**
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The one flag that tells the janitor a page belongs to the site.
3
+ *
4
+ * No imports at all: three surfaces read it — the two places the studio mints a
5
+ * document, the chore planner that would otherwise call it litter, and the
6
+ * machine that writes it into the baseline — and a second spelling would mean a
7
+ * page that survives one patrol and vanishes on the next.
8
+ *
9
+ * ## The problem it solves
10
+ *
11
+ * The janitor's model is *"anything that appeared after the baseline is
12
+ * litter"*, and it has no notion of authorship. That is correct for a demo,
13
+ * where the whole point is that visitors cannot leave a mark — and wrong for
14
+ * anybody running `mode: 'clean'` on a site they actually edit, where a page
15
+ * created in the studio was `doc.remove` litter within a patrol or two.
16
+ * Measured on the playground: a scratch page gone inside a minute.
17
+ *
18
+ * ## Why a flag is enough
19
+ *
20
+ * **A visitor cannot write to the tree at all.** That is why every visitor
21
+ * interaction in this module goes through RPC v1 and is written by the runner
22
+ * under the identity the SERVER stamps. So a document that appears in the tree
23
+ * by ordinary CRDT write was written by somebody holding write access — an
24
+ * owner — and this flag is that fact, recorded at the moment it is true.
25
+ *
26
+ * Litter the runner writes on a visitor's behalf never carries it, because the
27
+ * runner does not set it.
28
+ *
29
+ * ## What it deliberately does NOT do
30
+ *
31
+ * It does not protect an owner's EDIT to a seeded page. A demo's whole point is
32
+ * that it returns to its seeded shape, and an owner editing the demo is what it
33
+ * is demonstrating. Only CREATION is adopted; once adopted, the page's own
34
+ * shape becomes the baseline it is held to.
35
+ */
36
+ /** The meta key. Written once, read in three places. */
37
+ export declare const JUN_ADOPT_KEY = "junAdopt";
38
+ /** The meta a newly created page carries. Spread into the tree entry. */
39
+ export declare function junAdoptedMeta(): Record<string, unknown>;
40
+ /** Whether this tree entry is a page somebody with write access made. */
41
+ export declare function junIsAdopted(entry: {
42
+ meta?: Record<string, unknown> | null;
43
+ } | null | undefined): boolean;
@@ -0,0 +1,7 @@
1
+ export const JUN_ADOPT_KEY = "junAdopt";
2
+ export function junAdoptedMeta() {
3
+ return { [JUN_ADOPT_KEY]: true };
4
+ }
5
+ export function junIsAdopted(entry) {
6
+ return entry?.meta?.[JUN_ADOPT_KEY] === true;
7
+ }
@@ -0,0 +1,84 @@
1
+ /**
2
+ * What a swipe MEANS on a site made of documents.
3
+ *
4
+ * `@abraca/nuxt`'s `useSwipeGesture` answers "which way did the finger go".
5
+ * Everything here answers the questions that come after it — which page that
6
+ * is, whether the gesture applies at all, and how much rubber band to draw —
7
+ * and none of them can be seen on a rendered page, so they get unit tests
8
+ * instead. Zero imports, like `junNavValue`, `junSocial` and `junSearchRank`.
9
+ */
10
+ export type JunSwipeDirection = 'left' | 'right' | 'up' | 'down';
11
+ /** The two pages either side of the one being read. */
12
+ export interface JunNeighbourPair<T> {
13
+ /** The one BEFORE this in reading order — newer, in a dated collection. */
14
+ prev: T | null;
15
+ /** The one after — older, in a dated collection. */
16
+ next: T | null;
17
+ }
18
+ /**
19
+ * Which neighbour a horizontal swipe asks for.
20
+ *
21
+ * Swipe LEFT to go forward, the way every pager on every phone works: the
22
+ * content moves left because the next thing is arriving from the right. The
23
+ * opposite mapping feels correct for exactly as long as it takes to try it.
24
+ */
25
+ export declare function junSwipeNeighbour<T>(direction: JunSwipeDirection, pair: JunNeighbourPair<T>): T | null;
26
+ /**
27
+ * How far the page follows the finger.
28
+ *
29
+ * `0.4` is cou-sh's, and it is the number that makes a swipe feel attached to
30
+ * the hand rather than watched from a distance. Reduced motion returns `0`:
31
+ * the gesture still fires — taking it away would be removing a way to navigate
32
+ * from the people most likely to need one — but nothing slides.
33
+ */
34
+ export declare function junSwipeDamp(reducedMotion: boolean): number;
35
+ /**
36
+ * Whether a page swipe applies here at all.
37
+ *
38
+ * Four ways it must not:
39
+ *
40
+ * - **not flowing.** The immersive and panel buckets are renderers that own
41
+ * their own pointer — a globe, a deck, a mosaic. A page-level swipe would
42
+ * be competing with the thing the reader is actually touching.
43
+ * - **editing.** The owner's finger is placing a caret and dragging a
44
+ * selection, and a stray horizontal drag must not navigate away from an
45
+ * unsaved thought.
46
+ * - **an overlay is up.** The menu, the lightbox and the palette each own the
47
+ * gesture while they are open, and they have their own.
48
+ * - **switched off**, by the site or the reader.
49
+ */
50
+ export declare function junSwipeApplies(state: {
51
+ enabled: boolean;
52
+ bucket: string;
53
+ editing: boolean;
54
+ overlayOpen: boolean;
55
+ }): boolean;
56
+ /** A sibling, as little of one as the ordering needs. */
57
+ export interface JunSiblingLike {
58
+ id: string;
59
+ order?: number;
60
+ date?: unknown;
61
+ }
62
+ /**
63
+ * Siblings in the order the READER was shown them.
64
+ *
65
+ * Two orders, because two things are true: a journal is dated and its feed runs
66
+ * newest-first, while a docs section is arranged by hand and its order is the
67
+ * tree's. Getting this wrong is not subtle — "next" lands somewhere the reader
68
+ * has never seen the list put it.
69
+ *
70
+ * Dated sorting falls back to tree order for anything with no date, so one
71
+ * undated draft in a journal does not scramble the rest.
72
+ */
73
+ export declare function junSortSiblings<T extends JunSiblingLike>(list: readonly T[], mode: 'dated' | 'order'): T[];
74
+ /**
75
+ * The pair either side of `id` in an already-sorted list.
76
+ *
77
+ * Does NOT wrap. A reader who swipes past the end of a collection should feel
78
+ * the resistance and stop, not silently arrive back at the beginning — a loop
79
+ * makes a finite list feel endless, which is the opposite of knowing where you
80
+ * are.
81
+ */
82
+ export declare function junNeighboursOf<T extends {
83
+ id: string;
84
+ }>(sorted: readonly T[], id: string): JunNeighbourPair<T>;
@@ -0,0 +1,40 @@
1
+ export function junSwipeNeighbour(direction, pair) {
2
+ if (direction === "left") return pair.next;
3
+ if (direction === "right") return pair.prev;
4
+ return null;
5
+ }
6
+ export function junSwipeDamp(reducedMotion) {
7
+ return reducedMotion ? 0 : 0.4;
8
+ }
9
+ export function junSwipeApplies(state) {
10
+ return state.enabled && state.bucket === "flowing" && !state.editing && !state.overlayOpen;
11
+ }
12
+ export function junSortSiblings(list, mode) {
13
+ const out = [...list];
14
+ if (mode === "order") {
15
+ out.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
16
+ return out;
17
+ }
18
+ const time = (value) => {
19
+ if (typeof value === "number" && Number.isFinite(value)) return value < 1e11 ? value * 1e3 : value;
20
+ if (typeof value === "string" && value.trim()) {
21
+ const parsed = new Date(value.trim()).getTime();
22
+ return Number.isNaN(parsed) ? null : parsed;
23
+ }
24
+ return null;
25
+ };
26
+ out.sort((a, b) => {
27
+ const at = time(a.date);
28
+ const bt = time(b.date);
29
+ if (at != null && bt != null) return bt - at;
30
+ if (at != null) return -1;
31
+ if (bt != null) return 1;
32
+ return (a.order ?? 0) - (b.order ?? 0);
33
+ });
34
+ return out;
35
+ }
36
+ export function junNeighboursOf(sorted, id) {
37
+ const at = sorted.findIndex((item) => item.id === id);
38
+ if (at < 0) return { prev: null, next: null };
39
+ return { prev: sorted[at - 1] ?? null, next: sorted[at + 1] ?? null };
40
+ }
@@ -0,0 +1,86 @@
1
+ /**
2
+ * A stroke alphabet — letters as line segments, so the server can DRAW text.
3
+ *
4
+ * ## Why this exists
5
+ *
6
+ * The module rasterises its own PNGs (`junIcon`) rather than taking a native
7
+ * image dependency into a container. That was fine while the only thing being
8
+ * drawn was a mark, and stopped being fine the moment a per-page social card
9
+ * needed a TITLE on it: a link preview without the page's name is the site's
10
+ * logo repeated, which is what it was replacing.
11
+ *
12
+ * The alternatives were a font parser plus an embedded TTF (a few hundred
13
+ * lines and a binary in the package, to render at most three lines of text) or
14
+ * a bitmap font (crisp only at one size, and pixel-art at any other). A stroke
15
+ * alphabet is neither: it scales cleanly, it draws with the stroke primitive
16
+ * the mark already uses, and its "font file" is the table below.
17
+ *
18
+ * ## The grid
19
+ *
20
+ * Every glyph is drawn on a box 6 units wide with the cap line at `y = 0` and
21
+ * the baseline at `y = 10`. A descender reaches about 12. Advances are per
22
+ * glyph — `I` and `.` are narrow, `M` and `W` are wide — because uniform
23
+ * advances are what make hand-made type look hand-made.
24
+ *
25
+ * ## Capitals only, deliberately
26
+ *
27
+ * Half the glyphs, and a card set in capitals is a normal design choice rather
28
+ * than a compromise. `junTextStrokes` upper-cases whatever it is given, so a
29
+ * caller never has to think about it.
30
+ *
31
+ * Anything not in the table draws nothing and advances by a space, which is
32
+ * the one behaviour that cannot break a card: an emoji in a page title costs a
33
+ * gap, not a crash and not a tofu box.
34
+ */
35
+ /** A drawn line: `[x0, y0, x1, y1]`. The same shape `junIcon` strokes. */
36
+ export type JunSegment = [number, number, number, number];
37
+ /** Cap height in glyph units. A caller scales by `size / JUN_CAP_HEIGHT`. */
38
+ export declare const JUN_CAP_HEIGHT = 10;
39
+ /**
40
+ * Whether this alphabet can draw this text AT ALL.
41
+ *
42
+ * The table is Latin: a Japanese, Greek, Cyrillic or emoji title produces zero
43
+ * strokes and the card comes out with a mark, a rule and no title — which is a
44
+ * worse link preview than none, because it looks like the site is broken rather
45
+ * than plain.
46
+ *
47
+ * So the caller asks first. `useJunDocPage` stops offering a drawn card for a
48
+ * page it cannot letter, and the renderer falls back to the site's name.
49
+ */
50
+ export declare function junCanDraw(text: string): boolean;
51
+ /** Width of a string in glyph units, tracking included. */
52
+ export declare function junTextWidth(text: string): number;
53
+ /**
54
+ * Break `text` into at most `maxLines` lines that each fit `maxWidth` units.
55
+ *
56
+ * Word wrapping, with two rules a card needs and a paragraph does not: a word
57
+ * longer than the whole line is CUT rather than allowed to overflow (a URL in
58
+ * a title is a real thing), and text that will not fit in the line budget ends
59
+ * with an ellipsis instead of silently losing its tail.
60
+ */
61
+ export declare function junWrapText(text: string, maxWidth: number, maxLines: number): string[];
62
+ /**
63
+ * The same wrap, plus whether anything had to be DROPPED to make it fit.
64
+ *
65
+ * The card needs the second half: it steps a title down through type sizes
66
+ * until the whole thing fits, and "did it fit" is not answerable from the
67
+ * lines alone — a truncated title and a title that happened to end there are
68
+ * the same two lines.
69
+ */
70
+ export declare function junWrapInfo(text: string, maxWidth: number, maxLines: number): {
71
+ lines: string[];
72
+ truncated: boolean;
73
+ };
74
+ /**
75
+ * The segments that draw `text`, in PIXEL space, GROUPED BY GLYPH.
76
+ *
77
+ * `x`, `y` is the left end of the BASELINE — the same anchor typesetting uses,
78
+ * so a caller positions lines by leading rather than by guessing at cap height.
79
+ *
80
+ * Grouped rather than flat because of how the rasteriser works: it tests every
81
+ * pixel in a shape's bounding box against every segment in it. One shape per
82
+ * LINE means a box the width of the card against a hundred and fifty segments,
83
+ * which is tens of millions of distance tests for one card. One shape per
84
+ * glyph keeps both small, and the same card draws in a twentieth of the time.
85
+ */
86
+ export declare function junTextStrokes(text: string, x: number, y: number, size: number): JunSegment[][];