@inkbar/svelte 0.1.1 → 0.2.0
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 +32 -5
- package/dist/components/InkIcon.svelte +24 -0
- package/dist/components/InkIcon.svelte.d.ts +9 -0
- package/dist/components/InkIcon.svelte.d.ts.map +1 -0
- package/dist/components/InkNextPage.svelte +38 -0
- package/dist/components/InkNextPage.svelte.d.ts +5 -0
- package/dist/components/InkNextPage.svelte.d.ts.map +1 -0
- package/dist/components/InkPrevPage.svelte +38 -0
- package/dist/components/InkPrevPage.svelte.d.ts +5 -0
- package/dist/components/InkPrevPage.svelte.d.ts.map +1 -0
- package/dist/components/InkRedo.svelte +38 -0
- package/dist/components/InkRedo.svelte.d.ts +5 -0
- package/dist/components/InkRedo.svelte.d.ts.map +1 -0
- package/dist/components/InkToolButton.svelte +15 -1
- package/dist/components/InkToolButton.svelte.d.ts.map +1 -1
- package/dist/components/InkToolbarSeparator.svelte +18 -0
- package/dist/components/InkToolbarSeparator.svelte.d.ts +6 -0
- package/dist/components/InkToolbarSeparator.svelte.d.ts.map +1 -0
- package/dist/components/InkUndo.svelte +38 -0
- package/dist/components/InkUndo.svelte.d.ts +5 -0
- package/dist/components/InkUndo.svelte.d.ts.map +1 -0
- package/dist/components/InkZoomIn.svelte +3 -1
- package/dist/components/InkZoomIn.svelte.d.ts.map +1 -1
- package/dist/components/InkZoomOut.svelte +3 -1
- package/dist/components/InkZoomOut.svelte.d.ts.map +1 -1
- package/dist/components/InkZoomSelect.svelte +73 -24
- package/dist/components/InkZoomSelect.svelte.d.ts +3 -2
- package/dist/components/InkZoomSelect.svelte.d.ts.map +1 -1
- package/dist/components/history-button.d.ts +10 -0
- package/dist/components/history-button.d.ts.map +1 -0
- package/dist/components/history-button.js +1 -0
- package/dist/components/page-button.d.ts +10 -0
- package/dist/components/page-button.d.ts.map +1 -0
- package/dist/components/page-button.js +1 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/package.json +5 -5
- package/dist/class-names.d.ts +0 -3
- package/dist/class-names.d.ts.map +0 -1
- package/dist/class-names.js +0 -5
- package/dist/compositions/DefaultToolbar.svelte +0 -90
- package/dist/compositions/DefaultToolbar.svelte.d.ts +0 -10
- package/dist/compositions/DefaultToolbar.svelte.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
---
|
|
22
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
|
|
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 components to build your own toolbars, popovers for notes and suggested redactions, and hooks for anything else. `@inkbar/theme` styles them all.
|
|
24
24
|
|
|
25
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
26
|
|
|
@@ -39,7 +39,18 @@ Svelte 5.46.4 or later is a peer dependency. Add the Vite plugin from `@inkbar/c
|
|
|
39
39
|
import {
|
|
40
40
|
InkRoot,
|
|
41
41
|
InkViewport,
|
|
42
|
-
|
|
42
|
+
InkToolbar,
|
|
43
|
+
InkToolButton,
|
|
44
|
+
InkToolbarSeparator,
|
|
45
|
+
InkUndo,
|
|
46
|
+
InkRedo,
|
|
47
|
+
InkPrevPage,
|
|
48
|
+
InkPageInput,
|
|
49
|
+
InkPageCount,
|
|
50
|
+
InkNextPage,
|
|
51
|
+
InkZoomOut,
|
|
52
|
+
InkZoomSelect,
|
|
53
|
+
InkZoomIn,
|
|
43
54
|
InkNotePopover,
|
|
44
55
|
InkSuggestionCard,
|
|
45
56
|
} from '@inkbar/svelte'
|
|
@@ -53,14 +64,30 @@ Svelte 5.46.4 or later is a peer dependency. Add the Vite plugin from `@inkbar/c
|
|
|
53
64
|
</script>
|
|
54
65
|
|
|
55
66
|
<InkRoot src={{ url: signedUrl, key: documentId }} {assets} bind:annotations>
|
|
56
|
-
<
|
|
67
|
+
<InkToolbar>
|
|
68
|
+
<InkToolButton tool="select" />
|
|
69
|
+
<InkToolButton tool="highlight" />
|
|
70
|
+
<InkToolButton tool="note" />
|
|
71
|
+
<InkToolbarSeparator />
|
|
72
|
+
<InkUndo />
|
|
73
|
+
<InkRedo />
|
|
74
|
+
</InkToolbar>
|
|
57
75
|
<InkViewport />
|
|
76
|
+
<InkToolbar label="Page and zoom">
|
|
77
|
+
<InkPrevPage />
|
|
78
|
+
<InkPageInput />
|
|
79
|
+
<InkPageCount />
|
|
80
|
+
<InkNextPage />
|
|
81
|
+
<InkZoomOut />
|
|
82
|
+
<InkZoomSelect />
|
|
83
|
+
<InkZoomIn />
|
|
84
|
+
</InkToolbar>
|
|
58
85
|
<InkNotePopover />
|
|
59
86
|
<InkSuggestionCard />
|
|
60
87
|
</InkRoot>
|
|
61
88
|
```
|
|
62
89
|
|
|
63
|
-
`bind:annotations` makes your list the source of truth. Leave it off and Inkbar keeps the state itself, with undo and redo.
|
|
90
|
+
Each toolbar control is a component, so keep the ones you need and put them where you like. Buttons show icons from `@inkbar/icons`. Pass your own as `children` to replace one, and use `InkIcon` to put the same icons on your own buttons. `bind:annotations` makes your list the source of truth. Leave it off and Inkbar keeps the state itself, with undo and redo.
|
|
64
91
|
|
|
65
92
|
## Controlled mode
|
|
66
93
|
|
|
@@ -144,7 +171,7 @@ The scroll element takes focus. With the highlight or redact tool active, `Enter
|
|
|
144
171
|
|
|
145
172
|
## Styling
|
|
146
173
|
|
|
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`, `
|
|
174
|
+
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`, `InkToolbar` and the toolbar controls accept `class`.
|
|
148
175
|
|
|
149
176
|
## Hooks
|
|
150
177
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { IconNode } from '@inkbar/icons'
|
|
3
|
+
|
|
4
|
+
export interface InkIconProps {
|
|
5
|
+
icon: IconNode
|
|
6
|
+
size?: number | undefined
|
|
7
|
+
}
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
/*
|
|
12
|
+
* An icon from `@inkbar/icons`, hidden from assistive technology: the control it sits in
|
|
13
|
+
* carries the name. The theme sizes it with `--ink-icon-size`.
|
|
14
|
+
*/
|
|
15
|
+
import { ICON_ATTRIBUTES } from '@inkbar/icons'
|
|
16
|
+
|
|
17
|
+
let { icon, size = 18 }: InkIconProps = $props()
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<svg {...ICON_ATTRIBUTES} width={size} height={size} class="ink-icon" aria-hidden="true">
|
|
21
|
+
{#each icon as [tag, attrs], i (i)}
|
|
22
|
+
<svelte:element this={tag} {...attrs} />
|
|
23
|
+
{/each}
|
|
24
|
+
</svg>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IconNode } from '@inkbar/icons';
|
|
2
|
+
export interface InkIconProps {
|
|
3
|
+
icon: IconNode;
|
|
4
|
+
size?: number | undefined;
|
|
5
|
+
}
|
|
6
|
+
declare const InkIcon: import("svelte").Component<InkIconProps, {}, "">;
|
|
7
|
+
type InkIcon = ReturnType<typeof InkIcon>;
|
|
8
|
+
export default InkIcon;
|
|
9
|
+
//# sourceMappingURL=InkIcon.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkIcon.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/InkIcon.svelte.ts"],"names":[],"mappings":"AAGE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAE7C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,QAAQ,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC1B;AA0BH,QAAA,MAAM,OAAO,kDAAwC,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { ChevronRight } from '@inkbar/icons'
|
|
3
|
+
import { Toolbar } from 'bits-ui'
|
|
4
|
+
|
|
5
|
+
import { usePage } from '../hooks/usePage.svelte.js'
|
|
6
|
+
|
|
7
|
+
import { asBitsProps } from './child-snippet.js'
|
|
8
|
+
import InkIcon from './InkIcon.svelte'
|
|
9
|
+
|
|
10
|
+
import type { InkPageButtonProps } from './page-button.js'
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
class: className,
|
|
14
|
+
children,
|
|
15
|
+
child,
|
|
16
|
+
disabled,
|
|
17
|
+
onclick,
|
|
18
|
+
...rest
|
|
19
|
+
}: InkPageButtonProps = $props()
|
|
20
|
+
|
|
21
|
+
const page = usePage()
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<Toolbar.Button
|
|
25
|
+
class={['ink-next-page', className]}
|
|
26
|
+
data-ink-next-page=""
|
|
27
|
+
aria-label="Next page"
|
|
28
|
+
title="Next page"
|
|
29
|
+
disabled={page.current >= page.count - 1 || !!disabled}
|
|
30
|
+
{...child ? { child } : {}}
|
|
31
|
+
{...asBitsProps(rest)}
|
|
32
|
+
onclick={(e) => {
|
|
33
|
+
onclick?.(e)
|
|
34
|
+
if (!e.defaultPrevented) page.next()
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
{#if children}{@render children()}{:else}<InkIcon icon={ChevronRight} />{/if}
|
|
38
|
+
</Toolbar.Button>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { InkPageButtonProps } from './page-button.js';
|
|
2
|
+
declare const InkNextPage: import("svelte").Component<InkPageButtonProps, {}, "">;
|
|
3
|
+
type InkNextPage = ReturnType<typeof InkNextPage>;
|
|
4
|
+
export default InkNextPage;
|
|
5
|
+
//# sourceMappingURL=InkNextPage.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkNextPage.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/InkNextPage.svelte.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAkC3D,QAAA,MAAM,WAAW,wDAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { ChevronLeft } from '@inkbar/icons'
|
|
3
|
+
import { Toolbar } from 'bits-ui'
|
|
4
|
+
|
|
5
|
+
import { usePage } from '../hooks/usePage.svelte.js'
|
|
6
|
+
|
|
7
|
+
import { asBitsProps } from './child-snippet.js'
|
|
8
|
+
import InkIcon from './InkIcon.svelte'
|
|
9
|
+
|
|
10
|
+
import type { InkPageButtonProps } from './page-button.js'
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
class: className,
|
|
14
|
+
children,
|
|
15
|
+
child,
|
|
16
|
+
disabled,
|
|
17
|
+
onclick,
|
|
18
|
+
...rest
|
|
19
|
+
}: InkPageButtonProps = $props()
|
|
20
|
+
|
|
21
|
+
const page = usePage()
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<Toolbar.Button
|
|
25
|
+
class={['ink-prev-page', className]}
|
|
26
|
+
data-ink-prev-page=""
|
|
27
|
+
aria-label="Previous page"
|
|
28
|
+
title="Previous page"
|
|
29
|
+
disabled={page.current <= 0 || !!disabled}
|
|
30
|
+
{...child ? { child } : {}}
|
|
31
|
+
{...asBitsProps(rest)}
|
|
32
|
+
onclick={(e) => {
|
|
33
|
+
onclick?.(e)
|
|
34
|
+
if (!e.defaultPrevented) page.previous()
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
{#if children}{@render children()}{:else}<InkIcon icon={ChevronLeft} />{/if}
|
|
38
|
+
</Toolbar.Button>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { InkPageButtonProps } from './page-button.js';
|
|
2
|
+
declare const InkPrevPage: import("svelte").Component<InkPageButtonProps, {}, "">;
|
|
3
|
+
type InkPrevPage = ReturnType<typeof InkPrevPage>;
|
|
4
|
+
export default InkPrevPage;
|
|
5
|
+
//# sourceMappingURL=InkPrevPage.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkPrevPage.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/InkPrevPage.svelte.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAkC3D,QAAA,MAAM,WAAW,wDAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Redo2 } from '@inkbar/icons'
|
|
3
|
+
import { Toolbar } from 'bits-ui'
|
|
4
|
+
|
|
5
|
+
import { useHistory } from '../hooks/useHistory.svelte.js'
|
|
6
|
+
|
|
7
|
+
import { asBitsProps } from './child-snippet.js'
|
|
8
|
+
import InkIcon from './InkIcon.svelte'
|
|
9
|
+
|
|
10
|
+
import type { InkHistoryButtonProps } from './history-button.js'
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
class: className,
|
|
14
|
+
children,
|
|
15
|
+
child,
|
|
16
|
+
disabled,
|
|
17
|
+
onclick,
|
|
18
|
+
...rest
|
|
19
|
+
}: InkHistoryButtonProps = $props()
|
|
20
|
+
|
|
21
|
+
const history = useHistory()
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<Toolbar.Button
|
|
25
|
+
class={['ink-redo', className]}
|
|
26
|
+
data-ink-redo=""
|
|
27
|
+
aria-label="Redo"
|
|
28
|
+
title="Redo"
|
|
29
|
+
disabled={!history.canRedo || !!disabled}
|
|
30
|
+
{...child ? { child } : {}}
|
|
31
|
+
{...asBitsProps(rest)}
|
|
32
|
+
onclick={(e) => {
|
|
33
|
+
onclick?.(e)
|
|
34
|
+
if (!e.defaultPrevented) history.redo()
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
{#if children}{@render children()}{:else}<InkIcon icon={Redo2} />{/if}
|
|
38
|
+
</Toolbar.Button>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkRedo.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/InkRedo.svelte.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAkCjE,QAAA,MAAM,OAAO,2DAAwC,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}
|
|
@@ -14,11 +14,23 @@
|
|
|
14
14
|
|
|
15
15
|
<script lang="ts">
|
|
16
16
|
import { TOOL_LABELS } from '@inkbar/core/dom'
|
|
17
|
+
import { Hand, Highlighter, MessageSquare, MousePointer2, Square } from '@inkbar/icons'
|
|
17
18
|
import { Toolbar } from 'bits-ui'
|
|
18
19
|
|
|
19
20
|
import { useTool } from '../hooks/useTool.svelte.js'
|
|
20
21
|
|
|
21
22
|
import { asBitsProps } from './child-snippet.js'
|
|
23
|
+
import InkIcon from './InkIcon.svelte'
|
|
24
|
+
|
|
25
|
+
import type { IconNode } from '@inkbar/icons'
|
|
26
|
+
|
|
27
|
+
const ICONS: Readonly<Record<ToolId, IconNode>> = {
|
|
28
|
+
view: Hand,
|
|
29
|
+
select: MousePointer2,
|
|
30
|
+
highlight: Highlighter,
|
|
31
|
+
'redact-area': Square,
|
|
32
|
+
note: MessageSquare,
|
|
33
|
+
}
|
|
22
34
|
|
|
23
35
|
let {
|
|
24
36
|
tool,
|
|
@@ -50,5 +62,7 @@
|
|
|
50
62
|
if (!e.defaultPrevented) current.setTool(tool)
|
|
51
63
|
}}
|
|
52
64
|
>
|
|
53
|
-
{#if children}{@render children({ active, label: name })}{:else}
|
|
65
|
+
{#if children}{@render children({ active, label: name })}{:else}<InkIcon
|
|
66
|
+
icon={ICONS[tool]}
|
|
67
|
+
/>{/if}
|
|
54
68
|
</Toolbar.Button>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InkToolButton.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/InkToolButton.svelte.ts"],"names":[],"mappings":"AAGE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAE3D,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC;IAChF,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,GAAG,SAAS,CAAA;IACpE,KAAK,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;CACjC;
|
|
1
|
+
{"version":3,"file":"InkToolButton.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/InkToolButton.svelte.ts"],"names":[],"mappings":"AAGE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAE3D,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC;IAChF,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,GAAG,SAAS,CAAA;IACpE,KAAK,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;CACjC;AA4DH,QAAA,MAAM,aAAa,wDAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements'
|
|
3
|
+
|
|
4
|
+
export type InkToolbarSeparatorProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'>
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<script lang="ts">
|
|
8
|
+
/* A divider between groups of controls in a horizontal toolbar. Not focusable. */
|
|
9
|
+
let { class: className, ...rest }: InkToolbarSeparatorProps = $props()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<div
|
|
13
|
+
role="separator"
|
|
14
|
+
aria-orientation="vertical"
|
|
15
|
+
class={['ink-toolbar-separator', className]}
|
|
16
|
+
data-ink-toolbar-separator=""
|
|
17
|
+
{...rest}
|
|
18
|
+
></div>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
export type InkToolbarSeparatorProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'>;
|
|
3
|
+
declare const InkToolbarSeparator: import("svelte").Component<InkToolbarSeparatorProps, {}, "">;
|
|
4
|
+
type InkToolbarSeparator = ReturnType<typeof InkToolbarSeparator>;
|
|
5
|
+
export default InkToolbarSeparator;
|
|
6
|
+
//# sourceMappingURL=InkToolbarSeparator.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkToolbarSeparator.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/InkToolbarSeparator.svelte.ts"],"names":[],"mappings":"AAGE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAErD,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,CACxF;AAYD,QAAA,MAAM,mBAAmB,8DAAwC,CAAC;AAClE,KAAK,mBAAmB,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAClE,eAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Undo2 } from '@inkbar/icons'
|
|
3
|
+
import { Toolbar } from 'bits-ui'
|
|
4
|
+
|
|
5
|
+
import { useHistory } from '../hooks/useHistory.svelte.js'
|
|
6
|
+
|
|
7
|
+
import { asBitsProps } from './child-snippet.js'
|
|
8
|
+
import InkIcon from './InkIcon.svelte'
|
|
9
|
+
|
|
10
|
+
import type { InkHistoryButtonProps } from './history-button.js'
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
class: className,
|
|
14
|
+
children,
|
|
15
|
+
child,
|
|
16
|
+
disabled,
|
|
17
|
+
onclick,
|
|
18
|
+
...rest
|
|
19
|
+
}: InkHistoryButtonProps = $props()
|
|
20
|
+
|
|
21
|
+
const history = useHistory()
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<Toolbar.Button
|
|
25
|
+
class={['ink-undo', className]}
|
|
26
|
+
data-ink-undo=""
|
|
27
|
+
aria-label="Undo"
|
|
28
|
+
title="Undo"
|
|
29
|
+
disabled={!history.canUndo || !!disabled}
|
|
30
|
+
{...child ? { child } : {}}
|
|
31
|
+
{...asBitsProps(rest)}
|
|
32
|
+
onclick={(e) => {
|
|
33
|
+
onclick?.(e)
|
|
34
|
+
if (!e.defaultPrevented) history.undo()
|
|
35
|
+
}}
|
|
36
|
+
>
|
|
37
|
+
{#if children}{@render children()}{:else}<InkIcon icon={Undo2} />{/if}
|
|
38
|
+
</Toolbar.Button>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InkUndo.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/InkUndo.svelte.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAkCjE,QAAA,MAAM,OAAO,2DAAwC,CAAC;AACtD,KAAK,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAC1C,eAAe,OAAO,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { ZoomIn } from '@inkbar/icons'
|
|
2
3
|
import { Toolbar } from 'bits-ui'
|
|
3
4
|
|
|
4
5
|
import { useZoom } from '../hooks/useZoom.svelte.js'
|
|
5
6
|
|
|
6
7
|
import { asBitsProps } from './child-snippet.js'
|
|
8
|
+
import InkIcon from './InkIcon.svelte'
|
|
7
9
|
|
|
8
10
|
import type { InkZoomButtonProps } from './zoom-button.js'
|
|
9
11
|
|
|
@@ -30,5 +32,5 @@
|
|
|
30
32
|
if (!e.defaultPrevented) zoom.zoomIn()
|
|
31
33
|
}}
|
|
32
34
|
>
|
|
33
|
-
{#if children}{@render children()}{:else}
|
|
35
|
+
{#if children}{@render children()}{:else}<InkIcon icon={ZoomIn} />{/if}
|
|
34
36
|
</Toolbar.Button>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InkZoomIn.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/InkZoomIn.svelte.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InkZoomIn.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/InkZoomIn.svelte.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAiC3D,QAAA,MAAM,SAAS,wDAAwC,CAAC;AACxD,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAC9C,eAAe,SAAS,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { ZoomOut } from '@inkbar/icons'
|
|
2
3
|
import { Toolbar } from 'bits-ui'
|
|
3
4
|
|
|
4
5
|
import { useZoom } from '../hooks/useZoom.svelte.js'
|
|
5
6
|
|
|
6
7
|
import { asBitsProps } from './child-snippet.js'
|
|
8
|
+
import InkIcon from './InkIcon.svelte'
|
|
7
9
|
|
|
8
10
|
import type { InkZoomButtonProps } from './zoom-button.js'
|
|
9
11
|
|
|
@@ -30,5 +32,5 @@
|
|
|
30
32
|
if (!e.defaultPrevented) zoom.zoomOut()
|
|
31
33
|
}}
|
|
32
34
|
>
|
|
33
|
-
{#if children}{@render children()}{:else}
|
|
35
|
+
{#if children}{@render children()}{:else}<InkIcon icon={ZoomOut} />{/if}
|
|
34
36
|
</Toolbar.Button>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InkZoomOut.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/InkZoomOut.svelte.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InkZoomOut.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/InkZoomOut.svelte.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAiC3D,QAAA,MAAM,UAAU,wDAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
|
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { HTMLButtonAttributes } from 'svelte/elements'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
'value' | 'onchange' | 'children'
|
|
7
|
-
>
|
|
4
|
+
/** Attributes for the trigger button. The listbox and its options are the component's own. */
|
|
5
|
+
export type InkZoomSelectProps = Omit<HTMLButtonAttributes, 'value' | 'children'>
|
|
8
6
|
</script>
|
|
9
7
|
|
|
10
8
|
<script lang="ts">
|
|
11
9
|
import { ZOOM_LEVELS, type ZoomValue } from '@inkbar/core/dom'
|
|
10
|
+
import { Check, ChevronDown } from '@inkbar/icons'
|
|
11
|
+
import { Select } from 'bits-ui'
|
|
12
12
|
|
|
13
13
|
import { useZoom } from '../hooks/useZoom.svelte.js'
|
|
14
14
|
|
|
15
|
+
import { asBitsProps } from './child-snippet.js'
|
|
16
|
+
import InkIcon from './InkIcon.svelte'
|
|
17
|
+
|
|
15
18
|
let { class: className, ...rest }: InkZoomSelectProps = $props()
|
|
16
19
|
|
|
17
20
|
const CUSTOM = 'custom:'
|
|
21
|
+
const FITS = [
|
|
22
|
+
{ value: 'fit-width', label: 'Fit width' },
|
|
23
|
+
{ value: 'fit-page', label: 'Fit page' },
|
|
24
|
+
]
|
|
18
25
|
const level = (z: number) => ZOOM_LEVELS.find((l) => Math.abs(l - z) < 0.001)
|
|
26
|
+
const percent = (z: number) => `${Math.round(z * 100)}%`
|
|
19
27
|
|
|
20
28
|
const zoom = useZoom()
|
|
21
29
|
/** A numeric zoom that is not one of the levels (zoom in and out multiply). */
|
|
@@ -29,28 +37,69 @@
|
|
|
29
37
|
? String(level(zoom.zoom))
|
|
30
38
|
: `${CUSTOM}${zoom.zoom}`
|
|
31
39
|
)
|
|
32
|
-
|
|
33
|
-
|
|
40
|
+
/** The levels, with a custom zoom in its place among them. */
|
|
41
|
+
const levels = $derived.by(() => {
|
|
42
|
+
const list = ZOOM_LEVELS.map((l) => ({ z: l, value: String(l), label: percent(l) }))
|
|
43
|
+
if (custom !== null)
|
|
44
|
+
list.push({ z: custom, value: `${CUSTOM}${custom}`, label: percent(zoom.scale) })
|
|
45
|
+
return list.sort((a, b) => a.z - b.z)
|
|
46
|
+
})
|
|
47
|
+
// Every option, for the trigger's label and typeahead: the items mount only while it is open.
|
|
48
|
+
const items = $derived([...FITS, ...levels])
|
|
49
|
+
|
|
50
|
+
function onValueChange(v: string): void {
|
|
51
|
+
if (v === value) return
|
|
34
52
|
const next: ZoomValue =
|
|
35
53
|
v === 'fit-width' || v === 'fit-page' ? v : Number(v.replace(CUSTOM, ''))
|
|
36
54
|
zoom.setZoom(next)
|
|
37
55
|
}
|
|
38
56
|
</script>
|
|
39
57
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
<!-- Bits UI's trigger is a plain button with a listbox popup; the role makes it the
|
|
59
|
+
select-only combobox of the ARIA pattern, as Reka UI and Radix render it. -->
|
|
60
|
+
<Select.Root type="single" {items} bind:value={() => value, onValueChange}>
|
|
61
|
+
<Select.Trigger
|
|
62
|
+
class={['ink-zoom-select', 'ink-select-trigger', className]}
|
|
63
|
+
data-ink-zoom-select=""
|
|
64
|
+
role="combobox"
|
|
65
|
+
aria-label="Zoom"
|
|
66
|
+
{...asBitsProps(rest)}
|
|
67
|
+
>
|
|
68
|
+
<Select.Value class="ink-select-value" />
|
|
69
|
+
<span class="ink-select-icon" aria-hidden="true">
|
|
70
|
+
<InkIcon icon={ChevronDown} size={16} />
|
|
71
|
+
</span>
|
|
72
|
+
</Select.Trigger>
|
|
73
|
+
<Select.Portal>
|
|
74
|
+
<Select.Content
|
|
75
|
+
class="ink-select-content"
|
|
76
|
+
data-ink-select-content=""
|
|
77
|
+
side="top"
|
|
78
|
+
sideOffset={4}
|
|
79
|
+
>
|
|
80
|
+
<Select.Viewport>
|
|
81
|
+
{#each items as o, i (o.value)}
|
|
82
|
+
<!-- The fits, then the levels. -->
|
|
83
|
+
{#if i === FITS.length}
|
|
84
|
+
<div class="ink-select-separator" aria-hidden="true"></div>
|
|
85
|
+
{/if}
|
|
86
|
+
<Select.Item
|
|
87
|
+
value={o.value}
|
|
88
|
+
label={o.label}
|
|
89
|
+
class="ink-select-item"
|
|
90
|
+
data-ink-select-item=""
|
|
91
|
+
>
|
|
92
|
+
{#snippet children({ selected })}
|
|
93
|
+
<span>{o.label}</span>
|
|
94
|
+
{#if selected}
|
|
95
|
+
<span class="ink-select-indicator">
|
|
96
|
+
<InkIcon icon={Check} size={16} />
|
|
97
|
+
</span>
|
|
98
|
+
{/if}
|
|
99
|
+
{/snippet}
|
|
100
|
+
</Select.Item>
|
|
101
|
+
{/each}
|
|
102
|
+
</Select.Viewport>
|
|
103
|
+
</Select.Content>
|
|
104
|
+
</Select.Portal>
|
|
105
|
+
</Select.Root>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
2
|
+
/** Attributes for the trigger button. The listbox and its options are the component's own. */
|
|
3
|
+
export type InkZoomSelectProps = Omit<HTMLButtonAttributes, 'value' | 'children'>;
|
|
3
4
|
declare const InkZoomSelect: import("svelte").Component<InkZoomSelectProps, {}, "">;
|
|
4
5
|
type InkZoomSelect = ReturnType<typeof InkZoomSelect>;
|
|
5
6
|
export default InkZoomSelect;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InkZoomSelect.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/InkZoomSelect.svelte.ts"],"names":[],"mappings":"AAGE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAE3D,MAAM,MAAM,kBAAkB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"InkZoomSelect.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/InkZoomSelect.svelte.ts"],"names":[],"mappings":"AAGE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAE3D,8FAA8F;AAC9F,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,oBAAoB,EAAE,OAAO,GAAG,UAAU,CAAC,CAClF;AAiGD,QAAA,MAAM,aAAa,wDAAwC,CAAC;AAC5D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AACtD,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ChildSnippet } from './child-snippet.js';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
4
|
+
/** Props of `InkUndo` and `InkRedo`: a toolbar button that may render through `child`. */
|
|
5
|
+
export interface InkHistoryButtonProps extends Omit<HTMLButtonAttributes, 'children'> {
|
|
6
|
+
children?: Snippet | undefined;
|
|
7
|
+
/** Render your own button: spread `props` on it. */
|
|
8
|
+
child?: ChildSnippet | undefined;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=history-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history-button.d.ts","sourceRoot":"","sources":["../../src/lib/components/history-button.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAE3D,0FAA0F;AAC1F,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC;IACnF,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC9B,oDAAoD;IACpD,KAAK,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;CACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ChildSnippet } from './child-snippet.js';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
4
|
+
/** Props of `InkPrevPage` and `InkNextPage`: a toolbar button that may render through `child`. */
|
|
5
|
+
export interface InkPageButtonProps extends Omit<HTMLButtonAttributes, 'children'> {
|
|
6
|
+
children?: Snippet | undefined;
|
|
7
|
+
/** Render your own button: spread `props` on it. */
|
|
8
|
+
child?: ChildSnippet | undefined;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=page-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-button.d.ts","sourceRoot":"","sources":["../../src/lib/components/page-button.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAE3D,kGAAkG;AAClG,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC;IAChF,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC9B,oDAAoD;IACpD,KAAK,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;CACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -24,8 +24,15 @@ export { default as InkAnnotation } from './components/InkAnnotation.svelte';
|
|
|
24
24
|
export type { InkAnnotationProps } from './components/InkAnnotation.svelte';
|
|
25
25
|
export { default as InkToolbar } from './components/InkToolbar.svelte';
|
|
26
26
|
export type { InkToolbarProps } from './components/InkToolbar.svelte';
|
|
27
|
+
export { default as InkIcon } from './components/InkIcon.svelte';
|
|
28
|
+
export type { InkIconProps } from './components/InkIcon.svelte';
|
|
27
29
|
export { default as InkToolButton } from './components/InkToolButton.svelte';
|
|
28
30
|
export type { InkToolButtonProps } from './components/InkToolButton.svelte';
|
|
31
|
+
export { default as InkToolbarSeparator } from './components/InkToolbarSeparator.svelte';
|
|
32
|
+
export type { InkToolbarSeparatorProps } from './components/InkToolbarSeparator.svelte';
|
|
33
|
+
export { default as InkUndo } from './components/InkUndo.svelte';
|
|
34
|
+
export { default as InkRedo } from './components/InkRedo.svelte';
|
|
35
|
+
export type { InkHistoryButtonProps } from './components/history-button.js';
|
|
29
36
|
export { default as InkZoomIn } from './components/InkZoomIn.svelte';
|
|
30
37
|
export { default as InkZoomOut } from './components/InkZoomOut.svelte';
|
|
31
38
|
export type { InkZoomButtonProps } from './components/zoom-button.js';
|
|
@@ -35,8 +42,9 @@ export { default as InkPageInput } from './components/InkPageInput.svelte';
|
|
|
35
42
|
export type { InkPageInputProps } from './components/InkPageInput.svelte';
|
|
36
43
|
export { default as InkPageCount } from './components/InkPageCount.svelte';
|
|
37
44
|
export type { InkPageCountProps } from './components/InkPageCount.svelte';
|
|
38
|
-
export { default as
|
|
39
|
-
export
|
|
45
|
+
export { default as InkPrevPage } from './components/InkPrevPage.svelte';
|
|
46
|
+
export { default as InkNextPage } from './components/InkNextPage.svelte';
|
|
47
|
+
export type { InkPageButtonProps } from './components/page-button.js';
|
|
40
48
|
export type { ChildSnippet } from './components/child-snippet.js';
|
|
41
49
|
export { default as InkNotePopover } from './components/InkNotePopover.svelte';
|
|
42
50
|
export type { InkNotePopoverProps } from './components/InkNotePopover.svelte';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,gBAAgB,MAAM,6BAA6B,CAAA;AAE/D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,YAAY,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAC3D,YAAY,EACV,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,kBAAkB,CAAA;AACzB,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAA;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,6BAA6B,CAAA;AAChE,YAAY,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC/D,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAC/D,OAAO,EAAE,OAAO,IAAI,WAAW,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C,CAAA;AACzE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iCAAiC,CAAA;AACxE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iCAAiC,CAAA;AACxE,YAAY,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AACrE,YAAY,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,oCAAoC,CAAA;AAC9E,YAAY,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAA;AAC7E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AACpF,YAAY,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -13,12 +13,17 @@ export { default as InkViewport } from './components/InkViewport.svelte';
|
|
|
13
13
|
export { default as InkPage } from './components/InkPage.svelte';
|
|
14
14
|
export { default as InkAnnotation } from './components/InkAnnotation.svelte';
|
|
15
15
|
export { default as InkToolbar } from './components/InkToolbar.svelte';
|
|
16
|
+
export { default as InkIcon } from './components/InkIcon.svelte';
|
|
16
17
|
export { default as InkToolButton } from './components/InkToolButton.svelte';
|
|
18
|
+
export { default as InkToolbarSeparator } from './components/InkToolbarSeparator.svelte';
|
|
19
|
+
export { default as InkUndo } from './components/InkUndo.svelte';
|
|
20
|
+
export { default as InkRedo } from './components/InkRedo.svelte';
|
|
17
21
|
export { default as InkZoomIn } from './components/InkZoomIn.svelte';
|
|
18
22
|
export { default as InkZoomOut } from './components/InkZoomOut.svelte';
|
|
19
23
|
export { default as InkZoomSelect } from './components/InkZoomSelect.svelte';
|
|
20
24
|
export { default as InkPageInput } from './components/InkPageInput.svelte';
|
|
21
25
|
export { default as InkPageCount } from './components/InkPageCount.svelte';
|
|
22
|
-
export { default as
|
|
26
|
+
export { default as InkPrevPage } from './components/InkPrevPage.svelte';
|
|
27
|
+
export { default as InkNextPage } from './components/InkNextPage.svelte';
|
|
23
28
|
export { default as InkNotePopover } from './components/InkNotePopover.svelte';
|
|
24
29
|
export { default as InkSuggestionCard } from './components/InkSuggestionCard.svelte';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkbar/svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Svelte 5 components and hooks for Inkbar, the browser PDF viewer and editor.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://inkbar.dev",
|
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
"./package.json": "./package.json"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
+
"@inkbar/icons": "^0.2.0",
|
|
29
30
|
"@internationalized/date": "^3.12.4",
|
|
30
|
-
"@lucide/svelte": "^1.56.0",
|
|
31
31
|
"bits-ui": "^2.19.5",
|
|
32
32
|
"esm-env": "^1.2.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@inkbar/core": "^0.
|
|
35
|
+
"@inkbar/core": "^0.2.0",
|
|
36
36
|
"svelte": "^5.46.4"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@inkbar/core": "0.
|
|
39
|
+
"@inkbar/core": "0.2.0",
|
|
40
40
|
"@inkbar/fixtures": "0.0.0",
|
|
41
|
-
"@inkbar/theme": "0.
|
|
41
|
+
"@inkbar/theme": "0.2.0",
|
|
42
42
|
"@sveltejs/package": "^3.0.0",
|
|
43
43
|
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
|
44
44
|
"@vitest/browser-playwright": "^5.0.4",
|
package/dist/class-names.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/class-names.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
<script module lang="ts">
|
|
2
|
-
import type { Snippet } from 'svelte'
|
|
3
|
-
|
|
4
|
-
export interface DefaultToolbarProps {
|
|
5
|
-
label?: string | undefined
|
|
6
|
-
class?: string | undefined
|
|
7
|
-
children?: Snippet | undefined
|
|
8
|
-
}
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<script lang="ts">
|
|
12
|
-
/*
|
|
13
|
-
* The standard toolbar: tools, zoom and page controls with icons. It adds no styles of its
|
|
14
|
-
* own; the theme styles the `data-ink-*` hooks. Extra controls go in `children`.
|
|
15
|
-
*/
|
|
16
|
-
// One module per icon: the package's index evaluates every icon it ships, which costs a
|
|
17
|
-
// server (or a test) that imports this file well over a second. A new icon also goes in the
|
|
18
|
-
// browser tests' `optimizeDeps.include` in vitest.config.ts.
|
|
19
|
-
import Hand from '@lucide/svelte/icons/hand'
|
|
20
|
-
import Highlighter from '@lucide/svelte/icons/highlighter'
|
|
21
|
-
import MessageSquare from '@lucide/svelte/icons/message-square'
|
|
22
|
-
import MousePointer2 from '@lucide/svelte/icons/mouse-pointer-2'
|
|
23
|
-
import Square from '@lucide/svelte/icons/square'
|
|
24
|
-
import ZoomIn from '@lucide/svelte/icons/zoom-in'
|
|
25
|
-
import ZoomOut from '@lucide/svelte/icons/zoom-out'
|
|
26
|
-
|
|
27
|
-
import { cx } from '../class-names.js'
|
|
28
|
-
import InkPageCount from '../components/InkPageCount.svelte'
|
|
29
|
-
import InkPageInput from '../components/InkPageInput.svelte'
|
|
30
|
-
import InkToolbar from '../components/InkToolbar.svelte'
|
|
31
|
-
import InkToolButton from '../components/InkToolButton.svelte'
|
|
32
|
-
import InkZoomIn from '../components/InkZoomIn.svelte'
|
|
33
|
-
import InkZoomOut from '../components/InkZoomOut.svelte'
|
|
34
|
-
import InkZoomSelect from '../components/InkZoomSelect.svelte'
|
|
35
|
-
|
|
36
|
-
let {
|
|
37
|
-
label = 'Document tools',
|
|
38
|
-
class: className,
|
|
39
|
-
children,
|
|
40
|
-
}: DefaultToolbarProps = $props()
|
|
41
|
-
|
|
42
|
-
const ICON = 18
|
|
43
|
-
</script>
|
|
44
|
-
|
|
45
|
-
<InkToolbar
|
|
46
|
-
{label}
|
|
47
|
-
class={cx('ink-default-toolbar', className)}
|
|
48
|
-
data-ink-default-toolbar=""
|
|
49
|
-
>
|
|
50
|
-
<div
|
|
51
|
-
class="ink-toolbar-group"
|
|
52
|
-
data-ink-toolbar-group="tools"
|
|
53
|
-
role="group"
|
|
54
|
-
aria-label="Tools"
|
|
55
|
-
>
|
|
56
|
-
<InkToolButton tool="view"><Hand size={ICON} aria-hidden="true" /></InkToolButton>
|
|
57
|
-
<InkToolButton tool="select"
|
|
58
|
-
><MousePointer2 size={ICON} aria-hidden="true" /></InkToolButton
|
|
59
|
-
>
|
|
60
|
-
<InkToolButton tool="highlight"
|
|
61
|
-
><Highlighter size={ICON} aria-hidden="true" /></InkToolButton
|
|
62
|
-
>
|
|
63
|
-
<InkToolButton tool="redact-area"
|
|
64
|
-
><Square size={ICON} aria-hidden="true" /></InkToolButton
|
|
65
|
-
>
|
|
66
|
-
<InkToolButton tool="note"
|
|
67
|
-
><MessageSquare size={ICON} aria-hidden="true" /></InkToolButton
|
|
68
|
-
>
|
|
69
|
-
</div>
|
|
70
|
-
<div
|
|
71
|
-
class="ink-toolbar-group"
|
|
72
|
-
data-ink-toolbar-group="zoom"
|
|
73
|
-
role="group"
|
|
74
|
-
aria-label="Zoom"
|
|
75
|
-
>
|
|
76
|
-
<InkZoomOut><ZoomOut size={ICON} aria-hidden="true" /></InkZoomOut>
|
|
77
|
-
<InkZoomSelect />
|
|
78
|
-
<InkZoomIn><ZoomIn size={ICON} aria-hidden="true" /></InkZoomIn>
|
|
79
|
-
</div>
|
|
80
|
-
<div
|
|
81
|
-
class="ink-toolbar-group"
|
|
82
|
-
data-ink-toolbar-group="page"
|
|
83
|
-
role="group"
|
|
84
|
-
aria-label="Page"
|
|
85
|
-
>
|
|
86
|
-
<InkPageInput />
|
|
87
|
-
<InkPageCount />
|
|
88
|
-
</div>
|
|
89
|
-
{@render children?.()}
|
|
90
|
-
</InkToolbar>
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
2
|
-
export interface DefaultToolbarProps {
|
|
3
|
-
label?: string | undefined;
|
|
4
|
-
class?: string | undefined;
|
|
5
|
-
children?: Snippet | undefined;
|
|
6
|
-
}
|
|
7
|
-
declare const DefaultToolbar: import("svelte").Component<DefaultToolbarProps, {}, "">;
|
|
8
|
-
type DefaultToolbar = ReturnType<typeof DefaultToolbar>;
|
|
9
|
-
export default DefaultToolbar;
|
|
10
|
-
//# sourceMappingURL=DefaultToolbar.svelte.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultToolbar.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/compositions/DefaultToolbar.svelte.ts"],"names":[],"mappings":"AAGE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAErC,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC/B;AAkFH,QAAA,MAAM,cAAc,yDAAwC,CAAC;AAC7D,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AACxD,eAAe,cAAc,CAAC"}
|