@kong-ui-public/document-viewer 0.2.9 → 0.2.10

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.
@@ -1,32 +1,36 @@
1
- import { openBlock as o, createElementBlock as c, renderSlot as s, createElementVNode as y, defineComponent as l, createBlock as i, resolveDynamicComponent as f, unref as d, withCtx as p, normalizeClass as k, Fragment as x, createTextVNode as B, toDisplayString as C, createCommentVNode as I, createVNode as $, mergeProps as w } from "vue";
2
- const _ = (e, t) => {
1
+ import { openBlock as o, createElementBlock as _, renderSlot as s, createElementVNode as $, defineComponent as l, createBlock as i, resolveDynamicComponent as p, unref as d, withCtx as f, normalizeClass as w, Fragment as B, createTextVNode as S, toDisplayString as q, createCommentVNode as T, createVNode as k, mergeProps as V } from "vue";
2
+ var u = /* @__PURE__ */ ((e) => (e.header = "header", e.body = "body", e.footer = "footer", e))(u || {}), m = /* @__PURE__ */ ((e) => (e.left = "left", e.center = "center", e.right = "right", e))(m || {});
3
+ function L(e) {
4
+ return e.type === "text";
5
+ }
6
+ const c = (e, t) => {
3
7
  const n = e.__vccOpts || e;
4
8
  for (const [r, a] of t)
5
9
  n[r] = a;
6
10
  return n;
7
- }, N = {};
8
- function q(e, t) {
9
- return o(), c("blockquote", null, [
11
+ }, D = {};
12
+ function O(e, t) {
13
+ return o(), _("blockquote", null, [
10
14
  s(e.$slots, "default", {}, void 0, !0)
11
15
  ]);
12
16
  }
13
- const V = /* @__PURE__ */ _(N, [["render", q], ["__scopeId", "data-v-a9ac327a"]]);
14
- const L = {};
15
- function S(e, t) {
16
- return o(), c("code", null, [
17
+ const E = /* @__PURE__ */ c(D, [["render", O], ["__scopeId", "data-v-8e8713de"]]);
18
+ const P = {};
19
+ function H(e, t) {
20
+ return o(), _("code", null, [
17
21
  s(e.$slots, "default", {}, void 0, !0)
18
22
  ]);
19
23
  }
20
- const T = /* @__PURE__ */ _(L, [["render", S], ["__scopeId", "data-v-015a6bbb"]]);
21
- const D = {};
22
- function O(e, t) {
23
- return o(), c("pre", null, [
24
- y("code", null, [
24
+ const j = /* @__PURE__ */ c(P, [["render", H], ["__scopeId", "data-v-015a6bbb"]]);
25
+ const U = {};
26
+ function z(e, t) {
27
+ return o(), _("pre", null, [
28
+ $("code", null, [
25
29
  s(e.$slots, "default", {}, void 0, !0)
26
30
  ])
27
31
  ]);
28
32
  }
29
- const P = /* @__PURE__ */ _(D, [["render", O], ["__scopeId", "data-v-7d7d103e"]]), E = /* @__PURE__ */ l({
33
+ const F = /* @__PURE__ */ c(U, [["render", z], ["__scopeId", "data-v-7d7d103e"]]), M = /* @__PURE__ */ l({
30
34
  __name: "Emphasis",
31
35
  props: {
32
36
  level: {
@@ -42,14 +46,14 @@ const P = /* @__PURE__ */ _(D, [["render", O], ["__scopeId", "data-v-7d7d103e"]]
42
46
  },
43
47
  setup(e) {
44
48
  const n = e.level === 1 ? "em" : "strong";
45
- return (r, a) => (o(), i(f(d(n)), null, {
46
- default: p(() => [
49
+ return (r, a) => (o(), i(p(d(n)), null, {
50
+ default: f(() => [
47
51
  s(r.$slots, "default")
48
52
  ]),
49
53
  _: 3
50
54
  }));
51
55
  }
52
- }), H = /* @__PURE__ */ l({
56
+ }), W = /* @__PURE__ */ l({
53
57
  __name: "Heading",
54
58
  props: {
55
59
  level: {
@@ -65,15 +69,15 @@ const P = /* @__PURE__ */ _(D, [["render", O], ["__scopeId", "data-v-7d7d103e"]]
65
69
  },
66
70
  setup(e) {
67
71
  const n = `h${e.level}`;
68
- return (r, a) => (o(), i(f(n), null, {
69
- default: p(() => [
72
+ return (r, a) => (o(), i(p(n), null, {
73
+ default: f(() => [
70
74
  s(r.$slots, "default", {}, void 0, !0)
71
75
  ]),
72
76
  _: 3
73
77
  }));
74
78
  }
75
79
  });
76
- const j = /* @__PURE__ */ _(H, [["__scopeId", "data-v-07152ca1"]]), U = ["alt", "src", "title"], z = /* @__PURE__ */ l({
80
+ const G = /* @__PURE__ */ c(W, [["__scopeId", "data-v-07152ca1"]]), J = ["alt", "src", "title"], K = /* @__PURE__ */ l({
77
81
  __name: "Image",
78
82
  props: {
79
83
  url: {
@@ -90,30 +94,28 @@ const j = /* @__PURE__ */ _(H, [["__scopeId", "data-v-07152ca1"]]), U = ["alt",
90
94
  }
91
95
  },
92
96
  setup(e) {
93
- return (t, n) => (o(), c("figure", null, [
94
- y("img", {
97
+ return (t, n) => (o(), _("figure", null, [
98
+ $("img", {
95
99
  alt: e.alt,
96
100
  src: e.url,
97
101
  title: e.title
98
- }, null, 8, U),
99
- y("figcaption", null, [
102
+ }, null, 8, J),
103
+ $("figcaption", null, [
100
104
  s(t.$slots, "default")
101
105
  ])
102
106
  ]));
103
107
  }
104
- }), F = {};
105
- function M(e, t) {
106
- return o(), c("hr");
108
+ }), Q = {};
109
+ function X(e, t) {
110
+ return o(), _("hr");
107
111
  }
108
- const G = /* @__PURE__ */ _(F, [["render", M]]), J = {};
109
- function K(e, t) {
110
- return o(), c("table", null, [
112
+ const Y = /* @__PURE__ */ c(Q, [["render", X]]), Z = {};
113
+ function A(e, t) {
114
+ return o(), _("table", null, [
111
115
  s(e.$slots, "default")
112
116
  ]);
113
117
  }
114
- const Q = /* @__PURE__ */ _(J, [["render", K]]);
115
- var u = /* @__PURE__ */ ((e) => (e.header = "header", e.body = "body", e.footer = "footer", e))(u || {}), m = /* @__PURE__ */ ((e) => (e.left = "left", e.center = "center", e.right = "right", e))(m || {});
116
- const W = /* @__PURE__ */ l({
118
+ const R = /* @__PURE__ */ c(Z, [["render", A]]), ee = /* @__PURE__ */ l({
117
119
  __name: "TableRow",
118
120
  props: {
119
121
  section: {
@@ -124,14 +126,14 @@ const W = /* @__PURE__ */ l({
124
126
  setup(e) {
125
127
  const t = e;
126
128
  let n;
127
- return t.section === u.header ? n = "thead" : t.section === u.body ? n = "tbody" : t.section === u.footer && (n = "tfoot"), (r, a) => (o(), i(f(d(n)), null, {
128
- default: p(() => [
129
+ return t.section === u.header ? n = "thead" : t.section === u.body ? n = "tbody" : t.section === u.footer && (n = "tfoot"), (r, a) => (o(), i(p(d(n)), null, {
130
+ default: f(() => [
129
131
  s(r.$slots, "default")
130
132
  ]),
131
133
  _: 3
132
134
  }));
133
135
  }
134
- }), X = /* @__PURE__ */ l({
136
+ }), te = /* @__PURE__ */ l({
135
137
  __name: "TableCell",
136
138
  props: {
137
139
  align: {
@@ -147,51 +149,51 @@ const W = /* @__PURE__ */ l({
147
149
  var a;
148
150
  const t = e, n = ((a = t.parent) == null ? void 0 : a.section) === u.header ? "th" : "td";
149
151
  let r;
150
- return t.align === m.center ? r = "align-center" : t.align === m.right && (r = "align-right"), (g, h) => (o(), i(f(d(n)), {
151
- class: k(d(r))
152
+ return t.align === m.center ? r = "align-center" : t.align === m.right && (r = "align-right"), (g, y) => (o(), i(p(d(n)), {
153
+ class: w(d(r))
152
154
  }, {
153
- default: p(() => [
155
+ default: f(() => [
154
156
  s(g.$slots, "default", {}, void 0, !0)
155
157
  ]),
156
158
  _: 3
157
159
  }, 8, ["class"]));
158
160
  }
159
161
  });
160
- const Y = /* @__PURE__ */ _(X, [["__scopeId", "data-v-6da63f53"]]), Z = { key: 0 }, A = {
162
+ const ne = /* @__PURE__ */ c(te, [["__scopeId", "data-v-6da63f53"]]), re = { key: 0 }, oe = {
161
163
  inheritAttrs: !1
162
- }, R = /* @__PURE__ */ l({
163
- ...A,
164
+ }, se = /* @__PURE__ */ l({
165
+ ...oe,
164
166
  __name: "Text",
165
167
  props: {
166
168
  text: {
167
169
  type: String,
168
170
  required: !0
169
171
  },
170
- hardBreak: {
172
+ appendSpace: {
171
173
  type: Boolean,
172
174
  default: !1
173
175
  }
174
176
  },
175
177
  setup(e) {
176
- return (t, n) => (o(), c(x, null, [
177
- B(C(e.text), 1),
178
- e.hardBreak ? (o(), c("br", Z)) : I("", !0)
178
+ return (t, n) => (o(), _(B, null, [
179
+ S(q(e.text), 1),
180
+ e.appendSpace ? (o(), _("span", re, " ")) : T("", !0)
179
181
  ], 64));
180
182
  }
181
- }), ee = {};
182
- function te(e, t) {
183
- return o(), c("span", null, [
183
+ }), _e = {};
184
+ function ce(e, t) {
185
+ return o(), _("span", null, [
184
186
  s(e.$slots, "default")
185
187
  ]);
186
188
  }
187
- const ne = /* @__PURE__ */ _(ee, [["render", te]]);
188
- const re = {};
189
- function oe(e, t) {
190
- return o(), c("p", null, [
189
+ const ae = /* @__PURE__ */ c(_e, [["render", ce]]);
190
+ const le = {};
191
+ function ue(e, t) {
192
+ return o(), _("p", null, [
191
193
  s(e.$slots, "default", {}, void 0, !0)
192
194
  ]);
193
195
  }
194
- const se = /* @__PURE__ */ _(re, [["render", oe], ["__scopeId", "data-v-c7681718"]]), ce = /* @__PURE__ */ l({
196
+ const de = /* @__PURE__ */ c(le, [["render", ue], ["__scopeId", "data-v-c7681718"]]), ie = /* @__PURE__ */ l({
195
197
  __name: "List",
196
198
  props: {
197
199
  isOrdered: {
@@ -201,21 +203,21 @@ const se = /* @__PURE__ */ _(re, [["render", oe], ["__scopeId", "data-v-c7681718
201
203
  },
202
204
  setup(e) {
203
205
  const n = e.isOrdered ? "ol" : "ul";
204
- return (r, a) => (o(), i(f(d(n)), null, {
205
- default: p(() => [
206
+ return (r, a) => (o(), i(p(d(n)), null, {
207
+ default: f(() => [
206
208
  s(r.$slots, "default", {}, void 0, !0)
207
209
  ]),
208
210
  _: 3
209
211
  }));
210
212
  }
211
213
  });
212
- const _e = /* @__PURE__ */ _(ce, [["__scopeId", "data-v-f52e8277"]]), ae = {};
213
- function le(e, t) {
214
- return o(), c("li", null, [
214
+ const pe = /* @__PURE__ */ c(ie, [["__scopeId", "data-v-f52e8277"]]), fe = {};
215
+ function me(e, t) {
216
+ return o(), _("li", null, [
215
217
  s(e.$slots, "default")
216
218
  ]);
217
219
  }
218
- const ue = /* @__PURE__ */ _(ae, [["render", le]]), de = ["href", "title"], ie = /* @__PURE__ */ l({
220
+ const ge = /* @__PURE__ */ c(fe, [["render", me]]), ye = ["href", "title"], ve = /* @__PURE__ */ l({
219
221
  __name: "Link",
220
222
  props: {
221
223
  href: {
@@ -228,37 +230,37 @@ const ue = /* @__PURE__ */ _(ae, [["render", le]]), de = ["href", "title"], ie =
228
230
  }
229
231
  },
230
232
  setup(e) {
231
- return (t, n) => (o(), c("a", {
233
+ return (t, n) => (o(), _("a", {
232
234
  href: e.href,
233
235
  rel: "noreferrer noopener nofollow",
234
236
  title: e.title
235
237
  }, [
236
238
  s(t.$slots, "default", {}, void 0, !0)
237
- ], 8, de));
239
+ ], 8, ye));
238
240
  }
239
241
  });
240
- const fe = /* @__PURE__ */ _(ie, [["__scopeId", "data-v-9b27e235"]]), pe = {
241
- blockquote: V,
242
- code: T,
243
- code_block: P,
244
- emphasis: E,
245
- heading: j,
246
- image: z,
247
- line_break: G,
248
- link: fe,
249
- list: _e,
250
- list_item: ue,
251
- paragraph: se,
252
- table: Q,
253
- table_row: W,
254
- table_cell: Y,
255
- text: R,
256
- text_block: ne
257
- }, v = [];
258
- function me(e) {
259
- v.indexOf(e) === -1 && (v.push(e), console.warn(`[DocumentViewer] Unable to render an unknown node type "${e}"`));
242
+ const $e = /* @__PURE__ */ c(ve, [["__scopeId", "data-v-9b27e235"]]), he = {
243
+ blockquote: E,
244
+ code: j,
245
+ code_block: F,
246
+ emphasis: M,
247
+ heading: G,
248
+ image: K,
249
+ line_break: Y,
250
+ link: $e,
251
+ list: pe,
252
+ list_item: ge,
253
+ paragraph: de,
254
+ table: R,
255
+ table_row: ee,
256
+ table_cell: ne,
257
+ text: se,
258
+ text_block: ae
259
+ }, x = [];
260
+ function be(e) {
261
+ x.indexOf(e) === -1 && (x.push(e), console.warn(`[DocumentViewer] Unable to render an unknown node type "${e}"`));
260
262
  }
261
- function b(e, t) {
263
+ function I(e, t) {
262
264
  return e.map((n) => {
263
265
  if (!n)
264
266
  return null;
@@ -266,15 +268,24 @@ function b(e, t) {
266
268
  type: r,
267
269
  children: a,
268
270
  ...g
269
- } = n, h = pe[n.type];
270
- return h ? $(h, w(g, {
271
+ } = n, y = he[n.type];
272
+ if (!y)
273
+ return be(r), null;
274
+ if ((n == null ? void 0 : n.type) === "paragraph" && (n != null && n.children)) {
275
+ const h = n.children, C = h.length - 1;
276
+ h.forEach((v, N) => {
277
+ var b;
278
+ L(v) && !((b = v.text) != null && b.endsWith(" ")) && N !== C && (v.appendSpace = !0);
279
+ });
280
+ }
281
+ return k(y, V(g, {
271
282
  parent: t
272
283
  }), {
273
- default: () => a && b(a, n)
274
- }) : (me(r), null);
284
+ default: () => a && I(a, n)
285
+ });
275
286
  });
276
287
  }
277
- const ge = { class: "document-viewer" }, he = /* @__PURE__ */ l({
288
+ const xe = { class: "document-viewer" }, ke = /* @__PURE__ */ l({
278
289
  __name: "DocumentViewer",
279
290
  props: {
280
291
  document: {
@@ -285,17 +296,18 @@ const ge = { class: "document-viewer" }, he = /* @__PURE__ */ l({
285
296
  setup(e) {
286
297
  const t = e, n = () => {
287
298
  var r;
288
- return (r = t.document) != null && r.children ? b(t.document.children) : null;
299
+ return (r = t.document) != null && r.children ? I(t.document.children) : null;
289
300
  };
290
- return (r, a) => (o(), c("div", ge, [
291
- $(n)
301
+ return (r, a) => (o(), _("div", xe, [
302
+ k(n)
292
303
  ]));
293
304
  }
294
305
  });
295
- const ve = /* @__PURE__ */ _(he, [["__scopeId", "data-v-4b223d3a"]]);
306
+ const Ce = /* @__PURE__ */ c(ke, [["__scopeId", "data-v-4b223d3a"]]);
296
307
  export {
297
308
  m as TableCellAlign,
298
309
  u as TableRowSection,
299
- ve as default
310
+ Ce as default,
311
+ L as isTextNode
300
312
  };
301
313
  //# sourceMappingURL=document-viewer.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"document-viewer.es.js","sources":["../src/components/nodes/Blockquote.vue","../src/components/nodes/Code.vue","../src/components/nodes/CodeBlock.vue","../src/components/nodes/Emphasis.vue","../src/components/nodes/Heading.vue","../src/components/nodes/LineBreak.vue","../src/components/nodes/Table.vue","../src/types/index.ts","../src/components/nodes/TableRow.vue","../src/components/nodes/TableCell.vue","../src/components/nodes/Text.vue","../src/components/nodes/TextBlock.vue","../src/components/nodes/Paragraph.vue","../src/components/nodes/List.vue","../src/components/nodes/ListItem.vue","../src/components/renderChildren.tsx","../src/components/DocumentViewer.vue"],"sourcesContent":["<template>\n <blockquote>\n <slot />\n </blockquote>\n</template>\n\n<style scoped>\nblockquote {\n background: var(--document-viewer-blockquote-background, #f8f8fa);\n border-left: 2.5px solid var(--document-viewer-blockquote-border, var(--text_colors-accent, #0b172d));\n border-radius: var(--document-viewer-blockquote-border-radius, 3px);\n font-size: 14px;\n margin: var(--spacing-sm, 12px) var(--spacing-sm, 12px);\n padding: var(--spacing-sm, 12px);\n}\n</style>\n","<template>\n <code>\n <slot />\n </code>\n</template>\n\n<style scoped>\ncode {\n background: var(--document-viewer-code-background, #f1f1f1);\n border-radius: var(--document-viewer-code-border-radius, 3px);\n color: var(--document-viewer-code-color, inherit);\n font-family: var(--document-viewer-code-font-family, var(--document-viewer-font-family-monospace));\n font-size: var(--document-viewer-code-font-size, 14px);\n padding: 4px 6px;\n}\n</style>\n","<template>\n <pre><code><slot /></code></pre>\n</template>\n\n<style scoped>\npre {\n background: var(--document-viewer-code-block-background, #f1f1f1);\n border-radius: var(--document-viewer-code-block-border-radius, 3px);\n color: var(--document-viewer-code-block-color, inherit);\n font-family: var(--document-viewer-code-block-font-family, var(--document-viewer-font-family-monospace));\n font-size: var(--document-viewer-code-block-font-size, 14px);\n margin-bottom: var(--spacing-sm, 12px);\n padding: 12px;\n}\n</style>\n","<template>\n <component :is=\"tag\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nconst props = defineProps({\n level: {\n type: Number,\n default: 1,\n validator(value: unknown): boolean {\n if (!Number.isInteger(value)) {\n return false\n }\n\n const num = value as number\n return num > 0 && num < 3\n },\n },\n})\n\nconst tag = props.level === 1 ? 'em' : 'strong'\n</script>\n","<template>\n <component :is=\"tag\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nconst props = defineProps({\n level: {\n type: Number,\n validator(value: unknown): boolean {\n if (!Number.isInteger(value)) {\n return false\n }\n\n const num = value as number\n\n return num > 0 && num < 7\n },\n default: 1,\n },\n})\n\nconst tag = `h${props.level}`\n</script>\n\n<style scoped>\nh1, h2, h3, h4, h5, h6 {\n color: var(--document-viewer-color, var(--text_colors-headings, #0b172d));\n font-family: var(--document-viewer-font-family-headings, var(--document-viewer-font-family-default));\n font-weight: var(--document-viewer-heading-font-weight, 500);\n margin-top: 0;\n}\n\nh1 {\n font-size: 32px;\n font-weight: 500;\n line-height: 38px;\n margin-bottom: var(--spacing-xxl, 48px);\n}\n\nh2 {\n font-size: 24px;\n line-height: 20px;\n margin-bottom: var(--spacing-lg, 24px);\n}\n\nh3 {\n font-size: 20px;\n line-height: 20px;\n margin-bottom: var(--spacing-sm, 12px);\n}\n\nh4 {\n font-size: 18px;\n line-height: 20px;\n margin-bottom: var(--spacing-sm, 12px);\n}\n\nh5 {\n font-size: 16px;\n line-height: 20px;\n margin-bottom: var(--spacing-sm, 12px);\n}\n\nh6 {\n font-size: 14.5px;\n line-height: 20px;\n margin-bottom: var(--spacing-sm, 12px);\n}\n\nh1:first-child, h2:first-child, h3:first-child, h4:first-child, h5:first-child, h6:first-child {\n margin-top: 0;\n}\n</style>\n","<template>\n <hr>\n</template>\n","<template>\n <table>\n <slot />\n </table>\n</template>\n","/* eslint-disable no-unused-vars */\nexport interface BaseNode<Type extends string = string> {\n type: Type\n children?: Array<BaseNode>\n}\n\n// TODO: Reach out to DevX for a proper interface\nexport interface Document extends BaseNode<'document'> {\n children: Array<BaseNode>\n version: number\n}\n\nexport enum TableRowSection {\n header = 'header',\n body = 'body',\n footer = 'footer'\n}\n\nexport enum TableCellAlign {\n left = 'left',\n center = 'center',\n right = 'right'\n}\n\nexport interface TableCellNode extends BaseNode<'table_cell'> {\n align?: TableCellAlign\n}\n\nexport interface TableRowNode extends BaseNode<'table_row'> {\n section?: TableRowSection\n children: Array<TableCellNode>\n}\n\nexport interface TextNode extends BaseNode<'text'> {\n text: string\n children: undefined\n hardBreak?: boolean\n}\n\nexport interface HeadingNode extends BaseNode<'heading'> {\n level: number\n}\n\nexport interface ListItemNode extends BaseNode<'list_item'> {}\n\nexport interface ListNode extends BaseNode<'list'> {\n isOrdered?: boolean\n children: Array<ListItemNode>\n}\n\nexport interface LinkNode extends BaseNode<'link'> {\n href: string\n}\n","<template>\n <component :is=\"tag\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport { PropType } from 'vue'\nimport { TableRowSection } from '../../types'\n\nconst props = defineProps({\n section: {\n type: String as PropType<TableRowSection>,\n default: TableRowSection.body,\n },\n})\n\nlet tag: string\nif (props.section === TableRowSection.header) {\n tag = 'thead'\n} else if (props.section === TableRowSection.body) {\n tag = 'tbody'\n} else if (props.section === TableRowSection.footer) {\n tag = 'tfoot'\n}\n</script>\n","<template>\n <component\n :is=\"tag\"\n :class=\"className\"\n >\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport { PropType } from 'vue'\nimport { TableCellAlign, TableRowNode, TableRowSection } from '../../types'\n\nconst props = defineProps({\n align: {\n type: String as PropType<TableCellAlign>,\n default: TableCellAlign.left,\n },\n parent: {\n type: Object as PropType<TableRowNode>,\n required: true,\n },\n})\n\nconst tag = props.parent?.section === TableRowSection.header ? 'th' : 'td'\n\nlet className: string\nif (props.align === TableCellAlign.center) {\n className = 'align-center'\n} else if (props.align === TableCellAlign.right) {\n className = 'align-right'\n}\n</script>\n\n<style scoped>\nth, td {\n text-align: left;\n}\n\n.align-center {\n text-align: center;\n}\n\n.align-right {\n text-align: right;\n}\n</style>\n","<template>\n {{ text }}<br v-if=\"hardBreak\">\n</template>\n\n<script lang=\"ts\">\nexport default {\n inheritAttrs: false,\n}\n</script>\n<script setup lang=\"ts\">\ndefineProps({\n text: {\n type: String,\n required: true,\n },\n hardBreak: {\n type: Boolean,\n default: false,\n },\n})\n</script>\n","<template>\n <span>\n <slot />\n </span>\n</template>\n","<template>\n <p>\n <slot />\n </p>\n</template>\n\n<style scoped>\np {\n font-size: 14px;\n line-height: 20px;\n margin: var(--document-viewer-paragraph-margin, 0 0 12px);\n}\n</style>\n","<template>\n <component :is=\"tag\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nconst props = defineProps({\n isOrdered: {\n type: Boolean,\n default: false,\n },\n})\n\nconst tag = props.isOrdered ? 'ol' : 'ul'\n</script>\n\n<style scoped>\nul, ol {\n font-size: 14px;\n margin-bottom: var(--spacing-sm, 12px);\n margin-left: 16px;\n padding: 0;\n}\n\nol {\n list-style: decimal;\n}\n\nul {\n list-style: disc;\n}\n</style>\n","<template>\n <li>\n <slot />\n </li>\n</template>\n","import { Component } from 'vue'\nimport { BaseNode } from '../types'\nimport Blockquote from './nodes/Blockquote.vue'\nimport Code from './nodes/Code.vue'\nimport CodeBlock from './nodes/CodeBlock.vue'\nimport Emphasis from './nodes/Emphasis.vue'\nimport Heading from './nodes/Heading.vue'\nimport Image from './nodes/Image.vue'\nimport LineBreak from './nodes/LineBreak.vue'\nimport Table from './nodes/Table.vue'\nimport TableRow from './nodes/TableRow.vue'\nimport TableCell from './nodes/TableCell.vue'\nimport Text from './nodes/Text.vue'\nimport TextBlock from './nodes/TextBlock.vue'\nimport Paragraph from './nodes/Paragraph.vue'\nimport List from './nodes/List.vue'\nimport ListItem from './nodes/ListItem.vue'\nimport Link from './nodes/Link.vue'\n\n// The node to component mapping is currently static but may change in the future\nconst nodeTypeToComponentMap: Record<string, Component> = {\n blockquote: Blockquote,\n code: Code,\n code_block: CodeBlock,\n emphasis: Emphasis,\n heading: Heading,\n image: Image,\n line_break: LineBreak,\n link: Link,\n list: List,\n list_item: ListItem,\n paragraph: Paragraph,\n table: Table,\n table_row: TableRow,\n table_cell: TableCell,\n text: Text,\n text_block: TextBlock,\n}\n\nconst nodeTypesNotified: Array<string> = []\nfunction notifyUnknownNodeType(type: string) {\n if (nodeTypesNotified.indexOf(type) !== -1) {\n return\n }\n\n nodeTypesNotified.push(type)\n console.warn(`[DocumentViewer] Unable to render an unknown node type \"${type}\"`)\n}\n\nexport default function renderChildren<ChildTypes extends BaseNode>(children: Array<ChildTypes>, parent?: BaseNode): Component {\n return children.map((child) => {\n if (!child) {\n return null\n }\n\n const { type, children, ...restProps } = child\n const component = nodeTypeToComponentMap[child.type]\n\n if (!component) {\n notifyUnknownNodeType(type)\n return null\n }\n\n return (\n <component {...restProps} parent={parent}>\n {() => children && renderChildren(children, child)}\n </component>\n )\n })\n}\n","<template>\n <div class=\"document-viewer\">\n <Children />\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport renderChildren from './renderChildren'\n\nconst props = defineProps({\n document: {\n type: Object,\n required: true,\n },\n})\n\nconst Children = () => props.document?.children ? renderChildren(props.document.children) : null\n</script>\n\n<style>\n:root {\n --document-viewer-font-family-default: Roboto, Helvetica, sans-serif;\n --document-viewer-font-family-monospace: Consolas, 'Liberation Mono', Menlo, Courier, monospace;\n}\n</style>\n<style scoped>\n.document-viewer {\n color: var(--document-viewer-color, var(--text_colors-primary, #0b172d));\n font-family: var(--document-viewer-font-family-default, var(--font-family-sans));\n font-size: var(--document-viewer-font-size, 16px);\n}\n</style>\n"],"names":["_cache","_openBlock","_createElementBlock","tag","TableRowSection","TableCellAlign","props","_a","className","__default__","nodeTypeToComponentMap","blockquote","Blockquote","code","Code","code_block","CodeBlock","emphasis","Emphasis","heading","Heading","image","Image","line_break","LineBreak","link","Link","list","List","list_item","ListItem","paragraph","Paragraph","table","Table","table_row","TableRow","table_cell","TableCell","text","Text","text_block","TextBlock","nodeTypesNotified","notifyUnknownNodeType","type","indexOf","push","console","warn","renderChildren","children","parent","map","child","restProps","component","_createVNode","_mergeProps","Children"],"mappings":";;;;;;;cAGeA,GAAA;SADHC,EAAA,GAAAC,EAAA,cAAA,MAAA;AAAA;;;;;cCCHF,GAAA;SADGC,EAAA,GAAAC,EAAA,QAAA,MAAA;AAAA;;;;;cCDsBF,GAAA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AYC;AAAAA,EACZC,MAAMC;AAAAA,EACNC,YAAYC;AAAAA,EACZC,UAAUC;AAAAA,EACVC,SAASC;AAAAA,EACTC,OAAOC;AAAAA,EACPC,YAAYC;AAAAA,EACZC,MAAMC;AAAAA,EACNC,MAAMC;AAAAA,EACNC,WAAWC;AAAAA,EACXC,WAAWC;AAAAA,EACXC,OAAOC;AAAAA,EACPC,WAAWC;AAAAA,EACXC,YAAYC;AAAAA,EACZC,MAAMC;AAAAA,EACNC,YAAYC;AACd,GAEMC,IAAmC,CAAA;AACzC,SAASC,GAAsBC,GAAc;AAC3C,EAAIF,EAAkBG,QAAQD,CAAI,MAAM,OAIxCF,EAAkBI,KAAKF,CAAI,GAC3BG,QAAQC,KAAM,2DAA0DJ,IAAO;AACjF;AAEe,SAASK,EAA4CC,GAA6BC,GAA8B;AAC7H,SAAOD,EAASE,IAAKC,CAAAA,MAAU;AAC7B,QAAI,CAACA;AACH,aAAO;AAGT,UAAM;AAAA,MAAET,MAAAA;AAAAA,MAAMM,UAAAA;AAAAA,MAAU,GAAGI;AAAAA,IAAW,IAAGD,GACnCE,IAAY9C,GAAuB4C,EAAMT,IAAI;AAEnD,WAAKW,IAKLC,EAAAD,GAAAE,EACiBH,GAAS;AAAA,MAAA,QAAUH;AAAAA,IAAM,CAAA,GAAA;AAAA,MAAA,SACrC,MAAMD,KAAYD,EAAeC,GAAUG,CAAK;AAAA,IAAC,CAAA,KANpDV,GAAsBC,CAAI,GACnB;AAAA,EAQX,CAAC;AACH;;;;;;;;;;iBCrDMc,IAAW,MAAA;;AAAM,cAAApD,IAAAD,EAAM,aAAN,QAAAC,EAAgB,WAAW2C,EAAe5C,EAAM,SAAS,QAAQ,IAAI;AAAA;;;;;;;"}
1
+ {"version":3,"file":"document-viewer.es.js","sources":["../src/types/index.ts","../src/components/nodes/Blockquote.vue","../src/components/nodes/Code.vue","../src/components/nodes/CodeBlock.vue","../src/components/nodes/Emphasis.vue","../src/components/nodes/Heading.vue","../src/components/nodes/LineBreak.vue","../src/components/nodes/Table.vue","../src/components/nodes/TableRow.vue","../src/components/nodes/TableCell.vue","../src/components/nodes/Text.vue","../src/components/nodes/TextBlock.vue","../src/components/nodes/Paragraph.vue","../src/components/nodes/List.vue","../src/components/nodes/ListItem.vue","../src/components/renderChildren.tsx","../src/components/DocumentViewer.vue"],"sourcesContent":["/* eslint-disable no-unused-vars */\nexport interface BaseNode<Type extends string = string> {\n type: Type\n children?: Array<BaseNode>\n}\n\n// TODO: Reach out to DevX for a proper interface\nexport interface Document extends BaseNode<'document'> {\n children: Array<BaseNode>\n version: number\n}\n\nexport enum TableRowSection {\n header = 'header',\n body = 'body',\n footer = 'footer'\n}\n\nexport enum TableCellAlign {\n left = 'left',\n center = 'center',\n right = 'right'\n}\n\nexport interface TableCellNode extends BaseNode<'table_cell'> {\n align?: TableCellAlign\n}\n\nexport interface TableRowNode extends BaseNode<'table_row'> {\n section?: TableRowSection\n children: Array<TableCellNode>\n}\n\nexport interface TextNode extends BaseNode<'text'> {\n text: string\n children: undefined\n appendSpace?: boolean\n}\n\nexport function isTextNode(o: any): o is TextNode {\n return o.type === 'text'\n}\n\nexport interface HeadingNode extends BaseNode<'heading'> {\n level: number\n}\n\nexport interface ListItemNode extends BaseNode<'list_item'> {}\n\nexport interface ListNode extends BaseNode<'list'> {\n isOrdered?: boolean\n children: Array<ListItemNode>\n}\n\nexport interface LinkNode extends BaseNode<'link'> {\n href: string\n}\n","<template>\n <blockquote>\n <slot />\n </blockquote>\n</template>\n\n<style lang=\"scss\" scoped>\nblockquote {\n background: var(--document-viewer-blockquote-background, #f8f8fa);\n border-left: 2.5px solid var(--document-viewer-blockquote-border, var(--text_colors-accent, #0b172d));\n border-radius: var(--document-viewer-blockquote-border-radius, 3px);\n font-size: 14px;\n margin: var(--spacing-sm, 12px) var(--spacing-sm, 12px);\n padding: var(--spacing-sm, 12px);\n\n :deep(blockquote p) {\n margin-bottom: 0;\n }\n\n :deep(p:last-of-type) {\n margin-bottom: 0;\n }\n}\n</style>\n","<template>\n <code>\n <slot />\n </code>\n</template>\n\n<style scoped>\ncode {\n background: var(--document-viewer-code-background, #f1f1f1);\n border-radius: var(--document-viewer-code-border-radius, 3px);\n color: var(--document-viewer-code-color, inherit);\n font-family: var(--document-viewer-code-font-family, var(--document-viewer-font-family-monospace));\n font-size: var(--document-viewer-code-font-size, 14px);\n padding: 4px 6px;\n}\n</style>\n","<template>\n <pre><code><slot /></code></pre>\n</template>\n\n<style scoped>\npre {\n background: var(--document-viewer-code-block-background, #f1f1f1);\n border-radius: var(--document-viewer-code-block-border-radius, 3px);\n color: var(--document-viewer-code-block-color, inherit);\n font-family: var(--document-viewer-code-block-font-family, var(--document-viewer-font-family-monospace));\n font-size: var(--document-viewer-code-block-font-size, 14px);\n margin-bottom: var(--spacing-sm, 12px);\n padding: 12px;\n}\n</style>\n","<template>\n <component :is=\"tag\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nconst props = defineProps({\n level: {\n type: Number,\n default: 1,\n validator(value: unknown): boolean {\n if (!Number.isInteger(value)) {\n return false\n }\n\n const num = value as number\n return num > 0 && num < 3\n },\n },\n})\n\nconst tag = props.level === 1 ? 'em' : 'strong'\n</script>\n","<template>\n <component :is=\"tag\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nconst props = defineProps({\n level: {\n type: Number,\n validator(value: unknown): boolean {\n if (!Number.isInteger(value)) {\n return false\n }\n\n const num = value as number\n\n return num > 0 && num < 7\n },\n default: 1,\n },\n})\n\nconst tag = `h${props.level}`\n</script>\n\n<style scoped>\nh1, h2, h3, h4, h5, h6 {\n color: var(--document-viewer-color, var(--text_colors-headings, #0b172d));\n font-family: var(--document-viewer-font-family-headings, var(--document-viewer-font-family-default));\n font-weight: var(--document-viewer-heading-font-weight, 500);\n margin-top: 0;\n}\n\nh1 {\n font-size: 32px;\n font-weight: 500;\n line-height: 38px;\n margin-bottom: var(--spacing-xxl, 48px);\n}\n\nh2 {\n font-size: 24px;\n line-height: 20px;\n margin-bottom: var(--spacing-lg, 24px);\n}\n\nh3 {\n font-size: 20px;\n line-height: 20px;\n margin-bottom: var(--spacing-sm, 12px);\n}\n\nh4 {\n font-size: 18px;\n line-height: 20px;\n margin-bottom: var(--spacing-sm, 12px);\n}\n\nh5 {\n font-size: 16px;\n line-height: 20px;\n margin-bottom: var(--spacing-sm, 12px);\n}\n\nh6 {\n font-size: 14.5px;\n line-height: 20px;\n margin-bottom: var(--spacing-sm, 12px);\n}\n\nh1:first-child, h2:first-child, h3:first-child, h4:first-child, h5:first-child, h6:first-child {\n margin-top: 0;\n}\n</style>\n","<template>\n <hr>\n</template>\n","<template>\n <table>\n <slot />\n </table>\n</template>\n","<template>\n <component :is=\"tag\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport { PropType } from 'vue'\nimport { TableRowSection } from '../../types'\n\nconst props = defineProps({\n section: {\n type: String as PropType<TableRowSection>,\n default: TableRowSection.body,\n },\n})\n\nlet tag: string\nif (props.section === TableRowSection.header) {\n tag = 'thead'\n} else if (props.section === TableRowSection.body) {\n tag = 'tbody'\n} else if (props.section === TableRowSection.footer) {\n tag = 'tfoot'\n}\n</script>\n","<template>\n <component\n :is=\"tag\"\n :class=\"className\"\n >\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport { PropType } from 'vue'\nimport { TableCellAlign, TableRowNode, TableRowSection } from '../../types'\n\nconst props = defineProps({\n align: {\n type: String as PropType<TableCellAlign>,\n default: TableCellAlign.left,\n },\n parent: {\n type: Object as PropType<TableRowNode>,\n required: true,\n },\n})\n\nconst tag = props.parent?.section === TableRowSection.header ? 'th' : 'td'\n\nlet className: string\nif (props.align === TableCellAlign.center) {\n className = 'align-center'\n} else if (props.align === TableCellAlign.right) {\n className = 'align-right'\n}\n</script>\n\n<style scoped>\nth, td {\n text-align: left;\n}\n\n.align-center {\n text-align: center;\n}\n\n.align-right {\n text-align: right;\n}\n</style>\n","<template>\n {{ text }}<span v-if=\"appendSpace\">&nbsp;</span>\n</template>\n\n<script lang=\"ts\">\nexport default {\n inheritAttrs: false,\n}\n</script>\n<script setup lang=\"ts\">\ndefineProps({\n text: {\n type: String,\n required: true,\n },\n appendSpace: {\n type: Boolean,\n default: false,\n },\n})\n</script>\n","<template>\n <span>\n <slot />\n </span>\n</template>\n","<template>\n <p>\n <slot />\n </p>\n</template>\n\n<style scoped>\np {\n font-size: 14px;\n line-height: 20px;\n margin: var(--document-viewer-paragraph-margin, 0 0 12px);\n}\n</style>\n","<template>\n <component :is=\"tag\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nconst props = defineProps({\n isOrdered: {\n type: Boolean,\n default: false,\n },\n})\n\nconst tag = props.isOrdered ? 'ol' : 'ul'\n</script>\n\n<style scoped>\nul, ol {\n font-size: 14px;\n margin-bottom: var(--spacing-sm, 12px);\n margin-left: 16px;\n padding: 0;\n}\n\nol {\n list-style: decimal;\n}\n\nul {\n list-style: disc;\n}\n</style>\n","<template>\n <li>\n <slot />\n </li>\n</template>\n","import { Component } from 'vue'\nimport { BaseNode, isTextNode } from '../types'\nimport Blockquote from './nodes/Blockquote.vue'\nimport Code from './nodes/Code.vue'\nimport CodeBlock from './nodes/CodeBlock.vue'\nimport Emphasis from './nodes/Emphasis.vue'\nimport Heading from './nodes/Heading.vue'\nimport Image from './nodes/Image.vue'\nimport LineBreak from './nodes/LineBreak.vue'\nimport Table from './nodes/Table.vue'\nimport TableRow from './nodes/TableRow.vue'\nimport TableCell from './nodes/TableCell.vue'\nimport Text from './nodes/Text.vue'\nimport TextBlock from './nodes/TextBlock.vue'\nimport Paragraph from './nodes/Paragraph.vue'\nimport List from './nodes/List.vue'\nimport ListItem from './nodes/ListItem.vue'\nimport Link from './nodes/Link.vue'\n\n// The node to component mapping is currently static but may change in the future\nconst nodeTypeToComponentMap: Record<string, Component> = {\n blockquote: Blockquote,\n code: Code,\n code_block: CodeBlock,\n emphasis: Emphasis,\n heading: Heading,\n image: Image,\n line_break: LineBreak,\n link: Link,\n list: List,\n list_item: ListItem,\n paragraph: Paragraph,\n table: Table,\n table_row: TableRow,\n table_cell: TableCell,\n text: Text,\n text_block: TextBlock,\n}\n\nconst nodeTypesNotified: Array<string> = []\nfunction notifyUnknownNodeType(type: string) {\n if (nodeTypesNotified.indexOf(type) !== -1) {\n return\n }\n\n nodeTypesNotified.push(type)\n console.warn(`[DocumentViewer] Unable to render an unknown node type \"${type}\"`)\n}\n\nexport default function renderChildren<ChildTypes extends BaseNode>(children: Array<ChildTypes>, parent?: BaseNode): Component {\n return children.map((child) => {\n if (!child) {\n return null\n }\n\n const { type, children, ...restProps } = child\n const component = nodeTypeToComponentMap[child.type]\n\n if (!component) {\n notifyUnknownNodeType(type)\n return null\n }\n\n // This is to fix an issue with text blocks that are beside another element\n // not having a space between them\n if (child?.type === 'paragraph' && child?.children) {\n const paragraphChildren = child.children\n const lastItemIndex = paragraphChildren.length - 1\n\n paragraphChildren.forEach((paragraphChild, index) => {\n if (isTextNode(paragraphChild) && !paragraphChild.text?.endsWith(' ') && index !== lastItemIndex) {\n paragraphChild.appendSpace = true\n }\n })\n }\n\n return (\n <component {...restProps} parent={parent}>\n {() => children && renderChildren(children, child)}\n </component>\n )\n })\n}\n","<template>\n <div class=\"document-viewer\">\n <Children />\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport renderChildren from './renderChildren'\n\nconst props = defineProps({\n document: {\n type: Object,\n required: true,\n },\n})\n\nconst Children = () => props.document?.children ? renderChildren(props.document.children) : null\n</script>\n\n<style>\n:root {\n --document-viewer-font-family-default: Roboto, Helvetica, sans-serif;\n --document-viewer-font-family-monospace: Consolas, 'Liberation Mono', Menlo, Courier, monospace;\n}\n</style>\n<style scoped>\n.document-viewer {\n color: var(--document-viewer-color, var(--text_colors-primary, #0b172d));\n font-family: var(--document-viewer-font-family-default, var(--font-family-sans));\n font-size: var(--document-viewer-font-size, 16px);\n}\n</style>\n"],"names":["TableRowSection","TableCellAlign","isTextNode","o","_cache","_openBlock","_createElementBlock","tag","props","_a","className","__default__","nodeTypeToComponentMap","blockquote","Blockquote","code","Code","code_block","CodeBlock","emphasis","Emphasis","heading","Heading","image","Image","line_break","LineBreak","link","Link","list","List","list_item","ListItem","paragraph","Paragraph","table","Table","table_row","TableRow","table_cell","TableCell","text","Text","text_block","TextBlock","nodeTypesNotified","notifyUnknownNodeType","type","indexOf","push","console","warn","renderChildren","children","parent","map","child","restProps","component","paragraphChildren","lastItemIndex","length","forEach","paragraphChild","index","endsWith","appendSpace","_createVNode","_mergeProps","Children"],"mappings":";AAYY,IAAAA,sBAAAA,OACVA,EAAA,SAAS,UACTA,EAAA,OAAO,QACPA,EAAA,SAAS,UAHCA,IAAAA,KAAA,CAAA,CAAA,GAMAC,sBAAAA,OACVA,EAAA,OAAO,QACPA,EAAA,SAAS,UACTA,EAAA,QAAQ,SAHEA,IAAAA,KAAA,CAAA,CAAA;AAqBL,SAASC,EAAWC,GAAuB;AAChD,SAAOA,EAAE,SAAS;AACpB;;;;;;;cCtCeC,GAAA;SADHC,EAAA,GAAAC,EAAA,cAAA,MAAA;AAAA;;;;;cCCHF,GAAA;SADGC,EAAA,GAAAC,EAAA,QAAA,MAAA;AAAA;;;;;cCDsBF,GAAA;SAANC,EAAA,GAAAC,EAAA,OAAA,MAAA;AAAA,MAAP,QAAA,MAAA;AAAA;;;;;;;;;;;;;;;;;;;ACqBrB,UAAMC,MAAY,UAAU,IAAI,OAAO;;;;;;;;;;;;;;;;;;;;;;;ACCjC,UAAAA,IAAM,MAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCtBhBH,GAAA;;;;cCEIA,GAAA;SADEC,EAAA,GAAAC,EAAA,SAAA,MAAA;AAAA;;;;;;;;;;;;;ACeR,QAAAC;AACA,WAAAC,EAAM,YAAYR,EAAgB,SAC9BO,IAAA,UACGC,EAAM,YAAYR,EAAgB,OACrCO,IAAA,UACGC,EAAM,YAAYR,EAAgB,WACrCO,IAAA;;;;;;;;;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ACnCE,IAAY9C,GAAuB4C,EAAMT,IAAI;AAEnD,QAAI,CAACW;AACHZ,aAAAA,GAAsBC,CAAI,GACnB;AAKT,SAAIS,KAAAA,gBAAAA,EAAOT,UAAS,gBAAeS,KAAAA,QAAAA,EAAOH,WAAU;AAClD,YAAMM,IAAoBH,EAAMH,UAC1BO,IAAgBD,EAAkBE,SAAS;AAEjDF,MAAAA,EAAkBG,QAAQ,CAACC,GAAgBC,MAAU;;AACnD,QAAI9D,EAAW6D,CAAc,KAAK,GAACA,IAAAA,EAAetB,SAAfsB,QAAAA,EAAqBE,SAAS,SAAQD,MAAUJ,MACjFG,EAAeG,cAAc;AAAA,MAEjC,CAAC;AAAA,IACH;AAEA,WAAAC,EAAAT,GAAAU,EACiBX,GAAS;AAAA,MAAA,QAAUH;AAAAA,IAAM,CAAA,GAAA;AAAA,MAAA,SACrC,MAAMD,KAAYD,EAAeC,GAAUG,CAAK;AAAA,IAAC,CAAA;AAAA,EAGxD,CAAC;AACH;;;;;;;;;;iBClEMa,IAAW,MAAA;;AAAM,cAAA5D,IAAAD,EAAM,aAAN,QAAAC,EAAgB,WAAW2C,EAAe5C,EAAM,SAAS,QAAQ,IAAI;AAAA;;;;;;;"}
@@ -1,2 +1,2 @@
1
- (function(s,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(s=typeof globalThis<"u"?globalThis:s||self,e(s["kong-ui-public-document-viewer"]={},s.Vue))})(this,function(s,e){"use strict";const re="",c=(t,n)=>{const o=t.__vccOpts||t;for(const[r,l]of n)o[r]=l;return o},u={};function m(t,n){return e.openBlock(),e.createElementBlock("blockquote",null,[e.renderSlot(t.$slots,"default",{},void 0,!0)])}const k=c(u,[["render",m],["__scopeId","data-v-a9ac327a"]]),ce="",h={};function y(t,n){return e.openBlock(),e.createElementBlock("code",null,[e.renderSlot(t.$slots,"default",{},void 0,!0)])}const g=c(h,[["render",y],["__scopeId","data-v-015a6bbb"]]),le="",B={};function $(t,n){return e.openBlock(),e.createElementBlock("pre",null,[e.createElementVNode("code",null,[e.renderSlot(t.$slots,"default",{},void 0,!0)])])}const b=c(B,[["render",$],["__scopeId","data-v-7d7d103e"]]),C=e.defineComponent({__name:"Emphasis",props:{level:{type:Number,default:1,validator(t){if(!Number.isInteger(t))return!1;const n=t;return n>0&&n<3}}},setup(t){const o=t.level===1?"em":"strong";return(r,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(o)),null,{default:e.withCtx(()=>[e.renderSlot(r.$slots,"default")]),_:3}))}}),x=e.defineComponent({__name:"Heading",props:{level:{type:Number,validator(t){if(!Number.isInteger(t))return!1;const n=t;return n>0&&n<7},default:1}},setup(t){const o=`h${t.level}`;return(r,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o),null,{default:e.withCtx(()=>[e.renderSlot(r.$slots,"default",{},void 0,!0)]),_:3}))}}),se="",S=c(x,[["__scopeId","data-v-07152ca1"]]),w=["alt","src","title"],E=e.defineComponent({__name:"Image",props:{url:{type:String,required:!0},alt:{type:String,default:""},title:{type:String,default:""}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("figure",null,[e.createElementVNode("img",{alt:t.alt,src:t.url,title:t.title},null,8,w),e.createElementVNode("figcaption",null,[e.renderSlot(n.$slots,"default")])]))}}),N={};function I(t,n){return e.openBlock(),e.createElementBlock("hr")}const T=c(N,[["render",I]]),V={};function D(t,n){return e.openBlock(),e.createElementBlock("table",null,[e.renderSlot(t.$slots,"default")])}const q=c(V,[["render",D]]);var a=(t=>(t.header="header",t.body="body",t.footer="footer",t))(a||{}),_=(t=>(t.left="left",t.center="center",t.right="right",t))(_||{});const L=e.defineComponent({__name:"TableRow",props:{section:{type:String,default:a.body}},setup(t){const n=t;let o;return n.section===a.header?o="thead":n.section===a.body?o="tbody":n.section===a.footer&&(o="tfoot"),(r,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(o)),null,{default:e.withCtx(()=>[e.renderSlot(r.$slots,"default")]),_:3}))}}),O=e.defineComponent({__name:"TableCell",props:{align:{type:String,default:_.left},parent:{type:Object,required:!0}},setup(t){var l;const n=t,o=((l=n.parent)==null?void 0:l.section)===a.header?"th":"td";let r;return n.align===_.center?r="align-center":n.align===_.right&&(r="align-right"),(d,i)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(o)),{class:e.normalizeClass(e.unref(r))},{default:e.withCtx(()=>[e.renderSlot(d.$slots,"default",{},void 0,!0)]),_:3},8,["class"]))}}),ae="",P=c(O,[["__scopeId","data-v-6da63f53"]]),j={key:0},H={inheritAttrs:!1},M=e.defineComponent({...H,__name:"Text",props:{text:{type:String,required:!0},hardBreak:{type:Boolean,default:!1}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createTextVNode(e.toDisplayString(t.text),1),t.hardBreak?(e.openBlock(),e.createElementBlock("br",j)):e.createCommentVNode("",!0)],64))}}),U={};function z(t,n){return e.openBlock(),e.createElementBlock("span",null,[e.renderSlot(t.$slots,"default")])}const F=c(U,[["render",z]]),_e="",A={};function G(t,n){return e.openBlock(),e.createElementBlock("p",null,[e.renderSlot(t.$slots,"default",{},void 0,!0)])}const J=c(A,[["render",G],["__scopeId","data-v-c7681718"]]),K=e.defineComponent({__name:"List",props:{isOrdered:{type:Boolean,default:!1}},setup(t){const o=t.isOrdered?"ol":"ul";return(r,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(o)),null,{default:e.withCtx(()=>[e.renderSlot(r.$slots,"default",{},void 0,!0)]),_:3}))}}),de="",Q=c(K,[["__scopeId","data-v-f52e8277"]]),R={};function W(t,n){return e.openBlock(),e.createElementBlock("li",null,[e.renderSlot(t.$slots,"default")])}const X=c(R,[["render",W]]),Y=["href","title"],Z=e.defineComponent({__name:"Link",props:{href:{type:String,required:!0},title:{type:String,default:""}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("a",{href:t.href,rel:"noreferrer noopener nofollow",title:t.title},[e.renderSlot(n.$slots,"default",{},void 0,!0)],8,Y))}}),ie="",v={blockquote:k,code:g,code_block:b,emphasis:C,heading:S,image:E,line_break:T,link:c(Z,[["__scopeId","data-v-9b27e235"]]),list:Q,list_item:X,paragraph:J,table:q,table_row:L,table_cell:P,text:M,text_block:F},p=[];function ee(t){p.indexOf(t)===-1&&(p.push(t),console.warn(`[DocumentViewer] Unable to render an unknown node type "${t}"`))}function f(t,n){return t.map(o=>{if(!o)return null;const{type:r,children:l,...d}=o,i=v[o.type];return i?e.createVNode(i,e.mergeProps(d,{parent:n}),{default:()=>l&&f(l,o)}):(ee(r),null)})}const te={class:"document-viewer"},ne=e.defineComponent({__name:"DocumentViewer",props:{document:{type:Object,required:!0}},setup(t){const n=t,o=()=>{var r;return(r=n.document)!=null&&r.children?f(n.document.children):null};return(r,l)=>(e.openBlock(),e.createElementBlock("div",te,[e.createVNode(o)]))}}),fe="",ue="",oe=c(ne,[["__scopeId","data-v-4b223d3a"]]);s.TableCellAlign=_,s.TableRowSection=a,s.default=oe,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(s,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(s=typeof globalThis<"u"?globalThis:s||self,e(s["kong-ui-public-document-viewer"]={},s.Vue))})(this,function(s,e){"use strict";var a=(t=>(t.header="header",t.body="body",t.footer="footer",t))(a||{}),_=(t=>(t.left="left",t.center="center",t.right="right",t))(_||{});function f(t){return t.type==="text"}const de="",c=(t,n)=>{const o=t.__vccOpts||t;for(const[r,l]of n)o[r]=l;return o},g={};function h(t,n){return e.openBlock(),e.createElementBlock("blockquote",null,[e.renderSlot(t.$slots,"default",{},void 0,!0)])}const B=c(g,[["render",h],["__scopeId","data-v-8e8713de"]]),ie="",$={};function b(t,n){return e.openBlock(),e.createElementBlock("code",null,[e.renderSlot(t.$slots,"default",{},void 0,!0)])}const x=c($,[["render",b],["__scopeId","data-v-015a6bbb"]]),pe="",C={};function S(t,n){return e.openBlock(),e.createElementBlock("pre",null,[e.createElementVNode("code",null,[e.renderSlot(t.$slots,"default",{},void 0,!0)])])}const E=c(C,[["render",S],["__scopeId","data-v-7d7d103e"]]),w=e.defineComponent({__name:"Emphasis",props:{level:{type:Number,default:1,validator(t){if(!Number.isInteger(t))return!1;const n=t;return n>0&&n<3}}},setup(t){const o=t.level===1?"em":"strong";return(r,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(o)),null,{default:e.withCtx(()=>[e.renderSlot(r.$slots,"default")]),_:3}))}}),N=e.defineComponent({__name:"Heading",props:{level:{type:Number,validator(t){if(!Number.isInteger(t))return!1;const n=t;return n>0&&n<7},default:1}},setup(t){const o=`h${t.level}`;return(r,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o),null,{default:e.withCtx(()=>[e.renderSlot(r.$slots,"default",{},void 0,!0)]),_:3}))}}),fe="",I=c(N,[["__scopeId","data-v-07152ca1"]]),T=["alt","src","title"],V=e.defineComponent({__name:"Image",props:{url:{type:String,required:!0},alt:{type:String,default:""},title:{type:String,default:""}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("figure",null,[e.createElementVNode("img",{alt:t.alt,src:t.url,title:t.title},null,8,T),e.createElementVNode("figcaption",null,[e.renderSlot(n.$slots,"default")])]))}}),D={};function q(t,n){return e.openBlock(),e.createElementBlock("hr")}const L=c(D,[["render",q]]),O={};function P(t,n){return e.openBlock(),e.createElementBlock("table",null,[e.renderSlot(t.$slots,"default")])}const j=c(O,[["render",P]]),H=e.defineComponent({__name:"TableRow",props:{section:{type:String,default:a.body}},setup(t){const n=t;let o;return n.section===a.header?o="thead":n.section===a.body?o="tbody":n.section===a.footer&&(o="tfoot"),(r,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(o)),null,{default:e.withCtx(()=>[e.renderSlot(r.$slots,"default")]),_:3}))}}),M=e.defineComponent({__name:"TableCell",props:{align:{type:String,default:_.left},parent:{type:Object,required:!0}},setup(t){var l;const n=t,o=((l=n.parent)==null?void 0:l.section)===a.header?"th":"td";let r;return n.align===_.center?r="align-center":n.align===_.right&&(r="align-right"),(d,i)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(o)),{class:e.normalizeClass(e.unref(r))},{default:e.withCtx(()=>[e.renderSlot(d.$slots,"default",{},void 0,!0)]),_:3},8,["class"]))}}),ue="",U=c(M,[["__scopeId","data-v-6da63f53"]]),z={key:0},F={inheritAttrs:!1},W=e.defineComponent({...F,__name:"Text",props:{text:{type:String,required:!0},appendSpace:{type:Boolean,default:!1}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createTextVNode(e.toDisplayString(t.text),1),t.appendSpace?(e.openBlock(),e.createElementBlock("span",z," ")):e.createCommentVNode("",!0)],64))}}),A={};function G(t,n){return e.openBlock(),e.createElementBlock("span",null,[e.renderSlot(t.$slots,"default")])}const J=c(A,[["render",G]]),me="",K={};function Q(t,n){return e.openBlock(),e.createElementBlock("p",null,[e.renderSlot(t.$slots,"default",{},void 0,!0)])}const R=c(K,[["render",Q],["__scopeId","data-v-c7681718"]]),X=e.defineComponent({__name:"List",props:{isOrdered:{type:Boolean,default:!1}},setup(t){const o=t.isOrdered?"ol":"ul";return(r,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(o)),null,{default:e.withCtx(()=>[e.renderSlot(r.$slots,"default",{},void 0,!0)]),_:3}))}}),ke="",Y=c(X,[["__scopeId","data-v-f52e8277"]]),Z={};function v(t,n){return e.openBlock(),e.createElementBlock("li",null,[e.renderSlot(t.$slots,"default")])}const ee=c(Z,[["render",v]]),te=["href","title"],ne=e.defineComponent({__name:"Link",props:{href:{type:String,required:!0},title:{type:String,default:""}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("a",{href:t.href,rel:"noreferrer noopener nofollow",title:t.title},[e.renderSlot(n.$slots,"default",{},void 0,!0)],8,te))}}),ye="",oe={blockquote:B,code:x,code_block:E,emphasis:w,heading:I,image:V,line_break:L,link:c(ne,[["__scopeId","data-v-9b27e235"]]),list:Y,list_item:ee,paragraph:R,table:j,table_row:H,table_cell:U,text:W,text_block:J},u=[];function re(t){u.indexOf(t)===-1&&(u.push(t),console.warn(`[DocumentViewer] Unable to render an unknown node type "${t}"`))}function m(t,n){return t.map(o=>{if(!o)return null;const{type:r,children:l,...d}=o,i=oe[o.type];if(!i)return re(r),null;if((o==null?void 0:o.type)==="paragraph"&&(o!=null&&o.children)){const k=o.children,ae=k.length-1;k.forEach((p,_e)=>{var y;f(p)&&!((y=p.text)!=null&&y.endsWith(" "))&&_e!==ae&&(p.appendSpace=!0)})}return e.createVNode(i,e.mergeProps(d,{parent:n}),{default:()=>l&&m(l,o)})})}const ce={class:"document-viewer"},le=e.defineComponent({__name:"DocumentViewer",props:{document:{type:Object,required:!0}},setup(t){const n=t,o=()=>{var r;return(r=n.document)!=null&&r.children?m(n.document.children):null};return(r,l)=>(e.openBlock(),e.createElementBlock("div",ce,[e.createVNode(o)]))}}),he="",Be="",se=c(le,[["__scopeId","data-v-4b223d3a"]]);s.TableCellAlign=_,s.TableRowSection=a,s.default=se,s.isTextNode=f,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
2
2
  //# sourceMappingURL=document-viewer.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"document-viewer.umd.js","sources":["../src/components/nodes/Blockquote.vue","../src/components/nodes/Code.vue","../src/components/nodes/CodeBlock.vue","../src/components/nodes/Emphasis.vue","../src/components/nodes/Heading.vue","../src/components/nodes/LineBreak.vue","../src/components/nodes/Table.vue","../src/types/index.ts","../src/components/nodes/TableRow.vue","../src/components/nodes/TableCell.vue","../src/components/nodes/Text.vue","../src/components/nodes/TextBlock.vue","../src/components/nodes/Paragraph.vue","../src/components/nodes/List.vue","../src/components/nodes/ListItem.vue","../src/components/renderChildren.tsx","../src/components/DocumentViewer.vue"],"sourcesContent":["<template>\n <blockquote>\n <slot />\n </blockquote>\n</template>\n\n<style scoped>\nblockquote {\n background: var(--document-viewer-blockquote-background, #f8f8fa);\n border-left: 2.5px solid var(--document-viewer-blockquote-border, var(--text_colors-accent, #0b172d));\n border-radius: var(--document-viewer-blockquote-border-radius, 3px);\n font-size: 14px;\n margin: var(--spacing-sm, 12px) var(--spacing-sm, 12px);\n padding: var(--spacing-sm, 12px);\n}\n</style>\n","<template>\n <code>\n <slot />\n </code>\n</template>\n\n<style scoped>\ncode {\n background: var(--document-viewer-code-background, #f1f1f1);\n border-radius: var(--document-viewer-code-border-radius, 3px);\n color: var(--document-viewer-code-color, inherit);\n font-family: var(--document-viewer-code-font-family, var(--document-viewer-font-family-monospace));\n font-size: var(--document-viewer-code-font-size, 14px);\n padding: 4px 6px;\n}\n</style>\n","<template>\n <pre><code><slot /></code></pre>\n</template>\n\n<style scoped>\npre {\n background: var(--document-viewer-code-block-background, #f1f1f1);\n border-radius: var(--document-viewer-code-block-border-radius, 3px);\n color: var(--document-viewer-code-block-color, inherit);\n font-family: var(--document-viewer-code-block-font-family, var(--document-viewer-font-family-monospace));\n font-size: var(--document-viewer-code-block-font-size, 14px);\n margin-bottom: var(--spacing-sm, 12px);\n padding: 12px;\n}\n</style>\n","<template>\n <component :is=\"tag\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nconst props = defineProps({\n level: {\n type: Number,\n default: 1,\n validator(value: unknown): boolean {\n if (!Number.isInteger(value)) {\n return false\n }\n\n const num = value as number\n return num > 0 && num < 3\n },\n },\n})\n\nconst tag = props.level === 1 ? 'em' : 'strong'\n</script>\n","<template>\n <component :is=\"tag\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nconst props = defineProps({\n level: {\n type: Number,\n validator(value: unknown): boolean {\n if (!Number.isInteger(value)) {\n return false\n }\n\n const num = value as number\n\n return num > 0 && num < 7\n },\n default: 1,\n },\n})\n\nconst tag = `h${props.level}`\n</script>\n\n<style scoped>\nh1, h2, h3, h4, h5, h6 {\n color: var(--document-viewer-color, var(--text_colors-headings, #0b172d));\n font-family: var(--document-viewer-font-family-headings, var(--document-viewer-font-family-default));\n font-weight: var(--document-viewer-heading-font-weight, 500);\n margin-top: 0;\n}\n\nh1 {\n font-size: 32px;\n font-weight: 500;\n line-height: 38px;\n margin-bottom: var(--spacing-xxl, 48px);\n}\n\nh2 {\n font-size: 24px;\n line-height: 20px;\n margin-bottom: var(--spacing-lg, 24px);\n}\n\nh3 {\n font-size: 20px;\n line-height: 20px;\n margin-bottom: var(--spacing-sm, 12px);\n}\n\nh4 {\n font-size: 18px;\n line-height: 20px;\n margin-bottom: var(--spacing-sm, 12px);\n}\n\nh5 {\n font-size: 16px;\n line-height: 20px;\n margin-bottom: var(--spacing-sm, 12px);\n}\n\nh6 {\n font-size: 14.5px;\n line-height: 20px;\n margin-bottom: var(--spacing-sm, 12px);\n}\n\nh1:first-child, h2:first-child, h3:first-child, h4:first-child, h5:first-child, h6:first-child {\n margin-top: 0;\n}\n</style>\n","<template>\n <hr>\n</template>\n","<template>\n <table>\n <slot />\n </table>\n</template>\n","/* eslint-disable no-unused-vars */\nexport interface BaseNode<Type extends string = string> {\n type: Type\n children?: Array<BaseNode>\n}\n\n// TODO: Reach out to DevX for a proper interface\nexport interface Document extends BaseNode<'document'> {\n children: Array<BaseNode>\n version: number\n}\n\nexport enum TableRowSection {\n header = 'header',\n body = 'body',\n footer = 'footer'\n}\n\nexport enum TableCellAlign {\n left = 'left',\n center = 'center',\n right = 'right'\n}\n\nexport interface TableCellNode extends BaseNode<'table_cell'> {\n align?: TableCellAlign\n}\n\nexport interface TableRowNode extends BaseNode<'table_row'> {\n section?: TableRowSection\n children: Array<TableCellNode>\n}\n\nexport interface TextNode extends BaseNode<'text'> {\n text: string\n children: undefined\n hardBreak?: boolean\n}\n\nexport interface HeadingNode extends BaseNode<'heading'> {\n level: number\n}\n\nexport interface ListItemNode extends BaseNode<'list_item'> {}\n\nexport interface ListNode extends BaseNode<'list'> {\n isOrdered?: boolean\n children: Array<ListItemNode>\n}\n\nexport interface LinkNode extends BaseNode<'link'> {\n href: string\n}\n","<template>\n <component :is=\"tag\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport { PropType } from 'vue'\nimport { TableRowSection } from '../../types'\n\nconst props = defineProps({\n section: {\n type: String as PropType<TableRowSection>,\n default: TableRowSection.body,\n },\n})\n\nlet tag: string\nif (props.section === TableRowSection.header) {\n tag = 'thead'\n} else if (props.section === TableRowSection.body) {\n tag = 'tbody'\n} else if (props.section === TableRowSection.footer) {\n tag = 'tfoot'\n}\n</script>\n","<template>\n <component\n :is=\"tag\"\n :class=\"className\"\n >\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport { PropType } from 'vue'\nimport { TableCellAlign, TableRowNode, TableRowSection } from '../../types'\n\nconst props = defineProps({\n align: {\n type: String as PropType<TableCellAlign>,\n default: TableCellAlign.left,\n },\n parent: {\n type: Object as PropType<TableRowNode>,\n required: true,\n },\n})\n\nconst tag = props.parent?.section === TableRowSection.header ? 'th' : 'td'\n\nlet className: string\nif (props.align === TableCellAlign.center) {\n className = 'align-center'\n} else if (props.align === TableCellAlign.right) {\n className = 'align-right'\n}\n</script>\n\n<style scoped>\nth, td {\n text-align: left;\n}\n\n.align-center {\n text-align: center;\n}\n\n.align-right {\n text-align: right;\n}\n</style>\n","<template>\n {{ text }}<br v-if=\"hardBreak\">\n</template>\n\n<script lang=\"ts\">\nexport default {\n inheritAttrs: false,\n}\n</script>\n<script setup lang=\"ts\">\ndefineProps({\n text: {\n type: String,\n required: true,\n },\n hardBreak: {\n type: Boolean,\n default: false,\n },\n})\n</script>\n","<template>\n <span>\n <slot />\n </span>\n</template>\n","<template>\n <p>\n <slot />\n </p>\n</template>\n\n<style scoped>\np {\n font-size: 14px;\n line-height: 20px;\n margin: var(--document-viewer-paragraph-margin, 0 0 12px);\n}\n</style>\n","<template>\n <component :is=\"tag\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nconst props = defineProps({\n isOrdered: {\n type: Boolean,\n default: false,\n },\n})\n\nconst tag = props.isOrdered ? 'ol' : 'ul'\n</script>\n\n<style scoped>\nul, ol {\n font-size: 14px;\n margin-bottom: var(--spacing-sm, 12px);\n margin-left: 16px;\n padding: 0;\n}\n\nol {\n list-style: decimal;\n}\n\nul {\n list-style: disc;\n}\n</style>\n","<template>\n <li>\n <slot />\n </li>\n</template>\n","import { Component } from 'vue'\nimport { BaseNode } from '../types'\nimport Blockquote from './nodes/Blockquote.vue'\nimport Code from './nodes/Code.vue'\nimport CodeBlock from './nodes/CodeBlock.vue'\nimport Emphasis from './nodes/Emphasis.vue'\nimport Heading from './nodes/Heading.vue'\nimport Image from './nodes/Image.vue'\nimport LineBreak from './nodes/LineBreak.vue'\nimport Table from './nodes/Table.vue'\nimport TableRow from './nodes/TableRow.vue'\nimport TableCell from './nodes/TableCell.vue'\nimport Text from './nodes/Text.vue'\nimport TextBlock from './nodes/TextBlock.vue'\nimport Paragraph from './nodes/Paragraph.vue'\nimport List from './nodes/List.vue'\nimport ListItem from './nodes/ListItem.vue'\nimport Link from './nodes/Link.vue'\n\n// The node to component mapping is currently static but may change in the future\nconst nodeTypeToComponentMap: Record<string, Component> = {\n blockquote: Blockquote,\n code: Code,\n code_block: CodeBlock,\n emphasis: Emphasis,\n heading: Heading,\n image: Image,\n line_break: LineBreak,\n link: Link,\n list: List,\n list_item: ListItem,\n paragraph: Paragraph,\n table: Table,\n table_row: TableRow,\n table_cell: TableCell,\n text: Text,\n text_block: TextBlock,\n}\n\nconst nodeTypesNotified: Array<string> = []\nfunction notifyUnknownNodeType(type: string) {\n if (nodeTypesNotified.indexOf(type) !== -1) {\n return\n }\n\n nodeTypesNotified.push(type)\n console.warn(`[DocumentViewer] Unable to render an unknown node type \"${type}\"`)\n}\n\nexport default function renderChildren<ChildTypes extends BaseNode>(children: Array<ChildTypes>, parent?: BaseNode): Component {\n return children.map((child) => {\n if (!child) {\n return null\n }\n\n const { type, children, ...restProps } = child\n const component = nodeTypeToComponentMap[child.type]\n\n if (!component) {\n notifyUnknownNodeType(type)\n return null\n }\n\n return (\n <component {...restProps} parent={parent}>\n {() => children && renderChildren(children, child)}\n </component>\n )\n })\n}\n","<template>\n <div class=\"document-viewer\">\n <Children />\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport renderChildren from './renderChildren'\n\nconst props = defineProps({\n document: {\n type: Object,\n required: true,\n },\n})\n\nconst Children = () => props.document?.children ? renderChildren(props.document.children) : null\n</script>\n\n<style>\n:root {\n --document-viewer-font-family-default: Roboto, Helvetica, sans-serif;\n --document-viewer-font-family-monospace: Consolas, 'Liberation Mono', Menlo, Courier, monospace;\n}\n</style>\n<style scoped>\n.document-viewer {\n color: var(--document-viewer-color, var(--text_colors-primary, #0b172d));\n font-family: var(--document-viewer-font-family-default, var(--font-family-sans));\n font-size: var(--document-viewer-font-size, 16px);\n}\n</style>\n"],"names":["_cache","_openBlock","_createElementBlock","tag","TableRowSection","TableCellAlign","props","_a","className","__default__","nodeTypeToComponentMap","blockquote","Blockquote","code","Code","code_block","CodeBlock","emphasis","Emphasis","heading","Heading","image","Image","line_break","LineBreak","link","list","List","list_item","ListItem","paragraph","Paragraph","table","Table","table_row","TableRow","table_cell","TableCell","text","Text","text_block","TextBlock","nodeTypesNotified","notifyUnknownNodeType","type","indexOf","push","console","warn","renderChildren","children","parent","map","child","restProps","component","_createVNode","_mergeProps","Children"],"mappings":"yXAGeA,EAAA,QADHC,YAAA,EAAAC,qBAAA,aAAA,KAAA,qICCHF,EAAA,QADGC,YAAA,EAAAC,qBAAA,OAAA,KAAA,qICDsBF,EAAA,QAANC,YAAA,EAAAC,qBAAA,MAAA,KAAA,GAAP,mBAAA,OAAA,KAAA,8QCqBrB,MAAMC,IAAY,QAAU,EAAI,KAAO,iUCCjC,MAAAA,EAAM,MAAU,wmBCtBhBH,EAAA,+FCEIA,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IAAKC,GAAU,CAC7B,GAAI,CAACA,EACH,OAAO,KAGT,KAAM,CAAET,KAAAA,EAAMM,SAAAA,EAAU,GAAGI,CAAW,EAAGD,EACnCE,EAAY7C,EAAuB2C,EAAMT,IAAI,EAEnD,OAAKW,EAKLC,cAAAD,EAAAE,EAAA,WACiBH,EAAS,CAAA,OAAUH,CAAM,CAAA,EAAA,CAAA,QACrC,IAAMD,GAAYD,EAAeC,EAAUG,CAAK,CAAC,CAAA,GANpDV,GAAsBC,CAAI,EACnB,KAQX,CAAC,CACH,gJCrDMc,EAAW,IAAA,OAAM,OAAAnD,EAAAD,EAAM,WAAN,MAAAC,EAAgB,SAAW0C,EAAe3C,EAAM,SAAS,QAAQ,EAAI"}
1
+ {"version":3,"file":"document-viewer.umd.js","sources":["../src/types/index.ts","../src/components/nodes/Blockquote.vue","../src/components/nodes/Code.vue","../src/components/nodes/CodeBlock.vue","../src/components/nodes/Emphasis.vue","../src/components/nodes/Heading.vue","../src/components/nodes/LineBreak.vue","../src/components/nodes/Table.vue","../src/components/nodes/TableRow.vue","../src/components/nodes/TableCell.vue","../src/components/nodes/Text.vue","../src/components/nodes/TextBlock.vue","../src/components/nodes/Paragraph.vue","../src/components/nodes/List.vue","../src/components/nodes/ListItem.vue","../src/components/renderChildren.tsx","../src/components/DocumentViewer.vue"],"sourcesContent":["/* eslint-disable no-unused-vars */\nexport interface BaseNode<Type extends string = string> {\n type: Type\n children?: Array<BaseNode>\n}\n\n// TODO: Reach out to DevX for a proper interface\nexport interface Document extends BaseNode<'document'> {\n children: Array<BaseNode>\n version: number\n}\n\nexport enum TableRowSection {\n header = 'header',\n body = 'body',\n footer = 'footer'\n}\n\nexport enum TableCellAlign {\n left = 'left',\n center = 'center',\n right = 'right'\n}\n\nexport interface TableCellNode extends BaseNode<'table_cell'> {\n align?: TableCellAlign\n}\n\nexport interface TableRowNode extends BaseNode<'table_row'> {\n section?: TableRowSection\n children: Array<TableCellNode>\n}\n\nexport interface TextNode extends BaseNode<'text'> {\n text: string\n children: undefined\n appendSpace?: boolean\n}\n\nexport function isTextNode(o: any): o is TextNode {\n return o.type === 'text'\n}\n\nexport interface HeadingNode extends BaseNode<'heading'> {\n level: number\n}\n\nexport interface ListItemNode extends BaseNode<'list_item'> {}\n\nexport interface ListNode extends BaseNode<'list'> {\n isOrdered?: boolean\n children: Array<ListItemNode>\n}\n\nexport interface LinkNode extends BaseNode<'link'> {\n href: string\n}\n","<template>\n <blockquote>\n <slot />\n </blockquote>\n</template>\n\n<style lang=\"scss\" scoped>\nblockquote {\n background: var(--document-viewer-blockquote-background, #f8f8fa);\n border-left: 2.5px solid var(--document-viewer-blockquote-border, var(--text_colors-accent, #0b172d));\n border-radius: var(--document-viewer-blockquote-border-radius, 3px);\n font-size: 14px;\n margin: var(--spacing-sm, 12px) var(--spacing-sm, 12px);\n padding: var(--spacing-sm, 12px);\n\n :deep(blockquote p) {\n margin-bottom: 0;\n }\n\n :deep(p:last-of-type) {\n margin-bottom: 0;\n }\n}\n</style>\n","<template>\n <code>\n <slot />\n </code>\n</template>\n\n<style scoped>\ncode {\n background: var(--document-viewer-code-background, #f1f1f1);\n border-radius: var(--document-viewer-code-border-radius, 3px);\n color: var(--document-viewer-code-color, inherit);\n font-family: var(--document-viewer-code-font-family, var(--document-viewer-font-family-monospace));\n font-size: var(--document-viewer-code-font-size, 14px);\n padding: 4px 6px;\n}\n</style>\n","<template>\n <pre><code><slot /></code></pre>\n</template>\n\n<style scoped>\npre {\n background: var(--document-viewer-code-block-background, #f1f1f1);\n border-radius: var(--document-viewer-code-block-border-radius, 3px);\n color: var(--document-viewer-code-block-color, inherit);\n font-family: var(--document-viewer-code-block-font-family, var(--document-viewer-font-family-monospace));\n font-size: var(--document-viewer-code-block-font-size, 14px);\n margin-bottom: var(--spacing-sm, 12px);\n padding: 12px;\n}\n</style>\n","<template>\n <component :is=\"tag\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nconst props = defineProps({\n level: {\n type: Number,\n default: 1,\n validator(value: unknown): boolean {\n if (!Number.isInteger(value)) {\n return false\n }\n\n const num = value as number\n return num > 0 && num < 3\n },\n },\n})\n\nconst tag = props.level === 1 ? 'em' : 'strong'\n</script>\n","<template>\n <component :is=\"tag\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nconst props = defineProps({\n level: {\n type: Number,\n validator(value: unknown): boolean {\n if (!Number.isInteger(value)) {\n return false\n }\n\n const num = value as number\n\n return num > 0 && num < 7\n },\n default: 1,\n },\n})\n\nconst tag = `h${props.level}`\n</script>\n\n<style scoped>\nh1, h2, h3, h4, h5, h6 {\n color: var(--document-viewer-color, var(--text_colors-headings, #0b172d));\n font-family: var(--document-viewer-font-family-headings, var(--document-viewer-font-family-default));\n font-weight: var(--document-viewer-heading-font-weight, 500);\n margin-top: 0;\n}\n\nh1 {\n font-size: 32px;\n font-weight: 500;\n line-height: 38px;\n margin-bottom: var(--spacing-xxl, 48px);\n}\n\nh2 {\n font-size: 24px;\n line-height: 20px;\n margin-bottom: var(--spacing-lg, 24px);\n}\n\nh3 {\n font-size: 20px;\n line-height: 20px;\n margin-bottom: var(--spacing-sm, 12px);\n}\n\nh4 {\n font-size: 18px;\n line-height: 20px;\n margin-bottom: var(--spacing-sm, 12px);\n}\n\nh5 {\n font-size: 16px;\n line-height: 20px;\n margin-bottom: var(--spacing-sm, 12px);\n}\n\nh6 {\n font-size: 14.5px;\n line-height: 20px;\n margin-bottom: var(--spacing-sm, 12px);\n}\n\nh1:first-child, h2:first-child, h3:first-child, h4:first-child, h5:first-child, h6:first-child {\n margin-top: 0;\n}\n</style>\n","<template>\n <hr>\n</template>\n","<template>\n <table>\n <slot />\n </table>\n</template>\n","<template>\n <component :is=\"tag\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport { PropType } from 'vue'\nimport { TableRowSection } from '../../types'\n\nconst props = defineProps({\n section: {\n type: String as PropType<TableRowSection>,\n default: TableRowSection.body,\n },\n})\n\nlet tag: string\nif (props.section === TableRowSection.header) {\n tag = 'thead'\n} else if (props.section === TableRowSection.body) {\n tag = 'tbody'\n} else if (props.section === TableRowSection.footer) {\n tag = 'tfoot'\n}\n</script>\n","<template>\n <component\n :is=\"tag\"\n :class=\"className\"\n >\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nimport { PropType } from 'vue'\nimport { TableCellAlign, TableRowNode, TableRowSection } from '../../types'\n\nconst props = defineProps({\n align: {\n type: String as PropType<TableCellAlign>,\n default: TableCellAlign.left,\n },\n parent: {\n type: Object as PropType<TableRowNode>,\n required: true,\n },\n})\n\nconst tag = props.parent?.section === TableRowSection.header ? 'th' : 'td'\n\nlet className: string\nif (props.align === TableCellAlign.center) {\n className = 'align-center'\n} else if (props.align === TableCellAlign.right) {\n className = 'align-right'\n}\n</script>\n\n<style scoped>\nth, td {\n text-align: left;\n}\n\n.align-center {\n text-align: center;\n}\n\n.align-right {\n text-align: right;\n}\n</style>\n","<template>\n {{ text }}<span v-if=\"appendSpace\">&nbsp;</span>\n</template>\n\n<script lang=\"ts\">\nexport default {\n inheritAttrs: false,\n}\n</script>\n<script setup lang=\"ts\">\ndefineProps({\n text: {\n type: String,\n required: true,\n },\n appendSpace: {\n type: Boolean,\n default: false,\n },\n})\n</script>\n","<template>\n <span>\n <slot />\n </span>\n</template>\n","<template>\n <p>\n <slot />\n </p>\n</template>\n\n<style scoped>\np {\n font-size: 14px;\n line-height: 20px;\n margin: var(--document-viewer-paragraph-margin, 0 0 12px);\n}\n</style>\n","<template>\n <component :is=\"tag\">\n <slot />\n </component>\n</template>\n\n<script setup lang=\"ts\">\nconst props = defineProps({\n isOrdered: {\n type: Boolean,\n default: false,\n },\n})\n\nconst tag = props.isOrdered ? 'ol' : 'ul'\n</script>\n\n<style scoped>\nul, ol {\n font-size: 14px;\n margin-bottom: var(--spacing-sm, 12px);\n margin-left: 16px;\n padding: 0;\n}\n\nol {\n list-style: decimal;\n}\n\nul {\n list-style: disc;\n}\n</style>\n","<template>\n <li>\n <slot />\n </li>\n</template>\n","import { Component } from 'vue'\nimport { BaseNode, isTextNode } from '../types'\nimport Blockquote from './nodes/Blockquote.vue'\nimport Code from './nodes/Code.vue'\nimport CodeBlock from './nodes/CodeBlock.vue'\nimport Emphasis from './nodes/Emphasis.vue'\nimport Heading from './nodes/Heading.vue'\nimport Image from './nodes/Image.vue'\nimport LineBreak from './nodes/LineBreak.vue'\nimport Table from './nodes/Table.vue'\nimport TableRow from './nodes/TableRow.vue'\nimport TableCell from './nodes/TableCell.vue'\nimport Text from './nodes/Text.vue'\nimport TextBlock from './nodes/TextBlock.vue'\nimport Paragraph from './nodes/Paragraph.vue'\nimport List from './nodes/List.vue'\nimport ListItem from './nodes/ListItem.vue'\nimport Link from './nodes/Link.vue'\n\n// The node to component mapping is currently static but may change in the future\nconst nodeTypeToComponentMap: Record<string, Component> = {\n blockquote: Blockquote,\n code: Code,\n code_block: CodeBlock,\n emphasis: Emphasis,\n heading: Heading,\n image: Image,\n line_break: LineBreak,\n link: Link,\n list: List,\n list_item: ListItem,\n paragraph: Paragraph,\n table: Table,\n table_row: TableRow,\n table_cell: TableCell,\n text: Text,\n text_block: TextBlock,\n}\n\nconst nodeTypesNotified: Array<string> = []\nfunction notifyUnknownNodeType(type: string) {\n if (nodeTypesNotified.indexOf(type) !== -1) {\n return\n }\n\n nodeTypesNotified.push(type)\n console.warn(`[DocumentViewer] Unable to render an unknown node type \"${type}\"`)\n}\n\nexport default function renderChildren<ChildTypes extends BaseNode>(children: Array<ChildTypes>, parent?: BaseNode): Component {\n return children.map((child) => {\n if (!child) {\n return null\n }\n\n const { type, children, ...restProps } = child\n const component = nodeTypeToComponentMap[child.type]\n\n if (!component) {\n notifyUnknownNodeType(type)\n return null\n }\n\n // This is to fix an issue with text blocks that are beside another element\n // not having a space between them\n if (child?.type === 'paragraph' && child?.children) {\n const paragraphChildren = child.children\n const lastItemIndex = paragraphChildren.length - 1\n\n paragraphChildren.forEach((paragraphChild, index) => {\n if (isTextNode(paragraphChild) && !paragraphChild.text?.endsWith(' ') && index !== lastItemIndex) {\n paragraphChild.appendSpace = true\n }\n })\n }\n\n return (\n <component {...restProps} parent={parent}>\n {() => children && renderChildren(children, child)}\n </component>\n )\n })\n}\n","<template>\n <div class=\"document-viewer\">\n <Children />\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport renderChildren from './renderChildren'\n\nconst props = defineProps({\n document: {\n type: Object,\n required: true,\n },\n})\n\nconst Children = () => props.document?.children ? renderChildren(props.document.children) : null\n</script>\n\n<style>\n:root {\n --document-viewer-font-family-default: Roboto, Helvetica, sans-serif;\n --document-viewer-font-family-monospace: Consolas, 'Liberation Mono', Menlo, Courier, monospace;\n}\n</style>\n<style scoped>\n.document-viewer {\n color: var(--document-viewer-color, var(--text_colors-primary, #0b172d));\n font-family: var(--document-viewer-font-family-default, var(--font-family-sans));\n font-size: var(--document-viewer-font-size, 16px);\n}\n</style>\n"],"names":["TableRowSection","TableCellAlign","isTextNode","o","_cache","_openBlock","_createElementBlock","tag","props","_a","className","__default__","nodeTypeToComponentMap","blockquote","Blockquote","code","Code","code_block","CodeBlock","emphasis","Emphasis","heading","Heading","image","Image","line_break","LineBreak","link","list","List","list_item","ListItem","paragraph","Paragraph","table","Table","table_row","TableRow","table_cell","TableCell","text","Text","text_block","TextBlock","nodeTypesNotified","notifyUnknownNodeType","type","indexOf","push","console","warn","renderChildren","children","parent","map","child","restProps","component","paragraphChildren","lastItemIndex","length","forEach","paragraphChild","index","endsWith","appendSpace","_createVNode","_mergeProps","Children"],"mappings":"sRAYY,IAAAA,GAAAA,IACVA,EAAA,OAAS,SACTA,EAAA,KAAO,OACPA,EAAA,OAAS,SAHCA,IAAAA,GAAA,CAAA,CAAA,EAMAC,GAAAA,IACVA,EAAA,KAAO,OACPA,EAAA,OAAS,SACTA,EAAA,MAAQ,QAHEA,IAAAA,GAAA,CAAA,CAAA,EAqBL,SAASC,EAAWC,EAAuB,CAChD,OAAOA,EAAE,OAAS,MACpB,oGC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O,EACjF,CAEe,SAASK,EAA4CC,EAA6BC,EAA8B,CAC7H,OAAOD,EAASE,IAAKC,GAAU,CAC7B,GAAI,CAACA,EACH,OAAO,KAGT,KAAM,CAAET,KAAAA,EAAMM,SAAAA,EAAU,GAAGI,CAAW,EAAGD,EACnCE,EAAY7C,GAAuB2C,EAAMT,IAAI,EAEnD,GAAI,CAACW,EACHZ,OAAAA,GAAsBC,CAAI,EACnB,KAKT,IAAIS,GAAAA,YAAAA,EAAOT,QAAS,cAAeS,GAAAA,MAAAA,EAAOH,UAAU,CAClD,MAAMM,EAAoBH,EAAMH,SAC1BO,GAAgBD,EAAkBE,OAAS,EAEjDF,EAAkBG,QAAQ,CAACC,EAAgBC,KAAU,OAC/C7D,EAAW4D,CAAc,GAAK,GAACA,EAAAA,EAAetB,OAAfsB,MAAAA,EAAqBE,SAAS,OAAQD,KAAUJ,KACjFG,EAAeG,YAAc,GAEjC,CAAC,CACH,CAEA,OAAAC,cAAAT,EAAAU,EAAA,WACiBX,EAAS,CAAA,OAAUH,CAAM,CAAA,EAAA,CAAA,QACrC,IAAMD,GAAYD,EAAeC,EAAUG,CAAK,CAAC,CAAA,CAGxD,CAAC,CACH,gJClEMa,EAAW,IAAA,OAAM,OAAA3D,EAAAD,EAAM,WAAN,MAAAC,EAAgB,SAAW0C,EAAe3C,EAAM,SAAS,QAAQ,EAAI"}
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- blockquote[data-v-a9ac327a]{background:#f8f8fa;background:var(--document-viewer-blockquote-background, #f8f8fa);border-left:2.5px solid #0b172d;border-left:2.5px solid var(--document-viewer-blockquote-border, var(--text_colors-accent, #0b172d));border-radius:3px;border-radius:var(--document-viewer-blockquote-border-radius, 3px);font-size:14px;margin:12px;margin:var(--spacing-sm, 12px) var(--spacing-sm, 12px);padding:12px;padding:var(--spacing-sm, 12px)}code[data-v-015a6bbb]{background:#f1f1f1;background:var(--document-viewer-code-background, #f1f1f1);border-radius:3px;border-radius:var(--document-viewer-code-border-radius, 3px);color:inherit;color:var(--document-viewer-code-color, inherit);font-family:var(--document-viewer-font-family-monospace);font-family:var(--document-viewer-code-font-family, var(--document-viewer-font-family-monospace));font-size:14px;font-size:var(--document-viewer-code-font-size, 14px);padding:4px 6px}pre[data-v-7d7d103e]{background:#f1f1f1;background:var(--document-viewer-code-block-background, #f1f1f1);border-radius:3px;border-radius:var(--document-viewer-code-block-border-radius, 3px);color:inherit;color:var(--document-viewer-code-block-color, inherit);font-family:var(--document-viewer-font-family-monospace);font-family:var(--document-viewer-code-block-font-family, var(--document-viewer-font-family-monospace));font-size:14px;font-size:var(--document-viewer-code-block-font-size, 14px);margin-bottom:12px;margin-bottom:var(--spacing-sm, 12px);padding:12px}h1[data-v-07152ca1],h2[data-v-07152ca1],h3[data-v-07152ca1],h4[data-v-07152ca1],h5[data-v-07152ca1],h6[data-v-07152ca1]{color:#0b172d;color:var(--document-viewer-color, var(--text_colors-headings, #0b172d));font-family:var(--document-viewer-font-family-default);font-family:var(--document-viewer-font-family-headings, var(--document-viewer-font-family-default));font-weight:500;font-weight:var(--document-viewer-heading-font-weight, 500);margin-top:0}h1[data-v-07152ca1]{font-size:32px;font-weight:500;line-height:38px;margin-bottom:48px;margin-bottom:var(--spacing-xxl, 48px)}h2[data-v-07152ca1]{font-size:24px;line-height:20px;margin-bottom:24px;margin-bottom:var(--spacing-lg, 24px)}h3[data-v-07152ca1]{font-size:20px;line-height:20px;margin-bottom:12px;margin-bottom:var(--spacing-sm, 12px)}h4[data-v-07152ca1]{font-size:18px;line-height:20px;margin-bottom:12px;margin-bottom:var(--spacing-sm, 12px)}h5[data-v-07152ca1]{font-size:16px;line-height:20px;margin-bottom:12px;margin-bottom:var(--spacing-sm, 12px)}h6[data-v-07152ca1]{font-size:14.5px;line-height:20px;margin-bottom:12px;margin-bottom:var(--spacing-sm, 12px)}h1[data-v-07152ca1]:first-child,h2[data-v-07152ca1]:first-child,h3[data-v-07152ca1]:first-child,h4[data-v-07152ca1]:first-child,h5[data-v-07152ca1]:first-child,h6[data-v-07152ca1]:first-child{margin-top:0}th[data-v-6da63f53],td[data-v-6da63f53]{text-align:left}.align-center[data-v-6da63f53]{text-align:center}.align-right[data-v-6da63f53]{text-align:right}p[data-v-c7681718]{font-size:14px;line-height:20px;margin:0 0 12px;margin:var(--document-viewer-paragraph-margin, 0 0 12px)}ul[data-v-f52e8277],ol[data-v-f52e8277]{font-size:14px;margin-bottom:12px;margin-bottom:var(--spacing-sm, 12px);margin-left:16px;padding:0}ol[data-v-f52e8277]{list-style:decimal}ul[data-v-f52e8277]{list-style:disc}a[data-v-9b27e235]{color:#1155cb;color:var(--document-viewer-link-color, #1155cb);text-decoration:none}a[data-v-9b27e235]:hover{color:#5e8adc;color:var(--document-viewer-link-hover-color, #5e8adc);text-decoration:underline}:root{--document-viewer-font-family-default: Roboto, Helvetica, sans-serif;--document-viewer-font-family-monospace: Consolas, "Liberation Mono", Menlo, Courier, monospace}.document-viewer[data-v-4b223d3a]{color:#0b172d;color:var(--document-viewer-color, var(--text_colors-primary, #0b172d));font-family:var(--font-family-sans);font-family:var(--document-viewer-font-family-default, var(--font-family-sans));font-size:16px;font-size:var(--document-viewer-font-size, 16px)}
1
+ blockquote[data-v-8e8713de]{background:#f8f8fa;background:var(--document-viewer-blockquote-background, #f8f8fa);border-left:2.5px solid #0b172d;border-left:2.5px solid var(--document-viewer-blockquote-border, var(--text_colors-accent, #0b172d));border-radius:3px;border-radius:var(--document-viewer-blockquote-border-radius, 3px);font-size:14px;margin:12px;margin:var(--spacing-sm, 12px) var(--spacing-sm, 12px);padding:12px;padding:var(--spacing-sm, 12px)}blockquote[data-v-8e8713de] blockquote p{margin-bottom:0}blockquote[data-v-8e8713de] p:last-of-type{margin-bottom:0}code[data-v-015a6bbb]{background:#f1f1f1;background:var(--document-viewer-code-background, #f1f1f1);border-radius:3px;border-radius:var(--document-viewer-code-border-radius, 3px);color:inherit;color:var(--document-viewer-code-color, inherit);font-family:var(--document-viewer-code-font-family, var(--document-viewer-font-family-monospace));font-size:14px;font-size:var(--document-viewer-code-font-size, 14px);padding:4px 6px}pre[data-v-7d7d103e]{background:#f1f1f1;background:var(--document-viewer-code-block-background, #f1f1f1);border-radius:3px;border-radius:var(--document-viewer-code-block-border-radius, 3px);color:inherit;color:var(--document-viewer-code-block-color, inherit);font-family:var(--document-viewer-code-block-font-family, var(--document-viewer-font-family-monospace));font-size:14px;font-size:var(--document-viewer-code-block-font-size, 14px);margin-bottom:12px;margin-bottom:var(--spacing-sm, 12px);padding:12px}h1[data-v-07152ca1],h2[data-v-07152ca1],h3[data-v-07152ca1],h4[data-v-07152ca1],h5[data-v-07152ca1],h6[data-v-07152ca1]{color:#0b172d;color:var(--document-viewer-color, var(--text_colors-headings, #0b172d));font-family:var(--document-viewer-font-family-headings, var(--document-viewer-font-family-default));font-weight:500;font-weight:var(--document-viewer-heading-font-weight, 500);margin-top:0}h1[data-v-07152ca1]{font-size:32px;font-weight:500;line-height:38px;margin-bottom:48px;margin-bottom:var(--spacing-xxl, 48px)}h2[data-v-07152ca1]{font-size:24px;line-height:20px;margin-bottom:24px;margin-bottom:var(--spacing-lg, 24px)}h3[data-v-07152ca1]{font-size:20px;line-height:20px;margin-bottom:12px;margin-bottom:var(--spacing-sm, 12px)}h4[data-v-07152ca1]{font-size:18px;line-height:20px;margin-bottom:12px;margin-bottom:var(--spacing-sm, 12px)}h5[data-v-07152ca1]{font-size:16px;line-height:20px;margin-bottom:12px;margin-bottom:var(--spacing-sm, 12px)}h6[data-v-07152ca1]{font-size:14.5px;line-height:20px;margin-bottom:12px;margin-bottom:var(--spacing-sm, 12px)}h1[data-v-07152ca1]:first-child,h2[data-v-07152ca1]:first-child,h3[data-v-07152ca1]:first-child,h4[data-v-07152ca1]:first-child,h5[data-v-07152ca1]:first-child,h6[data-v-07152ca1]:first-child{margin-top:0}th[data-v-6da63f53],td[data-v-6da63f53]{text-align:left}.align-center[data-v-6da63f53]{text-align:center}.align-right[data-v-6da63f53]{text-align:right}p[data-v-c7681718]{font-size:14px;line-height:20px;margin:0 0 12px;margin:var(--document-viewer-paragraph-margin, 0 0 12px)}ul[data-v-f52e8277],ol[data-v-f52e8277]{font-size:14px;margin-bottom:12px;margin-bottom:var(--spacing-sm, 12px);margin-left:16px;padding:0}ol[data-v-f52e8277]{list-style:decimal}ul[data-v-f52e8277]{list-style:disc}a[data-v-9b27e235]{color:#1155cb;color:var(--document-viewer-link-color, #1155cb);text-decoration:none}a[data-v-9b27e235]:hover{color:#5e8adc;color:var(--document-viewer-link-hover-color, #5e8adc);text-decoration:underline}:root{--document-viewer-font-family-default: Roboto, Helvetica, sans-serif;--document-viewer-font-family-monospace: Consolas, "Liberation Mono", Menlo, Courier, monospace}.document-viewer[data-v-4b223d3a]{color:#0b172d;color:var(--document-viewer-color, var(--text_colors-primary, #0b172d));font-family:var(--document-viewer-font-family-default, var(--font-family-sans));font-size:16px;font-size:var(--document-viewer-font-size, 16px)}
@@ -3,7 +3,7 @@ declare const _default: import("vue").DefineComponent<{
3
3
  type: StringConstructor;
4
4
  required: true;
5
5
  };
6
- hardBreak: {
6
+ appendSpace: {
7
7
  type: BooleanConstructor;
8
8
  default: boolean;
9
9
  };
@@ -12,12 +12,12 @@ declare const _default: import("vue").DefineComponent<{
12
12
  type: StringConstructor;
13
13
  required: true;
14
14
  };
15
- hardBreak: {
15
+ appendSpace: {
16
16
  type: BooleanConstructor;
17
17
  default: boolean;
18
18
  };
19
19
  }>>, {
20
- hardBreak: boolean;
20
+ appendSpace: boolean;
21
21
  }>;
22
22
  export default _default;
23
23
  //# sourceMappingURL=Text.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Text.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/nodes/Text.vue.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,wBA0Ec"}
1
+ {"version":3,"file":"Text.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/nodes/Text.vue.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,wBA2Ec"}
@@ -1 +1 @@
1
- {"version":3,"file":"renderChildren.d.ts","sourceRoot":"","sources":["../../../src/components/renderChildren.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAgDnC,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,UAAU,SAAS,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,CAoB7H"}
1
+ {"version":3,"file":"renderChildren.d.ts","sourceRoot":"","sources":["../../../src/components/renderChildren.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAc,MAAM,UAAU,CAAA;AAgD/C,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,UAAU,SAAS,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,CAiC7H"}
@@ -26,8 +26,9 @@ export interface TableRowNode extends BaseNode<'table_row'> {
26
26
  export interface TextNode extends BaseNode<'text'> {
27
27
  text: string;
28
28
  children: undefined;
29
- hardBreak?: boolean;
29
+ appendSpace?: boolean;
30
30
  }
31
+ export declare function isTextNode(o: any): o is TextNode;
31
32
  export interface HeadingNode extends BaseNode<'heading'> {
32
33
  level: number;
33
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,QAAQ,CAAC,IAAI,SAAS,MAAM,GAAG,MAAM;IACpD,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;CAC3B;AAGD,MAAM,WAAW,QAAS,SAAQ,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package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kong-ui-public/document-viewer",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "type": "module",
5
5
  "main": "./dist/document-viewer.umd.js",
6
6
  "module": "./dist/document-viewer.es.js",