@molecule/app-margin-notes-react 4.0.1 → 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 +8 -3
- package/dist/MarginNotes.d.ts.map +1 -1
- package/dist/MarginNotes.js +4 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/types.d.ts +5 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
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
|
|
@@ -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) {
|
|
@@ -281,7 +282,11 @@ interface MarginNotesProps extends Omit<HTMLAttributes<HTMLDivElement>, 'childre
|
|
|
281
282
|
notes?: MarginNote[]
|
|
282
283
|
/** The note kinds, in the order their switches appear. Kinds absent here are always shown. */
|
|
283
284
|
kinds?: MarginNoteKind[]
|
|
284
|
-
/**
|
|
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
|
+
*/
|
|
285
290
|
markLabel?: string
|
|
286
291
|
/** Width of the prose column (a CSS length). Default `38rem`. */
|
|
287
292
|
measure?: string
|
|
@@ -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;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,
|
|
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
|
@@ -30,6 +30,9 @@ export function MarginNotes(props) {
|
|
|
30
30
|
const pinLabel = t('marginNotes.aria.pin', undefined, {
|
|
31
31
|
defaultValue: 'Pin the notes for this section',
|
|
32
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;
|
|
33
36
|
const rows = useMemo(() => buildRows(blocks, notes), [blocks, notes]);
|
|
34
37
|
const notesById = useMemo(() => new Map(notes.map((n) => [n.id, n])), [notes]);
|
|
35
38
|
const hasNotes = rows.some((r) => r.notes.length > 0);
|
|
@@ -160,7 +163,7 @@ export function MarginNotes(props) {
|
|
|
160
163
|
const tinted = !!activeNote && ids.includes(activeNote);
|
|
161
164
|
const interactive = ids.length > 0;
|
|
162
165
|
const togglePin = () => setPinnedBlock((p) => (p === block.id ? null : block.id));
|
|
163
|
-
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:
|
|
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));
|
|
164
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, {
|
|
165
168
|
defaultValue: 'Notes for this section',
|
|
166
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
|
@@ -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) {
|
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
|
@@ -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) {
|
package/dist/types.d.ts
CHANGED
|
@@ -51,7 +51,11 @@ export interface MarginNotesProps extends Omit<HTMLAttributes<HTMLDivElement>, '
|
|
|
51
51
|
notes?: MarginNote[];
|
|
52
52
|
/** The note kinds, in the order their switches appear. Kinds absent here are always shown. */
|
|
53
53
|
kinds?: MarginNoteKind[];
|
|
54
|
-
/**
|
|
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
|
+
*/
|
|
55
59
|
markLabel?: string;
|
|
56
60
|
/** Width of the prose column (a CSS length). Default `38rem`. */
|
|
57
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;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,QAAQ,GAAG,KAA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E,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",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"@molecule/app-i18n": "1.2.2",
|
|
46
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",
|