@plitzi/sdk-authoring 0.39.2 → 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.
Files changed (27) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/index-src.js +1204 -997
  3. package/dist/index.d.ts +73 -6
  4. package/dist/node.d.ts +57 -5
  5. package/dist/plugin.d.ts +1 -1
  6. package/package.json +7 -7
  7. package/skills/plitzi-authoring/recipes/accordion.ts +3 -1
  8. package/skills/plitzi-authoring/recipes/carousel.ts +68 -63
  9. package/skills/plitzi-authoring/recipes/detail-page.ts +43 -33
  10. package/skills/plitzi-authoring/recipes/embed-and-svg.ts +16 -11
  11. package/skills/plitzi-authoring/recipes/every-few-seconds.ts +52 -42
  12. package/skills/plitzi-authoring/recipes/feature-flag.ts +7 -2
  13. package/skills/plitzi-authoring/recipes/filter-a-list.ts +39 -31
  14. package/skills/plitzi-authoring/recipes/forms-and-modals.ts +34 -28
  15. package/skills/plitzi-authoring/recipes/from-tailwind.ts +11 -6
  16. package/skills/plitzi-authoring/recipes/link-to-a-section.ts +11 -6
  17. package/skills/plitzi-authoring/recipes/link-with-data.ts +21 -16
  18. package/skills/plitzi-authoring/recipes/marquee.ts +17 -12
  19. package/skills/plitzi-authoring/recipes/plugin.ts +16 -10
  20. package/skills/plitzi-authoring/recipes/scroll-a-row.ts +30 -25
  21. package/skills/plitzi-authoring/recipes/server-data.ts +15 -10
  22. package/skills/plitzi-authoring/recipes/show-data.ts +32 -24
  23. package/skills/plitzi-authoring/recipes/style-a-page.ts +9 -4
  24. package/skills/plitzi-authoring/recipes/typed-data.ts +26 -21
  25. package/skills/plitzi-authoring/recipes/usable-without-sight.ts +16 -11
  26. package/skills/plitzi-authoring/reference/authoring-errors.md +3 -0
  27. package/skills/plitzi-authoring/reference/efficiency.md +2 -1
package/dist/index.d.ts CHANGED
@@ -380,6 +380,11 @@ export declare const addNotification: (params: {
380
380
  autoDismissTimeout?: number;
381
381
  }) => StepSpec;
382
382
 
383
+ /** The kinds, in the order a setting lists them: a tuple, so a schema validator can take it as its values. */
384
+ declare const AI_CRAWLER_KINDS: readonly ["training", "assistants", "search"];
385
+
386
+ declare type AiCrawlerKind = (typeof AI_CRAWLER_KINDS)[number];
387
+
383
388
  /**
384
389
  * Where each region of one picture sits in the other, from their row profiles — so two pages of different heights are
385
390
  * compared section by section, not row for row: one section 400 px taller pushes everything under it down, and compared
@@ -781,11 +786,26 @@ export declare const AUTHORING_CODES: {
781
786
  readonly means: "an `h4` right after an `h2` on a page as it is drawn — inside its layouts, with the headings a `markdown` writes, and without those that start hidden (`visible: false`): the outline misses a level (Lighthouse: \"not in a sequentially-descending order\")";
782
787
  readonly fix: "the next level down; size it with its class";
783
788
  };
789
+ readonly 'page-without-main': {
790
+ readonly kind: "suggested";
791
+ readonly means: "a page that draws no `main` landmark — neither it nor its layouts: a screen reader skipping to the content and a browser agent find no place where the page's own content starts (Lighthouse: \"Document does not have a main landmark\")";
792
+ readonly fix: "the container holding the page's content drawn as `main` (`container({ subType: 'main', children })`) — in the layout's slot when its pages share the shell — once a page";
793
+ };
784
794
  readonly 'repeated-on-pages': {
785
795
  readonly kind: "suggested";
786
796
  readonly means: "the same block — a header, a footer, a side panel — written into several pages";
787
797
  readonly fix: "a layout holding it once (`layouts`, and `layout: { id, slot }` on each page) — a component when only some pages of a layout carry it, written in its area’s folder and listed in the space’s `components`; a link marks its own page with the `current` state";
788
798
  };
799
+ readonly 'heavy-page': {
800
+ readonly kind: "suggested";
801
+ readonly means: "one page whose part of the document passes 250 KB — every visitor downloads it before the page is theirs — with the shapes written again most inside it, by what they weigh";
802
+ readonly fix: "the rows of data as one `list` of a component, read from the data (`list({ items, row })`), and a block written per state as one element whose state picks its content: the document then holds one copy — or, for an app's page heavy for how many elements it has, `quiet: ['heavy-page']` on the page, with why";
803
+ };
804
+ readonly 'repeated-expression': {
805
+ readonly kind: "suggested";
806
+ readonly means: "the same long expression — its numbers and words aside — written into many bindings, steps or attributes: a sum or a choice worked out again in every copy, and carried by the document once per copy";
807
+ readonly fix: "what the copies share as a computed value (`computed: { chosen: '{{ … }}' }`, read as `computed.chosen`), answering `null` off the page that reads it (`navigation.currentPageId`), each copy keeping what differs; copies side by side as one `list` whose rows carry what differs (`list({ items, row })`)";
808
+ };
789
809
  readonly 'repeated-shape': {
790
810
  readonly kind: "suggested";
791
811
  readonly means: "the same structure written again and again with different words — cards, rows, tiles. Copies that read their data in a form of their own (their template) or render on the server are no repeats, and neither are copies side by side wired to different sources or state keys — controls written alike; copies apart that read different sources are one component, each instance handed its own";
@@ -2270,6 +2290,15 @@ export declare interface AuthorSpaceOptions {
2270
2290
 
2271
2291
  export declare const authRefreshDetails: () => StepSpec;
2272
2292
 
2293
+ /**
2294
+ * What a field holds, as a browser and a password manager read `autocomplete` (WHATWG autofill tokens) — the ones a
2295
+ * sign-in, a sign-up and a contact form use. A password field said `off` for every space, so no password manager
2296
+ * filled a sign-in or offered to save a new password.
2297
+ */
2298
+ declare const AUTOFILL_FIELDS: readonly ["username", "current-password", "new-password", "one-time-code", "email", "name", "given-name", "family-name", "organization", "tel", "street-address", "postal-code", "country", "url"];
2299
+
2300
+ declare type AutofillField = (typeof AUTOFILL_FIELDS)[number];
2301
+
2273
2302
  /**
2274
2303
  * Waits for the space on the page to take its markup over (`data-hydrated`, put on its root by the SDK) — or says it did
2275
2304
  * not: a press before then does nothing, and what is read is the server's HTML. A page with no space has nothing to
@@ -5537,6 +5566,7 @@ declare const elementDeclarations: {
5537
5566
  readonly contentAttributes: readonly ["label", "placeholder", "options", "requiredMessage", "minLengthMessage", "maxLengthMessage", "minMessage", "maxMessage", "formatMessage", "patternMessage", "matchesMessage"];
5538
5567
  readonly attributeValues: {
5539
5568
  readonly subType: readonly ["text", "number", "email", "password", "search", "url", "tel", "date", "time", "checkbox", "switch", "select", "textarea", "hidden", "color", "file"];
5569
+ readonly autoComplete: readonly ["username", "current-password", "new-password", "one-time-code", "email", "name", "given-name", "family-name", "organization", "tel", "street-address", "postal-code", "country", "url"];
5540
5570
  };
5541
5571
  readonly triggers: {
5542
5572
  readonly onChange: {
@@ -8947,7 +8977,12 @@ declare type FormControlProps = {
8947
8977
  placeholder: string;
8948
8978
  /** A `file` field's offer, as the browser reads `accept`: `image/png,image/jpeg`, `.pdf`. `''` for any file. */
8949
8979
  accept: string;
8950
- autoComplete: boolean;
8980
+ /**
8981
+ * What the browser may fill in: `true` lets it decide (on a password field, the account's current password), `false`
8982
+ * asks it not to, and a token names what the field holds — `username`, `new-password`, `one-time-code`, `email`…
8983
+ * (`AUTOFILL_FIELDS`), which is what a password manager reads to fill a sign-in and to save a new password.
8984
+ */
8985
+ autoComplete: boolean | AutofillField;
8951
8986
  /**
8952
8987
  * Takes the focus as it appears — a search box opened by a shortcut is typed into at once. With the control's
8953
8988
  * container shown only while wanted (`loadStrategy: 'visible'`), it appears each time it is opened.
@@ -10847,6 +10882,12 @@ export declare interface PageSpec {
10847
10882
  flag?: string;
10848
10883
  /** How the space's navigation lists it: see {@link PageNav}. */
10849
10884
  nav?: PageNav;
10885
+ /**
10886
+ * Suggestions this page is not offered, because it is written this way on purpose — `quiet: ['heavy-page']` on an
10887
+ * app's page that is heavy for how many elements it has, not for a shape written again. Only suggestions: a problem
10888
+ * is never quieted. Say why beside it.
10889
+ */
10890
+ quiet?: SuggestionCode[];
10850
10891
  body: ElementSpec[];
10851
10892
  }
10852
10893
 
@@ -11815,7 +11856,7 @@ export declare interface RuleSetSpec extends VariantSpec {
11815
11856
 
11816
11857
  /**
11817
11858
  * A condition as Plitzi stores it — a flag's rules, an interaction's `when`, a binding's condition: the schema's own
11818
- * format, so sdk-shared defines it (RFC 0032, D13). plitzi-ui's QueryBuilder edits the same shape with prop types of its
11859
+ * 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
11819
11860
  * own, and a type test in the builder, where the two meet, holds them assignable both ways.
11820
11861
  */
11821
11862
  declare type RuleValue = Date | string | number | boolean | undefined | null | object;
@@ -11926,11 +11967,25 @@ export declare type Schema = {
11926
11967
  */
11927
11968
  robotsTxt?: string;
11928
11969
  /**
11929
- * Keeps the crawlers that gather pages to train AI models (`AI_CRAWLERS`: GPTBot, ClaudeBot, Google-Extended…) out of
11930
- * the whole site: `/robots.txt` says `Disallow: /` to each, after whatever `robotsTxt` says. Search engines keep
11931
- * reading it. Left out, nobody is kept out.
11970
+ * The site's `/.well-known/security.txt` (RFC 9116), as a researcher who found a flaw reads it: where to write
11971
+ * (`Contact:`), until when the text holds (`Expires:`), and anything else the RFC names. Left out, the address answers
11972
+ * 404 — a site that says nothing is not given words it did not write.
11973
+ */
11974
+ securityTxt?: string;
11975
+ /**
11976
+ * The space's `/llms.txt` (llmstxt.org), as an assistant reads it to find its way around: the site's name, what it
11977
+ * is, and a link to each page with what it is for. Left out, the server writes one from the pages the sitemap lists
11978
+ * — each page's SEO title and description. A space that keeps `assistants` out (`blockAiCrawlers`) answers 404:
11979
+ * an index for them would invite what the site refuses.
11932
11980
  */
11933
- blockAiCrawlers?: boolean;
11981
+ llmsTxt?: string;
11982
+ /**
11983
+ * The kinds of AI crawler kept out of the whole site, each its owner's to decide (`AI_CRAWLERS`): `training` (GPTBot,
11984
+ * ClaudeBot, Google-Extended…), `assistants` fetching a page for a person (ChatGPT-User, Claude-User…) and AI
11985
+ * `search` indexes (OAI-SearchBot, PerplexityBot…). `/robots.txt` says `Disallow: /` to each agent of each kind named,
11986
+ * after whatever `robotsTxt` says. Search engines keep reading it. Left out, nobody is kept out.
11987
+ */
11988
+ blockAiCrawlers?: AiCrawlerKind[];
11934
11989
  /**
11935
11990
  * A move from page to page drawn as one view becoming the next (the browser's view transitions): the pages cross-fade,
11936
11991
  * and an element named the same on both by CSS — `view-transition-name: fighter-portrait` — moves from where it was
@@ -11948,6 +12003,11 @@ export declare type Schema = {
11948
12003
  * yours" there, as on any page. Left out, the platform's few words. A page with an `access` of its own cannot be it.
11949
12004
  */
11950
12005
  withheldPage?: string;
12006
+ /**
12007
+ * Sends the whole space with every page instead of in parts — the page's own elements and its layouts', the rest
12008
+ * fetched as a link to it is followed. For a space whose pages read each other's elements at run time.
12009
+ */
12010
+ wholeDocument?: boolean;
11951
12011
  /** The language its pages are written in, as a language tag (`en`, `es-MX`): `<html lang>` and `og:locale`. */
11952
12012
  language?: string;
11953
12013
  /** The tab's icon: a file of the site (`/favicon.svg`) or an address (`https://…`). Left out, Plitzi's. */
@@ -12043,6 +12103,13 @@ export declare type Schema = {
12043
12103
  pages: Element_2['id'][];
12044
12104
  pageFolders: PageFolder[];
12045
12105
  components: Record<SpaceComponent['id'], SpaceComponent>;
12106
+ /**
12107
+ * Only in a document a page server sends in parts (`splitSchema`): the roots — pages and layouts — whose elements are
12108
+ * not in `flat` yet, each by the name of the part that holds them, fetched before a page that needs it is drawn; `''`
12109
+ * for one this visitor is not sent, which only the server can draw. Absent, the document is whole: the SDK alone, the
12110
+ * builder, the MCP and a static deploy never see it.
12111
+ */
12112
+ parts?: Record<string, string>;
12046
12113
  };
12047
12114
 
12048
12115
  /**
package/dist/node.d.ts CHANGED
@@ -140,6 +140,11 @@ declare type ActionLimits = {
140
140
  */
141
141
  export declare const actionsIn: (folder: string | URL) => Promise<ActionEntry[]>;
142
142
 
143
+ /** The kinds, in the order a setting lists them: a tuple, so a schema validator can take it as its values. */
144
+ declare const AI_CRAWLER_KINDS: readonly ["training", "assistants", "search"];
145
+
146
+ declare type AiCrawlerKind = (typeof AI_CRAWLER_KINDS)[number];
147
+
143
148
  /** What one ancestor condition changes: inside it always, in its states, or in its variants (and their states). */
144
149
  declare interface AncestorSpec {
145
150
  css?: CssSpec;
@@ -178,11 +183,26 @@ declare const AUTHORING_CODES: {
178
183
  readonly means: "an `h4` right after an `h2` on a page as it is drawn — inside its layouts, with the headings a `markdown` writes, and without those that start hidden (`visible: false`): the outline misses a level (Lighthouse: \"not in a sequentially-descending order\")";
179
184
  readonly fix: "the next level down; size it with its class";
180
185
  };
186
+ readonly 'page-without-main': {
187
+ readonly kind: "suggested";
188
+ readonly means: "a page that draws no `main` landmark — neither it nor its layouts: a screen reader skipping to the content and a browser agent find no place where the page's own content starts (Lighthouse: \"Document does not have a main landmark\")";
189
+ readonly fix: "the container holding the page's content drawn as `main` (`container({ subType: 'main', children })`) — in the layout's slot when its pages share the shell — once a page";
190
+ };
181
191
  readonly 'repeated-on-pages': {
182
192
  readonly kind: "suggested";
183
193
  readonly means: "the same block — a header, a footer, a side panel — written into several pages";
184
194
  readonly fix: "a layout holding it once (`layouts`, and `layout: { id, slot }` on each page) — a component when only some pages of a layout carry it, written in its area’s folder and listed in the space’s `components`; a link marks its own page with the `current` state";
185
195
  };
196
+ readonly 'heavy-page': {
197
+ readonly kind: "suggested";
198
+ readonly means: "one page whose part of the document passes 250 KB — every visitor downloads it before the page is theirs — with the shapes written again most inside it, by what they weigh";
199
+ readonly fix: "the rows of data as one `list` of a component, read from the data (`list({ items, row })`), and a block written per state as one element whose state picks its content: the document then holds one copy — or, for an app's page heavy for how many elements it has, `quiet: ['heavy-page']` on the page, with why";
200
+ };
201
+ readonly 'repeated-expression': {
202
+ readonly kind: "suggested";
203
+ readonly means: "the same long expression — its numbers and words aside — written into many bindings, steps or attributes: a sum or a choice worked out again in every copy, and carried by the document once per copy";
204
+ readonly fix: "what the copies share as a computed value (`computed: { chosen: '{{ … }}' }`, read as `computed.chosen`), answering `null` off the page that reads it (`navigation.currentPageId`), each copy keeping what differs; copies side by side as one `list` whose rows carry what differs (`list({ items, row })`)";
205
+ };
186
206
  readonly 'repeated-shape': {
187
207
  readonly kind: "suggested";
188
208
  readonly means: "the same structure written again and again with different words — cards, rows, tiles. Copies that read their data in a form of their own (their template) or render on the server are no repeats, and neither are copies side by side wired to different sources or state keys — controls written alike; copies apart that read different sources are one component, each instance handed its own";
@@ -2648,6 +2668,12 @@ declare interface PageSpec {
2648
2668
  flag?: string;
2649
2669
  /** How the space's navigation lists it: see {@link PageNav}. */
2650
2670
  nav?: PageNav;
2671
+ /**
2672
+ * Suggestions this page is not offered, because it is written this way on purpose — `quiet: ['heavy-page']` on an
2673
+ * app's page that is heavy for how many elements it has, not for a shape written again. Only suggestions: a problem
2674
+ * is never quieted. Say why beside it.
2675
+ */
2676
+ quiet?: SuggestionCode[];
2651
2677
  body: ElementSpec[];
2652
2678
  }
2653
2679
 
@@ -2906,7 +2932,7 @@ declare interface RuleSetSpec extends VariantSpec {
2906
2932
 
2907
2933
  /**
2908
2934
  * A condition as Plitzi stores it — a flag's rules, an interaction's `when`, a binding's condition: the schema's own
2909
- * format, so sdk-shared defines it (RFC 0032, D13). plitzi-ui's QueryBuilder edits the same shape with prop types of its
2935
+ * 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
2910
2936
  * own, and a type test in the builder, where the two meet, holds them assignable both ways.
2911
2937
  */
2912
2938
  declare type RuleValue = Date | string | number | boolean | undefined | null | object;
@@ -2959,11 +2985,25 @@ declare type Schema = {
2959
2985
  */
2960
2986
  robotsTxt?: string;
2961
2987
  /**
2962
- * Keeps the crawlers that gather pages to train AI models (`AI_CRAWLERS`: GPTBot, ClaudeBot, Google-Extended…) out of
2963
- * the whole site: `/robots.txt` says `Disallow: /` to each, after whatever `robotsTxt` says. Search engines keep
2964
- * reading it. Left out, nobody is kept out.
2988
+ * The site's `/.well-known/security.txt` (RFC 9116), as a researcher who found a flaw reads it: where to write
2989
+ * (`Contact:`), until when the text holds (`Expires:`), and anything else the RFC names. Left out, the address answers
2990
+ * 404 — a site that says nothing is not given words it did not write.
2991
+ */
2992
+ securityTxt?: string;
2993
+ /**
2994
+ * The space's `/llms.txt` (llmstxt.org), as an assistant reads it to find its way around: the site's name, what it
2995
+ * is, and a link to each page with what it is for. Left out, the server writes one from the pages the sitemap lists
2996
+ * — each page's SEO title and description. A space that keeps `assistants` out (`blockAiCrawlers`) answers 404:
2997
+ * an index for them would invite what the site refuses.
2998
+ */
2999
+ llmsTxt?: string;
3000
+ /**
3001
+ * The kinds of AI crawler kept out of the whole site, each its owner's to decide (`AI_CRAWLERS`): `training` (GPTBot,
3002
+ * ClaudeBot, Google-Extended…), `assistants` fetching a page for a person (ChatGPT-User, Claude-User…) and AI
3003
+ * `search` indexes (OAI-SearchBot, PerplexityBot…). `/robots.txt` says `Disallow: /` to each agent of each kind named,
3004
+ * after whatever `robotsTxt` says. Search engines keep reading it. Left out, nobody is kept out.
2965
3005
  */
2966
- blockAiCrawlers?: boolean;
3006
+ blockAiCrawlers?: AiCrawlerKind[];
2967
3007
  /**
2968
3008
  * A move from page to page drawn as one view becoming the next (the browser's view transitions): the pages cross-fade,
2969
3009
  * and an element named the same on both by CSS — `view-transition-name: fighter-portrait` — moves from where it was
@@ -2981,6 +3021,11 @@ declare type Schema = {
2981
3021
  * yours" there, as on any page. Left out, the platform's few words. A page with an `access` of its own cannot be it.
2982
3022
  */
2983
3023
  withheldPage?: string;
3024
+ /**
3025
+ * Sends the whole space with every page instead of in parts — the page's own elements and its layouts', the rest
3026
+ * fetched as a link to it is followed. For a space whose pages read each other's elements at run time.
3027
+ */
3028
+ wholeDocument?: boolean;
2984
3029
  /** The language its pages are written in, as a language tag (`en`, `es-MX`): `<html lang>` and `og:locale`. */
2985
3030
  language?: string;
2986
3031
  /** The tab's icon: a file of the site (`/favicon.svg`) or an address (`https://…`). Left out, Plitzi's. */
@@ -3076,6 +3121,13 @@ declare type Schema = {
3076
3121
  pages: Element_2['id'][];
3077
3122
  pageFolders: PageFolder[];
3078
3123
  components: Record<SpaceComponent['id'], SpaceComponent>;
3124
+ /**
3125
+ * Only in a document a page server sends in parts (`splitSchema`): the roots — pages and layouts — whose elements are
3126
+ * not in `flat` yet, each by the name of the part that holds them, fetched before a page that needs it is drawn; `''`
3127
+ * for one this visitor is not sent, which only the server can draw. Absent, the document is whole: the SDK alone, the
3128
+ * builder, the MCP and a static deploy never see it.
3129
+ */
3130
+ parts?: Record<string, string>;
3079
3131
  };
3080
3132
 
3081
3133
  /**
package/dist/plugin.d.ts CHANGED
@@ -612,7 +612,7 @@ 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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-authoring",
3
- "version": "0.39.2",
3
+ "version": "0.39.4",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist/index.js",
@@ -66,12 +66,12 @@
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.2",
71
- "@plitzi/sdk-interactions": "0.39.2",
72
- "@plitzi/sdk-schema": "0.39.2",
73
- "@plitzi/sdk-shared": "0.39.2",
74
- "@plitzi/sdk-style": "0.39.2",
69
+ "@plitzi/plitzi-ui": "^1.6.39",
70
+ "@plitzi/sdk-elements": "0.39.4",
71
+ "@plitzi/sdk-interactions": "0.39.4",
72
+ "@plitzi/sdk-schema": "0.39.4",
73
+ "@plitzi/sdk-shared": "0.39.4",
74
+ "@plitzi/sdk-style": "0.39.4",
75
75
  "@types/react": "^19.3.0",
76
76
  "eslint": "^9.39.5",
77
77
  "prettier": "^3.9.10",
@@ -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
  ]