2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-17 19:21:20 +03:00

feat: react, vue3 and vanilla examples (#242)

* feat: react, vue3 and vanilla examples

* fix: vue3 example

* Create rare-worms-tease.md

* fix: vue3 types

* fix: vue3 ts checks

* fix: vue3 render types

* fix: vue3 component types
This commit is contained in:
Nikolay Kost
2024-07-12 03:35:51 +03:00
committed by GitHub
parent 1490bd6a8b
commit 16ad5216db
63 changed files with 2389 additions and 226 deletions
+5 -5
View File
@@ -53,12 +53,12 @@ const renderContent = (content: TagNodeTree, openTag: string, closeTag: string)
return null
}
export class TagNode implements TagNodeObject {
public readonly tag: string
export class TagNode<TagValue extends any = any> implements TagNodeObject {
public readonly tag: string | TagValue
public attrs: Record<string, unknown>
public content: TagNodeTree
constructor(tag: string, attrs: Record<string, unknown>, content: TagNodeTree) {
constructor(tag: string | TagValue, attrs: Record<string, unknown>, content: TagNodeTree) {
this.tag = tag;
this.attrs = attrs;
this.content = content
@@ -81,7 +81,7 @@ export class TagNode implements TagNodeObject {
}
toTagStart({ openTag = OPEN_BRAKET, closeTag = CLOSE_BRAKET } = {}) {
const tagAttrs = getTagAttrs(this.tag, this.attrs);
const tagAttrs = getTagAttrs(String(this.tag), this.attrs);
return `${openTag}${tagAttrs}${closeTag}`;
}
@@ -91,7 +91,7 @@ export class TagNode implements TagNodeObject {
}
toTagNode() {
return new TagNode(this.tag.toLowerCase(), this.attrs, this.content);
return new TagNode(String(this.tag).toLowerCase(), this.attrs, this.content);
}
toString({ openTag = OPEN_BRAKET, closeTag = CLOSE_BRAKET } = {}): string {