@openremote/or-rive-renderer 1.22.0-snapshot.20260407154359
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 +21 -0
- package/custom-elements-jsx.d.ts +181 -0
- package/custom-elements.json +179 -0
- package/dist/umd/04862882bda5db2f.wasm +0 -0
- package/dist/umd/index.bundle.js +22 -0
- package/dist/umd/index.bundle.js.map +1 -0
- package/dist/umd/index.js +22 -0
- package/dist/umd/index.js.map +1 -0
- package/dist/umd/index.orbundle.js +22 -0
- package/dist/umd/index.orbundle.js.map +1 -0
- package/lib/index.d.ts +46 -0
- package/lib/index.d.ts.map +1 -0
- package/package.json +31 -0
- package/stories/or-rive-renderer.stories.ts +68 -0
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from "lit";
|
|
2
|
+
import { Rive } from "@rive-app/webgl2";
|
|
3
|
+
export declare class OrRiveRenderer extends LitElement {
|
|
4
|
+
static get styles(): import("lit").CSSResult[];
|
|
5
|
+
/**
|
|
6
|
+
* A string representing the URL or path to the public asset .riv file.
|
|
7
|
+
* For more details, refer to Rive Parameters on how to properly use this property.
|
|
8
|
+
*/
|
|
9
|
+
url?: string;
|
|
10
|
+
/**
|
|
11
|
+
* The string representing the artboard you want to display.
|
|
12
|
+
* When not supplied, the default artboard from the .riv file is selected.
|
|
13
|
+
* Docs: https://rive.app/docs/runtimes/web/artboards
|
|
14
|
+
*/
|
|
15
|
+
artboard?: string;
|
|
16
|
+
/**
|
|
17
|
+
* A list of strings (`["My State Machine"]`) you wish to display.
|
|
18
|
+
* Look up the Rive documentation for more info: https://rive.app/docs/runtimes/web/state-machines.
|
|
19
|
+
* By default, the state machine will autoplay.
|
|
20
|
+
*/
|
|
21
|
+
stateMachines?: string[];
|
|
22
|
+
protected _canvas?: HTMLCanvasElement;
|
|
23
|
+
protected _rive?: Rive;
|
|
24
|
+
protected _resizeObserver?: ResizeObserver;
|
|
25
|
+
protected _valueQueue: (() => void)[];
|
|
26
|
+
/**
|
|
27
|
+
* Public function for updating data within the animation using "View Models".
|
|
28
|
+
* For example, if the animation has a state property named "myValue", you can use this function to update the value to "100".
|
|
29
|
+
* Full documentation can be found here: https://rive.app/docs/runtimes/web/data-binding
|
|
30
|
+
* @param name - Name of the state property inside the .riv animation
|
|
31
|
+
* @param value - Value to set. It will auto-detect the object {@link type}.
|
|
32
|
+
* @param type - (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.
|
|
33
|
+
*/
|
|
34
|
+
setValue(name: string, value?: any, type?: string): Promise<void>;
|
|
35
|
+
connectedCallback(): void;
|
|
36
|
+
disconnectedCallback(): void;
|
|
37
|
+
updated(changedProps: PropertyValues): void;
|
|
38
|
+
render(): import("lit").TemplateResult<1>;
|
|
39
|
+
/**
|
|
40
|
+
* Callback function when this web component changes in size.
|
|
41
|
+
* In this case, it is used for calling a Rive JS function to calibrate using the new canvas size.
|
|
42
|
+
* @protected
|
|
43
|
+
*/
|
|
44
|
+
protected _onResize: import("lodash").DebouncedFunc<(entries: ResizeObserverEntry[]) => void>;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,UAAU,EAAE,cAAc,EAAY,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAC,IAAI,EAAmC,MAAM,kBAAkB,CAAC;AASxE,qBACa,cAAe,SAAQ,UAAU;IAE1C,MAAM,KAAK,MAAM,8BAmBhB;IAED;;;OAGG;IAEI,GAAG,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IAEI,QAAQ,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;OAIG;IAEI,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IAGhC,SAAS,CAAC,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAEtC,SAAS,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC;IACvB,SAAS,CAAC,eAAe,CAAC,EAAE,cAAc,CAAC;IAC3C,SAAS,CAAC,WAAW,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,CAAM;IAE3C;;;;;;;OAOG;IACU,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG,EAAE,IAAI,GAAE,MAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IA2B5F,iBAAiB;IAMjB,oBAAoB;IAOpB,OAAO,CAAC,YAAY,EAAE,cAAc;IAyBpC,MAAM;IAMN;;;;OAIG;IACH,SAAS,CAAC,SAAS,2CAAsB,mBAAmB,EAAE,WAMtD;CAEX"}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openremote/or-rive-renderer",
|
|
3
|
+
"version": "1.22.0-snapshot.20260407154359",
|
|
4
|
+
"description": "A web component for displaying Rive animations using WebGL",
|
|
5
|
+
"customElements": "custom-elements.json",
|
|
6
|
+
"main": "dist/umd/index.bundle.js",
|
|
7
|
+
"module": "lib/index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./lib/index.js",
|
|
10
|
+
"./*": "./lib/*.js"
|
|
11
|
+
},
|
|
12
|
+
"types": "lib/index.d.ts",
|
|
13
|
+
"scripts": {
|
|
14
|
+
"clean": "npx tsc -b --clean && npx shx rm -rf dist lib",
|
|
15
|
+
"analyze": "npx cem analyze --config ../custom-elements-manifest.config.mjs",
|
|
16
|
+
"build": "npx tsc -b",
|
|
17
|
+
"test": "npx tsc -b && npx playwright test",
|
|
18
|
+
"prepack": "npx rspack"
|
|
19
|
+
},
|
|
20
|
+
"author": "OpenRemote",
|
|
21
|
+
"repository": "https://github.com/openremote/openremote",
|
|
22
|
+
"license": "AGPL-3.0-or-later",
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@rive-app/webgl2": "^2.35.4",
|
|
25
|
+
"lit": "^3.3.1",
|
|
26
|
+
"lodash.debounce": "^4.0.8"
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, OpenRemote Inc.
|
|
3
|
+
*
|
|
4
|
+
* See the CONTRIBUTORS.txt file in the distribution for a
|
|
5
|
+
* full listing of individual contributors.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Affero General Public License as
|
|
9
|
+
* published by the Free Software Foundation, either version 3 of the
|
|
10
|
+
* License, or (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Affero General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
18
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
import {setCustomElementsManifest, type Meta, type StoryObj} from "@storybook/web-components";
|
|
21
|
+
import {getORStorybookHelpers} from "../../storybook-utils.js";
|
|
22
|
+
import customElements from "../custom-elements.json" with {type: "json"};
|
|
23
|
+
import packageJson from "../package.json" with {type: "json"};
|
|
24
|
+
import "../src/index";
|
|
25
|
+
import { html } from "lit";
|
|
26
|
+
|
|
27
|
+
const tagName = "or-rive-renderer";
|
|
28
|
+
type Story = StoryObj;
|
|
29
|
+
setCustomElementsManifest(customElements);
|
|
30
|
+
|
|
31
|
+
const { events, args, argTypes, template } = getORStorybookHelpers(tagName);
|
|
32
|
+
|
|
33
|
+
const meta: Meta = {
|
|
34
|
+
title: "Playground/or-rive-renderer",
|
|
35
|
+
component: tagName,
|
|
36
|
+
args: args,
|
|
37
|
+
argTypes: argTypes,
|
|
38
|
+
render: storyArgs => template(storyArgs),
|
|
39
|
+
excludeStories: /^[a-z].*/,
|
|
40
|
+
parameters: {
|
|
41
|
+
actions: {
|
|
42
|
+
handles: events
|
|
43
|
+
},
|
|
44
|
+
docs: {
|
|
45
|
+
subtitle: `<${tagName}>`,
|
|
46
|
+
description: "A Web Component for displaying `.riv` files from the [Rive](https://rive.app) ecosystem.",
|
|
47
|
+
story: {
|
|
48
|
+
height: "370px"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const Primary: Story = {
|
|
55
|
+
render: args => html`
|
|
56
|
+
<style>or-rive-renderer { height: 256px; }</style>
|
|
57
|
+
${template(args)}
|
|
58
|
+
`,
|
|
59
|
+
args: {
|
|
60
|
+
url: "https://cdn.rive.app/animations/vehicles.riv"
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const examples: Story[] = [];
|
|
65
|
+
|
|
66
|
+
export { customElements, packageJson };
|
|
67
|
+
|
|
68
|
+
export default meta;
|