@builder.io/mitosis 0.0.56-62 → 0.0.56-66
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__/data/types/foo-type.d.ts +1 -0
- package/dist/src/__tests__/data/types/foo-type.js +2 -0
- package/dist/src/__tests__/data/types/type-dependency.raw.d.ts +5 -0
- package/dist/src/__tests__/data/types/type-dependency.raw.jsx +6 -0
- package/dist/src/__tests__/shared.js +2 -0
- package/dist/src/generators/qwik/component-generator.js +7 -55
- package/dist/src/parsers/jsx/component-types.d.ts +1 -0
- package/dist/src/parsers/jsx/component-types.js +9 -1
- package/dist/src/parsers/jsx/jsx.js +6 -0
- package/dist/test/qwik/Accordion/high.jsx +0 -0
- package/dist/test/qwik/Accordion/low.jsx +240 -0
- package/dist/test/qwik/Accordion/med.jsx +4 -0
- package/dist/test/qwik/For/high.jsx +0 -0
- package/dist/test/qwik/For/low.jsx +52 -0
- package/dist/test/qwik/For/med.jsx +4 -0
- package/dist/test/qwik/Image/high.js +9 -0
- package/dist/test/qwik/Image/low.js +0 -0
- package/dist/test/qwik/Image/med.js +155 -0
- package/dist/test/qwik/Image.slow/high.js +9 -0
- package/dist/test/qwik/Image.slow/low.js +0 -0
- package/dist/test/qwik/Image.slow/med.js +155 -0
- package/dist/test/qwik/bindings/high.cjs +0 -0
- package/dist/test/qwik/bindings/low.cjs +45 -0
- package/dist/test/qwik/bindings/med.cjs +3 -0
- package/dist/test/qwik/button/high.js +3 -0
- package/dist/test/qwik/button/low.js +25 -0
- package/dist/test/qwik/button/med.js +31 -0
- package/dist/test/qwik/component/bindings/high.jsx +0 -0
- package/dist/test/qwik/component/bindings/low.jsx +104 -0
- package/dist/test/qwik/component/bindings/med.jsx +7 -0
- package/dist/test/qwik/component/component/inputs/high.cjsx +9 -0
- package/dist/test/qwik/component/component/inputs/low.cjsx +0 -0
- package/dist/test/qwik/component/component/inputs/med.cjsx +68 -0
- package/dist/test/qwik/for-loop.bindings/high.cjs +0 -0
- package/dist/test/qwik/for-loop.bindings/low.cjs +56 -0
- package/dist/test/qwik/for-loop.bindings/med.cjs +5 -0
- package/dist/test/qwik/hello_world/stylesheet/high.jsx +0 -0
- package/dist/test/qwik/hello_world/stylesheet/low.jsx +26 -0
- package/dist/test/qwik/hello_world/stylesheet/med.jsx +4 -0
- package/dist/test/qwik/mount/high.cjs +0 -0
- package/dist/test/qwik/mount/low.cjs +47 -0
- package/dist/test/qwik/mount/med.cjs +3 -0
- package/dist/test/qwik/page-with-symbol/high.js +0 -0
- package/dist/test/qwik/page-with-symbol/low.js +33 -0
- package/dist/test/qwik/page-with-symbol/med.js +4 -0
- package/dist/test/qwik/show-hide/high.jsx +9 -0
- package/dist/test/qwik/show-hide/low.jsx +0 -0
- package/dist/test/qwik/show-hide/med.jsx +181 -0
- package/dist/test/qwik/svg/high.js +0 -0
- package/dist/test/qwik/svg/low.js +30 -0
- package/dist/test/qwik/svg/med.js +4 -0
- package/dist/test/qwik/todo/Todo.cjs/high.cjs +19 -0
- package/dist/test/qwik/todo/Todo.cjs/low.cjs +0 -0
- package/dist/test/qwik/todo/Todo.cjs/med.cjs +51 -0
- package/dist/test/qwik/todo/Todo.js/high.js +19 -0
- package/dist/test/qwik/todo/Todo.js/low.js +0 -0
- package/dist/test/qwik/todo/Todo.js/med.js +47 -0
- package/dist/test/qwik/todo/Todo.tsx/high.tsx +19 -0
- package/dist/test/qwik/todo/Todo.tsx/low.tsx +0 -0
- package/dist/test/qwik/todo/Todo.tsx/med.tsx +43 -0
- package/dist/test/qwik/todos/Todo.tsx/high.tsx +7 -0
- package/dist/test/qwik/todos/Todo.tsx/low.tsx +32 -0
- package/dist/test/qwik/todos/Todo.tsx/med.tsx +4 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type Foo = null;
|
|
@@ -21,6 +21,7 @@ var preserveExportOrLocalStatement = require('./data/basic-preserve-export-or-lo
|
|
|
21
21
|
var propsType = require('./data/types/component-props-type.raw');
|
|
22
22
|
var propsInterface = require('./data/types/component-props-interface.raw');
|
|
23
23
|
var preserveTyping = require('./data/types/preserve-typing.raw');
|
|
24
|
+
var typeDependency = require('./data/types/type-dependency.raw');
|
|
24
25
|
var classRaw = require('./data/styles/class.raw');
|
|
25
26
|
var className = require('./data/styles/className.raw');
|
|
26
27
|
var classAndClassName = require('./data/styles/class-and-className.raw');
|
|
@@ -86,6 +87,7 @@ var BASIC_TESTS = {
|
|
|
86
87
|
propsType: propsType,
|
|
87
88
|
propsInterface: propsInterface,
|
|
88
89
|
preserveTyping: preserveTyping,
|
|
90
|
+
typeDependency: typeDependency,
|
|
89
91
|
propsDestructure: propsDestructure,
|
|
90
92
|
'onInit & onMount': onInitonMount,
|
|
91
93
|
'Basic Context': basicContext,
|
|
@@ -1,15 +1,4 @@
|
|
|
1
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
2
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
3
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
4
|
if (ar || !(i in from)) {
|
|
@@ -50,19 +39,15 @@ var componentToQwik = function (userOptions) {
|
|
|
50
39
|
try {
|
|
51
40
|
emitImports(file, component);
|
|
52
41
|
emitTypes(file, component);
|
|
53
|
-
var
|
|
54
|
-
var isLightComponent = ((_c = (_b =
|
|
55
|
-
var imports_1 = (_d =
|
|
42
|
+
var metadata = component.meta.useMetadata || {};
|
|
43
|
+
var isLightComponent = ((_c = (_b = metadata === null || metadata === void 0 ? void 0 : metadata.qwik) === null || _b === void 0 ? void 0 : _b.component) === null || _c === void 0 ? void 0 : _c.isLight) || false;
|
|
44
|
+
var imports_1 = (_d = metadata === null || metadata === void 0 ? void 0 : metadata.qwik) === null || _d === void 0 ? void 0 : _d.imports;
|
|
56
45
|
imports_1 && Object.keys(imports_1).forEach(function (key) { return file.import(imports_1[key], key); });
|
|
57
|
-
var state_2 = emitStateMethodsAndRewriteBindings(file, component,
|
|
46
|
+
var state_2 = emitStateMethodsAndRewriteBindings(file, component, metadata);
|
|
58
47
|
var hasState_1 = (0, state_1.checkHasState)(component);
|
|
59
48
|
var css_1 = null;
|
|
60
|
-
var topLevelElement_1 = isLightComponent ? null : getTopLevelElement(component);
|
|
61
49
|
var componentBody = (0, src_generator_1.arrowFnBlock)(['props'], [
|
|
62
50
|
function () {
|
|
63
|
-
var _a, _b;
|
|
64
|
-
if ((_b = (_a = metadata_1 === null || metadata_1 === void 0 ? void 0 : metadata_1.qwik) === null || _a === void 0 ? void 0 : _a.component) === null || _b === void 0 ? void 0 : _b.useHostElement)
|
|
65
|
-
emitUseHostElement(file);
|
|
66
51
|
css_1 = emitUseStyles(file, component);
|
|
67
52
|
emitUseContext(file, component);
|
|
68
53
|
emitUseRef(file, component);
|
|
@@ -72,14 +57,12 @@ var componentToQwik = function (userOptions) {
|
|
|
72
57
|
emitUseWatch(file, component);
|
|
73
58
|
emitUseCleanup(file, component);
|
|
74
59
|
emitTagNameHack(file, component);
|
|
75
|
-
emitJSX(file, component
|
|
60
|
+
emitJSX(file, component);
|
|
76
61
|
},
|
|
77
62
|
], [component.propsTypeRef || 'any']);
|
|
78
63
|
file.src.const(component.name, isLightComponent
|
|
79
64
|
? componentBody
|
|
80
|
-
: (0, src_generator_1.invoke)(file.import(file.qwikModule, 'component$'),
|
|
81
|
-
componentBody
|
|
82
|
-
], (topLevelElement_1 ? ["{tagName:\"".concat(topLevelElement_1, "\"}")] : []), true)), true, true);
|
|
65
|
+
: (0, src_generator_1.invoke)(file.import(file.qwikModule, 'component$'), [componentBody]), true, true);
|
|
83
66
|
file.exportDefault(component.name);
|
|
84
67
|
emitStyles(file, css_1);
|
|
85
68
|
DEBUG && file.exportConst('COMPONENT', JSON.stringify(component, null, 2));
|
|
@@ -136,17 +119,11 @@ function emitUseCleanup(file, component) {
|
|
|
136
119
|
file.src.emit(file.import(file.qwikModule, 'useCleanup$').localName, '(()=>{', code, '});');
|
|
137
120
|
}
|
|
138
121
|
}
|
|
139
|
-
function emitJSX(file, component
|
|
122
|
+
function emitJSX(file, component) {
|
|
140
123
|
var directives = new Map();
|
|
141
124
|
var handlers = new Map();
|
|
142
125
|
var styles = new Map();
|
|
143
126
|
var parentSymbolBindings = {};
|
|
144
|
-
var children = component.children;
|
|
145
|
-
if (topLevelElement && children.length == 1) {
|
|
146
|
-
var child = children[0];
|
|
147
|
-
children[0] = __assign(__assign({}, child), { name: 'Host' });
|
|
148
|
-
file.import(file.qwikModule, 'Host');
|
|
149
|
-
}
|
|
150
127
|
file.src.emit('return ', (0, jsx_1.renderJSXNodes)(file, directives, handlers, component.children, styles, parentSymbolBindings));
|
|
151
128
|
}
|
|
152
129
|
function emitUseContextProvider(file, component) {
|
|
@@ -326,28 +303,3 @@ function stateToMethodOrGetter(state) {
|
|
|
326
303
|
});
|
|
327
304
|
return methodMap;
|
|
328
305
|
}
|
|
329
|
-
/**
|
|
330
|
-
* Return a top-level element for the component.
|
|
331
|
-
*
|
|
332
|
-
* WHAT: If the component has a single root element, then this returns the element name.
|
|
333
|
-
*
|
|
334
|
-
* WHY: This is useful to pull the root element into the component's host and thus saving unnecessary wrapping.
|
|
335
|
-
*
|
|
336
|
-
* @param component
|
|
337
|
-
*/
|
|
338
|
-
function getTopLevelElement(component) {
|
|
339
|
-
var _a;
|
|
340
|
-
if (((_a = component.children) === null || _a === void 0 ? void 0 : _a.length) === 1) {
|
|
341
|
-
var child = component.children[0];
|
|
342
|
-
if (child['@type'] === '@builder.io/mitosis/node' && startsLowerCase(child.name)) {
|
|
343
|
-
return child.name;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
return null;
|
|
347
|
-
}
|
|
348
|
-
function startsLowerCase(name) {
|
|
349
|
-
return name.length > 0 && name[0].toLowerCase() === name[0];
|
|
350
|
-
}
|
|
351
|
-
function emitUseHostElement(file) {
|
|
352
|
-
file.src.emit('const hostElement=', file.import(file.qwikModule, 'useHostElement').localName, '();');
|
|
353
|
-
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as babel from '@babel/core';
|
|
2
2
|
import { Context } from './types';
|
|
3
3
|
export declare const getPropsTypeRef: (node: babel.types.FunctionDeclaration) => string | undefined;
|
|
4
|
+
export declare const isTypeImport: (node: babel.Node) => boolean;
|
|
4
5
|
export declare const isTypeOrInterface: (node: babel.Node) => boolean;
|
|
5
6
|
export declare const collectTypes: (node: babel.Node, context: Context) => void;
|
|
6
7
|
export declare const collectInterfaces: (node: babel.Node, context: Context) => void;
|
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.collectInterfaces = exports.collectTypes = exports.isTypeOrInterface = exports.getPropsTypeRef = void 0;
|
|
29
|
+
exports.collectInterfaces = exports.collectTypes = exports.isTypeOrInterface = exports.isTypeImport = exports.getPropsTypeRef = void 0;
|
|
30
30
|
var babel = __importStar(require("@babel/core"));
|
|
31
31
|
var generator_1 = __importDefault(require("@babel/generator"));
|
|
32
32
|
var types = babel.types;
|
|
@@ -46,6 +46,14 @@ var getPropsTypeRef = function (node) {
|
|
|
46
46
|
return undefined;
|
|
47
47
|
};
|
|
48
48
|
exports.getPropsTypeRef = getPropsTypeRef;
|
|
49
|
+
var isTypeImport = function (node) {
|
|
50
|
+
var _a;
|
|
51
|
+
return types.isImportDeclaration(node) &&
|
|
52
|
+
node.importKind === 'type' &&
|
|
53
|
+
// Babel adds an implicit JSX type import that we don't want
|
|
54
|
+
((_a = node.specifiers[0]) === null || _a === void 0 ? void 0 : _a.local.name) !== 'JSX';
|
|
55
|
+
};
|
|
56
|
+
exports.isTypeImport = isTypeImport;
|
|
49
57
|
var isTypeOrInterface = function (node) {
|
|
50
58
|
return types.isTSTypeAliasDeclaration(node) ||
|
|
51
59
|
types.isTSInterfaceDeclaration(node) ||
|
|
@@ -506,6 +506,12 @@ function parseJsx(jsx, options) {
|
|
|
506
506
|
component: (0, create_mitosis_component_1.createMitosisComponent)(),
|
|
507
507
|
};
|
|
508
508
|
var keepStatements = path.node.body.filter(function (statement) { return isImportOrDefaultExport(statement) || (0, component_types_1.isTypeOrInterface)(statement); });
|
|
509
|
+
for (var _i = 0, _a = path.node.body; _i < _a.length; _i++) {
|
|
510
|
+
var statement = _a[_i];
|
|
511
|
+
if ((0, component_types_1.isTypeImport)(statement)) {
|
|
512
|
+
(0, component_types_1.collectTypes)(statement, context);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
509
515
|
var exportsOrLocalVariables = path.node.body.filter(function (statement) {
|
|
510
516
|
return !isImportOrDefaultExport(statement) &&
|
|
511
517
|
!(0, component_types_1.isTypeOrInterface)(statement) &&
|
|
File without changes
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Fragment,
|
|
3
|
+
h,
|
|
4
|
+
qrl,
|
|
5
|
+
useStore,
|
|
6
|
+
withScopedStylesQrl,
|
|
7
|
+
} from "@builder.io/qwik";
|
|
8
|
+
export const MyComponent_styles = `.csw5022{display:flex;flex-direction:column;position:relative;flex-shrink:0;box-sizing:border-box;margin-top:20px;align-items:stretch}.csanagh{margin-top:10px;position:relative;display:flex;align-items:stretch;flex-direction:column;padding-bottom:10px}.c4qyc1p{position:relative;display:flex;align-items:stretch;flex-direction:column;margin-top:10px;padding-bottom:10px}.crwdrpw{text-align:left;display:flex;flex-direction:column}.ctcw2m4{padding-top:50px;text-align:left;display:flex;flex-direction:column;padding-bottom:50px}`;
|
|
9
|
+
export const MyComponent_onMount = (props) => {
|
|
10
|
+
const state = useStore(() => {
|
|
11
|
+
const state = Object.assign(
|
|
12
|
+
{},
|
|
13
|
+
props,
|
|
14
|
+
typeof __STATE__ === "object" ? __STATE__[props.serverStateId] : undefined
|
|
15
|
+
);
|
|
16
|
+
return state;
|
|
17
|
+
});
|
|
18
|
+
withScopedStylesQrl(qrl("./low.js", "MyComponent_styles", []));
|
|
19
|
+
return (
|
|
20
|
+
<div
|
|
21
|
+
builder-id="builder-bb2f62792e464d73b7cb89258027f356"
|
|
22
|
+
gridRowWidth="25%"
|
|
23
|
+
class="csw5022 builder-block"
|
|
24
|
+
items={[
|
|
25
|
+
{
|
|
26
|
+
title: [
|
|
27
|
+
{
|
|
28
|
+
"@type": "@builder.io/sdk:Element",
|
|
29
|
+
"@version": 2,
|
|
30
|
+
layerName: "Accordion item title",
|
|
31
|
+
id: "builder-5fed2723c1cc4fb39e9d22b9c54ef179",
|
|
32
|
+
children: [
|
|
33
|
+
{
|
|
34
|
+
"@type": "@builder.io/sdk:Element",
|
|
35
|
+
"@version": 2,
|
|
36
|
+
id: "builder-2cad86b387ec405d82917895d7af0a12",
|
|
37
|
+
component: {
|
|
38
|
+
name: "Text",
|
|
39
|
+
options: { text: "<p>Item 1</p>" },
|
|
40
|
+
},
|
|
41
|
+
responsiveStyles: {
|
|
42
|
+
large: {
|
|
43
|
+
textAlign: "left",
|
|
44
|
+
display: "flex",
|
|
45
|
+
flexDirection: "column",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
responsiveStyles: {
|
|
51
|
+
large: {
|
|
52
|
+
marginTop: "10px",
|
|
53
|
+
position: "relative",
|
|
54
|
+
display: "flex",
|
|
55
|
+
alignItems: "stretch",
|
|
56
|
+
flexDirection: "column",
|
|
57
|
+
paddingBottom: "10px",
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
detail: [
|
|
63
|
+
{
|
|
64
|
+
"@type": "@builder.io/sdk:Element",
|
|
65
|
+
"@version": 2,
|
|
66
|
+
layerName: "Accordion item detail",
|
|
67
|
+
id: "builder-18279a99b32240f19aa21d3f4b015cc9",
|
|
68
|
+
children: [
|
|
69
|
+
{
|
|
70
|
+
"@type": "@builder.io/sdk:Element",
|
|
71
|
+
"@version": 2,
|
|
72
|
+
id: "builder-2dbfa56b8988461c8566bbe759580e9b",
|
|
73
|
+
component: {
|
|
74
|
+
name: "Text",
|
|
75
|
+
options: { text: "<p>Item 1 content</p>" },
|
|
76
|
+
},
|
|
77
|
+
responsiveStyles: {
|
|
78
|
+
large: {
|
|
79
|
+
paddingTop: "50px",
|
|
80
|
+
textAlign: "left",
|
|
81
|
+
display: "flex",
|
|
82
|
+
flexDirection: "column",
|
|
83
|
+
paddingBottom: "50px",
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
responsiveStyles: {
|
|
89
|
+
large: {
|
|
90
|
+
position: "relative",
|
|
91
|
+
display: "flex",
|
|
92
|
+
alignItems: "stretch",
|
|
93
|
+
flexDirection: "column",
|
|
94
|
+
marginTop: "10px",
|
|
95
|
+
paddingBottom: "10px",
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
title: [
|
|
103
|
+
{
|
|
104
|
+
"@type": "@builder.io/sdk:Element",
|
|
105
|
+
"@version": 2,
|
|
106
|
+
layerName: "Accordion item title",
|
|
107
|
+
id: "builder-2a93def22a354cf7aa193c20d1ad6def",
|
|
108
|
+
children: [
|
|
109
|
+
{
|
|
110
|
+
"@type": "@builder.io/sdk:Element",
|
|
111
|
+
"@version": 2,
|
|
112
|
+
id: "builder-1365fc457ece45db82ad90dbe9819e7c",
|
|
113
|
+
component: {
|
|
114
|
+
name: "Text",
|
|
115
|
+
options: { text: "<p>Item 2</p>" },
|
|
116
|
+
},
|
|
117
|
+
responsiveStyles: {
|
|
118
|
+
large: {
|
|
119
|
+
textAlign: "left",
|
|
120
|
+
display: "flex",
|
|
121
|
+
flexDirection: "column",
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
responsiveStyles: {
|
|
127
|
+
large: {
|
|
128
|
+
marginTop: "10px",
|
|
129
|
+
position: "relative",
|
|
130
|
+
display: "flex",
|
|
131
|
+
alignItems: "stretch",
|
|
132
|
+
flexDirection: "column",
|
|
133
|
+
paddingBottom: "10px",
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
detail: [
|
|
139
|
+
{
|
|
140
|
+
"@type": "@builder.io/sdk:Element",
|
|
141
|
+
"@version": 2,
|
|
142
|
+
layerName: "Accordion item detail",
|
|
143
|
+
id: "builder-fd6ef41da6d040328fbd8b0801611fe5",
|
|
144
|
+
children: [
|
|
145
|
+
{
|
|
146
|
+
"@type": "@builder.io/sdk:Element",
|
|
147
|
+
"@version": 2,
|
|
148
|
+
id: "builder-7362f9fd64c647c5a400d9e75c74473f",
|
|
149
|
+
component: {
|
|
150
|
+
name: "Text",
|
|
151
|
+
options: { text: "<p>Item 2 content</p>" },
|
|
152
|
+
},
|
|
153
|
+
responsiveStyles: {
|
|
154
|
+
large: {
|
|
155
|
+
paddingTop: "50px",
|
|
156
|
+
textAlign: "left",
|
|
157
|
+
display: "flex",
|
|
158
|
+
flexDirection: "column",
|
|
159
|
+
paddingBottom: "50px",
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
responsiveStyles: {
|
|
165
|
+
large: {
|
|
166
|
+
position: "relative",
|
|
167
|
+
display: "flex",
|
|
168
|
+
alignItems: "stretch",
|
|
169
|
+
flexDirection: "column",
|
|
170
|
+
marginTop: "10px",
|
|
171
|
+
paddingBottom: "10px",
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
},
|
|
177
|
+
]}
|
|
178
|
+
animate={true}
|
|
179
|
+
>
|
|
180
|
+
<div>
|
|
181
|
+
<div builder="accordion">
|
|
182
|
+
<div builder="accordion-title">
|
|
183
|
+
<div
|
|
184
|
+
builder-id="builder-5fed2723c1cc4fb39e9d22b9c54ef179"
|
|
185
|
+
class="csanagh"
|
|
186
|
+
>
|
|
187
|
+
<div class="crwdrpw">
|
|
188
|
+
<div
|
|
189
|
+
dangerouslySetInnerHTML="<p>Item 1</p>"
|
|
190
|
+
class="builder-text"
|
|
191
|
+
></div>
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
</div>
|
|
195
|
+
<div builder="accordion-detail">
|
|
196
|
+
<div
|
|
197
|
+
builder-id="builder-18279a99b32240f19aa21d3f4b015cc9"
|
|
198
|
+
class="c4qyc1p"
|
|
199
|
+
>
|
|
200
|
+
<div class="ctcw2m4">
|
|
201
|
+
<div
|
|
202
|
+
dangerouslySetInnerHTML="<p>Item 1 content</p>"
|
|
203
|
+
class="builder-text"
|
|
204
|
+
></div>
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
</div>
|
|
209
|
+
<div builder="accordion">
|
|
210
|
+
<div builder="accordion-title">
|
|
211
|
+
<div
|
|
212
|
+
builder-id="builder-2a93def22a354cf7aa193c20d1ad6def"
|
|
213
|
+
class="csanagh"
|
|
214
|
+
>
|
|
215
|
+
<div class="crwdrpw">
|
|
216
|
+
<div
|
|
217
|
+
dangerouslySetInnerHTML="<p>Item 2</p>"
|
|
218
|
+
class="builder-text"
|
|
219
|
+
></div>
|
|
220
|
+
</div>
|
|
221
|
+
</div>
|
|
222
|
+
</div>
|
|
223
|
+
<div builder="accordion-detail">
|
|
224
|
+
<div
|
|
225
|
+
builder-id="builder-fd6ef41da6d040328fbd8b0801611fe5"
|
|
226
|
+
class="c4qyc1p"
|
|
227
|
+
>
|
|
228
|
+
<div class="ctcw2m4">
|
|
229
|
+
<div
|
|
230
|
+
dangerouslySetInnerHTML="<p>Item 2 content</p>"
|
|
231
|
+
class="builder-text"
|
|
232
|
+
></div>
|
|
233
|
+
</div>
|
|
234
|
+
</div>
|
|
235
|
+
</div>
|
|
236
|
+
</div>
|
|
237
|
+
</div>
|
|
238
|
+
</div>
|
|
239
|
+
);
|
|
240
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Fragment,
|
|
3
|
+
h,
|
|
4
|
+
qrl,
|
|
5
|
+
useStore,
|
|
6
|
+
withScopedStylesQrl,
|
|
7
|
+
} from "@builder.io/qwik";
|
|
8
|
+
export const MyComponent_styles = `.cvdfnp5{display:flex;flex-direction:column;position:relative;flex-shrink:0;box-sizing:border-box;margin-top:0px;padding-left:20px;padding-right:20px;padding-top:50px;padding-bottom:50px;width:100vw;margin-left:calc(50% - 50vw)}.cz5wnof{width:100%;align-self:stretch;flex-grow:1;box-sizing:border-box;max-width:1200px;display:flex;flex-direction:column;align-items:stretch;margin-left:auto;margin-right:auto}.cdrk993{text-align:center}`;
|
|
9
|
+
export const MyComponent_onMount = (props) => {
|
|
10
|
+
const state = useStore(() => {
|
|
11
|
+
const state = Object.assign(
|
|
12
|
+
{},
|
|
13
|
+
props,
|
|
14
|
+
typeof __STATE__ === "object" ? __STATE__[props.serverStateId] : undefined
|
|
15
|
+
);
|
|
16
|
+
return state;
|
|
17
|
+
});
|
|
18
|
+
withScopedStylesQrl(qrl("./low.js", "MyComponent_styles", []));
|
|
19
|
+
return (
|
|
20
|
+
<div
|
|
21
|
+
builder-id="builder-a58a66676d9b4ecc826c1b8bc5ad91f1"
|
|
22
|
+
class="cvdfnp5 builder-block"
|
|
23
|
+
maxWidth={1200}
|
|
24
|
+
>
|
|
25
|
+
<section
|
|
26
|
+
builder-id="builder-a58a66676d9b4ecc826c1b8bc5ad91f1"
|
|
27
|
+
class="cz5wnof"
|
|
28
|
+
>
|
|
29
|
+
{(state.simpleList.results || []).map((item) => {
|
|
30
|
+
var state = Object.assign({}, this, {
|
|
31
|
+
resultsItem: item == null ? {} : item,
|
|
32
|
+
});
|
|
33
|
+
return (
|
|
34
|
+
<div class="cdrk993">
|
|
35
|
+
<div
|
|
36
|
+
class="builder-text"
|
|
37
|
+
dangerouslySetInnerHTML={(() => {
|
|
38
|
+
try {
|
|
39
|
+
var _virtual_index = state.resultsItem.data.title;
|
|
40
|
+
return _virtual_index;
|
|
41
|
+
} catch (err) {
|
|
42
|
+
console.warn("Builder code error", err);
|
|
43
|
+
}
|
|
44
|
+
})()}
|
|
45
|
+
></div>
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
})}
|
|
49
|
+
</section>
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Fragment,
|
|
3
|
+
componentQrl,
|
|
4
|
+
h,
|
|
5
|
+
qrl,
|
|
6
|
+
useStore,
|
|
7
|
+
withScopedStylesQrl,
|
|
8
|
+
} from "@builder.io/qwik";
|
|
9
|
+
export const MyComponent_styles = `.cvk52jt{display:flex;flex-direction:column;position:relative;flex-shrink:0;box-sizing:border-box;margin-top:20px;min-height:20px;min-width:20px;overflow:hidden}.cjrqfb1{display:flex;flex-direction:column;position:relative;flex-shrink:0;box-sizing:border-box;margin-top:20px;line-height:normal;height:auto;text-align:center}`;
|
|
10
|
+
export const MyComponent_onMount = (props) => {
|
|
11
|
+
const state = useStore(() => {
|
|
12
|
+
const state = Object.assign(
|
|
13
|
+
{},
|
|
14
|
+
props,
|
|
15
|
+
typeof __STATE__ === "object" ? __STATE__[props.serverStateId] : undefined
|
|
16
|
+
);
|
|
17
|
+
if (!state.hasOwnProperty("myState")) state.myState = "initialValue";
|
|
18
|
+
return state;
|
|
19
|
+
});
|
|
20
|
+
withScopedStylesQrl(qrl("./med.js", "MyComponent_styles", []));
|
|
21
|
+
return h(
|
|
22
|
+
Fragment,
|
|
23
|
+
null,
|
|
24
|
+
h(Image, {
|
|
25
|
+
"builder-id": "builder-fa4480d2f48a44a7a2e98cf07c54927b",
|
|
26
|
+
image:
|
|
27
|
+
"https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=1160",
|
|
28
|
+
backgroundSize: "cover",
|
|
29
|
+
backgroundPosition: "center",
|
|
30
|
+
srcset:
|
|
31
|
+
"https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=100 100w, https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=200 200w, https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=400 400w, https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=800 800w, https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=1200 1200w, https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=1600 1600w, https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=2000 2000w, https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=1160 1160w, https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=598 598w, https://cdn.builder.io/api/v1/image/assets%2F23dfd7cef1104af59f281d58ec525923%2F4ecf7b7554464b0183ab8250f67e797b?width=958 958w",
|
|
32
|
+
sizes: "(max-width: 638px) 94vw, (max-width: 998px) 96vw, 83vw",
|
|
33
|
+
class: "cvk52jt builder-block",
|
|
34
|
+
onClick$: qrl("./high.js", "MyComponent_onClick_0", [state]),
|
|
35
|
+
lazy: false,
|
|
36
|
+
fitContent: true,
|
|
37
|
+
aspectRatio: 1,
|
|
38
|
+
height: 1300,
|
|
39
|
+
width: 1300,
|
|
40
|
+
}),
|
|
41
|
+
h(
|
|
42
|
+
"div",
|
|
43
|
+
{ class: "cjrqfb1" },
|
|
44
|
+
h("div", {
|
|
45
|
+
class: "builder-text",
|
|
46
|
+
dangerouslySetInnerHTML: (() => {
|
|
47
|
+
try {
|
|
48
|
+
var _virtual_index = state.myState;
|
|
49
|
+
return _virtual_index;
|
|
50
|
+
} catch (err) {
|
|
51
|
+
console.warn("Builder code error", err);
|
|
52
|
+
}
|
|
53
|
+
})(),
|
|
54
|
+
})
|
|
55
|
+
)
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
export const MyComponent = componentQrl(
|
|
59
|
+
qrl("./med.js", "MyComponent_onMount", [])
|
|
60
|
+
);
|
|
61
|
+
export const Image = function Image(props) {
|
|
62
|
+
var _a;
|
|
63
|
+
var jsx = props.children || [];
|
|
64
|
+
var image = props.image;
|
|
65
|
+
if (image) {
|
|
66
|
+
var isBuilderIoImage = !!(image || "").match(/\.builder\.io/);
|
|
67
|
+
var isPixel =
|
|
68
|
+
(_a = props.builderBlock) === null || _a === void 0
|
|
69
|
+
? void 0
|
|
70
|
+
: _a.id.startsWith("builder-pixel-");
|
|
71
|
+
var imgProps = {
|
|
72
|
+
src: props.image,
|
|
73
|
+
style:
|
|
74
|
+
"object-fit:"
|
|
75
|
+
.concat(props.backgroundSize || "cover", ";object-position:")
|
|
76
|
+
.concat(props.backgroundPosition || "center", ";") +
|
|
77
|
+
(props.aspectRatio
|
|
78
|
+
? "position:absolute;height:100%;width:100%;top:0;left:0"
|
|
79
|
+
: ""),
|
|
80
|
+
sizes: props.sizes,
|
|
81
|
+
alt: props.altText,
|
|
82
|
+
role: !props.altText ? "presentation" : undefined,
|
|
83
|
+
loading: isPixel ? "eager" : "lazy",
|
|
84
|
+
srcset: undefined,
|
|
85
|
+
};
|
|
86
|
+
if (isBuilderIoImage) {
|
|
87
|
+
var webpImage_1 = updateQueryParam(image, "format", "webp");
|
|
88
|
+
var srcset = ["100", "200", "400", "800", "1200", "1600", "2000"]
|
|
89
|
+
.concat(props.srcsetSizes ? String(props.srcsetSizes).split(" ") : [])
|
|
90
|
+
.map(function (size) {
|
|
91
|
+
return (
|
|
92
|
+
updateQueryParam(webpImage_1, "width", size) + " " + size + "w"
|
|
93
|
+
);
|
|
94
|
+
})
|
|
95
|
+
.concat([image])
|
|
96
|
+
.join(",");
|
|
97
|
+
imgProps.srcset = srcset;
|
|
98
|
+
jsx = jsx = [
|
|
99
|
+
h("picture", {}, [
|
|
100
|
+
h("source", { type: "image/webp", srcset: srcset }),
|
|
101
|
+
h("img", imgProps, jsx),
|
|
102
|
+
]),
|
|
103
|
+
];
|
|
104
|
+
} else {
|
|
105
|
+
jsx = [h("img", imgProps, jsx)];
|
|
106
|
+
}
|
|
107
|
+
if (
|
|
108
|
+
props.aspectRatio &&
|
|
109
|
+
!(props.fitContent && props.children && props.children.length)
|
|
110
|
+
) {
|
|
111
|
+
var sizingDiv = h("div", {
|
|
112
|
+
class: "builder-image-sizer",
|
|
113
|
+
style: "width:100%;padding-top:".concat(
|
|
114
|
+
(props.aspectRatio || 1) * 100,
|
|
115
|
+
"%;pointer-events:none;font-size:0"
|
|
116
|
+
),
|
|
117
|
+
});
|
|
118
|
+
jsx.push(sizingDiv);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
var children = props.children ? [jsx].concat(props.children) : [jsx];
|
|
122
|
+
return h(
|
|
123
|
+
props.href ? "a" : "div",
|
|
124
|
+
__passThroughProps__({ href: props.href, class: props.class }, props),
|
|
125
|
+
children
|
|
126
|
+
);
|
|
127
|
+
function updateQueryParam(uri, key, value) {
|
|
128
|
+
if (uri === void 0) {
|
|
129
|
+
uri = "";
|
|
130
|
+
}
|
|
131
|
+
var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
|
|
132
|
+
var separator = uri.indexOf("?") !== -1 ? "&" : "?";
|
|
133
|
+
if (uri.match(re)) {
|
|
134
|
+
return uri.replace(
|
|
135
|
+
re,
|
|
136
|
+
"$1" + key + "=" + encodeURIComponent(value) + "$2"
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
return uri + separator + key + "=" + encodeURIComponent(value);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
export const __passThroughProps__ = function __passThroughProps__(
|
|
143
|
+
dstProps,
|
|
144
|
+
srcProps
|
|
145
|
+
) {
|
|
146
|
+
for (var key in srcProps) {
|
|
147
|
+
if (
|
|
148
|
+
Object.prototype.hasOwnProperty.call(srcProps, key) &&
|
|
149
|
+
((key.startsWith("on") && key.endsWith("$")) || key == "style")
|
|
150
|
+
) {
|
|
151
|
+
dstProps[key] = srcProps[key];
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return dstProps;
|
|
155
|
+
};
|