davis-components 0.2.34 → 0.2.62

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.
@@ -0,0 +1,175 @@
1
+ import { g as ct, D as ft } from "./main-CZpQW1NC.js";
2
+ import { r as dt } from "./immutable-DRDRJfC7.js";
3
+ function pt(L, H) {
4
+ for (var w = 0; w < H.length; w++) {
5
+ const h = H[w];
6
+ if (typeof h != "string" && !Array.isArray(h)) {
7
+ for (const o in h)
8
+ if (o !== "default" && !(o in L)) {
9
+ const T = Object.getOwnPropertyDescriptor(h, o);
10
+ T && Object.defineProperty(L, o, T.get ? T : {
11
+ enumerable: !0,
12
+ get: () => h[o]
13
+ });
14
+ }
15
+ }
16
+ }
17
+ return Object.freeze(Object.defineProperty(L, Symbol.toStringTag, { value: "Module" }));
18
+ }
19
+ var G = { exports: {} };
20
+ (function(L, H) {
21
+ (function(w, h) {
22
+ L.exports = h(dt(), ft);
23
+ })(window, function(w, h) {
24
+ return A = {}, o.m = T = [function(e, r) {
25
+ e.exports = w;
26
+ }, function(e, r) {
27
+ e.exports = h;
28
+ }, function(e, r, s) {
29
+ e.exports = s(3);
30
+ }, function(e, r, s) {
31
+ s.r(r);
32
+ var u = s(1), l = s(0), W = function(t) {
33
+ var a, i = null;
34
+ return document.implementation && document.implementation.createHTMLDocument && ((a = document.implementation.createHTMLDocument("foo")).documentElement.innerHTML = t, i = a.getElementsByTagName("body")[0]), i;
35
+ }, J = function(t, a, i) {
36
+ var d, p = t.textContent;
37
+ return p.trim() === "" ? { chunk: (d = i, { text: " ", inlines: [new l.OrderedSet()], entities: [d], blocks: [] }) } : { chunk: { text: p, inlines: Array(p.length).fill(a), entities: Array(p.length).fill(i), blocks: [] } };
38
+ }, Q = function() {
39
+ return { text: `
40
+ `, inlines: [new l.OrderedSet()], entities: new Array(1), blocks: [] };
41
+ }, X = function() {
42
+ return { text: "", inlines: [], entities: [], blocks: [] };
43
+ }, Y = function(t, a) {
44
+ return { text: "", inlines: [], entities: [], blocks: [{ type: t, depth: 0, data: a || new l.Map({}) }] };
45
+ }, Z = function(t, a, i) {
46
+ return { text: "\r", inlines: [], entities: [], blocks: [{ type: t, depth: Math.max(0, Math.min(4, a)), data: i || new l.Map({}) }] };
47
+ }, D = function(t) {
48
+ return { text: "\r ", inlines: [new l.OrderedSet()], entities: [t], blocks: [{ type: "atomic", depth: 0, data: new l.Map({}) }] };
49
+ }, tt = function(t, a) {
50
+ return { text: t.text + a.text, inlines: t.inlines.concat(a.inlines), entities: t.entities.concat(a.entities), blocks: t.blocks.concat(a.blocks) };
51
+ }, et = new l.Map({ "header-one": { element: "h1" }, "header-two": { element: "h2" }, "header-three": { element: "h3" }, "header-four": { element: "h4" }, "header-five": { element: "h5" }, "header-six": { element: "h6" }, "unordered-list-item": { element: "li", wrapper: "ul" }, "ordered-list-item": { element: "li", wrapper: "ol" }, blockquote: { element: "blockquote" }, code: { element: "pre" }, atomic: { element: "figure" }, unstyled: { element: "p", aliasedElements: ["div"] } }), I = { code: "CODE", del: "STRIKETHROUGH", em: "ITALIC", strong: "BOLD", ins: "UNDERLINE", sub: "SUBSCRIPT", sup: "SUPERSCRIPT" };
52
+ function U(t) {
53
+ return t.style.textAlign ? new l.Map({ "text-align": t.style.textAlign }) : t.style.marginLeft ? new l.Map({ "margin-left": t.style.marginLeft }) : void 0;
54
+ }
55
+ var nt = function(t) {
56
+ var a = void 0;
57
+ if (t instanceof HTMLAnchorElement) {
58
+ var i = {};
59
+ a = t.dataset && t.dataset.mention !== void 0 ? (i.url = t.href, i.text = t.innerHTML, i.value = t.dataset.value, u.Entity.__create("MENTION", "IMMUTABLE", i)) : (i.url = t.getAttribute && t.getAttribute("href") || t.href, i.title = t.innerHTML, i.targetOption = t.target, u.Entity.__create("LINK", "MUTABLE", i));
60
+ }
61
+ return a;
62
+ };
63
+ s.d(r, "default", function() {
64
+ return at;
65
+ });
66
+ var rt = " ", it = new RegExp("&nbsp;", "g"), B = !0;
67
+ function R(t, a, i, d, p, O) {
68
+ var n = t.nodeName.toLowerCase();
69
+ if (O) {
70
+ var g = O(n, t);
71
+ if (g) {
72
+ var _ = u.Entity.__create(g.type, g.mutability, g.data || {});
73
+ return { chunk: D(_) };
74
+ }
75
+ }
76
+ if (n === "#text" && t.textContent !== `
77
+ `) return J(t, a, p);
78
+ if (n === "br") return { chunk: Q() };
79
+ if (n === "img" && t instanceof HTMLImageElement) {
80
+ var c = {};
81
+ c.src = t.getAttribute && t.getAttribute("src") || t.src, c.alt = t.alt, c.height = t.style.height, c.width = t.style.width, t.style.float && (c.alignment = t.style.float);
82
+ var b = u.Entity.__create("IMAGE", "MUTABLE", c);
83
+ return { chunk: D(b) };
84
+ }
85
+ if (n === "video" && t instanceof HTMLVideoElement) {
86
+ var m = {};
87
+ m.src = t.getAttribute && t.getAttribute("src") || t.src, m.alt = t.alt, m.height = t.style.height, m.width = t.style.width, t.style.float && (m.alignment = t.style.float);
88
+ var P = u.Entity.__create("VIDEO", "MUTABLE", m);
89
+ return { chunk: D(P) };
90
+ }
91
+ if (n === "iframe" && t instanceof HTMLIFrameElement) {
92
+ var E = {};
93
+ E.src = t.getAttribute && t.getAttribute("src") || t.src, E.height = t.height, E.width = t.width;
94
+ var N = u.Entity.__create("EMBEDDED_LINK", "MUTABLE", E);
95
+ return { chunk: D(N) };
96
+ }
97
+ var y, v = function(S, C) {
98
+ var j = et.filter(function(f) {
99
+ return f.element === S && (!f.wrapper || f.wrapper === C) || f.wrapper === S || f.aliasedElements && -1 < f.aliasedElements.indexOf(S);
100
+ }).keySeq().toSet().toArray();
101
+ if (j.length === 1) return j[0];
102
+ }(n, d);
103
+ v && (n === "ul" || n === "ol" ? (d = n, i += 1) : (v !== "unordered-list-item" && v !== "ordered-list-item" && (d = "", i = -1), B ? (y = Y(v, U(t)), B = !1) : y = Z(v, i, U(t)))), y = y || X(), a = function(S, C, j) {
104
+ var f, q = I[S];
105
+ if (q) f = j.add(q).toOrderedSet();
106
+ else if (C instanceof HTMLElement) {
107
+ var M = C;
108
+ f = (f = j).withMutations(function(k) {
109
+ var K = M.style.color, $ = M.style.backgroundColor, z = M.style.fontSize, F = M.style.fontFamily.replace(/^"|"$/g, ""), lt = M.style.fontWeight, st = M.style.textDecoration, ut = M.style.fontStyle;
110
+ K && k.add("color-".concat(K.replace(/ /g, ""))), $ && k.add("bgcolor-".concat($.replace(/ /g, ""))), z && k.add("fontsize-".concat(z.replace(/px$/g, ""))), F && k.add("fontfamily-".concat(F)), lt === "bold" && k.add(I.strong), st === "underline" && k.add(I.ins), ut === "italic" && k.add(I.em);
111
+ }).toOrderedSet();
112
+ }
113
+ return f;
114
+ }(n, t, a);
115
+ for (var x = t.firstChild; x; ) {
116
+ var ot = R(x, a, i, d, nt(x) || p, O).chunk;
117
+ y = tt(y, ot), x = x.nextSibling;
118
+ }
119
+ return { chunk: y };
120
+ }
121
+ function at(t, a) {
122
+ var i, d, p, O = (i = a, d = t.trim().replace(it, rt), (p = W(d)) ? (B = !0, { chunk: R(p, new l.OrderedSet(), -1, "", void 0, i).chunk }) : null);
123
+ if (O) {
124
+ var n = O.chunk, g = new l.OrderedMap({});
125
+ n.entities && n.entities.forEach(function(c) {
126
+ c && (g = g.set(c, u.Entity.__get(c)));
127
+ });
128
+ var _ = 0;
129
+ return { contentBlocks: n.text.split("\r").map(function(c, b) {
130
+ var m = _ + c.length, P = n && n.inlines.slice(_, m), E = n && n.entities.slice(_, m), N = new l.List(P.map(function(y, v) {
131
+ var x = { style: y, entity: null };
132
+ return E[v] && (x.entity = E[v]), u.CharacterMetadata.create(x);
133
+ }));
134
+ return _ = m, new u.ContentBlock({ key: Object(u.genKey)(), type: n && n.blocks[b] && n.blocks[b].type || "unstyled", depth: n && n.blocks[b] && n.blocks[b].depth, data: n && n.blocks[b] && n.blocks[b].data || new l.Map({}), text: c, characterList: N });
135
+ }), entityMap: g };
136
+ }
137
+ return null;
138
+ }
139
+ }], o.c = A, o.d = function(e, r, s) {
140
+ o.o(e, r) || Object.defineProperty(e, r, { enumerable: !0, get: s });
141
+ }, o.r = function(e) {
142
+ typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e, "__esModule", { value: !0 });
143
+ }, o.t = function(e, r) {
144
+ if (1 & r && (e = o(e)), 8 & r || 4 & r && typeof e == "object" && e && e.__esModule) return e;
145
+ var s = /* @__PURE__ */ Object.create(null);
146
+ if (o.r(s), Object.defineProperty(s, "default", { enumerable: !0, value: e }), 2 & r && typeof e != "string") for (var u in e) o.d(s, u, function(l) {
147
+ return e[l];
148
+ }.bind(null, u));
149
+ return s;
150
+ }, o.n = function(e) {
151
+ var r = e && e.__esModule ? function() {
152
+ return e.default;
153
+ } : function() {
154
+ return e;
155
+ };
156
+ return o.d(r, "a", r), r;
157
+ }, o.o = function(e, r) {
158
+ return Object.prototype.hasOwnProperty.call(e, r);
159
+ }, o.p = "", o(o.s = 2);
160
+ function o(e) {
161
+ if (A[e]) return A[e].exports;
162
+ var r = A[e] = { i: e, l: !1, exports: {} };
163
+ return T[e].call(r.exports, r, r.exports, o), r.l = !0, r.exports;
164
+ }
165
+ var T, A;
166
+ });
167
+ })(G);
168
+ var V = G.exports;
169
+ const mt = /* @__PURE__ */ ct(V), gt = /* @__PURE__ */ pt({
170
+ __proto__: null,
171
+ default: mt
172
+ }, [V]);
173
+ export {
174
+ gt as h
175
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";const G=require("./main-Dp31xoXp.cjs"),ft=require("./immutable-DgYntGke.cjs");function dt(L,H){for(var w=0;w<H.length;w++){const h=H[w];if(typeof h!="string"&&!Array.isArray(h)){for(const o in h)if(o!=="default"&&!(o in L)){const T=Object.getOwnPropertyDescriptor(h,o);T&&Object.defineProperty(L,o,T.get?T:{enumerable:!0,get:()=>h[o]})}}}return Object.freeze(Object.defineProperty(L,Symbol.toStringTag,{value:"Module"}))}var V={exports:{}};(function(L,H){(function(w,h){L.exports=h(ft.requireImmutable(),G.Draft)})(window,function(w,h){return A={},o.m=T=[function(e,r){e.exports=w},function(e,r){e.exports=h},function(e,r,u){e.exports=u(3)},function(e,r,u){u.r(r);var c=u(1),l=u(0),J=function(t){var a,i=null;return document.implementation&&document.implementation.createHTMLDocument&&((a=document.implementation.createHTMLDocument("foo")).documentElement.innerHTML=t,i=a.getElementsByTagName("body")[0]),i},Q=function(t,a,i){var d,m=t.textContent;return m.trim()===""?{chunk:(d=i,{text:" ",inlines:[new l.OrderedSet],entities:[d],blocks:[]})}:{chunk:{text:m,inlines:Array(m.length).fill(a),entities:Array(m.length).fill(i),blocks:[]}}},X=function(){return{text:`
2
+ `,inlines:[new l.OrderedSet],entities:new Array(1),blocks:[]}},Y=function(){return{text:"",inlines:[],entities:[],blocks:[]}},Z=function(t,a){return{text:"",inlines:[],entities:[],blocks:[{type:t,depth:0,data:a||new l.Map({})}]}},tt=function(t,a,i){return{text:"\r",inlines:[],entities:[],blocks:[{type:t,depth:Math.max(0,Math.min(4,a)),data:i||new l.Map({})}]}},D=function(t){return{text:"\r ",inlines:[new l.OrderedSet],entities:[t],blocks:[{type:"atomic",depth:0,data:new l.Map({})}]}},et=function(t,a){return{text:t.text+a.text,inlines:t.inlines.concat(a.inlines),entities:t.entities.concat(a.entities),blocks:t.blocks.concat(a.blocks)}},nt=new l.Map({"header-one":{element:"h1"},"header-two":{element:"h2"},"header-three":{element:"h3"},"header-four":{element:"h4"},"header-five":{element:"h5"},"header-six":{element:"h6"},"unordered-list-item":{element:"li",wrapper:"ul"},"ordered-list-item":{element:"li",wrapper:"ol"},blockquote:{element:"blockquote"},code:{element:"pre"},atomic:{element:"figure"},unstyled:{element:"p",aliasedElements:["div"]}}),I={code:"CODE",del:"STRIKETHROUGH",em:"ITALIC",strong:"BOLD",ins:"UNDERLINE",sub:"SUBSCRIPT",sup:"SUPERSCRIPT"};function U(t){return t.style.textAlign?new l.Map({"text-align":t.style.textAlign}):t.style.marginLeft?new l.Map({"margin-left":t.style.marginLeft}):void 0}var rt=function(t){var a=void 0;if(t instanceof HTMLAnchorElement){var i={};a=t.dataset&&t.dataset.mention!==void 0?(i.url=t.href,i.text=t.innerHTML,i.value=t.dataset.value,c.Entity.__create("MENTION","IMMUTABLE",i)):(i.url=t.getAttribute&&t.getAttribute("href")||t.href,i.title=t.innerHTML,i.targetOption=t.target,c.Entity.__create("LINK","MUTABLE",i))}return a};u.d(r,"default",function(){return ot});var it=" ",at=new RegExp("&nbsp;","g"),B=!0;function R(t,a,i,d,m,O){var n=t.nodeName.toLowerCase();if(O){var g=O(n,t);if(g){var _=c.Entity.__create(g.type,g.mutability,g.data||{});return{chunk:D(_)}}}if(n==="#text"&&t.textContent!==`
3
+ `)return Q(t,a,m);if(n==="br")return{chunk:X()};if(n==="img"&&t instanceof HTMLImageElement){var s={};s.src=t.getAttribute&&t.getAttribute("src")||t.src,s.alt=t.alt,s.height=t.style.height,s.width=t.style.width,t.style.float&&(s.alignment=t.style.float);var b=c.Entity.__create("IMAGE","MUTABLE",s);return{chunk:D(b)}}if(n==="video"&&t instanceof HTMLVideoElement){var p={};p.src=t.getAttribute&&t.getAttribute("src")||t.src,p.alt=t.alt,p.height=t.style.height,p.width=t.style.width,t.style.float&&(p.alignment=t.style.float);var P=c.Entity.__create("VIDEO","MUTABLE",p);return{chunk:D(P)}}if(n==="iframe"&&t instanceof HTMLIFrameElement){var E={};E.src=t.getAttribute&&t.getAttribute("src")||t.src,E.height=t.height,E.width=t.width;var N=c.Entity.__create("EMBEDDED_LINK","MUTABLE",E);return{chunk:D(N)}}var y,v=function(S,C){var j=nt.filter(function(f){return f.element===S&&(!f.wrapper||f.wrapper===C)||f.wrapper===S||f.aliasedElements&&-1<f.aliasedElements.indexOf(S)}).keySeq().toSet().toArray();if(j.length===1)return j[0]}(n,d);v&&(n==="ul"||n==="ol"?(d=n,i+=1):(v!=="unordered-list-item"&&v!=="ordered-list-item"&&(d="",i=-1),B?(y=Z(v,U(t)),B=!1):y=tt(v,i,U(t)))),y=y||Y(),a=function(S,C,j){var f,q=I[S];if(q)f=j.add(q).toOrderedSet();else if(C instanceof HTMLElement){var M=C;f=(f=j).withMutations(function(k){var K=M.style.color,$=M.style.backgroundColor,z=M.style.fontSize,F=M.style.fontFamily.replace(/^"|"$/g,""),ut=M.style.fontWeight,ct=M.style.textDecoration,st=M.style.fontStyle;K&&k.add("color-".concat(K.replace(/ /g,""))),$&&k.add("bgcolor-".concat($.replace(/ /g,""))),z&&k.add("fontsize-".concat(z.replace(/px$/g,""))),F&&k.add("fontfamily-".concat(F)),ut==="bold"&&k.add(I.strong),ct==="underline"&&k.add(I.ins),st==="italic"&&k.add(I.em)}).toOrderedSet()}return f}(n,t,a);for(var x=t.firstChild;x;){var lt=R(x,a,i,d,rt(x)||m,O).chunk;y=et(y,lt),x=x.nextSibling}return{chunk:y}}function ot(t,a){var i,d,m,O=(i=a,d=t.trim().replace(at,it),(m=J(d))?(B=!0,{chunk:R(m,new l.OrderedSet,-1,"",void 0,i).chunk}):null);if(O){var n=O.chunk,g=new l.OrderedMap({});n.entities&&n.entities.forEach(function(s){s&&(g=g.set(s,c.Entity.__get(s)))});var _=0;return{contentBlocks:n.text.split("\r").map(function(s,b){var p=_+s.length,P=n&&n.inlines.slice(_,p),E=n&&n.entities.slice(_,p),N=new l.List(P.map(function(y,v){var x={style:y,entity:null};return E[v]&&(x.entity=E[v]),c.CharacterMetadata.create(x)}));return _=p,new c.ContentBlock({key:Object(c.genKey)(),type:n&&n.blocks[b]&&n.blocks[b].type||"unstyled",depth:n&&n.blocks[b]&&n.blocks[b].depth,data:n&&n.blocks[b]&&n.blocks[b].data||new l.Map({}),text:s,characterList:N})}),entityMap:g}}return null}}],o.c=A,o.d=function(e,r,u){o.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:u})},o.r=function(e){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,r){if(1&r&&(e=o(e)),8&r||4&r&&typeof e=="object"&&e&&e.__esModule)return e;var u=Object.create(null);if(o.r(u),Object.defineProperty(u,"default",{enumerable:!0,value:e}),2&r&&typeof e!="string")for(var c in e)o.d(u,c,function(l){return e[l]}.bind(null,c));return u},o.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(r,"a",r),r},o.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},o.p="",o(o.s=2);function o(e){if(A[e])return A[e].exports;var r=A[e]={i:e,l:!1,exports:{}};return T[e].call(r.exports,r,r.exports,o),r.l=!0,r.exports}var T,A})})(V);var W=V.exports;const mt=G.getDefaultExportFromCjs(W),pt=dt({__proto__:null,default:mt},[W]);exports.htmlToDraftjs=pt;