@coffer-org/sdk 1.1.0 → 1.2.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 (69) hide show
  1. package/dist/color-names.d.ts +0 -1
  2. package/dist/color-names.js +0 -1
  3. package/dist/condition.d.ts +3 -19
  4. package/dist/condition.js +50 -69
  5. package/dist/countries.d.ts +0 -2
  6. package/dist/countries.js +0 -1
  7. package/dist/currencies.d.ts +0 -10
  8. package/dist/currencies.js +0 -10
  9. package/dist/extend.d.ts +3 -22
  10. package/dist/extend.js +2 -6
  11. package/dist/field-helpers.d.ts +0 -7
  12. package/dist/field-helpers.js +0 -16
  13. package/dist/field-presets.d.ts +55 -87
  14. package/dist/field-presets.js +116 -108
  15. package/dist/fields/constants.d.ts +36 -0
  16. package/dist/fields/constants.js +18 -0
  17. package/dist/fields/normalize.d.ts +84 -0
  18. package/dist/fields/normalize.js +47 -0
  19. package/dist/fields/url.d.ts +13 -0
  20. package/dist/fields/url.js +49 -0
  21. package/dist/fields/validation.d.ts +30 -0
  22. package/dist/fields/validation.js +57 -0
  23. package/dist/fields.d.ts +222 -332
  24. package/dist/fields.js +435 -351
  25. package/dist/index.d.ts +14 -16
  26. package/dist/index.js +14 -16
  27. package/dist/module.d.ts +13 -103
  28. package/dist/module.js +51 -83
  29. package/dist/package.d.ts +3 -20
  30. package/dist/package.js +14 -19
  31. package/dist/plugin.d.ts +5 -45
  32. package/dist/plugin.js +5 -19
  33. package/dist/settings.d.ts +1 -2
  34. package/dist/settings.js +0 -1
  35. package/dist/units.d.ts +0 -1
  36. package/dist/units.js +0 -5
  37. package/dist/vault.d.ts +3 -8
  38. package/dist/vault.js +4 -1
  39. package/package.json +5 -1
  40. package/dist/color-names.d.ts.map +0 -1
  41. package/dist/color-names.js.map +0 -1
  42. package/dist/condition.d.ts.map +0 -1
  43. package/dist/condition.js.map +0 -1
  44. package/dist/countries.d.ts.map +0 -1
  45. package/dist/countries.js.map +0 -1
  46. package/dist/currencies.d.ts.map +0 -1
  47. package/dist/currencies.js.map +0 -1
  48. package/dist/extend.d.ts.map +0 -1
  49. package/dist/extend.js.map +0 -1
  50. package/dist/field-helpers.d.ts.map +0 -1
  51. package/dist/field-helpers.js.map +0 -1
  52. package/dist/field-presets.d.ts.map +0 -1
  53. package/dist/field-presets.js.map +0 -1
  54. package/dist/fields.d.ts.map +0 -1
  55. package/dist/fields.js.map +0 -1
  56. package/dist/index.d.ts.map +0 -1
  57. package/dist/index.js.map +0 -1
  58. package/dist/module.d.ts.map +0 -1
  59. package/dist/module.js.map +0 -1
  60. package/dist/package.d.ts.map +0 -1
  61. package/dist/package.js.map +0 -1
  62. package/dist/plugin.d.ts.map +0 -1
  63. package/dist/plugin.js.map +0 -1
  64. package/dist/settings.d.ts.map +0 -1
  65. package/dist/settings.js.map +0 -1
  66. package/dist/units.d.ts.map +0 -1
  67. package/dist/units.js.map +0 -1
  68. package/dist/vault.d.ts.map +0 -1
  69. package/dist/vault.js.map +0 -1
@@ -4,4 +4,3 @@ export interface NamedColor {
4
4
  }
5
5
  export declare const BASIC_COLORS: NamedColor[];
6
6
  export declare const COLOR_LABELS: Record<'en' | 'ru' | 'uk', Record<string, string>>;
7
- //# sourceMappingURL=color-names.d.ts.map
@@ -460,4 +460,3 @@ export const COLOR_LABELS = {
460
460
  'faded-very-dark-pink': 'Темне рожеве дерево (дуже тьмяний темний рожевий)',
461
461
  },
462
462
  };
463
- //# sourceMappingURL=color-names.js.map
@@ -1,18 +1,3 @@
1
- /**
2
- * Умовний DSL для показу extend-блоків (та інших UI-концернів).
3
- *
4
- * Оцінюється над значеннями форми (`values`), де значення —
5
- * рядки/boolean, а multiple-поля — JSON-рядок масиву ('["a","b"]').
6
- * Порівняння нестроге: скаляри зводяться через `String`,
7
- * числові оператори — через `Number`.
8
- *
9
- * Приклад:
10
- * { type: 'device', $or: [{ os: 'linux' }, { os: 'macos' }] }
11
- * → видно, коли type=device І (os=linux АБО os=macos)
12
- *
13
- * { tags: { $contains: 'fpv' } }
14
- * → видно, коли multiple-поле tags містить 'fpv'
15
- */
16
1
  export type Scalar = string | number | boolean;
17
2
  export interface FieldPredicate {
18
3
  $eq?: Scalar;
@@ -31,8 +16,7 @@ export interface Condition {
31
16
  $and?: Condition[];
32
17
  $or?: Condition[];
33
18
  }
34
- type Values = Record<string, unknown>;
35
- /** Оцінити умову проти значень форми. Порожня/undefined умова → true. */
19
+ export type Values = Record<string, unknown>;
36
20
  export declare function evalCondition(cond: Condition | undefined, values: Values): boolean;
37
- export {};
38
- //# sourceMappingURL=condition.d.ts.map
21
+ export declare function resolveFlag(v: boolean | Condition | undefined, values: Values): boolean;
22
+ export declare function describeCondition(cond: Condition | undefined, labelOf: (field: string) => string, valueLabelOf?: (field: string, value: Scalar) => string): string[];
package/dist/condition.js CHANGED
@@ -1,109 +1,90 @@
1
+ import sift from 'sift';
2
+ const createEqualsOperation = sift
3
+ .createEqualsOperation;
1
4
  const isScalar = (v) => typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean';
2
5
  const eqLoose = (a, b) => String(a) === String(b);
3
- const cmpNumber = (a, b, op) => {
4
- const x = Number(a);
5
- const y = Number(b);
6
- if (Number.isNaN(x) || Number.isNaN(y))
7
- return false;
8
- return op(x, y);
6
+ const _siftOperations = {
7
+ $contains(params, ownerQuery, options) {
8
+ return createEqualsOperation((value) => Array.isArray(value) && value.some((el) => eqLoose(el, params)), ownerQuery, options);
9
+ },
9
10
  };
10
- /**
11
- * Нормалізувати значення поля у масив для membership-перевірок.
12
- * Multiple-поля зберігаються у формі як JSON-рядок масиву ('["a","b"]').
13
- * Скаляр трактується як масив з одного елемента.
14
- */
15
- const asArray = (v) => {
16
- if (Array.isArray(v))
17
- return v;
18
- if (typeof v === 'string') {
19
- try {
20
- const parsed = JSON.parse(v);
21
- if (Array.isArray(parsed))
22
- return parsed;
23
- }
24
- catch {
25
- // не JSON — трактуємо як скаляр нижче
26
- }
11
+ export function evalCondition(cond, values) {
12
+ if (!cond)
13
+ return true;
14
+ try {
15
+ return sift(cond, { operations: _siftOperations })(values);
27
16
  }
28
- return [v];
29
- };
30
- /** Оцінити предикат одного поля проти значення форми. */
31
- function evalPredicate(pred, value, present) {
32
- if (isScalar(pred)) {
33
- return present && eqLoose(value, pred);
17
+ catch {
18
+ return false;
34
19
  }
35
- // Об'єкт-предикат: усі задані оператори в кон'юнкції (AND).
20
+ }
21
+ export function resolveFlag(v, values) {
22
+ return typeof v === 'boolean' ? v : v ? evalCondition(v, values) : false;
23
+ }
24
+ function describePredicate(label, pred, vl) {
25
+ if (isScalar(pred))
26
+ return [`${label} = ${vl(pred)}`];
27
+ const out = [];
36
28
  for (const [op, operand] of Object.entries(pred)) {
37
29
  if (operand === undefined)
38
30
  continue;
39
31
  switch (op) {
40
32
  case '$eq':
41
- if (!present || !eqLoose(value, operand))
42
- return false;
33
+ out.push(`${label} = ${vl(operand)}`);
43
34
  break;
44
35
  case '$ne':
45
- // Відсутнє значення трактуємо як "не дорівнює" → проходить.
46
- if (present && eqLoose(value, operand))
47
- return false;
48
- break;
49
- case '$in':
50
- if (!present || !operand.some((o) => eqLoose(value, o)))
51
- return false;
52
- break;
53
- case '$nin':
54
- // Відсутнє значення → точно немає у списку → проходить.
55
- if (present && operand.some((o) => eqLoose(value, o)))
56
- return false;
36
+ out.push(`${label} ${vl(operand)}`);
57
37
  break;
58
38
  case '$gt':
59
- if (!present || !cmpNumber(value, operand, (x, y) => x > y))
60
- return false;
39
+ out.push(`${label} > ${String(operand)}`);
61
40
  break;
62
41
  case '$lt':
63
- if (!present || !cmpNumber(value, operand, (x, y) => x < y))
64
- return false;
42
+ out.push(`${label} < ${String(operand)}`);
65
43
  break;
66
44
  case '$gte':
67
- if (!present || !cmpNumber(value, operand, (x, y) => x >= y))
68
- return false;
45
+ out.push(`${label} ${String(operand)}`);
69
46
  break;
70
47
  case '$lte':
71
- if (!present || !cmpNumber(value, operand, (x, y) => x <= y))
72
- return false;
48
+ out.push(`${label} ${String(operand)}`);
49
+ break;
50
+ case '$in':
51
+ out.push(`${label} ∈ {${operand.map(vl).join(', ')}}`);
52
+ break;
53
+ case '$nin':
54
+ out.push(`${label} ∉ {${operand.map(vl).join(', ')}}`);
73
55
  break;
74
56
  case '$contains':
75
- if (!present || !asArray(value).some((el) => eqLoose(el, operand)))
76
- return false;
57
+ out.push(`${label} contains ${vl(operand)}`);
77
58
  break;
78
59
  default:
79
- // Невідомий оператор — ігноруємо (forward-compat).
80
60
  break;
81
61
  }
82
62
  }
83
- return true;
63
+ return out;
84
64
  }
85
- /** Оцінити умову проти значень форми. Порожня/undefined умова → true. */
86
- export function evalCondition(cond, values) {
65
+ export function describeCondition(cond, labelOf, valueLabelOf) {
87
66
  if (!cond)
88
- return true;
67
+ return [];
68
+ const out = [];
89
69
  for (const [key, spec] of Object.entries(cond)) {
90
70
  if (spec === undefined)
91
71
  continue;
92
72
  if (key === '$and') {
93
- if (!spec.every((c) => evalCondition(c, values)))
94
- return false;
73
+ for (const c of spec)
74
+ out.push(...describeCondition(c, labelOf, valueLabelOf));
95
75
  continue;
96
76
  }
97
77
  if (key === '$or') {
98
- if (!spec.some((c) => evalCondition(c, values)))
99
- return false;
78
+ const branches = spec
79
+ .map((c) => describeCondition(c, labelOf, valueLabelOf))
80
+ .filter((cl) => cl.length > 0)
81
+ .map((cl) => (cl.length > 1 ? `(${cl.join(' and ')})` : cl[0]));
82
+ if (branches.length)
83
+ out.push(branches.join(' or '));
100
84
  continue;
101
85
  }
102
- // Ключ-поле: implicit AND із рештою.
103
- const present = Object.prototype.hasOwnProperty.call(values, key) && values[key] != null;
104
- if (!evalPredicate(spec, values[key], present))
105
- return false;
86
+ const vl = (v) => (valueLabelOf ? valueLabelOf(key, v) : String(v));
87
+ out.push(...describePredicate(labelOf(key), spec, vl));
106
88
  }
107
- return true;
89
+ return out;
108
90
  }
109
- //# sourceMappingURL=condition.js.map
@@ -1,8 +1,6 @@
1
- /** Список країн: ISO 3166-1 alpha-2 → назва (українська). */
2
1
  export interface Country {
3
2
  code: string;
4
3
  name: string;
5
4
  }
6
5
  export declare const COUNTRIES: Country[];
7
6
  export declare const COUNTRIES_BY_CODE: Map<string, Country>;
8
- //# sourceMappingURL=countries.d.ts.map
package/dist/countries.js CHANGED
@@ -194,4 +194,3 @@ export const COUNTRIES = [
194
194
  { code: 'ZW', name: 'Зімбабве' },
195
195
  ];
196
196
  export const COUNTRIES_BY_CODE = new Map(COUNTRIES.map((c) => [c.code, c]));
197
- //# sourceMappingURL=countries.js.map
@@ -1,14 +1,4 @@
1
- /**
2
- * Валюти з вбудованого `Intl` (ISO 4217) — БЕЗ hand-list і без npm-залежності.
3
- * Коди — `Intl.supportedValuesOf('currency')`; символи/назви локалізовані через
4
- * `Intl.NumberFormat`/`Intl.DisplayNames`.
5
- */
6
- /** Усі ISO 4217 коди. Fallback — кілька основних (на випадок старого рантайму). */
7
1
  export declare const CURRENCY_CODES: string[];
8
- /** Чи валідний ISO 4217 код. */
9
2
  export declare const isCurrencyCode: (c: string) => boolean;
10
- /** Символ валюти (narrowSymbol) для локалі; fallback — сам код. */
11
3
  export declare function currencySymbol(code: string, locale?: string): string;
12
- /** Локалізована назва валюти; fallback — сам код. */
13
4
  export declare function currencyName(code: string, locale?: string): string;
14
- //# sourceMappingURL=currencies.d.ts.map
@@ -1,9 +1,3 @@
1
- /**
2
- * Валюти з вбудованого `Intl` (ISO 4217) — БЕЗ hand-list і без npm-залежності.
3
- * Коди — `Intl.supportedValuesOf('currency')`; символи/назви локалізовані через
4
- * `Intl.NumberFormat`/`Intl.DisplayNames`.
5
- */
6
- /** Усі ISO 4217 коди. Fallback — кілька основних (на випадок старого рантайму). */
7
1
  export const CURRENCY_CODES = (() => {
8
2
  try {
9
3
  return Intl.supportedValuesOf('currency');
@@ -13,9 +7,7 @@ export const CURRENCY_CODES = (() => {
13
7
  }
14
8
  })();
15
9
  const CODE_SET = new Set(CURRENCY_CODES);
16
- /** Чи валідний ISO 4217 код. */
17
10
  export const isCurrencyCode = (c) => CODE_SET.has(c);
18
- /** Символ валюти (narrowSymbol) для локалі; fallback — сам код. */
19
11
  export function currencySymbol(code, locale) {
20
12
  try {
21
13
  const part = new Intl.NumberFormat(locale, { style: 'currency', currency: code, currencyDisplay: 'narrowSymbol' })
@@ -27,7 +19,6 @@ export function currencySymbol(code, locale) {
27
19
  return code;
28
20
  }
29
21
  }
30
- /** Локалізована назва валюти; fallback — сам код. */
31
22
  export function currencyName(code, locale = 'en') {
32
23
  try {
33
24
  return new Intl.DisplayNames([locale], { type: 'currency' }).of(code) ?? code;
@@ -36,4 +27,3 @@ export function currencyName(code, locale = 'en') {
36
27
  return code;
37
28
  }
38
29
  }
39
- //# sourceMappingURL=currencies.js.map
package/dist/extend.d.ts CHANGED
@@ -1,20 +1,5 @@
1
- /**
2
- * Extend-механізм: 1:1 розширення сутності за правилами прив'язки.
3
- *
4
- * Прив'язка (attachTo) — структурна, лише за vault/module:
5
- * - vault тільки: { vault: 'things' } (будь-який модуль)
6
- * - vault + module: { vault: 'things', module: 'item' }
7
- *
8
- * Показ блоку — окремий UI-концерн через `showWhen` (Condition над
9
- * значеннями запису). Оцінюється на фронті. Без `showWhen` — блок
10
- * показується завжди для своїх vault/module.
11
- *
12
- * Зберігання: окрема таблиця `extend__<id>` з `base_id TEXT PK (FK → base table)`.
13
- * API: поле `_extends` у відповіді: { device_info: {...} }.
14
- * Форма: авто-секція під основними полями.
15
- */
16
- import type { LayoutEl } from './fields.js';
17
- import type { Condition } from './condition.js';
1
+ import type { LayoutEl } from './fields.ts';
2
+ import type { Condition } from './condition.ts';
18
3
  import { z } from 'zod';
19
4
  export interface AttachRule {
20
5
  vault: string;
@@ -30,17 +15,13 @@ export interface ExtendDef {
30
15
  claude?: string;
31
16
  }
32
17
  export declare function defineExtend(e: ExtendDef): ExtendDef;
33
- /** Перевірити чи extend прив'язується до сутності з даним vault/module. */
34
18
  export declare function extendMatches(e: ExtendDef, vault: string, module: string): boolean;
35
- /** Zod-схема extend'у для PATCH-валідації (усі поля опціональні). */
36
19
  export declare function buildExtendZodPartial(e: ExtendDef): z.ZodObject<z.ZodRawShape>;
37
- /** Серіалізована форма extend'у для клієнта. */
38
20
  export declare function extendToClient(e: ExtendDef): {
39
21
  id: string;
40
22
  label: string;
41
23
  icon: string | undefined;
42
24
  attachTo: AttachRule[];
43
25
  showWhen: Condition | undefined;
44
- fields: import("./module.js").LayoutElClient[];
26
+ fields: import("./module.ts").LayoutElClient[];
45
27
  };
46
- //# sourceMappingURL=extend.d.ts.map
package/dist/extend.js CHANGED
@@ -1,13 +1,12 @@
1
- import { layoutToClient, fieldEntries, buildShape } from './module.js';
1
+ import { layoutToClient, fieldEntries, buildShape } from "./module.js";
2
2
  import { z } from 'zod';
3
3
  export function defineExtend(e) {
4
4
  const keys = fieldEntries(e.fields).map(([k]) => k);
5
5
  const dup = keys.find((k, i) => keys.indexOf(k) !== i);
6
6
  if (dup)
7
- throw new Error(`[extend] ${e.id}: дубльований key '${dup}'`);
7
+ throw new Error(`[extend] ${e.id}: duplicate key '${dup}'`);
8
8
  return e;
9
9
  }
10
- /** Перевірити чи extend прив'язується до сутності з даним vault/module. */
11
10
  export function extendMatches(e, vault, module) {
12
11
  return e.attachTo.some((rule) => {
13
12
  if (rule.vault !== vault)
@@ -17,11 +16,9 @@ export function extendMatches(e, vault, module) {
17
16
  return true;
18
17
  });
19
18
  }
20
- /** Zod-схема extend'у для PATCH-валідації (усі поля опціональні). */
21
19
  export function buildExtendZodPartial(e) {
22
20
  return z.object(buildShape(e.fields, true));
23
21
  }
24
- /** Серіалізована форма extend'у для клієнта. */
25
22
  export function extendToClient(e) {
26
23
  return {
27
24
  id: e.id,
@@ -32,4 +29,3 @@ export function extendToClient(e) {
32
29
  fields: layoutToClient(e.fields),
33
30
  };
34
31
  }
35
- //# sourceMappingURL=extend.js.map
@@ -1,9 +1,2 @@
1
1
  export declare function parseMultiple(raw: string | unknown): unknown[];
2
2
  export declare function serializeMultiple(items: unknown[]): string;
3
- export type PerRecordRow = {
4
- recordId: string;
5
- value: unknown;
6
- };
7
- export declare function parsePerRecord(raw: string | unknown): PerRecordRow[];
8
- export declare function serializePerRecord(items: PerRecordRow[]): string;
9
- //# sourceMappingURL=field-helpers.d.ts.map
@@ -12,19 +12,3 @@ export function parseMultiple(raw) {
12
12
  export function serializeMultiple(items) {
13
13
  return items.length ? JSON.stringify(items) : '';
14
14
  }
15
- export function parsePerRecord(raw) {
16
- if (typeof raw !== 'string' || !raw)
17
- return [];
18
- try {
19
- const v = JSON.parse(raw);
20
- return Array.isArray(v) ? v : [];
21
- }
22
- catch {
23
- return [];
24
- }
25
- }
26
- export function serializePerRecord(items) {
27
- const filled = items.filter((r) => r.value !== '' && r.value !== undefined);
28
- return filled.length ? JSON.stringify(filled) : '';
29
- }
30
- //# sourceMappingURL=field-helpers.js.map
@@ -1,11 +1,7 @@
1
- import { type FieldMeta, type FieldItem, type StaticEl, type FieldCoreOpts, type FieldConfig, type RealOpts, type IntOpts } from './fields.js';
2
- /** Базові opts для текстових пресетів (pattern/validation задає сам пресет). */
1
+ import { type FieldMeta, type FieldItem, type StaticEl, type FieldCoreOpts } from './fields.ts';
3
2
  export interface TextPresetOpts extends FieldCoreOpts {
4
3
  label?: string;
5
- required?: boolean;
6
- multiple?: boolean;
7
4
  }
8
- /** Email — kind 'email', email-валідація, inputType 'email'. */
9
5
  export declare function email(o: TextPresetOpts & {
10
6
  key: string;
11
7
  }): FieldItem;
@@ -17,19 +13,6 @@ export declare function email(o: TextPresetOpts & {
17
13
  key?: undefined;
18
14
  value?: undefined;
19
15
  }): FieldMeta;
20
- /** URL — kind 'url', url-валідація, inputType 'url'. */
21
- export declare function url(o: TextPresetOpts & {
22
- key: string;
23
- }): FieldItem;
24
- export declare function url(o: TextPresetOpts & {
25
- value: unknown;
26
- key?: undefined;
27
- }): StaticEl;
28
- export declare function url(o: TextPresetOpts & {
29
- key?: undefined;
30
- value?: undefined;
31
- }): FieldMeta;
32
- /** Телефон — kind 'tel', inputType 'tel'. Без строгої схеми (формати різні). */
33
16
  export declare function tel(o: TextPresetOpts & {
34
17
  key: string;
35
18
  }): FieldItem;
@@ -41,7 +24,6 @@ export declare function tel(o: TextPresetOpts & {
41
24
  key?: undefined;
42
25
  value?: undefined;
43
26
  }): FieldMeta;
44
- /** Пароль — kind 'password', inputType 'password'. Без строгої схеми. */
45
27
  export declare function password(o: TextPresetOpts & {
46
28
  key: string;
47
29
  }): FieldItem;
@@ -53,7 +35,6 @@ export declare function password(o: TextPresetOpts & {
53
35
  key?: undefined;
54
36
  value?: undefined;
55
37
  }): FieldMeta;
56
- /** Slug — kind 'slug', `^[a-z0-9-]+$`. */
57
38
  export declare function slug(o: TextPresetOpts & {
58
39
  key: string;
59
40
  }): FieldItem;
@@ -65,7 +46,6 @@ export declare function slug(o: TextPresetOpts & {
65
46
  key?: undefined;
66
47
  value?: undefined;
67
48
  }): FieldMeta;
68
- /** Hex-колір — kind 'color', `#rrggbb` + swatch-widget. */
69
49
  export declare function color(o: TextPresetOpts & {
70
50
  key: string;
71
51
  }): FieldItem;
@@ -77,7 +57,6 @@ export declare function color(o: TextPresetOpts & {
77
57
  key?: undefined;
78
58
  value?: undefined;
79
59
  }): FieldMeta;
80
- /** Назва кольору CSS — kind 'colorname'. */
81
60
  export declare function colorname(o: TextPresetOpts & {
82
61
  key: string;
83
62
  }): FieldItem;
@@ -89,7 +68,6 @@ export declare function colorname(o: TextPresetOpts & {
89
68
  key?: undefined;
90
69
  value?: undefined;
91
70
  }): FieldMeta;
92
- /** Заголовок модуля — kind 'title'. Heading-рендер. */
93
71
  export declare function title(o: TextPresetOpts & {
94
72
  key: string;
95
73
  }): FieldItem;
@@ -101,69 +79,46 @@ export declare function title(o: TextPresetOpts & {
101
79
  key?: undefined;
102
80
  value?: undefined;
103
81
  }): FieldMeta;
104
- /** IMEI kind 'imei', 15-digit pattern. */
105
- export declare function imei(o: TextPresetOpts & {
82
+ export declare function link(o: TextPresetOpts & {
106
83
  key: string;
107
84
  }): FieldItem;
108
- export declare function imei(o: TextPresetOpts & {
85
+ export declare function link(o: TextPresetOpts & {
109
86
  value: unknown;
110
87
  key?: undefined;
111
88
  }): StaticEl;
112
- export declare function imei(o: TextPresetOpts & {
89
+ export declare function link(o: TextPresetOpts & {
113
90
  key?: undefined;
114
91
  value?: undefined;
115
92
  }): FieldMeta;
116
- /** MAC-адреса kind 'mac', XX:XX:XX:XX:XX:XX (роздільник `:` або `-`). */
117
- export declare function mac(o: TextPresetOpts & {
118
- key: string;
119
- }): FieldItem;
120
- export declare function mac(o: TextPresetOpts & {
121
- value: unknown;
122
- key?: undefined;
123
- }): StaticEl;
124
- export declare function mac(o: TextPresetOpts & {
125
- key?: undefined;
126
- value?: undefined;
127
- }): FieldMeta;
128
- /** IBAN — kind 'iban', 2 літери + 2 цифри + 11–30 буквоцифр. */
129
- export declare function iban(o: TextPresetOpts & {
93
+ export interface TagOpts extends FieldCoreOpts {
94
+ label?: string;
95
+ options?: string | string[];
96
+ }
97
+ export declare function tag(o: TagOpts & {
130
98
  key: string;
131
99
  }): FieldItem;
132
- export declare function iban(o: TextPresetOpts & {
100
+ export declare function tag(o: TagOpts & {
133
101
  value: unknown;
134
102
  key?: undefined;
135
103
  }): StaticEl;
136
- export declare function iban(o: TextPresetOpts & {
104
+ export declare function tag(o: TagOpts & {
137
105
  key?: undefined;
138
106
  value?: undefined;
139
107
  }): FieldMeta;
140
- export interface TagsOpts extends FieldCoreOpts {
141
- label?: string;
142
- required?: boolean;
143
- /**
144
- * Підказки автодоповнення або іменоване джерело.
145
- * string → іменований список (UI тільки); array → inline підказки.
146
- * Не валідуються — тільки UI.
147
- */
148
- options?: string | string[];
149
- }
150
- /** Теги — масив непорожніх рядків + chip-widget. */
151
- export declare function tags(o: TagsOpts & {
108
+ export declare function tags(o: TagOpts & {
152
109
  key: string;
153
110
  }): FieldItem;
154
- export declare function tags(o: TagsOpts & {
111
+ export declare function tags(o: TagOpts & {
155
112
  value: unknown;
156
113
  key?: undefined;
157
114
  }): StaticEl;
158
- export declare function tags(o: TagsOpts & {
115
+ export declare function tags(o: TagOpts & {
159
116
  key?: undefined;
160
117
  value?: undefined;
161
118
  }): FieldMeta;
162
119
  type MarkdownOpts = {
163
120
  label?: string;
164
- required?: boolean;
165
121
  } & FieldCoreOpts;
166
- /** Markdown — text() + markdown-редактор. */
167
122
  export declare function markdown(o: MarkdownOpts & {
168
123
  key: string;
169
124
  }): FieldItem;
@@ -177,12 +132,7 @@ export declare function markdown(o: MarkdownOpts & {
177
132
  }): FieldMeta;
178
133
  type CodeOpts = {
179
134
  label?: string;
180
- required?: boolean;
181
135
  } & FieldCoreOpts;
182
- /**
183
- * Сніпет коду — text() + моноширинний редактор коду.
184
- * `config.language` — підказка підсвітки (json/yaml/bash/ini…), зберігається у hints.
185
- */
186
136
  export declare function snippet(o: CodeOpts & {
187
137
  key: string;
188
138
  }): FieldItem;
@@ -196,11 +146,7 @@ export declare function snippet(o: CodeOpts & {
196
146
  }): FieldMeta;
197
147
  export interface RatingOpts extends FieldCoreOpts {
198
148
  label?: string;
199
- required?: boolean;
200
- max?: number;
201
- multiple?: boolean;
202
149
  }
203
- /** Оцінка 1..N — integer + star-widget. */
204
150
  export declare function rating(o: RatingOpts & {
205
151
  key: string;
206
152
  }): FieldItem;
@@ -214,14 +160,7 @@ export declare function rating(o: RatingOpts & {
214
160
  }): FieldMeta;
215
161
  export interface DurationOpts extends FieldCoreOpts {
216
162
  label?: string;
217
- required?: boolean;
218
- /** Maximum value in seconds. Default: 604800 (1 week). */
219
- max?: number;
220
- /** Step in seconds. Default: 60. */
221
- step?: number;
222
- multiple?: boolean;
223
163
  }
224
- /** Тривалість у секундах — integer + duration-widget («2д 3год 30хв 15с»). */
225
164
  export declare function duration(o: DurationOpts & {
226
165
  key: string;
227
166
  }): FieldItem;
@@ -233,15 +172,44 @@ export declare function duration(o: DurationOpts & {
233
172
  key?: undefined;
234
173
  value?: undefined;
235
174
  }): FieldMeta;
236
- /** Відсоток 0..100 real({config:{min:0,max:100}}). */
237
- export declare function percent(o: Omit<RealOpts, 'config'> & {
238
- config?: FieldConfig;
175
+ export interface ReminderOpts extends FieldCoreOpts {
176
+ label?: string;
177
+ }
178
+ export declare function reminder(o: ReminderOpts & {
179
+ key: string;
180
+ }): FieldItem;
181
+ export declare function reminder(o: ReminderOpts & {
182
+ value: unknown;
183
+ key?: undefined;
184
+ }): StaticEl;
185
+ export declare function reminder(o: ReminderOpts & {
186
+ key?: undefined;
187
+ value?: undefined;
188
+ }): FieldMeta;
189
+ export declare function percent(o: FieldCoreOpts): FieldMeta;
190
+ export declare function year(o: FieldCoreOpts): FieldMeta;
191
+ export declare function weight(o: TextPresetOpts & {
192
+ key: string;
193
+ }): FieldItem;
194
+ export declare function weight(o: TextPresetOpts & {
195
+ value: unknown;
196
+ key?: undefined;
197
+ }): StaticEl;
198
+ export declare function weight(o: TextPresetOpts & {
199
+ key?: undefined;
200
+ value?: undefined;
239
201
  }): FieldMeta;
240
- /** Рік int({config:{min:1900,max:2100}}); межі перекриваються через config.min/max. */
241
- export declare function year(o: Omit<IntOpts, 'config'> & {
242
- config?: FieldConfig;
202
+ export declare function dimensions(o: TextPresetOpts & {
203
+ key: string;
204
+ }): FieldItem;
205
+ export declare function dimensions(o: TextPresetOpts & {
206
+ value: unknown;
207
+ key?: undefined;
208
+ }): StaticEl;
209
+ export declare function dimensions(o: TextPresetOpts & {
210
+ key?: undefined;
211
+ value?: undefined;
243
212
  }): FieldMeta;
244
- /** Країна — пресет над select({options:'countries'}) з прапорами. */
245
213
  export declare function country(o: TextPresetOpts & {
246
214
  key: string;
247
215
  }): FieldItem;
@@ -255,24 +223,24 @@ export declare function country(o: TextPresetOpts & {
255
223
  }): FieldMeta;
256
224
  export declare const presets: {
257
225
  email: typeof email;
258
- url: typeof url;
259
226
  tel: typeof tel;
260
227
  slug: typeof slug;
261
228
  color: typeof color;
262
229
  colorname: typeof colorname;
263
230
  title: typeof title;
264
231
  password: typeof password;
232
+ link: typeof link;
233
+ tag: typeof tag;
265
234
  tags: typeof tags;
266
- imei: typeof imei;
267
- mac: typeof mac;
268
- iban: typeof iban;
269
235
  markdown: typeof markdown;
270
236
  snippet: typeof snippet;
271
237
  rating: typeof rating;
272
238
  duration: typeof duration;
239
+ reminder: typeof reminder;
273
240
  percent: typeof percent;
274
241
  year: typeof year;
242
+ weight: typeof weight;
243
+ dimensions: typeof dimensions;
275
244
  country: typeof country;
276
245
  };
277
246
  export {};
278
- //# sourceMappingURL=field-presets.d.ts.map