pro-editor-schema 0.0.1-alpha.1 → 0.0.1-alpha.3

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
@@ -21,17 +21,120 @@ type Schema<TRequiredAttributes extends readonly AttributeDefinition[] = readonl
21
21
  allowedChildTagNames: ReadonlySet<string>;
22
22
  };
23
23
 
24
- declare const SCHEMAS: Schema[];
24
+ type schema_types_AttributeDefinition<T extends readonly string[] = readonly string[]> = AttributeDefinition<T>;
25
+ type schema_types_ELEMENT_ROLE = ELEMENT_ROLE;
26
+ declare const schema_types_ELEMENT_ROLE: typeof ELEMENT_ROLE;
27
+ type schema_types_FreeAttribute = FreeAttribute;
28
+ type schema_types_RestrictedAttribute<T extends readonly string[] = readonly string[]> = RestrictedAttribute<T>;
29
+ type schema_types_Schema<TRequiredAttributes extends readonly AttributeDefinition[] = readonly AttributeDefinition[], TOptionalAttributes extends readonly AttributeDefinition[] = readonly AttributeDefinition[]> = Schema<TRequiredAttributes, TOptionalAttributes>;
30
+ type schema_types_SchemaKind = SchemaKind;
31
+ declare namespace schema_types {
32
+ export { type schema_types_AttributeDefinition as AttributeDefinition, schema_types_ELEMENT_ROLE as ELEMENT_ROLE, type schema_types_FreeAttribute as FreeAttribute, type schema_types_RestrictedAttribute as RestrictedAttribute, type schema_types_Schema as Schema, type schema_types_SchemaKind as SchemaKind };
33
+ }
34
+
35
+ declare const SCHEMAS: ReadonlyArray<Schema>;
36
+ declare const SCHEMA_MAP: Map<string, Schema>;
37
+ declare const schemas: {
38
+ [k: string]: Schema;
39
+ };
40
+
41
+ declare const schemas$1_SCHEMAS: typeof SCHEMAS;
42
+ declare const schemas$1_SCHEMA_MAP: typeof SCHEMA_MAP;
43
+ declare const schemas$1_schemas: typeof schemas;
44
+ declare namespace schemas$1 {
45
+ export { schemas$1_SCHEMAS as SCHEMAS, schemas$1_SCHEMA_MAP as SCHEMA_MAP, schemas$1_schemas as schemas };
46
+ }
47
+
48
+ declare const ELEMENT_SCHEMAS: ReadonlyArray<Schema>;
49
+ declare const elementSchemas: {
50
+ [k: string]: Schema;
51
+ };
52
+
53
+ declare const index$3_ELEMENT_SCHEMAS: typeof ELEMENT_SCHEMAS;
54
+ declare const index$3_elementSchemas: typeof elementSchemas;
55
+ declare namespace index$3 {
56
+ export { index$3_ELEMENT_SCHEMAS as ELEMENT_SCHEMAS, index$3_elementSchemas as elementSchemas };
57
+ }
58
+
59
+ declare const GROUP_ELEMENT_SCHEMAS: ReadonlyArray<Schema>;
60
+ declare const groupElementSchemas: {
61
+ [k: string]: Schema;
62
+ };
63
+
64
+ declare const index$2_GROUP_ELEMENT_SCHEMAS: typeof GROUP_ELEMENT_SCHEMAS;
65
+ declare const index$2_groupElementSchemas: typeof groupElementSchemas;
66
+ declare namespace index$2 {
67
+ export { index$2_GROUP_ELEMENT_SCHEMAS as GROUP_ELEMENT_SCHEMAS, index$2_groupElementSchemas as groupElementSchemas };
68
+ }
69
+
70
+ declare const INLINE_ELEMENT_SCHEMAS: ReadonlyArray<Schema>;
71
+ declare const inlineElementSchemas: {
72
+ [k: string]: Schema;
73
+ };
74
+
75
+ declare const index$1_INLINE_ELEMENT_SCHEMAS: typeof INLINE_ELEMENT_SCHEMAS;
76
+ declare const index$1_inlineElementSchemas: typeof inlineElementSchemas;
77
+ declare namespace index$1 {
78
+ export { index$1_INLINE_ELEMENT_SCHEMAS as INLINE_ELEMENT_SCHEMAS, index$1_inlineElementSchemas as inlineElementSchemas };
79
+ }
80
+
81
+ declare const ATOM_SCHEMAS: ReadonlyArray<Schema>;
82
+ declare const atomSchemas: {
83
+ [k: string]: Schema;
84
+ };
85
+
86
+ declare const index_ATOM_SCHEMAS: typeof ATOM_SCHEMAS;
87
+ declare const index_atomSchemas: typeof atomSchemas;
88
+ declare namespace index {
89
+ export { index_ATOM_SCHEMAS as ATOM_SCHEMAS, index_atomSchemas as atomSchemas };
90
+ }
25
91
 
26
92
  declare const IGNORED_ATTRIBUTES: string[];
27
93
 
94
+ declare const ignoredAttributes_IGNORED_ATTRIBUTES: typeof IGNORED_ATTRIBUTES;
95
+ declare namespace ignoredAttributes {
96
+ export { ignoredAttributes_IGNORED_ATTRIBUTES as IGNORED_ATTRIBUTES };
97
+ }
98
+
28
99
  declare const isIgnoredAttribute: (attribute: string) => boolean;
29
100
  declare const isIgnoredElement: (element: Element) => boolean;
30
101
  declare const findSchemaByTag: (element: Element) => Schema | undefined;
102
+ declare const isAttributeRestricted: (attr: AttributeDefinition) => attr is RestrictedAttribute;
103
+ declare const getAttributeName: (attribute: AttributeDefinition) => string;
104
+ declare const findAttributeDefinitionByName: (definitions: readonly AttributeDefinition[], name: string) => AttributeDefinition | undefined;
105
+
106
+ declare const utils_findAttributeDefinitionByName: typeof findAttributeDefinitionByName;
107
+ declare const utils_findSchemaByTag: typeof findSchemaByTag;
108
+ declare const utils_getAttributeName: typeof getAttributeName;
109
+ declare const utils_isAttributeRestricted: typeof isAttributeRestricted;
110
+ declare const utils_isIgnoredAttribute: typeof isIgnoredAttribute;
111
+ declare const utils_isIgnoredElement: typeof isIgnoredElement;
112
+ declare namespace utils {
113
+ export { utils_findAttributeDefinitionByName as findAttributeDefinitionByName, utils_findSchemaByTag as findSchemaByTag, utils_getAttributeName as getAttributeName, utils_isAttributeRestricted as isAttributeRestricted, utils_isIgnoredAttribute as isIgnoredAttribute, utils_isIgnoredElement as isIgnoredElement };
114
+ }
31
115
 
32
116
  declare const IGNORED_ELEMENT_SELECTORS: string[];
33
117
 
118
+ declare const ignoredElements_IGNORED_ELEMENT_SELECTORS: typeof IGNORED_ELEMENT_SELECTORS;
119
+ declare namespace ignoredElements {
120
+ export { ignoredElements_IGNORED_ELEMENT_SELECTORS as IGNORED_ELEMENT_SELECTORS };
121
+ }
122
+
123
+ declare const TRACK_CHANGES_ATTR_DATA_USERNAME = "data-username";
124
+ declare const TRACK_CHANGES_ATTR_DATA_USERID = "data-userid";
125
+ declare const TRACK_CHANGES_ATTR_DATA_TIME = "data-time";
126
+ declare const TRACK_CHANGES_ATTR_DATA_DATE = "data-date";
34
127
  declare const TRACK_CHANGES_ATTRS: readonly ["data-username", "data-userid", "data-time", "data-date"];
35
128
  declare const ID_ATTRS: readonly ["store", "ele-id"];
36
129
 
37
- export { ID_ATTRS, IGNORED_ATTRIBUTES, IGNORED_ELEMENT_SELECTORS, type Schema, TRACK_CHANGES_ATTRS, findSchemaByTag, isIgnoredAttribute, isIgnoredElement, SCHEMAS as schemas };
130
+ declare const globalAttributes_ID_ATTRS: typeof ID_ATTRS;
131
+ declare const globalAttributes_TRACK_CHANGES_ATTRS: typeof TRACK_CHANGES_ATTRS;
132
+ declare const globalAttributes_TRACK_CHANGES_ATTR_DATA_DATE: typeof TRACK_CHANGES_ATTR_DATA_DATE;
133
+ declare const globalAttributes_TRACK_CHANGES_ATTR_DATA_TIME: typeof TRACK_CHANGES_ATTR_DATA_TIME;
134
+ declare const globalAttributes_TRACK_CHANGES_ATTR_DATA_USERID: typeof TRACK_CHANGES_ATTR_DATA_USERID;
135
+ declare const globalAttributes_TRACK_CHANGES_ATTR_DATA_USERNAME: typeof TRACK_CHANGES_ATTR_DATA_USERNAME;
136
+ declare namespace globalAttributes {
137
+ export { globalAttributes_ID_ATTRS as ID_ATTRS, globalAttributes_TRACK_CHANGES_ATTRS as TRACK_CHANGES_ATTRS, globalAttributes_TRACK_CHANGES_ATTR_DATA_DATE as TRACK_CHANGES_ATTR_DATA_DATE, globalAttributes_TRACK_CHANGES_ATTR_DATA_TIME as TRACK_CHANGES_ATTR_DATA_TIME, globalAttributes_TRACK_CHANGES_ATTR_DATA_USERID as TRACK_CHANGES_ATTR_DATA_USERID, globalAttributes_TRACK_CHANGES_ATTR_DATA_USERNAME as TRACK_CHANGES_ATTR_DATA_USERNAME };
138
+ }
139
+
140
+ export { globalAttributes as GlobalAttributes, ignoredAttributes as IgnoredAttributes, ignoredElements as IgnoredElements, schema_types as SchemaTypes, schemas$1 as Schemas, index as SchemasAtoms, index$3 as SchemasElements, index$2 as SchemasGroupElements, index$1 as SchemasInlineElements, utils as Utils };
package/dist/index.d.ts CHANGED
@@ -21,17 +21,120 @@ type Schema<TRequiredAttributes extends readonly AttributeDefinition[] = readonl
21
21
  allowedChildTagNames: ReadonlySet<string>;
22
22
  };
23
23
 
24
- declare const SCHEMAS: Schema[];
24
+ type schema_types_AttributeDefinition<T extends readonly string[] = readonly string[]> = AttributeDefinition<T>;
25
+ type schema_types_ELEMENT_ROLE = ELEMENT_ROLE;
26
+ declare const schema_types_ELEMENT_ROLE: typeof ELEMENT_ROLE;
27
+ type schema_types_FreeAttribute = FreeAttribute;
28
+ type schema_types_RestrictedAttribute<T extends readonly string[] = readonly string[]> = RestrictedAttribute<T>;
29
+ type schema_types_Schema<TRequiredAttributes extends readonly AttributeDefinition[] = readonly AttributeDefinition[], TOptionalAttributes extends readonly AttributeDefinition[] = readonly AttributeDefinition[]> = Schema<TRequiredAttributes, TOptionalAttributes>;
30
+ type schema_types_SchemaKind = SchemaKind;
31
+ declare namespace schema_types {
32
+ export { type schema_types_AttributeDefinition as AttributeDefinition, schema_types_ELEMENT_ROLE as ELEMENT_ROLE, type schema_types_FreeAttribute as FreeAttribute, type schema_types_RestrictedAttribute as RestrictedAttribute, type schema_types_Schema as Schema, type schema_types_SchemaKind as SchemaKind };
33
+ }
34
+
35
+ declare const SCHEMAS: ReadonlyArray<Schema>;
36
+ declare const SCHEMA_MAP: Map<string, Schema>;
37
+ declare const schemas: {
38
+ [k: string]: Schema;
39
+ };
40
+
41
+ declare const schemas$1_SCHEMAS: typeof SCHEMAS;
42
+ declare const schemas$1_SCHEMA_MAP: typeof SCHEMA_MAP;
43
+ declare const schemas$1_schemas: typeof schemas;
44
+ declare namespace schemas$1 {
45
+ export { schemas$1_SCHEMAS as SCHEMAS, schemas$1_SCHEMA_MAP as SCHEMA_MAP, schemas$1_schemas as schemas };
46
+ }
47
+
48
+ declare const ELEMENT_SCHEMAS: ReadonlyArray<Schema>;
49
+ declare const elementSchemas: {
50
+ [k: string]: Schema;
51
+ };
52
+
53
+ declare const index$3_ELEMENT_SCHEMAS: typeof ELEMENT_SCHEMAS;
54
+ declare const index$3_elementSchemas: typeof elementSchemas;
55
+ declare namespace index$3 {
56
+ export { index$3_ELEMENT_SCHEMAS as ELEMENT_SCHEMAS, index$3_elementSchemas as elementSchemas };
57
+ }
58
+
59
+ declare const GROUP_ELEMENT_SCHEMAS: ReadonlyArray<Schema>;
60
+ declare const groupElementSchemas: {
61
+ [k: string]: Schema;
62
+ };
63
+
64
+ declare const index$2_GROUP_ELEMENT_SCHEMAS: typeof GROUP_ELEMENT_SCHEMAS;
65
+ declare const index$2_groupElementSchemas: typeof groupElementSchemas;
66
+ declare namespace index$2 {
67
+ export { index$2_GROUP_ELEMENT_SCHEMAS as GROUP_ELEMENT_SCHEMAS, index$2_groupElementSchemas as groupElementSchemas };
68
+ }
69
+
70
+ declare const INLINE_ELEMENT_SCHEMAS: ReadonlyArray<Schema>;
71
+ declare const inlineElementSchemas: {
72
+ [k: string]: Schema;
73
+ };
74
+
75
+ declare const index$1_INLINE_ELEMENT_SCHEMAS: typeof INLINE_ELEMENT_SCHEMAS;
76
+ declare const index$1_inlineElementSchemas: typeof inlineElementSchemas;
77
+ declare namespace index$1 {
78
+ export { index$1_INLINE_ELEMENT_SCHEMAS as INLINE_ELEMENT_SCHEMAS, index$1_inlineElementSchemas as inlineElementSchemas };
79
+ }
80
+
81
+ declare const ATOM_SCHEMAS: ReadonlyArray<Schema>;
82
+ declare const atomSchemas: {
83
+ [k: string]: Schema;
84
+ };
85
+
86
+ declare const index_ATOM_SCHEMAS: typeof ATOM_SCHEMAS;
87
+ declare const index_atomSchemas: typeof atomSchemas;
88
+ declare namespace index {
89
+ export { index_ATOM_SCHEMAS as ATOM_SCHEMAS, index_atomSchemas as atomSchemas };
90
+ }
25
91
 
26
92
  declare const IGNORED_ATTRIBUTES: string[];
27
93
 
94
+ declare const ignoredAttributes_IGNORED_ATTRIBUTES: typeof IGNORED_ATTRIBUTES;
95
+ declare namespace ignoredAttributes {
96
+ export { ignoredAttributes_IGNORED_ATTRIBUTES as IGNORED_ATTRIBUTES };
97
+ }
98
+
28
99
  declare const isIgnoredAttribute: (attribute: string) => boolean;
29
100
  declare const isIgnoredElement: (element: Element) => boolean;
30
101
  declare const findSchemaByTag: (element: Element) => Schema | undefined;
102
+ declare const isAttributeRestricted: (attr: AttributeDefinition) => attr is RestrictedAttribute;
103
+ declare const getAttributeName: (attribute: AttributeDefinition) => string;
104
+ declare const findAttributeDefinitionByName: (definitions: readonly AttributeDefinition[], name: string) => AttributeDefinition | undefined;
105
+
106
+ declare const utils_findAttributeDefinitionByName: typeof findAttributeDefinitionByName;
107
+ declare const utils_findSchemaByTag: typeof findSchemaByTag;
108
+ declare const utils_getAttributeName: typeof getAttributeName;
109
+ declare const utils_isAttributeRestricted: typeof isAttributeRestricted;
110
+ declare const utils_isIgnoredAttribute: typeof isIgnoredAttribute;
111
+ declare const utils_isIgnoredElement: typeof isIgnoredElement;
112
+ declare namespace utils {
113
+ export { utils_findAttributeDefinitionByName as findAttributeDefinitionByName, utils_findSchemaByTag as findSchemaByTag, utils_getAttributeName as getAttributeName, utils_isAttributeRestricted as isAttributeRestricted, utils_isIgnoredAttribute as isIgnoredAttribute, utils_isIgnoredElement as isIgnoredElement };
114
+ }
31
115
 
32
116
  declare const IGNORED_ELEMENT_SELECTORS: string[];
33
117
 
118
+ declare const ignoredElements_IGNORED_ELEMENT_SELECTORS: typeof IGNORED_ELEMENT_SELECTORS;
119
+ declare namespace ignoredElements {
120
+ export { ignoredElements_IGNORED_ELEMENT_SELECTORS as IGNORED_ELEMENT_SELECTORS };
121
+ }
122
+
123
+ declare const TRACK_CHANGES_ATTR_DATA_USERNAME = "data-username";
124
+ declare const TRACK_CHANGES_ATTR_DATA_USERID = "data-userid";
125
+ declare const TRACK_CHANGES_ATTR_DATA_TIME = "data-time";
126
+ declare const TRACK_CHANGES_ATTR_DATA_DATE = "data-date";
34
127
  declare const TRACK_CHANGES_ATTRS: readonly ["data-username", "data-userid", "data-time", "data-date"];
35
128
  declare const ID_ATTRS: readonly ["store", "ele-id"];
36
129
 
37
- export { ID_ATTRS, IGNORED_ATTRIBUTES, IGNORED_ELEMENT_SELECTORS, type Schema, TRACK_CHANGES_ATTRS, findSchemaByTag, isIgnoredAttribute, isIgnoredElement, SCHEMAS as schemas };
130
+ declare const globalAttributes_ID_ATTRS: typeof ID_ATTRS;
131
+ declare const globalAttributes_TRACK_CHANGES_ATTRS: typeof TRACK_CHANGES_ATTRS;
132
+ declare const globalAttributes_TRACK_CHANGES_ATTR_DATA_DATE: typeof TRACK_CHANGES_ATTR_DATA_DATE;
133
+ declare const globalAttributes_TRACK_CHANGES_ATTR_DATA_TIME: typeof TRACK_CHANGES_ATTR_DATA_TIME;
134
+ declare const globalAttributes_TRACK_CHANGES_ATTR_DATA_USERID: typeof TRACK_CHANGES_ATTR_DATA_USERID;
135
+ declare const globalAttributes_TRACK_CHANGES_ATTR_DATA_USERNAME: typeof TRACK_CHANGES_ATTR_DATA_USERNAME;
136
+ declare namespace globalAttributes {
137
+ export { globalAttributes_ID_ATTRS as ID_ATTRS, globalAttributes_TRACK_CHANGES_ATTRS as TRACK_CHANGES_ATTRS, globalAttributes_TRACK_CHANGES_ATTR_DATA_DATE as TRACK_CHANGES_ATTR_DATA_DATE, globalAttributes_TRACK_CHANGES_ATTR_DATA_TIME as TRACK_CHANGES_ATTR_DATA_TIME, globalAttributes_TRACK_CHANGES_ATTR_DATA_USERID as TRACK_CHANGES_ATTR_DATA_USERID, globalAttributes_TRACK_CHANGES_ATTR_DATA_USERNAME as TRACK_CHANGES_ATTR_DATA_USERNAME };
138
+ }
139
+
140
+ export { globalAttributes as GlobalAttributes, ignoredAttributes as IgnoredAttributes, ignoredElements as IgnoredElements, schema_types as SchemaTypes, schemas$1 as Schemas, index as SchemasAtoms, index$3 as SchemasElements, index$2 as SchemasGroupElements, index$1 as SchemasInlineElements, utils as Utils };
package/dist/index.js CHANGED
@@ -20,17 +20,34 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
- ID_ATTRS: () => ID_ATTRS,
24
- IGNORED_ATTRIBUTES: () => IGNORED_ATTRIBUTES,
25
- IGNORED_ELEMENT_SELECTORS: () => IGNORED_ELEMENT_SELECTORS,
26
- TRACK_CHANGES_ATTRS: () => TRACK_CHANGES_ATTRS,
27
- findSchemaByTag: () => findSchemaByTag,
28
- isIgnoredAttribute: () => isIgnoredAttribute,
29
- isIgnoredElement: () => isIgnoredElement,
30
- schemas: () => SCHEMAS
23
+ GlobalAttributes: () => globalAttributes_exports,
24
+ IgnoredAttributes: () => ignoredAttributes_exports,
25
+ IgnoredElements: () => ignoredElements_exports,
26
+ SchemaTypes: () => schema_types_exports,
27
+ Schemas: () => schemas_exports,
28
+ SchemasAtoms: () => atoms_exports,
29
+ SchemasElements: () => elements_exports,
30
+ SchemasGroupElements: () => groupElements_exports,
31
+ SchemasInlineElements: () => inlineElements_exports,
32
+ Utils: () => utils_exports
31
33
  });
32
34
  module.exports = __toCommonJS(index_exports);
33
35
 
36
+ // src/schema/schemas.ts
37
+ var schemas_exports = {};
38
+ __export(schemas_exports, {
39
+ SCHEMAS: () => SCHEMAS,
40
+ SCHEMA_MAP: () => SCHEMA_MAP,
41
+ schemas: () => schemas
42
+ });
43
+
44
+ // src/schema/elementSchemas/atoms/index.ts
45
+ var atoms_exports = {};
46
+ __export(atoms_exports, {
47
+ ATOM_SCHEMAS: () => ATOM_SCHEMAS,
48
+ atomSchemas: () => atomSchemas
49
+ });
50
+
34
51
  // src/schema/shared/createSchema.ts
35
52
  var createSchema = ({
36
53
  kind,
@@ -51,6 +68,15 @@ var createSchema = ({
51
68
  };
52
69
 
53
70
  // src/schema/shared/globalAttributes.ts
71
+ var globalAttributes_exports = {};
72
+ __export(globalAttributes_exports, {
73
+ ID_ATTRS: () => ID_ATTRS,
74
+ TRACK_CHANGES_ATTRS: () => TRACK_CHANGES_ATTRS,
75
+ TRACK_CHANGES_ATTR_DATA_DATE: () => TRACK_CHANGES_ATTR_DATA_DATE,
76
+ TRACK_CHANGES_ATTR_DATA_TIME: () => TRACK_CHANGES_ATTR_DATA_TIME,
77
+ TRACK_CHANGES_ATTR_DATA_USERID: () => TRACK_CHANGES_ATTR_DATA_USERID,
78
+ TRACK_CHANGES_ATTR_DATA_USERNAME: () => TRACK_CHANGES_ATTR_DATA_USERNAME
79
+ });
54
80
  var TRACK_CHANGES_ATTR_DATA_USERNAME = "data-username";
55
81
  var TRACK_CHANGES_ATTR_DATA_USERID = "data-userid";
56
82
  var TRACK_CHANGES_ATTR_DATA_TIME = "data-time";
@@ -98,6 +124,19 @@ var B_SCHEMA = createSchema({
98
124
  allowedChildTagNames: ATOM_TAGS
99
125
  });
100
126
 
127
+ // src/schema/schema.types.ts
128
+ var schema_types_exports = {};
129
+ __export(schema_types_exports, {
130
+ ELEMENT_ROLE: () => ELEMENT_ROLE
131
+ });
132
+ var ELEMENT_ROLE = /* @__PURE__ */ ((ELEMENT_ROLE2) => {
133
+ ELEMENT_ROLE2["QUERYCOMMENTSWRAPPER"] = "QUERYCOMMENTSWRAPPER";
134
+ ELEMENT_ROLE2["HEADING"] = "HEADING";
135
+ ELEMENT_ROLE2["INS"] = "INS";
136
+ ELEMENT_ROLE2["DEL"] = "DEL";
137
+ return ELEMENT_ROLE2;
138
+ })(ELEMENT_ROLE || {});
139
+
101
140
  // src/schema/elementSchemas/atoms/commentQuerySection.ts
102
141
  var COMMENT_QUERY_SECTION_SCHEMA = createSchema({
103
142
  kind: "atom",
@@ -222,6 +261,16 @@ var ATOM_SCHEMAS = [
222
261
  INSERTION_SCHEMA,
223
262
  DELETION_SCHEMA
224
263
  ];
264
+ var atomSchemas = Object.fromEntries(
265
+ ATOM_SCHEMAS.map((schema) => [schema.tag, schema])
266
+ );
267
+
268
+ // src/schema/elementSchemas/elements/index.ts
269
+ var elements_exports = {};
270
+ __export(elements_exports, {
271
+ ELEMENT_SCHEMAS: () => ELEMENT_SCHEMAS,
272
+ elementSchemas: () => elementSchemas
273
+ });
225
274
 
226
275
  // src/schema/elementSchemas/inlineElements/inlineElementsTags.ts
227
276
  var COMMENT_TAG = "COMMENT";
@@ -277,6 +326,16 @@ var ELEMENT_SCHEMAS = [
277
326
  PARA_SCHEMA,
278
327
  TITLE_SCHEMA
279
328
  ];
329
+ var elementSchemas = Object.fromEntries(
330
+ ELEMENT_SCHEMAS.map((schema) => [schema.tag, schema])
331
+ );
332
+
333
+ // src/schema/elementSchemas/groupElements/index.ts
334
+ var groupElements_exports = {};
335
+ __export(groupElements_exports, {
336
+ GROUP_ELEMENT_SCHEMAS: () => GROUP_ELEMENT_SCHEMAS,
337
+ groupElementSchemas: () => groupElementSchemas
338
+ });
280
339
 
281
340
  // src/schema/elementSchemas/groupElements/groupElementsTags.ts
282
341
  var SECTION_TAG = "SECTION1";
@@ -301,6 +360,16 @@ var SECTION_SCHEMA = createSchema({
301
360
 
302
361
  // src/schema/elementSchemas/groupElements/index.ts
303
362
  var GROUP_ELEMENT_SCHEMAS = [SECTION_SCHEMA];
363
+ var groupElementSchemas = Object.fromEntries(
364
+ GROUP_ELEMENT_SCHEMAS.map((schema) => [schema.tag, schema])
365
+ );
366
+
367
+ // src/schema/elementSchemas/inlineElements/index.ts
368
+ var inlineElements_exports = {};
369
+ __export(inlineElements_exports, {
370
+ INLINE_ELEMENT_SCHEMAS: () => INLINE_ELEMENT_SCHEMAS,
371
+ inlineElementSchemas: () => inlineElementSchemas
372
+ });
304
373
 
305
374
  // src/schema/elementSchemas/inlineElements/comment.ts
306
375
  var COMMENT_SCHEMA = createSchema({
@@ -424,6 +493,9 @@ var INLINE_ELEMENT_SCHEMAS = [
424
493
  CONTENT_SCHEMA,
425
494
  REPLY_SCHEMA
426
495
  ];
496
+ var inlineElementSchemas = Object.fromEntries(
497
+ INLINE_ELEMENT_SCHEMAS.map((schema) => [schema.tag, schema])
498
+ );
427
499
 
428
500
  // src/schema/schemas.ts
429
501
  var SCHEMAS = [
@@ -432,8 +504,18 @@ var SCHEMAS = [
432
504
  ...GROUP_ELEMENT_SCHEMAS,
433
505
  ...INLINE_ELEMENT_SCHEMAS
434
506
  ];
507
+ var SCHEMA_MAP = new Map(
508
+ SCHEMAS.map((schema) => [schema.tag, schema])
509
+ );
510
+ var schemas = Object.fromEntries(
511
+ SCHEMAS.map((schema) => [schema.tag, schema])
512
+ );
435
513
 
436
514
  // src/schema/shared/ignoredAttributes.ts
515
+ var ignoredAttributes_exports = {};
516
+ __export(ignoredAttributes_exports, {
517
+ IGNORED_ATTRIBUTES: () => IGNORED_ATTRIBUTES
518
+ });
437
519
  var IGNORED_ATTRIBUTES = [
438
520
  // Styling & layout
439
521
  "class",
@@ -450,7 +532,22 @@ var IGNORED_ATTRIBUTES = [
450
532
  "hidden"
451
533
  ];
452
534
 
535
+ // src/schema/shared/utils.ts
536
+ var utils_exports = {};
537
+ __export(utils_exports, {
538
+ findAttributeDefinitionByName: () => findAttributeDefinitionByName,
539
+ findSchemaByTag: () => findSchemaByTag,
540
+ getAttributeName: () => getAttributeName,
541
+ isAttributeRestricted: () => isAttributeRestricted,
542
+ isIgnoredAttribute: () => isIgnoredAttribute,
543
+ isIgnoredElement: () => isIgnoredElement
544
+ });
545
+
453
546
  // src/schema/shared/ignoredElements.ts
547
+ var ignoredElements_exports = {};
548
+ __export(ignoredElements_exports, {
549
+ IGNORED_ELEMENT_SELECTORS: () => IGNORED_ELEMENT_SELECTORS
550
+ });
454
551
  var IGNORED_ELEMENT_SELECTORS = [
455
552
  "span.rhlabel",
456
553
  "span.abstractlabel",
@@ -462,15 +559,47 @@ var IGNORED_ELEMENT_SELECTORS = [
462
559
  // src/schema/shared/utils.ts
463
560
  var isIgnoredAttribute = (attribute) => IGNORED_ATTRIBUTES.includes(attribute);
464
561
  var isIgnoredElement = (element) => IGNORED_ELEMENT_SELECTORS.some((selector) => element.matches(selector));
465
- var findSchemaByTag = (element) => SCHEMAS.find((schema) => schema.tag === element.tagName.toLowerCase());
562
+ var findSchemaByTag = (element) => {
563
+ const isInsertion = element.classList.contains("ins");
564
+ const isDeletion = element.classList.contains("del");
565
+ const isQueryComment = element.classList.contains("cmtQurySection");
566
+ const isHeading = element.getAttribute("role")?.startsWith("H");
567
+ if (isHeading) {
568
+ return SCHEMA_MAP.get(element.tagName.toUpperCase() + "HEADING" /* HEADING */);
569
+ }
570
+ if (isInsertion) {
571
+ return SCHEMA_MAP.get(element.tagName.toUpperCase() + "INS" /* INS */);
572
+ }
573
+ if (isDeletion) {
574
+ return SCHEMA_MAP.get(element.tagName.toUpperCase() + "DEL" /* DEL */);
575
+ }
576
+ if (isQueryComment) {
577
+ return SCHEMA_MAP.get(
578
+ element.tagName.toUpperCase() + "QUERYCOMMENTSWRAPPER" /* QUERYCOMMENTSWRAPPER */
579
+ );
580
+ }
581
+ return SCHEMA_MAP.get(element.tagName.toUpperCase());
582
+ };
583
+ var isAttributeRestricted = (attr) => typeof attr !== "string";
584
+ var getAttributeName = (attribute) => typeof attribute === "string" ? attribute : attribute.name;
585
+ var findAttributeDefinitionByName = (definitions, name) => {
586
+ for (const def of definitions) {
587
+ if (getAttributeName(def) === name) {
588
+ return def;
589
+ }
590
+ }
591
+ return void 0;
592
+ };
466
593
  // Annotate the CommonJS export names for ESM import in node:
467
594
  0 && (module.exports = {
468
- ID_ATTRS,
469
- IGNORED_ATTRIBUTES,
470
- IGNORED_ELEMENT_SELECTORS,
471
- TRACK_CHANGES_ATTRS,
472
- findSchemaByTag,
473
- isIgnoredAttribute,
474
- isIgnoredElement,
475
- schemas
595
+ GlobalAttributes,
596
+ IgnoredAttributes,
597
+ IgnoredElements,
598
+ SchemaTypes,
599
+ Schemas,
600
+ SchemasAtoms,
601
+ SchemasElements,
602
+ SchemasGroupElements,
603
+ SchemasInlineElements,
604
+ Utils
476
605
  });
package/dist/index.mjs CHANGED
@@ -1,3 +1,24 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ // src/schema/schemas.ts
8
+ var schemas_exports = {};
9
+ __export(schemas_exports, {
10
+ SCHEMAS: () => SCHEMAS,
11
+ SCHEMA_MAP: () => SCHEMA_MAP,
12
+ schemas: () => schemas
13
+ });
14
+
15
+ // src/schema/elementSchemas/atoms/index.ts
16
+ var atoms_exports = {};
17
+ __export(atoms_exports, {
18
+ ATOM_SCHEMAS: () => ATOM_SCHEMAS,
19
+ atomSchemas: () => atomSchemas
20
+ });
21
+
1
22
  // src/schema/shared/createSchema.ts
2
23
  var createSchema = ({
3
24
  kind,
@@ -18,6 +39,15 @@ var createSchema = ({
18
39
  };
19
40
 
20
41
  // src/schema/shared/globalAttributes.ts
42
+ var globalAttributes_exports = {};
43
+ __export(globalAttributes_exports, {
44
+ ID_ATTRS: () => ID_ATTRS,
45
+ TRACK_CHANGES_ATTRS: () => TRACK_CHANGES_ATTRS,
46
+ TRACK_CHANGES_ATTR_DATA_DATE: () => TRACK_CHANGES_ATTR_DATA_DATE,
47
+ TRACK_CHANGES_ATTR_DATA_TIME: () => TRACK_CHANGES_ATTR_DATA_TIME,
48
+ TRACK_CHANGES_ATTR_DATA_USERID: () => TRACK_CHANGES_ATTR_DATA_USERID,
49
+ TRACK_CHANGES_ATTR_DATA_USERNAME: () => TRACK_CHANGES_ATTR_DATA_USERNAME
50
+ });
21
51
  var TRACK_CHANGES_ATTR_DATA_USERNAME = "data-username";
22
52
  var TRACK_CHANGES_ATTR_DATA_USERID = "data-userid";
23
53
  var TRACK_CHANGES_ATTR_DATA_TIME = "data-time";
@@ -65,6 +95,19 @@ var B_SCHEMA = createSchema({
65
95
  allowedChildTagNames: ATOM_TAGS
66
96
  });
67
97
 
98
+ // src/schema/schema.types.ts
99
+ var schema_types_exports = {};
100
+ __export(schema_types_exports, {
101
+ ELEMENT_ROLE: () => ELEMENT_ROLE
102
+ });
103
+ var ELEMENT_ROLE = /* @__PURE__ */ ((ELEMENT_ROLE2) => {
104
+ ELEMENT_ROLE2["QUERYCOMMENTSWRAPPER"] = "QUERYCOMMENTSWRAPPER";
105
+ ELEMENT_ROLE2["HEADING"] = "HEADING";
106
+ ELEMENT_ROLE2["INS"] = "INS";
107
+ ELEMENT_ROLE2["DEL"] = "DEL";
108
+ return ELEMENT_ROLE2;
109
+ })(ELEMENT_ROLE || {});
110
+
68
111
  // src/schema/elementSchemas/atoms/commentQuerySection.ts
69
112
  var COMMENT_QUERY_SECTION_SCHEMA = createSchema({
70
113
  kind: "atom",
@@ -189,6 +232,16 @@ var ATOM_SCHEMAS = [
189
232
  INSERTION_SCHEMA,
190
233
  DELETION_SCHEMA
191
234
  ];
235
+ var atomSchemas = Object.fromEntries(
236
+ ATOM_SCHEMAS.map((schema) => [schema.tag, schema])
237
+ );
238
+
239
+ // src/schema/elementSchemas/elements/index.ts
240
+ var elements_exports = {};
241
+ __export(elements_exports, {
242
+ ELEMENT_SCHEMAS: () => ELEMENT_SCHEMAS,
243
+ elementSchemas: () => elementSchemas
244
+ });
192
245
 
193
246
  // src/schema/elementSchemas/inlineElements/inlineElementsTags.ts
194
247
  var COMMENT_TAG = "COMMENT";
@@ -244,6 +297,16 @@ var ELEMENT_SCHEMAS = [
244
297
  PARA_SCHEMA,
245
298
  TITLE_SCHEMA
246
299
  ];
300
+ var elementSchemas = Object.fromEntries(
301
+ ELEMENT_SCHEMAS.map((schema) => [schema.tag, schema])
302
+ );
303
+
304
+ // src/schema/elementSchemas/groupElements/index.ts
305
+ var groupElements_exports = {};
306
+ __export(groupElements_exports, {
307
+ GROUP_ELEMENT_SCHEMAS: () => GROUP_ELEMENT_SCHEMAS,
308
+ groupElementSchemas: () => groupElementSchemas
309
+ });
247
310
 
248
311
  // src/schema/elementSchemas/groupElements/groupElementsTags.ts
249
312
  var SECTION_TAG = "SECTION1";
@@ -268,6 +331,16 @@ var SECTION_SCHEMA = createSchema({
268
331
 
269
332
  // src/schema/elementSchemas/groupElements/index.ts
270
333
  var GROUP_ELEMENT_SCHEMAS = [SECTION_SCHEMA];
334
+ var groupElementSchemas = Object.fromEntries(
335
+ GROUP_ELEMENT_SCHEMAS.map((schema) => [schema.tag, schema])
336
+ );
337
+
338
+ // src/schema/elementSchemas/inlineElements/index.ts
339
+ var inlineElements_exports = {};
340
+ __export(inlineElements_exports, {
341
+ INLINE_ELEMENT_SCHEMAS: () => INLINE_ELEMENT_SCHEMAS,
342
+ inlineElementSchemas: () => inlineElementSchemas
343
+ });
271
344
 
272
345
  // src/schema/elementSchemas/inlineElements/comment.ts
273
346
  var COMMENT_SCHEMA = createSchema({
@@ -391,6 +464,9 @@ var INLINE_ELEMENT_SCHEMAS = [
391
464
  CONTENT_SCHEMA,
392
465
  REPLY_SCHEMA
393
466
  ];
467
+ var inlineElementSchemas = Object.fromEntries(
468
+ INLINE_ELEMENT_SCHEMAS.map((schema) => [schema.tag, schema])
469
+ );
394
470
 
395
471
  // src/schema/schemas.ts
396
472
  var SCHEMAS = [
@@ -399,8 +475,18 @@ var SCHEMAS = [
399
475
  ...GROUP_ELEMENT_SCHEMAS,
400
476
  ...INLINE_ELEMENT_SCHEMAS
401
477
  ];
478
+ var SCHEMA_MAP = new Map(
479
+ SCHEMAS.map((schema) => [schema.tag, schema])
480
+ );
481
+ var schemas = Object.fromEntries(
482
+ SCHEMAS.map((schema) => [schema.tag, schema])
483
+ );
402
484
 
403
485
  // src/schema/shared/ignoredAttributes.ts
486
+ var ignoredAttributes_exports = {};
487
+ __export(ignoredAttributes_exports, {
488
+ IGNORED_ATTRIBUTES: () => IGNORED_ATTRIBUTES
489
+ });
404
490
  var IGNORED_ATTRIBUTES = [
405
491
  // Styling & layout
406
492
  "class",
@@ -417,7 +503,22 @@ var IGNORED_ATTRIBUTES = [
417
503
  "hidden"
418
504
  ];
419
505
 
506
+ // src/schema/shared/utils.ts
507
+ var utils_exports = {};
508
+ __export(utils_exports, {
509
+ findAttributeDefinitionByName: () => findAttributeDefinitionByName,
510
+ findSchemaByTag: () => findSchemaByTag,
511
+ getAttributeName: () => getAttributeName,
512
+ isAttributeRestricted: () => isAttributeRestricted,
513
+ isIgnoredAttribute: () => isIgnoredAttribute,
514
+ isIgnoredElement: () => isIgnoredElement
515
+ });
516
+
420
517
  // src/schema/shared/ignoredElements.ts
518
+ var ignoredElements_exports = {};
519
+ __export(ignoredElements_exports, {
520
+ IGNORED_ELEMENT_SELECTORS: () => IGNORED_ELEMENT_SELECTORS
521
+ });
421
522
  var IGNORED_ELEMENT_SELECTORS = [
422
523
  "span.rhlabel",
423
524
  "span.abstractlabel",
@@ -429,14 +530,46 @@ var IGNORED_ELEMENT_SELECTORS = [
429
530
  // src/schema/shared/utils.ts
430
531
  var isIgnoredAttribute = (attribute) => IGNORED_ATTRIBUTES.includes(attribute);
431
532
  var isIgnoredElement = (element) => IGNORED_ELEMENT_SELECTORS.some((selector) => element.matches(selector));
432
- var findSchemaByTag = (element) => SCHEMAS.find((schema) => schema.tag === element.tagName.toLowerCase());
533
+ var findSchemaByTag = (element) => {
534
+ const isInsertion = element.classList.contains("ins");
535
+ const isDeletion = element.classList.contains("del");
536
+ const isQueryComment = element.classList.contains("cmtQurySection");
537
+ const isHeading = element.getAttribute("role")?.startsWith("H");
538
+ if (isHeading) {
539
+ return SCHEMA_MAP.get(element.tagName.toUpperCase() + "HEADING" /* HEADING */);
540
+ }
541
+ if (isInsertion) {
542
+ return SCHEMA_MAP.get(element.tagName.toUpperCase() + "INS" /* INS */);
543
+ }
544
+ if (isDeletion) {
545
+ return SCHEMA_MAP.get(element.tagName.toUpperCase() + "DEL" /* DEL */);
546
+ }
547
+ if (isQueryComment) {
548
+ return SCHEMA_MAP.get(
549
+ element.tagName.toUpperCase() + "QUERYCOMMENTSWRAPPER" /* QUERYCOMMENTSWRAPPER */
550
+ );
551
+ }
552
+ return SCHEMA_MAP.get(element.tagName.toUpperCase());
553
+ };
554
+ var isAttributeRestricted = (attr) => typeof attr !== "string";
555
+ var getAttributeName = (attribute) => typeof attribute === "string" ? attribute : attribute.name;
556
+ var findAttributeDefinitionByName = (definitions, name) => {
557
+ for (const def of definitions) {
558
+ if (getAttributeName(def) === name) {
559
+ return def;
560
+ }
561
+ }
562
+ return void 0;
563
+ };
433
564
  export {
434
- ID_ATTRS,
435
- IGNORED_ATTRIBUTES,
436
- IGNORED_ELEMENT_SELECTORS,
437
- TRACK_CHANGES_ATTRS,
438
- findSchemaByTag,
439
- isIgnoredAttribute,
440
- isIgnoredElement,
441
- SCHEMAS as schemas
565
+ globalAttributes_exports as GlobalAttributes,
566
+ ignoredAttributes_exports as IgnoredAttributes,
567
+ ignoredElements_exports as IgnoredElements,
568
+ schema_types_exports as SchemaTypes,
569
+ schemas_exports as Schemas,
570
+ atoms_exports as SchemasAtoms,
571
+ elements_exports as SchemasElements,
572
+ groupElements_exports as SchemasGroupElements,
573
+ inlineElements_exports as SchemasInlineElements,
574
+ utils_exports as Utils
442
575
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pro-editor-schema",
3
- "version": "0.0.1-alpha.1",
3
+ "version": "0.0.1-alpha.3",
4
4
  "description": "Pro Editor XML schemas",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",