@onivoro/server-html 0.1.1 → 24.23.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.
Files changed (131) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +263 -0
  3. package/package.json +20 -39
  4. package/{dist/cjs → src}/index.d.ts +1 -0
  5. package/src/index.js +24 -0
  6. package/src/index.js.map +1 -0
  7. package/{dist/esm → src}/lib/deprecated/a.function.d.ts +1 -0
  8. package/{dist/esm → src}/lib/deprecated/a.function.js +2 -2
  9. package/src/lib/deprecated/a.function.js.map +1 -0
  10. package/{dist/cjs → src}/lib/deprecated/html-element-renderer.type.d.ts +1 -0
  11. package/{dist/cjs → src}/lib/deprecated/html-element-renderer.type.js +1 -0
  12. package/src/lib/deprecated/html-element-renderer.type.js.map +1 -0
  13. package/{dist/cjs → src}/lib/deprecated/html.function.d.ts +1 -0
  14. package/{dist/cjs → src}/lib/deprecated/html.function.js +2 -2
  15. package/src/lib/deprecated/html.function.js.map +1 -0
  16. package/{dist/cjs → src}/lib/deprecated/login-button.function.d.ts +1 -0
  17. package/{dist/cjs → src}/lib/deprecated/login-button.function.js +2 -2
  18. package/src/lib/deprecated/login-button.function.js.map +1 -0
  19. package/{dist/cjs → src}/lib/deprecated/self-closing-html-element-renderer.type.d.ts +1 -0
  20. package/{dist/esm → src}/lib/deprecated/self-closing-html-element-renderer.type.js +1 -0
  21. package/src/lib/deprecated/self-closing-html-element-renderer.type.js.map +1 -0
  22. package/{dist/cjs → src}/lib/deprecated/self-closing-tag.function.d.ts +1 -0
  23. package/{dist/esm → src}/lib/deprecated/self-closing-tag.function.js +2 -2
  24. package/src/lib/deprecated/self-closing-tag.function.js.map +1 -0
  25. package/{dist/cjs → src}/lib/deprecated/tag.function.d.ts +1 -0
  26. package/{dist/esm → src}/lib/deprecated/tag.function.js +2 -2
  27. package/src/lib/deprecated/tag.function.js.map +1 -0
  28. package/{dist/cjs → src}/lib/deprecated/tags.d.ts +2 -1
  29. package/{dist/esm → src}/lib/deprecated/tags.js +1 -0
  30. package/src/lib/deprecated/tags.js.map +1 -0
  31. package/{dist/cjs → src}/lib/email-body.function.d.ts +1 -0
  32. package/{dist/esm → src}/lib/email-body.function.js +2 -2
  33. package/src/lib/email-body.function.js.map +1 -0
  34. package/{dist/cjs → src}/lib/primitives/element.function.d.ts +1 -0
  35. package/{dist/esm → src}/lib/primitives/element.function.js +2 -2
  36. package/src/lib/primitives/element.function.js.map +1 -0
  37. package/{dist/cjs → src}/lib/primitives/elements.d.ts +2 -1
  38. package/{dist/esm → src}/lib/primitives/elements.js +1 -2
  39. package/src/lib/primitives/elements.js.map +1 -0
  40. package/src/lib/primitives/format-attributes.function.d.ts +2 -0
  41. package/{dist/esm → src}/lib/primitives/format-attributes.function.js +5 -2
  42. package/src/lib/primitives/format-attributes.function.js.map +1 -0
  43. package/{dist/cjs → src}/lib/primitives/inline-style.function.d.ts +1 -0
  44. package/{dist/cjs → src}/lib/primitives/inline-style.function.js +2 -2
  45. package/src/lib/primitives/inline-style.function.js.map +1 -0
  46. package/{dist/types → src}/lib/primitives/self-closing-element.function.d.ts +2 -1
  47. package/{dist/cjs → src}/lib/primitives/self-closing-element.function.js +2 -2
  48. package/src/lib/primitives/self-closing-element.function.js.map +1 -0
  49. package/{dist/cjs → src}/lib/styles/button-styles.constant.d.ts +1 -0
  50. package/{dist/cjs → src}/lib/styles/button-styles.constant.js +1 -0
  51. package/src/lib/styles/button-styles.constant.js.map +1 -0
  52. package/{dist/types → src}/lib/styles/font-styles.constant.d.ts +1 -0
  53. package/{dist/cjs → src}/lib/styles/font-styles.constant.js +1 -0
  54. package/src/lib/styles/font-styles.constant.js.map +1 -0
  55. package/{dist/cjs → src}/lib/table.function.d.ts +1 -0
  56. package/{dist/cjs → src}/lib/table.function.js +2 -2
  57. package/src/lib/table.function.js.map +1 -0
  58. package/{dist/types → src}/lib/types/attributes.type.d.ts +1 -0
  59. package/{dist/esm → src}/lib/types/attributes.type.js +1 -0
  60. package/src/lib/types/attributes.type.js.map +1 -0
  61. package/{dist/cjs → src}/lib/types/element-renderer.type.d.ts +1 -0
  62. package/{dist/esm → src}/lib/types/element-renderer.type.js +1 -0
  63. package/src/lib/types/element-renderer.type.js.map +1 -0
  64. package/{dist/types → src}/lib/types/self-closing-element-renderer.type.d.ts +1 -0
  65. package/{dist/cjs → src}/lib/types/self-closing-element-renderer.type.js +1 -0
  66. package/src/lib/types/self-closing-element-renderer.type.js.map +1 -0
  67. package/dist/cjs/index.js +0 -36
  68. package/dist/cjs/lib/deprecated/a.function.d.ts +0 -1
  69. package/dist/cjs/lib/deprecated/a.function.js +0 -8
  70. package/dist/cjs/lib/deprecated/self-closing-html-element-renderer.type.js +0 -2
  71. package/dist/cjs/lib/deprecated/self-closing-tag.function.js +0 -8
  72. package/dist/cjs/lib/deprecated/tag.function.js +0 -12
  73. package/dist/cjs/lib/deprecated/tags.js +0 -27
  74. package/dist/cjs/lib/email-body.function.js +0 -25
  75. package/dist/cjs/lib/primitives/element.function.js +0 -13
  76. package/dist/cjs/lib/primitives/elements.js +0 -34
  77. package/dist/cjs/lib/primitives/format-attributes.function.d.ts +0 -1
  78. package/dist/cjs/lib/primitives/format-attributes.function.js +0 -9
  79. package/dist/cjs/lib/primitives/self-closing-element.function.d.ts +0 -2
  80. package/dist/cjs/lib/styles/font-styles.constant.d.ts +0 -7
  81. package/dist/cjs/lib/types/attributes.type.d.ts +0 -4
  82. package/dist/cjs/lib/types/attributes.type.js +0 -2
  83. package/dist/cjs/lib/types/element-renderer.type.js +0 -2
  84. package/dist/cjs/lib/types/self-closing-element-renderer.type.d.ts +0 -2
  85. package/dist/esm/index.d.ts +0 -20
  86. package/dist/esm/index.js +0 -36
  87. package/dist/esm/lib/deprecated/html-element-renderer.type.d.ts +0 -1
  88. package/dist/esm/lib/deprecated/html-element-renderer.type.js +0 -2
  89. package/dist/esm/lib/deprecated/html.function.d.ts +0 -1
  90. package/dist/esm/lib/deprecated/html.function.js +0 -43
  91. package/dist/esm/lib/deprecated/login-button.function.d.ts +0 -1
  92. package/dist/esm/lib/deprecated/login-button.function.js +0 -15
  93. package/dist/esm/lib/deprecated/self-closing-html-element-renderer.type.d.ts +0 -1
  94. package/dist/esm/lib/deprecated/self-closing-tag.function.d.ts +0 -1
  95. package/dist/esm/lib/deprecated/tag.function.d.ts +0 -1
  96. package/dist/esm/lib/deprecated/tags.d.ts +0 -24
  97. package/dist/esm/lib/email-body.function.d.ts +0 -2
  98. package/dist/esm/lib/primitives/element.function.d.ts +0 -2
  99. package/dist/esm/lib/primitives/elements.d.ts +0 -26
  100. package/dist/esm/lib/primitives/format-attributes.function.d.ts +0 -1
  101. package/dist/esm/lib/primitives/inline-style.function.d.ts +0 -1
  102. package/dist/esm/lib/primitives/inline-style.function.js +0 -10
  103. package/dist/esm/lib/primitives/self-closing-element.function.d.ts +0 -2
  104. package/dist/esm/lib/primitives/self-closing-element.function.js +0 -8
  105. package/dist/esm/lib/styles/button-styles.constant.d.ts +0 -11
  106. package/dist/esm/lib/styles/button-styles.constant.js +0 -14
  107. package/dist/esm/lib/styles/font-styles.constant.d.ts +0 -7
  108. package/dist/esm/lib/styles/font-styles.constant.js +0 -10
  109. package/dist/esm/lib/table.function.d.ts +0 -1
  110. package/dist/esm/lib/table.function.js +0 -13
  111. package/dist/esm/lib/types/attributes.type.d.ts +0 -4
  112. package/dist/esm/lib/types/element-renderer.type.d.ts +0 -2
  113. package/dist/esm/lib/types/self-closing-element-renderer.type.d.ts +0 -2
  114. package/dist/esm/lib/types/self-closing-element-renderer.type.js +0 -2
  115. package/dist/types/index.d.ts +0 -20
  116. package/dist/types/lib/deprecated/a.function.d.ts +0 -1
  117. package/dist/types/lib/deprecated/html-element-renderer.type.d.ts +0 -1
  118. package/dist/types/lib/deprecated/html.function.d.ts +0 -1
  119. package/dist/types/lib/deprecated/login-button.function.d.ts +0 -1
  120. package/dist/types/lib/deprecated/self-closing-html-element-renderer.type.d.ts +0 -1
  121. package/dist/types/lib/deprecated/self-closing-tag.function.d.ts +0 -1
  122. package/dist/types/lib/deprecated/tag.function.d.ts +0 -1
  123. package/dist/types/lib/deprecated/tags.d.ts +0 -24
  124. package/dist/types/lib/email-body.function.d.ts +0 -2
  125. package/dist/types/lib/primitives/element.function.d.ts +0 -2
  126. package/dist/types/lib/primitives/elements.d.ts +0 -26
  127. package/dist/types/lib/primitives/format-attributes.function.d.ts +0 -1
  128. package/dist/types/lib/primitives/inline-style.function.d.ts +0 -1
  129. package/dist/types/lib/styles/button-styles.constant.d.ts +0 -11
  130. package/dist/types/lib/table.function.d.ts +0 -1
  131. package/dist/types/lib/types/element-renderer.type.d.ts +0 -2
@@ -1 +1,2 @@
1
1
  export declare function inlineStyle(styles: Record<string, string>): string;
2
+ //# sourceMappingURL=inline-style.function.d.ts.map
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.inlineStyle = void 0;
3
+ exports.inlineStyle = inlineStyle;
4
4
  function inlineStyle(styles) {
5
5
  const rules = Object.entries(styles)
6
6
  .map(([k, v]) => `${k}: ${v};`)
7
7
  .join(' ');
8
8
  return `style="${rules}"`;
9
9
  }
10
- exports.inlineStyle = inlineStyle;
10
+ //# sourceMappingURL=inline-style.function.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-style.function.js","sourceRoot":"","sources":["../../../../../../../libs/server/html/src/lib/primitives/inline-style.function.ts"],"names":[],"mappings":";;AAAA,kCAKC;AALD,SAAgB,WAAW,CAAC,MAA8B;IACxD,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;SACjC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC;SAC9B,IAAI,CAAC,GAAG,CAAC,CAAC;IACb,OAAO,UAAU,KAAK,GAAG,CAAC;AAC5B,CAAC"}
@@ -1,2 +1,3 @@
1
1
  import { TAttributes } from "../types/attributes.type";
2
- export declare function selfClosingElement(tag: string, attributes: TAttributes): string;
2
+ export declare function selfClosingElement(tag: string, attributes?: TAttributes): string;
3
+ //# sourceMappingURL=self-closing-element.function.d.ts.map
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.selfClosingElement = void 0;
3
+ exports.selfClosingElement = selfClosingElement;
4
4
  const element_function_1 = require("./element.function");
5
5
  function selfClosingElement(tag, attributes) {
6
6
  return (0, element_function_1.element)(tag, [], attributes).replace(`></${tag}>`, '/>');
7
7
  }
8
- exports.selfClosingElement = selfClosingElement;
8
+ //# sourceMappingURL=self-closing-element.function.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"self-closing-element.function.js","sourceRoot":"","sources":["../../../../../../../libs/server/html/src/lib/primitives/self-closing-element.function.ts"],"names":[],"mappings":";;AAGA,gDASC;AAXD,yDAA6C;AAE7C,SAAgB,kBAAkB,CAC9B,GAAW,EACX,UAAwB;IAExB,OAAO,IAAA,0BAAO,EACV,GAAG,EACH,EAAE,EACF,UAAU,CACb,CAAC,OAAO,CAAC,MAAM,GAAG,GAAG,EAAE,IAAI,CAAC,CAAA;AACjC,CAAC"}
@@ -9,3 +9,4 @@ export declare const buttonStyles: {
9
9
  'box-sizing': string;
10
10
  color: string;
11
11
  };
12
+ //# sourceMappingURL=button-styles.constant.d.ts.map
@@ -12,3 +12,4 @@ exports.buttonStyles = {
12
12
  'box-sizing': 'border-box',
13
13
  color: 'inherit'
14
14
  };
15
+ //# sourceMappingURL=button-styles.constant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button-styles.constant.js","sourceRoot":"","sources":["../../../../../../../libs/server/html/src/lib/styles/button-styles.constant.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IACxB,OAAO,EAAE,aAAa;IACtB,MAAM,EAAE,WAAW;IACnB,eAAe,EAAE,KAAK;IACtB,OAAO,EAAE,cAAc;IACvB,aAAa,EAAE,KAAK;IACpB,YAAY,EAAE,QAAQ;IACtB,iBAAiB,EAAE,MAAM;IACzB,YAAY,EAAE,YAAY;IAC1B,KAAK,EAAE,SAAS;CACnB,CAAC"}
@@ -5,3 +5,4 @@ export declare const fontStyles: {
5
5
  '-moz-osx-font-smoothing': string;
6
6
  color: string;
7
7
  };
8
+ //# sourceMappingURL=font-styles.constant.d.ts.map
@@ -8,3 +8,4 @@ exports.fontStyles = {
8
8
  '-moz-osx-font-smoothing': `grayscale`,
9
9
  color: 'rgba(0, 0, 0, 0.5) !important',
10
10
  };
11
+ //# sourceMappingURL=font-styles.constant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"font-styles.constant.js","sourceRoot":"","sources":["../../../../../../../libs/server/html/src/lib/styles/font-styles.constant.ts"],"names":[],"mappings":";;;AAAa,QAAA,UAAU,GAAG;IACtB,aAAa,EAAE,0JAA0J;IACzK,WAAW,EAAE,OAAO;IACpB,wBAAwB,EAAE,aAAa;IACvC,yBAAyB,EAAE,WAAW;IACtC,KAAK,EAAE,+BAA+B;CACzC,CAAC"}
@@ -1 +1,2 @@
1
1
  export declare function table(columns: string[], rows: Array<any[]>): string;
2
+ //# sourceMappingURL=table.function.d.ts.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.table = void 0;
3
+ exports.table = table;
4
4
  const elements_1 = require("./primitives/elements");
5
5
  const padding = '0.5rem';
6
6
  const color = 'inherit';
@@ -10,4 +10,4 @@ function table(columns, rows) {
10
10
  (0, elements_1.tbody)(rows.map((row, i) => (0, elements_1.tr)(row.map((cell) => (0, elements_1.td)([cell], { style: { padding, color } })), { style: { 'background-color': i % 2 ? '' : 'rgba(0, 0, 0, 0.2)', padding, color } }))),
11
11
  ], { style: { 'border-collapse': 'collapse', width: '100%', color } });
12
12
  }
13
- exports.table = table;
13
+ //# sourceMappingURL=table.function.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.function.js","sourceRoot":"","sources":["../../../../../../libs/server/html/src/lib/table.function.ts"],"names":[],"mappings":";;AAIA,sBAYC;AAhBD,oDAAsE;AAEtE,MAAM,OAAO,GAAG,QAAQ,CAAC;AACzB,MAAM,KAAK,GAAG,SAAS,CAAC;AACxB,SAAgB,KAAK,CAAC,OAAiB,EAAE,IAAkB;IACzD,OAAO,IAAA,cAAG,EAAC;QACT,IAAA,gBAAK,EAAC,CAAC,IAAA,aAAE,EAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,aAAE,EAAC,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,EAAC,KAAK,EAAE,EAAE,qBAAqB,EAAE,KAAK,EAAE,qBAAqB,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAC,EAAC,CAAC,CAAC,CAAC;QAC9P,IAAA,gBAAK,EACH,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAClB,IAAA,aAAE,EACA,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,aAAE,EAAC,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAC5D,EAAE,KAAK,EAAE,EAAE,kBAAkB,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,oBAAoB,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CACrF,CACF,CACF;KACF,EAAE,EAAC,KAAK,EAAE,EAAE,iBAAiB,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAC,EAAC,CAAC,CAAC;AACtE,CAAC"}
@@ -2,3 +2,4 @@ export type TAttributes = Record<string, any> & {
2
2
  cssClass?: string;
3
3
  style?: Record<string, string>;
4
4
  };
5
+ //# sourceMappingURL=attributes.type.d.ts.map
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=attributes.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attributes.type.js","sourceRoot":"","sources":["../../../../../../../libs/server/html/src/lib/types/attributes.type.ts"],"names":[],"mappings":""}
@@ -1,2 +1,3 @@
1
1
  import { TAttributes } from "./attributes.type";
2
2
  export type TElementRenderer = (content: Array<string | number>, attributes?: TAttributes) => string;
3
+ //# sourceMappingURL=element-renderer.type.d.ts.map
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=element-renderer.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element-renderer.type.js","sourceRoot":"","sources":["../../../../../../../libs/server/html/src/lib/types/element-renderer.type.ts"],"names":[],"mappings":""}
@@ -1,2 +1,3 @@
1
1
  import { TAttributes } from "./attributes.type";
2
2
  export type TSelfClosingElementRenderer = (attributes?: TAttributes) => string;
3
+ //# sourceMappingURL=self-closing-element-renderer.type.d.ts.map
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=self-closing-element-renderer.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"self-closing-element-renderer.type.js","sourceRoot":"","sources":["../../../../../../../libs/server/html/src/lib/types/self-closing-element-renderer.type.ts"],"names":[],"mappings":""}
package/dist/cjs/index.js DELETED
@@ -1,36 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./lib/deprecated/a.function"), exports);
18
- __exportStar(require("./lib/deprecated/html-element-renderer.type"), exports);
19
- __exportStar(require("./lib/deprecated/html.function"), exports);
20
- __exportStar(require("./lib/deprecated/login-button.function"), exports);
21
- __exportStar(require("./lib/deprecated/self-closing-html-element-renderer.type"), exports);
22
- __exportStar(require("./lib/deprecated/self-closing-tag.function"), exports);
23
- __exportStar(require("./lib/deprecated/tag.function"), exports);
24
- __exportStar(require("./lib/deprecated/tags"), exports);
25
- __exportStar(require("./lib/primitives/element.function"), exports);
26
- __exportStar(require("./lib/primitives/elements"), exports);
27
- __exportStar(require("./lib/primitives/format-attributes.function"), exports);
28
- __exportStar(require("./lib/primitives/inline-style.function"), exports);
29
- __exportStar(require("./lib/primitives/self-closing-element.function"), exports);
30
- __exportStar(require("./lib/styles/button-styles.constant"), exports);
31
- __exportStar(require("./lib/styles/font-styles.constant"), exports);
32
- __exportStar(require("./lib/types/attributes.type"), exports);
33
- __exportStar(require("./lib/types/element-renderer.type"), exports);
34
- __exportStar(require("./lib/types/self-closing-element-renderer.type"), exports);
35
- __exportStar(require("./lib/email-body.function"), exports);
36
- __exportStar(require("./lib/table.function"), exports);
@@ -1 +0,0 @@
1
- export declare function a(text: string, href: string, cssClass?: string): string;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.a = void 0;
4
- function a(text, href, cssClass) {
5
- const classExp = cssClass ? `class="${cssClass}"` : '';
6
- return `<a target="_blank" href="${href}" ${classExp}>${text}</a>`;
7
- }
8
- exports.a = a;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.selfClosingTag = void 0;
4
- const tag_function_1 = require("./tag.function");
5
- function selfClosingTag(tag, cssClass, attributes, styles) {
6
- return (0, tag_function_1.tag)(tag, [], cssClass, attributes, styles).replace(`></${tag}>`, '/>');
7
- }
8
- exports.selfClosingTag = selfClosingTag;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tag = void 0;
4
- const format_attributes_function_1 = require("../primitives/format-attributes.function");
5
- const inline_style_function_1 = require("../primitives/inline-style.function");
6
- function tag(tag, content, cssClass, attributes, styles) {
7
- const classExp = cssClass ? ` class="${cssClass}"` : '';
8
- const attributesExp = attributes ? ` ${(0, format_attributes_function_1.formatAttributes)(attributes)}` : '';
9
- const styleExp = styles ? ` ${(0, inline_style_function_1.inlineStyle)(styles)}` : '';
10
- return `<${tag}${classExp}${attributesExp}${styleExp}>${content.join?.('')}</${tag}>`;
11
- }
12
- exports.tag = tag;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._style = exports._tr = exports._thead = exports._th = exports._td = exports._tbody = exports._tab = exports._pre = exports._p = exports._main = exports._img = exports._htm = exports._header = exports._head = exports._h6 = exports._h5 = exports._h4 = exports._h3 = exports._h2 = exports._h1 = exports._div = exports._body = void 0;
4
- const self_closing_tag_function_1 = require("./self-closing-tag.function");
5
- const tag_function_1 = require("./tag.function");
6
- exports._body = tag_function_1.tag.bind(null, 'body');
7
- exports._div = tag_function_1.tag.bind(null, 'div');
8
- exports._h1 = tag_function_1.tag.bind(null, 'h1');
9
- exports._h2 = tag_function_1.tag.bind(null, 'h2');
10
- exports._h3 = tag_function_1.tag.bind(null, 'h3');
11
- exports._h4 = tag_function_1.tag.bind(null, 'h4');
12
- exports._h5 = tag_function_1.tag.bind(null, 'h5');
13
- exports._h6 = tag_function_1.tag.bind(null, 'h6');
14
- exports._head = tag_function_1.tag.bind(null, 'head');
15
- exports._header = tag_function_1.tag.bind(null, 'header');
16
- exports._htm = tag_function_1.tag.bind(null, 'html');
17
- exports._img = self_closing_tag_function_1.selfClosingTag.bind(null, 'img');
18
- exports._main = tag_function_1.tag.bind(null, 'main');
19
- exports._p = tag_function_1.tag.bind(null, 'p');
20
- exports._pre = tag_function_1.tag.bind(null, 'pre');
21
- exports._tab = tag_function_1.tag.bind(null, 'table');
22
- exports._tbody = tag_function_1.tag.bind(null, 'tbody');
23
- exports._td = tag_function_1.tag.bind(null, 'td');
24
- exports._th = tag_function_1.tag.bind(null, 'th');
25
- exports._thead = tag_function_1.tag.bind(null, 'thead');
26
- exports._tr = tag_function_1.tag.bind(null, 'tr');
27
- exports._style = tag_function_1.tag.bind(null, 'style');
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.emailBody = void 0;
4
- const elements_1 = require("./primitives/elements");
5
- const font_styles_constant_1 = require("./styles/font-styles.constant");
6
- function emailBody(title, subtitle, markup, logoUrl, extraStyles = {}) {
7
- return (0, elements_1.div)([
8
- (0, elements_1.div)([
9
- (0, elements_1.div)([
10
- logoUrl
11
- ? `<img height="64" width="auto" src="${logoUrl}" />`
12
- : undefined,
13
- title ? (0, elements_1.h1)([title]) : undefined,
14
- subtitle ? (0, elements_1.h2)([subtitle]) : undefined,
15
- ].filter(Boolean)),
16
- (0, elements_1.div)(markup),
17
- ], {
18
- style: {
19
- ...font_styles_constant_1.fontStyles,
20
- ...(extraStyles || {})
21
- }
22
- }),
23
- ]);
24
- }
25
- exports.emailBody = emailBody;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.element = void 0;
4
- const format_attributes_function_1 = require("./format-attributes.function");
5
- const inline_style_function_1 = require("./inline-style.function");
6
- function element(tag, content, attributes) {
7
- const { cssClass = '', style = undefined, ...attrs } = attributes || {};
8
- const classExp = cssClass ? ` class="${cssClass}"` : '';
9
- const attributesExp = attrs ? ` ${(0, format_attributes_function_1.formatAttributes)(attrs)}` : '';
10
- const styleExp = style ? ` ${(0, inline_style_function_1.inlineStyle)(style)}` : '';
11
- return `<${tag}${classExp}${attributesExp}${styleExp}>${content.join?.('')}</${tag}>`;
12
- }
13
- exports.element = element;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.style = exports.tr = exports.thead = exports.th = exports.td = exports.tbody = exports.tab = exports.pre = exports.p = exports.main = exports.img = exports.htm = exports.header = exports.head = exports.h6 = exports.h5 = exports.h4 = exports.h3 = exports.h2 = exports.h1 = exports.div = exports.button = exports.body = exports.anchor = void 0;
4
- const element_function_1 = require("./element.function");
5
- const self_closing_element_function_1 = require("./self-closing-element.function");
6
- const button_styles_constant_1 = require("../styles/button-styles.constant");
7
- const anchor = (content, attributes) => (0, element_function_1.element)('a', content, { ...attributes, style: { ...button_styles_constant_1.buttonStyles, ...attributes?.style } });
8
- exports.anchor = anchor;
9
- exports.body = element_function_1.element.bind(null, 'body');
10
- const button = (content, attributes) => (0, element_function_1.element)('button', content, { ...attributes, style: { ...button_styles_constant_1.buttonStyles, ...attributes?.style } });
11
- exports.button = button;
12
- exports.div = element_function_1.element.bind(null, 'div');
13
- exports.h1 = element_function_1.element.bind(null, 'h1');
14
- exports.h2 = element_function_1.element.bind(null, 'h2');
15
- exports.h3 = element_function_1.element.bind(null, 'h3');
16
- exports.h4 = element_function_1.element.bind(null, 'h4');
17
- exports.h5 = element_function_1.element.bind(null, 'h5');
18
- exports.h6 = element_function_1.element.bind(null, 'h6');
19
- exports.head = element_function_1.element.bind(null, 'head');
20
- exports.header = element_function_1.element.bind(null, 'header');
21
- exports.htm = element_function_1.element.bind(null, 'html');
22
- exports.img = self_closing_element_function_1.selfClosingElement.bind(null, 'img');
23
- exports.main = element_function_1.element.bind(null, 'main');
24
- exports.p = element_function_1.element.bind(null, 'p');
25
- exports.pre = element_function_1.element.bind(null, 'pre');
26
- exports.tab = element_function_1.element.bind(null, 'table');
27
- exports.tbody = element_function_1.element.bind(null, 'tbody');
28
- exports.td = element_function_1.element.bind(null, 'td');
29
- exports.th = element_function_1.element.bind(null, 'th');
30
- exports.thead = element_function_1.element.bind(null, 'thead');
31
- exports.tr = element_function_1.element.bind(null, 'tr');
32
- // todo: make this take a Record<string, Record<string, string>> instead of the terrible raw string formatting used now
33
- // todo: apply kebab-casing to camelCased keys so that consumers can write { fontWeight: 600 } instead of {'font-weight': 600 } (do this for all style properties of primitives' attributes)
34
- exports.style = element_function_1.element.bind(null, 'style');
@@ -1 +0,0 @@
1
- export declare function formatAttributes(attributes: Record<string, any>): string;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatAttributes = void 0;
4
- function formatAttributes(attributes) {
5
- return Object.entries(attributes)
6
- .map(([k, v]) => `${k}="${v}"`)
7
- .join(' ');
8
- }
9
- exports.formatAttributes = formatAttributes;
@@ -1,2 +0,0 @@
1
- import { TAttributes } from "../types/attributes.type";
2
- export declare function selfClosingElement(tag: string, attributes: TAttributes): string;
@@ -1,7 +0,0 @@
1
- export declare const fontStyles: {
2
- 'font-family': string;
3
- 'font-size': string;
4
- '-webkit-font-smoothing': string;
5
- '-moz-osx-font-smoothing': string;
6
- color: string;
7
- };
@@ -1,4 +0,0 @@
1
- export type TAttributes = Record<string, any> & {
2
- cssClass?: string;
3
- style?: Record<string, string>;
4
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- import { TAttributes } from "./attributes.type";
2
- export type TSelfClosingElementRenderer = (attributes?: TAttributes) => string;
@@ -1,20 +0,0 @@
1
- export * from './lib/deprecated/a.function';
2
- export * from './lib/deprecated/html-element-renderer.type';
3
- export * from './lib/deprecated/html.function';
4
- export * from './lib/deprecated/login-button.function';
5
- export * from './lib/deprecated/self-closing-html-element-renderer.type';
6
- export * from './lib/deprecated/self-closing-tag.function';
7
- export * from './lib/deprecated/tag.function';
8
- export * from './lib/deprecated/tags';
9
- export * from './lib/primitives/element.function';
10
- export * from './lib/primitives/elements';
11
- export * from './lib/primitives/format-attributes.function';
12
- export * from './lib/primitives/inline-style.function';
13
- export * from './lib/primitives/self-closing-element.function';
14
- export * from './lib/styles/button-styles.constant';
15
- export * from './lib/styles/font-styles.constant';
16
- export * from './lib/types/attributes.type';
17
- export * from './lib/types/element-renderer.type';
18
- export * from './lib/types/self-closing-element-renderer.type';
19
- export * from './lib/email-body.function';
20
- export * from './lib/table.function';
package/dist/esm/index.js DELETED
@@ -1,36 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./lib/deprecated/a.function"), exports);
18
- __exportStar(require("./lib/deprecated/html-element-renderer.type"), exports);
19
- __exportStar(require("./lib/deprecated/html.function"), exports);
20
- __exportStar(require("./lib/deprecated/login-button.function"), exports);
21
- __exportStar(require("./lib/deprecated/self-closing-html-element-renderer.type"), exports);
22
- __exportStar(require("./lib/deprecated/self-closing-tag.function"), exports);
23
- __exportStar(require("./lib/deprecated/tag.function"), exports);
24
- __exportStar(require("./lib/deprecated/tags"), exports);
25
- __exportStar(require("./lib/primitives/element.function"), exports);
26
- __exportStar(require("./lib/primitives/elements"), exports);
27
- __exportStar(require("./lib/primitives/format-attributes.function"), exports);
28
- __exportStar(require("./lib/primitives/inline-style.function"), exports);
29
- __exportStar(require("./lib/primitives/self-closing-element.function"), exports);
30
- __exportStar(require("./lib/styles/button-styles.constant"), exports);
31
- __exportStar(require("./lib/styles/font-styles.constant"), exports);
32
- __exportStar(require("./lib/types/attributes.type"), exports);
33
- __exportStar(require("./lib/types/element-renderer.type"), exports);
34
- __exportStar(require("./lib/types/self-closing-element-renderer.type"), exports);
35
- __exportStar(require("./lib/email-body.function"), exports);
36
- __exportStar(require("./lib/table.function"), exports);
@@ -1 +0,0 @@
1
- export type THtmlElementRenderer = (content: Array<string | number>, cssClass?: string, attributes?: Record<string, any>, styles?: Record<string, string>) => string;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +0,0 @@
1
- export declare function html(title: string, subtitle: string, markup: Array<string | number>, logoUrl?: string): string;
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.html = void 0;
4
- const tags_1 = require("./tags");
5
- function html(title, subtitle, markup, logoUrl) {
6
- return (0, tags_1._htm)([
7
- (0, tags_1._head)([
8
- (0, tags_1._style)([
9
- 'body {',
10
- 'padding: 64px;',
11
- `font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";`,
12
- `font-size: 1rem;`,
13
- `-webkit-font-smoothing: antialiased;`,
14
- `-moz-osx-font-smoothing: grayscale;`,
15
- 'color: rgb(34, 30, 31);',
16
- '}',
17
- 'h1, h2, h3, h4, pre { color: rgb(34, 30, 31) !important; }',
18
- 'td, th { text-align: left; padding: 8px;}',
19
- 'table { border-collapse: collapse; width: 100%;}',
20
- 'tbody { border-width: 1px; border-style: solid; border-left-style: none; border-right-style: none; }',
21
- '.focal, a { padding: 12px 24px; font-weight: bold; display: block; text-align: center; border-radius: 4px; }',
22
- '.mw-880 { max-width: 880px !important; margin: auto; }',
23
- '.mw-440 { max-width: 440px !important; margin: auto; }',
24
- 'pre { padding: 12px 24px; font-weight: bold; display: block; text-align: center; border-radius: 4px; border: solid 1px; }',
25
- 'a { max-width: 240px; }',
26
- '.bg-gray { background-color: #efefef; }',
27
- '.drop-shadow, .button { filter: drop-shadow(2px 2px 1px rgba(0, 0, 0, 0.3)); }',
28
- '.button { text-decoration: none; margin: 32px 0; background-color: rgb(205, 62, 71); color: white !important; }',
29
- ]),
30
- ]),
31
- (0, tags_1._body)([
32
- (0, tags_1._header)([
33
- logoUrl
34
- ? `<img height="64" width="auto" src="${logoUrl}" />`
35
- : undefined,
36
- (0, tags_1._h1)([title]),
37
- (0, tags_1._h2)([subtitle]),
38
- ].filter(Boolean)),
39
- (0, tags_1._main)(markup),
40
- ]),
41
- ]);
42
- }
43
- exports.html = html;
@@ -1 +0,0 @@
1
- export declare function loginButton(text: string, href: string, extraStyles?: Record<string, string>): string;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loginButton = void 0;
4
- const elements_1 = require("../primitives/elements");
5
- const button_styles_constant_1 = require("../styles/button-styles.constant");
6
- function loginButton(text, href, extraStyles) {
7
- return (0, elements_1.anchor)([text], {
8
- href,
9
- style: {
10
- ...button_styles_constant_1.buttonStyles,
11
- ...(extraStyles || {})
12
- }
13
- });
14
- }
15
- exports.loginButton = loginButton;
@@ -1 +0,0 @@
1
- export type TSelfClosingHtmlElementRenderer = (cssClass?: string, attributes?: Record<string, any>, styles?: Record<string, string>) => string;
@@ -1 +0,0 @@
1
- export declare function selfClosingTag(tag: string, cssClass?: string, attributes?: Record<string, any>, styles?: Record<string, string>): string;
@@ -1 +0,0 @@
1
- export declare function tag(tag: string, content: Array<string | number>, cssClass?: string, attributes?: Record<string, any>, styles?: Record<string, string>): string;
@@ -1,24 +0,0 @@
1
- import { THtmlElementRenderer } from "./html-element-renderer.type";
2
- import { TSelfClosingHtmlElementRenderer } from "./self-closing-html-element-renderer.type";
3
- export declare const _body: THtmlElementRenderer;
4
- export declare const _div: THtmlElementRenderer;
5
- export declare const _h1: THtmlElementRenderer;
6
- export declare const _h2: THtmlElementRenderer;
7
- export declare const _h3: THtmlElementRenderer;
8
- export declare const _h4: THtmlElementRenderer;
9
- export declare const _h5: THtmlElementRenderer;
10
- export declare const _h6: THtmlElementRenderer;
11
- export declare const _head: THtmlElementRenderer;
12
- export declare const _header: THtmlElementRenderer;
13
- export declare const _htm: THtmlElementRenderer;
14
- export declare const _img: TSelfClosingHtmlElementRenderer;
15
- export declare const _main: THtmlElementRenderer;
16
- export declare const _p: THtmlElementRenderer;
17
- export declare const _pre: THtmlElementRenderer;
18
- export declare const _tab: THtmlElementRenderer;
19
- export declare const _tbody: THtmlElementRenderer;
20
- export declare const _td: THtmlElementRenderer;
21
- export declare const _th: THtmlElementRenderer;
22
- export declare const _thead: THtmlElementRenderer;
23
- export declare const _tr: THtmlElementRenderer;
24
- export declare const _style: any;
@@ -1,2 +0,0 @@
1
- import { TAttributes } from './types/attributes.type';
2
- export declare function emailBody(title: string, subtitle: string, markup: Array<string | number>, logoUrl?: string, extraStyles?: TAttributes['style']): string;
@@ -1,2 +0,0 @@
1
- import { TAttributes } from "../types/attributes.type";
2
- export declare function element(tag: string, content: Array<string | number>, attributes?: TAttributes): string;
@@ -1,26 +0,0 @@
1
- import { TElementRenderer } from "../types/element-renderer.type";
2
- import { TSelfClosingElementRenderer } from "../types/self-closing-element-renderer.type";
3
- export declare const anchor: TElementRenderer;
4
- export declare const body: TElementRenderer;
5
- export declare const button: TElementRenderer;
6
- export declare const div: TElementRenderer;
7
- export declare const h1: TElementRenderer;
8
- export declare const h2: TElementRenderer;
9
- export declare const h3: TElementRenderer;
10
- export declare const h4: TElementRenderer;
11
- export declare const h5: TElementRenderer;
12
- export declare const h6: TElementRenderer;
13
- export declare const head: TElementRenderer;
14
- export declare const header: TElementRenderer;
15
- export declare const htm: TElementRenderer;
16
- export declare const img: TSelfClosingElementRenderer;
17
- export declare const main: TElementRenderer;
18
- export declare const p: TElementRenderer;
19
- export declare const pre: TElementRenderer;
20
- export declare const tab: TElementRenderer;
21
- export declare const tbody: TElementRenderer;
22
- export declare const td: TElementRenderer;
23
- export declare const th: TElementRenderer;
24
- export declare const thead: TElementRenderer;
25
- export declare const tr: TElementRenderer;
26
- export declare const style: any;
@@ -1 +0,0 @@
1
- export declare function formatAttributes(attributes: Record<string, any>): string;
@@ -1 +0,0 @@
1
- export declare function inlineStyle(styles: Record<string, string>): string;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.inlineStyle = void 0;
4
- function inlineStyle(styles) {
5
- const rules = Object.entries(styles)
6
- .map(([k, v]) => `${k}: ${v};`)
7
- .join(' ');
8
- return `style="${rules}"`;
9
- }
10
- exports.inlineStyle = inlineStyle;
@@ -1,2 +0,0 @@
1
- import { TAttributes } from "../types/attributes.type";
2
- export declare function selfClosingElement(tag: string, attributes: TAttributes): string;