@getforma/core 1.0.2 → 1.0.3

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.
Files changed (2) hide show
  1. package/README.md +47 -2
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -174,7 +174,7 @@ See [The `h()` function](#the-h-function) below for the full signature and all c
174
174
 
175
175
  ### 3. HTML Runtime (no build step)
176
176
 
177
- Drop a script tag, write `data-*` attributes. Zero config, zero tooling works from a CDN.
177
+ One `<script>` tag. One HTML file. No npm, no bundler, no `node_modules`, no config files. Just open it in a browser.
178
178
 
179
179
  ```html
180
180
  <script src="https://cdn.jsdelivr.net/npm/@getforma/core@latest/dist/formajs-runtime.global.js"></script>
@@ -186,7 +186,52 @@ Drop a script tag, write `data-*` attributes. Zero config, zero tooling — work
186
186
  </div>
187
187
  ```
188
188
 
189
- The expression parser is hand-written no `eval()`, no `new Function()` by default. For strict CSP environments, use the hardened build:
189
+ That's a working reactive counter. No JavaScript file. No build step. Just HTML.
190
+
191
+ **Here's what you get from a single HTML file with one script tag:**
192
+
193
+ ```html
194
+ <script src="https://cdn.jsdelivr.net/npm/@getforma/core@latest/dist/formajs-runtime.global.js"></script>
195
+
196
+ <div data-forma-state='{
197
+ "query": "",
198
+ "items": ["Apples", "Bananas", "Cherries", "Dates", "Elderberries"],
199
+ "darkMode": false
200
+ }'>
201
+
202
+ <!-- Two-way binding: type in the input, the list filters instantly -->
203
+ <input data-model="{query}" placeholder="Search fruits...">
204
+
205
+ <!-- Computed value: derived from query, updates automatically -->
206
+ <p data-computed="matchCount = items.filter(i => i.toLowerCase().includes(query.toLowerCase())).length"
207
+ data-text="{'Found ' + matchCount + ' results'}"></p>
208
+
209
+ <!-- Conditional rendering: show/hide based on state -->
210
+ <p data-show="{query.length > 0 && matchCount === 0}">No matches found.</p>
211
+
212
+ <!-- List rendering: keyed reconciliation, only changed items re-render -->
213
+ <ul data-list="{items.filter(i => i.toLowerCase().includes(query.toLowerCase()))}">
214
+ <li>{item}</li>
215
+ </ul>
216
+
217
+ <!-- Event handling with $dispatch: cross-component communication -->
218
+ <button data-on:click="{darkMode = !darkMode}">
219
+ Toggle Dark Mode
220
+ </button>
221
+
222
+ <!-- Dynamic classes and attributes -->
223
+ <div data-class:dark="{darkMode}" data-bind:data-theme="{darkMode ? 'dark' : 'light'}">
224
+ Theme is: <span data-text="{darkMode ? 'Dark' : 'Light'}"></span>
225
+ </div>
226
+
227
+ <!-- Persist to localStorage: survives page refresh -->
228
+ <div data-persist="{darkMode}"></div>
229
+ </div>
230
+ ```
231
+
232
+ That single HTML file gives you: reactive state, two-way data binding, computed values, conditional rendering, list rendering with filtering, event handling, dynamic CSS classes, dynamic attributes, and localStorage persistence. **No JavaScript written. No build tools installed.**
233
+
234
+ The expression parser is hand-written and CSP-safe — no `eval()`, no `new Function()` by default. For strict CSP environments, use the hardened build:
190
235
 
191
236
  ```html
192
237
  <script src="https://cdn.jsdelivr.net/npm/@getforma/core@latest/dist/formajs-runtime-hardened.global.js"></script>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@getforma/core",
3
3
  "author": "Forma <victor@getforma.dev>",
4
- "version": "1.0.2",
4
+ "version": "1.0.3",
5
5
  "description": "Real DOM reactive library — fine-grained signals, islands architecture, SSR hydration. No virtual DOM, no diffing. ~15KB gzipped.",
6
6
  "type": "module",
7
7
  "main": "./dist/index.cjs",