duckfn-docs-kit 0.4.0 → 0.4.1

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/src/sql/sql.css CHANGED
@@ -191,12 +191,13 @@ dfk-sql:not(:defined) {
191
191
 
192
192
  /* --- Result tabs --------------------------------------------------------- */
193
193
 
194
- /* The strip is a row holding the scrolling tab list and the corner button
195
- (the fullscreen toggle, owned by `<dfk-sql>`). */
194
+ /* The strip is a row holding the scrolling tab list and, at its right end, the
195
+ chrome that acts on the result as a whole: `[the active tab's own controls]
196
+ [download] [fullscreen]`. The corner never scrolls with the list and never
197
+ shrinks, so those buttons stay put however many tabs there are. */
196
198
  .dfk-sql-tabs {
197
199
  display: flex;
198
200
  align-items: center;
199
- padding-right: 0.3rem;
200
201
  border-bottom: 1px solid var(--ifm-global-border-color, #e0e0e0);
201
202
  background: var(--ifm-color-emphasis-100, #f5f5f5);
202
203
  }
@@ -210,6 +211,63 @@ dfk-sql:not(:defined) {
210
211
  overflow-x: auto;
211
212
  }
212
213
 
214
+ .dfk-sql-tab-corner {
215
+ display: flex;
216
+ flex-shrink: 0;
217
+ align-items: center;
218
+ gap: 0.15rem;
219
+ padding-right: 0.3rem;
220
+ }
221
+
222
+ /* One tab's own controls — a table's search and view switches, a figure's zoom
223
+ and edit buttons. Written by the renderers (and by an embedded
224
+ `<dfk-mermaid>`); only the active tab's container is shown. */
225
+ .dfk-sql-tab-actions {
226
+ display: flex;
227
+ align-items: center;
228
+ gap: 0.15rem;
229
+ }
230
+
231
+ .dfk-sql-tab-actions[hidden] {
232
+ display: none;
233
+ }
234
+
235
+ /* The search box opens in place rather than as a popover over the canvas: the
236
+ table is as wide as the page, and a popover would cover the cells the reader
237
+ is searching. */
238
+ .dfk-sql-search-input {
239
+ width: 9rem;
240
+ padding: 0.1rem 0.4rem;
241
+ border: 1px solid var(--ifm-global-border-color, #e0e0e0);
242
+ border-radius: var(--ifm-global-radius, 0.25rem);
243
+ background: var(--ifm-background-surface-color, #fff);
244
+ color: var(--ifm-font-color-base, #181818);
245
+ font-family: inherit;
246
+ font-size: 0.75rem;
247
+ line-height: 1.5;
248
+ }
249
+
250
+ .dfk-sql-search-input:focus-visible {
251
+ outline: 2px solid var(--ifm-color-primary, #14459b);
252
+ outline-offset: -1px;
253
+ }
254
+
255
+ .dfk-sql-search-input[hidden] {
256
+ display: none;
257
+ }
258
+
259
+ .dfk-sql-search-count {
260
+ min-width: 2.2rem;
261
+ color: var(--ifm-color-emphasis-700, #666);
262
+ font-size: 0.7rem;
263
+ font-variant-numeric: tabular-nums;
264
+ text-align: center;
265
+ }
266
+
267
+ .dfk-sql-search-count[hidden] {
268
+ display: none;
269
+ }
270
+
213
271
  .dfk-sql-tab {
214
272
  padding: 0.15rem 0.65rem;
215
273
  border: 1px solid transparent;
@@ -317,11 +375,16 @@ dfk-sql:not(:defined) {
317
375
  bottom of the table from continuing into the page scroll (the page lurches
318
376
  upward and the example leaves the screen). It is not inherited, so it is
319
377
  declared on every scrolling box, including VTable's inner scroll containers
320
- under `.dfk-sql-table`. */
321
- .dfk-sql-panel,
378
+ under `.dfk-sql-table`.
379
+ The panel is contained **only while the result is expanded**: `contain` applies
380
+ to any box with a non-visible `overflow`, and a panel is a scroll container
381
+ whether or not it has anything to scroll — so, inline, it would swallow the
382
+ wheel that should have gone to the page (a figure is a picture there, not a
383
+ viewport: see `DfkMermaid.css`). Expanded, the panel really does scroll, and
384
+ without this the wheel would move the page *behind* the overlay instead. */
322
385
  .dfk-sql-table,
323
386
  .dfk-sql-table *,
324
- .dfk-sql-svg {
387
+ .dfk-sql-result-expanded .dfk-sql-panel {
325
388
  overscroll-behavior: contain;
326
389
  }
327
390
 
@@ -347,18 +410,37 @@ dfk-sql:not(:defined) {
347
410
  background: #fff;
348
411
  }
349
412
 
413
+ /* The `svg` result is a pan/zoom viewport (the shared `PanZoomView`), with the
414
+ SVG in its content box. It draws no frame: the result panel is the frame, and
415
+ stacking a second one behind the tab strip is what made a two-box look. The
416
+ `overflow: hidden` clips a zoomed figure instead of letting it spill over the
417
+ page, and is also what panzoom expects of a pan element's parent. */
350
418
  .dfk-sql-svg {
351
419
  width: var(--dfk-sql-preview-width, 100%);
352
420
  height: var(--dfk-sql-preview-height, auto);
353
421
  padding: 0.5rem;
354
- overflow: auto;
422
+ overflow: hidden;
355
423
  }
356
424
 
357
- .dfk-sql-svg > svg {
425
+ .dfk-sql-svg-content > svg {
426
+ display: block;
427
+ margin: 0 auto;
358
428
  max-width: 100%;
359
429
  height: auto;
360
430
  }
361
431
 
432
+ /* The cursor says what a drag will actually do, so it follows the zoom state
433
+ rather than being set once (`PanZoomView` writes the two state classes).
434
+ `cursor` is inherited, so it reaches the figure and every label in it. The
435
+ same two rules live in `DfkMermaid.css`. */
436
+ .dfk-sql-svg.dfk-panzoom-zoomed {
437
+ cursor: grab;
438
+ }
439
+
440
+ .dfk-sql-svg.dfk-panzoom-zoomed.dfk-panzoom-grabbing {
441
+ cursor: grabbing;
442
+ }
443
+
362
444
  /* --- Fullscreen ---------------------------------------------------------- */
363
445
 
364
446
  /* Also carries `.dfk-sql-result`, so `overflow` and the radius are re-declared
@@ -396,4 +478,90 @@ dfk-sql:not(:defined) {
396
478
  panel is one full-height scroll area rather than a strip. */
397
479
  .dfk-sql-result-expanded .dfk-sql-svg {
398
480
  height: 100%;
481
+ }
482
+
483
+ /* --- Source dialog ------------------------------------------------------- */
484
+
485
+ /* The `svg` viewer's source editor (`SourceDialog`). The dialog itself is
486
+ modal — it renders in the top layer, so its position needs no help — but the
487
+ class names are written by the shared widget, which `<dfk-mermaid>` uses
488
+ inside its shadow root; these rules are that sheet's `.dfk-source-dialog*`
489
+ block, in the light DOM, and the two are kept in sync by hand. */
490
+ .dfk-source-dialog {
491
+ width: min(56rem, 92vw);
492
+ max-width: none;
493
+ padding: 0;
494
+ border: 1px solid var(--ifm-global-border-color, #e0e0e0);
495
+ border-radius: var(--ifm-global-radius, 0.4rem);
496
+ background: var(--ifm-background-surface-color, #fff);
497
+ color: var(--ifm-font-color-base, #181818);
498
+ }
499
+
500
+ .dfk-source-dialog::backdrop {
501
+ background: rgb(0 0 0 / 45%);
502
+ }
503
+
504
+ .dfk-source-dialog-body {
505
+ display: flex;
506
+ flex-direction: column;
507
+ gap: 0.5rem;
508
+ padding: 0.75rem;
509
+ }
510
+
511
+ .dfk-source-dialog-title {
512
+ margin: 0;
513
+ font-size: 0.95rem;
514
+ font-weight: 600;
515
+ }
516
+
517
+ .dfk-source-dialog-editor {
518
+ border: 1px solid var(--ifm-global-border-color, #e0e0e0);
519
+ border-radius: var(--ifm-global-radius, 0.4rem);
520
+ overflow: hidden;
521
+ background: var(--ifm-background-surface-color, #fff);
522
+ font-size: var(--ifm-code-font-size, 95%);
523
+ }
524
+
525
+ .dfk-source-dialog-editor .cm-editor {
526
+ outline: none;
527
+ }
528
+
529
+ .dfk-source-dialog-editor .cm-scroller {
530
+ max-height: 55vh;
531
+ font-family: var(--ifm-font-family-monospace, ui-monospace, SFMono-Regular,
532
+ Menlo, monospace);
533
+ line-height: 1.6;
534
+ }
535
+
536
+ .dfk-source-dialog-footer {
537
+ display: flex;
538
+ justify-content: flex-end;
539
+ gap: 0.5rem;
540
+ }
541
+
542
+ .dfk-source-dialog-button {
543
+ padding: 0.3rem 0.9rem;
544
+ border: 1px solid var(--ifm-global-border-color, #e0e0e0);
545
+ border-radius: var(--ifm-global-radius, 0.25rem);
546
+ background: var(--ifm-background-surface-color, #fff);
547
+ color: var(--ifm-font-color-base, #181818);
548
+ font-family: inherit;
549
+ font-size: 0.85rem;
550
+ cursor: pointer;
551
+ }
552
+
553
+ .dfk-source-dialog-button:hover {
554
+ border-color: var(--ifm-color-primary, #14459b);
555
+ color: var(--ifm-color-primary, #14459b);
556
+ }
557
+
558
+ .dfk-source-dialog-apply {
559
+ border-color: var(--ifm-color-primary, #14459b);
560
+ background: var(--ifm-color-primary, #14459b);
561
+ color: var(--ifm-button-color, #fff);
562
+ }
563
+
564
+ .dfk-source-dialog-apply:hover {
565
+ color: var(--ifm-button-color, #fff);
566
+ filter: brightness(1.1);
399
567
  }
@@ -1,23 +0,0 @@
1
- /**
2
- * What a downloaded diagram is called.
3
- *
4
- * The name is derived from the page, not from the diagram: a diagram has no name
5
- * of its own, and the reader downloading one is after "the diagram from that
6
- * section", not `mermaid-diagram.svg`.
7
- *
8
- * Three sources, most specific first, each falling back to the next:
9
- *
10
- * 1. **The diagram's own title** — mermaid's frontmatter
11
- * (`---\ntitle: …\n---`, which mermaid itself draws above the diagram).
12
- * 2. **The nearest heading above it** — the section the diagram belongs to, which
13
- * on a docs page is what a reader would call it.
14
- * 3. **The document title** — the browser tab's title, for a diagram that sits
15
- * above every heading on its page.
16
- *
17
- * Nothing found → {@link DEFAULT_DIAGRAM_FILE}.
18
- *
19
- * This is browser-only code.
20
- */
21
- /** Used when nothing on the page says anything about this diagram. */
22
- export declare const DEFAULT_DIAGRAM_FILE = "mermaid-diagram.svg";
23
- export declare function diagramFileName(source: string, element: Element): string;