@blackcube/aurelia-kit 1.0.0-rc5 → 1.0.0-rc7
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 +24 -18
- package/dist/index.es.js +545 -536
- package/dist/index.es.js.map +1 -1
- package/dist/types/abstracts/components/abstract-dialog.d.ts +3 -4
- package/dist/types/abstracts/components/abstract-dialog.d.ts.map +1 -1
- package/dist/types/attributes/menu.d.ts +23 -1
- package/dist/types/attributes/menu.d.ts.map +1 -1
- package/dist/types/attributes/modal-trigger.d.ts +0 -1
- package/dist/types/attributes/modal-trigger.d.ts.map +1 -1
- package/dist/types/attributes/toast.d.ts +2 -2
- package/dist/types/attributes/toaster-trigger.d.ts +3 -3
- package/dist/types/attributes/toaster.d.ts +2 -2
- package/dist/types/components/bleet-dialog.d.ts +1 -1
- package/dist/types/enums/event-aggregator.d.ts +6 -6
- package/dist/types/enums/event-aggregator.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/interfaces/dialog.d.ts +1 -2
- package/dist/types/interfaces/dialog.d.ts.map +1 -1
- package/dist/types/interfaces/event-aggregator.d.ts +2 -3
- package/dist/types/interfaces/event-aggregator.d.ts.map +1 -1
- package/dist/types/utils/toaster.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ An element that must leave the layout when hidden also carries the HTML `hidden`
|
|
|
61
61
|
(Tailwind's preflight turns it into `display: none`); the attribute toggles it, never a class.
|
|
62
62
|
|
|
63
63
|
Attribute options use the Aurelia multi-binding syntax, as written by the PHP widgets:
|
|
64
|
-
`bleet-toaster-trigger="
|
|
64
|
+
`bleet-toaster-trigger="level: success; title: Saved; content: Done; duration: 3000"`.
|
|
65
65
|
|
|
66
66
|
## Abstract components
|
|
67
67
|
|
|
@@ -185,7 +185,6 @@ Behavior:
|
|
|
185
185
|
```typescript
|
|
186
186
|
interface IDialogResponse {
|
|
187
187
|
content?: string; // the whole HTML of the dialog
|
|
188
|
-
color?: UiColor; // not used by the element: the server HTML carries its own colors
|
|
189
188
|
icon?: string | null; // not used by the element: the server HTML carries its own icon
|
|
190
189
|
action?: DialogAction; // Close closes the dialog, RefreshAndClose closes it and reloads the page
|
|
191
190
|
toast?: IToast; // published on Channels.Toaster
|
|
@@ -195,7 +194,8 @@ interface IDialogResponse {
|
|
|
195
194
|
}
|
|
196
195
|
```
|
|
197
196
|
|
|
198
|
-
PHP side, `AureliaCommunication::dialogContent($content
|
|
197
|
+
PHP side, `AureliaCommunication::dialogContent($content)` builds the `content` part of it: the look of the dialog is
|
|
198
|
+
in its HTML.
|
|
199
199
|
|
|
200
200
|
**In a SPA**, the frame is the application's: its element extends `AbstractDialog` (see
|
|
201
201
|
[Abstract components](#abstract-components)), its template holds the `<dialog ref="dialogElement">`, and the dialog is
|
|
@@ -216,13 +216,13 @@ export class AppDrawer extends AbstractDialog {}
|
|
|
216
216
|
```
|
|
217
217
|
|
|
218
218
|
```typescript
|
|
219
|
-
resolve(IEventAggregator).publish(Channels.Modal, <IModal>{ action: ModalAction.Open, id: 'drawer', title: 'Edit user'
|
|
219
|
+
resolve(IEventAggregator).publish(Channels.Modal, <IModal>{ action: ModalAction.Open, id: 'drawer', title: 'Edit user' });
|
|
220
220
|
```
|
|
221
221
|
|
|
222
222
|
| `AbstractDialog` | Meaning |
|
|
223
223
|
|---|---|
|
|
224
224
|
| `id` (bindable) | the id of the dialog on `Channels.Modal` |
|
|
225
|
-
| `title
|
|
225
|
+
| `title` | the one of the opening, kept until the dialog is closed |
|
|
226
226
|
| `dialogElement` | the `<dialog>` of the template (`ref`) |
|
|
227
227
|
| `show(data)`, `close()`, `clear()` | protected, to extend: an opening, a closing, what to clear once closed |
|
|
228
228
|
|
|
@@ -285,7 +285,7 @@ Markup it expects:
|
|
|
285
285
|
<div bleet-toaster popover="manual"
|
|
286
286
|
class="fixed inset-auto top-4 right-0 z-70 m-0 p-0 pr-4 border-0 bg-transparent overflow-visible flex flex-col gap-4 pointer-events-none">
|
|
287
287
|
|
|
288
|
-
<!-- one template per
|
|
288
|
+
<!-- one template per UiLevel: info, success, warning, danger -->
|
|
289
289
|
<template data-toaster="success">
|
|
290
290
|
<div class="… translate-x-full opacity-0 transition-all duration-500"
|
|
291
291
|
data-toaster-show="translate-x-0 opacity-100"
|
|
@@ -311,24 +311,24 @@ box of a popover (`inset`, `margin`, `padding`, `border`, `background`, `overflo
|
|
|
311
311
|
|
|
312
312
|
Behavior:
|
|
313
313
|
|
|
314
|
-
- `ToasterAction.Add`: clones `template[data-toaster=<
|
|
314
|
+
- `ToasterAction.Add`: clones `template[data-toaster=<level>]`, puts the icon of
|
|
315
315
|
`template[data-toaster=icon-<icon>]` in the `icon` slot, fills `title` and `content`, appends the card to the
|
|
316
316
|
container, then swaps its hide classes for its show classes. With `duration` > 0 the toast closes itself after
|
|
317
317
|
`duration` ms; `0` keeps it until it is closed.
|
|
318
318
|
- `ToasterAction.Remove` (or a click on `close`): swaps the show classes for the hide classes, waits for the end
|
|
319
319
|
of the transition, removes the card.
|
|
320
|
-
- A toast whose `id` is already displayed is ignored. A
|
|
320
|
+
- A toast whose `id` is already displayed is ignored. A level without template is logged and ignored.
|
|
321
321
|
|
|
322
322
|
Publishing a toast from TypeScript:
|
|
323
323
|
|
|
324
324
|
```typescript
|
|
325
325
|
import { resolve, IEventAggregator } from 'aurelia';
|
|
326
|
-
import { Channels, IToaster, ToasterAction,
|
|
326
|
+
import { Channels, IToaster, ToasterAction, UiLevel, UiToastIcon } from '@blackcube/aurelia-kit';
|
|
327
327
|
|
|
328
328
|
resolve(IEventAggregator).publish(Channels.Toaster, <IToaster>{
|
|
329
329
|
action: ToasterAction.Add,
|
|
330
330
|
toast: {
|
|
331
|
-
|
|
331
|
+
level: UiLevel.Success,
|
|
332
332
|
icon: UiToastIcon.Success,
|
|
333
333
|
title: 'Saved',
|
|
334
334
|
content: 'The page has been saved.',
|
|
@@ -345,7 +345,7 @@ interface IToaster {
|
|
|
345
345
|
|
|
346
346
|
interface IToast {
|
|
347
347
|
id?: string; // generated when absent
|
|
348
|
-
|
|
348
|
+
level: UiLevel; // default Info
|
|
349
349
|
icon?: UiToastIcon; // default Info
|
|
350
350
|
title?: string;
|
|
351
351
|
content: string; // HTML
|
|
@@ -359,20 +359,20 @@ Publishes one toast when the page loads (after `DOMContentLoaded`). Rendered by
|
|
|
359
359
|
as a hidden element:
|
|
360
360
|
|
|
361
361
|
```html
|
|
362
|
-
<div hidden bleet-toast="
|
|
362
|
+
<div hidden bleet-toast="level: success; icon: check-circle; title: Saved; content: Done; duration: 3000"></div>
|
|
363
363
|
```
|
|
364
364
|
|
|
365
|
-
Options: `id`, `
|
|
365
|
+
Options: `id`, `level`, `icon`, `title`, `content`, `duration` (same meaning as `IToast`).
|
|
366
366
|
|
|
367
367
|
### `bleet-toaster-trigger`
|
|
368
368
|
|
|
369
369
|
Publishes one toast on click. Rendered by `Bleet::toast()->…->trigger()` as attributes of another element:
|
|
370
370
|
|
|
371
371
|
```html
|
|
372
|
-
<button bleet-toaster-trigger="
|
|
372
|
+
<button bleet-toaster-trigger="level: success; content: Saved!">Save</button>
|
|
373
373
|
```
|
|
374
374
|
|
|
375
|
-
Options: `id`, `
|
|
375
|
+
Options: `id`, `level`, `icon`, `title`, `content`, `duration`.
|
|
376
376
|
|
|
377
377
|
### `AbstractToaster` (SPA)
|
|
378
378
|
|
|
@@ -399,7 +399,7 @@ export class AppToaster extends AbstractToaster {}
|
|
|
399
399
|
|
|
400
400
|
| `AbstractToaster` | Meaning |
|
|
401
401
|
|---|---|
|
|
402
|
-
| `toasts` | the toasts shown: `id`, `
|
|
402
|
+
| `toasts` | the toasts shown: `id`, `level`, `icon`, `title`, `content`, `duration`, with the defaults of the attribute |
|
|
403
403
|
| `onClickClose(event, id)` | closes the toast (its button) |
|
|
404
404
|
|
|
405
405
|
Behavior:
|
|
@@ -496,7 +496,13 @@ Behavior:
|
|
|
496
496
|
|
|
497
497
|
- Listens on `Channels.Menu`: `MenuAction.Open` applies the show classes and opens the overlay, `MenuAction.Close`
|
|
498
498
|
applies the hide classes and closes the overlay, `MenuAction.Toggle` does one or the other. `aria-hidden` follows.
|
|
499
|
-
- A click on `[data-menu=close]` closes the menu; the menu closes too when the overlay closes
|
|
499
|
+
- A click on `[data-menu=close]` closes the menu; the menu closes too when the overlay closes, on `Escape` and on a
|
|
500
|
+
click on a link of the menu (the link is followed).
|
|
501
|
+
- Open, the focus is trapped in the menu (`ITrapFocusService`), on `[data-menu=close]` first; once closed, it goes back
|
|
502
|
+
to what opened the menu (the burger).
|
|
503
|
+
- The page follows: `<body>` takes the classes of the menu's `data-menu-page-show` while it is open and of its
|
|
504
|
+
`data-menu-page-hide` once closed — `data-menu-page-show="overflow-hidden"` keeps the page from scrolling under it.
|
|
505
|
+
Without these attributes, the page is left as is.
|
|
500
506
|
- Publishes `MenuStatus.Opening`, `Opened`, `Closing`, `Closed` on `Channels.MenuStatus`.
|
|
501
507
|
- `[data-menu=toggle-button-ID]` shows or hides `[data-menu=toggle-list-ID]` (`hidden` attribute), sets the
|
|
502
508
|
data-menu-show / data-menu-hide classes of its `svg[data-menu=icon]` and its `aria-expanded`. Accordion: opening a
|
|
@@ -755,7 +761,7 @@ resolve(IEventAggregator).publish(Channels.Upload, <IUpload>{ action: UploadActi
|
|
|
755
761
|
|
|
756
762
|
Attributes: `BleetToasterCustomAttribute`, `BleetToastCustomAttribute`, `BleetToasterTriggerCustomAttribute`,
|
|
757
763
|
and the attributes of the other widgets. Abstract components: `AbstractDialog`, `AbstractDropdown`, `AbstractPager` (its `PagerEvent`, `IPagerDetail`),
|
|
758
|
-
`AbstractToaster`. Enums: `Channels`, `ToasterAction`, `ToasterStatus`, `
|
|
764
|
+
`AbstractToaster`. Enums: `Channels`, `ToasterAction`, `ToasterStatus`, `UiLevel`,
|
|
759
765
|
`UiToastIcon`, `UiIcon`, and the actions and statuses of the other channels. Interfaces: `IToaster`, `IToast`,
|
|
760
766
|
and the payloads of the other channels. Services: `IStorageService`, `ITransitionService`, `ITrapFocusService`.
|
|
761
767
|
|