@form-engine-ts/core 2.9.5 → 3.0.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.
package/README.md CHANGED
@@ -29,7 +29,8 @@ if (!result.valid) console.error(result.issues);
29
29
  Add `pages` to partition every field into an accessible wizard and use `validatePageAnswers(schema, pageIndex, values)`
30
30
  for step-scoped validation. Schemas without `pages` remain single-page forms.
31
31
 
32
- Store authoring-time translations on forms, fields, options, and pages. `resolveLocalizedSchema` applies them synchronously,
32
+ Store authoring-time translations on forms, fields, options, and pages. `resolveLocalizedSchema(schema, locale)` applies
33
+ them synchronously and returns the original schema when no locale is supplied,
33
34
  while `populateSchemaTranslations` fills them through an injected `AsyncTranslationAdapter`. Population defaults to
34
35
  `overwrite: "missing-only"`, accepts per-slot `shouldOverwrite` and `createMetadata` callbacks, and returns
35
36
  `{ schema, report }` with updated and skipped translation slots.
package/dist/index.cjs CHANGED
@@ -2035,7 +2035,7 @@ function translationSlots(schema, locale) {
2035
2035
  return descriptors;
2036
2036
  }
2037
2037
  function resolveLocalizedSchema(schema, targetLocale) {
2038
- if (targetLocale.length === 0 || targetLocale === schema.defaultLocale) return schema;
2038
+ if (targetLocale === void 0 || targetLocale.length === 0 || targetLocale === schema.defaultLocale) return schema;
2039
2039
  const formTranslation = schema.translations?.[targetLocale];
2040
2040
  const completionMessage = formTranslation?.completionMessage ?? schema.completionMessage;
2041
2041
  return {
package/dist/index.d.cts CHANGED
@@ -611,7 +611,7 @@ interface TranslationReport {
611
611
  readonly updatedSlots: readonly TranslationSlot[];
612
612
  readonly skippedSlots: readonly TranslationSlot[];
613
613
  }
614
- declare function resolveLocalizedSchema(schema: FormSchema, targetLocale: string): FormSchema;
614
+ declare function resolveLocalizedSchema(schema: FormSchema, targetLocale?: string): FormSchema;
615
615
  declare function populateSchemaTranslations(schema: FormSchema, targetLocales: readonly string[], adapter: AsyncTranslationAdapter, options?: PopulateTranslationOptions): Promise<{
616
616
  readonly schema: FormSchema;
617
617
  readonly report: TranslationReport;
package/dist/index.d.ts CHANGED
@@ -611,7 +611,7 @@ interface TranslationReport {
611
611
  readonly updatedSlots: readonly TranslationSlot[];
612
612
  readonly skippedSlots: readonly TranslationSlot[];
613
613
  }
614
- declare function resolveLocalizedSchema(schema: FormSchema, targetLocale: string): FormSchema;
614
+ declare function resolveLocalizedSchema(schema: FormSchema, targetLocale?: string): FormSchema;
615
615
  declare function populateSchemaTranslations(schema: FormSchema, targetLocales: readonly string[], adapter: AsyncTranslationAdapter, options?: PopulateTranslationOptions): Promise<{
616
616
  readonly schema: FormSchema;
617
617
  readonly report: TranslationReport;
package/dist/index.js CHANGED
@@ -1967,7 +1967,7 @@ function translationSlots(schema, locale) {
1967
1967
  return descriptors;
1968
1968
  }
1969
1969
  function resolveLocalizedSchema(schema, targetLocale) {
1970
- if (targetLocale.length === 0 || targetLocale === schema.defaultLocale) return schema;
1970
+ if (targetLocale === void 0 || targetLocale.length === 0 || targetLocale === schema.defaultLocale) return schema;
1971
1971
  const formTranslation = schema.translations?.[targetLocale];
1972
1972
  const completionMessage = formTranslation?.completionMessage ?? schema.completionMessage;
1973
1973
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@form-engine-ts/core",
3
- "version": "2.9.5",
3
+ "version": "3.0.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },