@marktiderman/genesis-core 1.12.0 → 1.13.0
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 +32 -0
- package/dist/chunk-3B4IFDMK.js +117 -0
- package/dist/chunk-3B4IFDMK.js.map +1 -0
- package/dist/chunk-7FVTGKTX.js +8 -0
- package/dist/chunk-7FVTGKTX.js.map +1 -0
- package/dist/chunk-AUVKRXRC.js +81 -0
- package/dist/chunk-AUVKRXRC.js.map +1 -0
- package/dist/chunk-FARKPY6R.js +66 -0
- package/dist/chunk-FARKPY6R.js.map +1 -0
- package/dist/{chunk-OSPLIKSH.js → chunk-GEF5W2LO.js} +19 -9
- package/dist/chunk-GEF5W2LO.js.map +1 -0
- package/dist/{chunk-NMFABW4Y.js → chunk-JKZ2FVWK.js} +5 -5
- package/dist/{chunk-NMFABW4Y.js.map → chunk-JKZ2FVWK.js.map} +1 -1
- package/dist/{chunk-RCAP3Q4T.js → chunk-OYIUIW7C.js} +3 -2
- package/dist/chunk-OYIUIW7C.js.map +1 -0
- package/dist/{chunk-S2ZXUNXB.js → chunk-REYTMXAA.js} +3 -3
- package/dist/{chunk-S2ZXUNXB.js.map → chunk-REYTMXAA.js.map} +1 -1
- package/dist/{chunk-BGTXN2E6.js → chunk-RF6YVWHX.js} +4 -4
- package/dist/{chunk-BGTXN2E6.js.map → chunk-RF6YVWHX.js.map} +1 -1
- package/dist/{chunk-TOU2CMDH.js → chunk-TCL27Q5W.js} +167 -58
- package/dist/chunk-TCL27Q5W.js.map +1 -0
- package/dist/{chunk-NZPJI7FC.js → chunk-UGGMJUFQ.js} +45 -13
- package/dist/chunk-UGGMJUFQ.js.map +1 -0
- package/dist/{chunk-KXVHDK3Q.js → chunk-UV3ROHQA.js} +27 -5
- package/dist/chunk-UV3ROHQA.js.map +1 -0
- package/dist/chunk-YDDPFSQ6.js +35 -0
- package/dist/chunk-YDDPFSQ6.js.map +1 -0
- package/dist/csv.d.ts +41 -0
- package/dist/csv.js +77 -0
- package/dist/csv.js.map +1 -0
- package/dist/dates.js +1 -115
- package/dist/dates.js.map +1 -1
- package/dist/hooks/index.d.ts +7 -43
- package/dist/hooks/index.js +14 -12
- package/dist/hooks/live-cache.d.ts +15 -0
- package/dist/hooks/live-cache.js +3 -0
- package/dist/hooks/live-cache.js.map +1 -0
- package/dist/hooks/mutation-mode.d.ts +2 -2
- package/dist/hooks/mutation-mode.js +2 -2
- package/dist/hooks/related-keys.d.ts +2 -2
- package/dist/hooks/use-capabilities.d.ts +1 -1
- package/dist/hooks/use-infinite-resource.d.ts +18 -2
- package/dist/hooks/use-infinite-resource.js +4 -3
- package/dist/hooks/use-live.d.ts +15 -3
- package/dist/hooks/use-live.js +2 -1
- package/dist/hooks/use-one.d.ts +2 -2
- package/dist/hooks/use-one.js +4 -3
- package/dist/hooks/use-resource-form.d.ts +9 -2
- package/dist/hooks/use-resource-form.js +7 -6
- package/dist/hooks/use-resource.d.ts +2 -2
- package/dist/hooks/use-resource.js +5 -4
- package/dist/hooks/use-write.d.ts +2 -2
- package/dist/index.d.ts +13 -6
- package/dist/index.js +19 -15
- package/dist/provider/index.d.ts +11 -6
- package/dist/provider/index.js +2 -2
- package/dist/resource/index.d.ts +86 -0
- package/dist/resource/index.js +85 -0
- package/dist/resource/index.js.map +1 -0
- package/dist/resource-view/index.d.ts +285 -0
- package/dist/resource-view/index.js +320 -0
- package/dist/resource-view/index.js.map +1 -0
- package/dist/schema/index.d.ts +4 -4
- package/dist/schema/index.js +1 -0
- package/dist/testing/index.d.ts +3 -3
- package/dist/{types-B9DDfvWa.d.ts → types-CXhqXPN1.d.ts} +21 -4
- package/dist/{types-C7FJtFXV.d.ts → types-o8j7g6O6.d.ts} +38 -1
- package/dist/urls.d.ts +18 -0
- package/dist/urls.js +3 -0
- package/dist/urls.js.map +1 -0
- package/dist/viewer-scope-0dR-_o0f.d.ts +76 -0
- package/dist/{write-outcome-B2fE29yZ.d.ts → write-outcome-CFnpciUI.d.ts} +1 -1
- package/package.json +17 -1
- package/dist/chunk-5ORRAXIV.js +0 -30
- package/dist/chunk-5ORRAXIV.js.map +0 -1
- package/dist/chunk-KXVHDK3Q.js.map +0 -1
- package/dist/chunk-NZPJI7FC.js.map +0 -1
- package/dist/chunk-OSPLIKSH.js.map +0 -1
- package/dist/chunk-RCAP3Q4T.js.map +0 -1
- package/dist/chunk-TOU2CMDH.js.map +0 -1
package/dist/hooks/index.d.ts
CHANGED
|
@@ -5,52 +5,16 @@ export { useCapabilities } from './use-capabilities.js';
|
|
|
5
5
|
export { UseWriteOptions, UseWriteReturn, WRITE_FAILED, useWrite } from './use-write.js';
|
|
6
6
|
export { UseDraftReturn, useDraft } from './use-draft.js';
|
|
7
7
|
export { DEFAULT_DRAFT_DELAY_MS, DRAFT_NOT_SAVED, DraftAdoption, DraftController, DraftOptions, DraftSeed, DraftState, DraftStatus, DraftValue, isNetworkFailure, stableJson } from './draft-controller.js';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import { QueryClient } from '@tanstack/react-query';
|
|
11
|
-
export { DEFAULT_LIVE_DEBOUNCE_MS, LiveOptions } from './use-live.js';
|
|
8
|
+
export { R as ResourceScope, V as ViewerContext, a as ViewerScope, b as ViewerScopeProps, c as clearViewerCache, u as useOptionalViewerScope, d as useViewerScope } from '../viewer-scope-0dR-_o0f.js';
|
|
9
|
+
export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS, LiveOptions } from './use-live.js';
|
|
12
10
|
export { UseResourceFormOptions, UseResourceFormReturn, buildArrayItemDefaults, useResourceForm } from './use-resource-form.js';
|
|
13
11
|
export { UseWizardReturn, WizardStep, useWizard } from './use-wizard.js';
|
|
14
12
|
export { DEFAULT_UNDO_DELAY_MS, MutationMode, MutationModeOptions, UndoableWrite, dropPendingWrites, flushPendingWrites, pendingWriteCount } from './mutation-mode.js';
|
|
15
13
|
export { DEFAULT_UNSAVED_CHANGES_MESSAGE, UseUnsavedChangesGuardOptions, UseUnsavedChangesGuardReturn, useUnsavedChangesGuard } from './use-unsaved-changes-guard.js';
|
|
16
|
-
import '
|
|
17
|
-
import '../types-
|
|
14
|
+
import '@tanstack/react-query';
|
|
15
|
+
import '../types-CXhqXPN1.js';
|
|
16
|
+
import '../types-o8j7g6O6.js';
|
|
18
17
|
import '../form-types.js';
|
|
18
|
+
import 'react';
|
|
19
|
+
import '../dates.js';
|
|
19
20
|
import 'react-hook-form';
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Empties the query cache for a new viewer: sends the old viewer's waiting
|
|
23
|
-
* undoable writes (the session is still theirs), cancels reads in flight,
|
|
24
|
-
* then removes every query. Call it in the sign-in and sign-out actions,
|
|
25
|
-
* before the session changes.
|
|
26
|
-
*/
|
|
27
|
-
declare function clearViewerCache(queryClient: QueryClient): Promise<void>;
|
|
28
|
-
interface ViewerScopeProps {
|
|
29
|
-
/** The signed-in viewer's id, null when signed out, undefined while the session loads. */
|
|
30
|
-
viewer: string | null | undefined;
|
|
31
|
-
/**
|
|
32
|
-
* The viewer a persisted cache was saved for. When the first known viewer
|
|
33
|
-
* is this one, the restored cache is kept; otherwise it's emptied.
|
|
34
|
-
*/
|
|
35
|
-
persistedViewer?: string | null;
|
|
36
|
-
/** Shown while the session loads (and for the one render a change takes). */
|
|
37
|
-
fallback?: ReactNode;
|
|
38
|
-
children: ReactNode;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Keeps one viewer's cached data from ever showing to the next. Children
|
|
42
|
-
* render only once the viewer is known, under a key of that viewer, so a
|
|
43
|
-
* sign-out or a new person signing in unmounts every screen and its queries
|
|
44
|
-
* before the cache is emptied and the new viewer's screens mount fresh. The
|
|
45
|
-
* first known viewer empties a restored cache too, unless it's the
|
|
46
|
-
* `persistedViewer` it was saved for.
|
|
47
|
-
*
|
|
48
|
-
* ```tsx
|
|
49
|
-
* <ViewerScope viewer={session === undefined ? undefined : (session?.user.id ?? null)}>
|
|
50
|
-
* <App />
|
|
51
|
-
* </ViewerScope>
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
declare function ViewerScope({ viewer, persistedViewer, fallback, children }: ViewerScopeProps): react.JSX.Element;
|
|
55
|
-
|
|
56
|
-
export { ViewerScope, type ViewerScopeProps, clearViewerCache };
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
export { ViewerScope, clearViewerCache } from '../chunk-
|
|
2
|
-
export {
|
|
1
|
+
export { ViewerScope, clearViewerCache, useOptionalViewerScope, useViewerScope } from '../chunk-FARKPY6R.js';
|
|
2
|
+
export { buildArrayItemDefaults, useResourceForm } from '../chunk-GEF5W2LO.js';
|
|
3
|
+
export { useOne } from '../chunk-RF6YVWHX.js';
|
|
4
|
+
export { useResource } from '../chunk-JKZ2FVWK.js';
|
|
5
|
+
export { DEFAULT_UNSAVED_CHANGES_MESSAGE, useUnsavedChangesGuard } from '../chunk-XQO4OH2N.js';
|
|
3
6
|
export { useWizard } from '../chunk-7KOLYF27.js';
|
|
4
7
|
export { WRITE_FAILED, useWrite } from '../chunk-52T2EYXH.js';
|
|
5
|
-
export {
|
|
6
|
-
export { useInfiniteResource } from '../chunk-NZPJI7FC.js';
|
|
7
|
-
export { buildArrayItemDefaults, useResourceForm } from '../chunk-OSPLIKSH.js';
|
|
8
|
-
export { DEFAULT_UNSAVED_CHANGES_MESSAGE, useUnsavedChangesGuard } from '../chunk-XQO4OH2N.js';
|
|
9
|
-
export { DEFAULT_UNDO_DELAY_MS, dropPendingWrites, flushPendingWrites, pendingWriteCount } from '../chunk-S2ZXUNXB.js';
|
|
8
|
+
export { DEFAULT_UNDO_DELAY_MS, dropPendingWrites, flushPendingWrites, pendingWriteCount } from '../chunk-REYTMXAA.js';
|
|
10
9
|
import '../chunk-7NUL32W7.js';
|
|
11
10
|
export { useCapabilities } from '../chunk-BQOJX67X.js';
|
|
12
|
-
export {
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
export { useDraft } from '../chunk-DF2UWEEB.js';
|
|
12
|
+
export { DEFAULT_DRAFT_DELAY_MS, DRAFT_NOT_SAVED, DraftController, isNetworkFailure, stableJson } from '../chunk-HBAPYA5K.js';
|
|
13
|
+
import '../chunk-LG6TUBVM.js';
|
|
14
|
+
export { useInfiniteResource } from '../chunk-UGGMJUFQ.js';
|
|
15
|
+
export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS } from '../chunk-UV3ROHQA.js';
|
|
16
|
+
import '../chunk-AUVKRXRC.js';
|
|
17
|
+
import '../chunk-OYIUIW7C.js';
|
|
15
18
|
import '../chunk-GGSXSI6Z.js';
|
|
16
19
|
import '../chunk-ZYJUEJ4Z.js';
|
|
20
|
+
import '../chunk-3B4IFDMK.js';
|
|
17
21
|
import '../chunk-RYEXWQFD.js';
|
|
18
|
-
export { DEFAULT_DRAFT_DELAY_MS, DRAFT_NOT_SAVED, DraftController, isNetworkFailure, stableJson } from '../chunk-HBAPYA5K.js';
|
|
19
|
-
import '../chunk-LG6TUBVM.js';
|
|
20
22
|
//# sourceMappingURL=index.js.map
|
|
21
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Query, QueryClient } from '@tanstack/react-query';
|
|
2
|
+
|
|
3
|
+
type Row = Record<string, unknown>;
|
|
4
|
+
/**
|
|
5
|
+
* Patches a changed row into every cached read of `resource`: records read whole (no `select`),
|
|
6
|
+
* and the rows of lists and infinite lists. Fields a cached row lacks are left out.
|
|
7
|
+
*/
|
|
8
|
+
declare function patchCachedRow(queryClient: QueryClient, resource: string, record: Row): void;
|
|
9
|
+
/**
|
|
10
|
+
* Whether a cached list could be changed by these rows: one of them matches its filters, or is in
|
|
11
|
+
* it now (it may have left). Any read that isn't a list could always change.
|
|
12
|
+
*/
|
|
13
|
+
declare function listCouldChange(query: Query, records: readonly Row[]): boolean;
|
|
14
|
+
|
|
15
|
+
export { listCouldChange, patchCachedRow };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"live-cache.js"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QueryClient } from '@tanstack/react-query';
|
|
2
|
-
import { a as Identifier, B as BaseRecord, D as DataProvider } from '../types-
|
|
3
|
-
import { A as AuditEntry } from '../types-
|
|
2
|
+
import { a as Identifier, B as BaseRecord, D as DataProvider } from '../types-CXhqXPN1.js';
|
|
3
|
+
import { A as AuditEntry } from '../types-o8j7g6O6.js';
|
|
4
4
|
import '../form-types.js';
|
|
5
5
|
|
|
6
6
|
type MutationMode = "pessimistic" | "optimistic" | "undoable";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { DEFAULT_UNDO_DELAY_MS, DROPPED_WRITE_MESSAGE, cachedRecord, dropPendingWrites, executeWrite, flushPendingWrites, invalidateResource, pendingWriteCount, providerServesUndo, sameValue } from '../chunk-
|
|
1
|
+
export { DEFAULT_UNDO_DELAY_MS, DROPPED_WRITE_MESSAGE, cachedRecord, dropPendingWrites, executeWrite, flushPendingWrites, invalidateResource, pendingWriteCount, providerServesUndo, sameValue } from '../chunk-REYTMXAA.js';
|
|
2
2
|
import '../chunk-BQOJX67X.js';
|
|
3
|
-
import '../chunk-
|
|
3
|
+
import '../chunk-OYIUIW7C.js';
|
|
4
4
|
import '../chunk-GGSXSI6Z.js';
|
|
5
5
|
import '../chunk-ZYJUEJ4Z.js';
|
|
6
6
|
//# sourceMappingURL=mutation-mode.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as DataProvider, W as WriteEvent, I as InvalidationKey } from '../types-
|
|
2
|
-
import '../types-
|
|
1
|
+
import { D as DataProvider, W as WriteEvent, I as InvalidationKey } from '../types-CXhqXPN1.js';
|
|
2
|
+
import '../types-o8j7g6O6.js';
|
|
3
3
|
import '../form-types.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UseInfiniteQueryResult, InfiniteData } from '@tanstack/react-query';
|
|
2
|
-
import {
|
|
2
|
+
import { S as SortParam, F as FilterParam, l as ListResult, L as ListParams, B as BaseRecord } from '../types-CXhqXPN1.js';
|
|
3
3
|
import { LiveOptions } from './use-live.js';
|
|
4
|
-
import '../types-
|
|
4
|
+
import '../types-o8j7g6O6.js';
|
|
5
5
|
import '../form-types.js';
|
|
6
6
|
|
|
7
7
|
interface UseInfiniteResourceOptions {
|
|
@@ -20,6 +20,17 @@ interface UseInfiniteResourceOptions {
|
|
|
20
20
|
enabled?: boolean;
|
|
21
21
|
/** Refetch the loaded pages when the provider reports a change. See `UseResourceOptions.live`. */
|
|
22
22
|
live?: boolean | LiveOptions;
|
|
23
|
+
/**
|
|
24
|
+
* Keep at most this many pages loaded (TanStack Query's `maxPages`): scrolling far drops pages
|
|
25
|
+
* from the front, and scrolling back loads them again, so a long feed and a live refetch stay
|
|
26
|
+
* cheap. Needs a provider that pages by cursor both ways (`prevCursor`); offset paging ignores it.
|
|
27
|
+
*/
|
|
28
|
+
maxPages?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Keep the current rows on screen while a new search, sort or filter loads, instead of a
|
|
31
|
+
* loading state for each change. Default false.
|
|
32
|
+
*/
|
|
33
|
+
keepPreviousData?: boolean;
|
|
23
34
|
}
|
|
24
35
|
/** Where one page starts: its offset page, and its cursor (`null` for the first). */
|
|
25
36
|
interface InfinitePageParam {
|
|
@@ -33,9 +44,14 @@ interface UseInfiniteResourceReturn<T> {
|
|
|
33
44
|
rows: T[];
|
|
34
45
|
/** Rows matching the filters and search, from the first page's count. */
|
|
35
46
|
total: number | undefined;
|
|
47
|
+
/** True when `total` is the database's estimate, so a screen says "about". */
|
|
48
|
+
totalIsEstimate: boolean;
|
|
36
49
|
/** Loads the next page. Does nothing while one is loading or none is left. */
|
|
37
50
|
fetchNextPage: () => void;
|
|
38
51
|
hasNextPage: boolean;
|
|
52
|
+
/** Load the page before the first loaded one (after `maxPages` dropped it). No-op when there is none. */
|
|
53
|
+
fetchPreviousPage: () => void;
|
|
54
|
+
hasPreviousPage: boolean;
|
|
39
55
|
isFetchingNextPage: boolean;
|
|
40
56
|
/** The params every page is asked with (without its page and cursor). */
|
|
41
57
|
params: Omit<ListParams, "pagination"> & {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { useInfiniteResource } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
export { useInfiniteResource } from '../chunk-UGGMJUFQ.js';
|
|
2
|
+
import '../chunk-UV3ROHQA.js';
|
|
3
|
+
import '../chunk-AUVKRXRC.js';
|
|
4
|
+
import '../chunk-OYIUIW7C.js';
|
|
4
5
|
import '../chunk-GGSXSI6Z.js';
|
|
5
6
|
import '../chunk-ZYJUEJ4Z.js';
|
|
6
7
|
//# sourceMappingURL=use-infinite-resource.js.map
|
package/dist/hooks/use-live.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { QueryKey } from '@tanstack/react-query';
|
|
2
|
-
import {
|
|
3
|
-
import '../types-
|
|
2
|
+
import { p as SubscribeParams, m as ResourceChangeEvent } from '../types-CXhqXPN1.js';
|
|
3
|
+
import '../types-o8j7g6O6.js';
|
|
4
4
|
import '../form-types.js';
|
|
5
5
|
|
|
6
6
|
/** How long a burst of change events is gathered into one refetch. */
|
|
7
7
|
declare const DEFAULT_LIVE_DEBOUNCE_MS = 250;
|
|
8
|
+
/**
|
|
9
|
+
* How often a live read refetches anyway while the page is visible. Realtime checks each change
|
|
10
|
+
* against the row's new state, so a row the viewer stops being allowed to see (binned, made a
|
|
11
|
+
* draft, moved to another practice) sends them nothing and would stay on screen.
|
|
12
|
+
*/
|
|
13
|
+
declare const DEFAULT_LIVE_RESYNC_MS = 60000;
|
|
8
14
|
/** `live` as an object, to tune it. `live: true` takes the defaults. */
|
|
9
15
|
interface LiveOptions {
|
|
10
16
|
/**
|
|
@@ -13,6 +19,12 @@ interface LiveOptions {
|
|
|
13
19
|
* steady stream still refetches at least every `4 × debounceMs`.
|
|
14
20
|
*/
|
|
15
21
|
debounceMs?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Refetch at least this often while the page is visible, for the changes realtime can't
|
|
24
|
+
* deliver (a row the viewer may no longer read). Default {@link DEFAULT_LIVE_RESYNC_MS}; 0 turns
|
|
25
|
+
* it off.
|
|
26
|
+
*/
|
|
27
|
+
resyncMs?: number;
|
|
16
28
|
}
|
|
17
29
|
/**
|
|
18
30
|
* Subscribes while mounted and `enabled`, and invalidates `queryKey` (a
|
|
@@ -24,4 +36,4 @@ interface LiveOptions {
|
|
|
24
36
|
*/
|
|
25
37
|
declare function useLiveInvalidation(resource: string, live: boolean | LiveOptions | undefined, enabled: boolean, params: SubscribeParams, queryKey: QueryKey, accept?: (event: ResourceChangeEvent) => boolean): void;
|
|
26
38
|
|
|
27
|
-
export { DEFAULT_LIVE_DEBOUNCE_MS, type LiveOptions, useLiveInvalidation };
|
|
39
|
+
export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS, type LiveOptions, useLiveInvalidation };
|
package/dist/hooks/use-live.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { DEFAULT_LIVE_DEBOUNCE_MS, useLiveInvalidation } from '../chunk-
|
|
1
|
+
export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS, useLiveInvalidation } from '../chunk-UV3ROHQA.js';
|
|
2
|
+
import '../chunk-AUVKRXRC.js';
|
|
2
3
|
import '../chunk-GGSXSI6Z.js';
|
|
3
4
|
import '../chunk-ZYJUEJ4Z.js';
|
|
4
5
|
//# sourceMappingURL=use-live.js.map
|
package/dist/hooks/use-one.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import { B as BaseRecord, a as Identifier } from '../types-
|
|
2
|
+
import { B as BaseRecord, a as Identifier } from '../types-CXhqXPN1.js';
|
|
3
3
|
import { LiveOptions } from './use-live.js';
|
|
4
|
-
import '../types-
|
|
4
|
+
import '../types-o8j7g6O6.js';
|
|
5
5
|
import '../form-types.js';
|
|
6
6
|
|
|
7
7
|
interface UseOneOptions {
|
package/dist/hooks/use-one.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { useOne } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
export { useOne } from '../chunk-RF6YVWHX.js';
|
|
2
|
+
import '../chunk-UV3ROHQA.js';
|
|
3
|
+
import '../chunk-AUVKRXRC.js';
|
|
4
|
+
import '../chunk-OYIUIW7C.js';
|
|
4
5
|
import '../chunk-GGSXSI6Z.js';
|
|
5
6
|
import '../chunk-ZYJUEJ4Z.js';
|
|
6
7
|
//# sourceMappingURL=use-one.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { UseFormReturn } from 'react-hook-form';
|
|
2
2
|
import { ResourceFormFieldDef } from '../form-types.js';
|
|
3
|
-
import { I as InvalidationKey } from '../types-
|
|
3
|
+
import { I as InvalidationKey } from '../types-CXhqXPN1.js';
|
|
4
4
|
import { MutationModeOptions } from './mutation-mode.js';
|
|
5
|
-
import '../types-
|
|
5
|
+
import '../types-o8j7g6O6.js';
|
|
6
6
|
import '@tanstack/react-query';
|
|
7
7
|
|
|
8
8
|
interface UseResourceFormOptions extends MutationModeOptions {
|
|
@@ -67,6 +67,13 @@ interface UseResourceFormOptions extends MutationModeOptions {
|
|
|
67
67
|
* the provider's own `invalidates`.
|
|
68
68
|
*/
|
|
69
69
|
invalidates?: InvalidationKey[];
|
|
70
|
+
/**
|
|
71
|
+
* What an edit sends. `"loaded"` (default): every field of the record the form opened with,
|
|
72
|
+
* plus any field the person changed, but never a field the record didn't carry and nobody
|
|
73
|
+
* touched. So a list that didn't load a column (or a value the server left out) can't be
|
|
74
|
+
* overwritten with an empty one. `"all"`: every form field, as before.
|
|
75
|
+
*/
|
|
76
|
+
updates?: "loaded" | "all";
|
|
70
77
|
}
|
|
71
78
|
interface UseResourceFormReturn {
|
|
72
79
|
form: UseFormReturn<Record<string, unknown>>;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
export { buildArrayItemDefaults, useResourceForm } from '../chunk-
|
|
1
|
+
export { buildArrayItemDefaults, useResourceForm } from '../chunk-GEF5W2LO.js';
|
|
2
|
+
import '../chunk-RF6YVWHX.js';
|
|
2
3
|
import '../chunk-XQO4OH2N.js';
|
|
3
|
-
import '../chunk-
|
|
4
|
+
import '../chunk-REYTMXAA.js';
|
|
4
5
|
import '../chunk-7NUL32W7.js';
|
|
5
6
|
import '../chunk-BQOJX67X.js';
|
|
6
|
-
import '../chunk-
|
|
7
|
-
import '../chunk-
|
|
8
|
-
import '../chunk-
|
|
7
|
+
import '../chunk-LG6TUBVM.js';
|
|
8
|
+
import '../chunk-UV3ROHQA.js';
|
|
9
|
+
import '../chunk-AUVKRXRC.js';
|
|
10
|
+
import '../chunk-OYIUIW7C.js';
|
|
9
11
|
import '../chunk-GGSXSI6Z.js';
|
|
10
12
|
import '../chunk-ZYJUEJ4Z.js';
|
|
11
13
|
import '../chunk-RYEXWQFD.js';
|
|
12
|
-
import '../chunk-LG6TUBVM.js';
|
|
13
14
|
//# sourceMappingURL=use-resource-form.js.map
|
|
14
15
|
//# sourceMappingURL=use-resource-form.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { UseQueryResult, UseMutationResult } from '@tanstack/react-query';
|
|
2
|
-
import {
|
|
2
|
+
import { S as SortParam, F as FilterParam, I as InvalidationKey, l as ListResult, L as ListParams, a as Identifier, B as BaseRecord } from '../types-CXhqXPN1.js';
|
|
3
3
|
import { MutationModeOptions } from './mutation-mode.js';
|
|
4
4
|
import { LiveOptions } from './use-live.js';
|
|
5
|
-
import '../types-
|
|
5
|
+
import '../types-o8j7g6O6.js';
|
|
6
6
|
import '../form-types.js';
|
|
7
7
|
|
|
8
8
|
interface UseResourceOptions<T> extends MutationModeOptions {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export { useResource } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
1
|
+
export { useResource } from '../chunk-JKZ2FVWK.js';
|
|
2
|
+
import '../chunk-REYTMXAA.js';
|
|
3
3
|
import '../chunk-7NUL32W7.js';
|
|
4
4
|
import '../chunk-BQOJX67X.js';
|
|
5
|
-
import '../chunk-
|
|
6
|
-
import '../chunk-
|
|
5
|
+
import '../chunk-UV3ROHQA.js';
|
|
6
|
+
import '../chunk-AUVKRXRC.js';
|
|
7
|
+
import '../chunk-OYIUIW7C.js';
|
|
7
8
|
import '../chunk-GGSXSI6Z.js';
|
|
8
9
|
import '../chunk-ZYJUEJ4Z.js';
|
|
9
10
|
//# sourceMappingURL=use-resource.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QueryClient, MutationOptions } from '@tanstack/react-query';
|
|
2
|
-
import { I as InvalidationKey } from '../types-
|
|
3
|
-
import '../types-
|
|
2
|
+
import { I as InvalidationKey } from '../types-CXhqXPN1.js';
|
|
3
|
+
import '../types-o8j7g6O6.js';
|
|
4
4
|
import '../form-types.js';
|
|
5
5
|
|
|
6
6
|
declare const WRITE_FAILED = "That didn't work. Try again.";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { L as ListParams, a as Identifier } from './types-
|
|
2
|
-
export { A as ArrayFilter, B as BaseRecord, b as BulkChange, c as BulkResult, C as
|
|
3
|
-
export { D as DataWriteError, a as DataWriteErrorOptions, W as WriteOutcome, i as isDataWriteError } from './write-outcome-
|
|
1
|
+
import { L as ListParams, a as Identifier } from './types-CXhqXPN1.js';
|
|
2
|
+
export { A as ArrayFilter, B as BaseRecord, b as BulkChange, c as BulkResult, C as CountMode, d as CreateParams, e as CreateResult, D as DataProvider, f as DeleteParams, g as DeleteResult, F as FilterParam, G as GetManyParams, h as GetManyResult, i as GetOneParams, j as GetOneResult, H as HistoryParams, k as ImportParams, I as InvalidationKey, l as ListResult, N as NullFilter, P as PaginationParam, R as RangeFilter, m as ResourceChangeEvent, n as RowFailure, o as ScalarFilter, S as SortParam, p as SubscribeParams, U as UpdateParams, q as UpdateResult, W as WriteEvent } from './types-CXhqXPN1.js';
|
|
3
|
+
export { D as DataWriteError, a as DataWriteErrorOptions, W as WriteOutcome, i as isDataWriteError } from './write-outcome-CFnpciUI.js';
|
|
4
4
|
export { CallRpcOptions, CreateOrAdoptOptions, CreateOrAdoptResult, DEFAULT_RPC_MESSAGES, DataProviderRoot, DataProviderRootProps, GenesisProvider, GenesisProviderProps, MockProviderOptions, PostgrestFieldErrors, RPC_FAILED, RpcClient, SupabaseClient, SupabaseClientInput, SupabaseProviderOptions, SupabaseRealtimeChannel, SupabaseRealtimePayload, SupabaseResourceConfig, SupabaseWriteContext, callRpc, createMockProvider, createOrAdopt, createSupabaseProvider, fieldErrorsFromPostgrest, readOutcomeFromCode, toDataWriteError, useDataProvider, useStorage, writeOutcomeFromCode } from './provider/index.js';
|
|
5
5
|
export { D as DataReadError, a as DataReadErrorOptions, R as ReadOutcome, i as isDataReadError, r as readFailureMessage } from './read-outcome-BnboMYOV.js';
|
|
6
6
|
export { S as StorageAdapter } from './types-DKcxHXxq.js';
|
|
@@ -12,18 +12,20 @@ export { useCapabilities } from './hooks/use-capabilities.js';
|
|
|
12
12
|
export { UseWriteOptions, UseWriteReturn, WRITE_FAILED, useWrite } from './hooks/use-write.js';
|
|
13
13
|
export { UseDraftReturn, useDraft } from './hooks/use-draft.js';
|
|
14
14
|
export { DEFAULT_DRAFT_DELAY_MS, DRAFT_NOT_SAVED, DraftAdoption, DraftController, DraftOptions, DraftSeed, DraftState, DraftStatus, DraftValue, isNetworkFailure, stableJson } from './hooks/draft-controller.js';
|
|
15
|
-
export { ViewerScope, ViewerScopeProps, clearViewerCache } from './
|
|
16
|
-
export { DEFAULT_LIVE_DEBOUNCE_MS, LiveOptions } from './hooks/use-live.js';
|
|
15
|
+
export { R as ResourceScope, V as ViewerContext, a as ViewerScope, b as ViewerScopeProps, c as clearViewerCache, u as useOptionalViewerScope, d as useViewerScope } from './viewer-scope-0dR-_o0f.js';
|
|
16
|
+
export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS, LiveOptions } from './hooks/use-live.js';
|
|
17
17
|
export { UseResourceFormOptions, UseResourceFormReturn, buildArrayItemDefaults, useResourceForm } from './hooks/use-resource-form.js';
|
|
18
18
|
export { UseWizardReturn, WizardStep, useWizard } from './hooks/use-wizard.js';
|
|
19
19
|
export { DEFAULT_UNDO_DELAY_MS, MutationMode, MutationModeOptions, UndoableWrite, dropPendingWrites, flushPendingWrites, pendingWriteCount } from './hooks/mutation-mode.js';
|
|
20
20
|
export { DEFAULT_UNSAVED_CHANGES_MESSAGE, UseUnsavedChangesGuardOptions, UseUnsavedChangesGuardReturn, useUnsavedChangesGuard } from './hooks/use-unsaved-changes-guard.js';
|
|
21
21
|
export { FieldType, ResourceFormFieldDef, SelectOption, FieldType as WidgetHint } from './form-types.js';
|
|
22
|
-
export { A as AuditEntry, D as DataRow,
|
|
22
|
+
export { A as AuditEntry, D as DataRow, a as FieldPermissions, b as FieldReference, F as FieldSchema, c as FilterOperator, P as ProviderCapabilities, R as RecordComment, d as ResourceAccess, e as ResourceContract, f as ResourceRelation, g as ResourceSchema, h as ResourceSummary, i as RowAction, j as RowOf, S as StorageType, V as VersionField, k as defineResource } from './types-o8j7g6O6.js';
|
|
23
23
|
export { decodeRecordKey, encodeRecordKey, keyFields } from './schema/index.js';
|
|
24
24
|
import { Query } from '@tanstack/react-query';
|
|
25
|
+
export { isSafeUrl, normalizeLinkUrl } from './urls.js';
|
|
25
26
|
export { titleCase } from './utils.js';
|
|
26
27
|
import 'react';
|
|
28
|
+
import './dates.js';
|
|
27
29
|
import 'react-hook-form';
|
|
28
30
|
|
|
29
31
|
/** Who and when a key is for. `viewer` is required; null means signed out. */
|
|
@@ -33,6 +35,11 @@ interface KeyScope {
|
|
|
33
35
|
group?: string | null;
|
|
34
36
|
/** The person-day (YYYY-MM-DD) a "today" read is for. */
|
|
35
37
|
day?: string | null;
|
|
38
|
+
/**
|
|
39
|
+
* Where the viewer is working (ViewerScope's `scope`: practice, person, space…). Part of every
|
|
40
|
+
* key, so the same query for two practices never shares a cache entry.
|
|
41
|
+
*/
|
|
42
|
+
scope?: Readonly<Record<string, unknown>>;
|
|
36
43
|
}
|
|
37
44
|
type Fields = Record<string, unknown>;
|
|
38
45
|
type QueryDefs = Record<string, (...args: never[]) => Fields>;
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
export { DEFAULT_RPC_MESSAGES, RPC_FAILED, callRpc, createOrAdopt, createSupabaseProvider, fieldErrorsFromPostgrest, readOutcomeFromCode, toDataWriteError, writeOutcomeFromCode } from './chunk-TOU2CMDH.js';
|
|
2
|
-
export { decodeRecordKey, encodeRecordKey, keyFields } from './chunk-KV2HW4G4.js';
|
|
3
1
|
import './chunk-XCX2TRBL.js';
|
|
2
|
+
export { defineResource } from './chunk-7FVTGKTX.js';
|
|
3
|
+
export { decodeRecordKey, encodeRecordKey, keyFields } from './chunk-KV2HW4G4.js';
|
|
4
|
+
export { DEFAULT_RPC_MESSAGES, RPC_FAILED, callRpc, createOrAdopt, createSupabaseProvider, fieldErrorsFromPostgrest, readOutcomeFromCode, toDataWriteError, writeOutcomeFromCode } from './chunk-TCL27Q5W.js';
|
|
4
5
|
export { DataReadError, isDataReadError, readFailureMessage } from './chunk-HUNGCTRA.js';
|
|
5
|
-
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
6
|
+
export { ViewerScope, clearViewerCache, useOptionalViewerScope, useViewerScope } from './chunk-FARKPY6R.js';
|
|
7
|
+
export { buildArrayItemDefaults, useResourceForm } from './chunk-GEF5W2LO.js';
|
|
8
|
+
export { useOne } from './chunk-RF6YVWHX.js';
|
|
9
|
+
export { useResource } from './chunk-JKZ2FVWK.js';
|
|
10
|
+
export { DEFAULT_UNSAVED_CHANGES_MESSAGE, useUnsavedChangesGuard } from './chunk-XQO4OH2N.js';
|
|
8
11
|
export { useWizard } from './chunk-7KOLYF27.js';
|
|
9
12
|
export { WRITE_FAILED, useWrite } from './chunk-52T2EYXH.js';
|
|
10
|
-
export {
|
|
11
|
-
export { useInfiniteResource } from './chunk-NZPJI7FC.js';
|
|
12
|
-
export { buildArrayItemDefaults, useResourceForm } from './chunk-OSPLIKSH.js';
|
|
13
|
-
export { DEFAULT_UNSAVED_CHANGES_MESSAGE, useUnsavedChangesGuard } from './chunk-XQO4OH2N.js';
|
|
14
|
-
export { DEFAULT_UNDO_DELAY_MS, dropPendingWrites, flushPendingWrites, pendingWriteCount } from './chunk-S2ZXUNXB.js';
|
|
13
|
+
export { DEFAULT_UNDO_DELAY_MS, dropPendingWrites, flushPendingWrites, pendingWriteCount } from './chunk-REYTMXAA.js';
|
|
15
14
|
import './chunk-7NUL32W7.js';
|
|
16
15
|
export { useCapabilities } from './chunk-BQOJX67X.js';
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
16
|
+
export { useDraft } from './chunk-DF2UWEEB.js';
|
|
17
|
+
export { DEFAULT_DRAFT_DELAY_MS, DRAFT_NOT_SAVED, DraftController, isNetworkFailure, stableJson } from './chunk-HBAPYA5K.js';
|
|
18
|
+
export { DataWriteError, isDataWriteError } from './chunk-LG6TUBVM.js';
|
|
19
|
+
export { useInfiniteResource } from './chunk-UGGMJUFQ.js';
|
|
20
|
+
export { DEFAULT_LIVE_DEBOUNCE_MS, DEFAULT_LIVE_RESYNC_MS } from './chunk-UV3ROHQA.js';
|
|
21
|
+
import './chunk-AUVKRXRC.js';
|
|
22
|
+
export { defineQueryKeys, resourceKeys } from './chunk-OYIUIW7C.js';
|
|
20
23
|
export { DataProviderRoot, GenesisProvider, createMockProvider, useDataProvider, useStorage } from './chunk-GGSXSI6Z.js';
|
|
21
24
|
export { createLocalStorageAdapter, createMemoryStorageAdapter, createNoopStorageAdapter } from './chunk-ZYJUEJ4Z.js';
|
|
25
|
+
import './chunk-3B4IFDMK.js';
|
|
26
|
+
import './chunk-65SXNHWE.js';
|
|
27
|
+
export { isSafeUrl, normalizeLinkUrl } from './chunk-YDDPFSQ6.js';
|
|
22
28
|
export { titleCase } from './chunk-RYEXWQFD.js';
|
|
23
|
-
export { DEFAULT_DRAFT_DELAY_MS, DRAFT_NOT_SAVED, DraftController, isNetworkFailure, stableJson } from './chunk-HBAPYA5K.js';
|
|
24
|
-
export { DataWriteError, isDataWriteError } from './chunk-LG6TUBVM.js';
|
|
25
29
|
//# sourceMappingURL=index.js.map
|
|
26
30
|
//# sourceMappingURL=index.js.map
|
package/dist/provider/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { D as DataProvider, a as Identifier, B as BaseRecord, I as InvalidationKey, W as WriteEvent, F as FilterParam } from '../types-
|
|
2
|
-
export { A as ArrayFilter, b as BulkChange, c as BulkResult,
|
|
3
|
-
import { D as DataWriteError, W as WriteOutcome } from '../write-outcome-
|
|
4
|
-
export { a as DataWriteErrorOptions, i as isDataWriteError } from '../write-outcome-
|
|
1
|
+
import { D as DataProvider, a as Identifier, B as BaseRecord, I as InvalidationKey, W as WriteEvent, C as CountMode, F as FilterParam } from '../types-CXhqXPN1.js';
|
|
2
|
+
export { A as ArrayFilter, b as BulkChange, c as BulkResult, d as CreateParams, e as CreateResult, f as DeleteParams, g as DeleteResult, G as GetManyParams, h as GetManyResult, i as GetOneParams, j as GetOneResult, H as HistoryParams, k as ImportParams, L as ListParams, l as ListResult, N as NullFilter, P as PaginationParam, R as RangeFilter, m as ResourceChangeEvent, n as RowFailure, o as ScalarFilter, S as SortParam, p as SubscribeParams, U as UpdateParams, q as UpdateResult } from '../types-CXhqXPN1.js';
|
|
3
|
+
import { D as DataWriteError, W as WriteOutcome } from '../write-outcome-CFnpciUI.js';
|
|
4
|
+
export { a as DataWriteErrorOptions, i as isDataWriteError } from '../write-outcome-CFnpciUI.js';
|
|
5
5
|
import { D as DataReadError, R as ReadOutcome } from '../read-outcome-BnboMYOV.js';
|
|
6
6
|
export { a as DataReadErrorOptions, i as isDataReadError, r as readFailureMessage } from '../read-outcome-BnboMYOV.js';
|
|
7
7
|
import * as react from 'react';
|
|
8
8
|
import { ReactNode } from 'react';
|
|
9
9
|
import { QueryClient } from '@tanstack/react-query';
|
|
10
10
|
import { S as StorageAdapter } from '../types-DKcxHXxq.js';
|
|
11
|
-
import '../types-
|
|
11
|
+
import '../types-o8j7g6O6.js';
|
|
12
12
|
import '../form-types.js';
|
|
13
13
|
|
|
14
14
|
interface MockProviderOptions {
|
|
@@ -208,6 +208,11 @@ interface SupabaseResourceConfig {
|
|
|
208
208
|
rpc: string;
|
|
209
209
|
args?: () => Record<string, unknown>;
|
|
210
210
|
};
|
|
211
|
+
/**
|
|
212
|
+
* How lists of this resource count their total (default `exact`). Use
|
|
213
|
+
* `estimated` for large tables, or `none` when no screen shows a count.
|
|
214
|
+
*/
|
|
215
|
+
count?: CountMode;
|
|
211
216
|
/** The columns read when the caller names none, e.g. embedded joins: `"*, person:people(full_name)"`. Default `"*"`. */
|
|
212
217
|
select?: string;
|
|
213
218
|
/**
|
|
@@ -456,4 +461,4 @@ type GenesisProviderProps = {
|
|
|
456
461
|
*/
|
|
457
462
|
declare function GenesisProvider({ children, provider, mock, storage, queryClient: queryClientProp, }: GenesisProviderProps): react.JSX.Element;
|
|
458
463
|
|
|
459
|
-
export { BaseRecord, type CallRpcOptions, type CreateOrAdoptOptions, type CreateOrAdoptResult, DEFAULT_RPC_MESSAGES, DataProvider, DataProviderRoot, type DataProviderRootProps, DataReadError, DataWriteError, FilterParam, GenesisProvider, type GenesisProviderProps, Identifier, InvalidationKey, type MockProviderOptions, type PostgrestFieldErrors, RPC_FAILED, ReadOutcome, type RpcClient, type SupabaseClient, type SupabaseClientInput, type SupabaseProviderOptions, type SupabaseRealtimeChannel, type SupabaseRealtimePayload, type SupabaseResourceConfig, type SupabaseWriteContext, WriteEvent, WriteOutcome, callRpc, createMockProvider, createOrAdopt, createSupabaseProvider, fieldErrorsFromPostgrest, readOutcomeFromCode, toDataWriteError, useDataProvider, useStorage, writeOutcomeFromCode };
|
|
464
|
+
export { BaseRecord, type CallRpcOptions, CountMode, type CreateOrAdoptOptions, type CreateOrAdoptResult, DEFAULT_RPC_MESSAGES, DataProvider, DataProviderRoot, type DataProviderRootProps, DataReadError, DataWriteError, FilterParam, GenesisProvider, type GenesisProviderProps, Identifier, InvalidationKey, type MockProviderOptions, type PostgrestFieldErrors, RPC_FAILED, ReadOutcome, type RpcClient, type SupabaseClient, type SupabaseClientInput, type SupabaseProviderOptions, type SupabaseRealtimeChannel, type SupabaseRealtimePayload, type SupabaseResourceConfig, type SupabaseWriteContext, WriteEvent, WriteOutcome, callRpc, createMockProvider, createOrAdopt, createSupabaseProvider, fieldErrorsFromPostgrest, readOutcomeFromCode, toDataWriteError, useDataProvider, useStorage, writeOutcomeFromCode };
|
package/dist/provider/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { DEFAULT_RPC_MESSAGES, RPC_FAILED, callRpc, createOrAdopt, createSupabaseProvider, fieldErrorsFromPostgrest, readOutcomeFromCode, toDataWriteError, writeOutcomeFromCode } from '../chunk-
|
|
1
|
+
export { DEFAULT_RPC_MESSAGES, RPC_FAILED, callRpc, createOrAdopt, createSupabaseProvider, fieldErrorsFromPostgrest, readOutcomeFromCode, toDataWriteError, writeOutcomeFromCode } from '../chunk-TCL27Q5W.js';
|
|
2
2
|
export { DataReadError, isDataReadError, readFailureMessage } from '../chunk-HUNGCTRA.js';
|
|
3
|
+
export { DataWriteError, isDataWriteError } from '../chunk-LG6TUBVM.js';
|
|
3
4
|
export { DataProviderRoot, GenesisProvider, createMockProvider, useDataProvider, useStorage } from '../chunk-GGSXSI6Z.js';
|
|
4
5
|
import '../chunk-ZYJUEJ4Z.js';
|
|
5
6
|
import '../chunk-RYEXWQFD.js';
|
|
6
|
-
export { DataWriteError, isDataWriteError } from '../chunk-LG6TUBVM.js';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/** Where the host's draft saving stands. */
|
|
2
|
+
type SaveState = "saved" | "saving" | "unsaved" | "failed" | "stopped" | "conflict";
|
|
3
|
+
declare const SAVE_STATE_LABEL: Record<SaveState, string>;
|
|
4
|
+
/** A chip's colour: the tinted, AA-safe Genesis badge tones. */
|
|
5
|
+
type ChipTone = "success" | "warning" | "danger" | "info" | "muted";
|
|
6
|
+
/** Whether something can be published, from an editor's checks. */
|
|
7
|
+
interface Readiness {
|
|
8
|
+
state: "ready" | "problems" | "warnings" | "empty" | "pending";
|
|
9
|
+
/** Problems or warnings to look at (0 when ready, empty or pending). */
|
|
10
|
+
count: number;
|
|
11
|
+
}
|
|
12
|
+
/** One of an editor's findings, as readinessOf reads it. */
|
|
13
|
+
interface ReadinessFinding {
|
|
14
|
+
level: "error" | "warning" | "info";
|
|
15
|
+
code?: string | undefined;
|
|
16
|
+
}
|
|
17
|
+
interface ReadinessOptions {
|
|
18
|
+
/** Errors are held back while something new is being written: "pending", not "problems". */
|
|
19
|
+
pending?: boolean | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* The finding code that means "nothing to publish yet" (for example a form builder's
|
|
22
|
+
* `no-questions`): it makes the result "empty", not broken. None by default.
|
|
23
|
+
*/
|
|
24
|
+
emptyCode?: string | undefined;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Readiness from an editor's findings (any list of `{ level, code? }`): errors block
|
|
28
|
+
* publishing, warnings ask for a look. One pass over the findings.
|
|
29
|
+
*/
|
|
30
|
+
declare function readinessOf(findings: readonly ReadinessFinding[], options?: ReadinessOptions): Readiness;
|
|
31
|
+
/** The readiness chip's words, each optional; the defaults are resource-neutral. */
|
|
32
|
+
interface ReadinessLabels {
|
|
33
|
+
/** Default "Ready to publish". */
|
|
34
|
+
ready?: string | undefined;
|
|
35
|
+
/** When there is nothing yet. Default "Nothing to publish yet"; a form says "Add a question". */
|
|
36
|
+
empty?: string | undefined;
|
|
37
|
+
/** Default "In progress". */
|
|
38
|
+
pending?: string | undefined;
|
|
39
|
+
/** Default "1 problem to fix" / "3 problems to fix". */
|
|
40
|
+
problems?: ((count: number) => string) | undefined;
|
|
41
|
+
/** Default "2 to check". */
|
|
42
|
+
warnings?: ((count: number) => string) | undefined;
|
|
43
|
+
}
|
|
44
|
+
/** The readiness chip's label and tone. */
|
|
45
|
+
declare function readinessChip(readiness: Readiness, labels?: ReadinessLabels): {
|
|
46
|
+
label: string;
|
|
47
|
+
tone: ChipTone;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** A day (YYYY-MM-DD) in words, given today on the same clock: "Today", "Yesterday", "Oct 21", "Oct 21, 2025". */
|
|
51
|
+
declare function dayLabel(day: string, today?: string): string;
|
|
52
|
+
|
|
53
|
+
/** One search param a prefilled link may set, and the values staff pick from. */
|
|
54
|
+
interface PrefillChoice {
|
|
55
|
+
key: string;
|
|
56
|
+
/** The picker's accessible name, e.g. "Location". */
|
|
57
|
+
label: string;
|
|
58
|
+
/** The picker's "leave it out" choice, e.g. "Any location". */
|
|
59
|
+
anyLabel: string;
|
|
60
|
+
options: readonly {
|
|
61
|
+
value: string;
|
|
62
|
+
label: string;
|
|
63
|
+
}[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* `url` with `values` set as search params (empty values left out), keeping what it has.
|
|
67
|
+
* An absolute link stays absolute; a relative one (`/f/a?x=1`) stays relative, so it never
|
|
68
|
+
* throws while a page is still working out its origin.
|
|
69
|
+
*/
|
|
70
|
+
declare function prefilledUrl(url: string, values: Record<string, string | undefined>): string;
|
|
71
|
+
/** An `<iframe>` that shows the page on another website, full width. */
|
|
72
|
+
declare function embedSnippet(url: string, title: string): string;
|
|
73
|
+
|
|
74
|
+
/** The colour of a headline number's detail: good news, bad news, a warning, or plain. */
|
|
75
|
+
type HeadlineTone = "positive" | "negative" | "warning" | "muted";
|
|
76
|
+
/** One headline number, as data: a label, the number, and a short line under it. */
|
|
77
|
+
interface HeadlineNumber {
|
|
78
|
+
key: string;
|
|
79
|
+
label: string;
|
|
80
|
+
value: string | number;
|
|
81
|
+
detail?: string | undefined;
|
|
82
|
+
/** The detail's colour. Default plain. */
|
|
83
|
+
tone?: HeadlineTone | undefined;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export { type ChipTone, type HeadlineNumber, type HeadlineTone, type PrefillChoice, type Readiness, type ReadinessFinding, type ReadinessLabels, type ReadinessOptions, SAVE_STATE_LABEL, type SaveState, dayLabel, embedSnippet, prefilledUrl, readinessChip, readinessOf };
|