duckfn-docs-kit 0.2.1 → 0.4.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 (53) hide show
  1. package/AGENTS.md +294 -224
  2. package/README.md +10 -6
  3. package/bin/sql-verify.mjs +12 -12
  4. package/dist/IconButton.d.ts +22 -0
  5. package/dist/codemirror.d.ts +29 -0
  6. package/dist/index.d.ts +28 -7
  7. package/dist/index.js +2 -2
  8. package/dist/mermaid/DfkMermaid.d.ts +7 -0
  9. package/dist/mermaid/config.d.ts +48 -0
  10. package/dist/mermaid/remark.d.ts +40 -0
  11. package/dist/mermaid/remark.js +32 -0
  12. package/dist/mermaid/render.d.ts +94 -0
  13. package/dist/mermaid/styles.d.ts +6 -0
  14. package/dist/mermaid/title.d.ts +23 -0
  15. package/dist/{register-DKLiYs-F.js → register-Dev_kc3Z.js} +921 -579
  16. package/dist/remark.d.ts +1 -1
  17. package/dist/sql/browserRunner.d.ts +41 -0
  18. package/dist/sql/browserRunner.js +186 -0
  19. package/dist/sql/client.js +1 -1
  20. package/dist/sql/harness.d.ts +59 -0
  21. package/dist/sql/harness.js +8328 -0
  22. package/dist/sql/remark.d.ts +6 -1
  23. package/dist/sql/renderers.d.ts +2 -0
  24. package/dist/sql/runtime.d.ts +20 -0
  25. package/dist/sql/verify.d.ts +4 -5
  26. package/dist/sql/verify.js +36 -49
  27. package/package.json +6 -2
  28. package/src/IconButton.ts +50 -0
  29. package/src/codemirror.ts +88 -0
  30. package/src/index.ts +31 -7
  31. package/src/mermaid/DfkMermaid.css +289 -0
  32. package/src/mermaid/DfkMermaid.ts +557 -0
  33. package/src/mermaid/config.ts +74 -0
  34. package/src/mermaid/remark.ts +98 -0
  35. package/src/mermaid/render.ts +178 -0
  36. package/src/mermaid/styles.ts +24 -0
  37. package/src/mermaid/title.ts +127 -0
  38. package/src/register.ts +3 -0
  39. package/src/remark.ts +1 -1
  40. package/src/sql/DfkSql.css +13 -10
  41. package/src/sql/DfkSql.ts +11 -46
  42. package/src/sql/browserRunner.ts +402 -0
  43. package/src/sql/harness.ts +134 -0
  44. package/src/sql/remark.ts +6 -1
  45. package/src/sql/renderers.ts +24 -3
  46. package/src/sql/runtime.ts +44 -0
  47. package/src/sql/sql.css +13 -11
  48. package/src/sql/verify.ts +23 -41
  49. package/dist/sql/editor.d.ts +0 -16
  50. package/dist/sql/nodeRunner.d.ts +0 -51
  51. package/dist/sql/nodeRunner.js +0 -115
  52. package/src/sql/editor.ts +0 -75
  53. package/src/sql/nodeRunner.ts +0 -298
@@ -0,0 +1,289 @@
1
+ /* Shadow-root styles for `<dfk-mermaid>`: the diagram viewport, the action
2
+ cluster floating in its top-right corner, and the source-editing dialog.
3
+
4
+ Theme colours arrive through the inherited `--ifm-*` custom properties;
5
+ box-sizing must be re-declared here because the host page's universal reset
6
+ does not cross the shadow boundary. */
7
+
8
+ *,
9
+ *::before,
10
+ *::after {
11
+ box-sizing: border-box;
12
+ }
13
+
14
+ :host {
15
+ display: block;
16
+ margin: 1rem 0;
17
+ }
18
+
19
+ .dfk-mermaid-canvas {
20
+ position: relative;
21
+ }
22
+
23
+ /* The zoom/pan viewport. Panzoom transforms `.dfk-mermaid-content` *inside* this
24
+ box, so the overflow stays clipped here rather than spilling over the page —
25
+ `overflow: hidden` is also what panzoom expects of a pan element's parent. */
26
+ .dfk-mermaid-viewport {
27
+ overflow: hidden;
28
+ border: 1px solid var(--ifm-global-border-color, #e0e0e0);
29
+ border-radius: var(--ifm-global-radius, 0.4rem);
30
+ background: var(--ifm-background-surface-color, #fff);
31
+ padding: 0.75rem;
32
+ }
33
+
34
+ /* Mermaid sizes its own `<svg>` (`width="100%"` plus an inline `max-width`), so
35
+ nothing here fights that: the rules only centre it once the inline cap kicks
36
+ in, and give it a line box so the viewport has a height. */
37
+ .dfk-mermaid-content > svg {
38
+ display: block;
39
+ margin: 0 auto;
40
+ max-width: 100%;
41
+ height: auto;
42
+ }
43
+
44
+ /* --- Cursor -------------------------------------------------------------- */
45
+
46
+ /* The cursor says what a drag will actually do, which is why it is driven by the
47
+ zoom state rather than set on the element once and for all (panzoom's `cursor`
48
+ option does the latter, and it was promising a pan at fit — over text that is
49
+ perfectly selectable). `cursor` is inherited, so these two rules reach the
50
+ diagram and every label in it; the buttons override it with `pointer`. */
51
+ .dfk-mermaid-canvas.dfk-mermaid-zoomed {
52
+ cursor: grab;
53
+ }
54
+
55
+ .dfk-mermaid-canvas.dfk-mermaid-zoomed.dfk-mermaid-grabbing {
56
+ cursor: grabbing;
57
+ }
58
+
59
+ /* --- Status line --------------------------------------------------------- */
60
+
61
+ /* Doubles as the "still rendering" placeholder: the mermaid bundle is a lazy
62
+ `import()`, and this line is what the reader sees while it lands (or the error
63
+ message, if the source does not parse). It is the component's only
64
+ pre-render content — a diagram's height is unknowable before it renders, so
65
+ the alternative would be inventing a placeholder height that is wrong for
66
+ every diagram but one. */
67
+ .dfk-mermaid-message {
68
+ margin: 0.5rem 0 0;
69
+ font-size: 0.8rem;
70
+ color: var(--ifm-color-emphasis-700, #666);
71
+ }
72
+
73
+ .dfk-mermaid-message:empty {
74
+ display: none;
75
+ }
76
+
77
+ .dfk-mermaid-message-error {
78
+ padding: 0.5rem 0.75rem;
79
+ border-radius: var(--ifm-global-radius, 0.25rem);
80
+ color: var(--ifm-color-danger-contrast, #fff);
81
+ background: var(--ifm-color-danger, #d32f2f);
82
+ font-family: var(--ifm-font-family-monospace, ui-monospace, SFMono-Regular,
83
+ Menlo, monospace);
84
+ font-size: var(--ifm-code-font-size, 95%);
85
+ white-space: pre-wrap;
86
+ word-break: break-word;
87
+ }
88
+
89
+ .dfk-mermaid-canvas[hidden],
90
+ .dfk-mermaid-message[hidden] {
91
+ display: none;
92
+ }
93
+
94
+ /* --- Floating actions ---------------------------------------------------- */
95
+
96
+ /* Hover/focus-revealed, like the buttons on Docusaurus' own code blocks and the
97
+ ones on a runnable SQL block. The cluster is inert while hidden so an
98
+ invisible button is never a click target over the diagram. */
99
+ .dfk-mermaid-actions {
100
+ position: absolute;
101
+ top: 0.25rem;
102
+ right: 0.25rem;
103
+ z-index: 2;
104
+ display: flex;
105
+ align-items: center;
106
+ gap: 0.15rem;
107
+ padding: 0.1rem 0.2rem;
108
+ border-radius: var(--ifm-global-radius, 0.3rem);
109
+ background: var(--ifm-color-emphasis-100, #f5f5f5);
110
+ opacity: 0;
111
+ pointer-events: none;
112
+ transition: opacity 0.12s ease;
113
+ }
114
+
115
+ .dfk-mermaid-canvas:hover .dfk-mermaid-actions,
116
+ .dfk-mermaid-canvas:focus-within .dfk-mermaid-actions {
117
+ opacity: 1;
118
+ pointer-events: auto;
119
+ }
120
+
121
+ /* --- Icon buttons and their tooltips ------------------------------------- */
122
+
123
+ /* The class names are written by the shared `IconButton` widget
124
+ (`src/IconButton.ts`); the same rules live in `DfkSql.css` and `sql.css`,
125
+ once per shadow tree they have to reach. Keep the copies in sync. */
126
+ .dfk-icon-button {
127
+ position: relative;
128
+ display: inline-flex;
129
+ align-items: center;
130
+ justify-content: center;
131
+ width: 1.6rem;
132
+ height: 1.6rem;
133
+ padding: 0;
134
+ border: none;
135
+ border-radius: var(--ifm-global-radius, 0.25rem);
136
+ background: transparent;
137
+ color: var(--ifm-color-emphasis-700, #666);
138
+ cursor: pointer;
139
+ transition: background 0.12s ease, color 0.12s ease;
140
+ }
141
+
142
+ .dfk-icon-button:hover:not(:disabled),
143
+ .dfk-icon-button:focus-visible {
144
+ background: var(--ifm-color-emphasis-200, #e6e6e6);
145
+ color: var(--ifm-color-primary, #14459b);
146
+ }
147
+
148
+ .dfk-icon-button:disabled {
149
+ opacity: 0.45;
150
+ cursor: progress;
151
+ }
152
+
153
+ .dfk-icon-button[hidden] {
154
+ display: none;
155
+ }
156
+
157
+ .dfk-icon {
158
+ font-size: 1rem;
159
+ }
160
+
161
+ [data-tip]::after {
162
+ content: attr(data-tip);
163
+ position: absolute;
164
+ top: calc(100% + 0.3rem);
165
+ right: 0;
166
+ z-index: 2;
167
+ padding: 0.15rem 0.4rem;
168
+ border-radius: var(--ifm-global-radius, 0.25rem);
169
+ background: var(--ifm-color-emphasis-800, #333);
170
+ color: var(--ifm-color-emphasis-0, #fff);
171
+ font-size: 0.7rem;
172
+ line-height: 1.4;
173
+ white-space: nowrap;
174
+ opacity: 0;
175
+ pointer-events: none;
176
+ transition: opacity 0.12s ease;
177
+ }
178
+
179
+ [data-tip]:hover::after,
180
+ [data-tip]:focus-visible::after {
181
+ opacity: 1;
182
+ }
183
+
184
+ /* --- Fullscreen ---------------------------------------------------------- */
185
+
186
+ /* The whole canvas becomes a fixed overlay. `z-index` has to clear Docusaurus'
187
+ navbar and its own overlays. The background must be the *surface* colour, not
188
+ `--ifm-background-color`: a site may legitimately define the latter as
189
+ `transparent` (this repository's docs site does), which would leave the
190
+ overlay see-through with the page showing underneath. */
191
+ .dfk-mermaid-expanded {
192
+ position: fixed;
193
+ inset: 0;
194
+ z-index: 2147483000;
195
+ display: flex;
196
+ flex-direction: column;
197
+ background: var(--ifm-background-surface-color, #fff);
198
+ }
199
+
200
+ .dfk-mermaid-expanded .dfk-mermaid-viewport {
201
+ flex: 1;
202
+ border: none;
203
+ border-radius: 0;
204
+ }
205
+
206
+ /* --- Source dialog ------------------------------------------------------- */
207
+
208
+ .dfk-mermaid-dialog {
209
+ width: min(56rem, 92vw);
210
+ max-width: none;
211
+ padding: 0;
212
+ border: 1px solid var(--ifm-global-border-color, #e0e0e0);
213
+ border-radius: var(--ifm-global-radius, 0.4rem);
214
+ background: var(--ifm-background-surface-color, #fff);
215
+ color: var(--ifm-font-color-base, #181818);
216
+ }
217
+
218
+ .dfk-mermaid-dialog::backdrop {
219
+ background: rgb(0 0 0 / 45%);
220
+ }
221
+
222
+ .dfk-mermaid-dialog-body {
223
+ display: flex;
224
+ flex-direction: column;
225
+ gap: 0.5rem;
226
+ padding: 0.75rem;
227
+ }
228
+
229
+ .dfk-mermaid-dialog-title {
230
+ margin: 0;
231
+ font-size: 0.95rem;
232
+ font-weight: 600;
233
+ }
234
+
235
+ /* CodeMirror mounts here, inside the shadow tree, so style-mod puts its base
236
+ theme in the same root the `.cm-*` rules are needed in (`src/codemirror.ts`).
237
+ The content inset is CodeMirror's own (`padding: 4px 0`) and is left alone —
238
+ see the note in `DfkSql.css` about `ViewState.measure()`. */
239
+ .dfk-mermaid-dialog-editor {
240
+ border: 1px solid var(--ifm-global-border-color, #e0e0e0);
241
+ border-radius: var(--ifm-global-radius, 0.4rem);
242
+ overflow: hidden;
243
+ background: var(--ifm-background-surface-color, #fff);
244
+ font-size: var(--ifm-code-font-size, 95%);
245
+ }
246
+
247
+ .dfk-mermaid-dialog-editor .cm-editor {
248
+ outline: none;
249
+ }
250
+
251
+ .dfk-mermaid-dialog-editor .cm-scroller {
252
+ max-height: 55vh;
253
+ font-family: var(--ifm-font-family-monospace, ui-monospace, SFMono-Regular,
254
+ Menlo, monospace);
255
+ line-height: 1.6;
256
+ }
257
+
258
+ .dfk-mermaid-dialog-footer {
259
+ display: flex;
260
+ justify-content: flex-end;
261
+ gap: 0.5rem;
262
+ }
263
+
264
+ .dfk-mermaid-dialog-button {
265
+ padding: 0.3rem 0.9rem;
266
+ border: 1px solid var(--ifm-global-border-color, #e0e0e0);
267
+ border-radius: var(--ifm-global-radius, 0.25rem);
268
+ background: var(--ifm-background-surface-color, #fff);
269
+ color: var(--ifm-font-color-base, #181818);
270
+ font-family: inherit;
271
+ font-size: 0.85rem;
272
+ cursor: pointer;
273
+ }
274
+
275
+ .dfk-mermaid-dialog-button:hover {
276
+ border-color: var(--ifm-color-primary, #14459b);
277
+ color: var(--ifm-color-primary, #14459b);
278
+ }
279
+
280
+ .dfk-mermaid-dialog-apply {
281
+ border-color: var(--ifm-color-primary, #14459b);
282
+ background: var(--ifm-color-primary, #14459b);
283
+ color: var(--ifm-button-color, #fff);
284
+ }
285
+
286
+ .dfk-mermaid-dialog-apply:hover {
287
+ color: var(--ifm-button-color, #fff);
288
+ filter: brightness(1.1);
289
+ }