mirror of
https://github.com/tenrok/BBob.git
synced 2026-06-08 17:22:26 +03:00
* fix: TagNode.create with null content by default * Create five-meals-sing.md * fix: tests * fix(preset): types inference * fix: preset types * fix: preset types * fix: lock file, parser and utils * refactor: move types to separate package * fix(preset): add @bbob/core to dev deps * fix(preset): lock file * test(preset-vue): create tags * test(preset-vue): tests * chore(nx): fix nx cover deps * chore: changesets
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
import React, { ReactNode } from 'react';
|
||||
import type { BBobPlugins, BBobCoreOptions } from '@bbob/core';
|
||||
import type { BBobPlugins, BBobCoreOptions } from '@bbob/types';
|
||||
|
||||
import { render } from './render';
|
||||
|
||||
const content = (children: ReactNode, plugins?: BBobPlugins, options?: BBobCoreOptions) => React.Children.map(children, (child) => (typeof child === 'string' ? render(child, plugins, options) : child));
|
||||
const content = (children: ReactNode, plugins?: BBobPlugins, options?: BBobCoreOptions) =>
|
||||
React.Children.map(children,
|
||||
(child) =>
|
||||
(typeof child === 'string' ? render(child, plugins, options) : child)
|
||||
);
|
||||
|
||||
export type BBobReactComponentProps = {
|
||||
children: ReactNode
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
/* eslint-disable no-use-before-define */
|
||||
import React, { ReactNode } from "react";
|
||||
import { render as htmlrender } from "@bbob/html";
|
||||
import core, {
|
||||
BBobCoreOptions,
|
||||
BBobCoreTagNodeTree,
|
||||
BBobPlugins,
|
||||
} from "@bbob/core";
|
||||
import core from "@bbob/core";
|
||||
|
||||
import {
|
||||
isTagNode,
|
||||
isStringNode,
|
||||
isEOL,
|
||||
TagNode,
|
||||
TagNodeTree,
|
||||
} from "@bbob/plugin-helper";
|
||||
|
||||
import type {
|
||||
BBobCoreOptions,
|
||||
BBobCoreTagNodeTree,
|
||||
BBobPlugins,
|
||||
TagNodeTree,
|
||||
} from "@bbob/types";
|
||||
|
||||
const toAST = (
|
||||
source: string,
|
||||
plugins?: BBobPlugins,
|
||||
@@ -45,8 +47,8 @@ function tagToReactElement(node: TagNode, index: number) {
|
||||
);
|
||||
}
|
||||
|
||||
function renderToReactNodes(nodes: BBobCoreTagNodeTree | TagNodeTree) {
|
||||
if (Array.isArray(nodes) && nodes.length) {
|
||||
function renderToReactNodes(nodes?: BBobCoreTagNodeTree | TagNodeTree) {
|
||||
if (nodes && Array.isArray(nodes) && nodes.length) {
|
||||
return nodes.reduce<ReactNode[]>((arr, node, index) => {
|
||||
if (isTagNode(node)) {
|
||||
arr.push(tagToReactElement(node, index));
|
||||
|
||||
Reference in New Issue
Block a user