@openremote/or-rive-renderer 1.14.0-snapshot

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 ADDED
@@ -0,0 +1,21 @@
1
+ # @openremote/or-rive-renderer
2
+ [![NPM Version][npm-image]][npm-url]
3
+
4
+ Package containing a Web Component, built with [Lit](https://lit.dev), for displaying `.riv` files from the [Rive](https://rive.app) ecosystem.
5
+
6
+ ## Install
7
+ ```bash
8
+ npm i @openremote/or-rive-renderer
9
+ yarn add @openremote/or-rive-renderer
10
+ ```
11
+
12
+ ## Example usage
13
+ ```html
14
+ <or-rive-renderer url="animations/my-animation.riv"></or-rive-renderer>
15
+ ```
16
+
17
+ ## License
18
+ [GNU AGPL](https://www.gnu.org/licenses/agpl-3.0.en.html)
19
+
20
+ [npm-image]: https://img.shields.io/npm/v/@openremote/or-rive-renderer.svg
21
+ [npm-url]: https://npmjs.org/package/@openremote/or-rive-renderer
@@ -0,0 +1,229 @@
1
+ import type { OrRiveRenderer } from "./lib/index.d.ts";
2
+
3
+ /**
4
+ * This type can be used to create scoped tags for your components.
5
+ *
6
+ * Usage:
7
+ *
8
+ * ```ts
9
+ * import type { ScopedElements } from "path/to/library/jsx-integration";
10
+ *
11
+ * declare module "my-library" {
12
+ * namespace JSX {
13
+ * interface IntrinsicElements
14
+ * extends ScopedElements<'test-', ''> {}
15
+ * }
16
+ * }
17
+ * ```
18
+ *
19
+ * @deprecated Runtime scoped elements result in duplicate types and can confusing for developers. It is recommended to use the `prefix` and `suffix` options to generate new types instead.
20
+ */
21
+ export type ScopedElements<
22
+ Prefix extends string = "",
23
+ Suffix extends string = ""
24
+ > = {
25
+ [Key in keyof CustomElements as `${Prefix}${Key}${Suffix}`]: CustomElements[Key];
26
+ };
27
+
28
+ type BaseProps<T extends HTMLElement> = {
29
+ /** Content added between the opening and closing tags of the element */
30
+ children?: any;
31
+ /** Used for declaratively styling one or more elements using CSS (Cascading Stylesheets) */
32
+ class?: string;
33
+ /** Used for declaratively styling one or more elements using CSS (Cascading Stylesheets) */
34
+ className?: string;
35
+ /** Takes an object where the key is the class name(s) and the value is a boolean expression. When true, the class is applied, and when false, it is removed. */
36
+ classList?: Record<string, boolean | undefined>;
37
+ /** Specifies the text direction of the element. */
38
+ dir?: "ltr" | "rtl";
39
+ /** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
40
+ exportparts?: string;
41
+ /** For <label> and <output>, lets you associate the label with some control. */
42
+ htmlFor?: string;
43
+ /** Specifies whether the element should be hidden. */
44
+ hidden?: boolean | string;
45
+ /** A unique identifier for the element. */
46
+ id?: string;
47
+ /** Keys tell React which array item each component corresponds to */
48
+ key?: string | number;
49
+ /** Specifies the language of the element. */
50
+ lang?: string;
51
+ /** Defines the element's semantic role for accessibility APIs. */
52
+ role?: string;
53
+ /** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */
54
+ part?: string;
55
+ /** Use the ref attribute with a variable to assign a DOM element to the variable once the element is rendered. */
56
+ ref?: T | ((e: T) => void);
57
+ /** Adds a reference for a custom element slot */
58
+ slot?: string;
59
+ /** Prop for setting inline styles */
60
+ style?: Record<string, string | number>;
61
+ /** Overrides the default Tab button behavior. Avoid using values other than -1 and 0. */
62
+ tabIndex?: number;
63
+ /** Specifies the tooltip text for the element. */
64
+ title?: string;
65
+ /** Passing 'no' excludes the element content from being translated. */
66
+ translate?: "yes" | "no";
67
+ /** The popover global attribute is used to designate an element as a popover element. */
68
+ popover?: "auto" | "hint" | "manual";
69
+ /** Turns an element element into a popover control button; takes the ID of the popover element to control as its value. */
70
+ popovertarget?: "top" | "bottom" | "left" | "right" | "auto";
71
+ /** Specifies the action to be performed on a popover element being controlled by a control element. */
72
+ popovertargetaction?: "show" | "hide" | "toggle";
73
+ };
74
+
75
+ type BaseEvents = {};
76
+
77
+ export type OrRiveRendererProps = {
78
+ /** A string representing the URL or path to the public asset .riv file.
79
+ For more details, refer to Rive Parameters on how to properly use this property. */
80
+ url?: OrRiveRenderer["url"];
81
+ /** The string representing the artboard you want to display.
82
+ When not supplied, the default artboard from the .riv file is selected.
83
+ Docs: https://rive.app/docs/runtimes/web/artboards */
84
+ artboard?: OrRiveRenderer["artboard"];
85
+ /** A list of strings (`["My State Machine"]`) you wish to display.
86
+ Look up the Rive documentation for more info: https://rive.app/docs/runtimes/web/state-machines.
87
+ By default, the state machine will autoplay. */
88
+ stateMachines?: OrRiveRenderer["stateMachines"];
89
+ };
90
+
91
+ export type OrRiveRendererSolidJsProps = {
92
+ /** A string representing the URL or path to the public asset .riv file.
93
+ For more details, refer to Rive Parameters on how to properly use this property. */
94
+ "prop:url"?: OrRiveRenderer["url"];
95
+ /** The string representing the artboard you want to display.
96
+ When not supplied, the default artboard from the .riv file is selected.
97
+ Docs: https://rive.app/docs/runtimes/web/artboards */
98
+ "prop:artboard"?: OrRiveRenderer["artboard"];
99
+ /** A list of strings (`["My State Machine"]`) you wish to display.
100
+ Look up the Rive documentation for more info: https://rive.app/docs/runtimes/web/state-machines.
101
+ By default, the state machine will autoplay. */
102
+ "prop:stateMachines"?: OrRiveRenderer["stateMachines"];
103
+
104
+ /** Set the innerHTML of the element */
105
+ innerHTML?: string;
106
+ /** Set the textContent of the element */
107
+ textContent?: string | number;
108
+ };
109
+
110
+ export type CustomElements = {
111
+ /**
112
+ *
113
+ *
114
+ * ## Attributes & Properties
115
+ *
116
+ * Component attributes and properties that can be applied to the element or by using JavaScript.
117
+ *
118
+ * - `url`: A string representing the URL or path to the public asset .riv file.
119
+ * For more details, refer to Rive Parameters on how to properly use this property.
120
+ * - `artboard`: The string representing the artboard you want to display.
121
+ * When not supplied, the default artboard from the .riv file is selected.
122
+ * Docs: https://rive.app/docs/runtimes/web/artboards
123
+ * - `stateMachines`: A list of strings (`["My State Machine"]`) you wish to display.
124
+ * Look up the Rive documentation for more info: https://rive.app/docs/runtimes/web/state-machines.
125
+ * By default, the state machine will autoplay.
126
+ *
127
+ * ## Methods
128
+ *
129
+ * Methods that can be called to access component functionality.
130
+ *
131
+ * - `setValue(name: string, value?: any, type: string = typeof value) => Promise<void>`: Public function for updating data within the animation using "View Models".
132
+ * For example, if the animation has a state property named "myValue", you can use this function to update the value to "100".
133
+ * Full documentation can be found here: https://rive.app/docs/runtimes/web/data-binding
134
+ */
135
+ "or-rive-renderer": Partial<
136
+ OrRiveRendererProps & BaseProps<OrRiveRenderer> & BaseEvents
137
+ >;
138
+ };
139
+
140
+ export type CustomElementsSolidJs = {
141
+ /**
142
+ *
143
+ *
144
+ * ## Attributes & Properties
145
+ *
146
+ * Component attributes and properties that can be applied to the element or by using JavaScript.
147
+ *
148
+ * - `url`: A string representing the URL or path to the public asset .riv file.
149
+ * For more details, refer to Rive Parameters on how to properly use this property.
150
+ * - `artboard`: The string representing the artboard you want to display.
151
+ * When not supplied, the default artboard from the .riv file is selected.
152
+ * Docs: https://rive.app/docs/runtimes/web/artboards
153
+ * - `stateMachines`: A list of strings (`["My State Machine"]`) you wish to display.
154
+ * Look up the Rive documentation for more info: https://rive.app/docs/runtimes/web/state-machines.
155
+ * By default, the state machine will autoplay.
156
+ *
157
+ * ## Methods
158
+ *
159
+ * Methods that can be called to access component functionality.
160
+ *
161
+ * - `setValue(name: string, value?: any, type: string = typeof value) => Promise<void>`: Public function for updating data within the animation using "View Models".
162
+ * For example, if the animation has a state property named "myValue", you can use this function to update the value to "100".
163
+ * Full documentation can be found here: https://rive.app/docs/runtimes/web/data-binding
164
+ */
165
+ "or-rive-renderer": Partial<
166
+ OrRiveRendererProps &
167
+ OrRiveRendererSolidJsProps &
168
+ BaseProps<OrRiveRenderer> &
169
+ BaseEvents
170
+ >;
171
+ };
172
+
173
+ export type CustomCssProperties = {};
174
+
175
+ declare module "react" {
176
+ namespace JSX {
177
+ interface IntrinsicElements extends CustomElements {}
178
+ }
179
+ export interface CSSProperties extends CustomCssProperties {}
180
+ }
181
+
182
+ declare module "preact" {
183
+ namespace JSX {
184
+ interface IntrinsicElements extends CustomElements {}
185
+ }
186
+ export interface CSSProperties extends CustomCssProperties {}
187
+ }
188
+
189
+ declare module "@builder.io/qwik" {
190
+ namespace JSX {
191
+ interface IntrinsicElements extends CustomElements {}
192
+ }
193
+ export interface CSSProperties extends CustomCssProperties {}
194
+ }
195
+
196
+ declare module "@stencil/core" {
197
+ namespace JSX {
198
+ interface IntrinsicElements extends CustomElements {}
199
+ }
200
+ export interface CSSProperties extends CustomCssProperties {}
201
+ }
202
+
203
+ declare module "hono/jsx" {
204
+ namespace JSX {
205
+ interface IntrinsicElements extends CustomElements {}
206
+ }
207
+ export interface CSSProperties extends CustomCssProperties {}
208
+ }
209
+
210
+ declare module "react-native" {
211
+ namespace JSX {
212
+ interface IntrinsicElements extends CustomElements {}
213
+ }
214
+ export interface CSSProperties extends CustomCssProperties {}
215
+ }
216
+
217
+ declare module "solid-js" {
218
+ namespace JSX {
219
+ interface IntrinsicElements extends CustomElementsSolidJs {}
220
+ }
221
+ export interface CSSProperties extends CustomCssProperties {}
222
+ }
223
+
224
+ declare global {
225
+ namespace JSX {
226
+ interface IntrinsicElements extends CustomElements {}
227
+ }
228
+ export interface CSSProperties extends CustomCssProperties {}
229
+ }
@@ -0,0 +1,179 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/index.ts",
8
+ "declarations": [
9
+ {
10
+ "kind": "class",
11
+ "description": "",
12
+ "name": "OrRiveRenderer",
13
+ "members": [
14
+ {
15
+ "kind": "field",
16
+ "name": "url",
17
+ "type": {
18
+ "text": "string | undefined"
19
+ },
20
+ "privacy": "public",
21
+ "description": "A string representing the URL or path to the public asset .riv file.\nFor more details, refer to Rive Parameters on how to properly use this property.",
22
+ "attribute": "url"
23
+ },
24
+ {
25
+ "kind": "field",
26
+ "name": "artboard",
27
+ "type": {
28
+ "text": "string | undefined"
29
+ },
30
+ "privacy": "public",
31
+ "description": "The string representing the artboard you want to display.\nWhen not supplied, the default artboard from the .riv file is selected.\nDocs: https://rive.app/docs/runtimes/web/artboards",
32
+ "attribute": "artboard"
33
+ },
34
+ {
35
+ "kind": "field",
36
+ "name": "stateMachines",
37
+ "type": {
38
+ "text": "string[] | undefined"
39
+ },
40
+ "privacy": "public",
41
+ "description": "A list of strings (`[\"My State Machine\"]`) you wish to display.\nLook up the Rive documentation for more info: https://rive.app/docs/runtimes/web/state-machines.\nBy default, the state machine will autoplay.",
42
+ "attribute": "stateMachines"
43
+ },
44
+ {
45
+ "kind": "field",
46
+ "name": "_canvas",
47
+ "type": {
48
+ "text": "HTMLCanvasElement | undefined"
49
+ },
50
+ "privacy": "protected"
51
+ },
52
+ {
53
+ "kind": "field",
54
+ "name": "_rive",
55
+ "type": {
56
+ "text": "Rive | undefined"
57
+ },
58
+ "privacy": "protected"
59
+ },
60
+ {
61
+ "kind": "field",
62
+ "name": "_resizeObserver",
63
+ "type": {
64
+ "text": "ResizeObserver | undefined"
65
+ },
66
+ "privacy": "protected"
67
+ },
68
+ {
69
+ "kind": "field",
70
+ "name": "_valueQueue",
71
+ "type": {
72
+ "text": "(() => void)[]"
73
+ },
74
+ "privacy": "protected",
75
+ "default": "[]"
76
+ },
77
+ {
78
+ "kind": "method",
79
+ "name": "setValue",
80
+ "privacy": "public",
81
+ "return": {
82
+ "type": {
83
+ "text": "Promise<void>"
84
+ }
85
+ },
86
+ "parameters": [
87
+ {
88
+ "name": "name",
89
+ "type": {
90
+ "text": "string"
91
+ },
92
+ "description": "Name of the state property inside the .riv animation"
93
+ },
94
+ {
95
+ "name": "value",
96
+ "optional": true,
97
+ "type": {
98
+ "text": "any"
99
+ },
100
+ "description": "Value to set. It will auto-detect the object {@link type}.\n * "
101
+ },
102
+ {
103
+ "name": "type",
104
+ "default": "typeof value",
105
+ "type": {
106
+ "text": "string"
107
+ },
108
+ "description": "(optional) the value type to set. Currently, the supported types are: string, boolean, number, color and enum. Everything else will be converted to a trigger."
109
+ }
110
+ ],
111
+ "description": "Public function for updating data within the animation using \"View Models\".\nFor example, if the animation has a state property named \"myValue\", you can use this function to update the value to \"100\".\nFull documentation can be found here: https://rive.app/docs/runtimes/web/data-binding",
112
+ "type": {
113
+ "text": "setValue(name: string, value?: any, type: string = typeof value) => Promise<void>"
114
+ }
115
+ },
116
+ {
117
+ "kind": "field",
118
+ "name": "_onResize",
119
+ "privacy": "protected",
120
+ "description": "Callback function when this web component changes in size.\nIn this case, it is used for calling a Rive JS function to calibrate using the new canvas size."
121
+ }
122
+ ],
123
+ "attributes": [
124
+ {
125
+ "name": "url",
126
+ "type": {
127
+ "text": "string | undefined"
128
+ },
129
+ "description": "A string representing the URL or path to the public asset .riv file.\nFor more details, refer to Rive Parameters on how to properly use this property.",
130
+ "fieldName": "url"
131
+ },
132
+ {
133
+ "name": "artboard",
134
+ "type": {
135
+ "text": "string | undefined"
136
+ },
137
+ "description": "The string representing the artboard you want to display.\nWhen not supplied, the default artboard from the .riv file is selected.\nDocs: https://rive.app/docs/runtimes/web/artboards",
138
+ "fieldName": "artboard"
139
+ },
140
+ {
141
+ "name": "stateMachines",
142
+ "type": {
143
+ "text": "string[] | undefined"
144
+ },
145
+ "description": "A list of strings (`[\"My State Machine\"]`) you wish to display.\nLook up the Rive documentation for more info: https://rive.app/docs/runtimes/web/state-machines.\nBy default, the state machine will autoplay.",
146
+ "fieldName": "stateMachines"
147
+ }
148
+ ],
149
+ "superclass": {
150
+ "name": "LitElement",
151
+ "package": "lit"
152
+ },
153
+ "tagName": "or-rive-renderer",
154
+ "customElement": true,
155
+ "modulePath": "src/index.ts",
156
+ "definitionPath": "src/index.ts"
157
+ }
158
+ ],
159
+ "exports": [
160
+ {
161
+ "kind": "js",
162
+ "name": "OrRiveRenderer",
163
+ "declaration": {
164
+ "name": "OrRiveRenderer",
165
+ "module": "src/index.ts"
166
+ }
167
+ },
168
+ {
169
+ "kind": "custom-element-definition",
170
+ "name": "or-rive-renderer",
171
+ "declaration": {
172
+ "name": "OrRiveRenderer",
173
+ "module": "src/index.ts"
174
+ }
175
+ }
176
+ ]
177
+ }
178
+ ]
179
+ }
Binary file