@phis/ui 0.5.2 → 0.5.3

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 (182) hide show
  1. package/README.md +1 -1
  2. package/components/controls/phi-border-control.js +1 -1
  3. package/components/controls/phi-bound-radius-control.js +9 -9
  4. package/components/controls/phi-brand-control.js +1 -1
  5. package/components/controls/phi-drawer-control-adapter.js +4 -4
  6. package/components/controls/phi-dropdown-control.js +2 -2
  7. package/components/controls/phi-form-control.js +1 -1
  8. package/components/controls/phi-image-control.js +1 -1
  9. package/components/controls/phi-mask-picker-control.js +6 -6
  10. package/components/controls/phi-select-control.js +1 -1
  11. package/components/controls/phi-theme-scope-control.js +1 -1
  12. package/components/controls/use-phi-color-control-presets.js +2 -2
  13. package/components/forms/compound-form-controls.js +2 -2
  14. package/components/forms/extended-form-field-controls.js +1 -1
  15. package/components/forms/shared-form-provider-registry.js +2 -2
  16. package/components/layouts/clients/phi-flex-layout-client.js +4 -4
  17. package/components/layouts/clients/phi-grid-layout-client.js +3 -3
  18. package/components/layouts/clients/phi-sequence-slot-editor.js +1 -1
  19. package/components/layouts/layout-definitions.d.ts +4 -4
  20. package/components/layouts/phi-page-region-layout.js +1 -1
  21. package/components/layouts/phi-structure-region-layout.js +3 -3
  22. package/components/media/phi-asset-focal-rect-widget.js +4 -4
  23. package/components/media/phi-asset-inspector-section.js +1 -1
  24. package/components/media/phi-media-kind-icon.js +2 -2
  25. package/components/media/phi-media-restricted-icon.js +1 -1
  26. package/components/overlays/phi-overlay-container-client.js +1 -1
  27. package/components/regions/presets/phi-base-page-column.js +6 -2
  28. package/components/root/phi-config-provider.js +1 -1
  29. package/components/root/phi-root-background.js +1 -1
  30. package/components/root/phi-root-theme-resolver.js +1 -1
  31. package/components/shell/phi-module-icons.js +1 -1
  32. package/components/widgets/built-in/builder-workspace-preview.js +8 -8
  33. package/components/widgets/client/bullet-list-entries-editor.js +2 -2
  34. package/components/widgets/client/external-document-editor.js +1 -1
  35. package/components/widgets/client/html-editor.js +3 -3
  36. package/components/widgets/config/background.d.ts +1 -1
  37. package/components/widgets/config/background.js +1 -1
  38. package/components/widgets/inspector-field-row.js +1 -1
  39. package/components/widgets/label-sets/inspector.js +2 -0
  40. package/components/widgets/label-types/inspector.d.ts +1 -0
  41. package/components/widgets/label-types/inspector.js +1 -0
  42. package/components/widgets/shared/card-body-client.js +1 -1
  43. package/components/widgets/shared/result-body-client.js +1 -1
  44. package/constants/media-library-provider-keys.d.ts +8 -1
  45. package/constants/media-library-provider-keys.js +8 -1
  46. package/constants/record-field-kinds.d.ts +6 -0
  47. package/constants/record-field-kinds.js +7 -0
  48. package/constants/runtime-module-ownership.js +1 -1
  49. package/helpers/border-widget-style.d.ts +2 -2
  50. package/helpers/border-widget-style.js +2 -2
  51. package/helpers/cms-dialog.d.ts +4 -4
  52. package/helpers/cms-layout-defaults.d.ts +2 -2
  53. package/helpers/cms-page-catalog.d.ts +5 -0
  54. package/helpers/cms-preset-page-tree.d.ts +4 -0
  55. package/helpers/cms-preset-page-tree.js +2 -0
  56. package/helpers/layout-style.d.ts +2 -2
  57. package/helpers/page-layout-check.d.ts +4 -1
  58. package/helpers/page-layout-check.js +26 -0
  59. package/helpers/record-fields.d.ts +9 -0
  60. package/helpers/record-fields.js +84 -0
  61. package/helpers/surface-presets.d.ts +6 -6
  62. package/helpers/surface-style.d.ts +1 -1
  63. package/helpers.d.ts +0 -1
  64. package/helpers.js +0 -2
  65. package/module-page-check.d.ts +12 -0
  66. package/module-page-check.js +12 -0
  67. package/module-records.d.ts +4 -2
  68. package/module-records.js +3 -1
  69. package/next/antd-form-context-loader.mjs +31 -0
  70. package/next/config.d.mts +2 -0
  71. package/next/config.mjs +36 -3
  72. package/package.json +10 -1
  73. package/plugins/runtime-modules/asset/data-providers.d.ts +0 -65
  74. package/plugins/runtime-modules/asset/data-providers.js +0 -40
  75. package/plugins/runtime-modules/asset/definition.d.ts +0 -60
  76. package/plugins/runtime-modules/asset/ids.d.ts +0 -1
  77. package/plugins/runtime-modules/asset/ids.js +1 -2
  78. package/plugins/runtime-modules/asset/presets.d.ts +1 -0
  79. package/plugins/runtime-modules/asset/server.js +0 -5
  80. package/plugins/runtime-modules/blog/presets.d.ts +1 -0
  81. package/plugins/runtime-modules/builder/clients/inspector-config-field.d.ts +4 -1
  82. package/plugins/runtime-modules/builder/clients/inspector-config-field.js +13 -4
  83. package/plugins/runtime-modules/builder/clients/inspector-link-target-field.js +1 -1
  84. package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +14 -1
  85. package/plugins/runtime-modules/builder/clients/inspector-signal-section.js +2 -2
  86. package/plugins/runtime-modules/builder/clients/layout-inspector.js +1 -1
  87. package/plugins/runtime-modules/builder/clients/layout-scaffold-buttons.js +4 -4
  88. package/plugins/runtime-modules/builder/clients/layout-scaffold-overlays.js +1 -1
  89. package/plugins/runtime-modules/builder/clients/region-inspector.js +1 -1
  90. package/plugins/runtime-modules/builder/clients/region-visibility-fields.js +1 -1
  91. package/plugins/runtime-modules/builder/clients/shells-workspace.js +1 -1
  92. package/plugins/runtime-modules/builder/clients/structure-canvas.js +2 -2
  93. package/plugins/runtime-modules/builder/clients/widget-effects-editor.js +1 -1
  94. package/plugins/runtime-modules/builder/clients/widget-inspector.d.ts +4 -1
  95. package/plugins/runtime-modules/builder/clients/widget-inspector.js +3 -2
  96. package/plugins/runtime-modules/builder/page-presets.server.d.ts +6 -0
  97. package/plugins/runtime-modules/builder/page-presets.server.js +8 -0
  98. package/plugins/runtime-modules/builder/pages-workspace.js +12 -1
  99. package/plugins/runtime-modules/builder/render-root-node-scaffold.js +5 -5
  100. package/plugins/runtime-modules/builder/structure-dnd.js +2 -2
  101. package/plugins/runtime-modules/builder/widgets/test-block/client.js +1 -1
  102. package/plugins/runtime-modules/content-entry-routes.d.ts +1 -0
  103. package/plugins/runtime-modules/contracts.d.ts +1 -1
  104. package/plugins/runtime-modules/contracts.js +41 -1
  105. package/plugins/runtime-modules/core/data-providers.d.ts +60 -0
  106. package/plugins/runtime-modules/core/data-providers.js +41 -0
  107. package/plugins/runtime-modules/core/definition.d.ts +55 -0
  108. package/plugins/runtime-modules/core/server.js +5 -0
  109. package/plugins/runtime-modules/core/widgets/button/config.d.ts +34 -0
  110. package/plugins/runtime-modules/core/widgets/button/config.js +16 -0
  111. package/plugins/runtime-modules/core/widgets/button/plugin.js +37 -6
  112. package/plugins/runtime-modules/core/widgets/card/config.d.ts +13 -2
  113. package/plugins/runtime-modules/core/widgets/description/config.d.ts +13 -2
  114. package/plugins/runtime-modules/core/widgets/description/editor.js +13 -13
  115. package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +11 -0
  116. package/plugins/runtime-modules/core/widgets/gallery/client.d.ts +4 -1
  117. package/plugins/runtime-modules/core/widgets/gallery/client.js +29 -21
  118. package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +16 -0
  119. package/plugins/runtime-modules/core/widgets/gallery/config.js +16 -0
  120. package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +1 -1
  121. package/plugins/runtime-modules/core/widgets/gallery/server.js +11 -0
  122. package/plugins/runtime-modules/core/widgets/image/config.d.ts +35 -0
  123. package/plugins/runtime-modules/core/widgets/image/config.js +8 -0
  124. package/plugins/runtime-modules/core/widgets/image/plugin.js +19 -1
  125. package/plugins/runtime-modules/core/widgets/image/server.d.ts +3 -1
  126. package/plugins/runtime-modules/core/widgets/image/server.js +2 -2
  127. package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +13 -0
  128. package/plugins/runtime-modules/core/widgets/markdown/config.js +8 -0
  129. package/plugins/runtime-modules/core/widgets/markdown/editor.js +7 -7
  130. package/plugins/runtime-modules/core/widgets/markdown/plugin.js +20 -7
  131. package/plugins/runtime-modules/core/widgets/record/authoring.js +1 -1
  132. package/plugins/runtime-modules/core/widgets/result/config.d.ts +11 -0
  133. package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +13 -0
  134. package/plugins/runtime-modules/core/widgets/simple-text/config.js +9 -0
  135. package/plugins/runtime-modules/core/widgets/simple-text/editor.js +1 -1
  136. package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +14 -1
  137. package/plugins/runtime-modules/core/widgets/spacer/client.js +1 -1
  138. package/plugins/runtime-modules/core/widgets/table/config.d.ts +37 -0
  139. package/plugins/runtime-modules/descriptor-compiler.js +8 -0
  140. package/plugins/runtime-modules/editor/presets.d.ts +1 -0
  141. package/plugins/runtime-modules/groups/definition.d.ts +1 -1
  142. package/plugins/runtime-modules/localization/presets.d.ts +1 -0
  143. package/plugins/runtime-modules/news/presets.d.ts +1 -0
  144. package/plugins/runtime-modules/resolver.js +2 -0
  145. package/plugins/runtime-modules/revisions/presets.d.ts +1 -0
  146. package/plugins/runtime-modules/theme/presets.d.ts +1 -0
  147. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +25 -2
  148. package/server-helpers/cms-page-record.d.ts +26 -0
  149. package/server-helpers/cms-page-record.js +42 -0
  150. package/server-helpers/cms-request.js +48 -4
  151. package/server-helpers/record-fields.d.ts +62 -0
  152. package/server-helpers/record-fields.js +87 -0
  153. package/server-helpers/record-samples.d.ts +21 -0
  154. package/server-helpers/record-samples.js +41 -0
  155. package/styles/builder-scaffold.css +19 -19
  156. package/styles/controls.css +109 -109
  157. package/styles/gradients.css +23 -23
  158. package/styles/layout-affordances.css +15 -15
  159. package/styles/layout-authoring-scaffold.css +20 -20
  160. package/styles/layout.css +9 -9
  161. package/styles/root.css +4 -4
  162. package/styles/shell.css +48 -17
  163. package/theme/antd-css-var-contract.d.ts +86 -80
  164. package/theme/antd-css-var-contract.js +92 -81
  165. package/theme/phi-control-shape.d.ts +1 -1
  166. package/theme/phi-theme-gradients.d.ts +2 -2
  167. package/theme/phi-theme-gradients.js +14 -14
  168. package/theme/phi-theme-palette.d.ts +1 -1
  169. package/theme/phi-theme-palette.js +2 -2
  170. package/theme/phi-theme-tokens.d.ts +8 -5
  171. package/theme/phi-theme-tokens.js +59 -28
  172. package/theme/phi-theme.d.ts +14 -2
  173. package/theme/phi-theme.js +14 -1
  174. package/theme/phi-tokens.d.ts +5 -0
  175. package/theme/phi-tokens.js +9 -0
  176. package/types/cms-module-descriptors.d.ts +6 -0
  177. package/types/cms-plugins.d.ts +19 -1
  178. package/types/core-widget-placements.d.ts +10 -0
  179. package/types/record-provider.d.ts +92 -0
  180. package/types/widget-runtime.d.ts +5 -0
  181. /package/plugins/runtime-modules/{asset/services/folder-images.server.d.ts → core/services/media-folder-images.server.d.ts} +0 -0
  182. /package/plugins/runtime-modules/{asset/services/folder-images.server.js → core/services/media-folder-images.server.js} +0 -0
@@ -53,6 +53,8 @@ export type PhiMarkdownWidgetPlacement = PhiWidgetPlacementBase & {
53
53
  eyebrow?: string;
54
54
  sourceMode?: "inline" | "url";
55
55
  markdown?: string;
56
+ /** A Markdown or text field of the page record shown instead of the Widget's own text. */
57
+ recordField?: string;
56
58
  sourceUrl?: string;
57
59
  sourceLocale?: string;
58
60
  revalidateSeconds?: number;
@@ -90,6 +92,8 @@ export type PhiSimpleTextWidgetPlacement = PhiWidgetPlacementBase & {
90
92
  disabled?: boolean;
91
93
  /** `"preset"` while the words are a Preset's (`helpers/text-source.ts`). */
92
94
  textSource?: PhiTextSource;
95
+ /** A text, number or date field of the page record shown instead of the Widget's own text. */
96
+ recordField?: string;
93
97
  };
94
98
  export type PhiDescriptionWidgetPlacement = PhiWidgetPlacementBase & {
95
99
  eyebrow?: string;
@@ -114,6 +118,10 @@ export type PhiButtonWidgetPlacement = PhiWidgetPlacementBase & PhiControlPlacem
114
118
  gradient?: PhiThemeGradientKey;
115
119
  linkTarget?: PhiLinkTarget;
116
120
  danger?: boolean;
121
+ /** A text field of the page record sent as the signal value instead of `value`. */
122
+ valueRecordField?: string;
123
+ /** A link field of the page record the Button leads to instead of `linkTarget`. */
124
+ linkRecordField?: string;
117
125
  };
118
126
  export type PhiImageWidgetPreviewMode = "none" | "native" | "lightbox";
119
127
  export type PhiImageWidgetFit = "cover" | "contain" | "fill";
@@ -131,6 +139,8 @@ export type PhiImageWidgetPlacement = PhiWidgetPlacementBase & PhiMediaImageSour
131
139
  borderBottomLeftRadius?: number | string;
132
140
  borderBottomRightRadius?: number | string;
133
141
  mask?: PhiMaskConfig;
142
+ /** A picture field of the page record shown instead of the Widget's own picture. */
143
+ recordField?: string;
134
144
  };
135
145
  export type PhiIconWidgetPlacement = PhiWidgetPlacementBase & {
136
146
  icon?: string;
@@ -1,3 +1,4 @@
1
+ import type { PhiRecordFieldKind } from "../constants/record-field-kinds";
1
2
  import type { PhiRuntimeDataProviderKey } from "./runtime-data-provider";
2
3
  import type { PhiBlockRuntime } from "./widget-runtime";
3
4
  /** What a record Provider is asked with, besides its parameters: whose Site, in which language. */
@@ -20,4 +21,95 @@ export type PhiRuntimeRecordProviderResolver = (params: Readonly<Record<string,
20
21
  export type PhiRuntimeModuleRecordProviderServerDefinition = {
21
22
  key: PhiRuntimeDataProviderKey;
22
23
  load: () => Promise<PhiRuntimeRecordProviderResolver>;
24
+ /** The reader of the fields the descriptor declares; present exactly where it declares any. */
25
+ loadFields?: () => Promise<PhiRuntimeRecordFieldsReader>;
26
+ /**
27
+ * A few records to show a template with while it is edited; the Builder's Preview takes the first.
28
+ * Optional: without one a template previews with its Widgets' own content. Only where the descriptor
29
+ * declares `record` (fields): a sample stands in for the record a Page is about.
30
+ */
31
+ loadSamples?: () => Promise<PhiRuntimeRecordSamplesReader>;
23
32
  };
33
+ /**
34
+ * One record to show a template with: what the Builder calls it, and the parameters of the Provider that
35
+ * name it (`{ slug: "chair" }`) -- the Provider's own, not a route's.
36
+ */
37
+ export type PhiRecordSample = {
38
+ label: string;
39
+ params: Readonly<Record<string, string>>;
40
+ };
41
+ /** The samples a Provider offers, best first; the Builder's Preview takes the first. */
42
+ export type PhiRuntimeRecordSamplesReader = (context: PhiRuntimeRecordProviderContext) => Promise<readonly PhiRecordSample[]>;
43
+ /** A picture as a record names it: where it is served from -- Site-relative or absolute -- and what it shows. */
44
+ export type PhiRecordPicture = {
45
+ src: string;
46
+ alt?: string;
47
+ };
48
+ /** A short state said in a word, with the tone it is said in. */
49
+ export type PhiRecordTag = {
50
+ label: string;
51
+ tone?: "default" | "success" | "warning" | "error";
52
+ };
53
+ /** Somewhere a record leads: an address, Site-relative or absolute, and the words for it. */
54
+ export type PhiRecordLink = {
55
+ href: string;
56
+ label?: string;
57
+ };
58
+ /**
59
+ * What a field of each kind holds. A `date` is an ISO instant and a `number` a number: Core writes both in
60
+ * the page's language. What a domain formats itself is a `text`.
61
+ */
62
+ export type PhiRecordFieldValueByKind = {
63
+ text: string;
64
+ markdown: string;
65
+ picture: PhiRecordPicture;
66
+ pictures: readonly PhiRecordPicture[];
67
+ list: readonly string[];
68
+ tag: PhiRecordTag;
69
+ date: string;
70
+ number: number;
71
+ link: PhiRecordLink;
72
+ };
73
+ export type PhiRecordFieldDescriptor = {
74
+ /** The field's name in a Widget's config; unique within its Provider. */
75
+ key: string;
76
+ /** What the Builder calls it. */
77
+ label: string;
78
+ kind: PhiRecordFieldKind;
79
+ description?: string;
80
+ };
81
+ /**
82
+ * Whose a record is: `public` is the same for everybody, so a page about it may be rendered once;
83
+ * `viewer` is the signed-in account's own and is read for each request.
84
+ */
85
+ export type PhiRecordAudience = "public" | "viewer";
86
+ /** What a `record` descriptor declares about its record. */
87
+ export type PhiRecordDeclaration = {
88
+ audience: PhiRecordAudience;
89
+ fields: readonly PhiRecordFieldDescriptor[];
90
+ };
91
+ /**
92
+ * From the record a resolver answered to its declared fields' values, by field key. A field the record
93
+ * does not have is left out; a value that is not of its declared kind is dropped by Core and logged.
94
+ */
95
+ export type PhiRuntimeRecordFieldsReader = (record: unknown, context: PhiRuntimeRecordProviderContext) => Readonly<Record<string, unknown>> | Promise<Readonly<Record<string, unknown>>>;
96
+ /** One field of a record as Core hands it to a Widget: its declared kind and a value of that kind. */
97
+ export type PhiRecordField = {
98
+ [K in PhiRecordFieldKind]: {
99
+ kind: K;
100
+ value: PhiRecordFieldValueByKind[K];
101
+ };
102
+ }[PhiRecordFieldKind];
103
+ /**
104
+ * The record a Page is about, named by a route that has a parameter.
105
+ *
106
+ * `params` maps each parameter the Provider takes to the route parameter that fills it. `titleField` and
107
+ * `descriptionField` name `text` fields that become the Page's title and description.
108
+ */
109
+ export type PhiCmsPageRecordDescriptor = {
110
+ providerKey: PhiRuntimeDataProviderKey;
111
+ params: Readonly<Record<string, string>>;
112
+ titleField?: string;
113
+ descriptionField?: string;
114
+ };
115
+ export type { PhiRecordFieldKind } from "../constants/record-field-kinds";
@@ -114,6 +114,11 @@ export type PhiBlockRuntimePage = {
114
114
  * a Page says, and this can only add to that, never take it back.
115
115
  */
116
116
  noindex?: boolean;
117
+ /**
118
+ * The record this Page is about, as a binding: the Provider and the parameters the address filled in.
119
+ * Present on a route that names a `pageRecord`; a Widget reads the record's fields through it.
120
+ */
121
+ record?: import("./runtime-data-provider").PhiRuntimeDataProviderBinding;
117
122
  };
118
123
  /**
119
124
  * What a Widget knows about the request it renders in. It holds nothing only the server may know: a