@frigear-nu/forms 0.1.4 → 0.2.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 (45) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/app/components/FormBuilder.vue +1 -0
  3. package/dist/runtime/app/components/FormBuilderAccess.vue +1 -0
  4. package/dist/runtime/app/components/FormBuilderCaptchaSettings.vue +1 -0
  5. package/dist/runtime/app/components/FormBuilderCondition.vue +1 -0
  6. package/dist/runtime/app/components/FormBuilderFieldRow.d.vue.ts +2 -2
  7. package/dist/runtime/app/components/FormBuilderFieldRow.vue +1 -0
  8. package/dist/runtime/app/components/FormBuilderFieldRow.vue.d.ts +2 -2
  9. package/dist/runtime/app/components/FormBuilderFieldSettings.vue +1 -0
  10. package/dist/runtime/app/components/FormBuilderOptions.vue +1 -0
  11. package/dist/runtime/app/components/FormBuilderPhoneSettings.vue +1 -0
  12. package/dist/runtime/app/components/FormBuilderSettings.vue +1 -0
  13. package/dist/runtime/app/components/FormBuilderStepHeader.d.vue.ts +2 -2
  14. package/dist/runtime/app/components/FormBuilderStepHeader.vue +1 -0
  15. package/dist/runtime/app/components/FormBuilderStepHeader.vue.d.ts +2 -2
  16. package/dist/runtime/app/components/FormBuilderStepSettings.vue +1 -0
  17. package/dist/runtime/app/components/FormBuilderText.vue +1 -0
  18. package/dist/runtime/app/components/FormCaptcha.vue +1 -0
  19. package/dist/runtime/app/components/FormCreateSlideover.vue +1 -0
  20. package/dist/runtime/app/components/FormEmbed.vue +1 -0
  21. package/dist/runtime/app/components/FormField.vue +1 -0
  22. package/dist/runtime/app/components/FormImportSlideover.vue +1 -0
  23. package/dist/runtime/app/components/FormPhoneInput.vue +1 -0
  24. package/dist/runtime/app/components/FormPreview.vue +1 -0
  25. package/dist/runtime/app/components/FormRenderer.vue +1 -0
  26. package/dist/runtime/app/components/FormSubmissionView.vue +1 -0
  27. package/dist/runtime/app/composables/useCaptcha.js +1 -0
  28. package/dist/runtime/app/composables/useCaptchaSecrets.d.ts +14 -2
  29. package/dist/runtime/app/composables/useCaptchaSecrets.js +1 -0
  30. package/dist/runtime/app/composables/useFormActions.js +1 -0
  31. package/dist/runtime/app/composables/useFormBuilderEditor.d.ts +24 -7
  32. package/dist/runtime/app/composables/useFormBuilderEditor.js +1 -0
  33. package/dist/runtime/app/composables/useFormBuilderLabels.js +1 -0
  34. package/dist/runtime/app/composables/useFormStepper.d.ts +10 -7
  35. package/dist/runtime/app/composables/useFormStepper.js +1 -0
  36. package/dist/runtime/app/composables/useForms.d.ts +7 -6
  37. package/dist/runtime/app/composables/useForms.js +1 -0
  38. package/dist/runtime/app/pages/admin-form.vue +1 -0
  39. package/dist/runtime/app/pages/admin-submission.vue +1 -0
  40. package/dist/runtime/app/pages/admin-submissions.vue +1 -0
  41. package/dist/runtime/app/pages/admin.vue +1 -0
  42. package/dist/runtime/app/pages/form.vue +1 -0
  43. package/dist/runtime/menus.js +1 -0
  44. package/dist/runtime/server/utils/admin-schemas.d.ts +24 -24
  45. package/package.json +10 -10
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@frigear-nu/forms",
3
3
  "configKey": "forms",
4
- "version": "0.1.4",
4
+ "version": "0.2.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.3",
7
7
  "unbuild": "unknown"
@@ -3,6 +3,7 @@ import { fieldTypes } from "../../utils";
3
3
  import { useCaptchaSecrets } from "../composables/useCaptchaSecrets";
4
4
  import { useFormBuilderEditor } from "../composables/useFormBuilderEditor";
5
5
  import { fieldTypeIcons, useFormBuilderLabels } from "../composables/useFormBuilderLabels";
6
+ import { computed, useModuleT } from "#imports";
6
7
  const definition = defineModel({ type: Object, ...{ required: true } });
7
8
  const props = defineProps({
8
9
  formId: { type: String, required: false }
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
2
  import { formsApi, resolveAccess, setAccess } from "../../utils";
3
+ import { $fetch, computed, ref, useCopyToClipboard, useErrorToast, useFetch, useFormat, useModuleT, useRequestURL, useToast } from "#imports";
3
4
  const definition = defineModel({ type: Object, ...{ required: true } });
4
5
  const props = defineProps({
5
6
  formId: { type: String, required: true },
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
2
  import { captchaProviders } from "../../utils";
3
3
  import { captchaSiteKey } from "../composables/useCaptcha";
4
+ import { computed, useModuleT } from "#imports";
4
5
  const props = defineProps({
5
6
  field: { type: Object, required: true },
6
7
  formId: { type: String, required: false },
@@ -1,4 +1,5 @@
1
1
  <script setup>
2
+ import { computed, useModuleT } from "#imports";
2
3
  const props = defineProps({
3
4
  fields: { type: Array, required: true }
4
5
  });
@@ -6,21 +6,21 @@ type __VLS_Props = {
6
6
  };
7
7
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
8
  select: () => any;
9
+ remove: () => any;
9
10
  dragend: () => any;
10
11
  dragover: (event: DragEvent) => any;
11
12
  dragstart: (event: DragEvent) => any;
12
13
  up: () => any;
13
14
  down: () => any;
14
- remove: () => any;
15
15
  duplicate: () => any;
16
16
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
17
17
  onSelect?: (() => any) | undefined;
18
+ onRemove?: (() => any) | undefined;
18
19
  onDragend?: (() => any) | undefined;
19
20
  onDragover?: ((event: DragEvent) => any) | undefined;
20
21
  onDragstart?: ((event: DragEvent) => any) | undefined;
21
22
  onUp?: (() => any) | undefined;
22
23
  onDown?: (() => any) | undefined;
23
- onRemove?: (() => any) | undefined;
24
24
  onDuplicate?: (() => any) | undefined;
25
25
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
26
26
  declare const _default: typeof __VLS_export;
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
2
  import { fieldTypeIcons, useFormBuilderLabels } from "../composables/useFormBuilderLabels";
3
+ import { useModuleT } from "#imports";
3
4
  defineProps({
4
5
  field: { type: Object, required: true },
5
6
  selected: { type: Boolean, required: true },
@@ -6,21 +6,21 @@ type __VLS_Props = {
6
6
  };
7
7
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
8
  select: () => any;
9
+ remove: () => any;
9
10
  dragend: () => any;
10
11
  dragover: (event: DragEvent) => any;
11
12
  dragstart: (event: DragEvent) => any;
12
13
  up: () => any;
13
14
  down: () => any;
14
- remove: () => any;
15
15
  duplicate: () => any;
16
16
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
17
17
  onSelect?: (() => any) | undefined;
18
+ onRemove?: (() => any) | undefined;
18
19
  onDragend?: (() => any) | undefined;
19
20
  onDragover?: ((event: DragEvent) => any) | undefined;
20
21
  onDragstart?: ((event: DragEvent) => any) | undefined;
21
22
  onUp?: (() => any) | undefined;
22
23
  onDown?: (() => any) | undefined;
23
- onRemove?: (() => any) | undefined;
24
24
  onDuplicate?: (() => any) | undefined;
25
25
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
26
26
  declare const _default: typeof __VLS_export;
@@ -2,6 +2,7 @@
2
2
  import { translate } from "../../utils";
3
3
  import { useFormBuilderLabels } from "../composables/useFormBuilderLabels";
4
4
  import { useFormsLocale } from "../composables/useForms";
5
+ import { computed, useModuleT } from "#imports";
5
6
  const props = defineProps({
6
7
  field: { type: Object, required: true },
7
8
  at: { type: Object, required: true },
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
2
  import { arrayMove } from "../../utils";
3
+ import { useModuleT } from "#imports";
3
4
  const props = defineProps({
4
5
  options: { type: Array, required: false }
5
6
  });
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
2
  import { allPhoneCountries, countryName, defaultPhoneCountry, phoneCountries } from "../../utils";
3
3
  import { useFormsLocale } from "../composables/useForms";
4
+ import { computed, useModuleT } from "#imports";
4
5
  const props = defineProps({
5
6
  field: { type: Object, required: true }
6
7
  });
@@ -16,6 +16,7 @@ import {
16
16
  unknownBodyVariables
17
17
  } from "../../utils";
18
18
  import { useFormsLocale } from "../composables/useForms";
19
+ import { computed, ref, useModuleT } from "#imports";
19
20
  const definition = defineModel({ type: Object, ...{ required: true } });
20
21
  const t = useModuleT("forms");
21
22
  const locale = useFormsLocale();
@@ -10,18 +10,18 @@ type __VLS_Props = {
10
10
  };
11
11
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
12
  select: () => any;
13
+ remove: () => any;
13
14
  dragend: () => any;
14
15
  dragstart: (event: DragEvent) => any;
15
16
  up: () => any;
16
17
  down: () => any;
17
- remove: () => any;
18
18
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
19
19
  onSelect?: (() => any) | undefined;
20
+ onRemove?: (() => any) | undefined;
20
21
  onDragend?: (() => any) | undefined;
21
22
  onDragstart?: ((event: DragEvent) => any) | undefined;
22
23
  onUp?: (() => any) | undefined;
23
24
  onDown?: (() => any) | undefined;
24
- onRemove?: (() => any) | undefined;
25
25
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
26
26
  declare const _default: typeof __VLS_export;
27
27
  export default _default;
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
2
  import { translate } from "../../utils";
3
3
  import { useFormsLocale } from "../composables/useForms";
4
+ import { useModuleT } from "#imports";
4
5
  defineProps({
5
6
  step: { type: Object, required: true },
6
7
  index: { type: Number, required: true },
@@ -10,18 +10,18 @@ type __VLS_Props = {
10
10
  };
11
11
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
12
  select: () => any;
13
+ remove: () => any;
13
14
  dragend: () => any;
14
15
  dragstart: (event: DragEvent) => any;
15
16
  up: () => any;
16
17
  down: () => any;
17
- remove: () => any;
18
18
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
19
19
  onSelect?: (() => any) | undefined;
20
+ onRemove?: (() => any) | undefined;
20
21
  onDragend?: (() => any) | undefined;
21
22
  onDragstart?: ((event: DragEvent) => any) | undefined;
22
23
  onUp?: (() => any) | undefined;
23
24
  onDown?: (() => any) | undefined;
24
- onRemove?: (() => any) | undefined;
25
25
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
26
26
  declare const _default: typeof __VLS_export;
27
27
  export default _default;
@@ -1,4 +1,5 @@
1
1
  <script setup>
2
+ import { useModuleT } from "#imports";
2
3
  defineProps({
3
4
  step: { type: Object, required: true },
4
5
  conditionFields: { type: Array, required: true }
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
2
  import { collapseTranslated, expandTranslated, readTranslated } from "../../utils";
3
3
  import { useFormsLocale, useFormsLocales } from "../composables/useForms";
4
+ import { computed, ref, useModuleT } from "#imports";
4
5
  const props = defineProps({
5
6
  placeholder: { type: String, required: false },
6
7
  multiline: { type: Boolean, required: false },
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
2
  import { resolveCaptcha } from "../../utils";
3
3
  import { captchaDefaultProvider, captchaSiteKey, loadCaptchaScript } from "../composables/useCaptcha";
4
+ import { computed, onBeforeUnmount, onMounted, ref, useModuleT, useTemplateRef, watch } from "#imports";
4
5
  const props = defineProps({
5
6
  field: { type: Object, required: true },
6
7
  preview: { type: Boolean, required: false },
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
2
  import { z } from "zod";
3
3
  import { defineForm, formsApi } from "../../utils";
4
+ import { $fetch, reactive, useAction, useModuleT, watch } from "#imports";
4
5
  const emit = defineEmits(["close"]);
5
6
  const t = useModuleT("forms");
6
7
  const { busy, run } = useAction();
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
2
  import { embedMode, formsApi } from "../../utils";
3
+ import { $fetch, FORM_PASSWORD_HEADER, computed, ref, useAuthPages, useFormAccess, useModuleT, useRoute, watch } from "#imports";
3
4
  const props = defineProps({
4
5
  slug: { type: String, required: true },
5
6
  title: { type: Boolean, required: false, default: false },
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
2
  import { isCountryPhone, renderMarkdown, translate } from "../../utils";
3
+ import { computed, useModuleT } from "#imports";
3
4
  const props = defineProps({
4
5
  field: { type: Object, required: true },
5
6
  locale: { type: String, required: true },
@@ -1,6 +1,7 @@
1
1
  <script setup>
2
2
  import { z } from "zod";
3
3
  import { formsApi } from "../../utils";
4
+ import { $fetch, reactive, useAction, useModuleT } from "#imports";
4
5
  const emit = defineEmits(["close"]);
5
6
  const t = useModuleT("forms");
6
7
  const { busy, run } = useAction();
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
2
  import { composePhone, countryName, defaultPhoneCountry, parsePhone, phoneCountries } from "../../utils";
3
+ import { computed, ref, watch } from "#imports";
3
4
  const props = defineProps({
4
5
  config: { type: Object, required: false },
5
6
  locale: { type: String, required: true },
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
2
  import { PREVIEW_WIDTHS, previewScale } from "../../utils";
3
+ import { computed, onBeforeUnmount, onMounted, ref, useCopyToClipboard, useFormsPaths, useModuleT, useTemplateRef, watch } from "#imports";
3
4
  const props = defineProps({
4
5
  slug: { type: String, required: true },
5
6
  name: { type: String, required: false },
@@ -2,6 +2,7 @@
2
2
  import { previewPayload, translate } from "../../utils";
3
3
  import { emptyAnswers, submissionIssues, submitAnswers, useFormsLocale } from "../composables/useForms";
4
4
  import { useFormStepper } from "../composables/useFormStepper";
5
+ import { computed, getCurrentInstance, navigateTo, reactive, ref, useForm, useModuleT, useTemplateRef, useToast, watch } from "#imports";
5
6
  const props = defineProps({
6
7
  slug: { type: String, required: false },
7
8
  form: { type: Object, required: false },
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
2
  import { formsApi, isAnswerField, resolveVisibility, translate } from "../../utils";
3
+ import { computed, useFormsLocale, useModuleT } from "#imports";
3
4
  const props = defineProps({
4
5
  submission: { type: Object, required: true }
5
6
  });
@@ -1,4 +1,5 @@
1
1
  import { normalizeCaptchaProvider, resolveCaptcha } from "../../utils/index.js";
2
+ import { useRuntimeConfig } from "#imports";
2
3
  const SCRIPTS = {
3
4
  turnstile: { src: "https://challenges.cloudflare.com/turnstile/v0/api.js", global: "turnstile" },
4
5
  recaptcha: { src: "https://www.google.com/recaptcha/api.js", global: "grecaptcha" },
@@ -1,7 +1,19 @@
1
- import type { FormField } from '../../../types.js';
1
+ import type { FormField, FormSecretsDto } from '../../../types.js';
2
+ import type { MaybeRefOrGetter } from '#imports';
2
3
  /**
3
4
  * The write-only captcha secret key of a saved form. It is stored right away through the admin secrets API,
4
5
  * not with the definition. `field` is the currently selected field; the state only applies when it is a captcha.
5
6
  */
6
- export declare function useCaptchaSecrets(formId: MaybeRefOrGetter<string | undefined>, field: MaybeRefOrGetter<FormField | undefined>): any;
7
+ export declare function useCaptchaSecrets(formId: MaybeRefOrGetter<string | undefined>, field: MaybeRefOrGetter<FormField | undefined>): {
8
+ captcha: (Required<Pick<import("../../utils/index.js").CaptchaConfig, "provider">> & import("../../utils/index.js").CaptchaConfig) | undefined;
9
+ secrets: FormSecretsDto | undefined;
10
+ value: string;
11
+ saving: boolean;
12
+ loading: boolean;
13
+ source: import("../../utils/index.js").SecretSource | undefined;
14
+ statusLabel: any;
15
+ setValue: (next: string) => void;
16
+ save: () => Promise<void>;
17
+ remove: () => Promise<void>;
18
+ };
7
19
  export type CaptchaSecrets = ReturnType<typeof useCaptchaSecrets>;
@@ -1,5 +1,6 @@
1
1
  import { formsApi, resolveCaptcha } from "../../utils/index.js";
2
2
  import { captchaDefaultProvider } from "./useCaptcha.js";
3
+ import { $fetch, computed, onMounted, reactive, ref, toValue, useModuleT, useToast, watch } from "#imports";
3
4
  export function useCaptchaSecrets(formId, field) {
4
5
  const t = useModuleT("forms");
5
6
  const toast = useToast();
@@ -1,5 +1,6 @@
1
1
  import { LazyFormCreateSlideover, LazyFormImportSlideover } from "#components";
2
2
  import { formsApi } from "../../utils/index.js";
3
+ import { $fetch, navigateTo, refreshNuxtData, useAction, useConfirmDialog, useErrorToast, useFormLink, useFormsPaths, useModuleT, useOverlay, useToast } from "#imports";
3
4
  export const FORMS_LIST_KEY = "forms:admin:forms";
4
5
  export function useFormActions() {
5
6
  const t = useModuleT("forms");
@@ -1,5 +1,6 @@
1
1
  import type { FormDefinition, FormField, FormStep, FieldType } from '../../../types.js';
2
2
  import type { FieldPosition } from '../../utils/index.js';
3
+ import type { Ref } from '#imports';
3
4
  export type BuilderSelection = {
4
5
  kind: 'field';
5
6
  at: FieldPosition;
@@ -7,20 +8,35 @@ export type BuilderSelection = {
7
8
  kind: 'step';
8
9
  index: number;
9
10
  };
11
+ type Dragged = {
12
+ kind: 'field';
13
+ from: FieldPosition;
14
+ } | {
15
+ kind: 'step';
16
+ index: number;
17
+ };
18
+ type DropSlot = {
19
+ kind: 'field';
20
+ step: number;
21
+ index: number;
22
+ } | {
23
+ kind: 'step';
24
+ index: number;
25
+ };
10
26
  /**
11
27
  * State and edit actions of the form builder: what is selected, drag and drop reordering and every change to
12
28
  * the definition. All edits go through the `definition` model, so the builder stays a pure v-model component.
13
29
  */
14
30
  export declare function useFormBuilderEditor(definition: Ref<FormDefinition>): {
15
- selection: any;
16
- selectedField: any;
17
- selectedStep: any;
31
+ selection: Ref<BuilderSelection | undefined, BuilderSelection | undefined>;
32
+ selectedField: import("vue").ComputedRef<FormField | undefined>;
33
+ selectedStep: import("vue").ComputedRef<FormStep | undefined>;
18
34
  isSelected: (step: number, index: number) => boolean;
19
35
  isStepSelected: (index: number) => boolean;
20
36
  selectField: (at: FieldPosition) => void;
21
37
  selectStep: (index: number) => void;
22
- dragged: any;
23
- slot: any;
38
+ dragged: Ref<Dragged | undefined, Dragged | undefined>;
39
+ slot: Ref<DropSlot | undefined, DropSlot | undefined>;
24
40
  startFieldDrag: (event: DragEvent, from: FieldPosition) => void;
25
41
  startStepDrag: (event: DragEvent, index: number) => void;
26
42
  endDrag: () => void;
@@ -34,7 +50,7 @@ export declare function useFormBuilderEditor(definition: Ref<FormDefinition>): {
34
50
  showLine: (step: number, index: number) => boolean;
35
51
  showStepLine: (index: number) => boolean;
36
52
  addField: (type: FieldType, at: FieldPosition) => void;
37
- addStep: (index?: any) => void;
53
+ addStep: (index?: number) => void;
38
54
  removeAtField: (at: FieldPosition) => void;
39
55
  copyField: (at: FieldPosition) => void;
40
56
  nudge: (at: FieldPosition, delta: -1 | 1) => void;
@@ -45,5 +61,6 @@ export declare function useFormBuilderEditor(definition: Ref<FormDefinition>): {
45
61
  patchStep: (patch: Partial<FormStep>) => void;
46
62
  moveToStep: (step: number) => void;
47
63
  setMode: (mode: FormDefinition["mode"]) => Promise<void>;
48
- conditionFields: (step: number, index: number) => any;
64
+ conditionFields: (step: number, index: number) => string[];
49
65
  };
66
+ export {};
@@ -15,6 +15,7 @@ import {
15
15
  updateStep
16
16
  } from "../../utils/index.js";
17
17
  import { useConfirmDialog } from "@frigear-nu/ui/composables";
18
+ import { computed, ref, useModuleT, watch } from "#imports";
18
19
  export function useFormBuilderEditor(definition) {
19
20
  const t = useModuleT("forms");
20
21
  const confirm = useConfirmDialog();
@@ -1,5 +1,6 @@
1
1
  import { translate } from "../../utils/index.js";
2
2
  import { useFormsLocale } from "./useForms.js";
3
+ import { useModuleT } from "#imports";
3
4
  export const fieldTypeIcons = {
4
5
  text: "i-lucide-text-cursor-input",
5
6
  textarea: "i-lucide-align-left",
@@ -1,5 +1,6 @@
1
1
  import type { FormDefinition } from '../../../types.js';
2
2
  import type { Answers, MessageTranslator } from '../../utils/index.js';
3
+ import type { MaybeRefOrGetter } from '#imports';
3
4
  /**
4
5
  * State machine for single page and stepped forms. Steps and fields that are hidden by `showIf`
5
6
  * are skipped, so `current` always refers to a visible step.
@@ -8,13 +9,15 @@ export declare function useFormStepper(definition: MaybeRefOrGetter<FormDefiniti
8
9
  t?: MaybeRefOrGetter<MessageTranslator | undefined>;
9
10
  locale?: MaybeRefOrGetter<string>;
10
11
  }): {
11
- steps: any;
12
- index: any;
13
- current: any;
14
- isFirst: any;
15
- isLast: any;
16
- stepped: any;
17
- schema: any;
12
+ steps: import("vue").ComputedRef<import("../../utils/index.js").VisibleStep[]>;
13
+ index: import("vue").ComputedRef<number>;
14
+ current: import("vue").ComputedRef<import("../../utils/index.js").VisibleStep | undefined>;
15
+ isFirst: import("vue").ComputedRef<boolean>;
16
+ isLast: import("vue").ComputedRef<boolean>;
17
+ stepped: import("vue").ComputedRef<boolean>;
18
+ schema: import("vue").ComputedRef<import("zod").ZodObject<{
19
+ [x: string]: import("zod").ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
20
+ }, import("zod/v4/core").$strip>>;
18
21
  next: () => void;
19
22
  prev: () => void;
20
23
  reset: (to?: number) => void;
@@ -1,4 +1,5 @@
1
1
  import { buildFormSchema, resolveVisibility } from "../../utils/index.js";
2
+ import { computed, ref, toValue } from "#imports";
2
3
  export function useFormStepper(definition, answers, options = {}) {
3
4
  const position = ref(0);
4
5
  const steps = computed(() => resolveVisibility(toValue(definition), toValue(answers)));
@@ -1,14 +1,15 @@
1
- import type { FormDefinition, FormField, SubmitResponse } from '../../../types.js';
1
+ import type { FormAccessInfoDto, FormDefinition, FormField, PublicFormDto, SubmitResponse } from '../../../types.js';
2
+ import type { MaybeRefOrGetter } from '#imports';
2
3
  /** Locale for translated form content: `@nuxtjs/i18n`'s when installed, otherwise `en`. */
3
- export declare function useFormsLocale(): any;
4
+ export declare function useFormsLocale(): import("vue").ComputedRef<string>;
4
5
  /** Locales content can be translated into: `@nuxtjs/i18n`'s configured locales when installed, otherwise just `en`. */
5
- export declare function useFormsLocales(): any;
6
+ export declare function useFormsLocales(): import("vue").ComputedRef<string[]>;
6
7
  /** Header carrying the shared password of a password-protected form. */
7
8
  export declare const FORM_PASSWORD_HEADER = "x-form-password";
8
9
  /** Loads a published form definition by slug; `password` unlocks a password-protected form. */
9
- export declare function useForm(slug: MaybeRefOrGetter<string>, password?: MaybeRefOrGetter<string | undefined>): any;
10
+ export declare function useForm(slug: MaybeRefOrGetter<string>, password?: MaybeRefOrGetter<string | undefined>): import("#app").AsyncData<PublicFormDto | undefined, import("#app").NuxtError<unknown> | undefined>;
10
11
  /** Loads what the public page needs to choose between the form, a password/sign-in gate and "not found". */
11
- export declare function useFormAccess(slug: MaybeRefOrGetter<string>): any;
12
+ export declare function useFormAccess(slug: MaybeRefOrGetter<string>): import("#app").AsyncData<FormAccessInfoDto | undefined, import("#app").NuxtError<unknown> | undefined>;
12
13
  /** Initial answers: empty arrays for files, `false` for checkboxes, everything else unset. */
13
14
  export declare function emptyAnswers(definition: Pick<FormDefinition, 'steps'>): Record<string, unknown>;
14
15
  /** One problem with a submission, as the submit route reports it. */
@@ -34,7 +35,7 @@ declare const DEFAULT_PATHS: {
34
35
  export declare function useFormsPaths(): (name: keyof typeof DEFAULT_PATHS, params?: Record<string, string>) => string;
35
36
  /** Absolute public address of a form and a clipboard copier; `enabled` is false when the form page route is off. */
36
37
  export declare function useFormLink(): {
37
- enabled: any;
38
+ enabled: import("vue").ComputedRef<boolean>;
38
39
  url: (slug: string) => string;
39
40
  copy: (slug: string) => any;
40
41
  };
@@ -1,4 +1,5 @@
1
1
  import { formsApi, resolveVisibility, translate } from "../../utils/index.js";
2
+ import { $fetch, computed, toValue, useCopyToClipboard, useFetch, useModuleT, useNuxtApp, useRequestURL, useRuntimeConfig } from "#imports";
2
3
  export function useFormsLocale() {
3
4
  const nuxtApp = useNuxtApp();
4
5
  return computed(() => nuxtApp.$i18n?.locale?.value ?? "en");
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
2
  import { formDefinitionSchema, formsApi } from "../../utils";
3
+ import { $fetch, computed, navigateTo, reactive, ref, toRaw, useAction, useFetch, useFormActions, useFormsPaths, useModuleT, useRoute, watch } from "#imports";
3
4
  const t = useModuleT("forms");
4
5
  const route = useRoute();
5
6
  const paths = useFormsPaths();
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
2
  import { formsApi } from "../../utils";
3
+ import { computed, useFetch, useFormActions, useFormat, useFormsPaths, useModuleT, useRoute } from "#imports";
3
4
  const t = useModuleT("forms");
4
5
  const route = useRoute();
5
6
  const paths = useFormsPaths();
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
2
  import { formsApi } from "../../utils";
3
+ import { computed, useFetch, useFormActions, useFormat, useFormsPaths, useModuleT, useRoute, useTableQuery, useTableSort } from "#imports";
3
4
  const t = useModuleT("forms");
4
5
  const route = useRoute();
5
6
  const paths = useFormsPaths();
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
2
  import { formsApi } from "../../utils";
3
+ import { FORMS_LIST_KEY, computed, numericColumn, useFetch, useFormActions, useFormat, useFormsPaths, useModuleT, useTableQuery, useTableSort } from "#imports";
3
4
  const t = useModuleT("forms");
4
5
  const paths = useFormsPaths();
5
6
  const format = useFormat();
@@ -1,5 +1,6 @@
1
1
  <script setup>
2
2
  import { formsApi } from "../../utils";
3
+ import { $fetch, FORM_PASSWORD_HEADER, computed, createError, navigateTo, ref, useAuthPages, useFormAccess, useFormat, useHead, useModuleT, useRoute } from "#imports";
3
4
  const route = useRoute();
4
5
  const t = useModuleT("forms");
5
6
  const format = useFormat();
@@ -1,4 +1,5 @@
1
1
  import { defineMenuItem, defineMenuSource, extendMenuItem } from "@frigear-nu/menu/utils";
2
+ import { useRuntimeConfig } from "#imports";
2
3
  export default defineMenuSource(() => {
3
4
  const config = useRuntimeConfig().public.forms;
4
5
  if (config?.pages?.admin) {
@@ -13,8 +13,8 @@ export declare const formInput: z.ZodObject<{
13
13
  stepped: "stepped";
14
14
  }>;
15
15
  storage: z.ZodDefault<z.ZodEnum<{
16
- db: "db";
17
16
  none: "none";
17
+ db: "db";
18
18
  }>>;
19
19
  steps: z.ZodArray<z.ZodObject<{
20
20
  id: z.ZodString;
@@ -23,8 +23,8 @@ export declare const formInput: z.ZodObject<{
23
23
  showIf: z.ZodOptional<z.ZodObject<{
24
24
  field: z.ZodString;
25
25
  op: z.ZodEnum<{
26
- in: "in";
27
26
  eq: "eq";
27
+ in: "in";
28
28
  neq: "neq";
29
29
  empty: "empty";
30
30
  notEmpty: "notEmpty";
@@ -36,16 +36,16 @@ export declare const formInput: z.ZodObject<{
36
36
  key: z.ZodString;
37
37
  type: z.ZodEnum<{
38
38
  number: "number";
39
- date: "date";
40
- file: "file";
41
- email: "email";
42
39
  text: "text";
40
+ email: "email";
41
+ file: "file";
42
+ markdown: "markdown";
43
+ date: "date";
43
44
  tel: "tel";
44
45
  textarea: "textarea";
45
46
  select: "select";
46
47
  radio: "radio";
47
48
  checkbox: "checkbox";
48
- markdown: "markdown";
49
49
  captcha: "captcha";
50
50
  }>;
51
51
  content: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
@@ -98,8 +98,8 @@ export declare const formInput: z.ZodObject<{
98
98
  showIf: z.ZodOptional<z.ZodObject<{
99
99
  field: z.ZodString;
100
100
  op: z.ZodEnum<{
101
- in: "in";
102
101
  eq: "eq";
102
+ in: "in";
103
103
  neq: "neq";
104
104
  empty: "empty";
105
105
  notEmpty: "notEmpty";
@@ -123,8 +123,8 @@ export declare const formInput: z.ZodObject<{
123
123
  api: "api";
124
124
  }>>;
125
125
  auth: z.ZodDefault<z.ZodEnum<{
126
- none: "none";
127
126
  user: "user";
127
+ none: "none";
128
128
  token: "token";
129
129
  password: "password";
130
130
  }>>;
@@ -172,8 +172,8 @@ export declare const formPatch: z.ZodObject<{
172
172
  stepped: "stepped";
173
173
  }>;
174
174
  storage: z.ZodDefault<z.ZodEnum<{
175
- db: "db";
176
175
  none: "none";
176
+ db: "db";
177
177
  }>>;
178
178
  steps: z.ZodArray<z.ZodObject<{
179
179
  id: z.ZodString;
@@ -182,8 +182,8 @@ export declare const formPatch: z.ZodObject<{
182
182
  showIf: z.ZodOptional<z.ZodObject<{
183
183
  field: z.ZodString;
184
184
  op: z.ZodEnum<{
185
- in: "in";
186
185
  eq: "eq";
186
+ in: "in";
187
187
  neq: "neq";
188
188
  empty: "empty";
189
189
  notEmpty: "notEmpty";
@@ -195,16 +195,16 @@ export declare const formPatch: z.ZodObject<{
195
195
  key: z.ZodString;
196
196
  type: z.ZodEnum<{
197
197
  number: "number";
198
- date: "date";
199
- file: "file";
200
- email: "email";
201
198
  text: "text";
199
+ email: "email";
200
+ file: "file";
201
+ markdown: "markdown";
202
+ date: "date";
202
203
  tel: "tel";
203
204
  textarea: "textarea";
204
205
  select: "select";
205
206
  radio: "radio";
206
207
  checkbox: "checkbox";
207
- markdown: "markdown";
208
208
  captcha: "captcha";
209
209
  }>;
210
210
  content: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
@@ -257,8 +257,8 @@ export declare const formPatch: z.ZodObject<{
257
257
  showIf: z.ZodOptional<z.ZodObject<{
258
258
  field: z.ZodString;
259
259
  op: z.ZodEnum<{
260
- in: "in";
261
260
  eq: "eq";
261
+ in: "in";
262
262
  neq: "neq";
263
263
  empty: "empty";
264
264
  notEmpty: "notEmpty";
@@ -282,8 +282,8 @@ export declare const formPatch: z.ZodObject<{
282
282
  api: "api";
283
283
  }>>;
284
284
  auth: z.ZodDefault<z.ZodEnum<{
285
- none: "none";
286
285
  user: "user";
286
+ none: "none";
287
287
  token: "token";
288
288
  password: "password";
289
289
  }>>;
@@ -337,8 +337,8 @@ export declare const importInput: z.ZodObject<{
337
337
  stepped: "stepped";
338
338
  }>;
339
339
  storage: z.ZodDefault<z.ZodEnum<{
340
- db: "db";
341
340
  none: "none";
341
+ db: "db";
342
342
  }>>;
343
343
  steps: z.ZodArray<z.ZodObject<{
344
344
  id: z.ZodString;
@@ -347,8 +347,8 @@ export declare const importInput: z.ZodObject<{
347
347
  showIf: z.ZodOptional<z.ZodObject<{
348
348
  field: z.ZodString;
349
349
  op: z.ZodEnum<{
350
- in: "in";
351
350
  eq: "eq";
351
+ in: "in";
352
352
  neq: "neq";
353
353
  empty: "empty";
354
354
  notEmpty: "notEmpty";
@@ -360,16 +360,16 @@ export declare const importInput: z.ZodObject<{
360
360
  key: z.ZodString;
361
361
  type: z.ZodEnum<{
362
362
  number: "number";
363
- date: "date";
364
- file: "file";
365
- email: "email";
366
363
  text: "text";
364
+ email: "email";
365
+ file: "file";
366
+ markdown: "markdown";
367
+ date: "date";
367
368
  tel: "tel";
368
369
  textarea: "textarea";
369
370
  select: "select";
370
371
  radio: "radio";
371
372
  checkbox: "checkbox";
372
- markdown: "markdown";
373
373
  captcha: "captcha";
374
374
  }>;
375
375
  content: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
@@ -422,8 +422,8 @@ export declare const importInput: z.ZodObject<{
422
422
  showIf: z.ZodOptional<z.ZodObject<{
423
423
  field: z.ZodString;
424
424
  op: z.ZodEnum<{
425
- in: "in";
426
425
  eq: "eq";
426
+ in: "in";
427
427
  neq: "neq";
428
428
  empty: "empty";
429
429
  notEmpty: "notEmpty";
@@ -447,8 +447,8 @@ export declare const importInput: z.ZodObject<{
447
447
  api: "api";
448
448
  }>>;
449
449
  auth: z.ZodDefault<z.ZodEnum<{
450
- none: "none";
451
450
  user: "user";
451
+ none: "none";
452
452
  token: "token";
453
453
  password: "password";
454
454
  }>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frigear-nu/forms",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
4
4
  "description": "Dynamic, database-stored forms (single page or stepped) with submissions, file uploads and email delivery for the frigear ecosystem.",
5
5
  "homepage": "https://docs.frigear.dev/modules/forms",
6
6
  "repository": {
@@ -35,13 +35,13 @@
35
35
  "playground"
36
36
  ],
37
37
  "dependencies": {
38
- "@frigear-nu/admin": "0.1.3",
39
- "@frigear-nu/module-kit": "1.1.3",
40
- "@frigear-nu/notify": "0.1.3",
41
- "@frigear-nu/ui": "0.1.3",
42
- "@frigear-nu/auth": "0.1.5",
43
- "@frigear-nu/mcp": "0.1.3",
44
- "@frigear-nu/users": "1.1.4",
38
+ "@frigear-nu/admin": "0.2.0",
39
+ "@frigear-nu/module-kit": "1.2.0",
40
+ "@frigear-nu/notify": "0.2.0",
41
+ "@frigear-nu/ui": "0.2.0",
42
+ "@frigear-nu/auth": "0.2.0",
43
+ "@frigear-nu/mcp": "0.2.0",
44
+ "@frigear-nu/users": "1.2.0",
45
45
  "@libsql/client": "^0.18.0",
46
46
  "@nuxt/kit": "^4.6.1",
47
47
  "drizzle-kit": "^0.31.11",
@@ -51,7 +51,7 @@
51
51
  "zod": "^4.6.5"
52
52
  },
53
53
  "peerDependencies": {
54
- "@frigear-nu/menu": "0.1.3",
54
+ "@frigear-nu/menu": "0.2.0",
55
55
  "@nuxt/ui": "^4.12.0",
56
56
  "@nuxthub/core": "^0.10.8"
57
57
  },
@@ -64,7 +64,7 @@
64
64
  }
65
65
  },
66
66
  "devDependencies": {
67
- "@frigear-nu/menu": "0.1.3",
67
+ "@frigear-nu/menu": "0.2.0",
68
68
  "@nuxt/devtools": "^3.4.2",
69
69
  "@nuxt/eslint-config": "^1.17.0",
70
70
  "@nuxt/module-builder": "^1.0.3",