@nswds/app 4.0.2 → 4.0.4

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.d.cts CHANGED
@@ -50,7 +50,7 @@ import { ThemeProviderProps } from 'next-themes';
50
50
  import * as TogglePrimitive from '@radix-ui/react-toggle';
51
51
  import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
52
52
  import { LucideIcon } from 'lucide-react';
53
- import { UIMessage, LanguageModelUsage, Experimental_GeneratedImage, FileUIPart, ChatStatus, ToolUIPart } from 'ai';
53
+ import { UIMessage, LanguageModelUsage, GeneratedFile, FileUIPart, ChatStatus, ToolUIPart } from 'ai';
54
54
  import { ModelId } from 'tokenlens';
55
55
  import { StickToBottom } from 'use-stick-to-bottom';
56
56
  import { Streamdown } from 'streamdown';
@@ -1141,6 +1141,32 @@ interface DynamicFaviconProps {
1141
1141
  lightModeFavicon: string;
1142
1142
  darkModeFavicon: string;
1143
1143
  }
1144
+ /**
1145
+ * @deprecated Use Next's `app/` icon file conventions instead, and let the SVG
1146
+ * invert itself.
1147
+ *
1148
+ * Put `favicon.ico`, `icon.svg` and `apple-icon.png` in `app/`, and give the
1149
+ * SVG an inline `@media (prefers-color-scheme: dark)` rule. The browser then
1150
+ * swaps the icon natively — no JavaScript, no second asset, and it works before
1151
+ * hydration.
1152
+ *
1153
+ * Three reasons this component is worse than that:
1154
+ *
1155
+ * 1. **It needs two extra raster files** that the `app/` conventions do not, and
1156
+ * every repo in the fleet has now deleted them. A mount left pointing at
1157
+ * `/icon-light.ico` after that deletion silently requests a URL that no
1158
+ * longer exists.
1159
+ * 2. **Under streaming metadata it appends rather than replaces.** The real icon
1160
+ * tags are still in `<body>` when this effect runs, so
1161
+ * `document.querySelector("link[rel='icon']")` finds nothing and the `else`
1162
+ * branch creates a *new* link — which then becomes the browser's first icon
1163
+ * candidate, ahead of the correct hashed one.
1164
+ * 3. **It only reacts to the OS colour scheme**, not to an in-app theme toggle,
1165
+ * so it was never consistent with a `data-theme`-driven design system anyway.
1166
+ *
1167
+ * Still exported so existing consumers keep building. It will be removed in the
1168
+ * next major.
1169
+ */
1144
1170
  declare function DynamicFavicon({ lightModeFavicon, darkModeFavicon }: DynamicFaviconProps): null;
1145
1171
 
1146
1172
  type ExpandableSearchButtonProps = Omit<react.ComponentPropsWithoutRef<'button'>, 'type'> & {
@@ -1230,7 +1256,7 @@ declare const useFormField: () => {
1230
1256
  isDirty: boolean;
1231
1257
  isTouched: boolean;
1232
1258
  isValidating: boolean;
1233
- error?: react_hook_form.FieldError;
1259
+ error?: react_hook_form.FieldError | undefined;
1234
1260
  id: string;
1235
1261
  name: string;
1236
1262
  formItemId: string;
@@ -6300,7 +6326,7 @@ declare const ConversationEmptyState: ({ className, title, description, icon, ch
6300
6326
  type ConversationScrollButtonProps = ComponentProps<typeof Button>;
6301
6327
  declare const ConversationScrollButton: ({ className, ...props }: ConversationScrollButtonProps) => false | react.JSX.Element;
6302
6328
 
6303
- type ImageProps = Experimental_GeneratedImage & {
6329
+ type ImageProps = GeneratedFile & {
6304
6330
  className?: string;
6305
6331
  alt?: string;
6306
6332
  };
package/dist/index.d.ts CHANGED
@@ -50,7 +50,7 @@ import { ThemeProviderProps } from 'next-themes';
50
50
  import * as TogglePrimitive from '@radix-ui/react-toggle';
51
51
  import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
52
52
  import { LucideIcon } from 'lucide-react';
53
- import { UIMessage, LanguageModelUsage, Experimental_GeneratedImage, FileUIPart, ChatStatus, ToolUIPart } from 'ai';
53
+ import { UIMessage, LanguageModelUsage, GeneratedFile, FileUIPart, ChatStatus, ToolUIPart } from 'ai';
54
54
  import { ModelId } from 'tokenlens';
55
55
  import { StickToBottom } from 'use-stick-to-bottom';
56
56
  import { Streamdown } from 'streamdown';
@@ -1141,6 +1141,32 @@ interface DynamicFaviconProps {
1141
1141
  lightModeFavicon: string;
1142
1142
  darkModeFavicon: string;
1143
1143
  }
1144
+ /**
1145
+ * @deprecated Use Next's `app/` icon file conventions instead, and let the SVG
1146
+ * invert itself.
1147
+ *
1148
+ * Put `favicon.ico`, `icon.svg` and `apple-icon.png` in `app/`, and give the
1149
+ * SVG an inline `@media (prefers-color-scheme: dark)` rule. The browser then
1150
+ * swaps the icon natively — no JavaScript, no second asset, and it works before
1151
+ * hydration.
1152
+ *
1153
+ * Three reasons this component is worse than that:
1154
+ *
1155
+ * 1. **It needs two extra raster files** that the `app/` conventions do not, and
1156
+ * every repo in the fleet has now deleted them. A mount left pointing at
1157
+ * `/icon-light.ico` after that deletion silently requests a URL that no
1158
+ * longer exists.
1159
+ * 2. **Under streaming metadata it appends rather than replaces.** The real icon
1160
+ * tags are still in `<body>` when this effect runs, so
1161
+ * `document.querySelector("link[rel='icon']")` finds nothing and the `else`
1162
+ * branch creates a *new* link — which then becomes the browser's first icon
1163
+ * candidate, ahead of the correct hashed one.
1164
+ * 3. **It only reacts to the OS colour scheme**, not to an in-app theme toggle,
1165
+ * so it was never consistent with a `data-theme`-driven design system anyway.
1166
+ *
1167
+ * Still exported so existing consumers keep building. It will be removed in the
1168
+ * next major.
1169
+ */
1144
1170
  declare function DynamicFavicon({ lightModeFavicon, darkModeFavicon }: DynamicFaviconProps): null;
1145
1171
 
1146
1172
  type ExpandableSearchButtonProps = Omit<react.ComponentPropsWithoutRef<'button'>, 'type'> & {
@@ -1230,7 +1256,7 @@ declare const useFormField: () => {
1230
1256
  isDirty: boolean;
1231
1257
  isTouched: boolean;
1232
1258
  isValidating: boolean;
1233
- error?: react_hook_form.FieldError;
1259
+ error?: react_hook_form.FieldError | undefined;
1234
1260
  id: string;
1235
1261
  name: string;
1236
1262
  formItemId: string;
@@ -6300,7 +6326,7 @@ declare const ConversationEmptyState: ({ className, title, description, icon, ch
6300
6326
  type ConversationScrollButtonProps = ComponentProps<typeof Button>;
6301
6327
  declare const ConversationScrollButton: ({ className, ...props }: ConversationScrollButtonProps) => false | react.JSX.Element;
6302
6328
 
6303
- type ImageProps = Experimental_GeneratedImage & {
6329
+ type ImageProps = GeneratedFile & {
6304
6330
  className?: string;
6305
6331
  alt?: string;
6306
6332
  };
package/dist/index.js CHANGED
@@ -13667,6 +13667,11 @@ function DrawerDescription({
13667
13667
  }
13668
13668
  function DynamicFavicon({ lightModeFavicon, darkModeFavicon }) {
13669
13669
  useEffect(() => {
13670
+ if (process.env.NODE_ENV !== "production") {
13671
+ console.warn(
13672
+ "[@nswds/app] DynamicFavicon is deprecated and will be removed in the next major. Use the app/ icon file conventions (favicon.ico, icon.svg, apple-icon.png) and put @media (prefers-color-scheme: dark) inside icon.svg \u2014 the browser then swaps the icon natively, before hydration, with no second asset."
13673
+ );
13674
+ }
13670
13675
  const updateFavicon = () => {
13671
13676
  const isDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches;
13672
13677
  const favicon = document.querySelector("link[rel='icon']");
@@ -14432,7 +14437,7 @@ function FormatToggle({ format, setFormat }) {
14432
14437
 
14433
14438
  // package.json
14434
14439
  var package_default = {
14435
- version: "4.0.2"};
14440
+ version: "4.0.4"};
14436
14441
  var SluggerContext = React5__default.createContext(null);
14437
14442
  function flattenText(nodes) {
14438
14443
  if (nodes == null || typeof nodes === "boolean") return "";