json-joy
Version:
Collection of libraries for building collaborative editing apps.
157 lines (156 loc) • 7.96 kB
JavaScript
/**
* 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 var CursorAnchor;
(function (CursorAnchor) {
CursorAnchor[CursorAnchor["Start"] = 0] = "Start";
CursorAnchor[CursorAnchor["End"] = 1] = "End";
})(CursorAnchor || (CursorAnchor = {}));
/**
* All type name must be fully lowercase, as HTML custom element tag names must
* be lowercase.
*/
export var SliceTypeName;
(function (SliceTypeName) {
SliceTypeName[SliceTypeName["p"] = 0] = "p";
SliceTypeName[SliceTypeName["blockquote"] = 1] = "blockquote";
SliceTypeName[SliceTypeName["codeblock"] = 2] = "codeblock";
SliceTypeName[SliceTypeName["pre"] = 3] = "pre";
SliceTypeName[SliceTypeName["ul"] = 4] = "ul";
SliceTypeName[SliceTypeName["ol"] = 5] = "ol";
SliceTypeName[SliceTypeName["tl"] = 6] = "tl";
SliceTypeName[SliceTypeName["li"] = 7] = "li";
SliceTypeName[SliceTypeName["h1"] = 8] = "h1";
SliceTypeName[SliceTypeName["h2"] = 9] = "h2";
SliceTypeName[SliceTypeName["h3"] = 10] = "h3";
SliceTypeName[SliceTypeName["h4"] = 11] = "h4";
SliceTypeName[SliceTypeName["h5"] = 12] = "h5";
SliceTypeName[SliceTypeName["h6"] = 13] = "h6";
SliceTypeName[SliceTypeName["title"] = 14] = "title";
SliceTypeName[SliceTypeName["subtitle"] = 15] = "subtitle";
SliceTypeName[SliceTypeName["br"] = 16] = "br";
SliceTypeName[SliceTypeName["nl"] = 17] = "nl";
SliceTypeName[SliceTypeName["hr"] = 18] = "hr";
SliceTypeName[SliceTypeName["page"] = 19] = "page";
SliceTypeName[SliceTypeName["aside"] = 20] = "aside";
SliceTypeName[SliceTypeName["embed"] = 21] = "embed";
SliceTypeName[SliceTypeName["column"] = 22] = "column";
SliceTypeName[SliceTypeName["contents"] = 23] = "contents";
SliceTypeName[SliceTypeName["table"] = 24] = "table";
SliceTypeName[SliceTypeName["row"] = 25] = "row";
SliceTypeName[SliceTypeName["cell"] = 26] = "cell";
SliceTypeName[SliceTypeName["collapselist"] = 27] = "collapselist";
SliceTypeName[SliceTypeName["collapse"] = 28] = "collapse";
SliceTypeName[SliceTypeName["note"] = 29] = "note";
SliceTypeName[SliceTypeName["mathblock"] = 30] = "mathblock";
SliceTypeName[SliceTypeName["Cursor"] = -1] = "Cursor";
SliceTypeName[SliceTypeName["RemoteCursor"] = -2] = "RemoteCursor";
SliceTypeName[SliceTypeName["b"] = -3] = "b";
SliceTypeName[SliceTypeName["i"] = -4] = "i";
SliceTypeName[SliceTypeName["u"] = -5] = "u";
SliceTypeName[SliceTypeName["s"] = -6] = "s";
SliceTypeName[SliceTypeName["code"] = -7] = "code";
SliceTypeName[SliceTypeName["mark"] = -8] = "mark";
SliceTypeName[SliceTypeName["a"] = -9] = "a";
SliceTypeName[SliceTypeName["comment"] = -10] = "comment";
SliceTypeName[SliceTypeName["del"] = -11] = "del";
SliceTypeName[SliceTypeName["ins"] = -12] = "ins";
SliceTypeName[SliceTypeName["sup"] = -13] = "sup";
SliceTypeName[SliceTypeName["sub"] = -14] = "sub";
SliceTypeName[SliceTypeName["math"] = -15] = "math";
SliceTypeName[SliceTypeName["font"] = -16] = "font";
SliceTypeName[SliceTypeName["col"] = -17] = "col";
SliceTypeName[SliceTypeName["bg"] = -18] = "bg";
SliceTypeName[SliceTypeName["kbd"] = -19] = "kbd";
SliceTypeName[SliceTypeName["spoiler"] = -20] = "spoiler";
SliceTypeName[SliceTypeName["footnote"] = -23] = "footnote";
SliceTypeName[SliceTypeName["ref"] = -24] = "ref";
SliceTypeName[SliceTypeName["iaside"] = -25] = "iaside";
SliceTypeName[SliceTypeName["iembed"] = -26] = "iembed";
SliceTypeName[SliceTypeName["bookmark"] = -27] = "bookmark";
SliceTypeName[SliceTypeName["overline"] = -28] = "overline";
})(SliceTypeName || (SliceTypeName = {}));
/** Slice header octet (8 bits) masking specification. */
export var SliceHeaderMask;
(function (SliceHeaderMask) {
/** The {@link Anchor} of the slice start {@link Point}. */
SliceHeaderMask[SliceHeaderMask["X1Anchor"] = 1] = "X1Anchor";
/** The {@link Anchor} of the slice end {@link Point}. */
SliceHeaderMask[SliceHeaderMask["X2Anchor"] = 2] = "X2Anchor";
/** Slice stacking behavior, one of {@link SliceStacking}. */
SliceHeaderMask[SliceHeaderMask["Stacking"] = 28] = "Stacking";
})(SliceHeaderMask || (SliceHeaderMask = {}));
export var SliceHeaderShift;
(function (SliceHeaderShift) {
SliceHeaderShift[SliceHeaderShift["X1Anchor"] = 0] = "X1Anchor";
SliceHeaderShift[SliceHeaderShift["X2Anchor"] = 1] = "X2Anchor";
SliceHeaderShift[SliceHeaderShift["Stacking"] = 2] = "Stacking";
})(SliceHeaderShift || (SliceHeaderShift = {}));
export var SliceStacking;
(function (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.
*/
SliceStacking[SliceStacking["Marker"] = 0] = "Marker";
/**
* 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.
*/
SliceStacking[SliceStacking["Many"] = 1] = "Many";
/**
* 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.
*/
SliceStacking[SliceStacking["One"] = 2] = "One";
/**
* 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.
*/
SliceStacking[SliceStacking["Erase"] = 3] = "Erase";
/**
* Used to mark the user's cursor position in the document.
*
* @todo Consider removing this.
*/
SliceStacking[SliceStacking["Cursor"] = 4] = "Cursor";
})(SliceStacking || (SliceStacking = {}));
export var SliceStackingName;
(function (SliceStackingName) {
SliceStackingName[SliceStackingName["Marker"] = 0] = "Marker";
SliceStackingName[SliceStackingName["Many"] = 1] = "Many";
SliceStackingName[SliceStackingName["One"] = 2] = "One";
SliceStackingName[SliceStackingName["Erase"] = 3] = "Erase";
SliceStackingName[SliceStackingName["Cursor"] = 4] = "Cursor";
})(SliceStackingName || (SliceStackingName = {}));
/**
* Specifies `vec` offsets in the {@link SliceView}.
*/
export var SliceTupleIndex;
(function (SliceTupleIndex) {
SliceTupleIndex[SliceTupleIndex["Header"] = 0] = "Header";
SliceTupleIndex[SliceTupleIndex["X1"] = 1] = "X1";
SliceTupleIndex[SliceTupleIndex["X2"] = 2] = "X2";
SliceTupleIndex[SliceTupleIndex["Type"] = 3] = "Type";
SliceTupleIndex[SliceTupleIndex["Data"] = 4] = "Data";
})(SliceTupleIndex || (SliceTupleIndex = {}));