@timeax/form-palette 0.1.2 → 0.1.4
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 +2280 -0
- package/dist/{variant-BGkGWsSy.d.mts → core-EVtvQ-ma.d.mts} +3522 -3488
- package/dist/{variant-B_L0opEi.d.ts → core-ZuVzbe2m.d.ts} +3522 -3488
- package/dist/extra.d.mts +134 -163
- package/dist/extra.d.ts +134 -163
- package/dist/extra.js +7838 -5940
- package/dist/extra.js.map +1 -1
- package/dist/extra.mjs +7763 -5862
- package/dist/extra.mjs.map +1 -1
- package/dist/index.d.mts +14 -3
- package/dist/index.d.ts +14 -3
- package/dist/index.js +3429 -3655
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3359 -3585
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -2
- package/Readme.md +0 -1380
package/dist/extra.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
3
|
+
import { Q as ListerSearchPayload, U as ListerId, W as ListerDefinition, X as ListerOption, Y as PresetMap, Z as ListerApi, _ as ListerStoreState, $ as ListerSessionId, a0 as ListerSearchTarget, a1 as ListerSearchMode, a2 as ListerFilterCtx, a3 as ListerDetails, a4 as ListerProviderHost, a5 as ListerRuntimeState, a6 as ShadcnJsonEditorProps, a7 as JsonEditorIndexHandle } from './core-EVtvQ-ma.mjs';
|
|
4
|
+
export { ad as ListerChangeEvent, am as ListerFilterApply, al as ListerFilterApplyMode, an as ListerFilterBindKey, ap as ListerFilterGroupOption, ao as ListerFilterInput, ar as ListerFilterInputOption, as as ListerFilterOption, at as ListerFilterSpec, aq as ListerFilterValueOption, af as ListerLogCode, ag as ListerLogEntry, ae as ListerLogLevel, ai as ListerMapping, a8 as ListerMode, ax as ListerOpenOptions, a9 as ListerOpenReason, ay as ListerOpenResult, aw as ListerOptionsForMode, ah as ListerPermissionCtx, av as ListerRawForMode, ak as ListerSearchSpec, aD as ListerSessionState, aj as ListerSource, au as ListerValueForMode, ac as OpenAnchor, aB as PresetFilters, aC as PresetMeta, az as PresetRaw, aA as PresetValue, ab as Resolver, aa as Selector } from './core-EVtvQ-ma.mjs';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import './adapter-CvjXO9Gi.mjs';
|
|
7
7
|
import '@inertiajs/core';
|
|
@@ -11,189 +11,155 @@ import 'class-variance-authority/types';
|
|
|
11
11
|
import 'class-variance-authority';
|
|
12
12
|
import '@radix-ui/react-switch';
|
|
13
13
|
|
|
14
|
+
type HttpMethod = "GET" | "POST";
|
|
14
15
|
type HttpReq = {
|
|
15
16
|
endpoint: string;
|
|
16
|
-
method
|
|
17
|
+
method?: HttpMethod;
|
|
17
18
|
params?: any;
|
|
18
19
|
body?: any;
|
|
19
|
-
headers?:
|
|
20
|
+
headers?: Record<string, string>;
|
|
21
|
+
signal?: AbortSignal;
|
|
22
|
+
requestId?: string;
|
|
20
23
|
};
|
|
21
24
|
type ListerHttpClient = (req: HttpReq) => Promise<any>;
|
|
22
25
|
|
|
23
|
-
type
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
searchSpec?: any;
|
|
33
|
-
searchTarget?: any;
|
|
34
|
-
searchPayload?: any;
|
|
35
|
-
ownerKey?: string;
|
|
26
|
+
type ListerFetchOpts<TCtx = any> = {
|
|
27
|
+
query?: string;
|
|
28
|
+
search?: ListerSearchPayload;
|
|
29
|
+
cursor?: string | null;
|
|
30
|
+
/** request control */
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
requestId?: string;
|
|
33
|
+
/** mapping context override */
|
|
34
|
+
ctx?: TCtx;
|
|
36
35
|
};
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
declare function fetchListerList<TRaw, TValue extends ListerId, TFilters, TMeta, TCtx>(args: {
|
|
37
|
+
def: ListerDefinition<TRaw, TValue, TFilters, TMeta, TCtx>;
|
|
39
38
|
http: ListerHttpClient;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
*/
|
|
59
|
-
setSearchTarget(id: ListerSessionId, target: ListerSearchTarget): void;
|
|
60
|
-
/**
|
|
61
|
-
* Backwards compatible signatures:
|
|
62
|
-
* - existing calls still work: searchRemote(id, q)
|
|
63
|
-
* - new calls can optionally override payload: searchRemote(id, q, payload)
|
|
64
|
-
*
|
|
65
|
-
* If payload is omitted, implementation should read from session.searchTarget.
|
|
66
|
-
*/
|
|
67
|
-
searchLocal: {
|
|
68
|
-
(id: ListerSessionId, q: string): void;
|
|
69
|
-
(id: ListerSessionId, q: string, payload?: ListerSearchPayload): void;
|
|
70
|
-
};
|
|
71
|
-
searchRemote: {
|
|
72
|
-
(id: ListerSessionId, q: string): void;
|
|
73
|
-
(id: ListerSessionId, q: string, payload?: ListerSearchPayload): void;
|
|
74
|
-
};
|
|
75
|
-
refresh(id: ListerSessionId): void;
|
|
76
|
-
setPosition(id: ListerSessionId, pos: {
|
|
77
|
-
x: number;
|
|
78
|
-
y: number;
|
|
79
|
-
} | null): void;
|
|
80
|
-
/** Filters (non-UI logic; per session) */
|
|
81
|
-
getFilterCtx<TFilters>(id: ListerSessionId): ListerFilterCtx<TFilters>;
|
|
82
|
-
/**
|
|
83
|
-
* NEW semantics:
|
|
84
|
-
* - `optionId` is the UI identifier of the filter option (NOT the db value)
|
|
85
|
-
* - `selectedFilterValues` tracks selected option ids (for UI checkmarks/badge)
|
|
86
|
-
*/
|
|
87
|
-
applyFilterOption(id: ListerSessionId, optionId: string | number): void;
|
|
88
|
-
registerPreset(kind: string, def: AnyDef): void;
|
|
89
|
-
getPreset(kind: string): AnyDef | undefined;
|
|
90
|
-
/** Derived list for UI later (local/hybrid filtering) */
|
|
91
|
-
getVisibleOptions(id: ListerSessionId): any[];
|
|
92
|
-
};
|
|
93
|
-
declare const Ctx: React.Context<InternalContextValue | null>;
|
|
94
|
-
type ResolvedFilterNode<TFilters> = {
|
|
95
|
-
option: ListerFilterOption<TFilters>;
|
|
96
|
-
id: string;
|
|
97
|
-
kind?: string;
|
|
98
|
-
disabled?: boolean;
|
|
99
|
-
bindKey?: string;
|
|
100
|
-
dbValue?: any;
|
|
101
|
-
apply?: {
|
|
102
|
-
key?: string;
|
|
103
|
-
mode?: "replace" | "merge" | "unset";
|
|
104
|
-
toggleable?: boolean;
|
|
105
|
-
value?: any;
|
|
106
|
-
};
|
|
39
|
+
filters?: TFilters;
|
|
40
|
+
opts?: ListerFetchOpts<TCtx>;
|
|
41
|
+
}): Promise<{
|
|
42
|
+
rawList: TRaw[];
|
|
43
|
+
optionsList: Array<ListerOption<TRaw, TValue, TMeta>>;
|
|
44
|
+
responseBody: any;
|
|
45
|
+
requestId?: string;
|
|
46
|
+
}>;
|
|
47
|
+
|
|
48
|
+
type ListerEngine = {
|
|
49
|
+
http: ListerHttpClient;
|
|
50
|
+
fetch: <TRaw, TValue extends ListerId, TFilters, TMeta, TCtx>(args: {
|
|
51
|
+
def: ListerDefinition<TRaw, TValue, TFilters, TMeta, TCtx>;
|
|
52
|
+
filters?: TFilters;
|
|
53
|
+
opts?: ListerFetchOpts<TCtx> & {
|
|
54
|
+
search?: ListerSearchPayload;
|
|
55
|
+
};
|
|
56
|
+
}) => ReturnType<typeof fetchListerList<TRaw, TValue, TFilters, TMeta, TCtx>>;
|
|
107
57
|
};
|
|
108
|
-
|
|
109
|
-
|
|
58
|
+
|
|
59
|
+
type CreateListerRuntimeOptions<P extends PresetMap> = {
|
|
110
60
|
host: ListerProviderHost;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
/**
|
|
61
|
+
/** Provide your own engine (for tests / custom http). */
|
|
62
|
+
engine?: ListerEngine;
|
|
63
|
+
/** Initial preset map (kind => definition). */
|
|
64
|
+
presets?: P;
|
|
65
|
+
/** Debounce used when searchMode is remote/hybrid and query changes. */
|
|
114
66
|
remoteDebounceMs?: number;
|
|
115
|
-
|
|
116
|
-
|
|
67
|
+
now?: () => number;
|
|
68
|
+
makeSessionId?: () => string;
|
|
69
|
+
};
|
|
70
|
+
type ListerRuntime<P extends PresetMap> = {
|
|
71
|
+
engine: ListerEngine;
|
|
72
|
+
api: ListerApi<P>;
|
|
73
|
+
getState(): ListerStoreState;
|
|
74
|
+
subscribe(fn: () => void): () => void;
|
|
75
|
+
actions: {
|
|
76
|
+
focus(sessionId: ListerSessionId): void;
|
|
77
|
+
close(sessionId: ListerSessionId): void;
|
|
78
|
+
cancel(sessionId: ListerSessionId): void;
|
|
79
|
+
apply(sessionId: ListerSessionId): void;
|
|
80
|
+
clear(sessionId: ListerSessionId): void;
|
|
81
|
+
toggle(sessionId: ListerSessionId, value: any): void;
|
|
82
|
+
select(sessionId: ListerSessionId, value: any): void;
|
|
83
|
+
deselect(sessionId: ListerSessionId, value: any): void;
|
|
84
|
+
setQuery(sessionId: ListerSessionId, query: string): void;
|
|
85
|
+
setSearchTarget(sessionId: ListerSessionId, target?: ListerSearchTarget): void;
|
|
86
|
+
setSearchMode(sessionId: ListerSessionId, mode: ListerSearchMode): void;
|
|
87
|
+
setFiltersPatch(sessionId: ListerSessionId, patch: any): void;
|
|
88
|
+
mergeFiltersPatch(sessionId: ListerSessionId, patch: any): void;
|
|
89
|
+
getFilterCtx<TFilters>(id: ListerSessionId): ListerFilterCtx<TFilters>;
|
|
90
|
+
applyFilterOption(id: ListerSessionId, optionId: string | number): void;
|
|
91
|
+
refresh(sessionId: ListerSessionId): void;
|
|
92
|
+
};
|
|
93
|
+
selectors: {
|
|
94
|
+
effectiveFilters(sessionId: ListerSessionId): any;
|
|
95
|
+
visibleOptions(sessionId: ListerSessionId): any[];
|
|
96
|
+
detailsPayload(sessionId: ListerSessionId, action: ListerDetails<any, any, any, any>["action"]): any;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
117
99
|
|
|
118
100
|
/**
|
|
119
|
-
*
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
101
|
+
* Context for Lister runtime bridge.
|
|
102
|
+
*/
|
|
103
|
+
declare const ListerContext: React.Context<ListerRuntime<any> | null>;
|
|
104
|
+
type ListerProviderProps<P extends PresetMap> = React.PropsWithChildren<CreateListerRuntimeOptions<P>>;
|
|
105
|
+
/**
|
|
106
|
+
* ListerProvider — creates a singleton runtime and exposes it via React context.
|
|
123
107
|
*
|
|
124
|
-
*
|
|
125
|
-
* -
|
|
126
|
-
* -
|
|
127
|
-
* -
|
|
108
|
+
* Responsibilities:
|
|
109
|
+
* - instantiate `createListerRuntime` once per provider
|
|
110
|
+
* - subscribe to runtime store (if needed by descendants)
|
|
111
|
+
* - expose `api`, `actions`, `selectors`, and `state`
|
|
128
112
|
*/
|
|
129
|
-
declare function
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
declare function ListerUI(): react_jsx_runtime.JSX.Element | null;
|
|
135
|
-
declare function HeaderBar(props: {
|
|
136
|
-
id: ListerSessionId;
|
|
137
|
-
title: string;
|
|
138
|
-
loading: boolean;
|
|
139
|
-
refreshing: boolean;
|
|
140
|
-
showRefresh: boolean;
|
|
141
|
-
draggable: boolean;
|
|
142
|
-
onRefresh(): void;
|
|
143
|
-
onClose(): void;
|
|
144
|
-
}): react_jsx_runtime.JSX.Element;
|
|
113
|
+
declare function ListerProvider<P extends PresetMap>({ children, ...opts }: ListerProviderProps<P>): react_jsx_runtime.JSX.Element;
|
|
114
|
+
/**
|
|
115
|
+
* Helper: get current runtime or throw
|
|
116
|
+
*/
|
|
117
|
+
declare function useListerRuntime<P extends PresetMap>(): ListerRuntime<P>;
|
|
145
118
|
|
|
146
|
-
declare function
|
|
147
|
-
id: ListerSessionId;
|
|
148
|
-
className?: string;
|
|
149
|
-
}): react_jsx_runtime.JSX.Element;
|
|
150
|
-
declare function FooterBar(props: {
|
|
151
|
-
id: ListerSessionId;
|
|
152
|
-
mode: ListerMode;
|
|
153
|
-
confirm: boolean;
|
|
154
|
-
onClear(): void;
|
|
155
|
-
onCancel(): void;
|
|
156
|
-
onApply(): void;
|
|
157
|
-
}): react_jsx_runtime.JSX.Element;
|
|
119
|
+
declare function ListerUI(): React.ReactPortal | null;
|
|
158
120
|
|
|
121
|
+
/**
|
|
122
|
+
* useLister — stable hook returning { api, store/state, actions, selectors }.
|
|
123
|
+
*
|
|
124
|
+
* It directly mirrors the current runtime, with stable reference equality
|
|
125
|
+
* for top-level properties (api/actions/selectors), while `state` updates on
|
|
126
|
+
* store changes.
|
|
127
|
+
*/
|
|
159
128
|
declare function useLister<P extends PresetMap>(): {
|
|
160
129
|
api: ListerApi<P>;
|
|
161
|
-
store: ListerStoreState;
|
|
162
|
-
/** active session convenience (can be undefined if none open) */
|
|
163
|
-
state: AnyState | undefined;
|
|
164
130
|
actions: {
|
|
165
|
-
focus(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
toggle(
|
|
171
|
-
select(
|
|
172
|
-
deselect(
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
setSearchMode(
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
(id: ListerSessionId, q: string): void;
|
|
179
|
-
(id: ListerSessionId, q: string, payload?: ListerSearchPayload): void;
|
|
180
|
-
};
|
|
181
|
-
searchRemote: {
|
|
182
|
-
(id: ListerSessionId, q: string): void;
|
|
183
|
-
(id: ListerSessionId, q: string, payload?: ListerSearchPayload): void;
|
|
184
|
-
};
|
|
185
|
-
refresh(id: ListerSessionId): void;
|
|
186
|
-
setPosition(id: ListerSessionId, pos: {
|
|
187
|
-
x: number;
|
|
188
|
-
y: number;
|
|
189
|
-
} | null): void;
|
|
190
|
-
/** Filters (non-UI logic) */
|
|
131
|
+
focus(sessionId: ListerSessionId): void;
|
|
132
|
+
close(sessionId: ListerSessionId): void;
|
|
133
|
+
cancel(sessionId: ListerSessionId): void;
|
|
134
|
+
apply(sessionId: ListerSessionId): void;
|
|
135
|
+
clear(sessionId: ListerSessionId): void;
|
|
136
|
+
toggle(sessionId: ListerSessionId, value: any): void;
|
|
137
|
+
select(sessionId: ListerSessionId, value: any): void;
|
|
138
|
+
deselect(sessionId: ListerSessionId, value: any): void;
|
|
139
|
+
setQuery(sessionId: ListerSessionId, query: string): void;
|
|
140
|
+
setSearchTarget(sessionId: ListerSessionId, target?: ListerSearchTarget): void;
|
|
141
|
+
setSearchMode(sessionId: ListerSessionId, mode: ListerSearchMode): void;
|
|
142
|
+
setFiltersPatch(sessionId: ListerSessionId, patch: any): void;
|
|
143
|
+
mergeFiltersPatch(sessionId: ListerSessionId, patch: any): void;
|
|
191
144
|
getFilterCtx<TFilters>(id: ListerSessionId): ListerFilterCtx<TFilters>;
|
|
192
145
|
applyFilterOption(id: ListerSessionId, optionId: string | number): void;
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
146
|
+
refresh(sessionId: ListerSessionId): void;
|
|
147
|
+
};
|
|
148
|
+
selectors: {
|
|
149
|
+
effectiveFilters(sessionId: ListerSessionId): any;
|
|
150
|
+
visibleOptions(sessionId: ListerSessionId): any[];
|
|
151
|
+
detailsPayload(sessionId: ListerSessionId, action: ListerDetails<any, any, any, any>["action"]): any;
|
|
196
152
|
};
|
|
153
|
+
state: ListerStoreState;
|
|
154
|
+
store: ListerStoreState;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* useListerSession — convenience hook for one active session.
|
|
158
|
+
* Example: UI overlays or modals can call this to get the current session.
|
|
159
|
+
*/
|
|
160
|
+
declare function useListerSession<P extends PresetMap>(sessionId?: ListerSessionId): {
|
|
161
|
+
session: ListerRuntimeState<any, any, any, any, any> | undefined;
|
|
162
|
+
activeId: string | undefined;
|
|
197
163
|
};
|
|
198
164
|
|
|
199
165
|
/**
|
|
@@ -239,7 +205,7 @@ type UseDataOptions<TItem = any, TFilters = Record<string, any>> = {
|
|
|
239
205
|
method?: "GET" | "POST";
|
|
240
206
|
selector?: DataSelector<TItem>;
|
|
241
207
|
/**
|
|
242
|
-
* Passed through into
|
|
208
|
+
* Passed through into request builder (same signature shape as legacy provider)
|
|
243
209
|
*/
|
|
244
210
|
buildRequest?: (ctx: DataBuildRequestCtx<TFilters>) => DataBuildRequestResult;
|
|
245
211
|
/**
|
|
@@ -260,6 +226,10 @@ type UseDataOptions<TItem = any, TFilters = Record<string, any>> = {
|
|
|
260
226
|
* Optional selection support (by stable item key)
|
|
261
227
|
*/
|
|
262
228
|
selection?: DataSelectionConfig<TItem>;
|
|
229
|
+
/**
|
|
230
|
+
* Optional override: custom http client (otherwise uses global axios / axios import)
|
|
231
|
+
*/
|
|
232
|
+
http?: ListerHttpClient;
|
|
263
233
|
};
|
|
264
234
|
type UseDataResult<TItem = any, TFilters = Record<string, any>> = {
|
|
265
235
|
id?: string;
|
|
@@ -291,10 +261,11 @@ type UseDataResult<TItem = any, TFilters = Record<string, any>> = {
|
|
|
291
261
|
query?: string;
|
|
292
262
|
filters?: TFilters;
|
|
293
263
|
searchTarget?: ListerSearchTarget;
|
|
264
|
+
search?: ListerSearchPayload;
|
|
294
265
|
}) => Promise<TItem[]>;
|
|
295
266
|
};
|
|
296
267
|
declare function useData<TItem = any, TFilters = Record<string, any>>(opts: UseDataOptions<TItem, TFilters>): UseDataResult<TItem, TFilters>;
|
|
297
268
|
|
|
298
269
|
declare const ShadcnJsonEditorVariant: React.ForwardRefExoticComponent<ShadcnJsonEditorProps & React.RefAttributes<JsonEditorIndexHandle>>;
|
|
299
270
|
|
|
300
|
-
export { type
|
|
271
|
+
export { type DataBuildRequestCtx, type DataBuildRequestResult, type DataKey, type DataSearchConfig, type DataSelectionConfig, type DataSelectionKey, type DataSelectionMode, type DataSelector, ShadcnJsonEditorVariant as JsonEditor, ListerApi, ListerContext, ListerDefinition, ListerDetails, ListerFilterCtx, ListerId, ListerOption, ListerProvider, ListerProviderHost, type ListerProviderProps, ListerRuntimeState, ListerSearchMode, ListerSearchPayload, ListerSearchTarget, ListerSessionId, ListerStoreState, ListerUI, PresetMap, type UseDataOptions, type UseDataResult, useData, useLister, useListerRuntime, useListerSession };
|