@warp-ds/elements 2.1.0 → 2.1.1-next.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.
@@ -723,9 +723,9 @@ var require_moo = __commonJS({
723
723
  }
724
724
  });
725
725
 
726
- // node_modules/.pnpm/@messageformat+parser@5.1.0/node_modules/@messageformat/parser/lib/lexer.js
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.0/node_modules/@messageformat/parser/lib/lexer.js"(exports) {
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: /'[{}#](?:[^]*?[^'])?'(?!')/u,
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.0/node_modules/@messageformat/parser/lib/parser.js
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.0/node_modules/@messageformat/parser/lib/parser.js"(exports) {
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.parse = exports.ParseError = void 0;
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 keys = type === "plural" ? this.cardinalKeys : this.ordinalKeys;
868
870
  if (this.strictPluralKeys && keys.length > 0 && !keys.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
- if (sel.cases.length > 0)
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,22 +1010,21 @@ 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
 
1009
- // node_modules/.pnpm/@warp-ds+icons@2.4.0/node_modules/@warp-ds/icons/dist/elements/close-16.js
1016
+ // node_modules/.pnpm/@warp-ds+icons@2.5.0-next.1/node_modules/@warp-ds/icons/dist/elements/close-16.js
1010
1017
  import { LitElement } from "lit";
1011
1018
  import { unsafeStatic, html } from "lit/static-html.js";
1012
1019
 
1013
- // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1020
+ // 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
1014
1021
  var import_unraw = __toESM(require_dist(), 1);
1015
1022
 
1016
- // node_modules/.pnpm/@lingui+message-utils@4.11.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1023
+ // node_modules/.pnpm/@lingui+message-utils@5.1.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1017
1024
  var import_parser = __toESM(require_parser(), 1);
1018
1025
  function processTokens(tokens, mapText) {
1019
1026
  if (!tokens.filter((token) => token.type !== "content").length) {
1020
- return tokens.map((token) => mapText(token.value)).join("");
1027
+ return tokens.map((token) => mapText(token.value));
1021
1028
  }
1022
1029
  return tokens.map((token) => {
1023
1030
  var _a;
@@ -1057,11 +1064,11 @@ function compileMessage(message, mapText = (v) => v) {
1057
1064
  console.error(`${e.message}
1058
1065
 
1059
1066
  Message: ${message}`);
1060
- return message;
1067
+ return [message];
1061
1068
  }
1062
1069
  }
1063
1070
 
1064
- // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1071
+ // 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
1065
1072
  var isString = (s) => typeof s === "string";
1066
1073
  var isFunction = (f) => typeof f === "function";
1067
1074
  var cache = /* @__PURE__ */ new Map();
@@ -1112,7 +1119,7 @@ function cacheKey(type, locales, options) {
1112
1119
  const localeKey = locales.join("-");
1113
1120
  return `${type}-${localeKey}-${JSON.stringify(options)}`;
1114
1121
  }
1115
- var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;
1122
+ var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/;
1116
1123
  var OCTOTHORPE_PH = "%__lingui_octothorpe__%";
1117
1124
  var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1118
1125
  const locales = passedLocales || locale;
@@ -1244,7 +1251,11 @@ var I18n = class extends EventEmitter {
1244
1251
  __publicField2(this, "_localeData", {});
1245
1252
  __publicField2(this, "_messages", {});
1246
1253
  __publicField2(this, "_missing");
1254
+ __publicField2(this, "_messageCompiler");
1247
1255
  __publicField2(this, "t", this._.bind(this));
1256
+ if (true) {
1257
+ this.setMessagesCompiler(compileMessage);
1258
+ }
1248
1259
  if (params.missing != null)
1249
1260
  this._missing = params.missing;
1250
1261
  if (params.messages != null)
@@ -1280,6 +1291,25 @@ var I18n = class extends EventEmitter {
1280
1291
  Object.assign(maybeLocaleData, localeData);
1281
1292
  }
1282
1293
  }
1294
+ /**
1295
+ * Registers a `MessageCompiler` to enable the use of uncompiled catalogs at runtime.
1296
+ *
1297
+ * In production builds, the `MessageCompiler` is typically excluded to reduce bundle size.
1298
+ * By default, message catalogs should be precompiled during the build process. However,
1299
+ * if you need to compile catalogs at runtime, you can use this method to set a message compiler.
1300
+ *
1301
+ * Example usage:
1302
+ *
1303
+ * ```ts
1304
+ * import { compileMessage } from "@lingui/message-utils/compileMessage";
1305
+ *
1306
+ * i18n.setMessagesCompiler(compileMessage);
1307
+ * ```
1308
+ */
1309
+ setMessagesCompiler(compiler) {
1310
+ this._messageCompiler = compiler;
1311
+ return this;
1312
+ }
1283
1313
  /**
1284
1314
  * @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
1285
1315
  */
@@ -1351,8 +1381,20 @@ var I18n = class extends EventEmitter {
1351
1381
  this.emit("missing", { id, locale: this._locale });
1352
1382
  }
1353
1383
  let translation = messageForId || message || id;
1354
- if (true) {
1355
- translation = isString(translation) ? compileMessage(translation) : translation;
1384
+ if (isString(translation)) {
1385
+ if (this._messageCompiler) {
1386
+ translation = this._messageCompiler(translation);
1387
+ } else {
1388
+ console.warn(`Uncompiled message detected! Message:
1389
+
1390
+ > ${translation}
1391
+
1392
+ That means you use raw catalog or your catalog doesn't have a translation for the message and fallback was used.
1393
+ ICU features such as interpolation and plurals will not work properly for that message.
1394
+
1395
+ Please compile your catalog first.
1396
+ `);
1397
+ }
1356
1398
  }
1357
1399
  if (isString(translation) && UNICODE_REGEX.test(translation))
1358
1400
  return JSON.parse(`"${translation}"`);
@@ -1376,12 +1418,12 @@ function setupI18n(params = {}) {
1376
1418
  }
1377
1419
  var i18n = setupI18n();
1378
1420
 
1379
- // node_modules/.pnpm/@warp-ds+icons@2.4.0/node_modules/@warp-ds/icons/dist/elements/close-16.js
1380
- var messages = JSON.parse('{"icon.title.close":"Kryss"}');
1381
- var messages2 = JSON.parse('{"icon.title.close":"Cross"}');
1382
- var messages3 = JSON.parse('{"icon.title.close":"Rasti"}');
1383
- var messages4 = JSON.parse('{"icon.title.close":"Kryds"}');
1384
- var messages5 = JSON.parse('{"icon.title.close":"Kryss"}');
1421
+ // node_modules/.pnpm/@warp-ds+icons@2.5.0-next.1/node_modules/@warp-ds/icons/dist/elements/close-16.js
1422
+ var messages = JSON.parse('{"icon.title.close":["Kryss"]}');
1423
+ var messages2 = JSON.parse('{"icon.title.close":["Cross"]}');
1424
+ var messages3 = JSON.parse('{"icon.title.close":["Rasti"]}');
1425
+ var messages4 = JSON.parse('{"icon.title.close":["Kryds"]}');
1426
+ var messages5 = JSON.parse('{"icon.title.close":["Kryss"]}');
1385
1427
  var supportedLocales = ["en", "nb", "fi", "da", "sv"];
1386
1428
  var defaultLocale2 = "en";
1387
1429
  var detectByBrand = () => {
@@ -1481,7 +1523,7 @@ var r = function() {
1481
1523
  }, []).join(" ");
1482
1524
  };
1483
1525
 
1484
- // node_modules/.pnpm/@warp-ds+css@2.0.0_@warp-ds+uno@2.0.0_unocss@0.62.0_postcss@8.4.41_rollup@4.20.0_vite@5.3.3_@_vyiy5vwpqfzwy5hpmfkwp3zmle/node_modules/@warp-ds/css/component-classes/index.js
1526
+ // 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
1485
1527
  var pill = {
1486
1528
  wrapper: "flex items-center",
1487
1529
  button: "inline-flex items-center focusable text-xs transition-all",
@@ -1777,19 +1819,19 @@ function kebabCaseAttributes(constructor) {
1777
1819
  }
1778
1820
 
1779
1821
  // packages/pill/locales/da/messages.mjs
1780
- var messages6 = JSON.parse('{"pill.aria.openFilter":"\xC5bn filter","pill.aria.removeFilter":["Fjern filter ",["label"]]}');
1822
+ var messages6 = JSON.parse('{"pill.aria.openFilter":["\xC5bn filter"],"pill.aria.removeFilter":["Fjern filter ",["label"]]}');
1781
1823
 
1782
1824
  // packages/pill/locales/en/messages.mjs
1783
- var messages7 = JSON.parse('{"pill.aria.openFilter":"Open filter","pill.aria.removeFilter":["Remove filter ",["label"]]}');
1825
+ var messages7 = JSON.parse('{"pill.aria.openFilter":["Open filter"],"pill.aria.removeFilter":["Remove filter ",["label"]]}');
1784
1826
 
1785
1827
  // packages/pill/locales/fi/messages.mjs
1786
- var messages8 = JSON.parse('{"pill.aria.openFilter":"Avaa suodatin","pill.aria.removeFilter":["Tyhjenn\xE4 suodatin ",["label"]]}');
1828
+ var messages8 = JSON.parse('{"pill.aria.openFilter":["Avaa suodatin"],"pill.aria.removeFilter":["Tyhjenn\xE4 suodatin ",["label"]]}');
1787
1829
 
1788
1830
  // packages/pill/locales/nb/messages.mjs
1789
- var messages9 = JSON.parse('{"pill.aria.openFilter":"\xC5pne filter","pill.aria.removeFilter":["Fjern filter ",["label"]]}');
1831
+ var messages9 = JSON.parse('{"pill.aria.openFilter":["\xC5pne filter"],"pill.aria.removeFilter":["Fjern filter ",["label"]]}');
1790
1832
 
1791
1833
  // packages/pill/locales/sv/messages.mjs
1792
- var messages10 = JSON.parse('{"pill.aria.openFilter":"\xD6ppna filter","pill.aria.removeFilter":["Ta bort filtret ",["label"]]}');
1834
+ var messages10 = JSON.parse('{"pill.aria.openFilter":["\xD6ppna filter"],"pill.aria.removeFilter":["Ta bort filtret ",["label"]]}');
1793
1835
 
1794
1836
  // packages/pill/index.js
1795
1837
  var WarpPill = class extends kebabCaseAttributes(WarpElement) {