@phis/ui 0.4.7 → 0.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/cms/phi-cms-runtime-registry.d.ts +2 -1
- package/components/cms/phi-cms-runtime-registry.js +1 -1
- package/components/controls/phi-color-control.js +2 -1
- package/components/controls/phi-drawer-control-adapter.js +2 -3
- package/components/controls/phi-drawer-control.js +3 -3
- package/components/controls/phi-dropdown-control.js +2 -1
- package/components/controls/phi-float-button-control.js +3 -3
- package/components/controls/phi-modal-control-adapter.js +2 -2
- package/components/controls/phi-modal-control.js +3 -3
- package/components/controls/phi-ribbon-wrap-control.js +2 -1
- package/components/controls/phi-zoom-image-overlay.js +11 -5
- package/components/forms/content-entry-forms.js +1 -5
- package/components/forms/form-descriptor-runtime-client.js +2 -1
- package/components/forms/form-descriptor-text.d.ts +17 -0
- package/components/forms/form-descriptor-text.js +14 -0
- package/components/forms/runtime-form-controller-plugin.d.ts +0 -115
- package/components/forms/runtime-form-controller-plugin.js +1 -1
- package/components/forms/upload-form-control.d.ts +0 -7
- package/components/forms/upload-form-control.js +1 -1
- package/components/layouts/clients/phi-collapsible-layout-client.js +2 -1
- package/components/layouts/clients/phi-sequence-slot-editor.js +2 -1
- package/components/layouts/clients/phi-split-card-half.js +2 -1
- package/components/layouts/phi-base-layout.js +2 -1
- package/components/layouts/phi-layout-surface-box.js +2 -1
- package/components/media/phi-media-picker-server.js +3 -11
- package/components/navigation/use-phi-protected-mail.js +1 -9
- package/components/regions/presets/clients/sider-context.js +4 -2
- package/components/root/phi-config-provider.js +2 -1
- package/components/root/phi-dayjs-locale.d.ts +4 -1
- package/components/root/phi-dayjs-locale.js +2 -2
- package/components/root/phi-intl-locale.d.ts +7 -1
- package/components/root/phi-intl-locale.js +20 -15
- package/components/root/phi-root-layout.js +2 -1
- package/components/runtime/core-runtime-controller-plugin.d.ts +0 -84
- package/components/runtime/core-runtime-controller-plugin.js +1 -1
- package/components/runtime/runtime-signal-bus.js +39 -4
- package/components/state/use-phi-hydrated.d.ts +6 -0
- package/components/state/use-phi-hydrated.js +11 -0
- package/components/widgets/client/shared/phi-rendered-value.js +4 -3
- package/components/widgets/config/parser-primitives.d.ts +5 -0
- package/components/widgets/config/parser-primitives.js +11 -0
- package/components/widgets/label-sets/runtime-options.d.ts +1 -1
- package/components/widgets/server/builder-chrome.js +2 -6
- package/components/widgets/server/search.js +2 -6
- package/gateway/dashboard-cards-route.js +5 -7
- package/gateway/navigation-target-route.js +7 -9
- package/gateway/page-references-route.js +6 -8
- package/gateway/site-config.js +3 -0
- package/gateway/site-proxy.js +13 -2
- package/helpers/class-names.d.ts +7 -0
- package/helpers/class-names.js +10 -0
- package/helpers/cms-navigation-catalog.js +4 -2
- package/helpers/cms-page-catalog.js +35 -6
- package/helpers/cms-region-keys.d.ts +0 -1
- package/helpers/cms-region-keys.js +1 -1
- package/helpers/format-date-time.d.ts +14 -3
- package/helpers/format-date-time.js +27 -11
- package/helpers/region-page-scope.d.ts +1 -3
- package/helpers/region-page-scope.js +0 -4
- package/helpers/translation-format.d.ts +6 -0
- package/helpers/translation-format.js +15 -8
- package/package.json +2 -2
- package/plugins/runtime/phi-slot-child-frame-view.js +2 -1
- package/plugins/runtime/phi-slot-child-viewport-effects-observer.js +1 -1
- package/plugins/runtime-modules/admin/forms.js +1 -1
- package/plugins/runtime-modules/admin/trees/phi-default-admin-settings-page-tree.js +2 -5
- package/plugins/runtime-modules/app/forms.js +1 -1
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +2 -6
- package/plugins/runtime-modules/asset/metadata-form.js +2 -6
- package/plugins/runtime-modules/asset/settings-forms.js +1 -1
- package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +2 -5
- package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +2 -6
- package/plugins/runtime-modules/asset/widgets/area-upload/server.js +2 -6
- package/plugins/runtime-modules/asset/widgets/image-inspector/authoring.js +1 -3
- package/plugins/runtime-modules/asset/widgets/image-inspector/server.js +2 -6
- package/plugins/runtime-modules/asset/widgets.js +5 -7
- package/plugins/runtime-modules/auth/admin-settings-forms.js +1 -1
- package/plugins/runtime-modules/auth/ids.d.ts +7 -7
- package/plugins/runtime-modules/auth/ids.js +7 -7
- package/plugins/runtime-modules/auth/trees/phi-auth-area-overlay-tree.server.js +2 -6
- package/plugins/runtime-modules/auth/trees/phi-default-admin-auth-settings-page-tree.js +2 -5
- package/plugins/runtime-modules/auth/widgets.d.ts +1 -2
- package/plugins/runtime-modules/auth/widgets.js +5 -7
- package/plugins/runtime-modules/avatar/overlay-tree.server.js +2 -6
- package/plugins/runtime-modules/avatar/widgets/account-avatar/server.js +2 -6
- package/plugins/runtime-modules/avatar/widgets/account-avatar-picker/server.js +2 -6
- package/plugins/runtime-modules/avatar/widgets.js +3 -5
- package/plugins/runtime-modules/builder/clients/pages-workspace.d.ts +2 -3
- package/plugins/runtime-modules/builder/clients/pages-workspace.js +5 -18
- package/plugins/runtime-modules/builder/controller/draft-command-controller.js +1 -0
- package/plugins/runtime-modules/builder/controller/page-controller.js +1 -1
- package/plugins/runtime-modules/builder/controller/server-definition.js +3 -11
- package/plugins/runtime-modules/builder/controller/workspace-controller.js +2 -6
- package/plugins/runtime-modules/builder/developer-workspace-store.d.ts +2 -8
- package/plugins/runtime-modules/builder/developer-workspace-store.js +24 -44
- package/plugins/runtime-modules/builder/developer-workspace-types.d.ts +0 -5
- package/plugins/runtime-modules/builder/edit-scaffold-drawer.js +2 -1
- package/plugins/runtime-modules/builder/inspector-section-widget.js +6 -31
- package/plugins/runtime-modules/builder/navigation-persistence.js +12 -3
- package/plugins/runtime-modules/builder/page-meta-form.js +4 -12
- package/plugins/runtime-modules/builder/page-presets.server.d.ts +0 -1
- package/plugins/runtime-modules/builder/page-presets.server.js +0 -24
- package/plugins/runtime-modules/builder/pages-workspace.js +6 -16
- package/plugins/runtime-modules/builder/persistence.d.ts +6 -4
- package/plugins/runtime-modules/builder/persistence.js +6 -7
- package/plugins/runtime-modules/builder/shells-workspace.js +3 -11
- package/plugins/runtime-modules/builder/signal-wiring-form.js +3 -7
- package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +2 -6
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +6 -26
- package/plugins/runtime-modules/builder/trees/phi-default-builder-settings-page-tree.js +2 -6
- package/plugins/runtime-modules/builder/widgets/developer-builder-pages-header/plugin.js +2 -6
- package/plugins/runtime-modules/builder/widgets/inspector-header/plugin.js +2 -6
- package/plugins/runtime-modules/builder/widgets/structure-region/built-in.js +3 -2
- package/plugins/runtime-modules/builder/widgets/structure-region/plugin.js +1 -6
- package/plugins/runtime-modules/builder/widgets.js +10 -12
- package/plugins/runtime-modules/contracts.d.ts +15 -1
- package/plugins/runtime-modules/contracts.js +10 -0
- package/plugins/runtime-modules/core/messaging/forms.js +1 -1
- package/plugins/runtime-modules/core/widgets/description/server.js +12 -9
- package/plugins/runtime-modules/core/widgets/dimension/plugin.js +2 -6
- package/plugins/runtime-modules/core/widgets/draft-status/plugin.js +2 -6
- package/plugins/runtime-modules/core/widgets/entry-list/config.js +2 -9
- package/plugins/runtime-modules/core/widgets/entry-list/view.server.js +1 -1
- package/plugins/runtime-modules/core/widgets/form-preview/client.js +2 -15
- package/plugins/runtime-modules/core/widgets/gallery/server.js +2 -6
- package/plugins/runtime-modules/core/widgets/image/server.js +2 -6
- package/plugins/runtime-modules/core/widgets/length/plugin.js +2 -6
- package/plugins/runtime-modules/core/widgets/markdown-toc/plugin.js +2 -6
- package/plugins/runtime-modules/core/widgets/page-title/server.js +2 -6
- package/plugins/runtime-modules/core/widgets/pagination/config.js +4 -8
- package/plugins/runtime-modules/core/widgets/search-results/config.js +2 -8
- package/plugins/runtime-modules/core/widgets/sidebar-navigation/server.d.ts +2 -2
- package/plugins/runtime-modules/core/widgets/sidebar-navigation/server.js +8 -13
- package/plugins/runtime-modules/core/widgets/theme-mode-switch/server.js +2 -6
- package/plugins/runtime-modules/core/widgets/thread-conversation/client.js +16 -31
- package/plugins/runtime-modules/core/widgets/timeline/client.js +9 -4
- package/plugins/runtime-modules/core/widgets/tour-button/server.js +2 -6
- package/plugins/runtime-modules/core/widgets.js +59 -61
- package/plugins/runtime-modules/dashboard/clients/dashboard-card-view.js +7 -5
- package/plugins/runtime-modules/dashboard/trees/phi-default-admin-dashboard-page-tree.js +2 -6
- package/plugins/runtime-modules/dashboard/trees/phi-default-area-dashboard-page-tree.js +2 -6
- package/plugins/runtime-modules/dashboard/trees/phi-default-builder-dashboard-page-tree.js +2 -6
- package/plugins/runtime-modules/descriptor-compiler.js +6 -6
- package/plugins/runtime-modules/groups/controller/client.d.ts +0 -56
- package/plugins/runtime-modules/groups/controller/client.js +1 -1
- package/plugins/runtime-modules/groups/forms.js +1 -5
- package/plugins/runtime-modules/groups/trees/phi-default-admin-groups-page-tree.js +2 -6
- package/plugins/runtime-modules/groups/trees/phi-default-app-groups-page-tree.js +2 -6
- package/plugins/runtime-modules/localization/forms.js +2 -6
- package/plugins/runtime-modules/localization/services/options.js +19 -9
- package/plugins/runtime-modules/localization/trees/phi-default-admin-locales-page-tree.js +3 -11
- package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +3 -11
- package/plugins/runtime-modules/observability/trees/phi-default-admin-logs-page-tree.js +3 -11
- package/plugins/runtime-modules/revisions/forms.js +1 -1
- package/plugins/runtime-modules/revisions/services/table.js +6 -2
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +2 -2
- package/plugins/runtime-modules/theme/controller/server-definition.js +2 -6
- package/plugins/runtime-modules/theme/trees/phi-default-builder-theme-page-tree.js +2 -6
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +17 -21
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.d.ts +0 -2
- package/plugins/runtime-modules/theme/widgets/brand-controls/config.js +0 -8
- package/plugins/runtime-modules/theme/widgets.js +6 -8
- package/plugins/runtime-modules/threads/controller/client.d.ts +0 -78
- package/plugins/runtime-modules/threads/controller/client.js +1 -1
- package/plugins/runtime-modules/threads/forms.js +1 -1
- package/plugins/runtime-modules/threads/ids.d.ts +0 -1
- package/plugins/runtime-modules/threads/ids.js +0 -2
- package/plugins/runtime-modules/user-management/controller/client.d.ts +0 -73
- package/plugins/runtime-modules/user-management/controller/client.js +1 -1
- package/plugins/runtime-modules/user-management/forms.js +1 -5
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +2 -6
- package/plugins/runtime-modules/video/widgets.js +2 -4
- package/server-helpers/cms-request.d.ts +19 -0
- package/server-helpers/cms-request.js +26 -8
- package/server-helpers/cms-root.js +6 -8
- package/server-helpers/public-login-route.js +6 -8
- package/server-helpers/runtime.js +1 -0
- package/server-helpers/search-index.js +58 -27
- package/types/length.js +8 -3
- package/types/site-config.d.ts +6 -0
- package/types/widget-runtime.d.ts +2 -0
- package/types.d.ts +5 -3
- package/types.js +3 -0
|
@@ -3,15 +3,17 @@ import { createHash } from "node:crypto";
|
|
|
3
3
|
import { PHI_SEARCH_MAX_DOCUMENTS } from "@phis/contracts/search";
|
|
4
4
|
import { resolvePhiCmsPageRedirect } from "../components/cms/phi-cms-page-redirect";
|
|
5
5
|
import { getSiteAreaWithPublishedPages } from "../gateway/site-area";
|
|
6
|
+
import { getResolvedSiteConfig } from "../gateway/site-config";
|
|
6
7
|
import { onPhiSiteReadMarker } from "../gateway/site-read-marker-listeners";
|
|
7
8
|
import { fetchPhiSiteSearchIndexStates, putPhiSiteSearchIndexSet } from "../gateway/site-search";
|
|
8
|
-
import {
|
|
9
|
+
import { buildPhiRuntimeModuleAccessRegistry, filterPhiCmsRenderableTreeForViewer, } from "../helpers/cms-access-policy";
|
|
9
10
|
import { collectPhiSitemapCandidates } from "../helpers/phi-seo";
|
|
10
|
-
import {
|
|
11
|
+
import { resolvePhiCmsAreaShellPresetBinding, resolvePhiCmsDescriptorCatalog, } from "../plugins/runtime-modules/descriptor-compiler";
|
|
11
12
|
import { resolvePhiCmsAreaRuntimeModuleScope } from "../components/cms/phi-cms-runtime-registry";
|
|
12
13
|
import { canPhiViewerAccess } from "../types/access";
|
|
13
14
|
import { resolvePhiCmsLookup } from "./cms-lookup";
|
|
14
|
-
import {
|
|
15
|
+
import { resolvePhiAreaRouteScope } from "./cms-request";
|
|
16
|
+
import { runWithPhiRequestRuntime } from "./request-runtime";
|
|
15
17
|
import { loadPhiSiteRequestContext } from "./runtime";
|
|
16
18
|
import { joinPhiSearchText } from "./search-text";
|
|
17
19
|
/**
|
|
@@ -41,7 +43,7 @@ const PHI_SEARCH_INDEX_DEBOUNCE_MS = 2_000;
|
|
|
41
43
|
* What the extraction is, named in the fingerprint: a change in how documents are built reindexes every
|
|
42
44
|
* Site on its next start, which the published revisions alone would not do.
|
|
43
45
|
*/
|
|
44
|
-
const PHI_SEARCH_INDEX_FORMAT =
|
|
46
|
+
const PHI_SEARCH_INDEX_FORMAT = 2;
|
|
45
47
|
const REGISTRY_KEY = Symbol.for("phis-ui.search-index");
|
|
46
48
|
function readRegistry() {
|
|
47
49
|
const holder = globalThis;
|
|
@@ -161,6 +163,8 @@ async function indexArea({ area, bridge, credentials, heldFingerprint, }) {
|
|
|
161
163
|
const areaMask = area === "public" ? 1 : 2;
|
|
162
164
|
// The Site's languages and its server, read once as the anonymous reader; the locale is per set.
|
|
163
165
|
const anonymous = await loadPhiSiteRequestContext(siteKey, "", "", apiBaseUrl, internalToken);
|
|
166
|
+
// The Site config's change markers, from the same answer the context above was built from.
|
|
167
|
+
const { readMarker, translationMarkers } = await getResolvedSiteConfig({ apiBaseUrl, internalToken, siteKey });
|
|
164
168
|
const locales = anonymous.site.availableLocales.map((option) => option.code);
|
|
165
169
|
const { area: areaPreset, publishedPages } = await getSiteAreaWithPublishedPages({
|
|
166
170
|
apiBaseUrl,
|
|
@@ -170,18 +174,24 @@ async function indexArea({ area, bridge, credentials, heldFingerprint, }) {
|
|
|
170
174
|
sourcePreset,
|
|
171
175
|
area,
|
|
172
176
|
});
|
|
173
|
-
const activeModuleIds
|
|
174
|
-
|
|
177
|
+
const { activeModuleIds, routeTable } = resolvePhiAreaRouteScope({
|
|
178
|
+
runtimeModuleCatalog: bridge.runtimeModuleCatalog,
|
|
175
179
|
catalog,
|
|
176
180
|
area,
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
landingSelection: readPhiAreaLandingSelection(areaPreset?.preset.preset.config),
|
|
181
|
+
preset: areaPreset?.preset ?? null,
|
|
182
|
+
serverCapabilities: anonymous.serverCapabilities,
|
|
180
183
|
});
|
|
181
184
|
const candidates = collectPhiSitemapCandidates({
|
|
182
185
|
moduleRoutes: [...routeTable.exactByPath].map(([path, descriptor]) => [path, descriptor]),
|
|
183
186
|
publishedPages,
|
|
184
187
|
});
|
|
188
|
+
/*
|
|
189
|
+
* The read marker and the translation markers are in here because what a Page says is not only its
|
|
190
|
+
* structure: a Widget bound to content reads the content's published version, and every text is
|
|
191
|
+
* translated. Publishing content moves the read marker (the Site's publish triggers), correcting a
|
|
192
|
+
* translation moves a translation marker, and without them here either left the old words in the
|
|
193
|
+
* index. The price is a run per published change, which is what SEARCH.md promises.
|
|
194
|
+
*/
|
|
185
195
|
const fingerprint = createHash("sha256").update(JSON.stringify({
|
|
186
196
|
format: PHI_SEARCH_INDEX_FORMAT,
|
|
187
197
|
area,
|
|
@@ -189,6 +199,8 @@ async function indexArea({ area, bridge, credentials, heldFingerprint, }) {
|
|
|
189
199
|
areaPreset: areaPreset?.preset ?? null,
|
|
190
200
|
activeModuleIds: [...activeModuleIds].sort(),
|
|
191
201
|
locales,
|
|
202
|
+
readMarker,
|
|
203
|
+
translationMarkers,
|
|
192
204
|
})).digest("hex");
|
|
193
205
|
// The Area's Module scope as the live render resolves it: the preset's selection, the locked ones implied.
|
|
194
206
|
const { moduleSet } = await resolvePhiCmsAreaRuntimeModuleScope({
|
|
@@ -197,6 +209,8 @@ async function indexArea({ area, bridge, credentials, heldFingerprint, }) {
|
|
|
197
209
|
areaPreset: areaPreset?.preset ?? null,
|
|
198
210
|
serverCapabilities: anonymous.serverCapabilities,
|
|
199
211
|
});
|
|
212
|
+
// The same access registry the live render filters a Page's tree with (phi-cms-page-render-scope.tsx).
|
|
213
|
+
const accessRegistry = buildPhiRuntimeModuleAccessRegistry(moduleSet);
|
|
200
214
|
const plugins = new Map();
|
|
201
215
|
const loadPlugin = (type) => {
|
|
202
216
|
let pending = plugins.get(type);
|
|
@@ -218,7 +232,7 @@ async function indexArea({ area, bridge, credentials, heldFingerprint, }) {
|
|
|
218
232
|
if (heldFingerprint(areaMask, locale) === fingerprint)
|
|
219
233
|
continue;
|
|
220
234
|
const context = asIndexingReader(await loadPhiSiteRequestContext(siteKey, locale, "", apiBaseUrl, internalToken), area);
|
|
221
|
-
const documents = await readDocuments({ bridge, area, locale, context, candidates, loadPlugin });
|
|
235
|
+
const documents = await readDocuments({ bridge, area, locale, context, candidates, loadPlugin, accessRegistry });
|
|
222
236
|
const answer = await putPhiSiteSearchIndexSet({
|
|
223
237
|
...credentials,
|
|
224
238
|
area,
|
|
@@ -233,7 +247,7 @@ async function indexArea({ area, bridge, credentials, heldFingerprint, }) {
|
|
|
233
247
|
console.info(`[phis-ui] Search index ${area}/${locale}: ${answer.accepted ? `${answer.state.documentCount} documents written` : "already held"}.`);
|
|
234
248
|
}
|
|
235
249
|
}
|
|
236
|
-
async function readDocuments({ bridge, area, locale, context, candidates, loadPlugin, }) {
|
|
250
|
+
async function readDocuments({ bridge, area, locale, context, candidates, loadPlugin, accessRegistry, }) {
|
|
237
251
|
const documents = new Array(candidates.length).fill(null);
|
|
238
252
|
let next = 0;
|
|
239
253
|
async function work() {
|
|
@@ -241,7 +255,7 @@ async function readDocuments({ bridge, area, locale, context, candidates, loadPl
|
|
|
241
255
|
const index = next++;
|
|
242
256
|
const path = candidates[index].path;
|
|
243
257
|
try {
|
|
244
|
-
documents[index] = await readDocument({ bridge, area, locale, context, path, loadPlugin });
|
|
258
|
+
documents[index] = await readDocument({ bridge, area, locale, context, path, loadPlugin, accessRegistry });
|
|
245
259
|
}
|
|
246
260
|
catch (error) {
|
|
247
261
|
console.error(`[phis-ui] The search index could not read ${area}:${path} (${locale}).`, error);
|
|
@@ -256,9 +270,11 @@ async function readDocuments({ bridge, area, locale, context, candidates, loadPl
|
|
|
256
270
|
/**
|
|
257
271
|
* One Page as a document, or `null` where a reader of this Area would not get one: nothing resolves
|
|
258
272
|
* there, it forwards, it asked to stay out of the index, or its access policy is narrower than the
|
|
259
|
-
* reader's. The words are the Page's title and description and every Widget's own answer, in tree order
|
|
273
|
+
* reader's. The words are the Page's title and description and every Widget's own answer, in tree order
|
|
274
|
+
* -- of the Widgets this reader would see: a Layout or Widget with a narrower policy than the Page's is
|
|
275
|
+
* left out here as the live render leaves it out, so its words never reach a reader it is hidden from.
|
|
260
276
|
*/
|
|
261
|
-
async function readDocument({ bridge, area, locale, context, path, loadPlugin, }) {
|
|
277
|
+
async function readDocument({ bridge, area, locale, context, path, loadPlugin, accessRegistry, }) {
|
|
262
278
|
const resolved = await resolvePhiCmsLookup({
|
|
263
279
|
bridge,
|
|
264
280
|
area,
|
|
@@ -276,20 +292,35 @@ async function readDocument({ bridge, area, locale, context, path, loadPlugin, }
|
|
|
276
292
|
return null;
|
|
277
293
|
if (!canPhiViewerAccess(resolved.runtime.viewer, page.accessPolicy))
|
|
278
294
|
return null;
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
295
|
+
/*
|
|
296
|
+
* The Widgets answer inside a request scope of their own. `searchText` is given the runtime, but the
|
|
297
|
+
* shared server helpers a Widget reaches for -- the translation of its texts first of all -- read the
|
|
298
|
+
* request runtime from the scope, and the indexer runs where no request is: at start-up, or on a
|
|
299
|
+
* timer after a publish. Without this scope every Widget that translates fails and a Page is indexed
|
|
300
|
+
* by title and description alone, which is what the first production index was.
|
|
301
|
+
*/
|
|
302
|
+
const visible = filterPhiCmsRenderableTreeForViewer({
|
|
303
|
+
tree: resolved.page,
|
|
304
|
+
viewer: resolved.runtime.viewer,
|
|
305
|
+
registry: accessRegistry,
|
|
306
|
+
});
|
|
307
|
+
const lines = await runWithPhiRequestRuntime(resolved.runtime, async () => {
|
|
308
|
+
const collected = [];
|
|
309
|
+
for (const widget of visible.contentWidgets) {
|
|
310
|
+
const plugin = await loadPlugin(widget.widgetType);
|
|
311
|
+
if (!plugin?.searchText)
|
|
312
|
+
continue;
|
|
313
|
+
try {
|
|
314
|
+
const config = plugin.parseConfig(widget.config);
|
|
315
|
+
collected.push(...await plugin.searchText({ widget, config, runtime: resolved.runtime }));
|
|
316
|
+
}
|
|
317
|
+
catch (error) {
|
|
318
|
+
// One Widget that cannot say its words costs the Page those words, not the Page.
|
|
319
|
+
console.error(`[phis-ui] The search index could not read the Widget "${widget.widgetType}" on ${area}:${path}.`, error);
|
|
320
|
+
}
|
|
291
321
|
}
|
|
292
|
-
|
|
322
|
+
return collected;
|
|
323
|
+
});
|
|
293
324
|
return {
|
|
294
325
|
path: page.path,
|
|
295
326
|
title: resolved.runtime.page?.title ?? "",
|
package/types/length.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export const PHI_CSS_LENGTH_UNITS = ["px", "%", "em", "rem", "vw", "vh"];
|
|
2
2
|
const CSS_LENGTH_PATTERN = /^([+-]?(?:\d+(?:\.\d+)?|\.\d+))(px|%|em|rem|vw|vh)$/;
|
|
3
|
+
const BARE_NUMBER_PATTERN = /^[+-]?(?:\d+(?:\.\d+)?|\.\d+)$/;
|
|
3
4
|
export function readPhiCssLengthPart(value) {
|
|
4
5
|
if (typeof value === "number") {
|
|
5
6
|
return Number.isFinite(value) ? { value, unit: "px" } : null;
|
|
@@ -8,9 +9,13 @@ export function readPhiCssLengthPart(value) {
|
|
|
8
9
|
return null;
|
|
9
10
|
}
|
|
10
11
|
const trimmed = value.trim();
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
// `Number("")` is 0 and `Number("0x1f")` is 31: a field emptied in the Inspector read as "0px", and a
|
|
13
|
+
// hex literal as a length. Only a decimal, with or without a unit, is one.
|
|
14
|
+
if (!trimmed) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
if (BARE_NUMBER_PATTERN.test(trimmed)) {
|
|
18
|
+
return { value: Number(trimmed), unit: "px" };
|
|
14
19
|
}
|
|
15
20
|
const match = CSS_LENGTH_PATTERN.exec(trimmed);
|
|
16
21
|
if (!match) {
|
package/types/site-config.d.ts
CHANGED
|
@@ -73,6 +73,12 @@ export type PhiSiteConfig = {
|
|
|
73
73
|
* language a visitor is shown first, which is `defaultLocale` and may differ.
|
|
74
74
|
*/
|
|
75
75
|
sourceLocale: string;
|
|
76
|
+
/**
|
|
77
|
+
* The IANA zone every date and time of the Site is shown in (`phis site set --time-zone`). One zone
|
|
78
|
+
* for the server render and the browser: both format the same instant with it, so the text a page
|
|
79
|
+
* is hydrated against is the text the reader sees. Neither the host's zone nor the reader's.
|
|
80
|
+
*/
|
|
81
|
+
timeZone: string;
|
|
76
82
|
availableLocales: PhiSiteLocaleOption[];
|
|
77
83
|
/** What each served locale means, so a request naming one is resolved without asking Core. */
|
|
78
84
|
localeCapabilities: PhiLocaleCapability[];
|
|
@@ -24,6 +24,8 @@ export type PhiBlockRuntimeSite = {
|
|
|
24
24
|
defaultLocale: string;
|
|
25
25
|
/** The language the Site's own words are written in (`PhiSiteConfig.sourceLocale`). */
|
|
26
26
|
sourceLocale: string;
|
|
27
|
+
/** The IANA zone the Site's dates and times are shown in (`PhiSiteConfig.timeZone`). */
|
|
28
|
+
timeZone: string;
|
|
27
29
|
store: {
|
|
28
30
|
enabled: boolean;
|
|
29
31
|
};
|
package/types.d.ts
CHANGED
|
@@ -3,9 +3,11 @@ export * from "./types/cms-overlay";
|
|
|
3
3
|
export type * from "./types/cms-container";
|
|
4
4
|
export * from "./types/cms-instance-id";
|
|
5
5
|
export { type PhiCmsAreaDefinition, type PhiCmsAreaOverlayPresetDescriptor, type PhiCmsAreaShellCompositionSource, type PhiCmsAreaShellPresetBinding, type PhiCmsAreaShellPresetDescriptor, type PhiCmsDescriptorBuildContext, type PhiCmsNavigationAnchor, type PhiCmsNavigationAnchoredInjectionDescriptor, type PhiCmsNavigationAnchorPlacement, type PhiCmsNavigationBaseItemDescriptor, type PhiCmsNavigationCustomItem, type PhiCmsNavigationFolder, type PhiCmsNavigationFolderTarget, type PhiCmsNavigationInjectionDescriptor, type PhiCmsNavigationInjectionItemDescriptor, type PhiCmsNavigationItemOverride, type PhiCmsNavigationItemPlacement, type PhiCmsNavigationItemStanding, type PhiCmsNavigationKeyedInjectionDescriptor, type PhiCmsNavigationLabel, type PhiCmsNavigationSurfaceDescriptor, type PhiCmsPresetIdentity, type PhiCmsPresetSource, type PhiCmsRoutePresetBinding, type PhiCmsRoutePresetDescriptor, type PhiCmsThemeBlockBinding, type PhiCmsThemeBlockDescriptor, type PhiCmsThemeBlockKind, type PhiCmsThemeDescriptorContribution, type PhiCmsThemePresetBinding, type PhiCmsThemePresetDescriptor, type PhiRuntimeModuleId, } from "./types/cms-module-descriptors";
|
|
6
|
-
export
|
|
7
|
-
export type {
|
|
8
|
-
export
|
|
6
|
+
export { expandPhiBorderRadiusConfig, mergePhiBorderWidgetConfig, mergePhiCmsConfigValues, mergePhiPaddingWidgetConfig, normalizePhiPaddingWidgetConfig, } from "./types/cms-config";
|
|
7
|
+
export type { PhiCmsBorderWidgetConfig, PhiCmsPaddingWidgetConfig, PhiCmsPluginConfigBase, PhiCmsRenderableBlockConfigBase, } from "./types/cms-config";
|
|
8
|
+
export { readPhiCmsBorderWidgetConfig } from "./types/cms-border-config";
|
|
9
|
+
export { PHI_CMS_BORDER_SOURCES, readPhiCmsBorderSource, resolvePhiCmsBorderSource } from "./types/cms-border-source";
|
|
10
|
+
export type { PhiCmsBorderSource } from "./types/cms-border-source";
|
|
9
11
|
export type * from "./types/renderable-block";
|
|
10
12
|
export * from "./types/layout-style";
|
|
11
13
|
export * from "./types/control";
|
package/types.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export * from "./types/cms-overlay";
|
|
2
2
|
export * from "./types/cms-instance-id";
|
|
3
3
|
export {} from "./types/cms-module-descriptors";
|
|
4
|
+
export { expandPhiBorderRadiusConfig, mergePhiBorderWidgetConfig, mergePhiCmsConfigValues, mergePhiPaddingWidgetConfig, normalizePhiPaddingWidgetConfig, } from "./types/cms-config";
|
|
5
|
+
export { readPhiCmsBorderWidgetConfig } from "./types/cms-border-config";
|
|
6
|
+
export { PHI_CMS_BORDER_SOURCES, readPhiCmsBorderSource, resolvePhiCmsBorderSource } from "./types/cms-border-source";
|
|
4
7
|
export * from "./types/layout-style";
|
|
5
8
|
export * from "./types/control";
|
|
6
9
|
export * from "./types/calendar";
|