odant-work 1.0.95 → 1.0.97

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,88 +1,262 @@
1
- /**
2
- * oda-text-input — строчный ввод текста на нативном input: text, password (с показом), email, url, tel, search.
3
- * Тип — inputType, иначе field.type (если это один из типов текста), иначе text.
4
- */
5
-
6
- const TEXT_TYPES = ['text', 'password', 'email', 'url', 'tel', 'search'];
7
-
8
- /** адрес электронной почты — выражение из спецификации HTML (то же, что у нативного type=email) */
9
- const EMAIL = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
10
-
11
- /** скомпилированные pattern (атрибут pattern сопоставляется со всем значением, как у нативного input) */
12
- const PATTERNS = new Map();
13
- function patternOf(pattern) {
14
- if (!PATTERNS.has(pattern)) {
15
- let re;
16
- // нативный input компилирует pattern с флагом v, при ошибке — игнорирует его; запасной вариант — u
17
- for (const flags of ['v', 'u']) {
18
- try {
19
- re = new RegExp('^(?:' + pattern + ')$', flags);
20
- break;
21
- }
22
- catch { }
23
- }
24
- PATTERNS.set(pattern, re);
25
- }
26
- return PATTERNS.get(pattern);
27
- }
28
-
29
- ODA({
30
- is: 'oda-text-input',
31
- imports: 'oda//input.js, oda//button.js',
32
- extends: 'oda-input',
33
- template: /*html*/`
34
- <input class="control" part="control"
35
- :type="nativeType" :value="value ?? ''" :placeholder="placeholderText"
36
- :readonly="isReadonly" :disabled :required="isRequired"
37
- :minlength="field?.minLength" :maxlength="field?.maxLength" :pattern="pattern || field?.pattern"
38
- :autocomplete="autocomplete" :inputmode="inputMode"
39
- @input="value = $this.value">
40
- <oda-button ~if="textType === 'password'" class="affix" :icon="revealed ? 'icons:visibility-off' : 'icons:visibility'" :icon-size
41
- title="Показать / скрыть" @tap.stop="revealed = !revealed"></oda-button>
42
- <oda-button ~if="clearable && !isEmpty && !isReadonly" class="affix" icon="icons:close" :icon-size title="Очистить" @tap.stop="value = ''"></oda-button>
43
- `,
44
- $public: {
45
- // без $def: пустое значение — undefined (как в данных); $def: '' вечно спорил
46
- // с привязкой и давал цикл запись→нотификация→рендер (см. pitfalls §21)
47
- value: {
48
- $type: String
49
- },
50
- /** text | password | email | url | tel | search; пусто — по field.type */
51
- inputType: '',
52
- pattern: '',
53
- autocomplete: 'off',
54
- /** кнопка очистки */
55
- clearable: false
56
- },
57
- revealed: false,
58
- get textType() {
59
- const t = String(this.inputType || this.field?.type || 'text').toLowerCase();
60
- return TEXT_TYPES.includes(t) ? t : 'text';
61
- },
62
- get nativeType() {
63
- return this.textType === 'password' && this.revealed ? 'text' : this.textType;
64
- },
65
- get inputMode() {
66
- return { email: 'email', url: 'url', tel: 'tel', search: 'search' }[this.textType] ?? 'text';
67
- },
68
- get validationErrors() {
69
- return this.formatMessage ? [this.formatMessage] : [];
70
- },
71
- /**
72
- * Проверка формата (email, url, pattern) по правилам нативного input, но без создания DOM
73
- * и с русским текстом (нативное сообщение зависит от языка браузера). Пустое значение сюда не доходит.
74
- */
75
- get formatMessage() {
76
- const text = this.value ?? '';
77
- if (this.textType === 'email' && !EMAIL.test(text))
78
- return 'Введите адрес электронной почты';
79
- if (this.textType === 'url' && !URL.canParse(text))
80
- return 'Введите адрес в виде URL (например, https://example.com)';
81
- const pattern = this.pattern || this.field?.pattern;
82
- // нерабочий pattern нативный input игнорирует — игнорируем и мы
83
- const re = pattern && patternOf(pattern);
84
- if (re && !re.test(text))
85
- return 'Значение не соответствует формату';
86
- return '';
87
- }
88
- });
1
+ /**
2
+ * oda-text-input — строчный ввод текста на нативном input: text, password (с показом), email, url, tel, search.
3
+ * Тип — inputType, иначе field.type (если это один из типов текста), иначе text.
4
+ * При наличии list (массив, строка с | / ; / , или объект) или field.list включает выпадающий список выбора (dropdown).
5
+ */
6
+ import { normalizeOptions } from '/oda/components/inputs/input/input.js';
7
+
8
+ const TEXT_TYPES = ['text', 'password', 'email', 'url', 'tel', 'search'];
9
+
10
+ /** адрес электронной почты — выражение из спецификации HTML (то же, что у нативного type=email) */
11
+ const EMAIL = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
12
+
13
+ /** скомпилированные pattern (атрибут pattern сопоставляется со всем значением, как у нативного input) */
14
+ const PATTERNS = new Map();
15
+ function patternOf(pattern) {
16
+ if (!PATTERNS.has(pattern)) {
17
+ let re;
18
+ // нативный input компилирует pattern с флагом v, при ошибке — игнорирует его; запасной вариант — u
19
+ for (const flags of ['v', 'u']) {
20
+ try {
21
+ re = new RegExp('^(?:' + pattern + ')$', flags);
22
+ break;
23
+ }
24
+ catch { }
25
+ }
26
+ PATTERNS.set(pattern, re);
27
+ }
28
+ return PATTERNS.get(pattern);
29
+ }
30
+
31
+ ODA({
32
+ is: 'oda-text-input',
33
+ imports: 'oda//input.js, oda//button.js, oda//icon.js',
34
+ extends: 'oda-input',
35
+ template: /*html*/`
36
+ <style>
37
+ .dd-toggle {
38
+ cursor: pointer;
39
+ transition: transform .15s ease;
40
+ }
41
+ .dd-toggle.open {
42
+ transform: rotate(180deg);
43
+ }
44
+ .dd-menu {
45
+ margin: 0;
46
+ padding: 4px;
47
+ border: 1px solid var(--subtle-border, var(--border-color, #d0d7de));
48
+ border-radius: var(--radius-s, 8px);
49
+ background: var(--content-background, #fff);
50
+ color: var(--content-color, inherit);
51
+ box-shadow: var(--elevation-3, 0 8px 24px rgba(0, 0, 0, .14));
52
+ box-sizing: border-box;
53
+ overflow-y: auto;
54
+ max-height: 260px;
55
+ font: inherit;
56
+ }
57
+ .dd-menu:popover-open {
58
+ display: flex;
59
+ flex-direction: column;
60
+ gap: 2px;
61
+ }
62
+ .dd-item {
63
+ display: flex;
64
+ align-items: center;
65
+ gap: 8px;
66
+ padding: 6px 10px;
67
+ border-radius: var(--radius-xs, 6px);
68
+ cursor: pointer;
69
+ min-width: 0;
70
+ user-select: none;
71
+ }
72
+ .dd-item:hover,
73
+ .dd-item.active {
74
+ background: var(--subtle-background, rgba(0, 0, 0, .05));
75
+ }
76
+ .dd-item.selected {
77
+ background: var(--accent-soft, rgba(37, 99, 235, .12));
78
+ color: var(--accent-color, inherit);
79
+ font-weight: 600;
80
+ }
81
+ .dd-item.disabled {
82
+ opacity: .45;
83
+ pointer-events: none;
84
+ }
85
+ .dd-label {
86
+ flex: 1 1 auto;
87
+ min-width: 0;
88
+ overflow: hidden;
89
+ text-overflow: ellipsis;
90
+ white-space: nowrap;
91
+ }
92
+ </style>
93
+ <input class="control" part="control"
94
+ :type="nativeType" :value="value ?? ''" :placeholder="placeholderText"
95
+ :readonly="isReadonly" :disabled :required="isRequired"
96
+ :minlength="field?.minLength" :maxlength="field?.maxLength" :pattern="pattern || field?.pattern"
97
+ :autocomplete="autocomplete" :inputmode="inputMode"
98
+ @input="onTextInput($this.value)" @keydown="onTextKey($event)">
99
+ <oda-button ~if="textType === 'password'" class="affix" :icon="revealed ? 'icons:visibility-off' : 'icons:visibility'" :icon-size
100
+ title="Показать / скрыть" @tap.stop="revealed = !revealed"></oda-button>
101
+ <oda-button ~if="clearable && !isEmpty && !isReadonly" class="affix" icon="icons:close" :icon-size title="Очистить" @tap.stop="value = ''"></oda-button>
102
+ <oda-button ~if="listOptions.length && !isReadonly && !disabled" class="affix dd-toggle" ~class="{ open: menuOpen }"
103
+ icon="icons:arrow-drop-down" :icon-size="18" title="Выбрать из списка"
104
+ @down.prevent.stop @tap.stop="toggleMenu()"></oda-button>
105
+ <div ~if="listOptions.length" class="dd-menu" popover="auto" @toggle="onPopoverToggle($event)">
106
+ <div ~for="listOptions" style="display: contents">
107
+ <div class="dd-item"
108
+ ~class="{ selected: isSelectedOption($for.item), active: $for.index === activeIndex, disabled: !!$for.item.disabled }"
109
+ @pointerdown.prevent="pickOption($for.item)">
110
+ <oda-icon ~if="$for.item.icon" :icon="$for.item.icon" :icon-size="16"></oda-icon>
111
+ <span class="dd-label">{{$for.item.label}}</span>
112
+ <oda-icon ~if="isSelectedOption($for.item)" icon="icons:check" :icon-size="14"></oda-icon>
113
+ </div>
114
+ </div>
115
+ </div>
116
+ `,
117
+ $public: {
118
+ // без $def: пустое значение — undefined (как в данных); $def: '' вечно спорил
119
+ // с привязкой и давал цикл запись→нотификация→рендер (см. pitfalls §21)
120
+ value: {
121
+ $type: String
122
+ },
123
+ /** text | password | email | url | tel | search; пусто — по field.type */
124
+ inputType: '',
125
+ pattern: '',
126
+ autocomplete: 'off',
127
+ /** кнопка очистки */
128
+ clearable: false,
129
+ /** список вариантов (массив, строка с | / ; / , или объект) — включает выпадающий выбор */
130
+ list: undefined
131
+ },
132
+ revealed: false,
133
+ menuOpen: false,
134
+ activeIndex: -1,
135
+ get listOptions() {
136
+ return normalizeOptions(this.list ?? this.field?.list ?? this.field?.items ?? this.field?.options);
137
+ },
138
+ isSelectedOption(o) {
139
+ return !this.isEmpty && o && String(o.value) === String(this.value);
140
+ },
141
+ onTextInput(v) {
142
+ this.value = v;
143
+ },
144
+ toggleMenu() {
145
+ if (this.menuOpen)
146
+ this.closeMenu();
147
+ else
148
+ this.openMenu();
149
+ },
150
+ openMenu() {
151
+ if (this.isReadonly || this.disabled || !this.listOptions.length)
152
+ return;
153
+ const menu = this.$('.dd-menu');
154
+ if (!menu)
155
+ return;
156
+ const rect = this.getBoundingClientRect();
157
+ const vw = window.innerWidth || 0;
158
+ const vh = window.innerHeight || 0;
159
+ const spaceBelow = vh - rect.bottom - 8;
160
+ const spaceAbove = rect.top - 8;
161
+ const maxH = Math.min(260, Math.max(120, Math.max(spaceBelow, spaceAbove)));
162
+ const openUp = spaceBelow < 160 && spaceAbove > spaceBelow;
163
+ menu.style.position = 'fixed';
164
+ menu.style.left = Math.max(8, Math.min(rect.left, vw - Math.max(rect.width, 160) - 8)) + 'px';
165
+ menu.style.width = Math.max(rect.width, 140) + 'px';
166
+ menu.style.maxHeight = maxH + 'px';
167
+ if (openUp) {
168
+ menu.style.top = 'auto';
169
+ menu.style.bottom = Math.max(8, vh - rect.top + 4) + 'px';
170
+ }
171
+ else {
172
+ menu.style.bottom = 'auto';
173
+ menu.style.top = Math.min(vh - 48, rect.bottom + 4) + 'px';
174
+ }
175
+ try {
176
+ if (!menu.matches(':popover-open'))
177
+ menu.showPopover?.();
178
+ }
179
+ catch { /* ignore */ }
180
+ this.menuOpen = true;
181
+ this.activeIndex = this.listOptions.findIndex(o => this.isSelectedOption(o));
182
+ },
183
+ closeMenu() {
184
+ const menu = this.$('.dd-menu');
185
+ try {
186
+ if (menu?.matches?.(':popover-open'))
187
+ menu.hidePopover?.();
188
+ }
189
+ catch { /* ignore */ }
190
+ this.menuOpen = false;
191
+ this.activeIndex = -1;
192
+ },
193
+ onPopoverToggle(e) {
194
+ this.menuOpen = e?.newState === 'open';
195
+ if (!this.menuOpen)
196
+ this.activeIndex = -1;
197
+ },
198
+ pickOption(o) {
199
+ if (!o || o.disabled)
200
+ return;
201
+ this.value = String(o.value ?? '');
202
+ this.closeMenu();
203
+ this.focus();
204
+ },
205
+ onTextKey(e) {
206
+ if (this.isReadonly || this.disabled || !this.listOptions.length)
207
+ return;
208
+ if (e.key === 'ArrowDown') {
209
+ e.preventDefault();
210
+ if (!this.menuOpen)
211
+ this.openMenu();
212
+ else
213
+ this.activeIndex = (this.activeIndex + 1) % this.listOptions.length;
214
+ }
215
+ else if (e.key === 'ArrowUp' && this.menuOpen) {
216
+ e.preventDefault();
217
+ this.activeIndex = (this.activeIndex - 1 + this.listOptions.length) % this.listOptions.length;
218
+ }
219
+ else if (e.key === 'Enter' && this.menuOpen && this.activeIndex >= 0) {
220
+ const item = this.listOptions[this.activeIndex];
221
+ if (item && !item.disabled) {
222
+ e.preventDefault();
223
+ this.pickOption(item);
224
+ }
225
+ }
226
+ else if (e.key === 'Escape' && this.menuOpen) {
227
+ e.preventDefault();
228
+ e.stopPropagation();
229
+ this.closeMenu();
230
+ }
231
+ },
232
+ get textType() {
233
+ const t = String(this.inputType || this.field?.type || 'text').toLowerCase();
234
+ return TEXT_TYPES.includes(t) ? t : 'text';
235
+ },
236
+ get nativeType() {
237
+ return this.textType === 'password' && this.revealed ? 'text' : this.textType;
238
+ },
239
+ get inputMode() {
240
+ return { email: 'email', url: 'url', tel: 'tel', search: 'search' }[this.textType] ?? 'text';
241
+ },
242
+ get validationErrors() {
243
+ return this.formatMessage ? [this.formatMessage] : [];
244
+ },
245
+ /**
246
+ * Проверка формата (email, url, pattern) по правилам нативного input, но без создания DOM
247
+ * и с русским текстом (нативное сообщение зависит от языка браузера). Пустое значение сюда не доходит.
248
+ */
249
+ get formatMessage() {
250
+ const text = this.value ?? '';
251
+ if (this.textType === 'email' && !EMAIL.test(text))
252
+ return 'Введите адрес электронной почты';
253
+ if (this.textType === 'url' && !URL.canParse(text))
254
+ return 'Введите адрес в виде URL (например, https://example.com)';
255
+ const pattern = this.pattern || this.field?.pattern;
256
+ // нерабочий pattern нативный input игнорирует — игнорируем и мы
257
+ const re = pattern && patternOf(pattern);
258
+ if (re && !re.test(text))
259
+ return 'Значение не соответствует формату';
260
+ return '';
261
+ }
262
+ });
@@ -53,10 +53,17 @@ function cleanField(f, seen) {
53
53
  field.catalog = f.catalog.trim();
54
54
  if (f.analytic === true)
55
55
  field.analytic = true;
56
+ const rawList = f.list !== undefined ? f.list : ((type !== 'Select' && type !== 'Radio') ? (f.items ?? f.options) : undefined);
57
+ if (rawList !== undefined && rawList !== null && rawList !== '') {
58
+ field.list = rawList;
59
+ if (f.allowOther !== undefined)
60
+ field.allowOther = Boolean(f.allowOther);
61
+ }
56
62
  if (type === 'Select' || type === 'Radio') {
57
- const options = Array.isArray(f.options) ? f.options : [];
58
- field.options = options
59
- .filter(o => o && typeof o === 'object' && String(o.value ?? '').trim() !== '')
63
+ const rawOpts = Array.isArray(f.options) ? f.options : (Array.isArray(f.items) ? f.items : (Array.isArray(f.list) ? f.list : []));
64
+ field.options = rawOpts
65
+ .map(o => o && typeof o === 'object' ? o : { value: String(o ?? ''), label: String(o ?? '') })
66
+ .filter(o => o && String(o.value ?? '').trim() !== '')
60
67
  .map(o => ({
61
68
  value: String(o.value).trim(),
62
69
  label: String(o.label || o.value).trim(),
@@ -1055,7 +1062,7 @@ ODA({is: 'oda-editor-form-field',
1055
1062
  <div class="field-row" ~if="!isBlockField" ~class="{ invalid: hasError, multiline: field?.type === 'Text' }">
1056
1063
  <label class="field-label" ~class="{ compact: isCompactField }" :title="label">{{label}}<span class="req" ~if="required"> *</span>:</label>
1057
1064
  <div class="editor-box">
1058
- <div class="field-control" ~is="editor" :value="data?.[field.id]" @value-changed="onFieldValueChanged($event)" :field :meta="field" :at="data?.time || ''" :allow-other="!!field.other" :borderless="false" dense no-header :readonly="Boolean(readonly || field?.readonly || field?.disabled)" :disabled="Boolean(field?.disabled)"></div>
1065
+ <div class="field-control" ~is="editor" :value="data?.[field.id]" @value-changed="onFieldValueChanged($event)" :field :meta="field" :list="field?.list" :at="data?.time || ''" :allow-other="field?.allowOther !== undefined ? !!field.allowOther : (editor === 'oda-combobox-input' ? true : !!field.other)" :borderless="false" dense no-header :readonly="Boolean(readonly || field?.readonly || field?.disabled)" :disabled="Boolean(field?.disabled)"></div>
1059
1066
  <div class="field-error" ~if="serverError">{{serverError}}</div>
1060
1067
  </div>
1061
1068
  </div>
@@ -1065,7 +1072,7 @@ ODA({is: 'oda-editor-form-field',
1065
1072
  <span>{{label}}<span class="req" ~if="required"> *</span></span>
1066
1073
  </div>
1067
1074
  <div class="editor-box">
1068
- <div ~if="field?.type !== 'Struct'" ~is="editor" :value="data?.[field.id]" @value-changed="onFieldValueChanged($event)" :field :meta="field" :at="data?.time || ''" :allow-other="!!field.other" :borderless="false" no-header :readonly="Boolean(readonly || field?.readonly || field?.disabled)" :disabled="Boolean(field?.disabled)"></div>
1075
+ <div ~if="field?.type !== 'Struct'" ~is="editor" :value="data?.[field.id]" @value-changed="onFieldValueChanged($event)" :field :meta="field" :list="field?.list" :at="data?.time || ''" :allow-other="field?.allowOther !== undefined ? !!field.allowOther : (editor === 'oda-combobox-input' ? true : !!field.other)" :borderless="false" no-header :readonly="Boolean(readonly || field?.readonly || field?.disabled)" :disabled="Boolean(field?.disabled)"></div>
1069
1076
  <div ~if="children?.length && expanded" class="children-box" horizontal :denied="formDesigner?.isItemDenied?.(null, groupLayer)">
1070
1077
  <div class="group-item" ~for="visibleGroupItems"
1071
1078
  ~class="{designing: formDesigner?.designMode}"
@@ -22,6 +22,7 @@ export const CONTROLS = {
22
22
  datetime: 'oda-date-input',
23
23
  timestamp: 'oda-date-input',
24
24
  select: 'oda-select-input',
25
+ combobox: 'oda-combobox-input',
25
26
  radio: 'oda-radio-input',
26
27
  tags: 'oda-tags-input',
27
28
  color: 'oda-color-input',
@@ -39,15 +40,23 @@ export const CONTROLS = {
39
40
  table: 'oda-table-input'
40
41
  };
41
42
 
42
- /** выбор тега по карте: field.control → путь `/` (link) → controls[type] → группа без типа (undefined) → controls.default */
43
+ /** выбор тега по карте: field.control → путь `/` (link) → field.list (выбор/дропдаун) → controls[type] → группа без типа (undefined) → controls.default */
43
44
  export function controlOf(map = {}, field = {}) {
44
45
  if (field.control)
45
46
  return field.control;
46
47
  const type = field.type;
47
48
  if (typeof type === 'string' && type.startsWith('/'))
48
49
  return map.link ?? map.default;
49
- if (type !== undefined && (type in map || String(type).toLowerCase() in map))
50
- return map[type] ?? map[String(type).toLowerCase()];
50
+ const typeKey = type !== undefined ? String(type).toLowerCase() : '';
51
+ const hasList = field.list !== undefined && field.list !== null && field.list !== ''
52
+ && (!Array.isArray(field.list) || field.list.length > 0);
53
+ if (hasList && !['select', 'radio', 'tags', 'list', 'link'].includes(typeKey)) {
54
+ if (field.allowOther === false)
55
+ return map.select ?? map.combobox ?? map.default;
56
+ return map.combobox ?? map.select ?? map.default;
57
+ }
58
+ if (type !== undefined && (type in map || typeKey in map))
59
+ return map[type] ?? map[typeKey];
51
60
  if (field.fields && type === undefined)
52
61
  return undefined;
53
62
  return map.default;
@@ -8,6 +8,7 @@ import '/oda/components/inputs/numeric/numeric.js';
8
8
  import '/oda/components/inputs/date/date.js';
9
9
  import '/oda/components/inputs/checkbox/checkbox.js';
10
10
  import '/oda/components/inputs/select/select.js';
11
+ import '/oda/components/inputs/combobox/combobox.js';
11
12
  import '/oda/components/inputs/radio/radio.js';
12
13
  import '/oda/components/inputs/color/color.js';
13
14
  import '/oda/components/inputs/range/range.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "odant-work",
3
- "version": "1.0.95",
3
+ "version": "1.0.97",
4
4
  "description": "ODANT-WORK — платформа цифровой организации (встроенная система учёта, документооборот, управление процессами и приватный мультимодальный ИИ)",
5
5
  "type": "module",
6
6
  "main": "sources/work.js",
@@ -65,8 +65,15 @@ export class $handler extends $class{
65
65
  get allowUse(){
66
66
  return this.DATA?.allowUse;
67
67
  }
68
+ _baseImportPath(item = this) {
69
+ const p = String(item?.path || '');
70
+ const s = String(item?.short || '');
71
+ if (p.startsWith('/$server/$folder/'))
72
+ return p;
73
+ return s || p;
74
+ }
68
75
  async import(path, is){
69
- path = (this.path || this.short) + '/~/' + (path || 'class.js');
76
+ path = this._baseImportPath(this) + '/~/' + (path || 'class.js');
70
77
  if(!path.endsWith('.js'))
71
78
  path += '.js';
72
79
  const module = await import(path);
@@ -83,7 +90,7 @@ export class $handler extends $class{
83
90
  }
84
91
  if (!comp || typeof comp !== 'object')
85
92
  return null;
86
- const rawPath = this.path || this.short || this.id;
93
+ const rawPath = this._baseImportPath(this) || this.id;
87
94
  const want = is || comp.is || rawExport.tag || makeViewTag(this.id, rawPath);
88
95
  // Клонируем описание компонента с сохранением дескрипторов (геттеры/сеттеры),
89
96
  // чтобы регистрация в WORK/ODA не мутировала кэшированный ES-модуль.
@@ -163,7 +170,7 @@ export class $handler extends $class{
163
170
  async getModule() {
164
171
  const $item = Reactor.activate(this);
165
172
  $item.$context = await $item.$context;
166
- const module = await import(`${$item.path || $item.short}/~/class.js`);
173
+ const module = await import(`${this._baseImportPath($item)}/~/class.js`);
167
174
  return module.default;
168
175
  }
169
176
  }
package/sources/client.js CHANGED
@@ -465,17 +465,22 @@ WORK.login = async function(force = false){
465
465
  try { sessionStorage.removeItem('work.pendingInviteToken'); } catch { /* ignore */ }
466
466
  }
467
467
  WORK.uid = uid;
468
+ WORK._anonExitSynced = false;
468
469
  await WORK.syncAuthUI();
469
470
  WORK.refreshChatUnread?.();
470
471
  WORK.notifyAuth?.({ uid, reason: 'login' });
471
472
  return res;
472
473
  }
474
+ const hadAuth = Boolean(WORK.uid);
473
475
  if (WORK.uid)
474
476
  await WORK.removeCurrentPushSubscription?.();
475
477
  WORK.uid = '';
476
478
  WORK.USER = undefined;
477
479
  WORK.chatUnread = { total: 0, byThread: {}, byNode: {}, byPeer: {} };
478
- await WORK.fetch("/", 'user_exit', {}, {}).catch(() => {});
480
+ if (hadAuth || !WORK._anonExitSynced) {
481
+ WORK._anonExitSynced = true;
482
+ await WORK.fetch("/", 'user_exit', {}, {}).catch(() => {});
483
+ }
479
484
  await WORK.syncAuthUI();
480
485
  WORK.notifyAuth?.({ uid: '', reason: 'logout' });
481
486
  })();