@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.
Files changed (81) hide show
  1. package/README.md +23 -6
  2. package/dist/PlaygroundRoot-Bcq7hG6m.js +4114 -0
  3. package/dist/bash-DXbFn1Mw.js +2 -0
  4. package/dist/diff-BbCHXb9k.js +2 -0
  5. package/dist/html-BheHDAwJ.js +10 -0
  6. package/dist/index.js +646 -5
  7. package/dist/less-DcFvX2iI.js +2 -0
  8. package/dist/light-plus-DuoQWI9Q.js +3 -0
  9. package/dist/markdown-qYHfSPvL.js +2 -0
  10. package/dist/marked.esm-CNYX-ybC.js +1796 -0
  11. package/dist/{App-BzlvncHB.js → plugin-S72dg7Tb.js} +560 -1608
  12. package/dist/style.css +2880 -9004
  13. package/dist/tokyo-night-A7e3DMsQ.js +3 -0
  14. package/dist/types/app/App.vue.d.ts +1 -0
  15. package/dist/types/app/PlaygroundApiTable.vue.d.ts +16 -0
  16. package/dist/types/app/PlaygroundEditorPicker.vue.d.ts +3 -0
  17. package/dist/types/app/PlaygroundModuleApi.vue.d.ts +17 -0
  18. package/dist/types/app/PlaygroundPage.vue.d.ts +30 -0
  19. package/dist/types/app/{PlaygroundSourcePanel.vue.d.ts → PlaygroundPageIndex.vue.d.ts} +4 -4
  20. package/dist/types/app/PlaygroundPluginPanel.vue.d.ts +3 -0
  21. package/dist/types/app/PlaygroundPluginSlot.vue.d.ts +12 -0
  22. package/dist/types/app/PlaygroundPluginWrappers.vue.d.ts +25 -0
  23. package/dist/types/app/PlaygroundRoot.vue.d.ts +4 -0
  24. package/dist/types/app/{PlaygroundParamsPanel.vue.d.ts → PlaygroundSceneArgs.vue.d.ts} +1 -1
  25. package/dist/types/app/PlaygroundSceneOutput.vue.d.ts +6 -0
  26. package/dist/types/app/PlaygroundSceneSection.vue.d.ts +16 -0
  27. package/dist/types/app/{PlaygroundStage.vue.d.ts → PlaygroundSceneSource.vue.d.ts} +0 -1
  28. package/dist/types/app/PlaygroundSidebar.vue.d.ts +19 -8
  29. package/dist/types/app/viewport.d.ts +39 -0
  30. package/dist/types/code/CodeBlock.vue.d.ts +19 -1
  31. package/dist/types/code/clipboard.d.ts +2 -0
  32. package/dist/types/code/find.d.ts +42 -0
  33. package/dist/types/code/highlighter.d.ts +9 -2
  34. package/dist/types/code/openInEditor.d.ts +35 -0
  35. package/dist/types/components/PwApiBrief.vue.d.ts +16 -0
  36. package/dist/types/components/PwButton.vue.d.ts +2 -2
  37. package/dist/types/components/PwDemo.vue.d.ts +39 -0
  38. package/dist/types/components/PwDemoGrid.vue.d.ts +32 -0
  39. package/dist/types/components/PwInput.vue.d.ts +8 -8
  40. package/dist/types/components/PwSceneBoundary.vue.d.ts +20 -0
  41. package/dist/types/components/PwSceneNote.vue.d.ts +19 -0
  42. package/dist/types/components/PwTooltip.vue.d.ts +3 -0
  43. package/dist/types/components/prose/PwCallout.vue.d.ts +24 -0
  44. package/dist/types/components/prose/PwMarkdown.vue.d.ts +11 -0
  45. package/dist/types/components/prose/PwProse.vue.d.ts +27 -0
  46. package/dist/types/components/prose/PwStep.vue.d.ts +27 -0
  47. package/dist/types/components/prose/PwSteps.vue.d.ts +26 -0
  48. package/dist/types/components/prose/enhance.d.ts +4 -0
  49. package/dist/types/components/prose/index.d.ts +7 -0
  50. package/dist/types/components/prose/markdown-scene.d.ts +10 -0
  51. package/dist/types/components/prose/parse.d.ts +20 -0
  52. package/dist/types/components/prose/render.d.ts +22 -0
  53. package/dist/types/components/scene.d.ts +5 -0
  54. package/dist/types/config.d.ts +43 -5
  55. package/dist/types/index.d.ts +15 -8
  56. package/dist/types/module-api.d.ts +55 -0
  57. package/dist/types/payload/args.d.ts +22 -3
  58. package/dist/types/payload/context.d.ts +3 -0
  59. package/dist/types/payload/output.d.ts +18 -3
  60. package/dist/types/plugin.d.ts +119 -0
  61. package/dist/types/scene-meta.d.ts +38 -3
  62. package/dist/types/shims.d.ts +26 -5
  63. package/dist/types/types.d.ts +107 -15
  64. package/dist/vue-B_A2yz16.js +30 -0
  65. package/dist/yaml-CoEYOy4X.js +2 -0
  66. package/package.json +3 -4
  67. package/dist/assets/editor.worker-G4Kxf7Y6.js +0 -15827
  68. package/dist/assets/ts.worker-Dee0cZZb.js +0 -164076
  69. package/dist/dist-CiAXGmAo.js +0 -151
  70. package/dist/editor.api-6f2aPN2V.js +0 -126730
  71. package/dist/editor.worker-VDFPHiZj.js +0 -5
  72. package/dist/monaco.contribution-jrnupplv.js +0 -220
  73. package/dist/output-Dx3ubog9.js +0 -51
  74. package/dist/ts.worker-CpQm_d0w.js +0 -5
  75. package/dist/tsMode-C6DRwdZC.js +0 -52173
  76. package/dist/types/app/PlaygroundToolbar.vue.d.ts +0 -22
  77. package/dist/types/code/CodeEditor.vue.d.ts +0 -18
  78. package/dist/types/code/monaco.d.ts +0 -6
  79. package/dist/vitesse-dark-B9O9KI0c.js +0 -3
  80. package/dist/vitesse-light-Cs2DYTIe.js +0 -3
  81. package/dist/vue-tjAT-6a9.js +0 -36
@@ -0,0 +1,32 @@
1
+ /**
2
+ * 场景内 Demo 栅格。两种排法:
3
+ * - `columns` 固定列数(1–4),窄屏折成单列;
4
+ * - `min` 给每列最小宽度,放不下自动折行(优先于 columns)。
5
+ */
6
+ type __VLS_Props = {
7
+ /** 固定列数,默认 1 */
8
+ columns?: 1 | 2 | 3 | 4;
9
+ /** 每列最小宽度(px);大于 0 时改用 auto-fit,忽略 columns */
10
+ min?: number;
11
+ /** 间距,默认 md */
12
+ gap?: 'sm' | 'md' | 'lg';
13
+ };
14
+ declare const __VLS_template: () => {
15
+ __VLS_Slots: {
16
+ default?: (props: {}) => any;
17
+ };
18
+ };
19
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
20
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
21
+ columns: 1 | 2 | 3 | 4;
22
+ min: number;
23
+ gap: "md" | "sm" | "lg";
24
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
25
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
26
+ declare const _default: typeof __VLS_export;
27
+ export default _default;
28
+ type __VLS_WithSlots<T, S> = T & {
29
+ new (): {
30
+ $slots: S;
31
+ };
32
+ };
@@ -17,21 +17,21 @@ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
17
17
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
18
18
  focus: () => void | undefined;
19
19
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
- "update:modelValue": (value: string) => any;
21
- keydown: (event: KeyboardEvent) => any;
22
- focus: (event: FocusEvent) => any;
23
20
  blur: (event: FocusEvent) => any;
21
+ focus: (event: FocusEvent) => any;
22
+ keydown: (event: KeyboardEvent) => any;
23
+ "update:modelValue": (value: string) => any;
24
24
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
25
- "onUpdate:modelValue"?: ((value: string) => any) | undefined;
26
- onKeydown?: ((event: KeyboardEvent) => any) | undefined;
27
- onFocus?: ((event: FocusEvent) => any) | undefined;
28
25
  onBlur?: ((event: FocusEvent) => any) | undefined;
26
+ onFocus?: ((event: FocusEvent) => any) | undefined;
27
+ onKeydown?: ((event: KeyboardEvent) => any) | undefined;
28
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
29
29
  }>, {
30
30
  type: "number" | "text";
31
- size: "sm" | "md";
31
+ autofocus: boolean;
32
+ size: "md" | "sm";
32
33
  modelValue: string;
33
34
  clearable: boolean;
34
- autofocus: boolean;
35
35
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
36
36
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
37
37
  declare const _default: typeof __VLS_export;
@@ -0,0 +1,20 @@
1
+ /** 场景错误边界:一个场景抛错只替换这一块,整页与其它场景继续可用 */
2
+ type __VLS_Props = {
3
+ title?: string;
4
+ file?: string;
5
+ };
6
+ declare const __VLS_template: () => {
7
+ __VLS_Slots: {
8
+ default?: (props: {}) => any;
9
+ };
10
+ };
11
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
12
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
16
+ type __VLS_WithSlots<T, S> = T & {
17
+ new (): {
18
+ $slots: S;
19
+ };
20
+ };
@@ -0,0 +1,19 @@
1
+ /** 场景内说明块(引用样式) */
2
+ type __VLS_Props = {
3
+ text?: string;
4
+ };
5
+ declare const __VLS_template: () => {
6
+ __VLS_Slots: {
7
+ default?: (props: {}) => any;
8
+ };
9
+ };
10
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
11
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
15
+ type __VLS_WithSlots<T, S> = T & {
16
+ new (): {
17
+ $slots: S;
18
+ };
19
+ };
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,24 @@
1
+ type __VLS_Props = {
2
+ /** 语义:info 说明 / tip 建议 / warn 警告 / danger 危险 */
3
+ tone?: 'info' | 'tip' | 'warn' | 'danger';
4
+ /** 小标题,留空则只有正文 */
5
+ title?: string;
6
+ };
7
+ declare const __VLS_template: () => {
8
+ __VLS_Slots: {
9
+ default?: (props: {}) => any;
10
+ };
11
+ };
12
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
13
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
14
+ title: string;
15
+ tone: "info" | "tip" | "warn" | "danger";
16
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
18
+ declare const _default: typeof __VLS_export;
19
+ export default _default;
20
+ type __VLS_WithSlots<T, S> = T & {
21
+ new (): {
22
+ $slots: S;
23
+ };
24
+ };
@@ -0,0 +1,11 @@
1
+ type __VLS_Props = {
2
+ /** Markdown 原文 */
3
+ source: string;
4
+ /** 正文宽度,默认 720px */
5
+ width?: string;
6
+ };
7
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
8
+ width: string;
9
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;
@@ -0,0 +1,27 @@
1
+ type __VLS_Props = {
2
+ /** 大标题(可选,通常是页标题或场景标题) */
3
+ title?: string;
4
+ /** 标题下的一行引导语 */
5
+ lead?: string;
6
+ /** 正文宽度,默认 720px */
7
+ width?: string;
8
+ };
9
+ declare const __VLS_template: () => {
10
+ __VLS_Slots: {
11
+ default?: (props: {}) => any;
12
+ };
13
+ };
14
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
15
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
16
+ title: string;
17
+ lead: string;
18
+ width: string;
19
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
21
+ declare const _default: typeof __VLS_export;
22
+ export default _default;
23
+ type __VLS_WithSlots<T, S> = T & {
24
+ new (): {
25
+ $slots: S;
26
+ };
27
+ };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * 单条步骤,放在 `PwSteps` 里使用;标题可选,正文走默认插槽。
3
+ */
4
+ type __VLS_Props = {
5
+ /** 加粗的步骤标题 */
6
+ title?: string;
7
+ /** 步骤下的一句说明 */
8
+ description?: string;
9
+ };
10
+ declare const __VLS_template: () => {
11
+ __VLS_Slots: {
12
+ default?: (props: {}) => any;
13
+ };
14
+ };
15
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
16
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
17
+ title: string;
18
+ description: string;
19
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
21
+ declare const _default: typeof __VLS_export;
22
+ export default _default;
23
+ type __VLS_WithSlots<T, S> = T & {
24
+ new (): {
25
+ $slots: S;
26
+ };
27
+ };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * 步骤列表:按顺序讲一件事时用,序号由 CSS 计数器生成,增删条目不用改编号。
3
+ *
4
+ * Markdown 里写 `::: steps` + 有序列表,渲染出来是同一个组件。
5
+ */
6
+ type __VLS_Props = {
7
+ /** 起始序号,默认 1 */
8
+ start?: number;
9
+ };
10
+ declare const __VLS_template: () => {
11
+ __VLS_Slots: {
12
+ default?: (props: {}) => any;
13
+ };
14
+ };
15
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
16
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
17
+ start: number;
18
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
20
+ declare const _default: typeof __VLS_export;
21
+ export default _default;
22
+ type __VLS_WithSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -0,0 +1,4 @@
1
+ /** 增强 root 下所有还没处理过的代码块 */
2
+ export declare const enhanceCodeBlocks: (root: HTMLElement | null) => Promise<void>;
3
+ /** 复制按钮的点击:由容器统一代理(`v-html` 里的节点绑不了 Vue 事件) */
4
+ export declare const handleCopyClick: (event: MouseEvent) => Promise<void>;
@@ -0,0 +1,7 @@
1
+ /** 文档排版能力:内容页(介绍 / 指南)里直接用,Markdown 场景内部也走同一套 */
2
+ export { default as PwProse } from './PwProse.vue';
3
+ export { default as PwCallout } from './PwCallout.vue';
4
+ export { default as PwSteps } from './PwSteps.vue';
5
+ export { default as PwStep } from './PwStep.vue';
6
+ export { default as PwMarkdown } from './PwMarkdown.vue';
7
+ export type { CalloutTone, MarkdownBlock } from './render';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * 把一个 Markdown 场景包成组件:插件扫描到 `.md` 文件时调用。
3
+ *
4
+ * ```ts
5
+ * load: () => import('./guide.md?raw').then((mod) => ({ default: defineMarkdownScene(mod.default) }))
6
+ * ```
7
+ */
8
+ export declare const defineMarkdownScene: (source: string) => import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
9
+ [key: string]: any;
10
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Markdown 解析(不依赖任何渲染库,会被 verify 直接单测)。
3
+ *
4
+ * 产物是「区块列表」:普通 Markdown、提示块、步骤块。
5
+ * 真正的 Markdown → HTML 交给 marked,见 `render.ts`。
6
+ */
7
+ export type CalloutTone = 'info' | 'tip' | 'warn' | 'danger';
8
+ export declare const TONE_LABEL: Record<CalloutTone, string>;
9
+ export interface MarkdownBlockRaw {
10
+ kind: 'md' | 'callout' | 'steps';
11
+ tone?: CalloutTone;
12
+ title?: string;
13
+ text: string;
14
+ }
15
+ /** 去掉 `---` 头(内容由插件解析成 pageMeta / sceneMeta,渲染时不该出现) */
16
+ export declare const stripFrontmatter: (source: string) => string;
17
+ /** 极简 frontmatter 解析:`key: value` 与 `key: [a, b]`,够声明标题 / 排序 / 标签用 */
18
+ export declare const parseFrontmatter: (source: string) => Record<string, string | string[]>;
19
+ /** 把正文切成「普通 Markdown / 提示块 / 步骤块」,容器不支持嵌套 */
20
+ export declare const splitBlocks: (body: string) => MarkdownBlockRaw[];
@@ -0,0 +1,22 @@
1
+ import { parseFrontmatter, type CalloutTone } from './parse';
2
+ export type { CalloutTone } from './parse';
3
+ export type MarkdownBlock = {
4
+ kind: 'html';
5
+ html: string;
6
+ } | {
7
+ kind: 'callout';
8
+ tone: CalloutTone;
9
+ title: string;
10
+ html: string;
11
+ } | {
12
+ kind: 'steps';
13
+ items: string[];
14
+ };
15
+ /**
16
+ * 把 Markdown 原文渲染成区块列表。
17
+ *
18
+ * 这里只做 Markdown → HTML;语法高亮、语言角标与复制按钮统一交给 `enhance.ts`
19
+ * (和手写内容页 `PwProse` 走同一段逻辑)。marked 按需加载,页面里没有 `.md` 场景时不会下载。
20
+ */
21
+ export declare const renderMarkdown: (source: string) => Promise<MarkdownBlock[]>;
22
+ export { parseFrontmatter };
@@ -0,0 +1,5 @@
1
+ /** 场景布局原语:一场景多 Demo 时用,未使用时场景就是普通 SFC */
2
+ export { default as PwDemoGrid } from './PwDemoGrid.vue';
3
+ export { default as PwDemo } from './PwDemo.vue';
4
+ export { default as PwSceneNote } from './PwSceneNote.vue';
5
+ export { default as PwApiBrief } from './PwApiBrief.vue';
@@ -1,6 +1,5 @@
1
1
  /** playground 的唯一配置入口。 */
2
2
  export type PlaygroundUiTheme = 'light' | 'dark' | 'auto';
3
- export type PlaygroundCodeViewer = 'monaco' | 'shiki';
4
3
  export interface PlaygroundConfig {
5
4
  /** 品牌标题,默认取 package.json 的 name */
6
5
  title?: string;
@@ -8,13 +7,15 @@ export interface PlaygroundConfig {
8
7
  scenes?: string;
9
8
  /** 是否展示源码面板,默认 true */
10
9
  sources?: boolean;
11
- /** 代码区实现:可编辑编辑器 / 只读高亮块,默认 'monaco' */
12
- codeViewer?: PlaygroundCodeViewer;
13
10
  theme?: {
14
11
  /** 外壳主题(12 个 CSS 变量),默认 'auto' */
15
12
  ui?: PlaygroundUiTheme;
16
- /** 代码区 shiki 主题名,默认 'vitesse-dark' */
17
- code?: string;
13
+ /**
14
+ * 演示画布主题,默认 'light'。
15
+ * 很多组件库只实现了浅色,画布固定浅色可以避免在暗色外壳里渲染成黑底黑字;
16
+ * 'auto' 表示跟随外壳。
17
+ */
18
+ stage?: PlaygroundUiTheme;
18
19
  };
19
20
  /** 扫描时排除的 glob(相对 scenes 根) */
20
21
  exclude?: string[];
@@ -30,7 +31,44 @@ export interface PlaygroundConfig {
30
31
  port?: number;
31
32
  /** 契约清单要扫描的组件 glob(如 src/components 下所有 .vue);不配则不生成 manifest */
32
33
  components?: string[];
34
+ /**
35
+ * 非组件模块 glob(如 `src/lib/**` + `/*.ts`):函数 / hooks / 常量的契约。
36
+ * 抽出来的内容进 API 页签的「函数 / 常量」表,并写进 manifest / llms.txt。
37
+ */
38
+ modules?: string[];
33
39
  /** 组件契约提取用的 tsconfig,默认项目根的 tsconfig.json */
34
40
  tsconfig?: string;
41
+ /**
42
+ * 供场景读取的纯常量(如 apiBase / appName)。
43
+ * ⚠️ 会明文进构建产物、任何人都能看到,禁止放 token / 密钥,这类值必须走插件运行时获取。
44
+ * 场景里用 `usePlaygroundEnv()` 读取;插件返回值会覆盖同名字段。
45
+ */
46
+ globals?: Record<string, unknown>;
47
+ /**
48
+ * 运行时插件模块路径,如 `['./src/playground/plugins.ts']`。
49
+ * 只接受路径而不是内联对象:配置会 `JSON.stringify` 进虚拟模块,函数无法序列化。
50
+ * 规则:`./x` 相对项目根;`/x` 与 `@/x` 原样交给 Vite。
51
+ */
52
+ plugins?: string[];
53
+ /**
54
+ * 分组(scenes 下的一级目录名)→ 侧栏显示名。
55
+ * 例如 `{ 'tao-common': 'Tao 通用组件' }`;不配时用目录名首字母大写化。
56
+ */
57
+ groups?: Record<string, string>;
58
+ /** 本地 IDE 打开:preset 决定用哪个编辑器的 URL scheme */
59
+ editor?: {
60
+ /** 'vscode' | 'cursor' | 'webstorm' | 'custom' */
61
+ preset?: 'vscode' | 'cursor' | 'webstorm' | 'custom';
62
+ /** preset = 'custom' 时的模板,支持 {file} / {line} */
63
+ custom?: string;
64
+ /** 是否把项目根绝对路径写进产物,默认 true;对外发布时设为 false(按钮降级为复制路径) */
65
+ exposeRoot?: boolean;
66
+ /** 访问者能否在按钮里自己换编辑器,默认 true */
67
+ allowChoice?: boolean;
68
+ /** 可选的编辑器列表,默认内置的常用几个(vscode/cursor/windsurf/trae/zed/webstorm/idea/sublime) */
69
+ options?: string[];
70
+ /** 是否允许访问者填自定义协议模板(任意 IDE),默认 true */
71
+ allowCustom?: boolean;
72
+ };
35
73
  }
36
74
  export declare const defineConfig: (config: PlaygroundConfig) => PlaygroundConfig;
@@ -1,14 +1,21 @@
1
1
  /// <reference path="./shims.d.ts" />
2
2
  export { defineConfig } from './config';
3
- export type { PlaygroundConfig, PlaygroundCodeViewer, PlaygroundUiTheme } from './config';
4
- export { defineSceneMeta } from './scene-meta';
5
- export type { SceneMeta } from './scene-meta';
6
- export type { SceneDescriptor } from './types';
3
+ export type { PlaygroundConfig, PlaygroundUiTheme } from './config';
4
+ export { defineSceneMeta, definePageMeta } from './scene-meta';
5
+ export type { SceneMeta, PageMeta } from './scene-meta';
6
+ export type { SceneDescriptor, PageDescriptor, SceneSection } from './types';
7
+ export { PwDemoGrid, PwDemo, PwSceneNote, PwApiBrief } from './components/scene';
8
+ export { PwProse, PwCallout, PwSteps, PwStep, PwMarkdown } from './components/prose';
9
+ export type { CalloutTone, MarkdownBlock } from './components/prose';
10
+ export { defineMarkdownScene } from './components/prose/markdown-scene';
7
11
  export { toast } from './components/toast';
8
- export { useSceneArgs, currentArgs } from './payload/args';
9
- export type { SceneArgs, SceneArgsOptions } from './payload/args';
10
- export { useSceneOutput, currentOutput } from './payload/output';
11
- export type { SceneSnapshot } from './payload/output';
12
+ export { useSceneArgs, currentArgs, currentArgsSlots } from './payload/args';
13
+ export type { SceneArgs, SceneArgsOptions, SceneArgsBinding } from './payload/args';
14
+ export { useSceneOutput, currentOutput, currentOutputSlots } from './payload/output';
15
+ export type { SceneSnapshot, SceneOutputBinding } from './payload/output';
16
+ export { definePlaygroundPlugin } from './plugin';
17
+ export type { PlaygroundPlugin, PlaygroundPluginContext, PlaygroundResolvedConfig, PlaygroundUiApi, PlaygroundUiOptions, PlaygroundPanelOptions, PlaygroundPanelHandle, } from './plugin';
18
+ export { usePlaygroundEnv, usePlaygroundPlugin, usePlaygroundTheme, usePlaygroundUi, openPlaygroundPanel, closePlaygroundPanel, togglePlaygroundPanel, } from './plugin';
12
19
  export interface CreatePlaygroundOptions {
13
20
  /** 挂载点,默认 `#app` */
14
21
  el?: string | HTMLElement;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * 非组件文件(纯函数 / hooks / 常量)的契约。
3
+ * 由 `@rinova/playground-vite` 用 TypeScript 编译器 API 抽取,写进 `.playground/manifest.json`;
4
+ * 这里的类型与 `packages/playground-vite/src/module-api.ts` 同构 —— manifest.json 就是那条契约。
5
+ */
6
+ export interface ModuleParam {
7
+ name: string;
8
+ type: string;
9
+ optional: boolean;
10
+ /** 源码里的默认值原文,没有就是空串 */
11
+ default: string;
12
+ description: string;
13
+ }
14
+ export interface ModuleFunction {
15
+ name: string;
16
+ /** 名字以 use + 大写开头即为 hook */
17
+ kind: 'function' | 'hook';
18
+ /** `formatMoney(value: number, options?: FormatMoneyOptions): string` */
19
+ signature: string;
20
+ params: ModuleParam[];
21
+ returns: string;
22
+ description: string;
23
+ /** 有没有场景引用过这个名字 */
24
+ covered: boolean;
25
+ /** 引用过这个名字的场景 id */
26
+ coveredBy?: string[];
27
+ }
28
+ export interface ModuleConstant {
29
+ name: string;
30
+ type: string;
31
+ /** 短值直接给原文,长的留空 */
32
+ value: string;
33
+ description: string;
34
+ covered: boolean;
35
+ /** 引用过这个名字的场景 id */
36
+ coveredBy?: string[];
37
+ }
38
+ export interface ModuleType {
39
+ name: string;
40
+ kind: 'interface' | 'type';
41
+ file: string;
42
+ code: string;
43
+ }
44
+ export interface ModuleApi {
45
+ /** 文件名去掉扩展名,如 `money` */
46
+ name: string;
47
+ rel: string;
48
+ functions: ModuleFunction[];
49
+ constants: ModuleConstant[];
50
+ types: ModuleType[];
51
+ /** 引用了这个模块的场景 id */
52
+ scenes: string[];
53
+ /** 没有任何场景提到的导出名 */
54
+ uncovered: string[];
55
+ }
@@ -4,16 +4,35 @@ export interface SceneArgsOptions {
4
4
  options?: Record<string, Array<string | number>>;
5
5
  /** 字段标签,缺省用 key */
6
6
  labels?: Record<string, string>;
7
+ /**
8
+ * 槽位名。一个场景里多次调用 `useSceneArgs` 时,每块输入各占一个槽位,
9
+ * 面板按名字分块显示。只调用一次时可以省略。
10
+ */
11
+ slot?: string;
7
12
  }
8
13
  export interface SceneArgsBinding {
14
+ /** 槽位标识,缺省 `default` */
15
+ key: string;
16
+ /** 归属场景(页内多场景时只显示当前场景的槽位) */
17
+ sceneId: string;
18
+ /** 面板上显示的名字,等于 `options.slot` */
19
+ label: string;
9
20
  values: SceneArgs;
10
21
  defaults: SceneArgs;
11
22
  options: SceneArgsOptions;
12
23
  }
13
- /** 同一时刻只有一个场景挂载,所以只需要一个"当前入参"槽位 */
14
- export declare const currentArgs: import("vue").ShallowRef<SceneArgsBinding | null, SceneArgsBinding | null>;
24
+ /** 当前场景挂载的全部输入槽位(同一时刻只有一个场景挂载) */
25
+ export declare const currentArgsSlots: import("vue").ShallowRef<SceneArgsBinding[], SceneArgsBinding[]>;
26
+ /** 兼容旧接口:第一个槽位 */
27
+ export declare const currentArgs: import("vue").ComputedRef<SceneArgsBinding | null>;
15
28
  /**
16
- * 在场景的 `<script setup>` 里声明可变入参,返回响应式对象:
29
+ * 在场景的 `<script setup>` 里声明可变输入,返回响应式对象:
17
30
  * 面板改表单 → 这里同步变化 → 组件跟着重渲染。纯浏览器能力,生产环境同样可用。
31
+ *
32
+ * 一个场景里有多个 demo 时,各自调用一次并传 `slot` 区分:
33
+ * ```ts
34
+ * const primary = useSceneArgs({ size: 'md' }, { slot: '主按钮' })
35
+ * const ghost = useSceneArgs({ size: 'sm' }, { slot: '次按钮' })
36
+ * ```
18
37
  */
19
38
  export declare const useSceneArgs: <T extends SceneArgs>(defaults: T, options?: SceneArgsOptions) => T;
@@ -0,0 +1,3 @@
1
+ export declare const provideSceneContext: (name: string) => void;
2
+ /** 不在场景里调用(例如自己在别处挂组件)时返回空串 */
3
+ export declare const useSceneContext: () => string;
@@ -1,4 +1,19 @@
1
1
  export type SceneSnapshot = Record<string, unknown>;
2
- /** 出参快照:由面板轮询调用,纯前端实现 */
3
- export declare const currentOutput: import("vue").ShallowRef<(() => SceneSnapshot) | null, (() => SceneSnapshot) | null>;
4
- export declare const useSceneOutput: (getter: () => SceneSnapshot) => void;
2
+ export interface SceneOutputBinding {
3
+ /** 槽位标识,缺省 `default` */
4
+ key: string;
5
+ /** 归属场景(页内多场景时只显示当前场景的槽位) */
6
+ sceneId: string;
7
+ /** 面板上显示的名字,等于传进来的 slot */
8
+ label: string;
9
+ getter: () => SceneSnapshot;
10
+ }
11
+ /** 当前场景挂载的全部输出槽位;由面板轮询调用,纯前端实现 */
12
+ export declare const currentOutputSlots: import("vue").ShallowRef<SceneOutputBinding[], SceneOutputBinding[]>;
13
+ /** 兼容旧接口:第一个槽位 */
14
+ export declare const currentOutput: import("vue").ComputedRef<(() => SceneSnapshot) | null>;
15
+ /**
16
+ * 把场景里的响应式状态暴露成「输出」快照。
17
+ * 一个场景多个 demo 时传 `slot` 区分,例如 `useSceneOutput(() => ({ ... }), '主按钮')`。
18
+ */
19
+ export declare const useSceneOutput: (getter: () => SceneSnapshot, slot?: string) => void;