@urban-toolkit/autk-grammar 0.2.1 → 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.
package/README.md CHANGED
@@ -27,6 +27,22 @@ const grammar = new AutkGrammar({ map: 'map', plot: 'plot' }); // ids of the map
27
27
  await grammar.run(spec);
28
28
  ```
29
29
 
30
+ ## JSON Schema
31
+
32
+ The package ships the grammar's JSON Schema (draft-07) as `@urban-toolkit/autk-grammar/build/autk-grammar-schema.json`, with `$id` `https://autarkjs.org/schema/autk-grammar/v1.json`. Validate a spec with any draft-07 validator:
33
+
34
+ ```ts
35
+ import { Ajv } from 'ajv';
36
+ import schema from '@urban-toolkit/autk-grammar/build/autk-grammar-schema.json' with { type: 'json' };
37
+
38
+ const validate = new Ajv({ allowUnionTypes: true }).compile(schema);
39
+ if (!validate(spec)) console.error(validate.errors);
40
+ ```
41
+
42
+ ## Compute helpers
43
+
44
+ `runCompute(block, layers, run)` runs one `compute` entry against named FeatureCollections with a GPU runner you pass in, for example `params => new AutkComputeEngine().gpgpuPipeline(params)`. It joins a `wglsFunction` written as an array of lines, resolves `fromFeature` uniforms, and drives `iterate: 'all'` (one dispatch per feature, outputs summed) and `iterate: 'batched'` (one dispatch over packed uniform arrays). `resolveComputeParams(block, layers, iterateIndex?)` returns the parameters of a single dispatch without running anything.
45
+
30
46
  ## License
31
47
 
32
48
  MIT