@minidocs/astro 0.0.0-stage → 0.1.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 (66) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +26 -2
  3. package/dist/behaviors.d.mts +114 -0
  4. package/dist/behaviors.mjs +635 -0
  5. package/dist/index.d.mts +25 -0
  6. package/dist/index.mjs +262 -0
  7. package/dist/links-UTLyoo_o.mjs +177 -0
  8. package/dist/loaders.d.mts +20 -0
  9. package/dist/loaders.mjs +76 -0
  10. package/dist/routing-TMqRCY2Q.mjs +48 -0
  11. package/dist/runtime.d.mts +160 -0
  12. package/dist/runtime.mjs +310 -0
  13. package/package.json +80 -3
  14. package/src/components/Prose.astro +9 -0
  15. package/src/components/callout/Root.astro +14 -0
  16. package/src/components/callout/Title.astro +9 -0
  17. package/src/components/callout/index.ts +2 -0
  18. package/src/components/index.ts +7 -0
  19. package/src/components/layout/Aside.astro +29 -0
  20. package/src/components/layout/Header.astro +18 -0
  21. package/src/components/layout/Main.astro +9 -0
  22. package/src/components/layout/Root.astro +15 -0
  23. package/src/components/layout/Sidebar.astro +9 -0
  24. package/src/components/layout/Title.astro +10 -0
  25. package/src/components/layout/index.ts +6 -0
  26. package/src/components/pager/Label.astro +9 -0
  27. package/src/components/pager/Link.astro +12 -0
  28. package/src/components/pager/Root.astro +12 -0
  29. package/src/components/pager/Title.astro +9 -0
  30. package/src/components/pager/index.ts +4 -0
  31. package/src/components/search/Count.astro +10 -0
  32. package/src/components/search/Dialog.astro +14 -0
  33. package/src/components/search/Empty.astro +10 -0
  34. package/src/components/search/Error.astro +10 -0
  35. package/src/components/search/Found.astro +10 -0
  36. package/src/components/search/Idle.astro +10 -0
  37. package/src/components/search/Input.astro +26 -0
  38. package/src/components/search/Loading.astro +10 -0
  39. package/src/components/search/Query.astro +10 -0
  40. package/src/components/search/Results.astro +20 -0
  41. package/src/components/search/Root.astro +15 -0
  42. package/src/components/search/Shortcut.astro +14 -0
  43. package/src/components/search/Trigger.astro +28 -0
  44. package/src/components/search/index.ts +13 -0
  45. package/src/components/sidebar/Group.astro +45 -0
  46. package/src/components/sidebar/Item.astro +9 -0
  47. package/src/components/sidebar/Label.astro +9 -0
  48. package/src/components/sidebar/Link.astro +23 -0
  49. package/src/components/sidebar/List.astro +11 -0
  50. package/src/components/sidebar/Root.astro +24 -0
  51. package/src/components/sidebar/Trigger.astro +29 -0
  52. package/src/components/sidebar/index.ts +7 -0
  53. package/src/components/toc/Item.astro +9 -0
  54. package/src/components/toc/Link.astro +12 -0
  55. package/src/components/toc/List.astro +11 -0
  56. package/src/components/toc/Root.astro +20 -0
  57. package/src/components/toc/index.ts +4 -0
  58. package/src/styles/base.css +41 -0
  59. package/src/styles/callout.css +58 -0
  60. package/src/styles/layout.css +406 -0
  61. package/src/styles/pager.css +51 -0
  62. package/src/styles/prose.css +218 -0
  63. package/src/styles/search.css +202 -0
  64. package/src/styles/sidebar.css +162 -0
  65. package/src/styles/toc.css +79 -0
  66. package/src/styles.css +9 -0
@@ -0,0 +1,202 @@
1
+ /* Search: the trigger, the dialog, and the states around results. Options are styled by their ARIA state. */
2
+ @layer minidocs {
3
+ .md-search-trigger {
4
+ display: inline-flex;
5
+ align-items: center;
6
+ gap: 0.5rem;
7
+ min-width: 13rem;
8
+ height: 2rem;
9
+ padding-inline: 0.625rem 0.5rem;
10
+ border: 0;
11
+ border-radius: 0.5rem;
12
+ background: color-mix(in srgb, var(--md-color-heading) 4.5%, transparent);
13
+ color: var(--md-color-muted);
14
+ font: inherit;
15
+ font-size: 0.8125rem;
16
+ cursor: pointer;
17
+ transition:
18
+ color 0.15s,
19
+ background-color 0.15s;
20
+ }
21
+
22
+ .md-search-trigger:hover {
23
+ background: color-mix(in srgb, var(--md-color-heading) 8%, transparent);
24
+ color: var(--md-color-heading);
25
+ }
26
+
27
+ .md-search-trigger:focus-visible {
28
+ outline: var(--md-focus-ring);
29
+ outline-offset: 2px;
30
+ }
31
+
32
+ /* One nested kbd per key, which styles can box or join, e.g. with a "+" before every key but the first */
33
+ .md-search-shortcut {
34
+ display: inline-flex;
35
+ gap: 0.1875em;
36
+ margin-inline-start: auto;
37
+ color: var(--md-color-muted);
38
+ font-family: var(--md-font-sans);
39
+ font-size: 0.75rem;
40
+ }
41
+
42
+ .md-search-shortcut[data-platform="apple"] {
43
+ gap: 0.0625em;
44
+ }
45
+
46
+ .md-search-shortcut kbd {
47
+ font: inherit;
48
+ }
49
+
50
+ .md-search-dialog {
51
+ box-sizing: border-box;
52
+ width: min(36rem, 100vw - 1.5rem);
53
+ max-height: min(32rem, 100dvh - 2 * min(14vh, 7rem));
54
+ margin: min(14vh, 7rem) auto auto;
55
+ padding: 0;
56
+ overflow: hidden;
57
+ border: 1px solid var(--md-color-border);
58
+ border-radius: 0.875rem;
59
+ background: var(--md-color-bg);
60
+ color: var(--md-color-text);
61
+ box-shadow: 0 24px 48px -12px rgb(0 0 0 / 0.18);
62
+ /* Set here, not on [open]: closing keeps display flex until it fades out, and a row would flash meanwhile */
63
+ flex-direction: column;
64
+ opacity: 0;
65
+ transform: scale(0.98);
66
+ transition:
67
+ opacity 0.18s,
68
+ transform 0.18s cubic-bezier(0.32, 0.72, 0, 1),
69
+ overlay 0.18s allow-discrete,
70
+ display 0.18s allow-discrete;
71
+ }
72
+
73
+ /* Results scroll on their own, below whatever sits above them */
74
+ .md-search-dialog[open] {
75
+ display: flex;
76
+ opacity: 1;
77
+ transform: none;
78
+ }
79
+
80
+ /* The page behind a modal stays put, as with the sidebar drawer */
81
+ :root:has(.md-search-dialog[open]) {
82
+ overflow: hidden;
83
+ }
84
+
85
+ .md-search-dialog::backdrop {
86
+ background: transparent;
87
+ transition:
88
+ background-color 0.18s,
89
+ overlay 0.18s allow-discrete,
90
+ display 0.18s allow-discrete;
91
+ }
92
+
93
+ .md-search-dialog[open]::backdrop {
94
+ background: light-dark(rgb(0 0 0 / 0.16), rgb(0 0 0 / 0.5));
95
+ }
96
+
97
+ @starting-style {
98
+ .md-search-dialog[open] {
99
+ opacity: 0;
100
+ transform: scale(0.98);
101
+ }
102
+
103
+ .md-search-dialog[open]::backdrop {
104
+ background: transparent;
105
+ }
106
+ }
107
+
108
+ .md-search-input {
109
+ box-sizing: border-box;
110
+ width: 100%;
111
+ min-width: 0;
112
+ padding: 0.875rem 1rem;
113
+ border: 0;
114
+ border-block-end: 1px solid var(--md-color-border);
115
+ background: transparent;
116
+ color: var(--md-color-heading);
117
+ font: inherit;
118
+ font-size: 0.9375rem;
119
+ outline: none;
120
+ }
121
+
122
+ .md-search-input::placeholder {
123
+ color: var(--md-color-muted);
124
+ }
125
+
126
+ .md-search-results {
127
+ flex: 1;
128
+ min-height: 0;
129
+ padding: 0.375rem;
130
+ overflow-y: auto;
131
+ overscroll-behavior: contain;
132
+ scroll-padding-block: 0.375rem;
133
+ }
134
+
135
+ .md-search-results [role="group"] + [role="group"] {
136
+ margin-block-start: 0.5rem;
137
+ }
138
+
139
+ .md-search-results [role="option"] {
140
+ display: block;
141
+ padding: 0.5rem 0.625rem;
142
+ border-radius: 0.5rem;
143
+ color: var(--md-color-text);
144
+ font-size: 0.875rem;
145
+ line-height: 1.45;
146
+ text-decoration: none;
147
+ cursor: pointer;
148
+ }
149
+
150
+ .md-search-results [role="option"][aria-selected="true"] {
151
+ background: var(--md-color-hover);
152
+ }
153
+
154
+ .md-search-results mark {
155
+ background: none;
156
+ color: var(--md-color-accent);
157
+ }
158
+
159
+ .md-search-idle,
160
+ .md-search-loading,
161
+ .md-search-empty,
162
+ .md-search-error {
163
+ padding: 2.25rem 1.5rem;
164
+ color: var(--md-color-muted);
165
+ font-size: 0.8125rem;
166
+ text-align: center;
167
+ text-wrap: balance;
168
+ }
169
+
170
+ .md-search-found {
171
+ color: var(--md-color-muted);
172
+ font-size: 0.75rem;
173
+ }
174
+
175
+ .md-search-query {
176
+ color: var(--md-color-heading);
177
+ }
178
+
179
+ /* Local engines answer within a frame, so a loading message that appeared at once would only flash */
180
+ .md-search-loading {
181
+ animation: md-search-reveal 0.15s 0.3s backwards;
182
+ }
183
+
184
+ /* Over earlier results, a message would push them down on every keystroke; place a spinner there yourself */
185
+ .md-search:not([data-status="loading"]) .md-search-loading {
186
+ display: none;
187
+ }
188
+
189
+ @keyframes md-search-reveal {
190
+ from {
191
+ opacity: 0;
192
+ }
193
+ }
194
+
195
+ @media (prefers-reduced-motion: reduce) {
196
+ .md-search-trigger,
197
+ .md-search-dialog,
198
+ .md-search-dialog::backdrop {
199
+ transition: none;
200
+ }
201
+ }
202
+ }
@@ -0,0 +1,162 @@
1
+ /* Sidebar: the tree itself. Where it sits and the drawer on narrow screens belong to layout.css. */
2
+ @layer minidocs {
3
+ .md-sidebar {
4
+ color: var(--md-color-text);
5
+ font-size: var(--md-sidebar-font-size);
6
+ line-height: 1.5;
7
+ }
8
+
9
+ .md-sidebar-list {
10
+ margin: 0;
11
+ padding: 0;
12
+ list-style: none;
13
+ }
14
+
15
+ .md-sidebar-item + .md-sidebar-item {
16
+ margin-block-start: 1px;
17
+ }
18
+
19
+ .md-sidebar-link,
20
+ .md-sidebar-group-title {
21
+ position: relative;
22
+ display: flex;
23
+ align-items: center;
24
+ gap: 0.5rem;
25
+ padding: var(--md-sidebar-item-padding-block) var(--md-sidebar-item-padding-inline);
26
+ border-radius: var(--md-radius);
27
+ color: inherit;
28
+ text-decoration: none;
29
+ cursor: pointer;
30
+ transition:
31
+ color 0.15s,
32
+ background-color 0.15s;
33
+ }
34
+
35
+ .md-sidebar-link:hover,
36
+ .md-sidebar-group-title:hover {
37
+ background: var(--md-color-hover);
38
+ color: var(--md-color-heading);
39
+ }
40
+
41
+ .md-sidebar :is(.md-sidebar-link, .md-sidebar-group-title):focus-visible {
42
+ outline: var(--md-focus-ring);
43
+ outline-offset: -2px;
44
+ }
45
+
46
+ .md-sidebar [aria-current="page"] {
47
+ background: var(--md-color-current);
48
+ color: var(--md-color-accent);
49
+ font-weight: 500;
50
+ }
51
+
52
+ /* Levels inside a group hang off a hairline; the current page marks its stretch of it */
53
+ .md-sidebar-group .md-sidebar-list {
54
+ margin-block: 1px;
55
+ margin-inline-start: var(--md-sidebar-indent);
56
+ padding-inline-start: var(--md-sidebar-rail-gap);
57
+ border-inline-start: 1px solid var(--md-color-border);
58
+ }
59
+
60
+ .md-sidebar-group .md-sidebar-list [aria-current="page"] {
61
+ background: none;
62
+ }
63
+
64
+ .md-sidebar-group .md-sidebar-list [aria-current="page"]::before {
65
+ content: "";
66
+ position: absolute;
67
+ inset-block: 0.25rem;
68
+ inset-inline-start: calc(-1 * var(--md-sidebar-rail-gap) - 1.5px);
69
+ width: 2px;
70
+ border-radius: 1px;
71
+ background: var(--md-color-accent);
72
+ }
73
+
74
+ .md-sidebar-label {
75
+ display: block;
76
+ margin-block-start: 1.5rem;
77
+ padding: var(--md-sidebar-item-padding-block) var(--md-sidebar-item-padding-inline);
78
+ padding-block-end: 0.25rem;
79
+ color: var(--md-color-heading);
80
+ font-size: 0.8125rem;
81
+ font-weight: 600;
82
+ }
83
+
84
+ .md-sidebar-item:first-child > .md-sidebar-label {
85
+ margin-block-start: 0;
86
+ }
87
+
88
+ /* A labelled section lists its pages without another level of indentation */
89
+ .md-sidebar-label + .md-sidebar-list {
90
+ margin-inline-start: 0;
91
+ padding-inline-start: 0;
92
+ border: 0;
93
+ }
94
+
95
+ .md-sidebar-group-title {
96
+ list-style: none;
97
+ }
98
+
99
+ .md-sidebar-group-title::-webkit-details-marker {
100
+ display: none;
101
+ }
102
+
103
+ /* Native markers vary between browsers, so groups draw their own chevron */
104
+ .md-sidebar-group-title::after {
105
+ content: "";
106
+ flex: none;
107
+ width: 0.3125rem;
108
+ height: 0.3125rem;
109
+ margin-inline: auto 0.25rem;
110
+ border-block-end: 1.5px solid currentColor;
111
+ border-inline-end: 1.5px solid currentColor;
112
+ opacity: 0.45;
113
+ transform: rotate(-45deg);
114
+ transition: transform 0.2s;
115
+ }
116
+
117
+ .md-sidebar-group[data-state="open"] > .md-sidebar-group-title::after {
118
+ transform: rotate(45deg);
119
+ }
120
+
121
+ .md-sidebar-link[data-external]::after {
122
+ content: "";
123
+ flex: none;
124
+ width: 0.4375rem;
125
+ height: 0.4375rem;
126
+ margin-inline-start: -0.125rem;
127
+ border-block-start: 1.5px solid currentColor;
128
+ border-inline-end: 1.5px solid currentColor;
129
+ opacity: 0.45;
130
+ transform: translateY(-0.125rem);
131
+ }
132
+
133
+ /* Always shown here; layout.css hides it where the sidebar has its own column */
134
+ .md-sidebar-trigger {
135
+ display: inline-flex;
136
+ align-items: center;
137
+ gap: 0.375rem;
138
+ padding: 0.375rem 0.75rem;
139
+ border: 1px solid var(--md-color-border);
140
+ border-radius: var(--md-radius);
141
+ background: transparent;
142
+ color: var(--md-color-heading);
143
+ font: inherit;
144
+ font-size: 0.875rem;
145
+ cursor: pointer;
146
+ }
147
+
148
+ .md-sidebar-trigger:hover {
149
+ background: var(--md-color-hover);
150
+ }
151
+
152
+ .md-sidebar-trigger:focus-visible {
153
+ outline: var(--md-focus-ring);
154
+ outline-offset: 2px;
155
+ }
156
+
157
+ @media (prefers-reduced-motion: reduce) {
158
+ .md-sidebar-group-title::after {
159
+ transition: none;
160
+ }
161
+ }
162
+ }
@@ -0,0 +1,79 @@
1
+ /* Table of contents. */
2
+ @layer minidocs {
3
+ .md-toc {
4
+ position: relative;
5
+ padding-inline-start: var(--md-toc-indent);
6
+ color: var(--md-color-muted);
7
+ font-size: var(--md-toc-font-size);
8
+ line-height: 1.45;
9
+ }
10
+
11
+ /* The track the reading position moves along */
12
+ .md-toc::before {
13
+ content: "";
14
+ position: absolute;
15
+ inset-block: 0;
16
+ inset-inline-start: 0;
17
+ width: 1px;
18
+ background: var(--md-color-border);
19
+ }
20
+
21
+ /* attachToc places the marker on the current link through these variables */
22
+ .md-toc::after {
23
+ content: "";
24
+ position: absolute;
25
+ top: 0;
26
+ inset-inline-start: -0.5px;
27
+ width: 2px;
28
+ height: var(--md-toc-marker-height, 0);
29
+ border-radius: 1px;
30
+ background: var(--md-color-accent);
31
+ transform: translateY(var(--md-toc-marker-top, 0));
32
+ transition:
33
+ transform 0.25s cubic-bezier(0.32, 0.72, 0, 1),
34
+ height 0.25s cubic-bezier(0.32, 0.72, 0, 1);
35
+ }
36
+
37
+ /* attachToc sets this while the marker jumps, e.g. on a page opened half way down */
38
+ .md-toc[data-md-toc-instant]::after {
39
+ transition: none;
40
+ }
41
+
42
+ .md-toc-list {
43
+ margin: 0;
44
+ padding: 0;
45
+ list-style: none;
46
+ }
47
+
48
+ .md-toc-list .md-toc-list {
49
+ padding-inline-start: var(--md-toc-indent);
50
+ }
51
+
52
+ .md-toc-link {
53
+ display: block;
54
+ padding-block: 0.3125rem;
55
+ color: inherit;
56
+ text-decoration: none;
57
+ transition: color 0.15s;
58
+ }
59
+
60
+ .md-toc-link:hover {
61
+ color: var(--md-color-heading);
62
+ }
63
+
64
+ .md-toc-link:focus-visible {
65
+ border-radius: 2px;
66
+ outline: var(--md-focus-ring);
67
+ outline-offset: 2px;
68
+ }
69
+
70
+ .md-toc-link[aria-current="true"] {
71
+ color: var(--md-color-accent);
72
+ }
73
+
74
+ @media (prefers-reduced-motion: reduce) {
75
+ .md-toc::after {
76
+ transition: none;
77
+ }
78
+ }
79
+ }
package/src/styles.css ADDED
@@ -0,0 +1,9 @@
1
+ /* All minidocs default styles. To leave a part unstyled, import base.css and the files you want from minidocs/styles/ instead. */
2
+ @import "./styles/base.css";
3
+ @import "./styles/layout.css";
4
+ @import "./styles/sidebar.css";
5
+ @import "./styles/toc.css";
6
+ @import "./styles/prose.css";
7
+ @import "./styles/pager.css";
8
+ @import "./styles/callout.css";
9
+ @import "./styles/search.css";