mirror of
https://github.com/tenrok/BBob.git
synced 2026-06-20 20:00:33 +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:
@@ -0,0 +1,13 @@
|
||||
export type StringNode = string | number
|
||||
|
||||
export interface TagNodeObject<TagValue extends any = any> {
|
||||
readonly tag: TagValue
|
||||
attrs?: Record<string, unknown>
|
||||
content?: TagNodeTree<TagValue>
|
||||
}
|
||||
|
||||
export type NodeContent<TagValue extends any = any> = TagNodeObject<TagValue> | StringNode | null
|
||||
|
||||
export type PartialNodeContent<TagValue extends any = any> = Partial<TagNodeObject<TagValue>> | StringNode | null
|
||||
|
||||
export type TagNodeTree<TagValue extends any = any> = NodeContent<TagValue> | NodeContent<TagValue>[] | null
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ParseOptions } from "./parser";
|
||||
import { NodeContent, PartialNodeContent, TagNodeObject, TagNodeTree } from "./types";
|
||||
import { NodeContent, PartialNodeContent, TagNodeObject, TagNodeTree } from "./common";
|
||||
|
||||
export interface BBobCoreOptions<
|
||||
Data = unknown | null,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export * from './types'
|
||||
export * from './common'
|
||||
export * from './parser'
|
||||
export * from './core'
|
||||
export * from './preset'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TagNodeTree } from "./types";
|
||||
import { TagNodeTree } from "./common";
|
||||
|
||||
export interface ParseError {
|
||||
tagName: string;
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
|
||||
import { BBobCoreTagNodeTree, BBobPluginFunction, BBobPluginOptions } from "./core";
|
||||
import { TagNodeObject } from "./types";
|
||||
import { TagNodeObject } from "./common";
|
||||
|
||||
export type PartialRecord<K extends keyof any, T> = Partial<Record<K, T>>
|
||||
|
||||
export type PresetTagsDefinition<Key extends string = string> = Record<Key, PresetTagFunction>
|
||||
export type PresetTagsDefinition<
|
||||
Key extends string = string,
|
||||
TagValue extends any = any
|
||||
> = Record<Key, PresetTagFunction<TagNodeObject<TagValue>>>
|
||||
|
||||
export type PresetOptions = Record<string, unknown>
|
||||
|
||||
@@ -15,7 +18,7 @@ export type ProcessorFunction<Tags extends PresetTagsDefinition = PresetTagsDefi
|
||||
options: Options
|
||||
) => BBobCoreTagNodeTree
|
||||
|
||||
// export type ProcessorReturnType = ReturnType<ProcessorFunction>;
|
||||
export type ProcessorReturnType = ReturnType<ProcessorFunction>;
|
||||
|
||||
export interface PresetTagFunction<Node extends TagNodeObject = TagNodeObject, Options extends PresetOptions = PresetOptions> {
|
||||
(
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
export type StringNode = string | number
|
||||
|
||||
export interface TagNodeObject {
|
||||
readonly tag: string
|
||||
attrs?: Record<string, unknown>
|
||||
content?: TagNodeTree
|
||||
}
|
||||
|
||||
export type NodeContent = TagNodeObject | StringNode | null
|
||||
|
||||
export type PartialNodeContent = Partial<TagNodeObject> | StringNode | null
|
||||
|
||||
export type TagNodeTree = NodeContent | NodeContent[] | null
|
||||
Reference in New Issue
Block a user