@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.
Files changed (64) hide show
  1. package/dist/upstart-editor-api.d.ts +79 -0
  2. package/dist/upstart-editor-api.d.ts.map +1 -0
  3. package/dist/upstart-editor-api.js +208 -0
  4. package/dist/upstart-editor-api.js.map +1 -0
  5. package/dist/vite-plugin-upstart-attrs.d.ts +3 -3
  6. package/dist/vite-plugin-upstart-attrs.d.ts.map +1 -1
  7. package/dist/vite-plugin-upstart-attrs.js +227 -25
  8. package/dist/vite-plugin-upstart-attrs.js.map +1 -1
  9. package/dist/vite-plugin-upstart-branding/plugin.d.ts +17 -0
  10. package/dist/vite-plugin-upstart-branding/plugin.d.ts.map +1 -0
  11. package/dist/vite-plugin-upstart-branding/plugin.js +41 -0
  12. package/dist/vite-plugin-upstart-branding/plugin.js.map +1 -0
  13. package/dist/vite-plugin-upstart-branding/runtime.d.ts +10 -0
  14. package/dist/vite-plugin-upstart-branding/runtime.d.ts.map +1 -0
  15. package/dist/vite-plugin-upstart-branding/runtime.js +118 -0
  16. package/dist/vite-plugin-upstart-branding/runtime.js.map +1 -0
  17. package/dist/vite-plugin-upstart-branding/types.d.ts +14 -0
  18. package/dist/vite-plugin-upstart-branding/types.d.ts.map +1 -0
  19. package/dist/vite-plugin-upstart-branding/types.js +1 -0
  20. package/dist/vite-plugin-upstart-editor/plugin.d.ts +3 -3
  21. package/dist/vite-plugin-upstart-editor/plugin.d.ts.map +1 -1
  22. package/dist/vite-plugin-upstart-editor/plugin.js +3 -16
  23. package/dist/vite-plugin-upstart-editor/plugin.js.map +1 -1
  24. package/dist/vite-plugin-upstart-editor/runtime/click-handler.js +25 -11
  25. package/dist/vite-plugin-upstart-editor/runtime/click-handler.js.map +1 -1
  26. package/dist/vite-plugin-upstart-editor/runtime/error-handler.d.ts +5 -0
  27. package/dist/vite-plugin-upstart-editor/runtime/error-handler.d.ts.map +1 -0
  28. package/dist/vite-plugin-upstart-editor/runtime/error-handler.js +16 -0
  29. package/dist/vite-plugin-upstart-editor/runtime/error-handler.js.map +1 -0
  30. package/dist/vite-plugin-upstart-editor/runtime/hover-overlay.js +1 -1
  31. package/dist/vite-plugin-upstart-editor/runtime/hover-overlay.js.map +1 -1
  32. package/dist/vite-plugin-upstart-editor/runtime/index.d.ts +2 -1
  33. package/dist/vite-plugin-upstart-editor/runtime/index.d.ts.map +1 -1
  34. package/dist/vite-plugin-upstart-editor/runtime/index.js +42 -7
  35. package/dist/vite-plugin-upstart-editor/runtime/index.js.map +1 -1
  36. package/dist/vite-plugin-upstart-editor/runtime/text-editor.d.ts +6 -1
  37. package/dist/vite-plugin-upstart-editor/runtime/text-editor.d.ts.map +1 -1
  38. package/dist/vite-plugin-upstart-editor/runtime/text-editor.js +423 -129
  39. package/dist/vite-plugin-upstart-editor/runtime/text-editor.js.map +1 -1
  40. package/dist/vite-plugin-upstart-editor/runtime/types.d.ts +18 -10
  41. package/dist/vite-plugin-upstart-editor/runtime/types.d.ts.map +1 -1
  42. package/dist/vite-plugin-upstart-theme.d.ts +3 -3
  43. package/dist/vite-plugin-upstart-theme.d.ts.map +1 -1
  44. package/dist/vite-plugin-upstart-theme.js +1 -3
  45. package/dist/vite-plugin-upstart-theme.js.map +1 -1
  46. package/package.json +12 -4
  47. package/src/tests/upstart-editor-api.test.ts +98 -174
  48. package/src/tests/vite-plugin-upstart-attrs.test.ts +408 -105
  49. package/src/tests/vite-plugin-upstart-branding.test.ts +90 -0
  50. package/src/tests/vite-plugin-upstart-editor.test.ts +1 -2
  51. package/src/upstart-editor-api.ts +90 -29
  52. package/src/vite-plugin-upstart-attrs.ts +376 -38
  53. package/src/vite-plugin-upstart-branding/plugin.ts +59 -0
  54. package/src/vite-plugin-upstart-branding/runtime.ts +128 -0
  55. package/src/vite-plugin-upstart-branding/types.ts +10 -0
  56. package/src/vite-plugin-upstart-editor/plugin.ts +4 -19
  57. package/src/vite-plugin-upstart-editor/runtime/click-handler.ts +25 -12
  58. package/src/vite-plugin-upstart-editor/runtime/error-handler.ts +12 -0
  59. package/src/vite-plugin-upstart-editor/runtime/hover-overlay.ts +1 -1
  60. package/src/vite-plugin-upstart-editor/runtime/index.ts +39 -5
  61. package/src/vite-plugin-upstart-editor/runtime/text-editor.ts +518 -141
  62. package/src/vite-plugin-upstart-editor/runtime/types.ts +18 -4
  63. package/src/vite-plugin-upstart-theme.ts +0 -3
  64. 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-update"; hash: string; newText: string }
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: string;
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', 'a', 'span', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'label']
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
  };