@riebeckite/plugin-sidenotes 0.0.21 → 0.0.23

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 CHANGED
@@ -1,5 +1,7 @@
1
1
  # @riebeckite/plugin-sidenotes
2
2
 
3
+ <!-- Generated from docs/docs/plugins/sidenotes.md. Edit the canonical documentation in docs/docs/plugins and run `pnpm docs:sync`. -->
4
+
3
5
  Tufte-style side notes for Riebeckite. Authors keep writing ordinary GFM
4
6
  footnotes (`[^1]` and `[^1]: text`); the plugin rewrites the generated
5
7
  footnote markup into an inline reference plus a note that renders as a margin
@@ -16,11 +18,13 @@ core pipeline produces from `remark-gfm`:
16
18
  (`[data-rr-sidenotes-ref]`) that keeps its `href="#fn-…"` target, so the
17
19
  footnote stays reachable with plain browser navigation.
18
20
  - Each footnote definition becomes a `.rr-sidenotes__note` aside next to the
19
- reference: a static **margin note** on desktop (`@media (min-width: 48rem)`)
20
- and a **popover** on mobile (`@media (max-width: 48rem)`).
21
- - The trailing footnote definitions section is kept (it is the link target
22
- on mobile and the no-JavaScript fallback) and hidden on desktop, where the
23
- margin notes are always visible.
21
+ reference: an inline note from tablet width (`@media (min-width: 48rem)`), a
22
+ sticky **margin note** when there is room for an article rail
23
+ (`@media (min-width: 88rem)`), and a **popover** on mobile
24
+ (`@media (max-width: 48rem)`).
25
+ - The trailing footnote definitions section is kept (it is the link target on
26
+ mobile and the no-JavaScript fallback) and hidden from tablet width up, where
27
+ the inline or margin notes are always visible.
24
28
 
25
29
  A small client entry (`initSidenotes`) toggles the mobile popover: tap to
26
30
  open/close, `Escape` to close, and click outside to close. It ignores the page
@@ -114,12 +118,12 @@ Stable hooks follow the `rr-sidenotes` convention: `rr-sidenotes__toggle`,
114
118
  ## Limitations
115
119
 
116
120
  - Footnotes that reuse the same definition share one margin note and popover.
117
- - The footnote definitions section is hidden on desktop; margins must have
118
- room for the notes, and themes can restyle `.rr-sidenotes__note` freely.
121
+ - The footnote definitions section is hidden from tablet width up. On widths
122
+ that cannot fit an article rail, notes remain in the article flow; themes can
123
+ restyle `.rr-sidenotes__note` freely.
119
124
  - Notes inside tables or deeply nested inline markup are placed after the
120
125
  nearest block ancestor, so their vertical position is approximate.
121
126
 
122
127
  ## See also
123
128
 
124
- - [Plugin guide](../../../docs/docs/reference/plugin-api.md)
125
-
129
+ - [Plugin guide](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/reference/plugin-api.md)
package/README_ja.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @riebeckite/plugin-sidenotes
2
2
 
3
+ <!-- Generated from docs/docs/plugins/sidenotes.ja.md. Edit the canonical documentation in docs/docs/plugins and run `pnpm docs:sync`. -->
4
+
3
5
  Riebeckite 用の Tufte スタイルのサイドノート・プラグインです。執筆者は通常の
4
6
  GFM 脚注(`[^1]` と `[^1]: 本文`)をそのまま書き続けます。プラグインが生成
5
7
  された脚注マークアップを、インラインの参照リンクと、デスクトップではマージン
@@ -16,13 +18,14 @@ GFM 脚注(`[^1]` と `[^1]: 本文`)をそのまま書き続けます。プ
16
18
  - 脚注参照は `[data-rr-sidenotes-ref]` を持つ小さな参照リンク付きの `sup`
17
19
  になり、`href="#fn-…"` のリンク先は保持されます。通常のブラウザのリンク
18
20
  遷移でも脚注に到達できます。
19
- - 脚注定義は参照のそばの `.rr-sidenotes__note` の aside になります。
20
- デスクトップ(`@media (min-width: 48rem)`)では常時表示の**マージンノート**、
21
- モバイル(`@media (max-width: 48rem)`)では**ポップオーバー**として表示
22
- されます。
21
+ - 脚注定義は参照のそばの `.rr-sidenotes__note` の aside になります。タブレット
22
+ 幅以上(`@media (min-width: 48rem)`)では本文中のノートとして表示し、記事の
23
+ 横に置ける幅がある場合(`@media (min-width: 88rem)`)は sticky な**マージン
24
+ ノート**にします。モバイル(`@media (max-width: 48rem)`)では**ポップ
25
+ オーバー**として表示されます。
23
26
  - 文末の脚注定義セクションは残します(モバイルではリンク先、JavaScript が
24
- 無効な場合のフォールバックになります)。マージンノートが常に見える
25
- デスクトップでは非表示にします。
27
+ 無効な場合のフォールバックになります)。タブレット幅以上では本文中または
28
+ マージンのノートが常に見えるため、非表示にします。
26
29
 
27
30
  クライアントエントリ(`initSidenotes`)がモバイルのポップオーバーを切り替え
28
31
  ます。タップで開閉、`Escape` で閉じる、外側のクリックで閉じる、という動作です。
@@ -118,11 +121,12 @@ import "@riebeckite/plugin-sidenotes/style.css";
118
121
 
119
122
  - 同じ定義を再利用した脚注は、1 つのマージンノートとポップオーバーを共有
120
123
  します。
121
- - デスクトップでは脚注定義セクションを非表示にします。ノートを置くための
122
- 余白が必要です。テーマは `.rr-sidenotes__note` を自由に再スタイルできます。
124
+ - タブレット幅以上では脚注定義セクションを非表示にします。記事の横に置けない
125
+ 幅ではノートを本文フローに残します。テーマは `.rr-sidenotes__note` を自由に
126
+ 再スタイルできます。
123
127
  - テーブル内や深く入れ子になったインライン要素の中の注は、最も近いブロック
124
128
  要素の後ろに置かれるため、縦位置はおおよその位置になります。
125
129
 
126
130
  ## 関連リンク
127
131
 
128
- - [プラグイン API](../../../docs/docs/reference/plugin-api.ja.md)
132
+ - [プラグイン API](https://github.com/Rerurate514/riebeckite/blob/main/docs/docs/reference/plugin-api.ja.md)
package/dist/index.js CHANGED
@@ -461,12 +461,22 @@ function sidenotes(options = {}) {
461
461
  options,
462
462
  validateOptions: validateSidenotesOptions,
463
463
  rehypePlugins: [() => rehypeSidenotes(resolved)],
464
- assets: [createStyleAsset(SIDENOTES_PLUGIN_NAME)],
464
+ assets: [
465
+ createStyleAsset(
466
+ SIDENOTES_PLUGIN_NAME,
467
+ "@riebeckite/plugin-sidenotes/style.css"
468
+ )
469
+ ],
465
470
  clientEntries: [
466
- createClientEntry(SIDENOTES_PLUGIN_NAME, "initSidenotes", {
467
- openLabel: resolved.openLabel,
468
- closeLabel: resolved.closeLabel
469
- })
471
+ createClientEntry(
472
+ SIDENOTES_PLUGIN_NAME,
473
+ "@riebeckite/plugin-sidenotes/client",
474
+ "initSidenotes",
475
+ {
476
+ openLabel: resolved.openLabel,
477
+ closeLabel: resolved.closeLabel
478
+ }
479
+ )
470
480
  ]
471
481
  });
472
482
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riebeckite/plugin-sidenotes",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -21,7 +21,7 @@
21
21
  "./style.css": "./style.css"
22
22
  },
23
23
  "dependencies": {
24
- "@riebeckite/core": "0.0.21"
24
+ "@riebeckite/core": "0.0.23"
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public"
package/style.css CHANGED
@@ -87,41 +87,34 @@
87
87
  }
88
88
  }
89
89
 
90
- /* Desktop: static margin notes beside their paragraph anchor. */
91
90
  @media (min-width: 48rem) {
92
- :is(
93
- p,
94
- li,
95
- dd,
96
- dt,
97
- td,
98
- th,
99
- figcaption,
100
- h1,
101
- h2,
102
- h3,
103
- h4,
104
- h5,
105
- h6,
106
- blockquote
107
- ):has(.rr-sidenotes__ref) {
108
- position: relative;
109
- }
110
-
111
91
  .rr-sidenotes__note {
112
- position: absolute;
113
- top: 0;
114
- left: 100%;
115
- width: var(--rr-sidenotes-width, 16rem);
116
- max-width: calc(100vw - 100% - 1rem);
117
- margin-left: var(--rb-space-3, 1.5rem);
118
- padding-left: var(--rb-space-2, 1rem);
119
- border-left: calc(var(--rb-rule-width, 1px) * 2) solid
92
+ max-inline-size: 100%;
93
+ margin-block: var(--rb-space-3, 1.5rem);
94
+ padding-inline-start: var(--rb-space-2, 1rem);
95
+ border-inline-start: calc(var(--rb-rule-width, 1px) * 2) solid
120
96
  var(--rr-sidenotes-rule);
121
97
  }
122
98
 
123
- /* Margin notes are always visible, so the trailing definitions are hidden. */
124
99
  .rr-sidenotes__footnotes {
125
100
  display: none;
126
101
  }
127
102
  }
103
+
104
+ @media (min-width: 88rem) {
105
+ .rr-sidenotes__note {
106
+ position: sticky;
107
+ top: var(--rr-sidenotes-sticky-top, var(--rb-space-4, 2rem));
108
+ width: min(
109
+ var(--rr-sidenotes-width, 16rem),
110
+ calc(
111
+ (100vw - var(--rb-layout-article-max, 48rem)) /
112
+ 2 -
113
+ var(--rb-space-3, 1.5rem)
114
+ )
115
+ );
116
+ max-inline-size: none;
117
+ margin-block: 0;
118
+ margin-inline-start: calc(100% + var(--rb-space-3, 1.5rem));
119
+ }
120
+ }