@chelone/vue 0.4.0 → 0.5.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.
@@ -4,7 +4,7 @@ import { useRoute, useRouter, START_LOCATION } from "vue-router";
4
4
  import _sfc_main$6 from "../components/admin/layout/layout.vue.js";
5
5
  import _sfc_main$1 from "../components/admin/layout/theme-provider.vue.js";
6
6
  import _sfc_main$4 from "../components/admin/auth/login-page.vue.js";
7
- import _sfc_main$3 from "../components/ui/spinner.vue.js";
7
+ import _sfc_main$3 from "../components/ui/spinner2.vue.js";
8
8
  import { useBasename } from "../router/adapter.js";
9
9
  import { useWatchDataErrors } from "../auth/permissions-hooks.js";
10
10
  import { useAuthGate } from "./auth-gate.js";
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, computed, unref, openBlock, createBlock, createElementBlock, createVNode } from "vue";
2
2
  import { useHandleAuthCallback } from "../../../admin/auth-gate.js";
3
- import _sfc_main$2 from "../../ui/spinner.vue.js";
3
+ import _sfc_main$2 from "../../ui/spinner2.vue.js";
4
4
  import _sfc_main$1 from "./auth-error.vue.js";
5
5
  const _hoisted_1 = {
6
6
  key: 1,
@@ -6,7 +6,7 @@ import { useTranslate } from "../../../i18n/use-translate.js";
6
6
  import { cn } from "../../../lib/utils.js";
7
7
  import { useLogin } from "../../../auth/auth-hooks.js";
8
8
  import _sfc_main$2 from "../../ui/button.vue.js";
9
- import _sfc_main$3 from "../../ui/spinner.vue.js";
9
+ import _sfc_main$3 from "../../ui/spinner2.vue.js";
10
10
  import _sfc_main$1 from "../inputs/text-input.vue.js";
11
11
  const _sfc_main = /* @__PURE__ */ defineComponent({
12
12
  __name: "login-form",
@@ -6,7 +6,7 @@ import { useForm } from "../../../form/use-form.js";
6
6
  import { useTranslate } from "../../../i18n/use-translate.js";
7
7
  import { cn } from "../../../lib/utils.js";
8
8
  import _sfc_main$3 from "../../ui/button.vue.js";
9
- import _sfc_main$4 from "../../ui/spinner.vue.js";
9
+ import _sfc_main$4 from "../../ui/spinner2.vue.js";
10
10
  import _sfc_main$2 from "../inputs/password-input.vue.js";
11
11
  import _sfc_main$1 from "../inputs/text-input.vue.js";
12
12
  import { LogInIcon } from "./icons.js";
@@ -2,7 +2,7 @@ import { defineComponent, computed, openBlock, createElementBlock, normalizeClas
2
2
  import { useLoading, useRefresh } from "../../../data/use-refresh.js";
3
3
  import { useTranslate } from "../../../i18n/use-translate.js";
4
4
  import { cn } from "../../../lib/utils.js";
5
- import _sfc_main$2 from "../../ui/spinner.vue.js";
5
+ import _sfc_main$2 from "../../ui/spinner2.vue.js";
6
6
  import { RotateCwIcon } from "../buttons/icons.js";
7
7
  import _sfc_main$1 from "../common/icon-button-with-tooltip.vue.js";
8
8
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -1,6 +1,6 @@
1
1
  import { defineComponent, computed, openBlock, createBlock, normalizeClass, createCommentVNode } from "vue";
2
2
  import { cn } from "../../../lib/utils.js";
3
- import _sfc_main$1 from "../../ui/spinner.vue.js";
3
+ import _sfc_main$1 from "../../ui/spinner2.vue.js";
4
4
  const _sfc_main = /* @__PURE__ */ defineComponent({
5
5
  __name: "spinner",
6
6
  props: {
@@ -1,20 +1,31 @@
1
- import type { LooseRecord, SourceProp } from "@chelone/core";
1
+ import type { LooseRecord, SourcePath, SourceProp } from "@chelone/core";
2
2
  import type { ChoiceRecord, OptionText } from "../../../choices/use-choices.js";
3
3
  /** Props for {@link SelectField}. */
4
- export interface SelectFieldProps {
4
+ export interface SelectFieldProps<TChoice extends ChoiceRecord = ChoiceRecord> {
5
5
  source: SourceProp;
6
6
  record?: LooseRecord;
7
7
  defaultValue?: unknown;
8
8
  empty?: string;
9
9
  /** The list of choices to map the value against. */
10
- choices?: readonly ChoiceRecord[];
10
+ choices?: readonly TChoice[];
11
11
  /** The value path on a choice. Default `'id'`. */
12
- optionValue?: string;
12
+ optionValue?: SourcePath<TChoice>;
13
13
  /** The display path or a formatter. Default `'name'`. */
14
- optionText?: OptionText;
14
+ optionText?: OptionText<TChoice>;
15
15
  /** Translate a string-path text through the catalog. Default `true`. */
16
16
  translateChoice?: boolean;
17
17
  class?: string;
18
18
  }
19
- declare const _default: import("vue").DefineComponent<SelectFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SelectFieldProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const _default: <TChoice extends ChoiceRecord = ChoiceRecord>(__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<{
20
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & SelectFieldProps<TChoice> & Partial<{}>> & import("vue").PublicProps;
21
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
22
+ attrs: any;
23
+ slots: {};
24
+ emit: {};
25
+ }>) => import("vue").VNode & {
26
+ __ctx?: Awaited<typeof __VLS_setup>;
27
+ };
20
28
  export default _default;
29
+ type __VLS_PrettifyLocal<T> = {
30
+ [K in keyof T]: T[K];
31
+ } & {};
@@ -11,7 +11,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
11
11
  empty: {},
12
12
  choices: {},
13
13
  optionValue: {},
14
- optionText: {},
14
+ optionText: { type: Function },
15
15
  translateChoice: { type: Boolean },
16
16
  class: {}
17
17
  },
@@ -1,13 +1,20 @@
1
+ import type { ChoiceRecord } from "../../../choices/use-choices.js";
1
2
  import type { ChoiceInputBaseProps } from "./choice-input-props.js";
2
3
  /** Props for {@link CheckboxGroupInput}. */
3
- export interface CheckboxGroupInputProps extends ChoiceInputBaseProps {
4
+ export interface CheckboxGroupInputProps<TChoice extends ChoiceRecord = ChoiceRecord> extends ChoiceInputBaseProps<TChoice> {
4
5
  /** Lay the checkboxes out horizontally instead of stacked. */
5
6
  row?: boolean;
6
7
  }
7
- declare const _default: import("vue").DefineComponent<CheckboxGroupInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CheckboxGroupInputProps> & Readonly<{}>, {
8
- label: string | false;
9
- optionValue: string;
10
- row: boolean;
11
- disableValue: string;
12
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: <TChoice extends ChoiceRecord = ChoiceRecord>(__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<{
9
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & CheckboxGroupInputProps<TChoice> & Partial<{}>> & import("vue").PublicProps;
10
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
11
+ attrs: any;
12
+ slots: {};
13
+ emit: {};
14
+ }>) => import("vue").VNode & {
15
+ __ctx?: Awaited<typeof __VLS_setup>;
16
+ };
13
17
  export default _default;
18
+ type __VLS_PrettifyLocal<T> = {
19
+ [K in keyof T]: T[K];
20
+ } & {};
@@ -19,8 +19,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
19
19
  source: {},
20
20
  choices: {},
21
21
  optionText: {},
22
- optionValue: { default: "id" },
23
- disableValue: { default: "disabled" },
22
+ optionValue: {},
23
+ disableValue: {},
24
24
  translateChoice: { type: Boolean },
25
25
  label: { type: [String, Boolean], default: void 0 },
26
26
  helperText: {},
@@ -1,10 +1,25 @@
1
+ import type { ChoiceRecord } from "../../../choices/use-choices.js";
1
2
  import type { ChoiceInputBaseProps } from "./choice-input-props.js";
2
- /** Props for {@link DatagridInput}. */
3
- export interface DatagridInputProps extends ChoiceInputBaseProps {
3
+ /**
4
+ * Props for {@link DatagridInput}.
5
+ *
6
+ * `disableValue` comes in through the shared base and is unused: a datagrid row
7
+ * is never disabled. The React twin has no `disableValue` prop at all.
8
+ */
9
+ export interface DatagridInputProps<TChoice extends ChoiceRecord = ChoiceRecord> extends ChoiceInputBaseProps<TChoice> {
4
10
  /** Column header for the choice column. Default empty. */
5
11
  optionLabel?: string;
6
12
  }
7
- declare const _default: import("vue").DefineComponent<DatagridInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DatagridInputProps> & Readonly<{}>, {
8
- optionValue: string;
9
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ declare const _default: <TChoice extends ChoiceRecord = ChoiceRecord>(__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<{
14
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & DatagridInputProps<TChoice> & Partial<{}>> & import("vue").PublicProps;
15
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
16
+ attrs: any;
17
+ slots: {};
18
+ emit: {};
19
+ }>) => import("vue").VNode & {
20
+ __ctx?: Awaited<typeof __VLS_setup>;
21
+ };
10
22
  export default _default;
23
+ type __VLS_PrettifyLocal<T> = {
24
+ [K in keyof T]: T[K];
25
+ } & {};
@@ -12,14 +12,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
12
12
  optionLabel: {},
13
13
  source: {},
14
14
  choices: {},
15
- optionText: {},
16
- optionValue: { default: "id" },
15
+ optionText: { type: Function },
16
+ optionValue: {},
17
17
  disableValue: {},
18
18
  translateChoice: { type: Boolean },
19
19
  label: { type: [String, Boolean] },
20
20
  helperText: {},
21
21
  defaultValue: {},
22
- validate: {},
22
+ validate: { type: [Function, Array] },
23
23
  disabled: { type: Boolean },
24
24
  readonly: { type: Boolean },
25
25
  class: {}
@@ -32,6 +32,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
32
32
  componentName: "DatagridInput",
33
33
  choices: props.choices,
34
34
  source: props.source,
35
+ // The React twin defaults `optionText` to `"name"` in its own destructuring,
36
+ // so a `<DatagridInput>` under a reference wrapper labels the `name` field
37
+ // rather than the record representation. The literal has to be cast: a
38
+ // `SourcePath<TChoice>` is deferred while `TChoice` is open.
35
39
  optionText: props.optionText ?? "name",
36
40
  optionValue: props.optionValue,
37
41
  disableValue: props.disableValue,
@@ -1,13 +1,20 @@
1
+ import type { ChoiceRecord } from "../../../choices/use-choices.js";
1
2
  import type { ChoiceInputBaseProps } from "./choice-input-props.js";
2
3
  /** Props for {@link RadioButtonGroupInput}. */
3
- export interface RadioButtonGroupInputProps extends ChoiceInputBaseProps {
4
+ export interface RadioButtonGroupInputProps<TChoice extends ChoiceRecord = ChoiceRecord> extends ChoiceInputBaseProps<TChoice> {
4
5
  /** Lay the radios out horizontally instead of stacked. */
5
6
  row?: boolean;
6
7
  }
7
- declare const _default: import("vue").DefineComponent<RadioButtonGroupInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<RadioButtonGroupInputProps> & Readonly<{}>, {
8
- label: string | false;
9
- optionValue: string;
10
- row: boolean;
11
- disableValue: string;
12
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ declare const _default: <TChoice extends ChoiceRecord = ChoiceRecord>(__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<{
9
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & RadioButtonGroupInputProps<TChoice> & Partial<{}>> & import("vue").PublicProps;
10
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
11
+ attrs: any;
12
+ slots: {};
13
+ emit: {};
14
+ }>) => import("vue").VNode & {
15
+ __ctx?: Awaited<typeof __VLS_setup>;
16
+ };
13
17
  export default _default;
18
+ type __VLS_PrettifyLocal<T> = {
19
+ [K in keyof T]: T[K];
20
+ } & {};
@@ -19,8 +19,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
19
19
  source: {},
20
20
  choices: {},
21
21
  optionText: {},
22
- optionValue: { default: "id" },
23
- disableValue: { default: "disabled" },
22
+ optionValue: {},
23
+ disableValue: {},
24
24
  translateChoice: { type: Boolean },
25
25
  label: { type: [String, Boolean], default: void 0 },
26
26
  helperText: {},
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, unref, openBlock, createBlock, normalizeClass, createCommentVNode } from "vue";
2
- import _sfc_main$1 from "../../ui/spinner.vue.js";
2
+ import _sfc_main$1 from "../../ui/spinner2.vue.js";
3
3
  import { useTimeout } from "../feedback/use-timeout.js";
4
4
  const _sfc_main = /* @__PURE__ */ defineComponent({
5
5
  __name: "count-spinner",
@@ -6,7 +6,7 @@ import { useForm } from "../../../form/use-form.js";
6
6
  import { useTranslate } from "../../../i18n/use-translate.js";
7
7
  import { cn } from "../../../lib/utils.js";
8
8
  import _sfc_main$2 from "../../ui/button.vue.js";
9
- import _sfc_main$3 from "../../ui/spinner.vue.js";
9
+ import _sfc_main$3 from "../../ui/spinner2.vue.js";
10
10
  import _sfc_main$1 from "../inputs/text-input.vue.js";
11
11
  import { useResetPassword } from "./use-password-recovery.js";
12
12
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -6,7 +6,7 @@ import { useForm } from "../../../form/use-form.js";
6
6
  import { useTranslate } from "../../../i18n/use-translate.js";
7
7
  import { cn } from "../../../lib/utils.js";
8
8
  import _sfc_main$2 from "../../ui/button.vue.js";
9
- import _sfc_main$3 from "../../ui/spinner.vue.js";
9
+ import _sfc_main$3 from "../../ui/spinner2.vue.js";
10
10
  import _sfc_main$1 from "../inputs/password-input.vue.js";
11
11
  import { useSupabaseUrlTokens, useSetPassword } from "./use-password-recovery.js";
12
12
  const _hoisted_1 = {
@@ -6,7 +6,7 @@ import { useTranslate } from "../../i18n/use-translate.js";
6
6
  import { useNotify } from "../../notification-hooks.js";
7
7
  import { useMapsConfig } from "../maps/use-map.js";
8
8
  import _sfc_main$1 from "../ui/button.vue.js";
9
- import _sfc_main$2 from "../ui/spinner.vue.js";
9
+ import _sfc_main$2 from "../ui/spinner2.vue.js";
10
10
  import { fetchOsmFeatures } from "./osm-features.js";
11
11
  import { subtractMask, unionAll } from "./osm-geometry-ops.js";
12
12
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -1,32 +1,4 @@
1
- import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, createElementVNode } from "vue";
2
- import { cn } from "../../lib/utils.js";
3
- const _sfc_main = /* @__PURE__ */ defineComponent({
4
- __name: "spinner",
5
- props: {
6
- class: {}
7
- },
8
- setup(__props) {
9
- const props = __props;
10
- const classes = computed(() => cn("size-4 animate-spin", props.class));
11
- return (_ctx, _cache) => {
12
- return openBlock(), createElementBlock("svg", {
13
- role: "status",
14
- "aria-label": "Loading",
15
- class: normalizeClass(classes.value),
16
- "data-slot": "spinner",
17
- viewBox: "0 0 24 24",
18
- fill: "none",
19
- stroke: "currentColor",
20
- "stroke-width": "2",
21
- "stroke-linecap": "round",
22
- "stroke-linejoin": "round",
23
- "aria-hidden": "false"
24
- }, [..._cache[0] || (_cache[0] = [
25
- createElementVNode("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }, null, -1)
26
- ])], 2);
27
- };
28
- }
29
- });
1
+ import _sfc_main from "./spinner2.vue.js";
30
2
  export {
31
3
  _sfc_main as default
32
4
  };
@@ -1,4 +1,32 @@
1
- import _sfc_main from "./spinner.vue.js";
1
+ import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, createElementVNode } from "vue";
2
+ import { cn } from "../../lib/utils.js";
3
+ const _sfc_main = /* @__PURE__ */ defineComponent({
4
+ __name: "spinner",
5
+ props: {
6
+ class: {}
7
+ },
8
+ setup(__props) {
9
+ const props = __props;
10
+ const classes = computed(() => cn("size-4 animate-spin", props.class));
11
+ return (_ctx, _cache) => {
12
+ return openBlock(), createElementBlock("svg", {
13
+ role: "status",
14
+ "aria-label": "Loading",
15
+ class: normalizeClass(classes.value),
16
+ "data-slot": "spinner",
17
+ viewBox: "0 0 24 24",
18
+ fill: "none",
19
+ stroke: "currentColor",
20
+ "stroke-width": "2",
21
+ "stroke-linecap": "round",
22
+ "stroke-linejoin": "round",
23
+ "aria-hidden": "false"
24
+ }, [..._cache[0] || (_cache[0] = [
25
+ createElementVNode("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }, null, -1)
26
+ ])], 2);
27
+ };
28
+ }
29
+ });
2
30
  export {
3
31
  _sfc_main as default
4
32
  };
@@ -27,7 +27,8 @@
27
27
  * directly; their `source` keeps the registered union, or a plain string when
28
28
  * nothing is registered.
29
29
  */
30
- import type { RecordOf, RegisteredResourceName, RegisteredResources, ResourceMap, SourceProp } from "@chelone/core";
30
+ import type { RecordOf, RegisteredResourceName, RegisteredResources, ResourceMap, SourceProp, SourceValue } from "@chelone/core";
31
+ import { type VNode } from "vue";
31
32
  import Create from "./components/admin/view/create.vue.js";
32
33
  import Edit from "./components/admin/view/edit.vue.js";
33
34
  import List from "./components/admin/view/list.vue.js";
@@ -259,7 +260,29 @@ declare const sourceMembers: {
259
260
  }) => any;
260
261
  };
261
262
  });
262
- SelectField: import("vue").DefineComponent<import("./index.js").SelectFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("./index.js").SelectFieldProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
263
+ SelectField: <TChoice extends import("./index.js").ChoiceRecord = import("./index.js").ChoiceRecord>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: {
264
+ attrs: any;
265
+ emit: {};
266
+ slots: {};
267
+ }, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
268
+ props: {
269
+ source: SourceProp;
270
+ record?: import("@chelone/core").LooseRecord | undefined;
271
+ defaultValue?: unknown;
272
+ empty?: string | undefined;
273
+ choices?: readonly TChoice[] | undefined;
274
+ optionValue?: import("@chelone/core").SourcePath<TChoice> | undefined;
275
+ optionText?: import("./index.js").OptionText<TChoice> | undefined;
276
+ translateChoice?: boolean | undefined;
277
+ class?: string | undefined;
278
+ } & import("vue").PublicProps;
279
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
280
+ attrs: any;
281
+ slots: {};
282
+ emit: {};
283
+ }>) => import("vue").VNode & {
284
+ __ctx?: Awaited<typeof __VLS_setup>;
285
+ };
263
286
  SubscriptionPlanField: import("vue").DefineComponent<import("./index.js").SubscriptionPlanFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("./index.js").SubscriptionPlanFieldProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
264
287
  TextArrayField: import("vue").DefineComponent<import("./index.js").TextArrayFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("./index.js").TextArrayFieldProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
265
288
  TextField: import("vue").DefineComponent<import("./index.js").TextFieldProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("./index.js").TextFieldProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -438,12 +461,34 @@ declare const sourceMembers: {
438
461
  BooleanInput: import("vue").DefineComponent<import("./index.js").BooleanInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("./index.js").BooleanInputProps> & Readonly<{}>, {
439
462
  label: string | false;
440
463
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
441
- CheckboxGroupInput: import("vue").DefineComponent<import("./index.js").CheckboxGroupInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("./index.js").CheckboxGroupInputProps> & Readonly<{}>, {
442
- label: string | false;
443
- optionValue: string;
444
- row: boolean;
445
- disableValue: string;
446
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
464
+ CheckboxGroupInput: <TChoice extends import("./index.js").ChoiceRecord = import("./index.js").ChoiceRecord>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: {
465
+ attrs: any;
466
+ emit: {};
467
+ slots: {};
468
+ }, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
469
+ props: {
470
+ row?: boolean | undefined;
471
+ source?: string | undefined;
472
+ choices?: readonly (string | TChoice)[] | undefined;
473
+ optionText?: import("./index.js").OptionText<TChoice> | undefined;
474
+ optionValue?: import("@chelone/core").SourcePath<TChoice> | undefined;
475
+ disableValue?: import("@chelone/core").SourcePath<TChoice> | undefined;
476
+ translateChoice?: boolean | undefined;
477
+ label?: string | false | undefined;
478
+ helperText?: string | undefined;
479
+ defaultValue?: unknown;
480
+ validate?: (import("@chelone/core").Validator | readonly import("@chelone/core").Validator[]) | undefined;
481
+ disabled?: boolean | undefined;
482
+ readonly?: boolean | undefined;
483
+ class?: string | undefined;
484
+ } & import("vue").PublicProps;
485
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
486
+ attrs: any;
487
+ slots: {};
488
+ emit: {};
489
+ }>) => import("vue").VNode & {
490
+ __ctx?: Awaited<typeof __VLS_setup>;
491
+ };
447
492
  ColorInput: import("vue").DefineComponent<import("./index.js").ColorInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("./index.js").ColorInputProps> & Readonly<{}>, {
448
493
  label: string | false;
449
494
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -454,9 +499,34 @@ declare const sourceMembers: {
454
499
  label: string | false;
455
500
  storeAsMinorUnits: boolean;
456
501
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
457
- DatagridInput: import("vue").DefineComponent<import("./index.js").DatagridInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("./index.js").DatagridInputProps> & Readonly<{}>, {
458
- optionValue: string;
459
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
502
+ DatagridInput: <TChoice extends import("./index.js").ChoiceRecord = import("./index.js").ChoiceRecord>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: {
503
+ attrs: any;
504
+ emit: {};
505
+ slots: {};
506
+ }, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
507
+ props: {
508
+ optionLabel?: string | undefined;
509
+ source?: string | undefined;
510
+ choices?: readonly (string | TChoice)[] | undefined;
511
+ optionText?: import("./index.js").OptionText<TChoice> | undefined;
512
+ optionValue?: import("@chelone/core").SourcePath<TChoice> | undefined;
513
+ disableValue?: import("@chelone/core").SourcePath<TChoice> | undefined;
514
+ translateChoice?: boolean | undefined;
515
+ label?: string | false | undefined;
516
+ helperText?: string | undefined;
517
+ defaultValue?: unknown;
518
+ validate?: (import("@chelone/core").Validator | readonly import("@chelone/core").Validator[]) | undefined;
519
+ disabled?: boolean | undefined;
520
+ readonly?: boolean | undefined;
521
+ class?: string | undefined;
522
+ } & import("vue").PublicProps;
523
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
524
+ attrs: any;
525
+ slots: {};
526
+ emit: {};
527
+ }>) => import("vue").VNode & {
528
+ __ctx?: Awaited<typeof __VLS_setup>;
529
+ };
460
530
  DateInput: import("vue").DefineComponent<import("./index.js").DateInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("./index.js").DateInputProps> & Readonly<{}>, {
461
531
  label: string | false;
462
532
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -577,12 +647,34 @@ declare const sourceMembers: {
577
647
  label: string | false;
578
648
  defaultCountry: import("libphonenumber-js").CountryCode;
579
649
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
580
- RadioButtonGroupInput: import("vue").DefineComponent<import("./index.js").RadioButtonGroupInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("./index.js").RadioButtonGroupInputProps> & Readonly<{}>, {
581
- label: string | false;
582
- optionValue: string;
583
- row: boolean;
584
- disableValue: string;
585
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
650
+ RadioButtonGroupInput: <TChoice extends import("./index.js").ChoiceRecord = import("./index.js").ChoiceRecord>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: {
651
+ attrs: any;
652
+ emit: {};
653
+ slots: {};
654
+ }, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
655
+ props: {
656
+ row?: boolean | undefined;
657
+ source?: string | undefined;
658
+ choices?: readonly (string | TChoice)[] | undefined;
659
+ optionText?: import("./index.js").OptionText<TChoice> | undefined;
660
+ optionValue?: import("@chelone/core").SourcePath<TChoice> | undefined;
661
+ disableValue?: import("@chelone/core").SourcePath<TChoice> | undefined;
662
+ translateChoice?: boolean | undefined;
663
+ label?: string | false | undefined;
664
+ helperText?: string | undefined;
665
+ defaultValue?: unknown;
666
+ validate?: (import("@chelone/core").Validator | readonly import("@chelone/core").Validator[]) | undefined;
667
+ disabled?: boolean | undefined;
668
+ readonly?: boolean | undefined;
669
+ class?: string | undefined;
670
+ } & import("vue").PublicProps;
671
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
672
+ attrs: any;
673
+ slots: {};
674
+ emit: {};
675
+ }>) => import("vue").VNode & {
676
+ __ctx?: Awaited<typeof __VLS_setup>;
677
+ };
586
678
  RatingInput: import("vue").DefineComponent<import("./index.js").RatingInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("./index.js").RatingInputProps> & Readonly<{}>, {
587
679
  label: string | false;
588
680
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -707,6 +799,38 @@ type WithSource<P, TSource> = "source" extends keyof P ? Omit<P, "source"> & (Pa
707
799
  type Retyped<TComponent extends Ctor, TSource> = Pick<TComponent, keyof TComponent> & (new (...args: ConstructorParameters<TComponent>) => Omit<InstanceType<TComponent>, "$props"> & {
708
800
  $props: WithSource<InstanceType<TComponent>["$props"], TSource>;
709
801
  });
802
+ /** The return type of an optional callback prop. */
803
+ type CallbackResult<TCallback> = NonNullable<TCallback> extends (...args: never[]) => infer TResult ? TResult : never;
804
+ /** The first parameter of an optional callback prop. */
805
+ type CallbackParam<TCallback> = NonNullable<TCallback> extends (value: infer TValue, ...args: never[]) => unknown ? TValue : never;
806
+ /**
807
+ * The `format`, `parse` and `transform` entries of `P` with `TValue` in place
808
+ * of the value they took or returned. Each stays optional and keeps the rest
809
+ * of its signature, and one `P` lacks is not added.
810
+ */
811
+ type ValueEntries<P, TValue> = {
812
+ [K in Extract<keyof P, "format" | "transform">]?: (value: TValue) => CallbackResult<P[K]>;
813
+ } & {
814
+ [K in Extract<keyof P, "parse">]?: (value: CallbackParam<P[K]>) => TValue;
815
+ };
816
+ /**
817
+ * A member whose props have a `format`, `parse` or `transform`: a generic
818
+ * function component over the literal `source`, so those callbacks take the
819
+ * value at it. Volar reads a function component's props off its first
820
+ * parameter and its slots off the second. `NoInfer` keeps `TPath` from being inferred back through
821
+ * `SourceValue` out of a callback's parameter, which overflows the type depth.
822
+ */
823
+ type ValueMember<TComponent extends Ctor, TRecord> = <TPath extends SourceProp<TRecord>>(props: Omit<InstanceType<TComponent>["$props"], "source" | "format" | "parse" | "transform"> & (Partial<Pick<InstanceType<TComponent>["$props"], "source">> extends Pick<InstanceType<TComponent>["$props"], "source"> ? {
824
+ source?: TPath;
825
+ } : {
826
+ source: TPath;
827
+ }) & ValueEntries<InstanceType<TComponent>["$props"], NoInfer<SourceValue<TRecord, TPath>>>, ctx?: {
828
+ slots?: InstanceType<TComponent>["$slots"];
829
+ }) => VNode;
830
+ /** The member type: {@link ValueMember} when the props have a value callback, else {@link Retyped}. */
831
+ type ResourceMember<TComponent extends Ctor, TRecord> = [
832
+ keyof InstanceType<TComponent>["$props"] & ("format" | "parse" | "transform")
833
+ ] extends [never] ? Retyped<TComponent, SourceProp<TRecord>> : ValueMember<TComponent, TRecord>;
710
834
  /**
711
835
  * A view with its `resource` prop removed. Templates are not strict about
712
836
  * undeclared attributes, so the prop stays as `never` to make
@@ -722,7 +846,7 @@ type BoundView<TComponent extends Ctor> = Pick<TComponent, keyof TComponent> & (
722
846
  * `TName`, and every field and input with `source` typed by `TName`'s record.
723
847
  */
724
848
  export type ResourceComponents<TResources extends ResourceMap, TName extends keyof TResources & string> = {
725
- [K in keyof SourceMembers as SourceMembers[K] extends Ctor ? K : never]: Retyped<Extract<SourceMembers[K], Ctor>, SourceProp<RecordOf<TResources, TName>>>;
849
+ [K in keyof SourceMembers as SourceMembers[K] extends Ctor ? K : never]: ResourceMember<Extract<SourceMembers[K], Ctor>, RecordOf<TResources, TName>>;
726
850
  } & {
727
851
  Edit: BoundView<typeof Edit>;
728
852
  Create: BoundView<typeof Create>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chelone/vue",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -57,7 +57,7 @@
57
57
  "dependencies": {
58
58
  "cronstrue": "^3.24.0",
59
59
  "libphonenumber-js": "^1.13.8",
60
- "@chelone/core": "0.4.0"
60
+ "@chelone/core": "0.5.0"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "@guolao/vue-monaco-editor": "^1.6.0",
@@ -76,7 +76,7 @@
76
76
  "terra-draw-maplibre-gl-adapter": "^1.5.0",
77
77
  "vue": "^3.4.0",
78
78
  "vue-router": "^4.0.0",
79
- "@chelone/supabase": "0.4.0"
79
+ "@chelone/supabase": "0.5.0"
80
80
  },
81
81
  "peerDependenciesMeta": {
82
82
  "@chelone/supabase": {
@@ -150,7 +150,7 @@
150
150
  "vue-router": "^4.0.0",
151
151
  "vue-tsc": "^2.0.0",
152
152
  "zod": "^3.24.0",
153
- "@chelone/supabase": "0.4.0"
153
+ "@chelone/supabase": "0.5.0"
154
154
  },
155
155
  "scripts": {
156
156
  "build": "vite build && vue-tsc -p tsconfig.build.json && node ../../scripts/strip-dts-css-imports.mjs dist && node ../../scripts/dts-extensions.mjs dist",