@manyducks.co/dolla 2.0.0-alpha.10 → 2.0.0-alpha.12
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/index.d.ts +1 -1
- package/dist/index.js +842 -731
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.js +2 -2
- package/dist/jsx-runtime.js +2 -2
- package/dist/modules/i18n.d.ts +34 -8
- package/dist/{passthrough-9kwwjgWk.js → passthrough-Bz5ZF4jn.js} +5 -5
- package/dist/{passthrough-9kwwjgWk.js.map → passthrough-Bz5ZF4jn.js.map} +1 -1
- package/package.json +1 -1
package/dist/jsx-dev-runtime.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as s } from "./passthrough-
|
|
2
|
-
import { P as m } from "./passthrough-
|
|
1
|
+
import { r as s } from "./passthrough-Bz5ZF4jn.js";
|
|
2
|
+
import { P as m } from "./passthrough-Bz5ZF4jn.js";
|
|
3
3
|
function d(n, r, t, e, a, l) {
|
|
4
4
|
const i = { ...o(["children", "key"], r) }, c = Array.isArray(r.children) ? r.children : [r.children];
|
|
5
5
|
return s(n, i, ...c);
|
package/dist/jsx-runtime.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as t } from "./passthrough-
|
|
2
|
-
import { P as l } from "./passthrough-
|
|
1
|
+
import { r as t } from "./passthrough-Bz5ZF4jn.js";
|
|
2
|
+
import { P as l } from "./passthrough-Bz5ZF4jn.js";
|
|
3
3
|
function d(n, e, r) {
|
|
4
4
|
return t(n, e ? { ...u(["children", "key"], e) } : void 0, e.children);
|
|
5
5
|
}
|
package/dist/modules/i18n.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { MaybeState, type State } from "../state.js";
|
|
2
|
-
import type { Stringable } from "../types.js";
|
|
1
|
+
import { type MaybeState, type State } from "../state.js";
|
|
3
2
|
import type { Dolla } from "./dolla.js";
|
|
4
3
|
/**
|
|
5
4
|
* An object where values are either a translated string or another nested Translation object.
|
|
@@ -26,6 +25,18 @@ export type I18nSetupOptions = {
|
|
|
26
25
|
locale?: string | null;
|
|
27
26
|
translations: TranslationConfig[];
|
|
28
27
|
};
|
|
28
|
+
export type TOptions = {
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
count?: MaybeState<number>;
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
context?: MaybeState<string>;
|
|
37
|
+
[value: string]: MaybeState<any>;
|
|
38
|
+
};
|
|
39
|
+
export type Formatter = (locale: string, value: unknown, options: Record<string, any>) => string;
|
|
29
40
|
/**
|
|
30
41
|
* Dolla's I(nternationalizatio)n module. Manages language translations and locale-based formatting.
|
|
31
42
|
*/
|
|
@@ -39,16 +50,31 @@ export declare class I18n {
|
|
|
39
50
|
/**
|
|
40
51
|
* Returns a State containing the value at `key`.
|
|
41
52
|
|
|
42
|
-
* @param
|
|
43
|
-
* @param
|
|
53
|
+
* @param selector - Key to the translated value.
|
|
54
|
+
* @param options - A map of `{{placeholder}}` names and the values to replace them with.
|
|
44
55
|
*
|
|
45
56
|
* @example
|
|
46
|
-
* const $value = t("your.key.here");
|
|
57
|
+
* const $value = t("your.key.here", { count: 5 });
|
|
58
|
+
*/
|
|
59
|
+
t(selector: string, options?: TOptions): State<string>;
|
|
60
|
+
/**
|
|
61
|
+
* Add a custom format callback.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* Dolla.i18n.addFormat("myCurrency", (locale, value, options) => {
|
|
65
|
+
* // ...
|
|
66
|
+
* });
|
|
67
|
+
*
|
|
68
|
+
* {
|
|
69
|
+
* "exampleKey": "{{count | myCurrency}} dollars"
|
|
70
|
+
* }
|
|
71
|
+
*
|
|
72
|
+
* t("exampleKey", {count: 5}); // State<"&5 dollars">
|
|
47
73
|
*/
|
|
48
|
-
|
|
74
|
+
addFormat(name: string, callback: (locale: string, value: unknown, options: Record<string, any>) => string): void;
|
|
49
75
|
/**
|
|
50
|
-
* Creates
|
|
51
|
-
* NOTE: The Collator remains bound to the locale it was created with.
|
|
76
|
+
* Creates an `Intl.Collator` configured for the current locale.
|
|
77
|
+
* NOTE: The Collator remains bound to the locale it was created with, even when the app's locale changes.
|
|
52
78
|
*
|
|
53
79
|
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator/Collator#options
|
|
54
80
|
*/
|
|
@@ -1249,12 +1249,12 @@ export {
|
|
|
1249
1249
|
We as C,
|
|
1250
1250
|
Ke as D,
|
|
1251
1251
|
ze as P,
|
|
1252
|
-
|
|
1253
|
-
|
|
1252
|
+
I as a,
|
|
1253
|
+
A as b,
|
|
1254
1254
|
Re as c,
|
|
1255
1255
|
ge as d,
|
|
1256
|
-
|
|
1257
|
-
|
|
1256
|
+
O as e,
|
|
1257
|
+
_ as f,
|
|
1258
1258
|
V as g,
|
|
1259
1259
|
Be as h,
|
|
1260
1260
|
L as i,
|
|
@@ -1276,4 +1276,4 @@ export {
|
|
|
1276
1276
|
K as y,
|
|
1277
1277
|
M as z
|
|
1278
1278
|
};
|
|
1279
|
-
//# sourceMappingURL=passthrough-
|
|
1279
|
+
//# sourceMappingURL=passthrough-Bz5ZF4jn.js.map
|