@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,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,7 +1026,7 @@ var r = function() {
1019
1026
  }, []).join(" ");
1020
1027
  };
1021
1028
 
1022
- // 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
1029
+ // 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
1023
1030
  var buttonDefaultStyling = "font-bold focusable justify-center transition-colors ease-in-out";
1024
1031
  var buttonColors = {
1025
1032
  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]",
@@ -1266,18 +1273,18 @@ var attention = {
1266
1273
  // packages/alert/index.js
1267
1274
  import WarpElement from "@warp-ds/elements-core";
1268
1275
 
1269
- // node_modules/.pnpm/@warp-ds+icons@2.4.0/node_modules/@warp-ds/icons/dist/elements/info-16.js
1276
+ // node_modules/.pnpm/@warp-ds+icons@2.5.0-next.1/node_modules/@warp-ds/icons/dist/elements/info-16.js
1270
1277
  import { LitElement } from "lit";
1271
1278
  import { unsafeStatic, html } from "lit/static-html.js";
1272
1279
 
1273
- // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1280
+ // 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
1274
1281
  var import_unraw = __toESM(require_dist(), 1);
1275
1282
 
1276
- // node_modules/.pnpm/@lingui+message-utils@4.11.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1283
+ // node_modules/.pnpm/@lingui+message-utils@5.1.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1277
1284
  var import_parser = __toESM(require_parser(), 1);
1278
1285
  function processTokens(tokens, mapText) {
1279
1286
  if (!tokens.filter((token) => token.type !== "content").length) {
1280
- return tokens.map((token) => mapText(token.value)).join("");
1287
+ return tokens.map((token) => mapText(token.value));
1281
1288
  }
1282
1289
  return tokens.map((token) => {
1283
1290
  var _a;
@@ -1317,11 +1324,11 @@ function compileMessage(message, mapText = (v) => v) {
1317
1324
  console.error(`${e.message}
1318
1325
 
1319
1326
  Message: ${message}`);
1320
- return message;
1327
+ return [message];
1321
1328
  }
1322
1329
  }
1323
1330
 
1324
- // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1331
+ // 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
1325
1332
  var isString = (s) => typeof s === "string";
1326
1333
  var isFunction = (f) => typeof f === "function";
1327
1334
  var cache = /* @__PURE__ */ new Map();
@@ -1372,7 +1379,7 @@ function cacheKey(type, locales, options) {
1372
1379
  const localeKey = locales.join("-");
1373
1380
  return `${type}-${localeKey}-${JSON.stringify(options)}`;
1374
1381
  }
1375
- var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;
1382
+ var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/;
1376
1383
  var OCTOTHORPE_PH = "%__lingui_octothorpe__%";
1377
1384
  var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1378
1385
  const locales = passedLocales || locale;
@@ -1504,7 +1511,11 @@ var I18n = class extends EventEmitter {
1504
1511
  __publicField2(this, "_localeData", {});
1505
1512
  __publicField2(this, "_messages", {});
1506
1513
  __publicField2(this, "_missing");
1514
+ __publicField2(this, "_messageCompiler");
1507
1515
  __publicField2(this, "t", this._.bind(this));
1516
+ if (true) {
1517
+ this.setMessagesCompiler(compileMessage);
1518
+ }
1508
1519
  if (params.missing != null)
1509
1520
  this._missing = params.missing;
1510
1521
  if (params.messages != null)
@@ -1540,6 +1551,25 @@ var I18n = class extends EventEmitter {
1540
1551
  Object.assign(maybeLocaleData, localeData);
1541
1552
  }
1542
1553
  }
1554
+ /**
1555
+ * Registers a `MessageCompiler` to enable the use of uncompiled catalogs at runtime.
1556
+ *
1557
+ * In production builds, the `MessageCompiler` is typically excluded to reduce bundle size.
1558
+ * By default, message catalogs should be precompiled during the build process. However,
1559
+ * if you need to compile catalogs at runtime, you can use this method to set a message compiler.
1560
+ *
1561
+ * Example usage:
1562
+ *
1563
+ * ```ts
1564
+ * import { compileMessage } from "@lingui/message-utils/compileMessage";
1565
+ *
1566
+ * i18n.setMessagesCompiler(compileMessage);
1567
+ * ```
1568
+ */
1569
+ setMessagesCompiler(compiler) {
1570
+ this._messageCompiler = compiler;
1571
+ return this;
1572
+ }
1543
1573
  /**
1544
1574
  * @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
1545
1575
  */
@@ -1611,8 +1641,20 @@ var I18n = class extends EventEmitter {
1611
1641
  this.emit("missing", { id, locale: this._locale });
1612
1642
  }
1613
1643
  let translation = messageForId || message || id;
1614
- if (true) {
1615
- translation = isString(translation) ? compileMessage(translation) : translation;
1644
+ if (isString(translation)) {
1645
+ if (this._messageCompiler) {
1646
+ translation = this._messageCompiler(translation);
1647
+ } else {
1648
+ console.warn(`Uncompiled message detected! Message:
1649
+
1650
+ > ${translation}
1651
+
1652
+ That means you use raw catalog or your catalog doesn't have a translation for the message and fallback was used.
1653
+ ICU features such as interpolation and plurals will not work properly for that message.
1654
+
1655
+ Please compile your catalog first.
1656
+ `);
1657
+ }
1616
1658
  }
1617
1659
  if (isString(translation) && UNICODE_REGEX.test(translation))
1618
1660
  return JSON.parse(`"${translation}"`);
@@ -1636,12 +1678,12 @@ function setupI18n(params = {}) {
1636
1678
  }
1637
1679
  var i18n = setupI18n();
1638
1680
 
1639
- // node_modules/.pnpm/@warp-ds+icons@2.4.0/node_modules/@warp-ds/icons/dist/elements/info-16.js
1640
- var messages = JSON.parse('{"icon.title.info":"Informasjonssirkel"}');
1641
- var messages2 = JSON.parse('{"icon.title.info":"Information circle"}');
1642
- var messages3 = JSON.parse('{"icon.title.info":"Ympyr\xE4, jonka sis\xE4ll\xE4 on i-kirjain"}');
1643
- var messages4 = JSON.parse('{"icon.title.info":"Informationscirkel"}');
1644
- var messages5 = JSON.parse('{"icon.title.info":"Informationscirkel"}');
1681
+ // node_modules/.pnpm/@warp-ds+icons@2.5.0-next.1/node_modules/@warp-ds/icons/dist/elements/info-16.js
1682
+ var messages = JSON.parse('{"icon.title.info":["Informasjonssirkel"]}');
1683
+ var messages2 = JSON.parse('{"icon.title.info":["Information circle"]}');
1684
+ var messages3 = JSON.parse('{"icon.title.info":["Ympyr\xE4, jonka sis\xE4ll\xE4 on i-kirjain"]}');
1685
+ var messages4 = JSON.parse('{"icon.title.info":["Informationscirkel"]}');
1686
+ var messages5 = JSON.parse('{"icon.title.info":["Informationscirkel"]}');
1645
1687
  var supportedLocales = ["en", "nb", "fi", "da", "sv"];
1646
1688
  var defaultLocale2 = "en";
1647
1689
  var detectByBrand = () => {
@@ -1728,14 +1770,14 @@ if (!customElements.get("w-icon-info-16")) {
1728
1770
  customElements.define("w-icon-info-16", IconInfo16);
1729
1771
  }
1730
1772
 
1731
- // node_modules/.pnpm/@warp-ds+icons@2.4.0/node_modules/@warp-ds/icons/dist/elements/warning-16.js
1773
+ // node_modules/.pnpm/@warp-ds+icons@2.5.0-next.1/node_modules/@warp-ds/icons/dist/elements/warning-16.js
1732
1774
  import { LitElement as LitElement2 } from "lit";
1733
1775
  import { unsafeStatic as unsafeStatic2, html as html2 } from "lit/static-html.js";
1734
- var messages6 = JSON.parse('{"icon.title.warning":"Varseltrekant med utropstegn"}');
1735
- var messages22 = JSON.parse('{"icon.title.warning":"Warning triangle with exclamation point"}');
1736
- var messages32 = JSON.parse('{"icon.title.warning":"Varoituskolmio, jonka sis\xE4ll\xE4 on huutomerkki"}');
1737
- var messages42 = JSON.parse('{"icon.title.warning":"Advarselstrekant med et udr\xE5bstegn"}');
1738
- var messages52 = JSON.parse('{"icon.title.warning":"Varningstriangel med utropstecken"}');
1776
+ var messages6 = JSON.parse('{"icon.title.warning":["Varseltrekant med utropstegn"]}');
1777
+ var messages22 = JSON.parse('{"icon.title.warning":["Warning triangle with exclamation point"]}');
1778
+ var messages32 = JSON.parse('{"icon.title.warning":["Varoituskolmio, jonka sis\xE4ll\xE4 on huutomerkki"]}');
1779
+ var messages42 = JSON.parse('{"icon.title.warning":["Advarselstrekant med et udr\xE5bstegn"]}');
1780
+ var messages52 = JSON.parse('{"icon.title.warning":["Varningstriangel med utropstecken"]}');
1739
1781
  var supportedLocales2 = ["en", "nb", "fi", "da", "sv"];
1740
1782
  var defaultLocale3 = "en";
1741
1783
  var detectByBrand2 = () => {
@@ -1822,14 +1864,14 @@ if (!customElements.get("w-icon-warning-16")) {
1822
1864
  customElements.define("w-icon-warning-16", IconWarning16);
1823
1865
  }
1824
1866
 
1825
- // node_modules/.pnpm/@warp-ds+icons@2.4.0/node_modules/@warp-ds/icons/dist/elements/error-16.js
1867
+ // node_modules/.pnpm/@warp-ds+icons@2.5.0-next.1/node_modules/@warp-ds/icons/dist/elements/error-16.js
1826
1868
  import { LitElement as LitElement3 } from "lit";
1827
1869
  import { unsafeStatic as unsafeStatic3, html as html3 } from "lit/static-html.js";
1828
- var messages7 = JSON.parse('{"icon.title.error":"\xC5ttekant med utropstegn"}');
1829
- var messages23 = JSON.parse('{"icon.title.error":"Octagon with exclamation point"}');
1830
- var messages33 = JSON.parse('{"icon.title.error":"Kahdeksankulmio, jonka sis\xE4ll\xE4 on huutomerkki"}');
1831
- var messages43 = JSON.parse('{"icon.title.error":"Ottekant med et udr\xE5bstegn"}');
1832
- var messages53 = JSON.parse('{"icon.title.error":"Oktagon med utropstecken"}');
1870
+ var messages7 = JSON.parse('{"icon.title.error":["\xC5ttekant med utropstegn"]}');
1871
+ var messages23 = JSON.parse('{"icon.title.error":["Octagon with exclamation point"]}');
1872
+ var messages33 = JSON.parse('{"icon.title.error":["Kahdeksankulmio, jonka sis\xE4ll\xE4 on huutomerkki"]}');
1873
+ var messages43 = JSON.parse('{"icon.title.error":["Ottekant med et udr\xE5bstegn"]}');
1874
+ var messages53 = JSON.parse('{"icon.title.error":["Oktagon med utropstecken"]}');
1833
1875
  var supportedLocales3 = ["en", "nb", "fi", "da", "sv"];
1834
1876
  var defaultLocale4 = "en";
1835
1877
  var detectByBrand3 = () => {
@@ -1916,14 +1958,14 @@ if (!customElements.get("w-icon-error-16")) {
1916
1958
  customElements.define("w-icon-error-16", IconError16);
1917
1959
  }
1918
1960
 
1919
- // node_modules/.pnpm/@warp-ds+icons@2.4.0/node_modules/@warp-ds/icons/dist/elements/success-16.js
1961
+ // node_modules/.pnpm/@warp-ds+icons@2.5.0-next.1/node_modules/@warp-ds/icons/dist/elements/success-16.js
1920
1962
  import { LitElement as LitElement4 } from "lit";
1921
1963
  import { unsafeStatic as unsafeStatic4, html as html4 } from "lit/static-html.js";
1922
- var messages8 = JSON.parse('{"icon.title.success":"Sirkel med sjekkmerke"}');
1923
- var messages24 = JSON.parse('{"icon.title.success":"Circle with checkmark"}');
1924
- var messages34 = JSON.parse('{"icon.title.success":"Ympyr\xE4, jonka sis\xE4ll\xE4 on valintamerkki"}');
1925
- var messages44 = JSON.parse('{"icon.title.success":"Cirkel med et flueben"}');
1926
- var messages54 = JSON.parse('{"icon.title.success":"Cirkel med bock"}');
1964
+ var messages8 = JSON.parse('{"icon.title.success":["Sirkel med sjekkmerke"]}');
1965
+ var messages24 = JSON.parse('{"icon.title.success":["Circle with checkmark"]}');
1966
+ var messages34 = JSON.parse('{"icon.title.success":["Ympyr\xE4, jonka sis\xE4ll\xE4 on valintamerkki"]}');
1967
+ var messages44 = JSON.parse('{"icon.title.success":["Cirkel med et flueben"]}');
1968
+ var messages54 = JSON.parse('{"icon.title.success":["Cirkel med bock"]}');
1927
1969
  var supportedLocales4 = ["en", "nb", "fi", "da", "sv"];
1928
1970
  var defaultLocale5 = "en";
1929
1971
  var detectByBrand4 = () => {