@astl/editor-tiptap 0.0.0 → 0.1.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/CHANGELOG.md +111 -0
- package/LICENSE +202 -0
- package/README.md +49 -0
- package/dist/adapter.d.ts +13 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/adapter.js +421 -0
- package/dist/adapter.js.map +1 -0
- package/dist/blocks.d.ts +96 -0
- package/dist/blocks.d.ts.map +1 -0
- package/dist/blocks.js +460 -0
- package/dist/blocks.js.map +1 -0
- package/dist/define.d.ts +64 -0
- package/dist/define.d.ts.map +1 -0
- package/dist/define.js +20 -0
- package/dist/define.js.map +1 -0
- package/dist/element.d.ts +91 -0
- package/dist/element.d.ts.map +1 -0
- package/dist/element.js +779 -0
- package/dist/element.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/layouts.d.ts +52 -0
- package/dist/layouts.d.ts.map +1 -0
- package/dist/layouts.js +198 -0
- package/dist/layouts.js.map +1 -0
- package/dist/nodes.d.ts +150 -0
- package/dist/nodes.d.ts.map +1 -0
- package/dist/nodes.js +2426 -0
- package/dist/nodes.js.map +1 -0
- package/dist/source-view.d.ts +26 -0
- package/dist/source-view.d.ts.map +1 -0
- package/dist/source-view.js +114 -0
- package/dist/source-view.js.map +1 -0
- package/dist/source.d.ts +8 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +24 -0
- package/dist/source.js.map +1 -0
- package/dist/style.d.ts +16 -0
- package/dist/style.d.ts.map +1 -0
- package/dist/style.js +568 -0
- package/dist/style.js.map +1 -0
- package/dist/styles.d.ts +5 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +921 -0
- package/dist/styles.js.map +1 -0
- package/dist/surface.d.ts +24 -0
- package/dist/surface.d.ts.map +1 -0
- package/dist/surface.js +90 -0
- package/dist/surface.js.map +1 -0
- package/dist/tiptap.d.ts +10 -0
- package/dist/tiptap.d.ts.map +1 -0
- package/dist/tiptap.js +9 -0
- package/dist/tiptap.js.map +1 -0
- package/package.json +63 -4
- package/src/adapter.ts +421 -0
- package/src/blocks.ts +577 -0
- package/src/define.ts +84 -0
- package/src/element.ts +988 -0
- package/src/index.ts +10 -0
- package/src/layouts.ts +220 -0
- package/src/nodes.ts +2690 -0
- package/src/source-view.ts +138 -0
- package/src/source.ts +27 -0
- package/src/style.ts +638 -0
- package/src/styles.ts +931 -0
- package/src/surface.ts +110 -0
- package/src/tiptap.ts +9 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `<astl-editor>`: the authoring kit (toolbar, inspector, issues, preview) around an editing surface. The surface is
|
|
3
|
+
* TipTap by default, imported on demand; any other editor plugs in through `adapter` and a `slot="surface"` child, and
|
|
4
|
+
* then TipTap is never loaded.
|
|
5
|
+
*/
|
|
6
|
+
import { type AttemptPolicy, type EditorAdapter } from '@astl/core';
|
|
7
|
+
import { type Authoring } from '@astl/editor';
|
|
8
|
+
import { type ThemeSetting } from '@astl/tokens';
|
|
9
|
+
import { type CSSResultGroup, LitElement, type PropertyDeclarations, type PropertyValues, type TemplateResult } from 'lit';
|
|
10
|
+
import type { DefineEditorOptions, EditorHostView } from './define.js';
|
|
11
|
+
/** Adds to what every `<astl-editor>` offers (`defineEditor`). Checks everything before anything changes. */
|
|
12
|
+
export declare function register(options: DefineEditorOptions): void;
|
|
13
|
+
export declare class AstlEditor extends LitElement {
|
|
14
|
+
#private;
|
|
15
|
+
static properties: PropertyDeclarations;
|
|
16
|
+
static styles: CSSResultGroup;
|
|
17
|
+
/** UI locale (`en`, `pl`); default: the `lang` attribute, else the browser languages, else `en`. */
|
|
18
|
+
locale: string | null;
|
|
19
|
+
/**
|
|
20
|
+
* The component types authors can use (space-separated tags in the attribute); null: every registered type. Others
|
|
21
|
+
* stay in the document, reported as unknown elements.
|
|
22
|
+
*/
|
|
23
|
+
components: readonly string[] | null;
|
|
24
|
+
/**
|
|
25
|
+
* The toolbar's featured inserts, as buttons before "More" (space-separated in the attribute): component tags,
|
|
26
|
+
* `tag:template` for a named starter, and `text`, `picture`, `page-break`. Null: the list `defineEditor` got.
|
|
27
|
+
*/
|
|
28
|
+
featured: readonly string[] | null;
|
|
29
|
+
/**
|
|
30
|
+
* The side column's panels, in order (space-separated in the attribute): `issues` and `inspector`. Null: both,
|
|
31
|
+
* issues first. Empty: no side column, the surface takes the width; a host then shows its own `<astl-inspector>`
|
|
32
|
+
* or `<astl-issues>`, wired with `authoring` and `adapter` once the editor is ready.
|
|
33
|
+
*/
|
|
34
|
+
panels: readonly string[] | null;
|
|
35
|
+
/**
|
|
36
|
+
* What the editor shows: `visual` (default) the surface; `source` the document's HTML in a text area, which leaving
|
|
37
|
+
* applies (with errors the editor stays there and lists them, so no text is lost); or the `name` of one of `views`.
|
|
38
|
+
* The toolbar's view switch sets it; each change fires `astl-editor-view` (bubbles, composed; `detail.view`).
|
|
39
|
+
*/
|
|
40
|
+
view: string;
|
|
41
|
+
/**
|
|
42
|
+
* The host's views, after "Visual" and "HTML" in the view switch: `{ name, label }` each (the attribute: a JSON
|
|
43
|
+
* list). One shows the host's `slot="view-<name>"` children in place of the editor. Null: the list `defineEditor` got.
|
|
44
|
+
*/
|
|
45
|
+
views: readonly EditorHostView[] | null;
|
|
46
|
+
/** `light`, `dark`, `hc` or `auto` (the system's light or dark), passed on as `data-theme`. */
|
|
47
|
+
theme: ThemeSetting | null;
|
|
48
|
+
/**
|
|
49
|
+
* The policy the preview plays under: the one the host's students get, when it offers less than practice (no hints,
|
|
50
|
+
* no check of one interaction). Null: `PRACTICE_POLICY`. A change plays a shown preview again.
|
|
51
|
+
*/
|
|
52
|
+
previewPolicy: AttemptPolicy | null;
|
|
53
|
+
/**
|
|
54
|
+
* The editor the kit drives. Default: TipTap, on a surface this element creates when it first renders without an
|
|
55
|
+
* adapter and without a `slot="surface"` child. Setting another adapter swaps the editor; null brings the TipTap
|
|
56
|
+
* surface back (with its document), unless a `slot="surface"` child is there.
|
|
57
|
+
*/
|
|
58
|
+
adapter: EditorAdapter | null;
|
|
59
|
+
constructor();
|
|
60
|
+
/** The source HTML (`<astl-doc>`): the adapter's, or a value waiting for it, or an empty document. */
|
|
61
|
+
get value(): string;
|
|
62
|
+
set value(source: string);
|
|
63
|
+
/**
|
|
64
|
+
* Resolves when the editor is first ready: its surface loaded (or the host's `adapter` set) and the value in place,
|
|
65
|
+
* so `adapter`, `authoring` and `value` are usable. Each time an editor becomes ready (again after a swap or a
|
|
66
|
+
* reconnect, with a new `adapter`), `astl-editor-ready` fires (bubbles, composed).
|
|
67
|
+
*/
|
|
68
|
+
get ready(): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Compiles the current value and plays it in the preview, as the preview's own button does. Resolves when it plays,
|
|
71
|
+
* or shows why it cannot.
|
|
72
|
+
*/
|
|
73
|
+
preview(): Promise<void>;
|
|
74
|
+
/** The kit's logic, built from the registrations, the UI locale and `components`. */
|
|
75
|
+
get authoring(): Authoring;
|
|
76
|
+
connectedCallback(): void;
|
|
77
|
+
disconnectedCallback(): void;
|
|
78
|
+
protected willUpdate(changed: PropertyValues<this>): void;
|
|
79
|
+
protected updated(changed: PropertyValues<this>): void;
|
|
80
|
+
protected render(): TemplateResult;
|
|
81
|
+
}
|
|
82
|
+
declare global {
|
|
83
|
+
interface HTMLElementTagNameMap {
|
|
84
|
+
'astl-editor': AstlEditor;
|
|
85
|
+
}
|
|
86
|
+
interface HTMLElementEventMap {
|
|
87
|
+
'astl-editor-change': Event;
|
|
88
|
+
'astl-editor-ready': Event;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,KAAK,aAAa,EA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