@swell/apps-sdk 1.0.186 → 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.mjs CHANGED
@@ -3502,7 +3502,15 @@ function resolveSectionPresets(schema) {
3502
3502
  }, {}),
3503
3503
  ...preset.settings || void 0
3504
3504
  },
3505
- blocks: preset.blocks?.map((block) => {
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) => section.blocks?.[key2]).filter(Boolean);
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 || []).map((block) => {
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 set3 = blogs.results.reduce(
11558
- (set4, blog) => {
11574
+ const set4 = blogs.results.reduce(
11575
+ (set5, blog) => {
11559
11576
  for (const tag of blog.tags || []) {
11560
- set4.add(tag);
11577
+ set5.add(tag);
11561
11578
  }
11562
- return set4;
11579
+ return set5;
11563
11580
  },
11564
11581
  /* @__PURE__ */ new Set()
11565
11582
  );
11566
- return Array.from(set3.values());
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 set3 = /* @__PURE__ */ new Set();
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
- set3.add(tag);
11973
+ set4.add(tag);
11957
11974
  }
11958
11975
  }
11959
11976
  })
11960
11977
  );
11961
- return Array.from(set3.values());
11978
+ return Array.from(set4.values());
11962
11979
  }),
11963
11980
  all_types: defer(async () => {
11964
11981
  const products = await resolveProducts();
@@ -14546,6 +14563,8 @@ ${injects.join("\n")}</script>`;
14546
14563
  return `templates/${this.getPageType(name)}`;
14547
14564
  case "sections":
14548
14565
  return `sections/${name}`;
14566
+ case "blocks":
14567
+ return `blocks/${name}`;
14549
14568
  default:
14550
14569
  throw new Error(`Theme file type not supported: ${type}`);
14551
14570
  }
@@ -14895,14 +14914,161 @@ function bind3(_liquidSwell) {
14895
14914
  };
14896
14915
  }
14897
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
+
14898
15064
  // src/liquid/tags/for.ts
14899
- import { evalToken as evalToken2, ForTag as LiquidForTag } from "liquidjs";
15065
+ import { evalToken as evalToken3, ForTag as LiquidForTag } from "liquidjs";
14900
15066
  var MODIFIERS = Object.freeze(["offset", "limit", "reversed"]);
14901
- function bind4(_liquidSwell) {
15067
+ function bind6(_liquidSwell) {
14902
15068
  return class ForTag extends LiquidForTag {
14903
15069
  *render(ctx, emitter) {
14904
15070
  const r = this.liquid.renderer;
14905
- let collection = yield evalToken2(this.collection, ctx);
15071
+ let collection = yield evalToken3(this.collection, ctx);
14906
15072
  collection = yield resolveEnumerable(collection);
14907
15073
  if (!collection.length) {
14908
15074
  yield r.renderTemplates(this.elseTemplates, ctx, emitter);
@@ -14969,10 +15135,10 @@ function limit(arr, count) {
14969
15135
  }
14970
15136
 
14971
15137
  // src/liquid/tags/form.ts
14972
- import { Tag as Tag4, Hash, TypeGuards as TypeGuards2, evalToken as evalToken3 } from "liquidjs";
15138
+ import { Tag as Tag6, Hash as Hash3, TypeGuards as TypeGuards2, evalToken as evalToken4 } from "liquidjs";
14973
15139
  var IGNORED_SHOPIFY_FORMS = Object.freeze(["new_comment", "guest_login"]);
14974
- function bind5(liquidSwell) {
14975
- return class FormTag extends Tag4 {
15140
+ function bind7(liquidSwell) {
15141
+ return class FormTag extends Tag6 {
14976
15142
  formType;
14977
15143
  formConfig;
14978
15144
  templates;
@@ -14985,7 +15151,7 @@ function bind5(liquidSwell) {
14985
15151
  this.formConfig = liquidSwell.theme.getFormConfig(this.formType);
14986
15152
  this.arg = tokenizer.readValue();
14987
15153
  this.templates = [];
14988
- this.hash = new Hash(this.tokenizer.remaining());
15154
+ this.hash = new Hash3(this.tokenizer.remaining());
14989
15155
  while (remainTokens.length > 0) {
14990
15156
  const token2 = remainTokens.shift();
14991
15157
  if (TypeGuards2.isTagToken(token2) && token2.name === "endform") {
@@ -15006,7 +15172,7 @@ function bind5(liquidSwell) {
15006
15172
  return;
15007
15173
  }
15008
15174
  const r = this.liquid.renderer;
15009
- const arg = yield evalToken3(this.arg, ctx);
15175
+ const arg = yield evalToken4(this.arg, ctx);
15010
15176
  const hash = yield this.hash.render(ctx);
15011
15177
  const scope = ctx.getAll();
15012
15178
  const attrs = " " + Object.entries({ id: `${this.formConfig.id}_form`, ...hash }).reduce((acc, [key, value]) => {
@@ -15069,12 +15235,12 @@ function bind5(liquidSwell) {
15069
15235
  // src/liquid/tags/if.ts
15070
15236
  import {
15071
15237
  assert,
15072
- Tag as Tag5,
15238
+ Tag as Tag7,
15073
15239
  Value as Value3,
15074
15240
  isTruthy as isTruthy2
15075
15241
  } from "liquidjs";
15076
- function bind6(_liquidSwell) {
15077
- return class IfTag extends Tag5 {
15242
+ function bind8(_liquidSwell) {
15243
+ return class IfTag extends Tag7 {
15078
15244
  branches = [];
15079
15245
  elseTemplates;
15080
15246
  constructor(tagToken, remainTokens, liquid, parser) {
@@ -15141,9 +15307,9 @@ function assertEmpty(predicate, message = `unexpected ${JSON.stringify(predicate
15141
15307
  }
15142
15308
 
15143
15309
  // src/liquid/tags/javascript.ts
15144
- import { Tag as Tag6, TypeGuards as TypeGuards3 } from "liquidjs";
15145
- function bind7(_liquidSwell) {
15146
- return class JavascriptTag extends Tag6 {
15310
+ import { Tag as Tag8, TypeGuards as TypeGuards3 } from "liquidjs";
15311
+ function bind9(_liquidSwell) {
15312
+ return class JavascriptTag extends Tag8 {
15147
15313
  templates;
15148
15314
  constructor(token, remainTokens, liquid, parser) {
15149
15315
  super(token, remainTokens, liquid);
@@ -15168,9 +15334,9 @@ function bind7(_liquidSwell) {
15168
15334
  }
15169
15335
 
15170
15336
  // src/liquid/tags/layout.ts
15171
- import { Tag as Tag7 } from "liquidjs";
15172
- function bind8(liquidSwell) {
15173
- return class LayoutTag extends Tag7 {
15337
+ import { Tag as Tag9 } from "liquidjs";
15338
+ function bind10(liquidSwell) {
15339
+ return class LayoutTag extends Tag9 {
15174
15340
  fileName;
15175
15341
  constructor(token, remainTokens, liquid, _parser) {
15176
15342
  super(token, remainTokens, liquid);
@@ -15186,9 +15352,9 @@ function bind8(liquidSwell) {
15186
15352
  }
15187
15353
 
15188
15354
  // src/liquid/tags/paginate.ts
15189
- import { Tag as Tag8, Hash as Hash2, evalToken as evalToken4 } from "liquidjs";
15190
- function bind9(liquidSwell) {
15191
- return class PaginateTag extends Tag8 {
15355
+ import { Tag as Tag10, Hash as Hash4, evalToken as evalToken5 } from "liquidjs";
15356
+ function bind11(liquidSwell) {
15357
+ return class PaginateTag extends Tag10 {
15192
15358
  collection;
15193
15359
  pageSize;
15194
15360
  templates;
@@ -15203,7 +15369,7 @@ function bind9(liquidSwell) {
15203
15369
  }
15204
15370
  this.templates = [];
15205
15371
  this.collection = collection;
15206
- this.hash = new Hash2(this.tokenizer.remaining());
15372
+ this.hash = new Hash4(this.tokenizer.remaining());
15207
15373
  const stream = parser.parseStream(remainTokens).on("tag:endpaginate", () => stream.stop()).on("template", (tpl) => {
15208
15374
  this.templates.push(tpl);
15209
15375
  }).on("end", () => {
@@ -15213,8 +15379,8 @@ function bind9(liquidSwell) {
15213
15379
  }
15214
15380
  *render(ctx, emitter) {
15215
15381
  const r = this.liquid.renderer;
15216
- const collection = yield evalToken4(this.collection, ctx);
15217
- const pageSize = Number(yield evalToken4(this.pageSize, ctx));
15382
+ const collection = yield evalToken5(this.collection, ctx);
15383
+ const pageSize = Number(yield evalToken5(this.pageSize, ctx));
15218
15384
  const hash = yield this.hash.render(ctx);
15219
15385
  if (!Number.isNaN(pageSize) && collection instanceof SwellStorefrontCollection && collection.limit !== pageSize) {
15220
15386
  yield collection._get({
@@ -15240,9 +15406,9 @@ function bind9(liquidSwell) {
15240
15406
  }
15241
15407
 
15242
15408
  // src/liquid/tags/render.ts
15243
- import { assign } from "lodash-es";
15244
- import { assert as assert2, evalToken as evalToken5, RenderTag as LiquidRenderTag } from "liquidjs";
15245
- function bind10(liquidSwell) {
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) {
15246
15412
  return class RenderTag extends LiquidRenderTag {
15247
15413
  *render(ctx, emitter) {
15248
15414
  const self = this;
@@ -15259,17 +15425,20 @@ function bind10(liquidSwell) {
15259
15425
  );
15260
15426
  const childCtx = ctx.spawn();
15261
15427
  const scope = childCtx.bottom();
15262
- assign(scope, yield hash.render(ctx));
15428
+ assign2(scope, ctx.bottom());
15263
15429
  const parentSection = yield ctx._get(["section"]);
15264
- if (parentSection) assign(scope, { section: 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));
15265
15434
  if (self["with"]) {
15266
15435
  const { value, alias } = self["with"];
15267
15436
  const aliasName = alias || filename;
15268
- scope[aliasName] = yield evalToken5(value, ctx);
15437
+ scope[aliasName] = yield evalToken6(value, ctx);
15269
15438
  }
15270
15439
  if (self["for"]) {
15271
15440
  const { value, alias } = self["for"];
15272
- let collection = yield evalToken5(value, ctx);
15441
+ let collection = yield evalToken6(value, ctx);
15273
15442
  collection = yield resolveEnumerable(collection);
15274
15443
  scope["forloop"] = new ForloopDrop(
15275
15444
  collection.length,
@@ -15312,13 +15481,13 @@ function* renderFilePath(file, ctx, liquid) {
15312
15481
  default:
15313
15482
  break;
15314
15483
  }
15315
- return yield evalToken5(file, ctx);
15484
+ return yield evalToken6(file, ctx);
15316
15485
  }
15317
15486
 
15318
15487
  // src/liquid/tags/section.ts
15319
- import { Tag as Tag9 } from "liquidjs";
15320
- function bind11(liquidSwell) {
15321
- return class SectionTag extends Tag9 {
15488
+ import { Tag as Tag11 } from "liquidjs";
15489
+ function bind13(liquidSwell) {
15490
+ return class SectionTag extends Tag11 {
15322
15491
  fileName;
15323
15492
  constructor(token, remainTokens, liquid, _parser) {
15324
15493
  super(token, remainTokens, liquid);
@@ -15369,10 +15538,10 @@ function bind11(liquidSwell) {
15369
15538
  }
15370
15539
 
15371
15540
  // src/liquid/tags/sections.ts
15372
- import { Tag as Tag10 } from "liquidjs";
15541
+ import { Tag as Tag12 } from "liquidjs";
15373
15542
  import JSON54 from "json5";
15374
- function bind12(liquidSwell) {
15375
- return class SectionsTag extends Tag10 {
15543
+ function bind14(liquidSwell) {
15544
+ return class SectionsTag extends Tag12 {
15376
15545
  fileName;
15377
15546
  constructor(token, remainTokens, liquid, _parser) {
15378
15547
  super(token, remainTokens, liquid);
@@ -15412,9 +15581,9 @@ function bind12(liquidSwell) {
15412
15581
  }
15413
15582
 
15414
15583
  // src/liquid/tags/style.ts
15415
- import { Tag as Tag11, TypeGuards as TypeGuards4 } from "liquidjs";
15416
- function bind13(_liquidSwell) {
15417
- return class StyleTag extends Tag11 {
15584
+ import { Tag as Tag13, TypeGuards as TypeGuards4 } from "liquidjs";
15585
+ function bind15(_liquidSwell) {
15586
+ return class StyleTag extends Tag13 {
15418
15587
  templates;
15419
15588
  hash;
15420
15589
  constructor(token, remainTokens, liquid, parser) {
@@ -15446,9 +15615,9 @@ function bind13(_liquidSwell) {
15446
15615
  }
15447
15616
 
15448
15617
  // src/liquid/tags/stylesheet.ts
15449
- import { Tag as Tag12, TypeGuards as TypeGuards5 } from "liquidjs";
15450
- function bind14(_liquidSwell) {
15451
- return class StyleSheetTag extends Tag12 {
15618
+ import { Tag as Tag14, TypeGuards as TypeGuards5 } from "liquidjs";
15619
+ function bind16(_liquidSwell) {
15620
+ return class StyleSheetTag extends Tag14 {
15452
15621
  templates;
15453
15622
  constructor(token, remainTokens, liquid, parser) {
15454
15623
  super(token, remainTokens, liquid);
@@ -15471,8 +15640,8 @@ function bind14(_liquidSwell) {
15471
15640
  }
15472
15641
 
15473
15642
  // src/liquid/tags/shopify/include.ts
15474
- import { assert as assert3, evalToken as evalToken6, IncludeTag as LiquidIncludeTag } from "liquidjs";
15475
- function bind15(liquidSwell) {
15643
+ import { assert as assert3, evalToken as evalToken7, IncludeTag as LiquidIncludeTag } from "liquidjs";
15644
+ function bind17(liquidSwell) {
15476
15645
  return class IncludeTag extends LiquidIncludeTag {
15477
15646
  *render(ctx, emitter) {
15478
15647
  const { hash } = this;
@@ -15487,7 +15656,7 @@ function bind15(liquidSwell) {
15487
15656
  ctx.setRegister("blockMode", 0);
15488
15657
  const scope = yield hash.render(ctx);
15489
15658
  if (this.withVar) {
15490
- scope[filepath] = yield evalToken6(this.withVar, ctx);
15659
+ scope[filepath] = yield evalToken7(this.withVar, ctx);
15491
15660
  }
15492
15661
  ctx.push(ctx.opts.jekyllInclude ? { include: scope } : scope);
15493
15662
  const output = yield liquidSwell.getComponentPath(filepath).then((path) => liquidSwell.getThemeConfig(path)).then((themeConfig) => liquidSwell.renderTemplate(themeConfig, ctx));
@@ -15499,10 +15668,10 @@ function bind15(liquidSwell) {
15499
15668
  }
15500
15669
 
15501
15670
  // src/liquid/tags/shopify/schema.ts
15502
- import { Tag as Tag13 } from "liquidjs";
15671
+ import { Tag as Tag15 } from "liquidjs";
15503
15672
  import JSON55 from "json5";
15504
- function bind16(liquidSwell) {
15505
- return class SchemaTag extends Tag13 {
15673
+ function bind18(liquidSwell) {
15674
+ return class SchemaTag extends Tag15 {
15506
15675
  templates;
15507
15676
  constructor(token, remainTokens, liquid, parser) {
15508
15677
  super(token, remainTokens, liquid);
@@ -15524,6 +15693,7 @@ function bind16(liquidSwell) {
15524
15693
  liquidSwell.lastSchema = void 0;
15525
15694
  if (typeof jsonOutput === "string") {
15526
15695
  liquidSwell.lastSchema = JSON55.parse(jsonOutput);
15696
+ expandThemeBlocks(liquidSwell);
15527
15697
  }
15528
15698
  } catch (err) {
15529
15699
  console.warn(err);
@@ -15533,11 +15703,22 @@ function bind16(liquidSwell) {
15533
15703
  }
15534
15704
  };
15535
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
+ }
15536
15717
 
15537
15718
  // src/liquid/tags/inline_editable.ts
15538
- import { Tag as Tag14 } from "liquidjs";
15539
- function bind17(_liquidSwell) {
15540
- return class InlineEditableTag extends Tag14 {
15719
+ import { Tag as Tag16 } from "liquidjs";
15720
+ function bind19(_liquidSwell) {
15721
+ return class InlineEditableTag extends Tag16 {
15541
15722
  key;
15542
15723
  value;
15543
15724
  constructor(token, remainTokens, liquid, _parser) {
@@ -15565,129 +15746,131 @@ var tags = {
15565
15746
  assign: bind,
15566
15747
  case: bind2,
15567
15748
  comment: bind3,
15568
- for: bind4,
15569
- form: bind5,
15570
- if: bind6,
15571
- javascript: bind7,
15572
- layout: bind8,
15573
- paginate: bind9,
15574
- render: bind10,
15575
- section: bind11,
15576
- sections: bind12,
15577
- style: bind13,
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,
15578
15761
  // Shopify compatibility only
15579
- include: bind15,
15580
- schema: bind16,
15581
- stylesheet: bind14,
15762
+ include: bind17,
15763
+ schema: bind18,
15764
+ stylesheet: bind16,
15582
15765
  // Swell only
15583
- inline_editable: bind17
15766
+ inline_editable: bind19
15584
15767
  };
15585
15768
  function bindTags(liquidSwell) {
15586
15769
  Object.entries(tags).forEach(
15587
- ([tag, bind67]) => liquidSwell.registerTag(tag, bind67(liquidSwell))
15770
+ ([tag, bind70]) => liquidSwell.registerTag(tag, bind70(liquidSwell))
15588
15771
  );
15589
15772
  }
15590
15773
 
15591
15774
  // src/liquid/filters/asset_url.ts
15592
- function bind18(liquidSwell) {
15775
+ function bind20(liquidSwell) {
15593
15776
  return function filterAssetUrl(assetPath) {
15594
15777
  return liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
15595
15778
  };
15596
15779
  }
15597
15780
 
15598
15781
  // src/liquid/filters/brightness_difference.ts
15599
- function bind19(_liquidSwell) {
15782
+ function bind21(_liquidSwell) {
15600
15783
  return (color1, color2) => {
15601
15784
  return ThemeColor.get(color1).brightnessDifference(ThemeColor.get(color2));
15602
15785
  };
15603
15786
  }
15604
15787
 
15605
15788
  // src/liquid/filters/color_brightness.ts
15606
- function bind20(_liquidSwell) {
15789
+ function bind22(_liquidSwell) {
15607
15790
  return (color) => {
15608
15791
  return ThemeColor.get(color).brightness();
15609
15792
  };
15610
15793
  }
15611
15794
 
15612
15795
  // src/liquid/filters/color_contrast.ts
15613
- function bind21(_liquidSwell) {
15796
+ function bind23(_liquidSwell) {
15614
15797
  return (color1, color2) => {
15615
15798
  return ThemeColor.get(color1).contrast(ThemeColor.get(color2));
15616
15799
  };
15617
15800
  }
15618
15801
 
15619
15802
  // src/liquid/filters/color_darken.ts
15620
- function bind22(_liquidSwell) {
15803
+ function bind24(_liquidSwell) {
15621
15804
  return (color, percent) => {
15622
15805
  return ThemeColor.get(color).darken(percent);
15623
15806
  };
15624
15807
  }
15625
15808
 
15626
15809
  // src/liquid/filters/color_desaturate.ts
15627
- function bind23(_liquidSwell) {
15810
+ function bind25(_liquidSwell) {
15628
15811
  return (color, value) => {
15629
15812
  return ThemeColor.get(color).desaturate(value);
15630
15813
  };
15631
15814
  }
15632
15815
 
15633
15816
  // src/liquid/filters/color_difference.ts
15634
- function bind24(_liquidSwell) {
15817
+ function bind26(_liquidSwell) {
15635
15818
  return (color1, color2) => {
15636
15819
  return ThemeColor.get(color1).difference(ThemeColor.get(color2));
15637
15820
  };
15638
15821
  }
15639
15822
 
15640
15823
  // src/liquid/filters/color_extract.ts
15641
- function bind25(_liquidSwell) {
15824
+ function bind27(_liquidSwell) {
15642
15825
  return (color, field) => {
15643
15826
  return ThemeColor.get(color).extract(field);
15644
15827
  };
15645
15828
  }
15646
15829
 
15647
15830
  // src/liquid/filters/color_lighten.ts
15648
- function bind26(_liquidSwell) {
15831
+ function bind28(_liquidSwell) {
15649
15832
  return (color, percent) => {
15650
15833
  return ThemeColor.get(color).lighten(percent);
15651
15834
  };
15652
15835
  }
15653
15836
 
15654
15837
  // src/liquid/filters/color_mix.ts
15655
- function bind27(_liquidSwell) {
15838
+ function bind29(_liquidSwell) {
15656
15839
  return (color1, color2, ratio) => {
15657
15840
  return ThemeColor.get(color1).mix(ThemeColor.get(color2), ratio);
15658
15841
  };
15659
15842
  }
15660
15843
 
15661
15844
  // src/liquid/filters/color_modify.ts
15662
- function bind28(_liquidSwell) {
15845
+ function bind30(_liquidSwell) {
15663
15846
  return function filterColorModify(color, field, value) {
15664
15847
  return ThemeColor.get(color).modify(field, Number(value) || 0);
15665
15848
  };
15666
15849
  }
15667
15850
 
15668
15851
  // src/liquid/filters/color_saturate.ts
15669
- function bind29(_liquidSwell) {
15852
+ function bind31(_liquidSwell) {
15670
15853
  return (color, value) => {
15671
15854
  return ThemeColor.get(color).saturate(value);
15672
15855
  };
15673
15856
  }
15674
15857
 
15675
15858
  // src/liquid/filters/color_to_hex.ts
15676
- function bind30(_liquidSwell) {
15859
+ function bind32(_liquidSwell) {
15677
15860
  return (color) => {
15678
15861
  return ThemeColor.get(color).hex();
15679
15862
  };
15680
15863
  }
15681
15864
 
15682
15865
  // src/liquid/filters/color_to_hsl.ts
15683
- function bind31(_liquidSwell) {
15866
+ function bind33(_liquidSwell) {
15684
15867
  return (color) => {
15685
15868
  return ThemeColor.get(color).hsl();
15686
15869
  };
15687
15870
  }
15688
15871
 
15689
15872
  // src/liquid/filters/color_to_rgb.ts
15690
- function bind32(_liquidSwell) {
15873
+ function bind34(_liquidSwell) {
15691
15874
  return (color, alpha) => {
15692
15875
  return alpha !== void 0 ? ThemeColor.get(color).rgba(alpha) : ThemeColor.get(color).rgb();
15693
15876
  };
@@ -15695,7 +15878,7 @@ function bind32(_liquidSwell) {
15695
15878
 
15696
15879
  // src/liquid/filters/date.ts
15697
15880
  import strftime from "strftime";
15698
- function bind33(_liquidSwell) {
15881
+ function bind35(_liquidSwell) {
15699
15882
  return (dateValue, ...params) => {
15700
15883
  const date = ensureDate(dateValue);
15701
15884
  const { format } = getDateFilterParams(params);
@@ -15753,7 +15936,7 @@ function applyStrftimeFormat(format, date) {
15753
15936
  }
15754
15937
 
15755
15938
  // src/liquid/filters/date_next_interval.ts
15756
- function bind34(_liquidSwell) {
15939
+ function bind36(_liquidSwell) {
15757
15940
  return (dateValue, interval, intervalCount) => {
15758
15941
  const date = ensureDate(dateValue);
15759
15942
  const result = getNextIntervalDate(date, interval, Number(intervalCount));
@@ -15805,7 +15988,7 @@ function time(date) {
15805
15988
  }
15806
15989
 
15807
15990
  // src/liquid/filters/default_errors.ts
15808
- function bind35(_liquidSwell) {
15991
+ function bind37(_liquidSwell) {
15809
15992
  return async function filterDefaultError(errors) {
15810
15993
  if (!errors) {
15811
15994
  return "";
@@ -15831,7 +16014,7 @@ function bind35(_liquidSwell) {
15831
16014
  }
15832
16015
 
15833
16016
  // src/liquid/filters/divided_by.ts
15834
- function bind36(_liquidSwell) {
16017
+ function bind38(_liquidSwell) {
15835
16018
  return (dividend, divisor, integerArithmetic) => {
15836
16019
  if (!isNumber(dividend) || !isNumber(divisor)) {
15837
16020
  return dividend;
@@ -15842,7 +16025,7 @@ function bind36(_liquidSwell) {
15842
16025
 
15843
16026
  // src/liquid/filters/embedded_content.ts
15844
16027
  import { unescape } from "lodash-es";
15845
- function bind37(_liquidSwell) {
16028
+ function bind39(_liquidSwell) {
15846
16029
  return (value, tag = "iframe") => {
15847
16030
  const escapeIframes = value.replaceAll(`<${tag}`, `&lt;${tag}`).replaceAll(`</${tag}`, `&lt;/${tag}`);
15848
16031
  const removeTags = escapeIframes.replaceAll(/<(.*?)>/gi, "");
@@ -15854,7 +16037,7 @@ function bind37(_liquidSwell) {
15854
16037
 
15855
16038
  // src/liquid/filters/escape.ts
15856
16039
  import { escape } from "lodash-es";
15857
- function bind38(_liquidSwell) {
16040
+ function bind40(_liquidSwell) {
15858
16041
  return function escapeTag(input) {
15859
16042
  if (!input?.startsWith) {
15860
16043
  return input;
@@ -15867,7 +16050,7 @@ function bind38(_liquidSwell) {
15867
16050
  }
15868
16051
 
15869
16052
  // src/liquid/filters/font_face.ts
15870
- function bind39(_liquidSwell) {
16053
+ function bind41(_liquidSwell) {
15871
16054
  return (fontSetting, ...params) => {
15872
16055
  if (!fontSetting) {
15873
16056
  return null;
@@ -15879,14 +16062,14 @@ function bind39(_liquidSwell) {
15879
16062
  }
15880
16063
 
15881
16064
  // src/liquid/filters/font_modify.ts
15882
- function bind40(_liquidSwell) {
16065
+ function bind42(_liquidSwell) {
15883
16066
  return (fontSetting, prop, value) => {
15884
16067
  return ThemeFont.clone(fontSetting).modify(prop, value);
15885
16068
  };
15886
16069
  }
15887
16070
 
15888
16071
  // src/liquid/filters/font_url.ts
15889
- function bind41(_liquidSwell) {
16072
+ function bind43(_liquidSwell) {
15890
16073
  return (fontSetting) => {
15891
16074
  return ThemeFont.get(fontSetting).url();
15892
16075
  };
@@ -15936,14 +16119,14 @@ var format_address_default = {
15936
16119
 
15937
16120
  // src/liquid/filters/handleize.ts
15938
16121
  import { kebabCase } from "lodash-es";
15939
- function bind42(_liquidSwell) {
16122
+ function bind44(_liquidSwell) {
15940
16123
  return function filterHandleize(handle) {
15941
16124
  return kebabCase(handle);
15942
16125
  };
15943
16126
  }
15944
16127
 
15945
16128
  // src/liquid/filters/image_tag.ts
15946
- function bind43(_liquidSwell) {
16129
+ function bind45(_liquidSwell) {
15947
16130
  return function filterImageTag(imageUrl, ...params) {
15948
16131
  imageUrl = String(imageUrl || "");
15949
16132
  let {
@@ -16107,7 +16290,7 @@ var filterDefinition = {
16107
16290
  var image_url_default = filterDefinition;
16108
16291
 
16109
16292
  // src/liquid/filters/inline_asset_content.ts
16110
- function bind44(liquidSwell) {
16293
+ function bind46(liquidSwell) {
16111
16294
  return async (assetPath) => {
16112
16295
  const config = await liquidSwell.theme.getThemeConfig(
16113
16296
  `theme/assets/${assetPath}`
@@ -16117,14 +16300,14 @@ function bind44(liquidSwell) {
16117
16300
  }
16118
16301
 
16119
16302
  // src/liquid/filters/json.ts
16120
- function bind45(_liquidSwell) {
16303
+ function bind47(_liquidSwell) {
16121
16304
  return async function filterJson(input, space = 0) {
16122
16305
  return jsonStringifyAsync(input, space);
16123
16306
  };
16124
16307
  }
16125
16308
 
16126
16309
  // src/liquid/filters/json_pretty.ts
16127
- function bind46(_liquidSwell) {
16310
+ function bind48(_liquidSwell) {
16128
16311
  return async function filterJsonPretty(input, space = 2) {
16129
16312
  const output = await jsonStringifyAsync(input, space);
16130
16313
  return `<pre>${output}</pre>`;
@@ -16134,7 +16317,7 @@ function bind46(_liquidSwell) {
16134
16317
  // src/liquid/filters/locale_flag.ts
16135
16318
  import { hasFlag } from "country-flag-icons";
16136
16319
  import * as flags from "country-flag-icons/string/1x1";
16137
- function bind47(_liquidSwell) {
16320
+ function bind49(_liquidSwell) {
16138
16321
  return (localeCode) => {
16139
16322
  if (typeof localeCode !== "string") {
16140
16323
  return flags.US;
@@ -16145,7 +16328,7 @@ function bind47(_liquidSwell) {
16145
16328
  }
16146
16329
 
16147
16330
  // src/liquid/filters/minus.ts
16148
- function bind48(_liquidSwell) {
16331
+ function bind50(_liquidSwell) {
16149
16332
  return (first, second) => {
16150
16333
  const firstValue = isNumber(first) ? first : 0;
16151
16334
  const secondValue = isNumber(second) ? second : 0;
@@ -16154,7 +16337,7 @@ function bind48(_liquidSwell) {
16154
16337
  }
16155
16338
 
16156
16339
  // src/liquid/filters/money.ts
16157
- function bind49(liquidSwell) {
16340
+ function bind51(liquidSwell) {
16158
16341
  return function filterMoney(value) {
16159
16342
  const amount = getMoneyAmount(liquidSwell, value);
16160
16343
  return liquidSwell.renderCurrency(amount);
@@ -16171,7 +16354,7 @@ function getMoneyAmount(liquidSwell, value) {
16171
16354
  }
16172
16355
 
16173
16356
  // src/liquid/filters/money_with_currency.ts
16174
- function bind50(liquidSwell) {
16357
+ function bind52(liquidSwell) {
16175
16358
  return function filterMoneyWithCurrency(value) {
16176
16359
  const { currency } = liquidSwell.theme.swell.getStorefrontLocalization();
16177
16360
  const amount = getMoneyAmount(liquidSwell, value);
@@ -16180,7 +16363,7 @@ function bind50(liquidSwell) {
16180
16363
  }
16181
16364
 
16182
16365
  // src/liquid/filters/money_without_currency.ts
16183
- function bind51(liquidSwell) {
16366
+ function bind53(liquidSwell) {
16184
16367
  return function filterMoneyWithoutCurrency(value) {
16185
16368
  const amount = getMoneyAmount(liquidSwell, value);
16186
16369
  return liquidSwell.renderCurrency(amount).replace(/[^0-9.,]/g, "");
@@ -16188,30 +16371,45 @@ function bind51(liquidSwell) {
16188
16371
  }
16189
16372
 
16190
16373
  // src/liquid/filters/money_without_trailing_zeros.ts
16191
- function bind52(liquidSwell) {
16374
+ function bind54(liquidSwell) {
16192
16375
  return function filterMoneyWithoutTrailingZeros(value) {
16193
16376
  const amount = getMoneyAmount(liquidSwell, value);
16194
16377
  return liquidSwell.renderCurrency(amount).split(".")[0].split(",")[0];
16195
16378
  };
16196
16379
  }
16197
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
+
16198
16396
  // src/liquid/filters/script_tag.ts
16199
- function bind53(_liquidSwell) {
16397
+ function bind56(_liquidSwell) {
16200
16398
  return function filterScriptTag(assetUrl) {
16201
16399
  return `<script src="${assetUrl}" type="text/javascript"></script>`;
16202
16400
  };
16203
16401
  }
16204
16402
 
16205
16403
  // src/liquid/filters/stylesheet_tag.ts
16206
- function bind54(_liquidSwell) {
16404
+ function bind57(_liquidSwell) {
16207
16405
  return function filterStyleSheetTag(assetUrl) {
16208
16406
  return `<link href="${assetUrl}" rel="stylesheet" type="text/css" media="all" />`;
16209
16407
  };
16210
16408
  }
16211
16409
 
16212
16410
  // src/liquid/filters/time_tag.ts
16213
- function bind55(_liquidSwell) {
16214
- const dateFilter = bind33(_liquidSwell);
16411
+ function bind58(_liquidSwell) {
16412
+ const dateFilter = bind35(_liquidSwell);
16215
16413
  return (dateValue, ...params) => {
16216
16414
  const date = ensureDate(dateValue);
16217
16415
  const formattedDate = dateFilter(dateValue, ...params);
@@ -16221,7 +16419,7 @@ function bind55(_liquidSwell) {
16221
16419
  }
16222
16420
 
16223
16421
  // src/liquid/filters/translate.ts
16224
- function bind56(liquidSwell) {
16422
+ function bind59(liquidSwell) {
16225
16423
  return async function filterTranslate(key, params) {
16226
16424
  const props = params && paramsToProps(params);
16227
16425
  const str = await liquidSwell.renderTranslation(key, props);
@@ -16230,7 +16428,7 @@ function bind56(liquidSwell) {
16230
16428
  }
16231
16429
 
16232
16430
  // src/liquid/filters/where.ts
16233
- function bind57(_liquidSwell) {
16431
+ function bind60(_liquidSwell) {
16234
16432
  return function* filterWhere(arr, property, expected) {
16235
16433
  const results = [];
16236
16434
  const list = yield resolveEnumerable(arr);
@@ -16284,7 +16482,7 @@ function getSizesFromParam(param) {
16284
16482
  height: height ? Number(height) : void 0
16285
16483
  };
16286
16484
  }
16287
- function bind58(liquidSwell) {
16485
+ function bind61(liquidSwell) {
16288
16486
  return async function filterAssetImgUrl(assetPath, size = "small") {
16289
16487
  const imageUrl = await liquidSwell.getAssetUrl(assetPath).then((url) => url || "");
16290
16488
  const sizes = getSizesFromParam(size);
@@ -16300,14 +16498,14 @@ function bind58(liquidSwell) {
16300
16498
  }
16301
16499
 
16302
16500
  // src/liquid/filters/shopify/hex_to_rgba.ts
16303
- function bind59(_liquidSwell) {
16501
+ function bind62(_liquidSwell) {
16304
16502
  return (color, alpha) => {
16305
16503
  return ThemeColor.get(color).rgba(alpha || 1);
16306
16504
  };
16307
16505
  }
16308
16506
 
16309
16507
  // src/liquid/filters/shopify/img_url.ts
16310
- function bind60(liquidSwell) {
16508
+ function bind63(liquidSwell) {
16311
16509
  return async function filterImgUrl(input, ...params) {
16312
16510
  const url = await getImageUrlFromInput(input, liquidSwell);
16313
16511
  if (typeof url !== "string" || url === "") {
@@ -16345,14 +16543,14 @@ var item_count_for_variant_default = {
16345
16543
  };
16346
16544
 
16347
16545
  // src/liquid/filters/shopify/payment_button.ts
16348
- function bind61(_liquidSwell) {
16546
+ function bind64(_liquidSwell) {
16349
16547
  return (form) => {
16350
16548
  return `<button style="display: block; visibility: hidden;"></button>`;
16351
16549
  };
16352
16550
  }
16353
16551
 
16354
16552
  // src/liquid/filters/shopify/payment_terms.ts
16355
- function bind62(_liquidSwell) {
16553
+ function bind65(_liquidSwell) {
16356
16554
  return (form) => {
16357
16555
  return null;
16358
16556
  };
@@ -16454,7 +16652,7 @@ var svgs = {
16454
16652
  var placeholder_svgs_default = svgs;
16455
16653
 
16456
16654
  // src/liquid/filters/shopify/placeholder_svg_tag.ts
16457
- function bind63(_liquidSwell) {
16655
+ function bind66(_liquidSwell) {
16458
16656
  return function filterPlaceholderSvgTag(name, className) {
16459
16657
  const svg = placeholder_svgs_default[name];
16460
16658
  if (typeof svg === "object" && svg !== null) {
@@ -16465,7 +16663,7 @@ function bind63(_liquidSwell) {
16465
16663
  }
16466
16664
 
16467
16665
  // src/liquid/filters/shopify/shopify_asset_url.ts
16468
- function bind64(_liquidSwell) {
16666
+ function bind67(_liquidSwell) {
16469
16667
  return function filterShopifyAssetUrl(input) {
16470
16668
  if (typeof input === "string") {
16471
16669
  switch (input) {
@@ -16490,7 +16688,7 @@ function bind64(_liquidSwell) {
16490
16688
  }
16491
16689
 
16492
16690
  // src/liquid/filters/shopify/structured_data.ts
16493
- function bind65(_liquidSwell) {
16691
+ function bind68(_liquidSwell) {
16494
16692
  return async function filterStructuredData(input) {
16495
16693
  let value = input;
16496
16694
  if (value instanceof StorefrontResource) {
@@ -16568,7 +16766,7 @@ function convertToSchemaOrgProductGroup(product) {
16568
16766
  }
16569
16767
 
16570
16768
  // src/liquid/filters/inline_editable.ts
16571
- function bind66(_liquidSwell) {
16769
+ function bind69(_liquidSwell) {
16572
16770
  return (value, key) => {
16573
16771
  if (typeof value === "object" && "value" in value) {
16574
16772
  value = value.value;
@@ -16579,64 +16777,65 @@ function bind66(_liquidSwell) {
16579
16777
 
16580
16778
  // src/liquid/filters/index.ts
16581
16779
  var filters = {
16582
- asset_url: bind18,
16583
- brightness_difference: bind19,
16584
- color_brightness: bind20,
16585
- color_contrast: bind21,
16586
- color_darken: bind22,
16587
- color_desaturate: bind23,
16588
- color_difference: bind24,
16589
- color_extract: bind25,
16590
- color_lighten: bind26,
16591
- color_mix: bind27,
16592
- color_modify: bind28,
16593
- color_saturate: bind29,
16594
- color_to_hex: bind30,
16595
- color_to_hsl: bind31,
16596
- color_to_rgb: bind32,
16597
- date_next_interval: bind34,
16598
- date: bind33,
16599
- default_errors: bind35,
16600
- divided_by: bind36,
16601
- embedded_content: bind37,
16602
- escape: bind38,
16603
- font_face: bind39,
16604
- font_modify: bind40,
16605
- font_url: bind41,
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,
16606
16804
  format_address: format_address_default,
16607
- handle: bind42,
16805
+ handle: bind44,
16608
16806
  // alias
16609
- handleize: bind42,
16610
- image_tag: bind43,
16807
+ handleize: bind44,
16808
+ image_tag: bind45,
16611
16809
  image_url: image_url_default,
16612
- inline_asset_content: bind44,
16613
- json: bind45,
16614
- json_pretty: bind46,
16615
- locale_flag: bind47,
16616
- minus: bind48,
16617
- money: bind49,
16618
- money_with_currency: bind50,
16619
- money_without_currency: bind51,
16620
- money_without_trailing_zeros: bind52,
16621
- script_tag: bind53,
16622
- stylesheet_tag: bind54,
16623
- time_tag: bind55,
16624
- translate: bind56,
16625
- t: bind56,
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,
16626
16825
  // alias
16627
- where: bind57,
16826
+ where: bind60,
16628
16827
  // Shopify compatibility only
16629
- asset_img_url: bind58,
16630
- hex_to_rgba: bind59,
16631
- img_url: bind60,
16828
+ asset_img_url: bind61,
16829
+ hex_to_rgba: bind62,
16830
+ img_url: bind63,
16632
16831
  item_count_for_variant: item_count_for_variant_default,
16633
- payment_button: bind61,
16634
- payment_terms: bind62,
16635
- placeholder_svg_tag: bind63,
16636
- shopify_asset_url: bind64,
16637
- structured_data: bind65,
16832
+ payment_button: bind64,
16833
+ payment_terms: bind65,
16834
+ placeholder_svg_tag: bind66,
16835
+ shopify_asset_url: bind67,
16836
+ structured_data: bind68,
16638
16837
  // Swell only
16639
- inline_editable: bind66
16838
+ inline_editable: bind69
16640
16839
  };
16641
16840
  function bindFilters(liquidSwell) {
16642
16841
  for (const [tag, handler] of Object.entries(filters)) {
@@ -16650,8 +16849,8 @@ function bindFilters(liquidSwell) {
16650
16849
  }
16651
16850
  }
16652
16851
  }
16653
- function bindWithResolvedProps(liquidSwell, bind67, resolve = []) {
16654
- const handler = bind67(liquidSwell);
16852
+ function bindWithResolvedProps(liquidSwell, bind70, resolve = []) {
16853
+ const handler = bind70(liquidSwell);
16655
16854
  if (!Array.isArray(resolve)) {
16656
16855
  return handler;
16657
16856
  }
@@ -16778,10 +16977,16 @@ var ThemeColor = class _ThemeColor extends Drop16 {
16778
16977
  return this.color.darken(percent / 100).hex().toLowerCase();
16779
16978
  }
16780
16979
  rgb() {
16781
- return this.color.rgb().toString();
16980
+ return `${this.red} ${this.green} ${this.blue}`;
16782
16981
  }
16783
16982
  rgba(alpha) {
16784
- return this.color.alpha(alpha).rgb().toString();
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)}`;
16785
16990
  }
16786
16991
  hsl() {
16787
16992
  return this.color.hsl().round().toString();
@@ -16886,6 +17091,7 @@ var LiquidSwell31 = class extends Liquid3 {
16886
17091
  extName;
16887
17092
  componentsDir;
16888
17093
  sectionsDir;
17094
+ blocksDir;
16889
17095
  lastSchema;
16890
17096
  constructor({
16891
17097
  theme,
@@ -16903,7 +17109,8 @@ var LiquidSwell31 = class extends Liquid3 {
16903
17109
  layoutName,
16904
17110
  extName,
16905
17111
  componentsDir,
16906
- sectionsDir
17112
+ sectionsDir,
17113
+ blocksDir
16907
17114
  }) {
16908
17115
  getThemeConfig = getThemeConfig || theme.getThemeConfig.bind(theme);
16909
17116
  extName = extName || "liquid";
@@ -16932,6 +17139,7 @@ var LiquidSwell31 = class extends Liquid3 {
16932
17139
  this.extName = extName;
16933
17140
  this.componentsDir = componentsDir || "components";
16934
17141
  this.sectionsDir = sectionsDir || "sections";
17142
+ this.blocksDir = blocksDir || "blocks";
16935
17143
  this.lastSchema = void 0;
16936
17144
  bindTags(this);
16937
17145
  bindFilters(this);
@@ -16954,6 +17162,9 @@ var LiquidSwell31 = class extends Liquid3 {
16954
17162
  async getSectionGroupPath(sectionName) {
16955
17163
  return await this.resolveFilePathByType("sections", `${sectionName}.json`) || resolveFilePath(`${this.sectionsDir}/${sectionName}`, "json");
16956
17164
  }
17165
+ async getThemeBlockPath(blockName) {
17166
+ return await this.resolveFilePathByType("blocks", blockName) || resolveFilePath(`${this.blocksDir}/${blockName}`, this.extName);
17167
+ }
16957
17168
  };
16958
17169
  function resolveFilePath(fileName, extName) {
16959
17170
  return `theme/${fileName}.${extName}`;
@@ -18665,6 +18876,30 @@ ${this.shopifyCompatibility.getContentForHeader()}`;
18665
18876
  const configs = this.getThemeConfigsByPath("theme/sections/");
18666
18877
  return getAllSections(configs, this.getTemplateSchema.bind(this));
18667
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
+ }
18668
18903
  async getPageSections(sectionGroup, resolveSettings = true) {
18669
18904
  const sectionConfigs = await getPageSections(
18670
18905
  sectionGroup,
@@ -19025,14 +19260,14 @@ function parseJsonConfig(config) {
19025
19260
  return {};
19026
19261
  }
19027
19262
  }
19028
- function extractSchemaTag(template) {
19263
+ function extractSchemaTag(template, inner = false) {
19029
19264
  const list = template.match(
19030
19265
  /\{%-?\s*schema\s*-?%\}(.*)\{%-?\s*endschema\s*-?%\}/s
19031
19266
  );
19032
19267
  if (list === null) {
19033
19268
  return template;
19034
19269
  }
19035
- return list[0];
19270
+ return inner ? list[1] : list[0];
19036
19271
  }
19037
19272
  function withSuffix(path, suffix) {
19038
19273
  return suffix ? `${path}.${suffix}` : path;