@phis/ui 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/components/controls/phi-cascader-control.d.ts +9 -1
  2. package/components/controls/phi-cascader-control.js +25 -3
  3. package/components/controls/phi-money-control.d.ts +39 -0
  4. package/components/controls/phi-money-control.js +34 -0
  5. package/components/controls/phi-number-control.d.ts +6 -1
  6. package/components/controls/phi-number-control.js +3 -3
  7. package/components/controls/phi-options-provider.d.ts +7 -0
  8. package/components/controls/phi-options-provider.js +11 -0
  9. package/components/forms/extended-form-field-controls.d.ts +1 -0
  10. package/components/forms/extended-form-field-controls.js +23 -1
  11. package/components/forms/form-descriptor-runtime-client.js +13 -0
  12. package/components/forms/form-provider-contract.d.ts +43 -0
  13. package/components/forms/form-provider-contract.js +40 -0
  14. package/components/forms/money-field.d.ts +27 -0
  15. package/components/forms/money-field.js +78 -0
  16. package/components/forms/shared-form-provider-registry.js +4 -0
  17. package/components/media/phi-media-picker-binding.js +6 -1
  18. package/components/media/phi-site-font-assets.js +6 -1
  19. package/components/motion/phi-sequence-run.d.ts +14 -1
  20. package/components/motion/phi-sequence-run.js +22 -3
  21. package/components/motion/phi-sequence-viewport.js +3 -1
  22. package/components/regions/presets/content-entry-editor-page-tree.js +3 -1
  23. package/components/tables/client/phi-table-binding.js +16 -3
  24. package/components/trees/client/phi-tree-binding.js +6 -2
  25. package/components/widgets/client/shared/phi-collection-view-binding.js +10 -2
  26. package/components/widgets/client/shared/phi-rendered-value.d.ts +9 -1
  27. package/components/widgets/client/shared/phi-rendered-value.js +20 -1
  28. package/components/widgets/config/choice-shared.d.ts +2 -2
  29. package/components/widgets/label-sets/gallery.js +6 -0
  30. package/components/widgets/label-sets/interval.d.ts +4 -0
  31. package/components/widgets/label-sets/interval.js +31 -0
  32. package/components/widgets/label-sets/record.js +6 -1
  33. package/components/widgets/label-sets/slot-upload.d.ts +4 -0
  34. package/components/widgets/label-sets/slot-upload.js +36 -0
  35. package/components/widgets/label-sets/table.js +6 -1
  36. package/components/widgets/label-types/gallery.d.ts +7 -0
  37. package/components/widgets/label-types/gallery.js +6 -0
  38. package/components/widgets/label-types/interval.d.ts +16 -0
  39. package/components/widgets/label-types/interval.js +21 -0
  40. package/components/widgets/label-types/record.d.ts +3 -0
  41. package/components/widgets/label-types/record.js +2 -0
  42. package/components/widgets/label-types/slot-upload.d.ts +24 -0
  43. package/components/widgets/label-types/slot-upload.js +16 -0
  44. package/components/widgets/label-types/table.d.ts +3 -0
  45. package/components/widgets/label-types/table.js +2 -0
  46. package/constants/record-field-kinds.d.ts +1 -1
  47. package/constants/record-field-kinds.js +1 -1
  48. package/constants/runtime-module-ownership.js +1 -0
  49. package/controls.d.ts +7 -0
  50. package/controls.js +4 -0
  51. package/helpers/cms-dialog.d.ts +39 -3
  52. package/helpers/cms-dialog.js +46 -4
  53. package/helpers/cms-page-catalog.d.ts +8 -0
  54. package/helpers/cms-page-catalog.js +18 -2
  55. package/helpers/cms-preset-nodes.d.ts +13 -3
  56. package/helpers/cms-preset-nodes.js +3 -2
  57. package/helpers/money-amount.d.ts +48 -0
  58. package/helpers/money-amount.js +131 -0
  59. package/helpers/page-layout-check.js +15 -2
  60. package/helpers/record-fields.d.ts +18 -5
  61. package/helpers/record-fields.js +38 -13
  62. package/module-records.d.ts +6 -3
  63. package/module-records.js +4 -2
  64. package/package.json +2 -2
  65. package/plugins/runtime-modules/accounting/module.d.ts +1 -1
  66. package/plugins/runtime-modules/app/module.d.ts +1 -1
  67. package/plugins/runtime-modules/asset/services/collection.js +1 -0
  68. package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +2 -2
  69. package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +3 -0
  70. package/plugins/runtime-modules/builder/offered-page-catalog.js +3 -3
  71. package/plugins/runtime-modules/builder/options-providers.js +7 -0
  72. package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +6 -3
  73. package/plugins/runtime-modules/contracts.d.ts +1 -1
  74. package/plugins/runtime-modules/core/definition.d.ts +43 -0
  75. package/plugins/runtime-modules/core/form-providers.d.ts +43 -0
  76. package/plugins/runtime-modules/core/widgets/breadcrumb/client.d.ts +6 -3
  77. package/plugins/runtime-modules/core/widgets/breadcrumb/client.js +6 -5
  78. package/plugins/runtime-modules/core/widgets/breadcrumb/plugin.js +1 -1
  79. package/plugins/runtime-modules/core/widgets/breadcrumb/server.d.ts +9 -1
  80. package/plugins/runtime-modules/core/widgets/breadcrumb/server.js +29 -3
  81. package/plugins/runtime-modules/core/widgets/card/config.d.ts +1 -1
  82. package/plugins/runtime-modules/core/widgets/cascader/authoring.d.ts +3 -3
  83. package/plugins/runtime-modules/core/widgets/cascader/client.js +1 -1
  84. package/plugins/runtime-modules/core/widgets/cascader/config.d.ts +8 -2
  85. package/plugins/runtime-modules/core/widgets/cascader/config.js +22 -0
  86. package/plugins/runtime-modules/core/widgets/checkbox-group/config.d.ts +1 -1
  87. package/plugins/runtime-modules/core/widgets/description/config.d.ts +1 -1
  88. package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +1 -1
  89. package/plugins/runtime-modules/core/widgets/gallery/authoring.js +12 -3
  90. package/plugins/runtime-modules/core/widgets/gallery/client.js +10 -1
  91. package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +3 -1
  92. package/plugins/runtime-modules/core/widgets/gallery/config.js +8 -0
  93. package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +1 -1
  94. package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +1 -1
  95. package/plugins/runtime-modules/core/widgets/multi-select/config.d.ts +1 -1
  96. package/plugins/runtime-modules/core/widgets/record/client.js +8 -2
  97. package/plugins/runtime-modules/core/widgets/record/config.js +4 -0
  98. package/plugins/runtime-modules/core/widgets/result/config.d.ts +1 -1
  99. package/plugins/runtime-modules/core/widgets/segmented/config.d.ts +1 -1
  100. package/plugins/runtime-modules/core/widgets/select-box/config.d.ts +1 -1
  101. package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -1
  102. package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +1 -1
  103. package/plugins/runtime-modules/core/widgets/slot-upload/authoring.js +2 -1
  104. package/plugins/runtime-modules/core/widgets/slot-upload/client.d.ts +3 -1
  105. package/plugins/runtime-modules/core/widgets/slot-upload/client.js +45 -24
  106. package/plugins/runtime-modules/core/widgets/slot-upload/config.d.ts +12 -4
  107. package/plugins/runtime-modules/core/widgets/slot-upload/config.js +18 -1
  108. package/plugins/runtime-modules/core/widgets/slot-upload/plugin.js +4 -2
  109. package/plugins/runtime-modules/core/widgets/slot-upload/server.d.ts +9 -3
  110. package/plugins/runtime-modules/core/widgets/slot-upload/server.js +17 -3
  111. package/plugins/runtime-modules/core/widgets/steps/config.d.ts +1 -1
  112. package/plugins/runtime-modules/core/widgets/table/client.js +4 -4
  113. package/plugins/runtime-modules/core/widgets/table/config.d.ts +3 -3
  114. package/plugins/runtime-modules/core/widgets/table/config.js +3 -0
  115. package/plugins/runtime-modules/descriptor-compiler.d.ts +11 -1
  116. package/plugins/runtime-modules/descriptor-compiler.js +49 -8
  117. package/plugins/runtime-modules/groups/definition.d.ts +1 -1
  118. package/plugins/runtime-modules/groups/forms.d.ts +18 -0
  119. package/plugins/runtime-modules/groups/forms.js +2 -2
  120. package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +6 -4
  121. package/plugins/runtime-modules/public/module.d.ts +1 -1
  122. package/plugins/runtime-modules/resolver.js +5 -0
  123. package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +2 -2
  124. package/plugins/runtime-modules/threads/trees/phi-default-threads-page-tree.js +4 -2
  125. package/plugins/runtime-modules/user-management/controller/client.js +6 -1
  126. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +3 -3
  127. package/runtime-render-client.d.ts +1 -1
  128. package/runtime-render-client.js +2 -1
  129. package/server-helpers/cms-page-record.d.ts +2 -2
  130. package/server-helpers/cms-page-record.js +15 -5
  131. package/server-helpers/record-fields.d.ts +1 -1
  132. package/server-helpers/record-fields.js +1 -2
  133. package/server-helpers/record-samples.d.ts +4 -4
  134. package/server-helpers/record-samples.js +10 -2
  135. package/types/cms-module-descriptors.d.ts +3 -0
  136. package/types/cms-plugins.d.ts +8 -0
  137. package/types/collection-provider.d.ts +7 -0
  138. package/types/core-widget-placements.d.ts +32 -0
  139. package/types/record-provider.d.ts +19 -3
  140. package/types/table-widget.d.ts +33 -1
  141. package/types/table-widget.js +1 -0
  142. package/types/tree-widget.d.ts +7 -0
  143. package/types/widget-runtime.d.ts +1 -1
  144. package/types.d.ts +1 -0
@@ -0,0 +1,24 @@
1
+ /**
2
+ * What the slot upload field says. The refusals of the upload it runs are not here: they are the shared
3
+ * reading of `PHI_MEDIA_UPLOAD_DEFAULT_LABELS`, the same as on every other Media upload surface.
4
+ */
5
+ export type PhiSlotUploadWidgetLabels = {
6
+ /** The field names no Add-on, table or slot, so there is nowhere to put a file. */
7
+ unconfigured: string;
8
+ /** No row has arrived yet, so there is nothing to upload to. */
9
+ noRow: string;
10
+ choose: string;
11
+ empty: string;
12
+ remove: string;
13
+ /** A file of the slot, `%1` its content type and `%2` its size in bytes. */
14
+ fileTitle: string;
15
+ /** `%1` is the slot name the field was configured with. */
16
+ slotMissing: string;
17
+ /** `%1` is the HTTP status the server answered with. */
18
+ serverAnswered: string;
19
+ unreachable: string;
20
+ removeFailed: string;
21
+ };
22
+ export declare const PHI_SLOT_UPLOAD_WIDGET_DEFAULT_LABELS: PhiSlotUploadWidgetLabels;
23
+ /** Fills `%1`, `%2`, ... of a slot upload template in order. */
24
+ export declare function formatPhiSlotUploadWidgetLabel(template: string, ...values: readonly (string | number)[]): string;
@@ -0,0 +1,16 @@
1
+ export const PHI_SLOT_UPLOAD_WIDGET_DEFAULT_LABELS = {
2
+ unconfigured: "This field names no Add-on, table or slot.",
3
+ noRow: "Nothing selected.",
4
+ choose: "Choose a file",
5
+ empty: "Nothing here yet.",
6
+ remove: "Remove this file",
7
+ fileTitle: "%1 — %2 bytes",
8
+ slotMissing: 'This table declares no slot named "%1".',
9
+ serverAnswered: "The server answered %1.",
10
+ unreachable: "Unreachable.",
11
+ removeFailed: "That file stayed.",
12
+ };
13
+ /** Fills `%1`, `%2`, ... of a slot upload template in order. */
14
+ export function formatPhiSlotUploadWidgetLabel(template, ...values) {
15
+ return values.reduce((text, value, index) => text.replace(`%${index + 1}`, String(value)), template);
16
+ }
@@ -1,3 +1,4 @@
1
+ import { type PhiIntervalLabels } from "./interval";
1
2
  export type PhiTableWidgetLabels = {
2
3
  search: string;
3
4
  reset: string;
@@ -17,6 +18,8 @@ export type PhiTableWidgetLabels = {
17
18
  dragRow: string;
18
19
  moveRowUp: string;
19
20
  moveRowDown: string;
21
+ /** The words of the `interval` renderer, from their own Label Set. */
22
+ interval: PhiIntervalLabels;
20
23
  };
21
24
  export declare const PHI_TABLE_WIDGET_DEFAULT_LABELS: PhiTableWidgetLabels;
22
25
  export declare function formatPhiTableWidgetLabel(template: string, value: string | number): string;
@@ -1,3 +1,4 @@
1
+ import { PHI_INTERVAL_DEFAULT_LABELS } from "./interval";
1
2
  export const PHI_TABLE_WIDGET_DEFAULT_LABELS = {
2
3
  search: "Search",
3
4
  reset: "Reset",
@@ -17,6 +18,7 @@ export const PHI_TABLE_WIDGET_DEFAULT_LABELS = {
17
18
  dragRow: "Drag row",
18
19
  moveRowUp: "Move row up",
19
20
  moveRowDown: "Move row down",
21
+ interval: PHI_INTERVAL_DEFAULT_LABELS,
20
22
  };
21
23
  export function formatPhiTableWidgetLabel(template, value) {
22
24
  return template.replace("%1", String(value));
@@ -2,5 +2,5 @@
2
2
  * The kinds a field of a record can be. Closed: a Widget says which of them it draws, and the Builder offers
3
3
  * only those. Here rather than beside the record types, so that reading the list at runtime does not load them.
4
4
  */
5
- export declare const PHI_RECORD_FIELD_KINDS: readonly ["text", "markdown", "picture", "pictures", "list", "tag", "date", "number", "link"];
5
+ export declare const PHI_RECORD_FIELD_KINDS: readonly ["text", "markdown", "picture", "pictures", "list", "tag", "date", "number", "money", "link"];
6
6
  export type PhiRecordFieldKind = (typeof PHI_RECORD_FIELD_KINDS)[number];
@@ -3,5 +3,5 @@
3
3
  * only those. Here rather than beside the record types, so that reading the list at runtime does not load them.
4
4
  */
5
5
  export const PHI_RECORD_FIELD_KINDS = [
6
- "text", "markdown", "picture", "pictures", "list", "tag", "date", "number", "link",
6
+ "text", "markdown", "picture", "pictures", "list", "tag", "date", "number", "money", "link",
7
7
  ];
@@ -47,6 +47,7 @@ const PHI_RUNTIME_MODULE_OWNERSHIP = {
47
47
  "form-field/email": ["core", "email"],
48
48
  "form-field/hidden": ["core", "hidden"],
49
49
  "form-field/honeypot": ["core", "honeypot"],
50
+ "form-field/money": ["core", "money"],
50
51
  "form-field/multi-select": ["core", "multi-select"],
51
52
  "form-field/number": ["core", "number"],
52
53
  "form-field/password": ["core", "password"],
package/controls.d.ts CHANGED
@@ -4,6 +4,13 @@ export type { PhiTextControlPresentation, PhiTextControlProps, } from "./compone
4
4
  export type { PhiTextInputType } from "./components/controls/phi-text-types";
5
5
  export { PHI_CONTROL_SIZES, PHI_FEEDBACK_LEVELS, readPhiControlSize, } from "./types/control";
6
6
  export type { PhiControlPresentationConfig, PhiControlSize, PhiFeedbackLevel, } from "./types/control";
7
+ export { PhiCompactGroupControl } from "./components/controls/phi-compact-group-control";
8
+ export type { PhiCompactGroupControlProps } from "./components/controls/phi-compact-group-control";
9
+ export { PhiViewportVisibilityControl } from "./components/controls/phi-viewport-visibility-control";
10
+ export { PhiEntryListControl } from "./components/controls/phi-entry-list-control";
11
+ export type { PhiEntryListControlProps, PhiEntryListEntry } from "./components/controls/phi-entry-list-control";
12
+ export { PhiPlacementMatrixControl } from "./components/controls/phi-placement-matrix-control";
13
+ export type { PhiPlacementMatrixControlProps } from "./components/controls/phi-placement-matrix-control";
7
14
  export { PhiNumberControl } from "./components/controls/phi-number-control";
8
15
  export type { PhiNumberControlProps } from "./components/controls/phi-number-control";
9
16
  export { PhiPopoverControl } from "./components/controls/phi-popover-control";
package/controls.js CHANGED
@@ -1,6 +1,10 @@
1
1
  export { PhiTextControl } from "./components/controls/phi-text-control";
2
2
  export { PhiLabeledControl } from "./components/controls/phi-labeled-control";
3
3
  export { PHI_CONTROL_SIZES, PHI_FEEDBACK_LEVELS, readPhiControlSize, } from "./types/control";
4
+ export { PhiCompactGroupControl } from "./components/controls/phi-compact-group-control";
5
+ export { PhiViewportVisibilityControl } from "./components/controls/phi-viewport-visibility-control";
6
+ export { PhiEntryListControl } from "./components/controls/phi-entry-list-control";
7
+ export { PhiPlacementMatrixControl } from "./components/controls/phi-placement-matrix-control";
4
8
  export { PhiNumberControl } from "./components/controls/phi-number-control";
5
9
  export { PhiPopoverControl } from "./components/controls/phi-popover-control";
6
10
  export { PHI_PICKER_PLACEMENTS } from "./components/controls/phi-picker-control-contract";
@@ -1,3 +1,4 @@
1
+ import { type PhiFormDescriptor } from "@phis/contracts/forms";
1
2
  /** The body Layout's config: a vertical Flex with the `panel` creation preset under it. */
2
3
  export declare const PHI_DIALOG_BODY_CONFIG: {
3
4
  readonly gap: "var(--phi-padding-sm)";
@@ -40,12 +41,47 @@ export declare const PHI_DIALOG_COMMANDS_CONFIG: {
40
41
  readonly controlSize: "medium";
41
42
  };
42
43
  /**
43
- * A dialog's width where it names none: the reading measure, which is also where a Form's own cap lies,
44
- * so a Form fills the dialog it opens in. A wider one -- a table, a preview -- says so, and takes its
45
- * width from the same sequence (`PHI_LAYOUT`).
44
+ * A dialog's width where it names none and its Form needs two columns: the reading measure, which is also
45
+ * where a Form's own cap lies, so a Form fills the dialog it opens in. A wider one -- a table, a preview
46
+ * -- says so, and takes its width from the same sequence (`PHI_LAYOUT`).
46
47
  */
47
48
  export declare const PHI_DIALOG_WIDTH: {
48
49
  readonly compact: "calc(100vw - 32px)";
49
50
  readonly medium: 610;
50
51
  readonly wide: 610;
51
52
  };
53
+ /**
54
+ * A dialog's width where its Form stands in one column.
55
+ *
56
+ * The reading measure is the room two columns need; one column in it is a strip of labels and a run of
57
+ * inputs far longer than anything typed into them. The narrow width is not `contentMaxNarrow` itself,
58
+ * though: that is where a Form turns `medium` and puts its labels beside the fields
59
+ * (`PHI_FORM_RESPONSIVE_MIN_WIDTH.medium`, the same 377), and the Form stands inside the body's inset.
60
+ * So it is that measure plus the inset on both sides -- the Theme's `base` step, whatever it is set to.
61
+ */
62
+ export declare const PHI_DIALOG_WIDTH_SINGLE_COLUMN: {
63
+ readonly compact: "calc(100vw - 32px)";
64
+ readonly medium: "calc(377px + 2 * var(--phi-padding))";
65
+ readonly wide: "calc(377px + 2 * var(--phi-padding))";
66
+ };
67
+ /**
68
+ * Whether a Form stands in one column wherever it can stand in two.
69
+ *
70
+ * Read off the descriptor at the two widths that put labels beside fields, `medium` and `wide`: a field
71
+ * whose label and control together leave part of the row free leaves room for a field beside it, and
72
+ * that is a Form of two columns -- whether a second field stands there or not, since the half was meant
73
+ * for one. A field takes the layout's label column into its extent even where it draws no label, as it
74
+ * does on the grid (`labelSlot` in `resolvePhiFormGridPlacement`), so a checkbox under the inputs is
75
+ * still a field of the one column. At `compact` every Form is one column, and it says nothing.
76
+ */
77
+ export declare function isPhiFormSingleColumn(descriptor: PhiFormDescriptor): boolean;
78
+ /** The width a dialog takes for the Form in its body: `PHI_DIALOG_WIDTH_SINGLE_COLUMN` or `PHI_DIALOG_WIDTH`. */
79
+ export declare function resolvePhiDialogFormWidth(descriptor: PhiFormDescriptor): {
80
+ readonly compact: "calc(100vw - 32px)";
81
+ readonly medium: 610;
82
+ readonly wide: 610;
83
+ } | {
84
+ readonly compact: "calc(100vw - 32px)";
85
+ readonly medium: "calc(377px + 2 * var(--phi-padding))";
86
+ readonly wide: "calc(377px + 2 * var(--phi-padding))";
87
+ };
@@ -1,3 +1,5 @@
1
+ import { PHI_FORM_GRID_LAST_LINE, resolvePhiFormLayout, } from "@phis/contracts/forms";
2
+ import { resolvePhiFormFieldExtent, resolvePhiFormFieldRanges } from "../components/forms/form-descriptor-contract";
1
3
  import { PHI_SPACE } from "../theme/antd-css-var-contract";
2
4
  import { PHI_SURFACE_WASH } from "./surface-presets";
3
5
  import { PHI_LAYOUT } from "../theme/phi-tokens";
@@ -17,7 +19,9 @@ import { PHI_LAYOUT } from "../theme/phi-tokens";
17
19
  * instead: the same ground, no inset, and its content draws no corner of its own either.
18
20
  * - The actions are one compact group, labelled, at the medium size: a dialog asks one question and its
19
21
  * answers belong together.
20
- * - The width is the reading measure of a form, full width less the gutter on a phone.
22
+ * - The width is as wide as its Form needs: the reading measure for a Form of two columns, the narrowest
23
+ * width that keeps a Form's labels beside its fields for one of one column, full width less the gutter
24
+ * on a phone either way. A table or an editor states a wider one.
21
25
  */
22
26
  /** The body Layout's config: a vertical Flex with the `panel` creation preset under it. */
23
27
  export const PHI_DIALOG_BODY_CONFIG = {
@@ -39,12 +43,50 @@ export const PHI_DIALOG_COMMANDS_CONFIG = {
39
43
  controlSize: "medium",
40
44
  };
41
45
  /**
42
- * A dialog's width where it names none: the reading measure, which is also where a Form's own cap lies,
43
- * so a Form fills the dialog it opens in. A wider one -- a table, a preview -- says so, and takes its
44
- * width from the same sequence (`PHI_LAYOUT`).
46
+ * A dialog's width where it names none and its Form needs two columns: the reading measure, which is also
47
+ * where a Form's own cap lies, so a Form fills the dialog it opens in. A wider one -- a table, a preview
48
+ * -- says so, and takes its width from the same sequence (`PHI_LAYOUT`).
45
49
  */
46
50
  export const PHI_DIALOG_WIDTH = {
47
51
  compact: "calc(100vw - 32px)",
48
52
  medium: PHI_LAYOUT.contentMax,
49
53
  wide: PHI_LAYOUT.contentMax,
50
54
  };
55
+ /**
56
+ * A dialog's width where its Form stands in one column.
57
+ *
58
+ * The reading measure is the room two columns need; one column in it is a strip of labels and a run of
59
+ * inputs far longer than anything typed into them. The narrow width is not `contentMaxNarrow` itself,
60
+ * though: that is where a Form turns `medium` and puts its labels beside the fields
61
+ * (`PHI_FORM_RESPONSIVE_MIN_WIDTH.medium`, the same 377), and the Form stands inside the body's inset.
62
+ * So it is that measure plus the inset on both sides -- the Theme's `base` step, whatever it is set to.
63
+ */
64
+ export const PHI_DIALOG_WIDTH_SINGLE_COLUMN = {
65
+ compact: PHI_DIALOG_WIDTH.compact,
66
+ medium: `calc(${PHI_LAYOUT.contentMaxNarrow}px + 2 * ${PHI_DIALOG_BODY_CONFIG.padding})`,
67
+ wide: `calc(${PHI_LAYOUT.contentMaxNarrow}px + 2 * ${PHI_DIALOG_BODY_CONFIG.padding})`,
68
+ };
69
+ /** The widths at which a Form's labels stand beside its fields, and so the ones that have columns. */
70
+ const PHI_DIALOG_FORM_COLUMN_MODES = ["medium", "wide"];
71
+ /**
72
+ * Whether a Form stands in one column wherever it can stand in two.
73
+ *
74
+ * Read off the descriptor at the two widths that put labels beside fields, `medium` and `wide`: a field
75
+ * whose label and control together leave part of the row free leaves room for a field beside it, and
76
+ * that is a Form of two columns -- whether a second field stands there or not, since the half was meant
77
+ * for one. A field takes the layout's label column into its extent even where it draws no label, as it
78
+ * does on the grid (`labelSlot` in `resolvePhiFormGridPlacement`), so a checkbox under the inputs is
79
+ * still a field of the one column. At `compact` every Form is one column, and it says nothing.
80
+ */
81
+ export function isPhiFormSingleColumn(descriptor) {
82
+ const layout = resolvePhiFormLayout(descriptor.layout);
83
+ return descriptor.fields.every((field) => PHI_DIALOG_FORM_COLUMN_MODES.every((mode) => {
84
+ const ranges = resolvePhiFormFieldRanges(layout, field.placement, mode, `fields.${field.key}`);
85
+ const extent = resolvePhiFormFieldExtent(ranges.label, ranges.control);
86
+ return extent.start === 1 && extent.end === PHI_FORM_GRID_LAST_LINE;
87
+ }));
88
+ }
89
+ /** The width a dialog takes for the Form in its body: `PHI_DIALOG_WIDTH_SINGLE_COLUMN` or `PHI_DIALOG_WIDTH`. */
90
+ export function resolvePhiDialogFormWidth(descriptor) {
91
+ return isPhiFormSingleColumn(descriptor) ? PHI_DIALOG_WIDTH_SINGLE_COLUMN : PHI_DIALOG_WIDTH;
92
+ }
@@ -51,6 +51,14 @@ export type PhiBuilderModulePresetPagesByArea = Record<PhiBuilderPageCatalogArea
51
51
  export declare function createEmptyPhiBuilderModulePresetPagesByArea(): PhiBuilderModulePresetPagesByArea;
52
52
  export type PhiBuilderPageCatalogArea = PhiBuilderAreaKey;
53
53
  export declare function findPhiPageNodePath(pages: PhiPresetPageNode[], targetKey: string, prefix?: PhiPresetPageNode[]): PhiPresetPageNode[] | null;
54
+ /**
55
+ * The Page a requested key stands for, or `null` where the catalog knows no such key.
56
+ *
57
+ * A folder is no Page: `/shop/p/:slug` made the folders `shop` and `p`, and a workspace opened on one drew
58
+ * a Page with empty Regions. A folder's key -- from the picker of old, or an address somebody kept -- stands
59
+ * for the first Page inside it.
60
+ */
61
+ export declare function resolvePhiBuilderRequestedPageKey(requestedPageKey: string | null | undefined, pages: readonly PhiPresetPageNode[]): string | null;
54
62
  export declare function resolvePhiBuilderActivePageKey(requestedPageKey: string | null | undefined, pages: readonly PhiPresetPageNode[]): string | null;
55
63
  export declare function resolvePhiBuilderPagePresetSource(pageKey: string, pages: readonly PhiPresetPageNode[]): PhiCmsPresetSource | null;
56
64
  export declare function resolvePhiBuilderPageDefaultFlags(pageKey: string, pages: readonly PhiPresetPageNode[]): number;
@@ -100,10 +100,26 @@ function findFirstPhiBuilderPageNodeKey(pages) {
100
100
  }
101
101
  return null;
102
102
  }
103
- export function resolvePhiBuilderActivePageKey(requestedPageKey, pages) {
103
+ /**
104
+ * The Page a requested key stands for, or `null` where the catalog knows no such key.
105
+ *
106
+ * A folder is no Page: `/shop/p/:slug` made the folders `shop` and `p`, and a workspace opened on one drew
107
+ * a Page with empty Regions. A folder's key -- from the picker of old, or an address somebody kept -- stands
108
+ * for the first Page inside it.
109
+ */
110
+ export function resolvePhiBuilderRequestedPageKey(requestedPageKey, pages) {
104
111
  const normalizedPageKey = requestedPageKey?.trim() ?? "";
105
- if (normalizedPageKey && readPhiPageNodePath(pages, normalizedPageKey)) {
112
+ const requested = normalizedPageKey ? readPhiPageNodePath(pages, normalizedPageKey)?.at(-1) : null;
113
+ if (!requested)
114
+ return null;
115
+ if (requested.storagePath)
106
116
  return normalizedPageKey;
117
+ return requested.children ? findFirstPhiBuilderPageNodeKey(requested.children) : null;
118
+ }
119
+ export function resolvePhiBuilderActivePageKey(requestedPageKey, pages) {
120
+ const requested = resolvePhiBuilderRequestedPageKey(requestedPageKey, pages);
121
+ if (requested) {
122
+ return requested;
107
123
  }
108
124
  /*
109
125
  * Not `pages[0]`: since a Module's routes live under its package, the first root node is the folder
@@ -1,3 +1,4 @@
1
+ import type { PhiFormDescriptor } from "@phis/contracts/forms";
1
2
  import { buildPhiCmsLayoutNode, type PhiCmsWidgetNodeFactoryCommon, type PhiCmsWidgetPlacementFields } from "./cms-node-factories";
2
3
  import type { PhiCommandToolbarWidgetPlacement } from "../types/core-widget-placements";
3
4
  import type { PhiCmsContentWidgetNode, PhiCmsLayoutNode, PhiCmsOverlayNode, PhiCmsPageNode, PhiCmsRegionNode } from "../types/cms";
@@ -65,20 +66,29 @@ export type PhiCmsPresetOverlayInput = {
65
66
  *
66
67
  * What it decides is what differs between dialogs: its ids, its title and wiring, what extra the body
67
68
  * Layout carries (a form's label column, say), and its buttons. How the body and the actions look is the
68
- * one answer every dialog shares (`helpers/cms-dialog.ts`), so it is not an input.
69
+ * one answer every dialog shares (`helpers/cms-dialog.ts`), so it is not an input. Nor is the width, as
70
+ * long as the dialog can see the Form it holds: given `body.form`, it takes the width that Form needs
71
+ * (`resolvePhiDialogFormWidth`); given none, `PHI_DIALOG_WIDTH`. A width in `config` is the caller's
72
+ * own, for a table or an editor that needs more.
69
73
  */
70
74
  export type PhiCmsPresetDialogInput = {
71
75
  id: PhiCmsInstanceId;
72
76
  bodyLayoutNodeId: PhiCmsInstanceId;
73
77
  sortOrder: number;
74
78
  label: string | null;
75
- /** The Overlay's config: title, mount and close policy, open action, routes. `width` defaults. */
79
+ /** The Overlay's config: title, mount and close policy, open action, routes. `width` follows `body.form`. */
76
80
  config: Record<string, unknown>;
77
81
  headerLayoutNodeId?: PhiCmsInstanceId | null;
78
- /** Config the body Layout carries besides the dialog's own: anything but its gap, padding and ground. */
82
+ /**
83
+ * The body Layout: its label, the config it carries besides the dialog's own (anything but its gap,
84
+ * padding and ground), and the Form the Preset places in it, which the dialog takes its width from.
85
+ */
79
86
  body?: {
80
87
  label?: string;
81
88
  config?: Record<string, unknown>;
89
+ form?: {
90
+ descriptor: PhiFormDescriptor;
91
+ };
82
92
  };
83
93
  /** The actions, where the dialog has any. */
84
94
  commands?: {
@@ -1,6 +1,6 @@
1
1
  import { buildPhiCmsLayoutNode, buildPhiCmsWidgetNode, } from "./cms-node-factories";
2
2
  import { PhiCmsStatus } from "../constants/phi-cms";
3
- import { PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG, PHI_DIALOG_WIDTH } from "./cms-dialog";
3
+ import { PHI_DIALOG_BODY_CONFIG, PHI_DIALOG_COMMANDS_CONFIG, PHI_DIALOG_WIDTH, resolvePhiDialogFormWidth, } from "./cms-dialog";
4
4
  export function createPhiCmsPresetNodes(defaults) {
5
5
  const nodes = createPhiCmsPresetNodeSet(defaults);
6
6
  return "pageType" in defaults ? createPhiCmsPresetPageNodeSet(defaults, nodes) : nodes;
@@ -81,7 +81,8 @@ function createPhiCmsPresetNodeSet(defaults) {
81
81
  creationPreset: { layoutKind: "verticalflex", preset: "panel" },
82
82
  config: { ...input.body?.config, ...PHI_DIALOG_BODY_CONFIG },
83
83
  });
84
- const config = { width: PHI_DIALOG_WIDTH, ...input.config };
84
+ const form = input.body?.form;
85
+ const config = { width: form ? resolvePhiDialogFormWidth(form.descriptor) : PHI_DIALOG_WIDTH, ...input.config };
85
86
  const commands = input.commands;
86
87
  if (!commands) {
87
88
  return {
@@ -0,0 +1,48 @@
1
+ import { type PhisPaymentMoney } from "@phis/contracts/payments";
2
+ /** The largest minor amount the contract carries. */
3
+ export declare const PHI_MINOR_AMOUNT_MAX = "9999999999999999";
4
+ /** The currency's exponent, or `undefined` for a code that is not an ISO 4217 currency a payment accepts. */
5
+ export declare function readPhiCurrencyExponent(currency: string): number | undefined;
6
+ export declare function isPhiMinorAmount(value: unknown): value is string;
7
+ /**
8
+ * A value a Provider handed over as an amount of money, or `null` where it is none: `{ currency, minor }`
9
+ * with a currency a payment accepts and `minor` as the contract writes it or as a safe non-negative
10
+ * integer, which is how a row out of JSON often carries it. The answer is always the contract's shape.
11
+ */
12
+ export declare function readPhiMoneyValue(value: unknown): PhisPaymentMoney | null;
13
+ /** `-1`, `0` or `1` as `left` is less than, equal to or more than `right`; both minor amounts. */
14
+ export declare function comparePhiMinorAmounts(left: string, right: string): number;
15
+ /**
16
+ * A major amount written with a point (`"19.9"`, `"19."`, `".5"`) as the minor amount it states, or
17
+ * `null` where it states none or one the contract cannot carry.
18
+ *
19
+ * A fraction longer than the currency has is rounded half up on its digits, the way the Control rounds
20
+ * it when the field is left: `"12.345"` francs are `"1235"` Rappen.
21
+ */
22
+ export declare function phiMajorToMinorAmount(major: string, exponent: number): string | null;
23
+ /**
24
+ * A major amount (`"1234.5"`) written the way the locale writes it, with as many places as the currency
25
+ * has: `1’234.50` in de-CH, `1.234,50` in de-DE, `1,234.50` in en.
26
+ *
27
+ * The whole part is formatted as a `bigint`, so no digit passes through a float; the fraction is the
28
+ * amount's own digits behind the locale's separator. What is not a major amount is returned as it came.
29
+ */
30
+ export declare function formatPhiMajorAmount(major: string, locale: string, exponent: number): string;
31
+ /**
32
+ * What somebody typed, in the locale's way of writing numbers, as a major amount with a point.
33
+ *
34
+ * Group separators and spaces are dropped. The decimal separator is the locale's, and the point or the
35
+ * comma is read as one too wherever the locale does not group with it: somebody in fr-CH who types
36
+ * `12.50` means twelve and a half, while in de-DE `1.250` is one thousand two hundred and fifty, as it
37
+ * would be written there. The result may still not be a number -- `"1.2.3"` -- and the Control then
38
+ * keeps the last amount it could read.
39
+ */
40
+ export declare function parsePhiLocaleAmount(text: string, locale: string): string;
41
+ /**
42
+ * Where the currency stands beside the number in the locale, and as what: its ISO code, which no
43
+ * reader confuses with another currency's the way `$` is confused, and which nobody translates.
44
+ */
45
+ export declare function resolvePhiCurrencyAffix(locale: string, currency: string): {
46
+ placement: "prefix" | "suffix";
47
+ text: string;
48
+ };
@@ -0,0 +1,131 @@
1
+ import { PHIS_PAYMENT_CURRENCY_EXPONENTS, phisMinorToMajorAmount } from "@phis/contracts/payments";
2
+ /*
3
+ * An amount of money as the contract keeps it and as a person reads it.
4
+ *
5
+ * The contract keeps minor units as a canonical integer string (`PhisPaymentMoney.minor`: `"1990"` for
6
+ * 19.90 francs), and a person reads major units written the way their language writes numbers. Between
7
+ * the two lies a power of ten that is the currency's (`PHIS_PAYMENT_CURRENCY_EXPONENTS`: two for the
8
+ * franc, none for the yen, three for the dinar) -- never a fixed hundred.
9
+ *
10
+ * Every conversion here is done on the digits. `12.35 * 100` is `1234.9999999999998` in a float, and a
11
+ * price rounded down by one Rappen on every save is not a rounding error anybody notices until the
12
+ * books do not add up. So a major amount is split at its point, the fraction padded to the exponent,
13
+ * and the digits joined; nothing is multiplied. The way back, and showing an amount as money, are the
14
+ * contract's (`phisMinorToMajorAmount`, `formatPhisMoney` in `@phis/contracts/payments`), so that a
15
+ * Table, a record and a shop write the same amount the same way.
16
+ */
17
+ /** A minor amount as phis-server accepts one (`requirePhisPaymentMinor`): no sign, no leading zero, 16 digits at most. */
18
+ const PHI_MINOR_AMOUNT_PATTERN = /^(0|[1-9][0-9]{0,15})$/u;
19
+ /** The largest minor amount the contract carries. */
20
+ export const PHI_MINOR_AMOUNT_MAX = "9999999999999999";
21
+ const PHI_MAJOR_AMOUNT_PATTERN = /^([0-9]*)(?:\.([0-9]*))?$/u;
22
+ /** The currency's exponent, or `undefined` for a code that is not an ISO 4217 currency a payment accepts. */
23
+ export function readPhiCurrencyExponent(currency) {
24
+ return Object.hasOwn(PHIS_PAYMENT_CURRENCY_EXPONENTS, currency) ? PHIS_PAYMENT_CURRENCY_EXPONENTS[currency] : undefined;
25
+ }
26
+ export function isPhiMinorAmount(value) {
27
+ return typeof value === "string" && PHI_MINOR_AMOUNT_PATTERN.test(value);
28
+ }
29
+ /**
30
+ * A value a Provider handed over as an amount of money, or `null` where it is none: `{ currency, minor }`
31
+ * with a currency a payment accepts and `minor` as the contract writes it or as a safe non-negative
32
+ * integer, which is how a row out of JSON often carries it. The answer is always the contract's shape.
33
+ */
34
+ export function readPhiMoneyValue(value) {
35
+ if (typeof value !== "object" || value === null || Array.isArray(value))
36
+ return null;
37
+ const { currency, minor } = value;
38
+ if (typeof currency !== "string" || readPhiCurrencyExponent(currency) === undefined)
39
+ return null;
40
+ const text = typeof minor === "number" && Number.isSafeInteger(minor) && minor >= 0 ? String(minor) : minor;
41
+ return isPhiMinorAmount(text) ? { currency, minor: text } : null;
42
+ }
43
+ /** `-1`, `0` or `1` as `left` is less than, equal to or more than `right`; both minor amounts. */
44
+ export function comparePhiMinorAmounts(left, right) {
45
+ const difference = BigInt(left) - BigInt(right);
46
+ return difference < 0n ? -1 : difference > 0n ? 1 : 0;
47
+ }
48
+ /**
49
+ * A major amount written with a point (`"19.9"`, `"19."`, `".5"`) as the minor amount it states, or
50
+ * `null` where it states none or one the contract cannot carry.
51
+ *
52
+ * A fraction longer than the currency has is rounded half up on its digits, the way the Control rounds
53
+ * it when the field is left: `"12.345"` francs are `"1235"` Rappen.
54
+ */
55
+ export function phiMajorToMinorAmount(major, exponent) {
56
+ const match = PHI_MAJOR_AMOUNT_PATTERN.exec(major.trim());
57
+ if (!match)
58
+ return null;
59
+ const whole = match[1] ?? "";
60
+ const fraction = match[2] ?? "";
61
+ if (whole === "" && fraction === "")
62
+ return null;
63
+ const kept = fraction.slice(0, exponent).padEnd(exponent, "0");
64
+ const roundsUp = fraction.length > exponent && fraction.charCodeAt(exponent) >= "5".charCodeAt(0);
65
+ const minor = (BigInt(`${whole}${kept}` || "0") + (roundsUp ? 1n : 0n)).toString();
66
+ return PHI_MINOR_AMOUNT_PATTERN.test(minor) ? minor : null;
67
+ }
68
+ const symbolsByLocale = new Map();
69
+ /** The locale's decimal and group separators, in Latin digits so that what is typed can be read back. */
70
+ function readPhiAmountSymbols(locale) {
71
+ const cached = symbolsByLocale.get(locale);
72
+ if (cached)
73
+ return cached;
74
+ const parts = new Intl.NumberFormat(locale, { numberingSystem: "latn" }).formatToParts(1234567.5);
75
+ const symbols = {
76
+ decimal: parts.find((part) => part.type === "decimal")?.value ?? ".",
77
+ group: parts.find((part) => part.type === "group")?.value ?? "",
78
+ };
79
+ symbolsByLocale.set(locale, symbols);
80
+ return symbols;
81
+ }
82
+ /**
83
+ * A major amount (`"1234.5"`) written the way the locale writes it, with as many places as the currency
84
+ * has: `1’234.50` in de-CH, `1.234,50` in de-DE, `1,234.50` in en.
85
+ *
86
+ * The whole part is formatted as a `bigint`, so no digit passes through a float; the fraction is the
87
+ * amount's own digits behind the locale's separator. What is not a major amount is returned as it came.
88
+ */
89
+ export function formatPhiMajorAmount(major, locale, exponent) {
90
+ const minor = phiMajorToMinorAmount(major, exponent);
91
+ if (minor === null)
92
+ return major;
93
+ const [whole = "0", fraction = ""] = phisMinorToMajorAmount(minor, exponent).split(".");
94
+ const formattedWhole = new Intl.NumberFormat(locale, { numberingSystem: "latn", maximumFractionDigits: 0 }).format(BigInt(whole));
95
+ return exponent === 0 ? formattedWhole : `${formattedWhole}${readPhiAmountSymbols(locale).decimal}${fraction}`;
96
+ }
97
+ /**
98
+ * What somebody typed, in the locale's way of writing numbers, as a major amount with a point.
99
+ *
100
+ * Group separators and spaces are dropped. The decimal separator is the locale's, and the point or the
101
+ * comma is read as one too wherever the locale does not group with it: somebody in fr-CH who types
102
+ * `12.50` means twelve and a half, while in de-DE `1.250` is one thousand two hundred and fifty, as it
103
+ * would be written there. The result may still not be a number -- `"1.2.3"` -- and the Control then
104
+ * keeps the last amount it could read.
105
+ */
106
+ export function parsePhiLocaleAmount(text, locale) {
107
+ const { decimal, group } = readPhiAmountSymbols(locale);
108
+ let result = "";
109
+ for (const character of text) {
110
+ if (character >= "0" && character <= "9") {
111
+ result += character;
112
+ }
113
+ else if (character === decimal || ((character === "." || character === ",") && character !== group)) {
114
+ result += ".";
115
+ }
116
+ }
117
+ return result;
118
+ }
119
+ /**
120
+ * Where the currency stands beside the number in the locale, and as what: its ISO code, which no
121
+ * reader confuses with another currency's the way `$` is confused, and which nobody translates.
122
+ */
123
+ export function resolvePhiCurrencyAffix(locale, currency) {
124
+ const parts = new Intl.NumberFormat(locale, { style: "currency", currency, currencyDisplay: "code" }).formatToParts(1);
125
+ const currencyIndex = parts.findIndex((part) => part.type === "currency");
126
+ const numberIndex = parts.findIndex((part) => part.type === "integer");
127
+ return {
128
+ placement: currencyIndex !== -1 && numberIndex !== -1 && currencyIndex > numberIndex ? "suffix" : "prefix",
129
+ text: parts[currencyIndex]?.value.trim() || currency,
130
+ };
131
+ }
@@ -1,5 +1,5 @@
1
1
  import { PhiCmsRegionType } from "../constants/phi-cms";
2
- import { PHI_SPACE } from "../theme/antd-css-var-contract";
2
+ import { PHI_PAGE, PHI_SPACE } from "../theme/antd-css-var-contract";
3
3
  import { parsePhiCmsCarouselLayoutConfig, parsePhiCmsCollapsibleLayoutConfig, parsePhiCmsContentLayoutConfig, parsePhiCmsFlexLayoutConfig, parsePhiCmsFlexVerticalLayoutConfig, parsePhiCmsGridLayoutConfig, parsePhiCmsMasonryLayoutConfig, parsePhiCmsSplitCardLayoutConfig, parsePhiCmsStackLayoutConfig, parsePhiCmsThreeColumnLayoutConfig, } from "../types/cms-config";
4
4
  import { readPhiSurface } from "../types/surface";
5
5
  const SPACING_KEYS = ["padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "gap"];
@@ -22,9 +22,16 @@ const LAYOUT_CONFIG_PARSERS = {
22
22
  "three-column": parsePhiCmsThreeColumnLayoutConfig,
23
23
  "split-card": parsePhiCmsSplitCardLayoutConfig,
24
24
  };
25
+ /*
26
+ * The Theme's Page inset (`PHI_PAGE.padding`, THEME.md "Page padding") is a step of the spacing scale per
27
+ * side and screen, chosen by the Theme: a distance like any other, at the preset level.
28
+ */
29
+ const PAGE_INSET_REFERENCES = new Set(Object.values(PHI_PAGE.padding));
25
30
  function stepOf(value) {
26
31
  if (value === 0 || value === "0")
27
32
  return "none";
33
+ if (PAGE_INSET_REFERENCES.has(value))
34
+ return "page";
28
35
  for (const [step, reference] of Object.entries(PHI_SPACE)) {
29
36
  if (value === reference)
30
37
  return step;
@@ -78,6 +85,12 @@ export function checkPhiPagePresetLayout(tree) {
78
85
  // A band under the Header keeps its sides on the small step without a Surface; nothing above or below.
79
86
  const headerBottomRootId = tree.regions
80
87
  .find((region) => region.regionType === PhiCmsRegionType.HeaderBottom)?.rootLayoutNodeId;
88
+ /*
89
+ * An Overlay's footer is the dialog's action row, built by `dialog` on `createPhiCmsPresetNodes` and held
90
+ * to its own contract by the descriptor compiler (OVERLAYS.md, "Structured dialogs"): its inset is the
91
+ * dialog's, not a Page Layout's, so the Surface rule below does not apply to it.
92
+ */
93
+ const overlayFooterIds = new Set(tree.overlays.flatMap((overlay) => overlay.footerLayoutNodeId == null ? [] : [overlay.footerLayoutNodeId]));
81
94
  for (const node of tree.layoutNodes) {
82
95
  const config = (node.config ?? {});
83
96
  const typeKey = typeKeyOf(node);
@@ -128,7 +141,7 @@ export function checkPhiPagePresetLayout(tree) {
128
141
  }
129
142
  continue;
130
143
  }
131
- if (!surface && typeKey !== "content") {
144
+ if (!surface && typeKey !== "content" && !overlayFooterIds.has(node.id)) {
132
145
  if (hasPadding(config)) {
133
146
  findings.push({
134
147
  node: nameOf(node),
@@ -1,9 +1,22 @@
1
- import type { PhiRecordField, PhiRecordFieldKind, PhiRecordFieldValueByKind } from "../types/record-provider";
1
+ import type { PhiRuntimeModuleCatalogEntry } from "../types/cms-plugins";
2
+ import type { PhiRuntimeDataProviderKey } from "../types/runtime-data-provider";
3
+ import type { PhiRecordDeclaration, PhiRecordField, PhiRecordFieldKind, PhiRecordFieldValueByKind } from "../types/record-provider";
2
4
  /** `value` as a field of `kind`, or `undefined` where it is not one. */
3
5
  export declare function readPhiRecordFieldValue<K extends PhiRecordFieldKind>(kind: K, value: unknown): PhiRecordFieldValueByKind[K] | undefined;
4
- /** The kinds a line of text can show: a text as it is, a number and a date in the page's language. */
5
- export declare const PHI_RECORD_TEXT_FIELD_KINDS: readonly ["text", "number", "date"];
6
- /** A text, number or date field as the words a page shows, written for `locale`. */
6
+ /**
7
+ * The kinds a line of text can show: a text as it is, a number, a date and an amount of money in the
8
+ * page's language.
9
+ */
10
+ export declare const PHI_RECORD_TEXT_FIELD_KINDS: readonly ["text", "number", "date", "money"];
11
+ /**
12
+ * A text, number, date or money field as the words a page shows, written for `locale`; a date on the
13
+ * calendar of the Site's `timeZone`, as every other date the page shows (`formatPhiDate`).
14
+ */
7
15
  export declare function formatPhiRecordFieldText(field: Extract<PhiRecordField, {
8
16
  kind: (typeof PHI_RECORD_TEXT_FIELD_KINDS)[number];
9
- }>, locale: string): string;
17
+ }>, locale: string, timeZone: string): string;
18
+ /**
19
+ * The declarations of the `record` Providers these Modules describe, by key: what a render's registry
20
+ * answers a record's fields from (`recordDeclarationsByKey`).
21
+ */
22
+ export declare function buildPhiRecordDeclarationsByKey(entries: readonly Pick<PhiRuntimeModuleCatalogEntry, "definition">[]): ReadonlyMap<PhiRuntimeDataProviderKey, PhiRecordDeclaration>;