@axel669/zephyr 1.0.0-dev.0 → 1.0.0-dev.2

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/package.json CHANGED
@@ -1,50 +1,50 @@
1
- {
2
- "name": "@axel669/zephyr",
3
- "version": "1.0.0-dev.0",
4
- "description": "",
5
- "main": "index.js",
6
- "scripts": {
7
- "build": "rollup -c lib/rollup.config.js",
8
- "build.test": "rollup -c test/rollup.config.js"
9
- },
10
- "keywords": [],
11
- "author": "",
12
- "license": "ISC",
13
- "packageManager": "pnpm@10.9.0",
14
- "type": "module",
15
- "dependencies": {
16
- "fs-jetpack": "^5.1.0",
17
- "prettier": "^3.9.4"
18
- },
19
- "devDependencies": {
20
- "@axel669/rollup-html-input": "^0.1.2",
21
- "@axel669/windstorm": "1.0.0-beta.9",
22
- "@rollup/plugin-commonjs": "^29.0.3",
23
- "@rollup/plugin-node-resolve": "^16.0.3",
24
- "@rollup/plugin-replace": "^6.0.3",
25
- "@rollup/plugin-terser": "^1.0.0",
26
- "peggy": "^5.1.0",
27
- "preact": "10.29.3",
28
- "preact-render-to-string": "6.7.0",
29
- "preact-transitioning": "^1.5.3",
30
- "rolldown": "1.1.5",
31
- "rollup": "^4.62.2",
32
- "valtio": "2.3.2"
33
- },
34
- "imports": {
35
- "#core": "./lib/main.js",
36
- "#styled": "./lib/styled.js",
37
- "#state/*": "./test/state/*.js"
38
- },
39
- "exports": {
40
- ".": "./dist/zephyr.min.js",
41
- "./dev": "./dist/zephyr.js",
42
- "./unstyled": "./dist/zephyr-unstyled.min.js",
43
- "./unstyled-dev": "./dist/zephyr-unstyled.js",
44
- "./rollup": "./compiler/rollup.js"
45
- },
46
- "files": [
47
- "compiler",
48
- "dist/"
49
- ]
50
- }
1
+ {
2
+ "name": "@axel669/zephyr",
3
+ "version": "1.0.0-dev.2",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "build": "rollup -c lib/rollup.config.js",
8
+ "build.test": "rollup -c test/rollup.config.js"
9
+ },
10
+ "keywords": [],
11
+ "author": "",
12
+ "license": "ISC",
13
+ "packageManager": "pnpm@12.9.1",
14
+ "type": "module",
15
+ "dependencies": {
16
+ "fs-jetpack": "^5.1.0",
17
+ "prettier": "^3.9.4"
18
+ },
19
+ "devDependencies": {
20
+ "@axel669/rollup-html-input": "^0.1.2",
21
+ "@axel669/windstorm": "1.0.0-beta.10",
22
+ "@rollup/plugin-commonjs": "^29.0.3",
23
+ "@rollup/plugin-node-resolve": "^16.0.3",
24
+ "@rollup/plugin-replace": "^6.0.3",
25
+ "@rollup/plugin-terser": "^1.0.0",
26
+ "peggy": "^5.1.0",
27
+ "preact": "10.29.3",
28
+ "preact-render-to-string": "6.7.0",
29
+ "preact-transitioning": "^1.5.3",
30
+ "rolldown": "1.1.5",
31
+ "rollup": "^4.62.2",
32
+ "valtio": "2.3.2"
33
+ },
34
+ "imports": {
35
+ "#core": "./lib/main.js",
36
+ "#styled": "./lib/styled.js",
37
+ "#state/*": "./test/state/*.js"
38
+ },
39
+ "exports": {
40
+ ".": "./dist/zephyr.min.js",
41
+ "./dev": "./dist/zephyr.js",
42
+ "./unstyled": "./dist/zephyr-unstyled.min.js",
43
+ "./unstyled-dev": "./dist/zephyr-unstyled.js",
44
+ "./rollup": "./compiler/rollup.js"
45
+ },
46
+ "files": [
47
+ "compiler",
48
+ "dist/"
49
+ ]
50
+ }
package/readme.md CHANGED
@@ -86,9 +86,12 @@ is processed and sent to the update function, and handle things like numeric
86
86
  inputs and date inputs. Custom behavior can also be registered for this step
87
87
  using the `registerInputValue` function.
88
88
 
89
- Finally, when binding to a piece of valtio state, the value can start with a `#`
90
- and it will automatically have an update function created that assigns back to
91
- the value, so the case of tracking a value can be done with very little syntax.
89
+ Two shorthands exist to help this process further:
90
+ - `#bind:` + the variable that holds the value can be used to have zephyr
91
+ automagically create the right object to send downward.
92
+ - `#group:` + the vaariable that holds the value can be used to bind the value
93
+ in the same way that svelte's `bind:group` works for radio and checkbox
94
+ inputs.
92
95
 
93
96
  ```jsx
94
97
  import * as zephyr from "@axel669/zephyr"
@@ -113,7 +116,26 @@ const state = ze.proxy({
113
116
  })
114
117
  // this will be expanded to:
115
118
  // value={state.text} oninput={(next) => state.text = next}
116
- const thing2 = <input type="text" $$value={#state.text} />
119
+ const thing2 = <input type="text" $$value={#bind:state.text} />
120
+
121
+ const state = ze.proxy({
122
+ checks: [],
123
+ radio: "first"
124
+ })
125
+ // this will add/remove values from the array corresponding to the value
126
+ // of each checkbox
127
+ const checks = <#frag>
128
+ <input type="checkbox" value="first" $$checked={#group:state.checks} />
129
+ <input type="checkbox" value="second" $$checked={#group:state.checks} />
130
+ <input type="checkbox" value="third" $$checked={#group:state.checks} />
131
+ <//>
132
+ // this will set the state.radio value to the string values of the selected
133
+ // radio input instead of a true/false like normal
134
+ const radios = <#frag>
135
+ <input type="radio" value="first" $$checked={#group:state.radio} />
136
+ <input type="radio" value="second" $$checked={#group:state.radio} />
137
+ <input type="radio" value="third" $$checked={#group:state.radio} />
138
+ <//>
117
139
  ```
118
140
 
119
141
  ### $: Render