@builder.io/mitosis 0.0.48 → 0.0.49
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/CHANGELOG.md +4 -0
- package/dist/src/__tests__/angular.test.d.ts +1 -0
- package/dist/src/__tests__/angular.test.js +12 -0
- package/dist/src/__tests__/data/blocks/onUpdate.raw.d.ts +1 -0
- package/dist/src/__tests__/data/blocks/onUpdate.raw.jsx +10 -0
- package/dist/src/__tests__/data/blocks/onUpdateWithDeps.raw.d.ts +1 -0
- package/dist/src/__tests__/data/blocks/onUpdateWithDeps.raw.jsx +11 -0
- package/dist/src/__tests__/data/blocks/tabs.raw.d.ts +11 -0
- package/dist/src/__tests__/data/blocks/tabs.raw.jsx +24 -0
- package/dist/src/__tests__/qoot.test.d.ts +1 -0
- package/dist/src/__tests__/qoot.test.js +115 -0
- package/dist/src/__tests__/qwik.test.js +38 -10
- package/dist/src/__tests__/react.test.js +12 -0
- package/dist/src/__tests__/svelte.test.d.ts +1 -0
- package/dist/src/__tests__/svelte.test.js +12 -0
- package/dist/src/__tests__/vue.test.js +6 -0
- package/dist/src/generators/angular.js +7 -3
- package/dist/src/generators/builder.js +7 -7
- package/dist/src/generators/html.js +16 -7
- package/dist/src/generators/jsx-lite.d.ts +10 -0
- package/dist/src/generators/jsx-lite.js +176 -0
- package/dist/src/generators/minify.d.ts +1 -0
- package/dist/src/generators/minify.js +24 -0
- package/dist/src/generators/mitosis.js +5 -2
- package/dist/src/generators/qoot.d.ts +21 -0
- package/dist/src/generators/qoot.js +442 -0
- package/dist/src/generators/qwik/component.js +48 -6
- package/dist/src/generators/qwik/directives.d.ts +21 -1
- package/dist/src/generators/qwik/directives.js +80 -3
- package/dist/src/generators/qwik/jsx.d.ts +1 -1
- package/dist/src/generators/qwik/jsx.js +28 -5
- package/dist/src/generators/qwik/src-generator.d.ts +3 -1
- package/dist/src/generators/qwik/src-generator.js +34 -10
- package/dist/src/generators/qwik.d.ts +21 -0
- package/dist/src/generators/qwik.js +458 -0
- package/dist/src/generators/react.js +13 -7
- package/dist/src/generators/solid.js +5 -2
- package/dist/src/generators/svelte.js +10 -5
- package/dist/src/generators/vue.js +7 -5
- package/dist/src/helpers/create-jsx-lite-component.d.ts +2 -0
- package/dist/src/helpers/create-jsx-lite-component.js +16 -0
- package/dist/src/helpers/create-jsx-lite-context.d.ts +4 -0
- package/dist/src/helpers/create-jsx-lite-context.js +18 -0
- package/dist/src/helpers/create-jsx-lite-node.d.ts +2 -0
- package/dist/src/helpers/create-jsx-lite-node.js +16 -0
- package/dist/src/helpers/is-jsx-lite-node.d.ts +2 -0
- package/dist/src/helpers/is-jsx-lite-node.js +7 -0
- package/dist/src/helpers/map-refs.js +7 -6
- package/dist/src/helpers/process-http-requests.js +3 -3
- package/dist/src/helpers/process-tag-references.js +4 -3
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.js +4 -3
- package/dist/src/parsers/builder.d.ts +50 -10
- package/dist/src/parsers/builder.js +37 -7
- package/dist/src/parsers/jsx.js +43 -3
- package/dist/src/parsers/liquid.js +4 -4
- package/dist/src/plugins/compile-away-builder-components.js +40 -20
- package/dist/src/symbols/symbol-processor.d.ts +18 -0
- package/dist/src/symbols/symbol-processor.js +177 -0
- package/dist/src/types/jsx-lite-component.d.ts +63 -0
- package/dist/src/types/jsx-lite-component.js +2 -0
- package/dist/src/types/jsx-lite-context.d.ts +6 -0
- package/dist/src/types/jsx-lite-context.js +2 -0
- package/dist/src/types/jsx-lite-node.d.ts +13 -0
- package/dist/src/types/jsx-lite-node.js +2 -0
- package/dist/src/types/jsx-lite-styles.d.ts +1 -0
- package/dist/src/types/jsx-lite-styles.js +2 -0
- package/dist/src/types/mitosis-component.d.ts +10 -5
- package/dist/test/qoot/Todo/bundle.js +88 -0
- package/dist/test/qoot/Todo/component.ts +17 -0
- package/dist/test/qoot/Todo/onButtonClick.ts +13 -0
- package/dist/test/qoot/Todo/onInput2Blur.ts +11 -0
- package/dist/test/qoot/Todo/onInput2KeyUp.ts +10 -0
- package/dist/test/qoot/Todo/onInputClick.ts +10 -0
- package/dist/test/qoot/Todo/onLabelDblClick.ts +11 -0
- package/dist/test/qoot/Todo/public.ts +4 -0
- package/dist/test/qoot/Todo/template.tsx +46 -0
- package/dist/test/qoot/Todos/component.ts +9 -0
- package/dist/test/qoot/Todos/onInputClick.ts +14 -0
- package/dist/test/qoot/Todos/public.ts +3 -0
- package/dist/test/qoot/Todos/template.tsx +30 -0
- package/dist/test/qwik/{todo → Todo}/Todo.cjs/high.cjs +0 -0
- package/dist/test/qwik/{todo → Todo}/Todo.cjs/low.cjs +0 -0
- package/dist/test/qwik/{todo → Todo}/Todo.cjs/med.cjs +0 -0
- package/dist/test/qwik/{todo → Todo}/Todo.js/high.js +0 -0
- package/dist/test/qwik/{todo → Todo}/Todo.js/low.js +0 -0
- package/dist/test/qwik/{todo → Todo}/Todo.js/med.js +0 -0
- package/dist/test/qwik/{todo → Todo}/Todo.tsx/high.tsx +0 -0
- package/dist/test/qwik/{todo → Todo}/Todo.tsx/low.tsx +0 -0
- package/dist/test/qwik/{todo → Todo}/Todo.tsx/med.tsx +0 -0
- package/dist/test/qwik/Todo/bundle.js +46 -0
- package/dist/test/qwik/Todo/component.ts +17 -0
- package/dist/test/qwik/Todo/onButtonClick.ts +10 -0
- package/dist/test/qwik/Todo/onInput2Blur.ts +14 -0
- package/dist/test/qwik/Todo/onInput2KeyUp.ts +10 -0
- package/dist/test/qwik/Todo/onInputClick.ts +13 -0
- package/dist/test/qwik/Todo/onLabelDblClick.ts +11 -0
- package/dist/test/qwik/Todo/public.ts +3 -0
- package/dist/test/qwik/Todo/template.tsx +46 -0
- package/dist/test/qwik/Todo.ts +4 -0
- package/dist/test/qwik/Todo_component.ts +17 -0
- package/dist/test/qwik/Todo_onButtonClick.ts +13 -0
- package/dist/test/qwik/Todo_onInput2Blur.ts +14 -0
- package/dist/test/qwik/Todo_onInput2KeyUp.ts +10 -0
- package/dist/test/qwik/Todo_onInputClick.ts +13 -0
- package/dist/test/qwik/Todo_onLabelDblClick.ts +14 -0
- package/dist/test/qwik/Todo_template.tsx +46 -0
- package/dist/test/qwik/{todos → Todos}/Todo.tsx/high.tsx +0 -0
- package/dist/test/qwik/{todos → Todos}/Todo.tsx/low.tsx +3 -4
- package/dist/test/qwik/{todos → Todos}/Todo.tsx/med.tsx +0 -0
- package/dist/test/qwik/Todos/component.ts +9 -0
- package/dist/test/qwik/Todos/onInputClick.ts +14 -0
- package/dist/test/qwik/Todos/public.ts +3 -0
- package/dist/test/qwik/Todos/template.tsx +30 -0
- package/dist/test/qwik/Todos.ts +3 -0
- package/dist/test/qwik/Todos_component.ts +9 -0
- package/dist/test/qwik/Todos_onInputClick.ts +14 -0
- package/dist/test/qwik/Todos_template.tsx +30 -0
- package/dist/test/qwik/qwik/Image/high.js +1 -0
- package/dist/test/qwik/qwik/Image/low.js +75 -0
- package/dist/test/qwik/qwik/Image/med.js +9 -0
- package/dist/test/qwik/{For/high.jsx → qwik/Image.slow/high.js} +0 -0
- package/dist/test/qwik/qwik/Image.slow/low.js +75 -0
- package/dist/test/qwik/{For/med.jsx → qwik/Image.slow/med.js} +0 -0
- package/dist/test/qwik/qwik/button/high.js +8 -0
- package/dist/test/qwik/qwik/button/low.js +34 -0
- package/dist/test/qwik/qwik/button/med.js +9 -0
- package/dist/test/qwik/qwik/hello_world/stylesheet/high.jsx +1 -0
- package/dist/test/qwik/qwik/hello_world/stylesheet/low.jsx +24 -0
- package/dist/test/qwik/qwik/hello_world/stylesheet/med.jsx +9 -0
- package/dist/test/qwik/qwik/page-with-symbol/high.js +1 -0
- package/dist/test/qwik/qwik/page-with-symbol/low.js +49 -0
- package/dist/test/qwik/qwik/page-with-symbol/med.js +9 -0
- package/dist/test/qwik/qwik/svg/high.js +1 -0
- package/dist/test/qwik/qwik/svg/low.js +30 -0
- package/dist/test/qwik/qwik/svg/med.js +9 -0
- package/dist/test/qwik/qwik/todo/Todo.cjs/high.cjs +31 -0
- package/dist/test/qwik/qwik/todo/Todo.cjs/low.cjs +1 -0
- package/dist/test/qwik/qwik/todo/Todo.cjs/med.cjs +59 -0
- package/dist/test/qwik/qwik/todo/Todo.js/high.js +5 -0
- package/dist/{src/types/generators.d.ts → test/qwik/qwik/todo/Todo.js/low.js} +0 -0
- package/dist/test/qwik/qwik/todo/Todo.js/med.js +1 -0
- package/dist/test/qwik/qwik/todo/Todo.tsx/high.tsx +30 -0
- package/dist/test/qwik/qwik/todo/Todo.tsx/low.tsx +1 -0
- package/dist/test/qwik/qwik/todo/Todo.tsx/med.tsx +34 -0
- package/dist/test/qwik/qwik/todos/Todo.tsx/high.tsx +12 -0
- package/dist/test/qwik/qwik/todos/Todo.tsx/low.tsx +24 -0
- package/dist/test/qwik/qwik/todos/Todo.tsx/med.tsx +8 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/src/types/generators.js +0 -1
- package/dist/test/qwik/For/low.jsx +0 -55
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
6
|
+
var __assign = (this && this.__assign) || function () {
|
|
7
|
+
__assign = Object.assign || function(t) {
|
|
8
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
9
|
+
s = arguments[i];
|
|
10
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
11
|
+
t[p] = s[p];
|
|
12
|
+
}
|
|
13
|
+
return t;
|
|
14
|
+
};
|
|
15
|
+
return __assign.apply(this, arguments);
|
|
16
|
+
};
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
54
|
+
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
55
|
+
to[j] = from[i];
|
|
56
|
+
return to;
|
|
57
|
+
};
|
|
58
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
59
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
60
|
+
};
|
|
61
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
+
exports.componentToQoot = void 0;
|
|
63
|
+
var dedent_1 = __importDefault(require("dedent"));
|
|
64
|
+
var lodash_1 = require("lodash");
|
|
65
|
+
var standalone_1 = require("prettier/standalone");
|
|
66
|
+
var is_jsx_lite_node_1 = require("../helpers/is-jsx-lite-node");
|
|
67
|
+
var traverse_1 = __importDefault(require("traverse"));
|
|
68
|
+
var capitalize_1 = require("../helpers/capitalize");
|
|
69
|
+
var fast_clone_1 = require("../helpers/fast-clone");
|
|
70
|
+
var render_imports_1 = require("../helpers/render-imports");
|
|
71
|
+
var strip_meta_properties_1 = require("../helpers/strip-meta-properties");
|
|
72
|
+
var filter_empty_text_nodes_1 = require("../helpers/filter-empty-text-nodes");
|
|
73
|
+
var plugins_1 = require("../modules/plugins");
|
|
74
|
+
var jsx_1 = require("../parsers/jsx");
|
|
75
|
+
var remove_surrounding_block_1 = require("../helpers/remove-surrounding-block");
|
|
76
|
+
var get_state_object_string_1 = require("../helpers/get-state-object-string");
|
|
77
|
+
var strip_state_and_props_refs_1 = require("../helpers/strip-state-and-props-refs");
|
|
78
|
+
var babel_transform_1 = require("../helpers/babel-transform");
|
|
79
|
+
var core_1 = require("@babel/core");
|
|
80
|
+
var collect_styles_1 = require("../helpers/collect-styles");
|
|
81
|
+
var is_valid_attribute_name_1 = require("../helpers/is-valid-attribute-name");
|
|
82
|
+
var rollup_1 = require("rollup");
|
|
83
|
+
var plugin_virtual_1 = __importDefault(require("@rollup/plugin-virtual"));
|
|
84
|
+
var qootImport = function (options) {
|
|
85
|
+
return options.qootLib || '@builder.io/qwik';
|
|
86
|
+
};
|
|
87
|
+
function addMarkDirtyAfterSetInCode(code, options, useString) {
|
|
88
|
+
if (useString === void 0) { useString = 'markDirty(this)'; }
|
|
89
|
+
return babel_transform_1.babelTransformExpression(code, {
|
|
90
|
+
UpdateExpression: function (path) {
|
|
91
|
+
var node = path.node;
|
|
92
|
+
if (core_1.types.isMemberExpression(node.argument)) {
|
|
93
|
+
if (core_1.types.isIdentifier(node.argument.object)) {
|
|
94
|
+
// TODO: utillity to properly trace this reference to the beginning
|
|
95
|
+
if (node.argument.object.name === 'state') {
|
|
96
|
+
// TODO: ultimately do updates by property, e.g. updateName()
|
|
97
|
+
// that updates any attributes dependent on name, etcç
|
|
98
|
+
var parent_1 = path;
|
|
99
|
+
// `_temp = ` assignments are created sometimes when we insertAfter
|
|
100
|
+
// for simple expressions. this causes us to re-process the same expression
|
|
101
|
+
// in an infinite loop
|
|
102
|
+
while ((parent_1 = parent_1.parentPath)) {
|
|
103
|
+
if (core_1.types.isAssignmentExpression(parent_1.node) &&
|
|
104
|
+
core_1.types.isIdentifier(parent_1.node.left) &&
|
|
105
|
+
parent_1.node.left.name.startsWith('_temp')) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
path.insertAfter(core_1.types.identifier(useString));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
AssignmentExpression: function (path) {
|
|
115
|
+
var node = path.node;
|
|
116
|
+
if (core_1.types.isMemberExpression(node.left)) {
|
|
117
|
+
if (core_1.types.isIdentifier(node.left.object)) {
|
|
118
|
+
// TODO: utillity to properly trace this reference to the beginning
|
|
119
|
+
if (node.left.object.name === 'state') {
|
|
120
|
+
// TODO: ultimately do updates by property, e.g. updateName()
|
|
121
|
+
// that updates any attributes dependent on name, etcç
|
|
122
|
+
var parent_2 = path;
|
|
123
|
+
// `_temp = ` assignments are created sometimes when we insertAfter
|
|
124
|
+
// for simple expressions. this causes us to re-process the same expression
|
|
125
|
+
// in an infinite loop
|
|
126
|
+
while ((parent_2 = parent_2.parentPath)) {
|
|
127
|
+
if (core_1.types.isAssignmentExpression(parent_2.node) &&
|
|
128
|
+
core_1.types.isIdentifier(parent_2.node.left) &&
|
|
129
|
+
parent_2.node.left.name.startsWith('_temp')) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
path.insertAfter(core_1.types.identifier(useString));
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
var processBinding = function (binding, options) {
|
|
141
|
+
return strip_state_and_props_refs_1.stripStateAndPropsRefs(addMarkDirtyAfterSetInCode(binding, options), {
|
|
142
|
+
replaceWith: 'this.',
|
|
143
|
+
})
|
|
144
|
+
// Remove trailing semicolon
|
|
145
|
+
.trim()
|
|
146
|
+
.replace(/;$/, '');
|
|
147
|
+
};
|
|
148
|
+
var NODE_MAPPERS = {
|
|
149
|
+
Fragment: function (json, options) {
|
|
150
|
+
return "<>" + json.children
|
|
151
|
+
.map(function (item) { return blockToQoot(item, options); })
|
|
152
|
+
.join('\n') + "</>";
|
|
153
|
+
},
|
|
154
|
+
For: function (json, options) {
|
|
155
|
+
return "{" + processBinding(json.bindings.each, options) + ".map(" + json.bindings._forName + " => (\n <>" + json.children
|
|
156
|
+
.filter(filter_empty_text_nodes_1.filterEmptyTextNodes)
|
|
157
|
+
.map(function (item) { return blockToQoot(item, options); })
|
|
158
|
+
.join('\n') + "</>\n ))}";
|
|
159
|
+
},
|
|
160
|
+
Show: function (json, options) {
|
|
161
|
+
return "{" + processBinding(json.bindings.when, options) + " ? (\n <>" + json.children
|
|
162
|
+
.filter(filter_empty_text_nodes_1.filterEmptyTextNodes)
|
|
163
|
+
.map(function (item) { return blockToQoot(item, options); })
|
|
164
|
+
.join('\n') + "</>\n ) : undefined}";
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
var getId = function (json, options) {
|
|
168
|
+
var name = json.properties.$name
|
|
169
|
+
? lodash_1.camelCase(json.properties.$name)
|
|
170
|
+
: /^h\d$/.test(json.name || '') // don't dashcase h1 into h-1
|
|
171
|
+
? json.name
|
|
172
|
+
: lodash_1.camelCase(json.name || 'div');
|
|
173
|
+
var newNameNum = (options.namesMap[name] || 0) + 1;
|
|
174
|
+
options.namesMap[name] = newNameNum;
|
|
175
|
+
return capitalize_1.capitalize("" + name + (newNameNum === 1 ? '' : "" + newNameNum));
|
|
176
|
+
};
|
|
177
|
+
var elId = function (node, options) {
|
|
178
|
+
if (node.meta.id) {
|
|
179
|
+
return node.meta.id;
|
|
180
|
+
}
|
|
181
|
+
var id = getId(node, options);
|
|
182
|
+
node.meta.id = id;
|
|
183
|
+
return id;
|
|
184
|
+
};
|
|
185
|
+
var blockToQoot = function (json, options) {
|
|
186
|
+
if (NODE_MAPPERS[json.name]) {
|
|
187
|
+
return NODE_MAPPERS[json.name](json, options);
|
|
188
|
+
}
|
|
189
|
+
if (json.bindings._text) {
|
|
190
|
+
return "{" + processBinding(json.bindings._text, options) + "}";
|
|
191
|
+
}
|
|
192
|
+
if (json.properties._text) {
|
|
193
|
+
return json.properties._text;
|
|
194
|
+
}
|
|
195
|
+
var str = '';
|
|
196
|
+
str += "<" + json.name + " ";
|
|
197
|
+
if (json.bindings._spread) {
|
|
198
|
+
str += " {...(" + json.bindings._spread + ")} ";
|
|
199
|
+
}
|
|
200
|
+
for (var key in json.properties) {
|
|
201
|
+
if (key.startsWith('_') || key.startsWith('$')) {
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
var value = json.properties[key];
|
|
205
|
+
str += " " + key + "=\"" + value + "\" ";
|
|
206
|
+
}
|
|
207
|
+
var eventBindings = {};
|
|
208
|
+
for (var key in json.bindings) {
|
|
209
|
+
var value = json.bindings[key];
|
|
210
|
+
if (key.startsWith('_') || key.startsWith('$')) {
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
if (key.startsWith('on')) {
|
|
214
|
+
var useKey = key.replace('on', 'on:').toLowerCase();
|
|
215
|
+
var componentName = getComponentName(options.componentJson, options);
|
|
216
|
+
if (options.bundle) {
|
|
217
|
+
eventBindings[useKey] = "QRL`" + options.qrlPrefix + "/" + componentName + "/bundle" + (options.qrlSuffix || '') + ".on" + elId(json, options) + key.slice(2) + "`";
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
eventBindings[useKey] = "QRL`" + options.qrlPrefix + "/" + componentName + "/on" + elId(json, options) + key.slice(2) + (options.qrlSuffix || '') + "`";
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
if (!is_valid_attribute_name_1.isValidAttributeName(key)) {
|
|
225
|
+
console.warn('Skipping invalid attribute name:', key);
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
str += " " + key + "={" + processBinding(value, options) + "} ";
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
if (lodash_1.size(eventBindings)) {
|
|
233
|
+
for (var event_1 in eventBindings) {
|
|
234
|
+
str += event_1 + "={" + eventBindings[event_1] + "}";
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if (jsx_1.selfClosingTags.has(json.name)) {
|
|
238
|
+
return str + ' />';
|
|
239
|
+
}
|
|
240
|
+
str += '>';
|
|
241
|
+
if (json.children) {
|
|
242
|
+
str += json.children.map(function (item) { return blockToQoot(item, options); }).join('\n');
|
|
243
|
+
}
|
|
244
|
+
str += "</" + json.name + ">";
|
|
245
|
+
return str;
|
|
246
|
+
};
|
|
247
|
+
var getComponentName = function (json, options) {
|
|
248
|
+
return capitalize_1.capitalize(lodash_1.camelCase(json.name || 'my-component'));
|
|
249
|
+
};
|
|
250
|
+
// TODO
|
|
251
|
+
var getProvidersString = function (componentJson, options) {
|
|
252
|
+
return 'null';
|
|
253
|
+
};
|
|
254
|
+
var formatCode = function (str, options, type) {
|
|
255
|
+
if (type === void 0) { type = 'typescript'; }
|
|
256
|
+
if (options.prettier !== false) {
|
|
257
|
+
try {
|
|
258
|
+
str = standalone_1.format(str, {
|
|
259
|
+
parser: type === 'typescript' ? 'babel-ts' : type,
|
|
260
|
+
plugins: [
|
|
261
|
+
require('prettier/parser-typescript'),
|
|
262
|
+
require('prettier/parser-babel'),
|
|
263
|
+
require('prettier/parser-postcss'),
|
|
264
|
+
],
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
catch (err) {
|
|
268
|
+
console.warn('Error formatting code', err);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return str;
|
|
272
|
+
};
|
|
273
|
+
var getEventHandlerFiles = function (componentJson, options) {
|
|
274
|
+
var files = [];
|
|
275
|
+
traverse_1.default(componentJson).forEach(function (item) {
|
|
276
|
+
if (is_jsx_lite_node_1.isJsxLiteNode(item)) {
|
|
277
|
+
for (var binding in item.bindings) {
|
|
278
|
+
if (binding.startsWith('on')) {
|
|
279
|
+
var eventHandlerName = elId(item, options) + binding.slice(2);
|
|
280
|
+
var componentName = getComponentName(componentJson, options);
|
|
281
|
+
var str = formatCode("import {\n injectEventHandler,\n provideEvent,\n markDirty\n } from '" + qootImport(options) + "';\n import { " + componentName + "Component } from './component.js'\n \n export " + (options.bundle ? "const on" + eventHandlerName + " =" : 'default') + " injectEventHandler(\n " + componentName + "Component,\n provideEvent(),\n async function (this: " + componentName + "Component, event: Event) {\n " + remove_surrounding_block_1.removeSurroundingBlock(processBinding(item.bindings[binding], options)) + "\n }\n )\n ", options);
|
|
282
|
+
str = formatCode(str, options);
|
|
283
|
+
files.push({
|
|
284
|
+
path: componentName + "/on" + eventHandlerName + ".ts",
|
|
285
|
+
contents: str,
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
return files;
|
|
292
|
+
};
|
|
293
|
+
var componentToQoot = function (componentJson, toQootOptions) {
|
|
294
|
+
if (toQootOptions === void 0) { toQootOptions = {}; }
|
|
295
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
296
|
+
var json, options, css, hasCss, addWrapper, componentName, str, dataString, output, moduleMap, bundle, bundleOutput;
|
|
297
|
+
return __generator(this, function (_a) {
|
|
298
|
+
switch (_a.label) {
|
|
299
|
+
case 0:
|
|
300
|
+
json = fast_clone_1.fastClone(componentJson);
|
|
301
|
+
options = __assign(__assign({ qrlPrefix: 'ui:' }, toQootOptions), { namesMap: {}, componentJson: json });
|
|
302
|
+
if (options.plugins) {
|
|
303
|
+
json = plugins_1.runPreJsonPlugins(json, options.plugins);
|
|
304
|
+
}
|
|
305
|
+
css = collect_styles_1.collectCss(json, {
|
|
306
|
+
classProperty: 'class',
|
|
307
|
+
prefix: options.cssNamespace,
|
|
308
|
+
});
|
|
309
|
+
if (options.minifyStyles) {
|
|
310
|
+
css = css.trim().replace(/\s+/g, ' ');
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
css = formatCode(css, options, 'css');
|
|
314
|
+
}
|
|
315
|
+
hasCss = Boolean(css.trim().length);
|
|
316
|
+
addWrapper = json.children.length > 1 || hasCss;
|
|
317
|
+
if (options.plugins) {
|
|
318
|
+
json = plugins_1.runPostJsonPlugins(json, options.plugins);
|
|
319
|
+
}
|
|
320
|
+
componentName = capitalize_1.capitalize(lodash_1.camelCase(componentJson.name || 'my-component'));
|
|
321
|
+
strip_meta_properties_1.stripMetaProperties(json);
|
|
322
|
+
str = dedent_1.default(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n import { injectMethod, QRL, jsxFactory } from '", "';\n import { ", "Component } from './component.js'\n ", "\n\n export ", " injectMethod(", "Component, function (this: ", "Component) {\n return (", "\n ", "\n ", "\n ", ")\n })\n "], ["\n import { injectMethod, QRL, jsxFactory } from '", "';\n import { ", "Component } from './component.js'\n ",
|
|
323
|
+
"\n\n export ",
|
|
324
|
+
" injectMethod(", "Component, function (this: ", "Component) {\n return (", "\n ",
|
|
325
|
+
"\n ", "\n ", ")\n })\n "])), qootImport(options), componentName, render_imports_1.renderPreComponent(__assign(__assign({}, json), { imports: json.imports.map(function (item) {
|
|
326
|
+
if (item.path.endsWith('.lite')) {
|
|
327
|
+
var clone = fast_clone_1.fastClone(item);
|
|
328
|
+
var name_1 = clone.path
|
|
329
|
+
.split(/[\.\/]/)
|
|
330
|
+
// Get the -1 index of array
|
|
331
|
+
.slice(-2, -1)
|
|
332
|
+
.pop();
|
|
333
|
+
var pascalName = capitalize_1.capitalize(lodash_1.camelCase(name_1));
|
|
334
|
+
clone.path = "../" + pascalName + "/public.js";
|
|
335
|
+
for (var key in clone.imports) {
|
|
336
|
+
var value = clone.imports[key];
|
|
337
|
+
if (value === 'default') {
|
|
338
|
+
clone.imports[key] = pascalName;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
return clone;
|
|
342
|
+
}
|
|
343
|
+
return item;
|
|
344
|
+
}) })), options.bundle ? "const template = " : 'default', componentName, componentName, addWrapper ? '<>' : '', !hasCss
|
|
345
|
+
? ''
|
|
346
|
+
: "<style>{`" + css
|
|
347
|
+
.trim()
|
|
348
|
+
.replace(/^|\n/g, '\n' + ' '.repeat(12)) + "`}</style>", json.children.map(function (item) { return blockToQoot(item, options); }).join('\n'), addWrapper ? '</>' : '');
|
|
349
|
+
if (options.plugins) {
|
|
350
|
+
str = plugins_1.runPreCodePlugins(str, options.plugins);
|
|
351
|
+
}
|
|
352
|
+
str = formatCode(str, options);
|
|
353
|
+
if (options.plugins) {
|
|
354
|
+
str = plugins_1.runPostCodePlugins(str, options.plugins);
|
|
355
|
+
}
|
|
356
|
+
dataString = get_state_object_string_1.getStateObjectString(json, {
|
|
357
|
+
format: 'class',
|
|
358
|
+
valueMapper: function (code) { return processBinding(code, options); },
|
|
359
|
+
});
|
|
360
|
+
output = {
|
|
361
|
+
files: __spreadArray([
|
|
362
|
+
{
|
|
363
|
+
path: componentName + "/template.tsx",
|
|
364
|
+
contents: str,
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
path: componentName + "/public.ts",
|
|
368
|
+
contents: formatCode("\n import { jsxDeclareComponent, QRL } from '" + qootImport(options) + "';\n \n export const " + componentName + " = jsxDeclareComponent(QRL`" + options.qrlPrefix + "/" + componentName + "/" + (options.bundle ? 'bundle' : 'template') + (options.qrlSuffix || '') + (options.bundle ? '.template' : '') + "`, '" + lodash_1.kebabCase(componentName) + "');\n ", options),
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
path: componentName + "/component.ts",
|
|
372
|
+
contents: formatCode((function () {
|
|
373
|
+
var str = "\n " + (options.format === 'builder' ? '' : 'export ') + "class " + (options.format === 'builder' ? '_' : '') + componentName + "Component extends Component<any, any> {\n " + (options.format === 'builder'
|
|
374
|
+
? ''
|
|
375
|
+
: "static $templateQRL = '" + options.qrlPrefix + "/" + componentName + "/" + (options.bundle ? 'bundle' : 'template') + (options.qrlSuffix || '') + (options.bundle ? '.template' : '') + "'") + "\n\n " + dataString + "\n\n " + (!json.hooks.onMount
|
|
376
|
+
? ''
|
|
377
|
+
: "\n constructor(...args) {\n super(...args);\n\n " + processBinding(json.hooks.onMount, options) + "\n }\n ") + "\n\n $newState() {\n return {} // TODO\n }\n }\n " + (options.format !== 'builder'
|
|
378
|
+
? ''
|
|
379
|
+
: "\n export const " + componentName + "Component = new Proxy(_" + componentName + "Component, {\n get(target, prop) {\n if (prop === '$templateQRL') {\n return '" + options.qrlPrefix + "/" + componentName + "/" + (options.bundle ? 'bundle' : 'template') + (options.qrlSuffix || '') + (options.bundle ? '.template' : '') + "'\n }\n return Reflect.get(...arguments)\n }\n })\n ") + "\n ";
|
|
380
|
+
str = "\n import { Component, QRL " + (str.includes('markDirty(') ? ', markDirty' : '') + " } from '" + qootImport(options) + "';\n " + str + "\n ";
|
|
381
|
+
return str;
|
|
382
|
+
})(), options),
|
|
383
|
+
}
|
|
384
|
+
], getEventHandlerFiles(json, options)),
|
|
385
|
+
};
|
|
386
|
+
if (!options.bundle) return [3 /*break*/, 3];
|
|
387
|
+
moduleMap = __assign({ entry: output.files
|
|
388
|
+
.filter(function (file) { return !file.path.endsWith('/public.ts'); })
|
|
389
|
+
.map(function (file) { return "export * from './" + file.path.replace(/\.tsx?$/, '.js') + "';"; })
|
|
390
|
+
.join('\n') }, output.files.reduce(function (memo, arg) {
|
|
391
|
+
var transformed = core_1.transform(arg.contents, {
|
|
392
|
+
sourceFileName: arg.path,
|
|
393
|
+
plugins: [
|
|
394
|
+
[
|
|
395
|
+
require('@babel/plugin-transform-typescript'),
|
|
396
|
+
{
|
|
397
|
+
jsx: 'react',
|
|
398
|
+
isTSX: true,
|
|
399
|
+
allExtensions: true,
|
|
400
|
+
jsxFactory: 'jsxFactory',
|
|
401
|
+
jsxPragma: 'jsxFactory',
|
|
402
|
+
},
|
|
403
|
+
],
|
|
404
|
+
[
|
|
405
|
+
require('@babel/plugin-transform-react-jsx'),
|
|
406
|
+
{
|
|
407
|
+
pragma: 'jsxFactory',
|
|
408
|
+
pragmaFrag: 'null',
|
|
409
|
+
throwIfNamespace: false,
|
|
410
|
+
},
|
|
411
|
+
],
|
|
412
|
+
require('@babel/plugin-proposal-class-properties'),
|
|
413
|
+
],
|
|
414
|
+
});
|
|
415
|
+
memo['./' + arg.path.replace(/\.tsx?$/, '.js')] = transformed.code;
|
|
416
|
+
return memo;
|
|
417
|
+
}, {}));
|
|
418
|
+
return [4 /*yield*/, rollup_1.rollup({
|
|
419
|
+
input: 'entry',
|
|
420
|
+
external: [options.qootLib || '@builder.io/qwik'],
|
|
421
|
+
plugins: [plugin_virtual_1.default(moduleMap)],
|
|
422
|
+
})];
|
|
423
|
+
case 1:
|
|
424
|
+
bundle = _a.sent();
|
|
425
|
+
return [4 /*yield*/, bundle.generate({
|
|
426
|
+
file: 'bundle.js',
|
|
427
|
+
format: 'esm',
|
|
428
|
+
})];
|
|
429
|
+
case 2:
|
|
430
|
+
bundleOutput = (_a.sent()).output;
|
|
431
|
+
output.files.push({
|
|
432
|
+
path: componentName + "/bundle.js",
|
|
433
|
+
contents: bundleOutput[0].code,
|
|
434
|
+
});
|
|
435
|
+
_a.label = 3;
|
|
436
|
+
case 3: return [2 /*return*/, output];
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
});
|
|
440
|
+
};
|
|
441
|
+
exports.componentToQoot = componentToQoot;
|
|
442
|
+
var templateObject_1;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
3
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
|
+
return cooked;
|
|
5
|
+
};
|
|
2
6
|
var __assign = (this && this.__assign) || function () {
|
|
3
7
|
__assign = Object.assign || function(t) {
|
|
4
8
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
@@ -13,6 +17,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
18
|
exports.addCommonStyles = exports.addComponent = exports.createFileSet = void 0;
|
|
15
19
|
var compile_away_builder_components_1 = require("../../plugins/compile-away-builder-components");
|
|
20
|
+
var minify_1 = require("../minify");
|
|
16
21
|
var handlers_1 = require("./handlers");
|
|
17
22
|
var jsx_1 = require("./jsx");
|
|
18
23
|
var src_generator_1 = require("./src-generator");
|
|
@@ -36,6 +41,7 @@ function createFileSet(options) {
|
|
|
36
41
|
enumerable: false,
|
|
37
42
|
value: { styles: new Map(), symbolName: null },
|
|
38
43
|
});
|
|
44
|
+
fileSet.med.exportConst('__merge', (0, minify_1.minify)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["", ""], ["", ""])), __merge));
|
|
39
45
|
return fileSet;
|
|
40
46
|
}
|
|
41
47
|
exports.createFileSet = createFileSet;
|
|
@@ -43,9 +49,10 @@ function getCommonStyles(fileSet) {
|
|
|
43
49
|
return fileSet['_commonStyles'];
|
|
44
50
|
}
|
|
45
51
|
function addComponent(fileSet, component, opts) {
|
|
52
|
+
var _a, _b;
|
|
46
53
|
if (opts === void 0) { opts = {}; }
|
|
47
54
|
var _opts = __assign({ isRoot: false, shareStyles: false }, opts);
|
|
48
|
-
(0, compile_away_builder_components_1.compileAwayBuilderComponentsFromTree)(component, compile_away_builder_components_1.components);
|
|
55
|
+
(0, compile_away_builder_components_1.compileAwayBuilderComponentsFromTree)(component, __assign(__assign({}, compile_away_builder_components_1.components), { Image: undefined, CoreButton: undefined }));
|
|
49
56
|
var componentName = component.name;
|
|
50
57
|
var handlers = (0, handlers_1.renderHandlers)(fileSet.high, componentName, component.children);
|
|
51
58
|
// If the component has no handlers, than it is probably static
|
|
@@ -59,7 +66,7 @@ function addComponent(fileSet, component, opts) {
|
|
|
59
66
|
this.emit((0, src_generator_1.invoke)(componentFile.import(componentFile.qwikModule, 'qHook'), [(0, src_generator_1.arrowFnValue)([], ['({})'])], ['any', 'any']));
|
|
60
67
|
});
|
|
61
68
|
}
|
|
62
|
-
if (component.hooks.onMount) {
|
|
69
|
+
if ((_a = component.hooks.onMount) === null || _a === void 0 ? void 0 : _a.code) {
|
|
63
70
|
addComponentOnMount(componentFile, componentName, component);
|
|
64
71
|
}
|
|
65
72
|
var styles = _opts.shareStyles
|
|
@@ -69,7 +76,7 @@ function addComponent(fileSet, component, opts) {
|
|
|
69
76
|
var qComponentOptions = {
|
|
70
77
|
// tagName: string(componentName.toLowerCase()),
|
|
71
78
|
onMount: (0, src_generator_1.invoke)(componentFile.import(componentFile.qwikModule, 'qHook'), [
|
|
72
|
-
componentFile.toQrl(component.hooks.onMount
|
|
79
|
+
componentFile.toQrl(((_b = component.hooks.onMount) === null || _b === void 0 ? void 0 : _b.code)
|
|
73
80
|
? componentName + '_onMount'
|
|
74
81
|
: 'onMountCreateEmptyState'),
|
|
75
82
|
]),
|
|
@@ -92,11 +99,29 @@ function addComponent(fileSet, component, opts) {
|
|
|
92
99
|
}
|
|
93
100
|
componentFile.exportConst(componentName, (0, src_generator_1.invoke)(componentFile.import(componentFile.qwikModule, 'qComponent'), [qComponentOptions], ['any', 'any']));
|
|
94
101
|
onRenderFile.src.emit(src_generator_1.NL);
|
|
102
|
+
var directives = new Map();
|
|
95
103
|
onRenderFile.exportConst(componentName + '_onRender', (0, src_generator_1.invoke)(onRenderFile.import(onRenderFile.qwikModule, 'qHook'), [
|
|
96
|
-
(0, src_generator_1.
|
|
104
|
+
(0, src_generator_1.arrowFnBlock)(['__props__', '__state__'], [
|
|
105
|
+
renderStateConst(onRenderFile),
|
|
106
|
+
function () {
|
|
107
|
+
return this.emit('return ', (0, jsx_1.renderJSXNodes)(onRenderFile, directives, handlers, component.children, styles, {}), ';');
|
|
108
|
+
},
|
|
109
|
+
]),
|
|
97
110
|
]));
|
|
111
|
+
directives.forEach(function (code, name) {
|
|
112
|
+
fileSet.med.import(fileSet.med.qwikModule, 'h');
|
|
113
|
+
fileSet.med.exportConst(name, code);
|
|
114
|
+
});
|
|
98
115
|
}
|
|
99
116
|
exports.addComponent = addComponent;
|
|
117
|
+
function renderStateConst(file, isMount) {
|
|
118
|
+
if (isMount === void 0) { isMount = false; }
|
|
119
|
+
return function () {
|
|
120
|
+
return this.emit('const state', src_generator_1.WS, '=', src_generator_1.WS, file.module == 'med'
|
|
121
|
+
? file.exports.get('__merge')
|
|
122
|
+
: file.import('./med', '__merge').name, '(__state__,', src_generator_1.WS, '__props__', isMount ? ',true);' : ');', src_generator_1.NL);
|
|
123
|
+
};
|
|
124
|
+
}
|
|
100
125
|
function addCommonStyles(fileSet) {
|
|
101
126
|
var _a = getCommonStyles(fileSet), styles = _a.styles, symbolName = _a.symbolName;
|
|
102
127
|
var onRenderFile = fileSet.low;
|
|
@@ -109,9 +134,26 @@ function addComponentOnMount(componentFile, componentName, component) {
|
|
|
109
134
|
componentFile.exportConst(componentName + '_onMount', function () {
|
|
110
135
|
var _this = this;
|
|
111
136
|
this.emit((0, src_generator_1.invoke)(componentFile.import(componentFile.qwikModule, 'qHook'), [
|
|
112
|
-
(0, src_generator_1.arrowFnValue)([], function () {
|
|
113
|
-
|
|
137
|
+
(0, src_generator_1.arrowFnValue)(['__props__'], function () {
|
|
138
|
+
var _a;
|
|
139
|
+
return _this.emit('{', src_generator_1.NL, src_generator_1.INDENT, 'const __state__', src_generator_1.WS, '=', src_generator_1.WS, componentFile.import(componentFile.qwikModule, 'qObject').name, '({});', src_generator_1.NL, renderStateConst(componentFile, true), (0, src_generator_1.iif)((_a = component.hooks.onMount) === null || _a === void 0 ? void 0 : _a.code), src_generator_1.NL, 'return state;', src_generator_1.UNINDENT, src_generator_1.NL, '}');
|
|
114
140
|
}),
|
|
115
141
|
], ['any', 'any']));
|
|
116
142
|
});
|
|
117
143
|
}
|
|
144
|
+
function __merge(state, props, create) {
|
|
145
|
+
if (create === void 0) { create = false; }
|
|
146
|
+
for (var key in props) {
|
|
147
|
+
if (key.indexOf(':') == -1 &&
|
|
148
|
+
!key.startsWith('__') &&
|
|
149
|
+
Object.prototype.hasOwnProperty.call(props, key)) {
|
|
150
|
+
state[key] = props[key];
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (create && typeof __STATE__ == 'object' && props.serverStateId) {
|
|
154
|
+
debugger;
|
|
155
|
+
Object.assign(state, __STATE__[props.serverStateId]);
|
|
156
|
+
}
|
|
157
|
+
return state;
|
|
158
|
+
}
|
|
159
|
+
var templateObject_1;
|
|
@@ -1,2 +1,22 @@
|
|
|
1
1
|
import { MitosisNode } from '../../types/mitosis-node';
|
|
2
|
-
export declare const DIRECTIVES: Record<string, (node: MitosisNode, blockFn: () => void) => void>;
|
|
2
|
+
export declare const DIRECTIVES: Record<string, string | ((node: MitosisNode, blockFn: () => void) => void)>;
|
|
3
|
+
export declare function Image(props: {
|
|
4
|
+
href?: string;
|
|
5
|
+
image?: string;
|
|
6
|
+
backgroundSize?: string;
|
|
7
|
+
backgroundPosition?: string;
|
|
8
|
+
sizes?: string;
|
|
9
|
+
altText?: string;
|
|
10
|
+
fitContent?: boolean;
|
|
11
|
+
aspectRatio?: number;
|
|
12
|
+
lazy?: boolean;
|
|
13
|
+
class?: string;
|
|
14
|
+
children?: any[];
|
|
15
|
+
}): any;
|
|
16
|
+
export declare function CoreButton(props: {
|
|
17
|
+
text?: string;
|
|
18
|
+
link?: string;
|
|
19
|
+
class?: string;
|
|
20
|
+
openInNewTab?: string;
|
|
21
|
+
tagName$: string;
|
|
22
|
+
}): any;
|