pro-editor-schema 0.1.198 → 0.1.199

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/dist/index.d.mts CHANGED
@@ -7,13 +7,8 @@ type RestrictedAttribute<T = readonly string[]> = {
7
7
  };
8
8
  type AttributeDefinition<T = readonly string[]> = FreeAttribute | RestrictedAttribute<T>;
9
9
  type AllowedChildren = {
10
- tagName: string;
11
- required: boolean;
12
- };
13
- type ResolveTo = "unwrap" | "skip" | "remove";
14
- type ForbiddenElement = {
15
10
  code: SchemaCode;
16
- resolveTo?: ResolveTo;
11
+ required: boolean;
17
12
  };
18
13
  type Schema<TRequiredAttributes = readonly AttributeDefinition[], TOptionalAttributes = readonly AttributeDefinition[]> = {
19
14
  code: SchemaCode;
@@ -21,9 +16,8 @@ type Schema<TRequiredAttributes = readonly AttributeDefinition[], TOptionalAttri
21
16
  tag: string;
22
17
  requiredAttributes: TRequiredAttributes;
23
18
  optionalAttributes: TOptionalAttributes;
24
- defaultChildTagName?: string;
25
- allowedChildTagNames: ReadonlySet<AllowedChildren>;
26
- forbiddenElements?: ReadonlySet<ForbiddenElement>;
19
+ defaultChildCode?: SchemaCode;
20
+ allowedChildrenCodes: ReadonlySet<AllowedChildren>;
27
21
  };
28
22
  type SchemaCode = ElementSchemaCode | InlineSchemaCode | AtomSchemaCode;
29
23
  type ElementSchemaCode = "referenceBibliomixed" | "referenceBibliography" | "bibliodiv" | "degrees" | "email" | "equation" | "fignote" | "figsource" | "firstname" | "footnote" | "footnoteno" | "honorific" | "img" | "informalfigure" | "keyword" | "label1" | "li" | "line" | "lrh" | "math" | "mathphrase" | "merror" | "mfrac" | "mi" | "mmultiscripts" | "mn" | "mo" | "mover" | "mpadded" | "mphantom" | "mprescripts" | "mroot" | "mrow" | "ms" | "mspace" | "msqrt" | "mstyle" | "msub" | "msubsup" | "msup" | "mtable" | "mtd" | "mtext" | "mtr" | "munder" | "munderover" | "olink" | "org" | "orgname" | "para" | "punc" | "rrh" | "source1" | "speaker" | "subtitle1" | "surname" | "tag" | "tblfn" | "tblsource" | "thead" | "title1" | "token" | "tp" | "abstract1" | "affiliation" | "alttext" | "appendix" | "author" | "authorgroup" | "blockquote" | "caption1" | "chapter" | "dialogue" | "epigraph" | "figure1" | "footnoteSection" | "heading" | "imageobject" | "info1" | "keywordset" | "mediaobject" | "ol" | "personname" | "poem" | "sidebar" | "table" | "table1" | "tbody" | "td" | "tgroup" | "tr" | "ul";
@@ -35,9 +29,9 @@ declare const SCHEMAS: Record<SchemaCode, Schema>;
35
29
 
36
30
  declare const isIgnoredAttribute: (attribute: string) => boolean;
37
31
  declare const isIgnoredElement: (element: Element) => boolean;
38
- declare const findSchemaByCode: (code: SchemaCode) => Schema;
39
- declare const findSchemaByTagName: (tagName: string) => Schema[];
40
- declare const findSchemaByElement: (element: Element) => Schema;
32
+ declare const isIgnoredValidation: (code: SchemaCode) => boolean;
33
+ declare const findSchemaByCode: (code: SchemaCode) => Schema | undefined;
34
+ declare const findSchemaByElement: (element: Element) => Schema | undefined;
41
35
  declare const isAttributeRestricted: (attr: AttributeDefinition) => attr is RestrictedAttribute;
42
36
  declare const getAttributeName: (attribute: AttributeDefinition) => string;
43
37
  declare const findAttributeDefinitionByName: (definitions: readonly AttributeDefinition[], name: string) => AttributeDefinition | undefined;
@@ -55,6 +49,7 @@ type CreateElementParams<TSchema extends Schema> = {
55
49
  declare const createElement: <TSchema extends Schema>({ schemaCode, attributes, }: CreateElementParams<TSchema>) => HTMLElement;
56
50
 
57
51
  declare const IGNORED_ELEMENT_SELECTORS: string[];
52
+ declare const IGNORED_VALIDATION_ELEMENT_SELECTORS: SchemaCode[];
58
53
 
59
54
  declare const IGNORED_ATTRIBUTES: string[];
60
55
  declare const IGNORED_ATTRIBUTES_STARTS_WITH: string[];
@@ -111,4 +106,4 @@ type ValidationError = {
111
106
  */
112
107
  declare const validateXml: (xml: Element, elementsToLink: readonly string[], linkElements: readonly string[], schemasToValidateAgainst: SchemaCode[]) => ValidationError[];
113
108
 
114
- export { ALIGNMENT_ATTRIBUTE, ATOM_SCHEMAS, type AllowedChildren, type AtomSchemaCode, type AttributeDefinition, ELEMENT_SCHEMAS, ELE_ID_ATTRIBUTE, ElementLabel, type ElementSchemaCode, FIGURE_PLACEMENT_ATTRIBUTE, type ForbiddenElement, type FreeAttribute, ID_ATTRS, IGNORED_ATTRIBUTES, IGNORED_ATTRIBUTES_STARTS_WITH, IGNORED_ELEMENT_SELECTORS, INDENT_TYPE_ATTRIBUTE, INLINE_ELEMENT_SCHEMAS, type InlineSchemaCode, LAYOUT_ATTRIBUTES, LAYOUT_CELL_WIDTH_ATTRIBUTE, LAYOUT_TABLE_ORIENTATION_ATTRIBUTE, LAYOUT_TABLE_PLACEMENT_ATTRIBUTE, LAYOUT_USER_ATTRIBUTE, LEFT_INDENT_ATTRIBUTE, RIGHT_INDENT_ATTRIBUTE, type ResolveTo, type RestrictedAttribute, SCHEMAS, SPACE_ABOVE_ATTRIBUTE, SPACE_BELOW_ATTRIBUTE, SPECIAL_INDENT_ATTRIBUTE, STORE_ATTRIBUTE, STYLE_NAME_ATTRIBUTE, type Schema, type SchemaCode, type SchemaKind, TRACK_CHANGES_ATTRS, TRACK_CHANGES_ATTR_DATA_DATE, TRACK_CHANGES_ATTR_DATA_TIME, TRACK_CHANGES_ATTR_DATA_USERID, TRACK_CHANGES_ATTR_DATA_USERNAME, type ValidationError, type ValidationErrorKind, type ValidationErrorLevel, createElement, findAttributeDefinitionByName, findSchemaByCode, findSchemaByElement, findSchemaByTagName, getAttributeName, isAttributeRestricted, isIgnoredAttribute, isIgnoredElement, validateXml };
109
+ export { ALIGNMENT_ATTRIBUTE, ATOM_SCHEMAS, type AllowedChildren, type AtomSchemaCode, type AttributeDefinition, ELEMENT_SCHEMAS, ELE_ID_ATTRIBUTE, ElementLabel, type ElementSchemaCode, FIGURE_PLACEMENT_ATTRIBUTE, type FreeAttribute, ID_ATTRS, IGNORED_ATTRIBUTES, IGNORED_ATTRIBUTES_STARTS_WITH, IGNORED_ELEMENT_SELECTORS, IGNORED_VALIDATION_ELEMENT_SELECTORS, INDENT_TYPE_ATTRIBUTE, INLINE_ELEMENT_SCHEMAS, type InlineSchemaCode, LAYOUT_ATTRIBUTES, LAYOUT_CELL_WIDTH_ATTRIBUTE, LAYOUT_TABLE_ORIENTATION_ATTRIBUTE, LAYOUT_TABLE_PLACEMENT_ATTRIBUTE, LAYOUT_USER_ATTRIBUTE, LEFT_INDENT_ATTRIBUTE, RIGHT_INDENT_ATTRIBUTE, type RestrictedAttribute, SCHEMAS, SPACE_ABOVE_ATTRIBUTE, SPACE_BELOW_ATTRIBUTE, SPECIAL_INDENT_ATTRIBUTE, STORE_ATTRIBUTE, STYLE_NAME_ATTRIBUTE, type Schema, type SchemaCode, type SchemaKind, TRACK_CHANGES_ATTRS, TRACK_CHANGES_ATTR_DATA_DATE, TRACK_CHANGES_ATTR_DATA_TIME, TRACK_CHANGES_ATTR_DATA_USERID, TRACK_CHANGES_ATTR_DATA_USERNAME, type ValidationError, type ValidationErrorKind, type ValidationErrorLevel, createElement, findAttributeDefinitionByName, findSchemaByCode, findSchemaByElement, getAttributeName, isAttributeRestricted, isIgnoredAttribute, isIgnoredElement, isIgnoredValidation, validateXml };
package/dist/index.d.ts CHANGED
@@ -7,13 +7,8 @@ type RestrictedAttribute<T = readonly string[]> = {
7
7
  };
8
8
  type AttributeDefinition<T = readonly string[]> = FreeAttribute | RestrictedAttribute<T>;
9
9
  type AllowedChildren = {
10
- tagName: string;
11
- required: boolean;
12
- };
13
- type ResolveTo = "unwrap" | "skip" | "remove";
14
- type ForbiddenElement = {
15
10
  code: SchemaCode;
16
- resolveTo?: ResolveTo;
11
+ required: boolean;
17
12
  };
18
13
  type Schema<TRequiredAttributes = readonly AttributeDefinition[], TOptionalAttributes = readonly AttributeDefinition[]> = {
19
14
  code: SchemaCode;
@@ -21,9 +16,8 @@ type Schema<TRequiredAttributes = readonly AttributeDefinition[], TOptionalAttri
21
16
  tag: string;
22
17
  requiredAttributes: TRequiredAttributes;
23
18
  optionalAttributes: TOptionalAttributes;
24
- defaultChildTagName?: string;
25
- allowedChildTagNames: ReadonlySet<AllowedChildren>;
26
- forbiddenElements?: ReadonlySet<ForbiddenElement>;
19
+ defaultChildCode?: SchemaCode;
20
+ allowedChildrenCodes: ReadonlySet<AllowedChildren>;
27
21
  };
28
22
  type SchemaCode = ElementSchemaCode | InlineSchemaCode | AtomSchemaCode;
29
23
  type ElementSchemaCode = "referenceBibliomixed" | "referenceBibliography" | "bibliodiv" | "degrees" | "email" | "equation" | "fignote" | "figsource" | "firstname" | "footnote" | "footnoteno" | "honorific" | "img" | "informalfigure" | "keyword" | "label1" | "li" | "line" | "lrh" | "math" | "mathphrase" | "merror" | "mfrac" | "mi" | "mmultiscripts" | "mn" | "mo" | "mover" | "mpadded" | "mphantom" | "mprescripts" | "mroot" | "mrow" | "ms" | "mspace" | "msqrt" | "mstyle" | "msub" | "msubsup" | "msup" | "mtable" | "mtd" | "mtext" | "mtr" | "munder" | "munderover" | "olink" | "org" | "orgname" | "para" | "punc" | "rrh" | "source1" | "speaker" | "subtitle1" | "surname" | "tag" | "tblfn" | "tblsource" | "thead" | "title1" | "token" | "tp" | "abstract1" | "affiliation" | "alttext" | "appendix" | "author" | "authorgroup" | "blockquote" | "caption1" | "chapter" | "dialogue" | "epigraph" | "figure1" | "footnoteSection" | "heading" | "imageobject" | "info1" | "keywordset" | "mediaobject" | "ol" | "personname" | "poem" | "sidebar" | "table" | "table1" | "tbody" | "td" | "tgroup" | "tr" | "ul";
@@ -35,9 +29,9 @@ declare const SCHEMAS: Record<SchemaCode, Schema>;
35
29
 
36
30
  declare const isIgnoredAttribute: (attribute: string) => boolean;
37
31
  declare const isIgnoredElement: (element: Element) => boolean;
38
- declare const findSchemaByCode: (code: SchemaCode) => Schema;
39
- declare const findSchemaByTagName: (tagName: string) => Schema[];
40
- declare const findSchemaByElement: (element: Element) => Schema;
32
+ declare const isIgnoredValidation: (code: SchemaCode) => boolean;
33
+ declare const findSchemaByCode: (code: SchemaCode) => Schema | undefined;
34
+ declare const findSchemaByElement: (element: Element) => Schema | undefined;
41
35
  declare const isAttributeRestricted: (attr: AttributeDefinition) => attr is RestrictedAttribute;
42
36
  declare const getAttributeName: (attribute: AttributeDefinition) => string;
43
37
  declare const findAttributeDefinitionByName: (definitions: readonly AttributeDefinition[], name: string) => AttributeDefinition | undefined;
@@ -55,6 +49,7 @@ type CreateElementParams<TSchema extends Schema> = {
55
49
  declare const createElement: <TSchema extends Schema>({ schemaCode, attributes, }: CreateElementParams<TSchema>) => HTMLElement;
56
50
 
57
51
  declare const IGNORED_ELEMENT_SELECTORS: string[];
52
+ declare const IGNORED_VALIDATION_ELEMENT_SELECTORS: SchemaCode[];
58
53
 
59
54
  declare const IGNORED_ATTRIBUTES: string[];
60
55
  declare const IGNORED_ATTRIBUTES_STARTS_WITH: string[];
@@ -111,4 +106,4 @@ type ValidationError = {
111
106
  */
112
107
  declare const validateXml: (xml: Element, elementsToLink: readonly string[], linkElements: readonly string[], schemasToValidateAgainst: SchemaCode[]) => ValidationError[];
113
108
 
114
- export { ALIGNMENT_ATTRIBUTE, ATOM_SCHEMAS, type AllowedChildren, type AtomSchemaCode, type AttributeDefinition, ELEMENT_SCHEMAS, ELE_ID_ATTRIBUTE, ElementLabel, type ElementSchemaCode, FIGURE_PLACEMENT_ATTRIBUTE, type ForbiddenElement, type FreeAttribute, ID_ATTRS, IGNORED_ATTRIBUTES, IGNORED_ATTRIBUTES_STARTS_WITH, IGNORED_ELEMENT_SELECTORS, INDENT_TYPE_ATTRIBUTE, INLINE_ELEMENT_SCHEMAS, type InlineSchemaCode, LAYOUT_ATTRIBUTES, LAYOUT_CELL_WIDTH_ATTRIBUTE, LAYOUT_TABLE_ORIENTATION_ATTRIBUTE, LAYOUT_TABLE_PLACEMENT_ATTRIBUTE, LAYOUT_USER_ATTRIBUTE, LEFT_INDENT_ATTRIBUTE, RIGHT_INDENT_ATTRIBUTE, type ResolveTo, type RestrictedAttribute, SCHEMAS, SPACE_ABOVE_ATTRIBUTE, SPACE_BELOW_ATTRIBUTE, SPECIAL_INDENT_ATTRIBUTE, STORE_ATTRIBUTE, STYLE_NAME_ATTRIBUTE, type Schema, type SchemaCode, type SchemaKind, TRACK_CHANGES_ATTRS, TRACK_CHANGES_ATTR_DATA_DATE, TRACK_CHANGES_ATTR_DATA_TIME, TRACK_CHANGES_ATTR_DATA_USERID, TRACK_CHANGES_ATTR_DATA_USERNAME, type ValidationError, type ValidationErrorKind, type ValidationErrorLevel, createElement, findAttributeDefinitionByName, findSchemaByCode, findSchemaByElement, findSchemaByTagName, getAttributeName, isAttributeRestricted, isIgnoredAttribute, isIgnoredElement, validateXml };
109
+ export { ALIGNMENT_ATTRIBUTE, ATOM_SCHEMAS, type AllowedChildren, type AtomSchemaCode, type AttributeDefinition, ELEMENT_SCHEMAS, ELE_ID_ATTRIBUTE, ElementLabel, type ElementSchemaCode, FIGURE_PLACEMENT_ATTRIBUTE, type FreeAttribute, ID_ATTRS, IGNORED_ATTRIBUTES, IGNORED_ATTRIBUTES_STARTS_WITH, IGNORED_ELEMENT_SELECTORS, IGNORED_VALIDATION_ELEMENT_SELECTORS, INDENT_TYPE_ATTRIBUTE, INLINE_ELEMENT_SCHEMAS, type InlineSchemaCode, LAYOUT_ATTRIBUTES, LAYOUT_CELL_WIDTH_ATTRIBUTE, LAYOUT_TABLE_ORIENTATION_ATTRIBUTE, LAYOUT_TABLE_PLACEMENT_ATTRIBUTE, LAYOUT_USER_ATTRIBUTE, LEFT_INDENT_ATTRIBUTE, RIGHT_INDENT_ATTRIBUTE, type RestrictedAttribute, SCHEMAS, SPACE_ABOVE_ATTRIBUTE, SPACE_BELOW_ATTRIBUTE, SPECIAL_INDENT_ATTRIBUTE, STORE_ATTRIBUTE, STYLE_NAME_ATTRIBUTE, type Schema, type SchemaCode, type SchemaKind, TRACK_CHANGES_ATTRS, TRACK_CHANGES_ATTR_DATA_DATE, TRACK_CHANGES_ATTR_DATA_TIME, TRACK_CHANGES_ATTR_DATA_USERID, TRACK_CHANGES_ATTR_DATA_USERNAME, type ValidationError, type ValidationErrorKind, type ValidationErrorLevel, createElement, findAttributeDefinitionByName, findSchemaByCode, findSchemaByElement, getAttributeName, isAttributeRestricted, isIgnoredAttribute, isIgnoredElement, isIgnoredValidation, validateXml };