@samtv12345/etherpad-webcomponents 0.0.0 → 0.0.14
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/LICENSE +21 -0
- package/README.md +173 -0
- package/dist/EpButton.d.ts +17 -0
- package/dist/EpButton.d.ts.map +1 -0
- package/dist/EpButton.js +168 -0
- package/dist/EpButton.js.map +1 -0
- package/dist/EpCard.d.ts +15 -0
- package/dist/EpCard.d.ts.map +1 -0
- package/dist/EpCard.js +126 -0
- package/dist/EpCard.js.map +1 -0
- package/dist/EpChatMessage.d.ts +15 -0
- package/dist/EpChatMessage.d.ts.map +1 -0
- package/dist/EpChatMessage.js +75 -0
- package/dist/EpChatMessage.js.map +1 -0
- package/dist/EpCheckbox.d.ts +16 -0
- package/dist/EpCheckbox.d.ts.map +1 -0
- package/dist/EpCheckbox.js +154 -0
- package/dist/EpCheckbox.js.map +1 -0
- package/dist/EpColorPicker.d.ts +16 -0
- package/dist/EpColorPicker.d.ts.map +1 -0
- package/dist/EpColorPicker.js +191 -0
- package/dist/EpColorPicker.js.map +1 -0
- package/dist/EpColorWheel.d.ts +61 -0
- package/dist/EpColorWheel.d.ts.map +1 -0
- package/dist/EpColorWheel.js +428 -0
- package/dist/EpColorWheel.js.map +1 -0
- package/dist/EpDropdown.d.ts +44 -0
- package/dist/EpDropdown.d.ts.map +1 -0
- package/dist/EpDropdown.js +298 -0
- package/dist/EpDropdown.js.map +1 -0
- package/dist/EpDropdownItem.d.ts +16 -0
- package/dist/EpDropdownItem.d.ts.map +1 -0
- package/dist/EpDropdownItem.js +88 -0
- package/dist/EpDropdownItem.js.map +1 -0
- package/dist/EpEditor.d.ts +108 -0
- package/dist/EpEditor.d.ts.map +1 -0
- package/dist/EpEditor.js +277 -0
- package/dist/EpEditor.js.map +1 -0
- package/dist/EpInput.d.ts +20 -0
- package/dist/EpInput.d.ts.map +1 -0
- package/dist/EpInput.js +154 -0
- package/dist/EpInput.js.map +1 -0
- package/dist/EpModal.d.ts +45 -0
- package/dist/EpModal.d.ts.map +1 -0
- package/dist/EpModal.js +212 -0
- package/dist/EpModal.js.map +1 -0
- package/dist/EpNotification.d.ts +32 -0
- package/dist/EpNotification.d.ts.map +1 -0
- package/dist/EpNotification.js +215 -0
- package/dist/EpNotification.js.map +1 -0
- package/dist/EpSelect.d.ts +38 -0
- package/dist/EpSelect.d.ts.map +1 -0
- package/dist/EpSelect.js +270 -0
- package/dist/EpSelect.js.map +1 -0
- package/dist/EpTabs.d.ts +64 -0
- package/dist/EpTabs.d.ts.map +1 -0
- package/dist/EpTabs.js +296 -0
- package/dist/EpTabs.js.map +1 -0
- package/dist/EpTheme.d.ts +40 -0
- package/dist/EpTheme.d.ts.map +1 -0
- package/dist/EpTheme.js +136 -0
- package/dist/EpTheme.js.map +1 -0
- package/dist/EpToast.d.ts +37 -0
- package/dist/EpToast.d.ts.map +1 -0
- package/dist/EpToast.js +220 -0
- package/dist/EpToast.js.map +1 -0
- package/dist/EpToolbarSelect.d.ts +24 -0
- package/dist/EpToolbarSelect.d.ts.map +1 -0
- package/dist/EpToolbarSelect.js +138 -0
- package/dist/EpToolbarSelect.js.map +1 -0
- package/dist/EpUserBadge.d.ts +15 -0
- package/dist/EpUserBadge.d.ts.map +1 -0
- package/dist/EpUserBadge.js +90 -0
- package/dist/EpUserBadge.js.map +1 -0
- package/dist/collab/clientMessage.d.ts +102 -0
- package/dist/collab/clientMessage.d.ts.map +1 -0
- package/dist/collab/clientMessage.js +132 -0
- package/dist/collab/clientMessage.js.map +1 -0
- package/dist/editor/AceEditor.d.ts +205 -0
- package/dist/editor/AceEditor.d.ts.map +1 -0
- package/dist/editor/AceEditor.js +2879 -0
- package/dist/editor/AceEditor.js.map +1 -0
- package/dist/editor/AttributeManager.d.ts +25 -0
- package/dist/editor/AttributeManager.d.ts.map +1 -0
- package/dist/editor/AttributeManager.js +236 -0
- package/dist/editor/AttributeManager.js.map +1 -0
- package/dist/editor/AttributeMap.d.ts +13 -0
- package/dist/editor/AttributeMap.d.ts.map +1 -0
- package/dist/editor/AttributeMap.js +37 -0
- package/dist/editor/AttributeMap.js.map +1 -0
- package/dist/editor/AttributePool.d.ts +22 -0
- package/dist/editor/AttributePool.d.ts.map +1 -0
- package/dist/editor/AttributePool.js +101 -0
- package/dist/editor/AttributePool.js.map +1 -0
- package/dist/editor/Builder.d.ts +15 -0
- package/dist/editor/Builder.d.ts.map +1 -0
- package/dist/editor/Builder.js +47 -0
- package/dist/editor/Builder.js.map +1 -0
- package/dist/editor/Changeset.d.ts +61 -0
- package/dist/editor/Changeset.d.ts.map +1 -0
- package/dist/editor/Changeset.js +942 -0
- package/dist/editor/Changeset.js.map +1 -0
- package/dist/editor/ChangesetUtils.d.ts +11 -0
- package/dist/editor/ChangesetUtils.d.ts.map +1 -0
- package/dist/editor/ChangesetUtils.js +30 -0
- package/dist/editor/ChangesetUtils.js.map +1 -0
- package/dist/editor/MergingOpAssembler.d.ts +13 -0
- package/dist/editor/MergingOpAssembler.d.ts.map +1 -0
- package/dist/editor/MergingOpAssembler.js +60 -0
- package/dist/editor/MergingOpAssembler.js.map +1 -0
- package/dist/editor/Op.d.ts +10 -0
- package/dist/editor/Op.d.ts.map +1 -0
- package/dist/editor/Op.js +18 -0
- package/dist/editor/Op.js.map +1 -0
- package/dist/editor/OpAssembler.d.ts +9 -0
- package/dist/editor/OpAssembler.d.ts.map +1 -0
- package/dist/editor/OpAssembler.js +16 -0
- package/dist/editor/OpAssembler.js.map +1 -0
- package/dist/editor/OpIter.d.ts +9 -0
- package/dist/editor/OpIter.d.ts.map +1 -0
- package/dist/editor/OpIter.js +22 -0
- package/dist/editor/OpIter.js.map +1 -0
- package/dist/editor/SmartOpAssembler.d.ts +21 -0
- package/dist/editor/SmartOpAssembler.d.ts.map +1 -0
- package/dist/editor/SmartOpAssembler.js +71 -0
- package/dist/editor/SmartOpAssembler.js.map +1 -0
- package/dist/editor/StringAssembler.d.ts +7 -0
- package/dist/editor/StringAssembler.d.ts.map +1 -0
- package/dist/editor/StringAssembler.js +15 -0
- package/dist/editor/StringAssembler.js.map +1 -0
- package/dist/editor/StringIterator.d.ts +13 -0
- package/dist/editor/StringIterator.d.ts.map +1 -0
- package/dist/editor/StringIterator.js +29 -0
- package/dist/editor/StringIterator.js.map +1 -0
- package/dist/editor/TextLinesMutator.d.ts +31 -0
- package/dist/editor/TextLinesMutator.d.ts.map +1 -0
- package/dist/editor/TextLinesMutator.js +198 -0
- package/dist/editor/TextLinesMutator.js.map +1 -0
- package/dist/editor/ace2_common.d.ts +9 -0
- package/dist/editor/ace2_common.d.ts.map +1 -0
- package/dist/editor/ace2_common.js +31 -0
- package/dist/editor/ace2_common.js.map +1 -0
- package/dist/editor/attributes.d.ts +20 -0
- package/dist/editor/attributes.d.ts.map +1 -0
- package/dist/editor/attributes.js +54 -0
- package/dist/editor/attributes.js.map +1 -0
- package/dist/editor/browser_flags.d.ts +7 -0
- package/dist/editor/browser_flags.d.ts.map +1 -0
- package/dist/editor/browser_flags.js +8 -0
- package/dist/editor/browser_flags.js.map +1 -0
- package/dist/editor/changesettracker.d.ts +54 -0
- package/dist/editor/changesettracker.d.ts.map +1 -0
- package/dist/editor/changesettracker.js +193 -0
- package/dist/editor/changesettracker.js.map +1 -0
- package/dist/editor/colorutils.d.ts +22 -0
- package/dist/editor/colorutils.d.ts.map +1 -0
- package/dist/editor/colorutils.js +81 -0
- package/dist/editor/colorutils.js.map +1 -0
- package/dist/editor/contentcollector.d.ts +52 -0
- package/dist/editor/contentcollector.d.ts.map +1 -0
- package/dist/editor/contentcollector.js +692 -0
- package/dist/editor/contentcollector.js.map +1 -0
- package/dist/editor/core/EventBus.d.ts +187 -0
- package/dist/editor/core/EventBus.d.ts.map +1 -0
- package/dist/editor/core/EventBus.js +169 -0
- package/dist/editor/core/EventBus.js.map +1 -0
- package/dist/editor/cssmanager.d.ts +6 -0
- package/dist/editor/cssmanager.d.ts.map +1 -0
- package/dist/editor/cssmanager.js +35 -0
- package/dist/editor/cssmanager.js.map +1 -0
- package/dist/editor/domline.d.ts +35 -0
- package/dist/editor/domline.d.ts.map +1 -0
- package/dist/editor/domline.js +267 -0
- package/dist/editor/domline.js.map +1 -0
- package/dist/editor/html_escape.d.ts +3 -0
- package/dist/editor/html_escape.d.ts.map +1 -0
- package/dist/editor/html_escape.js +8 -0
- package/dist/editor/html_escape.js.map +1 -0
- package/dist/editor/linestylefilter.d.ts +22 -0
- package/dist/editor/linestylefilter.d.ts.map +1 -0
- package/dist/editor/linestylefilter.js +298 -0
- package/dist/editor/linestylefilter.js.map +1 -0
- package/dist/editor/skiplist.d.ts +51 -0
- package/dist/editor/skiplist.d.ts.map +1 -0
- package/dist/editor/skiplist.js +327 -0
- package/dist/editor/skiplist.js.map +1 -0
- package/dist/editor/types/AText.d.ts +5 -0
- package/dist/editor/types/AText.d.ts.map +1 -0
- package/dist/editor/types/AText.js +2 -0
- package/dist/editor/types/AText.js.map +1 -0
- package/dist/editor/types/Attribute.d.ts +2 -0
- package/dist/editor/types/Attribute.d.ts.map +1 -0
- package/dist/editor/types/Attribute.js +2 -0
- package/dist/editor/types/Attribute.js.map +1 -0
- package/dist/editor/types/ChangeSet.d.ts +7 -0
- package/dist/editor/types/ChangeSet.d.ts.map +1 -0
- package/dist/editor/types/ChangeSet.js +2 -0
- package/dist/editor/types/ChangeSet.js.map +1 -0
- package/dist/editor/types/ChangeSetBuilder.d.ts +7 -0
- package/dist/editor/types/ChangeSetBuilder.d.ts.map +1 -0
- package/dist/editor/types/ChangeSetBuilder.js +2 -0
- package/dist/editor/types/ChangeSetBuilder.js.map +1 -0
- package/dist/editor/types/RepModel.d.ts +25 -0
- package/dist/editor/types/RepModel.d.ts.map +1 -0
- package/dist/editor/types/RepModel.js +2 -0
- package/dist/editor/types/RepModel.js.map +1 -0
- package/dist/editor/undomodule.d.ts +30 -0
- package/dist/editor/undomodule.d.ts.map +1 -0
- package/dist/editor/undomodule.js +276 -0
- package/dist/editor/undomodule.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/themes.d.ts +81 -0
- package/dist/themes.d.ts.map +1 -0
- package/dist/themes.js +227 -0
- package/dist/themes.js.map +1 -0
- package/package.json +73 -7
package/dist/EpEditor.js
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, html } from 'lit';
|
|
8
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
9
|
+
import { AceEditor } from './editor/AceEditor.js';
|
|
10
|
+
/**
|
|
11
|
+
* `<ep-editor>` — A standalone rich-text editor web component based on
|
|
12
|
+
* Etherpad's Ace editor engine.
|
|
13
|
+
*
|
|
14
|
+
* Supports bold, italic, underline, strikethrough, ordered/unordered lists,
|
|
15
|
+
* indentation, undo/redo, and changeset-based collaboration.
|
|
16
|
+
*
|
|
17
|
+
* @fires content-changed - When the document text changes. Detail: `{ text: string }`
|
|
18
|
+
* @fires selection-changed - When the selection changes. Detail: `{ selStart, selEnd }`
|
|
19
|
+
* @fires ready - When the editor has finished initializing.
|
|
20
|
+
*/
|
|
21
|
+
let EpEditor = class EpEditor extends LitElement {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
/** Initial text content for the editor. */
|
|
25
|
+
this.content = '';
|
|
26
|
+
/** Whether the editor is read-only. */
|
|
27
|
+
this.readonly = false;
|
|
28
|
+
/** Whether text wrapping is enabled. */
|
|
29
|
+
this.wrap = true;
|
|
30
|
+
/** The current author ID for attributing changes. */
|
|
31
|
+
this.authorId = '';
|
|
32
|
+
this._ready = false;
|
|
33
|
+
this._editor = null;
|
|
34
|
+
this._initialContentSet = false;
|
|
35
|
+
}
|
|
36
|
+
// Render into the light DOM, NOT a shadow root. Etherpad's Ace engine reads
|
|
37
|
+
// and restores the caret via the document Selection API, which does not work
|
|
38
|
+
// reliably across a shadow boundary (the caret retargets to the host and
|
|
39
|
+
// every keystroke inserts at offset 0, reversing the text). In light DOM the
|
|
40
|
+
// engine uses the standard, well-tested selection path.
|
|
41
|
+
createRenderRoot() {
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
get editor() {
|
|
45
|
+
return this._editor;
|
|
46
|
+
}
|
|
47
|
+
// ── Lifecycle ──────────────────────────────────────────────
|
|
48
|
+
firstUpdated() {
|
|
49
|
+
const container = this.renderRoot.querySelector('.ep-editor-container');
|
|
50
|
+
if (!container)
|
|
51
|
+
return;
|
|
52
|
+
this._editor = new AceEditor(container);
|
|
53
|
+
this._editor.init().then(() => {
|
|
54
|
+
this._ready = true;
|
|
55
|
+
if (this.content && !this._initialContentSet) {
|
|
56
|
+
this._editor.setText(this.content);
|
|
57
|
+
this._initialContentSet = true;
|
|
58
|
+
}
|
|
59
|
+
this._editor.setEditable(!this.readonly);
|
|
60
|
+
this._editor.setWraps(this.wrap);
|
|
61
|
+
if (this.authorId) {
|
|
62
|
+
this._editor.setAuthor(this.authorId);
|
|
63
|
+
}
|
|
64
|
+
// Wire up events from the engine
|
|
65
|
+
this._editor.onContentChanged = (text) => {
|
|
66
|
+
this.dispatchEvent(new CustomEvent('content-changed', {
|
|
67
|
+
detail: { text },
|
|
68
|
+
bubbles: true,
|
|
69
|
+
composed: true,
|
|
70
|
+
}));
|
|
71
|
+
};
|
|
72
|
+
this._editor.onSelectionChanged = (selStart, selEnd) => {
|
|
73
|
+
this.dispatchEvent(new CustomEvent('selection-changed', {
|
|
74
|
+
detail: { selStart, selEnd },
|
|
75
|
+
bubbles: true,
|
|
76
|
+
composed: true,
|
|
77
|
+
}));
|
|
78
|
+
};
|
|
79
|
+
this.dispatchEvent(new CustomEvent('ready', { bubbles: true, composed: true }));
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
updated(changedProperties) {
|
|
83
|
+
if (!this._editor || !this._ready)
|
|
84
|
+
return;
|
|
85
|
+
if (changedProperties.has('readonly')) {
|
|
86
|
+
this._editor.setEditable(!this.readonly);
|
|
87
|
+
}
|
|
88
|
+
if (changedProperties.has('wrap')) {
|
|
89
|
+
this._editor.setWraps(this.wrap);
|
|
90
|
+
}
|
|
91
|
+
if (changedProperties.has('authorId') && this.authorId) {
|
|
92
|
+
this._editor.setAuthor(this.authorId);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
disconnectedCallback() {
|
|
96
|
+
super.disconnectedCallback();
|
|
97
|
+
if (this._editor) {
|
|
98
|
+
this._editor.dispose();
|
|
99
|
+
this._editor = null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// ── Public API ─────────────────────────────────────────────
|
|
103
|
+
/** Returns the current document text. */
|
|
104
|
+
getText() {
|
|
105
|
+
return this._editor?.getText() ?? '';
|
|
106
|
+
}
|
|
107
|
+
/** Sets the document text, replacing all current content. */
|
|
108
|
+
setText(text) {
|
|
109
|
+
if (this._editor && this._ready) {
|
|
110
|
+
this._editor.setText(text);
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
this.content = text;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/** Returns the attributed text with the attribute pool. */
|
|
117
|
+
getAttributedText() {
|
|
118
|
+
return this._editor?.getAttributedText() ?? null;
|
|
119
|
+
}
|
|
120
|
+
/** Sets the attributed text (for advanced/collaborative use). */
|
|
121
|
+
setAttributedText(atext, apoolJsonObj) {
|
|
122
|
+
this._editor?.setAttributedText(atext, apoolJsonObj);
|
|
123
|
+
}
|
|
124
|
+
/** Toggles a formatting attribute on the current selection (e.g. 'bold', 'italic'). */
|
|
125
|
+
toggleFormat(name) {
|
|
126
|
+
this._editor?.toggleAttribute(name);
|
|
127
|
+
}
|
|
128
|
+
/** Sets a formatting attribute on the current selection. */
|
|
129
|
+
setFormattingAttribute(name, value) {
|
|
130
|
+
this._editor?.setAttribute(name, value);
|
|
131
|
+
}
|
|
132
|
+
/** Returns whether the given attribute is active on the current selection. */
|
|
133
|
+
getFormattingAttribute(name) {
|
|
134
|
+
return this._editor?.getAttribute(name) ?? false;
|
|
135
|
+
}
|
|
136
|
+
/** Inserts an unordered (bullet) list at the current line. */
|
|
137
|
+
insertUnorderedList() {
|
|
138
|
+
this._editor?.insertUnorderedList();
|
|
139
|
+
}
|
|
140
|
+
/** Inserts an ordered (numbered) list at the current line. */
|
|
141
|
+
insertOrderedList() {
|
|
142
|
+
this._editor?.insertOrderedList();
|
|
143
|
+
}
|
|
144
|
+
/** Indents or outdents the current selection. */
|
|
145
|
+
indentOutdent(isOut) {
|
|
146
|
+
this._editor?.indentOutdent(isOut);
|
|
147
|
+
}
|
|
148
|
+
/** Performs undo. */
|
|
149
|
+
undo() {
|
|
150
|
+
this._editor?.undo();
|
|
151
|
+
}
|
|
152
|
+
/** Performs redo. */
|
|
153
|
+
redo() {
|
|
154
|
+
this._editor?.redo();
|
|
155
|
+
}
|
|
156
|
+
/** Focuses the editor. */
|
|
157
|
+
focusEditor() {
|
|
158
|
+
this._editor?.focus();
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Applies an external changeset (for collaboration).
|
|
162
|
+
* @param cs - The encoded changeset string.
|
|
163
|
+
* @param optAuthor - Optional author ID.
|
|
164
|
+
* @param apoolJsonObj - Optional attribute pool JSON.
|
|
165
|
+
*/
|
|
166
|
+
applyChangeset(cs, optAuthor, apoolJsonObj) {
|
|
167
|
+
this._editor?.applyChangeset(cs, optAuthor, apoolJsonObj);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Prepares the user's pending changes as a changeset (for collaboration).
|
|
171
|
+
* Returns `{ changeset, apool }` or null if no changes.
|
|
172
|
+
*/
|
|
173
|
+
prepareUserChangeset() {
|
|
174
|
+
return this._editor?.prepareUserChangeset() ?? null;
|
|
175
|
+
}
|
|
176
|
+
/** Sets an author's display color. */
|
|
177
|
+
setAuthorInfo(author, info) {
|
|
178
|
+
this._editor?.setAuthorInfo(author, info);
|
|
179
|
+
}
|
|
180
|
+
// ── Collaboration API ─────────────────────────────────────
|
|
181
|
+
/** Sets the base text for collaboration tracking. */
|
|
182
|
+
setBaseText(txt) {
|
|
183
|
+
this._editor?.setBaseText(txt);
|
|
184
|
+
}
|
|
185
|
+
/** Sets the base attributed text from the server. */
|
|
186
|
+
setBaseAttributedText(atxt, apoolJsonObj) {
|
|
187
|
+
this._editor?.setBaseAttributedText(atxt, apoolJsonObj);
|
|
188
|
+
}
|
|
189
|
+
/** Applies remote changes to the base text. */
|
|
190
|
+
applyChangesToBase(c, optAuthor, apoolJsonObj) {
|
|
191
|
+
this._editor?.applyChangesToBase(c, optAuthor, apoolJsonObj);
|
|
192
|
+
}
|
|
193
|
+
/** Commits prepared changeset to the base after server confirmation. */
|
|
194
|
+
applyPreparedChangesetToBase() {
|
|
195
|
+
this._editor?.applyPreparedChangesetToBase();
|
|
196
|
+
}
|
|
197
|
+
/** Registers a callback for when the user makes changes. */
|
|
198
|
+
setUserChangeNotificationCallback(f) {
|
|
199
|
+
this._editor?.setUserChangeNotificationCallback(f);
|
|
200
|
+
}
|
|
201
|
+
/** Sets an editor property (wraps, showsauthorcolors, etc.). */
|
|
202
|
+
setProperty(key, value) {
|
|
203
|
+
this._editor?.setProperty(key, value);
|
|
204
|
+
}
|
|
205
|
+
/** Returns the international composition state. */
|
|
206
|
+
getInInternationalComposition() {
|
|
207
|
+
return this._editor?.getInInternationalComposition() ?? null;
|
|
208
|
+
}
|
|
209
|
+
// ── Render ─────────────────────────────────────────────────
|
|
210
|
+
render() {
|
|
211
|
+
return html `
|
|
212
|
+
<style>
|
|
213
|
+
ep-editor { display: block; position: relative; min-height: 100px; }
|
|
214
|
+
ep-editor .ep-editor-container {
|
|
215
|
+
width: 100%;
|
|
216
|
+
height: 100%;
|
|
217
|
+
min-height: inherit;
|
|
218
|
+
overflow: auto;
|
|
219
|
+
font-family: var(--ep-editor-font, var(--main-font-family, Quicksand, Cantarell, "Open Sans", "Helvetica Neue", sans-serif));
|
|
220
|
+
font-size: var(--ep-editor-font-size, 14px);
|
|
221
|
+
line-height: var(--ep-editor-line-height, 1.6);
|
|
222
|
+
color: var(--ep-editor-color, var(--text-color, #485365));
|
|
223
|
+
background: var(--ep-editor-bg, var(--bg-color, #fff));
|
|
224
|
+
padding: var(--ep-editor-padding, 8px 12px);
|
|
225
|
+
box-sizing: border-box;
|
|
226
|
+
outline: none;
|
|
227
|
+
white-space: pre-wrap;
|
|
228
|
+
word-wrap: break-word;
|
|
229
|
+
}
|
|
230
|
+
ep-editor .ep-editor-container:focus { outline: none; }
|
|
231
|
+
ep-editor .ep-editor-container .list-bullet1 { list-style-type: disc; }
|
|
232
|
+
ep-editor .ep-editor-container .list-bullet2 { list-style-type: circle; }
|
|
233
|
+
ep-editor .ep-editor-container .list-bullet3 { list-style-type: square; }
|
|
234
|
+
ep-editor .ep-editor-container .list-bullet4 { list-style-type: disc; }
|
|
235
|
+
ep-editor .ep-editor-container .list-number1 { list-style-type: decimal; }
|
|
236
|
+
ep-editor .ep-editor-container .list-number2 { list-style-type: lower-alpha; }
|
|
237
|
+
ep-editor .ep-editor-container .list-number3 { list-style-type: lower-roman; }
|
|
238
|
+
ep-editor .ep-editor-container .list-number4 { list-style-type: decimal; }
|
|
239
|
+
ep-editor .ep-editor-container ul, ep-editor .ep-editor-container ol { padding-left: 1.5em; margin: 0; }
|
|
240
|
+
ep-editor .ep-editor-container .tag\\:b, ep-editor .ep-editor-container b { font-weight: bold; }
|
|
241
|
+
ep-editor .ep-editor-container .tag\\:i, ep-editor .ep-editor-container i { font-style: italic; }
|
|
242
|
+
ep-editor .ep-editor-container .tag\\:u, ep-editor .ep-editor-container u { text-decoration: underline; }
|
|
243
|
+
ep-editor .ep-editor-container .tag\\:s, ep-editor .ep-editor-container s { text-decoration: line-through; }
|
|
244
|
+
ep-editor .ep-editor-container a { color: var(--ep-editor-link-color, #2e96f3); text-decoration: underline; }
|
|
245
|
+
ep-editor[readonly] .ep-editor-container { opacity: 0.85; cursor: default; }
|
|
246
|
+
</style>
|
|
247
|
+
<div
|
|
248
|
+
class="ep-editor-container"
|
|
249
|
+
contenteditable="${this.readonly ? 'false' : 'true'}"
|
|
250
|
+
role="textbox"
|
|
251
|
+
aria-multiline="true"
|
|
252
|
+
aria-readonly="${this.readonly}"
|
|
253
|
+
spellcheck="true"
|
|
254
|
+
></div>
|
|
255
|
+
`;
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
__decorate([
|
|
259
|
+
property({ type: String })
|
|
260
|
+
], EpEditor.prototype, "content", void 0);
|
|
261
|
+
__decorate([
|
|
262
|
+
property({ type: Boolean, reflect: true })
|
|
263
|
+
], EpEditor.prototype, "readonly", void 0);
|
|
264
|
+
__decorate([
|
|
265
|
+
property({ type: Boolean })
|
|
266
|
+
], EpEditor.prototype, "wrap", void 0);
|
|
267
|
+
__decorate([
|
|
268
|
+
property({ type: String, attribute: 'author-id' })
|
|
269
|
+
], EpEditor.prototype, "authorId", void 0);
|
|
270
|
+
__decorate([
|
|
271
|
+
state()
|
|
272
|
+
], EpEditor.prototype, "_ready", void 0);
|
|
273
|
+
EpEditor = __decorate([
|
|
274
|
+
customElement('ep-editor')
|
|
275
|
+
], EpEditor);
|
|
276
|
+
export { EpEditor };
|
|
277
|
+
//# sourceMappingURL=EpEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EpEditor.js","sourceRoot":"","sources":["../src/EpEditor.ts"],"names":[],"mappings":";;;;;;A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;IACJ,CAAC;CACF,CAAA;AA3Q6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yCAAc;AAGG;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CAAkB;AAGhC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sCAAa;AAGW;IAAnD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;0CAAe;AAEjD;IAAhB,KAAK,EAAE;wCAAwB;AAtBrB,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAsRpB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export declare class EpInput extends LitElement {
|
|
3
|
+
static styles: import("lit").CSSResult;
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
placeholder: string;
|
|
7
|
+
hint: string;
|
|
8
|
+
errorText: string;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
error: boolean;
|
|
11
|
+
type: 'text' | 'password' | 'email' | 'number' | 'textarea';
|
|
12
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
13
|
+
private _onInput;
|
|
14
|
+
}
|
|
15
|
+
declare global {
|
|
16
|
+
interface HTMLElementTagNameMap {
|
|
17
|
+
'ep-input': EpInput;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=EpInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EpInput.d.ts","sourceRoot":"","sources":["../src/EpInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,qBACa,OAAQ,SAAQ,UAAU;IACrC,MAAM,CAAC,MAAM,0BAuEX;IAEU,KAAK,SAAM;IACX,KAAK,SAAM;IACX,WAAW,SAAM;IACjB,IAAI,SAAM;IACiB,SAAS,SAAM;IACV,QAAQ,UAAS;IACjB,KAAK,UAAS;IAC7B,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAU;IAElG,MAAM;IA2BN,OAAO,CAAC,QAAQ;CAQjB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,OAAO,CAAC;KACrB;CACF"}
|
package/dist/EpInput.js
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, html, css } from 'lit';
|
|
8
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
9
|
+
let EpInput = class EpInput extends LitElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.label = '';
|
|
13
|
+
this.value = '';
|
|
14
|
+
this.placeholder = '';
|
|
15
|
+
this.hint = '';
|
|
16
|
+
this.errorText = '';
|
|
17
|
+
this.disabled = false;
|
|
18
|
+
this.error = false;
|
|
19
|
+
this.type = 'text';
|
|
20
|
+
}
|
|
21
|
+
render() {
|
|
22
|
+
return html `
|
|
23
|
+
${this.label ? html `<label>${this.label}</label>` : ''}
|
|
24
|
+
${this.type === 'textarea'
|
|
25
|
+
? html `<textarea
|
|
26
|
+
.value="${this.value}"
|
|
27
|
+
placeholder="${this.placeholder}"
|
|
28
|
+
?disabled="${this.disabled}"
|
|
29
|
+
@input="${this._onInput}"
|
|
30
|
+
></textarea>`
|
|
31
|
+
: html `<input
|
|
32
|
+
type="${this.type}"
|
|
33
|
+
.value="${this.value}"
|
|
34
|
+
placeholder="${this.placeholder}"
|
|
35
|
+
?disabled="${this.disabled}"
|
|
36
|
+
@input="${this._onInput}"
|
|
37
|
+
/>`}
|
|
38
|
+
${this.error && this.errorText
|
|
39
|
+
? html `<div class="error-text">${this.errorText}</div>`
|
|
40
|
+
: this.hint
|
|
41
|
+
? html `<div class="hint">${this.hint}</div>`
|
|
42
|
+
: ''}
|
|
43
|
+
`;
|
|
44
|
+
}
|
|
45
|
+
_onInput(e) {
|
|
46
|
+
const target = e.target;
|
|
47
|
+
this.value = target.value;
|
|
48
|
+
this.dispatchEvent(new CustomEvent('ep-input', {
|
|
49
|
+
bubbles: true, composed: true,
|
|
50
|
+
detail: { value: this.value },
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
EpInput.styles = css `
|
|
55
|
+
:host {
|
|
56
|
+
--ep-font: var(--main-font-family, Quicksand, Cantarell, "Open Sans", "Helvetica Neue", sans-serif);
|
|
57
|
+
--ep-input-focus-border-color: var(--text-soft-color, #8a94a3);
|
|
58
|
+
display: block;
|
|
59
|
+
box-sizing: border-box;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
label {
|
|
63
|
+
display: block;
|
|
64
|
+
font-family: var(--ep-font);
|
|
65
|
+
font-size: 14px;
|
|
66
|
+
font-weight: 700;
|
|
67
|
+
color: var(--text-color, #485365);
|
|
68
|
+
margin-bottom: 6px;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
input, textarea {
|
|
72
|
+
font-family: var(--ep-font);
|
|
73
|
+
width: 100%;
|
|
74
|
+
height: 100%;
|
|
75
|
+
min-height: 0;
|
|
76
|
+
box-sizing: border-box;
|
|
77
|
+
display: block;
|
|
78
|
+
margin: 0;
|
|
79
|
+
padding: 8px 10px;
|
|
80
|
+
border: 1px solid var(--middle-color, #d2d2d2);
|
|
81
|
+
border-radius: calc(var(--radius, 4px) - 1px);
|
|
82
|
+
font-size: 14px;
|
|
83
|
+
background: var(--bg-soft-color, #f2f3f4);
|
|
84
|
+
color: var(--text-color, #485365);
|
|
85
|
+
outline: none;
|
|
86
|
+
transition: border-color 0.15s ease;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
input::placeholder, textarea::placeholder {
|
|
90
|
+
color: var(--text-soft-color, #576273);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
input:focus, textarea:focus {
|
|
94
|
+
border-color: var(--ep-input-focus-border-color);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
textarea {
|
|
98
|
+
resize: vertical;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
:host([disabled]) input,
|
|
102
|
+
:host([disabled]) textarea {
|
|
103
|
+
opacity: 0.5;
|
|
104
|
+
cursor: not-allowed;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.hint {
|
|
108
|
+
font-family: var(--ep-font);
|
|
109
|
+
font-size: 12px;
|
|
110
|
+
color: var(--text-soft-color, #576273);
|
|
111
|
+
margin-top: 4px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
:host([error]) input,
|
|
115
|
+
:host([error]) textarea {
|
|
116
|
+
border-color: var(--danger-color, #d1242f);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.error-text {
|
|
120
|
+
font-family: var(--ep-font);
|
|
121
|
+
font-size: 12px;
|
|
122
|
+
color: var(--danger-color, #d1242f);
|
|
123
|
+
margin-top: 4px;
|
|
124
|
+
}
|
|
125
|
+
`;
|
|
126
|
+
__decorate([
|
|
127
|
+
property()
|
|
128
|
+
], EpInput.prototype, "label", void 0);
|
|
129
|
+
__decorate([
|
|
130
|
+
property()
|
|
131
|
+
], EpInput.prototype, "value", void 0);
|
|
132
|
+
__decorate([
|
|
133
|
+
property()
|
|
134
|
+
], EpInput.prototype, "placeholder", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
property()
|
|
137
|
+
], EpInput.prototype, "hint", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
property({ attribute: 'error-text' })
|
|
140
|
+
], EpInput.prototype, "errorText", void 0);
|
|
141
|
+
__decorate([
|
|
142
|
+
property({ type: Boolean, reflect: true })
|
|
143
|
+
], EpInput.prototype, "disabled", void 0);
|
|
144
|
+
__decorate([
|
|
145
|
+
property({ type: Boolean, reflect: true })
|
|
146
|
+
], EpInput.prototype, "error", void 0);
|
|
147
|
+
__decorate([
|
|
148
|
+
property({ reflect: true })
|
|
149
|
+
], EpInput.prototype, "type", void 0);
|
|
150
|
+
EpInput = __decorate([
|
|
151
|
+
customElement('ep-input')
|
|
152
|
+
], EpInput);
|
|
153
|
+
export { EpInput };
|
|
154
|
+
//# sourceMappingURL=EpInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EpInput.js","sourceRoot":"","sources":["../src/EpInput.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGrD,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,UAAU;IAAhC;;QA0EO,UAAK,GAAG,EAAE,CAAC;QACX,UAAK,GAAG,EAAE,CAAC;QACX,gBAAW,GAAG,EAAE,CAAC;QACjB,SAAI,GAAG,EAAE,CAAC;QACiB,cAAS,GAAG,EAAE,CAAC;QACV,aAAQ,GAAG,KAAK,CAAC;QACjB,UAAK,GAAG,KAAK,CAAC;QAC7B,SAAI,GAA0D,MAAM,CAAC;IAqCpG,CAAC;IAnCC,MAAM;QACJ,OAAO,IAAI,CAAA;QACP,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAA,UAAU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AAQ,EAAE;qCAAW;AACiB;IAAtC,QAAQ,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;0CAAgB;AACV;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAAkB;AACjB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sCAAe;AAC7B;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;qCAAsE;AAjFvF,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAsHnB"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
interface ConfirmOptions {
|
|
3
|
+
title: string;
|
|
4
|
+
message: string;
|
|
5
|
+
confirmText?: string;
|
|
6
|
+
cancelText?: string;
|
|
7
|
+
}
|
|
8
|
+
interface PromptOptions {
|
|
9
|
+
title: string;
|
|
10
|
+
message: string;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class EpModal extends LitElement {
|
|
14
|
+
static properties: {
|
|
15
|
+
open: {
|
|
16
|
+
type: BooleanConstructor;
|
|
17
|
+
reflect: boolean;
|
|
18
|
+
};
|
|
19
|
+
modalTitle: {
|
|
20
|
+
attribute: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
static styles: import("lit").CSSResult;
|
|
24
|
+
open: boolean;
|
|
25
|
+
modalTitle: string;
|
|
26
|
+
private _previousFocus;
|
|
27
|
+
private _boundKeyDown;
|
|
28
|
+
constructor();
|
|
29
|
+
protected updated(changed: PropertyValues): void;
|
|
30
|
+
close(action?: string): void;
|
|
31
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
32
|
+
private _onOpen;
|
|
33
|
+
private _onClose;
|
|
34
|
+
private _handleKeyDown;
|
|
35
|
+
private _trapFocus;
|
|
36
|
+
static confirm(options: ConfirmOptions): Promise<boolean>;
|
|
37
|
+
static prompt(options: PromptOptions): Promise<string | null>;
|
|
38
|
+
}
|
|
39
|
+
declare global {
|
|
40
|
+
interface HTMLElementTagNameMap {
|
|
41
|
+
'ep-modal': EpModal;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=EpModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EpModal.d.ts","sourceRoot":"","sources":["../src/EpModal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,cAAc,EAAE,MAAM,KAAK,CAAC;AAE5D,UAAU,cAAc;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,OAAQ,SAAQ,UAAU;IACrC,OAAgB,UAAU;;;;;;;;MAGxB;IAEF,OAAgB,MAAM,0BAkEpB;IAEF,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IAEnB,OAAO,CAAC,cAAc,CAA4B;IAClD,OAAO,CAAC,aAAa,CAA6B;;cAS/B,OAAO,CAAC,OAAO,EAAE,cAAc;IAOlD,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM;cAOF,MAAM;IAgBzB,OAAO,CAAC,OAAO;IAQf,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,UAAU;IAkBlB,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IAwBzD,MAAM,CAAC,MAAM,CAAC,OAAO,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