@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.
- package/.claude/settings.json +11 -0
- package/.github/workflows/verify.yml +64 -0
- package/.gitmodules +3 -0
- package/.prettierignore +25 -0
- package/.prettierrc.cjs +9 -0
- package/.zed/settings.json +21 -0
- package/AGENTS.md +232 -0
- package/LICENSE +21 -0
- package/README.md +266 -0
- package/biome.json +58 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +350 -0
- package/dist/schema.d.mts +265 -0
- package/dist/schema.mjs +21 -0
- package/docs/TESTING.md +293 -0
- package/docs/assets-plan.md +197 -0
- package/docs/build-spec.md +466 -0
- package/docs/library-conversion-plan.md +419 -0
- package/example/.gitattributes +7 -0
- package/example/.shopifyignore +28 -0
- package/example/.theme-check.yml +7 -0
- package/example/blocks/_built--sections--hero--blocks--feature.liquid +52 -0
- package/example/config/settings_schema.json +10 -0
- package/example/layout/theme.liquid +25 -0
- package/example/locales/en.default.json +1 -0
- package/example/package-lock.json +51 -0
- package/example/package.json +20 -0
- package/example/sections/built--sections--hero.liquid +83 -0
- package/example/snippets/built--components--button.liquid +38 -0
- package/example/snippets/built--components--card.liquid +33 -0
- package/example/src/components/button/button.css +13 -0
- package/example/src/components/card/card.css +16 -0
- package/example/src/components/card/card.liquid +9 -0
- package/example/src/sections/hero/blocks/feature/feature.css +11 -0
- package/example/src/sections/hero/blocks/feature/feature.liquid +9 -0
- package/example/src/sections/hero/blocks/feature/feature.schema.ts +14 -0
- package/example/src/sections/hero/hero.css +15 -0
- package/example/src/sections/hero/hero.liquid +16 -0
- package/example/src/sections/hero/hero.schema.ts +26 -0
- package/example/src/sections/hero/hero.test.ts +43 -0
- package/example/src/utilities/labels.ts +5 -0
- package/example/templates/index.liquid +1 -0
- package/example/tsconfig.json +10 -0
- package/example/vitest.config.ts +6 -0
- package/lib/build/build.test.ts +475 -0
- package/lib/build/build.ts +314 -0
- package/lib/build/command.ts +27 -0
- package/lib/build/index.ts +1 -0
- package/lib/cli.ts +17 -0
- package/lib/dev/command.ts +25 -0
- package/lib/dev/index.ts +1 -0
- package/lib/dev/watch.ts +52 -0
- package/lib/resolver.test.ts +275 -0
- package/lib/resolver.ts +156 -0
- package/lib/schema.ts +37 -0
- package/package.json +59 -0
- package/scripts/codegen-schema.ts +66 -0
- package/src/components/button/button.css +13 -0
- package/src/components/button/button.liquid +5 -0
- package/src/components/button/button.ts +5 -0
- package/src/tsconfig.json +10 -0
- package/tests/example.test.ts +101 -0
- package/tsconfig.json +20 -0
- package/tsdown.config.ts +14 -0
- package/vendor/theme-liquid-docs/.gitattributes +10 -0
- package/vendor/theme-liquid-docs/.github/CODEOWNERS +1 -0
- package/vendor/theme-liquid-docs/.github/CODE_OF_CONDUCT.md +73 -0
- package/vendor/theme-liquid-docs/.github/ISSUE_TEMPLATE/bug_report.md +17 -0
- package/vendor/theme-liquid-docs/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
- package/vendor/theme-liquid-docs/.github/dependabot.yaml +6 -0
- package/vendor/theme-liquid-docs/.github/workflows/ci.yml +33 -0
- package/vendor/theme-liquid-docs/.github/workflows/cla.yml +27 -0
- package/vendor/theme-liquid-docs/.github/workflows/shopify-dev-preview-automation.yml +86 -0
- package/vendor/theme-liquid-docs/.github/workflows/update-latest.yml +56 -0
- package/vendor/theme-liquid-docs/.prettierrc.json +16 -0
- package/vendor/theme-liquid-docs/.vscode/settings.json +28 -0
- package/vendor/theme-liquid-docs/LICENSE.md +7 -0
- package/vendor/theme-liquid-docs/README.md +48 -0
- package/vendor/theme-liquid-docs/ai/claude/CLAUDE.md +1485 -0
- package/vendor/theme-liquid-docs/ai/cursor/rules/assets.mdc +15 -0
- package/vendor/theme-liquid-docs/ai/cursor/rules/blocks.mdc +339 -0
- package/vendor/theme-liquid-docs/ai/cursor/rules/examples/block-example-group.mdc +103 -0
- package/vendor/theme-liquid-docs/ai/cursor/rules/examples/block-example-text.mdc +59 -0
- package/vendor/theme-liquid-docs/ai/cursor/rules/examples/section-example.mdc +61 -0
- package/vendor/theme-liquid-docs/ai/cursor/rules/examples/snippet-example.mdc +72 -0
- package/vendor/theme-liquid-docs/ai/cursor/rules/liquid.mdc +837 -0
- package/vendor/theme-liquid-docs/ai/cursor/rules/locales.mdc +100 -0
- package/vendor/theme-liquid-docs/ai/cursor/rules/localization.mdc +67 -0
- package/vendor/theme-liquid-docs/ai/cursor/rules/mcp.mdc +2 -0
- package/vendor/theme-liquid-docs/ai/cursor/rules/schemas.mdc +184 -0
- package/vendor/theme-liquid-docs/ai/cursor/rules/sections.mdc +84 -0
- package/vendor/theme-liquid-docs/ai/cursor/rules/settings-schema.mdc +51 -0
- package/vendor/theme-liquid-docs/ai/cursor/rules/snippets.mdc +119 -0
- package/vendor/theme-liquid-docs/ai/github/copilot-instructions.md +1485 -0
- package/vendor/theme-liquid-docs/ai/liquid.mdc +638 -0
- package/vendor/theme-liquid-docs/data/filters.json +6148 -0
- package/vendor/theme-liquid-docs/data/latest.json +2 -0
- package/vendor/theme-liquid-docs/data/objects.json +20594 -0
- package/vendor/theme-liquid-docs/data/shopify_system_translations.json +2586 -0
- package/vendor/theme-liquid-docs/data/tags.json +1276 -0
- package/vendor/theme-liquid-docs/package.json +20 -0
- package/vendor/theme-liquid-docs/schemas/manifest_schema.json +31 -0
- package/vendor/theme-liquid-docs/schemas/manifest_theme.json +19 -0
- package/vendor/theme-liquid-docs/schemas/manifest_theme_app_extension.json +10 -0
- package/vendor/theme-liquid-docs/schemas/theme/app_block_entry.json +13 -0
- package/vendor/theme-liquid-docs/schemas/theme/default_setting_values.json +24 -0
- package/vendor/theme-liquid-docs/schemas/theme/local_block_entry.json +25 -0
- package/vendor/theme-liquid-docs/schemas/theme/preset.json +72 -0
- package/vendor/theme-liquid-docs/schemas/theme/preset_blocks.json +91 -0
- package/vendor/theme-liquid-docs/schemas/theme/section.json +208 -0
- package/vendor/theme-liquid-docs/schemas/theme/setting.json +1413 -0
- package/vendor/theme-liquid-docs/schemas/theme/settings.json +10 -0
- package/vendor/theme-liquid-docs/schemas/theme/targetted_block_entry.json +15 -0
- package/vendor/theme-liquid-docs/schemas/theme/theme_block.json +91 -0
- package/vendor/theme-liquid-docs/schemas/theme/theme_block_entry.json +14 -0
- package/vendor/theme-liquid-docs/schemas/theme/theme_settings.json +83 -0
- package/vendor/theme-liquid-docs/schemas/theme/translations.json +63 -0
- package/vendor/theme-liquid-docs/schemas/update/update_extension_schema_v1.json +186 -0
- package/vendor/theme-liquid-docs/tests/fixtures/section-nested-blocks.json +18 -0
- package/vendor/theme-liquid-docs/tests/fixtures/section-schema-1.json +90 -0
- package/vendor/theme-liquid-docs/tests/fixtures/section-schema-2.json +201 -0
- package/vendor/theme-liquid-docs/tests/fixtures/section-schema-3.json +29 -0
- package/vendor/theme-liquid-docs/tests/fixtures/section-schema-4.json +315 -0
- package/vendor/theme-liquid-docs/tests/fixtures/section-schema-5.json +114 -0
- package/vendor/theme-liquid-docs/tests/fixtures/section-schema-6.json +63 -0
- package/vendor/theme-liquid-docs/tests/fixtures/section-schema-conditional-settings.json +145 -0
- package/vendor/theme-liquid-docs/tests/fixtures/section-schema-preset-blocks-as-hash.json +60 -0
- package/vendor/theme-liquid-docs/tests/fixtures/section-schema-static-block-preset.json +76 -0
- package/vendor/theme-liquid-docs/tests/fixtures/section-settings.json +34 -0
- package/vendor/theme-liquid-docs/tests/fixtures/theme-block-1.json +234 -0
- package/vendor/theme-liquid-docs/tests/fixtures/theme-block-2.json +253 -0
- package/vendor/theme-liquid-docs/tests/fixtures/theme-block-basics.json +48 -0
- package/vendor/theme-liquid-docs/tests/fixtures/theme-block-conditional-settings.json +202 -0
- package/vendor/theme-liquid-docs/tests/fixtures/theme-block-presets-as-hash.json +50 -0
- package/vendor/theme-liquid-docs/tests/fixtures/theme-block-settings.json +34 -0
- package/vendor/theme-liquid-docs/tests/fixtures/theme-settings-all-settings.json +313 -0
- package/vendor/theme-liquid-docs/tests/fixtures/theme-settings-dawn.json +1469 -0
- package/vendor/theme-liquid-docs/tests/fixtures/theme-settings-metadata.json +10 -0
- package/vendor/theme-liquid-docs/tests/fixtures/translations-1.json +14 -0
- package/vendor/theme-liquid-docs/tests/section.spec.ts +367 -0
- package/vendor/theme-liquid-docs/tests/test-constants.ts +58 -0
- package/vendor/theme-liquid-docs/tests/test-helpers.ts +104 -0
- package/vendor/theme-liquid-docs/tests/theme-settings/color_palette.spec.ts +184 -0
- package/vendor/theme-liquid-docs/tests/theme-settings/color_scheme_group.spec.ts +143 -0
- package/vendor/theme-liquid-docs/tests/theme-settings/general.spec.ts +192 -0
- package/vendor/theme-liquid-docs/tests/theme-settings/metaobject.spec.ts +94 -0
- package/vendor/theme-liquid-docs/tests/theme-settings/resource_list.spec.ts +58 -0
- package/vendor/theme-liquid-docs/tests/theme-settings/theme-metadata.spec.ts +59 -0
- package/vendor/theme-liquid-docs/tests/theme_block.spec.ts +266 -0
- package/vendor/theme-liquid-docs/tests/translations_schema.spec.ts +31 -0
- package/vendor/theme-liquid-docs/yarn.lock +543 -0
- 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,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,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 @@
|
|
|
1
|
+
{% section 'built--sections--hero' %}
|