stilo-editor 0.0.0-stage → 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/LICENSE +21 -0
- package/README.md +226 -2
- package/dist/characters--8h5uTeF.js +854 -0
- package/dist/content.css +398 -0
- package/dist/core/drop.d.ts +6 -0
- package/dist/core/editor.d.ts +120 -0
- package/dist/core/errors.d.ts +6 -0
- package/dist/core/events.d.ts +19 -0
- package/dist/core/extension-manager.d.ts +57 -0
- package/dist/core/extension.d.ts +48 -0
- package/dist/core/helpers/active.d.ts +33 -0
- package/dist/core/helpers/block-style.d.ts +25 -0
- package/dist/core/helpers/input-rules.d.ts +28 -0
- package/dist/core/helpers/lists.d.ts +20 -0
- package/dist/core/helpers/marks.d.ts +52 -0
- package/dist/core/helpers/nodes.d.ts +26 -0
- package/dist/core/helpers/parse-rules.d.ts +8 -0
- package/dist/core/helpers/word-count.d.ts +14 -0
- package/dist/core/html/css.d.ts +106 -0
- package/dist/core/html/parse.d.ts +7 -0
- package/dist/core/html/paste/base-styles.d.ts +7 -0
- package/dist/core/html/paste/google-docs.d.ts +7 -0
- package/dist/core/html/paste/index.d.ts +9 -0
- package/dist/core/html/paste/table-widths.d.ts +7 -0
- package/dist/core/html/paste/word.d.ts +8 -0
- package/dist/core/html/sanitize.d.ts +49 -0
- package/dist/core/html/serialize.d.ts +31 -0
- package/dist/core/types.d.ts +107 -0
- package/dist/extensions/blockquote/index.d.ts +15 -0
- package/dist/extensions/bold/index.d.ts +17 -0
- package/dist/extensions/bullet-list/index.d.ts +9 -0
- package/dist/extensions/clear-formatting/index.d.ts +12 -0
- package/dist/extensions/code/index.d.ts +15 -0
- package/dist/extensions/code-block/index.d.ts +24 -0
- package/dist/extensions/default-extensions/index.d.ts +57 -0
- package/dist/extensions/document/index.d.ts +17 -0
- package/dist/extensions/drop-cursor/index.d.ts +15 -0
- package/dist/extensions/gap-cursor/index.d.ts +6 -0
- package/dist/extensions/hard-break/index.d.ts +11 -0
- package/dist/extensions/heading/index.d.ts +25 -0
- package/dist/extensions/highlight/index.d.ts +24 -0
- package/dist/extensions/history/index.d.ts +21 -0
- package/dist/extensions/horizontal-rule/index.d.ts +11 -0
- package/dist/extensions/image/image-view.d.ts +27 -0
- package/dist/extensions/image/index.d.ts +29 -0
- package/dist/extensions/index.d.ts +36 -0
- package/dist/extensions/italic/index.d.ts +16 -0
- package/dist/extensions/line-height/index.d.ts +18 -0
- package/dist/extensions/link/index.d.ts +23 -0
- package/dist/extensions/list-item/index.d.ts +16 -0
- package/dist/extensions/move-block/index.d.ts +17 -0
- package/dist/extensions/ordered-list/index.d.ts +12 -0
- package/dist/extensions/paragraph/index.d.ts +14 -0
- package/dist/extensions/placeholder/index.d.ts +13 -0
- package/dist/extensions/search/index.d.ts +55 -0
- package/dist/extensions/strike/index.d.ts +16 -0
- package/dist/extensions/subscript/index.d.ts +16 -0
- package/dist/extensions/superscript/index.d.ts +17 -0
- package/dist/extensions/table/index.d.ts +70 -0
- package/dist/extensions/task-item/index.d.ts +24 -0
- package/dist/extensions/task-item/task-item-view.d.ts +24 -0
- package/dist/extensions/task-list/index.d.ts +11 -0
- package/dist/extensions/text/index.d.ts +12 -0
- package/dist/extensions/text-align/index.d.ts +18 -0
- package/dist/extensions/text-case/index.d.ts +14 -0
- package/dist/extensions/text-style/font-size.d.ts +21 -0
- package/dist/extensions/text-style/index.d.ts +30 -0
- package/dist/extensions/underline/index.d.ts +15 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +1 -0
- package/dist/src-CV6pgfTS.js +2662 -0
- package/dist/style.css +1395 -0
- package/dist/ui/components/character-picker.d.ts +22 -0
- package/dist/ui/components/characters.d.ts +10 -0
- package/dist/ui/components/color-button.d.ts +23 -0
- package/dist/ui/components/dropdown.d.ts +34 -0
- package/dist/ui/components/find-bar.d.ts +24 -0
- package/dist/ui/components/font-size-input.d.ts +21 -0
- package/dist/ui/components/icon-menu.d.ts +20 -0
- package/dist/ui/components/icon.d.ts +3 -0
- package/dist/ui/components/link-bubble.d.ts +19 -0
- package/dist/ui/components/link-popover.d.ts +20 -0
- package/dist/ui/components/popover.d.ts +27 -0
- package/dist/ui/components/shortcut.d.ts +11 -0
- package/dist/ui/components/status-bar.d.ts +19 -0
- package/dist/ui/components/table-actions.d.ts +25 -0
- package/dist/ui/components/table-handles.d.ts +16 -0
- package/dist/ui/components/table-menu.d.ts +21 -0
- package/dist/ui/i18n/en.d.ts +3 -0
- package/dist/ui/i18n/it.d.ts +3 -0
- package/dist/ui/i18n/types.d.ts +4 -0
- package/dist/ui/index.d.ts +23 -0
- package/dist/ui/toolbar/fonts.d.ts +8 -0
- package/dist/ui/toolbar/items.d.ts +33 -0
- package/dist/ui/toolbar/palette.d.ts +6 -0
- package/dist/ui/toolbar/toolbar.d.ts +28 -0
- package/dist/ui/toolbar/types.d.ts +150 -0
- package/dist/ui.css +996 -0
- package/dist/ui.js +2350 -0
- package/package.json +96 -4
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Node } from 'prosemirror-model';
|
|
2
|
+
import type { EditorView, NodeView, ViewMutationRecord } from 'prosemirror-view';
|
|
3
|
+
/**
|
|
4
|
+
* The `taskItem` node in the editor: `<li data-checked>` holding a checkbox
|
|
5
|
+
* (`input.stilo-task-item__checkbox`) and the content (`div.stilo-task-item__content`). Clicking
|
|
6
|
+
* the checkbox sets `checked`; it leaves the focus in the editor and does nothing when the editor
|
|
7
|
+
* is not editable.
|
|
8
|
+
*/
|
|
9
|
+
export declare class TaskItemView implements NodeView {
|
|
10
|
+
private readonly view;
|
|
11
|
+
private readonly getPos;
|
|
12
|
+
readonly dom: HTMLElement;
|
|
13
|
+
readonly contentDOM: HTMLElement;
|
|
14
|
+
private readonly checkbox;
|
|
15
|
+
private node;
|
|
16
|
+
constructor(node: Node, view: EditorView, getPos: () => number | undefined);
|
|
17
|
+
update(node: Node): boolean;
|
|
18
|
+
/** The checkbox handles its own events: ProseMirror must not move the selection. */
|
|
19
|
+
stopEvent(event: Event): boolean;
|
|
20
|
+
/** Only the content is ProseMirror's: the checkbox and the `data-checked` are the view's. */
|
|
21
|
+
ignoreMutation(mutation: ViewMutationRecord): boolean;
|
|
22
|
+
private render;
|
|
23
|
+
private setChecked;
|
|
24
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Command } from 'prosemirror-state';
|
|
2
|
+
declare module '../../core/types' {
|
|
3
|
+
interface Commands {
|
|
4
|
+
/** Wraps the selection in a task list, lifts it out, or converts another list type. */
|
|
5
|
+
toggleTaskList: () => Command;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The `taskList` node (`<ul data-type="taskList">`), docs/SPEC.md F-406. Requires `TaskItem`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const TaskList: (options?: Partial<Record<string, never>> | undefined) => import("../..").Extension<Record<string, never>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Command } from 'prosemirror-state';
|
|
2
|
+
declare module '../../core/types' {
|
|
3
|
+
interface Commands {
|
|
4
|
+
/**
|
|
5
|
+
* Replaces the selection with `text`, with the marks active at the cursor. Returns `false`
|
|
6
|
+
* for an empty string.
|
|
7
|
+
*/
|
|
8
|
+
insertText: (text: string) => Command;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/** The `text` node, and the `insertText` command. */
|
|
12
|
+
export declare const Text: (options?: Partial<Record<string, never>> | undefined) => import("../..").Extension<Record<string, never>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Command } from 'prosemirror-state';
|
|
2
|
+
import type { TextAlignment } from '../../core/helpers/block-style';
|
|
3
|
+
declare module '../../core/types' {
|
|
4
|
+
interface Commands {
|
|
5
|
+
/**
|
|
6
|
+
* Aligns the selected paragraphs and headings. `false` for another value, or when no
|
|
7
|
+
* selected block can be aligned.
|
|
8
|
+
*/
|
|
9
|
+
setTextAlign: (alignment: TextAlignment) => Command;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Text alignment of paragraphs and headings (docs/SPEC.md F-308): the command and its
|
|
14
|
+
* shortcuts. The `textAlign` attribute itself belongs to the `paragraph` and `heading` nodes, so
|
|
15
|
+
* aligned content keeps its alignment without this extension.
|
|
16
|
+
*/
|
|
17
|
+
export declare const TextAlign: (options?: Partial<Record<string, never>> | undefined) => import("../..").Extension<Record<string, never>>;
|
|
18
|
+
export type { TextAlignment } from '../../core/helpers/block-style';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Command } from 'prosemirror-state';
|
|
2
|
+
/**
|
|
3
|
+
* A letter case: `upper` (UPPERCASE), `lower` (lowercase), `title` (Title Case), `sentence`
|
|
4
|
+
* (Sentence case), `toggle` (tOGGLE cASE).
|
|
5
|
+
*/
|
|
6
|
+
export type LetterCase = 'upper' | 'lower' | 'title' | 'sentence' | 'toggle';
|
|
7
|
+
declare module '../../core/types' {
|
|
8
|
+
interface Commands {
|
|
9
|
+
/** Changes the case of the characters of the selection; marks are kept. */
|
|
10
|
+
setTextCase: (letterCase: LetterCase) => Command;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/** The `setTextCase` command, docs/SPEC.md F-213: changes the characters, not a style. */
|
|
14
|
+
export declare const TextCase: (options?: Partial<Record<string, never>> | undefined) => import("../..").Extension<Record<string, never>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Editor } from '../../core/editor';
|
|
2
|
+
/**
|
|
3
|
+
* The unit of a font size control: the number it shows and the unit it writes. `rem` shows px
|
|
4
|
+
* and writes rem, so the text follows the base size of the page that displays it.
|
|
5
|
+
*/
|
|
6
|
+
export type FontSizeUnit = 'pt' | 'px' | 'rem';
|
|
7
|
+
/**
|
|
8
|
+
* The font size of the text at `pos` in `unit`, rounded to one decimal: the size the browser
|
|
9
|
+
* renders, so it includes headings, `em` and the page's own base size. Without `pos`, the size
|
|
10
|
+
* at the start of the selection; for an empty selection, the size stored for the next typed text
|
|
11
|
+
* when there is one (the page does not show it yet). Where nothing can be measured (no layout, as
|
|
12
|
+
* in jsdom) it counts 16px (12pt).
|
|
13
|
+
*/
|
|
14
|
+
export declare function getFontSize(editor: Editor, unit?: FontSizeUnit, pos?: number): number;
|
|
15
|
+
/** The CSS font size for `value` in `unit`: `12` → `12pt`; for `rem`, px divided by the base. */
|
|
16
|
+
export declare function toFontSize(editor: Editor, value: number, unit?: FontSizeUnit): string;
|
|
17
|
+
/**
|
|
18
|
+
* The size after a step of `delta` from `size`: up to the next whole number, or down to the
|
|
19
|
+
* previous one (`13.5` + 1 → `14`), kept between 1 and 400.
|
|
20
|
+
*/
|
|
21
|
+
export declare function stepFontSizeValue(size: number, delta: number): number;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Command } from 'prosemirror-state';
|
|
2
|
+
import { type FontSizeUnit } from './font-size';
|
|
3
|
+
declare module '../../core/types' {
|
|
4
|
+
interface Commands {
|
|
5
|
+
/** Colors the selection. Returns `false` when `color` is not a valid CSS color. */
|
|
6
|
+
setColor: (color: string) => Command;
|
|
7
|
+
/** Removes the text color from the selection. */
|
|
8
|
+
unsetColor: () => Command;
|
|
9
|
+
/** Sets the font family list of the selection. Returns `false` when no name is valid. */
|
|
10
|
+
setFontFamily: (fontFamily: string) => Command;
|
|
11
|
+
/** Removes the font family from the selection. */
|
|
12
|
+
unsetFontFamily: () => Command;
|
|
13
|
+
/** Sets the font size of the selection (`px`, `pt`, `em`, `rem`, `%`); `false` if invalid. */
|
|
14
|
+
setFontSize: (fontSize: string) => Command;
|
|
15
|
+
/** Removes the font size from the selection. */
|
|
16
|
+
unsetFontSize: () => Command;
|
|
17
|
+
/**
|
|
18
|
+
* Changes the font size of each selected part (or of the next typed text) from the size it
|
|
19
|
+
* has on the page to the next whole number in `unit` (`delta` 1) or the previous one (`-1`),
|
|
20
|
+
* between 1 and 400. Default unit `pt`.
|
|
21
|
+
*/
|
|
22
|
+
stepFontSize: (delta: number, unit?: FontSizeUnit) => Command;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The `textStyle` mark (`<span style="font-family: x; font-size: y; color: z">`), docs/SPEC.md
|
|
27
|
+
* F-208, F-210, F-211. Also parsed from `<font face size color>`.
|
|
28
|
+
*/
|
|
29
|
+
export declare const TextStyle: (options?: Partial<Record<string, never>> | undefined) => import("../..").Extension<Record<string, never>>;
|
|
30
|
+
export { type FontSizeUnit, getFontSize, toFontSize } from './font-size';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Command } from 'prosemirror-state';
|
|
2
|
+
declare module '../../core/types' {
|
|
3
|
+
interface Commands {
|
|
4
|
+
/** Adds underline to the selection. */
|
|
5
|
+
setUnderline: () => Command;
|
|
6
|
+
/** Removes underline from the selection. */
|
|
7
|
+
unsetUnderline: () => Command;
|
|
8
|
+
/** Removes underline if the whole selection is underlined, otherwise adds it. */
|
|
9
|
+
toggleUnderline: () => Command;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The `underline` mark (`<u>`), docs/SPEC.md F-203. Also parsed from `text-decoration: underline`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const Underline: (options?: Partial<Record<string, never>> | undefined) => import("../..").Extension<Record<string, never>>;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { Editor } from './core/editor';
|
|
2
|
+
export { StiloError } from './core/errors';
|
|
3
|
+
export type { EventHandler } from './core/events';
|
|
4
|
+
export type { Extension, ExtensionContext, ExtensionSpec } from './core/extension';
|
|
5
|
+
export { DEFAULT_PRIORITY, defineExtension } from './core/extension';
|
|
6
|
+
export { attrsMatch, isMarkActive, isNodeActive } from './core/helpers/active';
|
|
7
|
+
export { markInputRule } from './core/helpers/input-rules';
|
|
8
|
+
export { toggleList } from './core/helpers/lists';
|
|
9
|
+
export { setMark, toggleMark, unsetMark } from './core/helpers/marks';
|
|
10
|
+
export { insertBlock, insertBlockNode } from './core/helpers/nodes';
|
|
11
|
+
export { textDecorationRules } from './core/helpers/parse-rules';
|
|
12
|
+
export { getWordCount, type WordCount } from './core/helpers/word-count';
|
|
13
|
+
export type { CommandFactories, CommandFactory, CommandName, CommandRunner, CommandRunners, Commands, EditorEvents, EditorOptions, JSONContent, SetContentOptions, } from './core/types';
|
|
14
|
+
export * from './extensions';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { B as Blockquote, z as Bold, R as BulletList, L as ClearFormatting, I as Code, F as CodeBlock, X as DEFAULT_PRIORITY, P as Document, N as DropCursor, Q as Editor, M as GapCursor, j as HardBreak, A as Heading, k as Highlight, O as History, D as HorizontalRule, E as Image, T as Italic, w as LineHeight, C as Link, S as ListItem, x as MoveBlock, b as OrderedList, y as Paragraph, v as Placeholder, g as Search, nt as StiloError, h as Strike, m as Subscript, p as Superscript, d as Table, u as TaskItem, l as TaskList, c as Text, s as TextAlign, o as TextCase, r as TextStyle, n as Underline, $ as attrsMatch, t as defaultExtensions, Z as defineExtension, i as getFontSize, _ as getSearchResults, f as getTableHeaders, V as getWordCount, U as insertBlock, W as insertBlockNode, et as isMarkActive, tt as isNodeActive, Y as markInputRule, G as setMark, H as textDecorationRules, a as toFontSize, J as toggleList, K as toggleMark, q as unsetMark } from "./src-CV6pgfTS.js";
|