kopular 0.21.1 → 0.21.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.
Files changed (2) hide show
  1. package/LLM.md +22 -0
  2. package/package.json +2 -2
package/LLM.md CHANGED
@@ -169,6 +169,28 @@ FormField<string> email = new FormField<string>("", (string v) => Validators.Ema
169
169
  `{ get; }`) — `extern class` supports a plain field declaration for exactly this case,
170
170
  not just get/set accessor pairs.
171
171
 
172
+ `Computed1`/`Computed2`/`Resource<T>` (needs `kopscript >= 0.24.0` for `extern enum`,
173
+ which `AsyncStatus` requires):
174
+
175
+ ```ks
176
+ extern class Computed1<A, R> {
177
+ constructor(state<A> source, (A) => R compute);
178
+ state<R> Value;
179
+ } from "kopular/computed";
180
+ extern class Computed2<A, B, R> {
181
+ constructor(state<A> a, state<B> b, (A, B) => R compute);
182
+ state<R> Value;
183
+ } from "kopular/computed";
184
+
185
+ extern enum AsyncStatus { Loading, Success, Failure } from "kopular/resource";
186
+ extern class Resource<T> {
187
+ constructor(task<T> operation);
188
+ state<AsyncStatus> Status;
189
+ state<T?> Data;
190
+ state<string?> Error;
191
+ } from "kopular/resource";
192
+ ```
193
+
172
194
  You also need your own ambient DOM `extern` block (`document`, `Element`, `Event`, ...) —
173
195
  Kopular's own copy in `dom.ks` isn't reachable across the package boundary; redeclare the
174
196
  handful of members you actually use. See KopularDemo's `src/kopular_bindings.ks` for a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kopular",
3
- "version": "0.21.1",
3
+ "version": "0.21.2",
4
4
  "description": "Kopular: a small component framework for KopScript — components, reactive state, constructor-injected services, routing, real compiled templates, and HTTP, with no DI container",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -62,7 +62,7 @@
62
62
  "@types/jsdom": "^30.0.0",
63
63
  "@types/node": "^20.14.0",
64
64
  "jsdom": "^25.0.1",
65
- "kopscript": "^0.23.0",
65
+ "kopscript": "^0.24.0",
66
66
  "typescript": "^5.5.0",
67
67
  "vitest": "^4.1.11"
68
68
  },