@olares/lares-mobile 0.15.7 → 0.15.9

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.
@@ -1,21 +1,55 @@
1
1
  <template>
2
2
  <header class="lares-bar">
3
- <button type="button" class="lares-bar__icon-btn" :aria-label="t('bar.menu')" @click="$emit('history')">
3
+ <button
4
+ type="button"
5
+ class="lares-bar__icon-btn"
6
+ :data-unseen="unseen ? 'true' : 'false'"
7
+ :aria-label="t('bar.menu')"
8
+ @click="$emit('history')"
9
+ >
4
10
  <svg class="lares-bar__glyph" viewBox="0 0 24 24" aria-hidden="true">
5
- <path d="M5 9h14M5 15h14" />
11
+ <path d="M5 6.5h14M5 12h14M5 17.5h14" />
6
12
  </svg>
13
+ <span v-if="unseen" class="lares-bar__dot" aria-hidden="true" />
7
14
  </button>
8
- <h1 class="lares-bar__title">{{ title }}</h1>
15
+ <div class="lares-bar__switch" role="group" :aria-label="t('model.menuAria')">
16
+ <button
17
+ type="button"
18
+ class="lares-bar__segment"
19
+ :disabled="modelBusy"
20
+ :aria-label="modelAria"
21
+ @click="$emit('model')"
22
+ >
23
+ <span>{{ modelLabel || t("model.select") }}</span>
24
+ </button>
25
+ <button
26
+ v-if="!effortDisabled"
27
+ type="button"
28
+ class="lares-bar__segment"
29
+ :disabled="modelBusy"
30
+ :aria-label="effortAria"
31
+ @click="$emit('model')"
32
+ >
33
+ <span>{{ effortLabel || t("reasoning.default") }}</span>
34
+ </button>
35
+ </div>
9
36
  <button
10
37
  type="button"
11
38
  class="lares-bar__icon-btn"
12
- :disabled="starting"
13
- :aria-label="t('bar.newAria')"
14
- @click="$emit('create')"
39
+ :data-speak="speak ? 'true' : 'false'"
40
+ :disabled="speakBusy"
41
+ :aria-pressed="speak"
42
+ :aria-label="speak ? t('bar.speakOn') : t('bar.speakOff')"
43
+ @click="$emit('speak')"
15
44
  >
16
- <svg class="lares-bar__glyph" viewBox="0 0 24 24" aria-hidden="true">
17
- <circle cx="12" cy="12" r="8.25" />
18
- <path d="M12 8.5v7M8.5 12h7" />
45
+ <svg v-if="speak" class="lares-bar__glyph" viewBox="0 0 24 24" aria-hidden="true">
46
+ <path d="M4 10h3.2L11 6.5v11L7.2 14H4z" />
47
+ <path d="M14.5 9.2a3.2 3.2 0 0 1 0 5.6" />
48
+ <path d="M16.8 7a6 6 0 0 1 0 10" />
49
+ </svg>
50
+ <svg v-else class="lares-bar__glyph" viewBox="0 0 24 24" aria-hidden="true">
51
+ <path d="M4 10h3.2L11 6.5v11L7.2 14H4z" />
52
+ <path d="m16 10 4 4M20 10l-4 4" />
19
53
  </svg>
20
54
  </button>
21
55
  </header>
@@ -26,45 +60,50 @@ export default {
26
60
  name: "LaresChatBar",
27
61
  props: {
28
62
  t: { type: Function, required: true },
29
- title: { type: String, default: "" },
30
- starting: { type: Boolean, default: false },
63
+ modelLabel: { type: String, default: "" },
64
+ modelBusy: { type: Boolean, default: false },
65
+ effortLabel: { type: String, default: "" },
66
+ effortDisabled: { type: Boolean, default: false },
67
+ unseen: { type: Boolean, default: false },
68
+ speak: { type: Boolean, default: false },
69
+ speakBusy: { type: Boolean, default: false },
70
+ },
71
+ emits: ["history", "model", "effort", "speak"],
72
+ computed: {
73
+ modelAria() {
74
+ return this.modelLabel
75
+ ? this.t("model.switchAria", { label: this.modelLabel })
76
+ : this.t("model.select");
77
+ },
78
+ effortAria() {
79
+ return this.t("reasoning.switchAria", { label: this.effortLabel || this.t("reasoning.default") });
80
+ },
31
81
  },
32
- emits: ["history", "create"],
33
82
  };
34
83
  </script>
35
84
 
36
85
  <style scoped>
37
86
  .lares-bar {
38
- display: grid;
39
- grid-template-columns: 44px 1fr 44px;
87
+ display: flex;
40
88
  align-items: center;
89
+ gap: 8px;
41
90
  flex-shrink: 0;
42
91
  min-height: 56px;
43
- padding: 6px 8px;
44
- }
45
-
46
- .lares-bar__title {
47
- max-width: 100%;
48
- margin: 0;
49
- overflow: hidden;
50
- font-size: 18px;
51
- font-weight: 600;
52
- line-height: 24px;
53
- text-align: center;
54
- text-overflow: ellipsis;
55
- white-space: nowrap;
92
+ padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
56
93
  }
57
94
 
58
95
  .lares-bar__icon-btn {
96
+ position: relative;
59
97
  display: inline-flex;
60
98
  align-items: center;
61
99
  justify-content: center;
62
- width: 40px;
63
- height: 40px;
64
- border: 0;
100
+ width: 36px;
101
+ height: 36px;
102
+ flex-shrink: 0;
103
+ border: 1px solid var(--q-separator);
65
104
  border-radius: 999px;
66
105
  padding: 0;
67
- background: transparent;
106
+ background: var(--q-background-1);
68
107
  color: var(--q-ink-1);
69
108
  }
70
109
 
@@ -73,12 +112,74 @@ export default {
73
112
  height: 22px;
74
113
  fill: none;
75
114
  stroke: currentColor;
76
- stroke-width: 1.75;
115
+ stroke-width: 2;
77
116
  stroke-linecap: round;
78
117
  stroke-linejoin: round;
79
118
  }
80
119
 
81
- .lares-bar__icon-btn:active {
120
+ .lares-bar__icon-btn[data-speak="true"] {
121
+ color: var(--q-blue-default);
122
+ border-color: var(--q-blue-default);
123
+ }
124
+
125
+ .lares-bar__icon-btn:active:not(:disabled) {
126
+ background: var(--q-btn-bg-pressed);
127
+ }
128
+
129
+ .lares-bar__dot {
130
+ position: absolute;
131
+ top: 7px;
132
+ right: 7px;
133
+ width: 8px;
134
+ height: 8px;
135
+ border-radius: 50%;
136
+ background: var(--q-blue-default);
137
+ box-shadow: 0 0 0 2px var(--q-background-1);
138
+ }
139
+
140
+ .lares-bar__switch {
141
+ display: inline-flex;
142
+ min-width: 0;
143
+ max-width: calc(100% - 96px);
144
+ height: 36px;
145
+ margin-right: auto;
146
+ overflow: hidden;
147
+ align-items: stretch;
148
+ border-radius: 999px;
149
+ background: var(--q-background-3);
150
+ }
151
+
152
+ .lares-bar__segment {
153
+ display: inline-flex;
154
+ min-width: 0;
155
+ max-width: 148px;
156
+ align-items: center;
157
+ border: 0;
158
+ padding: 0 14px;
159
+ background: transparent;
160
+ color: var(--q-ink-1);
161
+ font-size: 15px;
162
+ font-weight: 600;
163
+ line-height: 20px;
164
+ }
165
+
166
+ .lares-bar__segment + .lares-bar__segment::before {
167
+ content: "";
168
+ width: 1px;
169
+ height: 14px;
170
+ flex: none;
171
+ margin-right: 12px;
172
+ background: var(--q-separator);
173
+ }
174
+
175
+ .lares-bar__segment span {
176
+ min-width: 0;
177
+ overflow: hidden;
178
+ text-overflow: ellipsis;
179
+ white-space: nowrap;
180
+ }
181
+
182
+ .lares-bar__segment:active:not(:disabled) {
82
183
  background: var(--q-btn-bg-pressed);
83
184
  }
84
185
  </style>