@plitzi/sdk-server 0.38.24 → 0.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/CHANGELOG.md +152 -1
  2. package/README.md +55 -9
  3. package/dist/actions.d.ts +4 -1
  4. package/dist/actions.js +3 -2
  5. package/dist/auth.d.ts +2 -2
  6. package/dist/auth.js +5 -4
  7. package/dist/core/auth/api/accounts.d.ts +11 -0
  8. package/dist/core/auth/api/accounts.js +175 -0
  9. package/dist/core/auth/api/admin.d.ts +41 -0
  10. package/dist/core/auth/api/admin.js +146 -0
  11. package/dist/core/auth/api/context.d.ts +119 -0
  12. package/dist/core/auth/api/context.js +262 -0
  13. package/dist/core/auth/api/factors.d.ts +31 -0
  14. package/dist/core/auth/api/factors.js +209 -0
  15. package/dist/core/auth/api/index.d.ts +94 -0
  16. package/dist/core/auth/api/index.js +43 -0
  17. package/dist/core/auth/api/profile.d.ts +43 -0
  18. package/dist/core/auth/api/profile.js +243 -0
  19. package/dist/core/auth/api/session.d.ts +62 -0
  20. package/dist/core/auth/api/session.js +312 -0
  21. package/dist/core/auth/{api.d.ts → api/types.d.ts} +41 -195
  22. package/dist/core/auth/api/values.d.ts +67 -0
  23. package/dist/core/auth/api/values.js +90 -0
  24. package/dist/core/auth/createAuth.d.ts +49 -39
  25. package/dist/core/auth/createAuth.js +21 -1
  26. package/dist/core/auth/oauth/client.d.ts +2 -2
  27. package/dist/core/auth/oauth/client.js +6 -1
  28. package/dist/core/auth/oauth/index.d.ts +30 -7
  29. package/dist/core/auth/oauth/index.js +33 -14
  30. package/dist/core/auth/oauth/providers/github.js +1 -1
  31. package/dist/core/auth/oauth/providers/google.js +1 -1
  32. package/dist/core/auth/oauth/providers/oidc.d.ts +40 -0
  33. package/dist/core/auth/oauth/providers/oidc.js +197 -0
  34. package/dist/core/auth/oauth/state.d.ts +2 -0
  35. package/dist/core/auth/oauth/state.js +2 -0
  36. package/dist/core/auth/oauth/types.d.ts +21 -3
  37. package/dist/core/auth/oauth/types.js +4 -1
  38. package/dist/core/auth/routes.js +1 -1
  39. package/dist/core/auth/tokens.d.ts +3 -1
  40. package/dist/core/auth/tokens.js +2 -1
  41. package/dist/core/configSeam.d.ts +0 -4
  42. package/dist/core/configSeam.js +12 -1
  43. package/dist/core/createServer.js +16 -4
  44. package/dist/core/freePort.d.ts +10 -0
  45. package/dist/core/freePort.js +39 -1
  46. package/dist/core/handlers/socialRouteHandlers.d.ts +9 -1
  47. package/dist/core/handlers/socialRouteHandlers.js +46 -12
  48. package/dist/core/health.d.ts +1 -0
  49. package/dist/core/health.js +2 -1
  50. package/dist/core/http/stages/authRoutes.d.ts +6 -0
  51. package/dist/core/http/stages/authRoutes.js +42 -1
  52. package/dist/core/http/stages/images.js +5 -3
  53. package/dist/core/http/stages/livePages.js +1 -1
  54. package/dist/core/server/fleet/relay.js +9 -1
  55. package/dist/core/server/fleet/stores.d.ts +7 -0
  56. package/dist/core/server/fleet/stores.js +15 -2
  57. package/dist/core/server/pageServer.js +5 -1
  58. package/dist/core/services/realtime.js +4 -2
  59. package/dist/core/services/registry.js +7 -1
  60. package/dist/core/services/robotsTxt.d.ts +16 -0
  61. package/dist/core/services/robotsTxt.js +50 -0
  62. package/dist/core/services/servedSpace.d.ts +8 -0
  63. package/dist/core/services/servedSpace.js +16 -0
  64. package/dist/core/services/sitemapXml.d.ts +7 -0
  65. package/dist/core/services/sitemapXml.js +37 -0
  66. package/dist/functions-api.d.ts +69 -2
  67. package/dist/helpers/fileStore.d.ts +60 -0
  68. package/dist/helpers/fileStore.js +127 -0
  69. package/dist/helpers/outboundGuard.d.ts +32 -3
  70. package/dist/helpers/outboundGuard.js +50 -5
  71. package/dist/hosts/project/agentRuns.d.ts +24 -0
  72. package/dist/hosts/project/agentRuns.js +107 -0
  73. package/dist/hosts/project/laterAsks.d.ts +41 -0
  74. package/dist/hosts/project/laterAsks.js +117 -0
  75. package/dist/hosts/project/plugins.js +11 -4
  76. package/dist/hosts/project/serveProject.d.ts +8 -1
  77. package/dist/hosts/project/serveProject.js +81 -24
  78. package/dist/hosts/project/spaceFailure.d.ts +4 -0
  79. package/dist/hosts/project/spaceFailure.js +10 -0
  80. package/dist/hosts/project/watchSpace.d.ts +5 -5
  81. package/dist/hosts/project/watchSpace.js +15 -6
  82. package/dist/index.js +2 -2
  83. package/dist/kernel.js +1 -1
  84. package/dist/modules/actions/connectorWrite.js +3 -1
  85. package/dist/modules/actions/index.js +1 -1
  86. package/dist/modules/actions/jobs/fileQueue.d.ts +34 -0
  87. package/dist/modules/actions/jobs/fileQueue.js +72 -0
  88. package/dist/modules/actions/jobs/index.js +3 -3
  89. package/dist/modules/actions/jobs/memoryQueue.js +6 -215
  90. package/dist/modules/actions/jobs/queueDocument.d.ts +14 -0
  91. package/dist/modules/actions/jobs/queueDocument.js +22 -0
  92. package/dist/modules/actions/jobs/queueRules.d.ts +39 -0
  93. package/dist/modules/actions/jobs/queueRules.js +270 -0
  94. package/dist/modules/actions/moduleFor.js +2 -0
  95. package/dist/modules/actions/runtime/fileKv.d.ts +3 -1
  96. package/dist/modules/actions/runtime/fileKv.js +12 -98
  97. package/dist/modules/actions/runtime/guards.d.ts +19 -1
  98. package/dist/modules/actions/runtime/guards.js +10 -1
  99. package/dist/modules/actions/runtime/kvChange.d.ts +40 -0
  100. package/dist/modules/actions/runtime/kvChange.js +23 -1
  101. package/dist/modules/actions/runtime/kvList.d.ts +4 -0
  102. package/dist/modules/actions/runtime/kvList.js +5 -1
  103. package/dist/modules/actions/runtime/kvStore.js +15 -1
  104. package/dist/modules/actions/runtime/namespaceKv.js +2 -0
  105. package/dist/modules/actions/runtime/renderResolver.js +31 -5
  106. package/dist/modules/actions/runtime/runAction.js +16 -6
  107. package/dist/modules/actions/runtime/scope.js +11 -0
  108. package/dist/modules/actions/runtime/taskContext.js +11 -32
  109. package/dist/modules/actions/tasks/auth.js +2 -0
  110. package/dist/modules/actions/tasks/connector.js +6 -2
  111. package/dist/modules/actions/tasks/flow.js +5 -0
  112. package/dist/modules/actions/tasks/http.js +2 -1
  113. package/dist/modules/actions/tasks/kv.js +5 -0
  114. package/dist/modules/actions/tasks/list.js +11 -2
  115. package/dist/modules/actions/tasks/transform.js +2 -0
  116. package/dist/modules/actions/transport/callHandler.js +25 -4
  117. package/dist/modules/actions/types.d.ts +46 -1
  118. package/dist/modules/connectors/engine.d.ts +7 -2
  119. package/dist/modules/connectors/engine.js +4 -4
  120. package/dist/modules/connectors/resolver.d.ts +2 -1
  121. package/dist/modules/connectors/resolver.js +3 -2
  122. package/dist/modules/functions/build.d.ts +7 -2
  123. package/dist/modules/functions/build.js +90 -6
  124. package/dist/modules/functions/capabilities.js +16 -0
  125. package/dist/modules/functions/context.js +6 -2
  126. package/dist/modules/functions/contract.d.ts +39 -1
  127. package/dist/modules/functions/driver.d.ts +2 -1
  128. package/dist/modules/functions/driver.js +35 -0
  129. package/dist/modules/functions/load.d.ts +1 -1
  130. package/dist/modules/functions/load.js +2 -2
  131. package/dist/modules/functions/manifest.js +7 -1
  132. package/dist/modules/functions/oauth.d.ts +1 -1
  133. package/dist/modules/functions/oauth.js +4 -4
  134. package/dist/modules/functions/protocol.d.ts +6 -0
  135. package/dist/modules/functions/sandbox/guest/bytes.d.ts +27 -0
  136. package/dist/modules/functions/sandbox/guest/bytes.js +108 -0
  137. package/dist/modules/functions/sandbox/guest/crypto.d.ts +47 -0
  138. package/dist/modules/functions/sandbox/guest/crypto.js +144 -0
  139. package/dist/modules/functions/sandbox/guest/events.d.ts +152 -0
  140. package/dist/modules/functions/sandbox/guest/events.js +143 -0
  141. package/dist/modules/functions/sandbox/guest/fetch.d.ts +305 -0
  142. package/dist/modules/functions/sandbox/guest/fetch.js +237 -0
  143. package/dist/modules/functions/sandbox/guest/index.d.ts +28 -0
  144. package/dist/modules/functions/sandbox/guest/index.js +130 -0
  145. package/dist/modules/functions/sandbox/{guest.d.ts → guest/types.d.ts} +5 -12
  146. package/dist/modules/functions/sandbox/isolate.js +20 -6
  147. package/dist/modules/functions/space.js +2 -8
  148. package/dist/modules/images/imageProxy.d.ts +3 -2
  149. package/dist/modules/images/imageProxy.js +2 -2
  150. package/dist/modules/mongo/jobQueue.js +0 -19
  151. package/dist/modules/mysql/accounts.js +12 -5
  152. package/dist/modules/mysql/jobs/index.d.ts +1 -1
  153. package/dist/modules/mysql/jobs/schema.d.ts +0 -6
  154. package/dist/modules/mysql/jobs/schema.js +2 -46
  155. package/dist/modules/mysql/schema.js +26 -1
  156. package/dist/modules/mysql/sessions.js +2 -1
  157. package/dist/modules/realtime/handlers.d.ts +9 -4
  158. package/dist/modules/realtime/handlers.js +20 -3
  159. package/dist/modules/realtime/hub.d.ts +4 -2
  160. package/dist/modules/realtime/hub.js +36 -4
  161. package/dist/modules/realtime/index.d.ts +14 -0
  162. package/dist/modules/realtime/index.js +14 -1
  163. package/dist/modules/realtime/presence.d.ts +33 -0
  164. package/dist/modules/realtime/presence.js +56 -0
  165. package/dist/modules/realtime/socket.d.ts +3 -1
  166. package/dist/modules/realtime/socket.js +2 -2
  167. package/dist/modules/rsc/connectorRscData.d.ts +6 -1
  168. package/dist/modules/rsc/connectorRscData.js +27 -6
  169. package/dist/modules/rsc/externalQueryReader.d.ts +28 -0
  170. package/dist/modules/rsc/externalQueryReader.js +43 -0
  171. package/dist/modules/rsc/handler.js +1 -1
  172. package/dist/modules/rsc/resolveRscData.d.ts +11 -1
  173. package/dist/modules/rsc/resolveRscData.js +86 -16
  174. package/dist/modules/runtime/inside.js +1 -1
  175. package/dist/modules/runtime/runner.js +2 -1
  176. package/dist/modules/sqlite/jobQueue.d.ts +35 -0
  177. package/dist/modules/sqlite/jobQueue.js +56 -0
  178. package/dist/modules/sqlite/kv.d.ts +1 -1
  179. package/dist/modules/sqlite/kv.js +2 -10
  180. package/dist/modules/sqlite/open.d.ts +3 -0
  181. package/dist/modules/sqlite/open.js +13 -0
  182. package/dist/modules/ssr/Component.d.ts +5 -1
  183. package/dist/modules/ssr/Component.js +3 -1
  184. package/dist/modules/ssr/applySSRResult.d.ts +8 -1
  185. package/dist/modules/ssr/applySSRResult.js +23 -3
  186. package/dist/modules/ssr/handler.js +30 -5
  187. package/dist/modules/ssr/prepareRender.js +27 -5
  188. package/dist/modules/ssr/preview.d.ts +2 -0
  189. package/dist/modules/ssr/preview.js +6 -3
  190. package/dist/modules/ssr/registerExternalPlugins.d.ts +2 -6
  191. package/dist/modules/ssr/registerExternalPlugins.js +2 -2
  192. package/dist/modules/ssr/resolvePageSeo.d.ts +11 -0
  193. package/dist/modules/ssr/resolvePageSeo.js +13 -2
  194. package/dist/modules/ssr/streamBody.js +2 -2
  195. package/dist/modules/ssr/views/template.ejs +21 -17
  196. package/dist/mysql.d.ts +1 -1
  197. package/dist/mysql.js +2 -2
  198. package/dist/plugins/manager.d.ts +5 -0
  199. package/dist/plugins/manager.js +9 -0
  200. package/dist/sqlite.d.ts +8 -1
  201. package/dist/sqlite.js +3 -1
  202. package/package.json +5 -5
  203. package/skills/plitzi-authoring/CHEATSHEET.md +6 -6
  204. package/skills/plitzi-authoring/SKILL.md +4 -2
  205. package/skills/plitzi-authoring/recipes/accordion.ts +2 -1
  206. package/skills/plitzi-authoring/recipes/carousel.ts +24 -3
  207. package/skills/plitzi-authoring/recipes/detail-page.ts +0 -1
  208. package/skills/plitzi-authoring/recipes/embed-and-svg.ts +3 -1
  209. package/skills/plitzi-authoring/recipes/filter-a-list.ts +0 -1
  210. package/skills/plitzi-authoring/recipes/show-data.ts +0 -1
  211. package/skills/plitzi-authoring/recipes/typed-data.ts +0 -1
  212. package/skills/plitzi-authoring/reference/accessibility.md +7 -2
  213. package/skills/plitzi-authoring/reference/auth.md +15 -4
  214. package/skills/plitzi-authoring/reference/authoring-errors.md +51 -10
  215. package/skills/plitzi-authoring/reference/colours-and-motion.md +7 -1
  216. package/skills/plitzi-authoring/reference/components.md +4 -1
  217. package/skills/plitzi-authoring/reference/data-and-visibility.md +31 -22
  218. package/skills/plitzi-authoring/reference/efficiency.md +2 -1
  219. package/skills/plitzi-authoring/reference/elements-and-styles.md +16 -15
  220. package/skills/plitzi-authoring/reference/flows.md +20 -8
  221. package/skills/plitzi-authoring/reference/kept-state.md +8 -0
  222. package/skills/plitzi-authoring/reference/layouts.md +18 -2
  223. package/skills/plitzi-authoring/reference/lists.md +20 -4
  224. package/skills/plitzi-authoring/reference/plugin-reach.md +12 -0
  225. package/skills/plitzi-authoring/reference/plugins.md +13 -2
  226. package/skills/plitzi-authoring/reference/realtime.md +8 -5
  227. package/skills/plitzi-authoring/reference/structure.md +17 -1
  228. package/skills/plitzi-authoring/reference/templates.md +11 -3
  229. package/skills/plitzi-authoring/reference/testing.md +82 -5
  230. package/skills/plitzi-authoring/reference/typed-sources.md +6 -0
  231. package/skills/plitzi-authoring/reference/validation.md +1 -1
  232. package/dist/core/auth/api.js +0 -1323
  233. package/dist/modules/functions/sandbox/guest.js +0 -662
@@ -1,4 +1,6 @@
1
- import { requestAuthority } from "../../core/requestParser.js";
1
+ import { privateOriginsOf } from "../../helpers/outboundGuard.js";
2
+ import { readDraftToken } from "../../core/previewToken.js";
3
+ import { requestAuthority, requestOrigin } from "../../core/requestParser.js";
2
4
  import { requestFlagOverrides } from "../../helpers/flagOverrides.js";
3
5
  import { authorizesDebugging } from "../../helpers/debugAuthorization.js";
4
6
  import { SPACE_TOKEN_PARAM } from "../../core/auth/credentials.js";
@@ -8,7 +10,6 @@ import { ssrPaintedCookieName } from "../../helpers/paintedCookie.js";
8
10
  import { readCookie } from "../../helpers/readCookie.js";
9
11
  import { buildOfflineDataCacheKey } from "../../helpers/cache/keys.js";
10
12
  import { loadPluginComponents } from "./loadPluginComponents.js";
11
- import { readDraftToken } from "../../core/previewToken.js";
12
13
  import { resolveActionEndpoint, resolveRscEndpoint } from "../../core/services/resolve.js";
13
14
  import { createOfflineDataLoader } from "../../helpers/offlineDataLoader.js";
14
15
  import { hydrationPayload, spaceDocument } from "../../helpers/hydrationPayload.js";
@@ -21,7 +22,7 @@ import { sdkAssetVersion } from "../../core/sdkAssets.js";
21
22
  import { buildServerInfo } from "../../helpers/buildServerInfo.js";
22
23
  import { resolveDebugMode } from "../../helpers/resolveDebugMode.js";
23
24
  import { flagUserFromSSR, flagValues, resolveFlags } from "@plitzi/sdk-shared/flags";
24
- import { collectServerElements, notFoundProvider, pageElementTypes, pageNotFound, pageServerContext, pageWithheldOf, withholdPages } from "@plitzi/sdk-shared/schema";
25
+ import { collectServerElements, notFoundProvider, pageElementTypes, pageHeadTags, pageNotFound, pageServerContext, pageWithheldOf, spaceIdentity, withholdPages } from "@plitzi/sdk-shared/schema";
25
26
  import { debugCookieName } from "@plitzi/sdk-shared/devTools";
26
27
  import { themeFromCookies } from "@plitzi/sdk-shared/theme/cookie";
27
28
  import { paintedKeys, paintedStateFor } from "@plitzi/sdk-shared/state";
@@ -139,12 +140,16 @@ var prepareRender = async (req, config, spaceId, environment, revision, pluginMa
139
140
  * this request's.
140
141
  */
141
142
  const actionRuns = debugAuthorized && req.ctx.actionRuns?.length ? req.ctx.actionRuns : void 0;
142
- const { degrade, analytics } = req.ctx.meter ?? {};
143
+ const runStatus = debugAuthorized && req.ctx.runStatus === true;
144
+ const inspector = req.ctx.inspectedDraft === true;
145
+ const { degrade, badge: meteredBadge, quotaNear: meteredNear, analytics } = req.ctx.meter ?? {};
143
146
  const clientAnalytics = analytics ? {
144
147
  ...analytics,
145
148
  firstViewCounted: true
146
149
  } : void 0;
147
150
  const overQuota = degrade ? true : void 0;
151
+ const quotaNear = meteredNear && !degrade ? true : void 0;
152
+ const badge = meteredBadge ? true : void 0;
148
153
  /**
149
154
  * The visitor's theme, from the cookie the SDK writes it to.
150
155
  *
@@ -203,7 +208,11 @@ var prepareRender = async (req, config, spaceId, environment, revision, pluginMa
203
208
  ...paintedState ? { state: paintedState } : {},
204
209
  ...clientAnalytics ? { analytics: clientAnalytics } : {},
205
210
  ...overQuota ? { overQuota } : {},
211
+ ...quotaNear ? { quotaNear } : {},
212
+ ...badge ? { badge } : {},
206
213
  ...actionRuns ? { actionRuns } : {},
214
+ ...runStatus ? { runStatus } : {},
215
+ ...inspector ? { inspector } : {},
207
216
  ...serverFlags ? { serverFlags } : {},
208
217
  ...forcedFlags ? { forcedFlags } : {}
209
218
  }, { apart: spaceDocumentPath !== void 0 });
@@ -215,7 +224,7 @@ var prepareRender = async (req, config, spaceId, environment, revision, pluginMa
215
224
  const key = pluginManager.ensure(pluginName, pluginSource);
216
225
  if (!pluginBaseNames.has(pluginName)) dynamicNames.push(key);
217
226
  }
218
- const externalNames = config.autoLoadSchemaPlugins !== false ? await m("extPlugins", () => registerExternalPlugins(pluginManager, offlineData, { allowPrivateHosts: config.allowPrivatePluginHosts === true }, pluginBaseNames)) : [];
227
+ const externalNames = config.autoLoadSchemaPlugins !== false ? await m("extPlugins", () => registerExternalPlugins(pluginManager, offlineData, { privateOrigins: privateOriginsOf(config.outbound?.privateOrigins) }, pluginBaseNames)) : [];
219
228
  const allPluginNames = [
220
229
  ...pluginNames,
221
230
  ...dynamicNames,
@@ -248,6 +257,16 @@ var prepareRender = async (req, config, spaceId, environment, revision, pluginMa
248
257
  };
249
258
  });
250
259
  const vendorJs = (debugRendered ? "/sdk-assets/plitzi-sdk-dev-vendor.js" : "/sdk-assets/plitzi-sdk-vendor.js") + v;
260
+ const deploymentProps = req.ctx.spaceDeployment?.templateProps;
261
+ const origin = requestOrigin(req);
262
+ const head = pageHeadTags({
263
+ title: pageSeo.title ?? deploymentProps?.title ?? DEFAULT_TITLE,
264
+ ...pageSeo.description ?? deploymentProps?.description ? { description: pageSeo.description ?? deploymentProps?.description } : {},
265
+ ...pageSeo.robots ? { robots: pageSeo.robots } : {},
266
+ ...pageSeo.image ? { image: pageSeo.image } : {},
267
+ ...pageSeo.imageAlt ? { imageAlt: pageSeo.imageAlt } : {},
268
+ ...pageSeo.type ? { type: pageSeo.type } : {}
269
+ }, spaceIdentity(schema?.settings), origin === "" ? "" : `${origin}${req.path}`);
251
270
  return {
252
271
  componentProps: {
253
272
  plugins: Object.keys(pluginComponents).length > 0 ? pluginComponents : void 0,
@@ -258,6 +277,8 @@ var prepareRender = async (req, config, spaceId, environment, revision, pluginMa
258
277
  sdkDevToolsStylePath,
259
278
  sdkIconsStylePath,
260
279
  overQuota,
280
+ quotaNear,
281
+ badge,
261
282
  theme,
262
283
  ...paintedState ? { state: paintedState } : {},
263
284
  ...serverFlags ? { serverFlags } : {},
@@ -293,6 +314,7 @@ var prepareRender = async (req, config, spaceId, environment, revision, pluginMa
293
314
  fonts: fontsToHead(offlineData?.style.fonts ?? [], fontUrlResolver(config.fonts?.baseUrl)),
294
315
  ...req.ctx.spaceDeployment?.templateProps,
295
316
  ...pageSeo,
317
+ head,
296
318
  plugins: templatePlugins,
297
319
  debugMode: debugAuthorized,
298
320
  ssrOnly: config.ssrOnly === true,
@@ -14,6 +14,8 @@ export type DraftOverride = {
14
14
  token: string;
15
15
  /** Whether the token survived the read — which is what decides if the visit is worth remembering in a cookie. */
16
16
  reusable: boolean;
17
+ /** A session minted for a test runner: the page carries the state bridge. */
18
+ inspected: boolean;
17
19
  };
18
20
  /**
19
21
  * Resolve the draft this request is looking at, if any.
@@ -14,12 +14,13 @@ var DRAFT_STORE_METHODS = {
14
14
  var createMemoryDraftStore = () => {
15
15
  const store = /* @__PURE__ */ new Map();
16
16
  return {
17
- put(token, data, { ttlMs, reusable = false, spaceId }) {
17
+ put(token, data, { ttlMs, reusable = false, spaceId, inspected = false }) {
18
18
  store.set(token, {
19
19
  data,
20
20
  expiresAt: Date.now() + ttlMs,
21
21
  reusable,
22
- spaceId
22
+ spaceId,
23
+ inspected
23
24
  });
24
25
  },
25
26
  take(token) {
@@ -29,7 +30,8 @@ var createMemoryDraftStore = () => {
29
30
  return hit.expiresAt > Date.now() ? {
30
31
  data: hit.data,
31
32
  reusable: hit.reusable,
32
- spaceId: hit.spaceId
33
+ spaceId: hit.spaceId,
34
+ ...hit.inspected ? { inspected: true } : {}
33
35
  } : void 0;
34
36
  },
35
37
  drop(token) {
@@ -51,6 +53,7 @@ var takeDraftOverride = async (req, config) => {
51
53
  return {
52
54
  data: entry.data,
53
55
  reusable: entry.reusable,
56
+ inspected: entry.inspected === true,
54
57
  token
55
58
  };
56
59
  };
@@ -1,9 +1,6 @@
1
+ import { OutboundOptions } from '../../helpers/outboundGuard';
1
2
  import { PluginManager } from '../../plugins/manager';
2
3
  import { OfflineDataRaw } from '@plitzi/sdk-shared';
3
- /** Where a plugin may be read from: anywhere public, and — on a development machine only — a private address too. */
4
- type ManifestReach = {
5
- allowPrivateHosts: boolean;
6
- };
7
4
  /**
8
5
  * Reads plugins listed in offlineData.plugins, fetches their manifests, downloads and caches
9
6
  * JS/CSS via the PluginManager, and returns the effective plugin keys to pass to getEntries().
@@ -12,5 +9,4 @@ type ManifestReach = {
12
9
  * on its CDN. Those are never looked for elsewhere: the deployment's copy is the one rendered, and asking the CDN for a
13
10
  * manifest nobody will use is a request, and a warning, for nothing.
14
11
  */
15
- export declare const registerExternalPlugins: (pluginManager: PluginManager, offlineData: OfflineDataRaw | undefined, reach?: ManifestReach, registered?: ReadonlySet<string>) => Promise<string[]>;
16
- export {};
12
+ export declare const registerExternalPlugins: (pluginManager: PluginManager, offlineData: OfflineDataRaw | undefined, reach?: OutboundOptions, registered?: ReadonlySet<string>) => Promise<string[]>;
@@ -33,7 +33,7 @@ var writeDiskEntry = async (dir, resource, entry) => {
33
33
  var fetchAndStore = async (dir, resource, reach) => {
34
34
  try {
35
35
  const url = `${resource}/plugin-manifest.json`;
36
- const res = reach.allowPrivateHosts ? await fetch(url) : await fetchOutbound(fetch, new URL(url));
36
+ const res = await fetchOutbound(fetch, new URL(url), {}, reach);
37
37
  if (!res.ok) {
38
38
  serverLog.warn("SSR", `Failed to fetch plugin manifest from ${url}: HTTP ${res.status}`);
39
39
  return null;
@@ -102,7 +102,7 @@ var registerPlugin = async (pluginManager, plugin, reach) => {
102
102
  * on its CDN. Those are never looked for elsewhere: the deployment's copy is the one rendered, and asking the CDN for a
103
103
  * manifest nobody will use is a request, and a warning, for nothing.
104
104
  */
105
- var registerExternalPlugins = async (pluginManager, offlineData, reach = { allowPrivateHosts: false }, registered = /* @__PURE__ */ new Set()) => {
105
+ var registerExternalPlugins = async (pluginManager, offlineData, reach = {}, registered = /* @__PURE__ */ new Set()) => {
106
106
  const plugins = offlineData?.plugins?.filter((plugin) => !registered.has(plugin.type));
107
107
  if (!plugins || plugins.length === 0) return [];
108
108
  return (await Promise.all(plugins.map((p) => registerPlugin(pluginManager, p, reach)))).filter((k) => k !== null);
@@ -1,7 +1,17 @@
1
1
  import { Schema } from '@plitzi/sdk-shared';
2
+ import { OgType } from '@plitzi/sdk-shared/schema';
2
3
  export type PageSeo = {
3
4
  title?: string;
4
5
  description?: string;
6
+ /** `<meta name="robots">`: whether search engines index the page and follow its links. */
7
+ robots?: string;
8
+ /** Each JSON-LD object, as the text of its `<script type="application/ld+json">` — escaped for the tag. */
9
+ structuredData?: string[];
10
+ /** The picture a link to the page shows (`og:image`), as the page wrote it: a file of the site or an address. */
11
+ image?: string;
12
+ imageAlt?: string;
13
+ /** What the page is, in Open Graph's words (`og:type`). */
14
+ type?: OgType;
5
15
  };
6
16
  /**
7
17
  * The title and description the addressed page declares for itself.
@@ -17,5 +27,6 @@ export type PageSeo = {
17
27
  *
18
28
  * Either may be a template over the page's server providers and the address (`pageServerContext`): a detail page says
19
29
  * the title of the record it shows, in the HTML a crawler reads. One that does not evaluate is nothing, as a blank is.
30
+ * So may each text of its JSON-LD (`pageStructuredData`).
20
31
  */
21
32
  export declare const resolvePageSeo: (schema: Schema | undefined, pageId: string | undefined, context?: Record<string, unknown>) => PageSeo;
@@ -1,4 +1,4 @@
1
- import { pageSeoText } from "@plitzi/sdk-shared/schema";
1
+ import { isOgType, jsonForScript, pageSeoText, pageStructuredData } from "@plitzi/sdk-shared/schema";
2
2
  //#region src/modules/ssr/resolvePageSeo.ts
3
3
  /**
4
4
  * The title and description the addressed page declares for itself.
@@ -14,6 +14,7 @@ import { pageSeoText } from "@plitzi/sdk-shared/schema";
14
14
  *
15
15
  * Either may be a template over the page's server providers and the address (`pageServerContext`): a detail page says
16
16
  * the title of the record it shows, in the HTML a crawler reads. One that does not evaluate is nothing, as a blank is.
17
+ * So may each text of its JSON-LD (`pageStructuredData`).
17
18
  */
18
19
  var resolvePageSeo = (schema, pageId, context = {}) => {
19
20
  if (!schema || !pageId) return {};
@@ -21,9 +22,19 @@ var resolvePageSeo = (schema, pageId, context = {}) => {
21
22
  if (!page?.attributes.seoEnabled) return {};
22
23
  const title = pageSeoText(page.attributes.seoPageTitle, context);
23
24
  const description = pageSeoText(page.attributes.seoPageDescription, context);
25
+ const robots = typeof page.attributes.seoRobots === "string" ? page.attributes.seoRobots.trim() : "";
26
+ const structuredData = pageStructuredData(page.attributes.seoStructuredData, context).map(jsonForScript);
27
+ const image = pageSeoText(page.attributes.seoImage, context);
28
+ const imageAlt = pageSeoText(page.attributes.seoImageAlt, context);
29
+ const { seoType } = page.attributes;
24
30
  return {
25
31
  ...title ? { title } : {},
26
- ...description ? { description } : {}
32
+ ...description ? { description } : {},
33
+ ...robots ? { robots } : {},
34
+ ...structuredData.length > 0 ? { structuredData } : {},
35
+ ...image ? { image } : {},
36
+ ...image && imageAlt ? { imageAlt } : {},
37
+ ...isOgType(seoType) ? { type: seoType } : {}
27
38
  };
28
39
  };
29
40
  //#endregion
@@ -1,4 +1,4 @@
1
- import { applySSRResult, isReusable, withNotFound, withRefusal } from "./applySSRResult.js";
1
+ import { applySSRResult, isReusable, renderParamsOf, withNotFound, withRefusal } from "./applySSRResult.js";
2
2
  import Component from "./Component.js";
3
3
  import { prepareRender } from "./prepareRender.js";
4
4
  import { renderToPipeableStream } from "react-dom/server";
@@ -51,7 +51,7 @@ var streamBody = async (req, res, config, spaceId, environment, revision, render
51
51
  }
52
52
  withNotFound(result, prep.notFound);
53
53
  withRefusal(result, prep.refused);
54
- if (applySSRResult(res, result)) {
54
+ if (applySSRResult(res, result, renderParamsOf(req.query))) {
55
55
  abort();
56
56
  resolve();
57
57
  return;
@@ -1,22 +1,25 @@
1
1
  <!doctype html>
2
- <html lang="en"<% if (locals.themeClass) { %> class="<%= locals.themeClass %>"<% } %>>
2
+ <html lang="<%= (locals.head && locals.head.lang) || 'en' %>"<% if (locals.themeClass) { %> class="<%= locals.themeClass %>"<% } %>>
3
3
  <head>
4
4
  <meta charset="utf-8" />
5
5
  <title><%= locals.title || '' %></title>
6
- <% if (locals.description) { %>
7
- <meta name="description" content="<%= locals.description %>" />
8
- <% } %>
9
- <meta property="og:type" content="website" />
10
- <% if (locals.title) { %>
11
- <meta property="og:title" content="<%= locals.title %>" />
12
- <meta name="twitter:title" content="<%= locals.title %>" />
13
- <% } %>
14
- <% if (locals.description) { %>
15
- <meta property="og:description" content="<%= locals.description %>" />
16
- <meta name="twitter:description" content="<%= locals.description %>" />
17
- <% } %>
6
+ <%
7
+ /*
8
+ What a link preview, a search engine and the browser read of the page, as `pageHeadTags` (@plitzi/sdk-shared)
9
+ decides it — the page's description, robots, Open Graph and card with its picture, its canonical address, the
10
+ space's icon and colour. The page keeps them as it moves (`PageHead`) from the same definition.
11
+ */
12
+ %>
13
+ <% ((locals.head && locals.head.meta) || []).forEach(function (tag) { %>
14
+ <meta <%= tag.attribute %>="<%= tag.key %>" content="<%= tag.content %>"<% if (tag.media) { %> media="<%= tag.media %>"<% } %> />
15
+ <% }) %>
16
+ <% (locals.structuredData || []).forEach(function (json) { %>
17
+ <script type="application/ld+json"><%- json %></script>
18
+ <% }) %>
18
19
  <meta name="viewport" content="width=device-width, initial-scale=1" />
19
- <link rel="shortcut icon" href="https://cdn.plitzi.com/resources/img/favicon.svg" />
20
+ <% ((locals.head && locals.head.links) || []).forEach(function (link) { %>
21
+ <link rel="<%= link.rel %>" href="<%= link.href %>"<% if (link.type) { %> type="<%= link.type %>"<% } %> />
22
+ <% }) %>
20
23
 
21
24
  <%
22
25
  /*
@@ -34,10 +37,11 @@
34
37
 
35
38
  <%
36
39
  /*
37
- The one origin the document reaches for whatever the space declares: the favicon's. Named here so the space's
38
- own fonts can skip it rather than ask for it twice. A font host is preconnected only when the space uses one.
40
+ Plitzi's icon's origin, reached when the space names no icon of its own. Named here so the space's own fonts
41
+ can skip it rather than ask for it twice. A font host is preconnected only when the space uses one.
39
42
  */
40
- const staticOrigins = ['https://cdn.plitzi.com'];
43
+ const icon = ((locals.head && locals.head.links) || []).find(function (link) { return link.rel === 'icon'; });
44
+ const staticOrigins = icon && icon.href.indexOf('https://cdn.plitzi.com/') === 0 ? ['https://cdn.plitzi.com'] : [];
41
45
  %>
42
46
  <% for (const origin of staticOrigins) { %>
43
47
  <link rel="preconnect" href="<%= origin %>" crossorigin />
package/dist/mysql.d.ts CHANGED
@@ -31,7 +31,7 @@ export { createMysqlStore, mysqlSchemaStatements } from './modules/mysql';
31
31
  * createServer({ action: { lookups, kv: createMysqlKv({ pool }), jobs: { queue: createMysqlJobQueue({ pool }) } } });
32
32
  * ```
33
33
  */
34
- export { createMysqlJobQueue, createMysqlKv, mysqlJobSchemaStatements, mysqlJobSchemaUpgrades } from './modules/mysql/jobs';
34
+ export { createMysqlJobQueue, createMysqlKv, mysqlJobSchemaStatements } from './modules/mysql/jobs';
35
35
  export type { MysqlJobQueue, MysqlJobQueueOptions, MysqlKvOptions } from './modules/mysql/jobs';
36
36
  export { SCHEMA_VERSION, TABLE_NAMES, tableNames } from './modules/mysql';
37
37
  export type { AccountSeed, MysqlAdmin, MysqlConfig, IdentityStore, LinkedIdentity, MysqlStore, SessionStore, SessionSummary, SpaceTokenSeed, TableKey, Tables } from './modules/mysql';
package/dist/mysql.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { TABLE_NAMES, tableNames } from "./modules/mysql/config.js";
2
2
  import { SCHEMA_VERSION } from "./modules/mysql/schema.js";
3
3
  import { createMysqlStore, mysqlSchemaStatements } from "./modules/mysql/index.js";
4
- import { mysqlJobSchemaStatements, mysqlJobSchemaUpgrades } from "./modules/mysql/jobs/schema.js";
4
+ import { mysqlJobSchemaStatements } from "./modules/mysql/jobs/schema.js";
5
5
  import { createMysqlJobQueue } from "./modules/mysql/jobs/jobQueue.js";
6
6
  import { createMysqlKv } from "./modules/mysql/jobs/kv.js";
7
- export { SCHEMA_VERSION, TABLE_NAMES, createMysqlJobQueue, createMysqlKv, createMysqlStore, mysqlJobSchemaStatements, mysqlJobSchemaUpgrades, mysqlSchemaStatements, tableNames };
7
+ export { SCHEMA_VERSION, TABLE_NAMES, createMysqlJobQueue, createMysqlKv, createMysqlStore, mysqlJobSchemaStatements, mysqlSchemaStatements, tableNames };
@@ -27,6 +27,11 @@ export declare class PluginManager {
27
27
  rebuild(name: string): Promise<PluginEntry | null>;
28
28
  private remember;
29
29
  hasPlugin(name: string): boolean;
30
+ /**
31
+ * A plugin no longer there — its folder removed under a dev server: never built again, nothing of it remembered. A run's
32
+ * preview logged "build failed … Could not resolve" for a plugin a task had deleted, build after build.
33
+ */
34
+ unregister(name: string): void;
30
35
  register(name: string, source: PluginSource): void;
31
36
  /**
32
37
  * Keeps a source a render names, and returns the key to pass to getEntries(): `name@version+<identity>`, or
@@ -97,6 +97,15 @@ var PluginManager = class {
97
97
  hasPlugin(name) {
98
98
  return this.resolveKey(name) !== null;
99
99
  }
100
+ /**
101
+ * A plugin no longer there — its folder removed under a dev server: never built again, nothing of it remembered. A run's
102
+ * preview logged "build failed … Could not resolve" for a plugin a task had deleted, build after build.
103
+ */
104
+ unregister(name) {
105
+ const base = name.replace(/@[^@]*$/, "");
106
+ for (const key of Object.keys(this.plugins).filter((each) => each.replace(/@[^@]*$/, "") === base)) Reflect.deleteProperty(this.plugins, key);
107
+ this.forget(base);
108
+ }
100
109
  register(name, source) {
101
110
  this.plugins[name] = source;
102
111
  this.mem.delete(name);
package/dist/sqlite.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- /** A key/value store in a SQLite file, for a deployment with no database. Import it as `@plitzi/sdk-server/sqlite`.
1
+ /** A key/value store and a job queue in a SQLite file, for a deployment with no database. Import it as
2
+ * `@plitzi/sdk-server/sqlite`.
2
3
  *
3
4
  * What server actions keep in `kv` — saved layouts, counters, the single-flight keys a run guard takes — lives in one
4
5
  * process's memory by default, and goes with it. `createFileKv` (`@plitzi/sdk-server/actions`) keeps it in a JSON
@@ -11,7 +12,13 @@
11
12
  * createServer({ adapters, action: { lookups, kv: createSqliteKv({ file: 'data/kv.sqlite' }) } });
12
13
  * ```
13
14
  *
15
+ * The job queue — what `ctx.later`, a schedule's fires and a function's jobs wait in — the same way:
16
+ * `jobs: { queue: createSqliteJobQueue({ db }) }`, beside `createFileJobQueue` (one process, a JSON file) and a
17
+ * database's own (`JobQueue`).
18
+ *
14
19
  * Its own entry because it loads `node:sqlite`, which needs Node 22.13 or later and prints an `ExperimentalWarning`
15
20
  * when it loads: a deployment that does not use it never loads it. */
21
+ export { createSqliteJobQueue } from './modules/sqlite/jobQueue';
16
22
  export { createSqliteKv } from './modules/sqlite/kv';
23
+ export type { SqliteJobQueueOptions } from './modules/sqlite/jobQueue';
17
24
  export type { SqliteKvOptions } from './modules/sqlite/kv';
package/dist/sqlite.js CHANGED
@@ -1 +1,3 @@
1
- export { createSqliteKv } from "./modules/sqlite/kv.js";
1
+ import { createSqliteJobQueue } from "./modules/sqlite/jobQueue.js";
2
+ import { createSqliteKv } from "./modules/sqlite/kv.js";
3
+ export { createSqliteJobQueue, createSqliteKv };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-server",
3
- "version": "0.38.24",
3
+ "version": "0.39.0",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist",
@@ -108,19 +108,19 @@
108
108
  },
109
109
  "type": "module",
110
110
  "engines": {
111
- "node": ">=22.18"
111
+ "node": "^24.22.1 || >=26.12.1"
112
112
  },
113
113
  "sideEffects": [
114
114
  "./dist/env.js"
115
115
  ],
116
116
  "dependencies": {
117
- "@plitzi/plitzi-sdk": "0.38.24",
118
- "@plitzi/sdk-shared": "0.38.24",
117
+ "@plitzi/plitzi-sdk": "0.39.0",
118
+ "@plitzi/sdk-shared": "0.39.0",
119
119
  "ejs": "^7.0.2",
120
120
  "esbuild": "^0.28.2",
121
121
  "jsonwebtoken": "^9.0.3",
122
122
  "nodemailer": "^10.1.3",
123
- "undici": "^8.12.2",
123
+ "undici": "^8.12.3",
124
124
  "ws": "^8.22.0"
125
125
  },
126
126
  "peerDependencies": {
@@ -1,8 +1,8 @@
1
1
  # Plitzi authoring — cheatsheet
2
2
 
3
3
  What most changes need, on one page. Everything is imported from `@plitzi/sdk-authoring`. For the rest, ask by name —
4
- `npx @plitzi/cli explain navigate` (an element, a step, a trigger, a problem's code), `--list steps` for every one of a
5
- kind — rather than reading its `.d.ts`.
4
+ `npx @plitzi/cli explain navigate` (an element, step, server step, trigger, code, filter), `--list steps` for every one
5
+ of a kind — rather than reading its `.d.ts`.
6
6
 
7
7
  ## The space
8
8
 
@@ -49,10 +49,10 @@ carousel({ id: 'hero', items: 'p.data.slides', autoplay: 5000, row: 'slide-card'
49
49
  // rows follow their item's `id`, or `itemKey: 'slug'`
50
50
  apiContainer({ id: 'p', query: '/data/x.json', cache: true, children }) // publishes p.data; no box of its own
51
51
  apiContainer({ id: 'p', query: '/data/x.json', runtime: 'server', children }) // read by the page server: still p.data
52
- apiContainer({ id: 'p', action: 'report', runtime: 'server', children }) // the action's output at p's root: p.rows
52
+ apiContainer({ id: 'p', action: 'report', runtime: 'server', children }) // its output at p's root: p.rows
53
53
  // loadingSlot: 'p-skeleton' — a child shown until it answers
54
54
  form({ id, managedByInteractions: true, flows, children })
55
- formControl({ name: 'email', label: 'Email', subType: 'email', required: true }) // optional without required; select: options: [{ label, value }]
55
+ formControl({ name: 'email', label: 'Email', subType: 'email', required: true }) // optional without required; select: options: [{ label, value }]; number: min, max
56
56
  modalContainer({ id, visible: false, title, children })
57
57
  component('card', { props: { title }, children: { body: [ … ] } })
58
58
  const seats = defineElement(seatsDeclaration); seats({ id }) // a plugin
@@ -104,8 +104,8 @@ A flow is `[trigger, …steps]`, in an element's `flows`.
104
104
  [onClick(), setState({ key: 'saved', type: 'boolean', value: true })] // types: boolean, number, text, json
105
105
  [named('sent', onSubmit()), setState({ key: 'email', type: 'text', value: '{{ sent.values.email }}' })]
106
106
  [on('onChange'), …]; [on('onMouseEnter'), …]; [onPageLoad(), …]; [onKey('mod+k, escape'), …]
107
- [onInterval(5000), …] // every 5 s, while the tab is in view
108
- [onClick(), scrollBy('cards', { x: '80%' })]; scrollTo('cards', { x: 'end' }); scrollIntoView('answer')
107
+ [onInterval(5000), …] // every 5 s, the tab in view
108
+ [onClick(), scrollBy('cards', { x: '80%' })]; scrollTo('cards', { x: 'end' }); scrollIntoView('answer'); focus('field')
109
109
  [named('row', onScroll()), …] // { x, y, atStart, atEnd } of its own box
110
110
  [onClick(), toggleState({ key: 'menuOpen' })]
111
111
  [onClick(), cycleState({ key: 'slide', length: 3, by: -1 })] // goes round; stepState({ key, by, min, max }) stops
@@ -24,7 +24,8 @@ export const space = {
24
24
  };
25
25
  ```
26
26
 
27
- A space on Plitzi — edited in the builder — is edited through the Plitzi MCP server instead, never both on one space.
27
+ A change to a space on Plitzi itself — the builder's — is the Plitzi MCP server's instead. One taken out as a project
28
+ (`plitzi create --from`) and changed through the MCP meanwhile refuses `space push` until `space pull`.
28
29
 
29
30
  ## How to work
30
31
 
@@ -37,7 +38,8 @@ A space on Plitzi — edited in the builder — is edited through the Plitzi MCP
37
38
  4. **Before saying done:** `npm run lint:space` clean, and the [review checklist](reference/review-checklist.md).
38
39
 
39
40
  What a name means — an element, a step, a trigger, a code, any `@plitzi` export (`pageFamily`, `createServer`): `npx plitzi explain
40
- <name>`, in a few lines. Never read the `.d.ts`.
41
+ <name>`, in a few lines; whether there is a way at all — a field an element publishes, a state — `npx plitzi explain
42
+ --search "<words>"`. Never read the `.d.ts`.
41
43
 
42
44
  ## Five rules authoring cannot check for you
43
45
 
@@ -1,5 +1,6 @@
1
1
  /**
2
- * An accordion — questions whose answers open one at a time — written once and mapped over the questions: the open one
2
+ * An accordion — questions whose answers open one at a time, a disclosure that expands and collapses, as `<details>`
3
+ * would — written once and mapped over the questions: the open one
3
4
  * is a key in `state`, and each question reads it the same way. The button says whether its answer is open
4
5
  * (`ariaExpanded`) and which panel it opens (`controls`, by the panel's id), so a screen reader follows it; the panel is
5
6
  * revealed by the state, so it starts hidden.
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * Three carousels from one element: slides that change on their own with arrows and dots, a marquee of logos that
3
3
  * never ends, and a row of cards a visitor swipes. The slides, the dots and anything else inside read the carousel's
4
- * source — `carousel_<id>.index`, `.count`, `.item`, `.items` — and the arrows and dots are steps on it.
4
+ * source — `carousel_<id>.index`, `.count`, `.item`, `.items`, and `.atStart`, `.atEnd`, `.shown` for where it stands —
5
+ * and the arrows and dots are steps on it.
5
6
  */
6
7
  import {
7
8
  activeWhen,
@@ -40,6 +41,12 @@ const dots = styles('hero-dots', { display: 'flex', gap: 8, margin: '0px', paddi
40
41
  // Several slides at once: the carousel's class says how wide each is and the gap between them.
41
42
  const cards = styles('picks-row', { '--plitzi-carousel-slide-width': '240px', '--plitzi-carousel-gap': '16px' });
42
43
 
44
+ // An arrow with nowhere to go is hidden and passes the pointer on, as a shop's arrows do at a row's ends.
45
+ const arrow = styles('picks-arrow', {
46
+ css: { transition: 'opacity 0.2s' },
47
+ variants: { spent: { opacity: 0, pointerEvents: 'none' } }
48
+ });
49
+
43
50
  export const recipe: SpaceSpec = {
44
51
  name: 'Carousels',
45
52
  permanentUrl: 'carousels',
@@ -100,7 +107,8 @@ export const recipe: SpaceSpec = {
100
107
  items: ['Acme', 'Globex', 'Initech', 'Umbrella', 'Hooli'],
101
108
  row: r => text({ from: r.item, css: { padding: '0px 24px', fontWeight: 600 } })
102
109
  }),
103
- // A row that swipes on a phone and snaps to each card; the arrows move it a card at a time.
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.
104
112
  carousel({
105
113
  id: 'picks',
106
114
  label: 'Picks',
@@ -109,7 +117,20 @@ export const recipe: SpaceSpec = {
109
117
  items: SLIDES,
110
118
  row: r => container({ class: slide, children: [text({ from: `${r.item}.title` })] }),
111
119
  children: [
112
- button({ content: '›', title: 'More picks', flows: [[onClick(), carouselNext('picks')]] }),
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')]]
126
+ }),
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')]]
133
+ }),
113
134
  text({ from: 'picks.index', as: '{{ source + 1 }} of {{ carousel_picks.count }}' })
114
135
  ]
115
136
  })
@@ -1,4 +1,3 @@
1
- /* eslint-disable quotes -- templates quote their own strings, and read best in the other quotes */
2
1
  /**
3
2
  * A page per record: a card links to `/products/<slug>`, and the detail page narrows the same file to the product its
4
3
  * address names — with a message, not an empty page, when no product has that name, and status 404: the provider is
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * Something drawn elsewhere — a map, a video player — in an `embed`, and a drawing of your own in an `svg`.
3
3
  *
4
- * An embed says what it shows in `title`, which is what a screen reader announces, and loads lazily. An `svg` takes
4
+ * An embed says what it shows in `title`, which is what a screen reader announces, and loads lazily — and hidden (its
5
+ * `visible`, a player behind its poster) it loads nothing until it is first shown: no `src` binding to the play state
6
+ * is needed. An `svg` takes
5
7
  * the markup alone, checked to be an SVG and with anything that runs taken out; drawn with `currentColor`, it follows
6
8
  * the colour of its class in both themes. Without a `label` it is decoration, hidden from readers; with one it is an
7
9
  * image that says it.
@@ -1,4 +1,3 @@
1
- /* eslint-disable quotes -- templates quote their own strings, and read best in the other quotes */
2
1
  /**
3
2
  * Filter and sort a list: a select writes the chosen category to `state`, and the list is bound through a template
4
3
  * that hands over its VALUE — only the matching rows are rendered, with a count and an empty state over the same rows.
@@ -1,4 +1,3 @@
1
- /* eslint-disable quotes -- templates quote their own strings, and read best in the other quotes */
2
1
  /**
3
2
  * Show data with no backend, in a project with no server: a JSON file the browser fetches (`public/data/products.json`,
4
3
  * public), read by a provider — one card per product, a skeleton while it loads, a count, a computed value, and an
@@ -1,4 +1,3 @@
1
- /* eslint-disable quotes -- templates quote their own strings, and read best in the other quotes */
2
1
  /**
3
2
  * Data typed by a sample of it: `source()` turns the JSON the page reads into names the editor completes and checks —
4
3
  * `site.data.hero.titel` is a type error, not an empty heading. In a project the sample is the file itself:
@@ -19,7 +19,8 @@ button({ content: '', title: 'Close', icon: 'fa-solid fa-xmark' })
19
19
  // Words that do not say what it does — a key hint, a count: `label` is read in their place.
20
20
  button({ content: 'V', label: 'Select (V)', title: 'Select — V', icon: 'fa-solid fa-arrow-pointer' })
21
21
 
22
- // A link around a whole card: without `label` it is announced as every word inside the card.
22
+ // A link around a whole card: without `label` it is announced as every word inside the card — and around an
23
+ // `article`, Playwright reads no name at all (accname takes none from an article): name it, and a test finds it.
23
24
  link({ href: '/posts/field-notes', label: 'Read “Field notes”', children: [ /* cover, topic, title, byline */ ] })
24
25
 
25
26
  // A field whose design says what it is: the label stays, out of sight.
@@ -81,8 +82,12 @@ button({ content: 'Menu', bind: { ariaExpanded: 'state.menuOpen' }, flows: [[onC
81
82
 
82
83
  An "active" variant is for the eyes. `ariaPressed` and `ariaExpanded` are for everyone else. Use both. A button that
83
84
  opens a panel also names it — `controls: 'menu-panel'`, the panel's id (authoring gives the panel the anchor
84
- `aria-controls` needs; [recipes/accordion.ts](../recipes/accordion.ts)). Words that change while somebody is on the page
85
+ `aria-controls` needs; [recipes/accordion.ts](../recipes/accordion.ts)). In a list's row, both are the row's own: each
86
+ row's panel is drawn as `<id>-<row>`, and the row's button points at its own. Words that change while somebody is on the page
85
87
  — a count, a total, a status — sit in `container({ live: 'polite', … })`, so a screen reader says them when they change.
88
+ A part that opens and closes on its own — a question and its answer, many open at once — needs no state at all:
89
+ `container({ subType: 'details', children: [container({ subType: 'summary', children: [text('Question')] }), …] })`
90
+ (`open: true` to start open), the browser's own disclosure, announced as one. The accordion recipe is for one-at-a-time.
86
91
 
87
92
  ## The page has an outline
88
93