@phis/ui 0.5.1 → 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.
- package/README.md +1 -1
- package/components/controls/phi-border-control.js +1 -1
- package/components/controls/phi-bound-radius-control.js +9 -9
- package/components/controls/phi-brand-control.js +1 -1
- package/components/controls/phi-drawer-control-adapter.js +4 -4
- package/components/controls/phi-dropdown-control.js +2 -2
- package/components/controls/phi-form-control.js +1 -1
- package/components/controls/phi-image-control.js +1 -1
- package/components/controls/phi-mask-picker-control.js +6 -6
- package/components/controls/phi-select-control.js +1 -1
- package/components/controls/phi-theme-scope-control.js +1 -1
- package/components/controls/use-phi-color-control-presets.js +2 -2
- package/components/forms/compound-form-controls.js +2 -2
- package/components/forms/extended-form-field-controls.js +1 -1
- package/components/forms/shared-form-provider-registry.js +2 -2
- package/components/layouts/clients/phi-flex-layout-client.js +4 -4
- package/components/layouts/clients/phi-grid-layout-client.js +3 -3
- package/components/layouts/clients/phi-sequence-slot-editor.js +1 -1
- package/components/layouts/layout-definitions.d.ts +4 -4
- package/components/layouts/phi-page-region-layout.js +1 -1
- package/components/layouts/phi-structure-region-layout.js +3 -3
- package/components/media/phi-asset-focal-rect-widget.js +4 -4
- package/components/media/phi-asset-inspector-section.js +1 -1
- package/components/media/phi-media-kind-icon.js +2 -2
- package/components/media/phi-media-restricted-icon.js +1 -1
- package/components/overlays/phi-overlay-container-client.js +1 -1
- package/components/regions/presets/phi-base-page-column.d.ts +5 -2
- package/components/regions/presets/phi-base-page-column.js +6 -2
- package/components/root/phi-config-provider.js +1 -1
- package/components/root/phi-root-background.js +1 -1
- package/components/root/phi-root-theme-resolver.js +1 -1
- package/components/shell/phi-module-icons.js +1 -1
- package/components/widgets/built-in/builder-workspace-preview.js +8 -8
- package/components/widgets/client/bullet-list-entries-editor.js +2 -2
- package/components/widgets/client/external-document-editor.js +1 -1
- package/components/widgets/client/html-editor.js +3 -3
- package/components/widgets/config/background.d.ts +1 -1
- package/components/widgets/config/background.js +1 -1
- package/components/widgets/inspector-field-row.js +1 -1
- package/components/widgets/label-sets/inspector.js +2 -0
- package/components/widgets/label-types/inspector.d.ts +1 -0
- package/components/widgets/label-types/inspector.js +1 -0
- package/components/widgets/shared/card-body-client.js +1 -1
- package/components/widgets/shared/result-body-client.js +1 -1
- package/constants/media-library-provider-keys.d.ts +8 -1
- package/constants/media-library-provider-keys.js +8 -1
- package/constants/record-field-kinds.d.ts +6 -0
- package/constants/record-field-kinds.js +7 -0
- package/constants/runtime-module-ownership.js +1 -1
- package/helpers/border-widget-style.d.ts +2 -2
- package/helpers/border-widget-style.js +2 -2
- package/helpers/cms-dialog.d.ts +4 -4
- package/helpers/cms-layout-defaults.d.ts +2 -2
- package/helpers/cms-page-catalog.d.ts +5 -0
- package/helpers/cms-preset-page-tree.d.ts +4 -0
- package/helpers/cms-preset-page-tree.js +2 -0
- package/helpers/cms-region-keys.d.ts +1 -1
- package/helpers/layout-style.d.ts +2 -2
- package/helpers/page-layout-check.d.ts +4 -1
- package/helpers/page-layout-check.js +26 -0
- package/helpers/record-fields.d.ts +9 -0
- package/helpers/record-fields.js +84 -0
- package/helpers/surface-presets.d.ts +6 -6
- package/helpers/surface-style.d.ts +1 -1
- package/helpers.d.ts +0 -1
- package/helpers.js +0 -2
- package/module-page-check.d.ts +12 -0
- package/module-page-check.js +12 -0
- package/module-records.d.ts +4 -2
- package/module-records.js +3 -1
- package/next/antd-form-context-loader.mjs +31 -0
- package/next/config.d.mts +2 -0
- package/next/config.mjs +36 -3
- package/package.json +10 -1
- package/plugins/runtime-modules/asset/data-providers.d.ts +0 -65
- package/plugins/runtime-modules/asset/data-providers.js +0 -40
- package/plugins/runtime-modules/asset/definition.d.ts +0 -60
- package/plugins/runtime-modules/asset/ids.d.ts +0 -1
- package/plugins/runtime-modules/asset/ids.js +1 -2
- package/plugins/runtime-modules/asset/presets.d.ts +1 -0
- package/plugins/runtime-modules/asset/server.js +0 -5
- package/plugins/runtime-modules/blog/presets.d.ts +1 -0
- package/plugins/runtime-modules/builder/clients/inspector-config-field.d.ts +4 -1
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +13 -4
- package/plugins/runtime-modules/builder/clients/inspector-link-target-field.js +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +14 -1
- package/plugins/runtime-modules/builder/clients/inspector-signal-section.js +2 -2
- package/plugins/runtime-modules/builder/clients/layout-inspector.js +1 -1
- package/plugins/runtime-modules/builder/clients/layout-scaffold-buttons.js +4 -4
- package/plugins/runtime-modules/builder/clients/layout-scaffold-overlays.js +1 -1
- package/plugins/runtime-modules/builder/clients/region-inspector.js +1 -1
- package/plugins/runtime-modules/builder/clients/region-visibility-fields.js +1 -1
- package/plugins/runtime-modules/builder/clients/shells-workspace.js +1 -1
- package/plugins/runtime-modules/builder/clients/structure-canvas.js +2 -2
- package/plugins/runtime-modules/builder/clients/widget-effects-editor.js +1 -1
- package/plugins/runtime-modules/builder/clients/widget-inspector.d.ts +4 -1
- package/plugins/runtime-modules/builder/clients/widget-inspector.js +3 -2
- package/plugins/runtime-modules/builder/page-presets.server.d.ts +6 -0
- package/plugins/runtime-modules/builder/page-presets.server.js +8 -0
- package/plugins/runtime-modules/builder/pages-workspace.js +12 -1
- package/plugins/runtime-modules/builder/render-root-node-scaffold.js +5 -5
- package/plugins/runtime-modules/builder/structure-dnd.js +2 -2
- package/plugins/runtime-modules/builder/widgets/test-block/client.js +1 -1
- package/plugins/runtime-modules/content-entry-routes.d.ts +1 -0
- package/plugins/runtime-modules/contracts.d.ts +1 -1
- package/plugins/runtime-modules/contracts.js +41 -1
- package/plugins/runtime-modules/core/data-providers.d.ts +60 -0
- package/plugins/runtime-modules/core/data-providers.js +41 -0
- package/plugins/runtime-modules/core/definition.d.ts +55 -0
- package/plugins/runtime-modules/core/server.js +5 -0
- package/plugins/runtime-modules/core/widgets/button/config.d.ts +34 -0
- package/plugins/runtime-modules/core/widgets/button/config.js +16 -0
- package/plugins/runtime-modules/core/widgets/button/plugin.js +37 -6
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +13 -2
- package/plugins/runtime-modules/core/widgets/description/config.d.ts +13 -2
- package/plugins/runtime-modules/core/widgets/description/editor.js +13 -13
- package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +11 -0
- package/plugins/runtime-modules/core/widgets/gallery/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/gallery/client.js +29 -21
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +16 -0
- package/plugins/runtime-modules/core/widgets/gallery/config.js +16 -0
- package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/gallery/server.js +11 -0
- package/plugins/runtime-modules/core/widgets/header-navigation/authoring.js +2 -3
- package/plugins/runtime-modules/core/widgets/header-navigation/client.d.ts +1 -3
- package/plugins/runtime-modules/core/widgets/header-navigation/client.js +9 -5
- package/plugins/runtime-modules/core/widgets/header-navigation/config.d.ts +1 -4
- package/plugins/runtime-modules/core/widgets/header-navigation/plugin.js +2 -3
- package/plugins/runtime-modules/core/widgets/header-navigation/server.d.ts +2 -2
- package/plugins/runtime-modules/core/widgets/header-navigation/server.js +1 -2
- package/plugins/runtime-modules/core/widgets/image/config.d.ts +35 -0
- package/plugins/runtime-modules/core/widgets/image/config.js +8 -0
- package/plugins/runtime-modules/core/widgets/image/plugin.js +19 -1
- package/plugins/runtime-modules/core/widgets/image/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/image/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +13 -0
- package/plugins/runtime-modules/core/widgets/markdown/config.js +8 -0
- package/plugins/runtime-modules/core/widgets/markdown/editor.js +7 -7
- package/plugins/runtime-modules/core/widgets/markdown/plugin.js +20 -7
- package/plugins/runtime-modules/core/widgets/record/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/result/config.d.ts +11 -0
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +13 -0
- package/plugins/runtime-modules/core/widgets/simple-text/config.js +9 -0
- package/plugins/runtime-modules/core/widgets/simple-text/editor.js +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/plugin.js +14 -1
- package/plugins/runtime-modules/core/widgets/spacer/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/table/config.d.ts +37 -0
- package/plugins/runtime-modules/descriptor-compiler.js +8 -0
- package/plugins/runtime-modules/editor/presets.d.ts +1 -0
- package/plugins/runtime-modules/groups/definition.d.ts +1 -1
- package/plugins/runtime-modules/localization/presets.d.ts +1 -0
- package/plugins/runtime-modules/news/presets.d.ts +1 -0
- package/plugins/runtime-modules/resolver.js +2 -0
- package/plugins/runtime-modules/revisions/presets.d.ts +1 -0
- package/plugins/runtime-modules/theme/presets.d.ts +1 -0
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +37 -1
- package/server-helpers/cms-page-record.d.ts +26 -0
- package/server-helpers/cms-page-record.js +42 -0
- package/server-helpers/cms-request.js +48 -4
- package/server-helpers/record-fields.d.ts +62 -0
- package/server-helpers/record-fields.js +87 -0
- package/server-helpers/record-samples.d.ts +21 -0
- package/server-helpers/record-samples.js +41 -0
- package/styles/builder-scaffold.css +19 -19
- package/styles/controls.css +121 -108
- package/styles/gradients.css +23 -23
- package/styles/layout-affordances.css +15 -15
- package/styles/layout-authoring-scaffold.css +20 -20
- package/styles/layout.css +9 -9
- package/styles/root.css +4 -4
- package/styles/shell.css +48 -17
- package/theme/antd-css-var-contract.d.ts +93 -78
- package/theme/antd-css-var-contract.js +99 -79
- package/theme/phi-container-breakpoints.d.ts +4 -1
- package/theme/phi-container-breakpoints.js +4 -1
- package/theme/phi-control-shape.d.ts +1 -1
- package/theme/phi-theme-gradients.d.ts +2 -2
- package/theme/phi-theme-gradients.js +14 -14
- package/theme/phi-theme-palette.d.ts +1 -1
- package/theme/phi-theme-palette.js +2 -2
- package/theme/phi-theme-tokens.d.ts +10 -4
- package/theme/phi-theme-tokens.js +78 -23
- package/theme/phi-theme.d.ts +14 -0
- package/theme/phi-theme.js +14 -0
- package/theme/phi-tokens.d.ts +6 -1
- package/theme/phi-tokens.js +22 -2
- package/theme.d.ts +1 -1
- package/theme.js +1 -1
- package/types/cms-module-descriptors.d.ts +6 -0
- package/types/cms-plugins.d.ts +19 -1
- package/types/core-widget-placements.d.ts +10 -0
- package/types/record-provider.d.ts +92 -0
- package/types/widget-runtime.d.ts +5 -0
- /package/plugins/runtime-modules/{asset/services/folder-images.server.d.ts → core/services/media-folder-images.server.d.ts} +0 -0
- /package/plugins/runtime-modules/{asset/services/folder-images.server.js → core/services/media-folder-images.server.js} +0 -0
|
@@ -75,7 +75,7 @@ export function PhiBulletListEntriesEditor({ entries, listStyle, onCommit, state
|
|
|
75
75
|
}
|
|
76
76
|
return (_jsx("div", { ref: listRef, style: { width: "100%", minWidth: 0 }, children: _jsx(PhiBulletListControl, { listStyle: listStyle,
|
|
77
77
|
// Each entry is a borderless text field, whose first line stands at the field's height.
|
|
78
|
-
markerLineHeight: "var(--
|
|
78
|
+
markerLineHeight: "var(--phi-control-height)", items: buildPhiBulletListTree(shown, (item, index) => (_jsx(PhiTextControl, { presentation: "textarea", value: item.text, readOnly: !onCommit, variant: "borderless", placeholder: `Item ${index + 1}`, autoSize: { minRows: 1, maxRows: 6 }, onChange: (value) => updateText(index, value ?? ""), onBlur: () => commit(shown), onKeyDown: (event) => {
|
|
79
79
|
if (!onCommit)
|
|
80
80
|
return;
|
|
81
81
|
if (event.key === "Tab") {
|
|
@@ -105,5 +105,5 @@ export function PhiBulletListEntriesEditor({ entries, listStyle, onCommit, state
|
|
|
105
105
|
* first line's middle is the marker's (`markerLineHeight` above). That is the padding the
|
|
106
106
|
* field had from Ant Design already; stated, the clear button can find the line too.
|
|
107
107
|
*/
|
|
108
|
-
inputStyle: { paddingBlock: "calc((var(--
|
|
108
|
+
inputStyle: { paddingBlock: "calc((var(--phi-control-height) - 1lh) / 2)" } })), states && onCommit ? (_entry, index) => stepState(index) : undefined) }) }));
|
|
109
109
|
}
|
|
@@ -43,5 +43,5 @@ export function PhiExternalDocumentEditor({ format, sourceUrl, sourceLocale, onS
|
|
|
43
43
|
});
|
|
44
44
|
return () => controller.abort();
|
|
45
45
|
}, [canReport, format, sourceLocale, sourceUrl]);
|
|
46
|
-
return (_jsx("div", { style: { width: 520, height: 260, maxWidth: "100%", minWidth: 0, minHeight: 0, display: "flex" }, children: _jsx(PhiAlertControl, { level: "info", showIcon: true, title: `External ${format} source`, description: _jsxs(PhiFlexControl, { vertical: true, gap: "var(--
|
|
46
|
+
return (_jsx("div", { style: { width: 520, height: 260, maxWidth: "100%", minWidth: 0, minHeight: 0, display: "flex" }, children: _jsx(PhiAlertControl, { level: "info", showIcon: true, title: `External ${format} source`, description: _jsxs(PhiFlexControl, { vertical: true, gap: "var(--phi-padding-xs)", style: { width: "100%", minWidth: 0 }, children: [_jsx(PhiTypographyControl, { children: "This widget renders the configured external document. Edit its URL and source locale in the widget settings." }), _jsx(PhiTypographyControl, { code: true, copyable: { text: sourceUrl }, style: { wordBreak: "break-all" }, children: sourceUrl || "No Source URL configured." })] }) }) }));
|
|
47
47
|
}
|
|
@@ -64,8 +64,8 @@ const PHI_HTML_WIDGET_EDITOR_LIVE_STYLE = `
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
.phi-html-widget-editor__text--code {
|
|
67
|
-
font-family: var(--
|
|
68
|
-
background: var(--
|
|
67
|
+
font-family: var(--phi-font-family-code, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, monospace);
|
|
68
|
+
background: var(--phi-color-fill-secondary, rgba(0, 0, 0, 0.04));
|
|
69
69
|
border-radius: 4px;
|
|
70
70
|
padding: 0 0.2em;
|
|
71
71
|
}
|
|
@@ -436,7 +436,7 @@ export function PhiHtmlWidgetEditor({ blockId, html, fontFamily, fontSize, onCha
|
|
|
436
436
|
width: "100%",
|
|
437
437
|
minWidth: 0,
|
|
438
438
|
maxWidth: "100%",
|
|
439
|
-
border: "1px solid var(--
|
|
439
|
+
border: "1px solid var(--phi-color-border, rgba(0, 0, 0, 0.12))",
|
|
440
440
|
borderRadius: 0,
|
|
441
441
|
overflow: "hidden",
|
|
442
442
|
backgroundColor: "rgba(255,255,255,0.84)",
|
|
@@ -88,7 +88,7 @@ export declare const PHI_BACKGROUND_BASE_KINDS: readonly PhiCmsBackgroundWidgetC
|
|
|
88
88
|
* ground (`PHI_SURFACE_TONE_GROUND`), and what a `theme` ground falls back to where the Theme's Overlay
|
|
89
89
|
* is not published.
|
|
90
90
|
*/
|
|
91
|
-
export declare const PHI_BACKGROUND_CONTAINER_GROUND = "var(--
|
|
91
|
+
export declare const PHI_BACKGROUND_CONTAINER_GROUND = "var(--phi-color-bg-container)";
|
|
92
92
|
/**
|
|
93
93
|
* What a `theme` Base paints: the Shell Chrome Overlay's custom properties, the same ones the Shell's
|
|
94
94
|
* chrome panes paint from (components/shell/phi-cms-shell.tsx).
|
|
@@ -37,7 +37,7 @@ export const PHI_BACKGROUND_BASE_KINDS = [
|
|
|
37
37
|
* ground (`PHI_SURFACE_TONE_GROUND`), and what a `theme` ground falls back to where the Theme's Overlay
|
|
38
38
|
* is not published.
|
|
39
39
|
*/
|
|
40
|
-
export const PHI_BACKGROUND_CONTAINER_GROUND = "var(--
|
|
40
|
+
export const PHI_BACKGROUND_CONTAINER_GROUND = "var(--phi-color-bg-container)";
|
|
41
41
|
/**
|
|
42
42
|
* What a `theme` Base paints: the Shell Chrome Overlay's custom properties, the same ones the Shell's
|
|
43
43
|
* chrome panes paint from (components/shell/phi-cms-shell.tsx).
|
|
@@ -5,5 +5,5 @@ import { PhiTypographyControl } from "../controls/phi-typography-control";
|
|
|
5
5
|
/** The label column every Inspector row shares, so a control that draws its own header lines up with the rest. */
|
|
6
6
|
export const PHI_INSPECTOR_FIELD_LABEL_WIDTH = 140;
|
|
7
7
|
export function PhiInspectorFieldRow({ label, children, labelWidth = PHI_INSPECTOR_FIELD_LABEL_WIDTH, }) {
|
|
8
|
-
return (_jsxs(PhiFlexControl, { align: "flex-start", gap: 12, wrap: false, style: { width: "100%" }, children: [_jsx(PhiTypographyControl, { style: { flex: `0 0 ${labelWidth}px`, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", lineHeight: "var(--
|
|
8
|
+
return (_jsxs(PhiFlexControl, { align: "flex-start", gap: 12, wrap: false, style: { width: "100%" }, children: [_jsx(PhiTypographyControl, { style: { flex: `0 0 ${labelWidth}px`, minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", lineHeight: "var(--phi-control-height)" }, children: label }), _jsx("div", { style: { flex: "1 1 auto", minWidth: 0 }, children: children })] }));
|
|
9
9
|
}
|
|
@@ -69,6 +69,7 @@ const PHI_INSPECTOR_WIDGET_LABEL_SET = definePhiLabelSet({
|
|
|
69
69
|
field_select_table_resource: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.fields.selectTableResource,
|
|
70
70
|
field_select_calendar: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.fields.selectCalendar,
|
|
71
71
|
field_select_video_provider: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.fields.selectVideoProvider,
|
|
72
|
+
field_select_record_field: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.fields.selectRecordField,
|
|
72
73
|
link_none: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.fields.linkTarget.none,
|
|
73
74
|
link_page: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.fields.linkTarget.page,
|
|
74
75
|
link_external: PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.fields.linkTarget.external,
|
|
@@ -158,6 +159,7 @@ export async function getPhiInspectorWidgetLabels(options) {
|
|
|
158
159
|
selectTableResource: labels.field_select_table_resource,
|
|
159
160
|
selectCalendar: labels.field_select_calendar,
|
|
160
161
|
selectVideoProvider: labels.field_select_video_provider,
|
|
162
|
+
selectRecordField: labels.field_select_record_field,
|
|
161
163
|
linkTarget: {
|
|
162
164
|
none: labels.link_none,
|
|
163
165
|
page: labels.link_page,
|
|
@@ -103,6 +103,7 @@ export type PhiInspectorFieldLabels = {
|
|
|
103
103
|
selectTableResource: string;
|
|
104
104
|
selectCalendar: string;
|
|
105
105
|
selectVideoProvider: string;
|
|
106
|
+
selectRecordField: string;
|
|
106
107
|
linkTarget: PhiInspectorLinkTargetLabels;
|
|
107
108
|
};
|
|
108
109
|
export declare const PHI_INSPECTOR_WIDGET_DEFAULT_LABELS: PhiInspectorWidgetLabels;
|
|
@@ -72,6 +72,7 @@ export const PHI_INSPECTOR_WIDGET_DEFAULT_LABELS = {
|
|
|
72
72
|
selectTableResource: "Select a Table resource",
|
|
73
73
|
selectCalendar: "Select a calendar",
|
|
74
74
|
selectVideoProvider: "Select a video provider",
|
|
75
|
+
selectRecordField: "Select a field of the page's record",
|
|
75
76
|
linkTarget: {
|
|
76
77
|
none: "None",
|
|
77
78
|
page: "Page",
|
|
@@ -24,7 +24,7 @@ import { PHI_THEME_HEADING_FONT_VARIABLE } from "../../../theme/phi-theme-typogr
|
|
|
24
24
|
import { PHI_CARD_IMAGE_SIZES, PHI_CARD_TEXT_SLOTS, readPhiCardBillingPeriod } from "./card-vocabulary";
|
|
25
25
|
/**
|
|
26
26
|
* The layer over a card's picture. A colour or a gradient is drawn as CSS, each colour mixed down to the
|
|
27
|
-
* Overlay's opacity, so a Theme variable (`var(--
|
|
27
|
+
* Overlay's opacity, so a Theme variable (`var(--phi-color-bg-container)`) resolves and the picture fades
|
|
28
28
|
* into the card's own ground in either mode; a Background draws the same Overlay into an SVG picture,
|
|
29
29
|
* where no variable reaches. A pattern or noise is drawn as a Background draws it.
|
|
30
30
|
*/
|
|
@@ -4,7 +4,7 @@ import { PhiButtonControl } from "../../controls/phi-button-control";
|
|
|
4
4
|
import { PhiResultControl } from "../../controls/phi-result-control";
|
|
5
5
|
export function PhiResultWidgetBody({ config, code, title, subTitle, homeHref, homeLinkLabel, }) {
|
|
6
6
|
const renderedTitle = code && title && code !== title
|
|
7
|
-
? (_jsxs("span", { style: { display: "inline-flex", flexDirection: "column", gap: "var(--
|
|
7
|
+
? (_jsxs("span", { style: { display: "inline-flex", flexDirection: "column", gap: "var(--phi-padding-xxs)" }, children: [_jsx("span", { children: code }), _jsx("span", { style: { fontSize: "var(--phi-font-size-lg)", fontWeight: 400 }, children: title })] }))
|
|
8
8
|
: (title || code || "Information");
|
|
9
9
|
return (_jsx(PhiResultControl, { status: config?.status ?? "info", title: renderedTitle, subTitle: subTitle, extra: config?.homeLink
|
|
10
10
|
? _jsx(PhiButtonControl, { href: homeHref, label: homeLinkLabel, type: "primary" })
|
|
@@ -19,9 +19,16 @@
|
|
|
19
19
|
export declare const PHI_MEDIA_LIBRARY_DATA_PROVIDER_KEYS: {
|
|
20
20
|
readonly collection: `${string}/${string}`;
|
|
21
21
|
readonly folders: `${string}/${string}`;
|
|
22
|
+
/**
|
|
23
|
+
* Every Folder of the Site Space as a choice, loaded by the choice itself. The Asset Module answers it,
|
|
24
|
+
* and the Builder reads it in any Area (`availableToAuthoringChrome`); the folder pictures Provider
|
|
25
|
+
* names it for its Folder setting.
|
|
26
|
+
*/
|
|
27
|
+
readonly folderChoices: `${string}/${string}`;
|
|
22
28
|
/**
|
|
23
29
|
* The public pictures of one Folder, read on the server while the page is drawn (a `record`
|
|
24
|
-
* Provider).
|
|
30
|
+
* Provider). Served by Core, not by the Asset Module: showing what is public needs no Media
|
|
31
|
+
* management in the Area, as an Image Widget does not. The Gallery Widget starts bound to it.
|
|
25
32
|
*/
|
|
26
33
|
readonly folderImages: `${string}/${string}`;
|
|
27
34
|
};
|
|
@@ -20,9 +20,16 @@ import { createPhiSharedRuntimeDataProviderKey, createPhiSharedRuntimeItemRender
|
|
|
20
20
|
export const PHI_MEDIA_LIBRARY_DATA_PROVIDER_KEYS = {
|
|
21
21
|
collection: createPhiSharedRuntimeDataProviderKey("collections", "media"),
|
|
22
22
|
folders: createPhiSharedRuntimeDataProviderKey("options", "media-folders"),
|
|
23
|
+
/**
|
|
24
|
+
* Every Folder of the Site Space as a choice, loaded by the choice itself. The Asset Module answers it,
|
|
25
|
+
* and the Builder reads it in any Area (`availableToAuthoringChrome`); the folder pictures Provider
|
|
26
|
+
* names it for its Folder setting.
|
|
27
|
+
*/
|
|
28
|
+
folderChoices: createPhiSharedRuntimeDataProviderKey("options", "media-folder-choices"),
|
|
23
29
|
/**
|
|
24
30
|
* The public pictures of one Folder, read on the server while the page is drawn (a `record`
|
|
25
|
-
* Provider).
|
|
31
|
+
* Provider). Served by Core, not by the Asset Module: showing what is public needs no Media
|
|
32
|
+
* management in the Area, as an Image Widget does not. The Gallery Widget starts bound to it.
|
|
26
33
|
*/
|
|
27
34
|
folderImages: createPhiSharedRuntimeDataProviderKey("records", "media-folder-images"),
|
|
28
35
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The kinds a field of a record can be. Closed: a Widget says which of them it draws, and the Builder offers
|
|
3
|
+
* only those. Here rather than beside the record types, so that reading the list at runtime does not load them.
|
|
4
|
+
*/
|
|
5
|
+
export declare const PHI_RECORD_FIELD_KINDS: readonly ["text", "markdown", "picture", "pictures", "list", "tag", "date", "number", "link"];
|
|
6
|
+
export type PhiRecordFieldKind = (typeof PHI_RECORD_FIELD_KINDS)[number];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The kinds a field of a record can be. Closed: a Widget says which of them it draws, and the Builder offers
|
|
3
|
+
* only those. Here rather than beside the record types, so that reading the list at runtime does not load them.
|
|
4
|
+
*/
|
|
5
|
+
export const PHI_RECORD_FIELD_KINDS = [
|
|
6
|
+
"text", "markdown", "picture", "pictures", "list", "tag", "date", "number", "link",
|
|
7
|
+
];
|
|
@@ -244,7 +244,7 @@ const PHI_RUNTIME_MODULE_OWNERSHIP = {
|
|
|
244
244
|
// One published entry with its relatives, read on the server (`types/record-provider.ts`).
|
|
245
245
|
"records/content-entry": ["core", "content-entry"],
|
|
246
246
|
// The public pictures of a Media Folder, for a Gallery that shows a Folder.
|
|
247
|
-
"records/media-folder-images": ["
|
|
247
|
+
"records/media-folder-images": ["core", "media-folder-images"],
|
|
248
248
|
"signals/tour-availability": ["tour", "availability"],
|
|
249
249
|
"signals/tour-progress": ["tour", "progress"],
|
|
250
250
|
"signals/tree-action": ["core", "tree-action"],
|
|
@@ -13,9 +13,9 @@ type PhiBorderWidgetStyleFallback = {
|
|
|
13
13
|
* has to add this to the sum, and a `1px` typed into that calculation is the same second answer as one
|
|
14
14
|
* typed into a border.
|
|
15
15
|
*/
|
|
16
|
-
export declare const PHI_THEME_BORDER_WIDTH = "var(--
|
|
16
|
+
export declare const PHI_THEME_BORDER_WIDTH = "var(--phi-line-width, 1px)";
|
|
17
17
|
/** The Site's own line: its border colour at its line width. One string, so nobody types a second. */
|
|
18
|
-
export declare const PHI_THEME_BORDER_LINE = "var(--
|
|
18
|
+
export declare const PHI_THEME_BORDER_LINE = "var(--phi-line-width, 1px) solid var(--phi-color-border)";
|
|
19
19
|
/**
|
|
20
20
|
* The same line at a colour the caller names.
|
|
21
21
|
*
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* has to add this to the sum, and a `1px` typed into that calculation is the same second answer as one
|
|
6
6
|
* typed into a border.
|
|
7
7
|
*/
|
|
8
|
-
export const PHI_THEME_BORDER_WIDTH = "var(--
|
|
8
|
+
export const PHI_THEME_BORDER_WIDTH = "var(--phi-line-width, 1px)";
|
|
9
9
|
/** The Site's own line: its border colour at its line width. One string, so nobody types a second. */
|
|
10
|
-
export const PHI_THEME_BORDER_LINE = `${PHI_THEME_BORDER_WIDTH} solid var(--
|
|
10
|
+
export const PHI_THEME_BORDER_LINE = `${PHI_THEME_BORDER_WIDTH} solid var(--phi-color-border)`;
|
|
11
11
|
/**
|
|
12
12
|
* The same line at a colour the caller names.
|
|
13
13
|
*
|
package/helpers/cms-dialog.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/** The body Layout's config: a vertical Flex with the `panel` creation preset under it. */
|
|
2
2
|
export declare const PHI_DIALOG_BODY_CONFIG: {
|
|
3
|
-
readonly gap: "var(--
|
|
3
|
+
readonly gap: "var(--phi-padding-sm)";
|
|
4
4
|
readonly margin: 0;
|
|
5
|
-
readonly padding: "var(--
|
|
5
|
+
readonly padding: "var(--phi-padding)";
|
|
6
6
|
readonly surface: {
|
|
7
7
|
readonly background: {
|
|
8
8
|
readonly base: {
|
|
9
9
|
readonly kind: "color";
|
|
10
|
-
readonly color: "var(--
|
|
10
|
+
readonly color: "var(--phi-color-fill-quaternary)";
|
|
11
11
|
};
|
|
12
12
|
readonly overlay: null;
|
|
13
13
|
readonly filter: null;
|
|
@@ -24,7 +24,7 @@ export declare const PHI_DIALOG_BLEED_BODY_CONFIG: {
|
|
|
24
24
|
readonly background: {
|
|
25
25
|
readonly base: {
|
|
26
26
|
readonly kind: "color";
|
|
27
|
-
readonly color: "var(--
|
|
27
|
+
readonly color: "var(--phi-color-fill-quaternary)";
|
|
28
28
|
};
|
|
29
29
|
readonly overlay: null;
|
|
30
30
|
readonly filter: null;
|
|
@@ -8,7 +8,7 @@ export declare const PHI_SPLIT_CARD_LAYOUT_CREATION_CONFIG: {
|
|
|
8
8
|
readonly background: {
|
|
9
9
|
readonly base: {
|
|
10
10
|
readonly kind: "color";
|
|
11
|
-
readonly color: "var(--
|
|
11
|
+
readonly color: "var(--phi-color-bg-container)";
|
|
12
12
|
};
|
|
13
13
|
readonly overlay: null;
|
|
14
14
|
readonly filter: null;
|
|
@@ -17,7 +17,7 @@ export declare const PHI_SPLIT_CARD_LAYOUT_CREATION_CONFIG: {
|
|
|
17
17
|
readonly border: {
|
|
18
18
|
readonly borderWidth: 1;
|
|
19
19
|
readonly borderStyle: "solid";
|
|
20
|
-
readonly borderColor: "var(--
|
|
20
|
+
readonly borderColor: "var(--phi-color-border-secondary)";
|
|
21
21
|
};
|
|
22
22
|
readonly shadow: "soft";
|
|
23
23
|
};
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { type PhiBuilderAreaKey } from "../constants/cms-areas";
|
|
2
2
|
import type { PhiCmsPresetSource } from "../types/cms-module-descriptors";
|
|
3
|
+
import type { PhiRuntimeDataProviderKey } from "../types/runtime-data-provider";
|
|
3
4
|
import { type PhiPageReference } from "../types/references";
|
|
4
5
|
export type PhiPresetPageNode = {
|
|
5
6
|
key: string;
|
|
6
7
|
title: string;
|
|
8
|
+
/** The record Provider of the record this Page is about, where its route names one. */
|
|
9
|
+
pageRecord?: {
|
|
10
|
+
providerKey: PhiRuntimeDataProviderKey;
|
|
11
|
+
};
|
|
7
12
|
/** The address the Page answers on, including the package namespace outside Public. */
|
|
8
13
|
storagePath?: string;
|
|
9
14
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PhiPresetPageNode } from "./cms-page-catalog";
|
|
2
2
|
import type { PhiCmsActiveRouteTable } from "../types/cms-module-descriptors";
|
|
3
3
|
import type { PhiRuntimeModuleId } from "../types";
|
|
4
|
+
import type { PhiRuntimeDataProviderKey } from "../types/runtime-data-provider";
|
|
4
5
|
/**
|
|
5
6
|
* Puts one Module route into a Page tree, under the folders its path names.
|
|
6
7
|
*
|
|
@@ -16,6 +17,9 @@ export declare function insertPhiPresetPageTarget(roots: PhiPresetPageNode[], ta
|
|
|
16
17
|
presetVersion: number;
|
|
17
18
|
defaultPageFlags?: number;
|
|
18
19
|
landingPage?: true;
|
|
20
|
+
pageRecord?: {
|
|
21
|
+
providerKey: PhiRuntimeDataProviderKey;
|
|
22
|
+
};
|
|
19
23
|
}): void;
|
|
20
24
|
/**
|
|
21
25
|
* The Module Pages one Area answers on today, as catalog nodes.
|
|
@@ -43,6 +43,7 @@ export function insertPhiPresetPageTarget(roots, target) {
|
|
|
43
43
|
sourcePreset,
|
|
44
44
|
...(target.defaultPageFlags ? { defaultPageFlags: target.defaultPageFlags } : {}),
|
|
45
45
|
...(target.landingPage ? { landingPage: true } : {}),
|
|
46
|
+
...(target.pageRecord ? { pageRecord: { providerKey: target.pageRecord.providerKey } } : {}),
|
|
46
47
|
});
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
@@ -64,6 +65,7 @@ export function insertPhiPresetPageTarget(roots, target) {
|
|
|
64
65
|
sourcePreset,
|
|
65
66
|
...(target.defaultPageFlags ? { defaultPageFlags: target.defaultPageFlags } : {}),
|
|
66
67
|
...(target.landingPage ? { landingPage: true } : {}),
|
|
68
|
+
...(target.pageRecord ? { pageRecord: { providerKey: target.pageRecord.providerKey } } : {}),
|
|
67
69
|
});
|
|
68
70
|
}
|
|
69
71
|
/**
|
|
@@ -32,5 +32,5 @@ export type PhiCmsRegionOwnership = "shell" | "page";
|
|
|
32
32
|
* know is not a placement anybody chose -- refusing it would hide Widgets over a typo.
|
|
33
33
|
*/
|
|
34
34
|
export declare function phiCmsRegionAcceptsWidget(regionKey: string | null | undefined, required: PhiCmsRegionOwnership | null | undefined): boolean;
|
|
35
|
-
export declare function resolvePhiCmsRegionType(regionKey: string | null | undefined):
|
|
35
|
+
export declare function resolvePhiCmsRegionType(regionKey: string | null | undefined): 10 | 40 | 12 | 50 | 11 | 20 | 21 | 25 | 30 | 39 | 41;
|
|
36
36
|
export declare function resolvePhiCmsRegionKey(regionType: number | null | undefined): "content" | "header_top" | "header_main" | "header_bottom" | "sider_left" | "sider_right" | "hero" | "footer_top" | "footer_main" | "footer_bottom" | "drawer_right" | undefined;
|
|
@@ -23,8 +23,8 @@ export declare const PHI_GLASS_LAYOUT_EFFECT_DEFINITIONS: {
|
|
|
23
23
|
};
|
|
24
24
|
export declare const PHI_SHADOW_DEFINITIONS: {
|
|
25
25
|
readonly none: "none";
|
|
26
|
-
readonly soft: "var(--
|
|
27
|
-
readonly strong: "var(--
|
|
26
|
+
readonly soft: "var(--phi-box-shadow-tertiary)";
|
|
27
|
+
readonly strong: "var(--phi-box-shadow)";
|
|
28
28
|
};
|
|
29
29
|
export declare function resolvePhiShadow(value: PhiShadow | null | undefined): CSSProperties["boxShadow"] | undefined;
|
|
30
30
|
export declare function resolvePhiLayoutEffectStyle({ effect, background, }: {
|
|
@@ -7,7 +7,10 @@ import type { PhiResolvedCmsPageTree } from "../types/cms";
|
|
|
7
7
|
* on what an author saves in the Builder: there the scale is what the Inspector offers, and a value off it
|
|
8
8
|
* is the author's to choose.
|
|
9
9
|
*
|
|
10
|
-
* It reads the stated config only and resolves nothing: a distance is a step of `PHI_SPACE` or nothing
|
|
10
|
+
* It reads the stated config only and resolves nothing: a distance is a step of `PHI_SPACE` or nothing, and
|
|
11
|
+
* a Layout's config is one its own parser takes -- a Grid of five columns is refused, for the Grid takes 1,
|
|
12
|
+
* 2, 3, 4 or 6, and on a live page a Layout whose config is refused is left out without a message. Widget
|
|
13
|
+
* configs are not parsed here; their parsers live with the Widgets.
|
|
11
14
|
*/
|
|
12
15
|
export type PhiPageLayoutFinding = {
|
|
13
16
|
/** The node's label, or its id where it has none. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PhiCmsRegionType } from "../constants/phi-cms";
|
|
2
2
|
import { PHI_SPACE } from "../theme/antd-css-var-contract";
|
|
3
|
+
import { parsePhiCmsCarouselLayoutConfig, parsePhiCmsCollapsibleLayoutConfig, parsePhiCmsContentLayoutConfig, parsePhiCmsFlexLayoutConfig, parsePhiCmsFlexVerticalLayoutConfig, parsePhiCmsGridLayoutConfig, parsePhiCmsMasonryLayoutConfig, parsePhiCmsSplitCardLayoutConfig, parsePhiCmsStackLayoutConfig, parsePhiCmsThreeColumnLayoutConfig, } from "../types/cms-config";
|
|
3
4
|
import { readPhiSurface } from "../types/surface";
|
|
4
5
|
const SPACING_KEYS = ["padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "gap"];
|
|
5
6
|
const PADDING_KEYS = SPACING_KEYS.filter((key) => key !== "gap");
|
|
@@ -8,6 +9,19 @@ const PRESET_STEPS = ["xxs", "xs", "sm", "base", "md"];
|
|
|
8
9
|
const EMPHASIS_STEPS = ["lg", "xl", "xxl"];
|
|
9
10
|
/** Layouts that bring a padding of their own by default (LAYOUTING.md): stated, or they keep it. */
|
|
10
11
|
const DEFAULT_PADDED_LAYOUTS = new Set(["grid", "masonry", "three-column"]);
|
|
12
|
+
/** The strict parser of each Layout type that has one in the contract layer (the plugins' `parseConfig`). */
|
|
13
|
+
const LAYOUT_CONFIG_PARSERS = {
|
|
14
|
+
content: parsePhiCmsContentLayoutConfig,
|
|
15
|
+
flex: parsePhiCmsFlexLayoutConfig,
|
|
16
|
+
"flex-vertical": parsePhiCmsFlexVerticalLayoutConfig,
|
|
17
|
+
masonry: parsePhiCmsMasonryLayoutConfig,
|
|
18
|
+
stack: parsePhiCmsStackLayoutConfig,
|
|
19
|
+
carousel: parsePhiCmsCarouselLayoutConfig,
|
|
20
|
+
collapsible: parsePhiCmsCollapsibleLayoutConfig,
|
|
21
|
+
grid: parsePhiCmsGridLayoutConfig,
|
|
22
|
+
"three-column": parsePhiCmsThreeColumnLayoutConfig,
|
|
23
|
+
"split-card": parsePhiCmsSplitCardLayoutConfig,
|
|
24
|
+
};
|
|
11
25
|
function stepOf(value) {
|
|
12
26
|
if (value === 0 || value === "0")
|
|
13
27
|
return "none";
|
|
@@ -68,6 +82,18 @@ export function checkPhiPagePresetLayout(tree) {
|
|
|
68
82
|
const config = (node.config ?? {});
|
|
69
83
|
const typeKey = typeKeyOf(node);
|
|
70
84
|
const surface = readPhiSurface(config.surface);
|
|
85
|
+
const parse = Object.hasOwn(LAYOUT_CONFIG_PARSERS, typeKey) ? LAYOUT_CONFIG_PARSERS[typeKey] : undefined;
|
|
86
|
+
if (parse) {
|
|
87
|
+
try {
|
|
88
|
+
parse(config);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
findings.push({
|
|
92
|
+
node: nameOf(node),
|
|
93
|
+
message: `its config is refused: ${error instanceof Error ? error.message : String(error)}`,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
71
97
|
for (const key of SPACING_KEYS) {
|
|
72
98
|
const value = config[key];
|
|
73
99
|
if (value == null)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PhiRecordField, PhiRecordFieldKind, PhiRecordFieldValueByKind } from "../types/record-provider";
|
|
2
|
+
/** `value` as a field of `kind`, or `undefined` where it is not one. */
|
|
3
|
+
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`. */
|
|
7
|
+
export declare function formatPhiRecordFieldText(field: Extract<PhiRecordField, {
|
|
8
|
+
kind: (typeof PHI_RECORD_TEXT_FIELD_KINDS)[number];
|
|
9
|
+
}>, locale: string): string;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* A record field's value, checked against its declared kind (`types/record-provider.ts`).
|
|
3
|
+
*
|
|
4
|
+
* A Module hands these over and a Core Widget draws them unseen, so the kind is the whole agreement: a
|
|
5
|
+
* value that is not of its kind answers `undefined` and is not drawn.
|
|
6
|
+
*/
|
|
7
|
+
function isRecord(value) {
|
|
8
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9
|
+
}
|
|
10
|
+
/** An address a record may name: absolute over http(s), or Site-relative. Never a scheme of its own. */
|
|
11
|
+
function readAddress(value) {
|
|
12
|
+
if (typeof value !== "string")
|
|
13
|
+
return undefined;
|
|
14
|
+
const address = value.trim();
|
|
15
|
+
return /^https?:\/\//iu.test(address) || (address.startsWith("/") && !address.startsWith("//")) ? address : undefined;
|
|
16
|
+
}
|
|
17
|
+
function readPicture(value) {
|
|
18
|
+
if (!isRecord(value))
|
|
19
|
+
return undefined;
|
|
20
|
+
const src = readAddress(value.src);
|
|
21
|
+
if (!src)
|
|
22
|
+
return undefined;
|
|
23
|
+
return typeof value.alt === "string" && value.alt ? { src, alt: value.alt } : { src };
|
|
24
|
+
}
|
|
25
|
+
const TAG_TONES = ["default", "success", "warning", "error"];
|
|
26
|
+
function readTag(value) {
|
|
27
|
+
if (!isRecord(value) || typeof value.label !== "string" || !value.label.trim())
|
|
28
|
+
return undefined;
|
|
29
|
+
if (value.tone === undefined)
|
|
30
|
+
return { label: value.label };
|
|
31
|
+
return typeof value.tone === "string" && TAG_TONES.includes(value.tone)
|
|
32
|
+
? { label: value.label, tone: value.tone }
|
|
33
|
+
: undefined;
|
|
34
|
+
}
|
|
35
|
+
function readLink(value) {
|
|
36
|
+
if (!isRecord(value))
|
|
37
|
+
return undefined;
|
|
38
|
+
const href = readAddress(value.href);
|
|
39
|
+
if (!href)
|
|
40
|
+
return undefined;
|
|
41
|
+
return typeof value.label === "string" && value.label ? { href, label: value.label } : { href };
|
|
42
|
+
}
|
|
43
|
+
function readAll(value, read) {
|
|
44
|
+
if (!Array.isArray(value))
|
|
45
|
+
return undefined;
|
|
46
|
+
const entries = value.map(read);
|
|
47
|
+
return entries.every((entry) => entry !== undefined) ? entries : undefined;
|
|
48
|
+
}
|
|
49
|
+
export function readPhiRecordFieldValue(kind, value) {
|
|
50
|
+
switch (kind) {
|
|
51
|
+
case "text":
|
|
52
|
+
case "markdown":
|
|
53
|
+
return typeof value === "string" ? value : undefined;
|
|
54
|
+
case "picture":
|
|
55
|
+
return readPicture(value);
|
|
56
|
+
case "pictures":
|
|
57
|
+
return readAll(value, readPicture);
|
|
58
|
+
case "list":
|
|
59
|
+
return readAll(value, (entry) => (typeof entry === "string" ? entry : undefined));
|
|
60
|
+
case "tag":
|
|
61
|
+
return readTag(value);
|
|
62
|
+
case "date":
|
|
63
|
+
return typeof value === "string" && !Number.isNaN(Date.parse(value)) ? value : undefined;
|
|
64
|
+
case "number":
|
|
65
|
+
return typeof value === "number" && Number.isFinite(value) ? value : undefined;
|
|
66
|
+
case "link":
|
|
67
|
+
return readLink(value);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/** The kinds a line of text can show: a text as it is, a number and a date in the page's language. */
|
|
71
|
+
export const PHI_RECORD_TEXT_FIELD_KINDS = ["text", "number", "date"];
|
|
72
|
+
/** A text, number or date field as the words a page shows, written for `locale`. */
|
|
73
|
+
export function formatPhiRecordFieldText(field, locale) {
|
|
74
|
+
if (field.kind === "text")
|
|
75
|
+
return field.value;
|
|
76
|
+
try {
|
|
77
|
+
return field.kind === "number"
|
|
78
|
+
? new Intl.NumberFormat(locale).format(field.value)
|
|
79
|
+
: new Intl.DateTimeFormat(locale, { dateStyle: "medium" }).format(new Date(field.value));
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return String(field.value);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -11,7 +11,7 @@ export declare const PHI_SURFACE_CARD: {
|
|
|
11
11
|
readonly background: {
|
|
12
12
|
readonly base: {
|
|
13
13
|
readonly kind: "color";
|
|
14
|
-
readonly color: "var(--
|
|
14
|
+
readonly color: "var(--phi-color-bg-container)";
|
|
15
15
|
};
|
|
16
16
|
readonly overlay: null;
|
|
17
17
|
readonly filter: null;
|
|
@@ -20,7 +20,7 @@ export declare const PHI_SURFACE_CARD: {
|
|
|
20
20
|
readonly border: {
|
|
21
21
|
readonly borderWidth: 1;
|
|
22
22
|
readonly borderStyle: "solid";
|
|
23
|
-
readonly borderColor: "var(--
|
|
23
|
+
readonly borderColor: "var(--phi-color-border-secondary)";
|
|
24
24
|
};
|
|
25
25
|
readonly shadow: "soft";
|
|
26
26
|
};
|
|
@@ -33,7 +33,7 @@ export declare const PHI_SURFACE_WASH: {
|
|
|
33
33
|
readonly background: {
|
|
34
34
|
readonly base: {
|
|
35
35
|
readonly kind: "color";
|
|
36
|
-
readonly color: "var(--
|
|
36
|
+
readonly color: "var(--phi-color-fill-quaternary)";
|
|
37
37
|
};
|
|
38
38
|
readonly overlay: null;
|
|
39
39
|
readonly filter: null;
|
|
@@ -46,7 +46,7 @@ export declare const PHI_SURFACE_PRESETS: {
|
|
|
46
46
|
readonly background: {
|
|
47
47
|
readonly base: {
|
|
48
48
|
readonly kind: "color";
|
|
49
|
-
readonly color: "var(--
|
|
49
|
+
readonly color: "var(--phi-color-bg-container)";
|
|
50
50
|
};
|
|
51
51
|
readonly overlay: null;
|
|
52
52
|
readonly filter: null;
|
|
@@ -55,7 +55,7 @@ export declare const PHI_SURFACE_PRESETS: {
|
|
|
55
55
|
readonly border: {
|
|
56
56
|
readonly borderWidth: 1;
|
|
57
57
|
readonly borderStyle: "solid";
|
|
58
|
-
readonly borderColor: "var(--
|
|
58
|
+
readonly borderColor: "var(--phi-color-border-secondary)";
|
|
59
59
|
};
|
|
60
60
|
readonly shadow: "soft";
|
|
61
61
|
};
|
|
@@ -63,7 +63,7 @@ export declare const PHI_SURFACE_PRESETS: {
|
|
|
63
63
|
readonly background: {
|
|
64
64
|
readonly base: {
|
|
65
65
|
readonly kind: "color";
|
|
66
|
-
readonly color: "var(--
|
|
66
|
+
readonly color: "var(--phi-color-fill-quaternary)";
|
|
67
67
|
};
|
|
68
68
|
readonly overlay: null;
|
|
69
69
|
readonly filter: null;
|
|
@@ -51,7 +51,7 @@ export type PhiSurfaceStyleOptions = {
|
|
|
51
51
|
groundLayer?: boolean;
|
|
52
52
|
};
|
|
53
53
|
/** The ground a toned Surface paints where it states none: the container ground of the tone's mode. */
|
|
54
|
-
export declare const PHI_SURFACE_TONE_GROUND = "var(--
|
|
54
|
+
export declare const PHI_SURFACE_TONE_GROUND = "var(--phi-color-bg-container)";
|
|
55
55
|
/**
|
|
56
56
|
* Whether a Surface takes its tone's ground (`PHI_SURFACE_TONE_GROUND`): it asks for a mode of its own and
|
|
57
57
|
* its Background paints nothing. A stated ground wins, and the Theme's Overlay (`base.kind: "theme"`) is
|
package/helpers.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ export * from "./helpers/widget-dimension-plugin-fields";
|
|
|
10
10
|
export * from "./helpers/translation-format";
|
|
11
11
|
export { buildPhiCmsLayoutNode, buildPhiCmsWidgetNode, } from "./helpers/cms-node-factories";
|
|
12
12
|
export * from "./helpers/cms-preset-nodes";
|
|
13
|
-
export { checkPhiPagePresetLayout, type PhiPageLayoutFinding } from "./helpers/page-layout-check";
|
|
14
13
|
export * from "./helpers/cms-dialog";
|
|
15
14
|
export { buildPhiSettingsPageShellTree, type PhiSettingsPageShellFormSection, type PhiSettingsPageShellOverlay, type PhiSettingsPageShellPanel, type PhiSettingsPageShellSection, type PhiSettingsPageShellWidgetSection, } from "./components/regions/presets/phi-settings-page-shell-tree";
|
|
16
15
|
export * from "./helpers/format-date-time";
|
package/helpers.js
CHANGED
|
@@ -10,8 +10,6 @@ export * from "./helpers/widget-dimension-plugin-fields";
|
|
|
10
10
|
export * from "./helpers/translation-format";
|
|
11
11
|
export { buildPhiCmsLayoutNode, buildPhiCmsWidgetNode, } from "./helpers/cms-node-factories";
|
|
12
12
|
export * from "./helpers/cms-preset-nodes";
|
|
13
|
-
/* The Page rule as a check, for a package to run over the trees its presets build (THIRD_PARTY_MODULES.md 6b). */
|
|
14
|
-
export { checkPhiPagePresetLayout } from "./helpers/page-layout-check";
|
|
15
13
|
export * from "./helpers/cms-dialog";
|
|
16
14
|
/*
|
|
17
15
|
* The one Settings page shell (SETTINGS.md section 4). Public because the contract holds for every
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a Module package needs to check its own preset Pages in its own verify step, and nothing else
|
|
3
|
+
* (THIRD_PARTY_MODULES.md, "Checking a Page preset").
|
|
4
|
+
*
|
|
5
|
+
* Narrow because it is verify-time tooling: it carries the Layout config parsers, which a Site's runtime
|
|
6
|
+
* must not load for this. A package runs the check in its own tests over the trees its route presets
|
|
7
|
+
* build, and treats a finding as an error; it is never called while a Site serves a request, and so it is
|
|
8
|
+
* never part of `@phis/ui/helpers`.
|
|
9
|
+
*
|
|
10
|
+
* No `server-only` here, on purpose: a test in a package loads this door without a mock.
|
|
11
|
+
*/
|
|
12
|
+
export { checkPhiPagePresetLayout, type PhiPageLayoutFinding } from "./helpers/page-layout-check";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a Module package needs to check its own preset Pages in its own verify step, and nothing else
|
|
3
|
+
* (THIRD_PARTY_MODULES.md, "Checking a Page preset").
|
|
4
|
+
*
|
|
5
|
+
* Narrow because it is verify-time tooling: it carries the Layout config parsers, which a Site's runtime
|
|
6
|
+
* must not load for this. A package runs the check in its own tests over the trees its route presets
|
|
7
|
+
* build, and treats a finding as an error; it is never called while a Site serves a request, and so it is
|
|
8
|
+
* never part of `@phis/ui/helpers`.
|
|
9
|
+
*
|
|
10
|
+
* No `server-only` here, on purpose: a test in a package loads this door without a mock.
|
|
11
|
+
*/
|
|
12
|
+
export { checkPhiPagePresetLayout } from "./helpers/page-layout-check";
|