@lofcz/streamdown 2.9.2 → 2.9.3

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.
@@ -8,17 +8,23 @@
8
8
  */
9
9
  export declare const STREAMDOWN_CLASSES: readonly string[];
10
10
  /**
11
- * Generates a Tailwind v4 `@source inline()` directive containing all
11
+ * Generates Tailwind v4 `@source inline()` directive(s) containing all
12
12
  * streamdown classes, optionally prefixed.
13
13
  *
14
+ * Classes that contain commas (e.g. `text-[var(--sdm-c,inherit)]`) cannot live
15
+ * inside a brace group — `@source inline("{a,b}")` brace-expands on commas and
16
+ * would split them. Those are emitted as their own `@source inline("…")` lines.
17
+ *
14
18
  * @param prefix - Tailwind v4 prefix string (e.g. `"tw"` for `prefix(tw)`).
15
19
  * Omit or pass `undefined` when you are not using a prefix.
16
- * @returns A ready-to-paste CSS `@source inline(...)` rule string.
20
+ * @returns Ready-to-paste CSS `@source inline(...)` rule string(s).
17
21
  *
18
22
  * @example
19
23
  * // In a postcss.config.js build script, write this string to a CSS file:
20
24
  * import { getSourceInline } from 'streamdown/tailwind';
21
25
  * console.log(getSourceInline('tw'));
22
26
  * // → @source inline("tw:{absolute,animate-spin,...}");
27
+ * // @source inline("tw:text-[var(--sdm-c,inherit)]");
28
+ * // …
23
29
  */
24
30
  export declare function getSourceInline(prefix?: string): string;
@@ -1 +1,2 @@
1
- var t=["-mt-10","[&>p]:inline","[&>p:last-child]:mb-0","[&>svg]:inline-block","[&_svg]:h-auto","[&_svg]:w-auto","[counter-increment:line_0]","[counter-reset:line]","[li_&]:pl-6","absolute","animate-spin","appearance-none","backdrop-blur-sm","before:[counter-increment:line]","before:content-[counter(line)]","before:font-mono","before:inline-block","before:mr-4","before:select-none","before:text-[13px]","before:text-muted-foreground/50","before:text-right","before:w-6","bg-[var(--sdm-bg,inherit]","bg-[var(--sdm-tbg)]","bg-background","bg-background/50","bg-background/80","bg-background/90","bg-background/95","bg-black/10","bg-muted","bg-muted/40","bg-muted/80","bg-primary","bg-red-100","bg-red-50","bg-sidebar","bg-sidebar/80","block","border","border-b","border-b-2","border-border","border-collapse","border-current","border-l-4","border-muted-foreground/30","border-red-200","border-sidebar","border-t","bottom-2","bottom-4","break-all","cursor-pointer","dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit)]","dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]","dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]","disabled:cursor-not-allowed","disabled:opacity-50","divide-border","divide-y","duration-150","duration-200","ease-out","fixed","flex","flex-1","flex-col","font-medium","font-mono","font-semibold","gap-1","gap-2","gap-4","group","group-hover:block","group-hover:opacity-100","h-4","h-8","h-[46px]","h-auto","h-full","hidden","hover:bg-background","hover:bg-muted","hover:bg-muted/40","hover:bg-primary/90","hover:text-foreground","inline-block","inset-0","italic","items-center","justify-between","justify-center","justify-end","left-2","left-4","list-decimal","list-disc","list-inside","lowercase","max-h-32","max-w-full","max-w-md","mb-2","min-h-28","min-h-[200px]","min-w-[120px]","ml-1","mt-1","mt-2","mt-6","mx-4","my-4","my-6","opacity-0","origin-center","overflow-hidden","overflow-x-auto","overflow-y-auto","overscroll-y-auto","p-1","p-1.5","p-2","p-3","p-4","p-6","pl-4","pointer-events-auto","pointer-events-none","px-1.5","px-3","px-4","py-0.5","py-1","py-2","relative","right-0","right-2","right-4","rounded","rounded-full","rounded-lg","rounded-md","rounded-r-md","rounded-xl","shadow-lg","shadow-sm","shrink-0","size-4","size-full","space-x-2","space-y-2","space-y-4","sticky","table-fixed","supports-[backdrop-filter]:backdrop-blur","supports-[backdrop-filter]:backdrop-blur-sm","supports-[backdrop-filter]:bg-background/70","supports-[backdrop-filter]:bg-sidebar/70","text-2xl","text-3xl","text-[var(--sdm-c,inherit)]","text-base","text-left","text-lg","text-muted-foreground","text-primary","text-primary-foreground","text-red-600","text-red-700","text-red-800","text-sm","text-xl","text-xs","top-2","top-4","top-full","transition-all","transition-colors","transition-transform","w-4","w-8","w-full","whitespace-normal","whitespace-nowrap","wrap-anywhere","z-10","z-50"];function n(e){let r=[...t];return `@source inline("${e?`${e}:{${r.join(",")}}`:`{${r.join(",")}}`}");`}export{t as STREAMDOWN_CLASSES,n as getSourceInline};
1
+ var s=["-mt-10","[&>p]:inline","[&>p:last-child]:mb-0","[&>svg]:inline-block","[&_svg]:h-auto","[&_svg]:w-auto","[counter-increment:line_0]","[counter-reset:line]","[li_&]:pl-6","absolute","animate-spin","appearance-none","backdrop-blur-sm","before:[counter-increment:line]","before:content-[counter(line)]","before:font-mono","before:inline-block","before:mr-4","before:select-none","before:text-[13px]","before:text-muted-foreground/50","before:text-right","before:w-6","bg-[var(--sdm-bg,inherit)]","bg-[var(--sdm-tbg)]","bg-background","bg-background/50","bg-background/80","bg-background/90","bg-background/95","bg-black/10","bg-muted","bg-muted/40","bg-muted/80","bg-primary","bg-red-100","bg-red-50","bg-sidebar","bg-sidebar/80","block","border","border-b","border-b-2","border-border","border-collapse","border-current","border-l-4","border-muted-foreground/30","border-red-200","border-sidebar","border-t","bottom-2","bottom-4","break-all","cursor-pointer","dark:bg-[var(--shiki-dark-bg,var(--sdm-bg,inherit))]","dark:bg-[var(--shiki-dark-bg,var(--sdm-tbg))]","dark:text-[var(--shiki-dark,var(--sdm-c,inherit))]","disabled:cursor-not-allowed","disabled:opacity-50","divide-border","divide-y","duration-150","duration-200","ease-out","fixed","flex","flex-1","flex-col","font-medium","font-mono","font-semibold","gap-1","gap-2","gap-4","group","group-hover:block","group-hover:opacity-100","h-4","h-8","h-[46px]","h-auto","h-full","hidden","hover:bg-background","hover:bg-muted","hover:bg-muted/40","hover:bg-primary/90","hover:text-foreground","inline-block","inset-0","italic","items-center","justify-between","justify-center","justify-end","left-2","left-4","list-decimal","list-disc","list-inside","lowercase","max-h-32","max-w-full","max-w-md","mb-2","min-h-28","min-h-[200px]","min-w-[120px]","ml-1","mt-1","mt-2","mt-6","mx-4","my-4","my-6","opacity-0","origin-center","overflow-hidden","overflow-x-auto","overflow-y-auto","overscroll-y-auto","p-1","p-1.5","p-2","p-3","p-4","p-6","pl-4","pointer-events-auto","pointer-events-none","px-1.5","px-3","px-4","py-0.5","py-1","py-2","relative","right-0","right-2","right-4","rounded","rounded-full","rounded-lg","rounded-md","rounded-r-md","rounded-xl","shadow-lg","shadow-sm","shrink-0","size-4","size-full","space-x-2","space-y-2","space-y-4","sticky","table-fixed","supports-[backdrop-filter]:backdrop-blur","supports-[backdrop-filter]:backdrop-blur-sm","supports-[backdrop-filter]:bg-background/70","supports-[backdrop-filter]:bg-sidebar/70","text-2xl","text-3xl","text-[var(--sdm-c,inherit)]","text-base","text-left","text-lg","text-muted-foreground","text-primary","text-primary-foreground","text-red-600","text-red-700","text-red-800","text-sm","text-xl","text-xs","top-2","top-4","top-full","transition-all","transition-colors","transition-transform","w-4","w-8","w-full","whitespace-normal","whitespace-nowrap","wrap-anywhere","z-10","z-50"];function a(r){let i=[...s],d=e=>r?`${r}:${e}`:e,t=[],n=[];for(let e of i)e.includes(",")?n.push(e):t.push(e);let o=[];if(t.length>0){let e=r?`${r}:{${t.join(",")}}`:`{${t.join(",")}}`;o.push(`@source inline("${e}");`);}for(let e of n)o.push(`@source inline("${d(e)}");`);return o.join(`
2
+ `)}export{s as STREAMDOWN_CLASSES,a as getSourceInline};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lofcz/streamdown",
3
- "version": "2.9.2",
3
+ "version": "2.9.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -52,8 +52,8 @@
52
52
  "tsup": "^8.5.1",
53
53
  "typescript": "^7.0.2",
54
54
  "vitest": "^4.0.15",
55
- "@streamdown/math": "npm:@lofcz/streamdown-math@1.0.3",
56
55
  "@streamdown/cjk": "npm:@lofcz/streamdown-cjk@1.0.3",
56
+ "@streamdown/math": "npm:@lofcz/streamdown-math@1.0.3",
57
57
  "@streamdown/mermaid": "npm:@lofcz/streamdown-mermaid@1.0.2"
58
58
  },
59
59
  "peerDependencies": {
package/styles.css CHANGED
@@ -136,3 +136,30 @@
136
136
  )::after {
137
137
  content: none;
138
138
  }
139
+
140
+ /*
141
+ * Shiki dual-theme tokens stash colors in --sdm-c / --shiki-dark (inline `color`
142
+ * would override the dark-mode class switch). The matching Tailwind utilities
143
+ * contain commas (`text-[var(--sdm-c,inherit)]`), and `@source inline("{a,b}")`
144
+ * brace-expands on those commas — so the utilities never get generated.
145
+ * Apply the custom properties here instead.
146
+ */
147
+ [data-streamdown="code-block"] [style*="--sdm-c"] {
148
+ color: var(--sdm-c, inherit);
149
+ }
150
+
151
+ :is(.dark, [data-theme="dark"])
152
+ [data-streamdown="code-block"]
153
+ [style*="--sdm-c"] {
154
+ color: var(--shiki-dark, var(--sdm-c, inherit));
155
+ }
156
+
157
+ [data-streamdown="code-block"] [style*="--sdm-tbg"] {
158
+ background-color: var(--sdm-tbg);
159
+ }
160
+
161
+ :is(.dark, [data-theme="dark"])
162
+ [data-streamdown="code-block"]
163
+ [style*="--sdm-tbg"] {
164
+ background-color: var(--shiki-dark-bg, var(--sdm-tbg));
165
+ }