@g9tm/aiassistant-svelte 1.10.0 → 1.11.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/AssistantRoot.svelte +76 -33
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/parts/Composer.svelte +6 -4
- package/dist/parts/Icon.svelte +9 -0
- package/dist/parts/Icon.svelte.d.ts +7 -0
- package/dist/parts/Message.svelte +4 -3
- package/dist/parts/MessageList.svelte +13 -1
- package/dist/parts/MessageList.svelte.d.ts +1 -0
- package/dist/parts/PdfButton.svelte +44 -37
- package/dist/parts/PdfButton.svelte.d.ts +4 -1
- package/dist/parts/WorkCard.svelte +4 -4
- package/dist/parts/WorkCard.svelte.d.ts +1 -0
- package/dist/parts/icons.d.ts +3 -0
- package/dist/parts/icons.js +22 -0
- package/dist/surfaces/AssistantChat.svelte +3 -3
- package/dist/surfaces/AssistantChat.svelte.d.ts +1 -0
- package/dist/surfaces/AssistantPanel.svelte +57 -52
- package/dist/surfaces/AssistantPanel.svelte.d.ts +2 -0
- package/package.json +2 -2
|
@@ -43,45 +43,86 @@
|
|
|
43
43
|
.g9a-styled :global(.g9a-panel[data-layout="inline"]) { inline-size: 100%; block-size: 100%; box-shadow: none; border: 1px solid var(--g9a-line); border-radius: var(--g9a-radius); }
|
|
44
44
|
.g9a-styled :global(.g9a-panel[data-layout="card"]) { border-radius: var(--g9a-radius); border: 1px solid var(--g9a-line); max-block-size: 520px; }
|
|
45
45
|
.g9a-styled :global(.g9a-panel[data-layout="compact"]) { box-shadow: none; }
|
|
46
|
-
.g9a-styled :global(.g9a-panel__header) { display: flex; align-items: center; gap:
|
|
47
|
-
.g9a-styled :global(.g9a-panel__header > strong) { flex: 1; min-inline-size: 0; }
|
|
46
|
+
.g9a-styled :global(.g9a-panel__header) { display: flex; align-items: center; gap: 10px; padding-block: 10px; padding-inline: var(--g9a-pad) 8px; border-bottom: 1px solid var(--g9a-line); }
|
|
47
|
+
.g9a-styled :global(.g9a-panel__header > strong) { flex: 1; min-inline-size: 0; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
48
|
+
.g9a-styled :global(.g9a-panel__mark), .g9a-styled :global(.g9a-messages__empty-mark) { display: inline-grid; place-items: center; flex: none; inline-size: 30px; block-size: 30px; border-radius: 50%; color: var(--g9a-accent); background: color-mix(in srgb, var(--g9a-accent) 15%, transparent); }
|
|
49
|
+
.g9a-styled :global(.g9a-panel__tools) { display: flex; align-items: center; gap: 2px; margin-inline-start: auto; }
|
|
50
|
+
.g9a-styled :global(.g9a-icon) { flex: none; }
|
|
51
|
+
.g9a-styled :global(.g9a-icon-button), .g9a-styled :global(.g9a-composer__attach), .g9a-styled :global(.g9a-composer__mic) { display: inline-grid; place-items: center; flex: none; inline-size: 34px; min-block-size: 34px; padding: 0; border: 0; border-radius: var(--g9a-radius); background: transparent; color: var(--g9a-muted); transition: background-color var(--g9a-motion), color var(--g9a-motion); }
|
|
52
|
+
.g9a-styled :global(.g9a-icon-button:hover), .g9a-styled :global(.g9a-composer__attach:hover), .g9a-styled :global(.g9a-composer__mic:hover) { background: color-mix(in srgb, var(--g9a-ink) 8%, transparent); color: var(--g9a-ink); }
|
|
53
|
+
.g9a-styled :global(.g9a-composer__mic[aria-pressed="true"]) { color: var(--g9a-danger); }
|
|
54
|
+
.g9a-styled :global(button:focus-visible) { outline: 2px solid color-mix(in srgb, var(--g9a-accent) 70%, transparent); outline-offset: 2px; }
|
|
55
|
+
.g9a-styled :global(button:disabled) { opacity: .5; cursor: default; }
|
|
48
56
|
.g9a-styled :global(.g9a-panel__body), .g9a-styled :global(.g9a-chat) { display: flex; flex-direction: column; flex: 1; min-block-size: 0; }
|
|
49
|
-
.g9a-styled :global(.g9a-messages) { flex: 1; overflow-y: auto; padding: var(--g9a-pad); display: flex; flex-direction: column; gap: var(--g9a-
|
|
57
|
+
.g9a-styled :global(.g9a-messages) { flex: 1; overflow-y: auto; padding: 16px var(--g9a-pad) 12px; display: flex; flex-direction: column; gap: 20px; scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--g9a-ink) 20%, transparent) transparent; }
|
|
58
|
+
.g9a-styled :global(.g9a-messages > [data-id]) { display: flex; flex-direction: column; min-inline-size: 0; }
|
|
59
|
+
.g9a-styled :global(.g9a-messages__empty) { margin-block: auto; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 24px 8px; text-align: center; }
|
|
60
|
+
.g9a-styled :global(.g9a-messages__empty-mark) { inline-size: 48px; block-size: 48px; margin-block-end: 6px; }
|
|
61
|
+
.g9a-styled :global(.g9a-messages__empty-mark .g9a-icon) { inline-size: 24px; block-size: 24px; }
|
|
62
|
+
.g9a-styled :global(.g9a-messages__empty > strong) { font-size: 16px; font-weight: 600; }
|
|
63
|
+
.g9a-styled :global(.g9a-messages__empty .g9a-block__actions) { justify-content: center; margin-block-start: 14px; }
|
|
50
64
|
.g9a-styled :global(.g9a-messages-frame) { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
|
|
51
65
|
.g9a-styled :global(.g9a-messages[data-selectable="true"]) { user-select: text; -webkit-user-select: text; }
|
|
52
|
-
.g9a-styled :global(.g9a-messages__newest) { position: absolute; bottom:
|
|
66
|
+
.g9a-styled :global(.g9a-messages__newest) { position: absolute; bottom: 10px; inset-inline: 0; margin-inline: auto; inline-size: fit-content; min-block-size: 32px; padding: 0 14px; border-radius: 999px; font-size: 12px; background: var(--g9a-surface); box-shadow: var(--g9a-shadow); }
|
|
53
67
|
.g9a-styled :global(.g9a-list) { margin: 0 0 6px; padding-inline-start: 1.4em; }
|
|
54
68
|
.g9a-styled :global(.g9a-list li) { padding-inline-start: 0.2em; }
|
|
55
69
|
.g9a-styled :global(.g9a-composer__menu), .g9a-styled :global(.g9a-block__entities), .g9a-styled :global(.g9a-tour-nav) { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
56
|
-
.g9a-styled :global(.g9a-message) { max-inline-size:
|
|
57
|
-
.g9a-styled :global(.g9a-message__user) { align-self: flex-start; background: var(--g9a-user-bubble, color-mix(in srgb, var(--g9a-accent)
|
|
58
|
-
.g9a-styled :global(.g9a-
|
|
70
|
+
.g9a-styled :global(.g9a-message) { max-inline-size: 100%; min-inline-size: 0; }
|
|
71
|
+
.g9a-styled :global(.g9a-message__user) { align-self: flex-start; max-inline-size: 85%; padding: 9px 14px; border-radius: calc(var(--g9a-radius) + 8px); border-start-start-radius: var(--g9a-radius-s); background: var(--g9a-user-bubble, color-mix(in srgb, var(--g9a-accent) 16%, var(--g9a-surface))); }
|
|
72
|
+
.g9a-styled :global(.g9a-message__user .g9a-p:last-child) { margin: 0; }
|
|
73
|
+
.g9a-styled :global(.g9a-message__assistant) { align-self: stretch; }
|
|
74
|
+
.g9a-styled :global(.g9a-message__assistant > * + *) { margin-block-start: 10px; }
|
|
59
75
|
.g9a-styled :global(.g9a-message[data-pending="true"]) { opacity: .7; }
|
|
60
|
-
.g9a-styled :global(.g9a-message__feedback) { display: flex;
|
|
61
|
-
.g9a-styled :global(.g9a-
|
|
62
|
-
.g9a-styled :global(.g9a-
|
|
76
|
+
.g9a-styled :global(.g9a-message__feedback), .g9a-styled :global(.g9a-message__rate) { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; color: var(--g9a-muted); font-size: 12px; }
|
|
77
|
+
.g9a-styled :global(.g9a-message__rate > span) { margin-inline-end: 4px; }
|
|
78
|
+
.g9a-styled :global(.g9a-message__feedback button), .g9a-styled :global(.g9a-message__rate button) { min-block-size: 30px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; color: var(--g9a-muted); font-size: 12px; }
|
|
79
|
+
.g9a-styled :global(.g9a-message__feedback .g9a-icon-button), .g9a-styled :global(.g9a-message__rate .g9a-icon-button) { inline-size: 30px; padding: 0; border-radius: var(--g9a-radius-s); }
|
|
80
|
+
.g9a-styled :global(.g9a-message__feedback .g9a-icon), .g9a-styled :global(.g9a-message__rate .g9a-icon) { inline-size: 16px; block-size: 16px; }
|
|
81
|
+
.g9a-styled :global(.g9a-message__feedback button:hover), .g9a-styled :global(.g9a-message__rate button:hover) { background: color-mix(in srgb, var(--g9a-ink) 8%, transparent); color: var(--g9a-ink); }
|
|
82
|
+
.g9a-styled :global(.g9a-message__provenance) { font-size: 11px; color: var(--g9a-muted); padding: 1px 8px; margin-inline-end: 4px; border-radius: 999px; background: color-mix(in srgb, var(--g9a-ink) 7%, transparent); }
|
|
63
83
|
.g9a-styled :global(.g9a-p) { margin: 0 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
64
|
-
.g9a-styled :global(code) { font-family: ui-monospace, monospace; background: var(--g9a-surface); border-radius: 4px; padding: 0 4px; }
|
|
84
|
+
.g9a-styled :global(code) { font-family: ui-monospace, monospace; background: var(--g9a-surface-2); border-radius: 4px; padding: 0 4px; }
|
|
65
85
|
.g9a-styled :global(a) { color: var(--g9a-accent); }
|
|
66
|
-
.g9a-styled :global(.g9a-work) { display: flex; gap: var(--g9a-gap); align-items: flex-start;
|
|
86
|
+
.g9a-styled :global(.g9a-work) { display: flex; gap: var(--g9a-gap); align-items: flex-start; margin: 0 var(--g9a-pad) 4px; padding: 10px 12px; border-radius: var(--g9a-radius); background: var(--g9a-surface-2); }
|
|
67
87
|
.g9a-styled :global(.g9a-work-main) { flex: 1; min-inline-size: 0; }
|
|
68
|
-
.g9a-styled :global(.g9a-work-head) { display: flex;
|
|
88
|
+
.g9a-styled :global(.g9a-work-head) { display: flex; align-items: center; gap: 10px; }
|
|
89
|
+
.g9a-styled :global(.g9a-work-head > strong) { flex: 1; min-inline-size: 0; font-size: 13px; font-weight: 600; }
|
|
90
|
+
.g9a-styled :global(.g9a-work__elapsed) { font-variant-numeric: tabular-nums; }
|
|
91
|
+
.g9a-styled :global(.g9a-work__progress), .g9a-styled :global(.g9a-work__status) { font-size: 12px; margin-block-start: 2px; }
|
|
92
|
+
.g9a-styled :global(.g9a-work__tool) { display: flex; align-items: center; gap: 8px; }
|
|
93
|
+
.g9a-styled :global(.g9a-work__tool::before) { content: ""; flex: none; inline-size: 5px; block-size: 5px; border-radius: 50%; background: currentColor; opacity: .6; }
|
|
94
|
+
.g9a-styled :global(.g9a-work__tool[data-state="start"]) { color: var(--g9a-ink); }
|
|
95
|
+
.g9a-styled :global(.g9a-work__tool[data-state="start"]::before) { background: var(--g9a-accent); opacity: 1; }
|
|
96
|
+
.g9a-styled :global(.g9a-stream) { font-size: 12px; color: var(--g9a-muted); margin-block-start: 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; }
|
|
69
97
|
.g9a-styled :global(.g9a-work__elapsed), .g9a-styled :global(.g9a-work__tool), .g9a-styled :global(.g9a-note) { color: var(--g9a-muted); font-size: 12px; }
|
|
70
|
-
.g9a-styled :global(.g9a-stages)
|
|
71
|
-
.g9a-styled :global(.g9a-
|
|
72
|
-
.g9a-styled :global(
|
|
73
|
-
.g9a-styled :global(.g9a-
|
|
98
|
+
.g9a-styled :global(.g9a-stages) { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-block: 8px 2px; }
|
|
99
|
+
.g9a-styled :global(.g9a-stages-thinking) { display: flex; flex-wrap: wrap; gap: 6px; margin-block: 4px; }
|
|
100
|
+
.g9a-styled :global(.g9a-work__stage) { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--g9a-muted); }
|
|
101
|
+
.g9a-styled :global(.g9a-work__stage::before) { content: ""; flex: none; inline-size: 7px; block-size: 7px; border-radius: 50%; background: var(--g9a-line); }
|
|
102
|
+
.g9a-styled :global(.g9a-work__stage[data-state="on"]) { color: var(--g9a-ink); font-weight: 600; }
|
|
103
|
+
.g9a-styled :global(.g9a-work__stage[data-state="on"]::before) { background: var(--g9a-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--g9a-accent) 25%, transparent); }
|
|
104
|
+
.g9a-styled :global(.g9a-work__stage[data-state="done"]::before) { background: color-mix(in srgb, var(--g9a-accent) 55%, transparent); }
|
|
105
|
+
.g9a-styled :global(.g9a-stages-thinking > span) { padding: 1px 10px; border-radius: 999px; border: 1px solid var(--g9a-line); font-size: 12px; color: var(--g9a-muted); }
|
|
106
|
+
.g9a-styled :global(.g9a-stages-thinking > [data-state="on"]) { background: color-mix(in srgb, var(--g9a-accent) 20%, transparent); color: var(--g9a-ink); border-color: var(--g9a-accent); }
|
|
107
|
+
.g9a-styled :global(.g9a-thinking-orb) { inline-size: 10px; block-size: 10px; border-radius: 50%; background: var(--g9a-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--g9a-accent) 20%, transparent); animation: g9a-pulse 1.2s ease-in-out infinite; flex: none; }
|
|
74
108
|
.g9a-styled :global(.g9a-thinking-orb[data-still="true"]) { animation: none; }
|
|
75
109
|
@keyframes -global-g9a-pulse { 0%, 100% { transform: scale(.8); opacity: .6; } 50% { transform: scale(1); opacity: 1; } }
|
|
76
110
|
@media (prefers-reduced-motion: reduce) { .g9a-styled :global(.g9a-thinking-orb) { animation: none; } }
|
|
77
|
-
.g9a-styled :global(.g9a-composer) { padding: var(--g9a-pad)
|
|
78
|
-
.g9a-styled :global(.g9a-composer-row) { display: flex; gap: var(--g9a-
|
|
79
|
-
.g9a-styled :global(.g9a-
|
|
111
|
+
.g9a-styled :global(.g9a-composer) { padding: 8px var(--g9a-pad) var(--g9a-pad); }
|
|
112
|
+
.g9a-styled :global(.g9a-composer-row) { display: flex; gap: 2px; align-items: flex-end; padding: 5px; border: 1px solid var(--g9a-line); border-radius: calc(var(--g9a-radius) + 10px); background: var(--g9a-surface-2); transition: border-color var(--g9a-motion), box-shadow var(--g9a-motion); }
|
|
113
|
+
.g9a-styled :global(.g9a-composer-row:focus-within) { border-color: color-mix(in srgb, var(--g9a-accent) 60%, var(--g9a-line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--g9a-accent) 15%, transparent); }
|
|
114
|
+
.g9a-styled :global(.g9a-composer-row .g9a-composer__attach), .g9a-styled :global(.g9a-composer-row .g9a-composer__mic), .g9a-styled :global(.g9a-composer-row .g9a-composer__send), .g9a-styled :global(.g9a-composer-row .g9a-composer__stop) { inline-size: 36px; min-block-size: 36px; border-radius: 50%; }
|
|
115
|
+
.g9a-styled :global(.g9a-composer__input) { flex: 1; min-inline-size: 0; min-block-size: 36px; max-block-size: 30vh; box-sizing: border-box; resize: none; padding: 7px 6px; border: 0; border-radius: 0; background: transparent; outline: none; line-height: 1.55; }
|
|
80
116
|
.g9a-styled :global(.g9a-composer__send) { background: var(--g9a-accent); color: var(--g9a-accent-ink); border-color: var(--g9a-accent); }
|
|
117
|
+
.g9a-styled :global(.g9a-composer-row .g9a-composer__send), .g9a-styled :global(.g9a-composer-row .g9a-composer__stop) { display: inline-grid; place-items: center; flex: none; padding: 0; border: 0; transition: opacity var(--g9a-motion), transform var(--g9a-motion); }
|
|
118
|
+
.g9a-styled :global(.g9a-composer__send[data-empty="true"]) { opacity: .45; }
|
|
119
|
+
.g9a-styled :global(.g9a-composer-row .g9a-composer__stop) { background: var(--g9a-ink); color: var(--g9a-surface); }
|
|
120
|
+
.g9a-styled :global(.g9a-composer__menu button) { min-block-size: 30px; border-radius: 999px; font-size: 12px; }
|
|
121
|
+
.g9a-styled :global(.g9a-composer__menu) { margin-block-end: 8px; }
|
|
81
122
|
.g9a-styled :global(.g9a-file-chips) { display: flex; flex-wrap: wrap; gap: 4px; margin-block-end: 6px; }
|
|
82
|
-
.g9a-styled :global(.g9a-file-chip) { background: var(--g9a-surface-2); border-radius: 999px; padding: 2px
|
|
83
|
-
.g9a-styled :global(.g9a-file-chip button) { min-block-size:
|
|
84
|
-
.g9a-styled :global(.g9a-card__approval) { border: 1px solid var(--g9a-approval-card-border); border-radius: var(--g9a-radius); padding:
|
|
123
|
+
.g9a-styled :global(.g9a-file-chip) { display: inline-flex; align-items: center; gap: 2px; background: var(--g9a-surface-2); border: 1px solid var(--g9a-line); border-radius: 999px; padding-block: 2px; padding-inline: 10px 2px; font-size: 12px; }
|
|
124
|
+
.g9a-styled :global(.g9a-file-chip button) { min-block-size: 22px; border: 0; border-radius: 999px; background: none; padding: 0 6px; color: var(--g9a-muted); }
|
|
125
|
+
.g9a-styled :global(.g9a-card__approval) { border: 1px solid color-mix(in srgb, var(--g9a-approval-card-border) 55%, transparent); border-radius: calc(var(--g9a-radius) + 4px); padding: 14px; background: var(--g9a-surface); }
|
|
85
126
|
.g9a-styled :global(.g9a-card__approval h3) { margin: 0 0 6px; font-size: 15px; }
|
|
86
127
|
.g9a-styled :global(.g9a-card__approval__fact) { font-size: 12px; color: var(--g9a-muted); padding-inline-start: 24px; }
|
|
87
128
|
.g9a-styled :global(.g9a-card__approval__confirm) { background: var(--g9a-accent); color: var(--g9a-accent-ink); border-color: var(--g9a-accent); }
|
|
@@ -100,27 +141,29 @@
|
|
|
100
141
|
.g9a-styled :global([data-bad="true"]), .g9a-styled :global([data-ok="false"]) { color: var(--g9a-danger); }
|
|
101
142
|
.g9a-styled :global(.g9a-block-title) { font-weight: 600; margin-block: 4px; }
|
|
102
143
|
.g9a-styled :global(.g9a-block__table table) { border-collapse: collapse; inline-size: 100%; font-size: 13px; }
|
|
103
|
-
.g9a-styled :global(.g9a-block__table th), .g9a-styled :global(.g9a-block__table td) { border-bottom: 1px solid var(--g9a-line); padding:
|
|
144
|
+
.g9a-styled :global(.g9a-block__table th), .g9a-styled :global(.g9a-block__table td) { border-bottom: 1px solid var(--g9a-line); padding: 6px 8px; text-align: start; }
|
|
145
|
+
.g9a-styled :global(.g9a-block__table th) { color: var(--g9a-muted); font-size: 12px; font-weight: 600; }
|
|
104
146
|
.g9a-styled :global([data-kind="number"]), .g9a-styled :global([data-kind="money"]), .g9a-styled :global([data-kind="percent"]) { text-align: end; font-variant-numeric: tabular-nums; }
|
|
105
|
-
.g9a-styled :global(.g9a-block__table__card) { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0 0 6px; padding:
|
|
147
|
+
.g9a-styled :global(.g9a-block__table__card) { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0 0 6px; padding: 8px 10px; background: var(--g9a-surface-2); border-radius: var(--g9a-radius-s); }
|
|
106
148
|
.g9a-styled :global(.g9a-block__table__card dt) { color: var(--g9a-muted); }
|
|
107
149
|
.g9a-styled :global(.g9a-block__table__card dd) { margin: 0; }
|
|
108
150
|
.g9a-styled :global(.g9a-block__chart__bar) { display: grid; grid-template-columns: 1fr; gap: 2px; margin-block-end: 6px; }
|
|
109
|
-
.g9a-styled :global(.g9a-bar-track) { display: block; block-size:
|
|
110
|
-
.g9a-styled :global(.g9a-bar-fill) { display: block; block-size: 100%; background: var(--g9a-chart-bar); border-radius:
|
|
151
|
+
.g9a-styled :global(.g9a-bar-track) { display: block; block-size: 8px; background: var(--g9a-surface-2); border-radius: 4px; overflow: hidden; }
|
|
152
|
+
.g9a-styled :global(.g9a-bar-fill) { display: block; block-size: 100%; background: var(--g9a-chart-bar); border-radius: 4px; }
|
|
111
153
|
.g9a-styled :global(.g9a-bar-value) { font-size: 12px; color: var(--g9a-muted); }
|
|
112
154
|
.g9a-styled :global(.g9a-block__chart__line) { inline-size: 100%; block-size: 140px; }
|
|
113
155
|
.g9a-styled :global(.g9a-block__chart__line path) { stroke: var(--g9a-chart-bar); stroke-width: 2; }
|
|
114
156
|
.g9a-styled :global(.g9a-donut) { inline-size: 120px; }
|
|
115
157
|
.g9a-styled :global(.g9a-donut path) { fill: none; stroke: var(--g9a-chart-bar); stroke-width: 14; }
|
|
116
158
|
.g9a-styled :global(.g9a-block__kpi) { display: flex; flex-wrap: wrap; gap: var(--g9a-gap); }
|
|
117
|
-
.g9a-styled :global(.g9a-block__kpi > div) { display: flex; flex-direction: column; padding:
|
|
118
|
-
.g9a-styled :global(.g9a-block__actions) { display: flex; flex-wrap: wrap; gap:
|
|
119
|
-
.g9a-styled :global(.g9a-block__action) {
|
|
120
|
-
.g9a-styled :global(.g9a-block__action
|
|
121
|
-
.g9a-styled :global(
|
|
159
|
+
.g9a-styled :global(.g9a-block__kpi > div) { display: flex; flex-direction: column; flex: 1 1 110px; padding: 8px 12px; background: var(--g9a-surface-2); border-radius: var(--g9a-radius); }
|
|
160
|
+
.g9a-styled :global(.g9a-block__actions) { display: flex; flex-wrap: wrap; gap: 8px; margin-block-start: 6px; }
|
|
161
|
+
.g9a-styled :global(.g9a-block__action) { display: inline-flex; align-items: center; gap: 10px; max-inline-size: 100%; padding: 0 14px; border-radius: 999px; border-color: color-mix(in srgb, var(--g9a-accent) 35%, transparent); background: color-mix(in srgb, var(--g9a-accent) 10%, transparent); text-align: start; transition: background-color var(--g9a-motion), border-color var(--g9a-motion); }
|
|
162
|
+
.g9a-styled :global(.g9a-block__action:hover) { background: color-mix(in srgb, var(--g9a-accent) 18%, transparent); border-color: color-mix(in srgb, var(--g9a-accent) 60%, transparent); }
|
|
163
|
+
.g9a-styled :global(.g9a-block__action::after) { content: ""; flex: none; inline-size: 6px; block-size: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); opacity: .55; }
|
|
164
|
+
.g9a-styled[dir="rtl"] :global(.g9a-block__action::after) { transform: rotate(135deg); }
|
|
122
165
|
.g9a-styled :global(.g9a-suggested) { font-size: 10px; color: var(--g9a-muted); margin-inline-start: 6px; }
|
|
123
|
-
.g9a-styled :global(.g9a-block__callout) { border-inline-start: 3px solid var(--g9a-accent); padding:
|
|
166
|
+
.g9a-styled :global(.g9a-block__callout) { border-inline-start: 3px solid var(--g9a-accent); padding: 8px 12px; background: var(--g9a-surface-2); border-start-end-radius: var(--g9a-radius-s); border-end-end-radius: var(--g9a-radius-s); }
|
|
124
167
|
.g9a-styled :global(.g9a-block__callout[data-tone="danger"]) { border-color: var(--g9a-danger); }
|
|
125
168
|
.g9a-styled :global(.g9a-block__callout[data-tone="warn"]) { border-color: var(--g9a-warn); }
|
|
126
169
|
.g9a-styled :global(.g9a-block__image img) { max-inline-size: 100%; border-radius: var(--g9a-radius-s); }
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export { default as WorkCard } from "./parts/WorkCard.svelte";
|
|
|
10
10
|
export { default as TextView } from "./parts/TextView.svelte";
|
|
11
11
|
export { default as RevealText } from "./parts/RevealText.svelte";
|
|
12
12
|
export { default as ThinkingOrb } from "./parts/ThinkingOrb.svelte";
|
|
13
|
+
export { default as Icon } from "./parts/Icon.svelte";
|
|
14
|
+
export type { IconName } from "./parts/icons.js";
|
|
13
15
|
export { default as StagesThinking } from "./parts/StagesThinking.svelte";
|
|
14
16
|
export { default as Small } from "./parts/Small.svelte";
|
|
15
17
|
export { default as BlockView } from "./blocks/BlockView.svelte";
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export { default as WorkCard } from "./parts/WorkCard.svelte";
|
|
|
10
10
|
export { default as TextView } from "./parts/TextView.svelte";
|
|
11
11
|
export { default as RevealText } from "./parts/RevealText.svelte";
|
|
12
12
|
export { default as ThinkingOrb } from "./parts/ThinkingOrb.svelte";
|
|
13
|
+
export { default as Icon } from "./parts/Icon.svelte";
|
|
13
14
|
export { default as StagesThinking } from "./parts/StagesThinking.svelte";
|
|
14
15
|
export { default as Small } from "./parts/Small.svelte";
|
|
15
16
|
export { default as BlockView } from "./blocks/BlockView.svelte";
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { can, type PickedRef, type QuickRequest } from "@g9tm/aiassistant";
|
|
4
4
|
import { atWord, chatOf, composerOf, matchQuick, pickRefs, putPick, refsIn, slashQuery } from "@g9tm/aiassistant/pages";
|
|
5
5
|
import { cls, sty, useUi } from "../context.js";
|
|
6
|
+
import Icon from "./Icon.svelte";
|
|
6
7
|
|
|
7
8
|
let { busy, attachments, placeholder = undefined }: { busy: boolean; attachments: { id: string; name: string; kind: string }[]; placeholder?: string | undefined } = $props();
|
|
8
9
|
const ui = useUi();
|
|
@@ -105,11 +106,12 @@
|
|
|
105
106
|
</div>
|
|
106
107
|
{/if}
|
|
107
108
|
<div class="g9a-composer-row">
|
|
108
|
-
{#if can(host, "attach")}<button type="button" class={cls(ui, "composer.attach")} aria-label={t("composer.attach")} onclick={attach}
|
|
109
|
+
{#if can(host, "attach")}<button type="button" class={cls(ui, "composer.attach")} aria-label={t("composer.attach")} title={t("composer.attach")} onclick={attach}><Icon name="attach" /></button>{/if}
|
|
109
110
|
<textarea bind:this={input} bind:value={text} class={cls(ui, "composer.input")} rows="1" placeholder={placeholder ?? t("composer.placeholder")} aria-label={placeholder ?? t("composer.placeholder")}
|
|
110
111
|
onkeydown={key}></textarea>
|
|
111
|
-
{#if can(host, "mic")}<button type="button" class={cls(ui, "composer.mic")} aria-label={t("composer.mic")} onclick={dictate}
|
|
112
|
-
{:else if voice && can(host, "record")}<button type="button" class={cls(ui, "composer.mic")} aria-label={t("composer.mic")} aria-pressed={stopRecording !== null} onclick={record}
|
|
113
|
-
<button type="submit" class={cls(ui, busy ? "composer.stop" : "composer.send")}
|
|
112
|
+
{#if can(host, "mic")}<button type="button" class={cls(ui, "composer.mic")} aria-label={t("composer.mic")} title={t("composer.mic")} onclick={dictate}><Icon name="mic" /></button>
|
|
113
|
+
{:else if voice && can(host, "record")}<button type="button" class={cls(ui, "composer.mic")} aria-label={t("composer.mic")} aria-pressed={stopRecording !== null} onclick={record}><Icon name={stopRecording ? "stop" : "mic"} /></button>{/if}
|
|
114
|
+
<button type="submit" class={cls(ui, busy ? "composer.stop" : "composer.send")} aria-label={busy ? t("composer.stop") : t("composer.send")} title={busy ? t("composer.stop") : t("composer.send")}
|
|
115
|
+
data-empty={!busy && text.trim().length === 0}><Icon name={busy ? "stop" : "send"} /></button>
|
|
114
116
|
</div>
|
|
115
117
|
</form>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// One line icon, drawn in the text colour; hidden from screen readers (its button carries the words).
|
|
3
|
+
import { iconPath, type IconName } from "./icons.js";
|
|
4
|
+
|
|
5
|
+
let { name }: { name: IconName } = $props();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<svg class="g9a-icon" data-icon={name} viewBox="0 0 24 24" width="18" height="18" fill={name === "stop" ? "currentColor" : "none"} stroke="currentColor"
|
|
9
|
+
stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d={iconPath(name)} /></svg>
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import BlockView from "../blocks/BlockView.svelte";
|
|
8
8
|
import ApprovalCard from "../cards/ApprovalCard.svelte";
|
|
9
9
|
import Cards from "../cards/Cards.svelte";
|
|
10
|
+
import Icon from "./Icon.svelte";
|
|
10
11
|
import RevealText from "./RevealText.svelte";
|
|
11
12
|
import Small from "./Small.svelte";
|
|
12
13
|
|
|
@@ -38,15 +39,15 @@
|
|
|
38
39
|
{#if message.role === "assistant"}
|
|
39
40
|
<div class={cls(ui, "message.feedback")}>
|
|
40
41
|
<Small kind="provenance" provenance={message.provenance} />
|
|
41
|
-
{#if ui.assistant.host.copy}<button type="button" data-role="copy" onclick={async () => { await ui.assistant.host.copy?.(message.text); copied = true; }}
|
|
42
|
+
{#if ui.assistant.host.copy}<button type="button" class="g9a-icon-button" data-role="copy" aria-label={t("feedback.copy")} title={t("feedback.copy")} onclick={async () => { await ui.assistant.host.copy?.(message.text); copied = true; }}><Icon name={copied ? "check" : "copy"} /></button>{/if}
|
|
42
43
|
{#if message.provenance === "learned"}<button type="button" data-role="feedback" onclick={() => ui.assistant.notRight(message.id)}>{t("feedback.not_right")}</button>{/if}
|
|
43
|
-
{#if last && chatOf(ui.assistant).again && !message.pending}<button type="button" data-role="again" onclick={() => askAgain(ui.assistant)}
|
|
44
|
+
{#if last && chatOf(ui.assistant).again && !message.pending}<button type="button" class="g9a-icon-button" data-role="again" aria-label={pt("message.again")} title={pt("message.again")} onclick={() => askAgain(ui.assistant)}><Icon name="again" /></button><button type="button" class="g9a-icon-button" data-role="edit" aria-label={pt("message.edit")} title={pt("message.edit")} onclick={() => editLast(ui.assistant)}><Icon name="edit" /></button>{/if}
|
|
44
45
|
</div>
|
|
45
46
|
{#if chatOf(ui.assistant).feedback && !message.pending && message.id}
|
|
46
47
|
<div class={cls(ui, "message.rate")}>
|
|
47
48
|
{#if rating === "good" || rating === "bad"}<span>{pt("feedback.thanks")}</span>
|
|
48
49
|
{:else if rating === "asking"}<span>{pt("feedback.why")}</span>{#each FEEDBACK_REASONS as r (r)}<button type="button" data-role="reason" onclick={() => rateAnswer(ui.assistant, message, false, r)}>{pt("feedback.reason." + r)}</button>{/each}<button type="button" data-role="reason" onclick={() => rateAnswer(ui.assistant, message, false, null)}>{pt("feedback.skip")}</button>
|
|
49
|
-
{:else}<span>{pt("feedback.ask")}</span><button type="button" data-role="good" aria-label={pt("feedback.good")} onclick={() => rateAnswer(ui.assistant, message, true)}
|
|
50
|
+
{:else}<span>{pt("feedback.ask")}</span><button type="button" class="g9a-icon-button" data-role="good" aria-label={pt("feedback.good")} title={pt("feedback.good")} onclick={() => rateAnswer(ui.assistant, message, true)}><Icon name="good" /></button><button type="button" class="g9a-icon-button" data-role="bad" aria-label={pt("feedback.bad")} title={pt("feedback.bad")} onclick={() => rateAnswer(ui.assistant, message, false)}><Icon name="bad" /></button>{/if}
|
|
50
51
|
</div>
|
|
51
52
|
{/if}
|
|
52
53
|
{/if}
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
import type { MessageView, PlanView } from "@g9tm/aiassistant";
|
|
5
5
|
import { chatOf, pageTexts } from "@g9tm/aiassistant/pages";
|
|
6
6
|
import { cls, override, useUi } from "../context.js";
|
|
7
|
+
import Icon from "./Icon.svelte";
|
|
7
8
|
import Message from "./Message.svelte";
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
// starts: up to four first questions, shown with a welcome while there is no message yet.
|
|
11
|
+
let { messages, plans, runId, starts = [] }: { messages: MessageView[]; plans: ReadonlyMap<string, PlanView>; runId: string | null; starts?: string[] } = $props();
|
|
10
12
|
const ui = useUi();
|
|
11
13
|
const Item = $derived(override(ui, "Message") ?? Message);
|
|
12
14
|
let box: HTMLDivElement | undefined = $state();
|
|
@@ -31,6 +33,16 @@
|
|
|
31
33
|
|
|
32
34
|
<div class="g9a-messages-frame">
|
|
33
35
|
<div class={cls(ui, "messages")} bind:this={box} aria-live="polite" onscroll={measure} data-selectable={chatOf(ui.assistant).selectable}>
|
|
36
|
+
{#if messages.length === 0}
|
|
37
|
+
<div class="g9a-messages__empty">
|
|
38
|
+
<span class="g9a-messages__empty-mark"><Icon name="mark" /></span>
|
|
39
|
+
<strong>{pageTexts(ui.texts).t("chat.empty.title")}</strong>
|
|
40
|
+
<span class="g9a-note">{pageTexts(ui.texts).t("chat.empty.hint")}</span>
|
|
41
|
+
{#if starts.length > 0}
|
|
42
|
+
<div class={cls(ui, "block.actions")}>{#each starts.slice(0, 4) as q (q)}<button type="button" class={cls(ui, "block.action")} data-role="start" onclick={() => ui.assistant.send(q)}>{q}</button>{/each}</div>
|
|
43
|
+
{/if}
|
|
44
|
+
</div>
|
|
45
|
+
{/if}
|
|
34
46
|
{#each messages as m (m.id)}
|
|
35
47
|
<div data-id={m.id}><Item message={m} {plans} {runId} last={m.id === lastAnswer} /></div>
|
|
36
48
|
{/each}
|
|
@@ -3,6 +3,7 @@ type $$ComponentProps = {
|
|
|
3
3
|
messages: MessageView[];
|
|
4
4
|
plans: ReadonlyMap<string, PlanView>;
|
|
5
5
|
runId: string | null;
|
|
6
|
+
starts?: string[];
|
|
6
7
|
};
|
|
7
8
|
declare const MessageList: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
8
9
|
type MessageList = ReturnType<typeof MessageList>;
|
|
@@ -1,37 +1,44 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// "Download PDF" of the open conversation, once it has messages: the server's signed link (ten minutes), opened by the
|
|
3
|
-
// host. Busy while the link is asked for; a notice if it could not be made. Hidden when the host cannot open links.
|
|
4
|
-
import { onDestroy } from "svelte";
|
|
5
|
-
import { obj, str } from "@g9tm/aiassistant";
|
|
6
|
-
import { useUi } from "../context.js";
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
{
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// "Download PDF" of the open conversation, once it has messages: the server's signed link (ten minutes), opened by the
|
|
3
|
+
// host. Busy while the link is asked for; a notice if it could not be made. Hidden when the host cannot open links.
|
|
4
|
+
import { onDestroy } from "svelte";
|
|
5
|
+
import { obj, str } from "@g9tm/aiassistant";
|
|
6
|
+
import { useUi } from "../context.js";
|
|
7
|
+
import Icon from "./Icon.svelte";
|
|
8
|
+
import { AssistantState } from "../store.svelte.js";
|
|
9
|
+
import { pageTexts } from "../pages/texts.js";
|
|
10
|
+
|
|
11
|
+
// icon: drawn as a round icon button with the words as its label (the panel's header).
|
|
12
|
+
let { icon = false }: { icon?: boolean } = $props();
|
|
13
|
+
const ui = useUi();
|
|
14
|
+
const t = pageTexts(ui.texts).t;
|
|
15
|
+
const live = new AssistantState(ui.assistant);
|
|
16
|
+
onDestroy(() => live.dispose());
|
|
17
|
+
const id = $derived(live.current.conversationId);
|
|
18
|
+
const shown = $derived(id !== null && live.current.messages.length > 0 && typeof ui.assistant.host.openUrl === "function");
|
|
19
|
+
let busy = $state(false);
|
|
20
|
+
let failed = $state(false);
|
|
21
|
+
|
|
22
|
+
async function download(): Promise<void> {
|
|
23
|
+
if (!id || busy) return;
|
|
24
|
+
busy = true;
|
|
25
|
+
failed = false;
|
|
26
|
+
try {
|
|
27
|
+
const url = str(obj(await ui.assistant.api.documentLink(id))["url"]);
|
|
28
|
+
if (!/^(https:\/\/|\/(?!\/))/u.test(url)) throw new Error("no link"); // the server's own path or https only
|
|
29
|
+
ui.assistant.host.openUrl?.(url);
|
|
30
|
+
} catch {
|
|
31
|
+
failed = true;
|
|
32
|
+
}
|
|
33
|
+
busy = false;
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
{#if shown}
|
|
38
|
+
{#if icon}
|
|
39
|
+
<button type="button" class="g9a-pdf g9a-icon-button" aria-busy={busy} disabled={busy} aria-label={busy ? t("pdf.busy") : t("pdf.download")} title={t("pdf.download")} onclick={download}><Icon name="download" /></button>
|
|
40
|
+
{:else}
|
|
41
|
+
<button type="button" class="g9a-pdf" aria-busy={busy} disabled={busy} onclick={download}>{busy ? t("pdf.busy") : t("pdf.download")}</button>
|
|
42
|
+
{/if}
|
|
43
|
+
{#if failed}<span class="g9a-note g9a-pdf__failed" role="alert">{t("pdf.failed")}</span>{/if}
|
|
44
|
+
{/if}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
icon?: boolean;
|
|
3
|
+
};
|
|
4
|
+
declare const PdfButton: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
2
5
|
type PdfButton = ReturnType<typeof PdfButton>;
|
|
3
6
|
export default PdfButton;
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
import { Ticker } from "../store.svelte.js";
|
|
9
9
|
import ThinkingOrb from "./ThinkingOrb.svelte";
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
// stop: its own Stop button (off inside the chat, where the composer's send turns into Stop).
|
|
12
|
+
let { run, stop = true }: { run: RunView; stop?: boolean } = $props();
|
|
12
13
|
const ui = useUi();
|
|
13
14
|
const t = ui.texts.t;
|
|
14
15
|
const ticker = new Ticker();
|
|
@@ -27,9 +28,8 @@
|
|
|
27
28
|
|
|
28
29
|
{#if !finished(run) && run.state !== "waiting-confirm" && run.state !== "waiting-answer"}
|
|
29
30
|
<div class={cls(ui, "work")} role="status">
|
|
30
|
-
<ThinkingOrb />
|
|
31
31
|
<div class="g9a-work-main">
|
|
32
|
-
<div class="g9a-work-head"><strong>{long ? t("work.long") : t("work.title")}</strong><span class={cls(ui, "work.elapsed")}>{t("work.elapsed", { seconds })}</span></div>
|
|
32
|
+
<div class="g9a-work-head"><ThinkingOrb /><strong>{long ? t("work.long") : t("work.title")}</strong><span class={cls(ui, "work.elapsed")}>{t("work.elapsed", { seconds })}</span></div>
|
|
33
33
|
{#if chatOf(ui.assistant).status && statusOf(run)}{@const st = statusOf(run)}<div class={cls(ui, "work.status")}>{pageTexts(ui.texts).t("work.status", { what: t(st?.key ?? "", st?.args) })}</div>{/if}
|
|
34
34
|
<div class="g9a-stages">
|
|
35
35
|
{#each run.stages.filter((s) => s.id !== "waiting") as s, i (i)}<span class={cls(ui, "work.stage")} data-state={s.state}>{label(s)}</span>{/each}
|
|
@@ -38,6 +38,6 @@
|
|
|
38
38
|
{#each run.tools.slice(-3) as tool, i (i)}<div class={cls(ui, "work.tool")} data-state={tool.state}>{t(tool.title.key) === tool.title.key ? tool.name : t(tool.title.key)}</div>{/each}
|
|
39
39
|
{#if run.streamingText}<div class="g9a-stream">{run.streamingText}</div>{/if}
|
|
40
40
|
</div>
|
|
41
|
-
<button type="button" class={cls(ui, "composer.stop")} onclick={() => ui.assistant.stop()}>{t("composer.stop")}</button>
|
|
41
|
+
{#if stop}<button type="button" class={cls(ui, "composer.stop")} onclick={() => ui.assistant.stop()}>{t("composer.stop")}</button>{/if}
|
|
42
42
|
</div>
|
|
43
43
|
{/if}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type IconName = "mark" | "new" | "download" | "close" | "attach" | "send" | "stop" | "mic" | "copy" | "check" | "good" | "bad" | "again" | "edit";
|
|
2
|
+
/** The path of an icon (empty for a name it does not know). */
|
|
3
|
+
export declare function iconPath(name: IconName): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// The panel's line icons (24-unit grid, drawn with the text colour), inline so no image or font is loaded. The React
|
|
2
|
+
// renderer keeps the same file (tests/ts/client/renderer-parity.test.ts).
|
|
3
|
+
const PATHS = new Map([
|
|
4
|
+
["mark", "M12 3.5l1.9 5.1 5.1 1.9-5.1 1.9-1.9 5.1-1.9-5.1-5.1-1.9 5.1-1.9zM18.5 15.5l.8 2 2 .8-2 .8-.8 2-.8-2-2-.8 2-.8z"],
|
|
5
|
+
["new", "M12 4H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-6M17.6 3.4a2 2 0 0 1 2.9 2.9L12 14.8l-3.7.9.9-3.7z"],
|
|
6
|
+
["download", "M12 4v11M7 10.5l5 5 5-5M5 20h14"],
|
|
7
|
+
["close", "M6.5 6.5l11 11M17.5 6.5l-11 11"],
|
|
8
|
+
["attach", "M20 11.4l-8 8a5 5 0 0 1-7.1-7.1l8.3-8.3a3.3 3.3 0 0 1 4.7 4.7l-8.3 8.3a1.7 1.7 0 0 1-2.4-2.4l7.6-7.6"],
|
|
9
|
+
["send", "M12 19V5.5M6 11.5l6-6 6 6"],
|
|
10
|
+
["stop", "M8 8h8v8H8z"],
|
|
11
|
+
["mic", "M12 3.5a3 3 0 0 0-3 3V12a3 3 0 0 0 6 0V6.5a3 3 0 0 0-3-3zM5.5 11.5a6.5 6.5 0 0 0 13 0M12 18v2.5"],
|
|
12
|
+
["copy", "M9 9h10.5v10.5H9zM15 9V5H4.5v10.5H9"],
|
|
13
|
+
["check", "M5 12.5l4.5 4.5L19 7.5"],
|
|
14
|
+
["good", "M7.5 10.5v9h-3v-9zM7.5 10.5l3.8-6.6a1.9 1.9 0 0 1 3.4 1.5l-.9 3.6h5a1.8 1.8 0 0 1 1.8 2.1l-1.2 6.3a2 2 0 0 1-2 1.6H7.5"],
|
|
15
|
+
["bad", "M7.5 13.5v-9h-3v9zM7.5 13.5l3.8 6.6a1.9 1.9 0 0 0 3.4-1.5l-.9-3.6h5a1.8 1.8 0 0 0 1.8-2.1l-1.2-6.3a2 2 0 0 0-2-1.6H7.5"],
|
|
16
|
+
["again", "M4.5 12a7.5 7.5 0 0 1 13-5.1L19.5 9M19.5 4.5V9H15M19.5 12a7.5 7.5 0 0 1-13 5.1L4.5 15M4.5 19.5V15H9"],
|
|
17
|
+
["edit", "M4.5 19.5h4l10-10a2.8 2.8 0 0 0-4-4l-10 10zM13 7l4 4"],
|
|
18
|
+
]);
|
|
19
|
+
/** The path of an icon (empty for a name it does not know). */
|
|
20
|
+
export function iconPath(name) {
|
|
21
|
+
return PATHS.get(name) ?? "";
|
|
22
|
+
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import Small from "../parts/Small.svelte";
|
|
10
10
|
import WorkCard from "../parts/WorkCard.svelte";
|
|
11
11
|
|
|
12
|
-
let { placeholder = undefined }: { placeholder?: string | undefined } = $props();
|
|
12
|
+
let { placeholder = undefined, starts = [] }: { placeholder?: string | undefined; starts?: string[] } = $props();
|
|
13
13
|
const ui = useUi();
|
|
14
14
|
const live = new AssistantState(ui.assistant);
|
|
15
15
|
onDestroy(() => live.dispose());
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
|
|
25
25
|
<div class={cls(ui, "chat")}>
|
|
26
26
|
<Small kind="mode" state={s.state} />
|
|
27
|
-
<List messages={s.messages} plans={s.plans} runId={s.run?.runId ?? null} />
|
|
28
|
-
{#if s.run}<Work run={s.run} />{/if}
|
|
27
|
+
<List messages={s.messages} plans={s.plans} runId={s.run?.runId ?? null} starts={s.busy ? [] : starts} />
|
|
28
|
+
{#if s.run}<Work run={s.run} stop={false} />{/if}
|
|
29
29
|
{#if s.error}<div class="g9a-note" role="alert">{ui.texts.t(s.error)}</div>{/if}
|
|
30
30
|
<Compose busy={s.busy} attachments={s.attachments} {placeholder} />
|
|
31
31
|
</div>
|
|
@@ -1,52 +1,57 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
// The panel in six layouts (sheet, side, fullscreen, inline, card, compact) or "auto" by the container's width; the
|
|
3
|
-
// layout can change live without losing the conversation. Escape closes; Alt+A (by key position, so it works with a
|
|
4
|
-
// Persian keyboard) toggles. Dialogs inside sit above the panel.
|
|
5
|
-
import type { Snippet } from "svelte";
|
|
6
|
-
import { pickLayout, type Layout, type LayoutThresholds } from "@g9tm/aiassistant";
|
|
7
|
-
import { cls, override, sty, useUi } from "../context.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
{#if
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// The panel in six layouts (sheet, side, fullscreen, inline, card, compact) or "auto" by the container's width; the
|
|
3
|
+
// layout can change live without losing the conversation. Escape closes; Alt+A (by key position, so it works with a
|
|
4
|
+
// Persian keyboard) toggles. Dialogs inside sit above the panel.
|
|
5
|
+
import type { Snippet } from "svelte";
|
|
6
|
+
import { pickLayout, type Layout, type LayoutThresholds } from "@g9tm/aiassistant";
|
|
7
|
+
import { cls, override, sty, useUi } from "../context.js";
|
|
8
|
+
import Icon from "../parts/Icon.svelte";
|
|
9
|
+
import PdfButton from "../parts/PdfButton.svelte";
|
|
10
|
+
import AssistantChat from "./AssistantChat.svelte";
|
|
11
|
+
|
|
12
|
+
let { open = $bindable(true), layout = "auto", thresholds = undefined, title = undefined, header = undefined, onclose = undefined, starts = [] }: {
|
|
13
|
+
open?: boolean; layout?: Layout; thresholds?: LayoutThresholds | undefined; title?: string | undefined; header?: Snippet | undefined; onclose?: (() => void) | undefined;
|
|
14
|
+
/** Up to four first questions shown while the conversation is empty. */
|
|
15
|
+
starts?: string[];
|
|
16
|
+
} = $props();
|
|
17
|
+
const ui = useUi();
|
|
18
|
+
const t = ui.texts.t;
|
|
19
|
+
let width = $state(1024);
|
|
20
|
+
let opener: Element | null = null;
|
|
21
|
+
const current = $derived(pickLayout(layout, width, thresholds));
|
|
22
|
+
const Pdf = $derived(override(ui, "PdfButton") ?? PdfButton);
|
|
23
|
+
|
|
24
|
+
function close(): void {
|
|
25
|
+
open = false;
|
|
26
|
+
onclose?.();
|
|
27
|
+
if (opener instanceof HTMLElement) opener.focus(); // focus goes back to what opened it
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function onkey(e: KeyboardEvent): void {
|
|
31
|
+
if (e.altKey && e.code === "KeyA") {
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
if (!open) opener = document.activeElement;
|
|
34
|
+
open = !open;
|
|
35
|
+
} else if (e.key === "Escape" && open && current !== "inline" && current !== "card") close();
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<svelte:window onkeydown={onkey} />
|
|
40
|
+
|
|
41
|
+
<div class="g9a-measure" bind:clientWidth={width}></div>
|
|
42
|
+
{#if open || current === "inline" || current === "card"}
|
|
43
|
+
<section class={cls(ui, "panel")} style={sty(ui, "panel") ?? ""} data-layout={current} role={current === "sheet" || current === "fullscreen" ? "dialog" : "region"}
|
|
44
|
+
aria-label={title ?? t("assistant.name")} style:z-index={current === "inline" || current === "card" ? undefined : ui.layer - 1}>
|
|
45
|
+
{#if current !== "compact"}
|
|
46
|
+
<header class={cls(ui, "panel.header")}>
|
|
47
|
+
{#if header}{@render header()}{:else}<span class="g9a-panel__mark"><Icon name="mark" /></span><strong>{title ?? t("assistant.name")}</strong>{/if}
|
|
48
|
+
<div class="g9a-panel__tools">
|
|
49
|
+
<button type="button" class="g9a-icon-button" data-role="new" aria-label={t("panel.new")} title={t("panel.new")} onclick={() => ui.assistant.fresh()}><Icon name="new" /></button>
|
|
50
|
+
<Pdf icon />
|
|
51
|
+
{#if current !== "inline" && current !== "card"}<button type="button" class="g9a-icon-button" data-role="close" aria-label={t("panel.close")} title={t("panel.close")} onclick={close}><Icon name="close" /></button>{/if}
|
|
52
|
+
</div>
|
|
53
|
+
</header>
|
|
54
|
+
{/if}
|
|
55
|
+
<div class={cls(ui, "panel.body")}><AssistantChat {starts} /></div>
|
|
56
|
+
</section>
|
|
57
|
+
{/if}
|
|
@@ -7,6 +7,8 @@ type $$ComponentProps = {
|
|
|
7
7
|
title?: string | undefined;
|
|
8
8
|
header?: Snippet | undefined;
|
|
9
9
|
onclose?: (() => void) | undefined;
|
|
10
|
+
/** Up to four first questions shown while the conversation is empty. */
|
|
11
|
+
starts?: string[];
|
|
10
12
|
};
|
|
11
13
|
declare const AssistantPanel: import("svelte").Component<$$ComponentProps, {}, "open">;
|
|
12
14
|
type AssistantPanel = ReturnType<typeof AssistantPanel>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@g9tm/aiassistant-svelte",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "Svelte 5 components for the G9 AI assistant, fully customisable (layouts, tokens, per-part classes, overrides, parts).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@g9tm/aiassistant": "1.
|
|
34
|
+
"@g9tm/aiassistant": "1.11.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@sveltejs/package": "2.5.8",
|