@upstart.gg/vite-plugins 0.0.39 → 0.0.40
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/dist/upstart-editor-api.d.ts +79 -0
- package/dist/upstart-editor-api.d.ts.map +1 -0
- package/dist/upstart-editor-api.js +208 -0
- package/dist/upstart-editor-api.js.map +1 -0
- package/dist/vite-plugin-upstart-attrs.d.ts +3 -3
- package/dist/vite-plugin-upstart-attrs.d.ts.map +1 -1
- package/dist/vite-plugin-upstart-attrs.js +227 -25
- package/dist/vite-plugin-upstart-attrs.js.map +1 -1
- package/dist/vite-plugin-upstart-branding/plugin.d.ts +17 -0
- package/dist/vite-plugin-upstart-branding/plugin.d.ts.map +1 -0
- package/dist/vite-plugin-upstart-branding/plugin.js +41 -0
- package/dist/vite-plugin-upstart-branding/plugin.js.map +1 -0
- package/dist/vite-plugin-upstart-branding/runtime.d.ts +10 -0
- package/dist/vite-plugin-upstart-branding/runtime.d.ts.map +1 -0
- package/dist/vite-plugin-upstart-branding/runtime.js +118 -0
- package/dist/vite-plugin-upstart-branding/runtime.js.map +1 -0
- package/dist/vite-plugin-upstart-branding/types.d.ts +14 -0
- package/dist/vite-plugin-upstart-branding/types.d.ts.map +1 -0
- package/dist/vite-plugin-upstart-branding/types.js +1 -0
- package/dist/vite-plugin-upstart-editor/plugin.d.ts +3 -3
- package/dist/vite-plugin-upstart-editor/plugin.d.ts.map +1 -1
- package/dist/vite-plugin-upstart-editor/plugin.js +3 -16
- package/dist/vite-plugin-upstart-editor/plugin.js.map +1 -1
- package/dist/vite-plugin-upstart-editor/runtime/click-handler.js +25 -11
- package/dist/vite-plugin-upstart-editor/runtime/click-handler.js.map +1 -1
- package/dist/vite-plugin-upstart-editor/runtime/error-handler.d.ts +5 -0
- package/dist/vite-plugin-upstart-editor/runtime/error-handler.d.ts.map +1 -0
- package/dist/vite-plugin-upstart-editor/runtime/error-handler.js +16 -0
- package/dist/vite-plugin-upstart-editor/runtime/error-handler.js.map +1 -0
- package/dist/vite-plugin-upstart-editor/runtime/hover-overlay.js +1 -1
- package/dist/vite-plugin-upstart-editor/runtime/hover-overlay.js.map +1 -1
- package/dist/vite-plugin-upstart-editor/runtime/index.d.ts +2 -1
- package/dist/vite-plugin-upstart-editor/runtime/index.d.ts.map +1 -1
- package/dist/vite-plugin-upstart-editor/runtime/index.js +42 -7
- package/dist/vite-plugin-upstart-editor/runtime/index.js.map +1 -1
- package/dist/vite-plugin-upstart-editor/runtime/text-editor.d.ts +6 -1
- package/dist/vite-plugin-upstart-editor/runtime/text-editor.d.ts.map +1 -1
- package/dist/vite-plugin-upstart-editor/runtime/text-editor.js +423 -129
- package/dist/vite-plugin-upstart-editor/runtime/text-editor.js.map +1 -1
- package/dist/vite-plugin-upstart-editor/runtime/types.d.ts +18 -10
- package/dist/vite-plugin-upstart-editor/runtime/types.d.ts.map +1 -1
- package/dist/vite-plugin-upstart-theme.d.ts +3 -3
- package/dist/vite-plugin-upstart-theme.d.ts.map +1 -1
- package/dist/vite-plugin-upstart-theme.js +1 -3
- package/dist/vite-plugin-upstart-theme.js.map +1 -1
- package/package.json +12 -4
- package/src/tests/upstart-editor-api.test.ts +98 -174
- package/src/tests/vite-plugin-upstart-attrs.test.ts +408 -105
- package/src/tests/vite-plugin-upstart-branding.test.ts +90 -0
- package/src/tests/vite-plugin-upstart-editor.test.ts +1 -2
- package/src/upstart-editor-api.ts +90 -29
- package/src/vite-plugin-upstart-attrs.ts +376 -38
- package/src/vite-plugin-upstart-branding/plugin.ts +59 -0
- package/src/vite-plugin-upstart-branding/runtime.ts +128 -0
- package/src/vite-plugin-upstart-branding/types.ts +10 -0
- package/src/vite-plugin-upstart-editor/plugin.ts +4 -19
- package/src/vite-plugin-upstart-editor/runtime/click-handler.ts +25 -12
- package/src/vite-plugin-upstart-editor/runtime/error-handler.ts +12 -0
- package/src/vite-plugin-upstart-editor/runtime/hover-overlay.ts +1 -1
- package/src/vite-plugin-upstart-editor/runtime/index.ts +39 -5
- package/src/vite-plugin-upstart-editor/runtime/text-editor.ts +518 -141
- package/src/vite-plugin-upstart-editor/runtime/types.ts +18 -4
- package/src/vite-plugin-upstart-theme.ts +0 -3
- package/src/vite-plugin-upstart-editor/PLAN.md +0 -1391
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import type { Editor } from "@tiptap/core";
|
|
2
|
+
import type { PayloadEditText } from "~/upstart-editor-api";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Editor mode
|
|
5
6
|
*/
|
|
6
7
|
export type EditorMode = "preview" | "edit";
|
|
7
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Text editor mode: determines schema constraints and bubble menu options.
|
|
11
|
+
*/
|
|
12
|
+
export type TextEditorMode = "block-rich" | "inline-rich" | "plain";
|
|
13
|
+
|
|
8
14
|
/**
|
|
9
15
|
* Element bounds used for UI positioning.
|
|
10
16
|
*/
|
|
@@ -24,23 +30,24 @@ export interface EditorInstance {
|
|
|
24
30
|
editor: Editor;
|
|
25
31
|
element: HTMLElement;
|
|
26
32
|
hash: string;
|
|
33
|
+
mode: TextEditorMode;
|
|
27
34
|
}
|
|
28
35
|
|
|
29
36
|
/**
|
|
30
37
|
* Messages sent from iframe to parent editor.
|
|
31
38
|
*/
|
|
32
39
|
export type EditorMessage =
|
|
33
|
-
| { type: "text-
|
|
34
|
-
| { type: "text-save"; hash: string; newText: string }
|
|
40
|
+
| { type: "text-edit"; payload: PayloadEditText }
|
|
35
41
|
| { type: "editor-ready" }
|
|
36
42
|
| { type: "editor-error"; error: string }
|
|
37
43
|
| { type: "element-hovered"; hash: string; bounds: ElementBounds }
|
|
38
44
|
| {
|
|
39
45
|
type: "element-clicked";
|
|
40
46
|
hash: string;
|
|
41
|
-
componentName
|
|
47
|
+
componentName?: string;
|
|
42
48
|
filePath: string;
|
|
43
49
|
currentClassName: string;
|
|
50
|
+
classNameId: string;
|
|
44
51
|
bounds: ElementBounds;
|
|
45
52
|
};
|
|
46
53
|
|
|
@@ -77,9 +84,16 @@ export interface UpstartEditorOptions {
|
|
|
77
84
|
*/
|
|
78
85
|
richTextElements?: string[];
|
|
79
86
|
|
|
87
|
+
/**
|
|
88
|
+
* Elements that should use inline rich text editing (inline formatting only, no blocks).
|
|
89
|
+
* Uses a custom inline document schema to prevent block elements like <p> inside inline elements.
|
|
90
|
+
* @default ['a', 'span', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']
|
|
91
|
+
*/
|
|
92
|
+
inlineRichTextElements?: string[];
|
|
93
|
+
|
|
80
94
|
/**
|
|
81
95
|
* Elements that should use plain text editing (no formatting).
|
|
82
|
-
* @default ['button', '
|
|
96
|
+
* @default ['button', 'label']
|
|
83
97
|
*/
|
|
84
98
|
plainTextElements?: string[];
|
|
85
99
|
|
|
@@ -273,7 +273,6 @@ export const upstartTheme = createUnplugin<PluginOptions>((opts) => {
|
|
|
273
273
|
const fontsCSS = generateFontsCSS(themes.light, themes.dark, fontsDisplay);
|
|
274
274
|
const fontsCSSPath = path.join(outputDir, "fonts.css");
|
|
275
275
|
fs.writeFileSync(fontsCSSPath, fontsCSS);
|
|
276
|
-
console.log(`✓ Generated fonts CSS: ${fontsCSSPath}`);
|
|
277
276
|
|
|
278
277
|
const output: string[] = [];
|
|
279
278
|
|
|
@@ -304,8 +303,6 @@ export const upstartTheme = createUnplugin<PluginOptions>((opts) => {
|
|
|
304
303
|
// Write the generated CSS file
|
|
305
304
|
const cssContent = output.join("\n");
|
|
306
305
|
fs.writeFileSync(opts.outputPath, cssContent);
|
|
307
|
-
|
|
308
|
-
console.log(`✓ Generated theme CSS: ${opts.outputPath}`);
|
|
309
306
|
},
|
|
310
307
|
},
|
|
311
308
|
};
|