@phis/ui 0.8.1 → 0.8.2

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 (77) hide show
  1. package/README.md +9 -2
  2. package/components/controls/phi-table-control.js +3 -3
  3. package/components/media/media-upload-flow.d.ts +62 -5
  4. package/components/media/media-upload-flow.js +62 -24
  5. package/components/media/phi-area-upload-widget.d.ts +44 -1
  6. package/components/media/phi-area-upload-widget.js +32 -7
  7. package/components/media/phi-media-upload.d.ts +10 -3
  8. package/components/media/phi-media-upload.js +11 -8
  9. package/components/shell/phi-widget-icon.js +1 -0
  10. package/components/widgets/client/html-editor-link-node.d.ts +12 -0
  11. package/components/widgets/client/html-editor-link-node.js +60 -0
  12. package/components/widgets/client/html-editor.js +10 -6
  13. package/components/widgets/client/shared/phi-collection-view-binding.js +33 -26
  14. package/constants/cms-widget-types.d.ts +1 -0
  15. package/constants/cms-widget-types.js +3 -0
  16. package/constants/runtime-module-ownership.js +1 -0
  17. package/gateway/site-proxy.d.ts +12 -0
  18. package/gateway/site-proxy.js +20 -0
  19. package/net/phi-next-proxy.d.ts +7 -0
  20. package/net/phi-next-proxy.js +1 -1
  21. package/package.json +27 -14
  22. package/plugins/runtime-modules/area-contributions/admin.d.ts +1 -1
  23. package/plugins/runtime-modules/area-contributions/admin.js +2 -0
  24. package/plugins/runtime-modules/avatar/addresses.d.ts +1 -1
  25. package/plugins/runtime-modules/cdn/authoring-widgets.d.ts +3 -0
  26. package/plugins/runtime-modules/cdn/authoring-widgets.js +7 -0
  27. package/plugins/runtime-modules/cdn/authoring.d.ts +1 -0
  28. package/plugins/runtime-modules/cdn/authoring.js +8 -0
  29. package/plugins/runtime-modules/cdn/bytes.d.ts +5 -0
  30. package/plugins/runtime-modules/cdn/bytes.js +17 -0
  31. package/plugins/runtime-modules/cdn/client-data-providers.d.ts +7 -0
  32. package/plugins/runtime-modules/cdn/client-data-providers.js +9 -0
  33. package/plugins/runtime-modules/cdn/data-providers.d.ts +134 -0
  34. package/plugins/runtime-modules/cdn/data-providers.js +117 -0
  35. package/plugins/runtime-modules/cdn/definition.d.ts +140 -0
  36. package/plugins/runtime-modules/cdn/definition.js +23 -0
  37. package/plugins/runtime-modules/cdn/ids.d.ts +18 -0
  38. package/plugins/runtime-modules/cdn/ids.js +20 -0
  39. package/plugins/runtime-modules/cdn/module.d.ts +131 -0
  40. package/plugins/runtime-modules/cdn/module.js +4 -0
  41. package/plugins/runtime-modules/cdn/platform.d.ts +25 -0
  42. package/plugins/runtime-modules/cdn/platform.js +73 -0
  43. package/plugins/runtime-modules/cdn/presets.d.ts +2 -0
  44. package/plugins/runtime-modules/cdn/presets.js +20 -0
  45. package/plugins/runtime-modules/cdn/server.d.ts +1 -0
  46. package/plugins/runtime-modules/cdn/server.js +14 -0
  47. package/plugins/runtime-modules/cdn/services/table.d.ts +11 -0
  48. package/plugins/runtime-modules/cdn/services/table.js +296 -0
  49. package/plugins/runtime-modules/cdn/services/upload.d.ts +20 -0
  50. package/plugins/runtime-modules/cdn/services/upload.js +146 -0
  51. package/plugins/runtime-modules/cdn/table-params.d.ts +10 -0
  52. package/plugins/runtime-modules/cdn/table-params.js +10 -0
  53. package/plugins/runtime-modules/cdn/trees/admin-cdn-label-set.d.ts +95 -0
  54. package/plugins/runtime-modules/cdn/trees/admin-cdn-label-set.js +156 -0
  55. package/plugins/runtime-modules/cdn/trees/phi-default-admin-cdn-page-tree.d.ts +18 -0
  56. package/plugins/runtime-modules/cdn/trees/phi-default-admin-cdn-page-tree.js +479 -0
  57. package/plugins/runtime-modules/cdn/widgets/upload/client.d.ts +12 -0
  58. package/plugins/runtime-modules/cdn/widgets/upload/client.js +138 -0
  59. package/plugins/runtime-modules/cdn/widgets/upload/config.d.ts +29 -0
  60. package/plugins/runtime-modules/cdn/widgets/upload/config.js +43 -0
  61. package/plugins/runtime-modules/cdn/widgets/upload/label-types.d.ts +24 -0
  62. package/plugins/runtime-modules/cdn/widgets/upload/label-types.js +1 -0
  63. package/plugins/runtime-modules/cdn/widgets/upload/labels.d.ts +4 -0
  64. package/plugins/runtime-modules/cdn/widgets/upload/labels.js +72 -0
  65. package/plugins/runtime-modules/cdn/widgets/upload/plugin.d.ts +3 -0
  66. package/plugins/runtime-modules/cdn/widgets/upload/plugin.js +7 -0
  67. package/plugins/runtime-modules/cdn/widgets/upload/server.d.ts +8 -0
  68. package/plugins/runtime-modules/cdn/widgets/upload/server.js +17 -0
  69. package/plugins/runtime-modules/cdn/widgets.d.ts +2 -0
  70. package/plugins/runtime-modules/cdn/widgets.js +13 -0
  71. package/plugins/runtime-modules/client-authoring-providers/admin.d.ts +1 -1
  72. package/plugins/runtime-modules/client-authoring-providers/admin.js +6 -0
  73. package/plugins/runtime-modules/client-manifests/admin.js +11 -1
  74. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +1 -1
  75. package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.js +3 -1
  76. package/plugins/runtime-modules/core/widgets/table/client.js +6 -4
  77. package/types/table-widget.d.ts +2 -2
@@ -0,0 +1,60 @@
1
+ import { LinkNode } from "@lexical/link";
2
+ import { $applyNodeReplacement } from "lexical";
3
+ import { createPhiPageUri, readPhiInternalReference } from "../../../types/references";
4
+ /** Keeps Page identity in authoring HTML; only the server render resolves it to an address. */
5
+ export class PhiHtmlLinkNode extends LinkNode {
6
+ static getType() {
7
+ return "phi-html-link";
8
+ }
9
+ static clone(node) {
10
+ return new PhiHtmlLinkNode(node.__url, {
11
+ rel: node.__rel,
12
+ target: node.__target,
13
+ title: node.__title,
14
+ }, node.__key);
15
+ }
16
+ static importJSON(serializedNode) {
17
+ return $applyNodeReplacement(new PhiHtmlLinkNode()).updateFromJSON(serializedNode);
18
+ }
19
+ static importDOM() {
20
+ return {
21
+ a: () => ({
22
+ priority: 2,
23
+ conversion: (element) => {
24
+ if (!(element instanceof HTMLAnchorElement))
25
+ return null;
26
+ return {
27
+ node: $applyNodeReplacement(new PhiHtmlLinkNode(element.getAttribute("href") ?? "", {
28
+ rel: element.getAttribute("rel"),
29
+ target: element.getAttribute("target"),
30
+ title: element.getAttribute("title"),
31
+ })),
32
+ };
33
+ },
34
+ }),
35
+ };
36
+ }
37
+ sanitizeUrl(url) {
38
+ const reference = readPhiInternalReference(url);
39
+ if (reference?.kind === "page") {
40
+ try {
41
+ if (createPhiPageUri(reference.reference, reference.fragment) === url)
42
+ return url;
43
+ }
44
+ catch {
45
+ // A malformed Unicode fragment cannot be emitted by the canonical factory.
46
+ }
47
+ }
48
+ return super.sanitizeUrl(url);
49
+ }
50
+ }
51
+ /** Factories, commands and imports must all create the same node, including LinkNode transforms. */
52
+ export const PHI_HTML_LINK_NODE_REPLACEMENT = {
53
+ replace: LinkNode,
54
+ with: (node) => new PhiHtmlLinkNode(node.getURL(), {
55
+ rel: node.getRel(),
56
+ target: node.getTarget(),
57
+ title: node.getTitle(),
58
+ }),
59
+ withKlass: PhiHtmlLinkNode,
60
+ };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useEffect, useEffectEvent, useId, useMemo, useRef, } from "react";
4
- import { $createParagraphNode, $getRoot, $getSelection, $isElementNode, $isRangeSelection, $isRootOrShadowRoot, $insertNodes, BLUR_COMMAND, CAN_REDO_COMMAND, CAN_UNDO_COMMAND, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_LOW, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, REDO_COMMAND, SELECTION_CHANGE_COMMAND, UNDO_COMMAND, getStyleObjectFromCSS, configExtension, defineExtension, } from "lexical";
4
+ import { $createParagraphNode, $getRoot, $getSelection, $isElementNode, $isRangeSelection, $isRootOrShadowRoot, $insertNodes, BLUR_COMMAND, CAN_REDO_COMMAND, CAN_UNDO_COMMAND, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_LOW, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, REDO_COMMAND, UNDO_COMMAND, getStyleObjectFromCSS, configExtension, defineExtension, } from "lexical";
5
5
  import { $generateHtmlFromNodes, $generateNodesFromDOM } from "@lexical/html";
6
6
  import { TOGGLE_LINK_COMMAND, $isLinkNode } from "@lexical/link";
7
7
  import { $removeList, INSERT_ORDERED_LIST_COMMAND, INSERT_UNORDERED_LIST_COMMAND, ListNode } from "@lexical/list";
@@ -23,6 +23,7 @@ import { resolvePhiWidgetFontSize } from "../helpers/font-size";
23
23
  import { sanitizePhiHtmlWidgetMarkup } from "../helpers/html-content";
24
24
  import { PHI_HTML_WIDGET_EDITOR_EMPTY_STATE, registerPhiHtmlWidgetEditorBridge, } from "../client/html-editor-bridge";
25
25
  import { $createPhiHtmlImageNode, PhiHtmlImageNode } from "./html-editor-image-node";
26
+ import { PhiHtmlLinkNode, PHI_HTML_LINK_NODE_REPLACEMENT } from "./html-editor-link-node";
26
27
  const PHI_HTML_WIDGET_PLACEHOLDER = "Write rich text...";
27
28
  const PHI_HTML_WIDGET_EDITOR_LINE_HEIGHT = 1.7;
28
29
  const PHI_HTML_WIDGET_EDITOR_MIN_CONTENT_HEIGHT = `${PHI_HTML_WIDGET_EDITOR_LINE_HEIGHT}em`;
@@ -356,12 +357,15 @@ function PhiHtmlWidgetEditorBridgePlugin({ blockId, }) {
356
357
  editor.dispatchCommand(REDO_COMMAND, undefined);
357
358
  },
358
359
  });
360
+ /*
361
+ * Every commit reaches the update listener, a selection-only one included, and it reads the state
362
+ * just committed. `SELECTION_CHANGE_COMMAND` is no place for this: since Lexical 0.52 it runs inside
363
+ * the pending update, before reconciliation, where `editor.getEditorState()` is still the previous
364
+ * commit -- the toolbar would show the formats of the caret's last position, one move behind.
365
+ */
359
366
  return mergeRegister(editor.registerUpdateListener(() => {
360
367
  refreshBridgeState();
361
- }), editor.registerCommand(SELECTION_CHANGE_COMMAND, () => {
362
- refreshBridgeState();
363
- return false;
364
- }, COMMAND_PRIORITY_LOW), editor.registerCommand(CAN_UNDO_COMMAND, (canUndo) => {
368
+ }), editor.registerCommand(CAN_UNDO_COMMAND, (canUndo) => {
365
369
  stateRef.current = {
366
370
  ...stateRef.current,
367
371
  canUndo,
@@ -403,7 +407,7 @@ export function PhiHtmlWidgetEditor({ blockId, html, fontFamily, fontSize, onCha
403
407
  LinkExtension,
404
408
  ListExtension,
405
409
  ],
406
- nodes: [PhiHtmlImageNode],
410
+ nodes: [PhiHtmlImageNode, PhiHtmlLinkNode, PHI_HTML_LINK_NODE_REPLACEMENT],
407
411
  init(editorConfig) {
408
412
  editorConfig.namespace = `PhiHtmlWidgetEditor:${editorId}`;
409
413
  editorConfig.onError = (error) => {
@@ -66,38 +66,45 @@ export function usePhiCollectionViewBinding({ source, initialQuery, pageSize, })
66
66
  const abortController = new AbortController();
67
67
  const requestId = ++latestRequestRef.current;
68
68
  const isCurrent = () => !abortController.signal.aborted && requestId === latestRequestRef.current;
69
- const loadingTimer = window.setTimeout(() => {
69
+ let loadingTimer;
70
+ const queryTimer = window.setTimeout(() => {
70
71
  if (abortController.signal.aborted)
71
72
  return;
72
- setLoading(true);
73
73
  setError(null);
74
74
  setQueryError(null);
75
+ // Reset the source first, and only show loading if its answer actually remains pending.
76
+ loadingTimer = window.setTimeout(() => {
77
+ if (isCurrent())
78
+ setLoading(true);
79
+ }, 0);
80
+ void Promise.resolve().then(() => provider.query({
81
+ resourceKey: source.resourceKey,
82
+ query,
83
+ params: source.params,
84
+ locale,
85
+ timeZone,
86
+ signal: abortController.signal,
87
+ })).then((nextData) => {
88
+ if (!isCurrent())
89
+ return;
90
+ setData(nextData);
91
+ setError(nextData.error);
92
+ setQueryError(nextData.error);
93
+ }).catch((nextError) => {
94
+ if (isCurrent()) {
95
+ const message = nextError instanceof Error ? nextError.message : "Collection request failed.";
96
+ setError(message);
97
+ setQueryError(message);
98
+ }
99
+ }).finally(() => {
100
+ window.clearTimeout(loadingTimer);
101
+ // Superseded by an action is still finished loading; only a newer query takes the flag over.
102
+ if (!abortController.signal.aborted)
103
+ setLoading(false);
104
+ });
75
105
  }, 0);
76
- void provider.query({
77
- resourceKey: source.resourceKey,
78
- query,
79
- params: source.params,
80
- locale,
81
- timeZone,
82
- signal: abortController.signal,
83
- }).then((nextData) => {
84
- if (!isCurrent())
85
- return;
86
- setData(nextData);
87
- setError(nextData.error);
88
- setQueryError(nextData.error);
89
- }).catch((nextError) => {
90
- if (isCurrent()) {
91
- const message = nextError instanceof Error ? nextError.message : "Collection request failed.";
92
- setError(message);
93
- setQueryError(message);
94
- }
95
- }).finally(() => {
96
- // Superseded by an action is still finished loading; only a newer query takes the flag over.
97
- if (!abortController.signal.aborted)
98
- setLoading(false);
99
- });
100
106
  return () => {
107
+ window.clearTimeout(queryTimer);
101
108
  window.clearTimeout(loadingTimer);
102
109
  abortController.abort();
103
110
  };
@@ -35,6 +35,7 @@ export declare const PhiCmsWidgetType: {
35
35
  readonly Tree: string;
36
36
  readonly AreaUpload: string;
37
37
  readonly SlotUpload: string;
38
+ readonly CdnUpload: string;
38
39
  readonly ImageInspector: string;
39
40
  readonly AssetFocalRect: string;
40
41
  readonly MediaPicker: string;
@@ -15,6 +15,7 @@ const PHI_CMS_WIDGET_PLUGIN_KEYS = {
15
15
  "auth": `${PHI_CMS_WIDGET_PLUGIN_KEY_BASE}/auth/widgets`,
16
16
  "avatar": `${PHI_CMS_WIDGET_PLUGIN_KEY_BASE}/avatar/widgets`,
17
17
  "builder": `${PHI_CMS_WIDGET_PLUGIN_KEY_BASE}/builder/widgets`,
18
+ "cdn": `${PHI_CMS_WIDGET_PLUGIN_KEY_BASE}/cdn/widgets`,
18
19
  "core": `${PHI_CMS_WIDGET_PLUGIN_KEY_BASE}/core/widgets`,
19
20
  "news": `${PHI_CMS_WIDGET_PLUGIN_KEY_BASE}/news/widgets`,
20
21
  "observability": `${PHI_CMS_WIDGET_PLUGIN_KEY_BASE}/observability/widgets`,
@@ -63,6 +64,7 @@ const PHI_CMS_WIDGET_MODULE_BY_TYPE_KEY = {
63
64
  "builder-widget-viewport-inspector": "builder",
64
65
  "button": "core",
65
66
  "card": "core",
67
+ "cdn-upload": "cdn",
66
68
  "cascader": "core",
67
69
  "checkbox": "core",
68
70
  "checkbox-group": "core",
@@ -166,6 +168,7 @@ export const PhiCmsWidgetType = {
166
168
  Tree: defineWidgetType(resolvePhiCmsWidgetPluginKey("tree"), "tree"),
167
169
  AreaUpload: defineWidgetType(resolvePhiCmsWidgetPluginKey("area-upload"), "area-upload"),
168
170
  SlotUpload: defineWidgetType(resolvePhiCmsWidgetPluginKey("slot-upload"), "slot-upload"),
171
+ CdnUpload: defineWidgetType(resolvePhiCmsWidgetPluginKey("cdn-upload"), "cdn-upload"),
169
172
  ImageInspector: defineWidgetType(resolvePhiCmsWidgetPluginKey("image-inspector"), "image-inspector"),
170
173
  AssetFocalRect: defineWidgetType(resolvePhiCmsWidgetPluginKey("asset-focal-rect"), "asset-focal-rect"),
171
174
  MediaPicker: defineWidgetType(resolvePhiCmsWidgetPluginKey("media-picker"), "media-picker"),
@@ -275,6 +275,7 @@ const PHI_RUNTIME_MODULE_OWNERSHIP = {
275
275
  "tables/builder-navigation": ["builder", "navigation"],
276
276
  "tables/runtime-modules": ["builder", "runtime-modules"],
277
277
  "tables/builder-signal-routes": ["builder", "signal-routes"],
278
+ "tables/cdn": ["cdn", "cdn"],
278
279
  "tables/content": ["core", "content"],
279
280
  "tables/content-entries": ["core", "content-entries"],
280
281
  "tables/content-entry-categories": ["core", "content-entry-categories"],
@@ -15,4 +15,16 @@ export type BuildPhiSiteProxyHandlersOptions = {
15
15
  */
16
16
  loadAreaBridge: PhiSiteAreaBridgeLoader;
17
17
  };
18
+ /**
19
+ * A body on its way to storage through this door, bounded by the browser that sends it and not by the
20
+ * proxy's clock -- on a slow link it takes longer than any timeout that suits a read:
21
+ *
22
+ * - one part of a CDN upload, `PUT /api/site/admin/cdn/uploads/<token>/parts/<n>`, up to 16 MiB that Core
23
+ * streams on to the bucket;
24
+ * - a Media body sent whole (`proxy-stream`, a Space on a Local Storage Profile),
25
+ * `PUT /api/site/media/uploads/<token>`, up to the Site's largest object.
26
+ *
27
+ * Exactly these shapes and this verb: init, report and finalize keep the timeout.
28
+ */
29
+ export declare function isPhiUnboundedSiteRequest(request: Pick<Request, "method">, path: readonly string[] | undefined): boolean;
18
30
  export declare function buildPhiSiteProxyHandlers(options: BuildPhiSiteProxyHandlersOptions): PhiNextProxyHandlers;
@@ -110,6 +110,25 @@ function validatingCmsStructureWrite(handler, loadAreaBridge) {
110
110
  return handler(request, context);
111
111
  };
112
112
  }
113
+ /**
114
+ * A body on its way to storage through this door, bounded by the browser that sends it and not by the
115
+ * proxy's clock -- on a slow link it takes longer than any timeout that suits a read:
116
+ *
117
+ * - one part of a CDN upload, `PUT /api/site/admin/cdn/uploads/<token>/parts/<n>`, up to 16 MiB that Core
118
+ * streams on to the bucket;
119
+ * - a Media body sent whole (`proxy-stream`, a Space on a Local Storage Profile),
120
+ * `PUT /api/site/media/uploads/<token>`, up to the Site's largest object.
121
+ *
122
+ * Exactly these shapes and this verb: init, report and finalize keep the timeout.
123
+ */
124
+ export function isPhiUnboundedSiteRequest(request, path) {
125
+ if (request.method !== "PUT" || !path)
126
+ return false;
127
+ const cdnPart = path.length === 6 &&
128
+ path[0] === "admin" && path[1] === "cdn" && path[2] === "uploads" && path[4] === "parts";
129
+ const mediaBody = path.length === 3 && path[0] === "media" && path[1] === "uploads" && path[2] !== "init";
130
+ return cdnPart || mediaBody;
131
+ }
113
132
  export function buildPhiSiteProxyHandlers(options) {
114
133
  const { upstreamBaseUrl, timeoutMs, buildHeaders, logLabel = "[phis-ui][/api/site proxy]", missingBaseUrlMessage = "Missing apiBaseUrl for /api/site proxy.", } = options;
115
134
  const handlers = PhiNextProxy({
@@ -120,6 +139,7 @@ export function buildPhiSiteProxyHandlers(options) {
120
139
  missingBaseUrlMessage,
121
140
  buildHeaders,
122
141
  buildFetchInit: () => ({ cache: "no-store" }),
142
+ unboundedRequest: isPhiUnboundedSiteRequest,
123
143
  });
124
144
  // Built once per path and kept, so a Site that answers Forms all day pays the import a single time.
125
145
  const built = new Map();
@@ -19,6 +19,13 @@ export type PhiNextProxyConfig = {
19
19
  tags?: string[];
20
20
  };
21
21
  };
22
+ /**
23
+ * A request that may take longer than `timeoutMs` because its body is large, answered `null`: it is
24
+ * bounded by the browser alone -- aborted when the browser goes away (`request.signal`) -- and not
25
+ * by the clock. Every request this does not name keeps `timeoutMs`. A door names only what it must:
26
+ * a part of a CDN upload is 16 MiB on whatever link the person has, and eight seconds cut it.
27
+ */
28
+ unboundedRequest?: (request: NextRequest, path: PhiProxyPath) => boolean;
22
29
  };
23
30
  export type PhiNextProxyHandler = (request: NextRequest, context: PhiNextProxyRouteContext) => Promise<Response>;
24
31
  export type PhiNextProxyHandlers = {
@@ -84,7 +84,7 @@ async function proxyRequest(request, path, config) {
84
84
  ...(hasBody ? { body: request.body, duplex: "half" } : {}),
85
85
  ...(config.buildFetchInit?.(request, path) ?? { cache: "no-store" }),
86
86
  redirect: "manual",
87
- signal: AbortSignal.timeout(config.timeoutMs),
87
+ signal: config.unboundedRequest?.(request, path) ? request.signal : AbortSignal.timeout(config.timeoutMs),
88
88
  });
89
89
  const durationMs = Date.now() - startedAt;
90
90
  if (durationMs >= config.timeoutMs / 2 && targetResponse.ok) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phis/ui",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "license": "Apache-2.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -501,7 +501,7 @@
501
501
  "peerDependencies": {
502
502
  "@ant-design/icons": "^6.3.2",
503
503
  "antd": "^6.7.1",
504
- "next": "^16.2.11",
504
+ "next": "^16.4.6",
505
505
  "react": "^19.2.8",
506
506
  "react-dom": "^19.2.8"
507
507
  },
@@ -512,24 +512,37 @@
512
512
  "@dnd-kit/core": "^6.3.1",
513
513
  "@dnd-kit/sortable": "^10.0.0",
514
514
  "@dnd-kit/utilities": "^3.2.2",
515
- "@iconify/react": "^6.0.2",
516
- "@lexical/history": "0.50.0",
517
- "@lexical/html": "0.50.0",
518
- "@lexical/link": "0.50.0",
519
- "@lexical/list": "0.50.0",
520
- "@lexical/react": "0.50.0",
521
- "@lexical/rich-text": "0.50.0",
522
- "@lexical/selection": "0.50.0",
523
- "@lexical/utils": "0.50.0",
524
- "@phis/contracts": "^0.8.11",
515
+ "@iconify/react": "^6.0.4",
516
+ "@lexical/history": "0.53.0",
517
+ "@lexical/html": "0.53.0",
518
+ "@lexical/link": "0.53.0",
519
+ "@lexical/list": "0.53.0",
520
+ "@lexical/react": "0.53.0",
521
+ "@lexical/rich-text": "0.53.0",
522
+ "@lexical/selection": "0.53.0",
523
+ "@lexical/utils": "0.53.0",
524
+ "@phis/contracts": "^0.8.12",
525
525
  "dayjs": "^1.11.23",
526
526
  "dom-serializer": "^2.0.0",
527
527
  "htmlparser2": "^10.1.0",
528
- "lexical": "0.50.0",
528
+ "lexical": "0.53.0",
529
529
  "remark-gfm": "^4.0.1",
530
530
  "remark-parse": "^11.0.0",
531
- "sanitize-html": "2.17.7",
531
+ "sanitize-html": "2.18.2",
532
532
  "server-only": "^0.0.1",
533
533
  "unified": "^11.0.5"
534
+ },
535
+ "phis": {
536
+ "testedWith": {
537
+ "@ant-design/icons": "6.3.4",
538
+ "@types/node": "26.6.6",
539
+ "@types/react": "19.3.0",
540
+ "@types/react-dom": "19.3.0",
541
+ "antd": "6.7.2",
542
+ "next": "16.4.6",
543
+ "react": "19.3.1",
544
+ "react-dom": "19.3.1",
545
+ "typescript": "6.0.3"
546
+ }
534
547
  }
535
548
  }
@@ -1 +1 @@
1
- export declare const PHI_ADMIN_RUNTIME_MODULE_AREA_CONTRIBUTIONS: readonly [import("../area-contributions").PhiRuntimeModuleServerAreaContribution, import("../area-contributions").PhiRuntimeModuleServerAreaContribution, import("../area-contributions").PhiRuntimeModuleServerAreaContribution, import("../area-contributions").PhiRuntimeModuleServerAreaContribution, import("../area-contributions").PhiRuntimeModuleServerAreaContribution, import("../area-contributions").PhiRuntimeModuleServerAreaContribution, import("../area-contributions").PhiRuntimeModuleServerAreaContribution, import("../area-contributions").PhiRuntimeModuleServerAreaContribution, import("../area-contributions").PhiRuntimeModuleServerAreaContribution, import("../area-contributions").PhiRuntimeModuleServerAreaContribution, import("../area-contributions").PhiRuntimeModuleServerAreaContribution];
1
+ export declare const PHI_ADMIN_RUNTIME_MODULE_AREA_CONTRIBUTIONS: readonly [import("../area-contributions").PhiRuntimeModuleServerAreaContribution, import("../area-contributions").PhiRuntimeModuleServerAreaContribution, import("../area-contributions").PhiRuntimeModuleServerAreaContribution, import("../area-contributions").PhiRuntimeModuleServerAreaContribution, import("../area-contributions").PhiRuntimeModuleServerAreaContribution, import("../area-contributions").PhiRuntimeModuleServerAreaContribution, import("../area-contributions").PhiRuntimeModuleServerAreaContribution, import("../area-contributions").PhiRuntimeModuleServerAreaContribution, import("../area-contributions").PhiRuntimeModuleServerAreaContribution, import("../area-contributions").PhiRuntimeModuleServerAreaContribution, import("../area-contributions").PhiRuntimeModuleServerAreaContribution, import("../area-contributions").PhiRuntimeModuleServerAreaContribution];
@@ -4,6 +4,7 @@ import { createPhiLocalizationRuntimeModuleServerAreaContribution } from "../loc
4
4
  import { createPhiGroupsRuntimeModuleServerAreaContribution } from "../groups/server";
5
5
  import { PHI_USER_MANAGEMENT_RUNTIME_MODULE_SERVER_AREA_CONTRIBUTION } from "../user-management/server";
6
6
  import { PHI_OBSERVABILITY_RUNTIME_MODULE_SERVER_AREA_CONTRIBUTION } from "../observability/server";
7
+ import { PHI_CDN_RUNTIME_MODULE_SERVER_AREA_CONTRIBUTION } from "../cdn/server";
7
8
  import { createPhiAuthRuntimeModuleServerAreaContribution } from "../auth/server";
8
9
  import { PHI_ADMIN_RUNTIME_MODULE_SERVER_AREA_CONTRIBUTION } from "../admin/server";
9
10
  export const PHI_ADMIN_RUNTIME_MODULE_AREA_CONTRIBUTIONS = [
@@ -13,6 +14,7 @@ export const PHI_ADMIN_RUNTIME_MODULE_AREA_CONTRIBUTIONS = [
13
14
  createPhiGroupsRuntimeModuleServerAreaContribution(),
14
15
  createPhiLocalizationRuntimeModuleServerAreaContribution(),
15
16
  PHI_OBSERVABILITY_RUNTIME_MODULE_SERVER_AREA_CONTRIBUTION,
17
+ PHI_CDN_RUNTIME_MODULE_SERVER_AREA_CONTRIBUTION,
16
18
  PHI_USER_MANAGEMENT_RUNTIME_MODULE_SERVER_AREA_CONTRIBUTION,
17
19
  PHI_ADMIN_RUNTIME_MODULE_SERVER_AREA_CONTRIBUTION,
18
20
  ];
@@ -1,7 +1,7 @@
1
1
  export declare const PHI_AVATAR_OVERLAY_IDS: {
2
+ readonly widgetUpload: import("@phis/contracts/cms").PhiCmsInstanceId;
2
3
  readonly layoutBody: import("@phis/contracts/cms").PhiCmsInstanceId;
3
4
  readonly overlayPicker: import("@phis/contracts/cms").PhiCmsInstanceId;
4
- readonly widgetUpload: import("@phis/contracts/cms").PhiCmsInstanceId;
5
5
  readonly widgetPicker: import("@phis/contracts/cms").PhiCmsInstanceId;
6
6
  readonly presetKey: "avatar-app-picker-overlay";
7
7
  };
@@ -0,0 +1,3 @@
1
+ /** The upload has no settings and nothing to draw before a file is chosen, so its definition is all. */
2
+ declare const _default: import("react").ComponentType<import("../client-authoring-widget-module").PhiAuthoringWidgetModuleProps>;
3
+ export default _default;
@@ -0,0 +1,7 @@
1
+ "use client";
2
+ import { PHI_CDN_UPLOAD_WIDGET_DEFINITION } from "./widgets/upload/config";
3
+ import { createPhiAuthoringWidgetModule, definePhiAuthoringWidgetModuleLoader, } from "../client-authoring-widget-module";
4
+ /** The upload has no settings and nothing to draw before a file is chosen, so its definition is all. */
5
+ export default createPhiAuthoringWidgetModule([
6
+ definePhiAuthoringWidgetModuleLoader(PHI_CDN_UPLOAD_WIDGET_DEFINITION, () => Promise.resolve(PHI_CDN_UPLOAD_WIDGET_DEFINITION)),
7
+ ]);
@@ -0,0 +1 @@
1
+ export declare const PhiCdnRuntimeModuleAuthoringClient: import("react").ComponentType<import("../contracts").PhiRuntimeModuleAuthoringClientProps>;
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import WidgetModule from "./authoring-widgets";
3
+ import { createPhiRuntimeModuleAuthoringClient } from "../client-authoring-module";
4
+ import { PHI_CDN_RUNTIME_MODULE_ID } from "./ids";
5
+ export const PhiCdnRuntimeModuleAuthoringClient = createPhiRuntimeModuleAuthoringClient({
6
+ moduleId: PHI_CDN_RUNTIME_MODULE_ID,
7
+ WidgetModule,
8
+ });
@@ -0,0 +1,5 @@
1
+ /**
2
+ * A size as the CDN page says it: binary units, as the parts and the Media limits are counted, written
3
+ * with the reader's digits. Whole bytes below one KiB, one decimal above.
4
+ */
5
+ export declare function formatPhiCdnBytes(bytes: number, locale: string): string;
@@ -0,0 +1,17 @@
1
+ const UNITS = ["B", "KiB", "MiB", "GiB", "TiB"];
2
+ /**
3
+ * A size as the CDN page says it: binary units, as the parts and the Media limits are counted, written
4
+ * with the reader's digits. Whole bytes below one KiB, one decimal above.
5
+ */
6
+ export function formatPhiCdnBytes(bytes, locale) {
7
+ if (!Number.isFinite(bytes) || bytes < 0)
8
+ return "";
9
+ let value = bytes;
10
+ let unit = 0;
11
+ while (value >= 1024 && unit < UNITS.length - 1) {
12
+ value /= 1024;
13
+ unit += 1;
14
+ }
15
+ const digits = new Intl.NumberFormat(locale, { maximumFractionDigits: unit === 0 ? 0 : 1 }).format(value);
16
+ return `${digits} ${UNITS[unit]}`;
17
+ }
@@ -0,0 +1,7 @@
1
+ export declare const PHI_CDN_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS: {
2
+ key: `${string}/${string}`;
3
+ ownerModuleId: "@phis/ui/modules/cdn";
4
+ loadLive: () => Promise<import("react").ComponentType<{
5
+ children: import("react").ReactNode;
6
+ }>>;
7
+ }[];
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import { PHI_CDN_RUNTIME_DATA_PROVIDER_KEYS, PHI_CDN_RUNTIME_MODULE_ID } from "./ids";
3
+ export const PHI_CDN_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS = [
4
+ {
5
+ key: PHI_CDN_RUNTIME_DATA_PROVIDER_KEYS.table,
6
+ ownerModuleId: PHI_CDN_RUNTIME_MODULE_ID,
7
+ loadLive: async () => (await import("./services/table")).PhiCdnTableProviderClient,
8
+ },
9
+ ];
@@ -0,0 +1,134 @@
1
+ /**
2
+ * The Site's CDN catalogue and the check of its bucket, over Core's Admin routes
3
+ * (`/api/site/admin/cdn`, phis-server; Admins and Maintainers). Every write is Core's to allow: the
4
+ * Page only offers it.
5
+ *
6
+ * `files` is the catalogue: every file offered under the Site's name, copied into the bucket (`cdn`) or
7
+ * linked where its source keeps it (`link`), with what became of it. A key is the file's whole identity
8
+ * and is never written twice, so withdrawing and deleting keep the row: the key stays taken.
9
+ *
10
+ * `check` is one run of the bucket against the catalogue, read when its dialog opens. Its rows are what
11
+ * it found -- an object the catalogue does not hold, a file the bucket does not hold, a size that differs
12
+ * -- and an unrecorded object Core can take into the catalogue offers `adopt`.
13
+ */
14
+ export declare const PHI_CDN_RUNTIME_DATA_PROVIDER_DESCRIPTORS: {
15
+ key: `${string}/${string}`;
16
+ ownerModuleId: "@phis/ui/modules/cdn";
17
+ kind: "table";
18
+ executionMode: "live";
19
+ authoringMode: "none";
20
+ title: string;
21
+ description: string;
22
+ resources: ({
23
+ resourceKey: "files";
24
+ title: string;
25
+ rowIdentityPath: string;
26
+ recordRead: true;
27
+ fields: ({
28
+ key: string;
29
+ title: string;
30
+ type: "string";
31
+ required: true;
32
+ } | {
33
+ key: string;
34
+ title: string;
35
+ type: "number";
36
+ required?: undefined;
37
+ } | {
38
+ key: string;
39
+ title: string;
40
+ type: "string";
41
+ required?: undefined;
42
+ } | {
43
+ key: string;
44
+ title: string;
45
+ type: "json";
46
+ required?: undefined;
47
+ } | {
48
+ key: string;
49
+ title: string;
50
+ type: "datetime";
51
+ required?: undefined;
52
+ } | {
53
+ key: string;
54
+ title: string;
55
+ type: "boolean";
56
+ required?: undefined;
57
+ })[];
58
+ query: {
59
+ search: true;
60
+ filterFields: string[];
61
+ sorting: "single";
62
+ pagination: "offset";
63
+ total: true;
64
+ };
65
+ actions: ({
66
+ key: string;
67
+ title: string;
68
+ scope: "row";
69
+ intent: "read";
70
+ confirmation?: undefined;
71
+ disabledWhen?: undefined;
72
+ } | {
73
+ key: string;
74
+ title: string;
75
+ scope: "row";
76
+ intent: "destructive";
77
+ confirmation: "required";
78
+ disabledWhen: {
79
+ source: "row";
80
+ valuePath: string;
81
+ operator: "truthy";
82
+ };
83
+ })[];
84
+ summaryFields?: undefined;
85
+ } | {
86
+ resourceKey: "check";
87
+ title: string;
88
+ rowIdentityPath: string;
89
+ fields: ({
90
+ key: string;
91
+ title: string;
92
+ type: "string";
93
+ required: true;
94
+ } | {
95
+ key: string;
96
+ title: string;
97
+ type: "string";
98
+ required?: undefined;
99
+ } | {
100
+ key: string;
101
+ title: string;
102
+ type: "boolean";
103
+ required?: undefined;
104
+ })[];
105
+ summaryFields: ({
106
+ key: string;
107
+ title: string;
108
+ type: "number";
109
+ } | {
110
+ key: string;
111
+ title: string;
112
+ type: "boolean";
113
+ })[];
114
+ query: {
115
+ search: false;
116
+ filterFields: never[];
117
+ sorting: "none";
118
+ pagination: "none";
119
+ total?: undefined;
120
+ };
121
+ actions: {
122
+ key: string;
123
+ title: string;
124
+ scope: "row";
125
+ intent: "write";
126
+ visibleWhen: {
127
+ source: "row";
128
+ valuePath: string;
129
+ operator: "truthy";
130
+ };
131
+ }[];
132
+ recordRead?: undefined;
133
+ })[];
134
+ }[];