@documenso/embed-solid 0.1.0 → 0.2.0-rc.1

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,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 o=require("solid-js");function l(e,i,m){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,i,m){g(e)||(m==null?e.removeAttribute(i):e.setAttribute(i,m))}function f(e,i){g(e)||(i==null?e.removeAttribute("class"):e.className=i)}function b(e,i,m){return o.untrack(()=>e(i,m))}function g(e){return!!o.sharedConfig.context&&!o.sharedConfig.done&&(!e||e.isConnected)}var k=l("<iframe>");function E(e){const i=o.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})),n=new URL(`/embed/direct/${e.token}`,t);return e.externalId&&n.searchParams.set("externalId",e.externalId),`${n}#${a}`});function m(t){var a,n,d,u,r;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":(d=e.onDocumentError)==null||d.call(e,t.data.data);break;case"field-signed":(u=e.onFieldSigned)==null||u.call(e);break;case"field-unsigned":(r=e.onFieldUnsigned)==null||r.call(e);break}}let c;return o.onMount(()=>{window.addEventListener("message",m)}),(()=>{var t=k(),a=c;return typeof a=="function"?b(a,t):c=t,o.createRenderEffect(n=>{var d=e.className,u=i();return d!==n.e&&f(t,n.e=d),u!==n.t&&s(t,"src",n.t=u),n},{e:void 0,t:void 0}),t})()}var v=l("<iframe>");function h(e){const i=o.createMemo(()=>{const t=e.host||"https://app.documenso.com",a=btoa(JSON.stringify({name:e.name,lockName:e.lockName,css:e.css}));return`${new URL(`/embed/sign/${e.token}`,t)}#${a}`});function m(t){var a,n,d;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":(d=e.onDocumentError)==null||d.call(e,t.data.data);break}}let c;return o.onMount(()=>{window.addEventListener("message",m)}),(()=>{var t=v(),a=c;return typeof a=="function"?b(a,t):c=t,o.createRenderEffect(n=>{var d=e.className,u=i();return d!==n.e&&f(t,n.e=d),u!==n.t&&s(t,"src",n.t=u),n},{e:void 0,t:void 0}),t})()}exports.EmbedDirectTemplate=E;exports.EmbedSignDocument=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("solid-js");function u(e,d,o){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,o){k(e)||(o==null?e.removeAttribute(d):e.setAttribute(d,o))}function f(e,d){k(e)||(d==null?e.removeAttribute("class"):e.className=d)}function b(e,d,o){return m.untrack(()=>e(d,o))}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(encodeURIComponent(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 o(t){var a,n,i,r,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":(r=e.onFieldSigned)==null||r.call(e);break;case"field-unsigned":(l=e.onFieldUnsigned)==null||l.call(e);break}}let c;return m.onMount(()=>{window.addEventListener("message",o)}),(()=>{var t=g(),a=c;return typeof a=="function"?b(a,t):c=t,m.createRenderEffect(n=>{var i=e.className,r=d();return i!==n.e&&f(t,n.e=i),r!==n.t&&s(t,"src",n.t=r),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(encodeURIComponent(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 o(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",o)}),(()=>{var t=E(),a=c;return typeof a=="function"?b(a,t):c=t,m.createRenderEffect(n=>{var i=e.className,r=d();return i!==n.e&&f(t,n.e=i),r!==n.t&&s(t,"src",n.t=r),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 l, untrack as h, createMemo as r, onMount as s, createRenderEffect as f } from "solid-js";
2
- function b(e, i, m) {
1
+ import { sharedConfig as r, untrack as N, createMemo as u, 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, i, m) {
11
- N(e) || (m == null ? e.removeAttribute(i) : e.setAttribute(i, m));
10
+ function k(e, d, m) {
11
+ D(e) || (m == null ? e.removeAttribute(d) : e.setAttribute(d, m));
12
12
  }
13
- function g(e, i) {
14
- N(e) || (i == null ? e.removeAttribute("class") : e.className = i);
13
+ function g(e, d) {
14
+ D(e) || (d == null ? e.removeAttribute("class") : e.className = d);
15
15
  }
16
- function v(e, i, m) {
17
- return h(() => e(i, m));
16
+ function v(e, d, m) {
17
+ return N(() => e(d, m));
18
18
  }
19
- function N(e) {
20
- return !!l.context && !l.done && (!e || e.isConnected);
19
+ function D(e) {
20
+ return !!r.context && !r.done && (!e || e.isConnected);
21
21
  }
22
- var E = /* @__PURE__ */ b("<iframe>");
23
- function $(e) {
24
- const i = r(() => {
25
- const t = e.host || "https://app.documenso.com", a = btoa(JSON.stringify({
22
+ var h = /* @__PURE__ */ b("<iframe>");
23
+ function y(e) {
24
+ const d = u(() => {
25
+ const t = e.host || "https://app.documenso.com", a = btoa(encodeURIComponent(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
31
- })), n = new URL(`/embed/direct/${e.token}`, t);
30
+ css: e.css,
31
+ cssVars: e.cssVars,
32
+ darkModeDisabled: e.darkModeDisabled
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, d, u, o;
37
+ var a, n, i, o, l;
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
- (d = e.onDocumentError) == null || d.call(e, t.data.data);
47
+ (i = e.onDocumentError) == null || i.call(e, t.data.data);
46
48
  break;
47
49
  case "field-signed":
48
- (u = e.onFieldSigned) == null || u.call(e);
50
+ (o = e.onFieldSigned) == null || o.call(e);
49
51
  break;
50
52
  case "field-unsigned":
51
- (o = e.onFieldUnsigned) == null || o.call(e);
53
+ (l = e.onFieldUnsigned) == null || l.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 = E(), a = c;
61
+ var t = h(), a = c;
60
62
  return typeof a == "function" ? v(a, t) : c = t, f((n) => {
61
- var d = e.className, u = i();
62
- return d !== n.e && g(t, n.e = d), u !== n.t && k(t, "src", n.t = u), n;
63
+ var i = e.className, o = d();
64
+ return i !== n.e && g(t, n.e = i), o !== n.t && k(t, "src", n.t = o), n;
63
65
  }, {
64
66
  e: void 0,
65
67
  t: void 0
66
68
  }), t;
67
69
  })();
68
70
  }
69
- var w = /* @__PURE__ */ b("<iframe>");
70
- function D(e) {
71
- const i = r(() => {
72
- const t = e.host || "https://app.documenso.com", a = btoa(JSON.stringify({
71
+ var E = /* @__PURE__ */ b("<iframe>");
72
+ function M(e) {
73
+ const d = u(() => {
74
+ const t = e.host || "https://app.documenso.com", a = btoa(encodeURIComponent(JSON.stringify({
73
75
  name: e.name,
74
76
  lockName: e.lockName,
75
- css: e.css
76
- }));
77
+ css: e.css,
78
+ cssVars: e.cssVars,
79
+ darkModeDisabled: e.darkModeDisabled
80
+ })));
77
81
  return `${new URL(`/embed/sign/${e.token}`, t)}#${a}`;
78
82
  });
79
83
  function m(t) {
80
- var a, n, d;
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
- (d = e.onDocumentError) == null || d.call(e, t.data.data);
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 = w(), a = c;
102
+ var t = E(), a = c;
99
103
  return typeof a == "function" ? v(a, t) : c = t, f((n) => {
100
- var d = e.className, u = i();
101
- return d !== n.e && g(t, n.e = d), u !== n.t && k(t, "src", n.t = u), n;
104
+ var i = e.className, o = d();
105
+ return i !== n.e && g(t, n.e = i), o !== n.t && k(t, "src", n.t = o), 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
- $ as EmbedDirectTemplate,
110
- D as EmbedSignDocument
113
+ y as EmbedDirectTemplate,
114
+ M as EmbedSignDocument
111
115
  };
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@documenso/embed-solid",
3
- "version": "0.1.0",
3
+ "version": "0.2.0-rc.1",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist"