@warp-ds/elements 2.1.0 → 2.1.1-next.2
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.js +572 -156
- package/dist/index.js.map +4 -4
- package/dist/packages/affix/index.js +416 -45
- package/dist/packages/affix/index.js.map +4 -4
- package/dist/packages/alert/index.js +428 -57
- package/dist/packages/alert/index.js.map +4 -4
- package/dist/packages/attention/index.js +487 -71
- package/dist/packages/attention/index.js.map +4 -4
- package/dist/packages/badge/index.js +1 -1
- package/dist/packages/badge/index.js.map +2 -2
- package/dist/packages/box/index.js +1 -1
- package/dist/packages/box/index.js.map +2 -2
- package/dist/packages/breadcrumbs/index.js +409 -38
- package/dist/packages/breadcrumbs/index.js.map +4 -4
- package/dist/packages/button/index.js +408 -37
- package/dist/packages/button/index.js.map +4 -4
- package/dist/packages/card/index.js +408 -37
- package/dist/packages/card/index.js.map +4 -4
- package/dist/packages/expandable/index.js +416 -45
- package/dist/packages/expandable/index.js.map +4 -4
- package/dist/packages/modal/index.js +420 -49
- package/dist/packages/modal/index.js.map +4 -4
- package/dist/packages/pill/index.js +415 -44
- package/dist/packages/pill/index.js.map +4 -4
- package/dist/packages/select/index.js +414 -43
- package/dist/packages/select/index.js.map +4 -4
- package/dist/packages/textfield/index.js +1 -1
- package/dist/packages/textfield/index.js.map +2 -2
- package/dist/packages/toast/index.js +432 -61
- package/dist/packages/toast/index.js.map +4 -4
- package/package.json +13 -12
|
@@ -723,9 +723,9 @@ var require_moo = __commonJS({
|
|
|
723
723
|
}
|
|
724
724
|
});
|
|
725
725
|
|
|
726
|
-
// node_modules/.pnpm/@messageformat+parser@5.1.
|
|
726
|
+
// node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/lexer.js
|
|
727
727
|
var require_lexer = __commonJS({
|
|
728
|
-
"node_modules/.pnpm/@messageformat+parser@5.1.
|
|
728
|
+
"node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/lexer.js"(exports) {
|
|
729
729
|
"use strict";
|
|
730
730
|
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
731
731
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
@@ -738,7 +738,7 @@ var require_lexer = __commonJS({
|
|
|
738
738
|
doubleapos: { match: "''", value: () => "'" },
|
|
739
739
|
quoted: {
|
|
740
740
|
lineBreaks: true,
|
|
741
|
-
match: /'[{}#](?:[^]
|
|
741
|
+
match: /'[{}#](?:[^']|'')*'(?!')/u,
|
|
742
742
|
value: (src) => src.slice(1, -1).replace(/''/g, "'")
|
|
743
743
|
},
|
|
744
744
|
argument: {
|
|
@@ -790,12 +790,13 @@ var require_lexer = __commonJS({
|
|
|
790
790
|
}
|
|
791
791
|
});
|
|
792
792
|
|
|
793
|
-
// node_modules/.pnpm/@messageformat+parser@5.1.
|
|
793
|
+
// node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/parser.js
|
|
794
794
|
var require_parser = __commonJS({
|
|
795
|
-
"node_modules/.pnpm/@messageformat+parser@5.1.
|
|
795
|
+
"node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/parser.js"(exports) {
|
|
796
796
|
"use strict";
|
|
797
797
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
798
|
-
exports.
|
|
798
|
+
exports.ParseError = void 0;
|
|
799
|
+
exports.parse = parse2;
|
|
799
800
|
var lexer_js_1 = require_lexer();
|
|
800
801
|
var getContext = (lt) => ({
|
|
801
802
|
offset: lt.offset,
|
|
@@ -861,8 +862,9 @@ var require_parser = __commonJS({
|
|
|
861
862
|
}
|
|
862
863
|
checkSelectKey(lt, type, key) {
|
|
863
864
|
if (key[0] === "=") {
|
|
864
|
-
if (type === "select")
|
|
865
|
+
if (type === "select") {
|
|
865
866
|
throw new ParseError(lt, `The case ${key} is not valid with select`);
|
|
867
|
+
}
|
|
866
868
|
} else if (type !== "select") {
|
|
867
869
|
const keys2 = type === "plural" ? this.cardinalKeys : this.ordinalKeys;
|
|
868
870
|
if (this.strictPluralKeys && keys2.length > 0 && !keys2.includes(key)) {
|
|
@@ -880,10 +882,12 @@ var require_parser = __commonJS({
|
|
|
880
882
|
for (const lt of this.lexer) {
|
|
881
883
|
switch (lt.type) {
|
|
882
884
|
case "offset":
|
|
883
|
-
if (type === "select")
|
|
885
|
+
if (type === "select") {
|
|
884
886
|
throw new ParseError(lt, "Unexpected plural offset for select");
|
|
885
|
-
|
|
887
|
+
}
|
|
888
|
+
if (sel.cases.length > 0) {
|
|
886
889
|
throw new ParseError(lt, "Plural offset must be set before cases");
|
|
890
|
+
}
|
|
887
891
|
sel.pluralOffset = Number(lt.value);
|
|
888
892
|
ctx.text += lt.text;
|
|
889
893
|
ctx.lineBreaks += lt.lineBreaks;
|
|
@@ -923,11 +927,13 @@ var require_parser = __commonJS({
|
|
|
923
927
|
const end = this.lexer.next();
|
|
924
928
|
if (!end)
|
|
925
929
|
throw new ParseError(null, "Unexpected message end");
|
|
926
|
-
if (end.type !== "end")
|
|
930
|
+
if (end.type !== "end") {
|
|
927
931
|
throw new ParseError(end, `Unexpected lexer token: ${end.type}`);
|
|
932
|
+
}
|
|
928
933
|
ctx.text += end.text;
|
|
929
|
-
if (isSelectType(argType.value.toLowerCase()))
|
|
934
|
+
if (isSelectType(argType.value.toLowerCase())) {
|
|
930
935
|
throw new ParseError(argType, `Invalid type identifier: ${argType.value}`);
|
|
936
|
+
}
|
|
931
937
|
return {
|
|
932
938
|
type: "function",
|
|
933
939
|
arg: lt.value,
|
|
@@ -941,8 +947,9 @@ var require_parser = __commonJS({
|
|
|
941
947
|
throw new ParseError(argType, msg);
|
|
942
948
|
}
|
|
943
949
|
let param = this.parseBody(this.strict ? false : inPlural);
|
|
944
|
-
if (this.strict && param.length > 0)
|
|
950
|
+
if (this.strict && param.length > 0) {
|
|
945
951
|
param = strictArgStyleParam(lt, param);
|
|
952
|
+
}
|
|
946
953
|
return {
|
|
947
954
|
type: "function",
|
|
948
955
|
arg: lt.value,
|
|
@@ -952,10 +959,11 @@ var require_parser = __commonJS({
|
|
|
952
959
|
};
|
|
953
960
|
}
|
|
954
961
|
case "select":
|
|
955
|
-
if (isSelectType(argType.value))
|
|
962
|
+
if (isSelectType(argType.value)) {
|
|
956
963
|
return this.parseSelect(lt, inPlural, ctx, argType.value);
|
|
957
|
-
else
|
|
964
|
+
} else {
|
|
958
965
|
throw new ParseError(argType, `Unexpected select type ${argType.value}`);
|
|
966
|
+
}
|
|
959
967
|
default:
|
|
960
968
|
throw new ParseError(argType, `Unexpected lexer token: ${argType.type}`);
|
|
961
969
|
}
|
|
@@ -1002,7 +1010,6 @@ var require_parser = __commonJS({
|
|
|
1002
1010
|
const parser = new Parser(src, options);
|
|
1003
1011
|
return parser.parse();
|
|
1004
1012
|
}
|
|
1005
|
-
exports.parse = parse2;
|
|
1006
1013
|
}
|
|
1007
1014
|
});
|
|
1008
1015
|
|
|
@@ -1019,14 +1026,272 @@ var r = function() {
|
|
|
1019
1026
|
}, []).join(" ");
|
|
1020
1027
|
};
|
|
1021
1028
|
|
|
1022
|
-
// node_modules/.pnpm/@lingui+core@
|
|
1029
|
+
// node_modules/.pnpm/@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-macros@3.1.0_typescri_qfhfd5z2jpd4amxt2golzdalsi/node_modules/@lingui/core/dist/index.mjs
|
|
1023
1030
|
var import_unraw = __toESM(require_dist(), 1);
|
|
1024
1031
|
|
|
1025
|
-
// node_modules/.pnpm/@lingui+message-utils@
|
|
1032
|
+
// node_modules/.pnpm/@lingui+message-utils@5.2.0/node_modules/@lingui/message-utils/dist/compileMessage.mjs
|
|
1026
1033
|
var import_parser = __toESM(require_parser(), 1);
|
|
1034
|
+
var DateFormatError = class extends Error {
|
|
1035
|
+
/** @internal */
|
|
1036
|
+
constructor(msg, token, type) {
|
|
1037
|
+
super(msg);
|
|
1038
|
+
this.token = token;
|
|
1039
|
+
this.type = type || "error";
|
|
1040
|
+
}
|
|
1041
|
+
};
|
|
1042
|
+
var alpha = (width) => width < 4 ? "short" : width === 4 ? "long" : "narrow";
|
|
1043
|
+
var numeric = (width) => width % 2 === 0 ? "2-digit" : "numeric";
|
|
1044
|
+
function yearOptions(token, onError) {
|
|
1045
|
+
switch (token.char) {
|
|
1046
|
+
case "y":
|
|
1047
|
+
return { year: numeric(token.width) };
|
|
1048
|
+
case "r":
|
|
1049
|
+
return { calendar: "gregory", year: "numeric" };
|
|
1050
|
+
case "u":
|
|
1051
|
+
case "U":
|
|
1052
|
+
case "Y":
|
|
1053
|
+
default:
|
|
1054
|
+
onError(`${token.desc} is not supported; falling back to year:numeric`, DateFormatError.WARNING);
|
|
1055
|
+
return { year: "numeric" };
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
function monthStyle(token, onError) {
|
|
1059
|
+
switch (token.width) {
|
|
1060
|
+
case 1:
|
|
1061
|
+
return "numeric";
|
|
1062
|
+
case 2:
|
|
1063
|
+
return "2-digit";
|
|
1064
|
+
case 3:
|
|
1065
|
+
return "short";
|
|
1066
|
+
case 4:
|
|
1067
|
+
return "long";
|
|
1068
|
+
case 5:
|
|
1069
|
+
return "narrow";
|
|
1070
|
+
default:
|
|
1071
|
+
onError(`${token.desc} is not supported with width ${token.width}`);
|
|
1072
|
+
return void 0;
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
function dayStyle(token, onError) {
|
|
1076
|
+
const { char, desc, width } = token;
|
|
1077
|
+
if (char === "d") {
|
|
1078
|
+
return numeric(width);
|
|
1079
|
+
} else {
|
|
1080
|
+
onError(`${desc} is not supported`);
|
|
1081
|
+
return void 0;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
function weekdayStyle(token, onError) {
|
|
1085
|
+
const { char, desc, width } = token;
|
|
1086
|
+
if ((char === "c" || char === "e") && width < 3) {
|
|
1087
|
+
const msg = `Numeric value is not supported for ${desc}; falling back to weekday:short`;
|
|
1088
|
+
onError(msg, DateFormatError.WARNING);
|
|
1089
|
+
}
|
|
1090
|
+
return alpha(width);
|
|
1091
|
+
}
|
|
1092
|
+
function hourOptions(token) {
|
|
1093
|
+
const hour = numeric(token.width);
|
|
1094
|
+
let hourCycle;
|
|
1095
|
+
switch (token.char) {
|
|
1096
|
+
case "h":
|
|
1097
|
+
hourCycle = "h12";
|
|
1098
|
+
break;
|
|
1099
|
+
case "H":
|
|
1100
|
+
hourCycle = "h23";
|
|
1101
|
+
break;
|
|
1102
|
+
case "k":
|
|
1103
|
+
hourCycle = "h24";
|
|
1104
|
+
break;
|
|
1105
|
+
case "K":
|
|
1106
|
+
hourCycle = "h11";
|
|
1107
|
+
break;
|
|
1108
|
+
}
|
|
1109
|
+
return hourCycle ? { hour, hourCycle } : { hour };
|
|
1110
|
+
}
|
|
1111
|
+
function timeZoneNameStyle(token, onError) {
|
|
1112
|
+
const { char, desc, width } = token;
|
|
1113
|
+
switch (char) {
|
|
1114
|
+
case "v":
|
|
1115
|
+
case "z":
|
|
1116
|
+
return width === 4 ? "long" : "short";
|
|
1117
|
+
case "V":
|
|
1118
|
+
if (width === 4)
|
|
1119
|
+
return "long";
|
|
1120
|
+
onError(`${desc} is not supported with width ${width}`);
|
|
1121
|
+
return void 0;
|
|
1122
|
+
case "X":
|
|
1123
|
+
onError(`${desc} is not supported`);
|
|
1124
|
+
return void 0;
|
|
1125
|
+
}
|
|
1126
|
+
return "short";
|
|
1127
|
+
}
|
|
1128
|
+
function compileOptions(token, onError) {
|
|
1129
|
+
switch (token.field) {
|
|
1130
|
+
case "era":
|
|
1131
|
+
return { era: alpha(token.width) };
|
|
1132
|
+
case "year":
|
|
1133
|
+
return yearOptions(token, onError);
|
|
1134
|
+
case "month":
|
|
1135
|
+
return { month: monthStyle(token, onError) };
|
|
1136
|
+
case "day":
|
|
1137
|
+
return { day: dayStyle(token, onError) };
|
|
1138
|
+
case "weekday":
|
|
1139
|
+
return { weekday: weekdayStyle(token, onError) };
|
|
1140
|
+
case "period":
|
|
1141
|
+
return void 0;
|
|
1142
|
+
case "hour":
|
|
1143
|
+
return hourOptions(token);
|
|
1144
|
+
case "min":
|
|
1145
|
+
return { minute: numeric(token.width) };
|
|
1146
|
+
case "sec":
|
|
1147
|
+
return { second: numeric(token.width) };
|
|
1148
|
+
case "tz":
|
|
1149
|
+
return { timeZoneName: timeZoneNameStyle(token, onError) };
|
|
1150
|
+
case "quarter":
|
|
1151
|
+
case "week":
|
|
1152
|
+
case "sec-frac":
|
|
1153
|
+
case "ms":
|
|
1154
|
+
onError(`${token.desc} is not supported`);
|
|
1155
|
+
}
|
|
1156
|
+
return void 0;
|
|
1157
|
+
}
|
|
1158
|
+
function getDateFormatOptions(tokens, timeZone, onError = (error) => {
|
|
1159
|
+
throw error;
|
|
1160
|
+
}) {
|
|
1161
|
+
const options = {
|
|
1162
|
+
timeZone
|
|
1163
|
+
};
|
|
1164
|
+
const fields2 = [];
|
|
1165
|
+
for (const token of tokens) {
|
|
1166
|
+
const { error, field, str } = token;
|
|
1167
|
+
if (error) {
|
|
1168
|
+
const dte = new DateFormatError(error.message, token);
|
|
1169
|
+
dte.stack = error.stack;
|
|
1170
|
+
onError(dte);
|
|
1171
|
+
}
|
|
1172
|
+
if (str) {
|
|
1173
|
+
const msg = `Ignoring string part: ${str}`;
|
|
1174
|
+
onError(new DateFormatError(msg, token, DateFormatError.WARNING));
|
|
1175
|
+
}
|
|
1176
|
+
if (field) {
|
|
1177
|
+
if (fields2.indexOf(field) === -1)
|
|
1178
|
+
fields2.push(field);
|
|
1179
|
+
else
|
|
1180
|
+
onError(new DateFormatError(`Duplicate ${field} token`, token));
|
|
1181
|
+
}
|
|
1182
|
+
const opt = compileOptions(token, (msg, isWarning) => onError(new DateFormatError(msg, token, isWarning)));
|
|
1183
|
+
if (opt)
|
|
1184
|
+
Object.assign(options, opt);
|
|
1185
|
+
}
|
|
1186
|
+
return options;
|
|
1187
|
+
}
|
|
1188
|
+
var fields = {
|
|
1189
|
+
G: { field: "era", desc: "Era" },
|
|
1190
|
+
y: { field: "year", desc: "Year" },
|
|
1191
|
+
Y: { field: "year", desc: 'Year of "Week of Year"' },
|
|
1192
|
+
u: { field: "year", desc: "Extended year" },
|
|
1193
|
+
U: { field: "year", desc: "Cyclic year name" },
|
|
1194
|
+
r: { field: "year", desc: "Related Gregorian year" },
|
|
1195
|
+
Q: { field: "quarter", desc: "Quarter" },
|
|
1196
|
+
q: { field: "quarter", desc: "Stand-alone quarter" },
|
|
1197
|
+
M: { field: "month", desc: "Month in year" },
|
|
1198
|
+
L: { field: "month", desc: "Stand-alone month in year" },
|
|
1199
|
+
w: { field: "week", desc: "Week of year" },
|
|
1200
|
+
W: { field: "week", desc: "Week of month" },
|
|
1201
|
+
d: { field: "day", desc: "Day in month" },
|
|
1202
|
+
D: { field: "day", desc: "Day of year" },
|
|
1203
|
+
F: { field: "day", desc: "Day of week in month" },
|
|
1204
|
+
g: { field: "day", desc: "Modified julian day" },
|
|
1205
|
+
E: { field: "weekday", desc: "Day of week" },
|
|
1206
|
+
e: { field: "weekday", desc: "Local day of week" },
|
|
1207
|
+
c: { field: "weekday", desc: "Stand-alone local day of week" },
|
|
1208
|
+
a: { field: "period", desc: "AM/PM marker" },
|
|
1209
|
+
b: { field: "period", desc: "AM/PM/noon/midnight marker" },
|
|
1210
|
+
B: { field: "period", desc: "Flexible day period" },
|
|
1211
|
+
h: { field: "hour", desc: "Hour in AM/PM (1~12)" },
|
|
1212
|
+
H: { field: "hour", desc: "Hour in day (0~23)" },
|
|
1213
|
+
k: { field: "hour", desc: "Hour in day (1~24)" },
|
|
1214
|
+
K: { field: "hour", desc: "Hour in AM/PM (0~11)" },
|
|
1215
|
+
j: { field: "hour", desc: "Hour in preferred cycle" },
|
|
1216
|
+
J: { field: "hour", desc: "Hour in preferred cycle without marker" },
|
|
1217
|
+
C: { field: "hour", desc: "Hour in preferred cycle with flexible marker" },
|
|
1218
|
+
m: { field: "min", desc: "Minute in hour" },
|
|
1219
|
+
s: { field: "sec", desc: "Second in minute" },
|
|
1220
|
+
S: { field: "sec-frac", desc: "Fractional second" },
|
|
1221
|
+
A: { field: "ms", desc: "Milliseconds in day" },
|
|
1222
|
+
z: { field: "tz", desc: "Time Zone: specific non-location" },
|
|
1223
|
+
Z: { field: "tz", desc: "Time Zone" },
|
|
1224
|
+
O: { field: "tz", desc: "Time Zone: localized" },
|
|
1225
|
+
v: { field: "tz", desc: "Time Zone: generic non-location" },
|
|
1226
|
+
V: { field: "tz", desc: "Time Zone: ID" },
|
|
1227
|
+
X: { field: "tz", desc: "Time Zone: ISO8601 with Z" },
|
|
1228
|
+
x: { field: "tz", desc: "Time Zone: ISO8601" }
|
|
1229
|
+
};
|
|
1230
|
+
var isLetter = (char) => char >= "A" && char <= "Z" || char >= "a" && char <= "z";
|
|
1231
|
+
function readFieldToken(src, pos) {
|
|
1232
|
+
const char = src[pos];
|
|
1233
|
+
let width = 1;
|
|
1234
|
+
while (src[++pos] === char)
|
|
1235
|
+
++width;
|
|
1236
|
+
const field = fields[char];
|
|
1237
|
+
if (!field) {
|
|
1238
|
+
const msg = `The letter ${char} is not a valid field identifier`;
|
|
1239
|
+
return { char, error: new Error(msg), width };
|
|
1240
|
+
}
|
|
1241
|
+
return { char, field: field.field, desc: field.desc, width };
|
|
1242
|
+
}
|
|
1243
|
+
function readQuotedToken(src, pos) {
|
|
1244
|
+
let str = src[++pos];
|
|
1245
|
+
let width = 2;
|
|
1246
|
+
if (str === "'")
|
|
1247
|
+
return { char: "'", str, width };
|
|
1248
|
+
while (true) {
|
|
1249
|
+
const next = src[++pos];
|
|
1250
|
+
++width;
|
|
1251
|
+
if (next === void 0) {
|
|
1252
|
+
const msg = `Unterminated quoted literal in pattern: ${str || src}`;
|
|
1253
|
+
return { char: "'", error: new Error(msg), str, width };
|
|
1254
|
+
} else if (next === "'") {
|
|
1255
|
+
if (src[++pos] !== "'")
|
|
1256
|
+
return { char: "'", str, width };
|
|
1257
|
+
else
|
|
1258
|
+
++width;
|
|
1259
|
+
}
|
|
1260
|
+
str += next;
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
function readToken(src, pos) {
|
|
1264
|
+
const char = src[pos];
|
|
1265
|
+
if (!char)
|
|
1266
|
+
return null;
|
|
1267
|
+
if (isLetter(char))
|
|
1268
|
+
return readFieldToken(src, pos);
|
|
1269
|
+
if (char === "'")
|
|
1270
|
+
return readQuotedToken(src, pos);
|
|
1271
|
+
let str = char;
|
|
1272
|
+
let width = 1;
|
|
1273
|
+
while (true) {
|
|
1274
|
+
const next = src[++pos];
|
|
1275
|
+
if (!next || isLetter(next) || next === "'")
|
|
1276
|
+
return { char, str, width };
|
|
1277
|
+
str += next;
|
|
1278
|
+
width += 1;
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
function parseDateTokens(src) {
|
|
1282
|
+
const tokens = [];
|
|
1283
|
+
let pos = 0;
|
|
1284
|
+
while (true) {
|
|
1285
|
+
const token = readToken(src, pos);
|
|
1286
|
+
if (!token)
|
|
1287
|
+
return tokens;
|
|
1288
|
+
tokens.push(token);
|
|
1289
|
+
pos += token.width;
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1027
1292
|
function processTokens(tokens, mapText) {
|
|
1028
1293
|
if (!tokens.filter((token) => token.type !== "content").length) {
|
|
1029
|
-
return tokens.map((token) => mapText(token.value))
|
|
1294
|
+
return tokens.map((token) => mapText(token.value));
|
|
1030
1295
|
}
|
|
1031
1296
|
return tokens.map((token) => {
|
|
1032
1297
|
var _a;
|
|
@@ -1038,6 +1303,12 @@ function processTokens(tokens, mapText) {
|
|
|
1038
1303
|
return [token.arg];
|
|
1039
1304
|
} else if (token.type === "function") {
|
|
1040
1305
|
const _param = (_a = token == null ? void 0 : token.param) == null ? void 0 : _a[0];
|
|
1306
|
+
if (token.key === "date" && _param) {
|
|
1307
|
+
const opts = compileDateExpression(_param.value.trim(), (e) => {
|
|
1308
|
+
throw new Error(`Unable to compile date expression: ${e.message}`);
|
|
1309
|
+
});
|
|
1310
|
+
return [token.arg, token.key, opts];
|
|
1311
|
+
}
|
|
1041
1312
|
if (_param) {
|
|
1042
1313
|
return [token.arg, token.key, _param.value.trim()];
|
|
1043
1314
|
} else {
|
|
@@ -1059,6 +1330,13 @@ function processTokens(tokens, mapText) {
|
|
|
1059
1330
|
];
|
|
1060
1331
|
});
|
|
1061
1332
|
}
|
|
1333
|
+
function compileDateExpression(format, onError) {
|
|
1334
|
+
if (/^::/.test(format)) {
|
|
1335
|
+
const tokens = parseDateTokens(format.substring(2));
|
|
1336
|
+
return getDateFormatOptions(tokens, void 0, onError);
|
|
1337
|
+
}
|
|
1338
|
+
return format;
|
|
1339
|
+
}
|
|
1062
1340
|
function compileMessage(message, mapText = (v) => v) {
|
|
1063
1341
|
try {
|
|
1064
1342
|
return processTokens((0, import_parser.parse)(message), mapText);
|
|
@@ -1066,11 +1344,11 @@ function compileMessage(message, mapText = (v) => v) {
|
|
|
1066
1344
|
console.error(`${e.message}
|
|
1067
1345
|
|
|
1068
1346
|
Message: ${message}`);
|
|
1069
|
-
return message;
|
|
1347
|
+
return [message];
|
|
1070
1348
|
}
|
|
1071
1349
|
}
|
|
1072
1350
|
|
|
1073
|
-
// node_modules/.pnpm/@lingui+core@
|
|
1351
|
+
// node_modules/.pnpm/@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-macros@3.1.0_typescri_qfhfd5z2jpd4amxt2golzdalsi/node_modules/@lingui/core/dist/index.mjs
|
|
1074
1352
|
var isString = (s) => typeof s === "string";
|
|
1075
1353
|
var isFunction = (f) => typeof f === "function";
|
|
1076
1354
|
var cache = /* @__PURE__ */ new Map();
|
|
@@ -1081,12 +1359,59 @@ function normalizeLocales(locales) {
|
|
|
1081
1359
|
}
|
|
1082
1360
|
function date(locales, value, format) {
|
|
1083
1361
|
const _locales = normalizeLocales(locales);
|
|
1362
|
+
if (!format) {
|
|
1363
|
+
format = "default";
|
|
1364
|
+
}
|
|
1365
|
+
let o;
|
|
1366
|
+
if (typeof format === "string") {
|
|
1367
|
+
o = {
|
|
1368
|
+
day: "numeric",
|
|
1369
|
+
month: "short",
|
|
1370
|
+
year: "numeric"
|
|
1371
|
+
};
|
|
1372
|
+
switch (format) {
|
|
1373
|
+
case "full":
|
|
1374
|
+
o.weekday = "long";
|
|
1375
|
+
case "long":
|
|
1376
|
+
o.month = "long";
|
|
1377
|
+
break;
|
|
1378
|
+
case "short":
|
|
1379
|
+
o.month = "numeric";
|
|
1380
|
+
break;
|
|
1381
|
+
}
|
|
1382
|
+
} else {
|
|
1383
|
+
o = format;
|
|
1384
|
+
}
|
|
1084
1385
|
const formatter = getMemoized(
|
|
1085
1386
|
() => cacheKey("date", _locales, format),
|
|
1086
|
-
() => new Intl.DateTimeFormat(_locales,
|
|
1387
|
+
() => new Intl.DateTimeFormat(_locales, o)
|
|
1087
1388
|
);
|
|
1088
1389
|
return formatter.format(isString(value) ? new Date(value) : value);
|
|
1089
1390
|
}
|
|
1391
|
+
function time(locales, value, format) {
|
|
1392
|
+
let o;
|
|
1393
|
+
if (!format) {
|
|
1394
|
+
format = "default";
|
|
1395
|
+
}
|
|
1396
|
+
if (typeof format === "string") {
|
|
1397
|
+
o = {
|
|
1398
|
+
second: "numeric",
|
|
1399
|
+
minute: "numeric",
|
|
1400
|
+
hour: "numeric"
|
|
1401
|
+
};
|
|
1402
|
+
switch (format) {
|
|
1403
|
+
case "full":
|
|
1404
|
+
case "long":
|
|
1405
|
+
o.timeZoneName = "short";
|
|
1406
|
+
break;
|
|
1407
|
+
case "short":
|
|
1408
|
+
delete o.second;
|
|
1409
|
+
}
|
|
1410
|
+
} else {
|
|
1411
|
+
o = format;
|
|
1412
|
+
}
|
|
1413
|
+
return date(locales, value, o);
|
|
1414
|
+
}
|
|
1090
1415
|
function number(locales, value, format) {
|
|
1091
1416
|
const _locales = normalizeLocales(locales);
|
|
1092
1417
|
const formatter = getMemoized(
|
|
@@ -1121,12 +1446,14 @@ function cacheKey(type, locales, options) {
|
|
|
1121
1446
|
const localeKey = locales.join("-");
|
|
1122
1447
|
return `${type}-${localeKey}-${JSON.stringify(options)}`;
|
|
1123
1448
|
}
|
|
1124
|
-
var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}
|
|
1449
|
+
var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/;
|
|
1125
1450
|
var OCTOTHORPE_PH = "%__lingui_octothorpe__%";
|
|
1126
1451
|
var getDefaultFormats = (locale, passedLocales, formats = {}) => {
|
|
1127
1452
|
const locales = passedLocales || locale;
|
|
1128
1453
|
const style = (format) => {
|
|
1129
|
-
|
|
1454
|
+
if (typeof format === "object")
|
|
1455
|
+
return format;
|
|
1456
|
+
return formats[format];
|
|
1130
1457
|
};
|
|
1131
1458
|
const replaceOctothorpe = (value, message) => {
|
|
1132
1459
|
const numberFormat = Object.keys(formats).length ? style("number") : void 0;
|
|
@@ -1145,8 +1472,13 @@ var getDefaultFormats = (locale, passedLocales, formats = {}) => {
|
|
|
1145
1472
|
return replaceOctothorpe(value - offset, message);
|
|
1146
1473
|
},
|
|
1147
1474
|
select: selectFormatter,
|
|
1148
|
-
number: (value, format) => number(
|
|
1149
|
-
|
|
1475
|
+
number: (value, format) => number(
|
|
1476
|
+
locales,
|
|
1477
|
+
value,
|
|
1478
|
+
style(format) || { style: format }
|
|
1479
|
+
),
|
|
1480
|
+
date: (value, format) => date(locales, value, style(format) || format),
|
|
1481
|
+
time: (value, format) => time(locales, value, style(format) || format)
|
|
1150
1482
|
};
|
|
1151
1483
|
};
|
|
1152
1484
|
var selectFormatter = (value, rules) => {
|
|
@@ -1195,10 +1527,10 @@ function interpolate(translation, locale, locales) {
|
|
|
1195
1527
|
};
|
|
1196
1528
|
const result = formatMessage(translation);
|
|
1197
1529
|
if (isString(result) && UNICODE_REGEX.test(result)) {
|
|
1198
|
-
return (0, import_unraw.unraw)(result
|
|
1530
|
+
return (0, import_unraw.unraw)(result);
|
|
1199
1531
|
}
|
|
1200
1532
|
if (isString(result))
|
|
1201
|
-
return result
|
|
1533
|
+
return result;
|
|
1202
1534
|
return result ? String(result) : "";
|
|
1203
1535
|
};
|
|
1204
1536
|
}
|
|
@@ -1253,7 +1585,11 @@ var I18n = class extends EventEmitter {
|
|
|
1253
1585
|
__publicField2(this, "_localeData", {});
|
|
1254
1586
|
__publicField2(this, "_messages", {});
|
|
1255
1587
|
__publicField2(this, "_missing");
|
|
1588
|
+
__publicField2(this, "_messageCompiler");
|
|
1256
1589
|
__publicField2(this, "t", this._.bind(this));
|
|
1590
|
+
if (true) {
|
|
1591
|
+
this.setMessagesCompiler(compileMessage);
|
|
1592
|
+
}
|
|
1257
1593
|
if (params.missing != null)
|
|
1258
1594
|
this._missing = params.missing;
|
|
1259
1595
|
if (params.messages != null)
|
|
@@ -1289,12 +1625,30 @@ var I18n = class extends EventEmitter {
|
|
|
1289
1625
|
Object.assign(maybeLocaleData, localeData);
|
|
1290
1626
|
}
|
|
1291
1627
|
}
|
|
1628
|
+
/**
|
|
1629
|
+
* Registers a `MessageCompiler` to enable the use of uncompiled catalogs at runtime.
|
|
1630
|
+
*
|
|
1631
|
+
* In production builds, the `MessageCompiler` is typically excluded to reduce bundle size.
|
|
1632
|
+
* By default, message catalogs should be precompiled during the build process. However,
|
|
1633
|
+
* if you need to compile catalogs at runtime, you can use this method to set a message compiler.
|
|
1634
|
+
*
|
|
1635
|
+
* Example usage:
|
|
1636
|
+
*
|
|
1637
|
+
* ```ts
|
|
1638
|
+
* import { compileMessage } from "@lingui/message-utils/compileMessage";
|
|
1639
|
+
*
|
|
1640
|
+
* i18n.setMessagesCompiler(compileMessage);
|
|
1641
|
+
* ```
|
|
1642
|
+
*/
|
|
1643
|
+
setMessagesCompiler(compiler) {
|
|
1644
|
+
this._messageCompiler = compiler;
|
|
1645
|
+
return this;
|
|
1646
|
+
}
|
|
1292
1647
|
/**
|
|
1293
1648
|
* @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
|
|
1294
1649
|
*/
|
|
1295
|
-
// @ts-ignore deprecated, so ignore the reported error
|
|
1296
1650
|
loadLocaleData(localeOrAllData, localeData) {
|
|
1297
|
-
if (
|
|
1651
|
+
if (typeof localeOrAllData === "string") {
|
|
1298
1652
|
this._loadLocaleData(localeOrAllData, localeData);
|
|
1299
1653
|
} else {
|
|
1300
1654
|
Object.keys(localeOrAllData).forEach(
|
|
@@ -1341,6 +1695,11 @@ var I18n = class extends EventEmitter {
|
|
|
1341
1695
|
this.emit("change");
|
|
1342
1696
|
}
|
|
1343
1697
|
_(id, values, options) {
|
|
1698
|
+
if (!this.locale) {
|
|
1699
|
+
throw new Error(
|
|
1700
|
+
"Lingui: Attempted to call a translation function without setting a locale.\nMake sure to call `i18n.activate(locale)` before using Lingui functions.\nThis issue may also occur due to a race condition in your initialization logic."
|
|
1701
|
+
);
|
|
1702
|
+
}
|
|
1344
1703
|
let message = options == null ? void 0 : options.message;
|
|
1345
1704
|
if (!id) {
|
|
1346
1705
|
id = "";
|
|
@@ -1360,8 +1719,20 @@ var I18n = class extends EventEmitter {
|
|
|
1360
1719
|
this.emit("missing", { id, locale: this._locale });
|
|
1361
1720
|
}
|
|
1362
1721
|
let translation = messageForId || message || id;
|
|
1363
|
-
if (
|
|
1364
|
-
|
|
1722
|
+
if (isString(translation)) {
|
|
1723
|
+
if (this._messageCompiler) {
|
|
1724
|
+
translation = this._messageCompiler(translation);
|
|
1725
|
+
} else {
|
|
1726
|
+
console.warn(`Uncompiled message detected! Message:
|
|
1727
|
+
|
|
1728
|
+
> ${translation}
|
|
1729
|
+
|
|
1730
|
+
That means you use raw catalog or your catalog doesn't have a translation for the message and fallback was used.
|
|
1731
|
+
ICU features such as interpolation and plurals will not work properly for that message.
|
|
1732
|
+
|
|
1733
|
+
Please compile your catalog first.
|
|
1734
|
+
`);
|
|
1735
|
+
}
|
|
1365
1736
|
}
|
|
1366
1737
|
if (isString(translation) && UNICODE_REGEX.test(translation))
|
|
1367
1738
|
return JSON.parse(`"${translation}"`);
|
|
@@ -1385,7 +1756,7 @@ function setupI18n(params = {}) {
|
|
|
1385
1756
|
}
|
|
1386
1757
|
var i18n = setupI18n();
|
|
1387
1758
|
|
|
1388
|
-
// node_modules/.pnpm/@warp-ds+css@2.
|
|
1759
|
+
// node_modules/.pnpm/@warp-ds+css@2.1.1_@warp-ds+uno@2.1.0_unocss@0.62.0_postcss@8.5.1_rollup@4.32.1_vite@5.3.3_@t_sgrraibu65gdmqpe655kfrpl6a/node_modules/@warp-ds/css/component-classes/index.js
|
|
1389
1760
|
var card = {
|
|
1390
1761
|
base: "cursor-pointer overflow-hidden relative transition-all",
|
|
1391
1762
|
shadow: "group rounded-8 s-surface-elevated-200 hover:s-surface-elevated-200-hover active:s-surface-elevated-200-active",
|
|
@@ -1666,19 +2037,19 @@ var activateI18n = (enMessages, nbMessages, fiMessages, daMessages, svMessages)
|
|
|
1666
2037
|
};
|
|
1667
2038
|
|
|
1668
2039
|
// packages/card/locales/da/messages.mjs
|
|
1669
|
-
var messages = JSON.parse('{"card.button.text":"V\xE6lg"}');
|
|
2040
|
+
var messages = JSON.parse('{"card.button.text":["V\xE6lg"]}');
|
|
1670
2041
|
|
|
1671
2042
|
// packages/card/locales/en/messages.mjs
|
|
1672
|
-
var messages2 = JSON.parse('{"card.button.text":"Select"}');
|
|
2043
|
+
var messages2 = JSON.parse('{"card.button.text":["Select"]}');
|
|
1673
2044
|
|
|
1674
2045
|
// packages/card/locales/fi/messages.mjs
|
|
1675
|
-
var messages3 = JSON.parse('{"card.button.text":"Valitse"}');
|
|
2046
|
+
var messages3 = JSON.parse('{"card.button.text":["Valitse"]}');
|
|
1676
2047
|
|
|
1677
2048
|
// packages/card/locales/nb/messages.mjs
|
|
1678
|
-
var messages4 = JSON.parse('{"card.button.text":"Velg"}');
|
|
2049
|
+
var messages4 = JSON.parse('{"card.button.text":["Velg"]}');
|
|
1679
2050
|
|
|
1680
2051
|
// packages/card/locales/sv/messages.mjs
|
|
1681
|
-
var messages5 = JSON.parse('{"card.button.text":"V\xE4lj"}');
|
|
2052
|
+
var messages5 = JSON.parse('{"card.button.text":["V\xE4lj"]}');
|
|
1682
2053
|
|
|
1683
2054
|
// packages/card/index.js
|
|
1684
2055
|
var keys = {
|