@kieksme/csp-plugin-chat 0.4.0 → 0.5.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.
package/dist/browser.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  cspPlugin
3
- } from "./chunk-3ZQPP6HM.js";
3
+ } from "./chunk-PQWU3SII.js";
4
4
 
5
5
  // src/browser.tsx
6
6
  import { useEffect, useRef, useState } from "react";
@@ -92,21 +92,36 @@ function Chat(ctx) {
92
92
  abort.current = null;
93
93
  }
94
94
  }
95
- return /* @__PURE__ */ jsxs("div", { className: "chat-layout", children: [
96
- /* @__PURE__ */ jsxs("div", { className: "chat-intro", children: [
95
+ return /* @__PURE__ */ jsxs("div", { className: "chat-layout grid grid-cols-[1fr_1.7fr] gap-13.75 compact:grid-cols-[1fr] compact:gap-3.75", children: [
96
+ /* @__PURE__ */ jsxs("div", { className: "chat-intro [&_p]:text-[0.875rem] [&_p]:text-muted [&_p]:leading-[1.8] compact:max-w-[500px]", children: [
97
97
  /* @__PURE__ */ jsx("h3", { children: "Eine Frage reicht." }),
98
98
  /* @__PURE__ */ jsx("p", { children: "Unser Assistent kennt die Hilfe-Inhalte, das Team und die aktuellen Meldungen. F\xFCr dringende St\xF6rungen bleibt die Hotline der direkte Weg." }),
99
- /* @__PURE__ */ jsx("p", { className: "data-state", children: "\xD6ffentlicher Chat \xB7 Verlauf nur in dieser Sitzung" })
99
+ /* @__PURE__ */ jsx("p", { className: "data-state font-mono text-[0.625rem] text-muted m-[calc(var(--spacing)_*_3)_0_0] [&.warning]:text-warning", children: "\xD6ffentlicher Chat \xB7 Verlauf nur in dieser Sitzung" })
100
100
  ] }),
101
- /* @__PURE__ */ jsxs("div", { className: "chat-panel", children: [
102
- /* @__PURE__ */ jsxs("div", { className: "chat-history", "aria-live": "polite", "aria-busy": busy, children: [
103
- !messages.length && /* @__PURE__ */ jsx("p", { className: "message assistant", children: "Wie kann ich Ihnen helfen?" }),
104
- messages.map((m, i) => /* @__PURE__ */ jsxs("div", { className: "message " + m.role, children: [
105
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: m.role === "user" ? "Sie: " : "Assistent: " }),
106
- m.content || "Antwort wird vorbereitet \u2026"
107
- ] }, i))
108
- ] }),
109
- sources.length > 0 && /* @__PURE__ */ jsxs("div", { className: "sources", children: [
101
+ /* @__PURE__ */ jsxs("div", { className: "chat-panel bg-card border border-line p-6 rounded-card", children: [
102
+ /* @__PURE__ */ jsxs(
103
+ "div",
104
+ {
105
+ className: "chat-history grid gap-3.75 max-h-[400px] overflow-auto mb-4",
106
+ "aria-live": "polite",
107
+ "aria-busy": busy,
108
+ children: [
109
+ !messages.length && /* @__PURE__ */ jsx("p", { className: "message assistant text-[0.8125rem] leading-[1.8] whitespace-pre-wrap [overflow-wrap:anywhere] [&.user]:bg-soft [&.user]:pt-3 [&.user]:pb-3 [&.user]:pl-4 [&.user]:pr-4 [&.user]:rounded-card [&.assistant]:[border-left:2px_solid_var(--accent)] [&.assistant]:pt-[0] [&.assistant]:pb-[0] [&.assistant]:pl-4 [&.assistant]:pr-4", children: "Wie kann ich Ihnen helfen?" }),
110
+ messages.map((m, i) => /* @__PURE__ */ jsxs(
111
+ "div",
112
+ {
113
+ className: "message text-[0.8125rem] leading-[1.8] whitespace-pre-wrap [overflow-wrap:anywhere] [&.user]:bg-soft [&.user]:pt-3 [&.user]:pb-3 [&.user]:pl-4 [&.user]:pr-4 [&.user]:rounded-card [&.assistant]:[border-left:2px_solid_var(--accent)] [&.assistant]:pt-[0] [&.assistant]:pb-[0] [&.assistant]:pl-4 [&.assistant]:pr-4 " + m.role,
114
+ children: [
115
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: m.role === "user" ? "Sie: " : "Assistent: " }),
116
+ m.content || "Antwort wird vorbereitet \u2026"
117
+ ]
118
+ },
119
+ i
120
+ ))
121
+ ]
122
+ }
123
+ ),
124
+ sources.length > 0 && /* @__PURE__ */ jsxs("div", { className: "sources text-[0.6875rem] text-muted mt-3.75 mb-3.75 ml-[0] mr-[0] [&_a]:mr-3", children: [
110
125
  "Referenzquellen:",
111
126
  " ",
112
127
  sources.map(
@@ -119,31 +134,45 @@ function Chat(ctx) {
119
134
  ] }, s.id)
120
135
  )
121
136
  ] }),
122
- /* @__PURE__ */ jsxs("form", { className: "chat-form", onSubmit: submit, children: [
123
- /* @__PURE__ */ jsx("label", { className: "sr-only", htmlFor: "chat-input", children: "Ihre Frage" }),
124
- /* @__PURE__ */ jsx(
125
- "textarea",
126
- {
127
- id: "chat-input",
128
- className: "search",
129
- value: input,
130
- maxLength: 4e3,
131
- onChange: (e) => setInput(e.target.value),
132
- placeholder: "Ihre Frage an unser Team \u2026",
133
- required: true
134
- }
135
- ),
136
- /* @__PURE__ */ jsx(
137
- "button",
138
- {
139
- type: "submit",
140
- disabled: busy || !input.trim(),
141
- "aria-label": "Frage senden",
142
- children: "\u2191"
143
- }
144
- )
145
- ] }),
146
- error && /* @__PURE__ */ jsx("p", { className: "chat-error", role: "alert", children: error })
137
+ /* @__PURE__ */ jsxs(
138
+ "form",
139
+ {
140
+ className: "chat-form flex gap-2.5 items-end [&_textarea]:resize-y [&_textarea]:min-h-[50px] [&_textarea]:[flex:1] [&_textarea]:min-w-0 [&_button]:bg-accent [&_button]:text-accent-ink [&_button]:[border:0] [&_button]:w-[50px] [&_button]:h-[50px] [&_button]:rounded-card [&_button]:text-[1.25rem] [&_button:disabled]:opacity-[0.5]",
141
+ onSubmit: submit,
142
+ children: [
143
+ /* @__PURE__ */ jsx("label", { className: "sr-only", htmlFor: "chat-input", children: "Ihre Frage" }),
144
+ /* @__PURE__ */ jsx(
145
+ "textarea",
146
+ {
147
+ id: "chat-input",
148
+ className: "search bg-card border border-line rounded-card py-3.5 px-4.5 text-ink w-full",
149
+ value: input,
150
+ maxLength: 4e3,
151
+ onChange: (e) => setInput(e.target.value),
152
+ placeholder: "Ihre Frage an unser Team \u2026",
153
+ required: true
154
+ }
155
+ ),
156
+ /* @__PURE__ */ jsx(
157
+ "button",
158
+ {
159
+ type: "submit",
160
+ disabled: busy || !input.trim(),
161
+ "aria-label": "Frage senden",
162
+ children: "\u2191"
163
+ }
164
+ )
165
+ ]
166
+ }
167
+ ),
168
+ error && /* @__PURE__ */ jsx(
169
+ "p",
170
+ {
171
+ className: "chat-error text-danger dark:text-warning text-[0.75rem]",
172
+ role: "alert",
173
+ children: error
174
+ }
175
+ )
147
176
  ] })
148
177
  ] });
149
178
  }
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var cspPlugin = {
3
3
  id: "chat",
4
- sdkVersion: "^0.4.0",
4
+ sdkVersion: "^0.5.0",
5
5
  browser: "./browser",
6
6
  server: "./server"
7
7
  };
package/dist/server.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  cspPlugin
3
- } from "./chunk-3ZQPP6HM.js";
3
+ } from "./chunk-PQWU3SII.js";
4
4
 
5
5
  // src/server.ts
6
6
  import { z } from "zod";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kieksme/csp-plugin-chat",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -22,7 +22,7 @@
22
22
  "registry": "https://registry.npmjs.org"
23
23
  },
24
24
  "dependencies": {
25
- "@kieksme/csp-sdk": "^0.4.0",
25
+ "@kieksme/csp-sdk": "^0.5.0",
26
26
  "zod": "^3.25.76",
27
27
  "openai": "^6.3.0"
28
28
  },
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "cspPlugin": {
36
36
  "id": "chat",
37
- "sdkVersion": "^0.4.0",
37
+ "sdkVersion": "^0.5.0",
38
38
  "browser": "./browser",
39
39
  "server": "./server"
40
40
  },