@swell/apps-sdk 1.0.185 → 1.0.187
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/index.cjs +526 -266
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +526 -266
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +472 -212
- package/dist/index.mjs.map +4 -4
- package/dist/src/compatibility/shopify-objects/content.d.ts +12 -0
- package/dist/src/liquid/color.d.ts +1 -1
- package/dist/src/liquid/filters/index.d.ts +2 -0
- package/dist/src/liquid/filters/preload_tag.d.ts +3 -0
- package/dist/src/liquid/hash.d.ts +5 -0
- package/dist/src/liquid/index.d.ts +4 -1
- package/dist/src/liquid/tags/content_for.d.ts +3 -0
- package/dist/src/liquid/tags/doc.d.ts +2 -0
- package/dist/src/liquid/tags/index.d.ts +4 -0
- package/dist/src/liquid/tokens/identifier-token.d.ts +9 -0
- package/dist/src/liquid/tokens/index.d.ts +2 -0
- package/dist/src/liquid/tokienizer.d.ts +5 -0
- package/dist/src/theme.d.ts +5 -1
- package/dist/types/shopify.d.ts +2 -1
- package/dist/types/swell.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3652,7 +3652,15 @@ function resolveSectionPresets(schema) {
|
|
|
3652
3652
|
}, {}),
|
|
3653
3653
|
...preset.settings || void 0
|
|
3654
3654
|
},
|
|
3655
|
-
blocks: preset
|
|
3655
|
+
blocks: resolveSectionBlockPresets(preset, schema)
|
|
3656
|
+
}));
|
|
3657
|
+
}
|
|
3658
|
+
function resolveSectionBlockPresets(preset, schema) {
|
|
3659
|
+
if (!preset.blocks) {
|
|
3660
|
+
return;
|
|
3661
|
+
}
|
|
3662
|
+
if (Array.isArray(preset.blocks)) {
|
|
3663
|
+
return preset.blocks.map((block) => {
|
|
3656
3664
|
const blockDef = schema.blocks?.find((b) => b.type === block.type);
|
|
3657
3665
|
return blockDef ? {
|
|
3658
3666
|
...block,
|
|
@@ -3666,8 +3674,9 @@ function resolveSectionPresets(schema) {
|
|
|
3666
3674
|
...block.settings || void 0
|
|
3667
3675
|
}
|
|
3668
3676
|
} : block;
|
|
3669
|
-
})
|
|
3670
|
-
}
|
|
3677
|
+
});
|
|
3678
|
+
}
|
|
3679
|
+
return Object.values(preset.blocks);
|
|
3671
3680
|
}
|
|
3672
3681
|
async function getLayoutSectionGroups(allSections, renderTemplateSchema) {
|
|
3673
3682
|
const allSectionsList = Array.from(allSections.values());
|
|
@@ -3744,7 +3753,15 @@ async function getPageSections(sectionGroup, getSchema) {
|
|
|
3744
3753
|
};
|
|
3745
3754
|
const id = sectionGroup.id ? `page__${sectionGroup.id}__${key}` : schema.id;
|
|
3746
3755
|
const blockOrder = Array.isArray(section.block_order) ? section.block_order : Object.keys(section.blocks || {});
|
|
3747
|
-
const blocks = blockOrder.map((key2) =>
|
|
3756
|
+
const blocks = blockOrder.map((key2) => {
|
|
3757
|
+
const block = section.blocks?.[key2];
|
|
3758
|
+
if (block) {
|
|
3759
|
+
return {
|
|
3760
|
+
...block,
|
|
3761
|
+
id: `${schema.id}__${key2}`
|
|
3762
|
+
};
|
|
3763
|
+
}
|
|
3764
|
+
}).filter(Boolean);
|
|
3748
3765
|
const settings = {
|
|
3749
3766
|
section: {
|
|
3750
3767
|
id,
|
|
@@ -5738,7 +5755,7 @@ function getAllSectionComponents(allSections) {
|
|
|
5738
5755
|
// TODO: figure out how to make this work, doesn't work for collections normally
|
|
5739
5756
|
defaultValue: section.presets?.reduce(
|
|
5740
5757
|
(acc, preset, index) => {
|
|
5741
|
-
if (!preset.blocks) {
|
|
5758
|
+
if (!preset.blocks || !Array.isArray(preset.blocks)) {
|
|
5742
5759
|
return acc;
|
|
5743
5760
|
}
|
|
5744
5761
|
return preset.blocks.reduce(
|
|
@@ -5945,7 +5962,7 @@ function getAllSectionComponentTemplates(allSections) {
|
|
|
5945
5962
|
custom_css: preset.settings?.["custom_css"] || "",
|
|
5946
5963
|
...processFields(section.fields, preset.settings),
|
|
5947
5964
|
// Process blocks inside the preset
|
|
5948
|
-
Blocks: (preset.blocks
|
|
5965
|
+
Blocks: (Array.isArray(preset.blocks) ? preset.blocks : []).map((block) => {
|
|
5949
5966
|
const blockSchema = section.blocks?.find(
|
|
5950
5967
|
({ type }) => type === block.type
|
|
5951
5968
|
);
|
|
@@ -6405,11 +6422,11 @@ function getRandomId() {
|
|
|
6405
6422
|
}
|
|
6406
6423
|
|
|
6407
6424
|
// src/menus.ts
|
|
6408
|
-
var
|
|
6425
|
+
var import_lodash_es17 = require("lodash-es");
|
|
6409
6426
|
|
|
6410
6427
|
// src/theme.ts
|
|
6411
6428
|
var import_json56 = __toESM(require("json5"), 1);
|
|
6412
|
-
var
|
|
6429
|
+
var import_lodash_es16 = require("lodash-es");
|
|
6413
6430
|
|
|
6414
6431
|
// src/compatibility/shopify.ts
|
|
6415
6432
|
var import_lodash_es7 = require("lodash-es");
|
|
@@ -11704,16 +11721,16 @@ function ShopifyBlog(instance, blogCategory) {
|
|
|
11704
11721
|
if (!Array.isArray(blogs?.results)) {
|
|
11705
11722
|
return [];
|
|
11706
11723
|
}
|
|
11707
|
-
const
|
|
11708
|
-
(
|
|
11724
|
+
const set4 = blogs.results.reduce(
|
|
11725
|
+
(set5, blog) => {
|
|
11709
11726
|
for (const tag of blog.tags || []) {
|
|
11710
|
-
|
|
11727
|
+
set5.add(tag);
|
|
11711
11728
|
}
|
|
11712
|
-
return
|
|
11729
|
+
return set5;
|
|
11713
11730
|
},
|
|
11714
11731
|
/* @__PURE__ */ new Set()
|
|
11715
11732
|
);
|
|
11716
|
-
return Array.from(
|
|
11733
|
+
return Array.from(set4.values());
|
|
11717
11734
|
});
|
|
11718
11735
|
return new ShopifyResource({
|
|
11719
11736
|
all_tags: allTags,
|
|
@@ -12097,18 +12114,18 @@ function ShopifyCollection(instance, category) {
|
|
|
12097
12114
|
if (!resolved) {
|
|
12098
12115
|
return [];
|
|
12099
12116
|
}
|
|
12100
|
-
const
|
|
12117
|
+
const set4 = /* @__PURE__ */ new Set();
|
|
12101
12118
|
await Promise.all(
|
|
12102
12119
|
resolved.results.map(async (product) => {
|
|
12103
12120
|
const tags2 = await Promise.resolve().then(() => product.tags);
|
|
12104
12121
|
if (Array.isArray(tags2)) {
|
|
12105
12122
|
for (const tag of tags2) {
|
|
12106
|
-
|
|
12123
|
+
set4.add(tag);
|
|
12107
12124
|
}
|
|
12108
12125
|
}
|
|
12109
12126
|
})
|
|
12110
12127
|
);
|
|
12111
|
-
return Array.from(
|
|
12128
|
+
return Array.from(set4.values());
|
|
12112
12129
|
}),
|
|
12113
12130
|
all_types: defer(async () => {
|
|
12114
12131
|
const products = await resolveProducts();
|
|
@@ -12212,6 +12229,31 @@ function makeProductsCollectionResolve(instance, object, mapper) {
|
|
|
12212
12229
|
return resolveProducts;
|
|
12213
12230
|
}
|
|
12214
12231
|
|
|
12232
|
+
// src/compatibility/shopify-objects/content.ts
|
|
12233
|
+
var import_liquidjs6 = require("liquidjs");
|
|
12234
|
+
var ShopifySwellContent = class extends import_liquidjs6.Drop {
|
|
12235
|
+
content;
|
|
12236
|
+
description;
|
|
12237
|
+
constructor(product) {
|
|
12238
|
+
super();
|
|
12239
|
+
this.content = product?.content || {};
|
|
12240
|
+
this.description = product?.description || "";
|
|
12241
|
+
}
|
|
12242
|
+
toString() {
|
|
12243
|
+
return this.description;
|
|
12244
|
+
}
|
|
12245
|
+
toObject() {
|
|
12246
|
+
const combined = Object.assign({}, this.content);
|
|
12247
|
+
return combined;
|
|
12248
|
+
}
|
|
12249
|
+
toJSON() {
|
|
12250
|
+
return this.toObject();
|
|
12251
|
+
}
|
|
12252
|
+
toLiquid() {
|
|
12253
|
+
return this.toObject();
|
|
12254
|
+
}
|
|
12255
|
+
};
|
|
12256
|
+
|
|
12215
12257
|
// src/compatibility/shopify-objects/product.ts
|
|
12216
12258
|
function ShopifyProduct(instance, product, depth = 0) {
|
|
12217
12259
|
if (product instanceof ShopifyResource) {
|
|
@@ -12245,7 +12287,7 @@ function ShopifyProduct(instance, product, depth = 0) {
|
|
|
12245
12287
|
compare_at_price_max: compareAtPrice,
|
|
12246
12288
|
compare_at_price_min: compareAtPrice,
|
|
12247
12289
|
compare_at_price_varies: false,
|
|
12248
|
-
content: defer(() => product
|
|
12290
|
+
content: defer(() => new ShopifySwellContent(product)),
|
|
12249
12291
|
created_at: defer(() => product.date_created),
|
|
12250
12292
|
description: defer(() => product.description),
|
|
12251
12293
|
featured_image: deferWith(product, (product2) => {
|
|
@@ -13123,8 +13165,8 @@ function ShopifyShippingMethod(instance, order) {
|
|
|
13123
13165
|
}
|
|
13124
13166
|
|
|
13125
13167
|
// src/compatibility/drops/money.ts
|
|
13126
|
-
var
|
|
13127
|
-
var MoneyDrop = class extends
|
|
13168
|
+
var import_liquidjs7 = require("liquidjs");
|
|
13169
|
+
var MoneyDrop = class extends import_liquidjs7.Drop {
|
|
13128
13170
|
constructor(value, decimals, currency) {
|
|
13129
13171
|
super();
|
|
13130
13172
|
this.value = value;
|
|
@@ -13725,8 +13767,8 @@ function ShopifyShop(instance, store) {
|
|
|
13725
13767
|
}
|
|
13726
13768
|
|
|
13727
13769
|
// src/compatibility/drops/all_products.ts
|
|
13728
|
-
var
|
|
13729
|
-
var AllProductsDrop = class extends
|
|
13770
|
+
var import_liquidjs8 = require("liquidjs");
|
|
13771
|
+
var AllProductsDrop = class extends import_liquidjs8.Drop {
|
|
13730
13772
|
#instance;
|
|
13731
13773
|
#map;
|
|
13732
13774
|
constructor(instance) {
|
|
@@ -13768,8 +13810,8 @@ var AllProductsDrop = class extends import_liquidjs7.Drop {
|
|
|
13768
13810
|
};
|
|
13769
13811
|
|
|
13770
13812
|
// src/compatibility/drops/articles.ts
|
|
13771
|
-
var
|
|
13772
|
-
var ArticlesDrop = class extends
|
|
13813
|
+
var import_liquidjs9 = require("liquidjs");
|
|
13814
|
+
var ArticlesDrop = class extends import_liquidjs9.Drop {
|
|
13773
13815
|
#instance;
|
|
13774
13816
|
#map;
|
|
13775
13817
|
constructor(instance) {
|
|
@@ -13811,8 +13853,8 @@ var ArticlesDrop = class extends import_liquidjs8.Drop {
|
|
|
13811
13853
|
};
|
|
13812
13854
|
|
|
13813
13855
|
// src/compatibility/drops/blogs.ts
|
|
13814
|
-
var
|
|
13815
|
-
var BlogsDrop = class extends
|
|
13856
|
+
var import_liquidjs10 = require("liquidjs");
|
|
13857
|
+
var BlogsDrop = class extends import_liquidjs10.Drop {
|
|
13816
13858
|
#instance;
|
|
13817
13859
|
#map;
|
|
13818
13860
|
constructor(instance) {
|
|
@@ -13858,7 +13900,7 @@ var BlogsDrop = class extends import_liquidjs9.Drop {
|
|
|
13858
13900
|
};
|
|
13859
13901
|
|
|
13860
13902
|
// src/compatibility/drops/collections.ts
|
|
13861
|
-
var
|
|
13903
|
+
var import_liquidjs11 = require("liquidjs");
|
|
13862
13904
|
var AllCategoryResource = class extends StorefrontResource {
|
|
13863
13905
|
constructor(instance) {
|
|
13864
13906
|
super(() => {
|
|
@@ -13872,7 +13914,7 @@ var AllCategoryResource = class extends StorefrontResource {
|
|
|
13872
13914
|
});
|
|
13873
13915
|
}
|
|
13874
13916
|
};
|
|
13875
|
-
var CollectionsDrop = class extends
|
|
13917
|
+
var CollectionsDrop = class extends import_liquidjs11.Drop {
|
|
13876
13918
|
#instance;
|
|
13877
13919
|
#map;
|
|
13878
13920
|
constructor(instance) {
|
|
@@ -13999,8 +14041,8 @@ var SwellStorefrontProducts = class extends SwellStorefrontCollection {
|
|
|
13999
14041
|
};
|
|
14000
14042
|
|
|
14001
14043
|
// src/compatibility/drops/images.ts
|
|
14002
|
-
var
|
|
14003
|
-
var ImagesDrop = class extends
|
|
14044
|
+
var import_liquidjs12 = require("liquidjs");
|
|
14045
|
+
var ImagesDrop = class extends import_liquidjs12.Drop {
|
|
14004
14046
|
#instance;
|
|
14005
14047
|
#map;
|
|
14006
14048
|
constructor(instance) {
|
|
@@ -14054,8 +14096,8 @@ var SwellImage = class extends StorefrontResource {
|
|
|
14054
14096
|
};
|
|
14055
14097
|
|
|
14056
14098
|
// src/compatibility/drops/object-handles.ts
|
|
14057
|
-
var
|
|
14058
|
-
var ObjectHandlesDrop = class extends
|
|
14099
|
+
var import_liquidjs13 = require("liquidjs");
|
|
14100
|
+
var ObjectHandlesDrop = class extends import_liquidjs13.Drop {
|
|
14059
14101
|
#map;
|
|
14060
14102
|
constructor(map) {
|
|
14061
14103
|
super();
|
|
@@ -14095,8 +14137,8 @@ var ObjectHandlesDrop = class extends import_liquidjs12.Drop {
|
|
|
14095
14137
|
};
|
|
14096
14138
|
|
|
14097
14139
|
// src/compatibility/drops/pages.ts
|
|
14098
|
-
var
|
|
14099
|
-
var PagesDrop = class extends
|
|
14140
|
+
var import_liquidjs14 = require("liquidjs");
|
|
14141
|
+
var PagesDrop = class extends import_liquidjs14.Drop {
|
|
14100
14142
|
#instance;
|
|
14101
14143
|
#map;
|
|
14102
14144
|
constructor(instance) {
|
|
@@ -14671,6 +14713,8 @@ ${injects.join("\n")}</script>`;
|
|
|
14671
14713
|
return `templates/${this.getPageType(name)}`;
|
|
14672
14714
|
case "sections":
|
|
14673
14715
|
return `sections/${name}`;
|
|
14716
|
+
case "blocks":
|
|
14717
|
+
return `blocks/${name}`;
|
|
14674
14718
|
default:
|
|
14675
14719
|
throw new Error(`Theme file type not supported: ${type}`);
|
|
14676
14720
|
}
|
|
@@ -14816,9 +14860,9 @@ ${injects.join("\n")}</script>`;
|
|
|
14816
14860
|
};
|
|
14817
14861
|
|
|
14818
14862
|
// src/liquid/drops/render.ts
|
|
14819
|
-
var
|
|
14863
|
+
var import_liquidjs15 = require("liquidjs");
|
|
14820
14864
|
var import_lodash_es8 = require("lodash-es");
|
|
14821
|
-
var RenderDrop = class extends
|
|
14865
|
+
var RenderDrop = class extends import_liquidjs15.Drop {
|
|
14822
14866
|
#result;
|
|
14823
14867
|
#handler;
|
|
14824
14868
|
constructor(handler) {
|
|
@@ -14844,7 +14888,7 @@ var RenderDrop = class extends import_liquidjs14.Drop {
|
|
|
14844
14888
|
};
|
|
14845
14889
|
|
|
14846
14890
|
// src/liquid/index.ts
|
|
14847
|
-
var
|
|
14891
|
+
var import_liquidjs40 = require("liquidjs");
|
|
14848
14892
|
|
|
14849
14893
|
// src/utils/escape.ts
|
|
14850
14894
|
function replacerUnescape(match) {
|
|
@@ -14855,9 +14899,9 @@ function unescapeLiquidSyntax(template) {
|
|
|
14855
14899
|
}
|
|
14856
14900
|
|
|
14857
14901
|
// src/liquid/tags/assign.ts
|
|
14858
|
-
var
|
|
14902
|
+
var import_liquidjs16 = require("liquidjs");
|
|
14859
14903
|
function bind(_liquidSwell) {
|
|
14860
|
-
return class AssignTag extends
|
|
14904
|
+
return class AssignTag extends import_liquidjs16.Tag {
|
|
14861
14905
|
key;
|
|
14862
14906
|
value;
|
|
14863
14907
|
identifier;
|
|
@@ -14869,7 +14913,7 @@ function bind(_liquidSwell) {
|
|
|
14869
14913
|
this.tokenizer.skipBlank();
|
|
14870
14914
|
this.tokenizer.advance();
|
|
14871
14915
|
try {
|
|
14872
|
-
this.value = new
|
|
14916
|
+
this.value = new import_liquidjs16.Value(this.tokenizer.readFilteredValue(), this.liquid);
|
|
14873
14917
|
} catch (e) {
|
|
14874
14918
|
console.warn(
|
|
14875
14919
|
`Liquid "assign" tag: ${e instanceof Error ? e.stack : String(e)}`
|
|
@@ -14896,9 +14940,9 @@ function bind(_liquidSwell) {
|
|
|
14896
14940
|
}
|
|
14897
14941
|
|
|
14898
14942
|
// src/liquid/tags/case.ts
|
|
14899
|
-
var
|
|
14943
|
+
var import_liquidjs17 = require("liquidjs");
|
|
14900
14944
|
function bind2(liquidSwell) {
|
|
14901
|
-
return class CaseTag extends
|
|
14945
|
+
return class CaseTag extends import_liquidjs17.Tag {
|
|
14902
14946
|
value;
|
|
14903
14947
|
branches;
|
|
14904
14948
|
elseTemplates;
|
|
@@ -14909,7 +14953,7 @@ function bind2(liquidSwell) {
|
|
|
14909
14953
|
const caseVar = this.tokenizer.readValue()?.getText();
|
|
14910
14954
|
this.isBlock = Boolean(caseVar?.startsWith("block."));
|
|
14911
14955
|
this.tokenizer.p = begin;
|
|
14912
|
-
this.value = new
|
|
14956
|
+
this.value = new import_liquidjs17.Value(this.tokenizer.readFilteredValue(), this.liquid);
|
|
14913
14957
|
this.branches = [];
|
|
14914
14958
|
this.elseTemplates = [];
|
|
14915
14959
|
let p = [];
|
|
@@ -14947,12 +14991,12 @@ function bind2(liquidSwell) {
|
|
|
14947
14991
|
}
|
|
14948
14992
|
*render(ctx, emitter) {
|
|
14949
14993
|
const r = this.liquid.renderer;
|
|
14950
|
-
const target = (0,
|
|
14994
|
+
const target = (0, import_liquidjs17.toValue)(yield this.value.value(ctx, ctx.opts.lenientIf));
|
|
14951
14995
|
let branchHit = false;
|
|
14952
14996
|
let output = "";
|
|
14953
14997
|
for (const branch of this.branches) {
|
|
14954
14998
|
for (const valueToken of branch.values) {
|
|
14955
|
-
const value = yield (0,
|
|
14999
|
+
const value = yield (0, import_liquidjs17.evalToken)(valueToken, ctx, ctx.opts.lenientIf);
|
|
14956
15000
|
if (target === value) {
|
|
14957
15001
|
const blockOutput = yield r.renderTemplates(branch.templates, ctx);
|
|
14958
15002
|
output += blockOutput;
|
|
@@ -14985,15 +15029,15 @@ function bind2(liquidSwell) {
|
|
|
14985
15029
|
}
|
|
14986
15030
|
|
|
14987
15031
|
// src/liquid/tags/comment.ts
|
|
14988
|
-
var
|
|
15032
|
+
var import_liquidjs18 = require("liquidjs");
|
|
14989
15033
|
function bind3(_liquidSwell) {
|
|
14990
|
-
return class CommentTag extends
|
|
15034
|
+
return class CommentTag extends import_liquidjs18.Tag {
|
|
14991
15035
|
constructor(tagToken, remainTokens, liquid) {
|
|
14992
15036
|
super(tagToken, remainTokens, liquid);
|
|
14993
15037
|
let nested = 1;
|
|
14994
15038
|
while (remainTokens.length > 0) {
|
|
14995
15039
|
const token = remainTokens.shift();
|
|
14996
|
-
if (
|
|
15040
|
+
if (import_liquidjs18.TypeGuards.isTagToken(token)) {
|
|
14997
15041
|
switch (token.name) {
|
|
14998
15042
|
case "comment":
|
|
14999
15043
|
nested += 1;
|
|
@@ -15017,14 +15061,161 @@ function bind3(_liquidSwell) {
|
|
|
15017
15061
|
};
|
|
15018
15062
|
}
|
|
15019
15063
|
|
|
15064
|
+
// src/liquid/tags/content_for.ts
|
|
15065
|
+
var import_liquidjs22 = require("liquidjs");
|
|
15066
|
+
var import_lodash_es10 = require("lodash-es");
|
|
15067
|
+
|
|
15068
|
+
// src/liquid/hash.ts
|
|
15069
|
+
var import_lodash_es9 = require("lodash-es");
|
|
15070
|
+
var import_liquidjs21 = require("liquidjs");
|
|
15071
|
+
|
|
15072
|
+
// src/liquid/tokienizer.ts
|
|
15073
|
+
var import_liquidjs20 = require("liquidjs");
|
|
15074
|
+
|
|
15075
|
+
// src/liquid/tokens/identifier-token.ts
|
|
15076
|
+
var import_liquidjs19 = require("liquidjs");
|
|
15077
|
+
var IdentifierToken = class extends import_liquidjs19.Token {
|
|
15078
|
+
constructor(input, begin, end, file) {
|
|
15079
|
+
super(import_liquidjs19.TokenKind.Word, input, begin, end, file);
|
|
15080
|
+
this.input = input;
|
|
15081
|
+
this.begin = begin;
|
|
15082
|
+
this.end = end;
|
|
15083
|
+
this.file = file;
|
|
15084
|
+
this.content = this.getText();
|
|
15085
|
+
}
|
|
15086
|
+
content;
|
|
15087
|
+
};
|
|
15088
|
+
|
|
15089
|
+
// src/liquid/tokienizer.ts
|
|
15090
|
+
var isNumber2 = (c) => c >= "0" && c <= "9";
|
|
15091
|
+
var isCharacter = (c) => c >= "a" && c <= "z" || c >= "A" && c <= "Z";
|
|
15092
|
+
var isWord = (c) => "_-?".includes(c) || isCharacter(c) || isNumber2(c);
|
|
15093
|
+
var TokenizerSwell = class extends import_liquidjs20.Tokenizer {
|
|
15094
|
+
readIdentifier() {
|
|
15095
|
+
this.skipBlank();
|
|
15096
|
+
const begin = this.p;
|
|
15097
|
+
while (!this.end()) {
|
|
15098
|
+
const char = this.peek();
|
|
15099
|
+
if (isWord(char) || char === ".") {
|
|
15100
|
+
this.p++;
|
|
15101
|
+
} else {
|
|
15102
|
+
break;
|
|
15103
|
+
}
|
|
15104
|
+
}
|
|
15105
|
+
return new IdentifierToken(this.input, begin, this.p, this.file);
|
|
15106
|
+
}
|
|
15107
|
+
};
|
|
15108
|
+
|
|
15109
|
+
// src/liquid/hash.ts
|
|
15110
|
+
var HashSwell = class extends import_liquidjs21.Hash {
|
|
15111
|
+
constructor(input, jekyllStyle) {
|
|
15112
|
+
super(input, jekyllStyle);
|
|
15113
|
+
const tokenizer = input instanceof import_liquidjs21.Tokenizer ? input : new TokenizerSwell(input, {});
|
|
15114
|
+
for (const hash of tokenizer.readHashes(jekyllStyle)) {
|
|
15115
|
+
this.hash[hash.name.content] = hash.value;
|
|
15116
|
+
}
|
|
15117
|
+
}
|
|
15118
|
+
*render(ctx) {
|
|
15119
|
+
const hash = {};
|
|
15120
|
+
for (const key of Object.keys(this.hash)) {
|
|
15121
|
+
const token = this.hash[key];
|
|
15122
|
+
if (token !== void 0) {
|
|
15123
|
+
const value = yield (0, import_liquidjs21.evalToken)(token, ctx);
|
|
15124
|
+
(0, import_lodash_es9.set)(hash, key, value);
|
|
15125
|
+
}
|
|
15126
|
+
}
|
|
15127
|
+
return hash;
|
|
15128
|
+
}
|
|
15129
|
+
};
|
|
15130
|
+
|
|
15131
|
+
// src/liquid/tags/content_for.ts
|
|
15132
|
+
function bind4(liquidSwell) {
|
|
15133
|
+
return class ContentForTag extends import_liquidjs22.Tag {
|
|
15134
|
+
name;
|
|
15135
|
+
hash;
|
|
15136
|
+
constructor(token, remainTokens, liquid) {
|
|
15137
|
+
super(token, remainTokens, liquid);
|
|
15138
|
+
const tokenizer = token.tokenizer;
|
|
15139
|
+
this.name = tokenizer.readValue()?.content;
|
|
15140
|
+
this.hash = new HashSwell(tokenizer.remaining());
|
|
15141
|
+
}
|
|
15142
|
+
*render(ctx, emitter) {
|
|
15143
|
+
const section = yield ctx._get(["section"]);
|
|
15144
|
+
const block = yield ctx._get(["block"]);
|
|
15145
|
+
const hash = yield this.hash.render(ctx);
|
|
15146
|
+
const blocks = this.getBlocks(section, block, hash);
|
|
15147
|
+
for (const block2 of blocks) {
|
|
15148
|
+
if (!isObject2(block2) || typeof block2.type !== "string") {
|
|
15149
|
+
continue;
|
|
15150
|
+
}
|
|
15151
|
+
const blockPath = yield liquidSwell.getThemeBlockPath(
|
|
15152
|
+
block2.type
|
|
15153
|
+
);
|
|
15154
|
+
if (!blockPath) {
|
|
15155
|
+
continue;
|
|
15156
|
+
}
|
|
15157
|
+
const childCtx = ctx.spawn();
|
|
15158
|
+
const scope = childCtx.bottom();
|
|
15159
|
+
(0, import_lodash_es10.assign)(scope, { section });
|
|
15160
|
+
(0, import_lodash_es10.assign)(scope, { block: block2 });
|
|
15161
|
+
(0, import_lodash_es10.assign)(scope, hash);
|
|
15162
|
+
const templates = yield this.liquid._parseFile(
|
|
15163
|
+
blockPath,
|
|
15164
|
+
childCtx.sync
|
|
15165
|
+
);
|
|
15166
|
+
yield this.liquid.renderer.renderTemplates(
|
|
15167
|
+
templates,
|
|
15168
|
+
childCtx,
|
|
15169
|
+
emitter
|
|
15170
|
+
);
|
|
15171
|
+
}
|
|
15172
|
+
}
|
|
15173
|
+
getBlocks(section, block, hash) {
|
|
15174
|
+
const blockConfigs = this.getBlockConfigs(section, block);
|
|
15175
|
+
if (!isObject2(hash) || !hash.type) {
|
|
15176
|
+
return blockConfigs;
|
|
15177
|
+
}
|
|
15178
|
+
const blockConfig = blockConfigs.find(
|
|
15179
|
+
(blockConfig2) => isObject2(blockConfig2) && blockConfig2.type === hash.type
|
|
15180
|
+
);
|
|
15181
|
+
return blockConfig ? [blockConfig] : [];
|
|
15182
|
+
}
|
|
15183
|
+
getBlockConfigs(section, block) {
|
|
15184
|
+
if (isObject2(block) && block.blocks) {
|
|
15185
|
+
return Object.values(block.blocks);
|
|
15186
|
+
}
|
|
15187
|
+
if (isObject2(section) && Array.isArray(section.blocks)) {
|
|
15188
|
+
return section.blocks;
|
|
15189
|
+
}
|
|
15190
|
+
return [];
|
|
15191
|
+
}
|
|
15192
|
+
};
|
|
15193
|
+
}
|
|
15194
|
+
|
|
15195
|
+
// src/liquid/tags/doc.ts
|
|
15196
|
+
var import_liquidjs23 = require("liquidjs");
|
|
15197
|
+
function bind5() {
|
|
15198
|
+
return class DocTag extends import_liquidjs23.Tag {
|
|
15199
|
+
constructor(token, remainTokens, liquid, parser) {
|
|
15200
|
+
super(token, remainTokens, liquid);
|
|
15201
|
+
const stream = parser.parseStream(remainTokens).on("tag:enddoc", () => {
|
|
15202
|
+
stream.stop();
|
|
15203
|
+
});
|
|
15204
|
+
stream.start();
|
|
15205
|
+
}
|
|
15206
|
+
render() {
|
|
15207
|
+
}
|
|
15208
|
+
};
|
|
15209
|
+
}
|
|
15210
|
+
|
|
15020
15211
|
// src/liquid/tags/for.ts
|
|
15021
|
-
var
|
|
15212
|
+
var import_liquidjs24 = require("liquidjs");
|
|
15022
15213
|
var MODIFIERS = Object.freeze(["offset", "limit", "reversed"]);
|
|
15023
|
-
function
|
|
15024
|
-
return class ForTag extends
|
|
15214
|
+
function bind6(_liquidSwell) {
|
|
15215
|
+
return class ForTag extends import_liquidjs24.ForTag {
|
|
15025
15216
|
*render(ctx, emitter) {
|
|
15026
15217
|
const r = this.liquid.renderer;
|
|
15027
|
-
let collection = yield (0,
|
|
15218
|
+
let collection = yield (0, import_liquidjs24.evalToken)(this.collection, ctx);
|
|
15028
15219
|
collection = yield resolveEnumerable(collection);
|
|
15029
15220
|
if (!collection.length) {
|
|
15030
15221
|
yield r.renderTemplates(this.elseTemplates, ctx, emitter);
|
|
@@ -15091,10 +15282,10 @@ function limit(arr, count) {
|
|
|
15091
15282
|
}
|
|
15092
15283
|
|
|
15093
15284
|
// src/liquid/tags/form.ts
|
|
15094
|
-
var
|
|
15285
|
+
var import_liquidjs25 = require("liquidjs");
|
|
15095
15286
|
var IGNORED_SHOPIFY_FORMS = Object.freeze(["new_comment", "guest_login"]);
|
|
15096
|
-
function
|
|
15097
|
-
return class FormTag extends
|
|
15287
|
+
function bind7(liquidSwell) {
|
|
15288
|
+
return class FormTag extends import_liquidjs25.Tag {
|
|
15098
15289
|
formType;
|
|
15099
15290
|
formConfig;
|
|
15100
15291
|
templates;
|
|
@@ -15107,10 +15298,10 @@ function bind5(liquidSwell) {
|
|
|
15107
15298
|
this.formConfig = liquidSwell.theme.getFormConfig(this.formType);
|
|
15108
15299
|
this.arg = tokenizer.readValue();
|
|
15109
15300
|
this.templates = [];
|
|
15110
|
-
this.hash = new
|
|
15301
|
+
this.hash = new import_liquidjs25.Hash(this.tokenizer.remaining());
|
|
15111
15302
|
while (remainTokens.length > 0) {
|
|
15112
15303
|
const token2 = remainTokens.shift();
|
|
15113
|
-
if (
|
|
15304
|
+
if (import_liquidjs25.TypeGuards.isTagToken(token2) && token2.name === "endform") {
|
|
15114
15305
|
return;
|
|
15115
15306
|
}
|
|
15116
15307
|
this.templates.push(parser.parseToken(token2, remainTokens));
|
|
@@ -15128,7 +15319,7 @@ function bind5(liquidSwell) {
|
|
|
15128
15319
|
return;
|
|
15129
15320
|
}
|
|
15130
15321
|
const r = this.liquid.renderer;
|
|
15131
|
-
const arg = yield (0,
|
|
15322
|
+
const arg = yield (0, import_liquidjs25.evalToken)(this.arg, ctx);
|
|
15132
15323
|
const hash = yield this.hash.render(ctx);
|
|
15133
15324
|
const scope = ctx.getAll();
|
|
15134
15325
|
const attrs = " " + Object.entries({ id: `${this.formConfig.id}_form`, ...hash }).reduce((acc, [key, value]) => {
|
|
@@ -15189,9 +15380,9 @@ function bind5(liquidSwell) {
|
|
|
15189
15380
|
}
|
|
15190
15381
|
|
|
15191
15382
|
// src/liquid/tags/if.ts
|
|
15192
|
-
var
|
|
15193
|
-
function
|
|
15194
|
-
return class IfTag extends
|
|
15383
|
+
var import_liquidjs26 = require("liquidjs");
|
|
15384
|
+
function bind8(_liquidSwell) {
|
|
15385
|
+
return class IfTag extends import_liquidjs26.Tag {
|
|
15195
15386
|
branches = [];
|
|
15196
15387
|
elseTemplates;
|
|
15197
15388
|
constructor(tagToken, remainTokens, liquid, parser) {
|
|
@@ -15200,22 +15391,22 @@ function bind6(_liquidSwell) {
|
|
|
15200
15391
|
parser.parseStream(remainTokens).on(
|
|
15201
15392
|
"start",
|
|
15202
15393
|
() => this.branches.push({
|
|
15203
|
-
value: new
|
|
15394
|
+
value: new import_liquidjs26.Value(
|
|
15204
15395
|
tagToken.tokenizer.readFilteredValue(),
|
|
15205
15396
|
this.liquid
|
|
15206
15397
|
),
|
|
15207
15398
|
templates: p = []
|
|
15208
15399
|
})
|
|
15209
15400
|
).on("tag:elsif", (token) => {
|
|
15210
|
-
(0,
|
|
15401
|
+
(0, import_liquidjs26.assert)(!this.elseTemplates, "unexpected elsif after else");
|
|
15211
15402
|
this.branches.push({
|
|
15212
|
-
value: new
|
|
15403
|
+
value: new import_liquidjs26.Value(token.tokenizer.readFilteredValue(), this.liquid),
|
|
15213
15404
|
templates: p = []
|
|
15214
15405
|
});
|
|
15215
15406
|
}).on("tag:else", (tag) => {
|
|
15216
15407
|
if (tag.args.length > 0) {
|
|
15217
15408
|
this.branches.push({
|
|
15218
|
-
value: new
|
|
15409
|
+
value: new import_liquidjs26.Value(tag.tokenizer.readFilteredValue(), this.liquid),
|
|
15219
15410
|
templates: p = []
|
|
15220
15411
|
});
|
|
15221
15412
|
} else {
|
|
@@ -15233,7 +15424,7 @@ function bind6(_liquidSwell) {
|
|
|
15233
15424
|
const r = this.liquid.renderer;
|
|
15234
15425
|
for (const { value, templates } of this.branches) {
|
|
15235
15426
|
const v = yield value.value(ctx, ctx.opts.lenientIf);
|
|
15236
|
-
if ((0,
|
|
15427
|
+
if ((0, import_liquidjs26.isTruthy)(v, ctx)) {
|
|
15237
15428
|
yield r.renderTemplates(templates, ctx, emitter);
|
|
15238
15429
|
return;
|
|
15239
15430
|
}
|
|
@@ -15254,20 +15445,20 @@ function bind6(_liquidSwell) {
|
|
|
15254
15445
|
};
|
|
15255
15446
|
}
|
|
15256
15447
|
function assertEmpty(predicate, message = `unexpected ${JSON.stringify(predicate)}`) {
|
|
15257
|
-
(0,
|
|
15448
|
+
(0, import_liquidjs26.assert)(!predicate, message);
|
|
15258
15449
|
}
|
|
15259
15450
|
|
|
15260
15451
|
// src/liquid/tags/javascript.ts
|
|
15261
|
-
var
|
|
15262
|
-
function
|
|
15263
|
-
return class JavascriptTag extends
|
|
15452
|
+
var import_liquidjs27 = require("liquidjs");
|
|
15453
|
+
function bind9(_liquidSwell) {
|
|
15454
|
+
return class JavascriptTag extends import_liquidjs27.Tag {
|
|
15264
15455
|
templates;
|
|
15265
15456
|
constructor(token, remainTokens, liquid, parser) {
|
|
15266
15457
|
super(token, remainTokens, liquid);
|
|
15267
15458
|
this.templates = [];
|
|
15268
15459
|
while (remainTokens.length > 0) {
|
|
15269
15460
|
const token2 = remainTokens.shift();
|
|
15270
|
-
if (
|
|
15461
|
+
if (import_liquidjs27.TypeGuards.isTagToken(token2) && token2.name === "endjavascript") {
|
|
15271
15462
|
return;
|
|
15272
15463
|
}
|
|
15273
15464
|
this.templates.push(parser.parseToken(token2, remainTokens));
|
|
@@ -15285,9 +15476,9 @@ function bind7(_liquidSwell) {
|
|
|
15285
15476
|
}
|
|
15286
15477
|
|
|
15287
15478
|
// src/liquid/tags/layout.ts
|
|
15288
|
-
var
|
|
15289
|
-
function
|
|
15290
|
-
return class LayoutTag extends
|
|
15479
|
+
var import_liquidjs28 = require("liquidjs");
|
|
15480
|
+
function bind10(liquidSwell) {
|
|
15481
|
+
return class LayoutTag extends import_liquidjs28.Tag {
|
|
15291
15482
|
fileName;
|
|
15292
15483
|
constructor(token, remainTokens, liquid, _parser) {
|
|
15293
15484
|
super(token, remainTokens, liquid);
|
|
@@ -15303,9 +15494,9 @@ function bind8(liquidSwell) {
|
|
|
15303
15494
|
}
|
|
15304
15495
|
|
|
15305
15496
|
// src/liquid/tags/paginate.ts
|
|
15306
|
-
var
|
|
15307
|
-
function
|
|
15308
|
-
return class PaginateTag extends
|
|
15497
|
+
var import_liquidjs29 = require("liquidjs");
|
|
15498
|
+
function bind11(liquidSwell) {
|
|
15499
|
+
return class PaginateTag extends import_liquidjs29.Tag {
|
|
15309
15500
|
collection;
|
|
15310
15501
|
pageSize;
|
|
15311
15502
|
templates;
|
|
@@ -15320,7 +15511,7 @@ function bind9(liquidSwell) {
|
|
|
15320
15511
|
}
|
|
15321
15512
|
this.templates = [];
|
|
15322
15513
|
this.collection = collection;
|
|
15323
|
-
this.hash = new
|
|
15514
|
+
this.hash = new import_liquidjs29.Hash(this.tokenizer.remaining());
|
|
15324
15515
|
const stream = parser.parseStream(remainTokens).on("tag:endpaginate", () => stream.stop()).on("template", (tpl) => {
|
|
15325
15516
|
this.templates.push(tpl);
|
|
15326
15517
|
}).on("end", () => {
|
|
@@ -15330,8 +15521,8 @@ function bind9(liquidSwell) {
|
|
|
15330
15521
|
}
|
|
15331
15522
|
*render(ctx, emitter) {
|
|
15332
15523
|
const r = this.liquid.renderer;
|
|
15333
|
-
const collection = yield (0,
|
|
15334
|
-
const pageSize = Number(yield (0,
|
|
15524
|
+
const collection = yield (0, import_liquidjs29.evalToken)(this.collection, ctx);
|
|
15525
|
+
const pageSize = Number(yield (0, import_liquidjs29.evalToken)(this.pageSize, ctx));
|
|
15335
15526
|
const hash = yield this.hash.render(ctx);
|
|
15336
15527
|
if (!Number.isNaN(pageSize) && collection instanceof SwellStorefrontCollection && collection.limit !== pageSize) {
|
|
15337
15528
|
yield collection._get({
|
|
@@ -15357,10 +15548,10 @@ function bind9(liquidSwell) {
|
|
|
15357
15548
|
}
|
|
15358
15549
|
|
|
15359
15550
|
// src/liquid/tags/render.ts
|
|
15360
|
-
var
|
|
15361
|
-
var
|
|
15362
|
-
function
|
|
15363
|
-
return class RenderTag extends
|
|
15551
|
+
var import_lodash_es11 = require("lodash-es");
|
|
15552
|
+
var import_liquidjs30 = require("liquidjs");
|
|
15553
|
+
function bind12(liquidSwell) {
|
|
15554
|
+
return class RenderTag extends import_liquidjs30.RenderTag {
|
|
15364
15555
|
*render(ctx, emitter) {
|
|
15365
15556
|
const self = this;
|
|
15366
15557
|
const { liquid } = this;
|
|
@@ -15370,23 +15561,26 @@ function bind10(liquidSwell) {
|
|
|
15370
15561
|
ctx,
|
|
15371
15562
|
liquid
|
|
15372
15563
|
);
|
|
15373
|
-
(0,
|
|
15564
|
+
(0, import_liquidjs30.assert)(filename, () => `illegal file path "${filename}"`);
|
|
15374
15565
|
const configPath = yield liquidSwell.getComponentPath(
|
|
15375
15566
|
filename
|
|
15376
15567
|
);
|
|
15377
15568
|
const childCtx = ctx.spawn();
|
|
15378
15569
|
const scope = childCtx.bottom();
|
|
15379
|
-
(0,
|
|
15570
|
+
(0, import_lodash_es11.assign)(scope, ctx.bottom());
|
|
15380
15571
|
const parentSection = yield ctx._get(["section"]);
|
|
15381
|
-
if (parentSection) (0,
|
|
15572
|
+
if (parentSection) (0, import_lodash_es11.assign)(scope, { section: parentSection });
|
|
15573
|
+
const parentBlock = yield ctx._get(["block"]);
|
|
15574
|
+
if (parentBlock) (0, import_lodash_es11.assign)(scope, { block: parentBlock });
|
|
15575
|
+
(0, import_lodash_es11.assign)(scope, yield hash.render(ctx));
|
|
15382
15576
|
if (self["with"]) {
|
|
15383
15577
|
const { value, alias } = self["with"];
|
|
15384
15578
|
const aliasName = alias || filename;
|
|
15385
|
-
scope[aliasName] = yield (0,
|
|
15579
|
+
scope[aliasName] = yield (0, import_liquidjs30.evalToken)(value, ctx);
|
|
15386
15580
|
}
|
|
15387
15581
|
if (self["for"]) {
|
|
15388
15582
|
const { value, alias } = self["for"];
|
|
15389
|
-
let collection = yield (0,
|
|
15583
|
+
let collection = yield (0, import_liquidjs30.evalToken)(value, ctx);
|
|
15390
15584
|
collection = yield resolveEnumerable(collection);
|
|
15391
15585
|
scope["forloop"] = new ForloopDrop(
|
|
15392
15586
|
collection.length,
|
|
@@ -15429,13 +15623,13 @@ function* renderFilePath(file, ctx, liquid) {
|
|
|
15429
15623
|
default:
|
|
15430
15624
|
break;
|
|
15431
15625
|
}
|
|
15432
|
-
return yield (0,
|
|
15626
|
+
return yield (0, import_liquidjs30.evalToken)(file, ctx);
|
|
15433
15627
|
}
|
|
15434
15628
|
|
|
15435
15629
|
// src/liquid/tags/section.ts
|
|
15436
|
-
var
|
|
15437
|
-
function
|
|
15438
|
-
return class SectionTag extends
|
|
15630
|
+
var import_liquidjs31 = require("liquidjs");
|
|
15631
|
+
function bind13(liquidSwell) {
|
|
15632
|
+
return class SectionTag extends import_liquidjs31.Tag {
|
|
15439
15633
|
fileName;
|
|
15440
15634
|
constructor(token, remainTokens, liquid, _parser) {
|
|
15441
15635
|
super(token, remainTokens, liquid);
|
|
@@ -15486,10 +15680,10 @@ function bind11(liquidSwell) {
|
|
|
15486
15680
|
}
|
|
15487
15681
|
|
|
15488
15682
|
// src/liquid/tags/sections.ts
|
|
15489
|
-
var
|
|
15683
|
+
var import_liquidjs32 = require("liquidjs");
|
|
15490
15684
|
var import_json54 = __toESM(require("json5"), 1);
|
|
15491
|
-
function
|
|
15492
|
-
return class SectionsTag extends
|
|
15685
|
+
function bind14(liquidSwell) {
|
|
15686
|
+
return class SectionsTag extends import_liquidjs32.Tag {
|
|
15493
15687
|
fileName;
|
|
15494
15688
|
constructor(token, remainTokens, liquid, _parser) {
|
|
15495
15689
|
super(token, remainTokens, liquid);
|
|
@@ -15529,9 +15723,9 @@ function bind12(liquidSwell) {
|
|
|
15529
15723
|
}
|
|
15530
15724
|
|
|
15531
15725
|
// src/liquid/tags/style.ts
|
|
15532
|
-
var
|
|
15533
|
-
function
|
|
15534
|
-
return class StyleTag extends
|
|
15726
|
+
var import_liquidjs33 = require("liquidjs");
|
|
15727
|
+
function bind15(_liquidSwell) {
|
|
15728
|
+
return class StyleTag extends import_liquidjs33.Tag {
|
|
15535
15729
|
templates;
|
|
15536
15730
|
hash;
|
|
15537
15731
|
constructor(token, remainTokens, liquid, parser) {
|
|
@@ -15540,7 +15734,7 @@ function bind13(_liquidSwell) {
|
|
|
15540
15734
|
const tagBegin = token.begin;
|
|
15541
15735
|
while (remainTokens.length > 0) {
|
|
15542
15736
|
const token2 = remainTokens.shift();
|
|
15543
|
-
if (
|
|
15737
|
+
if (import_liquidjs33.TypeGuards.isTagToken(token2) && token2.name === "endstyle") {
|
|
15544
15738
|
this.hash = md5(token2.input.slice(tagBegin, token2.end));
|
|
15545
15739
|
return;
|
|
15546
15740
|
}
|
|
@@ -15563,16 +15757,16 @@ function bind13(_liquidSwell) {
|
|
|
15563
15757
|
}
|
|
15564
15758
|
|
|
15565
15759
|
// src/liquid/tags/stylesheet.ts
|
|
15566
|
-
var
|
|
15567
|
-
function
|
|
15568
|
-
return class StyleSheetTag extends
|
|
15760
|
+
var import_liquidjs34 = require("liquidjs");
|
|
15761
|
+
function bind16(_liquidSwell) {
|
|
15762
|
+
return class StyleSheetTag extends import_liquidjs34.Tag {
|
|
15569
15763
|
templates;
|
|
15570
15764
|
constructor(token, remainTokens, liquid, parser) {
|
|
15571
15765
|
super(token, remainTokens, liquid);
|
|
15572
15766
|
this.templates = [];
|
|
15573
15767
|
while (remainTokens.length > 0) {
|
|
15574
15768
|
const token2 = remainTokens.shift();
|
|
15575
|
-
if (
|
|
15769
|
+
if (import_liquidjs34.TypeGuards.isTagToken(token2) && token2.name === "endstylesheet") {
|
|
15576
15770
|
return;
|
|
15577
15771
|
}
|
|
15578
15772
|
this.templates.push(parser.parseToken(token2, remainTokens));
|
|
@@ -15588,9 +15782,9 @@ function bind14(_liquidSwell) {
|
|
|
15588
15782
|
}
|
|
15589
15783
|
|
|
15590
15784
|
// src/liquid/tags/shopify/include.ts
|
|
15591
|
-
var
|
|
15592
|
-
function
|
|
15593
|
-
return class IncludeTag extends
|
|
15785
|
+
var import_liquidjs35 = require("liquidjs");
|
|
15786
|
+
function bind17(liquidSwell) {
|
|
15787
|
+
return class IncludeTag extends import_liquidjs35.IncludeTag {
|
|
15594
15788
|
*render(ctx, emitter) {
|
|
15595
15789
|
const { hash } = this;
|
|
15596
15790
|
const filepath = yield renderFilePath(
|
|
@@ -15598,13 +15792,13 @@ function bind15(liquidSwell) {
|
|
|
15598
15792
|
ctx,
|
|
15599
15793
|
this.liquid
|
|
15600
15794
|
);
|
|
15601
|
-
(0,
|
|
15795
|
+
(0, import_liquidjs35.assert)(filepath, () => `illegal file path "${filepath}"`);
|
|
15602
15796
|
const saved = ctx.saveRegister("blocks", "blockMode");
|
|
15603
15797
|
ctx.setRegister("blocks", {});
|
|
15604
15798
|
ctx.setRegister("blockMode", 0);
|
|
15605
15799
|
const scope = yield hash.render(ctx);
|
|
15606
15800
|
if (this.withVar) {
|
|
15607
|
-
scope[filepath] = yield (0,
|
|
15801
|
+
scope[filepath] = yield (0, import_liquidjs35.evalToken)(this.withVar, ctx);
|
|
15608
15802
|
}
|
|
15609
15803
|
ctx.push(ctx.opts.jekyllInclude ? { include: scope } : scope);
|
|
15610
15804
|
const output = yield liquidSwell.getComponentPath(filepath).then((path) => liquidSwell.getThemeConfig(path)).then((themeConfig) => liquidSwell.renderTemplate(themeConfig, ctx));
|
|
@@ -15616,10 +15810,10 @@ function bind15(liquidSwell) {
|
|
|
15616
15810
|
}
|
|
15617
15811
|
|
|
15618
15812
|
// src/liquid/tags/shopify/schema.ts
|
|
15619
|
-
var
|
|
15813
|
+
var import_liquidjs36 = require("liquidjs");
|
|
15620
15814
|
var import_json55 = __toESM(require("json5"), 1);
|
|
15621
|
-
function
|
|
15622
|
-
return class SchemaTag extends
|
|
15815
|
+
function bind18(liquidSwell) {
|
|
15816
|
+
return class SchemaTag extends import_liquidjs36.Tag {
|
|
15623
15817
|
templates;
|
|
15624
15818
|
constructor(token, remainTokens, liquid, parser) {
|
|
15625
15819
|
super(token, remainTokens, liquid);
|
|
@@ -15641,6 +15835,7 @@ function bind16(liquidSwell) {
|
|
|
15641
15835
|
liquidSwell.lastSchema = void 0;
|
|
15642
15836
|
if (typeof jsonOutput === "string") {
|
|
15643
15837
|
liquidSwell.lastSchema = import_json55.default.parse(jsonOutput);
|
|
15838
|
+
expandThemeBlocks(liquidSwell);
|
|
15644
15839
|
}
|
|
15645
15840
|
} catch (err) {
|
|
15646
15841
|
console.warn(err);
|
|
@@ -15650,11 +15845,22 @@ function bind16(liquidSwell) {
|
|
|
15650
15845
|
}
|
|
15651
15846
|
};
|
|
15652
15847
|
}
|
|
15848
|
+
function expandThemeBlocks(liquidSwell) {
|
|
15849
|
+
const blocks = liquidSwell.lastSchema?.blocks;
|
|
15850
|
+
if (!Array.isArray(blocks)) {
|
|
15851
|
+
return;
|
|
15852
|
+
}
|
|
15853
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
15854
|
+
if (blocks[i].type === "@theme") {
|
|
15855
|
+
blocks.splice(i, 1, ...liquidSwell.theme.getAllThemeBlockSchemas());
|
|
15856
|
+
}
|
|
15857
|
+
}
|
|
15858
|
+
}
|
|
15653
15859
|
|
|
15654
15860
|
// src/liquid/tags/inline_editable.ts
|
|
15655
|
-
var
|
|
15656
|
-
function
|
|
15657
|
-
return class InlineEditableTag extends
|
|
15861
|
+
var import_liquidjs37 = require("liquidjs");
|
|
15862
|
+
function bind19(_liquidSwell) {
|
|
15863
|
+
return class InlineEditableTag extends import_liquidjs37.Tag {
|
|
15658
15864
|
key;
|
|
15659
15865
|
value;
|
|
15660
15866
|
constructor(token, remainTokens, liquid, _parser) {
|
|
@@ -15682,129 +15888,131 @@ var tags = {
|
|
|
15682
15888
|
assign: bind,
|
|
15683
15889
|
case: bind2,
|
|
15684
15890
|
comment: bind3,
|
|
15685
|
-
|
|
15686
|
-
|
|
15687
|
-
|
|
15688
|
-
|
|
15689
|
-
|
|
15690
|
-
|
|
15691
|
-
|
|
15692
|
-
|
|
15693
|
-
|
|
15694
|
-
|
|
15891
|
+
content_for: bind4,
|
|
15892
|
+
doc: bind5,
|
|
15893
|
+
for: bind6,
|
|
15894
|
+
form: bind7,
|
|
15895
|
+
if: bind8,
|
|
15896
|
+
javascript: bind9,
|
|
15897
|
+
layout: bind10,
|
|
15898
|
+
paginate: bind11,
|
|
15899
|
+
render: bind12,
|
|
15900
|
+
section: bind13,
|
|
15901
|
+
sections: bind14,
|
|
15902
|
+
style: bind15,
|
|
15695
15903
|
// Shopify compatibility only
|
|
15696
|
-
include:
|
|
15697
|
-
schema:
|
|
15698
|
-
stylesheet:
|
|
15904
|
+
include: bind17,
|
|
15905
|
+
schema: bind18,
|
|
15906
|
+
stylesheet: bind16,
|
|
15699
15907
|
// Swell only
|
|
15700
|
-
inline_editable:
|
|
15908
|
+
inline_editable: bind19
|
|
15701
15909
|
};
|
|
15702
15910
|
function bindTags(liquidSwell) {
|
|
15703
15911
|
Object.entries(tags).forEach(
|
|
15704
|
-
([tag,
|
|
15912
|
+
([tag, bind70]) => liquidSwell.registerTag(tag, bind70(liquidSwell))
|
|
15705
15913
|
);
|
|
15706
15914
|
}
|
|
15707
15915
|
|
|
15708
15916
|
// src/liquid/filters/asset_url.ts
|
|
15709
|
-
function
|
|
15917
|
+
function bind20(liquidSwell) {
|
|
15710
15918
|
return function filterAssetUrl(assetPath) {
|
|
15711
15919
|
return liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
|
|
15712
15920
|
};
|
|
15713
15921
|
}
|
|
15714
15922
|
|
|
15715
15923
|
// src/liquid/filters/brightness_difference.ts
|
|
15716
|
-
function
|
|
15924
|
+
function bind21(_liquidSwell) {
|
|
15717
15925
|
return (color1, color2) => {
|
|
15718
15926
|
return ThemeColor.get(color1).brightnessDifference(ThemeColor.get(color2));
|
|
15719
15927
|
};
|
|
15720
15928
|
}
|
|
15721
15929
|
|
|
15722
15930
|
// src/liquid/filters/color_brightness.ts
|
|
15723
|
-
function
|
|
15931
|
+
function bind22(_liquidSwell) {
|
|
15724
15932
|
return (color) => {
|
|
15725
15933
|
return ThemeColor.get(color).brightness();
|
|
15726
15934
|
};
|
|
15727
15935
|
}
|
|
15728
15936
|
|
|
15729
15937
|
// src/liquid/filters/color_contrast.ts
|
|
15730
|
-
function
|
|
15938
|
+
function bind23(_liquidSwell) {
|
|
15731
15939
|
return (color1, color2) => {
|
|
15732
15940
|
return ThemeColor.get(color1).contrast(ThemeColor.get(color2));
|
|
15733
15941
|
};
|
|
15734
15942
|
}
|
|
15735
15943
|
|
|
15736
15944
|
// src/liquid/filters/color_darken.ts
|
|
15737
|
-
function
|
|
15945
|
+
function bind24(_liquidSwell) {
|
|
15738
15946
|
return (color, percent) => {
|
|
15739
15947
|
return ThemeColor.get(color).darken(percent);
|
|
15740
15948
|
};
|
|
15741
15949
|
}
|
|
15742
15950
|
|
|
15743
15951
|
// src/liquid/filters/color_desaturate.ts
|
|
15744
|
-
function
|
|
15952
|
+
function bind25(_liquidSwell) {
|
|
15745
15953
|
return (color, value) => {
|
|
15746
15954
|
return ThemeColor.get(color).desaturate(value);
|
|
15747
15955
|
};
|
|
15748
15956
|
}
|
|
15749
15957
|
|
|
15750
15958
|
// src/liquid/filters/color_difference.ts
|
|
15751
|
-
function
|
|
15959
|
+
function bind26(_liquidSwell) {
|
|
15752
15960
|
return (color1, color2) => {
|
|
15753
15961
|
return ThemeColor.get(color1).difference(ThemeColor.get(color2));
|
|
15754
15962
|
};
|
|
15755
15963
|
}
|
|
15756
15964
|
|
|
15757
15965
|
// src/liquid/filters/color_extract.ts
|
|
15758
|
-
function
|
|
15966
|
+
function bind27(_liquidSwell) {
|
|
15759
15967
|
return (color, field) => {
|
|
15760
15968
|
return ThemeColor.get(color).extract(field);
|
|
15761
15969
|
};
|
|
15762
15970
|
}
|
|
15763
15971
|
|
|
15764
15972
|
// src/liquid/filters/color_lighten.ts
|
|
15765
|
-
function
|
|
15973
|
+
function bind28(_liquidSwell) {
|
|
15766
15974
|
return (color, percent) => {
|
|
15767
15975
|
return ThemeColor.get(color).lighten(percent);
|
|
15768
15976
|
};
|
|
15769
15977
|
}
|
|
15770
15978
|
|
|
15771
15979
|
// src/liquid/filters/color_mix.ts
|
|
15772
|
-
function
|
|
15980
|
+
function bind29(_liquidSwell) {
|
|
15773
15981
|
return (color1, color2, ratio) => {
|
|
15774
15982
|
return ThemeColor.get(color1).mix(ThemeColor.get(color2), ratio);
|
|
15775
15983
|
};
|
|
15776
15984
|
}
|
|
15777
15985
|
|
|
15778
15986
|
// src/liquid/filters/color_modify.ts
|
|
15779
|
-
function
|
|
15987
|
+
function bind30(_liquidSwell) {
|
|
15780
15988
|
return function filterColorModify(color, field, value) {
|
|
15781
15989
|
return ThemeColor.get(color).modify(field, Number(value) || 0);
|
|
15782
15990
|
};
|
|
15783
15991
|
}
|
|
15784
15992
|
|
|
15785
15993
|
// src/liquid/filters/color_saturate.ts
|
|
15786
|
-
function
|
|
15994
|
+
function bind31(_liquidSwell) {
|
|
15787
15995
|
return (color, value) => {
|
|
15788
15996
|
return ThemeColor.get(color).saturate(value);
|
|
15789
15997
|
};
|
|
15790
15998
|
}
|
|
15791
15999
|
|
|
15792
16000
|
// src/liquid/filters/color_to_hex.ts
|
|
15793
|
-
function
|
|
16001
|
+
function bind32(_liquidSwell) {
|
|
15794
16002
|
return (color) => {
|
|
15795
16003
|
return ThemeColor.get(color).hex();
|
|
15796
16004
|
};
|
|
15797
16005
|
}
|
|
15798
16006
|
|
|
15799
16007
|
// src/liquid/filters/color_to_hsl.ts
|
|
15800
|
-
function
|
|
16008
|
+
function bind33(_liquidSwell) {
|
|
15801
16009
|
return (color) => {
|
|
15802
16010
|
return ThemeColor.get(color).hsl();
|
|
15803
16011
|
};
|
|
15804
16012
|
}
|
|
15805
16013
|
|
|
15806
16014
|
// src/liquid/filters/color_to_rgb.ts
|
|
15807
|
-
function
|
|
16015
|
+
function bind34(_liquidSwell) {
|
|
15808
16016
|
return (color, alpha) => {
|
|
15809
16017
|
return alpha !== void 0 ? ThemeColor.get(color).rgba(alpha) : ThemeColor.get(color).rgb();
|
|
15810
16018
|
};
|
|
@@ -15812,7 +16020,7 @@ function bind32(_liquidSwell) {
|
|
|
15812
16020
|
|
|
15813
16021
|
// src/liquid/filters/date.ts
|
|
15814
16022
|
var import_strftime = __toESM(require("strftime"), 1);
|
|
15815
|
-
function
|
|
16023
|
+
function bind35(_liquidSwell) {
|
|
15816
16024
|
return (dateValue, ...params) => {
|
|
15817
16025
|
const date = ensureDate(dateValue);
|
|
15818
16026
|
const { format } = getDateFilterParams(params);
|
|
@@ -15870,7 +16078,7 @@ function applyStrftimeFormat(format, date) {
|
|
|
15870
16078
|
}
|
|
15871
16079
|
|
|
15872
16080
|
// src/liquid/filters/date_next_interval.ts
|
|
15873
|
-
function
|
|
16081
|
+
function bind36(_liquidSwell) {
|
|
15874
16082
|
return (dateValue, interval, intervalCount) => {
|
|
15875
16083
|
const date = ensureDate(dateValue);
|
|
15876
16084
|
const result = getNextIntervalDate(date, interval, Number(intervalCount));
|
|
@@ -15922,7 +16130,7 @@ function time(date) {
|
|
|
15922
16130
|
}
|
|
15923
16131
|
|
|
15924
16132
|
// src/liquid/filters/default_errors.ts
|
|
15925
|
-
function
|
|
16133
|
+
function bind37(_liquidSwell) {
|
|
15926
16134
|
return async function filterDefaultError(errors) {
|
|
15927
16135
|
if (!errors) {
|
|
15928
16136
|
return "";
|
|
@@ -15948,7 +16156,7 @@ function bind35(_liquidSwell) {
|
|
|
15948
16156
|
}
|
|
15949
16157
|
|
|
15950
16158
|
// src/liquid/filters/divided_by.ts
|
|
15951
|
-
function
|
|
16159
|
+
function bind38(_liquidSwell) {
|
|
15952
16160
|
return (dividend, divisor, integerArithmetic) => {
|
|
15953
16161
|
if (!isNumber(dividend) || !isNumber(divisor)) {
|
|
15954
16162
|
return dividend;
|
|
@@ -15958,20 +16166,20 @@ function bind36(_liquidSwell) {
|
|
|
15958
16166
|
}
|
|
15959
16167
|
|
|
15960
16168
|
// src/liquid/filters/embedded_content.ts
|
|
15961
|
-
var
|
|
15962
|
-
function
|
|
16169
|
+
var import_lodash_es12 = require("lodash-es");
|
|
16170
|
+
function bind39(_liquidSwell) {
|
|
15963
16171
|
return (value, tag = "iframe") => {
|
|
15964
16172
|
const escapeIframes = value.replaceAll(`<${tag}`, `<${tag}`).replaceAll(`</${tag}`, `</${tag}`);
|
|
15965
16173
|
const removeTags = escapeIframes.replaceAll(/<(.*?)>/gi, "");
|
|
15966
|
-
const unescaped = (0,
|
|
16174
|
+
const unescaped = (0, import_lodash_es12.unescape)(removeTags);
|
|
15967
16175
|
const replaceSpaces = unescaped.replaceAll(" ", " ");
|
|
15968
16176
|
return replaceSpaces;
|
|
15969
16177
|
};
|
|
15970
16178
|
}
|
|
15971
16179
|
|
|
15972
16180
|
// src/liquid/filters/escape.ts
|
|
15973
|
-
var
|
|
15974
|
-
function
|
|
16181
|
+
var import_lodash_es13 = require("lodash-es");
|
|
16182
|
+
function bind40(_liquidSwell) {
|
|
15975
16183
|
return function escapeTag(input) {
|
|
15976
16184
|
if (!input?.startsWith) {
|
|
15977
16185
|
return input;
|
|
@@ -15979,12 +16187,12 @@ function bind38(_liquidSwell) {
|
|
|
15979
16187
|
if (input.startsWith("<img") || input.startsWith("<video")) {
|
|
15980
16188
|
return input;
|
|
15981
16189
|
}
|
|
15982
|
-
return (0,
|
|
16190
|
+
return (0, import_lodash_es13.escape)(input);
|
|
15983
16191
|
};
|
|
15984
16192
|
}
|
|
15985
16193
|
|
|
15986
16194
|
// src/liquid/filters/font_face.ts
|
|
15987
|
-
function
|
|
16195
|
+
function bind41(_liquidSwell) {
|
|
15988
16196
|
return (fontSetting, ...params) => {
|
|
15989
16197
|
if (!fontSetting) {
|
|
15990
16198
|
return null;
|
|
@@ -15996,14 +16204,14 @@ function bind39(_liquidSwell) {
|
|
|
15996
16204
|
}
|
|
15997
16205
|
|
|
15998
16206
|
// src/liquid/filters/font_modify.ts
|
|
15999
|
-
function
|
|
16207
|
+
function bind42(_liquidSwell) {
|
|
16000
16208
|
return (fontSetting, prop, value) => {
|
|
16001
16209
|
return ThemeFont.clone(fontSetting).modify(prop, value);
|
|
16002
16210
|
};
|
|
16003
16211
|
}
|
|
16004
16212
|
|
|
16005
16213
|
// src/liquid/filters/font_url.ts
|
|
16006
|
-
function
|
|
16214
|
+
function bind43(_liquidSwell) {
|
|
16007
16215
|
return (fontSetting) => {
|
|
16008
16216
|
return ThemeFont.get(fontSetting).url();
|
|
16009
16217
|
};
|
|
@@ -16052,15 +16260,15 @@ var format_address_default = {
|
|
|
16052
16260
|
};
|
|
16053
16261
|
|
|
16054
16262
|
// src/liquid/filters/handleize.ts
|
|
16055
|
-
var
|
|
16056
|
-
function
|
|
16263
|
+
var import_lodash_es14 = require("lodash-es");
|
|
16264
|
+
function bind44(_liquidSwell) {
|
|
16057
16265
|
return function filterHandleize(handle) {
|
|
16058
|
-
return (0,
|
|
16266
|
+
return (0, import_lodash_es14.kebabCase)(handle);
|
|
16059
16267
|
};
|
|
16060
16268
|
}
|
|
16061
16269
|
|
|
16062
16270
|
// src/liquid/filters/image_tag.ts
|
|
16063
|
-
function
|
|
16271
|
+
function bind45(_liquidSwell) {
|
|
16064
16272
|
return function filterImageTag(imageUrl, ...params) {
|
|
16065
16273
|
imageUrl = String(imageUrl || "");
|
|
16066
16274
|
let {
|
|
@@ -16224,7 +16432,7 @@ var filterDefinition = {
|
|
|
16224
16432
|
var image_url_default = filterDefinition;
|
|
16225
16433
|
|
|
16226
16434
|
// src/liquid/filters/inline_asset_content.ts
|
|
16227
|
-
function
|
|
16435
|
+
function bind46(liquidSwell) {
|
|
16228
16436
|
return async (assetPath) => {
|
|
16229
16437
|
const config = await liquidSwell.theme.getThemeConfig(
|
|
16230
16438
|
`theme/assets/${assetPath}`
|
|
@@ -16234,14 +16442,14 @@ function bind44(liquidSwell) {
|
|
|
16234
16442
|
}
|
|
16235
16443
|
|
|
16236
16444
|
// src/liquid/filters/json.ts
|
|
16237
|
-
function
|
|
16445
|
+
function bind47(_liquidSwell) {
|
|
16238
16446
|
return async function filterJson(input, space = 0) {
|
|
16239
16447
|
return jsonStringifyAsync(input, space);
|
|
16240
16448
|
};
|
|
16241
16449
|
}
|
|
16242
16450
|
|
|
16243
16451
|
// src/liquid/filters/json_pretty.ts
|
|
16244
|
-
function
|
|
16452
|
+
function bind48(_liquidSwell) {
|
|
16245
16453
|
return async function filterJsonPretty(input, space = 2) {
|
|
16246
16454
|
const output = await jsonStringifyAsync(input, space);
|
|
16247
16455
|
return `<pre>${output}</pre>`;
|
|
@@ -16251,7 +16459,7 @@ function bind46(_liquidSwell) {
|
|
|
16251
16459
|
// src/liquid/filters/locale_flag.ts
|
|
16252
16460
|
var import_country_flag_icons = require("country-flag-icons");
|
|
16253
16461
|
var flags = __toESM(require("country-flag-icons/string/1x1"), 1);
|
|
16254
|
-
function
|
|
16462
|
+
function bind49(_liquidSwell) {
|
|
16255
16463
|
return (localeCode) => {
|
|
16256
16464
|
if (typeof localeCode !== "string") {
|
|
16257
16465
|
return flags.US;
|
|
@@ -16262,7 +16470,7 @@ function bind47(_liquidSwell) {
|
|
|
16262
16470
|
}
|
|
16263
16471
|
|
|
16264
16472
|
// src/liquid/filters/minus.ts
|
|
16265
|
-
function
|
|
16473
|
+
function bind50(_liquidSwell) {
|
|
16266
16474
|
return (first, second) => {
|
|
16267
16475
|
const firstValue = isNumber(first) ? first : 0;
|
|
16268
16476
|
const secondValue = isNumber(second) ? second : 0;
|
|
@@ -16271,7 +16479,7 @@ function bind48(_liquidSwell) {
|
|
|
16271
16479
|
}
|
|
16272
16480
|
|
|
16273
16481
|
// src/liquid/filters/money.ts
|
|
16274
|
-
function
|
|
16482
|
+
function bind51(liquidSwell) {
|
|
16275
16483
|
return function filterMoney(value) {
|
|
16276
16484
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16277
16485
|
return liquidSwell.renderCurrency(amount);
|
|
@@ -16288,7 +16496,7 @@ function getMoneyAmount(liquidSwell, value) {
|
|
|
16288
16496
|
}
|
|
16289
16497
|
|
|
16290
16498
|
// src/liquid/filters/money_with_currency.ts
|
|
16291
|
-
function
|
|
16499
|
+
function bind52(liquidSwell) {
|
|
16292
16500
|
return function filterMoneyWithCurrency(value) {
|
|
16293
16501
|
const { currency } = liquidSwell.theme.swell.getStorefrontLocalization();
|
|
16294
16502
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
@@ -16297,7 +16505,7 @@ function bind50(liquidSwell) {
|
|
|
16297
16505
|
}
|
|
16298
16506
|
|
|
16299
16507
|
// src/liquid/filters/money_without_currency.ts
|
|
16300
|
-
function
|
|
16508
|
+
function bind53(liquidSwell) {
|
|
16301
16509
|
return function filterMoneyWithoutCurrency(value) {
|
|
16302
16510
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16303
16511
|
return liquidSwell.renderCurrency(amount).replace(/[^0-9.,]/g, "");
|
|
@@ -16305,30 +16513,45 @@ function bind51(liquidSwell) {
|
|
|
16305
16513
|
}
|
|
16306
16514
|
|
|
16307
16515
|
// src/liquid/filters/money_without_trailing_zeros.ts
|
|
16308
|
-
function
|
|
16516
|
+
function bind54(liquidSwell) {
|
|
16309
16517
|
return function filterMoneyWithoutTrailingZeros(value) {
|
|
16310
16518
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16311
16519
|
return liquidSwell.renderCurrency(amount).split(".")[0].split(",")[0];
|
|
16312
16520
|
};
|
|
16313
16521
|
}
|
|
16314
16522
|
|
|
16523
|
+
// src/liquid/filters/preload_tag.ts
|
|
16524
|
+
function bind55(_liquidSwell) {
|
|
16525
|
+
return function filterPreloadTag(assetUrl, ...params) {
|
|
16526
|
+
if (!assetUrl) {
|
|
16527
|
+
return "";
|
|
16528
|
+
}
|
|
16529
|
+
const { as } = paramsToProps(params);
|
|
16530
|
+
let attributes = "";
|
|
16531
|
+
if (typeof as === "string" && as) {
|
|
16532
|
+
attributes += `as="${as}"`;
|
|
16533
|
+
}
|
|
16534
|
+
return `<link href="${assetUrl}" rel="preload" ${attributes} />`;
|
|
16535
|
+
};
|
|
16536
|
+
}
|
|
16537
|
+
|
|
16315
16538
|
// src/liquid/filters/script_tag.ts
|
|
16316
|
-
function
|
|
16539
|
+
function bind56(_liquidSwell) {
|
|
16317
16540
|
return function filterScriptTag(assetUrl) {
|
|
16318
16541
|
return `<script src="${assetUrl}" type="text/javascript"></script>`;
|
|
16319
16542
|
};
|
|
16320
16543
|
}
|
|
16321
16544
|
|
|
16322
16545
|
// src/liquid/filters/stylesheet_tag.ts
|
|
16323
|
-
function
|
|
16546
|
+
function bind57(_liquidSwell) {
|
|
16324
16547
|
return function filterStyleSheetTag(assetUrl) {
|
|
16325
16548
|
return `<link href="${assetUrl}" rel="stylesheet" type="text/css" media="all" />`;
|
|
16326
16549
|
};
|
|
16327
16550
|
}
|
|
16328
16551
|
|
|
16329
16552
|
// src/liquid/filters/time_tag.ts
|
|
16330
|
-
function
|
|
16331
|
-
const dateFilter =
|
|
16553
|
+
function bind58(_liquidSwell) {
|
|
16554
|
+
const dateFilter = bind35(_liquidSwell);
|
|
16332
16555
|
return (dateValue, ...params) => {
|
|
16333
16556
|
const date = ensureDate(dateValue);
|
|
16334
16557
|
const formattedDate = dateFilter(dateValue, ...params);
|
|
@@ -16338,7 +16561,7 @@ function bind55(_liquidSwell) {
|
|
|
16338
16561
|
}
|
|
16339
16562
|
|
|
16340
16563
|
// src/liquid/filters/translate.ts
|
|
16341
|
-
function
|
|
16564
|
+
function bind59(liquidSwell) {
|
|
16342
16565
|
return async function filterTranslate(key, params) {
|
|
16343
16566
|
const props = params && paramsToProps(params);
|
|
16344
16567
|
const str = await liquidSwell.renderTranslation(key, props);
|
|
@@ -16347,7 +16570,7 @@ function bind56(liquidSwell) {
|
|
|
16347
16570
|
}
|
|
16348
16571
|
|
|
16349
16572
|
// src/liquid/filters/where.ts
|
|
16350
|
-
function
|
|
16573
|
+
function bind60(_liquidSwell) {
|
|
16351
16574
|
return function* filterWhere(arr, property, expected) {
|
|
16352
16575
|
const results = [];
|
|
16353
16576
|
const list = yield resolveEnumerable(arr);
|
|
@@ -16401,7 +16624,7 @@ function getSizesFromParam(param) {
|
|
|
16401
16624
|
height: height ? Number(height) : void 0
|
|
16402
16625
|
};
|
|
16403
16626
|
}
|
|
16404
|
-
function
|
|
16627
|
+
function bind61(liquidSwell) {
|
|
16405
16628
|
return async function filterAssetImgUrl(assetPath, size = "small") {
|
|
16406
16629
|
const imageUrl = await liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
|
|
16407
16630
|
const sizes = getSizesFromParam(size);
|
|
@@ -16417,14 +16640,14 @@ function bind58(liquidSwell) {
|
|
|
16417
16640
|
}
|
|
16418
16641
|
|
|
16419
16642
|
// src/liquid/filters/shopify/hex_to_rgba.ts
|
|
16420
|
-
function
|
|
16643
|
+
function bind62(_liquidSwell) {
|
|
16421
16644
|
return (color, alpha) => {
|
|
16422
16645
|
return ThemeColor.get(color).rgba(alpha || 1);
|
|
16423
16646
|
};
|
|
16424
16647
|
}
|
|
16425
16648
|
|
|
16426
16649
|
// src/liquid/filters/shopify/img_url.ts
|
|
16427
|
-
function
|
|
16650
|
+
function bind63(liquidSwell) {
|
|
16428
16651
|
return async function filterImgUrl(input, ...params) {
|
|
16429
16652
|
const url = await getImageUrlFromInput(input, liquidSwell);
|
|
16430
16653
|
if (typeof url !== "string" || url === "") {
|
|
@@ -16462,14 +16685,14 @@ var item_count_for_variant_default = {
|
|
|
16462
16685
|
};
|
|
16463
16686
|
|
|
16464
16687
|
// src/liquid/filters/shopify/payment_button.ts
|
|
16465
|
-
function
|
|
16688
|
+
function bind64(_liquidSwell) {
|
|
16466
16689
|
return (form) => {
|
|
16467
16690
|
return `<button style="display: block; visibility: hidden;"></button>`;
|
|
16468
16691
|
};
|
|
16469
16692
|
}
|
|
16470
16693
|
|
|
16471
16694
|
// src/liquid/filters/shopify/payment_terms.ts
|
|
16472
|
-
function
|
|
16695
|
+
function bind65(_liquidSwell) {
|
|
16473
16696
|
return (form) => {
|
|
16474
16697
|
return null;
|
|
16475
16698
|
};
|
|
@@ -16571,7 +16794,7 @@ var svgs = {
|
|
|
16571
16794
|
var placeholder_svgs_default = svgs;
|
|
16572
16795
|
|
|
16573
16796
|
// src/liquid/filters/shopify/placeholder_svg_tag.ts
|
|
16574
|
-
function
|
|
16797
|
+
function bind66(_liquidSwell) {
|
|
16575
16798
|
return function filterPlaceholderSvgTag(name, className) {
|
|
16576
16799
|
const svg = placeholder_svgs_default[name];
|
|
16577
16800
|
if (typeof svg === "object" && svg !== null) {
|
|
@@ -16582,7 +16805,7 @@ function bind63(_liquidSwell) {
|
|
|
16582
16805
|
}
|
|
16583
16806
|
|
|
16584
16807
|
// src/liquid/filters/shopify/shopify_asset_url.ts
|
|
16585
|
-
function
|
|
16808
|
+
function bind67(_liquidSwell) {
|
|
16586
16809
|
return function filterShopifyAssetUrl(input) {
|
|
16587
16810
|
if (typeof input === "string") {
|
|
16588
16811
|
switch (input) {
|
|
@@ -16607,7 +16830,7 @@ function bind64(_liquidSwell) {
|
|
|
16607
16830
|
}
|
|
16608
16831
|
|
|
16609
16832
|
// src/liquid/filters/shopify/structured_data.ts
|
|
16610
|
-
function
|
|
16833
|
+
function bind68(_liquidSwell) {
|
|
16611
16834
|
return async function filterStructuredData(input) {
|
|
16612
16835
|
let value = input;
|
|
16613
16836
|
if (value instanceof StorefrontResource) {
|
|
@@ -16685,7 +16908,7 @@ function convertToSchemaOrgProductGroup(product) {
|
|
|
16685
16908
|
}
|
|
16686
16909
|
|
|
16687
16910
|
// src/liquid/filters/inline_editable.ts
|
|
16688
|
-
function
|
|
16911
|
+
function bind69(_liquidSwell) {
|
|
16689
16912
|
return (value, key) => {
|
|
16690
16913
|
if (typeof value === "object" && "value" in value) {
|
|
16691
16914
|
value = value.value;
|
|
@@ -16696,64 +16919,65 @@ function bind66(_liquidSwell) {
|
|
|
16696
16919
|
|
|
16697
16920
|
// src/liquid/filters/index.ts
|
|
16698
16921
|
var filters = {
|
|
16699
|
-
asset_url:
|
|
16700
|
-
brightness_difference:
|
|
16701
|
-
color_brightness:
|
|
16702
|
-
color_contrast:
|
|
16703
|
-
color_darken:
|
|
16704
|
-
color_desaturate:
|
|
16705
|
-
color_difference:
|
|
16706
|
-
color_extract:
|
|
16707
|
-
color_lighten:
|
|
16708
|
-
color_mix:
|
|
16709
|
-
color_modify:
|
|
16710
|
-
color_saturate:
|
|
16711
|
-
color_to_hex:
|
|
16712
|
-
color_to_hsl:
|
|
16713
|
-
color_to_rgb:
|
|
16714
|
-
date_next_interval:
|
|
16715
|
-
date:
|
|
16716
|
-
default_errors:
|
|
16717
|
-
divided_by:
|
|
16718
|
-
embedded_content:
|
|
16719
|
-
escape:
|
|
16720
|
-
font_face:
|
|
16721
|
-
font_modify:
|
|
16722
|
-
font_url:
|
|
16922
|
+
asset_url: bind20,
|
|
16923
|
+
brightness_difference: bind21,
|
|
16924
|
+
color_brightness: bind22,
|
|
16925
|
+
color_contrast: bind23,
|
|
16926
|
+
color_darken: bind24,
|
|
16927
|
+
color_desaturate: bind25,
|
|
16928
|
+
color_difference: bind26,
|
|
16929
|
+
color_extract: bind27,
|
|
16930
|
+
color_lighten: bind28,
|
|
16931
|
+
color_mix: bind29,
|
|
16932
|
+
color_modify: bind30,
|
|
16933
|
+
color_saturate: bind31,
|
|
16934
|
+
color_to_hex: bind32,
|
|
16935
|
+
color_to_hsl: bind33,
|
|
16936
|
+
color_to_rgb: bind34,
|
|
16937
|
+
date_next_interval: bind36,
|
|
16938
|
+
date: bind35,
|
|
16939
|
+
default_errors: bind37,
|
|
16940
|
+
divided_by: bind38,
|
|
16941
|
+
embedded_content: bind39,
|
|
16942
|
+
escape: bind40,
|
|
16943
|
+
font_face: bind41,
|
|
16944
|
+
font_modify: bind42,
|
|
16945
|
+
font_url: bind43,
|
|
16723
16946
|
format_address: format_address_default,
|
|
16724
|
-
handle:
|
|
16947
|
+
handle: bind44,
|
|
16725
16948
|
// alias
|
|
16726
|
-
handleize:
|
|
16727
|
-
image_tag:
|
|
16949
|
+
handleize: bind44,
|
|
16950
|
+
image_tag: bind45,
|
|
16728
16951
|
image_url: image_url_default,
|
|
16729
|
-
inline_asset_content:
|
|
16730
|
-
json:
|
|
16731
|
-
json_pretty:
|
|
16732
|
-
locale_flag:
|
|
16733
|
-
minus:
|
|
16734
|
-
money:
|
|
16735
|
-
money_with_currency:
|
|
16736
|
-
money_without_currency:
|
|
16737
|
-
money_without_trailing_zeros:
|
|
16738
|
-
|
|
16739
|
-
|
|
16740
|
-
|
|
16741
|
-
|
|
16742
|
-
|
|
16952
|
+
inline_asset_content: bind46,
|
|
16953
|
+
json: bind47,
|
|
16954
|
+
json_pretty: bind48,
|
|
16955
|
+
locale_flag: bind49,
|
|
16956
|
+
minus: bind50,
|
|
16957
|
+
money: bind51,
|
|
16958
|
+
money_with_currency: bind52,
|
|
16959
|
+
money_without_currency: bind53,
|
|
16960
|
+
money_without_trailing_zeros: bind54,
|
|
16961
|
+
preload_tag: bind55,
|
|
16962
|
+
script_tag: bind56,
|
|
16963
|
+
stylesheet_tag: bind57,
|
|
16964
|
+
time_tag: bind58,
|
|
16965
|
+
translate: bind59,
|
|
16966
|
+
t: bind59,
|
|
16743
16967
|
// alias
|
|
16744
|
-
where:
|
|
16968
|
+
where: bind60,
|
|
16745
16969
|
// Shopify compatibility only
|
|
16746
|
-
asset_img_url:
|
|
16747
|
-
hex_to_rgba:
|
|
16748
|
-
img_url:
|
|
16970
|
+
asset_img_url: bind61,
|
|
16971
|
+
hex_to_rgba: bind62,
|
|
16972
|
+
img_url: bind63,
|
|
16749
16973
|
item_count_for_variant: item_count_for_variant_default,
|
|
16750
|
-
payment_button:
|
|
16751
|
-
payment_terms:
|
|
16752
|
-
placeholder_svg_tag:
|
|
16753
|
-
shopify_asset_url:
|
|
16754
|
-
structured_data:
|
|
16974
|
+
payment_button: bind64,
|
|
16975
|
+
payment_terms: bind65,
|
|
16976
|
+
placeholder_svg_tag: bind66,
|
|
16977
|
+
shopify_asset_url: bind67,
|
|
16978
|
+
structured_data: bind68,
|
|
16755
16979
|
// Swell only
|
|
16756
|
-
inline_editable:
|
|
16980
|
+
inline_editable: bind69
|
|
16757
16981
|
};
|
|
16758
16982
|
function bindFilters(liquidSwell) {
|
|
16759
16983
|
for (const [tag, handler] of Object.entries(filters)) {
|
|
@@ -16767,8 +16991,8 @@ function bindFilters(liquidSwell) {
|
|
|
16767
16991
|
}
|
|
16768
16992
|
}
|
|
16769
16993
|
}
|
|
16770
|
-
function bindWithResolvedProps(liquidSwell,
|
|
16771
|
-
const handler =
|
|
16994
|
+
function bindWithResolvedProps(liquidSwell, bind70, resolve = []) {
|
|
16995
|
+
const handler = bind70(liquidSwell);
|
|
16772
16996
|
if (!Array.isArray(resolve)) {
|
|
16773
16997
|
return handler;
|
|
16774
16998
|
}
|
|
@@ -16820,9 +17044,9 @@ async function resolveAsyncProps(propArg, resolveProps) {
|
|
|
16820
17044
|
}
|
|
16821
17045
|
|
|
16822
17046
|
// src/liquid/operators.ts
|
|
16823
|
-
var
|
|
17047
|
+
var import_liquidjs38 = require("liquidjs");
|
|
16824
17048
|
var swellOperators = {
|
|
16825
|
-
...
|
|
17049
|
+
...import_liquidjs38.defaultOperators,
|
|
16826
17050
|
"==": equal,
|
|
16827
17051
|
"!=": (l, r) => !equal(l, r),
|
|
16828
17052
|
contains: (l, r) => {
|
|
@@ -16850,8 +17074,8 @@ function arrayEqual(lhs, rhs) {
|
|
|
16850
17074
|
|
|
16851
17075
|
// src/liquid/color.ts
|
|
16852
17076
|
var import_color = __toESM(require("color"), 1);
|
|
16853
|
-
var
|
|
16854
|
-
var ThemeColor = class _ThemeColor extends
|
|
17077
|
+
var import_liquidjs39 = require("liquidjs");
|
|
17078
|
+
var ThemeColor = class _ThemeColor extends import_liquidjs39.Drop {
|
|
16855
17079
|
color;
|
|
16856
17080
|
colorValues;
|
|
16857
17081
|
red;
|
|
@@ -16895,10 +17119,16 @@ var ThemeColor = class _ThemeColor extends import_liquidjs33.Drop {
|
|
|
16895
17119
|
return this.color.darken(percent / 100).hex().toLowerCase();
|
|
16896
17120
|
}
|
|
16897
17121
|
rgb() {
|
|
16898
|
-
return this.
|
|
17122
|
+
return `${this.red} ${this.green} ${this.blue}`;
|
|
16899
17123
|
}
|
|
16900
17124
|
rgba(alpha) {
|
|
16901
|
-
|
|
17125
|
+
const colorValues = this.color.object();
|
|
17126
|
+
const alphaValue = alpha || colorValues.alpha;
|
|
17127
|
+
const rgb = this.rgb();
|
|
17128
|
+
if (alphaValue === void 0) {
|
|
17129
|
+
return rgb;
|
|
17130
|
+
}
|
|
17131
|
+
return `${rgb} / ${Number(alphaValue).toFixed(2)}`;
|
|
16902
17132
|
}
|
|
16903
17133
|
hsl() {
|
|
16904
17134
|
return this.color.hsl().round().toString();
|
|
@@ -16986,7 +17216,7 @@ function isThemeColorLike(value) {
|
|
|
16986
17216
|
}
|
|
16987
17217
|
|
|
16988
17218
|
// src/liquid/index.ts
|
|
16989
|
-
var LiquidSwell31 = class extends
|
|
17219
|
+
var LiquidSwell31 = class extends import_liquidjs40.Liquid {
|
|
16990
17220
|
theme;
|
|
16991
17221
|
getThemeConfig;
|
|
16992
17222
|
getThemeTemplateConfigByType;
|
|
@@ -17003,6 +17233,7 @@ var LiquidSwell31 = class extends import_liquidjs34.Liquid {
|
|
|
17003
17233
|
extName;
|
|
17004
17234
|
componentsDir;
|
|
17005
17235
|
sectionsDir;
|
|
17236
|
+
blocksDir;
|
|
17006
17237
|
lastSchema;
|
|
17007
17238
|
constructor({
|
|
17008
17239
|
theme,
|
|
@@ -17020,7 +17251,8 @@ var LiquidSwell31 = class extends import_liquidjs34.Liquid {
|
|
|
17020
17251
|
layoutName,
|
|
17021
17252
|
extName,
|
|
17022
17253
|
componentsDir,
|
|
17023
|
-
sectionsDir
|
|
17254
|
+
sectionsDir,
|
|
17255
|
+
blocksDir
|
|
17024
17256
|
}) {
|
|
17025
17257
|
getThemeConfig = getThemeConfig || theme.getThemeConfig.bind(theme);
|
|
17026
17258
|
extName = extName || "liquid";
|
|
@@ -17049,6 +17281,7 @@ var LiquidSwell31 = class extends import_liquidjs34.Liquid {
|
|
|
17049
17281
|
this.extName = extName;
|
|
17050
17282
|
this.componentsDir = componentsDir || "components";
|
|
17051
17283
|
this.sectionsDir = sectionsDir || "sections";
|
|
17284
|
+
this.blocksDir = blocksDir || "blocks";
|
|
17052
17285
|
this.lastSchema = void 0;
|
|
17053
17286
|
bindTags(this);
|
|
17054
17287
|
bindFilters(this);
|
|
@@ -17071,6 +17304,9 @@ var LiquidSwell31 = class extends import_liquidjs34.Liquid {
|
|
|
17071
17304
|
async getSectionGroupPath(sectionName) {
|
|
17072
17305
|
return await this.resolveFilePathByType("sections", `${sectionName}.json`) || resolveFilePath(`${this.sectionsDir}/${sectionName}`, "json");
|
|
17073
17306
|
}
|
|
17307
|
+
async getThemeBlockPath(blockName) {
|
|
17308
|
+
return await this.resolveFilePathByType("blocks", blockName) || resolveFilePath(`${this.blocksDir}/${blockName}`, this.extName);
|
|
17309
|
+
}
|
|
17074
17310
|
};
|
|
17075
17311
|
function resolveFilePath(fileName, extName) {
|
|
17076
17312
|
return `theme/${fileName}.${extName}`;
|
|
@@ -17470,11 +17706,11 @@ var ThemeLoader = class _ThemeLoader {
|
|
|
17470
17706
|
};
|
|
17471
17707
|
|
|
17472
17708
|
// src/globals.ts
|
|
17473
|
-
var
|
|
17709
|
+
var import_lodash_es15 = require("lodash-es");
|
|
17474
17710
|
|
|
17475
17711
|
// src/compatibility/drops/robots-rule.ts
|
|
17476
|
-
var
|
|
17477
|
-
var RobotsRule = class _RobotsRule extends
|
|
17712
|
+
var import_liquidjs41 = require("liquidjs");
|
|
17713
|
+
var RobotsRule = class _RobotsRule extends import_liquidjs41.Drop {
|
|
17478
17714
|
constructor(directive, value) {
|
|
17479
17715
|
super();
|
|
17480
17716
|
this.directive = directive;
|
|
@@ -17570,7 +17806,7 @@ function getAllCountryOptionTags(geoSettings) {
|
|
|
17570
17806
|
}).filter(Boolean).join("\n");
|
|
17571
17807
|
}
|
|
17572
17808
|
function getRobotsGlobals(canonicalUrl) {
|
|
17573
|
-
const sitemapUrl = `${(0,
|
|
17809
|
+
const sitemapUrl = `${(0, import_lodash_es15.trimEnd)(canonicalUrl, "/")}/sitemap.xml`;
|
|
17574
17810
|
const defaultRules = [
|
|
17575
17811
|
{ directive: "Disallow", value: "/admin" },
|
|
17576
17812
|
{ directive: "Disallow", value: "/cart" },
|
|
@@ -18065,7 +18301,7 @@ var SwellTheme3 = class {
|
|
|
18065
18301
|
return languageConfig;
|
|
18066
18302
|
}
|
|
18067
18303
|
const localeShortCode = locale.split("-")[0];
|
|
18068
|
-
return (0,
|
|
18304
|
+
return (0, import_lodash_es16.reduce)(
|
|
18069
18305
|
languageConfig,
|
|
18070
18306
|
(acc, value, key) => {
|
|
18071
18307
|
if (isObject2(value)) {
|
|
@@ -18089,15 +18325,15 @@ var SwellTheme3 = class {
|
|
|
18089
18325
|
const translationEnd = translationParts.pop();
|
|
18090
18326
|
const translationPath = translationParts.join(".");
|
|
18091
18327
|
const translationConfigGlobal = this.globals.language;
|
|
18092
|
-
acc[key] = (0,
|
|
18328
|
+
acc[key] = (0, import_lodash_es16.get)(
|
|
18093
18329
|
translationConfigGlobal,
|
|
18094
18330
|
`${translationPath}.$locale.${locale}.${translationEnd}`
|
|
18095
|
-
) || (0,
|
|
18331
|
+
) || (0, import_lodash_es16.get)(
|
|
18096
18332
|
translationConfigGlobal,
|
|
18097
18333
|
`${translationPath}.$locale.${localeShortCode}.${translationEnd}`
|
|
18098
|
-
) || (0,
|
|
18334
|
+
) || (0, import_lodash_es16.get)(translationConfigGlobal, translationKey) || value;
|
|
18099
18335
|
} else {
|
|
18100
|
-
acc[key] = (0,
|
|
18336
|
+
acc[key] = (0, import_lodash_es16.get)(languageConfig, `$locale.${locale}.${key}`) || (0, import_lodash_es16.get)(languageConfig, `$locale.${localeShortCode}.${key}`) || value;
|
|
18101
18337
|
}
|
|
18102
18338
|
}
|
|
18103
18339
|
return acc;
|
|
@@ -18782,6 +19018,30 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
18782
19018
|
const configs = this.getThemeConfigsByPath("theme/sections/");
|
|
18783
19019
|
return getAllSections(configs, this.getTemplateSchema.bind(this));
|
|
18784
19020
|
}
|
|
19021
|
+
/**
|
|
19022
|
+
* Returns all theme block schemas from /blocks folder.
|
|
19023
|
+
*/
|
|
19024
|
+
getAllThemeBlockSchemas() {
|
|
19025
|
+
const schemas = [];
|
|
19026
|
+
const configs = this.getThemeConfigsByPath("theme/blocks/");
|
|
19027
|
+
for (const config of configs.values()) {
|
|
19028
|
+
const { name, file_path: filePath, file_data: fileData } = config;
|
|
19029
|
+
const rawSchema = extractSchemaTag(fileData, true);
|
|
19030
|
+
if (!rawSchema) {
|
|
19031
|
+
continue;
|
|
19032
|
+
}
|
|
19033
|
+
try {
|
|
19034
|
+
const schema = import_json56.default.parse(rawSchema);
|
|
19035
|
+
if (!schema.type) {
|
|
19036
|
+
schema.type = name;
|
|
19037
|
+
}
|
|
19038
|
+
schemas.push(schema);
|
|
19039
|
+
} catch (error) {
|
|
19040
|
+
console.warn(`Invalid schema in block: ${filePath}`, error);
|
|
19041
|
+
}
|
|
19042
|
+
}
|
|
19043
|
+
return schemas;
|
|
19044
|
+
}
|
|
18785
19045
|
async getPageSections(sectionGroup, resolveSettings = true) {
|
|
18786
19046
|
const sectionConfigs = await getPageSections(
|
|
18787
19047
|
sectionGroup,
|
|
@@ -18933,8 +19193,8 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
18933
19193
|
const keyParts = key?.split(".") || [];
|
|
18934
19194
|
const keyName = keyParts.pop() || "";
|
|
18935
19195
|
const keyPath = keyParts.join(".");
|
|
18936
|
-
const langObject = (0,
|
|
18937
|
-
let localeValue = (0,
|
|
19196
|
+
const langObject = (0, import_lodash_es16.get)(langConfig, keyPath);
|
|
19197
|
+
let localeValue = (0, import_lodash_es16.get)(langObject?.[localeCode], keyName) || (0, import_lodash_es16.get)(langObject?.[localeCode.split("-")[0]], keyName) || langObject?.[keyName];
|
|
18938
19198
|
if (data?.count !== void 0 && localeValue?.one) {
|
|
18939
19199
|
localeValue = data.count === 1 ? localeValue.one : localeValue.other;
|
|
18940
19200
|
}
|
|
@@ -19014,7 +19274,7 @@ function fillDefaultThemeSettings(themeSettings, editorSchemaSettings) {
|
|
|
19014
19274
|
}
|
|
19015
19275
|
}
|
|
19016
19276
|
function resolveThemeSettings(theme, themeSettings, editorSchemaSettings) {
|
|
19017
|
-
const settings = (0,
|
|
19277
|
+
const settings = (0, import_lodash_es16.cloneDeep)(themeSettings);
|
|
19018
19278
|
if (settings.$locale) {
|
|
19019
19279
|
const { locale } = theme.swell.getStorefrontLocalization();
|
|
19020
19280
|
const localeConfig = settings.$locale[locale] || {};
|
|
@@ -19024,16 +19284,16 @@ function resolveThemeSettings(theme, themeSettings, editorSchemaSettings) {
|
|
|
19024
19284
|
}
|
|
19025
19285
|
}
|
|
19026
19286
|
}
|
|
19027
|
-
(0,
|
|
19287
|
+
(0, import_lodash_es16.each)(settings, (value, key) => {
|
|
19028
19288
|
const setting = (editorSchemaSettings && findEditorSetting(editorSchemaSettings, key)) ?? null;
|
|
19029
19289
|
if (isObject2(value) && !(value instanceof StorefrontResource)) {
|
|
19030
19290
|
switch (setting?.type) {
|
|
19031
19291
|
case "color_scheme_group": {
|
|
19032
|
-
(0,
|
|
19292
|
+
(0, import_lodash_es16.each)(value, (scheme, schemeId) => {
|
|
19033
19293
|
if (isObject2(scheme) && typeof scheme.settings === "object" && scheme.settings) {
|
|
19034
19294
|
const settings2 = scheme.settings;
|
|
19035
|
-
(0,
|
|
19036
|
-
const fieldDef = (0,
|
|
19295
|
+
(0, import_lodash_es16.each)(settings2, (colorValue, colorId) => {
|
|
19296
|
+
const fieldDef = (0, import_lodash_es16.find)(setting.fields, { id: colorId });
|
|
19037
19297
|
if (fieldDef?.type === "color" && colorValue) {
|
|
19038
19298
|
scheme.id = schemeId;
|
|
19039
19299
|
settings2[colorId] = new ThemeColor(colorValue);
|
|
@@ -19084,7 +19344,7 @@ function resolveThemeSettings(theme, themeSettings, editorSchemaSettings) {
|
|
|
19084
19344
|
}
|
|
19085
19345
|
function findThemeSettingsByType(type, themeSettings, editorSchemaSettings) {
|
|
19086
19346
|
const foundSettings = [];
|
|
19087
|
-
(0,
|
|
19347
|
+
(0, import_lodash_es16.each)(themeSettings, (value, key) => {
|
|
19088
19348
|
if (isObject2(value) && !(value instanceof ThemeFont) && !(value instanceof StorefrontResource)) {
|
|
19089
19349
|
foundSettings.push(
|
|
19090
19350
|
...findThemeSettingsByType(type, value, editorSchemaSettings)
|
|
@@ -19142,14 +19402,14 @@ function parseJsonConfig(config) {
|
|
|
19142
19402
|
return {};
|
|
19143
19403
|
}
|
|
19144
19404
|
}
|
|
19145
|
-
function extractSchemaTag(template) {
|
|
19405
|
+
function extractSchemaTag(template, inner = false) {
|
|
19146
19406
|
const list = template.match(
|
|
19147
19407
|
/\{%-?\s*schema\s*-?%\}(.*)\{%-?\s*endschema\s*-?%\}/s
|
|
19148
19408
|
);
|
|
19149
19409
|
if (list === null) {
|
|
19150
19410
|
return template;
|
|
19151
19411
|
}
|
|
19152
|
-
return list[0];
|
|
19412
|
+
return inner ? list[1] : list[0];
|
|
19153
19413
|
}
|
|
19154
19414
|
function withSuffix(path, suffix) {
|
|
19155
19415
|
return suffix ? `${path}.${suffix}` : path;
|
|
@@ -19258,7 +19518,7 @@ function isChildItemActive(items) {
|
|
|
19258
19518
|
}
|
|
19259
19519
|
function getMenuItemValueId(value) {
|
|
19260
19520
|
const fallback = typeof value === "string" ? value : "";
|
|
19261
|
-
const slug = (0,
|
|
19521
|
+
const slug = (0, import_lodash_es17.get)(value, "id", (0, import_lodash_es17.get)(value, "slug", fallback)) || "";
|
|
19262
19522
|
return slug;
|
|
19263
19523
|
}
|
|
19264
19524
|
async function getMenuItemUrlAndResource(theme, menuItem) {
|