@phis/ui 0.5.5 → 0.5.6
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/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.js +7 -2
- 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/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 +7 -1
- package/plugins/runtime-modules/core/widgets/card/config.js +19 -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/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/types/cms-module-descriptors.d.ts +24 -0
- package/types/module-media.d.ts +31 -0
- package/types/module-media.js +11 -0
- package/types.d.ts +1 -0
|
@@ -8,6 +8,7 @@ import type { PhiViewerAccessPolicy } from "./access";
|
|
|
8
8
|
import type { PhiSignalRoute } from "./signals";
|
|
9
9
|
import type { PhiCmsInstanceId } from "./cms-instance-id";
|
|
10
10
|
import type { PhiRuntimeModuleFormDefinition } from "../components/forms/form-registry";
|
|
11
|
+
import type { PhiModuleMediaResolver } from "./module-media";
|
|
11
12
|
export type PhiRuntimeModuleId = `${string}/${string}`;
|
|
12
13
|
export type PhiCmsPresetIdentity = {
|
|
13
14
|
ownerModuleId: PhiRuntimeModuleId;
|
|
@@ -31,6 +32,12 @@ export type PhiCmsDescriptorBuildContext = {
|
|
|
31
32
|
page: PhiCmsPageNode;
|
|
32
33
|
runtime: PhiBlockRuntime;
|
|
33
34
|
catalog: PhiCmsCompiledDescriptorCatalog;
|
|
35
|
+
/**
|
|
36
|
+
* The ids the Site's Media library holds for the names the owning Module's own package declares
|
|
37
|
+
* (`phis.media`). Area shell, Area Overlay and route presets get it; a Theme preset or block loader has
|
|
38
|
+
* no context and does not.
|
|
39
|
+
*/
|
|
40
|
+
media: PhiModuleMediaResolver;
|
|
34
41
|
};
|
|
35
42
|
export type PhiCmsAreaShellPresetDescriptor = PhiCmsPresetIdentity & {
|
|
36
43
|
shellPresetVersion: number;
|
|
@@ -174,6 +181,15 @@ export type PhiCmsNavigationBaseItemDescriptor = {
|
|
|
174
181
|
signalRoutes?: {
|
|
175
182
|
emits?: readonly PhiSignalRoute[];
|
|
176
183
|
};
|
|
184
|
+
/**
|
|
185
|
+
* On an entry with children: where its folder address leads -- the itemKey of one direct child that
|
|
186
|
+
* goes to a route of the same Module, usually an overview. The folder address is the folder the
|
|
187
|
+
* children's paths share (`/faq` for `/faq/overview` and `/faq/hosting`); a request for it is
|
|
188
|
+
* forwarded to that child's Page. A Page is never a folder, so the overview is a child like the
|
|
189
|
+
* others and the container has no Page of its own. A Site's own choice in the Builder replaces it
|
|
190
|
+
* (phis-server REFERENCES.md, "Folder addresses"); THIRD_PARTY_MODULES.md, "Addresses and folders".
|
|
191
|
+
*/
|
|
192
|
+
folderTarget?: string;
|
|
177
193
|
children?: readonly PhiCmsNavigationBaseItemDescriptor[];
|
|
178
194
|
};
|
|
179
195
|
/**
|
|
@@ -263,6 +279,8 @@ export type PhiCmsNavigationInjectionItemDescriptor = {
|
|
|
263
279
|
signalRoutes?: {
|
|
264
280
|
emits?: readonly PhiSignalRoute[];
|
|
265
281
|
};
|
|
282
|
+
/** As on an Area's own entry: the direct child the folder address leads to. */
|
|
283
|
+
folderTarget?: string;
|
|
266
284
|
children?: readonly PhiCmsNavigationInjectionItemDescriptor[];
|
|
267
285
|
};
|
|
268
286
|
/**
|
|
@@ -338,6 +356,12 @@ export type PhiCmsResolvedNavigationItem = {
|
|
|
338
356
|
accessPolicy?: PhiViewerAccessPolicy;
|
|
339
357
|
/** The routes this entry sends on when it is chosen, carried through from its descriptor. */
|
|
340
358
|
emits?: readonly PhiSignalRoute[];
|
|
359
|
+
/**
|
|
360
|
+
* A Module container's folder, from its descriptor's `folderTarget`: the address its children share
|
|
361
|
+
* and the Page of the child it names. Absent where the children share no folder. A Site's override
|
|
362
|
+
* for the container replaces it.
|
|
363
|
+
*/
|
|
364
|
+
folder?: PhiCmsNavigationFolder;
|
|
341
365
|
children: readonly PhiCmsResolvedNavigationItem[];
|
|
342
366
|
};
|
|
343
367
|
export type PhiCmsResolvedNavigationSurface = {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pictures a Module's own package declares (`phis.media` in its `package.json`) as the Site's Media
|
|
3
|
+
* library holds them (design/MODULE_MEDIA.md in phis-server; THIRD_PARTY_MODULES.md, "Pictures a Module
|
|
4
|
+
* ships").
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* What a route, Area shell or Area Overlay preset asks for the ids of the names its own package declares.
|
|
8
|
+
*
|
|
9
|
+
* Bound to the package of the preset's owner: a Module cannot ask for another package's names. Each call
|
|
10
|
+
* answers the Asset id (`asset`) or the Media Folder id (`folder`) the Site holds for the name, or `null`
|
|
11
|
+
* where it has none -- the name is not imported yet, or its Asset or folder was deleted. A preset leaves
|
|
12
|
+
* the picture out then. Asynchronous because the Site reads the mapping from Core on first use only: a
|
|
13
|
+
* preset that never asks costs no request.
|
|
14
|
+
*/
|
|
15
|
+
export type PhiModuleMediaResolver = {
|
|
16
|
+
asset(key: string): Promise<number | null>;
|
|
17
|
+
folder(key: string): Promise<number | null>;
|
|
18
|
+
};
|
|
19
|
+
/** Package name -> declared key -> id, as `GET /api/v1/site/module-media` answers it. */
|
|
20
|
+
export type PhiModuleMediaMapping = {
|
|
21
|
+
assets: Readonly<Record<string, Readonly<Record<string, number>>>>;
|
|
22
|
+
folders: Readonly<Record<string, Readonly<Record<string, number>>>>;
|
|
23
|
+
};
|
|
24
|
+
/** Reads the Site's mapping. Called at most once per instantiation, on the first question. */
|
|
25
|
+
export type PhiModuleMediaLoader = () => Promise<PhiModuleMediaMapping>;
|
|
26
|
+
/** The mapping of a Site that holds nothing. */
|
|
27
|
+
export declare const PHI_EMPTY_MODULE_MEDIA_MAPPING: PhiModuleMediaMapping;
|
|
28
|
+
/**
|
|
29
|
+
* For a caller without a Core -- a contract script, a test: every name is answered `null`.
|
|
30
|
+
*/
|
|
31
|
+
export declare const PHI_EMPTY_MODULE_MEDIA_LOADER: PhiModuleMediaLoader;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pictures a Module's own package declares (`phis.media` in its `package.json`) as the Site's Media
|
|
3
|
+
* library holds them (design/MODULE_MEDIA.md in phis-server; THIRD_PARTY_MODULES.md, "Pictures a Module
|
|
4
|
+
* ships").
|
|
5
|
+
*/
|
|
6
|
+
/** The mapping of a Site that holds nothing. */
|
|
7
|
+
export const PHI_EMPTY_MODULE_MEDIA_MAPPING = { assets: {}, folders: {} };
|
|
8
|
+
/**
|
|
9
|
+
* For a caller without a Core -- a contract script, a test: every name is answered `null`.
|
|
10
|
+
*/
|
|
11
|
+
export const PHI_EMPTY_MODULE_MEDIA_LOADER = async () => PHI_EMPTY_MODULE_MEDIA_MAPPING;
|
package/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from "./types/cms-overlay";
|
|
|
3
3
|
export type * from "./types/cms-container";
|
|
4
4
|
export * from "./types/cms-instance-id";
|
|
5
5
|
export { type PhiCmsAreaDefinition, type PhiCmsAreaOverlayPresetDescriptor, type PhiCmsAreaShellCompositionSource, type PhiCmsAreaShellPresetBinding, type PhiCmsAreaShellPresetDescriptor, type PhiCmsDescriptorBuildContext, type PhiCmsNavigationAnchor, type PhiCmsNavigationAnchoredInjectionDescriptor, type PhiCmsNavigationAnchorPlacement, type PhiCmsNavigationAreaTarget, type PhiCmsNavigationBaseItemDescriptor, type PhiCmsNavigationCustomItem, type PhiCmsNavigationExternalTarget, type PhiCmsNavigationFolder, type PhiCmsNavigationFolderTarget, type PhiCmsNavigationInjectionDescriptor, type PhiCmsNavigationInjectionItemDescriptor, type PhiCmsNavigationItemOverride, type PhiCmsNavigationItemPlacement, type PhiCmsNavigationItemStanding, type PhiCmsNavigationKeyedInjectionDescriptor, type PhiCmsNavigationLabel, type PhiCmsNavigationSurfaceDescriptor, type PhiCmsPresetIdentity, type PhiCmsPresetSource, type PhiCmsRoutePresetBinding, type PhiCmsRoutePresetDescriptor, type PhiCmsThemeBlockBinding, type PhiCmsThemeBlockDescriptor, type PhiCmsThemeBlockKind, type PhiCmsThemeDescriptorContribution, type PhiCmsThemePresetBinding, type PhiCmsThemePresetDescriptor, type PhiRuntimeModuleId, } from "./types/cms-module-descriptors";
|
|
6
|
+
export type { PhiModuleMediaResolver } from "./types/module-media";
|
|
6
7
|
export { expandPhiBorderRadiusConfig, mergePhiBorderWidgetConfig, mergePhiCmsConfigValues, mergePhiPaddingWidgetConfig, normalizePhiPaddingWidgetConfig, } from "./types/cms-config";
|
|
7
8
|
export type { PhiCmsBorderWidgetConfig, PhiCmsPaddingWidgetConfig, PhiCmsPluginConfigBase, PhiCmsRenderableBlockConfigBase, } from "./types/cms-config";
|
|
8
9
|
export { readPhiCmsBorderWidgetConfig } from "./types/cms-border-config";
|