@documenso/embed-solid 0.1.0 → 0.2.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css-vars.d.ts +58 -0
- package/dist/direct-template.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +36 -32
- package/dist/sign-document.d.ts +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export type CssVars = {
|
|
2
|
+
/** Base background color */
|
|
3
|
+
background?: string | null;
|
|
4
|
+
/** Base text color */
|
|
5
|
+
foreground?: string | null;
|
|
6
|
+
/** Muted/subtle background color */
|
|
7
|
+
muted?: string | null;
|
|
8
|
+
/** Muted/subtle text color */
|
|
9
|
+
mutedForeground?: string | null;
|
|
10
|
+
/** Popover/dropdown background color */
|
|
11
|
+
popover?: string | null;
|
|
12
|
+
/** Popover/dropdown text color */
|
|
13
|
+
popoverForeground?: string | null;
|
|
14
|
+
/** Card background color */
|
|
15
|
+
card?: string | null;
|
|
16
|
+
/** Card border color */
|
|
17
|
+
cardBorder?: string | null;
|
|
18
|
+
/** Card border tint/highlight color */
|
|
19
|
+
cardBorderTint?: string | null;
|
|
20
|
+
/** Card text color */
|
|
21
|
+
cardForeground?: string | null;
|
|
22
|
+
/** Field card background color */
|
|
23
|
+
fieldCard?: string | null;
|
|
24
|
+
/** Field card border color */
|
|
25
|
+
fieldCardBorder?: string | null;
|
|
26
|
+
/** Field card text color */
|
|
27
|
+
fieldCardForeground?: string | null;
|
|
28
|
+
/** Widget background color */
|
|
29
|
+
widget?: string | null;
|
|
30
|
+
/** Widget text color */
|
|
31
|
+
widgetForeground?: string | null;
|
|
32
|
+
/** Default border color */
|
|
33
|
+
border?: string | null;
|
|
34
|
+
/** Input field border color */
|
|
35
|
+
input?: string | null;
|
|
36
|
+
/** Primary action/button color */
|
|
37
|
+
primary?: string | null;
|
|
38
|
+
/** Primary action/button text color */
|
|
39
|
+
primaryForeground?: string | null;
|
|
40
|
+
/** Secondary action/button color */
|
|
41
|
+
secondary?: string | null;
|
|
42
|
+
/** Secondary action/button text color */
|
|
43
|
+
secondaryForeground?: string | null;
|
|
44
|
+
/** Accent/highlight color */
|
|
45
|
+
accent?: string | null;
|
|
46
|
+
/** Accent/highlight text color */
|
|
47
|
+
accentForeground?: string | null;
|
|
48
|
+
/** Destructive/danger action color */
|
|
49
|
+
destructive?: string | null;
|
|
50
|
+
/** Destructive/danger text color */
|
|
51
|
+
destructiveForeground?: string | null;
|
|
52
|
+
/** Focus ring color */
|
|
53
|
+
ring?: string | null;
|
|
54
|
+
/** Border radius size in REM units */
|
|
55
|
+
radius?: string | null;
|
|
56
|
+
/** Warning/alert color */
|
|
57
|
+
warning?: string | null;
|
|
58
|
+
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { CssVars } from './css-vars';
|
|
1
2
|
export type EmbedDirectTemplateProps = {
|
|
2
3
|
className?: string;
|
|
3
4
|
host?: string;
|
|
4
5
|
token: string;
|
|
5
6
|
externalId?: string;
|
|
6
7
|
css?: string | undefined;
|
|
7
|
-
cssVars?: Record<string, string> | undefined;
|
|
8
|
+
cssVars?: (CssVars & Record<string, string>) | undefined;
|
|
9
|
+
darkModeDisabled?: boolean | undefined;
|
|
8
10
|
email?: string | undefined;
|
|
9
11
|
lockEmail?: boolean | undefined;
|
|
10
12
|
name?: string | undefined;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("solid-js");function u(e,d,r){let c;const t=()=>{const n=document.createElement("template");return n.innerHTML=e,n.content.firstChild},a=()=>(c||(c=t())).cloneNode(!0);return a.cloneNode=a,a}function s(e,d,r){k(e)||(r==null?e.removeAttribute(d):e.setAttribute(d,r))}function f(e,d){k(e)||(d==null?e.removeAttribute("class"):e.className=d)}function b(e,d,r){return m.untrack(()=>e(d,r))}function k(e){return!!m.sharedConfig.context&&!m.sharedConfig.done&&(!e||e.isConnected)}var g=u("<iframe>");function D(e){const d=m.createMemo(()=>{const t=e.host||"https://app.documenso.com",a=btoa(JSON.stringify({name:e.name,lockName:e.lockName,email:e.email,lockEmail:e.lockEmail,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled})),n=new URL(`/embed/direct/${e.token}`,t);return e.externalId&&n.searchParams.set("externalId",e.externalId),`${n}#${a}`});function r(t){var a,n,i,o,l;if((c==null?void 0:c.contentWindow)===t.source)switch(t.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(n=e.onDocumentCompleted)==null||n.call(e,t.data.data);break;case"document-error":(i=e.onDocumentError)==null||i.call(e,t.data.data);break;case"field-signed":(o=e.onFieldSigned)==null||o.call(e);break;case"field-unsigned":(l=e.onFieldUnsigned)==null||l.call(e);break}}let c;return m.onMount(()=>{window.addEventListener("message",r)}),(()=>{var t=g(),a=c;return typeof a=="function"?b(a,t):c=t,m.createRenderEffect(n=>{var i=e.className,o=d();return i!==n.e&&f(t,n.e=i),o!==n.t&&s(t,"src",n.t=o),n},{e:void 0,t:void 0}),t})()}var E=u("<iframe>");function v(e){const d=m.createMemo(()=>{const t=e.host||"https://app.documenso.com",a=btoa(JSON.stringify({name:e.name,lockName:e.lockName,css:e.css,cssVars:e.cssVars,darkModeDisabled:e.darkModeDisabled}));return`${new URL(`/embed/sign/${e.token}`,t)}#${a}`});function r(t){var a,n,i;if((c==null?void 0:c.contentWindow)===t.source)switch(t.data.action){case"document-ready":(a=e.onDocumentReady)==null||a.call(e);break;case"document-completed":(n=e.onDocumentCompleted)==null||n.call(e,t.data.data);break;case"document-error":(i=e.onDocumentError)==null||i.call(e,t.data.data);break}}let c;return m.onMount(()=>{window.addEventListener("message",r)}),(()=>{var t=E(),a=c;return typeof a=="function"?b(a,t):c=t,m.createRenderEffect(n=>{var i=e.className,o=d();return i!==n.e&&f(t,n.e=i),o!==n.t&&s(t,"src",n.t=o),n},{e:void 0,t:void 0}),t})()}exports.EmbedDirectTemplate=D;exports.EmbedSignDocument=v;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { sharedConfig as
|
|
2
|
-
function b(e,
|
|
1
|
+
import { sharedConfig as u, untrack as N, createMemo as o, onMount as s, createRenderEffect as f } from "solid-js";
|
|
2
|
+
function b(e, d, m) {
|
|
3
3
|
let c;
|
|
4
4
|
const t = () => {
|
|
5
5
|
const n = document.createElement("template");
|
|
@@ -7,32 +7,34 @@ function b(e, i, m) {
|
|
|
7
7
|
}, a = () => (c || (c = t())).cloneNode(!0);
|
|
8
8
|
return a.cloneNode = a, a;
|
|
9
9
|
}
|
|
10
|
-
function k(e,
|
|
11
|
-
|
|
10
|
+
function k(e, d, m) {
|
|
11
|
+
D(e) || (m == null ? e.removeAttribute(d) : e.setAttribute(d, m));
|
|
12
12
|
}
|
|
13
|
-
function g(e,
|
|
14
|
-
|
|
13
|
+
function g(e, d) {
|
|
14
|
+
D(e) || (d == null ? e.removeAttribute("class") : e.className = d);
|
|
15
15
|
}
|
|
16
|
-
function v(e,
|
|
17
|
-
return
|
|
16
|
+
function v(e, d, m) {
|
|
17
|
+
return N(() => e(d, m));
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
return !!
|
|
19
|
+
function D(e) {
|
|
20
|
+
return !!u.context && !u.done && (!e || e.isConnected);
|
|
21
21
|
}
|
|
22
|
-
var
|
|
23
|
-
function
|
|
24
|
-
const
|
|
22
|
+
var h = /* @__PURE__ */ b("<iframe>");
|
|
23
|
+
function y(e) {
|
|
24
|
+
const d = o(() => {
|
|
25
25
|
const t = e.host || "https://app.documenso.com", a = btoa(JSON.stringify({
|
|
26
26
|
name: e.name,
|
|
27
27
|
lockName: e.lockName,
|
|
28
28
|
email: e.email,
|
|
29
29
|
lockEmail: e.lockEmail,
|
|
30
|
-
css: e.css
|
|
30
|
+
css: e.css,
|
|
31
|
+
cssVars: e.cssVars,
|
|
32
|
+
darkModeDisabled: e.darkModeDisabled
|
|
31
33
|
})), n = new URL(`/embed/direct/${e.token}`, t);
|
|
32
34
|
return e.externalId && n.searchParams.set("externalId", e.externalId), `${n}#${a}`;
|
|
33
35
|
});
|
|
34
36
|
function m(t) {
|
|
35
|
-
var a, n,
|
|
37
|
+
var a, n, i, l, r;
|
|
36
38
|
if ((c == null ? void 0 : c.contentWindow) === t.source)
|
|
37
39
|
switch (t.data.action) {
|
|
38
40
|
case "document-ready":
|
|
@@ -42,13 +44,13 @@ function $(e) {
|
|
|
42
44
|
(n = e.onDocumentCompleted) == null || n.call(e, t.data.data);
|
|
43
45
|
break;
|
|
44
46
|
case "document-error":
|
|
45
|
-
(
|
|
47
|
+
(i = e.onDocumentError) == null || i.call(e, t.data.data);
|
|
46
48
|
break;
|
|
47
49
|
case "field-signed":
|
|
48
|
-
(
|
|
50
|
+
(l = e.onFieldSigned) == null || l.call(e);
|
|
49
51
|
break;
|
|
50
52
|
case "field-unsigned":
|
|
51
|
-
(
|
|
53
|
+
(r = e.onFieldUnsigned) == null || r.call(e);
|
|
52
54
|
break;
|
|
53
55
|
}
|
|
54
56
|
}
|
|
@@ -56,28 +58,30 @@ function $(e) {
|
|
|
56
58
|
return s(() => {
|
|
57
59
|
window.addEventListener("message", m);
|
|
58
60
|
}), (() => {
|
|
59
|
-
var t =
|
|
61
|
+
var t = h(), a = c;
|
|
60
62
|
return typeof a == "function" ? v(a, t) : c = t, f((n) => {
|
|
61
|
-
var
|
|
62
|
-
return
|
|
63
|
+
var i = e.className, l = d();
|
|
64
|
+
return i !== n.e && g(t, n.e = i), l !== n.t && k(t, "src", n.t = l), n;
|
|
63
65
|
}, {
|
|
64
66
|
e: void 0,
|
|
65
67
|
t: void 0
|
|
66
68
|
}), t;
|
|
67
69
|
})();
|
|
68
70
|
}
|
|
69
|
-
var
|
|
70
|
-
function
|
|
71
|
-
const
|
|
71
|
+
var E = /* @__PURE__ */ b("<iframe>");
|
|
72
|
+
function M(e) {
|
|
73
|
+
const d = o(() => {
|
|
72
74
|
const t = e.host || "https://app.documenso.com", a = btoa(JSON.stringify({
|
|
73
75
|
name: e.name,
|
|
74
76
|
lockName: e.lockName,
|
|
75
|
-
css: e.css
|
|
77
|
+
css: e.css,
|
|
78
|
+
cssVars: e.cssVars,
|
|
79
|
+
darkModeDisabled: e.darkModeDisabled
|
|
76
80
|
}));
|
|
77
81
|
return `${new URL(`/embed/sign/${e.token}`, t)}#${a}`;
|
|
78
82
|
});
|
|
79
83
|
function m(t) {
|
|
80
|
-
var a, n,
|
|
84
|
+
var a, n, i;
|
|
81
85
|
if ((c == null ? void 0 : c.contentWindow) === t.source)
|
|
82
86
|
switch (t.data.action) {
|
|
83
87
|
case "document-ready":
|
|
@@ -87,7 +91,7 @@ function D(e) {
|
|
|
87
91
|
(n = e.onDocumentCompleted) == null || n.call(e, t.data.data);
|
|
88
92
|
break;
|
|
89
93
|
case "document-error":
|
|
90
|
-
(
|
|
94
|
+
(i = e.onDocumentError) == null || i.call(e, t.data.data);
|
|
91
95
|
break;
|
|
92
96
|
}
|
|
93
97
|
}
|
|
@@ -95,10 +99,10 @@ function D(e) {
|
|
|
95
99
|
return s(() => {
|
|
96
100
|
window.addEventListener("message", m);
|
|
97
101
|
}), (() => {
|
|
98
|
-
var t =
|
|
102
|
+
var t = E(), a = c;
|
|
99
103
|
return typeof a == "function" ? v(a, t) : c = t, f((n) => {
|
|
100
|
-
var
|
|
101
|
-
return
|
|
104
|
+
var i = e.className, l = d();
|
|
105
|
+
return i !== n.e && g(t, n.e = i), l !== n.t && k(t, "src", n.t = l), n;
|
|
102
106
|
}, {
|
|
103
107
|
e: void 0,
|
|
104
108
|
t: void 0
|
|
@@ -106,6 +110,6 @@ function D(e) {
|
|
|
106
110
|
})();
|
|
107
111
|
}
|
|
108
112
|
export {
|
|
109
|
-
|
|
110
|
-
|
|
113
|
+
y as EmbedDirectTemplate,
|
|
114
|
+
M as EmbedSignDocument
|
|
111
115
|
};
|
package/dist/sign-document.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { CssVars } from './css-vars';
|
|
1
2
|
export type EmbedSignDocumentProps = {
|
|
2
3
|
className?: string;
|
|
3
4
|
host?: string;
|
|
4
5
|
token: string;
|
|
5
6
|
css?: string | undefined;
|
|
6
|
-
cssVars?: Record<string, string> | undefined;
|
|
7
|
+
cssVars?: (CssVars & Record<string, string>) | undefined;
|
|
8
|
+
darkModeDisabled?: boolean | undefined;
|
|
7
9
|
name?: string | undefined;
|
|
8
10
|
lockName?: boolean | undefined;
|
|
9
11
|
onDocumentReady?: () => void;
|