@phis/ui 0.5.5 → 0.5.7
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-anchor-nav-control.js +18 -1
- package/components/controls/phi-background-control.d.ts +9 -1
- package/components/controls/phi-background-control.js +66 -20
- package/components/widgets/config/background-pattern-live.d.ts +25 -0
- package/components/widgets/config/background-pattern-live.js +50 -0
- package/components/widgets/shared/card-body-client.d.ts +6 -2
- package/components/widgets/shared/card-body-client.js +27 -20
- package/components/widgets/shared/card-vocabulary.d.ts +7 -0
- package/components/widgets/shared/card-vocabulary.js +6 -0
- package/components/widgets/shared/markdown-body-client.d.ts +4 -1
- package/components/widgets/shared/markdown-body-client.js +10 -5
- package/components/widgets/shared/markdown-image-vocabulary.d.ts +19 -6
- package/components/widgets/shared/markdown-image-vocabulary.js +34 -9
- package/components/widgets/shared/markdown-render.d.ts +2 -1
- package/components/widgets/shared/markdown-render.js +4 -1
- package/constants/module-identity.d.ts +8 -0
- package/constants/module-identity.js +13 -0
- package/gateway/server-module-media.d.ts +12 -0
- package/gateway/server-module-media.js +83 -0
- package/helpers/cms-navigation-catalog.js +4 -1
- package/helpers/cms-page-catalog.d.ts +7 -0
- package/helpers/cms-preset-page-tree.js +16 -1
- package/helpers/module-media-check.d.ts +23 -0
- package/helpers/module-media-check.js +32 -0
- package/helpers/module-media.d.ts +7 -0
- package/helpers/module-media.js +15 -0
- package/helpers/route-address-check.d.ts +35 -0
- package/helpers/route-address-check.js +28 -0
- package/module-page-check.d.ts +2 -0
- package/module-page-check.js +2 -0
- package/package.json +1 -1
- package/plugins/runtime-modules/builder/area-shell-presets.server.js +2 -0
- package/plugins/runtime-modules/builder/clients/inspector-config-field.d.ts +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +8 -0
- package/plugins/runtime-modules/builder/navigation-folder-drop.js +2 -1
- package/plugins/runtime-modules/builder/options-providers.js +7 -1
- package/plugins/runtime-modules/builder/page-presets.server.js +2 -0
- package/plugins/runtime-modules/core/widgets/breadcrumb/server.js +9 -2
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +17 -1
- package/plugins/runtime-modules/core/widgets/card/config.js +20 -2
- package/plugins/runtime-modules/core/widgets/card/editor.js +2 -0
- package/plugins/runtime-modules/core/widgets/card/server.js +2 -0
- package/plugins/runtime-modules/core/widgets/description/config.d.ts +10 -0
- package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +10 -0
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +10 -0
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +16 -1
- package/plugins/runtime-modules/core/widgets/markdown/config.js +18 -1
- package/plugins/runtime-modules/core/widgets/result/config.d.ts +10 -0
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +10 -0
- package/plugins/runtime-modules/core/widgets/table/config.d.ts +34 -0
- package/plugins/runtime-modules/descriptor-compiler.d.ts +23 -3
- package/plugins/runtime-modules/descriptor-compiler.js +107 -12
- package/server-helpers/cms-area.js +9 -1
- package/server-helpers/cms-request.js +15 -2
- package/server-helpers/cms-root.js +2 -0
- package/server-helpers/module-folder-targets.d.ts +7 -0
- package/server-helpers/module-folder-targets.js +15 -0
- package/styles/controls.css +30 -5
- package/types/cms-module-descriptors.d.ts +24 -0
- package/types/cms-plugins.d.ts +8 -0
- package/types/core-widget-placements.d.ts +2 -1
- package/types/module-media.d.ts +31 -0
- package/types/module-media.js +11 -0
- package/types.d.ts +1 -0
|
@@ -8,24 +8,37 @@ export type PhiMarkdownImageAspectRatio = (typeof PHI_MARKDOWN_IMAGE_ASPECT_RATI
|
|
|
8
8
|
/** Where a picture stands: at an edge with the text flowing past it, or on a line of its own (`none`). */
|
|
9
9
|
export declare const PHI_MARKDOWN_FIGURE_FLOATS: readonly ["start", "end", "none"];
|
|
10
10
|
export type PhiMarkdownFigureFloat = (typeof PHI_MARKDOWN_FIGURE_FLOATS)[number];
|
|
11
|
+
/**
|
|
12
|
+
* How much of the line a picture beside the text takes, in fixed steps and never a measure of its own: what
|
|
13
|
+
* is left of the column after the gap, divided by a power of φ (`PHI_GOLDEN_RATIO`) -- `small` φ⁴ (about
|
|
14
|
+
* 0.15 of the column), `medium` φ³ (0.24), `large` φ² (0.38) and `xlarge` φ (0.62). `large` is what a picture
|
|
15
|
+
* has that says nothing: text and picture in the golden ratio. `small` is an app icon's or a portrait's
|
|
16
|
+
* step. It says nothing for a picture on a line of its own, which is as wide as the column; the divisors
|
|
17
|
+
* themselves are `styles/controls.css`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const PHI_MARKDOWN_IMAGE_FLOAT_WIDTHS: readonly ["small", "medium", "large", "xlarge"];
|
|
20
|
+
export type PhiMarkdownImageFloatWidth = (typeof PHI_MARKDOWN_IMAGE_FLOAT_WIDTHS)[number];
|
|
21
|
+
export declare const PHI_MARKDOWN_IMAGE_FLOAT_WIDTH_DEFAULT: PhiMarkdownImageFloatWidth;
|
|
22
|
+
export declare function readPhiMarkdownImageFloatWidth(value: unknown): PhiMarkdownImageFloatWidth | undefined;
|
|
11
23
|
export declare function readPhiMarkdownImageAspectRatio(value: unknown): PhiMarkdownImageAspectRatio | undefined;
|
|
12
24
|
/** A step as a number, width over height; `auto` has none -- the picture decides. */
|
|
13
25
|
export declare function resolvePhiMarkdownImageAspectRatioValue(ratio: PhiMarkdownImageAspectRatio | undefined): number | null;
|
|
14
26
|
/** A step as CSS writes it (`16 / 9`); `auto` has none. */
|
|
15
27
|
export declare function resolvePhiMarkdownImageAspectRatioCss(ratio: PhiMarkdownImageAspectRatio | undefined): string | null;
|
|
16
28
|
/**
|
|
17
|
-
* A picture's address read apart: the reference, and what the picture says for itself. Only `ratio
|
|
18
|
-
* `float` are read; anything else after the `?` is left out of the reference and ignored, so an address a
|
|
29
|
+
* A picture's address read apart: the reference, and what the picture says for itself. Only `ratio`,
|
|
30
|
+
* `float` and `width` are read; anything else after the `?` is left out of the reference and ignored, so an address a
|
|
19
31
|
* later release learns more words for still names its Asset today.
|
|
20
32
|
*/
|
|
21
33
|
export declare function readPhiMarkdownImageAddress(url: string): {
|
|
22
34
|
reference: string;
|
|
23
35
|
aspectRatio?: PhiMarkdownImageAspectRatio;
|
|
24
36
|
float?: PhiMarkdownFigureFloat;
|
|
37
|
+
floatWidth?: PhiMarkdownImageFloatWidth;
|
|
25
38
|
};
|
|
26
39
|
/**
|
|
27
|
-
* How wide a picture is drawn, for the image optimiser: beside the text its
|
|
28
|
-
* (`styles/controls.css`,
|
|
29
|
-
*
|
|
40
|
+
* How wide a picture is drawn, for the image optimiser: beside the text its step's share of the column
|
|
41
|
+
* (`styles/controls.css`, a reading column of at most 1120 px), on a line of its own the reading column's.
|
|
42
|
+
* Below 560 px a floated picture stands on its own line at full width, whatever its step.
|
|
30
43
|
*/
|
|
31
|
-
export declare function resolvePhiMarkdownFigureSizes(float: PhiMarkdownFigureFloat
|
|
44
|
+
export declare function resolvePhiMarkdownFigureSizes(float: PhiMarkdownFigureFloat, floatWidth?: PhiMarkdownImageFloatWidth): string;
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* reference of every route.
|
|
5
5
|
*
|
|
6
6
|
* Two places say it, and the nearer one wins. The Widget states what every picture in its text does -- the
|
|
7
|
-
* Inspector's "Image proportion" and "Image
|
|
8
|
-
* own address, after the Asset: `
|
|
7
|
+
* Inspector's "Image proportion", "Image Float" and "Image Width" -- and a picture that needs something else
|
|
8
|
+
* says so in its own address, after the Asset: ``, or
|
|
9
|
+
* ``. The address stays a
|
|
9
10
|
* `phis:asset/<id>` reference for everything that reads one (the server's reference index finds the id at
|
|
10
11
|
* its start), and it is plain Markdown, so a translation carries it through untouched.
|
|
11
12
|
*/
|
|
@@ -18,6 +19,19 @@ import { PHI_GOLDEN_RATIO } from "../../../theme/phi-tokens";
|
|
|
18
19
|
export const PHI_MARKDOWN_IMAGE_ASPECT_RATIOS = ["auto", "phi", "3:2", "4:3", "16:9", "2:1", "1:1"];
|
|
19
20
|
/** Where a picture stands: at an edge with the text flowing past it, or on a line of its own (`none`). */
|
|
20
21
|
export const PHI_MARKDOWN_FIGURE_FLOATS = ["start", "end", "none"];
|
|
22
|
+
/**
|
|
23
|
+
* How much of the line a picture beside the text takes, in fixed steps and never a measure of its own: what
|
|
24
|
+
* is left of the column after the gap, divided by a power of φ (`PHI_GOLDEN_RATIO`) -- `small` φ⁴ (about
|
|
25
|
+
* 0.15 of the column), `medium` φ³ (0.24), `large` φ² (0.38) and `xlarge` φ (0.62). `large` is what a picture
|
|
26
|
+
* has that says nothing: text and picture in the golden ratio. `small` is an app icon's or a portrait's
|
|
27
|
+
* step. It says nothing for a picture on a line of its own, which is as wide as the column; the divisors
|
|
28
|
+
* themselves are `styles/controls.css`.
|
|
29
|
+
*/
|
|
30
|
+
export const PHI_MARKDOWN_IMAGE_FLOAT_WIDTHS = ["small", "medium", "large", "xlarge"];
|
|
31
|
+
export const PHI_MARKDOWN_IMAGE_FLOAT_WIDTH_DEFAULT = "large";
|
|
32
|
+
export function readPhiMarkdownImageFloatWidth(value) {
|
|
33
|
+
return PHI_MARKDOWN_IMAGE_FLOAT_WIDTHS.find((width) => width === value);
|
|
34
|
+
}
|
|
21
35
|
export function readPhiMarkdownImageAspectRatio(value) {
|
|
22
36
|
return PHI_MARKDOWN_IMAGE_ASPECT_RATIOS.find((ratio) => ratio === value);
|
|
23
37
|
}
|
|
@@ -41,8 +55,8 @@ export function resolvePhiMarkdownImageAspectRatioCss(ratio) {
|
|
|
41
55
|
return ratio === "phi" ? `${PHI_GOLDEN_RATIO.toFixed(6)} / 1` : ratio.replace(":", " / ");
|
|
42
56
|
}
|
|
43
57
|
/**
|
|
44
|
-
* A picture's address read apart: the reference, and what the picture says for itself. Only `ratio
|
|
45
|
-
* `float` are read; anything else after the `?` is left out of the reference and ignored, so an address a
|
|
58
|
+
* A picture's address read apart: the reference, and what the picture says for itself. Only `ratio`,
|
|
59
|
+
* `float` and `width` are read; anything else after the `?` is left out of the reference and ignored, so an address a
|
|
46
60
|
* later release learns more words for still names its Asset today.
|
|
47
61
|
*/
|
|
48
62
|
export function readPhiMarkdownImageAddress(url) {
|
|
@@ -52,17 +66,28 @@ export function readPhiMarkdownImageAddress(url) {
|
|
|
52
66
|
const params = new URLSearchParams(url.slice(question + 1));
|
|
53
67
|
const aspectRatio = readPhiMarkdownImageAspectRatio(params.get("ratio"));
|
|
54
68
|
const float = readPhiMarkdownFigureFloat(params.get("float"));
|
|
69
|
+
const floatWidth = readPhiMarkdownImageFloatWidth(params.get("width"));
|
|
55
70
|
return {
|
|
56
71
|
reference: url.slice(0, question),
|
|
57
72
|
...(aspectRatio ? { aspectRatio } : {}),
|
|
58
73
|
...(float ? { float } : {}),
|
|
74
|
+
...(floatWidth ? { floatWidth } : {}),
|
|
59
75
|
};
|
|
60
76
|
}
|
|
77
|
+
/** The widest a floated picture of each step is drawn, in a reading column of 1120 px (`styles/controls.css`). */
|
|
78
|
+
const PHI_MARKDOWN_FLOAT_WIDTH_PIXELS = {
|
|
79
|
+
small: 160,
|
|
80
|
+
medium: 260,
|
|
81
|
+
large: 440,
|
|
82
|
+
xlarge: 680,
|
|
83
|
+
};
|
|
61
84
|
/**
|
|
62
|
-
* How wide a picture is drawn, for the image optimiser: beside the text its
|
|
63
|
-
* (`styles/controls.css`,
|
|
64
|
-
*
|
|
85
|
+
* How wide a picture is drawn, for the image optimiser: beside the text its step's share of the column
|
|
86
|
+
* (`styles/controls.css`, a reading column of at most 1120 px), on a line of its own the reading column's.
|
|
87
|
+
* Below 560 px a floated picture stands on its own line at full width, whatever its step.
|
|
65
88
|
*/
|
|
66
|
-
export function resolvePhiMarkdownFigureSizes(float) {
|
|
67
|
-
return float === "none"
|
|
89
|
+
export function resolvePhiMarkdownFigureSizes(float, floatWidth = PHI_MARKDOWN_IMAGE_FLOAT_WIDTH_DEFAULT) {
|
|
90
|
+
return float === "none"
|
|
91
|
+
? "(max-width: 768px) 100vw, 1120px"
|
|
92
|
+
: `(max-width: 560px) 100vw, ${PHI_MARKDOWN_FLOAT_WIDTH_PIXELS[floatWidth]}px`;
|
|
68
93
|
}
|
|
@@ -3,7 +3,7 @@ import type { PhiCmsResolvedContent } from "../../../types/cms";
|
|
|
3
3
|
import type { PhiMarkdownTocHeading } from "../../../types/markdown";
|
|
4
4
|
import type { PhiMarkdownBlock } from "./markdown-body-client";
|
|
5
5
|
import type { PhiMarkdownImageFloat } from "../../../types/core-widget-placements";
|
|
6
|
-
import { type PhiMarkdownImageAspectRatio } from "./markdown-image-vocabulary";
|
|
6
|
+
import { type PhiMarkdownImageAspectRatio, type PhiMarkdownImageFloatWidth } from "./markdown-image-vocabulary";
|
|
7
7
|
/**
|
|
8
8
|
* Where Markdown comes from and how it is turned into blocks: inline text, a stored content field, or a
|
|
9
9
|
* document fetched by URL, translated or not, with heading ids under a prefix of its own.
|
|
@@ -37,6 +37,7 @@ export type PhiMarkdownSourceConfig = {
|
|
|
37
37
|
/** What every picture in the text does, unless its own address says otherwise (`markdown-image-vocabulary.ts`). */
|
|
38
38
|
imageAspectRatio?: PhiMarkdownImageAspectRatio;
|
|
39
39
|
imageFloat?: PhiMarkdownImageFloat;
|
|
40
|
+
imageFloatWidth?: PhiMarkdownImageFloatWidth;
|
|
40
41
|
};
|
|
41
42
|
export type MarkdownRenderData = {
|
|
42
43
|
blocks: PhiMarkdownBlock[];
|
|
@@ -5,7 +5,7 @@ import remarkGfm from "remark-gfm";
|
|
|
5
5
|
import { trBulk, trBulkForLocale } from "../../../server-helpers/translate";
|
|
6
6
|
import { resolvePhiImagePresentation } from "../../media/image-presentation";
|
|
7
7
|
import { isPhiMediaSvgContentType } from "../../../constants/media";
|
|
8
|
-
import { readPhiMarkdownImageAddress, resolvePhiMarkdownImageAspectRatioCss, resolvePhiMarkdownImageAspectRatioValue, } from "./markdown-image-vocabulary";
|
|
8
|
+
import { readPhiMarkdownImageAddress, resolvePhiMarkdownImageAspectRatioCss, resolvePhiMarkdownImageAspectRatioValue, PHI_MARKDOWN_IMAGE_FLOAT_WIDTH_DEFAULT, } from "./markdown-image-vocabulary";
|
|
9
9
|
import { resolvePhiCodeLanguage, tokenizePhiCode } from "./markdown-code-tokens";
|
|
10
10
|
import { readPhiInternalReference } from "../../../types/references";
|
|
11
11
|
import { resolvePhiWidgetInternalReferences } from "../helpers/internal-reference-resolver.server";
|
|
@@ -155,6 +155,7 @@ async function projectInternalMarkdownNodes(tree, runtime) {
|
|
|
155
155
|
asset,
|
|
156
156
|
...(address.aspectRatio ? { aspectRatio: address.aspectRatio } : {}),
|
|
157
157
|
...(address.float ? { float: address.float } : {}),
|
|
158
|
+
...(address.floatWidth ? { floatWidth: address.floatWidth } : {}),
|
|
158
159
|
});
|
|
159
160
|
return [{ ...node, url: src, children }];
|
|
160
161
|
}
|
|
@@ -215,6 +216,7 @@ function buildMarkdownFigure(image, source, defaults) {
|
|
|
215
216
|
optimizable: !isPhiMediaSvgContentType(asset.contentType),
|
|
216
217
|
aspectRatio: resolvePhiMarkdownImageAspectRatioCss(aspectRatio),
|
|
217
218
|
float: source.float ?? defaults.float ?? "none",
|
|
219
|
+
floatWidth: source.floatWidth ?? defaults.floatWidth ?? PHI_MARKDOWN_IMAGE_FLOAT_WIDTH_DEFAULT,
|
|
218
220
|
};
|
|
219
221
|
}
|
|
220
222
|
function mapInlineNodes(nodes) {
|
|
@@ -488,6 +490,7 @@ export async function resolveMarkdownRenderData(config, runtime) {
|
|
|
488
490
|
: null, runtime, config?.extent ?? "document", config?.headingOffset ?? 0, {
|
|
489
491
|
...(config?.imageAspectRatio ? { aspectRatio: config.imageAspectRatio } : {}),
|
|
490
492
|
...(config?.imageFloat ? { float: config.imageFloat } : {}),
|
|
493
|
+
...(config?.imageFloatWidth ? { floatWidth: config.imageFloatWidth } : {}),
|
|
491
494
|
});
|
|
492
495
|
}
|
|
493
496
|
async function resolveMarkdownRenderDataFromSource(markdown, translate, headingIdPrefix, sourceLocale, sourceMode = "inline", sourceUrl = null, runtime, extent = "document", headingOffset = 0, imageDefaults = {}) {
|
|
@@ -65,3 +65,11 @@ export declare function parsePhiModuleIconName(value: unknown): {
|
|
|
65
65
|
moduleId: `${string}/${string}`;
|
|
66
66
|
name: string;
|
|
67
67
|
} | null;
|
|
68
|
+
/**
|
|
69
|
+
* The npm package a runtime module id belongs to: its first two path segments
|
|
70
|
+
* (`@phis/phisys/modules/site` -> `@phis/phisys`).
|
|
71
|
+
*
|
|
72
|
+
* What is declared per package -- the pictures of `phis.media` -- is looked up by this name, so a Module
|
|
73
|
+
* reaches its own package's names and nobody else's. Throws on an id that is not a runtime module id.
|
|
74
|
+
*/
|
|
75
|
+
export declare function readPhiRuntimeModulePackageName(moduleId: string): string;
|
|
@@ -127,3 +127,16 @@ export function parsePhiModuleIconName(value) {
|
|
|
127
127
|
const name = reference.slice(cut + 1);
|
|
128
128
|
return isPhiRuntimeModuleId(moduleId) && isPhiModuleIconName(name) ? { moduleId, name } : null;
|
|
129
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* The npm package a runtime module id belongs to: its first two path segments
|
|
132
|
+
* (`@phis/phisys/modules/site` -> `@phis/phisys`).
|
|
133
|
+
*
|
|
134
|
+
* What is declared per package -- the pictures of `phis.media` -- is looked up by this name, so a Module
|
|
135
|
+
* reaches its own package's names and nobody else's. Throws on an id that is not a runtime module id.
|
|
136
|
+
*/
|
|
137
|
+
export function readPhiRuntimeModulePackageName(moduleId) {
|
|
138
|
+
if (!isPhiRuntimeModuleId(moduleId)) {
|
|
139
|
+
throw new Error(`Invalid Phi runtime module id: ${moduleId}.`);
|
|
140
|
+
}
|
|
141
|
+
return moduleId.split("/", 2).join("/");
|
|
142
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
import { type PhiModuleMediaLoader, type PhiModuleMediaMapping } from "../types/module-media";
|
|
3
|
+
export declare function parsePhiModuleMediaMapping(value: unknown): PhiModuleMediaMapping;
|
|
4
|
+
/** Re-arms the once-per-process log; for tests. */
|
|
5
|
+
export declare function resetPhiModuleMediaUnavailableLog(): void;
|
|
6
|
+
export declare function getPhiModuleMediaMapping(options: {
|
|
7
|
+
apiBaseUrl: string;
|
|
8
|
+
internalToken: string;
|
|
9
|
+
siteKey: string;
|
|
10
|
+
}): Promise<PhiModuleMediaMapping>;
|
|
11
|
+
/** The loader a server caller hands to the descriptor compiler for this Site. */
|
|
12
|
+
export declare function createPhiModuleMediaLoader(siteKey: string): PhiModuleMediaLoader;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import "server-only";
|
|
2
|
+
import { isPhiRecord } from "../helpers/is-record";
|
|
3
|
+
import { readPhiServerApiCredentials } from "../helpers/phis-server-credentials";
|
|
4
|
+
import { PHI_EMPTY_MODULE_MEDIA_MAPPING, } from "../types/module-media";
|
|
5
|
+
import { fetchPhiSiteApi } from "./site-api-request";
|
|
6
|
+
import { readPhiSiteReadCache } from "./site-read-cache";
|
|
7
|
+
const PACKAGE_NAME_PATTERN = /^@[^/]+\/[^/]+$/;
|
|
8
|
+
const KEY_PATTERN = /^[a-z0-9][a-z0-9-]*$/;
|
|
9
|
+
function parseIds(value, what) {
|
|
10
|
+
if (!isPhiRecord(value)) {
|
|
11
|
+
throw new Error(`Invalid module media ${what}.`);
|
|
12
|
+
}
|
|
13
|
+
const result = {};
|
|
14
|
+
for (const [packageName, keys] of Object.entries(value)) {
|
|
15
|
+
if (!PACKAGE_NAME_PATTERN.test(packageName) || !isPhiRecord(keys)) {
|
|
16
|
+
throw new Error(`Invalid module media ${what}.`);
|
|
17
|
+
}
|
|
18
|
+
const ids = {};
|
|
19
|
+
for (const [key, id] of Object.entries(keys)) {
|
|
20
|
+
if (!KEY_PATTERN.test(key) || typeof id !== "number" || !Number.isSafeInteger(id) || id <= 0) {
|
|
21
|
+
throw new Error(`Invalid module media ${what}.`);
|
|
22
|
+
}
|
|
23
|
+
ids[key] = id;
|
|
24
|
+
}
|
|
25
|
+
result[packageName] = ids;
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
export function parsePhiModuleMediaMapping(value) {
|
|
30
|
+
if (!isPhiRecord(value)) {
|
|
31
|
+
throw new Error("Invalid module media mapping.");
|
|
32
|
+
}
|
|
33
|
+
return { assets: parseIds(value.assets, "assets"), folders: parseIds(value.folders, "folders") };
|
|
34
|
+
}
|
|
35
|
+
let unavailableLogged = false;
|
|
36
|
+
/** Re-arms the once-per-process log; for tests. */
|
|
37
|
+
export function resetPhiModuleMediaUnavailableLog() {
|
|
38
|
+
unavailableLogged = false;
|
|
39
|
+
}
|
|
40
|
+
export async function getPhiModuleMediaMapping(options) {
|
|
41
|
+
/*
|
|
42
|
+
* Kept in the read cache outside development, with the capability snapshot's reasoning and lifetime
|
|
43
|
+
* (60 s): the mapping is the same for every viewer and changes only on `phis module media sync` or a
|
|
44
|
+
* rebind, which no read marker sees, so the TTL is what lets a hand binding reach a running Site.
|
|
45
|
+
*/
|
|
46
|
+
if (process.env.NODE_ENV === "development") {
|
|
47
|
+
return loadPhiModuleMediaMapping(options);
|
|
48
|
+
}
|
|
49
|
+
return readPhiSiteReadCache(`module-media:${options.siteKey.trim().toLowerCase()}`, () => loadPhiModuleMediaMapping(options));
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Unlike the capability snapshot, a Core that cannot answer is not an error here: a missing route (`404`,
|
|
53
|
+
* a Core older than the route), a refusal or an unreachable Core give the empty mapping, and the first
|
|
54
|
+
* time per process is logged. A missing picture must not take a page down, and `@phis/ui` may be rolled
|
|
55
|
+
* out before the Core that knows the route. An answer that arrives but is malformed still throws.
|
|
56
|
+
*/
|
|
57
|
+
async function loadPhiModuleMediaMapping({ apiBaseUrl, internalToken, siteKey, }) {
|
|
58
|
+
let answer;
|
|
59
|
+
try {
|
|
60
|
+
answer = await fetchPhiSiteApi({
|
|
61
|
+
context: "getPhiModuleMediaMapping",
|
|
62
|
+
apiBaseUrl,
|
|
63
|
+
internalToken,
|
|
64
|
+
siteKey,
|
|
65
|
+
path: "/api/v1/site/module-media",
|
|
66
|
+
failure: "Failed to read module media",
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
if (!unavailableLogged) {
|
|
71
|
+
unavailableLogged = true;
|
|
72
|
+
console.warn("[phi-module-media] The Site's module media could not be read; presets leave their pictures out.", {
|
|
73
|
+
error,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return PHI_EMPTY_MODULE_MEDIA_MAPPING;
|
|
77
|
+
}
|
|
78
|
+
return parsePhiModuleMediaMapping(answer);
|
|
79
|
+
}
|
|
80
|
+
/** The loader a server caller hands to the descriptor compiler for this Site. */
|
|
81
|
+
export function createPhiModuleMediaLoader(siteKey) {
|
|
82
|
+
return () => getPhiModuleMediaMapping({ ...readPhiServerApiCredentials(), siteKey });
|
|
83
|
+
}
|
|
@@ -51,7 +51,10 @@ function materializeNavigationItem(item, tombstones, customItems, overrides) {
|
|
|
51
51
|
const customTarget = customItem?.target;
|
|
52
52
|
// A Site's stored external link and a Module's external entry resolve to the same target.
|
|
53
53
|
const externalTarget = item.target?.kind === "custom" && item.target.external === true ? item.target : null;
|
|
54
|
-
|
|
54
|
+
// A Site's own choice first; a Module container's descriptor names its default (`folderTarget`).
|
|
55
|
+
const folder = item.kind === "container"
|
|
56
|
+
? customItem?.folder ?? overrides.get(item.id)?.folder ?? item.folder
|
|
57
|
+
: undefined;
|
|
55
58
|
return {
|
|
56
59
|
id: item.id,
|
|
57
60
|
source: item.ownerModuleId === null ? "custom" : "module",
|
|
@@ -43,6 +43,13 @@ export type PhiPresetPageNode = {
|
|
|
43
43
|
pendingPath?: string | null;
|
|
44
44
|
pathLocked?: boolean;
|
|
45
45
|
pathOwnershipReason?: string;
|
|
46
|
+
/**
|
|
47
|
+
* A route that answers a family of Pages, by its parameter's name: `slug` for `/blog/:slug`. Every
|
|
48
|
+
* entry of a list answers on it, so it is shown as their kind ("Slug") rather than as one Page, and
|
|
49
|
+
* nothing links to it -- a link names one entry. It stands beneath its list's Page where there is one
|
|
50
|
+
* (`helpers/cms-preset-page-tree.ts`).
|
|
51
|
+
*/
|
|
52
|
+
routeParameter?: string;
|
|
46
53
|
children?: PhiPresetPageNode[];
|
|
47
54
|
};
|
|
48
55
|
/** A Page's address as the Builder shows it: the current one, and where a pending rename moves it. */
|
|
@@ -47,9 +47,19 @@ export function insertPhiPresetPageTarget(roots, target) {
|
|
|
47
47
|
});
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
+
/*
|
|
51
|
+
* A segment is one node, whether a Page answers on it or it only holds what lies beneath: a folder
|
|
52
|
+
* and a Page of the same address side by side read as two entries for one place. The one nesting
|
|
53
|
+
* routes may have is a list's entries beneath the list (`/blog/:slug` under `/blog`,
|
|
54
|
+
* `helpers/route-address-check.ts`), so they hang beneath the list's Page; whichever route comes
|
|
55
|
+
* first, the Page takes the folder's place and keeps what it held.
|
|
56
|
+
*/
|
|
50
57
|
let siblings = roots;
|
|
58
|
+
let folderPath = "";
|
|
51
59
|
for (const segment of segments.slice(0, -1)) {
|
|
52
|
-
|
|
60
|
+
folderPath = `${folderPath}/${segment}`;
|
|
61
|
+
let group = siblings.find((node) => node.catalogPath === folderPath)
|
|
62
|
+
?? siblings.find((node) => node.key === segment && !node.storagePath);
|
|
53
63
|
if (!group) {
|
|
54
64
|
group = { key: segment, title: humanizePageKey(segment), children: [] };
|
|
55
65
|
siblings.push(group);
|
|
@@ -57,6 +67,9 @@ export function insertPhiPresetPageTarget(roots, target) {
|
|
|
57
67
|
group.children ??= [];
|
|
58
68
|
siblings = group.children;
|
|
59
69
|
}
|
|
70
|
+
const last = segments[segments.length - 1];
|
|
71
|
+
const folderIndex = siblings.findIndex((node) => node.key === last && !node.storagePath);
|
|
72
|
+
const held = folderIndex >= 0 ? siblings.splice(folderIndex, 1)[0].children ?? [] : [];
|
|
60
73
|
siblings.push({
|
|
61
74
|
key: pageId,
|
|
62
75
|
title: target.title,
|
|
@@ -66,6 +79,8 @@ export function insertPhiPresetPageTarget(roots, target) {
|
|
|
66
79
|
...(target.defaultPageFlags ? { defaultPageFlags: target.defaultPageFlags } : {}),
|
|
67
80
|
...(target.landingPage ? { landingPage: true } : {}),
|
|
68
81
|
...(target.pageRecord ? { pageRecord: { providerKey: target.pageRecord.providerKey } } : {}),
|
|
82
|
+
...(last.startsWith(":") ? { routeParameter: last.slice(1) } : {}),
|
|
83
|
+
...(held.length > 0 ? { children: held } : {}),
|
|
69
84
|
});
|
|
70
85
|
}
|
|
71
86
|
/**
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PhiModuleMediaResolver } from "../types/module-media";
|
|
2
|
+
/** A name a preset asked for that the package does not declare in `phis.media`. */
|
|
3
|
+
export type PhiModuleMediaFinding = {
|
|
4
|
+
kind: "asset" | "folder";
|
|
5
|
+
key: string;
|
|
6
|
+
message: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The resolver a Module package hands its own `loadTree` in its verify step, where there is no Core
|
|
10
|
+
* (THIRD_PARTY_MODULES.md, "Checking a Page preset").
|
|
11
|
+
*
|
|
12
|
+
* `assets` and `folders` are the keys the package declares in `phis.media`. A declared key answers a
|
|
13
|
+
* placeholder id -- a stable positive integer, distinct from every other key's -- so the tree is built
|
|
14
|
+
* as on a Site that has imported everything. An undeclared key answers `null` and is recorded: on a
|
|
15
|
+
* real Site it would never resolve. Verify-time only, from `@phis/ui/module/page-check`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createPhiDeclaredMediaResolver(declared?: {
|
|
18
|
+
assets?: readonly string[];
|
|
19
|
+
folders?: readonly string[];
|
|
20
|
+
}): {
|
|
21
|
+
media: PhiModuleMediaResolver;
|
|
22
|
+
findings(): PhiModuleMediaFinding[];
|
|
23
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The resolver a Module package hands its own `loadTree` in its verify step, where there is no Core
|
|
3
|
+
* (THIRD_PARTY_MODULES.md, "Checking a Page preset").
|
|
4
|
+
*
|
|
5
|
+
* `assets` and `folders` are the keys the package declares in `phis.media`. A declared key answers a
|
|
6
|
+
* placeholder id -- a stable positive integer, distinct from every other key's -- so the tree is built
|
|
7
|
+
* as on a Site that has imported everything. An undeclared key answers `null` and is recorded: on a
|
|
8
|
+
* real Site it would never resolve. Verify-time only, from `@phis/ui/module/page-check`.
|
|
9
|
+
*/
|
|
10
|
+
export function createPhiDeclaredMediaResolver(declared = {}) {
|
|
11
|
+
const ids = new Map();
|
|
12
|
+
const found = [];
|
|
13
|
+
const answer = (kind, declaredKeys, key) => {
|
|
14
|
+
if (!declaredKeys?.includes(key)) {
|
|
15
|
+
if (!found.some((finding) => finding.kind === kind && finding.key === key)) {
|
|
16
|
+
found.push({ kind, key, message: `${kind} \`${key}\` is not declared in the package's \`phis.media\`.` });
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const id = `${kind}:${key}`;
|
|
21
|
+
if (!ids.has(id))
|
|
22
|
+
ids.set(id, ids.size + 1);
|
|
23
|
+
return ids.get(id);
|
|
24
|
+
};
|
|
25
|
+
return {
|
|
26
|
+
media: {
|
|
27
|
+
asset: async (key) => answer("asset", declared.assets, key),
|
|
28
|
+
folder: async (key) => answer("folder", declared.folders, key),
|
|
29
|
+
},
|
|
30
|
+
findings: () => [...found],
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PhiModuleMediaLoader, PhiModuleMediaResolver } from "../types/module-media";
|
|
2
|
+
/**
|
|
3
|
+
* The resolver a preset of `ownerModuleId` is handed: the names of that Module's own package, answered
|
|
4
|
+
* from `load`. `load` runs on the first question only and its promise is kept, so one instantiation asks
|
|
5
|
+
* Core at most once and a preset that asks nothing costs nothing.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createPhiModuleMediaResolver(ownerModuleId: string, load: PhiModuleMediaLoader): PhiModuleMediaResolver;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { readPhiRuntimeModulePackageName } from "../constants/module-identity";
|
|
2
|
+
/**
|
|
3
|
+
* The resolver a preset of `ownerModuleId` is handed: the names of that Module's own package, answered
|
|
4
|
+
* from `load`. `load` runs on the first question only and its promise is kept, so one instantiation asks
|
|
5
|
+
* Core at most once and a preset that asks nothing costs nothing.
|
|
6
|
+
*/
|
|
7
|
+
export function createPhiModuleMediaResolver(ownerModuleId, load) {
|
|
8
|
+
const packageName = readPhiRuntimeModulePackageName(ownerModuleId);
|
|
9
|
+
let mapping = null;
|
|
10
|
+
const read = () => (mapping ??= load());
|
|
11
|
+
return {
|
|
12
|
+
asset: async (key) => (await read()).assets[packageName]?.[key] ?? null,
|
|
13
|
+
folder: async (key) => (await read()).folders[packageName]?.[key] ?? null,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { PhiCmsAreaKey } from "../constants/cms-areas";
|
|
2
|
+
/**
|
|
3
|
+
* Whether a Module's routes keep the rule that a Page is never a folder (THIRD_PARTY_MODULES.md,
|
|
4
|
+
* "Addresses and folders"; phis-server REFERENCES.md, "A Page is never a folder").
|
|
5
|
+
*
|
|
6
|
+
* A route whose path lies beneath another route's path in the same Area makes the upper one a Page and
|
|
7
|
+
* a folder at once: the Builder lists it twice -- the Page, and a folder of the same name beside it --
|
|
8
|
+
* and a Navigation container of the lower Pages gets a folder address that the upper Page shadows. An
|
|
9
|
+
* overview belongs beside the Pages it leads to (`/faq/overview` next to `/faq/hosting`), and the
|
|
10
|
+
* container's `folderTarget` sends `/faq` to it.
|
|
11
|
+
*
|
|
12
|
+
* One nesting is allowed: a list's entries directly beneath the list, `/blog` and `/blog/:slug`. The
|
|
13
|
+
* entries are not Pages of their own in a Navigation -- one route answers every entry -- so no
|
|
14
|
+
* container is built of them and no folder address is shadowed. Anything further down is a Page beneath
|
|
15
|
+
* a Page again: `/blog/:slug/edit` beneath `/blog`, `/blog/archive` beside `/blog/:slug`.
|
|
16
|
+
*
|
|
17
|
+
* Compared by segment, a parameter by its name like any other segment: `/shop/:slug` and `/shop/cart`
|
|
18
|
+
* are siblings. `/` is the Area's root slot and no folder.
|
|
19
|
+
*
|
|
20
|
+
* Verify-time only, from `@phis/ui/module/page-check`: a package runs it over its own routes, and
|
|
21
|
+
* phis-ui over the first-party ones. The Site's own Pages are refused by phis-server when written.
|
|
22
|
+
*/
|
|
23
|
+
export type PhiRouteAddressSubject = {
|
|
24
|
+
area: PhiCmsAreaKey;
|
|
25
|
+
path: string;
|
|
26
|
+
presetKey: string;
|
|
27
|
+
};
|
|
28
|
+
export type PhiRouteAddressFinding = {
|
|
29
|
+
/** The route beneath, by its preset key. */
|
|
30
|
+
route: string;
|
|
31
|
+
/** The route above it, which would be a Page and a folder at once. */
|
|
32
|
+
above: string;
|
|
33
|
+
message: string;
|
|
34
|
+
};
|
|
35
|
+
export declare function checkPhiRouteAddresses(routes: readonly PhiRouteAddressSubject[]): PhiRouteAddressFinding[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
function segments(path) {
|
|
2
|
+
return path.split("/").filter(Boolean);
|
|
3
|
+
}
|
|
4
|
+
export function checkPhiRouteAddresses(routes) {
|
|
5
|
+
const findings = [];
|
|
6
|
+
for (const route of routes) {
|
|
7
|
+
const own = segments(route.path);
|
|
8
|
+
for (const other of routes) {
|
|
9
|
+
if (other === route || other.area !== route.area)
|
|
10
|
+
continue;
|
|
11
|
+
const upper = segments(other.path);
|
|
12
|
+
if (upper.length === 0 || upper.length >= own.length)
|
|
13
|
+
continue;
|
|
14
|
+
if (!upper.every((segment, index) => segment === own[index]))
|
|
15
|
+
continue;
|
|
16
|
+
// A list's entries, one parameter directly beneath it.
|
|
17
|
+
if (own.length === upper.length + 1 && own[own.length - 1].startsWith(":"))
|
|
18
|
+
continue;
|
|
19
|
+
findings.push({
|
|
20
|
+
route: route.presetKey,
|
|
21
|
+
above: other.presetKey,
|
|
22
|
+
message: `"${route.path}" lies beneath "${other.path}" (${other.presetKey}) in Area "${route.area}": `
|
|
23
|
+
+ "a Page is never a folder. Put the upper Page beside the others and name it the container's folderTarget.",
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return findings;
|
|
28
|
+
}
|
package/module-page-check.d.ts
CHANGED
|
@@ -9,5 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* No `server-only` here, on purpose: a test in a package loads this door without a mock.
|
|
11
11
|
*/
|
|
12
|
+
export { createPhiDeclaredMediaResolver, type PhiModuleMediaFinding } from "./helpers/module-media-check";
|
|
12
13
|
export { checkPhiPagePresetLayout, type PhiPageLayoutFinding } from "./helpers/page-layout-check";
|
|
13
14
|
export { checkPhiPresetTextSources, type PhiPresetTextSourceFinding } from "./helpers/preset-text-source-check";
|
|
15
|
+
export { checkPhiRouteAddresses, type PhiRouteAddressFinding, type PhiRouteAddressSubject } from "./helpers/route-address-check";
|
package/module-page-check.js
CHANGED
|
@@ -9,5 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* No `server-only` here, on purpose: a test in a package loads this door without a mock.
|
|
11
11
|
*/
|
|
12
|
+
export { createPhiDeclaredMediaResolver } from "./helpers/module-media-check";
|
|
12
13
|
export { checkPhiPagePresetLayout } from "./helpers/page-layout-check";
|
|
13
14
|
export { checkPhiPresetTextSources } from "./helpers/preset-text-source-check";
|
|
15
|
+
export { checkPhiRouteAddresses } from "./helpers/route-address-check";
|
package/package.json
CHANGED
|
@@ -12,6 +12,7 @@ import { resolvePhiBuilderAreaAsCmsArea } from "../../../constants/cms-areas";
|
|
|
12
12
|
import { instantiatePhiCmsAreaShellPreset, resolvePhiCmsAreaShellPresetBinding, resolvePhiCmsDescriptorCatalog, } from "../../../plugins/runtime-modules/descriptor-compiler";
|
|
13
13
|
import { PHI_BUILDER_AREA_SEARCH_PARAM, normalizePhiBuilderAreaSearchParam, } from "../../../helpers/cms-scope-search-params";
|
|
14
14
|
import { readPhiServerApiCredentials } from "../../../helpers/phis-server-credentials";
|
|
15
|
+
import { createPhiModuleMediaLoader } from "../../../gateway/server-module-media";
|
|
15
16
|
/**
|
|
16
17
|
* Every Area's installed Shell as the Builder edits it: with the current content of every node somebody
|
|
17
18
|
* wrote content for. All Areas together and once per request, because the Builder holds the preset
|
|
@@ -31,6 +32,7 @@ const loadInstalledAreaShellPresetTrees = cache(async function loadInstalledArea
|
|
|
31
32
|
siteId: runtime.site.id,
|
|
32
33
|
path: resolveStructureAreaPath(area),
|
|
33
34
|
runtime,
|
|
35
|
+
loadModuleMedia: createPhiModuleMediaLoader(runtime.site.key),
|
|
34
36
|
});
|
|
35
37
|
return [area, tree];
|
|
36
38
|
}))).filter((entry) => entry != null);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type
|
|
2
|
+
import { type PhiBackgroundControlProps } from "../../../../components/controls/phi-background-control";
|
|
3
3
|
import type { PhiCmsConfigField, PhiRuntimeModuleDataProviderDescriptor } from "../../../../types/cms-plugins";
|
|
4
4
|
import type { PhiCalendarAdapterDescriptor } from "../../../../types/calendar";
|
|
5
5
|
import type { PhiVideoProviderDescriptor } from "../../../../types/video";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { Fragment, useMemo, useState } from "react";
|
|
4
|
+
import { PhiBackgroundControl } from "../../../../components/controls/phi-background-control";
|
|
4
5
|
import { readPhiDotPath } from "../../../../helpers/dot-path";
|
|
5
6
|
import { PhiCheckboxGroupControl } from "../../../../components/controls/phi-checkbox-group-control";
|
|
6
7
|
import { PhiDividerControl } from "../../../../components/controls/phi-divider-control";
|
|
@@ -730,6 +731,13 @@ function renderPhiInspectorConfigFieldBody({ field, value, defaultValue, config,
|
|
|
730
731
|
// A box inside a Widget has no layer of its own to blur.
|
|
731
732
|
backgroundFilters: ["glass", "haze", "clear"], backgroundLabels: backgroundLabels, borderLabels: borderLabels, colorPickerLabels: colorPickerLabels, renderMediaPicker: renderMediaPicker, onChange: (nextValue) => onChange?.({ [field.key]: nextValue }) }));
|
|
732
733
|
}
|
|
734
|
+
/*
|
|
735
|
+
* The Control names its own section ("Overlay", from the Background labels), so the field adds no label
|
|
736
|
+
* above it. The Base is not edited here and is passed as `none`; a cleared Overlay removes the key.
|
|
737
|
+
*/
|
|
738
|
+
if (field.type === "background-overlay") {
|
|
739
|
+
return (_jsx(PhiFlexControl, { vertical: true, style: { width: "100%", minWidth: 0 }, children: _jsx(PhiBackgroundControl, { mode: "control", base: false, disabled: disabled || !onChange, value: { base: { kind: "none" }, overlay: (value ?? null) }, labels: backgroundLabels, colorPickerLabels: colorPickerLabels, renderMediaPicker: renderMediaPicker, onChange: (next) => onChange?.({ [field.key]: next?.overlay ?? undefined }) }) }, field.key));
|
|
740
|
+
}
|
|
733
741
|
if (field.type === "icon") {
|
|
734
742
|
const iconValue = typeof value === "string"
|
|
735
743
|
? value
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** A Page the Navigation can point at: it has a stable reference and has not been deleted. */
|
|
2
2
|
export function isPhiBuilderNavigablePage(node) {
|
|
3
|
-
|
|
3
|
+
// A list's entries are no Page a link can name (`routeParameter`): a link names one entry.
|
|
4
|
+
return Boolean(node.reference) && node.tombstoned !== true && !node.routeParameter;
|
|
4
5
|
}
|
|
5
6
|
/** Whether a catalog node would give the Navigation anything: a live Page, or one somewhere beneath it. */
|
|
6
7
|
export function hasPhiBuilderNavigableContent(node) {
|
|
@@ -20,6 +20,9 @@ function resolveProviderArea(context) {
|
|
|
20
20
|
? context.optionsProvider.area
|
|
21
21
|
: builderArea;
|
|
22
22
|
}
|
|
23
|
+
function humanizeRouteParameter(name) {
|
|
24
|
+
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
25
|
+
}
|
|
23
26
|
function collectPageOptions(area, nodes) {
|
|
24
27
|
return nodes.flatMap((node) => {
|
|
25
28
|
/*
|
|
@@ -44,11 +47,14 @@ function collectPageOptions(area, nodes) {
|
|
|
44
47
|
* by an author, and either way it hides where the Page answers: "Zz Nw Test" is `/zz-nw-test`.
|
|
45
48
|
*/
|
|
46
49
|
const address = node.storagePath ?? path;
|
|
50
|
+
// A list's entries are a kind, not one Page: named so beside their pattern, `Slug · /blog/:slug`.
|
|
51
|
+
const description = node.routeParameter ? `${humanizeRouteParameter(node.routeParameter)} · ${address}` : address;
|
|
47
52
|
return [
|
|
48
53
|
{
|
|
49
54
|
value: path,
|
|
50
55
|
label,
|
|
51
|
-
...(
|
|
56
|
+
...(description !== label ? { description } : {}),
|
|
57
|
+
...(node.routeParameter ? { icon: "antd:unordered-list" } : {}),
|
|
52
58
|
},
|
|
53
59
|
...collectPageOptions(area, node.children ?? []),
|
|
54
60
|
];
|