@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.js
CHANGED
|
@@ -3529,7 +3529,15 @@
|
|
|
3529
3529
|
}, {}),
|
|
3530
3530
|
...preset.settings || void 0
|
|
3531
3531
|
},
|
|
3532
|
-
blocks: preset
|
|
3532
|
+
blocks: resolveSectionBlockPresets(preset, schema)
|
|
3533
|
+
}));
|
|
3534
|
+
}
|
|
3535
|
+
function resolveSectionBlockPresets(preset, schema) {
|
|
3536
|
+
if (!preset.blocks) {
|
|
3537
|
+
return;
|
|
3538
|
+
}
|
|
3539
|
+
if (Array.isArray(preset.blocks)) {
|
|
3540
|
+
return preset.blocks.map((block) => {
|
|
3533
3541
|
const blockDef = schema.blocks?.find((b) => b.type === block.type);
|
|
3534
3542
|
return blockDef ? {
|
|
3535
3543
|
...block,
|
|
@@ -3543,8 +3551,9 @@
|
|
|
3543
3551
|
...block.settings || void 0
|
|
3544
3552
|
}
|
|
3545
3553
|
} : block;
|
|
3546
|
-
})
|
|
3547
|
-
}
|
|
3554
|
+
});
|
|
3555
|
+
}
|
|
3556
|
+
return Object.values(preset.blocks);
|
|
3548
3557
|
}
|
|
3549
3558
|
async function getLayoutSectionGroups(allSections, renderTemplateSchema) {
|
|
3550
3559
|
const allSectionsList = Array.from(allSections.values());
|
|
@@ -3621,7 +3630,15 @@
|
|
|
3621
3630
|
};
|
|
3622
3631
|
const id = sectionGroup.id ? `page__${sectionGroup.id}__${key}` : schema.id;
|
|
3623
3632
|
const blockOrder = Array.isArray(section.block_order) ? section.block_order : Object.keys(section.blocks || {});
|
|
3624
|
-
const blocks = blockOrder.map((key2) =>
|
|
3633
|
+
const blocks = blockOrder.map((key2) => {
|
|
3634
|
+
const block = section.blocks?.[key2];
|
|
3635
|
+
if (block) {
|
|
3636
|
+
return {
|
|
3637
|
+
...block,
|
|
3638
|
+
id: `${schema.id}__${key2}`
|
|
3639
|
+
};
|
|
3640
|
+
}
|
|
3641
|
+
}).filter(Boolean);
|
|
3625
3642
|
const settings = {
|
|
3626
3643
|
section: {
|
|
3627
3644
|
id,
|
|
@@ -5615,7 +5632,7 @@ ${formattedMessage}`;
|
|
|
5615
5632
|
// TODO: figure out how to make this work, doesn't work for collections normally
|
|
5616
5633
|
defaultValue: section.presets?.reduce(
|
|
5617
5634
|
(acc, preset, index) => {
|
|
5618
|
-
if (!preset.blocks) {
|
|
5635
|
+
if (!preset.blocks || !Array.isArray(preset.blocks)) {
|
|
5619
5636
|
return acc;
|
|
5620
5637
|
}
|
|
5621
5638
|
return preset.blocks.reduce(
|
|
@@ -5822,7 +5839,7 @@ ${formattedMessage}`;
|
|
|
5822
5839
|
custom_css: preset.settings?.["custom_css"] || "",
|
|
5823
5840
|
...processFields(section.fields, preset.settings),
|
|
5824
5841
|
// Process blocks inside the preset
|
|
5825
|
-
Blocks: (preset.blocks
|
|
5842
|
+
Blocks: (Array.isArray(preset.blocks) ? preset.blocks : []).map((block) => {
|
|
5826
5843
|
const blockSchema = section.blocks?.find(
|
|
5827
5844
|
({ type }) => type === block.type
|
|
5828
5845
|
);
|
|
@@ -6282,11 +6299,11 @@ ${formattedMessage}`;
|
|
|
6282
6299
|
}
|
|
6283
6300
|
|
|
6284
6301
|
// src/menus.ts
|
|
6285
|
-
var
|
|
6302
|
+
var import_lodash_es17 = __require("lodash-es");
|
|
6286
6303
|
|
|
6287
6304
|
// src/theme.ts
|
|
6288
6305
|
var import_json56 = __toESM(__require("json5"), 1);
|
|
6289
|
-
var
|
|
6306
|
+
var import_lodash_es16 = __require("lodash-es");
|
|
6290
6307
|
|
|
6291
6308
|
// src/compatibility/shopify.ts
|
|
6292
6309
|
var import_lodash_es7 = __require("lodash-es");
|
|
@@ -11581,16 +11598,16 @@ ${formattedMessage}`;
|
|
|
11581
11598
|
if (!Array.isArray(blogs?.results)) {
|
|
11582
11599
|
return [];
|
|
11583
11600
|
}
|
|
11584
|
-
const
|
|
11585
|
-
(
|
|
11601
|
+
const set4 = blogs.results.reduce(
|
|
11602
|
+
(set5, blog) => {
|
|
11586
11603
|
for (const tag of blog.tags || []) {
|
|
11587
|
-
|
|
11604
|
+
set5.add(tag);
|
|
11588
11605
|
}
|
|
11589
|
-
return
|
|
11606
|
+
return set5;
|
|
11590
11607
|
},
|
|
11591
11608
|
/* @__PURE__ */ new Set()
|
|
11592
11609
|
);
|
|
11593
|
-
return Array.from(
|
|
11610
|
+
return Array.from(set4.values());
|
|
11594
11611
|
});
|
|
11595
11612
|
return new ShopifyResource({
|
|
11596
11613
|
all_tags: allTags,
|
|
@@ -11974,18 +11991,18 @@ ${formattedMessage}`;
|
|
|
11974
11991
|
if (!resolved) {
|
|
11975
11992
|
return [];
|
|
11976
11993
|
}
|
|
11977
|
-
const
|
|
11994
|
+
const set4 = /* @__PURE__ */ new Set();
|
|
11978
11995
|
await Promise.all(
|
|
11979
11996
|
resolved.results.map(async (product) => {
|
|
11980
11997
|
const tags2 = await Promise.resolve().then(() => product.tags);
|
|
11981
11998
|
if (Array.isArray(tags2)) {
|
|
11982
11999
|
for (const tag of tags2) {
|
|
11983
|
-
|
|
12000
|
+
set4.add(tag);
|
|
11984
12001
|
}
|
|
11985
12002
|
}
|
|
11986
12003
|
})
|
|
11987
12004
|
);
|
|
11988
|
-
return Array.from(
|
|
12005
|
+
return Array.from(set4.values());
|
|
11989
12006
|
}),
|
|
11990
12007
|
all_types: defer(async () => {
|
|
11991
12008
|
const products = await resolveProducts();
|
|
@@ -12089,6 +12106,31 @@ ${formattedMessage}`;
|
|
|
12089
12106
|
return resolveProducts;
|
|
12090
12107
|
}
|
|
12091
12108
|
|
|
12109
|
+
// src/compatibility/shopify-objects/content.ts
|
|
12110
|
+
var import_liquidjs6 = __require("liquidjs");
|
|
12111
|
+
var ShopifySwellContent = class extends import_liquidjs6.Drop {
|
|
12112
|
+
content;
|
|
12113
|
+
description;
|
|
12114
|
+
constructor(product) {
|
|
12115
|
+
super();
|
|
12116
|
+
this.content = product?.content || {};
|
|
12117
|
+
this.description = product?.description || "";
|
|
12118
|
+
}
|
|
12119
|
+
toString() {
|
|
12120
|
+
return this.description;
|
|
12121
|
+
}
|
|
12122
|
+
toObject() {
|
|
12123
|
+
const combined = Object.assign({}, this.content);
|
|
12124
|
+
return combined;
|
|
12125
|
+
}
|
|
12126
|
+
toJSON() {
|
|
12127
|
+
return this.toObject();
|
|
12128
|
+
}
|
|
12129
|
+
toLiquid() {
|
|
12130
|
+
return this.toObject();
|
|
12131
|
+
}
|
|
12132
|
+
};
|
|
12133
|
+
|
|
12092
12134
|
// src/compatibility/shopify-objects/product.ts
|
|
12093
12135
|
function ShopifyProduct(instance, product, depth = 0) {
|
|
12094
12136
|
if (product instanceof ShopifyResource) {
|
|
@@ -12122,7 +12164,7 @@ ${formattedMessage}`;
|
|
|
12122
12164
|
compare_at_price_max: compareAtPrice,
|
|
12123
12165
|
compare_at_price_min: compareAtPrice,
|
|
12124
12166
|
compare_at_price_varies: false,
|
|
12125
|
-
content: defer(() => product
|
|
12167
|
+
content: defer(() => new ShopifySwellContent(product)),
|
|
12126
12168
|
created_at: defer(() => product.date_created),
|
|
12127
12169
|
description: defer(() => product.description),
|
|
12128
12170
|
featured_image: deferWith(product, (product2) => {
|
|
@@ -13000,8 +13042,8 @@ ${formattedMessage}`;
|
|
|
13000
13042
|
}
|
|
13001
13043
|
|
|
13002
13044
|
// src/compatibility/drops/money.ts
|
|
13003
|
-
var
|
|
13004
|
-
var MoneyDrop = class extends
|
|
13045
|
+
var import_liquidjs7 = __require("liquidjs");
|
|
13046
|
+
var MoneyDrop = class extends import_liquidjs7.Drop {
|
|
13005
13047
|
constructor(value, decimals, currency) {
|
|
13006
13048
|
super();
|
|
13007
13049
|
this.value = value;
|
|
@@ -13602,8 +13644,8 @@ ${formattedMessage}`;
|
|
|
13602
13644
|
}
|
|
13603
13645
|
|
|
13604
13646
|
// src/compatibility/drops/all_products.ts
|
|
13605
|
-
var
|
|
13606
|
-
var AllProductsDrop = class extends
|
|
13647
|
+
var import_liquidjs8 = __require("liquidjs");
|
|
13648
|
+
var AllProductsDrop = class extends import_liquidjs8.Drop {
|
|
13607
13649
|
#instance;
|
|
13608
13650
|
#map;
|
|
13609
13651
|
constructor(instance) {
|
|
@@ -13645,8 +13687,8 @@ ${formattedMessage}`;
|
|
|
13645
13687
|
};
|
|
13646
13688
|
|
|
13647
13689
|
// src/compatibility/drops/articles.ts
|
|
13648
|
-
var
|
|
13649
|
-
var ArticlesDrop = class extends
|
|
13690
|
+
var import_liquidjs9 = __require("liquidjs");
|
|
13691
|
+
var ArticlesDrop = class extends import_liquidjs9.Drop {
|
|
13650
13692
|
#instance;
|
|
13651
13693
|
#map;
|
|
13652
13694
|
constructor(instance) {
|
|
@@ -13688,8 +13730,8 @@ ${formattedMessage}`;
|
|
|
13688
13730
|
};
|
|
13689
13731
|
|
|
13690
13732
|
// src/compatibility/drops/blogs.ts
|
|
13691
|
-
var
|
|
13692
|
-
var BlogsDrop = class extends
|
|
13733
|
+
var import_liquidjs10 = __require("liquidjs");
|
|
13734
|
+
var BlogsDrop = class extends import_liquidjs10.Drop {
|
|
13693
13735
|
#instance;
|
|
13694
13736
|
#map;
|
|
13695
13737
|
constructor(instance) {
|
|
@@ -13735,7 +13777,7 @@ ${formattedMessage}`;
|
|
|
13735
13777
|
};
|
|
13736
13778
|
|
|
13737
13779
|
// src/compatibility/drops/collections.ts
|
|
13738
|
-
var
|
|
13780
|
+
var import_liquidjs11 = __require("liquidjs");
|
|
13739
13781
|
var AllCategoryResource = class extends StorefrontResource {
|
|
13740
13782
|
constructor(instance) {
|
|
13741
13783
|
super(() => {
|
|
@@ -13749,7 +13791,7 @@ ${formattedMessage}`;
|
|
|
13749
13791
|
});
|
|
13750
13792
|
}
|
|
13751
13793
|
};
|
|
13752
|
-
var CollectionsDrop = class extends
|
|
13794
|
+
var CollectionsDrop = class extends import_liquidjs11.Drop {
|
|
13753
13795
|
#instance;
|
|
13754
13796
|
#map;
|
|
13755
13797
|
constructor(instance) {
|
|
@@ -13876,8 +13918,8 @@ ${formattedMessage}`;
|
|
|
13876
13918
|
};
|
|
13877
13919
|
|
|
13878
13920
|
// src/compatibility/drops/images.ts
|
|
13879
|
-
var
|
|
13880
|
-
var ImagesDrop = class extends
|
|
13921
|
+
var import_liquidjs12 = __require("liquidjs");
|
|
13922
|
+
var ImagesDrop = class extends import_liquidjs12.Drop {
|
|
13881
13923
|
#instance;
|
|
13882
13924
|
#map;
|
|
13883
13925
|
constructor(instance) {
|
|
@@ -13931,8 +13973,8 @@ ${formattedMessage}`;
|
|
|
13931
13973
|
};
|
|
13932
13974
|
|
|
13933
13975
|
// src/compatibility/drops/object-handles.ts
|
|
13934
|
-
var
|
|
13935
|
-
var ObjectHandlesDrop = class extends
|
|
13976
|
+
var import_liquidjs13 = __require("liquidjs");
|
|
13977
|
+
var ObjectHandlesDrop = class extends import_liquidjs13.Drop {
|
|
13936
13978
|
#map;
|
|
13937
13979
|
constructor(map) {
|
|
13938
13980
|
super();
|
|
@@ -13972,8 +14014,8 @@ ${formattedMessage}`;
|
|
|
13972
14014
|
};
|
|
13973
14015
|
|
|
13974
14016
|
// src/compatibility/drops/pages.ts
|
|
13975
|
-
var
|
|
13976
|
-
var PagesDrop = class extends
|
|
14017
|
+
var import_liquidjs14 = __require("liquidjs");
|
|
14018
|
+
var PagesDrop = class extends import_liquidjs14.Drop {
|
|
13977
14019
|
#instance;
|
|
13978
14020
|
#map;
|
|
13979
14021
|
constructor(instance) {
|
|
@@ -14548,6 +14590,8 @@ ${injects.join("\n")}<\/script>`;
|
|
|
14548
14590
|
return `templates/${this.getPageType(name)}`;
|
|
14549
14591
|
case "sections":
|
|
14550
14592
|
return `sections/${name}`;
|
|
14593
|
+
case "blocks":
|
|
14594
|
+
return `blocks/${name}`;
|
|
14551
14595
|
default:
|
|
14552
14596
|
throw new Error(`Theme file type not supported: ${type}`);
|
|
14553
14597
|
}
|
|
@@ -14693,9 +14737,9 @@ ${injects.join("\n")}<\/script>`;
|
|
|
14693
14737
|
};
|
|
14694
14738
|
|
|
14695
14739
|
// src/liquid/drops/render.ts
|
|
14696
|
-
var
|
|
14740
|
+
var import_liquidjs15 = __require("liquidjs");
|
|
14697
14741
|
var import_lodash_es8 = __require("lodash-es");
|
|
14698
|
-
var RenderDrop = class extends
|
|
14742
|
+
var RenderDrop = class extends import_liquidjs15.Drop {
|
|
14699
14743
|
#result;
|
|
14700
14744
|
#handler;
|
|
14701
14745
|
constructor(handler) {
|
|
@@ -14721,7 +14765,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
14721
14765
|
};
|
|
14722
14766
|
|
|
14723
14767
|
// src/liquid/index.ts
|
|
14724
|
-
var
|
|
14768
|
+
var import_liquidjs40 = __require("liquidjs");
|
|
14725
14769
|
|
|
14726
14770
|
// src/utils/escape.ts
|
|
14727
14771
|
function replacerUnescape(match) {
|
|
@@ -14732,9 +14776,9 @@ ${injects.join("\n")}<\/script>`;
|
|
|
14732
14776
|
}
|
|
14733
14777
|
|
|
14734
14778
|
// src/liquid/tags/assign.ts
|
|
14735
|
-
var
|
|
14779
|
+
var import_liquidjs16 = __require("liquidjs");
|
|
14736
14780
|
function bind(_liquidSwell) {
|
|
14737
|
-
return class AssignTag extends
|
|
14781
|
+
return class AssignTag extends import_liquidjs16.Tag {
|
|
14738
14782
|
key;
|
|
14739
14783
|
value;
|
|
14740
14784
|
identifier;
|
|
@@ -14746,7 +14790,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
14746
14790
|
this.tokenizer.skipBlank();
|
|
14747
14791
|
this.tokenizer.advance();
|
|
14748
14792
|
try {
|
|
14749
|
-
this.value = new
|
|
14793
|
+
this.value = new import_liquidjs16.Value(this.tokenizer.readFilteredValue(), this.liquid);
|
|
14750
14794
|
} catch (e) {
|
|
14751
14795
|
console.warn(
|
|
14752
14796
|
`Liquid "assign" tag: ${e instanceof Error ? e.stack : String(e)}`
|
|
@@ -14773,9 +14817,9 @@ ${injects.join("\n")}<\/script>`;
|
|
|
14773
14817
|
}
|
|
14774
14818
|
|
|
14775
14819
|
// src/liquid/tags/case.ts
|
|
14776
|
-
var
|
|
14820
|
+
var import_liquidjs17 = __require("liquidjs");
|
|
14777
14821
|
function bind2(liquidSwell) {
|
|
14778
|
-
return class CaseTag extends
|
|
14822
|
+
return class CaseTag extends import_liquidjs17.Tag {
|
|
14779
14823
|
value;
|
|
14780
14824
|
branches;
|
|
14781
14825
|
elseTemplates;
|
|
@@ -14786,7 +14830,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
14786
14830
|
const caseVar = this.tokenizer.readValue()?.getText();
|
|
14787
14831
|
this.isBlock = Boolean(caseVar?.startsWith("block."));
|
|
14788
14832
|
this.tokenizer.p = begin;
|
|
14789
|
-
this.value = new
|
|
14833
|
+
this.value = new import_liquidjs17.Value(this.tokenizer.readFilteredValue(), this.liquid);
|
|
14790
14834
|
this.branches = [];
|
|
14791
14835
|
this.elseTemplates = [];
|
|
14792
14836
|
let p = [];
|
|
@@ -14824,12 +14868,12 @@ ${injects.join("\n")}<\/script>`;
|
|
|
14824
14868
|
}
|
|
14825
14869
|
*render(ctx, emitter) {
|
|
14826
14870
|
const r = this.liquid.renderer;
|
|
14827
|
-
const target = (0,
|
|
14871
|
+
const target = (0, import_liquidjs17.toValue)(yield this.value.value(ctx, ctx.opts.lenientIf));
|
|
14828
14872
|
let branchHit = false;
|
|
14829
14873
|
let output = "";
|
|
14830
14874
|
for (const branch of this.branches) {
|
|
14831
14875
|
for (const valueToken of branch.values) {
|
|
14832
|
-
const value = yield (0,
|
|
14876
|
+
const value = yield (0, import_liquidjs17.evalToken)(valueToken, ctx, ctx.opts.lenientIf);
|
|
14833
14877
|
if (target === value) {
|
|
14834
14878
|
const blockOutput = yield r.renderTemplates(branch.templates, ctx);
|
|
14835
14879
|
output += blockOutput;
|
|
@@ -14862,15 +14906,15 @@ ${injects.join("\n")}<\/script>`;
|
|
|
14862
14906
|
}
|
|
14863
14907
|
|
|
14864
14908
|
// src/liquid/tags/comment.ts
|
|
14865
|
-
var
|
|
14909
|
+
var import_liquidjs18 = __require("liquidjs");
|
|
14866
14910
|
function bind3(_liquidSwell) {
|
|
14867
|
-
return class CommentTag extends
|
|
14911
|
+
return class CommentTag extends import_liquidjs18.Tag {
|
|
14868
14912
|
constructor(tagToken, remainTokens, liquid) {
|
|
14869
14913
|
super(tagToken, remainTokens, liquid);
|
|
14870
14914
|
let nested = 1;
|
|
14871
14915
|
while (remainTokens.length > 0) {
|
|
14872
14916
|
const token = remainTokens.shift();
|
|
14873
|
-
if (
|
|
14917
|
+
if (import_liquidjs18.TypeGuards.isTagToken(token)) {
|
|
14874
14918
|
switch (token.name) {
|
|
14875
14919
|
case "comment":
|
|
14876
14920
|
nested += 1;
|
|
@@ -14894,14 +14938,161 @@ ${injects.join("\n")}<\/script>`;
|
|
|
14894
14938
|
};
|
|
14895
14939
|
}
|
|
14896
14940
|
|
|
14941
|
+
// src/liquid/tags/content_for.ts
|
|
14942
|
+
var import_liquidjs22 = __require("liquidjs");
|
|
14943
|
+
var import_lodash_es10 = __require("lodash-es");
|
|
14944
|
+
|
|
14945
|
+
// src/liquid/hash.ts
|
|
14946
|
+
var import_lodash_es9 = __require("lodash-es");
|
|
14947
|
+
var import_liquidjs21 = __require("liquidjs");
|
|
14948
|
+
|
|
14949
|
+
// src/liquid/tokienizer.ts
|
|
14950
|
+
var import_liquidjs20 = __require("liquidjs");
|
|
14951
|
+
|
|
14952
|
+
// src/liquid/tokens/identifier-token.ts
|
|
14953
|
+
var import_liquidjs19 = __require("liquidjs");
|
|
14954
|
+
var IdentifierToken = class extends import_liquidjs19.Token {
|
|
14955
|
+
constructor(input, begin, end, file) {
|
|
14956
|
+
super(import_liquidjs19.TokenKind.Word, input, begin, end, file);
|
|
14957
|
+
this.input = input;
|
|
14958
|
+
this.begin = begin;
|
|
14959
|
+
this.end = end;
|
|
14960
|
+
this.file = file;
|
|
14961
|
+
this.content = this.getText();
|
|
14962
|
+
}
|
|
14963
|
+
content;
|
|
14964
|
+
};
|
|
14965
|
+
|
|
14966
|
+
// src/liquid/tokienizer.ts
|
|
14967
|
+
var isNumber2 = (c) => c >= "0" && c <= "9";
|
|
14968
|
+
var isCharacter = (c) => c >= "a" && c <= "z" || c >= "A" && c <= "Z";
|
|
14969
|
+
var isWord = (c) => "_-?".includes(c) || isCharacter(c) || isNumber2(c);
|
|
14970
|
+
var TokenizerSwell = class extends import_liquidjs20.Tokenizer {
|
|
14971
|
+
readIdentifier() {
|
|
14972
|
+
this.skipBlank();
|
|
14973
|
+
const begin = this.p;
|
|
14974
|
+
while (!this.end()) {
|
|
14975
|
+
const char = this.peek();
|
|
14976
|
+
if (isWord(char) || char === ".") {
|
|
14977
|
+
this.p++;
|
|
14978
|
+
} else {
|
|
14979
|
+
break;
|
|
14980
|
+
}
|
|
14981
|
+
}
|
|
14982
|
+
return new IdentifierToken(this.input, begin, this.p, this.file);
|
|
14983
|
+
}
|
|
14984
|
+
};
|
|
14985
|
+
|
|
14986
|
+
// src/liquid/hash.ts
|
|
14987
|
+
var HashSwell = class extends import_liquidjs21.Hash {
|
|
14988
|
+
constructor(input, jekyllStyle) {
|
|
14989
|
+
super(input, jekyllStyle);
|
|
14990
|
+
const tokenizer = input instanceof import_liquidjs21.Tokenizer ? input : new TokenizerSwell(input, {});
|
|
14991
|
+
for (const hash of tokenizer.readHashes(jekyllStyle)) {
|
|
14992
|
+
this.hash[hash.name.content] = hash.value;
|
|
14993
|
+
}
|
|
14994
|
+
}
|
|
14995
|
+
*render(ctx) {
|
|
14996
|
+
const hash = {};
|
|
14997
|
+
for (const key of Object.keys(this.hash)) {
|
|
14998
|
+
const token = this.hash[key];
|
|
14999
|
+
if (token !== void 0) {
|
|
15000
|
+
const value = yield (0, import_liquidjs21.evalToken)(token, ctx);
|
|
15001
|
+
(0, import_lodash_es9.set)(hash, key, value);
|
|
15002
|
+
}
|
|
15003
|
+
}
|
|
15004
|
+
return hash;
|
|
15005
|
+
}
|
|
15006
|
+
};
|
|
15007
|
+
|
|
15008
|
+
// src/liquid/tags/content_for.ts
|
|
15009
|
+
function bind4(liquidSwell) {
|
|
15010
|
+
return class ContentForTag extends import_liquidjs22.Tag {
|
|
15011
|
+
name;
|
|
15012
|
+
hash;
|
|
15013
|
+
constructor(token, remainTokens, liquid) {
|
|
15014
|
+
super(token, remainTokens, liquid);
|
|
15015
|
+
const tokenizer = token.tokenizer;
|
|
15016
|
+
this.name = tokenizer.readValue()?.content;
|
|
15017
|
+
this.hash = new HashSwell(tokenizer.remaining());
|
|
15018
|
+
}
|
|
15019
|
+
*render(ctx, emitter) {
|
|
15020
|
+
const section = yield ctx._get(["section"]);
|
|
15021
|
+
const block = yield ctx._get(["block"]);
|
|
15022
|
+
const hash = yield this.hash.render(ctx);
|
|
15023
|
+
const blocks = this.getBlocks(section, block, hash);
|
|
15024
|
+
for (const block2 of blocks) {
|
|
15025
|
+
if (!isObject2(block2) || typeof block2.type !== "string") {
|
|
15026
|
+
continue;
|
|
15027
|
+
}
|
|
15028
|
+
const blockPath = yield liquidSwell.getThemeBlockPath(
|
|
15029
|
+
block2.type
|
|
15030
|
+
);
|
|
15031
|
+
if (!blockPath) {
|
|
15032
|
+
continue;
|
|
15033
|
+
}
|
|
15034
|
+
const childCtx = ctx.spawn();
|
|
15035
|
+
const scope = childCtx.bottom();
|
|
15036
|
+
(0, import_lodash_es10.assign)(scope, { section });
|
|
15037
|
+
(0, import_lodash_es10.assign)(scope, { block: block2 });
|
|
15038
|
+
(0, import_lodash_es10.assign)(scope, hash);
|
|
15039
|
+
const templates = yield this.liquid._parseFile(
|
|
15040
|
+
blockPath,
|
|
15041
|
+
childCtx.sync
|
|
15042
|
+
);
|
|
15043
|
+
yield this.liquid.renderer.renderTemplates(
|
|
15044
|
+
templates,
|
|
15045
|
+
childCtx,
|
|
15046
|
+
emitter
|
|
15047
|
+
);
|
|
15048
|
+
}
|
|
15049
|
+
}
|
|
15050
|
+
getBlocks(section, block, hash) {
|
|
15051
|
+
const blockConfigs = this.getBlockConfigs(section, block);
|
|
15052
|
+
if (!isObject2(hash) || !hash.type) {
|
|
15053
|
+
return blockConfigs;
|
|
15054
|
+
}
|
|
15055
|
+
const blockConfig = blockConfigs.find(
|
|
15056
|
+
(blockConfig2) => isObject2(blockConfig2) && blockConfig2.type === hash.type
|
|
15057
|
+
);
|
|
15058
|
+
return blockConfig ? [blockConfig] : [];
|
|
15059
|
+
}
|
|
15060
|
+
getBlockConfigs(section, block) {
|
|
15061
|
+
if (isObject2(block) && block.blocks) {
|
|
15062
|
+
return Object.values(block.blocks);
|
|
15063
|
+
}
|
|
15064
|
+
if (isObject2(section) && Array.isArray(section.blocks)) {
|
|
15065
|
+
return section.blocks;
|
|
15066
|
+
}
|
|
15067
|
+
return [];
|
|
15068
|
+
}
|
|
15069
|
+
};
|
|
15070
|
+
}
|
|
15071
|
+
|
|
15072
|
+
// src/liquid/tags/doc.ts
|
|
15073
|
+
var import_liquidjs23 = __require("liquidjs");
|
|
15074
|
+
function bind5() {
|
|
15075
|
+
return class DocTag extends import_liquidjs23.Tag {
|
|
15076
|
+
constructor(token, remainTokens, liquid, parser) {
|
|
15077
|
+
super(token, remainTokens, liquid);
|
|
15078
|
+
const stream = parser.parseStream(remainTokens).on("tag:enddoc", () => {
|
|
15079
|
+
stream.stop();
|
|
15080
|
+
});
|
|
15081
|
+
stream.start();
|
|
15082
|
+
}
|
|
15083
|
+
render() {
|
|
15084
|
+
}
|
|
15085
|
+
};
|
|
15086
|
+
}
|
|
15087
|
+
|
|
14897
15088
|
// src/liquid/tags/for.ts
|
|
14898
|
-
var
|
|
15089
|
+
var import_liquidjs24 = __require("liquidjs");
|
|
14899
15090
|
var MODIFIERS = Object.freeze(["offset", "limit", "reversed"]);
|
|
14900
|
-
function
|
|
14901
|
-
return class ForTag extends
|
|
15091
|
+
function bind6(_liquidSwell) {
|
|
15092
|
+
return class ForTag extends import_liquidjs24.ForTag {
|
|
14902
15093
|
*render(ctx, emitter) {
|
|
14903
15094
|
const r = this.liquid.renderer;
|
|
14904
|
-
let collection = yield (0,
|
|
15095
|
+
let collection = yield (0, import_liquidjs24.evalToken)(this.collection, ctx);
|
|
14905
15096
|
collection = yield resolveEnumerable(collection);
|
|
14906
15097
|
if (!collection.length) {
|
|
14907
15098
|
yield r.renderTemplates(this.elseTemplates, ctx, emitter);
|
|
@@ -14968,10 +15159,10 @@ ${injects.join("\n")}<\/script>`;
|
|
|
14968
15159
|
}
|
|
14969
15160
|
|
|
14970
15161
|
// src/liquid/tags/form.ts
|
|
14971
|
-
var
|
|
15162
|
+
var import_liquidjs25 = __require("liquidjs");
|
|
14972
15163
|
var IGNORED_SHOPIFY_FORMS = Object.freeze(["new_comment", "guest_login"]);
|
|
14973
|
-
function
|
|
14974
|
-
return class FormTag extends
|
|
15164
|
+
function bind7(liquidSwell) {
|
|
15165
|
+
return class FormTag extends import_liquidjs25.Tag {
|
|
14975
15166
|
formType;
|
|
14976
15167
|
formConfig;
|
|
14977
15168
|
templates;
|
|
@@ -14984,10 +15175,10 @@ ${injects.join("\n")}<\/script>`;
|
|
|
14984
15175
|
this.formConfig = liquidSwell.theme.getFormConfig(this.formType);
|
|
14985
15176
|
this.arg = tokenizer.readValue();
|
|
14986
15177
|
this.templates = [];
|
|
14987
|
-
this.hash = new
|
|
15178
|
+
this.hash = new import_liquidjs25.Hash(this.tokenizer.remaining());
|
|
14988
15179
|
while (remainTokens.length > 0) {
|
|
14989
15180
|
const token2 = remainTokens.shift();
|
|
14990
|
-
if (
|
|
15181
|
+
if (import_liquidjs25.TypeGuards.isTagToken(token2) && token2.name === "endform") {
|
|
14991
15182
|
return;
|
|
14992
15183
|
}
|
|
14993
15184
|
this.templates.push(parser.parseToken(token2, remainTokens));
|
|
@@ -15005,7 +15196,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15005
15196
|
return;
|
|
15006
15197
|
}
|
|
15007
15198
|
const r = this.liquid.renderer;
|
|
15008
|
-
const arg = yield (0,
|
|
15199
|
+
const arg = yield (0, import_liquidjs25.evalToken)(this.arg, ctx);
|
|
15009
15200
|
const hash = yield this.hash.render(ctx);
|
|
15010
15201
|
const scope = ctx.getAll();
|
|
15011
15202
|
const attrs = " " + Object.entries({ id: `${this.formConfig.id}_form`, ...hash }).reduce((acc, [key, value]) => {
|
|
@@ -15066,9 +15257,9 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15066
15257
|
}
|
|
15067
15258
|
|
|
15068
15259
|
// src/liquid/tags/if.ts
|
|
15069
|
-
var
|
|
15070
|
-
function
|
|
15071
|
-
return class IfTag extends
|
|
15260
|
+
var import_liquidjs26 = __require("liquidjs");
|
|
15261
|
+
function bind8(_liquidSwell) {
|
|
15262
|
+
return class IfTag extends import_liquidjs26.Tag {
|
|
15072
15263
|
branches = [];
|
|
15073
15264
|
elseTemplates;
|
|
15074
15265
|
constructor(tagToken, remainTokens, liquid, parser) {
|
|
@@ -15077,22 +15268,22 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15077
15268
|
parser.parseStream(remainTokens).on(
|
|
15078
15269
|
"start",
|
|
15079
15270
|
() => this.branches.push({
|
|
15080
|
-
value: new
|
|
15271
|
+
value: new import_liquidjs26.Value(
|
|
15081
15272
|
tagToken.tokenizer.readFilteredValue(),
|
|
15082
15273
|
this.liquid
|
|
15083
15274
|
),
|
|
15084
15275
|
templates: p = []
|
|
15085
15276
|
})
|
|
15086
15277
|
).on("tag:elsif", (token) => {
|
|
15087
|
-
(0,
|
|
15278
|
+
(0, import_liquidjs26.assert)(!this.elseTemplates, "unexpected elsif after else");
|
|
15088
15279
|
this.branches.push({
|
|
15089
|
-
value: new
|
|
15280
|
+
value: new import_liquidjs26.Value(token.tokenizer.readFilteredValue(), this.liquid),
|
|
15090
15281
|
templates: p = []
|
|
15091
15282
|
});
|
|
15092
15283
|
}).on("tag:else", (tag) => {
|
|
15093
15284
|
if (tag.args.length > 0) {
|
|
15094
15285
|
this.branches.push({
|
|
15095
|
-
value: new
|
|
15286
|
+
value: new import_liquidjs26.Value(tag.tokenizer.readFilteredValue(), this.liquid),
|
|
15096
15287
|
templates: p = []
|
|
15097
15288
|
});
|
|
15098
15289
|
} else {
|
|
@@ -15110,7 +15301,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15110
15301
|
const r = this.liquid.renderer;
|
|
15111
15302
|
for (const { value, templates } of this.branches) {
|
|
15112
15303
|
const v = yield value.value(ctx, ctx.opts.lenientIf);
|
|
15113
|
-
if ((0,
|
|
15304
|
+
if ((0, import_liquidjs26.isTruthy)(v, ctx)) {
|
|
15114
15305
|
yield r.renderTemplates(templates, ctx, emitter);
|
|
15115
15306
|
return;
|
|
15116
15307
|
}
|
|
@@ -15131,20 +15322,20 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15131
15322
|
};
|
|
15132
15323
|
}
|
|
15133
15324
|
function assertEmpty(predicate, message = `unexpected ${JSON.stringify(predicate)}`) {
|
|
15134
|
-
(0,
|
|
15325
|
+
(0, import_liquidjs26.assert)(!predicate, message);
|
|
15135
15326
|
}
|
|
15136
15327
|
|
|
15137
15328
|
// src/liquid/tags/javascript.ts
|
|
15138
|
-
var
|
|
15139
|
-
function
|
|
15140
|
-
return class JavascriptTag extends
|
|
15329
|
+
var import_liquidjs27 = __require("liquidjs");
|
|
15330
|
+
function bind9(_liquidSwell) {
|
|
15331
|
+
return class JavascriptTag extends import_liquidjs27.Tag {
|
|
15141
15332
|
templates;
|
|
15142
15333
|
constructor(token, remainTokens, liquid, parser) {
|
|
15143
15334
|
super(token, remainTokens, liquid);
|
|
15144
15335
|
this.templates = [];
|
|
15145
15336
|
while (remainTokens.length > 0) {
|
|
15146
15337
|
const token2 = remainTokens.shift();
|
|
15147
|
-
if (
|
|
15338
|
+
if (import_liquidjs27.TypeGuards.isTagToken(token2) && token2.name === "endjavascript") {
|
|
15148
15339
|
return;
|
|
15149
15340
|
}
|
|
15150
15341
|
this.templates.push(parser.parseToken(token2, remainTokens));
|
|
@@ -15162,9 +15353,9 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15162
15353
|
}
|
|
15163
15354
|
|
|
15164
15355
|
// src/liquid/tags/layout.ts
|
|
15165
|
-
var
|
|
15166
|
-
function
|
|
15167
|
-
return class LayoutTag extends
|
|
15356
|
+
var import_liquidjs28 = __require("liquidjs");
|
|
15357
|
+
function bind10(liquidSwell) {
|
|
15358
|
+
return class LayoutTag extends import_liquidjs28.Tag {
|
|
15168
15359
|
fileName;
|
|
15169
15360
|
constructor(token, remainTokens, liquid, _parser) {
|
|
15170
15361
|
super(token, remainTokens, liquid);
|
|
@@ -15180,9 +15371,9 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15180
15371
|
}
|
|
15181
15372
|
|
|
15182
15373
|
// src/liquid/tags/paginate.ts
|
|
15183
|
-
var
|
|
15184
|
-
function
|
|
15185
|
-
return class PaginateTag extends
|
|
15374
|
+
var import_liquidjs29 = __require("liquidjs");
|
|
15375
|
+
function bind11(liquidSwell) {
|
|
15376
|
+
return class PaginateTag extends import_liquidjs29.Tag {
|
|
15186
15377
|
collection;
|
|
15187
15378
|
pageSize;
|
|
15188
15379
|
templates;
|
|
@@ -15197,7 +15388,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15197
15388
|
}
|
|
15198
15389
|
this.templates = [];
|
|
15199
15390
|
this.collection = collection;
|
|
15200
|
-
this.hash = new
|
|
15391
|
+
this.hash = new import_liquidjs29.Hash(this.tokenizer.remaining());
|
|
15201
15392
|
const stream = parser.parseStream(remainTokens).on("tag:endpaginate", () => stream.stop()).on("template", (tpl) => {
|
|
15202
15393
|
this.templates.push(tpl);
|
|
15203
15394
|
}).on("end", () => {
|
|
@@ -15207,8 +15398,8 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15207
15398
|
}
|
|
15208
15399
|
*render(ctx, emitter) {
|
|
15209
15400
|
const r = this.liquid.renderer;
|
|
15210
|
-
const collection = yield (0,
|
|
15211
|
-
const pageSize = Number(yield (0,
|
|
15401
|
+
const collection = yield (0, import_liquidjs29.evalToken)(this.collection, ctx);
|
|
15402
|
+
const pageSize = Number(yield (0, import_liquidjs29.evalToken)(this.pageSize, ctx));
|
|
15212
15403
|
const hash = yield this.hash.render(ctx);
|
|
15213
15404
|
if (!Number.isNaN(pageSize) && collection instanceof SwellStorefrontCollection && collection.limit !== pageSize) {
|
|
15214
15405
|
yield collection._get({
|
|
@@ -15234,10 +15425,10 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15234
15425
|
}
|
|
15235
15426
|
|
|
15236
15427
|
// src/liquid/tags/render.ts
|
|
15237
|
-
var
|
|
15238
|
-
var
|
|
15239
|
-
function
|
|
15240
|
-
return class RenderTag extends
|
|
15428
|
+
var import_lodash_es11 = __require("lodash-es");
|
|
15429
|
+
var import_liquidjs30 = __require("liquidjs");
|
|
15430
|
+
function bind12(liquidSwell) {
|
|
15431
|
+
return class RenderTag extends import_liquidjs30.RenderTag {
|
|
15241
15432
|
*render(ctx, emitter) {
|
|
15242
15433
|
const self = this;
|
|
15243
15434
|
const { liquid } = this;
|
|
@@ -15247,23 +15438,26 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15247
15438
|
ctx,
|
|
15248
15439
|
liquid
|
|
15249
15440
|
);
|
|
15250
|
-
(0,
|
|
15441
|
+
(0, import_liquidjs30.assert)(filename, () => `illegal file path "${filename}"`);
|
|
15251
15442
|
const configPath = yield liquidSwell.getComponentPath(
|
|
15252
15443
|
filename
|
|
15253
15444
|
);
|
|
15254
15445
|
const childCtx = ctx.spawn();
|
|
15255
15446
|
const scope = childCtx.bottom();
|
|
15256
|
-
(0,
|
|
15447
|
+
(0, import_lodash_es11.assign)(scope, ctx.bottom());
|
|
15257
15448
|
const parentSection = yield ctx._get(["section"]);
|
|
15258
|
-
if (parentSection) (0,
|
|
15449
|
+
if (parentSection) (0, import_lodash_es11.assign)(scope, { section: parentSection });
|
|
15450
|
+
const parentBlock = yield ctx._get(["block"]);
|
|
15451
|
+
if (parentBlock) (0, import_lodash_es11.assign)(scope, { block: parentBlock });
|
|
15452
|
+
(0, import_lodash_es11.assign)(scope, yield hash.render(ctx));
|
|
15259
15453
|
if (self["with"]) {
|
|
15260
15454
|
const { value, alias } = self["with"];
|
|
15261
15455
|
const aliasName = alias || filename;
|
|
15262
|
-
scope[aliasName] = yield (0,
|
|
15456
|
+
scope[aliasName] = yield (0, import_liquidjs30.evalToken)(value, ctx);
|
|
15263
15457
|
}
|
|
15264
15458
|
if (self["for"]) {
|
|
15265
15459
|
const { value, alias } = self["for"];
|
|
15266
|
-
let collection = yield (0,
|
|
15460
|
+
let collection = yield (0, import_liquidjs30.evalToken)(value, ctx);
|
|
15267
15461
|
collection = yield resolveEnumerable(collection);
|
|
15268
15462
|
scope["forloop"] = new ForloopDrop(
|
|
15269
15463
|
collection.length,
|
|
@@ -15306,13 +15500,13 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15306
15500
|
default:
|
|
15307
15501
|
break;
|
|
15308
15502
|
}
|
|
15309
|
-
return yield (0,
|
|
15503
|
+
return yield (0, import_liquidjs30.evalToken)(file, ctx);
|
|
15310
15504
|
}
|
|
15311
15505
|
|
|
15312
15506
|
// src/liquid/tags/section.ts
|
|
15313
|
-
var
|
|
15314
|
-
function
|
|
15315
|
-
return class SectionTag extends
|
|
15507
|
+
var import_liquidjs31 = __require("liquidjs");
|
|
15508
|
+
function bind13(liquidSwell) {
|
|
15509
|
+
return class SectionTag extends import_liquidjs31.Tag {
|
|
15316
15510
|
fileName;
|
|
15317
15511
|
constructor(token, remainTokens, liquid, _parser) {
|
|
15318
15512
|
super(token, remainTokens, liquid);
|
|
@@ -15363,10 +15557,10 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15363
15557
|
}
|
|
15364
15558
|
|
|
15365
15559
|
// src/liquid/tags/sections.ts
|
|
15366
|
-
var
|
|
15560
|
+
var import_liquidjs32 = __require("liquidjs");
|
|
15367
15561
|
var import_json54 = __toESM(__require("json5"), 1);
|
|
15368
|
-
function
|
|
15369
|
-
return class SectionsTag extends
|
|
15562
|
+
function bind14(liquidSwell) {
|
|
15563
|
+
return class SectionsTag extends import_liquidjs32.Tag {
|
|
15370
15564
|
fileName;
|
|
15371
15565
|
constructor(token, remainTokens, liquid, _parser) {
|
|
15372
15566
|
super(token, remainTokens, liquid);
|
|
@@ -15406,9 +15600,9 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15406
15600
|
}
|
|
15407
15601
|
|
|
15408
15602
|
// src/liquid/tags/style.ts
|
|
15409
|
-
var
|
|
15410
|
-
function
|
|
15411
|
-
return class StyleTag extends
|
|
15603
|
+
var import_liquidjs33 = __require("liquidjs");
|
|
15604
|
+
function bind15(_liquidSwell) {
|
|
15605
|
+
return class StyleTag extends import_liquidjs33.Tag {
|
|
15412
15606
|
templates;
|
|
15413
15607
|
hash;
|
|
15414
15608
|
constructor(token, remainTokens, liquid, parser) {
|
|
@@ -15417,7 +15611,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15417
15611
|
const tagBegin = token.begin;
|
|
15418
15612
|
while (remainTokens.length > 0) {
|
|
15419
15613
|
const token2 = remainTokens.shift();
|
|
15420
|
-
if (
|
|
15614
|
+
if (import_liquidjs33.TypeGuards.isTagToken(token2) && token2.name === "endstyle") {
|
|
15421
15615
|
this.hash = md5(token2.input.slice(tagBegin, token2.end));
|
|
15422
15616
|
return;
|
|
15423
15617
|
}
|
|
@@ -15440,16 +15634,16 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15440
15634
|
}
|
|
15441
15635
|
|
|
15442
15636
|
// src/liquid/tags/stylesheet.ts
|
|
15443
|
-
var
|
|
15444
|
-
function
|
|
15445
|
-
return class StyleSheetTag extends
|
|
15637
|
+
var import_liquidjs34 = __require("liquidjs");
|
|
15638
|
+
function bind16(_liquidSwell) {
|
|
15639
|
+
return class StyleSheetTag extends import_liquidjs34.Tag {
|
|
15446
15640
|
templates;
|
|
15447
15641
|
constructor(token, remainTokens, liquid, parser) {
|
|
15448
15642
|
super(token, remainTokens, liquid);
|
|
15449
15643
|
this.templates = [];
|
|
15450
15644
|
while (remainTokens.length > 0) {
|
|
15451
15645
|
const token2 = remainTokens.shift();
|
|
15452
|
-
if (
|
|
15646
|
+
if (import_liquidjs34.TypeGuards.isTagToken(token2) && token2.name === "endstylesheet") {
|
|
15453
15647
|
return;
|
|
15454
15648
|
}
|
|
15455
15649
|
this.templates.push(parser.parseToken(token2, remainTokens));
|
|
@@ -15465,9 +15659,9 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15465
15659
|
}
|
|
15466
15660
|
|
|
15467
15661
|
// src/liquid/tags/shopify/include.ts
|
|
15468
|
-
var
|
|
15469
|
-
function
|
|
15470
|
-
return class IncludeTag extends
|
|
15662
|
+
var import_liquidjs35 = __require("liquidjs");
|
|
15663
|
+
function bind17(liquidSwell) {
|
|
15664
|
+
return class IncludeTag extends import_liquidjs35.IncludeTag {
|
|
15471
15665
|
*render(ctx, emitter) {
|
|
15472
15666
|
const { hash } = this;
|
|
15473
15667
|
const filepath = yield renderFilePath(
|
|
@@ -15475,13 +15669,13 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15475
15669
|
ctx,
|
|
15476
15670
|
this.liquid
|
|
15477
15671
|
);
|
|
15478
|
-
(0,
|
|
15672
|
+
(0, import_liquidjs35.assert)(filepath, () => `illegal file path "${filepath}"`);
|
|
15479
15673
|
const saved = ctx.saveRegister("blocks", "blockMode");
|
|
15480
15674
|
ctx.setRegister("blocks", {});
|
|
15481
15675
|
ctx.setRegister("blockMode", 0);
|
|
15482
15676
|
const scope = yield hash.render(ctx);
|
|
15483
15677
|
if (this.withVar) {
|
|
15484
|
-
scope[filepath] = yield (0,
|
|
15678
|
+
scope[filepath] = yield (0, import_liquidjs35.evalToken)(this.withVar, ctx);
|
|
15485
15679
|
}
|
|
15486
15680
|
ctx.push(ctx.opts.jekyllInclude ? { include: scope } : scope);
|
|
15487
15681
|
const output = yield liquidSwell.getComponentPath(filepath).then((path) => liquidSwell.getThemeConfig(path)).then((themeConfig) => liquidSwell.renderTemplate(themeConfig, ctx));
|
|
@@ -15493,10 +15687,10 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15493
15687
|
}
|
|
15494
15688
|
|
|
15495
15689
|
// src/liquid/tags/shopify/schema.ts
|
|
15496
|
-
var
|
|
15690
|
+
var import_liquidjs36 = __require("liquidjs");
|
|
15497
15691
|
var import_json55 = __toESM(__require("json5"), 1);
|
|
15498
|
-
function
|
|
15499
|
-
return class SchemaTag extends
|
|
15692
|
+
function bind18(liquidSwell) {
|
|
15693
|
+
return class SchemaTag extends import_liquidjs36.Tag {
|
|
15500
15694
|
templates;
|
|
15501
15695
|
constructor(token, remainTokens, liquid, parser) {
|
|
15502
15696
|
super(token, remainTokens, liquid);
|
|
@@ -15518,6 +15712,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15518
15712
|
liquidSwell.lastSchema = void 0;
|
|
15519
15713
|
if (typeof jsonOutput === "string") {
|
|
15520
15714
|
liquidSwell.lastSchema = import_json55.default.parse(jsonOutput);
|
|
15715
|
+
expandThemeBlocks(liquidSwell);
|
|
15521
15716
|
}
|
|
15522
15717
|
} catch (err) {
|
|
15523
15718
|
console.warn(err);
|
|
@@ -15527,11 +15722,22 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15527
15722
|
}
|
|
15528
15723
|
};
|
|
15529
15724
|
}
|
|
15725
|
+
function expandThemeBlocks(liquidSwell) {
|
|
15726
|
+
const blocks = liquidSwell.lastSchema?.blocks;
|
|
15727
|
+
if (!Array.isArray(blocks)) {
|
|
15728
|
+
return;
|
|
15729
|
+
}
|
|
15730
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
15731
|
+
if (blocks[i].type === "@theme") {
|
|
15732
|
+
blocks.splice(i, 1, ...liquidSwell.theme.getAllThemeBlockSchemas());
|
|
15733
|
+
}
|
|
15734
|
+
}
|
|
15735
|
+
}
|
|
15530
15736
|
|
|
15531
15737
|
// src/liquid/tags/inline_editable.ts
|
|
15532
|
-
var
|
|
15533
|
-
function
|
|
15534
|
-
return class InlineEditableTag extends
|
|
15738
|
+
var import_liquidjs37 = __require("liquidjs");
|
|
15739
|
+
function bind19(_liquidSwell) {
|
|
15740
|
+
return class InlineEditableTag extends import_liquidjs37.Tag {
|
|
15535
15741
|
key;
|
|
15536
15742
|
value;
|
|
15537
15743
|
constructor(token, remainTokens, liquid, _parser) {
|
|
@@ -15559,129 +15765,131 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15559
15765
|
assign: bind,
|
|
15560
15766
|
case: bind2,
|
|
15561
15767
|
comment: bind3,
|
|
15562
|
-
|
|
15563
|
-
|
|
15564
|
-
|
|
15565
|
-
|
|
15566
|
-
|
|
15567
|
-
|
|
15568
|
-
|
|
15569
|
-
|
|
15570
|
-
|
|
15571
|
-
|
|
15768
|
+
content_for: bind4,
|
|
15769
|
+
doc: bind5,
|
|
15770
|
+
for: bind6,
|
|
15771
|
+
form: bind7,
|
|
15772
|
+
if: bind8,
|
|
15773
|
+
javascript: bind9,
|
|
15774
|
+
layout: bind10,
|
|
15775
|
+
paginate: bind11,
|
|
15776
|
+
render: bind12,
|
|
15777
|
+
section: bind13,
|
|
15778
|
+
sections: bind14,
|
|
15779
|
+
style: bind15,
|
|
15572
15780
|
// Shopify compatibility only
|
|
15573
|
-
include:
|
|
15574
|
-
schema:
|
|
15575
|
-
stylesheet:
|
|
15781
|
+
include: bind17,
|
|
15782
|
+
schema: bind18,
|
|
15783
|
+
stylesheet: bind16,
|
|
15576
15784
|
// Swell only
|
|
15577
|
-
inline_editable:
|
|
15785
|
+
inline_editable: bind19
|
|
15578
15786
|
};
|
|
15579
15787
|
function bindTags(liquidSwell) {
|
|
15580
15788
|
Object.entries(tags).forEach(
|
|
15581
|
-
([tag,
|
|
15789
|
+
([tag, bind70]) => liquidSwell.registerTag(tag, bind70(liquidSwell))
|
|
15582
15790
|
);
|
|
15583
15791
|
}
|
|
15584
15792
|
|
|
15585
15793
|
// src/liquid/filters/asset_url.ts
|
|
15586
|
-
function
|
|
15794
|
+
function bind20(liquidSwell) {
|
|
15587
15795
|
return function filterAssetUrl(assetPath) {
|
|
15588
15796
|
return liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
|
|
15589
15797
|
};
|
|
15590
15798
|
}
|
|
15591
15799
|
|
|
15592
15800
|
// src/liquid/filters/brightness_difference.ts
|
|
15593
|
-
function
|
|
15801
|
+
function bind21(_liquidSwell) {
|
|
15594
15802
|
return (color1, color2) => {
|
|
15595
15803
|
return ThemeColor.get(color1).brightnessDifference(ThemeColor.get(color2));
|
|
15596
15804
|
};
|
|
15597
15805
|
}
|
|
15598
15806
|
|
|
15599
15807
|
// src/liquid/filters/color_brightness.ts
|
|
15600
|
-
function
|
|
15808
|
+
function bind22(_liquidSwell) {
|
|
15601
15809
|
return (color) => {
|
|
15602
15810
|
return ThemeColor.get(color).brightness();
|
|
15603
15811
|
};
|
|
15604
15812
|
}
|
|
15605
15813
|
|
|
15606
15814
|
// src/liquid/filters/color_contrast.ts
|
|
15607
|
-
function
|
|
15815
|
+
function bind23(_liquidSwell) {
|
|
15608
15816
|
return (color1, color2) => {
|
|
15609
15817
|
return ThemeColor.get(color1).contrast(ThemeColor.get(color2));
|
|
15610
15818
|
};
|
|
15611
15819
|
}
|
|
15612
15820
|
|
|
15613
15821
|
// src/liquid/filters/color_darken.ts
|
|
15614
|
-
function
|
|
15822
|
+
function bind24(_liquidSwell) {
|
|
15615
15823
|
return (color, percent) => {
|
|
15616
15824
|
return ThemeColor.get(color).darken(percent);
|
|
15617
15825
|
};
|
|
15618
15826
|
}
|
|
15619
15827
|
|
|
15620
15828
|
// src/liquid/filters/color_desaturate.ts
|
|
15621
|
-
function
|
|
15829
|
+
function bind25(_liquidSwell) {
|
|
15622
15830
|
return (color, value) => {
|
|
15623
15831
|
return ThemeColor.get(color).desaturate(value);
|
|
15624
15832
|
};
|
|
15625
15833
|
}
|
|
15626
15834
|
|
|
15627
15835
|
// src/liquid/filters/color_difference.ts
|
|
15628
|
-
function
|
|
15836
|
+
function bind26(_liquidSwell) {
|
|
15629
15837
|
return (color1, color2) => {
|
|
15630
15838
|
return ThemeColor.get(color1).difference(ThemeColor.get(color2));
|
|
15631
15839
|
};
|
|
15632
15840
|
}
|
|
15633
15841
|
|
|
15634
15842
|
// src/liquid/filters/color_extract.ts
|
|
15635
|
-
function
|
|
15843
|
+
function bind27(_liquidSwell) {
|
|
15636
15844
|
return (color, field) => {
|
|
15637
15845
|
return ThemeColor.get(color).extract(field);
|
|
15638
15846
|
};
|
|
15639
15847
|
}
|
|
15640
15848
|
|
|
15641
15849
|
// src/liquid/filters/color_lighten.ts
|
|
15642
|
-
function
|
|
15850
|
+
function bind28(_liquidSwell) {
|
|
15643
15851
|
return (color, percent) => {
|
|
15644
15852
|
return ThemeColor.get(color).lighten(percent);
|
|
15645
15853
|
};
|
|
15646
15854
|
}
|
|
15647
15855
|
|
|
15648
15856
|
// src/liquid/filters/color_mix.ts
|
|
15649
|
-
function
|
|
15857
|
+
function bind29(_liquidSwell) {
|
|
15650
15858
|
return (color1, color2, ratio) => {
|
|
15651
15859
|
return ThemeColor.get(color1).mix(ThemeColor.get(color2), ratio);
|
|
15652
15860
|
};
|
|
15653
15861
|
}
|
|
15654
15862
|
|
|
15655
15863
|
// src/liquid/filters/color_modify.ts
|
|
15656
|
-
function
|
|
15864
|
+
function bind30(_liquidSwell) {
|
|
15657
15865
|
return function filterColorModify(color, field, value) {
|
|
15658
15866
|
return ThemeColor.get(color).modify(field, Number(value) || 0);
|
|
15659
15867
|
};
|
|
15660
15868
|
}
|
|
15661
15869
|
|
|
15662
15870
|
// src/liquid/filters/color_saturate.ts
|
|
15663
|
-
function
|
|
15871
|
+
function bind31(_liquidSwell) {
|
|
15664
15872
|
return (color, value) => {
|
|
15665
15873
|
return ThemeColor.get(color).saturate(value);
|
|
15666
15874
|
};
|
|
15667
15875
|
}
|
|
15668
15876
|
|
|
15669
15877
|
// src/liquid/filters/color_to_hex.ts
|
|
15670
|
-
function
|
|
15878
|
+
function bind32(_liquidSwell) {
|
|
15671
15879
|
return (color) => {
|
|
15672
15880
|
return ThemeColor.get(color).hex();
|
|
15673
15881
|
};
|
|
15674
15882
|
}
|
|
15675
15883
|
|
|
15676
15884
|
// src/liquid/filters/color_to_hsl.ts
|
|
15677
|
-
function
|
|
15885
|
+
function bind33(_liquidSwell) {
|
|
15678
15886
|
return (color) => {
|
|
15679
15887
|
return ThemeColor.get(color).hsl();
|
|
15680
15888
|
};
|
|
15681
15889
|
}
|
|
15682
15890
|
|
|
15683
15891
|
// src/liquid/filters/color_to_rgb.ts
|
|
15684
|
-
function
|
|
15892
|
+
function bind34(_liquidSwell) {
|
|
15685
15893
|
return (color, alpha) => {
|
|
15686
15894
|
return alpha !== void 0 ? ThemeColor.get(color).rgba(alpha) : ThemeColor.get(color).rgb();
|
|
15687
15895
|
};
|
|
@@ -15689,7 +15897,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15689
15897
|
|
|
15690
15898
|
// src/liquid/filters/date.ts
|
|
15691
15899
|
var import_strftime = __toESM(__require("strftime"), 1);
|
|
15692
|
-
function
|
|
15900
|
+
function bind35(_liquidSwell) {
|
|
15693
15901
|
return (dateValue, ...params) => {
|
|
15694
15902
|
const date = ensureDate(dateValue);
|
|
15695
15903
|
const { format } = getDateFilterParams(params);
|
|
@@ -15747,7 +15955,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15747
15955
|
}
|
|
15748
15956
|
|
|
15749
15957
|
// src/liquid/filters/date_next_interval.ts
|
|
15750
|
-
function
|
|
15958
|
+
function bind36(_liquidSwell) {
|
|
15751
15959
|
return (dateValue, interval, intervalCount) => {
|
|
15752
15960
|
const date = ensureDate(dateValue);
|
|
15753
15961
|
const result = getNextIntervalDate(date, interval, Number(intervalCount));
|
|
@@ -15799,7 +16007,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15799
16007
|
}
|
|
15800
16008
|
|
|
15801
16009
|
// src/liquid/filters/default_errors.ts
|
|
15802
|
-
function
|
|
16010
|
+
function bind37(_liquidSwell) {
|
|
15803
16011
|
return async function filterDefaultError(errors) {
|
|
15804
16012
|
if (!errors) {
|
|
15805
16013
|
return "";
|
|
@@ -15825,7 +16033,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15825
16033
|
}
|
|
15826
16034
|
|
|
15827
16035
|
// src/liquid/filters/divided_by.ts
|
|
15828
|
-
function
|
|
16036
|
+
function bind38(_liquidSwell) {
|
|
15829
16037
|
return (dividend, divisor, integerArithmetic) => {
|
|
15830
16038
|
if (!isNumber(dividend) || !isNumber(divisor)) {
|
|
15831
16039
|
return dividend;
|
|
@@ -15835,20 +16043,20 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15835
16043
|
}
|
|
15836
16044
|
|
|
15837
16045
|
// src/liquid/filters/embedded_content.ts
|
|
15838
|
-
var
|
|
15839
|
-
function
|
|
16046
|
+
var import_lodash_es12 = __require("lodash-es");
|
|
16047
|
+
function bind39(_liquidSwell) {
|
|
15840
16048
|
return (value, tag = "iframe") => {
|
|
15841
16049
|
const escapeIframes = value.replaceAll(`<${tag}`, `<${tag}`).replaceAll(`</${tag}`, `</${tag}`);
|
|
15842
16050
|
const removeTags = escapeIframes.replaceAll(/<(.*?)>/gi, "");
|
|
15843
|
-
const unescaped = (0,
|
|
16051
|
+
const unescaped = (0, import_lodash_es12.unescape)(removeTags);
|
|
15844
16052
|
const replaceSpaces = unescaped.replaceAll(" ", " ");
|
|
15845
16053
|
return replaceSpaces;
|
|
15846
16054
|
};
|
|
15847
16055
|
}
|
|
15848
16056
|
|
|
15849
16057
|
// src/liquid/filters/escape.ts
|
|
15850
|
-
var
|
|
15851
|
-
function
|
|
16058
|
+
var import_lodash_es13 = __require("lodash-es");
|
|
16059
|
+
function bind40(_liquidSwell) {
|
|
15852
16060
|
return function escapeTag(input) {
|
|
15853
16061
|
if (!input?.startsWith) {
|
|
15854
16062
|
return input;
|
|
@@ -15856,12 +16064,12 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15856
16064
|
if (input.startsWith("<img") || input.startsWith("<video")) {
|
|
15857
16065
|
return input;
|
|
15858
16066
|
}
|
|
15859
|
-
return (0,
|
|
16067
|
+
return (0, import_lodash_es13.escape)(input);
|
|
15860
16068
|
};
|
|
15861
16069
|
}
|
|
15862
16070
|
|
|
15863
16071
|
// src/liquid/filters/font_face.ts
|
|
15864
|
-
function
|
|
16072
|
+
function bind41(_liquidSwell) {
|
|
15865
16073
|
return (fontSetting, ...params) => {
|
|
15866
16074
|
if (!fontSetting) {
|
|
15867
16075
|
return null;
|
|
@@ -15873,14 +16081,14 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15873
16081
|
}
|
|
15874
16082
|
|
|
15875
16083
|
// src/liquid/filters/font_modify.ts
|
|
15876
|
-
function
|
|
16084
|
+
function bind42(_liquidSwell) {
|
|
15877
16085
|
return (fontSetting, prop, value) => {
|
|
15878
16086
|
return ThemeFont.clone(fontSetting).modify(prop, value);
|
|
15879
16087
|
};
|
|
15880
16088
|
}
|
|
15881
16089
|
|
|
15882
16090
|
// src/liquid/filters/font_url.ts
|
|
15883
|
-
function
|
|
16091
|
+
function bind43(_liquidSwell) {
|
|
15884
16092
|
return (fontSetting) => {
|
|
15885
16093
|
return ThemeFont.get(fontSetting).url();
|
|
15886
16094
|
};
|
|
@@ -15929,15 +16137,15 @@ ${injects.join("\n")}<\/script>`;
|
|
|
15929
16137
|
};
|
|
15930
16138
|
|
|
15931
16139
|
// src/liquid/filters/handleize.ts
|
|
15932
|
-
var
|
|
15933
|
-
function
|
|
16140
|
+
var import_lodash_es14 = __require("lodash-es");
|
|
16141
|
+
function bind44(_liquidSwell) {
|
|
15934
16142
|
return function filterHandleize(handle) {
|
|
15935
|
-
return (0,
|
|
16143
|
+
return (0, import_lodash_es14.kebabCase)(handle);
|
|
15936
16144
|
};
|
|
15937
16145
|
}
|
|
15938
16146
|
|
|
15939
16147
|
// src/liquid/filters/image_tag.ts
|
|
15940
|
-
function
|
|
16148
|
+
function bind45(_liquidSwell) {
|
|
15941
16149
|
return function filterImageTag(imageUrl, ...params) {
|
|
15942
16150
|
imageUrl = String(imageUrl || "");
|
|
15943
16151
|
let {
|
|
@@ -16101,7 +16309,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16101
16309
|
var image_url_default = filterDefinition;
|
|
16102
16310
|
|
|
16103
16311
|
// src/liquid/filters/inline_asset_content.ts
|
|
16104
|
-
function
|
|
16312
|
+
function bind46(liquidSwell) {
|
|
16105
16313
|
return async (assetPath) => {
|
|
16106
16314
|
const config = await liquidSwell.theme.getThemeConfig(
|
|
16107
16315
|
`theme/assets/${assetPath}`
|
|
@@ -16111,14 +16319,14 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16111
16319
|
}
|
|
16112
16320
|
|
|
16113
16321
|
// src/liquid/filters/json.ts
|
|
16114
|
-
function
|
|
16322
|
+
function bind47(_liquidSwell) {
|
|
16115
16323
|
return async function filterJson(input, space = 0) {
|
|
16116
16324
|
return jsonStringifyAsync(input, space);
|
|
16117
16325
|
};
|
|
16118
16326
|
}
|
|
16119
16327
|
|
|
16120
16328
|
// src/liquid/filters/json_pretty.ts
|
|
16121
|
-
function
|
|
16329
|
+
function bind48(_liquidSwell) {
|
|
16122
16330
|
return async function filterJsonPretty(input, space = 2) {
|
|
16123
16331
|
const output = await jsonStringifyAsync(input, space);
|
|
16124
16332
|
return `<pre>${output}</pre>`;
|
|
@@ -16128,7 +16336,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16128
16336
|
// src/liquid/filters/locale_flag.ts
|
|
16129
16337
|
var import_country_flag_icons = __require("country-flag-icons");
|
|
16130
16338
|
var flags = __toESM(__require("country-flag-icons/string/1x1"), 1);
|
|
16131
|
-
function
|
|
16339
|
+
function bind49(_liquidSwell) {
|
|
16132
16340
|
return (localeCode) => {
|
|
16133
16341
|
if (typeof localeCode !== "string") {
|
|
16134
16342
|
return flags.US;
|
|
@@ -16139,7 +16347,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16139
16347
|
}
|
|
16140
16348
|
|
|
16141
16349
|
// src/liquid/filters/minus.ts
|
|
16142
|
-
function
|
|
16350
|
+
function bind50(_liquidSwell) {
|
|
16143
16351
|
return (first, second) => {
|
|
16144
16352
|
const firstValue = isNumber(first) ? first : 0;
|
|
16145
16353
|
const secondValue = isNumber(second) ? second : 0;
|
|
@@ -16148,7 +16356,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16148
16356
|
}
|
|
16149
16357
|
|
|
16150
16358
|
// src/liquid/filters/money.ts
|
|
16151
|
-
function
|
|
16359
|
+
function bind51(liquidSwell) {
|
|
16152
16360
|
return function filterMoney(value) {
|
|
16153
16361
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16154
16362
|
return liquidSwell.renderCurrency(amount);
|
|
@@ -16165,7 +16373,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16165
16373
|
}
|
|
16166
16374
|
|
|
16167
16375
|
// src/liquid/filters/money_with_currency.ts
|
|
16168
|
-
function
|
|
16376
|
+
function bind52(liquidSwell) {
|
|
16169
16377
|
return function filterMoneyWithCurrency(value) {
|
|
16170
16378
|
const { currency } = liquidSwell.theme.swell.getStorefrontLocalization();
|
|
16171
16379
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
@@ -16174,7 +16382,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16174
16382
|
}
|
|
16175
16383
|
|
|
16176
16384
|
// src/liquid/filters/money_without_currency.ts
|
|
16177
|
-
function
|
|
16385
|
+
function bind53(liquidSwell) {
|
|
16178
16386
|
return function filterMoneyWithoutCurrency(value) {
|
|
16179
16387
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16180
16388
|
return liquidSwell.renderCurrency(amount).replace(/[^0-9.,]/g, "");
|
|
@@ -16182,30 +16390,45 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16182
16390
|
}
|
|
16183
16391
|
|
|
16184
16392
|
// src/liquid/filters/money_without_trailing_zeros.ts
|
|
16185
|
-
function
|
|
16393
|
+
function bind54(liquidSwell) {
|
|
16186
16394
|
return function filterMoneyWithoutTrailingZeros(value) {
|
|
16187
16395
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16188
16396
|
return liquidSwell.renderCurrency(amount).split(".")[0].split(",")[0];
|
|
16189
16397
|
};
|
|
16190
16398
|
}
|
|
16191
16399
|
|
|
16400
|
+
// src/liquid/filters/preload_tag.ts
|
|
16401
|
+
function bind55(_liquidSwell) {
|
|
16402
|
+
return function filterPreloadTag(assetUrl, ...params) {
|
|
16403
|
+
if (!assetUrl) {
|
|
16404
|
+
return "";
|
|
16405
|
+
}
|
|
16406
|
+
const { as } = paramsToProps(params);
|
|
16407
|
+
let attributes = "";
|
|
16408
|
+
if (typeof as === "string" && as) {
|
|
16409
|
+
attributes += `as="${as}"`;
|
|
16410
|
+
}
|
|
16411
|
+
return `<link href="${assetUrl}" rel="preload" ${attributes} />`;
|
|
16412
|
+
};
|
|
16413
|
+
}
|
|
16414
|
+
|
|
16192
16415
|
// src/liquid/filters/script_tag.ts
|
|
16193
|
-
function
|
|
16416
|
+
function bind56(_liquidSwell) {
|
|
16194
16417
|
return function filterScriptTag(assetUrl) {
|
|
16195
16418
|
return `<script src="${assetUrl}" type="text/javascript"><\/script>`;
|
|
16196
16419
|
};
|
|
16197
16420
|
}
|
|
16198
16421
|
|
|
16199
16422
|
// src/liquid/filters/stylesheet_tag.ts
|
|
16200
|
-
function
|
|
16423
|
+
function bind57(_liquidSwell) {
|
|
16201
16424
|
return function filterStyleSheetTag(assetUrl) {
|
|
16202
16425
|
return `<link href="${assetUrl}" rel="stylesheet" type="text/css" media="all" />`;
|
|
16203
16426
|
};
|
|
16204
16427
|
}
|
|
16205
16428
|
|
|
16206
16429
|
// src/liquid/filters/time_tag.ts
|
|
16207
|
-
function
|
|
16208
|
-
const dateFilter =
|
|
16430
|
+
function bind58(_liquidSwell) {
|
|
16431
|
+
const dateFilter = bind35(_liquidSwell);
|
|
16209
16432
|
return (dateValue, ...params) => {
|
|
16210
16433
|
const date = ensureDate(dateValue);
|
|
16211
16434
|
const formattedDate = dateFilter(dateValue, ...params);
|
|
@@ -16215,7 +16438,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16215
16438
|
}
|
|
16216
16439
|
|
|
16217
16440
|
// src/liquid/filters/translate.ts
|
|
16218
|
-
function
|
|
16441
|
+
function bind59(liquidSwell) {
|
|
16219
16442
|
return async function filterTranslate(key, params) {
|
|
16220
16443
|
const props = params && paramsToProps(params);
|
|
16221
16444
|
const str = await liquidSwell.renderTranslation(key, props);
|
|
@@ -16224,7 +16447,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16224
16447
|
}
|
|
16225
16448
|
|
|
16226
16449
|
// src/liquid/filters/where.ts
|
|
16227
|
-
function
|
|
16450
|
+
function bind60(_liquidSwell) {
|
|
16228
16451
|
return function* filterWhere(arr, property, expected) {
|
|
16229
16452
|
const results = [];
|
|
16230
16453
|
const list = yield resolveEnumerable(arr);
|
|
@@ -16278,7 +16501,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16278
16501
|
height: height ? Number(height) : void 0
|
|
16279
16502
|
};
|
|
16280
16503
|
}
|
|
16281
|
-
function
|
|
16504
|
+
function bind61(liquidSwell) {
|
|
16282
16505
|
return async function filterAssetImgUrl(assetPath, size = "small") {
|
|
16283
16506
|
const imageUrl = await liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
|
|
16284
16507
|
const sizes = getSizesFromParam(size);
|
|
@@ -16294,14 +16517,14 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16294
16517
|
}
|
|
16295
16518
|
|
|
16296
16519
|
// src/liquid/filters/shopify/hex_to_rgba.ts
|
|
16297
|
-
function
|
|
16520
|
+
function bind62(_liquidSwell) {
|
|
16298
16521
|
return (color, alpha) => {
|
|
16299
16522
|
return ThemeColor.get(color).rgba(alpha || 1);
|
|
16300
16523
|
};
|
|
16301
16524
|
}
|
|
16302
16525
|
|
|
16303
16526
|
// src/liquid/filters/shopify/img_url.ts
|
|
16304
|
-
function
|
|
16527
|
+
function bind63(liquidSwell) {
|
|
16305
16528
|
return async function filterImgUrl(input, ...params) {
|
|
16306
16529
|
const url = await getImageUrlFromInput(input, liquidSwell);
|
|
16307
16530
|
if (typeof url !== "string" || url === "") {
|
|
@@ -16339,14 +16562,14 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16339
16562
|
};
|
|
16340
16563
|
|
|
16341
16564
|
// src/liquid/filters/shopify/payment_button.ts
|
|
16342
|
-
function
|
|
16565
|
+
function bind64(_liquidSwell) {
|
|
16343
16566
|
return (form) => {
|
|
16344
16567
|
return `<button style="display: block; visibility: hidden;"></button>`;
|
|
16345
16568
|
};
|
|
16346
16569
|
}
|
|
16347
16570
|
|
|
16348
16571
|
// src/liquid/filters/shopify/payment_terms.ts
|
|
16349
|
-
function
|
|
16572
|
+
function bind65(_liquidSwell) {
|
|
16350
16573
|
return (form) => {
|
|
16351
16574
|
return null;
|
|
16352
16575
|
};
|
|
@@ -16448,7 +16671,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16448
16671
|
var placeholder_svgs_default = svgs;
|
|
16449
16672
|
|
|
16450
16673
|
// src/liquid/filters/shopify/placeholder_svg_tag.ts
|
|
16451
|
-
function
|
|
16674
|
+
function bind66(_liquidSwell) {
|
|
16452
16675
|
return function filterPlaceholderSvgTag(name, className) {
|
|
16453
16676
|
const svg = placeholder_svgs_default[name];
|
|
16454
16677
|
if (typeof svg === "object" && svg !== null) {
|
|
@@ -16459,7 +16682,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16459
16682
|
}
|
|
16460
16683
|
|
|
16461
16684
|
// src/liquid/filters/shopify/shopify_asset_url.ts
|
|
16462
|
-
function
|
|
16685
|
+
function bind67(_liquidSwell) {
|
|
16463
16686
|
return function filterShopifyAssetUrl(input) {
|
|
16464
16687
|
if (typeof input === "string") {
|
|
16465
16688
|
switch (input) {
|
|
@@ -16484,7 +16707,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16484
16707
|
}
|
|
16485
16708
|
|
|
16486
16709
|
// src/liquid/filters/shopify/structured_data.ts
|
|
16487
|
-
function
|
|
16710
|
+
function bind68(_liquidSwell) {
|
|
16488
16711
|
return async function filterStructuredData(input) {
|
|
16489
16712
|
let value = input;
|
|
16490
16713
|
if (value instanceof StorefrontResource) {
|
|
@@ -16562,7 +16785,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16562
16785
|
}
|
|
16563
16786
|
|
|
16564
16787
|
// src/liquid/filters/inline_editable.ts
|
|
16565
|
-
function
|
|
16788
|
+
function bind69(_liquidSwell) {
|
|
16566
16789
|
return (value, key) => {
|
|
16567
16790
|
if (typeof value === "object" && "value" in value) {
|
|
16568
16791
|
value = value.value;
|
|
@@ -16573,64 +16796,65 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16573
16796
|
|
|
16574
16797
|
// src/liquid/filters/index.ts
|
|
16575
16798
|
var filters = {
|
|
16576
|
-
asset_url:
|
|
16577
|
-
brightness_difference:
|
|
16578
|
-
color_brightness:
|
|
16579
|
-
color_contrast:
|
|
16580
|
-
color_darken:
|
|
16581
|
-
color_desaturate:
|
|
16582
|
-
color_difference:
|
|
16583
|
-
color_extract:
|
|
16584
|
-
color_lighten:
|
|
16585
|
-
color_mix:
|
|
16586
|
-
color_modify:
|
|
16587
|
-
color_saturate:
|
|
16588
|
-
color_to_hex:
|
|
16589
|
-
color_to_hsl:
|
|
16590
|
-
color_to_rgb:
|
|
16591
|
-
date_next_interval:
|
|
16592
|
-
date:
|
|
16593
|
-
default_errors:
|
|
16594
|
-
divided_by:
|
|
16595
|
-
embedded_content:
|
|
16596
|
-
escape:
|
|
16597
|
-
font_face:
|
|
16598
|
-
font_modify:
|
|
16599
|
-
font_url:
|
|
16799
|
+
asset_url: bind20,
|
|
16800
|
+
brightness_difference: bind21,
|
|
16801
|
+
color_brightness: bind22,
|
|
16802
|
+
color_contrast: bind23,
|
|
16803
|
+
color_darken: bind24,
|
|
16804
|
+
color_desaturate: bind25,
|
|
16805
|
+
color_difference: bind26,
|
|
16806
|
+
color_extract: bind27,
|
|
16807
|
+
color_lighten: bind28,
|
|
16808
|
+
color_mix: bind29,
|
|
16809
|
+
color_modify: bind30,
|
|
16810
|
+
color_saturate: bind31,
|
|
16811
|
+
color_to_hex: bind32,
|
|
16812
|
+
color_to_hsl: bind33,
|
|
16813
|
+
color_to_rgb: bind34,
|
|
16814
|
+
date_next_interval: bind36,
|
|
16815
|
+
date: bind35,
|
|
16816
|
+
default_errors: bind37,
|
|
16817
|
+
divided_by: bind38,
|
|
16818
|
+
embedded_content: bind39,
|
|
16819
|
+
escape: bind40,
|
|
16820
|
+
font_face: bind41,
|
|
16821
|
+
font_modify: bind42,
|
|
16822
|
+
font_url: bind43,
|
|
16600
16823
|
format_address: format_address_default,
|
|
16601
|
-
handle:
|
|
16824
|
+
handle: bind44,
|
|
16602
16825
|
// alias
|
|
16603
|
-
handleize:
|
|
16604
|
-
image_tag:
|
|
16826
|
+
handleize: bind44,
|
|
16827
|
+
image_tag: bind45,
|
|
16605
16828
|
image_url: image_url_default,
|
|
16606
|
-
inline_asset_content:
|
|
16607
|
-
json:
|
|
16608
|
-
json_pretty:
|
|
16609
|
-
locale_flag:
|
|
16610
|
-
minus:
|
|
16611
|
-
money:
|
|
16612
|
-
money_with_currency:
|
|
16613
|
-
money_without_currency:
|
|
16614
|
-
money_without_trailing_zeros:
|
|
16615
|
-
|
|
16616
|
-
|
|
16617
|
-
|
|
16618
|
-
|
|
16619
|
-
|
|
16829
|
+
inline_asset_content: bind46,
|
|
16830
|
+
json: bind47,
|
|
16831
|
+
json_pretty: bind48,
|
|
16832
|
+
locale_flag: bind49,
|
|
16833
|
+
minus: bind50,
|
|
16834
|
+
money: bind51,
|
|
16835
|
+
money_with_currency: bind52,
|
|
16836
|
+
money_without_currency: bind53,
|
|
16837
|
+
money_without_trailing_zeros: bind54,
|
|
16838
|
+
preload_tag: bind55,
|
|
16839
|
+
script_tag: bind56,
|
|
16840
|
+
stylesheet_tag: bind57,
|
|
16841
|
+
time_tag: bind58,
|
|
16842
|
+
translate: bind59,
|
|
16843
|
+
t: bind59,
|
|
16620
16844
|
// alias
|
|
16621
|
-
where:
|
|
16845
|
+
where: bind60,
|
|
16622
16846
|
// Shopify compatibility only
|
|
16623
|
-
asset_img_url:
|
|
16624
|
-
hex_to_rgba:
|
|
16625
|
-
img_url:
|
|
16847
|
+
asset_img_url: bind61,
|
|
16848
|
+
hex_to_rgba: bind62,
|
|
16849
|
+
img_url: bind63,
|
|
16626
16850
|
item_count_for_variant: item_count_for_variant_default,
|
|
16627
|
-
payment_button:
|
|
16628
|
-
payment_terms:
|
|
16629
|
-
placeholder_svg_tag:
|
|
16630
|
-
shopify_asset_url:
|
|
16631
|
-
structured_data:
|
|
16851
|
+
payment_button: bind64,
|
|
16852
|
+
payment_terms: bind65,
|
|
16853
|
+
placeholder_svg_tag: bind66,
|
|
16854
|
+
shopify_asset_url: bind67,
|
|
16855
|
+
structured_data: bind68,
|
|
16632
16856
|
// Swell only
|
|
16633
|
-
inline_editable:
|
|
16857
|
+
inline_editable: bind69
|
|
16634
16858
|
};
|
|
16635
16859
|
function bindFilters(liquidSwell) {
|
|
16636
16860
|
for (const [tag, handler] of Object.entries(filters)) {
|
|
@@ -16644,8 +16868,8 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16644
16868
|
}
|
|
16645
16869
|
}
|
|
16646
16870
|
}
|
|
16647
|
-
function bindWithResolvedProps(liquidSwell,
|
|
16648
|
-
const handler =
|
|
16871
|
+
function bindWithResolvedProps(liquidSwell, bind70, resolve = []) {
|
|
16872
|
+
const handler = bind70(liquidSwell);
|
|
16649
16873
|
if (!Array.isArray(resolve)) {
|
|
16650
16874
|
return handler;
|
|
16651
16875
|
}
|
|
@@ -16697,9 +16921,9 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16697
16921
|
}
|
|
16698
16922
|
|
|
16699
16923
|
// src/liquid/operators.ts
|
|
16700
|
-
var
|
|
16924
|
+
var import_liquidjs38 = __require("liquidjs");
|
|
16701
16925
|
var swellOperators = {
|
|
16702
|
-
...
|
|
16926
|
+
...import_liquidjs38.defaultOperators,
|
|
16703
16927
|
"==": equal,
|
|
16704
16928
|
"!=": (l, r) => !equal(l, r),
|
|
16705
16929
|
contains: (l, r) => {
|
|
@@ -16727,8 +16951,8 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16727
16951
|
|
|
16728
16952
|
// src/liquid/color.ts
|
|
16729
16953
|
var import_color = __toESM(__require("color"), 1);
|
|
16730
|
-
var
|
|
16731
|
-
var ThemeColor = class _ThemeColor extends
|
|
16954
|
+
var import_liquidjs39 = __require("liquidjs");
|
|
16955
|
+
var ThemeColor = class _ThemeColor extends import_liquidjs39.Drop {
|
|
16732
16956
|
color;
|
|
16733
16957
|
colorValues;
|
|
16734
16958
|
red;
|
|
@@ -16772,10 +16996,16 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16772
16996
|
return this.color.darken(percent / 100).hex().toLowerCase();
|
|
16773
16997
|
}
|
|
16774
16998
|
rgb() {
|
|
16775
|
-
return this.
|
|
16999
|
+
return `${this.red} ${this.green} ${this.blue}`;
|
|
16776
17000
|
}
|
|
16777
17001
|
rgba(alpha) {
|
|
16778
|
-
|
|
17002
|
+
const colorValues = this.color.object();
|
|
17003
|
+
const alphaValue = alpha || colorValues.alpha;
|
|
17004
|
+
const rgb = this.rgb();
|
|
17005
|
+
if (alphaValue === void 0) {
|
|
17006
|
+
return rgb;
|
|
17007
|
+
}
|
|
17008
|
+
return `${rgb} / ${Number(alphaValue).toFixed(2)}`;
|
|
16779
17009
|
}
|
|
16780
17010
|
hsl() {
|
|
16781
17011
|
return this.color.hsl().round().toString();
|
|
@@ -16863,7 +17093,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16863
17093
|
}
|
|
16864
17094
|
|
|
16865
17095
|
// src/liquid/index.ts
|
|
16866
|
-
var LiquidSwell31 = class extends
|
|
17096
|
+
var LiquidSwell31 = class extends import_liquidjs40.Liquid {
|
|
16867
17097
|
theme;
|
|
16868
17098
|
getThemeConfig;
|
|
16869
17099
|
getThemeTemplateConfigByType;
|
|
@@ -16880,6 +17110,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16880
17110
|
extName;
|
|
16881
17111
|
componentsDir;
|
|
16882
17112
|
sectionsDir;
|
|
17113
|
+
blocksDir;
|
|
16883
17114
|
lastSchema;
|
|
16884
17115
|
constructor({
|
|
16885
17116
|
theme,
|
|
@@ -16897,7 +17128,8 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16897
17128
|
layoutName,
|
|
16898
17129
|
extName,
|
|
16899
17130
|
componentsDir,
|
|
16900
|
-
sectionsDir
|
|
17131
|
+
sectionsDir,
|
|
17132
|
+
blocksDir
|
|
16901
17133
|
}) {
|
|
16902
17134
|
getThemeConfig = getThemeConfig || theme.getThemeConfig.bind(theme);
|
|
16903
17135
|
extName = extName || "liquid";
|
|
@@ -16926,6 +17158,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16926
17158
|
this.extName = extName;
|
|
16927
17159
|
this.componentsDir = componentsDir || "components";
|
|
16928
17160
|
this.sectionsDir = sectionsDir || "sections";
|
|
17161
|
+
this.blocksDir = blocksDir || "blocks";
|
|
16929
17162
|
this.lastSchema = void 0;
|
|
16930
17163
|
bindTags(this);
|
|
16931
17164
|
bindFilters(this);
|
|
@@ -16948,6 +17181,9 @@ ${injects.join("\n")}<\/script>`;
|
|
|
16948
17181
|
async getSectionGroupPath(sectionName) {
|
|
16949
17182
|
return await this.resolveFilePathByType("sections", `${sectionName}.json`) || resolveFilePath(`${this.sectionsDir}/${sectionName}`, "json");
|
|
16950
17183
|
}
|
|
17184
|
+
async getThemeBlockPath(blockName) {
|
|
17185
|
+
return await this.resolveFilePathByType("blocks", blockName) || resolveFilePath(`${this.blocksDir}/${blockName}`, this.extName);
|
|
17186
|
+
}
|
|
16951
17187
|
};
|
|
16952
17188
|
function resolveFilePath(fileName, extName) {
|
|
16953
17189
|
return `theme/${fileName}.${extName}`;
|
|
@@ -17347,11 +17583,11 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17347
17583
|
};
|
|
17348
17584
|
|
|
17349
17585
|
// src/globals.ts
|
|
17350
|
-
var
|
|
17586
|
+
var import_lodash_es15 = __require("lodash-es");
|
|
17351
17587
|
|
|
17352
17588
|
// src/compatibility/drops/robots-rule.ts
|
|
17353
|
-
var
|
|
17354
|
-
var RobotsRule = class _RobotsRule extends
|
|
17589
|
+
var import_liquidjs41 = __require("liquidjs");
|
|
17590
|
+
var RobotsRule = class _RobotsRule extends import_liquidjs41.Drop {
|
|
17355
17591
|
constructor(directive, value) {
|
|
17356
17592
|
super();
|
|
17357
17593
|
this.directive = directive;
|
|
@@ -17447,7 +17683,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17447
17683
|
}).filter(Boolean).join("\n");
|
|
17448
17684
|
}
|
|
17449
17685
|
function getRobotsGlobals(canonicalUrl) {
|
|
17450
|
-
const sitemapUrl = `${(0,
|
|
17686
|
+
const sitemapUrl = `${(0, import_lodash_es15.trimEnd)(canonicalUrl, "/")}/sitemap.xml`;
|
|
17451
17687
|
const defaultRules = [
|
|
17452
17688
|
{ directive: "Disallow", value: "/admin" },
|
|
17453
17689
|
{ directive: "Disallow", value: "/cart" },
|
|
@@ -17942,7 +18178,7 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17942
18178
|
return languageConfig;
|
|
17943
18179
|
}
|
|
17944
18180
|
const localeShortCode = locale.split("-")[0];
|
|
17945
|
-
return (0,
|
|
18181
|
+
return (0, import_lodash_es16.reduce)(
|
|
17946
18182
|
languageConfig,
|
|
17947
18183
|
(acc, value, key) => {
|
|
17948
18184
|
if (isObject2(value)) {
|
|
@@ -17966,15 +18202,15 @@ ${injects.join("\n")}<\/script>`;
|
|
|
17966
18202
|
const translationEnd = translationParts.pop();
|
|
17967
18203
|
const translationPath = translationParts.join(".");
|
|
17968
18204
|
const translationConfigGlobal = this.globals.language;
|
|
17969
|
-
acc[key] = (0,
|
|
18205
|
+
acc[key] = (0, import_lodash_es16.get)(
|
|
17970
18206
|
translationConfigGlobal,
|
|
17971
18207
|
`${translationPath}.$locale.${locale}.${translationEnd}`
|
|
17972
|
-
) || (0,
|
|
18208
|
+
) || (0, import_lodash_es16.get)(
|
|
17973
18209
|
translationConfigGlobal,
|
|
17974
18210
|
`${translationPath}.$locale.${localeShortCode}.${translationEnd}`
|
|
17975
|
-
) || (0,
|
|
18211
|
+
) || (0, import_lodash_es16.get)(translationConfigGlobal, translationKey) || value;
|
|
17976
18212
|
} else {
|
|
17977
|
-
acc[key] = (0,
|
|
18213
|
+
acc[key] = (0, import_lodash_es16.get)(languageConfig, `$locale.${locale}.${key}`) || (0, import_lodash_es16.get)(languageConfig, `$locale.${localeShortCode}.${key}`) || value;
|
|
17978
18214
|
}
|
|
17979
18215
|
}
|
|
17980
18216
|
return acc;
|
|
@@ -18659,6 +18895,30 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
18659
18895
|
const configs = this.getThemeConfigsByPath("theme/sections/");
|
|
18660
18896
|
return getAllSections(configs, this.getTemplateSchema.bind(this));
|
|
18661
18897
|
}
|
|
18898
|
+
/**
|
|
18899
|
+
* Returns all theme block schemas from /blocks folder.
|
|
18900
|
+
*/
|
|
18901
|
+
getAllThemeBlockSchemas() {
|
|
18902
|
+
const schemas = [];
|
|
18903
|
+
const configs = this.getThemeConfigsByPath("theme/blocks/");
|
|
18904
|
+
for (const config of configs.values()) {
|
|
18905
|
+
const { name, file_path: filePath, file_data: fileData } = config;
|
|
18906
|
+
const rawSchema = extractSchemaTag(fileData, true);
|
|
18907
|
+
if (!rawSchema) {
|
|
18908
|
+
continue;
|
|
18909
|
+
}
|
|
18910
|
+
try {
|
|
18911
|
+
const schema = import_json56.default.parse(rawSchema);
|
|
18912
|
+
if (!schema.type) {
|
|
18913
|
+
schema.type = name;
|
|
18914
|
+
}
|
|
18915
|
+
schemas.push(schema);
|
|
18916
|
+
} catch (error) {
|
|
18917
|
+
console.warn(`Invalid schema in block: ${filePath}`, error);
|
|
18918
|
+
}
|
|
18919
|
+
}
|
|
18920
|
+
return schemas;
|
|
18921
|
+
}
|
|
18662
18922
|
async getPageSections(sectionGroup, resolveSettings = true) {
|
|
18663
18923
|
const sectionConfigs = await getPageSections(
|
|
18664
18924
|
sectionGroup,
|
|
@@ -18810,8 +19070,8 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
18810
19070
|
const keyParts = key?.split(".") || [];
|
|
18811
19071
|
const keyName = keyParts.pop() || "";
|
|
18812
19072
|
const keyPath = keyParts.join(".");
|
|
18813
|
-
const langObject = (0,
|
|
18814
|
-
let localeValue = (0,
|
|
19073
|
+
const langObject = (0, import_lodash_es16.get)(langConfig, keyPath);
|
|
19074
|
+
let localeValue = (0, import_lodash_es16.get)(langObject?.[localeCode], keyName) || (0, import_lodash_es16.get)(langObject?.[localeCode.split("-")[0]], keyName) || langObject?.[keyName];
|
|
18815
19075
|
if (data?.count !== void 0 && localeValue?.one) {
|
|
18816
19076
|
localeValue = data.count === 1 ? localeValue.one : localeValue.other;
|
|
18817
19077
|
}
|
|
@@ -18891,7 +19151,7 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
18891
19151
|
}
|
|
18892
19152
|
}
|
|
18893
19153
|
function resolveThemeSettings(theme, themeSettings, editorSchemaSettings) {
|
|
18894
|
-
const settings = (0,
|
|
19154
|
+
const settings = (0, import_lodash_es16.cloneDeep)(themeSettings);
|
|
18895
19155
|
if (settings.$locale) {
|
|
18896
19156
|
const { locale } = theme.swell.getStorefrontLocalization();
|
|
18897
19157
|
const localeConfig = settings.$locale[locale] || {};
|
|
@@ -18901,16 +19161,16 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
18901
19161
|
}
|
|
18902
19162
|
}
|
|
18903
19163
|
}
|
|
18904
|
-
(0,
|
|
19164
|
+
(0, import_lodash_es16.each)(settings, (value, key) => {
|
|
18905
19165
|
const setting = (editorSchemaSettings && findEditorSetting(editorSchemaSettings, key)) ?? null;
|
|
18906
19166
|
if (isObject2(value) && !(value instanceof StorefrontResource)) {
|
|
18907
19167
|
switch (setting?.type) {
|
|
18908
19168
|
case "color_scheme_group": {
|
|
18909
|
-
(0,
|
|
19169
|
+
(0, import_lodash_es16.each)(value, (scheme, schemeId) => {
|
|
18910
19170
|
if (isObject2(scheme) && typeof scheme.settings === "object" && scheme.settings) {
|
|
18911
19171
|
const settings2 = scheme.settings;
|
|
18912
|
-
(0,
|
|
18913
|
-
const fieldDef = (0,
|
|
19172
|
+
(0, import_lodash_es16.each)(settings2, (colorValue, colorId) => {
|
|
19173
|
+
const fieldDef = (0, import_lodash_es16.find)(setting.fields, { id: colorId });
|
|
18914
19174
|
if (fieldDef?.type === "color" && colorValue) {
|
|
18915
19175
|
scheme.id = schemeId;
|
|
18916
19176
|
settings2[colorId] = new ThemeColor(colorValue);
|
|
@@ -18961,7 +19221,7 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
18961
19221
|
}
|
|
18962
19222
|
function findThemeSettingsByType(type, themeSettings, editorSchemaSettings) {
|
|
18963
19223
|
const foundSettings = [];
|
|
18964
|
-
(0,
|
|
19224
|
+
(0, import_lodash_es16.each)(themeSettings, (value, key) => {
|
|
18965
19225
|
if (isObject2(value) && !(value instanceof ThemeFont) && !(value instanceof StorefrontResource)) {
|
|
18966
19226
|
foundSettings.push(
|
|
18967
19227
|
...findThemeSettingsByType(type, value, editorSchemaSettings)
|
|
@@ -19019,14 +19279,14 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
19019
19279
|
return {};
|
|
19020
19280
|
}
|
|
19021
19281
|
}
|
|
19022
|
-
function extractSchemaTag(template) {
|
|
19282
|
+
function extractSchemaTag(template, inner = false) {
|
|
19023
19283
|
const list = template.match(
|
|
19024
19284
|
/\{%-?\s*schema\s*-?%\}(.*)\{%-?\s*endschema\s*-?%\}/s
|
|
19025
19285
|
);
|
|
19026
19286
|
if (list === null) {
|
|
19027
19287
|
return template;
|
|
19028
19288
|
}
|
|
19029
|
-
return list[0];
|
|
19289
|
+
return inner ? list[1] : list[0];
|
|
19030
19290
|
}
|
|
19031
19291
|
function withSuffix(path, suffix) {
|
|
19032
19292
|
return suffix ? `${path}.${suffix}` : path;
|
|
@@ -19135,7 +19395,7 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
19135
19395
|
}
|
|
19136
19396
|
function getMenuItemValueId(value) {
|
|
19137
19397
|
const fallback = typeof value === "string" ? value : "";
|
|
19138
|
-
const slug = (0,
|
|
19398
|
+
const slug = (0, import_lodash_es17.get)(value, "id", (0, import_lodash_es17.get)(value, "slug", fallback)) || "";
|
|
19139
19399
|
return slug;
|
|
19140
19400
|
}
|
|
19141
19401
|
async function getMenuItemUrlAndResource(theme, menuItem) {
|