shelving 1.240.0 → 1.242.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 (111) hide show
  1. package/extract/TypescriptExtractor.d.ts +1 -1
  2. package/extract/TypescriptExtractor.js +17 -12
  3. package/package.json +1 -1
  4. package/schema/AddressSchema.d.ts +2 -2
  5. package/schema/AddressSchema.js +2 -2
  6. package/schema/ArraySchema.d.ts +1 -1
  7. package/schema/ArraySchema.js +1 -1
  8. package/schema/BooleanSchema.d.ts +1 -1
  9. package/schema/BooleanSchema.js +1 -1
  10. package/schema/ChoiceSchema.d.ts +1 -1
  11. package/schema/ChoiceSchema.js +1 -1
  12. package/schema/ColorSchema.d.ts +2 -2
  13. package/schema/ColorSchema.js +2 -2
  14. package/schema/CountrySchema.d.ts +2 -2
  15. package/schema/CountrySchema.js +2 -2
  16. package/schema/CurrencyAmountSchema.d.ts +8 -8
  17. package/schema/CurrencyAmountSchema.js +8 -8
  18. package/schema/CurrencyCodeSchema.d.ts +2 -2
  19. package/schema/CurrencyCodeSchema.js +2 -2
  20. package/schema/DataSchema.d.ts +4 -4
  21. package/schema/DataSchema.js +3 -3
  22. package/schema/DateSchema.d.ts +2 -2
  23. package/schema/DateSchema.js +2 -2
  24. package/schema/DateTimeSchema.d.ts +2 -2
  25. package/schema/DateTimeSchema.js +2 -2
  26. package/schema/DictionarySchema.d.ts +1 -1
  27. package/schema/DictionarySchema.js +1 -1
  28. package/schema/EmailSchema.d.ts +2 -2
  29. package/schema/EmailSchema.js +2 -2
  30. package/schema/EntitySchema.d.ts +2 -2
  31. package/schema/EntitySchema.js +2 -2
  32. package/schema/FileSchema.d.ts +2 -2
  33. package/schema/FileSchema.js +2 -2
  34. package/schema/KeySchema.d.ts +2 -2
  35. package/schema/KeySchema.js +2 -2
  36. package/schema/NullableSchema.d.ts +1 -1
  37. package/schema/NullableSchema.js +1 -1
  38. package/schema/NumberSchema.d.ts +10 -10
  39. package/schema/NumberSchema.js +10 -10
  40. package/schema/OptionalSchema.d.ts +1 -1
  41. package/schema/OptionalSchema.js +1 -1
  42. package/schema/PasswordSchema.d.ts +1 -1
  43. package/schema/PasswordSchema.js +1 -1
  44. package/schema/PhoneSchema.d.ts +2 -2
  45. package/schema/PhoneSchema.js +2 -2
  46. package/schema/RequiredSchema.d.ts +1 -1
  47. package/schema/RequiredSchema.js +1 -1
  48. package/schema/SlugSchema.d.ts +2 -6
  49. package/schema/SlugSchema.js +2 -6
  50. package/schema/StringSchema.d.ts +6 -6
  51. package/schema/StringSchema.js +6 -6
  52. package/schema/TimeSchema.d.ts +2 -2
  53. package/schema/TimeSchema.js +2 -2
  54. package/schema/URISchema.d.ts +2 -6
  55. package/schema/URISchema.js +2 -6
  56. package/schema/URLSchema.d.ts +2 -6
  57. package/schema/URLSchema.js +2 -6
  58. package/schema/UUIDSchema.d.ts +2 -6
  59. package/schema/UUIDSchema.js +2 -6
  60. package/ui/docs/DocumentationHomePage.d.ts +1 -1
  61. package/ui/docs/DocumentationHomePage.js +2 -2
  62. package/ui/docs/DocumentationHomePage.md +2 -2
  63. package/ui/docs/DocumentationHomePage.tsx +3 -5
  64. package/ui/docs/DocumentationKind.d.ts +1 -27
  65. package/ui/docs/DocumentationKind.js +2 -17
  66. package/ui/docs/DocumentationKind.tsx +3 -46
  67. package/ui/docs/DocumentationPage.js +12 -29
  68. package/ui/docs/DocumentationPage.test.tsx +16 -0
  69. package/ui/docs/DocumentationPage.tsx +11 -43
  70. package/ui/form/ButtonInput.d.ts +2 -2
  71. package/ui/form/ButtonInput.js +2 -2
  72. package/ui/form/ButtonInput.tsx +3 -3
  73. package/ui/form/CheckboxInput.d.ts +2 -2
  74. package/ui/form/CheckboxInput.js +2 -2
  75. package/ui/form/CheckboxInput.tsx +6 -3
  76. package/ui/form/DateInput.d.ts +3 -3
  77. package/ui/form/DateInput.js +4 -3
  78. package/ui/form/DateInput.tsx +5 -3
  79. package/ui/form/FileInput.d.ts +3 -3
  80. package/ui/form/FileInput.js +3 -3
  81. package/ui/form/FileInput.tsx +4 -3
  82. package/ui/form/Input.d.ts +56 -0
  83. package/ui/form/Input.js +56 -6
  84. package/ui/form/Input.tsx +75 -6
  85. package/ui/form/NumberInput.d.ts +3 -3
  86. package/ui/form/NumberInput.js +4 -3
  87. package/ui/form/NumberInput.tsx +5 -3
  88. package/ui/form/OutputInput.d.ts +2 -2
  89. package/ui/form/OutputInput.js +2 -2
  90. package/ui/form/OutputInput.tsx +3 -3
  91. package/ui/form/RadioInput.d.ts +2 -2
  92. package/ui/form/RadioInput.js +2 -2
  93. package/ui/form/RadioInput.tsx +3 -3
  94. package/ui/form/SelectInput.d.ts +2 -2
  95. package/ui/form/SelectInput.js +4 -3
  96. package/ui/form/SelectInput.tsx +5 -3
  97. package/ui/form/TextInput.d.ts +3 -3
  98. package/ui/form/TextInput.js +5 -4
  99. package/ui/form/TextInput.tsx +6 -4
  100. package/ui/style/Padding.d.ts +1 -1
  101. package/ui/style/Padding.module.css +32 -0
  102. package/ui/style/Padding.tsx +19 -1
  103. package/ui/style/Space.d.ts +1 -1
  104. package/ui/style/Space.module.css +32 -0
  105. package/ui/style/Space.tsx +19 -1
  106. package/ui/style/Width.d.ts +2 -0
  107. package/ui/style/Width.tsx +2 -0
  108. package/ui/style/getSpaceClass.md +2 -0
  109. package/ui/tree/TreeIndexPage.d.ts +3 -2
  110. package/ui/tree/TreeIndexPage.js +12 -7
  111. package/ui/tree/TreeIndexPage.tsx +26 -7
@@ -9,7 +9,7 @@ import { FileExtractor } from "./FileExtractor.js";
9
9
  * - A `@kind` tag in a symbol's JSDoc overrides the inferred kind — e.g. `@kind component` relabels a React component (otherwise a `function`) so the docs site groups and colours it as a component. The override also drops the trailing `()` from the title, since a non-function kind reads as a bare name.
10
10
  * - Top-of-file JSDoc comment becomes the file's `content`.
11
11
  * - Sets `description` (a plain-text summary from the first JSDoc paragraph) on the file and every `tree-documentation` child.
12
- * - Sets `title` on every `tree-documentation` child — `name()` for functions and methods, bare `name` for other kinds. Parent class context comes from the `class` prop ("member of …" affordance), never the title.
12
+ * - Sets `title` on every `tree-documentation` child — `name()` for functions, `Class.name()` for methods, `Class.name` for properties, bare `name` for other kinds.
13
13
  * - Records relational metadata as raw strings for render-time linking: `class` (owning class), `readonly`, `extends`, `implements`.
14
14
  * - Members declared with the `override` or `declare` modifier are skipped — the base class already documents overrides, and `declare` members are ambient type-only re-declarations rather than new API.
15
15
  * - Keys are the raw declared `name` (case-preserving) so case-distinct exports like `Collection` and `COLLECTION` stay separate.
@@ -10,7 +10,7 @@ import { extractMarkdownProps } from "./MarkupExtractor.js";
10
10
  * - A `@kind` tag in a symbol's JSDoc overrides the inferred kind — e.g. `@kind component` relabels a React component (otherwise a `function`) so the docs site groups and colours it as a component. The override also drops the trailing `()` from the title, since a non-function kind reads as a bare name.
11
11
  * - Top-of-file JSDoc comment becomes the file's `content`.
12
12
  * - Sets `description` (a plain-text summary from the first JSDoc paragraph) on the file and every `tree-documentation` child.
13
- * - Sets `title` on every `tree-documentation` child — `name()` for functions and methods, bare `name` for other kinds. Parent class context comes from the `class` prop ("member of …" affordance), never the title.
13
+ * - Sets `title` on every `tree-documentation` child — `name()` for functions, `Class.name()` for methods, `Class.name` for properties, bare `name` for other kinds.
14
14
  * - Records relational metadata as raw strings for render-time linking: `class` (owning class), `readonly`, `extends`, `implements`.
15
15
  * - Members declared with the `override` or `declare` modifier are skipped — the base class already documents overrides, and `declare` members are ambient type-only re-declarations rather than new API.
16
16
  * - Keys are the raw declared `name` (case-preserving) so case-distinct exports like `Collection` and `COLLECTION` stay separate.
@@ -332,10 +332,11 @@ function _getReturns(statement, source, jsDocReturns, name) {
332
332
  }
333
333
  /**
334
334
  * Extract class or interface members as child elements.
335
- * - `className` is stamped onto every member as its `class` prop (the source of the qualified flat key and the "member of …" affordance); the title stays the bare member `name` / `name()`.
335
+ * - `className` is stamped onto every member as its `class` prop (the source of the qualified flat key and the "member of …" affordance) and is prebaked into the member `title` (`Class.name` / `Class.name()`).
336
336
  * - Members declared with the `override` modifier are skipped — the base class already documents them, so a subclass page lists only its newly-introduced API.
337
337
  * - Members declared with the `declare` modifier are skipped — they're ambient type-only re-declarations (e.g. narrowing an inherited property's type), not new API.
338
338
  * - Getters/setters fold into a single `property` element per name; a getter with no matching setter is `readonly`.
339
+ * - `static` members are labelled `static method` / `static property` so the docs site groups them in their own sections, separate from instance `method` / `property`, and their rendered signature is prefixed with the `static ` keyword.
339
340
  */
340
341
  function _getClassMembers(statement, source, className) {
341
342
  if (!ts.isClassDeclaration(statement) && !ts.isInterfaceDeclaration(statement))
@@ -355,13 +356,17 @@ function _getClassMembers(statement, source, className) {
355
356
  // Skip `declare` members — ambient type-only re-declarations (e.g. a subclass narrowing an inherited property's type), not new API.
356
357
  if (modifiers?.some(m => m.kind === ts.SyntaxKind.DeclareKeyword))
357
358
  continue;
359
+ // `static` members are grouped and labelled separately from instance members (`static method` / `static property`),
360
+ // and carry the `static ` keyword in their rendered signature.
361
+ const isStatic = modifiers?.some(m => m.kind === ts.SyntaxKind.StaticKeyword);
362
+ const staticPrefix = isStatic ? "static " : "";
358
363
  const memberJSDoc = _getJSDoc(member, source);
359
364
  const content = _buildJSDocContent(memberJSDoc?.description, memberJSDoc?.unhandled);
360
365
  const description = extractMarkdownProps(memberJSDoc?.description ?? "").description;
361
366
  if (ts.isMethodDeclaration(member) || ts.isMethodSignature(member)) {
362
367
  const params = member.parameters.map(p => p.getText(source)).join(", ");
363
368
  const ret = member.type ? member.type.getText(source) : "void";
364
- const signature = `${name}(${params}): ${ret}`;
369
+ const signature = `${staticPrefix}${name}(${params}): ${ret}`;
365
370
  const key = name;
366
371
  const existingIndex = members.findIndex(m => m.key === key);
367
372
  const existing = members[existingIndex];
@@ -377,10 +382,10 @@ function _getClassMembers(statement, source, className) {
377
382
  key,
378
383
  props: {
379
384
  name,
380
- title: `${name}()`,
385
+ title: `${className}.${name}()`,
381
386
  description,
382
387
  content,
383
- kind: "method",
388
+ kind: isStatic ? "static method" : "method",
384
389
  class: className,
385
390
  signatures: [signature],
386
391
  },
@@ -395,13 +400,13 @@ function _getClassMembers(statement, source, className) {
395
400
  key: name,
396
401
  props: {
397
402
  name,
398
- title: name,
403
+ title: `${className}.${name}`,
399
404
  description,
400
405
  content,
401
- kind: "property",
406
+ kind: isStatic ? "static property" : "property",
402
407
  class: className,
403
408
  readonly,
404
- signatures: type ? [`${readonly ? "readonly " : ""}${name}: ${type}`] : undefined,
409
+ signatures: type ? [`${staticPrefix}${readonly ? "readonly " : ""}${name}: ${type}`] : undefined,
405
410
  },
406
411
  });
407
412
  }
@@ -418,7 +423,7 @@ function _getClassMembers(statement, source, className) {
418
423
  ...existing.props,
419
424
  // A getter + setter pair is writable — drop the read-only flag and the `readonly ` signature prefix.
420
425
  readonly: undefined,
421
- signatures: type ? [`${name}: ${type}`] : existing.props.signatures,
426
+ signatures: type ? [`${staticPrefix}${name}: ${type}`] : existing.props.signatures,
422
427
  },
423
428
  };
424
429
  }
@@ -428,13 +433,13 @@ function _getClassMembers(statement, source, className) {
428
433
  key,
429
434
  props: {
430
435
  name,
431
- title: name,
436
+ title: `${className}.${name}`,
432
437
  description,
433
438
  content,
434
- kind: "property",
439
+ kind: isStatic ? "static property" : "property",
435
440
  class: className,
436
441
  readonly: ts.isGetAccessor(member) || undefined,
437
- signatures: type ? [`${ts.isGetAccessor(member) ? "readonly " : ""}${name}: ${type}`] : undefined,
442
+ signatures: type ? [`${staticPrefix}${ts.isGetAccessor(member) ? "readonly " : ""}${name}: ${type}`] : undefined,
438
443
  },
439
444
  });
440
445
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shelving",
3
- "version": "1.240.0",
3
+ "version": "1.242.0",
4
4
  "author": "Dave Houlbrooke <dave@shax.com>",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,14 +38,14 @@ export declare class AddressSchema extends DataSchema<AddressData> {
38
38
  format(value: AddressData): string;
39
39
  }
40
40
  /**
41
- * Valid postal address data.
41
+ * Sugar instance of [`AddressSchema`](/schema/AddressSchema) for postal address data. Equivalent to `new AddressSchema({})`.
42
42
  *
43
43
  * @example ADDRESS.validate({ address1: "1 High St", city: "London", postcode: "SW1A 1AA", country: "GB" });
44
44
  * @see https://dhoulb.github.io/shelving/schema/AddressSchema/ADDRESS
45
45
  */
46
46
  export declare const ADDRESS: AddressSchema;
47
47
  /**
48
- * Valid postal address data, or `null`
48
+ * Sugar instance allowing an [`ADDRESS`](/schema/ADDRESS) or `null`. Equivalent to `NULLABLE(ADDRESS)`.
49
49
  *
50
50
  * @example NULLABLE_ADDRESS.validate(null); // Returns null
51
51
  * @see https://dhoulb.github.io/shelving/schema/AddressSchema/NULLABLE_ADDRESS
@@ -45,14 +45,14 @@ export class AddressSchema extends DataSchema {
45
45
  }
46
46
  }
47
47
  /**
48
- * Valid postal address data.
48
+ * Sugar instance of [`AddressSchema`](/schema/AddressSchema) for postal address data. Equivalent to `new AddressSchema({})`.
49
49
  *
50
50
  * @example ADDRESS.validate({ address1: "1 High St", city: "London", postcode: "SW1A 1AA", country: "GB" });
51
51
  * @see https://dhoulb.github.io/shelving/schema/AddressSchema/ADDRESS
52
52
  */
53
53
  export const ADDRESS = new AddressSchema({});
54
54
  /**
55
- * Valid postal address data, or `null`
55
+ * Sugar instance allowing an [`ADDRESS`](/schema/ADDRESS) or `null`. Equivalent to `NULLABLE(ADDRESS)`.
56
56
  *
57
57
  * @example NULLABLE_ADDRESS.validate(null); // Returns null
58
58
  * @see https://dhoulb.github.io/shelving/schema/AddressSchema/NULLABLE_ADDRESS
@@ -83,7 +83,7 @@ export declare class ArraySchema<T> extends Schema<ImmutableArray<T>> {
83
83
  /**
84
84
  * Create a schema for a valid array with specified items.
85
85
  *
86
- * *Factory for `ArraySchema`.*
86
+ * Sugar factory for [`ArraySchema`](/schema/ArraySchema).
87
87
  *
88
88
  * @param items Schema every item in the array must conform to.
89
89
  * @returns An `ArraySchema` validating arrays of the given item type.
@@ -79,7 +79,7 @@ export class ArraySchema extends Schema {
79
79
  /**
80
80
  * Create a schema for a valid array with specified items.
81
81
  *
82
- * *Factory for `ArraySchema`.*
82
+ * Sugar factory for [`ArraySchema`](/schema/ArraySchema).
83
83
  *
84
84
  * @param items Schema every item in the array must conform to.
85
85
  * @returns An `ArraySchema` validating arrays of the given item type.
@@ -63,7 +63,7 @@ export declare class BooleanSchema extends Schema<boolean> {
63
63
  format(value: boolean): string;
64
64
  }
65
65
  /**
66
- * Valid boolean.
66
+ * Sugar instance of [`BooleanSchema`](/schema/BooleanSchema) for a coerced boolean. Equivalent to `new BooleanSchema({})`.
67
67
  *
68
68
  * @example
69
69
  * BOOLEAN.validate("yes"); // Returns true
@@ -60,7 +60,7 @@ export class BooleanSchema extends Schema {
60
60
  }
61
61
  }
62
62
  /**
63
- * Valid boolean.
63
+ * Sugar instance of [`BooleanSchema`](/schema/BooleanSchema) for a coerced boolean. Equivalent to `new BooleanSchema({})`.
64
64
  *
65
65
  * @example
66
66
  * BOOLEAN.validate("yes"); // Returns true
@@ -76,7 +76,7 @@ export declare class ChoiceSchema<O extends string, I = never> extends Schema<O>
76
76
  /**
77
77
  * Create a schema for a valid choice from an allowed set of values.
78
78
  *
79
- * *Factory for `ChoiceSchema`.*
79
+ * Sugar factory for [`ChoiceSchema`](/schema/ChoiceSchema).
80
80
  *
81
81
  * @param options The allowed choices, as a `{ key: title }` dictionary or an array of keys.
82
82
  * @returns A `ChoiceSchema` validating the given choices.
@@ -60,7 +60,7 @@ export class ChoiceSchema extends Schema {
60
60
  /**
61
61
  * Create a schema for a valid choice from an allowed set of values.
62
62
  *
63
- * *Factory for `ChoiceSchema`.*
63
+ * Sugar factory for [`ChoiceSchema`](/schema/ChoiceSchema).
64
64
  *
65
65
  * @param options The allowed choices, as a `{ key: title }` dictionary or an array of keys.
66
66
  * @returns A `ChoiceSchema` validating the given choices.
@@ -39,14 +39,14 @@ export declare class ColorSchema extends StringSchema {
39
39
  sanitize(insaneString: string): string;
40
40
  }
41
41
  /**
42
- * Valid color hex string, e.g. `#00CCFF` (required because empty string is invalid).
42
+ * Sugar instance of [`ColorSchema`](/schema/ColorSchema) for a required hex color string, e.g. `#00CCFF`. Equivalent to `new ColorSchema({})`.
43
43
  *
44
44
  * @example COLOR.validate("#00CCFF"); // Returns "#00CCFF"
45
45
  * @see https://dhoulb.github.io/shelving/schema/ColorSchema/COLOR
46
46
  */
47
47
  export declare const COLOR: ColorSchema;
48
48
  /**
49
- * Valid color hex string, e.g. `#00CCFF`, or `null`
49
+ * Sugar instance allowing a [`COLOR`](/schema/COLOR) or `null`. Equivalent to `NULLABLE(COLOR)`.
50
50
  *
51
51
  * @example NULLABLE_COLOR.validate(null); // Returns null
52
52
  * @see https://dhoulb.github.io/shelving/schema/ColorSchema/NULLABLE_COLOR
@@ -50,14 +50,14 @@ export class ColorSchema extends StringSchema {
50
50
  }
51
51
  }
52
52
  /**
53
- * Valid color hex string, e.g. `#00CCFF` (required because empty string is invalid).
53
+ * Sugar instance of [`ColorSchema`](/schema/ColorSchema) for a required hex color string, e.g. `#00CCFF`. Equivalent to `new ColorSchema({})`.
54
54
  *
55
55
  * @example COLOR.validate("#00CCFF"); // Returns "#00CCFF"
56
56
  * @see https://dhoulb.github.io/shelving/schema/ColorSchema/COLOR
57
57
  */
58
58
  export const COLOR = new ColorSchema({});
59
59
  /**
60
- * Valid color hex string, e.g. `#00CCFF`, or `null`
60
+ * Sugar instance allowing a [`COLOR`](/schema/COLOR) or `null`. Equivalent to `NULLABLE(COLOR)`.
61
61
  *
62
62
  * @example NULLABLE_COLOR.validate(null); // Returns null
63
63
  * @see https://dhoulb.github.io/shelving/schema/ColorSchema/NULLABLE_COLOR
@@ -42,14 +42,14 @@ export declare class CountrySchema extends ChoiceSchema<Country, PossibleCountry
42
42
  validate(unsafeValue?: unknown): Country;
43
43
  }
44
44
  /**
45
- * Valid country code, e.g. `GB` (required because falsy values are invalid).
45
+ * Sugar instance of [`CountrySchema`](/schema/CountrySchema) for a required ISO 3166 country code, e.g. `GB`. Equivalent to `new CountrySchema({})`.
46
46
  *
47
47
  * @example COUNTRY.validate("GB") // "GB"
48
48
  * @see https://dhoulb.github.io/shelving/schema/CountrySchema/COUNTRY
49
49
  */
50
50
  export declare const COUNTRY: CountrySchema;
51
51
  /**
52
- * Valid country code, e.g. `GB`, or `null`.
52
+ * Sugar instance allowing a [`COUNTRY`](/schema/COUNTRY) or `null`. Equivalent to `NULLABLE(COUNTRY)`.
53
53
  *
54
54
  * @example NULLABLE_COUNTRY.validate(null) // null
55
55
  * @see https://dhoulb.github.io/shelving/schema/CountrySchema/NULLABLE_COUNTRY
@@ -40,14 +40,14 @@ export class CountrySchema extends ChoiceSchema {
40
40
  }
41
41
  }
42
42
  /**
43
- * Valid country code, e.g. `GB` (required because falsy values are invalid).
43
+ * Sugar instance of [`CountrySchema`](/schema/CountrySchema) for a required ISO 3166 country code, e.g. `GB`. Equivalent to `new CountrySchema({})`.
44
44
  *
45
45
  * @example COUNTRY.validate("GB") // "GB"
46
46
  * @see https://dhoulb.github.io/shelving/schema/CountrySchema/COUNTRY
47
47
  */
48
48
  export const COUNTRY = new CountrySchema({});
49
49
  /**
50
- * Valid country code, e.g. `GB`, or `null`.
50
+ * Sugar instance allowing a [`COUNTRY`](/schema/COUNTRY) or `null`. Equivalent to `NULLABLE(COUNTRY)`.
51
51
  *
52
52
  * @example NULLABLE_COUNTRY.validate(null) // null
53
53
  * @see https://dhoulb.github.io/shelving/schema/CountrySchema/NULLABLE_COUNTRY
@@ -66,7 +66,7 @@ export declare class CurrencyAmountSchema extends NumberSchema {
66
66
  /**
67
67
  * Create a `CurrencyAmountSchema` for a non-negative monetary amount in a currency.
68
68
  *
69
- * *Factory for `CurrencyAmountSchema`.*
69
+ * Sugar factory for [`CurrencyAmountSchema`](/schema/CurrencyAmountSchema).
70
70
  *
71
71
  * @param currency ISO 4217 currency code that determines the step and symbol.
72
72
  * @returns A `CurrencyAmountSchema` validating amounts in `currency`.
@@ -76,21 +76,21 @@ export declare class CurrencyAmountSchema extends NumberSchema {
76
76
  */
77
77
  export declare function CURRENCY_AMOUNT(currency: CurrencyCode): CurrencyAmountSchema;
78
78
  /**
79
- * Valid US dollar amount, e.g. `12.35`.
79
+ * Sugar instance of [`CurrencyAmountSchema`](/schema/CurrencyAmountSchema) for a US dollar amount. Equivalent to `new CurrencyAmountSchema({ currency: "USD" })`.
80
80
  *
81
81
  * @example USD_AMOUNT.validate("12.345") // 12.35
82
82
  * @see https://dhoulb.github.io/shelving/schema/CurrencyAmountSchema/USD_AMOUNT
83
83
  */
84
84
  export declare const USD_AMOUNT: CurrencyAmountSchema;
85
85
  /**
86
- * Valid pound sterling amount, e.g. `12.35`.
86
+ * Sugar instance of [`CurrencyAmountSchema`](/schema/CurrencyAmountSchema) for a pound sterling amount. Equivalent to `new CurrencyAmountSchema({ currency: "GBP" })`.
87
87
  *
88
88
  * @example GBP_AMOUNT.validate("12.345") // 12.35
89
89
  * @see https://dhoulb.github.io/shelving/schema/CurrencyAmountSchema/GBP_AMOUNT
90
90
  */
91
91
  export declare const GBP_AMOUNT: CurrencyAmountSchema;
92
92
  /**
93
- * Valid euro amount, e.g. `12.35`.
93
+ * Sugar instance of [`CurrencyAmountSchema`](/schema/CurrencyAmountSchema) for a euro amount. Equivalent to `new CurrencyAmountSchema({ currency: "EUR" })`.
94
94
  *
95
95
  * @example EUR_AMOUNT.validate("12.345") // 12.35
96
96
  * @see https://dhoulb.github.io/shelving/schema/CurrencyAmountSchema/EUR_AMOUNT
@@ -99,7 +99,7 @@ export declare const EUR_AMOUNT: CurrencyAmountSchema;
99
99
  /**
100
100
  * Create a `NullableSchema` for an optional monetary amount in a currency, or `null`.
101
101
  *
102
- * *Factory for `NullableSchema`.*
102
+ * Sugar factory for [`NullableSchema`](/schema/NullableSchema).
103
103
  *
104
104
  * @param currency ISO 4217 currency code that determines the step and symbol.
105
105
  * @returns A `NullableSchema` validating amounts in `currency`, or `null`.
@@ -109,21 +109,21 @@ export declare const EUR_AMOUNT: CurrencyAmountSchema;
109
109
  */
110
110
  export declare function NULLABLE_CURRENCY_AMOUNT(currency: CurrencyCode): NullableSchema<number>;
111
111
  /**
112
- * Valid US dollar amount, e.g. `12.35`, or `null`.
112
+ * Sugar instance allowing a [`USD_AMOUNT`](/schema/USD_AMOUNT) or `null`. Equivalent to `NULLABLE(USD_AMOUNT)`.
113
113
  *
114
114
  * @example NULLABLE_USD_AMOUNT.validate(null) // null
115
115
  * @see https://dhoulb.github.io/shelving/schema/CurrencyAmountSchema/NULLABLE_USD_AMOUNT
116
116
  */
117
117
  export declare const NULLABLE_USD_AMOUNT: NullableSchema<number>;
118
118
  /**
119
- * Valid pound sterling amount, e.g. `12.35`, or `null`.
119
+ * Sugar instance allowing a [`GBP_AMOUNT`](/schema/GBP_AMOUNT) or `null`. Equivalent to `NULLABLE(GBP_AMOUNT)`.
120
120
  *
121
121
  * @example NULLABLE_GBP_AMOUNT.validate(null) // null
122
122
  * @see https://dhoulb.github.io/shelving/schema/CurrencyAmountSchema/NULLABLE_GBP_AMOUNT
123
123
  */
124
124
  export declare const NULLABLE_GBP_AMOUNT: NullableSchema<number>;
125
125
  /**
126
- * Valid euro amount, e.g. `12.35`, or `null`.
126
+ * Sugar instance allowing an [`EUR_AMOUNT`](/schema/EUR_AMOUNT) or `null`. Equivalent to `NULLABLE(EUR_AMOUNT)`.
127
127
  *
128
128
  * @example NULLABLE_EUR_AMOUNT.validate(null) // null
129
129
  * @see https://dhoulb.github.io/shelving/schema/CurrencyAmountSchema/NULLABLE_EUR_AMOUNT
@@ -62,7 +62,7 @@ export class CurrencyAmountSchema extends NumberSchema {
62
62
  /**
63
63
  * Create a `CurrencyAmountSchema` for a non-negative monetary amount in a currency.
64
64
  *
65
- * *Factory for `CurrencyAmountSchema`.*
65
+ * Sugar factory for [`CurrencyAmountSchema`](/schema/CurrencyAmountSchema).
66
66
  *
67
67
  * @param currency ISO 4217 currency code that determines the step and symbol.
68
68
  * @returns A `CurrencyAmountSchema` validating amounts in `currency`.
@@ -74,21 +74,21 @@ export function CURRENCY_AMOUNT(currency) {
74
74
  return new CurrencyAmountSchema({ currency });
75
75
  }
76
76
  /**
77
- * Valid US dollar amount, e.g. `12.35`.
77
+ * Sugar instance of [`CurrencyAmountSchema`](/schema/CurrencyAmountSchema) for a US dollar amount. Equivalent to `new CurrencyAmountSchema({ currency: "USD" })`.
78
78
  *
79
79
  * @example USD_AMOUNT.validate("12.345") // 12.35
80
80
  * @see https://dhoulb.github.io/shelving/schema/CurrencyAmountSchema/USD_AMOUNT
81
81
  */
82
82
  export const USD_AMOUNT = new CurrencyAmountSchema({ currency: "USD" });
83
83
  /**
84
- * Valid pound sterling amount, e.g. `12.35`.
84
+ * Sugar instance of [`CurrencyAmountSchema`](/schema/CurrencyAmountSchema) for a pound sterling amount. Equivalent to `new CurrencyAmountSchema({ currency: "GBP" })`.
85
85
  *
86
86
  * @example GBP_AMOUNT.validate("12.345") // 12.35
87
87
  * @see https://dhoulb.github.io/shelving/schema/CurrencyAmountSchema/GBP_AMOUNT
88
88
  */
89
89
  export const GBP_AMOUNT = new CurrencyAmountSchema({ currency: "GBP" });
90
90
  /**
91
- * Valid euro amount, e.g. `12.35`.
91
+ * Sugar instance of [`CurrencyAmountSchema`](/schema/CurrencyAmountSchema) for a euro amount. Equivalent to `new CurrencyAmountSchema({ currency: "EUR" })`.
92
92
  *
93
93
  * @example EUR_AMOUNT.validate("12.345") // 12.35
94
94
  * @see https://dhoulb.github.io/shelving/schema/CurrencyAmountSchema/EUR_AMOUNT
@@ -97,7 +97,7 @@ export const EUR_AMOUNT = new CurrencyAmountSchema({ currency: "EUR" });
97
97
  /**
98
98
  * Create a `NullableSchema` for an optional monetary amount in a currency, or `null`.
99
99
  *
100
- * *Factory for `NullableSchema`.*
100
+ * Sugar factory for [`NullableSchema`](/schema/NullableSchema).
101
101
  *
102
102
  * @param currency ISO 4217 currency code that determines the step and symbol.
103
103
  * @returns A `NullableSchema` validating amounts in `currency`, or `null`.
@@ -109,21 +109,21 @@ export function NULLABLE_CURRENCY_AMOUNT(currency) {
109
109
  return NULLABLE(CURRENCY_AMOUNT(currency));
110
110
  }
111
111
  /**
112
- * Valid US dollar amount, e.g. `12.35`, or `null`.
112
+ * Sugar instance allowing a [`USD_AMOUNT`](/schema/USD_AMOUNT) or `null`. Equivalent to `NULLABLE(USD_AMOUNT)`.
113
113
  *
114
114
  * @example NULLABLE_USD_AMOUNT.validate(null) // null
115
115
  * @see https://dhoulb.github.io/shelving/schema/CurrencyAmountSchema/NULLABLE_USD_AMOUNT
116
116
  */
117
117
  export const NULLABLE_USD_AMOUNT = NULLABLE(USD_AMOUNT);
118
118
  /**
119
- * Valid pound sterling amount, e.g. `12.35`, or `null`.
119
+ * Sugar instance allowing a [`GBP_AMOUNT`](/schema/GBP_AMOUNT) or `null`. Equivalent to `NULLABLE(GBP_AMOUNT)`.
120
120
  *
121
121
  * @example NULLABLE_GBP_AMOUNT.validate(null) // null
122
122
  * @see https://dhoulb.github.io/shelving/schema/CurrencyAmountSchema/NULLABLE_GBP_AMOUNT
123
123
  */
124
124
  export const NULLABLE_GBP_AMOUNT = NULLABLE(GBP_AMOUNT);
125
125
  /**
126
- * Valid euro amount, e.g. `12.35`, or `null`.
126
+ * Sugar instance allowing an [`EUR_AMOUNT`](/schema/EUR_AMOUNT) or `null`. Equivalent to `NULLABLE(EUR_AMOUNT)`.
127
127
  *
128
128
  * @example NULLABLE_EUR_AMOUNT.validate(null) // null
129
129
  * @see https://dhoulb.github.io/shelving/schema/CurrencyAmountSchema/NULLABLE_EUR_AMOUNT
@@ -58,14 +58,14 @@ export declare class CurrencyCodeSchema extends StringSchema {
58
58
  validate(value?: unknown): string;
59
59
  }
60
60
  /**
61
- * Valid currency code, e.g. `GBP` (required because falsy values are invalid).
61
+ * Sugar instance of [`CurrencyCodeSchema`](/schema/CurrencyCodeSchema) for a required ISO 4217 currency code, e.g. `GBP`. Equivalent to `new CurrencyCodeSchema({})`.
62
62
  *
63
63
  * @example CURRENCY_CODE.validate("gbp") // "GBP"
64
64
  * @see https://dhoulb.github.io/shelving/schema/CurrencyCodeSchema/CURRENCY_CODE
65
65
  */
66
66
  export declare const CURRENCY_CODE: CurrencyCodeSchema;
67
67
  /**
68
- * Valid currency code, e.g. `GBP`, or `null`.
68
+ * Sugar instance allowing a [`CURRENCY_CODE`](/schema/CURRENCY_CODE) or `null`. Equivalent to `NULLABLE(CURRENCY_CODE)`.
69
69
  *
70
70
  * @example NULLABLE_CURRENCY_CODE.validate(null) // null
71
71
  * @see https://dhoulb.github.io/shelving/schema/CurrencyCodeSchema/NULLABLE_CURRENCY_CODE
@@ -67,14 +67,14 @@ export class CurrencyCodeSchema extends StringSchema {
67
67
  }
68
68
  }
69
69
  /**
70
- * Valid currency code, e.g. `GBP` (required because falsy values are invalid).
70
+ * Sugar instance of [`CurrencyCodeSchema`](/schema/CurrencyCodeSchema) for a required ISO 4217 currency code, e.g. `GBP`. Equivalent to `new CurrencyCodeSchema({})`.
71
71
  *
72
72
  * @example CURRENCY_CODE.validate("gbp") // "GBP"
73
73
  * @see https://dhoulb.github.io/shelving/schema/CurrencyCodeSchema/CURRENCY_CODE
74
74
  */
75
75
  export const CURRENCY_CODE = new CurrencyCodeSchema({});
76
76
  /**
77
- * Valid currency code, e.g. `GBP`, or `null`.
77
+ * Sugar instance allowing a [`CURRENCY_CODE`](/schema/CURRENCY_CODE) or `null`. Equivalent to `NULLABLE(CURRENCY_CODE)`.
78
78
  *
79
79
  * @example NULLABLE_CURRENCY_CODE.validate(null) // null
80
80
  * @see https://dhoulb.github.io/shelving/schema/CurrencyCodeSchema/NULLABLE_CURRENCY_CODE
@@ -78,7 +78,7 @@ export declare class DataSchema<T extends Data> extends Schema<unknown> {
78
78
  /**
79
79
  * Create a `DataSchema` for a set of properties.
80
80
  *
81
- * *Factory for `DataSchema`.*
81
+ * Sugar factory for [`DataSchema`](/schema/DataSchema).
82
82
  *
83
83
  * @param props A named schema for each property of the data object.
84
84
  * @returns A `DataSchema` validating data with the given props.
@@ -89,7 +89,7 @@ export declare function DATA<T extends Data>(props: Schemas<T>): DataSchema<T>;
89
89
  /**
90
90
  * Create a schema for a valid data object with specified properties, or `null`.
91
91
  *
92
- * *Factory for `NullableSchema`.*
92
+ * Sugar factory for [`NullableSchema`](/schema/NullableSchema).
93
93
  *
94
94
  * @param props A named schema for each property of the data object.
95
95
  * @returns A `NullableSchema` wrapping a `DataSchema` with the given props.
@@ -100,7 +100,7 @@ export declare function NULLABLE_DATA<T extends Data>(props: Schemas<T>): Nullab
100
100
  /**
101
101
  * Create a `DataSchema` that validates partially, i.e. every property can be its value or `undefined`.
102
102
  *
103
- * *Factory for `DataSchema`.*
103
+ * Sugar factory for [`DataSchema`](/schema/DataSchema).
104
104
  *
105
105
  * @param source The props schemas or an existing `DataSchema` to make partial.
106
106
  * @returns A `DataSchema` whose every property is optional.
@@ -111,7 +111,7 @@ export declare function PARTIAL<T extends Data>(source: Schemas<T> | DataSchema<
111
111
  /**
112
112
  * Create a `DataSchema` that validates a data item, i.e. it has a string or number `.id` identifier property.
113
113
  *
114
- * *Factory for `DataSchema`.*
114
+ * Sugar factory for [`DataSchema`](/schema/DataSchema).
115
115
  *
116
116
  * @param id Schema for the item's `id` identifier property.
117
117
  * @param schemas The props schemas or an existing `DataSchema` for the rest of the item.
@@ -85,7 +85,7 @@ function _getSchemaValue([, { value }]) {
85
85
  /**
86
86
  * Create a `DataSchema` for a set of properties.
87
87
  *
88
- * *Factory for `DataSchema`.*
88
+ * Sugar factory for [`DataSchema`](/schema/DataSchema).
89
89
  *
90
90
  * @param props A named schema for each property of the data object.
91
91
  * @returns A `DataSchema` validating data with the given props.
@@ -98,7 +98,7 @@ export function DATA(props) {
98
98
  /**
99
99
  * Create a schema for a valid data object with specified properties, or `null`.
100
100
  *
101
- * *Factory for `NullableSchema`.*
101
+ * Sugar factory for [`NullableSchema`](/schema/NullableSchema).
102
102
  *
103
103
  * @param props A named schema for each property of the data object.
104
104
  * @returns A `NullableSchema` wrapping a `DataSchema` with the given props.
@@ -120,7 +120,7 @@ function _optionalProp([, v]) {
120
120
  /**
121
121
  * Create a `DataSchema` that validates a data item, i.e. it has a string or number `.id` identifier property.
122
122
  *
123
- * *Factory for `DataSchema`.*
123
+ * Sugar factory for [`DataSchema`](/schema/DataSchema).
124
124
  *
125
125
  * @param id Schema for the item's `id` identifier property.
126
126
  * @param schemas The props schemas or an existing `DataSchema` for the rest of the item.
@@ -88,14 +88,14 @@ export declare class DateSchema extends Schema<string> {
88
88
  format(value: string): string;
89
89
  }
90
90
  /**
91
- * Valid date, e.g. `2005-09-12` (required because falsy values are invalid).
91
+ * Sugar instance of [`DateSchema`](/schema/DateSchema) for a required date. Equivalent to `new DateSchema({})`.
92
92
  *
93
93
  * @example DATE.validate("2005-09-12") // "2005-09-12"
94
94
  * @see https://dhoulb.github.io/shelving/schema/DateSchema/DATE
95
95
  */
96
96
  export declare const DATE: DateSchema;
97
97
  /**
98
- * Valid date, e.g. `2005-09-12`, or `null`.
98
+ * Sugar instance allowing a [`DATE`](/schema/DATE) or `null`. Equivalent to `NULLABLE(DATE)`.
99
99
  *
100
100
  * @example NULLABLE_DATE.validate(null) // null
101
101
  * @see https://dhoulb.github.io/shelving/schema/DateSchema/NULLABLE_DATE
@@ -79,14 +79,14 @@ export class DateSchema extends Schema {
79
79
  }
80
80
  }
81
81
  /**
82
- * Valid date, e.g. `2005-09-12` (required because falsy values are invalid).
82
+ * Sugar instance of [`DateSchema`](/schema/DateSchema) for a required date. Equivalent to `new DateSchema({})`.
83
83
  *
84
84
  * @example DATE.validate("2005-09-12") // "2005-09-12"
85
85
  * @see https://dhoulb.github.io/shelving/schema/DateSchema/DATE
86
86
  */
87
87
  export const DATE = new DateSchema({});
88
88
  /**
89
- * Valid date, e.g. `2005-09-12`, or `null`.
89
+ * Sugar instance allowing a [`DATE`](/schema/DATE) or `null`. Equivalent to `NULLABLE(DATE)`.
90
90
  *
91
91
  * @example NULLABLE_DATE.validate(null) // null
92
92
  * @see https://dhoulb.github.io/shelving/schema/DateSchema/NULLABLE_DATE
@@ -38,14 +38,14 @@ export declare class DateTimeSchema extends DateSchema {
38
38
  format(value: string): string;
39
39
  }
40
40
  /**
41
- * Valid datetime, e.g. `2005-09-12T08:00:00Z` (required because falsy values are invalid).
41
+ * Sugar instance of [`DateTimeSchema`](/schema/DateTimeSchema) for a required UTC datetime. Equivalent to `new DateTimeSchema({})`.
42
42
  *
43
43
  * @example DATETIME.validate("2005-09-12T08:00:00Z") // "2005-09-12T08:00:00.000Z"
44
44
  * @see https://dhoulb.github.io/shelving/schema/DateTimeSchema/DATETIME
45
45
  */
46
46
  export declare const DATETIME: DateTimeSchema;
47
47
  /**
48
- * Valid datetime, e.g. `2005-09-12T21:30:00Z`, or `null`.
48
+ * Sugar instance allowing a [`DATETIME`](/schema/DATETIME) or `null`. Equivalent to `NULLABLE(DATETIME)`.
49
49
  *
50
50
  * @example NULLABLE_DATETIME.validate(null) // null
51
51
  * @see https://dhoulb.github.io/shelving/schema/DateTimeSchema/NULLABLE_DATETIME
@@ -46,14 +46,14 @@ export class DateTimeSchema extends DateSchema {
46
46
  }
47
47
  }
48
48
  /**
49
- * Valid datetime, e.g. `2005-09-12T08:00:00Z` (required because falsy values are invalid).
49
+ * Sugar instance of [`DateTimeSchema`](/schema/DateTimeSchema) for a required UTC datetime. Equivalent to `new DateTimeSchema({})`.
50
50
  *
51
51
  * @example DATETIME.validate("2005-09-12T08:00:00Z") // "2005-09-12T08:00:00.000Z"
52
52
  * @see https://dhoulb.github.io/shelving/schema/DateTimeSchema/DATETIME
53
53
  */
54
54
  export const DATETIME = new DateTimeSchema({});
55
55
  /**
56
- * Valid datetime, e.g. `2005-09-12T21:30:00Z`, or `null`.
56
+ * Sugar instance allowing a [`DATETIME`](/schema/DATETIME) or `null`. Equivalent to `NULLABLE(DATETIME)`.
57
57
  *
58
58
  * @example NULLABLE_DATETIME.validate(null) // null
59
59
  * @see https://dhoulb.github.io/shelving/schema/DateTimeSchema/NULLABLE_DATETIME
@@ -62,7 +62,7 @@ export declare class DictionarySchema<T> extends Schema<ImmutableDictionary<T>>
62
62
  /**
63
63
  * Create a schema for a valid dictionary object with specified entry values.
64
64
  *
65
- * *Factory for `DictionarySchema`.*
65
+ * Sugar factory for [`DictionarySchema`](/schema/DictionarySchema).
66
66
  *
67
67
  * @param items Schema every entry value in the dictionary must conform to.
68
68
  * @returns A `DictionarySchema` validating dictionaries of the given item type.
@@ -64,7 +64,7 @@ export class DictionarySchema extends Schema {
64
64
  /**
65
65
  * Create a schema for a valid dictionary object with specified entry values.
66
66
  *
67
- * *Factory for `DictionarySchema`.*
67
+ * Sugar factory for [`DictionarySchema`](/schema/DictionarySchema).
68
68
  *
69
69
  * @param items Schema every entry value in the dictionary must conform to.
70
70
  * @returns A `DictionarySchema` validating dictionaries of the given item type.