@phis/ui 0.4.4 → 0.4.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/README.md +9 -3
- package/cms/plugins.d.ts +1 -0
- package/cms/plugins.js +2 -0
- package/components/cms/phi-cms-root-layout.js +31 -2
- package/components/controls/phi-background-control.d.ts +6 -1
- package/components/controls/phi-background-control.js +12 -4
- package/components/controls/phi-button-control.d.ts +15 -1
- package/components/controls/phi-button-control.js +21 -3
- package/components/controls/phi-collapse-control.d.ts +6 -2
- package/components/controls/phi-collapse-control.js +2 -2
- package/components/controls/phi-dialog-control.d.ts +11 -5
- package/components/controls/phi-dialog-control.js +19 -13
- package/components/controls/phi-dropdown-control.js +2 -2
- package/components/controls/phi-media-asset-tile-control.js +10 -10
- package/components/controls/phi-menu-control-vocabulary.d.ts +7 -0
- package/components/controls/phi-menu-control-vocabulary.js +10 -0
- package/components/controls/phi-menu-control.d.ts +4 -1
- package/components/controls/phi-menu-control.js +6 -1
- package/components/controls/phi-progress-control.d.ts +10 -2
- package/components/controls/phi-progress-control.js +6 -2
- package/components/controls/phi-ribbon-control.d.ts +4 -1
- package/components/controls/phi-ribbon-control.js +5 -3
- package/components/controls/phi-ribbon-wrap-control.d.ts +7 -1
- package/components/controls/phi-ribbon-wrap-control.js +8 -2
- package/components/controls/phi-segmented-control.d.ts +4 -1
- package/components/controls/phi-segmented-control.js +13 -2
- package/components/controls/phi-surface-control.d.ts +2 -0
- package/components/controls/phi-surface-control.js +16 -1
- package/components/controls/phi-switch-control.d.ts +4 -1
- package/components/controls/phi-switch-control.js +8 -2
- package/components/controls/phi-tag-control.d.ts +4 -1
- package/components/controls/phi-tag-control.js +11 -3
- package/components/layouts/clients/phi-split-card-layout-client.js +13 -5
- package/components/layouts/clients/phi-three-column-layout-client.js +9 -3
- package/components/layouts/phi-layout-view-model.js +10 -1
- package/components/layouts/split-card-geometry.js +6 -2
- package/components/media/aspect-ratios.d.ts +2 -2
- package/components/menus/phi-account-menu.js +3 -1
- package/components/navigation/phi-link.js +7 -2
- package/components/navigation/use-phi-protected-mail.d.ts +11 -0
- package/components/navigation/use-phi-protected-mail.js +29 -0
- package/components/regions/clients/cms-region-container-client.js +16 -2
- package/components/regions/phi-cms-region-container.js +5 -1
- package/components/regions/phi-cms-region-shell.d.ts +11 -0
- package/components/regions/phi-cms-region-shell.js +64 -7
- package/components/regions/presets/phi-area-shell-preset-nodes.js +2 -1
- package/components/root/phi-config-provider.js +16 -0
- package/components/root/phi-root-layout.d.ts +1 -0
- package/components/root/phi-root-layout.js +1 -0
- package/components/root/phi-root-theme-resolver.js +12 -1
- package/components/root/phi-shell-chrome-overlay.d.ts +6 -0
- package/components/root/phi-shell-chrome-overlay.js +7 -1
- package/components/runtime/runtime-module-context.d.ts +12 -1
- package/components/runtime/runtime-module-context.js +6 -1
- package/components/shell/phi-cms-shell.d.ts +9 -1
- package/components/shell/phi-cms-shell.js +10 -4
- package/components/shell/phi-nav-link.js +7 -2
- package/components/shell/phi-shell-sider-drawer.d.ts +17 -0
- package/components/shell/phi-shell-sider-drawer.js +88 -0
- package/components/shell/use-phi-shell-header-bands.d.ts +5 -0
- package/components/shell/use-phi-shell-header-bands.js +64 -0
- package/components/shell/use-phi-shell-sticky-bottom.d.ts +18 -0
- package/components/shell/use-phi-shell-sticky-bottom.js +54 -0
- package/components/tables/client/phi-table-binding.d.ts +1 -0
- package/components/tables/client/phi-table-binding.js +22 -3
- package/components/trees/client/phi-tree-binding.d.ts +1 -0
- package/components/trees/client/phi-tree-binding.js +11 -2
- package/components/widgets/client/shared/phi-collection-provider.js +4 -3
- package/components/widgets/client/shared/phi-collection-view-binding.d.ts +1 -0
- package/components/widgets/client/shared/phi-collection-view-binding.js +16 -2
- package/components/widgets/client/shared/phi-command-buttons.js +6 -2
- package/components/widgets/config/background.d.ts +20 -0
- package/components/widgets/config/background.js +44 -2
- package/components/widgets/config/button-variant.d.ts +22 -4
- package/components/widgets/config/button-variant.js +24 -5
- package/components/widgets/config/common-action-field.d.ts +1 -1
- package/components/widgets/config/parser-primitives.js +4 -2
- package/components/widgets/config/theme-gradient.d.ts +11 -0
- package/components/widgets/config/theme-gradient.js +12 -0
- package/components/widgets/helpers/internal-reference-resolver.server.d.ts +1 -0
- package/components/widgets/helpers/internal-reference-resolver.server.js +4 -1
- package/components/widgets/label-sets/background.js +2 -0
- package/components/widgets/label-sets/geometry.js +2 -0
- package/components/widgets/label-sets/inspector.js +6 -0
- package/components/widgets/label-types/background.d.ts +1 -0
- package/components/widgets/label-types/background.js +1 -0
- package/components/widgets/label-types/common-controls.js +2 -2
- package/components/widgets/label-types/geometry.d.ts +1 -0
- package/components/widgets/label-types/geometry.js +1 -0
- package/components/widgets/label-types/inspector.d.ts +6 -0
- package/components/widgets/label-types/inspector.js +3 -0
- package/components/widgets/server/navigation-request.js +13 -1
- package/components/widgets/shared/card-body-client.d.ts +13 -0
- package/components/widgets/shared/card-body-client.js +40 -11
- package/components/widgets/shared/card-vocabulary.d.ts +36 -0
- package/components/widgets/shared/card-vocabulary.js +52 -0
- package/components/widgets/shared/collection-source-failure.d.ts +26 -0
- package/components/widgets/shared/collection-source-failure.js +42 -0
- package/components/widgets/shared/markdown-body-client.d.ts +29 -0
- package/components/widgets/shared/markdown-body-client.js +60 -5
- package/components/widgets/shared/markdown-image-vocabulary.d.ts +31 -0
- package/components/widgets/shared/markdown-image-vocabulary.js +68 -0
- package/components/widgets/shared/markdown-render.d.ts +5 -0
- package/components/widgets/shared/markdown-render.js +139 -11
- package/components/widgets/shared/markdown-sections.d.ts +40 -0
- package/components/widgets/shared/markdown-sections.js +111 -0
- package/components/widgets/shared/widget-failure-client.d.ts +10 -0
- package/components/widgets/shared/widget-failure-client.js +20 -0
- package/components/widgets/shared/widget-failure.d.ts +31 -0
- package/components/widgets/shared/widget-failure.js +20 -0
- package/components/widgets/shared/widget-failure.server.d.ts +9 -0
- package/components/widgets/shared/widget-failure.server.js +12 -0
- package/gateway/dashboard-card-memo.d.ts +3 -0
- package/gateway/dashboard-card-memo.js +25 -0
- package/helpers/cms-region-keys.d.ts +1 -1
- package/helpers/external-href.js +1 -1
- package/helpers/layout-style.d.ts +8 -4
- package/helpers/layout-style.js +3 -2
- package/helpers/mode-paint.d.ts +4 -0
- package/helpers/mode-paint.js +47 -0
- package/helpers/protected-mail.d.ts +16 -0
- package/helpers/protected-mail.js +81 -0
- package/helpers/surface-style.js +33 -11
- package/module-dashboard-cards.d.ts +1 -0
- package/module-dashboard-cards.js +1 -0
- package/module-records.d.ts +7 -0
- package/module-records.js +6 -0
- package/package.json +2 -2
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-surface-labels.js +1 -0
- package/plugins/runtime-modules/builder/clients/region-inspector.js +67 -3
- package/plugins/runtime-modules/builder/clients/runtime-module-authoring-boundary.js +1 -1
- package/plugins/runtime-modules/builder/controller/draft-command-controller.js +7 -4
- package/plugins/runtime-modules/builder/controller/page-controller.js +7 -0
- package/plugins/runtime-modules/builder/persistence.d.ts +3 -0
- package/plugins/runtime-modules/builder/persistence.js +9 -1
- package/plugins/runtime-modules/core/content-entries/record-source.server.d.ts +3 -1
- package/plugins/runtime-modules/core/content-entries/record-source.server.js +7 -4
- package/plugins/runtime-modules/core/widgets/button/client.js +2 -2
- package/plugins/runtime-modules/core/widgets/button/config.d.ts +40 -4
- package/plugins/runtime-modules/core/widgets/button/config.js +12 -0
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +102 -1
- package/plugins/runtime-modules/core/widgets/card/config.js +60 -1
- package/plugins/runtime-modules/core/widgets/card/editor.js +17 -2
- package/plugins/runtime-modules/core/widgets/card/server.js +13 -1
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +10 -3
- package/plugins/runtime-modules/core/widgets/collection-view/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/client.d.ts +3 -0
- package/plugins/runtime-modules/core/widgets/collection-view/client.js +47 -11
- package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/collection-view/image-preview-grid.js +2 -2
- package/plugins/runtime-modules/core/widgets/collection-view/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/collection-view/server.d.ts +6 -1
- package/plugins/runtime-modules/core/widgets/collection-view/server.js +21 -3
- package/plugins/runtime-modules/core/widgets/entry-detail/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/entry-detail/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/entry-detail/server.js +5 -2
- package/plugins/runtime-modules/core/widgets/entry-header/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/entry-header/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/entry-header/server.js +5 -2
- package/plugins/runtime-modules/core/widgets/entry-list/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/entry-list/server.d.ts +6 -3
- package/plugins/runtime-modules/core/widgets/entry-list/server.js +13 -6
- package/plugins/runtime-modules/core/widgets/entry-list/view.server.js +2 -1
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +3 -3
- package/plugins/runtime-modules/core/widgets/gallery/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/gallery/server.d.ts +5 -3
- package/plugins/runtime-modules/core/widgets/gallery/server.js +8 -6
- package/plugins/runtime-modules/core/widgets/header-navigation/client.d.ts +6 -1
- package/plugins/runtime-modules/core/widgets/header-navigation/client.js +40 -13
- package/plugins/runtime-modules/core/widgets/header-navigation/config.d.ts +26 -1
- package/plugins/runtime-modules/core/widgets/header-navigation/config.js +27 -0
- package/plugins/runtime-modules/core/widgets/header-navigation/plugin.js +1 -1
- package/plugins/runtime-modules/core/widgets/header-navigation/server.d.ts +2 -2
- package/plugins/runtime-modules/core/widgets/header-navigation/server.js +3 -1
- package/plugins/runtime-modules/core/widgets/image/client.js +11 -7
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +16 -0
- package/plugins/runtime-modules/core/widgets/markdown/config.js +46 -1
- package/plugins/runtime-modules/core/widgets/markdown/server.js +22 -8
- package/plugins/runtime-modules/core/widgets/record/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/record/client.js +8 -3
- package/plugins/runtime-modules/core/widgets/record/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/record/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/record/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/segmented/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/segmented/config.d.ts +21 -1
- package/plugins/runtime-modules/core/widgets/segmented/config.js +11 -1
- package/plugins/runtime-modules/core/widgets/simple-text/server.js +11 -1
- package/plugins/runtime-modules/core/widgets/switch/client.js +1 -1
- package/plugins/runtime-modules/core/widgets/switch/config.d.ts +19 -0
- package/plugins/runtime-modules/core/widgets/switch/config.js +11 -0
- package/plugins/runtime-modules/core/widgets/table/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/table/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/table/client.js +16 -3
- package/plugins/runtime-modules/core/widgets/table/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/table/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/table/server.js +2 -2
- package/plugins/runtime-modules/core/widgets/table/static-resource-editor.js +2 -1
- package/plugins/runtime-modules/core/widgets/timeline/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/timeline/client.d.ts +1 -3
- package/plugins/runtime-modules/core/widgets/timeline/client.js +14 -4
- package/plugins/runtime-modules/core/widgets/tree/authoring.js +1 -1
- package/plugins/runtime-modules/core/widgets/tree/client.d.ts +4 -1
- package/plugins/runtime-modules/core/widgets/tree/client.js +13 -2
- package/plugins/runtime-modules/core/widgets/tree/plugin.js +3 -2
- package/plugins/runtime-modules/core/widgets/tree/server.d.ts +3 -1
- package/plugins/runtime-modules/core/widgets/tree/server.js +2 -2
- package/plugins/runtime-modules/theme/presets.d.ts +9 -1
- package/plugins/runtime-modules/theme/tour.d.ts +9 -1
- package/plugins/runtime-modules/theme/tour.js +10 -1
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +138 -7
- package/runtime-data-provider-client.d.ts +2 -0
- package/runtime-data-provider-client.js +7 -0
- package/styles/controls.css +118 -15
- package/styles/gradients.css +101 -0
- package/styles/layout.css +35 -0
- package/styles/root.css +18 -0
- package/styles/shell.css +206 -0
- package/theme/phi-button-shadow.d.ts +6 -0
- package/theme/phi-theme-gradients.d.ts +96 -0
- package/theme/phi-theme-gradients.js +245 -0
- package/theme/phi-theme-presets.d.ts +3 -0
- package/theme/phi-theme-presets.js +3 -0
- package/theme/phi-theme-tokens.d.ts +5 -1
- package/theme/phi-theme-tokens.js +14 -0
- package/theme/phi-tokens.d.ts +6 -0
- package/theme/phi-tokens.js +6 -0
- package/theme.d.ts +1 -0
- package/theme.js +6 -0
- package/types/cms-presets.d.ts +7 -0
- package/types/core-widget-placements.d.ts +8 -0
- package/types/layout-style.d.ts +9 -8
- package/types/layout-style.js +9 -8
- package/types/surface.d.ts +4 -0
- package/types/surface.js +4 -0
- package/types.d.ts +1 -1
- package/types.js +1 -1
|
@@ -3,12 +3,15 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore, } from "react";
|
|
4
4
|
import { usePhiSignalDispatcher, usePhiSignalListener } from "../../../../../components/runtime/runtime-signal-bus";
|
|
5
5
|
import { usePhiSignalIdentity } from "../../../../../components/runtime/runtime-signal-identity";
|
|
6
|
+
import { usePhiVisualAnchorParts } from "../../../../../components/runtime/runtime-visual-anchors";
|
|
7
|
+
import { PHI_VISUAL_ANCHOR_PART_ATTRIBUTE } from "../../../../../types/visual-anchors";
|
|
6
8
|
import { usePhiControlSignalController } from "../../../../../components/widgets/client/shared/phi-control-signals";
|
|
7
9
|
import { PHI_SIGNAL_VALUE_SCHEMAS } from "../../../../../types/signals";
|
|
8
10
|
import { createPhiThemeControllerAddress } from "../../../../../plugins/runtime-modules/theme/controller/address";
|
|
9
11
|
import { PHI_THEME_SIGNAL_CHANNELS } from "../../../../../plugins/runtime-modules/theme/controller/signals";
|
|
10
12
|
import { PHI_THEME_CUSTOM_COLOR_KEYS, isPhiThemePaletteModeSeedKey, mergePhiThemePalettes, resolvePhiThemeColorTokens, } from "../../../../../theme/phi-theme-presets";
|
|
11
13
|
import { buildPhiThemeCustomColorPalette, resolvePhiThemePaletteCustomColors } from "../../../../../theme/phi-theme-palette";
|
|
14
|
+
import { buildPhiThemeGradientTokens, PHI_THEME_GRADIENT_KEYS, readPhiThemeGradient, readPhiThemeGradientTextTone, readPhiThemeGradientKey, resolvePhiThemeGradients, resolvePhiThemeGradientText, resolvePhiThemeGradientContrast, resolvePhiThemeGradientAutoTextTone, resolvePhiThemeGradientInks, PHI_GRADIENT_HOVER_FILTER, } from "../../../../../theme/phi-theme-gradients";
|
|
12
15
|
import { usePhiConfig } from "../../../../../components/root/phi-config-provider";
|
|
13
16
|
import { usePhiThemeBlockCatalog } from "../../../../../components/root/phi-theme-block-catalog-provider";
|
|
14
17
|
import { resolvePhiThemeComposition, resolvePhiThemeEffectiveLogo, resolvePhiThemeEffectiveFonts, resolvePhiThemeEffectiveRoot, } from "../../../../../theme/phi-theme-composition";
|
|
@@ -267,6 +270,7 @@ const THEME_COLOR_SEED_SECTIONS = [
|
|
|
267
270
|
/** The Collapse order of the colour panel, which decides which section an author finds open. */
|
|
268
271
|
const BRAND_THEME_COLOR_SECTION_KEYS = [
|
|
269
272
|
"custom",
|
|
273
|
+
"gradients",
|
|
270
274
|
...THEME_COLOR_SEED_SECTIONS.map((section) => section.key),
|
|
271
275
|
];
|
|
272
276
|
/**
|
|
@@ -289,7 +293,7 @@ function withThemePalette(theme, palette) {
|
|
|
289
293
|
function mergeThemePaletteMode(theme, mode, rewrite) {
|
|
290
294
|
const palette = theme.palette ?? {};
|
|
291
295
|
const written = rewrite(palette.modes?.[mode] ?? {});
|
|
292
|
-
const nextMode = Object.fromEntries(["seed", "overrides", "customColors"]
|
|
296
|
+
const nextMode = Object.fromEntries(["seed", "overrides", "customColors", "gradients"]
|
|
293
297
|
.filter((part) => Object.keys(written[part] ?? {}).length > 0)
|
|
294
298
|
.map((part) => [part, written[part]]));
|
|
295
299
|
return withThemePalette(theme, {
|
|
@@ -347,10 +351,28 @@ function mergeThemeButtonShadow(theme, kind, choice) {
|
|
|
347
351
|
if (choice !== "theme") {
|
|
348
352
|
shadow[kind] = choice;
|
|
349
353
|
}
|
|
354
|
+
const { shadow: _previousShadow, ...otherButtons } = theme.buttons ?? {};
|
|
355
|
+
return withThemeButtons(theme, Object.keys(shadow).length > 0 ? { ...otherButtons, shadow } : otherButtons);
|
|
356
|
+
}
|
|
357
|
+
/** The Button settings written back, the `buttons` entry gone when nothing is left in it. */
|
|
358
|
+
function withThemeButtons(theme, buttons) {
|
|
350
359
|
const withoutButtons = omitThemeFields(theme, "buttons");
|
|
351
|
-
return Object.keys(
|
|
352
|
-
|
|
353
|
-
|
|
360
|
+
return Object.keys(buttons).length > 0 ? { ...withoutButtons, buttons } : withoutButtons;
|
|
361
|
+
}
|
|
362
|
+
/** Every primary Button filled with a Theme gradient, or handed back to its one colour. */
|
|
363
|
+
function mergeThemePrimaryButtonGradient(theme, gradient) {
|
|
364
|
+
const { primaryGradient: _previous, ...otherButtons } = theme.buttons ?? {};
|
|
365
|
+
return withThemeButtons(theme, gradient ? { ...otherButtons, primaryGradient: gradient } : otherButtons);
|
|
366
|
+
}
|
|
367
|
+
/** One gradient slot stated for the mode being edited, or handed back to the derived run with `null`. */
|
|
368
|
+
function mergeThemeGradient(theme, key, gradient, mode) {
|
|
369
|
+
return mergeThemePaletteMode(theme, mode, (current) => {
|
|
370
|
+
const gradients = { ...(current.gradients ?? {}) };
|
|
371
|
+
delete gradients[key];
|
|
372
|
+
if (gradient)
|
|
373
|
+
gradients[key] = gradient;
|
|
374
|
+
return { ...current, gradients };
|
|
375
|
+
});
|
|
354
376
|
}
|
|
355
377
|
/** A structural token the author set, laid over the style block under `style.token`. */
|
|
356
378
|
function mergeThemeToken(theme, tokenPatch) {
|
|
@@ -505,13 +527,22 @@ function readAliasTokenNumber(token, key) {
|
|
|
505
527
|
}
|
|
506
528
|
/** A draft's alias tokens for one mode, its blocks folded in, as the live render resolves a Theme. */
|
|
507
529
|
function resolveBrandDraftAliasTokens(resolvedTheme, preset, mode, fonts = {}) {
|
|
508
|
-
|
|
530
|
+
const aliasTokens = resolvePhiAntdAliasTokens(mode, {
|
|
509
531
|
...buildPhiEffectiveNonColorThemeTokens(resolvedTheme),
|
|
510
532
|
...resolvePhiThemeColorTokens(preset, resolvedTheme.palette, mode),
|
|
511
533
|
...(resolvedTheme.style?.token ?? {}),
|
|
512
534
|
...(fonts.body ? { fontFamily: fonts.body } : {}),
|
|
513
535
|
...(fonts.mono ? { fontFamilyCode: fonts.mono } : {}),
|
|
514
536
|
});
|
|
537
|
+
// The gradient slots and the primary Buttons' run, as the root lays them over its tokens.
|
|
538
|
+
return {
|
|
539
|
+
...aliasTokens,
|
|
540
|
+
...buildPhiThemeGradientTokens({
|
|
541
|
+
gradients: mergePhiThemePalettes(preset.palette, resolvedTheme.palette).modes?.[mode]?.gradients,
|
|
542
|
+
token: aliasTokens,
|
|
543
|
+
primaryButtonGradient: readPhiThemeGradientKey(resolvedTheme.buttons?.primaryGradient),
|
|
544
|
+
}),
|
|
545
|
+
};
|
|
515
546
|
}
|
|
516
547
|
function readEffectiveTokenNumber(token, key, fallback) {
|
|
517
548
|
const value = token[key];
|
|
@@ -1013,10 +1044,15 @@ function resolveThemeFontSlots(theme, fonts, block) {
|
|
|
1013
1044
|
?? "",
|
|
1014
1045
|
}));
|
|
1015
1046
|
}
|
|
1047
|
+
/** The parts of the colour panel a Tour may point at. */
|
|
1048
|
+
const PHI_BRAND_THEME_CONTROLS_ANCHOR_PARTS = ["gradients"];
|
|
1016
1049
|
export function PhiBuilderBrandThemeControlsWidgetClient({ runtime, config, colorPickerLabels, }) {
|
|
1017
1050
|
const { presets: themePresets, token: clientToken } = usePhiConfig();
|
|
1018
1051
|
const themeBlocks = usePhiThemeBlockCatalog();
|
|
1019
1052
|
const sectionLabelWidth = clientToken.controlHeight * 3;
|
|
1053
|
+
// The Gradients section is a part a Tour can point at (`cms:<id>:gradients`, theme/tour.ts).
|
|
1054
|
+
const anchorAddress = usePhiSignalIdentity().receiver ?? null;
|
|
1055
|
+
usePhiVisualAnchorParts(anchorAddress?.startsWith("cms:") ? anchorAddress : null, PHI_BRAND_THEME_CONTROLS_ANCHOR_PARTS);
|
|
1020
1056
|
const colorControlWidth = clientToken.controlHeight * 5.5;
|
|
1021
1057
|
const themeKey = resolveThemeKey(config);
|
|
1022
1058
|
const { state, draftRef, publishDraft, pickerTransaction } = usePhiBrandThemeDraft(runtime, themeKey);
|
|
@@ -1031,7 +1067,7 @@ export function PhiBuilderBrandThemeControlsWidgetClient({ runtime, config, colo
|
|
|
1031
1067
|
* then redrew. Kept until the draft, the mode, the blocks or the presets change.
|
|
1032
1068
|
*/
|
|
1033
1069
|
const customLabel = colorPickerLabels?.custom ?? "Custom";
|
|
1034
|
-
const { themeComposition, selectedPreset, colorToken, ownPalette, ownOverrides, customPalette, customColorOptions, computedToken, } = useMemo(() => {
|
|
1070
|
+
const { themeComposition, selectedPreset, colorToken, ownPalette, ownOverrides, customPalette, customColorOptions, computedToken, gradients, gradientInks, ownGradients, } = useMemo(() => {
|
|
1035
1071
|
const themeComposition = resolvePhiThemeComposition(state.draft, themeBlocks);
|
|
1036
1072
|
const selectedPreset = resolveThemePayloadPreset(state.draft, themePresets);
|
|
1037
1073
|
/*
|
|
@@ -1060,6 +1096,15 @@ export function PhiBuilderBrandThemeControlsWidgetClient({ runtime, config, colo
|
|
|
1060
1096
|
...buildPhiEffectiveNonColorThemeTokens(state.draft),
|
|
1061
1097
|
...baseColorToken,
|
|
1062
1098
|
});
|
|
1099
|
+
/*
|
|
1100
|
+
* The gradient slots as the Site draws them: stated by the palette block or the draft, else derived
|
|
1101
|
+
* from the mode's colours as they resolve WITH the author's overrides -- what the root derives from.
|
|
1102
|
+
*/
|
|
1103
|
+
const gradientToken = resolvePhiAntdAliasTokens(previewMode, { ...buildPhiEffectiveNonColorThemeTokens(state.draft), ...colorToken });
|
|
1104
|
+
const gradients = resolvePhiThemeGradients(mergePhiThemePalettes(selectedPreset.palette, state.draft.palette).modes?.[previewMode]?.gradients, gradientToken);
|
|
1105
|
+
// The Theme's two text colours in this mode, which the words on a run are chosen from.
|
|
1106
|
+
const gradientInks = resolvePhiThemeGradientInks(gradientToken);
|
|
1107
|
+
const ownGradients = ownPalette.modes?.[previewMode]?.gradients ?? {};
|
|
1063
1108
|
return {
|
|
1064
1109
|
themeComposition,
|
|
1065
1110
|
selectedPreset,
|
|
@@ -1069,6 +1114,9 @@ export function PhiBuilderBrandThemeControlsWidgetClient({ runtime, config, colo
|
|
|
1069
1114
|
customPalette,
|
|
1070
1115
|
customColorOptions,
|
|
1071
1116
|
computedToken,
|
|
1117
|
+
gradients,
|
|
1118
|
+
gradientInks,
|
|
1119
|
+
ownGradients,
|
|
1072
1120
|
};
|
|
1073
1121
|
}, [customLabel, previewMode, state.draft, themeBlocks, themePresets]);
|
|
1074
1122
|
return (_jsx(PhiFlexControl, { vertical: true, gap: clientToken.padding, style: { width: "100%", minWidth: 0, opacity: loading ? 0.65 : 1 }, children: _jsx(PhiCardControl, { size: "small", children: _jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingSM, children: [_jsx(PhiBrandBlockPicker, { label: "Palette", value: themeComposition.palette.key, unavailable: themeComposition.unavailable.palette, options: themeBlocks.palettes, onChange: (key) => {
|
|
@@ -1099,6 +1147,86 @@ export function PhiBuilderBrandThemeControlsWidgetClient({ runtime, config, colo
|
|
|
1099
1147
|
publishDraft(mergeThemeCustomColors(state.draft, { [tokenKey]: value }, previewMode));
|
|
1100
1148
|
} }) }, item.key))) })),
|
|
1101
1149
|
},
|
|
1150
|
+
{
|
|
1151
|
+
key: "gradients",
|
|
1152
|
+
label: (_jsxs(PhiFlexControl, { align: "center", gap: clientToken.paddingSM, wrap: "wrap", style: { minWidth: 0 }, [PHI_VISUAL_ANCHOR_PART_ATTRIBUTE]: "gradients", children: [_jsx(PhiTypographyControl, { strong: true, style: { width: sectionLabelWidth }, children: "Gradients" }), _jsx(PhiFlexControl, { gap: clientToken.paddingXXS, "aria-hidden": true, children: PHI_THEME_GRADIENT_KEYS.map((key) => (_jsx("span", { style: {
|
|
1153
|
+
width: clientToken.controlHeightSM * 1.5,
|
|
1154
|
+
height: clientToken.controlHeightSM,
|
|
1155
|
+
borderRadius: clientToken.borderRadiusSM,
|
|
1156
|
+
background: `linear-gradient(${gradients[key].direction}, ${gradients[key].stops
|
|
1157
|
+
.map((stop) => `${stop.color} ${stop.percent}%`).join(", ")})`,
|
|
1158
|
+
} }, key))) })] })),
|
|
1159
|
+
children: (_jsxs(PhiFlexControl, { vertical: true, gap: clientToken.padding, children: [_jsxs(PhiTypographyControl, { type: "secondary", children: ["Three runs Buttons, badges, tags and switches can be filled with. ", previewMode === "dark" ? "Dark" : "Light", " mode; a slot left alone follows the palette's colours."] }), PHI_THEME_GRADIENT_KEYS.map((key, index) => {
|
|
1160
|
+
const gradient = gradients[key];
|
|
1161
|
+
// The run the author stated, and the text tone they chose -- either may stand alone.
|
|
1162
|
+
const own = readPhiThemeGradient(ownGradients[key]);
|
|
1163
|
+
const ownTone = readPhiThemeGradientTextTone(ownGradients[key]);
|
|
1164
|
+
const text = resolvePhiThemeGradientText(gradient, gradientInks);
|
|
1165
|
+
const contrast = resolvePhiThemeGradientContrast(gradient, text);
|
|
1166
|
+
const tone = gradient.text ?? resolvePhiThemeGradientAutoTextTone(gradient, gradientInks);
|
|
1167
|
+
const otherTone = tone === "light" ? "dark" : "light";
|
|
1168
|
+
// Neither of the Theme's text colours reads: then the run itself is what has to change.
|
|
1169
|
+
const otherContrast = resolvePhiThemeGradientContrast(gradient, gradientInks[otherTone]);
|
|
1170
|
+
const neitherReads = otherContrast != null && otherContrast.ratio < 4.5;
|
|
1171
|
+
/*
|
|
1172
|
+
* An error where the author's choice is what reads poorly: a run they stated, or a text
|
|
1173
|
+
* colour they chose while the other one would read. Otherwise the palette's colours are
|
|
1174
|
+
* what falls short, and it is a hint.
|
|
1175
|
+
*/
|
|
1176
|
+
const contrastLevel = own || (ownTone && !neitherReads) ? "error" : "info";
|
|
1177
|
+
const paint = `linear-gradient(${gradient.direction}, ${gradient.stops
|
|
1178
|
+
.map((stop) => `${stop.color} ${stop.percent}%`).join(", ")})`;
|
|
1179
|
+
return (_jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingXS, children: [_jsxs(PhiFlexControl, { align: "center", justify: "space-between", gap: clientToken.paddingXS, children: [_jsx(PhiTypographyControl, { strong: true, children: `Gradient ${index + 1}` }), own || ownTone ? (_jsx(PhiButtonControl, { size: "small", type: "link", disabled: saving, style: { paddingInline: 0, height: clientToken.controlHeightSM }, onClick: () => publishDraft(mergeThemeGradient(draftRef.current, key, null, previewMode)), label: "Reset to palette" })) : null] }), _jsxs(PhiFlexControl, { align: "center", gap: clientToken.paddingSM, wrap: "wrap", "aria-hidden": true, children: [[false, true].map((hover) => (_jsx("span", { style: {
|
|
1180
|
+
display: "inline-flex",
|
|
1181
|
+
alignItems: "center",
|
|
1182
|
+
height: clientToken.controlHeight,
|
|
1183
|
+
paddingInline: clientToken.padding,
|
|
1184
|
+
borderRadius: 999,
|
|
1185
|
+
background: paint,
|
|
1186
|
+
color: text,
|
|
1187
|
+
fontSize: clientToken.fontSize,
|
|
1188
|
+
fontWeight: 600,
|
|
1189
|
+
whiteSpace: "nowrap",
|
|
1190
|
+
...(hover ? { filter: PHI_GRADIENT_HOVER_FILTER } : {}),
|
|
1191
|
+
}, children: hover ? "Hover" : `Gradient ${index + 1}` }, hover ? "hover" : "rest"))), _jsx("span", { style: {
|
|
1192
|
+
display: "inline-flex",
|
|
1193
|
+
alignItems: "center",
|
|
1194
|
+
paddingInline: clientToken.paddingXS,
|
|
1195
|
+
borderRadius: clientToken.borderRadiusSM,
|
|
1196
|
+
background: paint,
|
|
1197
|
+
color: text,
|
|
1198
|
+
fontSize: clientToken.fontSizeSM,
|
|
1199
|
+
fontWeight: 600,
|
|
1200
|
+
lineHeight: 2,
|
|
1201
|
+
}, children: "Badge" })] }), _jsx(PhiBackgroundControl, { value: normalizePhiBackgroundWidgetConfig({
|
|
1202
|
+
base: { kind: "gradient", direction: gradient.direction, stops: gradient.stops },
|
|
1203
|
+
}), baseKinds: ["gradient"], overlay: false, filters: [], motionModes: [], imageSourceKinds: [], disabled: saving, onChange: (value) => {
|
|
1204
|
+
const base = normalizePhiBackgroundWidgetConfig(value).base;
|
|
1205
|
+
if (base.kind !== "gradient")
|
|
1206
|
+
return;
|
|
1207
|
+
publishDraft(mergeThemeGradient(draftRef.current, key, { direction: base.direction, stops: base.stops, ...(ownTone ? { text: ownTone } : {}) }, previewMode));
|
|
1208
|
+
} }, `${key}-${previewMode}`), _jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingXXS, children: [_jsx(PhiTypographyControl, { type: "secondary", children: "Label colour" }), _jsx(PhiSegmentedControl, { block: true, disabled: saving, value: ownTone ?? "auto", options: [
|
|
1209
|
+
{ value: "auto", label: "Automatic" },
|
|
1210
|
+
{ value: "light", label: "Light text" },
|
|
1211
|
+
{ value: "dark", label: "Dark text" },
|
|
1212
|
+
], onChange: (next) => {
|
|
1213
|
+
// Only the words change: a run the author stated stays theirs, a derived one stays derived.
|
|
1214
|
+
const run = own ? { direction: own.direction, stops: own.stops } : null;
|
|
1215
|
+
const slot = next === "auto"
|
|
1216
|
+
? run
|
|
1217
|
+
: run ? { ...run, text: next } : { text: next };
|
|
1218
|
+
publishDraft(mergeThemeGradient(draftRef.current, key, slot, previewMode));
|
|
1219
|
+
} })] }), contrast != null && contrast.ratio < 4.5 ? (_jsx(PhiAlertControl, { showIcon: true, level: contrastLevel,
|
|
1220
|
+
// Small: a note beside a setting in a narrow panel, not a page's message.
|
|
1221
|
+
title: (_jsx("span", { style: { display: "block", fontSize: clientToken.fontSize, fontWeight: 600, lineHeight: 1.4 }, children: `Label contrast ${contrast.ratio.toFixed(1)}:1 at stop ${contrast.stopIndex + 1} (${contrast.color})${contrast.hover ? " under the pointer" : ""}.` })), description: (_jsx("span", { style: { display: "block", fontSize: clientToken.fontSizeSM, lineHeight: 1.45 }, children: [
|
|
1222
|
+
own ? null : "This run is derived from the palette's colours.",
|
|
1223
|
+
"Labels on Buttons, badges and tags need 4.5:1 to read reliably.",
|
|
1224
|
+
neitherReads
|
|
1225
|
+
? "Neither of the Theme's text colours reaches it here: make the run's stops lighter or darker."
|
|
1226
|
+
: `The ${otherTone} text reads better: choose it, or move the stops away from the ${tone} text.`,
|
|
1227
|
+
].filter(Boolean).join(" ") })) })) : null] }, key));
|
|
1228
|
+
})] })),
|
|
1229
|
+
},
|
|
1102
1230
|
...THEME_COLOR_SEED_SECTIONS.map((section) => {
|
|
1103
1231
|
const seedAuthored = Object.prototype.hasOwnProperty.call(ownPalette.seed ?? {}, section.key) ||
|
|
1104
1232
|
Object.prototype.hasOwnProperty.call(ownPalette.modes?.[previewMode]?.seed ?? {}, section.key);
|
|
@@ -1229,7 +1357,10 @@ export function PhiBuilderBrandStyleControlsWidgetClient({ runtime, config, }) {
|
|
|
1229
1357
|
{
|
|
1230
1358
|
key: "buttonShadow",
|
|
1231
1359
|
label: _jsx(PhiTypographyControl, { strong: true, children: "Button Shadow" }),
|
|
1232
|
-
children: (_jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingSM, children: [_jsx(PhiTypographyControl, { type: "secondary", children: "Under each kind of Button. Theme keeps the tinted line; applies to both modes." }), PHI_THEME_BUTTON_SHADOW_KINDS.map((item) => (_jsx(PhiSegmentedControl, { label: item.label, value: readThemeButtonShadowChoice(state.draft, item.key), options: PHI_THEME_BUTTON_SHADOW_OPTIONS, block: true, disabled: saving, onChange: (choice) => publishDraft(mergeThemeButtonShadow(state.draft, item.key, choice)) }, item.key)))
|
|
1360
|
+
children: (_jsxs(PhiFlexControl, { vertical: true, gap: clientToken.paddingSM, children: [_jsx(PhiTypographyControl, { type: "secondary", children: "Under each kind of Button. Theme keeps the tinted line; applies to both modes." }), PHI_THEME_BUTTON_SHADOW_KINDS.map((item) => (_jsx(PhiSegmentedControl, { label: item.label, value: readThemeButtonShadowChoice(state.draft, item.key), options: PHI_THEME_BUTTON_SHADOW_OPTIONS, block: true, disabled: saving, onChange: (choice) => publishDraft(mergeThemeButtonShadow(state.draft, item.key, choice)) }, item.key))), _jsx(PhiDividerControl, { style: { marginBlock: 0 } }), _jsx(PhiTypographyControl, { type: "secondary", children: "Fills every primary Button with one of the Theme's gradients (Color tab). A Button can still choose its own with the Gradient variant." }), _jsx(PhiSelectControl, { label: "Primary fill", value: readPhiThemeGradientKey(state.draft.buttons?.primaryGradient) ?? "none", options: [
|
|
1361
|
+
{ value: "none", label: "Colour" },
|
|
1362
|
+
...PHI_THEME_GRADIENT_KEYS.map((key, index) => ({ value: key, label: `Gradient ${index + 1}` })),
|
|
1363
|
+
], disabled: saving, onChange: (choice) => publishDraft(mergeThemePrimaryButtonGradient(state.draft, choice === "none" ? null : choice)) })] })),
|
|
1233
1364
|
},
|
|
1234
1365
|
{
|
|
1235
1366
|
key: "radius",
|
|
@@ -20,3 +20,5 @@ export { PhiCardCollectionViewBinding, } from "./plugins/runtime-modules/core/wi
|
|
|
20
20
|
export { createPhiRuntimeModuleDataProviderClientManifest, extendPhiRuntimeModuleDataProviderClientManifest, PhiRuntimeModuleDataProviderClientManifestProvider, } from "./components/runtime/runtime-module-data-provider-client-manifest";
|
|
21
21
|
export type { PhiRuntimeModuleDataProviderClientManifest, } from "./components/runtime/runtime-module-data-provider-client-manifest";
|
|
22
22
|
export type { PhiRuntimeModuleDataProviderClientProps, PhiRuntimeModuleDataProviderClientDefinition, PhiRuntimeModuleDataProviderDescriptor, } from "./types/cms-plugins";
|
|
23
|
+
export { PhiWidgetFailure } from "./components/widgets/shared/widget-failure-client";
|
|
24
|
+
export type { PhiWidgetFailureProps } from "./components/widgets/shared/widget-failure";
|
|
@@ -18,3 +18,10 @@ export { createPhiCollectionProviderClient, PhiCollectionProviderClient, usePhiC
|
|
|
18
18
|
*/
|
|
19
19
|
export { PhiCardCollectionViewBinding, } from "./plugins/runtime-modules/core/widgets/card/collection-view-binding";
|
|
20
20
|
export { createPhiRuntimeModuleDataProviderClientManifest, extendPhiRuntimeModuleDataProviderClientManifest, PhiRuntimeModuleDataProviderClientManifestProvider, } from "./components/runtime/runtime-module-data-provider-client-manifest";
|
|
21
|
+
/*
|
|
22
|
+
* What a Widget bound to one of these Providers renders when the binding cannot be served in the browser
|
|
23
|
+
* -- the Area does not offer the Provider, a read failed after hydration: the error card in the Builder,
|
|
24
|
+
* nothing on a live page, one `cms.widget.unavailable` warning per distinct failure. The Server twin,
|
|
25
|
+
* `PhiWidgetFailureServer`, is Server-only and lives in `@phis/ui/module/records`.
|
|
26
|
+
*/
|
|
27
|
+
export { PhiWidgetFailure } from "./components/widgets/shared/widget-failure-client";
|
package/styles/controls.css
CHANGED
|
@@ -293,6 +293,59 @@ h5.phi-typography, .phi-typography h5 {
|
|
|
293
293
|
--ant-menu-icon-margin-inline-end: calc(var(--ant-control-height-sm) - var(--phi-menu-font-size));
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
+
/*
|
|
297
|
+
* A horizontal menu's mark for the current entry (`PhiMenuControl` `selectionStyle`).
|
|
298
|
+
*
|
|
299
|
+
* The pill: the entry stands at the control height in the middle of its bar, on a ground in the Theme's
|
|
300
|
+
* Control shape -- a light primary tint in light mode, the primary mixed into the dark ground in dark
|
|
301
|
+
* mode -- and no bar under it. Ant Design writes the bar's width under a dark menu as a number rather than
|
|
302
|
+
* its variable, so it is set to nothing on the entry itself.
|
|
303
|
+
*/
|
|
304
|
+
.phi-menu-control--selection-pill.ant-menu.ant-menu-root.ant-menu-horizontal,
|
|
305
|
+
.phi-menu-control--selection-auto.ant-menu-dark.ant-menu-root.ant-menu-horizontal {
|
|
306
|
+
--ant-menu-active-bar-height: 0px;
|
|
307
|
+
/*
|
|
308
|
+
* The Theme's Control shape at the default size: one Control line tall, so the radius a grown Control
|
|
309
|
+
* holds is exactly this entry's -- the shape's number, or the capsule under `pill`.
|
|
310
|
+
*/
|
|
311
|
+
--ant-menu-horizontal-item-border-radius: var(--phi-control-radius-grown-md, var(--ant-border-radius));
|
|
312
|
+
--ant-menu-horizontal-item-selected-bg: var(--ant-color-primary-bg);
|
|
313
|
+
--ant-menu-dark-item-selected-bg: color-mix(in srgb, var(--ant-color-primary) 30%, transparent);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.phi-menu-control--selection-pill.ant-menu-horizontal > :is(.ant-menu-item, .ant-menu-submenu),
|
|
317
|
+
.phi-menu-control--selection-auto.ant-menu-dark.ant-menu-horizontal > :is(.ant-menu-item, .ant-menu-submenu) {
|
|
318
|
+
align-self: center;
|
|
319
|
+
height: var(--ant-control-height);
|
|
320
|
+
line-height: var(--ant-control-height);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.phi-menu-control--selection-pill.ant-menu-horizontal > :is(.ant-menu-item, .ant-menu-submenu)::after,
|
|
324
|
+
.phi-menu-control--selection-auto.ant-menu-dark.ant-menu-horizontal > :is(.ant-menu-item, .ant-menu-submenu)::after {
|
|
325
|
+
border-bottom-width: 0;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/* The bar in dark mode as well: no ground, and the bar Ant Design leaves out under a dark menu. */
|
|
329
|
+
.phi-menu-control--selection-underline.ant-menu-dark.ant-menu-root.ant-menu-horizontal {
|
|
330
|
+
--ant-menu-dark-item-selected-bg: transparent;
|
|
331
|
+
--ant-menu-dark-item-selected-color: var(--ant-color-primary);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.phi-menu-control--selection-underline.ant-menu-dark.ant-menu-horizontal
|
|
335
|
+
> :is(.ant-menu-item-selected, .ant-menu-submenu-selected)::after {
|
|
336
|
+
/* Ant Design's own `lineWidthBold`, which it derives as `lineWidth + 1`. */
|
|
337
|
+
border-bottom-width: calc(var(--ant-line-width) + 1px);
|
|
338
|
+
border-bottom-color: var(--ant-color-primary);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/*
|
|
342
|
+
* A Markdown text's sections that fold (`foldSections`): a fine rule of the Theme's between the questions,
|
|
343
|
+
* so a list of them reads as a list while every one is closed.
|
|
344
|
+
*/
|
|
345
|
+
.phi-markdown-folds :where(.ant-collapse-item + .ant-collapse-item) {
|
|
346
|
+
border-block-start: var(--ant-line-width, 1px) solid var(--ant-color-split);
|
|
347
|
+
}
|
|
348
|
+
|
|
296
349
|
/* --- Labeled control ---------------------------------------------------------------------------- */
|
|
297
350
|
|
|
298
351
|
/*
|
|
@@ -400,17 +453,22 @@ h5.phi-typography, .phi-typography h5 {
|
|
|
400
453
|
/* --- Dropdown ------------------------------------------------------------------------------------ */
|
|
401
454
|
|
|
402
455
|
/*
|
|
403
|
-
* The shared pill trigger: a bordered
|
|
404
|
-
* state,
|
|
456
|
+
* The shared pill trigger: a bordered label that reacts to hover. Hover is a CSS state, not React
|
|
457
|
+
* state, so a trigger never re-renders to change its own border colour.
|
|
458
|
+
*
|
|
459
|
+
* Its corner, its line and its air are the Theme's: the small Control's radius from the Style's control
|
|
460
|
+
* shape (a capsule under `pill`, a sharp box under `square`, the small step of the scale otherwise), the
|
|
461
|
+
* Theme's line width, and the spacing scale -- so it stands beside the header's buttons as one of them
|
|
462
|
+
* rather than as the one round thing a square Theme left behind.
|
|
405
463
|
*/
|
|
406
464
|
.phi-dropdown-control__pill {
|
|
407
465
|
display: inline-flex;
|
|
408
466
|
align-items: center;
|
|
409
467
|
justify-content: center;
|
|
410
468
|
min-width: 3.5rem;
|
|
411
|
-
padding:
|
|
412
|
-
border:
|
|
413
|
-
border-radius:
|
|
469
|
+
padding: var(--ant-padding-xxs) var(--ant-padding-sm);
|
|
470
|
+
border: var(--ant-line-width) solid var(--ant-color-border);
|
|
471
|
+
border-radius: var(--phi-control-radius-sm);
|
|
414
472
|
color: inherit;
|
|
415
473
|
font-size: inherit;
|
|
416
474
|
line-height: 1;
|
|
@@ -665,24 +723,69 @@ h5.phi-typography, .phi-typography h5 {
|
|
|
665
723
|
* Markdown pictures the text flows past (`imageFloat` on the Markdown Widget).
|
|
666
724
|
*
|
|
667
725
|
* Only where there is room for both: below 560px a picture beside the words leaves each of them a column
|
|
668
|
-
* nobody reads, so there the picture stands on its own line at full width, as an unfloated one does.
|
|
669
|
-
*
|
|
726
|
+
* nobody reads, so there the picture stands on its own line at full width, as an unfloated one does.
|
|
727
|
+
*
|
|
728
|
+
* Beside the words the line is shared in the golden ratio: what is left after the gap between them goes
|
|
729
|
+
* 1 : φ to picture and text (`PHI_GOLDEN_RATIO`, 1 + φ = 2.618), so the text is 1.618 times as wide as the
|
|
730
|
+
* picture at any column width -- 415 px of picture beside 671 px of text in a 1120 px column, with the
|
|
731
|
+
* Phi scale's `md` (34 px) between them. Every distance here is the Phi scale's, never `--ant-margin-*`.
|
|
670
732
|
*/
|
|
671
|
-
.phi-markdown-body
|
|
733
|
+
.phi-markdown-body {
|
|
734
|
+
/* The gap between picture and text, on the Phi scale (`PHI_SPACE.md`), not Ant Design's margins. */
|
|
735
|
+
--phi-markdown-float-gap: var(--ant-padding-md, 34px);
|
|
736
|
+
--phi-markdown-float-width: calc((100% - var(--phi-markdown-float-gap)) / 2.618034);
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
.phi-markdown-body :is(img):not(:where(.phi-markdown-figure *)) {
|
|
672
740
|
display: block;
|
|
673
|
-
margin-block-end: var(--ant-
|
|
741
|
+
margin-block-end: var(--ant-padding, 21px);
|
|
742
|
+
/*
|
|
743
|
+
* A picture is a surface, so its corners are the Theme's surface step (`--phi-surface-radius`, THEME.md
|
|
744
|
+
* "Control shape"): square under `square`, the widest step of the scale under `pill`.
|
|
745
|
+
*/
|
|
746
|
+
border-radius: var(--phi-surface-radius, 0);
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
@container (min-width: 560px) {
|
|
750
|
+
.phi-markdown-body--float-start :is(img):not(:where(.phi-markdown-figure *)) {
|
|
751
|
+
float: inline-start;
|
|
752
|
+
width: var(--phi-markdown-float-width);
|
|
753
|
+
margin-inline-end: var(--phi-markdown-float-gap);
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
.phi-markdown-body--float-end :is(img):not(:where(.phi-markdown-figure *)) {
|
|
757
|
+
float: inline-end;
|
|
758
|
+
width: var(--phi-markdown-float-width);
|
|
759
|
+
margin-inline-start: var(--phi-markdown-float-gap);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
/*
|
|
764
|
+
* A Media picture standing on its own (`PhiMarkdownFigure`): a figure whose frame holds the picture at its
|
|
765
|
+
* proportion, cropped into it, on the Theme's surface corner. It floats as the Widget says or as its own
|
|
766
|
+
* address says (`float=start|end|none`), in the same golden share and from the same container width as above.
|
|
767
|
+
*/
|
|
768
|
+
.phi-markdown-figure {
|
|
769
|
+
margin: 0 0 var(--ant-padding, 21px);
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
.phi-markdown-figure__frame {
|
|
773
|
+
position: relative;
|
|
774
|
+
width: 100%;
|
|
775
|
+
overflow: hidden;
|
|
776
|
+
border-radius: var(--phi-surface-radius, 0);
|
|
674
777
|
}
|
|
675
778
|
|
|
676
779
|
@container (min-width: 560px) {
|
|
677
|
-
.phi-markdown-
|
|
780
|
+
.phi-markdown-figure--float-start {
|
|
678
781
|
float: inline-start;
|
|
679
|
-
width:
|
|
680
|
-
margin-inline-end: var(--
|
|
782
|
+
width: var(--phi-markdown-float-width);
|
|
783
|
+
margin-inline-end: var(--phi-markdown-float-gap);
|
|
681
784
|
}
|
|
682
785
|
|
|
683
|
-
.phi-markdown-
|
|
786
|
+
.phi-markdown-figure--float-end {
|
|
684
787
|
float: inline-end;
|
|
685
|
-
width:
|
|
686
|
-
margin-inline-start: var(--
|
|
788
|
+
width: var(--phi-markdown-float-width);
|
|
789
|
+
margin-inline-start: var(--phi-markdown-float-gap);
|
|
687
790
|
}
|
|
688
791
|
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Gradients and glass on Controls (theme/phi-theme-gradients.ts).
|
|
3
|
+
*
|
|
4
|
+
* Ant Design 6 draws a Button's ground with `background-color` from its own variables
|
|
5
|
+
* (`--ant-btn-bg-color`, `-hover`, `-active`) and never sets `background-image`. So a run laid on as
|
|
6
|
+
* `background-image` sits over Ant Design's colour without fighting it and keeps that colour as the edge
|
|
7
|
+
* a gradient cannot draw. A disabled Button is left out of every rule here: its run would outweigh the
|
|
8
|
+
* `background` shorthand Ant Design greys it out with. Text colour goes through Ant Design's text variables, which is
|
|
9
|
+
* what its hover and active rules read.
|
|
10
|
+
*
|
|
11
|
+
* The selectors repeat a class for the reason `control-shape.css` gives: Ant Design's rules weigh up to
|
|
12
|
+
* four classes, and a tie is settled by source order this file does not control.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
* Every primary Button, where the Theme fills them with a gradient (`theme.buttons.primaryGradient`).
|
|
17
|
+
* A Button of the `gradient` variant is primary underneath and has a run of its own, so it is left out.
|
|
18
|
+
*/
|
|
19
|
+
.ant-btn.ant-btn.ant-btn-color-primary.ant-btn-variant-solid:not(.ant-btn-background-ghost):not(.phi-btn-gradient):not(:disabled):not(.ant-btn-disabled) {
|
|
20
|
+
background-image: var(--ant-phi-primary-button-gradient, none);
|
|
21
|
+
/* From the outer edge and once: from the padding box it tiled again under the border, and a pill's
|
|
22
|
+
ends showed the other end of the run. */
|
|
23
|
+
background-origin: border-box;
|
|
24
|
+
background-repeat: no-repeat;
|
|
25
|
+
will-change: filter;
|
|
26
|
+
--ant-btn-text-color: var(--ant-phi-primary-button-gradient-text, var(--ant-color-text-light-solid));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.ant-btn.ant-btn.ant-btn-color-primary.ant-btn-variant-solid:not(.ant-btn-background-ghost):not(.phi-btn-gradient):not(:disabled):not(.ant-btn-disabled):hover {
|
|
30
|
+
filter: var(--ant-phi-primary-button-gradient-hover, none);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.ant-btn.ant-btn.ant-btn-color-primary.ant-btn-variant-solid:not(.ant-btn-background-ghost):not(.phi-btn-gradient):not(:disabled):not(.ant-btn-disabled):active {
|
|
34
|
+
filter: var(--ant-phi-primary-button-gradient-active, none);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
* A Button of the `gradient` variant: its slot's run, whatever the Theme does with primary Buttons. The
|
|
39
|
+
* Control states the slot as `--phi-control-gradient` and its text as `--phi-control-gradient-text`.
|
|
40
|
+
*/
|
|
41
|
+
.ant-btn.ant-btn.phi-btn-gradient.phi-btn-gradient:not(:disabled):not(.ant-btn-disabled) {
|
|
42
|
+
background-image: var(--phi-control-gradient);
|
|
43
|
+
background-origin: border-box;
|
|
44
|
+
background-repeat: no-repeat;
|
|
45
|
+
/* Its own layer at rest as well: the browser otherwise lifts the Button onto one only while the
|
|
46
|
+
filter eases, rasterises its rounded rim there, and the pill seemed to change size twice. */
|
|
47
|
+
will-change: filter;
|
|
48
|
+
/* The run is the whole ground: a colour beneath it showed through the anti-aliased rim of a pill. */
|
|
49
|
+
--ant-btn-bg-color: transparent;
|
|
50
|
+
--ant-btn-bg-color-hover: transparent;
|
|
51
|
+
--ant-btn-bg-color-active: transparent;
|
|
52
|
+
--ant-btn-border-color: transparent;
|
|
53
|
+
--ant-btn-border-color-hover: transparent;
|
|
54
|
+
--ant-btn-border-color-active: transparent;
|
|
55
|
+
--ant-btn-text-color: var(--phi-control-gradient-text);
|
|
56
|
+
--ant-btn-text-color-hover: var(--phi-control-gradient-text);
|
|
57
|
+
--ant-btn-text-color-active: var(--phi-control-gradient-text);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/*
|
|
61
|
+
* Under the pointer and pressed the run stays the same picture and only its light changes: Ant Design
|
|
62
|
+
* transitions every property of a Button, and a picture swapped on hover crossfaded badly as the pointer
|
|
63
|
+
* left. A filter eases with the rest.
|
|
64
|
+
*/
|
|
65
|
+
.ant-btn.ant-btn.phi-btn-gradient.phi-btn-gradient:not(:disabled):not(.ant-btn-disabled):hover {
|
|
66
|
+
filter: brightness(1.18) saturate(1.15);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.ant-btn.ant-btn.phi-btn-gradient.phi-btn-gradient:not(:disabled):not(.ant-btn-disabled):active {
|
|
70
|
+
filter: brightness(0.88);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/*
|
|
74
|
+
* A Button of the `glass` variant: a pane of the container ground of the mode it stands in, frosting
|
|
75
|
+
* whatever shows through it -- a picture, a gradient. Inside a dark Surface tone the ground is the dark
|
|
76
|
+
* one, so the pane darkens instead of misting a dark picture white.
|
|
77
|
+
*/
|
|
78
|
+
.ant-btn.ant-btn.phi-btn-glass.phi-btn-glass {
|
|
79
|
+
--ant-btn-bg-color: color-mix(in srgb, var(--ant-color-bg-container) 24%, transparent);
|
|
80
|
+
--ant-btn-bg-color-hover: color-mix(in srgb, var(--ant-color-bg-container) 38%, transparent);
|
|
81
|
+
--ant-btn-bg-color-active: color-mix(in srgb, var(--ant-color-bg-container) 48%, transparent);
|
|
82
|
+
--ant-btn-border-color: color-mix(in srgb, var(--ant-color-text) 24%, transparent);
|
|
83
|
+
--ant-btn-border-color-hover: color-mix(in srgb, var(--ant-color-text) 40%, transparent);
|
|
84
|
+
--ant-btn-border-color-active: color-mix(in srgb, var(--ant-color-text) 40%, transparent);
|
|
85
|
+
--ant-btn-text-color: var(--ant-color-text);
|
|
86
|
+
--ant-btn-text-color-hover: var(--ant-color-text);
|
|
87
|
+
--ant-btn-text-color-active: var(--ant-color-text);
|
|
88
|
+
/* The frost itself is inline on the Button: a `backdrop-filter` in a stylesheet does not survive the build (styles/shell.css). */
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* A Switch that is on, filled with its slot's run instead of the primary colour. */
|
|
92
|
+
.ant-switch.ant-switch.ant-switch.phi-switch-gradient.ant-switch-checked {
|
|
93
|
+
background-image: var(--phi-control-gradient);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/* The thumb a Segmented slides under its selected item, and the item itself once the thumb has gone. */
|
|
97
|
+
.ant-segmented.ant-segmented.phi-segmented-gradient .ant-segmented-thumb,
|
|
98
|
+
.ant-segmented.ant-segmented.phi-segmented-gradient .ant-segmented-item-selected {
|
|
99
|
+
background-image: var(--phi-control-gradient);
|
|
100
|
+
color: var(--phi-control-gradient-text);
|
|
101
|
+
}
|
package/styles/layout.css
CHANGED
|
@@ -680,3 +680,38 @@
|
|
|
680
680
|
scale: none;
|
|
681
681
|
}
|
|
682
682
|
}
|
|
683
|
+
|
|
684
|
+
/*
|
|
685
|
+
* The Split Card's grid (`phi-split-card-layout-client.tsx`): the two cards side by side in the golden
|
|
686
|
+
* ratio, and one above the other where the Split Card itself is narrower than 36rem -- its own width,
|
|
687
|
+
* not the screen's, so it stacks in a narrow column on a wide screen as well. Stacked, each card shows
|
|
688
|
+
* the whole shared Background (`resolvePhiSplitCardGroundFrame`).
|
|
689
|
+
*/
|
|
690
|
+
.phi-split-card__grid {
|
|
691
|
+
display: grid;
|
|
692
|
+
grid-template-columns: var(--phi-split-card-columns);
|
|
693
|
+
align-items: stretch;
|
|
694
|
+
min-width: 0;
|
|
695
|
+
min-height: 0;
|
|
696
|
+
height: 100%;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
@container phi-split-card (width < 36rem) {
|
|
700
|
+
.phi-split-card__grid {
|
|
701
|
+
grid-template-columns: minmax(0, 1fr);
|
|
702
|
+
--phi-split-card-ground-left: 0px;
|
|
703
|
+
--phi-split-card-ground-width: 100%;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
/*
|
|
708
|
+
* A Three Column Layout on a phone (`phi-three-column-layout-client.tsx`): balanced sides give way to
|
|
709
|
+
* sides as wide as their content, and the middle takes what is left. The phone is the render viewport's
|
|
710
|
+
* width, as for `viewportFlags`.
|
|
711
|
+
*/
|
|
712
|
+
@container phi-render-viewport (width < 768px) {
|
|
713
|
+
[data-layout-kind="threecol"] {
|
|
714
|
+
--phi-three-column-side-flex: 0 1 auto;
|
|
715
|
+
--phi-three-column-middle-flex: 1 1 0;
|
|
716
|
+
}
|
|
717
|
+
}
|
package/styles/root.css
CHANGED
|
@@ -237,3 +237,21 @@ samp {
|
|
|
237
237
|
animation-delay: 0s !important;
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
+
|
|
241
|
+
/* The gates a paint per mode reads (`helpers/mode-paint.ts`): the open one is empty, the closed one is the
|
|
242
|
+
guaranteed-invalid value, so the closed mode's value is the one a `var()` falls back to. Light outside
|
|
243
|
+
the Root Layout as well -- a Modal portalled to <body> still reads one value. */
|
|
244
|
+
:root {
|
|
245
|
+
--phi-mode-light-gate: ;
|
|
246
|
+
--phi-mode-dark-gate: initial;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
:where([data-phi-theme-mode="light"]) {
|
|
250
|
+
--phi-mode-light-gate: ;
|
|
251
|
+
--phi-mode-dark-gate: initial;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
:where([data-phi-theme-mode="dark"]) {
|
|
255
|
+
--phi-mode-light-gate: initial;
|
|
256
|
+
--phi-mode-dark-gate: ;
|
|
257
|
+
}
|