@builder.io/mitosis 0.7.6 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/generators/angular/{blocks.d.ts → classic/blocks.d.ts} +3 -3
- package/dist/src/generators/angular/{blocks.js → classic/blocks.js} +14 -14
- package/dist/src/generators/angular/classic/component.d.ts +3 -0
- package/dist/src/generators/angular/classic/component.js +356 -0
- package/dist/src/generators/angular/classic/plugins/get-class-properties-plugin.d.ts +2 -0
- package/dist/src/generators/angular/classic/plugins/get-class-properties-plugin.js +138 -0
- package/dist/src/generators/angular/classic/plugins/get-code-processor-plugins.d.ts +8 -0
- package/dist/src/generators/angular/classic/plugins/get-code-processor-plugins.js +60 -0
- package/dist/src/generators/angular/component.d.ts +3 -0
- package/dist/src/generators/angular/component.js +27 -0
- package/dist/src/generators/angular/helpers/format.d.ts +1 -0
- package/dist/src/generators/angular/helpers/format.js +24 -0
- package/dist/src/generators/angular/helpers/get-inputs.d.ts +7 -0
- package/dist/src/generators/angular/helpers/get-inputs.js +18 -0
- package/dist/src/generators/angular/helpers/get-outputs.d.ts +7 -0
- package/dist/src/generators/angular/helpers/get-outputs.js +23 -0
- package/dist/src/generators/angular/helpers/get-refs.d.ts +8 -0
- package/dist/src/generators/angular/helpers/get-refs.js +40 -0
- package/dist/src/generators/angular/helpers/get-styles.d.ts +6 -0
- package/dist/src/generators/angular/helpers/get-styles.js +17 -0
- package/dist/src/generators/angular/helpers/index.d.ts +15 -0
- package/dist/src/generators/angular/helpers/index.js +126 -2
- package/dist/src/generators/angular/{parse-selector.d.ts → helpers/parse-selector.d.ts} +1 -1
- package/dist/src/generators/angular/{parse-selector.js → helpers/parse-selector.js} +3 -3
- package/dist/src/generators/angular/index.d.ts +1 -3
- package/dist/src/generators/angular/index.js +1 -692
- package/dist/src/generators/angular/signals/blocks.d.ts +10 -0
- package/dist/src/generators/angular/signals/blocks.js +242 -0
- package/dist/src/generators/angular/signals/component.d.ts +3 -0
- package/dist/src/generators/angular/signals/component.js +279 -0
- package/dist/src/generators/angular/signals/helpers/get-inputs.d.ts +7 -0
- package/dist/src/generators/angular/signals/helpers/get-inputs.js +15 -0
- package/dist/src/generators/angular/signals/helpers/index.d.ts +9 -0
- package/dist/src/generators/angular/signals/helpers/index.js +22 -0
- package/dist/src/generators/angular/signals/plugins/get-code-processor-plugins.d.ts +4 -0
- package/dist/src/generators/angular/signals/plugins/get-code-processor-plugins.js +194 -0
- package/dist/src/generators/angular/types.d.ts +23 -2
- package/dist/src/generators/angular/types.js +1 -0
- package/dist/src/generators/mitosis/generator.js +11 -27
- package/dist/src/generators/qwik/component-generator.js +1 -0
- package/dist/src/generators/solid/index.js +1 -0
- package/dist/src/generators/stencil/blocks.js +2 -1
- package/dist/src/generators/stencil/component.js +3 -2
- package/dist/src/generators/stencil/helpers/index.d.ts +0 -5
- package/dist/src/generators/stencil/helpers/index.js +2 -33
- package/dist/src/generators/stencil/plugins/get-code-processor-plugins.d.ts +1 -1
- package/dist/src/generators/stencil/plugins/get-code-processor-plugins.js +3 -2
- package/dist/src/generators/svelte/svelte.js +2 -0
- package/dist/src/generators/vue/vue.js +2 -0
- package/dist/src/helpers/babel-transform.js +1 -1
- package/dist/src/helpers/class-components.d.ts +13 -0
- package/dist/src/helpers/class-components.js +51 -0
- package/dist/src/helpers/get-state-object-string.d.ts +4 -0
- package/dist/src/helpers/get-state-object-string.js +22 -5
- package/dist/src/helpers/is-children.js +1 -1
- package/dist/src/helpers/map-refs.d.ts +7 -1
- package/dist/src/helpers/map-refs.js +21 -21
- package/dist/src/helpers/plugins/process-code/index.d.ts +1 -1
- package/dist/src/helpers/plugins/process-code/index.js +16 -2
- package/dist/src/helpers/plugins/process-code/types.d.ts +3 -2
- package/dist/src/helpers/render-imports.d.ts +5 -0
- package/dist/src/helpers/replace-identifiers.js +1 -4
- package/dist/src/helpers/traverse-nodes.d.ts +1 -1
- package/dist/src/parsers/builder/builder.d.ts +6 -0
- package/dist/src/parsers/builder/builder.js +25 -3
- package/dist/src/parsers/jsx/function-parser.js +15 -0
- package/dist/src/parsers/svelte/html/text.d.ts +18 -0
- package/dist/src/types/mitosis-component.d.ts +2 -0
- package/dist/src/types/mitosis-node.d.ts +7 -2
- package/dist/src/types/mitosis-node.js +8 -3
- package/package.json +1 -1
|
@@ -9,6 +9,6 @@ const getTextValue = (node) => {
|
|
|
9
9
|
exports.getTextValue = getTextValue;
|
|
10
10
|
function isChildren({ node, extraMatches = [], }) {
|
|
11
11
|
const textValue = (0, exports.getTextValue)(node);
|
|
12
|
-
return ['props.children', 'children'].concat(extraMatches).includes(textValue);
|
|
12
|
+
return ['props.children', 'children', 'children()'].concat(extraMatches).includes(textValue);
|
|
13
13
|
}
|
|
14
14
|
exports.default = isChildren;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import type { NodePath } from '@babel/core';
|
|
2
|
+
import { types } from '@babel/core';
|
|
3
|
+
import { CodeType } from '../helpers/plugins/process-code/types';
|
|
1
4
|
import { MitosisComponent } from '../types/mitosis-component';
|
|
2
|
-
export type RefMapper = (refName: string
|
|
5
|
+
export type RefMapper = (refName: string, extra?: {
|
|
6
|
+
type?: CodeType;
|
|
7
|
+
path: NodePath<types.Identifier>;
|
|
8
|
+
}) => string;
|
|
3
9
|
export declare const mapRefs: (component: MitosisComponent, mapper: RefMapper) => void;
|
|
@@ -10,13 +10,18 @@ const babel_transform_1 = require("./babel-transform");
|
|
|
10
10
|
const get_refs_1 = require("./get-refs");
|
|
11
11
|
const is_mitosis_node_1 = require("./is-mitosis-node");
|
|
12
12
|
const patterns_1 = require("./patterns");
|
|
13
|
-
const replaceRefsInString = (code, refs, mapper) => {
|
|
13
|
+
const replaceRefsInString = (code, refs, mapper, type) => {
|
|
14
14
|
return (0, babel_transform_1.babelTransformExpression)(code, {
|
|
15
15
|
Identifier(path) {
|
|
16
|
+
var _a;
|
|
16
17
|
const name = path.node.name;
|
|
17
18
|
const isRef = refs.includes(name);
|
|
18
|
-
if (isRef) {
|
|
19
|
-
path.replaceWith(core_1.types.identifier(mapper(name
|
|
19
|
+
if (isRef && !((_a = path.node.extra) === null || _a === void 0 ? void 0 : _a.replaced)) {
|
|
20
|
+
path.replaceWith(core_1.types.identifier(mapper(name, {
|
|
21
|
+
type,
|
|
22
|
+
path,
|
|
23
|
+
})));
|
|
24
|
+
path.node.extra = { replaced: true };
|
|
20
25
|
}
|
|
21
26
|
},
|
|
22
27
|
});
|
|
@@ -59,31 +64,26 @@ const mapRefs = (component, mapper) => {
|
|
|
59
64
|
if (typeof value === 'object' && key !== 'ref') {
|
|
60
65
|
item.bindings[key] = {
|
|
61
66
|
...value,
|
|
62
|
-
code: replaceRefsInString(value.code, refs, mapper),
|
|
67
|
+
code: replaceRefsInString(value.code, refs, mapper, 'bindings'),
|
|
63
68
|
};
|
|
64
69
|
}
|
|
65
70
|
}
|
|
66
71
|
}
|
|
67
72
|
});
|
|
68
73
|
for (const key of Object.keys(component.hooks)) {
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
const hookCode = hooks === null || hooks === void 0 ? void 0 : hooks.code;
|
|
82
|
-
if (hookCode) {
|
|
83
|
-
hooks.code = replaceRefsInString(hookCode, refs, mapper);
|
|
74
|
+
const _hook = component.hooks[key];
|
|
75
|
+
const hooks = Array.isArray(_hook) ? _hook : [_hook];
|
|
76
|
+
for (const hook of hooks) {
|
|
77
|
+
if (!hook)
|
|
78
|
+
continue;
|
|
79
|
+
if (hook.code) {
|
|
80
|
+
hook.code = replaceRefsInString(hook.code, refs, mapper);
|
|
81
|
+
}
|
|
82
|
+
if (hook.deps) {
|
|
83
|
+
hook.deps = replaceRefsInString(hook.deps, refs, mapper, 'hooks-deps');
|
|
84
84
|
}
|
|
85
|
-
if (
|
|
86
|
-
|
|
85
|
+
if (hook === null || hook === void 0 ? void 0 : hook.depsArray) {
|
|
86
|
+
hook.depsArray = hook.depsArray.map((dep) => replaceRefsInString(dep, refs, mapper, 'hooks-deps-array'));
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -7,6 +7,6 @@ export declare const createCodeProcessorPlugin: (codeProcessor: CodeProcessor, {
|
|
|
7
7
|
/**
|
|
8
8
|
* Given a `codeProcessor` function, processes all code expressions within a Mitosis component.
|
|
9
9
|
*/
|
|
10
|
-
export declare const CODE_PROCESSOR_PLUGIN: (codeProcessor: (codeType: import("./types").CodeType, json: MitosisComponent, node?: import("../../..").MitosisNode | undefined) => (code: string, hookType: string) => string | (() => void), a_1?: {
|
|
10
|
+
export declare const CODE_PROCESSOR_PLUGIN: (codeProcessor: (codeType: import("./types").CodeType, json: MitosisComponent, node?: import("../../..").MitosisNode | undefined) => (code: string, hookType: string, context?: import("neotraverse/legacy").TraverseContext | undefined) => string | (() => void), a_1?: {
|
|
11
11
|
processProperties?: boolean | undefined;
|
|
12
12
|
} | undefined) => MitosisPlugin;
|
|
@@ -7,6 +7,7 @@ const traverse_nodes_1 = require("../../traverse-nodes");
|
|
|
7
7
|
const createCodeProcessorPlugin = (codeProcessor, { processProperties } = { processProperties: false }) => (json) => {
|
|
8
8
|
var _a;
|
|
9
9
|
function processHook(key, hook) {
|
|
10
|
+
var _a;
|
|
10
11
|
const result = codeProcessor('hooks', json)(hook.code, key);
|
|
11
12
|
if (typeof result === 'string') {
|
|
12
13
|
hook.code = result;
|
|
@@ -23,6 +24,19 @@ const createCodeProcessorPlugin = (codeProcessor, { processProperties } = { proc
|
|
|
23
24
|
result();
|
|
24
25
|
}
|
|
25
26
|
}
|
|
27
|
+
if ((_a = hook.depsArray) === null || _a === void 0 ? void 0 : _a.length) {
|
|
28
|
+
hook.depsArray = hook.depsArray
|
|
29
|
+
.map((dep) => {
|
|
30
|
+
const innerResult = codeProcessor('hooks-deps-array', json)(dep, key);
|
|
31
|
+
if (typeof innerResult === 'string') {
|
|
32
|
+
return innerResult;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return '';
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
.filter((dep) => !!dep);
|
|
39
|
+
}
|
|
26
40
|
}
|
|
27
41
|
/**
|
|
28
42
|
* process code in hooks
|
|
@@ -88,7 +102,7 @@ const createCodeProcessorPlugin = (codeProcessor, { processProperties } = { proc
|
|
|
88
102
|
}
|
|
89
103
|
}
|
|
90
104
|
}
|
|
91
|
-
(0, traverse_nodes_1.traverseNodes)(json, (node) => {
|
|
105
|
+
(0, traverse_nodes_1.traverseNodes)(json, (node, context) => {
|
|
92
106
|
if (processProperties) {
|
|
93
107
|
for (const key in node.properties) {
|
|
94
108
|
const value = node.properties[key];
|
|
@@ -106,7 +120,7 @@ const createCodeProcessorPlugin = (codeProcessor, { processProperties } = { proc
|
|
|
106
120
|
for (const key in node.bindings) {
|
|
107
121
|
const value = node.bindings[key];
|
|
108
122
|
if (value === null || value === void 0 ? void 0 : value.code) {
|
|
109
|
-
const result = codeProcessor('bindings', json, node)(value.code, key);
|
|
123
|
+
const result = codeProcessor('bindings', json, node)(value.code, key, context);
|
|
110
124
|
if (typeof result === 'string') {
|
|
111
125
|
value.code = result;
|
|
112
126
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { TraverseContext } from 'neotraverse/legacy';
|
|
1
2
|
import { MitosisComponent } from '../../../types/mitosis-component';
|
|
2
3
|
import { MitosisNode } from '../../../types/mitosis-node';
|
|
3
|
-
export type CodeType = 'hooks' | 'hooks-deps' | 'bindings' | 'properties' | 'state' | 'types' | 'context-set' | 'dynamic-jsx-elements';
|
|
4
|
-
declare function codeProcessor(codeType: CodeType, json: MitosisComponent, node?: MitosisNode): (code: string, hookType: string) => string | (() => void);
|
|
4
|
+
export type CodeType = 'hooks' | 'hooks-deps' | 'hooks-deps-array' | 'bindings' | 'properties' | 'state' | 'types' | 'context-set' | 'dynamic-jsx-elements';
|
|
5
|
+
declare function codeProcessor(codeType: CodeType, json: MitosisComponent, node?: MitosisNode): (code: string, hookType: string, context?: TraverseContext) => string | (() => void);
|
|
5
6
|
export type CodeProcessor = typeof codeProcessor;
|
|
6
7
|
export {};
|
|
@@ -7,6 +7,11 @@ export declare const transformImportPath: ({ theImport, target, preserveFileExte
|
|
|
7
7
|
preserveFileExtensions: boolean;
|
|
8
8
|
explicitImportFileExtension: boolean;
|
|
9
9
|
}) => string;
|
|
10
|
+
export interface ImportValues {
|
|
11
|
+
starImport: string | null;
|
|
12
|
+
defaultImport: string | null;
|
|
13
|
+
namedImports: string | null;
|
|
14
|
+
}
|
|
10
15
|
type ImportArgs = {
|
|
11
16
|
target: Target;
|
|
12
17
|
asyncComponentImports: boolean;
|
|
@@ -89,10 +89,7 @@ const _replaceIdentifiers = (path, { from, to }) => {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
else {
|
|
92
|
-
if (core_1.types.isIdentifier(path.node)) {
|
|
93
|
-
console.debug(`Could not replace Identifier with nothing.`);
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
92
|
+
if (!core_1.types.isIdentifier(path.node)) {
|
|
96
93
|
// if we're looking at a member expression, e.g. `props.foo` and no `to` was provided, then we want to strip out
|
|
97
94
|
// the identifier and end up with `foo`. So we replace the member expression with just its `property` value.
|
|
98
95
|
path.replaceWith(path.node.property);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type TraverseContext } from 'neotraverse/legacy';
|
|
2
1
|
import { MitosisComponent } from '../types/mitosis-component';
|
|
3
2
|
import { MitosisNode } from '../types/mitosis-node';
|
|
3
|
+
import { type TraverseContext } from 'neotraverse/legacy';
|
|
4
4
|
export declare function traverseNodes(component: MitosisComponent | MitosisNode, cb: (node: MitosisNode, context: TraverseContext) => void): void;
|
|
@@ -13,6 +13,12 @@ type BuilderToMitosisOptions = {
|
|
|
13
13
|
preserveTextBlocks?: boolean;
|
|
14
14
|
includeSpecialBindings?: boolean;
|
|
15
15
|
includeMeta?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* When `true`, invalid bindings will be escaped as strings with special comments.
|
|
18
|
+
* This can then be used to have LLMs such as Claude attempt to repair the broken code.
|
|
19
|
+
* Defaults to `false`.
|
|
20
|
+
*/
|
|
21
|
+
escapeInvalidCode?: boolean;
|
|
16
22
|
};
|
|
17
23
|
export declare const builderElementToMitosisNode: (block: BuilderElement, options: BuilderToMitosisOptions, _internalOptions?: InternalOptions) => MitosisNode;
|
|
18
24
|
export declare const getMetaFromBlock: (block: BuilderElement, options: BuilderToMitosisOptions) => {};
|
|
@@ -127,9 +127,20 @@ const getStyleStringFromBlock = (block, options) => {
|
|
|
127
127
|
if (!key.includes('.')) {
|
|
128
128
|
continue;
|
|
129
129
|
}
|
|
130
|
+
let code = ((_b = (_a = block.code) === null || _a === void 0 ? void 0 : _a.bindings) === null || _b === void 0 ? void 0 : _b[key]) || block.bindings[key];
|
|
131
|
+
const verifyCode = verifyIsValid(code);
|
|
132
|
+
if (!verifyCode.valid) {
|
|
133
|
+
if (options.escapeInvalidCode) {
|
|
134
|
+
code = '`' + code + ' [INVALID CODE]`';
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
console.warn(`Dropping binding "${key}" due to invalid code: ${code}`);
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
130
141
|
if (key.includes('style')) {
|
|
131
142
|
const styleProperty = key.split('.')[1];
|
|
132
|
-
styleBindings[styleProperty] = convertExportDefaultToReturn(
|
|
143
|
+
styleBindings[styleProperty] = convertExportDefaultToReturn(code);
|
|
133
144
|
/**
|
|
134
145
|
* responsiveStyles that are bound need to be merged into media queries.
|
|
135
146
|
* Example:
|
|
@@ -152,7 +163,7 @@ const getStyleStringFromBlock = (block, options) => {
|
|
|
152
163
|
const objKey = `"${mediaKey}"`;
|
|
153
164
|
responsiveStyles[objKey] = {
|
|
154
165
|
...responsiveStyles[objKey],
|
|
155
|
-
[prop]:
|
|
166
|
+
[prop]: code,
|
|
156
167
|
};
|
|
157
168
|
}
|
|
158
169
|
}
|
|
@@ -672,8 +683,19 @@ const builderElementToMitosisNode = (block, options, _internalOptions = {}) => {
|
|
|
672
683
|
}
|
|
673
684
|
const useKey = key.replace(/^(component\.)?options\./, '');
|
|
674
685
|
if (!useKey.includes('.')) {
|
|
686
|
+
let code = blockBindings[key].code || blockBindings[key];
|
|
687
|
+
const verifyCode = verifyIsValid(code);
|
|
688
|
+
if (!verifyCode.valid) {
|
|
689
|
+
if (options.escapeInvalidCode) {
|
|
690
|
+
code = '`' + code + ' [INVALID CODE]`';
|
|
691
|
+
}
|
|
692
|
+
else {
|
|
693
|
+
console.warn(`Dropping binding "${key}" due to invalid code: ${code}`);
|
|
694
|
+
continue;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
675
697
|
bindings[useKey] = (0, bindings_1.createSingleBinding)({
|
|
676
|
-
code
|
|
698
|
+
code,
|
|
677
699
|
});
|
|
678
700
|
}
|
|
679
701
|
else if (useKey.includes('style') && useKey.includes('.')) {
|
|
@@ -29,6 +29,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.componentFunctionToJson = void 0;
|
|
30
30
|
const babel = __importStar(require("@babel/core"));
|
|
31
31
|
const generator_1 = __importDefault(require("@babel/generator"));
|
|
32
|
+
const types_1 = require("@babel/types");
|
|
32
33
|
const hooks_1 = require("../../constants/hooks");
|
|
33
34
|
const create_mitosis_component_1 = require("../../helpers/create-mitosis-component");
|
|
34
35
|
const get_bindings_1 = require("../../helpers/get-bindings");
|
|
@@ -155,11 +156,25 @@ const componentFunctionToJson = (node, context, stateToScope) => {
|
|
|
155
156
|
if (!secondArg ||
|
|
156
157
|
(types.isArrayExpression(secondArg) && secondArg.elements.length > 0)) {
|
|
157
158
|
const depsCode = secondArg ? (0, generator_1.default)(secondArg).code : '';
|
|
159
|
+
const depsArray = [];
|
|
160
|
+
if (secondArg && secondArg.elements) {
|
|
161
|
+
for (const element of secondArg.elements) {
|
|
162
|
+
if ((0, types_1.isIdentifier)(element)) {
|
|
163
|
+
depsArray.push(element.name);
|
|
164
|
+
}
|
|
165
|
+
else if ((0, types_1.isMemberExpression)(element) &&
|
|
166
|
+
(0, types_1.isIdentifier)(element.object) &&
|
|
167
|
+
(0, types_1.isIdentifier)(element.property)) {
|
|
168
|
+
depsArray.push(`${element.object.name}.${element.property.name}`);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
158
172
|
hooks.onUpdate = [
|
|
159
173
|
...(hooks.onUpdate || []),
|
|
160
174
|
{
|
|
161
175
|
code,
|
|
162
176
|
deps: depsCode,
|
|
177
|
+
depsArray,
|
|
163
178
|
},
|
|
164
179
|
];
|
|
165
180
|
}
|
|
@@ -39,4 +39,22 @@ export declare function parseText(node: TemplateNode): {
|
|
|
39
39
|
localizedValues?: {
|
|
40
40
|
[index: string]: import("../../..").BuilderLocalizedValue;
|
|
41
41
|
} | undefined;
|
|
42
|
+
} | {
|
|
43
|
+
name: string;
|
|
44
|
+
properties: {
|
|
45
|
+
_text: any;
|
|
46
|
+
};
|
|
47
|
+
'@type': "@builder.io/mitosis/node";
|
|
48
|
+
meta: import("../../../types/json").JSONObject;
|
|
49
|
+
scope: {};
|
|
50
|
+
bindings: {
|
|
51
|
+
[key: string]: import("../../..").Binding | undefined;
|
|
52
|
+
};
|
|
53
|
+
children: import("../../..").MitosisNode[];
|
|
54
|
+
slots?: {
|
|
55
|
+
[key: string]: import("../../..").MitosisNode[];
|
|
56
|
+
} | undefined;
|
|
57
|
+
localizedValues?: {
|
|
58
|
+
[index: string]: import("../../..").BuilderLocalizedValue;
|
|
59
|
+
} | undefined;
|
|
42
60
|
};
|
|
@@ -47,6 +47,7 @@ export interface ContextSetInfo extends ContextOptions {
|
|
|
47
47
|
export type BaseHook = {
|
|
48
48
|
code: string;
|
|
49
49
|
deps?: string;
|
|
50
|
+
depsArray?: string[];
|
|
50
51
|
};
|
|
51
52
|
export type MitosisComponentInput = {
|
|
52
53
|
name: string;
|
|
@@ -155,6 +156,7 @@ export type MitosisComponent = {
|
|
|
155
156
|
hooks?: {
|
|
156
157
|
[hookName: string]: BaseHook;
|
|
157
158
|
};
|
|
159
|
+
extra?: Record<string, any>;
|
|
158
160
|
};
|
|
159
161
|
};
|
|
160
162
|
};
|
|
@@ -81,7 +81,12 @@ export type BaseNode = {
|
|
|
81
81
|
[index: string]: BuilderLocalizedValue;
|
|
82
82
|
};
|
|
83
83
|
};
|
|
84
|
-
export
|
|
84
|
+
export declare const ForNodeName = "For";
|
|
85
|
+
export declare const FragmentNodeName = "Fragment";
|
|
86
|
+
export declare const ShowNodeName = "Show";
|
|
87
|
+
export declare const SlotNodeName = "Slot";
|
|
88
|
+
export declare const SpecialNodeNameList: string[];
|
|
89
|
+
export type SpecialNodesNames = (typeof SpecialNodeNameList)[number];
|
|
85
90
|
export type ForNode = BaseNode & {
|
|
86
91
|
name: 'For';
|
|
87
92
|
scope: {
|
|
@@ -93,7 +98,7 @@ export type ForNode = BaseNode & {
|
|
|
93
98
|
export type ShowNode = BaseNode & {
|
|
94
99
|
name: 'Show';
|
|
95
100
|
};
|
|
96
|
-
export type MitosisNode = BaseNode | ForNode;
|
|
101
|
+
export type MitosisNode = BaseNode | ForNode | ShowNode;
|
|
97
102
|
export declare const checkIsForNode: (node: MitosisNode) => node is ForNode;
|
|
98
103
|
export declare const checkIsShowNode: (node: MitosisNode) => node is ShowNode;
|
|
99
104
|
export {};
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.checkIsShowNode = exports.checkIsForNode = void 0;
|
|
4
|
-
|
|
3
|
+
exports.checkIsShowNode = exports.checkIsForNode = exports.SpecialNodeNameList = exports.SlotNodeName = exports.ShowNodeName = exports.FragmentNodeName = exports.ForNodeName = void 0;
|
|
4
|
+
exports.ForNodeName = 'For';
|
|
5
|
+
exports.FragmentNodeName = 'Fragment';
|
|
6
|
+
exports.ShowNodeName = 'Show';
|
|
7
|
+
exports.SlotNodeName = 'Slot';
|
|
8
|
+
exports.SpecialNodeNameList = [exports.ForNodeName, exports.FragmentNodeName, exports.ShowNodeName, exports.SlotNodeName];
|
|
9
|
+
const checkIsForNode = (node) => node.name === exports.ForNodeName;
|
|
5
10
|
exports.checkIsForNode = checkIsForNode;
|
|
6
|
-
const checkIsShowNode = (node) => node.name ===
|
|
11
|
+
const checkIsShowNode = (node) => node.name === exports.ShowNodeName;
|
|
7
12
|
exports.checkIsShowNode = checkIsShowNode;
|