@konomi-app/ui 5.3.2 → 5.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -157,12 +157,12 @@ interface DialogState {
157
157
  stepFormSubmitText: string;
158
158
  }
159
159
 
160
- type Listener = (state: DialogState) => void;
160
+ type Listener$1 = (state: DialogState) => void;
161
161
  declare class DialogController {
162
162
  #private;
163
163
  constructor();
164
164
  get state(): Readonly<DialogState>;
165
- subscribe(fn: Listener): () => void;
165
+ subscribe(fn: Listener$1): () => void;
166
166
  show(options?: ShowOptions): void;
167
167
  hide(): void;
168
168
  alert(optionsOrLabel: string | AlertOptions): Promise<DialogResult>;
@@ -284,4 +284,108 @@ declare class DialogSingleton {
284
284
  }
285
285
  declare const dialog: DialogSingleton;
286
286
 
287
- export { type AlertIcon, type AlertOptions, type ConfirmOptions, DialogController, type DialogResult, type DialogState, type DialogType, type FormFieldGroup, type FormFieldMeta, type FormInputType, type FormLayout, type FormOptions, OverlayDialog, type QueueItem, type QueueItemStatus, type ShowOptions, type StepFormItem, type StepFormOptions, type StepFormStepInput, type StepItem, type StepItemStatus, type TaskItemInput, dialog };
287
+ type ToastType = 'success' | 'error' | 'warning' | 'info' | 'loading';
288
+ type ToastPosition = 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center';
289
+ interface ToastAction {
290
+ label: string;
291
+ onClick: () => void;
292
+ }
293
+ interface ToastItem {
294
+ /** show() が返す一意な ID。dismiss(id) で使用 */
295
+ id: string;
296
+ /** アイコン・色を決定するビジュアルタイプ */
297
+ type: ToastType;
298
+ /** 主メッセージ */
299
+ message: string;
300
+ /** 補足説明 (省略可) */
301
+ description: string;
302
+ /** アクションボタン (省略可) */
303
+ action: ToastAction | null;
304
+ /** 自動非表示までの時間 (ms)。0 = 自動非表示なし */
305
+ duration: number;
306
+ /** 残り時間 (ms)。pause/resume で更新される */
307
+ remainingMs: number;
308
+ /** hover などで一時停止中かどうか */
309
+ paused: boolean;
310
+ /** 退出アニメーション再生中かどうか */
311
+ dismissing: boolean;
312
+ }
313
+ interface ToastOptions {
314
+ type?: ToastType;
315
+ message: string;
316
+ description?: string;
317
+ action?: ToastAction;
318
+ /** 表示時間 (ms)。省略時は defaultDuration。0 = 永続表示 */
319
+ duration?: number;
320
+ }
321
+ interface ToastConfig {
322
+ position: ToastPosition;
323
+ maxVisible: number;
324
+ defaultDuration: number;
325
+ }
326
+ interface ToastState {
327
+ items: ToastItem[];
328
+ position: ToastPosition;
329
+ maxVisible: number;
330
+ defaultDuration: number;
331
+ }
332
+
333
+ type Listener = (state: ToastState) => void;
334
+ declare class ToastController {
335
+ #private;
336
+ constructor();
337
+ get state(): Readonly<ToastState>;
338
+ subscribe(fn: Listener): () => void;
339
+ configure(config: Partial<ToastConfig>): void;
340
+ show(options: ToastOptions): string;
341
+ success(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
342
+ error(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
343
+ warning(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
344
+ info(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
345
+ loading(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
346
+ dismiss(id: string): void;
347
+ dismissAll(): void;
348
+ update(id: string, patch: Partial<Pick<ToastItem, 'message' | 'description' | 'type' | 'action'>> & {
349
+ /** duration を変更する場合に指定。loading→非loading 遷移時は省略で defaultDuration を自動適用 */
350
+ duration?: number;
351
+ }): void;
352
+ pauseTimer(id: string): void;
353
+ resumeTimer(id: string): void;
354
+ }
355
+
356
+ declare class ToastContainer extends LitElement {
357
+ static styles: lit.CSSResult;
358
+ controller: ToastController;
359
+ private _state;
360
+ private _unsubscribe?;
361
+ connectedCallback(): void;
362
+ disconnectedCallback(): void;
363
+ private _renderIcon;
364
+ private _renderToast;
365
+ render(): TemplateResult;
366
+ }
367
+ declare global {
368
+ interface HTMLElementTagNameMap {
369
+ 'toast-container': ToastContainer;
370
+ }
371
+ }
372
+
373
+ declare class ToastSingleton {
374
+ #private;
375
+ configure(config: Partial<ToastConfig>): void;
376
+ show(options: ToastOptions): string;
377
+ success(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
378
+ error(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
379
+ warning(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
380
+ info(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
381
+ loading(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
382
+ dismiss(id: string): void;
383
+ dismissAll(): void;
384
+ update(id: string, patch: Partial<Pick<ToastItem, 'message' | 'description' | 'type' | 'action'>> & {
385
+ duration?: number;
386
+ }): void;
387
+ get controller(): ToastController;
388
+ }
389
+ declare const toast: ToastSingleton;
390
+
391
+ export { type AlertIcon, type AlertOptions, type ConfirmOptions, DialogController, type DialogResult, type DialogState, type DialogType, type FormFieldGroup, type FormFieldMeta, type FormInputType, type FormLayout, type FormOptions, OverlayDialog, type QueueItem, type QueueItemStatus, type ShowOptions, type StepFormItem, type StepFormOptions, type StepFormStepInput, type StepItem, type StepItemStatus, type TaskItemInput, type ToastAction, type ToastConfig, ToastContainer, ToastController, type ToastItem, type ToastOptions, type ToastPosition, type ToastState, type ToastType, dialog, toast };
package/dist/index.d.ts CHANGED
@@ -157,12 +157,12 @@ interface DialogState {
157
157
  stepFormSubmitText: string;
158
158
  }
159
159
 
160
- type Listener = (state: DialogState) => void;
160
+ type Listener$1 = (state: DialogState) => void;
161
161
  declare class DialogController {
162
162
  #private;
163
163
  constructor();
164
164
  get state(): Readonly<DialogState>;
165
- subscribe(fn: Listener): () => void;
165
+ subscribe(fn: Listener$1): () => void;
166
166
  show(options?: ShowOptions): void;
167
167
  hide(): void;
168
168
  alert(optionsOrLabel: string | AlertOptions): Promise<DialogResult>;
@@ -284,4 +284,108 @@ declare class DialogSingleton {
284
284
  }
285
285
  declare const dialog: DialogSingleton;
286
286
 
287
- export { type AlertIcon, type AlertOptions, type ConfirmOptions, DialogController, type DialogResult, type DialogState, type DialogType, type FormFieldGroup, type FormFieldMeta, type FormInputType, type FormLayout, type FormOptions, OverlayDialog, type QueueItem, type QueueItemStatus, type ShowOptions, type StepFormItem, type StepFormOptions, type StepFormStepInput, type StepItem, type StepItemStatus, type TaskItemInput, dialog };
287
+ type ToastType = 'success' | 'error' | 'warning' | 'info' | 'loading';
288
+ type ToastPosition = 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center';
289
+ interface ToastAction {
290
+ label: string;
291
+ onClick: () => void;
292
+ }
293
+ interface ToastItem {
294
+ /** show() が返す一意な ID。dismiss(id) で使用 */
295
+ id: string;
296
+ /** アイコン・色を決定するビジュアルタイプ */
297
+ type: ToastType;
298
+ /** 主メッセージ */
299
+ message: string;
300
+ /** 補足説明 (省略可) */
301
+ description: string;
302
+ /** アクションボタン (省略可) */
303
+ action: ToastAction | null;
304
+ /** 自動非表示までの時間 (ms)。0 = 自動非表示なし */
305
+ duration: number;
306
+ /** 残り時間 (ms)。pause/resume で更新される */
307
+ remainingMs: number;
308
+ /** hover などで一時停止中かどうか */
309
+ paused: boolean;
310
+ /** 退出アニメーション再生中かどうか */
311
+ dismissing: boolean;
312
+ }
313
+ interface ToastOptions {
314
+ type?: ToastType;
315
+ message: string;
316
+ description?: string;
317
+ action?: ToastAction;
318
+ /** 表示時間 (ms)。省略時は defaultDuration。0 = 永続表示 */
319
+ duration?: number;
320
+ }
321
+ interface ToastConfig {
322
+ position: ToastPosition;
323
+ maxVisible: number;
324
+ defaultDuration: number;
325
+ }
326
+ interface ToastState {
327
+ items: ToastItem[];
328
+ position: ToastPosition;
329
+ maxVisible: number;
330
+ defaultDuration: number;
331
+ }
332
+
333
+ type Listener = (state: ToastState) => void;
334
+ declare class ToastController {
335
+ #private;
336
+ constructor();
337
+ get state(): Readonly<ToastState>;
338
+ subscribe(fn: Listener): () => void;
339
+ configure(config: Partial<ToastConfig>): void;
340
+ show(options: ToastOptions): string;
341
+ success(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
342
+ error(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
343
+ warning(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
344
+ info(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
345
+ loading(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
346
+ dismiss(id: string): void;
347
+ dismissAll(): void;
348
+ update(id: string, patch: Partial<Pick<ToastItem, 'message' | 'description' | 'type' | 'action'>> & {
349
+ /** duration を変更する場合に指定。loading→非loading 遷移時は省略で defaultDuration を自動適用 */
350
+ duration?: number;
351
+ }): void;
352
+ pauseTimer(id: string): void;
353
+ resumeTimer(id: string): void;
354
+ }
355
+
356
+ declare class ToastContainer extends LitElement {
357
+ static styles: lit.CSSResult;
358
+ controller: ToastController;
359
+ private _state;
360
+ private _unsubscribe?;
361
+ connectedCallback(): void;
362
+ disconnectedCallback(): void;
363
+ private _renderIcon;
364
+ private _renderToast;
365
+ render(): TemplateResult;
366
+ }
367
+ declare global {
368
+ interface HTMLElementTagNameMap {
369
+ 'toast-container': ToastContainer;
370
+ }
371
+ }
372
+
373
+ declare class ToastSingleton {
374
+ #private;
375
+ configure(config: Partial<ToastConfig>): void;
376
+ show(options: ToastOptions): string;
377
+ success(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
378
+ error(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
379
+ warning(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
380
+ info(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
381
+ loading(message: string, options?: Omit<ToastOptions, 'type' | 'message'>): string;
382
+ dismiss(id: string): void;
383
+ dismissAll(): void;
384
+ update(id: string, patch: Partial<Pick<ToastItem, 'message' | 'description' | 'type' | 'action'>> & {
385
+ duration?: number;
386
+ }): void;
387
+ get controller(): ToastController;
388
+ }
389
+ declare const toast: ToastSingleton;
390
+
391
+ export { type AlertIcon, type AlertOptions, type ConfirmOptions, DialogController, type DialogResult, type DialogState, type DialogType, type FormFieldGroup, type FormFieldMeta, type FormInputType, type FormLayout, type FormOptions, OverlayDialog, type QueueItem, type QueueItemStatus, type ShowOptions, type StepFormItem, type StepFormOptions, type StepFormStepInput, type StepItem, type StepItemStatus, type TaskItemInput, type ToastAction, type ToastConfig, ToastContainer, ToastController, type ToastItem, type ToastOptions, type ToastPosition, type ToastState, type ToastType, dialog, toast };