Files
copilotkit__copilotkit/packages/web-components/package.json
Benjamin Taylor 28437b1612 feat(web-components): expose drawer width + mobile breakpoint (ENT-1035)
Surface the CopilotThreadsDrawer's own structural values so host layouts
stop hand-copying `320px` / `768px`:

- New `layout-constants.ts` (single source of truth): DRAWER_DEFAULT_WIDTH,
  DRAWER_DEFAULT_WIDTH_PX, MOBILE_BREAKPOINT_PX, MOBILE_MAX_WIDTH_PX,
  MOBILE_MAX_WIDTH_QUERY. Exported from the barrel and from a PURE
  `./threads-drawer/layout-constants` subpath (importing it never evaluates
  the Lit element, so it is SSR-safe).
- Ship `./threads-drawer/layout.css`: a `:root --cpk-drawer-width` default
  plus `copilotkit-threads-layout` / `copilotkit-threads-main` helper classes
  that reserve the drawer column and collapse it on mobile off the same width
  and breakpoint the element uses. Copied into dist via a build:css step.
- The element and its shadow styles now read the constants. This also fixes
  the 767/768 seam (ENT-1037 item 1): the element flipped to mobile overlay at
  `max-width: 768px` while the react/vue coordination layers used
  `max-width: 767px`, so at exactly 768px the drawer went modal with no
  on-screen launcher. The element now uses 767px like everything else.
- react-core (Provider, ModalHeader, ChatInput) and vue (is-mobile-viewport,
  ChatInput) key their mobile split off the shared MOBILE_MAX_WIDTH_QUERY.
- Parity test asserts layout.css and the element stay in sync with the
  constants; attw excludes the CSS entrypoint.
2026-07-02 12:14:11 -05:00

98 lines
2.8 KiB
JSON

{
"name": "@copilotkit/web-components",
"version": "1.62.1",
"private": false,
"description": "Framework-agnostic shadow-DOM web components for CopilotKit - includes the <copilotkit-threads-drawer> threads drawer element",
"keywords": [
"ai",
"copilotkit",
"custom-elements",
"drawer",
"lit",
"shadow-dom",
"threads",
"web-components"
],
"homepage": "https://github.com/CopilotKit/CopilotKit",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/CopilotKit/CopilotKit.git",
"directory": "packages/web-components"
},
"files": [
"dist"
],
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.cts",
"unpkg": "./dist/index.umd.js",
"jsdelivr": "./dist/index.umd.js",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
},
"./threads-drawer": {
"import": {
"types": "./dist/threads-drawer/index.d.mts",
"default": "./dist/threads-drawer/index.mjs"
},
"require": {
"types": "./dist/threads-drawer/index.d.cts",
"default": "./dist/threads-drawer/index.cjs"
}
},
"./threads-drawer/layout-constants": {
"import": {
"types": "./dist/threads-drawer/layout-constants.d.mts",
"default": "./dist/threads-drawer/layout-constants.mjs"
},
"require": {
"types": "./dist/threads-drawer/layout-constants.d.cts",
"default": "./dist/threads-drawer/layout-constants.cjs"
}
},
"./threads-drawer/layout.css": "./dist/threads-drawer/layout.css",
"./package.json": "./package.json"
},
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "pnpm run gen:tokens && tsdown && pnpm run build:css",
"build:css": "node -e \"const fs=require('fs');fs.mkdirSync('./dist/threads-drawer',{recursive:true});fs.cpSync('./src/threads-drawer/layout.css','./dist/threads-drawer/layout.css')\"",
"gen:tokens": "tsx scripts/generate-tokens.ts",
"compat-check": "es-check es2022 --module 'dist/**/!(*.umd).{mjs,cjs,js}' && es-check es2018 'dist/**/*.umd.js'",
"check-types": "tsc --noEmit -p tsconfig.json",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",
"publint": "publint .",
"attw": "attw --pack . --profile node16"
},
"peerDependencies": {
"lit": "^3.3.2"
},
"devDependencies": {
"@copilotkit/typescript-config": "workspace:*",
"@types/node": "^22.15.3",
"jsdom": "^26.1.0",
"lit": "^3.3.2",
"tsdown": "^0.20.3",
"tsx": "^4.19.2",
"typescript": "5.9.2",
"vitest": "^3.2.4"
},
"engines": {
"node": ">=18"
}
}