Moves formBuilder types, formValidation, useConditionalLogic, useFormSteps, and formatFieldValue from apps/portal/src to packages/form-schema/src. Adds @form-schema path alias to both apps/portal and apps/app. Vue field components remain per-app to allow independent visual evolution. Behavior-neutral: all 35 Vitest tests green. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1.3 KiB
1.3 KiB
@form-schema
Shared schema contract and schema-driven behaviors for Crewli form rendering. Consumed by apps/portal (public submission) and apps/app (organizer builder + submissions review).
What lives here
types/— TypeScript types and enum constants mirroring backendFormBuilderenums andPublicForm(Schema|Submission)Resourceutils/formValidation.ts— validation rule builders driven byFormFieldValidationRulescomposables/useConditionalLogic.ts— evaluateconditional_logic.show_whenagainst field valuescomposables/useFormSteps.ts— step navigation logic for multi-step formscomposables/formatFieldValue.ts— render a stored submission value as a human-readable string
What does NOT live here
Vue components. Each app renders its own UI. Portal has full-fidelity submit components; app has builder-preview and submissions-review components. Sharing renderers would couple the two apps' visual styles, which we explicitly want to avoid.
Contract stability
This is an alias-only shared directory inside the monorepo — no npm package, no semver. Breaking changes (new field type, new validation key, new conditional operator) require updating both apps in the same PR. TypeScript will flag missing cases in dispatchers.