@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
@@ -1,151 +0,0 @@
1
- import { n as FontStyle, r as INITIAL, t as EncodedTokenMetadata } from "./App-BzlvncHB.js";
2
- // ../../node_modules/.pnpm/@shikijs+monaco@4.6.0/node_modules/@shikijs/monaco/dist/index.mjs
3
- var TokenizerState = class TokenizerState {
4
- _ruleStack;
5
- constructor(_ruleStack) {
6
- this._ruleStack = _ruleStack;
7
- }
8
- get ruleStack() {
9
- return this._ruleStack;
10
- }
11
- clone() {
12
- return new TokenizerState(this._ruleStack);
13
- }
14
- equals(other) {
15
- if (!other || !(other instanceof TokenizerState) || other !== this || other._ruleStack !== this._ruleStack) return false;
16
- return true;
17
- }
18
- };
19
- function normalizeColor(color) {
20
- if (Array.isArray(color)) color = color[0];
21
- if (!color) return void 0;
22
- color = (color.charCodeAt(0) === 35 ? color.slice(1) : color).toLowerCase();
23
- if (color.length === 3 || color.length === 4) color = color.split("").map((c) => c + c).join("");
24
- return color;
25
- }
26
- var RE_FONT_STYLE_SPLIT = /[\s,]+/;
27
- function textmateThemeToMonacoTheme(theme) {
28
- let rules = "rules" in theme ? theme.rules : void 0;
29
- if (!rules) {
30
- rules = [];
31
- const themeSettings = theme.settings || theme.tokenColors;
32
- for (const { scope, settings: { foreground, background, fontStyle } = {} } of themeSettings) {
33
- if (!foreground && !background && !fontStyle) continue;
34
- const scopes = Array.isArray(scope) ? scope : scope ? [scope] : [];
35
- const normalizedFontStyle = normalizeFontStyleString(fontStyle);
36
- const normalizedForeground = normalizeColor(foreground);
37
- const normalizedBackground = normalizeColor(background);
38
- rules.push(...scopes.map((s) => ({
39
- token: s,
40
- foreground: normalizedForeground,
41
- background: normalizedBackground,
42
- fontStyle: normalizedFontStyle
43
- })));
44
- }
45
- }
46
- const colors = Object.fromEntries(Object.entries(theme.colors || {}).map(([key, value]) => [key, `#${normalizeColor(value)}`]));
47
- return {
48
- base: theme.type === "light" ? "vs" : "vs-dark",
49
- inherit: false,
50
- colors,
51
- rules
52
- };
53
- }
54
- function shikiToMonaco(highlighter, monaco, options = {}) {
55
- const themeMap = /* @__PURE__ */ new Map();
56
- const themeIds = highlighter.getLoadedThemes();
57
- for (const themeId of themeIds) {
58
- const monacoTheme = textmateThemeToMonacoTheme(highlighter.getTheme(themeId));
59
- themeMap.set(themeId, monacoTheme);
60
- monaco.editor.defineTheme(themeId, monacoTheme);
61
- }
62
- const colorMap = [];
63
- const colorStyleToScopeMap = /* @__PURE__ */ new Map();
64
- const _setTheme = monaco.editor.setTheme.bind(monaco.editor);
65
- monaco.editor.setTheme = (themeName) => {
66
- const ret = highlighter.setTheme(themeName);
67
- const theme = themeMap.get(themeName);
68
- colorMap.length = ret.colorMap.length;
69
- for (let i = 0; i < ret.colorMap.length; i++) colorMap[i] = ret.colorMap[i];
70
- colorStyleToScopeMap.clear();
71
- theme?.rules.forEach((rule) => {
72
- const c = normalizeColor(rule.foreground);
73
- if (!c) return;
74
- const key = getColorStyleKey(c, normalizeFontStyleString(rule.fontStyle));
75
- if (!colorStyleToScopeMap.has(key)) colorStyleToScopeMap.set(key, rule.token);
76
- });
77
- _setTheme(themeName);
78
- };
79
- const _create = monaco.editor.create;
80
- monaco.editor.create = (element, options, override) => {
81
- if (options?.theme) monaco.editor.setTheme(options.theme);
82
- return _create(element, options, override);
83
- };
84
- monaco.editor.setTheme(themeIds[0]);
85
- function findScopeByColorAndStyle(color, fontStyle) {
86
- const key = getColorStyleKey(color, normalizeFontStyleBits(fontStyle));
87
- return colorStyleToScopeMap.get(key);
88
- }
89
- const { tokenizeMaxLineLength = 2e4, tokenizeTimeLimit = 500 } = options;
90
- const monacoLanguageIds = new Set(monaco.languages.getLanguages().map((l) => l.id));
91
- for (const lang of highlighter.getLoadedLanguages()) if (monacoLanguageIds.has(lang)) monaco.languages.setTokensProvider(lang, {
92
- getInitialState() {
93
- return new TokenizerState(INITIAL);
94
- },
95
- tokenize(line, state) {
96
- if (line.length >= tokenizeMaxLineLength) return {
97
- endState: state,
98
- tokens: [{
99
- startIndex: 0,
100
- scopes: ""
101
- }]
102
- };
103
- const result = highlighter.getLanguage(lang).tokenizeLine2(line, state.ruleStack, tokenizeTimeLimit);
104
- if (result.stoppedEarly) console.warn(`Time limit reached when tokenizing line: ${line.substring(0, 100)}`);
105
- const tokensLength = result.tokens.length / 2;
106
- const tokens = [];
107
- for (let j = 0; j < tokensLength; j++) {
108
- const startIndex = result.tokens[2 * j];
109
- const metadata = result.tokens[2 * j + 1];
110
- const colorIdx = EncodedTokenMetadata.getForeground(metadata);
111
- const color = normalizeColor(colorMap[colorIdx] || "");
112
- const fontStyle = EncodedTokenMetadata.getFontStyle(metadata);
113
- const scope = color ? findScopeByColorAndStyle(color, fontStyle) || "" : "";
114
- tokens.push({
115
- startIndex,
116
- scopes: scope
117
- });
118
- }
119
- return {
120
- endState: new TokenizerState(result.ruleStack),
121
- tokens
122
- };
123
- }
124
- });
125
- }
126
- function normalizeFontStyleBits(fontStyle) {
127
- if (fontStyle <= FontStyle.None) return "";
128
- const styles = [];
129
- if (fontStyle & FontStyle.Italic) styles.push("italic");
130
- if (fontStyle & FontStyle.Bold) styles.push("bold");
131
- if (fontStyle & FontStyle.Underline) styles.push("underline");
132
- if (fontStyle & FontStyle.Strikethrough) styles.push("strikethrough");
133
- return styles.join(" ");
134
- }
135
- var VALID_FONT_STYLES = [
136
- "italic",
137
- "bold",
138
- "underline",
139
- "strikethrough"
140
- ];
141
- var VALID_FONT_ALIASES = { "line-through": "strikethrough" };
142
- function normalizeFontStyleString(fontStyle) {
143
- if (!fontStyle) return "";
144
- const styles = new Set(fontStyle.split(RE_FONT_STYLE_SPLIT).map((style) => style.trim().toLowerCase()).map((style) => VALID_FONT_ALIASES[style] || style).filter(Boolean));
145
- return VALID_FONT_STYLES.filter((style) => styles.has(style)).join(" ");
146
- }
147
- function getColorStyleKey(color, fontStyle) {
148
- if (!fontStyle) return color;
149
- return `${color}|${fontStyle}`;
150
- }
151
- export { shikiToMonaco, textmateThemeToMonacoTheme };