@phis/ui 0.4.22 → 0.5.0
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/components/controls/phi-background-control.js +1 -1
- package/components/controls/phi-brand-control.d.ts +6 -1
- package/components/controls/phi-brand-control.js +2 -2
- package/components/controls/phi-breadcrumb-control.d.ts +2 -0
- package/components/media/media-asset-typed-fields.d.ts +10 -0
- package/components/media/media-asset-typed-fields.js +19 -0
- package/components/media/media-settings-labels.d.ts +33 -0
- package/components/media/media-settings-labels.js +62 -0
- package/components/media/media-upload-flow.d.ts +19 -0
- package/components/media/media-upload-flow.js +38 -0
- package/components/media/phi-asset-focal-rect-widget.js +2 -2
- package/components/media/phi-image-inspector-widget.js +1 -1
- package/components/media/phi-image-preview-data.js +5 -4
- package/components/media/phi-site-font-assets.js +2 -5
- package/components/media/use-authoring-asset-details.js +0 -1
- package/components/regions/presets/navigation-redirect.d.ts +2 -2
- package/components/regions/presets/navigation-redirect.js +3 -3
- package/components/regions/presets/phi-area-shell-preset-nodes.js +2 -1
- package/components/widgets/helpers/internal-reference-resolver.server.d.ts +1 -1
- package/components/widgets/helpers/internal-reference-resolver.server.js +4 -0
- package/components/widgets/label-sets/builder-modules.js +6 -0
- package/components/widgets/label-types/builder-modules.d.ts +4 -0
- package/components/widgets/label-types/builder-modules.js +3 -0
- package/components/widgets/shared/markdown-render.js +30 -135
- package/components/widgets/shared/markdown-translation-unit.d.ts +62 -0
- package/components/widgets/shared/markdown-translation-unit.js +211 -0
- package/constants/runtime-module-ownership.js +4 -0
- package/gateway/internal-references.d.ts +5 -0
- package/gateway/internal-references.js +12 -12
- package/gateway/site-media-settings.d.ts +2 -0
- package/gateway/site-media-settings.js +6 -1
- package/gateway/site-media-storage-reader.d.ts +19 -0
- package/gateway/site-media-storage-reader.js +24 -0
- package/helpers/cms-navigation-catalog.d.ts +2 -0
- package/helpers/cms-navigation-catalog.js +1 -0
- package/helpers/cms-page-catalog.d.ts +12 -0
- package/helpers/cms-page-catalog.js +5 -0
- package/helpers/phi-seo.d.ts +16 -2
- package/helpers/phi-seo.js +54 -11
- package/helpers/public-route-claims.d.ts +4 -0
- package/helpers/public-route-claims.js +1 -1
- package/next/seo-routes.d.ts +1 -1
- package/next/seo-routes.js +23 -5
- package/package.json +1 -1
- package/plugins/runtime-modules/area-definitions.d.ts +75 -6
- package/plugins/runtime-modules/area-definitions.js +20 -0
- package/plugins/runtime-modules/asset/client-data-providers.js +12 -0
- package/plugins/runtime-modules/asset/controller/runtime.js +1 -1
- package/plugins/runtime-modules/asset/data-providers.d.ts +27 -2
- package/plugins/runtime-modules/asset/data-providers.js +56 -0
- package/plugins/runtime-modules/asset/definition.d.ts +38 -2
- package/plugins/runtime-modules/asset/definition.js +2 -1
- package/plugins/runtime-modules/asset/ids.d.ts +4 -0
- package/plugins/runtime-modules/asset/ids.js +4 -0
- package/plugins/runtime-modules/asset/server.js +2 -1
- package/plugins/runtime-modules/asset/services/options.d.ts +7 -0
- package/plugins/runtime-modules/asset/services/options.js +38 -0
- package/plugins/runtime-modules/asset/services/storage-spaces-table.d.ts +3 -0
- package/plugins/runtime-modules/asset/services/storage-spaces-table.js +89 -0
- package/plugins/runtime-modules/asset/settings-forms.d.ts +17 -0
- package/plugins/runtime-modules/asset/settings-forms.js +117 -1
- package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +94 -1
- package/plugins/runtime-modules/builder/area-shell-presets.server.d.ts +8 -0
- package/plugins/runtime-modules/builder/area-shell-presets.server.js +13 -0
- package/plugins/runtime-modules/builder/controller/page-controller-helpers.js +1 -1
- package/plugins/runtime-modules/builder/controller/page-controller.d.ts +1 -1
- package/plugins/runtime-modules/builder/controller/page-controller.js +30 -3
- package/plugins/runtime-modules/builder/controller/server-definition.d.ts +7 -1
- package/plugins/runtime-modules/builder/controller/server-definition.js +8 -3
- package/plugins/runtime-modules/builder/data-providers.js +1 -0
- package/plugins/runtime-modules/builder/developer-workspace-types.d.ts +2 -0
- package/plugins/runtime-modules/builder/navigation-path-context.js +7 -3
- package/plugins/runtime-modules/builder/options-providers.js +2 -2
- package/plugins/runtime-modules/builder/page-address-rule.d.ts +39 -0
- package/plugins/runtime-modules/builder/page-address-rule.js +62 -0
- package/plugins/runtime-modules/builder/page-meta-form.js +10 -0
- package/plugins/runtime-modules/builder/public-route-collisions.js +7 -2
- package/plugins/runtime-modules/builder/services/page-source-tree.js +2 -1
- package/plugins/runtime-modules/builder/services/runtime-modules-table.js +49 -1
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +14 -2
- package/plugins/runtime-modules/core/widgets/brand/client.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/brand/client.js +2 -1
- package/plugins/runtime-modules/core/widgets/brand/plugin.js +23 -2
- package/plugins/runtime-modules/core/widgets/brand/server.d.ts +2 -2
- package/plugins/runtime-modules/core/widgets/brand/server.js +2 -1
- package/plugins/runtime-modules/core/widgets/breadcrumb/client.d.ts +14 -2
- package/plugins/runtime-modules/core/widgets/breadcrumb/client.js +35 -4
- package/plugins/runtime-modules/core/widgets/breadcrumb/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/breadcrumb/server.js +37 -2
- package/plugins/runtime-modules/core/widgets/card/editor.js +1 -1
- package/plugins/runtime-modules/core/widgets/card/server.js +7 -4
- package/plugins/runtime-modules/core/widgets/gallery/plugin.js +3 -1
- package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/gallery/server.js +12 -2
- package/plugins/runtime-modules/core/widgets/image/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/image/editor.js +1 -1
- package/plugins/runtime-modules/core/widgets/image/server.js +28 -5
- package/plugins/runtime-modules/core/widgets/page-title/authoring.js +3 -1
- package/plugins/runtime-modules/core/widgets/page-title/client.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/page-title/client.js +5 -1
- package/plugins/runtime-modules/core/widgets/page-title/config.d.ts +25 -3
- package/plugins/runtime-modules/core/widgets/page-title/config.js +24 -3
- package/plugins/runtime-modules/core/widgets/page-title/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/page-title/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/page-title/server.js +4 -3
- package/plugins/runtime-modules/core/widgets/table/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/table/config.js +9 -0
- package/plugins/runtime-modules/descriptor-compiler.js +33 -8
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +1 -1
- package/server-helpers/cms-review-params.d.ts +25 -0
- package/server-helpers/cms-review-params.js +54 -0
- package/server-helpers/cms-review.d.ts +1 -25
- package/server-helpers/cms-review.js +2 -54
- package/types/cms-module-descriptors.d.ts +33 -3
- package/types/media.d.ts +6 -2
- package/types/table-widget.d.ts +11 -0
- package/types.d.ts +1 -1
|
@@ -508,7 +508,7 @@ export function PhiBackgroundControl({ value, config, disabled = false, mode = "
|
|
|
508
508
|
deliveryUrl: asset.deliveryUrl ?? null,
|
|
509
509
|
deliveryRevision: asset.deliveryRevision ?? null,
|
|
510
510
|
variantVersion: asset.variantVersion ?? null,
|
|
511
|
-
focalRect: normalizeMediaFocalRect(asset.
|
|
511
|
+
focalRect: normalizeMediaFocalRect(asset.focalRect ?? null),
|
|
512
512
|
width: asset.width ?? null,
|
|
513
513
|
height: asset.height ?? null,
|
|
514
514
|
};
|
|
@@ -19,6 +19,11 @@ export type PhiBrandControlProps = {
|
|
|
19
19
|
* has one colour per mode for the same reason.
|
|
20
20
|
*/
|
|
21
21
|
mode: PhiThemeMode;
|
|
22
|
+
/**
|
|
23
|
+
* What a screen reader says for the Logo, in the page's language: the Brand Widget translates it on the
|
|
24
|
+
* Server. Absent -- the Theme workspace -- it is the Theme's own text as written.
|
|
25
|
+
*/
|
|
26
|
+
logoAlt?: string;
|
|
22
27
|
};
|
|
23
28
|
/**
|
|
24
29
|
* The address a mode's Logo is drawn from, or none.
|
|
@@ -68,4 +73,4 @@ export declare function phiBrandControlIsEmpty({ brand, fallbackTitle, shows, mo
|
|
|
68
73
|
* like while it is being set. The preview used to import the Widget for it, which is the one thing a
|
|
69
74
|
* Widget may not do to another Widget; what it actually needed was this.
|
|
70
75
|
*/
|
|
71
|
-
export declare function PhiBrandControl({ brand, fallbackTitle, shows, mode, }: PhiBrandControlProps): import("react").JSX.Element | null;
|
|
76
|
+
export declare function PhiBrandControl({ brand, fallbackTitle, shows, mode, logoAlt: logoAltProp, }: PhiBrandControlProps): import("react").JSX.Element | null;
|
|
@@ -113,7 +113,7 @@ export function phiBrandControlIsEmpty({ brand, fallbackTitle, shows = "lockup",
|
|
|
113
113
|
* like while it is being set. The preview used to import the Widget for it, which is the one thing a
|
|
114
114
|
* Widget may not do to another Widget; what it actually needed was this.
|
|
115
115
|
*/
|
|
116
|
-
export function PhiBrandControl({ brand, fallbackTitle, shows = "lockup", mode, }) {
|
|
116
|
+
export function PhiBrandControl({ brand, fallbackTitle, shows = "lockup", mode, logoAlt: logoAltProp, }) {
|
|
117
117
|
/*
|
|
118
118
|
* The Eyebrow travels with the Wordmark, so it goes where the Wordmark does -- switched off by the
|
|
119
119
|
* Brand as much as left out by the placement. It is the line above the name; above a bare Logo it
|
|
@@ -142,7 +142,7 @@ export function PhiBrandControl({ brand, fallbackTitle, shows = "lockup", mode,
|
|
|
142
142
|
* way to say "wordmark only" at all. The Wordmark carries the Brand where nothing is picked.
|
|
143
143
|
*/
|
|
144
144
|
const logoUrl = shows === "wordmark" ? null : resolvePhiBrandLogoUrl(brand, mode);
|
|
145
|
-
const logoAlt = brand?.logoAlt?.trim() || "Brand logo";
|
|
145
|
+
const logoAlt = logoAltProp?.trim() || brand?.logoAlt?.trim() || "Brand logo";
|
|
146
146
|
if (!logoUrl && !wordmarkNode && !eyebrow) {
|
|
147
147
|
return null;
|
|
148
148
|
}
|
|
@@ -2,6 +2,8 @@ import type { ReactNode } from "react";
|
|
|
2
2
|
export type PhiBreadcrumbControlItem = {
|
|
3
3
|
key?: string;
|
|
4
4
|
title: ReactNode;
|
|
5
|
+
/** Where the item leads; an item without one is text. */
|
|
6
|
+
href?: string;
|
|
5
7
|
};
|
|
6
8
|
export type PhiBreadcrumbControlProps = {
|
|
7
9
|
items: readonly PhiBreadcrumbControlItem[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type PhiConfigReader } from "../widgets/config/strict-config-reader";
|
|
2
|
+
import type { PhiFontMetrics } from "../../types/media";
|
|
3
|
+
import type { MediaFocalRect } from "./focal-rect";
|
|
4
|
+
/**
|
|
5
|
+
* The entries of an Asset's stored `meta` a client acts on, as the server sends them: typed fields, never
|
|
6
|
+
* `meta` itself. One reader for every response that carries them -- the management tile and detail as much
|
|
7
|
+
* as the public reference projection -- so the three cannot disagree about what a focal rectangle is.
|
|
8
|
+
*/
|
|
9
|
+
export declare function readPhiMediaFocalRectField(reader: PhiConfigReader): MediaFocalRect | null;
|
|
10
|
+
export declare function readPhiMediaFontField(reader: PhiConfigReader): PhiFontMetrics | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { readPhiFontMetricsFields } from "./media-font-metrics";
|
|
2
|
+
import { requirePhiField } from "../widgets/config/strict-config-reader";
|
|
3
|
+
/**
|
|
4
|
+
* The entries of an Asset's stored `meta` a client acts on, as the server sends them: typed fields, never
|
|
5
|
+
* `meta` itself. One reader for every response that carries them -- the management tile and detail as much
|
|
6
|
+
* as the public reference projection -- so the three cannot disagree about what a focal rectangle is.
|
|
7
|
+
*/
|
|
8
|
+
export function readPhiMediaFocalRectField(reader) {
|
|
9
|
+
return reader.object("focalRect", (rect) => {
|
|
10
|
+
const fraction = (key) => {
|
|
11
|
+
const value = requirePhiField(rect, key, "a number from 0 to 1", rect.number);
|
|
12
|
+
return value >= 0 && value <= 1 ? value : rect.fail(key, "a number from 0 to 1");
|
|
13
|
+
};
|
|
14
|
+
return { x: fraction("x"), y: fraction("y"), width: fraction("width"), height: fraction("height") };
|
|
15
|
+
}) ?? null;
|
|
16
|
+
}
|
|
17
|
+
export function readPhiMediaFontField(reader) {
|
|
18
|
+
return reader.object("font", readPhiFontMetricsFields) ?? null;
|
|
19
|
+
}
|
|
@@ -39,5 +39,38 @@ export declare function getPhiMediaSettingsPageLabels(options: PhiGlobalTranslat
|
|
|
39
39
|
title: string;
|
|
40
40
|
empty: string;
|
|
41
41
|
};
|
|
42
|
+
storage: {
|
|
43
|
+
title: string;
|
|
44
|
+
description: string;
|
|
45
|
+
siteSpace: string;
|
|
46
|
+
siteSpaceHint: string;
|
|
47
|
+
siteSpaceRequired: string;
|
|
48
|
+
defaultUser: string;
|
|
49
|
+
defaultUserHint: string;
|
|
50
|
+
defaultGroup: string;
|
|
51
|
+
defaultGroupHint: string;
|
|
52
|
+
local: string;
|
|
53
|
+
allowed: string;
|
|
54
|
+
allowedHint: string;
|
|
55
|
+
all: string;
|
|
56
|
+
disabled: string;
|
|
57
|
+
disabledHint: string;
|
|
58
|
+
none: string;
|
|
59
|
+
};
|
|
60
|
+
spaces: {
|
|
61
|
+
title: string;
|
|
62
|
+
description: string;
|
|
63
|
+
userTable: string;
|
|
64
|
+
groupTable: string;
|
|
65
|
+
owner: string;
|
|
66
|
+
email: string;
|
|
67
|
+
profile: string;
|
|
68
|
+
quota: string;
|
|
69
|
+
quotaHint: string;
|
|
70
|
+
effective: string;
|
|
71
|
+
used: string;
|
|
72
|
+
search: string;
|
|
73
|
+
empty: string;
|
|
74
|
+
};
|
|
42
75
|
submitLabel: string;
|
|
43
76
|
}>;
|
|
@@ -35,6 +35,35 @@ const PHI_MEDIA_SETTINGS_PAGE_LABEL_SET = definePhiLabelSet({
|
|
|
35
35
|
addon_spaces_title: "Add-on stores",
|
|
36
36
|
addon_spaces_empty: definePhiMessageLabel("No Add-on holds files on this site."),
|
|
37
37
|
submit_label: "Save",
|
|
38
|
+
storage_title: "Storage",
|
|
39
|
+
storage_description: definePhiMessageLabel("Where this site's Spaces write new uploads. The storage profiles themselves are created by the operator; changing where a Space writes moves no files."),
|
|
40
|
+
storage_site_space_label: "Site Space",
|
|
41
|
+
storage_site_space_hint: definePhiMessageLabel("Where uploads into the site's own media go."),
|
|
42
|
+
storage_site_space_required: definePhiMessageLabel("Choose where the site's own media is stored."),
|
|
43
|
+
storage_default_user_label: "New User Spaces",
|
|
44
|
+
storage_default_user_hint: definePhiMessageLabel("Where a User Space created from now on writes. Existing User Spaces keep theirs."),
|
|
45
|
+
storage_default_group_label: "New Group Spaces",
|
|
46
|
+
storage_default_group_hint: definePhiMessageLabel("Where a Group Space created from now on writes. Existing Group Spaces keep theirs."),
|
|
47
|
+
storage_local_placeholder: "Local storage",
|
|
48
|
+
storage_allowed_label: "Offered profiles",
|
|
49
|
+
storage_allowed_hint: definePhiMessageLabel("The storage profiles a Space may be pointed at. Empty offers every profile."),
|
|
50
|
+
storage_all_placeholder: "All profiles",
|
|
51
|
+
storage_disabled_label: "Paused profiles",
|
|
52
|
+
storage_disabled_hint: definePhiMessageLabel("A paused profile still delivers what it holds but takes no new uploads."),
|
|
53
|
+
storage_none_placeholder: "None",
|
|
54
|
+
spaces_title: "Spaces",
|
|
55
|
+
spaces_description: definePhiMessageLabel("The User and Group Spaces that exist, with the storage profile each writes to and its own quota. A Space without a quota of its own follows the site default; changing its profile moves no files."),
|
|
56
|
+
spaces_user_table: "User Spaces",
|
|
57
|
+
spaces_group_table: "Group Spaces",
|
|
58
|
+
spaces_owner: "Owner",
|
|
59
|
+
spaces_email: "Email",
|
|
60
|
+
spaces_profile: "Storage profile",
|
|
61
|
+
spaces_quota: "Own quota",
|
|
62
|
+
spaces_quota_hint: definePhiMessageLabel("Empty follows the site default for this kind of Space."),
|
|
63
|
+
spaces_effective: "Applies",
|
|
64
|
+
spaces_used: "Used",
|
|
65
|
+
spaces_search: "Search",
|
|
66
|
+
spaces_empty: definePhiMessageLabel("No Space of this kind exists yet."),
|
|
38
67
|
},
|
|
39
68
|
});
|
|
40
69
|
export async function getPhiMediaSettingsPageLabels(options) {
|
|
@@ -78,6 +107,39 @@ export async function getPhiMediaSettingsPageLabels(options) {
|
|
|
78
107
|
title: labels.addon_spaces_title,
|
|
79
108
|
empty: labels.addon_spaces_empty,
|
|
80
109
|
},
|
|
110
|
+
storage: {
|
|
111
|
+
title: labels.storage_title,
|
|
112
|
+
description: labels.storage_description,
|
|
113
|
+
siteSpace: labels.storage_site_space_label,
|
|
114
|
+
siteSpaceHint: labels.storage_site_space_hint,
|
|
115
|
+
siteSpaceRequired: labels.storage_site_space_required,
|
|
116
|
+
defaultUser: labels.storage_default_user_label,
|
|
117
|
+
defaultUserHint: labels.storage_default_user_hint,
|
|
118
|
+
defaultGroup: labels.storage_default_group_label,
|
|
119
|
+
defaultGroupHint: labels.storage_default_group_hint,
|
|
120
|
+
local: labels.storage_local_placeholder,
|
|
121
|
+
allowed: labels.storage_allowed_label,
|
|
122
|
+
allowedHint: labels.storage_allowed_hint,
|
|
123
|
+
all: labels.storage_all_placeholder,
|
|
124
|
+
disabled: labels.storage_disabled_label,
|
|
125
|
+
disabledHint: labels.storage_disabled_hint,
|
|
126
|
+
none: labels.storage_none_placeholder,
|
|
127
|
+
},
|
|
128
|
+
spaces: {
|
|
129
|
+
title: labels.spaces_title,
|
|
130
|
+
description: labels.spaces_description,
|
|
131
|
+
userTable: labels.spaces_user_table,
|
|
132
|
+
groupTable: labels.spaces_group_table,
|
|
133
|
+
owner: labels.spaces_owner,
|
|
134
|
+
email: labels.spaces_email,
|
|
135
|
+
profile: labels.spaces_profile,
|
|
136
|
+
quota: labels.spaces_quota,
|
|
137
|
+
quotaHint: labels.spaces_quota_hint,
|
|
138
|
+
effective: labels.spaces_effective,
|
|
139
|
+
used: labels.spaces_used,
|
|
140
|
+
search: labels.spaces_search,
|
|
141
|
+
empty: labels.spaces_empty,
|
|
142
|
+
},
|
|
81
143
|
submitLabel: labels.submit_label,
|
|
82
144
|
};
|
|
83
145
|
}
|
|
@@ -138,7 +138,26 @@ type PhiMediaUploadInitSession = {
|
|
|
138
138
|
uploaded: readonly PhiMediaUploadStoredPart[];
|
|
139
139
|
/** Whether this session was taken over rather than opened, which only the Server can say. */
|
|
140
140
|
resumed: boolean;
|
|
141
|
+
/** Null where the Server asked for none: every plan but one sent in parts. */
|
|
142
|
+
heartbeat: PhiMediaUploadHeartbeat | null;
|
|
141
143
|
};
|
|
144
|
+
type PhiMediaUploadHeartbeat = {
|
|
145
|
+
url: string;
|
|
146
|
+
intervalMs: number;
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* Says, every so often, that this page is still sending the parts of this body.
|
|
150
|
+
*
|
|
151
|
+
* The beacon on `pagehide` covers a reload or a closed tab; a crashed tab, a killed browser or a power cut
|
|
152
|
+
* send nothing at all, and their session would sit as if a page were still writing into it. The Server tells
|
|
153
|
+
* the two apart by this: a session whose beat has lapsed may be continued by the next attempt at the same
|
|
154
|
+
* file, one that is still beating must not be. A 404 means the session is no longer being delivered
|
|
155
|
+
* (finalized, swept, taken over), and beating on would renew nothing. Failures are otherwise ignored: a
|
|
156
|
+
* missed beat costs at most a later continuation, never this upload.
|
|
157
|
+
*
|
|
158
|
+
* Returns the way to stop.
|
|
159
|
+
*/
|
|
160
|
+
export declare function keepPhiMediaUploadHeartbeat(heartbeat: PhiMediaUploadHeartbeat | null): () => void;
|
|
142
161
|
/**
|
|
143
162
|
* What a Client may say about a body it could not deliver.
|
|
144
163
|
*
|
|
@@ -101,6 +101,40 @@ function bindPhiMediaUploadAbort(signal, abort) {
|
|
|
101
101
|
signal.addEventListener("abort", abort, { once: true });
|
|
102
102
|
return () => signal.removeEventListener("abort", abort);
|
|
103
103
|
}
|
|
104
|
+
function readPhiMediaUploadHeartbeat(value) {
|
|
105
|
+
const url = value?.url;
|
|
106
|
+
const intervalMs = value?.intervalMs;
|
|
107
|
+
// A floor, so a Server that misstated the interval cannot turn this into a request loop.
|
|
108
|
+
return typeof url === "string" && url && typeof intervalMs === "number" && intervalMs >= 1_000
|
|
109
|
+
? { url, intervalMs }
|
|
110
|
+
: null;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Says, every so often, that this page is still sending the parts of this body.
|
|
114
|
+
*
|
|
115
|
+
* The beacon on `pagehide` covers a reload or a closed tab; a crashed tab, a killed browser or a power cut
|
|
116
|
+
* send nothing at all, and their session would sit as if a page were still writing into it. The Server tells
|
|
117
|
+
* the two apart by this: a session whose beat has lapsed may be continued by the next attempt at the same
|
|
118
|
+
* file, one that is still beating must not be. A 404 means the session is no longer being delivered
|
|
119
|
+
* (finalized, swept, taken over), and beating on would renew nothing. Failures are otherwise ignored: a
|
|
120
|
+
* missed beat costs at most a later continuation, never this upload.
|
|
121
|
+
*
|
|
122
|
+
* Returns the way to stop.
|
|
123
|
+
*/
|
|
124
|
+
export function keepPhiMediaUploadHeartbeat(heartbeat) {
|
|
125
|
+
if (!heartbeat || typeof window === "undefined") {
|
|
126
|
+
return () => { };
|
|
127
|
+
}
|
|
128
|
+
const timer = window.setInterval(() => {
|
|
129
|
+
void fetch(heartbeat.url, { method: "POST", credentials: "same-origin" })
|
|
130
|
+
.then((response) => {
|
|
131
|
+
if (response.status === 404)
|
|
132
|
+
window.clearInterval(timer);
|
|
133
|
+
})
|
|
134
|
+
.catch(() => undefined);
|
|
135
|
+
}, heartbeat.intervalMs);
|
|
136
|
+
return () => window.clearInterval(timer);
|
|
137
|
+
}
|
|
104
138
|
/**
|
|
105
139
|
* What a Client may say about a body it could not deliver.
|
|
106
140
|
*
|
|
@@ -341,6 +375,7 @@ export async function initPhiMediaUploadSession(file, options, signal) {
|
|
|
341
375
|
expiresAt: payload.expiresAt,
|
|
342
376
|
uploaded,
|
|
343
377
|
resumed: payload.resumed === true,
|
|
378
|
+
heartbeat: payload.plan.kind === "multipart-put" ? readPhiMediaUploadHeartbeat(payload.heartbeat) : null,
|
|
344
379
|
};
|
|
345
380
|
}
|
|
346
381
|
/**
|
|
@@ -637,6 +672,7 @@ async function readPhiMediaUploadCancellation(run, signal) {
|
|
|
637
672
|
export async function runPhiMediaUploadSession(file, onProgress, options, signal) {
|
|
638
673
|
const init = await readPhiMediaUploadCancellation(() => initPhiMediaUploadSession(file, options, signal), signal);
|
|
639
674
|
const standDown = reportPhiMediaUploadAbandonmentOnLeaving(init.reportUrl, init.plan);
|
|
675
|
+
const stopBeating = keepPhiMediaUploadHeartbeat(init.heartbeat);
|
|
640
676
|
let upload;
|
|
641
677
|
try {
|
|
642
678
|
upload = await uploadPhiMediaUploadBody(init.plan, file, onProgress, init.uploaded, signal);
|
|
@@ -644,6 +680,7 @@ export async function runPhiMediaUploadSession(file, onProgress, options, signal
|
|
|
644
680
|
throwIfPhiMediaUploadAborted(signal);
|
|
645
681
|
}
|
|
646
682
|
catch (uploadError) {
|
|
683
|
+
stopBeating();
|
|
647
684
|
standDown();
|
|
648
685
|
// The Server cannot see this leg, so it is told rather than left to infer it from an expiry.
|
|
649
686
|
await reportPhiMediaUploadFailure(init.reportUrl, readPhiMediaUploadFailureReason(uploadError), uploadError instanceof Error ? uploadError.message : null);
|
|
@@ -659,6 +696,7 @@ export async function runPhiMediaUploadSession(file, onProgress, options, signal
|
|
|
659
696
|
* body that has already arrived. What this gives up is the sliver where somebody leaves after the body
|
|
660
697
|
* landed and before finalize was sent, and expiry already answers for that.
|
|
661
698
|
*/
|
|
699
|
+
stopBeating();
|
|
662
700
|
standDown();
|
|
663
701
|
const finalize = await finalizePhiMediaUploadSession(init.finalizeUrl, upload.completion);
|
|
664
702
|
return {
|
|
@@ -56,7 +56,7 @@ export function PhiAssetFocalRectWidget({ config, }) {
|
|
|
56
56
|
return _jsx(PhiAssetFocalRectEditor, { asset: asset, config: config }, asset?.id ?? "");
|
|
57
57
|
}
|
|
58
58
|
function PhiAssetFocalRectEditor({ asset, config, }) {
|
|
59
|
-
const currentRect = useMemo(() => normalizeMediaFocalRect(asset?.
|
|
59
|
+
const currentRect = useMemo(() => normalizeMediaFocalRect(asset?.focalRect), [asset?.focalRect]);
|
|
60
60
|
const [draft, setDraft] = useState(() => currentRect ?? createDefaultFocalRect());
|
|
61
61
|
const originalRef = useRef(currentRect);
|
|
62
62
|
const interactionRef = useRef(null);
|
|
@@ -131,7 +131,7 @@ function PhiAssetFocalRectEditor({ asset, config, }) {
|
|
|
131
131
|
const next = normalizeMediaFocalRect(draft);
|
|
132
132
|
updatePhiImagePreviewAsset(PHI_ASSET_CONTROLLER_STORE_KEY, asset.id, (current) => ({
|
|
133
133
|
...current,
|
|
134
|
-
|
|
134
|
+
focalRect: next,
|
|
135
135
|
}));
|
|
136
136
|
/*
|
|
137
137
|
* The rectangle, and not a field: which field it lands in is written on the route
|
|
@@ -16,7 +16,7 @@ export function PhiAssetConfigWidget({ config, labels, sitePublicUrl }) {
|
|
|
16
16
|
valueType: "none",
|
|
17
17
|
typeKey: "image-inspector-focal-rect",
|
|
18
18
|
});
|
|
19
|
-
return selectedAsset ? (_jsx(PhiAssetInspectorSection, { section: config?.section ?? "preview", asset: selectedAsset, selectedVariantKey: state.selectedVariantKey, sitePublicUrl: sitePublicUrl, labels: labels, focalRect: normalizeMediaFocalRect(selectedAsset.
|
|
19
|
+
return selectedAsset ? (_jsx(PhiAssetInspectorSection, { section: config?.section ?? "preview", asset: selectedAsset, selectedVariantKey: state.selectedVariantKey, sitePublicUrl: sitePublicUrl, labels: labels, focalRect: normalizeMediaFocalRect(selectedAsset.focalRect), onVariantKeyChange: (nextVariantKey) => {
|
|
20
20
|
setPhiImagePreviewSelection(PHI_ASSET_CONTROLLER_STORE_KEY, selectedAsset.id, nextVariantKey ?? null, selectedAssetTile);
|
|
21
21
|
}, onFocalRectOpen: () => focalRectSignals.emitCapability("focalRectOpen", null) })) : null;
|
|
22
22
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PHI_MEDIA_SPACE_KINDS } from "@phis/contracts/media";
|
|
2
|
+
import { readPhiMediaFocalRectField, readPhiMediaFontField } from "./media-asset-typed-fields";
|
|
2
3
|
import { PhiImageAssetVariantKey, PhiMediaKind, resolvePhiMediaKindFromContentType } from "../../constants/media";
|
|
3
4
|
import { createPhiResponseReader, requirePhiField, } from "../widgets/config/strict-config-reader";
|
|
4
5
|
/*
|
|
@@ -95,7 +96,8 @@ function readPhiMediaAssetFields(reader) {
|
|
|
95
96
|
blurDataUrl: nullableString(reader, "blurDataUrl"),
|
|
96
97
|
thumbnailUrl: nullableString(reader, "thumbnailUrl"),
|
|
97
98
|
previewUrl: nullableString(reader, "previewUrl"),
|
|
98
|
-
|
|
99
|
+
focalRect: readPhiMediaFocalRectField(reader),
|
|
100
|
+
font: readPhiMediaFontField(reader),
|
|
99
101
|
title: nullableString(reader, "title"),
|
|
100
102
|
altText: nullableString(reader, "altText"),
|
|
101
103
|
lifecycleStatus: requiredInteger(reader, "lifecycleStatus"),
|
|
@@ -134,7 +136,6 @@ export function readPhiMediaPagination(value, source = PHI_MEDIA_LISTING) {
|
|
|
134
136
|
export function readPhiMediaAssetTiles(value, source = PHI_MEDIA_LISTING) {
|
|
135
137
|
return createPhiResponseReader({ assets: value }, source).list("assets", (reader) => {
|
|
136
138
|
const variantVersion = reader.integer("variantVersion");
|
|
137
|
-
const meta = reader.value("meta", "an object", (entry) => (isPlainRecord(entry) ? entry : undefined));
|
|
138
139
|
const blurDataUrl = reader.string("blurDataUrl");
|
|
139
140
|
const folder = reader.object("folder", (folderReader) => ({
|
|
140
141
|
id: requiredInteger(folderReader, "id"),
|
|
@@ -164,7 +165,8 @@ export function readPhiMediaAssetTiles(value, source = PHI_MEDIA_LISTING) {
|
|
|
164
165
|
deliveryRevision: requiredInteger(reader, "deliveryRevision"),
|
|
165
166
|
presentationFlags: requiredInteger(reader, "presentationFlags"),
|
|
166
167
|
...(blurDataUrl === undefined ? {} : { blurDataUrl }),
|
|
167
|
-
|
|
168
|
+
focalRect: readPhiMediaFocalRectField(reader),
|
|
169
|
+
font: readPhiMediaFontField(reader),
|
|
168
170
|
folder: folder ?? null,
|
|
169
171
|
};
|
|
170
172
|
}) ?? [];
|
|
@@ -238,7 +240,6 @@ export function normalizePhiImagePreviewSelectionAsset(tile) {
|
|
|
238
240
|
...rest,
|
|
239
241
|
kind: tile.kind,
|
|
240
242
|
blurDataUrl: tile.blurDataUrl ?? null,
|
|
241
|
-
meta: tile.meta ?? null,
|
|
242
243
|
folder: null,
|
|
243
244
|
variants: null,
|
|
244
245
|
};
|
|
@@ -4,9 +4,7 @@ import { PhiMediaKind } from "../../constants/media";
|
|
|
4
4
|
import { createPhiAssetUri } from "../../types/references";
|
|
5
5
|
import { usePhiCollectionProvider } from "../widgets/client/shared/phi-collection-provider";
|
|
6
6
|
import { PHI_ASSET_COLLECTION_DATA_SOURCE } from "./asset-collection-runtime";
|
|
7
|
-
import { readPhiFontMetricsFields } from "./media-font-metrics";
|
|
8
7
|
import { readPhiMediaAssetTiles } from "./phi-image-preview-data";
|
|
9
|
-
import { createPhiResponseReader } from "../widgets/config/strict-config-reader";
|
|
10
8
|
/**
|
|
11
9
|
* The typefaces a Site owns, as something a font slot can be set to.
|
|
12
10
|
*
|
|
@@ -21,9 +19,8 @@ import { createPhiResponseReader } from "../widgets/config/strict-config-reader"
|
|
|
21
19
|
/** Enough for any Site's own lettering; a ceiling rather than a page size. */
|
|
22
20
|
const PHI_SITE_FONT_ASSET_LIMIT = 100;
|
|
23
21
|
function readFontAssetMetrics(asset) {
|
|
24
|
-
//
|
|
25
|
-
return
|
|
26
|
-
.object("font", readPhiFontMetricsFields) ?? null;
|
|
22
|
+
// Read off the tile already: the management projection carries the metrics as a typed field.
|
|
23
|
+
return asset.font;
|
|
27
24
|
}
|
|
28
25
|
function readFontAssetLabel(asset) {
|
|
29
26
|
const family = readFontAssetMetrics(asset)?.familyName;
|
|
@@ -50,7 +50,6 @@ export function usePhiAuthoringAssetDetails(assetId) {
|
|
|
50
50
|
return {
|
|
51
51
|
...currentAssetTile,
|
|
52
52
|
blurDataUrl: currentAssetTile.blurDataUrl ?? null,
|
|
53
|
-
meta: currentAssetTile.meta ?? null,
|
|
54
53
|
folder: fetchedAsset?.folder ?? null,
|
|
55
54
|
variants: keepFetchedVariants ? fetchedAsset?.variants ?? null : null,
|
|
56
55
|
};
|
|
@@ -12,8 +12,8 @@ import type { PhiCmsPageNode, PhiResolvedCmsPageTree } from "../../../types/cms"
|
|
|
12
12
|
/**
|
|
13
13
|
* The first place a navigation subtree actually goes.
|
|
14
14
|
*
|
|
15
|
-
* An Overlay opener is not a destination, so it can never be what a redirect lands on, and an
|
|
16
|
-
* address is
|
|
15
|
+
* An Overlay opener is not a destination, so it can never be what a redirect lands on, and neither an
|
|
16
|
+
* external address nor another Area's root is a place in the Area. Neither is the path the redirecting page itself answers: an Area root whose sidebar still carries an item pointing
|
|
17
17
|
* at "/" would forward to itself forever, which is the whole reason `skipPath` exists.
|
|
18
18
|
*/
|
|
19
19
|
export declare function findFirstPhiCmsNavigationLinkPath(items: readonly PhiCmsResolvedNavigationItem[], skipPath?: string): string | null;
|
|
@@ -12,13 +12,13 @@ import { readPhiCmsNavigationTargetPath } from "../../../helpers/navigation-targ
|
|
|
12
12
|
/**
|
|
13
13
|
* The first place a navigation subtree actually goes.
|
|
14
14
|
*
|
|
15
|
-
* An Overlay opener is not a destination, so it can never be what a redirect lands on, and an
|
|
16
|
-
* address is
|
|
15
|
+
* An Overlay opener is not a destination, so it can never be what a redirect lands on, and neither an
|
|
16
|
+
* external address nor another Area's root is a place in the Area. Neither is the path the redirecting page itself answers: an Area root whose sidebar still carries an item pointing
|
|
17
17
|
* at "/" would forward to itself forever, which is the whole reason `skipPath` exists.
|
|
18
18
|
*/
|
|
19
19
|
export function findFirstPhiCmsNavigationLinkPath(items, skipPath) {
|
|
20
20
|
for (const item of items) {
|
|
21
|
-
const path = item.target?.kind === "custom" && item.target.external === true
|
|
21
|
+
const path = (item.target?.kind === "custom" && item.target.external === true) || item.target?.kind === "area"
|
|
22
22
|
? null
|
|
23
23
|
: readPhiCmsNavigationTargetPath(item.target);
|
|
24
24
|
if (item.kind === "link" && path && path !== skipPath) {
|
|
@@ -78,7 +78,8 @@ export function buildPhiAreaShellHeaderNodes({ nodes, runtime, labelPrefix, ids,
|
|
|
78
78
|
slotIndex: PHI_CMS_THREE_COLUMN_LAYOUT_SLOT_INDEX.Middle,
|
|
79
79
|
sortOrder: 0,
|
|
80
80
|
label: "Page title",
|
|
81
|
-
|
|
81
|
+
/* A caption in the bar: the Page's heading is the Page's. */
|
|
82
|
+
config: { display: "label" },
|
|
82
83
|
}),
|
|
83
84
|
nodes.widget({
|
|
84
85
|
typeKey: "account",
|
|
@@ -13,7 +13,7 @@ export declare function resolvePhiPublicAssetReference(input: {
|
|
|
13
13
|
assetId: number;
|
|
14
14
|
}): Promise<import("../../../types").PhiPublicMediaAssetReference | null>;
|
|
15
15
|
export declare function resolvePhiWidgetInternalReferences(input: {
|
|
16
|
-
runtime: Pick<PhiBlockRuntime, "site" | "locale" | "area" | "viewer">;
|
|
16
|
+
runtime: Pick<PhiBlockRuntime, "site" | "locale" | "area" | "viewer" | "request">;
|
|
17
17
|
/**
|
|
18
18
|
* Which Area to resolve the Page references in. Absent is the one being rendered.
|
|
19
19
|
*
|
|
@@ -3,6 +3,7 @@ import { resolveSiteInternalReferences } from "../../../gateway/internal-referen
|
|
|
3
3
|
import { resolvePhiCmsRoutePresetByPageId } from "../../../plugins/runtime-modules/descriptor-compiler";
|
|
4
4
|
import { resolvePhiNavHref } from "../../../helpers/locale";
|
|
5
5
|
import { phiRuntime } from "../../../server-helpers/phi-runtime";
|
|
6
|
+
import { hasPhiCmsAuthorizedPreviewRead } from "../../../server-helpers/cms-review-params";
|
|
6
7
|
import { readPhiPageReference } from "../../../types/references";
|
|
7
8
|
/**
|
|
8
9
|
* Resolves one Asset reference for a Widget that binds a single Asset by id.
|
|
@@ -35,6 +36,9 @@ export async function resolvePhiWidgetInternalReferences(input) {
|
|
|
35
36
|
internalToken: rt.internalToken,
|
|
36
37
|
siteKey: rt.siteKey,
|
|
37
38
|
area,
|
|
39
|
+
// A link to a Page that was never published leads nowhere for a visitor, so only an authorized preview
|
|
40
|
+
// (a draft or revision read Core has already allowed) gets its path.
|
|
41
|
+
preview: hasPhiCmsAuthorizedPreviewRead(input.runtime.request?.searchParams),
|
|
38
42
|
references: pageReferences,
|
|
39
43
|
assetIds: input.assetIds,
|
|
40
44
|
});
|
|
@@ -60,6 +60,9 @@ const PHI_BUILDER_MODULES_PAGE_LABEL_SET = definePhiLabelSet({
|
|
|
60
60
|
public_routes_page: PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS.publicRoutes.page,
|
|
61
61
|
public_routes_wanted: PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS.publicRoutes.wanted,
|
|
62
62
|
public_routes_held_by: PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS.publicRoutes.heldBy,
|
|
63
|
+
public_routes_status: PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS.publicRoutes.status,
|
|
64
|
+
public_routes_live: PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS.publicRoutes.live,
|
|
65
|
+
public_routes_not_live: PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS.publicRoutes.notLive,
|
|
63
66
|
public_routes_address: PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS.publicRoutes.address,
|
|
64
67
|
public_routes_assign: PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS.publicRoutes.assign,
|
|
65
68
|
public_routes_cancel: PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS.publicRoutes.cancel,
|
|
@@ -143,6 +146,9 @@ export async function getPhiBuilderModulesPageLabels(options) {
|
|
|
143
146
|
page: labels.public_routes_page,
|
|
144
147
|
wanted: labels.public_routes_wanted,
|
|
145
148
|
heldBy: labels.public_routes_held_by,
|
|
149
|
+
status: labels.public_routes_status,
|
|
150
|
+
live: labels.public_routes_live,
|
|
151
|
+
notLive: labels.public_routes_not_live,
|
|
146
152
|
address: labels.public_routes_address,
|
|
147
153
|
assign: labels.public_routes_assign,
|
|
148
154
|
cancel: labels.public_routes_cancel,
|
|
@@ -67,6 +67,10 @@ export type PhiBuilderModulesPageLabels = {
|
|
|
67
67
|
page: string;
|
|
68
68
|
wanted: string;
|
|
69
69
|
heldBy: string;
|
|
70
|
+
/** Whether what holds the address answers on it today, which decides what moving it costs. */
|
|
71
|
+
status: string;
|
|
72
|
+
live: string;
|
|
73
|
+
notLive: string;
|
|
70
74
|
address: string;
|
|
71
75
|
assign: string;
|
|
72
76
|
cancel: string;
|
|
@@ -75,6 +75,9 @@ export const PHI_BUILDER_MODULES_PAGE_DEFAULT_LABELS = {
|
|
|
75
75
|
page: "Page",
|
|
76
76
|
wanted: "Wanted",
|
|
77
77
|
heldBy: "Taken by",
|
|
78
|
+
status: "Status",
|
|
79
|
+
live: "Live",
|
|
80
|
+
notLive: "Not published yet",
|
|
78
81
|
address: "Address",
|
|
79
82
|
assign: "Enable with these addresses",
|
|
80
83
|
cancel: "Cancel",
|