@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
package/module-records.d.ts
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* Server half every route of the Site imports. A Provider's resolver is the package's own function; the
|
|
7
7
|
* types say what it is asked with, `fetchPhiSiteApi` asks Core with the credentials the context carries,
|
|
8
8
|
* and `resolvePhiRecordSource` is how one of the package's Server Widgets reads the record its binding
|
|
9
|
-
* names -- once per request, however many Widgets are bound to it.
|
|
9
|
+
* names -- once per request, however many Widgets are bound to it. `resolvePhiPageRecordFields` reads the
|
|
10
|
+
* declared fields of the record the Page is about, through the same read.
|
|
10
11
|
*
|
|
11
12
|
* `PhiWidgetFailureServer` is what such a Widget renders when that read, or its binding, fails: the error
|
|
12
13
|
* card in the Builder, nothing on a live page, and the `cms.widget.unavailable` warning either way. It is
|
|
@@ -14,8 +15,9 @@
|
|
|
14
15
|
* in `@phis/ui/runtime/data-provider-client`.
|
|
15
16
|
*/
|
|
16
17
|
import "server-only";
|
|
17
|
-
export type { PhiRuntimeModuleRecordProviderServerDefinition, PhiRuntimeRecordProviderContext, PhiRuntimeRecordProviderResolver, } from "./types/record-provider";
|
|
18
|
+
export type { PhiRecordField, PhiRecordLink, PhiRecordPicture, PhiRecordSample, PhiRecordTag, PhiRuntimeModuleRecordProviderServerDefinition, PhiRuntimeRecordFieldsReader, PhiRuntimeRecordProviderContext, PhiRuntimeRecordProviderResolver, PhiRuntimeRecordSamplesReader, } from "./types/record-provider";
|
|
18
19
|
export { resolvePhiRecordSource, type PhiRecordSourceResult } from "./server-helpers/record-source";
|
|
20
|
+
export { resolvePhiPageRecordFields, type PhiPageRecordFieldsResult } from "./server-helpers/record-fields";
|
|
19
21
|
export { fetchPhiSiteApi, type PhiSiteApiRequest } from "./gateway/site-api-request";
|
|
20
22
|
export { PhiWidgetFailureServer } from "./components/widgets/shared/widget-failure.server";
|
|
21
23
|
export type { PhiWidgetFailureProps } from "./components/widgets/shared/widget-failure";
|
package/module-records.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* Server half every route of the Site imports. A Provider's resolver is the package's own function; the
|
|
7
7
|
* types say what it is asked with, `fetchPhiSiteApi` asks Core with the credentials the context carries,
|
|
8
8
|
* and `resolvePhiRecordSource` is how one of the package's Server Widgets reads the record its binding
|
|
9
|
-
* names -- once per request, however many Widgets are bound to it.
|
|
9
|
+
* names -- once per request, however many Widgets are bound to it. `resolvePhiPageRecordFields` reads the
|
|
10
|
+
* declared fields of the record the Page is about, through the same read.
|
|
10
11
|
*
|
|
11
12
|
* `PhiWidgetFailureServer` is what such a Widget renders when that read, or its binding, fails: the error
|
|
12
13
|
* card in the Builder, nothing on a live page, and the `cms.widget.unavailable` warning either way. It is
|
|
@@ -15,5 +16,6 @@
|
|
|
15
16
|
*/
|
|
16
17
|
import "server-only";
|
|
17
18
|
export { resolvePhiRecordSource } from "./server-helpers/record-source";
|
|
19
|
+
export { resolvePhiPageRecordFields } from "./server-helpers/record-fields";
|
|
18
20
|
export { fetchPhiSiteApi } from "./gateway/site-api-request";
|
|
19
21
|
export { PhiWidgetFailureServer } from "./components/widgets/shared/widget-failure.server";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A build-time patch for one line of Ant Design 6.7 (`antd/es/form/context.js`), applied by the Turbopack
|
|
3
|
+
* rule `withPhiNextConfig` sets (next/config.mjs). Remove it, the rule and the export once Ant Design
|
|
4
|
+
* imports the Form provider directly (TODOS.md, "At the next release").
|
|
5
|
+
*
|
|
6
|
+
* Since 6.7.0 every Button reads the Form's variant (`form/hooks/useVariants` -> `form/context`), and that
|
|
7
|
+
* file takes `FormProvider` from `@rc-component/form`'s entry, which declares no `sideEffects` and assigns
|
|
8
|
+
* statics on import -- so each page with a Button loaded the whole Form engine and `async-validator`
|
|
9
|
+
* (about 42 kB). `FormContext` is where the provider lives and imports React alone.
|
|
10
|
+
*
|
|
11
|
+
* Exact text only: a file that reads differently is left as it is, with a warning, so a changed Ant Design
|
|
12
|
+
* is never patched by guesswork.
|
|
13
|
+
*/
|
|
14
|
+
export const PHI_ANTD_FORM_CONTEXT_IMPORT = "import { FormProvider as RcFormProvider } from '@rc-component/form';";
|
|
15
|
+
export const PHI_ANTD_FORM_CONTEXT_PATCHED_IMPORT =
|
|
16
|
+
"import { FormProvider as RcFormProvider } from '@rc-component/form/es/FormContext';";
|
|
17
|
+
|
|
18
|
+
export function patchPhiAntdFormContext(source) {
|
|
19
|
+
const occurrences = source.split(PHI_ANTD_FORM_CONTEXT_IMPORT).length - 1;
|
|
20
|
+
return occurrences === 1 ? source.replace(PHI_ANTD_FORM_CONTEXT_IMPORT, PHI_ANTD_FORM_CONTEXT_PATCHED_IMPORT) : null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default function phiAntdFormContextLoader(source) {
|
|
24
|
+
const patched = patchPhiAntdFormContext(source);
|
|
25
|
+
if (patched !== null) return patched;
|
|
26
|
+
this.emitWarning?.(new Error(
|
|
27
|
+
"@phis/ui: antd/es/form/context.js no longer reads as Ant Design 6.7.0 wrote it; the Form provider patch "
|
|
28
|
+
+ "was not applied. Check whether Ant Design imports the provider directly now and remove the patch.",
|
|
29
|
+
));
|
|
30
|
+
return source;
|
|
31
|
+
}
|
package/next/config.d.mts
CHANGED
|
@@ -17,6 +17,8 @@ export declare function ensurePhiAntdStaticCss(projectDir?: string): string;
|
|
|
17
17
|
|
|
18
18
|
/** The host in `config/site-runtime.json`'s `site.publicUrl` under `dir`, or `null` where there is none. */
|
|
19
19
|
export declare function readPhiSitePublicHost(dir?: string): string | null;
|
|
20
|
+
/** The Turbopack rule patching Ant Design 6.7's Form context import, or `null` for any other Ant Design. */
|
|
21
|
+
export declare function readPhiAntdFormContextPatchRule(dir?: string): Record<string, unknown> | null;
|
|
20
22
|
|
|
21
23
|
/**
|
|
22
24
|
* A Site's `next.config`, with `@phis/ui/antd-static.css` resolved to the structure generated for its
|
package/next/config.mjs
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* What a Site's `next.config` takes from this package: the structural CSS of every Ant Design component,
|
|
3
3
|
* generated from the Ant Design the Site has installed.
|
|
4
4
|
*
|
|
5
|
-
* Ant Design emits two kinds of CSS. The structure -- `.ant-btn{padding:...;color:var(--
|
|
5
|
+
* Ant Design emits two kinds of CSS. The structure -- `.ant-btn{padding:...;color:var(--phi-color-text)}`
|
|
6
6
|
* -- reads every Theme value through a custom property, so it is the same for every Site, Theme and mode.
|
|
7
|
-
* The custom properties themselves -- `.phi-root-...{--
|
|
7
|
+
* The custom properties themselves -- `.phi-root-...{--phi-color-primary:...}` -- are what a Theme
|
|
8
8
|
* decides. The root runs Ant Design with `zeroRuntime`, which drops the structure from rendering and
|
|
9
9
|
* keeps the properties; this file is where the structure comes from instead. Generating it at runtime
|
|
10
10
|
* cost about 10 ms of CPU per page view and 40-140 KB of inline CSS per page (measured 04.10.2026).
|
|
@@ -189,7 +189,7 @@ export function generatePhiAntdStaticCss(projectDir = process.cwd()) {
|
|
|
189
189
|
const h = react.createElement;
|
|
190
190
|
const { createCache, extractStyle, px2remTransformer, StyleProvider } = site.cssinjs;
|
|
191
191
|
const cache = createCache();
|
|
192
|
-
const theme = { hashed: false, cssVar: { prefix: "
|
|
192
|
+
const theme = { hashed: false, cssVar: { prefix: "phi", key: "phi-static" } };
|
|
193
193
|
withoutDeprecationNotices(() => site.renderToString(
|
|
194
194
|
h(StyleProvider, {
|
|
195
195
|
cache,
|
|
@@ -277,6 +277,35 @@ export function readPhiSitePublicHost(dir = process.cwd()) {
|
|
|
277
277
|
return new URL(publicUrl).hostname;
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
+
/**
|
|
281
|
+
* The Turbopack rule that patches Ant Design 6.7's Form context import (next/antd-form-context-loader.mjs),
|
|
282
|
+
* or none for any other Ant Design: the patch is for 6.7 only, and a newer release is to be checked and the
|
|
283
|
+
* patch removed rather than carried along by default.
|
|
284
|
+
*/
|
|
285
|
+
export function readPhiAntdFormContextPatchRule(dir = process.cwd()) {
|
|
286
|
+
let version;
|
|
287
|
+
try {
|
|
288
|
+
version = JSON.parse(readFileSync(createRequire(path.join(dir, "package.json")).resolve("antd/package.json"), "utf8")).version;
|
|
289
|
+
} catch {
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
if (!/^6\.7\./u.test(version)) {
|
|
293
|
+
if (/^6\.(?:[89]|\d{2,})\./u.test(version) || /^(?:[7-9]|\d{2,})\./u.test(version)) {
|
|
294
|
+
console.warn(
|
|
295
|
+
`@phis/ui: Ant Design ${version} is past 6.7; check whether antd/es/form/context.js still imports `
|
|
296
|
+
+ "@rc-component/form whole, and remove the Form provider patch if it does not (TODOS.md).",
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
return null;
|
|
300
|
+
}
|
|
301
|
+
return {
|
|
302
|
+
"context.js": {
|
|
303
|
+
condition: { path: /[\\/]antd[\\/]es[\\/]form[\\/]context\.js$/u },
|
|
304
|
+
loaders: ["@phis/ui/next/antd-form-context-loader"],
|
|
305
|
+
},
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
|
|
280
309
|
/**
|
|
281
310
|
* A Site's `next.config`, with `@phis/ui/antd-static.css` resolved to the structure generated for its
|
|
282
311
|
* Ant Design, and the Site's own public host allowed to reach the dev server. `dir` is the Site's root,
|
|
@@ -295,6 +324,10 @@ export function withPhiNextConfig(nextConfig, { dir = process.cwd() } = {}) {
|
|
|
295
324
|
...(allowedDevOrigins.length > 0 ? { allowedDevOrigins } : {}),
|
|
296
325
|
turbopack: {
|
|
297
326
|
...nextConfig.turbopack,
|
|
327
|
+
rules: {
|
|
328
|
+
...nextConfig.turbopack?.rules,
|
|
329
|
+
...readPhiAntdFormContextPatchRule(dir),
|
|
330
|
+
},
|
|
298
331
|
resolveAlias: {
|
|
299
332
|
...nextConfig.turbopack?.resolveAlias,
|
|
300
333
|
[PHI_ANTD_STATIC_CSS]: file,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phis/ui",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -117,6 +117,10 @@
|
|
|
117
117
|
"import": "./next/config.mjs",
|
|
118
118
|
"default": "./next/config.mjs"
|
|
119
119
|
},
|
|
120
|
+
"./next/antd-form-context-loader": {
|
|
121
|
+
"import": "./next/antd-form-context-loader.mjs",
|
|
122
|
+
"default": "./next/antd-form-context-loader.mjs"
|
|
123
|
+
},
|
|
120
124
|
"./next/overlay-zones-client": {
|
|
121
125
|
"types": "./components/overlays/phi-overlay-zones-loader.d.ts",
|
|
122
126
|
"import": "./components/overlays/phi-overlay-zones-loader.js",
|
|
@@ -282,6 +286,11 @@
|
|
|
282
286
|
"import": "./module-records.js",
|
|
283
287
|
"default": "./module-records.js"
|
|
284
288
|
},
|
|
289
|
+
"./module/page-check": {
|
|
290
|
+
"types": "./module-page-check.d.ts",
|
|
291
|
+
"import": "./module-page-check.js",
|
|
292
|
+
"default": "./module-page-check.js"
|
|
293
|
+
},
|
|
285
294
|
"./module/references": {
|
|
286
295
|
"types": "./module-references.d.ts",
|
|
287
296
|
"import": "./module-references.js",
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import type { PhiTableProviderResourceDescriptor } from "../../../types/table-widget";
|
|
2
|
-
/** How the Folder's pictures are ordered; the words a record binding's `sort` takes. */
|
|
3
|
-
export declare const PHI_MEDIA_FOLDER_IMAGES_SORTS: readonly ["name_asc", "created_at_desc"];
|
|
4
|
-
export declare const PHI_MEDIA_FOLDER_IMAGES_DEFAULT_LIMIT = 50;
|
|
5
|
-
/** What the server hands out at most (`/api/v1/site/media/folder-images`). */
|
|
6
|
-
export declare const PHI_MEDIA_FOLDER_IMAGES_MAX_LIMIT = 200;
|
|
7
2
|
/** The existing User and Group Spaces, one resource per kind, for the Admin storage table. */
|
|
8
3
|
export declare const PHI_ASSET_STORAGE_SPACES_RESOURCES: readonly PhiTableProviderResourceDescriptor[];
|
|
9
4
|
export declare const PHI_ASSET_RUNTIME_DATA_PROVIDER_DESCRIPTORS: ({
|
|
@@ -16,7 +11,6 @@ export declare const PHI_ASSET_RUNTIME_DATA_PROVIDER_DESCRIPTORS: ({
|
|
|
16
11
|
description: string;
|
|
17
12
|
resources: readonly PhiTableProviderResourceDescriptor[];
|
|
18
13
|
availableToAuthoringChrome?: undefined;
|
|
19
|
-
settingsFields?: undefined;
|
|
20
14
|
} | {
|
|
21
15
|
key: `${string}/${string}`;
|
|
22
16
|
ownerModuleId: "@phis/ui/modules/asset";
|
|
@@ -27,7 +21,6 @@ export declare const PHI_ASSET_RUNTIME_DATA_PROVIDER_DESCRIPTORS: ({
|
|
|
27
21
|
description: string;
|
|
28
22
|
resources?: undefined;
|
|
29
23
|
availableToAuthoringChrome?: undefined;
|
|
30
|
-
settingsFields?: undefined;
|
|
31
24
|
} | {
|
|
32
25
|
key: `${string}/${string}`;
|
|
33
26
|
ownerModuleId: "@phis/ui/modules/asset";
|
|
@@ -38,63 +31,6 @@ export declare const PHI_ASSET_RUNTIME_DATA_PROVIDER_DESCRIPTORS: ({
|
|
|
38
31
|
description: string;
|
|
39
32
|
availableToAuthoringChrome: true;
|
|
40
33
|
resources?: undefined;
|
|
41
|
-
settingsFields?: undefined;
|
|
42
|
-
} | {
|
|
43
|
-
key: `${string}/${string}`;
|
|
44
|
-
ownerModuleId: "@phis/ui/modules/asset";
|
|
45
|
-
kind: "record";
|
|
46
|
-
executionMode: "live";
|
|
47
|
-
authoringMode: "none";
|
|
48
|
-
title: string;
|
|
49
|
-
description: string;
|
|
50
|
-
settingsFields: ({
|
|
51
|
-
key: string;
|
|
52
|
-
type: "choice";
|
|
53
|
-
heading: string;
|
|
54
|
-
label: string;
|
|
55
|
-
optionsProvider: {
|
|
56
|
-
providerKey: `${string}/${string}`;
|
|
57
|
-
};
|
|
58
|
-
description?: undefined;
|
|
59
|
-
options?: undefined;
|
|
60
|
-
min?: undefined;
|
|
61
|
-
max?: undefined;
|
|
62
|
-
} | {
|
|
63
|
-
key: string;
|
|
64
|
-
type: "boolean";
|
|
65
|
-
label: string;
|
|
66
|
-
description: string;
|
|
67
|
-
heading?: undefined;
|
|
68
|
-
optionsProvider?: undefined;
|
|
69
|
-
options?: undefined;
|
|
70
|
-
min?: undefined;
|
|
71
|
-
max?: undefined;
|
|
72
|
-
} | {
|
|
73
|
-
key: string;
|
|
74
|
-
type: "choice";
|
|
75
|
-
label: string;
|
|
76
|
-
options: {
|
|
77
|
-
value: string;
|
|
78
|
-
label: string;
|
|
79
|
-
}[];
|
|
80
|
-
heading?: undefined;
|
|
81
|
-
optionsProvider?: undefined;
|
|
82
|
-
description?: undefined;
|
|
83
|
-
min?: undefined;
|
|
84
|
-
max?: undefined;
|
|
85
|
-
} | {
|
|
86
|
-
key: string;
|
|
87
|
-
type: "number";
|
|
88
|
-
label: string;
|
|
89
|
-
min: number;
|
|
90
|
-
max: number;
|
|
91
|
-
heading?: undefined;
|
|
92
|
-
optionsProvider?: undefined;
|
|
93
|
-
description?: undefined;
|
|
94
|
-
options?: undefined;
|
|
95
|
-
})[];
|
|
96
|
-
resources?: undefined;
|
|
97
|
-
availableToAuthoringChrome?: undefined;
|
|
98
34
|
} | {
|
|
99
35
|
key: `${string}/${string}`;
|
|
100
36
|
ownerModuleId: "@phis/ui/modules/asset";
|
|
@@ -145,5 +81,4 @@ export declare const PHI_ASSET_RUNTIME_DATA_PROVIDER_DESCRIPTORS: ({
|
|
|
145
81
|
title: string;
|
|
146
82
|
}[];
|
|
147
83
|
}[];
|
|
148
|
-
settingsFields?: undefined;
|
|
149
84
|
})[];
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { PHI_SIGNAL_VALUE_SCHEMAS } from "../../../types/signals";
|
|
2
2
|
import { PHI_ASSET_RUNTIME_DATA_PROVIDER_KEYS, PHI_ASSET_RUNTIME_ITEM_RENDERER_KEY } from "./ids";
|
|
3
3
|
import { PHI_ASSET_RUNTIME_MODULE_ID } from "./ids";
|
|
4
|
-
/** How the Folder's pictures are ordered; the words a record binding's `sort` takes. */
|
|
5
|
-
export const PHI_MEDIA_FOLDER_IMAGES_SORTS = ["name_asc", "created_at_desc"];
|
|
6
|
-
export const PHI_MEDIA_FOLDER_IMAGES_DEFAULT_LIMIT = 50;
|
|
7
|
-
/** What the server hands out at most (`/api/v1/site/media/folder-images`). */
|
|
8
|
-
export const PHI_MEDIA_FOLDER_IMAGES_MAX_LIMIT = 200;
|
|
9
4
|
/** The existing User and Group Spaces, one resource per kind, for the Admin storage table. */
|
|
10
5
|
export const PHI_ASSET_STORAGE_SPACES_RESOURCES = [
|
|
11
6
|
{
|
|
@@ -74,41 +69,6 @@ export const PHI_ASSET_RUNTIME_DATA_PROVIDER_DESCRIPTORS = [
|
|
|
74
69
|
// Named in a record binding's parameters, which the Builder edits on any page.
|
|
75
70
|
availableToAuthoringChrome: true,
|
|
76
71
|
},
|
|
77
|
-
/*
|
|
78
|
-
* The pictures of a Folder, read on the server while the page is drawn (`types/record-provider.ts`).
|
|
79
|
-
* A Folder is a thing somebody keeps filling, so the page reads it rather than naming each picture:
|
|
80
|
-
* what is public in the branch at render time is what the Gallery shows.
|
|
81
|
-
*/
|
|
82
|
-
{
|
|
83
|
-
key: PHI_ASSET_RUNTIME_DATA_PROVIDER_KEYS.mediaFolderImages,
|
|
84
|
-
ownerModuleId: PHI_ASSET_RUNTIME_MODULE_ID,
|
|
85
|
-
kind: "record",
|
|
86
|
-
executionMode: "live",
|
|
87
|
-
// The Builder draws a placeholder for a Gallery and reads nothing.
|
|
88
|
-
authoringMode: "none",
|
|
89
|
-
title: "Media folder pictures",
|
|
90
|
-
description: "The public pictures of one media folder, with its subfolders unless told otherwise.",
|
|
91
|
-
settingsFields: [
|
|
92
|
-
{
|
|
93
|
-
key: "folderId",
|
|
94
|
-
type: "choice",
|
|
95
|
-
heading: "Folder",
|
|
96
|
-
label: "Folder",
|
|
97
|
-
optionsProvider: { providerKey: PHI_ASSET_RUNTIME_DATA_PROVIDER_KEYS.mediaFolderChoices },
|
|
98
|
-
},
|
|
99
|
-
{ key: "topLevelOnly", type: "boolean", label: "This folder only", description: "Leave the pictures in its subfolders out." },
|
|
100
|
-
{
|
|
101
|
-
key: "sort",
|
|
102
|
-
type: "choice",
|
|
103
|
-
label: "Order",
|
|
104
|
-
options: [
|
|
105
|
-
{ value: "name_asc", label: "By file name" },
|
|
106
|
-
{ value: "created_at_desc", label: "Newest first" },
|
|
107
|
-
],
|
|
108
|
-
},
|
|
109
|
-
{ key: "limit", type: "number", label: "At most", min: 1, max: PHI_MEDIA_FOLDER_IMAGES_MAX_LIMIT },
|
|
110
|
-
],
|
|
111
|
-
},
|
|
112
72
|
{
|
|
113
73
|
key: PHI_ASSET_RUNTIME_DATA_PROVIDER_KEYS.mediaFolders,
|
|
114
74
|
ownerModuleId: PHI_ASSET_RUNTIME_MODULE_ID,
|
|
@@ -20,7 +20,6 @@ export declare const PHI_ASSET_RUNTIME_MODULE_DEFINITION: {
|
|
|
20
20
|
description: string;
|
|
21
21
|
resources: readonly import("../../../types").PhiTableProviderResourceDescriptor[];
|
|
22
22
|
availableToAuthoringChrome?: undefined;
|
|
23
|
-
settingsFields?: undefined;
|
|
24
23
|
} | {
|
|
25
24
|
key: `${string}/${string}`;
|
|
26
25
|
ownerModuleId: "@phis/ui/modules/asset";
|
|
@@ -31,7 +30,6 @@ export declare const PHI_ASSET_RUNTIME_MODULE_DEFINITION: {
|
|
|
31
30
|
description: string;
|
|
32
31
|
resources?: undefined;
|
|
33
32
|
availableToAuthoringChrome?: undefined;
|
|
34
|
-
settingsFields?: undefined;
|
|
35
33
|
} | {
|
|
36
34
|
key: `${string}/${string}`;
|
|
37
35
|
ownerModuleId: "@phis/ui/modules/asset";
|
|
@@ -42,63 +40,6 @@ export declare const PHI_ASSET_RUNTIME_MODULE_DEFINITION: {
|
|
|
42
40
|
description: string;
|
|
43
41
|
availableToAuthoringChrome: true;
|
|
44
42
|
resources?: undefined;
|
|
45
|
-
settingsFields?: undefined;
|
|
46
|
-
} | {
|
|
47
|
-
key: `${string}/${string}`;
|
|
48
|
-
ownerModuleId: "@phis/ui/modules/asset";
|
|
49
|
-
kind: "record";
|
|
50
|
-
executionMode: "live";
|
|
51
|
-
authoringMode: "none";
|
|
52
|
-
title: string;
|
|
53
|
-
description: string;
|
|
54
|
-
settingsFields: ({
|
|
55
|
-
key: string;
|
|
56
|
-
type: "choice";
|
|
57
|
-
heading: string;
|
|
58
|
-
label: string;
|
|
59
|
-
optionsProvider: {
|
|
60
|
-
providerKey: `${string}/${string}`;
|
|
61
|
-
};
|
|
62
|
-
description?: undefined;
|
|
63
|
-
options?: undefined;
|
|
64
|
-
min?: undefined;
|
|
65
|
-
max?: undefined;
|
|
66
|
-
} | {
|
|
67
|
-
key: string;
|
|
68
|
-
type: "boolean";
|
|
69
|
-
label: string;
|
|
70
|
-
description: string;
|
|
71
|
-
heading?: undefined;
|
|
72
|
-
optionsProvider?: undefined;
|
|
73
|
-
options?: undefined;
|
|
74
|
-
min?: undefined;
|
|
75
|
-
max?: undefined;
|
|
76
|
-
} | {
|
|
77
|
-
key: string;
|
|
78
|
-
type: "choice";
|
|
79
|
-
label: string;
|
|
80
|
-
options: {
|
|
81
|
-
value: string;
|
|
82
|
-
label: string;
|
|
83
|
-
}[];
|
|
84
|
-
heading?: undefined;
|
|
85
|
-
optionsProvider?: undefined;
|
|
86
|
-
description?: undefined;
|
|
87
|
-
min?: undefined;
|
|
88
|
-
max?: undefined;
|
|
89
|
-
} | {
|
|
90
|
-
key: string;
|
|
91
|
-
type: "number";
|
|
92
|
-
label: string;
|
|
93
|
-
min: number;
|
|
94
|
-
max: number;
|
|
95
|
-
heading?: undefined;
|
|
96
|
-
optionsProvider?: undefined;
|
|
97
|
-
description?: undefined;
|
|
98
|
-
options?: undefined;
|
|
99
|
-
})[];
|
|
100
|
-
resources?: undefined;
|
|
101
|
-
availableToAuthoringChrome?: undefined;
|
|
102
43
|
} | {
|
|
103
44
|
key: `${string}/${string}`;
|
|
104
45
|
ownerModuleId: "@phis/ui/modules/asset";
|
|
@@ -149,7 +90,6 @@ export declare const PHI_ASSET_RUNTIME_MODULE_DEFINITION: {
|
|
|
149
90
|
title: string;
|
|
150
91
|
}[];
|
|
151
92
|
}[];
|
|
152
|
-
settingsFields?: undefined;
|
|
153
93
|
})[];
|
|
154
94
|
collectionItemRenderers: {
|
|
155
95
|
key: `${string}/${string}`;
|
|
@@ -7,7 +7,6 @@ export declare const PHI_ASSET_RUNTIME_MODULE_ID: "@phis/ui/modules/asset";
|
|
|
7
7
|
export declare const PHI_ASSET_RUNTIME_DATA_PROVIDER_KEYS: {
|
|
8
8
|
readonly mediaFolders: `${string}/${string}`;
|
|
9
9
|
readonly mediaCollection: `${string}/${string}`;
|
|
10
|
-
readonly mediaFolderImages: `${string}/${string}`;
|
|
11
10
|
/**
|
|
12
11
|
* Every Folder of the Site Space as a choice, loaded by the choice itself. `mediaFolders` reads the
|
|
13
12
|
* Media page's store, which is not there when a Gallery is configured on some other page.
|
|
@@ -10,12 +10,11 @@ export const PHI_ASSET_RUNTIME_MODULE_ID = `${PHI_SHARED_PACKAGE_NAME}/modules/a
|
|
|
10
10
|
export const PHI_ASSET_RUNTIME_DATA_PROVIDER_KEYS = {
|
|
11
11
|
mediaFolders: PHI_MEDIA_LIBRARY_DATA_PROVIDER_KEYS.folders,
|
|
12
12
|
mediaCollection: PHI_MEDIA_LIBRARY_DATA_PROVIDER_KEYS.collection,
|
|
13
|
-
mediaFolderImages: PHI_MEDIA_LIBRARY_DATA_PROVIDER_KEYS.folderImages,
|
|
14
13
|
/**
|
|
15
14
|
* Every Folder of the Site Space as a choice, loaded by the choice itself. `mediaFolders` reads the
|
|
16
15
|
* Media page's store, which is not there when a Gallery is configured on some other page.
|
|
17
16
|
*/
|
|
18
|
-
mediaFolderChoices:
|
|
17
|
+
mediaFolderChoices: PHI_MEDIA_LIBRARY_DATA_PROVIDER_KEYS.folderChoices,
|
|
19
18
|
/** The Site's Storage Profiles, for the Admin storage settings that point Spaces at one. */
|
|
20
19
|
mediaStorageProfiles: createPhiSharedRuntimeDataProviderKey("options", "media-storage-profiles"),
|
|
21
20
|
/** The existing User and Group Spaces with their Profile and quota, for the Admin storage table. */
|
|
@@ -50,5 +50,6 @@ export declare const PHI_ASSET_RUNTIME_MODULE_ROUTES: (PhiCmsRoutePresetDescript
|
|
|
50
50
|
activeModuleIds: ReadonlySet<import("../contracts").PhiRuntimeModuleId>;
|
|
51
51
|
params: Readonly<Record<string, string>>;
|
|
52
52
|
}) => import("../../../types").PhiResolvedCmsPageTree | Promise<import("../../../types").PhiResolvedCmsPageTree>;
|
|
53
|
+
pageRecord?: import("../../../types/record-provider").PhiCmsPageRecordDescriptor;
|
|
53
54
|
navigation?: readonly import("../../../types").PhiCmsNavigationInjectionDescriptor[];
|
|
54
55
|
})[];
|
|
@@ -2,7 +2,6 @@ import { PHI_ASSET_FOLDER_RUNTIME_MODULE_FORM, PHI_ASSET_METADATA_RUNTIME_MODULE
|
|
|
2
2
|
import { PHI_MEDIA_SETTINGS_RUNTIME_MODULE_FORM, PHI_MEDIA_STORAGE_SETTINGS_RUNTIME_MODULE_FORM } from "./settings-forms";
|
|
3
3
|
import { definePhiRuntimeModuleServerAreaContribution } from "../area-contributions";
|
|
4
4
|
import { PHI_ASSET_RUNTIME_MODULE_DEFINITION } from "./definition";
|
|
5
|
-
import { PHI_ASSET_RUNTIME_DATA_PROVIDER_KEYS } from "./ids";
|
|
6
5
|
import { PHI_ASSET_RUNTIME_MODULE_ROUTES } from "./presets";
|
|
7
6
|
import { PHI_RUNTIME_MODULE_WIDGETS as PHI_ASSET_WIDGETS } from "./widgets";
|
|
8
7
|
/**
|
|
@@ -24,10 +23,6 @@ export function createPhiAssetRuntimeModuleServerAreaContribution() {
|
|
|
24
23
|
],
|
|
25
24
|
routes: PHI_ASSET_RUNTIME_MODULE_ROUTES,
|
|
26
25
|
uiProvider: true,
|
|
27
|
-
recordProviders: [{
|
|
28
|
-
key: PHI_ASSET_RUNTIME_DATA_PROVIDER_KEYS.mediaFolderImages,
|
|
29
|
-
load: () => import("./services/folder-images.server").then((module) => module.resolvePhiMediaFolderImagesRecord),
|
|
30
|
-
}],
|
|
31
26
|
load: () => import("./module").then((module) => module.PHI_ASSET_RUNTIME_MODULE),
|
|
32
27
|
},
|
|
33
28
|
});
|
|
@@ -49,5 +49,6 @@ export declare const PHI_BLOG_RUNTIME_MODULE_ROUTES: ({
|
|
|
49
49
|
activeModuleIds: ReadonlySet<import("../contracts").PhiRuntimeModuleId>;
|
|
50
50
|
params: Readonly<Record<string, string>>;
|
|
51
51
|
}) => import("../../../types").PhiResolvedCmsPageTree | Promise<import("../../../types").PhiResolvedCmsPageTree>;
|
|
52
|
+
pageRecord?: import("../../../types/record-provider").PhiCmsPageRecordDescriptor;
|
|
52
53
|
navigation?: readonly import("../../../types").PhiCmsNavigationInjectionDescriptor[];
|
|
53
54
|
})[];
|
|
@@ -3,6 +3,7 @@ import type { PhiBackgroundControlProps } from "../../../../components/controls/
|
|
|
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";
|
|
6
|
+
import type { PhiRecordFieldDescriptor } from "../../../../types/record-provider";
|
|
6
7
|
import { type PhiRenderableBlockSize } from "../../../../types";
|
|
7
8
|
import { type PhiCmsPaddingWidgetConfig } from "../../../../types/cms-config";
|
|
8
9
|
import type { PhiColorPickerLabels } from "../../../../components/widgets/label-types/color-picker";
|
|
@@ -70,7 +71,7 @@ export declare function renderPhiInspectorPaddingConfigControl({ field, config,
|
|
|
70
71
|
onChange?: (nextPadding: PhiCmsPaddingWidgetConfig | null, patch: Record<string, unknown>) => void;
|
|
71
72
|
}): import("react").JSX.Element;
|
|
72
73
|
export declare function renderPhiInspectorConfigField(args: Parameters<typeof renderPhiInspectorConfigFieldBody>[0]): import("react").JSX.Element | null;
|
|
73
|
-
declare function renderPhiInspectorConfigFieldBody({ field, value, defaultValue, config, defaultConfig, disabled, onChange, widgetReferenceOptions, paddingLabels, backgroundLabels, borderLabels, renderMediaPicker, colorPickerLabels, iconPickerLabels, fieldLabels, dataProviderDescriptors, calendarAdapterDescriptors, videoProviderDescriptors, blockId, }: {
|
|
74
|
+
declare function renderPhiInspectorConfigFieldBody({ field, value, defaultValue, config, defaultConfig, disabled, onChange, widgetReferenceOptions, paddingLabels, backgroundLabels, borderLabels, renderMediaPicker, colorPickerLabels, iconPickerLabels, fieldLabels, dataProviderDescriptors, calendarAdapterDescriptors, videoProviderDescriptors, pageRecordFields, blockId, }: {
|
|
74
75
|
field: PhiCmsConfigField;
|
|
75
76
|
value: unknown;
|
|
76
77
|
defaultValue: unknown;
|
|
@@ -92,6 +93,8 @@ declare function renderPhiInspectorConfigFieldBody({ field, value, defaultValue,
|
|
|
92
93
|
dataProviderDescriptors?: readonly PhiRuntimeModuleDataProviderDescriptor[];
|
|
93
94
|
calendarAdapterDescriptors?: readonly PhiCalendarAdapterDescriptor[];
|
|
94
95
|
videoProviderDescriptors?: readonly PhiVideoProviderDescriptor[];
|
|
96
|
+
/** The declared fields of the record the edited Page is about; empty on a Page that is about none. */
|
|
97
|
+
pageRecordFields?: readonly PhiRecordFieldDescriptor[];
|
|
95
98
|
onChange?: (next: Record<string, unknown>) => void;
|
|
96
99
|
}): import("react").JSX.Element | null;
|
|
97
100
|
export {};
|
|
@@ -58,14 +58,14 @@ export function renderPhiInspectorSettingsRow(label, control, key) {
|
|
|
58
58
|
*/
|
|
59
59
|
function PhiInspectorSliderField({ value, min, max, step, suffix, disabled, onCommit, }) {
|
|
60
60
|
const [dragged, setDragged] = useState(null);
|
|
61
|
-
return (_jsx(PhiFlexControl, { align: "center", style: { minHeight: "var(--
|
|
61
|
+
return (_jsx(PhiFlexControl, { align: "center", style: { minHeight: "var(--phi-control-height)", width: "100%" }, children: _jsx(PhiSliderControl, { value: dragged ?? value, min: min, max: max, step: step, ...(suffix ? { tooltipSuffix: suffix } : {}), disabled: disabled, style: { width: "100%", marginInline: 6 }, onChange: setDragged, onChangeComplete: (next) => {
|
|
62
62
|
setDragged(null);
|
|
63
63
|
if (next !== value)
|
|
64
64
|
onCommit(next);
|
|
65
65
|
} }) }));
|
|
66
66
|
}
|
|
67
67
|
export function renderPhiInspectorSwitchRow({ key, label, checked, disabled, onChange, }) {
|
|
68
|
-
return renderPhiInspectorSettingsRow(label, _jsx(PhiFlexControl, { align: "center", style: { minHeight: "var(--
|
|
68
|
+
return renderPhiInspectorSettingsRow(label, _jsx(PhiFlexControl, { align: "center", style: { minHeight: "var(--phi-control-height)" }, children: _jsx(PhiSwitchControl, { checked: checked, disabled: disabled || !onChange, ...(onChange ? { onChange } : {}) }) }), key);
|
|
69
69
|
}
|
|
70
70
|
function renderPhiInspectorSettingsBlock(label, control, key) {
|
|
71
71
|
return (_jsxs(PhiFlexControl, { vertical: true, gap: 8, style: { width: "100%", minWidth: 0 }, children: [_jsx(PhiTypographyControl, { children: label }), control] }, key));
|
|
@@ -453,7 +453,7 @@ function PhiInspectorCollectionFieldControl({ field, config, labels, value, defa
|
|
|
453
453
|
return (_jsxs(PhiFlexControl, { vertical: true, gap: 8, style: {
|
|
454
454
|
width: "100%",
|
|
455
455
|
minWidth: 0,
|
|
456
|
-
padding: "var(--
|
|
456
|
+
padding: "var(--phi-padding-xs)",
|
|
457
457
|
border: `1px solid ${token.colorBorderSecondary}`,
|
|
458
458
|
borderRadius: token.borderRadius,
|
|
459
459
|
background: token.colorBgContainer,
|
|
@@ -512,7 +512,7 @@ export function renderPhiInspectorConfigField(args) {
|
|
|
512
512
|
return body;
|
|
513
513
|
return (_jsxs(Fragment, { children: [_jsx(PhiDividerControl, { titlePlacement: "start", style: { marginBlock: 0 }, children: args.field.heading }), body] }, args.field.key));
|
|
514
514
|
}
|
|
515
|
-
function renderPhiInspectorConfigFieldBody({ field, value, defaultValue, config, defaultConfig, disabled, onChange, widgetReferenceOptions, paddingLabels, backgroundLabels, borderLabels, renderMediaPicker, colorPickerLabels, iconPickerLabels, fieldLabels = PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.fields, dataProviderDescriptors = [], calendarAdapterDescriptors = [], videoProviderDescriptors = [], blockId, }) {
|
|
515
|
+
function renderPhiInspectorConfigFieldBody({ field, value, defaultValue, config, defaultConfig, disabled, onChange, widgetReferenceOptions, paddingLabels, backgroundLabels, borderLabels, renderMediaPicker, colorPickerLabels, iconPickerLabels, fieldLabels = PHI_INSPECTOR_WIDGET_DEFAULT_LABELS.fields, dataProviderDescriptors = [], calendarAdapterDescriptors = [], videoProviderDescriptors = [], pageRecordFields = [], blockId, }) {
|
|
516
516
|
if (field.type === "readonly") {
|
|
517
517
|
const displayValue = value ?? defaultValue;
|
|
518
518
|
return renderPhiInspectorConfigFieldControl(field, _jsx(PhiTextControl, { value: displayValue == null ? "" : String(displayValue), readOnly: true, allowClear: false, style: { width: "100%" } }));
|
|
@@ -611,6 +611,15 @@ function renderPhiInspectorConfigFieldBody({ field, value, defaultValue, config,
|
|
|
611
611
|
description: descriptor.description,
|
|
612
612
|
})), placeholder: fieldLabels.selectCalendar, value: typeof value === "string" ? value : typeof defaultValue === "string" ? defaultValue : undefined, disabled: disabled || !onChange, style: { width: "100%" }, onChange: (calendarAdapterKey) => onChange?.({ [field.key]: calendarAdapterKey }) }));
|
|
613
613
|
}
|
|
614
|
+
if (field.type === "record-field") {
|
|
615
|
+
// A Page that is about no record has no field to name; the row is for the Pages that are.
|
|
616
|
+
if (pageRecordFields.length === 0 && typeof value !== "string") {
|
|
617
|
+
return null;
|
|
618
|
+
}
|
|
619
|
+
return renderPhiInspectorConfigFieldControl(field, _jsx(PhiSelectControl, { allowClear: true, options: pageRecordFields
|
|
620
|
+
.filter((recordField) => field.kinds.includes(recordField.kind))
|
|
621
|
+
.map((recordField) => ({ value: recordField.key, label: recordField.label, description: recordField.description })), placeholder: fieldLabels.selectRecordField, value: typeof value === "string" ? value : undefined, disabled: disabled || !onChange, style: { width: "100%" }, onChange: (recordFieldKey) => onChange?.({ [field.key]: typeof recordFieldKey === "string" ? recordFieldKey : undefined }) }));
|
|
622
|
+
}
|
|
614
623
|
if (field.type === "video-provider") {
|
|
615
624
|
return renderPhiInspectorConfigFieldControl(field, _jsx(PhiSelectControl
|
|
616
625
|
/*
|
|
@@ -18,5 +18,5 @@ export function PhiInspectorLinkTargetFieldControl({ value, disabled, labels = P
|
|
|
18
18
|
const options = useMemo(() => buildPhiBuilderPageReferenceTree(state.area, pages, pages, { landing: labels.landingPage }), [labels.landingPage, pages, state.area]);
|
|
19
19
|
return (_jsx(PhiLinkTargetControl, { value: value, options: options, labels: labels, disabled: disabled, onChange: onChange,
|
|
20
20
|
// A row like every switch in the Inspector: its words on the left, the switch in the control column.
|
|
21
|
-
newTabRow: (control) => (_jsx(PhiInspectorFieldRow, { label: labels.newTab, children: _jsx(PhiFlexControl, { align: "center", style: { minHeight: "var(--
|
|
21
|
+
newTabRow: (control) => (_jsx(PhiInspectorFieldRow, { label: labels.newTab, children: _jsx(PhiFlexControl, { align: "center", style: { minHeight: "var(--phi-control-height)" }, children: control }) })) }));
|
|
22
22
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useMemo } from "react";
|
|
4
|
+
import { findPhiPageNodePath } from "../../../../helpers/cms-page-catalog";
|
|
4
5
|
import { PhiMediaPickerBinding } from "../../../../components/media/phi-media-picker-binding";
|
|
5
6
|
import { PHI_MEDIA_WIDGET_DEFAULT_LABELS } from "../../../../components/media/media-widget-labels";
|
|
6
7
|
import { PHI_SEARCH_WIDGET_DEFAULT_LABELS } from "../../../../components/widgets/label-types/search";
|
|
@@ -90,6 +91,17 @@ function usePhiBuilderInspectorSectionState(signalRoutes) {
|
|
|
90
91
|
const activeDataProviderDescriptors = activeModuleMetas.dataProviders;
|
|
91
92
|
const activeCalendarAdapterDescriptors = activeModuleMetas.calendarAdapters;
|
|
92
93
|
const activeVideoProviderDescriptors = activeModuleMetas.videoProviders;
|
|
94
|
+
/*
|
|
95
|
+
* The record the edited Page is about, where its route names one: the catalog carries the Provider's
|
|
96
|
+
* key, the Provider's descriptor the fields a Widget may bind to.
|
|
97
|
+
*/
|
|
98
|
+
const pageRecordProviderKey = usePhiDeveloperBuilderStateValue((state) => findPhiPageNodePath(state.modulePresetPagesByArea[state.area] ?? [], state.pageKey)?.at(-1)?.pageRecord?.providerKey ?? null);
|
|
99
|
+
const pageRecordFields = useMemo(() => {
|
|
100
|
+
const descriptor = pageRecordProviderKey
|
|
101
|
+
? activeDataProviderDescriptors.find((candidate) => candidate.key === pageRecordProviderKey)
|
|
102
|
+
: null;
|
|
103
|
+
return descriptor?.kind === "record" ? descriptor.record?.fields ?? [] : [];
|
|
104
|
+
}, [activeDataProviderDescriptors, pageRecordProviderKey]);
|
|
93
105
|
const activeModuleIcons = activeModuleMetas.icons;
|
|
94
106
|
/*
|
|
95
107
|
* Every Inspector section runs this hook, so what it works out per render is worked out fifteen
|
|
@@ -161,6 +173,7 @@ function usePhiBuilderInspectorSectionState(signalRoutes) {
|
|
|
161
173
|
activeCalendarAdapterDescriptors,
|
|
162
174
|
activeVideoProviderDescriptors,
|
|
163
175
|
activeDataProviderDescriptors,
|
|
176
|
+
pageRecordFields,
|
|
164
177
|
builderMode,
|
|
165
178
|
currentRegionDraft,
|
|
166
179
|
emitInspectorControllerAction,
|
|
@@ -197,5 +210,5 @@ export function PhiBuilderLayoutInspectorSectionWidgetClient({ section, signalRo
|
|
|
197
210
|
}
|
|
198
211
|
export function PhiBuilderWidgetInspectorSectionWidgetClient({ section, signalRoutes, geometryLabels, surfaceLabels, backgroundLabels, borderLabels, signalsLabels, fieldLabels, colorPickerLabels, iconPickerLabels, }) {
|
|
199
212
|
const state = usePhiBuilderInspectorSectionState(signalRoutes);
|
|
200
|
-
return _jsx(PhiBuilderInspectorModuleIcons, { sets: state.activeModuleIcons, children: _jsx(PhiDeveloperBuilderWidgetInspectorWidgetClient, { surfaceLabels: surfaceLabels, fieldLabels: fieldLabels, backgroundLabels: backgroundLabels, borderLabels: borderLabels, renderMediaPicker: state.renderBackgroundMediaPicker, onSurfaceChange: (surface) => state.emitInspectorControllerAction({ kind: "patchSelectedWidgetSurface", surface }), section: section, builderMode: state.builderMode, selectedStructureNodeKey: state.nodeKey, selectedStructureNodeKind: state.nodeKind, selectedStructureNodeTitle: state.selectedStructureNodeTitle, selectedStructureWidgetMeta: state.selectedStructurePlugin?.kind === "widget" ? state.selectedStructurePlugin : null, currentDraft: state.selectedWidgetNode, widgetReferenceOptions: state.widgetReferenceOptions, signalRouteScope: state.selectedSignalRouteScope, onConfigChange: (nextConfig) => state.emitInspectorControllerAction({ kind: "patchSelectedWidgetConfig", patch: nextConfig }), geometryLabels: geometryLabels, signalsLabels: signalsLabels, colorPickerLabels: colorPickerLabels, iconPickerLabels: iconPickerLabels, dataProviderDescriptors: state.activeDataProviderDescriptors, calendarAdapterDescriptors: state.activeCalendarAdapterDescriptors, videoProviderDescriptors: state.activeVideoProviderDescriptors, onGeometryChange: (geometry) => state.emitInspectorControllerAction({ kind: "patchSelectedWidgetGeometry", geometry }), onTranslateChange: (translate) => state.emitInspectorControllerAction({ kind: "setSelectedWidgetTranslate", translate }) }) });
|
|
213
|
+
return _jsx(PhiBuilderInspectorModuleIcons, { sets: state.activeModuleIcons, children: _jsx(PhiDeveloperBuilderWidgetInspectorWidgetClient, { surfaceLabels: surfaceLabels, fieldLabels: fieldLabels, backgroundLabels: backgroundLabels, borderLabels: borderLabels, renderMediaPicker: state.renderBackgroundMediaPicker, onSurfaceChange: (surface) => state.emitInspectorControllerAction({ kind: "patchSelectedWidgetSurface", surface }), section: section, builderMode: state.builderMode, selectedStructureNodeKey: state.nodeKey, selectedStructureNodeKind: state.nodeKind, selectedStructureNodeTitle: state.selectedStructureNodeTitle, selectedStructureWidgetMeta: state.selectedStructurePlugin?.kind === "widget" ? state.selectedStructurePlugin : null, currentDraft: state.selectedWidgetNode, widgetReferenceOptions: state.widgetReferenceOptions, signalRouteScope: state.selectedSignalRouteScope, onConfigChange: (nextConfig) => state.emitInspectorControllerAction({ kind: "patchSelectedWidgetConfig", patch: nextConfig }), geometryLabels: geometryLabels, signalsLabels: signalsLabels, colorPickerLabels: colorPickerLabels, iconPickerLabels: iconPickerLabels, dataProviderDescriptors: state.activeDataProviderDescriptors, calendarAdapterDescriptors: state.activeCalendarAdapterDescriptors, videoProviderDescriptors: state.activeVideoProviderDescriptors, pageRecordFields: state.pageRecordFields, onGeometryChange: (geometry) => state.emitInspectorControllerAction({ kind: "patchSelectedWidgetGeometry", geometry }), onTranslateChange: (translate) => state.emitInspectorControllerAction({ kind: "setSelectedWidgetTranslate", translate }) }) });
|
|
201
214
|
}
|
|
@@ -7,7 +7,7 @@ import { PHI_RENDERABLE_BLOCK_RECEIVE_CHANNELS } from "../../../../components/wi
|
|
|
7
7
|
import { PhiFlexControl } from "../../../../components/controls/phi-flex-control";
|
|
8
8
|
import { PhiTypographyControl } from "../../../../components/controls/phi-typography-control";
|
|
9
9
|
function renderSignalBlock(label, content, key, action) {
|
|
10
|
-
return (_jsxs(PhiFlexControl, { vertical: true, gap: 4, style: { width: "100%" }, children: [action ? (_jsxs(PhiFlexControl, { align: "center", justify: "space-between", gap: 8, style: { width: "100%" }, children: [_jsx(PhiTypographyControl, { style: { lineHeight: "var(--
|
|
10
|
+
return (_jsxs(PhiFlexControl, { vertical: true, gap: 4, style: { width: "100%" }, children: [action ? (_jsxs(PhiFlexControl, { align: "center", justify: "space-between", gap: 8, style: { width: "100%" }, children: [_jsx(PhiTypographyControl, { style: { lineHeight: "var(--phi-control-height)" }, children: label }), action] })) : (_jsx(PhiTypographyControl, { style: { lineHeight: "var(--phi-control-height)" }, children: label })), content] }, key));
|
|
11
11
|
}
|
|
12
12
|
function renderSignalCapabilities(capabilities, emptyLabel, options) {
|
|
13
13
|
return _jsx(PhiSignalCapabilityList, { capabilities: capabilities, emptyLabel: emptyLabel, ...options });
|
|
@@ -19,7 +19,7 @@ export function PhiInspectorSignalSection({ labels, emits, listens, }) {
|
|
|
19
19
|
: listens.filter((capability) => !PHI_RENDERABLE_BLOCK_RECEIVE_CHANNELS.has(capability.channel));
|
|
20
20
|
return (_jsxs("div", { style: {
|
|
21
21
|
display: "grid",
|
|
22
|
-
gap: "var(--
|
|
22
|
+
gap: "var(--phi-padding-sm)",
|
|
23
23
|
width: "100%",
|
|
24
24
|
}, children: [_jsx("div", { children: renderSignalBlock(labels?.blocks.emits ?? "Emits", renderSignalCapabilities(emits, labels?.blocks.none ?? "none", {
|
|
25
25
|
showCapability: true,
|