@wssto2/vue-core 0.18.0 → 0.19.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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.19.0 — 2026-11-06
4
+
5
+ A code editor for forms, for the templates, components and page code a site is built from.
6
+
7
+ ### New
8
+ - **form:** `CodeField` (CodeMirror 6, optional peers loaded when the first one shows): `v-model` string, `language: "liquid" | "html" | "css" | "javascript"`, `readonly`, `lineNumbers`, `height` (resizable), `markers: CodeMarker[]` (`{ line, column?, severity, message }` from the server's linter, drawn in the gutter and as underlines), `@save` on Ctrl/Cmd+S, a `#preview` slot that puts the app's preview beside the editor (behind a button on narrow screens). Tab indents, Esc then Tab leaves the editor. Liquid is the official `@codemirror/lang-liquid`. New types `CodeLanguage`, `CodeMarker`; new texts `core.form.code.*`. Recipe: `docs/recipes/code-field.md`.
9
+ - **peers:** optional `@codemirror/{state,view,commands,language,lint,lang-liquid,lang-html,lang-css,lang-javascript}` and `@lezer/highlight`.
10
+ - **check:consumer:** fails when the packed output imports quill or CodeMirror statically.
11
+
3
12
  ## 0.18.0 — 2026-11-06
4
13
 
5
14
  Forms and lists built from a schema at run time, for content whose fields are data (site-builder's content types). The `Dynamic*` pair generates fields and columns from a typed schema; it is not a page renderer.
package/README.md CHANGED
@@ -337,6 +337,7 @@ The library's own texts are under the `core` namespace in English, Croatian, Bos
337
337
  - [App setup](docs/recipes/app-setup.md): config, session, effects, locales and flags, permissions in the UI, error sentences, startup errors
338
338
  - [Forms](docs/recipes/forms.md): form state, fields, a record edited in group sheets, a long form, commands
339
339
  - [Forms and lists from a schema](docs/recipes/content-forms.md): `DynamicForm`, `RepeatField`, `ResourceField`, `RichTextField`, `buildValidator`, `DynamicCollection`, `visible_when`
340
+ - [A code editor](docs/recipes/code-field.md): `CodeField` (CodeMirror 6): Liquid / HTML / CSS / JavaScript, linter markers, a preview beside it, the keyboard
340
341
  - [Typed routes](docs/recipes/typed-routes.md): generated routes, `client.request`, a list from a route
341
342
  - [Sign-in](docs/recipes/sign-in.md): go-core's identity module: the sign-in page, the session wiring, the language, the module's committed types, the dev server
342
343
  - [Users and profile](docs/recipes/users.md): the users list and a person's record, "my profile" with the e-mail change by code, opting out, extra sections, refusals
@@ -26,8 +26,8 @@ type __VLS_Props = {
26
26
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
27
27
  to: RouteLocationRaw | null;
28
28
  subtitle: string | null;
29
- subtitleSelectable: boolean;
30
29
  highlight: string | null;
30
+ subtitleSelectable: boolean;
31
31
  spread: boolean;
32
32
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
33
  export default _default;
@@ -0,0 +1,62 @@
1
+ import { type CodeLanguage, type CodeMarker } from "./codeEditor";
2
+ import { type FieldProps, type FieldSlots } from "./field";
3
+ /**
4
+ * Source code: Liquid templates, HTML, CSS or JavaScript, with highlighting, line numbers and the findings of a linter. The value
5
+ * is the text ("" when empty). The editor is CodeMirror 6, optional peer dependencies loaded when the field first shows
6
+ * (see `loadCodeEditor`); an application that never shows this field never loads them.
7
+ *
8
+ * `markers` come from the server's linter (the browser checks nothing): each is drawn in the gutter and as an underline on its
9
+ * line, with the message on hover. `@save` fires on Ctrl/Cmd+S. Tab indents; Esc, then Tab, moves on to the next control.
10
+ * Give the `preview` slot (an iframe of the rendered page) and the editor sits beside it, below it on narrow screens behind a button.
11
+ *
12
+ * <CodeField v-model="form.body" language="liquid" :markers="lint" label="Template" @save="save">
13
+ * <template #preview><iframe :src="previewUrl" title="Preview" class="size-full" /></template>
14
+ * </CodeField>
15
+ */
16
+ type __VLS_Props = FieldProps & {
17
+ modelValue?: string;
18
+ language?: CodeLanguage;
19
+ /** Visible and selectable, not editable (a read-only viewer of a published version). */
20
+ readonly?: boolean;
21
+ lineNumbers?: boolean;
22
+ /** The height of the editor; the user can drag it taller (any CSS length). */
23
+ height?: string;
24
+ markers?: readonly CodeMarker[];
25
+ };
26
+ type __VLS_Slots = FieldSlots & {
27
+ /** The app's preview of the code; the editor goes beside it. */
28
+ preview?: () => unknown;
29
+ };
30
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {
31
+ focus: () => void | undefined;
32
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
33
+ save: () => any;
34
+ "update:modelValue": (source: string) => any;
35
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
36
+ onSave?: (() => any) | undefined;
37
+ "onUpdate:modelValue"?: ((source: string) => any) | undefined;
38
+ }>, {
39
+ disabled: boolean;
40
+ name: string;
41
+ label: string;
42
+ error: string;
43
+ required: boolean;
44
+ height: string;
45
+ presentation: "control" | "value";
46
+ modelValue: string;
47
+ labelHidden: boolean;
48
+ hint: string;
49
+ editable: boolean;
50
+ lockedReason: string;
51
+ readonly: boolean;
52
+ language: CodeLanguage;
53
+ lineNumbers: boolean;
54
+ markers: readonly CodeMarker[];
55
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
56
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
57
+ export default _default;
58
+ type __VLS_WithSlots<T, S> = T & {
59
+ new (): {
60
+ $slots: S;
61
+ };
62
+ };
@@ -0,0 +1,27 @@
1
+ import type { Extension } from "@codemirror/state";
2
+ /** What `CodeField` edits. `liquid` is HTML with `{{ }}` and `{% %}` (and the `<script>` / `<style>` of the page highlighted as their own languages). */
3
+ export type CodeLanguage = "liquid" | "html" | "css" | "javascript";
4
+ /** A finding of the server's linter (`site lint-templates`) shown in the editor: the gutter and an underline. Lines and columns count from 1. */
5
+ export interface CodeMarker {
6
+ line: number;
7
+ /** Without it the whole line is marked. */
8
+ column?: number;
9
+ severity: "error" | "warning";
10
+ message: string;
11
+ }
12
+ /**
13
+ * CodeMirror 6, every package an optional peer dependency (`npm i @codemirror/state @codemirror/view @codemirror/commands
14
+ * @codemirror/language @codemirror/lint`, and `@codemirror/lang-liquid` / `lang-html` / `lang-css` / `lang-javascript` for the
15
+ * languages in use). This file is the only place that imports them and only through `import()`: nothing loads until a `CodeField` shows.
16
+ */
17
+ export declare function loadCodeEditor(): Promise<{
18
+ state: typeof import("@codemirror/state");
19
+ view: typeof import("@codemirror/view");
20
+ commands: typeof import("@codemirror/commands");
21
+ language: typeof import("@codemirror/language");
22
+ lint: typeof import("@codemirror/lint");
23
+ highlight: typeof import("@lezer/highlight");
24
+ }>;
25
+ export type CodeEditor = Awaited<ReturnType<typeof loadCodeEditor>>;
26
+ /** The grammar of one language, loaded when it is first used. */
27
+ export declare function loadCodeLanguage(name: CodeLanguage): Promise<Extension>;
@@ -85,6 +85,8 @@ export { default as DynamicForm } from "./dynamic/DynamicForm.vue";
85
85
  export { default as RepeatField } from "./dynamic/RepeatField.vue";
86
86
  export { default as ResourceField } from "./dynamic/ResourceField.vue";
87
87
  export { default as RichTextField } from "./dynamic/RichTextField.vue";
88
+ export { default as CodeField } from "./CodeField.vue";
89
+ export type { CodeLanguage, CodeMarker } from "./codeEditor";
88
90
  export { evaluateVisibility, isEmptyValue } from "./dynamic/visibility";
89
91
  export { buildValidator } from "./dynamic/validator";
90
92
  export type { SchemaValidatorOptions } from "./dynamic/validator";