@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
|
@@ -729,9 +729,9 @@ var require_moo = __commonJS({
|
|
|
729
729
|
}
|
|
730
730
|
});
|
|
731
731
|
|
|
732
|
-
// node_modules/.pnpm/@messageformat+parser@5.1.
|
|
732
|
+
// node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/lexer.js
|
|
733
733
|
var require_lexer = __commonJS({
|
|
734
|
-
"node_modules/.pnpm/@messageformat+parser@5.1.
|
|
734
|
+
"node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/lexer.js"(exports) {
|
|
735
735
|
"use strict";
|
|
736
736
|
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
737
737
|
return mod && mod.__esModule ? mod : { "default": mod };
|
|
@@ -744,7 +744,7 @@ var require_lexer = __commonJS({
|
|
|
744
744
|
doubleapos: { match: "''", value: () => "'" },
|
|
745
745
|
quoted: {
|
|
746
746
|
lineBreaks: true,
|
|
747
|
-
match: /'[{}#](?:[^]
|
|
747
|
+
match: /'[{}#](?:[^']|'')*'(?!')/u,
|
|
748
748
|
value: (src) => src.slice(1, -1).replace(/''/g, "'")
|
|
749
749
|
},
|
|
750
750
|
argument: {
|
|
@@ -796,12 +796,13 @@ var require_lexer = __commonJS({
|
|
|
796
796
|
}
|
|
797
797
|
});
|
|
798
798
|
|
|
799
|
-
// node_modules/.pnpm/@messageformat+parser@5.1.
|
|
799
|
+
// node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/parser.js
|
|
800
800
|
var require_parser = __commonJS({
|
|
801
|
-
"node_modules/.pnpm/@messageformat+parser@5.1.
|
|
801
|
+
"node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/parser.js"(exports) {
|
|
802
802
|
"use strict";
|
|
803
803
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
804
|
-
exports.
|
|
804
|
+
exports.ParseError = void 0;
|
|
805
|
+
exports.parse = parse2;
|
|
805
806
|
var lexer_js_1 = require_lexer();
|
|
806
807
|
var getContext = (lt) => ({
|
|
807
808
|
offset: lt.offset,
|
|
@@ -867,8 +868,9 @@ var require_parser = __commonJS({
|
|
|
867
868
|
}
|
|
868
869
|
checkSelectKey(lt, type, key) {
|
|
869
870
|
if (key[0] === "=") {
|
|
870
|
-
if (type === "select")
|
|
871
|
+
if (type === "select") {
|
|
871
872
|
throw new ParseError(lt, `The case ${key} is not valid with select`);
|
|
873
|
+
}
|
|
872
874
|
} else if (type !== "select") {
|
|
873
875
|
const keys = type === "plural" ? this.cardinalKeys : this.ordinalKeys;
|
|
874
876
|
if (this.strictPluralKeys && keys.length > 0 && !keys.includes(key)) {
|
|
@@ -886,10 +888,12 @@ var require_parser = __commonJS({
|
|
|
886
888
|
for (const lt of this.lexer) {
|
|
887
889
|
switch (lt.type) {
|
|
888
890
|
case "offset":
|
|
889
|
-
if (type === "select")
|
|
891
|
+
if (type === "select") {
|
|
890
892
|
throw new ParseError(lt, "Unexpected plural offset for select");
|
|
891
|
-
|
|
893
|
+
}
|
|
894
|
+
if (sel.cases.length > 0) {
|
|
892
895
|
throw new ParseError(lt, "Plural offset must be set before cases");
|
|
896
|
+
}
|
|
893
897
|
sel.pluralOffset = Number(lt.value);
|
|
894
898
|
ctx.text += lt.text;
|
|
895
899
|
ctx.lineBreaks += lt.lineBreaks;
|
|
@@ -929,11 +933,13 @@ var require_parser = __commonJS({
|
|
|
929
933
|
const end = this.lexer.next();
|
|
930
934
|
if (!end)
|
|
931
935
|
throw new ParseError(null, "Unexpected message end");
|
|
932
|
-
if (end.type !== "end")
|
|
936
|
+
if (end.type !== "end") {
|
|
933
937
|
throw new ParseError(end, `Unexpected lexer token: ${end.type}`);
|
|
938
|
+
}
|
|
934
939
|
ctx.text += end.text;
|
|
935
|
-
if (isSelectType(argType.value.toLowerCase()))
|
|
940
|
+
if (isSelectType(argType.value.toLowerCase())) {
|
|
936
941
|
throw new ParseError(argType, `Invalid type identifier: ${argType.value}`);
|
|
942
|
+
}
|
|
937
943
|
return {
|
|
938
944
|
type: "function",
|
|
939
945
|
arg: lt.value,
|
|
@@ -947,8 +953,9 @@ var require_parser = __commonJS({
|
|
|
947
953
|
throw new ParseError(argType, msg);
|
|
948
954
|
}
|
|
949
955
|
let param = this.parseBody(this.strict ? false : inPlural);
|
|
950
|
-
if (this.strict && param.length > 0)
|
|
956
|
+
if (this.strict && param.length > 0) {
|
|
951
957
|
param = strictArgStyleParam(lt, param);
|
|
958
|
+
}
|
|
952
959
|
return {
|
|
953
960
|
type: "function",
|
|
954
961
|
arg: lt.value,
|
|
@@ -958,10 +965,11 @@ var require_parser = __commonJS({
|
|
|
958
965
|
};
|
|
959
966
|
}
|
|
960
967
|
case "select":
|
|
961
|
-
if (isSelectType(argType.value))
|
|
968
|
+
if (isSelectType(argType.value)) {
|
|
962
969
|
return this.parseSelect(lt, inPlural, ctx, argType.value);
|
|
963
|
-
else
|
|
970
|
+
} else {
|
|
964
971
|
throw new ParseError(argType, `Unexpected select type ${argType.value}`);
|
|
972
|
+
}
|
|
965
973
|
default:
|
|
966
974
|
throw new ParseError(argType, `Unexpected lexer token: ${argType.type}`);
|
|
967
975
|
}
|
|
@@ -1008,7 +1016,6 @@ var require_parser = __commonJS({
|
|
|
1008
1016
|
const parser = new Parser(src, options);
|
|
1009
1017
|
return parser.parse();
|
|
1010
1018
|
}
|
|
1011
|
-
exports.parse = parse2;
|
|
1012
1019
|
}
|
|
1013
1020
|
});
|
|
1014
1021
|
|
|
@@ -1025,7 +1032,7 @@ var r = function() {
|
|
|
1025
1032
|
}, []).join(" ");
|
|
1026
1033
|
};
|
|
1027
1034
|
|
|
1028
|
-
// node_modules/.pnpm/@warp-ds+css@2.
|
|
1035
|
+
// 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
|
|
1029
1036
|
var box = {
|
|
1030
1037
|
base: "group block relative break-words last-child:mb-0 p-16 rounded-8",
|
|
1031
1038
|
// Relative here enables w-clickable
|
|
@@ -1306,18 +1313,276 @@ function kebabCaseAttributes(constructor) {
|
|
|
1306
1313
|
};
|
|
1307
1314
|
}
|
|
1308
1315
|
|
|
1309
|
-
// node_modules/.pnpm/@warp-ds+icons@2.
|
|
1316
|
+
// node_modules/.pnpm/@warp-ds+icons@2.5.0_@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-_hyhbgchrkasknlbocfng7geeci/node_modules/@warp-ds/icons/dist/elements/chevron-down-16.js
|
|
1310
1317
|
import { LitElement } from "lit";
|
|
1311
1318
|
import { unsafeStatic, html } from "lit/static-html.js";
|
|
1312
1319
|
|
|
1313
|
-
// node_modules/.pnpm/@lingui+core@
|
|
1320
|
+
// 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
|
|
1314
1321
|
var import_unraw = __toESM(require_dist(), 1);
|
|
1315
1322
|
|
|
1316
|
-
// node_modules/.pnpm/@lingui+message-utils@
|
|
1323
|
+
// node_modules/.pnpm/@lingui+message-utils@5.2.0/node_modules/@lingui/message-utils/dist/compileMessage.mjs
|
|
1317
1324
|
var import_parser = __toESM(require_parser(), 1);
|
|
1325
|
+
var DateFormatError = class extends Error {
|
|
1326
|
+
/** @internal */
|
|
1327
|
+
constructor(msg, token, type) {
|
|
1328
|
+
super(msg);
|
|
1329
|
+
this.token = token;
|
|
1330
|
+
this.type = type || "error";
|
|
1331
|
+
}
|
|
1332
|
+
};
|
|
1333
|
+
var alpha = (width) => width < 4 ? "short" : width === 4 ? "long" : "narrow";
|
|
1334
|
+
var numeric = (width) => width % 2 === 0 ? "2-digit" : "numeric";
|
|
1335
|
+
function yearOptions(token, onError) {
|
|
1336
|
+
switch (token.char) {
|
|
1337
|
+
case "y":
|
|
1338
|
+
return { year: numeric(token.width) };
|
|
1339
|
+
case "r":
|
|
1340
|
+
return { calendar: "gregory", year: "numeric" };
|
|
1341
|
+
case "u":
|
|
1342
|
+
case "U":
|
|
1343
|
+
case "Y":
|
|
1344
|
+
default:
|
|
1345
|
+
onError(`${token.desc} is not supported; falling back to year:numeric`, DateFormatError.WARNING);
|
|
1346
|
+
return { year: "numeric" };
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
function monthStyle(token, onError) {
|
|
1350
|
+
switch (token.width) {
|
|
1351
|
+
case 1:
|
|
1352
|
+
return "numeric";
|
|
1353
|
+
case 2:
|
|
1354
|
+
return "2-digit";
|
|
1355
|
+
case 3:
|
|
1356
|
+
return "short";
|
|
1357
|
+
case 4:
|
|
1358
|
+
return "long";
|
|
1359
|
+
case 5:
|
|
1360
|
+
return "narrow";
|
|
1361
|
+
default:
|
|
1362
|
+
onError(`${token.desc} is not supported with width ${token.width}`);
|
|
1363
|
+
return void 0;
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
function dayStyle(token, onError) {
|
|
1367
|
+
const { char, desc, width } = token;
|
|
1368
|
+
if (char === "d") {
|
|
1369
|
+
return numeric(width);
|
|
1370
|
+
} else {
|
|
1371
|
+
onError(`${desc} is not supported`);
|
|
1372
|
+
return void 0;
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
function weekdayStyle(token, onError) {
|
|
1376
|
+
const { char, desc, width } = token;
|
|
1377
|
+
if ((char === "c" || char === "e") && width < 3) {
|
|
1378
|
+
const msg = `Numeric value is not supported for ${desc}; falling back to weekday:short`;
|
|
1379
|
+
onError(msg, DateFormatError.WARNING);
|
|
1380
|
+
}
|
|
1381
|
+
return alpha(width);
|
|
1382
|
+
}
|
|
1383
|
+
function hourOptions(token) {
|
|
1384
|
+
const hour = numeric(token.width);
|
|
1385
|
+
let hourCycle;
|
|
1386
|
+
switch (token.char) {
|
|
1387
|
+
case "h":
|
|
1388
|
+
hourCycle = "h12";
|
|
1389
|
+
break;
|
|
1390
|
+
case "H":
|
|
1391
|
+
hourCycle = "h23";
|
|
1392
|
+
break;
|
|
1393
|
+
case "k":
|
|
1394
|
+
hourCycle = "h24";
|
|
1395
|
+
break;
|
|
1396
|
+
case "K":
|
|
1397
|
+
hourCycle = "h11";
|
|
1398
|
+
break;
|
|
1399
|
+
}
|
|
1400
|
+
return hourCycle ? { hour, hourCycle } : { hour };
|
|
1401
|
+
}
|
|
1402
|
+
function timeZoneNameStyle(token, onError) {
|
|
1403
|
+
const { char, desc, width } = token;
|
|
1404
|
+
switch (char) {
|
|
1405
|
+
case "v":
|
|
1406
|
+
case "z":
|
|
1407
|
+
return width === 4 ? "long" : "short";
|
|
1408
|
+
case "V":
|
|
1409
|
+
if (width === 4)
|
|
1410
|
+
return "long";
|
|
1411
|
+
onError(`${desc} is not supported with width ${width}`);
|
|
1412
|
+
return void 0;
|
|
1413
|
+
case "X":
|
|
1414
|
+
onError(`${desc} is not supported`);
|
|
1415
|
+
return void 0;
|
|
1416
|
+
}
|
|
1417
|
+
return "short";
|
|
1418
|
+
}
|
|
1419
|
+
function compileOptions(token, onError) {
|
|
1420
|
+
switch (token.field) {
|
|
1421
|
+
case "era":
|
|
1422
|
+
return { era: alpha(token.width) };
|
|
1423
|
+
case "year":
|
|
1424
|
+
return yearOptions(token, onError);
|
|
1425
|
+
case "month":
|
|
1426
|
+
return { month: monthStyle(token, onError) };
|
|
1427
|
+
case "day":
|
|
1428
|
+
return { day: dayStyle(token, onError) };
|
|
1429
|
+
case "weekday":
|
|
1430
|
+
return { weekday: weekdayStyle(token, onError) };
|
|
1431
|
+
case "period":
|
|
1432
|
+
return void 0;
|
|
1433
|
+
case "hour":
|
|
1434
|
+
return hourOptions(token);
|
|
1435
|
+
case "min":
|
|
1436
|
+
return { minute: numeric(token.width) };
|
|
1437
|
+
case "sec":
|
|
1438
|
+
return { second: numeric(token.width) };
|
|
1439
|
+
case "tz":
|
|
1440
|
+
return { timeZoneName: timeZoneNameStyle(token, onError) };
|
|
1441
|
+
case "quarter":
|
|
1442
|
+
case "week":
|
|
1443
|
+
case "sec-frac":
|
|
1444
|
+
case "ms":
|
|
1445
|
+
onError(`${token.desc} is not supported`);
|
|
1446
|
+
}
|
|
1447
|
+
return void 0;
|
|
1448
|
+
}
|
|
1449
|
+
function getDateFormatOptions(tokens, timeZone, onError = (error) => {
|
|
1450
|
+
throw error;
|
|
1451
|
+
}) {
|
|
1452
|
+
const options = {
|
|
1453
|
+
timeZone
|
|
1454
|
+
};
|
|
1455
|
+
const fields2 = [];
|
|
1456
|
+
for (const token of tokens) {
|
|
1457
|
+
const { error, field, str } = token;
|
|
1458
|
+
if (error) {
|
|
1459
|
+
const dte = new DateFormatError(error.message, token);
|
|
1460
|
+
dte.stack = error.stack;
|
|
1461
|
+
onError(dte);
|
|
1462
|
+
}
|
|
1463
|
+
if (str) {
|
|
1464
|
+
const msg = `Ignoring string part: ${str}`;
|
|
1465
|
+
onError(new DateFormatError(msg, token, DateFormatError.WARNING));
|
|
1466
|
+
}
|
|
1467
|
+
if (field) {
|
|
1468
|
+
if (fields2.indexOf(field) === -1)
|
|
1469
|
+
fields2.push(field);
|
|
1470
|
+
else
|
|
1471
|
+
onError(new DateFormatError(`Duplicate ${field} token`, token));
|
|
1472
|
+
}
|
|
1473
|
+
const opt = compileOptions(token, (msg, isWarning) => onError(new DateFormatError(msg, token, isWarning)));
|
|
1474
|
+
if (opt)
|
|
1475
|
+
Object.assign(options, opt);
|
|
1476
|
+
}
|
|
1477
|
+
return options;
|
|
1478
|
+
}
|
|
1479
|
+
var fields = {
|
|
1480
|
+
G: { field: "era", desc: "Era" },
|
|
1481
|
+
y: { field: "year", desc: "Year" },
|
|
1482
|
+
Y: { field: "year", desc: 'Year of "Week of Year"' },
|
|
1483
|
+
u: { field: "year", desc: "Extended year" },
|
|
1484
|
+
U: { field: "year", desc: "Cyclic year name" },
|
|
1485
|
+
r: { field: "year", desc: "Related Gregorian year" },
|
|
1486
|
+
Q: { field: "quarter", desc: "Quarter" },
|
|
1487
|
+
q: { field: "quarter", desc: "Stand-alone quarter" },
|
|
1488
|
+
M: { field: "month", desc: "Month in year" },
|
|
1489
|
+
L: { field: "month", desc: "Stand-alone month in year" },
|
|
1490
|
+
w: { field: "week", desc: "Week of year" },
|
|
1491
|
+
W: { field: "week", desc: "Week of month" },
|
|
1492
|
+
d: { field: "day", desc: "Day in month" },
|
|
1493
|
+
D: { field: "day", desc: "Day of year" },
|
|
1494
|
+
F: { field: "day", desc: "Day of week in month" },
|
|
1495
|
+
g: { field: "day", desc: "Modified julian day" },
|
|
1496
|
+
E: { field: "weekday", desc: "Day of week" },
|
|
1497
|
+
e: { field: "weekday", desc: "Local day of week" },
|
|
1498
|
+
c: { field: "weekday", desc: "Stand-alone local day of week" },
|
|
1499
|
+
a: { field: "period", desc: "AM/PM marker" },
|
|
1500
|
+
b: { field: "period", desc: "AM/PM/noon/midnight marker" },
|
|
1501
|
+
B: { field: "period", desc: "Flexible day period" },
|
|
1502
|
+
h: { field: "hour", desc: "Hour in AM/PM (1~12)" },
|
|
1503
|
+
H: { field: "hour", desc: "Hour in day (0~23)" },
|
|
1504
|
+
k: { field: "hour", desc: "Hour in day (1~24)" },
|
|
1505
|
+
K: { field: "hour", desc: "Hour in AM/PM (0~11)" },
|
|
1506
|
+
j: { field: "hour", desc: "Hour in preferred cycle" },
|
|
1507
|
+
J: { field: "hour", desc: "Hour in preferred cycle without marker" },
|
|
1508
|
+
C: { field: "hour", desc: "Hour in preferred cycle with flexible marker" },
|
|
1509
|
+
m: { field: "min", desc: "Minute in hour" },
|
|
1510
|
+
s: { field: "sec", desc: "Second in minute" },
|
|
1511
|
+
S: { field: "sec-frac", desc: "Fractional second" },
|
|
1512
|
+
A: { field: "ms", desc: "Milliseconds in day" },
|
|
1513
|
+
z: { field: "tz", desc: "Time Zone: specific non-location" },
|
|
1514
|
+
Z: { field: "tz", desc: "Time Zone" },
|
|
1515
|
+
O: { field: "tz", desc: "Time Zone: localized" },
|
|
1516
|
+
v: { field: "tz", desc: "Time Zone: generic non-location" },
|
|
1517
|
+
V: { field: "tz", desc: "Time Zone: ID" },
|
|
1518
|
+
X: { field: "tz", desc: "Time Zone: ISO8601 with Z" },
|
|
1519
|
+
x: { field: "tz", desc: "Time Zone: ISO8601" }
|
|
1520
|
+
};
|
|
1521
|
+
var isLetter = (char) => char >= "A" && char <= "Z" || char >= "a" && char <= "z";
|
|
1522
|
+
function readFieldToken(src, pos) {
|
|
1523
|
+
const char = src[pos];
|
|
1524
|
+
let width = 1;
|
|
1525
|
+
while (src[++pos] === char)
|
|
1526
|
+
++width;
|
|
1527
|
+
const field = fields[char];
|
|
1528
|
+
if (!field) {
|
|
1529
|
+
const msg = `The letter ${char} is not a valid field identifier`;
|
|
1530
|
+
return { char, error: new Error(msg), width };
|
|
1531
|
+
}
|
|
1532
|
+
return { char, field: field.field, desc: field.desc, width };
|
|
1533
|
+
}
|
|
1534
|
+
function readQuotedToken(src, pos) {
|
|
1535
|
+
let str = src[++pos];
|
|
1536
|
+
let width = 2;
|
|
1537
|
+
if (str === "'")
|
|
1538
|
+
return { char: "'", str, width };
|
|
1539
|
+
while (true) {
|
|
1540
|
+
const next = src[++pos];
|
|
1541
|
+
++width;
|
|
1542
|
+
if (next === void 0) {
|
|
1543
|
+
const msg = `Unterminated quoted literal in pattern: ${str || src}`;
|
|
1544
|
+
return { char: "'", error: new Error(msg), str, width };
|
|
1545
|
+
} else if (next === "'") {
|
|
1546
|
+
if (src[++pos] !== "'")
|
|
1547
|
+
return { char: "'", str, width };
|
|
1548
|
+
else
|
|
1549
|
+
++width;
|
|
1550
|
+
}
|
|
1551
|
+
str += next;
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
function readToken(src, pos) {
|
|
1555
|
+
const char = src[pos];
|
|
1556
|
+
if (!char)
|
|
1557
|
+
return null;
|
|
1558
|
+
if (isLetter(char))
|
|
1559
|
+
return readFieldToken(src, pos);
|
|
1560
|
+
if (char === "'")
|
|
1561
|
+
return readQuotedToken(src, pos);
|
|
1562
|
+
let str = char;
|
|
1563
|
+
let width = 1;
|
|
1564
|
+
while (true) {
|
|
1565
|
+
const next = src[++pos];
|
|
1566
|
+
if (!next || isLetter(next) || next === "'")
|
|
1567
|
+
return { char, str, width };
|
|
1568
|
+
str += next;
|
|
1569
|
+
width += 1;
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
function parseDateTokens(src) {
|
|
1573
|
+
const tokens = [];
|
|
1574
|
+
let pos = 0;
|
|
1575
|
+
while (true) {
|
|
1576
|
+
const token = readToken(src, pos);
|
|
1577
|
+
if (!token)
|
|
1578
|
+
return tokens;
|
|
1579
|
+
tokens.push(token);
|
|
1580
|
+
pos += token.width;
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1318
1583
|
function processTokens(tokens, mapText) {
|
|
1319
1584
|
if (!tokens.filter((token) => token.type !== "content").length) {
|
|
1320
|
-
return tokens.map((token) => mapText(token.value))
|
|
1585
|
+
return tokens.map((token) => mapText(token.value));
|
|
1321
1586
|
}
|
|
1322
1587
|
return tokens.map((token) => {
|
|
1323
1588
|
var _a;
|
|
@@ -1329,6 +1594,12 @@ function processTokens(tokens, mapText) {
|
|
|
1329
1594
|
return [token.arg];
|
|
1330
1595
|
} else if (token.type === "function") {
|
|
1331
1596
|
const _param = (_a = token == null ? void 0 : token.param) == null ? void 0 : _a[0];
|
|
1597
|
+
if (token.key === "date" && _param) {
|
|
1598
|
+
const opts = compileDateExpression(_param.value.trim(), (e) => {
|
|
1599
|
+
throw new Error(`Unable to compile date expression: ${e.message}`);
|
|
1600
|
+
});
|
|
1601
|
+
return [token.arg, token.key, opts];
|
|
1602
|
+
}
|
|
1332
1603
|
if (_param) {
|
|
1333
1604
|
return [token.arg, token.key, _param.value.trim()];
|
|
1334
1605
|
} else {
|
|
@@ -1350,6 +1621,13 @@ function processTokens(tokens, mapText) {
|
|
|
1350
1621
|
];
|
|
1351
1622
|
});
|
|
1352
1623
|
}
|
|
1624
|
+
function compileDateExpression(format, onError) {
|
|
1625
|
+
if (/^::/.test(format)) {
|
|
1626
|
+
const tokens = parseDateTokens(format.substring(2));
|
|
1627
|
+
return getDateFormatOptions(tokens, void 0, onError);
|
|
1628
|
+
}
|
|
1629
|
+
return format;
|
|
1630
|
+
}
|
|
1353
1631
|
function compileMessage(message, mapText = (v) => v) {
|
|
1354
1632
|
try {
|
|
1355
1633
|
return processTokens((0, import_parser.parse)(message), mapText);
|
|
@@ -1357,11 +1635,11 @@ function compileMessage(message, mapText = (v) => v) {
|
|
|
1357
1635
|
console.error(`${e.message}
|
|
1358
1636
|
|
|
1359
1637
|
Message: ${message}`);
|
|
1360
|
-
return message;
|
|
1638
|
+
return [message];
|
|
1361
1639
|
}
|
|
1362
1640
|
}
|
|
1363
1641
|
|
|
1364
|
-
// node_modules/.pnpm/@lingui+core@
|
|
1642
|
+
// 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
|
|
1365
1643
|
var isString = (s) => typeof s === "string";
|
|
1366
1644
|
var isFunction = (f) => typeof f === "function";
|
|
1367
1645
|
var cache = /* @__PURE__ */ new Map();
|
|
@@ -1372,12 +1650,59 @@ function normalizeLocales(locales) {
|
|
|
1372
1650
|
}
|
|
1373
1651
|
function date(locales, value, format) {
|
|
1374
1652
|
const _locales = normalizeLocales(locales);
|
|
1653
|
+
if (!format) {
|
|
1654
|
+
format = "default";
|
|
1655
|
+
}
|
|
1656
|
+
let o;
|
|
1657
|
+
if (typeof format === "string") {
|
|
1658
|
+
o = {
|
|
1659
|
+
day: "numeric",
|
|
1660
|
+
month: "short",
|
|
1661
|
+
year: "numeric"
|
|
1662
|
+
};
|
|
1663
|
+
switch (format) {
|
|
1664
|
+
case "full":
|
|
1665
|
+
o.weekday = "long";
|
|
1666
|
+
case "long":
|
|
1667
|
+
o.month = "long";
|
|
1668
|
+
break;
|
|
1669
|
+
case "short":
|
|
1670
|
+
o.month = "numeric";
|
|
1671
|
+
break;
|
|
1672
|
+
}
|
|
1673
|
+
} else {
|
|
1674
|
+
o = format;
|
|
1675
|
+
}
|
|
1375
1676
|
const formatter = getMemoized(
|
|
1376
1677
|
() => cacheKey("date", _locales, format),
|
|
1377
|
-
() => new Intl.DateTimeFormat(_locales,
|
|
1678
|
+
() => new Intl.DateTimeFormat(_locales, o)
|
|
1378
1679
|
);
|
|
1379
1680
|
return formatter.format(isString(value) ? new Date(value) : value);
|
|
1380
1681
|
}
|
|
1682
|
+
function time(locales, value, format) {
|
|
1683
|
+
let o;
|
|
1684
|
+
if (!format) {
|
|
1685
|
+
format = "default";
|
|
1686
|
+
}
|
|
1687
|
+
if (typeof format === "string") {
|
|
1688
|
+
o = {
|
|
1689
|
+
second: "numeric",
|
|
1690
|
+
minute: "numeric",
|
|
1691
|
+
hour: "numeric"
|
|
1692
|
+
};
|
|
1693
|
+
switch (format) {
|
|
1694
|
+
case "full":
|
|
1695
|
+
case "long":
|
|
1696
|
+
o.timeZoneName = "short";
|
|
1697
|
+
break;
|
|
1698
|
+
case "short":
|
|
1699
|
+
delete o.second;
|
|
1700
|
+
}
|
|
1701
|
+
} else {
|
|
1702
|
+
o = format;
|
|
1703
|
+
}
|
|
1704
|
+
return date(locales, value, o);
|
|
1705
|
+
}
|
|
1381
1706
|
function number(locales, value, format) {
|
|
1382
1707
|
const _locales = normalizeLocales(locales);
|
|
1383
1708
|
const formatter = getMemoized(
|
|
@@ -1412,12 +1737,14 @@ function cacheKey(type, locales, options) {
|
|
|
1412
1737
|
const localeKey = locales.join("-");
|
|
1413
1738
|
return `${type}-${localeKey}-${JSON.stringify(options)}`;
|
|
1414
1739
|
}
|
|
1415
|
-
var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}
|
|
1740
|
+
var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/;
|
|
1416
1741
|
var OCTOTHORPE_PH = "%__lingui_octothorpe__%";
|
|
1417
1742
|
var getDefaultFormats = (locale, passedLocales, formats = {}) => {
|
|
1418
1743
|
const locales = passedLocales || locale;
|
|
1419
1744
|
const style = (format) => {
|
|
1420
|
-
|
|
1745
|
+
if (typeof format === "object")
|
|
1746
|
+
return format;
|
|
1747
|
+
return formats[format];
|
|
1421
1748
|
};
|
|
1422
1749
|
const replaceOctothorpe = (value, message) => {
|
|
1423
1750
|
const numberFormat = Object.keys(formats).length ? style("number") : void 0;
|
|
@@ -1436,8 +1763,13 @@ var getDefaultFormats = (locale, passedLocales, formats = {}) => {
|
|
|
1436
1763
|
return replaceOctothorpe(value - offset, message);
|
|
1437
1764
|
},
|
|
1438
1765
|
select: selectFormatter,
|
|
1439
|
-
number: (value, format) => number(
|
|
1440
|
-
|
|
1766
|
+
number: (value, format) => number(
|
|
1767
|
+
locales,
|
|
1768
|
+
value,
|
|
1769
|
+
style(format) || { style: format }
|
|
1770
|
+
),
|
|
1771
|
+
date: (value, format) => date(locales, value, style(format) || format),
|
|
1772
|
+
time: (value, format) => time(locales, value, style(format) || format)
|
|
1441
1773
|
};
|
|
1442
1774
|
};
|
|
1443
1775
|
var selectFormatter = (value, rules) => {
|
|
@@ -1486,10 +1818,10 @@ function interpolate(translation, locale, locales) {
|
|
|
1486
1818
|
};
|
|
1487
1819
|
const result = formatMessage(translation);
|
|
1488
1820
|
if (isString(result) && UNICODE_REGEX.test(result)) {
|
|
1489
|
-
return (0, import_unraw.unraw)(result
|
|
1821
|
+
return (0, import_unraw.unraw)(result);
|
|
1490
1822
|
}
|
|
1491
1823
|
if (isString(result))
|
|
1492
|
-
return result
|
|
1824
|
+
return result;
|
|
1493
1825
|
return result ? String(result) : "";
|
|
1494
1826
|
};
|
|
1495
1827
|
}
|
|
@@ -1544,7 +1876,11 @@ var I18n = class extends EventEmitter {
|
|
|
1544
1876
|
__publicField2(this, "_localeData", {});
|
|
1545
1877
|
__publicField2(this, "_messages", {});
|
|
1546
1878
|
__publicField2(this, "_missing");
|
|
1879
|
+
__publicField2(this, "_messageCompiler");
|
|
1547
1880
|
__publicField2(this, "t", this._.bind(this));
|
|
1881
|
+
if (true) {
|
|
1882
|
+
this.setMessagesCompiler(compileMessage);
|
|
1883
|
+
}
|
|
1548
1884
|
if (params.missing != null)
|
|
1549
1885
|
this._missing = params.missing;
|
|
1550
1886
|
if (params.messages != null)
|
|
@@ -1580,12 +1916,30 @@ var I18n = class extends EventEmitter {
|
|
|
1580
1916
|
Object.assign(maybeLocaleData, localeData);
|
|
1581
1917
|
}
|
|
1582
1918
|
}
|
|
1919
|
+
/**
|
|
1920
|
+
* Registers a `MessageCompiler` to enable the use of uncompiled catalogs at runtime.
|
|
1921
|
+
*
|
|
1922
|
+
* In production builds, the `MessageCompiler` is typically excluded to reduce bundle size.
|
|
1923
|
+
* By default, message catalogs should be precompiled during the build process. However,
|
|
1924
|
+
* if you need to compile catalogs at runtime, you can use this method to set a message compiler.
|
|
1925
|
+
*
|
|
1926
|
+
* Example usage:
|
|
1927
|
+
*
|
|
1928
|
+
* ```ts
|
|
1929
|
+
* import { compileMessage } from "@lingui/message-utils/compileMessage";
|
|
1930
|
+
*
|
|
1931
|
+
* i18n.setMessagesCompiler(compileMessage);
|
|
1932
|
+
* ```
|
|
1933
|
+
*/
|
|
1934
|
+
setMessagesCompiler(compiler) {
|
|
1935
|
+
this._messageCompiler = compiler;
|
|
1936
|
+
return this;
|
|
1937
|
+
}
|
|
1583
1938
|
/**
|
|
1584
1939
|
* @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
|
|
1585
1940
|
*/
|
|
1586
|
-
// @ts-ignore deprecated, so ignore the reported error
|
|
1587
1941
|
loadLocaleData(localeOrAllData, localeData) {
|
|
1588
|
-
if (
|
|
1942
|
+
if (typeof localeOrAllData === "string") {
|
|
1589
1943
|
this._loadLocaleData(localeOrAllData, localeData);
|
|
1590
1944
|
} else {
|
|
1591
1945
|
Object.keys(localeOrAllData).forEach(
|
|
@@ -1632,6 +1986,11 @@ var I18n = class extends EventEmitter {
|
|
|
1632
1986
|
this.emit("change");
|
|
1633
1987
|
}
|
|
1634
1988
|
_(id, values, options) {
|
|
1989
|
+
if (!this.locale) {
|
|
1990
|
+
throw new Error(
|
|
1991
|
+
"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."
|
|
1992
|
+
);
|
|
1993
|
+
}
|
|
1635
1994
|
let message = options == null ? void 0 : options.message;
|
|
1636
1995
|
if (!id) {
|
|
1637
1996
|
id = "";
|
|
@@ -1651,8 +2010,20 @@ var I18n = class extends EventEmitter {
|
|
|
1651
2010
|
this.emit("missing", { id, locale: this._locale });
|
|
1652
2011
|
}
|
|
1653
2012
|
let translation = messageForId || message || id;
|
|
1654
|
-
if (
|
|
1655
|
-
|
|
2013
|
+
if (isString(translation)) {
|
|
2014
|
+
if (this._messageCompiler) {
|
|
2015
|
+
translation = this._messageCompiler(translation);
|
|
2016
|
+
} else {
|
|
2017
|
+
console.warn(`Uncompiled message detected! Message:
|
|
2018
|
+
|
|
2019
|
+
> ${translation}
|
|
2020
|
+
|
|
2021
|
+
That means you use raw catalog or your catalog doesn't have a translation for the message and fallback was used.
|
|
2022
|
+
ICU features such as interpolation and plurals will not work properly for that message.
|
|
2023
|
+
|
|
2024
|
+
Please compile your catalog first.
|
|
2025
|
+
`);
|
|
2026
|
+
}
|
|
1656
2027
|
}
|
|
1657
2028
|
if (isString(translation) && UNICODE_REGEX.test(translation))
|
|
1658
2029
|
return JSON.parse(`"${translation}"`);
|
|
@@ -1676,12 +2047,12 @@ function setupI18n(params = {}) {
|
|
|
1676
2047
|
}
|
|
1677
2048
|
var i18n = setupI18n();
|
|
1678
2049
|
|
|
1679
|
-
// node_modules/.pnpm/@warp-ds+icons@2.
|
|
1680
|
-
var messages = JSON.parse('{"icon.title.chevron-down":"Nedoverpil"}');
|
|
1681
|
-
var messages2 = JSON.parse('{"icon.title.chevron-down":"Downward arrow"}');
|
|
1682
|
-
var messages3 = JSON.parse('{"icon.title.chevron-down":"Nuoli alasp\xE4in"}');
|
|
1683
|
-
var messages4 = JSON.parse('{"icon.title.chevron-down":"Pil nedad"}');
|
|
1684
|
-
var messages5 = JSON.parse('{"icon.title.chevron-down":"Pil ned"}');
|
|
2050
|
+
// node_modules/.pnpm/@warp-ds+icons@2.5.0_@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-_hyhbgchrkasknlbocfng7geeci/node_modules/@warp-ds/icons/dist/elements/chevron-down-16.js
|
|
2051
|
+
var messages = JSON.parse('{"icon.title.chevron-down":["Nedoverpil"]}');
|
|
2052
|
+
var messages2 = JSON.parse('{"icon.title.chevron-down":["Downward arrow"]}');
|
|
2053
|
+
var messages3 = JSON.parse('{"icon.title.chevron-down":["Nuoli alasp\xE4in"]}');
|
|
2054
|
+
var messages4 = JSON.parse('{"icon.title.chevron-down":["Pil nedad"]}');
|
|
2055
|
+
var messages5 = JSON.parse('{"icon.title.chevron-down":["Pil ned"]}');
|
|
1685
2056
|
var supportedLocales = ["en", "nb", "fi", "da", "sv"];
|
|
1686
2057
|
var defaultLocale2 = "en";
|
|
1687
2058
|
var detectByBrand = () => {
|
|
@@ -1768,14 +2139,14 @@ if (!customElements.get("w-icon-chevron-down-16")) {
|
|
|
1768
2139
|
customElements.define("w-icon-chevron-down-16", IconChevronDown16);
|
|
1769
2140
|
}
|
|
1770
2141
|
|
|
1771
|
-
// node_modules/.pnpm/@warp-ds+icons@2.
|
|
2142
|
+
// node_modules/.pnpm/@warp-ds+icons@2.5.0_@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-_hyhbgchrkasknlbocfng7geeci/node_modules/@warp-ds/icons/dist/elements/chevron-up-16.js
|
|
1772
2143
|
import { LitElement as LitElement2 } from "lit";
|
|
1773
2144
|
import { unsafeStatic as unsafeStatic2, html as html2 } from "lit/static-html.js";
|
|
1774
|
-
var messages6 = JSON.parse('{"icon.title.chevron-up":"Oppoverpil"}');
|
|
1775
|
-
var messages22 = JSON.parse('{"icon.title.chevron-up":"Upward arrow"}');
|
|
1776
|
-
var messages32 = JSON.parse('{"icon.title.chevron-up":"Nuoli yl\xF6sp\xE4in"}');
|
|
1777
|
-
var messages42 = JSON.parse('{"icon.title.chevron-up":"Pil opad"}');
|
|
1778
|
-
var messages52 = JSON.parse('{"icon.title.chevron-up":"Pil upp"}');
|
|
2145
|
+
var messages6 = JSON.parse('{"icon.title.chevron-up":["Oppoverpil"]}');
|
|
2146
|
+
var messages22 = JSON.parse('{"icon.title.chevron-up":["Upward arrow"]}');
|
|
2147
|
+
var messages32 = JSON.parse('{"icon.title.chevron-up":["Nuoli yl\xF6sp\xE4in"]}');
|
|
2148
|
+
var messages42 = JSON.parse('{"icon.title.chevron-up":["Pil opad"]}');
|
|
2149
|
+
var messages52 = JSON.parse('{"icon.title.chevron-up":["Pil upp"]}');
|
|
1779
2150
|
var supportedLocales2 = ["en", "nb", "fi", "da", "sv"];
|
|
1780
2151
|
var defaultLocale3 = "en";
|
|
1781
2152
|
var detectByBrand2 = () => {
|