@phis/ui 0.4.16 → 0.4.18

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 (110) hide show
  1. package/README.md +1 -1
  2. package/components/cms/phi-cms-render-error-boundary.d.ts +8 -0
  3. package/components/cms/phi-cms-render-error-boundary.js +2 -1
  4. package/components/controls/phi-table-control.js +15 -0
  5. package/components/forms/compound-form-controls.js +2 -1
  6. package/components/widgets/label-sets/observability-logs.d.ts +2 -0
  7. package/components/widgets/label-sets/observability-logs.js +4 -0
  8. package/components/widgets/label-sets/search.js +2 -0
  9. package/components/widgets/label-types/search.d.ts +2 -0
  10. package/components/widgets/label-types/search.js +1 -0
  11. package/constants/cms-widget-types.js +3 -2
  12. package/helpers/site-runtime.js +3 -0
  13. package/module-references.d.ts +19 -0
  14. package/module-references.js +18 -0
  15. package/net/log.d.ts +1 -0
  16. package/net/log.js +19 -1
  17. package/net/phi-next-proxy.js +9 -1
  18. package/package.json +6 -1
  19. package/plugins/runtime-modules/app/presets.js +0 -23
  20. package/plugins/runtime-modules/area-contributions/app.d.ts +1 -1
  21. package/plugins/runtime-modules/area-contributions/app.js +2 -0
  22. package/plugins/runtime-modules/area-contributions/public.d.ts +1 -1
  23. package/plugins/runtime-modules/area-contributions/public.js +2 -0
  24. package/plugins/runtime-modules/area-module-defaults.js +21 -2
  25. package/plugins/runtime-modules/builder/render-root-node-scaffold.js +54 -54
  26. package/plugins/runtime-modules/client-authoring-providers/app.d.ts +1 -1
  27. package/plugins/runtime-modules/client-authoring-providers/app.js +6 -0
  28. package/plugins/runtime-modules/client-authoring-providers/public.d.ts +1 -1
  29. package/plugins/runtime-modules/client-authoring-providers/public.js +6 -0
  30. package/plugins/runtime-modules/client-manifests/common.js +2 -2
  31. package/plugins/runtime-modules/core/authoring-widgets.js +0 -4
  32. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +1 -1
  33. package/plugins/runtime-modules/core/widgets/markdown-toc/client.js +1 -1
  34. package/plugins/runtime-modules/core/widgets/table/client.js +7 -5
  35. package/plugins/runtime-modules/core/widgets/table/config.js +8 -1
  36. package/plugins/runtime-modules/core/widgets/tree/client.js +1 -1
  37. package/plugins/runtime-modules/core/widgets.js +0 -17
  38. package/plugins/runtime-modules/groups/trees/group-tables.d.ts +44 -0
  39. package/plugins/runtime-modules/groups/trees/group-tables.js +150 -0
  40. package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +28 -136
  41. package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +9 -106
  42. package/plugins/runtime-modules/localization/trees/phi-default-admin-locales-page-tree.js +17 -5
  43. package/plugins/runtime-modules/observability/data-providers.d.ts +9 -0
  44. package/plugins/runtime-modules/observability/data-providers.js +5 -0
  45. package/plugins/runtime-modules/observability/definition.d.ts +9 -0
  46. package/plugins/runtime-modules/observability/module.d.ts +9 -0
  47. package/plugins/runtime-modules/observability/services/table.js +4 -0
  48. package/plugins/runtime-modules/observability/trees/phi-default-admin-logs-page-tree.js +13 -0
  49. package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +21 -0
  50. package/plugins/runtime-modules/preset-contracts/pub-area.d.ts +1 -1
  51. package/plugins/runtime-modules/preset-contracts/pub-area.js +1 -0
  52. package/plugins/runtime-modules/public/presets.d.ts +0 -16
  53. package/plugins/runtime-modules/public/presets.js +0 -22
  54. package/plugins/runtime-modules/public-base-page-references.d.ts +0 -1
  55. package/plugins/runtime-modules/public-base-page-references.js +0 -1
  56. package/plugins/runtime-modules/search/authoring-widgets.d.ts +2 -0
  57. package/plugins/runtime-modules/search/authoring-widgets.js +8 -0
  58. package/plugins/runtime-modules/search/authoring.d.ts +1 -0
  59. package/plugins/runtime-modules/search/authoring.js +8 -0
  60. package/plugins/runtime-modules/search/definition.d.ts +21 -0
  61. package/plugins/runtime-modules/search/definition.js +23 -0
  62. package/plugins/runtime-modules/search/ids.d.ts +6 -0
  63. package/plugins/runtime-modules/search/ids.js +7 -0
  64. package/plugins/runtime-modules/search/module.d.ts +10 -0
  65. package/plugins/runtime-modules/search/module.js +4 -0
  66. package/plugins/runtime-modules/search/page-references.d.ts +8 -0
  67. package/plugins/runtime-modules/search/page-references.js +17 -0
  68. package/plugins/runtime-modules/{search-page-tree.d.ts → search/page-tree.d.ts} +1 -1
  69. package/plugins/runtime-modules/{search-page-tree.js → search/page-tree.js} +9 -7
  70. package/plugins/runtime-modules/search/presets.d.ts +12 -0
  71. package/plugins/runtime-modules/search/presets.js +33 -0
  72. package/plugins/runtime-modules/search/server.d.ts +1 -0
  73. package/plugins/runtime-modules/search/server.js +16 -0
  74. package/plugins/runtime-modules/search/widgets/search-box/authoring.d.ts +8 -0
  75. package/plugins/runtime-modules/search/widgets/search-box/authoring.js +21 -0
  76. package/plugins/runtime-modules/search/widgets/search-box/client.d.ts +39 -0
  77. package/plugins/runtime-modules/search/widgets/search-box/client.js +114 -0
  78. package/plugins/runtime-modules/search/widgets/search-box/config.d.ts +96 -0
  79. package/plugins/runtime-modules/search/widgets/search-box/config.js +67 -0
  80. package/plugins/runtime-modules/{core → search}/widgets/search-box/plugin.js +1 -4
  81. package/plugins/runtime-modules/search/widgets/search-box/server.d.ts +15 -0
  82. package/plugins/runtime-modules/{core → search}/widgets/search-box/server.js +13 -14
  83. package/plugins/runtime-modules/{core → search}/widgets/search-results/config.d.ts +0 -1
  84. package/plugins/runtime-modules/{core → search}/widgets/search-results/config.js +0 -1
  85. package/plugins/runtime-modules/{core → search}/widgets/search-results/plugin.js +1 -3
  86. package/plugins/runtime-modules/{core → search}/widgets/search-results/server.d.ts +1 -2
  87. package/plugins/runtime-modules/{core → search}/widgets/search-results/server.js +2 -2
  88. package/plugins/runtime-modules/search/widgets.d.ts +2 -0
  89. package/plugins/runtime-modules/search/widgets.js +20 -0
  90. package/server-helpers/search-index.js +9 -0
  91. package/styles/shell.css +142 -0
  92. package/theme/phi-theme-tokens.d.ts +1 -1
  93. package/theme/phi-theme-tokens.js +2 -0
  94. package/types/table-widget.d.ts +10 -1
  95. package/types/table-widget.js +1 -0
  96. package/plugins/runtime-modules/core/widgets/search-box/authoring.d.ts +0 -6
  97. package/plugins/runtime-modules/core/widgets/search-box/authoring.js +0 -10
  98. package/plugins/runtime-modules/core/widgets/search-box/client.d.ts +0 -21
  99. package/plugins/runtime-modules/core/widgets/search-box/client.js +0 -17
  100. package/plugins/runtime-modules/core/widgets/search-box/config.d.ts +0 -63
  101. package/plugins/runtime-modules/core/widgets/search-box/config.js +0 -48
  102. package/plugins/runtime-modules/core/widgets/search-box/server.d.ts +0 -21
  103. package/plugins/runtime-modules/search-page-references.d.ts +0 -20
  104. package/plugins/runtime-modules/search-page-references.js +0 -35
  105. /package/plugins/runtime-modules/{core → search}/widgets/search-box/plugin.d.ts +0 -0
  106. /package/plugins/runtime-modules/{core → search}/widgets/search-results/authoring.d.ts +0 -0
  107. /package/plugins/runtime-modules/{core → search}/widgets/search-results/authoring.js +0 -0
  108. /package/plugins/runtime-modules/{core → search}/widgets/search-results/client.d.ts +0 -0
  109. /package/plugins/runtime-modules/{core → search}/widgets/search-results/client.js +0 -0
  110. /package/plugins/runtime-modules/{core → search}/widgets/search-results/plugin.d.ts +0 -0
@@ -0,0 +1,67 @@
1
+ import { resolvePhiCmsWidgetPluginKey } from "../../../../../constants/cms-widget-types";
2
+ import { PHI_SEARCH_WIDGET_DEFAULT_LABELS } from "../../../../../components/widgets/label-types/search";
3
+ import { readRenderableBlockConfig, } from "../../../../../components/widgets/config/parser-primitives";
4
+ const PHI_SEARCH_BOX_SIZES = ["small", "medium", "large"];
5
+ export const PHI_SEARCH_BOX_VARIANTS = ["input", "icon-only", "auto"];
6
+ function normalizePhiSearchBoxWidgetConfig(raw) {
7
+ return {
8
+ ...readRenderableBlockConfig(raw),
9
+ placeholder: typeof raw.placeholder === "string"
10
+ ? raw.placeholder.trim()
11
+ : PHI_SEARCH_WIDGET_DEFAULT_LABELS.placeholder,
12
+ controlSize: PHI_SEARCH_BOX_SIZES.includes(raw.controlSize)
13
+ ? raw.controlSize
14
+ : undefined,
15
+ variant: PHI_SEARCH_BOX_VARIANTS.includes(raw.variant)
16
+ ? raw.variant
17
+ : undefined,
18
+ };
19
+ }
20
+ export const PHI_SEARCH_BOX_WIDGET_DEFINITION = {
21
+ kind: "widget",
22
+ pluginKey: resolvePhiCmsWidgetPluginKey("search-box"),
23
+ typeKey: "search-box",
24
+ title: "Search Box",
25
+ description: "A box that sends what a visitor types to the Site's search results page.",
26
+ category: "navigation",
27
+ tags: ["search", "find", "navigation"],
28
+ icon: "antd:search",
29
+ slotSizePolicy: "fill-inline",
30
+ fields: [
31
+ {
32
+ key: "placeholder",
33
+ type: "string",
34
+ label: "Placeholder",
35
+ // Cleared is kept as cleared: the box then says nothing, rather than "Search" again.
36
+ emptyValue: "",
37
+ description: "Translated. Empty shows nothing.",
38
+ },
39
+ {
40
+ key: "variant",
41
+ type: "choice",
42
+ label: "Variant",
43
+ description: "Icon only opens into the field when pressed. Auto is the input, and the icon on a phone.",
44
+ options: [
45
+ { value: "input", label: "Input" },
46
+ { value: "icon-only", label: "Icon only" },
47
+ { value: "auto", label: "Auto" },
48
+ ],
49
+ },
50
+ {
51
+ key: "controlSize",
52
+ type: "choice",
53
+ label: "Size",
54
+ options: [
55
+ { value: "small", label: "Small" },
56
+ { value: "medium", label: "Medium" },
57
+ { value: "large", label: "Large" },
58
+ ],
59
+ },
60
+ ],
61
+ /*
62
+ * What the Inspector shows chosen where a box states nothing, and what an absent value renders as: the
63
+ * input, at the house's medium size.
64
+ */
65
+ defaultConfig: { ...normalizePhiSearchBoxWidgetConfig({}), variant: "input", controlSize: "medium" },
66
+ parseConfig: normalizePhiSearchBoxWidgetConfig,
67
+ };
@@ -1,11 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { PhiCmsFlags } from "../../../../../constants/phi-cms";
3
- import { hasPhiFlag } from "../../../../../helpers/flags";
4
2
  import { definePhiPassiveWidgetRenderers } from "../../../../../plugins/factories/widget-renderers";
5
3
  import { PHI_SEARCH_BOX_WIDGET_DEFINITION } from "./config";
6
4
  import { PhiSearchBoxWidget } from "./server";
7
5
  export const PHI_SEARCH_BOX_WIDGET_PLUGIN = {
8
6
  ...PHI_SEARCH_BOX_WIDGET_DEFINITION,
9
- // `links` carries the author's results Page, resolved with every other target of the page.
10
- ...definePhiPassiveWidgetRenderers(({ widget, config, runtime, links }) => (_jsx(PhiSearchBoxWidget, { config: config, runtime: runtime, links: links, translate: !hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate) }, `widget-${widget.id}`))),
7
+ ...definePhiPassiveWidgetRenderers(({ widget, config, runtime }) => (_jsx(PhiSearchBoxWidget, { config: config, runtime: runtime }, `widget-${widget.id}`))),
11
8
  };
@@ -0,0 +1,15 @@
1
+ import type { PhiNoLabels, PhiServerBlockBaseProps } from "../../../../../types";
2
+ import type { PhiSearchBoxWidgetConfig } from "./config";
3
+ export type PhiSearchBoxWidgetProps = PhiServerBlockBaseProps<PhiNoLabels, PhiSearchBoxWidgetConfig>;
4
+ /**
5
+ * The search box, resolved on the server: where the form goes, what the box says, what it already holds.
6
+ *
7
+ * Where it goes is the Search Module's results Page of the Area it stands in, a reference resolved as
8
+ * every link is. A Page that does not resolve -- unpublished -- draws no box at all rather than one that
9
+ * leads to "not found". The placeholder is the author's words, always translated: a box whose prompt
10
+ * stays in one language on a Site that speaks several has nothing to gain from it.
11
+ *
12
+ * On the results Page itself the box shows the query it is answering, read from the same URL parameter
13
+ * the results Widget reads.
14
+ */
15
+ export declare function PhiSearchBoxWidget({ config, runtime }: PhiSearchBoxWidgetProps): Promise<import("react").JSX.Element | null>;
@@ -7,41 +7,40 @@ import { resolvePhiLinkHref } from "../../../../../helpers/link-target";
7
7
  import { resolvePhiLinkTargetReferences } from "../../../../../server-helpers/cms-link-targets";
8
8
  import { phiRuntime } from "../../../../../server-helpers/phi-runtime";
9
9
  import { trBulkForLocale } from "../../../../../server-helpers/translate";
10
- import { resolvePhiSearchPageLinkTarget } from "../../../search-page-references";
10
+ import { resolvePhiSearchPageLinkTarget } from "../../page-references";
11
11
  /**
12
12
  * The search box, resolved on the server: where the form goes, what the box says, what it already holds.
13
13
  *
14
- * The results Page is a reference, resolved as every link is -- through the page's targets where the
15
- * author picked one, or alone where the box takes the Area's own Page. An Area whose search Page does not
16
- * resolve -- a Module switched off, a Page unpublished -- draws no box at all rather than one that
17
- * leads to "not found".
14
+ * Where it goes is the Search Module's results Page of the Area it stands in, a reference resolved as
15
+ * every link is. A Page that does not resolve -- unpublished -- draws no box at all rather than one that
16
+ * leads to "not found". The placeholder is the author's words, always translated: a box whose prompt
17
+ * stays in one language on a Site that speaks several has nothing to gain from it.
18
18
  *
19
19
  * On the results Page itself the box shows the query it is answering, read from the same URL parameter
20
20
  * the results Widget reads.
21
21
  */
22
- export async function PhiSearchBoxWidget({ config, runtime, links, translate = true }) {
22
+ export async function PhiSearchBoxWidget({ config, runtime }) {
23
23
  const rt = phiRuntime(runtime);
24
24
  const locale = runtime.locale.current;
25
- const target = config?.linkTarget ?? resolvePhiSearchPageLinkTarget(runtime.area);
26
- const resolved = config?.linkTarget
27
- ? links ?? null
28
- : target.kind === "page"
29
- ? await resolvePhiLinkTargetReferences(new Map([["linkTarget", { reference: target.reference, area: target.area ?? null }]]), runtime)
30
- : null;
25
+ const target = resolvePhiSearchPageLinkTarget(runtime.area);
26
+ const resolved = target.kind === "page"
27
+ ? await resolvePhiLinkTargetReferences(new Map([["linkTarget", { reference: target.reference, area: target.area ?? null }]]), runtime)
28
+ : null;
31
29
  const href = resolvePhiLinkHref(target, resolved);
32
30
  if (!href) {
33
31
  return null;
34
32
  }
35
33
  const [labels, [placeholder]] = await Promise.all([
36
34
  getPhiSearchWidgetLabels({ apiBaseUrl: rt.apiBaseUrl, internalToken: rt.internalToken, locale }),
37
- config?.placeholder && translate ? trBulkForLocale(locale, [config.placeholder]) : [config?.placeholder ?? ""],
35
+ config?.placeholder ? trBulkForLocale(locale, [config.placeholder]) : [""],
38
36
  ]);
39
37
  return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PhiCmsWidgetType.SearchBox, componentProps: {
40
38
  labels,
41
39
  config: {
42
40
  action: href.href,
43
- placeholder: placeholder || labels.placeholder,
41
+ placeholder,
44
42
  ...(config?.controlSize ? { size: config.controlSize } : {}),
43
+ ...(config?.variant ? { variant: config.variant } : {}),
45
44
  initialQuery: runtime.request?.searchParams?.[PHI_SEARCH_QUERY_PARAM] ?? "",
46
45
  },
47
46
  } }));
@@ -21,7 +21,6 @@ export declare const PHI_SEARCH_RESULTS_WIDGET_DEFINITION: {
21
21
  description: string;
22
22
  category: "content";
23
23
  tags: string[];
24
- translatesOwnText: true;
25
24
  icon: string;
26
25
  slotSizePolicy: "fill-inline";
27
26
  fields: ({
@@ -16,7 +16,6 @@ export const PHI_SEARCH_RESULTS_WIDGET_DEFINITION = {
16
16
  description: "The Site's pages matching the search in the page's address, best first.",
17
17
  category: "content",
18
18
  tags: ["search", "results", "find"],
19
- translatesOwnText: true,
20
19
  icon: "antd:search",
21
20
  slotSizePolicy: "fill-inline",
22
21
  fields: [
@@ -1,10 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { PhiCmsFlags } from "../../../../../constants/phi-cms";
3
- import { hasPhiFlag } from "../../../../../helpers/flags";
4
2
  import { definePhiPassiveWidgetRenderers } from "../../../../../plugins/factories/widget-renderers";
5
3
  import { PHI_SEARCH_RESULTS_WIDGET_DEFINITION } from "./config";
6
4
  import { PhiSearchResultsWidget } from "./server";
7
5
  export const PHI_SEARCH_RESULTS_WIDGET_PLUGIN = {
8
6
  ...PHI_SEARCH_RESULTS_WIDGET_DEFINITION,
9
- ...definePhiPassiveWidgetRenderers(({ widget, config, runtime }) => (_jsx(PhiSearchResultsWidget, { config: config, runtime: runtime, translate: !hasPhiFlag(widget.flags, PhiCmsFlags.NoTranslate), widgetId: widget.id }, `widget-${widget.id}`))),
7
+ ...definePhiPassiveWidgetRenderers(({ widget, config, runtime }) => (_jsx(PhiSearchResultsWidget, { config: config, runtime: runtime, widgetId: widget.id }, `widget-${widget.id}`))),
10
8
  };
@@ -2,7 +2,6 @@ import type { PhiNoLabels, PhiServerBlockBaseProps } from "../../../../../types"
2
2
  import type { PhiCmsInstanceId } from "../../../../../types/cms-instance-id";
3
3
  import type { PhiSearchResultsWidgetConfig } from "./config";
4
4
  export type PhiSearchResultsWidgetProps = PhiServerBlockBaseProps<PhiNoLabels, PhiSearchResultsWidgetConfig> & {
5
- translate?: boolean;
6
5
  widgetId?: PhiCmsInstanceId | null;
7
6
  };
8
7
  /**
@@ -17,4 +16,4 @@ export type PhiSearchResultsWidgetProps = PhiServerBlockBaseProps<PhiNoLabels, P
17
16
  * A failed read is `PhiWidgetFailureServer`: an empty list would tell the visitor the Site has nothing on
18
17
  * the subject, which is not what happened.
19
18
  */
20
- export declare function PhiSearchResultsWidget({ config, runtime, translate, widgetId }: PhiSearchResultsWidgetProps): Promise<import("react").JSX.Element>;
19
+ export declare function PhiSearchResultsWidget({ config, runtime, widgetId }: PhiSearchResultsWidgetProps): Promise<import("react").JSX.Element>;
@@ -29,13 +29,13 @@ function readHitArea(areaMask) {
29
29
  * A failed read is `PhiWidgetFailureServer`: an empty list would tell the visitor the Site has nothing on
30
30
  * the subject, which is not what happened.
31
31
  */
32
- export async function PhiSearchResultsWidget({ config, runtime, translate = true, widgetId }) {
32
+ export async function PhiSearchResultsWidget({ config, runtime, widgetId }) {
33
33
  const rt = phiRuntime(runtime);
34
34
  const locale = runtime.locale.current;
35
35
  const renderMode = readPhiRuntimeTreeRenderMode(config ?? {});
36
36
  const [labels, [title]] = await Promise.all([
37
37
  getPhiSearchResultsWidgetLabels({ apiBaseUrl: rt.apiBaseUrl, internalToken: rt.internalToken, locale }),
38
- config?.title && translate ? trBulkForLocale(locale, [config.title]) : [config?.title ?? ""],
38
+ config?.title ? trBulkForLocale(locale, [config.title]) : [""],
39
39
  ]);
40
40
  const raw = runtime.request?.searchParams?.[PHI_SEARCH_QUERY_PARAM];
41
41
  const query = readPhiSearchQuery(raw);
@@ -0,0 +1,2 @@
1
+ import type { PhiRuntimeModuleWidgetDefinition } from "../contracts";
2
+ export declare const PHI_SEARCH_RUNTIME_MODULE_WIDGETS: readonly PhiRuntimeModuleWidgetDefinition[];
@@ -0,0 +1,20 @@
1
+ import { PHI_SEARCH_RUNTIME_MODULE_ID } from "./ids";
2
+ import { PHI_SEARCH_BOX_WIDGET_DEFINITION } from "./widgets/search-box/config";
3
+ import { PHI_SEARCH_RESULTS_WIDGET_DEFINITION } from "./widgets/search-results/config";
4
+ import { definePhiFirstPartyWidget } from "../contracts";
5
+ export const PHI_SEARCH_RUNTIME_MODULE_WIDGETS = [
6
+ definePhiFirstPartyWidget({
7
+ definition: PHI_SEARCH_BOX_WIDGET_DEFINITION,
8
+ ownerModuleId: PHI_SEARCH_RUNTIME_MODULE_ID,
9
+ renderPolicies: { runtime: "custom", preview: "custom", authoring: "custom" },
10
+ loadRuntime: () => import("./widgets/search-box/plugin").then((module) => module.PHI_SEARCH_BOX_WIDGET_PLUGIN),
11
+ loadPreview: () => import("./widgets/search-box/plugin").then((module) => module.PHI_SEARCH_BOX_WIDGET_PLUGIN),
12
+ }),
13
+ definePhiFirstPartyWidget({
14
+ definition: PHI_SEARCH_RESULTS_WIDGET_DEFINITION,
15
+ ownerModuleId: PHI_SEARCH_RUNTIME_MODULE_ID,
16
+ renderPolicies: { runtime: "custom", preview: "custom", authoring: "custom" },
17
+ loadRuntime: () => import("./widgets/search-results/plugin").then((module) => module.PHI_SEARCH_RESULTS_WIDGET_PLUGIN),
18
+ loadPreview: () => import("./widgets/search-results/plugin").then((module) => module.PHI_SEARCH_RESULTS_WIDGET_PLUGIN),
19
+ }),
20
+ ];
@@ -1,5 +1,7 @@
1
1
  import "server-only";
2
2
  import { createHash } from "node:crypto";
3
+ import { PHI_SHARED_PACKAGE_NAME } from "../constants/package";
4
+ import { createPhiRuntimeModuleId } from "../constants/module-identity";
3
5
  import { PHI_SEARCH_MAX_DOCUMENTS } from "@phis/contracts/search";
4
6
  import { resolvePhiCmsPageRedirect } from "../components/cms/phi-cms-page-redirect";
5
7
  import { getSiteAreaWithPublishedPages } from "../gateway/site-area";
@@ -35,6 +37,11 @@ import { joinPhiSearchText } from "./search-text";
35
37
  * during a run queues one more.
36
38
  */
37
39
  const PHI_SEARCH_INDEX_AREAS = ["public", "app"];
40
+ /*
41
+ * The first-party Search Module, named by id as data (MODULES.md, "The dependency rule"): an Area is
42
+ * indexed only where it is switched on, since only there is anything placed that reads the index.
43
+ */
44
+ const PHI_SEARCH_RUNTIME_MODULE_ID = createPhiRuntimeModuleId(PHI_SHARED_PACKAGE_NAME, "search");
38
45
  /** How many Pages are resolved at once; each is a page lookup against the server. */
39
46
  const PHI_SEARCH_INDEX_RESOLVE_CONCURRENCY = 4;
40
47
  /** How long after the marker moved the run starts, so a burst of publishes is one run. */
@@ -181,6 +188,8 @@ async function indexArea({ area, bridge, credentials, heldFingerprint, }) {
181
188
  preset: areaPreset?.preset ?? null,
182
189
  serverCapabilities: anonymous.serverCapabilities,
183
190
  });
191
+ if (!activeModuleIds.has(PHI_SEARCH_RUNTIME_MODULE_ID))
192
+ return;
184
193
  const candidates = collectPhiSitemapCandidates({
185
194
  moduleRoutes: [...routeTable.exactByPath].map(([path, descriptor]) => [path, descriptor]),
186
195
  publishedPages,
package/styles/shell.css CHANGED
@@ -784,6 +784,11 @@
784
784
  position: absolute !important;
785
785
  width: 1px !important;
786
786
  height: 1px !important;
787
+ /* The pill's own `min-width` outweighs the width above; left standing, it kept the box 56px wide and
788
+ pushed it past the screen's edge, so every page scrolled sideways by a few pixels. */
789
+ min-width: 0 !important;
790
+ padding: 0 !important;
791
+ border: 0 !important;
787
792
  overflow: hidden !important;
788
793
  clip-path: inset(50%) !important;
789
794
  white-space: nowrap !important;
@@ -795,3 +800,140 @@
795
800
  transition: none !important;
796
801
  }
797
802
  }
803
+
804
+ /*
805
+ * The Search Box (SEARCH.md): the input, a magnifier alone that opens into one (`icon-only`), or `auto` -- both drawn, and the
806
+ * Shell's phone decides which shows, as it does for the Header Navigation's menu button above.
807
+ */
808
+ .phi-search-box {
809
+ display: flex;
810
+ align-items: center;
811
+ justify-content: flex-end;
812
+ min-width: 0;
813
+ }
814
+
815
+ .phi-search-box__field,
816
+ .phi-search-box__form {
817
+ display: block;
818
+ flex: 1 1 auto;
819
+ min-width: 0;
820
+ }
821
+
822
+ .phi-search-box--input,
823
+ .phi-search-box--auto {
824
+ width: 100%;
825
+ }
826
+
827
+ .phi-search-box__magnifier {
828
+ display: inline-flex;
829
+ align-items: center;
830
+ }
831
+
832
+ .phi-search-box--auto > .phi-search-box__magnifier,
833
+ .phi-search-box--auto > .phi-search-box__expand {
834
+ display: none;
835
+ }
836
+
837
+ /*
838
+ * The magnifier keeps its own width. The Widget fills its slot's inline size as a field does; a magnifier
839
+ * that filled it would push the Widgets beside it away, so the innermost slot around it hugs it instead.
840
+ */
841
+ .phi-slot-child:has(.phi-search-box--icon-only):not(:has(.phi-slot-child)) {
842
+ width: auto !important;
843
+ flex: 0 0 auto !important;
844
+ min-width: var(--ant-control-height) !important;
845
+ }
846
+
847
+ /* Opened where it stands: the field grows out of the magnifier. */
848
+ .phi-search-box__expand {
849
+ display: block;
850
+ width: 15rem;
851
+ max-width: 100%;
852
+ animation: phi-search-box-expand 180ms ease-out;
853
+ }
854
+
855
+ @keyframes phi-search-box-expand {
856
+ from {
857
+ width: var(--ant-control-height);
858
+ opacity: 0.4;
859
+ }
860
+ }
861
+
862
+ /* Closing plays it backwards, back into the magnifier; the field is removed when it ends. */
863
+ .phi-search-box__expand--closing {
864
+ animation: phi-search-box-collapse 180ms ease-in forwards;
865
+ pointer-events: none;
866
+ }
867
+
868
+ @keyframes phi-search-box-collapse {
869
+ to {
870
+ width: var(--ant-control-height);
871
+ opacity: 0.4;
872
+ }
873
+ }
874
+
875
+ /*
876
+ * Opened on a phone: a row over the whole band, the field and its close mark, on the page's own ground
877
+ * so the band's widgets do not show through it, light or dark.
878
+ */
879
+ .phi-search-box__row {
880
+ position: absolute;
881
+ inset: 0;
882
+ z-index: 60;
883
+ display: flex;
884
+ align-items: center;
885
+ gap: var(--ant-padding-xs, 8px);
886
+ padding-inline: var(--ant-padding, 16px);
887
+ background: var(--ant-color-bg-container);
888
+ animation: phi-search-box-row 160ms ease-out;
889
+ }
890
+
891
+ @keyframes phi-search-box-row {
892
+ from {
893
+ opacity: 0;
894
+ }
895
+ }
896
+
897
+ .phi-search-box__row--closing {
898
+ animation: phi-search-box-row-out 160ms ease-in forwards;
899
+ pointer-events: none;
900
+ }
901
+
902
+ @keyframes phi-search-box-row-out {
903
+ to {
904
+ opacity: 0;
905
+ }
906
+ }
907
+
908
+ @container phi-render-viewport (width < 768px) {
909
+ .phi-search-box--auto {
910
+ width: auto;
911
+ }
912
+
913
+ .phi-search-box--auto > .phi-search-box__field {
914
+ display: none;
915
+ }
916
+
917
+ .phi-search-box--auto > .phi-search-box__magnifier {
918
+ display: inline-flex;
919
+ }
920
+
921
+ .phi-search-box--auto > .phi-search-box__expand {
922
+ display: block;
923
+ }
924
+
925
+ .phi-slot-child:has(.phi-search-box--auto):not(:has(.phi-slot-child)) {
926
+ width: auto !important;
927
+ flex: 0 0 auto !important;
928
+ min-width: var(--ant-control-height) !important;
929
+ }
930
+ }
931
+
932
+ @media (prefers-reduced-motion: reduce) {
933
+ .phi-search-box__expand,
934
+ .phi-search-box__expand--closing,
935
+ .phi-search-box__row,
936
+ .phi-search-box__row--closing {
937
+ animation: none;
938
+ }
939
+ }
@@ -22,7 +22,7 @@ import type { PhiThemePalette } from "./phi-theme-presets";
22
22
  * Who may still speak Ant Design directly is a separate question, and `scripts/validate-control-boundaries.mjs`
23
23
  * answers it: the alias resolver, the root adapter, the two font helpers and this file.
24
24
  */
25
- export declare const PHI_THEME_TOKEN_KEYS: readonly ["colorBgContainer", "colorBgElevated", "colorBgMask", "colorBgSpotlight", "colorBorder", "colorBorderSecondary", "colorSplit", "colorFillAlter", "colorFill", "colorBgLayout", "colorFillQuaternary", "colorFillSecondary", "colorFillTertiary", "colorText", "colorTextBase", "colorTextHeading", "colorTextSecondary", "colorTextTertiary", "colorTextQuaternary", "colorTextDescription", "colorTextDisabled", "colorTextLabel", "colorTextPlaceholder", "colorTextLightSolid", "colorPrimary", "colorPrimaryBg", "colorPrimaryBgHover", "colorPrimaryBorder", "colorPrimaryBorderHover", "colorPrimaryHover", "colorPrimaryActive", "colorPrimaryText", "colorPrimaryTextHover", "colorPrimaryTextActive", "colorInfo", "colorInfoBg", "colorInfoBgHover", "colorInfoBorder", "colorInfoBorderHover", "colorInfoText", "colorInfoTextHover", "colorSuccess", "colorSuccessBg", "colorSuccessBgHover", "colorSuccessBorder", "colorSuccessBorderHover", "colorSuccessText", "colorWarning", "colorWarningBg", "colorWarningBgHover", "colorWarningBorder", "colorWarningBorderHover", "colorWarningText", "colorError", "colorErrorBg", "colorErrorText", "colorErrorTextHover", "colorErrorTextActive", "colorLink", "colorLinkHover", "colorLinkActive", "padding", "paddingXXS", "paddingXS", "paddingSM", "paddingMD", "paddingLG", "paddingXL", "margin", "marginXXS", "marginXS", "marginSM", "marginMD", "marginLG", "marginXL", "marginXXL", "sizeXS", "sizeSM", "sizeMD", "sizeLG", "borderRadius", "borderRadiusXS", "borderRadiusSM", "borderRadiusLG", "borderRadiusOuter", "lineWidth", "lineType", "boxShadow", "boxShadowSecondary", "boxShadowTertiary", "controlHeight", "controlHeightXS", "controlHeightSM", "controlHeightLG", "fontFamily", "fontFamilyCode", "fontSize", "fontSizeSM", "fontSizeLG", "fontSizeXL", "fontSizeHeading1", "fontSizeHeading2", "fontSizeHeading3", "fontSizeHeading4", "fontSizeHeading5", "fontWeightStrong", "lineHeight", "lineHeightSM", "lineHeightLG", "lineHeightHeading1", "lineHeightHeading2", "lineHeightHeading3", "lineHeightHeading4", "lineHeightHeading5", "motionDurationMid", "motionDurationSlow", "motionEaseInOut", "motionEaseOut"];
25
+ export declare const PHI_THEME_TOKEN_KEYS: readonly ["colorBgContainer", "colorBgElevated", "colorBgMask", "colorBgSpotlight", "colorBorder", "colorBorderSecondary", "colorSplit", "colorFillAlter", "colorFill", "colorBgLayout", "colorFillQuaternary", "colorFillSecondary", "colorFillTertiary", "colorText", "colorTextBase", "colorTextHeading", "colorTextSecondary", "colorTextTertiary", "colorTextQuaternary", "colorTextDescription", "colorTextDisabled", "colorTextLabel", "colorTextPlaceholder", "colorTextLightSolid", "colorPrimary", "colorPrimaryBg", "colorPrimaryBgHover", "colorPrimaryBorder", "colorPrimaryBorderHover", "colorPrimaryHover", "colorPrimaryActive", "colorPrimaryText", "colorPrimaryTextHover", "colorPrimaryTextActive", "colorInfo", "colorInfoBg", "colorInfoBgHover", "colorInfoBorder", "colorInfoBorderHover", "colorInfoText", "colorInfoTextHover", "colorSuccess", "colorSuccessBg", "colorSuccessBgHover", "colorSuccessBorder", "colorSuccessBorderHover", "colorSuccessText", "colorWarning", "colorWarningBg", "colorWarningBgHover", "colorWarningBorder", "colorWarningBorderHover", "colorWarningText", "colorError", "colorErrorBg", "colorErrorText", "colorErrorTextHover", "colorErrorTextActive", "colorLink", "colorLinkHover", "colorLinkActive", "padding", "paddingXXS", "paddingXS", "paddingSM", "paddingMD", "paddingLG", "paddingXL", "margin", "marginXXS", "marginXS", "marginSM", "marginMD", "marginLG", "marginXL", "marginXXL", "sizeXS", "sizeSM", "sizeMD", "sizeLG", "borderRadius", "borderRadiusXS", "borderRadiusSM", "borderRadiusLG", "borderRadiusOuter", "lineWidth", "lineWidthBold", "lineType", "boxShadow", "boxShadowSecondary", "boxShadowTertiary", "controlHeight", "controlHeightXS", "controlHeightSM", "controlHeightLG", "fontFamily", "fontFamilyCode", "fontSize", "fontSizeSM", "fontSizeLG", "fontSizeXL", "fontSizeHeading1", "fontSizeHeading2", "fontSizeHeading3", "fontSizeHeading4", "fontSizeHeading5", "fontWeightStrong", "lineHeight", "lineHeightSM", "lineHeightLG", "lineHeightHeading1", "lineHeightHeading2", "lineHeightHeading3", "lineHeightHeading4", "lineHeightHeading5", "motionDurationMid", "motionDurationSlow", "motionEaseInOut", "motionEaseOut"];
26
26
  /**
27
27
  * The names this house adds to Ant Design's set.
28
28
  *
@@ -114,6 +114,8 @@ export const PHI_THEME_TOKEN_KEYS = [
114
114
  "borderRadiusLG",
115
115
  "borderRadiusOuter",
116
116
  "lineWidth",
117
+ // The bold rule: an Anchor's rail and the like. Content set beside such a rail lines up with it.
118
+ "lineWidthBold",
117
119
  "lineType",
118
120
  "boxShadow",
119
121
  "boxShadowSecondary",
@@ -100,11 +100,20 @@ export type PhiTableColumnDefinition = {
100
100
  tagColorMap?: Readonly<Record<string, PhiTableTagColor>>;
101
101
  tagVariant?: PhiTableTagVariant;
102
102
  };
103
- export type PhiTableColumnEditorControl = "switch" | "checkbox" | "select" | "radio" | "segmented" | "multi-select" | "checkbox-group" | "icon-picker";
103
+ export type PhiTableColumnEditorControl = "switch" | "checkbox" | "select" | "radio" | "segmented" | "multi-select" | "checkbox-group" | "icon-picker"
104
+ /** A `string` field edited over several lines: the cell grows with its text and wraps it. */
105
+ | "textarea";
104
106
  type PhiTableFilterCommon = {
105
107
  key: string;
106
108
  label: string;
107
109
  labelPlacement?: "above" | "inline" | "none";
110
+ /**
111
+ * What the filter does, for a reader the label does not tell enough -- already in their language.
112
+ *
113
+ * Carried the way every Control carries a description: the information glyph after a label that is
114
+ * shown, the hover text of the Control itself where `labelPlacement` is `none`.
115
+ */
116
+ description?: string;
108
117
  };
109
118
  export type PhiTableFilterDefinition = PhiTableFilterCommon & ({
110
119
  type: "text";
@@ -321,6 +321,7 @@ export function validatePhiTableWidgetBinding(config, resource) {
321
321
  (field?.type === "enum" && (column.editor.control === "select" || column.editor.control === "radio" ||
322
322
  column.editor.control === "segmented")) ||
323
323
  (field?.type === "string" && Boolean(field.rowOptionsPath) && column.editor.control === "select") ||
324
+ (field?.type === "string" && column.editor.control === "textarea") ||
324
325
  (field?.type === "enum[]" && (column.editor.control === "multi-select" ||
325
326
  column.editor.control === "checkbox-group"));
326
327
  if (column.editor && !editorControlCompatible) {
@@ -1,6 +0,0 @@
1
- import { type PhiSearchBoxWidgetConfig } from "./config";
2
- /**
3
- * What the Builder says about a box that is a form the browser submits: where it leads, not a field to
4
- * type into on the canvas -- a submit there would leave the Builder for the results Page.
5
- */
6
- export declare const PHI_SEARCH_BOX_WIDGET_BUILDER_PLUGIN: import("../../../../../types").PhiCmsBuilderWidgetPlugin<PhiSearchBoxWidgetConfig>;
@@ -1,10 +0,0 @@
1
- "use client";
2
- import { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
3
- import { createPhiCmsBuilderWidgetPlugin } from "../../../../../plugins/factories/widget-builder-plugin";
4
- import { PhiWidgetEditorPlaceholder } from "../../../../../components/widgets/builder/widget-editor-placeholder";
5
- import { PHI_SEARCH_BOX_WIDGET_DEFINITION } from "./config";
6
- /**
7
- * What the Builder says about a box that is a form the browser submits: where it leads, not a field to
8
- * type into on the canvas -- a submit there would leave the Builder for the results Page.
9
- */
10
- export const PHI_SEARCH_BOX_WIDGET_BUILDER_PLUGIN = createPhiCmsBuilderWidgetPlugin(PHI_SEARCH_BOX_WIDGET_DEFINITION, ({ widget, config }) => (_jsx(PhiWidgetEditorPlaceholder, { widget: widget, pluginTitle: PHI_SEARCH_BOX_WIDGET_DEFINITION.title, summary: _jsxs(_Fragment, { children: ["A search field that sends what a visitor types to ", config?.linkTarget ? "the chosen results page" : "this Area's search page", config?.placeholder ? _jsxs(_Fragment, { children: ["; it reads \u201C", config.placeholder, "\u201D while empty"] }) : null, "."] }) })));
@@ -1,21 +0,0 @@
1
- import type { PhiSearchWidgetLabels } from "../../../../../components/widgets/label-types/search";
2
- import type { PhiClientBlockBaseProps } from "../../../../../types";
3
- import type { PhiControlSize } from "../../../../../types/control";
4
- export type PhiSearchBoxWidgetClientConfig = {
5
- /** The results Page, as the form's address. */
6
- action: string;
7
- placeholder: string;
8
- size?: PhiControlSize;
9
- /** The query the page is answering, so the box shows what was searched for. */
10
- initialQuery: string;
11
- };
12
- export type PhiSearchBoxWidgetClientProps = PhiClientBlockBaseProps<PhiSearchWidgetLabels, PhiSearchBoxWidgetClientConfig>;
13
- /**
14
- * A `GET` form around one search field (SEARCH.md).
15
- *
16
- * The browser submits it: Enter, or the keyboard's search key, sends `?q=` to the results Page without
17
- * a script, and a static Public page needs none. The field is the house's text Control with the form's
18
- * field name, so it clears, labels and sizes like every other field, and the form is a landmark a screen
19
- * reader lists.
20
- */
21
- export declare function PhiSearchBoxWidgetClient({ labels, config }: PhiSearchBoxWidgetClientProps): import("react").JSX.Element;
@@ -1,17 +0,0 @@
1
- "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useState } from "react";
4
- import { PHI_SEARCH_QUERY_PARAM } from "@phis/contracts/search";
5
- import { PhiTextControl } from "../../../../../components/controls/phi-text-control";
6
- /**
7
- * A `GET` form around one search field (SEARCH.md).
8
- *
9
- * The browser submits it: Enter, or the keyboard's search key, sends `?q=` to the results Page without
10
- * a script, and a static Public page needs none. The field is the house's text Control with the form's
11
- * field name, so it clears, labels and sizes like every other field, and the form is a landmark a screen
12
- * reader lists.
13
- */
14
- export function PhiSearchBoxWidgetClient({ labels, config }) {
15
- const [draft, setDraft] = useState(config?.initialQuery ?? "");
16
- return (_jsx("form", { method: "get", action: config?.action, role: "search", "aria-label": labels.title, style: { width: "100%" }, children: _jsx(PhiTextControl, { name: PHI_SEARCH_QUERY_PARAM, inputType: "search", ariaLabel: labels.ariaLabel, placeholder: config?.placeholder || labels.placeholder, clearLabel: labels.clearLabel, size: config?.size, value: draft, onChange: (value) => setDraft(value ?? ""), onClear: () => setDraft(""), style: { width: "100%" } }) }));
17
- }
@@ -1,63 +0,0 @@
1
- import type { PhiControlSize } from "../../../../../types/control";
2
- import { type PhiLinkTarget } from "../../../../../types/references";
3
- import { type PhiCmsWidgetConfigBase } from "../../../../../components/widgets/config/parser-primitives";
4
- /**
5
- * The box a visitor types a search into (SEARCH.md).
6
- *
7
- * It is a form the browser submits: `GET` to the results Page, the query in the URL. So it works before
8
- * anything hydrated and in a static render, where no script has run yet; and the results Page reads the
9
- * same URL whether it was reached from here, from a bookmark or from a link somebody pasted.
10
- */
11
- export type PhiSearchBoxWidgetConfig = PhiCmsWidgetConfigBase & {
12
- /** What the empty box says; empty for the label set's word. The author's text, translated. */
13
- placeholder: string;
14
- /**
15
- * Where the query goes: a results Page, as a reference (REFERENCES.md). Absent, the Area's own search
16
- * Page -- the App's in App, the Public one everywhere else -- so a box dropped into a Page works
17
- * without being told where.
18
- */
19
- linkTarget?: PhiLinkTarget;
20
- /** The field's size; `size` is the block's own geometry and cannot be this. */
21
- controlSize?: PhiControlSize;
22
- };
23
- declare function normalizePhiSearchBoxWidgetConfig(raw: Record<string, unknown>): PhiSearchBoxWidgetConfig;
24
- export declare const PHI_SEARCH_BOX_WIDGET_DEFINITION: {
25
- kind: "widget";
26
- pluginKey: string;
27
- typeKey: string;
28
- title: string;
29
- description: string;
30
- category: "navigation";
31
- tags: string[];
32
- translatesOwnText: true;
33
- icon: string;
34
- slotSizePolicy: "fill-inline";
35
- fields: ({
36
- key: string;
37
- type: "string";
38
- label: string;
39
- description: string;
40
- heading?: undefined;
41
- options?: undefined;
42
- } | {
43
- key: string;
44
- type: "link-target";
45
- heading: string;
46
- label: string;
47
- description: string;
48
- options?: undefined;
49
- } | {
50
- key: string;
51
- type: "choice";
52
- label: string;
53
- options: {
54
- value: string;
55
- label: string;
56
- }[];
57
- description?: undefined;
58
- heading?: undefined;
59
- })[];
60
- defaultConfig: PhiSearchBoxWidgetConfig;
61
- parseConfig: typeof normalizePhiSearchBoxWidgetConfig;
62
- };
63
- export {};