2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-08 17:22:26 +03:00

fix(#206): TagNode.create now with null content argument by default (#233)

* 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:
Nikolay Kost
2024-06-24 01:32:15 +03:00
committed by GitHub
parent 95d9b8a2ba
commit 270f5645f8
58 changed files with 657 additions and 428 deletions
+7 -2
View File
@@ -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
+10 -8
View File
@@ -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));