@plitzi/sdk-shared 0.38.24 → 0.39.1

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 (197) hide show
  1. package/CHANGELOG.md +153 -1
  2. package/dist/actions/functions.d.ts +22 -1
  3. package/dist/actions/functions.mjs +3 -3
  4. package/dist/actions/index.d.ts +1 -1
  5. package/dist/actions/index.mjs +7 -7
  6. package/dist/auth/failureChannel.mjs +1 -0
  7. package/dist/auth/index.d.ts +1 -1
  8. package/dist/auth/index.mjs +2 -2
  9. package/dist/auth/visitorRoles.d.ts +8 -0
  10. package/dist/auth/visitorRoles.mjs +5 -2
  11. package/dist/authoring/declare.d.ts +34 -1
  12. package/dist/authoring/elementCallbacks.d.ts +13 -0
  13. package/dist/authoring/elementCallbacks.mjs +11 -5
  14. package/dist/authoring/index.mjs +3 -3
  15. package/dist/authoring/paramSpec.d.ts +1 -0
  16. package/dist/dataSource/getBindingsDetails.d.ts +1 -1
  17. package/dist/dataSource/getBindingsDetails.mjs +1 -1
  18. package/dist/dataSource/globalSources.d.ts +1 -1
  19. package/dist/dataSource/index.d.ts +1 -2
  20. package/dist/dataSource/index.mjs +1 -1
  21. package/dist/dataSource/utility/arrayMap.mjs +1 -1
  22. package/dist/dataSource/utility/capitalize.mjs +1 -1
  23. package/dist/dataSource/utility/styleSelector.mjs +5 -3
  24. package/dist/dataSource/utility/styleVariant.mjs +17 -13
  25. package/dist/dataSource/variables/index.d.ts +2 -0
  26. package/dist/dataSource/variables/index.mjs +1 -0
  27. package/dist/dataSource/{resolveVariables.d.ts → variables/resolveVariables.d.ts} +1 -1
  28. package/dist/dataSource/{resolveVariables.mjs → variables/resolveVariables.mjs} +1 -1
  29. package/dist/devTools/chrome.d.ts +6 -0
  30. package/dist/devTools/chrome.mjs +2 -2
  31. package/dist/devTools/index.mjs +5 -5
  32. package/dist/devTools/sight/index.d.ts +1 -0
  33. package/dist/devTools/sight/index.mjs +1 -0
  34. package/dist/devTools/sight/sight.d.ts +28 -0
  35. package/dist/devTools/sight/sight.mjs +127 -0
  36. package/dist/devTools/utils/PlitziConsole.d.ts +14 -0
  37. package/dist/devTools/utils/PlitziConsole.mjs +20 -3
  38. package/dist/flags/flagsCookie.mjs +4 -4
  39. package/dist/flags/resolveFlags.d.ts +1 -1
  40. package/dist/helpers/index.mjs +19 -19
  41. package/dist/helpers/ruleEvaluator.d.ts +2 -0
  42. package/dist/helpers/ruleEvaluator.mjs +2 -2
  43. package/dist/helpers/scroll.d.ts +10 -0
  44. package/dist/helpers/scroll.mjs +2 -2
  45. package/dist/helpers/twigWrapper/Evaluator/Evaluator.mjs +90 -88
  46. package/dist/helpers/twigWrapper/Evaluator/helpers.d.ts +6 -0
  47. package/dist/helpers/twigWrapper/Evaluator/helpers.mjs +11 -2
  48. package/dist/helpers/twigWrapper/filters/arrays.d.ts +2 -0
  49. package/dist/helpers/twigWrapper/filters/arrays.mjs +66 -0
  50. package/dist/helpers/twigWrapper/filters/catalog/index.d.ts +17 -0
  51. package/dist/helpers/twigWrapper/filters/catalog/index.mjs +351 -0
  52. package/dist/helpers/twigWrapper/filters/dateParts.d.ts +25 -0
  53. package/dist/helpers/twigWrapper/filters/dateParts.mjs +56 -0
  54. package/dist/helpers/twigWrapper/filters/dates.d.ts +2 -0
  55. package/dist/helpers/twigWrapper/filters/dates.mjs +97 -0
  56. package/dist/helpers/twigWrapper/filters/filters.d.ts +3 -13
  57. package/dist/helpers/twigWrapper/filters/filters.mjs +25 -483
  58. package/dist/helpers/twigWrapper/filters/hashing.d.ts +3 -0
  59. package/dist/helpers/twigWrapper/filters/hashing.mjs +101 -0
  60. package/dist/helpers/twigWrapper/filters/index.mjs +4 -1
  61. package/dist/helpers/twigWrapper/filters/misc.d.ts +5 -0
  62. package/dist/helpers/twigWrapper/filters/misc.mjs +52 -0
  63. package/dist/helpers/twigWrapper/filters/numbers.d.ts +2 -0
  64. package/dist/helpers/twigWrapper/filters/numbers.mjs +36 -0
  65. package/dist/helpers/twigWrapper/filters/objects.d.ts +3 -0
  66. package/dist/helpers/twigWrapper/filters/objects.mjs +61 -0
  67. package/dist/helpers/twigWrapper/filters/raw.d.ts +8 -0
  68. package/dist/helpers/twigWrapper/filters/raw.mjs +7 -0
  69. package/dist/helpers/twigWrapper/filters/strings.d.ts +7 -0
  70. package/dist/helpers/twigWrapper/filters/strings.mjs +79 -0
  71. package/dist/helpers/twigWrapper/filters/types.d.ts +5 -0
  72. package/dist/helpers/twigWrapper/filters/types.mjs +4 -0
  73. package/dist/helpers/twigWrapper/filters/values.d.ts +12 -0
  74. package/dist/helpers/twigWrapper/filters/values.mjs +17 -0
  75. package/dist/helpers/twigWrapper/inspectTemplate.d.ts +5 -0
  76. package/dist/helpers/twigWrapper/inspectTemplate.mjs +39 -20
  77. package/dist/helpers/utils.d.ts +4 -0
  78. package/dist/helpers/utils.mjs +3 -5
  79. package/dist/navigation/index.d.ts +2 -0
  80. package/dist/navigation/index.mjs +2 -1
  81. package/dist/navigation/sitemap.d.ts +16 -0
  82. package/dist/navigation/sitemap.mjs +25 -0
  83. package/dist/network/entitlements.d.ts +101 -0
  84. package/dist/network/entitlements.mjs +4 -0
  85. package/dist/network/graphql/builder/Mutations/Space/SpaceRunE2eTestsMutation.d.ts +31 -0
  86. package/dist/network/graphql/builder/Mutations/Space/SpaceRunE2eTestsMutation.mjs +13 -0
  87. package/dist/network/graphql/builder/Mutations/Space/SpaceSetTestsMutation.d.ts +5 -0
  88. package/dist/network/graphql/builder/Mutations/Space/SpaceSetTestsMutation.mjs +11 -0
  89. package/dist/network/graphql/builder/Mutations/Space/SpaceUpdateSettingsMutation.d.ts +1 -1
  90. package/dist/network/graphql/builder/Mutations/Space/SpaceUpdateSettingsMutation.mjs +1 -1
  91. package/dist/network/graphql/builder/Mutations/index.d.ts +5 -0
  92. package/dist/network/graphql/builder/Mutations/index.mjs +150 -146
  93. package/dist/network/graphql/builder/Queries/Space/SpaceTestsQuery.d.ts +40 -0
  94. package/dist/network/graphql/builder/Queries/Space/SpaceTestsQuery.mjs +24 -0
  95. package/dist/network/graphql/builder/Queries/index.d.ts +3 -0
  96. package/dist/network/graphql/builder/Queries/index.mjs +44 -42
  97. package/dist/network/graphql/sdk/Queries/InitQuery.d.ts +3 -1
  98. package/dist/network/graphql/sdk/Queries/InitQuery.mjs +1 -1
  99. package/dist/network/index.d.ts +1 -0
  100. package/dist/network/index.mjs +9 -8
  101. package/dist/network/spaceEvents.d.ts +20 -1
  102. package/dist/network/spaceEvents.mjs +12 -0
  103. package/dist/project/index.mjs +8 -5
  104. package/dist/project/layout/check.d.ts +22 -0
  105. package/dist/project/layout/check.mjs +60 -0
  106. package/dist/project/{layout.d.ts → layout/codes.d.ts} +3 -66
  107. package/dist/project/layout/codes.mjs +108 -0
  108. package/dist/project/layout/contents.d.ts +10 -0
  109. package/dist/project/layout/contents.mjs +31 -0
  110. package/dist/project/layout/files.d.ts +31 -0
  111. package/dist/project/layout/files.mjs +49 -0
  112. package/dist/project/layout/folders.d.ts +4 -0
  113. package/dist/project/layout/folders.mjs +69 -0
  114. package/dist/project/layout/index.d.ts +16 -0
  115. package/dist/project/layout/index.mjs +5 -0
  116. package/dist/project/layout/plugins.d.ts +46 -0
  117. package/dist/project/layout/plugins.mjs +99 -0
  118. package/dist/project/layout/vendor.d.ts +15 -0
  119. package/dist/project/layout/vendor.mjs +34 -0
  120. package/dist/project/pages/index.d.ts +8 -0
  121. package/dist/project/pages/index.mjs +14 -0
  122. package/dist/project/paths/index.d.ts +52 -4
  123. package/dist/project/paths/index.mjs +2 -2
  124. package/dist/project/root.d.ts +6 -0
  125. package/dist/project/root.mjs +11 -10
  126. package/dist/realtime/client.mjs +104 -91
  127. package/dist/realtime/presence.d.ts +2 -2
  128. package/dist/realtime/presence.mjs +27 -21
  129. package/dist/runs/index.d.ts +73 -0
  130. package/dist/runs/index.mjs +6 -0
  131. package/dist/runs/report.d.ts +56 -0
  132. package/dist/runs/report.mjs +17 -0
  133. package/dist/schema/index.d.ts +6 -0
  134. package/dist/schema/index.mjs +18 -12
  135. package/dist/schema/motion.d.ts +25 -0
  136. package/dist/schema/motion.mjs +47 -19
  137. package/dist/schema/pageAccess.d.ts +6 -0
  138. package/dist/schema/pageAccess.mjs +8 -3
  139. package/dist/schema/pageHead.d.ts +64 -0
  140. package/dist/schema/pageHead.mjs +68 -0
  141. package/dist/schema/providerAnswer.d.ts +17 -0
  142. package/dist/schema/providerAnswer.mjs +4 -0
  143. package/dist/schema/providerWhen.d.ts +36 -0
  144. package/dist/schema/providerWhen.mjs +58 -0
  145. package/dist/schema/schemaSettings.d.ts +14 -0
  146. package/dist/schema/schemaSettings.mjs +4 -0
  147. package/dist/schema/serverElements.d.ts +20 -1
  148. package/dist/schema/serverElements.mjs +41 -28
  149. package/dist/schema/serverInput.d.ts +34 -0
  150. package/dist/schema/serverInput.mjs +60 -0
  151. package/dist/schema/serverQuery.d.ts +47 -0
  152. package/dist/schema/serverQuery.mjs +70 -0
  153. package/dist/server/index.mjs +5 -5
  154. package/dist/server/rsc/refreshRsc.d.ts +6 -2
  155. package/dist/server/rsc/refreshRsc.mjs +75 -59
  156. package/dist/server/rsc/useRscSync.mjs +22 -18
  157. package/dist/source/export.d.ts +1 -1
  158. package/dist/state/index.mjs +3 -3
  159. package/dist/state/paintedState.d.ts +20 -4
  160. package/dist/state/paintedState.mjs +13 -12
  161. package/dist/state/runtimeStatePersist.mjs +109 -48
  162. package/dist/store/renderSettings.d.ts +2 -0
  163. package/dist/store/renderSettings.mjs +13 -5
  164. package/dist/store/storeHooks.d.ts +45 -45
  165. package/dist/style/index.mjs +16 -16
  166. package/dist/style/styleConstants.d.ts +12 -2
  167. package/dist/style/styleConstants.mjs +20 -0
  168. package/dist/style/styleStates.d.ts +5 -0
  169. package/dist/style/styleStates.mjs +21 -5
  170. package/dist/types/ActionTypes.d.ts +26 -3
  171. package/dist/types/AuthTypes.d.ts +19 -1
  172. package/dist/types/CommonTypes.d.ts +3 -2
  173. package/dist/types/ElementTypes.d.ts +1 -1
  174. package/dist/types/InteractionTypes.d.ts +10 -1
  175. package/dist/types/JobTypes.d.ts +2 -1
  176. package/dist/types/OAuthTypes.d.ts +246 -0
  177. package/dist/types/OAuthTypes.mjs +0 -0
  178. package/dist/types/PluginTypes.d.ts +2 -0
  179. package/dist/types/PreviewTypes.d.ts +71 -0
  180. package/dist/types/PreviewTypes.mjs +0 -0
  181. package/dist/types/RealtimeTypes.d.ts +11 -0
  182. package/dist/types/SchemaTypes.d.ts +63 -0
  183. package/dist/types/ServerAdapterTypes.d.ts +345 -0
  184. package/dist/types/ServerAdapterTypes.mjs +0 -0
  185. package/dist/types/ServerConfigTypes.d.ts +527 -0
  186. package/dist/types/ServerConfigTypes.mjs +0 -0
  187. package/dist/types/ServerLogTypes.d.ts +119 -0
  188. package/dist/types/ServerLogTypes.mjs +0 -0
  189. package/dist/types/ServerTypes.d.ts +30 -1215
  190. package/dist/types/StoreTypes.d.ts +39 -1
  191. package/dist/types/TestTypes.d.ts +249 -0
  192. package/dist/types/TestTypes.mjs +0 -0
  193. package/dist/types/index.d.ts +6 -0
  194. package/eslint.config.mjs +3 -1
  195. package/package.json +2 -2
  196. package/setupTests.ts +4 -3
  197. package/dist/project/layout.mjs +0 -394
@@ -26,13 +26,13 @@ export type PresenceListeners = {
26
26
  onDepart?: (member: RealtimeMember) => void;
27
27
  };
28
28
  /**
29
- * Who is on a topic, kept from what the members say — nothing is stored anywhere.
29
+ * Who is on a topic, kept from what the members say — nothing is stored anywhere — and what the server keeps on it.
30
30
  *
31
31
  * A member announces itself (`$presence`) when it sets its state, when somebody new arrives (`$join`) and every
32
32
  * twenty seconds; the server says `$leave` when its connection closes. A member heard from in none of those ways for
33
33
  * a minute is gone, which is what heals a leave that was lost.
34
34
  *
35
35
  * Every tracker of one topic on one client is a view of the same member: `set` from any of them is the page's state,
36
- * and a tracker started late begins with everyone already known.
36
+ * and a tracker started late begins with everyone already known, and with what the server kept.
37
37
  */
38
38
  export declare const trackPresence: (client: RealtimeClient, topic: string, listener: PresenceListeners) => PresenceTracker;
@@ -1,25 +1,25 @@
1
1
  import { PRESENCE_TYPE as e } from "./topics.mjs";
2
2
  //#region src/realtime/presence.ts
3
3
  var t = 2e4, n = 65e3, r = /* @__PURE__ */ new WeakMap(), i = (r, i, a) => {
4
- let o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), l, u = !1, d = () => [...u && r.me ? [{
4
+ let o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map(), u, d = !1, f = () => [...d && r.me ? [{
5
5
  from: r.me,
6
- state: l,
6
+ state: u,
7
7
  me: !0
8
- }] : [], ...[...o.values()].map((e) => e.member)], f = () => {
9
- let e = d();
8
+ }] : [], ...[...o.values()].map((e) => e.member)], p = () => {
9
+ let e = f();
10
10
  c.forEach((t) => t.onChange(e));
11
- }, p = (e) => {
11
+ }, m = (e) => {
12
12
  let t = e.flatMap((e) => {
13
13
  let t = o.get(e);
14
14
  return o.delete(e), t ? [t.member] : [];
15
15
  });
16
16
  if (t.length) {
17
- f();
17
+ p();
18
18
  for (let e of t) c.forEach((t) => t.onDepart?.(e));
19
19
  }
20
- }, m = () => {
21
- u && r.publish(i, e, l);
22
- }, h = r.subscribe(i, (e) => {
20
+ }, h = () => {
21
+ d && r.publish(i, e, u);
22
+ }, g = r.subscribe(i, (e) => {
23
23
  if (e.from !== r.me || e.echo === !0) {
24
24
  if (e.type === "$presence") {
25
25
  let t = {
@@ -31,25 +31,26 @@ var t = 2e4, n = 65e3, r = /* @__PURE__ */ new WeakMap(), i = (r, i, a) => {
31
31
  o.set(e.from, {
32
32
  member: t,
33
33
  heardAt: Date.now()
34
- }), f(), n && c.forEach((e) => e.onArrive?.(t));
35
- } else e.type === "$leave" ? (s.delete(e.from), p([e.from])) : e.type === "$join" ? (s.add(e.from), m()) : e.type === "$revoked" && e.from === "server" && (o.clear(), s.clear(), f());
36
- c.forEach((t) => t.onMessage?.(e));
34
+ }), p(), n && c.forEach((e) => e.onArrive?.(t));
35
+ } else e.type === "$leave" ? (s.delete(e.from), m([e.from])) : e.type === "$join" ? (s.add(e.from), h()) : e.type === "$revoked" && e.from === "server" && (o.clear(), l.clear(), s.clear(), p());
36
+ e.retained === !0 && e.from === "server" && (l.get(e.type)?.at ?? 0) <= e.at && (e.data === null ? l.delete(e.type) : l.set(e.type, e)), c.forEach((t) => t.onMessage?.(e));
37
37
  }
38
- }), g = r.onStatus((e) => {
39
- e === "open" && (m(), f());
40
- }), _ = setInterval(() => {
41
- m();
38
+ }), _ = r.onStatus((e) => {
39
+ e === "open" && (h(), p());
40
+ }), v = setInterval(() => {
41
+ h();
42
42
  let e = Date.now();
43
- p([...o].filter(([, t]) => e - t.heardAt > n).map(([e]) => e));
43
+ m([...o].filter(([, t]) => e - t.heardAt > n).map(([e]) => e));
44
44
  }, t);
45
45
  return {
46
- members: d,
46
+ members: f,
47
+ kept: () => [...l.values()],
47
48
  set: (e) => {
48
- l = e, u = !0, m(), f();
49
+ u = e, d = !0, h(), p();
49
50
  },
50
51
  listeners: c,
51
52
  teardown: () => {
52
- clearInterval(_), g(), h(), a();
53
+ clearInterval(v), _(), g(), a();
53
54
  }
54
55
  };
55
56
  }, a = (e, t, n) => {
@@ -58,7 +59,12 @@ var t = 2e4, n = 65e3, r = /* @__PURE__ */ new WeakMap(), i = (r, i, a) => {
58
59
  let o = a.get(t) ?? i(e, t, () => a.delete(t));
59
60
  a.set(t, o), o.listeners.add(n);
60
61
  let s = o.members();
61
- return s.length && n.onChange(s), {
62
+ s.length && n.onChange(s);
63
+ for (let e of o.kept()) n.onMessage?.({
64
+ ...e,
65
+ replayed: !0
66
+ });
67
+ return {
62
68
  set: o.set,
63
69
  members: o.members,
64
70
  stop: () => {
@@ -0,0 +1,73 @@
1
+ export * from './report';
2
+ /**
3
+ * A run of agents (`plitzi run`), as the page its preview serves can show it: `plitzi run preview` keeps a snapshot of
4
+ * the run in a file and names it to the project's server (`RUN_STATUS_ENV`), which answers it at `RUN_STATUS_PATH`, and
5
+ * the dev tools draw it (their Run tab). Written by the CLI, read by the dev tools: this is what both agree it holds.
6
+ * Only a preview's server answers it — a project's own `start:dev`, or a deployment, has no run behind it.
7
+ */
8
+ /** Where the preview's server answers the run's snapshot. */
9
+ export declare const RUN_STATUS_PATH = "/__plitzi/run";
10
+ /** The variable that names the snapshot's file to the preview's server. */
11
+ export declare const RUN_STATUS_ENV = "PLITZI_RUN_STATUS";
12
+ export interface RunSnapshotTask {
13
+ id: string;
14
+ title: string;
15
+ role: string;
16
+ status: string;
17
+ /** The agent that holds it. */
18
+ agent?: string;
19
+ /** The lead reviewing it, while it is in review and one took it. */
20
+ reviewer?: string;
21
+ round: number;
22
+ /** What it writes, by project path. */
23
+ files: string[];
24
+ step?: string;
25
+ fraction?: number;
26
+ /** Why it is not moving, in a line: the tasks it starts after, the file it waits for, what blocks it and who acts. */
27
+ why?: string;
28
+ /** How urgent: its priority, or that of any task waiting on it — `critical` and `high` are marked. */
29
+ urgency?: string;
30
+ /** How many findings its spikes left: what the run found out before building it. */
31
+ found?: number;
32
+ }
33
+ export interface RunSnapshotAgent {
34
+ agent: string;
35
+ kind: 'lead' | 'co-lead' | 'agent';
36
+ /** working, reviewing, in-review, blocked, asking, waiting, idle, stopped, not-started, no-signal */
37
+ status: string;
38
+ model?: string;
39
+ /** What it is at, in a line. */
40
+ doing: string;
41
+ task?: string;
42
+ }
43
+ export interface RunSnapshotEvent {
44
+ at: string;
45
+ by: string;
46
+ /** What happened, for a glance: 72 characters at most. */
47
+ text: string;
48
+ /** The whole of it, when `text` says less. */
49
+ detail?: string;
50
+ /** take, complete, review, message, run, problem (a refusal, a crash, a failed check), other */
51
+ kind: string;
52
+ }
53
+ export interface RunSnapshot {
54
+ runId: string;
55
+ goal: string;
56
+ status: string;
57
+ done: number;
58
+ total: number;
59
+ /** When the CLI wrote it, ISO in UTC. */
60
+ at: string;
61
+ expectedEnd?: string;
62
+ tasks: RunSnapshotTask[];
63
+ /** What needs someone: a block, a question, a notice — and who acts on it. */
64
+ attention: {
65
+ text: string;
66
+ who: string;
67
+ }[];
68
+ /** Every agent and lead, and what each is at. */
69
+ agents?: RunSnapshotAgent[];
70
+ /** What happened last, newest first. */
71
+ feed?: RunSnapshotEvent[];
72
+ }
73
+ export declare const isRunSnapshot: (value: unknown) => value is RunSnapshot;
@@ -0,0 +1,6 @@
1
+ import { isRecord as e } from "../helpers/isRecord.mjs";
2
+ import { RUN_REPORTS_ENV as t, RUN_REPORT_PATH as n, RUN_REPORT_STEPS_MOST as r, RUN_REPORT_TEXT_MOST as i, isRunReport as a, runReportProblems as o } from "./report.mjs";
3
+ //#region src/runs/index.ts
4
+ var s = "/__plitzi/run", c = "PLITZI_RUN_STATUS", l = (t) => e(t) && typeof t.id == "string" && typeof t.title == "string" && typeof t.role == "string" && typeof t.status == "string" && typeof t.round == "number" && Array.isArray(t.files) && t.files.every((e) => typeof e == "string"), u = (t) => e(t) && typeof t.runId == "string" && typeof t.goal == "string" && typeof t.status == "string" && typeof t.done == "number" && typeof t.total == "number" && typeof t.at == "string" && Array.isArray(t.tasks) && t.tasks.every(l) && Array.isArray(t.attention) && t.attention.every((t) => e(t) && typeof t.text == "string" && typeof t.who == "string");
5
+ //#endregion
6
+ export { t as RUN_REPORTS_ENV, n as RUN_REPORT_PATH, r as RUN_REPORT_STEPS_MOST, i as RUN_REPORT_TEXT_MOST, c as RUN_STATUS_ENV, s as RUN_STATUS_PATH, a as isRunReport, u as isRunSnapshot, o as runReportProblems };
@@ -0,0 +1,56 @@
1
+ /**
2
+ * What the person watching a run's preview reports from its page — a bug as they see it, handed to the run's lead as it
3
+ * is: the address, the window, the theme, the element they point at and what they did since the page loaded. The dev
4
+ * tools' Run tab sends it to the preview's server (`RUN_REPORT_PATH`), which leaves it in the folder the CLI names
5
+ * (`RUN_REPORTS_ENV`); the CLI hands it to the lead with the command that plays it again. A lead that got words alone
6
+ * ("with tornadoes selected Strongest breaks") reproduced them by guessing the address, the layers and the width.
7
+ */
8
+ /** Where the preview's page sends a report: POST, one a request. */
9
+ export declare const RUN_REPORT_PATH = "/__plitzi/run/report";
10
+ /** The variable that names the folder the preview's server leaves each report in, for the CLI to hand on. */
11
+ export declare const RUN_REPORTS_ENV = "PLITZI_RUN_REPORTS";
12
+ /** The most steps a report keeps: the last ones, where what went wrong is. */
13
+ export declare const RUN_REPORT_STEPS_MOST = 40;
14
+ /** The longest text a report says. */
15
+ export declare const RUN_REPORT_TEXT_MOST = 2000;
16
+ /**
17
+ * One thing the person did: a press, or what a field holds once they typed in it — an element as a step names it
18
+ * (`bin-bar`, the third copy a list draws `bin-bar:3`). A password is never sent: `secret`, its text left out.
19
+ */
20
+ export type RunReportStep = {
21
+ kind: 'click';
22
+ element: string;
23
+ } | {
24
+ kind: 'type';
25
+ element: string;
26
+ text: string;
27
+ } | {
28
+ kind: 'type';
29
+ element: string;
30
+ secret: true;
31
+ };
32
+ export interface RunReport {
33
+ /** What is wrong, in the person's words. */
34
+ text: string;
35
+ /** The address the steps play again from — where the first was taken — or the page's, with none: path and query. */
36
+ path: string;
37
+ /** The address the person was on when they reported, when the steps took them away from `path`. */
38
+ seenOn?: string;
39
+ /** The window, as a page's breakpoints read it. */
40
+ width: number;
41
+ height: number;
42
+ /** The page's own width when the dev tools' panel took part of the window. */
43
+ pageWidth?: number;
44
+ scheme: 'light' | 'dark';
45
+ /** The element pointed at. */
46
+ element?: string;
47
+ /** What the person did since the page loaded, oldest first. */
48
+ steps: RunReportStep[];
49
+ /** How many steps before those were left out (`RUN_REPORT_STEPS_MOST`). */
50
+ earlier?: number;
51
+ /** When it was sent, ISO in UTC. */
52
+ at: string;
53
+ }
54
+ /** What is wrong with a report as sent, every problem at once — none: it is one. */
55
+ export declare const runReportProblems: (value: unknown) => string[];
56
+ export declare const isRunReport: (value: unknown) => value is RunReport;
@@ -0,0 +1,17 @@
1
+ import { isRecord as e } from "../helpers/isRecord.mjs";
2
+ //#region src/runs/report.ts
3
+ var t = "/__plitzi/run/report", n = "PLITZI_RUN_REPORTS", r = 40, i = 2e3, a = (t) => e(t) && typeof t.element == "string" && t.element !== "" && (t.kind === "click" || t.kind === "type" && (typeof t.text == "string" || t.secret === !0)), o = (e) => typeof e == "number" && Number.isInteger(e) && e > 0, s = (t) => e(t) ? [
4
+ ...typeof t.text == "string" && t.text.trim() !== "" ? [] : ["text: what is wrong, in words"],
5
+ ...typeof t.text == "string" && t.text.length > 2e3 ? [`text: ${String(i)} characters at most`] : [],
6
+ ...typeof t.path == "string" && t.path.startsWith("/") ? [] : ["path: the page’s path, from \"/\""],
7
+ ...t.seenOn === void 0 || typeof t.seenOn == "string" && t.seenOn.startsWith("/") ? [] : ["seenOn: the path they reported on, from \"/\""],
8
+ ...o(t.width) && o(t.height) ? [] : ["width and height: the window, in whole pixels"],
9
+ ...t.pageWidth === void 0 || o(t.pageWidth) ? [] : ["pageWidth: whole pixels"],
10
+ ...t.scheme === "light" || t.scheme === "dark" ? [] : ["scheme: light or dark"],
11
+ ...t.element === void 0 || typeof t.element == "string" && t.element !== "" ? [] : ["element: the id of the element pointed at"],
12
+ ...Array.isArray(t.steps) && t.steps.length <= 40 && t.steps.every(a) ? [] : ["steps: at most 40, each a click or a type of an element"],
13
+ ...t.earlier === void 0 || typeof t.earlier == "number" && t.earlier > 0 ? [] : ["earlier: how many steps were left out"],
14
+ ...typeof t.at == "string" && !Number.isNaN(Date.parse(t.at)) ? [] : ["at: when, ISO"]
15
+ ] : ["a report is a JSON object"], c = (e) => s(e).length === 0;
16
+ //#endregion
17
+ export { n as RUN_REPORTS_ENV, t as RUN_REPORT_PATH, r as RUN_REPORT_STEPS_MOST, i as RUN_REPORT_TEXT_MOST, c as isRunReport, s as runReportProblems };
@@ -2,6 +2,12 @@ export * from './anchor';
2
2
  export * from './schemaConstants';
3
3
  export * from './layoutChain';
4
4
  export * from './serverElements';
5
+ export * from './providerAnswer';
6
+ export * from './providerWhen';
7
+ export * from './serverInput';
8
+ export * from './serverQuery';
9
+ export * from './pageHead';
10
+ export * from './schemaSettings';
5
11
  export * from './snippet';
6
12
  export * from './motion';
7
13
  export * from './motionReveal';
@@ -1,12 +1,18 @@
1
- import { WITHHELD_ATTRIBUTE as e, mayReceive as t, pageAccessOf as n, pageAccessRefusal as r, pageWithheldOf as i, withholdPages as a } from "./pageAccess.mjs";
2
- import { elementFromWire as o, schemaFromWire as s, schemaToWire as c } from "./wire.mjs";
3
- import { ANCHOR_PATTERN as l, anchorOf as u, isAnchor as d, uniqueAnchor as f } from "./anchor.mjs";
4
- import { COMPONENT_PROPS_SOURCE as p, EMPTY_SCHEMA as m, VARIABLE_REGEX as h } from "./schemaConstants.mjs";
5
- import { findLayoutCycle as g, resolveLayoutChain as _ } from "./layoutChain.mjs";
6
- import { collectServerElements as v, hasServerElements as y, notFoundProvider as b, pageNotFound as x, pageSeoText as S, pageServerContext as C } from "./serverElements.mjs";
7
- import { isSnippet as w } from "./snippet.mjs";
8
- import { MOTION_DEFAULT_DURATION as T, MOTION_ENTERS as E, MOTION_ENTER_EASING as D, MOTION_ENTER_FRAMES as O, MOTION_ENTER_FROM as k, MOTION_LOOPS as A, MOTION_LOOP_FRAMES as j, MOTION_MAX_MS as M, MOTION_PLAY_CSS as N, MOTION_SEEN_ATTRIBUTE as P, MOTION_SEEN_CSS as F, MOTION_STILL_CSS as I, MOTION_TRIGGERS as L, MOTION_VIEW_SELECTOR as R, MOVING_SELECTOR as z, isMotion as B, isMotionAnimation as V, motionAttributes as H, motionProblems as U } from "./motion.mjs";
9
- import { revealOnView as W } from "./motionReveal.mjs";
10
- import { pageElementTypes as G } from "./pageElements.mjs";
11
- import { headingText as K, markdownHeadings as q } from "./markdownHeadings.mjs";
12
- export { l as ANCHOR_PATTERN, p as COMPONENT_PROPS_SOURCE, m as EMPTY_SCHEMA, T as MOTION_DEFAULT_DURATION, E as MOTION_ENTERS, D as MOTION_ENTER_EASING, O as MOTION_ENTER_FRAMES, k as MOTION_ENTER_FROM, A as MOTION_LOOPS, j as MOTION_LOOP_FRAMES, M as MOTION_MAX_MS, N as MOTION_PLAY_CSS, P as MOTION_SEEN_ATTRIBUTE, F as MOTION_SEEN_CSS, I as MOTION_STILL_CSS, L as MOTION_TRIGGERS, R as MOTION_VIEW_SELECTOR, z as MOVING_SELECTOR, h as VARIABLE_REGEX, e as WITHHELD_ATTRIBUTE, u as anchorOf, v as collectServerElements, o as elementFromWire, g as findLayoutCycle, y as hasServerElements, K as headingText, d as isAnchor, B as isMotion, V as isMotionAnimation, w as isSnippet, q as markdownHeadings, t as mayReceive, H as motionAttributes, U as motionProblems, b as notFoundProvider, n as pageAccessOf, r as pageAccessRefusal, G as pageElementTypes, x as pageNotFound, S as pageSeoText, C as pageServerContext, i as pageWithheldOf, _ as resolveLayoutChain, W as revealOnView, s as schemaFromWire, c as schemaToWire, f as uniqueAnchor, a as withholdPages };
1
+ import { WITHHELD_ATTRIBUTE as e, mayReceive as t, pageAccessOf as n, pageAccessRefusal as r, pageWithheldOf as i, withheldPageOf as a, withholdPages as o } from "./pageAccess.mjs";
2
+ import { elementFromWire as s, schemaFromWire as c, schemaToWire as l } from "./wire.mjs";
3
+ import { ANCHOR_PATTERN as u, anchorOf as d, isAnchor as f, uniqueAnchor as p } from "./anchor.mjs";
4
+ import { COMPONENT_PROPS_SOURCE as m, EMPTY_SCHEMA as h, VARIABLE_REGEX as g } from "./schemaConstants.mjs";
5
+ import { findLayoutCycle as _, resolveLayoutChain as v } from "./layoutChain.mjs";
6
+ import { RSC_FAILURE as y, collectServerElements as b, hasServerElements as x, jsonForScript as S, notFoundProvider as C, pageNotFound as w, pageSeoText as T, pageServerContext as E, pageStructuredData as D, rscFailureOf as O } from "./serverElements.mjs";
7
+ import { isEmptyAnswer as k } from "./providerAnswer.mjs";
8
+ import { isRuleGroup as A, serverProviderSource as j, serverWhenValues as M, whenOf as N, whenPaths as P, whenProviders as F, whenUnknownToServer as I } from "./providerWhen.mjs";
9
+ import { browserServerInput as L, inputProviders as R, inputReadings as z, serverInputOf as B } from "./serverInput.mjs";
10
+ import { serverQueryOf as V, serverQueryProblem as H } from "./serverQuery.mjs";
11
+ import { DEFAULT_FAVICON as U, OG_TYPES as W, absoluteAddress as G, isHeadAddress as K, isOgType as q, pageHeadTags as J, spaceIdentity as Y, spaceIdentityProblems as X } from "./pageHead.mjs";
12
+ import { SCHEMA_SETTINGS as Z, isSchemaSetting as Q } from "./schemaSettings.mjs";
13
+ import { isSnippet as $ } from "./snippet.mjs";
14
+ import { MOTION_DEFAULT_DURATION as ee, MOTION_EASING_KEYWORDS as te, MOTION_ENTERS as ne, MOTION_ENTER_EASING as re, MOTION_ENTER_FRAMES as ie, MOTION_ENTER_FROM as ae, MOTION_ENTER_TRAVEL as oe, MOTION_LOOPS as se, MOTION_LOOP_FRAMES as ce, MOTION_MAX_DISTANCE as le, MOTION_MAX_MS as ue, MOTION_PLAY_CSS as de, MOTION_SEEN_ATTRIBUTE as fe, MOTION_SEEN_CSS as pe, MOTION_STILL_CSS as me, MOTION_TRAVEL_PROPERTY as he, MOTION_TRIGGERS as ge, MOTION_VIEW_SELECTOR as _e, MOVING_SELECTOR as ve, isMotion as ye, isMotionAnimation as be, isMotionEasing as xe, motionAttributes as Se, motionProblems as Ce, travelled as we } from "./motion.mjs";
15
+ import { revealOnView as Te } from "./motionReveal.mjs";
16
+ import { pageElementTypes as Ee } from "./pageElements.mjs";
17
+ import { headingText as De, markdownHeadings as Oe } from "./markdownHeadings.mjs";
18
+ export { u as ANCHOR_PATTERN, m as COMPONENT_PROPS_SOURCE, U as DEFAULT_FAVICON, h as EMPTY_SCHEMA, ee as MOTION_DEFAULT_DURATION, te as MOTION_EASING_KEYWORDS, ne as MOTION_ENTERS, re as MOTION_ENTER_EASING, ie as MOTION_ENTER_FRAMES, ae as MOTION_ENTER_FROM, oe as MOTION_ENTER_TRAVEL, se as MOTION_LOOPS, ce as MOTION_LOOP_FRAMES, le as MOTION_MAX_DISTANCE, ue as MOTION_MAX_MS, de as MOTION_PLAY_CSS, fe as MOTION_SEEN_ATTRIBUTE, pe as MOTION_SEEN_CSS, me as MOTION_STILL_CSS, he as MOTION_TRAVEL_PROPERTY, ge as MOTION_TRIGGERS, _e as MOTION_VIEW_SELECTOR, ve as MOVING_SELECTOR, W as OG_TYPES, y as RSC_FAILURE, Z as SCHEMA_SETTINGS, g as VARIABLE_REGEX, e as WITHHELD_ATTRIBUTE, G as absoluteAddress, d as anchorOf, L as browserServerInput, b as collectServerElements, s as elementFromWire, _ as findLayoutCycle, x as hasServerElements, De as headingText, R as inputProviders, z as inputReadings, f as isAnchor, k as isEmptyAnswer, K as isHeadAddress, ye as isMotion, be as isMotionAnimation, xe as isMotionEasing, q as isOgType, A as isRuleGroup, Q as isSchemaSetting, $ as isSnippet, S as jsonForScript, Oe as markdownHeadings, t as mayReceive, Se as motionAttributes, Ce as motionProblems, C as notFoundProvider, n as pageAccessOf, r as pageAccessRefusal, Ee as pageElementTypes, J as pageHeadTags, w as pageNotFound, T as pageSeoText, E as pageServerContext, D as pageStructuredData, i as pageWithheldOf, v as resolveLayoutChain, Te as revealOnView, O as rscFailureOf, c as schemaFromWire, l as schemaToWire, B as serverInputOf, j as serverProviderSource, V as serverQueryOf, H as serverQueryProblem, M as serverWhenValues, Y as spaceIdentity, X as spaceIdentityProblems, we as travelled, p as uniqueAnchor, N as whenOf, P as whenPaths, F as whenProviders, I as whenUnknownToServer, a as withheldPageOf, o as withholdPages };
@@ -38,10 +38,35 @@ export interface ElementMotion {
38
38
  stagger?: number;
39
39
  /** Keeps moving after it arrived. */
40
40
  loop?: MotionLoop;
41
+ /**
42
+ * The curve it arrives along, as CSS says one — `ease-in-out`, `cubic-bezier(0.4, 0, 0.2, 1)`, `steps(4)` — for a
43
+ * copy whose arrivals must be the original's (`MOTION_ENTER_EASING` when left out).
44
+ */
45
+ easing?: string;
46
+ /**
47
+ * How far it travels to arrive, in px, for an arrival that travels (`MOTION_ENTER_TRAVEL`): `fade-up` rises 24 px
48
+ * unless this says 20.
49
+ */
50
+ distance?: number;
41
51
  }
42
52
  /** How long an arrival takes when it does not say, and the curve every arrival follows: quick out, gentle in. */
43
53
  export declare const MOTION_DEFAULT_DURATION = 600;
44
54
  export declare const MOTION_ENTER_EASING = "cubic-bezier(0.2, 0.7, 0.2, 1)";
55
+ /** The curves CSS names: `easing` is one, or a `cubic-bezier(…)`, or `steps(…)`. */
56
+ export declare const MOTION_EASING_KEYWORDS: readonly ["ease", "ease-in", "ease-out", "ease-in-out", "linear"];
57
+ /** Whether `value` is a curve an arrival can follow: a keyword, a `cubic-bezier` whose x values are 0 to 1, `steps`. */
58
+ export declare const isMotionEasing: (value: unknown) => value is string;
59
+ /**
60
+ * How far each arrival that travels goes, in px — what `distance` replaces. An arrival that grows, zooms or only fades
61
+ * travels nowhere, and takes no distance.
62
+ */
63
+ export declare const MOTION_ENTER_TRAVEL: Partial<Record<MotionEnter, number>>;
64
+ /** The farthest an arrival may travel: past it, it is a page that jumps, not one that arrives. */
65
+ export declare const MOTION_MAX_DISTANCE = 400;
66
+ /** What a `distance` scales a preset's travel by: the custom property its frames multiply every length by. */
67
+ export declare const MOTION_TRAVEL_PROPERTY = "--plitzi-motion-travel";
68
+ /** A frame's `translate` as the stylesheet plays it: each length scaled by the element's `distance`, if it says one. */
69
+ export declare const travelled: (translate: string) => string;
45
70
  /**
46
71
  * One frame of an arrival, `at` a percentage of its duration. It moves the individual `translate`, `scale` and `rotate`
47
72
  * properties — never `transform` — so it composes with a `transform` the element has of its own and with a loop.
@@ -28,7 +28,27 @@ var t = [
28
28
  "orbit",
29
29
  "heartbeat",
30
30
  "drift"
31
- ], i = 600, a = "cubic-bezier(0.2, 0.7, 0.2, 1)", o = {
31
+ ], i = 600, a = "cubic-bezier(0.2, 0.7, 0.2, 1)", o = [
32
+ "ease",
33
+ "ease-in",
34
+ "ease-out",
35
+ "ease-in-out",
36
+ "linear"
37
+ ], s = "-?(?:\\d+\\.?\\d*|\\.\\d+)", c = RegExp(`^cubic-bezier\\(\\s*(${s})\\s*,\\s*(${s})\\s*,\\s*(${s})\\s*,\\s*(${s})\\s*\\)$`), l = /^steps\(\s*[1-9]\d*\s*(?:,\s*(?:jump-start|jump-end|jump-none|jump-both|start|end)\s*)?\)$/, u = (e) => {
38
+ if (typeof e != "string") return !1;
39
+ let t = e.trim();
40
+ if (o.includes(t) || l.test(t)) return !0;
41
+ let n = c.exec(t);
42
+ return n !== null && [n[1], n[3]].every((e) => Number(e) >= 0 && Number(e) <= 1);
43
+ }, d = {
44
+ "fade-up": 24,
45
+ "fade-down": 24,
46
+ "slide-left": 32,
47
+ "slide-right": 32,
48
+ "slide-up": 72,
49
+ "bounce-in": 64,
50
+ tilt: 32
51
+ }, f = 400, p = "--plitzi-motion-travel", m = (e) => e.split(/\s+/).map((e) => e === "0" ? e : `calc(var(${p}, 1) * ${e})`).join(" "), h = {
32
52
  fade: [{
33
53
  at: 0,
34
54
  opacity: 0
@@ -121,13 +141,13 @@ var t = [
121
141
  scale: "0.4",
122
142
  rotate: "-180deg"
123
143
  }]
124
- }, s = Object.fromEntries(t.map((e) => {
125
- let [{ at: t, ...n }] = o[e];
144
+ }, g = Object.fromEntries(t.map((e) => {
145
+ let [{ at: t, ...n }] = h[e];
126
146
  return [e, n];
127
- })), c = (e, t) => {
147
+ })), _ = (e, t) => {
128
148
  let n = t * 2 * Math.PI, r = Math.round(Math.sin(n) * e * 10) / 10, i = Math.round(-Math.cos(n) * e * 10) / 10;
129
149
  return `translate(${String(r)}px, ${String(i)}px)`;
130
- }, l = {
150
+ }, v = {
131
151
  float: {
132
152
  frames: [{
133
153
  at: 50,
@@ -196,7 +216,7 @@ var t = [
196
216
  orbit: {
197
217
  frames: Array.from({ length: 9 }, (e, t) => ({
198
218
  at: t * 100 / 8,
199
- transform: c(6, t / 8)
219
+ transform: _(6, t / 8)
200
220
  })),
201
221
  periodMs: 8e3,
202
222
  easing: "linear"
@@ -231,41 +251,49 @@ var t = [
231
251
  periodMs: 7e3,
232
252
  easing: "ease-in-out"
233
253
  }
234
- }, u = 1e4, d = (e, t) => typeof t == "string" && e.includes(t), f = /* @__PURE__ */ new Set([
254
+ }, y = 1e4, b = (e, t) => typeof t == "string" && e.includes(t), x = /* @__PURE__ */ new Set([
235
255
  "enter",
236
256
  "on",
237
257
  "duration",
238
258
  "delay",
239
259
  "stagger",
240
- "loop"
241
- ]), p = (i) => {
260
+ "loop",
261
+ "easing",
262
+ "distance"
263
+ ]), S = (i) => {
242
264
  if (!e(i)) return ["motion is an object: `{ enter: \"fade-up\", on: \"view\" }`"];
243
265
  let a = [];
244
- for (let e of Object.keys(i)) f.has(e) || a.push(`motion has no "${e}" — it takes enter, on, duration, delay, stagger and loop`);
245
- i.enter !== void 0 && !d(t, i.enter) && a.push(`motion.enter is one of ${t.join(", ")}`), i.on !== void 0 && !d(n, i.on) && a.push(`motion.on is ${n.slice(0, -1).join(", ")} or ${String(n.at(-1))}`), i.loop !== void 0 && !d(r, i.loop) && a.push(`motion.loop is one of ${r.join(", ")}`);
266
+ for (let e of Object.keys(i)) x.has(e) || a.push(`motion has no "${e}" — it takes enter, on, duration, delay, stagger, loop, easing and distance`);
267
+ i.enter !== void 0 && !b(t, i.enter) && a.push(`motion.enter is one of ${t.join(", ")}`), i.on !== void 0 && !b(n, i.on) && a.push(`motion.on is ${n.slice(0, -1).join(", ")} or ${String(n.at(-1))}`), i.loop !== void 0 && !b(r, i.loop) && a.push(`motion.loop is one of ${r.join(", ")}`);
246
268
  for (let e of [
247
269
  "duration",
248
270
  "delay",
249
271
  "stagger"
250
272
  ]) {
251
273
  let t = i[e];
252
- t !== void 0 && (typeof t != "number" || !Number.isFinite(t) || t < 0 || t > 1e4) && a.push(`motion.${e} is a number of ms from 0 to ${String(u)}`);
274
+ t !== void 0 && (typeof t != "number" || !Number.isFinite(t) || t < 0 || t > 1e4) && a.push(`motion.${e} is a number of ms from 0 to ${String(y)}`);
253
275
  }
254
- return i.enter === void 0 && i.loop === void 0 && a.push("motion says nothing to play: give it an `enter`, a `loop`, or both"), i.stagger !== void 0 && i.enter === void 0 && a.push("motion.stagger staggers the children’s `enter`: give it one"), a;
255
- }, m = (e) => p(e).length === 0, h = (e) => {
276
+ if (i.easing !== void 0 && !u(i.easing) && a.push(`motion.easing is a curve CSS names: ${o.join(", ")}, cubic-bezier(x1, y1, x2, y2) with x from 0 to 1, or steps(n)`), i.distance !== void 0) {
277
+ let e = b(t, i.enter) ? i.enter : void 0, n = Object.keys(d).join(", ");
278
+ typeof i.distance != "number" || !Number.isFinite(i.distance) || i.distance < 0 || i.distance > 400 ? a.push("motion.distance is how far it travels, a number of px from 0 to 400") : (e === void 0 || d[e] === void 0) && a.push(`motion.distance is how far an arrival travels — ${n} do; ${e ?? "an element with no enter"} does not`);
279
+ }
280
+ return i.easing !== void 0 && i.enter === void 0 && a.push("motion.easing is the curve of its `enter`: give it one"), i.enter === void 0 && i.loop === void 0 && a.push("motion says nothing to play: give it an `enter`, a `loop`, or both"), i.stagger !== void 0 && i.enter === void 0 && a.push("motion.stagger staggers the children’s `enter`: give it one"), a;
281
+ }, C = (e) => S(e).length === 0, w = (e) => {
256
282
  if (!e) return {
257
283
  attributes: {},
258
284
  style: {}
259
285
  };
260
286
  let t = {}, n = {};
261
- return e.enter && (t[e.stagger === void 0 ? "data-motion-enter" : "data-motion-stagger"] = e.enter, t["data-motion-on"] = e.on ?? "load"), e.loop && (t["data-motion-loop"] = e.loop), e.duration !== void 0 && (n["--plitzi-motion-duration"] = `${String(e.duration)}ms`), e.delay !== void 0 && (n["--plitzi-motion-delay"] = `${String(e.delay)}ms`), e.stagger !== void 0 && (n["--plitzi-motion-stagger"] = `${String(e.stagger)}ms`), {
287
+ e.enter && (t[e.stagger === void 0 ? "data-motion-enter" : "data-motion-stagger"] = e.enter, t["data-motion-on"] = e.on ?? "load"), e.loop && (t["data-motion-loop"] = e.loop), e.duration !== void 0 && (n["--plitzi-motion-duration"] = `${String(e.duration)}ms`), e.delay !== void 0 && (n["--plitzi-motion-delay"] = `${String(e.delay)}ms`), e.stagger !== void 0 && (n["--plitzi-motion-stagger"] = `${String(e.stagger)}ms`), e.easing !== void 0 && (n["--plitzi-motion-easing"] = e.easing.trim());
288
+ let r = e.enter ? d[e.enter] : void 0;
289
+ return e.distance !== void 0 && r !== void 0 && (n[p] = String(Math.round(e.distance / r * 1e4) / 1e4)), {
262
290
  attributes: t,
263
291
  style: n
264
292
  };
265
- }, g = "[data-motion-enter], [data-motion-stagger] > *, [data-motion-loop]", _ = `${g} { animation: none !important; }`, v = "data-motion-seen", y = "[data-motion-on=\"view\"]", b = "[data-motion-on=\"view\"][data-motion-enter], [data-motion-on=\"view\"][data-motion-stagger] > * { animation-play-state: running, running !important; }", x = [
293
+ }, T = "[data-motion-enter], [data-motion-stagger] > *, [data-motion-loop]", E = `${T} { animation: none !important; }`, D = "data-motion-seen", O = "[data-motion-on=\"view\"]", k = "[data-motion-on=\"view\"][data-motion-enter], [data-motion-on=\"view\"][data-motion-stagger] > * { animation-play-state: running, running !important; }", A = [
266
294
  "[data-motion-loop] { animation-play-state: running, running !important; }",
267
- b,
295
+ k,
268
296
  "[data-motion-on=\"scroll\"][data-motion-enter], [data-motion-on=\"scroll\"][data-motion-stagger] > * { animation-timeline: auto, auto !important; }"
269
- ].join("\n"), S = (e) => "animationName" in e && typeof e.animationName == "string" && e.animationName.startsWith("plitzi-motion-");
297
+ ].join("\n"), j = (e) => "animationName" in e && typeof e.animationName == "string" && e.animationName.startsWith("plitzi-motion-");
270
298
  //#endregion
271
- export { i as MOTION_DEFAULT_DURATION, t as MOTION_ENTERS, a as MOTION_ENTER_EASING, o as MOTION_ENTER_FRAMES, s as MOTION_ENTER_FROM, r as MOTION_LOOPS, l as MOTION_LOOP_FRAMES, u as MOTION_MAX_MS, x as MOTION_PLAY_CSS, v as MOTION_SEEN_ATTRIBUTE, b as MOTION_SEEN_CSS, _ as MOTION_STILL_CSS, n as MOTION_TRIGGERS, y as MOTION_VIEW_SELECTOR, g as MOVING_SELECTOR, m as isMotion, S as isMotionAnimation, h as motionAttributes, p as motionProblems };
299
+ export { i as MOTION_DEFAULT_DURATION, o as MOTION_EASING_KEYWORDS, t as MOTION_ENTERS, a as MOTION_ENTER_EASING, h as MOTION_ENTER_FRAMES, g as MOTION_ENTER_FROM, d as MOTION_ENTER_TRAVEL, r as MOTION_LOOPS, v as MOTION_LOOP_FRAMES, f as MOTION_MAX_DISTANCE, y as MOTION_MAX_MS, A as MOTION_PLAY_CSS, D as MOTION_SEEN_ATTRIBUTE, k as MOTION_SEEN_CSS, E as MOTION_STILL_CSS, p as MOTION_TRAVEL_PROPERTY, n as MOTION_TRIGGERS, O as MOTION_VIEW_SELECTOR, T as MOVING_SELECTOR, C as isMotion, j as isMotionAnimation, u as isMotionEasing, w as motionAttributes, S as motionProblems, m as travelled };
@@ -22,6 +22,12 @@ export declare const WITHHELD_ATTRIBUTE = "withheld";
22
22
  export type PageWithheld = 'unauthenticated' | 'forbidden';
23
23
  /** Why a page of the space this browser was sent has no content, or nothing when it has its own. */
24
24
  export declare const pageWithheldOf: (attributes: Record<string, unknown> | undefined) => PageWithheld | undefined;
25
+ /**
26
+ * The page a page withheld from its visitor draws instead of the platform's refusal (`settings.withheldPage`): one of
27
+ * the space's pages that declares no `access` — or nothing, and the platform's few words. A schema holding only `flat`
28
+ * (a linter's, a page head's) has none.
29
+ */
30
+ export declare const withheldPageOf: (schema: Pick<Schema, "flat"> & Partial<Pick<Schema, "pages" | "settings">>) => string | undefined;
25
31
  /** The space as one visitor may be sent it, and the accesses of the protected pages it still holds whole. */
26
32
  export type WithheldSchema = {
27
33
  schema: Schema;
@@ -13,7 +13,12 @@ var t = (e) => {
13
13
  }, n) : void 0, r = "withheld", i = (e) => {
14
14
  let t = e?.[r];
15
15
  return t === "unauthenticated" || t === "forbidden" ? t : void 0;
16
- }, a = (e, i) => {
16
+ }, a = (e) => {
17
+ let n = e.settings?.withheldPage;
18
+ if (n === void 0 || !e.pages?.includes(n)) return;
19
+ let r = e.flat[n];
20
+ return r && !t(r.attributes) ? n : void 0;
21
+ }, o = (e, i) => {
17
22
  let a = /* @__PURE__ */ new Map(), o = [];
18
23
  for (let r of e.pages) {
19
24
  let s = t(e.flat[r]?.attributes);
@@ -49,6 +54,6 @@ var t = (e) => {
49
54
  withheld: [...a.keys()],
50
55
  kept: o
51
56
  };
52
- }, o = (e, t) => e.every((e) => n(e, t) === void 0);
57
+ }, s = (e, t) => e.every((e) => n(e, t) === void 0);
53
58
  //#endregion
54
- export { r as WITHHELD_ATTRIBUTE, o as mayReceive, t as pageAccessOf, n as pageAccessRefusal, i as pageWithheldOf, a as withholdPages };
59
+ export { r as WITHHELD_ATTRIBUTE, s as mayReceive, t as pageAccessOf, n as pageAccessRefusal, i as pageWithheldOf, a as withheldPageOf, o as withholdPages };
@@ -0,0 +1,64 @@
1
+ import { Schema } from '../types';
2
+ /**
3
+ * What a page's head says of it to whoever shows a link to it — a chat's preview card, a social post, a search result —
4
+ * and to the browser around it: one definition, read by the server that writes the document (what a link preview reads,
5
+ * never running the page) and by the page itself as it moves (`PageHead`), so the two never say different things.
6
+ */
7
+ /** The kinds of page Open Graph names (`og:type`), as ogp.me lists them. */
8
+ export declare const OG_TYPES: readonly ["website", "article", "profile", "book", "music.song", "music.album", "music.playlist", "music.radio_station", "video.movie", "video.episode", "video.tv_show", "video.other"];
9
+ export type OgType = (typeof OG_TYPES)[number];
10
+ export declare const isOgType: (value: unknown) => value is OgType;
11
+ /** The space's own settings a head reads: who the site is, beside each page. */
12
+ export type SpaceIdentity = Pick<Schema['settings'], 'siteName' | 'language' | 'favicon' | 'shareImage' | 'themeColor'>;
13
+ /** What one page says of itself, its templates already read: its own words, and its picture. */
14
+ export interface PageHeadFacts {
15
+ title?: string;
16
+ description?: string;
17
+ robots?: string;
18
+ image?: string;
19
+ imageAlt?: string;
20
+ type?: OgType;
21
+ }
22
+ /** A `<meta>` of the head: by `name` (description, twitter:…) or by `property` (Open Graph's). */
23
+ export interface HeadMeta {
24
+ attribute: 'name' | 'property';
25
+ key: string;
26
+ content: string;
27
+ /** For `theme-color` a scheme: `(prefers-color-scheme: dark)`. */
28
+ media?: string;
29
+ }
30
+ /** A `<link>` of the head: the page's own address, the tab's icon. */
31
+ export interface HeadLink {
32
+ rel: string;
33
+ href: string;
34
+ type?: string;
35
+ }
36
+ export interface PageHeadTags {
37
+ meta: HeadMeta[];
38
+ links: HeadLink[];
39
+ /** `<html lang>`, when the space says its language. */
40
+ lang?: string;
41
+ }
42
+ /** Whether a value names a file of the site or an address: what `favicon`, `shareImage` and a page's image take. */
43
+ export declare const isHeadAddress: (value: string) => boolean;
44
+ /**
45
+ * An address as a reader outside the page needs it: whole. A chat's preview never resolves `/og.png` against the page,
46
+ * so a file of the site is written with the origin the request came to; an address stays as it is.
47
+ */
48
+ export declare const absoluteAddress: (value: string, origin: string) => string;
49
+ /**
50
+ * What is wrong with the space's identity settings, each said with its fix — authoring refuses on them and the builder
51
+ * shows them as they are typed. None when they are right.
52
+ */
53
+ export declare const spaceIdentityProblems: (settings: SpaceIdentity) => string[];
54
+ /** Plitzi's own icon: the tab of a space that names none. */
55
+ export declare const DEFAULT_FAVICON = "https://cdn.plitzi.com/resources/img/favicon.svg";
56
+ /**
57
+ * Every tag a page's head carries besides its title and its JSON-LD: its description, its robots, its Open Graph and
58
+ * card — the title, the description, the picture and its words, the kind, the site, the language, the page's own
59
+ * address — the tab's icon and the browser's colour. `url` is the page's whole address, without its query: what a
60
+ * preview names as the link, and the canonical one. A picture of the site is made whole against its origin.
61
+ */
62
+ export declare const pageHeadTags: (page: PageHeadFacts, space: SpaceIdentity, url: string) => PageHeadTags;
63
+ /** The space's identity, read off its settings: only what each is, never another setting. */
64
+ export declare const spaceIdentity: (settings: Partial<Schema["settings"]> | undefined) => SpaceIdentity;