@builder.io/mitosis 0.0.56-13 → 0.0.56-16
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__/angular.test.js +2 -104
- package/dist/src/__tests__/builder.test.js +3 -3
- package/dist/src/__tests__/data/basic-child-component.raw.jsx +1 -2
- package/dist/src/__tests__/data/basic-context.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-context.raw.jsx +29 -0
- package/dist/src/__tests__/data/basic-custom-mitosis-package.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-custom-mitosis-package.raw.jsx +10 -0
- package/dist/src/__tests__/data/basic-for-show.raw.jsx +2 -3
- package/dist/src/__tests__/data/basic-for.raw.jsx +2 -3
- package/dist/src/__tests__/data/basic-forwardRef-metadata.raw.d.ts +5 -0
- package/dist/src/__tests__/data/basic-forwardRef-metadata.raw.jsx +17 -0
- package/dist/src/__tests__/data/basic-forwardRef.raw.d.ts +5 -0
- package/dist/src/__tests__/data/basic-forwardRef.raw.jsx +14 -0
- package/dist/src/__tests__/data/basic-onChange.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-onChange.raw.jsx +17 -0
- package/dist/src/__tests__/data/basic-onMount-update.raw.jsx +1 -1
- package/dist/src/__tests__/data/basic-onUpdate-return.raw.d.ts +1 -0
- package/dist/src/__tests__/data/basic-onUpdate-return.raw.jsx +24 -0
- package/dist/src/__tests__/data/basic-outputs-meta.raw.jsx +1 -1
- package/dist/src/__tests__/data/basic-outputs.raw.jsx +1 -1
- package/dist/src/__tests__/data/basic-preserve-export-or-local-statement.raw.d.ts +6 -0
- package/dist/src/__tests__/data/basic-preserve-export-or-local-statement.raw.jsx +14 -0
- package/dist/src/__tests__/data/basic-props-destructure.raw.d.ts +6 -0
- package/dist/src/__tests__/data/basic-props-destructure.raw.jsx +14 -0
- package/dist/src/__tests__/data/basic-props.raw.d.ts +6 -0
- package/dist/src/__tests__/data/basic-props.raw.jsx +13 -0
- package/dist/src/__tests__/data/basic-ref-assignment.raw.d.ts +4 -0
- package/dist/src/__tests__/data/basic-ref-assignment.raw.jsx +15 -0
- package/dist/src/__tests__/data/basic-ref-usePrevious.raw.d.ts +5 -0
- package/dist/src/__tests__/data/basic-ref-usePrevious.raw.jsx +35 -0
- package/dist/src/__tests__/data/basic-ref.raw.d.ts +4 -0
- package/dist/src/__tests__/data/basic-ref.raw.jsx +36 -0
- package/dist/src/__tests__/data/basic.raw.d.ts +6 -1
- package/dist/src/__tests__/data/basic.raw.jsx +10 -3
- package/dist/src/__tests__/data/blocks/classname-jsx.raw.jsx +1 -1
- package/dist/src/__tests__/data/blocks/columns.raw.jsx +1 -1
- package/dist/src/__tests__/data/blocks/custom-code.raw.jsx +3 -7
- package/dist/src/__tests__/data/blocks/embed.raw.jsx +3 -7
- package/dist/src/__tests__/data/blocks/form.raw.jsx +3 -3
- package/dist/src/__tests__/data/blocks/image.raw.jsx +8 -9
- package/dist/src/__tests__/data/blocks/img-state.raw.jsx +1 -1
- package/dist/src/__tests__/data/blocks/input.raw.jsx +1 -3
- package/dist/src/__tests__/data/blocks/multiple-onUpdateWithDeps.raw.jsx +7 -1
- package/dist/src/__tests__/data/blocks/onInit.raw.d.ts +8 -1
- package/dist/src/__tests__/data/blocks/onInit.raw.jsx +13 -3
- package/dist/src/__tests__/data/blocks/onUpdateWithDeps.raw.jsx +1 -1
- package/dist/src/__tests__/data/blocks/section-state.raw.jsx +1 -1
- package/dist/src/__tests__/data/blocks/select.raw.jsx +1 -3
- package/dist/src/__tests__/data/blocks/shadow-dom.raw.jsx +2 -4
- package/dist/src/__tests__/data/blocks/stamped-io.raw.jsx +2 -4
- package/dist/src/__tests__/data/blocks/text.raw.jsx +2 -5
- package/dist/src/__tests__/data/styles/class-and-className.raw.jsx +1 -3
- package/dist/src/__tests__/data/styles/className.raw.jsx +1 -3
- package/dist/src/__tests__/data/styles/classState.raw.d.ts +1 -0
- package/dist/src/__tests__/data/styles/classState.raw.jsx +12 -0
- package/dist/src/__tests__/data/types/component-props-interface.raw.d.ts +6 -0
- package/dist/src/__tests__/data/types/component-props-interface.raw.jsx +6 -0
- package/dist/src/__tests__/data/types/component-props-type.raw.d.ts +6 -0
- package/dist/src/__tests__/data/types/component-props-type.raw.jsx +6 -0
- package/dist/src/__tests__/data/types/preserve-typing.raw.d.ts +8 -0
- package/dist/src/__tests__/data/types/preserve-typing.raw.jsx +6 -0
- package/dist/src/__tests__/html.test.js +2 -145
- package/dist/src/__tests__/liquid.test.js +2 -109
- package/dist/src/__tests__/parse-jsx.test.js +22 -0
- package/dist/src/__tests__/qwik/convertMethodToFunction.test.d.ts +1 -0
- package/dist/src/__tests__/qwik/convertMethodToFunction.test.js +34 -0
- package/dist/src/__tests__/qwik/src-generator.test.d.ts +1 -0
- package/dist/src/__tests__/qwik/src-generator.test.js +65 -0
- package/dist/src/__tests__/qwik.test.js +44 -21
- package/dist/src/__tests__/react-native.test.js +2 -135
- package/dist/src/__tests__/react.test.js +5 -177
- package/dist/src/__tests__/shared.d.ts +3 -0
- package/dist/src/__tests__/shared.js +224 -0
- package/dist/src/__tests__/solid.test.js +2 -103
- package/dist/src/__tests__/stencil.test.js +3 -98
- package/dist/src/__tests__/styles.test.js +9 -1
- package/dist/src/__tests__/svelte.test.js +6 -0
- package/dist/src/__tests__/vue.test.js +2 -134
- package/dist/src/__tests__/webcomponent.test.js +6 -165
- package/dist/src/constants/hooks.d.ts +6 -0
- package/dist/src/constants/hooks.js +9 -0
- package/dist/src/generators/angular.d.ts +1 -1
- package/dist/src/generators/angular.js +66 -34
- package/dist/src/generators/builder.d.ts +1 -1
- package/dist/src/generators/builder.js +6 -12
- package/dist/src/generators/context/{react copy.d.ts → qwik.d.ts} +2 -2
- package/dist/src/generators/context/{react copy.js → qwik.js} +4 -5
- package/dist/src/generators/context/svelte.d.ts +1 -1
- package/dist/src/generators/helpers/context.js +1 -2
- package/dist/src/generators/html.d.ts +1 -1
- package/dist/src/generators/html.js +206 -120
- package/dist/src/generators/liquid.d.ts +1 -1
- package/dist/src/generators/liquid.js +6 -14
- package/dist/src/generators/mitosis.d.ts +1 -1
- package/dist/src/generators/mitosis.js +30 -29
- package/dist/src/generators/qwik/component-generator.d.ts +4 -0
- package/dist/src/generators/qwik/component-generator.js +271 -0
- package/dist/src/generators/qwik/component.js +4 -5
- package/dist/src/generators/qwik/convertMethodToFunction.d.ts +1 -0
- package/dist/src/generators/qwik/convertMethodToFunction.js +161 -0
- package/dist/src/generators/qwik/directives.js +20 -18
- package/dist/src/generators/qwik/index.d.ts +3 -1
- package/dist/src/generators/qwik/index.js +3 -1
- package/dist/src/generators/qwik/jsx.js +10 -6
- package/dist/src/generators/qwik/src-generator.d.ts +19 -7
- package/dist/src/generators/qwik/src-generator.js +149 -31
- package/dist/src/generators/qwik/styles.js +1 -2
- package/dist/src/generators/react-native.d.ts +2 -2
- package/dist/src/generators/react-native.js +3 -6
- package/dist/src/generators/react.d.ts +4 -2
- package/dist/src/generators/react.js +88 -68
- package/dist/src/generators/solid.d.ts +1 -1
- package/dist/src/generators/solid.js +9 -12
- package/dist/src/generators/stencil/generate.d.ts +1 -1
- package/dist/src/generators/stencil/generate.js +5 -11
- package/dist/src/generators/svelte.d.ts +1 -1
- package/dist/src/generators/svelte.js +19 -26
- package/dist/src/generators/swift-ui.d.ts +1 -1
- package/dist/src/generators/swift-ui.js +6 -12
- package/dist/src/generators/template.d.ts +1 -1
- package/dist/src/generators/template.js +6 -14
- package/dist/src/generators/vue.d.ts +12 -6
- package/dist/src/generators/vue.js +62 -31
- package/dist/src/helpers/babel-transform.js +3 -8
- package/dist/src/helpers/create-mitosis-component.d.ts +1 -1
- package/dist/src/helpers/create-mitosis-component.js +1 -1
- package/dist/src/helpers/fast-clone.js +1 -3
- package/dist/src/helpers/filter-empty-text-nodes.js +1 -2
- package/dist/src/helpers/get-bindings.d.ts +2 -0
- package/dist/src/helpers/get-bindings.js +18 -0
- package/dist/src/helpers/get-props-ref.d.ts +2 -0
- package/dist/src/helpers/get-props-ref.js +32 -0
- package/dist/src/helpers/getters-to-functions.d.ts +1 -1
- package/dist/src/helpers/getters-to-functions.js +1 -1
- package/dist/src/helpers/has-bindings-text.d.ts +2 -0
- package/dist/src/helpers/has-bindings-text.js +21 -0
- package/dist/src/helpers/has-stateful-dom.d.ts +2 -0
- package/dist/src/helpers/has-stateful-dom.js +21 -0
- package/dist/src/helpers/is-children.js +1 -2
- package/dist/src/helpers/is-component.js +1 -3
- package/dist/src/helpers/is-html-attribute.d.ts +1 -1
- package/dist/src/helpers/is-html-attribute.js +4 -19
- package/dist/src/helpers/map-refs.js +4 -1
- package/dist/src/helpers/parsers.js +1 -2
- package/dist/src/helpers/render-imports.d.ts +18 -2
- package/dist/src/helpers/render-imports.js +86 -45
- package/dist/src/helpers/render-imports.test.d.ts +1 -0
- package/dist/src/helpers/render-imports.test.js +19 -0
- package/dist/src/helpers/replace-idenifiers.js +2 -5
- package/dist/src/helpers/strip-state-and-props-refs.d.ts +2 -1
- package/dist/src/helpers/strip-state-and-props-refs.js +5 -8
- package/dist/src/helpers/styles/collect-css.d.ts +6 -0
- package/dist/src/helpers/styles/collect-css.js +87 -0
- package/dist/src/helpers/styles/collect-css.test.d.ts +1 -0
- package/dist/src/helpers/styles/collect-css.test.js +18 -0
- package/dist/src/helpers/styles/collect-styled-components.d.ts +2 -0
- package/dist/src/helpers/styles/collect-styled-components.js +61 -0
- package/dist/src/helpers/styles/helpers.d.ts +30 -0
- package/dist/src/helpers/styles/helpers.js +61 -0
- package/dist/src/helpers/typescript.d.ts +2 -0
- package/dist/src/helpers/typescript.js +2 -0
- package/dist/src/index.d.ts +7 -4
- package/dist/src/index.js +24 -8
- package/dist/src/jsx-types.d.ts +1 -0
- package/dist/src/modules/plugins.d.ts +1 -1
- package/dist/src/parsers/angular.js +10 -28
- package/dist/src/parsers/builder.d.ts +23 -23
- package/dist/src/parsers/builder.js +15 -33
- package/dist/src/parsers/jsx.d.ts +2 -1
- package/dist/src/parsers/jsx.js +214 -64
- package/dist/src/parsers/liquid.js +51 -149
- package/dist/src/plugins/compile-away-builder-components.js +4 -10
- package/dist/src/symbols/symbol-processor.js +4 -6
- package/dist/src/targets.d.ts +5 -3
- package/dist/src/targets.js +7 -1
- package/dist/src/types/config.d.ts +37 -17
- package/dist/src/types/mitosis-component.d.ts +30 -10
- package/dist/src/types/transpiler.d.ts +14 -0
- package/dist/src/types/transpiler.js +2 -0
- package/dist/test/qwik/Accordion/low.jsx +1 -0
- package/dist/test/qwik/For/low.jsx +1 -0
- package/dist/test/qwik/Image/med.js +2 -1
- package/dist/test/qwik/Image.slow/med.js +2 -1
- package/dist/test/qwik/bindings/low.cjs +3 -2
- package/dist/test/qwik/button/low.js +1 -0
- package/dist/test/qwik/component/bindings/low.jsx +2 -1
- package/dist/test/qwik/component/component/inputs/med.cjsx +2 -1
- package/dist/test/qwik/for-loop.bindings/high.cjs +0 -0
- package/dist/test/qwik/for-loop.bindings/low.cjs +47 -0
- package/dist/test/qwik/for-loop.bindings/med.cjs +5 -0
- package/dist/test/qwik/hello_world/stylesheet/low.jsx +1 -0
- package/dist/test/qwik/mount/high.cjs +0 -0
- package/dist/test/qwik/mount/low.cjs +44 -0
- package/dist/test/qwik/mount/med.cjs +3 -0
- package/dist/test/qwik/page-with-symbol/low.js +1 -0
- package/dist/test/qwik/show-hide/med.jsx +2 -1
- package/dist/test/qwik/svg/low.js +1 -0
- package/dist/test/qwik/todo/Todo.cjs/med.cjs +1 -0
- package/dist/test/qwik/todo/Todo.js/med.js +1 -0
- package/dist/test/qwik/todo/Todo.tsx/med.tsx +1 -0
- package/dist/test/qwik/todos/Todo.tsx/low.tsx +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -3
- package/README.md +0 -239
- package/dist/src/__tests__/data/blocks/content-slot.raw.d.ts +0 -6
- package/dist/src/__tests__/data/blocks/content-slot.raw.jsx +0 -13
- package/dist/src/__tests__/data/blocks/onUpdate.raw copy.d.ts +0 -1
- package/dist/src/__tests__/data/blocks/onUpdate.raw copy.jsx +0 -10
- package/dist/src/__tests__/data/blocks/slot.raw.d.ts +0 -5
- package/dist/src/__tests__/data/blocks/slot.raw.jsx +0 -6
- package/dist/src/__tests__/data/blocks/styles.raw.d.ts +0 -1
- package/dist/src/__tests__/data/blocks/styles.raw.jsx +0 -10
- package/dist/src/helpers/babel-transform copy.d.ts +0 -8
- package/dist/src/helpers/babel-transform copy.js +0 -138
- package/dist/src/helpers/collect-styles.d.ts +0 -29
- package/dist/src/helpers/collect-styles.js +0 -176
|
@@ -173,9 +173,7 @@ var getConditionalAttr = function (value, noEnd) {
|
|
|
173
173
|
? (_a = statement.match(/context\.(shopify\.)?liquid\.condition\("([^"]*)"/)) === null || _a === void 0 ? void 0 : _a[2]
|
|
174
174
|
: '';
|
|
175
175
|
var index = statement.indexOf('&&');
|
|
176
|
-
var branchValue = index > -1
|
|
177
|
-
? getConditionalAttr(statement.substr(index + 2), true)
|
|
178
|
-
: getValue(statement);
|
|
176
|
+
var branchValue = index > -1 ? getConditionalAttr(statement.substr(index + 2), true) : getValue(statement);
|
|
179
177
|
if (expression) {
|
|
180
178
|
return "{% ".concat(expression, " ").concat(condition, " %} ").concat(branchValue);
|
|
181
179
|
}
|
|
@@ -239,9 +237,7 @@ function blockToLiquid(json, options) {
|
|
|
239
237
|
var bindings = __assign(__assign({}, block.bindings), (_a = block.code) === null || _a === void 0 ? void 0 : _a.bindings);
|
|
240
238
|
var hasInvalidHide = bindings.hide && !(0, liquid_1.isValidLiquidBinding)(bindings.hide);
|
|
241
239
|
var hasInvalidShow = bindings.show && !(0, liquid_1.isValidLiquidBinding)(bindings.show);
|
|
242
|
-
var hasInvalidRepeat = block.repeat &&
|
|
243
|
-
block.repeat.collection &&
|
|
244
|
-
!(0, liquid_1.isValidLiquidBinding)(block.repeat.collection);
|
|
240
|
+
var hasInvalidRepeat = block.repeat && block.repeat.collection && !(0, liquid_1.isValidLiquidBinding)(block.repeat.collection);
|
|
245
241
|
if (hasInvalidHide || hasInvalidShow || hasInvalidRepeat) {
|
|
246
242
|
return '';
|
|
247
243
|
}
|
|
@@ -271,13 +267,10 @@ function blockToLiquid(json, options) {
|
|
|
271
267
|
if (!block.properties) {
|
|
272
268
|
block.properties = {};
|
|
273
269
|
}
|
|
274
|
-
var name_1 = key.startsWith('properties.')
|
|
275
|
-
? key.replace(/^\s*properties\s*\./, '')
|
|
276
|
-
: key;
|
|
270
|
+
var name_1 = key.startsWith('properties.') ? key.replace(/^\s*properties\s*\./, '') : key;
|
|
277
271
|
(0, lodash_1.set)(block.properties, name_1, valueString);
|
|
278
272
|
}
|
|
279
|
-
else if (key.startsWith('component.options.') ||
|
|
280
|
-
key.startsWith('options.')) {
|
|
273
|
+
else if (key.startsWith('component.options.') || key.startsWith('options.')) {
|
|
281
274
|
var name_2 = key.replace(/^.*?options\./, '');
|
|
282
275
|
if (!block.component) {
|
|
283
276
|
continue;
|
|
@@ -329,8 +322,7 @@ function blockToLiquid(json, options) {
|
|
|
329
322
|
if (block.component && !componentInfo) {
|
|
330
323
|
console.warn("Could not find component: ".concat(block.component.name));
|
|
331
324
|
}
|
|
332
|
-
var collectionName = block.repeat &&
|
|
333
|
-
(0, lodash_1.last)((block.repeat.collection || '').trim().split('(')[0].trim().split('.'));
|
|
325
|
+
var collectionName = block.repeat && (0, lodash_1.last)((block.repeat.collection || '').trim().split('(')[0].trim().split('.'));
|
|
334
326
|
if (collectionName) {
|
|
335
327
|
collectionName = convertBinding(collectionName, options);
|
|
336
328
|
}
|
|
@@ -340,16 +332,10 @@ function blockToLiquid(json, options) {
|
|
|
340
332
|
(0, liquid_1.isValidLiquidBinding)(block.repeat.collection)
|
|
341
333
|
? "{% for ".concat(block.repeat.itemName || collectionName + '_item', " in ").concat(convertBinding(block.repeat.collection, options), " %}")
|
|
342
334
|
: '', "\n ").concat(!options.static && bindings.hide
|
|
343
|
-
? "{% unless ".concat(!(0, liquid_1.isValidLiquidBinding)(bindings.hide)
|
|
344
|
-
? 'false'
|
|
345
|
-
: convertBinding(bindings.hide, options), " %}")
|
|
335
|
+
? "{% unless ".concat(!(0, liquid_1.isValidLiquidBinding)(bindings.hide) ? 'false' : convertBinding(bindings.hide, options), " %}")
|
|
346
336
|
: '', "\n ").concat(!options.static && bindings.show
|
|
347
|
-
? "{% if ".concat(!(0, liquid_1.isValidLiquidBinding)(bindings.show)
|
|
348
|
-
|
|
349
|
-
: convertBinding(bindings.show, options), " %}")
|
|
350
|
-
: '', "\n ").concat(!options.static && bindings.hide ? '{% endunless %}' : '', "\n ").concat(!options.static && bindings.show ? '{% endif %}' : '', "\n ").concat(!options.static && block.repeat && block.repeat.collection
|
|
351
|
-
? '{% endfor %}'
|
|
352
|
-
: '', "\n ");
|
|
337
|
+
? "{% if ".concat(!(0, liquid_1.isValidLiquidBinding)(bindings.show) ? 'false' : convertBinding(bindings.show, options), " %}")
|
|
338
|
+
: '', "\n ").concat(!options.static && bindings.hide ? '{% endunless %}' : '', "\n ").concat(!options.static && bindings.show ? '{% endif %}' : '', "\n ").concat(!options.static && block.repeat && block.repeat.collection ? '{% endfor %}' : '', "\n ");
|
|
353
339
|
}
|
|
354
340
|
exports.blockToLiquid = blockToLiquid;
|
|
355
341
|
// TODO: make these core functions and share with react, vue, etc
|
|
@@ -501,14 +487,10 @@ var liquidBindingTemplate = function (str) {
|
|
|
501
487
|
: "liquid.get(\"".concat(str.replace(/\n+/g, ' ').replace(/"/g, '\\"'), "\")");
|
|
502
488
|
};
|
|
503
489
|
var liquidRenderTemplate = function (str) {
|
|
504
|
-
return isSimpleLiquidBinding(str)
|
|
505
|
-
? str
|
|
506
|
-
: "liquid(\"".concat(str.replace(/\n+/g, ' ').replace(/"/g, '\\"'), "\")");
|
|
490
|
+
return isSimpleLiquidBinding(str) ? str : "liquid(\"".concat(str.replace(/\n+/g, ' ').replace(/"/g, '\\"'), "\")");
|
|
507
491
|
};
|
|
508
492
|
var liquidConditionTemplate = function (str) {
|
|
509
|
-
return isSimpleLiquidBinding(str)
|
|
510
|
-
? str
|
|
511
|
-
: "liquid(\"".concat(str.replace(/\n+/g, ' ').replace(/"/g, '\\"'), "\")");
|
|
493
|
+
return isSimpleLiquidBinding(str) ? str : "liquid(\"".concat(str.replace(/\n+/g, ' ').replace(/"/g, '\\"'), "\")");
|
|
512
494
|
};
|
|
513
495
|
var isIfTemplate = function (template) {
|
|
514
496
|
return template.token.type === 'tag' && template.token.name === 'if';
|
|
@@ -531,19 +513,13 @@ var isCaseTemplate = function (template) {
|
|
|
531
513
|
var isOutputTemplate = function (template) {
|
|
532
514
|
return template.token.type === 'output';
|
|
533
515
|
};
|
|
534
|
-
var isElement = function (node) {
|
|
535
|
-
return node.type === 1;
|
|
536
|
-
};
|
|
516
|
+
var isElement = function (node) { return node.type === 1; };
|
|
537
517
|
var isTextNode = function (node) {
|
|
538
518
|
return node.type === 3 || node.type === 2;
|
|
539
519
|
};
|
|
540
520
|
// Custom common HTML symbol encoding so not to confuse with actual encoded HTML
|
|
541
|
-
var htmlEncode = function (html) {
|
|
542
|
-
|
|
543
|
-
};
|
|
544
|
-
var htmlDecode = function (html) {
|
|
545
|
-
return html.replace(/_APOS_/g, "'").replace(/_QUOT_/g, '"');
|
|
546
|
-
};
|
|
521
|
+
var htmlEncode = function (html) { return html.replace(/'/g, '_APOS_').replace(/"/g, '_QUOT_'); };
|
|
522
|
+
var htmlDecode = function (html) { return html.replace(/_APOS_/g, "'").replace(/_QUOT_/g, '"'); };
|
|
547
523
|
var createHtmlAttribute = function (attribute, attributeValue) {
|
|
548
524
|
if (attributeValue === void 0) { attributeValue = null; }
|
|
549
525
|
var encodedValue = '';
|
|
@@ -557,14 +533,10 @@ var parseArgList = function (args) {
|
|
|
557
533
|
return args
|
|
558
534
|
// find all the string arguments (wrapped with ' or "), then replace any commas
|
|
559
535
|
// this allows us to split the args on "," without worrying about breaking any strings
|
|
560
|
-
.replace(/('[^']*'|"[^"]*")/g, function (str) {
|
|
561
|
-
return str.replace(/,/g, COMMA_TOKEN);
|
|
562
|
-
})
|
|
536
|
+
.replace(/('[^']*'|"[^"]*")/g, function (str) { return str.replace(/,/g, COMMA_TOKEN); })
|
|
563
537
|
.split(',')
|
|
564
538
|
// now that we the arg list is broken up, we can re-add the escaped commas to each item
|
|
565
|
-
.map(function (item) {
|
|
566
|
-
return item.replace(new RegExp(COMMA_TOKEN, 'g'), ',').trim();
|
|
567
|
-
});
|
|
539
|
+
.map(function (item) { return item.replace(new RegExp(COMMA_TOKEN, 'g'), ',').trim(); });
|
|
568
540
|
};
|
|
569
541
|
var errorLinesRe = /\((\d*):(\d*)\)/;
|
|
570
542
|
var getErrorInfo = function (message) {
|
|
@@ -576,7 +548,7 @@ var getErrorInfo = function (message) {
|
|
|
576
548
|
};
|
|
577
549
|
var getSubstringTill = function (col, line, str) {
|
|
578
550
|
var lines = str.split('\n');
|
|
579
|
-
return
|
|
551
|
+
return lines.slice(0, line - 1).join('\n') + lines[line - 1].substring(0, col - 1);
|
|
580
552
|
};
|
|
581
553
|
var transpileUnlessToIf = function (unlessTemplate) {
|
|
582
554
|
var cond = unlessTemplate.impl.cond;
|
|
@@ -654,8 +626,7 @@ var parsedLiquidToHtml = function (templates, options) { return __awaiter(void 0
|
|
|
654
626
|
index++;
|
|
655
627
|
return [3 /*break*/, 2];
|
|
656
628
|
case 10:
|
|
657
|
-
if (!(psuedoTemplate.impl.elseTemplates &&
|
|
658
|
-
psuedoTemplate.impl.elseTemplates.length)) return [3 /*break*/, 17];
|
|
629
|
+
if (!(psuedoTemplate.impl.elseTemplates && psuedoTemplate.impl.elseTemplates.length)) return [3 /*break*/, 17];
|
|
659
630
|
html += createHtmlAttribute('else', {
|
|
660
631
|
fullRaw: '{% else %}',
|
|
661
632
|
});
|
|
@@ -821,11 +792,9 @@ var parsedLiquidToHtml = function (templates, options) { return __awaiter(void 0
|
|
|
821
792
|
case 46:
|
|
822
793
|
if (!(name_4 === 'capture')) return [3 /*break*/, 47];
|
|
823
794
|
rawExpression = '';
|
|
824
|
-
for (_s = 0, _t = template.impl
|
|
825
|
-
.templates; _s < _t.length; _s++) {
|
|
795
|
+
for (_s = 0, _t = template.impl.templates; _s < _t.length; _s++) {
|
|
826
796
|
templateToken = _t[_s];
|
|
827
|
-
if (templateToken.name === 'raw' &&
|
|
828
|
-
((_a = templateToken.impl) === null || _a === void 0 ? void 0 : _a.tokens)) {
|
|
797
|
+
if (templateToken.name === 'raw' && ((_a = templateToken.impl) === null || _a === void 0 ? void 0 : _a.tokens)) {
|
|
829
798
|
for (_u = 0, _v = templateToken.impl.tokens; _u < _v.length; _u++) {
|
|
830
799
|
rawToken = _v[_u];
|
|
831
800
|
rawExpression += rawToken.raw;
|
|
@@ -898,10 +867,7 @@ var parsedLiquidToHtml = function (templates, options) { return __awaiter(void 0
|
|
|
898
867
|
return [4 /*yield*/, getShopifyAsset("sections/".concat(path, ".liquid"), options)];
|
|
899
868
|
case 56:
|
|
900
869
|
currentAsset = _10.sent();
|
|
901
|
-
if (!(currentAsset &&
|
|
902
|
-
!(0, lodash_1.isError)(currentAsset) &&
|
|
903
|
-
themeSettings &&
|
|
904
|
-
!(0, lodash_1.isError)(themeSettings))) return [3 /*break*/, 62];
|
|
870
|
+
if (!(currentAsset && !(0, lodash_1.isError)(currentAsset) && themeSettings && !(0, lodash_1.isError)(themeSettings))) return [3 /*break*/, 62];
|
|
905
871
|
schemaObject = {};
|
|
906
872
|
schemaDefault = currentAsset.match(/{%-? schema -?%}([\s\S]*?){%-? endschema -?%}/);
|
|
907
873
|
defaultSchemaObject_1 = {};
|
|
@@ -921,8 +887,7 @@ var parsedLiquidToHtml = function (templates, options) { return __awaiter(void 0
|
|
|
921
887
|
themeSettings.current.sections[path] = {};
|
|
922
888
|
}
|
|
923
889
|
sectionSettingsState = Object.assign({}, defaultSchemaObject_1, themeSettings.current.sections[path].settings);
|
|
924
|
-
themeSettings.current.sections[path].settings =
|
|
925
|
-
sectionSettingsState;
|
|
890
|
+
themeSettings.current.sections[path].settings = sectionSettingsState;
|
|
926
891
|
if (!(options.importSections === false)) return [3 /*break*/, 57];
|
|
927
892
|
html += serializeBlock(__assign(__assign({ layerName: "".concat(humanCase(path.replace('-template', '')), " section"), component: {
|
|
928
893
|
name: 'Shopify:SectionRef',
|
|
@@ -933,8 +898,7 @@ var parsedLiquidToHtml = function (templates, options) { return __awaiter(void 0
|
|
|
933
898
|
properties: {
|
|
934
899
|
'data-slot': 'shopify:productPage',
|
|
935
900
|
},
|
|
936
|
-
})), ((path === 'collection-template' ||
|
|
937
|
-
path === 'collection') && {
|
|
901
|
+
})), ((path === 'collection-template' || path === 'collection') && {
|
|
938
902
|
properties: {
|
|
939
903
|
'data-slot': 'shopify:collectionPage',
|
|
940
904
|
},
|
|
@@ -1135,9 +1099,7 @@ var parsedLiquidToHtml = function (templates, options) { return __awaiter(void 0
|
|
|
1135
1099
|
}); };
|
|
1136
1100
|
exports.parsedLiquidToHtml = parsedLiquidToHtml;
|
|
1137
1101
|
var flattenExpressions = function (conditionsArray, value) {
|
|
1138
|
-
return (conditionsArray
|
|
1139
|
-
.map(function (c) { return (c.negate ? "".concat(c.expression, " {% else %}") : c.expression); })
|
|
1140
|
-
.join(' ') +
|
|
1102
|
+
return (conditionsArray.map(function (c) { return (c.negate ? "".concat(c.expression, " {% else %}") : c.expression); }).join(' ') +
|
|
1141
1103
|
value +
|
|
1142
1104
|
conditionsArray.map(function () { return "{% endif %}"; }));
|
|
1143
1105
|
};
|
|
@@ -1177,8 +1139,7 @@ function processInnerTemplates(templates, options, priorConditions, overrideHash
|
|
|
1177
1139
|
if (node.type === 'text') {
|
|
1178
1140
|
result += node.value;
|
|
1179
1141
|
}
|
|
1180
|
-
else if ((0, lodash_1.isNull)(node.endSourceSpan) &&
|
|
1181
|
-
!selfCloseTags.has(node.name)) {
|
|
1142
|
+
else if ((0, lodash_1.isNull)(node.endSourceSpan) && !selfCloseTags.has(node.name)) {
|
|
1182
1143
|
var block = {
|
|
1183
1144
|
tagName: node.name,
|
|
1184
1145
|
bindings: {},
|
|
@@ -1222,8 +1183,7 @@ function processInnerTemplates(templates, options, priorConditions, overrideHash
|
|
|
1222
1183
|
}
|
|
1223
1184
|
}
|
|
1224
1185
|
catch (error) {
|
|
1225
|
-
if (error instanceof Error &&
|
|
1226
|
-
error.message.includes('Unexpected closing tag')) {
|
|
1186
|
+
if (error instanceof Error && error.message.includes('Unexpected closing tag')) {
|
|
1227
1187
|
// template.str have an unclosed tag, extract all valid text and
|
|
1228
1188
|
// replace the invlalid endtag with htmlattr
|
|
1229
1189
|
var _d = getErrorInfo(error.message), col = _d.col, line = _d.line;
|
|
@@ -1231,8 +1191,7 @@ function processInnerTemplates(templates, options, priorConditions, overrideHash
|
|
|
1231
1191
|
var preErrorTag = getSubstringTill(Number(col), Number(line), str);
|
|
1232
1192
|
result += preErrorTag;
|
|
1233
1193
|
result += createHtmlAttribute('endopencondtag', {
|
|
1234
|
-
hash: overrideHash ||
|
|
1235
|
-
(priorConditions.length > 0 && (0, object_hash_1.default)(priorConditions)),
|
|
1194
|
+
hash: overrideHash || (priorConditions.length > 0 && (0, object_hash_1.default)(priorConditions)),
|
|
1236
1195
|
});
|
|
1237
1196
|
// 3 is length of </>
|
|
1238
1197
|
var leftovers = str.substring(preErrorTag.length + errorTag.length + 4);
|
|
@@ -1303,9 +1262,7 @@ var htmlNodeToBuilder = function (node, index, parentArray, options) { return __
|
|
|
1303
1262
|
element = el(__assign(__assign({}, parsedBlock), (children.length > 0 && { children: children })));
|
|
1304
1263
|
if ((_f = parsedBlock.meta) === null || _f === void 0 ? void 0 : _f.psuedoNode) {
|
|
1305
1264
|
psuedoNode = (_g = parsedBlock.meta) === null || _g === void 0 ? void 0 : _g.psuedoNode;
|
|
1306
|
-
(element.properties = {}),
|
|
1307
|
-
(element.bindings = {}),
|
|
1308
|
-
delete parsedBlock.meta.psuedoNode;
|
|
1265
|
+
(element.properties = {}), (element.bindings = {}), delete parsedBlock.meta.psuedoNode;
|
|
1309
1266
|
}
|
|
1310
1267
|
else {
|
|
1311
1268
|
return [2 /*return*/, element];
|
|
@@ -1366,18 +1323,9 @@ var htmlNodeToBuilder = function (node, index, parentArray, options) { return __
|
|
|
1366
1323
|
parsed = parseTag(text);
|
|
1367
1324
|
text = '';
|
|
1368
1325
|
}
|
|
1369
|
-
parsedOutput = parsed &&
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
JSON.parse(parsed.value);
|
|
1373
|
-
parsedFor = parsed &&
|
|
1374
|
-
parsed.value &&
|
|
1375
|
-
parsed.name === 'for' &&
|
|
1376
|
-
JSON.parse(parsed.value);
|
|
1377
|
-
parsedIf = parsed &&
|
|
1378
|
-
parsed.value &&
|
|
1379
|
-
parsed.name === 'if' &&
|
|
1380
|
-
JSON.parse(parsed.value);
|
|
1326
|
+
parsedOutput = parsed && parsed.value && parsed.name === 'output' && JSON.parse(parsed.value);
|
|
1327
|
+
parsedFor = parsed && parsed.value && parsed.name === 'for' && JSON.parse(parsed.value);
|
|
1328
|
+
parsedIf = parsed && parsed.value && parsed.name === 'if' && JSON.parse(parsed.value);
|
|
1381
1329
|
parsedValue = parsedOutput;
|
|
1382
1330
|
return [4 /*yield*/, getTranslation(parsedValue, options)];
|
|
1383
1331
|
case 12:
|
|
@@ -1606,9 +1554,7 @@ var htmlToAst = function (html) {
|
|
|
1606
1554
|
};
|
|
1607
1555
|
exports.htmlToAst = htmlToAst;
|
|
1608
1556
|
var isBuilderElement = function (el) {
|
|
1609
|
-
return Boolean(el &&
|
|
1610
|
-
typeof el === 'object' &&
|
|
1611
|
-
el['@type'] === '@builder.io/sdk:Element');
|
|
1557
|
+
return Boolean(el && typeof el === 'object' && el['@type'] === '@builder.io/sdk:Element');
|
|
1612
1558
|
};
|
|
1613
1559
|
var isBuilderElementArray = function (obj) {
|
|
1614
1560
|
return Boolean(obj && Array.isArray(obj) && obj[0] && isBuilderElement(obj[0]));
|
|
@@ -1699,9 +1645,7 @@ var postProcessHtmlAstNodes = function (nodes) {
|
|
|
1699
1645
|
this.update(__assign(__assign({}, current), { name: current.name.replace(bindingsPlaceholder, '') }));
|
|
1700
1646
|
}
|
|
1701
1647
|
else if (current) {
|
|
1702
|
-
var prop = Object.keys(current).find(function (key) {
|
|
1703
|
-
return key.startsWith(bindingsPlaceholder);
|
|
1704
|
-
});
|
|
1648
|
+
var prop = Object.keys(current).find(function (key) { return key.startsWith(bindingsPlaceholder); });
|
|
1705
1649
|
if (prop) {
|
|
1706
1650
|
this.update(__assign(__assign({}, (0, lodash_1.omit)(current, prop)), (_a = {}, _a[prop === null || prop === void 0 ? void 0 : prop.replace(bindingsPlaceholder, '')] = current[prop], _a)));
|
|
1707
1651
|
}
|
|
@@ -1803,9 +1747,7 @@ var matchConditionalTagsWithEndings = function (nodes) {
|
|
|
1803
1747
|
if (!isOpenConditionalTag(node) || this_1.key === 'conditionalTags') {
|
|
1804
1748
|
return { value: void 0 };
|
|
1805
1749
|
}
|
|
1806
|
-
var conditionalTags = [
|
|
1807
|
-
(0, lodash_1.omit)(node, 'children'),
|
|
1808
|
-
];
|
|
1750
|
+
var conditionalTags = [(0, lodash_1.omit)(node, 'children')];
|
|
1809
1751
|
var tag = node;
|
|
1810
1752
|
var originalIndex = node.meta.originalIndex;
|
|
1811
1753
|
var branchIndex = node.meta.branchIndex;
|
|
@@ -1830,11 +1772,7 @@ var matchConditionalTagsWithEndings = function (nodes) {
|
|
|
1830
1772
|
endTag =
|
|
1831
1773
|
current
|
|
1832
1774
|
.slice(currentIndex + 1)
|
|
1833
|
-
.findIndex(function (el) {
|
|
1834
|
-
var _a, _b;
|
|
1835
|
-
return isCondition(el) &&
|
|
1836
|
-
((_a = el.component) === null || _a === void 0 ? void 0 : _a.options.hash) === ((_b = node.component) === null || _b === void 0 ? void 0 : _b.options.hash);
|
|
1837
|
-
}) + 1;
|
|
1775
|
+
.findIndex(function (el) { var _a, _b; return isCondition(el) && ((_a = el.component) === null || _a === void 0 ? void 0 : _a.options.hash) === ((_b = node.component) === null || _b === void 0 ? void 0 : _b.options.hash); }) + 1;
|
|
1838
1776
|
if (endTag === 0) {
|
|
1839
1777
|
throw Error("no endTag for a conditional ".concat((_a = node.component) === null || _a === void 0 ? void 0 : _a.options.hash));
|
|
1840
1778
|
}
|
|
@@ -1961,13 +1899,7 @@ var postProcessBuilderTree = function (nodes, options) { return __awaiter(void 0
|
|
|
1961
1899
|
var _j = tempNodeInfo(item), name_9 = _j.name, value = _j.value;
|
|
1962
1900
|
var parsedValue = value && (0, lodash_1.attempt)(function () { return JSON.parse(value); });
|
|
1963
1901
|
if (name_9) {
|
|
1964
|
-
var isBlockStart = [
|
|
1965
|
-
'for',
|
|
1966
|
-
'if',
|
|
1967
|
-
'unless',
|
|
1968
|
-
'paginate',
|
|
1969
|
-
'form',
|
|
1970
|
-
].includes(name_9);
|
|
1902
|
+
var isBlockStart = ['for', 'if', 'unless', 'paginate', 'form'].includes(name_9);
|
|
1971
1903
|
if (isBlockStart) {
|
|
1972
1904
|
var parent_2 = current;
|
|
1973
1905
|
// Could be fucked.... could have no close tag... or be in wrong palce...
|
|
@@ -1998,9 +1930,7 @@ var postProcessBuilderTree = function (nodes, options) { return __awaiter(void 0
|
|
|
1998
1930
|
else {
|
|
1999
1931
|
updated = true;
|
|
2000
1932
|
var skip_2 = 0;
|
|
2001
|
-
var midTags = nextSiblings
|
|
2002
|
-
.slice(0, parent_2.indexOf(endTag))
|
|
2003
|
-
.filter(function (el) {
|
|
1933
|
+
var midTags = nextSiblings.slice(0, parent_2.indexOf(endTag)).filter(function (el) {
|
|
2004
1934
|
var siblingName = tempNodeInfo(el).name;
|
|
2005
1935
|
if ('if' === siblingName || siblingName === 'unless') {
|
|
2006
1936
|
skip_2++;
|
|
@@ -2016,8 +1946,7 @@ var postProcessBuilderTree = function (nodes, options) { return __awaiter(void 0
|
|
|
2016
1946
|
return false;
|
|
2017
1947
|
}
|
|
2018
1948
|
}
|
|
2019
|
-
if (!skip_2 &&
|
|
2020
|
-
['else', 'elsif'].includes(siblingName)) {
|
|
1949
|
+
if (!skip_2 && ['else', 'elsif'].includes(siblingName)) {
|
|
2021
1950
|
return true;
|
|
2022
1951
|
}
|
|
2023
1952
|
return false;
|
|
@@ -2090,8 +2019,7 @@ var postProcessBuilderTree = function (nodes, options) { return __awaiter(void 0
|
|
|
2090
2019
|
}
|
|
2091
2020
|
var parsedValue_3 = info.value && JSON.parse(info.value);
|
|
2092
2021
|
var args = parseArgList(parsedValue_3.args);
|
|
2093
|
-
options_2.type = (_f = args
|
|
2094
|
-
.shift()) === null || _f === void 0 ? void 0 : _f.replace(/"/g, '').replace(/'/g, '');
|
|
2022
|
+
options_2.type = (_f = args.shift()) === null || _f === void 0 ? void 0 : _f.replace(/"/g, '').replace(/'/g, '');
|
|
2095
2023
|
options_2.parameter = null;
|
|
2096
2024
|
options_2.customAttributes = null;
|
|
2097
2025
|
if (args.length && !args[0].includes(':')) {
|
|
@@ -2173,9 +2101,7 @@ var htmlAstToBuilder = function (nodes, options) { return __awaiter(void 0, void
|
|
|
2173
2101
|
_b = lodash_1.flatten;
|
|
2174
2102
|
return [4 /*yield*/, Promise.all(nodes
|
|
2175
2103
|
.filter(function (node) { return isTextNode(node) || isElement(node); })
|
|
2176
|
-
.map(function (node, index, nodes) {
|
|
2177
|
-
return (0, exports.htmlNodeToBuilder)(node, index, nodes, options);
|
|
2178
|
-
}))];
|
|
2104
|
+
.map(function (node, index, nodes) { return (0, exports.htmlNodeToBuilder)(node, index, nodes, options); }))];
|
|
2179
2105
|
case 1:
|
|
2180
2106
|
els = _a.apply(void 0, [_b.apply(void 0, [_c.sent()])]);
|
|
2181
2107
|
return [2 /*return*/, els];
|
|
@@ -2243,12 +2169,8 @@ var htmlDebugNodeString = function (el) {
|
|
|
2243
2169
|
properties.push(['@' + property, String(value)]);
|
|
2244
2170
|
}
|
|
2245
2171
|
}
|
|
2246
|
-
return "<".concat(tagName, " ").concat(properties.reduce(function (memo, tuple) {
|
|
2247
|
-
|
|
2248
|
-
}, ''), "\n ").concat(el.children && el.children.length
|
|
2249
|
-
? ">".concat(el.children
|
|
2250
|
-
.map(function (child) { return htmlDebugNodeString(child); })
|
|
2251
|
-
.join('\n'), "</").concat(tagName, ">")
|
|
2172
|
+
return "<".concat(tagName, " ").concat(properties.reduce(function (memo, tuple) { return memo + " ".concat(tuple[0], "=\"").concat((tuple[1] || '').replace(/"/g, '`'), "\""); }, ''), "\n ").concat(el.children && el.children.length
|
|
2173
|
+
? ">".concat(el.children.map(function (child) { return htmlDebugNodeString(child); }).join('\n'), "</").concat(tagName, ">")
|
|
2252
2174
|
: '/>', "\n ");
|
|
2253
2175
|
};
|
|
2254
2176
|
/**
|
|
@@ -2277,9 +2199,7 @@ var preprocessLiquid = function (liquid, options) {
|
|
|
2277
2199
|
match = matchedCaptureGroup[0], capturedVariableName = matchedCaptureGroup[1], capturedContents = matchedCaptureGroup[2];
|
|
2278
2200
|
capturedContentsHasLiquid = capturedContents === null || capturedContents === void 0 ? void 0 : capturedContents.match(/\{%/gim);
|
|
2279
2201
|
capturedContentContainsCaptureTag = capturedContents === null || capturedContents === void 0 ? void 0 : capturedContents.match(/{%-?\s*capture/gim);
|
|
2280
|
-
if (capturedVariableName &&
|
|
2281
|
-
capturedContentsHasLiquid &&
|
|
2282
|
-
!capturedContentContainsCaptureTag) {
|
|
2202
|
+
if (capturedVariableName && capturedContentsHasLiquid && !capturedContentContainsCaptureTag) {
|
|
2283
2203
|
// We want to find a replace any instances of the captured variable in the template, i.e. {{ my_variable }}
|
|
2284
2204
|
allCaptureGroupMatches.push({
|
|
2285
2205
|
match: match,
|
|
@@ -2314,21 +2234,13 @@ var preprocessLiquid = function (liquid, options) {
|
|
|
2314
2234
|
}
|
|
2315
2235
|
includesWithRegex = /{%-?\s*include\s*([\S]+?)\s*with\s*([\S]+?)\s*-?%}/gi;
|
|
2316
2236
|
processedLiquid = processedLiquid.replace(includesWithRegex, function (fullIncludesMatch, templateName, withMatch) {
|
|
2317
|
-
var templateNameCleaned = templateName
|
|
2318
|
-
.trim()
|
|
2319
|
-
.replace(/'/g, '')
|
|
2320
|
-
.replace(/"/g, '');
|
|
2237
|
+
var templateNameCleaned = templateName.trim().replace(/'/g, '').replace(/"/g, '');
|
|
2321
2238
|
return "{% include '".concat(templateNameCleaned, "', ").concat(templateNameCleaned, ": ").concat(withMatch, " %}");
|
|
2322
2239
|
});
|
|
2323
2240
|
includesWithAndValuesRegex = /{%-?\s*include\s*([\S]+?)\s*with\s*(([\S]+?:\s*[\S]+?,?\s*)+)-?%}/gi;
|
|
2324
2241
|
processedLiquid = processedLiquid.replace(includesWithAndValuesRegex, function (fullIncludesMatch, templateName, allKeysAndValues) {
|
|
2325
|
-
var templateNameCleaned = templateName
|
|
2326
|
-
|
|
2327
|
-
.replace(/'/g, '')
|
|
2328
|
-
.replace(/"/g, '');
|
|
2329
|
-
var allKeysAndValuesCleaned = allKeysAndValues
|
|
2330
|
-
.trim()
|
|
2331
|
-
.replace(/\s+/g, ' ');
|
|
2242
|
+
var templateNameCleaned = templateName.trim().replace(/'/g, '').replace(/"/g, '');
|
|
2243
|
+
var allKeysAndValuesCleaned = allKeysAndValues.trim().replace(/\s+/g, ' ');
|
|
2332
2244
|
return "{% include '".concat(templateNameCleaned, "', ").concat(allKeysAndValuesCleaned, " %}");
|
|
2333
2245
|
});
|
|
2334
2246
|
templateContainsRegex = /{%-?(.+?)template\s+contains\s+(.+?)-?%}/gi;
|
|
@@ -2351,8 +2263,7 @@ var preprocessLiquid = function (liquid, options) {
|
|
|
2351
2263
|
themeAsset = _e.sent();
|
|
2352
2264
|
themeSettings = typeof themeAsset === 'string' && (0, lodash_1.attempt)(function () { return JSON.parse(themeAsset); });
|
|
2353
2265
|
if (themeSettings && !(0, lodash_1.isError)(themeSettings)) {
|
|
2354
|
-
contentForIndexTemplates = ((_b = themeSettings.current) === null || _b === void 0 ? void 0 : _b.content_for_index) ||
|
|
2355
|
-
((_d = (_c = themeSettings.presets) === null || _c === void 0 ? void 0 : _c.Default) === null || _d === void 0 ? void 0 : _d.content_for_index);
|
|
2266
|
+
contentForIndexTemplates = ((_b = themeSettings.current) === null || _b === void 0 ? void 0 : _b.content_for_index) || ((_d = (_c = themeSettings.presets) === null || _c === void 0 ? void 0 : _c.Default) === null || _d === void 0 ? void 0 : _d.content_for_index);
|
|
2356
2267
|
if (contentForIndexTemplates.length) {
|
|
2357
2268
|
contentForIndexLiquidStrings_1 = contentForIndexTemplates.map(function (template) { return "{% section '".concat(template, "' %}"); });
|
|
2358
2269
|
contentForIndexRegex = /{{\s*content_for_index\s*}}/gi;
|
|
@@ -2396,17 +2307,13 @@ var liquidToBuilder = function (liquid, options) {
|
|
|
2396
2307
|
case 3:
|
|
2397
2308
|
themeAsset = _a.sent();
|
|
2398
2309
|
themeSettings = typeof themeAsset === 'string' && (0, lodash_1.attempt)(function () { return JSON.parse(themeAsset); });
|
|
2399
|
-
if (themeSettings &&
|
|
2400
|
-
!(0, lodash_1.isError)(themeSettings) &&
|
|
2401
|
-
options.importSections !== false) {
|
|
2310
|
+
if (themeSettings && !(0, lodash_1.isError)(themeSettings) && options.importSections !== false) {
|
|
2402
2311
|
serialized = serializeBlock({
|
|
2403
2312
|
layerName: "Theme Settings",
|
|
2404
2313
|
component: {
|
|
2405
2314
|
name: 'Shopify:ThemeProvider',
|
|
2406
2315
|
options: {
|
|
2407
|
-
shopifyMetafields: [
|
|
2408
|
-
{ path: 'state.settings', as: '_theme_settings' },
|
|
2409
|
-
],
|
|
2316
|
+
shopifyMetafields: [{ path: 'state.settings', as: '_theme_settings' }],
|
|
2410
2317
|
state: {
|
|
2411
2318
|
settings: mapArrays((0, lodash_1.omit)(themeSettings.current, 'sections')),
|
|
2412
2319
|
},
|
|
@@ -2505,9 +2412,7 @@ var bindingsFromAttrs = function (node, bindings, properties, options) { return
|
|
|
2505
2412
|
getConditionalValue = function (conditions, value, defaultValue) {
|
|
2506
2413
|
return conditions.length > 0
|
|
2507
2414
|
? "/*start*/".concat(conditions
|
|
2508
|
-
.map(function (c) {
|
|
2509
|
-
return "".concat(c.negate ? '!' : '').concat(liquidConditionTemplate(c.expression));
|
|
2510
|
-
})
|
|
2415
|
+
.map(function (c) { return "".concat(c.negate ? '!' : '').concat(liquidConditionTemplate(c.expression)); })
|
|
2511
2416
|
.join('&&') + " ? ".concat(value, " : (").concat(defaultValue, ")"), "/*end*/")
|
|
2512
2417
|
: value;
|
|
2513
2418
|
};
|
|
@@ -2528,9 +2433,7 @@ var bindingsFromAttrs = function (node, bindings, properties, options) { return
|
|
|
2528
2433
|
stuff = JSON.parse(htmlDecode(value));
|
|
2529
2434
|
if (!(key === '[if]')) return [3 /*break*/, 3];
|
|
2530
2435
|
jump = getIndexOfClosingTag(i + 1, ['[endif]']);
|
|
2531
|
-
return [4 /*yield*/, parseAttrsInRange(i + 1, jump, conditions.concat([
|
|
2532
|
-
{ expression: stuff.cond, negate: stuff.negate },
|
|
2533
|
-
]))];
|
|
2436
|
+
return [4 /*yield*/, parseAttrsInRange(i + 1, jump, conditions.concat([{ expression: stuff.cond, negate: stuff.negate }]))];
|
|
2534
2437
|
case 2:
|
|
2535
2438
|
_b.sent();
|
|
2536
2439
|
return [3 /*break*/, 9];
|
|
@@ -2563,8 +2466,7 @@ var bindingsFromAttrs = function (node, bindings, properties, options) { return
|
|
|
2563
2466
|
// Remove trailing semi-colon because the liquid render function does not know how to handle it
|
|
2564
2467
|
liquidStr = liquidStr === null || liquidStr === void 0 ? void 0 : liquidStr.replace(/;$/, '');
|
|
2565
2468
|
useKey = key;
|
|
2566
|
-
if ((keyForImage == key ||
|
|
2567
|
-
(!keyForImage && (key === 'src' || key === 'data-src'))) &&
|
|
2469
|
+
if ((keyForImage == key || (!keyForImage && (key === 'src' || key === 'data-src'))) &&
|
|
2568
2470
|
node.tag === 'img') {
|
|
2569
2471
|
useKey = 'component.options.image';
|
|
2570
2472
|
keyForImage = key;
|
|
@@ -183,9 +183,7 @@ exports.components = {
|
|
|
183
183
|
alignSelf: 'stretch',
|
|
184
184
|
flexGrow: '1',
|
|
185
185
|
boxSizing: 'border-box',
|
|
186
|
-
maxWidth: "".concat((((_b = node.bindings.maxWidth) === null || _b === void 0 ? void 0 : _b.code) &&
|
|
187
|
-
Number(node.bindings.maxWidth.code)) ||
|
|
188
|
-
1200, "px"),
|
|
186
|
+
maxWidth: "".concat((((_b = node.bindings.maxWidth) === null || _b === void 0 ? void 0 : _b.code) && Number(node.bindings.maxWidth.code)) || 1200, "px"),
|
|
189
187
|
display: 'flex',
|
|
190
188
|
flexDirection: 'column',
|
|
191
189
|
alignItems: 'stretch',
|
|
@@ -202,13 +200,11 @@ exports.components = {
|
|
|
202
200
|
var columns = node.children.filter(filter_empty_text_nodes_1.filterEmptyTextNodes).map(function (item) {
|
|
203
201
|
var _a;
|
|
204
202
|
return ({
|
|
205
|
-
width: parseFloat(item.properties.width || ((_a = item.bindings.width) === null || _a === void 0 ? void 0 : _a.code) || '0') ||
|
|
206
|
-
0,
|
|
203
|
+
width: parseFloat(item.properties.width || ((_a = item.bindings.width) === null || _a === void 0 ? void 0 : _a.code) || '0') || 0,
|
|
207
204
|
children: item.children,
|
|
208
205
|
});
|
|
209
206
|
});
|
|
210
|
-
var gutterSize = (node.properties.getterSize && parseFloat(node.properties.getterSize)) ||
|
|
211
|
-
20;
|
|
207
|
+
var gutterSize = (node.properties.getterSize && parseFloat(node.properties.getterSize)) || 20;
|
|
212
208
|
function getWidth(index) {
|
|
213
209
|
return (columns[index] && columns[index].width) || 100 / columns.length;
|
|
214
210
|
}
|
|
@@ -537,9 +533,7 @@ function generateBuilderIoSrcSet(image) {
|
|
|
537
533
|
var isBuilderIo = !!(image || '').match(/builder\.io/);
|
|
538
534
|
return isBuilderIo
|
|
539
535
|
? [100, 200, 400, 800, 1200, 1600, 2000]
|
|
540
|
-
.map(function (size) {
|
|
541
|
-
return "".concat(updateQueryParam(image, 'width', String(size)), " ").concat(size, "w");
|
|
542
|
-
})
|
|
536
|
+
.map(function (size) { return "".concat(updateQueryParam(image, 'width', String(size)), " ").concat(size, "w"); })
|
|
543
537
|
.concat([image])
|
|
544
538
|
.join(', ')
|
|
545
539
|
: '';
|
|
@@ -28,9 +28,7 @@ function ensureAllSymbolsHaveIds(content) {
|
|
|
28
28
|
var ids = new Set();
|
|
29
29
|
(0, traverse_1.forEach)(content, function (el) {
|
|
30
30
|
var _a, _b, _c;
|
|
31
|
-
if (this.key === 'jsCode' &&
|
|
32
|
-
isString(el) &&
|
|
33
|
-
el.endsWith('return _virtual_index')) {
|
|
31
|
+
if (this.key === 'jsCode' && isString(el) && el.endsWith('return _virtual_index')) {
|
|
34
32
|
// Sometimes rollup adds a final `return _virtual_index` but that causes VM evaluation to fail.
|
|
35
33
|
// Instead of a return on the last line, it needs a plain expression on the last line. Luckily
|
|
36
34
|
// because the rollup compile behavior is consistent this works pretty reliably
|
|
@@ -81,7 +79,7 @@ function convertBuilderContentToSymbolHierarchy(content, _a) {
|
|
|
81
79
|
if (cssCode) {
|
|
82
80
|
collectComponentStyles && collectComponentStyles.push((0, minify_1.minify)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["", ""], ["", ""])), cssCode));
|
|
83
81
|
}
|
|
84
|
-
while (path[0 /* DEPTH */] >= this.path.length) {
|
|
82
|
+
while (path[0 /* Path.DEPTH */] >= this.path.length) {
|
|
85
83
|
path.shift();
|
|
86
84
|
path.shift();
|
|
87
85
|
}
|
|
@@ -97,10 +95,10 @@ function convertBuilderContentToSymbolHierarchy(content, _a) {
|
|
|
97
95
|
collectComponentState[id] = state;
|
|
98
96
|
}
|
|
99
97
|
}
|
|
100
|
-
if (path[0 /* DEPTH */] < this.path.length) {
|
|
98
|
+
if (path[0 /* Path.DEPTH */] < this.path.length) {
|
|
101
99
|
var id = getIdFromSymbol(el);
|
|
102
100
|
hierarchy[id] = [];
|
|
103
|
-
addIfMissing(hierarchy[path[1 /* ID */]], id);
|
|
101
|
+
addIfMissing(hierarchy[path[1 /* Path.ID */]], id);
|
|
104
102
|
path.unshift(this.path.length, id);
|
|
105
103
|
}
|
|
106
104
|
// TODO(misko): This should be `el.content` not `el`
|
package/dist/src/targets.d.ts
CHANGED
|
@@ -19,7 +19,9 @@ export declare const targets: {
|
|
|
19
19
|
swift: (options?: import("./generators/swift-ui").ToSwiftOptions) => import(".").Transpiler;
|
|
20
20
|
template: (options?: import("./generators/template").ToTemplateOptions) => import(".").Transpiler;
|
|
21
21
|
webcomponent: (options?: import("./generators/html").ToHtmlOptions) => import(".").Transpiler;
|
|
22
|
-
vue: (
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
vue: (vueOptions?: Omit<import("./generators/vue").ToVueOptions, "vueVersion"> | undefined) => import(".").Transpiler;
|
|
23
|
+
vue2: (vueOptions?: Omit<import("./generators/vue").ToVueOptions, "vueVersion"> | undefined) => import(".").Transpiler;
|
|
24
|
+
vue3: (vueOptions?: Omit<import("./generators/vue").ToVueOptions, "vueVersion"> | undefined) => import(".").Transpiler;
|
|
25
|
+
stencil: (options?: import("./generators/stencil").ToStencilOptions) => import(".").Transpiler;
|
|
26
|
+
qwik: (userOptions?: import("./generators/qwik/component-generator").ToQwikOptions) => import(".").Transpiler;
|
|
25
27
|
};
|
package/dist/src/targets.js
CHANGED
|
@@ -13,6 +13,8 @@ var svelte_1 = require("./generators/svelte");
|
|
|
13
13
|
var swift_ui_1 = require("./generators/swift-ui");
|
|
14
14
|
var template_1 = require("./generators/template");
|
|
15
15
|
var vue_1 = require("./generators/vue");
|
|
16
|
+
var stencil_1 = require("./generators/stencil");
|
|
17
|
+
var qwik_1 = require("./generators/qwik");
|
|
16
18
|
exports.targets = {
|
|
17
19
|
angular: angular_1.componentToAngular,
|
|
18
20
|
builder: builder_1.componentToBuilder,
|
|
@@ -27,5 +29,9 @@ exports.targets = {
|
|
|
27
29
|
swift: swift_ui_1.componentToSwift,
|
|
28
30
|
template: template_1.componentToTemplate,
|
|
29
31
|
webcomponent: html_1.componentToCustomElement,
|
|
30
|
-
vue: vue_1.
|
|
32
|
+
vue: vue_1.componentToVue3,
|
|
33
|
+
vue2: vue_1.componentToVue2,
|
|
34
|
+
vue3: vue_1.componentToVue3,
|
|
35
|
+
stencil: stencil_1.componentToStencil,
|
|
36
|
+
qwik: qwik_1.componentToQwik,
|
|
31
37
|
};
|