mnfst-types 0.1.6 → 0.1.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mnfst-types",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Generate TypeScript types for a Manifest project from manifest.json and sample data",
5
5
  "type": "module",
6
6
  "bin": {
@@ -139,41 +139,49 @@ export interface ManifestLocale {
139
139
  set(locale: string): void;
140
140
  }
141
141
 
142
- /** `$toast` from the toasts plugin. */
143
- export interface ManifestToast {
144
- (message: string, opts?: { type?: 'info' | 'success' | 'warning' | 'error'; duration?: number }): void;
145
- info(message: string, opts?: Record<string, unknown>): void;
146
- success(message: string, opts?: Record<string, unknown>): void;
147
- warning(message: string, opts?: Record<string, unknown>): void;
148
- error(message: string, opts?: Record<string, unknown>): void;
149
- dismiss(id?: string): void;
142
+ /** One toast flavor: callable, with `.dismiss` (adds a close button) and `.fixed` (sticky) variants. */
143
+ export interface ManifestToastVariant {
144
+ (message: string, opts?: Record<string, unknown>): void;
145
+ dismiss(message: string, opts?: Record<string, unknown>): void;
146
+ fixed(message: string, opts?: Record<string, unknown>): void;
150
147
  }
151
148
 
152
- /** `$colors` from the themes plugin. */
153
- export interface ManifestTheme {
154
- readonly current: 'light' | 'dark' | 'system';
155
- set(theme: 'light' | 'dark' | 'system'): void;
156
- toggle(): void;
149
+ /** `$toast` from the toasts plugin. Typed variants: `$toast.brand(...)`, `$toast.positive.dismiss(...)`. */
150
+ export interface ManifestToast extends ManifestToastVariant {
151
+ brand: ManifestToastVariant;
152
+ accent: ManifestToastVariant;
153
+ positive: ManifestToastVariant;
154
+ negative: ManifestToastVariant;
157
155
  }
158
156
 
159
- /** `$colors` from the colors plugin. */
160
- export interface ManifestColors {
161
- [name: string]: string | ManifestColors;
157
+ /** `$color` from the color plugin — the current light/dark/system color mode. */
158
+ export interface ManifestColor {
159
+ current: 'light' | 'dark' | 'system' | string;
162
160
  }
163
161
 
164
- /** `$colorpicker` from the colorpicker plugin. */
162
+ /** `$colorpicker` from the colorpicker plugin. Loose by design. */
165
163
  export interface ManifestColorpicker {
166
- open(opts?: Record<string, unknown>): void;
167
- close(): void;
164
+ (id?: string): Record<string, unknown>;
168
165
  [extra: string]: unknown;
169
166
  }
170
167
 
171
- /** `$url` from the url-parameters plugin: read/write URL query params reactively. */
168
+ /** One URL query parameter handle from `$url.<name>` (reactive). */
169
+ export interface ManifestUrlParam {
170
+ /** Current value (get/set; empty string when absent). */
171
+ value: string;
172
+ /** First value when the param repeats. */
173
+ readonly first: string;
174
+ /** All values for a repeating param. */
175
+ readonly all: string[];
176
+ set(value: string): void;
177
+ add(value: string): void;
178
+ remove(value?: string): void;
179
+ clear(): void;
180
+ }
181
+
182
+ /** `$url` from the url-parameters plugin: `$url.tab.value`, `$url.tag.add('x')`, ... */
172
183
  export interface ManifestUrl {
173
- get(name: string): string | null;
174
- set(name: string, value: string | null): void;
175
- has(name: string): boolean;
176
- [name: string]: unknown;
184
+ [param: string]: ManifestUrlParam;
177
185
  }
178
186
 
179
187
  /** `$route` magic — true if the current route matches the given pattern. */
@@ -188,6 +196,152 @@ export type ManifestModify = (attr: string) => string | undefined;
188
196
  /** `$try(fn)` — run a callback and swallow any thrown error, returning undefined on failure. */
189
197
  export type ManifestTry = <T>(fn: () => T) => T | undefined;
190
198
 
199
+ /** `$pay` from the payments plugin: callable to start checkout, plus portal/state helpers. */
200
+ export interface ManifestPay {
201
+ (ref: string, payload?: Record<string, unknown>): Promise<unknown>;
202
+ portal(ref?: string, payload?: Record<string, unknown>): Promise<unknown>;
203
+ refresh(): Promise<unknown>;
204
+ register(name: string, adapter: unknown): void;
205
+ readonly state: Record<string, unknown> | undefined;
206
+ readonly loading: boolean | undefined;
207
+ [extra: string]: unknown;
208
+ }
209
+
210
+ /** A conversation handle returned by `$chat.open(...)`. Loose by design. */
211
+ export interface ManifestChatHandle {
212
+ readonly messages: unknown[];
213
+ readonly participants: unknown[];
214
+ readonly typing: unknown[];
215
+ readonly me: unknown;
216
+ [extra: string]: unknown;
217
+ }
218
+
219
+ /** `$chat` from the chat plugin — adapter-based conversation projection. */
220
+ export interface ManifestChat {
221
+ open(conversationId: string, opts?: Record<string, unknown>): ManifestChatHandle;
222
+ merge(handles: ManifestChatHandle[], opts?: Record<string, unknown>): ManifestChatHandle;
223
+ adapter(name: string, factory?: unknown): unknown;
224
+ flatten(tree: unknown): unknown[];
225
+ /** Shared revision counter — trackable even before any handle resolves. */
226
+ readonly version: number;
227
+ [extra: string]: unknown;
228
+ }
229
+
230
+ /** One `$status.<name>` entry. */
231
+ export interface ManifestStatusEntry {
232
+ readonly state: string;
233
+ [extra: string]: unknown;
234
+ }
235
+
236
+ /** `$status` from the status plugin: `$status.api.state`, iterable, stringifies to the overall state. */
237
+ export interface ManifestStatus extends Iterable<ManifestStatusEntry> {
238
+ readonly [name: string]: any;
239
+ }
240
+
241
+ /** `$presence` from the Appwrite presences plugin. */
242
+ export interface ManifestPresence {
243
+ start(opts?: Record<string, unknown>): Promise<unknown>;
244
+ stop(): void;
245
+ set(values: Record<string, unknown>): Promise<unknown>;
246
+ clear(): Promise<unknown>;
247
+ of(userId: string): unknown;
248
+ all(): unknown[];
249
+ readonly records: Record<string, unknown>;
250
+ readonly list: unknown[];
251
+ readonly ready: boolean;
252
+ readonly error: unknown;
253
+ readonly me: unknown;
254
+ }
255
+
256
+ /** `$date(id?)` from the datepicker plugin — the picker API for the nearest (or given) instance. */
257
+ export type ManifestDate = (id?: string) => Record<string, unknown>;
258
+
259
+ /** `$chart(id?)` from the charts plugin — the chart API for the nearest (or given) instance. */
260
+ export type ManifestChart = (id?: string) => Record<string, unknown>;
261
+
262
+ /** `$export(opts)` from the export plugin — export the page or a data source (pdf/csv/json/...). */
263
+ export type ManifestExport = (opts?: {
264
+ format?: string;
265
+ filename?: string;
266
+ source?: string;
267
+ data?: unknown;
268
+ [extra: string]: unknown;
269
+ }) => Promise<unknown>;
270
+
271
+ /** `$device` from the utilities plugin (enriched by the native plugin when present). */
272
+ export interface ManifestDevice {
273
+ readonly os: string;
274
+ readonly touch: boolean;
275
+ readonly online: boolean;
276
+ readonly standalone: boolean;
277
+ readonly native: boolean;
278
+ readonly platform: string;
279
+ }
280
+
281
+ /** `$share` from the native plugin — native sheet, web share, or clipboard fallback. */
282
+ export type ManifestShare = (opts?: { title?: string; text?: string; url?: string }) =>
283
+ Promise<{ shared: boolean; method: string; cancelled?: boolean }>;
284
+
285
+ /** `$push` from the native plugin — push/notification permissions and token. */
286
+ export interface ManifestPush {
287
+ request(): Promise<string>;
288
+ readonly permission: string;
289
+ [extra: string]: unknown;
290
+ }
291
+
292
+ /** `$secure` from the native plugin — secure key-value storage (native keychain or fallback). */
293
+ export interface ManifestSecure {
294
+ get(key: string): Promise<string | null>;
295
+ set(key: string, value: string): Promise<void>;
296
+ remove(key: string): Promise<void>;
297
+ keys(): Promise<string[]>;
298
+ clear(): Promise<void>;
299
+ use(adapter: unknown): void;
300
+ }
301
+
302
+ /** `$links` from the native plugin — deep/universal link handling. */
303
+ export interface ManifestLinks {
304
+ on(handler: (url: string) => void): void;
305
+ open(url: string): void;
306
+ readonly last: string | null;
307
+ }
308
+
309
+ /** `$app` from the native plugin — foreground/background state. */
310
+ export interface ManifestApp {
311
+ readonly active: boolean;
312
+ onChange(handler: (active: boolean) => void): void;
313
+ }
314
+
315
+ /** `$haptics` from the native plugin — haptic feedback with web vibration fallback. */
316
+ export interface ManifestHaptics {
317
+ impact(style?: string): Promise<unknown>;
318
+ notification(type?: string): Promise<unknown>;
319
+ [extra: string]: unknown;
320
+ }
321
+
322
+ /** `$biometric` from the native plugin. */
323
+ export interface ManifestBiometric {
324
+ available(): Promise<boolean>;
325
+ verify(opts?: Record<string, unknown>): Promise<unknown>;
326
+ }
327
+
328
+ /** `$camera` from the native plugin. */
329
+ export interface ManifestCamera {
330
+ photo(opts?: Record<string, unknown>): Promise<unknown>;
331
+ pick(opts?: Record<string, unknown>): Promise<unknown>;
332
+ }
333
+
334
+ /**
335
+ * Manifest's custom-element/attribute authoring surface (documentation aid —
336
+ * these are HTML attributes, not JS globals). Element styles pair with most.
337
+ */
338
+ export type ManifestDirective =
339
+ | 'x-route' | 'x-anchors'
340
+ | 'x-icon' | 'x-svg' | 'x-markdown' | 'x-code' | 'x-code-group'
341
+ | 'x-toast' | 'x-tooltip' | 'x-carousel' | 'x-virtual' | 'x-resize'
342
+ | 'x-chart' | 'x-date' | 'x-color' | 'x-colorpicker' | 'x-combobox'
343
+ | 'x-export' | 'x-pay' | 'x-files' | 'x-data-files';
344
+
191
345
  // ---------------------------------------------------------------------------
192
346
  // Global declarations (what Alpine exposes inside `x-data`, `x-show`, etc.)
193
347
  // ---------------------------------------------------------------------------
@@ -201,20 +355,50 @@ declare global {
201
355
  const $modify: ManifestModify;
202
356
  /** Run a callback safely, returning undefined on error. */
203
357
  const $try: ManifestTry;
204
- /** Appwrite auth plugin (only present when the plugin is loaded). */
358
+ /** Appwrite auth plugin (present when the plugin is loaded). */
205
359
  const $auth: ManifestAuth;
206
360
  /** Localization plugin. */
207
361
  const $locale: ManifestLocale;
208
362
  /** Toasts plugin. */
209
363
  const $toast: ManifestToast;
210
- /** Themes plugin. */
211
- const $colors: ManifestTheme;
212
- /** Colors plugin. */
213
- const $colors: ManifestColors;
364
+ /** Color-mode plugin (`$color.current = 'dark'`). */
365
+ const $color: ManifestColor;
214
366
  /** Colorpicker plugin. */
215
367
  const $colorpicker: ManifestColorpicker;
216
- /** URL parameters plugin. */
368
+ /** URL parameters plugin (`$url.tab.value`). */
217
369
  const $url: ManifestUrl;
370
+ /** Payments plugin. */
371
+ const $pay: ManifestPay;
372
+ /** Chat plugin. */
373
+ const $chat: ManifestChat;
374
+ /** Status plugin. */
375
+ const $status: ManifestStatus;
376
+ /** Appwrite presences plugin. */
377
+ const $presence: ManifestPresence;
378
+ /** Datepicker plugin. */
379
+ const $date: ManifestDate;
380
+ /** Charts plugin. */
381
+ const $chart: ManifestChart;
382
+ /** Export plugin. */
383
+ const $export: ManifestExport;
384
+ /** Device/platform info (utilities; enriched by the native plugin). */
385
+ const $device: ManifestDevice;
386
+ /** Native share (native plugin). */
387
+ const $share: ManifestShare;
388
+ /** Push permissions (native plugin). */
389
+ const $push: ManifestPush;
390
+ /** Secure storage (native plugin). */
391
+ const $secure: ManifestSecure;
392
+ /** Deep links (native plugin). */
393
+ const $links: ManifestLinks;
394
+ /** App foreground state (native plugin). */
395
+ const $app: ManifestApp;
396
+ /** Haptics (native plugin). */
397
+ const $haptics: ManifestHaptics;
398
+ /** Biometric auth (native plugin). */
399
+ const $biometric: ManifestBiometric;
400
+ /** Camera (native plugin). */
401
+ const $camera: ManifestCamera;
218
402
 
219
403
  /** Window-level Manifest namespace exposed by the loader. */
220
404
  interface Window {