aboutsummaryrefslogtreecommitdiff
path: root/src/index.ts
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2023-08-25 12:14:42 +0530
committerAkshay Nair <phenax5@gmail.com>2023-08-25 12:14:42 +0530
commitca0737e393bbf5c45f688593bbfaf41079a66784 (patch)
treef3de7e5ce2bbd022fabd50db23bd54a240a89735 /src/index.ts
parentf7ea49c88717c0c15835c9024c84a95678836a30 (diff)
downloadcss-everything-ca0737e393bbf5c45f688593bbfaf41079a66784.tar.gz
css-everything-ca0737e393bbf5c45f688593bbfaf41079a66784.zip
feat: h expressions for declaring elements
Diffstat (limited to 'src/index.ts')
-rw-r--r--src/index.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/index.ts b/src/index.ts
index 69d1fea..bc471ee 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -247,10 +247,10 @@ export const handleEvents = async (
}
}
-const declarationToElement = (
+const declarationToElement = async (
declaration: Declaration,
$parent?: HTMLElement,
-): { node: HTMLElement; isNewElement: boolean } => {
+): Promise<{ node: HTMLElement; isNewElement: boolean }> => {
const { tag, id, selectors } = declaration.selector
const tagName = tag || 'div'
@@ -291,12 +291,17 @@ const createLayer = async (
if (!$childrenRoot.parentNode) $parent.appendChild($childrenRoot)
for (const declaration of declarations) {
- const { node: $child, isNewElement } = declarationToElement(
+ const { node: $child, isNewElement } = await declarationToElement(
declaration,
$childrenRoot,
)
$childrenRoot.appendChild($child)
+ console.log($child.dataset.element, isNewElement, declaration)
await manageElement($child, isNewElement)
+
+ if (declaration.children.length > 0) {
+ await createLayer(declaration.children, $child)
+ }
}
}