@plitzi/sdk-server 0.39.3 → 0.39.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +49 -7
- package/dist/auth.d.ts +3 -2
- package/dist/auth.js +26 -107
- package/dist/cache.js +1 -1
- package/dist/chunks/{buildBody-W9D8ySNY.js → buildBody-BSC0UbjP.js} +352 -110
- package/dist/chunks/{core-TlrWmT4B.js → core-w7FIMpgv.js} +86 -4
- package/dist/chunks/{createServer-Bd_b7T3k.js → createServer-BQ0KE0Qu.js} +157 -34
- package/dist/chunks/{platform-DhdFYWm5.js → platform-C0AVlwpB.js} +2 -2
- package/dist/chunks/throttle-CRiZB6_A.js +330 -0
- package/dist/chunks/{token-B2uY9JzU.js → token-CBUubxtm.js} +1 -1
- package/dist/chunks/views/template.ejs +7 -0
- package/dist/core/auth/api/context.d.ts +4 -4
- package/dist/core/auth/api/values.d.ts +6 -0
- package/dist/core/auth/createAuth.d.ts +1 -1
- package/dist/core/auth/throttle.d.ts +54 -4
- package/dist/core/createServer.d.ts +1 -1
- package/dist/core/platform.d.ts +1 -1
- package/dist/core/services/iconFaces.d.ts +3 -0
- package/dist/core/services/llmsTxt.d.ts +15 -0
- package/dist/core/services/robotsTxt.d.ts +2 -8
- package/dist/core/services/securityTxt.d.ts +10 -0
- package/dist/handlers.js +1 -1
- package/dist/helpers/documentParts.d.ts +10 -0
- package/dist/helpers/paintedCookie.d.ts +15 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/modules/icons/glyphs.d.ts +21 -0
- package/dist/modules/icons/handler.d.ts +11 -0
- package/dist/modules/icons/spaceIcons.d.ts +26 -0
- package/dist/modules/rsc/connectorRscData.d.ts +4 -2
- package/dist/modules/rsc/resolveRscData.d.ts +4 -1
- package/dist/modules/ssr/csrfHint.d.ts +12 -0
- package/dist/modules/ssr/defaultFavicon.d.ts +1 -1
- package/dist/modules/ssr/spaceDocument.d.ts +8 -1
- package/dist/oauth.js +1 -1
- package/dist/platform.d.ts +1 -1
- package/dist/platform.js +1 -1
- package/dist/project.js +3 -3
- package/dist/spaces.js +1 -1
- package/dist/ssr.js +1 -1
- package/dist/types/config.d.ts +24 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +10 -8
- package/skills/plitzi-authoring/recipes/accordion.ts +3 -1
- package/skills/plitzi-authoring/recipes/carousel.ts +68 -63
- package/skills/plitzi-authoring/recipes/detail-page.ts +43 -33
- package/skills/plitzi-authoring/recipes/embed-and-svg.ts +16 -11
- package/skills/plitzi-authoring/recipes/every-few-seconds.ts +52 -42
- package/skills/plitzi-authoring/recipes/feature-flag.ts +7 -2
- package/skills/plitzi-authoring/recipes/filter-a-list.ts +39 -31
- package/skills/plitzi-authoring/recipes/forms-and-modals.ts +34 -28
- package/skills/plitzi-authoring/recipes/from-tailwind.ts +11 -6
- package/skills/plitzi-authoring/recipes/link-to-a-section.ts +11 -6
- package/skills/plitzi-authoring/recipes/link-with-data.ts +21 -16
- package/skills/plitzi-authoring/recipes/marquee.ts +17 -12
- package/skills/plitzi-authoring/recipes/plugin.ts +16 -10
- package/skills/plitzi-authoring/recipes/scroll-a-row.ts +30 -25
- package/skills/plitzi-authoring/recipes/server-data.ts +15 -10
- package/skills/plitzi-authoring/recipes/show-data.ts +32 -24
- package/skills/plitzi-authoring/recipes/style-a-page.ts +9 -4
- package/skills/plitzi-authoring/recipes/typed-data.ts +26 -21
- package/skills/plitzi-authoring/recipes/usable-without-sight.ts +16 -11
- package/skills/plitzi-authoring/reference/authoring-errors.md +3 -0
- package/skills/plitzi-authoring/reference/efficiency.md +2 -1
- package/dist/chunks/throttle-BH7JLIOF.js +0 -108
|
@@ -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
|
|
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-
|
|
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-CBUubxtm.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
|
package/dist/platform.d.ts
CHANGED
|
@@ -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 (
|
|
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-
|
|
1
|
+
export { t as createPlatform } from "./chunks/platform-C0AVlwpB.js";
|
package/dist/project.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as LIVE_PAGES_PATH } from "./chunks/createServer-
|
|
2
|
-
import { f as createJsonAdapters, h as escapeHtml, p as createCloudAdapters } from "./chunks/core-
|
|
3
|
-
import { t as createPlatform } from "./chunks/platform-
|
|
1
|
+
import { n as LIVE_PAGES_PATH } from "./chunks/createServer-BQ0KE0Qu.js";
|
|
2
|
+
import { f as createJsonAdapters, h as escapeHtml, p as createCloudAdapters } from "./chunks/core-w7FIMpgv.js";
|
|
3
|
+
import { t as createPlatform } from "./chunks/platform-C0AVlwpB.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.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-
|
|
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-w7FIMpgv.js";
|
package/dist/ssr.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as buildBody,
|
|
1
|
+
export { t as buildBody, E as createMemoryDraftStore, O as takeDraftOverride } from "./chunks/buildBody-BSC0UbjP.js";
|
package/dist/types/config.d.ts
CHANGED
|
@@ -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
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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
|
+
"version": "0.39.4",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -89,15 +89,16 @@
|
|
|
89
89
|
"./dist/env.js"
|
|
90
90
|
],
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@plitzi/plitzi-sdk": "0.39.
|
|
93
|
-
"@plitzi/sdk-kernel": "0.39.
|
|
94
|
-
"@plitzi/sdk-shared": "0.39.
|
|
92
|
+
"@plitzi/plitzi-sdk": "0.39.4",
|
|
93
|
+
"@plitzi/sdk-kernel": "0.39.4",
|
|
94
|
+
"@plitzi/sdk-shared": "0.39.4",
|
|
95
95
|
"ejs": "^7.0.2",
|
|
96
96
|
"esbuild": "^0.28.2",
|
|
97
|
-
"jsonwebtoken": "^9.0.3"
|
|
97
|
+
"jsonwebtoken": "^9.0.3",
|
|
98
|
+
"subset-font": "^2.9.0"
|
|
98
99
|
},
|
|
99
100
|
"peerDependencies": {
|
|
100
|
-
"@plitzi/sdk-actions": "^0.39.
|
|
101
|
+
"@plitzi/sdk-actions": "^0.39.4",
|
|
101
102
|
"react": "^19",
|
|
102
103
|
"react-dom": "^19",
|
|
103
104
|
"sharp": "^0.34.0"
|
|
@@ -111,12 +112,13 @@
|
|
|
111
112
|
}
|
|
112
113
|
},
|
|
113
114
|
"devDependencies": {
|
|
114
|
-
"@plitzi/sdk-actions": "0.39.
|
|
115
|
-
"@plitzi/sdk-runtime": "0.39.
|
|
115
|
+
"@plitzi/sdk-actions": "0.39.4",
|
|
116
|
+
"@plitzi/sdk-runtime": "0.39.4",
|
|
116
117
|
"@types/ejs": "^3.1.5",
|
|
117
118
|
"@types/jsonwebtoken": "^9.0.10",
|
|
118
119
|
"@types/node": "^26.6.6",
|
|
119
120
|
"@types/react": "^19.3.0",
|
|
121
|
+
"@types/subset-font": "^2",
|
|
120
122
|
"@types/ws": "^8.18.2",
|
|
121
123
|
"@vitejs/plugin-react": "^6.3.0",
|
|
122
124
|
"@vitest/coverage-v8": "^5.1.0",
|
|
@@ -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: [
|
|
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
|
-
|
|
67
|
-
|
|
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
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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
|
-
|
|
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,
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
query: '/data/products.json',
|
|
22
|
-
cache: true,
|
|
19
|
+
container({
|
|
20
|
+
subType: 'main',
|
|
23
21
|
children: [
|
|
24
|
-
|
|
25
|
-
id: '
|
|
26
|
-
|
|
22
|
+
apiContainer({
|
|
23
|
+
id: 'catalog',
|
|
24
|
+
query: '/data/products.json',
|
|
25
|
+
cache: true,
|
|
27
26
|
children: [
|
|
28
|
-
|
|
27
|
+
list({
|
|
28
|
+
id: 'products',
|
|
29
|
+
items: 'catalog.data.products',
|
|
29
30
|
children: [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
49
|
-
|
|
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
|
-
|
|
55
|
-
id: '
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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: '
|
|
34
|
+
subType: 'main',
|
|
35
35
|
children: [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
]
|