@clevertask/scribe 0.1.26 → 0.1.28

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.
Files changed (37) hide show
  1. package/README.md +9 -1
  2. package/dist/components/Menu/TableBubbleMenu.d.ts.map +1 -1
  3. package/dist/components/Menu/TableBubbleMenu.js +174 -134
  4. package/dist/components/Menu/TableHeightSettings.d.ts +11 -0
  5. package/dist/components/Menu/TableHeightSettings.d.ts.map +1 -0
  6. package/dist/components/Menu/TableHeightSettings.js +156 -0
  7. package/dist/components/Menu/TableLayoutOptions.d.ts +24 -0
  8. package/dist/components/Menu/TableLayoutOptions.d.ts.map +1 -0
  9. package/dist/components/Menu/TableLayoutOptions.js +126 -0
  10. package/dist/components/Scribe/extension/index.js +1 -1
  11. package/dist/components/Scribe/extension/resizable-table.d.ts +13 -1
  12. package/dist/components/Scribe/extension/resizable-table.d.ts.map +1 -1
  13. package/dist/components/Scribe/extension/resizable-table.js +165 -2
  14. package/dist/components/Scribe/extension/slashCommand/items.js +1 -1
  15. package/dist/components/Scribe/extension/table-layout.d.ts +31 -0
  16. package/dist/components/Scribe/extension/table-layout.d.ts.map +1 -0
  17. package/dist/components/Scribe/extension/table-layout.js +2 -0
  18. package/dist/components/Scribe/extension/table-sticky-header.d.ts +7 -0
  19. package/dist/components/Scribe/extension/table-sticky-header.d.ts.map +1 -0
  20. package/dist/components/Scribe/extension/table-sticky-header.js +106 -0
  21. package/dist/components/Scribe/index.js +2 -2
  22. package/dist/document-node-capabilities.d.ts.map +1 -1
  23. package/dist/document-node-capabilities.js +80 -68
  24. package/dist/{extension-BFPlsViw.js → extension-BU2USLV1.js} +1 -1
  25. package/dist/{html-to-markdown-BpR-7GtJ.js → html-to-markdown-DF93it73.js} +1 -1
  26. package/dist/main.css +47 -0
  27. package/dist/main.d.ts +1 -0
  28. package/dist/main.d.ts.map +1 -1
  29. package/dist/main.js +1 -1
  30. package/dist/{schema-extensions-BryyErmk.js → schema-extensions-DyCk1Goa.js} +10 -9
  31. package/dist/schema-extensions.js +1 -1
  32. package/dist/schema.js +1 -1
  33. package/dist/{resizable-table-JZOaj_L3.js → table-layout-BoDS50DR.js} +140 -110
  34. package/dist/utils/html-to-markdown.d.ts.map +1 -1
  35. package/dist/utils/html-to-markdown.js +1 -1
  36. package/dist/utils/index.js +2 -2
  37. package/package.json +1 -1
@@ -0,0 +1,106 @@
1
+ import { Plugin as e } from "@tiptap/pm/state";
2
+ //#region lib/components/Scribe/extension/table-sticky-header.ts
3
+ var t = ".tableWrapper[data-table-sticky-header-active=\"true\"]", n = "--scribe-table-sticky-header-top", r = /^(auto|scroll|overlay)$/, i = (e) => {
4
+ if (e.parentElement) return e.parentElement;
5
+ let t = e.getRootNode();
6
+ return "host" in t ? t.host : null;
7
+ }, a = (e) => e.querySelector(":scope > table")?.rows[0]?.cells, o = (e) => Math.max(0, ...Array.from(a(e) ?? [], (e) => e.getBoundingClientRect().height)), s = (e) => {
8
+ let t = e.ownerDocument.defaultView;
9
+ if (!t) return null;
10
+ for (let n = i(e); n && n !== e.ownerDocument.body && n !== e.ownerDocument.documentElement; n = i(n)) if (r.test(t.getComputedStyle(n).overflowY) && n.scrollHeight > n.clientHeight + 1) return n;
11
+ return null;
12
+ }, c = (e, t) => {
13
+ let n = e.ownerDocument.defaultView, r = n.visualViewport?.offsetTop ?? 0, i = r + (n.visualViewport?.height ?? n.innerHeight);
14
+ if (!t) return {
15
+ top: r,
16
+ bottom: i
17
+ };
18
+ let a = t.getBoundingClientRect(), o = t.offsetHeight > 0 ? a.height / t.offsetHeight : 1, s = a.top + t.clientTop * o;
19
+ return {
20
+ top: Math.max(r, s),
21
+ bottom: Math.min(i, s + t.clientHeight * o)
22
+ };
23
+ }, l = (e) => {
24
+ let t = e.ownerDocument.defaultView?.getComputedStyle(e).scrollMarginTop;
25
+ return Math.max(0, Number.parseFloat(t ?? "") || 0);
26
+ }, u = (e) => {
27
+ if (e.getAttribute("data-table-limit-height") === "true") {
28
+ e.style.removeProperty(n);
29
+ return;
30
+ }
31
+ let t = e.querySelector(":scope > table");
32
+ if (!t) return;
33
+ let r = e.getBoundingClientRect(), i = c(e, s(e)), a = Math.max(0, t.getBoundingClientRect().bottom - r.top - o(e)), u = Math.max(0, Math.min(i.top + l(e) - r.top, a)), d = e.offsetHeight > 0 ? r.height / e.offsetHeight : 1, f = String(u / (d || 1)) + "px";
34
+ e.style.getPropertyValue(n) !== f && e.style.setProperty(n, f);
35
+ }, d = (e) => {
36
+ let { $head: n } = e.state.selection, r;
37
+ if (["cell", "header_cell"].includes(n.nodeAfter?.type.spec.tableRole ?? "")) r = n.pos;
38
+ else for (let e = n.depth; e > 0; e--) if (["cell", "header_cell"].includes(n.node(e).type.spec.tableRole ?? "")) {
39
+ r = n.before(e);
40
+ break;
41
+ }
42
+ if (r === void 0) return !1;
43
+ let i = e.nodeDOM(r), a = i?.nodeType === 1 ? i : null, d = a?.closest(t), f = a?.closest("table"), p = f?.rows[0];
44
+ if (!d || !p || f?.parentElement !== d) return !1;
45
+ let m = d.getAttribute("data-table-limit-height") === "true", h = m ? d : s(d), g = c(d, h), _ = o(d);
46
+ if (_ <= 0 || g.bottom <= g.top) return !1;
47
+ let v = g.top + (m ? 0 : l(d)) + (p.contains(a) ? 0 : _) + 5, y = e.coordsAtPos(n.pos), b = 0;
48
+ if (y.top < v ? b = y.top - v : y.bottom > g.bottom - 5 && (b = y.bottom - g.bottom + 5), b) {
49
+ if (h) {
50
+ let e = h.getBoundingClientRect(), t = h.offsetHeight > 0 ? e.height / h.offsetHeight : 1;
51
+ h.scrollTop += b / (t || 1);
52
+ } else d.ownerDocument.defaultView?.scrollBy(0, b);
53
+ u(d);
54
+ }
55
+ if (p.contains(a)) {
56
+ let t = d.getBoundingClientRect(), r = d.offsetWidth > 0 ? t.width / d.offsetWidth : 1, i = t.left + d.clientLeft * r + 5, a = t.left + (d.clientLeft + d.clientWidth) * r - 5, o = e.coordsAtPos(n.pos);
57
+ o.left < i ? d.scrollLeft += (o.left - i) / (r || 1) : o.right > a && (d.scrollLeft += (o.right - a) / (r || 1));
58
+ }
59
+ return !1;
60
+ }, f = () => new e({
61
+ props: { handleScrollToSelection: d },
62
+ view(e) {
63
+ let r = e.dom.ownerDocument.defaultView;
64
+ if (!r) return {};
65
+ let o = null, s = !1, c = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), d = r.ResizeObserver ? new r.ResizeObserver(f) : null;
66
+ function f() {
67
+ s || o !== null || c.size === 0 || (o = r.requestAnimationFrame(() => {
68
+ o = null, p();
69
+ }));
70
+ }
71
+ function p() {
72
+ let r = new Set(e.dom.querySelectorAll(t));
73
+ for (let e of c) r.has(e) || e.style.removeProperty(n);
74
+ c = r;
75
+ let o = /* @__PURE__ */ new Set();
76
+ if (c.size) {
77
+ for (let t = e.dom; t; t = i(t)) o.add(t);
78
+ for (let e of c) {
79
+ o.add(e);
80
+ for (let t of a(e) ?? []) o.add(t);
81
+ u(e);
82
+ }
83
+ }
84
+ for (let e of l) o.has(e) || (d?.unobserve(e), l.delete(e));
85
+ for (let e of o) l.has(e) || (d?.observe(e), l.add(e));
86
+ }
87
+ let m = /* @__PURE__ */ new Set([e.dom.ownerDocument, e.root]);
88
+ for (let e of m) e.addEventListener("scroll", f, {
89
+ capture: !0,
90
+ passive: !0
91
+ });
92
+ return r.addEventListener("scroll", f, { passive: !0 }), r.addEventListener("resize", f, { passive: !0 }), r.visualViewport?.addEventListener("resize", f), r.visualViewport?.addEventListener("scroll", f), p(), {
93
+ update() {
94
+ s || p();
95
+ },
96
+ destroy() {
97
+ s = !0, o !== null && r.cancelAnimationFrame(o), d?.disconnect();
98
+ for (let e of m) e.removeEventListener("scroll", f, !0);
99
+ r.removeEventListener("scroll", f), r.removeEventListener("resize", f), r.visualViewport?.removeEventListener("resize", f), r.visualViewport?.removeEventListener("scroll", f);
100
+ for (let e of c) e.style.removeProperty(n);
101
+ }
102
+ };
103
+ }
104
+ });
105
+ //#endregion
106
+ export { f as createStickyTableHeaderPlugin, d as scrollSelectionBelowStickyHeader };
@@ -3,8 +3,8 @@ import { o as n, t as r } from "../../dist-BiognBi4.js";
3
3
  import i from "../Menu/CalloutBubbleMenu.js";
4
4
  import a from "../Menu/LinkBubbleMenu.js";
5
5
  import o from "../Menu/TableBubbleMenu.js";
6
- import { t as s } from "../../html-to-markdown-BpR-7GtJ.js";
7
- import { t as c } from "../../extension-BFPlsViw.js";
6
+ import { t as s } from "../../html-to-markdown-DF93it73.js";
7
+ import { t as c } from "../../extension-BU2USLV1.js";
8
8
  import { SuggestionItemType as l } from "./extension/slashCommand/items.js";
9
9
  import "./extension/tableOfContents.js";
10
10
  import "../../utils/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"document-node-capabilities.d.ts","sourceRoot":"","sources":["../lib/document-node-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAI/C,eAAO,MAAM,qCAAqC,YAChD,UAAU,EACV,MAAM,EACN,YAAY,EACZ,SAAS,EACT,WAAW,EACX,MAAM,EACN,WAAW,EACX,OAAO,EACP,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,WAAW,CACH,CAAC;AAEX,MAAM,MAAM,gCAAgC,GAC1C,CAAC,OAAO,qCAAqC,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,eAAO,MAAM,kCAAkC,YAC7C,MAAM,EACN,QAAQ,EACR,OAAO,EACP,YAAY,CACJ,CAAC;AAEX,MAAM,MAAM,6BAA6B,GAAG,CAAC,OAAO,kCAAkC,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhG,MAAM,MAAM,gCAAgC,GACxC;IACE,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,QAAQ,GAAG,cAAc,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC5E,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B,GACD;IACE,QAAQ,CAAC,IAAI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AgC,CAAC,CAAC,CAAC;IAChF,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;QACnC,QAAQ,CAAC,IAAI,EAAE,6BAA6B,CAAC;KAC9C,CAAC;IACF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,mBAAmB,EAAE,SAAS,oCAAoC,EAAE,CAAC;IAC9E,QAAQ,CAAC,IAAI,EAAE,gCAAgC,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG,QAAQ,CACzD,MAAM,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAC7C,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAC7C,KAAK,CAAC,UAAU,SAAS,4BAA4B,cAEzC,UAAU,KACrB,UAAwB,CAAC;AA0X5B;;;;;GAKG;AACH,eAAO,MAAM,0CAA0C,WAC7C,MAAM,2BACU,SAAS,4BAA4B,EAAE,KAC9D,oCAuCF,CAAC"}
@@ -1,7 +1,8 @@
1
- import { CALLOUT_VARIANTS as e } from "./components/Scribe/extension/callout.js";
2
- import { EXTERNAL_LINK_PREVIEW_DISPLAYS as t } from "./components/Scribe/extension/external-link-preview/types.js";
1
+ import { i as e } from "./table-layout-BoDS50DR.js";
2
+ import { CALLOUT_VARIANTS as t } from "./components/Scribe/extension/callout.js";
3
+ import { EXTERNAL_LINK_PREVIEW_DISPLAYS as n } from "./components/Scribe/extension/external-link-preview/types.js";
3
4
  //#region lib/document-node-capabilities.ts
4
- var n = [
5
+ var r = [
5
6
  "document",
6
7
  "text",
7
8
  "text_block",
@@ -15,36 +16,36 @@ var n = [
15
16
  "inline_atom",
16
17
  "block_atom",
17
18
  "separator"
18
- ], r = [
19
+ ], i = [
19
20
  "none",
20
21
  "inline",
21
22
  "block",
22
23
  "structured"
23
- ], i = (e) => e, a = {}, o = [], s = [
24
- i({
25
- attributes: a,
24
+ ], a = (e) => e, o = {}, s = [], c = [
25
+ a({
26
+ attributes: o,
26
27
  content: {
27
28
  expression: "block+",
28
29
  kind: "block"
29
30
  },
30
31
  label: "Document",
31
32
  nodeType: "doc",
32
- potentialOperations: o,
33
+ potentialOperations: s,
33
34
  role: "document"
34
35
  }),
35
- i({
36
- attributes: a,
36
+ a({
37
+ attributes: o,
37
38
  content: {
38
39
  expression: null,
39
40
  kind: "none"
40
41
  },
41
42
  label: "Text",
42
43
  nodeType: "text",
43
- potentialOperations: o,
44
+ potentialOperations: s,
44
45
  role: "text"
45
46
  }),
46
- i({
47
- attributes: a,
47
+ a({
48
+ attributes: o,
48
49
  content: {
49
50
  expression: "inline*",
50
51
  kind: "inline"
@@ -54,7 +55,7 @@ var n = [
54
55
  potentialOperations: [{ type: "replace_content" }],
55
56
  role: "text_block"
56
57
  }),
57
- i({
58
+ a({
58
59
  attributes: { level: {
59
60
  kind: "enum",
60
61
  values: [
@@ -72,21 +73,21 @@ var n = [
72
73
  },
73
74
  label: "Heading",
74
75
  nodeType: "heading",
75
- potentialOperations: o,
76
+ potentialOperations: s,
76
77
  role: "heading"
77
78
  }),
78
- i({
79
- attributes: a,
79
+ a({
80
+ attributes: o,
80
81
  content: {
81
82
  expression: "block+",
82
83
  kind: "block"
83
84
  },
84
85
  label: "Block quote",
85
86
  nodeType: "blockquote",
86
- potentialOperations: o,
87
+ potentialOperations: s,
87
88
  role: "container"
88
89
  }),
89
- i({
90
+ a({
90
91
  attributes: { language: {
91
92
  kind: "string",
92
93
  nullable: !0
@@ -97,43 +98,43 @@ var n = [
97
98
  },
98
99
  label: "Code block",
99
100
  nodeType: "codeBlock",
100
- potentialOperations: o,
101
+ potentialOperations: s,
101
102
  role: "text_block"
102
103
  }),
103
- i({
104
- attributes: a,
104
+ a({
105
+ attributes: o,
105
106
  content: {
106
107
  expression: null,
107
108
  kind: "none"
108
109
  },
109
110
  label: "Hard break",
110
111
  nodeType: "hardBreak",
111
- potentialOperations: o,
112
+ potentialOperations: s,
112
113
  role: "inline_atom"
113
114
  }),
114
- i({
115
- attributes: a,
115
+ a({
116
+ attributes: o,
116
117
  content: {
117
118
  expression: null,
118
119
  kind: "none"
119
120
  },
120
121
  label: "Horizontal rule",
121
122
  nodeType: "horizontalRule",
122
- potentialOperations: o,
123
+ potentialOperations: s,
123
124
  role: "separator"
124
125
  }),
125
- i({
126
- attributes: a,
126
+ a({
127
+ attributes: o,
127
128
  content: {
128
129
  expression: "listItem+",
129
130
  kind: "structured"
130
131
  },
131
132
  label: "Bullet list",
132
133
  nodeType: "bulletList",
133
- potentialOperations: o,
134
+ potentialOperations: s,
134
135
  role: "list"
135
136
  }),
136
- i({
137
+ a({
137
138
  attributes: {
138
139
  start: { kind: "number" },
139
140
  type: {
@@ -147,32 +148,32 @@ var n = [
147
148
  },
148
149
  label: "Ordered list",
149
150
  nodeType: "orderedList",
150
- potentialOperations: o,
151
+ potentialOperations: s,
151
152
  role: "list"
152
153
  }),
153
- i({
154
- attributes: a,
154
+ a({
155
+ attributes: o,
155
156
  content: {
156
157
  expression: "paragraph block*",
157
158
  kind: "structured"
158
159
  },
159
160
  label: "List item",
160
161
  nodeType: "listItem",
161
- potentialOperations: o,
162
+ potentialOperations: s,
162
163
  role: "list_item"
163
164
  }),
164
- i({
165
- attributes: a,
165
+ a({
166
+ attributes: o,
166
167
  content: {
167
168
  expression: "taskItem+",
168
169
  kind: "structured"
169
170
  },
170
171
  label: "Task list",
171
172
  nodeType: "taskList",
172
- potentialOperations: o,
173
+ potentialOperations: s,
173
174
  role: "list"
174
175
  }),
175
- i({
176
+ a({
176
177
  attributes: { checked: { kind: "boolean" } },
177
178
  content: {
178
179
  expression: "paragraph block*",
@@ -186,10 +187,10 @@ var n = [
186
187
  }],
187
188
  role: "list_item"
188
189
  }),
189
- i({
190
+ a({
190
191
  attributes: { variant: {
191
192
  kind: "enum",
192
- values: e
193
+ values: t
193
194
  } },
194
195
  content: {
195
196
  expression: "block+",
@@ -203,29 +204,40 @@ var n = [
203
204
  }],
204
205
  role: "container"
205
206
  }),
206
- i({
207
- attributes: a,
207
+ a({
208
+ attributes: {
209
+ tableLayout: {
210
+ kind: "enum",
211
+ values: e
212
+ },
213
+ limitHeight: { kind: "boolean" },
214
+ maxHeight: {
215
+ kind: "number",
216
+ nullable: !0
217
+ },
218
+ stickyHeaderRow: { kind: "boolean" }
219
+ },
208
220
  content: {
209
221
  expression: "tableRow+",
210
222
  kind: "structured"
211
223
  },
212
224
  label: "Table",
213
225
  nodeType: "table",
214
- potentialOperations: o,
226
+ potentialOperations: s,
215
227
  role: "table"
216
228
  }),
217
- i({
218
- attributes: a,
229
+ a({
230
+ attributes: o,
219
231
  content: {
220
232
  expression: "(tableCell | tableHeader)*",
221
233
  kind: "structured"
222
234
  },
223
235
  label: "Table row",
224
236
  nodeType: "tableRow",
225
- potentialOperations: o,
237
+ potentialOperations: s,
226
238
  role: "table_row"
227
239
  }),
228
- ...["tableCell", "tableHeader"].map((e) => i({
240
+ ...["tableCell", "tableHeader"].map((e) => a({
229
241
  attributes: {
230
242
  align: {
231
243
  kind: "enum",
@@ -249,10 +261,10 @@ var n = [
249
261
  },
250
262
  label: e === "tableCell" ? "Table cell" : "Table header",
251
263
  nodeType: e,
252
- potentialOperations: o,
264
+ potentialOperations: s,
253
265
  role: "table_cell"
254
266
  })),
255
- i({
267
+ a({
256
268
  attributes: {
257
269
  alt: {
258
270
  kind: "string",
@@ -281,10 +293,10 @@ var n = [
281
293
  },
282
294
  label: "Image",
283
295
  nodeType: "image",
284
- potentialOperations: o,
296
+ potentialOperations: s,
285
297
  role: "inline_atom"
286
298
  }),
287
- i({
299
+ a({
288
300
  attributes: { name: {
289
301
  kind: "string",
290
302
  nullable: !0
@@ -295,10 +307,10 @@ var n = [
295
307
  },
296
308
  label: "Emoji",
297
309
  nodeType: "emoji",
298
- potentialOperations: o,
310
+ potentialOperations: s,
299
311
  role: "inline_atom"
300
312
  }),
301
- ...["inlineMath", "blockMath"].map((e) => i({
313
+ ...["inlineMath", "blockMath"].map((e) => a({
302
314
  attributes: { latex: { kind: "string" } },
303
315
  content: {
304
316
  expression: null,
@@ -306,10 +318,10 @@ var n = [
306
318
  },
307
319
  label: e === "inlineMath" ? "Inline math" : "Block math",
308
320
  nodeType: e,
309
- potentialOperations: o,
321
+ potentialOperations: s,
310
322
  role: e === "inlineMath" ? "inline_atom" : "block_atom"
311
323
  })),
312
- i({
324
+ a({
313
325
  attributes: {
314
326
  description: {
315
327
  kind: "string",
@@ -317,7 +329,7 @@ var n = [
317
329
  },
318
330
  display: {
319
331
  kind: "enum",
320
- values: t
332
+ values: n
321
333
  },
322
334
  faviconUrl: {
323
335
  kind: "string",
@@ -348,23 +360,23 @@ var n = [
348
360
  },
349
361
  label: "External link preview",
350
362
  nodeType: "externalLinkPreview",
351
- potentialOperations: o,
363
+ potentialOperations: s,
352
364
  role: "inline_atom"
353
365
  })
354
- ], c = (e, t, n, r) => {
366
+ ], l = (e, t, n, r) => {
355
367
  let i = [...t].sort(), a = [...n].sort();
356
368
  if (i.length !== a.length || i.some((e, t) => e !== a[t])) throw Error(`Document node capability ${r} ${e} drifted from the Scribe schema: expected [${a.join(", ")}], received [${i.join(", ")}].`);
357
- }, l = (e, t, n) => {
369
+ }, u = (e, t, n) => {
358
370
  if (n.kind === "enum" && (n.values.length === 0 || new Set(n.values).size !== n.values.length)) throw Error(`Document node capability ${e}.${t} requires unique enum values.`);
359
- }, u = (e) => e.isLeaf ? "none" : e.inlineContent ? "inline" : e.spec.content === "block+" || e.spec.content === "block*" ? "block" : "structured", d = (e, t) => {
371
+ }, d = (e) => e.isLeaf ? "none" : e.inlineContent ? "inline" : e.spec.content === "block+" || e.spec.content === "block*" ? "block" : "structured", f = (e, t) => {
360
372
  let n = e.nodes[t.nodeType];
361
373
  if (!n) throw Error(`Document node capability ${t.nodeType} does not exist in the Scribe schema.`);
362
374
  let r = n.spec.content ?? null;
363
375
  if (r !== t.content.expression) throw Error(`Document node capability ${t.nodeType} content drifted from the Scribe schema: expected ${String(r)}, received ${String(t.content.expression)}.`);
364
- let i = u(n);
376
+ let i = d(n);
365
377
  if (i !== t.content.kind) throw Error(`Document node capability ${t.nodeType} content kind drifted from the Scribe schema: expected ${i}, received ${t.content.kind}.`);
366
378
  let a = Object.keys(t.attributes);
367
- c("attributes", a, Object.keys(n.spec.attrs ?? {}), t.nodeType), a.forEach((e) => l(t.nodeType, e, t.attributes[e]));
379
+ l("attributes", a, Object.keys(n.spec.attrs ?? {}), t.nodeType), a.forEach((e) => u(t.nodeType, e, t.attributes[e]));
368
380
  let o = t.potentialOperations.map((e) => e.type);
369
381
  if (new Set(o).size !== o.length) throw Error(`Document node capability ${t.nodeType} repeats a potential operation.`);
370
382
  t.potentialOperations.forEach((e) => {
@@ -377,7 +389,7 @@ var n = [
377
389
  });
378
390
  }
379
391
  });
380
- }, f = (e) => {
392
+ }, p = (e) => {
381
393
  let t = Object.freeze(Object.fromEntries(Object.entries(e.attributes).map(([e, t]) => [e, Object.freeze(t.kind === "enum" ? {
382
394
  ...t,
383
395
  values: Object.freeze([...t.values])
@@ -393,17 +405,17 @@ var n = [
393
405
  potentialOperations: n,
394
406
  role: e.role
395
407
  });
396
- }, p = (e, t = []) => {
408
+ }, m = (e, t = []) => {
397
409
  let n = /* @__PURE__ */ new Map(), r = t.map((e) => e.nodeType).filter((t) => !e.nodes[t]);
398
410
  if (r.length > 0) throw Error(`Document node capabilities do not exist in the Scribe schema: ${r.join(", ")}.`);
399
- for (let e of [...s, ...t]) {
411
+ for (let e of [...c, ...t]) {
400
412
  if (n.has(e.nodeType)) throw Error(`Document node capability ${e.nodeType} is declared more than once.`);
401
413
  n.set(e.nodeType, e);
402
414
  }
403
415
  let i = Object.keys(e.nodes), a = i.map((e) => n.get(e)), o = i.filter((e, t) => !a[t]);
404
416
  if (o.length > 0) throw Error(`Document node capabilities are missing for schema nodes: ${o.join(", ")}.`);
405
- let c = a.map((t) => (d(e, t), [t.nodeType, f(t)]));
406
- return Object.freeze(Object.fromEntries(c));
417
+ let s = a.map((t) => (f(e, t), [t.nodeType, p(t)]));
418
+ return Object.freeze(Object.fromEntries(s));
407
419
  };
408
420
  //#endregion
409
- export { n as SCRIBE_DOCUMENT_NODE_CAPABILITY_ROLES, r as SCRIBE_DOCUMENT_NODE_CONTENT_KINDS, p as createScribeDocumentNodeCapabilityManifest, i as defineScribeDocumentNodeCapability };
421
+ export { r as SCRIBE_DOCUMENT_NODE_CAPABILITY_ROLES, i as SCRIBE_DOCUMENT_NODE_CONTENT_KINDS, m as createScribeDocumentNodeCapabilityManifest, a as defineScribeDocumentNodeCapability };
@@ -1,4 +1,4 @@
1
- import { n as e, r as t, t as n } from "./schema-extensions-BryyErmk.js";
1
+ import { n as e, r as t, t as n } from "./schema-extensions-DyCk1Goa.js";
2
2
  import r from "./components/Scribe/extension/extension-markdown-paste.js";
3
3
  import { SlashCommand as i } from "./components/Scribe/extension/slashCommand/index.js";
4
4
  import a from "./components/Scribe/extension/extension-selectedText.js";
@@ -504,7 +504,7 @@ var G = "scribe-table-break", K = /* @__PURE__ */ new Set([
504
504
  if (!r) return null;
505
505
  if (r === "left" || r === "center" || r === "right") return r;
506
506
  }, ue = (e) => {
507
- if (e.caption || e.tFoot || ce(e)) return null;
507
+ if (e.caption || e.tFoot || ce(e) || ["fit", "scroll"].includes(e.getAttribute("data-table-layout") ?? "") || e.getAttribute("data-table-limit-height") === "true" || e.hasAttribute("data-table-max-height") || e.getAttribute("data-table-sticky-header-row") === "true") return null;
508
508
  let t = Array.from(e.rows), n = t[0]?.cells.length ?? 0;
509
509
  if (t.length === 0 || n === 0) return null;
510
510
  let r = t.map((e) => Array.from(e.cells));
package/dist/main.css CHANGED
@@ -395,6 +395,7 @@
395
395
  }
396
396
 
397
397
  .scribe-content .tiptap .tableWrapper {
398
+ --scribe-table-custom-max-height: initial;
398
399
  margin: 0 0 1rem;
399
400
  max-width: 100%;
400
401
  overflow-x: auto;
@@ -405,6 +406,52 @@
405
406
  min-width: 100%;
406
407
  }
407
408
 
409
+ .scribe-content .tiptap .tableWrapper[data-table-layout="scroll"] > table {
410
+ min-width: 0;
411
+ width: auto;
412
+ }
413
+
414
+ .scribe-content .tiptap .tableWrapper[data-table-layout="fit"] > table {
415
+ max-width: 100%;
416
+ min-width: 0 !important;
417
+ width: 100% !important;
418
+ }
419
+
420
+ .scribe-content .tiptap .tableWrapper[data-table-layout="fit"] > table > colgroup > col {
421
+ min-width: 0 !important;
422
+ width: auto !important;
423
+ }
424
+
425
+ .scribe-content .tiptap .tableWrapper[data-table-layout="fit"] > table > tbody > tr > th,
426
+ .scribe-content .tiptap .tableWrapper[data-table-layout="fit"] > table > tbody > tr > td {
427
+ min-width: 0;
428
+ overflow-wrap: anywhere;
429
+ }
430
+
431
+ .scribe-content .tiptap .tableWrapper[data-table-limit-height="true"] {
432
+ max-height: var(--scribe-table-custom-max-height, var(--scribe-table-max-height, 360px));
433
+ overflow-y: auto;
434
+ }
435
+
436
+ .scribe-content .tiptap .tableWrapper[data-table-sticky-header-active="true"] {
437
+ isolation: isolate;
438
+ scroll-margin-top: var(--scribe-table-sticky-header-offset, 0px);
439
+ }
440
+
441
+ .scribe-content
442
+ .tiptap
443
+ .tableWrapper[data-table-sticky-header-active="true"]
444
+ > table
445
+ > tbody
446
+ > tr:first-child
447
+ > th {
448
+ background: var(--gray-3);
449
+ box-shadow: inset 0 -1px var(--gray-6);
450
+ position: sticky;
451
+ top: var(--scribe-table-sticky-header-top, 0px);
452
+ z-index: 4;
453
+ }
454
+
408
455
  .scribe-content .tiptap th,
409
456
  .scribe-content .tiptap td {
410
457
  border: 1px solid var(--gray-6);
package/dist/main.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export * from "./components/Scribe";
2
2
  export * from "./components/Scribe/extension/callout";
3
3
  export * from "./components/Scribe/extension/external-link-preview";
4
+ export type { ScribeTableLayout } from "./components/Scribe/extension/resizable-table";
4
5
  export * from "./utils";
5
6
  export type { Content } from "@tiptap/react";
6
7
  //# sourceMappingURL=main.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../lib/main.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,uCAAuC,CAAC;AACtD,cAAc,qDAAqD,CAAC;AACpE,cAAc,SAAS,CAAC;AACxB,YAAY,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../lib/main.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,uCAAuC,CAAC;AACtD,cAAc,qDAAqD,CAAC;AACpE,YAAY,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AACvF,cAAc,SAAS,CAAC;AACxB,YAAY,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC"}
package/dist/main.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { CALLOUT_VARIANTS as e, CALLOUT_VARIANT_LABELS as t, Callout as n, DEFAULT_CALLOUT_VARIANT as r, isCalloutVariant as i } from "./components/Scribe/extension/callout.js";
2
2
  import { EXTERNAL_LINK_PREVIEW_DISPLAYS as a } from "./components/Scribe/extension/external-link-preview/types.js";
3
3
  import { EXTERNAL_LINK_PREVIEW_NODE_NAME as o } from "./components/Scribe/extension/external-link-preview/attributes.js";
4
- import { t as s } from "./html-to-markdown-BpR-7GtJ.js";
4
+ import { t as s } from "./html-to-markdown-DF93it73.js";
5
5
  import { t as c } from "./markdown-to-html-BoK5O_j-.js";
6
6
  import { isInViewport as l } from "./utils/is-in-viewport.js";
7
7
  import { convertLegacyMathDelimiters as u } from "./utils/convert-legacy-math-delimiters.js";
@@ -1,9 +1,10 @@
1
1
  import { A as e, B as t, C as n, D as r, F as i, H as a, I as o, L as s, M as c, O as l, P as u, R as d, S as f, U as p, V as m, _ as h, a as g, b as _, c as v, d as y, f as b, g as x, i as S, j as C, k as ee, l as te, n as w, p as ne, r as re, s as ie, u as ae, w as oe, x as se } from "./dist-xjmWZ-oh.js";
2
2
  import { t as ce } from "./dist-Dk0fXvrc.js";
3
- import { r as le, t as ue } from "./resizable-table-JZOaj_L3.js";
4
- import { n as de, t as fe } from "./extension-link-DmM_EJTn.js";
5
- import { Callout as pe } from "./components/Scribe/extension/callout.js";
6
- import { ExternalLinkPreviewSchema as me } from "./components/Scribe/extension/external-link-preview/schema.js";
3
+ import { m as le } from "./table-layout-BoDS50DR.js";
4
+ import { n as ue, t as de } from "./extension-link-DmM_EJTn.js";
5
+ import { Callout as fe } from "./components/Scribe/extension/callout.js";
6
+ import { ExternalLinkPreviewSchema as pe } from "./components/Scribe/extension/external-link-preview/schema.js";
7
+ import { ScribeTable as me } from "./components/Scribe/extension/resizable-table.js";
7
8
  import { NodeSelection as he, Plugin as ge, PluginKey as _e, Selection as ve, TextSelection as ye } from "@tiptap/pm/state";
8
9
  import { Fragment as be, Slice as xe } from "@tiptap/pm/model";
9
10
  import { Decoration as Se, DecorationSet as Ce } from "@tiptap/pm/view";
@@ -55232,7 +55233,7 @@ var Ll = w.create({
55232
55233
  name: "starterKit",
55233
55234
  addExtensions() {
55234
55235
  let e = [];
55235
- return this.options.bold !== !1 && e.push(Uc.configure(this.options.bold)), this.options.blockquote !== !1 && e.push(Rc.configure(this.options.blockquote)), this.options.bulletList !== !1 && e.push(rs.configure(this.options.bulletList)), this.options.code !== !1 && e.push(je.configure(this.options.code)), this.options.codeBlock !== !1 && e.push(qc.configure(this.options.codeBlock)), this.options.document !== !1 && e.push(Jc.configure(this.options.document)), this.options.dropcursor !== !1 && e.push(dl.configure(this.options.dropcursor)), this.options.gapcursor !== !1 && e.push(pl.configure(this.options.gapcursor)), this.options.hardBreak !== !1 && e.push(Yc.configure(this.options.hardBreak)), this.options.heading !== !1 && e.push(Xc.configure(this.options.heading)), this.options.undoRedo !== !1 && e.push(Rl.configure(this.options.undoRedo)), this.options.horizontalRule !== !1 && e.push(Zc.configure(this.options.horizontalRule)), this.options.italic !== !1 && e.push(nl.configure(this.options.italic)), this.options.listItem !== !1 && e.push(Es.configure(this.options.listItem)), this.options.listKeymap !== !1 && e.push(Fs.configure(this.options?.listKeymap)), this.options.link !== !1 && e.push(de.configure(this.options?.link)), this.options.orderedList !== !1 && e.push(Qs.configure(this.options.orderedList)), this.options.paragraph !== !1 && e.push(al.configure(this.options.paragraph)), this.options.strike !== !1 && e.push(cl.configure(this.options.strike)), this.options.text !== !1 && e.push(ll.configure(this.options.text)), this.options.underline !== !1 && e.push(ul.configure(this.options?.underline)), this.options.trailingNode !== !1 && e.push(Ll.configure(this.options?.trailingNode)), e;
55236
+ return this.options.bold !== !1 && e.push(Uc.configure(this.options.bold)), this.options.blockquote !== !1 && e.push(Rc.configure(this.options.blockquote)), this.options.bulletList !== !1 && e.push(rs.configure(this.options.bulletList)), this.options.code !== !1 && e.push(je.configure(this.options.code)), this.options.codeBlock !== !1 && e.push(qc.configure(this.options.codeBlock)), this.options.document !== !1 && e.push(Jc.configure(this.options.document)), this.options.dropcursor !== !1 && e.push(dl.configure(this.options.dropcursor)), this.options.gapcursor !== !1 && e.push(pl.configure(this.options.gapcursor)), this.options.hardBreak !== !1 && e.push(Yc.configure(this.options.hardBreak)), this.options.heading !== !1 && e.push(Xc.configure(this.options.heading)), this.options.undoRedo !== !1 && e.push(Rl.configure(this.options.undoRedo)), this.options.horizontalRule !== !1 && e.push(Zc.configure(this.options.horizontalRule)), this.options.italic !== !1 && e.push(nl.configure(this.options.italic)), this.options.listItem !== !1 && e.push(Es.configure(this.options.listItem)), this.options.listKeymap !== !1 && e.push(Fs.configure(this.options?.listKeymap)), this.options.link !== !1 && e.push(ue.configure(this.options?.link)), this.options.orderedList !== !1 && e.push(Qs.configure(this.options.orderedList)), this.options.paragraph !== !1 && e.push(al.configure(this.options.paragraph)), this.options.strike !== !1 && e.push(cl.configure(this.options.strike)), this.options.text !== !1 && e.push(ll.configure(this.options.text)), this.options.underline !== !1 && e.push(ul.configure(this.options?.underline)), this.options.trailingNode !== !1 && e.push(Ll.configure(this.options?.trailingNode)), e;
55236
55237
  }
55237
55238
  }), Bl = Me.extend({ excludes: "code" }), Vl = ({ enableUndoRedo: e } = {}) => ({
55238
55239
  starterKit: zl.configure({
@@ -55245,14 +55246,14 @@ var Ll = w.create({
55245
55246
  ...e === !1 ? { undoRedo: !1 } : {}
55246
55247
  }),
55247
55248
  code: Bl,
55248
- externalLinkPreview: me,
55249
- callout: pe,
55249
+ externalLinkPreview: pe,
55250
+ callout: fe,
55250
55251
  taskList: ac.configure({ HTMLAttributes: { class: "scribe-task-list" } }),
55251
55252
  taskItem: ic.configure({ nested: !0 }),
55252
55253
  tableKit: le.configure({ table: !1 }),
55253
- table: ue,
55254
+ table: me,
55254
55255
  highlight: Xe,
55255
- link: fe,
55256
+ link: de,
55256
55257
  image: Qe.configure({
55257
55258
  inline: !0,
55258
55259
  HTMLAttributes: { class: "scribe-image-node" },
@@ -1,2 +1,2 @@
1
- import { t as e } from "./schema-extensions-BryyErmk.js";
1
+ import { t as e } from "./schema-extensions-DyCk1Goa.js";
2
2
  export { e as createScribeSchemaExtensionSet };
package/dist/schema.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ScribeTableTransformError as e, applyScribeTableTransform as t } from "./table-transforms.js";
2
- import { t as n } from "./schema-extensions-BryyErmk.js";
2
+ import { t as n } from "./schema-extensions-DyCk1Goa.js";
3
3
  import { SCRIBE_DOCUMENT_NODE_CAPABILITY_ROLES as r, SCRIBE_DOCUMENT_NODE_CONTENT_KINDS as i, createScribeDocumentNodeCapabilityManifest as a, defineScribeDocumentNodeCapability as o } from "./document-node-capabilities.js";
4
4
  //#region lib/schema.ts
5
5
  var s = (e = {}) => Object.values(n(e));