ropav 0.13.0 → 0.15.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/dist/components/accordion/index.d.ts +1 -0
- package/dist/components/alert-dialog/alert-dialog-backdrop.js +3 -1
- package/dist/components/autocomplete/index.d.ts +1 -0
- package/dist/components/calendar/index.d.ts +1 -0
- package/dist/components/checkbox-group/index.d.ts +1 -0
- package/dist/components/color-slider/index.d.ts +1 -0
- package/dist/components/combo-box/index.d.ts +2 -0
- package/dist/components/date-field/index.d.ts +1 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-range-picker/index.d.ts +2 -0
- package/dist/components/date-range-picker/use-date-range-picker.js +1 -1
- package/dist/components/disclosure-group/index.d.ts +1 -0
- package/dist/components/drawer/drawer-backdrop.js +3 -1
- package/dist/components/dropdown/dropdown-menu.js +7 -3
- package/dist/components/dropdown/dropdown-root.js +1 -1
- package/dist/components/dropdown/dropdown-submenu-trigger.js +1 -1
- package/dist/components/dropdown/dropdown.context.d.ts +1 -1
- package/dist/components/dropdown/index.d.ts +1 -0
- package/dist/components/field-error/field-error-root.js +1 -1
- package/dist/components/form/form-root.js +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/meter/meter-root.js +1 -1
- package/dist/components/modal/modal-backdrop.js +3 -1
- package/dist/components/number-field/index.d.ts +1 -0
- package/dist/components/overlay/overlay-popover.js +15 -6
- package/dist/components/portal-provider/index.d.ts +3 -0
- package/dist/components/portal-provider/index.js +2 -0
- package/dist/components/portal-provider/portal-provider.d.ts +21 -0
- package/dist/components/portal-provider/portal-provider.js +20 -0
- package/dist/components/portal-provider/portal-provider.types.d.ts +22 -0
- package/dist/components/radio-group/index.d.ts +1 -0
- package/dist/components/range-calendar/index.d.ts +1 -0
- package/dist/components/segmented-control/index.d.ts +1 -0
- package/dist/components/select/index.d.ts +1 -0
- package/dist/components/slider/index.d.ts +1 -0
- package/dist/components/table/table-drag-handle.js +1 -1
- package/dist/components/tabs/index.d.ts +1 -0
- package/dist/components/tabs/tabs-root.js +5 -0
- package/dist/components/tabs/tabs.types.d.ts +8 -0
- package/dist/components/time-field/index.d.ts +2 -0
- package/dist/components/toast/toast-provider.js +3 -1
- package/dist/components/toggle-button/index.d.ts +1 -0
- package/dist/components/toggle-button-group/index.d.ts +1 -0
- package/dist/components/tooltip/index.d.ts +1 -0
- package/dist/components/tooltip/tooltip-content.js +4 -1
- package/dist/composables/drag-manager.js +1 -1
- package/dist/composables/drag-modality.js +2 -1
- package/dist/composables/focus-scope-registry.d.ts +27 -0
- package/dist/composables/focus-scope-registry.js +45 -0
- package/dist/composables/form-context.d.ts +25 -0
- package/dist/composables/form-context.js +17 -0
- package/dist/composables/index.d.ts +1 -24
- package/dist/composables/interaction-modality.d.ts +42 -0
- package/dist/composables/interaction-modality.js +91 -0
- package/dist/composables/use-calendar-cell.js +1 -1
- package/dist/composables/use-checkbox-group-state.js +2 -1
- package/dist/composables/use-combo-box-state.d.ts +2 -1
- package/dist/composables/use-combo-box-state.js +3 -2
- package/dist/composables/use-combo-box.js +6 -3
- package/dist/composables/use-css-variable.js +1 -5
- package/dist/composables/use-default-locale.d.ts +9 -0
- package/dist/composables/use-default-locale.js +39 -0
- package/dist/composables/use-dismissable.d.ts +6 -0
- package/dist/composables/use-dismissable.js +9 -11
- package/dist/composables/use-display-names.js +1 -1
- package/dist/composables/use-drag.js +1 -1
- package/dist/composables/use-droppable-collection.js +1 -1
- package/dist/composables/use-focus-scope.d.ts +6 -12
- package/dist/composables/use-focus-scope.js +14 -33
- package/dist/composables/use-form-validation-state.d.ts +1 -60
- package/dist/composables/use-form-validation-state.js +3 -134
- package/dist/composables/use-form-validation.d.ts +2 -1
- package/dist/composables/use-form-validation.js +2 -2
- package/dist/composables/use-interaction-states.d.ts +0 -36
- package/dist/composables/use-interaction-states.js +8 -91
- package/dist/composables/use-locale.d.ts +0 -14
- package/dist/composables/use-locale.js +4 -37
- package/dist/composables/use-localized-string-dictionary.d.ts +10 -0
- package/dist/composables/use-localized-string-dictionary.js +26 -0
- package/dist/composables/use-localized-string-formatter.d.ts +0 -9
- package/dist/composables/use-localized-string-formatter.js +3 -24
- package/dist/composables/use-long-press.d.ts +0 -2
- package/dist/composables/use-long-press.js +2 -2
- package/dist/composables/use-menu-trigger-state.d.ts +64 -0
- package/dist/composables/use-menu-trigger-state.js +90 -0
- package/dist/composables/use-menu-trigger.d.ts +2 -1
- package/dist/composables/use-modal-overlay.d.ts +2 -1
- package/dist/composables/use-modal-overlay.js +17 -4
- package/dist/composables/use-overlay-trigger-state.d.ts +0 -62
- package/dist/composables/use-overlay-trigger-state.js +2 -87
- package/dist/composables/use-page-size.d.ts +14 -0
- package/dist/composables/use-page-size.js +42 -0
- package/dist/composables/use-portal.d.ts +35 -0
- package/dist/composables/use-portal.js +47 -0
- package/dist/composables/use-press.d.ts +0 -20
- package/dist/composables/use-press.js +3 -26
- package/dist/composables/use-range-calendar.js +1 -1
- package/dist/composables/use-select-state.d.ts +1 -1
- package/dist/composables/use-select-state.js +1 -1
- package/dist/composables/use-slider.js +1 -1
- package/dist/composables/use-toast-region.js +2 -1
- package/dist/composables/use-tooltip-trigger-state.js +1 -15
- package/dist/composables/use-tooltip-trigger.js +1 -1
- package/dist/composables/use-viewport-size.d.ts +0 -13
- package/dist/composables/use-viewport-size.js +1 -38
- package/dist/composables/validation-result.d.ts +37 -0
- package/dist/composables/validation-result.js +122 -0
- package/dist/composables/virtual-event.d.ts +20 -0
- package/dist/composables/virtual-event.js +28 -0
- package/dist/index.js +13 -35
- package/dist/ropav.min.css +1 -1
- package/dist/utils/aria-hide-outside.d.ts +4 -1
- package/dist/utils/aria-hide-outside.js +17 -5
- package/dist/utils/date-validation.js +1 -1
- package/dist/utils/region.d.ts +10 -0
- package/dist/utils/region.js +13 -0
- package/dist/version.js +1 -1
- package/package.json +6 -2
|
@@ -1,34 +1,8 @@
|
|
|
1
|
+
import { innermostContainingScope, isElementInAnyFocusScope, registerFocusScope } from "./focus-scope-registry.js";
|
|
1
2
|
import { tabbableIn } from "../utils/focus.js";
|
|
2
3
|
import { onScopeDispose, toValue, watch } from "vue";
|
|
3
4
|
//#region src/composables/use-focus-scope.ts
|
|
4
5
|
/**
|
|
5
|
-
* Registered scopes, outermost first.
|
|
6
|
-
*
|
|
7
|
-
* Module-level because containment is a question about the whole page, not about one overlay:
|
|
8
|
-
* only the innermost containing scope may hold focus, and focus moving into a scope nested
|
|
9
|
-
* inside it has to be allowed through rather than pulled back.
|
|
10
|
-
*/
|
|
11
|
-
var scopes = [];
|
|
12
|
-
var innermostContainingScope = () => {
|
|
13
|
-
for (let index = scopes.length - 1; index >= 0; index--) {
|
|
14
|
-
const scope = scopes[index];
|
|
15
|
-
if (scope.contain()) return scope;
|
|
16
|
-
}
|
|
17
|
-
return null;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Whether the element sits inside any registered scope.
|
|
21
|
-
*
|
|
22
|
-
* Any scope rather than only the descendants of one, because an overlay opened from inside
|
|
23
|
-
* another is a **sibling** in the DOM rather than a descendant — a submenu renders into its root
|
|
24
|
-
* popover's container, and a dropdown opened from a popover makes a container of its own. There
|
|
25
|
-
* is no tree to walk here, so a scope boundary is the thing that answers "focus is still in an
|
|
26
|
-
* overlay". React Aria walks its scope tree and asks the narrower question; the difference shows
|
|
27
|
-
* only when two unrelated overlays are open at once and focus moves between them, where this
|
|
28
|
-
* errs towards leaving them open.
|
|
29
|
-
*/
|
|
30
|
-
var isElementInAnyFocusScope = (element) => scopes.some((scope) => scope.root()?.contains(element));
|
|
31
|
-
/**
|
|
32
6
|
* Keep focus inside an overlay and give it back when the overlay closes, ported from React
|
|
33
7
|
* Aria's `FocusScope`.
|
|
34
8
|
*
|
|
@@ -57,8 +31,14 @@ var useFocusScope = (options) => {
|
|
|
57
31
|
const getRoot = () => toValue(options.scopeRef) ?? null;
|
|
58
32
|
const scope = {
|
|
59
33
|
contain: () => Boolean(toValue(options.contain)),
|
|
34
|
+
region: () => toValue(options.region) ?? null,
|
|
60
35
|
root: getRoot
|
|
61
36
|
};
|
|
37
|
+
/** Whether an element is somewhere this scope has any say over. */
|
|
38
|
+
const isInRegion = (element) => {
|
|
39
|
+
const region = scope.region();
|
|
40
|
+
return !region || !element || region.contains(element);
|
|
41
|
+
};
|
|
62
42
|
const focusElement = (element) => {
|
|
63
43
|
element?.focus({ preventScroll: true });
|
|
64
44
|
};
|
|
@@ -75,7 +55,8 @@ var useFocusScope = (options) => {
|
|
|
75
55
|
const ownerDocument = root.ownerDocument;
|
|
76
56
|
const onKeydown = (event) => {
|
|
77
57
|
if (event.key !== "Tab" || event.altKey || event.ctrlKey || event.metaKey) return;
|
|
78
|
-
if (innermostContainingScope() !== scope) return;
|
|
58
|
+
if (innermostContainingScope(scope.region()) !== scope) return;
|
|
59
|
+
if (!isInRegion(ownerDocument.activeElement)) return;
|
|
79
60
|
const focusable = tabbableIn(root);
|
|
80
61
|
if (focusable.length === 0) {
|
|
81
62
|
event.preventDefault();
|
|
@@ -88,9 +69,10 @@ var useFocusScope = (options) => {
|
|
|
88
69
|
focusElement(next);
|
|
89
70
|
};
|
|
90
71
|
const onFocusin = (event) => {
|
|
91
|
-
if (innermostContainingScope() !== scope) return;
|
|
72
|
+
if (innermostContainingScope(scope.region()) !== scope) return;
|
|
92
73
|
const target = event.target;
|
|
93
74
|
if (!(target instanceof Element)) return;
|
|
75
|
+
if (!isInRegion(target)) return;
|
|
94
76
|
if (isElementInAnyFocusScope(target)) return;
|
|
95
77
|
focusElement(root);
|
|
96
78
|
};
|
|
@@ -105,15 +87,14 @@ var useFocusScope = (options) => {
|
|
|
105
87
|
detach();
|
|
106
88
|
if (!root || !isActive) return;
|
|
107
89
|
const previouslyFocused = root.ownerDocument.activeElement;
|
|
108
|
-
|
|
90
|
+
const unregister = registerFocusScope(scope);
|
|
109
91
|
attach(root);
|
|
110
92
|
const autoFocus = toValue(options.autoFocus);
|
|
111
93
|
if (autoFocus === "first" || autoFocus === "last") focusEnd(root, autoFocus);
|
|
112
94
|
else if (autoFocus) focusElement(root);
|
|
113
95
|
onCleanup(() => {
|
|
114
96
|
detach();
|
|
115
|
-
|
|
116
|
-
if (index >= 0) scopes.splice(index, 1);
|
|
97
|
+
unregister();
|
|
117
98
|
if (!toValue(options.restoreFocus)) return;
|
|
118
99
|
const active = root.ownerDocument.activeElement;
|
|
119
100
|
if (!(!active || active === root.ownerDocument.body || root.contains(active))) return;
|
|
@@ -127,4 +108,4 @@ var useFocusScope = (options) => {
|
|
|
127
108
|
onScopeDispose(() => detach(), true);
|
|
128
109
|
};
|
|
129
110
|
//#endregion
|
|
130
|
-
export {
|
|
111
|
+
export { useFocusScope };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComputedRef, MaybeRefOrGetter
|
|
1
|
+
import type { ComputedRef, MaybeRefOrGetter } from "vue";
|
|
2
2
|
/**
|
|
3
3
|
* Snapshot of an element's `ValidityState`.
|
|
4
4
|
*
|
|
@@ -36,65 +36,13 @@ export interface ValidationResult {
|
|
|
36
36
|
export type ValidationBehavior = "aria" | "native";
|
|
37
37
|
/** Returns a message, several, or nothing at all when the value is acceptable. */
|
|
38
38
|
export type ValidationFunction<T> = (value: T) => string | string[] | true | null | undefined;
|
|
39
|
-
export declare const VALID_VALIDITY_STATE: ValidationDetails;
|
|
40
|
-
/** Failure that came from a prop, a `validate` function or the server rather than the browser. */
|
|
41
|
-
export declare const CUSTOM_VALIDITY_STATE: ValidationDetails;
|
|
42
|
-
/** A required field with nothing in it. What the browser reports under `"native"`. */
|
|
43
|
-
export declare const MISSING_VALIDITY_STATE: ValidationDetails;
|
|
44
|
-
export declare const DEFAULT_VALIDATION_RESULT: ValidationResult;
|
|
45
|
-
/**
|
|
46
|
-
* One verdict out of several, for a control whose value has more than one part.
|
|
47
|
-
*
|
|
48
|
-
* Invalid if any part is, with the messages collected in order and deduplicated — two ends of a
|
|
49
|
-
* range that are both out of bounds say the same thing, and saying it twice is not more helpful.
|
|
50
|
-
*/
|
|
51
|
-
export declare const mergeValidation: (...results: ValidationResult[]) => ValidationResult;
|
|
52
|
-
/** Form controls that take part in constraint validation. */
|
|
53
|
-
export type ValidatableElement = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
|
|
54
|
-
/** Freeze an element's live validity into a result the state layer can hold. */
|
|
55
|
-
export declare const getNativeValidation: (element: ValidatableElement) => ValidationResult;
|
|
56
39
|
/**
|
|
57
40
|
* The kinds of control a required field can be. Each is a different sentence: a list asks to be
|
|
58
41
|
* chosen from, a checkbox to be ticked.
|
|
59
42
|
*/
|
|
60
43
|
export type RequiredControl = "checkbox" | "radio" | "select" | "text";
|
|
61
|
-
/**
|
|
62
|
-
* What the browser would say about an empty control of this kind.
|
|
63
|
-
*
|
|
64
|
-
* Read off a detached probe rather than translated here. The platform already holds the sentence,
|
|
65
|
-
* in the *browser's* locale — which is the locale a validation message belongs in, since it sits
|
|
66
|
-
* beside the browser's own — and it is the one the same field would report under `"native"`.
|
|
67
|
-
*
|
|
68
|
-
* Empty on a server, where the field cannot have been revealed yet and so has nothing to say.
|
|
69
|
-
*/
|
|
70
|
-
export declare const missingValueMessage: (kind: RequiredControl) => string;
|
|
71
|
-
/** Whether a value counts as nothing. Covers every shape a field holds when it is empty. */
|
|
72
|
-
export declare const isValueMissing: (value: unknown) => boolean;
|
|
73
44
|
/** Errors a server returned, keyed by the `name` each field submits under. */
|
|
74
45
|
export type FormValidationErrors = Record<string, string | string[]>;
|
|
75
|
-
export interface FormContext {
|
|
76
|
-
/** Errors keyed by field `name`, shown until the user edits the value. */
|
|
77
|
-
validationErrors: ComputedRef<FormValidationErrors>;
|
|
78
|
-
/** Default for every field inside, unless the field names its own. */
|
|
79
|
-
validationBehavior: ComputedRef<ValidationBehavior>;
|
|
80
|
-
/**
|
|
81
|
-
* Bumped by every submit attempt.
|
|
82
|
-
*
|
|
83
|
-
* Under `"native"` a field learns of a failed submit from the browser, which fires `invalid` at
|
|
84
|
-
* it. Under `"aria"` the browser is not involved, so this is the only thing that tells a field
|
|
85
|
-
* holding an unrevealed error that it is now being asked for.
|
|
86
|
-
*/
|
|
87
|
-
submitCount?: Readonly<Ref<number>>;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* React splits this in two — `FormValidationContext` in react-stately for the errors,
|
|
91
|
-
* `FormContext` in react-aria-components for the behaviour — only because the two live in
|
|
92
|
-
* different packages. Here one provider hands out both, so a field injects once and the two
|
|
93
|
-
* halves cannot drift apart.
|
|
94
|
-
*
|
|
95
|
-
* Loose: a field outside a form is the normal case, not an error.
|
|
96
|
-
*/
|
|
97
|
-
export declare const useFormContext: () => FormContext | null, provideFormContext: (value: FormContext | null) => FormContext | null;
|
|
98
46
|
export interface UseFormValidationStateOptions<T> {
|
|
99
47
|
/** Value handed to `validate`. `null` or `undefined` skips custom validation entirely. */
|
|
100
48
|
value: MaybeRefOrGetter<T | null | undefined>;
|
|
@@ -146,13 +94,6 @@ export interface FormValidationState {
|
|
|
146
94
|
/** Reveal what validation currently says — on change, or on a failed submit. */
|
|
147
95
|
commitValidation: () => void;
|
|
148
96
|
}
|
|
149
|
-
/**
|
|
150
|
-
* Whether two results say the same thing.
|
|
151
|
-
*
|
|
152
|
-
* Not an optimisation: the results live in `shallowRef`s, and assigning an equal-but-new
|
|
153
|
-
* object still retriggers every computed reading them.
|
|
154
|
-
*/
|
|
155
|
-
export declare const isEqualValidation: (a: ValidationResult | null, b: ValidationResult | null) => boolean;
|
|
156
97
|
/**
|
|
157
98
|
* Decide what a field's validation currently says, ported from React Aria's
|
|
158
99
|
* `packages/react-stately/src/form/useFormValidationState.ts` (react-stately 3.49.0).
|
|
@@ -1,127 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useFormContext } from "./form-context.js";
|
|
2
|
+
import { CUSTOM_VALIDITY_STATE, DEFAULT_VALIDATION_RESULT, MISSING_VALIDITY_STATE, VALID_VALIDITY_STATE, isEqualValidation, isValueMissing, missingValueMessage } from "./validation-result.js";
|
|
2
3
|
import { computed, nextTick, shallowRef, toValue, watch } from "vue";
|
|
3
4
|
//#region src/composables/use-form-validation-state.ts
|
|
4
|
-
var VALID_VALIDITY_STATE = Object.freeze({
|
|
5
|
-
badInput: false,
|
|
6
|
-
customError: false,
|
|
7
|
-
patternMismatch: false,
|
|
8
|
-
rangeOverflow: false,
|
|
9
|
-
rangeUnderflow: false,
|
|
10
|
-
stepMismatch: false,
|
|
11
|
-
tooLong: false,
|
|
12
|
-
tooShort: false,
|
|
13
|
-
typeMismatch: false,
|
|
14
|
-
valid: true,
|
|
15
|
-
valueMissing: false
|
|
16
|
-
});
|
|
17
|
-
/** Failure that came from a prop, a `validate` function or the server rather than the browser. */
|
|
18
|
-
var CUSTOM_VALIDITY_STATE = Object.freeze({
|
|
19
|
-
...VALID_VALIDITY_STATE,
|
|
20
|
-
customError: true,
|
|
21
|
-
valid: false
|
|
22
|
-
});
|
|
23
|
-
/** A required field with nothing in it. What the browser reports under `"native"`. */
|
|
24
|
-
var MISSING_VALIDITY_STATE = Object.freeze({
|
|
25
|
-
...VALID_VALIDITY_STATE,
|
|
26
|
-
valid: false,
|
|
27
|
-
valueMissing: true
|
|
28
|
-
});
|
|
29
|
-
var DEFAULT_VALIDATION_RESULT = Object.freeze({
|
|
30
|
-
isInvalid: false,
|
|
31
|
-
validationDetails: VALID_VALIDITY_STATE,
|
|
32
|
-
validationErrors: []
|
|
33
|
-
});
|
|
34
|
-
/**
|
|
35
|
-
* One verdict out of several, for a control whose value has more than one part.
|
|
36
|
-
*
|
|
37
|
-
* Invalid if any part is, with the messages collected in order and deduplicated — two ends of a
|
|
38
|
-
* range that are both out of bounds say the same thing, and saying it twice is not more helpful.
|
|
39
|
-
*/
|
|
40
|
-
var mergeValidation = (...results) => {
|
|
41
|
-
const errors = /* @__PURE__ */ new Set();
|
|
42
|
-
const details = { ...VALID_VALIDITY_STATE };
|
|
43
|
-
let isInvalid = false;
|
|
44
|
-
for (const result of results) {
|
|
45
|
-
for (const error of result.validationErrors) errors.add(error);
|
|
46
|
-
isInvalid ||= result.isInvalid;
|
|
47
|
-
for (const key of Object.keys(details)) details[key] ||= result.validationDetails[key];
|
|
48
|
-
}
|
|
49
|
-
details.valid = !isInvalid;
|
|
50
|
-
return {
|
|
51
|
-
isInvalid,
|
|
52
|
-
validationDetails: details,
|
|
53
|
-
validationErrors: [...errors]
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
/** Freeze an element's live validity into a result the state layer can hold. */
|
|
57
|
-
var getNativeValidation = (element) => {
|
|
58
|
-
const validity = element.validity;
|
|
59
|
-
return {
|
|
60
|
-
isInvalid: !validity.valid,
|
|
61
|
-
validationDetails: {
|
|
62
|
-
badInput: validity.badInput,
|
|
63
|
-
customError: validity.customError,
|
|
64
|
-
patternMismatch: validity.patternMismatch,
|
|
65
|
-
rangeOverflow: validity.rangeOverflow,
|
|
66
|
-
rangeUnderflow: validity.rangeUnderflow,
|
|
67
|
-
stepMismatch: validity.stepMismatch,
|
|
68
|
-
tooLong: validity.tooLong,
|
|
69
|
-
tooShort: validity.tooShort,
|
|
70
|
-
typeMismatch: validity.typeMismatch,
|
|
71
|
-
valid: validity.valid,
|
|
72
|
-
valueMissing: validity.valueMissing
|
|
73
|
-
},
|
|
74
|
-
validationErrors: element.validationMessage ? [element.validationMessage] : []
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
var missingValueMessages = /* @__PURE__ */ new Map();
|
|
78
|
-
/**
|
|
79
|
-
* What the browser would say about an empty control of this kind.
|
|
80
|
-
*
|
|
81
|
-
* Read off a detached probe rather than translated here. The platform already holds the sentence,
|
|
82
|
-
* in the *browser's* locale — which is the locale a validation message belongs in, since it sits
|
|
83
|
-
* beside the browser's own — and it is the one the same field would report under `"native"`.
|
|
84
|
-
*
|
|
85
|
-
* Empty on a server, where the field cannot have been revealed yet and so has nothing to say.
|
|
86
|
-
*/
|
|
87
|
-
var missingValueMessage = (kind) => {
|
|
88
|
-
const cached = missingValueMessages.get(kind);
|
|
89
|
-
if (cached !== void 0) return cached;
|
|
90
|
-
if (typeof document === "undefined") return "";
|
|
91
|
-
let probe;
|
|
92
|
-
if (kind === "select") probe = document.createElement("select");
|
|
93
|
-
else {
|
|
94
|
-
const input = document.createElement("input");
|
|
95
|
-
if (kind !== "text") {
|
|
96
|
-
input.type = kind;
|
|
97
|
-
input.name = "probe";
|
|
98
|
-
}
|
|
99
|
-
probe = input;
|
|
100
|
-
}
|
|
101
|
-
probe.required = true;
|
|
102
|
-
const message = probe.validationMessage;
|
|
103
|
-
missingValueMessages.set(kind, message);
|
|
104
|
-
return message;
|
|
105
|
-
};
|
|
106
|
-
/** Whether a value counts as nothing. Covers every shape a field holds when it is empty. */
|
|
107
|
-
var isValueMissing = (value) => {
|
|
108
|
-
if (value == null || value === "" || value === false) return true;
|
|
109
|
-
if (Array.isArray(value)) return value.length === 0;
|
|
110
|
-
return typeof value === "number" && Number.isNaN(value);
|
|
111
|
-
};
|
|
112
|
-
/**
|
|
113
|
-
* React splits this in two — `FormValidationContext` in react-stately for the errors,
|
|
114
|
-
* `FormContext` in react-aria-components for the behaviour — only because the two live in
|
|
115
|
-
* different packages. Here one provider hands out both, so a field injects once and the two
|
|
116
|
-
* halves cannot drift apart.
|
|
117
|
-
*
|
|
118
|
-
* Loose: a field outside a form is the normal case, not an error.
|
|
119
|
-
*/
|
|
120
|
-
var [useFormContext, provideFormContext] = createContext({
|
|
121
|
-
defaultValue: null,
|
|
122
|
-
name: "FormContext",
|
|
123
|
-
strict: false
|
|
124
|
-
});
|
|
125
5
|
var asArray = (value) => {
|
|
126
6
|
if (!value) return [];
|
|
127
7
|
return Array.isArray(value) ? value : [value];
|
|
@@ -136,17 +16,6 @@ var toValidationResult = (errors) => errors.length > 0 ? {
|
|
|
136
16
|
validationErrors: errors
|
|
137
17
|
} : null;
|
|
138
18
|
/**
|
|
139
|
-
* Whether two results say the same thing.
|
|
140
|
-
*
|
|
141
|
-
* Not an optimisation: the results live in `shallowRef`s, and assigning an equal-but-new
|
|
142
|
-
* object still retriggers every computed reading them.
|
|
143
|
-
*/
|
|
144
|
-
var isEqualValidation = (a, b) => {
|
|
145
|
-
if (a === b) return true;
|
|
146
|
-
if (!a || !b) return false;
|
|
147
|
-
return a.isInvalid === b.isInvalid && a.validationErrors.length === b.validationErrors.length && a.validationErrors.every((error, index) => error === b.validationErrors[index]) && Object.keys(a.validationDetails).every((key) => a.validationDetails[key] === b.validationDetails[key]);
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
19
|
* Decide what a field's validation currently says, ported from React Aria's
|
|
151
20
|
* `packages/react-stately/src/form/useFormValidationState.ts` (react-stately 3.49.0).
|
|
152
21
|
*
|
|
@@ -279,4 +148,4 @@ var useFormValidationState = (options) => {
|
|
|
279
148
|
};
|
|
280
149
|
};
|
|
281
150
|
//#endregion
|
|
282
|
-
export {
|
|
151
|
+
export { useFormValidationState };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { FormValidationState
|
|
1
|
+
import type { FormValidationState } from "./use-form-validation-state.js";
|
|
2
|
+
import type { ValidatableElement } from "./validation-result.js";
|
|
2
3
|
import type { MaybeRefOrGetter, Ref } from "vue";
|
|
3
4
|
export interface UseFormValidationOptions {
|
|
4
5
|
/** Called instead of focusing the element when a failed submit lands on this field. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { setInteractionModality } from "./
|
|
2
|
-
import { getNativeValidation } from "./
|
|
1
|
+
import { setInteractionModality } from "./interaction-modality.js";
|
|
2
|
+
import { getNativeValidation } from "./validation-result.js";
|
|
3
3
|
import { onScopeDispose, toValue, watch, watchEffect } from "vue";
|
|
4
4
|
//#region src/composables/use-form-validation.ts
|
|
5
5
|
/** First control in the form the browser considers invalid, in document order. */
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
import type { ComputedRef, MaybeRefOrGetter } from "vue";
|
|
2
2
|
/** How the last interaction reached the page, which decides whether focus is visible. */
|
|
3
3
|
export type InteractionModality = "keyboard" | "pointer";
|
|
4
|
-
/**
|
|
5
|
-
* Keep the shared modality listeners attached, returning the release.
|
|
6
|
-
*
|
|
7
|
-
* For a component that has to ask how the user is driving the page without otherwise taking part
|
|
8
|
-
* in the interaction lifecycle — a tooltip trigger, which opens on hover only for a real pointer.
|
|
9
|
-
* Without this the answer would be whatever it was when the last interactive component unmounted.
|
|
10
|
-
*/
|
|
11
|
-
export declare const retainInteractionModality: () => (() => void);
|
|
12
|
-
/**
|
|
13
|
-
* How the user is driving the page right now.
|
|
14
|
-
*
|
|
15
|
-
* Ported from React Aria's `getInteractionModality`. Not reactive on purpose — read it inside an
|
|
16
|
-
* event handler, where the answer is the one that matters.
|
|
17
|
-
*/
|
|
18
|
-
export declare const getInteractionModality: () => InteractionModality;
|
|
19
4
|
/**
|
|
20
5
|
* The same answer as a reactive ref, for text that is rendered rather than read in a handler.
|
|
21
6
|
*
|
|
@@ -29,27 +14,6 @@ export declare const getInteractionModality: () => InteractionModality;
|
|
|
29
14
|
* interaction lifecycle.
|
|
30
15
|
*/
|
|
31
16
|
export declare const useInteractionModality: () => ComputedRef<InteractionModality>;
|
|
32
|
-
/**
|
|
33
|
-
* Whether focus arriving right now is the kind that came from a keyboard.
|
|
34
|
-
*
|
|
35
|
-
* Ported from React Aria's `isFocusVisible`, and reads the same answer React Aria reads — the one
|
|
36
|
-
* that follows the pointer as it moves. Read it inside a handler: a tooltip asks it on focus to
|
|
37
|
-
* tell tabbing to a button apart from clicking it, and only the pointer-following answer knows the
|
|
38
|
-
* user had already reached for the mouse.
|
|
39
|
-
*
|
|
40
|
-
* Not the answer that decides whether a ring is painted. That one lives on `useInteractionStates`
|
|
41
|
-
* and deliberately ignores a bare mouse move, so moving the pointer cannot erase a ring that is
|
|
42
|
-
* already there. The two can disagree, and that is the point.
|
|
43
|
-
*/
|
|
44
|
-
export declare const isFocusVisible: () => boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Declare how the last interaction reached the page.
|
|
47
|
-
*
|
|
48
|
-
* Ported from React Aria's `setInteractionModality`. A component that moves focus itself —
|
|
49
|
-
* a slider label handing focus to its first thumb — has to say that the move came from the
|
|
50
|
-
* keyboard, or the ring it just earned would not be painted.
|
|
51
|
-
*/
|
|
52
|
-
export declare const setInteractionModality: (next: InteractionModality) => void;
|
|
53
17
|
export interface UseInteractionStatesOptions {
|
|
54
18
|
/** Suppresses every state and keeps the element out of the interaction lifecycle. */
|
|
55
19
|
isDisabled?: MaybeRefOrGetter<boolean | undefined>;
|
|
@@ -1,65 +1,6 @@
|
|
|
1
|
+
import { getFocusRingModality, retainInteractionModality } from "./interaction-modality.js";
|
|
1
2
|
import { computed, onScopeDispose, shallowRef, toValue } from "vue";
|
|
2
3
|
//#region src/composables/use-interaction-states.ts
|
|
3
|
-
var modality = shallowRef("keyboard");
|
|
4
|
-
/**
|
|
5
|
-
* The same answer, kept out of the reactive graph.
|
|
6
|
-
*
|
|
7
|
-
* These are two different questions and they need two different answers. "Should a focus ring be
|
|
8
|
-
* painted" may only change when something is pressed or a key is struck — a bare mouse move must
|
|
9
|
-
* not erase a ring that is already there. "How is the user driving the page right now" has to
|
|
10
|
-
* follow the pointer as it moves, because a tooltip decides whether to open on hover by asking it.
|
|
11
|
-
* Answering the second reactively would make every mouse move re-render every focusable thing on
|
|
12
|
-
* the page and drop the ring while doing it, which is why React Aria keeps the same split.
|
|
13
|
-
*/
|
|
14
|
-
var latestModality = "keyboard";
|
|
15
|
-
/** Number of live consumers, so the document listeners are attached exactly once. */
|
|
16
|
-
var consumerCount = 0;
|
|
17
|
-
var onGlobalKeydown = (event) => {
|
|
18
|
-
if (event.metaKey || event.altKey || event.ctrlKey) return;
|
|
19
|
-
latestModality = "keyboard";
|
|
20
|
-
modality.value = "keyboard";
|
|
21
|
-
};
|
|
22
|
-
var onGlobalPointerdown = () => {
|
|
23
|
-
latestModality = "pointer";
|
|
24
|
-
modality.value = "pointer";
|
|
25
|
-
};
|
|
26
|
-
/** Tracked without touching the reactive ref, for the reason above. */
|
|
27
|
-
var onGlobalPointerMoved = () => {
|
|
28
|
-
latestModality = "pointer";
|
|
29
|
-
};
|
|
30
|
-
/** Attach the shared modality listeners, returning the release for this consumer. */
|
|
31
|
-
var retainModalityListeners = () => {
|
|
32
|
-
if (typeof document === "undefined") return () => {};
|
|
33
|
-
if (++consumerCount === 1) {
|
|
34
|
-
document.addEventListener("keydown", onGlobalKeydown, true);
|
|
35
|
-
document.addEventListener("pointerdown", onGlobalPointerdown, true);
|
|
36
|
-
document.addEventListener("pointermove", onGlobalPointerMoved, true);
|
|
37
|
-
document.addEventListener("pointerup", onGlobalPointerMoved, true);
|
|
38
|
-
}
|
|
39
|
-
return () => {
|
|
40
|
-
if (--consumerCount === 0) {
|
|
41
|
-
document.removeEventListener("keydown", onGlobalKeydown, true);
|
|
42
|
-
document.removeEventListener("pointerdown", onGlobalPointerdown, true);
|
|
43
|
-
document.removeEventListener("pointermove", onGlobalPointerMoved, true);
|
|
44
|
-
document.removeEventListener("pointerup", onGlobalPointerMoved, true);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Keep the shared modality listeners attached, returning the release.
|
|
50
|
-
*
|
|
51
|
-
* For a component that has to ask how the user is driving the page without otherwise taking part
|
|
52
|
-
* in the interaction lifecycle — a tooltip trigger, which opens on hover only for a real pointer.
|
|
53
|
-
* Without this the answer would be whatever it was when the last interactive component unmounted.
|
|
54
|
-
*/
|
|
55
|
-
var retainInteractionModality = () => retainModalityListeners();
|
|
56
|
-
/**
|
|
57
|
-
* How the user is driving the page right now.
|
|
58
|
-
*
|
|
59
|
-
* Ported from React Aria's `getInteractionModality`. Not reactive on purpose — read it inside an
|
|
60
|
-
* event handler, where the answer is the one that matters.
|
|
61
|
-
*/
|
|
62
|
-
var getInteractionModality = () => latestModality;
|
|
63
4
|
/**
|
|
64
5
|
* The same answer as a reactive ref, for text that is rendered rather than read in a handler.
|
|
65
6
|
*
|
|
@@ -73,33 +14,9 @@ var getInteractionModality = () => latestModality;
|
|
|
73
14
|
* interaction lifecycle.
|
|
74
15
|
*/
|
|
75
16
|
var useInteractionModality = () => {
|
|
76
|
-
const release =
|
|
17
|
+
const release = retainInteractionModality();
|
|
77
18
|
onScopeDispose(release);
|
|
78
|
-
return computed(() =>
|
|
79
|
-
};
|
|
80
|
-
/**
|
|
81
|
-
* Whether focus arriving right now is the kind that came from a keyboard.
|
|
82
|
-
*
|
|
83
|
-
* Ported from React Aria's `isFocusVisible`, and reads the same answer React Aria reads — the one
|
|
84
|
-
* that follows the pointer as it moves. Read it inside a handler: a tooltip asks it on focus to
|
|
85
|
-
* tell tabbing to a button apart from clicking it, and only the pointer-following answer knows the
|
|
86
|
-
* user had already reached for the mouse.
|
|
87
|
-
*
|
|
88
|
-
* Not the answer that decides whether a ring is painted. That one lives on `useInteractionStates`
|
|
89
|
-
* and deliberately ignores a bare mouse move, so moving the pointer cannot erase a ring that is
|
|
90
|
-
* already there. The two can disagree, and that is the point.
|
|
91
|
-
*/
|
|
92
|
-
var isFocusVisible = () => latestModality === "keyboard";
|
|
93
|
-
/**
|
|
94
|
-
* Declare how the last interaction reached the page.
|
|
95
|
-
*
|
|
96
|
-
* Ported from React Aria's `setInteractionModality`. A component that moves focus itself —
|
|
97
|
-
* a slider label handing focus to its first thumb — has to say that the move came from the
|
|
98
|
-
* keyboard, or the ring it just earned would not be painted.
|
|
99
|
-
*/
|
|
100
|
-
var setInteractionModality = (next) => {
|
|
101
|
-
latestModality = next;
|
|
102
|
-
modality.value = next;
|
|
19
|
+
return computed(() => getFocusRingModality());
|
|
103
20
|
};
|
|
104
21
|
/**
|
|
105
22
|
* Track hover, press and focus so a component can publish them as `data-*`
|
|
@@ -161,13 +78,13 @@ var useInteractionStates = (options = {}) => {
|
|
|
161
78
|
focused.value = false;
|
|
162
79
|
endPress();
|
|
163
80
|
};
|
|
164
|
-
const releaseModalityListeners =
|
|
81
|
+
const releaseModalityListeners = retainInteractionModality();
|
|
165
82
|
onScopeDispose(() => {
|
|
166
83
|
releaseModalityListeners();
|
|
167
84
|
releasePress?.();
|
|
168
85
|
}, true);
|
|
169
86
|
return {
|
|
170
|
-
isFocusVisible: computed(() => focused.value && !isDisabled.value &&
|
|
87
|
+
isFocusVisible: computed(() => focused.value && !isDisabled.value && getFocusRingModality() === "keyboard"),
|
|
171
88
|
isFocused: computed(() => focused.value && !isDisabled.value),
|
|
172
89
|
isHovered: computed(() => hovered.value && !isInert.value),
|
|
173
90
|
isPressed: computed(() => pressed.value && !isInert.value),
|
|
@@ -209,16 +126,16 @@ var useFocusWithin = (options = {}) => {
|
|
|
209
126
|
if (currentTarget instanceof Node && relatedTarget instanceof Node && currentTarget.contains(relatedTarget)) return;
|
|
210
127
|
focusWithin.value = false;
|
|
211
128
|
};
|
|
212
|
-
const releaseModalityListeners =
|
|
129
|
+
const releaseModalityListeners = retainInteractionModality();
|
|
213
130
|
onScopeDispose(() => {
|
|
214
131
|
releaseModalityListeners();
|
|
215
132
|
}, true);
|
|
216
133
|
return {
|
|
217
|
-
isFocusVisible: computed(() => focusWithin.value && !isDisabled.value &&
|
|
134
|
+
isFocusVisible: computed(() => focusWithin.value && !isDisabled.value && getFocusRingModality() === "keyboard"),
|
|
218
135
|
isFocusWithin: computed(() => focusWithin.value && !isDisabled.value),
|
|
219
136
|
onFocusin,
|
|
220
137
|
onFocusout
|
|
221
138
|
};
|
|
222
139
|
};
|
|
223
140
|
//#endregion
|
|
224
|
-
export {
|
|
141
|
+
export { useFocusWithin, useInteractionModality, useInteractionStates };
|
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
import type { Locale } from "../utils/locale.js";
|
|
2
2
|
import type { ComputedRef, MaybeRefOrGetter } from "vue";
|
|
3
|
-
/**
|
|
4
|
-
* The locale an ancestor has chosen, or `null` when nobody has and the browser's own should win.
|
|
5
|
-
*
|
|
6
|
-
* Loose, because most of the tree runs without a provider and reading the browser setting is the
|
|
7
|
-
* right answer there — not an error.
|
|
8
|
-
*/
|
|
9
|
-
export declare const useLocaleContext: () => ComputedRef<Locale> | null, provideLocaleContext: (value: ComputedRef<Locale> | null) => ComputedRef<Locale> | null;
|
|
10
|
-
/**
|
|
11
|
-
* The locale the browser is set to, following the user changing it.
|
|
12
|
-
*
|
|
13
|
-
* Ported from React Aria's `packages/react-aria/src/i18n/useDefaultLocale.ts` (react-aria 3.51.0),
|
|
14
|
-
* minus its server branch — this package does not render on the server yet.
|
|
15
|
-
*/
|
|
16
|
-
export declare const useDefaultLocale: () => ComputedRef<Locale>;
|
|
17
3
|
/**
|
|
18
4
|
* The locale that applies here: the nearest ancestor's choice, or the browser's when there is none.
|
|
19
5
|
*
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createContext } from "../utils/create-context.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { isRTL } from "../utils/locale.js";
|
|
3
|
+
import { useDefaultLocale } from "./use-default-locale.js";
|
|
4
|
+
import { computed, toValue } from "vue";
|
|
4
5
|
//#region src/composables/use-locale.ts
|
|
5
6
|
/**
|
|
6
7
|
* The locale an ancestor has chosen, or `null` when nobody has and the browser's own should win.
|
|
@@ -14,40 +15,6 @@ var [useLocaleContext, provideLocaleContext] = createContext({
|
|
|
14
15
|
strict: false
|
|
15
16
|
});
|
|
16
17
|
/**
|
|
17
|
-
* The browser's locale, shared by every consumer and updated when the user changes it.
|
|
18
|
-
*
|
|
19
|
-
* Module-level rather than per-component: `languagechange` is a window event and the answer is the
|
|
20
|
-
* same for the whole page, so one listener serves all of them. Held behind a reference count so a
|
|
21
|
-
* page with no locale-aware component on it carries no listener.
|
|
22
|
-
*/
|
|
23
|
-
var browserLocale = shallowRef(getDefaultLocale());
|
|
24
|
-
var consumerCount = 0;
|
|
25
|
-
var onLanguageChange = () => {
|
|
26
|
-
browserLocale.value = getDefaultLocale();
|
|
27
|
-
};
|
|
28
|
-
/** Attach the shared `languagechange` listener, returning the release for this consumer. */
|
|
29
|
-
var retainBrowserLocale = () => {
|
|
30
|
-
/* c8 ignore next */
|
|
31
|
-
if (typeof window === "undefined") return () => {};
|
|
32
|
-
if (++consumerCount === 1) {
|
|
33
|
-
onLanguageChange();
|
|
34
|
-
window.addEventListener("languagechange", onLanguageChange);
|
|
35
|
-
}
|
|
36
|
-
return () => {
|
|
37
|
-
if (--consumerCount === 0) window.removeEventListener("languagechange", onLanguageChange);
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* The locale the browser is set to, following the user changing it.
|
|
42
|
-
*
|
|
43
|
-
* Ported from React Aria's `packages/react-aria/src/i18n/useDefaultLocale.ts` (react-aria 3.51.0),
|
|
44
|
-
* minus its server branch — this package does not render on the server yet.
|
|
45
|
-
*/
|
|
46
|
-
var useDefaultLocale = () => {
|
|
47
|
-
onScopeDispose(retainBrowserLocale());
|
|
48
|
-
return computed(() => browserLocale.value);
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
18
|
* The locale that applies here: the nearest ancestor's choice, or the browser's when there is none.
|
|
52
19
|
*
|
|
53
20
|
* Ported from React Aria's `packages/react-aria/src/i18n/I18nProvider.tsx` (react-aria 3.51.0).
|
|
@@ -77,4 +44,4 @@ var provideLocale = (locale) => {
|
|
|
77
44
|
return resolved;
|
|
78
45
|
};
|
|
79
46
|
//#endregion
|
|
80
|
-
export { provideLocale,
|
|
47
|
+
export { provideLocale, useLocale };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LocalizedString, LocalizedStrings } from "@internationalized/string";
|
|
2
|
+
import { LocalizedStringDictionary } from "@internationalized/string";
|
|
3
|
+
/**
|
|
4
|
+
* The dictionary for a table of localized strings.
|
|
5
|
+
*
|
|
6
|
+
* Ported from React Aria's `packages/react-aria/src/i18n/useLocalizedStringFormatter.ts`
|
|
7
|
+
* (react-aria 3.51.0), without its global-dictionary lookup: that exists so a server can hand
|
|
8
|
+
* pre-loaded strings to the client, which this package does not do yet.
|
|
9
|
+
*/
|
|
10
|
+
export declare const useLocalizedStringDictionary: <K extends string = string, T extends LocalizedString = string>(strings: LocalizedStrings<K, T>) => LocalizedStringDictionary<K, T>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { LocalizedStringDictionary } from "@internationalized/string";
|
|
2
|
+
//#region src/composables/use-localized-string-dictionary.ts
|
|
3
|
+
/**
|
|
4
|
+
* Dictionaries built so far, keyed by the table each was built from.
|
|
5
|
+
*
|
|
6
|
+
* A dictionary is derived entirely from its strings and is read-only afterwards, so every consumer
|
|
7
|
+
* of the same table can share one. Weak, so a table that goes out of scope takes its dictionary
|
|
8
|
+
* with it.
|
|
9
|
+
*/
|
|
10
|
+
var dictionaries = /* @__PURE__ */ new WeakMap();
|
|
11
|
+
/**
|
|
12
|
+
* The dictionary for a table of localized strings.
|
|
13
|
+
*
|
|
14
|
+
* Ported from React Aria's `packages/react-aria/src/i18n/useLocalizedStringFormatter.ts`
|
|
15
|
+
* (react-aria 3.51.0), without its global-dictionary lookup: that exists so a server can hand
|
|
16
|
+
* pre-loaded strings to the client, which this package does not do yet.
|
|
17
|
+
*/
|
|
18
|
+
var useLocalizedStringDictionary = (strings) => {
|
|
19
|
+
const cached = dictionaries.get(strings);
|
|
20
|
+
if (cached) return cached;
|
|
21
|
+
const dictionary = new LocalizedStringDictionary(strings);
|
|
22
|
+
dictionaries.set(strings, dictionary);
|
|
23
|
+
return dictionary;
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { useLocalizedStringDictionary };
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import type { LocalizedStringFormatter as Formatter, LocalizedString, LocalizedStrings } from "@internationalized/string";
|
|
2
2
|
import type { ComputedRef } from "vue";
|
|
3
|
-
import { LocalizedStringDictionary } from "@internationalized/string";
|
|
4
|
-
/**
|
|
5
|
-
* The dictionary for a table of localized strings.
|
|
6
|
-
*
|
|
7
|
-
* Ported from React Aria's `packages/react-aria/src/i18n/useLocalizedStringFormatter.ts`
|
|
8
|
-
* (react-aria 3.51.0), without its global-dictionary lookup: that exists so a server can hand
|
|
9
|
-
* pre-loaded strings to the client, which this package does not do yet.
|
|
10
|
-
*/
|
|
11
|
-
export declare const useLocalizedStringDictionary: <K extends string = string, T extends LocalizedString = string>(strings: LocalizedStrings<K, T>) => LocalizedStringDictionary<K, T>;
|
|
12
3
|
/**
|
|
13
4
|
* A formatter reading a table of localized strings in the locale that applies here.
|
|
14
5
|
*
|