@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.
- package/README.md +9 -2
- package/components/controls/phi-table-control.js +3 -3
- package/components/media/media-upload-flow.d.ts +62 -5
- package/components/media/media-upload-flow.js +62 -24
- package/components/media/phi-area-upload-widget.d.ts +44 -1
- package/components/media/phi-area-upload-widget.js +32 -7
- package/components/media/phi-media-upload.d.ts +10 -3
- package/components/media/phi-media-upload.js +11 -8
- package/components/shell/phi-widget-icon.js +1 -0
- package/components/widgets/client/html-editor-link-node.d.ts +12 -0
- package/components/widgets/client/html-editor-link-node.js +60 -0
- package/components/widgets/client/html-editor.js +10 -6
- package/components/widgets/client/shared/phi-collection-view-binding.js +33 -26
- package/constants/cms-widget-types.d.ts +1 -0
- package/constants/cms-widget-types.js +3 -0
- package/constants/runtime-module-ownership.js +1 -0
- package/gateway/site-proxy.d.ts +12 -0
- package/gateway/site-proxy.js +20 -0
- package/net/phi-next-proxy.d.ts +7 -0
- package/net/phi-next-proxy.js +1 -1
- package/package.json +27 -14
- package/plugins/runtime-modules/area-contributions/admin.d.ts +1 -1
- package/plugins/runtime-modules/area-contributions/admin.js +2 -0
- package/plugins/runtime-modules/avatar/addresses.d.ts +1 -1
- package/plugins/runtime-modules/cdn/authoring-widgets.d.ts +3 -0
- package/plugins/runtime-modules/cdn/authoring-widgets.js +7 -0
- package/plugins/runtime-modules/cdn/authoring.d.ts +1 -0
- package/plugins/runtime-modules/cdn/authoring.js +8 -0
- package/plugins/runtime-modules/cdn/bytes.d.ts +5 -0
- package/plugins/runtime-modules/cdn/bytes.js +17 -0
- package/plugins/runtime-modules/cdn/client-data-providers.d.ts +7 -0
- package/plugins/runtime-modules/cdn/client-data-providers.js +9 -0
- package/plugins/runtime-modules/cdn/data-providers.d.ts +134 -0
- package/plugins/runtime-modules/cdn/data-providers.js +117 -0
- package/plugins/runtime-modules/cdn/definition.d.ts +140 -0
- package/plugins/runtime-modules/cdn/definition.js +23 -0
- package/plugins/runtime-modules/cdn/ids.d.ts +18 -0
- package/plugins/runtime-modules/cdn/ids.js +20 -0
- package/plugins/runtime-modules/cdn/module.d.ts +131 -0
- package/plugins/runtime-modules/cdn/module.js +4 -0
- package/plugins/runtime-modules/cdn/platform.d.ts +25 -0
- package/plugins/runtime-modules/cdn/platform.js +73 -0
- package/plugins/runtime-modules/cdn/presets.d.ts +2 -0
- package/plugins/runtime-modules/cdn/presets.js +20 -0
- package/plugins/runtime-modules/cdn/server.d.ts +1 -0
- package/plugins/runtime-modules/cdn/server.js +14 -0
- package/plugins/runtime-modules/cdn/services/table.d.ts +11 -0
- package/plugins/runtime-modules/cdn/services/table.js +296 -0
- package/plugins/runtime-modules/cdn/services/upload.d.ts +20 -0
- package/plugins/runtime-modules/cdn/services/upload.js +146 -0
- package/plugins/runtime-modules/cdn/table-params.d.ts +10 -0
- package/plugins/runtime-modules/cdn/table-params.js +10 -0
- package/plugins/runtime-modules/cdn/trees/admin-cdn-label-set.d.ts +95 -0
- package/plugins/runtime-modules/cdn/trees/admin-cdn-label-set.js +156 -0
- package/plugins/runtime-modules/cdn/trees/phi-default-admin-cdn-page-tree.d.ts +18 -0
- package/plugins/runtime-modules/cdn/trees/phi-default-admin-cdn-page-tree.js +479 -0
- package/plugins/runtime-modules/cdn/widgets/upload/client.d.ts +12 -0
- package/plugins/runtime-modules/cdn/widgets/upload/client.js +138 -0
- package/plugins/runtime-modules/cdn/widgets/upload/config.d.ts +29 -0
- package/plugins/runtime-modules/cdn/widgets/upload/config.js +43 -0
- package/plugins/runtime-modules/cdn/widgets/upload/label-types.d.ts +24 -0
- package/plugins/runtime-modules/cdn/widgets/upload/label-types.js +1 -0
- package/plugins/runtime-modules/cdn/widgets/upload/labels.d.ts +4 -0
- package/plugins/runtime-modules/cdn/widgets/upload/labels.js +72 -0
- package/plugins/runtime-modules/cdn/widgets/upload/plugin.d.ts +3 -0
- package/plugins/runtime-modules/cdn/widgets/upload/plugin.js +7 -0
- package/plugins/runtime-modules/cdn/widgets/upload/server.d.ts +8 -0
- package/plugins/runtime-modules/cdn/widgets/upload/server.js +17 -0
- package/plugins/runtime-modules/cdn/widgets.d.ts +2 -0
- package/plugins/runtime-modules/cdn/widgets.js +13 -0
- package/plugins/runtime-modules/client-authoring-providers/admin.d.ts +1 -1
- package/plugins/runtime-modules/client-authoring-providers/admin.js +6 -0
- package/plugins/runtime-modules/client-manifests/admin.js +11 -1
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.js +3 -1
- package/plugins/runtime-modules/core/widgets/table/client.js +6 -4
- package/types/table-widget.d.ts +2 -2
package/README.md
CHANGED
|
@@ -35,11 +35,18 @@ It does not own:
|
|
|
35
35
|
|
|
36
36
|
| Package | Range |
|
|
37
37
|
| --- | --- |
|
|
38
|
-
| `next` | `^16.
|
|
38
|
+
| `next` | `^16.4.6` |
|
|
39
39
|
| `react`, `react-dom` | `^19.2.8` |
|
|
40
|
-
| `antd` | `^6.
|
|
40
|
+
| `antd` | `^6.7.1` |
|
|
41
41
|
| `@ant-design/icons` | `^6.3.2` |
|
|
42
42
|
|
|
43
|
+
The ranges say what the package accepts. The exact versions it is built and tested with stand in
|
|
44
|
+
`package.json#phis.testedWith`, which ships with the package; `phis init` pins a new Site to them. The
|
|
45
|
+
field is read from node_modules, never typed: locally `pnpm tested-with:write` writes it and `pnpm verify`
|
|
46
|
+
fails while it says anything else. The release workflow writes it again from what its own install
|
|
47
|
+
resolved, right before verify, build and publish, so a patch released upstream since the last commit is
|
|
48
|
+
recorded as the version the published package was actually built and verified with, not a reason to fail.
|
|
49
|
+
|
|
43
50
|
## For Site operators
|
|
44
51
|
|
|
45
52
|
- Create a Site with `phis init <site key>`. The generated Site is the Skeleton: route files, deployment
|
|
@@ -1022,8 +1022,8 @@ export function PhiTableControl({ rows, rowIdentityPath, columns, columnOrder, s
|
|
|
1022
1022
|
* Whether something of the Table's own stands at its bottom edge. A sticky-top summary does not: it
|
|
1023
1023
|
* rides above the rows and leaves the last row to end the Table.
|
|
1024
1024
|
*/
|
|
1025
|
-
const hasClosingBlock =
|
|
1026
|
-
(
|
|
1025
|
+
const hasClosingBlock = Boolean(footer) ||
|
|
1026
|
+
(!loading && summary != null && summary.placement !== "sticky-top");
|
|
1027
1027
|
const frameRef = useRef(null);
|
|
1028
1028
|
// Where the Shell's Header ends, which is where a sticky header row stops (`styles/controls.css`).
|
|
1029
1029
|
usePhiShellStickyTop({ active: stickyHeader && showHeader !== false, elementRef: frameRef });
|
|
@@ -1077,7 +1077,7 @@ export function PhiTableControl({ rows, rowIdentityPath, columns, columnOrder, s
|
|
|
1077
1077
|
pageSizeOptions: pagination.pageSizeOptions?.map(String),
|
|
1078
1078
|
showSizeChanger: pagination.showSizeChanger,
|
|
1079
1079
|
onChange: pagination.onChange,
|
|
1080
|
-
}, footer: footer
|
|
1080
|
+
}, footer: footer ? () => (_jsx(Flex, { [PHI_VISUAL_ANCHOR_PART_ATTRIBUTE]: "footer", align: "center", justify: footer.align ?? "start", style: { minHeight: "1lh" }, gap: "small", wrap: true, children: loading ? null : footer.content })) : undefined, summary: summaryNode, expandable: tree && !loading ? {
|
|
1081
1081
|
childrenColumnName: "__phiTableChildren",
|
|
1082
1082
|
showExpandColumn: false,
|
|
1083
1083
|
expandedRowKeys: [...tree.expandedRowIdentities],
|
|
@@ -107,7 +107,7 @@ export type PhiMediaUploadProgressHandler = (progress: number) => void;
|
|
|
107
107
|
* uses the Add-on's root. Making it a parameter is what lets the acceptance, the progress, the refusal
|
|
108
108
|
* and the labels stay shared instead of being written twice with the second one drifting.
|
|
109
109
|
*/
|
|
110
|
-
export type PhiMediaUploadSessionRunner = (file: File, onProgress?: PhiMediaUploadProgressHandler, options?: PhiMediaUploadInitOptions, signal?: AbortSignal) => Promise<{
|
|
110
|
+
export type PhiMediaUploadSessionRunner = (file: File, onProgress?: PhiMediaUploadProgressHandler, options?: PhiMediaUploadInitOptions, signal?: AbortSignal, onPhase?: (phase: PhiUploadPhase) => void) => Promise<{
|
|
111
111
|
asset: {
|
|
112
112
|
id: number;
|
|
113
113
|
};
|
|
@@ -141,7 +141,7 @@ type PhiMediaUploadInitSession = {
|
|
|
141
141
|
/** Null where the Server asked for none: every plan but one sent in parts. */
|
|
142
142
|
heartbeat: PhiMediaUploadHeartbeat | null;
|
|
143
143
|
};
|
|
144
|
-
type PhiMediaUploadHeartbeat = {
|
|
144
|
+
export type PhiMediaUploadHeartbeat = {
|
|
145
145
|
url: string;
|
|
146
146
|
intervalMs: number;
|
|
147
147
|
};
|
|
@@ -272,16 +272,73 @@ export declare function uploadPhiMediaUploadBody(plan: PhiMediaUploadPlan, file:
|
|
|
272
272
|
/** Parts an earlier attempt delivered, where this session was taken over rather than opened. */
|
|
273
273
|
stored?: readonly PhiMediaUploadStoredPart[],
|
|
274
274
|
/** Stops the body where it is; what is in flight is aborted and the call throws `cancelled`. */
|
|
275
|
-
signal?: AbortSignal
|
|
275
|
+
signal?: AbortSignal,
|
|
276
|
+
/** What a delivered part answers with (`PhiUploadPartReceipt`); a storage's entity tag unless said. */
|
|
277
|
+
receipt?: PhiUploadPartReceipt): Promise<PhiMediaUploadUploadResponse>;
|
|
276
278
|
/**
|
|
277
|
-
*
|
|
279
|
+
* What a delivered part of a body answers with.
|
|
280
|
+
*
|
|
281
|
+
* `etag`: the storage's entity tag, which a completion names every part by -- a part delivered to a
|
|
282
|
+
* presigned storage address, whose tag the browser has to read and hand on. `none`: nothing to hand on --
|
|
283
|
+
* a part delivered to a route of this Site's server, which completes the assembly itself and asks the
|
|
284
|
+
* storage what it holds.
|
|
285
|
+
*/
|
|
286
|
+
export type PhiUploadPartReceipt = "etag" | "none";
|
|
287
|
+
/**
|
|
288
|
+
* Where an upload stands, for a surface that says more than a percentage: the file is hashed and the
|
|
289
|
+
* session opened (`checksum`), its body travels (`transfer`, which the progress figures belong to), and
|
|
290
|
+
* the place it went settles it (`finish`) -- an Asset made, a file hashed whole and recorded.
|
|
291
|
+
*/
|
|
292
|
+
export type PhiUploadPhase = "checksum" | "transfer" | "finish";
|
|
293
|
+
/** One upload, opened by its target: how the body travels, and how its target settles or drops it. */
|
|
294
|
+
export type PhiUploadSession<TResult> = {
|
|
295
|
+
plan: PhiMediaUploadPlan;
|
|
296
|
+
/** Parts an earlier attempt delivered; the plan addresses only what is missing. */
|
|
297
|
+
uploaded: readonly PhiMediaUploadStoredPart[];
|
|
298
|
+
/** Null where the target asks for none. */
|
|
299
|
+
heartbeat: PhiMediaUploadHeartbeat | null;
|
|
300
|
+
/** What a delivered part answers with. `etag` where the target says nothing. */
|
|
301
|
+
partReceipt?: PhiUploadPartReceipt;
|
|
302
|
+
/**
|
|
303
|
+
* Called when the body starts to travel; returns the way to stop. For a target that tells its server
|
|
304
|
+
* when the page goes away mid-body (`pagehide`).
|
|
305
|
+
*/
|
|
306
|
+
watchLeaving?: () => () => void;
|
|
307
|
+
/** The body did not arrive, for whichever reason the error says: what the target does about it. */
|
|
308
|
+
abandon: (error: unknown, signal: AbortSignal | undefined) => Promise<void>;
|
|
309
|
+
/** The body arrived: the target settles it, with what the transport reported back. */
|
|
310
|
+
finish: (completion: unknown, signal: AbortSignal | undefined) => Promise<TResult>;
|
|
311
|
+
};
|
|
312
|
+
/** Where an upload goes: Core's Media routes, or another place that takes a body the same way. */
|
|
313
|
+
export type PhiUploadTarget<TResult> = {
|
|
314
|
+
/** Hashes what it needs and opens -- or takes up again -- the session for this file. */
|
|
315
|
+
open: (file: File, signal: AbortSignal | undefined) => Promise<PhiUploadSession<TResult>>;
|
|
316
|
+
};
|
|
317
|
+
/**
|
|
318
|
+
* One file through an upload target, from chosen to settled.
|
|
319
|
+
*
|
|
320
|
+
* The sequence every upload of this package runs, whichever target it is for: open (hashing first), keep
|
|
321
|
+
* the session alive while parts travel, send the body by its plan -- the parts the target does not hold
|
|
322
|
+
* yet, several at once, each tried again after a transport failure or a `5xx` -- and settle it. `signal`
|
|
323
|
+
* stops it up to the moment `finish` begins: an open in flight is aborted, a body in flight is aborted
|
|
324
|
+
* and reported `cancelled`, and the target is told (`abandon`). Once `finish` runs it is not stopped
|
|
325
|
+
* midway -- the target is already turning the body into what it stores, and stopping would only hide the
|
|
326
|
+
* answer; `finish` itself decides whether it still waits for one.
|
|
327
|
+
*/
|
|
328
|
+
export declare function runPhiUploadSession<TResult>(target: PhiUploadTarget<TResult>, file: File, { onProgress, onPhase, signal, }?: {
|
|
329
|
+
onProgress?: PhiMediaUploadProgressHandler;
|
|
330
|
+
onPhase?: (phase: PhiUploadPhase) => void;
|
|
331
|
+
signal?: AbortSignal;
|
|
332
|
+
}): Promise<TResult>;
|
|
333
|
+
/**
|
|
334
|
+
* One file through Core's own upload routes (`runPhiUploadSession` with Core's Media target).
|
|
278
335
|
*
|
|
279
336
|
* `signal` stops it up to the moment finalize is sent: an init in flight is aborted, a body in flight is
|
|
280
337
|
* aborted and reported `cancelled`, so the Server clears up the reservation and whatever arrived. Once
|
|
281
338
|
* finalize is sent it is not stopped -- the Server is already turning the body into an Asset, and aborting
|
|
282
339
|
* the request would only hide the answer. A caller that stopped it ignores what comes back.
|
|
283
340
|
*/
|
|
284
|
-
export declare function runPhiMediaUploadSession(file: File, onProgress?: PhiMediaUploadProgressHandler, options?: PhiMediaUploadInitOptions, signal?: AbortSignal): Promise<PhiMediaUploadSessionResult>;
|
|
341
|
+
export declare function runPhiMediaUploadSession(file: File, onProgress?: PhiMediaUploadProgressHandler, options?: PhiMediaUploadInitOptions, signal?: AbortSignal, onPhase?: (phase: PhiUploadPhase) => void): Promise<PhiMediaUploadSessionResult>;
|
|
285
342
|
/**
|
|
286
343
|
* A place an Add-on's route made for a file, as `assets:v1` answered it.
|
|
287
344
|
*
|
|
@@ -504,7 +504,7 @@ export async function initPhiMediaUploadSession(file, options, signal) {
|
|
|
504
504
|
* Retried on a transport failure and on a `5xx`, and never on a `4xx`: a signature the endpoint rejected
|
|
505
505
|
* will be rejected again, and repeating it only delays saying so.
|
|
506
506
|
*/
|
|
507
|
-
async function uploadPhiMediaUploadPart(part, body, onPartProgress, signal) {
|
|
507
|
+
async function uploadPhiMediaUploadPart(part, body, onPartProgress, signal, receipt = "etag") {
|
|
508
508
|
let lastError = null;
|
|
509
509
|
for (let attempt = 1; attempt <= PHI_MEDIA_UPLOAD_PART_ATTEMPTS; attempt += 1) {
|
|
510
510
|
throwIfPhiMediaUploadAborted(signal);
|
|
@@ -529,8 +529,8 @@ async function uploadPhiMediaUploadPart(part, body, onPartProgress, signal) {
|
|
|
529
529
|
reject(new PhiMediaUploadError(`Part ${part.partNumber} was refused (${xhr.status}).`, PHI_MEDIA_UPLOAD_FAILURE_REASONS.StorageRejected, xhr.status));
|
|
530
530
|
return;
|
|
531
531
|
}
|
|
532
|
-
const eTag = (xhr.getResponseHeader("etag") ?? "").trim();
|
|
533
|
-
if (!eTag) {
|
|
532
|
+
const eTag = receipt === "etag" ? (xhr.getResponseHeader("etag") ?? "").trim() : "";
|
|
533
|
+
if (receipt === "etag" && !eTag) {
|
|
534
534
|
reject(new PhiMediaUploadError(`Part ${part.partNumber} arrived without an entity tag, so it cannot be assembled.`, PHI_MEDIA_UPLOAD_FAILURE_REASONS.ClientError, xhr.status));
|
|
535
535
|
return;
|
|
536
536
|
}
|
|
@@ -582,7 +582,7 @@ async function uploadPhiMediaUploadPart(part, body, onPartProgress, signal) {
|
|
|
582
582
|
*/
|
|
583
583
|
async function uploadPhiMediaUploadParts(plan, file, onProgress,
|
|
584
584
|
/** What an earlier attempt already delivered, which this one neither sends nor waits for. */
|
|
585
|
-
stored = [], signal) {
|
|
585
|
+
stored = [], signal, receipt = "etag") {
|
|
586
586
|
const loadedByPart = new Map();
|
|
587
587
|
const report = () => onProgress?.(resolvePhiMediaUploadPartProgress(loadedByPart, file.size));
|
|
588
588
|
const stop = new AbortController();
|
|
@@ -616,7 +616,7 @@ stored = [], signal) {
|
|
|
616
616
|
return;
|
|
617
617
|
loadedByPart.set(part.partNumber, loadedBytes);
|
|
618
618
|
report();
|
|
619
|
-
}, stop.signal));
|
|
619
|
+
}, stop.signal, receipt));
|
|
620
620
|
}
|
|
621
621
|
catch (error) {
|
|
622
622
|
// The first failure is the one reported; the others are this one stopping them.
|
|
@@ -648,10 +648,12 @@ export async function uploadPhiMediaUploadBody(plan, file, onProgress,
|
|
|
648
648
|
/** Parts an earlier attempt delivered, where this session was taken over rather than opened. */
|
|
649
649
|
stored = [],
|
|
650
650
|
/** Stops the body where it is; what is in flight is aborted and the call throws `cancelled`. */
|
|
651
|
-
signal
|
|
651
|
+
signal,
|
|
652
|
+
/** What a delivered part answers with (`PhiUploadPartReceipt`); a storage's entity tag unless said. */
|
|
653
|
+
receipt = "etag") {
|
|
652
654
|
throwIfPhiMediaUploadAborted(signal);
|
|
653
655
|
if (plan.kind === "multipart-put") {
|
|
654
|
-
return await uploadPhiMediaUploadParts(plan, file, onProgress, stored, signal);
|
|
656
|
+
return await uploadPhiMediaUploadParts(plan, file, onProgress, stored, signal, receipt);
|
|
655
657
|
}
|
|
656
658
|
if (plan.kind !== "proxy-stream" && plan.kind !== "presigned-put") {
|
|
657
659
|
// A newer control plane issued a plan this Client cannot carry out. Saying so is the only safe
|
|
@@ -778,32 +780,36 @@ async function readPhiMediaUploadCancellation(run, signal) {
|
|
|
778
780
|
}
|
|
779
781
|
}
|
|
780
782
|
/**
|
|
781
|
-
* One file through
|
|
783
|
+
* One file through an upload target, from chosen to settled.
|
|
782
784
|
*
|
|
783
|
-
*
|
|
784
|
-
*
|
|
785
|
-
*
|
|
786
|
-
* the
|
|
785
|
+
* The sequence every upload of this package runs, whichever target it is for: open (hashing first), keep
|
|
786
|
+
* the session alive while parts travel, send the body by its plan -- the parts the target does not hold
|
|
787
|
+
* yet, several at once, each tried again after a transport failure or a `5xx` -- and settle it. `signal`
|
|
788
|
+
* stops it up to the moment `finish` begins: an open in flight is aborted, a body in flight is aborted
|
|
789
|
+
* and reported `cancelled`, and the target is told (`abandon`). Once `finish` runs it is not stopped
|
|
790
|
+
* midway -- the target is already turning the body into what it stores, and stopping would only hide the
|
|
791
|
+
* answer; `finish` itself decides whether it still waits for one.
|
|
787
792
|
*/
|
|
788
|
-
export async function
|
|
789
|
-
|
|
790
|
-
const
|
|
791
|
-
const
|
|
793
|
+
export async function runPhiUploadSession(target, file, { onProgress, onPhase, signal, } = {}) {
|
|
794
|
+
onPhase?.("checksum");
|
|
795
|
+
const session = await readPhiMediaUploadCancellation(() => target.open(file, signal), signal);
|
|
796
|
+
const standDown = session.watchLeaving?.() ?? (() => { });
|
|
797
|
+
const stopBeating = keepPhiMediaUploadHeartbeat(session.heartbeat);
|
|
798
|
+
onPhase?.("transfer");
|
|
792
799
|
let upload;
|
|
793
800
|
try {
|
|
794
|
-
upload = await uploadPhiMediaUploadBody(
|
|
795
|
-
// Stopped after the last byte and before
|
|
801
|
+
upload = await uploadPhiMediaUploadBody(session.plan, file, onProgress, session.uploaded, signal, session.partReceipt);
|
|
802
|
+
// Stopped after the last byte and before it was settled: the body is there, and nobody wants it.
|
|
796
803
|
throwIfPhiMediaUploadAborted(signal);
|
|
797
804
|
}
|
|
798
805
|
catch (uploadError) {
|
|
799
806
|
stopBeating();
|
|
800
807
|
standDown();
|
|
801
|
-
|
|
802
|
-
await reportPhiMediaUploadFailure(init.reportUrl, readPhiMediaUploadFailureReason(uploadError), uploadError instanceof Error ? uploadError.message : null);
|
|
808
|
+
await session.abandon(uploadError, signal);
|
|
803
809
|
throw uploadError;
|
|
804
810
|
}
|
|
805
811
|
/*
|
|
806
|
-
* Stood down before
|
|
812
|
+
* Stood down before settling begins, and deliberately not after it answers.
|
|
807
813
|
*
|
|
808
814
|
* Once the Server holds the finalize request it copies the staged object onto its final key and closes
|
|
809
815
|
* the session; a beacon arriving in the middle of that would be a second request racing the first for
|
|
@@ -814,12 +820,44 @@ export async function runPhiMediaUploadSession(file, onProgress, options, signal
|
|
|
814
820
|
*/
|
|
815
821
|
stopBeating();
|
|
816
822
|
standDown();
|
|
817
|
-
|
|
823
|
+
onPhase?.("finish");
|
|
824
|
+
return await session.finish(upload.completion, signal);
|
|
825
|
+
}
|
|
826
|
+
/** Core's own Media upload routes as an upload target: init, the report of a failure, and finalize. */
|
|
827
|
+
function createPhiMediaUploadTarget(options) {
|
|
818
828
|
return {
|
|
819
|
-
|
|
820
|
-
|
|
829
|
+
open: async (file, signal) => {
|
|
830
|
+
const init = await initPhiMediaUploadSession(file, options, signal);
|
|
831
|
+
return {
|
|
832
|
+
plan: init.plan,
|
|
833
|
+
uploaded: init.uploaded,
|
|
834
|
+
heartbeat: init.heartbeat,
|
|
835
|
+
watchLeaving: () => reportPhiMediaUploadAbandonmentOnLeaving(init.reportUrl, init.plan),
|
|
836
|
+
// The Server cannot see this leg, so it is told rather than left to infer it from an expiry.
|
|
837
|
+
abandon: (error) => reportPhiMediaUploadFailure(init.reportUrl, readPhiMediaUploadFailureReason(error), error instanceof Error ? error.message : null),
|
|
838
|
+
finish: async (completion) => {
|
|
839
|
+
const finalize = await finalizePhiMediaUploadSession(init.finalizeUrl, completion);
|
|
840
|
+
return { asset: finalize.asset, token: init.token };
|
|
841
|
+
},
|
|
842
|
+
};
|
|
843
|
+
},
|
|
821
844
|
};
|
|
822
845
|
}
|
|
846
|
+
/**
|
|
847
|
+
* One file through Core's own upload routes (`runPhiUploadSession` with Core's Media target).
|
|
848
|
+
*
|
|
849
|
+
* `signal` stops it up to the moment finalize is sent: an init in flight is aborted, a body in flight is
|
|
850
|
+
* aborted and reported `cancelled`, so the Server clears up the reservation and whatever arrived. Once
|
|
851
|
+
* finalize is sent it is not stopped -- the Server is already turning the body into an Asset, and aborting
|
|
852
|
+
* the request would only hide the answer. A caller that stopped it ignores what comes back.
|
|
853
|
+
*/
|
|
854
|
+
export async function runPhiMediaUploadSession(file, onProgress, options, signal, onPhase) {
|
|
855
|
+
return await runPhiUploadSession(createPhiMediaUploadTarget(options), file, {
|
|
856
|
+
...(onProgress ? { onProgress } : {}),
|
|
857
|
+
...(onPhase ? { onPhase } : {}),
|
|
858
|
+
...(signal ? { signal } : {}),
|
|
859
|
+
});
|
|
860
|
+
}
|
|
823
861
|
/**
|
|
824
862
|
* Carries out an upload an Add-on's own route reserved.
|
|
825
863
|
*
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
1
2
|
import type { PhiCmsAreaUploadWidgetConfig } from "../../types/media";
|
|
2
3
|
import type { PhiMediaAssetTile } from "../../types/media";
|
|
3
4
|
import type { PhiCollectionProviderQuery } from "../../types/collection-provider";
|
|
4
5
|
import type { PhiAreaUploadWidgetLabels } from "./media-widget-labels";
|
|
6
|
+
import { type PhiMediaUploadSessionRunner, type PhiUploadPhase } from "./media-upload-flow";
|
|
5
7
|
import { type PhiMediaUploadAcceptance } from "./phi-media-upload";
|
|
6
8
|
import { type PhiImagePreviewStoreState } from "./phi-image-preview-store";
|
|
7
9
|
export type PhiAreaUploadWidgetProps = {
|
|
@@ -44,5 +46,46 @@ export type PhiAreaUploadWidgetProps = {
|
|
|
44
46
|
query: PhiCollectionProviderQuery;
|
|
45
47
|
};
|
|
46
48
|
};
|
|
47
|
-
|
|
49
|
+
/**
|
|
50
|
+
* A Module's own upload through this surface, in place of the Media library's: its fields stand in front
|
|
51
|
+
* of the file, its runner takes the file somewhere else (`runPhiUploadSession` with the Module's target),
|
|
52
|
+
* and what arrived is the Module's to show. The drop area, the file's tile with its progress, its refusal
|
|
53
|
+
* and its retry, and the stop when the surface goes away stay this surface's. The CDN page's upload is
|
|
54
|
+
* the one that asked: a file published under a name, a version and a file name the person states.
|
|
55
|
+
*
|
|
56
|
+
* A file picked here is held until the person sends it (`startLabel`), because the Module's fields may
|
|
57
|
+
* start from it -- a file name, a platform read from the extension -- and are only complete once they do.
|
|
58
|
+
* One file at a time.
|
|
59
|
+
*
|
|
60
|
+
* Not part of `PhiAreaUploadWidgetProps`, which a Site can place: a target is code, never configuration.
|
|
61
|
+
*/
|
|
62
|
+
export type PhiAreaUploadModuleTarget<TResult> = {
|
|
63
|
+
/** The Module's fields, drawn in front of the file, told which file is held and whether one is on its way. */
|
|
64
|
+
renderFields: (state: {
|
|
65
|
+
file: File | null;
|
|
66
|
+
uploading: boolean;
|
|
67
|
+
}) => ReactNode;
|
|
68
|
+
/** A file was picked, for fields that start from it. */
|
|
69
|
+
onFilePicked?: (file: File) => void;
|
|
70
|
+
/** Whether the held file may be sent: the Module's fields hold what its target needs. */
|
|
71
|
+
ready: boolean;
|
|
72
|
+
startLabel: string;
|
|
73
|
+
cancelLabel: string;
|
|
74
|
+
/** Where the file goes (`usePhiMediaUpload`'s runner); its third argument, the Media init options, is unused. */
|
|
75
|
+
runSession: (...args: Parameters<PhiMediaUploadSessionRunner>) => Promise<{
|
|
76
|
+
asset: TResult;
|
|
77
|
+
}>;
|
|
78
|
+
/** The target's own words for a refusal; null falls back to the Media refusals. */
|
|
79
|
+
readError?: (error: unknown) => string | null;
|
|
80
|
+
/** What the file's tag says while it is hashed and while the target settles it, in place of a percentage. */
|
|
81
|
+
phaseLabels?: Partial<Record<PhiUploadPhase, string>>;
|
|
82
|
+
/** The abort reason Cancel stops the upload with, for a target that tells a stop from a discard. */
|
|
83
|
+
cancelReason?: unknown;
|
|
84
|
+
/** What arrived. The surface says so as it says it for an Asset, and holds no file any more. */
|
|
85
|
+
onUploaded: (result: TResult, file: File) => void;
|
|
86
|
+
};
|
|
87
|
+
export type PhiAreaUploadBindingProps = PhiAreaUploadWidgetProps & {
|
|
88
|
+
moduleTarget?: PhiAreaUploadModuleTarget<any>;
|
|
89
|
+
};
|
|
90
|
+
export declare function PhiAreaUploadBinding({ config, labels, onUploadComplete, acceptance, showFinished, onAssetUploaded, onUploadingChange, refuseFile, siteSpaceOnly, collectionContext, moduleTarget, }: PhiAreaUploadBindingProps): import("react").JSX.Element;
|
|
48
91
|
export declare function PhiAreaUploadWidget(props: PhiAreaUploadWidgetProps): import("react").JSX.Element;
|
|
@@ -39,6 +39,7 @@ function buildUploadWallItem(asset, localId) {
|
|
|
39
39
|
height: asset.height ?? null,
|
|
40
40
|
presentationFlags: asset.presentationFlags,
|
|
41
41
|
progress: 100,
|
|
42
|
+
phase: null,
|
|
42
43
|
status: "done",
|
|
43
44
|
deleting: false,
|
|
44
45
|
error: null,
|
|
@@ -60,6 +61,7 @@ function buildPendingWallItem(item, presentationFlags) {
|
|
|
60
61
|
height: null,
|
|
61
62
|
presentationFlags,
|
|
62
63
|
progress: item.progress,
|
|
64
|
+
phase: item.phase,
|
|
63
65
|
status: item.status,
|
|
64
66
|
deleting: false,
|
|
65
67
|
error: item.error,
|
|
@@ -68,7 +70,7 @@ function buildPendingWallItem(item, presentationFlags) {
|
|
|
68
70
|
function resolveUploadWallDisplayDimensions(item) {
|
|
69
71
|
return resolvePhiMediaAssetDisplayDimensions(item);
|
|
70
72
|
}
|
|
71
|
-
export function PhiAreaUploadBinding({ config, labels, onUploadComplete, acceptance, showFinished = true, onAssetUploaded, onUploadingChange, refuseFile, siteSpaceOnly = false, collectionContext, }) {
|
|
73
|
+
export function PhiAreaUploadBinding({ config, labels, onUploadComplete, acceptance, showFinished = true, onAssetUploaded, onUploadingChange, refuseFile, siteSpaceOnly = false, collectionContext, moduleTarget, }) {
|
|
72
74
|
const { token } = usePhiConfig();
|
|
73
75
|
const { showMessage } = usePhiApplicationFeedback();
|
|
74
76
|
const uploadTileFrameSize = token.controlHeight * 3;
|
|
@@ -78,7 +80,8 @@ export function PhiAreaUploadBinding({ config, labels, onUploadComplete, accepta
|
|
|
78
80
|
const [uploadWall, setUploadWall] = useState([]);
|
|
79
81
|
const allowDelete = config?.allowDelete ?? true;
|
|
80
82
|
const configAccept = config?.accept?.trim() || "*/*";
|
|
81
|
-
const multiple = config?.multiple ?? true;
|
|
83
|
+
const multiple = moduleTarget ? false : config?.multiple ?? true;
|
|
84
|
+
const [heldFile, setHeldFile] = useState(null);
|
|
82
85
|
const collectionFolderId = collectionContext?.folderId ?? null;
|
|
83
86
|
const collectionPresentationFlags = collectionContext?.presentationFlags ?? null;
|
|
84
87
|
const hasCollectionContext = collectionContext != null;
|
|
@@ -154,8 +157,16 @@ export function PhiAreaUploadBinding({ config, labels, onUploadComplete, accepta
|
|
|
154
157
|
labels: labels.refusals,
|
|
155
158
|
...(acceptance ? { acceptance } : {}),
|
|
156
159
|
initOptions: uploadInitOptions,
|
|
157
|
-
|
|
158
|
-
|
|
160
|
+
...(moduleTarget ? { runSession: moduleTarget.runSession } : {}),
|
|
161
|
+
...(moduleTarget?.readError ? { readError: moduleTarget.readError } : {}),
|
|
162
|
+
onUploaded: (result, file) => {
|
|
163
|
+
if (moduleTarget) {
|
|
164
|
+
setHeldFile(null);
|
|
165
|
+
showUploadMessage("success", labels.uploadSuccessTemplate.replace("%1", file.name));
|
|
166
|
+
moduleTarget.onUploaded(result, file);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const uploadedTile = normalizePhiImagePreviewTile(result, []);
|
|
159
170
|
if (showFinished) {
|
|
160
171
|
setUploadWall((current) => [buildUploadWallItem(uploadedTile, `asset-${uploadedTile.id}`), ...current]);
|
|
161
172
|
}
|
|
@@ -181,7 +192,15 @@ export function PhiAreaUploadBinding({ config, labels, onUploadComplete, accepta
|
|
|
181
192
|
.map((item) => buildPendingWallItem(item, uploadInitOptions.presentationFlags ?? 0)),
|
|
182
193
|
...uploadWall,
|
|
183
194
|
];
|
|
184
|
-
return (_jsxs(PhiFlexControl, { vertical: true, gap: 12, style: { width: "100%" }, children: [_jsx(PhiUploadDropArea, { multiple: multiple, accept: accept, title: labels.dropTitle, hint: labels.dropHint, onFile: (file) => {
|
|
195
|
+
return (_jsxs(PhiFlexControl, { vertical: true, gap: 12, style: { width: "100%" }, children: [moduleTarget ? moduleTarget.renderFields({ file: heldFile, uploading }) : null, _jsx(PhiUploadDropArea, { multiple: multiple, accept: accept, title: moduleTarget && heldFile ? heldFile.name : labels.dropTitle, hint: labels.dropHint, onFile: (file) => {
|
|
196
|
+
if (moduleTarget) {
|
|
197
|
+
// Held, not sent: the Module's fields may start from it and are complete only once they do.
|
|
198
|
+
if (uploading)
|
|
199
|
+
return;
|
|
200
|
+
setHeldFile(file);
|
|
201
|
+
moduleTarget.onFilePicked?.(file);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
185
204
|
const refusal = refuseFile?.(file, sendingRef.current) ?? null;
|
|
186
205
|
if (refusal) {
|
|
187
206
|
showUploadMessage("error", refusal);
|
|
@@ -192,7 +211,12 @@ export function PhiAreaUploadBinding({ config, labels, onUploadComplete, accepta
|
|
|
192
211
|
void upload.upload(file).finally(() => {
|
|
193
212
|
sendingRef.current -= 1;
|
|
194
213
|
});
|
|
195
|
-
} }),
|
|
214
|
+
} }), moduleTarget ? (_jsxs(PhiFlexControl, { justify: "flex-end", gap: 8, children: [uploading ? (_jsx(PhiButtonControl, { label: moduleTarget.cancelLabel, onClick: () => upload.cancel(moduleTarget.cancelReason) })) : null, _jsx(PhiButtonControl, { type: "primary", label: moduleTarget.startLabel, icon: _jsx(PhiIcon, { name: "upload", size: "inherit" }), loading: uploading, disabled: !heldFile || !moduleTarget.ready || uploading, onClick: () => {
|
|
215
|
+
if (!heldFile)
|
|
216
|
+
return;
|
|
217
|
+
upload.reset();
|
|
218
|
+
void upload.upload(heldFile);
|
|
219
|
+
} })] })) : null, _jsx(PhiCollectionLayoutControl, { mode: "grid", gap: token.paddingSM, minColumnWidth: uploadTileFrameSize, items: wallItems.map((item) => {
|
|
196
220
|
const displayDimensions = resolveUploadWallDisplayDimensions(item);
|
|
197
221
|
return (_jsxs("div", { style: {
|
|
198
222
|
border: resolvePhiThemeBorderLine(token.colorBorderSecondary),
|
|
@@ -249,7 +273,8 @@ export function PhiAreaUploadBinding({ config, labels, onUploadComplete, accepta
|
|
|
249
273
|
color: "#fff",
|
|
250
274
|
}, children: _jsx(PhiSpinControl, {}) })) : null] }), _jsxs(PhiFlexControl, { vertical: true, gap: 6, style: { padding: token.paddingSM }, children: [_jsx(PhiFlexControl, { align: "center", justify: "space-between", gap: 8, children: _jsx(PhiTypographyControl, { strong: true, ellipsis: true, title: item.title ?? item.originalName, style: { minWidth: 0 }, children: item.title ?? item.originalName }) }), _jsxs(PhiFlexControl, { align: "center", justify: "space-between", gap: 8, wrap: true, children: [_jsx(PhiTypographyControl, { type: "secondary", ellipsis: true, style: { display: "block", minWidth: 0 }, children: resolvePhiMediaAssetTypeLabel(item.kind, item.contentType, item.originalName) }), allowDelete && item.assetId > 0 ? (_jsx(PhiButtonControl, { ariaLabel: labels.deleteLabel, icon: _jsx(PhiIcon, { name: "delete", size: "inherit" }), type: "text", size: "small", danger: true, onClick: () => {
|
|
251
275
|
void deleteUploadedAsset(item.localId, item.assetId);
|
|
252
|
-
} })) : null] }), _jsxs(PhiFlexControl, { align: "center", gap: 6, wrap: true, children: [_jsx(PhiTagControl, { color: item.status === "error" ? "red" : item.status === "uploading" ? "blue" : "green", children:
|
|
276
|
+
} })) : null] }), _jsxs(PhiFlexControl, { align: "center", gap: 6, wrap: true, children: [_jsx(PhiTagControl, { color: item.status === "error" ? "red" : item.status === "uploading" ? "blue" : "green", children: (item.status === "uploading" && item.phase && moduleTarget?.phaseLabels?.[item.phase])
|
|
277
|
+
|| resolvePhiUploadStatusLabel(item, labels) }), item.status === "error" && item.file ? (_jsx(PhiButtonControl, { type: "primary", size: "small", onClick: () => {
|
|
253
278
|
void upload.retry(item.localId);
|
|
254
279
|
}, label: labels.retryLabel })) : null] })] })] }, item.localId));
|
|
255
280
|
}) })] }));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PhiMediaKindValue } from "../../types/media";
|
|
2
2
|
import type { PhiAreaUploadWidgetLabels } from "./media-widget-labels";
|
|
3
3
|
import type { PhiMediaUploadLabels } from "./media-upload-labels";
|
|
4
|
-
import { type PhiMediaUploadSessionRunner, type PhiMediaUploadInitOptions } from "./media-upload-flow";
|
|
4
|
+
import { type PhiMediaUploadSessionRunner, type PhiMediaUploadInitOptions, type PhiUploadPhase } from "./media-upload-flow";
|
|
5
5
|
/**
|
|
6
6
|
* What a surface accepts, stated by the Module that offers it.
|
|
7
7
|
*
|
|
@@ -42,6 +42,8 @@ type PhiMediaUploadItem = {
|
|
|
42
42
|
localId: string;
|
|
43
43
|
file: File;
|
|
44
44
|
progress: number;
|
|
45
|
+
/** Where a file on its way stands (`PhiUploadPhase`); null before the session says. */
|
|
46
|
+
phase: PhiUploadPhase | null;
|
|
45
47
|
status: "uploading" | "done" | "error";
|
|
46
48
|
error: string | null;
|
|
47
49
|
assetId: number | null;
|
|
@@ -69,7 +71,7 @@ type PhiMediaUploadItem = {
|
|
|
69
71
|
* whatever would act on the incomplete value.
|
|
70
72
|
*/
|
|
71
73
|
export declare function usePhiMediaUpload<TAsset extends {
|
|
72
|
-
id
|
|
74
|
+
id?: unknown;
|
|
73
75
|
} = {
|
|
74
76
|
id: number;
|
|
75
77
|
}>(input: {
|
|
@@ -92,13 +94,18 @@ export declare function usePhiMediaUpload<TAsset extends {
|
|
|
92
94
|
*/
|
|
93
95
|
onUploaded?: (asset: TAsset, file: File) => void | Promise<void>;
|
|
94
96
|
onRejected?: (message: string, file: File) => void;
|
|
97
|
+
/**
|
|
98
|
+
* The sentence a failure is shown with, for a runner whose target words its own refusals -- Core's CDN
|
|
99
|
+
* routes answer `{ error, message }` in a person's words. Null falls back to the Media refusals.
|
|
100
|
+
*/
|
|
101
|
+
readError?: (error: unknown) => string | null;
|
|
95
102
|
}): {
|
|
96
103
|
accept: string;
|
|
97
104
|
items: readonly PhiMediaUploadItem[];
|
|
98
105
|
uploading: boolean;
|
|
99
106
|
upload: (file: File, fileInitOptions?: PhiMediaUploadInitOptions) => Promise<TAsset | null>;
|
|
100
107
|
retry: (localId: string) => Promise<TAsset | null>;
|
|
101
|
-
cancel: () => void;
|
|
108
|
+
cancel: (reason?: unknown) => void;
|
|
102
109
|
reset: () => void;
|
|
103
110
|
};
|
|
104
111
|
export {};
|
|
@@ -104,7 +104,8 @@ export function readPhiMediaUploadErrorMessage(error, labels) {
|
|
|
104
104
|
* whatever would act on the incomplete value.
|
|
105
105
|
*/
|
|
106
106
|
export function usePhiMediaUpload(input) {
|
|
107
|
-
const { labels, acceptance, initOptions, onUploaded, onRejected } = input;
|
|
107
|
+
const { labels, acceptance, initOptions, onUploaded, onRejected, readError } = input;
|
|
108
|
+
const readFailure = useCallback((error) => readError?.(error) ?? readPhiMediaUploadErrorMessage(error, labels), [labels, readError]);
|
|
108
109
|
const runSession = input.runSession
|
|
109
110
|
?? runPhiMediaUploadSession;
|
|
110
111
|
const [items, setItems] = useState([]);
|
|
@@ -138,6 +139,7 @@ export function usePhiMediaUpload(input) {
|
|
|
138
139
|
localId,
|
|
139
140
|
file,
|
|
140
141
|
progress: 0,
|
|
142
|
+
phase: null,
|
|
141
143
|
status: "uploading",
|
|
142
144
|
error: null,
|
|
143
145
|
assetId: null,
|
|
@@ -148,14 +150,14 @@ export function usePhiMediaUpload(input) {
|
|
|
148
150
|
running.current.add(controller);
|
|
149
151
|
let asset;
|
|
150
152
|
try {
|
|
151
|
-
({ asset } = await runSession(file, (progress) => patch(localId, { progress }), fileInitOptions ?? initOptions, controller.signal));
|
|
153
|
+
({ asset } = await runSession(file, (progress) => patch(localId, { progress }), fileInitOptions ?? initOptions, controller.signal, (phase) => patch(localId, { phase })));
|
|
152
154
|
}
|
|
153
155
|
catch (error) {
|
|
154
156
|
if (controller.signal.aborted || isPhiMediaUploadCancelled(error)) {
|
|
155
157
|
setItems((current) => current.filter((item) => item.localId !== localId));
|
|
156
158
|
return null;
|
|
157
159
|
}
|
|
158
|
-
const message =
|
|
160
|
+
const message = readFailure(error);
|
|
159
161
|
patch(localId, { progress: 100, status: "error", error: message });
|
|
160
162
|
onRejected?.(message, file);
|
|
161
163
|
return null;
|
|
@@ -166,27 +168,28 @@ export function usePhiMediaUpload(input) {
|
|
|
166
168
|
// Stopped while finalize was answering: the Asset exists, but nobody is waiting to enter it.
|
|
167
169
|
if (controller.signal.aborted)
|
|
168
170
|
return null;
|
|
169
|
-
patch(localId, { progress: 100, status: "done", assetId: asset.id });
|
|
171
|
+
patch(localId, { progress: 100, status: "done", assetId: typeof asset.id === "number" ? asset.id : null });
|
|
170
172
|
try {
|
|
171
173
|
await onUploaded?.(asset, file);
|
|
172
174
|
}
|
|
173
175
|
catch (error) {
|
|
174
|
-
const message =
|
|
176
|
+
const message = readFailure(error);
|
|
175
177
|
patch(localId, { status: "error", error: message });
|
|
176
178
|
onRejected?.(message, file);
|
|
177
179
|
return null;
|
|
178
180
|
}
|
|
179
181
|
return asset;
|
|
180
|
-
}, [acceptance, initOptions, labels, onRejected, onUploaded, patch, runSession]);
|
|
182
|
+
}, [acceptance, initOptions, labels, onRejected, onUploaded, patch, readFailure, runSession]);
|
|
181
183
|
const upload = useCallback((file, fileInitOptions) => run(file, undefined, fileInitOptions), [run]);
|
|
182
184
|
/** Starts a failed item's file again, in the place it had. */
|
|
183
185
|
const retry = useCallback((localId) => {
|
|
184
186
|
const failed = items.find((item) => item.localId === localId && item.status === "error");
|
|
185
187
|
return failed ? run(failed.file, localId, failed.initOptions) : Promise.resolve(null);
|
|
186
188
|
}, [items, run]);
|
|
187
|
-
|
|
189
|
+
/** Stops what is on its way; `reason` reaches the runner as the signal's (a target may read it). */
|
|
190
|
+
const cancel = useCallback((reason) => {
|
|
188
191
|
for (const controller of running.current)
|
|
189
|
-
controller.abort();
|
|
192
|
+
controller.abort(reason);
|
|
190
193
|
}, []);
|
|
191
194
|
const reset = useCallback(() => setItems([]), []);
|
|
192
195
|
const uploading = items.some((item) => item.status === "uploading");
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LinkNode, type SerializedLinkNode } from "@lexical/link";
|
|
2
|
+
import { type DOMConversionMap, type LexicalNodeReplacement } from "lexical";
|
|
3
|
+
/** Keeps Page identity in authoring HTML; only the server render resolves it to an address. */
|
|
4
|
+
export declare class PhiHtmlLinkNode extends LinkNode {
|
|
5
|
+
static getType(): string;
|
|
6
|
+
static clone(node: PhiHtmlLinkNode): PhiHtmlLinkNode;
|
|
7
|
+
static importJSON(serializedNode: SerializedLinkNode): PhiHtmlLinkNode;
|
|
8
|
+
static importDOM(): DOMConversionMap;
|
|
9
|
+
sanitizeUrl(url: string): string;
|
|
10
|
+
}
|
|
11
|
+
/** Factories, commands and imports must all create the same node, including LinkNode transforms. */
|
|
12
|
+
export declare const PHI_HTML_LINK_NODE_REPLACEMENT: LexicalNodeReplacement;
|