@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 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
- 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,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,14 @@ var r = function() {
1019
1026
  }, []).join(" ");
1020
1027
  };
1021
1028
 
1022
- // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1029
+ // 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
1023
1030
  var import_unraw = __toESM(require_dist(), 1);
1024
1031
 
1025
- // node_modules/.pnpm/@lingui+message-utils@4.11.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1032
+ // node_modules/.pnpm/@lingui+message-utils@5.1.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1026
1033
  var import_parser = __toESM(require_parser(), 1);
1027
1034
  function processTokens(tokens, mapText) {
1028
1035
  if (!tokens.filter((token) => token.type !== "content").length) {
1029
- return tokens.map((token) => mapText(token.value)).join("");
1036
+ return tokens.map((token) => mapText(token.value));
1030
1037
  }
1031
1038
  return tokens.map((token) => {
1032
1039
  var _a;
@@ -1066,11 +1073,11 @@ function compileMessage(message, mapText = (v) => v) {
1066
1073
  console.error(`${e.message}
1067
1074
 
1068
1075
  Message: ${message}`);
1069
- return message;
1076
+ return [message];
1070
1077
  }
1071
1078
  }
1072
1079
 
1073
- // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1080
+ // 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
1074
1081
  var isString = (s) => typeof s === "string";
1075
1082
  var isFunction = (f) => typeof f === "function";
1076
1083
  var cache = /* @__PURE__ */ new Map();
@@ -1121,7 +1128,7 @@ function cacheKey(type, locales, options) {
1121
1128
  const localeKey = locales.join("-");
1122
1129
  return `${type}-${localeKey}-${JSON.stringify(options)}`;
1123
1130
  }
1124
- var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;
1131
+ var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/;
1125
1132
  var OCTOTHORPE_PH = "%__lingui_octothorpe__%";
1126
1133
  var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1127
1134
  const locales = passedLocales || locale;
@@ -1253,7 +1260,11 @@ var I18n = class extends EventEmitter {
1253
1260
  __publicField2(this, "_localeData", {});
1254
1261
  __publicField2(this, "_messages", {});
1255
1262
  __publicField2(this, "_missing");
1263
+ __publicField2(this, "_messageCompiler");
1256
1264
  __publicField2(this, "t", this._.bind(this));
1265
+ if (true) {
1266
+ this.setMessagesCompiler(compileMessage);
1267
+ }
1257
1268
  if (params.missing != null)
1258
1269
  this._missing = params.missing;
1259
1270
  if (params.messages != null)
@@ -1289,6 +1300,25 @@ var I18n = class extends EventEmitter {
1289
1300
  Object.assign(maybeLocaleData, localeData);
1290
1301
  }
1291
1302
  }
1303
+ /**
1304
+ * Registers a `MessageCompiler` to enable the use of uncompiled catalogs at runtime.
1305
+ *
1306
+ * In production builds, the `MessageCompiler` is typically excluded to reduce bundle size.
1307
+ * By default, message catalogs should be precompiled during the build process. However,
1308
+ * if you need to compile catalogs at runtime, you can use this method to set a message compiler.
1309
+ *
1310
+ * Example usage:
1311
+ *
1312
+ * ```ts
1313
+ * import { compileMessage } from "@lingui/message-utils/compileMessage";
1314
+ *
1315
+ * i18n.setMessagesCompiler(compileMessage);
1316
+ * ```
1317
+ */
1318
+ setMessagesCompiler(compiler) {
1319
+ this._messageCompiler = compiler;
1320
+ return this;
1321
+ }
1292
1322
  /**
1293
1323
  * @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
1294
1324
  */
@@ -1360,8 +1390,20 @@ var I18n = class extends EventEmitter {
1360
1390
  this.emit("missing", { id, locale: this._locale });
1361
1391
  }
1362
1392
  let translation = messageForId || message || id;
1363
- if (true) {
1364
- translation = isString(translation) ? compileMessage(translation) : translation;
1393
+ if (isString(translation)) {
1394
+ if (this._messageCompiler) {
1395
+ translation = this._messageCompiler(translation);
1396
+ } else {
1397
+ console.warn(`Uncompiled message detected! Message:
1398
+
1399
+ > ${translation}
1400
+
1401
+ That means you use raw catalog or your catalog doesn't have a translation for the message and fallback was used.
1402
+ ICU features such as interpolation and plurals will not work properly for that message.
1403
+
1404
+ Please compile your catalog first.
1405
+ `);
1406
+ }
1365
1407
  }
1366
1408
  if (isString(translation) && UNICODE_REGEX.test(translation))
1367
1409
  return JSON.parse(`"${translation}"`);
@@ -1385,7 +1427,7 @@ function setupI18n(params = {}) {
1385
1427
  }
1386
1428
  var i18n = setupI18n();
1387
1429
 
1388
- // 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
1430
+ // 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
1389
1431
  var card = {
1390
1432
  base: "cursor-pointer overflow-hidden relative transition-all",
1391
1433
  shadow: "group rounded-8 s-surface-elevated-200 hover:s-surface-elevated-200-hover active:s-surface-elevated-200-active",
@@ -1666,19 +1708,19 @@ var activateI18n = (enMessages, nbMessages, fiMessages, daMessages, svMessages)
1666
1708
  };
1667
1709
 
1668
1710
  // packages/card/locales/da/messages.mjs
1669
- var messages = JSON.parse('{"card.button.text":"V\xE6lg"}');
1711
+ var messages = JSON.parse('{"card.button.text":["V\xE6lg"]}');
1670
1712
 
1671
1713
  // packages/card/locales/en/messages.mjs
1672
- var messages2 = JSON.parse('{"card.button.text":"Select"}');
1714
+ var messages2 = JSON.parse('{"card.button.text":["Select"]}');
1673
1715
 
1674
1716
  // packages/card/locales/fi/messages.mjs
1675
- var messages3 = JSON.parse('{"card.button.text":"Valitse"}');
1717
+ var messages3 = JSON.parse('{"card.button.text":["Valitse"]}');
1676
1718
 
1677
1719
  // packages/card/locales/nb/messages.mjs
1678
- var messages4 = JSON.parse('{"card.button.text":"Velg"}');
1720
+ var messages4 = JSON.parse('{"card.button.text":["Velg"]}');
1679
1721
 
1680
1722
  // packages/card/locales/sv/messages.mjs
1681
- var messages5 = JSON.parse('{"card.button.text":"V\xE4lj"}');
1723
+ var messages5 = JSON.parse('{"card.button.text":["V\xE4lj"]}');
1682
1724
 
1683
1725
  // packages/card/index.js
1684
1726
  var keys = {