@phis/ui 0.5.4 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/components/cms/phi-cms-layout-renderer.js +17 -7
  2. package/components/controls/phi-anchor-nav-control.js +18 -1
  3. package/components/layouts/clients/phi-flex-layout-client.js +17 -2
  4. package/components/layouts/clients/phi-layout-anchored-overlay.d.ts +2 -0
  5. package/components/layouts/clients/phi-layout-anchored-overlay.js +2 -0
  6. package/components/regions/presets/content-entry-editor-page-tree.js +2 -0
  7. package/components/regions/presets/content-entry-public-page-trees.js +2 -0
  8. package/components/widgets/builder/stack-tabs.d.ts +2 -1
  9. package/components/widgets/builder/stack-tabs.js +18 -2
  10. package/components/widgets/config/choice-shared.d.ts +0 -48
  11. package/components/widgets/config/choice-shared.js +0 -1
  12. package/components/widgets/config/stack-tabs.js +4 -3
  13. package/components/widgets/shared/card-body-client.d.ts +6 -2
  14. package/components/widgets/shared/card-body-client.js +27 -20
  15. package/components/widgets/shared/card-vocabulary.d.ts +7 -0
  16. package/components/widgets/shared/card-vocabulary.js +6 -0
  17. package/components/widgets/shared/markdown-body-client.js +7 -2
  18. package/constants/module-identity.d.ts +8 -0
  19. package/constants/module-identity.js +13 -0
  20. package/gateway/server-module-media.d.ts +12 -0
  21. package/gateway/server-module-media.js +83 -0
  22. package/helpers/cms-navigation-catalog.js +4 -1
  23. package/helpers/cms-page-catalog.d.ts +7 -0
  24. package/helpers/cms-preset-page-tree.js +16 -1
  25. package/helpers/config-text-fields.d.ts +49 -0
  26. package/helpers/config-text-fields.js +122 -0
  27. package/helpers/module-media-check.d.ts +23 -0
  28. package/helpers/module-media-check.js +32 -0
  29. package/helpers/module-media.d.ts +7 -0
  30. package/helpers/module-media.js +15 -0
  31. package/helpers/preset-text-source-check.d.ts +22 -0
  32. package/helpers/preset-text-source-check.js +45 -0
  33. package/helpers/route-address-check.d.ts +35 -0
  34. package/helpers/route-address-check.js +28 -0
  35. package/helpers/text-source.d.ts +14 -5
  36. package/helpers/text-source.js +16 -3
  37. package/module-page-check.d.ts +3 -0
  38. package/module-page-check.js +3 -0
  39. package/package.json +1 -1
  40. package/plugins/runtime/phi-slot-child-frame-view.js +1 -1
  41. package/plugins/runtime/slot-size-policy.d.ts +8 -2
  42. package/plugins/runtime/slot-size-policy.js +51 -16
  43. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-page-tree.js +2 -0
  44. package/plugins/runtime-modules/builder/area-shell-presets.server.js +2 -0
  45. package/plugins/runtime-modules/builder/clients/widget-inspector.js +2 -2
  46. package/plugins/runtime-modules/builder/navigation-folder-drop.js +2 -1
  47. package/plugins/runtime-modules/builder/options-providers.js +7 -1
  48. package/plugins/runtime-modules/builder/page-presets.server.js +2 -0
  49. package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +3 -0
  50. package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +11 -0
  51. package/plugins/runtime-modules/core/widgets/breadcrumb/server.js +9 -2
  52. package/plugins/runtime-modules/core/widgets/button/config.d.ts +0 -1
  53. package/plugins/runtime-modules/core/widgets/button/config.js +0 -1
  54. package/plugins/runtime-modules/core/widgets/button/plugin.js +6 -25
  55. package/plugins/runtime-modules/core/widgets/card/config.d.ts +24 -2
  56. package/plugins/runtime-modules/core/widgets/card/config.js +35 -3
  57. package/plugins/runtime-modules/core/widgets/card/editor.js +2 -0
  58. package/plugins/runtime-modules/core/widgets/card/plugin.js +8 -10
  59. package/plugins/runtime-modules/core/widgets/card/server.d.ts +1 -2
  60. package/plugins/runtime-modules/core/widgets/card/server.js +18 -28
  61. package/plugins/runtime-modules/core/widgets/cascader/authoring.d.ts +1 -0
  62. package/plugins/runtime-modules/core/widgets/checkbox-group/config.d.ts +7 -1
  63. package/plugins/runtime-modules/core/widgets/checkbox-group/config.js +1 -1
  64. package/plugins/runtime-modules/core/widgets/description/config.d.ts +1 -0
  65. package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +1 -1
  66. package/plugins/runtime-modules/core/widgets/entry-list/config.js +0 -1
  67. package/plugins/runtime-modules/core/widgets/entry-list/plugin.js +1 -3
  68. package/plugins/runtime-modules/core/widgets/entry-list/server.d.ts +1 -3
  69. package/plugins/runtime-modules/core/widgets/entry-list/server.js +3 -3
  70. package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +1 -0
  71. package/plugins/runtime-modules/core/widgets/image/server.js +5 -9
  72. package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +1 -0
  73. package/plugins/runtime-modules/core/widgets/markdown-toc/server.js +3 -5
  74. package/plugins/runtime-modules/core/widgets/quick-links/plugin.js +2 -4
  75. package/plugins/runtime-modules/core/widgets/quick-links/server.d.ts +2 -5
  76. package/plugins/runtime-modules/core/widgets/quick-links/server.js +2 -6
  77. package/plugins/runtime-modules/core/widgets/result/config.d.ts +1 -1
  78. package/plugins/runtime-modules/core/widgets/result/config.js +0 -1
  79. package/plugins/runtime-modules/core/widgets/result/plugin.js +2 -4
  80. package/plugins/runtime-modules/core/widgets/result/server.d.ts +2 -3
  81. package/plugins/runtime-modules/core/widgets/result/server.js +11 -33
  82. package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -0
  83. package/plugins/runtime-modules/core/widgets/slider/config.d.ts +11 -0
  84. package/plugins/runtime-modules/core/widgets/slider/config.js +1 -1
  85. package/plugins/runtime-modules/core/widgets/slot-upload/config.d.ts +0 -1
  86. package/plugins/runtime-modules/core/widgets/slot-upload/config.js +0 -2
  87. package/plugins/runtime-modules/core/widgets/slot-upload/plugin.js +2 -4
  88. package/plugins/runtime-modules/core/widgets/slot-upload/server.d.ts +3 -4
  89. package/plugins/runtime-modules/core/widgets/slot-upload/server.js +5 -13
  90. package/plugins/runtime-modules/core/widgets/spacer/config.d.ts +1 -1
  91. package/plugins/runtime-modules/core/widgets/spacer/config.js +1 -1
  92. package/plugins/runtime-modules/core/widgets/steps/config.d.ts +7 -2
  93. package/plugins/runtime-modules/core/widgets/steps/config.js +1 -2
  94. package/plugins/runtime-modules/core/widgets/steps/plugin.js +6 -30
  95. package/plugins/runtime-modules/core/widgets/table/config.d.ts +3 -0
  96. package/plugins/runtime-modules/core/widgets/table/config.js +1 -1
  97. package/plugins/runtime-modules/core/widgets/timeline/config.d.ts +8 -1
  98. package/plugins/runtime-modules/core/widgets/timeline/config.js +1 -2
  99. package/plugins/runtime-modules/core/widgets/timeline/plugin.js +6 -37
  100. package/plugins/runtime-modules/descriptor-compiler.d.ts +23 -3
  101. package/plugins/runtime-modules/descriptor-compiler.js +107 -12
  102. package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +2 -0
  103. package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +2 -0
  104. package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +3 -0
  105. package/plugins/runtime-modules/page-preset-overlays.d.ts +18 -0
  106. package/plugins/runtime-modules/page-preset-overlays.js +70 -0
  107. package/plugins/runtime-modules/public/trees/phi-default-pub-welcome-page-tree.js +1 -0
  108. package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +3 -0
  109. package/plugins/runtime-modules/search/widgets/search-box/server.js +3 -5
  110. package/plugins/runtime-modules/search/widgets/search-results/server.js +3 -5
  111. package/plugins/runtime-modules/theme/trees/phi-default-builder-theme-page-tree.js +4 -0
  112. package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +2 -0
  113. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +2 -0
  114. package/server-helpers/cms-area.js +9 -1
  115. package/server-helpers/cms-request.js +49 -14
  116. package/server-helpers/cms-root.js +2 -0
  117. package/server-helpers/cms-widget-texts.d.ts +14 -0
  118. package/server-helpers/cms-widget-texts.js +117 -0
  119. package/server-helpers/module-folder-targets.d.ts +7 -0
  120. package/server-helpers/module-folder-targets.js +15 -0
  121. package/server-helpers/search-index.js +12 -3
  122. package/styles/root.css +6 -2
  123. package/types/cms-module-descriptors.d.ts +24 -0
  124. package/types/cms-plugins.d.ts +30 -5
  125. package/types/core-widget-placements.d.ts +5 -0
  126. package/types/module-media.d.ts +31 -0
  127. package/types/module-media.js +11 -0
  128. package/types/slot-size-policy.d.ts +19 -2
  129. package/types.d.ts +1 -0
@@ -17,7 +17,11 @@ export type PhiSlotChildSizing = {
17
17
  */
18
18
  queriesRoom: boolean;
19
19
  };
20
- export declare function resolvePhiSlotSizePolicy(policy: PhiSlotSizePolicy | null | undefined, kind: PhiSlotChildKind): PhiNormalizedSlotSizePolicy;
20
+ /**
21
+ * `config` is the config of the block whose policy this is; a by-config policy reads its field there.
22
+ * A caller without the block's config passes `null` and gets `otherwise`.
23
+ */
24
+ export declare function resolvePhiSlotSizePolicy(policy: PhiSlotSizePolicy | null | undefined, kind: PhiSlotChildKind, config: Record<string, unknown> | null | undefined): PhiNormalizedSlotSizePolicy;
21
25
  export declare function resolvePhiSlotChildExplicitAxes(geometry: PhiResolvedBlockGeometry): {
22
26
  explicitInlineSize: boolean;
23
27
  explicitBlockSize: boolean;
@@ -61,7 +65,8 @@ export declare function resolvePhiSlotChildSizeConstraints(geometry: PhiResolved
61
65
  * `Cannot assign to read only property 'config'` and take the Widget's whole render with it. The account
62
66
  * menu was lost to exactly that shape, from a different source; see the Account Widget plugin.
63
67
  *
64
- * Six resolved values carry the same information and share nothing, so there is no reference to fill in.
68
+ * Resolved values carry the same information and share nothing, so there is no reference to fill in.
69
+ * The policy is built here as a plain object, `takesRest` included.
65
70
  */
66
71
  export declare function resolvePhiSlotChildSizingForConfig(kind: PhiSlotChildKind, slotSizePolicy: PhiSlotSizePolicy | null | undefined, config: PhiRenderableBlockGeometryInput | null | undefined): PhiSlotChildSizing;
67
72
  export declare function buildPhiSlotChildClassName(policy: PhiNormalizedSlotSizePolicy): string;
@@ -75,6 +80,7 @@ export declare function buildPhiSlotChildDataAttributes(policy: PhiNormalizedSlo
75
80
  }): {
76
81
  "data-phi-slot-size-inline": PhiSlotAxisSizePolicy;
77
82
  "data-phi-slot-size-block": PhiSlotAxisSizePolicy;
83
+ "data-phi-slot-rest": string | undefined;
78
84
  "data-phi-layout-fill-slot": string | undefined;
79
85
  "data-phi-layout-explicit-width": string | undefined;
80
86
  "data-phi-layout-explicit-height": string | undefined;
@@ -25,9 +25,30 @@ const PHI_SLOT_CHILD_DEFAULT_POLICY = {
25
25
  function normalizePhiSlotPolicyAxis(axis, fallback) {
26
26
  return axis === "fill" || axis === "fixed" || axis === "intrinsic" ? axis : fallback;
27
27
  }
28
- export function resolvePhiSlotSizePolicy(policy, kind) {
28
+ /**
29
+ * The value a by-config policy holds for this config.
30
+ *
31
+ * Only a top-level config field with a string or boolean value is read (a boolean as the key `"true"` or
32
+ * `"false"`); a missing field, any other value, an unknown value and no config at all give `otherwise`. A policy that is already a value passes through.
33
+ */
34
+ function resolvePhiSlotSizePolicyValue(policy, config) {
35
+ if (policy == null || typeof policy === "string" || !("configField" in policy)) {
36
+ return policy;
37
+ }
38
+ const field = config?.[policy.configField];
39
+ const selected = typeof field === "boolean" ? String(field) : field;
40
+ return typeof selected === "string" && Object.hasOwn(policy.byValue, selected)
41
+ ? policy.byValue[selected]
42
+ : policy.otherwise;
43
+ }
44
+ /**
45
+ * `config` is the config of the block whose policy this is; a by-config policy reads its field there.
46
+ * A caller without the block's config passes `null` and gets `otherwise`.
47
+ */
48
+ export function resolvePhiSlotSizePolicy(policy, kind, config) {
29
49
  const fallback = PHI_SLOT_CHILD_DEFAULT_POLICY[kind];
30
- if (policy == null) {
50
+ const value = resolvePhiSlotSizePolicyValue(policy, config);
51
+ if (value == null) {
31
52
  return fallback;
32
53
  }
33
54
  /*
@@ -38,39 +59,46 @@ export function resolvePhiSlotSizePolicy(policy, kind) {
38
59
  * Layout asked, so nothing moved -- but the word has to mean what it says now that every definition
39
60
  * has to say it.
40
61
  */
41
- if (policy === "intrinsic") {
62
+ if (value === "intrinsic") {
42
63
  return {
43
64
  inline: "intrinsic",
44
65
  block: "intrinsic",
45
66
  };
46
67
  }
47
- if (policy === "fill") {
68
+ if (value === "fill") {
48
69
  return {
49
70
  inline: "fill",
50
71
  block: "fill",
51
72
  };
52
73
  }
53
- if (policy === "fill-inline") {
74
+ if (value === "rest") {
75
+ return {
76
+ inline: "fill",
77
+ block: "fill",
78
+ takesRest: true,
79
+ };
80
+ }
81
+ if (value === "fill-inline") {
54
82
  return {
55
83
  inline: "fill",
56
84
  block: "intrinsic",
57
85
  };
58
86
  }
59
- if (policy === "fill-block") {
87
+ if (value === "fill-block") {
60
88
  return {
61
89
  inline: "intrinsic",
62
90
  block: "fill",
63
91
  };
64
92
  }
65
- if (policy === "fixed") {
93
+ if (value === "fixed") {
66
94
  return {
67
95
  inline: "fixed",
68
96
  block: "fixed",
69
97
  };
70
98
  }
71
99
  return {
72
- inline: normalizePhiSlotPolicyAxis(policy.inline, fallback.inline),
73
- block: normalizePhiSlotPolicyAxis(policy.block, fallback.block),
100
+ inline: normalizePhiSlotPolicyAxis(value.inline, fallback.inline),
101
+ block: normalizePhiSlotPolicyAxis(value.block, fallback.block),
74
102
  };
75
103
  }
76
104
  export function resolvePhiSlotChildExplicitAxes(geometry) {
@@ -100,7 +128,11 @@ export function resolvePhiSlotChildExplicitAxes(geometry) {
100
128
  export function resolvePhiEffectiveSlotSizePolicy(policy, explicit) {
101
129
  const inline = explicit?.explicitInlineSize === true ? "fixed" : policy.inline;
102
130
  const block = explicit?.explicitBlockSize === true ? "fixed" : policy.block;
103
- return inline === policy.inline && block === policy.block ? policy : { inline, block };
131
+ if (inline === policy.inline && block === policy.block) {
132
+ return policy;
133
+ }
134
+ // The flag is carried as it stands: the Flex Layout asks for it together with a main axis that still fills.
135
+ return policy.takesRest === true ? { inline, block, takesRest: true } : { inline, block };
104
136
  }
105
137
  export function resolvePhiSlotChildSizeConstraints(geometry) {
106
138
  return {
@@ -121,13 +153,14 @@ export function resolvePhiSlotChildSizeConstraints(geometry) {
121
153
  * `Cannot assign to read only property 'config'` and take the Widget's whole render with it. The account
122
154
  * menu was lost to exactly that shape, from a different source; see the Account Widget plugin.
123
155
  *
124
- * Six resolved values carry the same information and share nothing, so there is no reference to fill in.
156
+ * Resolved values carry the same information and share nothing, so there is no reference to fill in.
157
+ * The policy is built here as a plain object, `takesRest` included.
125
158
  */
126
159
  export function resolvePhiSlotChildSizingForConfig(kind, slotSizePolicy, config) {
127
160
  const geometry = resolvePhiRenderableBlockGeometry(config);
128
161
  const explicit = resolvePhiSlotChildExplicitAxes(geometry);
129
162
  return {
130
- policy: resolvePhiEffectiveSlotSizePolicy(resolvePhiSlotSizePolicy(slotSizePolicy, kind), explicit),
163
+ policy: resolvePhiEffectiveSlotSizePolicy(resolvePhiSlotSizePolicy(slotSizePolicy, kind, config), explicit),
131
164
  ...explicit,
132
165
  ...resolvePhiSlotChildSizeConstraints(geometry),
133
166
  queriesRoom: phiBlockGeometryQueriesRoom(geometry),
@@ -149,6 +182,7 @@ export function buildPhiSlotChildDataAttributes(policy, options) {
149
182
  return {
150
183
  "data-phi-slot-size-inline": policy.inline,
151
184
  "data-phi-slot-size-block": policy.block,
185
+ "data-phi-slot-rest": policy.takesRest === true ? "true" : undefined,
152
186
  "data-phi-layout-fill-slot": fillInline || fillBlock ? "true" : undefined,
153
187
  "data-phi-layout-explicit-width": explicitInlineSize ? "true" : undefined,
154
188
  "data-phi-layout-explicit-height": explicitBlockSize ? "true" : undefined,
@@ -161,7 +195,7 @@ export function buildPhiSlotChildDataAttributes(policy, options) {
161
195
  export function resolvePhiSlotChildSizing(child, fallbackKind = "widget") {
162
196
  if (!isValidElement(child)) {
163
197
  return {
164
- policy: resolvePhiSlotSizePolicy(undefined, fallbackKind),
198
+ policy: resolvePhiSlotSizePolicy(undefined, fallbackKind, null),
165
199
  explicitInlineSize: false,
166
200
  explicitBlockSize: false,
167
201
  queriesRoom: false,
@@ -194,7 +228,7 @@ export function resolvePhiSlotChildSizing(child, fallbackKind = "widget") {
194
228
  || configExplicit.explicitBlockSize,
195
229
  };
196
230
  return {
197
- policy: resolvePhiEffectiveSlotSizePolicy(resolvePhiSlotSizePolicy(props.slotSizePolicy, resolvedKind), explicit),
231
+ policy: resolvePhiEffectiveSlotSizePolicy(resolvePhiSlotSizePolicy(props.slotSizePolicy, resolvedKind, props.config), explicit),
198
232
  ...explicit,
199
233
  ...configConstraints,
200
234
  queriesRoom,
@@ -211,14 +245,15 @@ export function resolvePhiSlotChildSizing(child, fallbackKind = "widget") {
211
245
  props["data-phi-slot-size-block"] === "intrinsic"
212
246
  ? props["data-phi-slot-size-block"]
213
247
  : undefined,
214
- }, fallbackKind);
248
+ }, fallbackKind, props.config);
249
+ const dataPolicy = props["data-phi-slot-rest"] === "true" ? { ...policy, takesRest: true } : policy;
215
250
  const explicit = {
216
251
  explicitInlineSize: props["data-phi-layout-explicit-width"] === "true" || configExplicit.explicitInlineSize,
217
252
  explicitBlockSize: props["data-phi-layout-explicit-height"] === "true" || configExplicit.explicitBlockSize,
218
253
  };
219
254
  return {
220
255
  // Idempotent: an element that already wrote the effective policy into its attributes says the same again.
221
- policy: resolvePhiEffectiveSlotSizePolicy(policy, explicit),
256
+ policy: resolvePhiEffectiveSlotSizePolicy(dataPolicy, explicit),
222
257
  ...explicit,
223
258
  queriesRoom,
224
259
  minInlineSize: configConstraints.minInlineSize ??
@@ -1,3 +1,4 @@
1
+ import { PHI_TEXT_SOURCE_PRESET } from "../../../../helpers/text-source";
1
2
  import { createPhiPresetCmsInstanceIdMap } from "../../../../types/cms-instance-id";
2
3
  import { PHI_SURFACE_CARD } from "../../../../helpers/surface-presets";
3
4
  import { PHI_ACCOUNTING_RUNTIME_MODULE_ID } from "../ids";
@@ -36,6 +37,7 @@ export async function buildPhiDefaultAccountingPageTree({ page, }) {
36
37
  label: "Accounting",
37
38
  config: {
38
39
  eyebrow: "Accounting",
40
+ textSource: PHI_TEXT_SOURCE_PRESET,
39
41
  title: "Accounting",
40
42
  description: "Invoices and billing workflows for this site.",
41
43
  variant: "compact",
@@ -12,6 +12,7 @@ import { resolvePhiBuilderAreaAsCmsArea } from "../../../constants/cms-areas";
12
12
  import { instantiatePhiCmsAreaShellPreset, resolvePhiCmsAreaShellPresetBinding, resolvePhiCmsDescriptorCatalog, } from "../../../plugins/runtime-modules/descriptor-compiler";
13
13
  import { PHI_BUILDER_AREA_SEARCH_PARAM, normalizePhiBuilderAreaSearchParam, } from "../../../helpers/cms-scope-search-params";
14
14
  import { readPhiServerApiCredentials } from "../../../helpers/phis-server-credentials";
15
+ import { createPhiModuleMediaLoader } from "../../../gateway/server-module-media";
15
16
  /**
16
17
  * Every Area's installed Shell as the Builder edits it: with the current content of every node somebody
17
18
  * wrote content for. All Areas together and once per request, because the Builder holds the preset
@@ -31,6 +32,7 @@ const loadInstalledAreaShellPresetTrees = cache(async function loadInstalledArea
31
32
  siteId: runtime.site.id,
32
33
  path: resolveStructureAreaPath(area),
33
34
  runtime,
35
+ loadModuleMedia: createPhiModuleMediaLoader(runtime.site.key),
34
36
  });
35
37
  return [area, tree];
36
38
  }))).filter((entry) => entry != null);
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { isPhiAuthoredTextField, readPhiTextSource } from "../../../../helpers/text-source";
3
+ import { PHI_TEXT_SOURCE_PRESET, isPhiAuthoredTextField, readPhiTextSource } from "../../../../helpers/text-source";
4
4
  import { useEffect } from "react";
5
5
  import { PhiGeometryControl } from "../../../../components/controls/phi-geometry-control";
6
6
  import { PhiSurfaceControl } from "../../../../components/controls/phi-surface-control";
@@ -88,7 +88,7 @@ export function PhiDeveloperBuilderWidgetInspectorWidgetClient({ section, builde
88
88
  * An author writing into a Preset's text makes the Widget's words the Site's: from here on the
89
89
  * Site's store translates them, not the global one (`helpers/text-source.ts`).
90
90
  */
91
- if (readPhiTextSource(currentWidgetSettingsConfigRecord.textSource) != null
91
+ if (readPhiTextSource(currentWidgetSettingsConfigRecord.textSource) === PHI_TEXT_SOURCE_PRESET
92
92
  && isPhiAuthoredTextField(field)) {
93
93
  patch.textSource = undefined;
94
94
  }
@@ -1,6 +1,7 @@
1
1
  /** A Page the Navigation can point at: it has a stable reference and has not been deleted. */
2
2
  export function isPhiBuilderNavigablePage(node) {
3
- return Boolean(node.reference) && node.tombstoned !== true;
3
+ // A list's entries are no Page a link can name (`routeParameter`): a link names one entry.
4
+ return Boolean(node.reference) && node.tombstoned !== true && !node.routeParameter;
4
5
  }
5
6
  /** Whether a catalog node would give the Navigation anything: a live Page, or one somewhere beneath it. */
6
7
  export function hasPhiBuilderNavigableContent(node) {
@@ -20,6 +20,9 @@ function resolveProviderArea(context) {
20
20
  ? context.optionsProvider.area
21
21
  : builderArea;
22
22
  }
23
+ function humanizeRouteParameter(name) {
24
+ return name.charAt(0).toUpperCase() + name.slice(1);
25
+ }
23
26
  function collectPageOptions(area, nodes) {
24
27
  return nodes.flatMap((node) => {
25
28
  /*
@@ -44,11 +47,14 @@ function collectPageOptions(area, nodes) {
44
47
  * by an author, and either way it hides where the Page answers: "Zz Nw Test" is `/zz-nw-test`.
45
48
  */
46
49
  const address = node.storagePath ?? path;
50
+ // A list's entries are a kind, not one Page: named so beside their pattern, `Slug · /blog/:slug`.
51
+ const description = node.routeParameter ? `${humanizeRouteParameter(node.routeParameter)} · ${address}` : address;
47
52
  return [
48
53
  {
49
54
  value: path,
50
55
  label,
51
- ...(address !== label ? { description: address } : {}),
56
+ ...(description !== label ? { description } : {}),
57
+ ...(node.routeParameter ? { icon: "antd:unordered-list" } : {}),
52
58
  },
53
59
  ...collectPageOptions(area, node.children ?? []),
54
60
  ];
@@ -15,6 +15,7 @@ import { resolvePhiBuilderAreaAsCmsArea } from "../../../constants/cms-areas";
15
15
  import { createPhiPresetCmsPageId, isPhiCmsInstanceId } from "../../../types/cms-instance-id";
16
16
  import { buildPhiBuilderAreaLandingSelection, buildPhiBuilderRuntimeModulesConfigForArea, } from "./area-shell-presets.server";
17
17
  import { readPhiServerApiCredentials } from "../../../helpers/phis-server-credentials";
18
+ import { createPhiModuleMediaLoader } from "../../../gateway/server-module-media";
18
19
  /**
19
20
  * The Area's routes as the Builder's server half must see them: the table the reader compiles.
20
21
  *
@@ -95,6 +96,7 @@ async function buildPhiRegistryPresetPageTree({ runtime, runtimeModuleCatalog, b
95
96
  siteId: runtime.site.id,
96
97
  path,
97
98
  runtime,
99
+ loadModuleMedia: createPhiModuleMediaLoader(runtime.site.key),
98
100
  }), {
99
101
  runtimeModuleCatalog,
100
102
  siteKey: runtime.site.key,
@@ -1,3 +1,4 @@
1
+ import { PHI_TEXT_SOURCE_PRESET } from "../../../../helpers/text-source";
1
2
  import { PHI_CMS_DEFAULT_SLOT_INDEX } from "../../../../constants/cms-layout-types";
2
3
  import { PhiCmsFlags } from "../../../../constants/phi-cms";
3
4
  import { createPhiCmsPresetNodes } from "../../../../helpers/cms-preset-nodes";
@@ -468,6 +469,7 @@ export async function buildPhiBuilderInspectorAreaOverlayTree({ page, runtime, }
468
469
  label: "Builder effects commands",
469
470
  config: {
470
471
  key: "builder-effects-commands",
472
+ textSource: PHI_TEXT_SOURCE_PRESET,
471
473
  ...PHI_DIALOG_COMMANDS_CONFIG,
472
474
  /*
473
475
  * The two buttons as one group, the way the Area settings footer states it: they are the two
@@ -597,6 +599,7 @@ export async function buildPhiBuilderInspectorAreaOverlayTree({ page, runtime, }
597
599
  label: "Builder signal wiring commands",
598
600
  config: {
599
601
  key: "builder-signal-wiring-commands",
602
+ textSource: PHI_TEXT_SOURCE_PRESET,
600
603
  ...PHI_DIALOG_COMMANDS_CONFIG,
601
604
  /*
602
605
  * The two buttons as one group, the way the Area settings footer states it: they are the two
@@ -1,3 +1,4 @@
1
+ import { PHI_TEXT_SOURCE_PRESET } from "../../../../helpers/text-source";
1
2
  import { createPhiPresetCmsInstanceIdMap, } from "../../../../types/cms-instance-id";
2
3
  import { PHI_CMS_DEFAULT_SLOT_INDEX, PHI_CMS_SEQUENTIAL_LAYOUT_SLOTS, PHI_CMS_THREE_COLUMN_LAYOUT_SLOT_INDEX, } from "../../../../constants/cms-layout-types";
3
4
  import { PhiCmsFlags, PhiCmsRegionType, PhiCmsStatus } from "../../../../constants/phi-cms";
@@ -511,6 +512,7 @@ export async function buildPhiDefaultBuilderAreaPresetTree({ page, runtime, }) {
511
512
  label: "dev builder area selector",
512
513
  config: {
513
514
  key: "builder-area-selector",
515
+ textSource: PHI_TEXT_SOURCE_PRESET,
514
516
  value: "public",
515
517
  /*
516
518
  * Disabled is the selector's resting state: only Builder pages that edit one Area at a
@@ -564,6 +566,7 @@ export async function buildPhiDefaultBuilderAreaPresetTree({ page, runtime, }) {
564
566
  label: labels.themeSwitch.debug,
565
567
  defaultChecked: false,
566
568
  key: "debugScaffold",
569
+ textSource: PHI_TEXT_SOURCE_PRESET,
567
570
  /*
568
571
  * Disabled is the switch's resting state, the same way the Area selector rests: only the
569
572
  * pages that draw a canvas arm it, via the workspace controller's "enabled" signal
@@ -1195,6 +1198,7 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
1195
1198
  label: siderFullHeightLabel,
1196
1199
  defaultChecked: true,
1197
1200
  key: "dev-structure-sider-full-height-switch",
1201
+ textSource: PHI_TEXT_SOURCE_PRESET,
1198
1202
  signalRoutes: {
1199
1203
  emits: [
1200
1204
  {
@@ -1307,6 +1311,7 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
1307
1311
  label: "dev area settings action",
1308
1312
  config: {
1309
1313
  key: "areaSettingsAction",
1314
+ textSource: PHI_TEXT_SOURCE_PRESET,
1310
1315
  compact: true,
1311
1316
  showLabels: true,
1312
1317
  buttons: [{
@@ -1338,6 +1343,7 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
1338
1343
  label: "Area settings commands",
1339
1344
  config: {
1340
1345
  key: "area-settings-commands",
1346
+ textSource: PHI_TEXT_SOURCE_PRESET,
1341
1347
  ...PHI_DIALOG_COMMANDS_CONFIG,
1342
1348
  /*
1343
1349
  * The two buttons as one group rather than as two things that happen to stand near
@@ -1398,6 +1404,7 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
1398
1404
  label: "dev pages select",
1399
1405
  config: {
1400
1406
  key: "pageSelect",
1407
+ textSource: PHI_TEXT_SOURCE_PRESET,
1401
1408
  // Folders open under the pointer and choose nothing: only a Page is offered.
1402
1409
  expandTrigger: "hover",
1403
1410
  select: "options",
@@ -1432,6 +1439,7 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
1432
1439
  text: "",
1433
1440
  placeholder: labels.pages.form.title,
1434
1441
  key: "pageTitle",
1442
+ textSource: PHI_TEXT_SOURCE_PRESET,
1435
1443
  signalRoutes: {
1436
1444
  listens: [
1437
1445
  {
@@ -1459,6 +1467,7 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
1459
1467
  label: "dev pages meta toolbar",
1460
1468
  config: {
1461
1469
  key: "pageMetaToolbar",
1470
+ textSource: PHI_TEXT_SOURCE_PRESET,
1462
1471
  signalRoutes: {
1463
1472
  emits: [
1464
1473
  {
@@ -1715,6 +1724,7 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
1715
1724
  label: "Builder module usage commands",
1716
1725
  config: {
1717
1726
  key: "module-usage-commands",
1727
+ textSource: PHI_TEXT_SOURCE_PRESET,
1718
1728
  ...PHI_DIALOG_COMMANDS_CONFIG,
1719
1729
  buttons: [
1720
1730
  { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: modulesLabels?.usage.cancel ?? "Keep it on", icon: "close" },
@@ -1811,6 +1821,7 @@ async function buildPhiDefaultBuilderPagePresetTemplateTree({ page, runtime, pre
1811
1821
  label: "Builder public route collision commands",
1812
1822
  config: {
1813
1823
  key: "public-routes-commands",
1824
+ textSource: PHI_TEXT_SOURCE_PRESET,
1814
1825
  ...PHI_DIALOG_COMMANDS_CONFIG,
1815
1826
  buttons: [
1816
1827
  { key: "cancel", emits: [{ capabilityId: "command", value: "cancel" }], label: modulesLabels?.publicRoutes.cancel ?? "Cancel", icon: "close" },
@@ -4,6 +4,7 @@ import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runt
4
4
  import { fetchSiteNavigationFolderTarget } from "../../../../../gateway/site-nav";
5
5
  import { readPhiServerApiCredentials } from "../../../../../helpers/phis-server-credentials";
6
6
  import { resolvePhiWidgetRecordField } from "../../../../../server-helpers/record-fields";
7
+ import { resolvePhiRequestModuleFolderTargets } from "../../../../../server-helpers/module-folder-targets";
7
8
  /** The folders a Page path lies in, outermost first: `/docs/guides/a` gives `/docs` and `/docs/guides`. */
8
9
  export function listPhiBreadcrumbFolderPaths(pagePath) {
9
10
  const segments = pagePath.split("/").filter(Boolean);
@@ -13,7 +14,8 @@ export function listPhiBreadcrumbFolderPaths(pagePath) {
13
14
  * Which folders of the Page's path lead somewhere, so the client links exactly those.
14
15
  *
15
16
  * A folder segment is a link when its folder address resolves to a Page (REFERENCES.md, "Folder
16
- * addresses"); one that resolves to nothing would be a link into a 404. Asked once per folder of the
17
+ * addresses") or a Module container's `folderTarget` leads it to one; one that resolves to nothing
18
+ * would be a link into a 404. Asked once per folder of the
17
19
  * path, which is the depth of the path and not the size of the Site, and only when the trail shows the
18
20
  * path at all. A failed lookup leaves that segment unlinked rather than failing the trail.
19
21
  */
@@ -34,7 +36,12 @@ async function resolveLinkedFolderPaths(props) {
34
36
  area: String(runtime.area),
35
37
  path,
36
38
  }).catch(() => null)));
37
- return folders.filter((_path, index) => answers[index] != null);
39
+ // Where the Site chose no target, a Module container's own (`folderTarget`) answers, as on a request.
40
+ const unanswered = folders.filter((_path, index) => answers[index] == null);
41
+ const moduleTargets = unanswered.length > 0
42
+ ? resolvePhiRequestModuleFolderTargets(runtime.area, unanswered)
43
+ : new Map();
44
+ return folders.filter((path, index) => answers[index] != null || moduleTargets.has(path));
38
45
  }
39
46
  /**
40
47
  * The title of the record the Page is about, for the trail's last item; `null` leaves the path segment.
@@ -47,7 +47,6 @@ export declare const PHI_BUTTON_WIDGET_DEFINITION: {
47
47
  category: "form";
48
48
  icon: string;
49
49
  iconFamily: string;
50
- translatesOwnText: true;
51
50
  slotSizePolicy: "intrinsic";
52
51
  runtimeSignals: {
53
52
  emits: ({
@@ -46,7 +46,6 @@ export const PHI_BUTTON_WIDGET_DEFINITION = {
46
46
  category: "form",
47
47
  icon: "antd:edit-outlined",
48
48
  iconFamily: "form",
49
- translatesOwnText: true,
50
49
  slotSizePolicy: "intrinsic",
51
50
  runtimeSignals: {
52
51
  ...PHI_BUTTON_CONTROL_SIGNALS,
@@ -1,33 +1,11 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { PhiCmsFlags } from "../../../../../constants/phi-cms";
3
- import { hasPhiFlag } from "../../../../../helpers/flags";
4
2
  import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
5
3
  import { PhiRuntimeModuleRenderClientHost } from "../../../../../components/runtime/runtime-module-render-client-manifest";
6
4
  import { PHI_BUTTON_WIDGET_DEFINITION } from "./config";
7
5
  import { getPhiCommonControlLabelsForRuntime } from "../../../../../components/widgets/label-sets/common-controls";
8
6
  import { isPhiExternalHref } from "../../../../../helpers/external-href";
9
7
  import { resolvePhiLinkHref } from "../../../../../helpers/link-target";
10
- import { trBulkForLocale } from "../../../../../server-helpers/translate";
11
8
  import { resolvePhiWidgetRecordField } from "../../../../../server-helpers/record-fields";
12
- /**
13
- * The Button's own words in the reader's language.
14
- *
15
- * Every Widget translates the text written into it itself; nothing does it for them on the way in. The
16
- * common control labels beside it are a global label set and arrive translated already.
17
- */
18
- async function translatePhiButtonConfig(config, runtime, translate) {
19
- if (!translate)
20
- return config;
21
- const entries = [["label", config.label], ["tooltip", config.tooltip]]
22
- .filter((entry) => Boolean(entry[1]?.trim()));
23
- if (entries.length === 0)
24
- return config;
25
- const translated = await trBulkForLocale(runtime.locale.current, entries.map(([, text]) => text));
26
- return {
27
- ...config,
28
- ...Object.fromEntries(entries.map(([key, text], index) => [key, translated[index]?.trim() || text])),
29
- };
30
- }
31
9
  /**
32
10
  * What the page record says of the Button, where it names a field for its value or its link: a Button on
33
11
  * a template sends what the record it stands beside is called and leads where that record leads, not a
@@ -58,8 +36,11 @@ export const PHI_BUTTON_WIDGET_PLUGIN = {
58
36
  if (!bound)
59
37
  return null;
60
38
  const { link: recordLink } = bound;
61
- const translated = await translatePhiButtonConfig(bound.config, runtime, !hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate));
62
- /* The record's words stand in for an empty label only, and are the record's own: not translated. */
39
+ /*
40
+ * The Button's own words arrive translated (server-helpers/cms-widget-texts.ts). The record's stand
41
+ * in for an empty label only, and are the record's own: not translated.
42
+ */
43
+ const translated = bound.config;
63
44
  const config = recordLink?.label && !translated.label?.trim() ? { ...translated, label: recordLink.label } : translated;
64
45
  return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Button, componentProps: {
65
46
  blockId: widget.id,
@@ -72,7 +53,7 @@ export const PHI_BUTTON_WIDGET_PLUGIN = {
72
53
  },
73
54
  renderPreview: async ({ widget, config, runtime, links }) => (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.Button, componentProps: {
74
55
  blockId: widget.id,
75
- config: await translatePhiButtonConfig(config, runtime, !hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate)),
56
+ config,
76
57
  labels: await getPhiCommonControlLabelsForRuntime(runtime),
77
58
  link: resolvePhiLinkHref(config.linkTarget, links),
78
59
  disabled: true,
@@ -5,7 +5,7 @@ import type { PhiImageAssetVariantKeyValue } from "../../../../../types/media";
5
5
  import { type PhiLinkTarget } from "../../../../../types/references";
6
6
  import { type PhiBackgroundOverlay } from "../../../../../components/widgets/config/background";
7
7
  import { type PhiBulletListEntry, type PhiBulletListStyle } from "../../../../../components/widgets/shared/bullet-list-vocabulary";
8
- import { type PhiCardBillingPeriod, type PhiCardHeadingLevel, type PhiCardHoverEffect, type PhiCardIconPlacement, type PhiCardTextAlign, type PhiCardBadgeStyle, type PhiCardMediaAspectRatio, type PhiCardVariant, type PhiCardWidgetBody } from "../../../../../components/widgets/shared/card-vocabulary";
8
+ import { type PhiCardBillingPeriod, type PhiCardHeadingLevel, type PhiCardHoverEffect, type PhiCardIconPlacement, type PhiCardIconSize, type PhiCardTextAlign, type PhiCardBadgeStyle, type PhiCardMediaAspectRatio, type PhiCardVariant, type PhiCardWidgetBody } from "../../../../../components/widgets/shared/card-vocabulary";
9
9
  import { type PhiSignalRouteSet } from "../../../../../types/signals";
10
10
  import { type PhiCmsWidgetConfigBase } from "../../../../../components/widgets/config/parser-primitives";
11
11
  type PhiCardImageSource = {
@@ -54,6 +54,10 @@ export type PhiCmsCardWidgetConfig = PhiCmsWidgetConfigBase & PhiCardImageSource
54
54
  /** The icon's colour and the ground it stands on; absent, the Theme's. */
55
55
  iconColor?: string;
56
56
  iconBackground?: string;
57
+ /** How large the icon is drawn, in fixed steps. Absent is `default`. */
58
+ iconSize?: PhiCardIconSize;
59
+ /** `false` draws the icon without its ground; absent is framed. */
60
+ iconFramed?: boolean;
57
61
  /** The picture's words for a reader who cannot see it; an Asset brings its own. */
58
62
  alt?: string;
59
63
  /**
@@ -102,7 +106,22 @@ export declare const PHI_CARD_WIDGET_DEFINITION: {
102
106
  description: string;
103
107
  icon: string;
104
108
  iconFamily: string;
105
- translatesOwnText: true;
109
+ configTexts: ({
110
+ key: string;
111
+ register: "label";
112
+ item?: undefined;
113
+ values?: undefined;
114
+ } | {
115
+ key: string;
116
+ register: "message";
117
+ item?: undefined;
118
+ values?: undefined;
119
+ } | {
120
+ key: string;
121
+ item: string;
122
+ values: string;
123
+ register: "message";
124
+ })[];
106
125
  slotSizePolicy: "fill";
107
126
  surface: "own";
108
127
  runtimeSignals: {
@@ -130,6 +149,7 @@ export declare const PHI_CARD_WIDGET_DEFINITION: {
130
149
  headingLevel: "h3";
131
150
  textAlign: "start";
132
151
  badgeStyle: "none";
152
+ iconFramed: true;
133
153
  };
134
154
  creationConfig: {
135
155
  surface: {
@@ -156,6 +176,7 @@ export declare const PHI_CARD_WIDGET_DEFINITION: {
156
176
  headingLevel: "h3";
157
177
  textAlign: "start";
158
178
  badgeStyle: "none";
179
+ iconFramed: true;
159
180
  };
160
181
  fields: (({
161
182
  key: string;
@@ -169,6 +190,7 @@ export declare const PHI_CARD_WIDGET_DEFINITION: {
169
190
  type: "string" | "url" | "icon";
170
191
  emptyValue?: "";
171
192
  placeholder?: string;
193
+ text?: false | "label" | "message";
172
194
  }) | ({
173
195
  key: string;
174
196
  label: string;