@forsakringskassan/docs-live-example 2.4.0 → 2.4.2

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.
package/dist/cjs/index.js CHANGED
@@ -1644,10 +1644,10 @@ function expandAnimation(element) {
1644
1644
  animation.onfinish = () => {
1645
1645
  onAnimationFinish(false);
1646
1646
  };
1647
- animation.oncancel = () => {
1647
+ animation.addEventListener("cancel", () => {
1648
1648
  element.classList.remove(ClassNames.COLLAPSING);
1649
1649
  isClosing = false;
1650
- };
1650
+ });
1651
1651
  }
1652
1652
  function open() {
1653
1653
  let currentHeight = 0;
@@ -1680,10 +1680,10 @@ function expandAnimation(element) {
1680
1680
  animation.onfinish = () => {
1681
1681
  onAnimationFinish(true);
1682
1682
  };
1683
- animation.oncancel = () => {
1683
+ animation.addEventListener("cancel", () => {
1684
1684
  element.classList.remove(ClassNames.EXPANDING);
1685
1685
  isExpanding = false;
1686
- };
1686
+ });
1687
1687
  }
1688
1688
  function onAnimationFinish(open2) {
1689
1689
  element.setAttribute("aria-expanded", open2 ? "true" : "false");
@@ -1709,9 +1709,10 @@ function cyrb53(str) {
1709
1709
  let h1 = 3735928559 ^ seed;
1710
1710
  let h2 = 1103547991 ^ seed;
1711
1711
  for (let i = 0, ch; i < str.length; i++) {
1712
- ch = str.charCodeAt(i);
1712
+ ch = str.codePointAt(i);
1713
1713
  h1 = Math.imul(h1 ^ ch, a);
1714
1714
  h2 = Math.imul(h2 ^ ch, b);
1715
+ i += ch > 65535 ? 2 : 1;
1715
1716
  }
1716
1717
  h1 = Math.imul(h1 ^ h1 >>> 16, c) ^ Math.imul(h2 ^ h2 >>> 13, d);
1717
1718
  h2 = Math.imul(h2 ^ h2 >>> 16, c) ^ Math.imul(h1 ^ h1 >>> 13, d);
@@ -1973,7 +1974,7 @@ async function highlight(code) {
1973
1974
  // src/utils/strip-comments.ts
1974
1975
  function stripComments(html) {
1975
1976
  const commentPattern = /<!--.*?-->/g;
1976
- return html.replace(commentPattern, "");
1977
+ return html.replaceAll(commentPattern, "");
1977
1978
  }
1978
1979
 
1979
1980
  // src/utils/get-source-code.ts
@@ -1990,7 +1991,7 @@ async function getSourceCode(options) {
1990
1991
 
1991
1992
  // src/utils/to-kebab-case.ts
1992
1993
  function toKebabCase(input) {
1993
- return input.replace(
1994
+ return input.replaceAll(
1994
1995
  /[A-Z]+(?![a-z])|[A-Z]/g,
1995
1996
  ($, ofs) => (ofs ? "-" : "") + $.toLowerCase()
1996
1997
  );
@@ -2099,14 +2100,14 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
2099
2100
  (0, import_vue3.createElementVNode)("div", _hoisted_1, [
2100
2101
  (0, import_vue3.createElementVNode)("button", {
2101
2102
  type: "button",
2102
- class: "button button--discrete",
2103
+ class: "code-preview__button",
2103
2104
  "aria-controls": $setup.id("code-expand"),
2104
2105
  "aria-expanded": $setup.animation.isOpen ? "true" : "false",
2105
2106
  onClick: $setup.onToggleCode
2106
2107
  }, [
2107
2108
  _cache[2] || (_cache[2] = (0, import_vue3.createElementVNode)(
2108
2109
  "i",
2109
- { class: "icon icon--code" },
2110
+ { class: "docs-icon icon--code" },
2110
2111
  null,
2111
2112
  -1
2112
2113
  /* CACHED */
@@ -2408,7 +2409,7 @@ LiveExample_default.__file = "src/LiveExample.vue";
2408
2409
  var LiveExample_default2 = LiveExample_default;
2409
2410
 
2410
2411
  // src/create-element.ts
2411
- var voidElements = [
2412
+ var voidElements = /* @__PURE__ */ new Set([
2412
2413
  "area",
2413
2414
  "base",
2414
2415
  "br",
@@ -2423,7 +2424,7 @@ var voidElements = [
2423
2424
  "source",
2424
2425
  "track",
2425
2426
  "wbr"
2426
- ];
2427
+ ]);
2427
2428
  function unpackArgs(args) {
2428
2429
  if (args.length === 0) {
2429
2430
  return { attributes: {}, children: [] };
@@ -2466,9 +2467,9 @@ function serializeAttribute(key, value, prefix = "") {
2466
2467
  if (typeof value === "boolean") {
2467
2468
  return value ? `${prefix}${key}` : [];
2468
2469
  }
2469
- return Object.entries(value).map(([nestedKey, value2]) => {
2470
+ return Object.entries(value).flatMap(([nestedKey, value2]) => {
2470
2471
  return serializeAttribute(nestedKey, value2, `${prefix}${key}-`);
2471
- }).flat().filter(Boolean);
2472
+ }).filter(Boolean);
2472
2473
  }
2473
2474
  function serializeAttributes(attrs) {
2474
2475
  const entries = Object.entries(attrs);
@@ -2485,7 +2486,7 @@ function serializeAttributes(attrs) {
2485
2486
  function createElement(tagName, ...args) {
2486
2487
  const { attributes, children } = unpackArgs(args);
2487
2488
  const attrs = serializeAttributes(attributes);
2488
- if (voidElements.includes(tagName)) {
2489
+ if (voidElements.has(tagName)) {
2489
2490
  return `<${tagName}${attrs}>`;
2490
2491
  } else {
2491
2492
  const content = serializeChildren(children);
package/dist/esm/index.js CHANGED
@@ -1630,10 +1630,10 @@ function expandAnimation(element) {
1630
1630
  animation.onfinish = () => {
1631
1631
  onAnimationFinish(false);
1632
1632
  };
1633
- animation.oncancel = () => {
1633
+ animation.addEventListener("cancel", () => {
1634
1634
  element.classList.remove(ClassNames.COLLAPSING);
1635
1635
  isClosing = false;
1636
- };
1636
+ });
1637
1637
  }
1638
1638
  function open() {
1639
1639
  let currentHeight = 0;
@@ -1666,10 +1666,10 @@ function expandAnimation(element) {
1666
1666
  animation.onfinish = () => {
1667
1667
  onAnimationFinish(true);
1668
1668
  };
1669
- animation.oncancel = () => {
1669
+ animation.addEventListener("cancel", () => {
1670
1670
  element.classList.remove(ClassNames.EXPANDING);
1671
1671
  isExpanding = false;
1672
- };
1672
+ });
1673
1673
  }
1674
1674
  function onAnimationFinish(open2) {
1675
1675
  element.setAttribute("aria-expanded", open2 ? "true" : "false");
@@ -1695,9 +1695,10 @@ function cyrb53(str) {
1695
1695
  let h1 = 3735928559 ^ seed;
1696
1696
  let h2 = 1103547991 ^ seed;
1697
1697
  for (let i = 0, ch; i < str.length; i++) {
1698
- ch = str.charCodeAt(i);
1698
+ ch = str.codePointAt(i);
1699
1699
  h1 = Math.imul(h1 ^ ch, a);
1700
1700
  h2 = Math.imul(h2 ^ ch, b);
1701
+ i += ch > 65535 ? 2 : 1;
1701
1702
  }
1702
1703
  h1 = Math.imul(h1 ^ h1 >>> 16, c) ^ Math.imul(h2 ^ h2 >>> 13, d);
1703
1704
  h2 = Math.imul(h2 ^ h2 >>> 16, c) ^ Math.imul(h1 ^ h1 >>> 13, d);
@@ -1959,7 +1960,7 @@ async function highlight(code) {
1959
1960
  // src/utils/strip-comments.ts
1960
1961
  function stripComments(html) {
1961
1962
  const commentPattern = /<!--.*?-->/g;
1962
- return html.replace(commentPattern, "");
1963
+ return html.replaceAll(commentPattern, "");
1963
1964
  }
1964
1965
 
1965
1966
  // src/utils/get-source-code.ts
@@ -1976,7 +1977,7 @@ async function getSourceCode(options) {
1976
1977
 
1977
1978
  // src/utils/to-kebab-case.ts
1978
1979
  function toKebabCase(input) {
1979
- return input.replace(
1980
+ return input.replaceAll(
1980
1981
  /[A-Z]+(?![a-z])|[A-Z]/g,
1981
1982
  ($, ofs) => (ofs ? "-" : "") + $.toLowerCase()
1982
1983
  );
@@ -2085,14 +2086,14 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
2085
2086
  _createElementVNode("div", _hoisted_1, [
2086
2087
  _createElementVNode("button", {
2087
2088
  type: "button",
2088
- class: "button button--discrete",
2089
+ class: "code-preview__button",
2089
2090
  "aria-controls": $setup.id("code-expand"),
2090
2091
  "aria-expanded": $setup.animation.isOpen ? "true" : "false",
2091
2092
  onClick: $setup.onToggleCode
2092
2093
  }, [
2093
2094
  _cache[2] || (_cache[2] = _createElementVNode(
2094
2095
  "i",
2095
- { class: "icon icon--code" },
2096
+ { class: "docs-icon icon--code" },
2096
2097
  null,
2097
2098
  -1
2098
2099
  /* CACHED */
@@ -2394,7 +2395,7 @@ LiveExample_default.__file = "src/LiveExample.vue";
2394
2395
  var LiveExample_default2 = LiveExample_default;
2395
2396
 
2396
2397
  // src/create-element.ts
2397
- var voidElements = [
2398
+ var voidElements = /* @__PURE__ */ new Set([
2398
2399
  "area",
2399
2400
  "base",
2400
2401
  "br",
@@ -2409,7 +2410,7 @@ var voidElements = [
2409
2410
  "source",
2410
2411
  "track",
2411
2412
  "wbr"
2412
- ];
2413
+ ]);
2413
2414
  function unpackArgs(args) {
2414
2415
  if (args.length === 0) {
2415
2416
  return { attributes: {}, children: [] };
@@ -2452,9 +2453,9 @@ function serializeAttribute(key, value, prefix = "") {
2452
2453
  if (typeof value === "boolean") {
2453
2454
  return value ? `${prefix}${key}` : [];
2454
2455
  }
2455
- return Object.entries(value).map(([nestedKey, value2]) => {
2456
+ return Object.entries(value).flatMap(([nestedKey, value2]) => {
2456
2457
  return serializeAttribute(nestedKey, value2, `${prefix}${key}-`);
2457
- }).flat().filter(Boolean);
2458
+ }).filter(Boolean);
2458
2459
  }
2459
2460
  function serializeAttributes(attrs) {
2460
2461
  const entries = Object.entries(attrs);
@@ -2471,7 +2472,7 @@ function serializeAttributes(attrs) {
2471
2472
  function createElement(tagName, ...args) {
2472
2473
  const { attributes, children } = unpackArgs(args);
2473
2474
  const attrs = serializeAttributes(attributes);
2474
- if (voidElements.includes(tagName)) {
2475
+ if (voidElements.has(tagName)) {
2475
2476
  return `<${tagName}${attrs}>`;
2476
2477
  } else {
2477
2478
  const content = serializeChildren(children);
package/dist/main.css CHANGED
@@ -25,7 +25,7 @@
25
25
  grid-template-areas: "example" "controls" "code";
26
26
  }
27
27
  @container example-container (width >= 43.0379746835rem) {
28
- :not(.live-example__container--single-column) {
28
+ .live-example__container:not(.live-example__container--single-column) {
29
29
  grid-template-columns: 1fr var(--live-example-controls-width);
30
30
  grid-template-areas: "example controls" "code code";
31
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forsakringskassan/docs-live-example",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "description": "Components used for live examples",
5
5
  "keywords": [
6
6
  "documentation"