@builder.io/mitosis 0.0.45 → 0.0.46
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/__tests__/builder.test.js +71 -68
- package/dist/src/__tests__/context.test.js +13 -10
- package/dist/src/__tests__/data/basic.raw.jsx +1 -1
- package/dist/src/__tests__/data/blocks/button-with-metadata.raw.jsx +1 -1
- package/dist/src/__tests__/data/blocks/columns.raw.jsx +2 -2
- package/dist/src/__tests__/data/blocks/custom-code.raw.jsx +3 -3
- package/dist/src/__tests__/data/blocks/embed.raw.jsx +3 -3
- package/dist/src/__tests__/data/blocks/form.raw.jsx +5 -5
- package/dist/src/__tests__/data/blocks/image.raw.jsx +4 -4
- package/dist/src/__tests__/data/blocks/stamped-io.raw.jsx +4 -4
- package/dist/src/__tests__/data/context/component-with-context.lite.jsx +2 -2
- package/dist/src/__tests__/data/context/simple.context.lite.js +1 -1
- package/dist/src/__tests__/html.test.js +2 -2
- package/dist/src/__tests__/liquid.test.js +34 -34
- package/dist/src/__tests__/parse-jsx.test.js +1 -1
- package/dist/src/__tests__/qwik.test.js +36 -36
- package/dist/src/__tests__/react-native.test.js +35 -35
- package/dist/src/__tests__/react.test.js +35 -35
- package/dist/src/__tests__/solid.test.js +32 -32
- package/dist/src/__tests__/vue.test.js +35 -34
- package/dist/src/generators/angular.d.ts +4 -7
- package/dist/src/generators/angular.js +77 -81
- package/dist/src/generators/builder.d.ts +4 -4
- package/dist/src/generators/builder.js +57 -57
- package/dist/src/generators/context/react.d.ts +3 -1
- package/dist/src/generators/context/react.js +20 -17
- package/dist/src/generators/html.d.ts +5 -9
- package/dist/src/generators/html.js +205 -199
- package/dist/src/generators/liquid.d.ts +5 -9
- package/dist/src/generators/liquid.js +62 -59
- package/dist/src/generators/mitosis.d.ts +6 -7
- package/dist/src/generators/mitosis.js +61 -63
- package/dist/src/generators/qwik/component.js +13 -13
- package/dist/src/generators/qwik/handlers.js +12 -8
- package/dist/src/generators/qwik/jsx.js +13 -9
- package/dist/src/generators/qwik/styles.js +11 -7
- package/dist/src/generators/react-native.d.ts +4 -7
- package/dist/src/generators/react-native.js +25 -22
- package/dist/src/generators/react.d.ts +4 -8
- package/dist/src/generators/react.js +103 -112
- package/dist/src/generators/solid.d.ts +4 -8
- package/dist/src/generators/solid.js +55 -54
- package/dist/src/generators/svelte.d.ts +4 -7
- package/dist/src/generators/svelte.js +120 -123
- package/dist/src/generators/swift-ui.d.ts +2 -2
- package/dist/src/generators/swift-ui.js +62 -62
- package/dist/src/generators/template.d.ts +4 -8
- package/dist/src/generators/template.js +48 -45
- package/dist/src/generators/vue.d.ts +9 -9
- package/dist/src/generators/vue.js +169 -169
- package/dist/src/helpers/babel-transform.js +9 -9
- package/dist/src/helpers/collect-styles.js +39 -39
- package/dist/src/helpers/dash-case.js +1 -1
- package/dist/src/helpers/generic-format.test.js +2 -2
- package/dist/src/helpers/get-components-used.js +2 -2
- package/dist/src/helpers/get-components.js +3 -3
- package/dist/src/helpers/get-props.js +1 -1
- package/dist/src/helpers/get-refs.js +2 -2
- package/dist/src/helpers/get-state-object-string.js +5 -5
- package/dist/src/helpers/get-state-used.js +1 -1
- package/dist/src/helpers/get-styles.js +1 -1
- package/dist/src/helpers/getters-to-functions.js +4 -4
- package/dist/src/helpers/handle-missing-state.js +1 -1
- package/dist/src/helpers/has-component.js +2 -2
- package/dist/src/helpers/has-props.js +1 -1
- package/dist/src/helpers/is-children.js +1 -1
- package/dist/src/helpers/json.d.ts +1 -0
- package/dist/src/helpers/json.js +17 -0
- package/dist/src/helpers/map-refs.js +4 -4
- package/dist/src/helpers/map-to-attributes.js +4 -4
- package/dist/src/helpers/map-to-css.js +2 -2
- package/dist/src/helpers/parse-node.js +2 -2
- package/dist/src/helpers/parse-reactive-script.js +4 -4
- package/dist/src/helpers/process-http-requests.js +1 -1
- package/dist/src/helpers/process-tag-references.js +4 -4
- package/dist/src/helpers/remove-surrounding-block.test.js +1 -1
- package/dist/src/helpers/render-imports.js +7 -7
- package/dist/src/helpers/replace-idenifiers.js +1 -1
- package/dist/src/helpers/strip-meta-properties.js +2 -2
- package/dist/src/helpers/trace-reference-to-module-path.js +1 -1
- package/dist/src/helpers/traverse-nodes.js +2 -2
- package/dist/src/helpers/try-prettier-format.js +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +2 -0
- package/dist/src/modules/plugins.d.ts +2 -10
- package/dist/src/parsers/angular.js +13 -13
- package/dist/src/parsers/builder.js +54 -58
- package/dist/src/parsers/context.js +2 -2
- package/dist/src/parsers/jsx.js +59 -87
- package/dist/src/parsers/liquid.js +191 -194
- package/dist/src/plugins/compile-away-builder-components.js +49 -45
- package/dist/src/plugins/compile-away-components.js +3 -3
- package/dist/src/plugins/map-styles.js +3 -3
- package/dist/src/targets.d.ts +24 -0
- package/dist/src/targets.js +30 -0
- package/dist/src/types/config.d.ts +31 -0
- package/dist/src/types/{jsx-lite-component.js → config.js} +0 -0
- package/dist/{test/qwik/Todo/Todo.js/low.js → src/types/generators.d.ts} +0 -0
- package/dist/src/types/generators.js +1 -0
- package/dist/src/types/plugins.d.ts +11 -0
- package/dist/src/types/{jsx-lite-context.js → plugins.js} +0 -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/{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/{Todos → todos}/Todo.tsx/high.tsx +0 -0
- package/dist/test/qwik/{Todos → todos}/Todo.tsx/low.tsx +0 -0
- package/dist/test/qwik/{Todos → todos}/Todo.tsx/med.tsx +0 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/dist/src/__tests__/data/blocks/tabs.raw.d.ts +0 -11
- package/dist/src/__tests__/data/blocks/tabs.raw.jsx +0 -24
- package/dist/src/__tests__/qoot.test.d.ts +0 -1
- package/dist/src/__tests__/qoot.test.js +0 -115
- package/dist/src/generators/jsx-lite.d.ts +0 -10
- package/dist/src/generators/jsx-lite.js +0 -176
- package/dist/src/generators/qoot.d.ts +0 -21
- package/dist/src/generators/qoot.js +0 -442
- package/dist/src/generators/qwik.d.ts +0 -21
- package/dist/src/generators/qwik.js +0 -458
- package/dist/src/helpers/create-jsx-lite-component.d.ts +0 -2
- package/dist/src/helpers/create-jsx-lite-component.js +0 -16
- package/dist/src/helpers/create-jsx-lite-context.d.ts +0 -4
- package/dist/src/helpers/create-jsx-lite-context.js +0 -18
- package/dist/src/helpers/create-jsx-lite-node.d.ts +0 -2
- package/dist/src/helpers/create-jsx-lite-node.js +0 -16
- package/dist/src/helpers/is-jsx-lite-node.d.ts +0 -2
- package/dist/src/helpers/is-jsx-lite-node.js +0 -7
- package/dist/src/types/jsx-lite-component.d.ts +0 -63
- package/dist/src/types/jsx-lite-context.d.ts +0 -6
- package/dist/src/types/jsx-lite-node.d.ts +0 -13
- package/dist/src/types/jsx-lite-node.js +0 -2
- package/dist/src/types/jsx-lite-styles.d.ts +0 -1
- package/dist/src/types/jsx-lite-styles.js +0 -2
- package/dist/test/qoot/Todo/bundle.js +0 -88
- package/dist/test/qoot/Todo/component.ts +0 -17
- package/dist/test/qoot/Todo/onButtonClick.ts +0 -13
- package/dist/test/qoot/Todo/onInput2Blur.ts +0 -11
- package/dist/test/qoot/Todo/onInput2KeyUp.ts +0 -10
- package/dist/test/qoot/Todo/onInputClick.ts +0 -10
- package/dist/test/qoot/Todo/onLabelDblClick.ts +0 -11
- package/dist/test/qoot/Todo/public.ts +0 -4
- package/dist/test/qoot/Todo/template.tsx +0 -46
- package/dist/test/qoot/Todos/component.ts +0 -9
- package/dist/test/qoot/Todos/onInputClick.ts +0 -14
- package/dist/test/qoot/Todos/public.ts +0 -3
- package/dist/test/qoot/Todos/template.tsx +0 -30
- package/dist/test/qwik/Todo/bundle.js +0 -46
- package/dist/test/qwik/Todo/component.ts +0 -17
- package/dist/test/qwik/Todo/onButtonClick.ts +0 -10
- package/dist/test/qwik/Todo/onInput2Blur.ts +0 -14
- package/dist/test/qwik/Todo/onInput2KeyUp.ts +0 -10
- package/dist/test/qwik/Todo/onInputClick.ts +0 -13
- package/dist/test/qwik/Todo/onLabelDblClick.ts +0 -11
- package/dist/test/qwik/Todo/public.ts +0 -3
- package/dist/test/qwik/Todo/template.tsx +0 -46
- package/dist/test/qwik/Todo.ts +0 -4
- package/dist/test/qwik/Todo_component.ts +0 -17
- package/dist/test/qwik/Todo_onButtonClick.ts +0 -13
- package/dist/test/qwik/Todo_onInput2Blur.ts +0 -14
- package/dist/test/qwik/Todo_onInput2KeyUp.ts +0 -10
- package/dist/test/qwik/Todo_onInputClick.ts +0 -13
- package/dist/test/qwik/Todo_onLabelDblClick.ts +0 -14
- package/dist/test/qwik/Todo_template.tsx +0 -46
- package/dist/test/qwik/Todos/component.ts +0 -9
- package/dist/test/qwik/Todos/onInputClick.ts +0 -14
- package/dist/test/qwik/Todos/public.ts +0 -3
- package/dist/test/qwik/Todos/template.tsx +0 -30
- package/dist/test/qwik/Todos.ts +0 -3
- package/dist/test/qwik/Todos_component.ts +0 -9
- package/dist/test/qwik/Todos_onInputClick.ts +0 -14
- package/dist/test/qwik/Todos_template.tsx +0 -30
- package/dist/test/qwik/qwik/Image/high.js +0 -1
- package/dist/test/qwik/qwik/Image/low.js +0 -75
- package/dist/test/qwik/qwik/Image/med.js +0 -9
- package/dist/test/qwik/qwik/Image.slow/high.js +0 -1
- package/dist/test/qwik/qwik/Image.slow/low.js +0 -75
- package/dist/test/qwik/qwik/Image.slow/med.js +0 -9
- package/dist/test/qwik/qwik/button/high.js +0 -8
- package/dist/test/qwik/qwik/button/low.js +0 -34
- package/dist/test/qwik/qwik/button/med.js +0 -9
- package/dist/test/qwik/qwik/hello_world/stylesheet/high.jsx +0 -1
- package/dist/test/qwik/qwik/hello_world/stylesheet/low.jsx +0 -24
- package/dist/test/qwik/qwik/hello_world/stylesheet/med.jsx +0 -9
- package/dist/test/qwik/qwik/page-with-symbol/high.js +0 -1
- package/dist/test/qwik/qwik/page-with-symbol/low.js +0 -49
- package/dist/test/qwik/qwik/page-with-symbol/med.js +0 -9
- package/dist/test/qwik/qwik/svg/high.js +0 -1
- package/dist/test/qwik/qwik/svg/low.js +0 -30
- package/dist/test/qwik/qwik/svg/med.js +0 -9
- package/dist/test/qwik/qwik/todo/Todo.cjs/high.cjs +0 -31
- package/dist/test/qwik/qwik/todo/Todo.cjs/low.cjs +0 -1
- package/dist/test/qwik/qwik/todo/Todo.cjs/med.cjs +0 -59
- package/dist/test/qwik/qwik/todo/Todo.js/high.js +0 -5
- package/dist/test/qwik/qwik/todo/Todo.js/med.js +0 -1
- package/dist/test/qwik/qwik/todo/Todo.tsx/high.tsx +0 -30
- package/dist/test/qwik/qwik/todo/Todo.tsx/low.tsx +0 -1
- package/dist/test/qwik/qwik/todo/Todo.tsx/med.tsx +0 -34
- package/dist/test/qwik/qwik/todos/Todo.tsx/high.tsx +0 -12
- package/dist/test/qwik/qwik/todos/Todo.tsx/low.tsx +0 -24
- package/dist/test/qwik/qwik/todos/Todo.tsx/med.tsx +0 -8
|
@@ -1,458 +0,0 @@
|
|
|
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.componentToQwik = void 0;
|
|
63
|
-
var core_1 = require("@babel/core");
|
|
64
|
-
var plugin_virtual_1 = __importDefault(require("@rollup/plugin-virtual"));
|
|
65
|
-
var dedent_1 = __importDefault(require("dedent"));
|
|
66
|
-
var lodash_1 = require("lodash");
|
|
67
|
-
var standalone_1 = require("prettier/standalone");
|
|
68
|
-
var rollup_1 = require("rollup");
|
|
69
|
-
var traverse_1 = __importDefault(require("traverse"));
|
|
70
|
-
var babel_transform_1 = require("../helpers/babel-transform");
|
|
71
|
-
var capitalize_1 = require("../helpers/capitalize");
|
|
72
|
-
var collect_styles_1 = require("../helpers/collect-styles");
|
|
73
|
-
var fast_clone_1 = require("../helpers/fast-clone");
|
|
74
|
-
var filter_empty_text_nodes_1 = require("../helpers/filter-empty-text-nodes");
|
|
75
|
-
var get_state_object_string_1 = require("../helpers/get-state-object-string");
|
|
76
|
-
var is_mitosis_node_1 = require("../helpers/is-mitosis-node");
|
|
77
|
-
var is_valid_attribute_name_1 = require("../helpers/is-valid-attribute-name");
|
|
78
|
-
var remove_surrounding_block_1 = require("../helpers/remove-surrounding-block");
|
|
79
|
-
var render_imports_1 = require("../helpers/render-imports");
|
|
80
|
-
var strip_meta_properties_1 = require("../helpers/strip-meta-properties");
|
|
81
|
-
var strip_state_and_props_refs_1 = require("../helpers/strip-state-and-props-refs");
|
|
82
|
-
var plugins_1 = require("../modules/plugins");
|
|
83
|
-
var jsx_1 = require("../parsers/jsx");
|
|
84
|
-
var html_escape_1 = require("../helpers/html-escape");
|
|
85
|
-
var qwikImport = function (options) {
|
|
86
|
-
return options.qwikLib || '@builder.io/qwik';
|
|
87
|
-
};
|
|
88
|
-
function addMarkDirtyAfterSetInCode(code, options, useString) {
|
|
89
|
-
if (useString === void 0) { useString = 'markDirty(this)'; }
|
|
90
|
-
return babel_transform_1.babelTransformExpression(code, {
|
|
91
|
-
UpdateExpression: function (path) {
|
|
92
|
-
var node = path.node;
|
|
93
|
-
if (core_1.types.isMemberExpression(node.argument)) {
|
|
94
|
-
if (core_1.types.isIdentifier(node.argument.object)) {
|
|
95
|
-
// TODO: utility to properly trace this reference to the beginning
|
|
96
|
-
if (node.argument.object.name === 'state') {
|
|
97
|
-
// TODO: ultimately do updates by property, e.g. updateName()
|
|
98
|
-
// that updates any attributes dependent on name, etc
|
|
99
|
-
var parent_1 = path;
|
|
100
|
-
// `_temp = ` assignments are created sometimes when we insertAfter
|
|
101
|
-
// for simple expressions. this causes us to re-process the same expression
|
|
102
|
-
// in an infinite loop
|
|
103
|
-
while ((parent_1 = parent_1.parentPath)) {
|
|
104
|
-
if (core_1.types.isAssignmentExpression(parent_1.node) &&
|
|
105
|
-
core_1.types.isIdentifier(parent_1.node.left) &&
|
|
106
|
-
parent_1.node.left.name.startsWith('_temp')) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
path.insertAfter(core_1.types.identifier(useString));
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
AssignmentExpression: function (path) {
|
|
116
|
-
var node = path.node;
|
|
117
|
-
if (core_1.types.isMemberExpression(node.left)) {
|
|
118
|
-
if (core_1.types.isIdentifier(node.left.object)) {
|
|
119
|
-
// TODO: utility to properly trace this reference to the beginning
|
|
120
|
-
if (node.left.object.name === 'state') {
|
|
121
|
-
// TODO: ultimately do updates by property, e.g. updateName()
|
|
122
|
-
// that updates any attributes dependent on name, etc
|
|
123
|
-
var parent_2 = path;
|
|
124
|
-
// `_temp = ` assignments are created sometimes when we insertAfter
|
|
125
|
-
// for simple expressions. this causes us to re-process the same expression
|
|
126
|
-
// in an infinite loop
|
|
127
|
-
while ((parent_2 = parent_2.parentPath)) {
|
|
128
|
-
if (core_1.types.isAssignmentExpression(parent_2.node) &&
|
|
129
|
-
core_1.types.isIdentifier(parent_2.node.left) &&
|
|
130
|
-
parent_2.node.left.name.startsWith('_temp')) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
path.insertAfter(core_1.types.identifier(useString));
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
var processBinding = function (binding, options) {
|
|
142
|
-
return strip_state_and_props_refs_1.stripStateAndPropsRefs(addMarkDirtyAfterSetInCode(binding, options), {
|
|
143
|
-
replaceWith: 'this.',
|
|
144
|
-
})
|
|
145
|
-
// Remove trailing semicolon
|
|
146
|
-
.trim()
|
|
147
|
-
.replace(/;$/, '');
|
|
148
|
-
};
|
|
149
|
-
var NODE_MAPPERS = {
|
|
150
|
-
Fragment: function (json, options) {
|
|
151
|
-
return "<>" + json.children
|
|
152
|
-
.map(function (item) { return blockToQwik(item, options); })
|
|
153
|
-
.join('\n') + "</>";
|
|
154
|
-
},
|
|
155
|
-
For: function (json, options) {
|
|
156
|
-
return "{" + processBinding(json.bindings.each, options) + "?.map(" + json.properties._forName + " => (\n <>" + json.children
|
|
157
|
-
.filter(filter_empty_text_nodes_1.filterEmptyTextNodes)
|
|
158
|
-
.map(function (item) { return blockToQwik(item, options); })
|
|
159
|
-
.join('\n') + "</>\n ))}";
|
|
160
|
-
},
|
|
161
|
-
Show: function (json, options) {
|
|
162
|
-
return "{" + processBinding(json.bindings.when, options) + " ? (\n <>" + json.children
|
|
163
|
-
.filter(filter_empty_text_nodes_1.filterEmptyTextNodes)
|
|
164
|
-
.map(function (item) { return blockToQwik(item, options); })
|
|
165
|
-
.join('\n') + "</>\n ) : undefined}";
|
|
166
|
-
},
|
|
167
|
-
};
|
|
168
|
-
var getId = function (json, options) {
|
|
169
|
-
var name = json.properties.$name
|
|
170
|
-
? camelCase(json.properties.$name)
|
|
171
|
-
: /^h\d$/.test(json.name || '') // don't dashcase h1 into h-1
|
|
172
|
-
? json.name
|
|
173
|
-
: camelCase(json.name || 'div');
|
|
174
|
-
var newNameNum = (options.namesMap[name] || 0) + 1;
|
|
175
|
-
options.namesMap[name] = newNameNum;
|
|
176
|
-
return capitalize_1.capitalize("" + name + (newNameNum === 1 ? '' : "" + newNameNum));
|
|
177
|
-
};
|
|
178
|
-
var elId = function (node, options) {
|
|
179
|
-
if (node.meta.id) {
|
|
180
|
-
return node.meta.id;
|
|
181
|
-
}
|
|
182
|
-
var id = getId(node, options);
|
|
183
|
-
node.meta.id = id;
|
|
184
|
-
return id;
|
|
185
|
-
};
|
|
186
|
-
var blockToQwik = function (json, options) {
|
|
187
|
-
if (NODE_MAPPERS[json.name]) {
|
|
188
|
-
return NODE_MAPPERS[json.name](json, options);
|
|
189
|
-
}
|
|
190
|
-
if (json.bindings._text) {
|
|
191
|
-
return "{" + processBinding(json.bindings._text, options) + "}";
|
|
192
|
-
}
|
|
193
|
-
if (json.properties._text) {
|
|
194
|
-
return json.properties._text;
|
|
195
|
-
}
|
|
196
|
-
var str = '';
|
|
197
|
-
str += "<" + json.name + " ";
|
|
198
|
-
if (json.bindings._spread) {
|
|
199
|
-
str += " {...(" + json.bindings._spread + ")} ";
|
|
200
|
-
}
|
|
201
|
-
for (var key in json.properties) {
|
|
202
|
-
if (!key || key.startsWith('_') || key.startsWith('$')) {
|
|
203
|
-
continue;
|
|
204
|
-
}
|
|
205
|
-
var value = html_escape_1.htmlAttributeEscape(json.properties[key] || '');
|
|
206
|
-
if (is_valid_attribute_name_1.isValidAttributeName(key)) {
|
|
207
|
-
str += " " + key + "=\"" + value + "\" ";
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
var eventBindings = {};
|
|
211
|
-
for (var key in json.bindings) {
|
|
212
|
-
var value = json.bindings[key];
|
|
213
|
-
if (key.startsWith('_') || key.startsWith('$')) {
|
|
214
|
-
continue;
|
|
215
|
-
}
|
|
216
|
-
if (key.startsWith('on')) {
|
|
217
|
-
var useKey = key.replace('on', 'on:').toLowerCase();
|
|
218
|
-
var componentName = getComponentName(options.componentJson, options);
|
|
219
|
-
if (options.bundle) {
|
|
220
|
-
eventBindings[useKey] = "QRL`" + options.qrlPrefix + "/" + componentName + "/bundle" + (options.qrlSuffix || '') + ".on" + elId(json, options) + key.slice(2) + "`";
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
eventBindings[useKey] = "QRL`" + options.qrlPrefix + "/" + componentName + "_on" + elId(json, options) + key.slice(2) + (options.qrlSuffix || '') + "`";
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
else {
|
|
227
|
-
if (!is_valid_attribute_name_1.isValidAttributeName(key)) {
|
|
228
|
-
console.warn('Skipping invalid attribute name:', key);
|
|
229
|
-
}
|
|
230
|
-
else {
|
|
231
|
-
str += " " + key + "={" + processBinding(value, options) + "} ";
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
if (lodash_1.size(eventBindings)) {
|
|
236
|
-
for (var event_1 in eventBindings) {
|
|
237
|
-
str += event_1 + "={" + eventBindings[event_1] + "}";
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
if (jsx_1.selfClosingTags.has(json.name)) {
|
|
241
|
-
return str + ' />';
|
|
242
|
-
}
|
|
243
|
-
str += '>';
|
|
244
|
-
if (json.children) {
|
|
245
|
-
str += json.children.map(function (item) { return blockToQwik(item, options); }).join('\n');
|
|
246
|
-
}
|
|
247
|
-
str += "</" + json.name + ">";
|
|
248
|
-
return str;
|
|
249
|
-
};
|
|
250
|
-
var getComponentName = function (json, options) {
|
|
251
|
-
return capitalize_1.capitalize(camelCase(json.name || 'my-component'));
|
|
252
|
-
};
|
|
253
|
-
// TODO
|
|
254
|
-
var getProvidersString = function (componentJson, options) {
|
|
255
|
-
return 'null';
|
|
256
|
-
};
|
|
257
|
-
var formatCode = function (str, options, type) {
|
|
258
|
-
if (type === void 0) { type = 'typescript'; }
|
|
259
|
-
if (options.prettier !== false) {
|
|
260
|
-
try {
|
|
261
|
-
str = standalone_1.format(str, {
|
|
262
|
-
parser: type === 'typescript' ? 'babel-ts' : type,
|
|
263
|
-
plugins: [
|
|
264
|
-
require('prettier/parser-typescript'),
|
|
265
|
-
require('prettier/parser-babel'),
|
|
266
|
-
require('prettier/parser-postcss'),
|
|
267
|
-
],
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
catch (err) {
|
|
271
|
-
console.warn('Error formatting code', err);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
return str;
|
|
275
|
-
};
|
|
276
|
-
var getEventHandlerFiles = function (componentJson, options) {
|
|
277
|
-
var files = [];
|
|
278
|
-
traverse_1.default(componentJson).forEach(function (item) {
|
|
279
|
-
if (is_mitosis_node_1.isMitosisNode(item)) {
|
|
280
|
-
for (var binding in item.bindings) {
|
|
281
|
-
if (binding.startsWith('on')) {
|
|
282
|
-
var eventHandlerName = elId(item, options) + binding.slice(2);
|
|
283
|
-
var componentName = getComponentName(componentJson, options);
|
|
284
|
-
var str = formatCode("import {\n injectEventHandler,\n provideEvent,\n markDirty\n } from '" + qwikImport(options) + "';\n import { " + componentName + "Component } from './" + componentName + "_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);
|
|
285
|
-
str = formatCode(str, options);
|
|
286
|
-
files.push({
|
|
287
|
-
path: componentName + "_on" + eventHandlerName + ".ts",
|
|
288
|
-
contents: str,
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
});
|
|
294
|
-
return files;
|
|
295
|
-
};
|
|
296
|
-
var componentToQwik = function (componentJson, toQwikOptions) {
|
|
297
|
-
if (toQwikOptions === void 0) { toQwikOptions = {}; }
|
|
298
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
299
|
-
var json, options, css, hasCss, addWrapper, componentName, str, dataString, output, moduleMap, bundle, bundleOutput;
|
|
300
|
-
return __generator(this, function (_a) {
|
|
301
|
-
switch (_a.label) {
|
|
302
|
-
case 0:
|
|
303
|
-
json = fast_clone_1.fastClone(componentJson);
|
|
304
|
-
options = __assign(__assign({ qrlPrefix: 'ui:' }, toQwikOptions), { namesMap: {}, componentJson: json });
|
|
305
|
-
if (options.plugins) {
|
|
306
|
-
json = plugins_1.runPreJsonPlugins(json, options.plugins);
|
|
307
|
-
}
|
|
308
|
-
css = collect_styles_1.collectCss(json, {
|
|
309
|
-
classProperty: 'class',
|
|
310
|
-
prefix: options.cssNamespace,
|
|
311
|
-
});
|
|
312
|
-
if (options.minifyStyles) {
|
|
313
|
-
css = css.trim().replace(/\s+/g, ' ');
|
|
314
|
-
}
|
|
315
|
-
else {
|
|
316
|
-
css = formatCode(css, options, 'css');
|
|
317
|
-
}
|
|
318
|
-
hasCss = Boolean(css.trim().length);
|
|
319
|
-
addWrapper = json.children.length > 1 || hasCss;
|
|
320
|
-
if (options.plugins) {
|
|
321
|
-
json = plugins_1.runPostJsonPlugins(json, options.plugins);
|
|
322
|
-
}
|
|
323
|
-
componentName = capitalize_1.capitalize(camelCase(componentJson.name || 'my-component'));
|
|
324
|
-
strip_meta_properties_1.stripMetaProperties(json);
|
|
325
|
-
str = dedent_1.default(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n import { injectMethod, QRL, h } 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, h } from '", "';\n import { ", "Component } from './", "_component.js'\n ",
|
|
326
|
-
"\n\n export ",
|
|
327
|
-
" injectMethod(", "Component, function (this: ", "Component) {\n return (", "\n ",
|
|
328
|
-
"\n ", "\n ", ")\n })\n "])), qwikImport(options), componentName, componentName, render_imports_1.renderPreComponent(__assign(__assign({}, json), { imports: json.imports.map(function (item) {
|
|
329
|
-
if (item.path.endsWith('.lite')) {
|
|
330
|
-
var clone = fast_clone_1.fastClone(item);
|
|
331
|
-
var name_1 = clone.path
|
|
332
|
-
.split(/[\.\/]/)
|
|
333
|
-
// Get the -1 index of array
|
|
334
|
-
.slice(-2, -1)
|
|
335
|
-
.pop();
|
|
336
|
-
var pascalName = capitalize_1.capitalize(camelCase(name_1));
|
|
337
|
-
clone.path = "../" + pascalName + "/public.js";
|
|
338
|
-
for (var key in clone.imports) {
|
|
339
|
-
var value = clone.imports[key];
|
|
340
|
-
if (value === 'default') {
|
|
341
|
-
clone.imports[key] = pascalName;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
return clone;
|
|
345
|
-
}
|
|
346
|
-
return item;
|
|
347
|
-
}) })), options.bundle ? "const template = " : 'default', componentName, componentName, addWrapper ? '<>' : '', !hasCss
|
|
348
|
-
? ''
|
|
349
|
-
: "<style>{`" + css
|
|
350
|
-
.trim()
|
|
351
|
-
.replace(/^|\n/g, '\n' + ' '.repeat(12)) + "`}</style>", json.children.map(function (item) { return blockToQwik(item, options); }).join('\n'), addWrapper ? '</>' : '');
|
|
352
|
-
if (options.plugins) {
|
|
353
|
-
str = plugins_1.runPreCodePlugins(str, options.plugins);
|
|
354
|
-
}
|
|
355
|
-
str = formatCode(str, options);
|
|
356
|
-
if (options.plugins) {
|
|
357
|
-
str = plugins_1.runPostCodePlugins(str, options.plugins);
|
|
358
|
-
}
|
|
359
|
-
dataString = get_state_object_string_1.getStateObjectStringFromComponent(json, {
|
|
360
|
-
format: 'class',
|
|
361
|
-
valueMapper: function (code) { return processBinding(code, options); },
|
|
362
|
-
});
|
|
363
|
-
output = {
|
|
364
|
-
files: __spreadArray([
|
|
365
|
-
{
|
|
366
|
-
path: componentName + "_template.tsx",
|
|
367
|
-
contents: str,
|
|
368
|
-
},
|
|
369
|
-
{
|
|
370
|
-
path: componentName + ".ts",
|
|
371
|
-
contents: formatCode("\n import { jsxDeclareComponent, QRL } from '" + qwikImport(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),
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
path: componentName + "_component.ts",
|
|
375
|
-
contents: formatCode((function () {
|
|
376
|
-
var str = "\n " + (options.format === 'builder' ? '' : 'export ') + "class " + (options.format === 'builder' ? '_' : '') + componentName + "Component extends Component<any, any> {\n " + (options.format === 'builder'
|
|
377
|
-
? ''
|
|
378
|
-
: "static $templateQRL = '" + options.qrlPrefix + "/" + componentName + (options.bundle ? '/bundle' : '_template') + (options.qrlSuffix || '') + (options.bundle ? '.template' : '') + "'") + "\n\n " + dataString + "\n\n " + (!json.hooks.onMount
|
|
379
|
-
? ''
|
|
380
|
-
: "\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'
|
|
381
|
-
? ''
|
|
382
|
-
: "\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 ";
|
|
383
|
-
str = "\n import { Component, QRL " + (str.includes('markDirty(') ? ', markDirty' : '') + " } from '" + qwikImport(options) + "';\n " + str + "\n ";
|
|
384
|
-
return str;
|
|
385
|
-
})(), options),
|
|
386
|
-
}
|
|
387
|
-
], getEventHandlerFiles(json, options)),
|
|
388
|
-
};
|
|
389
|
-
if (!options.bundle) return [3 /*break*/, 3];
|
|
390
|
-
moduleMap = __assign({ entry: output.files
|
|
391
|
-
.filter(function (file) { return !file.path.endsWith('.ts'); })
|
|
392
|
-
.map(function (file) { return "export * from './" + file.path.replace(/\.tsx?$/, '.js') + "';"; })
|
|
393
|
-
.join('\n') }, output.files.reduce(function (memo, arg) {
|
|
394
|
-
var transformed = core_1.transform(arg.contents, {
|
|
395
|
-
sourceFileName: arg.path,
|
|
396
|
-
plugins: [
|
|
397
|
-
[
|
|
398
|
-
require('@babel/plugin-transform-typescript'),
|
|
399
|
-
{
|
|
400
|
-
jsx: 'react',
|
|
401
|
-
isTSX: true,
|
|
402
|
-
allExtensions: true,
|
|
403
|
-
jsxFactory: 'h',
|
|
404
|
-
jsxPragma: 'h',
|
|
405
|
-
},
|
|
406
|
-
],
|
|
407
|
-
[
|
|
408
|
-
require('@babel/plugin-transform-react-jsx'),
|
|
409
|
-
{
|
|
410
|
-
pragma: 'h',
|
|
411
|
-
pragmaFrag: 'null',
|
|
412
|
-
throwIfNamespace: false,
|
|
413
|
-
},
|
|
414
|
-
],
|
|
415
|
-
require('@babel/plugin-proposal-class-properties'),
|
|
416
|
-
],
|
|
417
|
-
});
|
|
418
|
-
memo['./' + arg.path.replace(/\.tsx?$/, '.js')] = transformed.code;
|
|
419
|
-
return memo;
|
|
420
|
-
}, {}));
|
|
421
|
-
return [4 /*yield*/, rollup_1.rollup({
|
|
422
|
-
input: 'entry',
|
|
423
|
-
external: [options.qwikLib || '@builder.io/qwik'],
|
|
424
|
-
plugins: [plugin_virtual_1.default(moduleMap)],
|
|
425
|
-
})];
|
|
426
|
-
case 1:
|
|
427
|
-
bundle = _a.sent();
|
|
428
|
-
return [4 /*yield*/, bundle.generate({
|
|
429
|
-
file: 'bundle.js',
|
|
430
|
-
format: 'esm',
|
|
431
|
-
})];
|
|
432
|
-
case 2:
|
|
433
|
-
bundleOutput = (_a.sent()).output;
|
|
434
|
-
output.files.push({
|
|
435
|
-
path: componentName + "/bundle.js",
|
|
436
|
-
contents: bundleOutput[0].code,
|
|
437
|
-
});
|
|
438
|
-
_a.label = 3;
|
|
439
|
-
case 3: return [2 /*return*/, output];
|
|
440
|
-
}
|
|
441
|
-
});
|
|
442
|
-
});
|
|
443
|
-
};
|
|
444
|
-
exports.componentToQwik = componentToQwik;
|
|
445
|
-
/**
|
|
446
|
-
* This is a function similar to loadash `camelCase`, but it does not mess with capitalization.
|
|
447
|
-
*
|
|
448
|
-
* loadash: `camelCase('A-BC')` => "ABc"
|
|
449
|
-
* this fn: `camelCase('A-BC')` => "ABC"
|
|
450
|
-
*
|
|
451
|
-
*/
|
|
452
|
-
function camelCase(text) {
|
|
453
|
-
if (text === void 0) { text = ''; }
|
|
454
|
-
var parts = text.split('-');
|
|
455
|
-
var first = parts.shift();
|
|
456
|
-
return first + parts.map(capitalize_1.capitalize).join('');
|
|
457
|
-
}
|
|
458
|
-
var templateObject_1;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.createJSXLiteComponent = void 0;
|
|
15
|
-
var createJSXLiteComponent = function (options) { return (__assign({ '@type': '@jsx-lite/component', imports: [], meta: {}, state: {}, children: [], hooks: {}, context: { get: {}, set: {} }, name: (options === null || options === void 0 ? void 0 : options.name) || 'MyComponent', subComponents: [] }, options)); };
|
|
16
|
-
exports.createJSXLiteComponent = createJSXLiteComponent;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.createJsxLiteContext = void 0;
|
|
15
|
-
function createJsxLiteContext(options) {
|
|
16
|
-
return __assign({ '@type': '@jsx-lite/context', value: {} }, options);
|
|
17
|
-
}
|
|
18
|
-
exports.createJsxLiteContext = createJsxLiteContext;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.createJSXLiteNode = void 0;
|
|
15
|
-
var createJSXLiteNode = function (options) { return (__assign({ '@type': '@jsx-lite/node', name: 'div', meta: {}, properties: {}, bindings: {}, children: [] }, options)); };
|
|
16
|
-
exports.createJSXLiteNode = createJSXLiteNode;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { JSONObject } from './json';
|
|
2
|
-
import { JSXLiteNode } from './jsx-lite-node';
|
|
3
|
-
/**
|
|
4
|
-
* @example
|
|
5
|
-
* // import core, { useState, someThing as someAlias } from '@jsx-lite/core'
|
|
6
|
-
* {
|
|
7
|
-
* path: '@jsx-lite/core',
|
|
8
|
-
* imports: {
|
|
9
|
-
* useState: 'useState',
|
|
10
|
-
* someAlias: 'someThing',
|
|
11
|
-
* core: 'default',
|
|
12
|
-
* }
|
|
13
|
-
* }
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* // import * as core from '@jsx-lite/core'
|
|
17
|
-
* {
|
|
18
|
-
* path: '@jsx-lite/core',
|
|
19
|
-
* imports: {
|
|
20
|
-
* core: '*',
|
|
21
|
-
* }
|
|
22
|
-
* }
|
|
23
|
-
*/
|
|
24
|
-
export interface JSXLiteImport {
|
|
25
|
-
path: string;
|
|
26
|
-
imports: {
|
|
27
|
-
[key: string]: string | undefined;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
declare type ContextInfo = {
|
|
31
|
-
name: string;
|
|
32
|
-
path: string;
|
|
33
|
-
};
|
|
34
|
-
export declare type JSXLiteComponent = {
|
|
35
|
-
'@type': '@jsx-lite/component';
|
|
36
|
-
name: string;
|
|
37
|
-
imports: JSXLiteImport[];
|
|
38
|
-
meta: JSONObject & {
|
|
39
|
-
metadataHook?: JSONObject;
|
|
40
|
-
};
|
|
41
|
-
state: JSONObject;
|
|
42
|
-
context: {
|
|
43
|
-
get: {
|
|
44
|
-
[key: string]: ContextInfo;
|
|
45
|
-
};
|
|
46
|
-
set: {
|
|
47
|
-
[key: string]: {
|
|
48
|
-
name: string;
|
|
49
|
-
value?: JSONObject;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
hooks: {
|
|
54
|
-
init?: string;
|
|
55
|
-
onMount?: string;
|
|
56
|
-
onUnMount?: string;
|
|
57
|
-
preComponent?: string;
|
|
58
|
-
postComponent?: string;
|
|
59
|
-
};
|
|
60
|
-
children: JSXLiteNode[];
|
|
61
|
-
subComponents: JSXLiteComponent[];
|
|
62
|
-
};
|
|
63
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { JSONObject } from './json';
|
|
2
|
-
export declare type JSXLiteNode = {
|
|
3
|
-
'@type': '@jsx-lite/node';
|
|
4
|
-
name: string;
|
|
5
|
-
meta: JSONObject;
|
|
6
|
-
properties: {
|
|
7
|
-
[key: string]: string | undefined;
|
|
8
|
-
};
|
|
9
|
-
bindings: {
|
|
10
|
-
[key: string]: string | undefined;
|
|
11
|
-
};
|
|
12
|
-
children: JSXLiteNode[];
|
|
13
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare type JSXLiteStyles = Omit<Partial<CSSStyleDeclaration>, 'length' | 'getPropertyPriority' | 'getPropertyValue' | 'item' | 'removeProperty' | 'setProperty'>;
|