@webmaster-droid/web 0.1.1 → 0.3.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/dist/core.css ADDED
@@ -0,0 +1,229 @@
1
+ .wmd-panel {
2
+ position: fixed;
3
+ right: 1rem;
4
+ bottom: 1rem;
5
+ z-index: 100;
6
+ display: flex;
7
+ flex-direction: column;
8
+ width: min(480px, calc(100vw - 1.5rem));
9
+ height: 62vh;
10
+ max-height: calc(100vh - 1.5rem);
11
+ overflow: hidden;
12
+ box-sizing: border-box;
13
+ }
14
+
15
+ .wmd-panel * {
16
+ box-sizing: border-box;
17
+ }
18
+
19
+ .wmd-launcher {
20
+ position: fixed;
21
+ right: 1rem;
22
+ bottom: 1rem;
23
+ z-index: 100;
24
+ box-sizing: border-box;
25
+ }
26
+
27
+ .wmd-header {
28
+ flex-shrink: 0;
29
+ }
30
+
31
+ .wmd-header-row {
32
+ display: flex;
33
+ align-items: center;
34
+ gap: 0.5rem;
35
+ }
36
+
37
+ .wmd-header-actions {
38
+ margin-left: auto;
39
+ display: flex;
40
+ align-items: center;
41
+ gap: 0.25rem;
42
+ }
43
+
44
+ .wmd-tabs {
45
+ display: inline-flex;
46
+ align-items: center;
47
+ }
48
+
49
+ .wmd-login-section {
50
+ display: flex;
51
+ flex: 1;
52
+ min-height: 0;
53
+ align-items: center;
54
+ justify-content: center;
55
+ }
56
+
57
+ .wmd-login-card,
58
+ .wmd-login-warning {
59
+ width: 100%;
60
+ max-width: 24rem;
61
+ }
62
+
63
+ .wmd-login-fields {
64
+ display: flex;
65
+ flex-direction: column;
66
+ gap: 0.5rem;
67
+ }
68
+
69
+ .wmd-chat-section {
70
+ display: flex;
71
+ flex: 1;
72
+ min-height: 0;
73
+ flex-direction: column;
74
+ gap: 0.25rem;
75
+ overflow: auto;
76
+ }
77
+
78
+ .wmd-message--tool {
79
+ max-width: 96%;
80
+ }
81
+
82
+ .wmd-message--user,
83
+ .wmd-message--thinking,
84
+ .wmd-message--assistant,
85
+ .wmd-message--fallback {
86
+ max-width: 92%;
87
+ }
88
+
89
+ .wmd-message--user {
90
+ margin-left: auto;
91
+ }
92
+
93
+ .wmd-message--assistant {
94
+ position: relative;
95
+ }
96
+
97
+ .wmd-assistant-avatar,
98
+ .wmd-assistant-avatar-fallback {
99
+ position: absolute;
100
+ top: 0.375rem;
101
+ left: 0.5rem;
102
+ width: 18px;
103
+ height: 18px;
104
+ }
105
+
106
+ .wmd-assistant-avatar--pending {
107
+ animation: wmd-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
108
+ }
109
+
110
+ .wmd-footer {
111
+ flex-shrink: 0;
112
+ }
113
+
114
+ .wmd-model-row,
115
+ .wmd-selected-element,
116
+ .wmd-composer-row {
117
+ display: flex;
118
+ align-items: center;
119
+ gap: 0.375rem;
120
+ }
121
+
122
+ .wmd-model-select,
123
+ .wmd-composer-input {
124
+ min-width: 0;
125
+ flex: 1;
126
+ }
127
+
128
+ .wmd-composer-input {
129
+ resize: none;
130
+ }
131
+
132
+ .wmd-history-section {
133
+ display: flex;
134
+ flex: 1;
135
+ min-height: 0;
136
+ flex-direction: column;
137
+ }
138
+
139
+ .wmd-history-columns {
140
+ display: flex;
141
+ flex: 1;
142
+ min-height: 0;
143
+ flex-direction: column;
144
+ gap: 0.5rem;
145
+ overflow: hidden;
146
+ }
147
+
148
+ .wmd-history-card {
149
+ display: flex;
150
+ min-height: 0;
151
+ flex-direction: column;
152
+ }
153
+
154
+ .wmd-history-list {
155
+ overflow: auto;
156
+ }
157
+
158
+ .wmd-history-stack {
159
+ display: flex;
160
+ flex-direction: column;
161
+ gap: 0.25rem;
162
+ }
163
+
164
+ .wmd-history-item {
165
+ display: flex;
166
+ align-items: center;
167
+ justify-content: space-between;
168
+ gap: 0.5rem;
169
+ }
170
+
171
+ .wmd-history-item--checkpoint {
172
+ display: flex;
173
+ align-items: flex-start;
174
+ justify-content: space-between;
175
+ gap: 0.5rem;
176
+ }
177
+
178
+ .wmd-history-text {
179
+ min-width: 0;
180
+ flex: 1;
181
+ }
182
+
183
+ .wmd-history-actions {
184
+ display: flex;
185
+ align-items: center;
186
+ gap: 0.25rem;
187
+ }
188
+
189
+ .wmd-history-timestamp,
190
+ .wmd-history-reason,
191
+ .wmd-selected-text {
192
+ overflow: hidden;
193
+ text-overflow: ellipsis;
194
+ white-space: nowrap;
195
+ }
196
+
197
+ .wmd-icon-button,
198
+ .wmd-selected-clear,
199
+ .wmd-history-delete {
200
+ display: inline-flex;
201
+ align-items: center;
202
+ justify-content: center;
203
+ }
204
+
205
+ .wmd-icon {
206
+ width: 14px;
207
+ height: 14px;
208
+ }
209
+
210
+ .wmd-selected-clear-icon {
211
+ width: 12px;
212
+ height: 12px;
213
+ }
214
+
215
+ @media (max-width: 640px) {
216
+ .wmd-panel {
217
+ left: 0.75rem;
218
+ right: 0.75rem;
219
+ bottom: 0.75rem;
220
+ width: auto;
221
+ height: min(72vh, 540px);
222
+ }
223
+ }
224
+
225
+ @keyframes wmd-pulse {
226
+ 50% {
227
+ opacity: 0.5;
228
+ }
229
+ }
package/dist/index.d.ts CHANGED
@@ -3,15 +3,15 @@ import React, { ImgHTMLAttributes, HTMLAttributes, ReactNode } from 'react';
3
3
  import { CmsDocument, SelectedElementKind, SelectedElementContext, PublishRequest, RollbackRequest } from '@webmaster-droid/contracts';
4
4
  import { Session, SupabaseClient } from '@supabase/supabase-js';
5
5
 
6
- type AnyCmsDocument$1 = CmsDocument<object, object, string>;
6
+ type AnyCmsDocument$2 = CmsDocument<object, object, string>;
7
7
  type EditableMode = "live" | "draft";
8
8
  interface EditableContextValue {
9
- document: AnyCmsDocument$1;
9
+ document: AnyCmsDocument$2;
10
10
  mode: EditableMode;
11
11
  enabled: boolean;
12
12
  }
13
13
  declare function EditableProvider(props: {
14
- document: AnyCmsDocument$1;
14
+ document: AnyCmsDocument$2;
15
15
  mode?: EditableMode;
16
16
  enabled?: boolean;
17
17
  children: ReactNode;
@@ -626,6 +626,13 @@ type ModelOption = {
626
626
  id: string;
627
627
  label: string;
628
628
  };
629
+ type ModelCapabilities = {
630
+ contentEdit: boolean;
631
+ themeTokenEdit: boolean;
632
+ imageGenerate: boolean;
633
+ imageEdit: boolean;
634
+ visionAssist: boolean;
635
+ };
629
636
  type WebmasterDroidConfig = {
630
637
  apiBaseUrl?: string;
631
638
  supabaseUrl?: string;
@@ -658,6 +665,7 @@ type WebmasterDroidContextValue = {
658
665
  setModelId: (modelId: string) => void;
659
666
  showModelPicker: boolean;
660
667
  modelOptions: ModelOption[];
668
+ capabilities: ModelCapabilities;
661
669
  includeThinking: boolean;
662
670
  setIncludeThinking: (value: boolean) => void;
663
671
  refreshKey: number;
@@ -677,23 +685,31 @@ declare function WebmasterDroidProvider(props: {
677
685
  }): react_jsx_runtime.JSX.Element;
678
686
  declare function useWebmasterDroid(): WebmasterDroidContextValue;
679
687
 
680
- declare function WebmasterDroidOverlay(): react_jsx_runtime.JSX.Element | null;
688
+ type WebmasterDroidOverlayProps = {
689
+ injectCoreStyles?: boolean;
690
+ };
691
+ declare function WebmasterDroidOverlay({ injectCoreStyles }: WebmasterDroidOverlayProps): react_jsx_runtime.JSX.Element | null;
681
692
 
682
- type AnyCmsDocument = CmsDocument<object, object, string>;
683
- type WebmasterDroidCmsContextValue<TDocument extends AnyCmsDocument = AnyCmsDocument> = {
693
+ type AnyCmsDocument$1 = CmsDocument<object, object, string>;
694
+ type WebmasterDroidCmsContextValue<TDocument extends AnyCmsDocument$1 = AnyCmsDocument$1> = {
684
695
  document: TDocument;
685
696
  stage: "live" | "draft";
686
697
  loading: boolean;
687
698
  error: string | null;
688
699
  };
689
- declare function WebmasterDroidRuntime<TDocument extends AnyCmsDocument = AnyCmsDocument>(props: {
700
+ type WebmasterDroidRuntimeProps<TDocument extends AnyCmsDocument$1 = AnyCmsDocument$1> = {
690
701
  children: ReactNode;
691
702
  fallbackDocument?: TDocument;
692
703
  config?: WebmasterDroidConfig;
693
704
  includeOverlay?: boolean;
694
705
  applyThemeTokens?: boolean;
695
- }): react_jsx_runtime.JSX.Element;
696
- declare function useWebmasterDroidCmsDocument<TDocument extends AnyCmsDocument = AnyCmsDocument>(): WebmasterDroidCmsContextValue<TDocument>;
706
+ injectCoreStyles?: boolean;
707
+ };
708
+ declare function WebmasterDroidRuntime<TDocument extends AnyCmsDocument$1 = AnyCmsDocument$1>(props: WebmasterDroidRuntimeProps<TDocument>): react_jsx_runtime.JSX.Element;
709
+ declare function useWebmasterDroidCmsDocument<TDocument extends AnyCmsDocument$1 = AnyCmsDocument$1>(): WebmasterDroidCmsContextValue<TDocument>;
710
+
711
+ type AnyCmsDocument = CmsDocument<object, object, string>;
712
+ declare function normalizeCmsDocumentWithFallback<TDocument extends AnyCmsDocument>(document: unknown, fallbackDocument: TDocument): TDocument;
697
713
 
698
714
  declare function getSupabaseBrowserClient(config: ResolvedWebmasterDroidConfig): SupabaseClient | null;
699
715
 
@@ -703,6 +719,7 @@ declare function fetchModels(apiBaseUrl: string): Promise<{
703
719
  openai: boolean;
704
720
  gemini: boolean;
705
721
  };
722
+ capabilities: ModelCapabilities;
706
723
  defaultModelId: string;
707
724
  showModelPicker: boolean;
708
725
  availableModels: ModelOption[];
@@ -741,4 +758,4 @@ declare function streamChat(params: {
741
758
  }) => void;
742
759
  }): Promise<void>;
743
760
 
744
- export { EditableImage, EditableLink, EditableProvider, EditableRichText, EditableText, type ModelOption, type ResolvedWebmasterDroidConfig, type WebmasterDroidCmsContextValue, type WebmasterDroidConfig, type WebmasterDroidContextValue, WebmasterDroidOverlay, WebmasterDroidProvider, WebmasterDroidRuntime, buildApiUrl, deleteCheckpoint, editableMeta, fetchCmsContent, fetchHistory, fetchModels, getSupabaseBrowserClient, parseSelectedEditableFromTarget, publishDraft, resolveWebmasterDroidConfig, rollbackDraft, streamChat, useEditableDocument, useWebmasterDroid, useWebmasterDroidCmsDocument };
761
+ export { EditableImage, EditableLink, EditableProvider, EditableRichText, EditableText, type ModelOption, type ResolvedWebmasterDroidConfig, type WebmasterDroidCmsContextValue, type WebmasterDroidConfig, type WebmasterDroidContextValue, WebmasterDroidOverlay, type WebmasterDroidOverlayProps, WebmasterDroidProvider, WebmasterDroidRuntime, type WebmasterDroidRuntimeProps, buildApiUrl, deleteCheckpoint, editableMeta, fetchCmsContent, fetchHistory, fetchModels, getSupabaseBrowserClient, normalizeCmsDocumentWithFallback, parseSelectedEditableFromTarget, publishDraft, resolveWebmasterDroidConfig, rollbackDraft, streamChat, useEditableDocument, useWebmasterDroid, useWebmasterDroidCmsDocument };