@inkbar/svelte 0.10.0 → 0.11.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.
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
gap?: number
|
|
15
15
|
/** Pages kept mounted either side of the visible ones. */
|
|
16
16
|
buffer?: number
|
|
17
|
+
/** Pinch to zoom the pages. Off leaves the browser's own touch handling alone. */
|
|
18
|
+
pinchZoom?: boolean
|
|
17
19
|
loading?: Snippet | undefined
|
|
18
20
|
empty?: Snippet | undefined
|
|
19
21
|
error?: Snippet<[{ error: InkError }]> | undefined
|
|
@@ -63,6 +65,7 @@
|
|
|
63
65
|
rotation = 0,
|
|
64
66
|
gap = 16,
|
|
65
67
|
buffer = 2,
|
|
68
|
+
pinchZoom = true,
|
|
66
69
|
loading,
|
|
67
70
|
empty,
|
|
68
71
|
error,
|
|
@@ -100,7 +103,12 @@
|
|
|
100
103
|
*/
|
|
101
104
|
let build = 0
|
|
102
105
|
/** The construction options the engine was last built with, so a rebuild runs only on a change. */
|
|
103
|
-
let builtWith: {
|
|
106
|
+
let builtWith: {
|
|
107
|
+
gap: number
|
|
108
|
+
buffer: number
|
|
109
|
+
pinchZoom: boolean
|
|
110
|
+
custom: boolean
|
|
111
|
+
} | null = null
|
|
104
112
|
let stops: (() => void)[] = []
|
|
105
113
|
/** The zoom and page last reported to the host. */
|
|
106
114
|
let lastReportedZoom: ZoomValue | undefined
|
|
@@ -135,7 +143,7 @@
|
|
|
135
143
|
let first = true
|
|
136
144
|
build += 1
|
|
137
145
|
const custom = !!annotation
|
|
138
|
-
builtWith = { gap, buffer, custom }
|
|
146
|
+
builtWith = { gap, buffer, pinchZoom, custom }
|
|
139
147
|
// The tools this viewer registers, from the same inputs; a later `tools` waits for a rebuild.
|
|
140
148
|
ctx.setOpenedToolIds(toolIdsOf(ctx.hostTools, ctx.pluginHost))
|
|
141
149
|
engine = mountViewer({
|
|
@@ -147,6 +155,7 @@
|
|
|
147
155
|
rotation,
|
|
148
156
|
gap,
|
|
149
157
|
buffer,
|
|
158
|
+
pinchZoom,
|
|
150
159
|
tool: ctx.tool,
|
|
151
160
|
...(ctx.hostTools ? { tools: ctx.hostTools } : {}),
|
|
152
161
|
// The engine adds the plugins' tools and layers, and decorates through the host, which
|
|
@@ -253,7 +262,7 @@
|
|
|
253
262
|
|
|
254
263
|
// Construction-only options rebuild the engine for the same document, keeping zoom and page.
|
|
255
264
|
// The deriveds notify only on a real change: a host that spreads its props invalidates `gap`
|
|
256
|
-
// and `buffer` without changing them. One effect for all
|
|
265
|
+
// and `buffer` without changing them. One effect for all of them, so a gap and a snippet change
|
|
257
266
|
// in the same tick rebuild once. It skips its first run (and any run after a build that
|
|
258
267
|
// already used these values) by comparing with `builtWith`.
|
|
259
268
|
//
|
|
@@ -264,15 +273,22 @@
|
|
|
264
273
|
// `pages` for the new build's pages. The rebuild keeps the scroll position.
|
|
265
274
|
const buildGap = $derived(gap)
|
|
266
275
|
const buildBuffer = $derived(buffer)
|
|
276
|
+
const buildPinchZoom = $derived(pinchZoom)
|
|
267
277
|
const buildCustom = $derived(!!annotation)
|
|
268
278
|
$effect(() => {
|
|
269
|
-
const next = {
|
|
279
|
+
const next = {
|
|
280
|
+
gap: buildGap,
|
|
281
|
+
buffer: buildBuffer,
|
|
282
|
+
pinchZoom: buildPinchZoom,
|
|
283
|
+
custom: buildCustom,
|
|
284
|
+
}
|
|
270
285
|
untrack(() => {
|
|
271
286
|
const built = builtWith
|
|
272
287
|
if (!engine || !built) return
|
|
273
288
|
if (
|
|
274
289
|
built.gap === next.gap &&
|
|
275
290
|
built.buffer === next.buffer &&
|
|
291
|
+
built.pinchZoom === next.pinchZoom &&
|
|
276
292
|
built.custom === next.custom
|
|
277
293
|
)
|
|
278
294
|
return
|
|
@@ -281,6 +297,7 @@
|
|
|
281
297
|
engine.rebuild({
|
|
282
298
|
gap: next.gap,
|
|
283
299
|
buffer: next.buffer,
|
|
300
|
+
pinchZoom: next.pinchZoom,
|
|
284
301
|
customAnnotations: next.custom,
|
|
285
302
|
})
|
|
286
303
|
})
|
|
@@ -9,6 +9,8 @@ export interface InkViewportProps extends Omit<HTMLAttributes<HTMLDivElement>, '
|
|
|
9
9
|
gap?: number;
|
|
10
10
|
/** Pages kept mounted either side of the visible ones. */
|
|
11
11
|
buffer?: number;
|
|
12
|
+
/** Pinch to zoom the pages. Off leaves the browser's own touch handling alone. */
|
|
13
|
+
pinchZoom?: boolean;
|
|
12
14
|
loading?: Snippet | undefined;
|
|
13
15
|
empty?: Snippet | undefined;
|
|
14
16
|
error?: Snippet<[{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InkViewport.svelte.d.ts","sourceRoot":"","sources":["../../src/lib/components/InkViewport.svelte.ts"],"names":[],"mappings":"AAGE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACrF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAErD,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAC5C,cAAc,CAAC,cAAc,CAAC,EAC9B,UAAU,CACX;IACC,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,QAAQ,CAAC,EAAE,YAAY,CAAA;IACvB,iCAAiC;IACjC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC7B,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;QAAE,KAAK,EAAE,QAAQ,CAAA;KAAE,CAAC,CAAC,GAAG,SAAS,CAAA;IAClD,UA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AC,CAAC;QAAE,KAAK,EAAE,QAAQ,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,GAAG,SAAS,CAAA;CACrE;AA0XH,QAAA,MAAM,WAAW,sDAAwC,CAAC;AAC1D,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAClD,eAAe,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkbar/svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.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.
|
|
29
|
+
"@inkbar/icons": "^0.11.0",
|
|
30
30
|
"@internationalized/date": "^3.12.4",
|
|
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.11.0",
|
|
36
36
|
"svelte": "^5.46.4"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@inkbar/core": "0.
|
|
39
|
+
"@inkbar/core": "0.11.0",
|
|
40
40
|
"@inkbar/fixtures": "0.0.0",
|
|
41
|
-
"@inkbar/theme": "0.
|
|
41
|
+
"@inkbar/theme": "0.11.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",
|