@copilotkit/web-components 1.62.0

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.
Files changed (49) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +90 -0
  3. package/dist/index.cjs +12 -0
  4. package/dist/index.d.cts +7 -0
  5. package/dist/index.d.mts +7 -0
  6. package/dist/index.mjs +7 -0
  7. package/dist/index.umd.js +2548 -0
  8. package/dist/index.umd.js.map +1 -0
  9. package/dist/threads-drawer/copilotkit-threads-drawer.cjs +677 -0
  10. package/dist/threads-drawer/copilotkit-threads-drawer.cjs.map +1 -0
  11. package/dist/threads-drawer/copilotkit-threads-drawer.d.cts +182 -0
  12. package/dist/threads-drawer/copilotkit-threads-drawer.d.cts.map +1 -0
  13. package/dist/threads-drawer/copilotkit-threads-drawer.d.mts +182 -0
  14. package/dist/threads-drawer/copilotkit-threads-drawer.d.mts.map +1 -0
  15. package/dist/threads-drawer/copilotkit-threads-drawer.mjs +676 -0
  16. package/dist/threads-drawer/copilotkit-threads-drawer.mjs.map +1 -0
  17. package/dist/threads-drawer/define.cjs +15 -0
  18. package/dist/threads-drawer/define.cjs.map +1 -0
  19. package/dist/threads-drawer/define.d.cts +17 -0
  20. package/dist/threads-drawer/define.d.cts.map +1 -0
  21. package/dist/threads-drawer/define.d.mts +17 -0
  22. package/dist/threads-drawer/define.d.mts.map +1 -0
  23. package/dist/threads-drawer/define.mjs +15 -0
  24. package/dist/threads-drawer/define.mjs.map +1 -0
  25. package/dist/threads-drawer/generated-tokens.cjs +33 -0
  26. package/dist/threads-drawer/generated-tokens.cjs.map +1 -0
  27. package/dist/threads-drawer/generated-tokens.d.cts +32 -0
  28. package/dist/threads-drawer/generated-tokens.d.cts.map +1 -0
  29. package/dist/threads-drawer/generated-tokens.d.mts +32 -0
  30. package/dist/threads-drawer/generated-tokens.d.mts.map +1 -0
  31. package/dist/threads-drawer/generated-tokens.mjs +32 -0
  32. package/dist/threads-drawer/generated-tokens.mjs.map +1 -0
  33. package/dist/threads-drawer/index.cjs +11 -0
  34. package/dist/threads-drawer/index.d.cts +6 -0
  35. package/dist/threads-drawer/index.d.mts +6 -0
  36. package/dist/threads-drawer/index.mjs +6 -0
  37. package/dist/threads-drawer/styles.cjs +499 -0
  38. package/dist/threads-drawer/styles.cjs.map +1 -0
  39. package/dist/threads-drawer/styles.d.cts +24 -0
  40. package/dist/threads-drawer/styles.d.cts.map +1 -0
  41. package/dist/threads-drawer/styles.d.mts +24 -0
  42. package/dist/threads-drawer/styles.d.mts.map +1 -0
  43. package/dist/threads-drawer/styles.mjs +499 -0
  44. package/dist/threads-drawer/styles.mjs.map +1 -0
  45. package/dist/threads-drawer/types.d.cts +97 -0
  46. package/dist/threads-drawer/types.d.cts.map +1 -0
  47. package/dist/threads-drawer/types.d.mts +97 -0
  48. package/dist/threads-drawer/types.d.mts.map +1 -0
  49. package/package.json +85 -0
@@ -0,0 +1,97 @@
1
+ //#region src/threads-drawer/types.d.ts
2
+ /**
3
+ * Public type surface for the `<copilotkit-threads-drawer>` custom element.
4
+ *
5
+ * The element is a pure VIEW: domain data flows IN as properties and user
6
+ * intent flows OUT as DOM `CustomEvent`s. These types intentionally do NOT
7
+ * import from `@copilotkit/core` or any framework — the element is
8
+ * framework-agnostic and self-contained. The thread shape mirrors the fields
9
+ * the drawer needs to render and is structurally compatible with core's thread
10
+ * record (`id`, `name`, `archived`, timestamps).
11
+ */
12
+ /**
13
+ * Minimal thread record the drawer renders. A `null` name signals an
14
+ * as-yet-unnamed thread and is rendered as a "New thread" placeholder until the
15
+ * async name arrives.
16
+ */
17
+ interface DrawerThread {
18
+ /** Stable thread identifier; drives row keying and slot reconciliation. */
19
+ readonly id: string;
20
+ /** Display name, or `null` when not yet named. */
21
+ readonly name: string | null;
22
+ /** Whether the thread is archived (affects styling + available actions). */
23
+ readonly archived: boolean;
24
+ /** ISO timestamp the thread was created. */
25
+ readonly createdAt: string;
26
+ /** ISO timestamp the thread was last updated. */
27
+ readonly updatedAt: string;
28
+ /** ISO timestamp of the most recent run, if any. */
29
+ readonly lastRunAt?: string;
30
+ }
31
+ /** The Active/All filter the element owns authoritatively. */
32
+ type DrawerFilter = "active" | "all";
33
+ /** `detail` for the `thread-selected` event. */
34
+ interface ThreadSelectedDetail {
35
+ readonly threadId: string;
36
+ }
37
+ /** `detail` for the `archive` event. */
38
+ interface ArchiveDetail {
39
+ readonly threadId: string;
40
+ }
41
+ /** `detail` for the `unarchive` event. */
42
+ interface UnarchiveDetail {
43
+ readonly threadId: string;
44
+ }
45
+ /** `detail` for the `delete` event (fired only after in-element confirm). */
46
+ interface DeleteDetail {
47
+ readonly threadId: string;
48
+ }
49
+ /** `detail` for the `filter-change` event. */
50
+ interface FilterChangeDetail {
51
+ readonly filter: DrawerFilter;
52
+ }
53
+ /** `detail` for the `open-change` event. */
54
+ interface OpenChangeDetail {
55
+ readonly open: boolean;
56
+ }
57
+ /**
58
+ * `detail` for the `retry` event, emitted from the actionable error state so a
59
+ * wrapper can back it with a core refetch. `scope` distinguishes an initial
60
+ * fetch retry from a fetch-more retry.
61
+ */
62
+ interface RetryDetail {
63
+ readonly scope: "initial" | "fetch-more";
64
+ }
65
+ /** `detail` for the `new-thread` event. */
66
+ type NewThreadDetail = Record<string, never>;
67
+ /**
68
+ * `detail` for the `licensed` event (Upgrade CTA click). Carries the
69
+ * `licenseUrl` the element will open in a new tab. The event is cancelable:
70
+ * a host that calls `preventDefault()` suppresses the default navigation and
71
+ * takes over (e.g. to route in-app or fire its own telemetry).
72
+ */
73
+ interface LicensedDetail {
74
+ readonly licenseUrl: string | null;
75
+ }
76
+ /** `detail` for the `load-more` event (advance pagination; no payload). */
77
+ type LoadMoreDetail = Record<string, never>;
78
+ /**
79
+ * Strongly-typed event map for `<copilotkit-threads-drawer>`. Consumers can use this to
80
+ * type `addEventListener` callbacks. All events bubble and are composed so they
81
+ * cross the shadow boundary.
82
+ */
83
+ interface CopilotKitThreadsDrawerEventMap {
84
+ "thread-selected": CustomEvent<ThreadSelectedDetail>;
85
+ archive: CustomEvent<ArchiveDetail>;
86
+ unarchive: CustomEvent<UnarchiveDetail>;
87
+ delete: CustomEvent<DeleteDetail>;
88
+ "new-thread": CustomEvent<NewThreadDetail>;
89
+ "filter-change": CustomEvent<FilterChangeDetail>;
90
+ "open-change": CustomEvent<OpenChangeDetail>;
91
+ retry: CustomEvent<RetryDetail>;
92
+ licensed: CustomEvent<LicensedDetail>;
93
+ "load-more": CustomEvent<LoadMoreDetail>;
94
+ }
95
+ //#endregion
96
+ export { ArchiveDetail, CopilotKitThreadsDrawerEventMap, DeleteDetail, DrawerFilter, DrawerThread, FilterChangeDetail, LicensedDetail, LoadMoreDetail, NewThreadDetail, OpenChangeDetail, RetryDetail, ThreadSelectedDetail, UnarchiveDetail };
97
+ //# sourceMappingURL=types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.mts","names":[],"sources":["../../src/threads-drawer/types.ts"],"mappings":";;AAgBA;;;;;;;;;;;;AAgBA;;UAhBiB,YAAA;EAgBO;EAAA,SAdb,EAAA;EAiBM;EAAA,SAfN,IAAA;;WAEA,QAAA;EAcQ;EAAA,SAZR,SAAA;EAgBmB;EAAA,SAdnB,SAAA;EAeA;EAAA,SAbA,SAAA;AAAA;;KAIC,YAAA;;UAGK,oBAAA;EAAA,SACN,QAAA;AAAA;;UAIM,aAAA;EAAA,SACN,QAAA;AAAA;;UAIM,eAAA;EAAA,SACN,QAAA;AAAA;AAcX;AAAA,UAViB,YAAA;EAAA,SACN,QAAA;AAAA;;UAIM,kBAAA;EAAA,SACN,MAAA,EAAQ,YAAA;AAAA;;UAIF,gBAAA;EAAA,SACN,IAAA;AAAA;;;;AAqBX;;UAbiB,WAAA;EAAA,SACN,KAAA;AAAA;AAiBX;AAAA,KAbY,eAAA,GAAkB,MAAA;;;;AAoB9B;;;UAZiB,cAAA;EAAA,SACN,UAAA;AAAA;;KAIC,cAAA,GAAiB,MAAA;;;;;;UAOZ,+BAAA;EACf,iBAAA,EAAmB,WAAA,CAAY,oBAAA;EAC/B,OAAA,EAAS,WAAA,CAAY,aAAA;EACrB,SAAA,EAAW,WAAA,CAAY,eAAA;EACvB,MAAA,EAAQ,WAAA,CAAY,YAAA;EACpB,YAAA,EAAc,WAAA,CAAY,eAAA;EAC1B,eAAA,EAAiB,WAAA,CAAY,kBAAA;EAC7B,aAAA,EAAe,WAAA,CAAY,gBAAA;EAC3B,KAAA,EAAO,WAAA,CAAY,WAAA;EACnB,QAAA,EAAU,WAAA,CAAY,cAAA;EACtB,WAAA,EAAa,WAAA,CAAY,cAAA;AAAA"}
package/package.json ADDED
@@ -0,0 +1,85 @@
1
+ {
2
+ "name": "@copilotkit/web-components",
3
+ "version": "1.62.0",
4
+ "private": false,
5
+ "description": "Framework-agnostic shadow-DOM web components for CopilotKit - includes the <copilotkit-threads-drawer> threads drawer element",
6
+ "keywords": [
7
+ "ai",
8
+ "copilotkit",
9
+ "custom-elements",
10
+ "drawer",
11
+ "lit",
12
+ "shadow-dom",
13
+ "threads",
14
+ "web-components"
15
+ ],
16
+ "homepage": "https://github.com/CopilotKit/CopilotKit",
17
+ "license": "MIT",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/CopilotKit/CopilotKit.git",
21
+ "directory": "packages/web-components"
22
+ },
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "type": "module",
27
+ "main": "./dist/index.cjs",
28
+ "module": "./dist/index.mjs",
29
+ "types": "./dist/index.d.cts",
30
+ "unpkg": "./dist/index.umd.js",
31
+ "jsdelivr": "./dist/index.umd.js",
32
+ "exports": {
33
+ ".": {
34
+ "import": {
35
+ "types": "./dist/index.d.mts",
36
+ "default": "./dist/index.mjs"
37
+ },
38
+ "require": {
39
+ "types": "./dist/index.d.cts",
40
+ "default": "./dist/index.cjs"
41
+ }
42
+ },
43
+ "./threads-drawer": {
44
+ "import": {
45
+ "types": "./dist/threads-drawer/index.d.mts",
46
+ "default": "./dist/threads-drawer/index.mjs"
47
+ },
48
+ "require": {
49
+ "types": "./dist/threads-drawer/index.d.cts",
50
+ "default": "./dist/threads-drawer/index.cjs"
51
+ }
52
+ },
53
+ "./package.json": "./package.json"
54
+ },
55
+ "publishConfig": {
56
+ "access": "public"
57
+ },
58
+ "peerDependencies": {
59
+ "lit": "^3.3.2"
60
+ },
61
+ "devDependencies": {
62
+ "@types/node": "^22.15.3",
63
+ "jsdom": "^26.1.0",
64
+ "lit": "^3.3.2",
65
+ "tsdown": "^0.20.3",
66
+ "tsx": "^4.19.2",
67
+ "typescript": "5.9.2",
68
+ "vitest": "^3.2.4",
69
+ "@copilotkit/typescript-config": "1.55.0-next.8"
70
+ },
71
+ "engines": {
72
+ "node": ">=18"
73
+ },
74
+ "scripts": {
75
+ "build": "pnpm run gen:tokens && tsdown",
76
+ "gen:tokens": "tsx scripts/generate-tokens.ts",
77
+ "compat-check": "es-check es2022 --module 'dist/**/!(*.umd).{mjs,cjs,js}' && es-check es2018 'dist/**/*.umd.js'",
78
+ "check-types": "tsc --noEmit -p tsconfig.json",
79
+ "test": "vitest run",
80
+ "test:watch": "vitest",
81
+ "test:coverage": "vitest run --coverage",
82
+ "publint": "publint .",
83
+ "attw": "attw --pack . --profile node16"
84
+ }
85
+ }