@chelone/vue 0.2.0 → 0.4.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 (142) hide show
  1. package/dist/array/use-array-input.d.ts +4 -3
  2. package/dist/choices/use-choices.d.ts +19 -12
  3. package/dist/choices/use-choices.js +8 -11
  4. package/dist/components/admin/auth/auth-error.vue.d.ts +1 -1
  5. package/dist/components/admin/buttons/dual-approval-button.vue.d.ts +19 -15
  6. package/dist/components/admin/buttons/dual-approval-button.vue.js +3 -1
  7. package/dist/components/admin/buttons/save-button.vue.d.ts +1 -1
  8. package/dist/components/admin/buttons/sort-button.vue.d.ts +2 -1
  9. package/dist/components/admin/buttons/status-transition-button.vue.d.ts +19 -14
  10. package/dist/components/admin/buttons/status-transition-button.vue.js +3 -1
  11. package/dist/components/admin/buttons/update-button.vue.d.ts +3 -3
  12. package/dist/components/admin/feedback/linear-progress.vue.d.ts +1 -1
  13. package/dist/components/admin/fields/api-key-field.vue.d.ts +27 -9
  14. package/dist/components/admin/fields/api-key-field.vue.js +3 -1
  15. package/dist/components/admin/fields/array-field.vue.d.ts +2 -2
  16. package/dist/components/admin/fields/badge-field.vue.d.ts +2 -2
  17. package/dist/components/admin/fields/boolean-field.vue.d.ts +2 -2
  18. package/dist/components/admin/fields/chip-field.vue.d.ts +2 -2
  19. package/dist/components/admin/fields/color-field.vue.d.ts +2 -2
  20. package/dist/components/admin/fields/cron-field.vue.d.ts +2 -2
  21. package/dist/components/admin/fields/currency-field.vue.d.ts +2 -2
  22. package/dist/components/admin/fields/date-field.vue.d.ts +2 -2
  23. package/dist/components/admin/fields/duration-field.vue.d.ts +2 -2
  24. package/dist/components/admin/fields/email-field.vue.d.ts +2 -2
  25. package/dist/components/admin/fields/file-field.vue.d.ts +2 -2
  26. package/dist/components/admin/fields/file-field.vue.js +3 -3
  27. package/dist/components/admin/fields/function-field.vue.d.ts +3 -3
  28. package/dist/components/admin/fields/image-field.vue.d.ts +2 -2
  29. package/dist/components/admin/fields/image-field.vue.js +3 -3
  30. package/dist/components/admin/fields/json-field.vue.d.ts +2 -2
  31. package/dist/components/admin/fields/number-field.vue.d.ts +2 -2
  32. package/dist/components/admin/fields/phone-field.vue.d.ts +2 -2
  33. package/dist/components/admin/fields/rating-field.vue.d.ts +22 -7
  34. package/dist/components/admin/fields/rating-field.vue.js +3 -1
  35. package/dist/components/admin/fields/record-field.vue.d.ts +3 -3
  36. package/dist/components/admin/fields/reference-array-field.vue.d.ts +2 -2
  37. package/dist/components/admin/fields/reference-field.vue.d.ts +2 -1
  38. package/dist/components/admin/fields/reference-many-count.vue.d.ts +2 -2
  39. package/dist/components/admin/fields/reference-many-field.vue.d.ts +2 -2
  40. package/dist/components/admin/fields/reference-one-field.vue.d.ts +2 -2
  41. package/dist/components/admin/fields/select-field.vue.d.ts +2 -2
  42. package/dist/components/admin/fields/select-field.vue.js +1 -1
  43. package/dist/components/admin/fields/subscription-plan-field.vue.d.ts +2 -2
  44. package/dist/components/admin/fields/text-array-field.vue.d.ts +2 -2
  45. package/dist/components/admin/fields/text-field.vue.d.ts +2 -8
  46. package/dist/components/admin/fields/url-field.vue.d.ts +2 -2
  47. package/dist/components/admin/fields/usage-meter-field.vue.d.ts +22 -7
  48. package/dist/components/admin/fields/usage-meter-field.vue.js +3 -1
  49. package/dist/components/admin/fields/webhook-endpoint-field.vue.d.ts +2 -2
  50. package/dist/components/admin/fields/wrapper-field.vue.d.ts +3 -3
  51. package/dist/components/admin/fields/wrapper-field.vue.js +6 -0
  52. package/dist/components/admin/inputs/api-key-input.vue.d.ts +2 -2
  53. package/dist/components/admin/inputs/array-input.vue.d.ts +2 -2
  54. package/dist/components/admin/inputs/autocomplete-array-input.vue.d.ts +14 -6
  55. package/dist/components/admin/inputs/autocomplete-array-input.vue.js +2 -3
  56. package/dist/components/admin/inputs/autocomplete-input.vue.d.ts +14 -6
  57. package/dist/components/admin/inputs/autocomplete-input.vue.js +2 -3
  58. package/dist/components/admin/inputs/boolean-input.vue.d.ts +2 -2
  59. package/dist/components/admin/inputs/checkbox-group-input.vue.d.ts +1 -1
  60. package/dist/components/admin/inputs/choice-input-props.d.ts +7 -7
  61. package/dist/components/admin/inputs/color-input.vue.d.ts +2 -2
  62. package/dist/components/admin/inputs/cron-input.vue.d.ts +2 -2
  63. package/dist/components/admin/inputs/currency-input.vue.d.ts +2 -2
  64. package/dist/components/admin/inputs/date-input.vue.d.ts +2 -2
  65. package/dist/components/admin/inputs/date-time-input.vue.d.ts +2 -2
  66. package/dist/components/admin/inputs/duration-input.vue.d.ts +2 -2
  67. package/dist/components/admin/inputs/file-input.vue.d.ts +2 -2
  68. package/dist/components/admin/inputs/nullable-boolean-input.vue.d.ts +2 -2
  69. package/dist/components/admin/inputs/number-input.vue.d.ts +2 -2
  70. package/dist/components/admin/inputs/password-input.vue.d.ts +2 -2
  71. package/dist/components/admin/inputs/phone-input.vue.d.ts +2 -2
  72. package/dist/components/admin/inputs/radio-button-group-input.vue.d.ts +1 -1
  73. package/dist/components/admin/inputs/rating-input.vue.d.ts +2 -2
  74. package/dist/components/admin/inputs/reference-array-input.vue.d.ts +2 -2
  75. package/dist/components/admin/inputs/reference-input.vue.d.ts +2 -2
  76. package/dist/components/admin/inputs/resettable-text-input.vue.d.ts +2 -1
  77. package/dist/components/admin/inputs/search-input.vue.d.ts +3 -3
  78. package/dist/components/admin/inputs/select-array-input.vue.d.ts +14 -5
  79. package/dist/components/admin/inputs/select-array-input.vue.js +1 -1
  80. package/dist/components/admin/inputs/select-input.vue.d.ts +14 -7
  81. package/dist/components/admin/inputs/select-input.vue.js +1 -1
  82. package/dist/components/admin/inputs/subscription-plan-picker.vue.d.ts +2 -2
  83. package/dist/components/admin/inputs/text-array-input.vue.d.ts +2 -2
  84. package/dist/components/admin/inputs/text-input.vue.d.ts +2 -1
  85. package/dist/components/admin/inputs/time-input.vue.d.ts +2 -1
  86. package/dist/components/admin/inputs/use-choice-input.d.ts +13 -19
  87. package/dist/components/admin/inputs/use-choice-input.js +4 -1
  88. package/dist/components/admin/inputs/webhook-endpoint-input.vue.d.ts +2 -2
  89. package/dist/components/admin/list/calendar-list.vue.d.ts +8 -8
  90. package/dist/components/admin/list/data-table-col.vue.d.ts +2 -2
  91. package/dist/components/admin/list/data-table-number-col.vue.d.ts +2 -1
  92. package/dist/components/admin/list/filter-form.vue.js +2 -10
  93. package/dist/components/admin/list/filter-live-search.vue.d.ts +1 -1
  94. package/dist/components/admin/list/kanban-board.vue.d.ts +41 -0
  95. package/dist/components/admin/list/kanban-board.vue.js +275 -0
  96. package/dist/components/admin/list/kanban-board2.vue.js +4 -0
  97. package/dist/components/admin/list/list-icons.d.ts +2 -0
  98. package/dist/components/admin/list/list-icons.js +7 -0
  99. package/dist/components/admin/list/tree-list.vue.d.ts +7 -6
  100. package/dist/components/admin/list/tree-list.vue.js +3 -9
  101. package/dist/components/admin/view/labeled.vue.d.ts +6 -5
  102. package/dist/components/admin/view/labeled.vue.js +4 -1
  103. package/dist/components/admin/view/tabbed-show-layout-tab.vue.d.ts +2 -2
  104. package/dist/components/index.d.ts +2 -0
  105. package/dist/components/maps/geo-json-field.vue.d.ts +2 -1
  106. package/dist/components/maps/lat-lng-field.vue.d.ts +3 -3
  107. package/dist/components/maps/lat-lng-input.vue.d.ts +4 -4
  108. package/dist/components/maps-draw/shape-input.vue.d.ts +4 -4
  109. package/dist/components/maps-draw/simplify-input.vue.d.ts +2 -2
  110. package/dist/components/maps-osm/geocoding-input.vue.d.ts +6 -6
  111. package/dist/components/maps-osm/map-with-search.vue.d.ts +4 -4
  112. package/dist/components/maps-osm/osm-feature-operator.vue.d.ts +3 -3
  113. package/dist/components/maps-osm/reverse-geocode-field.vue.d.ts +3 -3
  114. package/dist/components/mdx-editor/mdx-field.vue.d.ts +2 -2
  115. package/dist/components/mdx-editor/mdx-input.vue.d.ts +2 -2
  116. package/dist/components/monaco/monaco-json-field.vue.d.ts +2 -2
  117. package/dist/components/monaco/monaco-json-input.vue.d.ts +2 -2
  118. package/dist/components/ui/alert.d.ts +1 -1
  119. package/dist/components/ui/badge.d.ts +1 -1
  120. package/dist/components/ui/button.vue.d.ts +1 -1
  121. package/dist/components/ui/command/command-dialog.vue.d.ts +1 -1
  122. package/dist/components/ui/dropdown-menu/dropdown-menu-item.vue.js +9 -3
  123. package/dist/components/ui/input.vue.d.ts +2 -2
  124. package/dist/components/ui/sidebar/sidebar-menu-button.vue.d.ts +1 -1
  125. package/dist/components/ui/textarea.vue.d.ts +2 -2
  126. package/dist/controllers/use-controller-for-id.d.ts +6 -2
  127. package/dist/controllers/use-controller-for-id.js +2 -1
  128. package/dist/create-resource-components.d.ts +743 -0
  129. package/dist/create-resource-components.js +171 -0
  130. package/dist/data/create-chelone-hooks.d.ts +28 -8
  131. package/dist/data/mutations.d.ts +28 -8
  132. package/dist/form/use-input.d.ts +9 -6
  133. package/dist/form/use-input.js +2 -1
  134. package/dist/index.d.ts +2 -0
  135. package/dist/index.js +248 -243
  136. package/dist/label/use-get-record-representation.d.ts +2 -1
  137. package/dist/label/use-get-record-representation.js +1 -13
  138. package/dist/record/use-field-value.d.ts +22 -11
  139. package/dist/record/use-field-value.js +3 -20
  140. package/package.json +4 -4
  141. package/dist/components/admin/fields/get-path.d.ts +0 -7
  142. package/dist/components/admin/fields/get-path.js +0 -14
@@ -18,11 +18,11 @@
18
18
  * array field's error/meta ride a separate {@link useSubscribable} over the field
19
19
  * binding, projected through `computed`.
20
20
  */
21
- import type { ArrayBindingUpdateOptions, ArrayRow, SourceScope, TranslatableMessage } from "@chelone/core";
21
+ import type { ArrayBindingUpdateOptions, ArrayRow, SourcePath, SourceScope, TranslatableMessage } from "@chelone/core";
22
22
  import { type ComputedRef, type Ref } from "vue";
23
- export interface UseArrayInputOptions extends ArrayBindingUpdateOptions {
23
+ export interface UseArrayInputOptions<TRecord = unknown> extends ArrayBindingUpdateOptions {
24
24
  /** The array field path RELATIVE to the ambient source scope. */
25
- source: string;
25
+ source: SourcePath<TRecord>;
26
26
  }
27
27
  /** The array field's own reactive error state (min-length validators, etc.). */
28
28
  export interface ArrayFieldState {
@@ -52,4 +52,5 @@ export interface UseArrayInputResult {
52
52
  clear(): void;
53
53
  fieldState: ArrayFieldState;
54
54
  }
55
+ export declare function useArrayInput<TRecord>(options: UseArrayInputOptions<TRecord>): UseArrayInputResult;
55
56
  export declare function useArrayInput(options: UseArrayInputOptions): UseArrayInputResult;
@@ -13,30 +13,37 @@
13
13
  * comes from the ambient i18n via {@link useTranslate}, so `useChoices` must be
14
14
  * called in `setup`.
15
15
  */
16
+ import { type SourcePath } from "@chelone/core";
16
17
  /** An erased choice record — choices carry arbitrary shapes (`{id, name, ...}`). */
17
18
  export type ChoiceRecord = Record<string, unknown>;
18
- /** The display path (dotted) or a formatter over the whole choice. */
19
- export type OptionText = string | ((choice: ChoiceRecord) => string);
20
- export interface UseChoicesOptions {
19
+ /** The display path (dot or bracket) or a formatter over the whole choice. */
20
+ export type OptionText<TChoice extends ChoiceRecord = ChoiceRecord> = SourcePath<TChoice> | ((choice: TChoice) => string);
21
+ export interface UseChoicesOptions<TChoice extends ChoiceRecord = ChoiceRecord> {
21
22
  /** The display path or a formatter. Default `'name'`. */
22
- optionText?: OptionText;
23
+ optionText?: OptionText<TChoice>;
23
24
  /** The value path. Default `'id'`. */
24
- optionValue?: string;
25
+ optionValue?: SourcePath<TChoice>;
25
26
  /** The disabled-flag path. Default `'disabled'`. */
26
- disableValue?: string;
27
+ disableValue?: SourcePath<TChoice>;
27
28
  /** Translate a string-path text through the catalog (default `true`). */
28
29
  translateChoice?: boolean;
29
30
  }
30
31
  /** The choice accessors a choice input needs. */
31
- export interface UseChoicesResult {
32
+ export interface UseChoicesResult<TChoice extends ChoiceRecord = ChoiceRecord> {
32
33
  /** The display text: string path (optionally translated) or the formatter's output. */
33
- getChoiceText(choice: ChoiceRecord): string;
34
+ getChoiceText(choice: TChoice): string;
34
35
  /** The value: `get(choice, optionValue)`, falling back to `choice.id`. */
35
- getChoiceValue(choice: ChoiceRecord): unknown;
36
+ getChoiceValue(choice: TChoice): unknown;
36
37
  /** The disabled flag: `get(choice, disableValue)`. */
37
- getDisableValue(choice: ChoiceRecord): unknown;
38
+ getDisableValue(choice: TChoice): unknown;
38
39
  }
39
- /** Reads a dotted path off a record (`get(choice, 'a.b')`), else `undefined`. */
40
+ /**
41
+ * Read a choice path off a record with core's one path grammar
42
+ * ({@link getAtPath}): dot members (`author.name`), bracket indices
43
+ * (`tags[0].label`) and numeric-dot indices all resolve, and an own flat key
44
+ * equal to the whole path wins. An empty path reads nothing, where core's
45
+ * reader returns the record itself. Public in the package barrel.
46
+ */
40
47
  export declare function getChoicePath(record: ChoiceRecord, path: string): unknown;
41
48
  /**
42
49
  * The choice accessors (ra's `useChoices`): text (string path or formatter,
@@ -44,4 +51,4 @@ export declare function getChoicePath(record: ChoiceRecord, path: string): unkno
44
51
  * value (`optionValue` path or `id`), and disabled flag. Defaults are read live
45
52
  * off `options`, so a reactive props object stays live between reads.
46
53
  */
47
- export declare function useChoices(options?: UseChoicesOptions): UseChoicesResult;
54
+ export declare function useChoices<TChoice extends ChoiceRecord = ChoiceRecord>(options?: UseChoicesOptions<TChoice>): UseChoicesResult<TChoice>;
@@ -1,31 +1,28 @@
1
+ import { getAtPath } from "@chelone/core";
1
2
  import { useTranslate } from "../i18n/use-translate.js";
2
3
  function getChoicePath(record, path) {
3
- if (path in record) return record[path];
4
- let current = record;
5
- for (const key of path.split(".")) {
6
- if (current == null || typeof current !== "object") return void 0;
7
- current = current[key];
8
- }
9
- return current;
4
+ if (path === "") return void 0;
5
+ return getAtPath(record, path);
10
6
  }
11
7
  function useChoices(options = {}) {
12
8
  const translate = useTranslate();
9
+ const loose = () => options;
13
10
  return {
14
11
  getChoiceText(choice) {
15
- const optionText = options.optionText ?? "name";
12
+ const optionText = loose().optionText ?? "name";
16
13
  if (typeof optionText === "function") return optionText(choice);
17
14
  const raw = getChoicePath(choice, optionText);
18
15
  const text = raw == null ? "" : String(raw);
19
- if (options.translateChoice === false) return text;
16
+ if (loose().translateChoice === false) return text;
20
17
  const translated = translate(text, { _: text });
21
18
  return translated === text ? text : translated;
22
19
  },
23
20
  getChoiceValue(choice) {
24
- const value = getChoicePath(choice, options.optionValue ?? "id");
21
+ const value = getChoicePath(choice, loose().optionValue ?? "id");
25
22
  return value !== void 0 ? value : choice.id;
26
23
  },
27
24
  getDisableValue(choice) {
28
- return getChoicePath(choice, options.disableValue ?? "disabled");
25
+ return getChoicePath(choice, loose().disableValue ?? "disabled");
29
26
  }
30
27
  };
31
28
  }
@@ -7,7 +7,7 @@ export interface AuthErrorProps {
7
7
  class?: string;
8
8
  }
9
9
  declare const _default: import("vue").DefineComponent<AuthErrorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<AuthErrorProps> & Readonly<{}>, {
10
- message: string;
11
10
  title: string;
11
+ message: string;
12
12
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
13
  export default _default;
@@ -1,12 +1,12 @@
1
- import type { LooseRecord, MutationMode } from "@chelone/core";
1
+ import type { MutationMode, SourceKey } from "@chelone/core";
2
2
  /** Props for {@link DualApprovalButton}. */
3
- export interface DualApprovalButtonProps {
3
+ export interface DualApprovalButtonProps<TRecord extends Record<string, unknown> = Record<string, unknown>> {
4
4
  /** Approvals needed. Floored, minimum 1. Default `2`. */
5
5
  required?: number;
6
- /** Record field holding the approver list. Default `"approvers"`. */
7
- approverSource?: string;
8
- /** Record field the status is written to. Default `"status"`. */
9
- statusSource?: string;
6
+ /** Record field holding the approver list, a top-level key. Default `"approvers"`. */
7
+ approverSource?: SourceKey<TRecord>;
8
+ /** Record field the status is written to, a top-level key. Default `"status"`. */
9
+ statusSource?: SourceKey<TRecord>;
10
10
  /** Status written while approvals are short of `required`. Default `"pending"`. */
11
11
  pendingValue?: unknown;
12
12
  /** Status written once approvals reach `required`. Default `"approved"`. */
@@ -14,18 +14,22 @@ export interface DualApprovalButtonProps {
14
14
  /** Override the ambient `<Resource>`. */
15
15
  resource?: string;
16
16
  /** Override the ambient record. */
17
- record?: LooseRecord;
17
+ record?: TRecord;
18
18
  /** How the update is dispatched. Default `"pessimistic"`. */
19
19
  mutationMode?: MutationMode;
20
20
  /** Extra CSS class appended to the button. */
21
21
  class?: string;
22
22
  }
23
- declare const _default: import("vue").DefineComponent<DualApprovalButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DualApprovalButtonProps> & Readonly<{}>, {
24
- required: number;
25
- mutationMode: MutationMode;
26
- approverSource: string;
27
- statusSource: string;
28
- pendingValue: "pending";
29
- approvedValue: "approved";
30
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
23
+ declare const _default: <TRecord extends Record<string, unknown> = Record<string, unknown>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
24
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & DualApprovalButtonProps<TRecord> & Partial<{}>> & import("vue").PublicProps;
25
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
26
+ attrs: any;
27
+ slots: {};
28
+ emit: {};
29
+ }>) => import("vue").VNode & {
30
+ __ctx?: Awaited<typeof __VLS_setup>;
31
+ };
31
32
  export default _default;
33
+ type __VLS_PrettifyLocal<T> = {
34
+ [K in keyof T]: T[K];
35
+ } & {};
@@ -36,7 +36,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
36
36
  const props = __props;
37
37
  const resource = useResourceContext(props);
38
38
  const injectedRecord = inject(RecordContextKey, null);
39
- const record = computed(() => props.record ?? injectedRecord?.value);
39
+ const record = computed(
40
+ () => props.record ?? injectedRecord?.value
41
+ );
40
42
  const translate = useTranslate();
41
43
  const notifications = useCheloneNotifications();
42
44
  const { identity } = useOptionalIdentity();
@@ -7,8 +7,8 @@ export interface SaveButtonProps {
7
7
  class?: string;
8
8
  }
9
9
  declare const _default: import("vue").DefineComponent<SaveButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SaveButtonProps> & Readonly<{}>, {
10
- label: string;
11
10
  variant: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
11
+ label: string;
12
12
  alwaysEnable: boolean;
13
13
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
14
  export default _default;
@@ -1,7 +1,8 @@
1
+ import type { SourceProp } from "@chelone/core";
1
2
  /** Props for {@link SortButton}. */
2
3
  export interface SortButtonProps {
3
4
  /** The sortable field names offered in the dropdown. */
4
- fields: string[];
5
+ fields: SourceProp[];
5
6
  /** Override the auto-translated button label. */
6
7
  label?: string;
7
8
  /** Extra CSS class appended to the trigger. */
@@ -1,8 +1,8 @@
1
- import type { LooseRecord, MutationMode } from "@chelone/core";
1
+ import type { MutationMode, SourceKey } from "@chelone/core";
2
2
  /** Props for {@link StatusTransitionButton}. */
3
- export interface StatusTransitionButtonProps {
4
- /** Record field holding the status. Default `"status"`. */
5
- source?: string;
3
+ export interface StatusTransitionButtonProps<TRecord extends Record<string, unknown> = Record<string, unknown>> {
4
+ /** Record field holding the status, a top-level key. Default `"status"`. */
5
+ source?: SourceKey<TRecord>;
6
6
  /** Next states by current state. */
7
7
  transitions: Record<string, readonly string[]>;
8
8
  /** Predicates keyed `"<from>-><to>"`. A transition with no guard is allowed. */
@@ -12,7 +12,7 @@ export interface StatusTransitionButtonProps {
12
12
  /** Override the ambient `<Resource>`. */
13
13
  resource?: string;
14
14
  /** Override the ambient record. */
15
- record?: LooseRecord;
15
+ record?: TRecord;
16
16
  /** Ask for confirmation before moving the record. Default `false`. */
17
17
  confirm?: boolean;
18
18
  /** How the update is dispatched. Default `"pessimistic"`. */
@@ -20,13 +20,18 @@ export interface StatusTransitionButtonProps {
20
20
  /** Extra CSS class appended to the trigger. */
21
21
  class?: string;
22
22
  }
23
- declare const _default: import("vue").DefineComponent<StatusTransitionButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
24
- transition: (from: string, to: string, record: LooseRecord) => any;
25
- }, string, import("vue").PublicProps, Readonly<StatusTransitionButtonProps> & Readonly<{
26
- onTransition?: ((from: string, to: string, record: LooseRecord) => any) | undefined;
27
- }>, {
28
- source: string;
29
- confirm: boolean;
30
- mutationMode: MutationMode;
31
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
23
+ declare const _default: <TRecord extends Record<string, unknown> = Record<string, unknown>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
24
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
25
+ readonly onTransition?: ((from: string, to: string, record: TRecord) => any) | undefined;
26
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onTransition"> & StatusTransitionButtonProps<TRecord> & Partial<{}>> & import("vue").PublicProps;
27
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
28
+ attrs: any;
29
+ slots: {};
30
+ emit: (event: "transition", from: string, to: string, record: TRecord) => void;
31
+ }>) => import("vue").VNode & {
32
+ __ctx?: Awaited<typeof __VLS_setup>;
33
+ };
32
34
  export default _default;
35
+ type __VLS_PrettifyLocal<T> = {
36
+ [K in keyof T]: T[K];
37
+ } & {};
@@ -37,7 +37,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
37
37
  const emit = __emit;
38
38
  const resource = useResourceContext(props);
39
39
  const injectedRecord = inject(RecordContextKey, null);
40
- const record = computed(() => props.record ?? injectedRecord?.value);
40
+ const record = computed(
41
+ () => props.record ?? injectedRecord?.value
42
+ );
41
43
  const translate = useTranslate();
42
44
  const notifications = useCheloneNotifications();
43
45
  const { canAccess, isPending: isAccessPending } = useMenuAccess(
@@ -29,16 +29,16 @@ export interface UpdateButtonProps {
29
29
  }
30
30
  declare const _default: __VLS_WithSlots<import("vue").DefineComponent<UpdateButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
31
31
  click: (e?: MouseEvent | undefined) => any;
32
- error: (error: unknown) => any;
33
32
  success: (data: LooseRecord) => any;
33
+ error: (error: unknown) => any;
34
34
  }, string, import("vue").PublicProps, Readonly<UpdateButtonProps> & Readonly<{
35
35
  onClick?: ((e?: MouseEvent | undefined) => any) | undefined;
36
- onError?: ((error: unknown) => any) | undefined;
37
36
  onSuccess?: ((data: LooseRecord) => any) | undefined;
37
+ onError?: ((error: unknown) => any) | undefined;
38
38
  }>, {
39
39
  variant: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
40
- confirmColor: "primary" | "warning";
41
40
  mutationMode: MutationMode;
41
+ confirmColor: "primary" | "warning";
42
42
  confirmTitle: string;
43
43
  confirmContent: string;
44
44
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
@@ -10,7 +10,7 @@ export interface LinearProgressProps {
10
10
  class?: string;
11
11
  }
12
12
  declare const _default: import("vue").DefineComponent<LinearProgressProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<LinearProgressProps> & Readonly<{}>, {
13
- timeout: number;
14
13
  max: number;
14
+ timeout: number;
15
15
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
16
  export default _default;
@@ -1,16 +1,34 @@
1
- import type { LooseRecord } from "@chelone/core";
1
+ import type { LooseRecord, SourceKey, SourceProp } from "@chelone/core";
2
2
  /** Props for {@link ApiKeyField}. */
3
- export interface ApiKeyFieldProps {
4
- source: string;
5
- record?: LooseRecord;
3
+ export interface ApiKeyFieldProps<RecordType extends LooseRecord = LooseRecord> {
4
+ source: SourceProp;
5
+ /** The record to render. Defaults to the ambient `RecordContext` value. */
6
+ record?: RecordType;
6
7
  defaultValue?: unknown;
7
- /** Record field with scope strings. Renders chips when set. */
8
- scopesSource?: string;
9
- /** Record field with an ISO last-used timestamp. */
10
- lastUsedSource?: string;
8
+ /**
9
+ * Sibling record field with scope strings; renders chips when set. A
10
+ * top-level key, not a path: the read is `record[scopesSource]`.
11
+ */
12
+ scopesSource?: SourceKey<RecordType>;
13
+ /**
14
+ * Sibling record field with an ISO last-used timestamp. A top-level key, not
15
+ * a path: the read is `record[lastUsedSource]`.
16
+ */
17
+ lastUsedSource?: SourceKey<RecordType>;
11
18
  /** 'last4' shows the trailing 4 chars; 'full' masks everything. */
12
19
  maskedFormat?: "last4" | "full";
13
20
  class?: string;
14
21
  }
15
- declare const _default: import("vue").DefineComponent<ApiKeyFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ApiKeyFieldProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
22
+ declare const _default: <RecordType extends LooseRecord = LooseRecord>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
23
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & ApiKeyFieldProps<RecordType> & Partial<{}>> & import("vue").PublicProps;
24
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
25
+ attrs: any;
26
+ slots: {};
27
+ emit: {};
28
+ }>) => import("vue").VNode & {
29
+ __ctx?: Awaited<typeof __VLS_setup>;
30
+ };
16
31
  export default _default;
32
+ type __VLS_PrettifyLocal<T> = {
33
+ [K in keyof T]: T[K];
34
+ } & {};
@@ -61,7 +61,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
61
61
  defaultValue: props.defaultValue
62
62
  });
63
63
  const injectedRecord = inject(RecordContextKey, null);
64
- const ctxRecord = computed(() => props.record ?? injectedRecord?.value);
64
+ const ctxRecord = computed(
65
+ () => props.record ?? injectedRecord?.value
66
+ );
65
67
  const revealed = ref(false);
66
68
  const copied = ref(false);
67
69
  const key = computed(() => value.value == null ? null : String(value.value));
@@ -1,8 +1,8 @@
1
- import type { FilterPayload, LooseRecord, SortPayload } from "@chelone/core";
1
+ import type { FilterPayload, LooseRecord, SortPayload, SourceProp } from "@chelone/core";
2
2
  /** Props for {@link ArrayField}. */
3
3
  export interface ArrayFieldProps {
4
4
  /** The field path to the array on the current record. */
5
- source: string;
5
+ source: SourceProp;
6
6
  /** The record to read. Defaults to the ambient `RecordContext` value. */
7
7
  record?: LooseRecord;
8
8
  /** Returned when the resolved value is `undefined`. */
@@ -1,8 +1,8 @@
1
- import type { LooseRecord } from "@chelone/core";
1
+ import type { LooseRecord, SourceProp } from "@chelone/core";
2
2
  import type { BadgeVariant } from "../../ui/badge.js";
3
3
  /** Props for {@link BadgeField}. */
4
4
  export interface BadgeFieldProps {
5
- source: string;
5
+ source: SourceProp;
6
6
  record?: LooseRecord;
7
7
  defaultValue?: unknown;
8
8
  empty?: string;
@@ -1,7 +1,7 @@
1
- import type { LooseRecord } from "@chelone/core";
1
+ import type { LooseRecord, SourceProp } from "@chelone/core";
2
2
  /** Props for {@link BooleanField}. */
3
3
  export interface BooleanFieldProps {
4
- source: string;
4
+ source: SourceProp;
5
5
  record?: LooseRecord;
6
6
  defaultValue?: unknown;
7
7
  /** Label shown (as a native `title` tooltip) when the value is truthy. */
@@ -1,8 +1,8 @@
1
- import type { LooseRecord } from "@chelone/core";
1
+ import type { LooseRecord, SourceProp } from "@chelone/core";
2
2
  import type { BadgeVariant } from "../../ui/badge.js";
3
3
  /** Props for {@link ChipField}. */
4
4
  export interface ChipFieldProps {
5
- source: string;
5
+ source: SourceProp;
6
6
  record?: LooseRecord;
7
7
  defaultValue?: unknown;
8
8
  empty?: string;
@@ -1,7 +1,7 @@
1
- import type { LooseRecord } from "@chelone/core";
1
+ import type { LooseRecord, SourceProp } from "@chelone/core";
2
2
  /** Props for {@link ColorField}. */
3
3
  export interface ColorFieldProps {
4
- source: string;
4
+ source: SourceProp;
5
5
  record?: LooseRecord;
6
6
  defaultValue?: unknown;
7
7
  empty?: string;
@@ -1,7 +1,7 @@
1
- import type { LooseRecord } from "@chelone/core";
1
+ import type { LooseRecord, SourceProp } from "@chelone/core";
2
2
  /** Props for {@link CronField}. */
3
3
  export interface CronFieldProps {
4
- source: string;
4
+ source: SourceProp;
5
5
  record?: LooseRecord;
6
6
  defaultValue?: unknown;
7
7
  empty?: string;
@@ -1,7 +1,7 @@
1
- import type { LooseRecord } from "@chelone/core";
1
+ import type { LooseRecord, SourceProp } from "@chelone/core";
2
2
  /** Props for {@link CurrencyField}. */
3
3
  export interface CurrencyFieldProps {
4
- source: string;
4
+ source: SourceProp;
5
5
  record?: LooseRecord;
6
6
  defaultValue?: unknown;
7
7
  empty?: string;
@@ -1,7 +1,7 @@
1
- import type { LooseRecord } from "@chelone/core";
1
+ import type { LooseRecord, SourceProp } from "@chelone/core";
2
2
  /** Props for {@link DateField}. */
3
3
  export interface DateFieldProps {
4
- source: string;
4
+ source: SourceProp;
5
5
  record?: LooseRecord;
6
6
  defaultValue?: unknown;
7
7
  empty?: string;
@@ -1,7 +1,7 @@
1
- import type { LooseRecord } from "@chelone/core";
1
+ import type { LooseRecord, SourceProp } from "@chelone/core";
2
2
  /** Props for {@link DurationField}. */
3
3
  export interface DurationFieldProps {
4
- source: string;
4
+ source: SourceProp;
5
5
  record?: LooseRecord;
6
6
  defaultValue?: unknown;
7
7
  empty?: string;
@@ -1,7 +1,7 @@
1
- import type { LooseRecord } from "@chelone/core";
1
+ import type { LooseRecord, SourceProp } from "@chelone/core";
2
2
  /** Props for {@link EmailField}. */
3
3
  export interface EmailFieldProps {
4
- source: string;
4
+ source: SourceProp;
5
5
  record?: LooseRecord;
6
6
  defaultValue?: unknown;
7
7
  empty?: string;
@@ -1,7 +1,7 @@
1
- import type { LooseRecord } from "@chelone/core";
1
+ import type { LooseRecord, SourceProp } from "@chelone/core";
2
2
  /** Props for {@link FileField}. */
3
3
  export interface FileFieldProps {
4
- source: string;
4
+ source: SourceProp;
5
5
  record?: LooseRecord;
6
6
  defaultValue?: unknown;
7
7
  empty?: string;
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, unref, toDisplayString, Fragment, renderList, createElementVNode, createCommentVNode } from "vue";
2
- import { getPath } from "./get-path.js";
2
+ import { getAtPath } from "@chelone/core";
3
3
  import { cn } from "../../../lib/utils.js";
4
4
  import { useFieldValue } from "../../../record/use-field-value.js";
5
5
  import { useTranslate } from "../../../i18n/use-translate.js";
@@ -46,8 +46,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
46
46
  const links = computed(() => {
47
47
  if (!Array.isArray(sourceValue.value)) return [];
48
48
  return sourceValue.value.map((file, index) => {
49
- const fileTitleValue = props.title ? getPath(file, props.title) ?? props.title : props.title;
50
- const srcValue = props.src ? getPath(file, props.src) ?? props.title : props.title;
49
+ const fileTitleValue = props.title ? getAtPath(file, props.title) ?? props.title : props.title;
50
+ const srcValue = props.src ? getAtPath(file, props.src) ?? props.title : props.title;
51
51
  return { href: srcValue, title: fileTitleValue, key: srcValue ?? index };
52
52
  });
53
53
  });
@@ -1,9 +1,9 @@
1
- import type { LooseRecord } from "@chelone/core";
1
+ import type { LooseRecord, SourceProp } from "@chelone/core";
2
2
  /** Props for {@link FunctionField}. */
3
- export interface FunctionFieldProps<RecordType = LooseRecord> {
3
+ export interface FunctionFieldProps<RecordType extends LooseRecord = LooseRecord> {
4
4
  record?: RecordType;
5
5
  /** Optional source, forwarded to the default slot for convenience. */
6
- source?: string;
6
+ source?: SourceProp<RecordType>;
7
7
  class?: string;
8
8
  }
9
9
  declare const _default: <RecordType extends LooseRecord = LooseRecord>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
@@ -1,7 +1,7 @@
1
- import type { LooseRecord } from "@chelone/core";
1
+ import type { LooseRecord, SourceProp } from "@chelone/core";
2
2
  /** Props for {@link ImageField}. */
3
3
  export interface ImageFieldProps {
4
- source: string;
4
+ source: SourceProp;
5
5
  record?: LooseRecord;
6
6
  defaultValue?: unknown;
7
7
  empty?: string;
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, unref, toDisplayString, createElementVNode, Fragment, renderList, createCommentVNode } from "vue";
2
- import { getPath } from "./get-path.js";
2
+ import { getAtPath } from "@chelone/core";
3
3
  import { cn } from "../../../lib/utils.js";
4
4
  import { useFieldValue } from "../../../record/use-field-value.js";
5
5
  import { useTranslate } from "../../../i18n/use-translate.js";
@@ -39,8 +39,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
39
39
  const items = computed(() => {
40
40
  if (!Array.isArray(value.value)) return [];
41
41
  return value.value.map((file, index) => {
42
- const fileTitleValue = props.title ? getPath(file, props.title) ?? props.title : props.title;
43
- const srcValue = props.src ? getPath(file, props.src) ?? props.title : props.title;
42
+ const fileTitleValue = props.title ? getAtPath(file, props.title) ?? props.title : props.title;
43
+ const srcValue = props.src ? getAtPath(file, props.src) ?? props.title : props.title;
44
44
  return { src: srcValue, title: fileTitleValue, key: srcValue ?? index };
45
45
  });
46
46
  });
@@ -1,7 +1,7 @@
1
- import type { LooseRecord } from "@chelone/core";
1
+ import type { LooseRecord, SourceProp } from "@chelone/core";
2
2
  /** Props for {@link JsonField}. */
3
3
  export interface JsonFieldProps {
4
- source: string;
4
+ source: SourceProp;
5
5
  record?: LooseRecord;
6
6
  defaultValue?: unknown;
7
7
  empty?: string;
@@ -1,7 +1,7 @@
1
- import type { LooseRecord } from "@chelone/core";
1
+ import type { LooseRecord, SourceProp } from "@chelone/core";
2
2
  /** Props for {@link NumberField}. */
3
3
  export interface NumberFieldProps {
4
- source: string;
4
+ source: SourceProp;
5
5
  record?: LooseRecord;
6
6
  defaultValue?: unknown;
7
7
  empty?: string;
@@ -1,7 +1,7 @@
1
- import type { LooseRecord } from "@chelone/core";
1
+ import type { LooseRecord, SourceProp } from "@chelone/core";
2
2
  /** Props for {@link PhoneField}. */
3
3
  export interface PhoneFieldProps {
4
- source: string;
4
+ source: SourceProp;
5
5
  record?: LooseRecord;
6
6
  defaultValue?: unknown;
7
7
  empty?: string;