@riebeckite/plugin-sidenotes 0.0.5

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/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@riebeckite/plugin-sidenotes",
3
+ "version": "0.0.5",
4
+ "license": "Apache-2.0",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "source": "./index.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "./client": {
16
+ "types": "./dist/client.d.ts",
17
+ "import": "./dist/client.js",
18
+ "source": "./client.ts",
19
+ "default": "./dist/client.js"
20
+ },
21
+ "./style.css": "./style.css"
22
+ },
23
+ "dependencies": {
24
+ "@riebeckite/core": "0.0.5"
25
+ },
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "files": [
30
+ "LICENSE",
31
+ "README.md",
32
+ "README_ja.md",
33
+ "dist",
34
+ "style.css"
35
+ ],
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/Rerurate514/riebeckite.git",
39
+ "directory": "packages/plugins/sidenotes"
40
+ },
41
+ "homepage": "https://github.com/Rerurate514/riebeckite#readme",
42
+ "bugs": {
43
+ "url": "https://github.com/Rerurate514/riebeckite/issues"
44
+ },
45
+ "description": "Tufte-style side notes for Riebeckite footnotes, with mobile popovers",
46
+ "keywords": [
47
+ "riebeckite",
48
+ "plugin",
49
+ "sidenotes",
50
+ "footnotes"
51
+ ],
52
+ "engines": {
53
+ "node": "^20.19.0 || >=22.12.0"
54
+ },
55
+ "sideEffects": [
56
+ "./style.css"
57
+ ],
58
+ "scripts": {
59
+ "build": "node ../../../scripts/build_package.mjs"
60
+ }
61
+ }
package/style.css ADDED
@@ -0,0 +1,127 @@
1
+ /*
2
+ * @riebeckite/plugin-sidenotes
3
+ *
4
+ * Tufte-style side notes. The same `.rr-sidenotes__note` element is a static
5
+ * margin note on desktop (>= 48rem) and the popover source on mobile
6
+ * (< 48rem). Plugin CSS intentionally loads before theme CSS, so a theme can
7
+ * restyle these hooks without editing the plugin.
8
+ */
9
+
10
+ .rr-sidenotes__toggle {
11
+ color: var(--rb-color-accent, #3f5f87);
12
+ font-size: 0.75em;
13
+ line-height: 1.2;
14
+ text-decoration: underline;
15
+ text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
16
+ text-underline-offset: 0.2em;
17
+ }
18
+
19
+ .rr-sidenotes__toggle:focus-visible {
20
+ outline: 2px solid var(--rb-color-accent, #3f5f87);
21
+ outline-offset: 2px;
22
+ }
23
+
24
+ .rr-sidenotes__note {
25
+ --rr-sidenotes-ink: var(--rb-color-ink, #202020);
26
+ --rr-sidenotes-muted: var(--rb-color-muted, #6b6b6b);
27
+ --rr-sidenotes-rule: color-mix(
28
+ in srgb,
29
+ var(--rr-sidenotes-ink) 18%,
30
+ transparent
31
+ );
32
+
33
+ color: var(--rr-sidenotes-ink);
34
+ font-size: 0.8125rem;
35
+ line-height: 1.55;
36
+ }
37
+
38
+ .rr-sidenotes__index {
39
+ display: inline-block;
40
+ margin-right: 0.4em;
41
+ color: var(--rr-sidenotes-muted);
42
+ font-size: 0.75em;
43
+ font-weight: 600;
44
+ }
45
+
46
+ .rr-sidenotes__body p {
47
+ margin: 0 0 0.5em;
48
+ }
49
+
50
+ .rr-sidenotes__body p:last-child {
51
+ margin-bottom: 0;
52
+ }
53
+
54
+ .rr-sidenotes__footnotes {
55
+ font-size: 0.875rem;
56
+ color: var(--rr-sidenotes-ink);
57
+ }
58
+
59
+ /* Mobile: notes are hidden and become tap-open popovers. */
60
+ @media (max-width: 48rem) {
61
+ .rr-sidenotes__note {
62
+ position: fixed;
63
+ z-index: 60;
64
+ bottom: var(--rb-space-2, 1rem);
65
+ left: var(--rb-space-2, 1rem);
66
+ right: var(--rb-space-2, 1rem);
67
+ display: none;
68
+ max-height: min(60vh, 24rem);
69
+ overflow: auto;
70
+ padding: var(--rb-space-3, 1.5rem);
71
+ background: var(--rb-color-surface, #ffffff);
72
+ border: var(--rb-rule-width, 1px) solid var(--rr-sidenotes-rule);
73
+ box-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 0.18);
74
+ }
75
+
76
+ /* Right-edge panel variant driven by `popoverAlignment: "end"`. */
77
+ .rr-sidenotes__note--popover-end {
78
+ top: 50%;
79
+ bottom: auto;
80
+ left: auto;
81
+ width: min(20rem, calc(100vw - 2 * var(--rb-space-2, 1rem)));
82
+ transform: translateY(-50%);
83
+ }
84
+
85
+ .rr-sidenotes__note--open {
86
+ display: block;
87
+ }
88
+ }
89
+
90
+ /* Desktop: static margin notes beside their paragraph anchor. */
91
+ @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
+ .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
120
+ var(--rr-sidenotes-rule);
121
+ }
122
+
123
+ /* Margin notes are always visible, so the trailing definitions are hidden. */
124
+ .rr-sidenotes__footnotes {
125
+ display: none;
126
+ }
127
+ }