@plitzi/sdk-server 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 (89) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +50 -8
  3. package/dist/adapters/cloudAdapters.d.ts +7 -0
  4. package/dist/adapters/space/index.d.ts +2 -0
  5. package/dist/adapters/space/resolvers.d.ts +14 -3
  6. package/dist/adapters/space/snapshotPreview.d.ts +45 -0
  7. package/dist/adapters/space/types.d.ts +4 -1
  8. package/dist/auth.d.ts +3 -2
  9. package/dist/auth.js +26 -107
  10. package/dist/cache.js +1 -1
  11. package/dist/chunks/{buildBody-W9D8ySNY.js → buildBody-Bm398uxH.js} +893 -114
  12. package/dist/chunks/{core-TlrWmT4B.js → core-CoKORAOg.js} +234 -26
  13. package/dist/chunks/{createServer-Bd_b7T3k.js → createServer-BSmQqzwb.js} +186 -639
  14. package/dist/chunks/{platform-DhdFYWm5.js → platform-BTssQQXp.js} +2 -2
  15. package/dist/chunks/sdkAssets-CXGoc_WE.js +60 -0
  16. package/dist/chunks/throttle-CRiZB6_A.js +330 -0
  17. package/dist/chunks/{token-B2uY9JzU.js → token-XEz1n4jp.js} +1 -1
  18. package/dist/chunks/views/template.ejs +12 -0
  19. package/dist/core/auth/api/context.d.ts +4 -4
  20. package/dist/core/auth/api/values.d.ts +6 -0
  21. package/dist/core/auth/createAuth.d.ts +1 -1
  22. package/dist/core/auth/throttle.d.ts +54 -4
  23. package/dist/core/createServer.d.ts +1 -1
  24. package/dist/core/platform.d.ts +1 -1
  25. package/dist/core/services/iconFaces.d.ts +3 -0
  26. package/dist/core/services/llmsTxt.d.ts +15 -0
  27. package/dist/core/services/robotsTxt.d.ts +5 -9
  28. package/dist/core/services/securityTxt.d.ts +10 -0
  29. package/dist/deploy/aws/s3.d.ts +51 -0
  30. package/dist/deploy/aws/sigv4.d.ts +33 -0
  31. package/dist/deploy/contentType.d.ts +2 -0
  32. package/dist/deploy/fingerprint.d.ts +18 -0
  33. package/dist/deploy/folder.d.ts +6 -0
  34. package/dist/deploy/ftp.d.ts +27 -0
  35. package/dist/deploy/sdkFiles.d.ts +11 -0
  36. package/dist/deploy/spaShell.d.ts +35 -0
  37. package/dist/deploy/staticSite.d.ts +44 -0
  38. package/dist/deploy/types.d.ts +58 -0
  39. package/dist/deploy/zip.d.ts +8 -0
  40. package/dist/deploy.d.ts +24 -0
  41. package/dist/deploy.js +938 -0
  42. package/dist/handlers.js +1 -1
  43. package/dist/helpers/documentParts.d.ts +10 -0
  44. package/dist/helpers/ownVersion.d.ts +1 -0
  45. package/dist/helpers/paintedCookie.d.ts +15 -1
  46. package/dist/index.d.ts +1 -1
  47. package/dist/index.js +3 -3
  48. package/dist/modules/icons/glyphs.d.ts +21 -0
  49. package/dist/modules/icons/handler.d.ts +11 -0
  50. package/dist/modules/icons/spaceIcons.d.ts +26 -0
  51. package/dist/modules/rsc/connectorRscData.d.ts +4 -2
  52. package/dist/modules/rsc/resolveRscData.d.ts +4 -1
  53. package/dist/modules/ssr/csrfHint.d.ts +12 -0
  54. package/dist/modules/ssr/defaultFavicon.d.ts +1 -1
  55. package/dist/modules/ssr/spaceDocument.d.ts +8 -1
  56. package/dist/oauth.js +1 -1
  57. package/dist/platform.d.ts +1 -1
  58. package/dist/platform.js +1 -1
  59. package/dist/project.js +3 -3
  60. package/dist/spaces.d.ts +2 -2
  61. package/dist/spaces.js +1 -1
  62. package/dist/ssr.d.ts +1 -1
  63. package/dist/ssr.js +1 -1
  64. package/dist/types/config.d.ts +24 -0
  65. package/dist/types/index.d.ts +1 -1
  66. package/package.json +17 -13
  67. package/skills/plitzi-authoring/recipes/accordion.ts +3 -1
  68. package/skills/plitzi-authoring/recipes/carousel.ts +68 -63
  69. package/skills/plitzi-authoring/recipes/detail-page.ts +43 -33
  70. package/skills/plitzi-authoring/recipes/embed-and-svg.ts +16 -11
  71. package/skills/plitzi-authoring/recipes/every-few-seconds.ts +52 -42
  72. package/skills/plitzi-authoring/recipes/feature-flag.ts +7 -2
  73. package/skills/plitzi-authoring/recipes/filter-a-list.ts +39 -31
  74. package/skills/plitzi-authoring/recipes/forms-and-modals.ts +34 -28
  75. package/skills/plitzi-authoring/recipes/from-tailwind.ts +11 -6
  76. package/skills/plitzi-authoring/recipes/link-to-a-section.ts +11 -6
  77. package/skills/plitzi-authoring/recipes/link-with-data.ts +21 -16
  78. package/skills/plitzi-authoring/recipes/marquee.ts +17 -12
  79. package/skills/plitzi-authoring/recipes/plugin.ts +16 -10
  80. package/skills/plitzi-authoring/recipes/scroll-a-row.ts +30 -25
  81. package/skills/plitzi-authoring/recipes/server-data.ts +15 -10
  82. package/skills/plitzi-authoring/recipes/show-data.ts +32 -24
  83. package/skills/plitzi-authoring/recipes/style-a-page.ts +9 -4
  84. package/skills/plitzi-authoring/recipes/typed-data.ts +26 -21
  85. package/skills/plitzi-authoring/recipes/usable-without-sight.ts +16 -11
  86. package/skills/plitzi-authoring/reference/authoring-errors.md +11 -4
  87. package/skills/plitzi-authoring/reference/efficiency.md +3 -1
  88. package/skills/plitzi-authoring/reference/layouts.md +2 -1
  89. package/dist/chunks/throttle-BH7JLIOF.js +0 -108
@@ -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
  ]
@@ -40,12 +40,17 @@ export const recipe: SpaceSpec = {
40
40
  slug: '',
41
41
  body: [
42
42
  container({
43
- class: grid,
44
- children: ['Fast', 'Typed', 'Yours'].map(name =>
45
- container({ class: card, children: [heading(name, { subType: 'h3', class: title }), text('…')] })
46
- )
47
- }),
48
- link({ href: '/start', class: cta, content: 'Get started' })
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
- id: 'plans-section',
21
- subType: 'section',
22
- anchor: 'plans',
23
- children: [heading('Plans', { subType: 'h2' }), text('Three of them.')]
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
- apiContainer({
19
- id: 'catalog',
20
- query: '/data/products.json',
21
- cache: true,
18
+ container({
19
+ subType: 'main',
22
20
  children: [
23
- list({
24
- id: 'products',
25
- items: 'catalog.data.products',
21
+ apiContainer({
22
+ id: 'catalog',
23
+ query: '/data/products.json',
24
+ cache: true,
26
25
  children: [
27
- listItem({
26
+ list({
27
+ id: 'products',
28
+ items: 'catalog.data.products',
28
29
  children: [
29
- link({
30
- target: 'blank',
31
- href: 'https://wa.me/34600000000?text={{ list_products.item.title|url_encode }}',
32
- icon: 'fa-brands fa-whatsapp',
33
- content: 'Ask about it'
34
- }),
35
- link({ href: 'mailto:shop@example.com', content: 'Write to us' })
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
- apiContainer({
36
- id: 'catalog',
37
- query: '/data/brands.json',
38
- cache: true,
35
+ container({
36
+ subType: 'main',
39
37
  children: [
40
- container({
41
- class: marquee,
38
+ apiContainer({
39
+ id: 'catalog',
40
+ query: '/data/brands.json',
41
+ cache: true,
42
42
  children: [
43
- list({
44
- id: 'brands',
45
- class: track,
46
- from: 'catalog.data.brands',
47
- as: '{{ source|merge(source)|merge(source) }}',
48
- children: [listItem({ children: [text({ from: 'brands.item' })] })]
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
- seatPicker({
42
- id: 'seats',
43
- rows: 12,
44
- flows: [
45
- [
46
- named('picked', declaredTrigger(declaration, 'onPick')),
47
- setState({ key: 'seat', type: 'text', value: '{{ picked.seat }}' })
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
  ]