@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.mjs
CHANGED
|
@@ -3502,7 +3502,15 @@ function resolveSectionPresets(schema) {
|
|
|
3502
3502
|
}, {}),
|
|
3503
3503
|
...preset.settings || void 0
|
|
3504
3504
|
},
|
|
3505
|
-
blocks: preset
|
|
3505
|
+
blocks: resolveSectionBlockPresets(preset, schema)
|
|
3506
|
+
}));
|
|
3507
|
+
}
|
|
3508
|
+
function resolveSectionBlockPresets(preset, schema) {
|
|
3509
|
+
if (!preset.blocks) {
|
|
3510
|
+
return;
|
|
3511
|
+
}
|
|
3512
|
+
if (Array.isArray(preset.blocks)) {
|
|
3513
|
+
return preset.blocks.map((block) => {
|
|
3506
3514
|
const blockDef = schema.blocks?.find((b) => b.type === block.type);
|
|
3507
3515
|
return blockDef ? {
|
|
3508
3516
|
...block,
|
|
@@ -3516,8 +3524,9 @@ function resolveSectionPresets(schema) {
|
|
|
3516
3524
|
...block.settings || void 0
|
|
3517
3525
|
}
|
|
3518
3526
|
} : block;
|
|
3519
|
-
})
|
|
3520
|
-
}
|
|
3527
|
+
});
|
|
3528
|
+
}
|
|
3529
|
+
return Object.values(preset.blocks);
|
|
3521
3530
|
}
|
|
3522
3531
|
async function getLayoutSectionGroups(allSections, renderTemplateSchema) {
|
|
3523
3532
|
const allSectionsList = Array.from(allSections.values());
|
|
@@ -3594,7 +3603,15 @@ async function getPageSections(sectionGroup, getSchema) {
|
|
|
3594
3603
|
};
|
|
3595
3604
|
const id = sectionGroup.id ? `page__${sectionGroup.id}__${key}` : schema.id;
|
|
3596
3605
|
const blockOrder = Array.isArray(section.block_order) ? section.block_order : Object.keys(section.blocks || {});
|
|
3597
|
-
const blocks = blockOrder.map((key2) =>
|
|
3606
|
+
const blocks = blockOrder.map((key2) => {
|
|
3607
|
+
const block = section.blocks?.[key2];
|
|
3608
|
+
if (block) {
|
|
3609
|
+
return {
|
|
3610
|
+
...block,
|
|
3611
|
+
id: `${schema.id}__${key2}`
|
|
3612
|
+
};
|
|
3613
|
+
}
|
|
3614
|
+
}).filter(Boolean);
|
|
3598
3615
|
const settings = {
|
|
3599
3616
|
section: {
|
|
3600
3617
|
id,
|
|
@@ -5588,7 +5605,7 @@ function getAllSectionComponents(allSections) {
|
|
|
5588
5605
|
// TODO: figure out how to make this work, doesn't work for collections normally
|
|
5589
5606
|
defaultValue: section.presets?.reduce(
|
|
5590
5607
|
(acc, preset, index) => {
|
|
5591
|
-
if (!preset.blocks) {
|
|
5608
|
+
if (!preset.blocks || !Array.isArray(preset.blocks)) {
|
|
5592
5609
|
return acc;
|
|
5593
5610
|
}
|
|
5594
5611
|
return preset.blocks.reduce(
|
|
@@ -5795,7 +5812,7 @@ function getAllSectionComponentTemplates(allSections) {
|
|
|
5795
5812
|
custom_css: preset.settings?.["custom_css"] || "",
|
|
5796
5813
|
...processFields(section.fields, preset.settings),
|
|
5797
5814
|
// Process blocks inside the preset
|
|
5798
|
-
Blocks: (preset.blocks
|
|
5815
|
+
Blocks: (Array.isArray(preset.blocks) ? preset.blocks : []).map((block) => {
|
|
5799
5816
|
const blockSchema = section.blocks?.find(
|
|
5800
5817
|
({ type }) => type === block.type
|
|
5801
5818
|
);
|
|
@@ -11554,16 +11571,16 @@ function ShopifyBlog(instance, blogCategory) {
|
|
|
11554
11571
|
if (!Array.isArray(blogs?.results)) {
|
|
11555
11572
|
return [];
|
|
11556
11573
|
}
|
|
11557
|
-
const
|
|
11558
|
-
(
|
|
11574
|
+
const set4 = blogs.results.reduce(
|
|
11575
|
+
(set5, blog) => {
|
|
11559
11576
|
for (const tag of blog.tags || []) {
|
|
11560
|
-
|
|
11577
|
+
set5.add(tag);
|
|
11561
11578
|
}
|
|
11562
|
-
return
|
|
11579
|
+
return set5;
|
|
11563
11580
|
},
|
|
11564
11581
|
/* @__PURE__ */ new Set()
|
|
11565
11582
|
);
|
|
11566
|
-
return Array.from(
|
|
11583
|
+
return Array.from(set4.values());
|
|
11567
11584
|
});
|
|
11568
11585
|
return new ShopifyResource({
|
|
11569
11586
|
all_tags: allTags,
|
|
@@ -11947,18 +11964,18 @@ function ShopifyCollection(instance, category) {
|
|
|
11947
11964
|
if (!resolved) {
|
|
11948
11965
|
return [];
|
|
11949
11966
|
}
|
|
11950
|
-
const
|
|
11967
|
+
const set4 = /* @__PURE__ */ new Set();
|
|
11951
11968
|
await Promise.all(
|
|
11952
11969
|
resolved.results.map(async (product) => {
|
|
11953
11970
|
const tags2 = await Promise.resolve().then(() => product.tags);
|
|
11954
11971
|
if (Array.isArray(tags2)) {
|
|
11955
11972
|
for (const tag of tags2) {
|
|
11956
|
-
|
|
11973
|
+
set4.add(tag);
|
|
11957
11974
|
}
|
|
11958
11975
|
}
|
|
11959
11976
|
})
|
|
11960
11977
|
);
|
|
11961
|
-
return Array.from(
|
|
11978
|
+
return Array.from(set4.values());
|
|
11962
11979
|
}),
|
|
11963
11980
|
all_types: defer(async () => {
|
|
11964
11981
|
const products = await resolveProducts();
|
|
@@ -12062,6 +12079,31 @@ function makeProductsCollectionResolve(instance, object, mapper) {
|
|
|
12062
12079
|
return resolveProducts;
|
|
12063
12080
|
}
|
|
12064
12081
|
|
|
12082
|
+
// src/compatibility/shopify-objects/content.ts
|
|
12083
|
+
import { Drop as Drop6 } from "liquidjs";
|
|
12084
|
+
var ShopifySwellContent = class extends Drop6 {
|
|
12085
|
+
content;
|
|
12086
|
+
description;
|
|
12087
|
+
constructor(product) {
|
|
12088
|
+
super();
|
|
12089
|
+
this.content = product?.content || {};
|
|
12090
|
+
this.description = product?.description || "";
|
|
12091
|
+
}
|
|
12092
|
+
toString() {
|
|
12093
|
+
return this.description;
|
|
12094
|
+
}
|
|
12095
|
+
toObject() {
|
|
12096
|
+
const combined = Object.assign({}, this.content);
|
|
12097
|
+
return combined;
|
|
12098
|
+
}
|
|
12099
|
+
toJSON() {
|
|
12100
|
+
return this.toObject();
|
|
12101
|
+
}
|
|
12102
|
+
toLiquid() {
|
|
12103
|
+
return this.toObject();
|
|
12104
|
+
}
|
|
12105
|
+
};
|
|
12106
|
+
|
|
12065
12107
|
// src/compatibility/shopify-objects/product.ts
|
|
12066
12108
|
function ShopifyProduct(instance, product, depth = 0) {
|
|
12067
12109
|
if (product instanceof ShopifyResource) {
|
|
@@ -12095,7 +12137,7 @@ function ShopifyProduct(instance, product, depth = 0) {
|
|
|
12095
12137
|
compare_at_price_max: compareAtPrice,
|
|
12096
12138
|
compare_at_price_min: compareAtPrice,
|
|
12097
12139
|
compare_at_price_varies: false,
|
|
12098
|
-
content: defer(() => product
|
|
12140
|
+
content: defer(() => new ShopifySwellContent(product)),
|
|
12099
12141
|
created_at: defer(() => product.date_created),
|
|
12100
12142
|
description: defer(() => product.description),
|
|
12101
12143
|
featured_image: deferWith(product, (product2) => {
|
|
@@ -12973,8 +13015,8 @@ function ShopifyShippingMethod(instance, order) {
|
|
|
12973
13015
|
}
|
|
12974
13016
|
|
|
12975
13017
|
// src/compatibility/drops/money.ts
|
|
12976
|
-
import { Drop as
|
|
12977
|
-
var MoneyDrop = class extends
|
|
13018
|
+
import { Drop as Drop7 } from "liquidjs";
|
|
13019
|
+
var MoneyDrop = class extends Drop7 {
|
|
12978
13020
|
constructor(value, decimals, currency) {
|
|
12979
13021
|
super();
|
|
12980
13022
|
this.value = value;
|
|
@@ -13575,8 +13617,8 @@ function ShopifyShop(instance, store) {
|
|
|
13575
13617
|
}
|
|
13576
13618
|
|
|
13577
13619
|
// src/compatibility/drops/all_products.ts
|
|
13578
|
-
import { Drop as
|
|
13579
|
-
var AllProductsDrop = class extends
|
|
13620
|
+
import { Drop as Drop8 } from "liquidjs";
|
|
13621
|
+
var AllProductsDrop = class extends Drop8 {
|
|
13580
13622
|
#instance;
|
|
13581
13623
|
#map;
|
|
13582
13624
|
constructor(instance) {
|
|
@@ -13618,8 +13660,8 @@ var AllProductsDrop = class extends Drop7 {
|
|
|
13618
13660
|
};
|
|
13619
13661
|
|
|
13620
13662
|
// src/compatibility/drops/articles.ts
|
|
13621
|
-
import { Drop as
|
|
13622
|
-
var ArticlesDrop = class extends
|
|
13663
|
+
import { Drop as Drop9 } from "liquidjs";
|
|
13664
|
+
var ArticlesDrop = class extends Drop9 {
|
|
13623
13665
|
#instance;
|
|
13624
13666
|
#map;
|
|
13625
13667
|
constructor(instance) {
|
|
@@ -13661,8 +13703,8 @@ var ArticlesDrop = class extends Drop8 {
|
|
|
13661
13703
|
};
|
|
13662
13704
|
|
|
13663
13705
|
// src/compatibility/drops/blogs.ts
|
|
13664
|
-
import { Drop as
|
|
13665
|
-
var BlogsDrop = class extends
|
|
13706
|
+
import { Drop as Drop10 } from "liquidjs";
|
|
13707
|
+
var BlogsDrop = class extends Drop10 {
|
|
13666
13708
|
#instance;
|
|
13667
13709
|
#map;
|
|
13668
13710
|
constructor(instance) {
|
|
@@ -13708,7 +13750,7 @@ var BlogsDrop = class extends Drop9 {
|
|
|
13708
13750
|
};
|
|
13709
13751
|
|
|
13710
13752
|
// src/compatibility/drops/collections.ts
|
|
13711
|
-
import { Drop as
|
|
13753
|
+
import { Drop as Drop11 } from "liquidjs";
|
|
13712
13754
|
var AllCategoryResource = class extends StorefrontResource {
|
|
13713
13755
|
constructor(instance) {
|
|
13714
13756
|
super(() => {
|
|
@@ -13722,7 +13764,7 @@ var AllCategoryResource = class extends StorefrontResource {
|
|
|
13722
13764
|
});
|
|
13723
13765
|
}
|
|
13724
13766
|
};
|
|
13725
|
-
var CollectionsDrop = class extends
|
|
13767
|
+
var CollectionsDrop = class extends Drop11 {
|
|
13726
13768
|
#instance;
|
|
13727
13769
|
#map;
|
|
13728
13770
|
constructor(instance) {
|
|
@@ -13849,8 +13891,8 @@ var SwellStorefrontProducts = class extends SwellStorefrontCollection {
|
|
|
13849
13891
|
};
|
|
13850
13892
|
|
|
13851
13893
|
// src/compatibility/drops/images.ts
|
|
13852
|
-
import { Drop as
|
|
13853
|
-
var ImagesDrop = class extends
|
|
13894
|
+
import { Drop as Drop12 } from "liquidjs";
|
|
13895
|
+
var ImagesDrop = class extends Drop12 {
|
|
13854
13896
|
#instance;
|
|
13855
13897
|
#map;
|
|
13856
13898
|
constructor(instance) {
|
|
@@ -13904,8 +13946,8 @@ var SwellImage = class extends StorefrontResource {
|
|
|
13904
13946
|
};
|
|
13905
13947
|
|
|
13906
13948
|
// src/compatibility/drops/object-handles.ts
|
|
13907
|
-
import { Drop as
|
|
13908
|
-
var ObjectHandlesDrop = class extends
|
|
13949
|
+
import { Drop as Drop13 } from "liquidjs";
|
|
13950
|
+
var ObjectHandlesDrop = class extends Drop13 {
|
|
13909
13951
|
#map;
|
|
13910
13952
|
constructor(map) {
|
|
13911
13953
|
super();
|
|
@@ -13945,8 +13987,8 @@ var ObjectHandlesDrop = class extends Drop12 {
|
|
|
13945
13987
|
};
|
|
13946
13988
|
|
|
13947
13989
|
// src/compatibility/drops/pages.ts
|
|
13948
|
-
import { Drop as
|
|
13949
|
-
var PagesDrop = class extends
|
|
13990
|
+
import { Drop as Drop14 } from "liquidjs";
|
|
13991
|
+
var PagesDrop = class extends Drop14 {
|
|
13950
13992
|
#instance;
|
|
13951
13993
|
#map;
|
|
13952
13994
|
constructor(instance) {
|
|
@@ -14521,6 +14563,8 @@ ${injects.join("\n")}</script>`;
|
|
|
14521
14563
|
return `templates/${this.getPageType(name)}`;
|
|
14522
14564
|
case "sections":
|
|
14523
14565
|
return `sections/${name}`;
|
|
14566
|
+
case "blocks":
|
|
14567
|
+
return `blocks/${name}`;
|
|
14524
14568
|
default:
|
|
14525
14569
|
throw new Error(`Theme file type not supported: ${type}`);
|
|
14526
14570
|
}
|
|
@@ -14666,9 +14710,9 @@ ${injects.join("\n")}</script>`;
|
|
|
14666
14710
|
};
|
|
14667
14711
|
|
|
14668
14712
|
// src/liquid/drops/render.ts
|
|
14669
|
-
import { Drop as
|
|
14713
|
+
import { Drop as Drop15 } from "liquidjs";
|
|
14670
14714
|
import { noop as noop2 } from "lodash-es";
|
|
14671
|
-
var RenderDrop = class extends
|
|
14715
|
+
var RenderDrop = class extends Drop15 {
|
|
14672
14716
|
#result;
|
|
14673
14717
|
#handler;
|
|
14674
14718
|
constructor(handler) {
|
|
@@ -14870,14 +14914,161 @@ function bind3(_liquidSwell) {
|
|
|
14870
14914
|
};
|
|
14871
14915
|
}
|
|
14872
14916
|
|
|
14917
|
+
// src/liquid/tags/content_for.ts
|
|
14918
|
+
import { Tag as Tag4 } from "liquidjs";
|
|
14919
|
+
import { assign } from "lodash-es";
|
|
14920
|
+
|
|
14921
|
+
// src/liquid/hash.ts
|
|
14922
|
+
import { set as set3 } from "lodash-es";
|
|
14923
|
+
import { Hash, Tokenizer as Tokenizer2, evalToken as evalToken2 } from "liquidjs";
|
|
14924
|
+
|
|
14925
|
+
// src/liquid/tokienizer.ts
|
|
14926
|
+
import { Tokenizer } from "liquidjs";
|
|
14927
|
+
|
|
14928
|
+
// src/liquid/tokens/identifier-token.ts
|
|
14929
|
+
import { Token, TokenKind } from "liquidjs";
|
|
14930
|
+
var IdentifierToken = class extends Token {
|
|
14931
|
+
constructor(input, begin, end, file) {
|
|
14932
|
+
super(TokenKind.Word, input, begin, end, file);
|
|
14933
|
+
this.input = input;
|
|
14934
|
+
this.begin = begin;
|
|
14935
|
+
this.end = end;
|
|
14936
|
+
this.file = file;
|
|
14937
|
+
this.content = this.getText();
|
|
14938
|
+
}
|
|
14939
|
+
content;
|
|
14940
|
+
};
|
|
14941
|
+
|
|
14942
|
+
// src/liquid/tokienizer.ts
|
|
14943
|
+
var isNumber2 = (c) => c >= "0" && c <= "9";
|
|
14944
|
+
var isCharacter = (c) => c >= "a" && c <= "z" || c >= "A" && c <= "Z";
|
|
14945
|
+
var isWord = (c) => "_-?".includes(c) || isCharacter(c) || isNumber2(c);
|
|
14946
|
+
var TokenizerSwell = class extends Tokenizer {
|
|
14947
|
+
readIdentifier() {
|
|
14948
|
+
this.skipBlank();
|
|
14949
|
+
const begin = this.p;
|
|
14950
|
+
while (!this.end()) {
|
|
14951
|
+
const char = this.peek();
|
|
14952
|
+
if (isWord(char) || char === ".") {
|
|
14953
|
+
this.p++;
|
|
14954
|
+
} else {
|
|
14955
|
+
break;
|
|
14956
|
+
}
|
|
14957
|
+
}
|
|
14958
|
+
return new IdentifierToken(this.input, begin, this.p, this.file);
|
|
14959
|
+
}
|
|
14960
|
+
};
|
|
14961
|
+
|
|
14962
|
+
// src/liquid/hash.ts
|
|
14963
|
+
var HashSwell = class extends Hash {
|
|
14964
|
+
constructor(input, jekyllStyle) {
|
|
14965
|
+
super(input, jekyllStyle);
|
|
14966
|
+
const tokenizer = input instanceof Tokenizer2 ? input : new TokenizerSwell(input, {});
|
|
14967
|
+
for (const hash of tokenizer.readHashes(jekyllStyle)) {
|
|
14968
|
+
this.hash[hash.name.content] = hash.value;
|
|
14969
|
+
}
|
|
14970
|
+
}
|
|
14971
|
+
*render(ctx) {
|
|
14972
|
+
const hash = {};
|
|
14973
|
+
for (const key of Object.keys(this.hash)) {
|
|
14974
|
+
const token = this.hash[key];
|
|
14975
|
+
if (token !== void 0) {
|
|
14976
|
+
const value = yield evalToken2(token, ctx);
|
|
14977
|
+
set3(hash, key, value);
|
|
14978
|
+
}
|
|
14979
|
+
}
|
|
14980
|
+
return hash;
|
|
14981
|
+
}
|
|
14982
|
+
};
|
|
14983
|
+
|
|
14984
|
+
// src/liquid/tags/content_for.ts
|
|
14985
|
+
function bind4(liquidSwell) {
|
|
14986
|
+
return class ContentForTag extends Tag4 {
|
|
14987
|
+
name;
|
|
14988
|
+
hash;
|
|
14989
|
+
constructor(token, remainTokens, liquid) {
|
|
14990
|
+
super(token, remainTokens, liquid);
|
|
14991
|
+
const tokenizer = token.tokenizer;
|
|
14992
|
+
this.name = tokenizer.readValue()?.content;
|
|
14993
|
+
this.hash = new HashSwell(tokenizer.remaining());
|
|
14994
|
+
}
|
|
14995
|
+
*render(ctx, emitter) {
|
|
14996
|
+
const section = yield ctx._get(["section"]);
|
|
14997
|
+
const block = yield ctx._get(["block"]);
|
|
14998
|
+
const hash = yield this.hash.render(ctx);
|
|
14999
|
+
const blocks = this.getBlocks(section, block, hash);
|
|
15000
|
+
for (const block2 of blocks) {
|
|
15001
|
+
if (!isObject2(block2) || typeof block2.type !== "string") {
|
|
15002
|
+
continue;
|
|
15003
|
+
}
|
|
15004
|
+
const blockPath = yield liquidSwell.getThemeBlockPath(
|
|
15005
|
+
block2.type
|
|
15006
|
+
);
|
|
15007
|
+
if (!blockPath) {
|
|
15008
|
+
continue;
|
|
15009
|
+
}
|
|
15010
|
+
const childCtx = ctx.spawn();
|
|
15011
|
+
const scope = childCtx.bottom();
|
|
15012
|
+
assign(scope, { section });
|
|
15013
|
+
assign(scope, { block: block2 });
|
|
15014
|
+
assign(scope, hash);
|
|
15015
|
+
const templates = yield this.liquid._parseFile(
|
|
15016
|
+
blockPath,
|
|
15017
|
+
childCtx.sync
|
|
15018
|
+
);
|
|
15019
|
+
yield this.liquid.renderer.renderTemplates(
|
|
15020
|
+
templates,
|
|
15021
|
+
childCtx,
|
|
15022
|
+
emitter
|
|
15023
|
+
);
|
|
15024
|
+
}
|
|
15025
|
+
}
|
|
15026
|
+
getBlocks(section, block, hash) {
|
|
15027
|
+
const blockConfigs = this.getBlockConfigs(section, block);
|
|
15028
|
+
if (!isObject2(hash) || !hash.type) {
|
|
15029
|
+
return blockConfigs;
|
|
15030
|
+
}
|
|
15031
|
+
const blockConfig = blockConfigs.find(
|
|
15032
|
+
(blockConfig2) => isObject2(blockConfig2) && blockConfig2.type === hash.type
|
|
15033
|
+
);
|
|
15034
|
+
return blockConfig ? [blockConfig] : [];
|
|
15035
|
+
}
|
|
15036
|
+
getBlockConfigs(section, block) {
|
|
15037
|
+
if (isObject2(block) && block.blocks) {
|
|
15038
|
+
return Object.values(block.blocks);
|
|
15039
|
+
}
|
|
15040
|
+
if (isObject2(section) && Array.isArray(section.blocks)) {
|
|
15041
|
+
return section.blocks;
|
|
15042
|
+
}
|
|
15043
|
+
return [];
|
|
15044
|
+
}
|
|
15045
|
+
};
|
|
15046
|
+
}
|
|
15047
|
+
|
|
15048
|
+
// src/liquid/tags/doc.ts
|
|
15049
|
+
import { Tag as Tag5 } from "liquidjs";
|
|
15050
|
+
function bind5() {
|
|
15051
|
+
return class DocTag extends Tag5 {
|
|
15052
|
+
constructor(token, remainTokens, liquid, parser) {
|
|
15053
|
+
super(token, remainTokens, liquid);
|
|
15054
|
+
const stream = parser.parseStream(remainTokens).on("tag:enddoc", () => {
|
|
15055
|
+
stream.stop();
|
|
15056
|
+
});
|
|
15057
|
+
stream.start();
|
|
15058
|
+
}
|
|
15059
|
+
render() {
|
|
15060
|
+
}
|
|
15061
|
+
};
|
|
15062
|
+
}
|
|
15063
|
+
|
|
14873
15064
|
// src/liquid/tags/for.ts
|
|
14874
|
-
import { evalToken as
|
|
15065
|
+
import { evalToken as evalToken3, ForTag as LiquidForTag } from "liquidjs";
|
|
14875
15066
|
var MODIFIERS = Object.freeze(["offset", "limit", "reversed"]);
|
|
14876
|
-
function
|
|
15067
|
+
function bind6(_liquidSwell) {
|
|
14877
15068
|
return class ForTag extends LiquidForTag {
|
|
14878
15069
|
*render(ctx, emitter) {
|
|
14879
15070
|
const r = this.liquid.renderer;
|
|
14880
|
-
let collection = yield
|
|
15071
|
+
let collection = yield evalToken3(this.collection, ctx);
|
|
14881
15072
|
collection = yield resolveEnumerable(collection);
|
|
14882
15073
|
if (!collection.length) {
|
|
14883
15074
|
yield r.renderTemplates(this.elseTemplates, ctx, emitter);
|
|
@@ -14944,10 +15135,10 @@ function limit(arr, count) {
|
|
|
14944
15135
|
}
|
|
14945
15136
|
|
|
14946
15137
|
// src/liquid/tags/form.ts
|
|
14947
|
-
import { Tag as
|
|
15138
|
+
import { Tag as Tag6, Hash as Hash3, TypeGuards as TypeGuards2, evalToken as evalToken4 } from "liquidjs";
|
|
14948
15139
|
var IGNORED_SHOPIFY_FORMS = Object.freeze(["new_comment", "guest_login"]);
|
|
14949
|
-
function
|
|
14950
|
-
return class FormTag extends
|
|
15140
|
+
function bind7(liquidSwell) {
|
|
15141
|
+
return class FormTag extends Tag6 {
|
|
14951
15142
|
formType;
|
|
14952
15143
|
formConfig;
|
|
14953
15144
|
templates;
|
|
@@ -14960,7 +15151,7 @@ function bind5(liquidSwell) {
|
|
|
14960
15151
|
this.formConfig = liquidSwell.theme.getFormConfig(this.formType);
|
|
14961
15152
|
this.arg = tokenizer.readValue();
|
|
14962
15153
|
this.templates = [];
|
|
14963
|
-
this.hash = new
|
|
15154
|
+
this.hash = new Hash3(this.tokenizer.remaining());
|
|
14964
15155
|
while (remainTokens.length > 0) {
|
|
14965
15156
|
const token2 = remainTokens.shift();
|
|
14966
15157
|
if (TypeGuards2.isTagToken(token2) && token2.name === "endform") {
|
|
@@ -14981,7 +15172,7 @@ function bind5(liquidSwell) {
|
|
|
14981
15172
|
return;
|
|
14982
15173
|
}
|
|
14983
15174
|
const r = this.liquid.renderer;
|
|
14984
|
-
const arg = yield
|
|
15175
|
+
const arg = yield evalToken4(this.arg, ctx);
|
|
14985
15176
|
const hash = yield this.hash.render(ctx);
|
|
14986
15177
|
const scope = ctx.getAll();
|
|
14987
15178
|
const attrs = " " + Object.entries({ id: `${this.formConfig.id}_form`, ...hash }).reduce((acc, [key, value]) => {
|
|
@@ -15044,12 +15235,12 @@ function bind5(liquidSwell) {
|
|
|
15044
15235
|
// src/liquid/tags/if.ts
|
|
15045
15236
|
import {
|
|
15046
15237
|
assert,
|
|
15047
|
-
Tag as
|
|
15238
|
+
Tag as Tag7,
|
|
15048
15239
|
Value as Value3,
|
|
15049
15240
|
isTruthy as isTruthy2
|
|
15050
15241
|
} from "liquidjs";
|
|
15051
|
-
function
|
|
15052
|
-
return class IfTag extends
|
|
15242
|
+
function bind8(_liquidSwell) {
|
|
15243
|
+
return class IfTag extends Tag7 {
|
|
15053
15244
|
branches = [];
|
|
15054
15245
|
elseTemplates;
|
|
15055
15246
|
constructor(tagToken, remainTokens, liquid, parser) {
|
|
@@ -15116,9 +15307,9 @@ function assertEmpty(predicate, message = `unexpected ${JSON.stringify(predicate
|
|
|
15116
15307
|
}
|
|
15117
15308
|
|
|
15118
15309
|
// src/liquid/tags/javascript.ts
|
|
15119
|
-
import { Tag as
|
|
15120
|
-
function
|
|
15121
|
-
return class JavascriptTag extends
|
|
15310
|
+
import { Tag as Tag8, TypeGuards as TypeGuards3 } from "liquidjs";
|
|
15311
|
+
function bind9(_liquidSwell) {
|
|
15312
|
+
return class JavascriptTag extends Tag8 {
|
|
15122
15313
|
templates;
|
|
15123
15314
|
constructor(token, remainTokens, liquid, parser) {
|
|
15124
15315
|
super(token, remainTokens, liquid);
|
|
@@ -15143,9 +15334,9 @@ function bind7(_liquidSwell) {
|
|
|
15143
15334
|
}
|
|
15144
15335
|
|
|
15145
15336
|
// src/liquid/tags/layout.ts
|
|
15146
|
-
import { Tag as
|
|
15147
|
-
function
|
|
15148
|
-
return class LayoutTag extends
|
|
15337
|
+
import { Tag as Tag9 } from "liquidjs";
|
|
15338
|
+
function bind10(liquidSwell) {
|
|
15339
|
+
return class LayoutTag extends Tag9 {
|
|
15149
15340
|
fileName;
|
|
15150
15341
|
constructor(token, remainTokens, liquid, _parser) {
|
|
15151
15342
|
super(token, remainTokens, liquid);
|
|
@@ -15161,9 +15352,9 @@ function bind8(liquidSwell) {
|
|
|
15161
15352
|
}
|
|
15162
15353
|
|
|
15163
15354
|
// src/liquid/tags/paginate.ts
|
|
15164
|
-
import { Tag as
|
|
15165
|
-
function
|
|
15166
|
-
return class PaginateTag extends
|
|
15355
|
+
import { Tag as Tag10, Hash as Hash4, evalToken as evalToken5 } from "liquidjs";
|
|
15356
|
+
function bind11(liquidSwell) {
|
|
15357
|
+
return class PaginateTag extends Tag10 {
|
|
15167
15358
|
collection;
|
|
15168
15359
|
pageSize;
|
|
15169
15360
|
templates;
|
|
@@ -15178,7 +15369,7 @@ function bind9(liquidSwell) {
|
|
|
15178
15369
|
}
|
|
15179
15370
|
this.templates = [];
|
|
15180
15371
|
this.collection = collection;
|
|
15181
|
-
this.hash = new
|
|
15372
|
+
this.hash = new Hash4(this.tokenizer.remaining());
|
|
15182
15373
|
const stream = parser.parseStream(remainTokens).on("tag:endpaginate", () => stream.stop()).on("template", (tpl) => {
|
|
15183
15374
|
this.templates.push(tpl);
|
|
15184
15375
|
}).on("end", () => {
|
|
@@ -15188,8 +15379,8 @@ function bind9(liquidSwell) {
|
|
|
15188
15379
|
}
|
|
15189
15380
|
*render(ctx, emitter) {
|
|
15190
15381
|
const r = this.liquid.renderer;
|
|
15191
|
-
const collection = yield
|
|
15192
|
-
const pageSize = Number(yield
|
|
15382
|
+
const collection = yield evalToken5(this.collection, ctx);
|
|
15383
|
+
const pageSize = Number(yield evalToken5(this.pageSize, ctx));
|
|
15193
15384
|
const hash = yield this.hash.render(ctx);
|
|
15194
15385
|
if (!Number.isNaN(pageSize) && collection instanceof SwellStorefrontCollection && collection.limit !== pageSize) {
|
|
15195
15386
|
yield collection._get({
|
|
@@ -15215,9 +15406,9 @@ function bind9(liquidSwell) {
|
|
|
15215
15406
|
}
|
|
15216
15407
|
|
|
15217
15408
|
// src/liquid/tags/render.ts
|
|
15218
|
-
import { assign } from "lodash-es";
|
|
15219
|
-
import { assert as assert2, evalToken as
|
|
15220
|
-
function
|
|
15409
|
+
import { assign as assign2 } from "lodash-es";
|
|
15410
|
+
import { assert as assert2, evalToken as evalToken6, RenderTag as LiquidRenderTag } from "liquidjs";
|
|
15411
|
+
function bind12(liquidSwell) {
|
|
15221
15412
|
return class RenderTag extends LiquidRenderTag {
|
|
15222
15413
|
*render(ctx, emitter) {
|
|
15223
15414
|
const self = this;
|
|
@@ -15234,17 +15425,20 @@ function bind10(liquidSwell) {
|
|
|
15234
15425
|
);
|
|
15235
15426
|
const childCtx = ctx.spawn();
|
|
15236
15427
|
const scope = childCtx.bottom();
|
|
15237
|
-
|
|
15428
|
+
assign2(scope, ctx.bottom());
|
|
15238
15429
|
const parentSection = yield ctx._get(["section"]);
|
|
15239
|
-
if (parentSection)
|
|
15430
|
+
if (parentSection) assign2(scope, { section: parentSection });
|
|
15431
|
+
const parentBlock = yield ctx._get(["block"]);
|
|
15432
|
+
if (parentBlock) assign2(scope, { block: parentBlock });
|
|
15433
|
+
assign2(scope, yield hash.render(ctx));
|
|
15240
15434
|
if (self["with"]) {
|
|
15241
15435
|
const { value, alias } = self["with"];
|
|
15242
15436
|
const aliasName = alias || filename;
|
|
15243
|
-
scope[aliasName] = yield
|
|
15437
|
+
scope[aliasName] = yield evalToken6(value, ctx);
|
|
15244
15438
|
}
|
|
15245
15439
|
if (self["for"]) {
|
|
15246
15440
|
const { value, alias } = self["for"];
|
|
15247
|
-
let collection = yield
|
|
15441
|
+
let collection = yield evalToken6(value, ctx);
|
|
15248
15442
|
collection = yield resolveEnumerable(collection);
|
|
15249
15443
|
scope["forloop"] = new ForloopDrop(
|
|
15250
15444
|
collection.length,
|
|
@@ -15287,13 +15481,13 @@ function* renderFilePath(file, ctx, liquid) {
|
|
|
15287
15481
|
default:
|
|
15288
15482
|
break;
|
|
15289
15483
|
}
|
|
15290
|
-
return yield
|
|
15484
|
+
return yield evalToken6(file, ctx);
|
|
15291
15485
|
}
|
|
15292
15486
|
|
|
15293
15487
|
// src/liquid/tags/section.ts
|
|
15294
|
-
import { Tag as
|
|
15295
|
-
function
|
|
15296
|
-
return class SectionTag extends
|
|
15488
|
+
import { Tag as Tag11 } from "liquidjs";
|
|
15489
|
+
function bind13(liquidSwell) {
|
|
15490
|
+
return class SectionTag extends Tag11 {
|
|
15297
15491
|
fileName;
|
|
15298
15492
|
constructor(token, remainTokens, liquid, _parser) {
|
|
15299
15493
|
super(token, remainTokens, liquid);
|
|
@@ -15344,10 +15538,10 @@ function bind11(liquidSwell) {
|
|
|
15344
15538
|
}
|
|
15345
15539
|
|
|
15346
15540
|
// src/liquid/tags/sections.ts
|
|
15347
|
-
import { Tag as
|
|
15541
|
+
import { Tag as Tag12 } from "liquidjs";
|
|
15348
15542
|
import JSON54 from "json5";
|
|
15349
|
-
function
|
|
15350
|
-
return class SectionsTag extends
|
|
15543
|
+
function bind14(liquidSwell) {
|
|
15544
|
+
return class SectionsTag extends Tag12 {
|
|
15351
15545
|
fileName;
|
|
15352
15546
|
constructor(token, remainTokens, liquid, _parser) {
|
|
15353
15547
|
super(token, remainTokens, liquid);
|
|
@@ -15387,9 +15581,9 @@ function bind12(liquidSwell) {
|
|
|
15387
15581
|
}
|
|
15388
15582
|
|
|
15389
15583
|
// src/liquid/tags/style.ts
|
|
15390
|
-
import { Tag as
|
|
15391
|
-
function
|
|
15392
|
-
return class StyleTag extends
|
|
15584
|
+
import { Tag as Tag13, TypeGuards as TypeGuards4 } from "liquidjs";
|
|
15585
|
+
function bind15(_liquidSwell) {
|
|
15586
|
+
return class StyleTag extends Tag13 {
|
|
15393
15587
|
templates;
|
|
15394
15588
|
hash;
|
|
15395
15589
|
constructor(token, remainTokens, liquid, parser) {
|
|
@@ -15421,9 +15615,9 @@ function bind13(_liquidSwell) {
|
|
|
15421
15615
|
}
|
|
15422
15616
|
|
|
15423
15617
|
// src/liquid/tags/stylesheet.ts
|
|
15424
|
-
import { Tag as
|
|
15425
|
-
function
|
|
15426
|
-
return class StyleSheetTag extends
|
|
15618
|
+
import { Tag as Tag14, TypeGuards as TypeGuards5 } from "liquidjs";
|
|
15619
|
+
function bind16(_liquidSwell) {
|
|
15620
|
+
return class StyleSheetTag extends Tag14 {
|
|
15427
15621
|
templates;
|
|
15428
15622
|
constructor(token, remainTokens, liquid, parser) {
|
|
15429
15623
|
super(token, remainTokens, liquid);
|
|
@@ -15446,8 +15640,8 @@ function bind14(_liquidSwell) {
|
|
|
15446
15640
|
}
|
|
15447
15641
|
|
|
15448
15642
|
// src/liquid/tags/shopify/include.ts
|
|
15449
|
-
import { assert as assert3, evalToken as
|
|
15450
|
-
function
|
|
15643
|
+
import { assert as assert3, evalToken as evalToken7, IncludeTag as LiquidIncludeTag } from "liquidjs";
|
|
15644
|
+
function bind17(liquidSwell) {
|
|
15451
15645
|
return class IncludeTag extends LiquidIncludeTag {
|
|
15452
15646
|
*render(ctx, emitter) {
|
|
15453
15647
|
const { hash } = this;
|
|
@@ -15462,7 +15656,7 @@ function bind15(liquidSwell) {
|
|
|
15462
15656
|
ctx.setRegister("blockMode", 0);
|
|
15463
15657
|
const scope = yield hash.render(ctx);
|
|
15464
15658
|
if (this.withVar) {
|
|
15465
|
-
scope[filepath] = yield
|
|
15659
|
+
scope[filepath] = yield evalToken7(this.withVar, ctx);
|
|
15466
15660
|
}
|
|
15467
15661
|
ctx.push(ctx.opts.jekyllInclude ? { include: scope } : scope);
|
|
15468
15662
|
const output = yield liquidSwell.getComponentPath(filepath).then((path) => liquidSwell.getThemeConfig(path)).then((themeConfig) => liquidSwell.renderTemplate(themeConfig, ctx));
|
|
@@ -15474,10 +15668,10 @@ function bind15(liquidSwell) {
|
|
|
15474
15668
|
}
|
|
15475
15669
|
|
|
15476
15670
|
// src/liquid/tags/shopify/schema.ts
|
|
15477
|
-
import { Tag as
|
|
15671
|
+
import { Tag as Tag15 } from "liquidjs";
|
|
15478
15672
|
import JSON55 from "json5";
|
|
15479
|
-
function
|
|
15480
|
-
return class SchemaTag extends
|
|
15673
|
+
function bind18(liquidSwell) {
|
|
15674
|
+
return class SchemaTag extends Tag15 {
|
|
15481
15675
|
templates;
|
|
15482
15676
|
constructor(token, remainTokens, liquid, parser) {
|
|
15483
15677
|
super(token, remainTokens, liquid);
|
|
@@ -15499,6 +15693,7 @@ function bind16(liquidSwell) {
|
|
|
15499
15693
|
liquidSwell.lastSchema = void 0;
|
|
15500
15694
|
if (typeof jsonOutput === "string") {
|
|
15501
15695
|
liquidSwell.lastSchema = JSON55.parse(jsonOutput);
|
|
15696
|
+
expandThemeBlocks(liquidSwell);
|
|
15502
15697
|
}
|
|
15503
15698
|
} catch (err) {
|
|
15504
15699
|
console.warn(err);
|
|
@@ -15508,11 +15703,22 @@ function bind16(liquidSwell) {
|
|
|
15508
15703
|
}
|
|
15509
15704
|
};
|
|
15510
15705
|
}
|
|
15706
|
+
function expandThemeBlocks(liquidSwell) {
|
|
15707
|
+
const blocks = liquidSwell.lastSchema?.blocks;
|
|
15708
|
+
if (!Array.isArray(blocks)) {
|
|
15709
|
+
return;
|
|
15710
|
+
}
|
|
15711
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
15712
|
+
if (blocks[i].type === "@theme") {
|
|
15713
|
+
blocks.splice(i, 1, ...liquidSwell.theme.getAllThemeBlockSchemas());
|
|
15714
|
+
}
|
|
15715
|
+
}
|
|
15716
|
+
}
|
|
15511
15717
|
|
|
15512
15718
|
// src/liquid/tags/inline_editable.ts
|
|
15513
|
-
import { Tag as
|
|
15514
|
-
function
|
|
15515
|
-
return class InlineEditableTag extends
|
|
15719
|
+
import { Tag as Tag16 } from "liquidjs";
|
|
15720
|
+
function bind19(_liquidSwell) {
|
|
15721
|
+
return class InlineEditableTag extends Tag16 {
|
|
15516
15722
|
key;
|
|
15517
15723
|
value;
|
|
15518
15724
|
constructor(token, remainTokens, liquid, _parser) {
|
|
@@ -15540,129 +15746,131 @@ var tags = {
|
|
|
15540
15746
|
assign: bind,
|
|
15541
15747
|
case: bind2,
|
|
15542
15748
|
comment: bind3,
|
|
15543
|
-
|
|
15544
|
-
|
|
15545
|
-
|
|
15546
|
-
|
|
15547
|
-
|
|
15548
|
-
|
|
15549
|
-
|
|
15550
|
-
|
|
15551
|
-
|
|
15552
|
-
|
|
15749
|
+
content_for: bind4,
|
|
15750
|
+
doc: bind5,
|
|
15751
|
+
for: bind6,
|
|
15752
|
+
form: bind7,
|
|
15753
|
+
if: bind8,
|
|
15754
|
+
javascript: bind9,
|
|
15755
|
+
layout: bind10,
|
|
15756
|
+
paginate: bind11,
|
|
15757
|
+
render: bind12,
|
|
15758
|
+
section: bind13,
|
|
15759
|
+
sections: bind14,
|
|
15760
|
+
style: bind15,
|
|
15553
15761
|
// Shopify compatibility only
|
|
15554
|
-
include:
|
|
15555
|
-
schema:
|
|
15556
|
-
stylesheet:
|
|
15762
|
+
include: bind17,
|
|
15763
|
+
schema: bind18,
|
|
15764
|
+
stylesheet: bind16,
|
|
15557
15765
|
// Swell only
|
|
15558
|
-
inline_editable:
|
|
15766
|
+
inline_editable: bind19
|
|
15559
15767
|
};
|
|
15560
15768
|
function bindTags(liquidSwell) {
|
|
15561
15769
|
Object.entries(tags).forEach(
|
|
15562
|
-
([tag,
|
|
15770
|
+
([tag, bind70]) => liquidSwell.registerTag(tag, bind70(liquidSwell))
|
|
15563
15771
|
);
|
|
15564
15772
|
}
|
|
15565
15773
|
|
|
15566
15774
|
// src/liquid/filters/asset_url.ts
|
|
15567
|
-
function
|
|
15775
|
+
function bind20(liquidSwell) {
|
|
15568
15776
|
return function filterAssetUrl(assetPath) {
|
|
15569
15777
|
return liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
|
|
15570
15778
|
};
|
|
15571
15779
|
}
|
|
15572
15780
|
|
|
15573
15781
|
// src/liquid/filters/brightness_difference.ts
|
|
15574
|
-
function
|
|
15782
|
+
function bind21(_liquidSwell) {
|
|
15575
15783
|
return (color1, color2) => {
|
|
15576
15784
|
return ThemeColor.get(color1).brightnessDifference(ThemeColor.get(color2));
|
|
15577
15785
|
};
|
|
15578
15786
|
}
|
|
15579
15787
|
|
|
15580
15788
|
// src/liquid/filters/color_brightness.ts
|
|
15581
|
-
function
|
|
15789
|
+
function bind22(_liquidSwell) {
|
|
15582
15790
|
return (color) => {
|
|
15583
15791
|
return ThemeColor.get(color).brightness();
|
|
15584
15792
|
};
|
|
15585
15793
|
}
|
|
15586
15794
|
|
|
15587
15795
|
// src/liquid/filters/color_contrast.ts
|
|
15588
|
-
function
|
|
15796
|
+
function bind23(_liquidSwell) {
|
|
15589
15797
|
return (color1, color2) => {
|
|
15590
15798
|
return ThemeColor.get(color1).contrast(ThemeColor.get(color2));
|
|
15591
15799
|
};
|
|
15592
15800
|
}
|
|
15593
15801
|
|
|
15594
15802
|
// src/liquid/filters/color_darken.ts
|
|
15595
|
-
function
|
|
15803
|
+
function bind24(_liquidSwell) {
|
|
15596
15804
|
return (color, percent) => {
|
|
15597
15805
|
return ThemeColor.get(color).darken(percent);
|
|
15598
15806
|
};
|
|
15599
15807
|
}
|
|
15600
15808
|
|
|
15601
15809
|
// src/liquid/filters/color_desaturate.ts
|
|
15602
|
-
function
|
|
15810
|
+
function bind25(_liquidSwell) {
|
|
15603
15811
|
return (color, value) => {
|
|
15604
15812
|
return ThemeColor.get(color).desaturate(value);
|
|
15605
15813
|
};
|
|
15606
15814
|
}
|
|
15607
15815
|
|
|
15608
15816
|
// src/liquid/filters/color_difference.ts
|
|
15609
|
-
function
|
|
15817
|
+
function bind26(_liquidSwell) {
|
|
15610
15818
|
return (color1, color2) => {
|
|
15611
15819
|
return ThemeColor.get(color1).difference(ThemeColor.get(color2));
|
|
15612
15820
|
};
|
|
15613
15821
|
}
|
|
15614
15822
|
|
|
15615
15823
|
// src/liquid/filters/color_extract.ts
|
|
15616
|
-
function
|
|
15824
|
+
function bind27(_liquidSwell) {
|
|
15617
15825
|
return (color, field) => {
|
|
15618
15826
|
return ThemeColor.get(color).extract(field);
|
|
15619
15827
|
};
|
|
15620
15828
|
}
|
|
15621
15829
|
|
|
15622
15830
|
// src/liquid/filters/color_lighten.ts
|
|
15623
|
-
function
|
|
15831
|
+
function bind28(_liquidSwell) {
|
|
15624
15832
|
return (color, percent) => {
|
|
15625
15833
|
return ThemeColor.get(color).lighten(percent);
|
|
15626
15834
|
};
|
|
15627
15835
|
}
|
|
15628
15836
|
|
|
15629
15837
|
// src/liquid/filters/color_mix.ts
|
|
15630
|
-
function
|
|
15838
|
+
function bind29(_liquidSwell) {
|
|
15631
15839
|
return (color1, color2, ratio) => {
|
|
15632
15840
|
return ThemeColor.get(color1).mix(ThemeColor.get(color2), ratio);
|
|
15633
15841
|
};
|
|
15634
15842
|
}
|
|
15635
15843
|
|
|
15636
15844
|
// src/liquid/filters/color_modify.ts
|
|
15637
|
-
function
|
|
15845
|
+
function bind30(_liquidSwell) {
|
|
15638
15846
|
return function filterColorModify(color, field, value) {
|
|
15639
15847
|
return ThemeColor.get(color).modify(field, Number(value) || 0);
|
|
15640
15848
|
};
|
|
15641
15849
|
}
|
|
15642
15850
|
|
|
15643
15851
|
// src/liquid/filters/color_saturate.ts
|
|
15644
|
-
function
|
|
15852
|
+
function bind31(_liquidSwell) {
|
|
15645
15853
|
return (color, value) => {
|
|
15646
15854
|
return ThemeColor.get(color).saturate(value);
|
|
15647
15855
|
};
|
|
15648
15856
|
}
|
|
15649
15857
|
|
|
15650
15858
|
// src/liquid/filters/color_to_hex.ts
|
|
15651
|
-
function
|
|
15859
|
+
function bind32(_liquidSwell) {
|
|
15652
15860
|
return (color) => {
|
|
15653
15861
|
return ThemeColor.get(color).hex();
|
|
15654
15862
|
};
|
|
15655
15863
|
}
|
|
15656
15864
|
|
|
15657
15865
|
// src/liquid/filters/color_to_hsl.ts
|
|
15658
|
-
function
|
|
15866
|
+
function bind33(_liquidSwell) {
|
|
15659
15867
|
return (color) => {
|
|
15660
15868
|
return ThemeColor.get(color).hsl();
|
|
15661
15869
|
};
|
|
15662
15870
|
}
|
|
15663
15871
|
|
|
15664
15872
|
// src/liquid/filters/color_to_rgb.ts
|
|
15665
|
-
function
|
|
15873
|
+
function bind34(_liquidSwell) {
|
|
15666
15874
|
return (color, alpha) => {
|
|
15667
15875
|
return alpha !== void 0 ? ThemeColor.get(color).rgba(alpha) : ThemeColor.get(color).rgb();
|
|
15668
15876
|
};
|
|
@@ -15670,7 +15878,7 @@ function bind32(_liquidSwell) {
|
|
|
15670
15878
|
|
|
15671
15879
|
// src/liquid/filters/date.ts
|
|
15672
15880
|
import strftime from "strftime";
|
|
15673
|
-
function
|
|
15881
|
+
function bind35(_liquidSwell) {
|
|
15674
15882
|
return (dateValue, ...params) => {
|
|
15675
15883
|
const date = ensureDate(dateValue);
|
|
15676
15884
|
const { format } = getDateFilterParams(params);
|
|
@@ -15728,7 +15936,7 @@ function applyStrftimeFormat(format, date) {
|
|
|
15728
15936
|
}
|
|
15729
15937
|
|
|
15730
15938
|
// src/liquid/filters/date_next_interval.ts
|
|
15731
|
-
function
|
|
15939
|
+
function bind36(_liquidSwell) {
|
|
15732
15940
|
return (dateValue, interval, intervalCount) => {
|
|
15733
15941
|
const date = ensureDate(dateValue);
|
|
15734
15942
|
const result = getNextIntervalDate(date, interval, Number(intervalCount));
|
|
@@ -15780,7 +15988,7 @@ function time(date) {
|
|
|
15780
15988
|
}
|
|
15781
15989
|
|
|
15782
15990
|
// src/liquid/filters/default_errors.ts
|
|
15783
|
-
function
|
|
15991
|
+
function bind37(_liquidSwell) {
|
|
15784
15992
|
return async function filterDefaultError(errors) {
|
|
15785
15993
|
if (!errors) {
|
|
15786
15994
|
return "";
|
|
@@ -15806,7 +16014,7 @@ function bind35(_liquidSwell) {
|
|
|
15806
16014
|
}
|
|
15807
16015
|
|
|
15808
16016
|
// src/liquid/filters/divided_by.ts
|
|
15809
|
-
function
|
|
16017
|
+
function bind38(_liquidSwell) {
|
|
15810
16018
|
return (dividend, divisor, integerArithmetic) => {
|
|
15811
16019
|
if (!isNumber(dividend) || !isNumber(divisor)) {
|
|
15812
16020
|
return dividend;
|
|
@@ -15817,7 +16025,7 @@ function bind36(_liquidSwell) {
|
|
|
15817
16025
|
|
|
15818
16026
|
// src/liquid/filters/embedded_content.ts
|
|
15819
16027
|
import { unescape } from "lodash-es";
|
|
15820
|
-
function
|
|
16028
|
+
function bind39(_liquidSwell) {
|
|
15821
16029
|
return (value, tag = "iframe") => {
|
|
15822
16030
|
const escapeIframes = value.replaceAll(`<${tag}`, `<${tag}`).replaceAll(`</${tag}`, `</${tag}`);
|
|
15823
16031
|
const removeTags = escapeIframes.replaceAll(/<(.*?)>/gi, "");
|
|
@@ -15829,7 +16037,7 @@ function bind37(_liquidSwell) {
|
|
|
15829
16037
|
|
|
15830
16038
|
// src/liquid/filters/escape.ts
|
|
15831
16039
|
import { escape } from "lodash-es";
|
|
15832
|
-
function
|
|
16040
|
+
function bind40(_liquidSwell) {
|
|
15833
16041
|
return function escapeTag(input) {
|
|
15834
16042
|
if (!input?.startsWith) {
|
|
15835
16043
|
return input;
|
|
@@ -15842,7 +16050,7 @@ function bind38(_liquidSwell) {
|
|
|
15842
16050
|
}
|
|
15843
16051
|
|
|
15844
16052
|
// src/liquid/filters/font_face.ts
|
|
15845
|
-
function
|
|
16053
|
+
function bind41(_liquidSwell) {
|
|
15846
16054
|
return (fontSetting, ...params) => {
|
|
15847
16055
|
if (!fontSetting) {
|
|
15848
16056
|
return null;
|
|
@@ -15854,14 +16062,14 @@ function bind39(_liquidSwell) {
|
|
|
15854
16062
|
}
|
|
15855
16063
|
|
|
15856
16064
|
// src/liquid/filters/font_modify.ts
|
|
15857
|
-
function
|
|
16065
|
+
function bind42(_liquidSwell) {
|
|
15858
16066
|
return (fontSetting, prop, value) => {
|
|
15859
16067
|
return ThemeFont.clone(fontSetting).modify(prop, value);
|
|
15860
16068
|
};
|
|
15861
16069
|
}
|
|
15862
16070
|
|
|
15863
16071
|
// src/liquid/filters/font_url.ts
|
|
15864
|
-
function
|
|
16072
|
+
function bind43(_liquidSwell) {
|
|
15865
16073
|
return (fontSetting) => {
|
|
15866
16074
|
return ThemeFont.get(fontSetting).url();
|
|
15867
16075
|
};
|
|
@@ -15911,14 +16119,14 @@ var format_address_default = {
|
|
|
15911
16119
|
|
|
15912
16120
|
// src/liquid/filters/handleize.ts
|
|
15913
16121
|
import { kebabCase } from "lodash-es";
|
|
15914
|
-
function
|
|
16122
|
+
function bind44(_liquidSwell) {
|
|
15915
16123
|
return function filterHandleize(handle) {
|
|
15916
16124
|
return kebabCase(handle);
|
|
15917
16125
|
};
|
|
15918
16126
|
}
|
|
15919
16127
|
|
|
15920
16128
|
// src/liquid/filters/image_tag.ts
|
|
15921
|
-
function
|
|
16129
|
+
function bind45(_liquidSwell) {
|
|
15922
16130
|
return function filterImageTag(imageUrl, ...params) {
|
|
15923
16131
|
imageUrl = String(imageUrl || "");
|
|
15924
16132
|
let {
|
|
@@ -16082,7 +16290,7 @@ var filterDefinition = {
|
|
|
16082
16290
|
var image_url_default = filterDefinition;
|
|
16083
16291
|
|
|
16084
16292
|
// src/liquid/filters/inline_asset_content.ts
|
|
16085
|
-
function
|
|
16293
|
+
function bind46(liquidSwell) {
|
|
16086
16294
|
return async (assetPath) => {
|
|
16087
16295
|
const config = await liquidSwell.theme.getThemeConfig(
|
|
16088
16296
|
`theme/assets/${assetPath}`
|
|
@@ -16092,14 +16300,14 @@ function bind44(liquidSwell) {
|
|
|
16092
16300
|
}
|
|
16093
16301
|
|
|
16094
16302
|
// src/liquid/filters/json.ts
|
|
16095
|
-
function
|
|
16303
|
+
function bind47(_liquidSwell) {
|
|
16096
16304
|
return async function filterJson(input, space = 0) {
|
|
16097
16305
|
return jsonStringifyAsync(input, space);
|
|
16098
16306
|
};
|
|
16099
16307
|
}
|
|
16100
16308
|
|
|
16101
16309
|
// src/liquid/filters/json_pretty.ts
|
|
16102
|
-
function
|
|
16310
|
+
function bind48(_liquidSwell) {
|
|
16103
16311
|
return async function filterJsonPretty(input, space = 2) {
|
|
16104
16312
|
const output = await jsonStringifyAsync(input, space);
|
|
16105
16313
|
return `<pre>${output}</pre>`;
|
|
@@ -16109,7 +16317,7 @@ function bind46(_liquidSwell) {
|
|
|
16109
16317
|
// src/liquid/filters/locale_flag.ts
|
|
16110
16318
|
import { hasFlag } from "country-flag-icons";
|
|
16111
16319
|
import * as flags from "country-flag-icons/string/1x1";
|
|
16112
|
-
function
|
|
16320
|
+
function bind49(_liquidSwell) {
|
|
16113
16321
|
return (localeCode) => {
|
|
16114
16322
|
if (typeof localeCode !== "string") {
|
|
16115
16323
|
return flags.US;
|
|
@@ -16120,7 +16328,7 @@ function bind47(_liquidSwell) {
|
|
|
16120
16328
|
}
|
|
16121
16329
|
|
|
16122
16330
|
// src/liquid/filters/minus.ts
|
|
16123
|
-
function
|
|
16331
|
+
function bind50(_liquidSwell) {
|
|
16124
16332
|
return (first, second) => {
|
|
16125
16333
|
const firstValue = isNumber(first) ? first : 0;
|
|
16126
16334
|
const secondValue = isNumber(second) ? second : 0;
|
|
@@ -16129,7 +16337,7 @@ function bind48(_liquidSwell) {
|
|
|
16129
16337
|
}
|
|
16130
16338
|
|
|
16131
16339
|
// src/liquid/filters/money.ts
|
|
16132
|
-
function
|
|
16340
|
+
function bind51(liquidSwell) {
|
|
16133
16341
|
return function filterMoney(value) {
|
|
16134
16342
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16135
16343
|
return liquidSwell.renderCurrency(amount);
|
|
@@ -16146,7 +16354,7 @@ function getMoneyAmount(liquidSwell, value) {
|
|
|
16146
16354
|
}
|
|
16147
16355
|
|
|
16148
16356
|
// src/liquid/filters/money_with_currency.ts
|
|
16149
|
-
function
|
|
16357
|
+
function bind52(liquidSwell) {
|
|
16150
16358
|
return function filterMoneyWithCurrency(value) {
|
|
16151
16359
|
const { currency } = liquidSwell.theme.swell.getStorefrontLocalization();
|
|
16152
16360
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
@@ -16155,7 +16363,7 @@ function bind50(liquidSwell) {
|
|
|
16155
16363
|
}
|
|
16156
16364
|
|
|
16157
16365
|
// src/liquid/filters/money_without_currency.ts
|
|
16158
|
-
function
|
|
16366
|
+
function bind53(liquidSwell) {
|
|
16159
16367
|
return function filterMoneyWithoutCurrency(value) {
|
|
16160
16368
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16161
16369
|
return liquidSwell.renderCurrency(amount).replace(/[^0-9.,]/g, "");
|
|
@@ -16163,30 +16371,45 @@ function bind51(liquidSwell) {
|
|
|
16163
16371
|
}
|
|
16164
16372
|
|
|
16165
16373
|
// src/liquid/filters/money_without_trailing_zeros.ts
|
|
16166
|
-
function
|
|
16374
|
+
function bind54(liquidSwell) {
|
|
16167
16375
|
return function filterMoneyWithoutTrailingZeros(value) {
|
|
16168
16376
|
const amount = getMoneyAmount(liquidSwell, value);
|
|
16169
16377
|
return liquidSwell.renderCurrency(amount).split(".")[0].split(",")[0];
|
|
16170
16378
|
};
|
|
16171
16379
|
}
|
|
16172
16380
|
|
|
16381
|
+
// src/liquid/filters/preload_tag.ts
|
|
16382
|
+
function bind55(_liquidSwell) {
|
|
16383
|
+
return function filterPreloadTag(assetUrl, ...params) {
|
|
16384
|
+
if (!assetUrl) {
|
|
16385
|
+
return "";
|
|
16386
|
+
}
|
|
16387
|
+
const { as } = paramsToProps(params);
|
|
16388
|
+
let attributes = "";
|
|
16389
|
+
if (typeof as === "string" && as) {
|
|
16390
|
+
attributes += `as="${as}"`;
|
|
16391
|
+
}
|
|
16392
|
+
return `<link href="${assetUrl}" rel="preload" ${attributes} />`;
|
|
16393
|
+
};
|
|
16394
|
+
}
|
|
16395
|
+
|
|
16173
16396
|
// src/liquid/filters/script_tag.ts
|
|
16174
|
-
function
|
|
16397
|
+
function bind56(_liquidSwell) {
|
|
16175
16398
|
return function filterScriptTag(assetUrl) {
|
|
16176
16399
|
return `<script src="${assetUrl}" type="text/javascript"></script>`;
|
|
16177
16400
|
};
|
|
16178
16401
|
}
|
|
16179
16402
|
|
|
16180
16403
|
// src/liquid/filters/stylesheet_tag.ts
|
|
16181
|
-
function
|
|
16404
|
+
function bind57(_liquidSwell) {
|
|
16182
16405
|
return function filterStyleSheetTag(assetUrl) {
|
|
16183
16406
|
return `<link href="${assetUrl}" rel="stylesheet" type="text/css" media="all" />`;
|
|
16184
16407
|
};
|
|
16185
16408
|
}
|
|
16186
16409
|
|
|
16187
16410
|
// src/liquid/filters/time_tag.ts
|
|
16188
|
-
function
|
|
16189
|
-
const dateFilter =
|
|
16411
|
+
function bind58(_liquidSwell) {
|
|
16412
|
+
const dateFilter = bind35(_liquidSwell);
|
|
16190
16413
|
return (dateValue, ...params) => {
|
|
16191
16414
|
const date = ensureDate(dateValue);
|
|
16192
16415
|
const formattedDate = dateFilter(dateValue, ...params);
|
|
@@ -16196,7 +16419,7 @@ function bind55(_liquidSwell) {
|
|
|
16196
16419
|
}
|
|
16197
16420
|
|
|
16198
16421
|
// src/liquid/filters/translate.ts
|
|
16199
|
-
function
|
|
16422
|
+
function bind59(liquidSwell) {
|
|
16200
16423
|
return async function filterTranslate(key, params) {
|
|
16201
16424
|
const props = params && paramsToProps(params);
|
|
16202
16425
|
const str = await liquidSwell.renderTranslation(key, props);
|
|
@@ -16205,7 +16428,7 @@ function bind56(liquidSwell) {
|
|
|
16205
16428
|
}
|
|
16206
16429
|
|
|
16207
16430
|
// src/liquid/filters/where.ts
|
|
16208
|
-
function
|
|
16431
|
+
function bind60(_liquidSwell) {
|
|
16209
16432
|
return function* filterWhere(arr, property, expected) {
|
|
16210
16433
|
const results = [];
|
|
16211
16434
|
const list = yield resolveEnumerable(arr);
|
|
@@ -16259,7 +16482,7 @@ function getSizesFromParam(param) {
|
|
|
16259
16482
|
height: height ? Number(height) : void 0
|
|
16260
16483
|
};
|
|
16261
16484
|
}
|
|
16262
|
-
function
|
|
16485
|
+
function bind61(liquidSwell) {
|
|
16263
16486
|
return async function filterAssetImgUrl(assetPath, size = "small") {
|
|
16264
16487
|
const imageUrl = await liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
|
|
16265
16488
|
const sizes = getSizesFromParam(size);
|
|
@@ -16275,14 +16498,14 @@ function bind58(liquidSwell) {
|
|
|
16275
16498
|
}
|
|
16276
16499
|
|
|
16277
16500
|
// src/liquid/filters/shopify/hex_to_rgba.ts
|
|
16278
|
-
function
|
|
16501
|
+
function bind62(_liquidSwell) {
|
|
16279
16502
|
return (color, alpha) => {
|
|
16280
16503
|
return ThemeColor.get(color).rgba(alpha || 1);
|
|
16281
16504
|
};
|
|
16282
16505
|
}
|
|
16283
16506
|
|
|
16284
16507
|
// src/liquid/filters/shopify/img_url.ts
|
|
16285
|
-
function
|
|
16508
|
+
function bind63(liquidSwell) {
|
|
16286
16509
|
return async function filterImgUrl(input, ...params) {
|
|
16287
16510
|
const url = await getImageUrlFromInput(input, liquidSwell);
|
|
16288
16511
|
if (typeof url !== "string" || url === "") {
|
|
@@ -16320,14 +16543,14 @@ var item_count_for_variant_default = {
|
|
|
16320
16543
|
};
|
|
16321
16544
|
|
|
16322
16545
|
// src/liquid/filters/shopify/payment_button.ts
|
|
16323
|
-
function
|
|
16546
|
+
function bind64(_liquidSwell) {
|
|
16324
16547
|
return (form) => {
|
|
16325
16548
|
return `<button style="display: block; visibility: hidden;"></button>`;
|
|
16326
16549
|
};
|
|
16327
16550
|
}
|
|
16328
16551
|
|
|
16329
16552
|
// src/liquid/filters/shopify/payment_terms.ts
|
|
16330
|
-
function
|
|
16553
|
+
function bind65(_liquidSwell) {
|
|
16331
16554
|
return (form) => {
|
|
16332
16555
|
return null;
|
|
16333
16556
|
};
|
|
@@ -16429,7 +16652,7 @@ var svgs = {
|
|
|
16429
16652
|
var placeholder_svgs_default = svgs;
|
|
16430
16653
|
|
|
16431
16654
|
// src/liquid/filters/shopify/placeholder_svg_tag.ts
|
|
16432
|
-
function
|
|
16655
|
+
function bind66(_liquidSwell) {
|
|
16433
16656
|
return function filterPlaceholderSvgTag(name, className) {
|
|
16434
16657
|
const svg = placeholder_svgs_default[name];
|
|
16435
16658
|
if (typeof svg === "object" && svg !== null) {
|
|
@@ -16440,7 +16663,7 @@ function bind63(_liquidSwell) {
|
|
|
16440
16663
|
}
|
|
16441
16664
|
|
|
16442
16665
|
// src/liquid/filters/shopify/shopify_asset_url.ts
|
|
16443
|
-
function
|
|
16666
|
+
function bind67(_liquidSwell) {
|
|
16444
16667
|
return function filterShopifyAssetUrl(input) {
|
|
16445
16668
|
if (typeof input === "string") {
|
|
16446
16669
|
switch (input) {
|
|
@@ -16465,7 +16688,7 @@ function bind64(_liquidSwell) {
|
|
|
16465
16688
|
}
|
|
16466
16689
|
|
|
16467
16690
|
// src/liquid/filters/shopify/structured_data.ts
|
|
16468
|
-
function
|
|
16691
|
+
function bind68(_liquidSwell) {
|
|
16469
16692
|
return async function filterStructuredData(input) {
|
|
16470
16693
|
let value = input;
|
|
16471
16694
|
if (value instanceof StorefrontResource) {
|
|
@@ -16543,7 +16766,7 @@ function convertToSchemaOrgProductGroup(product) {
|
|
|
16543
16766
|
}
|
|
16544
16767
|
|
|
16545
16768
|
// src/liquid/filters/inline_editable.ts
|
|
16546
|
-
function
|
|
16769
|
+
function bind69(_liquidSwell) {
|
|
16547
16770
|
return (value, key) => {
|
|
16548
16771
|
if (typeof value === "object" && "value" in value) {
|
|
16549
16772
|
value = value.value;
|
|
@@ -16554,64 +16777,65 @@ function bind66(_liquidSwell) {
|
|
|
16554
16777
|
|
|
16555
16778
|
// src/liquid/filters/index.ts
|
|
16556
16779
|
var filters = {
|
|
16557
|
-
asset_url:
|
|
16558
|
-
brightness_difference:
|
|
16559
|
-
color_brightness:
|
|
16560
|
-
color_contrast:
|
|
16561
|
-
color_darken:
|
|
16562
|
-
color_desaturate:
|
|
16563
|
-
color_difference:
|
|
16564
|
-
color_extract:
|
|
16565
|
-
color_lighten:
|
|
16566
|
-
color_mix:
|
|
16567
|
-
color_modify:
|
|
16568
|
-
color_saturate:
|
|
16569
|
-
color_to_hex:
|
|
16570
|
-
color_to_hsl:
|
|
16571
|
-
color_to_rgb:
|
|
16572
|
-
date_next_interval:
|
|
16573
|
-
date:
|
|
16574
|
-
default_errors:
|
|
16575
|
-
divided_by:
|
|
16576
|
-
embedded_content:
|
|
16577
|
-
escape:
|
|
16578
|
-
font_face:
|
|
16579
|
-
font_modify:
|
|
16580
|
-
font_url:
|
|
16780
|
+
asset_url: bind20,
|
|
16781
|
+
brightness_difference: bind21,
|
|
16782
|
+
color_brightness: bind22,
|
|
16783
|
+
color_contrast: bind23,
|
|
16784
|
+
color_darken: bind24,
|
|
16785
|
+
color_desaturate: bind25,
|
|
16786
|
+
color_difference: bind26,
|
|
16787
|
+
color_extract: bind27,
|
|
16788
|
+
color_lighten: bind28,
|
|
16789
|
+
color_mix: bind29,
|
|
16790
|
+
color_modify: bind30,
|
|
16791
|
+
color_saturate: bind31,
|
|
16792
|
+
color_to_hex: bind32,
|
|
16793
|
+
color_to_hsl: bind33,
|
|
16794
|
+
color_to_rgb: bind34,
|
|
16795
|
+
date_next_interval: bind36,
|
|
16796
|
+
date: bind35,
|
|
16797
|
+
default_errors: bind37,
|
|
16798
|
+
divided_by: bind38,
|
|
16799
|
+
embedded_content: bind39,
|
|
16800
|
+
escape: bind40,
|
|
16801
|
+
font_face: bind41,
|
|
16802
|
+
font_modify: bind42,
|
|
16803
|
+
font_url: bind43,
|
|
16581
16804
|
format_address: format_address_default,
|
|
16582
|
-
handle:
|
|
16805
|
+
handle: bind44,
|
|
16583
16806
|
// alias
|
|
16584
|
-
handleize:
|
|
16585
|
-
image_tag:
|
|
16807
|
+
handleize: bind44,
|
|
16808
|
+
image_tag: bind45,
|
|
16586
16809
|
image_url: image_url_default,
|
|
16587
|
-
inline_asset_content:
|
|
16588
|
-
json:
|
|
16589
|
-
json_pretty:
|
|
16590
|
-
locale_flag:
|
|
16591
|
-
minus:
|
|
16592
|
-
money:
|
|
16593
|
-
money_with_currency:
|
|
16594
|
-
money_without_currency:
|
|
16595
|
-
money_without_trailing_zeros:
|
|
16596
|
-
|
|
16597
|
-
|
|
16598
|
-
|
|
16599
|
-
|
|
16600
|
-
|
|
16810
|
+
inline_asset_content: bind46,
|
|
16811
|
+
json: bind47,
|
|
16812
|
+
json_pretty: bind48,
|
|
16813
|
+
locale_flag: bind49,
|
|
16814
|
+
minus: bind50,
|
|
16815
|
+
money: bind51,
|
|
16816
|
+
money_with_currency: bind52,
|
|
16817
|
+
money_without_currency: bind53,
|
|
16818
|
+
money_without_trailing_zeros: bind54,
|
|
16819
|
+
preload_tag: bind55,
|
|
16820
|
+
script_tag: bind56,
|
|
16821
|
+
stylesheet_tag: bind57,
|
|
16822
|
+
time_tag: bind58,
|
|
16823
|
+
translate: bind59,
|
|
16824
|
+
t: bind59,
|
|
16601
16825
|
// alias
|
|
16602
|
-
where:
|
|
16826
|
+
where: bind60,
|
|
16603
16827
|
// Shopify compatibility only
|
|
16604
|
-
asset_img_url:
|
|
16605
|
-
hex_to_rgba:
|
|
16606
|
-
img_url:
|
|
16828
|
+
asset_img_url: bind61,
|
|
16829
|
+
hex_to_rgba: bind62,
|
|
16830
|
+
img_url: bind63,
|
|
16607
16831
|
item_count_for_variant: item_count_for_variant_default,
|
|
16608
|
-
payment_button:
|
|
16609
|
-
payment_terms:
|
|
16610
|
-
placeholder_svg_tag:
|
|
16611
|
-
shopify_asset_url:
|
|
16612
|
-
structured_data:
|
|
16832
|
+
payment_button: bind64,
|
|
16833
|
+
payment_terms: bind65,
|
|
16834
|
+
placeholder_svg_tag: bind66,
|
|
16835
|
+
shopify_asset_url: bind67,
|
|
16836
|
+
structured_data: bind68,
|
|
16613
16837
|
// Swell only
|
|
16614
|
-
inline_editable:
|
|
16838
|
+
inline_editable: bind69
|
|
16615
16839
|
};
|
|
16616
16840
|
function bindFilters(liquidSwell) {
|
|
16617
16841
|
for (const [tag, handler] of Object.entries(filters)) {
|
|
@@ -16625,8 +16849,8 @@ function bindFilters(liquidSwell) {
|
|
|
16625
16849
|
}
|
|
16626
16850
|
}
|
|
16627
16851
|
}
|
|
16628
|
-
function bindWithResolvedProps(liquidSwell,
|
|
16629
|
-
const handler =
|
|
16852
|
+
function bindWithResolvedProps(liquidSwell, bind70, resolve = []) {
|
|
16853
|
+
const handler = bind70(liquidSwell);
|
|
16630
16854
|
if (!Array.isArray(resolve)) {
|
|
16631
16855
|
return handler;
|
|
16632
16856
|
}
|
|
@@ -16708,8 +16932,8 @@ function arrayEqual(lhs, rhs) {
|
|
|
16708
16932
|
|
|
16709
16933
|
// src/liquid/color.ts
|
|
16710
16934
|
import Color from "color";
|
|
16711
|
-
import { Drop as
|
|
16712
|
-
var ThemeColor = class _ThemeColor extends
|
|
16935
|
+
import { Drop as Drop16 } from "liquidjs";
|
|
16936
|
+
var ThemeColor = class _ThemeColor extends Drop16 {
|
|
16713
16937
|
color;
|
|
16714
16938
|
colorValues;
|
|
16715
16939
|
red;
|
|
@@ -16753,10 +16977,16 @@ var ThemeColor = class _ThemeColor extends Drop15 {
|
|
|
16753
16977
|
return this.color.darken(percent / 100).hex().toLowerCase();
|
|
16754
16978
|
}
|
|
16755
16979
|
rgb() {
|
|
16756
|
-
return this.
|
|
16980
|
+
return `${this.red} ${this.green} ${this.blue}`;
|
|
16757
16981
|
}
|
|
16758
16982
|
rgba(alpha) {
|
|
16759
|
-
|
|
16983
|
+
const colorValues = this.color.object();
|
|
16984
|
+
const alphaValue = alpha || colorValues.alpha;
|
|
16985
|
+
const rgb = this.rgb();
|
|
16986
|
+
if (alphaValue === void 0) {
|
|
16987
|
+
return rgb;
|
|
16988
|
+
}
|
|
16989
|
+
return `${rgb} / ${Number(alphaValue).toFixed(2)}`;
|
|
16760
16990
|
}
|
|
16761
16991
|
hsl() {
|
|
16762
16992
|
return this.color.hsl().round().toString();
|
|
@@ -16861,6 +17091,7 @@ var LiquidSwell31 = class extends Liquid3 {
|
|
|
16861
17091
|
extName;
|
|
16862
17092
|
componentsDir;
|
|
16863
17093
|
sectionsDir;
|
|
17094
|
+
blocksDir;
|
|
16864
17095
|
lastSchema;
|
|
16865
17096
|
constructor({
|
|
16866
17097
|
theme,
|
|
@@ -16878,7 +17109,8 @@ var LiquidSwell31 = class extends Liquid3 {
|
|
|
16878
17109
|
layoutName,
|
|
16879
17110
|
extName,
|
|
16880
17111
|
componentsDir,
|
|
16881
|
-
sectionsDir
|
|
17112
|
+
sectionsDir,
|
|
17113
|
+
blocksDir
|
|
16882
17114
|
}) {
|
|
16883
17115
|
getThemeConfig = getThemeConfig || theme.getThemeConfig.bind(theme);
|
|
16884
17116
|
extName = extName || "liquid";
|
|
@@ -16907,6 +17139,7 @@ var LiquidSwell31 = class extends Liquid3 {
|
|
|
16907
17139
|
this.extName = extName;
|
|
16908
17140
|
this.componentsDir = componentsDir || "components";
|
|
16909
17141
|
this.sectionsDir = sectionsDir || "sections";
|
|
17142
|
+
this.blocksDir = blocksDir || "blocks";
|
|
16910
17143
|
this.lastSchema = void 0;
|
|
16911
17144
|
bindTags(this);
|
|
16912
17145
|
bindFilters(this);
|
|
@@ -16929,6 +17162,9 @@ var LiquidSwell31 = class extends Liquid3 {
|
|
|
16929
17162
|
async getSectionGroupPath(sectionName) {
|
|
16930
17163
|
return await this.resolveFilePathByType("sections", `${sectionName}.json`) || resolveFilePath(`${this.sectionsDir}/${sectionName}`, "json");
|
|
16931
17164
|
}
|
|
17165
|
+
async getThemeBlockPath(blockName) {
|
|
17166
|
+
return await this.resolveFilePathByType("blocks", blockName) || resolveFilePath(`${this.blocksDir}/${blockName}`, this.extName);
|
|
17167
|
+
}
|
|
16932
17168
|
};
|
|
16933
17169
|
function resolveFilePath(fileName, extName) {
|
|
16934
17170
|
return `theme/${fileName}.${extName}`;
|
|
@@ -17331,8 +17567,8 @@ var ThemeLoader = class _ThemeLoader {
|
|
|
17331
17567
|
import { trimEnd } from "lodash-es";
|
|
17332
17568
|
|
|
17333
17569
|
// src/compatibility/drops/robots-rule.ts
|
|
17334
|
-
import { Drop as
|
|
17335
|
-
var RobotsRule = class _RobotsRule extends
|
|
17570
|
+
import { Drop as Drop17 } from "liquidjs";
|
|
17571
|
+
var RobotsRule = class _RobotsRule extends Drop17 {
|
|
17336
17572
|
constructor(directive, value) {
|
|
17337
17573
|
super();
|
|
17338
17574
|
this.directive = directive;
|
|
@@ -18640,6 +18876,30 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
|
|
|
18640
18876
|
const configs = this.getThemeConfigsByPath("theme/sections/");
|
|
18641
18877
|
return getAllSections(configs, this.getTemplateSchema.bind(this));
|
|
18642
18878
|
}
|
|
18879
|
+
/**
|
|
18880
|
+
* Returns all theme block schemas from /blocks folder.
|
|
18881
|
+
*/
|
|
18882
|
+
getAllThemeBlockSchemas() {
|
|
18883
|
+
const schemas = [];
|
|
18884
|
+
const configs = this.getThemeConfigsByPath("theme/blocks/");
|
|
18885
|
+
for (const config of configs.values()) {
|
|
18886
|
+
const { name, file_path: filePath, file_data: fileData } = config;
|
|
18887
|
+
const rawSchema = extractSchemaTag(fileData, true);
|
|
18888
|
+
if (!rawSchema) {
|
|
18889
|
+
continue;
|
|
18890
|
+
}
|
|
18891
|
+
try {
|
|
18892
|
+
const schema = JSON56.parse(rawSchema);
|
|
18893
|
+
if (!schema.type) {
|
|
18894
|
+
schema.type = name;
|
|
18895
|
+
}
|
|
18896
|
+
schemas.push(schema);
|
|
18897
|
+
} catch (error) {
|
|
18898
|
+
console.warn(`Invalid schema in block: ${filePath}`, error);
|
|
18899
|
+
}
|
|
18900
|
+
}
|
|
18901
|
+
return schemas;
|
|
18902
|
+
}
|
|
18643
18903
|
async getPageSections(sectionGroup, resolveSettings = true) {
|
|
18644
18904
|
const sectionConfigs = await getPageSections(
|
|
18645
18905
|
sectionGroup,
|
|
@@ -19000,14 +19260,14 @@ function parseJsonConfig(config) {
|
|
|
19000
19260
|
return {};
|
|
19001
19261
|
}
|
|
19002
19262
|
}
|
|
19003
|
-
function extractSchemaTag(template) {
|
|
19263
|
+
function extractSchemaTag(template, inner = false) {
|
|
19004
19264
|
const list = template.match(
|
|
19005
19265
|
/\{%-?\s*schema\s*-?%\}(.*)\{%-?\s*endschema\s*-?%\}/s
|
|
19006
19266
|
);
|
|
19007
19267
|
if (list === null) {
|
|
19008
19268
|
return template;
|
|
19009
19269
|
}
|
|
19010
|
-
return list[0];
|
|
19270
|
+
return inner ? list[1] : list[0];
|
|
19011
19271
|
}
|
|
19012
19272
|
function withSuffix(path, suffix) {
|
|
19013
19273
|
return suffix ? `${path}.${suffix}` : path;
|