@ham2k/extension-sdk 0.9.0 → 0.9.1

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/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // @ham2k/extension-sdk 0.9.0
1
+ // @ham2k/extension-sdk 0.9.1
2
2
  /** Experimental v1 scene contract. All coordinates are in the scene's viewBox. */
3
3
  export interface SvgScene {
4
4
  version: 1;
@@ -1140,6 +1140,20 @@ export interface FormField {
1140
1140
  templateContext?: "export" | "adif" | "text";
1141
1141
  templateSample?: Record<string, JSONValue>;
1142
1142
  uppercase?: boolean;
1143
+ suggestions?: {
1144
+ code: string;
1145
+ name?: string;
1146
+ standalone?: boolean;
1147
+ }[];
1148
+ multiValue?: {
1149
+ separator: string;
1150
+ inheritPrefix?: number;
1151
+ };
1152
+ transforms?: {
1153
+ pattern: string;
1154
+ replacement: string;
1155
+ flags?: string;
1156
+ }[];
1143
1157
  options?: FormFieldOption[] | string;
1144
1158
  validate?: (value: any, state: Record<string, any>) => string | null | undefined | Promise<string | null | undefined>;
1145
1159
  transform?: (value: any, state: Record<string, any>) => any | Promise<any>;
package/docs/forms.md CHANGED
@@ -38,6 +38,23 @@ export interface FormField {
38
38
  value?: any; // initial state value if not provided in host call state
39
39
  placeholder?: string;
40
40
  uppercase?: boolean; // force typed input to uppercase (callsign fields always are)
41
+ // Only used when fieldType === 'text': the codes the field takes, offered
42
+ // in a list under it as the operator types (matched on code and name, as a
43
+ // `kind: 'options'` logging control matches) and named beside it — a value
44
+ // that is none of them shows in red with a `?` once the operator pauses or
45
+ // leaves the field. Flagged, never refused: Save writes what was typed.
46
+ // `standalone` marks a code valid only as the WHOLE value, never inside a
47
+ // multiValue list. A host older than this renders the plain text field, and
48
+ // so does a settings list (or a field with an `icon`), which edits text in a
49
+ // dialog row of its own.
50
+ suggestions?: { code: string; name?: string; standalone?: boolean }[];
51
+ // Only used with `suggestions`: the field holds several codes joined by
52
+ // `separator` (a QSO party county line, `ALB/SCH`), each suggested, named
53
+ // and checked on its own. `inheritPrefix` as on a logging control's.
54
+ multiValue?: { separator: string; inheritPrefix?: number };
55
+ // Only used with `suggestions`: live-reformatting passes as a logging
56
+ // control's `transforms` — a county line typed `ALB,SCH` becomes `ALB/SCH`.
57
+ transforms?: { pattern: string; replacement: string; flags?: string }[];
41
58
  options?: FormFieldOption[]; // required for select/radio
42
59
  validate?: (value: any, state: Record<string, any>) => string | null | undefined | Promise<string | null | undefined>;
43
60
  transform?: (value: any, state: Record<string, any>) => any | Promise<any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ham2k/extension-sdk",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Write extensions for the Ham2K Logger: typed hook contracts and the host API",
5
5
  "keywords": [
6
6
  "ham2k",