duckfn-docs-kit 0.3.0 → 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.
- package/AGENTS.md +294 -234
- package/README.md +10 -6
- package/dist/IconButton.d.ts +22 -0
- package/dist/codemirror.d.ts +29 -0
- package/dist/index.d.ts +28 -7
- package/dist/index.js +2 -2
- package/dist/mermaid/DfkMermaid.d.ts +7 -0
- package/dist/mermaid/config.d.ts +48 -0
- package/dist/mermaid/remark.d.ts +40 -0
- package/dist/mermaid/remark.js +32 -0
- package/dist/mermaid/render.d.ts +94 -0
- package/dist/mermaid/styles.d.ts +6 -0
- package/dist/mermaid/title.d.ts +23 -0
- package/dist/{register-CALCwFBv.js → register-Dev_kc3Z.js} +891 -558
- package/dist/remark.d.ts +1 -1
- package/dist/sql/client.js +1 -1
- package/dist/sql/remark.d.ts +6 -1
- package/dist/sql/renderers.d.ts +2 -0
- package/package.json +4 -1
- package/src/IconButton.ts +50 -0
- package/src/codemirror.ts +88 -0
- package/src/index.ts +31 -7
- package/src/mermaid/DfkMermaid.css +289 -0
- package/src/mermaid/DfkMermaid.ts +557 -0
- package/src/mermaid/config.ts +74 -0
- package/src/mermaid/remark.ts +98 -0
- package/src/mermaid/render.ts +178 -0
- package/src/mermaid/styles.ts +24 -0
- package/src/mermaid/title.ts +127 -0
- package/src/register.ts +3 -0
- package/src/remark.ts +1 -1
- package/src/sql/DfkSql.css +13 -10
- package/src/sql/DfkSql.ts +11 -46
- package/src/sql/remark.ts +6 -1
- package/src/sql/renderers.ts +24 -3
- package/src/sql/sql.css +13 -11
- package/dist/sql/editor.d.ts +0 -16
- package/src/sql/editor.ts +0 -75
package/src/sql/sql.css
CHANGED
|
@@ -237,11 +237,13 @@ dfk-sql:not(:defined) {
|
|
|
237
237
|
|
|
238
238
|
/* --- Icon buttons and their tooltips ------------------------------------- */
|
|
239
239
|
|
|
240
|
-
/* The
|
|
241
|
-
`
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
240
|
+
/* The class names are written by the shared `IconButton` widget
|
|
241
|
+
(`src/IconButton.ts`). The same rules (and the `[data-tip]` tooltip below) are
|
|
242
|
+
declared in `DfkSql.css` and `DfkMermaid.css`, because the buttons are split
|
|
243
|
+
across shadow boundaries: the code-block actions live in `<dfk-sql>`'s tree,
|
|
244
|
+
a diagram's cluster in `<dfk-mermaid>`'s, and the fullscreen toggle in this
|
|
245
|
+
light-DOM tab strip. Keep the copies in sync. */
|
|
246
|
+
.dfk-icon-button {
|
|
245
247
|
position: relative;
|
|
246
248
|
display: inline-flex;
|
|
247
249
|
align-items: center;
|
|
@@ -257,27 +259,27 @@ dfk-sql:not(:defined) {
|
|
|
257
259
|
transition: background 0.12s ease, color 0.12s ease;
|
|
258
260
|
}
|
|
259
261
|
|
|
260
|
-
.dfk-
|
|
261
|
-
.dfk-
|
|
262
|
+
.dfk-icon-button:hover:not(:disabled),
|
|
263
|
+
.dfk-icon-button:focus-visible {
|
|
262
264
|
background: var(--ifm-color-emphasis-200, #e6e6e6);
|
|
263
265
|
color: var(--ifm-color-primary, #14459b);
|
|
264
266
|
}
|
|
265
267
|
|
|
266
|
-
.dfk-
|
|
268
|
+
.dfk-icon-button:disabled {
|
|
267
269
|
opacity: 0.45;
|
|
268
270
|
cursor: progress;
|
|
269
271
|
}
|
|
270
272
|
|
|
271
|
-
.dfk-
|
|
273
|
+
.dfk-icon-button[hidden] {
|
|
272
274
|
display: none;
|
|
273
275
|
}
|
|
274
276
|
|
|
275
277
|
/* A sticky state, e.g. the wrap toggle while wrapping is on. */
|
|
276
|
-
.dfk-
|
|
278
|
+
.dfk-icon-on {
|
|
277
279
|
color: var(--ifm-color-primary, #14459b);
|
|
278
280
|
}
|
|
279
281
|
|
|
280
|
-
.dfk-
|
|
282
|
+
.dfk-icon {
|
|
281
283
|
font-size: 1rem;
|
|
282
284
|
}
|
|
283
285
|
|
package/dist/sql/editor.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The CodeMirror 6 editor that *is* the code view of a runnable SQL block.
|
|
3
|
-
*
|
|
4
|
-
* Every CodeMirror module arrives through dynamic `import()` inside
|
|
5
|
-
* {@link mountSqlEditor}: a page full of SQL examples pays nothing for the
|
|
6
|
-
* editor on its critical path, and Docusaurus' Node prerender never evaluates
|
|
7
|
-
* any of it.
|
|
8
|
-
*/
|
|
9
|
-
export interface SqlEditor {
|
|
10
|
-
getValue(): string;
|
|
11
|
-
setValue(value: string): void;
|
|
12
|
-
/** Soft-wraps long lines, or stops wrapping them (the block's wrap toggle). */
|
|
13
|
-
setWrap(wrapped: boolean): void;
|
|
14
|
-
destroy(): void;
|
|
15
|
-
}
|
|
16
|
-
export declare function mountSqlEditor(container: HTMLElement, value: string, onChange: (value: string) => void): Promise<SqlEditor>;
|
package/src/sql/editor.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The CodeMirror 6 editor that *is* the code view of a runnable SQL block.
|
|
3
|
-
*
|
|
4
|
-
* Every CodeMirror module arrives through dynamic `import()` inside
|
|
5
|
-
* {@link mountSqlEditor}: a page full of SQL examples pays nothing for the
|
|
6
|
-
* editor on its critical path, and Docusaurus' Node prerender never evaluates
|
|
7
|
-
* any of it.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export interface SqlEditor {
|
|
11
|
-
getValue(): string;
|
|
12
|
-
setValue(value: string): void;
|
|
13
|
-
/** Soft-wraps long lines, or stops wrapping them (the block's wrap toggle). */
|
|
14
|
-
setWrap(wrapped: boolean): void;
|
|
15
|
-
destroy(): void;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export async function mountSqlEditor(
|
|
19
|
-
container: HTMLElement,
|
|
20
|
-
value: string,
|
|
21
|
-
onChange: (value: string) => void,
|
|
22
|
-
): Promise<SqlEditor> {
|
|
23
|
-
const [
|
|
24
|
-
{basicSetup},
|
|
25
|
-
{sql},
|
|
26
|
-
{EditorView, keymap},
|
|
27
|
-
{defaultKeymap, historyKeymap},
|
|
28
|
-
{Compartment},
|
|
29
|
-
] = await Promise.all([
|
|
30
|
-
import('codemirror'),
|
|
31
|
-
import('@codemirror/lang-sql'),
|
|
32
|
-
import('@codemirror/view'),
|
|
33
|
-
import('@codemirror/commands'),
|
|
34
|
-
import('@codemirror/state'),
|
|
35
|
-
]);
|
|
36
|
-
|
|
37
|
-
// Wrapping is toggled from the outside, and reconfiguring it must not disturb
|
|
38
|
-
// the document or the undo history — that is exactly what a compartment is
|
|
39
|
-
// for, so the extension is swapped in place rather than rebuilt.
|
|
40
|
-
const wrap = new Compartment();
|
|
41
|
-
|
|
42
|
-
const view = new EditorView({
|
|
43
|
-
doc: value,
|
|
44
|
-
extensions: [
|
|
45
|
-
basicSetup,
|
|
46
|
-
sql(),
|
|
47
|
-
keymap.of([...defaultKeymap, ...historyKeymap]),
|
|
48
|
-
wrap.of([]),
|
|
49
|
-
EditorView.updateListener.of((update) => {
|
|
50
|
-
if (update.docChanged) {
|
|
51
|
-
onChange(update.state.doc.toString());
|
|
52
|
-
}
|
|
53
|
-
}),
|
|
54
|
-
],
|
|
55
|
-
parent: container,
|
|
56
|
-
// `root` is left to CodeMirror's own `getRoot(container)`. The container sits
|
|
57
|
-
// in `<dfk-sql>`'s shadow root, so style-mod mounts the base theme into that
|
|
58
|
-
// same shadow root — exactly where the `.cm-*` rules are needed. Pinning it
|
|
59
|
-
// to `document` would put them outside the editor's tree instead, where a
|
|
60
|
-
// shadow boundary stops them.
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
getValue: () => view.state.doc.toString(),
|
|
65
|
-
setValue: (next: string) =>
|
|
66
|
-
view.dispatch({
|
|
67
|
-
changes: {from: 0, to: view.state.doc.length, insert: next},
|
|
68
|
-
}),
|
|
69
|
-
setWrap: (wrapped: boolean) =>
|
|
70
|
-
view.dispatch({
|
|
71
|
-
effects: wrap.reconfigure(wrapped ? EditorView.lineWrapping : []),
|
|
72
|
-
}),
|
|
73
|
-
destroy: () => view.destroy(),
|
|
74
|
-
};
|
|
75
|
-
}
|