@openstage/glyph-element 0.2.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/THIRD-PARTY-NOTICES.md +1505 -0
- package/dist/chunks/bash-Dw1nAEst.js +171 -0
- package/dist/chunks/bash-Dw1nAEst.js.map +1 -0
- package/dist/chunks/csharp-D8ELXkGi.js +262 -0
- package/dist/chunks/csharp-D8ELXkGi.js.map +1 -0
- package/dist/chunks/css-DQEU4whB.js +142 -0
- package/dist/chunks/css-DQEU4whB.js.map +1 -0
- package/dist/chunks/fsharp-D4SqCnMZ.js +242 -0
- package/dist/chunks/fsharp-D4SqCnMZ.js.map +1 -0
- package/dist/chunks/go-BJIB22rX.js +142 -0
- package/dist/chunks/go-BJIB22rX.js.map +1 -0
- package/dist/chunks/haskell-eGGgAkgA.js +140 -0
- package/dist/chunks/haskell-eGGgAkgA.js.map +1 -0
- package/dist/chunks/highlight-core-C0K6BIzZ.js +967 -0
- package/dist/chunks/highlight-core-C0K6BIzZ.js.map +1 -0
- package/dist/chunks/java-DHPUyZsV.js +171 -0
- package/dist/chunks/java-DHPUyZsV.js.map +1 -0
- package/dist/chunks/javascript-D_CG8suQ.js +438 -0
- package/dist/chunks/javascript-D_CG8suQ.js.map +1 -0
- package/dist/chunks/json-BD6qkh12.js +38 -0
- package/dist/chunks/json-BD6qkh12.js.map +1 -0
- package/dist/chunks/kotlin-C75rnxi-.js +203 -0
- package/dist/chunks/kotlin-C75rnxi-.js.map +1 -0
- package/dist/chunks/markdown-B6LMDWi1.js +183 -0
- package/dist/chunks/markdown-B6LMDWi1.js.map +1 -0
- package/dist/chunks/ocaml-CMtC1T-S.js +54 -0
- package/dist/chunks/ocaml-CMtC1T-S.js.map +1 -0
- package/dist/chunks/prosemirror-dAj0dboi.js +7790 -0
- package/dist/chunks/prosemirror-dAj0dboi.js.map +1 -0
- package/dist/chunks/python-ny4cvzzX.js +240 -0
- package/dist/chunks/python-ny4cvzzX.js.map +1 -0
- package/dist/chunks/rolldown-runtime-BE9Pkid1.js +13 -0
- package/dist/chunks/rust-8OMNiTht.js +171 -0
- package/dist/chunks/rust-8OMNiTht.js.map +1 -0
- package/dist/chunks/scala-BB851ZJZ.js +164 -0
- package/dist/chunks/scala-BB851ZJZ.js.map +1 -0
- package/dist/chunks/sql-CoOMeU5k.js +120 -0
- package/dist/chunks/sql-CoOMeU5k.js.map +1 -0
- package/dist/chunks/tiptap-Cb4W88fy.js +8527 -0
- package/dist/chunks/tiptap-Cb4W88fy.js.map +1 -0
- package/dist/chunks/typescript-Dh7IycF2.js +523 -0
- package/dist/chunks/typescript-Dh7IycF2.js.map +1 -0
- package/dist/chunks/vendor-B82PcruV.js +1799 -0
- package/dist/chunks/vendor-B82PcruV.js.map +1 -0
- package/dist/chunks/xml-BpsgObpu.js +168 -0
- package/dist/chunks/xml-BpsgObpu.js.map +1 -0
- package/dist/codeblock-backspace.d.ts +3 -0
- package/dist/codeblock-backspace.d.ts.map +1 -0
- package/dist/document-conversion.d.ts +29 -0
- package/dist/document-conversion.d.ts.map +1 -0
- package/dist/editor-element.d.ts +93 -0
- package/dist/editor-element.d.ts.map +1 -0
- package/dist/glyph-editor-element.js +783 -0
- package/dist/glyph-editor-element.js.map +1 -0
- package/dist/header.d.ts +18 -0
- package/dist/header.d.ts.map +1 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/link-dialog.d.ts +29 -0
- package/dist/link-dialog.d.ts.map +1 -0
- package/dist/safe-href.d.ts +2 -0
- package/dist/safe-href.d.ts.map +1 -0
- package/dist/slash-menu.d.ts +22 -0
- package/dist/slash-menu.d.ts.map +1 -0
- package/dist/styles.d.ts +2 -0
- package/dist/styles.d.ts.map +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { type EditorApi, type EditorConfig, type EditorDocument, type EditorTheme, type SlashCommand } from '@openstage/glyph-core';
|
|
2
|
+
/**
|
|
3
|
+
* Public shape of the `<glyph-editor>` element. The DOM type is also augmented
|
|
4
|
+
* (`HTMLElementTagNameMap`), so `document.querySelector('glyph-editor')` is
|
|
5
|
+
* typed as this interface automatically.
|
|
6
|
+
*
|
|
7
|
+
* Properties accept rich values (objects/arrays) and must be set in JavaScript,
|
|
8
|
+
* not via HTML attributes. The only attributes observed are `placeholder` and
|
|
9
|
+
* `show-header`.
|
|
10
|
+
*
|
|
11
|
+
* Events (all `bubbles: true, composed: true` so they cross Shadow DOM):
|
|
12
|
+
* - `content-change` — `CustomEvent<EditorDocument>`, fired on every edit
|
|
13
|
+
* - `selection-change` — `CustomEvent<void>`, caret/selection moved
|
|
14
|
+
* - `ready` — `CustomEvent<void>`, editor initialised
|
|
15
|
+
* - `focus` / `blur` — `CustomEvent<void>`
|
|
16
|
+
*/
|
|
17
|
+
export interface GlyphEditorElement extends HTMLElement {
|
|
18
|
+
/** The current document. Reading returns {@link getJSON}; writing calls {@link setContent}. */
|
|
19
|
+
content: EditorDocument;
|
|
20
|
+
/** Color theme; merged onto CSS custom properties. Omit for the built-in light theme. */
|
|
21
|
+
theme?: EditorTheme;
|
|
22
|
+
/** Slash-command menu entries. Defaults to the built-in set; assign to replace. */
|
|
23
|
+
commands?: readonly SlashCommand[];
|
|
24
|
+
/** Toolbar/behaviour configuration. Assigning rebuilds the editor instance. */
|
|
25
|
+
config?: EditorConfig;
|
|
26
|
+
/**
|
|
27
|
+
* Returns the current document as canonical JSON. Safe to persist verbatim
|
|
28
|
+
* and later pass back to {@link setContent}.
|
|
29
|
+
*/
|
|
30
|
+
getJSON(): EditorDocument;
|
|
31
|
+
/**
|
|
32
|
+
* Replaces the document. The input is validated and migrated to the current
|
|
33
|
+
* schema; an invalid value throws `TypeError`.
|
|
34
|
+
*
|
|
35
|
+
* @param document - A document previously produced by {@link getJSON} (or
|
|
36
|
+
* built with the `@openstage/glyph-core` node constructors).
|
|
37
|
+
*/
|
|
38
|
+
setContent(document: EditorDocument): void;
|
|
39
|
+
/** Moves keyboard focus into the editor. */
|
|
40
|
+
focus(): void;
|
|
41
|
+
/**
|
|
42
|
+
* The abstracted command surface (no engine types). For headless usage set
|
|
43
|
+
* `config.showHeader = false` and drive the editor from your own UI plus the
|
|
44
|
+
* DOM events. Throws if called before the element is connected to the DOM.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* const api = editor.getApi();
|
|
49
|
+
* api.toggleBold();
|
|
50
|
+
* api.setHeading(2);
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
getApi(): EditorApi;
|
|
54
|
+
/**
|
|
55
|
+
* Sets the text shown in the toolbar `status` slot (e.g. save state).
|
|
56
|
+
* No-op if `status` is not part of the configured toolbar.
|
|
57
|
+
*
|
|
58
|
+
* @param text - Status text, or `''` to clear it.
|
|
59
|
+
*/
|
|
60
|
+
setStatus(text: string): void;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* `<glyph-editor>` implementation. Instantiated by the browser via the custom
|
|
64
|
+
* element registry — construct it through the DOM
|
|
65
|
+
* (`document.createElement('glyph-editor')` or markup), never with `new`.
|
|
66
|
+
*
|
|
67
|
+
* All implementation state uses ECMAScript private fields (`#x`) so the emitted
|
|
68
|
+
* type declarations expose no engine (Tiptap/ProseMirror) types.
|
|
69
|
+
*
|
|
70
|
+
* @see {@link GlyphEditorElement} for the documented public API.
|
|
71
|
+
*/
|
|
72
|
+
export declare class GlyphEditor extends HTMLElement implements GlyphEditorElement {
|
|
73
|
+
#private;
|
|
74
|
+
static get observedAttributes(): string[];
|
|
75
|
+
constructor();
|
|
76
|
+
get content(): EditorDocument;
|
|
77
|
+
set content(document: EditorDocument);
|
|
78
|
+
get theme(): EditorTheme | undefined;
|
|
79
|
+
set theme(theme: EditorTheme | undefined);
|
|
80
|
+
get commands(): readonly SlashCommand[];
|
|
81
|
+
set commands(commands: readonly SlashCommand[]);
|
|
82
|
+
get config(): EditorConfig;
|
|
83
|
+
set config(config: EditorConfig);
|
|
84
|
+
getJSON: () => EditorDocument;
|
|
85
|
+
setContent: (document: EditorDocument) => void;
|
|
86
|
+
focus: () => void;
|
|
87
|
+
getApi: () => EditorApi;
|
|
88
|
+
setStatus: (text: string) => void;
|
|
89
|
+
connectedCallback(): void;
|
|
90
|
+
disconnectedCallback(): void;
|
|
91
|
+
attributeChangedCallback(): void;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=editor-element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-element.d.ts","sourceRoot":"","sources":["../src/editor-element.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,cAAc,EAEnB,KAAK,WAAW,EAChB,KAAK,YAAY,EAMlB,MAAM,uBAAuB,CAAC;AAQ/B;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,+FAA+F;IAC/F,OAAO,EAAE,cAAc,CAAC;IACxB,yFAAyF;IACzF,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IACnC,+EAA+E;IAC/E,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB;;;OAGG;IACH,OAAO,IAAI,cAAc,CAAC;IAC1B;;;;;;OAMG;IACH,UAAU,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAC;IAC3C,4CAA4C;IAC5C,KAAK,IAAI,IAAI,CAAC;IACd;;;;;;;;;;;OAWG;IACH,MAAM,IAAI,SAAS,CAAC;IACpB;;;;;OAKG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED;;;;;;;;;GASG;AACH,qBAAa,WAAY,SAAQ,WAAY,YAAW,kBAAkB;;IACxE,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;;IAuBD,IAAI,OAAO,IAAI,cAAc,CAE5B;IACD,IAAI,OAAO,CAAC,QAAQ,EAAE,cAAc,EAEnC;IAED,IAAI,KAAK,IAAI,WAAW,GAAG,SAAS,CAEnC;IACD,IAAI,KAAK,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,EAGvC;IAED,IAAI,QAAQ,IAAI,SAAS,YAAY,EAAE,CAEtC;IACD,IAAI,QAAQ,CAAC,QAAQ,EAAE,SAAS,YAAY,EAAE,EAG7C;IAED,IAAI,MAAM,IAAI,YAAY,CAEzB;IACD,IAAI,MAAM,CAAC,MAAM,EAAE,YAAY,EAG9B;IAED,OAAO,QAAO,cAAc,CAC2C;IAEvE,UAAU,GAAI,UAAU,cAAc,KAAG,IAAI,CAM3C;IAEO,KAAK,QAAO,IAAI,CAEvB;IAEF,MAAM,QAAO,SAAS,CAGpB;IAEF,SAAS,GAAI,MAAM,MAAM,KAAG,IAAI,CAG9B;IAEF,iBAAiB,IAAI,IAAI;IAIzB,oBAAoB,IAAI,IAAI;IAI5B,wBAAwB,IAAI,IAAI;CA+NjC"}
|