@plitzi/sdk-authoring 0.39.3 → 0.39.4
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/CHANGELOG.md +7 -0
- package/dist/index-src.js +1204 -997
- package/dist/index.d.ts +73 -6
- package/dist/node.d.ts +57 -5
- package/dist/plugin.d.ts +1 -1
- package/package.json +7 -7
- package/skills/plitzi-authoring/recipes/accordion.ts +3 -1
- package/skills/plitzi-authoring/recipes/carousel.ts +68 -63
- package/skills/plitzi-authoring/recipes/detail-page.ts +43 -33
- package/skills/plitzi-authoring/recipes/embed-and-svg.ts +16 -11
- package/skills/plitzi-authoring/recipes/every-few-seconds.ts +52 -42
- package/skills/plitzi-authoring/recipes/feature-flag.ts +7 -2
- package/skills/plitzi-authoring/recipes/filter-a-list.ts +39 -31
- package/skills/plitzi-authoring/recipes/forms-and-modals.ts +34 -28
- package/skills/plitzi-authoring/recipes/from-tailwind.ts +11 -6
- package/skills/plitzi-authoring/recipes/link-to-a-section.ts +11 -6
- package/skills/plitzi-authoring/recipes/link-with-data.ts +21 -16
- package/skills/plitzi-authoring/recipes/marquee.ts +17 -12
- package/skills/plitzi-authoring/recipes/plugin.ts +16 -10
- package/skills/plitzi-authoring/recipes/scroll-a-row.ts +30 -25
- package/skills/plitzi-authoring/recipes/server-data.ts +15 -10
- package/skills/plitzi-authoring/recipes/show-data.ts +32 -24
- package/skills/plitzi-authoring/recipes/style-a-page.ts +9 -4
- package/skills/plitzi-authoring/recipes/typed-data.ts +26 -21
- package/skills/plitzi-authoring/recipes/usable-without-sight.ts +16 -11
- package/skills/plitzi-authoring/reference/authoring-errors.md +3 -0
- package/skills/plitzi-authoring/reference/efficiency.md +2 -1
|
@@ -68,54 +68,64 @@ export const recipe: SpaceSpec = {
|
|
|
68
68
|
slug: '',
|
|
69
69
|
body: [
|
|
70
70
|
container({
|
|
71
|
-
|
|
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
|
-
|
|
82
|
-
id: '
|
|
83
|
-
|
|
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
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
children: [
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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({
|
|
20
|
-
|
|
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
|
|
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
|
-
|
|
23
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
32
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
button({ content: '
|
|
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
|
]
|
|
@@ -40,12 +40,17 @@ export const recipe: SpaceSpec = {
|
|
|
40
40
|
slug: '',
|
|
41
41
|
body: [
|
|
42
42
|
container({
|
|
43
|
-
|
|
44
|
-
children: [
|
|
45
|
-
container({
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
subType: 'main',
|
|
44
|
+
children: [
|
|
45
|
+
container({
|
|
46
|
+
class: grid,
|
|
47
|
+
children: ['Fast', 'Typed', 'Yours'].map(name =>
|
|
48
|
+
container({ class: card, children: [heading(name, { subType: 'h3', class: title }), text('…')] })
|
|
49
|
+
)
|
|
50
|
+
}),
|
|
51
|
+
link({ href: '/start', class: cta, content: 'Get started' })
|
|
52
|
+
]
|
|
53
|
+
})
|
|
49
54
|
]
|
|
50
55
|
}
|
|
51
56
|
]
|
|
@@ -15,12 +15,17 @@ export const recipe: SpaceSpec = {
|
|
|
15
15
|
name: 'Home',
|
|
16
16
|
slug: '',
|
|
17
17
|
body: [
|
|
18
|
-
link({ href: 'home', hash: 'plans', content: 'See the plans' }),
|
|
19
18
|
container({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
subType: 'main',
|
|
20
|
+
children: [
|
|
21
|
+
link({ href: 'home', hash: 'plans', content: 'See the plans' }),
|
|
22
|
+
container({
|
|
23
|
+
id: 'plans-section',
|
|
24
|
+
subType: 'section',
|
|
25
|
+
anchor: 'plans',
|
|
26
|
+
children: [heading('Plans', { subType: 'h2' }), text('Three of them.')]
|
|
27
|
+
})
|
|
28
|
+
]
|
|
24
29
|
})
|
|
25
30
|
]
|
|
26
31
|
},
|
|
@@ -29,7 +34,7 @@ export const recipe: SpaceSpec = {
|
|
|
29
34
|
name: 'About',
|
|
30
35
|
slug: 'about',
|
|
31
36
|
// → /#plans
|
|
32
|
-
body: [link({ href: 'home', hash: 'plans', content: 'Plans' })]
|
|
37
|
+
body: [container({ subType: 'main', children: [link({ href: 'home', hash: 'plans', content: 'Plans' })] })]
|
|
33
38
|
}
|
|
34
39
|
]
|
|
35
40
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* A link built from the row it is in — here "ask about this product" on WhatsApp, with the product's name in the
|
|
3
3
|
* message. An attribute resolves a name with filters, so the text is encoded with `url_encode`.
|
|
4
4
|
*/
|
|
5
|
-
import { apiContainer, link, list, listItem } from '@plitzi/sdk-authoring';
|
|
5
|
+
import { apiContainer, container, link, list, listItem } from '@plitzi/sdk-authoring';
|
|
6
6
|
|
|
7
7
|
import type { SpaceSpec } from '@plitzi/sdk-authoring';
|
|
8
8
|
|
|
@@ -15,24 +15,29 @@ export const recipe: SpaceSpec = {
|
|
|
15
15
|
name: 'Home',
|
|
16
16
|
slug: '',
|
|
17
17
|
body: [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
query: '/data/products.json',
|
|
21
|
-
cache: true,
|
|
18
|
+
container({
|
|
19
|
+
subType: 'main',
|
|
22
20
|
children: [
|
|
23
|
-
|
|
24
|
-
id: '
|
|
25
|
-
|
|
21
|
+
apiContainer({
|
|
22
|
+
id: 'catalog',
|
|
23
|
+
query: '/data/products.json',
|
|
24
|
+
cache: true,
|
|
26
25
|
children: [
|
|
27
|
-
|
|
26
|
+
list({
|
|
27
|
+
id: 'products',
|
|
28
|
+
items: 'catalog.data.products',
|
|
28
29
|
children: [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
listItem({
|
|
31
|
+
children: [
|
|
32
|
+
link({
|
|
33
|
+
target: 'blank',
|
|
34
|
+
href: 'https://wa.me/34600000000?text={{ list_products.item.title|url_encode }}',
|
|
35
|
+
icon: 'fa-brands fa-whatsapp',
|
|
36
|
+
content: 'Ask about it'
|
|
37
|
+
}),
|
|
38
|
+
link({ href: 'mailto:shop@example.com', content: 'Write to us' })
|
|
39
|
+
]
|
|
40
|
+
})
|
|
36
41
|
]
|
|
37
42
|
})
|
|
38
43
|
]
|
|
@@ -32,20 +32,25 @@ export const recipe: SpaceSpec = {
|
|
|
32
32
|
name: 'Home',
|
|
33
33
|
slug: '',
|
|
34
34
|
body: [
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
query: '/data/brands.json',
|
|
38
|
-
cache: true,
|
|
35
|
+
container({
|
|
36
|
+
subType: 'main',
|
|
39
37
|
children: [
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
apiContainer({
|
|
39
|
+
id: 'catalog',
|
|
40
|
+
query: '/data/brands.json',
|
|
41
|
+
cache: true,
|
|
42
42
|
children: [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
container({
|
|
44
|
+
class: marquee,
|
|
45
|
+
children: [
|
|
46
|
+
list({
|
|
47
|
+
id: 'brands',
|
|
48
|
+
class: track,
|
|
49
|
+
from: 'catalog.data.brands',
|
|
50
|
+
as: '{{ source|merge(source)|merge(source) }}',
|
|
51
|
+
children: [listItem({ children: [text({ from: 'brands.item' })] })]
|
|
52
|
+
})
|
|
53
|
+
]
|
|
49
54
|
})
|
|
50
55
|
]
|
|
51
56
|
})
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import {
|
|
6
6
|
button,
|
|
7
|
+
container,
|
|
7
8
|
declaredCallback,
|
|
8
9
|
declaredTrigger,
|
|
9
10
|
defineElement,
|
|
@@ -38,17 +39,22 @@ export const recipe: SpaceSpec = {
|
|
|
38
39
|
name: 'Home',
|
|
39
40
|
slug: '',
|
|
40
41
|
body: [
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
container({
|
|
43
|
+
subType: 'main',
|
|
44
|
+
children: [
|
|
45
|
+
seatPicker({
|
|
46
|
+
id: 'seats',
|
|
47
|
+
rows: 12,
|
|
48
|
+
flows: [
|
|
49
|
+
[
|
|
50
|
+
named('picked', declaredTrigger(declaration, 'onPick')),
|
|
51
|
+
setState({ key: 'seat', type: 'text', value: '{{ picked.seat }}' })
|
|
52
|
+
]
|
|
53
|
+
]
|
|
54
|
+
}),
|
|
55
|
+
button({ content: 'Clear', flows: [[onClick(), declaredCallback(declaration, 'reset', { on: 'seats' })]] })
|
|
49
56
|
]
|
|
50
|
-
})
|
|
51
|
-
button({ content: 'Clear', flows: [[onClick(), declaredCallback(declaration, 'reset', { on: 'seats' })]] })
|
|
57
|
+
})
|
|
52
58
|
]
|
|
53
59
|
}
|
|
54
60
|
]
|
|
@@ -43,32 +43,37 @@ export const recipe: SpaceSpec = {
|
|
|
43
43
|
slug: '',
|
|
44
44
|
body: [
|
|
45
45
|
container({
|
|
46
|
+
subType: 'main',
|
|
46
47
|
children: [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
48
|
+
container({
|
|
49
|
+
children: [
|
|
50
|
+
// Shown until the row says it is at that end: the arrows are there before anybody scrolls.
|
|
51
|
+
button({
|
|
52
|
+
content: '‹',
|
|
53
|
+
title: 'Previous categories',
|
|
54
|
+
visible: '!state.rowAtStart',
|
|
55
|
+
flows: [[onClick(), scrollBy('categories', { x: '-80%' })]]
|
|
56
|
+
}),
|
|
57
|
+
list({
|
|
58
|
+
id: 'categories',
|
|
59
|
+
class: row,
|
|
60
|
+
items: CATEGORIES,
|
|
61
|
+
flows: [
|
|
62
|
+
[
|
|
63
|
+
named('moved', onScroll()),
|
|
64
|
+
setState({ key: 'rowAtStart', type: 'boolean', value: '{{ moved.atStart }}' }),
|
|
65
|
+
setState({ key: 'rowAtEnd', type: 'boolean', value: '{{ moved.atEnd }}' })
|
|
66
|
+
]
|
|
67
|
+
],
|
|
68
|
+
children: [listItem({ class: card, children: [text({ from: 'categories.item' })] })]
|
|
69
|
+
}),
|
|
70
|
+
button({
|
|
71
|
+
content: '›',
|
|
72
|
+
title: 'More categories',
|
|
73
|
+
visible: '!state.rowAtEnd',
|
|
74
|
+
flows: [[onClick(), scrollBy('categories', { x: '80%' })]]
|
|
75
|
+
})
|
|
76
|
+
]
|
|
72
77
|
})
|
|
73
78
|
]
|
|
74
79
|
})
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* - An API's answer for the signed-in visitor (`credentials: 'include'`) is asked with their cookies only where the
|
|
15
15
|
* server names that API and trusts the space (`rsc.visitorCredentials`); anywhere else the provider's error says so.
|
|
16
16
|
*/
|
|
17
|
-
import { apiContainer, heading, list, listItem, styles, text } from '@plitzi/sdk-authoring';
|
|
17
|
+
import { apiContainer, container, heading, list, listItem, styles, text } from '@plitzi/sdk-authoring';
|
|
18
18
|
|
|
19
19
|
import type { SpaceSpec } from '@plitzi/sdk-authoring';
|
|
20
20
|
|
|
@@ -50,16 +50,21 @@ export const recipe: SpaceSpec = {
|
|
|
50
50
|
name: 'Home',
|
|
51
51
|
slug: '',
|
|
52
52
|
body: [
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
query: '/data/plans.json',
|
|
56
|
-
runtime: 'server',
|
|
57
|
-
mockData: { plans: [{ name: 'Starter', price: '$0' }] },
|
|
53
|
+
container({
|
|
54
|
+
subType: 'main',
|
|
58
55
|
children: [
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
apiContainer({
|
|
57
|
+
id: 'plans',
|
|
58
|
+
query: '/data/plans.json',
|
|
59
|
+
runtime: 'server',
|
|
60
|
+
mockData: { plans: [{ name: 'Starter', price: '$0' }] },
|
|
61
|
+
children: [
|
|
62
|
+
// `plans.data.plans` — the file's `plans` — in either runtime.
|
|
63
|
+
list({ id: 'plan-list', class: grid, items: 'plans.data.plans', row: 'plan-card' }),
|
|
64
|
+
text('No plans yet.', {
|
|
65
|
+
visible: { source: 'plans.data.plans', template: '{{ source is defined and source|length == 0 }}' }
|
|
66
|
+
})
|
|
67
|
+
]
|
|
63
68
|
})
|
|
64
69
|
]
|
|
65
70
|
})
|