@molecule/app-margin-notes-react 4.0.0 → 4.0.2
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 +18 -11
- package/dist/MarginNotes.d.ts +2 -1
- package/dist/MarginNotes.d.ts.map +1 -1
- package/dist/MarginNotes.js +16 -10
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -5
- package/dist/types.d.ts +9 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-11-
|
|
6
|
+
Generated: 2026-11-21T12:46:43.684Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-margin-notes-react
|
|
@@ -19,8 +19,8 @@ hovering or focusing a note tints the paragraphs it covers. A paragraph can
|
|
|
19
19
|
carry a small mark in its left margin. Note kinds (say, "Summaries" and
|
|
20
20
|
"Prompts") each get a real switch. Phone: the notes column gives way to a bar
|
|
21
21
|
fixed to the bottom that shows the notes for the section being read and
|
|
22
|
-
follows the reader;
|
|
23
|
-
go; the switches live in the bar. A document with no notes renders centred
|
|
22
|
+
follows the reader; a noted paragraph's pin button pins its notes, a second
|
|
23
|
+
press lets go; the switches live in the bar. A document with no notes renders centred
|
|
24
24
|
prose at full measure with no notes column, no switches and no bar.
|
|
25
25
|
|
|
26
26
|
The example is a complete static-site post body: it takes the post's
|
|
@@ -90,9 +90,10 @@ export function PostBody({
|
|
|
90
90
|
const starts = new Set(sectionStarts(provenance.spans))
|
|
91
91
|
const notes: MarginNote[] = []
|
|
92
92
|
const promptNoteIds = new Map<string, string>()
|
|
93
|
-
let summaryId: string | undefined
|
|
94
93
|
|
|
95
94
|
const blocks: MarginNotesBlock[] = provenance.spans.map((span, i) => {
|
|
95
|
+
// The section summary, if this span starts one; only this iteration reads it.
|
|
96
|
+
let summaryId: string | undefined
|
|
96
97
|
if (starts.has(i)) {
|
|
97
98
|
summaryId = summaries[i] ? `summary-${i}` : undefined
|
|
98
99
|
if (summaryId) {
|
|
@@ -260,9 +261,10 @@ interface MarginNoteKind {
|
|
|
260
261
|
/**
|
|
261
262
|
* How this kind reaches the phone panel. `'follow'` (default): the panel
|
|
262
263
|
* shows it for the section being read, following the reader. `'tap'`: only
|
|
263
|
-
* when the reader
|
|
264
|
-
* for notes about one paragraph rather than the
|
|
265
|
-
* note even while its switch is off: on a phone
|
|
264
|
+
* when the reader presses the pin button of a block it belongs to (and gone
|
|
265
|
+
* on the second press) — for notes about one paragraph rather than the
|
|
266
|
+
* section. The pin shows the note even while its switch is off: on a phone
|
|
267
|
+
* the pin is how it is found.
|
|
266
268
|
*/
|
|
267
269
|
panel?: 'follow' | 'tap'
|
|
268
270
|
}
|
|
@@ -280,7 +282,11 @@ interface MarginNotesProps extends Omit<HTMLAttributes<HTMLDivElement>, 'childre
|
|
|
280
282
|
notes?: MarginNote[]
|
|
281
283
|
/** The note kinds, in the order their switches appear. Kinds absent here are always shown. */
|
|
282
284
|
kinds?: MarginNoteKind[]
|
|
283
|
-
/**
|
|
285
|
+
/**
|
|
286
|
+
* Accessible name of the margin mark, already translated (e.g. "Written with
|
|
287
|
+
* AI"). Without it (or with a blank one) the mark is decorative and hidden
|
|
288
|
+
* from assistive technology — a margin mark carries no meaning on its own.
|
|
289
|
+
*/
|
|
284
290
|
markLabel?: string
|
|
285
291
|
/** Width of the prose column (a CSS length). Default `38rem`. */
|
|
286
292
|
measure?: string
|
|
@@ -319,7 +325,8 @@ Long-form text with notes beside each paragraph.
|
|
|
319
325
|
Desktop: a prose column and, to its right, a narrower notes column; each
|
|
320
326
|
note lines up with the block(s) it belongs to and appears once. Phone: the
|
|
321
327
|
notes column disappears and a bar fixed to the bottom shows the notes for
|
|
322
|
-
the section being read (
|
|
328
|
+
the section being read (a noted block's pin button pins its notes, a second
|
|
329
|
+
press lets go),
|
|
323
330
|
with the kind switches in the bar. Every default — which kinds show, which
|
|
324
331
|
surface a width gets — is decided in the first render and by CSS, so
|
|
325
332
|
server-rendered or prerendered HTML is right before any JavaScript runs.
|
|
@@ -430,11 +437,11 @@ Peer dependencies:
|
|
|
430
437
|
- The example needs `@molecule/app-markdown` and a markdown bond
|
|
431
438
|
(`@molecule/app-markdown-marked`), bonded once at startup:
|
|
432
439
|
`setProvider(provider)`.
|
|
433
|
-
- Section notes follow the reader; paragraph notes wait for
|
|
440
|
+
- Section notes follow the reader; paragraph notes wait for the pin. On a
|
|
434
441
|
phone the panel shows the kinds with `panel: 'follow'` (the default) for
|
|
435
442
|
the section in view. A kind about ONE paragraph (a prompt, a citation)
|
|
436
443
|
gets `panel: 'tap'`: while its switch is off it shows only when that
|
|
437
|
-
paragraph is
|
|
444
|
+
paragraph's pin button is pressed (and goes on the second press); once its switch is ON it
|
|
438
445
|
follows the section in view like a `'follow'` kind, so the switch always
|
|
439
446
|
shows something.
|
|
440
447
|
- The mark is drawn on the block, as an absolutely-placed dot inside the
|
package/dist/MarginNotes.d.ts
CHANGED
|
@@ -6,7 +6,8 @@ import type { MarginNotesProps } from './types.js';
|
|
|
6
6
|
* Desktop: a prose column and, to its right, a narrower notes column; each
|
|
7
7
|
* note lines up with the block(s) it belongs to and appears once. Phone: the
|
|
8
8
|
* notes column disappears and a bar fixed to the bottom shows the notes for
|
|
9
|
-
* the section being read (
|
|
9
|
+
* the section being read (a noted block's pin button pins its notes, a second
|
|
10
|
+
* press lets go),
|
|
10
11
|
* with the kind switches in the bar. Every default — which kinds show, which
|
|
11
12
|
* surface a width gets — is decided in the first render and by CSS, so
|
|
12
13
|
* server-rendered or prerendered HTML is right before any JavaScript runs.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarginNotes.d.ts","sourceRoot":"","sources":["../src/MarginNotes.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,GAAG,EAAE,MAAM,OAAO,CAAA;AAQ/C,OAAO,KAAK,EAAc,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAQ9D
|
|
1
|
+
{"version":3,"file":"MarginNotes.d.ts","sourceRoot":"","sources":["../src/MarginNotes.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,GAAG,EAAE,MAAM,OAAO,CAAA;AAQ/C,OAAO,KAAK,EAAc,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAQ9D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAoUhE"}
|
package/dist/MarginNotes.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { useTranslation } from '@molecule/app-react';
|
|
4
4
|
import { getClassMap } from '@molecule/app-ui';
|
|
5
|
-
import { Switch } from '@molecule/app-ui-react';
|
|
5
|
+
import { Icon, Switch } from '@molecule/app-ui-react';
|
|
6
6
|
import { buildRows, defaultShownKinds } from './rows.js';
|
|
7
7
|
/** Layout effect in the browser, plain effect on the server (where it never runs). */
|
|
8
8
|
const useBrowserLayoutEffect = typeof window === 'undefined' ? useEffect : useLayoutEffect;
|
|
@@ -14,7 +14,8 @@ const READING_LINE = 0.35;
|
|
|
14
14
|
* Desktop: a prose column and, to its right, a narrower notes column; each
|
|
15
15
|
* note lines up with the block(s) it belongs to and appears once. Phone: the
|
|
16
16
|
* notes column disappears and a bar fixed to the bottom shows the notes for
|
|
17
|
-
* the section being read (
|
|
17
|
+
* the section being read (a noted block's pin button pins its notes, a second
|
|
18
|
+
* press lets go),
|
|
18
19
|
* with the kind switches in the bar. Every default — which kinds show, which
|
|
19
20
|
* surface a width gets — is decided in the first render and by CSS, so
|
|
20
21
|
* server-rendered or prerendered HTML is right before any JavaScript runs.
|
|
@@ -26,6 +27,12 @@ export function MarginNotes(props) {
|
|
|
26
27
|
const { blocks, notes = [], kinds = [], markLabel, measure = '38rem', gutterWidth = '18rem', shownKinds: shownKindsProp, onShownKindsChange, className, style, ...rest } = props;
|
|
27
28
|
const cm = getClassMap();
|
|
28
29
|
const { t } = useTranslation();
|
|
30
|
+
const pinLabel = t('marginNotes.aria.pin', undefined, {
|
|
31
|
+
defaultValue: 'Pin the notes for this section',
|
|
32
|
+
});
|
|
33
|
+
// A named mark is an image named by `markLabel`; an unnamed one is
|
|
34
|
+
// decorative (axe-core rejects an image with no name).
|
|
35
|
+
const markNamed = typeof markLabel === 'string' && markLabel.trim().length > 0;
|
|
29
36
|
const rows = useMemo(() => buildRows(blocks, notes), [blocks, notes]);
|
|
30
37
|
const notesById = useMemo(() => new Map(notes.map((n) => [n.id, n])), [notes]);
|
|
31
38
|
const hasNotes = rows.some((r) => r.notes.length > 0);
|
|
@@ -49,7 +56,7 @@ export function MarginNotes(props) {
|
|
|
49
56
|
const b = activeBlock ? blocks.find((x) => x.id === activeBlock) : undefined;
|
|
50
57
|
return new Set(b?.noteIds ?? []);
|
|
51
58
|
}, [activeBlock, blocks]);
|
|
52
|
-
// Phone: the section being read, and a block the reader
|
|
59
|
+
// Phone: the section being read, and a block the reader pinned.
|
|
53
60
|
const firstWithNotes = rows.find((r) => r.noteIds.length > 0)?.id ?? null;
|
|
54
61
|
const [readingRow, setReadingRow] = useState(firstWithNotes);
|
|
55
62
|
const [pinnedBlock, setPinnedBlock] = useState(null);
|
|
@@ -115,21 +122,21 @@ export function MarginNotes(props) {
|
|
|
115
122
|
window.addEventListener('resize', measureOffsets);
|
|
116
123
|
return () => window.removeEventListener('resize', measureOffsets);
|
|
117
124
|
}, [hasNotes, rows]);
|
|
118
|
-
// Kinds that reach the panel only
|
|
125
|
+
// Kinds that reach the panel only through a block's pin (notes about one paragraph).
|
|
119
126
|
const tapOnly = useMemo(() => new Set(kinds.filter((k) => k.panel === 'tap').map((k) => k.id)), [kinds]);
|
|
120
127
|
const panelNoteIds = useMemo(() => {
|
|
121
128
|
if (pinnedBlock)
|
|
122
129
|
return blocks.find((b) => b.id === pinnedBlock)?.noteIds ?? [];
|
|
123
130
|
const ids = rows.find((r) => r.id === readingRow)?.noteIds ?? [];
|
|
124
131
|
// A tap kind follows the reader too once its switch is ON: turning the
|
|
125
|
-
// switch on must show something on a phone, not wait for a
|
|
132
|
+
// switch on must show something on a phone, not wait for a pin.
|
|
126
133
|
return ids.filter((id) => {
|
|
127
134
|
const note = notesById.get(id);
|
|
128
135
|
return !!note && (!tapOnly.has(note.kind) || isShown(note));
|
|
129
136
|
});
|
|
130
137
|
}, [pinnedBlock, readingRow, blocks, rows, tapOnly, notesById, isShown]);
|
|
131
|
-
// A
|
|
132
|
-
// the
|
|
138
|
+
// A pinned block's tap-kind notes show whatever their switch says: on a phone
|
|
139
|
+
// the pin is the only way to reach a note about one paragraph (a prompt that
|
|
133
140
|
// defaults off). Follow-kind notes keep obeying their switch.
|
|
134
141
|
const inPanel = (note) => isShown(note) || (pinnedBlock !== null && tapOnly.has(note.kind));
|
|
135
142
|
const panelNotes = panelNoteIds
|
|
@@ -155,9 +162,8 @@ export function MarginNotes(props) {
|
|
|
155
162
|
const ids = block.noteIds ?? [];
|
|
156
163
|
const tinted = !!activeNote && ids.includes(activeNote);
|
|
157
164
|
const interactive = ids.length > 0;
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
: undefined, className: cm.cn(cm.position('relative'), tinted && cm.bgPrimarySubtle), children: [block.marked && (_jsx("span", { role: "img", "aria-label": markLabel, "data-mol-id": `margin-notes-mark-${block.id}`, className: cm.cn(cm.position('absolute'), cm.roundedFull, cm.bgPrimary, cm.hiddenBelow('md')), style: { left: '-0.9rem', top: '0.75em', width: '6px', height: '6px' } })), block.content] }, block.id));
|
|
165
|
+
const togglePin = () => setPinnedBlock((p) => (p === block.id ? null : block.id));
|
|
166
|
+
return (_jsxs("div", { id: block.id, "data-mol-id": `margin-notes-block-${block.id}`, "data-block-marked": block.marked ? 'true' : undefined, "data-block-pinned": pinnedBlock === block.id ? 'true' : undefined, onMouseEnter: interactive ? () => setActiveBlock(block.id) : undefined, onMouseLeave: interactive ? () => setActiveBlock(null) : undefined, onFocus: interactive ? () => setActiveBlock(block.id) : undefined, onBlur: interactive ? () => setActiveBlock(null) : undefined, className: cm.cn(cm.position('relative'), tinted && cm.bgPrimarySubtle), children: [block.marked && (_jsx("span", { role: markNamed ? 'img' : undefined, "aria-label": markNamed ? markLabel : undefined, "aria-hidden": markNamed ? undefined : 'true', "data-mol-id": `margin-notes-mark-${block.id}`, className: cm.cn(cm.position('absolute'), cm.roundedFull, cm.bgPrimary, cm.hiddenBelow('md')), style: { left: '-0.9rem', top: '0.75em', width: '6px', height: '6px' } })), block.content, interactive && (_jsx("div", { className: cm.cn(cm.hiddenFrom('md'), cm.flex({ justify: 'end' })), children: _jsx("button", { type: "button", "aria-pressed": pinnedBlock === block.id, "aria-label": pinLabel, "data-mol-id": `margin-notes-pin-${block.id}`, onClick: togglePin, className: cm.button({ variant: 'ghost', size: 'sm' }), children: _jsx(Icon, { name: "pin", size: 16, "aria-hidden": "true" }) }) }))] }, block.id));
|
|
161
167
|
}) }), hasNotes && (_jsx("div", { className: cm.cn(cm.hiddenBelow('md'), cm.stack(3)), style: { width: gutterWidth, flexShrink: 0, paddingTop: noteOffsets[row.id] }, "aria-label": t('marginNotes.aria.notes', undefined, { defaultValue: 'Notes' }), role: "complementary", children: row.notes.map((note) => noteView(note, 'gutter')) }))] }, row.id))) }), hasNotes && (_jsxs(_Fragment, { children: [_jsx("div", { className: cm.hiddenFrom('md'), style: { height: '14rem' }, "aria-hidden": "true" }), _jsxs("div", { className: cm.cn(cm.hiddenFrom('md'), cm.position('fixed'), cm.surface, cm.borderT, cm.shadowLifted, cm.sp('p', 3), cm.stack(2)), style: { left: 0, right: 0, bottom: 0, zIndex: 20 }, "data-mol-id": "margin-notes-bar", children: [_jsxs("div", { role: "region", "aria-live": "polite", "aria-label": t('marginNotes.aria.panel', undefined, {
|
|
162
168
|
defaultValue: 'Notes for this section',
|
|
163
169
|
}), style: { maxHeight: '40vh', overflowY: 'auto' }, "data-mol-id": "margin-notes-panel", children: [panelNotes.map((note) => noteView(note, 'panel')), pinnedBlock && (_jsx("button", { type: "button", onClick: () => setPinnedBlock(null), className: cm.cn(cm.button({ variant: 'ghost', size: 'sm' }), cm.touchTarget), "data-mol-id": "margin-notes-dismiss", children: t('marginNotes.dismiss', undefined, { defaultValue: 'Hide notes' }) }))] }), switches('bar')] })] }))] }));
|
package/dist/index.d.ts
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
* carry a small mark in its left margin. Note kinds (say, "Summaries" and
|
|
11
11
|
* "Prompts") each get a real switch. Phone: the notes column gives way to a bar
|
|
12
12
|
* fixed to the bottom that shows the notes for the section being read and
|
|
13
|
-
* follows the reader;
|
|
14
|
-
* go; the switches live in the bar. A document with no notes renders centred
|
|
13
|
+
* follows the reader; a noted paragraph's pin button pins its notes, a second
|
|
14
|
+
* press lets go; the switches live in the bar. A document with no notes renders centred
|
|
15
15
|
* prose at full measure with no notes column, no switches and no bar.
|
|
16
16
|
*
|
|
17
17
|
* The example is a complete static-site post body: it takes the post's
|
|
@@ -76,9 +76,10 @@
|
|
|
76
76
|
* const starts = new Set(sectionStarts(provenance.spans))
|
|
77
77
|
* const notes: MarginNote[] = []
|
|
78
78
|
* const promptNoteIds = new Map<string, string>()
|
|
79
|
-
* let summaryId: string | undefined
|
|
80
79
|
*
|
|
81
80
|
* const blocks: MarginNotesBlock[] = provenance.spans.map((span, i) => {
|
|
81
|
+
* // The section summary, if this span starts one; only this iteration reads it.
|
|
82
|
+
* let summaryId: string | undefined
|
|
82
83
|
* if (starts.has(i)) {
|
|
83
84
|
* summaryId = summaries[i] ? `summary-${i}` : undefined
|
|
84
85
|
* if (summaryId) {
|
|
@@ -205,11 +206,11 @@
|
|
|
205
206
|
* - The example needs `@molecule/app-markdown` and a markdown bond
|
|
206
207
|
* (`@molecule/app-markdown-marked`), bonded once at startup:
|
|
207
208
|
* `setProvider(provider)`.
|
|
208
|
-
* - Section notes follow the reader; paragraph notes wait for
|
|
209
|
+
* - Section notes follow the reader; paragraph notes wait for the pin. On a
|
|
209
210
|
* phone the panel shows the kinds with `panel: 'follow'` (the default) for
|
|
210
211
|
* the section in view. A kind about ONE paragraph (a prompt, a citation)
|
|
211
212
|
* gets `panel: 'tap'`: while its switch is off it shows only when that
|
|
212
|
-
* paragraph is
|
|
213
|
+
* paragraph's pin button is pressed (and goes on the second press); once its switch is ON it
|
|
213
214
|
* follows the section in view like a `'follow'` kind, so the switch always
|
|
214
215
|
* shows something.
|
|
215
216
|
* - The mark is drawn on the block, as an absolutely-placed dot inside the
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkOG;AAEH,cAAc,kBAAkB,CAAA;AAChC,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
* carry a small mark in its left margin. Note kinds (say, "Summaries" and
|
|
11
11
|
* "Prompts") each get a real switch. Phone: the notes column gives way to a bar
|
|
12
12
|
* fixed to the bottom that shows the notes for the section being read and
|
|
13
|
-
* follows the reader;
|
|
14
|
-
* go; the switches live in the bar. A document with no notes renders centred
|
|
13
|
+
* follows the reader; a noted paragraph's pin button pins its notes, a second
|
|
14
|
+
* press lets go; the switches live in the bar. A document with no notes renders centred
|
|
15
15
|
* prose at full measure with no notes column, no switches and no bar.
|
|
16
16
|
*
|
|
17
17
|
* The example is a complete static-site post body: it takes the post's
|
|
@@ -76,9 +76,10 @@
|
|
|
76
76
|
* const starts = new Set(sectionStarts(provenance.spans))
|
|
77
77
|
* const notes: MarginNote[] = []
|
|
78
78
|
* const promptNoteIds = new Map<string, string>()
|
|
79
|
-
* let summaryId: string | undefined
|
|
80
79
|
*
|
|
81
80
|
* const blocks: MarginNotesBlock[] = provenance.spans.map((span, i) => {
|
|
81
|
+
* // The section summary, if this span starts one; only this iteration reads it.
|
|
82
|
+
* let summaryId: string | undefined
|
|
82
83
|
* if (starts.has(i)) {
|
|
83
84
|
* summaryId = summaries[i] ? `summary-${i}` : undefined
|
|
84
85
|
* if (summaryId) {
|
|
@@ -205,11 +206,11 @@
|
|
|
205
206
|
* - The example needs `@molecule/app-markdown` and a markdown bond
|
|
206
207
|
* (`@molecule/app-markdown-marked`), bonded once at startup:
|
|
207
208
|
* `setProvider(provider)`.
|
|
208
|
-
* - Section notes follow the reader; paragraph notes wait for
|
|
209
|
+
* - Section notes follow the reader; paragraph notes wait for the pin. On a
|
|
209
210
|
* phone the panel shows the kinds with `panel: 'follow'` (the default) for
|
|
210
211
|
* the section in view. A kind about ONE paragraph (a prompt, a citation)
|
|
211
212
|
* gets `panel: 'tap'`: while its switch is off it shows only when that
|
|
212
|
-
* paragraph is
|
|
213
|
+
* paragraph's pin button is pressed (and goes on the second press); once its switch is ON it
|
|
213
214
|
* follows the section in view like a `'follow'` kind, so the switch always
|
|
214
215
|
* shows something.
|
|
215
216
|
* - The mark is drawn on the block, as an absolutely-placed dot inside the
|
package/dist/types.d.ts
CHANGED
|
@@ -36,9 +36,10 @@ export interface MarginNoteKind {
|
|
|
36
36
|
/**
|
|
37
37
|
* How this kind reaches the phone panel. `'follow'` (default): the panel
|
|
38
38
|
* shows it for the section being read, following the reader. `'tap'`: only
|
|
39
|
-
* when the reader
|
|
40
|
-
* for notes about one paragraph rather than the
|
|
41
|
-
* note even while its switch is off: on a phone
|
|
39
|
+
* when the reader presses the pin button of a block it belongs to (and gone
|
|
40
|
+
* on the second press) — for notes about one paragraph rather than the
|
|
41
|
+
* section. The pin shows the note even while its switch is off: on a phone
|
|
42
|
+
* the pin is how it is found.
|
|
42
43
|
*/
|
|
43
44
|
panel?: 'follow' | 'tap';
|
|
44
45
|
}
|
|
@@ -50,7 +51,11 @@ export interface MarginNotesProps extends Omit<HTMLAttributes<HTMLDivElement>, '
|
|
|
50
51
|
notes?: MarginNote[];
|
|
51
52
|
/** The note kinds, in the order their switches appear. Kinds absent here are always shown. */
|
|
52
53
|
kinds?: MarginNoteKind[];
|
|
53
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* Accessible name of the margin mark, already translated (e.g. "Written with
|
|
56
|
+
* AI"). Without it (or with a blank one) the mark is decorative and hidden
|
|
57
|
+
* from assistive technology — a margin mark carries no meaning on its own.
|
|
58
|
+
*/
|
|
54
59
|
markLabel?: string;
|
|
55
60
|
/** Width of the prose column (a CSS length). Default `38rem`. */
|
|
56
61
|
measure?: string;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,EAAE,EAAE,MAAM,CAAA;IACV,4CAA4C;IAC5C,OAAO,EAAE,SAAS,CAAA;IAClB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,sDAAsD;AACtD,MAAM,WAAW,UAAU;IACzB,mEAAmE;IACnE,EAAE,EAAE,MAAM,CAAA;IACV,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAA;IACZ,yBAAyB;IACzB,OAAO,EAAE,SAAS,CAAA;CACnB;AAED,gEAAgE;AAChE,MAAM,WAAW,cAAc;IAC7B,0DAA0D;IAC1D,EAAE,EAAE,MAAM,CAAA;IACV,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAA;IACb,oFAAoF;IACpF,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,EAAE,EAAE,MAAM,CAAA;IACV,4CAA4C;IAC5C,OAAO,EAAE,SAAS,CAAA;IAClB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,sDAAsD;AACtD,MAAM,WAAW,UAAU;IACzB,mEAAmE;IACnE,EAAE,EAAE,MAAM,CAAA;IACV,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAA;IACZ,yBAAyB;IACzB,OAAO,EAAE,SAAS,CAAA;CACnB;AAED,gEAAgE;AAChE,MAAM,WAAW,cAAc;IAC7B,0DAA0D;IAC1D,EAAE,EAAE,MAAM,CAAA;IACV,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAA;IACb,oFAAoF;IACpF,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAA;CACzB;AAED,6BAA6B;AAC7B,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IACxF,kCAAkC;IAClC,MAAM,EAAE,gBAAgB,EAAE,CAAA;IAC1B,iGAAiG;IACjG,KAAK,CAAC,EAAE,UAAU,EAAE,CAAA;IACpB,8FAA8F;IAC9F,KAAK,CAAC,EAAE,cAAc,EAAE,CAAA;IACxB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,0FAA0F;IAC1F,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,qFAAqF;IACrF,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;CAC/C;AAED,4EAA4E;AAC5E,MAAM,WAAW,cAAc;IAC7B,gDAAgD;IAChD,EAAE,EAAE,MAAM,CAAA;IACV,wCAAwC;IACxC,MAAM,EAAE,gBAAgB,EAAE,CAAA;IAC1B,qFAAqF;IACrF,KAAK,EAAE,UAAU,EAAE,CAAA;IACnB,2EAA2E;IAC3E,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-margin-notes-react",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Long-form reading layout with notes beside each paragraph: aligned notes column, margin marks, two-way hover, switchable note kinds, and a phone bar that follows the reader",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/app-margin-notes-react",
|
|
6
6
|
"type": "module",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"react": "^18.0.0 || ^19.0.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@molecule/app-i18n": "1.
|
|
46
|
-
"@molecule/app-markdown": "1.0.
|
|
45
|
+
"@molecule/app-i18n": "1.2.2",
|
|
46
|
+
"@molecule/app-markdown": "1.0.4",
|
|
47
47
|
"@molecule/app-markdown-marked": "1.0.3",
|
|
48
|
-
"@molecule/app-react": "4.
|
|
49
|
-
"@molecule/app-ui": "1.
|
|
50
|
-
"@molecule/app-ui-react": "4.
|
|
48
|
+
"@molecule/app-react": "4.10.1",
|
|
49
|
+
"@molecule/app-ui": "1.5.0",
|
|
50
|
+
"@molecule/app-ui-react": "4.2.0",
|
|
51
51
|
"@testing-library/react": "16.3.3",
|
|
52
52
|
"@types/node": "26.6.5",
|
|
53
53
|
"@types/react": "19.3.0",
|