@inkbar/svelte 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +154 -2
- package/dist/class-names.d.ts +3 -0
- package/dist/class-names.d.ts.map +1 -0
- package/dist/class-names.js +5 -0
- package/dist/components/InkAnnotation.svelte +73 -0
- package/dist/components/InkAnnotation.svelte.d.ts +13 -0
- package/dist/components/InkAnnotation.svelte.d.ts.map +1 -0
- package/dist/components/InkNotePopover.svelte +193 -0
- package/dist/components/InkNotePopover.svelte.d.ts +9 -0
- package/dist/components/InkNotePopover.svelte.d.ts.map +1 -0
- package/dist/components/InkPage.svelte +125 -0
- package/dist/components/InkPage.svelte.d.ts +22 -0
- package/dist/components/InkPage.svelte.d.ts.map +1 -0
- package/dist/components/InkPageCount.svelte +20 -0
- package/dist/components/InkPageCount.svelte.d.ts +6 -0
- package/dist/components/InkPageCount.svelte.d.ts.map +1 -0
- package/dist/components/InkPageInput.svelte +49 -0
- package/dist/components/InkPageInput.svelte.d.ts +6 -0
- package/dist/components/InkPageInput.svelte.d.ts.map +1 -0
- package/dist/components/InkRoot.svelte +358 -0
- package/dist/components/InkRoot.svelte.d.ts +51 -0
- package/dist/components/InkRoot.svelte.d.ts.map +1 -0
- package/dist/components/InkSuggestionCard.svelte +121 -0
- package/dist/components/InkSuggestionCard.svelte.d.ts +9 -0
- package/dist/components/InkSuggestionCard.svelte.d.ts.map +1 -0
- package/dist/components/InkToolButton.svelte +54 -0
- package/dist/components/InkToolButton.svelte.d.ts +17 -0
- package/dist/components/InkToolButton.svelte.d.ts.map +1 -0
- package/dist/components/InkToolbar.svelte +40 -0
- package/dist/components/InkToolbar.svelte.d.ts +13 -0
- package/dist/components/InkToolbar.svelte.d.ts.map +1 -0
- package/dist/components/InkViewport.svelte +306 -0
- package/dist/components/InkViewport.svelte.d.ts +27 -0
- package/dist/components/InkViewport.svelte.d.ts.map +1 -0
- package/dist/components/InkZoomIn.svelte +34 -0
- package/dist/components/InkZoomIn.svelte.d.ts +5 -0
- package/dist/components/InkZoomIn.svelte.d.ts.map +1 -0
- package/dist/components/InkZoomOut.svelte +34 -0
- package/dist/components/InkZoomOut.svelte.d.ts +5 -0
- package/dist/components/InkZoomOut.svelte.d.ts.map +1 -0
- package/dist/components/InkZoomSelect.svelte +56 -0
- package/dist/components/InkZoomSelect.svelte.d.ts +6 -0
- package/dist/components/InkZoomSelect.svelte.d.ts.map +1 -0
- package/dist/components/ThreadForm.svelte +42 -0
- package/dist/components/ThreadForm.svelte.d.ts +11 -0
- package/dist/components/ThreadForm.svelte.d.ts.map +1 -0
- package/dist/components/annotation-element.svelte.d.ts +9 -0
- package/dist/components/annotation-element.svelte.d.ts.map +1 -0
- package/dist/components/annotation-element.svelte.js +25 -0
- package/dist/components/child-snippet.d.ts +22 -0
- package/dist/components/child-snippet.d.ts.map +1 -0
- package/dist/components/child-snippet.js +14 -0
- package/dist/components/popover-focus.d.ts +33 -0
- package/dist/components/popover-focus.d.ts.map +1 -0
- package/dist/components/popover-focus.js +63 -0
- package/dist/components/portal.d.ts +26 -0
- package/dist/components/portal.d.ts.map +1 -0
- package/dist/components/portal.js +55 -0
- package/dist/components/zoom-button.d.ts +10 -0
- package/dist/components/zoom-button.d.ts.map +1 -0
- package/dist/components/zoom-button.js +1 -0
- package/dist/compositions/DefaultToolbar.svelte +90 -0
- package/dist/compositions/DefaultToolbar.svelte.d.ts +10 -0
- package/dist/compositions/DefaultToolbar.svelte.d.ts.map +1 -0
- package/dist/context.d.ts +57 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +34 -0
- package/dist/hooks/useAnnotations.svelte.d.ts +1683 -0
- package/dist/hooks/useAnnotations.svelte.d.ts.map +1 -0
- package/dist/hooks/useAnnotations.svelte.js +33 -0
- package/dist/hooks/useDocument.svelte.d.ts +12 -0
- package/dist/hooks/useDocument.svelte.d.ts.map +1 -0
- package/dist/hooks/useDocument.svelte.js +28 -0
- package/dist/hooks/useEmbedded.svelte.d.ts +7 -0
- package/dist/hooks/useEmbedded.svelte.d.ts.map +1 -0
- package/dist/hooks/useEmbedded.svelte.js +17 -0
- package/dist/hooks/useHistory.svelte.d.ts +7 -0
- package/dist/hooks/useHistory.svelte.d.ts.map +1 -0
- package/dist/hooks/useHistory.svelte.js +8 -0
- package/dist/hooks/usePage.svelte.d.ts +10 -0
- package/dist/hooks/usePage.svelte.d.ts.map +1 -0
- package/dist/hooks/usePage.svelte.js +29 -0
- package/dist/hooks/useSelection.svelte.d.ts +6 -0
- package/dist/hooks/useSelection.svelte.d.ts.map +1 -0
- package/dist/hooks/useSelection.svelte.js +12 -0
- package/dist/hooks/useTool.svelte.d.ts +6 -0
- package/dist/hooks/useTool.svelte.d.ts.map +1 -0
- package/dist/hooks/useTool.svelte.js +10 -0
- package/dist/hooks/useZoom.svelte.d.ts +9 -0
- package/dist/hooks/useZoom.svelte.d.ts.map +1 -0
- package/dist/hooks/useZoom.svelte.js +18 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/use-readable.svelte.d.ts +13 -0
- package/dist/use-readable.svelte.d.ts.map +1 -0
- package/dist/use-readable.svelte.js +28 -0
- package/package.json +56 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Redactr Platforms Ltd
|
|
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,155 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/inkbar/inkbar/main/.github/assets/inkbar-mark-on-dark.svg">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/inkbar/inkbar/main/.github/assets/inkbar-mark-on-light.svg" alt="Inkbar" width="72" height="72">
|
|
5
|
+
</picture>
|
|
6
|
+
</p>
|
|
2
7
|
|
|
3
|
-
|
|
8
|
+
<h1 align="center">@inkbar/svelte</h1>
|
|
9
|
+
|
|
10
|
+
<p align="center">
|
|
11
|
+
A PDF viewer and editor for Svelte 5. No licence fee.
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://inkbar.dev">Website</a> ·
|
|
16
|
+
<a href="https://inkbar.dev/docs/">Docs</a> ·
|
|
17
|
+
<a href="https://sandbox.inkbar.dev">Sandbox</a> ·
|
|
18
|
+
<a href="https://github.com/inkbar/inkbar">GitHub</a>
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
Drop a PDF viewer into your Svelte app and let people highlight text, leave notes with replies and review redactions. `@inkbar/svelte` gives you a default toolbar and popovers styled by `@inkbar/theme`, plus the unstyled components and hooks they are made from, so you can keep the defaults or build your own UI.
|
|
24
|
+
|
|
25
|
+
Annotations are plain typed objects. Bind them with `bind:annotations` to keep them in your own state, or let Inkbar hold them with undo and redo.
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
pnpm add @inkbar/svelte @inkbar/core @inkbar/theme
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Svelte 5.46.4 or later is a peer dependency. Add the Vite plugin from `@inkbar/core/vite` so the PDF engine can load its worker and fonts; the [`@inkbar/core` README](https://github.com/inkbar/inkbar/tree/main/packages/core#serving-pdfjs-assets) covers it. The package ships `.svelte` sources, so your bundler compiles them for your target, including the server.
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
```svelte
|
|
38
|
+
<script lang="ts">
|
|
39
|
+
import {
|
|
40
|
+
InkRoot,
|
|
41
|
+
InkViewport,
|
|
42
|
+
DefaultToolbar,
|
|
43
|
+
InkNotePopover,
|
|
44
|
+
InkSuggestionCard,
|
|
45
|
+
} from '@inkbar/svelte'
|
|
46
|
+
import type { Annotation } from '@inkbar/core'
|
|
47
|
+
import { assets } from 'virtual:inkbar-assets'
|
|
48
|
+
import '@inkbar/theme/theme.css'
|
|
49
|
+
|
|
50
|
+
let { signedUrl, documentId }: { signedUrl: string; documentId: string } = $props()
|
|
51
|
+
|
|
52
|
+
let annotations = $state.raw<Annotation[]>([])
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<InkRoot src={{ url: signedUrl, key: documentId }} {assets} bind:annotations>
|
|
56
|
+
<DefaultToolbar />
|
|
57
|
+
<InkViewport />
|
|
58
|
+
<InkNotePopover />
|
|
59
|
+
<InkSuggestionCard />
|
|
60
|
+
</InkRoot>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`bind:annotations` makes your list the source of truth. Leave it off and Inkbar keeps the state itself, with undo and redo.
|
|
64
|
+
|
|
65
|
+
## Controlled mode
|
|
66
|
+
|
|
67
|
+
With `bind:annotations`, Inkbar proposes each change by writing the binding and shows whatever list it holds. To change annotations yourself, replace the array: `annotations = [...annotations, next]`. In-place mutation (`push`, `splice`, editing an item) is not observed, so the viewer never sees it. Declare the list with `$state.raw`, since Inkbar replaces it whole.
|
|
68
|
+
|
|
69
|
+
To decide on each proposal before it applies, use a function binding. The setter receives the proposed list; apply it, change it or drop it:
|
|
70
|
+
|
|
71
|
+
```svelte
|
|
72
|
+
<InkRoot
|
|
73
|
+
src={{ url: signedUrl, key: documentId }}
|
|
74
|
+
{assets}
|
|
75
|
+
bind:annotations={() => annotations, (next) => (annotations = next.filter(allowed))}
|
|
76
|
+
>
|
|
77
|
+
<InkViewport />
|
|
78
|
+
</InkRoot>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
`onAnnotationsChange` fires alongside the binding, and `onChange` carries the change itself. An `annotations` prop passed without a binding is overridden inside the component as proposals arrive, so bind it to keep control.
|
|
82
|
+
|
|
83
|
+
Undo and redo are off in controlled mode unless you pass `history={true}`. Inkbar then keeps a stack of your list's past values and applies undo and redo through the binding. Every change to the list is a step, including the list you load from your server when the document opens. Clear the history once that load has reached the viewer, so the first undo does not empty the list:
|
|
84
|
+
|
|
85
|
+
```svelte
|
|
86
|
+
<script lang="ts">
|
|
87
|
+
import { tick } from 'svelte'
|
|
88
|
+
import { InkRoot, InkViewport } from '@inkbar/svelte'
|
|
89
|
+
import type { InkRootHandle } from '@inkbar/svelte'
|
|
90
|
+
import type { Annotation, InkDocument } from '@inkbar/core'
|
|
91
|
+
import { assets } from 'virtual:inkbar-assets'
|
|
92
|
+
|
|
93
|
+
let { signedUrl, documentId }: { signedUrl: string; documentId: string } = $props()
|
|
94
|
+
|
|
95
|
+
let annotations = $state.raw<Annotation[]>([])
|
|
96
|
+
let root = $state<InkRootHandle | undefined>()
|
|
97
|
+
|
|
98
|
+
async function onReady(doc: InkDocument) {
|
|
99
|
+
annotations = await loadAnnotations(doc.key)
|
|
100
|
+
await tick()
|
|
101
|
+
root?.history.clear()
|
|
102
|
+
}
|
|
103
|
+
</script>
|
|
104
|
+
|
|
105
|
+
<InkRoot
|
|
106
|
+
bind:this={root}
|
|
107
|
+
bind:annotations
|
|
108
|
+
history={true}
|
|
109
|
+
src={{ url: signedUrl, key: documentId }}
|
|
110
|
+
{assets}
|
|
111
|
+
{onReady}
|
|
112
|
+
>
|
|
113
|
+
<InkViewport />
|
|
114
|
+
</InkRoot>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Inside `InkRoot`, `useHistory()` returns the same object. Its `batch(fn)` runs `fn` and records what it changes as one undo step. With `history={true}` on a controlled list, you still get one write to `bind:annotations` per add. The step lands when the current task ends, and `canUndo` updates then. Any other change you apply to the list in that window joins the step. In both modes, `fn` must be synchronous. The instance also exposes `getDocument()` and `getStatus()`, and `bind:ref` gives you the root element.
|
|
118
|
+
|
|
119
|
+
`key` identifies the document. Reuse the same key when only the signed URL changes and the document is not reloaded.
|
|
120
|
+
|
|
121
|
+
## Note popover
|
|
122
|
+
|
|
123
|
+
`InkNotePopover` opens the thread of the activated note. A new note has no text yet, so the form first writes the note's own text (labelled "Comment"); after that it adds replies.
|
|
124
|
+
|
|
125
|
+
A root note with no text and no replies is removed when its popover closes, or when activation moves to another annotation, so abandoned notes do not stay on the page. Locked notes are never removed. If you add notes yourself (`add({ type: 'note', ... })`), give them `contents`, or they will be removed the first time someone opens and closes them.
|
|
126
|
+
|
|
127
|
+
## Custom rendering
|
|
128
|
+
|
|
129
|
+
Slots are snippets. `InkViewport` takes `loading`, `empty`, `error`, `annotation` and `pageError`. `InkNotePopover` and `InkSuggestionCard` take `children` as a snippet that receives the popover's props. `InkToolButton` takes `children` as a snippet of `{ active, label }`. The props each receives are typed as `AnnotationSlotProps`, `NotePopoverSlotProps` and `SuggestionCardSlotProps`, the same types the Vue and React packages export.
|
|
130
|
+
|
|
131
|
+
`InkRoot`, `InkToolbar`, `InkToolButton`, `InkZoomIn` and `InkZoomOut` take a `child` snippet to render your own element. Spread the `props` it gives you on that element. The snippet type is exported as `ChildSnippet`.
|
|
132
|
+
|
|
133
|
+
```svelte
|
|
134
|
+
<InkToolbar>
|
|
135
|
+
{#snippet child({ props })}
|
|
136
|
+
<nav {...props} class="my-toolbar">…</nav>
|
|
137
|
+
{/snippet}
|
|
138
|
+
</InkToolbar>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Keyboard
|
|
142
|
+
|
|
143
|
+
The scroll element takes focus. With the highlight or redact tool active, `Enter` turns the text selection into a mark; with the note tool, `Enter` places a note in the middle of the current page and opens it. On a focused annotation, `Enter` or `Space` selects and activates it (a note opens its thread and a suggested redaction its card; other types are only selected), `ArrowUp` and `ArrowDown` move between annotations, `Shift` + arrow moves it by 1 pt (add `Alt` for 10 pt), `Ctrl` or `Cmd` + `Shift` + arrow resizes an area mark, and `Delete` removes it. The full table is in the [`@inkbar/core` README](https://github.com/inkbar/inkbar/tree/main/packages/core#tools-and-keyboard).
|
|
144
|
+
|
|
145
|
+
## Styling
|
|
146
|
+
|
|
147
|
+
Components carry state on data attributes, for example `[data-annotation][data-state="selected"]` and `[data-tool="highlight"][data-state="on"]`. `@inkbar/theme` gives a default look. Your own CSS overrides it without `!important`. `InkRoot`, `InkViewport`, `DefaultToolbar` and the toolbar controls accept `class`.
|
|
148
|
+
|
|
149
|
+
## Hooks
|
|
150
|
+
|
|
151
|
+
`useDocument`, `useAnnotations`, `useTool`, `useSelection`, `useZoom`, `usePage`, `useHistory` and `useEmbedded` read the state of the nearest `InkRoot`. Call them during component initialisation, as you would `getContext`. Each returns an object whose reactive members are getters: read `useZoom().zoom` in your template or an effect and it tracks; destructure it (`const { zoom } = useZoom()`) and you copy the value once. Keep the object and read through it.
|
|
152
|
+
|
|
153
|
+
## Licence
|
|
154
|
+
|
|
155
|
+
[MIT](https://github.com/inkbar/inkbar/blob/main/LICENSE). From the team behind [Redactr](https://redactr.io).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"class-names.d.ts","sourceRoot":"","sources":["../src/lib/class-names.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,wBAAgB,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,KAAK,CAAC,EAAE,GAAG,MAAM,GAAG,SAAS,CAGtF"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { Annotation } from '@inkbar/core'
|
|
3
|
+
import type { AnnotationSlotProps } from '@inkbar/core/dom'
|
|
4
|
+
import type { Snippet } from 'svelte'
|
|
5
|
+
|
|
6
|
+
export interface InkAnnotationProps {
|
|
7
|
+
annotation: Annotation
|
|
8
|
+
/** The overlay element; its `data-state` (which includes hover) drives `state`. */
|
|
9
|
+
element?: HTMLElement | undefined
|
|
10
|
+
children: Snippet<[AnnotationSlotProps]>
|
|
11
|
+
}
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
/*
|
|
16
|
+
* Slot props for one annotation. It renders only its children: the overlay already draws the
|
|
17
|
+
* default visual for every annotation that is not custom, so this never draws a second one.
|
|
18
|
+
* InkPage portals it into the annotation's overlay element.
|
|
19
|
+
*/
|
|
20
|
+
import { acceptSuggestion } from '@inkbar/core'
|
|
21
|
+
|
|
22
|
+
import { useInkContext } from '../context.js'
|
|
23
|
+
|
|
24
|
+
import type { AnnotationState } from '@inkbar/core/dom'
|
|
25
|
+
|
|
26
|
+
let { annotation, element, children }: InkAnnotationProps = $props()
|
|
27
|
+
|
|
28
|
+
const ctx = useInkContext('InkAnnotation')
|
|
29
|
+
|
|
30
|
+
function readState(el: HTMLElement): AnnotationState | null {
|
|
31
|
+
const s = el.dataset.state
|
|
32
|
+
return s === 'idle' || s === 'hover' || s === 'selected' ? s : null
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
let observed = $state.raw<AnnotationState | null>(null)
|
|
36
|
+
const observedEl = $derived(element)
|
|
37
|
+
$effect(() => {
|
|
38
|
+
const el = observedEl
|
|
39
|
+
if (!el) {
|
|
40
|
+
observed = null
|
|
41
|
+
return
|
|
42
|
+
}
|
|
43
|
+
observed = readState(el)
|
|
44
|
+
const observer = new MutationObserver(() => {
|
|
45
|
+
observed = readState(el)
|
|
46
|
+
})
|
|
47
|
+
observer.observe(el, { attributes: true, attributeFilter: ['data-state'] })
|
|
48
|
+
return () => observer.disconnect()
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const isSuggestion = $derived(
|
|
52
|
+
annotation.type === 'redact' && annotation.origin === 'suggested'
|
|
53
|
+
)
|
|
54
|
+
const locked = $derived(annotation.locked === true)
|
|
55
|
+
const selected = $derived(ctx.selection.includes(annotation.id))
|
|
56
|
+
const store = () => ctx.document?.annotations
|
|
57
|
+
const slotProps = $derived<AnnotationSlotProps>({
|
|
58
|
+
annotation,
|
|
59
|
+
state: observed ?? (selected ? 'selected' : 'idle'),
|
|
60
|
+
locked,
|
|
61
|
+
select: () => store()?.select([annotation.id]),
|
|
62
|
+
remove: () => void store()?.remove(annotation.id),
|
|
63
|
+
accept: () => {
|
|
64
|
+
const s = store()
|
|
65
|
+
if (s && isSuggestion) acceptSuggestion(s, annotation.id)
|
|
66
|
+
},
|
|
67
|
+
dismiss: () => {
|
|
68
|
+
if (isSuggestion) store()?.remove(annotation.id)
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
{@render children(slotProps)}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Annotation } from '@inkbar/core';
|
|
2
|
+
import type { AnnotationSlotProps } from '@inkbar/core/dom';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
export interface InkAnnotationProps {
|
|
5
|
+
annotation: Annotation;
|
|
6
|
+
/** The overlay element; its `data-state` (which includes hover) drives `state`. */
|
|
7
|
+
element?: HTMLElement | undefined;
|
|
8
|
+
children: Snippet<[AnnotationSlotProps]>;
|
|
9
|
+
}
|
|
10
|
+
declare const InkAnnotation: import("svelte").Component<InkAnnotationProps, {}, "">;
|
|
11
|
+
type InkAnnotation = ReturnType<typeof InkAnnotation>;
|
|
12
|
+
export default InkAnnotation;
|
|
13
|
+
//# sourceMappingURL=InkAnnotation.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkAnnotation.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/InkAnnotation.svelte.ts"],"names":[],"mappings":"AAGE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAErC,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,UAAU,CAAA;IACtB,mFAAmF;IACnF,OAAO,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;IACjC,QAAQ,EAAE,OAAO,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAA;CACzC;AA2EH,QAAA,MAAM,aAAa,wDAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { NotePopoverSlotProps } from '@inkbar/core/dom'
|
|
3
|
+
import type { Snippet } from 'svelte'
|
|
4
|
+
|
|
5
|
+
export interface InkNotePopoverProps {
|
|
6
|
+
children?: Snippet<[NotePopoverSlotProps]> | undefined
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
/*
|
|
12
|
+
* The thread for the activated note, anchored to the note's overlay element. Activating a
|
|
13
|
+
* reply opens the whole thread from its root. Closing (Close, Escape, a press outside) clears
|
|
14
|
+
* `activated`.
|
|
15
|
+
*
|
|
16
|
+
* A new note has no text. While its root is empty (and unlocked) the default form writes the
|
|
17
|
+
* root's own `contents`, labelled "Comment", and the thread list stays hidden until there is
|
|
18
|
+
* something in it; after that the form adds replies. Closing a root that is still empty and
|
|
19
|
+
* has no replies removes it, so an abandoned note does not stay on the page.
|
|
20
|
+
*/
|
|
21
|
+
import { isAbandonedNote, threadOf, threadRoot } from '@inkbar/core'
|
|
22
|
+
import { Popover } from 'bits-ui'
|
|
23
|
+
import { untrack } from 'svelte'
|
|
24
|
+
|
|
25
|
+
import { useInkContext } from '../context.js'
|
|
26
|
+
import { useAnnotations } from '../hooks/useAnnotations.svelte.js'
|
|
27
|
+
|
|
28
|
+
import { useAnnotationElement } from './annotation-element.svelte.js'
|
|
29
|
+
import { keepOpenOnAnnotation, useFocusReturn } from './popover-focus.js'
|
|
30
|
+
import ThreadForm from './ThreadForm.svelte'
|
|
31
|
+
|
|
32
|
+
import type { Annotation, NoteAnnotation } from '@inkbar/core'
|
|
33
|
+
|
|
34
|
+
let { children }: InkNotePopoverProps = $props()
|
|
35
|
+
|
|
36
|
+
const ctx = useInkContext('InkNotePopover')
|
|
37
|
+
const store = useAnnotations()
|
|
38
|
+
|
|
39
|
+
const note = $derived.by<NoteAnnotation | null>(() => {
|
|
40
|
+
const a = ctx.activated
|
|
41
|
+
? store.annotations.find((x) => x.id === ctx.activated)
|
|
42
|
+
: undefined
|
|
43
|
+
return a?.type === 'note' ? threadRoot(store.annotations, a) : null
|
|
44
|
+
})
|
|
45
|
+
const anchorRef = useAnnotationElement(
|
|
46
|
+
() => ctx.rootEl,
|
|
47
|
+
() => note?.id ?? null
|
|
48
|
+
)
|
|
49
|
+
const anchor = $derived(anchorRef.current)
|
|
50
|
+
const focusReturn = useFocusReturn(ctx)
|
|
51
|
+
const open = $derived(note !== null && anchor !== null)
|
|
52
|
+
/** The root, then every reply below it, depth first, each level in creation order. */
|
|
53
|
+
const thread = $derived<Annotation[]>(note ? threadOf(store.annotations, note) : [])
|
|
54
|
+
/** True while the default form writes the root note's own text rather than a reply. */
|
|
55
|
+
const editingRoot = $derived(note !== null && !note.locked && !note.contents?.trim())
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Notes this popover wrote text or a reply for. In controlled mode the write is a proposal
|
|
59
|
+
* the host may not have applied yet, so the applied list still shows the note empty; these
|
|
60
|
+
* are never dropped as abandoned. Bookkeeping only: nothing renders from it.
|
|
61
|
+
*/
|
|
62
|
+
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
|
63
|
+
const written = new Set<string>()
|
|
64
|
+
/** Notes this popover has already asked to remove, so a slow host is asked once. */
|
|
65
|
+
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
|
66
|
+
const dropped = new Set<string>()
|
|
67
|
+
|
|
68
|
+
/** Removes an unlocked root note with no text and no replies. True when it did. */
|
|
69
|
+
function dropIfEmpty(id: string): boolean {
|
|
70
|
+
if (dropped.has(id) || written.has(id) || !isAbandonedNote(store.annotations, id))
|
|
71
|
+
return false
|
|
72
|
+
dropped.add(id)
|
|
73
|
+
store.remove(id)
|
|
74
|
+
return true
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Activation moved on from a note that never got any text: drop it.
|
|
78
|
+
let previousId: string | undefined
|
|
79
|
+
$effect(() => {
|
|
80
|
+
const id = note?.id
|
|
81
|
+
const previous = previousId
|
|
82
|
+
if (previous === id) return
|
|
83
|
+
previousId = id
|
|
84
|
+
if (previous !== undefined) untrack(() => dropIfEmpty(previous))
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
function reply(text: string): void {
|
|
88
|
+
const root = note
|
|
89
|
+
const contents = text.trim()
|
|
90
|
+
if (!root || !contents) return
|
|
91
|
+
written.add(root.id)
|
|
92
|
+
store.add({
|
|
93
|
+
type: 'note',
|
|
94
|
+
page: root.page,
|
|
95
|
+
rect: root.rect,
|
|
96
|
+
contents,
|
|
97
|
+
inReplyTo: root.id,
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
function isEmptyRoot(root: NoteAnnotation): boolean {
|
|
101
|
+
return (
|
|
102
|
+
!written.has(root.id) &&
|
|
103
|
+
!root.locked &&
|
|
104
|
+
!root.contents?.trim() &&
|
|
105
|
+
thread.length === 1
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
function close(): void {
|
|
109
|
+
const root = note
|
|
110
|
+
if (root && store.annotations.some((a) => a.id === root.id) && isEmptyRoot(root)) {
|
|
111
|
+
focusReturn.beforeRemove(anchor)
|
|
112
|
+
dropIfEmpty(root.id)
|
|
113
|
+
}
|
|
114
|
+
ctx.setActivated(null)
|
|
115
|
+
}
|
|
116
|
+
function updateContents(contents: string): void {
|
|
117
|
+
if (!note || note.locked) return
|
|
118
|
+
if (contents.trim()) written.add(note.id)
|
|
119
|
+
store.update(note.id, { contents })
|
|
120
|
+
}
|
|
121
|
+
/** Locked notes cannot be removed: removing one does nothing and keeps the popover. */
|
|
122
|
+
function removeThread(): void {
|
|
123
|
+
const root = note
|
|
124
|
+
if (!root || root.locked) return
|
|
125
|
+
focusReturn.beforeRemove(anchor)
|
|
126
|
+
// Under a slow controlled host the note stays listed for a while; it is not asked for again.
|
|
127
|
+
dropped.add(root.id)
|
|
128
|
+
store.remove(root.id)
|
|
129
|
+
ctx.setActivated(null)
|
|
130
|
+
}
|
|
131
|
+
function onOpenChange(next: boolean): void {
|
|
132
|
+
if (!next) close()
|
|
133
|
+
}
|
|
134
|
+
</script>
|
|
135
|
+
|
|
136
|
+
<Popover.Root bind:open={() => open, onOpenChange}>
|
|
137
|
+
<Popover.Portal>
|
|
138
|
+
{#if note && anchor}
|
|
139
|
+
<Popover.Content
|
|
140
|
+
class="ink-note-popover"
|
|
141
|
+
data-ink-note-popover=""
|
|
142
|
+
role="dialog"
|
|
143
|
+
side="right"
|
|
144
|
+
sideOffset={8}
|
|
145
|
+
collisionPadding={8}
|
|
146
|
+
aria-label="Note thread"
|
|
147
|
+
customAnchor={anchor}
|
|
148
|
+
onInteractOutside={keepOpenOnAnnotation}
|
|
149
|
+
onOpenAutoFocus={focusReturn.onOpenAutoFocus}
|
|
150
|
+
onCloseAutoFocus={(e) => focusReturn.onCloseAutoFocus(e, anchor)}
|
|
151
|
+
>
|
|
152
|
+
{#if children}
|
|
153
|
+
{@render children({
|
|
154
|
+
note,
|
|
155
|
+
replies: thread.slice(1),
|
|
156
|
+
reply,
|
|
157
|
+
update: updateContents,
|
|
158
|
+
remove: removeThread,
|
|
159
|
+
close,
|
|
160
|
+
})}
|
|
161
|
+
{:else}
|
|
162
|
+
{#if !editingRoot || thread.length > 1}
|
|
163
|
+
<ol class="ink-thread" data-ink-thread="">
|
|
164
|
+
{#each thread as item (item.id)}
|
|
165
|
+
<li
|
|
166
|
+
class="ink-thread-item"
|
|
167
|
+
data-ink-thread-item=""
|
|
168
|
+
data-reply={item.inReplyTo ? '' : undefined}
|
|
169
|
+
>
|
|
170
|
+
<span class="ink-thread-author">{item.author ?? 'Anonymous'}</span>
|
|
171
|
+
<time class="ink-thread-time" datetime={item.createdAt}>
|
|
172
|
+
{new Date(item.createdAt).toLocaleString()}
|
|
173
|
+
</time>
|
|
174
|
+
<p class="ink-thread-text">{item.contents}</p>
|
|
175
|
+
</li>
|
|
176
|
+
{/each}
|
|
177
|
+
</ol>
|
|
178
|
+
{/if}
|
|
179
|
+
<!-- Keyed by note: moving to another note starts with an empty draft at once. -->
|
|
180
|
+
{#key note.id}
|
|
181
|
+
<ThreadForm
|
|
182
|
+
{editingRoot}
|
|
183
|
+
locked={!!note.locked}
|
|
184
|
+
onSubmit={(text) => (editingRoot ? updateContents(text) : reply(text))}
|
|
185
|
+
onRemove={removeThread}
|
|
186
|
+
onClose={close}
|
|
187
|
+
/>
|
|
188
|
+
{/key}
|
|
189
|
+
{/if}
|
|
190
|
+
</Popover.Content>
|
|
191
|
+
{/if}
|
|
192
|
+
</Popover.Portal>
|
|
193
|
+
</Popover.Root>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NotePopoverSlotProps } from '@inkbar/core/dom';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
export interface InkNotePopoverProps {
|
|
4
|
+
children?: Snippet<[NotePopoverSlotProps]> | undefined;
|
|
5
|
+
}
|
|
6
|
+
declare const InkNotePopover: import("svelte").Component<InkNotePopoverProps, {}, "">;
|
|
7
|
+
type InkNotePopover = ReturnType<typeof InkNotePopover>;
|
|
8
|
+
export default InkNotePopover;
|
|
9
|
+
//# sourceMappingURL=InkNotePopover.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkNotePopover.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/InkNotePopover.svelte.ts"],"names":[],"mappings":"AAGE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAErC,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC,oBAAoB,CAAC,CAAC,GAAG,SAAS,CAAA;CACvD;AAwLH,QAAA,MAAM,cAAc,yDAAwC,CAAC;AAC7D,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AACxD,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { InkError } from '@inkbar/core'
|
|
3
|
+
import type { AnnotationSlotProps, PageMount } from '@inkbar/core/dom'
|
|
4
|
+
import type { Snippet } from 'svelte'
|
|
5
|
+
|
|
6
|
+
export interface InkPageProps {
|
|
7
|
+
page: number
|
|
8
|
+
host: HTMLElement
|
|
9
|
+
/** The engine's page mount in `host`. */
|
|
10
|
+
mount: PageMount
|
|
11
|
+
/** The engine's error for this page, `null` while it renders. */
|
|
12
|
+
error: InkError | null
|
|
13
|
+
/** Fixed for the life of the mount: the engine rebuilds when it changes. */
|
|
14
|
+
customAnnotations?: boolean
|
|
15
|
+
annotation?: Snippet<[AnnotationSlotProps]> | undefined
|
|
16
|
+
pageError?: Snippet<[{ error: InkError; page: number }]> | undefined
|
|
17
|
+
}
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
/*
|
|
22
|
+
* One page the viewer engine mounted. Renders nothing visible in place; the portal attachment
|
|
23
|
+
* moves the page error into the host and each custom annotation's content into its overlay
|
|
24
|
+
* element.
|
|
25
|
+
*
|
|
26
|
+
* The overlay creates and removes those elements as the annotation list changes, outside
|
|
27
|
+
* Svelte. So the portal targets come from a list read after every overlay render: this
|
|
28
|
+
* component subscribes to the store after the overlay does (the engine created the mount
|
|
29
|
+
* first), and core notifies subscribers in order, so the elements already exist when the list
|
|
30
|
+
* arrives here.
|
|
31
|
+
*
|
|
32
|
+
* The engine tracks page errors and sets `data-state="error"` on the host; this component
|
|
33
|
+
* portals the page error into it while `error` is set.
|
|
34
|
+
*/
|
|
35
|
+
import { untrack } from 'svelte'
|
|
36
|
+
|
|
37
|
+
import { useInkContext } from '../context.js'
|
|
38
|
+
|
|
39
|
+
import InkAnnotation from './InkAnnotation.svelte'
|
|
40
|
+
import { portal } from './portal.js'
|
|
41
|
+
|
|
42
|
+
import type { Annotation } from '@inkbar/core'
|
|
43
|
+
|
|
44
|
+
let {
|
|
45
|
+
page,
|
|
46
|
+
host,
|
|
47
|
+
mount,
|
|
48
|
+
error,
|
|
49
|
+
customAnnotations = false,
|
|
50
|
+
annotation,
|
|
51
|
+
pageError,
|
|
52
|
+
}: InkPageProps = $props()
|
|
53
|
+
|
|
54
|
+
interface Target {
|
|
55
|
+
annotation: Annotation
|
|
56
|
+
el: HTMLElement
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function sameTargets(a: readonly Target[], b: readonly Target[]): boolean {
|
|
60
|
+
return (
|
|
61
|
+
a.length === b.length &&
|
|
62
|
+
a.every((t, i) => t.annotation === b[i]!.annotation && t.el === b[i]!.el)
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const ctx = useInkContext('InkPage')
|
|
67
|
+
let targets = $state.raw<Target[]>([])
|
|
68
|
+
|
|
69
|
+
// Targets are read from the current mount, and read again when InkViewport hands this page a
|
|
70
|
+
// new one (the page left and came back within one tick, under the same key). The props are
|
|
71
|
+
// read through deriveds, which notify only when the value changes: InkViewport replaces this
|
|
72
|
+
// page's whole entry when its error changes, and that invalidates every prop without
|
|
73
|
+
// changing the mount.
|
|
74
|
+
const listPage = $derived(page)
|
|
75
|
+
const listMount = $derived(mount)
|
|
76
|
+
const listCustom = $derived(customAnnotations)
|
|
77
|
+
$effect(() => {
|
|
78
|
+
const p = listPage
|
|
79
|
+
const m = listMount
|
|
80
|
+
const custom = listCustom
|
|
81
|
+
const doc = untrack(() => ctx.document)
|
|
82
|
+
if (!doc || !custom) {
|
|
83
|
+
if (untrack(() => targets).length > 0) targets = []
|
|
84
|
+
return
|
|
85
|
+
}
|
|
86
|
+
const read = (): void => {
|
|
87
|
+
const next = doc.annotations.byPage(p).flatMap((a) => {
|
|
88
|
+
const el = m.overlay.elementFor(a.id)
|
|
89
|
+
return el ? [{ annotation: a, el }] : []
|
|
90
|
+
})
|
|
91
|
+
// A change elsewhere in the document leaves this page's targets as they were. The
|
|
92
|
+
// first read runs inside the effect, which must not come to depend on its own list.
|
|
93
|
+
if (
|
|
94
|
+
!sameTargets(
|
|
95
|
+
untrack(() => targets),
|
|
96
|
+
next
|
|
97
|
+
)
|
|
98
|
+
)
|
|
99
|
+
targets = next
|
|
100
|
+
}
|
|
101
|
+
const stop = doc.annotations.list.subscribe(read)
|
|
102
|
+
read()
|
|
103
|
+
return stop
|
|
104
|
+
})
|
|
105
|
+
</script>
|
|
106
|
+
|
|
107
|
+
{#if error}
|
|
108
|
+
<div hidden {@attach portal(host)}>
|
|
109
|
+
<div class="ink-page-error" data-ink-page-error="" role="alert">
|
|
110
|
+
{#if pageError}
|
|
111
|
+
{@render pageError({ error, page })}
|
|
112
|
+
{:else}
|
|
113
|
+
<p>Page {page + 1} could not be shown.</p>
|
|
114
|
+
<code class="ink-error-code">{error.code}</code>
|
|
115
|
+
{/if}
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
{/if}
|
|
119
|
+
{#if annotation}
|
|
120
|
+
{#each targets as t (t.annotation.id)}
|
|
121
|
+
<div hidden {@attach portal(t.el)}>
|
|
122
|
+
<InkAnnotation annotation={t.annotation} element={t.el} children={annotation} />
|
|
123
|
+
</div>
|
|
124
|
+
{/each}
|
|
125
|
+
{/if}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { InkError } from '@inkbar/core';
|
|
2
|
+
import type { AnnotationSlotProps, PageMount } from '@inkbar/core/dom';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
export interface InkPageProps {
|
|
5
|
+
page: number;
|
|
6
|
+
host: HTMLElement;
|
|
7
|
+
/** The engine's page mount in `host`. */
|
|
8
|
+
mount: PageMount;
|
|
9
|
+
/** The engine's error for this page, `null` while it renders. */
|
|
10
|
+
error: InkError | null;
|
|
11
|
+
/** Fixed for the life of the mount: the engine rebuilds when it changes. */
|
|
12
|
+
customAnnotations?: boolean;
|
|
13
|
+
annotation?: Snippet<[AnnotationSlotProps]> | undefined;
|
|
14
|
+
pageError?: Snippet<[{
|
|
15
|
+
error: InkError;
|
|
16
|
+
page: number;
|
|
17
|
+
}]> | undefined;
|
|
18
|
+
}
|
|
19
|
+
declare const InkPage: import("svelte").Component<InkPageProps, {}, "">;
|
|
20
|
+
type InkPage = ReturnType<typeof InkPage>;
|
|
21
|
+
export default InkPage;
|
|
22
|
+
//# sourceMappingURL=InkPage.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkPage.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/InkPage.svelte.ts"],"names":[],"mappings":"AAGE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAErC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,WAAW,CAAA;IACjB,yCAAyC;IACzC,KAAK,EAAE,SAAS,CAAA;IAChB,iEAAiE;IACjE,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAA;IACtB,4EAA4E;IAC5E,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC,mBAAmB,CAAC,CAAC,GAAG,SAAS,CAAA;IACvD,SAAS,CAAC,EAAE,OAAO,CAAC,CAAC;QAAE,KAAK,EAAE,QAAQ,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,GAAG,SAAS,CAAA;CACrE;AA4HH,QAAA,MAAM,OAAO,kDAAwC,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
3
|
+
|
|
4
|
+
export type InkPageCountProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children'>
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
import { usePage } from '../hooks/usePage.svelte.js'
|
|
9
|
+
|
|
10
|
+
let { class: className, ...rest }: InkPageCountProps = $props()
|
|
11
|
+
|
|
12
|
+
const page = usePage()
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<span
|
|
16
|
+
class={['ink-page-count', className]}
|
|
17
|
+
data-ink-page-count=""
|
|
18
|
+
aria-live="polite"
|
|
19
|
+
{...rest}>of {page.count}</span
|
|
20
|
+
>
|