json-joy
Version:
Collection of libraries for building collaborative editing apps.
211 lines (210 loc) • 6.14 kB
TypeScript
/**
* Specifies whether the start or the end of the cursor is the "anchor", e.g.
* the end which does not move when user changes selection. The other
* end is free to move, the moving end of the cursor is "focus". By default
* "anchor" is usually the start of the cursor.
*/
export declare enum CursorAnchor {
Start = 0,
End = 1
}
export declare const enum SliceTypeCon {
p = 0,// <p>
blockquote = 1,// <blockquote>
codeblock = 2,// <pre><code>
pre = 3,// <pre>
ul = 4,// <ul>
ol = 5,// <ol>
tl = 6,// - [ ] Task list
li = 7,// <li>
h1 = 8,// <h1>
h2 = 9,// <h2>
h3 = 10,// <h3>
h4 = 11,// <h4>
h5 = 12,// <h5>
h6 = 13,// <h6>
title = 14,// <title>
subtitle = 15,// <subtitle>
br = 16,// <br>
nl = 17,// \n
hr = 18,// <hr>
page = 19,// Page break
aside = 20,// <aside>
embed = 21,// <embed>, <iframe>, <object>, <video>, <audio>, etc.
column = 22,// <div style="column-count: ..."> (represents 2 and 3 column layouts)
contents = 23,// Table of contents
table = 24,// <table>
row = 25,// Table row
cell = 26,// Table cell
collapselist = 27,// Collapsible list - > List item
collapse = 28,// Collapsible block
note = 29,// Note block
mathblock = 30,// <math> block
Cursor = -1,
RemoteCursor = -2,
b = -3,// <b>
i = -4,// <i>
u = -5,// <u>
s = -6,// <s>
code = -7,// <code>
mark = -8,// <mark>
a = -9,// <a>
comment = -10,// User comment attached to a slice
del = -11,// <del>
ins = -12,// <ins>
sup = -13,// <sup>
sub = -14,// <sub>
math = -15,// <math> inline
font = -16,// <span style="font-family: ...">
col = -17,// <span style="color: ...">
bg = -18,// <span style="background: ...">
kbd = -19,// <kbd>
spoiler = -20,// <span style="color: transparent; background: black">
q = -21,// <q> (inline quote)
cite = -22,// <cite> (inline citation)
footnote = -23,// <sup> or <a> with href="#footnote-..." and title="Footnote ..."
ref = -24,// <a> with href="#ref-..." and title="Reference ..." (Reference to some element in the document)
iaside = -25,// Inline <aside>
iembed = -26,// inline embed (any media, dropdown, Google Docs-like chips: date, person, file, etc.)
bookmark = -27,// UI for creating a link to this slice
overline = -28
}
/**
* All type name must be fully lowercase, as HTML custom element tag names must
* be lowercase.
*/
export declare enum SliceTypeName {
p = 0,
blockquote = 1,
codeblock = 2,
pre = 3,
ul = 4,
ol = 5,
tl = 6,
li = 7,
h1 = 8,
h2 = 9,
h3 = 10,
h4 = 11,
h5 = 12,
h6 = 13,
title = 14,
subtitle = 15,
br = 16,
nl = 17,
hr = 18,
page = 19,
aside = 20,
embed = 21,
column = 22,
contents = 23,
table = 24,
row = 25,
cell = 26,
collapselist = 27,
collapse = 28,
note = 29,
mathblock = 30,
Cursor = -1,
RemoteCursor = -2,
b = -3,
i = -4,
u = -5,
s = -6,
code = -7,
mark = -8,
a = -9,
comment = -10,
del = -11,
ins = -12,
sup = -13,
sub = -14,
math = -15,
font = -16,
col = -17,
bg = -18,
kbd = -19,
spoiler = -20,
footnote = -23,
ref = -24,
iaside = -25,
iembed = -26,
bookmark = -27,
overline = -28
}
/** Slice header octet (8 bits) masking specification. */
export declare enum SliceHeaderMask {
/** The {@link Anchor} of the slice start {@link Point}. */
X1Anchor = 1,
/** The {@link Anchor} of the slice end {@link Point}. */
X2Anchor = 2,
/** Slice stacking behavior, one of {@link SliceStacking}. */
Stacking = 28
}
export declare enum SliceHeaderShift {
X1Anchor = 0,
X2Anchor = 1,
Stacking = 2
}
export declare enum SliceStacking {
/**
* The `Marker` slices are used to mark a block split position in the
* document. For example, paragraph, heading, blockquote, etc. It separates
* adjacent blocks and is used to determine the block type of the contents
* following the marker, until the next marker is encountered.
*/
Marker = 0,
/**
* The `Many` slices are inline formatting annotations, which allow one
* or more annotations of the same type to apply to the same text. Slices with
* stacking behavior `Many` are appended to the stack of attributes for a
* specific slice type. With the most recent annotation on top.
*
* Slices with stacking behavior `Many` are used for inline formatting, like
* for links, comments, etc. Where multiple annotations of the same type can
* be applied to the same text.
*/
Many = 1,
/**
* The slices with stacking behavior `One` are used for inline formatting
* annotations, they overwrite the stack of attributes for a specific slice
* type. This type of slice is used when only one annotation of a specific
* type can be applied to the same text. For example, those could be used
* for simple inline formatting, like bold, italic, etc.
*/
One = 2,
/**
* The `Erase` slices are used to soft remove all annotations
* (`Many` or `One`) of the same type which are applied to the same text
* range. The erase slices soft remove only the annotations which were applied
* before the erase slice, as determined by the logical clock (there could
* be many layers of annotations applied and erased).
*
* Usually slices with stacking behavior `Erase` are used to reverse inline
* exclusive (`One`) inline formatting, like bold, italic, etc.
*/
Erase = 3,
/**
* Used to mark the user's cursor position in the document.
*
* @todo Consider removing this.
*/
Cursor = 4
}
export declare enum SliceStackingName {
Marker = 0,
Many = 1,
One = 2,
Erase = 3,
Cursor = 4
}
/**
* Specifies `vec` offsets in the {@link SliceView}.
*/
export declare enum SliceTupleIndex {
Header = 0,
X1 = 1,
X2 = 2,
Type = 3,
Data = 4
}