@formio/uag-js 0.0.0-stage → 2.0.0-rc.1

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/index.mjs ADDED
@@ -0,0 +1,5 @@
1
+ // The ES module entry: the same module as index.js, which is CommonJS (and a browser global).
2
+ import uag from './index.js';
3
+
4
+ export const { UAG, attach, createChat, uagFormUrl, routingPlugin, ExtractionState, SSEParser, isEmpty, CHAT_TEMPLATES } = uag;
5
+ export default uag;
package/package.json CHANGED
@@ -1,6 +1,47 @@
1
1
  {
2
2
  "name": "@formio/uag-js",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "2.0.0-rc.1",
4
+ "description": "The Form.io UAG for formio.js applications: register it once, and forms tagged \"uag\" save through the UAG and get Agent Input, without overwriting what the user entered.",
5
+ "keywords": [
6
+ "formio",
7
+ "formio.js",
8
+ "uag",
9
+ "universal-agent-gateway",
10
+ "ai",
11
+ "forms"
12
+ ],
13
+ "license": "MIT",
14
+ "main": "index.js",
15
+ "module": "index.mjs",
16
+ "browser": "index.js",
17
+ "types": "index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./index.d.ts",
21
+ "import": "./index.mjs",
22
+ "require": "./index.js",
23
+ "default": "./index.js"
24
+ },
25
+ "./uag-js.css": "./uag-js.css",
26
+ "./package.json": "./package.json"
27
+ },
28
+ "files": [
29
+ "index.js",
30
+ "index.mjs",
31
+ "index.d.ts",
32
+ "uag-js.css",
33
+ "README.md",
34
+ "LICENSE.txt"
35
+ ],
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "git+https://github.com/formio/uag.git",
39
+ "directory": "packages/uag-js"
40
+ },
41
+ "peerDependencies": {
42
+ "@formio/js": ">=5"
43
+ },
44
+ "publishConfig": {
45
+ "access": "public"
46
+ }
47
+ }
package/uag-js.css ADDED
@@ -0,0 +1,94 @@
1
+ /* Default styles for Agent Input annotations and the chat. Override freely. */
2
+ .uag-chip { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; font-size: 0.85em; padding: 2px 8px; border-radius: 10px; }
3
+ .uag-confident { background: #e7f4ee; color: #1d5b3f; }
4
+ .uag-uncertain { background: #fff4de; color: #6b4a07; }
5
+ .uag-suggested { background: #eef1f6; color: #3b4658; }
6
+ .uag-alternative { border: 1px solid currentColor; background: transparent; border-radius: 8px; padding: 0 6px; cursor: pointer; font: inherit; }
7
+ .uag-review { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-weight: 600; cursor: pointer; }
8
+ .uag-review input { margin: 0; accent-color: #1d5b3f; }
9
+ .uag-uncertain.uag-review-needed { background: #fdecee; color: #8a1f1f; box-shadow: 0 0 0 2px currentColor; }
10
+ .uag-uncertain.uag-reviewed { background: #e7f4ee; color: #1d5b3f; }
11
+ .uag-error { margin-top: 4px; font-size: 0.85em; color: #8a1f1f; }
12
+
13
+ /*
14
+ * The chat (Formio.createChat). Theme it by setting these custom properties on
15
+ * .uag-chat or any ancestor, or replace these rules entirely:
16
+ * --uag-chat-font: inherit
17
+ * --uag-chat-bg: #f4f5f7
18
+ * --uag-chat-surface: #ffffff
19
+ * --uag-chat-text: #0c141d
20
+ * --uag-chat-muted: #566073
21
+ * --uag-chat-border: #e0e5ec
22
+ * --uag-chat-accent: #3a7d22
23
+ * --uag-chat-accent-text: #ffffff
24
+ * --uag-chat-user-bg: #3a4756
25
+ * --uag-chat-user-text: #ffffff
26
+ * --uag-chat-radius: 16px
27
+ * --uag-chat-height: 560px
28
+ */
29
+ .uag-chat {
30
+ display: flex;
31
+ flex-direction: column;
32
+ height: var(--uag-chat-height, 560px);
33
+ min-height: 320px;
34
+ font: inherit;
35
+ font-family: var(--uag-chat-font, inherit);
36
+ color: var(--uag-chat-text, #0c141d);
37
+ background: var(--uag-chat-surface, #ffffff);
38
+ border: 1px solid var(--uag-chat-border, #e0e5ec);
39
+ border-radius: var(--uag-chat-radius, 16px);
40
+ overflow: hidden;
41
+ box-sizing: border-box;
42
+ }
43
+ .uag-chat *, .uag-chat *::before, .uag-chat *::after { box-sizing: border-box; }
44
+ .uag-chat [hidden] { display: none !important; }
45
+ .uag-chat__header { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--uag-chat-border, #e0e5ec); }
46
+ .uag-chat__title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
47
+ .uag-chat__action {
48
+ font: inherit; font-size: 0.85em; padding: 5px 12px; cursor: pointer;
49
+ border: 1px solid var(--uag-chat-border, #e0e5ec); border-radius: 999px;
50
+ background: var(--uag-chat-surface, #ffffff); color: var(--uag-chat-muted, #566073);
51
+ }
52
+ .uag-chat__action:hover { color: var(--uag-chat-text, #0c141d); border-color: var(--uag-chat-muted, #566073); }
53
+ .uag-chat__log { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--uag-chat-bg, #f4f5f7); }
54
+ .uag-chat__message { max-width: 85%; padding: 10px 14px; border-radius: var(--uag-chat-radius, 16px); overflow-wrap: anywhere; line-height: 1.45; }
55
+ .uag-chat__message p { margin: 0 0 8px; }
56
+ .uag-chat__message p:last-child { margin-bottom: 0; }
57
+ .uag-chat__message ul, .uag-chat__message ol { margin: 0 0 8px; padding-left: 20px; }
58
+ .uag-chat__message--user { align-self: flex-end; background: var(--uag-chat-user-bg, #3a4756); color: var(--uag-chat-user-text, #ffffff); border-bottom-right-radius: 4px; }
59
+ .uag-chat__message--assistant { align-self: flex-start; background: var(--uag-chat-surface, #ffffff); border: 1px solid var(--uag-chat-border, #e0e5ec); border-bottom-left-radius: 4px; }
60
+ .uag-chat__typing { display: flex; gap: 5px; padding: 14px; }
61
+ .uag-chat__typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--uag-chat-muted, #566073); animation: uag-chat-bounce 1.25s infinite ease-in-out; }
62
+ .uag-chat__typing span:nth-child(2) { animation-delay: .16s; }
63
+ .uag-chat__typing span:nth-child(3) { animation-delay: .32s; }
64
+ @keyframes uag-chat-bounce { 0%, 65%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: .95; } }
65
+ @media (prefers-reduced-motion: reduce) { .uag-chat__typing span { animation: none; } }
66
+ .uag-chat__suggestions { display: flex; flex-wrap: wrap; gap: 8px; }
67
+ .uag-chat__suggestion {
68
+ font: inherit; font-size: 0.9em; padding: 6px 12px; cursor: pointer; text-align: left;
69
+ border: 1px solid var(--uag-chat-accent, #3a7d22); border-radius: 999px; background: var(--uag-chat-surface, #ffffff); color: var(--uag-chat-text, #0c141d);
70
+ }
71
+ .uag-chat__notice { align-self: stretch; padding: 10px 14px; border-radius: 12px; font-size: 0.92em; background: var(--uag-chat-surface, #ffffff); border: 1px solid var(--uag-chat-border, #e0e5ec); color: var(--uag-chat-muted, #566073); }
72
+ .uag-chat__notice--error { background: #fdecee; border-color: #f3c2c8; color: #a23442; }
73
+ .uag-chat__notice--success { background: #edfae6; border-color: #c9e8b4; color: #3f7a22; }
74
+ .uag-chat__summary { align-self: stretch; padding: 12px 14px; border-radius: 12px; background: var(--uag-chat-surface, #ffffff); border: 1px solid var(--uag-chat-accent, #3a7d22); }
75
+ .uag-chat__summary-title { font-weight: 600; margin-bottom: 8px; }
76
+ .uag-chat__summary dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0 0 12px; }
77
+ .uag-chat__summary dt { color: var(--uag-chat-muted, #566073); }
78
+ .uag-chat__summary dd { margin: 0; overflow-wrap: anywhere; }
79
+ .uag-chat__summary-actions { display: flex; flex-wrap: wrap; gap: 8px; }
80
+ .uag-chat__submit, .uag-chat__send {
81
+ font: inherit; font-weight: 600; padding: 8px 18px; cursor: pointer;
82
+ border: 1px solid var(--uag-chat-accent, #3a7d22); border-radius: 999px; background: var(--uag-chat-accent, #3a7d22); color: var(--uag-chat-accent-text, #ffffff);
83
+ }
84
+ .uag-chat__submit:disabled, .uag-chat__send:disabled { opacity: .5; cursor: default; }
85
+ .uag-chat__composer { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--uag-chat-border, #e0e5ec); }
86
+ .uag-chat__input { flex: 1; min-width: 0; font: inherit; padding: 9px 14px; color: var(--uag-chat-text, #0c141d); background: var(--uag-chat-surface, #ffffff); border: 1px solid var(--uag-chat-border, #e0e5ec); border-radius: 999px; }
87
+ .uag-chat__input:focus { outline: 2px solid var(--uag-chat-accent, #3a7d22); outline-offset: -1px; }
88
+ .uag-chat__form { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 16px; }
89
+ .uag-chat__form-bar { display: flex; justify-content: flex-end; margin-bottom: 8px; }
90
+ .uag-chat__sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
91
+ @media (max-width: 480px) {
92
+ .uag-chat__message { max-width: 92%; }
93
+ .uag-chat__header, .uag-chat__composer, .uag-chat__log, .uag-chat__form { padding-left: 12px; padding-right: 12px; }
94
+ }