@june-ai/june-ui 0.2.1 → 0.2.2

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/index.cjs CHANGED
@@ -152,9 +152,7 @@ var darkTheme = {
152
152
  "--june-muted": "#9ca3af",
153
153
  "--june-border": "#1f2937",
154
154
  "--june-accent": "#818cf8",
155
- "--june-danger": "#f87171",
156
- "--june-radius": "8px",
157
- "--june-font-family": "system-ui, -apple-system, 'Segoe UI', sans-serif"
155
+ "--june-danger": "#f87171"
158
156
  };
159
157
 
160
158
  // src/themes/light.ts
@@ -163,9 +161,7 @@ var lightTheme = {
163
161
  "--june-muted": "#6b7280",
164
162
  "--june-border": "#e5e7eb",
165
163
  "--june-accent": "#4f46e5",
166
- "--june-danger": "#b91c1c",
167
- "--june-radius": "8px",
168
- "--june-font-family": "system-ui, -apple-system, 'Segoe UI', sans-serif"
164
+ "--june-danger": "#b91c1c"
169
165
  };
170
166
 
171
167
  // src/themes/theme-provider.tsx
@@ -190,23 +186,33 @@ function useResolvedTheme(mode) {
190
186
  return mode === "system" ? system : mode;
191
187
  }
192
188
  function JuneThemeProvider({
193
- mode = "light",
189
+ mode,
194
190
  vars,
195
191
  className,
196
192
  style,
197
193
  children
198
194
  }) {
199
- const resolved = useResolvedTheme(mode);
195
+ const explicit = mode !== void 0;
196
+ const resolved = useResolvedTheme(mode ?? "system");
200
197
  const mergedStyle = (0, import_react2.useMemo)(() => {
201
- const base = resolved === "dark" ? darkTheme : lightTheme;
202
- return { ...base, ...vars, colorScheme: resolved, ...style };
203
- }, [resolved, vars, style]);
204
- const context = (0, import_react2.useMemo)(() => ({ mode, theme: resolved }), [mode, resolved]);
198
+ if (!explicit && !vars && !style) return void 0;
199
+ const base = explicit ? resolved === "dark" ? darkTheme : lightTheme : void 0;
200
+ return {
201
+ ...base,
202
+ ...vars,
203
+ ...explicit ? { colorScheme: resolved } : {},
204
+ ...style
205
+ };
206
+ }, [explicit, resolved, vars, style]);
207
+ const context = (0, import_react2.useMemo)(
208
+ () => ({ mode: mode ?? "system", theme: resolved }),
209
+ [mode, resolved]
210
+ );
205
211
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(JuneContext.Provider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
206
212
  "div",
207
213
  {
208
214
  className: className ? `june-ui-root ${className}` : "june-ui-root",
209
- "data-june-theme": resolved,
215
+ "data-june-theme": explicit ? resolved : void 0,
210
216
  style: mergedStyle,
211
217
  children
212
218
  }
@@ -665,7 +671,7 @@ function JuneRenderer(props) {
665
671
  isStreaming = false,
666
672
  mixedContent = true,
667
673
  renderText,
668
- theme = "light",
674
+ theme,
669
675
  themeVars,
670
676
  className,
671
677
  style,
package/dist/index.d.cts CHANGED
@@ -89,6 +89,7 @@ declare function runAction(event: OpenUIActionEvent, options: RunActionOptions):
89
89
  declare function createActionHandler(options: RunActionOptions): (event: OpenUIActionEvent) => void;
90
90
 
91
91
  type JuneThemeVars = Record<string, string>;
92
+ /** Colors only. June never sets fonts, radii or backgrounds. */
92
93
  declare const lightTheme: JuneThemeVars;
93
94
 
94
95
  interface FallbackArgs {
@@ -149,6 +150,10 @@ declare function JuneRenderer(props: JuneRendererProps): react.JSX.Element;
149
150
 
150
151
  declare function useResolvedTheme(mode: JuneThemeMode): JuneResolvedTheme;
151
152
  interface JuneThemeProviderProps {
153
+ /**
154
+ * Omit to inherit the host app's look: no colors, fonts or color-scheme are applied.
155
+ * "light" | "dark" | "system" opt in to June's text colors.
156
+ */
152
157
  mode?: JuneThemeMode;
153
158
  /** CSS variable overrides, e.g. { "--june-accent": "#0ea5e9" }. */
154
159
  vars?: JuneThemeVars;
package/dist/index.d.ts CHANGED
@@ -89,6 +89,7 @@ declare function runAction(event: OpenUIActionEvent, options: RunActionOptions):
89
89
  declare function createActionHandler(options: RunActionOptions): (event: OpenUIActionEvent) => void;
90
90
 
91
91
  type JuneThemeVars = Record<string, string>;
92
+ /** Colors only. June never sets fonts, radii or backgrounds. */
92
93
  declare const lightTheme: JuneThemeVars;
93
94
 
94
95
  interface FallbackArgs {
@@ -149,6 +150,10 @@ declare function JuneRenderer(props: JuneRendererProps): react.JSX.Element;
149
150
 
150
151
  declare function useResolvedTheme(mode: JuneThemeMode): JuneResolvedTheme;
151
152
  interface JuneThemeProviderProps {
153
+ /**
154
+ * Omit to inherit the host app's look: no colors, fonts or color-scheme are applied.
155
+ * "light" | "dark" | "system" opt in to June's text colors.
156
+ */
152
157
  mode?: JuneThemeMode;
153
158
  /** CSS variable overrides, e.g. { "--june-accent": "#0ea5e9" }. */
154
159
  vars?: JuneThemeVars;
package/dist/index.js CHANGED
@@ -113,9 +113,7 @@ var darkTheme = {
113
113
  "--june-muted": "#9ca3af",
114
114
  "--june-border": "#1f2937",
115
115
  "--june-accent": "#818cf8",
116
- "--june-danger": "#f87171",
117
- "--june-radius": "8px",
118
- "--june-font-family": "system-ui, -apple-system, 'Segoe UI', sans-serif"
116
+ "--june-danger": "#f87171"
119
117
  };
120
118
 
121
119
  // src/themes/light.ts
@@ -124,9 +122,7 @@ var lightTheme = {
124
122
  "--june-muted": "#6b7280",
125
123
  "--june-border": "#e5e7eb",
126
124
  "--june-accent": "#4f46e5",
127
- "--june-danger": "#b91c1c",
128
- "--june-radius": "8px",
129
- "--june-font-family": "system-ui, -apple-system, 'Segoe UI', sans-serif"
125
+ "--june-danger": "#b91c1c"
130
126
  };
131
127
 
132
128
  // src/themes/theme-provider.tsx
@@ -151,23 +147,33 @@ function useResolvedTheme(mode) {
151
147
  return mode === "system" ? system : mode;
152
148
  }
153
149
  function JuneThemeProvider({
154
- mode = "light",
150
+ mode,
155
151
  vars,
156
152
  className,
157
153
  style,
158
154
  children
159
155
  }) {
160
- const resolved = useResolvedTheme(mode);
156
+ const explicit = mode !== void 0;
157
+ const resolved = useResolvedTheme(mode ?? "system");
161
158
  const mergedStyle = useMemo(() => {
162
- const base = resolved === "dark" ? darkTheme : lightTheme;
163
- return { ...base, ...vars, colorScheme: resolved, ...style };
164
- }, [resolved, vars, style]);
165
- const context = useMemo(() => ({ mode, theme: resolved }), [mode, resolved]);
159
+ if (!explicit && !vars && !style) return void 0;
160
+ const base = explicit ? resolved === "dark" ? darkTheme : lightTheme : void 0;
161
+ return {
162
+ ...base,
163
+ ...vars,
164
+ ...explicit ? { colorScheme: resolved } : {},
165
+ ...style
166
+ };
167
+ }, [explicit, resolved, vars, style]);
168
+ const context = useMemo(
169
+ () => ({ mode: mode ?? "system", theme: resolved }),
170
+ [mode, resolved]
171
+ );
166
172
  return /* @__PURE__ */ jsx(JuneContext.Provider, { value: context, children: /* @__PURE__ */ jsx(
167
173
  "div",
168
174
  {
169
175
  className: className ? `june-ui-root ${className}` : "june-ui-root",
170
- "data-june-theme": resolved,
176
+ "data-june-theme": explicit ? resolved : void 0,
171
177
  style: mergedStyle,
172
178
  children
173
179
  }
@@ -626,7 +632,7 @@ function JuneRenderer(props) {
626
632
  isStreaming = false,
627
633
  mixedContent = true,
628
634
  renderText,
629
- theme = "light",
635
+ theme,
630
636
  themeVars,
631
637
  className,
632
638
  style,
package/dist/june.css CHANGED
@@ -1,21 +1,30 @@
1
1
  .june-ui-root {
2
- box-sizing: border-box;
3
- max-width: 100%;
4
- color: var(--june-foreground);
5
- background: var(--june-background);
6
- font-family: var(--june-font-family);
7
- border-radius: var(--june-radius);
8
- }
9
-
10
- .june-ui-root img,
11
- .june-ui-root video {
12
- max-width: 100%;
13
- height: auto;
14
- }
15
-
16
- [data-june-error] {
17
- padding: 12px 16px;
18
- border: 1px solid var(--june-danger);
19
- border-radius: var(--june-radius);
20
- color: var(--june-danger);
21
- }
2
+ box-sizing: border-box;
3
+ max-width: 100%;
4
+ min-width: 0;
5
+ }
6
+
7
+ /* Colors apply only when a theme is explicitly chosen. */
8
+ .june-ui-root[data-june-theme] {
9
+ color: var(--june-foreground);
10
+ }
11
+
12
+ .june-ui-root img,
13
+ .june-ui-root video {
14
+ max-width: 100%;
15
+ height: auto;
16
+ }
17
+
18
+ .june-text {
19
+ margin: 0 0 8px;
20
+ line-height: 1.5;
21
+ overflow-wrap: anywhere;
22
+ white-space: pre-wrap;
23
+ }
24
+
25
+ [data-june-error] {
26
+ padding: 12px 16px;
27
+ border: 1px solid var(--june-danger, #b91c1c);
28
+ border-radius: 8px;
29
+ color: var(--june-danger, #b91c1c);
30
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@june-ai/june-ui",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "A React Generative UI SDK powered by OpenUI",
5
5
  "license": "MIT",
6
6
  "type": "module",