open-index/open-npm huggingface dataset:
npm package: @kitware/trame-iframe
Description: This library aims to simplify interaction between a trame application living inside an iframe and its iframe parent.   This work is inspired by the [official trame-client js lib](https://github.com/Kitware/trame-client/tree/master/js-lib)
Latest version: 1.1.1

# Trame iframe library for plain JS
This library aims to simplify interaction between a trame application living inside an iframe and its iframe parent.  
This work is inspired by the [official trame-client js lib](https://github.com/Kitware/trame-client/tree/master/js-lib)

## Examples
- [Vite](./examples/vite/)

## Usage
First you need to grab the iframe that contains your trame application.
```js
import ClientCommunicator from "@kitware/trame-iframe";

const iframe = document.getElementById("trame_app");
const iframe_url = "http://localhost:3000";

const trame = new ClientCommunicator(iframe, iframe_url);

// set
trame.state.set("a", 2);
trame.state.set('b', 3);
trame.state.update({
    a: 2.5,
    b: 3.5,
    c: 4.5,
})

// get
console.log(trame.state.get("c"));
console.log(trame.state.get('a'));


// simple api for state change
trame.state.watch(
    ["a", "b", "c"], 
    (a, b, c) => {
        console.log(`a(${a}) or b(${b}) or c(${c}) have changed`);
    }
);

// -----------------------------------
// Method execution API
// -----------------------------------

// method execution on Python side
trame.trigger("name", ['arg_0', 'arg_1'], { kwarg_0: 1,  kwarg_1: 2 });
```
npm package: @kitware/trame-react
Description: React wrapper to trame-iframe
Author: Kitware
Latest version: 1.2.1

# React/trame application 

Requires a paraview 5.10+

## Virtual environment

```sh
virtualenv .venv
source .venv/bin/activate
pip install -r trame-app/requirements.txt
```

## trame application

### Run trame-app
```sh
cd trame-app
path/to/pvpython ./app.py --port 8080 --server --venv absolute/path/to/.venv
```

## React Application

### Setup
In an other terminal:

```sh
npm install
```

### Apps communication
Before launching the streamlit app, please modify
.venv/lib/python3.9/site-packages/trame_iframe/module/serve/trame-iframe.umd.js file:

Change in "Communicator" section:

```sh
window.postMessage(e,"*");
```

by

```sh
window.top.postMessage(e,"*");
```

Open localhost:8081 on your web browser
npm package: @kitware/trame-vtklocal
Description: This project is just providing the infrastructure to bundle the pure JavaScript library for trame-vtklocal.
Latest version: 1.1.3

# JavaScript Library bundler

This project is just providing the infrastructure to bundle the pure JavaScript library for trame-vtklocal.

## v1 breaking change

We now publish an ESM bundle for both RemoteSession and StandaloneSession and a UMD bundle for the StandaloneSession as a VTK namespace for interacting with vtk classes in plain JavaScript.
npm package: @kitware/vtk-wasm
Description: A WebAssembly port of the VTK library
Latest version: 1.7.4

# vtk-wasm

## Project Structure and Build Scripts

This repository provides the infrastructure to bundle the pure JavaScript library for loading VTK.wasm.

The full usage documentation of vtk-wasm can be found at: https://kitware.github.io/vtk-wasm/

### File Structure

- `dist/` — Bundled output files.
- `examples/` — Example applications demonstrating vtk-wasm usage.
- `docs/` — Documentation and guide pages.
- `src/` — Source code for the library.
- `README.md` — Project documentation.  
- `package.json` — Project metadata and build scripts.

### Build Scripts

The following scripts are available in `package.json`:

- **`npm run docs:dev`** - Starts a local development server for the guide pages with live reloading
- **`npm run docs:build`** - Builds the guide pages for VTK.wasm
- **`npm run build`** — Builds the ESM and UMD bundles for both RemoteSession and StandaloneSession.
- **`npm run build:esm`** — Builds only the ESM bundles.
- **`npm run build:examples`** — Builds the example applications.
- **`npm run build:vtk`** — Builds only the UMD bundle for StandaloneSession.
- **`npm run build:viewer`** - Builds the vtkWASMViewer JavaScript library.
- **`npm run clean`** — Cleans the `dist/` directory.
- **`npm run lint`** — Runs code linting on the source files.

### Bundles

- **ESM Bundles:** For both RemoteSession and StandaloneSession.
- **UMD Bundle:** For StandaloneSession, exposed as the `VTK` namespace for use in browser environments.

Refer to the `package.json` for the full list of scripts and configuration details.

### ESM imports

```js
import { RemoteSession } from "@kitware/vtk-wasm/remote"
import { createVtkObjectProxy, createNamespace } from "@kitware/vtk-wasm/vtk"
import { ExportViewer, createViewer } from "@kitware/vtk-wasm/viewer"
```

### RemoteSession progress

```js
import { RemoteSession } from "@kitware/vtk-wasm/remote"

const session = new RemoteSession()
const removeProgress = session.addProgressCallback(({ active, state, hash }) => {
  // state: { current, total }, hash: { current, total }
  // active is true while states/blobs are being fetched
})

// Later, to stop listening:
removeProgress()
```

### UMD imports

```js
import "@kitware/vtk-wasm/viewer.css";
import "@kitware/vtk-wasm/viewer-umd.js";

import "@kitware/vtk-wasm/vtk-umd.js";
```