diff options
| author | Akshay Nair <phenax5@gmail.com> | 2023-08-25 12:14:42 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2023-08-25 12:14:42 +0530 |
| commit | ca0737e393bbf5c45f688593bbfaf41079a66784 (patch) | |
| tree | f3de7e5ce2bbd022fabd50db23bd54a240a89735 /src/index.ts | |
| parent | f7ea49c88717c0c15835c9024c84a95678836a30 (diff) | |
| download | css-everything-ca0737e393bbf5c45f688593bbfaf41079a66784.tar.gz css-everything-ca0737e393bbf5c45f688593bbfaf41079a66784.zip | |
feat: h expressions for declaring elements
Diffstat (limited to '')
| -rw-r--r-- | src/index.ts | 11 |
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) + } } } |
