wff-web 0.1.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/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2024-2026 Patrick Auld
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,29 @@
1
+ interface RenderOptions {
2
+ xml: string;
3
+ assets?: Map<string, ArrayBuffer>;
4
+ width?: number;
5
+ height?: number;
6
+ time?: Date;
7
+ ambient?: boolean;
8
+ configuration?: Record<string, string | number | boolean>;
9
+ /** If true, start a requestAnimationFrame loop and re-render each frame. */
10
+ animate?: boolean;
11
+ }
12
+ interface RenderResult {
13
+ metadata: Map<string, string>;
14
+ /** Stop the animation loop (only present when animate=true). */
15
+ stop?: () => void;
16
+ }
17
+ /**
18
+ * Render a WFF v4 watch face XML onto a canvas element.
19
+ *
20
+ * If options.animate is true, starts a requestAnimationFrame loop and
21
+ * re-renders each frame with updated time and elapsed milliseconds.
22
+ * Returns a stop() function in the result to cancel the loop.
23
+ *
24
+ * For static (snapshot) renders, elapsedMs = 0 so all animations are at
25
+ * their start state.
26
+ */
27
+ declare function renderWatchFace(canvas: HTMLCanvasElement, options: RenderOptions): Promise<RenderResult>;
28
+
29
+ export { type RenderOptions, type RenderResult, renderWatchFace };