@forsakringskassan/docs-live-example 2.3.0 → 2.4.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.
- package/README.md +4 -0
- package/dist/LiveExample.vue.d.ts +12 -2
- package/dist/cjs/index.js +71 -53
- package/dist/esm/index.js +72 -54
- package/dist/main.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -45,6 +45,10 @@ Om exemplet behöver spara ett värde (till exempel `v-model`) så skickas detta
|
|
|
45
45
|
|
|
46
46
|
Om exemplet behöver köra en metod så skickas detta in genom `livemethods`.
|
|
47
47
|
|
|
48
|
+
#### `forceSingleColumn` (optional)
|
|
49
|
+
|
|
50
|
+
Om exemplets exempelyta hindras av kontrollytan i den högra kolumnen går det att ange `forceSingleColumn` för att forcera exemplet att visas i en kolumn.
|
|
51
|
+
|
|
48
52
|
### Konfigurera exemplet
|
|
49
53
|
|
|
50
54
|
För att skapa ett konfigurerbart exempel börjar vi med att skapa en ny komponent `AwesomeComponentLiveExample.vue`.
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type PropType } from "vue";
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
2
4
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
5
|
/**
|
|
4
6
|
* Explicitly render example in given language.
|
|
@@ -38,11 +40,16 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
38
40
|
required: false;
|
|
39
41
|
default: () => {};
|
|
40
42
|
};
|
|
43
|
+
forceSingleColumn: {
|
|
44
|
+
type: BooleanConstructor;
|
|
45
|
+
required: false;
|
|
46
|
+
};
|
|
41
47
|
}>, {}, {
|
|
42
48
|
/** Language declared by parent element via `data-language`, if any */
|
|
43
49
|
parentLanguage: string;
|
|
44
50
|
exampleElement: HTMLElement | undefined;
|
|
45
51
|
}, {
|
|
52
|
+
containerClasses(): string[];
|
|
46
53
|
templateLanguage(): "vue" | "html";
|
|
47
54
|
}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
48
55
|
/**
|
|
@@ -83,11 +90,16 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
83
90
|
required: false;
|
|
84
91
|
default: () => {};
|
|
85
92
|
};
|
|
93
|
+
forceSingleColumn: {
|
|
94
|
+
type: BooleanConstructor;
|
|
95
|
+
required: false;
|
|
96
|
+
};
|
|
86
97
|
}>> & Readonly<{}>, {
|
|
87
98
|
language: "html" | "vue" | "auto";
|
|
88
99
|
components: Record<string, any>;
|
|
89
100
|
livedata: Record<string, any>;
|
|
90
101
|
livemethods: Record<string, any>;
|
|
102
|
+
forceSingleColumn: boolean;
|
|
91
103
|
}, {}, {
|
|
92
104
|
LiveExampleSourcecode: import("vue").DefineComponent<{
|
|
93
105
|
element: HTMLElement;
|
|
@@ -134,5 +146,3 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
134
146
|
};
|
|
135
147
|
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
136
148
|
}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
137
|
-
declare const _default: typeof __VLS_export;
|
|
138
|
-
export default _default;
|
package/dist/cjs/index.js
CHANGED
|
@@ -928,7 +928,7 @@ var require_core = __commonJS({
|
|
|
928
928
|
};
|
|
929
929
|
var escape = escapeHTML;
|
|
930
930
|
var inherit = inherit$1;
|
|
931
|
-
var NO_MATCH = Symbol("nomatch");
|
|
931
|
+
var NO_MATCH = /* @__PURE__ */ Symbol("nomatch");
|
|
932
932
|
var MAX_KEYWORD_HITS = 7;
|
|
933
933
|
var HLJS = function(hljs) {
|
|
934
934
|
const languages = /* @__PURE__ */ Object.create(null);
|
|
@@ -2289,6 +2289,10 @@ var LiveExample_default = (0, import_vue5.defineComponent)({
|
|
|
2289
2289
|
default: () => {
|
|
2290
2290
|
return {};
|
|
2291
2291
|
}
|
|
2292
|
+
},
|
|
2293
|
+
forceSingleColumn: {
|
|
2294
|
+
type: Boolean,
|
|
2295
|
+
required: false
|
|
2292
2296
|
}
|
|
2293
2297
|
},
|
|
2294
2298
|
data() {
|
|
@@ -2299,6 +2303,13 @@ var LiveExample_default = (0, import_vue5.defineComponent)({
|
|
|
2299
2303
|
};
|
|
2300
2304
|
},
|
|
2301
2305
|
computed: {
|
|
2306
|
+
containerClasses() {
|
|
2307
|
+
const classes = ["live-example__container"];
|
|
2308
|
+
if (this.forceSingleColumn) {
|
|
2309
|
+
classes.push("live-example__container--single-column");
|
|
2310
|
+
}
|
|
2311
|
+
return classes;
|
|
2312
|
+
},
|
|
2302
2313
|
templateLanguage() {
|
|
2303
2314
|
if (this.language !== "auto") {
|
|
2304
2315
|
return this.language;
|
|
@@ -2321,67 +2332,74 @@ var LiveExample_default = (0, import_vue5.defineComponent)({
|
|
|
2321
2332
|
|
|
2322
2333
|
// sfc-template:/home/runner/work/docs-live-example/docs-live-example/src/LiveExample.vue?type=template
|
|
2323
2334
|
var import_vue6 = require("vue");
|
|
2324
|
-
var _hoisted_14 = {
|
|
2325
|
-
var _hoisted_22 = {
|
|
2335
|
+
var _hoisted_14 = {
|
|
2326
2336
|
ref: "example",
|
|
2327
2337
|
class: "live-example__example user-background"
|
|
2328
2338
|
};
|
|
2329
|
-
var
|
|
2330
|
-
var
|
|
2331
|
-
var
|
|
2332
|
-
var
|
|
2333
|
-
var
|
|
2339
|
+
var _hoisted_22 = { key: 0 };
|
|
2340
|
+
var _hoisted_32 = ["innerHTML"];
|
|
2341
|
+
var _hoisted_42 = { key: 2 };
|
|
2342
|
+
var _hoisted_52 = { class: "live-example__controls" };
|
|
2343
|
+
var _hoisted_62 = {
|
|
2334
2344
|
key: 0,
|
|
2335
2345
|
class: "live-example__code"
|
|
2336
2346
|
};
|
|
2337
2347
|
function render2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2338
2348
|
const _component_live_vue_code = (0, import_vue6.resolveComponent)("live-vue-code");
|
|
2339
2349
|
const _component_live_example_sourcecode = (0, import_vue6.resolveComponent)("live-example-sourcecode");
|
|
2340
|
-
return (0, import_vue6.openBlock)(), (0, import_vue6.createElementBlock)(
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2350
|
+
return (0, import_vue6.openBlock)(), (0, import_vue6.createElementBlock)(
|
|
2351
|
+
"div",
|
|
2352
|
+
{
|
|
2353
|
+
class: (0, import_vue6.normalizeClass)(_ctx.containerClasses)
|
|
2354
|
+
},
|
|
2355
|
+
[
|
|
2356
|
+
(0, import_vue6.createElementVNode)(
|
|
2357
|
+
"div",
|
|
2358
|
+
_hoisted_14,
|
|
2359
|
+
[
|
|
2360
|
+
_ctx.templateLanguage === "vue" ? ((0, import_vue6.openBlock)(), (0, import_vue6.createElementBlock)("div", _hoisted_22, [
|
|
2361
|
+
(0, import_vue6.createVNode)(_component_live_vue_code, {
|
|
2362
|
+
components: _ctx.components,
|
|
2363
|
+
template: _ctx.template,
|
|
2364
|
+
livedata: _ctx.livedata,
|
|
2365
|
+
livemethods: _ctx.livemethods
|
|
2366
|
+
}, null, 8, ["components", "template", "livedata", "livemethods"])
|
|
2367
|
+
])) : _ctx.templateLanguage === "html" ? ((0, import_vue6.openBlock)(), (0, import_vue6.createElementBlock)(
|
|
2368
|
+
import_vue6.Fragment,
|
|
2369
|
+
{ key: 1 },
|
|
2370
|
+
[
|
|
2371
|
+
(0, import_vue6.createCommentVNode)(" eslint-disable-next-line vue/no-v-html -- expected to show rendered html "),
|
|
2372
|
+
(0, import_vue6.createElementVNode)("div", { innerHTML: _ctx.template }, null, 8, _hoisted_32)
|
|
2373
|
+
],
|
|
2374
|
+
2112
|
|
2375
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
2376
|
+
)) : ((0, import_vue6.openBlock)(), (0, import_vue6.createElementBlock)("div", _hoisted_42, [..._cache[0] || (_cache[0] = [
|
|
2377
|
+
(0, import_vue6.createElementVNode)(
|
|
2378
|
+
"pre",
|
|
2379
|
+
null,
|
|
2380
|
+
"Unknown language, cannot render example",
|
|
2381
|
+
-1
|
|
2382
|
+
/* CACHED */
|
|
2383
|
+
)
|
|
2384
|
+
])]))
|
|
2385
|
+
],
|
|
2386
|
+
512
|
|
2387
|
+
/* NEED_PATCH */
|
|
2388
|
+
),
|
|
2389
|
+
(0, import_vue6.createElementVNode)("div", _hoisted_52, [
|
|
2390
|
+
(0, import_vue6.renderSlot)(_ctx.$slots, "default")
|
|
2391
|
+
]),
|
|
2392
|
+
_ctx.exampleElement ? ((0, import_vue6.openBlock)(), (0, import_vue6.createElementBlock)("div", _hoisted_62, [
|
|
2393
|
+
(0, import_vue6.createVNode)(_component_live_example_sourcecode, {
|
|
2394
|
+
element: _ctx.exampleElement,
|
|
2395
|
+
template: _ctx.template,
|
|
2396
|
+
"template-language": _ctx.templateLanguage
|
|
2397
|
+
}, null, 8, ["element", "template", "template-language"])
|
|
2398
|
+
])) : (0, import_vue6.createCommentVNode)("v-if", true)
|
|
2399
|
+
],
|
|
2400
|
+
2
|
|
2401
|
+
/* CLASS */
|
|
2402
|
+
);
|
|
2385
2403
|
}
|
|
2386
2404
|
|
|
2387
2405
|
// src/LiveExample.vue
|
package/dist/esm/index.js
CHANGED
|
@@ -922,7 +922,7 @@ var require_core = __commonJS({
|
|
|
922
922
|
};
|
|
923
923
|
var escape = escapeHTML;
|
|
924
924
|
var inherit = inherit$1;
|
|
925
|
-
var NO_MATCH = Symbol("nomatch");
|
|
925
|
+
var NO_MATCH = /* @__PURE__ */ Symbol("nomatch");
|
|
926
926
|
var MAX_KEYWORD_HITS = 7;
|
|
927
927
|
var HLJS = function(hljs) {
|
|
928
928
|
const languages = /* @__PURE__ */ Object.create(null);
|
|
@@ -2275,6 +2275,10 @@ var LiveExample_default = defineComponent2({
|
|
|
2275
2275
|
default: () => {
|
|
2276
2276
|
return {};
|
|
2277
2277
|
}
|
|
2278
|
+
},
|
|
2279
|
+
forceSingleColumn: {
|
|
2280
|
+
type: Boolean,
|
|
2281
|
+
required: false
|
|
2278
2282
|
}
|
|
2279
2283
|
},
|
|
2280
2284
|
data() {
|
|
@@ -2285,6 +2289,13 @@ var LiveExample_default = defineComponent2({
|
|
|
2285
2289
|
};
|
|
2286
2290
|
},
|
|
2287
2291
|
computed: {
|
|
2292
|
+
containerClasses() {
|
|
2293
|
+
const classes = ["live-example__container"];
|
|
2294
|
+
if (this.forceSingleColumn) {
|
|
2295
|
+
classes.push("live-example__container--single-column");
|
|
2296
|
+
}
|
|
2297
|
+
return classes;
|
|
2298
|
+
},
|
|
2288
2299
|
templateLanguage() {
|
|
2289
2300
|
if (this.language !== "auto") {
|
|
2290
2301
|
return this.language;
|
|
@@ -2306,68 +2317,75 @@ var LiveExample_default = defineComponent2({
|
|
|
2306
2317
|
});
|
|
2307
2318
|
|
|
2308
2319
|
// sfc-template:/home/runner/work/docs-live-example/docs-live-example/src/LiveExample.vue?type=template
|
|
2309
|
-
import { resolveComponent as _resolveComponent, createVNode as _createVNode, openBlock as _openBlock2, createElementBlock as _createElementBlock2, createCommentVNode as _createCommentVNode2, createElementVNode as _createElementVNode2, Fragment as _Fragment2, renderSlot as _renderSlot } from "vue";
|
|
2310
|
-
var _hoisted_14 = {
|
|
2311
|
-
var _hoisted_22 = {
|
|
2320
|
+
import { resolveComponent as _resolveComponent, createVNode as _createVNode, openBlock as _openBlock2, createElementBlock as _createElementBlock2, createCommentVNode as _createCommentVNode2, createElementVNode as _createElementVNode2, Fragment as _Fragment2, renderSlot as _renderSlot, normalizeClass as _normalizeClass } from "vue";
|
|
2321
|
+
var _hoisted_14 = {
|
|
2312
2322
|
ref: "example",
|
|
2313
2323
|
class: "live-example__example user-background"
|
|
2314
2324
|
};
|
|
2315
|
-
var
|
|
2316
|
-
var
|
|
2317
|
-
var
|
|
2318
|
-
var
|
|
2319
|
-
var
|
|
2325
|
+
var _hoisted_22 = { key: 0 };
|
|
2326
|
+
var _hoisted_32 = ["innerHTML"];
|
|
2327
|
+
var _hoisted_42 = { key: 2 };
|
|
2328
|
+
var _hoisted_52 = { class: "live-example__controls" };
|
|
2329
|
+
var _hoisted_62 = {
|
|
2320
2330
|
key: 0,
|
|
2321
2331
|
class: "live-example__code"
|
|
2322
2332
|
};
|
|
2323
2333
|
function render2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2324
2334
|
const _component_live_vue_code = _resolveComponent("live-vue-code");
|
|
2325
2335
|
const _component_live_example_sourcecode = _resolveComponent("live-example-sourcecode");
|
|
2326
|
-
return _openBlock2(), _createElementBlock2(
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2336
|
+
return _openBlock2(), _createElementBlock2(
|
|
2337
|
+
"div",
|
|
2338
|
+
{
|
|
2339
|
+
class: _normalizeClass(_ctx.containerClasses)
|
|
2340
|
+
},
|
|
2341
|
+
[
|
|
2342
|
+
_createElementVNode2(
|
|
2343
|
+
"div",
|
|
2344
|
+
_hoisted_14,
|
|
2345
|
+
[
|
|
2346
|
+
_ctx.templateLanguage === "vue" ? (_openBlock2(), _createElementBlock2("div", _hoisted_22, [
|
|
2347
|
+
_createVNode(_component_live_vue_code, {
|
|
2348
|
+
components: _ctx.components,
|
|
2349
|
+
template: _ctx.template,
|
|
2350
|
+
livedata: _ctx.livedata,
|
|
2351
|
+
livemethods: _ctx.livemethods
|
|
2352
|
+
}, null, 8, ["components", "template", "livedata", "livemethods"])
|
|
2353
|
+
])) : _ctx.templateLanguage === "html" ? (_openBlock2(), _createElementBlock2(
|
|
2354
|
+
_Fragment2,
|
|
2355
|
+
{ key: 1 },
|
|
2356
|
+
[
|
|
2357
|
+
_createCommentVNode2(" eslint-disable-next-line vue/no-v-html -- expected to show rendered html "),
|
|
2358
|
+
_createElementVNode2("div", { innerHTML: _ctx.template }, null, 8, _hoisted_32)
|
|
2359
|
+
],
|
|
2360
|
+
2112
|
|
2361
|
+
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
|
|
2362
|
+
)) : (_openBlock2(), _createElementBlock2("div", _hoisted_42, [..._cache[0] || (_cache[0] = [
|
|
2363
|
+
_createElementVNode2(
|
|
2364
|
+
"pre",
|
|
2365
|
+
null,
|
|
2366
|
+
"Unknown language, cannot render example",
|
|
2367
|
+
-1
|
|
2368
|
+
/* CACHED */
|
|
2369
|
+
)
|
|
2370
|
+
])]))
|
|
2371
|
+
],
|
|
2372
|
+
512
|
|
2373
|
+
/* NEED_PATCH */
|
|
2374
|
+
),
|
|
2375
|
+
_createElementVNode2("div", _hoisted_52, [
|
|
2376
|
+
_renderSlot(_ctx.$slots, "default")
|
|
2377
|
+
]),
|
|
2378
|
+
_ctx.exampleElement ? (_openBlock2(), _createElementBlock2("div", _hoisted_62, [
|
|
2379
|
+
_createVNode(_component_live_example_sourcecode, {
|
|
2380
|
+
element: _ctx.exampleElement,
|
|
2381
|
+
template: _ctx.template,
|
|
2382
|
+
"template-language": _ctx.templateLanguage
|
|
2383
|
+
}, null, 8, ["element", "template", "template-language"])
|
|
2384
|
+
])) : _createCommentVNode2("v-if", true)
|
|
2385
|
+
],
|
|
2386
|
+
2
|
|
2387
|
+
/* CLASS */
|
|
2388
|
+
);
|
|
2371
2389
|
}
|
|
2372
2390
|
|
|
2373
2391
|
// src/LiveExample.vue
|
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
|
-
.live-example__container {
|
|
28
|
+
: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
|
}
|