@warp-ds/elements 2.1.1-next.1 → 2.1.1

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.
@@ -1032,7 +1032,7 @@ var r = function() {
1032
1032
  }, []).join(" ");
1033
1033
  };
1034
1034
 
1035
- // node_modules/.pnpm/@warp-ds+css@2.0.1_@warp-ds+uno@2.0.2_unocss@0.62.0_postcss@8.5.1_rollup@4.32.1_vite@5.3.3_@t_2s4pctzvx7cgxzqlrreqkg4h34/node_modules/@warp-ds/css/component-classes/index.js
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
1036
1036
  var box = {
1037
1037
  base: "group block relative break-words last-child:mb-0 p-16 rounded-8",
1038
1038
  // Relative here enables w-clickable
@@ -1313,15 +1313,273 @@ function kebabCaseAttributes(constructor) {
1313
1313
  };
1314
1314
  }
1315
1315
 
1316
- // node_modules/.pnpm/@warp-ds+icons@2.5.0-next.1/node_modules/@warp-ds/icons/dist/elements/chevron-down-16.js
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
1317
1317
  import { LitElement } from "lit";
1318
1318
  import { unsafeStatic, html } from "lit/static-html.js";
1319
1319
 
1320
- // node_modules/.pnpm/@lingui+core@5.1.2_@lingui+babel-plugin-lingui-macro@5.1.2_babel-plugin-macros@3.1.0_typescri_g2ngrxg2kfutsfck3yn2icllca/node_modules/@lingui/core/dist/index.mjs
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
1321
1321
  var import_unraw = __toESM(require_dist(), 1);
1322
1322
 
1323
- // node_modules/.pnpm/@lingui+message-utils@5.1.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1323
+ // node_modules/.pnpm/@lingui+message-utils@5.2.0/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1324
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
+ }
1325
1583
  function processTokens(tokens, mapText) {
1326
1584
  if (!tokens.filter((token) => token.type !== "content").length) {
1327
1585
  return tokens.map((token) => mapText(token.value));
@@ -1336,6 +1594,12 @@ function processTokens(tokens, mapText) {
1336
1594
  return [token.arg];
1337
1595
  } else if (token.type === "function") {
1338
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
+ }
1339
1603
  if (_param) {
1340
1604
  return [token.arg, token.key, _param.value.trim()];
1341
1605
  } else {
@@ -1357,6 +1621,13 @@ function processTokens(tokens, mapText) {
1357
1621
  ];
1358
1622
  });
1359
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
+ }
1360
1631
  function compileMessage(message, mapText = (v) => v) {
1361
1632
  try {
1362
1633
  return processTokens((0, import_parser.parse)(message), mapText);
@@ -1368,7 +1639,7 @@ Message: ${message}`);
1368
1639
  }
1369
1640
  }
1370
1641
 
1371
- // node_modules/.pnpm/@lingui+core@5.1.2_@lingui+babel-plugin-lingui-macro@5.1.2_babel-plugin-macros@3.1.0_typescri_g2ngrxg2kfutsfck3yn2icllca/node_modules/@lingui/core/dist/index.mjs
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
1372
1643
  var isString = (s) => typeof s === "string";
1373
1644
  var isFunction = (f) => typeof f === "function";
1374
1645
  var cache = /* @__PURE__ */ new Map();
@@ -1379,12 +1650,59 @@ function normalizeLocales(locales) {
1379
1650
  }
1380
1651
  function date(locales, value, format) {
1381
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
+ }
1382
1676
  const formatter = getMemoized(
1383
1677
  () => cacheKey("date", _locales, format),
1384
- () => new Intl.DateTimeFormat(_locales, format)
1678
+ () => new Intl.DateTimeFormat(_locales, o)
1385
1679
  );
1386
1680
  return formatter.format(isString(value) ? new Date(value) : value);
1387
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
+ }
1388
1706
  function number(locales, value, format) {
1389
1707
  const _locales = normalizeLocales(locales);
1390
1708
  const formatter = getMemoized(
@@ -1424,7 +1742,9 @@ var OCTOTHORPE_PH = "%__lingui_octothorpe__%";
1424
1742
  var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1425
1743
  const locales = passedLocales || locale;
1426
1744
  const style = (format) => {
1427
- return typeof format === "object" ? format : formats[format] || { style: format };
1745
+ if (typeof format === "object")
1746
+ return format;
1747
+ return formats[format];
1428
1748
  };
1429
1749
  const replaceOctothorpe = (value, message) => {
1430
1750
  const numberFormat = Object.keys(formats).length ? style("number") : void 0;
@@ -1443,8 +1763,13 @@ var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1443
1763
  return replaceOctothorpe(value - offset, message);
1444
1764
  },
1445
1765
  select: selectFormatter,
1446
- number: (value, format) => number(locales, value, style(format)),
1447
- date: (value, format) => date(locales, value, style(format))
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)
1448
1773
  };
1449
1774
  };
1450
1775
  var selectFormatter = (value, rules) => {
@@ -1493,10 +1818,10 @@ function interpolate(translation, locale, locales) {
1493
1818
  };
1494
1819
  const result = formatMessage(translation);
1495
1820
  if (isString(result) && UNICODE_REGEX.test(result)) {
1496
- return (0, import_unraw.unraw)(result.trim());
1821
+ return (0, import_unraw.unraw)(result);
1497
1822
  }
1498
1823
  if (isString(result))
1499
- return result.trim();
1824
+ return result;
1500
1825
  return result ? String(result) : "";
1501
1826
  };
1502
1827
  }
@@ -1613,9 +1938,8 @@ var I18n = class extends EventEmitter {
1613
1938
  /**
1614
1939
  * @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
1615
1940
  */
1616
- // @ts-ignore deprecated, so ignore the reported error
1617
1941
  loadLocaleData(localeOrAllData, localeData) {
1618
- if (localeData != null) {
1942
+ if (typeof localeOrAllData === "string") {
1619
1943
  this._loadLocaleData(localeOrAllData, localeData);
1620
1944
  } else {
1621
1945
  Object.keys(localeOrAllData).forEach(
@@ -1662,6 +1986,11 @@ var I18n = class extends EventEmitter {
1662
1986
  this.emit("change");
1663
1987
  }
1664
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
+ }
1665
1994
  let message = options == null ? void 0 : options.message;
1666
1995
  if (!id) {
1667
1996
  id = "";
@@ -1718,7 +2047,7 @@ function setupI18n(params = {}) {
1718
2047
  }
1719
2048
  var i18n = setupI18n();
1720
2049
 
1721
- // node_modules/.pnpm/@warp-ds+icons@2.5.0-next.1/node_modules/@warp-ds/icons/dist/elements/chevron-down-16.js
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
1722
2051
  var messages = JSON.parse('{"icon.title.chevron-down":["Nedoverpil"]}');
1723
2052
  var messages2 = JSON.parse('{"icon.title.chevron-down":["Downward arrow"]}');
1724
2053
  var messages3 = JSON.parse('{"icon.title.chevron-down":["Nuoli alasp\xE4in"]}');
@@ -1810,7 +2139,7 @@ if (!customElements.get("w-icon-chevron-down-16")) {
1810
2139
  customElements.define("w-icon-chevron-down-16", IconChevronDown16);
1811
2140
  }
1812
2141
 
1813
- // node_modules/.pnpm/@warp-ds+icons@2.5.0-next.1/node_modules/@warp-ds/icons/dist/elements/chevron-up-16.js
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
1814
2143
  import { LitElement as LitElement2 } from "lit";
1815
2144
  import { unsafeStatic as unsafeStatic2, html as html2 } from "lit/static-html.js";
1816
2145
  var messages6 = JSON.parse('{"icon.title.chevron-up":["Oppoverpil"]}');