@inspectorhub/field-ui 0.5.0 → 0.6.1
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 -0
- package/dist/{data-source-B3NrVs6i.d.ts → data-source-Do9_Rv50.d.ts} +20 -6
- package/dist/index.d.ts +9 -2
- package/dist/index.js +2602 -1952
- package/dist/testing.d.ts +3 -1
- package/dist/testing.js +3 -3
- package/dist/theme.css +8 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -65,6 +65,10 @@ What the host has to provide:
|
|
|
65
65
|
down explicitly; leaving the slot out does not turn the gate off.
|
|
66
66
|
- `slots.renderUnsavedGuard`, if leaving the editor with unsaved work should be
|
|
67
67
|
intercepted. Absent means leaving is never intercepted.
|
|
68
|
+
- `slots.renderStatus`, an optional status element of the host's own (an offline indicator, say). The editor shows it
|
|
69
|
+
beside the save state in the desktop header and in the phone and tablet app bars, and never in place of it. Absent,
|
|
70
|
+
nothing is added. The host owns its semantics. It must be pure and may be called more than once per render. It cannot
|
|
71
|
+
shrink or truncate, so keep it small: the phone app bar shares one row with the title.
|
|
68
72
|
- The theme (see Theme) and the peer dependencies (see below).
|
|
69
73
|
|
|
70
74
|
A member of `urls`, `resources` or `slots` that the host leaves out hides the
|
|
@@ -142,6 +146,11 @@ signatures):
|
|
|
142
146
|
optional `subscribe(listener)` and calls the listener whenever any photo address may have changed. The editor then asks
|
|
143
147
|
`photo()` again and its thumbnails, viewer and previews show the new address. Calls may be batched; `subscribe` returns
|
|
144
148
|
the unsubscribe function. Absent, nothing changes.
|
|
149
|
+
`photo()` also takes an optional third argument, `size`: a `PhotoSize` (`'thumb'`, `'view'` or `'original'`). It is a
|
|
150
|
+
hint. The editor asks for `thumb` in photo strips and the side-rail preview, and for `original` where the exact bytes
|
|
151
|
+
matter (the side-rail download, the source a crop or an annotation is made from, the photo studio). `view` is part
|
|
152
|
+
of the contract but nothing in the editor requests it yet. A host with smaller copies may return one for `thumb`
|
|
153
|
+
or `view`; a host without them ignores the argument and nothing changes.
|
|
145
154
|
- `resources`: `FieldResources`, optional capabilities (preferences, canned
|
|
146
155
|
comments, cost items, repair items, media pool, settings sheet, AI assist,
|
|
147
156
|
publish readiness, template search, version history, video). A member the
|
|
@@ -1162,7 +1162,11 @@ type PendingMediaRecord = (PendingMediaBase & {
|
|
|
1162
1162
|
meta: PhotoAnnotateMeta;
|
|
1163
1163
|
});
|
|
1164
1164
|
interface PendingMediaStore {
|
|
1165
|
-
/**
|
|
1165
|
+
/**
|
|
1166
|
+
* Must reject on failure. A host may attach a stable `code` to the error;
|
|
1167
|
+
* the editor recognizes `UNSUPPORTED_TYPE` and `TOO_LARGE` for safe photo
|
|
1168
|
+
* guidance. Unknown errors keep the generic rejection notice.
|
|
1169
|
+
*/
|
|
1166
1170
|
put(rec: PendingMediaRecord): Promise<void>;
|
|
1167
1171
|
get(pendingId: string): Promise<PendingMediaRecord | null>;
|
|
1168
1172
|
list(inspectionId?: string): Promise<PendingMediaRecord[]>;
|
|
@@ -1178,10 +1182,12 @@ interface MediaFileResult {
|
|
|
1178
1182
|
index: number;
|
|
1179
1183
|
ok: boolean;
|
|
1180
1184
|
key?: string;
|
|
1181
|
-
/** `NO_KEY`, `HTTP_<status>` or `EXCEPTION
|
|
1185
|
+
/** A fixed host code such as `TOO_LARGE`, `NO_KEY`, `HTTP_<status>` or `EXCEPTION`; never render arbitrary values. */
|
|
1182
1186
|
error?: string;
|
|
1183
1187
|
/** The upload failed but the host kept the bytes on the device (see `MediaUploader`): not a lost photo. */
|
|
1184
1188
|
kept?: boolean;
|
|
1189
|
+
/** The host refused the file itself (see `MediaUploader`): nothing is waiting to be saved, so it is not a failed save. */
|
|
1190
|
+
permanent?: boolean;
|
|
1185
1191
|
}
|
|
1186
1192
|
/**
|
|
1187
1193
|
* Online media upload. It is NOT a `FieldCommand`: the editor never routes photo
|
|
@@ -1199,7 +1205,8 @@ interface MediaFileResult {
|
|
|
1199
1205
|
* - `kind: 'crop'`: `key` is the derived `croppedKey`.
|
|
1200
1206
|
* - `kind: 'annotate'`: `key` is the derived `annotatedKey`.
|
|
1201
1207
|
*
|
|
1202
|
-
* Failure is `{ ok: false, error }` and never a throw.
|
|
1208
|
+
* Failure is `{ ok: false, error }` and never a throw. `permanent: true` says the host will refuse these very bytes every time
|
|
1209
|
+
* (the server rejected the file itself, not the connection): the offline drain then stops retrying the queued record. A host that stored the bytes on the device and wrote the
|
|
1203
1210
|
* pending entry itself (see `appendPendingPhoto`) adds `kept: true`: the photo is not lost and uploads later, so the
|
|
1204
1211
|
* editor counts it as saved on the device instead of as a failure.
|
|
1205
1212
|
*/
|
|
@@ -1212,6 +1219,7 @@ interface MediaUploader {
|
|
|
1212
1219
|
ok: false;
|
|
1213
1220
|
error: string;
|
|
1214
1221
|
kept?: true;
|
|
1222
|
+
permanent?: true;
|
|
1215
1223
|
}>;
|
|
1216
1224
|
}
|
|
1217
1225
|
|
|
@@ -1368,8 +1376,14 @@ interface CollabConnector {
|
|
|
1368
1376
|
}): ResultsDocHandle;
|
|
1369
1377
|
purge(inspectionId: string): Promise<void>;
|
|
1370
1378
|
}
|
|
1379
|
+
/** How much picture a caller needs: `thumb` (a tile), `view` (a full-screen viewer) or `original` (a download, or a crop or annotation source). */
|
|
1380
|
+
type PhotoSize = 'thumb' | 'view' | 'original';
|
|
1371
1381
|
interface FieldUrls {
|
|
1372
|
-
|
|
1382
|
+
/**
|
|
1383
|
+
* The address of a photo. `size` is an optional hint: a host with smaller copies may return one for `thumb` or
|
|
1384
|
+
* `view`; a host without them ignores it and answers as before. `original` is always the exact stored bytes.
|
|
1385
|
+
*/
|
|
1386
|
+
photo(inspectionId: string, key: string, size?: PhotoSize): string;
|
|
1373
1387
|
/**
|
|
1374
1388
|
* Optional. `photo()` is synchronous, so a host that can only produce an address later (a photo it fetches and
|
|
1375
1389
|
* caches, a signed address it renews) calls the listener whenever any photo address may have changed; the editor then
|
|
@@ -1588,5 +1602,5 @@ interface FieldDataSource {
|
|
|
1588
1602
|
platform: 'web' | 'ios' | 'android';
|
|
1589
1603
|
}
|
|
1590
1604
|
|
|
1591
|
-
export { METADATA_PRESETS as M, isDecodeImageError as
|
|
1592
|
-
export type {
|
|
1605
|
+
export { METADATA_PRESETS as M, isDecodeImageError as ax, resolvePcaNarrative as ay, DecodeImageError as t };
|
|
1606
|
+
export type { PropertyMetaField as $, AiAssistInput as A, BulkCreateUnitsBody as B, CommandResult as C, DateFormat as D, EditorData as E, FieldCommand as F, FieldResources as G, FieldUrls as H, InspectionPrefs as I, GalleryPhoto as J, InspectionUnit as K, MediaFileResult as L, MediaPoolListing as N, MediaUploader as O, NotifyOptions as P, NotifyVariant as Q, OutboundCoolingWindow as R, PcaNarrative as S, PcaNarrativeData as T, PendingMediaRecord as U, PendingMediaStore as V, PhotoAnnotateMeta as W, PhotoCropMeta as X, PhotoCropTransform as Y, PhotoSize as Z, PhotoUploadMeta as _, CommandData as a, PsqView as a0, PublishBlockingDefect as a1, PublishReadiness as a2, RatingLevel as a3, RelianceText as a4, RepairItemOption as a5, ReportLinkTtl as a6, ReportProfileOption as a7, ReportSignoffView as a8, ResultMap as a9, ResultsDocHandle as aa, RevisionStatus as ab, SaveStructureTemplateCommand as ac, SchemaItem as ad, SchemaSection as ae, SessionInfo as af, SettingsSheetData as ag, StatutoryCoverage as ah, StatutoryDetails as ai, TagLibraryEntry as aj, TemplateItemBody as ak, TemplateSchema as al, TemplateSearchResult as am, TemplateSnapshot as an, TemplateSummary as ao, TimeFormat as ap, UnitCommand as aq, UnitProgress as ar, VersionSnapshotContent as as, VersionSnapshotEntry as at, VideoFinalizeInput as au, VideoUploadRef as av, VideoUploadTicket as aw, FieldDataSource as b, AiAssistResult as c, AutoAdvanceMode as d, AutofillReason as e, CollabConnector as f, CommandDataMap as g, CommandKey as h, CommentsLibraryEntry as i, CommentsLibraryQuery as j, CommentsLibraryRow as k, CommercialPresets as l, ComplianceCommand as m, CompliancePanelData as n, CostItemView as o, CostItemWrite as p, CostItemsListing as q, CoverPhotoOption as r, DecodeImage as s, DecodeImageOptions as u, DecodedImage as v, DefectCategory as w, DocumentReviewItemView as x, EditorInspection as y, ExecuteOptions as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FieldCommand, C as CommandResult, a as CommandData, b as FieldDataSource, E as EditorData, I as InspectionPrefs } from './data-source-
|
|
2
|
-
export { A as AiAssistInput, c as AiAssistResult, d as AutoAdvanceMode, e as AutofillReason, B as BulkCreateUnitsBody, f as CollabConnector, g as CommandDataMap, h as CommandKey, i as CommentsLibraryEntry, j as CommentsLibraryQuery, k as CommentsLibraryRow, l as CommercialPresets, m as ComplianceCommand, n as CompliancePanelData, o as CostItemView, p as CostItemWrite, q as CostItemsListing, r as CoverPhotoOption, D as DateFormat, s as DecodeImage, t as DecodeImageError, u as DecodeImageOptions, v as DecodedImage, w as DefectCategory, x as DocumentReviewItemView, y as EditorInspection, z as ExecuteOptions, G as FieldResources, H as FieldUrls, J as GalleryPhoto, K as InspectionUnit, M as METADATA_PRESETS, L as MediaFileResult, N as MediaPoolListing, O as MediaUploader, P as NotifyOptions, Q as NotifyVariant, R as OutboundCoolingWindow, S as PcaNarrative, T as PcaNarrativeData, U as PendingMediaRecord, V as PendingMediaStore, W as PhotoAnnotateMeta, X as PhotoCropMeta, Y as PhotoCropTransform, Z as
|
|
1
|
+
import { F as FieldCommand, C as CommandResult, a as CommandData, b as FieldDataSource, E as EditorData, I as InspectionPrefs } from './data-source-Do9_Rv50.js';
|
|
2
|
+
export { A as AiAssistInput, c as AiAssistResult, d as AutoAdvanceMode, e as AutofillReason, B as BulkCreateUnitsBody, f as CollabConnector, g as CommandDataMap, h as CommandKey, i as CommentsLibraryEntry, j as CommentsLibraryQuery, k as CommentsLibraryRow, l as CommercialPresets, m as ComplianceCommand, n as CompliancePanelData, o as CostItemView, p as CostItemWrite, q as CostItemsListing, r as CoverPhotoOption, D as DateFormat, s as DecodeImage, t as DecodeImageError, u as DecodeImageOptions, v as DecodedImage, w as DefectCategory, x as DocumentReviewItemView, y as EditorInspection, z as ExecuteOptions, G as FieldResources, H as FieldUrls, J as GalleryPhoto, K as InspectionUnit, M as METADATA_PRESETS, L as MediaFileResult, N as MediaPoolListing, O as MediaUploader, P as NotifyOptions, Q as NotifyVariant, R as OutboundCoolingWindow, S as PcaNarrative, T as PcaNarrativeData, U as PendingMediaRecord, V as PendingMediaStore, W as PhotoAnnotateMeta, X as PhotoCropMeta, Y as PhotoCropTransform, Z as PhotoSize, _ as PhotoUploadMeta, $ as PropertyMetaField, a0 as PsqView, a1 as PublishBlockingDefect, a2 as PublishReadiness, a3 as RatingLevel, a4 as RelianceText, a5 as RepairItemOption, a6 as ReportLinkTtl, a7 as ReportProfileOption, a8 as ReportSignoffView, a9 as ResultMap, aa as ResultsDocHandle, ab as RevisionStatus, ac as SaveStructureTemplateCommand, ad as SchemaItem, ae as SchemaSection, af as SessionInfo, ag as SettingsSheetData, ah as StatutoryCoverage, ai as StatutoryDetails, aj as TagLibraryEntry, ak as TemplateItemBody, al as TemplateSchema, am as TemplateSearchResult, an as TemplateSnapshot, ao as TemplateSummary, ap as TimeFormat, aq as UnitCommand, ar as UnitProgress, as as VersionSnapshotContent, at as VersionSnapshotEntry, au as VideoFinalizeInput, av as VideoUploadRef, aw as VideoUploadTicket, ax as isDecodeImageError, ay as resolvePcaNarrative } from './data-source-Do9_Rv50.js';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
import * as Y from 'yjs';
|
|
@@ -50,6 +50,13 @@ interface FieldHostSlots {
|
|
|
50
50
|
renderUnsavedGuard?: (props: {
|
|
51
51
|
atRisk: boolean;
|
|
52
52
|
}) => ReactNode;
|
|
53
|
+
/**
|
|
54
|
+
* A status element of the host's own (an offline indicator, say), shown beside the save state in the editor's header
|
|
55
|
+
* (desktop) and app bar (phone and tablet). It adds to the save state and never replaces it. Absent, or returning
|
|
56
|
+
* nothing, leaves the header as it was. It must be pure: it may be called more than once per render. The host owns the element's semantics (role, live region) and should keep it
|
|
57
|
+
* small: the phone app bar shares one row with the title and the More button.
|
|
58
|
+
*/
|
|
59
|
+
renderStatus?: () => ReactNode;
|
|
53
60
|
/** Told which layout band the browser really shows (after mount, and on change); a host that remembers it returns it as `EditorData.initialLayout`. */
|
|
54
61
|
onLayoutObserved?: (layout: 'phone' | 'tablet' | 'desktop') => void;
|
|
55
62
|
}
|