@social-mail/social-mail-client 1.9.109 → 1.9.111

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.
Files changed (2) hide show
  1. package/css-for-email.js +10 -4
  2. package/package.json +1 -1
package/css-for-email.js CHANGED
@@ -23,10 +23,9 @@ async function flattenStyleSheets() {
23
23
 
24
24
  const te = new TextEncoder();
25
25
 
26
- async function encodeTo36(text) {
26
+ function encodeTo36(text) {
27
27
  const buffer = te.encode(text);
28
- const hash = await window.crypto.subtle.digest("SHA-1", buffer);
29
- const c = window.btoa(hash);
28
+ const c = window.btoa(buffer);
30
29
  return "c_" + c.replaceAll("=", "_");
31
30
  }
32
31
 
@@ -38,6 +37,8 @@ async function flattenStyler() {
38
37
  for(let i=0;i<all.length;i++) {
39
38
  const e = all[i];
40
39
 
40
+ const remove = [];
41
+
41
42
  for(const name of e.getAttributeNames()) {
42
43
  if (!name.startsWith("styler-")) {
43
44
  continue;
@@ -45,9 +46,14 @@ async function flattenStyler() {
45
46
  const value = e.getAttribute(name);
46
47
  const cssValue = CSS.escape(value);
47
48
  const rule = `[${name}=${cssValue}]`;
48
- const className = await encodeTo36(rule);
49
+ const className = encodeTo36(rule);
49
50
  e.classList.add(className);
50
51
  replaceList.push({ rule, className: "." + className});
52
+ remove.push(name);
53
+ }
54
+
55
+ for(const n of remove) {
56
+ e.removeAttribute(n);
51
57
  }
52
58
  }
53
59
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-client",
3
- "version": "1.9.109",
3
+ "version": "1.9.111",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {