@wc-bindable/alpine 0.3.0

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.
@@ -0,0 +1,3 @@
1
+ import type Alpine from "alpinejs";
2
+ export default function wcBindablePlugin(alpine: typeof Alpine): void;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAGnC,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,MAAM,EAAE,OAAO,MAAM,QAqB7D"}
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ import { bind, isWcBindable } from "@wc-bindable/core";
2
+ export default function wcBindablePlugin(alpine) {
3
+ alpine.directive("wc-bindable", (el, { expression }, { evaluate, cleanup }) => {
4
+ if (!isWcBindable(el))
5
+ return;
6
+ const target = expression ? evaluate(expression) : undefined;
7
+ const unbind = bind(el, (name, value) => {
8
+ const data = alpine.$data(el);
9
+ if (target) {
10
+ const obj = (data[target] ?? {});
11
+ data[target] = { ...obj, [name]: value };
12
+ }
13
+ else {
14
+ data[name] = value;
15
+ }
16
+ });
17
+ cleanup(unbind);
18
+ });
19
+ }
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEvD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,MAAqB;IAC5D,MAAM,CAAC,SAAS,CACd,aAAa,EACb,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,EAAE;QAC5C,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;YAAE,OAAO;QAE9B,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAS,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAErE,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YACtC,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,CAA4B,CAAC;YACzD,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAA4B,CAAC;gBAC5D,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC;YAC3C,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;YACrB,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC,CACF,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@wc-bindable/alpine",
3
+ "version": "0.3.0",
4
+ "description": "Alpine.js plugin adapter for wc-bindable protocol",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "LICENSE",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "dev": "tsc --watch"
22
+ },
23
+ "dependencies": {
24
+ "@wc-bindable/core": "^0.3.0"
25
+ },
26
+ "peerDependencies": {
27
+ "alpinejs": ">=3"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/user/wc-bindable-protocol.git",
32
+ "directory": "packages/alpine"
33
+ },
34
+ "license": "MIT"
35
+ }