@faqir-ui/core 1.0.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/LICENSE +21 -0
- package/README.md +97 -0
- package/cdn.json +28 -0
- package/dist/faqir-core.js +11792 -0
- package/dist/faqir-core.min.js +5 -0
- package/dist/faqir-core.min.js.map +11 -0
- package/dist/faqir-core.mjs +9735 -0
- package/dist/faqir.aurora.css +13527 -0
- package/dist/faqir.brutalist.css +13536 -0
- package/dist/faqir.contrast.css +13569 -0
- package/dist/faqir.default.css +13468 -0
- package/dist/faqir.document-serif.css +13457 -0
- package/dist/faqir.document.css +13466 -0
- package/dist/faqir.glass.css +13576 -0
- package/dist/faqir.midnight.css +13518 -0
- package/dist/faqir.paper.css +13539 -0
- package/dist/faqir.slate.css +13518 -0
- package/dist/faqir.soft.css +13540 -0
- package/dist/faqir.terminal.css +13546 -0
- package/dist/plugins/faqir-collapse.js +110 -0
- package/dist/plugins/faqir-intersect.js +64 -0
- package/dist/plugins/faqir-mask.js +339 -0
- package/dist/plugins/faqir-persist.js +129 -0
- package/dist/plugins/faqir-validate.js +221 -0
- package/dist/sri.json +23 -0
- package/examples/cdn-two-tag.html +49 -0
- package/faqir-core.d.ts +856 -0
- package/package.json +77 -0
- package/src/cdn-entry.js +12 -0
- package/src/esm-entry.js +58 -0
package/faqir-core.d.ts
ADDED
|
@@ -0,0 +1,856 @@
|
|
|
1
|
+
// TypeScript declarations for the Faqir engine — `@faqir-ui/core`. [task 1.0-02 · §A6]
|
|
2
|
+
//
|
|
3
|
+
// Faqir has no build step and ships no TypeScript: `registry/core/faqir-core.js`
|
|
4
|
+
// is hand-written ES5-in-a-UMD-closure, and this file is the contract stated
|
|
5
|
+
// beside it rather than emitted from it. Two things keep the two honest:
|
|
6
|
+
//
|
|
7
|
+
// • `tests/core/faqir-core-types.test.ts` enumerates the LIVE `Faqir` object,
|
|
8
|
+
// the live `window.__FAQIR_DEVTOOLS__` handle, the engine's `@ui:magic`
|
|
9
|
+
// declarations and every recipe's `@ui:provides` header, and holds each of
|
|
10
|
+
// them against what is declared below — in BOTH directions, so a member
|
|
11
|
+
// added to the engine and a member declared here that the engine does not
|
|
12
|
+
// have are equally a failure.
|
|
13
|
+
// • `tests/fixtures/types/` is compiled by `tsc` with this file on the path:
|
|
14
|
+
// correct usage must compile, and every `@ts-expect-error` line must
|
|
15
|
+
// actually error. Both directions again — a declaration loose enough to
|
|
16
|
+
// accept misuse fails the same way a declaration too tight to accept
|
|
17
|
+
// correct code does.
|
|
18
|
+
//
|
|
19
|
+
// Consumption. Two shapes are typed here, and this file is the `import` one:
|
|
20
|
+
//
|
|
21
|
+
// import Faqir from "@faqir-ui/core"; // default: the whole engine
|
|
22
|
+
// import { start, reactive } from "@faqir-ui/core"; // named, one per member
|
|
23
|
+
// <script src="…/faqir-core.min.js"></script> // window.Faqir, window.__FAQIR_DEVTOOLS__
|
|
24
|
+
//
|
|
25
|
+
// Module shape. This file is an ES module, matching `dist/faqir-core.mjs`, which
|
|
26
|
+
// is what the package's `import` condition resolves to. It used to be
|
|
27
|
+
// `export = Faqir` — the CommonJS form — in a file the package's
|
|
28
|
+
// `"type": "module"` classifies as ESM, which is illegal (TS1192 under both
|
|
29
|
+
// `node16` and `bundler`) and was the type-level half of a bug whose runtime
|
|
30
|
+
// half was `SyntaxError: … does not provide an export named 'default'`.
|
|
31
|
+
//
|
|
32
|
+
// The interfaces are therefore declared at MODULE level and aliased into a
|
|
33
|
+
// `Faqir` namespace, rather than the other way round. Both spellings keep
|
|
34
|
+
// working —
|
|
35
|
+
//
|
|
36
|
+
// import Faqir, { type ControllerApis } from "@faqir-ui/core";
|
|
37
|
+
// type A = Faqir.ControllerApis["dialog"]; // through the default import
|
|
38
|
+
// type B = ControllerApis["dialog"]; // as a named type
|
|
39
|
+
//
|
|
40
|
+
// — and, because the interfaces are real module exports now, the augmentation
|
|
41
|
+
// form below merges with them for real. Under the old `export =` shape a
|
|
42
|
+
// consumer's `declare module "@faqir-ui/core" { interface PluginMagics {…} }`
|
|
43
|
+
// merged only by accident of the namespace/module identification; under a
|
|
44
|
+
// default export it would have silently declared a SECOND, unrelated interface
|
|
45
|
+
// and every augmented member would have fallen through `Scope`'s index
|
|
46
|
+
// signature as `unknown`.
|
|
47
|
+
//
|
|
48
|
+
// Security. The evaluator compiles every `l-*` expression with `new Function`,
|
|
49
|
+
// so a page running Faqir needs `script-src … 'unsafe-eval'`, and `l-html`
|
|
50
|
+
// writes markup unsanitized by design. Neither is a fact the type system can
|
|
51
|
+
// carry — read `docs/security.md` before pointing Faqir at anything a user
|
|
52
|
+
// typed.
|
|
53
|
+
|
|
54
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
55
|
+
// Reactivity
|
|
56
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
57
|
+
|
|
58
|
+
/** What `effect()` and `$watch()` hand back: call it to stop tracking. */
|
|
59
|
+
export type Disposer = () => void;
|
|
60
|
+
|
|
61
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
62
|
+
// Scope + magics
|
|
63
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The magic properties the engine defines on every scope, exactly as the
|
|
67
|
+
* `@ui:magic` block in `src/core-src/engine.js` declares them.
|
|
68
|
+
*
|
|
69
|
+
* They are non-enumerable by construction, which is why `inspect().scope`
|
|
70
|
+
* (a plain deep copy) never contains them and why the drift test reads the
|
|
71
|
+
* engine's declarations rather than `Object.keys` of a live scope.
|
|
72
|
+
*/
|
|
73
|
+
export interface Magics {
|
|
74
|
+
/**
|
|
75
|
+
* The scope ROOT — the element carrying `l-data`, not the element the
|
|
76
|
+
* expression is written on. Every magic that walks the DOM starts here.
|
|
77
|
+
*/
|
|
78
|
+
readonly $el: Element;
|
|
79
|
+
/** The scope's `l-ref` elements, keyed by name. */
|
|
80
|
+
readonly $refs: Record<string, Element>;
|
|
81
|
+
/** Every store registered with `Faqir.store()`. */
|
|
82
|
+
readonly $store: Stores;
|
|
83
|
+
/**
|
|
84
|
+
* `data-state` of the `[data-ui]` closest to the scope root. Writable —
|
|
85
|
+
* assigning sets the attribute — and reads re-run when a controller
|
|
86
|
+
* changes it. `undefined` when there is no `[data-ui]` in reach.
|
|
87
|
+
*/
|
|
88
|
+
$state: string | undefined;
|
|
89
|
+
/** `data-variant` of that same `[data-ui]`, writable and observed alike. */
|
|
90
|
+
$variant: string | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* The controller API of that same `[data-ui]` — and a lookup for any other.
|
|
93
|
+
*
|
|
94
|
+
* `$ui.open()` reaches the controller of the component this expression sits
|
|
95
|
+
* inside. `$ui('#detail-drawer').open()` reaches another component's, named by
|
|
96
|
+
* a CSS selector, and returns `null` when nothing matches or the match has no
|
|
97
|
+
* controller — so `$ui('#maybe')?.open()` is the safe form. [W2-6]
|
|
98
|
+
*
|
|
99
|
+
* Only `destroy()` is universal — the rest of the surface differs per
|
|
100
|
+
* component, and the engine returns whatever the controller returned. Cast to
|
|
101
|
+
* the component's entry in {@link ControllerApis} to reach the rest:
|
|
102
|
+
* `($ui as unknown as Faqir.ControllerApis["dialog"]).open()`, or
|
|
103
|
+
* `$ui('#d') as Faqir.ControllerApis["dialog"] | null`.
|
|
104
|
+
*/
|
|
105
|
+
readonly $ui: UiHandle;
|
|
106
|
+
/** Fires a bubbling, composed `CustomEvent` from the scope root. */
|
|
107
|
+
readonly $dispatch: (event: string, detail?: unknown) => boolean;
|
|
108
|
+
/** Queues `fn` as a microtask, after the effects a mutation queued flush. */
|
|
109
|
+
readonly $nextTick: (fn?: () => void) => void;
|
|
110
|
+
/** Watch one scope key. Returns a disposer. */
|
|
111
|
+
readonly $watch: <T = unknown>(
|
|
112
|
+
key: string,
|
|
113
|
+
callback: (value: T, previous: T) => void,
|
|
114
|
+
) => Disposer;
|
|
115
|
+
/** `$id('label')` → `faqir-<scope>-label`, stable and unique per scope. */
|
|
116
|
+
readonly $id: (name: string) => string;
|
|
117
|
+
/**
|
|
118
|
+
* The DOM event being handled. Set for the duration of an `l-on` handler
|
|
119
|
+
* and deleted again after it, so it reads as `undefined` anywhere else.
|
|
120
|
+
*/
|
|
121
|
+
readonly $event?: Event;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Extension point for magics a plugin registers with `Faqir.magic()`.
|
|
126
|
+
*
|
|
127
|
+
* Empty here on purpose: `$persist` exists only on a page that loaded
|
|
128
|
+
* `plugins/faqir-persist.js`, so declaring it unconditionally would type a
|
|
129
|
+
* property that is usually not there. Declare the ones you load:
|
|
130
|
+
*
|
|
131
|
+
* declare module "@faqir-ui/core" {
|
|
132
|
+
* interface PluginMagics {
|
|
133
|
+
* $persist: (key: string, value?: unknown) => unknown;
|
|
134
|
+
* }
|
|
135
|
+
* }
|
|
136
|
+
*
|
|
137
|
+
* The interfaces are module-level exports, so an augmentation names one
|
|
138
|
+
* directly — there is no `namespace Faqir` wrapper to reach through. The same
|
|
139
|
+
* form opens {@link ControllerApis} and {@link Stores}.
|
|
140
|
+
*/
|
|
141
|
+
export interface PluginMagics {}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* A live reactive scope: the `l-data` object, the `data-prop-*` values merged
|
|
145
|
+
* over it, whatever `l-source` injected, and the magics on its prototype.
|
|
146
|
+
*
|
|
147
|
+
* The index signature is `unknown` rather than `any` because the members are
|
|
148
|
+
* genuinely unknown at compile time — narrow or cast at the point of use
|
|
149
|
+
* instead of letting a typo through the whole file.
|
|
150
|
+
*/
|
|
151
|
+
export interface Scope extends Magics, PluginMagics {
|
|
152
|
+
[key: string]: unknown;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Every store registered with `Faqir.store()`. Augmentable, the same way
|
|
157
|
+
* {@link PluginMagics} is, when a project wants its stores typed by name.
|
|
158
|
+
*/
|
|
159
|
+
export interface Stores {
|
|
160
|
+
[name: string]: Record<string, unknown>;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
164
|
+
// Directives
|
|
165
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* One parsed `l-*` / `:` / `@` attribute, as a directive handler receives it.
|
|
169
|
+
*
|
|
170
|
+
* `arg` is present only for the argument-taking forms (`l-bind:<attr>`,
|
|
171
|
+
* `l-on:<event>`, `l-source:<name>`) — the parser does not set the key at all
|
|
172
|
+
* otherwise, which is why it is optional here and `string | null` on
|
|
173
|
+
* {@link InspectedDirective}, where `inspect()` normalizes it.
|
|
174
|
+
*/
|
|
175
|
+
export interface Directive {
|
|
176
|
+
/** Directive name without the `l-` prefix: `bind`, `on`, `text`, … */
|
|
177
|
+
type: string;
|
|
178
|
+
arg?: string;
|
|
179
|
+
/** The attribute's value, uncompiled. */
|
|
180
|
+
expression: string;
|
|
181
|
+
/** Dot-suffixes, in source order: `l-on:input.debounce500ms` → `["debounce500ms"]`. */
|
|
182
|
+
modifiers: string[];
|
|
183
|
+
/** The attribute name as authored. */
|
|
184
|
+
raw: string;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* {@link Directive} as `inspect()` reports it — the same five keys, with
|
|
189
|
+
* `arg` normalized to `null` instead of being absent. Written out rather
|
|
190
|
+
* than `Omit<Directive, "arg">` so the published surface reads as itself;
|
|
191
|
+
* the drift test holds the two member lists against each other.
|
|
192
|
+
*/
|
|
193
|
+
export interface InspectedDirective {
|
|
194
|
+
type: string;
|
|
195
|
+
arg: string | null;
|
|
196
|
+
expression: string;
|
|
197
|
+
modifiers: string[];
|
|
198
|
+
raw: string;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* A handler registered with `Faqir.directive()`. Return a cleanup function to
|
|
203
|
+
* have it run when the owning scope is destroyed (`l-if` hide, keyed `l-for`
|
|
204
|
+
* removal, `Faqir.destroy()`).
|
|
205
|
+
*/
|
|
206
|
+
export type DirectiveHandler = (
|
|
207
|
+
el: Element,
|
|
208
|
+
directive: Directive,
|
|
209
|
+
scope: Scope,
|
|
210
|
+
) => void | Disposer;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* A magic registered with `Faqir.magic()`. Resolved lazily on every read, so
|
|
214
|
+
* it receives the final reactive scope rather than the object being built.
|
|
215
|
+
*/
|
|
216
|
+
export type MagicFactory = (el: Element, scope: Scope) => unknown;
|
|
217
|
+
|
|
218
|
+
/** A function passed to `Faqir.plugin()`; it receives the engine itself. */
|
|
219
|
+
export type Plugin = (faqir: FaqirGlobal) => void;
|
|
220
|
+
|
|
221
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
222
|
+
// l-source
|
|
223
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* The CRUD controller `l-source:<name>` injects into the scope as `$<name>`,
|
|
227
|
+
* beside the `<name>`, `<name>Loading` and `<name>Error` properties.
|
|
228
|
+
*
|
|
229
|
+
* Every method resolves rather than rejects: a failed request writes
|
|
230
|
+
* `<name>Error` and settles. Once the owning scope is destroyed the methods
|
|
231
|
+
* are inert and in-flight requests are aborted.
|
|
232
|
+
*/
|
|
233
|
+
export interface SourceController<T = Record<string, unknown>> {
|
|
234
|
+
/** (Re)load the collection. A newer call aborts and supersedes an older one. */
|
|
235
|
+
load(): Promise<void>;
|
|
236
|
+
/** POST. Resolves with the created record, or `null` when the request failed. */
|
|
237
|
+
create(payload: Partial<T>): Promise<T | null>;
|
|
238
|
+
/** PATCH by identity key (`id` unless `.key.<name>` said otherwise). */
|
|
239
|
+
update(id: string | number, payload: Partial<T>): Promise<T | null>;
|
|
240
|
+
/** DELETE by identity key. */
|
|
241
|
+
remove(id: string | number): Promise<void>;
|
|
242
|
+
/** Alias of {@link SourceController.load}. */
|
|
243
|
+
refresh(): Promise<void>;
|
|
244
|
+
/** Poll every `interval` ms (the `.poll` modifier's value, else 30000). */
|
|
245
|
+
startPolling(interval?: number): void;
|
|
246
|
+
stopPolling(): void;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
250
|
+
// Controllers
|
|
251
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* The only method every recipe controller has. A controller's real surface is
|
|
255
|
+
* its entry in {@link ControllerApis}; this is what code holding an
|
|
256
|
+
* unidentified controller (`$ui`, `inspect().controller.api`) may call.
|
|
257
|
+
*/
|
|
258
|
+
export interface ControllerApi {
|
|
259
|
+
destroy(): void;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* What `$ui` is: the local controller's surface, and a function that resolves
|
|
264
|
+
* another component's. [W2-6]
|
|
265
|
+
*
|
|
266
|
+
* Callable because the scope root was the only component an expression could
|
|
267
|
+
* ever reach, which left "open that drawer from this table row" — the most
|
|
268
|
+
* common admin interaction there is — with no expression that could say it.
|
|
269
|
+
*/
|
|
270
|
+
export interface UiHandle extends Partial<ControllerApi> {
|
|
271
|
+
/** The controller of the component matching `selector`, or `null`. */
|
|
272
|
+
(selector: string): ControllerApi | null;
|
|
273
|
+
/** The controller of the component at (or enclosing) `element`, or `null`. */
|
|
274
|
+
(element: Element): ControllerApi | null;
|
|
275
|
+
/** Any other method the local controller exposes — cast to narrow it. */
|
|
276
|
+
[method: string]: unknown;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* A factory registered with `Faqir.controller()`. It receives the
|
|
281
|
+
* `[data-ui]` root and must be double-init safe — the engine calls it again
|
|
282
|
+
* for elements a MutationObserver sees a second time.
|
|
283
|
+
*/
|
|
284
|
+
export type ControllerFactory<A extends ControllerApi = ControllerApi> = (root: Element) => A;
|
|
285
|
+
|
|
286
|
+
export interface AccordionApi extends ControllerApi {
|
|
287
|
+
toggle(index: number): void;
|
|
288
|
+
expand(index: number): void;
|
|
289
|
+
collapse(index: number): void;
|
|
290
|
+
expandAll(): void;
|
|
291
|
+
collapseAll(): void;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/** `dialog` and `alert-dialog` share one controller; the panel's role differs. */
|
|
295
|
+
export interface DialogApi extends ControllerApi {
|
|
296
|
+
open(): void;
|
|
297
|
+
close(): void;
|
|
298
|
+
toggle(): void;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export interface BarcodeApi extends ControllerApi {
|
|
302
|
+
render(): void;
|
|
303
|
+
update(value: string): void;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/** A `range` calendar reports two dates; a single-date one reports a string. */
|
|
307
|
+
export type CalendarValue = string | null | { start: string | null; end: string | null };
|
|
308
|
+
|
|
309
|
+
export interface CalendarApi extends ControllerApi {
|
|
310
|
+
getValue(): CalendarValue;
|
|
311
|
+
setValue(value: string): void;
|
|
312
|
+
clear(): void;
|
|
313
|
+
navigate(month: number, year: number): void;
|
|
314
|
+
selectDate(date: Date | string): void;
|
|
315
|
+
focusDate(date: Date | string): void;
|
|
316
|
+
setMin(value: string): void;
|
|
317
|
+
setMax(value: string): void;
|
|
318
|
+
setDisabledDates(list: string[]): void;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export interface CarouselApi extends ControllerApi {
|
|
322
|
+
next(): void;
|
|
323
|
+
prev(): void;
|
|
324
|
+
goTo(index: number): void;
|
|
325
|
+
getIndex(): number;
|
|
326
|
+
getCount(): number;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
export interface ComboboxApi extends ControllerApi {
|
|
330
|
+
open(): void;
|
|
331
|
+
close(): void;
|
|
332
|
+
filter(query: string): void;
|
|
333
|
+
selectOption(index: number): void;
|
|
334
|
+
getValue(): string | null;
|
|
335
|
+
setValue(value: string): void;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export interface CommandPaletteApi extends ControllerApi {
|
|
339
|
+
open(): void;
|
|
340
|
+
close(): void;
|
|
341
|
+
filter(query: string): void;
|
|
342
|
+
selectItem(index: number): void;
|
|
343
|
+
registerCommand(command: Record<string, unknown>): void;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export interface ContextMenuApi extends ControllerApi {
|
|
347
|
+
open(x?: number, y?: number): void;
|
|
348
|
+
close(options?: { restoreFocus?: boolean }): void;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export interface DatePickerApi extends ControllerApi {
|
|
352
|
+
open(): void;
|
|
353
|
+
close(): void;
|
|
354
|
+
getValue(): CalendarValue;
|
|
355
|
+
setValue(date: string): void;
|
|
356
|
+
navigate(month: number, year: number): void;
|
|
357
|
+
selectDate(date: Date | string): void;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
export interface DrawerApi extends ControllerApi {
|
|
361
|
+
open(): void;
|
|
362
|
+
close(): void;
|
|
363
|
+
toggle(): void;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export interface DropdownApi extends ControllerApi {
|
|
367
|
+
open(options?: { focus?: string }): void;
|
|
368
|
+
close(options?: { restoreFocus?: boolean }): void;
|
|
369
|
+
toggle(): void;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
export interface FileUploadApi extends ControllerApi {
|
|
373
|
+
getFiles(): FileList;
|
|
374
|
+
open(): void;
|
|
375
|
+
/** By index or by the `File` itself. Returns whether anything was removed. */
|
|
376
|
+
remove(target: number | File): boolean;
|
|
377
|
+
clear(): void;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export interface InputOtpApi extends ControllerApi {
|
|
381
|
+
getValue(): string;
|
|
382
|
+
/** Silent — does not fire `change`/`complete`. */
|
|
383
|
+
setValue(value: string): void;
|
|
384
|
+
clear(): void;
|
|
385
|
+
focus(): void;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export interface MenubarApi extends ControllerApi {
|
|
389
|
+
open(index?: number, focus?: string): void;
|
|
390
|
+
close(restoreFocus?: boolean): void;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
export interface PaginationApi extends ControllerApi {
|
|
394
|
+
setPage(page: number): void;
|
|
395
|
+
getPage(): number;
|
|
396
|
+
setTotal(total: number): void;
|
|
397
|
+
render(current: number, total: number): void;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
export interface PopoverApi extends ControllerApi {
|
|
401
|
+
open(): void;
|
|
402
|
+
close(): void;
|
|
403
|
+
toggle(): void;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
export interface QrCodeApi extends ControllerApi {
|
|
407
|
+
render(): void;
|
|
408
|
+
update(value: string, errorCorrectionLevel?: string): void;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
export interface SelectCustomApi extends ControllerApi {
|
|
412
|
+
open(): void;
|
|
413
|
+
close(): void;
|
|
414
|
+
toggle(): void;
|
|
415
|
+
select(value: string): void;
|
|
416
|
+
getValue(): string | null;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export interface SheetApi extends ControllerApi {
|
|
420
|
+
open(): void;
|
|
421
|
+
close(): void;
|
|
422
|
+
toggle(): void;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
export interface SidebarApi extends ControllerApi {
|
|
426
|
+
toggle(): void;
|
|
427
|
+
expand(): void;
|
|
428
|
+
collapse(): void;
|
|
429
|
+
open(): void;
|
|
430
|
+
close(): void;
|
|
431
|
+
isMobile(): boolean;
|
|
432
|
+
/** The root's `data-state` — `""` when it carries none. */
|
|
433
|
+
getState(): string;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
export interface SliderApi extends ControllerApi {
|
|
437
|
+
/** `setValue(thumbIndex, value)` — a single-thumb slider is index 0. */
|
|
438
|
+
setValue(index: number, value: number): void;
|
|
439
|
+
/** A number, or both ends when the slider is a range. */
|
|
440
|
+
getValue(): number | number[];
|
|
441
|
+
getValues(): number[];
|
|
442
|
+
setFormatter(format: ((value: number) => string) | null): void;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
export interface TableSort {
|
|
446
|
+
index: number;
|
|
447
|
+
direction: string;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
export interface TableState {
|
|
451
|
+
sorts: TableSort[];
|
|
452
|
+
filter: string;
|
|
453
|
+
columnFilters: [number, string][];
|
|
454
|
+
widths: (string | null)[];
|
|
455
|
+
hidden: boolean[];
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
export interface TableApi extends ControllerApi {
|
|
459
|
+
sort(columnIndex: number, direction?: string): void;
|
|
460
|
+
sortBy(specs: TableSort[]): void;
|
|
461
|
+
clearSort(): void;
|
|
462
|
+
selectRow(index: number): void;
|
|
463
|
+
selectAll(): void;
|
|
464
|
+
deselectAll(): void;
|
|
465
|
+
/** Row indices, in document order. */
|
|
466
|
+
getSelected(): number[];
|
|
467
|
+
getSelectedData(): Record<string, string>[];
|
|
468
|
+
setFilter(query: string): void;
|
|
469
|
+
setColumnFilter(columnIndex: number, query: string): void;
|
|
470
|
+
clearFilters(): void;
|
|
471
|
+
toggleGroup(target: number | Element, force?: boolean): void;
|
|
472
|
+
toggleRow(target: number | Element, force?: boolean): void;
|
|
473
|
+
toggleDetail(target: number | Element, force?: boolean): void;
|
|
474
|
+
expandAll(): void;
|
|
475
|
+
collapseAll(): void;
|
|
476
|
+
startEdit(row: number | Element, column?: number): void;
|
|
477
|
+
commitEdit(focusBack?: boolean): void;
|
|
478
|
+
cancelEdit(focusBack?: boolean): void;
|
|
479
|
+
moveRow(from: number, to: number): void;
|
|
480
|
+
moveColumn(from: number, to: number): void;
|
|
481
|
+
hideColumn(index: number): void;
|
|
482
|
+
showColumn(index: number): void;
|
|
483
|
+
toggleColumn(index: number, force?: boolean): void;
|
|
484
|
+
setColumnWidth(index: number, width: number): void;
|
|
485
|
+
exportCsv(options?: { all?: boolean; separator?: string; filename?: string }): void;
|
|
486
|
+
/** Visible rows by default; `{ all: true }` includes filtered-out ones. */
|
|
487
|
+
getData(options?: { all?: boolean }): Record<string, string>[];
|
|
488
|
+
getState(): TableState;
|
|
489
|
+
setState(state: Partial<TableState>): void;
|
|
490
|
+
refresh(): void;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
export interface TabsApi extends ControllerApi {
|
|
494
|
+
activate(index: number): void;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
export interface TagInputApi extends ControllerApi {
|
|
498
|
+
getValue(): string[];
|
|
499
|
+
setValue(values: string[]): void;
|
|
500
|
+
addTag(value: string): void;
|
|
501
|
+
removeTag(value: string): void;
|
|
502
|
+
clear(): void;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
export interface ToastApi extends ControllerApi {
|
|
506
|
+
/**
|
|
507
|
+
* `message`, `icon` and `actionLabel` are written with `textContent` —
|
|
508
|
+
* markup in them is inert, so an error string or an echoed username is
|
|
509
|
+
* safe. `iconHtml` is the explicit opt-in that writes `innerHTML`, and is
|
|
510
|
+
* an `l-html`-class surface: author-supplied values only.
|
|
511
|
+
*/
|
|
512
|
+
add(options?: {
|
|
513
|
+
message?: string;
|
|
514
|
+
tone?: string;
|
|
515
|
+
icon?: string;
|
|
516
|
+
/** Unescaped icon markup (e.g. an inline `<svg>`). Never pass untrusted input. */
|
|
517
|
+
iconHtml?: string;
|
|
518
|
+
actionLabel?: string;
|
|
519
|
+
onAction?: (() => void) | null;
|
|
520
|
+
duration?: number;
|
|
521
|
+
}): string;
|
|
522
|
+
dismiss(id: string): void;
|
|
523
|
+
dismissAll(): void;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
export interface ToggleGroupApi extends ControllerApi {
|
|
527
|
+
/** An array in `multi` mode, one value (or `null`) in single mode. */
|
|
528
|
+
getValue(): string | string[] | null;
|
|
529
|
+
setValue(value: string | string[] | null): void;
|
|
530
|
+
toggle(value: string): void;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
export interface TooltipApi extends ControllerApi {
|
|
534
|
+
show(): void;
|
|
535
|
+
hide(): void;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
export interface TreeViewApi extends ControllerApi {
|
|
539
|
+
select(target: string | Element): boolean;
|
|
540
|
+
expand(target: string | Element): boolean;
|
|
541
|
+
collapse(target: string | Element): boolean;
|
|
542
|
+
toggle(target: string | Element): boolean;
|
|
543
|
+
refresh(): void;
|
|
544
|
+
getSelected(): Element | null;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Every recipe controller the shipped engine registers, keyed by its
|
|
549
|
+
* `data-ui` value. The method NAMES are held against each recipe's
|
|
550
|
+
* `@ui:provides` header by the drift test, in both directions.
|
|
551
|
+
*
|
|
552
|
+
* Augment it to type a controller of your own:
|
|
553
|
+
*
|
|
554
|
+
* declare module "@faqir-ui/core" {
|
|
555
|
+
* interface ControllerApis { "my-widget": MyWidgetApi }
|
|
556
|
+
* }
|
|
557
|
+
*/
|
|
558
|
+
export interface ControllerApis {
|
|
559
|
+
accordion: AccordionApi;
|
|
560
|
+
"alert-dialog": DialogApi;
|
|
561
|
+
barcode: BarcodeApi;
|
|
562
|
+
calendar: CalendarApi;
|
|
563
|
+
carousel: CarouselApi;
|
|
564
|
+
combobox: ComboboxApi;
|
|
565
|
+
"command-palette": CommandPaletteApi;
|
|
566
|
+
"context-menu": ContextMenuApi;
|
|
567
|
+
"date-picker": DatePickerApi;
|
|
568
|
+
dialog: DialogApi;
|
|
569
|
+
drawer: DrawerApi;
|
|
570
|
+
dropdown: DropdownApi;
|
|
571
|
+
"file-upload": FileUploadApi;
|
|
572
|
+
"input-otp": InputOtpApi;
|
|
573
|
+
menubar: MenubarApi;
|
|
574
|
+
pagination: PaginationApi;
|
|
575
|
+
popover: PopoverApi;
|
|
576
|
+
"qr-code": QrCodeApi;
|
|
577
|
+
"select-custom": SelectCustomApi;
|
|
578
|
+
sheet: SheetApi;
|
|
579
|
+
sidebar: SidebarApi;
|
|
580
|
+
slider: SliderApi;
|
|
581
|
+
table: TableApi;
|
|
582
|
+
tabs: TabsApi;
|
|
583
|
+
"tag-input": TagInputApi;
|
|
584
|
+
toast: ToastApi;
|
|
585
|
+
"toggle-group": ToggleGroupApi;
|
|
586
|
+
tooltip: TooltipApi;
|
|
587
|
+
"tree-view": TreeViewApi;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
591
|
+
// Inspection [task 0.7-12]
|
|
592
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
593
|
+
|
|
594
|
+
/** The five protocol attributes, read the way `$state`/`$variant` read them. */
|
|
595
|
+
export interface ProtocolState {
|
|
596
|
+
ui: string | null;
|
|
597
|
+
part: string | null;
|
|
598
|
+
variant: string | null;
|
|
599
|
+
size: string | null;
|
|
600
|
+
state: string | null;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Everything Faqir knows about one element.
|
|
605
|
+
*
|
|
606
|
+
* `scope` is a plain deep copy: magics are absent (they are non-enumerable),
|
|
607
|
+
* functions/elements/cycles collapse to markers, mutating it does not touch
|
|
608
|
+
* the live scope, and reading it registers no reactive dependency.
|
|
609
|
+
*
|
|
610
|
+
* The type parameter names the controller you expect, since the engine cannot
|
|
611
|
+
* know it: `Faqir.inspect<Faqir.ControllerApis["dialog"]>("#confirm")`.
|
|
612
|
+
*/
|
|
613
|
+
export interface Inspection<A extends ControllerApi = ControllerApi> {
|
|
614
|
+
el: Element;
|
|
615
|
+
/** Nearest ancestor-or-self owning a scope. */
|
|
616
|
+
scopeRoot: Element | null;
|
|
617
|
+
scopeId: number | null;
|
|
618
|
+
scope: Record<string, unknown> | null;
|
|
619
|
+
directives: InspectedDirective[];
|
|
620
|
+
controller: {
|
|
621
|
+
ui: string;
|
|
622
|
+
el: Element;
|
|
623
|
+
api: A;
|
|
624
|
+
/** The api's function keys, sorted. */
|
|
625
|
+
methods: string[];
|
|
626
|
+
} | null;
|
|
627
|
+
state: ProtocolState;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/** One entry of `__FAQIR_DEVTOOLS__.scopes()`. */
|
|
631
|
+
export interface DevtoolsScope {
|
|
632
|
+
el: Element;
|
|
633
|
+
id: number | null;
|
|
634
|
+
/** `div#cart[data-ui="card"]` — short, human, stable. */
|
|
635
|
+
label: string;
|
|
636
|
+
scope: Record<string, unknown> | null;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
/** One entry of `__FAQIR_DEVTOOLS__.components()`. */
|
|
640
|
+
export interface DevtoolsComponent {
|
|
641
|
+
el: Element;
|
|
642
|
+
label: string;
|
|
643
|
+
ui: string | null;
|
|
644
|
+
variant: string | null;
|
|
645
|
+
size: string | null;
|
|
646
|
+
state: string | null;
|
|
647
|
+
/** This component's OWN parts — parts of a nested `[data-ui]` are excluded. */
|
|
648
|
+
parts: string[];
|
|
649
|
+
/** Whether a controller is mounted on it. */
|
|
650
|
+
controller: boolean;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* One recorded diagnostic. The production engine records none, so
|
|
655
|
+
* `warnings()` is always `[]` there — the four classes exist only in
|
|
656
|
+
* `faqir-core.dev.js`.
|
|
657
|
+
*/
|
|
658
|
+
export interface DevtoolsWarning {
|
|
659
|
+
kind: "expression" | "directive" | "reorder" | "html";
|
|
660
|
+
message: string;
|
|
661
|
+
/** The offending element, as a short label. */
|
|
662
|
+
element: string | null;
|
|
663
|
+
/** Its `outerHTML`, head-and-tail truncated. */
|
|
664
|
+
html: string;
|
|
665
|
+
[extra: string]: unknown;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* `window.__FAQIR_DEVTOOLS__` — the stable handle agents and the `faqir dev`
|
|
670
|
+
* overlay read. Installed by BOTH builds; only `dev` flips between them.
|
|
671
|
+
*/
|
|
672
|
+
export interface Devtools {
|
|
673
|
+
/** Handle schema version. Bumped only on a breaking shape change. */
|
|
674
|
+
readonly version: number;
|
|
675
|
+
/** `true` in `faqir-core.dev.js`, `false` in the production engine. */
|
|
676
|
+
readonly dev: boolean;
|
|
677
|
+
/** The Faqir global itself. */
|
|
678
|
+
readonly faqir: FaqirGlobal;
|
|
679
|
+
inspect<A extends ControllerApi = ControllerApi>(
|
|
680
|
+
target: Element | string,
|
|
681
|
+
): Inspection<A> | null;
|
|
682
|
+
/** Declared scope roots in document order. Defaults to the whole document. */
|
|
683
|
+
scopes(within?: ParentNode): DevtoolsScope[];
|
|
684
|
+
/** Every mounted component, with its protocol attributes and its parts. */
|
|
685
|
+
components(within?: ParentNode): DevtoolsComponent[];
|
|
686
|
+
/** Snapshot of every `Faqir.store()` on the page. */
|
|
687
|
+
stores(): Record<string, Record<string, unknown>>;
|
|
688
|
+
/** Diagnostics recorded so far, oldest first. */
|
|
689
|
+
warnings(): DevtoolsWarning[];
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
693
|
+
// The global
|
|
694
|
+
// ─────────────────────────────────────────────────────────────────────────
|
|
695
|
+
|
|
696
|
+
export interface FaqirGlobal {
|
|
697
|
+
readonly version: string;
|
|
698
|
+
|
|
699
|
+
// ── Reactivity ──
|
|
700
|
+
/** Wrap an object in the reactive proxy. Idempotent — already-reactive in, same out. */
|
|
701
|
+
reactive<T extends object>(obj: T): T;
|
|
702
|
+
/** Run `fn`, re-running it whenever a reactive value it read changes. */
|
|
703
|
+
effect(fn: () => void): Disposer;
|
|
704
|
+
/** Run `fn` with effect flushing deferred until it returns. */
|
|
705
|
+
batch(fn: () => void): void;
|
|
706
|
+
/** Run `fn` without registering any dependency it reads. */
|
|
707
|
+
untrack<T>(fn: () => T): T;
|
|
708
|
+
/** Queue `fn` as a microtask — after the effects a mutation queued flush. */
|
|
709
|
+
nextTick(fn?: () => void): void;
|
|
710
|
+
|
|
711
|
+
// ── Expressions ──
|
|
712
|
+
/**
|
|
713
|
+
* Compile and run one expression against a scope. Errors are reported, not
|
|
714
|
+
* thrown, and yield `undefined`.
|
|
715
|
+
*
|
|
716
|
+
* Compilation uses `new Function`, which is what makes `'unsafe-eval'` a
|
|
717
|
+
* requirement — see `docs/security.md`. Never build the string from input
|
|
718
|
+
* you did not author.
|
|
719
|
+
*/
|
|
720
|
+
evaluate<T = unknown>(expression: string, scope: object, el?: Element | null): T | undefined;
|
|
721
|
+
/** The statement form — `l-on`, `l-init`. Same caveats, no return value. */
|
|
722
|
+
evaluateAssignment(expression: string, scope: object, el?: Element | null): void;
|
|
723
|
+
|
|
724
|
+
// ── Registration ──
|
|
725
|
+
/** Name a scope factory, so `l-data="cart"` resolves to it instead of an object literal. */
|
|
726
|
+
data<T extends Record<string, unknown>>(name: string, factory: () => T): void;
|
|
727
|
+
/** Register a global reactive store, reachable in expressions as `$store.<name>`. */
|
|
728
|
+
store<T extends object>(name: string, obj: T): void;
|
|
729
|
+
/** Register `l-<name>`. The `l-` prefix is NOT part of `name`. */
|
|
730
|
+
directive(name: string, handler: DirectiveHandler): void;
|
|
731
|
+
/** Register `$<name>`. The `$` is NOT part of `name`. */
|
|
732
|
+
magic(name: string, callback: MagicFactory): void;
|
|
733
|
+
/** Call `fn` with the engine. The whole plugin protocol. */
|
|
734
|
+
plugin(fn: Plugin): void;
|
|
735
|
+
/** Register a controller for a `data-ui` value. */
|
|
736
|
+
controller<K extends keyof ControllerApis>(
|
|
737
|
+
name: K,
|
|
738
|
+
factory: ControllerFactory<ControllerApis[K]>,
|
|
739
|
+
): void;
|
|
740
|
+
controller<N extends string>(
|
|
741
|
+
name: N extends keyof ControllerApis ? never : N,
|
|
742
|
+
factory: ControllerFactory,
|
|
743
|
+
): void;
|
|
744
|
+
|
|
745
|
+
// ── Lifecycle ──
|
|
746
|
+
/** Bootstrap. Runs automatically unless the script tag carries `data-manual`. */
|
|
747
|
+
start(): void;
|
|
748
|
+
/** Initialize one subtree, optionally inside an existing scope. */
|
|
749
|
+
initTree(root: Element, parentScope?: Scope | null): void;
|
|
750
|
+
/**
|
|
751
|
+
* Run the cleanups registered on `el` and its descendants — `l-source`
|
|
752
|
+
* aborts, poll teardown, effect disposers, `l-model` listeners, `$watch`
|
|
753
|
+
* subscriptions, and any `__faqirTeardown` the scope's data declared (which is
|
|
754
|
+
* how `apiSource()` stops its polling). Structural directives call this for
|
|
755
|
+
* you; it is exposed for imperative teardown of a subtree.
|
|
756
|
+
*
|
|
757
|
+
* "and its descendants" is a walk over CHILD NODES, not elements: `l-if` and
|
|
758
|
+
* `l-for` own their subtree through an anchor COMMENT, and that is the node
|
|
759
|
+
* their list effect's disposer lives on. Until W3-1 the walk was
|
|
760
|
+
* `querySelectorAll('*')` and the disposers were dropped on the floor anyway,
|
|
761
|
+
* so both structural directives went on running against a destroyed scope —
|
|
762
|
+
* this doc was true of the intent and false of the engine.
|
|
763
|
+
*
|
|
764
|
+
* It does NOT remove rendered DOM. An `l-if` branch that is showing stays
|
|
765
|
+
* showing; what stops is everything that was driving it.
|
|
766
|
+
*/
|
|
767
|
+
destroy(el: Element): void;
|
|
768
|
+
|
|
769
|
+
// ── Inspection ──
|
|
770
|
+
/** A snapshot of one element, by node or by selector. */
|
|
771
|
+
inspect<A extends ControllerApi = ControllerApi>(
|
|
772
|
+
target: Element | string,
|
|
773
|
+
): Inspection<A> | null;
|
|
774
|
+
/**
|
|
775
|
+
* The same object installed at `window.__FAQIR_DEVTOOLS__`. Exposed here
|
|
776
|
+
* too so code holding a specific engine instance reaches ITS handle rather
|
|
777
|
+
* than whichever engine touched the global last.
|
|
778
|
+
*/
|
|
779
|
+
readonly devtools: Devtools;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
declare const Faqir: FaqirGlobal;
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
|
+
* The namespace spelling. Every name is an ALIAS of the module-level
|
|
786
|
+
* declaration, not a copy, so `Faqir.PluginMagics` and the augmentable
|
|
787
|
+
* `PluginMagics` are one interface — augment either, see it through both.
|
|
788
|
+
*/
|
|
789
|
+
declare namespace Faqir {
|
|
790
|
+
export { Disposer, Magics, PluginMagics, Scope, Stores, Directive,
|
|
791
|
+
InspectedDirective, DirectiveHandler, MagicFactory, Plugin,
|
|
792
|
+
SourceController, ControllerApi, ControllerFactory, AccordionApi,
|
|
793
|
+
DialogApi, BarcodeApi, CalendarValue, CalendarApi, CarouselApi,
|
|
794
|
+
ComboboxApi, CommandPaletteApi, ContextMenuApi, DatePickerApi, DrawerApi,
|
|
795
|
+
DropdownApi, FileUploadApi, InputOtpApi, MenubarApi, PaginationApi,
|
|
796
|
+
PopoverApi, QrCodeApi, SelectCustomApi, SheetApi, SidebarApi, SliderApi,
|
|
797
|
+
TableSort, TableState, TableApi, TabsApi, TagInputApi, ToastApi,
|
|
798
|
+
ToggleGroupApi, TooltipApi, TreeViewApi, ControllerApis, ProtocolState,
|
|
799
|
+
Inspection, DevtoolsScope, DevtoolsComponent, DevtoolsWarning, Devtools,
|
|
800
|
+
FaqirGlobal };
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
export default Faqir;
|
|
804
|
+
|
|
805
|
+
// The same members as named exports, matching `dist/faqir-core.mjs`. A bundler
|
|
806
|
+
// cannot destructure a UMD default, which is why the ESM build hands these out
|
|
807
|
+
// individually and why they are declared individually here.
|
|
808
|
+
export declare const version: FaqirGlobal["version"];
|
|
809
|
+
export declare const reactive: FaqirGlobal["reactive"];
|
|
810
|
+
export declare const effect: FaqirGlobal["effect"];
|
|
811
|
+
export declare const batch: FaqirGlobal["batch"];
|
|
812
|
+
export declare const untrack: FaqirGlobal["untrack"];
|
|
813
|
+
export declare const evaluate: FaqirGlobal["evaluate"];
|
|
814
|
+
export declare const evaluateAssignment: FaqirGlobal["evaluateAssignment"];
|
|
815
|
+
export declare const nextTick: FaqirGlobal["nextTick"];
|
|
816
|
+
export declare const data: FaqirGlobal["data"];
|
|
817
|
+
export declare const store: FaqirGlobal["store"];
|
|
818
|
+
export declare const directive: FaqirGlobal["directive"];
|
|
819
|
+
export declare const magic: FaqirGlobal["magic"];
|
|
820
|
+
export declare const plugin: FaqirGlobal["plugin"];
|
|
821
|
+
export declare const controller: FaqirGlobal["controller"];
|
|
822
|
+
export declare const start: FaqirGlobal["start"];
|
|
823
|
+
export declare const initTree: FaqirGlobal["initTree"];
|
|
824
|
+
export declare const inspect: FaqirGlobal["inspect"];
|
|
825
|
+
export declare const devtools: FaqirGlobal["devtools"];
|
|
826
|
+
export declare const destroy: FaqirGlobal["destroy"];
|
|
827
|
+
|
|
828
|
+
declare global {
|
|
829
|
+
/**
|
|
830
|
+
* The classic-script global, set by `faqir-core.min.js` (and by any UMD load
|
|
831
|
+
* that falls to the global branch). Declared here rather than with
|
|
832
|
+
* `export as namespace Faqir`, which under a default export would have made
|
|
833
|
+
* the global the module's export *record* — `Faqir.default.start()` — instead
|
|
834
|
+
* of the engine itself.
|
|
835
|
+
*/
|
|
836
|
+
const Faqir: FaqirGlobal;
|
|
837
|
+
namespace Faqir {
|
|
838
|
+
export { Disposer, Magics, PluginMagics, Scope, Stores, Directive,
|
|
839
|
+
InspectedDirective, DirectiveHandler, MagicFactory, Plugin,
|
|
840
|
+
SourceController, ControllerApi, ControllerFactory, AccordionApi,
|
|
841
|
+
DialogApi, BarcodeApi, CalendarValue, CalendarApi, CarouselApi,
|
|
842
|
+
ComboboxApi, CommandPaletteApi, ContextMenuApi, DatePickerApi,
|
|
843
|
+
DrawerApi, DropdownApi, FileUploadApi, InputOtpApi, MenubarApi,
|
|
844
|
+
PaginationApi, PopoverApi, QrCodeApi, SelectCustomApi, SheetApi,
|
|
845
|
+
SidebarApi, SliderApi, TableSort, TableState, TableApi, TabsApi,
|
|
846
|
+
TagInputApi, ToastApi, ToggleGroupApi, TooltipApi, TreeViewApi,
|
|
847
|
+
ControllerApis, ProtocolState, Inspection, DevtoolsScope,
|
|
848
|
+
DevtoolsComponent, DevtoolsWarning, Devtools, FaqirGlobal };
|
|
849
|
+
}
|
|
850
|
+
interface Window {
|
|
851
|
+
/** Set by the classic-script build; absent under a bundler import. */
|
|
852
|
+
Faqir?: FaqirGlobal;
|
|
853
|
+
/** Installed by both engine builds on every Faqir page. */
|
|
854
|
+
__FAQIR_DEVTOOLS__?: Devtools;
|
|
855
|
+
}
|
|
856
|
+
}
|