Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/matronator/view-sync

Lightweight alternative to Alpine.js' `x-model` attribute, that is CSP friendly (no 'unsafe-eval' needed).
https://github.com/matronator/view-sync

alpine alpinejs csp-friendly data-attributes data-sync html-input html5-framework input-sync inputs lightweight lightweight-framework lightweight-javascript-library sync-data sync-inputs typescript-library x-model

Last synced: 9 days ago
JSON representation

Lightweight alternative to Alpine.js' `x-model` attribute, that is CSP friendly (no 'unsafe-eval' needed).

Awesome Lists containing this project

README

        

# view-sync

![View Sync logo](https://raw.githubusercontent.com/matronator/view-sync/main/.github/logo.png)

![NPM Version](https://img.shields.io/npm/v/view-sync)
![NPM Downloads](https://img.shields.io/npm/dw/view-sync)
![npm TypeScript version](https://img.shields.io/npm/dependency-version/view-sync/dev/typescript)
![Tree shaking](https://badgen.net/bundlephobia/tree-shaking/view-sync)
![Dependencies](https://badgen.net/bundlephobia/dependency-count/view-sync)
![npm package minimized gzipped size](https://img.shields.io/bundlejs/size/view-sync)
![Commits](https://badgen.net/github/commits/matronator/view-sync)
![Issues](https://img.shields.io/github/issues/matronator/view-sync.svg)
![License](https://img.shields.io/github/license/matronator/view-sync.svg)
![Follow](https://img.shields.io/github/followers/matronator.svg?style=social&label=Follow&maxAge=2592000)
![GitHub Sponsors](https://img.shields.io/github/sponsors/matronator)

Lightweight alternative to Alpine.js' `x-model` attribute, that is CSP friendly (no 'unsafe-eval' needed).

## Installation

### Using a package manager

Install using your preferred package manager:

#### NPM:

```
npm i view-sync
```

#### Bun:

```
bun i view-sync
```

#### PNPM:

```
pnpm i view-sync
```

#### Yarn:

```
yarn add view-sync
```

And then import it like this:

```js
import { ViewSync } from 'view-sync';
```

### Using a CDN

#### With a `` tag

```html
<script src="https://cdn.jsdelivr.net/npm/view-sync/dist/view-sync.iife.min.js">

ViewSync.Init();

```

#### With a `` tag using `import`

```html
<script type="module">
import viewsync from https://cdn.jsdelivr.net/npm/view-sync/+esm

```

## Usage

HTML:

```html







I will be hidden if `hello` is falsy


```

JavaScript/TypeScript:

```ts
import { ViewSync } from 'view-sync';
ViewSync.Init();
```