@plitzi/sdk-authoring 0.39.3 → 0.39.6

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 (30) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/index-src.js +1776 -1145
  3. package/dist/index.d.ts +139 -15
  4. package/dist/index.js +2 -2
  5. package/dist/node.d.ts +81 -6
  6. package/dist/node.js +1 -1
  7. package/dist/plugin.d.ts +2 -2
  8. package/package.json +9 -9
  9. package/skills/plitzi-authoring/recipes/accordion.ts +3 -1
  10. package/skills/plitzi-authoring/recipes/carousel.ts +68 -63
  11. package/skills/plitzi-authoring/recipes/detail-page.ts +43 -33
  12. package/skills/plitzi-authoring/recipes/embed-and-svg.ts +16 -11
  13. package/skills/plitzi-authoring/recipes/every-few-seconds.ts +52 -42
  14. package/skills/plitzi-authoring/recipes/feature-flag.ts +7 -2
  15. package/skills/plitzi-authoring/recipes/filter-a-list.ts +39 -31
  16. package/skills/plitzi-authoring/recipes/forms-and-modals.ts +34 -28
  17. package/skills/plitzi-authoring/recipes/from-tailwind.ts +11 -6
  18. package/skills/plitzi-authoring/recipes/link-to-a-section.ts +11 -6
  19. package/skills/plitzi-authoring/recipes/link-with-data.ts +21 -16
  20. package/skills/plitzi-authoring/recipes/marquee.ts +17 -12
  21. package/skills/plitzi-authoring/recipes/plugin.ts +16 -10
  22. package/skills/plitzi-authoring/recipes/scroll-a-row.ts +30 -25
  23. package/skills/plitzi-authoring/recipes/server-data.ts +15 -10
  24. package/skills/plitzi-authoring/recipes/show-data.ts +32 -24
  25. package/skills/plitzi-authoring/recipes/style-a-page.ts +9 -4
  26. package/skills/plitzi-authoring/recipes/typed-data.ts +26 -21
  27. package/skills/plitzi-authoring/recipes/usable-without-sight.ts +16 -11
  28. package/skills/plitzi-authoring/reference/authoring-errors.md +11 -4
  29. package/skills/plitzi-authoring/reference/efficiency.md +3 -1
  30. package/skills/plitzi-authoring/reference/layouts.md +2 -1
package/dist/plugin.d.ts CHANGED
@@ -612,12 +612,12 @@ declare type RuleGroup = {
612
612
 
613
613
  /**
614
614
  * A condition as Plitzi stores it — a flag's rules, an interaction's `when`, a binding's condition: the schema's own
615
- * format, so sdk-shared defines it (RFC 0032, D13). plitzi-ui's QueryBuilder edits the same shape with prop types of its
615
+ * format, so sdk-shared defines it (docs/en/server-packages.md, D13). plitzi-ui's QueryBuilder edits the same shape with prop types of its
616
616
  * own, and a type test in the builder, where the two meet, holds them assignable both ways.
617
617
  */
618
618
  declare type RuleValue = Date | string | number | boolean | undefined | null | object;
619
619
 
620
- declare type SpaceCredentialProvider = 's3' | 'r2' | 'ssr' | 'custom' | 'smtp';
620
+ declare type SpaceCredentialProvider = 's3' | 'r2' | 'ssr' | 'custom' | 'smtp' | 'github' | 'cloudflare' | 'netlify' | 'vercel' | 'ftp';
621
621
 
622
622
  /**
623
623
  * The pseudo-elements a class can dress — parts of an element the page has no node for: the box drawn before or after
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-authoring",
3
- "version": "0.39.3",
3
+ "version": "0.39.6",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist/index.js",
@@ -66,17 +66,17 @@
66
66
  },
67
67
  "devDependencies": {
68
68
  "@microsoft/api-extractor": "^7.60.1",
69
- "@plitzi/plitzi-ui": "^1.6.38",
70
- "@plitzi/sdk-elements": "0.39.3",
71
- "@plitzi/sdk-interactions": "0.39.3",
72
- "@plitzi/sdk-schema": "0.39.3",
73
- "@plitzi/sdk-shared": "0.39.3",
74
- "@plitzi/sdk-style": "0.39.3",
69
+ "@plitzi/plitzi-ui": "^1.6.40",
70
+ "@plitzi/sdk-elements": "0.39.6",
71
+ "@plitzi/sdk-interactions": "0.39.6",
72
+ "@plitzi/sdk-schema": "0.39.6",
73
+ "@plitzi/sdk-shared": "0.39.6",
74
+ "@plitzi/sdk-style": "0.39.6",
75
75
  "@types/react": "^19.3.0",
76
76
  "eslint": "^9.39.5",
77
- "prettier": "^3.9.10",
77
+ "prettier": "^3.10.1",
78
78
  "typescript": "^6.0.3",
79
- "vite": "^8.3.7",
79
+ "vite": "^8.3.8",
80
80
  "vite-plugin-dts": "^5.1.2",
81
81
  "vitest": "^5.1.0"
82
82
  }
@@ -55,5 +55,7 @@ const faqItem = ({ id, question: words, answer: text }: (typeof QUESTIONS)[numbe
55
55
  export const recipe: SpaceSpec = {
56
56
  name: 'Questions',
57
57
  permanentUrl: 'questions',
58
- pages: [{ id: 'home', name: 'Home', slug: '', body: QUESTIONS.flatMap(faqItem) }]
58
+ pages: [
59
+ { id: 'home', name: 'Home', slug: '', body: [container({ subType: 'main', children: QUESTIONS.flatMap(faqItem) })] }
60
+ ]
59
61
  };
@@ -63,75 +63,80 @@ export const recipe: SpaceSpec = {
63
63
  name: 'Home',
64
64
  slug: '',
65
65
  body: [
66
- // One slide at a time, on its own every 5 s — held while the pointer or the keyboard is on it.
67
- carousel({
68
- id: 'hero',
69
- label: 'Featured',
70
- items: SLIDES,
71
- autoplay: 5000,
72
- row: r =>
73
- container({
74
- class: slide,
75
- children: [heading({ subType: 'h2', from: `${r.item}.title` }), text({ from: `${r.item}.lede` })]
76
- }),
66
+ container({
67
+ subType: 'main',
77
68
  children: [
78
- button({ content: '‹', title: 'Previous slide', flows: [[onClick(), carouselPrevious('hero')]] }),
79
- button({ content: '›', title: 'Next slide', flows: [[onClick(), carouselNext('hero')]] }),
80
- list({
81
- id: 'hero-dots',
82
- class: dots,
83
- items: 'hero.items',
69
+ // One slide at a time, on its own every 5 s — held while the pointer or the keyboard is on it.
70
+ carousel({
71
+ id: 'hero',
72
+ label: 'Featured',
73
+ items: SLIDES,
74
+ autoplay: 5000,
84
75
  row: r =>
85
- listItem({
86
- children: [
87
- button({
88
- content: '',
89
- class: dot,
90
- bind: [
91
- bindTemplate('title', r.index, 'Slide {{ source + 1 }}'),
92
- activeWhen(dot, `{{ ${r.inTemplate.index} == carousel_hero.index }}`)
93
- ],
94
- flows: [[onClick(), carouselGoTo('hero', `{{ ${r.inTemplate.index} }}`)]]
76
+ container({
77
+ class: slide,
78
+ children: [heading({ subType: 'h2', from: `${r.item}.title` }), text({ from: `${r.item}.lede` })]
79
+ }),
80
+ children: [
81
+ button({ content: '‹', title: 'Previous slide', flows: [[onClick(), carouselPrevious('hero')]] }),
82
+ button({ content: '›', title: 'Next slide', flows: [[onClick(), carouselNext('hero')]] }),
83
+ list({
84
+ id: 'hero-dots',
85
+ class: dots,
86
+ items: 'hero.items',
87
+ row: r =>
88
+ listItem({
89
+ children: [
90
+ button({
91
+ content: '',
92
+ class: dot,
93
+ bind: [
94
+ bindTemplate('title', r.index, 'Slide {{ source + 1 }}'),
95
+ activeWhen(dot, `{{ ${r.inTemplate.index} == carousel_hero.index }}`)
96
+ ],
97
+ flows: [[onClick(), carouselGoTo('hero', `{{ ${r.inTemplate.index} }}`)]]
98
+ })
99
+ ]
95
100
  })
96
- ]
97
101
  })
98
- })
99
- ]
100
- }),
101
- // Scrolling past for ever at 40 px a second, still under the pointer.
102
- carousel({
103
- id: 'logos',
104
- label: 'Brands we carry',
105
- mode: 'marquee',
106
- speed: 40,
107
- items: ['Acme', 'Globex', 'Initech', 'Umbrella', 'Hooli'],
108
- row: r => text({ from: r.item, css: { padding: '0px 24px', fontWeight: 600 } })
109
- }),
110
- // A row that swipes on a phone and snaps to each card; the arrows move it a page — as many cards as it shows —
111
- // and each hides at its end.
112
- carousel({
113
- id: 'picks',
114
- label: 'Picks',
115
- mode: 'scroll',
116
- class: cards,
117
- items: SLIDES,
118
- row: r => container({ class: slide, children: [text({ from: `${r.item}.title` })] }),
119
- children: [
120
- button({
121
- content: '‹',
122
- title: 'Earlier picks',
123
- class: arrow,
124
- bind: [activeWhen(arrow, '{{ carousel_picks.atStart }}', { variant: 'spent' })],
125
- flows: [[onClick(), carouselPrevious('picks', 'page')]]
102
+ ]
126
103
  }),
127
- button({
128
- content: '›',
129
- title: 'More picks',
130
- class: arrow,
131
- bind: [activeWhen(arrow, '{{ carousel_picks.atEnd }}', { variant: 'spent' })],
132
- flows: [[onClick(), carouselNext('picks', 'page')]]
104
+ // Scrolling past for ever at 40 px a second, still under the pointer.
105
+ carousel({
106
+ id: 'logos',
107
+ label: 'Brands we carry',
108
+ mode: 'marquee',
109
+ speed: 40,
110
+ items: ['Acme', 'Globex', 'Initech', 'Umbrella', 'Hooli'],
111
+ row: r => text({ from: r.item, css: { padding: '0px 24px', fontWeight: 600 } })
133
112
  }),
134
- text({ from: 'picks.index', as: '{{ source + 1 }} of {{ carousel_picks.count }}' })
113
+ // A row that swipes on a phone and snaps to each card; the arrows move it a page — as many cards as it shows —
114
+ // and each hides at its end.
115
+ carousel({
116
+ id: 'picks',
117
+ label: 'Picks',
118
+ mode: 'scroll',
119
+ class: cards,
120
+ items: SLIDES,
121
+ row: r => container({ class: slide, children: [text({ from: `${r.item}.title` })] }),
122
+ children: [
123
+ button({
124
+ content: '‹',
125
+ title: 'Earlier picks',
126
+ class: arrow,
127
+ bind: [activeWhen(arrow, '{{ carousel_picks.atStart }}', { variant: 'spent' })],
128
+ flows: [[onClick(), carouselPrevious('picks', 'page')]]
129
+ }),
130
+ button({
131
+ content: '›',
132
+ title: 'More picks',
133
+ class: arrow,
134
+ bind: [activeWhen(arrow, '{{ carousel_picks.atEnd }}', { variant: 'spent' })],
135
+ flows: [[onClick(), carouselNext('picks', 'page')]]
136
+ }),
137
+ text({ from: 'picks.index', as: '{{ source + 1 }} of {{ carousel_picks.count }}' })
138
+ ]
139
+ })
135
140
  ]
136
141
  })
137
142
  ]
@@ -3,7 +3,7 @@
3
3
  * address names — with a message, not an empty page, when no product has that name, and status 404: the provider is
4
4
  * resolved on the server, and `notFound` says when its answer holds nothing for this address.
5
5
  */
6
- import { apiContainer, heading, link, list, text, listItem } from '@plitzi/sdk-authoring';
6
+ import { apiContainer, container, heading, link, list, listItem, text } from '@plitzi/sdk-authoring';
7
7
 
8
8
  import type { SpaceSpec } from '@plitzi/sdk-authoring';
9
9
 
@@ -16,21 +16,26 @@ export const recipe: SpaceSpec = {
16
16
  name: 'Home',
17
17
  slug: '',
18
18
  body: [
19
- apiContainer({
20
- id: 'catalog',
21
- query: '/data/products.json',
22
- cache: true,
19
+ container({
20
+ subType: 'main',
23
21
  children: [
24
- list({
25
- id: 'products',
26
- items: 'catalog.data.products',
22
+ apiContainer({
23
+ id: 'catalog',
24
+ query: '/data/products.json',
25
+ cache: true,
27
26
  children: [
28
- listItem({
27
+ list({
28
+ id: 'products',
29
+ items: 'catalog.data.products',
29
30
  children: [
30
- // An attribute reads a name with filters, spelled in full.
31
- link({
32
- href: '/products/{{ list_products.item.slug|url_encode }}',
33
- children: [text({ from: 'products.item.title' })]
31
+ listItem({
32
+ children: [
33
+ // An attribute reads a name with filters, spelled in full.
34
+ link({
35
+ href: '/products/{{ list_products.item.slug|url_encode }}',
36
+ children: [text({ from: 'products.item.title' })]
37
+ })
38
+ ]
34
39
  })
35
40
  ]
36
41
  })
@@ -45,27 +50,32 @@ export const recipe: SpaceSpec = {
45
50
  name: 'Product',
46
51
  slug: 'products/:slug',
47
52
  body: [
48
- apiContainer({
49
- id: 'catalog-one',
50
- query: '/data/products.json',
51
- runtime: 'server',
52
- notFound: "{{ not (source.data.products|find('slug', navigation.routeParams.slug)) }}",
53
+ container({
54
+ subType: 'main',
53
55
  children: [
54
- list({
55
- id: 'this-product',
56
- from: 'catalog-one.data.products',
57
- as: '{{ source|filter(p => p.slug == navigation.routeParams.slug) }}',
58
- visible: {
59
- source: 'catalog-one.data.products',
60
- template: "{{ source|find('slug', navigation.routeParams.slug) }}"
61
- },
62
- children: [listItem({ children: [heading({ subType: 'h1', from: 'this-product.item.title' })] })]
63
- }),
64
- text('No product by that name.', {
65
- visible: {
66
- source: 'catalog-one.data.products',
67
- template: "{{ source is defined and not (source|find('slug', navigation.routeParams.slug)) }}"
68
- }
56
+ apiContainer({
57
+ id: 'catalog-one',
58
+ query: '/data/products.json',
59
+ runtime: 'server',
60
+ notFound: "{{ not (source.data.products|find('slug', navigation.routeParams.slug)) }}",
61
+ children: [
62
+ list({
63
+ id: 'this-product',
64
+ from: 'catalog-one.data.products',
65
+ as: '{{ source|filter(p => p.slug == navigation.routeParams.slug) }}',
66
+ visible: {
67
+ source: 'catalog-one.data.products',
68
+ template: "{{ source|find('slug', navigation.routeParams.slug) }}"
69
+ },
70
+ children: [listItem({ children: [heading({ subType: 'h1', from: 'this-product.item.title' })] })]
71
+ }),
72
+ text('No product by that name.', {
73
+ visible: {
74
+ source: 'catalog-one.data.products',
75
+ template: "{{ source is defined and not (source|find('slug', navigation.routeParams.slug)) }}"
76
+ }
77
+ })
78
+ ]
69
79
  })
70
80
  ]
71
81
  })
@@ -31,19 +31,24 @@ export const recipe: SpaceSpec = {
31
31
  slug: '',
32
32
  body: [
33
33
  container({
34
- subType: 'section',
34
+ subType: 'main',
35
35
  children: [
36
- heading('Find us', { subType: 'h2' }),
37
- embed({
38
- id: 'shop-map',
39
- class: frame,
40
- src: 'https://www.openstreetmap.org/export/embed.html?bbox=-3.71,40.41,-3.69,40.42',
41
- title: 'Our shop on the map'
42
- })
36
+ container({
37
+ subType: 'section',
38
+ children: [
39
+ heading('Find us', { subType: 'h2' }),
40
+ embed({
41
+ id: 'shop-map',
42
+ class: frame,
43
+ src: 'https://www.openstreetmap.org/export/embed.html?bbox=-3.71,40.41,-3.69,40.42',
44
+ title: 'Our shop on the map'
45
+ })
46
+ ]
47
+ }),
48
+ svg(CHECK, { class: badge }),
49
+ svg(CHECK, { class: badge, label: 'Verified' })
43
50
  ]
44
- }),
45
- svg(CHECK, { class: badge }),
46
- svg(CHECK, { class: badge, label: 'Verified' })
51
+ })
47
52
  ]
48
53
  }
49
54
  ]
@@ -68,54 +68,64 @@ export const recipe: SpaceSpec = {
68
68
  slug: '',
69
69
  body: [
70
70
  container({
71
- id: 'carousel',
72
- subType: 'section',
73
- label: 'Offers',
74
- flows: [
75
- // Each tick turns it, unless the pointer is on it.
76
- [onInterval(5000), when({ field: 'state.carouselPaused', operator: '!=', value: 'true' }, next)],
77
- [on('onMouseEnter'), setState({ key: 'carouselPaused', type: 'boolean', value: true })],
78
- [on('onMouseLeave'), setState({ key: 'carouselPaused', type: 'boolean', value: false })]
79
- ],
71
+ subType: 'main',
80
72
  children: [
81
- list({
82
- id: 'slides',
83
- items: SLIDES,
73
+ container({
74
+ id: 'carousel',
75
+ subType: 'section',
76
+ label: 'Offers',
77
+ flows: [
78
+ // Each tick turns it, unless the pointer is on it.
79
+ [onInterval(5000), when({ field: 'state.carouselPaused', operator: '!=', value: 'true' }, next)],
80
+ [on('onMouseEnter'), setState({ key: 'carouselPaused', type: 'boolean', value: true })],
81
+ [on('onMouseLeave'), setState({ key: 'carouselPaused', type: 'boolean', value: false })]
82
+ ],
84
83
  children: [
85
- listItem({
86
- class: slide,
87
- visible: { source: 'slides.index', template: '{{ source == (state.slide ?? 0) }}' },
88
- children: [heading({ subType: 'h2', from: 'slides.item.title' }), text({ from: 'slides.item.body' })]
89
- })
90
- ]
91
- }),
92
- button({
93
- content: 'Previous',
94
- flows: [[onClick(), previous]]
95
- }),
96
- button({
97
- content: 'Next',
98
- flows: [[onClick(), next]]
99
- }),
100
- list({
101
- id: 'dots',
102
- class: dots,
103
- items: SLIDES,
104
- children: [
105
- listItem({
84
+ list({
85
+ id: 'slides',
86
+ items: SLIDES,
87
+ children: [
88
+ listItem({
89
+ class: slide,
90
+ visible: { source: 'slides.index', template: '{{ source == (state.slide ?? 0) }}' },
91
+ children: [
92
+ heading({ subType: 'h2', from: 'slides.item.title' }),
93
+ text({ from: 'slides.item.body' })
94
+ ]
95
+ })
96
+ ]
97
+ }),
98
+ button({
99
+ content: 'Previous',
100
+ flows: [[onClick(), previous]]
101
+ }),
102
+ button({
103
+ content: 'Next',
104
+ flows: [[onClick(), next]]
105
+ }),
106
+ list({
107
+ id: 'dots',
108
+ class: dots,
109
+ items: SLIDES,
106
110
  children: [
107
- button({
108
- content: '',
109
- title: 'Show this offer',
110
- class: dot,
111
- bind: [activeWhen(dot, '{{ list_dots.index == (state.slide ?? 0) }}')],
112
- flows: [[onClick(), setState({ key: 'slide', type: 'number', value: '{{ list_dots.index }}' })]]
111
+ listItem({
112
+ children: [
113
+ button({
114
+ content: '',
115
+ title: 'Show this offer',
116
+ class: dot,
117
+ bind: [activeWhen(dot, '{{ list_dots.index == (state.slide ?? 0) }}')],
118
+ flows: [
119
+ [onClick(), setState({ key: 'slide', type: 'number', value: '{{ list_dots.index }}' })]
120
+ ]
121
+ })
122
+ ]
113
123
  })
114
124
  ]
115
- })
125
+ }),
126
+ text({ from: 'state.slide', as: '{{ (source ?? 0) + 1 }} of 3' })
116
127
  ]
117
- }),
118
- text({ from: 'state.slide', as: '{{ (source ?? 0) + 1 }} of 3' })
128
+ })
119
129
  ]
120
130
  })
121
131
  ]
@@ -16,8 +16,13 @@ export const recipe: SpaceSpec = {
16
16
  name: 'Home',
17
17
  slug: '',
18
18
  body: [
19
- container({ id: 'checkout-new', flag: 'newCheckout', children: [text('One step')] }),
20
- container({ id: 'checkout-old', flag: '!newCheckout', children: [text('Three steps')] })
19
+ container({
20
+ subType: 'main',
21
+ children: [
22
+ container({ id: 'checkout-new', flag: 'newCheckout', children: [text('One step')] }),
23
+ container({ id: 'checkout-old', flag: '!newCheckout', children: [text('Three steps')] })
24
+ ]
25
+ })
21
26
  ]
22
27
  }
23
28
  ]
@@ -2,7 +2,7 @@
2
2
  * Filter and sort a list: a select writes the chosen category to `state`, and the list is bound through a template
3
3
  * that hands over its VALUE — only the matching rows are rendered, with a count and an empty state over the same rows.
4
4
  */
5
- import { apiContainer, formControl, list, named, on, setState, text, listItem } from '@plitzi/sdk-authoring';
5
+ import { apiContainer, container, formControl, list, listItem, named, on, setState, text } from '@plitzi/sdk-authoring';
6
6
 
7
7
  import type { SpaceSpec } from '@plitzi/sdk-authoring';
8
8
 
@@ -19,38 +19,46 @@ export const recipe: SpaceSpec = {
19
19
  name: 'Home',
20
20
  slug: '',
21
21
  body: [
22
- // A control outside a form keeps its own value and fires `onChange` with `{ value, name }`: no form needed.
23
- formControl({
24
- name: 'category',
25
- label: 'Category',
26
- subType: 'select',
27
- options: [
28
- { label: 'Everything', value: 'all' },
29
- { label: 'Processors', value: 'cpu' },
30
- { label: 'Graphics cards', value: 'gpu' }
31
- ],
32
- defaultValue: 'all',
33
- flows: [
34
- [named('picked', on('onChange')), setState({ key: 'category', type: 'text', value: '{{ picked.value }}' })]
35
- ]
36
- }),
37
- apiContainer({
38
- id: 'catalog',
39
- query: '/data/products.json',
40
- cache: true,
22
+ container({
23
+ subType: 'main',
41
24
  children: [
42
- text({ from: 'catalog.data.products', as: `{{ ${shown}|length }} shown` }),
43
- list({
44
- id: 'shown',
45
- from: 'catalog.data.products',
46
- as: `{{ ${shown} }}`,
47
- children: [listItem({ children: [text({ from: 'shown.item.title' })] })]
25
+ // A control outside a form keeps its own value and fires `onChange` with `{ value, name }`: no form needed.
26
+ formControl({
27
+ name: 'category',
28
+ label: 'Category',
29
+ subType: 'select',
30
+ options: [
31
+ { label: 'Everything', value: 'all' },
32
+ { label: 'Processors', value: 'cpu' },
33
+ { label: 'Graphics cards', value: 'gpu' }
34
+ ],
35
+ defaultValue: 'all',
36
+ flows: [
37
+ [
38
+ named('picked', on('onChange')),
39
+ setState({ key: 'category', type: 'text', value: '{{ picked.value }}' })
40
+ ]
41
+ ]
48
42
  }),
49
- text('Nothing in that category.', {
50
- visible: {
51
- source: 'catalog.data.products',
52
- template: `{{ source is defined and ${shown}|length == 0 }}`
53
- }
43
+ apiContainer({
44
+ id: 'catalog',
45
+ query: '/data/products.json',
46
+ cache: true,
47
+ children: [
48
+ text({ from: 'catalog.data.products', as: `{{ ${shown}|length }} shown` }),
49
+ list({
50
+ id: 'shown',
51
+ from: 'catalog.data.products',
52
+ as: `{{ ${shown} }}`,
53
+ children: [listItem({ children: [text({ from: 'shown.item.title' })] })]
54
+ }),
55
+ text('Nothing in that category.', {
56
+ visible: {
57
+ source: 'catalog.data.products',
58
+ template: `{{ source is defined and ${shown}|length == 0 }}`
59
+ }
60
+ })
61
+ ]
54
62
  })
55
63
  ]
56
64
  })
@@ -5,6 +5,7 @@
5
5
  import {
6
6
  button,
7
7
  closeModal,
8
+ container,
8
9
  form,
9
10
  formControl,
10
11
  modalContainer,
@@ -28,36 +29,41 @@ export const recipe: SpaceSpec = {
28
29
  name: 'Home',
29
30
  slug: '',
30
31
  body: [
31
- button({ content: 'Save', flows: [[onClick(), setState({ key: 'saved', type: 'boolean', value: true })]] }),
32
- // A switch is named for how it leaves its default: shown until somebody hides it.
33
- button({ content: 'Hide details', flows: [[onClick(), toggleState({ key: 'detailsHidden' })]] }),
34
- form({
35
- id: 'signup',
36
- managedByInteractions: true,
37
- flows: [
38
- [named('sent', onSubmit()), setState({ key: 'email', type: 'text', value: '{{ sent.values.email }}' })]
39
- ],
32
+ container({
33
+ subType: 'main',
40
34
  children: [
41
- // Optional unless it says so, as an HTML field is: a sign-up without an address is no sign-up.
42
- formControl({ name: 'email', label: 'Email', subType: 'email', required: true }),
43
- button({ content: 'Sign up', subType: 'submit' })
35
+ button({ content: 'Save', flows: [[onClick(), setState({ key: 'saved', type: 'boolean', value: true })]] }),
36
+ // A switch is named for how it leaves its default: shown until somebody hides it.
37
+ button({ content: 'Hide details', flows: [[onClick(), toggleState({ key: 'detailsHidden' })]] }),
38
+ form({
39
+ id: 'signup',
40
+ managedByInteractions: true,
41
+ flows: [
42
+ [named('sent', onSubmit()), setState({ key: 'email', type: 'text', value: '{{ sent.values.email }}' })]
43
+ ],
44
+ children: [
45
+ // Optional unless it says so, as an HTML field is: a sign-up without an address is no sign-up.
46
+ formControl({ name: 'email', label: 'Email', subType: 'email', required: true }),
47
+ button({ content: 'Sign up', subType: 'submit' })
48
+ ]
49
+ }),
50
+ modalContainer({
51
+ id: 'details',
52
+ visible: false,
53
+ title: 'Details',
54
+ children: [
55
+ text('What the modal says.'),
56
+ button({
57
+ content: '',
58
+ title: 'Close',
59
+ icon: 'fa-solid fa-xmark',
60
+ flows: [[onClick(), closeModal('details')]]
61
+ })
62
+ ]
63
+ }),
64
+ button({ content: 'Open', flows: [[onClick(), openModal('details')]] })
44
65
  ]
45
- }),
46
- modalContainer({
47
- id: 'details',
48
- visible: false,
49
- title: 'Details',
50
- children: [
51
- text('What the modal says.'),
52
- button({
53
- content: '',
54
- title: 'Close',
55
- icon: 'fa-solid fa-xmark',
56
- flows: [[onClick(), closeModal('details')]]
57
- })
58
- ]
59
- }),
60
- button({ content: 'Open', flows: [[onClick(), openModal('details')]] })
66
+ })
61
67
  ]
62
68
  }
63
69
  ]