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: 4 months ago
JSON representation
Lightweight alternative to Alpine.js' `x-model` attribute, that is CSP friendly (no 'unsafe-eval' needed).
- Host: GitHub
- URL: https://github.com/matronator/view-sync
- Owner: matronator
- License: mit
- Created: 2024-07-08T20:02:19.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-16T21:32:27.000Z (6 months ago)
- Last Synced: 2025-03-17T14:03:23.083Z (4 months ago)
- Topics: 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
- Language: TypeScript
- Homepage:
- Size: 2.21 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# view-sync











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();
```