@pipelex/mthds-form 0.12.0 → 0.13.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.
@@ -441,9 +441,13 @@ interface StuffViewerProps {
441
441
  /** Which view opens first. Rendered, unless a host has a reason. */
442
442
  defaultView?: StuffViewerView;
443
443
  /**
444
- * Names the saved files: `<baseName>.json`, and any file inside the stuff
445
- * that carries no name of its own, whichever control saved it. Defaults to
446
- * the field's name, which is what the header shows.
444
+ * Names the saved files, whichever control saved them: the base name names
445
+ * the whole stuff, so the JSON copy is `<baseName>.json`, a file inside the
446
+ * stuff that carries no name of its own is `<baseName>-<place>`, and a stuff
447
+ * that is one file saves as `<baseName>.<ext>`. Defaults to the field's name,
448
+ * which is what the header shows. Give each stuff a distinct base name, as
449
+ * the default already is: two panels handed the same one save their unnamed
450
+ * files under the same names.
447
451
  */
448
452
  downloadBaseName?: string;
449
453
  /**
@@ -707,15 +711,62 @@ interface FieldStrings {
707
711
  optionalFieldsCount: (count: number) => string;
708
712
  optionalInputsCount: (count: number) => string;
709
713
  }
714
+ /** The English strings, which every control falls back to. Kept under this name for existing hosts. */
710
715
  declare const DEFAULT_FIELD_STRINGS: FieldStrings;
711
- /** Inject host-app strings over the English defaults for every control below. */
712
- declare function FieldStringsProvider({ strings, children, }: {
713
- strings: Partial<FieldStrings>;
716
+ /**
717
+ * Set the strings every control below speaks. `locale` picks a language pack by its code (`fr`,
718
+ * `fr-FR`, `en-GB`…; an unknown one falls back to English), and `strings` overrides single keys
719
+ * on top of it. Both are optional: with neither, the controls speak English.
720
+ */
721
+ declare function FieldStringsProvider({ locale, strings, children, }: {
722
+ locale?: string;
723
+ strings?: Partial<FieldStrings>;
714
724
  children: ReactNode;
715
725
  }): react.JSX.Element;
716
726
  /** The strings the nearest provider supplies (English defaults when none does). */
717
727
  declare function useFieldStrings(): FieldStrings;
718
728
 
729
+ /**
730
+ * The controls' strings in English: the package's defaults, and the pack every unknown or missing
731
+ * locale falls back to (see `fieldStringsFor` in `./index.ts`).
732
+ */
733
+
734
+ declare const EN_FIELD_STRINGS: FieldStrings;
735
+
736
+ /**
737
+ * The controls' strings in French: a complete `FieldStrings`, for a host that
738
+ * serves French and has no message catalogue of its own to bridge. Mounted as
739
+ * `<FieldStringsProvider strings={FR_FIELD_STRINGS}>`, or spread under a host's
740
+ * own overrides (`{ ...FR_FIELD_STRINGS, addItem: 'Ajouter une ligne' }`).
741
+ *
742
+ * The count-bearing messages apply French plural rules, where zero and one both
743
+ * take the singular (`0 élément`, `1 élément`, `2 éléments`), and a size is
744
+ * written the French way: `ko` and `Mo`, a decimal comma, a space before them.
745
+ * Both come from `Intl` (`PluralRules`, `NumberFormat`), not hand-written rules.
746
+ * A colon takes the no-break space French typography puts before it, so it
747
+ * never wraps onto a line of its own.
748
+ *
749
+ * Typed as `FieldStrings` rather than `Partial`, so a key added to the contract
750
+ * fails the build here until it is translated.
751
+ */
752
+
753
+ declare const FR_FIELD_STRINGS: FieldStrings;
754
+
755
+ /**
756
+ * The language packs, by locale code, and the switch that picks one. A new language is one file in
757
+ * this folder, typed as a whole `FieldStrings`, added to `FIELD_STRINGS_BY_LOCALE` below.
758
+ */
759
+
760
+ /** Every language pack the package ships, keyed by its primary language subtag. */
761
+ declare const FIELD_STRINGS_BY_LOCALE: Readonly<Record<string, FieldStrings>>;
762
+ /** The locale codes a pack exists for. */
763
+ declare const SUPPORTED_LOCALES: string[];
764
+ /**
765
+ * The pack for a locale code, read as BCP 47: its primary language subtag decides, so `fr`,
766
+ * `fr-FR`, `fr_CA` and `FR` all give French. A missing or unknown locale gives English.
767
+ */
768
+ declare function fieldStringsFor(locale?: string | null): FieldStrings;
769
+
719
770
  declare function FieldDomIdProvider({ prefix, children, }: {
720
771
  /**
721
772
  * Omit to mint one from `useId`; `''` writes the path unprefixed. An explicit
@@ -773,4 +824,4 @@ declare function useFieldPresentation(): FieldPresentation;
773
824
  */
774
825
  declare function humanizeFieldName(name: string): string;
775
826
 
776
- export { BooleanField, ConceptPill, DEFAULT_FIELD_STRINGS, DateField, DocumentField, type DownloadDisplay, EnumField, FieldDomIdProvider, FieldEnv, type FieldPresentation, FieldPresentationProvider, FieldShell, type FieldStrings, FieldStringsProvider, type FileValue, HtmlPreview, type HtmlPreviewProps, ImageField, JsonView, ListField, Markdown, type MarkdownProps, NumberField, ObjectField, OptionalToggle, ProseField, type ProseImages, type ResolveShareUrl, type ResolveUrl, ResultEnvProvider, ResultField, type ResultFieldProps, StuffViewer, type StuffViewerProps, type StuffViewerView, TextField, UnknownField, fieldControlClass, humanizeFieldName, saveInBrowser, useFieldDomId, useFieldPresentation, useFieldStrings, useProseImages, useResolveShareUrl, useResolveUrl, useResolvedUrl };
827
+ export { BooleanField, ConceptPill, DEFAULT_FIELD_STRINGS, DateField, DocumentField, type DownloadDisplay, EN_FIELD_STRINGS, EnumField, FIELD_STRINGS_BY_LOCALE, FR_FIELD_STRINGS, FieldDomIdProvider, FieldEnv, type FieldPresentation, FieldPresentationProvider, FieldShell, type FieldStrings, FieldStringsProvider, type FileValue, HtmlPreview, type HtmlPreviewProps, ImageField, JsonView, ListField, Markdown, type MarkdownProps, NumberField, ObjectField, OptionalToggle, ProseField, type ProseImages, type ResolveShareUrl, type ResolveUrl, ResultEnvProvider, ResultField, type ResultFieldProps, SUPPORTED_LOCALES, StuffViewer, type StuffViewerProps, type StuffViewerView, TextField, UnknownField, fieldControlClass, fieldStringsFor, humanizeFieldName, saveInBrowser, useFieldDomId, useFieldPresentation, useFieldStrings, useProseImages, useResolveShareUrl, useResolveUrl, useResolvedUrl };
@@ -1,11 +1,11 @@
1
1
  "use client";
2
- export { BooleanField, ConceptPill, DEFAULT_FIELD_STRINGS, DateField, DocumentField, EnumField, FieldDomIdProvider, FieldPresentationProvider, FieldRenderer, FieldShell, FieldStringsProvider, HtmlPreview, ImageField, JsonView, ListField, Markdown, NumberField, ObjectField, OptionalToggle, ProseField, ResultEnvProvider, ResultField, StuffViewer, TextField, UnknownField, fieldControlClass, humanizeFieldName, saveInBrowser, useFieldDomId, useFieldPresentation, useFieldStrings, useProseImages, useResolveShareUrl, useResolveUrl, useResolvedUrl } from '../chunk-4KX6YTLW.js';
3
- import '../chunk-V7T4DM63.js';
4
- import '../chunk-VS5JMFUV.js';
2
+ export { BooleanField, ConceptPill, DEFAULT_FIELD_STRINGS, DateField, DocumentField, EN_FIELD_STRINGS, EnumField, FIELD_STRINGS_BY_LOCALE, FR_FIELD_STRINGS, FieldDomIdProvider, FieldPresentationProvider, FieldRenderer, FieldShell, FieldStringsProvider, HtmlPreview, ImageField, JsonView, ListField, Markdown, NumberField, ObjectField, OptionalToggle, ProseField, ResultEnvProvider, ResultField, SUPPORTED_LOCALES, StuffViewer, TextField, UnknownField, fieldControlClass, fieldStringsFor, humanizeFieldName, saveInBrowser, useFieldDomId, useFieldPresentation, useFieldStrings, useProseImages, useResolveShareUrl, useResolveUrl, useResolvedUrl } from '../chunk-D2EQVWGN.js';
3
+ import '../chunk-7KQXGG6J.js';
4
+ import '../chunk-RRTI7AIR.js';
5
5
  import '../chunk-CM4KVG53.js';
6
6
  import '../chunk-FABY3DEY.js';
7
7
  import '../chunk-XCO6GTEC.js';
8
- import '../chunk-PM55AHRO.js';
8
+ import '../chunk-MJQ7CXUB.js';
9
9
  import '../chunk-GKV77RAS.js';
10
10
  import '../chunk-V3OV2XQT.js';
11
11
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipelex/mthds-form",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Headless form kernel and control set for MTHDS method inputs",
5
5
  "license": "MIT",
6
6
  "repository": {