@augeo/smelt 1.2.2

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.
Files changed (152) hide show
  1. package/.claude/settings.json +11 -0
  2. package/.github/workflows/verify.yml +64 -0
  3. package/.gitmodules +3 -0
  4. package/.prettierignore +25 -0
  5. package/.prettierrc.cjs +9 -0
  6. package/.zed/settings.json +21 -0
  7. package/AGENTS.md +232 -0
  8. package/LICENSE +21 -0
  9. package/README.md +266 -0
  10. package/biome.json +58 -0
  11. package/dist/cli.d.mts +1 -0
  12. package/dist/cli.mjs +350 -0
  13. package/dist/schema.d.mts +265 -0
  14. package/dist/schema.mjs +21 -0
  15. package/docs/TESTING.md +293 -0
  16. package/docs/assets-plan.md +197 -0
  17. package/docs/build-spec.md +466 -0
  18. package/docs/library-conversion-plan.md +419 -0
  19. package/example/.gitattributes +7 -0
  20. package/example/.shopifyignore +28 -0
  21. package/example/.theme-check.yml +7 -0
  22. package/example/blocks/_built--sections--hero--blocks--feature.liquid +52 -0
  23. package/example/config/settings_schema.json +10 -0
  24. package/example/layout/theme.liquid +25 -0
  25. package/example/locales/en.default.json +1 -0
  26. package/example/package-lock.json +51 -0
  27. package/example/package.json +20 -0
  28. package/example/sections/built--sections--hero.liquid +83 -0
  29. package/example/snippets/built--components--button.liquid +38 -0
  30. package/example/snippets/built--components--card.liquid +33 -0
  31. package/example/src/components/button/button.css +13 -0
  32. package/example/src/components/card/card.css +16 -0
  33. package/example/src/components/card/card.liquid +9 -0
  34. package/example/src/sections/hero/blocks/feature/feature.css +11 -0
  35. package/example/src/sections/hero/blocks/feature/feature.liquid +9 -0
  36. package/example/src/sections/hero/blocks/feature/feature.schema.ts +14 -0
  37. package/example/src/sections/hero/hero.css +15 -0
  38. package/example/src/sections/hero/hero.liquid +16 -0
  39. package/example/src/sections/hero/hero.schema.ts +26 -0
  40. package/example/src/sections/hero/hero.test.ts +43 -0
  41. package/example/src/utilities/labels.ts +5 -0
  42. package/example/templates/index.liquid +1 -0
  43. package/example/tsconfig.json +10 -0
  44. package/example/vitest.config.ts +6 -0
  45. package/lib/build/build.test.ts +475 -0
  46. package/lib/build/build.ts +314 -0
  47. package/lib/build/command.ts +27 -0
  48. package/lib/build/index.ts +1 -0
  49. package/lib/cli.ts +17 -0
  50. package/lib/dev/command.ts +25 -0
  51. package/lib/dev/index.ts +1 -0
  52. package/lib/dev/watch.ts +52 -0
  53. package/lib/resolver.test.ts +275 -0
  54. package/lib/resolver.ts +156 -0
  55. package/lib/schema.ts +37 -0
  56. package/package.json +59 -0
  57. package/scripts/codegen-schema.ts +66 -0
  58. package/src/components/button/button.css +13 -0
  59. package/src/components/button/button.liquid +5 -0
  60. package/src/components/button/button.ts +5 -0
  61. package/src/tsconfig.json +10 -0
  62. package/tests/example.test.ts +101 -0
  63. package/tsconfig.json +20 -0
  64. package/tsdown.config.ts +14 -0
  65. package/vendor/theme-liquid-docs/.gitattributes +10 -0
  66. package/vendor/theme-liquid-docs/.github/CODEOWNERS +1 -0
  67. package/vendor/theme-liquid-docs/.github/CODE_OF_CONDUCT.md +73 -0
  68. package/vendor/theme-liquid-docs/.github/ISSUE_TEMPLATE/bug_report.md +17 -0
  69. package/vendor/theme-liquid-docs/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
  70. package/vendor/theme-liquid-docs/.github/dependabot.yaml +6 -0
  71. package/vendor/theme-liquid-docs/.github/workflows/ci.yml +33 -0
  72. package/vendor/theme-liquid-docs/.github/workflows/cla.yml +27 -0
  73. package/vendor/theme-liquid-docs/.github/workflows/shopify-dev-preview-automation.yml +86 -0
  74. package/vendor/theme-liquid-docs/.github/workflows/update-latest.yml +56 -0
  75. package/vendor/theme-liquid-docs/.prettierrc.json +16 -0
  76. package/vendor/theme-liquid-docs/.vscode/settings.json +28 -0
  77. package/vendor/theme-liquid-docs/LICENSE.md +7 -0
  78. package/vendor/theme-liquid-docs/README.md +48 -0
  79. package/vendor/theme-liquid-docs/ai/claude/CLAUDE.md +1485 -0
  80. package/vendor/theme-liquid-docs/ai/cursor/rules/assets.mdc +15 -0
  81. package/vendor/theme-liquid-docs/ai/cursor/rules/blocks.mdc +339 -0
  82. package/vendor/theme-liquid-docs/ai/cursor/rules/examples/block-example-group.mdc +103 -0
  83. package/vendor/theme-liquid-docs/ai/cursor/rules/examples/block-example-text.mdc +59 -0
  84. package/vendor/theme-liquid-docs/ai/cursor/rules/examples/section-example.mdc +61 -0
  85. package/vendor/theme-liquid-docs/ai/cursor/rules/examples/snippet-example.mdc +72 -0
  86. package/vendor/theme-liquid-docs/ai/cursor/rules/liquid.mdc +837 -0
  87. package/vendor/theme-liquid-docs/ai/cursor/rules/locales.mdc +100 -0
  88. package/vendor/theme-liquid-docs/ai/cursor/rules/localization.mdc +67 -0
  89. package/vendor/theme-liquid-docs/ai/cursor/rules/mcp.mdc +2 -0
  90. package/vendor/theme-liquid-docs/ai/cursor/rules/schemas.mdc +184 -0
  91. package/vendor/theme-liquid-docs/ai/cursor/rules/sections.mdc +84 -0
  92. package/vendor/theme-liquid-docs/ai/cursor/rules/settings-schema.mdc +51 -0
  93. package/vendor/theme-liquid-docs/ai/cursor/rules/snippets.mdc +119 -0
  94. package/vendor/theme-liquid-docs/ai/github/copilot-instructions.md +1485 -0
  95. package/vendor/theme-liquid-docs/ai/liquid.mdc +638 -0
  96. package/vendor/theme-liquid-docs/data/filters.json +6148 -0
  97. package/vendor/theme-liquid-docs/data/latest.json +2 -0
  98. package/vendor/theme-liquid-docs/data/objects.json +20594 -0
  99. package/vendor/theme-liquid-docs/data/shopify_system_translations.json +2586 -0
  100. package/vendor/theme-liquid-docs/data/tags.json +1276 -0
  101. package/vendor/theme-liquid-docs/package.json +20 -0
  102. package/vendor/theme-liquid-docs/schemas/manifest_schema.json +31 -0
  103. package/vendor/theme-liquid-docs/schemas/manifest_theme.json +19 -0
  104. package/vendor/theme-liquid-docs/schemas/manifest_theme_app_extension.json +10 -0
  105. package/vendor/theme-liquid-docs/schemas/theme/app_block_entry.json +13 -0
  106. package/vendor/theme-liquid-docs/schemas/theme/default_setting_values.json +24 -0
  107. package/vendor/theme-liquid-docs/schemas/theme/local_block_entry.json +25 -0
  108. package/vendor/theme-liquid-docs/schemas/theme/preset.json +72 -0
  109. package/vendor/theme-liquid-docs/schemas/theme/preset_blocks.json +91 -0
  110. package/vendor/theme-liquid-docs/schemas/theme/section.json +208 -0
  111. package/vendor/theme-liquid-docs/schemas/theme/setting.json +1413 -0
  112. package/vendor/theme-liquid-docs/schemas/theme/settings.json +10 -0
  113. package/vendor/theme-liquid-docs/schemas/theme/targetted_block_entry.json +15 -0
  114. package/vendor/theme-liquid-docs/schemas/theme/theme_block.json +91 -0
  115. package/vendor/theme-liquid-docs/schemas/theme/theme_block_entry.json +14 -0
  116. package/vendor/theme-liquid-docs/schemas/theme/theme_settings.json +83 -0
  117. package/vendor/theme-liquid-docs/schemas/theme/translations.json +63 -0
  118. package/vendor/theme-liquid-docs/schemas/update/update_extension_schema_v1.json +186 -0
  119. package/vendor/theme-liquid-docs/tests/fixtures/section-nested-blocks.json +18 -0
  120. package/vendor/theme-liquid-docs/tests/fixtures/section-schema-1.json +90 -0
  121. package/vendor/theme-liquid-docs/tests/fixtures/section-schema-2.json +201 -0
  122. package/vendor/theme-liquid-docs/tests/fixtures/section-schema-3.json +29 -0
  123. package/vendor/theme-liquid-docs/tests/fixtures/section-schema-4.json +315 -0
  124. package/vendor/theme-liquid-docs/tests/fixtures/section-schema-5.json +114 -0
  125. package/vendor/theme-liquid-docs/tests/fixtures/section-schema-6.json +63 -0
  126. package/vendor/theme-liquid-docs/tests/fixtures/section-schema-conditional-settings.json +145 -0
  127. package/vendor/theme-liquid-docs/tests/fixtures/section-schema-preset-blocks-as-hash.json +60 -0
  128. package/vendor/theme-liquid-docs/tests/fixtures/section-schema-static-block-preset.json +76 -0
  129. package/vendor/theme-liquid-docs/tests/fixtures/section-settings.json +34 -0
  130. package/vendor/theme-liquid-docs/tests/fixtures/theme-block-1.json +234 -0
  131. package/vendor/theme-liquid-docs/tests/fixtures/theme-block-2.json +253 -0
  132. package/vendor/theme-liquid-docs/tests/fixtures/theme-block-basics.json +48 -0
  133. package/vendor/theme-liquid-docs/tests/fixtures/theme-block-conditional-settings.json +202 -0
  134. package/vendor/theme-liquid-docs/tests/fixtures/theme-block-presets-as-hash.json +50 -0
  135. package/vendor/theme-liquid-docs/tests/fixtures/theme-block-settings.json +34 -0
  136. package/vendor/theme-liquid-docs/tests/fixtures/theme-settings-all-settings.json +313 -0
  137. package/vendor/theme-liquid-docs/tests/fixtures/theme-settings-dawn.json +1469 -0
  138. package/vendor/theme-liquid-docs/tests/fixtures/theme-settings-metadata.json +10 -0
  139. package/vendor/theme-liquid-docs/tests/fixtures/translations-1.json +14 -0
  140. package/vendor/theme-liquid-docs/tests/section.spec.ts +367 -0
  141. package/vendor/theme-liquid-docs/tests/test-constants.ts +58 -0
  142. package/vendor/theme-liquid-docs/tests/test-helpers.ts +104 -0
  143. package/vendor/theme-liquid-docs/tests/theme-settings/color_palette.spec.ts +184 -0
  144. package/vendor/theme-liquid-docs/tests/theme-settings/color_scheme_group.spec.ts +143 -0
  145. package/vendor/theme-liquid-docs/tests/theme-settings/general.spec.ts +192 -0
  146. package/vendor/theme-liquid-docs/tests/theme-settings/metaobject.spec.ts +94 -0
  147. package/vendor/theme-liquid-docs/tests/theme-settings/resource_list.spec.ts +58 -0
  148. package/vendor/theme-liquid-docs/tests/theme-settings/theme-metadata.spec.ts +59 -0
  149. package/vendor/theme-liquid-docs/tests/theme_block.spec.ts +266 -0
  150. package/vendor/theme-liquid-docs/tests/translations_schema.spec.ts +31 -0
  151. package/vendor/theme-liquid-docs/yarn.lock +543 -0
  152. package/vitest.config.ts +7 -0
@@ -0,0 +1,83 @@
1
+ {%- comment -%}
2
+ GENERATED FROM consumer/src/sections/hero/hero.liquid — do not edit this file directly.
3
+ Edit the source and run `npm run build`.
4
+ {%- endcomment -%}
5
+
6
+ {%- liquid
7
+ assign heading = section.settings.heading | default: 'Welcome'
8
+ assign text_alignment = section.settings.text_alignment | default: 'center'
9
+ -%}
10
+
11
+ <section class="tr-hero" style="text-align: {{ text_alignment }};">
12
+ <h2 class="tr-hero__heading">{{ heading }}</h2>
13
+ {% render 'built--components--card',
14
+ title: 'Get started',
15
+ body: 'Build with Smelt.'
16
+ %}
17
+ {% render 'built--components--button', label: 'Continue' %}
18
+ <ul class="tr-hero__features">
19
+ {% content_for 'blocks' %}
20
+ </ul>
21
+ </section>
22
+
23
+ {% schema %}
24
+ {
25
+ "name": "Hero",
26
+ "settings": [
27
+ {
28
+ "type": "text",
29
+ "id": "heading",
30
+ "label": "Heading",
31
+ "default": "Welcome"
32
+ },
33
+ {
34
+ "type": "select",
35
+ "id": "text_alignment",
36
+ "label": "Text alignment",
37
+ "options": [
38
+ {
39
+ "value": "left",
40
+ "label": "Left"
41
+ },
42
+ {
43
+ "value": "center",
44
+ "label": "Center"
45
+ },
46
+ {
47
+ "value": "right",
48
+ "label": "Right"
49
+ }
50
+ ],
51
+ "default": "center"
52
+ }
53
+ ],
54
+ "presets": [
55
+ {
56
+ "name": "Hero"
57
+ }
58
+ ],
59
+ "blocks": [
60
+ {
61
+ "type": "_built--sections--hero--blocks--feature"
62
+ }
63
+ ]
64
+ }
65
+ {% endschema %}
66
+
67
+ {% stylesheet %}
68
+ .tr-hero {
69
+ padding: 2rem;
70
+ text-align: center;
71
+ }
72
+
73
+ .tr-hero__heading {
74
+ margin: 0 0 1rem;
75
+ font-size: 2rem;
76
+ }
77
+
78
+ .tr-hero__features {
79
+ padding: 0;
80
+ margin: 1rem 0 0;
81
+ list-style: none;
82
+ }
83
+ {% endstylesheet %}
@@ -0,0 +1,38 @@
1
+ {%- comment -%}
2
+ GENERATED FROM @augeo/smelt/src/components/button/button.liquid — do not edit this file directly.
3
+ Edit the source and run `npm run build`.
4
+ {%- endcomment -%}
5
+
6
+ {%- liquid
7
+ assign label = label | default: 'Click me'
8
+ -%}
9
+
10
+ <button class="tr-button" type="button">{{ label }}</button>
11
+
12
+ {% stylesheet %}
13
+ .tr-button {
14
+ padding: 0.75rem 1.5rem;
15
+ font: inherit;
16
+ color: #111;
17
+ cursor: pointer;
18
+ background: #f3c724;
19
+ border: 0;
20
+ border-radius: 999px;
21
+ }
22
+
23
+ .tr-button:hover {
24
+ background: #ffd633;
25
+ }
26
+ {% endstylesheet %}
27
+
28
+ {% javascript %}
29
+ "use strict";
30
+ (() => {
31
+ // src/components/button/button.ts
32
+ document.querySelectorAll(".tr-button").forEach((button) => {
33
+ button.addEventListener("click", () => {
34
+ console.log("tr-button clicked");
35
+ });
36
+ });
37
+ })();
38
+ {% endjavascript %}
@@ -0,0 +1,33 @@
1
+ {%- comment -%}
2
+ GENERATED FROM consumer/src/components/card/card.liquid — do not edit this file directly.
3
+ Edit the source and run `npm run build`.
4
+ {%- endcomment -%}
5
+
6
+ {%- liquid
7
+ assign title = title | default: 'Untitled'
8
+ assign body = body | default: ''
9
+ -%}
10
+
11
+ <article class="tr-card">
12
+ <h3 class="tr-card__title">{{ title }}</h3>
13
+ <p class="tr-card__body">{{ body }}</p>
14
+ </article>
15
+
16
+ {% stylesheet %}
17
+ .tr-card {
18
+ padding: 1rem;
19
+ background: #fff;
20
+ border: 1px solid #e0e0e0;
21
+ border-radius: 8px;
22
+ }
23
+
24
+ .tr-card__title {
25
+ margin: 0 0 0.5rem;
26
+ font-size: 1.125rem;
27
+ }
28
+
29
+ .tr-card__body {
30
+ margin: 0;
31
+ color: #555;
32
+ }
33
+ {% endstylesheet %}
@@ -0,0 +1,13 @@
1
+ .tr-button {
2
+ padding: 0.75rem 1.5rem;
3
+ font: inherit;
4
+ color: #111;
5
+ cursor: pointer;
6
+ background: #f3c724;
7
+ border: 0;
8
+ border-radius: 999px;
9
+ }
10
+
11
+ .tr-button:hover {
12
+ background: #ffd633;
13
+ }
@@ -0,0 +1,16 @@
1
+ .tr-card {
2
+ padding: 1rem;
3
+ background: #fff;
4
+ border: 1px solid #e0e0e0;
5
+ border-radius: 8px;
6
+ }
7
+
8
+ .tr-card__title {
9
+ margin: 0 0 0.5rem;
10
+ font-size: 1.125rem;
11
+ }
12
+
13
+ .tr-card__body {
14
+ margin: 0;
15
+ color: #555;
16
+ }
@@ -0,0 +1,9 @@
1
+ {%- liquid
2
+ assign title = title | default: 'Untitled'
3
+ assign body = body | default: ''
4
+ -%}
5
+
6
+ <article class="tr-card">
7
+ <h3 class="tr-card__title">{{ title }}</h3>
8
+ <p class="tr-card__body">{{ body }}</p>
9
+ </article>
@@ -0,0 +1,11 @@
1
+ .tr-feature {
2
+ margin: 0.5rem 0;
3
+ }
4
+
5
+ .tr-feature__title {
6
+ display: block;
7
+ }
8
+
9
+ .tr-feature__body {
10
+ margin: 0.25rem 0 0;
11
+ }
@@ -0,0 +1,9 @@
1
+ {%- liquid
2
+ assign title = block.settings.title | default: 'Feature'
3
+ assign body = block.settings.body | default: ''
4
+ -%}
5
+
6
+ <li class="tr-feature" {{ block.shopify_attributes }}>
7
+ <strong class="tr-feature__title">{{ title }}</strong>
8
+ <p class="tr-feature__body">{{ body }}</p>
9
+ </li>
@@ -0,0 +1,14 @@
1
+ import { defineSchemaBlock } from "@augeo/smelt/schema";
2
+
3
+ // `presets` provide initial-state defaults when a merchant adds this block.
4
+ // Private blocks (nested under a section/block) are added via the parent's
5
+ // "Add block" picker, not the global one — but presets still define the
6
+ // starting settings for each instance.
7
+ export const schema = defineSchemaBlock({
8
+ name: "Feature",
9
+ settings: [
10
+ { type: "text", id: "title", label: "Title", default: "Fast" },
11
+ { type: "textarea", id: "body", label: "Body" },
12
+ ],
13
+ presets: [{ name: "Feature" }],
14
+ });
@@ -0,0 +1,15 @@
1
+ .tr-hero {
2
+ padding: 2rem;
3
+ text-align: center;
4
+ }
5
+
6
+ .tr-hero__heading {
7
+ margin: 0 0 1rem;
8
+ font-size: 2rem;
9
+ }
10
+
11
+ .tr-hero__features {
12
+ padding: 0;
13
+ margin: 1rem 0 0;
14
+ list-style: none;
15
+ }
@@ -0,0 +1,16 @@
1
+ {%- liquid
2
+ assign heading = section.settings.heading | default: 'Welcome'
3
+ assign text_alignment = section.settings.text_alignment | default: 'center'
4
+ -%}
5
+
6
+ <section class="tr-hero" style="text-align: {{ text_alignment }};">
7
+ <h2 class="tr-hero__heading">{{ heading }}</h2>
8
+ {% render '@/components/card',
9
+ title: 'Get started',
10
+ body: 'Build with Smelt.'
11
+ %}
12
+ {% render '@/components/button', label: 'Continue' %}
13
+ <ul class="tr-hero__features">
14
+ {% content_for 'blocks' %}
15
+ </ul>
16
+ </section>
@@ -0,0 +1,26 @@
1
+ import { defineSchemaSection } from "@augeo/smelt/schema";
2
+ import { heroSectionName } from "@/utilities/labels";
3
+
4
+ export const schema = defineSchemaSection({
5
+ name: heroSectionName,
6
+ settings: [
7
+ {
8
+ type: "text",
9
+ id: "heading",
10
+ label: "Heading",
11
+ default: "Welcome",
12
+ },
13
+ {
14
+ type: "select",
15
+ id: "text_alignment",
16
+ label: "Text alignment",
17
+ options: [
18
+ { value: "left", label: "Left" },
19
+ { value: "center", label: "Center" },
20
+ { value: "right", label: "Right" },
21
+ ],
22
+ default: "center",
23
+ },
24
+ ],
25
+ presets: [{ name: "Hero" }],
26
+ });
@@ -0,0 +1,43 @@
1
+ import { render } from "@augeo/assay";
2
+ import { beforeEach, describe, expect, it } from "vitest";
3
+ import { page } from "vitest/browser";
4
+
5
+ describe("hero.liquid", () => {
6
+ describe("when rendered with custom settings", () => {
7
+ let container: HTMLElement;
8
+ beforeEach(async () => {
9
+ container = await render("built--sections--hero", {
10
+ section: {
11
+ settings: {
12
+ heading: "Welcome, Echo",
13
+ text_alignment: "left",
14
+ },
15
+ },
16
+ });
17
+ });
18
+
19
+ it("shows the configured heading", async () => {
20
+ await expect.element(page.getByText("Welcome, Echo")).toBeVisible();
21
+ });
22
+
23
+ it("renders the nested button via @/components/button", async () => {
24
+ await expect.element(page.getByText("Continue")).toBeVisible();
25
+ });
26
+
27
+ it("inlines the hero stylesheet as a <style> tag", () => {
28
+ const styles = Array.from(container.querySelectorAll("style"));
29
+ const heroStyle = styles.find((style) =>
30
+ style.textContent?.includes(".tr-hero"),
31
+ );
32
+ expect(heroStyle).toBeDefined();
33
+ });
34
+
35
+ it("inlines the nested button's javascript as a <script> tag", () => {
36
+ const scripts = Array.from(container.querySelectorAll("script"));
37
+ const buttonScript = scripts.find((script) =>
38
+ script.textContent?.includes("tr-button clicked"),
39
+ );
40
+ expect(buttonScript).toBeDefined();
41
+ });
42
+ });
43
+ });
@@ -0,0 +1,5 @@
1
+ // Shared labels imported via `@/utilities/labels` from schema files —
2
+ // demonstrates that `@/...` resolves against the consumer's tsconfig at
3
+ // schema-build time, the same way `tsc` and the IDE resolve it.
4
+
5
+ export const heroSectionName = "Hero";
@@ -0,0 +1 @@
1
+ {% section 'built--sections--hero' %}
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../tsconfig.json",
3
+ "compilerOptions": {
4
+ "lib": ["dom", "dom.iterable", "esnext"],
5
+ "paths": {
6
+ "@/*": ["./src/*"]
7
+ }
8
+ },
9
+ "include": ["src/**/*.ts", "vitest.config.ts"]
10
+ }
@@ -0,0 +1,6 @@
1
+ import { assayPreset } from "@augeo/assay/preset";
2
+
3
+ export default assayPreset({
4
+ liquidPaths: ["./sections", "./snippets", "./blocks"],
5
+ assetsPath: "./assets",
6
+ });