@dovetail-ts/notifications 0.0.0-stage → 1.0.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/CHANGELOG.md +32 -0
- package/LICENSE +21 -0
- package/README.md +139 -2
- package/addon-main.cjs +4 -0
- package/declarations/activity.d.ts +43 -0
- package/declarations/activity.d.ts.map +1 -0
- package/declarations/components/dovetail/activity-feed.d.ts +34 -0
- package/declarations/components/dovetail/activity-feed.d.ts.map +1 -0
- package/declarations/components/dovetail/inbox-button.d.ts +19 -0
- package/declarations/components/dovetail/inbox-button.d.ts.map +1 -0
- package/declarations/components/dovetail/inbox.d.ts +33 -0
- package/declarations/components/dovetail/inbox.d.ts.map +1 -0
- package/declarations/components/dovetail/toast-bridge.d.ts +24 -0
- package/declarations/components/dovetail/toast-bridge.d.ts.map +1 -0
- package/declarations/format.d.ts +3 -0
- package/declarations/format.d.ts.map +1 -0
- package/declarations/inbox.d.ts +99 -0
- package/declarations/inbox.d.ts.map +1 -0
- package/declarations/index.d.ts +15 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/toasts.d.ts +31 -0
- package/declarations/toasts.d.ts.map +1 -0
- package/declarations/when-visible.d.ts +9 -0
- package/declarations/when-visible.d.ts.map +1 -0
- package/dist/_app_/components/dovetail/activity-feed.js +1 -0
- package/dist/_app_/components/dovetail/inbox-button.js +1 -0
- package/dist/_app_/components/dovetail/inbox.js +1 -0
- package/dist/_app_/components/dovetail/toast-bridge.js +1 -0
- package/dist/activity-feed-CO_8ZYII.js +165 -0
- package/dist/activity-feed-CO_8ZYII.js.map +1 -0
- package/dist/components/dovetail/activity-feed.js +10 -0
- package/dist/components/dovetail/activity-feed.js.map +1 -0
- package/dist/components/dovetail/inbox-button.js +32 -0
- package/dist/components/dovetail/inbox-button.js.map +1 -0
- package/dist/components/dovetail/inbox.js +88 -0
- package/dist/components/dovetail/inbox.js.map +1 -0
- package/dist/components/dovetail/toast-bridge.js +7 -0
- package/dist/components/dovetail/toast-bridge.js.map +1 -0
- package/dist/format-CnYSfbv5.js +8 -0
- package/dist/format-CnYSfbv5.js.map +1 -0
- package/dist/index.js +406 -0
- package/dist/index.js.map +1 -0
- package/dist/toast-bridge-CJ7iWI9Q.js +95 -0
- package/dist/toast-bridge-CJ7iWI9Q.js.map +1 -0
- package/package.json +99 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @dovetail-ts/notifications
|
|
2
|
+
|
|
3
|
+
## 1.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 21b3dbf: Publish through OIDC trusted publishing only, with the Ember Workbench release kit. Each version from this release on has npm provenance.
|
|
8
|
+
- Updated dependencies [21b3dbf]
|
|
9
|
+
- @dovetail-ts/core@1.0.1
|
|
10
|
+
- @dovetail-ts/protocol@1.0.1
|
|
11
|
+
- @dovetail-ts/warp-drive@1.0.1
|
|
12
|
+
|
|
13
|
+
## 1.0.0
|
|
14
|
+
|
|
15
|
+
### Major Changes
|
|
16
|
+
|
|
17
|
+
- 480744b: First release of Dovetail: real-time and offline sync for Ember.
|
|
18
|
+
|
|
19
|
+
- `@dovetail-ts/core`: the connection life cycle, live store subscriptions, the optimistic ledger with rebase and rollback, the offline write queue in IndexedDB with a leader tab and dead letters, `DocSession` and `PresenceRoom`.
|
|
20
|
+
- `@dovetail-ts/warp-drive`: the store feed into WarpDrive.
|
|
21
|
+
- `@dovetail-ts/crdt`, `crdt-yjs`, `crdt-loro` and `crdt-automerge`: one `DocEngine` interface with three engines.
|
|
22
|
+
- `@dovetail-ts/tiptap`: co-editing in Tiptap 3 with carets, per-user undo, versions and comment threads.
|
|
23
|
+
- `@dovetail-ts/ember`, `notifications` and `inspector`: presence and status components, the inbox, toasts and activity feeds, and a dev panel.
|
|
24
|
+
- `@dovetail-ts/server`, the transports (`transport-ws`, `transport-sse`, `transport-cable`) and `conformance`: a Node server and one wire protocol that the Rails gems also pass.
|
|
25
|
+
- Adapters for Hocuspocus, Liveblocks, PartyKit and Supabase, and integrations for Switchyard, Millwork, Benchdog and Lattice. The Neon adapter is not in 1.0: it waits for a stable Neon Realtime client (1.1).
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [480744b]
|
|
30
|
+
- @dovetail-ts/core@1.0.0
|
|
31
|
+
- @dovetail-ts/protocol@1.0.0
|
|
32
|
+
- @dovetail-ts/warp-drive@1.0.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Joe Gaudet
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,140 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @dovetail-ts/notifications
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The notification stream, the inbox model, activity feeds and the toast bridge to the Joinery
|
|
4
|
+
Toaster. An Ember v2 addon.
|
|
5
|
+
|
|
6
|
+
Part of [Dovetail](https://joegaudet.com/dovetail/). Not released yet.
|
|
7
|
+
|
|
8
|
+
One stream feeds three surfaces (ADR 0009, ADR 0016). The server sends each notification on the
|
|
9
|
+
store feed of the per-user room (`user:<id>`). The inbox model keeps them, and the components
|
|
10
|
+
show them. Mark as read and archive are optimistic writes, so they work offline.
|
|
11
|
+
|
|
12
|
+
## Configure the inbox
|
|
13
|
+
|
|
14
|
+
Make the inbox first, and give its sink to the `SyncClient`. Then connect the inbox.
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { Connection, SyncClient, WriteQueue, openDovetailDB } from '@dovetail-ts/core'
|
|
18
|
+
import { storeSink } from '@dovetail-ts/warp-drive'
|
|
19
|
+
import { NotificationInbox } from '@dovetail-ts/notifications'
|
|
20
|
+
|
|
21
|
+
const inbox = new NotificationInbox({
|
|
22
|
+
userId: user.id,
|
|
23
|
+
url: 'https://sync.example.com', // the HTTP routes of the server
|
|
24
|
+
getToken: () => session.token,
|
|
25
|
+
})
|
|
26
|
+
const client = new SyncClient({
|
|
27
|
+
connection: new Connection({ transport, getToken: () => session.token }),
|
|
28
|
+
sink: inbox.sink(storeSink(store)), // the notifications, and all ops to the store
|
|
29
|
+
queue: new WriteQueue(await openDovetailDB()),
|
|
30
|
+
})
|
|
31
|
+
await client.start()
|
|
32
|
+
client.connection.connect()
|
|
33
|
+
const stop = inbox.connect(client) // joins user:<id> and loads the first page
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`NotificationInbox` options:
|
|
37
|
+
|
|
38
|
+
| Option | Default | |
|
|
39
|
+
| ---------- | ------------------ | -------------------------------------------------------------- |
|
|
40
|
+
| `userId` | (required) | The user. The inbox subscribes to `user:<userId>`. |
|
|
41
|
+
| `fetch` | the global `fetch` | Sends `GET /notifications` and `POST /notifications/read-all`. |
|
|
42
|
+
| `url` | `''` | The base URL of the HTTP routes. |
|
|
43
|
+
| `getToken` | (see below) | The token. The inbox sends `Authorization: Bearer <token>`. |
|
|
44
|
+
| `pageSize` | 20 | The size of a page. |
|
|
45
|
+
| `now` | `Date.now` | The clock of the read and archive times. |
|
|
46
|
+
| `describe` | see below | The text of a notification. |
|
|
47
|
+
|
|
48
|
+
`getToken` is necessary when the server has an `authenticate` hook. Such a server refuses an HTTP
|
|
49
|
+
request with no Bearer token with 401, unless the host sets `allowAnonymous` on the server. The
|
|
50
|
+
inbox calls `getToken` before each request (each page, the unread count and mark all as read),
|
|
51
|
+
so it always sends the newest token.
|
|
52
|
+
|
|
53
|
+
The sink gets the ops of all the rooms of the sync client. Only the feed of the per-user room and
|
|
54
|
+
the HTTP pages can add or delete a notification. A notification resource from another room can
|
|
55
|
+
change only the read, seen and archived times of a notification that the inbox has, and it makes
|
|
56
|
+
no toast.
|
|
57
|
+
|
|
58
|
+
The default text is `<actor id> <verb> on <target type> <target id>`. Give `describe` to show
|
|
59
|
+
names.
|
|
60
|
+
|
|
61
|
+
| Member | |
|
|
62
|
+
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
63
|
+
| `items` | The notifications that are not archived, the newest first. |
|
|
64
|
+
| `unreadItems` | The loaded unread items. |
|
|
65
|
+
| `unread` | The unread count of the server, with the local changes. The same in all tabs. |
|
|
66
|
+
| `state`, `error` | `idle`, `loading` or `error`, and the message of the last error. |
|
|
67
|
+
| `loaded`, `hasMore` | True after the first page, and while older pages exist. |
|
|
68
|
+
| `sink(inner?)` | The `StoreSink` for the `SyncClient`. |
|
|
69
|
+
| `connect(client)` | Subscribes and loads the first page. Returns a function that stops it. |
|
|
70
|
+
| `load()`, `loadMore()` | Loads the first page again, or the next older page. |
|
|
71
|
+
| `retry()` | Sends the request that failed last again. |
|
|
72
|
+
| `markRead(id)`, `archive(id)` | Optimistic writes through the `SyncClient`. They queue offline. Each write has only the time that changes (`readAt` or `archivedAt`). |
|
|
73
|
+
| `markAllRead()` | `POST /notifications/read-all`. It rolls back when the request fails. Offline, it queues a mark read for each loaded item, and sends the request when online. |
|
|
74
|
+
| `onNotification(listener)` | Calls `listener` for each new notification of the live feed. |
|
|
75
|
+
| `describe(item)` | The text of an item. |
|
|
76
|
+
|
|
77
|
+
## The components
|
|
78
|
+
|
|
79
|
+
Each component takes the inbox as an argument. Import them in a `.gts` file, or use
|
|
80
|
+
`<Dovetail::Name>` in a classic template.
|
|
81
|
+
|
|
82
|
+
```gts
|
|
83
|
+
import { Toaster } from '@ember-joinery/ember'
|
|
84
|
+
import { ActivityFeed, Inbox, InboxButton, ToastBridge } from '@dovetail-ts/notifications'
|
|
85
|
+
|
|
86
|
+
<template>
|
|
87
|
+
<InboxButton @inbox={{inbox}} {{on 'click' this.open}} />
|
|
88
|
+
<Inbox @inbox={{inbox}} />
|
|
89
|
+
<Toaster />
|
|
90
|
+
<ToastBridge @inbox={{inbox}} @client={{client}} @mute={{array 'assigned'}} />
|
|
91
|
+
</template>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
| Component | Arguments |
|
|
95
|
+
| -------------------------- | ------------------------------------------------------------------------------------------- |
|
|
96
|
+
| `<Dovetail::InboxButton>` | `@inbox`. A Joinery `Button` with the unread count. `data-state`: `unread` or `empty`. |
|
|
97
|
+
| `<Dovetail::Inbox>` | `@inbox`, `@tab` (`unread` or `all`). `data-state`: `loading`, `error`, `empty` or `ready`. |
|
|
98
|
+
| `<Dovetail::ActivityFeed>` | `@events`, `@scope`, `@window`, `@actorName`, `@describe`, `@hasMore`, `@onLoadOlder`. |
|
|
99
|
+
| `<Dovetail::ToastBridge>` | `@inbox`, `@client`, `@types`, `@mute`. It renders nothing. |
|
|
100
|
+
|
|
101
|
+
The inbox has the Unread and All tabs (the arrow keys move between them), "Mark as read",
|
|
102
|
+
"Archive", "Mark all as read", "Load more", an empty state and an error state with "Retry". Each
|
|
103
|
+
button has an accessible name with the text of its notification. A status region tells a
|
|
104
|
+
screen reader the unread count.
|
|
105
|
+
|
|
106
|
+
## Toasts
|
|
107
|
+
|
|
108
|
+
The toast bridge shows each new notification and these sync events in the Joinery `Toaster`:
|
|
109
|
+
`offline`, `online` (back online), `dead-letter` (a write that the server refused, also from
|
|
110
|
+
another tab) and `rollback` (a refused write of this tab that rolled back). One write gives one
|
|
111
|
+
toast. `@types` is the list of the notification verbs that make a toast (the default is all
|
|
112
|
+
verbs). `@mute` takes verbs and sync events. Dovetail has no toast component of its own.
|
|
113
|
+
Without Ember, call `bridgeToasts({ toasts, inbox, client, types, mute })`.
|
|
114
|
+
|
|
115
|
+
## Activity feeds
|
|
116
|
+
|
|
117
|
+
`<Dovetail::ActivityFeed>` groups the events of one actor and one verb in a short time
|
|
118
|
+
("Ana edited 3 notes"). It takes any list of `ActivityEvent` (`verb`, `actor`, `createdAt`,
|
|
119
|
+
`target`):
|
|
120
|
+
|
|
121
|
+
- `notificationActivity(inbox.items)` gives the events of the notifications.
|
|
122
|
+
- `ActivityLog` keeps live events. Give `log.add` as the `onActivity` of the Tiptap extension of
|
|
123
|
+
`@dovetail-ts/tiptap`.
|
|
124
|
+
|
|
125
|
+
`@scope` (a record, a room, a document or a team, as `{ type, id }`) keeps the events of that
|
|
126
|
+
target. `@onLoadOlder` runs when "Load older" becomes visible, and when the user presses it.
|
|
127
|
+
`groupActivity(events, { window, scope })` and `describeGroup(group, actorName)` do the same
|
|
128
|
+
work without a component.
|
|
129
|
+
|
|
130
|
+
## Tests
|
|
131
|
+
|
|
132
|
+
The harnesses are in `@dovetail-ts/test-support`: `InboxButtonHarness`, `InboxHarness` (and
|
|
133
|
+
`NotificationRowHarness`), `ActivityFeedHarness` and `ToastBridgeHarness`.
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
const inbox = new InboxHarness(ember())
|
|
137
|
+
await inbox.selectedTab.should.equal('Unread 2')
|
|
138
|
+
await inbox.markRead(0)
|
|
139
|
+
await inbox.notifications.should.deep.equal(['Ana commented on note-1'])
|
|
140
|
+
```
|
package/addon-main.cjs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ResourceIdentifier } from '@dovetail-ts/protocol';
|
|
2
|
+
import type { NotificationItem } from './inbox.ts';
|
|
3
|
+
/** One event of a feed. A Tiptap `ActivityEvent` and a notification both fit. */
|
|
4
|
+
export interface ActivityEvent {
|
|
5
|
+
verb: string;
|
|
6
|
+
/** The user id, or the resource identifier of the actor. */
|
|
7
|
+
actor: string | ResourceIdentifier;
|
|
8
|
+
/** An ISO 8601 date-time. */
|
|
9
|
+
createdAt: string;
|
|
10
|
+
/** The record that the event changed. An event with no target matches each scope. */
|
|
11
|
+
target?: ResourceIdentifier;
|
|
12
|
+
}
|
|
13
|
+
/** Events of one actor and one verb, the newest first. */
|
|
14
|
+
export interface ActivityGroup {
|
|
15
|
+
/** A stable key: the actor, the verb and the time of the newest event. */
|
|
16
|
+
key: string;
|
|
17
|
+
/** The id of the actor. */
|
|
18
|
+
actor: string;
|
|
19
|
+
verb: string;
|
|
20
|
+
/** The time of the newest event. */
|
|
21
|
+
createdAt: string;
|
|
22
|
+
count: number;
|
|
23
|
+
events: ActivityEvent[];
|
|
24
|
+
}
|
|
25
|
+
export interface GroupOptions {
|
|
26
|
+
/** The time in milliseconds that one group can span. The default is 5 minutes. */
|
|
27
|
+
window?: number;
|
|
28
|
+
/** Keeps only the events of this record, room, document or team. */
|
|
29
|
+
scope?: ResourceIdentifier;
|
|
30
|
+
}
|
|
31
|
+
/** The events of `events` in groups, the newest group first. */
|
|
32
|
+
export declare function groupActivity(events: readonly ActivityEvent[], { window, scope }?: GroupOptions): ActivityGroup[];
|
|
33
|
+
/** The text of a group: "ana edited 3 notes", "ana edited note n1" or "ana commented 2 times". */
|
|
34
|
+
export declare function describeGroup(group: ActivityGroup, actorName?: (id: string) => string): string;
|
|
35
|
+
/** The activity events of notifications. */
|
|
36
|
+
export declare function notificationActivity(items: readonly NotificationItem[]): ActivityEvent[];
|
|
37
|
+
/** A live list of events. Give `log.add` as the `onActivity` of the Tiptap extension. */
|
|
38
|
+
export declare class ActivityLog {
|
|
39
|
+
events: readonly ActivityEvent[];
|
|
40
|
+
/** Adds an event. */
|
|
41
|
+
add: (event: ActivityEvent) => void;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=activity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["../src/activity.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,iFAAiF;AACjF,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,4DAA4D;IAC5D,KAAK,EAAE,MAAM,GAAG,kBAAkB,CAAA;IAClC,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,qFAAqF;IACrF,MAAM,CAAC,EAAE,kBAAkB,CAAA;CAC5B;AAED,0DAA0D;AAC1D,MAAM,WAAW,aAAa;IAC5B,0EAA0E;IAC1E,GAAG,EAAE,MAAM,CAAA;IACX,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,aAAa,EAAE,CAAA;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,kFAAkF;IAClF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,oEAAoE;IACpE,KAAK,CAAC,EAAE,kBAAkB,CAAA;CAC3B;AAKD,gEAAgE;AAChE,wBAAgB,aAAa,CAC3B,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,EAAE,MAAmB,EAAE,KAAK,EAAE,GAAE,YAAiB,GAChD,aAAa,EAAE,CA4BjB;AAED,kGAAkG;AAClG,wBAAgB,aAAa,CAC3B,KAAK,EAAE,aAAa,EACpB,SAAS,GAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAiB,GAC3C,MAAM,CAOR;AAED,4CAA4C;AAC5C,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,gBAAgB,EAAE,GAAG,aAAa,EAAE,CAExF;AAED,yFAAyF;AACzF,qBAAa,WAAW;IACb,MAAM,EAAE,SAAS,aAAa,EAAE,CAAK;IAE9C,qBAAqB;IACrB,GAAG,GAAI,OAAO,aAAa,KAAG,IAAI,CAEjC;CACF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import type { ResourceIdentifier } from '@dovetail-ts/protocol';
|
|
3
|
+
import type { ActivityEvent, ActivityGroup } from '../../activity.ts';
|
|
4
|
+
export interface ActivityFeedSignature {
|
|
5
|
+
Element: HTMLElement;
|
|
6
|
+
Args: {
|
|
7
|
+
/** The events: notifications (`notificationActivity`), Tiptap events (`ActivityLog`) or any. */
|
|
8
|
+
events: readonly ActivityEvent[];
|
|
9
|
+
/** Shows only the events of this record, room, document or team. */
|
|
10
|
+
scope?: ResourceIdentifier;
|
|
11
|
+
/** The time in milliseconds that one group can span. The default is 5 minutes. */
|
|
12
|
+
window?: number;
|
|
13
|
+
/** The name of an actor id. The default is the id. */
|
|
14
|
+
actorName?: (id: string) => string;
|
|
15
|
+
/** The text of a group. The default is `describeGroup`, as "Ana edited 3 notes". */
|
|
16
|
+
describe?: (group: ActivityGroup) => string;
|
|
17
|
+
/** True when older events exist. */
|
|
18
|
+
hasMore?: boolean;
|
|
19
|
+
/** Loads older events. The feed calls it when its end becomes visible, or on "Load older". */
|
|
20
|
+
onLoadOlder?: () => Promise<void> | void;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A live list of activity for a scope, in groups of one actor and one verb ("Ana edited 3
|
|
25
|
+
* notes"), the newest first. Its `data-state` is `empty`, `loading` or `ready`.
|
|
26
|
+
*/
|
|
27
|
+
export default class ActivityFeed extends Component<ActivityFeedSignature> {
|
|
28
|
+
loading: boolean;
|
|
29
|
+
get groups(): ActivityGroup[];
|
|
30
|
+
get state(): string;
|
|
31
|
+
text: (group: ActivityGroup) => string;
|
|
32
|
+
loadOlder: () => Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=activity-feed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-feed.d.ts","sourceRoot":"","sources":["../../../src/components/dovetail/activity-feed.gts"],"names":[],"mappings":"AA0GA,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAI1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAE/D,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAIrE,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,WAAW,CAAA;IACpB,IAAI,EAAE;QACJ,gGAAgG;QAChG,MAAM,EAAE,SAAS,aAAa,EAAE,CAAA;QAChC,oEAAoE;QACpE,KAAK,CAAC,EAAE,kBAAkB,CAAA;QAC1B,kFAAkF;QAClF,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,sDAAsD;QACtD,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,CAAA;QAClC,oFAAoF;QACpF,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,MAAM,CAAA;QAC3C,oCAAoC;QACpC,OAAO,CAAC,EAAE,OAAO,CAAA;QACjB,8FAA8F;QAC9F,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;KACzC,CAAA;CACF;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,SAAS,CAAC,qBAAqB,CAAC;IAC/D,OAAO,UAAQ;IAExB,IAAI,MAAM,IAAI,aAAa,EAAE,CAM5B;IAED,IAAI,KAAK,IAAI,MAAM,CAGlB;IAED,IAAI,GAAI,OAAO,aAAa,KAAG,MAAM,CACqC;IAE1E,SAAS,QAAa,OAAO,CAAC,IAAI,CAAC,CAQlC;CA+HF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import type { NotificationInbox } from '../../inbox.ts';
|
|
3
|
+
export interface InboxButtonSignature {
|
|
4
|
+
/** A Joinery `<Button>`. Give it `{{on "click"}}` to open the inbox. */
|
|
5
|
+
Element: HTMLButtonElement | HTMLAnchorElement;
|
|
6
|
+
Args: {
|
|
7
|
+
inbox: NotificationInbox;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The button of the inbox, with the unread count of the user. The count is the same in all
|
|
12
|
+
* tabs. Its `data-state` is `unread` or `empty`.
|
|
13
|
+
*/
|
|
14
|
+
export default class InboxButton extends Component<InboxButtonSignature> {
|
|
15
|
+
get unread(): number;
|
|
16
|
+
get badge(): string;
|
|
17
|
+
get label(): string;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=inbox-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbox-button.d.ts","sourceRoot":"","sources":["../../../src/components/dovetail/inbox-button.gts"],"names":[],"mappings":"AA6CA,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAE1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAEvD,MAAM,WAAW,oBAAoB;IACnC,wEAAwE;IACxE,OAAO,EAAE,iBAAiB,GAAG,iBAAiB,CAAA;IAC9C,IAAI,EAAE;QACJ,KAAK,EAAE,iBAAiB,CAAA;KACzB,CAAA;CACF;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,SAAS,CAAC,oBAAoB,CAAC;IACtE,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,KAAK,IAAI,MAAM,CAElB;CAwCF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import type { NotificationInbox, NotificationItem } from '../../inbox.ts';
|
|
3
|
+
/** The tabs of the inbox. */
|
|
4
|
+
export type InboxTab = 'unread' | 'all';
|
|
5
|
+
export interface InboxSignature {
|
|
6
|
+
Element: HTMLElement;
|
|
7
|
+
Args: {
|
|
8
|
+
inbox: NotificationInbox;
|
|
9
|
+
/** The first tab. The default is `unread`. */
|
|
10
|
+
tab?: InboxTab;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The inbox panel: the Unread and All tabs, mark read, mark all read, archive, load more, and
|
|
15
|
+
* the empty and error states. Its `data-state` is `loading`, `error`, `empty` or `ready`.
|
|
16
|
+
*/
|
|
17
|
+
export default class Inbox extends Component<InboxSignature> {
|
|
18
|
+
#private;
|
|
19
|
+
tab: InboxTab;
|
|
20
|
+
get inbox(): NotificationInbox;
|
|
21
|
+
get items(): NotificationItem[];
|
|
22
|
+
get state(): string;
|
|
23
|
+
get busy(): boolean;
|
|
24
|
+
get emptyText(): string;
|
|
25
|
+
get status(): string;
|
|
26
|
+
select: (value: string) => void;
|
|
27
|
+
markRead: (item: NotificationItem, event: Event) => void;
|
|
28
|
+
archive: (item: NotificationItem, event: Event) => void;
|
|
29
|
+
markAllRead: () => void;
|
|
30
|
+
loadMore: () => void;
|
|
31
|
+
retry: () => void;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=inbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbox.d.ts","sourceRoot":"","sources":["../../../src/components/dovetail/inbox.gts"],"names":[],"mappings":"AAiNA,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAK1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAGzE,6BAA6B;AAC7B,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,KAAK,CAAA;AAEvC,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,WAAW,CAAA;IACpB,IAAI,EAAE;QACJ,KAAK,EAAE,iBAAiB,CAAA;QACxB,8CAA8C;QAC9C,GAAG,CAAC,EAAE,QAAQ,CAAA;KACf,CAAA;CACF;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,SAAS,CAAC,cAAc,CAAC;;IACjD,GAAG,EAAE,QAAQ,CAA4B;IAElD,IAAI,KAAK,IAAI,iBAAiB,CAE7B;IAED,IAAI,KAAK,IAAI,gBAAgB,EAAE,CAE9B;IAED,IAAI,KAAK,IAAI,MAAM,CAIlB;IAED,IAAI,IAAI,IAAI,OAAO,CAElB;IAED,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,MAAM,IAAI,MAAM,CAInB;IAED,MAAM,GAAI,OAAO,MAAM,KAAG,IAAI,CAE7B;IAED,QAAQ,GAAI,MAAM,gBAAgB,EAAE,OAAO,KAAK,KAAG,IAAI,CAGtD;IAED,OAAO,GAAI,MAAM,gBAAgB,EAAE,OAAO,KAAK,KAAG,IAAI,CAGrD;IACD,WAAW,QAAO,IAAI,CAAiC;IACvD,QAAQ,QAAO,IAAI,CAA8B;IACjD,KAAK,QAAO,IAAI,CAA2B;CAuV5C"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import type Owner from '@ember/owner';
|
|
3
|
+
import type { SyncClient } from '@dovetail-ts/core';
|
|
4
|
+
import type { NotificationInbox } from '../../inbox.ts';
|
|
5
|
+
export interface ToastBridgeSignature {
|
|
6
|
+
Args: {
|
|
7
|
+
/** The new notifications of this inbox make toasts. */
|
|
8
|
+
inbox?: NotificationInbox;
|
|
9
|
+
/** The sync events of this client (offline, back online, dead letter, rollback) make toasts. */
|
|
10
|
+
client?: SyncClient;
|
|
11
|
+
/** The notification verbs that make a toast. The default is all verbs. */
|
|
12
|
+
types?: readonly string[];
|
|
13
|
+
/** The notification verbs and the sync events that never make a toast. */
|
|
14
|
+
mute?: readonly string[];
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Shows notifications and sync events in the Joinery `<Toaster>` of the app. It renders
|
|
19
|
+
* nothing. It reads its arguments once, when it renders.
|
|
20
|
+
*/
|
|
21
|
+
export default class ToastBridge extends Component<ToastBridgeSignature> {
|
|
22
|
+
constructor(owner: Owner, args: ToastBridgeSignature['Args']);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=toast-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast-bridge.d.ts","sourceRoot":"","sources":["../../../src/components/dovetail/toast-bridge.gts"],"names":[],"mappings":"AAiCA,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAC1C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAGrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAGvD,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE;QACJ,uDAAuD;QACvD,KAAK,CAAC,EAAE,iBAAiB,CAAA;QACzB,gGAAgG;QAChG,MAAM,CAAC,EAAE,UAAU,CAAA;QACnB,0EAA0E;QAC1E,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;QACzB,0EAA0E;QAC1E,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;KACzB,CAAA;CACF;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,SAAS,CAAC,oBAAoB,CAAC;gBAC1D,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAC;CAQ7D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,KAAG,MAGtC,CAAA"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { NotificationResource, ResourceIdentifier } from '@dovetail-ts/protocol';
|
|
2
|
+
import type { StoreSink, SyncClient } from '@dovetail-ts/core';
|
|
3
|
+
/** One notification, as the UI shows it. */
|
|
4
|
+
export interface NotificationItem {
|
|
5
|
+
id: string;
|
|
6
|
+
verb: string;
|
|
7
|
+
actor: ResourceIdentifier;
|
|
8
|
+
target: ResourceIdentifier;
|
|
9
|
+
/** An ISO 8601 date-time. */
|
|
10
|
+
createdAt: string;
|
|
11
|
+
readAt: string | null;
|
|
12
|
+
archivedAt: string | null;
|
|
13
|
+
/** True when `readAt` has a value. */
|
|
14
|
+
read: boolean;
|
|
15
|
+
/** The JSON:API resource, with all its attributes. */
|
|
16
|
+
resource: NotificationResource;
|
|
17
|
+
}
|
|
18
|
+
export interface InboxOptions {
|
|
19
|
+
/** The id of the user. The inbox subscribes to the per-user room (`user:<id>`). */
|
|
20
|
+
userId: string;
|
|
21
|
+
/**
|
|
22
|
+
* Sends the HTTP requests (`GET /notifications`, `POST /notifications/read-all`). The default
|
|
23
|
+
* is the global `fetch`.
|
|
24
|
+
*/
|
|
25
|
+
fetch?: (url: string, init?: RequestInit) => Promise<Response>;
|
|
26
|
+
/** The base URL of the HTTP routes of the server. The default is `''` (the same origin). */
|
|
27
|
+
url?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The token of the user. The inbox calls it before each HTTP request, and sends the token as
|
|
30
|
+
* `Authorization: Bearer <token>`. It is necessary when the server has an `authenticate` hook:
|
|
31
|
+
* such a server refuses a request with no token with 401, unless it sets `allowAnonymous`.
|
|
32
|
+
*/
|
|
33
|
+
getToken?: () => string | undefined | Promise<string | undefined>;
|
|
34
|
+
/** The size of a page. The default is 20. */
|
|
35
|
+
pageSize?: number;
|
|
36
|
+
/** The clock of the read and archive times. The default is `Date.now`. */
|
|
37
|
+
now?: () => number;
|
|
38
|
+
/** The text of a notification. The default is `<actor id> <verb> on <target type> <target id>`. */
|
|
39
|
+
describe?: (item: NotificationItem) => string;
|
|
40
|
+
}
|
|
41
|
+
/** `idle`, `loading` (a page or a request is in progress) or `error` (the last request failed). */
|
|
42
|
+
export type InboxState = 'idle' | 'loading' | 'error';
|
|
43
|
+
/**
|
|
44
|
+
* The notifications of one user: the loaded pages and the live feed, the unread count, and the
|
|
45
|
+
* actions mark read, archive and mark all read.
|
|
46
|
+
*/
|
|
47
|
+
export declare class NotificationInbox {
|
|
48
|
+
#private;
|
|
49
|
+
private records;
|
|
50
|
+
/** The unread notifications on the server that are not loaded. */
|
|
51
|
+
private hiddenUnread;
|
|
52
|
+
/** The cursor of the next page: undefined before the first page, null after the last page. */
|
|
53
|
+
private next;
|
|
54
|
+
state: InboxState;
|
|
55
|
+
/** The message of the last error, or undefined. */
|
|
56
|
+
error: string | undefined;
|
|
57
|
+
constructor(options: InboxOptions);
|
|
58
|
+
/** The notifications that are not archived, the newest first. */
|
|
59
|
+
get items(): NotificationItem[];
|
|
60
|
+
/** The unread items that are loaded. */
|
|
61
|
+
get unreadItems(): NotificationItem[];
|
|
62
|
+
/** The number of unread notifications on the server, with the local changes. */
|
|
63
|
+
get unread(): number;
|
|
64
|
+
/** True when the server has older pages. */
|
|
65
|
+
get hasMore(): boolean;
|
|
66
|
+
/** True after the first page loaded. */
|
|
67
|
+
get loaded(): boolean;
|
|
68
|
+
/** The text of an item. An arrow function, so a template can call `@inbox.describe`. */
|
|
69
|
+
describe: (item: NotificationItem) => string;
|
|
70
|
+
/**
|
|
71
|
+
* The sink to give the SyncClient. It keeps the notifications, and gives each op to `inner`
|
|
72
|
+
* too (for example `storeSink(store)` of `@dovetail-ts/warp-drive`).
|
|
73
|
+
*/
|
|
74
|
+
sink(inner?: StoreSink): StoreSink;
|
|
75
|
+
/**
|
|
76
|
+
* Joins the per-user room on `client`, and loads the first page. Returns a function that stops
|
|
77
|
+
* it.
|
|
78
|
+
*/
|
|
79
|
+
connect(client: SyncClient): () => void;
|
|
80
|
+
/** Calls `listener` for each new notification of the live feed. Returns a function that stops it. */
|
|
81
|
+
onNotification(listener: (item: NotificationItem) => void): () => void;
|
|
82
|
+
/** Loads the first page again. */
|
|
83
|
+
load(): Promise<void>;
|
|
84
|
+
/** Loads the next older page. */
|
|
85
|
+
loadMore(): Promise<void>;
|
|
86
|
+
/** Sends the request that failed last again, or loads the first page. */
|
|
87
|
+
retry(): Promise<void>;
|
|
88
|
+
/** Marks one notification as read. Optimistic: it queues while offline. */
|
|
89
|
+
markRead(id: string): Promise<void>;
|
|
90
|
+
/** Archives one notification. Optimistic: it queues while offline. */
|
|
91
|
+
archive(id: string): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Marks each unread notification as read, with `POST /notifications/read-all`. The change shows
|
|
94
|
+
* at once, and rolls back when the request fails. Offline, each loaded unread item gets a
|
|
95
|
+
* queued mark read, and the request goes when the connection opens again.
|
|
96
|
+
*/
|
|
97
|
+
markAllRead(): Promise<void>;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=inbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inbox.d.ts","sourceRoot":"","sources":["../src/inbox.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { NotificationInbox } from './inbox.ts';
|
|
2
|
+
export type { InboxOptions, InboxState, NotificationItem } from './inbox.ts';
|
|
3
|
+
export { ActivityLog, describeGroup, groupActivity, notificationActivity } from './activity.ts';
|
|
4
|
+
export type { ActivityEvent, ActivityGroup, GroupOptions } from './activity.ts';
|
|
5
|
+
export { bridgeToasts } from './toasts.ts';
|
|
6
|
+
export type { SyncEvent, ToastBridgeOptions, ToastOptions, ToastSink } from './toasts.ts';
|
|
7
|
+
export { default as ActivityFeed } from './components/dovetail/activity-feed';
|
|
8
|
+
export type { ActivityFeedSignature } from './components/dovetail/activity-feed';
|
|
9
|
+
export { default as Inbox } from './components/dovetail/inbox';
|
|
10
|
+
export type { InboxSignature, InboxTab } from './components/dovetail/inbox';
|
|
11
|
+
export { default as InboxButton } from './components/dovetail/inbox-button';
|
|
12
|
+
export type { InboxButtonSignature } from './components/dovetail/inbox-button';
|
|
13
|
+
export { default as ToastBridge } from './components/dovetail/toast-bridge';
|
|
14
|
+
export type { ToastBridgeSignature } from './components/dovetail/toast-bridge';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAC9C,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC5E,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAC/F,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,YAAY,EAAE,SAAS,EAAE,kBAAkB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACzF,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,yCAAyC,CAAA;AACjF,YAAY,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAA;AACpF,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,iCAAiC,CAAA;AAClE,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAC/E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,wCAAwC,CAAA;AAC/E,YAAY,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAA;AAClF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,wCAAwC,CAAA;AAC/E,YAAY,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { SyncClient } from '@dovetail-ts/core';
|
|
2
|
+
import type { NotificationInbox } from './inbox.ts';
|
|
3
|
+
/** The options of one toast: a subset of the `ExternalToast` of Joinery. */
|
|
4
|
+
export interface ToastOptions {
|
|
5
|
+
id?: string | number;
|
|
6
|
+
}
|
|
7
|
+
type Show = (title: string, options?: ToastOptions) => string | number;
|
|
8
|
+
/** The toast functions that the bridge uses. `toastsFor(owner)` of `@ember-joinery/ember` fits. */
|
|
9
|
+
export interface ToastSink {
|
|
10
|
+
message: Show;
|
|
11
|
+
success: Show;
|
|
12
|
+
warning: Show;
|
|
13
|
+
error: Show;
|
|
14
|
+
}
|
|
15
|
+
/** The sync events that make a toast. Put a name in `mute` to stop its toasts. */
|
|
16
|
+
export type SyncEvent = 'offline' | 'online' | 'dead-letter' | 'rollback';
|
|
17
|
+
export interface ToastBridgeOptions {
|
|
18
|
+
toasts: ToastSink;
|
|
19
|
+
/** The new notifications of this inbox make toasts. */
|
|
20
|
+
inbox?: NotificationInbox;
|
|
21
|
+
/** The sync events of this client make toasts. */
|
|
22
|
+
client?: SyncClient;
|
|
23
|
+
/** The notification verbs that make a toast. The default is all verbs. */
|
|
24
|
+
types?: readonly string[];
|
|
25
|
+
/** The notification verbs and the sync events that never make a toast. */
|
|
26
|
+
mute?: readonly string[];
|
|
27
|
+
}
|
|
28
|
+
/** Shows the toasts. Returns a function that stops the bridge. */
|
|
29
|
+
export declare function bridgeToasts({ toasts, inbox, client, types, mute }: ToastBridgeOptions): () => void;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=toasts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toasts.d.ts","sourceRoot":"","sources":["../src/toasts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,mBAAmB,CAAA;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAEnD,4EAA4E;AAC5E,MAAM,WAAW,YAAY;IAC3B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACrB;AAED,KAAK,IAAI,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,KAAK,MAAM,GAAG,MAAM,CAAA;AAEtE,mGAAmG;AACnG,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,IAAI,CAAA;IACb,OAAO,EAAE,IAAI,CAAA;IACb,OAAO,EAAE,IAAI,CAAA;IACb,KAAK,EAAE,IAAI,CAAA;CACZ;AAED,kFAAkF;AAClF,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,aAAa,GAAG,UAAU,CAAA;AAEzE,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,SAAS,CAAA;IACjB,uDAAuD;IACvD,KAAK,CAAC,EAAE,iBAAiB,CAAA;IACzB,kDAAkD;IAClD,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,0EAA0E;IAC1E,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACzB,0EAA0E;IAC1E,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CACzB;AAED,kEAAkE;AAClE,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAS,EAAE,EAAE,kBAAkB,cAkD3F"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ModifierLike } from '@glint/template';
|
|
2
|
+
/** `{{whenVisible this.load}}`: calls `load` when the element becomes visible. */
|
|
3
|
+
export declare const whenVisible: ModifierLike<{
|
|
4
|
+
Element: Element;
|
|
5
|
+
Args: {
|
|
6
|
+
Positional: [() => void];
|
|
7
|
+
};
|
|
8
|
+
}>;
|
|
9
|
+
//# sourceMappingURL=when-visible.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"when-visible.d.ts","sourceRoot":"","sources":["../src/when-visible.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AA+BnD,kFAAkF;AAClF,eAAO,MAAM,WAAW,EAGR,YAAY,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE;QAAE,UAAU,EAAE,CAAC,MAAM,IAAI,CAAC,CAAA;KAAE,CAAA;CAAE,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@dovetail-ts/notifications/components/dovetail/activity-feed";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@dovetail-ts/notifications/components/dovetail/inbox-button";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@dovetail-ts/notifications/components/dovetail/inbox";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "@dovetail-ts/notifications/components/dovetail/toast-bridge";
|