@connextar/house 0.1.1 → 0.3.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 (148) hide show
  1. package/README.md +286 -28
  2. package/dist/changelog/changelog.d.ts +60 -0
  3. package/dist/changelog/changelog.d.ts.map +1 -0
  4. package/dist/changelog/changelog.js +61 -0
  5. package/dist/changelog/changelog.js.map +1 -0
  6. package/dist/changelog/index.d.ts +2 -0
  7. package/dist/changelog/index.d.ts.map +1 -0
  8. package/dist/changelog/index.js +2 -0
  9. package/dist/changelog/index.js.map +1 -0
  10. package/dist/editor/block-handle.d.ts +15 -0
  11. package/dist/editor/block-handle.d.ts.map +1 -0
  12. package/dist/editor/block-handle.js +106 -0
  13. package/dist/editor/block-handle.js.map +1 -0
  14. package/dist/editor/blocks.d.ts +35 -0
  15. package/dist/editor/blocks.d.ts.map +1 -0
  16. package/dist/editor/blocks.js +114 -0
  17. package/dist/editor/blocks.js.map +1 -0
  18. package/dist/editor/bubble-toolbar.d.ts +11 -0
  19. package/dist/editor/bubble-toolbar.d.ts.map +1 -0
  20. package/dist/editor/bubble-toolbar.js +87 -0
  21. package/dist/editor/bubble-toolbar.js.map +1 -0
  22. package/dist/editor/content-index.d.ts +2 -0
  23. package/dist/editor/content-index.d.ts.map +1 -0
  24. package/dist/editor/content-index.js +2 -0
  25. package/dist/editor/content-index.js.map +1 -0
  26. package/dist/editor/content.d.ts +30 -0
  27. package/dist/editor/content.d.ts.map +1 -0
  28. package/dist/editor/content.js +256 -0
  29. package/dist/editor/content.js.map +1 -0
  30. package/dist/editor/editor.d.ts +52 -0
  31. package/dist/editor/editor.d.ts.map +1 -0
  32. package/dist/editor/editor.js +160 -0
  33. package/dist/editor/editor.js.map +1 -0
  34. package/dist/editor/emoji-index.d.ts +2 -0
  35. package/dist/editor/emoji-index.d.ts.map +1 -0
  36. package/dist/editor/emoji-index.js +2 -0
  37. package/dist/editor/emoji-index.js.map +1 -0
  38. package/dist/editor/emoji-picker.d.ts +16 -0
  39. package/dist/editor/emoji-picker.d.ts.map +1 -0
  40. package/dist/editor/emoji-picker.js +37 -0
  41. package/dist/editor/emoji-picker.js.map +1 -0
  42. package/dist/editor/emoji.d.ts +18 -0
  43. package/dist/editor/emoji.d.ts.map +1 -0
  44. package/dist/editor/emoji.js +418 -0
  45. package/dist/editor/emoji.js.map +1 -0
  46. package/dist/editor/index.d.ts +5 -0
  47. package/dist/editor/index.d.ts.map +1 -0
  48. package/dist/editor/index.js +6 -0
  49. package/dist/editor/index.js.map +1 -0
  50. package/dist/editor/suggestion-popup.d.ts +17 -0
  51. package/dist/editor/suggestion-popup.d.ts.map +1 -0
  52. package/dist/editor/suggestion-popup.js +57 -0
  53. package/dist/editor/suggestion-popup.js.map +1 -0
  54. package/dist/editor/suggestions.d.ts +93 -0
  55. package/dist/editor/suggestions.d.ts.map +1 -0
  56. package/dist/editor/suggestions.js +179 -0
  57. package/dist/editor/suggestions.js.map +1 -0
  58. package/dist/editor/ui.d.ts +54 -0
  59. package/dist/editor/ui.d.ts.map +1 -0
  60. package/dist/editor/ui.js +58 -0
  61. package/dist/editor/ui.js.map +1 -0
  62. package/dist/house.css +333 -0
  63. package/dist/internal/cx.d.ts +3 -0
  64. package/dist/internal/cx.d.ts.map +1 -0
  65. package/dist/internal/cx.js +5 -0
  66. package/dist/internal/cx.js.map +1 -0
  67. package/dist/internal/next-link.d.ts +23 -0
  68. package/dist/internal/next-link.d.ts.map +1 -0
  69. package/dist/internal/next-link.js +3 -0
  70. package/dist/internal/next-link.js.map +1 -0
  71. package/dist/markdown/guide.d.ts +98 -0
  72. package/dist/markdown/guide.d.ts.map +1 -0
  73. package/dist/markdown/guide.js +328 -0
  74. package/dist/markdown/guide.js.map +1 -0
  75. package/dist/markdown/index.d.ts +4 -0
  76. package/dist/markdown/index.d.ts.map +1 -0
  77. package/dist/markdown/index.js +4 -0
  78. package/dist/markdown/index.js.map +1 -0
  79. package/dist/markdown/table-view.d.ts +28 -0
  80. package/dist/markdown/table-view.d.ts.map +1 -0
  81. package/dist/markdown/table-view.js +25 -0
  82. package/dist/markdown/table-view.js.map +1 -0
  83. package/dist/markdown/table.d.ts +35 -0
  84. package/dist/markdown/table.d.ts.map +1 -0
  85. package/dist/markdown/table.js +79 -0
  86. package/dist/markdown/table.js.map +1 -0
  87. package/dist/release/changelog.d.ts +72 -0
  88. package/dist/release/changelog.d.ts.map +1 -0
  89. package/dist/release/changelog.js +92 -0
  90. package/dist/release/changelog.js.map +1 -0
  91. package/dist/release/index.d.ts +3 -0
  92. package/dist/release/index.d.ts.map +1 -0
  93. package/dist/release/index.js +3 -0
  94. package/dist/release/index.js.map +1 -0
  95. package/dist/release/version.d.ts +33 -0
  96. package/dist/release/version.d.ts.map +1 -0
  97. package/dist/release/version.js +57 -0
  98. package/dist/release/version.js.map +1 -0
  99. package/dist/trail/index.d.ts +3 -0
  100. package/dist/trail/index.d.ts.map +1 -0
  101. package/dist/trail/index.js +3 -0
  102. package/dist/trail/index.js.map +1 -0
  103. package/dist/trail/rules.d.ts +44 -0
  104. package/dist/trail/rules.d.ts.map +1 -0
  105. package/dist/trail/rules.js +74 -0
  106. package/dist/trail/rules.js.map +1 -0
  107. package/dist/trail/trail.d.ts +49 -0
  108. package/dist/trail/trail.d.ts.map +1 -0
  109. package/dist/trail/trail.js +188 -0
  110. package/dist/trail/trail.js.map +1 -0
  111. package/dist/ux/errors.d.ts +26 -0
  112. package/dist/ux/errors.d.ts.map +1 -0
  113. package/dist/ux/errors.js +33 -0
  114. package/dist/ux/errors.js.map +1 -0
  115. package/dist/ux/feedback.d.ts +23 -0
  116. package/dist/ux/feedback.d.ts.map +1 -0
  117. package/dist/ux/feedback.js +22 -0
  118. package/dist/ux/feedback.js.map +1 -0
  119. package/dist/ux/index.d.ts +20 -0
  120. package/dist/ux/index.d.ts.map +1 -0
  121. package/dist/ux/index.js +20 -0
  122. package/dist/ux/index.js.map +1 -0
  123. package/dist/ux/navigation-index.d.ts +10 -0
  124. package/dist/ux/navigation-index.d.ts.map +1 -0
  125. package/dist/ux/navigation-index.js +10 -0
  126. package/dist/ux/navigation-index.js.map +1 -0
  127. package/dist/ux/navigation-progress.d.ts +53 -0
  128. package/dist/ux/navigation-progress.d.ts.map +1 -0
  129. package/dist/ux/navigation-progress.js +245 -0
  130. package/dist/ux/navigation-progress.js.map +1 -0
  131. package/dist/ux/optimistic.d.ts +139 -0
  132. package/dist/ux/optimistic.d.ts.map +1 -0
  133. package/dist/ux/optimistic.js +242 -0
  134. package/dist/ux/optimistic.js.map +1 -0
  135. package/dist/ux/use-action.d.ts +60 -0
  136. package/dist/ux/use-action.d.ts.map +1 -0
  137. package/dist/ux/use-action.js +100 -0
  138. package/dist/ux/use-action.js.map +1 -0
  139. package/dist/ux/use-optimistic-list.d.ts +69 -0
  140. package/dist/ux/use-optimistic-list.d.ts.map +1 -0
  141. package/dist/ux/use-optimistic-list.js +115 -0
  142. package/dist/ux/use-optimistic-list.js.map +1 -0
  143. package/dist/ux/use-optimistic-value.d.ts +40 -0
  144. package/dist/ux/use-optimistic-value.d.ts.map +1 -0
  145. package/dist/ux/use-optimistic-value.js +68 -0
  146. package/dist/ux/use-optimistic-value.js.map +1 -0
  147. package/docs/ReleaseProcess.md +315 -0
  148. package/package.json +83 -11
package/dist/house.css ADDED
@@ -0,0 +1,333 @@
1
+ /*
2
+ * @connextar/house — the styles its components need that utility classes
3
+ * cannot say: rich text, the editor's own chrome, and the trail's tinted pills.
4
+ *
5
+ * Import it once in the app's global stylesheet, after Tailwind:
6
+ *
7
+ * @import "tailwindcss";
8
+ * @import "@connextar/house/house.css";
9
+ * @source "../node_modules/@connextar/house/dist";
10
+ *
11
+ * The @source line is not optional. Tailwind does not scan node_modules, so
12
+ * without it every utility class that appears only inside this package — and
13
+ * the components use many — is silently missing from the build.
14
+ *
15
+ * Colours come from the app's own theme tokens (--primary, --border, …) through
16
+ * a --house-* variable at each use, so a theme that stores tokens as HSL
17
+ * triplets ("222 47% 11%") can map them once without forking this file:
18
+ *
19
+ * :root { --house-primary: hsl(var(--primary)); --house-border: hsl(var(--border)); … }
20
+ */
21
+
22
+ @layer components {
23
+ /* ── Rich text — the editor while writing, and RichTextContent while reading ── */
24
+
25
+ .house-prose {
26
+ color: var(--house-foreground, var(--foreground));
27
+ line-height: 1.65;
28
+ font-size: 0.925rem;
29
+ }
30
+
31
+ .house-prose h1,
32
+ .house-prose h2,
33
+ .house-prose h3 {
34
+ font-weight: 650;
35
+ color: var(--house-foreground, var(--foreground));
36
+ line-height: 1.25;
37
+ margin: 1.4em 0 0.5em;
38
+ }
39
+
40
+ .house-prose h1 {
41
+ font-size: 1.5em;
42
+ }
43
+ .house-prose h2 {
44
+ font-size: 1.25em;
45
+ }
46
+ .house-prose h3 {
47
+ font-size: 1.1em;
48
+ }
49
+
50
+ .house-prose h1:first-child,
51
+ .house-prose h2:first-child,
52
+ .house-prose h3:first-child,
53
+ .house-prose p:first-child {
54
+ margin-top: 0;
55
+ }
56
+
57
+ .house-prose p {
58
+ margin: 0.45em 0;
59
+ }
60
+
61
+ .house-prose ul,
62
+ .house-prose ol {
63
+ margin: 0.45em 0;
64
+ padding-left: 1.4em;
65
+ }
66
+
67
+ .house-prose ul {
68
+ list-style: disc;
69
+ }
70
+ .house-prose ol {
71
+ list-style: decimal;
72
+ }
73
+ .house-prose li {
74
+ margin: 0.2em 0;
75
+ }
76
+ .house-prose li > ul,
77
+ .house-prose li > ol {
78
+ margin: 0.15em 0;
79
+ }
80
+
81
+ /* Task lists — both the editor's data-type DOM and the renderer's own. */
82
+ .house-prose ul[data-type="taskList"],
83
+ .house-prose ul.house-task-list {
84
+ list-style: none;
85
+ padding-left: 0.2em;
86
+ }
87
+
88
+ .house-prose ul[data-type="taskList"] li,
89
+ .house-prose ul.house-task-list li {
90
+ display: flex;
91
+ align-items: baseline;
92
+ gap: 0.55em;
93
+ }
94
+
95
+ .house-prose ul[data-type="taskList"] li > label {
96
+ flex: 0 0 auto;
97
+ user-select: none;
98
+ }
99
+
100
+ .house-prose ul[data-type="taskList"] li > div {
101
+ flex: 1 1 auto;
102
+ }
103
+
104
+ .house-prose input[type="checkbox"] {
105
+ accent-color: var(--house-primary, var(--primary));
106
+ width: 0.95em;
107
+ height: 0.95em;
108
+ position: relative;
109
+ top: 0.08em;
110
+ }
111
+
112
+ .house-prose li[data-checked="true"] > div,
113
+ .house-prose li.house-task-done > span {
114
+ color: var(--house-muted-foreground, var(--muted-foreground));
115
+ text-decoration: line-through;
116
+ }
117
+
118
+ .house-prose blockquote {
119
+ margin: 0.7em 0;
120
+ border-left: 3px solid color-mix(in oklab, var(--house-primary, var(--primary)) 60%, transparent);
121
+ padding: 0.1em 0 0.1em 0.9em;
122
+ color: var(--house-muted-foreground, var(--muted-foreground));
123
+ font-style: italic;
124
+ }
125
+
126
+ .house-prose code {
127
+ background: var(--house-muted, var(--muted));
128
+ border-radius: 0.3em;
129
+ padding: 0.12em 0.35em;
130
+ font-size: 0.86em;
131
+ font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
132
+ }
133
+
134
+ .house-prose pre {
135
+ background: var(--house-muted, var(--muted));
136
+ border: 1px solid var(--house-border, var(--border));
137
+ border-radius: 0.5rem;
138
+ padding: 0.7em 0.9em;
139
+ margin: 0.7em 0;
140
+ overflow-x: auto;
141
+ }
142
+
143
+ .house-prose pre code {
144
+ background: transparent;
145
+ padding: 0;
146
+ font-size: 0.85em;
147
+ }
148
+
149
+ .house-prose hr {
150
+ border: 0;
151
+ border-top: 1px solid var(--house-border, var(--border));
152
+ margin: 1.2em 0;
153
+ }
154
+
155
+ .house-prose a {
156
+ color: var(--house-primary, var(--primary));
157
+ font-weight: 500;
158
+ text-decoration: underline;
159
+ text-decoration-color: color-mix(in oklab, var(--house-primary, var(--primary)) 40%, transparent);
160
+ text-underline-offset: 2px;
161
+ }
162
+
163
+ /* An inline #hashtag, a quiet chip in read views. */
164
+ .house-prose .house-hashtag {
165
+ color: var(--house-primary, var(--primary));
166
+ background: color-mix(in oklab, var(--house-primary, var(--primary)) 10%, transparent);
167
+ border-radius: 0.35em;
168
+ padding: 0.05em 0.3em;
169
+ font-weight: 500;
170
+ font-size: 0.92em;
171
+ }
172
+
173
+ /* ── The editor ─────────────────────────────────────────────────────────── */
174
+
175
+ /* The content area (Tiptap adds .tiptap to the contenteditable). */
176
+ .house-rich-text .tiptap {
177
+ outline: none;
178
+ min-height: var(--rich-text-min-height, 7rem);
179
+ padding: 0.65rem 0.85rem;
180
+ }
181
+
182
+ /* A page editor: a gutter on the left for each block's `+` and grip, and no
183
+ box — the page is the surface. */
184
+ .house-rich-text--document {
185
+ --rich-text-min-height: 20rem;
186
+ }
187
+
188
+ .house-rich-text--document .tiptap {
189
+ padding: 0.5rem 1rem 6rem 2.75rem;
190
+ }
191
+
192
+ /* The empty document's prompt, and "Type / for blocks" on an empty block. */
193
+ .house-rich-text .tiptap .is-empty::before {
194
+ content: attr(data-placeholder);
195
+ float: left;
196
+ height: 0;
197
+ pointer-events: none;
198
+ color: var(--house-muted-foreground, var(--muted-foreground));
199
+ }
200
+
201
+ /* The block gutter: `+` and grip beside the hovered block. The extension
202
+ positions it; this only styles it and fades it in. */
203
+ .house-block-handle {
204
+ display: flex;
205
+ align-items: center;
206
+ gap: 1px;
207
+ margin-right: 0.25rem;
208
+ opacity: 0;
209
+ transition: opacity 120ms ease;
210
+ }
211
+
212
+ .house-block-handle[data-show="true"],
213
+ .house-block-handle:hover,
214
+ .house-block-handle:focus-within,
215
+ .house-rich-text--document:hover .house-block-handle {
216
+ opacity: 1;
217
+ }
218
+
219
+ /* A block picked up by its grip, or selected whole. */
220
+ .house-rich-text .tiptap .ProseMirror-selectednode,
221
+ .house-rich-text .tiptap [draggable="true"]:active {
222
+ background: color-mix(in oklab, var(--house-primary, var(--primary)) 8%, transparent);
223
+ border-radius: 0.375rem;
224
+ }
225
+
226
+ .house-rich-text .tiptap.dragging,
227
+ .house-rich-text .tiptap.dragging * {
228
+ cursor: grabbing;
229
+ }
230
+
231
+ /* The in-flight text of a lookup, before it resolves. */
232
+ .house-rich-text .house-suggestion {
233
+ color: var(--house-primary, var(--primary));
234
+ background: color-mix(in oklab, var(--house-primary, var(--primary)) 8%, transparent);
235
+ border-radius: 0.25em;
236
+ }
237
+
238
+ /* ── The trail ──────────────────────────────────────────────────────────── */
239
+
240
+ /* Each step deeper a shade further from the card, so the rail reads as depth. */
241
+ .house-trail-pill {
242
+ background: color-mix(
243
+ in oklab,
244
+ var(--house-card, var(--card)) calc(100% - var(--house-trail-step, 0) * 6%),
245
+ var(--house-accent, var(--accent))
246
+ );
247
+ }
248
+
249
+ .house-trail-pill[data-current] {
250
+ box-shadow: inset 3px 0 0 var(--house-primary, var(--primary));
251
+ }
252
+ }
253
+
254
+ /* The trail bar shows below the lg breakpoint and adds its height less the page
255
+ padding it overlaps. A screen that fills the viewport subtracts --trail-bar so
256
+ the page doesn't scroll by that much. */
257
+ @media (width < 64rem) {
258
+ :root:has([data-trail-bar]) {
259
+ --trail-bar: 37px;
260
+ }
261
+ }
262
+
263
+ /* ── Busy controls (@connextar/house/ux) ────────────────────────────────
264
+ One rule for "this is working on it", wherever the click landed.
265
+
266
+ `data-busy` is set by two things that never meet: the app's own button, for
267
+ an action whose spinner it cannot render inside (a button that forwards to a
268
+ `Link` has nowhere to put one), and `NavigationProgress`, for whichever link
269
+ or menu item was clicked. Neither knows what the other is, so the agreement
270
+ is an attribute and this stylesheet.
271
+
272
+ The spinner is a pseudo-element on purpose: the navigation watcher marks DOM
273
+ nodes it has never rendered and cannot re-render — a sidebar link, a row in
274
+ a table, a dropdown item from a page this package has never heard of — and
275
+ CSS is the only thing that reaches all of them. It lays out as a flex item
276
+ where the control is a flex container, and inline after the label where it
277
+ is not, so it takes its own space instead of sitting on top of the words.
278
+
279
+ `currentColor` throughout: no theme token, so it lands in any app's palette. */
280
+
281
+ @layer components {
282
+ [data-busy="true"] {
283
+ cursor: progress;
284
+ }
285
+
286
+ [data-busy="true"]::after {
287
+ content: "";
288
+ display: inline-block;
289
+ flex: none;
290
+ width: 0.875rem;
291
+ height: 0.875rem;
292
+ margin-inline-start: 0.4rem;
293
+ vertical-align: -0.1875em;
294
+ border-radius: 9999px;
295
+ border: 2px solid currentColor;
296
+ border-inline-end-color: transparent;
297
+ opacity: 0.65;
298
+ animation: house-spin 0.6s linear infinite;
299
+ }
300
+
301
+ /* A flex control already spaces its children with `gap`. */
302
+ [data-busy="true"]:is(.inline-flex, .flex)::after {
303
+ margin-inline-start: 0;
304
+ }
305
+
306
+ /* A control that renders its own spinner marks it `.house-spinner`, so it
307
+ does not end up with two. */
308
+ [data-busy="true"]:has(> .house-spinner)::after {
309
+ content: none;
310
+ }
311
+ }
312
+
313
+ /* Keyframes must sit outside @layer. */
314
+ @keyframes house-spin {
315
+ to {
316
+ transform: rotate(360deg);
317
+ }
318
+ }
319
+
320
+ @media (prefers-reduced-motion: reduce) {
321
+ .house-block-handle {
322
+ transition: none;
323
+ }
324
+
325
+ /* Stillness was asked for, but silence is not the alternative: the ring
326
+ stays, it just stops going round. Removing it altogether would take away
327
+ the only thing on screen saying the click was heard. */
328
+ [data-busy="true"]::after {
329
+ animation: none !important;
330
+ border-inline-end-color: currentColor;
331
+ opacity: 0.45;
332
+ }
333
+ }
@@ -0,0 +1,3 @@
1
+ /** Join class names, dropping the falsy ones. The package's own `cn`, so it imports no app's. */
2
+ export declare function cx(...parts: Array<string | false | null | undefined>): string;
3
+ //# sourceMappingURL=cx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cx.d.ts","sourceRoot":"","sources":["../../src/internal/cx.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,wBAAgB,EAAE,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,MAAM,CAE7E"}
@@ -0,0 +1,5 @@
1
+ /** Join class names, dropping the falsy ones. The package's own `cn`, so it imports no app's. */
2
+ export function cx(...parts) {
3
+ return parts.filter(Boolean).join(" ");
4
+ }
5
+ //# sourceMappingURL=cx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cx.js","sourceRoot":"","sources":["../../src/internal/cx.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,MAAM,UAAU,EAAE,CAAC,GAAG,KAA+C;IACnE,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import NextLink from "next/link.js";
2
+ /**
3
+ * `next/link`, typed as the component it is.
4
+ *
5
+ * next/link is CommonJS, and Next ends that file with
6
+ * `module.exports = exports.default`, so a default import is the component under
7
+ * a bundler and under Node's own ESM loader (Vitest) alike. Only TypeScript
8
+ * disagrees: under `nodenext` it types a CommonJS default import as the whole
9
+ * module. The cast fixes the type and nothing else.
10
+ *
11
+ * It must stay a cast. In a server component the import is a client reference,
12
+ * and reading any property of one — `.default` included — throws "You cannot
13
+ * dot into a client module from a server component" and fails the page's
14
+ * prerender. `next-link.test.ts` holds that line.
15
+ *
16
+ * The specifier carries `.js` because `next` publishes no exports map. Next
17
+ * aliases the fully specified path to the App Router's Link exactly as it does
18
+ * the bare one (see its build/create-compiler-aliases.js).
19
+ */
20
+ type LinkComponent = typeof NextLink.default;
21
+ export declare const Link: LinkComponent;
22
+ export {};
23
+ //# sourceMappingURL=next-link.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"next-link.d.ts","sourceRoot":"","sources":["../../src/internal/next-link.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,cAAc,CAAC;AAEpC;;;;;;;;;;;;;;;;;GAiBG;AACH,KAAK,aAAa,GAAG,OAAO,QAAQ,CAAC,OAAO,CAAC;AAE7C,eAAO,MAAM,IAAI,EAA0B,aAAa,CAAC"}
@@ -0,0 +1,3 @@
1
+ import NextLink from "next/link.js";
2
+ export const Link = NextLink;
3
+ //# sourceMappingURL=next-link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"next-link.js","sourceRoot":"","sources":["../../src/internal/next-link.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,cAAc,CAAC;AAsBpC,MAAM,CAAC,MAAM,IAAI,GAAG,QAAoC,CAAC"}
@@ -0,0 +1,98 @@
1
+ import type { ReactNode } from "react";
2
+ import { type MarkdownTableClassNames } from "./table-view.js";
3
+ /**
4
+ * The help-centre guide renderer: Markdown files under `docs/guides/` drawn as a
5
+ * public page, with no Markdown library.
6
+ *
7
+ * Five apps each carried a copy of this, and the copies had drifted in the ways
8
+ * copies do. Two drew tables and three printed them as a paragraph of pipes; one
9
+ * kept a wrapped list line in its item and four broke it into a stray paragraph;
10
+ * one refused `javascript:` links and four passed them through; four numbered a
11
+ * repeated heading `-2` and one `-1`; and three let an `####` heading shift the
12
+ * numbering of the `##` headings after it, so a "Jump to" link could land on the
13
+ * wrong section. This is the union of the fixes.
14
+ *
15
+ * The syntax is the constrained subset guides use: `##`–`####` headings,
16
+ * paragraphs, blockquotes, ordered and unordered lists, tables, fenced code,
17
+ * horizontal rules, and inline bold, italic, code and links. Raw HTML is never
18
+ * interpreted, so a guide cannot put markup on a public page.
19
+ *
20
+ * Server-safe: no hooks, no client boundary.
21
+ */
22
+ export interface ParsedGuide {
23
+ /** The H1, with any trailing " — User Guide" removed. */
24
+ title: string;
25
+ /** The blockquote straight under the title — the page's lede — if there is one. */
26
+ lede?: string;
27
+ /** Everything after the title and lede. */
28
+ body: string;
29
+ }
30
+ export interface GuideHeading {
31
+ id: string;
32
+ text: string;
33
+ level: 2 | 3;
34
+ }
35
+ export interface HowToStep {
36
+ name: string;
37
+ text: string;
38
+ }
39
+ /** Split a raw guide into its title, lede and body. */
40
+ export declare function parseGuideFrontmatter(markdown: string): ParsedGuide;
41
+ /** Inline Markdown reduced to plain text, for structured data and search. */
42
+ export declare function stripInline(text: string): string;
43
+ /** A heading's text as a URL fragment, before de-duplication. */
44
+ export declare function headingSlug(text: string): string;
45
+ /**
46
+ * Hands out unique fragments in document order: the second "Tips" is `tips-2`.
47
+ * The renderer and `extractHeadings` each take one, and both feed it exactly the
48
+ * `##` and `###` headings outside code fences — which is what keeps a contents
49
+ * link and the heading it points at in step.
50
+ */
51
+ export declare function createHeadingIds(): (text: string) => string;
52
+ /** The `##` and `###` headings, in order, with the ids the renderer gives them. */
53
+ export declare function extractHeadings(body: string): GuideHeading[];
54
+ /**
55
+ * The `###` steps of a guide's "## Step by step" section as plain text, for
56
+ * HowTo structured data. Each step's text is its prose and list lines, capped
57
+ * so the schema stays lean. Empty when the guide has no such section.
58
+ */
59
+ export declare function extractHowToSteps(body: string): HowToStep[];
60
+ export interface GuideLinkOptions {
61
+ /** The public route guides live under. */
62
+ guidesPath?: string;
63
+ /** The file name (without `.md`) of the guide index, which links to `guidesPath` itself. */
64
+ indexSlug?: string;
65
+ }
66
+ /**
67
+ * Where a link in a guide goes. `other-guide.md#part` becomes
68
+ * `/guides/other-guide#part`; same-site paths, fragments, `mailto:` and web
69
+ * addresses pass through; anything else — `javascript:`, `data:`, a
70
+ * protocol-relative `//host` — becomes `#`.
71
+ */
72
+ export declare function resolveGuideHref(href: string, { guidesPath, indexSlug }?: GuideLinkOptions): string;
73
+ /** Every element a guide draws. Each value replaces the default for that element. */
74
+ export interface GuideClassNames {
75
+ h2: string;
76
+ h3: string;
77
+ h4: string;
78
+ paragraph: string;
79
+ blockquote: string;
80
+ orderedList: string;
81
+ unorderedList: string;
82
+ listItem: string;
83
+ link: string;
84
+ strong: string;
85
+ code: string;
86
+ pre: string;
87
+ hr: string;
88
+ table: Partial<MarkdownTableClassNames>;
89
+ }
90
+ /** The house look, on the shared theme tokens. */
91
+ export declare const GUIDE_CLASS_NAMES: GuideClassNames;
92
+ export interface GuideMarkdownProps extends GuideLinkOptions {
93
+ content: string;
94
+ classNames?: Partial<GuideClassNames>;
95
+ }
96
+ /** Render a guide body. */
97
+ export declare function GuideMarkdown({ content, guidesPath, indexSlug, classNames }: GuideMarkdownProps): ReactNode;
98
+ //# sourceMappingURL=guide.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guide.d.ts","sourceRoot":"","sources":["../../src/markdown/guide.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,EAAqB,KAAK,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAElF;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,WAAW;IAC1B,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,mFAAmF;IACnF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC;CACd;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AASD,uDAAuD;AACvD,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CA0BnE;AAED,6EAA6E;AAC7E,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAShD;AAED,iEAAiE;AACjE,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOhD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAQ3D;AAED,mFAAmF;AACnF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE,CAkB5D;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,CAmC3D;AAED,MAAM,WAAW,gBAAgB;IAC/B,0CAA0C;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4FAA4F;IAC5F,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,UAAsB,EAAE,SAAS,EAAE,GAAE,gBAAqB,GAAG,MAAM,CAUnH;AAED,qFAAqF;AACrF,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC;CACzC;AAED,kDAAkD;AAClD,eAAO,MAAM,iBAAiB,EAAE,eAe/B,CAAC;AAEF,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IAC1D,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CACvC;AAED,2BAA2B;AAC3B,wBAAgB,aAAa,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE,kBAAkB,GAAG,SAAS,CAoL3G"}