@kiosko/sdk 0.2.3 → 0.2.5

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/dist/plugin.d.ts CHANGED
@@ -30,6 +30,21 @@ export type { Canvas, Image };
30
30
  export interface CanvasApi {
31
31
  createCanvas: typeof createCanvas;
32
32
  loadImage: typeof loadImage;
33
+ /**
34
+ * Loads an image already shrunk to the size it will be shown at: decoded,
35
+ * scaled and prepared in another thread, so neither this nor the first
36
+ * paint of it holds the panels up. A press photo of 14 megapixels shown
37
+ * in a 600×462 tile cost up to 130 ms in that first paint; shrunk, a few.
38
+ * Never enlarges. `cover`: at least `width` × `height` (it will be
39
+ * cropped); `contain`: at most that (it will be shown whole).
40
+ * Kiosko 0.2.5 and later: check that it's there and fall back to
41
+ * `loadImage` otherwise. Not in the browser demo.
42
+ */
43
+ loadImageScaled?: (src: string | Buffer | Uint8Array, size: {
44
+ width: number;
45
+ height: number;
46
+ fit?: 'cover' | 'contain';
47
+ }) => Promise<Image>;
33
48
  }
34
49
  /** A rectangle in panel pixels. */
35
50
  export interface Box {
@@ -423,7 +438,7 @@ export interface InterludeDefinition<OF extends ObjectField<any> = ObjectField<a
423
438
  * package.json, `"kiosko": { "sdk": "^0.2.0" }`, so it can be refused before
424
439
  * it runs); the registry compares them with `satisfies`.
425
440
  */
426
- export declare const SDK_VERSION = "0.2.3";
441
+ export declare const SDK_VERSION = "0.2.5";
427
442
  /**
428
443
  * What a plugin does on the machine, declared for the person who installs
429
444
  * it: the Plugins page and the plugin store show it next to the plugin. It
package/dist/plugin.js CHANGED
@@ -15,7 +15,7 @@ export const CATEGORIES = [
15
15
  * package.json, `"kiosko": { "sdk": "^0.2.0" }`, so it can be refused before
16
16
  * it runs); the registry compares them with `satisfies`.
17
17
  */
18
- export const SDK_VERSION = '0.2.3';
18
+ export const SDK_VERSION = '0.2.5';
19
19
  /* Identity helpers: they only exist so TypeScript infers option and data types. */
20
20
  export function defineWidget(w) {
21
21
  return w;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiosko/sdk",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Plugin SDK for Kiosko: define widgets, data sources and interludes for small always-on LCD panels.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/plugin.ts CHANGED
@@ -32,6 +32,17 @@ export type { Canvas, Image };
32
32
  export interface CanvasApi {
33
33
  createCanvas: typeof createCanvas;
34
34
  loadImage: typeof loadImage;
35
+ /**
36
+ * Loads an image already shrunk to the size it will be shown at: decoded,
37
+ * scaled and prepared in another thread, so neither this nor the first
38
+ * paint of it holds the panels up. A press photo of 14 megapixels shown
39
+ * in a 600×462 tile cost up to 130 ms in that first paint; shrunk, a few.
40
+ * Never enlarges. `cover`: at least `width` × `height` (it will be
41
+ * cropped); `contain`: at most that (it will be shown whole).
42
+ * Kiosko 0.2.5 and later: check that it's there and fall back to
43
+ * `loadImage` otherwise. Not in the browser demo.
44
+ */
45
+ loadImageScaled?: (src: string | Buffer | Uint8Array, size: { width: number; height: number; fit?: 'cover' | 'contain' }) => Promise<Image>;
35
46
  }
36
47
 
37
48
  /** A rectangle in panel pixels. */
@@ -419,7 +430,7 @@ export interface InterludeDefinition<OF extends ObjectField<any> = ObjectField<a
419
430
  * package.json, `"kiosko": { "sdk": "^0.2.0" }`, so it can be refused before
420
431
  * it runs); the registry compares them with `satisfies`.
421
432
  */
422
- export const SDK_VERSION = '0.2.3';
433
+ export const SDK_VERSION = '0.2.5';
423
434
 
424
435
  /**
425
436
  * What a plugin does on the machine, declared for the person who installs