@rinova/playground 0.1.4 → 0.5.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 +23 -6
- package/dist/PlaygroundRoot-Bcq7hG6m.js +4114 -0
- package/dist/bash-DXbFn1Mw.js +2 -0
- package/dist/diff-BbCHXb9k.js +2 -0
- package/dist/html-BheHDAwJ.js +10 -0
- package/dist/index.js +646 -5
- package/dist/less-DcFvX2iI.js +2 -0
- package/dist/light-plus-DuoQWI9Q.js +3 -0
- package/dist/markdown-qYHfSPvL.js +2 -0
- package/dist/marked.esm-CNYX-ybC.js +1796 -0
- package/dist/{App-BzlvncHB.js → plugin-S72dg7Tb.js} +560 -1608
- package/dist/style.css +2880 -9004
- package/dist/tokyo-night-A7e3DMsQ.js +3 -0
- package/dist/types/app/App.vue.d.ts +1 -0
- package/dist/types/app/PlaygroundApiTable.vue.d.ts +16 -0
- package/dist/types/app/PlaygroundEditorPicker.vue.d.ts +3 -0
- package/dist/types/app/PlaygroundModuleApi.vue.d.ts +17 -0
- package/dist/types/app/PlaygroundPage.vue.d.ts +30 -0
- package/dist/types/app/{PlaygroundSourcePanel.vue.d.ts → PlaygroundPageIndex.vue.d.ts} +4 -4
- package/dist/types/app/PlaygroundPluginPanel.vue.d.ts +3 -0
- package/dist/types/app/PlaygroundPluginSlot.vue.d.ts +12 -0
- package/dist/types/app/PlaygroundPluginWrappers.vue.d.ts +25 -0
- package/dist/types/app/PlaygroundRoot.vue.d.ts +4 -0
- package/dist/types/app/{PlaygroundParamsPanel.vue.d.ts → PlaygroundSceneArgs.vue.d.ts} +1 -1
- package/dist/types/app/PlaygroundSceneOutput.vue.d.ts +6 -0
- package/dist/types/app/PlaygroundSceneSection.vue.d.ts +16 -0
- package/dist/types/app/{PlaygroundStage.vue.d.ts → PlaygroundSceneSource.vue.d.ts} +0 -1
- package/dist/types/app/PlaygroundSidebar.vue.d.ts +19 -8
- package/dist/types/app/viewport.d.ts +39 -0
- package/dist/types/code/CodeBlock.vue.d.ts +19 -1
- package/dist/types/code/clipboard.d.ts +2 -0
- package/dist/types/code/find.d.ts +42 -0
- package/dist/types/code/highlighter.d.ts +9 -2
- package/dist/types/code/openInEditor.d.ts +35 -0
- package/dist/types/components/PwApiBrief.vue.d.ts +16 -0
- package/dist/types/components/PwButton.vue.d.ts +2 -2
- package/dist/types/components/PwDemo.vue.d.ts +39 -0
- package/dist/types/components/PwDemoGrid.vue.d.ts +32 -0
- package/dist/types/components/PwInput.vue.d.ts +8 -8
- package/dist/types/components/PwSceneBoundary.vue.d.ts +20 -0
- package/dist/types/components/PwSceneNote.vue.d.ts +19 -0
- package/dist/types/components/PwTooltip.vue.d.ts +3 -0
- package/dist/types/components/prose/PwCallout.vue.d.ts +24 -0
- package/dist/types/components/prose/PwMarkdown.vue.d.ts +11 -0
- package/dist/types/components/prose/PwProse.vue.d.ts +27 -0
- package/dist/types/components/prose/PwStep.vue.d.ts +27 -0
- package/dist/types/components/prose/PwSteps.vue.d.ts +26 -0
- package/dist/types/components/prose/enhance.d.ts +4 -0
- package/dist/types/components/prose/index.d.ts +7 -0
- package/dist/types/components/prose/markdown-scene.d.ts +10 -0
- package/dist/types/components/prose/parse.d.ts +20 -0
- package/dist/types/components/prose/render.d.ts +22 -0
- package/dist/types/components/scene.d.ts +5 -0
- package/dist/types/config.d.ts +43 -5
- package/dist/types/index.d.ts +15 -8
- package/dist/types/module-api.d.ts +55 -0
- package/dist/types/payload/args.d.ts +22 -3
- package/dist/types/payload/context.d.ts +3 -0
- package/dist/types/payload/output.d.ts +18 -3
- package/dist/types/plugin.d.ts +119 -0
- package/dist/types/scene-meta.d.ts +38 -3
- package/dist/types/shims.d.ts +26 -5
- package/dist/types/types.d.ts +107 -15
- package/dist/vue-B_A2yz16.js +30 -0
- package/dist/yaml-CoEYOy4X.js +2 -0
- package/package.json +3 -4
- package/dist/assets/editor.worker-G4Kxf7Y6.js +0 -15827
- package/dist/assets/ts.worker-Dee0cZZb.js +0 -164076
- package/dist/dist-CiAXGmAo.js +0 -151
- package/dist/editor.api-6f2aPN2V.js +0 -126730
- package/dist/editor.worker-VDFPHiZj.js +0 -5
- package/dist/monaco.contribution-jrnupplv.js +0 -220
- package/dist/output-Dx3ubog9.js +0 -51
- package/dist/ts.worker-CpQm_d0w.js +0 -5
- package/dist/tsMode-C6DRwdZC.js +0 -52173
- package/dist/types/app/PlaygroundToolbar.vue.d.ts +0 -22
- package/dist/types/code/CodeEditor.vue.d.ts +0 -18
- package/dist/types/code/monaco.d.ts +0 -6
- package/dist/vitesse-dark-B9O9KI0c.js +0 -3
- package/dist/vitesse-light-Cs2DYTIe.js +0 -3
- package/dist/vue-tjAT-6a9.js +0 -36
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Fragment, Teleport, TransitionGroup, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, h, inject, normalizeClass, onBeforeUnmount, onMounted, openBlock, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, unref, watch, watchEffect, withCtx } from "vue";
|
|
3
|
-
import config from "virtual:playground/config";
|
|
4
|
-
import { scenes } from "virtual:playground/scenes";
|
|
1
|
+
import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, h, inject, onBeforeUnmount, onMounted, openBlock, provide, reactive, renderList, shallowRef, toDisplayString } from "vue";
|
|
5
2
|
// \0rolldown/runtime.js
|
|
6
3
|
var __defProp = Object.defineProperty;
|
|
7
4
|
var __exportAll = (all, no_symbols) => {
|
|
@@ -13,6 +10,61 @@ var __exportAll = (all, no_symbols) => {
|
|
|
13
10
|
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
14
11
|
return target;
|
|
15
12
|
};
|
|
13
|
+
// \0plugin-vue:export-helper
|
|
14
|
+
var _plugin_vue_export_helper_default = (sfc, props) => {
|
|
15
|
+
const target = sfc.__vccOpts || sfc;
|
|
16
|
+
for (const [key, val] of props) target[key] = val;
|
|
17
|
+
return target;
|
|
18
|
+
};
|
|
19
|
+
// src/components/PwApiBrief.vue?vue&type=script&setup=true&lang.ts
|
|
20
|
+
var _hoisted_1 = {
|
|
21
|
+
key: 0,
|
|
22
|
+
class: "pw-api-brief"
|
|
23
|
+
};
|
|
24
|
+
var _hoisted_2 = ["title", "onClick"];
|
|
25
|
+
var _hoisted_3 = { class: "pw-api-brief__name" };
|
|
26
|
+
var _hoisted_4 = {
|
|
27
|
+
key: 0,
|
|
28
|
+
class: "pw-api-brief__type"
|
|
29
|
+
};
|
|
30
|
+
var _hoisted_5 = {
|
|
31
|
+
key: 1,
|
|
32
|
+
class: "pw-api-brief__default"
|
|
33
|
+
};
|
|
34
|
+
// src/components/PwApiBrief.vue
|
|
35
|
+
var PwApiBrief_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
36
|
+
__name: "PwApiBrief",
|
|
37
|
+
props: { items: {} },
|
|
38
|
+
emits: ["inspect"],
|
|
39
|
+
setup(__props, { emit: __emit }) {
|
|
40
|
+
/** 场景顶部 API 摘要行:一个场景演示了哪些 API,类型与默认值来自 manifest */
|
|
41
|
+
const emit = __emit;
|
|
42
|
+
return (_ctx, _cache) => {
|
|
43
|
+
return __props.items.length ? (openBlock(), createElementBlock("ul", _hoisted_1, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item) => {
|
|
44
|
+
return openBlock(), createElementBlock("li", {
|
|
45
|
+
key: item.name,
|
|
46
|
+
class: "pw-api-brief__item"
|
|
47
|
+
}, [createElementVNode("button", {
|
|
48
|
+
type: "button",
|
|
49
|
+
class: "pw-api-brief__chip",
|
|
50
|
+
title: `在 API 表里查看 ${item.name}`,
|
|
51
|
+
onClick: ($event) => emit("inspect", item.name)
|
|
52
|
+
}, [
|
|
53
|
+
createElementVNode("code", _hoisted_3, toDisplayString(item.name), 1),
|
|
54
|
+
item.type ? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(item.type), 1)) : createCommentVNode("", true),
|
|
55
|
+
item.default ? (openBlock(), createElementBlock("span", _hoisted_5, "= " + toDisplayString(item.default), 1)) : createCommentVNode("", true)
|
|
56
|
+
], 8, _hoisted_2)]);
|
|
57
|
+
}), 128))])) : createCommentVNode("", true);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}), [["__scopeId", "data-v-20ccf753"]]);
|
|
61
|
+
// ../../node_modules/.pnpm/@shikijs+types@4.6.0/node_modules/@shikijs/types/dist/index.mjs
|
|
62
|
+
var ShikiError = class extends Error {
|
|
63
|
+
constructor(message) {
|
|
64
|
+
super(message);
|
|
65
|
+
this.name = "ShikiError";
|
|
66
|
+
}
|
|
67
|
+
};
|
|
16
68
|
// ../../node_modules/.pnpm/@shikijs+vscode-textmate@10.1.0/node_modules/@shikijs/vscode-textmate/dist/index.js
|
|
17
69
|
function clone(something) {
|
|
18
70
|
return doClone(something);
|
|
@@ -2378,760 +2430,108 @@ var Registry$1 = class {
|
|
|
2378
2430
|
}
|
|
2379
2431
|
};
|
|
2380
2432
|
var INITIAL = StateStackImpl.NULL;
|
|
2381
|
-
//
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
"
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
}, toDisplayString(item.text), 3);
|
|
2397
|
-
}), 128))]),
|
|
2398
|
-
_: 1
|
|
2399
|
-
})])]);
|
|
2400
|
-
};
|
|
2401
|
-
}
|
|
2402
|
-
});
|
|
2403
|
-
// \0plugin-vue:export-helper
|
|
2404
|
-
var _plugin_vue_export_helper_default = (sfc, props) => {
|
|
2405
|
-
const target = sfc.__vccOpts || sfc;
|
|
2406
|
-
for (const [key, val] of props) target[key] = val;
|
|
2407
|
-
return target;
|
|
2408
|
-
};
|
|
2409
|
-
// src/components/PwToastHost.vue
|
|
2410
|
-
var PwToastHost_default = /*#__PURE__*/ _plugin_vue_export_helper_default(PwToastHost_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-4f7c0a94"]]);
|
|
2411
|
-
// ../../node_modules/.pnpm/@lucide+vue@1.66.0_vue@3.5.44_typescript@5.9.3_/node_modules/@lucide/vue/dist/esm/shared/src/build/defaultAttributes.mjs
|
|
2433
|
+
// ../../node_modules/.pnpm/@shikijs+primitive@4.6.0/node_modules/@shikijs/primitive/dist/index.mjs
|
|
2434
|
+
function resolveColorReplacements(theme, options) {
|
|
2435
|
+
const replacements = typeof theme === "string" ? {} : { ...theme.colorReplacements };
|
|
2436
|
+
const themeName = typeof theme === "string" ? theme : theme.name;
|
|
2437
|
+
for (const [key, value] of Object.entries(options?.colorReplacements || {})) if (typeof value === "string") replacements[key] = value;
|
|
2438
|
+
else if (key === themeName) Object.assign(replacements, value);
|
|
2439
|
+
return replacements;
|
|
2440
|
+
}
|
|
2441
|
+
function applyColorReplacements(color, replacements) {
|
|
2442
|
+
if (!color) return color;
|
|
2443
|
+
return replacements?.[color?.toLowerCase()] || color;
|
|
2444
|
+
}
|
|
2445
|
+
function toArray(x) {
|
|
2446
|
+
return Array.isArray(x) ? x : [x];
|
|
2447
|
+
}
|
|
2412
2448
|
/**
|
|
2413
|
-
*
|
|
2414
|
-
*
|
|
2415
|
-
* This source code is licensed under the ISC license.
|
|
2416
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2449
|
+
* Normalize a getter to a promise.
|
|
2417
2450
|
*/
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
height: 24,
|
|
2422
|
-
viewBox: "0 0 24 24",
|
|
2423
|
-
fill: "none",
|
|
2424
|
-
stroke: "currentColor",
|
|
2425
|
-
"stroke-width": 2,
|
|
2426
|
-
"stroke-linecap": "round",
|
|
2427
|
-
"stroke-linejoin": "round"
|
|
2428
|
-
};
|
|
2429
|
-
// ../../node_modules/.pnpm/@lucide+vue@1.66.0_vue@3.5.44_typescript@5.9.3_/node_modules/@lucide/vue/dist/esm/shared/src/utils/mergeClasses.mjs
|
|
2451
|
+
async function normalizeGetter(p) {
|
|
2452
|
+
return Promise.resolve(typeof p === "function" ? p() : p).then((r) => r.default || r);
|
|
2453
|
+
}
|
|
2430
2454
|
/**
|
|
2431
|
-
*
|
|
2455
|
+
* Check if the language is plaintext that is ignored by Shiki.
|
|
2432
2456
|
*
|
|
2433
|
-
*
|
|
2434
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2457
|
+
* Hard-coded plain text languages: `plaintext`, `txt`, `text`, `plain`.
|
|
2435
2458
|
*/
|
|
2436
|
-
|
|
2437
|
-
return
|
|
2438
|
-
|
|
2439
|
-
|
|
2459
|
+
function isPlainLang(lang) {
|
|
2460
|
+
return !lang || [
|
|
2461
|
+
"plaintext",
|
|
2462
|
+
"txt",
|
|
2463
|
+
"text",
|
|
2464
|
+
"plain"
|
|
2465
|
+
].includes(lang);
|
|
2466
|
+
}
|
|
2440
2467
|
/**
|
|
2441
|
-
*
|
|
2468
|
+
* Check if the language is specially handled or bypassed by Shiki.
|
|
2442
2469
|
*
|
|
2443
|
-
*
|
|
2444
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2470
|
+
* Hard-coded languages: `ansi` and plaintexts like `plaintext`, `txt`, `text`, `plain`.
|
|
2445
2471
|
*/
|
|
2446
|
-
function
|
|
2447
|
-
return
|
|
2448
|
-
}
|
|
2449
|
-
function buildLucideIconNode(icon, params = {}) {
|
|
2450
|
-
const attributeNames = params.attributeNames ?? {};
|
|
2451
|
-
const getAttributeName = (attributeName) => attributeNames[attributeName] ?? attributeName;
|
|
2452
|
-
const viewBoxWidth = icon.size ?? icon.width ?? defaultAttributes["width"];
|
|
2453
|
-
const viewBoxHeight = icon.size ?? icon.height ?? defaultAttributes["height"];
|
|
2454
|
-
const aliasClassNames = icon.aliases?.filter((alias) => typeof alias === "string" && alias.trim() !== "").map((alias) => `lucide-${alias}`) ?? [];
|
|
2455
|
-
const iconClassNames = [...icon.name ? [`lucide-${icon.name}`] : [], ...aliasClassNames];
|
|
2456
|
-
const classNamesFromClassName = params.className?.split(" ").filter(Boolean) ?? [];
|
|
2457
|
-
const className = params.includeDefaultClasses === false ? mergeClasses(...classNamesFromClassName) : mergeClasses("lucide", ...iconClassNames, ...classNamesFromClassName);
|
|
2458
|
-
const calculatedStrokeWidth = params.absoluteStrokeWidth ? Number(params.strokeWidth ?? defaultAttributes["stroke-width"]) * Number(icon.size ?? icon.width ?? defaultAttributes["width"]) / Number(params.size ?? params.width ?? defaultAttributes["width"]) : params.strokeWidth ?? defaultAttributes["stroke-width"];
|
|
2459
|
-
return [
|
|
2460
|
-
"svg",
|
|
2461
|
-
{
|
|
2462
|
-
...Object.entries(defaultAttributes).reduce((attrs, [attrName, value]) => {
|
|
2463
|
-
attrs[getAttributeName(attrName)] = value;
|
|
2464
|
-
return attrs;
|
|
2465
|
-
}, {}),
|
|
2466
|
-
..."color" in params && params.color && { [getAttributeName("stroke")]: params.color },
|
|
2467
|
-
..."size" in params && isDefined(params.size) && {
|
|
2468
|
-
[getAttributeName("width")]: params.size,
|
|
2469
|
-
[getAttributeName("height")]: params.size
|
|
2470
|
-
},
|
|
2471
|
-
..."width" in params && isDefined(params.width) && { [getAttributeName("width")]: params.width },
|
|
2472
|
-
..."height" in params && isDefined(params.height) && { [getAttributeName("height")]: params.height },
|
|
2473
|
-
[getAttributeName("stroke-width")]: calculatedStrokeWidth,
|
|
2474
|
-
...className && { [getAttributeName("class")]: className },
|
|
2475
|
-
[getAttributeName("viewBox")]: `0 0 ${viewBoxWidth} ${viewBoxHeight}`,
|
|
2476
|
-
...params.hasA11yProp === false ? { [getAttributeName("aria-hidden")]: "true" } : {},
|
|
2477
|
-
..."attributes" in params && params.attributes
|
|
2478
|
-
},
|
|
2479
|
-
icon.node.map((child) => {
|
|
2480
|
-
const [name, attrs, children] = child;
|
|
2481
|
-
const nextAttrs = params.nonScalingStroke ? {
|
|
2482
|
-
[getAttributeName("vector-effect")]: "non-scaling-stroke",
|
|
2483
|
-
...attrs
|
|
2484
|
-
} : attrs;
|
|
2485
|
-
return children ? [
|
|
2486
|
-
name,
|
|
2487
|
-
nextAttrs,
|
|
2488
|
-
children
|
|
2489
|
-
] : [name, nextAttrs];
|
|
2490
|
-
})
|
|
2491
|
-
];
|
|
2472
|
+
function isSpecialLang(lang) {
|
|
2473
|
+
return lang === "ansi" || isPlainLang(lang);
|
|
2492
2474
|
}
|
|
2493
|
-
// ../../node_modules/.pnpm/@lucide+vue@1.66.0_vue@3.5.44_typescript@5.9.3_/node_modules/@lucide/vue/dist/esm/shared/src/utils/hasA11yProp.mjs
|
|
2494
2475
|
/**
|
|
2495
|
-
*
|
|
2476
|
+
* Check if the theme is specially handled or bypassed by Shiki.
|
|
2496
2477
|
*
|
|
2497
|
-
*
|
|
2498
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2478
|
+
* Hard-coded themes: `none`.
|
|
2499
2479
|
*/
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
};
|
|
2504
|
-
// ../../node_modules/.pnpm/@lucide+vue@1.66.0_vue@3.5.44_typescript@5.9.3_/node_modules/@lucide/vue/dist/esm/shared/src/utils/isEmptyString.mjs
|
|
2480
|
+
function isNoneTheme(theme) {
|
|
2481
|
+
return theme === "none";
|
|
2482
|
+
}
|
|
2505
2483
|
/**
|
|
2506
|
-
*
|
|
2484
|
+
* Check if the theme is specially handled or bypassed by Shiki.
|
|
2507
2485
|
*
|
|
2508
|
-
*
|
|
2509
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2486
|
+
* Hard-coded themes: `none`.
|
|
2510
2487
|
*/
|
|
2511
|
-
|
|
2512
|
-
|
|
2488
|
+
function isSpecialTheme(theme) {
|
|
2489
|
+
return isNoneTheme(theme);
|
|
2490
|
+
}
|
|
2513
2491
|
/**
|
|
2514
|
-
*
|
|
2492
|
+
* Split a string into lines, each line preserves the line ending.
|
|
2515
2493
|
*
|
|
2516
|
-
*
|
|
2517
|
-
*
|
|
2518
|
-
|
|
2519
|
-
var toKebabCase = (string) => string?.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
2520
|
-
// ../../node_modules/.pnpm/@lucide+vue@1.66.0_vue@3.5.44_typescript@5.9.3_/node_modules/@lucide/vue/dist/esm/context.mjs
|
|
2521
|
-
/**
|
|
2522
|
-
* @license @lucide/vue v1.66.0 - ISC
|
|
2494
|
+
* @param code - The code string to split into lines
|
|
2495
|
+
* @param preserveEnding - Whether to preserve line endings in the result
|
|
2496
|
+
* @returns Array of tuples containing [line content, offset index]
|
|
2523
2497
|
*
|
|
2524
|
-
*
|
|
2525
|
-
*
|
|
2498
|
+
* @example
|
|
2499
|
+
* ```ts
|
|
2500
|
+
* splitLines('hello\nworld', false)
|
|
2501
|
+
* // => [['hello', 0], ['world', 6]]
|
|
2502
|
+
*
|
|
2503
|
+
* splitLines('hello\nworld', true)
|
|
2504
|
+
* // => [['hello\n', 0], ['world', 6]]
|
|
2505
|
+
* ```
|
|
2526
2506
|
*/
|
|
2527
|
-
var
|
|
2528
|
-
function
|
|
2529
|
-
return
|
|
2507
|
+
var RE_NEWLINE = /(\r?\n)/g;
|
|
2508
|
+
function splitLines(code, preserveEnding = false) {
|
|
2509
|
+
if (code.length === 0) return [["", 0]];
|
|
2510
|
+
const parts = code.split(RE_NEWLINE);
|
|
2511
|
+
let index = 0;
|
|
2512
|
+
const lines = [];
|
|
2513
|
+
for (let i = 0; i < parts.length; i += 2) {
|
|
2514
|
+
const line = preserveEnding ? parts[i] + (parts[i + 1] || "") : parts[i];
|
|
2515
|
+
lines.push([line, index]);
|
|
2516
|
+
index += parts[i].length;
|
|
2517
|
+
index += parts[i + 1]?.length || 0;
|
|
2518
|
+
}
|
|
2519
|
+
return lines;
|
|
2530
2520
|
}
|
|
2531
|
-
// ../../node_modules/.pnpm/@lucide+vue@1.66.0_vue@3.5.44_typescript@5.9.3_/node_modules/@lucide/vue/dist/esm/Icon.mjs
|
|
2532
2521
|
/**
|
|
2533
|
-
*
|
|
2534
|
-
*
|
|
2535
|
-
* This source code is licensed under the ISC license.
|
|
2536
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2522
|
+
* https://github.com/microsoft/vscode/blob/f7f05dee53fb33fe023db2e06e30a89d3094488f/src/vs/platform/theme/common/colorRegistry.ts#L258-L268
|
|
2537
2523
|
*/
|
|
2538
|
-
var
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
size: 24,
|
|
2542
|
-
aliases: []
|
|
2543
|
-
}, absoluteStrokeWidth, "absolute-stroke-width": absoluteStrokeWidthKebabCase, nonScalingStroke, "non-scaling-stroke": nonScalingStrokeKebabCase, strokeWidth, "stroke-width": strokeWidthKebabCase, size, width = size, height = size, color, ...props }, { slots }) => {
|
|
2544
|
-
const { size: contextSize, color: contextColor, strokeWidth: contextStrokeWidth = 2, absoluteStrokeWidth: contextAbsoluteStrokeWidth = false, nonScalingStroke: contextNonScalingStroke = false, class: contextClass = "" } = useLucideProps();
|
|
2545
|
-
const isAbsoluteStrokeWidth = isEmptyString(absoluteStrokeWidth) || isEmptyString(absoluteStrokeWidthKebabCase) || absoluteStrokeWidth === true || absoluteStrokeWidthKebabCase === true || contextAbsoluteStrokeWidth === true;
|
|
2546
|
-
const isNonScalingStroke = isEmptyString(nonScalingStroke) || isEmptyString(nonScalingStrokeKebabCase) || nonScalingStroke === true || nonScalingStrokeKebabCase === true || contextNonScalingStroke === true;
|
|
2547
|
-
delete props.class;
|
|
2548
|
-
const defaultSlot = slots.default?.();
|
|
2549
|
-
const [, svgAttributes, builtIconNode = []] = buildLucideIconNode(icon, {
|
|
2550
|
-
color: color ?? contextColor,
|
|
2551
|
-
width: width ?? size ?? contextSize,
|
|
2552
|
-
height: height ?? size ?? contextSize,
|
|
2553
|
-
strokeWidth: strokeWidth ?? strokeWidthKebabCase ?? contextStrokeWidth,
|
|
2554
|
-
absoluteStrokeWidth: isAbsoluteStrokeWidth,
|
|
2555
|
-
nonScalingStroke: isNonScalingStroke,
|
|
2556
|
-
className: contextClass,
|
|
2557
|
-
hasA11yProp: defaultSlot != null && defaultSlot.length > 0 || hasA11yProp(props),
|
|
2558
|
-
attributes: props
|
|
2559
|
-
});
|
|
2560
|
-
return h("svg", svgAttributes, [...builtIconNode.map(([tag, attrs]) => h(tag, attrs)), ...defaultSlot ?? []]);
|
|
2524
|
+
var VSCODE_FALLBACK_EDITOR_FG = {
|
|
2525
|
+
light: "#333333",
|
|
2526
|
+
dark: "#bbbbbb"
|
|
2561
2527
|
};
|
|
2562
|
-
|
|
2528
|
+
var VSCODE_FALLBACK_EDITOR_BG = {
|
|
2529
|
+
light: "#fffffe",
|
|
2530
|
+
dark: "#1e1e1e"
|
|
2531
|
+
};
|
|
2532
|
+
var RESOLVED_KEY = "__shiki_resolved";
|
|
2563
2533
|
/**
|
|
2564
|
-
*
|
|
2565
|
-
*
|
|
2566
|
-
* This source code is licensed under the ISC license.
|
|
2567
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2568
|
-
*/
|
|
2569
|
-
function createLucideIcon(iconDataOrName, iconNode = []) {
|
|
2570
|
-
const icon = typeof iconDataOrName === "string" ? {
|
|
2571
|
-
name: iconDataOrName,
|
|
2572
|
-
node: iconNode
|
|
2573
|
-
} : iconDataOrName;
|
|
2574
|
-
return (props, { slots }) => h(Icon, {
|
|
2575
|
-
...props,
|
|
2576
|
-
icon
|
|
2577
|
-
}, slots.default ? { default: slots.default } : void 0);
|
|
2578
|
-
}
|
|
2579
|
-
/**
|
|
2580
|
-
* @license @lucide/vue v1.66.0 - ISC
|
|
2581
|
-
*
|
|
2582
|
-
* This source code is licensed under the ISC license.
|
|
2583
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2584
|
-
*/
|
|
2585
|
-
var Check = createLucideIcon({
|
|
2586
|
-
name: "check",
|
|
2587
|
-
size: 24,
|
|
2588
|
-
node: [["path", {
|
|
2589
|
-
d: "M20 6 9 17l-5-5",
|
|
2590
|
-
key: "1gmf2c"
|
|
2591
|
-
}]]
|
|
2592
|
-
});
|
|
2593
|
-
/**
|
|
2594
|
-
* @license @lucide/vue v1.66.0 - ISC
|
|
2595
|
-
*
|
|
2596
|
-
* This source code is licensed under the ISC license.
|
|
2597
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2598
|
-
*/
|
|
2599
|
-
var CodeXml = createLucideIcon({
|
|
2600
|
-
name: "code-xml",
|
|
2601
|
-
size: 24,
|
|
2602
|
-
node: [
|
|
2603
|
-
["path", {
|
|
2604
|
-
d: "m18 16 4-4-4-4",
|
|
2605
|
-
key: "1inbqp"
|
|
2606
|
-
}],
|
|
2607
|
-
["path", {
|
|
2608
|
-
d: "m6 8-4 4 4 4",
|
|
2609
|
-
key: "15zrgr"
|
|
2610
|
-
}],
|
|
2611
|
-
["path", {
|
|
2612
|
-
d: "m14.5 4-5 16",
|
|
2613
|
-
key: "e7oirm"
|
|
2614
|
-
}]
|
|
2615
|
-
],
|
|
2616
|
-
aliases: ["code-2"]
|
|
2617
|
-
});
|
|
2618
|
-
/**
|
|
2619
|
-
* @license @lucide/vue v1.66.0 - ISC
|
|
2620
|
-
*
|
|
2621
|
-
* This source code is licensed under the ISC license.
|
|
2622
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2623
|
-
*/
|
|
2624
|
-
var Copy = createLucideIcon({
|
|
2625
|
-
name: "copy",
|
|
2626
|
-
size: 24,
|
|
2627
|
-
node: [["rect", {
|
|
2628
|
-
width: "14",
|
|
2629
|
-
height: "14",
|
|
2630
|
-
x: "8",
|
|
2631
|
-
y: "8",
|
|
2632
|
-
rx: "2",
|
|
2633
|
-
ry: "2",
|
|
2634
|
-
key: "17jyea"
|
|
2635
|
-
}], ["path", {
|
|
2636
|
-
d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",
|
|
2637
|
-
key: "zix9uf"
|
|
2638
|
-
}]]
|
|
2639
|
-
});
|
|
2640
|
-
/**
|
|
2641
|
-
* @license @lucide/vue v1.66.0 - ISC
|
|
2642
|
-
*
|
|
2643
|
-
* This source code is licensed under the ISC license.
|
|
2644
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2645
|
-
*/
|
|
2646
|
-
var Monitor = createLucideIcon({
|
|
2647
|
-
name: "monitor",
|
|
2648
|
-
size: 24,
|
|
2649
|
-
node: [
|
|
2650
|
-
["rect", {
|
|
2651
|
-
width: "20",
|
|
2652
|
-
height: "14",
|
|
2653
|
-
x: "2",
|
|
2654
|
-
y: "3",
|
|
2655
|
-
rx: "2",
|
|
2656
|
-
key: "48i651"
|
|
2657
|
-
}],
|
|
2658
|
-
["line", {
|
|
2659
|
-
x1: "8",
|
|
2660
|
-
x2: "16",
|
|
2661
|
-
y1: "21",
|
|
2662
|
-
y2: "21",
|
|
2663
|
-
key: "1svkeh"
|
|
2664
|
-
}],
|
|
2665
|
-
["line", {
|
|
2666
|
-
x1: "12",
|
|
2667
|
-
x2: "12",
|
|
2668
|
-
y1: "17",
|
|
2669
|
-
y2: "21",
|
|
2670
|
-
key: "vw1qmm"
|
|
2671
|
-
}]
|
|
2672
|
-
]
|
|
2673
|
-
});
|
|
2674
|
-
/**
|
|
2675
|
-
* @license @lucide/vue v1.66.0 - ISC
|
|
2676
|
-
*
|
|
2677
|
-
* This source code is licensed under the ISC license.
|
|
2678
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2679
|
-
*/
|
|
2680
|
-
var Moon = createLucideIcon({
|
|
2681
|
-
name: "moon",
|
|
2682
|
-
size: 24,
|
|
2683
|
-
node: [["path", {
|
|
2684
|
-
d: "M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",
|
|
2685
|
-
key: "kfwtm"
|
|
2686
|
-
}]]
|
|
2687
|
-
});
|
|
2688
|
-
/**
|
|
2689
|
-
* @license @lucide/vue v1.66.0 - ISC
|
|
2690
|
-
*
|
|
2691
|
-
* This source code is licensed under the ISC license.
|
|
2692
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2693
|
-
*/
|
|
2694
|
-
var RotateCcw = createLucideIcon({
|
|
2695
|
-
name: "rotate-ccw",
|
|
2696
|
-
size: 24,
|
|
2697
|
-
node: [["path", {
|
|
2698
|
-
d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",
|
|
2699
|
-
key: "1357e3"
|
|
2700
|
-
}], ["path", {
|
|
2701
|
-
d: "M3 3v5h5",
|
|
2702
|
-
key: "1xhq8a"
|
|
2703
|
-
}]]
|
|
2704
|
-
});
|
|
2705
|
-
/**
|
|
2706
|
-
* @license @lucide/vue v1.66.0 - ISC
|
|
2707
|
-
*
|
|
2708
|
-
* This source code is licensed under the ISC license.
|
|
2709
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2710
|
-
*/
|
|
2711
|
-
var Search = createLucideIcon({
|
|
2712
|
-
name: "search",
|
|
2713
|
-
size: 24,
|
|
2714
|
-
node: [["path", {
|
|
2715
|
-
d: "m21 21-4.34-4.34",
|
|
2716
|
-
key: "14j7rj"
|
|
2717
|
-
}], ["circle", {
|
|
2718
|
-
cx: "11",
|
|
2719
|
-
cy: "11",
|
|
2720
|
-
r: "8",
|
|
2721
|
-
key: "4ej97u"
|
|
2722
|
-
}]]
|
|
2723
|
-
});
|
|
2724
|
-
/**
|
|
2725
|
-
* @license @lucide/vue v1.66.0 - ISC
|
|
2726
|
-
*
|
|
2727
|
-
* This source code is licensed under the ISC license.
|
|
2728
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2729
|
-
*/
|
|
2730
|
-
var SlidersHorizontal = createLucideIcon({
|
|
2731
|
-
name: "sliders-horizontal",
|
|
2732
|
-
size: 24,
|
|
2733
|
-
node: [
|
|
2734
|
-
["path", {
|
|
2735
|
-
d: "M10 5H3",
|
|
2736
|
-
key: "1qgfaw"
|
|
2737
|
-
}],
|
|
2738
|
-
["path", {
|
|
2739
|
-
d: "M12 19H3",
|
|
2740
|
-
key: "yhmn1j"
|
|
2741
|
-
}],
|
|
2742
|
-
["path", {
|
|
2743
|
-
d: "M14 3v4",
|
|
2744
|
-
key: "1sua03"
|
|
2745
|
-
}],
|
|
2746
|
-
["path", {
|
|
2747
|
-
d: "M16 17v4",
|
|
2748
|
-
key: "1q0r14"
|
|
2749
|
-
}],
|
|
2750
|
-
["path", {
|
|
2751
|
-
d: "M21 12h-9",
|
|
2752
|
-
key: "1o4lsq"
|
|
2753
|
-
}],
|
|
2754
|
-
["path", {
|
|
2755
|
-
d: "M21 19h-5",
|
|
2756
|
-
key: "1rlt1p"
|
|
2757
|
-
}],
|
|
2758
|
-
["path", {
|
|
2759
|
-
d: "M21 5h-7",
|
|
2760
|
-
key: "1oszz2"
|
|
2761
|
-
}],
|
|
2762
|
-
["path", {
|
|
2763
|
-
d: "M8 10v4",
|
|
2764
|
-
key: "tgpxqk"
|
|
2765
|
-
}],
|
|
2766
|
-
["path", {
|
|
2767
|
-
d: "M8 12H3",
|
|
2768
|
-
key: "a7s4jb"
|
|
2769
|
-
}]
|
|
2770
|
-
]
|
|
2771
|
-
});
|
|
2772
|
-
/**
|
|
2773
|
-
* @license @lucide/vue v1.66.0 - ISC
|
|
2774
|
-
*
|
|
2775
|
-
* This source code is licensed under the ISC license.
|
|
2776
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2777
|
-
*/
|
|
2778
|
-
var Smartphone = createLucideIcon({
|
|
2779
|
-
name: "smartphone",
|
|
2780
|
-
size: 24,
|
|
2781
|
-
node: [["rect", {
|
|
2782
|
-
width: "14",
|
|
2783
|
-
height: "20",
|
|
2784
|
-
x: "5",
|
|
2785
|
-
y: "2",
|
|
2786
|
-
rx: "2",
|
|
2787
|
-
ry: "2",
|
|
2788
|
-
key: "1yt0o3"
|
|
2789
|
-
}], ["path", {
|
|
2790
|
-
d: "M12 18h.01",
|
|
2791
|
-
key: "mhygvu"
|
|
2792
|
-
}]]
|
|
2793
|
-
});
|
|
2794
|
-
/**
|
|
2795
|
-
* @license @lucide/vue v1.66.0 - ISC
|
|
2796
|
-
*
|
|
2797
|
-
* This source code is licensed under the ISC license.
|
|
2798
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2799
|
-
*/
|
|
2800
|
-
var Sun = createLucideIcon({
|
|
2801
|
-
name: "sun",
|
|
2802
|
-
size: 24,
|
|
2803
|
-
node: [
|
|
2804
|
-
["circle", {
|
|
2805
|
-
cx: "12",
|
|
2806
|
-
cy: "12",
|
|
2807
|
-
r: "4",
|
|
2808
|
-
key: "4exip2"
|
|
2809
|
-
}],
|
|
2810
|
-
["path", {
|
|
2811
|
-
d: "M12 2v2",
|
|
2812
|
-
key: "tus03m"
|
|
2813
|
-
}],
|
|
2814
|
-
["path", {
|
|
2815
|
-
d: "M12 20v2",
|
|
2816
|
-
key: "1lh1kg"
|
|
2817
|
-
}],
|
|
2818
|
-
["path", {
|
|
2819
|
-
d: "m4.93 4.93 1.41 1.41",
|
|
2820
|
-
key: "149t6j"
|
|
2821
|
-
}],
|
|
2822
|
-
["path", {
|
|
2823
|
-
d: "m17.66 17.66 1.41 1.41",
|
|
2824
|
-
key: "ptbguv"
|
|
2825
|
-
}],
|
|
2826
|
-
["path", {
|
|
2827
|
-
d: "M2 12h2",
|
|
2828
|
-
key: "1t8f8n"
|
|
2829
|
-
}],
|
|
2830
|
-
["path", {
|
|
2831
|
-
d: "M20 12h2",
|
|
2832
|
-
key: "1q8mjw"
|
|
2833
|
-
}],
|
|
2834
|
-
["path", {
|
|
2835
|
-
d: "m6.34 17.66-1.41 1.41",
|
|
2836
|
-
key: "1m8zz5"
|
|
2837
|
-
}],
|
|
2838
|
-
["path", {
|
|
2839
|
-
d: "m19.07 4.93-1.41 1.41",
|
|
2840
|
-
key: "1shlcs"
|
|
2841
|
-
}]
|
|
2842
|
-
]
|
|
2843
|
-
});
|
|
2844
|
-
/**
|
|
2845
|
-
* @license @lucide/vue v1.66.0 - ISC
|
|
2846
|
-
*
|
|
2847
|
-
* This source code is licensed under the ISC license.
|
|
2848
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2849
|
-
*/
|
|
2850
|
-
var Tablet = createLucideIcon({
|
|
2851
|
-
name: "tablet",
|
|
2852
|
-
size: 24,
|
|
2853
|
-
node: [["rect", {
|
|
2854
|
-
width: "16",
|
|
2855
|
-
height: "20",
|
|
2856
|
-
x: "4",
|
|
2857
|
-
y: "2",
|
|
2858
|
-
rx: "2",
|
|
2859
|
-
ry: "2",
|
|
2860
|
-
key: "76otgf"
|
|
2861
|
-
}], ["line", {
|
|
2862
|
-
x1: "12",
|
|
2863
|
-
x2: "12.01",
|
|
2864
|
-
y1: "18",
|
|
2865
|
-
y2: "18",
|
|
2866
|
-
key: "1dp563"
|
|
2867
|
-
}]]
|
|
2868
|
-
});
|
|
2869
|
-
/**
|
|
2870
|
-
* @license @lucide/vue v1.66.0 - ISC
|
|
2871
|
-
*
|
|
2872
|
-
* This source code is licensed under the ISC license.
|
|
2873
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2874
|
-
*/
|
|
2875
|
-
var X$2 = createLucideIcon({
|
|
2876
|
-
name: "x",
|
|
2877
|
-
size: 24,
|
|
2878
|
-
node: [["path", {
|
|
2879
|
-
d: "M18 6 6 18",
|
|
2880
|
-
key: "1bl5f8"
|
|
2881
|
-
}], ["path", {
|
|
2882
|
-
d: "m6 6 12 12",
|
|
2883
|
-
key: "d8bk6v"
|
|
2884
|
-
}]]
|
|
2885
|
-
});
|
|
2886
|
-
// src/components/PwButton.vue?vue&type=script&setup=true&lang.ts
|
|
2887
|
-
var _hoisted_1$9 = ["disabled", "title"];
|
|
2888
|
-
var _hoisted_2$8 = {
|
|
2889
|
-
key: 0,
|
|
2890
|
-
class: "pw-btn__spinner",
|
|
2891
|
-
"aria-hidden": "true"
|
|
2892
|
-
};
|
|
2893
|
-
var _hoisted_3$7 = {
|
|
2894
|
-
key: 2,
|
|
2895
|
-
class: "pw-btn__label"
|
|
2896
|
-
};
|
|
2897
|
-
// src/components/PwButton.vue
|
|
2898
|
-
var PwButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
2899
|
-
__name: "PwButton",
|
|
2900
|
-
props: {
|
|
2901
|
-
variant: { default: "ghost" },
|
|
2902
|
-
size: { default: "md" },
|
|
2903
|
-
disabled: {
|
|
2904
|
-
type: Boolean,
|
|
2905
|
-
default: false
|
|
2906
|
-
},
|
|
2907
|
-
loading: {
|
|
2908
|
-
type: Boolean,
|
|
2909
|
-
default: false
|
|
2910
|
-
},
|
|
2911
|
-
title: {}
|
|
2912
|
-
},
|
|
2913
|
-
setup(__props) {
|
|
2914
|
-
return (_ctx, _cache) => {
|
|
2915
|
-
return openBlock(), createElementBlock("button", {
|
|
2916
|
-
class: normalizeClass(["pw-btn", [
|
|
2917
|
-
`pw-btn--${__props.variant}`,
|
|
2918
|
-
`pw-btn--${__props.size}`,
|
|
2919
|
-
{ "is-loading": __props.loading }
|
|
2920
|
-
]]),
|
|
2921
|
-
disabled: __props.disabled || __props.loading,
|
|
2922
|
-
title: __props.title,
|
|
2923
|
-
type: "button"
|
|
2924
|
-
}, [__props.loading ? (openBlock(), createElementBlock("span", _hoisted_2$8)) : renderSlot(_ctx.$slots, "icon", {}, void 0, true, 1), _ctx.$slots.default ? (openBlock(), createElementBlock("span", _hoisted_3$7, [renderSlot(_ctx.$slots, "default", {}, void 0, true)])) : createCommentVNode("", true)], 10, _hoisted_1$9);
|
|
2925
|
-
};
|
|
2926
|
-
}
|
|
2927
|
-
}), [["__scopeId", "data-v-8c5978c8"]]);
|
|
2928
|
-
// src/components/PwInput.vue?vue&type=script&setup=true&lang.ts
|
|
2929
|
-
var _hoisted_1$8 = ["data-empty"];
|
|
2930
|
-
var _hoisted_2$7 = [
|
|
2931
|
-
"type",
|
|
2932
|
-
"value",
|
|
2933
|
-
"placeholder",
|
|
2934
|
-
"autofocus"
|
|
2935
|
-
];
|
|
2936
|
-
// src/components/PwInput.vue
|
|
2937
|
-
var PwInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
2938
|
-
__name: "PwInput",
|
|
2939
|
-
props: {
|
|
2940
|
-
modelValue: { default: "" },
|
|
2941
|
-
placeholder: {},
|
|
2942
|
-
clearable: {
|
|
2943
|
-
type: Boolean,
|
|
2944
|
-
default: true
|
|
2945
|
-
},
|
|
2946
|
-
size: { default: "md" },
|
|
2947
|
-
autofocus: {
|
|
2948
|
-
type: Boolean,
|
|
2949
|
-
default: false
|
|
2950
|
-
},
|
|
2951
|
-
type: { default: "text" }
|
|
2952
|
-
},
|
|
2953
|
-
emits: [
|
|
2954
|
-
"update:modelValue",
|
|
2955
|
-
"keydown",
|
|
2956
|
-
"focus",
|
|
2957
|
-
"blur"
|
|
2958
|
-
],
|
|
2959
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
2960
|
-
const props = __props;
|
|
2961
|
-
const emit = __emit;
|
|
2962
|
-
const inputRef = ref();
|
|
2963
|
-
const onInput = (event) => {
|
|
2964
|
-
emit("update:modelValue", event.target.value);
|
|
2965
|
-
};
|
|
2966
|
-
const clear = () => {
|
|
2967
|
-
emit("update:modelValue", "");
|
|
2968
|
-
inputRef.value?.focus();
|
|
2969
|
-
};
|
|
2970
|
-
__expose({ focus: () => inputRef.value?.focus() });
|
|
2971
|
-
return (_ctx, _cache) => {
|
|
2972
|
-
return openBlock(), createElementBlock("div", {
|
|
2973
|
-
class: normalizeClass(["pw-input", `pw-input--${__props.size}`]),
|
|
2974
|
-
"data-empty": !props.modelValue
|
|
2975
|
-
}, [
|
|
2976
|
-
renderSlot(_ctx.$slots, "prefix", {}, void 0, true),
|
|
2977
|
-
createElementVNode("input", {
|
|
2978
|
-
ref_key: "inputRef",
|
|
2979
|
-
ref: inputRef,
|
|
2980
|
-
class: "pw-input__field",
|
|
2981
|
-
type: __props.type,
|
|
2982
|
-
value: __props.modelValue,
|
|
2983
|
-
placeholder: __props.placeholder,
|
|
2984
|
-
autofocus: __props.autofocus,
|
|
2985
|
-
onInput,
|
|
2986
|
-
onKeydown: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("keydown", $event)),
|
|
2987
|
-
onFocus: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("focus", $event)),
|
|
2988
|
-
onBlur: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("blur", $event))
|
|
2989
|
-
}, null, 40, _hoisted_2$7),
|
|
2990
|
-
__props.clearable && __props.modelValue ? (openBlock(), createElementBlock("button", {
|
|
2991
|
-
key: 0,
|
|
2992
|
-
class: "pw-input__clear",
|
|
2993
|
-
type: "button",
|
|
2994
|
-
title: "清空",
|
|
2995
|
-
onClick: clear
|
|
2996
|
-
}, " × ")) : createCommentVNode("", true),
|
|
2997
|
-
renderSlot(_ctx.$slots, "suffix", {}, void 0, true)
|
|
2998
|
-
], 10, _hoisted_1$8);
|
|
2999
|
-
};
|
|
3000
|
-
}
|
|
3001
|
-
}), [["__scopeId", "data-v-e249cd4b"]]);
|
|
3002
|
-
// src/components/PwSwitch.vue?vue&type=script&setup=true&lang.ts
|
|
3003
|
-
var _hoisted_1$7 = ["aria-checked", "disabled"];
|
|
3004
|
-
// src/components/PwSwitch.vue
|
|
3005
|
-
var PwSwitch_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
3006
|
-
__name: "PwSwitch",
|
|
3007
|
-
props: {
|
|
3008
|
-
modelValue: { type: Boolean },
|
|
3009
|
-
disabled: { type: Boolean }
|
|
3010
|
-
},
|
|
3011
|
-
emits: ["update:modelValue"],
|
|
3012
|
-
setup(__props, { emit: __emit }) {
|
|
3013
|
-
const emit = __emit;
|
|
3014
|
-
return (_ctx, _cache) => {
|
|
3015
|
-
return openBlock(), createElementBlock("button", {
|
|
3016
|
-
type: "button",
|
|
3017
|
-
role: "switch",
|
|
3018
|
-
class: normalizeClass(["pw-switch", { "is-on": __props.modelValue }]),
|
|
3019
|
-
"aria-checked": __props.modelValue,
|
|
3020
|
-
disabled: __props.disabled,
|
|
3021
|
-
onClick: _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", !__props.modelValue))
|
|
3022
|
-
}, [..._cache[1] || (_cache[1] = [createElementVNode("span", { class: "pw-switch__thumb" }, null, -1)])], 10, _hoisted_1$7);
|
|
3023
|
-
};
|
|
3024
|
-
}
|
|
3025
|
-
}), [["__scopeId", "data-v-64fffbcb"]]);
|
|
3026
|
-
// ../../node_modules/.pnpm/@shikijs+types@4.6.0/node_modules/@shikijs/types/dist/index.mjs
|
|
3027
|
-
var ShikiError = class extends Error {
|
|
3028
|
-
constructor(message) {
|
|
3029
|
-
super(message);
|
|
3030
|
-
this.name = "ShikiError";
|
|
3031
|
-
}
|
|
3032
|
-
};
|
|
3033
|
-
// ../../node_modules/.pnpm/@shikijs+primitive@4.6.0/node_modules/@shikijs/primitive/dist/index.mjs
|
|
3034
|
-
function resolveColorReplacements(theme, options) {
|
|
3035
|
-
const replacements = typeof theme === "string" ? {} : { ...theme.colorReplacements };
|
|
3036
|
-
const themeName = typeof theme === "string" ? theme : theme.name;
|
|
3037
|
-
for (const [key, value] of Object.entries(options?.colorReplacements || {})) if (typeof value === "string") replacements[key] = value;
|
|
3038
|
-
else if (key === themeName) Object.assign(replacements, value);
|
|
3039
|
-
return replacements;
|
|
3040
|
-
}
|
|
3041
|
-
function applyColorReplacements(color, replacements) {
|
|
3042
|
-
if (!color) return color;
|
|
3043
|
-
return replacements?.[color?.toLowerCase()] || color;
|
|
3044
|
-
}
|
|
3045
|
-
function toArray(x) {
|
|
3046
|
-
return Array.isArray(x) ? x : [x];
|
|
3047
|
-
}
|
|
3048
|
-
/**
|
|
3049
|
-
* Normalize a getter to a promise.
|
|
3050
|
-
*/
|
|
3051
|
-
async function normalizeGetter(p) {
|
|
3052
|
-
return Promise.resolve(typeof p === "function" ? p() : p).then((r) => r.default || r);
|
|
3053
|
-
}
|
|
3054
|
-
/**
|
|
3055
|
-
* Check if the language is plaintext that is ignored by Shiki.
|
|
3056
|
-
*
|
|
3057
|
-
* Hard-coded plain text languages: `plaintext`, `txt`, `text`, `plain`.
|
|
3058
|
-
*/
|
|
3059
|
-
function isPlainLang(lang) {
|
|
3060
|
-
return !lang || [
|
|
3061
|
-
"plaintext",
|
|
3062
|
-
"txt",
|
|
3063
|
-
"text",
|
|
3064
|
-
"plain"
|
|
3065
|
-
].includes(lang);
|
|
3066
|
-
}
|
|
3067
|
-
/**
|
|
3068
|
-
* Check if the language is specially handled or bypassed by Shiki.
|
|
3069
|
-
*
|
|
3070
|
-
* Hard-coded languages: `ansi` and plaintexts like `plaintext`, `txt`, `text`, `plain`.
|
|
3071
|
-
*/
|
|
3072
|
-
function isSpecialLang(lang) {
|
|
3073
|
-
return lang === "ansi" || isPlainLang(lang);
|
|
3074
|
-
}
|
|
3075
|
-
/**
|
|
3076
|
-
* Check if the theme is specially handled or bypassed by Shiki.
|
|
3077
|
-
*
|
|
3078
|
-
* Hard-coded themes: `none`.
|
|
3079
|
-
*/
|
|
3080
|
-
function isNoneTheme(theme) {
|
|
3081
|
-
return theme === "none";
|
|
3082
|
-
}
|
|
3083
|
-
/**
|
|
3084
|
-
* Check if the theme is specially handled or bypassed by Shiki.
|
|
3085
|
-
*
|
|
3086
|
-
* Hard-coded themes: `none`.
|
|
3087
|
-
*/
|
|
3088
|
-
function isSpecialTheme(theme) {
|
|
3089
|
-
return isNoneTheme(theme);
|
|
3090
|
-
}
|
|
3091
|
-
/**
|
|
3092
|
-
* Split a string into lines, each line preserves the line ending.
|
|
3093
|
-
*
|
|
3094
|
-
* @param code - The code string to split into lines
|
|
3095
|
-
* @param preserveEnding - Whether to preserve line endings in the result
|
|
3096
|
-
* @returns Array of tuples containing [line content, offset index]
|
|
3097
|
-
*
|
|
3098
|
-
* @example
|
|
3099
|
-
* ```ts
|
|
3100
|
-
* splitLines('hello\nworld', false)
|
|
3101
|
-
* // => [['hello', 0], ['world', 6]]
|
|
3102
|
-
*
|
|
3103
|
-
* splitLines('hello\nworld', true)
|
|
3104
|
-
* // => [['hello\n', 0], ['world', 6]]
|
|
3105
|
-
* ```
|
|
3106
|
-
*/
|
|
3107
|
-
var RE_NEWLINE = /(\r?\n)/g;
|
|
3108
|
-
function splitLines(code, preserveEnding = false) {
|
|
3109
|
-
if (code.length === 0) return [["", 0]];
|
|
3110
|
-
const parts = code.split(RE_NEWLINE);
|
|
3111
|
-
let index = 0;
|
|
3112
|
-
const lines = [];
|
|
3113
|
-
for (let i = 0; i < parts.length; i += 2) {
|
|
3114
|
-
const line = preserveEnding ? parts[i] + (parts[i + 1] || "") : parts[i];
|
|
3115
|
-
lines.push([line, index]);
|
|
3116
|
-
index += parts[i].length;
|
|
3117
|
-
index += parts[i + 1]?.length || 0;
|
|
3118
|
-
}
|
|
3119
|
-
return lines;
|
|
3120
|
-
}
|
|
3121
|
-
/**
|
|
3122
|
-
* https://github.com/microsoft/vscode/blob/f7f05dee53fb33fe023db2e06e30a89d3094488f/src/vs/platform/theme/common/colorRegistry.ts#L258-L268
|
|
3123
|
-
*/
|
|
3124
|
-
var VSCODE_FALLBACK_EDITOR_FG = {
|
|
3125
|
-
light: "#333333",
|
|
3126
|
-
dark: "#bbbbbb"
|
|
3127
|
-
};
|
|
3128
|
-
var VSCODE_FALLBACK_EDITOR_BG = {
|
|
3129
|
-
light: "#fffffe",
|
|
3130
|
-
dark: "#1e1e1e"
|
|
3131
|
-
};
|
|
3132
|
-
var RESOLVED_KEY = "__shiki_resolved";
|
|
3133
|
-
/**
|
|
3134
|
-
* Normalize a textmate theme to shiki theme
|
|
2534
|
+
* Normalize a textmate theme to shiki theme
|
|
3135
2535
|
*/
|
|
3136
2536
|
function normalizeTheme(rawTheme) {
|
|
3137
2537
|
if (rawTheme?.[RESOLVED_KEY]) return rawTheme;
|
|
@@ -11076,905 +10476,457 @@ function createJavaScriptRegexEngine(options = {}) {
|
|
|
11076
10476
|
* 静态代码块与后续的 Monaco 编辑器必须共用这一个实例,避免两套主题色。
|
|
11077
10477
|
*/
|
|
11078
10478
|
var highlighterPromise = null;
|
|
11079
|
-
|
|
11080
|
-
|
|
10479
|
+
/**
|
|
10480
|
+
* 代码配色:浅色用 light-plus(VSCode 默认浅色)、深色用 tokyo-night。
|
|
10481
|
+
*
|
|
10482
|
+
* 早先用 vitesse-light / vitesse-dark(低彩度),在 13px 的代码块里
|
|
10483
|
+
* 标签名、属性名、字符串几乎一个色,看着像“没有高亮”;换成这两套后
|
|
10484
|
+
* token 色相分得开(粉 / 紫 / 绿 / 青),深色底 #1a1b26 也贴着外壳的 #16181d。
|
|
10485
|
+
*/
|
|
10486
|
+
var PW_THEME_LIGHT = "light-plus";
|
|
10487
|
+
var PW_THEME_DARK = "tokyo-night";
|
|
11081
10488
|
var getHighlighter = () => {
|
|
11082
10489
|
highlighterPromise ??= createHighlighterCore({
|
|
11083
|
-
themes: [import("./
|
|
10490
|
+
themes: [import("./light-plus-DuoQWI9Q.js"), import("./tokyo-night-A7e3DMsQ.js")],
|
|
11084
10491
|
langs: [
|
|
11085
|
-
import("./vue-
|
|
10492
|
+
import("./vue-B_A2yz16.js"),
|
|
11086
10493
|
import("./typescript-CqzjXQdw.js"),
|
|
11087
10494
|
import("./javascript-drpK16Ry.js"),
|
|
11088
10495
|
import("./css-CZhy9mCC.js"),
|
|
11089
|
-
import("./json-BRBnC4S4.js")
|
|
10496
|
+
import("./json-BRBnC4S4.js"),
|
|
10497
|
+
import("./less-DcFvX2iI.js"),
|
|
10498
|
+
import("./html-BheHDAwJ.js"),
|
|
10499
|
+
import("./bash-DXbFn1Mw.js"),
|
|
10500
|
+
import("./markdown-qYHfSPvL.js"),
|
|
10501
|
+
import("./yaml-CoEYOy4X.js"),
|
|
10502
|
+
import("./diff-BbCHXb9k.js")
|
|
11090
10503
|
],
|
|
11091
10504
|
engine: createJavaScriptRegexEngine()
|
|
11092
10505
|
});
|
|
11093
10506
|
return highlighterPromise;
|
|
11094
10507
|
};
|
|
11095
|
-
// src/
|
|
11096
|
-
|
|
11097
|
-
|
|
11098
|
-
|
|
11099
|
-
|
|
11100
|
-
|
|
11101
|
-
|
|
11102
|
-
|
|
11103
|
-
|
|
11104
|
-
|
|
11105
|
-
|
|
11106
|
-
|
|
11107
|
-
|
|
11108
|
-
|
|
11109
|
-
|
|
11110
|
-
|
|
11111
|
-
|
|
11112
|
-
},
|
|
11113
|
-
setup(__props) {
|
|
11114
|
-
const props = __props;
|
|
11115
|
-
const html = ref("");
|
|
11116
|
-
const state = ref("loading");
|
|
11117
|
-
const error = ref("");
|
|
11118
|
-
watch(() => [props.code, props.lang], async ([code, lang]) => {
|
|
11119
|
-
state.value = "loading";
|
|
11120
|
-
try {
|
|
11121
|
-
const highlighter = await getHighlighter();
|
|
11122
|
-
html.value = highlighter.codeToHtml(code, {
|
|
11123
|
-
lang,
|
|
11124
|
-
themes: {
|
|
11125
|
-
light: PW_THEME_LIGHT,
|
|
11126
|
-
dark: PW_THEME_DARK
|
|
11127
|
-
},
|
|
11128
|
-
defaultColor: false
|
|
11129
|
-
});
|
|
11130
|
-
state.value = "ready";
|
|
11131
|
-
} catch (err) {
|
|
11132
|
-
error.value = err instanceof Error ? err.message : String(err);
|
|
11133
|
-
state.value = "error";
|
|
11134
|
-
}
|
|
11135
|
-
}, { immediate: true });
|
|
11136
|
-
return (_ctx, _cache) => {
|
|
11137
|
-
return openBlock(), createElementBlock("div", _hoisted_1$6, [state.value === "loading" ? (openBlock(), createElementBlock("div", _hoisted_2$6, "高亮中…")) : state.value === "error" ? (openBlock(), createElementBlock("pre", _hoisted_3$6, toDisplayString(error.value), 1)) : (openBlock(), createElementBlock("div", {
|
|
11138
|
-
key: 2,
|
|
11139
|
-
class: "pw-code__body",
|
|
11140
|
-
innerHTML: html.value
|
|
11141
|
-
}, null, 8, _hoisted_4$6))]);
|
|
11142
|
-
};
|
|
11143
|
-
}
|
|
11144
|
-
}), [["__scopeId", "data-v-feddef62"]]);
|
|
11145
|
-
// src/app/PlaygroundParamsPanel.vue?vue&type=script&setup=true&lang.ts
|
|
11146
|
-
var _hoisted_1$5 = { class: "pw-params" };
|
|
11147
|
-
var _hoisted_2$5 = { class: "pw-params__head" };
|
|
11148
|
-
var _hoisted_3$5 = ["disabled"];
|
|
11149
|
-
var _hoisted_4$5 = ["disabled"];
|
|
11150
|
-
var _hoisted_5$5 = { class: "pw-params__body" };
|
|
11151
|
-
var _hoisted_6$3 = {
|
|
11152
|
-
key: 0,
|
|
11153
|
-
class: "pw-form"
|
|
11154
|
-
};
|
|
11155
|
-
var _hoisted_7$3 = ["title"];
|
|
11156
|
-
var _hoisted_8$1 = ["value", "onChange"];
|
|
11157
|
-
var _hoisted_9$1 = ["value"];
|
|
11158
|
-
var _hoisted_10 = {
|
|
11159
|
-
key: 0,
|
|
11160
|
-
class: "pw-params__hint"
|
|
11161
|
-
};
|
|
11162
|
-
var _hoisted_11 = {
|
|
11163
|
-
key: 1,
|
|
11164
|
-
class: "pw-params__output"
|
|
10508
|
+
// ../../node_modules/.pnpm/@lucide+vue@1.66.0_vue@3.5.44_typescript@5.9.3_/node_modules/@lucide/vue/dist/esm/shared/src/build/defaultAttributes.mjs
|
|
10509
|
+
/**
|
|
10510
|
+
* @license @lucide/vue v1.66.0 - ISC
|
|
10511
|
+
*
|
|
10512
|
+
* This source code is licensed under the ISC license.
|
|
10513
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
10514
|
+
*/
|
|
10515
|
+
var defaultAttributes = {
|
|
10516
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10517
|
+
width: 24,
|
|
10518
|
+
height: 24,
|
|
10519
|
+
viewBox: "0 0 24 24",
|
|
10520
|
+
fill: "none",
|
|
10521
|
+
stroke: "currentColor",
|
|
10522
|
+
"stroke-width": 2,
|
|
10523
|
+
"stroke-linecap": "round",
|
|
10524
|
+
"stroke-linejoin": "round"
|
|
11165
10525
|
};
|
|
11166
|
-
// src/
|
|
11167
|
-
|
|
11168
|
-
|
|
11169
|
-
|
|
11170
|
-
|
|
11171
|
-
|
|
11172
|
-
|
|
11173
|
-
|
|
11174
|
-
|
|
11175
|
-
|
|
11176
|
-
|
|
11177
|
-
|
|
11178
|
-
|
|
11179
|
-
|
|
11180
|
-
|
|
11181
|
-
|
|
11182
|
-
|
|
11183
|
-
|
|
11184
|
-
|
|
11185
|
-
|
|
11186
|
-
|
|
11187
|
-
|
|
11188
|
-
|
|
11189
|
-
|
|
11190
|
-
|
|
11191
|
-
|
|
11192
|
-
|
|
11193
|
-
|
|
11194
|
-
|
|
11195
|
-
|
|
11196
|
-
|
|
11197
|
-
|
|
11198
|
-
|
|
11199
|
-
|
|
11200
|
-
|
|
11201
|
-
|
|
11202
|
-
|
|
11203
|
-
|
|
11204
|
-
|
|
11205
|
-
|
|
11206
|
-
|
|
11207
|
-
|
|
11208
|
-
|
|
11209
|
-
|
|
11210
|
-
|
|
11211
|
-
|
|
11212
|
-
|
|
11213
|
-
|
|
11214
|
-
|
|
11215
|
-
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11219
|
-
|
|
11220
|
-
|
|
11221
|
-
|
|
11222
|
-
|
|
11223
|
-
|
|
11224
|
-
|
|
11225
|
-
|
|
11226
|
-
|
|
11227
|
-
|
|
11228
|
-
|
|
11229
|
-
|
|
11230
|
-
|
|
11231
|
-
|
|
11232
|
-
|
|
11233
|
-
|
|
11234
|
-
|
|
11235
|
-
|
|
11236
|
-
|
|
11237
|
-
|
|
11238
|
-
|
|
11239
|
-
|
|
11240
|
-
startPolling();
|
|
11241
|
-
onBeforeUnmount(() => {
|
|
11242
|
-
if (timer !== null) window.clearInterval(timer);
|
|
11243
|
-
});
|
|
11244
|
-
return (_ctx, _cache) => {
|
|
11245
|
-
return openBlock(), createElementBlock("aside", _hoisted_1$5, [createElementVNode("header", _hoisted_2$5, [
|
|
11246
|
-
createElementVNode("button", {
|
|
11247
|
-
type: "button",
|
|
11248
|
-
class: normalizeClass(["pw-params__tab", { "is-active": activeTab.value === "args" }]),
|
|
11249
|
-
disabled: !hasArgs.value,
|
|
11250
|
-
onClick: _cache[0] || (_cache[0] = ($event) => tab.value = "args")
|
|
11251
|
-
}, " 入参 ", 10, _hoisted_3$5),
|
|
11252
|
-
createElementVNode("button", {
|
|
11253
|
-
type: "button",
|
|
11254
|
-
class: normalizeClass(["pw-params__tab", { "is-active": activeTab.value === "output" }]),
|
|
11255
|
-
disabled: !hasOutput.value,
|
|
11256
|
-
onClick: _cache[1] || (_cache[1] = ($event) => tab.value = "output")
|
|
11257
|
-
}, " 出参 ", 10, _hoisted_4$5),
|
|
11258
|
-
_cache[2] || (_cache[2] = createElementVNode("span", { class: "pw-params__spacer" }, null, -1)),
|
|
11259
|
-
activeTab.value === "args" && hasArgs.value ? (openBlock(), createBlock(PwButton_default, {
|
|
11260
|
-
key: 0,
|
|
11261
|
-
size: "sm",
|
|
11262
|
-
variant: "text",
|
|
11263
|
-
title: "恢复默认值",
|
|
11264
|
-
onClick: resetArgs
|
|
11265
|
-
}, {
|
|
11266
|
-
icon: withCtx(() => [createVNode(unref(RotateCcw), { size: 13 })]),
|
|
11267
|
-
_: 1
|
|
11268
|
-
})) : createCommentVNode("", true)
|
|
11269
|
-
]), createElementVNode("div", _hoisted_5$5, [activeTab.value === "args" ? (openBlock(), createElementBlock("div", _hoisted_6$3, [(openBlock(true), createElementBlock(Fragment, null, renderList(fields.value, (field) => {
|
|
11270
|
-
return openBlock(), createElementBlock("div", {
|
|
11271
|
-
key: field.key,
|
|
11272
|
-
class: "pw-form__row"
|
|
11273
|
-
}, [createElementVNode("label", {
|
|
11274
|
-
class: "pw-form__label",
|
|
11275
|
-
title: field.key
|
|
11276
|
-
}, toDisplayString(field.label), 9, _hoisted_7$3), field.kind === "boolean" ? (openBlock(), createBlock(PwSwitch_default, {
|
|
11277
|
-
key: 0,
|
|
11278
|
-
"model-value": field.value === true,
|
|
11279
|
-
"onUpdate:modelValue": ($event) => setValue(field.key, $event)
|
|
11280
|
-
}, null, 8, ["model-value", "onUpdate:modelValue"])) : field.options ? (openBlock(), createElementBlock("select", {
|
|
11281
|
-
key: 1,
|
|
11282
|
-
class: "pw-form__select",
|
|
11283
|
-
value: String(field.value),
|
|
11284
|
-
onChange: ($event) => setString(field.key, $event.target.value)
|
|
11285
|
-
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(field.options, (option) => {
|
|
11286
|
-
return openBlock(), createElementBlock("option", {
|
|
11287
|
-
key: String(option),
|
|
11288
|
-
value: String(option)
|
|
11289
|
-
}, toDisplayString(option), 9, _hoisted_9$1);
|
|
11290
|
-
}), 128))], 40, _hoisted_8$1)) : (openBlock(), createBlock(PwInput_default, {
|
|
11291
|
-
key: 2,
|
|
11292
|
-
size: "sm",
|
|
11293
|
-
type: field.kind === "number" ? "number" : "text",
|
|
11294
|
-
"model-value": String(field.value ?? ""),
|
|
11295
|
-
"onUpdate:modelValue": ($event) => field.kind === "number" ? setNumber(field.key, $event) : setString(field.key, $event)
|
|
11296
|
-
}, null, 8, [
|
|
11297
|
-
"type",
|
|
11298
|
-
"model-value",
|
|
11299
|
-
"onUpdate:modelValue"
|
|
11300
|
-
]))]);
|
|
11301
|
-
}), 128)), !fields.value.length ? (openBlock(), createElementBlock("p", _hoisted_10, "该场景没有声明入参")) : createCommentVNode("", true)])) : (openBlock(), createElementBlock("div", _hoisted_11, [createVNode(CodeBlock_default, {
|
|
11302
|
-
code: outputText.value,
|
|
11303
|
-
lang: "json"
|
|
11304
|
-
}, null, 8, ["code"])]))])]);
|
|
11305
|
-
};
|
|
11306
|
-
}
|
|
11307
|
-
}), [["__scopeId", "data-v-7e91c8d4"]]);
|
|
11308
|
-
// src/app/PlaygroundSidebar.vue?vue&type=script&setup=true&lang.ts
|
|
11309
|
-
var _hoisted_1$4 = { class: "pw-sidebar" };
|
|
11310
|
-
var _hoisted_2$4 = { class: "pw-sidebar__brand" };
|
|
11311
|
-
var _hoisted_3$4 = { class: "pw-sidebar__title" };
|
|
11312
|
-
var _hoisted_4$4 = { class: "pw-sidebar__search" };
|
|
11313
|
-
var _hoisted_5$4 = { class: "pw-sidebar__nav" };
|
|
11314
|
-
var _hoisted_6$2 = { class: "pw-nav-group__title" };
|
|
11315
|
-
var _hoisted_7$2 = ["onClick"];
|
|
11316
|
-
var _hoisted_8 = {
|
|
11317
|
-
key: 0,
|
|
11318
|
-
class: "pw-sidebar__empty"
|
|
10526
|
+
// ../../node_modules/.pnpm/@lucide+vue@1.66.0_vue@3.5.44_typescript@5.9.3_/node_modules/@lucide/vue/dist/esm/shared/src/utils/mergeClasses.mjs
|
|
10527
|
+
/**
|
|
10528
|
+
* @license @lucide/vue v1.66.0 - ISC
|
|
10529
|
+
*
|
|
10530
|
+
* This source code is licensed under the ISC license.
|
|
10531
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
10532
|
+
*/
|
|
10533
|
+
var mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
|
10534
|
+
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
10535
|
+
}).join(" ").trim();
|
|
10536
|
+
// ../../node_modules/.pnpm/@lucide+vue@1.66.0_vue@3.5.44_typescript@5.9.3_/node_modules/@lucide/vue/dist/esm/shared/src/build/buildLucideIconNode.mjs
|
|
10537
|
+
/**
|
|
10538
|
+
* @license @lucide/vue v1.66.0 - ISC
|
|
10539
|
+
*
|
|
10540
|
+
* This source code is licensed under the ISC license.
|
|
10541
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
10542
|
+
*/
|
|
10543
|
+
function isDefined(value) {
|
|
10544
|
+
return value !== null && value !== void 0;
|
|
10545
|
+
}
|
|
10546
|
+
function buildLucideIconNode(icon, params = {}) {
|
|
10547
|
+
const attributeNames = params.attributeNames ?? {};
|
|
10548
|
+
const getAttributeName = (attributeName) => attributeNames[attributeName] ?? attributeName;
|
|
10549
|
+
const viewBoxWidth = icon.size ?? icon.width ?? defaultAttributes["width"];
|
|
10550
|
+
const viewBoxHeight = icon.size ?? icon.height ?? defaultAttributes["height"];
|
|
10551
|
+
const aliasClassNames = icon.aliases?.filter((alias) => typeof alias === "string" && alias.trim() !== "").map((alias) => `lucide-${alias}`) ?? [];
|
|
10552
|
+
const iconClassNames = [...icon.name ? [`lucide-${icon.name}`] : [], ...aliasClassNames];
|
|
10553
|
+
const classNamesFromClassName = params.className?.split(" ").filter(Boolean) ?? [];
|
|
10554
|
+
const className = params.includeDefaultClasses === false ? mergeClasses(...classNamesFromClassName) : mergeClasses("lucide", ...iconClassNames, ...classNamesFromClassName);
|
|
10555
|
+
const calculatedStrokeWidth = params.absoluteStrokeWidth ? Number(params.strokeWidth ?? defaultAttributes["stroke-width"]) * Number(icon.size ?? icon.width ?? defaultAttributes["width"]) / Number(params.size ?? params.width ?? defaultAttributes["width"]) : params.strokeWidth ?? defaultAttributes["stroke-width"];
|
|
10556
|
+
return [
|
|
10557
|
+
"svg",
|
|
10558
|
+
{
|
|
10559
|
+
...Object.entries(defaultAttributes).reduce((attrs, [attrName, value]) => {
|
|
10560
|
+
attrs[getAttributeName(attrName)] = value;
|
|
10561
|
+
return attrs;
|
|
10562
|
+
}, {}),
|
|
10563
|
+
..."color" in params && params.color && { [getAttributeName("stroke")]: params.color },
|
|
10564
|
+
..."size" in params && isDefined(params.size) && {
|
|
10565
|
+
[getAttributeName("width")]: params.size,
|
|
10566
|
+
[getAttributeName("height")]: params.size
|
|
10567
|
+
},
|
|
10568
|
+
..."width" in params && isDefined(params.width) && { [getAttributeName("width")]: params.width },
|
|
10569
|
+
..."height" in params && isDefined(params.height) && { [getAttributeName("height")]: params.height },
|
|
10570
|
+
[getAttributeName("stroke-width")]: calculatedStrokeWidth,
|
|
10571
|
+
...className && { [getAttributeName("class")]: className },
|
|
10572
|
+
[getAttributeName("viewBox")]: `0 0 ${viewBoxWidth} ${viewBoxHeight}`,
|
|
10573
|
+
...params.hasA11yProp === false ? { [getAttributeName("aria-hidden")]: "true" } : {},
|
|
10574
|
+
..."attributes" in params && params.attributes
|
|
10575
|
+
},
|
|
10576
|
+
icon.node.map((child) => {
|
|
10577
|
+
const [name, attrs, children] = child;
|
|
10578
|
+
const nextAttrs = params.nonScalingStroke ? {
|
|
10579
|
+
[getAttributeName("vector-effect")]: "non-scaling-stroke",
|
|
10580
|
+
...attrs
|
|
10581
|
+
} : attrs;
|
|
10582
|
+
return children ? [
|
|
10583
|
+
name,
|
|
10584
|
+
nextAttrs,
|
|
10585
|
+
children
|
|
10586
|
+
] : [name, nextAttrs];
|
|
10587
|
+
})
|
|
10588
|
+
];
|
|
10589
|
+
}
|
|
10590
|
+
// ../../node_modules/.pnpm/@lucide+vue@1.66.0_vue@3.5.44_typescript@5.9.3_/node_modules/@lucide/vue/dist/esm/shared/src/utils/hasA11yProp.mjs
|
|
10591
|
+
/**
|
|
10592
|
+
* @license @lucide/vue v1.66.0 - ISC
|
|
10593
|
+
*
|
|
10594
|
+
* This source code is licensed under the ISC license.
|
|
10595
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
10596
|
+
*/
|
|
10597
|
+
var hasA11yProp = (props) => {
|
|
10598
|
+
for (const prop in props) if (prop.startsWith("aria-") || prop === "role" || prop === "title") return true;
|
|
10599
|
+
return false;
|
|
11319
10600
|
};
|
|
11320
|
-
|
|
11321
|
-
|
|
11322
|
-
|
|
11323
|
-
|
|
11324
|
-
|
|
11325
|
-
|
|
11326
|
-
|
|
11327
|
-
|
|
11328
|
-
|
|
11329
|
-
|
|
11330
|
-
|
|
11331
|
-
|
|
11332
|
-
|
|
11333
|
-
|
|
11334
|
-
|
|
11335
|
-
|
|
11336
|
-
|
|
11337
|
-
|
|
11338
|
-
|
|
11339
|
-
|
|
11340
|
-
|
|
11341
|
-
|
|
11342
|
-
|
|
11343
|
-
|
|
11344
|
-
|
|
11345
|
-
|
|
11346
|
-
|
|
11347
|
-
|
|
11348
|
-
|
|
11349
|
-
|
|
11350
|
-
|
|
11351
|
-
|
|
11352
|
-
|
|
11353
|
-
|
|
11354
|
-
|
|
11355
|
-
|
|
11356
|
-
|
|
11357
|
-
|
|
11358
|
-
|
|
11359
|
-
|
|
11360
|
-
|
|
11361
|
-
|
|
11362
|
-
|
|
11363
|
-
|
|
11364
|
-
|
|
11365
|
-
|
|
11366
|
-
|
|
11367
|
-
|
|
11368
|
-
|
|
11369
|
-
|
|
11370
|
-
|
|
11371
|
-
|
|
11372
|
-
|
|
11373
|
-
|
|
11374
|
-
|
|
11375
|
-
|
|
11376
|
-
|
|
11377
|
-
onClick: ($event) => _ctx.$emit("select", item.id)
|
|
11378
|
-
}, toDisplayString(item.title), 11, _hoisted_7$2);
|
|
11379
|
-
}), 128))]);
|
|
11380
|
-
}), 128)), !filteredGroups.value.length ? (openBlock(), createElementBlock("p", _hoisted_8, "没有匹配的场景")) : createCommentVNode("", true)]),
|
|
11381
|
-
createElementVNode("footer", _hoisted_9, toDisplayString(__props.sceneCount) + " 个场景", 1)
|
|
11382
|
-
]);
|
|
11383
|
-
};
|
|
11384
|
-
}
|
|
11385
|
-
}), [["__scopeId", "data-v-826f64d4"]]);
|
|
11386
|
-
// src/code/monaco.ts
|
|
11387
|
-
/**
|
|
11388
|
-
* Monaco 单例:worker 环境只能设置一次,highlighter 也只注入一次。
|
|
11389
|
-
* 所有路径都是懒加载,首屏不会碰到编辑器代码。
|
|
11390
|
-
*/
|
|
11391
|
-
var loader = null;
|
|
11392
|
-
var PW_MONACO_LANGS = [
|
|
11393
|
-
"vue",
|
|
11394
|
-
"typescript",
|
|
11395
|
-
"javascript",
|
|
11396
|
-
"css",
|
|
11397
|
-
"html",
|
|
11398
|
-
"json",
|
|
11399
|
-
"less"
|
|
11400
|
-
];
|
|
11401
|
-
/** 不同打包链路下 @shikijs/monaco 可能以 default 形式出现,两种形态都接受 */
|
|
11402
|
-
var resolveShikiToMonaco = (mod) => {
|
|
11403
|
-
const candidate = mod;
|
|
11404
|
-
const inject = candidate.shikiToMonaco ?? candidate.default?.shikiToMonaco;
|
|
11405
|
-
if (typeof inject !== "function") throw new Error("@shikijs/monaco 未导出 shikiToMonaco");
|
|
11406
|
-
return inject;
|
|
10601
|
+
// ../../node_modules/.pnpm/@lucide+vue@1.66.0_vue@3.5.44_typescript@5.9.3_/node_modules/@lucide/vue/dist/esm/shared/src/utils/isEmptyString.mjs
|
|
10602
|
+
/**
|
|
10603
|
+
* @license @lucide/vue v1.66.0 - ISC
|
|
10604
|
+
*
|
|
10605
|
+
* This source code is licensed under the ISC license.
|
|
10606
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
10607
|
+
*/
|
|
10608
|
+
var isEmptyString = (value) => value === "";
|
|
10609
|
+
// ../../node_modules/.pnpm/@lucide+vue@1.66.0_vue@3.5.44_typescript@5.9.3_/node_modules/@lucide/vue/dist/esm/shared/src/utils/toKebabCase.mjs
|
|
10610
|
+
/**
|
|
10611
|
+
* @license @lucide/vue v1.66.0 - ISC
|
|
10612
|
+
*
|
|
10613
|
+
* This source code is licensed under the ISC license.
|
|
10614
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
10615
|
+
*/
|
|
10616
|
+
var toKebabCase = (string) => string?.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
10617
|
+
// ../../node_modules/.pnpm/@lucide+vue@1.66.0_vue@3.5.44_typescript@5.9.3_/node_modules/@lucide/vue/dist/esm/context.mjs
|
|
10618
|
+
/**
|
|
10619
|
+
* @license @lucide/vue v1.66.0 - ISC
|
|
10620
|
+
*
|
|
10621
|
+
* This source code is licensed under the ISC license.
|
|
10622
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
10623
|
+
*/
|
|
10624
|
+
var LUCIDE_CONTEXT = /* @__PURE__ */ Symbol("lucide-icons");
|
|
10625
|
+
function useLucideProps() {
|
|
10626
|
+
return inject(LUCIDE_CONTEXT, {});
|
|
10627
|
+
}
|
|
10628
|
+
// ../../node_modules/.pnpm/@lucide+vue@1.66.0_vue@3.5.44_typescript@5.9.3_/node_modules/@lucide/vue/dist/esm/Icon.mjs
|
|
10629
|
+
/**
|
|
10630
|
+
* @license @lucide/vue v1.66.0 - ISC
|
|
10631
|
+
*
|
|
10632
|
+
* This source code is licensed under the ISC license.
|
|
10633
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
10634
|
+
*/
|
|
10635
|
+
var Icon = ({ name, iconNode, "icon-node": iconNodeKebabCase, icon = {
|
|
10636
|
+
name: name && toKebabCase(name),
|
|
10637
|
+
node: iconNode ?? iconNodeKebabCase ?? [],
|
|
10638
|
+
size: 24,
|
|
10639
|
+
aliases: []
|
|
10640
|
+
}, absoluteStrokeWidth, "absolute-stroke-width": absoluteStrokeWidthKebabCase, nonScalingStroke, "non-scaling-stroke": nonScalingStrokeKebabCase, strokeWidth, "stroke-width": strokeWidthKebabCase, size, width = size, height = size, color, ...props }, { slots }) => {
|
|
10641
|
+
const { size: contextSize, color: contextColor, strokeWidth: contextStrokeWidth = 2, absoluteStrokeWidth: contextAbsoluteStrokeWidth = false, nonScalingStroke: contextNonScalingStroke = false, class: contextClass = "" } = useLucideProps();
|
|
10642
|
+
const isAbsoluteStrokeWidth = isEmptyString(absoluteStrokeWidth) || isEmptyString(absoluteStrokeWidthKebabCase) || absoluteStrokeWidth === true || absoluteStrokeWidthKebabCase === true || contextAbsoluteStrokeWidth === true;
|
|
10643
|
+
const isNonScalingStroke = isEmptyString(nonScalingStroke) || isEmptyString(nonScalingStrokeKebabCase) || nonScalingStroke === true || nonScalingStrokeKebabCase === true || contextNonScalingStroke === true;
|
|
10644
|
+
delete props.class;
|
|
10645
|
+
const defaultSlot = slots.default?.();
|
|
10646
|
+
const [, svgAttributes, builtIconNode = []] = buildLucideIconNode(icon, {
|
|
10647
|
+
color: color ?? contextColor,
|
|
10648
|
+
width: width ?? size ?? contextSize,
|
|
10649
|
+
height: height ?? size ?? contextSize,
|
|
10650
|
+
strokeWidth: strokeWidth ?? strokeWidthKebabCase ?? contextStrokeWidth,
|
|
10651
|
+
absoluteStrokeWidth: isAbsoluteStrokeWidth,
|
|
10652
|
+
nonScalingStroke: isNonScalingStroke,
|
|
10653
|
+
className: contextClass,
|
|
10654
|
+
hasA11yProp: defaultSlot != null && defaultSlot.length > 0 || hasA11yProp(props),
|
|
10655
|
+
attributes: props
|
|
10656
|
+
});
|
|
10657
|
+
return h("svg", svgAttributes, [...builtIconNode.map(([tag, attrs]) => h(tag, attrs)), ...defaultSlot ?? []]);
|
|
11407
10658
|
};
|
|
11408
|
-
|
|
11409
|
-
|
|
11410
|
-
|
|
11411
|
-
|
|
11412
|
-
|
|
11413
|
-
|
|
11414
|
-
|
|
11415
|
-
|
|
11416
|
-
|
|
11417
|
-
|
|
11418
|
-
|
|
11419
|
-
|
|
11420
|
-
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
|
|
11424
|
-
|
|
11425
|
-
|
|
10659
|
+
// ../../node_modules/.pnpm/@lucide+vue@1.66.0_vue@3.5.44_typescript@5.9.3_/node_modules/@lucide/vue/dist/esm/createLucideIcon.mjs
|
|
10660
|
+
/**
|
|
10661
|
+
* @license @lucide/vue v1.66.0 - ISC
|
|
10662
|
+
*
|
|
10663
|
+
* This source code is licensed under the ISC license.
|
|
10664
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
10665
|
+
*/
|
|
10666
|
+
function createLucideIcon(iconDataOrName, iconNode = []) {
|
|
10667
|
+
const icon = typeof iconDataOrName === "string" ? {
|
|
10668
|
+
name: iconDataOrName,
|
|
10669
|
+
node: iconNode
|
|
10670
|
+
} : iconDataOrName;
|
|
10671
|
+
return (props, { slots }) => h(Icon, {
|
|
10672
|
+
...props,
|
|
10673
|
+
icon
|
|
10674
|
+
}, slots.default ? { default: slots.default } : void 0);
|
|
10675
|
+
}
|
|
10676
|
+
// src/components/toast.ts
|
|
10677
|
+
var toastState = reactive([]);
|
|
10678
|
+
var seed = 0;
|
|
10679
|
+
/** 轻提示。用法:toast('已复制'), toast('保存失败', 'error') */
|
|
10680
|
+
var toast = (text, type = "info", duration = 2400) => {
|
|
10681
|
+
const id = ++seed;
|
|
10682
|
+
toastState.push({
|
|
10683
|
+
id,
|
|
10684
|
+
text,
|
|
10685
|
+
type
|
|
10686
|
+
});
|
|
10687
|
+
window.setTimeout(() => {
|
|
10688
|
+
const index = toastState.findIndex((item) => item.id === id);
|
|
10689
|
+
if (index > -1) toastState.splice(index, 1);
|
|
10690
|
+
}, duration);
|
|
11426
10691
|
};
|
|
11427
|
-
|
|
11428
|
-
|
|
10692
|
+
// src/payload/context.ts
|
|
10693
|
+
/** 当前场景标识:由 PlaygroundSceneSection 提供,`useSceneArgs` / `useSceneOutput` 用来标记归属 */
|
|
10694
|
+
var sceneContextKey = Symbol("rinova-playground:scene");
|
|
10695
|
+
var provideSceneContext = (name) => provide(sceneContextKey, name);
|
|
10696
|
+
/** 不在场景里调用(例如自己在别处挂组件)时返回空串 */
|
|
10697
|
+
var useSceneContext = () => inject(sceneContextKey, "");
|
|
10698
|
+
// src/payload/args.ts
|
|
10699
|
+
/** setup 期递增,保证面板里槽位顺序与代码里声明的顺序一致 */
|
|
10700
|
+
var seq$2 = 0;
|
|
10701
|
+
/** 当前场景挂载的全部输入槽位(同一时刻只有一个场景挂载) */
|
|
10702
|
+
var currentArgsSlots = shallowRef([]);
|
|
10703
|
+
/** 兼容旧接口:第一个槽位 */
|
|
10704
|
+
var currentArgs = computed(() => currentArgsSlots.value[0] ?? null);
|
|
10705
|
+
var sortSlots$1 = (list) => [...list].sort((a, b) => a.order - b.order);
|
|
10706
|
+
/**
|
|
10707
|
+
* 在场景的 `<script setup>` 里声明可变输入,返回响应式对象:
|
|
10708
|
+
* 面板改表单 → 这里同步变化 → 组件跟着重渲染。纯浏览器能力,生产环境同样可用。
|
|
10709
|
+
*
|
|
10710
|
+
* 一个场景里有多个 demo 时,各自调用一次并传 `slot` 区分:
|
|
10711
|
+
* ```ts
|
|
10712
|
+
* const primary = useSceneArgs({ size: 'md' }, { slot: '主按钮' })
|
|
10713
|
+
* const ghost = useSceneArgs({ size: 'sm' }, { slot: '次按钮' })
|
|
10714
|
+
* ```
|
|
10715
|
+
*/
|
|
10716
|
+
var useSceneArgs = (defaults, options = {}) => {
|
|
10717
|
+
const values = reactive({ ...defaults });
|
|
10718
|
+
const slot = {
|
|
10719
|
+
order: seq$2++,
|
|
10720
|
+
sceneId: useSceneContext(),
|
|
10721
|
+
key: options.slot ?? "default",
|
|
10722
|
+
label: options.slot ?? "",
|
|
10723
|
+
values,
|
|
10724
|
+
defaults: { ...defaults },
|
|
10725
|
+
options
|
|
10726
|
+
};
|
|
10727
|
+
onMounted(() => {
|
|
10728
|
+
currentArgsSlots.value = sortSlots$1([...currentArgsSlots.value, slot]);
|
|
10729
|
+
});
|
|
10730
|
+
onBeforeUnmount(() => {
|
|
10731
|
+
currentArgsSlots.value = currentArgsSlots.value.filter((item) => item !== slot);
|
|
10732
|
+
});
|
|
10733
|
+
return values;
|
|
11429
10734
|
};
|
|
11430
|
-
|
|
11431
|
-
|
|
11432
|
-
|
|
11433
|
-
|
|
11434
|
-
|
|
11435
|
-
|
|
11436
|
-
|
|
11437
|
-
|
|
11438
|
-
|
|
10735
|
+
// src/payload/output.ts
|
|
10736
|
+
/** setup 期递增,保证面板里顺序与声明顺序一致 */
|
|
10737
|
+
var seq$1 = 0;
|
|
10738
|
+
/** 当前场景挂载的全部输出槽位;由面板轮询调用,纯前端实现 */
|
|
10739
|
+
var currentOutputSlots = shallowRef([]);
|
|
10740
|
+
/** 兼容旧接口:第一个槽位 */
|
|
10741
|
+
var currentOutput = computed(() => currentOutputSlots.value[0]?.getter ?? null);
|
|
10742
|
+
var sortSlots = (list) => [...list].sort((a, b) => a.order - b.order);
|
|
10743
|
+
/**
|
|
10744
|
+
* 把场景里的响应式状态暴露成「输出」快照。
|
|
10745
|
+
* 一个场景多个 demo 时传 `slot` 区分,例如 `useSceneOutput(() => ({ ... }), '主按钮')`。
|
|
10746
|
+
*/
|
|
10747
|
+
var useSceneOutput = (getter, slot) => {
|
|
10748
|
+
const entry = {
|
|
10749
|
+
order: seq$1++,
|
|
10750
|
+
sceneId: useSceneContext(),
|
|
10751
|
+
key: slot ?? "default",
|
|
10752
|
+
label: slot ?? "",
|
|
10753
|
+
getter
|
|
10754
|
+
};
|
|
10755
|
+
onMounted(() => {
|
|
10756
|
+
currentOutputSlots.value = sortSlots([...currentOutputSlots.value, entry]);
|
|
10757
|
+
});
|
|
10758
|
+
onBeforeUnmount(() => {
|
|
10759
|
+
currentOutputSlots.value = currentOutputSlots.value.filter((item) => item !== entry);
|
|
10760
|
+
});
|
|
11439
10761
|
};
|
|
11440
|
-
// src/
|
|
11441
|
-
|
|
11442
|
-
|
|
11443
|
-
|
|
11444
|
-
|
|
11445
|
-
|
|
11446
|
-
|
|
11447
|
-
|
|
11448
|
-
|
|
11449
|
-
|
|
11450
|
-
|
|
11451
|
-
|
|
11452
|
-
|
|
11453
|
-
|
|
11454
|
-
|
|
11455
|
-
|
|
11456
|
-
|
|
11457
|
-
|
|
11458
|
-
|
|
11459
|
-
|
|
11460
|
-
|
|
11461
|
-
|
|
11462
|
-
|
|
11463
|
-
|
|
11464
|
-
|
|
11465
|
-
|
|
11466
|
-
|
|
11467
|
-
readOnly: props.readOnly,
|
|
11468
|
-
domReadOnly: props.readOnly,
|
|
11469
|
-
minimap: { enabled: false },
|
|
11470
|
-
lineNumbers: "on",
|
|
11471
|
-
folding: true,
|
|
11472
|
-
scrollBeyondLastLine: false,
|
|
11473
|
-
automaticLayout: false,
|
|
11474
|
-
fontSize: 12.5,
|
|
11475
|
-
lineHeight: 20,
|
|
11476
|
-
fontFamily: mono || "ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
11477
|
-
padding: {
|
|
11478
|
-
top: 12,
|
|
11479
|
-
bottom: 16
|
|
11480
|
-
},
|
|
11481
|
-
renderLineHighlight: "none",
|
|
11482
|
-
overviewRulerLanes: 0,
|
|
11483
|
-
scrollbar: {
|
|
11484
|
-
verticalScrollbarSize: 8,
|
|
11485
|
-
horizontalScrollbarSize: 8
|
|
11486
|
-
},
|
|
11487
|
-
contextmenu: true,
|
|
11488
|
-
wordWrap: "off",
|
|
11489
|
-
tabSize: 2
|
|
11490
|
-
};
|
|
11491
|
-
};
|
|
11492
|
-
onMounted(async () => {
|
|
11493
|
-
try {
|
|
11494
|
-
const monaco = await loadMonaco();
|
|
11495
|
-
monacoRef = monaco;
|
|
11496
|
-
if (!host.value) return;
|
|
11497
|
-
applyMonacoTheme(monaco, props.theme);
|
|
11498
|
-
editor = monaco.editor.create(host.value, options());
|
|
11499
|
-
const instance = editor;
|
|
11500
|
-
observer = new ResizeObserver(() => {
|
|
11501
|
-
const box = host.value?.getBoundingClientRect();
|
|
11502
|
-
if (!box || box.width === 0 || box.height === 0) return;
|
|
11503
|
-
instance.layout();
|
|
11504
|
-
});
|
|
11505
|
-
observer.observe(host.value);
|
|
11506
|
-
requestAnimationFrame(() => instance.layout());
|
|
11507
|
-
instance.onDidChangeModelContent(() => {
|
|
11508
|
-
if (applying) return;
|
|
11509
|
-
emit("update:modelValue", instance.getValue());
|
|
11510
|
-
});
|
|
11511
|
-
} catch (error) {
|
|
11512
|
-
const message = error instanceof Error ? `${error.name}: ${error.message}` : String(error);
|
|
11513
|
-
console.error("[rinova-playground] Monaco 启动失败,已降级为静态高亮:", message);
|
|
11514
|
-
emit("fail", message);
|
|
11515
|
-
}
|
|
11516
|
-
});
|
|
11517
|
-
watch(() => props.modelValue, (value) => {
|
|
11518
|
-
if (!editor || editor.getValue() === value) return;
|
|
11519
|
-
applying = true;
|
|
11520
|
-
editor.setValue(value);
|
|
11521
|
-
applying = false;
|
|
11522
|
-
});
|
|
11523
|
-
watch(() => props.filename, (file) => {
|
|
11524
|
-
const model = editor?.getModel();
|
|
11525
|
-
if (model && monacoRef) monacoRef.editor.setModelLanguage(model, langFromFile(file));
|
|
11526
|
-
});
|
|
11527
|
-
watch(() => props.readOnly, (value) => editor?.updateOptions({
|
|
11528
|
-
readOnly: value,
|
|
11529
|
-
domReadOnly: value
|
|
11530
|
-
}));
|
|
11531
|
-
watch(() => props.theme, (value) => {
|
|
11532
|
-
if (monacoRef) applyMonacoTheme(monacoRef, value);
|
|
11533
|
-
});
|
|
11534
|
-
onBeforeUnmount(() => {
|
|
11535
|
-
observer?.disconnect();
|
|
11536
|
-
editor?.getModel()?.dispose();
|
|
11537
|
-
editor?.dispose();
|
|
11538
|
-
editor = null;
|
|
11539
|
-
});
|
|
11540
|
-
return (_ctx, _cache) => {
|
|
11541
|
-
return openBlock(), createElementBlock("div", {
|
|
11542
|
-
ref_key: "host",
|
|
11543
|
-
ref: host,
|
|
11544
|
-
class: "pw-monaco"
|
|
11545
|
-
}, null, 512);
|
|
11546
|
-
};
|
|
11547
|
-
}
|
|
11548
|
-
}), [["__scopeId", "data-v-c45e6fcb"]]);
|
|
11549
|
-
// src/app/PlaygroundSourcePanel.vue?vue&type=script&setup=true&lang.ts
|
|
11550
|
-
var _hoisted_1$3 = { class: "pw-source" };
|
|
11551
|
-
var _hoisted_2$3 = { class: "pw-source__head" };
|
|
11552
|
-
var _hoisted_3$3 = { class: "pw-source__tabs" };
|
|
11553
|
-
var _hoisted_4$3 = ["title", "onClick"];
|
|
11554
|
-
var _hoisted_5$3 = { class: "pw-source__actions" };
|
|
11555
|
-
var _hoisted_6$1 = { class: "pw-source__body" };
|
|
11556
|
-
var _hoisted_7$1 = {
|
|
11557
|
-
key: 0,
|
|
11558
|
-
class: "pw-source__hint"
|
|
10762
|
+
// src/plugin.ts
|
|
10763
|
+
/**
|
|
10764
|
+
* 声明一个 playground 插件(只做类型收窄,没有运行时逻辑)。
|
|
10765
|
+
*
|
|
10766
|
+
* ```ts
|
|
10767
|
+
* export default [
|
|
10768
|
+
* definePlaygroundPlugin({ name: 'auth', async setup(ctx) { return { user } } }),
|
|
10769
|
+
* ]
|
|
10770
|
+
* ```
|
|
10771
|
+
*/
|
|
10772
|
+
var definePlaygroundPlugin = (plugin) => plugin;
|
|
10773
|
+
var headerSlots = shallowRef([]);
|
|
10774
|
+
var footerSlots = shallowRef([]);
|
|
10775
|
+
var wrapperEntries = shallowRef([]);
|
|
10776
|
+
var panelEntries = shallowRef([]);
|
|
10777
|
+
var openPanelId = shallowRef("");
|
|
10778
|
+
var envValues = shallowRef({});
|
|
10779
|
+
/** 插件 setup 的返回值,按插件名存 */
|
|
10780
|
+
var apis = /* @__PURE__ */ new Map();
|
|
10781
|
+
var pluginHeaderSlots = headerSlots;
|
|
10782
|
+
var pluginFooterSlots = footerSlots;
|
|
10783
|
+
var pluginWrapperEntries = wrapperEntries;
|
|
10784
|
+
var pluginPanelEntries = panelEntries;
|
|
10785
|
+
var pluginOpenPanelId = openPanelId;
|
|
10786
|
+
var sortEntries = (list) => [...list].sort((a, b) => a.order - b.order || a.key.localeCompare(b.key));
|
|
10787
|
+
var closePlaygroundPanel = () => {
|
|
10788
|
+
openPanelId.value = "";
|
|
11559
10789
|
};
|
|
11560
|
-
|
|
11561
|
-
|
|
11562
|
-
__name: "PlaygroundSourcePanel",
|
|
11563
|
-
props: {
|
|
11564
|
-
scene: {},
|
|
11565
|
-
theme: {}
|
|
11566
|
-
},
|
|
11567
|
-
emits: ["close"],
|
|
11568
|
-
setup(__props) {
|
|
11569
|
-
const props = __props;
|
|
11570
|
-
const activeIndex = ref(0);
|
|
11571
|
-
const text = ref("");
|
|
11572
|
-
const loading = ref(true);
|
|
11573
|
-
const failed = ref(false);
|
|
11574
|
-
const copied = ref(false);
|
|
11575
|
-
const cache = /* @__PURE__ */ new Map();
|
|
11576
|
-
const viewer = config.codeViewer ?? "monaco";
|
|
11577
|
-
const active = computed(() => props.scene.sources[activeIndex.value] ?? props.scene.sources[0]);
|
|
11578
|
-
const fileName = (file) => file.split("/").pop() ?? file;
|
|
11579
|
-
const load = async (index) => {
|
|
11580
|
-
const source = props.scene.sources[index];
|
|
11581
|
-
if (!source) return;
|
|
11582
|
-
loading.value = true;
|
|
11583
|
-
try {
|
|
11584
|
-
const content = cache.get(source.rel) ?? await source.raw();
|
|
11585
|
-
cache.set(source.rel, content);
|
|
11586
|
-
text.value = content;
|
|
11587
|
-
} catch (error) {
|
|
11588
|
-
toast(`源码读取失败:${error instanceof Error ? error.message : String(error)}`, "error");
|
|
11589
|
-
text.value = "";
|
|
11590
|
-
} finally {
|
|
11591
|
-
loading.value = false;
|
|
11592
|
-
}
|
|
11593
|
-
};
|
|
11594
|
-
watch(() => props.scene, () => {
|
|
11595
|
-
activeIndex.value = 0;
|
|
11596
|
-
load(0);
|
|
11597
|
-
}, { immediate: true });
|
|
11598
|
-
const select = (index) => {
|
|
11599
|
-
if (index === activeIndex.value) return;
|
|
11600
|
-
activeIndex.value = index;
|
|
11601
|
-
load(index);
|
|
11602
|
-
};
|
|
11603
|
-
const copy = async () => {
|
|
11604
|
-
try {
|
|
11605
|
-
await navigator.clipboard.writeText(text.value);
|
|
11606
|
-
copied.value = true;
|
|
11607
|
-
toast("已复制源码", "success");
|
|
11608
|
-
window.setTimeout(() => copied.value = false, 1500);
|
|
11609
|
-
} catch {
|
|
11610
|
-
toast("复制失败,请手动选择", "error");
|
|
11611
|
-
}
|
|
11612
|
-
};
|
|
11613
|
-
return (_ctx, _cache) => {
|
|
11614
|
-
return openBlock(), createElementBlock("section", _hoisted_1$3, [createElementVNode("header", _hoisted_2$3, [createElementVNode("div", _hoisted_3$3, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.scene.sources, (source, index) => {
|
|
11615
|
-
return openBlock(), createElementBlock("button", {
|
|
11616
|
-
key: source.rel,
|
|
11617
|
-
type: "button",
|
|
11618
|
-
class: normalizeClass(["pw-tab", { "is-active": index === activeIndex.value }]),
|
|
11619
|
-
title: source.rel,
|
|
11620
|
-
onClick: ($event) => select(index)
|
|
11621
|
-
}, toDisplayString(fileName(source.rel)), 11, _hoisted_4$3);
|
|
11622
|
-
}), 128))]), createElementVNode("div", _hoisted_5$3, [createVNode(PwButton_default, {
|
|
11623
|
-
size: "sm",
|
|
11624
|
-
variant: "text",
|
|
11625
|
-
title: copied.value ? "已复制" : "复制源码",
|
|
11626
|
-
onClick: copy
|
|
11627
|
-
}, {
|
|
11628
|
-
icon: withCtx(() => [copied.value ? (openBlock(), createBlock(unref(Check), {
|
|
11629
|
-
key: 0,
|
|
11630
|
-
size: 13
|
|
11631
|
-
})) : (openBlock(), createBlock(unref(Copy), {
|
|
11632
|
-
key: 1,
|
|
11633
|
-
size: 13
|
|
11634
|
-
}))]),
|
|
11635
|
-
_: 1
|
|
11636
|
-
}, 8, ["title"]), createVNode(PwButton_default, {
|
|
11637
|
-
size: "sm",
|
|
11638
|
-
variant: "text",
|
|
11639
|
-
title: "关闭(Esc)",
|
|
11640
|
-
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
|
|
11641
|
-
}, {
|
|
11642
|
-
icon: withCtx(() => [createVNode(unref(X$2), { size: 13 })]),
|
|
11643
|
-
_: 1
|
|
11644
|
-
})])]), createElementVNode("div", _hoisted_6$1, [loading.value ? (openBlock(), createElementBlock("span", _hoisted_7$1, "读取源码中…")) : active.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [unref(viewer) === "monaco" && !failed.value ? (openBlock(), createBlock(CodeEditor_default, {
|
|
11645
|
-
key: 0,
|
|
11646
|
-
"model-value": text.value,
|
|
11647
|
-
filename: active.value.rel,
|
|
11648
|
-
"read-only": "",
|
|
11649
|
-
theme: __props.theme,
|
|
11650
|
-
onFail: _cache[1] || (_cache[1] = ($event) => failed.value = true)
|
|
11651
|
-
}, null, 8, [
|
|
11652
|
-
"model-value",
|
|
11653
|
-
"filename",
|
|
11654
|
-
"theme"
|
|
11655
|
-
])) : (openBlock(), createBlock(CodeBlock_default, {
|
|
11656
|
-
key: 1,
|
|
11657
|
-
code: text.value,
|
|
11658
|
-
lang: unref(langFromFile)(active.value.rel)
|
|
11659
|
-
}, null, 8, ["code", "lang"]))], 64)) : createCommentVNode("", true)])]);
|
|
11660
|
-
};
|
|
11661
|
-
}
|
|
11662
|
-
}), [["__scopeId", "data-v-16eca20a"]]);
|
|
11663
|
-
// src/app/PlaygroundStage.vue?vue&type=script&setup=true&lang.ts
|
|
11664
|
-
var _hoisted_1$2 = { class: "pw-stage__frame" };
|
|
11665
|
-
var _hoisted_2$2 = {
|
|
11666
|
-
key: 0,
|
|
11667
|
-
class: "pw-stage__desc"
|
|
10790
|
+
var openPlaygroundPanel = (id) => {
|
|
10791
|
+
openPanelId.value = id;
|
|
11668
10792
|
};
|
|
11669
|
-
var
|
|
11670
|
-
|
|
11671
|
-
key: 0,
|
|
11672
|
-
class: "pw-stage__error"
|
|
10793
|
+
var togglePlaygroundPanel = (id) => {
|
|
10794
|
+
openPanelId.value = openPanelId.value === id ? "" : id;
|
|
11673
10795
|
};
|
|
11674
|
-
|
|
11675
|
-
|
|
11676
|
-
|
|
10796
|
+
/** 供插件自己的 UI 组件使用(也可以在 ctx.ui 里拿到句柄) */
|
|
10797
|
+
var usePlaygroundUi = () => ({
|
|
10798
|
+
openPanel: openPlaygroundPanel,
|
|
10799
|
+
closePanel: closePlaygroundPanel,
|
|
10800
|
+
togglePanel: togglePlaygroundPanel
|
|
10801
|
+
});
|
|
10802
|
+
/** 场景里读全局变量 + 插件返回值(`globals` 打底,插件按声明顺序覆盖) */
|
|
10803
|
+
var usePlaygroundEnv = () => envValues.value;
|
|
10804
|
+
/** 场景里读单个插件的返回值;插件不存在直接抛错,避免静默 undefined */
|
|
10805
|
+
var usePlaygroundPlugin = (name) => {
|
|
10806
|
+
if (!apis.has(name)) throw new Error(`[rinova-playground] 插件「${name}」未注册或初始化失败。检查 playground.config.ts 的 plugins 与该插件的 name。`);
|
|
10807
|
+
return apis.get(name);
|
|
11677
10808
|
};
|
|
11678
|
-
|
|
11679
|
-
var
|
|
11680
|
-
|
|
11681
|
-
props: {
|
|
11682
|
-
scene: {},
|
|
11683
|
-
width: {}
|
|
11684
|
-
},
|
|
11685
|
-
setup(__props) {
|
|
11686
|
-
const props = __props;
|
|
11687
|
-
const comp = shallowRef(null);
|
|
11688
|
-
const error = ref("");
|
|
11689
|
-
let token = 0;
|
|
11690
|
-
watch(() => props.scene, async (scene) => {
|
|
11691
|
-
const current = ++token;
|
|
11692
|
-
comp.value = null;
|
|
11693
|
-
error.value = "";
|
|
11694
|
-
try {
|
|
11695
|
-
const mod = await scene.load();
|
|
11696
|
-
if (current === token) comp.value = mod.default;
|
|
11697
|
-
} catch (err) {
|
|
11698
|
-
if (current === token) error.value = err instanceof Error ? err.message : String(err);
|
|
11699
|
-
}
|
|
11700
|
-
}, { immediate: true });
|
|
11701
|
-
return (_ctx, _cache) => {
|
|
11702
|
-
return openBlock(), createElementBlock("section", { class: normalizeClass(["pw-stage", `pw-stage--${__props.width}`]) }, [createElementVNode("div", _hoisted_1$2, [__props.scene.description ? (openBlock(), createElementBlock("p", _hoisted_2$2, toDisplayString(__props.scene.description), 1)) : createCommentVNode("", true), createElementVNode("div", _hoisted_3$2, [error.value ? (openBlock(), createElementBlock("p", _hoisted_4$2, [
|
|
11703
|
-
_cache[0] || (_cache[0] = createElementVNode("strong", null, "场景加载失败", -1)),
|
|
11704
|
-
createElementVNode("code", null, toDisplayString(__props.scene.rel), 1),
|
|
11705
|
-
createElementVNode("span", null, toDisplayString(error.value), 1)
|
|
11706
|
-
])) : comp.value ? (openBlock(), createBlock(resolveDynamicComponent(comp.value), { key: __props.scene.id })) : (openBlock(), createElementBlock("span", _hoisted_5$2, "加载中…"))])])], 2);
|
|
11707
|
-
};
|
|
11708
|
-
}
|
|
11709
|
-
}), [["__scopeId", "data-v-2c6f2a44"]]);
|
|
11710
|
-
// src/app/PlaygroundToolbar.vue?vue&type=script&setup=true&lang.ts
|
|
11711
|
-
var _hoisted_1$1 = { class: "pw-toolbar" };
|
|
11712
|
-
var _hoisted_2$1 = { class: "pw-toolbar__crumb" };
|
|
11713
|
-
var _hoisted_3$1 = { class: "pw-toolbar__group" };
|
|
11714
|
-
var _hoisted_4$1 = { class: "pw-toolbar__title" };
|
|
11715
|
-
var _hoisted_5$1 = { class: "pw-toolbar__actions" };
|
|
11716
|
-
var _hoisted_6 = {
|
|
11717
|
-
class: "pw-width-group",
|
|
11718
|
-
role: "group",
|
|
11719
|
-
"aria-label": "预览宽度"
|
|
10809
|
+
var themeKey = Symbol("rinova-playground:theme");
|
|
10810
|
+
var providePlaygroundTheme = (theme) => {
|
|
10811
|
+
provide(themeKey, theme);
|
|
11720
10812
|
};
|
|
11721
|
-
|
|
11722
|
-
|
|
11723
|
-
|
|
11724
|
-
|
|
11725
|
-
|
|
11726
|
-
|
|
11727
|
-
|
|
11728
|
-
|
|
11729
|
-
showPayload: { type: Boolean },
|
|
11730
|
-
hasPayload: { type: Boolean },
|
|
11731
|
-
width: {},
|
|
11732
|
-
theme: {}
|
|
11733
|
-
},
|
|
11734
|
-
emits: [
|
|
11735
|
-
"toggle-code",
|
|
11736
|
-
"toggle-payload",
|
|
11737
|
-
"update:width",
|
|
11738
|
-
"toggle-theme"
|
|
11739
|
-
],
|
|
11740
|
-
setup(__props, { emit: __emit }) {
|
|
11741
|
-
const emit = __emit;
|
|
11742
|
-
const widths = [
|
|
11743
|
-
{
|
|
11744
|
-
value: "auto",
|
|
11745
|
-
icon: Monitor,
|
|
11746
|
-
label: "自适应"
|
|
11747
|
-
},
|
|
11748
|
-
{
|
|
11749
|
-
value: "tablet",
|
|
11750
|
-
icon: Tablet,
|
|
11751
|
-
label: "平板 820px"
|
|
11752
|
-
},
|
|
11753
|
-
{
|
|
11754
|
-
value: "mobile",
|
|
11755
|
-
icon: Smartphone,
|
|
11756
|
-
label: "手机 420px"
|
|
11757
|
-
}
|
|
11758
|
-
];
|
|
11759
|
-
return (_ctx, _cache) => {
|
|
11760
|
-
return openBlock(), createElementBlock("header", _hoisted_1$1, [createElementVNode("div", _hoisted_2$1, [
|
|
11761
|
-
createElementVNode("span", _hoisted_3$1, toDisplayString(__props.group), 1),
|
|
11762
|
-
_cache[3] || (_cache[3] = createElementVNode("span", { class: "pw-toolbar__sep" }, "/", -1)),
|
|
11763
|
-
createElementVNode("span", _hoisted_4$1, toDisplayString(__props.title), 1)
|
|
11764
|
-
]), createElementVNode("div", _hoisted_5$1, [
|
|
11765
|
-
createElementVNode("div", _hoisted_6, [(openBlock(), createElementBlock(Fragment, null, renderList(widths, (item) => {
|
|
11766
|
-
return createElementVNode("button", {
|
|
11767
|
-
key: item.value,
|
|
11768
|
-
type: "button",
|
|
11769
|
-
class: normalizeClass(["pw-width-btn", { "is-active": __props.width === item.value }]),
|
|
11770
|
-
title: item.label,
|
|
11771
|
-
onClick: ($event) => emit("update:width", item.value)
|
|
11772
|
-
}, [(openBlock(), createBlock(resolveDynamicComponent(item.icon), { size: 14 }))], 10, _hoisted_7);
|
|
11773
|
-
}), 64))]),
|
|
11774
|
-
createVNode(PwButton_default, {
|
|
11775
|
-
size: "sm",
|
|
11776
|
-
title: __props.theme === "dark" ? "切换到浅色" : "切换到深色",
|
|
11777
|
-
onClick: _cache[0] || (_cache[0] = ($event) => emit("toggle-theme"))
|
|
11778
|
-
}, {
|
|
11779
|
-
icon: withCtx(() => [__props.theme === "light" ? (openBlock(), createBlock(unref(Moon), {
|
|
11780
|
-
key: 0,
|
|
11781
|
-
size: 14
|
|
11782
|
-
})) : (openBlock(), createBlock(unref(Sun), {
|
|
11783
|
-
key: 1,
|
|
11784
|
-
size: 14
|
|
11785
|
-
}))]),
|
|
11786
|
-
_: 1
|
|
11787
|
-
}, 8, ["title"]),
|
|
11788
|
-
createVNode(PwButton_default, {
|
|
11789
|
-
size: "sm",
|
|
11790
|
-
variant: __props.showPayload ? "primary" : "ghost",
|
|
11791
|
-
disabled: !__props.hasPayload,
|
|
11792
|
-
title: __props.hasPayload ? "入参 / 出参" : "该场景没有声明 sceneMeta 或 useScenePayload",
|
|
11793
|
-
onClick: _cache[1] || (_cache[1] = ($event) => emit("toggle-payload"))
|
|
11794
|
-
}, {
|
|
11795
|
-
icon: withCtx(() => [createVNode(unref(SlidersHorizontal), { size: 14 })]),
|
|
11796
|
-
default: withCtx(() => [_cache[4] || (_cache[4] = createTextVNode(" 参数 ", -1))]),
|
|
11797
|
-
_: 1
|
|
11798
|
-
}, 8, [
|
|
11799
|
-
"variant",
|
|
11800
|
-
"disabled",
|
|
11801
|
-
"title"
|
|
11802
|
-
]),
|
|
11803
|
-
createVNode(PwButton_default, {
|
|
11804
|
-
size: "sm",
|
|
11805
|
-
variant: __props.showCode ? "primary" : "ghost",
|
|
11806
|
-
onClick: _cache[2] || (_cache[2] = ($event) => emit("toggle-code"))
|
|
11807
|
-
}, {
|
|
11808
|
-
icon: withCtx(() => [createVNode(unref(CodeXml), { size: 14 })]),
|
|
11809
|
-
default: withCtx(() => [_cache[5] || (_cache[5] = createTextVNode(" 代码 ", -1))]),
|
|
11810
|
-
_: 1
|
|
11811
|
-
}, 8, ["variant"])
|
|
11812
|
-
])]);
|
|
11813
|
-
};
|
|
11814
|
-
}
|
|
11815
|
-
}), [["__scopeId", "data-v-b90c60a6"]]);
|
|
11816
|
-
// src/app/App.vue?vue&type=script&setup=true&lang.ts
|
|
11817
|
-
var _hoisted_1 = { class: "pw-app" };
|
|
11818
|
-
var _hoisted_2 = { class: "pw-main" };
|
|
11819
|
-
var _hoisted_3 = { class: "pw-body" };
|
|
11820
|
-
var _hoisted_4 = {
|
|
11821
|
-
key: 1,
|
|
11822
|
-
class: "pw-empty"
|
|
10813
|
+
/**
|
|
10814
|
+
* 插件 UI 跟随外壳主题。框架不替第三方库切 `dark` class,
|
|
10815
|
+
* 这里只给当前值,怎么用由插件决定。
|
|
10816
|
+
*/
|
|
10817
|
+
var usePlaygroundTheme = () => {
|
|
10818
|
+
const injected = inject(themeKey, null);
|
|
10819
|
+
if (injected) return injected;
|
|
10820
|
+
return computed(() => document.documentElement.dataset.pwTheme === "dark" ? "dark" : "light");
|
|
11823
10821
|
};
|
|
11824
|
-
var
|
|
11825
|
-
|
|
11826
|
-
|
|
10822
|
+
var describeError = (error) => error instanceof Error ? error.message : String(error);
|
|
10823
|
+
var pluginError = (plugin, error) => {
|
|
10824
|
+
const next = /* @__PURE__ */ new Error(`[rinova-playground] 插件「${plugin}」初始化失败:${describeError(error)}`);
|
|
10825
|
+
next.name = "PlaygroundPluginError";
|
|
10826
|
+
if (error instanceof Error && error.stack) next.stack = `${next.message}\n${error.stack}`;
|
|
10827
|
+
return next;
|
|
11827
10828
|
};
|
|
11828
|
-
|
|
11829
|
-
|
|
11830
|
-
|
|
11831
|
-
|
|
11832
|
-
|
|
11833
|
-
|
|
11834
|
-
|
|
11835
|
-
|
|
11836
|
-
|
|
11837
|
-
|
|
11838
|
-
|
|
11839
|
-
|
|
11840
|
-
|
|
11841
|
-
|
|
11842
|
-
|
|
11843
|
-
|
|
11844
|
-
|
|
11845
|
-
|
|
11846
|
-
|
|
11847
|
-
|
|
11848
|
-
const
|
|
11849
|
-
|
|
11850
|
-
|
|
11851
|
-
|
|
11852
|
-
|
|
11853
|
-
|
|
11854
|
-
|
|
11855
|
-
|
|
11856
|
-
});
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
|
|
11860
|
-
|
|
11861
|
-
|
|
11862
|
-
|
|
11863
|
-
|
|
11864
|
-
|
|
11865
|
-
|
|
11866
|
-
|
|
11867
|
-
|
|
11868
|
-
|
|
11869
|
-
|
|
11870
|
-
preference.value = theme.value === "dark" ? "light" : "dark";
|
|
11871
|
-
localStorage.setItem(STORAGE_KEY, preference.value);
|
|
11872
|
-
};
|
|
11873
|
-
const basePath = (() => {
|
|
11874
|
-
const raw = config.routeBase ?? config.base ?? "/";
|
|
11875
|
-
return raw.endsWith("/") ? raw : `${raw}/`;
|
|
11876
|
-
})();
|
|
11877
|
-
/** 从 location.pathname 解析出场景 id(去掉 base 与尾部斜杠) */
|
|
11878
|
-
const sceneIdFromPath = () => {
|
|
11879
|
-
const path = decodeURIComponent(window.location.pathname);
|
|
11880
|
-
return (path.startsWith(basePath) ? path.slice(basePath.length) : path.replace(/^\//, "")).replace(/\/+$/, "");
|
|
11881
|
-
};
|
|
11882
|
-
const readLocation = () => {
|
|
11883
|
-
const id = sceneIdFromPath();
|
|
11884
|
-
if (id && scenes.some((scene) => scene.id === id)) activeId.value = id;
|
|
10829
|
+
/**
|
|
10830
|
+
* 依次加载插件模块并串行执行 setup。
|
|
10831
|
+
*
|
|
10832
|
+
* 串行而不是并行:后一个插件经常要读前一个的结果(请求层依赖登录态)。
|
|
10833
|
+
* 全部完成前 `PlaygroundRoot` 不渲染 App,所以场景挂载时环境一定就绪。
|
|
10834
|
+
*/
|
|
10835
|
+
var runPlugins = async (options) => {
|
|
10836
|
+
const { app, config, scenes, modules } = options;
|
|
10837
|
+
if (!modules.length) return;
|
|
10838
|
+
const globals = { ...config.globals ?? {} };
|
|
10839
|
+
const merged = { ...globals };
|
|
10840
|
+
const queue = [];
|
|
10841
|
+
for (const load of modules) {
|
|
10842
|
+
let loaded;
|
|
10843
|
+
try {
|
|
10844
|
+
loaded = await load();
|
|
10845
|
+
} catch (error) {
|
|
10846
|
+
throw pluginError("(模块加载)", error);
|
|
10847
|
+
}
|
|
10848
|
+
const value = loaded && typeof loaded === "object" && "default" in loaded ? loaded.default : loaded;
|
|
10849
|
+
for (const item of Array.isArray(value) ? value : [value]) {
|
|
10850
|
+
const plugin = item;
|
|
10851
|
+
if (!plugin || typeof plugin !== "object" || typeof plugin.name !== "string" || !plugin.name) throw new Error("[rinova-playground] 插件模块必须默认导出 definePlaygroundPlugin(...) 或它的数组,且每项都要有 name");
|
|
10852
|
+
queue.push(plugin);
|
|
10853
|
+
}
|
|
10854
|
+
}
|
|
10855
|
+
const seen = /* @__PURE__ */ new Set();
|
|
10856
|
+
for (const plugin of queue) {
|
|
10857
|
+
if (seen.has(plugin.name)) throw new Error(`[rinova-playground] 插件名重复:「${plugin.name}」`);
|
|
10858
|
+
seen.add(plugin.name);
|
|
10859
|
+
}
|
|
10860
|
+
const createContext = (plugin) => {
|
|
10861
|
+
const uiEntry = (options_, slot) => {
|
|
10862
|
+
const entry = {
|
|
10863
|
+
key: `${plugin.name}:${slot}:${nextSeq()}`,
|
|
10864
|
+
plugin: plugin.name,
|
|
10865
|
+
component: options_.component,
|
|
10866
|
+
props: options_.props,
|
|
10867
|
+
order: options_.order ?? Number.MAX_SAFE_INTEGER
|
|
10868
|
+
};
|
|
10869
|
+
if (slot === "header") headerSlots.value = sortEntries([...headerSlots.value, entry]);
|
|
10870
|
+
else footerSlots.value = sortEntries([...footerSlots.value, entry]);
|
|
11885
10871
|
};
|
|
11886
|
-
|
|
11887
|
-
|
|
11888
|
-
|
|
11889
|
-
|
|
11890
|
-
|
|
11891
|
-
|
|
11892
|
-
|
|
11893
|
-
|
|
11894
|
-
|
|
11895
|
-
|
|
11896
|
-
|
|
11897
|
-
|
|
11898
|
-
|
|
11899
|
-
|
|
11900
|
-
|
|
10872
|
+
return {
|
|
10873
|
+
app,
|
|
10874
|
+
config,
|
|
10875
|
+
globals,
|
|
10876
|
+
scenes,
|
|
10877
|
+
get: (name) => apis.get(name),
|
|
10878
|
+
wrap: (component, props) => {
|
|
10879
|
+
wrapperEntries.value = [...wrapperEntries.value, {
|
|
10880
|
+
key: `${plugin.name}:wrap:${nextSeq()}`,
|
|
10881
|
+
plugin: plugin.name,
|
|
10882
|
+
component,
|
|
10883
|
+
props,
|
|
10884
|
+
order: wrapperEntries.value.length
|
|
10885
|
+
}];
|
|
10886
|
+
},
|
|
10887
|
+
ui: {
|
|
10888
|
+
header: (entry) => uiEntry(entry, "header"),
|
|
10889
|
+
sidebarFooter: (entry) => uiEntry(entry, "footer"),
|
|
10890
|
+
panel: (entry) => {
|
|
10891
|
+
const panel = {
|
|
10892
|
+
key: `${plugin.name}:panel:${entry.id}`,
|
|
10893
|
+
plugin: plugin.name,
|
|
10894
|
+
id: entry.id,
|
|
10895
|
+
title: entry.title,
|
|
10896
|
+
component: entry.component,
|
|
10897
|
+
props: entry.props,
|
|
10898
|
+
order: entry.order ?? Number.MAX_SAFE_INTEGER
|
|
10899
|
+
};
|
|
10900
|
+
panelEntries.value = sortEntries([...panelEntries.value, panel]);
|
|
10901
|
+
return {
|
|
10902
|
+
id: entry.id,
|
|
10903
|
+
open: () => openPlaygroundPanel(entry.id),
|
|
10904
|
+
close: () => closePlaygroundPanel(),
|
|
10905
|
+
toggle: () => togglePlaygroundPanel(entry.id)
|
|
10906
|
+
};
|
|
10907
|
+
}
|
|
11901
10908
|
}
|
|
11902
|
-
if (event.key === "Escape" && showCode.value) showCode.value = false;
|
|
11903
|
-
};
|
|
11904
|
-
const media = window.matchMedia("(prefers-color-scheme: dark)");
|
|
11905
|
-
const onMediaChange = (event) => {
|
|
11906
|
-
systemDark.value = event.matches;
|
|
11907
|
-
};
|
|
11908
|
-
onMounted(() => {
|
|
11909
|
-
document.title = title;
|
|
11910
|
-
systemDark.value = media.matches;
|
|
11911
|
-
media.addEventListener("change", onMediaChange);
|
|
11912
|
-
readLocation();
|
|
11913
|
-
if (activeId.value && sceneIdFromPath() !== activeId.value) window.history.replaceState(null, "", `${basePath}${activeId.value}`);
|
|
11914
|
-
window.addEventListener("popstate", readLocation);
|
|
11915
|
-
window.addEventListener("keydown", onKeydown);
|
|
11916
|
-
});
|
|
11917
|
-
onBeforeUnmount(() => {
|
|
11918
|
-
media.removeEventListener("change", onMediaChange);
|
|
11919
|
-
window.removeEventListener("popstate", readLocation);
|
|
11920
|
-
window.removeEventListener("keydown", onKeydown);
|
|
11921
|
-
});
|
|
11922
|
-
return (_ctx, _cache) => {
|
|
11923
|
-
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
11924
|
-
createVNode(PlaygroundSidebar_default, {
|
|
11925
|
-
ref_key: "sidebarRef",
|
|
11926
|
-
ref: sidebarRef,
|
|
11927
|
-
title: unref(title),
|
|
11928
|
-
groups: groups.value,
|
|
11929
|
-
"active-id": activeId.value,
|
|
11930
|
-
"scene-count": visibleCount.value,
|
|
11931
|
-
onSelect: _cache[0] || (_cache[0] = ($event) => activeId.value = $event)
|
|
11932
|
-
}, null, 8, [
|
|
11933
|
-
"title",
|
|
11934
|
-
"groups",
|
|
11935
|
-
"active-id",
|
|
11936
|
-
"scene-count"
|
|
11937
|
-
]),
|
|
11938
|
-
createElementVNode("main", _hoisted_2, [
|
|
11939
|
-
activeScene.value ? (openBlock(), createBlock(PlaygroundToolbar_default, {
|
|
11940
|
-
key: 0,
|
|
11941
|
-
group: activeScene.value.group,
|
|
11942
|
-
title: activeScene.value.title,
|
|
11943
|
-
"show-code": showCode.value,
|
|
11944
|
-
"show-payload": showPayload.value,
|
|
11945
|
-
"has-payload": hasPayload.value,
|
|
11946
|
-
width: width.value,
|
|
11947
|
-
theme: theme.value,
|
|
11948
|
-
onToggleCode: _cache[1] || (_cache[1] = ($event) => showCode.value = !showCode.value),
|
|
11949
|
-
onTogglePayload: _cache[2] || (_cache[2] = ($event) => showPayload.value = !showPayload.value),
|
|
11950
|
-
"onUpdate:width": _cache[3] || (_cache[3] = ($event) => width.value = $event),
|
|
11951
|
-
onToggleTheme: toggleTheme
|
|
11952
|
-
}, null, 8, [
|
|
11953
|
-
"group",
|
|
11954
|
-
"title",
|
|
11955
|
-
"show-code",
|
|
11956
|
-
"show-payload",
|
|
11957
|
-
"has-payload",
|
|
11958
|
-
"width",
|
|
11959
|
-
"theme"
|
|
11960
|
-
])) : createCommentVNode("", true),
|
|
11961
|
-
createElementVNode("div", _hoisted_3, [activeScene.value ? (openBlock(), createBlock(PlaygroundStage_default, {
|
|
11962
|
-
key: 0,
|
|
11963
|
-
scene: activeScene.value,
|
|
11964
|
-
width: width.value
|
|
11965
|
-
}, null, 8, ["scene", "width"])) : (openBlock(), createElementBlock("div", _hoisted_4, "没有找到任何场景,请在 scenes 目录下新建 .vue 文件。")), showPayload.value && hasPayload.value ? (openBlock(), createBlock(PlaygroundParamsPanel_default, {
|
|
11966
|
-
key: 2,
|
|
11967
|
-
theme: theme.value
|
|
11968
|
-
}, null, 8, ["theme"])) : createCommentVNode("", true)]),
|
|
11969
|
-
showCode.value && activeScene.value ? (openBlock(), createElementBlock("div", _hoisted_5, [createVNode(PlaygroundSourcePanel_default, {
|
|
11970
|
-
scene: activeScene.value,
|
|
11971
|
-
theme: theme.value,
|
|
11972
|
-
onClose: _cache[4] || (_cache[4] = ($event) => showCode.value = false)
|
|
11973
|
-
}, null, 8, ["scene", "theme"])])) : createCommentVNode("", true)
|
|
11974
|
-
]),
|
|
11975
|
-
createVNode(PwToastHost_default)
|
|
11976
|
-
]);
|
|
11977
10909
|
};
|
|
10910
|
+
};
|
|
10911
|
+
for (const plugin of queue) try {
|
|
10912
|
+
const result = await plugin.setup?.(createContext(plugin));
|
|
10913
|
+
if (result !== void 0) {
|
|
10914
|
+
apis.set(plugin.name, result);
|
|
10915
|
+
if (result && typeof result === "object") Object.assign(merged, result);
|
|
10916
|
+
}
|
|
10917
|
+
} catch (error) {
|
|
10918
|
+
if (plugin.optional) {
|
|
10919
|
+
console.warn(`[rinova-playground] 可选插件「${plugin.name}」初始化失败,已跳过:`, describeError(error));
|
|
10920
|
+
continue;
|
|
10921
|
+
}
|
|
10922
|
+
throw pluginError(plugin.name, error);
|
|
11978
10923
|
}
|
|
11979
|
-
|
|
11980
|
-
|
|
10924
|
+
envValues.value = merged;
|
|
10925
|
+
};
|
|
10926
|
+
/** 注册序号:同一插件注册多个缝位时保证排序稳定 */
|
|
10927
|
+
var seq = 0;
|
|
10928
|
+
var nextSeq = () => {
|
|
10929
|
+
seq += 1;
|
|
10930
|
+
return seq;
|
|
10931
|
+
};
|
|
10932
|
+
export { _plugin_vue_export_helper_default as A, toast as C, PW_THEME_LIGHT as D, PW_THEME_DARK as E, getHighlighter as O, provideSceneContext as S, createLucideIcon as T, currentOutputSlots as _, pluginHeaderSlots as a, currentArgsSlots as b, pluginWrapperEntries as c, togglePlaygroundPanel as d, usePlaygroundEnv as f, currentOutput as g, usePlaygroundUi as h, pluginFooterSlots as i, PwApiBrief_default as k, providePlaygroundTheme as l, usePlaygroundTheme as m, definePlaygroundPlugin as n, pluginOpenPanelId as o, usePlaygroundPlugin as p, openPlaygroundPanel as r, pluginPanelEntries as s, closePlaygroundPanel as t, runPlugins as u, useSceneOutput as v, toastState as w, useSceneArgs as x, currentArgs as y };
|