@terreno/blocks 57.11.0 → 57.13.0

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 (58) hide show
  1. package/dist/errors.d.ts +2 -0
  2. package/dist/errors.js +2 -0
  3. package/dist/index.d.ts +7 -2
  4. package/dist/index.js +13 -1
  5. package/dist/interactive.d.ts +26 -0
  6. package/dist/interactive.js +62 -0
  7. package/dist/limits.d.ts +26 -0
  8. package/dist/limits.js +26 -0
  9. package/dist/lint.d.ts +18 -1
  10. package/dist/lint.js +186 -26
  11. package/dist/plainText.d.ts +17 -0
  12. package/dist/plainText.js +56 -0
  13. package/dist/prompt.d.ts +10 -1
  14. package/dist/prompt.js +73 -3
  15. package/dist/schema.d.ts +113 -2
  16. package/dist/schema.js +121 -5
  17. package/dist/validate.js +26 -2
  18. package/package.json +1 -1
  19. package/src/__snapshots__/prompt.test.ts.snap +530 -0
  20. package/src/errors.ts +4 -0
  21. package/src/fixtures/golden/sunday-roast.yaml +174 -0
  22. package/src/fixtures/invalid/card-eyebrow-empty.yaml +7 -0
  23. package/src/fixtures/invalid/card-eyebrow-too-long.yaml +7 -0
  24. package/src/fixtures/invalid/checklist-duplicate-item.yaml +9 -0
  25. package/src/fixtures/invalid/checklist-item-id-too-long.yaml +7 -0
  26. package/src/fixtures/invalid/checklist-reserved-id.yaml +16 -0
  27. package/src/fixtures/invalid/copy-missing-text-and-target.yaml +10 -0
  28. package/src/fixtures/invalid/copy-target.yaml +14 -0
  29. package/src/fixtures/invalid/gallery-caption-too-long.yaml +9 -0
  30. package/src/fixtures/invalid/gallery-image-host.yaml +10 -0
  31. package/src/fixtures/invalid/gallery-too-few.yaml +6 -0
  32. package/src/fixtures/invalid/list-image-host.yaml +12 -0
  33. package/src/fixtures/invalid/list-missing-title.yaml +6 -0
  34. package/src/fixtures/invalid/list-too-many.yaml +17 -0
  35. package/src/fixtures/invalid/stepper-decimals.yaml +14 -0
  36. package/src/fixtures/invalid/stepper-out-of-range.yaml +10 -0
  37. package/src/fixtures/invalid/stepper-reserved-id.yaml +19 -0
  38. package/src/fixtures/valid/card-eyebrow.yaml +8 -0
  39. package/src/fixtures/valid/checklist.yaml +29 -0
  40. package/src/fixtures/valid/copy.yaml +85 -0
  41. package/src/fixtures/valid/gallery.yaml +22 -0
  42. package/src/fixtures/valid/list.yaml +24 -0
  43. package/src/fixtures/valid/stepper.yaml +35 -0
  44. package/src/golden.test.ts +234 -0
  45. package/src/index.test.ts +9 -0
  46. package/src/index.ts +24 -0
  47. package/src/interactive.test.ts +141 -0
  48. package/src/interactive.ts +75 -0
  49. package/src/limits.ts +26 -0
  50. package/src/lint.test.ts +672 -0
  51. package/src/lint.ts +264 -33
  52. package/src/parse.test.ts +40 -0
  53. package/src/plainText.test.ts +158 -0
  54. package/src/plainText.ts +81 -0
  55. package/src/prompt.test.ts +325 -2
  56. package/src/prompt.ts +87 -2
  57. package/src/schema.ts +259 -6
  58. package/src/validate.ts +26 -2
@@ -0,0 +1,174 @@
1
+ v: 1
2
+ datasets:
3
+ lamb_by_guests:
4
+ columns:
5
+ - {name: guests, type: number}
6
+ - {name: bone_in_lamb, type: string}
7
+ - {name: potatoes, type: string}
8
+ rows:
9
+ - [4, "3–4 lb", "2 lb"]
10
+ - [6, "4–5 lb", "3 lb"]
11
+ - [8, "5–6 lb", "4 lb"]
12
+ - [10, "6–7½ lb", "5 lb"]
13
+ blocks:
14
+ - type: heading
15
+ size: lg
16
+ text: Your Sunday lamb roast 🍷
17
+ - type: gallery
18
+ id: roast_photos
19
+ images:
20
+ - {src: "https://images.example.com/sunday-roast/roast-lamb.jpg", alt: Roast lamb}
21
+ - {src: "https://images.example.com/sunday-roast/crispy-potatoes.jpg", alt: Crispy roast potatoes}
22
+ - {src: "https://images.example.com/sunday-roast/inspiration.jpg", alt: Sunday roast inspiration}
23
+ - type: text
24
+ markdown: |-
25
+ I'm thinking a proper British-inspired Sunday roast with a little Mediterranean flair. Crispy potatoes, tender rosemary and garlic lamb, seasonal vegetables, and a delicious gravy. The kind of meal where everyone lingers at the table.
26
+
27
+ Since you haven't finalized your guest list, we'll build a flexible menu that scales with your headcount.
28
+ - type: card
29
+ id: dinner_plan
30
+ eyebrow: Your dinner plan
31
+ title: Sunday roast with friends
32
+ children:
33
+ - type: text
34
+ markdown: |-
35
+ - **Style:** Cozy, generous, slightly elevated
36
+ - **Prep:** Most work happens before guests arrive
37
+ - **Cooking:** Approximately 2 to 3 hours, depending on the lamb
38
+ - **Serving:** Family-style, with everything in the middle of the table
39
+ - type: heading
40
+ size: md
41
+ text: 1. The menu
42
+ - type: list
43
+ id: menu
44
+ items:
45
+ - title: "The centerpiece: Rosemary and garlic roast lamb"
46
+ text: A classic leg of lamb with lemon, garlic, rosemary and olive oil. Serve carved with homemade gravy and mint sauce.
47
+ image: {src: "https://images.example.com/sunday-roast/rosemary-lamb.jpg", alt: "The centerpiece: Rosemary and garlic roast lamb"}
48
+ - title: "The essential: Extra-crispy roast potatoes"
49
+ text: Parboiled, shaken to create fluffy edges and roasted until golden. Nonnegotiable!
50
+ image: {src: "https://images.example.com/sunday-roast/roast-potatoes.jpg", alt: "The essential: Extra-crispy roast potatoes"}
51
+ - title: Honey-roasted carrots and parsnips
52
+ text: Tossed with olive oil, honey and fresh thyme.
53
+ image: {src: "https://images.example.com/sunday-roast/carrots-parsnips.jpg", alt: Honey-roasted carrots and parsnips}
54
+ - title: Lemony greens
55
+ text: Tenderstem broccoli with toasted almonds and lemon zest. Something fresh to balance the rich lamb.
56
+ image: {src: "https://images.example.com/sunday-roast/lemony-greens.jpg", alt: Lemony greens}
57
+ - title: "Dessert: Warm apple crumble"
58
+ text: Serve with vanilla ice cream. Make it the day before and reheat while you're eating.
59
+ image: {src: "https://images.example.com/sunday-roast/apple-crumble.jpg", alt: "Dessert: Warm apple crumble"}
60
+ - type: heading
61
+ size: md
62
+ text: 2. How much should you buy?
63
+ - type: text
64
+ markdown: Adjust the guest count below to calculate your shopping quantities. This assumes everyone eats lamb and includes you in the total.
65
+ - type: card
66
+ id: shopping
67
+ children:
68
+ - type: stepper
69
+ id: guests
70
+ label: Number of people
71
+ unit: People
72
+ value: 5
73
+ min: 1
74
+ max: 20
75
+ callback: {name: scaleStepper}
76
+ itemsTitle: Your shopping quantities
77
+ items:
78
+ - {label: Bone-in leg of lamb, amount: 2, unit: kg, decimals: 1}
79
+ - {label: Potatoes, amount: 1500, unit: g}
80
+ - {label: Carrots, amount: 8, round: up}
81
+ - {label: Parsnips, amount: 5, round: up}
82
+ - {label: Tenderstem broccoli, amount: 625, unit: g}
83
+ - {label: Apples for crumble, amount: 4, round: up}
84
+ note: Generous portions, with a little extra. Lamb weight includes the bone. Ask your butcher for help selecting the closest available size.
85
+ - type: actions
86
+ id: shopping_actions
87
+ elements:
88
+ - type: button
89
+ id: copy_shopping_list
90
+ text: Copy shopping list
91
+ variant: outline
92
+ iconName: copy
93
+ action: {kind: copy, target: guests}
94
+ - type: text
95
+ markdown: Also pick up garlic, rosemary, thyme, lemons, honey, almonds, olive oil, gravy ingredients, mint sauce, crumble topping and vanilla ice cream.
96
+ - type: table
97
+ id: lamb_table
98
+ title: How much lamb?
99
+ data: lamb_by_guests
100
+ - type: heading
101
+ size: md
102
+ text: 3. Your Sunday cooking timeline
103
+ - type: text
104
+ markdown: Let's assume you're eating at **5 PM.** This example uses a roughly 2.4 kg bone-in leg of lamb for six people. Adjust the roasting time to your actual joint.
105
+ - type: checklist
106
+ id: cooking
107
+ title: Cooking checklist
108
+ callback: {name: toggleChecklist}
109
+ items:
110
+ - id: prep_ahead
111
+ meta: Saturday
112
+ text: Prep ahead
113
+ detail: Make the crumble, prepare the lamb marinade, check your serving dishes and set the table.
114
+ checked: true
115
+ - id: prepare_lamb
116
+ meta: "12:30 PM"
117
+ text: Prepare the lamb
118
+ detail: Season with garlic, rosemary, lemon and olive oil. Refrigerate until closer to roasting.
119
+ - id: start_roasting
120
+ meta: "1:30 PM"
121
+ text: Start roasting
122
+ detail: Preheat the oven and roast the lamb. Use a meat thermometer rather than relying only on timing.
123
+ - id: prepare_sides
124
+ meta: "2:30 PM"
125
+ text: Prepare the sides
126
+ detail: Peel and chop vegetables. Parboil potatoes, drain and rough up their edges.
127
+ - id: check_lamb
128
+ meta: "3:30 PM"
129
+ text: Check the lamb
130
+ detail: Monitor its internal temperature. Once cooked, rest it loosely covered. Roast the potatoes and vegetables while it rests.
131
+ - id: finish_everything
132
+ meta: "4:15 PM"
133
+ text: Finish everything
134
+ detail: Make the gravy, cook the greens and warm the serving dishes.
135
+ - id: carve_serve
136
+ meta: "4:45 PM"
137
+ text: Carve and serve
138
+ detail: Check the potatoes and vegetables, carve the lamb and bring everything to the table.
139
+ - id: dinner
140
+ meta: "5:00 PM"
141
+ text: Dinner!
142
+ detail: Enjoy. Reheat the apple crumble while everyone finishes their main course.
143
+ - type: context
144
+ id: usda_note
145
+ text: For food safety, the USDA recommends cooking whole cuts of lamb to an internal temperature of 145°F, followed by at least a three-minute rest. Your actual cooking time will vary by joint size and oven.
146
+ - type: heading
147
+ size: md
148
+ text: 4. Three hosting tips
149
+ - type: text
150
+ id: hosting_tips
151
+ markdown: |-
152
+ - **Buy the lamb last:** Confirm your numbers before purchasing. Your butcher can help you choose the right size.
153
+ - **Make dessert ahead:** One less thing to think about on Sunday.
154
+ - **Protect your oven space:** The lamb and potatoes both need room. If you're cooking for eight or more, consider two smaller roasting trays and prepare the vegetables ahead.
155
+ - type: text
156
+ markdown: My one addition would be a simple starter of olives, good bread and whipped feta. Guests can nibble while you finish cooking, without spoiling their appetites.
157
+ - type: actions
158
+ id: follow_ups
159
+ elements:
160
+ - type: button
161
+ id: adjust_for_five
162
+ text: Adjust the plan for 5 guests
163
+ variant: outline
164
+ action: {kind: reply, text: Help me adjust the lamb roast plan for 5 guests}
165
+ - type: button
166
+ id: vegetarian_sides
167
+ text: Add vegetarian sides
168
+ variant: outline
169
+ action: {kind: reply, text: Add vegetarian side dish options for the lamb roast menu}
170
+ - type: button
171
+ id: gluten_free
172
+ text: Make it gluten-free
173
+ variant: outline
174
+ action: {kind: reply, text: Advise on making the lamb roast plan gluten-free}
@@ -0,0 +1,7 @@
1
+ v: 1
2
+ blocks:
3
+ - type: card
4
+ eyebrow: ""
5
+ children:
6
+ - type: text
7
+ markdown: Empty.
@@ -0,0 +1,7 @@
1
+ v: 1
2
+ blocks:
3
+ - type: card
4
+ eyebrow: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
5
+ children:
6
+ - type: text
7
+ markdown: Too long.
@@ -0,0 +1,9 @@
1
+ v: 1
2
+ blocks:
3
+ - type: checklist
4
+ id: cooking
5
+ items:
6
+ - id: oven
7
+ text: Preheat the oven
8
+ - id: oven
9
+ text: Turn the oven off
@@ -0,0 +1,7 @@
1
+ v: 1
2
+ blocks:
3
+ - type: checklist
4
+ id: cooking
5
+ items:
6
+ - id: a_very_long_item_id_that_is_over_32
7
+ text: Preheat the oven
@@ -0,0 +1,16 @@
1
+ v: 1
2
+ blocks:
3
+ - type: checklist
4
+ id: cooking
5
+ items:
6
+ - id: oven
7
+ text: Preheat the oven
8
+ - type: actions
9
+ id: more
10
+ elements:
11
+ - type: button
12
+ id: cooking_oven
13
+ text: Oven help
14
+ action:
15
+ kind: reply
16
+ text: How hot should the oven be?
@@ -0,0 +1,10 @@
1
+ v: 1
2
+ blocks:
3
+ - type: actions
4
+ id: copy_actions
5
+ elements:
6
+ - type: button
7
+ id: copy_it
8
+ text: Copy
9
+ action:
10
+ kind: copy
@@ -0,0 +1,14 @@
1
+ v: 1
2
+ blocks:
3
+ - type: heading
4
+ id: title
5
+ text: Sunday roast
6
+ - type: actions
7
+ id: copy_actions
8
+ elements:
9
+ - type: button
10
+ id: copy_title
11
+ text: Copy
12
+ action:
13
+ kind: copy
14
+ target: title
@@ -0,0 +1,9 @@
1
+ v: 1
2
+ blocks:
3
+ - type: gallery
4
+ images:
5
+ - src: file:roast-lamb
6
+ alt: Roast leg of lamb
7
+ - src: file:roast-potatoes
8
+ alt: Roast potatoes
9
+ caption: Crisp roast potatoes, par-boiled for ten minutes, shaken in the pan to rough up the edges, then roasted in hot fat for an hour
@@ -0,0 +1,10 @@
1
+ v: 1
2
+ blocks:
3
+ - type: gallery
4
+ images:
5
+ - src: file:roast-lamb
6
+ alt: Roast leg of lamb
7
+ - src: "data:image/png;base64,iVBORw0KGgo="
8
+ alt: Roast potatoes
9
+ - src: https://images.example.com/carrots.jpg
10
+ alt: Glazed carrots
@@ -0,0 +1,6 @@
1
+ v: 1
2
+ blocks:
3
+ - type: gallery
4
+ images:
5
+ - src: file:roast-lamb
6
+ alt: Roast leg of lamb
@@ -0,0 +1,12 @@
1
+ v: 1
2
+ blocks:
3
+ - type: list
4
+ items:
5
+ - title: Roast leg of lamb
6
+ image:
7
+ src: file:roast-lamb
8
+ alt: Roast leg of lamb
9
+ - title: Honey carrots
10
+ image:
11
+ src: https://images.example.com/carrots.jpg
12
+ alt: Glazed carrots
@@ -0,0 +1,6 @@
1
+ v: 1
2
+ blocks:
3
+ - type: list
4
+ items:
5
+ - text: Rubbed with garlic and rosemary.
6
+ meta: Main
@@ -0,0 +1,17 @@
1
+ v: 1
2
+ blocks:
3
+ - type: list
4
+ items:
5
+ - title: Dish 1
6
+ - title: Dish 2
7
+ - title: Dish 3
8
+ - title: Dish 4
9
+ - title: Dish 5
10
+ - title: Dish 6
11
+ - title: Dish 7
12
+ - title: Dish 8
13
+ - title: Dish 9
14
+ - title: Dish 10
15
+ - title: Dish 11
16
+ - title: Dish 12
17
+ - title: Dish 13
@@ -0,0 +1,14 @@
1
+ v: 1
2
+ blocks:
3
+ - type: stepper
4
+ id: guests
5
+ label: Number of people
6
+ value: 5
7
+ min: 1
8
+ max: 20
9
+ callback:
10
+ name: scaleStepper
11
+ items:
12
+ - label: Lamb
13
+ amount: 2
14
+ decimals: 4
@@ -0,0 +1,10 @@
1
+ v: 1
2
+ blocks:
3
+ - type: stepper
4
+ id: guests
5
+ label: Number of people
6
+ value: 21
7
+ min: 1
8
+ max: 20
9
+ callback:
10
+ name: scaleStepper
@@ -0,0 +1,19 @@
1
+ v: 1
2
+ blocks:
3
+ - type: stepper
4
+ id: guests
5
+ label: Number of people
6
+ value: 5
7
+ min: 1
8
+ max: 20
9
+ callback:
10
+ name: scaleStepper
11
+ - type: actions
12
+ id: more
13
+ elements:
14
+ - type: button
15
+ id: guests_increase
16
+ text: More
17
+ action:
18
+ kind: reply
19
+ text: More people
@@ -0,0 +1,8 @@
1
+ v: 1
2
+ blocks:
3
+ - type: card
4
+ eyebrow: Your dinner plan
5
+ title: Sunday roast for six
6
+ children:
7
+ - type: text
8
+ markdown: Lamb, crispy potatoes, and honey carrots.
@@ -0,0 +1,29 @@
1
+ v: 1
2
+ blocks:
3
+ - type: checklist
4
+ id: cooking
5
+ title: Cooking checklist
6
+ callback:
7
+ name: toggleChecklist
8
+ payload:
9
+ recipe: roast
10
+ items:
11
+ - id: oven
12
+ text: Preheat the oven
13
+ meta: "1:00 pm"
14
+ detail: 220 C, fan off.
15
+ checked: true
16
+ - id: lamb_in
17
+ text: Put the lamb in
18
+ meta: "1:30 pm"
19
+ - id: rest
20
+ text: Rest the lamb
21
+ checked: false
22
+ - type: card
23
+ title: Before guests arrive
24
+ children:
25
+ - type: checklist
26
+ id: prep
27
+ items:
28
+ - id: table
29
+ text: Set the table
@@ -0,0 +1,85 @@
1
+ v: 1
2
+ datasets:
3
+ guests:
4
+ columns:
5
+ - name: guests
6
+ type: number
7
+ - name: lamb_kg
8
+ type: number
9
+ rows:
10
+ - [4, 1.6]
11
+ - [6, 2.4]
12
+ blocks:
13
+ - type: stepper
14
+ id: people
15
+ label: Number of people
16
+ unit: People
17
+ value: 5
18
+ min: 1
19
+ max: 20
20
+ callback:
21
+ name: scaleStepper
22
+ items:
23
+ - label: Bone-in leg of lamb
24
+ amount: 2
25
+ unit: kg
26
+ decimals: 1
27
+ - type: checklist
28
+ id: cooking
29
+ items:
30
+ - id: oven
31
+ text: Preheat the oven
32
+ - type: card
33
+ title: Menu
34
+ children:
35
+ - type: list
36
+ id: menu
37
+ items:
38
+ - title: Roast leg of lamb
39
+ text: Rubbed with garlic and rosemary.
40
+ - type: text
41
+ id: tips
42
+ markdown: Rest the lamb for **20 minutes**.
43
+ - type: table
44
+ id: lamb_table
45
+ data: guests
46
+ - type: actions
47
+ id: copy_actions
48
+ elements:
49
+ - type: button
50
+ id: copy_shopping
51
+ text: Copy shopping list
52
+ variant: outline
53
+ action:
54
+ kind: copy
55
+ target: people
56
+ - type: button
57
+ id: copy_checklist
58
+ text: Copy checklist
59
+ action:
60
+ kind: copy
61
+ target: cooking
62
+ - type: button
63
+ id: copy_menu
64
+ text: Copy menu
65
+ action:
66
+ kind: copy
67
+ target: menu
68
+ - type: button
69
+ id: copy_tips
70
+ text: Copy tips
71
+ action:
72
+ kind: copy
73
+ target: tips
74
+ - type: button
75
+ id: copy_table
76
+ text: Copy table
77
+ action:
78
+ kind: copy
79
+ target: lamb_table
80
+ - type: button
81
+ id: copy_note
82
+ text: Copy note
83
+ action:
84
+ kind: copy
85
+ text: Lamb 2 kg, carrots 8, mint sauce.
@@ -0,0 +1,22 @@
1
+ v: 1
2
+ blocks:
3
+ - type: gallery
4
+ id: roast_photos
5
+ images:
6
+ - src: file:roast-lamb
7
+ alt: Roast leg of lamb on a carving board
8
+ caption: Roast lamb
9
+ - src: file:roast-potatoes
10
+ alt: Crisp roast potatoes in a tray
11
+ caption: Roast potatoes
12
+ - src: "data:image/png;base64,iVBORw0KGgo="
13
+ alt: Glazed carrots in a white dish
14
+ - type: card
15
+ title: Table ideas
16
+ children:
17
+ - type: gallery
18
+ images:
19
+ - src: file:table-setting
20
+ alt: A table set for six
21
+ - src: file:flowers
22
+ alt: A jug of spring flowers
@@ -0,0 +1,24 @@
1
+ v: 1
2
+ blocks:
3
+ - type: list
4
+ id: menu
5
+ items:
6
+ - title: Roast leg of lamb
7
+ text: Rubbed with garlic and rosemary, roasted for 90 minutes, then rested.
8
+ meta: Main
9
+ image:
10
+ src: file:roast-lamb
11
+ alt: Roast leg of lamb on a carving board
12
+ - title: Crispy roast potatoes
13
+ text: Par-boiled, shaken, and roasted in hot fat.
14
+ image:
15
+ src: "data:image/png;base64,iVBORw0KGgo="
16
+ alt: Crisp roast potatoes in a tray
17
+ - title: Mint sauce
18
+ - type: card
19
+ title: Pudding
20
+ children:
21
+ - type: list
22
+ items:
23
+ - title: Apple crumble
24
+ meta: 45 min
@@ -0,0 +1,35 @@
1
+ v: 1
2
+ blocks:
3
+ - type: card
4
+ title: How much should you buy?
5
+ children:
6
+ - type: stepper
7
+ id: guests
8
+ label: Number of people
9
+ unit: People
10
+ value: 5
11
+ min: 1
12
+ max: 20
13
+ callback:
14
+ name: scaleStepper
15
+ payload:
16
+ recipe: roast
17
+ itemsTitle: Your shopping quantities
18
+ items:
19
+ - label: Bone-in leg of lamb
20
+ amount: 2
21
+ unit: kg
22
+ decimals: 1
23
+ - label: Carrots
24
+ amount: 8
25
+ round: up
26
+ note: Generous portions, with a little extra.
27
+ - type: stepper
28
+ id: servings
29
+ label: Servings
30
+ value: 2
31
+ min: 0
32
+ max: 10
33
+ step: 0.5
34
+ callback:
35
+ name: scaleStepper