@maizzle/framework 5.0.0-beta.15 → 5.0.0-beta.17
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/package.json +13 -12
- package/src/posthtml/index.js +3 -1
- package/types/build.d.ts +3 -3
- package/types/config.d.ts +8 -2
- package/types/events.d.ts +20 -9
- package/types/posthtml.d.ts +3 -3
- package/types/components.d.ts +0 -195
- package/types/expressions.d.ts +0 -100
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maizzle/framework",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.17",
|
|
4
4
|
"description": "Maizzle is a framework that helps you quickly build HTML emails with Tailwind CSS.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -72,24 +72,25 @@
|
|
|
72
72
|
"postcss-import": "^16.1.0",
|
|
73
73
|
"postcss-safe-parser": "^7.0.0",
|
|
74
74
|
"posthtml": "^0.16.6",
|
|
75
|
-
"posthtml-attrs-parser": "^1.1.
|
|
75
|
+
"posthtml-attrs-parser": "^1.1.1",
|
|
76
76
|
"posthtml-base-url": "^3.1.4",
|
|
77
|
-
"posthtml-component": "^
|
|
78
|
-
"posthtml-content": "^2.0
|
|
79
|
-
"posthtml-
|
|
77
|
+
"posthtml-component": "^2.0.0",
|
|
78
|
+
"posthtml-content": "^2.1.0",
|
|
79
|
+
"posthtml-expressions": "^1.11.4",
|
|
80
|
+
"posthtml-extra-attributes": "^3.1.0",
|
|
80
81
|
"posthtml-fetch": "^4.0.0",
|
|
81
|
-
"posthtml-markdownit": "^3.0
|
|
82
|
-
"posthtml-mso": "^3.
|
|
82
|
+
"posthtml-markdownit": "^3.1.0",
|
|
83
|
+
"posthtml-mso": "^3.1.0",
|
|
83
84
|
"posthtml-parser": "^0.12.0",
|
|
84
|
-
"posthtml-postcss": "^1.0.
|
|
85
|
-
"posthtml-postcss-merge-longhand": "^3.1.
|
|
85
|
+
"posthtml-postcss": "^1.0.2",
|
|
86
|
+
"posthtml-postcss-merge-longhand": "^3.1.2",
|
|
86
87
|
"posthtml-render": "^3.0.0",
|
|
87
|
-
"posthtml-safe-class-names": "^4.0
|
|
88
|
-
"posthtml-url-parameters": "^3.
|
|
88
|
+
"posthtml-safe-class-names": "^4.1.0",
|
|
89
|
+
"posthtml-url-parameters": "^3.1.0",
|
|
89
90
|
"pretty": "^2.0.0",
|
|
90
91
|
"string-remove-widows": "^4.0.22",
|
|
91
92
|
"string-strip-html": "^13.4.8",
|
|
92
|
-
"tailwindcss": "^3.4.
|
|
93
|
+
"tailwindcss": "^3.4.7",
|
|
93
94
|
"ws": "^8.17.0"
|
|
94
95
|
},
|
|
95
96
|
"devDependencies": {
|
package/src/posthtml/index.js
CHANGED
|
@@ -63,7 +63,7 @@ export async function process(html = '', config = {}) {
|
|
|
63
63
|
},
|
|
64
64
|
),
|
|
65
65
|
},
|
|
66
|
-
get(config, '
|
|
66
|
+
get(config, 'fetch', {})
|
|
67
67
|
)
|
|
68
68
|
)
|
|
69
69
|
|
|
@@ -87,6 +87,8 @@ export async function process(html = '', config = {}) {
|
|
|
87
87
|
),
|
|
88
88
|
expandLinkTag,
|
|
89
89
|
postcssPlugin,
|
|
90
|
+
envTags(config.env),
|
|
91
|
+
envAttributes(config.env),
|
|
90
92
|
...get(config, 'posthtml.plugins.after', get(config, 'posthtml.plugins', []))
|
|
91
93
|
])
|
|
92
94
|
.process(html, posthtmlOptions)
|
package/types/build.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SpinnerName } from 'cli-spinners';
|
|
2
|
-
import type
|
|
2
|
+
import type { PostHTMLExpressions } from 'posthtml-expressions';
|
|
3
3
|
|
|
4
4
|
export default interface BuildConfig {
|
|
5
5
|
/**
|
|
@@ -19,9 +19,9 @@ export default interface BuildConfig {
|
|
|
19
19
|
content?: string[];
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
Configure expressions.
|
|
22
|
+
Configure [posthtml-expressions](https://github.com/posthtml/posthtml-expressions) options.
|
|
23
23
|
*/
|
|
24
|
-
expressions?:
|
|
24
|
+
expressions?: PostHTMLExpressions;
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Define the output path for compiled Templates, and what file extension they should use.
|
package/types/config.d.ts
CHANGED
|
@@ -8,11 +8,12 @@ import type PurgeCSSConfig from './css/purge';
|
|
|
8
8
|
import type PlaintextConfig from './plaintext';
|
|
9
9
|
import type CSSInlineConfig from './css/inline';
|
|
10
10
|
import type { SpinnerName } from 'cli-spinners';
|
|
11
|
-
import type ComponentsConfig from './components';
|
|
12
11
|
import type WidowWordsConfig from './widowWords';
|
|
13
12
|
import type { CoreBeautifyOptions } from 'js-beautify';
|
|
14
13
|
import type { BaseURLConfig } from 'posthtml-base-url';
|
|
15
14
|
import type URLParametersConfig from './urlParameters';
|
|
15
|
+
import type { PostHTMLFetchConfig } from 'posthtml-fetch';
|
|
16
|
+
import type { PostHTMLComponents } from 'posthtml-component';
|
|
16
17
|
|
|
17
18
|
import type { Config as TailwindConfig } from 'tailwindcss';
|
|
18
19
|
|
|
@@ -93,7 +94,7 @@ export default interface Config {
|
|
|
93
94
|
/**
|
|
94
95
|
* Configure components.
|
|
95
96
|
*/
|
|
96
|
-
components?:
|
|
97
|
+
components?: PostHTMLComponents;
|
|
97
98
|
|
|
98
99
|
/**
|
|
99
100
|
* Configure how CSS is handled.
|
|
@@ -169,6 +170,11 @@ export default interface Config {
|
|
|
169
170
|
tailwind?: TailwindConfig;
|
|
170
171
|
}
|
|
171
172
|
|
|
173
|
+
/**
|
|
174
|
+
* Configure the [`<fetch>`](https://maizzle.com/docs/tags#fetch) tag.
|
|
175
|
+
*/
|
|
176
|
+
fetch?: PostHTMLFetchConfig;
|
|
177
|
+
|
|
172
178
|
/**
|
|
173
179
|
* Transform text inside elements marked with custom attributes.
|
|
174
180
|
* Filters work only on elements that contain only text.
|
package/types/events.d.ts
CHANGED
|
@@ -18,7 +18,12 @@ export default interface Events {
|
|
|
18
18
|
* }
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
|
-
beforeCreate?: (params: {
|
|
21
|
+
beforeCreate?: (params: {
|
|
22
|
+
/**
|
|
23
|
+
* The computed Maizzle config object.
|
|
24
|
+
*/
|
|
25
|
+
config: Config
|
|
26
|
+
}) => void | Promise<void>;
|
|
22
27
|
|
|
23
28
|
/**
|
|
24
29
|
* Runs after the Template's config has been computed, but just before it is compiled.
|
|
@@ -43,11 +48,13 @@ export default interface Events {
|
|
|
43
48
|
*/
|
|
44
49
|
html: string;
|
|
45
50
|
/**
|
|
46
|
-
* The Template's Front Matter.
|
|
51
|
+
* The Template's Front Matter data.
|
|
47
52
|
*/
|
|
48
53
|
matter: { [key: string]: string };
|
|
49
54
|
/**
|
|
50
55
|
* The Template's computed config.
|
|
56
|
+
*
|
|
57
|
+
* This is the Environment config merged with the Template's Front Matter.
|
|
51
58
|
*/
|
|
52
59
|
config: Config;
|
|
53
60
|
/**
|
|
@@ -82,11 +89,13 @@ export default interface Events {
|
|
|
82
89
|
*/
|
|
83
90
|
html: string;
|
|
84
91
|
/**
|
|
85
|
-
* The Template's Front Matter.
|
|
92
|
+
* The Template's Front Matter data.
|
|
86
93
|
*/
|
|
87
94
|
matter: { [key: string]: string };
|
|
88
95
|
/**
|
|
89
96
|
* The Template's computed config.
|
|
97
|
+
*
|
|
98
|
+
* This is the Environment config merged with the Template's Front Matter.
|
|
90
99
|
*/
|
|
91
100
|
config: Config;
|
|
92
101
|
/**
|
|
@@ -121,11 +130,13 @@ export default interface Events {
|
|
|
121
130
|
*/
|
|
122
131
|
html: string;
|
|
123
132
|
/**
|
|
124
|
-
* The Template's Front Matter.
|
|
133
|
+
* The Template's Front Matter data.
|
|
125
134
|
*/
|
|
126
135
|
matter: { [key: string]: string };
|
|
127
136
|
/**
|
|
128
137
|
* The Template's computed config.
|
|
138
|
+
*
|
|
139
|
+
* This is the Environment config merged with the Template's Front Matter.
|
|
129
140
|
*/
|
|
130
141
|
config: Config;
|
|
131
142
|
/**
|
|
@@ -146,7 +157,7 @@ export default interface Events {
|
|
|
146
157
|
* @example
|
|
147
158
|
* ```
|
|
148
159
|
* export default {
|
|
149
|
-
* afterBuild: async ({
|
|
160
|
+
* afterBuild: async ({config, files}) => {
|
|
150
161
|
* // do something...
|
|
151
162
|
* }
|
|
152
163
|
* }
|
|
@@ -154,12 +165,12 @@ export default interface Events {
|
|
|
154
165
|
*/
|
|
155
166
|
afterBuild?: (params: {
|
|
156
167
|
/**
|
|
157
|
-
*
|
|
168
|
+
* The computed Maizzle config object.
|
|
158
169
|
*/
|
|
159
|
-
|
|
170
|
+
config: Config;
|
|
160
171
|
/**
|
|
161
|
-
*
|
|
172
|
+
* An array of paths to all the files inside the `build.output.path` directory.
|
|
162
173
|
*/
|
|
163
|
-
|
|
174
|
+
files: string[];
|
|
164
175
|
}) => string | Promise<string>;
|
|
165
176
|
}
|
package/types/posthtml.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Directive } from 'posthtml-parser';
|
|
2
|
-
import type
|
|
2
|
+
import type { PostHTMLExpressions } from 'posthtml-expressions';
|
|
3
3
|
|
|
4
4
|
export interface PostHTMLOptions {
|
|
5
5
|
/**
|
|
@@ -128,9 +128,9 @@ export interface PostHTMLOptions {
|
|
|
128
128
|
|
|
129
129
|
export default interface PostHTMLConfig {
|
|
130
130
|
/**
|
|
131
|
-
Configure expressions.
|
|
131
|
+
Configure [posthtml-expressions](https://github.com/posthtml/posthtml-expressions) options.
|
|
132
132
|
*/
|
|
133
|
-
expressions?:
|
|
133
|
+
expressions?: PostHTMLExpressions;
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
136
|
Configure PostHTML options.
|
package/types/components.d.ts
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import type ExpressionsConfig from './expressions';
|
|
2
|
-
import type { Options as PostHTMLParserOptions } from 'posthtml-parser';
|
|
3
|
-
|
|
4
|
-
interface AnyObject {
|
|
5
|
-
[key: string]: string | AnyObject;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export default interface ComponentsConfig {
|
|
9
|
-
/**
|
|
10
|
-
* Root path where to look for folders containing component files.
|
|
11
|
-
*
|
|
12
|
-
* @default './'
|
|
13
|
-
*/
|
|
14
|
-
root?: string;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Paths where to look for component files. Must be relative to `root`.
|
|
18
|
-
*
|
|
19
|
-
* @default ['src/components', 'src/layouts', 'src/templates']
|
|
20
|
-
*/
|
|
21
|
-
folders?: string[];
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Prefix to use for component tags.
|
|
25
|
-
*
|
|
26
|
-
* @default 'x-'
|
|
27
|
-
*/
|
|
28
|
-
tagPrefix?: string;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Tag name to be used in HTML when using a component.
|
|
32
|
-
*
|
|
33
|
-
* @default 'component'
|
|
34
|
-
*/
|
|
35
|
-
tag?: string;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Attribute name to be used when referencing a component via its path.
|
|
39
|
-
*
|
|
40
|
-
* @default 'src'
|
|
41
|
-
*/
|
|
42
|
-
attribute?: string;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* File extension that component files must use.
|
|
46
|
-
* Any other files will be ignored and not be made available as components.
|
|
47
|
-
*
|
|
48
|
-
* @default 'html'
|
|
49
|
-
*/
|
|
50
|
-
fileExtension?: string;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Name of the tag that will be replaced with the content that is passed to the component.
|
|
54
|
-
*
|
|
55
|
-
* @default 'yield'
|
|
56
|
-
*/
|
|
57
|
-
yield?: string;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Name of the slot tag, where the content will be injected.
|
|
61
|
-
*
|
|
62
|
-
* @default 'slot'
|
|
63
|
-
*/
|
|
64
|
-
slot?: string;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Name of the fill tag, where the content to be injected is defined.
|
|
68
|
-
*
|
|
69
|
-
* @default 'fill'
|
|
70
|
-
*/
|
|
71
|
-
fill?: string;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* String to use as a separator between the slot tag and its name.
|
|
75
|
-
*
|
|
76
|
-
* @default ':'
|
|
77
|
-
*/
|
|
78
|
-
slotSeparator?: string;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Tag name for pushing content to a stack.
|
|
82
|
-
*
|
|
83
|
-
* @default 'push'
|
|
84
|
-
*/
|
|
85
|
-
push?: string;
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Tag name for popping (rendering) content from a stack.
|
|
89
|
-
*
|
|
90
|
-
* @default 'stack'
|
|
91
|
-
*/
|
|
92
|
-
stack?: string;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Name of the props attribute to use in the `<script>` tag of a component.
|
|
96
|
-
*
|
|
97
|
-
* @default 'props'
|
|
98
|
-
*/
|
|
99
|
-
propsScriptAttribute?: string;
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Name of the object that will be used to store the props of a component.
|
|
103
|
-
*
|
|
104
|
-
* @default 'props'
|
|
105
|
-
*/
|
|
106
|
-
propsContext?: string;
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Name of the attribute that will be used to pass props to a component as JSON.
|
|
110
|
-
*
|
|
111
|
-
* @default 'locals'
|
|
112
|
-
*/
|
|
113
|
-
propsAttribute?: string;
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Name of the key to use when retrieving props passed to a slot via `$slots.slotName.props`.
|
|
117
|
-
*
|
|
118
|
-
* @default 'props'
|
|
119
|
-
*/
|
|
120
|
-
propsSlot?: string;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Configure [`posthtml-parser`](https://github.com/posthtml/posthtml-parser).
|
|
124
|
-
*
|
|
125
|
-
* @default
|
|
126
|
-
* {
|
|
127
|
-
* recognizeNoValueAttribute: true,
|
|
128
|
-
* recognizeSelfClosing: true
|
|
129
|
-
* }
|
|
130
|
-
*/
|
|
131
|
-
parserOptions?: PostHTMLParserOptions;
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Configure [`posthtml-expressions`](https://github.com/posthtml/posthtml-expressions).
|
|
135
|
-
*
|
|
136
|
-
* @default
|
|
137
|
-
* {
|
|
138
|
-
* strictMode: false,
|
|
139
|
-
* missingLocal: '{local}',
|
|
140
|
-
* locals: {
|
|
141
|
-
* page: config, // the computed Maizzle config object
|
|
142
|
-
* }
|
|
143
|
-
* }
|
|
144
|
-
*/
|
|
145
|
-
expressions?: ExpressionsConfig;
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* PostHTML plugins to apply to each parsed component.
|
|
149
|
-
*
|
|
150
|
-
* @default []
|
|
151
|
-
*/
|
|
152
|
-
plugins?: Array<() => void>;
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Extra rules for the PostHTML plugin that is used by components to parse attributes.
|
|
156
|
-
*
|
|
157
|
-
* @default {}
|
|
158
|
-
*/
|
|
159
|
-
attrsParserRules?: Record<string, AnyObject>;
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* In strict mode, an error will be thrown if a component cannot be rendered.
|
|
163
|
-
*
|
|
164
|
-
* @default true
|
|
165
|
-
*/
|
|
166
|
-
strict?: boolean;
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Utility methods to be passed to `<script props>` in a component.
|
|
170
|
-
*
|
|
171
|
-
* @default {merge: _.mergeWith, template: _.template}
|
|
172
|
-
*/
|
|
173
|
-
utilities?: Record<string, unknown>;
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Define additional attributes that should be preserved for specific HTML elements.
|
|
177
|
-
*
|
|
178
|
-
* @default {}
|
|
179
|
-
*/
|
|
180
|
-
elementAttributes?: Record<string, void>;
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Attributes that should be preserved on all elements in components.
|
|
184
|
-
*
|
|
185
|
-
* @default ['data-*']
|
|
186
|
-
*/
|
|
187
|
-
safelistAttributes?: string[];
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Attributes that should be removed from all elements in components.
|
|
191
|
-
*
|
|
192
|
-
* @default []
|
|
193
|
-
*/
|
|
194
|
-
blacklistAttributes?: string[];
|
|
195
|
-
}
|
package/types/expressions.d.ts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
export default interface ExpressionsConfig {
|
|
2
|
-
/**
|
|
3
|
-
Define the starting and ending delimiters used for expressions.
|
|
4
|
-
|
|
5
|
-
@default ['{{', '}}']
|
|
6
|
-
*/
|
|
7
|
-
delimiters?: string[];
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
Define the starting and ending delimiters used for unescaped expressions.
|
|
11
|
-
|
|
12
|
-
@default ['{{{', '}}}']
|
|
13
|
-
*/
|
|
14
|
-
unescapeDelimiters?: string[];
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
Object containing data that will be available under the `page` object.
|
|
18
|
-
|
|
19
|
-
@default {}
|
|
20
|
-
*/
|
|
21
|
-
locals?: Record<string, unknown>;
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
Attribute name for `<script>` tags that contain locals.
|
|
25
|
-
|
|
26
|
-
@default 'locals'
|
|
27
|
-
*/
|
|
28
|
-
localsAttr?: string;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
Whether to remove `<script>` tags that contain locals.
|
|
32
|
-
|
|
33
|
-
@default false
|
|
34
|
-
*/
|
|
35
|
-
removeScriptLocals?: boolean;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
Tag names to be used for if/else statements.
|
|
39
|
-
|
|
40
|
-
@default ['if', 'elseif', 'else']
|
|
41
|
-
*/
|
|
42
|
-
conditionalTags?: string[];
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
Tag names to be used for switch statements.
|
|
46
|
-
|
|
47
|
-
@default ['switch', 'case', 'default']
|
|
48
|
-
*/
|
|
49
|
-
switchTags?: string[];
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
Tag names to be used for loops.
|
|
53
|
-
|
|
54
|
-
@default ['each', 'for']
|
|
55
|
-
*/
|
|
56
|
-
loopTags?: string[];
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
Tag names to be used for scopes.
|
|
60
|
-
|
|
61
|
-
@default ['scope']
|
|
62
|
-
*/
|
|
63
|
-
scopeTags?: string[];
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
Name of tag inside of which expression parsing is disabled.
|
|
67
|
-
|
|
68
|
-
@default 'raw'
|
|
69
|
-
*/
|
|
70
|
-
ignoredTag?: string;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
Enabling strict mode will throw an error if an expression cannot be evaluated.
|
|
74
|
-
|
|
75
|
-
@default false
|
|
76
|
-
*/
|
|
77
|
-
strictMode?: boolean;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
What to render when referencing a value that is not defined in `locals`.
|
|
81
|
-
|
|
82
|
-
By default, the string 'undefined' will be output.
|
|
83
|
-
|
|
84
|
-
@default undefined
|
|
85
|
-
|
|
86
|
-
@example
|
|
87
|
-
|
|
88
|
-
```
|
|
89
|
-
// Output empty string if value is not defined
|
|
90
|
-
missingLocal: ''
|
|
91
|
-
|
|
92
|
-
// Output original reference if value is not defined
|
|
93
|
-
missingLocal: '{local}'
|
|
94
|
-
|
|
95
|
-
// Output custom string if value is not defined
|
|
96
|
-
missingLocal: 'ERR_NO_VALUE: {local}'
|
|
97
|
-
```
|
|
98
|
-
*/
|
|
99
|
-
missingLocal?: string;
|
|
100
|
-
}
|