@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.
@@ -726,9 +726,9 @@ var require_moo = __commonJS({
726
726
  }
727
727
  });
728
728
 
729
- // node_modules/.pnpm/@messageformat+parser@5.1.0/node_modules/@messageformat/parser/lib/lexer.js
729
+ // node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/lexer.js
730
730
  var require_lexer = __commonJS({
731
- "node_modules/.pnpm/@messageformat+parser@5.1.0/node_modules/@messageformat/parser/lib/lexer.js"(exports) {
731
+ "node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/lexer.js"(exports) {
732
732
  "use strict";
733
733
  var __importDefault = exports && exports.__importDefault || function(mod) {
734
734
  return mod && mod.__esModule ? mod : { "default": mod };
@@ -741,7 +741,7 @@ var require_lexer = __commonJS({
741
741
  doubleapos: { match: "''", value: () => "'" },
742
742
  quoted: {
743
743
  lineBreaks: true,
744
- match: /'[{}#](?:[^]*?[^'])?'(?!')/u,
744
+ match: /'[{}#](?:[^']|'')*'(?!')/u,
745
745
  value: (src) => src.slice(1, -1).replace(/''/g, "'")
746
746
  },
747
747
  argument: {
@@ -793,12 +793,13 @@ var require_lexer = __commonJS({
793
793
  }
794
794
  });
795
795
 
796
- // node_modules/.pnpm/@messageformat+parser@5.1.0/node_modules/@messageformat/parser/lib/parser.js
796
+ // node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/parser.js
797
797
  var require_parser = __commonJS({
798
- "node_modules/.pnpm/@messageformat+parser@5.1.0/node_modules/@messageformat/parser/lib/parser.js"(exports) {
798
+ "node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/parser.js"(exports) {
799
799
  "use strict";
800
800
  Object.defineProperty(exports, "__esModule", { value: true });
801
- exports.parse = exports.ParseError = void 0;
801
+ exports.ParseError = void 0;
802
+ exports.parse = parse2;
802
803
  var lexer_js_1 = require_lexer();
803
804
  var getContext = (lt) => ({
804
805
  offset: lt.offset,
@@ -864,8 +865,9 @@ var require_parser = __commonJS({
864
865
  }
865
866
  checkSelectKey(lt, type, key) {
866
867
  if (key[0] === "=") {
867
- if (type === "select")
868
+ if (type === "select") {
868
869
  throw new ParseError(lt, `The case ${key} is not valid with select`);
870
+ }
869
871
  } else if (type !== "select") {
870
872
  const keys = type === "plural" ? this.cardinalKeys : this.ordinalKeys;
871
873
  if (this.strictPluralKeys && keys.length > 0 && !keys.includes(key)) {
@@ -883,10 +885,12 @@ var require_parser = __commonJS({
883
885
  for (const lt of this.lexer) {
884
886
  switch (lt.type) {
885
887
  case "offset":
886
- if (type === "select")
888
+ if (type === "select") {
887
889
  throw new ParseError(lt, "Unexpected plural offset for select");
888
- if (sel.cases.length > 0)
890
+ }
891
+ if (sel.cases.length > 0) {
889
892
  throw new ParseError(lt, "Plural offset must be set before cases");
893
+ }
890
894
  sel.pluralOffset = Number(lt.value);
891
895
  ctx.text += lt.text;
892
896
  ctx.lineBreaks += lt.lineBreaks;
@@ -926,11 +930,13 @@ var require_parser = __commonJS({
926
930
  const end = this.lexer.next();
927
931
  if (!end)
928
932
  throw new ParseError(null, "Unexpected message end");
929
- if (end.type !== "end")
933
+ if (end.type !== "end") {
930
934
  throw new ParseError(end, `Unexpected lexer token: ${end.type}`);
935
+ }
931
936
  ctx.text += end.text;
932
- if (isSelectType(argType.value.toLowerCase()))
937
+ if (isSelectType(argType.value.toLowerCase())) {
933
938
  throw new ParseError(argType, `Invalid type identifier: ${argType.value}`);
939
+ }
934
940
  return {
935
941
  type: "function",
936
942
  arg: lt.value,
@@ -944,8 +950,9 @@ var require_parser = __commonJS({
944
950
  throw new ParseError(argType, msg);
945
951
  }
946
952
  let param = this.parseBody(this.strict ? false : inPlural);
947
- if (this.strict && param.length > 0)
953
+ if (this.strict && param.length > 0) {
948
954
  param = strictArgStyleParam(lt, param);
955
+ }
949
956
  return {
950
957
  type: "function",
951
958
  arg: lt.value,
@@ -955,10 +962,11 @@ var require_parser = __commonJS({
955
962
  };
956
963
  }
957
964
  case "select":
958
- if (isSelectType(argType.value))
965
+ if (isSelectType(argType.value)) {
959
966
  return this.parseSelect(lt, inPlural, ctx, argType.value);
960
- else
967
+ } else {
961
968
  throw new ParseError(argType, `Unexpected select type ${argType.value}`);
969
+ }
962
970
  default:
963
971
  throw new ParseError(argType, `Unexpected lexer token: ${argType.type}`);
964
972
  }
@@ -1005,7 +1013,6 @@ var require_parser = __commonJS({
1005
1013
  const parser = new Parser(src, options);
1006
1014
  return parser.parse();
1007
1015
  }
1008
- exports.parse = parse2;
1009
1016
  }
1010
1017
  });
1011
1018
 
@@ -1022,14 +1029,14 @@ var r = function() {
1022
1029
  }, []).join(" ");
1023
1030
  };
1024
1031
 
1025
- // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1032
+ // 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
1026
1033
  var import_unraw = __toESM(require_dist(), 1);
1027
1034
 
1028
- // node_modules/.pnpm/@lingui+message-utils@4.11.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1035
+ // node_modules/.pnpm/@lingui+message-utils@5.1.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1029
1036
  var import_parser = __toESM(require_parser(), 1);
1030
1037
  function processTokens(tokens, mapText) {
1031
1038
  if (!tokens.filter((token) => token.type !== "content").length) {
1032
- return tokens.map((token) => mapText(token.value)).join("");
1039
+ return tokens.map((token) => mapText(token.value));
1033
1040
  }
1034
1041
  return tokens.map((token) => {
1035
1042
  var _a;
@@ -1069,11 +1076,11 @@ function compileMessage(message, mapText = (v) => v) {
1069
1076
  console.error(`${e.message}
1070
1077
 
1071
1078
  Message: ${message}`);
1072
- return message;
1079
+ return [message];
1073
1080
  }
1074
1081
  }
1075
1082
 
1076
- // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1083
+ // 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
1077
1084
  var isString = (s) => typeof s === "string";
1078
1085
  var isFunction = (f) => typeof f === "function";
1079
1086
  var cache = /* @__PURE__ */ new Map();
@@ -1124,7 +1131,7 @@ function cacheKey(type, locales, options) {
1124
1131
  const localeKey = locales.join("-");
1125
1132
  return `${type}-${localeKey}-${JSON.stringify(options)}`;
1126
1133
  }
1127
- var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;
1134
+ var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/;
1128
1135
  var OCTOTHORPE_PH = "%__lingui_octothorpe__%";
1129
1136
  var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1130
1137
  const locales = passedLocales || locale;
@@ -1256,7 +1263,11 @@ var I18n = class extends EventEmitter {
1256
1263
  __publicField2(this, "_localeData", {});
1257
1264
  __publicField2(this, "_messages", {});
1258
1265
  __publicField2(this, "_missing");
1266
+ __publicField2(this, "_messageCompiler");
1259
1267
  __publicField2(this, "t", this._.bind(this));
1268
+ if (true) {
1269
+ this.setMessagesCompiler(compileMessage);
1270
+ }
1260
1271
  if (params.missing != null)
1261
1272
  this._missing = params.missing;
1262
1273
  if (params.messages != null)
@@ -1292,6 +1303,25 @@ var I18n = class extends EventEmitter {
1292
1303
  Object.assign(maybeLocaleData, localeData);
1293
1304
  }
1294
1305
  }
1306
+ /**
1307
+ * Registers a `MessageCompiler` to enable the use of uncompiled catalogs at runtime.
1308
+ *
1309
+ * In production builds, the `MessageCompiler` is typically excluded to reduce bundle size.
1310
+ * By default, message catalogs should be precompiled during the build process. However,
1311
+ * if you need to compile catalogs at runtime, you can use this method to set a message compiler.
1312
+ *
1313
+ * Example usage:
1314
+ *
1315
+ * ```ts
1316
+ * import { compileMessage } from "@lingui/message-utils/compileMessage";
1317
+ *
1318
+ * i18n.setMessagesCompiler(compileMessage);
1319
+ * ```
1320
+ */
1321
+ setMessagesCompiler(compiler) {
1322
+ this._messageCompiler = compiler;
1323
+ return this;
1324
+ }
1295
1325
  /**
1296
1326
  * @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
1297
1327
  */
@@ -1363,8 +1393,20 @@ var I18n = class extends EventEmitter {
1363
1393
  this.emit("missing", { id, locale: this._locale });
1364
1394
  }
1365
1395
  let translation = messageForId || message || id;
1366
- if (true) {
1367
- translation = isString(translation) ? compileMessage(translation) : translation;
1396
+ if (isString(translation)) {
1397
+ if (this._messageCompiler) {
1398
+ translation = this._messageCompiler(translation);
1399
+ } else {
1400
+ console.warn(`Uncompiled message detected! Message:
1401
+
1402
+ > ${translation}
1403
+
1404
+ That means you use raw catalog or your catalog doesn't have a translation for the message and fallback was used.
1405
+ ICU features such as interpolation and plurals will not work properly for that message.
1406
+
1407
+ Please compile your catalog first.
1408
+ `);
1409
+ }
1368
1410
  }
1369
1411
  if (isString(translation) && UNICODE_REGEX.test(translation))
1370
1412
  return JSON.parse(`"${translation}"`);
@@ -1388,7 +1430,7 @@ function setupI18n(params = {}) {
1388
1430
  }
1389
1431
  var i18n = setupI18n();
1390
1432
 
1391
- // 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
1433
+ // 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
1392
1434
  var buttonDefaultStyling = "font-bold focusable justify-center transition-colors ease-in-out";
1393
1435
  var buttonColors = {
1394
1436
  primary: "s-text-inverted bg-[--w-color-button-primary-background] hover:bg-[--w-color-button-primary-background-hover] active:bg-[--w-color-button-primary-background-active]",
@@ -1673,19 +1715,19 @@ function kebabCaseAttributes(constructor) {
1673
1715
  }
1674
1716
 
1675
1717
  // packages/button/locales/da/messages.mjs
1676
- var messages = JSON.parse('{"button.aria.loading":"Indl\xE6ser..."}');
1718
+ var messages = JSON.parse('{"button.aria.loading":["Indl\xE6ser..."]}');
1677
1719
 
1678
1720
  // packages/button/locales/en/messages.mjs
1679
- var messages2 = JSON.parse('{"button.aria.loading":"Loading..."}');
1721
+ var messages2 = JSON.parse('{"button.aria.loading":["Loading..."]}');
1680
1722
 
1681
1723
  // packages/button/locales/fi/messages.mjs
1682
- var messages3 = JSON.parse('{"button.aria.loading":"Ladataan..."}');
1724
+ var messages3 = JSON.parse('{"button.aria.loading":["Ladataan..."]}');
1683
1725
 
1684
1726
  // packages/button/locales/nb/messages.mjs
1685
- var messages4 = JSON.parse('{"button.aria.loading":"Laster..."}');
1727
+ var messages4 = JSON.parse('{"button.aria.loading":["Laster..."]}');
1686
1728
 
1687
1729
  // packages/button/locales/sv/messages.mjs
1688
- var messages5 = JSON.parse('{"button.aria.loading":"Laddar ..."}');
1730
+ var messages5 = JSON.parse('{"button.aria.loading":["Laddar ..."]}');
1689
1731
 
1690
1732
  // packages/button/index.js
1691
1733
  var buttonTypes2 = ["primary", "secondary", "negative", "utility", "pill", "link"];