@phis/ui 0.5.7 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/components/controls/phi-amount-list-control.d.ts +69 -0
  2. package/components/controls/phi-amount-list-control.js +15 -0
  3. package/components/controls/phi-button-control.js +16 -2
  4. package/components/root/phi-root-layout.d.ts +1 -0
  5. package/components/root/phi-root-layout.js +1 -0
  6. package/constants/media.d.ts +2 -0
  7. package/constants/media.js +2 -0
  8. package/controls.d.ts +2 -0
  9. package/controls.js +1 -0
  10. package/gateway/signet-route.d.ts +24 -0
  11. package/gateway/signet-route.js +102 -0
  12. package/gateway/site-proxy.js +14 -7
  13. package/helpers/phi-metadata.d.ts +8 -6
  14. package/helpers/phi-metadata.js +9 -2
  15. package/helpers/phi-signet-head.d.ts +25 -0
  16. package/helpers/phi-signet-head.js +41 -0
  17. package/helpers/phi-signet-paths.d.ts +16 -0
  18. package/helpers/phi-signet-paths.js +19 -0
  19. package/helpers/phi-signet.d.ts +28 -0
  20. package/helpers/phi-signet.js +59 -0
  21. package/next/root-route.js +7 -4
  22. package/next/site-proxy.js +16 -0
  23. package/package.json +3 -3
  24. package/plugins/runtime-modules/area-definitions.d.ts +24 -3
  25. package/plugins/runtime-modules/area-definitions.js +11 -3
  26. package/plugins/runtime-modules/public/presets.d.ts +12 -0
  27. package/plugins/runtime-modules/public/presets.js +10 -0
  28. package/plugins/runtime-modules/public/server.js +1 -1
  29. package/plugins/runtime-modules/public/trees/phi-default-pub-privacy-page-tree.d.ts +4 -0
  30. package/plugins/runtime-modules/public/trees/phi-default-pub-privacy-page-tree.js +66 -0
  31. package/plugins/runtime-modules/public-base-page-references.d.ts +2 -1
  32. package/plugins/runtime-modules/public-base-page-references.js +2 -1
  33. package/plugins/runtime-modules/theme/controller/runtime.js +7 -2
  34. package/plugins/runtime-modules/theme/materialize-images.d.ts +16 -0
  35. package/plugins/runtime-modules/theme/materialize-images.js +37 -0
  36. package/styles/amount-list.css +142 -0
  37. package/styles/controls.css +156 -7
  38. package/styles/gradients.css +21 -20
  39. package/theme/phi-theme-blocks.d.ts +7 -6
  40. package/theme/phi-theme-composition.d.ts +19 -1
  41. package/theme/phi-theme-composition.js +15 -0
  42. package/theme/phi-theme-signet.d.ts +25 -0
  43. package/theme/phi-theme-signet.js +17 -0
  44. package/types/site-theme.d.ts +17 -0
@@ -10,6 +10,7 @@ import { resolvePhiThemeComposition } from "../theme/phi-theme-composition";
10
10
  import { composePhiFontCatalogue } from "../theme/phi-font-catalogue";
11
11
  import { PHI_REM_ROOT_PX } from "../theme/phi-css-vars";
12
12
  import { buildPhiRootMetadata } from "../helpers/phi-metadata";
13
+ import { describePhiSignetHead } from "../helpers/phi-signet-head";
13
14
  import { localizePath } from "../helpers/locale";
14
15
  import { readPhiSiteRuntimeConfigSync, } from "../helpers/site-runtime";
15
16
  import { loadPhiRootLayoutContext } from "../server-helpers/root-layout";
@@ -85,11 +86,13 @@ function buildPhiNextRootMetadata(runtimeConfig, site, themeBlocks) {
85
86
  "Canonical starter structure for PHIS-powered sites.",
86
87
  },
87
88
  /*
88
- * The Set that is followed, resolved the same way the Brand Widget resolves the Logo, so the tab
89
- * and the header cannot end up wearing two different marks. A Site that follows a Set without one
90
- * hands over nothing and the head stays quiet.
89
+ * The Signet the Site wears, resolved the way the Brand Widget resolves the Logo -- the Site's own,
90
+ * then the followed Set's -- so the tab and the header cannot end up wearing two different marks.
91
+ * The Site's own has an address and the head names it; a followed Set's is named as the data URL it
92
+ * is, which Safari does not show until a Theme save has made it the Site's own. A Site with no
93
+ * Signet hands over nothing and the head stays quiet.
91
94
  */
92
- signet: resolvePhiThemeComposition(site.theme, themeBlocks).markSet.signet,
95
+ signet: describePhiSignetHead(resolvePhiThemeComposition(site.theme, themeBlocks).signet),
93
96
  });
94
97
  }
95
98
  /** The document shell of every dynamic route: the request decides the locale and the colour scheme. */
@@ -1,5 +1,6 @@
1
1
  import { NextRequest, NextResponse } from "next/server";
2
2
  import { isPhiAssetOrBackendPath } from "./static-asset-path";
3
+ import { PHI_SIGNET_ALIAS_PARAM, PHI_SIGNET_ALIAS_PATHS, PHI_SIGNET_PATH } from "../helpers/phi-signet-paths";
3
4
  import { PHI_SITE_SESSION_COOKIE } from "../constants/site-cookies";
4
5
  import { PHI_CMS_SPECIAL_ROOTS } from "../helpers/cms-routing";
5
6
  import { localizePath } from "../helpers/locale";
@@ -148,6 +149,21 @@ export async function proxyPhiNextSiteRequest(request) {
148
149
  ? NextResponse.next()
149
150
  : new NextResponse(null, { status: 404 });
150
151
  }
152
+ const signetAlias = request.method === "GET" || request.method === "HEAD"
153
+ ? PHI_SIGNET_ALIAS_PATHS[pathname]
154
+ : undefined;
155
+ if (signetAlias) {
156
+ /*
157
+ * The paths a browser asks for without reading the document: Safari takes no icon from a data URL
158
+ * and asks for these instead. They are answered by the Site's Signet route, which has the picture
159
+ * and says 404 where there is none or it is not a PNG for the Apple paths. A rewrite, so the address
160
+ * the browser asked for stays what it asked for. This stands in front of a file of the Site's own
161
+ * at the same path, which is the cost of needing no file in the Site (THEME.md, Signet).
162
+ */
163
+ const target = new URL(PHI_SIGNET_PATH, request.url);
164
+ target.searchParams.set(PHI_SIGNET_ALIAS_PARAM, signetAlias);
165
+ return NextResponse.rewrite(target);
166
+ }
151
167
  if (isPhiAssetOrBackendPath(pathname)) {
152
168
  /*
153
169
  * `x-locale` is this proxy's word, set below from the path. A backend route resolves its locale
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phis/ui",
3
- "version": "0.5.7",
3
+ "version": "0.6.0",
4
4
  "license": "Apache-2.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -495,14 +495,14 @@
495
495
  ],
496
496
  "peerDependencies": {
497
497
  "@ant-design/icons": "^6.3.2",
498
- "antd": "^6.7.0",
498
+ "antd": "^6.7.1",
499
499
  "next": "^16.2.11",
500
500
  "react": "^19.2.8",
501
501
  "react-dom": "^19.2.8"
502
502
  },
503
503
  "dependencies": {
504
504
  "@ant-design/colors": "^8.0.1",
505
- "@ant-design/cssinjs": "^2.1.2",
505
+ "@ant-design/cssinjs": "~2.1.2",
506
506
  "@ant-design/icons-svg": "^4.6.0",
507
507
  "@dnd-kit/core": "^6.3.1",
508
508
  "@dnd-kit/sortable": "^10.0.0",
@@ -26,6 +26,13 @@ export declare const PHI_PUBLIC_RUNTIME_AREA_DEFINITIONS: {
26
26
  defaultMessage: string;
27
27
  };
28
28
  readonly items: readonly [{
29
+ readonly itemKey: "@phis/ui/modules/public/nav/privacy";
30
+ readonly label: {
31
+ defaultMessage: string;
32
+ };
33
+ readonly icon: "antd:safety-certificate";
34
+ readonly routePresetKey: "public-privacy-page";
35
+ }, {
29
36
  readonly itemKey: "@phis/ui/modules/public/nav/terms";
30
37
  readonly label: {
31
38
  defaultMessage: string;
@@ -33,7 +40,7 @@ export declare const PHI_PUBLIC_RUNTIME_AREA_DEFINITIONS: {
33
40
  readonly icon: "antd:file-text";
34
41
  readonly routePresetKey: "public-terms-page";
35
42
  }];
36
- readonly exportedItemKeys: readonly ["@phis/ui/modules/public/nav/terms"];
43
+ readonly exportedItemKeys: readonly ["@phis/ui/modules/public/nav/privacy", "@phis/ui/modules/public/nav/terms"];
37
44
  }, PhiCmsNavigationSurfaceDescriptor];
38
45
  }[];
39
46
  export declare const PHI_APP_ACCOUNT_NAV_ITEM_KEY = "@phis/ui/modules/app/nav/account";
@@ -231,6 +238,13 @@ export declare const PHI_ALL_RUNTIME_AREA_DEFINITIONS: ({
231
238
  defaultMessage: string;
232
239
  };
233
240
  readonly items: readonly [{
241
+ readonly itemKey: "@phis/ui/modules/public/nav/privacy";
242
+ readonly label: {
243
+ defaultMessage: string;
244
+ };
245
+ readonly icon: "antd:safety-certificate";
246
+ readonly routePresetKey: "public-privacy-page";
247
+ }, {
234
248
  readonly itemKey: "@phis/ui/modules/public/nav/terms";
235
249
  readonly label: {
236
250
  defaultMessage: string;
@@ -238,7 +252,7 @@ export declare const PHI_ALL_RUNTIME_AREA_DEFINITIONS: ({
238
252
  readonly icon: "antd:file-text";
239
253
  readonly routePresetKey: "public-terms-page";
240
254
  }];
241
- readonly exportedItemKeys: readonly ["@phis/ui/modules/public/nav/terms"];
255
+ readonly exportedItemKeys: readonly ["@phis/ui/modules/public/nav/privacy", "@phis/ui/modules/public/nav/terms"];
242
256
  }, PhiCmsNavigationSurfaceDescriptor];
243
257
  } | {
244
258
  area: "app";
@@ -490,6 +504,13 @@ export declare function resolvePhiRuntimeAreaDefinition(area: PhiCmsAreaDefiniti
490
504
  defaultMessage: string;
491
505
  };
492
506
  readonly items: readonly [{
507
+ readonly itemKey: "@phis/ui/modules/public/nav/privacy";
508
+ readonly label: {
509
+ defaultMessage: string;
510
+ };
511
+ readonly icon: "antd:safety-certificate";
512
+ readonly routePresetKey: "public-privacy-page";
513
+ }, {
493
514
  readonly itemKey: "@phis/ui/modules/public/nav/terms";
494
515
  readonly label: {
495
516
  defaultMessage: string;
@@ -497,7 +518,7 @@ export declare function resolvePhiRuntimeAreaDefinition(area: PhiCmsAreaDefiniti
497
518
  readonly icon: "antd:file-text";
498
519
  readonly routePresetKey: "public-terms-page";
499
520
  }];
500
- readonly exportedItemKeys: readonly ["@phis/ui/modules/public/nav/terms"];
521
+ readonly exportedItemKeys: readonly ["@phis/ui/modules/public/nav/privacy", "@phis/ui/modules/public/nav/terms"];
501
522
  }, PhiCmsNavigationSurfaceDescriptor];
502
523
  } | {
503
524
  area: "app";
@@ -113,7 +113,9 @@ function sidebarAnchors(settingsItemKey) {
113
113
  };
114
114
  }
115
115
  /*
116
- * The Public surfaces carry one intrinsic entry, the terms, and export it as the one anchor.
116
+ * The Public header carries one intrinsic entry, the terms, and exports it as the one anchor. The footer
117
+ * carries two, the privacy notice and the terms in that order, and exports both: a Site package that has
118
+ * its own imprint places it before the privacy notice.
117
119
  *
118
120
  * The terms are Core's, so their entry is; the contact entry hangs after it, and a Site package's
119
121
  * landing places its Home entry before it. Public has no sidebar and no quick-links surface: the Public
@@ -126,6 +128,12 @@ const publicTermsItem = {
126
128
  icon: "antd:file-text",
127
129
  routePresetKey: "public-terms-page",
128
130
  };
131
+ const publicPrivacyItem = {
132
+ itemKey: "@phis/ui/modules/public/nav/privacy",
133
+ label: label("Privacy"),
134
+ icon: "antd:safety-certificate",
135
+ routePresetKey: "public-privacy-page",
136
+ };
129
137
  const publicNavigationSurfaces = [
130
138
  {
131
139
  navKey: "public:header",
@@ -136,8 +144,8 @@ const publicNavigationSurfaces = [
136
144
  {
137
145
  navKey: "public:footer",
138
146
  label: label("Public footer navigation"),
139
- items: [publicTermsItem],
140
- exportedItemKeys: [publicTermsItem.itemKey],
147
+ items: [publicPrivacyItem, publicTermsItem],
148
+ exportedItemKeys: [publicPrivacyItem.itemKey, publicTermsItem.itemKey],
141
149
  },
142
150
  accountNavigationSurface(PHI_PUBLIC_ACCOUNT_NAV_ITEM_KEY, "public:account"),
143
151
  ];
@@ -46,6 +46,18 @@ export declare const PHI_PUBLIC_RUNTIME_MODULE_ROUTES: ({
46
46
  };
47
47
  }[];
48
48
  loadTree: ({ page }: PhiCmsDescriptorBuildContext) => Promise<import("../../../types").PhiResolvedCmsPageTree>;
49
+ } | {
50
+ ownerModuleId: "@phis/ui/modules/public";
51
+ presetKey: "public-privacy-page";
52
+ presetVersion: number;
53
+ area: "public";
54
+ title: string;
55
+ path: string;
56
+ loadTree: ({ page }: PhiCmsDescriptorBuildContext & {
57
+ activeModuleIds: ReadonlySet<import("../contracts").PhiRuntimeModuleId>;
58
+ params: Readonly<Record<string, string>>;
59
+ }) => Promise<import("../../../types").PhiResolvedCmsPageTree>;
60
+ navigation?: undefined;
49
61
  } | {
50
62
  ownerModuleId: "@phis/ui/modules/public";
51
63
  presetKey: "public-terms-page";
@@ -91,6 +91,16 @@ export const PHI_PUBLIC_RUNTIME_MODULE_ROUTES = [
91
91
  loadTree: ({ page }) => import("./trees/phi-default-pub-error-page-tree")
92
92
  .then((module) => module.buildPhiDefaultPubErrorPageTree({ code, page })),
93
93
  })),
94
+ {
95
+ ownerModuleId: PHI_PUBLIC_RUNTIME_MODULE_ID,
96
+ presetKey: PHI_PUBLIC_BASE_PAGE_PRESET_KEYS.privacy,
97
+ presetVersion: 1,
98
+ area: "public",
99
+ title: "Privacy",
100
+ path: "/privacy",
101
+ loadTree: ({ page }) => import("./trees/phi-default-pub-privacy-page-tree")
102
+ .then((module) => module.buildPhiDefaultPubPrivacyPageTree({ page })),
103
+ },
94
104
  {
95
105
  ownerModuleId: PHI_PUBLIC_RUNTIME_MODULE_ID,
96
106
  presetKey: PHI_PUBLIC_BASE_PAGE_PRESET_KEYS.terms,
@@ -12,7 +12,7 @@ export const PHI_PUBLIC_RUNTIME_MODULE_SERVER_AREA_CONTRIBUTION = definePhiRunti
12
12
  forms: PHI_PUBLIC_RUNTIME_MODULE_FORMS,
13
13
  areaShells: PHI_PUBLIC_RUNTIME_MODULE_AREA_SHELLS,
14
14
  /*
15
- * The landing, the error Pages, the terms, and the contact page: what no Site can do without. Each
15
+ * The landing, the error Pages, the privacy notice, the terms, and the contact page: what no Site can do without. Each
16
16
  * is a floor a package Module may cover (MODULES.md, "Who owns an address") -- the landing through
17
17
  * the root slot, the others through their path.
18
18
  */
@@ -0,0 +1,4 @@
1
+ import type { PhiCmsPageNode, PhiResolvedCmsPageTree } from "../../../../types/cms";
2
+ export declare function buildPhiDefaultPubPrivacyPageTree({ page, }: {
3
+ page: PhiCmsPageNode;
4
+ }): Promise<PhiResolvedCmsPageTree>;
@@ -0,0 +1,66 @@
1
+ import { createPhiPresetCmsInstanceIdMap } from "../../../../types/cms-instance-id";
2
+ import { PHI_PUBLIC_RUNTIME_MODULE_ID } from "../ids";
3
+ import { PHI_CMS_DEFAULT_SLOT_INDEX } from "../../../../constants/cms-layout-types";
4
+ import { PhiCmsPageType } from "../../../../constants/phi-cms";
5
+ import { buildPhiBasePageColumnFrame } from "../../../../components/regions/presets/phi-base-page-column";
6
+ import { PHI_LAYOUT } from "../../../../theme/phi-tokens";
7
+ import { createPhiCmsPresetNodes } from "../../../../helpers/cms-preset-nodes";
8
+ import { createPhiPageUri } from "../../../../types/references";
9
+ import { PHI_PUBLIC_BASE_PAGE_REFERENCES } from "../../public-base-page-references";
10
+ /**
11
+ * Placeholder privacy page, carried inline for the reason the terms are. It is not a policy and does not
12
+ * pretend to be one: it says that the operator has published none here. The second sentence points at the
13
+ * contact page by reference, so the link follows whichever Module holds that Page.
14
+ */
15
+ const PHI_DEFAULT_PUB_PRIVACY_MARKDOWN = `# Privacy
16
+
17
+ The operator of this website has not published a privacy policy here yet.
18
+
19
+ If you have questions about how your data is handled, please [contact the operator](${createPhiPageUri(PHI_PUBLIC_BASE_PAGE_REFERENCES.contact)}).
20
+ `;
21
+ const SYNTHETIC_PRIVACY_REGION_IDS = {
22
+ regionContent: -330,
23
+ };
24
+ const SYNTHETIC_PRIVACY_LAYOUT_IDS = createPhiPresetCmsInstanceIdMap({
25
+ domain: "page",
26
+ ownerModuleId: PHI_PUBLIC_RUNTIME_MODULE_ID,
27
+ presetKey: "pub-privacy-page",
28
+ }, [
29
+ "layoutContent",
30
+ ]);
31
+ const SYNTHETIC_PRIVACY_WIDGET_IDS = createPhiPresetCmsInstanceIdMap({
32
+ domain: "page",
33
+ ownerModuleId: PHI_PUBLIC_RUNTIME_MODULE_ID,
34
+ presetKey: "pub-privacy-page",
35
+ }, [
36
+ "widgetMarkdown",
37
+ ]);
38
+ export async function buildPhiDefaultPubPrivacyPageTree({ page, }) {
39
+ const nodes = createPhiCmsPresetNodes(page);
40
+ return {
41
+ page: nodes.page({ pageType: PhiCmsPageType.Standard }),
42
+ overlays: [],
43
+ // On the base scaffold, in a column on the wash that stops at the reading measure.
44
+ ...buildPhiBasePageColumnFrame({
45
+ page,
46
+ regionId: SYNTHETIC_PRIVACY_REGION_IDS.regionContent,
47
+ columnId: SYNTHETIC_PRIVACY_LAYOUT_IDS.layoutContent,
48
+ label: "pub privacy page",
49
+ maxWidth: PHI_LAYOUT.readingMax,
50
+ }),
51
+ contentWidgets: [
52
+ nodes.widget({
53
+ typeKey: "markdown",
54
+ id: SYNTHETIC_PRIVACY_WIDGET_IDS.widgetMarkdown,
55
+ parentLayoutNodeId: SYNTHETIC_PRIVACY_LAYOUT_IDS.layoutContent,
56
+ slotIndex: PHI_CMS_DEFAULT_SLOT_INDEX,
57
+ sortOrder: 0,
58
+ label: "pub privacy markdown widget",
59
+ config: {
60
+ sourceMode: "inline",
61
+ markdown: PHI_DEFAULT_PUB_PRIVACY_MARKDOWN,
62
+ },
63
+ }),
64
+ ],
65
+ };
66
+ }
@@ -14,6 +14,7 @@ import { createPhiPageReference } from "../../types/references";
14
14
  export declare const PHI_PUBLIC_BASE_PAGE_PRESET_KEYS: {
15
15
  readonly welcome: "public-welcome-page";
16
16
  readonly home: "public-home-page";
17
+ readonly privacy: "public-privacy-page";
17
18
  readonly terms: "public-terms-page";
18
19
  readonly contact: "public-contact-page";
19
20
  readonly unsubscribe: "public-unsubscribe-page";
@@ -21,7 +22,7 @@ export declare const PHI_PUBLIC_BASE_PAGE_PRESET_KEYS: {
21
22
  /**
22
23
  * Ready-made references to the Pages every Site has, for a Module that links to one.
23
24
  *
24
- * The Public base brings a welcome, a home, terms and a contact Page, and a package Module may
25
+ * The Public base brings a welcome, a home, privacy, terms and a contact Page, and a package Module may
25
26
  * reasonably point at any of them -- phis.dev's closing line does exactly that. Without this it would
26
27
  * either type a path, which goes stale and cannot say which Module's Page it means where one covers
27
28
  * another, or assemble a reference from a preset key it copied, which nothing checks.
@@ -16,6 +16,7 @@ import { createPhiRuntimeModuleId } from "../../constants/module-identity";
16
16
  export const PHI_PUBLIC_BASE_PAGE_PRESET_KEYS = {
17
17
  welcome: "public-welcome-page",
18
18
  home: "public-home-page",
19
+ privacy: "public-privacy-page",
19
20
  terms: "public-terms-page",
20
21
  contact: "public-contact-page",
21
22
  unsubscribe: "public-unsubscribe-page",
@@ -25,7 +26,7 @@ const PHI_PUBLIC_RUNTIME_MODULE_ID = createPhiRuntimeModuleId(PHI_SHARED_PACKAGE
25
26
  /**
26
27
  * Ready-made references to the Pages every Site has, for a Module that links to one.
27
28
  *
28
- * The Public base brings a welcome, a home, terms and a contact Page, and a package Module may
29
+ * The Public base brings a welcome, a home, privacy, terms and a contact Page, and a package Module may
29
30
  * reasonably point at any of them -- phis.dev's closing line does exactly that. Without this it would
30
31
  * either type a path, which goes stale and cannot say which Module's Page it means where one covers
31
32
  * another, or assemble a reference from a preset key it copied, which nothing checks.
@@ -9,7 +9,7 @@ import { createPhiCoreRuntimeControllerAddress } from "../../../../components/ru
9
9
  import { usePhiConfig } from "../../../../components/root/phi-config-provider";
10
10
  import { usePhiThemeBlockCatalog } from "../../../../components/root/phi-theme-block-catalog-provider";
11
11
  import { resolvePhiThemeComposition } from "../../../../theme/phi-theme-composition";
12
- import { materializePhiThemeBrandLogo, materializePhiThemeModuleBlocks } from "../materialize-images";
12
+ import { materializePhiThemeBrandLogo, materializePhiThemeBrandSignet, materializePhiThemeModuleBlocks } from "../materialize-images";
13
13
  import { buildPhiSiteThemeSelectOptions, createPhiSiteThemeSelectionValue, createPhiThemeDerivation, ensurePhiThemeDerivation, readPhiSiteThemeSelectionState, resolvePhiThemeSelectionValue, } from "../../../../theme/phi-theme-selection";
14
14
  import { dispatchPhiSignalCapability } from "../../../../components/runtime/runtime-signal-identity";
15
15
  import { formatPhiHistoryMoveMessage, formatPhiHistoryTooltip, } from "../../../../components/widgets/label-types/history";
@@ -339,7 +339,12 @@ export function PhiThemeControllerRuntime({ runtime, config, setOptions, history
339
339
  * The Logo is taken the same way, from every Set, core included: a Set offers it, and a Site that
340
340
  * saved has decided to keep it -- as a picture in its own library, not as a data URL in its record.
341
341
  */
342
- nextTheme = await materializePhiThemeBrandLogo(materialized.theme, resolvePhiThemeComposition(materialized.theme, themeBlocks).markSet);
342
+ const withLogo = await materializePhiThemeBrandLogo(materialized.theme, resolvePhiThemeComposition(materialized.theme, themeBlocks).markSet);
343
+ /*
344
+ * And the Signet, which the browser tab wears: the Site delivers it from its own Media library
345
+ * under a real address, so Safari -- which loads no icon from a data URL -- shows it too.
346
+ */
347
+ nextTheme = await materializePhiThemeBrandSignet(withLogo, resolvePhiThemeComposition(withLogo, themeBlocks).markSet);
343
348
  const response = await fetch("/api/site/cms/theme", {
344
349
  method: "POST",
345
350
  headers: {
@@ -38,3 +38,19 @@ export declare function materializePhiThemeModuleBlocks<T extends {
38
38
  export declare function materializePhiThemeBrandLogo<T extends {
39
39
  brand?: PhiSiteThemeBrand | null;
40
40
  }>(theme: T, markSet: PhiThemeSetBlock): Promise<T>;
41
+ /**
42
+ * Takes the Signet a Theme wears into the Site's record, the picture into the Media library.
43
+ *
44
+ * The Logo's rule, for the mark the browser tab wears: a Module's Set is taken over, the core Set is
45
+ * followed and never copied, and a Site that saved has decided to keep what it saw. From then on the
46
+ * record names an Asset, the Site delivers it at a real address like any other picture of its own, and
47
+ * switching the Module off no longer blanks the tab.
48
+ *
49
+ * What is taken is a picture still carried inline or served from this origin -- the record's own
50
+ * `url` Signet, or, where the record says nothing, the followed Set's. A Signet that is already an
51
+ * Asset stays; an address on somebody else's server is neither fetched nor copied. There is no picker
52
+ * for it: the Theme editor offers no Signet field, and this is the only way one enters the record.
53
+ */
54
+ export declare function materializePhiThemeBrandSignet<T extends {
55
+ brand?: PhiSiteThemeBrand | null;
56
+ }>(theme: T, markSet: PhiThemeSetBlock): Promise<T>;
@@ -173,3 +173,40 @@ export async function materializePhiThemeBrandLogo(theme, markSet) {
173
173
  }
174
174
  return { ...theme, brand: { ...(theme.brand ?? {}), logo: next } };
175
175
  }
176
+ /**
177
+ * Takes the Signet a Theme wears into the Site's record, the picture into the Media library.
178
+ *
179
+ * The Logo's rule, for the mark the browser tab wears: a Module's Set is taken over, the core Set is
180
+ * followed and never copied, and a Site that saved has decided to keep what it saw. From then on the
181
+ * record names an Asset, the Site delivers it at a real address like any other picture of its own, and
182
+ * switching the Module off no longer blanks the tab.
183
+ *
184
+ * What is taken is a picture still carried inline or served from this origin -- the record's own
185
+ * `url` Signet, or, where the record says nothing, the followed Set's. A Signet that is already an
186
+ * Asset stays; an address on somebody else's server is neither fetched nor copied. There is no picker
187
+ * for it: the Theme editor offers no Signet field, and this is the only way one enters the record.
188
+ */
189
+ export async function materializePhiThemeBrandSignet(theme, markSet) {
190
+ const authored = theme.brand?.signet;
191
+ if (authored?.sourceKind === "asset")
192
+ return theme;
193
+ // A core Set offers nothing to take, like its Logo; what the author set is still theirs.
194
+ const offered = isPhiCoreThemeSet(markSet) ? null : markSet.signet;
195
+ const source = authored?.sourceKind === "url"
196
+ ? authored.sourceUrl
197
+ : typeof offered === "string" && offered.startsWith("data:image/") ? offered : null;
198
+ if (!isPhiThemeCarriedSource(source))
199
+ return theme;
200
+ const file = await readPhiThemeImageFile(source, `${markSet.key}-signet`);
201
+ const result = await runPhiMediaUploadSession(file, undefined, {
202
+ meta: { source: PhiMediaAssetSource.ThemeBrandSignet },
203
+ });
204
+ const assetId = result.asset.id;
205
+ return {
206
+ ...theme,
207
+ brand: {
208
+ ...(theme.brand ?? {}),
209
+ signet: { sourceKind: "asset", assetId, url: buildPhiMediaAssetContentDeliveryUrl(assetId) },
210
+ },
211
+ };
212
+ }
@@ -0,0 +1,142 @@
1
+ /*
2
+ * PhiAmountListControl (components/controls/phi-amount-list-control.tsx).
3
+ *
4
+ * One grid for the whole list: [media] [text] [controls] [amount]. Item rows and total rows are subgrids
5
+ * of it, so the amount column is the same column for all of them and sized by the widest amount. The
6
+ * cells carry their own inset instead of the grid a `column-gap`: a column no row uses (no media in the
7
+ * list, no controls) is then 0 wide and leaves no empty gap.
8
+ *
9
+ * Narrow is the list's own width (`@container`), not the viewport's: below 30rem an item is two lines.
10
+ */
11
+
12
+ .phi-amount-list {
13
+ container: phi-amount-list / inline-size;
14
+ display: grid;
15
+ grid-template-columns: auto minmax(0, 1fr) auto max-content;
16
+ width: 100%;
17
+ min-width: 0;
18
+ font-size: var(--phi-font-size);
19
+ line-height: var(--phi-line-height);
20
+ color: var(--phi-color-text);
21
+ }
22
+
23
+ .phi-amount-list--small {
24
+ font-size: var(--phi-font-size-sm);
25
+ }
26
+
27
+ .phi-amount-list--large {
28
+ font-size: var(--phi-font-size-lg);
29
+ }
30
+
31
+ .phi-amount-list__items,
32
+ .phi-amount-list__totals,
33
+ .phi-amount-list__item,
34
+ .phi-amount-list__total {
35
+ display: grid;
36
+ grid-template-columns: subgrid;
37
+ grid-column: 1 / -1;
38
+ }
39
+
40
+ .phi-amount-list__items,
41
+ .phi-amount-list__totals {
42
+ margin: 0;
43
+ padding: 0;
44
+ list-style: none;
45
+ }
46
+
47
+ .phi-amount-list__totals {
48
+ margin-block-start: var(--phi-padding-xs);
49
+ }
50
+
51
+ .phi-amount-list__item,
52
+ .phi-amount-list__total {
53
+ align-items: start;
54
+ padding-block: var(--phi-padding-xs);
55
+ }
56
+
57
+ .phi-amount-list--small .phi-amount-list__item,
58
+ .phi-amount-list--small .phi-amount-list__total {
59
+ padding-block: var(--phi-padding-xxs);
60
+ }
61
+
62
+ .phi-amount-list--large .phi-amount-list__item,
63
+ .phi-amount-list--large .phi-amount-list__total {
64
+ padding-block: var(--phi-padding-sm);
65
+ }
66
+
67
+ .phi-amount-list__media {
68
+ grid-column: 1;
69
+ padding-inline-end: var(--phi-padding-sm);
70
+ }
71
+
72
+ .phi-amount-list__text {
73
+ grid-column: 2;
74
+ min-width: 0;
75
+ overflow-wrap: anywhere;
76
+ }
77
+
78
+ .phi-amount-list__controls {
79
+ grid-column: 3;
80
+ align-self: center;
81
+ padding-inline-start: var(--phi-padding-sm);
82
+ }
83
+
84
+ .phi-amount-list__amount {
85
+ grid-column: 4;
86
+ margin: 0;
87
+ padding-inline-start: var(--phi-padding-sm);
88
+ text-align: end;
89
+ white-space: nowrap;
90
+ font-variant-numeric: tabular-nums;
91
+ }
92
+
93
+ .phi-amount-list__description,
94
+ .phi-amount-list__note {
95
+ color: var(--phi-color-text-description);
96
+ }
97
+
98
+ .phi-amount-list__note {
99
+ display: block;
100
+ font-size: var(--phi-font-size-sm);
101
+ }
102
+
103
+ .phi-amount-list__label {
104
+ grid-column: 1 / 4;
105
+ min-width: 0;
106
+ margin: 0;
107
+ overflow-wrap: anywhere;
108
+ }
109
+
110
+ .phi-amount-list__total--strong {
111
+ font-weight: var(--phi-font-weight-strong);
112
+ }
113
+
114
+ .phi-amount-list__total--divided {
115
+ border-block-start: 1px solid var(--phi-color-split);
116
+ }
117
+
118
+ .phi-amount-list__empty {
119
+ color: var(--phi-color-text-description);
120
+ }
121
+
122
+ @container phi-amount-list (max-width: 30rem) {
123
+ .phi-amount-list__media {
124
+ grid-row: 1;
125
+ }
126
+
127
+ .phi-amount-list__text {
128
+ grid-column: 2 / -1;
129
+ grid-row: 1;
130
+ }
131
+
132
+ .phi-amount-list__controls {
133
+ grid-column: 1 / 4;
134
+ grid-row: 2;
135
+ justify-self: start;
136
+ padding-inline-start: 0;
137
+ }
138
+
139
+ .phi-amount-list__item > .phi-amount-list__amount {
140
+ grid-row: 2;
141
+ }
142
+ }