@bigfootai/bigfoot-types 3.7.7 → 3.7.9

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/editor.js CHANGED
@@ -1,48 +1,94 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.bigfootSchema = void 0;
7
4
  const prosemirror_model_1 = require("prosemirror-model");
8
5
  const prosemirror_schema_basic_1 = require("prosemirror-schema-basic");
9
6
  const prosemirror_schema_list_1 = require("prosemirror-schema-list");
10
- const orderedmap_1 = __importDefault(require("orderedmap"));
11
- exports.bigfootSchema = new prosemirror_model_1.Schema({
12
- nodes: (0, prosemirror_schema_list_1.addListNodes)(prosemirror_schema_basic_1.schema.spec.nodes, 'paragraph block*', 'block'),
13
- marks: orderedmap_1.default.from(prosemirror_schema_basic_1.schema.spec.marks).addToEnd('tag', {
14
- attrs: {
15
- tagId: { default: null },
16
- tagType: { default: null },
17
- recommendationId: { default: null },
18
- ignore: { default: null },
7
+ const tag = {
8
+ attrs: {
9
+ tagId: { default: null },
10
+ tagType: { default: null },
11
+ recommendationId: { default: null },
12
+ ignore: { default: null },
13
+ },
14
+ inclusive: false,
15
+ parseDOM: [
16
+ {
17
+ tag: 'span[data-tag-id][data-tag-type][data-recommendation-id][data-ignore]',
18
+ getAttrs(dom) {
19
+ return {
20
+ tagId: dom.getAttribute('data-tag-id'),
21
+ tagType: dom.getAttribute('data-tag-type'),
22
+ recommendationId: dom.getAttribute('data-recommendation-id'),
23
+ ignore: dom.getAttribute('data-ignore'),
24
+ };
25
+ },
19
26
  },
20
- inclusive: false,
21
- parseDOM: [
27
+ ],
28
+ //@ts-expect-error Not sure why this is throwing an error, but will revisit
29
+ toDOM(node) {
30
+ const { tagId, tagType, recommendationId, ignore } = node.attrs;
31
+ return [
32
+ 'span',
22
33
  {
23
- tag: 'span[data-tag-id][data-tag-type][data-recommendation-id][data-ignore]',
24
- getAttrs(dom) {
25
- return {
26
- tagId: dom.getAttribute('data-tag-id'),
27
- tagType: dom.getAttribute('data-tag-type'),
28
- recommendationId: dom.getAttribute('data-recommendation-id'),
29
- ignore: dom.getAttribute('data-ignore'),
30
- };
31
- },
34
+ 'data-tag-id': tagId,
35
+ 'data-tag-type': tagType,
36
+ 'data-recommendation-id': recommendationId,
37
+ 'data-ignore': ignore,
38
+ },
39
+ 0,
40
+ ];
41
+ },
42
+ };
43
+ const checklist = {
44
+ content: 'checklistItem+',
45
+ group: 'block',
46
+ toDOM: () => ['ul', 0],
47
+ parseDOM: [{ tag: 'ul.checklist' }],
48
+ };
49
+ const checklistItem = {
50
+ content: 'text*',
51
+ attrs: { checked: { default: false } },
52
+ //@ts-expect-error Not sure why this is throwing an error, but will revisit
53
+ toDOM: (node) => [
54
+ 'li',
55
+ { 'data-checked': node?.attrs?.checked ? 'true' : 'false' },
56
+ [
57
+ 'input',
58
+ {
59
+ type: 'checkbox',
60
+ checked: node?.attrs?.checked ? 'checked' : '',
32
61
  },
33
62
  ],
34
- toDOM(node) {
35
- const { tagId, tagType, recommendationId, ignore } = node.attrs;
36
- return [
37
- 'span',
38
- {
39
- 'data-tag-id': tagId,
40
- 'data-tag-type': tagType,
41
- 'data-recommendation-id': recommendationId,
42
- 'data-ignore': ignore,
43
- },
44
- 0,
45
- ];
63
+ ['span', {}],
64
+ ],
65
+ parseDOM: [
66
+ {
67
+ tag: 'li[data-checked]',
68
+ getAttrs: (dom) => ({
69
+ checked: dom.getAttribute('data-checked') === 'true',
70
+ }),
71
+ },
72
+ ],
73
+ };
74
+ const strong = {
75
+ parseDOM: [
76
+ { tag: 'strong' },
77
+ {
78
+ tag: 'b',
79
+ getAttrs: (node) => node.style.fontWeight != 'normal' && null,
46
80
  },
47
- }),
81
+ ],
82
+ toDOM: () => ['strong', 0],
83
+ };
84
+ exports.bigfootSchema = new prosemirror_model_1.Schema({
85
+ nodes: (0, prosemirror_schema_list_1.addListNodes)(prosemirror_schema_basic_1.schema.spec.nodes, 'paragraph block*', 'block')
86
+ .addToEnd('checklist', checklist)
87
+ .addToEnd('checklistItem', checklistItem),
88
+ //@ts-expect-error Not sure why this is throwing an error, but will revisit
89
+ marks: {
90
+ ...prosemirror_schema_basic_1.schema.spec.marks,
91
+ tag,
92
+ strong,
93
+ },
48
94
  });
package/editor.ts CHANGED
@@ -1,49 +1,106 @@
1
- import { Schema } from 'prosemirror-model';
1
+ import { MarkSpec, NodeSpec, Schema } from 'prosemirror-model';
2
2
  import { schema } from 'prosemirror-schema-basic';
3
3
  import { addListNodes } from 'prosemirror-schema-list';
4
- import orderedMap from 'orderedmap';
5
4
 
6
- export const bigfootSchema = new Schema({
7
- nodes: addListNodes(schema.spec.nodes, 'paragraph block*', 'block'),
8
- marks: orderedMap.from(schema.spec.marks).addToEnd('tag', {
9
- attrs: {
10
- tagId: { default: null },
11
- tagType: { default: null },
12
- recommendationId: { default: null },
13
- ignore: { default: null },
5
+ const tag: MarkSpec = {
6
+ attrs: {
7
+ tagId: { default: null },
8
+ tagType: { default: null },
9
+ recommendationId: { default: null },
10
+ ignore: { default: null },
11
+ },
12
+ inclusive: false,
13
+ parseDOM: [
14
+ {
15
+ tag: 'span[data-tag-id][data-tag-type][data-recommendation-id][data-ignore]',
16
+ getAttrs(dom: string | HTMLElement) {
17
+ return {
18
+ tagId: (dom as HTMLElement).getAttribute('data-tag-id'),
19
+ tagType: (dom as HTMLElement).getAttribute('data-tag-type'),
20
+ recommendationId: (dom as HTMLElement).getAttribute(
21
+ 'data-recommendation-id'
22
+ ),
23
+ ignore: (dom as HTMLElement).getAttribute('data-ignore'),
24
+ };
25
+ },
14
26
  },
15
- inclusive: false,
16
- parseDOM: [
27
+ ],
28
+ //@ts-expect-error Not sure why this is throwing an error, but will revisit
29
+ toDOM(node: {
30
+ attrs: {
31
+ tagId: string;
32
+ tagType: string;
33
+ recommendationId: string;
34
+ ignore: string;
35
+ };
36
+ }) {
37
+ const { tagId, tagType, recommendationId, ignore } = node.attrs;
38
+ return [
39
+ 'span',
40
+ {
41
+ 'data-tag-id': tagId,
42
+ 'data-tag-type': tagType,
43
+ 'data-recommendation-id': recommendationId,
44
+ 'data-ignore': ignore,
45
+ },
46
+ 0,
47
+ ];
48
+ },
49
+ };
50
+
51
+ const checklist: NodeSpec = {
52
+ content: 'checklistItem+',
53
+ group: 'block',
54
+ toDOM: () => ['ul', 0],
55
+ parseDOM: [{ tag: 'ul.checklist' }],
56
+ };
57
+
58
+ const checklistItem: NodeSpec = {
59
+ content: 'text*',
60
+ attrs: { checked: { default: false } },
61
+ //@ts-expect-error Not sure why this is throwing an error, but will revisit
62
+ toDOM: (node: NodeSpec) => [
63
+ 'li',
64
+ { 'data-checked': node?.attrs?.checked ? 'true' : 'false' },
65
+ [
66
+ 'input',
17
67
  {
18
- tag: 'span[data-tag-id][data-tag-type][data-recommendation-id][data-ignore]',
19
- getAttrs(dom) {
20
- return {
21
- tagId: (dom as HTMLElement).getAttribute('data-tag-id'),
22
- tagType: (dom as HTMLElement).getAttribute(
23
- 'data-tag-type'
24
- ),
25
- recommendationId: (dom as HTMLElement).getAttribute(
26
- 'data-recommendation-id'
27
- ),
28
- ignore: (dom as HTMLElement).getAttribute(
29
- 'data-ignore'
30
- ),
31
- };
32
- },
68
+ type: 'checkbox',
69
+ checked: node?.attrs?.checked ? 'checked' : '',
33
70
  },
34
71
  ],
35
- toDOM(node) {
36
- const { tagId, tagType, recommendationId, ignore } = node.attrs;
37
- return [
38
- 'span',
39
- {
40
- 'data-tag-id': tagId,
41
- 'data-tag-type': tagType,
42
- 'data-recommendation-id': recommendationId,
43
- 'data-ignore': ignore,
44
- },
45
- 0,
46
- ];
72
+ ['span', {}],
73
+ ],
74
+ parseDOM: [
75
+ {
76
+ tag: 'li[data-checked]',
77
+ getAttrs: (dom: HTMLElement) => ({
78
+ checked: dom.getAttribute('data-checked') === 'true',
79
+ }),
80
+ },
81
+ ],
82
+ };
83
+
84
+ const strong: MarkSpec = {
85
+ parseDOM: [
86
+ { tag: 'strong' },
87
+ {
88
+ tag: 'b',
89
+ getAttrs: (node: HTMLElement) =>
90
+ node.style.fontWeight != 'normal' && null,
47
91
  },
48
- }),
92
+ ],
93
+ toDOM: () => ['strong', 0],
94
+ };
95
+
96
+ export const bigfootSchema = new Schema({
97
+ nodes: addListNodes(schema.spec.nodes, 'paragraph block*', 'block')
98
+ .addToEnd('checklist', checklist)
99
+ .addToEnd('checklistItem', checklistItem),
100
+ //@ts-expect-error Not sure why this is throwing an error, but will revisit
101
+ marks: {
102
+ ...schema.spec.marks,
103
+ tag,
104
+ strong,
105
+ },
49
106
  });
package/model.js CHANGED
@@ -509,11 +509,13 @@ type Article {${exports.PrimitiveFields}
509
509
  recommendations: [TagRecommendation]
510
510
  relations: [RelationEntry]
511
511
  archived: Boolean!
512
+ favorite: Boolean!
512
513
  }`;
513
514
  class Article extends Primitive {
514
515
  constructor(referenceBlock) {
515
516
  super();
516
517
  this.archived = false;
518
+ this.favorite = false;
517
519
  this.referenceBlock = referenceBlock;
518
520
  }
519
521
  }
package/model.ts CHANGED
@@ -759,6 +759,7 @@ type Article {${PrimitiveFields}
759
759
  recommendations: [TagRecommendation]
760
760
  relations: [RelationEntry]
761
761
  archived: Boolean!
762
+ favorite: Boolean!
762
763
  }`;
763
764
  export class Article extends Primitive {
764
765
  referenceBlock: ReferenceBlock;
@@ -772,6 +773,7 @@ export class Article extends Primitive {
772
773
  recommendations?: TagRecommendation[];
773
774
  relations?: RelationEntry[];
774
775
  archived: boolean;
776
+ favorite: boolean;
775
777
  _changes?: Changes;
776
778
  _tasks?: Task[];
777
779
  _entitiesPerson?: EntityEntry[];
@@ -783,6 +785,7 @@ export class Article extends Primitive {
783
785
  super();
784
786
 
785
787
  this.archived = false;
788
+ this.favorite = false;
786
789
 
787
790
  this.referenceBlock = referenceBlock;
788
791
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Bigfoot",
3
3
  "name": "@bigfootai/bigfoot-types",
4
- "version": "3.7.7",
4
+ "version": "3.7.9",
5
5
  "description": "The internal library for the types used in the Bigfoot platform",
6
6
  "main": "model.js",
7
7
  "license": "ISC",