@duffcloudservices/site-forms 0.1.2 → 0.1.4
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.
- package/README.md +18 -4
- package/dist/composables/useFormSubmission.d.ts +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +554 -398
- package/dist/index.js.map +1 -1
- package/dist/presets.d.ts +13 -0
- package/dist/site-forms.css +1 -1
- package/dist/types.d.ts +12 -2
- package/package.json +1 -1
- package/src/DcsForm.vue +1 -9
- package/src/__tests__/fields.test.ts +0 -1
- package/src/__tests__/multi-step.test.ts +0 -1
- package/src/__tests__/presets.test.ts +64 -0
- package/src/__tests__/schema.test.ts +0 -1
- package/src/__tests__/submission.test.ts +40 -2
- package/src/__tests__/validation.test.ts +29 -0
- package/src/__tests__/visible-if.test.ts +1 -2
- package/src/composables/useFormSubmission.ts +3 -3
- package/src/composables/useFormValidation.ts +8 -7
- package/src/index.ts +11 -0
- package/src/presets.ts +192 -0
- package/src/schema/form-definition.schema.json +410 -45
- package/src/style.css +35 -0
- package/src/types.ts +26 -2
package/README.md
CHANGED
|
@@ -115,7 +115,6 @@ Place a YAML file at `<site>/.dcs/forms/contact.yaml`:
|
|
|
115
115
|
|
|
116
116
|
```yaml
|
|
117
117
|
formId: contact
|
|
118
|
-
title: Contact Us
|
|
119
118
|
submission:
|
|
120
119
|
kind: lead
|
|
121
120
|
fields:
|
|
@@ -177,7 +176,7 @@ shadcn primitives in without forking field components.
|
|
|
177
176
|
|
|
178
177
|
| Slot | Scope | Default |
|
|
179
178
|
| ---------- | ------------------------------------------------------------------ | ---------------------------------------------------- |
|
|
180
|
-
| `header` | `{ definition }` |
|
|
179
|
+
| `header` | `{ definition }` | Empty; page/section headings live outside the managed form |
|
|
181
180
|
| `progress` | `{ current, total, step }` | `Step N of M — Title` (multi-step only) |
|
|
182
181
|
| `actions` | `{ isFirstStep, isLastStep, submitting, prev, next }` | Plain `<button>` elements |
|
|
183
182
|
| `success` | `{ definition }` | `definition.successMessage` |
|
|
@@ -213,8 +212,19 @@ import {
|
|
|
213
212
|
|
|
214
213
|
The form root carries `data-form-key="<formId>"` and every field
|
|
215
214
|
wrapper carries `data-form-field-key="<fieldId>"`. The portal preview
|
|
216
|
-
iframe bridge uses these to
|
|
217
|
-
|
|
215
|
+
iframe bridge uses these to discover managed forms, show the preview
|
|
216
|
+
affordance, and route preview click / context-menu actions into the same
|
|
217
|
+
portal `FormManagerSheet`. Do not strip these attributes in custom
|
|
218
|
+
layouts.
|
|
219
|
+
|
|
220
|
+
`definitionOverride` is a preview-only draft path for the iframe. The
|
|
221
|
+
durable form truth still lives in the form definition saved by the
|
|
222
|
+
portal and in the committed `.dcs/forms/<formId>.yaml` snapshot consumed
|
|
223
|
+
by the site runtime.
|
|
224
|
+
|
|
225
|
+
For the cross-package first-party component contract (runtime markers,
|
|
226
|
+
bridge discovery, portal entry points, rollout, validation), see
|
|
227
|
+
[`../FIRST-PARTY-COMPONENTS.md`](../FIRST-PARTY-COMPONENTS.md).
|
|
218
228
|
|
|
219
229
|
## Schema validation
|
|
220
230
|
|
|
@@ -249,6 +259,10 @@ pnpm --filter @duffcloudservices/site-forms type-check # vue-tsc --noEmit
|
|
|
249
259
|
- **Publishing** — [`PUBLISHING.md`](./PUBLISHING.md) covers the
|
|
250
260
|
registry, OIDC trusted publishing, version bump policy, and the
|
|
251
261
|
exact dep line sibling customer-site repos should add.
|
|
262
|
+
- **First-party visual-editor contract** —
|
|
263
|
+
[`../FIRST-PARTY-COMPONENTS.md`](../FIRST-PARTY-COMPONENTS.md)
|
|
264
|
+
captures the shared adaptation model used by forms and future
|
|
265
|
+
component families.
|
|
252
266
|
- **Validation CLI** — [`cli/forms/README.md`](../../cli/forms/README.md)
|
|
253
267
|
documents `dcs forms validate` and `dcs forms doctor`, which lint
|
|
254
268
|
the `.dcs/forms/*.yaml` files in a customer-site repo.
|
|
@@ -10,7 +10,7 @@ export interface SubmitOptions {
|
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
12
|
* POSTs a form submission to
|
|
13
|
-
* `${apiBase}/
|
|
13
|
+
* `${apiBase}/sites/{siteSlug}/forms/{formId}/submissions`.
|
|
14
14
|
*
|
|
15
15
|
* Uses JSON for plain values and `multipart/form-data` when any
|
|
16
16
|
* value is a `File` (file-upload fields).
|
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export { validateField, validateForm, isFieldVisible, hasErrors, } from './compo
|
|
|
17
17
|
export { submitFormValues } from './composables/useFormSubmission';
|
|
18
18
|
export type { SubmitOptions } from './composables/useFormSubmission';
|
|
19
19
|
export { loadFormDefinitions, parseFormYaml } from './loaders/yaml';
|
|
20
|
+
export { buildStandardFormDefinition, STANDARD_FORM_PRESET_META, } from './presets';
|
|
21
|
+
export type { StandardFormPreset, BuildStandardFormOptions, } from './presets';
|
|
20
22
|
export { validateFormDefinition, warnIfInvalid, } from './schema/validate';
|
|
21
23
|
export type { SchemaValidationResult } from './schema/validate';
|
|
22
|
-
export type { DcsFormSubmitPayload, DcsFormSubmitSuccess, DcsFormSubmitError, FormErrors, FormValues, PortalFormDefinition, PortalFormField, PortalFormFieldType, PortalFormFieldOption, PortalFormFieldValidation, PortalFormFieldVisibleIf, PortalFormFieldWidth, PortalFormStep, PortalFormSubmissionConfig, PortalFormSubmissionLeadConfig, PortalFormSubmissionEmailConfig, PortalFormSubmissionWebhookConfig, } from './types';
|
|
24
|
+
export type { DcsFormSubmitPayload, DcsFormSubmitSuccess, DcsFormSubmitError, FormErrors, FormValues, PortalFormDefinition, PortalFormField, PortalFormKind, PortalFormFieldRole, PortalFormAttachmentPolicy, PortalFormFieldType, PortalFormFieldOption, PortalFormFieldValidation, PortalFormFieldVisibleIf, PortalFormFieldWidth, PortalFormStep, PortalFormSubmissionConfig, PortalFormSubmissionLeadConfig, PortalFormSubmissionEmailConfig, PortalFormSubmissionWebhookConfig, } from './types';
|