@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
package/dist/handlers.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as authRoutes, n as renewForNavigation, r as applySessionOutcome, t as isDocumentNavigation } from "./chunks/renewal-D98v6-Jd.js";
2
- import { a as handleRegister, b as protectedResourceMetadata, i as handleAuthorizeSubmit, l as sendErrorJson, n as handleToken, r as handleAuthorizeStart, t as handleRevoke, y as authorizationServerMetadata } from "./chunks/token-B2uY9JzU.js";
2
+ import { a as handleRegister, b as protectedResourceMetadata, i as handleAuthorizeSubmit, l as sendErrorJson, n as handleToken, r as handleAuthorizeStart, t as handleRevoke, y as authorizationServerMetadata } from "./chunks/token-XEz1n4jp.js";
3
3
  import { serverLog } from "@plitzi/sdk-kernel/log";
4
4
  import { authFailureMessage, carrierOf, createAuthorizer, csrfFailureMessage } from "@plitzi/sdk-kernel/identity";
5
5
  // src/core/handlers/authRouteHandlers.ts
@@ -0,0 +1,10 @@
1
+ import { Schema } from '@plitzi/sdk-shared';
2
+ /**
3
+ * Whether this space is sent in parts: unless it asks for the whole (`settings.wholeDocument`), or has a single page —
4
+ * nothing to fetch later, so the shell would only be split for nothing.
5
+ */
6
+ export declare const sentInParts: (schema: Schema) => boolean;
7
+ /** The schema a page is sent with: the shell, that page's part and its layouts' — the same object for every visit. */
8
+ export declare const pageSchemaOf: (schema: Schema, withheld: readonly string[], pageId: string) => Schema;
9
+ /** A part's text by its name, for this group of visitors; none for a name their shell does not give. */
10
+ export declare const partTextOf: (schema: Schema, withheld: readonly string[], name: string) => string | undefined;
@@ -0,0 +1 @@
1
+ export declare const ownVersion: () => string;
@@ -1,5 +1,6 @@
1
+ import { SSRPaintedDefaults } from '../types/config';
1
2
  import { SSRRequest } from '@plitzi/sdk-kernel/types';
2
- import { Schema } from '@plitzi/sdk-shared';
3
+ import { Environment, Schema } from '@plitzi/sdk-shared';
3
4
  /**
4
5
  * The name the painted state of a server-rendered page is kept under, for this request's host.
5
6
  *
@@ -19,3 +20,16 @@ export declare const requestPaintedState: (req: Pick<SSRRequest, "headers" | "ho
19
20
  keys: ReadonlySet<string>;
20
21
  state: Record<string, unknown> | undefined;
21
22
  };
23
+ type PaintedState = ReturnType<typeof requestPaintedState>;
24
+ /**
25
+ * `requestPaintedState` with the deployment's defaults (`paintedDefaults`) for the keys the cookie holds none of — for
26
+ * an account the request proved, never a guest: a guest's page is cached for every guest, and a default is an
27
+ * account's. Another account's entry holds nothing for this one (`paintedStateFor`), so after a change of account the
28
+ * defaults are this account's. A deployment that fails to answer is said in the log, and the page is drawn without.
29
+ */
30
+ export declare const requestPaintedStateWithDefaults: (req: Pick<SSRRequest, "headers" | "hostname">, settings: Pick<Schema["settings"], "keepState" | "paintedState" | "browserState"> | undefined, scope: {
31
+ spaceId: number;
32
+ environment: Environment;
33
+ account: number | string | undefined;
34
+ }, defaults: SSRPaintedDefaults | undefined) => Promise<PaintedState>;
35
+ export {};
package/dist/index.d.ts CHANGED
@@ -21,4 +21,4 @@ export type { PubSubAdapter, SSRRealtimeConfig } from '@plitzi/sdk-shared';
21
21
  export type { ResolvedServices, ServerConfig } from './core/createServer';
22
22
  export type { AuthoringHost, AuthoringHostConfig } from './hosts/authoringHost';
23
23
  export type { PipelineExtensions, SSRContext } from './core/http/pageContext';
24
- export type { CacheFilter, CacheManager, PluginRegistry, SSRCacheConfig, SSRFontsConfig, SSRImagesConfig, SSRPageServerConfig, SSRPlugin, SSRRenderLimitConfig, SSRRscConfig, SSRServer, SSRServerConfig, SSRSignInConfig, SSRTemplateFn, SSRVisitorCredentialsConfig, ServerServices, SharedPage, SharedPageFacts, SharedPageStore } from './types';
24
+ export type { CacheFilter, CacheManager, PluginRegistry, SSRCacheConfig, SSRFontsConfig, SSRImagesConfig, SSRPageServerConfig, SSRPaintedDefaults, SSRPaintedDefaultsContext, SSRPlugin, SSRRenderLimitConfig, SSRRscConfig, SSRServer, SSRServerConfig, SSRSignInConfig, SSRTemplateFn, SSRVisitorCredentialsConfig, ServerServices, SharedPage, SharedPageFacts, SharedPageStore } from './types';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { r as resolveRscData, t as createServer } from "./chunks/createServer-Bd_b7T3k.js";
2
- import { a as presentsCredential, c as wildcardSubdomain, d as createAuthAdapters, f as createJsonAdapters, i as fixedSpace, k as createCacheInvalidator, l as createMemoryCache, n as createSpaceAdapters, nt as DEFAULT_IGNORED_QUERY_PARAMS, o as renderGrant, p as createCloudAdapters, r as authoringPreview, s as verifiedDomain, t as createRedisPageStore, u as refuse } from "./chunks/core-TlrWmT4B.js";
3
- import { S as createMemoryDraftStore, b as resolveServices, w as takeDraftOverride } from "./chunks/buildBody-W9D8ySNY.js";
1
+ import { r as resolveRscData, t as createServer } from "./chunks/createServer-BSmQqzwb.js";
2
+ import { L as createCacheInvalidator, _ as createCloudAdapters, c as fixedSpace, d as verifiedDomain, dt as DEFAULT_IGNORED_QUERY_PARAMS, f as wildcardSubdomain, g as createJsonAdapters, h as createAuthAdapters, l as presentsCredential, m as refuse, n as createSpaceAdapters, p as createMemoryCache, s as authoringPreview, t as createRedisPageStore, u as renderGrant } from "./chunks/core-CoKORAOg.js";
3
+ import { E as takeDraftOverride, _ as resolveServices, w as createMemoryDraftStore } from "./chunks/buildBody-Bm398uxH.js";
4
4
  import path from "node:path";
5
5
  import { serverLog } from "@plitzi/sdk-kernel/log";
6
6
  import { isRecord } from "@plitzi/sdk-shared/helpers";
@@ -0,0 +1,21 @@
1
+ /** A face of the icon font, as the SDK's icon stylesheet declares it: the family, the weight and its file. */
2
+ export type IconFace = {
3
+ key: 'solid' | 'regular' | 'brands';
4
+ family: string;
5
+ weight: string;
6
+ file: string;
7
+ };
8
+ /** Every icon name the SDK's sheet draws, its glyph, and which names are the brands' face. */
9
+ export type IconGlyphs = {
10
+ codepoints: ReadonlyMap<string, number>;
11
+ brands: ReadonlySet<string>;
12
+ faces: IconFace[];
13
+ };
14
+ /**
15
+ * The SDK's icon stylesheet read for what it draws: each name's glyph, the faces and their files. The sheet is Font
16
+ * Awesome's sheets one after another (`apps/sdk`'s `iconsPlugin`), the brands' last: a name declared after the brands'
17
+ * face is a brand.
18
+ */
19
+ export declare const parseIconGlyphs: (css: string) => IconGlyphs;
20
+ /** The glyphs of the SDK installed at `sdkDir`, read once per process. */
21
+ export declare const iconGlyphsAt: (sdkDir: string) => IconGlyphs;
@@ -0,0 +1,11 @@
1
+ import { TtlCache } from '../../helpers/cache';
2
+ import { SSRPageServerConfig } from '../../types';
3
+ import { SSRRequest, SSRResponseHelpers } from '@plitzi/sdk-kernel/types';
4
+ import { OfflineDataRaw } from '@plitzi/sdk-shared';
5
+ /**
6
+ * A face of the icon font cut to the glyphs the space names (`spaceIconsOf`), linked by its pages' heads — answered by
7
+ * whichever replica the request reaches, from the space as the request resolves it, as the stylesheet is. The name is
8
+ * the glyphs': asked for by the name it has now, it is kept for good; by an older one, it answers the space's glyphs as
9
+ * they are, kept by nobody — a glyph either lacks is drawn from the whole font all the same.
10
+ */
11
+ export declare const handleIconFace: (req: SSRRequest, res: SSRResponseHelpers, config: SSRPageServerConfig, sdkDir: string | undefined, offlineDataCache?: TtlCache<OfflineDataRaw>) => Promise<void>;
@@ -0,0 +1,26 @@
1
+ import { IconFace, IconGlyphs } from './glyphs';
2
+ import { OfflineDataRaw } from '@plitzi/sdk-shared';
3
+ /** Where a space's own icon faces are served: `/_plitzi/icons/<hash>-<face>.woff2`. */
4
+ export declare const ICONS_PATH = "/_plitzi/icons/";
5
+ /** One face cut to the glyphs a space names. */
6
+ export type SpaceIconFace = IconFace & {
7
+ codepoints: number[];
8
+ href: string;
9
+ };
10
+ /** The icons a space names, as faces of their own: what the page's head declares after the whole font's. */
11
+ export type SpaceIcons = {
12
+ hash: string;
13
+ faces: SpaceIconFace[];
14
+ };
15
+ /**
16
+ * The glyphs a space names anywhere in its document — an attribute, a component's props, a binding's template, a flow's
17
+ * params: `'fas fa-check'` and both sides of `open ? 'fa-chevron-up' : 'fa-chevron-down'` alike. An icon named only by
18
+ * data the space reads at run time is not here, and needs nothing: the whole font is declared before these faces, so
19
+ * the browser draws a glyph these lack from it.
20
+ */
21
+ export declare const spaceIconsOf: (offlineData: OfflineDataRaw, glyphs: IconGlyphs) => SpaceIcons | undefined;
22
+ /**
23
+ * The faces as the head declares them. Declared after the whole font's, a face with a `unicode-range` is the one a
24
+ * glyph in its range is drawn from: the page fetches the space's few glyphs, not the whole font.
25
+ */
26
+ export declare const iconFacesCss: (icons: SpaceIcons) => string;
@@ -1,4 +1,4 @@
1
- import { SSRVisitorCredentialsConfig } from '../../types';
1
+ import { SSRPaintedDefaults, SSRVisitorCredentialsConfig } from '../../types';
2
2
  import { ProjectDataLookup } from '@plitzi/sdk-kernel/data';
3
3
  import { RscElementResolver } from '@plitzi/sdk-kernel/engine';
4
4
  import { OutboundOptions } from '@plitzi/sdk-kernel/outbound';
@@ -18,7 +18,7 @@ import { SSRAdapters } from '@plitzi/sdk-kernel/types';
18
18
  *
19
19
  * A deployment that resolves server elements some other way still supplies its own `getRscData`, and that one wins.
20
20
  */
21
- export declare const connectorRscData: ({ engine, publicDir, data, elementTimeoutMs, sayFailures, outbound, visitorCredentials }: {
21
+ export declare const connectorRscData: ({ engine, publicDir, data, elementTimeoutMs, sayFailures, outbound, visitorCredentials, paintedDefaults }: {
22
22
  /** The engine's resolver of an element that names an action or a connector (`PageEngine.resolveElement`). */
23
23
  engine?: RscElementResolver;
24
24
  /** Where the server's static files are: a provider whose `query` is one of them is read from disk. */
@@ -36,4 +36,6 @@ export declare const connectorRscData: ({ engine, publicDir, data, elementTimeou
36
36
  outbound?: OutboundOptions;
37
37
  /** The deployment's own APIs a provider may ask as the visitor, and from which spaces (`rsc.visitorCredentials`). */
38
38
  visitorCredentials?: SSRVisitorCredentialsConfig;
39
+ /** What a painted key starts as for an account the cookie holds none of (`paintedDefaults`). */
40
+ paintedDefaults?: SSRPaintedDefaults;
39
41
  }) => NonNullable<SSRAdapters["getRscData"]>;
@@ -1,3 +1,4 @@
1
+ import { SSRPaintedDefaults } from '../../types/config';
1
2
  import { RscElementResolver } from '@plitzi/sdk-kernel/engine';
2
3
  import { SSRRequest } from '@plitzi/sdk-kernel/types';
3
4
  import { Environment, Schema, SSRRscData, SSRUser } from '@plitzi/sdk-shared';
@@ -24,6 +25,8 @@ export type ResolveRscDataOptions = {
24
25
  signal?: AbortSignal;
25
26
  /** While developing: a failed element says why in its data (`RSC_FAILURE`), where its provider shows it. */
26
27
  sayFailures?: boolean;
28
+ /** What a painted key starts as for an account the cookie holds none of (`paintedDefaults`). */
29
+ paintedDefaults?: SSRPaintedDefaults;
27
30
  };
28
31
  /**
29
32
  * Resolves the server-side data slices for the page addressed by `req`.
@@ -32,4 +35,4 @@ export type ResolveRscDataOptions = {
32
35
  * and the route params are what the browser will see. Each `runtime: 'server'` element resolves independently:
33
36
  * a provider that fails or hangs costs its own slice and nothing else.
34
37
  */
35
- export declare const resolveRscData: ({ schema, req, spaceId, environment, user, ids, resolveElement, flagOverrides, timeoutMs, signal, sayFailures }: ResolveRscDataOptions) => Promise<SSRRscData>;
38
+ export declare const resolveRscData: ({ schema, req, spaceId, environment, user, ids, resolveElement, flagOverrides, timeoutMs, signal, sayFailures, paintedDefaults }: ResolveRscDataOptions) => Promise<SSRRscData>;
@@ -0,0 +1,12 @@
1
+ import { SSRPageServerConfig } from '../../types';
2
+ import { Environment } from '@plitzi/sdk-shared';
3
+ /**
4
+ * What a page is told about the CSRF token its writes to the deployment's own APIs echo: those APIs, the cookie each
5
+ * keeps it in, and where a new one is handed out (`rsc.visitorCredentials`) — as JSON, for `<meta name="plitzi-csrf">`.
6
+ * Only on the pages of a space trusted to carry its visitors' sessions there; none where the deployment names no
7
+ * `csrfPath`.
8
+ */
9
+ export declare const csrfHintFor: (config: SSRPageServerConfig, space: {
10
+ spaceId: number;
11
+ environment: Environment;
12
+ }) => Promise<string | undefined>;
@@ -7,4 +7,4 @@
7
7
  * Kept as text rather than a file beside the module: the server's build moves its modules into chunks, and a deployment
8
8
  * bundles them again (a project's server, `bundleProject`) — a string goes wherever its module goes.
9
9
  */
10
- export declare const DEFAULT_FAVICON_SVG = "<svg version=\"1.1\" id=\"Capa_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" width=\"147.5px\" height=\"149px\" viewBox=\"0 0 147.5 149\" enable-background=\"new 0 0 147.5 149\" xml:space=\"preserve\"> <path fill=\"#4422EE\" d=\"M94.008,120.333l-14.699,14.699c-17.816,17.816-46.86,17.816-64.676,0s-17.816-46.86,0-64.676l14.699-14.699 l5.88,5.88L20.513,76.236c-14.581,14.581-14.581,38.335,0,52.917s38.335,14.581,52.917,0l14.699-14.699L94.008,120.333z\"/> <circle fill=\"#4422EE\" cx=\"32.058\" cy=\"58.79\" r=\"4.178\"/> <ellipse fill=\"#4422EE\" cx=\"90.876\" cy=\"117.587\" rx=\"4.165\" ry=\"4.15\"/> <path fill=\"#4422EE\" d=\"M73.469,44.587c1.562,1.562,1.546,4.111-0.037,5.694L54.09,69.623c-1.583,1.583-4.132,1.599-5.694,0.037l0,0 c-1.562-1.562-1.546-4.111,0.037-5.694l19.342-19.342C69.357,43.041,71.907,43.025,73.469,44.587L73.469,44.587z\"/> <path fill=\"#4422EE\" d=\"M112.978,5.077c1.667,1.667,1.655,4.001,0.208,5.449L81.746,41.967c-1.447,1.447-3.781,1.459-5.449-0.208 l0,0c-1.667-1.667-1.655-4.001-0.208-5.449L107.53,4.869C108.977,3.422,111.311,3.41,112.978,5.077L112.978,5.077z\"/> <path fill=\"#4422EE\" d=\"M82.843,8.292c1.647,1.647,1.599,4.765-0.354,6.718L46.427,51.072c-1.953,1.953-5.071,2-6.718,0.354l0,0 c-1.647-1.647-1.599-4.765,0.354-6.718L76.125,8.646C78.078,6.693,81.196,6.645,82.843,8.292L82.843,8.292z\"/> <path fill=\"#4422EE\" d=\"M99.814,49.304c1.367,1.367,1.367,3.583,0,4.95L87.086,66.982c-1.367,1.367-3.583,1.367-4.95,0l0,0 c-1.367-1.367-1.367-3.583,0-4.95l12.728-12.728C96.231,47.937,98.447,47.937,99.814,49.304L99.814,49.304z\"/> <path fill=\"#4422EE\" d=\"M136.605,12.557c1.355,1.355,1.355,3.551,0,4.906l-28.328,28.328c-1.355,1.355-3.551,1.355-4.906,0 l-0.044-0.044c-1.355-1.355-1.355-3.551,0-4.906l28.328-28.328c1.355-1.355,3.551-1.355,4.906,0L136.605,12.557z\"/> <path fill=\"#4422EE\" d=\"M105.824,77.942c1.562,1.562,1.546,4.111-0.037,5.694l-19.342,19.342c-1.583,1.583-4.132,1.599-5.694,0.037 l0,0c-1.562-1.562-1.546-4.111,0.037-5.694l19.342-19.342C101.713,76.397,104.262,76.38,105.824,77.942L105.824,77.942z\"/> <path fill=\"#4422EE\" d=\"M145.334,38.432c1.667,1.667,1.655,4.001,0.208,5.449l-31.441,31.441c-1.447,1.447-3.781,1.459-5.449-0.208 l0,0c-1.667-1.667-1.655-4.001-0.208-5.449l31.441-31.441C141.332,36.777,143.666,36.765,145.334,38.432L145.334,38.432z\"/> <path fill=\"#4422EE\" d=\"M141.533,66.982c1.647,1.647,1.599,4.765-0.354,6.718l-36.062,36.062c-1.953,1.953-5.071,2-6.718,0.354l0,0 c-1.647-1.647-1.599-4.765,0.354-6.718l36.062-36.062C136.768,65.383,139.886,65.335,141.533,66.982L141.533,66.982z\"/> <g> <path fill=\"#4422EE\" d=\"M80.474,72.436c-1.181,2.571-4.779,10.395-4.779,30.029c0,16.274-13.242,29.516-29.516,29.516 s-29.516-13.242-29.516-29.516s13.242-29.516,29.516-29.516c19.642,0,27.477-3.585,30.053-4.76 c0.985-0.453,2.646-1.216,4.057,0.193C81.692,69.788,80.93,71.446,80.474,72.436z M64.907,79.179 c-1.921,0.202-4.232,1.481-7.065,3.909c-5.126,4.393-11.172,11.979-15.066,17.437c-2.843-0.443-5.84,0.773-7.615,2.991 c-3.257,4.071-0.53,7.704-3.603,10.944c-0.535,0.564-0.344,1.491,0.371,1.797c5.026,2.152,11.451,0.811,14.464-2.367 c1.842-1.942,2.844-4.809,2.341-7.509c5.386-4.133,12.828-10.504,17.042-15.789c2.334-2.927,3.518-5.281,3.62-7.198 C69.535,80.812,67.531,78.903,64.907,79.179L64.907,79.179z\"/> <path fill=\"#4422EE\" d=\"M44.727,112.307c-2.039,2.15-6.55,3.402-10.564,2.331c2.244-3.58,0.315-6.79,2.699-9.77 c1.956-2.445,5.889-3.129,8.175-0.843C47.708,106.696,46.464,110.476,44.727,112.307z\"/> <path fill=\"#4422EE\" d=\"M44.956,101.215c0.548-0.758,1.407-1.927,2.481-3.328l3.668,3.668c-1.351,1.111-2.479,2.002-3.21,2.57 C47.236,102.943,46.216,101.882,44.956,101.215L44.956,101.215z\"/> <path fill=\"#4422EE\" d=\"M67.12,83.23c-0.251,4.695-10.719,13.862-14.292,16.887l-4.008-4.008 c2.94-3.723,11.57-14.256,16.276-14.751C66.352,81.226,67.185,82.018,67.12,83.23z\"/> </g> </svg>";
10
+ export declare const DEFAULT_FAVICON_SVG = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\" width=\"512\" height=\"512\"><!-- The layers: Font Awesome Free 7.3.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0) Copyright 2026 Fonticons, Inc. --><rect width=\"512\" height=\"512\" rx=\"112\" fill=\"#5b3df5\"/><path fill=\"#ffffff\" transform=\"translate(102 102) scale(0.6)\" d=\"M232.5 5.2c14.9-6.9 32.1-6.9 47 0l218.6 101c8.5 3.9 13.9 12.4 13.9 21.8s-5.4 17.9-13.9 21.8l-218.6 101c-14.9 6.9-32.1 6.9-47 0L13.9 149.8C5.4 145.8 0 137.3 0 128s5.4-17.9 13.9-21.8L232.5 5.2zM48.1 218.4l164.3 75.9c27.7 12.8 59.6 12.8 87.3 0l164.3-75.9 34.1 15.8c8.5 3.9 13.9 12.4 13.9 21.8s-5.4 17.9-13.9 21.8l-218.6 101c-14.9 6.9-32.1 6.9-47 0L13.9 277.8C5.4 273.8 0 265.3 0 256s5.4-17.9 13.9-21.8l34.1-15.8zM13.9 362.2l34.1-15.8 164.3 75.9c27.7 12.8 59.6 12.8 87.3 0l164.3-75.9 34.1 15.8c8.5 3.9 13.9 12.4 13.9 21.8s-5.4 17.9-13.9 21.8l-218.6 101c-14.9 6.9-32.1 6.9-47 0L13.9 405.8C5.4 401.8 0 393.3 0 384s5.4-17.9 13.9-21.8z\"/></svg>";
@@ -17,8 +17,15 @@ import { PageAccess } from '@plitzi/sdk-shared/schema';
17
17
  export declare const SPACE_DOCUMENT_PATH = "/_plitzi/space/";
18
18
  /** The space as it is now, for a page that renders it itself rather than one the server drew (`handleCurrentSpace`). */
19
19
  export declare const CURRENT_SPACE_PATH = "/_plitzi/space.json";
20
+ /**
21
+ * The page a document of the space in parts is that page's: its shell and its own part. Named in its address so that a
22
+ * process that did not draw the page — another replica, a process restarted — answers the same document rather than
23
+ * the whole space (`documentNow`), which it did: a visitor whose page and document reached two processes downloaded
24
+ * every page of the space.
25
+ */
26
+ export declare const PAGE_PARAM = "page";
20
27
  /** Where the page fetches `document` from — and the promise that this process can answer it. */
21
- export declare const publishSpaceDocument: (spaceId: number, environment: Environment, document: SpaceDocument, kept?: PageAccess[]) => string;
28
+ export declare const publishSpaceDocument: (spaceId: number, environment: Environment, document: SpaceDocument, kept?: PageAccess[], pageId?: string) => string;
22
29
  /**
23
30
  * Answers `/_plitzi/space/<hash>.json` for the space this host serves, behind the same gates as its pages.
24
31
  *
package/dist/oauth.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as dropPending, D as putCode, E as getPending, O as putPending, S as scopesOf, T as getClient, a as handleRegister, b as protectedResourceMetadata, c as redirectWithError, d as randomId, f as verifyChallenge, g as REGISTER_PATH, h as PROTECTED_RESOURCE_PATH, i as handleAuthorizeSubmit, l as sendErrorJson, m as AUTHORIZE_PATH, n as handleToken, o as redirectToSignIn, p as AUTHORIZATION_SERVER_PATH, r as handleAuthorizeStart, s as redirectWithCode, t as handleRevoke, u as sendJson, v as TOKEN_PATH, w as getAccess, x as resourceMetadataUrl, y as authorizationServerMetadata } from "./chunks/token-B2uY9JzU.js";
1
+ import { C as dropPending, D as putCode, E as getPending, O as putPending, S as scopesOf, T as getClient, a as handleRegister, b as protectedResourceMetadata, c as redirectWithError, d as randomId, f as verifyChallenge, g as REGISTER_PATH, h as PROTECTED_RESOURCE_PATH, i as handleAuthorizeSubmit, l as sendErrorJson, m as AUTHORIZE_PATH, n as handleToken, o as redirectToSignIn, p as AUTHORIZATION_SERVER_PATH, r as handleAuthorizeStart, s as redirectWithCode, t as handleRevoke, u as sendJson, v as TOKEN_PATH, w as getAccess, x as resourceMetadataUrl, y as authorizationServerMetadata } from "./chunks/token-XEz1n4jp.js";
2
2
  import { readRawBody } from "@plitzi/sdk-kernel/http";
3
3
  // src/core/oauth/challenge.ts
4
4
  /** The credential on an MCP request. `Authorization: Bearer` is what RFC 6750 defines and what a remote host
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Pages and actions in one process: `createPlatform` builds the actions engine and hands it to the page server (RFC 0032,
2
+ * Pages and actions in one process: `createPlatform` builds the actions engine and hands it to the page server (docs/en/server-packages.md,
3
3
  * D11). Its own entry so a page server deployed on its own never loads the engine to find out it has none.
4
4
  */
5
5
  export { createPlatform } from './core/platform';
package/dist/platform.js CHANGED
@@ -1 +1 @@
1
- export { t as createPlatform } from "./chunks/platform-DhdFYWm5.js";
1
+ export { t as createPlatform } from "./chunks/platform-BTssQQXp.js";
package/dist/project.js CHANGED
@@ -1,6 +1,6 @@
1
- import { n as LIVE_PAGES_PATH } from "./chunks/createServer-Bd_b7T3k.js";
2
- import { f as createJsonAdapters, h as escapeHtml, p as createCloudAdapters } from "./chunks/core-TlrWmT4B.js";
3
- import { t as createPlatform } from "./chunks/platform-DhdFYWm5.js";
1
+ import { n as LIVE_PAGES_PATH } from "./chunks/createServer-BSmQqzwb.js";
2
+ import { _ as createCloudAdapters, b as escapeHtml, g as createJsonAdapters } from "./chunks/core-CoKORAOg.js";
3
+ import { t as createPlatform } from "./chunks/platform-BTssQQXp.js";
4
4
  import { reachOwnServer } from "@plitzi/sdk-kernel/outbound";
5
5
  import { EMPTY_SCHEMA } from "@plitzi/sdk-shared/schema";
6
6
  import { mkdir, writeFile } from "node:fs/promises";
package/dist/spaces.d.ts CHANGED
@@ -3,5 +3,5 @@
3
3
  * keeps the answer: the resolution a page server renders with, apart from the renderer. A process that serves no pages
4
4
  * (a worker, an API) resolves spaces through this and loads nothing of React or the SDK.
5
5
  */
6
- export { authoringPreview, createMemoryCache, createSpaceAdapters, fixedSpace, presentsCredential, refuse, renderGrant, verifiedDomain, wildcardSubdomain } from './adapters/space';
7
- export type { AuthoringPreviewOptions, DeploymentRow, RenderGrantOptions, SpaceAdapters, SpaceAdaptersConfig, SpaceCache, SpaceRefusal, SpaceResolution, SpaceResolver, WildcardSubdomainOptions } from './adapters/space';
6
+ export { authoringPreview, createMemoryCache, createSpaceAdapters, fixedSpace, parsePreviewLabel, presentsCredential, PREVIEW_KEY_LENGTH, previewLabel, refuse, renderGrant, snapshotPreview, verifiedDomain, wildcardSubdomain } from './adapters/space';
7
+ export type { AuthoringPreviewOptions, DeploymentRow, PreviewAddress, RenderGrantOptions, SnapshotPreviewOptions, SpaceAdapters, SpaceAdaptersConfig, SpaceCache, SpaceRefusal, SpaceResolution, SpaceResolver, WildcardSubdomainOptions } from './adapters/space';
package/dist/spaces.js CHANGED
@@ -1 +1 @@
1
- export { r as authoringPreview, l as createMemoryCache, n as createSpaceAdapters, i as fixedSpace, a as presentsCredential, u as refuse, o as renderGrant, s as verifiedDomain, c as wildcardSubdomain } from "./chunks/core-TlrWmT4B.js";
1
+ export { r as PREVIEW_KEY_LENGTH, s as authoringPreview, p as createMemoryCache, n as createSpaceAdapters, c as fixedSpace, i as parsePreviewLabel, l as presentsCredential, a as previewLabel, m as refuse, u as renderGrant, o as snapshotPreview, d as verifiedDomain, f as wildcardSubdomain } from "./chunks/core-CoKORAOg.js";
package/dist/ssr.d.ts CHANGED
@@ -9,6 +9,6 @@
9
9
  * an injected render stage needs. */
10
10
  export { buildBody } from './modules/ssr/buildBody';
11
11
  export { createMemoryDraftStore, takeDraftOverride } from './modules/ssr/preview';
12
- export type { PluginManager } from './plugins/manager';
12
+ export { PluginManager } from './plugins/manager';
13
13
  export type { ServerCaches } from './helpers/cache';
14
14
  export type { PipelineExtensions, SSRContext } from './core/http/pageContext';
package/dist/ssr.js CHANGED
@@ -1 +1 @@
1
- export { t as buildBody, S as createMemoryDraftStore, w as takeDraftOverride } from "./chunks/buildBody-W9D8ySNY.js";
1
+ export { S as PluginManager, t as buildBody, w as createMemoryDraftStore, E as takeDraftOverride } from "./chunks/buildBody-Bm398uxH.js";
@@ -64,6 +64,14 @@ export type SSRCacheConfig = {
64
64
  /** The pages every replica shares. Without one, each process keeps its own. */
65
65
  store?: SharedPageStore;
66
66
  };
67
+ /** What `paintedDefaults` is asked with: the space being drawn, the account the request proved, the keys it lacks. */
68
+ export type SSRPaintedDefaultsContext = {
69
+ spaceId: number;
70
+ environment: Environment;
71
+ account: number | string;
72
+ keys: string[];
73
+ };
74
+ export type SSRPaintedDefaults = (context: SSRPaintedDefaultsContext) => Record<string, unknown> | undefined | Promise<Record<string, unknown> | undefined>;
67
75
  export type SSRRscConfig = {
68
76
  /** Whether the RSC endpoint is active. Defaults to true when adapters.getRscData is provided. */
69
77
  enabled?: boolean;
@@ -119,6 +127,13 @@ export type SSRVisitorCredentialsConfig = {
119
127
  spaceId: number;
120
128
  environment: Environment;
121
129
  }) => boolean | Promise<boolean>;
130
+ /**
131
+ * Where each of those APIs hands out a CSRF token (`'/auth/csrf'`, the kernel's flow). Given, the pages of the spaces
132
+ * above are told the APIs and the cookie each keeps the token in (`<meta name="plitzi-csrf">`), and every write they
133
+ * send there with the visitor's session echoes it (`@plitzi/sdk-shared/csrf`) — what an API that asks for it
134
+ * (`createCsrfMiddleware`) needs. Never told to a space not trusted to carry its visitors' sessions.
135
+ */
136
+ csrfPath?: string;
122
137
  };
123
138
  export type SSRServerConfig = ServerBaseConfig & {
124
139
  /**
@@ -198,6 +213,15 @@ export type SSRServerConfig = ServerBaseConfig & {
198
213
  trustedTypes?: false | 'report-only';
199
214
  /** RSC (React Server Components) endpoint configuration. */
200
215
  rsc?: SSRRscConfig;
216
+ /**
217
+ * What a painted key (`settings.paintedState`) starts as for a signed-in visitor whose cookie holds none of it — the
218
+ * first visit after signing in, or after another account signed in on this browser (whose values are never drawn for
219
+ * this one). The page is drawn with it, its server providers ask with it, and the browser starts from it, as from a
220
+ * painted value — a dashboard knows its workspace on the first visit instead of learning it once the browser runs.
221
+ * Asked only for an account the request proved, once a request, for the keys it lacks; a key left out stays missing.
222
+ * The deployment's answer, never a space's: it reads the deployment's own records.
223
+ */
224
+ paintedDefaults?: SSRPaintedDefaults;
201
225
  /** Which request-handling services this server mounts: `ssr` on by default, `rsc` whenever
202
226
  * `adapters.getRscData` exists. Stages a companion package contributes are deliberately NOT flags here —
203
227
  * handing them over is the decision. Only createServer reads these as written; the surface factories pin what
@@ -1,2 +1,2 @@
1
- export type { SSRCacheConfig, SSRPageServerConfig, SSRRenderLimitConfig, SSRRscConfig, SSRServerConfig, SSRSignInConfig, SSRVisitorCredentialsConfig, SharedPage, SharedPageFacts, SharedPageStore } from './config';
1
+ export type { SSRCacheConfig, SSRPageServerConfig, SSRPaintedDefaults, SSRPaintedDefaultsContext, SSRRenderLimitConfig, SSRRscConfig, SSRServerConfig, SSRSignInConfig, SSRVisitorCredentialsConfig, SharedPage, SharedPageFacts, SharedPageStore } from './config';
2
2
  export type { CacheFilter, CacheManager, PluginRegistry, SSRFontsConfig, SSRImagesConfig, SSRPlugin, SSRServer, SSRTemplateFn, ServerServices } from './server';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-server",
3
- "version": "0.39.3",
3
+ "version": "0.39.6",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist",
@@ -70,6 +70,12 @@
70
70
  "import": "./dist/bundle.js",
71
71
  "default": "./dist/bundle.js"
72
72
  },
73
+ "./deploy": {
74
+ "@plitzi/source": "./src/deploy.ts",
75
+ "types": "./dist/deploy.d.ts",
76
+ "import": "./dist/deploy.js",
77
+ "default": "./dist/deploy.js"
78
+ },
73
79
  "./env": {
74
80
  "@plitzi/source": "./src/env.ts",
75
81
  "types": "./dist/env.d.ts",
@@ -89,34 +95,32 @@
89
95
  "./dist/env.js"
90
96
  ],
91
97
  "dependencies": {
92
- "@plitzi/plitzi-sdk": "0.39.3",
93
- "@plitzi/sdk-kernel": "0.39.3",
94
- "@plitzi/sdk-shared": "0.39.3",
98
+ "@plitzi/plitzi-sdk": "0.39.6",
99
+ "@plitzi/sdk-actions": "0.39.6",
100
+ "@plitzi/sdk-kernel": "0.39.6",
101
+ "@plitzi/sdk-shared": "0.39.6",
95
102
  "ejs": "^7.0.2",
96
103
  "esbuild": "^0.28.2",
97
- "jsonwebtoken": "^9.0.3"
104
+ "jsonwebtoken": "^9.0.3",
105
+ "subset-font": "^2.9.0"
98
106
  },
99
107
  "peerDependencies": {
100
- "@plitzi/sdk-actions": "^0.39.3",
101
108
  "react": "^19",
102
109
  "react-dom": "^19",
103
110
  "sharp": "^0.34.0"
104
111
  },
105
112
  "peerDependenciesMeta": {
106
- "@plitzi/sdk-actions": {
107
- "optional": true
108
- },
109
113
  "sharp": {
110
114
  "optional": true
111
115
  }
112
116
  },
113
117
  "devDependencies": {
114
- "@plitzi/sdk-actions": "0.39.3",
115
- "@plitzi/sdk-runtime": "0.39.3",
118
+ "@plitzi/sdk-runtime": "0.39.6",
116
119
  "@types/ejs": "^3.1.5",
117
120
  "@types/jsonwebtoken": "^9.0.10",
118
121
  "@types/node": "^26.6.6",
119
122
  "@types/react": "^19.3.0",
123
+ "@types/subset-font": "^2.3.0",
120
124
  "@types/ws": "^8.18.2",
121
125
  "@vitejs/plugin-react": "^6.3.0",
122
126
  "@vitest/coverage-v8": "^5.1.0",
@@ -128,10 +132,10 @@
128
132
  "sharp": "^0.35.5",
129
133
  "tsx": "^4.23.15",
130
134
  "typescript": "^6.0.3",
131
- "vite": "^8.3.7",
135
+ "vite": "^8.3.8",
132
136
  "vite-plugin-dts": "^5.1.2",
133
137
  "vitest": "^5.1.0",
134
- "ws": "^8.22.2"
138
+ "ws": "^8.23.0"
135
139
  },
136
140
  "scripts": {
137
141
  "prepack": "node scripts/copy-authoring-skill.mjs",
@@ -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
  ]