@forsakringskassan/docs-live-example 1.5.6 → 2.1.0

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.
@@ -105,7 +105,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
105
105
  type: PropType<"vue" | "html">;
106
106
  required: true;
107
107
  };
108
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
108
+ }>, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
109
109
  element: {
110
110
  type: {
111
111
  new (): HTMLElement;
@@ -121,9 +121,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
121
121
  type: PropType<"vue" | "html">;
122
122
  required: true;
123
123
  };
124
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {
125
- expandable: HTMLDivElement;
126
- }, any>;
124
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
127
125
  LiveVueCode: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
128
126
  template: {
129
127
  type: StringConstructor;
@@ -15,7 +15,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
15
15
  type: PropType<"vue" | "html">;
16
16
  required: true;
17
17
  };
18
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
18
+ }>, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
19
19
  element: {
20
20
  type: {
21
21
  new (): HTMLElement;
@@ -31,7 +31,5 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
31
31
  type: PropType<"vue" | "html">;
32
32
  required: true;
33
33
  };
34
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {
35
- expandable: HTMLDivElement;
36
- }, any>;
34
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
37
35
  export default _default;
package/dist/cjs/index.js CHANGED
@@ -1721,8 +1721,8 @@ function generateId(template) {
1721
1721
  }
1722
1722
 
1723
1723
  // src/utils/highlight.ts
1724
- var import_standalone = __toESM(require("prettier/standalone"));
1725
- var import_parser_html = __toESM(require("prettier/parser-html"));
1724
+ var import_standalone = require("prettier/standalone");
1725
+ var import_html = __toESM(require("prettier/plugins/html"));
1726
1726
 
1727
1727
  // node_modules/highlight.js/es/core.js
1728
1728
  var import_core = __toESM(require_core(), 1);
@@ -1958,14 +1958,14 @@ function xml(hljs) {
1958
1958
  core_default.registerLanguage("html", xml);
1959
1959
  var prettierConfig = {
1960
1960
  parser: "html",
1961
- plugins: [import_parser_html.default],
1961
+ plugins: [import_html.default],
1962
1962
  singleQuote: false,
1963
1963
  arrowParens: "always",
1964
1964
  tabWidth: 4,
1965
1965
  printWidth: 80
1966
1966
  };
1967
1967
  async function highlight(code) {
1968
- const formatted = await import_standalone.default.format(code, prettierConfig);
1968
+ const formatted = await (0, import_standalone.format)(code, prettierConfig);
1969
1969
  const { value } = core_default.highlight(formatted, { language: "html" });
1970
1970
  return `<code class="hljs lang-html" tabindex="0">${value}</code>`;
1971
1971
  }
@@ -1988,6 +1988,14 @@ async function getSourceCode(options) {
1988
1988
  }
1989
1989
  }
1990
1990
 
1991
+ // src/utils/to-kebab-case.ts
1992
+ function toKebabCase(input) {
1993
+ return input.replace(
1994
+ /[A-Z]+(?![a-z])|[A-Z]/g,
1995
+ ($, ofs) => (ofs ? "-" : "") + $.toLowerCase()
1996
+ );
1997
+ }
1998
+
1991
1999
  // sfc-script:/home/runner/work/docs-live-example/docs-live-example/src/LiveExampleSourcecode.vue?type=script
1992
2000
  var LiveExampleSourcecode_default = /* @__PURE__ */ (0, import_vue.defineComponent)({
1993
2001
  __name: "LiveExampleSourcecode",
@@ -2110,7 +2118,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
2110
2118
  { class: "icon icon--code" },
2111
2119
  null,
2112
2120
  -1
2113
- /* HOISTED */
2121
+ /* CACHED */
2114
2122
  )),
2115
2123
  (0, import_vue3.createTextVNode)(
2116
2124
  " " + (0, import_vue3.toDisplayString)($setup.codeToggleText),
@@ -2132,7 +2140,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
2132
2140
  { class: "label fieldset__label" },
2133
2141
  "Kodspr\xE5k",
2134
2142
  -1
2135
- /* HOISTED */
2143
+ /* CACHED */
2136
2144
  )),
2137
2145
  (0, import_vue3.createElementVNode)("div", _hoisted_6, [
2138
2146
  $props.templateLanguage === "vue" ? ((0, import_vue3.openBlock)(), (0, import_vue3.createElementBlock)("div", _hoisted_7, [
@@ -2365,7 +2373,7 @@ function render2(_ctx, _cache, $props, $setup, $data, $options) {
2365
2373
  null,
2366
2374
  "Unknown language, cannot render example",
2367
2375
  -1
2368
- /* HOISTED */
2376
+ /* CACHED */
2369
2377
  )
2370
2378
  ])))
2371
2379
  ],
@@ -2455,7 +2463,9 @@ function serializeAttribute(key, value, prefix = "") {
2455
2463
  }
2456
2464
  function serializeAttributes(attrs) {
2457
2465
  const entries = Object.entries(attrs);
2458
- const kv = entries.map(([key, value]) => serializeAttribute(key, value));
2466
+ const kv = entries.map(
2467
+ ([key, value]) => serializeAttribute(toKebabCase(key), value)
2468
+ );
2459
2469
  const flat = kv.flat();
2460
2470
  if (flat.length > 0) {
2461
2471
  return ` ${kv.flat().join(" ")}`;
package/dist/esm/index.js CHANGED
@@ -1707,8 +1707,8 @@ function generateId(template) {
1707
1707
  }
1708
1708
 
1709
1709
  // src/utils/highlight.ts
1710
- import prettier from "prettier/standalone";
1711
- import htmlPlugin from "prettier/parser-html";
1710
+ import { format } from "prettier/standalone";
1711
+ import htmlPlugin from "prettier/plugins/html";
1712
1712
 
1713
1713
  // node_modules/highlight.js/es/core.js
1714
1714
  var import_core = __toESM(require_core(), 1);
@@ -1951,7 +1951,7 @@ var prettierConfig = {
1951
1951
  printWidth: 80
1952
1952
  };
1953
1953
  async function highlight(code) {
1954
- const formatted = await prettier.format(code, prettierConfig);
1954
+ const formatted = await format(code, prettierConfig);
1955
1955
  const { value } = core_default.highlight(formatted, { language: "html" });
1956
1956
  return `<code class="hljs lang-html" tabindex="0">${value}</code>`;
1957
1957
  }
@@ -1974,6 +1974,14 @@ async function getSourceCode(options) {
1974
1974
  }
1975
1975
  }
1976
1976
 
1977
+ // src/utils/to-kebab-case.ts
1978
+ function toKebabCase(input) {
1979
+ return input.replace(
1980
+ /[A-Z]+(?![a-z])|[A-Z]/g,
1981
+ ($, ofs) => (ofs ? "-" : "") + $.toLowerCase()
1982
+ );
1983
+ }
1984
+
1977
1985
  // sfc-script:/home/runner/work/docs-live-example/docs-live-example/src/LiveExampleSourcecode.vue?type=script
1978
1986
  var LiveExampleSourcecode_default = /* @__PURE__ */ _defineComponent({
1979
1987
  __name: "LiveExampleSourcecode",
@@ -2096,7 +2104,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
2096
2104
  { class: "icon icon--code" },
2097
2105
  null,
2098
2106
  -1
2099
- /* HOISTED */
2107
+ /* CACHED */
2100
2108
  )),
2101
2109
  _createTextVNode(
2102
2110
  " " + _toDisplayString($setup.codeToggleText),
@@ -2118,7 +2126,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
2118
2126
  { class: "label fieldset__label" },
2119
2127
  "Kodspr\xE5k",
2120
2128
  -1
2121
- /* HOISTED */
2129
+ /* CACHED */
2122
2130
  )),
2123
2131
  _createElementVNode("div", _hoisted_6, [
2124
2132
  $props.templateLanguage === "vue" ? (_openBlock(), _createElementBlock("div", _hoisted_7, [
@@ -2351,7 +2359,7 @@ function render2(_ctx, _cache, $props, $setup, $data, $options) {
2351
2359
  null,
2352
2360
  "Unknown language, cannot render example",
2353
2361
  -1
2354
- /* HOISTED */
2362
+ /* CACHED */
2355
2363
  )
2356
2364
  ])))
2357
2365
  ],
@@ -2441,7 +2449,9 @@ function serializeAttribute(key, value, prefix = "") {
2441
2449
  }
2442
2450
  function serializeAttributes(attrs) {
2443
2451
  const entries = Object.entries(attrs);
2444
- const kv = entries.map(([key, value]) => serializeAttribute(key, value));
2452
+ const kv = entries.map(
2453
+ ([key, value]) => serializeAttribute(toKebabCase(key), value)
2454
+ );
2445
2455
  const flat = kv.flat();
2446
2456
  if (flat.length > 0) {
2447
2457
  return ` ${kv.flat().join(" ")}`;
@@ -2,3 +2,4 @@ export { generateId } from "./generate-id";
2
2
  export { getSourceCode } from "./get-source-code";
3
3
  export { highlight } from "./highlight";
4
4
  export { stripComments } from "./strip-comments";
5
+ export { toKebabCase } from "./to-kebab-case";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export declare function toKebabCase(input: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forsakringskassan/docs-live-example",
3
- "version": "1.5.6",
3
+ "version": "2.1.0",
4
4
  "description": "Components used for live examples",
5
5
  "keywords": [
6
6
  "documentation"
@@ -35,7 +35,7 @@
35
35
  ],
36
36
  "peerDependencies": {
37
37
  "html-validate": ">= 7.9.0",
38
- "prettier": "^2.3 || ^3",
38
+ "prettier": "^3.0.0",
39
39
  "vue": "^3.4.15"
40
40
  },
41
41
  "peerDependenciesMeta": {