posthtml-component 2.2.0 → 2.2.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.
- package/package.json +2 -2
- package/src/index.js +5 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "posthtml-component",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "Laravel Blade-inspired components for PostHTML with slots, attributes as props, custom tags and more.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "posthtml/posthtml-components",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"style-to-object": "^1.0.6"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@biomejs/biome": "2.
|
|
42
|
+
"@biomejs/biome": "2.2.4",
|
|
43
43
|
"@vitest/coverage-v8": "^3.0.4",
|
|
44
44
|
"conventional-changelog-cli": "^5.0.0",
|
|
45
45
|
"highlight.js": "^11.6.0",
|
package/src/index.js
CHANGED
|
@@ -166,8 +166,6 @@ let processCounter = 0;
|
|
|
166
166
|
* @return {Object} PostHTML tree
|
|
167
167
|
*/
|
|
168
168
|
function processTree(options) {
|
|
169
|
-
const filledSlots = {};
|
|
170
|
-
|
|
171
169
|
return (tree, messages) => {
|
|
172
170
|
log(`Processing tree number ${processCounter}..`, 'processTree');
|
|
173
171
|
|
|
@@ -176,6 +174,8 @@ function processTree(options) {
|
|
|
176
174
|
}
|
|
177
175
|
|
|
178
176
|
match.call(tree, options.matcher, currentNode => {
|
|
177
|
+
const filledSlots = {};
|
|
178
|
+
|
|
179
179
|
log(`Match found for tag "${currentNode.tag}"..`, 'processTree');
|
|
180
180
|
|
|
181
181
|
if (!currentNode.attrs) {
|
|
@@ -229,14 +229,14 @@ function processTree(options) {
|
|
|
229
229
|
return currentNode.content || nextNode.content;
|
|
230
230
|
});
|
|
231
231
|
|
|
232
|
+
// Process <slot> tags
|
|
233
|
+
processSlotContent(nextNode, filledSlots, options);
|
|
234
|
+
|
|
232
235
|
nextNode = processTree(options)(nextNode, messages);
|
|
233
236
|
|
|
234
237
|
// Process <fill> tags
|
|
235
238
|
processFillContent(nextNode, filledSlots, options);
|
|
236
239
|
|
|
237
|
-
// Process <slot> tags
|
|
238
|
-
processSlotContent(nextNode, filledSlots, options);
|
|
239
|
-
|
|
240
240
|
// Remove component tag and replace content with <yield>
|
|
241
241
|
currentNode.tag = false;
|
|
242
242
|
currentNode.content = content;
|