davis-components 0.2.77 → 0.2.78

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,569 +0,0 @@
1
- import { r as Te } from "./immutable-rR_5sPGm.js";
2
- import "./main-BmaRtLds.js";
3
- function Oe(e) {
4
- return Ie(e) || we(e) || Se();
5
- }
6
- function Se() {
7
- throw new TypeError("Invalid attempt to spread non-iterable instance");
8
- }
9
- function we(e) {
10
- if (Symbol.iterator in Object(e) || Object.prototype.toString.call(e) === "[object Arguments]") return Array.from(e);
11
- }
12
- function Ie(e) {
13
- if (Array.isArray(e)) {
14
- for (var t = 0, r = new Array(e.length); t < e.length; t++)
15
- r[t] = e[t];
16
- return r;
17
- }
18
- }
19
- function X(e, t) {
20
- var r = Object.keys(e);
21
- return Object.getOwnPropertySymbols && r.push.apply(r, Object.getOwnPropertySymbols(e)), t && (r = r.filter(function(n) {
22
- return Object.getOwnPropertyDescriptor(e, n).enumerable;
23
- })), r;
24
- }
25
- function Z(e) {
26
- for (var t = 1; t < arguments.length; t++) {
27
- var r = arguments[t] != null ? arguments[t] : {};
28
- t % 2 ? X(r, !0).forEach(function(n) {
29
- De(e, n, r[n]);
30
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : X(r).forEach(function(n) {
31
- Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
32
- });
33
- }
34
- return e;
35
- }
36
- function De(e, t, r) {
37
- return t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
38
- }
39
- function Ae(e, t) {
40
- return ke(e) || be(e, t) || Re();
41
- }
42
- function Re() {
43
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
44
- }
45
- function be(e, t) {
46
- var r = [], n = !0, l = !1, a = void 0;
47
- try {
48
- for (var i = e[Symbol.iterator](), o; !(n = (o = i.next()).done) && (r.push(o.value), !(t && r.length === t)); n = !0)
49
- ;
50
- } catch (u) {
51
- l = !0, a = u;
52
- } finally {
53
- try {
54
- !n && i.return != null && i.return();
55
- } finally {
56
- if (l) throw a;
57
- }
58
- }
59
- return r;
60
- }
61
- function ke(e) {
62
- if (Array.isArray(e)) return e;
63
- }
64
- function me(e, t) {
65
- if (e == null)
66
- return t;
67
- for (var r = Ae(t, 2), n = r[0], l = r[1], a = Z({}, n), i = Oe(l), o = 0, u = Object.keys(e); o < u.length; o++) {
68
- var s = u[o];
69
- if (n.hasOwnProperty(s)) {
70
- var h = n[s];
71
- a[s] = Z({}, h, {}, e[s]);
72
- } else
73
- a[s] = e[s], i.push(s);
74
- }
75
- return [a, i];
76
- }
77
- var J = {
78
- acceptCharset: "accept-charset",
79
- className: "class",
80
- htmlFor: "for",
81
- httpEquiv: "http-equiv"
82
- };
83
- function M(e) {
84
- if (e == null)
85
- return e;
86
- for (var t = {}, r = !1, n = 0, l = Object.keys(e); n < l.length; n++) {
87
- var a = l[n], i = a;
88
- J.hasOwnProperty(a) && (i = J[a], r = !0), t[i] = e[a];
89
- }
90
- return r ? t : e;
91
- }
92
- var Le = /^(moz|ms|o|webkit)-/, Pe = /^\d+$/, Ce = /([A-Z])/g, _e = {
93
- animationIterationCount: !0,
94
- borderImageOutset: !0,
95
- borderImageSlice: !0,
96
- borderImageWidth: !0,
97
- boxFlex: !0,
98
- boxFlexGroup: !0,
99
- boxOrdinalGroup: !0,
100
- columnCount: !0,
101
- flex: !0,
102
- flexGrow: !0,
103
- flexPositive: !0,
104
- flexShrink: !0,
105
- flexNegative: !0,
106
- flexOrder: !0,
107
- gridRow: !0,
108
- gridRowEnd: !0,
109
- gridRowSpan: !0,
110
- gridRowStart: !0,
111
- gridColumn: !0,
112
- gridColumnEnd: !0,
113
- gridColumnSpan: !0,
114
- gridColumnStart: !0,
115
- fontWeight: !0,
116
- lineClamp: !0,
117
- lineHeight: !0,
118
- opacity: !0,
119
- order: !0,
120
- orphans: !0,
121
- tabSize: !0,
122
- widows: !0,
123
- zIndex: !0,
124
- zoom: !0,
125
- // SVG-related properties
126
- fillOpacity: !0,
127
- floodOpacity: !0,
128
- stopOpacity: !0,
129
- strokeDasharray: !0,
130
- strokeDashoffset: !0,
131
- strokeMiterlimit: !0,
132
- strokeOpacity: !0,
133
- strokeWidth: !0
134
- };
135
- function Be(e) {
136
- return e.replace(Ce, "-$1").toLowerCase().replace(Le, "-$1-");
137
- }
138
- function Ne(e, t) {
139
- var r;
140
- return typeof t == "string" ? r = Pe.test(t) : (r = !0, t = String(t)), !r || t === "0" || _e[e] === !0 ? t : t + "px";
141
- }
142
- function b(e) {
143
- return Object.keys(e).map(function(t) {
144
- var r = Ne(t, e[t]), n = Be(t);
145
- return "".concat(n, ": ").concat(r);
146
- }).join("; ");
147
- }
148
- var f = {
149
- // This is used to represent a normal text block (paragraph).
150
- UNSTYLED: "unstyled",
151
- HEADER_ONE: "header-one",
152
- HEADER_TWO: "header-two",
153
- HEADER_THREE: "header-three",
154
- HEADER_FOUR: "header-four",
155
- HEADER_FIVE: "header-five",
156
- HEADER_SIX: "header-six",
157
- UNORDERED_LIST_ITEM: "unordered-list-item",
158
- ORDERED_LIST_ITEM: "ordered-list-item",
159
- BLOCKQUOTE: "blockquote",
160
- PULLQUOTE: "pullquote",
161
- CODE: "code-block",
162
- ATOMIC: "atomic"
163
- }, S = {
164
- LINK: "LINK",
165
- IMAGE: "IMAGE"
166
- }, I = {
167
- BOLD: "BOLD",
168
- CODE: "CODE",
169
- ITALIC: "ITALIC",
170
- STRIKETHROUGH: "STRIKETHROUGH",
171
- UNDERLINE: "UNDERLINE"
172
- }, ae = Te(), U = new ae.OrderedSet();
173
- function je(e, t) {
174
- for (var r = null, n = null, l = [], a = 0, i = 0, o = e.length; i < o; i++) {
175
- n = r;
176
- var u = t.get(i);
177
- r = u ? u.getEntity() : null, i > 0 && r !== n && (l.push([n, ee(e.slice(a, i), t.slice(a, i))]), a = i);
178
- }
179
- return l.push([r, ee(e.slice(a), t.slice(a))]), l;
180
- }
181
- function ee(e, t) {
182
- for (var r = U, n = U, l = [], a = 0, i = 0, o = e.length; i < o; i++) {
183
- n = r;
184
- var u = t.get(i);
185
- r = u ? u.getStyle() : U, i > 0 && !ae.is(r, n) && (l.push([e.slice(a, i), n]), a = i);
186
- }
187
- return l.push([e.slice(a), r]), l;
188
- }
189
- var g, k, m;
190
- function re(e, t) {
191
- var r = Object.keys(e);
192
- return Object.getOwnPropertySymbols && r.push.apply(r, Object.getOwnPropertySymbols(e)), t && (r = r.filter(function(n) {
193
- return Object.getOwnPropertyDescriptor(e, n).enumerable;
194
- })), r;
195
- }
196
- function L(e) {
197
- for (var t = 1; t < arguments.length; t++) {
198
- var r = arguments[t] != null ? arguments[t] : {};
199
- t % 2 ? re(r, !0).forEach(function(n) {
200
- c(e, n, r[n]);
201
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : re(r).forEach(function(n) {
202
- Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
203
- });
204
- }
205
- return e;
206
- }
207
- function x(e, t) {
208
- return Ue(e) || Me(e, t) || He();
209
- }
210
- function He() {
211
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
212
- }
213
- function Me(e, t) {
214
- var r = [], n = !0, l = !1, a = void 0;
215
- try {
216
- for (var i = e[Symbol.iterator](), o; !(n = (o = i.next()).done) && (r.push(o.value), !(t && r.length === t)); n = !0)
217
- ;
218
- } catch (u) {
219
- l = !0, a = u;
220
- } finally {
221
- try {
222
- !n && i.return != null && i.return();
223
- } finally {
224
- if (l) throw a;
225
- }
226
- }
227
- return r;
228
- }
229
- function Ue(e) {
230
- if (Array.isArray(e)) return e;
231
- }
232
- function xe(e, t) {
233
- if (!(e instanceof t))
234
- throw new TypeError("Cannot call a class as a function");
235
- }
236
- function We(e, t) {
237
- for (var r = 0; r < t.length; r++) {
238
- var n = t[r];
239
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
240
- }
241
- }
242
- function Fe(e, t, r) {
243
- return t && We(e.prototype, t), e;
244
- }
245
- function c(e, t, r) {
246
- return t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
247
- }
248
- var ie = I.BOLD, W = I.CODE, le = I.ITALIC, oe = I.STRIKETHROUGH, ue = I.UNDERLINE, Ge = " ", se = "<br>", te = /^data-([a-z0-9-]+)$/, Ye = (g = {}, c(g, ie, {
249
- element: "strong"
250
- }), c(g, W, {
251
- element: "code"
252
- }), c(g, le, {
253
- element: "em"
254
- }), c(g, oe, {
255
- element: "del"
256
- }), c(g, ue, {
257
- element: "u"
258
- }), g), ze = [ie, le, ue, oe, W], P = (k = {}, c(k, S.LINK, {
259
- url: "href",
260
- href: "href",
261
- rel: "rel",
262
- target: "target",
263
- title: "title",
264
- className: "class"
265
- }), c(k, S.IMAGE, {
266
- src: "src",
267
- height: "height",
268
- width: "width",
269
- alt: "alt",
270
- className: "class"
271
- }), k), C = (m = {}, c(m, S.LINK, function(e, t) {
272
- for (var r = P.hasOwnProperty(e) ? P[e] : {}, n = t.getData(), l = {}, a = 0, i = Object.keys(n); a < i.length; a++) {
273
- var o = i[a], u = n[o];
274
- if (r.hasOwnProperty(o)) {
275
- var s = r[o];
276
- l[s] = u;
277
- } else te.test(o) && (l[o] = u);
278
- }
279
- return l;
280
- }), c(m, S.IMAGE, function(e, t) {
281
- for (var r = P.hasOwnProperty(e) ? P[e] : {}, n = t.getData(), l = {}, a = 0, i = Object.keys(n); a < i.length; a++) {
282
- var o = i[a], u = n[o];
283
- if (r.hasOwnProperty(o)) {
284
- var s = r[o];
285
- l[s] = u;
286
- } else te.test(o) && (l[o] = u);
287
- }
288
- return l;
289
- }), m);
290
- function ne(e, t) {
291
- switch (e) {
292
- case f.HEADER_ONE:
293
- return ["h1"];
294
- case f.HEADER_TWO:
295
- return ["h2"];
296
- case f.HEADER_THREE:
297
- return ["h3"];
298
- case f.HEADER_FOUR:
299
- return ["h4"];
300
- case f.HEADER_FIVE:
301
- return ["h5"];
302
- case f.HEADER_SIX:
303
- return ["h6"];
304
- case f.UNORDERED_LIST_ITEM:
305
- case f.ORDERED_LIST_ITEM:
306
- return ["li"];
307
- case f.BLOCKQUOTE:
308
- return ["blockquote"];
309
- case f.CODE:
310
- return ["pre", "code"];
311
- case f.ATOMIC:
312
- return ["figure"];
313
- default:
314
- return t === null ? [] : [t || "p"];
315
- }
316
- }
317
- function Ke(e) {
318
- switch (e) {
319
- case f.UNORDERED_LIST_ITEM:
320
- return "ul";
321
- case f.ORDERED_LIST_ITEM:
322
- return "ol";
323
- default:
324
- return null;
325
- }
326
- }
327
- var qe = /* @__PURE__ */ function() {
328
- function e(t, r) {
329
- xe(this, e), c(this, "blocks", void 0), c(this, "contentState", void 0), c(this, "currentBlock", void 0), c(this, "indentLevel", void 0), c(this, "output", void 0), c(this, "totalBlocks", void 0), c(this, "wrapperTag", void 0), c(this, "options", void 0), c(this, "inlineStyles", void 0), c(this, "inlineStyleFn", void 0), c(this, "styleOrder", void 0), r == null && (r = {}), this.contentState = t, this.options = r;
330
- var n = me(r.inlineStyles, [Ye, ze]), l = x(n, 2), a = l[0], i = l[1];
331
- this.inlineStyles = a, this.inlineStyleFn = r.inlineStyleFn, this.styleOrder = i;
332
- }
333
- return Fe(e, [{
334
- key: "generate",
335
- value: function() {
336
- for (this.output = [], this.blocks = this.contentState.getBlocksAsArray(), this.totalBlocks = this.blocks.length, this.currentBlock = 0, this.indentLevel = 0, this.wrapperTag = null; this.currentBlock < this.totalBlocks; )
337
- this.processBlock();
338
- return this.closeWrapperTag(), this.output.join("").trim();
339
- }
340
- }, {
341
- key: "processBlock",
342
- value: function() {
343
- var r = this.options, n = r.blockRenderers, l = r.defaultBlockTag, a = this.blocks[this.currentBlock], i = a.getType(), o = Ke(i);
344
- this.wrapperTag !== o && (this.wrapperTag && this.closeWrapperTag(), o && this.openWrapperTag(o)), this.indent();
345
- var u = n != null && n.hasOwnProperty(i) ? n[i] : null, s = u ? u(a) : null;
346
- if (s != null) {
347
- this.output.push(s), this.output.push(`
348
- `), this.currentBlock += 1;
349
- return;
350
- }
351
- this.writeStartTag(a, l), this.output.push(this.renderBlockContent(a));
352
- var h = this.getNextBlock();
353
- if ($e(i) && h && h.getDepth() === a.getDepth() + 1) {
354
- this.output.push(`
355
- `);
356
- var y = this.wrapperTag;
357
- this.wrapperTag = null, this.indentLevel += 1, this.currentBlock += 1, this.processBlocksAtDepth(h.getDepth()), this.wrapperTag = y, this.indentLevel -= 1, this.indent();
358
- } else
359
- this.currentBlock += 1;
360
- this.writeEndTag(a, l);
361
- }
362
- }, {
363
- key: "processBlocksAtDepth",
364
- value: function(r) {
365
- for (var n = this.blocks[this.currentBlock]; n && n.getDepth() === r; )
366
- this.processBlock(), n = this.blocks[this.currentBlock];
367
- this.closeWrapperTag();
368
- }
369
- }, {
370
- key: "getNextBlock",
371
- value: function() {
372
- return this.blocks[this.currentBlock + 1];
373
- }
374
- }, {
375
- key: "writeStartTag",
376
- value: function(r, n) {
377
- var l = ne(r.getType(), n), a;
378
- if (this.options.blockStyleFn) {
379
- var i = this.options.blockStyleFn(r) || {}, o = i.attributes, u = i.style;
380
- if (o = M(o), u != null) {
381
- var s = b(u);
382
- o = o == null ? {
383
- style: s
384
- } : L({}, o, {
385
- style: s
386
- });
387
- }
388
- a = O(o);
389
- } else
390
- a = "";
391
- var h = !0, y = !1, E = void 0;
392
- try {
393
- for (var v = l[Symbol.iterator](), p; !(h = (p = v.next()).done); h = !0) {
394
- var D = p.value;
395
- this.output.push("<".concat(D).concat(a, ">"));
396
- }
397
- } catch (w) {
398
- y = !0, E = w;
399
- } finally {
400
- try {
401
- !h && v.return != null && v.return();
402
- } finally {
403
- if (y)
404
- throw E;
405
- }
406
- }
407
- }
408
- }, {
409
- key: "writeEndTag",
410
- value: function(r, n) {
411
- var l = ne(r.getType(), n);
412
- if (l.length === 1)
413
- this.output.push("</".concat(l[0], `>
414
- `));
415
- else {
416
- var a = [], i = !0, o = !1, u = void 0;
417
- try {
418
- for (var s = l[Symbol.iterator](), h; !(i = (h = s.next()).done); i = !0) {
419
- var y = h.value;
420
- a.unshift("</".concat(y, ">"));
421
- }
422
- } catch (E) {
423
- o = !0, u = E;
424
- } finally {
425
- try {
426
- !i && s.return != null && s.return();
427
- } finally {
428
- if (o)
429
- throw u;
430
- }
431
- }
432
- this.output.push(a.join("") + `
433
- `);
434
- }
435
- }
436
- }, {
437
- key: "openWrapperTag",
438
- value: function(r) {
439
- this.wrapperTag = r, this.indent(), this.output.push("<".concat(r, `>
440
- `)), this.indentLevel += 1;
441
- }
442
- }, {
443
- key: "closeWrapperTag",
444
- value: function() {
445
- var r = this.wrapperTag;
446
- r && (this.indentLevel -= 1, this.indent(), this.output.push("</".concat(r, `>
447
- `)), this.wrapperTag = null);
448
- }
449
- }, {
450
- key: "indent",
451
- value: function() {
452
- this.output.push(Ge.repeat(this.indentLevel));
453
- }
454
- }, {
455
- key: "withCustomInlineStyles",
456
- value: function(r, n) {
457
- if (!this.inlineStyleFn)
458
- return r;
459
- var l = this.inlineStyleFn(n);
460
- if (!l)
461
- return r;
462
- var a = l.element, i = a === void 0 ? "span" : a, o = l.attributes, u = l.style, s = O(L({}, o, {
463
- style: u && b(u)
464
- }));
465
- return "<".concat(i).concat(s, ">").concat(r, "</").concat(i, ">");
466
- }
467
- }, {
468
- key: "renderBlockContent",
469
- value: function(r) {
470
- var n = this, l = r.getType(), a = r.getText();
471
- if (a === "")
472
- return se;
473
- a = this.preserveWhitespace(a);
474
- var i = r.getCharacterList(), o = je(a, i);
475
- return o.map(function(u) {
476
- var s = x(u, 2), h = s[0], y = s[1], E = y.map(function(ye) {
477
- var Y = x(ye, 2), Ee = Y[0], z = Y[1], _ = Qe(Ee), B = !0, K = !1, q = void 0;
478
- try {
479
- for (var N = n.styleOrder[Symbol.iterator](), $; !(B = ($ = N.next()).done); B = !0) {
480
- var j = $.value;
481
- if (!(j === W && l === f.CODE) && z.has(j)) {
482
- var H = n.inlineStyles[j], R = H.element, T = H.attributes, Q = H.style;
483
- if (R == null && (R = "span"), T = M(T), Q != null) {
484
- var V = b(Q);
485
- T = T == null ? {
486
- style: V
487
- } : L({}, T, {
488
- style: V
489
- });
490
- }
491
- var ge = O(T);
492
- _ = "<".concat(R).concat(ge, ">").concat(_, "</").concat(R, ">");
493
- }
494
- }
495
- } catch (de) {
496
- K = !0, q = de;
497
- } finally {
498
- try {
499
- !B && N.return != null && N.return();
500
- } finally {
501
- if (K)
502
- throw q;
503
- }
504
- }
505
- return n.withCustomInlineStyles(_, z);
506
- }).join(""), v = h ? n.contentState.getEntity(h) : null, p = v == null ? null : v.getType().toUpperCase(), D;
507
- if (v != null && n.options.entityStyleFn && (D = n.options.entityStyleFn(v))) {
508
- var w = D, A = w.element, d = w.attributes, F = w.style;
509
- if (A == null && (A = "span"), d = M(d), F != null) {
510
- var G = b(F);
511
- d = d == null ? {
512
- style: G
513
- } : L({}, d, {
514
- style: G
515
- });
516
- }
517
- var ce = O(d);
518
- return "<".concat(A).concat(ce, ">").concat(E, "</").concat(A, ">");
519
- } else if (p != null && p === S.LINK) {
520
- var fe = C.hasOwnProperty(p) ? C[p](p, v) : null, he = O(fe);
521
- return "<a".concat(he, ">").concat(E, "</a>");
522
- } else if (p != null && p === S.IMAGE) {
523
- var pe = C.hasOwnProperty(p) ? C[p](p, v) : null, ve = O(pe);
524
- return "<img".concat(ve, "/>");
525
- } else
526
- return E;
527
- }).join("");
528
- }
529
- }, {
530
- key: "preserveWhitespace",
531
- value: function(r) {
532
- for (var n = r.length, l = new Array(n), a = 0; a < n; a++)
533
- r[a] === " " && (a === 0 || a === n - 1 || r[a - 1] === " ") ? l[a] = " " : l[a] = r[a];
534
- return l.join("");
535
- }
536
- }]), e;
537
- }();
538
- function O(e) {
539
- if (e == null)
540
- return "";
541
- for (var t = [], r = 0, n = Object.keys(e); r < n.length; r++) {
542
- var l = n[r], a = e[l];
543
- a != null && t.push(" ".concat(l, '="').concat(Ve(a + ""), '"'));
544
- }
545
- return t.join("");
546
- }
547
- function $e(e) {
548
- switch (e) {
549
- case f.UNORDERED_LIST_ITEM:
550
- case f.ORDERED_LIST_ITEM:
551
- return !0;
552
- default:
553
- return !1;
554
- }
555
- }
556
- function Qe(e) {
557
- return e.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;").split(" ").join("&nbsp;").split(`
558
- `).join(se + `
559
- `);
560
- }
561
- function Ve(e) {
562
- return e.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;").split('"').join("&quot;");
563
- }
564
- function Je(e, t) {
565
- return new qe(e, t).generate();
566
- }
567
- export {
568
- Je as stateToHTML
569
- };