@forsakringskassan/docs-live-example 2.0.0 → 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;
@@ -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;
package/dist/cjs/index.js CHANGED
@@ -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
@@ -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": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Components used for live examples",
5
5
  "keywords": [
6
6
  "documentation"