@opendatacapture/instrument-guidelines 2.1.4 → 2.2.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.
Files changed (2) hide show
  1. package/AGENTS.md +16 -1
  2. package/package.json +1 -1
package/AGENTS.md CHANGED
@@ -441,12 +441,27 @@ type Fields<TData, TLanguage> = {
441
441
  type FieldsGroup<TData, TLanguage> = {
442
442
  description?: InstrumentUIOption<TLanguage, string>;
443
443
  fields: { [K in keyof TData]?: UnknownField<TData, K, TLanguage> };
444
+ kind?: 'fields-group';
444
445
  title?: InstrumentUIOption<TLanguage, string>;
445
446
  };
446
447
 
447
- type Content<TData, TLanguage> = Fields<TData, TLanguage> | FieldsGroup<TData, TLanguage>[];
448
+ // An item of arbitrary JSX inlined amongst the groups of a form
449
+ type Block<TData> = {
450
+ kind: 'block';
451
+ render: (
452
+ this: void,
453
+ data: PartialData<TData>,
454
+ context: { t: (translations: { [L in Language]?: string }) => string }
455
+ ) => ReactNode;
456
+ };
457
+
458
+ type Content<TData, TLanguage> = Fields<TData, TLanguage> | (Block<TData> | FieldsGroup<TData, TLanguage>)[];
448
459
  ```
449
460
 
461
+ Content is either an object mapping every key to a field (`Fields`), or an array of `FieldsGroup` items — optionally interleaved with `Block` items that render arbitrary JSX (e.g. explanatory text) between groups. A `Block` holds no field data; its `render` receives the current partial form data, plus a context whose `t` resolves a translation map to the language the form is displayed in, and returns a `ReactNode`.
462
+
463
+ **A form may not import React.** `/runtime/v1/react@19.x` and `/runtime/v1/react-dom@19.x` — and their `@18.x` counterparts — belong to an interactive instrument, which renders in a document of its own; importing any of them outside one is rejected when the instrument is loaded. Write JSX freely — it compiles to the JSX runtime, not to an import of your own — but a block is a plain function with no state and no hooks.
464
+
450
465
  ##### Full Type
451
466
 
452
467
  ```ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@opendatacapture/instrument-guidelines",
3
3
  "type": "module",
4
- "version": "2.1.4",
4
+ "version": "2.2.0",
5
5
  "description": "Guidelines for authoring Open Data Capture instruments, intended to be read by an AI agent (e.g. Claude Code).",
6
6
  "license": "Apache-2.0",
7
7
  "publishConfig": {