@coldsmirk/inkstone-codemirror 0.33.0 → 0.34.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/README.md +3 -3
- package/dist/clickhouse-sql-DyQWxgBC.js +12 -0
- package/dist/index.d.ts +10 -3
- package/dist/index.js +6 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,10 +9,10 @@ Part of [inkstone](https://github.com/coldsmirk/inkstone). For a drop-in React c
|
|
|
9
9
|
- **`ControlledEditorHost`** — the controlled-editor lifecycle solved once: the view is created once, external value changes reconcile into the document without resetting cursor/undo, and theme/extension swaps happen in place.
|
|
10
10
|
- **`ControlledMergeHost`** — the same discipline for [`@codemirror/merge`](https://github.com/codemirror/merge)'s side-by-side `MergeView`: both documents reconcile per side without caret resets or callback echo, dynamic extensions swap in place on both editors, and every merge-level option (`orientation`, `revertControls`, `collapseUnchanged`, …) passes straight through. Policy-free — pin either side read-only via `originalExtensions` / `modifiedExtensions` to match how your documents are controlled.
|
|
11
11
|
- **`documentExtensions(options)`** — the standard document editing bundle (history, brackets, completion UI, optional line numbers / wrapping / search), so hosts start from working defaults instead of a bare `EditorState`.
|
|
12
|
-
- **`codeMirrorLanguages` / `loadLanguage(language)`** — the supported `CodeMirrorLanguage` names and their lazy loaders: one dynamic `import()` per grammar, so only the selected language is fetched, never the whole catalog. Two tiers back the ids: the official `@codemirror/lang-*` (Lezer) parsers where upstream ships one, plus the full [`@codemirror/legacy-modes`](https://github.com/codemirror/legacy-modes) catalog (stream-mode highlighting) for everything upstream never wrote a Lezer grammar for — `shell`, `dockerfile`, `ini` / `env` / `properties`, `toml`, `nginx`, `powershell`, `lua`, and a hundred more.
|
|
13
|
-
- **MiniJinja** — `language: "minijinja"` for standalone templates, or `minijinja-<host>` mixed variants (`minijinja-html`, `-xml`, `-json`, `-yaml`, `-css`, `-scss`, `-sass`, `-less`, `-markdown`; the SQL family — `-sql` plus every dialect id: `-mysql`, `-pgsql`, `-sqlite`, `-mssql`, `-mariadb`, `-plsql`, `-cassandra`, `-hive`, `-sparksql`, `-gql`, `-gpsql`, `-esper`; and the config/deploy hosts `-toml`, `-ini`, `-env`, `-shell`, `-dockerfile`, `-nginx`) that overlay MiniJinja tooling on the host grammar. A parser adapter supports MiniJinja whitespace control, dotted namespace assignments, and comma-separated `set` assignments beyond the upstream Jinja grammar; a linter flags non-MiniJinja tags, and autocomplete is restricted to MiniJinja's real tags / filters / tests / functions.
|
|
12
|
+
- **`codeMirrorLanguages` / `loadLanguage(language)`** — the supported `CodeMirrorLanguage` names and their lazy loaders: one dynamic `import()` per grammar, so only the selected language is fetched, never the whole catalog. Two tiers back the ids: the official `@codemirror/lang-*` (Lezer) parsers where upstream ships one — with `clickhouse` a dialect of the package's own over `lang-sql`'s parser, since upstream ships none for ClickHouse — plus the full [`@codemirror/legacy-modes`](https://github.com/codemirror/legacy-modes) catalog (stream-mode highlighting) for everything upstream never wrote a Lezer grammar for — `shell`, `dockerfile`, `ini` / `env` / `properties`, `toml`, `nginx`, `powershell`, `lua`, and a hundred more.
|
|
13
|
+
- **MiniJinja** — `language: "minijinja"` for standalone templates, or `minijinja-<host>` mixed variants (`minijinja-html`, `-xml`, `-json`, `-yaml`, `-css`, `-scss`, `-sass`, `-less`, `-markdown`; the SQL family — `-sql` plus every dialect id: `-mysql`, `-pgsql`, `-sqlite`, `-mssql`, `-mariadb`, `-plsql`, `-cassandra`, `-clickhouse`, `-hive`, `-sparksql`, `-gql`, `-gpsql`, `-esper`; and the config/deploy hosts `-toml`, `-ini`, `-env`, `-shell`, `-dockerfile`, `-nginx`) that overlay MiniJinja tooling on the host grammar. A parser adapter supports MiniJinja whitespace control, dotted namespace assignments, and comma-separated `set` assignments beyond the upstream Jinja grammar; a linter flags non-MiniJinja tags, and autocomplete is restricted to MiniJinja's real tags / filters / tests / functions.
|
|
14
14
|
- **Context completion** — `normalizeContext({ schema })` (JSON Schema) or `normalizeContext({ sample })` (representative value) builds an `EditorContext`; dispatch it with `setMinijinjaContext` to make `{{ }}` / `{% if %}` / `{% for %}` complete the render context's variables and walk member access (`user.address.city`). `minijinjaContextField`, `resolveMembers`, and `typeAtPath` expose the underlying pieces.
|
|
15
|
-
- **SQL schema completion** — dispatch `setSqlSchema.of({ tables })` for dialect-aware table and column completion in the Lezer-backed `sql`, `mysql`, `pgsql`, `sqlite`, `mssql`, `mariadb`, `plsql`, and `
|
|
15
|
+
- **SQL schema completion** — dispatch `setSqlSchema.of({ tables })` for dialect-aware table and column completion in the Lezer-backed `sql`, `mysql`, `pgsql`, `sqlite`, `mssql`, `mariadb`, `plsql`, `cassandra`, and `clickhouse` languages plus their `minijinja-*` variants. Legacy stream-mode SQL languages do not consume schemas. Install `sqlSchemaField` in your static extensions to dispatch the schema before the lazy grammar arrives.
|
|
16
16
|
- **Catppuccin theming** — `defaultThemeExtensions(dark, height?, width?, fontSize?, lineHeight?)`, the latte/macchiato flavor pair plus chrome polish (completion tooltip, icons, hover/lint tooltips, search panel) and sizing. The polish paints the roles a consumer configured through `@coldsmirk/inkstone-core`'s `configureEditorColors` — background and gutter, the current line and its number, caret, selection, scrollbars, the tooltip and panel chrome and its text, the accent, and the diagnostic severities, which color every mark `@codemirror/lint` draws (squiggle, point, gutter marker) and the severity's mark that leads its message — and reads the host's `--inkstone-radius-*` / `--inkstone-shadow-*` tokens for corners and elevation, each falling back to its own look; `mergeTheme(dark)` / `installDiffChrome(root)` / `diffChromeColor(dark)` / `installDiffControlKeyboardSupport(container)` extend it to `@codemirror/merge`'s diff surfaces (see the `merge-chrome` module docs for the assembly). This is the identity `@coldsmirk/inkstone-react`'s components ship by default.
|
|
17
17
|
- **`searchPhrasesZhCn`** — an opt-in `EditorState.phrases` table localizing the search panel to Simplified Chinese.
|
|
18
18
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SQLDialect, sql } from "@codemirror/lang-sql";
|
|
2
|
+
//#region src/clickhouse-sql.ts
|
|
3
|
+
const ClickHouse = SQLDialect.define({
|
|
4
|
+
backslashEscapes: true,
|
|
5
|
+
hashComments: true,
|
|
6
|
+
identifierQuotes: "`\""
|
|
7
|
+
});
|
|
8
|
+
function clickhouse() {
|
|
9
|
+
return sql({ dialect: ClickHouse });
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { ClickHouse, clickhouse };
|
package/dist/index.d.ts
CHANGED
|
@@ -213,9 +213,10 @@ export declare function documentExtensions({ placeholder, lineWrapping, showLine
|
|
|
213
213
|
type LanguageLoader = () => Promise<Extension>;
|
|
214
214
|
/**
|
|
215
215
|
* Language id → lazy loader. Two tiers back the catalog: the official `@codemirror/lang-*`
|
|
216
|
-
* (Lezer) parsers where upstream ships one
|
|
217
|
-
*
|
|
218
|
-
*
|
|
216
|
+
* (Lezer) parsers where upstream ships one — ClickHouse a `lang-sql` dialect of this package's
|
|
217
|
+
* own (`clickhouse-sql.ts`) — and the full `@codemirror/legacy-modes` catalog for every language
|
|
218
|
+
* upstream never wrote a Lezer grammar for — where a language exists in both, the Lezer parser
|
|
219
|
+
* wins. Ids follow Monaco's spelling where they overlap, but the two
|
|
219
220
|
* editors expose independent language types — {@link CodeMirrorLanguage} is exactly this set.
|
|
220
221
|
*/
|
|
221
222
|
declare const loaders: {
|
|
@@ -318,6 +319,9 @@ declare const loaders: {
|
|
|
318
319
|
cassandra: () => Promise<{
|
|
319
320
|
extension: Extension;
|
|
320
321
|
} | readonly Extension[] | LanguageSupport>;
|
|
322
|
+
clickhouse: () => Promise<{
|
|
323
|
+
extension: Extension;
|
|
324
|
+
} | readonly Extension[] | LanguageSupport>;
|
|
321
325
|
apl: LanguageLoader;
|
|
322
326
|
asciiarmor: LanguageLoader;
|
|
323
327
|
asn1: LanguageLoader;
|
|
@@ -492,6 +496,9 @@ declare const loaders: {
|
|
|
492
496
|
"minijinja-cassandra": () => Promise<{
|
|
493
497
|
extension: Extension;
|
|
494
498
|
} | readonly Extension[] | LanguageSupport>;
|
|
499
|
+
"minijinja-clickhouse": () => Promise<{
|
|
500
|
+
extension: Extension;
|
|
501
|
+
} | readonly Extension[] | LanguageSupport>;
|
|
495
502
|
"minijinja-hive": () => Promise<{
|
|
496
503
|
extension: Extension;
|
|
497
504
|
} | readonly Extension[] | LanguageSupport>;
|
package/dist/index.js
CHANGED
|
@@ -187,6 +187,7 @@ const loaders = {
|
|
|
187
187
|
mariadb: () => Promise.all([import("./sql-support-Gk7Wv9Kj.js"), import("@codemirror/lang-sql")]).then(([schema, mod]) => schema.withSqlSchema(mod.sql({ dialect: mod.MariaSQL }), mod.MariaSQL)),
|
|
188
188
|
plsql: () => Promise.all([import("./sql-support-Gk7Wv9Kj.js"), import("@codemirror/lang-sql")]).then(([schema, mod]) => schema.withSqlSchema(mod.sql({ dialect: mod.PLSQL }), mod.PLSQL)),
|
|
189
189
|
cassandra: () => Promise.all([import("./sql-support-Gk7Wv9Kj.js"), import("@codemirror/lang-sql")]).then(([schema, mod]) => schema.withSqlSchema(mod.sql({ dialect: mod.Cassandra }), mod.Cassandra)),
|
|
190
|
+
clickhouse: () => Promise.all([import("./sql-support-Gk7Wv9Kj.js"), import("./clickhouse-sql-DyQWxgBC.js")]).then(([schema, mod]) => schema.withSqlSchema(mod.clickhouse(), mod.ClickHouse)),
|
|
190
191
|
apl: legacy(() => import("@codemirror/legacy-modes/mode/apl").then((mod) => mod.apl)),
|
|
191
192
|
asciiarmor: legacy(() => import("@codemirror/legacy-modes/mode/asciiarmor").then((mod) => mod.asciiArmor)),
|
|
192
193
|
asn1: legacy(() => import("@codemirror/legacy-modes/mode/asn1").then((mod) => mod.asn1({}))),
|
|
@@ -357,6 +358,11 @@ const loaders = {
|
|
|
357
358
|
import("./sql-support-Gk7Wv9Kj.js"),
|
|
358
359
|
import("@codemirror/lang-sql")
|
|
359
360
|
]).then(([mj, schema, mod]) => mj.minijinja({ base: schema.withSqlSchema(mod.sql({ dialect: mod.Cassandra }), mod.Cassandra) })),
|
|
361
|
+
"minijinja-clickhouse": () => Promise.all([
|
|
362
|
+
import("./minijinja-D5ANOjtx.js"),
|
|
363
|
+
import("./sql-support-Gk7Wv9Kj.js"),
|
|
364
|
+
import("./clickhouse-sql-DyQWxgBC.js")
|
|
365
|
+
]).then(([mj, schema, mod]) => mj.minijinja({ base: schema.withSqlSchema(mod.clickhouse(), mod.ClickHouse) })),
|
|
360
366
|
"minijinja-hive": () => Promise.all([import("./minijinja-D5ANOjtx.js"), import("@codemirror/legacy-modes/mode/sql")]).then(([mj, mod]) => mj.minijinja({ base: new LanguageSupport(StreamLanguage.define(mod.hive)) })),
|
|
361
367
|
"minijinja-sparksql": () => Promise.all([import("./minijinja-D5ANOjtx.js"), import("@codemirror/legacy-modes/mode/sql")]).then(([mj, mod]) => mj.minijinja({ base: new LanguageSupport(StreamLanguage.define(mod.sparkSQL)) })),
|
|
362
368
|
"minijinja-gql": () => Promise.all([import("./minijinja-D5ANOjtx.js"), import("@codemirror/legacy-modes/mode/sql")]).then(([mj, mod]) => mj.minijinja({ base: new LanguageSupport(StreamLanguage.define(mod.gql)) })),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coldsmirk/inkstone-codemirror",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.1",
|
|
4
4
|
"description": "Framework-agnostic CodeMirror 6 plumbing: a controlled editor host (create-once, external-value reconcile, in-place theme swap), the standard document extension bundle, and the editors' catppuccin theming.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codemirror",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@codemirror/lint": "^6.9.7",
|
|
63
63
|
"@codemirror/merge": "^6.12.2",
|
|
64
64
|
"@lezer/common": "^1.5.3",
|
|
65
|
-
"@coldsmirk/inkstone-core": "^0.
|
|
65
|
+
"@coldsmirk/inkstone-core": "^0.34.1"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@codemirror/autocomplete": "^6.20.3",
|