@duct-sdk/sdk 0.3.9 → 0.3.11

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/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  Public release notes for the Duct SDK. Versioning follows [semver](https://semver.org).
4
4
 
5
+ ## [0.3.11] — 2026-06-16
6
+
7
+ ### Fixed
8
+ - **Panel drag handle (light theme)** — grab bar uses a solid mid-gray with subtle shadow instead of 20% black, so it stays visible on light shell headers.
9
+
10
+ ## [0.3.10] — 2026-06-16
11
+
12
+ ### Improved
13
+ - **`duct init` shell generator** — `DuctShellEmbed` now passes `theme` from `duct.config.ts` → `widget.theme`; Svelte/Vue/Nuxt iframe URLs include `?theme=` so the hosted shell matches before push.
14
+
5
15
  ## [0.3.9] — 2026-06-14
6
16
 
7
17
  ### Added
@@ -62,10 +62,16 @@ function clampBubble(x, y) {
62
62
  y: Math.min(Math.max(margin, y), Math.max(margin, maxY)),
63
63
  };
64
64
  }
65
+ /** Visible grab-bar on light panels (solid beats low-alpha rgba on variable iframe headers). */
66
+ function dragHandleBarColor(isDark, hovered) {
67
+ if (isDark)
68
+ return hovered ? "rgba(255,255,255,0.38)" : "rgba(255,255,255,0.32)";
69
+ return hovered ? "#524E48" : "#635F59";
70
+ }
65
71
  /** Top grab handle for the open panel — with theme-aware hover tooltip. */
66
72
  function ShellDragHandle({ onPointerDown, isDragging, isDark, label = "Drag to move", style, }) {
67
73
  const [hovered, setHovered] = useState(false);
68
- const barColor = isDark ? "rgba(255,255,255,0.28)" : "rgba(12,11,9,0.20)";
74
+ const barColor = dragHandleBarColor(isDark, hovered);
69
75
  const showTip = hovered && !isDragging;
70
76
  return (_jsxs("div", { role: "button", tabIndex: -1, onPointerDown: onPointerDown, "aria-label": label, onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), style: {
71
77
  position: "absolute",
@@ -84,9 +90,10 @@ function ShellDragHandle({ onPointerDown, isDragging, isDark, label = "Drag to m
84
90
  ...style,
85
91
  }, children: [_jsx("div", { "aria-hidden": "true", style: {
86
92
  width: 32,
87
- height: 4,
93
+ height: isDark ? 4 : 5,
88
94
  borderRadius: 2,
89
95
  backgroundColor: barColor,
96
+ boxShadow: isDark ? undefined : "0 1px 2px rgba(12,11,9,0.12)",
90
97
  } }), showTip && (_jsx("div", { role: "tooltip", style: {
91
98
  position: "absolute",
92
99
  top: "100%",
@@ -2,12 +2,27 @@
2
2
  // @duct/sdk — Shell Component Generator
3
3
  // Generates framework-specific shell embed components
4
4
  // ============================================================
5
+ function widgetTheme(config) {
6
+ const t = config.widget?.theme;
7
+ if (t === "light" || t === "dark" || t === "system")
8
+ return t;
9
+ return "system";
10
+ }
11
+ /** DuctShell `theme` prop line — launcher chrome; chat surface uses manifest.widget.theme from duct push. */
12
+ function ductShellThemeProp(config, indent = " ") {
13
+ return `${indent}theme="${widgetTheme(config)}"`;
14
+ }
15
+ /** Iframe src query string so hosted shell matches widget.theme before/at push time. */
16
+ function shellThemeQuery(config) {
17
+ return `?theme=${widgetTheme(config)}`;
18
+ }
5
19
  // ----------------------------------------------------------------
6
20
  // Next.js / React shell component
7
21
  // ----------------------------------------------------------------
8
22
  function generateReactShellComponent(config) {
9
23
  const position = config.widget?.position ?? "bottom-right";
10
24
  const preset = config.widget?.preset ?? "tall";
25
+ const themeProp = ductShellThemeProp(config);
11
26
  const docsBase = config.product?.baseUrl
12
27
  ? `https://docs.${new URL(config.product.baseUrl).hostname.split('.').slice(-2).join('.')}`
13
28
  : 'http://localhost:3005/docs';
@@ -35,6 +50,7 @@ export function DuctShellEmbed() {
35
50
  shellHost={shellHost}
36
51
  position="${position}"
37
52
  preset="${preset}"
53
+ ${themeProp}
38
54
  // Size preset: "tall" (vertical), "square" (Copilot-style), or "large".
39
55
  // The bubble and opened panel are draggable; \`position\` only sets the starting corner.
40
56
  // Optional: provide user context (not sensitive — this is metadata for the shell UI)
@@ -149,6 +165,7 @@ export default function RootLayout({
149
165
  function generateRemixShellComponent(config) {
150
166
  const position = config.widget?.position ?? "bottom-right";
151
167
  const preset = config.widget?.preset ?? "tall";
168
+ const themeProp = ductShellThemeProp(config);
152
169
  const docsBase = config.product?.baseUrl
153
170
  ? `https://docs.${new URL(config.product.baseUrl).hostname.split('.').slice(-2).join('.')}`
154
171
  : 'http://localhost:3005/docs';
@@ -174,6 +191,7 @@ export function DuctShellEmbed() {
174
191
  shellHost={shellHost}
175
192
  position="${position}"
176
193
  preset="${preset}"
194
+ ${themeProp}
177
195
  onTokenRequest={async (shellId) => {
178
196
  const res = await fetch("/api/duct/token", {
179
197
  method: "POST",
@@ -202,6 +220,7 @@ export function DuctShellEmbed() {
202
220
  function generateViteShellComponent(config) {
203
221
  const position = config.widget?.position ?? "bottom-right";
204
222
  const preset = config.widget?.preset ?? "tall";
223
+ const themeProp = ductShellThemeProp(config);
205
224
  const docsBase = config.product?.baseUrl
206
225
  ? `https://docs.${new URL(config.product.baseUrl).hostname.split('.').slice(-2).join('.')}`
207
226
  : 'http://localhost:3005/docs';
@@ -227,6 +246,7 @@ export function DuctShellEmbed() {
227
246
  shellHost={shellHost}
228
247
  position="${position}"
229
248
  preset="${preset}"
249
+ ${themeProp}
230
250
  onTokenRequest={async (shellId) => {
231
251
  const res = await fetch("/api/duct/token", {
232
252
  method: "POST",
@@ -312,6 +332,7 @@ export function getEnvTemplateName(framework) {
312
332
  // SvelteKit shell component
313
333
  // ----------------------------------------------------------------
314
334
  function generateSvelteKitShellComponent(config) {
335
+ const themeQuery = shellThemeQuery(config);
315
336
  const docsBase = config.product?.baseUrl
316
337
  ? `https://docs.${new URL(config.product.baseUrl).hostname.split('.').slice(-2).join('.')}`
317
338
  : 'http://localhost:3005/docs';
@@ -333,7 +354,7 @@ function generateSvelteKitShellComponent(config) {
333
354
 
334
355
  const shellId = env.PUBLIC_DUCT_SHELL_ID ?? "";
335
356
  const shellHost = env.PUBLIC_DUCT_SHELL_HOST ?? "http://localhost:3000";
336
- const shellUrl = \`\${shellHost}/\${shellId}\`;
357
+ const shellUrl = \`\${shellHost}/\${shellId}${themeQuery}\`;
337
358
 
338
359
  async function getToken(): Promise<string> {
339
360
  const res = await fetch("/api/duct/token", {
@@ -420,6 +441,7 @@ function generateVue3ShellComponent(config) {
420
441
  const position = config.widget?.position ?? "bottom-right";
421
442
  const width = config.widget?.width ?? 380;
422
443
  const height = config.widget?.height ?? 620;
444
+ const themeQuery = shellThemeQuery(config);
423
445
  const docsBase = config.product?.baseUrl
424
446
  ? `https://docs.${new URL(config.product.baseUrl).hostname.split('.').slice(-2).join('.')}`
425
447
  : 'http://localhost:3005/docs';
@@ -474,7 +496,7 @@ const iframeRef = ref<HTMLIFrameElement | null>(null);
474
496
 
475
497
  const shellId = import.meta.env.VITE_DUCT_SHELL_ID as string ?? '';
476
498
  const shellHost = import.meta.env.VITE_DUCT_SHELL_HOST as string ?? 'http://localhost:3000';
477
- const shellUrl = computed(() => \`\${shellHost}/\${shellId}\`);
499
+ const shellUrl = computed(() => \`\${shellHost}/\${shellId}${themeQuery}\`);
478
500
 
479
501
  async function getToken(): Promise<string> {
480
502
  try {
@@ -539,6 +561,7 @@ function generateNuxtShellComponent(config) {
539
561
  const position = config.widget?.position ?? "bottom-right";
540
562
  const width = config.widget?.width ?? 380;
541
563
  const height = config.widget?.height ?? 620;
564
+ const themeQuery = shellThemeQuery(config);
542
565
  const docsBase = config.product?.baseUrl
543
566
  ? `https://docs.${new URL(config.product.baseUrl).hostname.split('.').slice(-2).join('.')}`
544
567
  : 'http://localhost:3005/docs';
@@ -593,7 +616,7 @@ const iframeRef = ref<HTMLIFrameElement | null>(null);
593
616
  const config = useRuntimeConfig();
594
617
  const shellId = (config.public.ductShellId as string) ?? '';
595
618
  const shellHost = (config.public.ductShellHost as string) ?? 'http://localhost:3000';
596
- const shellUrl = computed(() => \`\${shellHost}/\${shellId}\`);
619
+ const shellUrl = computed(() => \`\${shellHost}/\${shellId}${themeQuery}\`);
597
620
 
598
621
  async function getToken(): Promise<string> {
599
622
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duct-sdk/sdk",
3
- "version": "0.3.9",
3
+ "version": "0.3.11",
4
4
  "type": "module",
5
5
  "description": "Duct SDK — A shell (like terminal) that knows when to talk, when to show, and when to hand off.",
6
6
  "main": "dist/index.js",