@eightyfourthousand/lib-editing 2026.3.0 → 2026.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +4 -2
  2. package/package.json +7 -7
  3. package/src/lib/components/editor/EditorBackMatterPage.tsx +3 -1
  4. package/src/lib/components/editor/EditorHeader.tsx +1 -1
  5. package/src/lib/components/editor/EditorProvider.tsx +76 -0
  6. package/src/lib/components/editor/PaginationProvider.tsx +30 -45
  7. package/src/lib/components/editor/extensions/Heading/Heading.ts +4 -3
  8. package/src/lib/components/editor/extensions/InternalLink/InternalLink.ts +4 -1
  9. package/src/lib/components/editor/extensions/Mention/Mention.ts +4 -1
  10. package/src/lib/components/editor/extensions/Passage/EditorOptions.tsx +2 -2
  11. package/src/lib/components/editor/extensions/Passage/Passage.tsx +3 -3
  12. package/src/lib/components/editor/extensions/Passage/ReaderOptions.tsx +3 -3
  13. package/src/lib/components/editor/extensions/Passage/ShowAnnotations.tsx +3 -3
  14. package/src/lib/components/editor/extensions/TitlesNode.ts +1 -1
  15. package/src/lib/components/reader/ReaderBackMatterPage.tsx +1 -0
  16. package/src/lib/components/reader/ReaderBackMatterPanel.tsx +3 -0
  17. package/src/lib/components/reader/ReaderBodyPanel.tsx +1 -1
  18. package/src/lib/components/shared/BackMatterPanel.tsx +17 -10
  19. package/src/lib/components/shared/BodyPanel.tsx +6 -6
  20. package/src/lib/components/shared/LabeledElement.tsx +3 -3
  21. package/src/lib/components/shared/LeftPanel.tsx +3 -3
  22. package/src/lib/components/shared/NavigationContext.ts +1 -1
  23. package/src/lib/components/shared/NavigationProvider.tsx +33 -1
  24. package/src/lib/components/shared/ReaderSearchButton.tsx +110 -0
  25. package/src/lib/components/shared/SearchReplacePanel.tsx +259 -0
  26. package/src/lib/components/shared/SourceReader.tsx +13 -4
  27. package/src/lib/components/shared/SuggestRevisionForm.tsx +1 -1
  28. package/src/lib/components/shared/TableOfContents.tsx +40 -27
  29. package/src/lib/components/shared/ThreeColumnRenderer.tsx +16 -9
  30. package/src/lib/components/shared/TranslationHeader.tsx +2 -63
  31. package/src/lib/components/shared/bibliography/BibliographyList.tsx +2 -2
  32. package/src/lib/components/shared/glossary/GlossaryInstanceBody.tsx +15 -5
  33. package/src/lib/components/shared/glossary/GlossaryPaginationProvider.tsx +17 -56
  34. package/src/lib/components/shared/glossary/GlossaryTermList.tsx +4 -5
  35. package/src/lib/components/shared/hooks/usePaginationLoadTriggers.spec.tsx +158 -0
  36. package/src/lib/components/shared/hooks/usePaginationLoadTriggers.ts +129 -0
  37. package/src/lib/components/shared/titles/FramedCard.tsx +3 -3
  38. package/src/lib/components/shared/titles/Titles.tsx +17 -6
  39. package/src/lib/components/shared/titles/TitlesCard.tsx +6 -6
  40. package/src/lib/transformers/has-abbreviation.ts +7 -2
@@ -37,9 +37,9 @@ export const FramedCard = ({
37
37
  children: ReactNode;
38
38
  className?: string;
39
39
  }) => {
40
- const borderColor = `border-navy-50`;
41
- const bgColor = `bg-navy-25/40`;
42
- const ornamentTint = `fill-navy-50`;
40
+ const borderColor = `border-navy/50`;
41
+ const bgColor = `bg-navy/10`;
42
+ const ornamentTint = `fill-navy/20`;
43
43
  const ornamentBgTint = `fill-white/75`;
44
44
 
45
45
  const cornerSize = 2;
@@ -16,7 +16,7 @@ import {
16
16
  import { TitlesCard } from './TitlesCard';
17
17
  import { TitleForm } from './TitleForm';
18
18
 
19
- export type TitlesVariant = 'english' | 'tibetan' | 'comparison' | 'other';
19
+ export type TitlesVariant = 'english' | 'tibetan' | 'comparison' | 'front' | 'other';
20
20
 
21
21
  export const Titles = ({
22
22
  titles,
@@ -50,15 +50,14 @@ export const Titles = ({
50
50
 
51
51
  const footer =
52
52
  imprint?.mainTitles?.['Sa-Ltn'] ||
53
- mainTitles.find((t) => t.language === 'Sa-Ltn')?.title ||
54
- '...';
53
+ mainTitles.find((t) => t.language === 'Sa-Ltn')?.title;
55
54
 
56
55
  switch (variant) {
57
56
  case 'tibetan': {
58
57
  const boMain =
59
58
  imprint?.mainTitles?.bo ||
60
59
  mainTitles.find((t) => t.language === 'bo')?.title;
61
- header = `${BO_TITLE_PREFIX}${boMain || '...'}`;
60
+ header = boMain ? `${BO_TITLE_PREFIX}${boMain || ''}` : '';
62
61
  break;
63
62
  }
64
63
  case 'comparison': {
@@ -68,11 +67,23 @@ export const Titles = ({
68
67
  const enMain =
69
68
  imprint?.mainTitles?.en ||
70
69
  mainTitles.find((t) => t.language === 'en')?.title ||
71
- '...';
72
- header = `${BO_TITLE_PREFIX}${boMain || '...'}`;
70
+ '';
71
+ header = boMain ? `${BO_TITLE_PREFIX}${boMain || ''}` : '';
73
72
  main = enMain;
74
73
  break;
75
74
  }
75
+ case 'front': {
76
+ const boMain =
77
+ imprint?.mainTitles?.bo ||
78
+ mainTitles.find((t) => t.language === 'bo')?.title;
79
+ header = boMain ? `${BO_TITLE_PREFIX}${boMain || ''}` : '';
80
+ main =
81
+ imprint?.mainTitles?.en ||
82
+ mainTitles.find((t) => t.language === 'en')?.title ||
83
+ mainTitles[0]?.title ||
84
+ '';
85
+ break;
86
+ }
76
87
  case 'english':
77
88
  default:
78
89
  main =
@@ -28,10 +28,10 @@ export const TitlesCard = ({
28
28
  onEdit?(): void;
29
29
  }) => {
30
30
  const radial =
31
- 'bg-radial-[at_50%_50%] from-ochre-25 from-35% to-navy-25';
31
+ 'bg-radial-[at_50%_50%] from-ochre/10 from-35% to-navy/10';
32
32
 
33
33
  return (
34
- <div className="mx-auto flex w-full max-w-7xl gap-1.5 rounded-lg border bg-background p-1.5">
34
+ <div className="mx-auto flex w-full max-w-7xl gap-1.5 rounded-lg border bg-[#fff] p-1.5">
35
35
  {(toh || section) && (
36
36
  <div
37
37
  className={cn(
@@ -39,17 +39,17 @@ export const TitlesCard = ({
39
39
  radial,
40
40
  )}
41
41
  >
42
- <span className="text-sm leading-4 font-light text-ochre-700">
42
+ <span className="text-sm leading-4 font-light text-primary">
43
43
  {section}
44
44
  </span>
45
45
  <span className="text-xs uppercase text-muted-foreground">{toh}</span>
46
46
  </div>
47
47
  )}
48
- <div className="grow min-w-0 flex flex-col justify-center gap-3 rounded-lg border px-2 py-4 text-center md:rounded-s-none md:rounded-e-lg lg:rounded-none">
48
+ <div className="bg-[#fff] grow min-w-0 flex flex-col justify-center gap-3 rounded-lg border px-2 py-4 text-center md:rounded-s-none md:rounded-e-lg lg:rounded-none">
49
49
  {header && (
50
50
  <div
51
51
  className={cn(
52
- 'font-tibetan text-navy-500 px-2',
52
+ 'font-tibetan text-primary px-2',
53
53
  main ? 'text-2xl' : 'text-3xl',
54
54
  'leading-relaxed break-all xs:break-normal',
55
55
  )}
@@ -58,7 +58,7 @@ export const TitlesCard = ({
58
58
  </div>
59
59
  )}
60
60
  {main && (
61
- <div className="title-main break-all px-2 font-serif text-3xl text-navy-500 xs:break-normal">
61
+ <div className="title-main break-all px-2 font-serif text-3xl text-primary xs:break-normal">
62
62
  {main}
63
63
  </div>
64
64
  )}
@@ -5,7 +5,7 @@ import { Transformer } from './transformer';
5
5
 
6
6
  export const hasAbbreviation: Transformer = (ctx) => {
7
7
  const { annotation } = ctx;
8
- const { abbreviation, uuid } = annotation as HasAbbreviationAnnotation;
8
+ const { abbreviation, uuid, start, end } = annotation as HasAbbreviationAnnotation;
9
9
 
10
10
  recurse({
11
11
  until: ['text'],
@@ -21,7 +21,12 @@ export const hasAbbreviation: Transformer = (ctx) => {
21
21
  uuid,
22
22
  };
23
23
  block.content = [
24
- { type: 'text', text: block.text, marks: block.marks },
24
+ {
25
+ type: 'text',
26
+ text: block.text,
27
+ marks: block.marks,
28
+ attrs: { start, end }
29
+ },
25
30
  ];
26
31
  },
27
32
  });