@remit/ui 0.0.221 → 0.0.223

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.
Files changed (209) hide show
  1. package/package.json +14 -3
  2. package/src/components/DropdownMenu.tsx +100 -0
  3. package/src/components/EmptyState.tsx +11 -0
  4. package/src/components/ErrorBanner.render.test.ts +107 -0
  5. package/src/components/ErrorBanner.stories.tsx +132 -0
  6. package/src/components/ErrorBanner.tsx +122 -0
  7. package/src/components/ErrorBannerStack.tsx +34 -0
  8. package/src/components/ErrorState.render.test.ts +82 -0
  9. package/src/components/ErrorState.tsx +80 -0
  10. package/src/components/KeyboardShortcutsModal.tsx +111 -0
  11. package/src/components/account-service-change-dialog.render.test.ts +1 -41
  12. package/src/components/account-service-choice.render.test.ts +0 -26
  13. package/src/components/account-service-toggles.render.test.ts +0 -6
  14. package/src/components/address-display.render.test.ts +1 -38
  15. package/src/components/address-tag.render.test.ts +0 -11
  16. package/src/components/agenda-flow.reach.test.ts +0 -8
  17. package/src/components/agenda-flow.render.test.ts +0 -31
  18. package/src/components/agenda-panels.render.test.ts +0 -5
  19. package/src/components/app-shell-slotted.render.test.ts +0 -118
  20. package/src/components/attachment-list.render.test.ts +41 -24
  21. package/src/components/attachment-list.stories.tsx +67 -0
  22. package/src/components/attachment-list.tsx +112 -35
  23. package/src/components/attendee-row.render.test.ts +0 -41
  24. package/src/components/attention-dot.stories.tsx +46 -0
  25. package/src/components/attention-dot.tsx +23 -0
  26. package/src/components/banner.render.test.ts +0 -7
  27. package/src/components/bottom-sheet.render.test.ts +0 -42
  28. package/src/components/brief-section.render.test.ts +0 -13
  29. package/src/components/brief-sections.keyboard.test.ts +0 -13
  30. package/src/components/brief-sections.render.test.ts +0 -22
  31. package/src/components/calendar-clash-strip.render.test.ts +0 -19
  32. package/src/components/calendar-grid.render.test.ts +0 -79
  33. package/src/components/calendar-invite-card.render.test.ts +0 -19
  34. package/src/components/calendar-list.render.test.ts +0 -21
  35. package/src/components/calendar-slot-offers.render.test.ts +0 -24
  36. package/src/components/calendar-suggestion-deck.render.test.ts +0 -18
  37. package/src/components/calendar-toolbar.render.test.ts +1 -53
  38. package/src/components/category-badge.render.test.ts +1 -24
  39. package/src/components/compose-action-bar.render.test.ts +0 -5
  40. package/src/components/compose-attachments.render.test.ts +0 -38
  41. package/src/components/event-detail.render.test.ts +0 -27
  42. package/src/components/event-editor.render.test.ts +0 -4
  43. package/src/components/event-suggestion-card.render.test.ts +0 -61
  44. package/src/components/event-suggestion-card.zone-gate.test.ts +1 -7
  45. package/src/components/filter-clause-chip.tsx +1 -60
  46. package/src/components/filter-rule-editor.create.test.ts +0 -6
  47. package/src/components/filter-rule-editor.stories.tsx +24 -138
  48. package/src/components/filter-rule-editor.tsx +7 -93
  49. package/src/components/filter-rule.render.test.ts +9 -299
  50. package/src/components/filter-rule.ts +20 -85
  51. package/src/components/filter-sheet.render.test.ts +0 -7
  52. package/src/components/folder-manage-actions.render.test.ts +0 -13
  53. package/src/components/folder-manager.render.test.ts +0 -31
  54. package/src/components/folder-mutation-dialog.render.test.ts +0 -83
  55. package/src/components/folder-rename-dialog.render.test.ts +0 -14
  56. package/src/components/folder-row.render.test.ts +0 -30
  57. package/src/components/folder-sync-state.test.ts +0 -61
  58. package/src/components/folder-tree-picker.create.test.ts +0 -30
  59. package/src/components/folder-tree-picker.render.test.ts +0 -35
  60. package/src/components/intelligence-calendar-fixtures.ts +0 -2
  61. package/src/components/intelligence-calendar.render.test.ts +0 -4
  62. package/src/components/intelligence-panel.render.test.ts +1 -62
  63. package/src/components/intelligence-panel.stories.tsx +0 -76
  64. package/src/components/intelligence-panel.tab-strip.test.ts +0 -1
  65. package/src/components/intelligence-panel.tsx +6 -176
  66. package/src/components/intelligence-toggle.render.test.ts +0 -5
  67. package/src/components/isolated-email-frame.render.test.ts +0 -122
  68. package/src/components/isolated-email-frame.tsx +55 -3
  69. package/src/components/keyboard-hint-bar.render.test.ts +0 -7
  70. package/src/components/label-chip.render.test.ts +0 -28
  71. package/src/components/label-chip.tsx +1 -1
  72. package/src/components/mail-header.render.test.ts +0 -20
  73. package/src/components/mcp-connected-apps-page.stories.tsx +58 -0
  74. package/src/components/mcp-connected-apps-page.tsx +79 -0
  75. package/src/components/mcp-consent-page.stories.tsx +39 -0
  76. package/src/components/mcp-consent-page.tsx +47 -0
  77. package/src/components/mcp-device-page.stories.tsx +57 -0
  78. package/src/components/mcp-device-page.tsx +107 -0
  79. package/src/components/mcp-error-notice.stories.tsx +34 -0
  80. package/src/components/mcp-error-notice.tsx +23 -0
  81. package/src/components/mcp-error-page.stories.tsx +17 -0
  82. package/src/components/mcp-error-page.tsx +15 -0
  83. package/src/components/mcp-fixtures.ts +16 -0
  84. package/src/components/mcp-login-page.stories.tsx +37 -0
  85. package/src/components/mcp-login-page.tsx +58 -0
  86. package/src/components/mcp-page.stories.tsx +27 -0
  87. package/src/components/mcp-page.tsx +35 -0
  88. package/src/components/mcp-permission-list.stories.tsx +21 -0
  89. package/src/components/mcp-permission-list.tsx +22 -0
  90. package/src/components/message-body-view.render.test.ts +0 -21
  91. package/src/components/message-list-pane.brief-filter.test.ts +0 -6
  92. package/src/components/message-list-pane.render.test.ts +0 -54
  93. package/src/components/message-list-state.render.test.ts +0 -84
  94. package/src/components/{quarantine-bug-dialog.tsx → message-report-dialog.tsx} +9 -14
  95. package/src/components/message-row.render.test.ts +1 -98
  96. package/src/components/mobile-message-action-bar.render.test.ts +0 -59
  97. package/src/components/mobile-reading-pane.render.test.ts +0 -48
  98. package/src/components/mobile-reading-pane.stories.tsx +78 -0
  99. package/src/components/mobile-reading-pane.tsx +55 -41
  100. package/src/components/mobile-search-view.render.test.ts +0 -16
  101. package/src/components/mobile-search-view.stories.tsx +8 -11
  102. package/src/components/mobile-search-view.tsx +1 -1
  103. package/src/components/nav-sidebar.keyboard.test.ts +0 -8
  104. package/src/components/nav-sidebar.render.test.ts +2 -133
  105. package/src/components/new-folder-form.render.test.ts +0 -26
  106. package/src/components/outbox-row.render.test.ts +0 -9
  107. package/src/components/pane-layout.render.test.ts +0 -18
  108. package/src/components/plain-text-editor.mount.test.ts +0 -16
  109. package/src/components/popover-menu.render.test.ts +0 -11
  110. package/src/components/progress-bar.render.test.ts +0 -14
  111. package/src/components/quarantine-report.test.ts +0 -8
  112. package/src/components/quarantine-section.render.test.ts +16 -13
  113. package/src/components/quarantine-section.stories.tsx +11 -8
  114. package/src/components/reading-pane.render.test.ts +2 -106
  115. package/src/components/reading-pane.stories.tsx +3 -0
  116. package/src/components/refresh-button.render.test.ts +0 -9
  117. package/src/components/rescue-from-spam-flow.render.test.ts +0 -24
  118. package/src/components/rich-text-editor.mount.test.ts +0 -19
  119. package/src/components/rich-text-image-node.ts +11 -9
  120. package/src/components/role-appointment-list.render.test.ts +0 -49
  121. package/src/components/role-appointment-prompt.render.test.ts +0 -79
  122. package/src/components/row-actions.render.test.ts +0 -34
  123. package/src/components/search-bar.render.test.ts +0 -44
  124. package/src/components/search-chip-input.render.test.ts +0 -71
  125. package/src/components/search-conversion-notice.stories.tsx +0 -6
  126. package/src/components/search-conversion-notice.tsx +3 -9
  127. package/src/components/search-conversion.render.test.ts +0 -52
  128. package/src/components/search-conversion.ts +2 -18
  129. package/src/components/search-result-row.tsx +5 -26
  130. package/src/components/search-results.render.test.ts +0 -68
  131. package/src/components/search-results.stories.tsx +0 -30
  132. package/src/components/search-results.tsx +1 -1
  133. package/src/components/security-select.render.test.ts +1 -14
  134. package/src/components/selection-top-bar.render.test.ts +0 -180
  135. package/src/components/selection-wizard-fixtures.ts +0 -2
  136. package/src/components/selection-wizard.render.test.ts +7 -212
  137. package/src/components/selection-wizard.stories.tsx +24 -164
  138. package/src/components/selection-wizard.tsx +10 -86
  139. package/src/components/self-update.render.test.ts +0 -113
  140. package/src/components/sender-trust-indicator.render.test.ts +0 -30
  141. package/src/components/shell-top-bar.render.test.ts +0 -31
  142. package/src/components/shell-top-bar.stories.tsx +7 -0
  143. package/src/components/shell-top-bar.tsx +11 -2
  144. package/src/components/slide-panel.render.test.ts +0 -18
  145. package/src/components/suggest-list.render.test.ts +0 -6
  146. package/src/components/swipeable-row.gesture.test.ts +85 -40
  147. package/src/components/swipeable-row.render.test.ts +0 -7
  148. package/src/components/swipeable-row.stories.tsx +3 -2
  149. package/src/components/swipeable-row.tsx +65 -144
  150. package/src/components/sync-warning-fixtures.ts +22 -0
  151. package/src/components/sync-warning-report.ts +38 -0
  152. package/src/components/sync-warning-row.tsx +51 -0
  153. package/src/components/sync-warning-section.render.test.ts +19 -0
  154. package/src/components/sync-warning-section.stories.tsx +94 -0
  155. package/src/components/sync-warning-section.tsx +56 -0
  156. package/src/components/touch-list-body.render.test.ts +0 -29
  157. package/src/components/wizard.render.test.ts +0 -22
  158. package/src/filter-presets.test.ts +1 -107
  159. package/src/index.ts +40 -34
  160. package/src/lib/compose-language.test.ts +0 -11
  161. package/src/lib/email-render-treatment.test.ts +0 -21
  162. package/src/lib/keymap.test.ts +0 -32
  163. package/src/lib/property-prefill.ts +2 -2
  164. package/src/lib/search-rule.test.ts +0 -4
  165. package/src/lib/search-rule.ts +0 -9
  166. package/src/lib/sender-derivation.ts +3 -5
  167. package/src/lib/swipe-config.ts +11 -0
  168. package/src/lib/use-list-cursor.test.ts +0 -7
  169. package/src/lib/use-list-keyboard.test.ts +0 -14
  170. package/src/lib/use-long-press.test.ts +53 -36
  171. package/src/lib/use-long-press.ts +62 -56
  172. package/src/lib/use-modal-focus.test.ts +0 -20
  173. package/src/lib/use-selection.hook.test.ts +0 -13
  174. package/src/lib/use-selection.test.ts +0 -101
  175. package/src/lib/use-swipe-navigation.test.ts +162 -0
  176. package/src/lib/use-swipe-navigation.ts +90 -0
  177. package/src/lib/wizard-steps.test.ts +18 -79
  178. package/src/lib/wizard-steps.ts +27 -67
  179. package/src/mcp-pages.ts +36 -0
  180. package/src/category-presentation.test.ts +0 -76
  181. package/src/components/account-service-status.render.test.ts +0 -82
  182. package/src/components/app-password-hint.render.test.ts +0 -23
  183. package/src/components/app-top-bar.render.test.ts +0 -59
  184. package/src/components/auth-card.render.test.ts +0 -24
  185. package/src/components/auth-footer.render.test.ts +0 -17
  186. package/src/components/auth-hero.render.test.ts +0 -31
  187. package/src/components/auto-moved-badge.render.test.ts +0 -65
  188. package/src/components/button.render.test.ts +0 -29
  189. package/src/components/calendar-event-chip.render.test.ts +0 -67
  190. package/src/components/calendar-parse-badge.render.test.ts +0 -40
  191. package/src/components/checkbox.render.test.ts +0 -65
  192. package/src/components/compose-form-shell.render.test.ts +0 -106
  193. package/src/components/dialog.render.test.ts +0 -51
  194. package/src/components/field-label.render.test.ts +0 -16
  195. package/src/components/mail-action-toolbar.render.test.ts +0 -43
  196. package/src/components/nav-link-surface.render.test.ts +0 -126
  197. package/src/components/new-folder-action.render.test.ts +0 -44
  198. package/src/components/pane-header.render.test.ts +0 -22
  199. package/src/components/pull-to-refresh.render.test.ts +0 -46
  200. package/src/components/recurrence-scope-prompt.render.test.ts +0 -36
  201. package/src/components/rescue-banner.render.test.ts +0 -32
  202. package/src/components/rescue-candidate-row.render.test.ts +0 -68
  203. package/src/components/search-token-chip.render.test.ts +0 -42
  204. package/src/components/self-update-dot.tsx +0 -32
  205. package/src/components/settings-primitives.render.test.ts +0 -160
  206. package/src/lib/email-layout-clamp.test.ts +0 -139
  207. package/src/lib/label-color.test.ts +0 -25
  208. package/src/lib/semantic-off.ts +0 -20
  209. package/src/stories-viewport-globals.test.ts +0 -77
@@ -2,32 +2,19 @@ import assert from "node:assert/strict";
2
2
  import { describe, it } from "node:test";
3
3
  import { createElement } from "react";
4
4
  import { renderToString } from "react-dom/server";
5
- import {
6
- AddChipButton,
7
- ClauseChip,
8
- ClauseEditor,
9
- WidenChip,
10
- } from "./filter-clause-chip.js";
5
+ import { ClauseChip, ClauseEditor } from "./filter-clause-chip.js";
11
6
  import { FilterPreviewCount } from "./filter-preview-count.js";
12
7
  import {
13
8
  type ClauseField,
14
- clauseFieldHint,
15
9
  clauseFieldLabel,
16
- clauseFieldOrder,
17
10
  commitBlockedReason,
18
- commitLabel,
19
11
  demoRule,
20
12
  demoSenderFallbackRule,
21
- demoVocabularyRule,
22
13
  type FilterRule,
23
14
  type LabelOption,
24
15
  matchJoinWord,
25
- matchOperatorLabel,
26
16
  type PreviewCount,
27
17
  previewCountSummary,
28
- type RuleScope,
29
- scopeLabel,
30
- widenChipLabel,
31
18
  } from "./filter-rule.js";
32
19
  import {
33
20
  FilterRuleEditor,
@@ -57,49 +44,16 @@ const editor = (overrides: Partial<FilterRuleEditorProps> = {}) =>
57
44
  rule: demoRule,
58
45
  folders: FOLDERS,
59
46
  preview: READY,
60
- semanticAvailable: true,
61
47
  ...overrides,
62
48
  }),
63
49
  );
64
50
 
65
51
  describe("filter-rule model", () => {
66
- it("labels every clause field", () => {
67
- const labels = clauseFieldOrder.map(clauseFieldLabel);
68
- assert.deepEqual(labels, [
69
- "From",
70
- "Subject",
71
- "Has the words",
72
- "List",
73
- "Domain",
74
- ]);
75
- });
76
-
77
52
  it("joins clauses with and/or by operator", () => {
78
53
  assert.equal(matchJoinWord("all"), "and");
79
54
  assert.equal(matchJoinWord("any"), "or");
80
55
  });
81
56
 
82
- it("names the operators and scopes for the toggles", () => {
83
- assert.equal(matchOperatorLabel("all"), "Match all");
84
- assert.equal(matchOperatorLabel("any"), "Match any");
85
- const scopes: RuleScope[] = ["once", "standing", "until"];
86
- assert.deepEqual(scopes.map(scopeLabel), [
87
- "Just once",
88
- "Keep doing this",
89
- "Until a date",
90
- ]);
91
- });
92
-
93
- it("labels the widen chip with its anchor count", () => {
94
- assert.equal(widenChipLabel({ anchorCount: 2 }), "Similar to these 2");
95
- });
96
-
97
- it("labels the commit by scope", () => {
98
- assert.equal(commitLabel("once"), "Apply now");
99
- assert.equal(commitLabel("standing"), "Save rule");
100
- assert.equal(commitLabel("until"), "Save until then");
101
- });
102
-
103
57
  it("summarises every preview state", () => {
104
58
  assert.match(previewCountSummary({ status: "loading" }), /Counting/);
105
59
  assert.equal(
@@ -138,26 +92,6 @@ describe("commitBlockedReason", () => {
138
92
  assert.equal(commitBlockedReason(base, fresh), undefined);
139
93
  });
140
94
 
141
- it("an active widen alone is a matcher", () => {
142
- assert.equal(
143
- commitBlockedReason(
144
- { ...base, clauses: [], widen: { anchorCount: 2 } },
145
- fresh,
146
- ),
147
- undefined,
148
- );
149
- });
150
-
151
- it("an inactive widen alone is not a matcher", () => {
152
- assert.match(
153
- commitBlockedReason(
154
- { ...base, clauses: [], widen: { anchorCount: 2, inactive: true } },
155
- fresh,
156
- ) ?? "",
157
- /Add a clause/,
158
- );
159
- });
160
-
161
95
  it("asks for a matcher when there is none", () => {
162
96
  assert.match(
163
97
  commitBlockedReason({ ...base, clauses: [] }, fresh) ?? "",
@@ -266,39 +200,6 @@ describe("ClauseChip", () => {
266
200
  });
267
201
  });
268
202
 
269
- describe("WidenChip", () => {
270
- it("offers a removable similar-mail chip with the anchor count", () => {
271
- const html = render(
272
- createElement(WidenChip, {
273
- widen: { anchorCount: 3 },
274
- onRemove: () => {},
275
- }),
276
- );
277
- assert.match(html, /and anything similar/);
278
- assert.match(html, /Similar to these 3/);
279
- assert.match(html, /aria-label="Remove the similar-mail widen"/);
280
- });
281
-
282
- it("marks a degraded widen inactive but keeps it removable", () => {
283
- const html = render(
284
- createElement(WidenChip, {
285
- widen: { anchorCount: 2, inactive: true },
286
- onRemove: () => {},
287
- }),
288
- );
289
- assert.match(html, /not available here/);
290
- assert.match(html, /line-through/);
291
- assert.match(html, /aria-label="Remove the similar-mail widen"/);
292
- });
293
- });
294
-
295
- describe("AddChipButton", () => {
296
- it("renders its label", () => {
297
- const html = render(createElement(AddChipButton, { label: "Add clause" }));
298
- assert.match(html, /Add clause/);
299
- });
300
- });
301
-
302
203
  describe("ClauseEditor", () => {
303
204
  it("offers the field picker and a value input when adding", () => {
304
205
  const html = render(
@@ -312,16 +213,6 @@ describe("ClauseEditor", () => {
312
213
  assert.match(html, />Add</);
313
214
  });
314
215
 
315
- it("labels the submit Save when editing", () => {
316
- const html = render(
317
- createElement(ClauseEditor, {
318
- draft: { field: "Subject", value: "invoice" },
319
- mode: "edit",
320
- }),
321
- );
322
- assert.match(html, />Save</);
323
- });
324
-
325
216
  it("offers only the fields a consumer allows, so it never proposes a clause the backend can't match", () => {
326
217
  const html = render(
327
218
  createElement(ClauseEditor, {
@@ -357,17 +248,6 @@ describe("ClauseEditor", () => {
357
248
  assert.match(html, /registrable domain/i);
358
249
  });
359
250
 
360
- it("carries no hint for the self-evident fields", () => {
361
- const html = render(
362
- createElement(ClauseEditor, {
363
- draft: { field: "Subject", value: "" },
364
- mode: "add",
365
- }),
366
- );
367
- assert.doesNotMatch(html, /registrable domain/i);
368
- assert.doesNotMatch(html, /List-Id/);
369
- });
370
-
371
251
  it("is a plain text box when there is nothing to suggest", () => {
372
252
  const html = render(
373
253
  createElement(ClauseEditor, {
@@ -402,25 +282,7 @@ describe("ClauseEditor", () => {
402
282
  });
403
283
  });
404
284
 
405
- describe("clauseFieldHint", () => {
406
- it("explains ListId and FromDomain, and leaves the plain fields unexplained", () => {
407
- assert.match(clauseFieldHint("ListId") ?? "", /List-Id/);
408
- assert.match(clauseFieldHint("FromDomain") ?? "", /registrable domain/i);
409
- assert.equal(clauseFieldHint("From"), undefined);
410
- assert.equal(clauseFieldHint("Subject"), undefined);
411
- assert.equal(clauseFieldHint("HasWords"), undefined);
412
- });
413
- });
414
-
415
285
  describe("FilterPreviewCount", () => {
416
- it("shows a live loading state", () => {
417
- const html = render(
418
- createElement(FilterPreviewCount, { preview: { status: "loading" } }),
419
- );
420
- assert.match(html, /Counting matches/);
421
- assert.match(html, /aria-live/);
422
- });
423
-
424
286
  it("states zero without reading as an error", () => {
425
287
  const html = render(
426
288
  createElement(FilterPreviewCount, {
@@ -431,39 +293,6 @@ describe("FilterPreviewCount", () => {
431
293
  assert.doesNotMatch(html, /role="alert"/);
432
294
  });
433
295
 
434
- // A zero counted against an index that holds nothing is not the same
435
- // statement as a zero counted against the mail (#452), and reading it as one
436
- // talks the user out of a rule that would match plenty.
437
- it("says the index is still filling rather than that nothing matches", () => {
438
- const html = render(
439
- createElement(FilterPreviewCount, {
440
- preview: { status: "ready", count: 0, indexEmpty: true },
441
- }),
442
- );
443
- assert.match(html, /Still indexing/);
444
- assert.doesNotMatch(html, /No mail matches yet/);
445
- assert.doesNotMatch(html, /role="alert"/);
446
- });
447
-
448
- it("does not mark the empty-index line as recounting", () => {
449
- const html = render(
450
- createElement(FilterPreviewCount, {
451
- preview: { status: "ready", count: 0, stale: true, indexEmpty: true },
452
- }),
453
- );
454
- assert.match(html, /Still indexing/);
455
- assert.doesNotMatch(html, /recounting/);
456
- });
457
-
458
- it("counts many matches", () => {
459
- const html = render(
460
- createElement(FilterPreviewCount, {
461
- preview: { status: "ready", count: 412 },
462
- }),
463
- );
464
- assert.match(html, /412 messages match/);
465
- });
466
-
467
296
  it("marks a changed set as recounting rather than blank", () => {
468
297
  const html = render(
469
298
  createElement(FilterPreviewCount, {
@@ -485,21 +314,6 @@ describe("FilterPreviewCount", () => {
485
314
  });
486
315
 
487
316
  describe("FilterRuleEditor", () => {
488
- it("renders clause chips joined by the operator word", () => {
489
- const html = editor();
490
- assert.match(html, /notifications@github\.com/);
491
- assert.match(html, /pull request/);
492
- assert.match(html, /and/);
493
- });
494
-
495
- it("joins with or when matching any", () => {
496
- const html = editor({ rule: demoVocabularyRule });
497
- assert.match(html, /python-dev\.python\.org/);
498
- assert.match(html, /python\.org/);
499
- assert.match(html, /nightly build/);
500
- assert.match(html, /or/);
501
- });
502
-
503
317
  it("shows the match-operator toggle only with two or more matchers", () => {
504
318
  assert.match(editor(), /aria-label="Match operator"/);
505
319
  const single = editor({
@@ -513,53 +327,6 @@ describe("FilterRuleEditor", () => {
513
327
  assert.doesNotMatch(single, /aria-label="Match operator"/);
514
328
  });
515
329
 
516
- it("offers the widen add only when the deployment can serve it", () => {
517
- const noWiden: FilterRule = { ...demoRule, widen: undefined };
518
- assert.match(
519
- editor({ rule: noWiden, semanticAvailable: true }),
520
- /…and similar/,
521
- );
522
- assert.doesNotMatch(
523
- editor({ rule: noWiden, semanticAvailable: false }),
524
- /…and similar/,
525
- );
526
- });
527
-
528
- it("renders a present widen even where the capability is absent", () => {
529
- const html = editor({
530
- rule: {
531
- ...demoRule,
532
- widen: { anchorCount: 2, inactive: true },
533
- },
534
- semanticAvailable: false,
535
- });
536
- assert.match(html, /not available here/);
537
- });
538
-
539
- it("drops the join word before an inactive widen chip", () => {
540
- const joins = (html: string) =>
541
- html.match(/uppercase text-fg-subtle">and</g)?.length ?? 0;
542
- assert.equal(joins(editor()), 2);
543
- assert.equal(
544
- joins(
545
- editor({
546
- rule: { ...demoRule, widen: { anchorCount: 2, inactive: true } },
547
- semanticAvailable: false,
548
- }),
549
- ),
550
- 1,
551
- );
552
- });
553
-
554
- it("keeps a degraded widen removable in the editor", () => {
555
- const html = editor({
556
- rule: { ...demoRule, widen: { anchorCount: 2, inactive: true } },
557
- semanticAvailable: false,
558
- onRemoveWiden: () => {},
559
- });
560
- assert.match(html, /aria-label="Remove the similar-mail widen"/);
561
- });
562
-
563
330
  it("blocks the commit while the previewed set is recounting", () => {
564
331
  const html = editor({
565
332
  preview: { status: "ready", count: 47, stale: true },
@@ -569,7 +336,7 @@ describe("FilterRuleEditor", () => {
569
336
  assert.match(html, /disabled/);
570
337
  });
571
338
 
572
- it("renders the sender-fallback From chips as ordinary editable chips", () => {
339
+ it("renders derived From chips as ordinary editable chips", () => {
573
340
  const html = editor({ rule: demoSenderFallbackRule });
574
341
  assert.match(html, /receipts@stripe\.com/);
575
342
  assert.match(html, /receipts@lyft\.com/);
@@ -583,19 +350,6 @@ describe("FilterRuleEditor", () => {
583
350
  assert.match(html, /Travel/);
584
351
  });
585
352
 
586
- it("renders a chip for the selected label", () => {
587
- const html = editor({
588
- labels: LABELS,
589
- rule: { ...demoRule, labelId: "lbl-receipts" },
590
- });
591
- assert.match(html, /Receipts/);
592
- });
593
-
594
- it("offers no create option without onCreateLabel", () => {
595
- const html = editor({ labels: LABELS });
596
- assert.doesNotMatch(html, /New label…/);
597
- });
598
-
599
353
  it("offers the create option when onCreateLabel is wired", () => {
600
354
  const html = editor({
601
355
  labels: LABELS,
@@ -624,11 +378,6 @@ describe("FilterRuleEditor", () => {
624
378
  assert.doesNotMatch(once, /aria-label="Rule name"/);
625
379
  });
626
380
 
627
- it("drives the commit label from the scope", () => {
628
- assert.match(editor(), /Save rule/);
629
- assert.match(editor({ rule: { ...demoRule, scope: "once" } }), /Apply now/);
630
- });
631
-
632
381
  it("states why the commit is blocked instead of only disabling it", () => {
633
382
  const html = editor({
634
383
  rule: { ...demoRule, moveMailboxId: undefined },
@@ -637,59 +386,20 @@ describe("FilterRuleEditor", () => {
637
386
  assert.match(html, /Pick a folder/);
638
387
  });
639
388
 
640
- it("renders the inline clause editor when adding", () => {
641
- const html = editor({
642
- clauseEdit: { mode: "add", draft: { field: "From", value: "" } },
643
- });
644
- assert.match(html, /aria-label="Clause value"/);
645
- assert.doesNotMatch(html, /Add clause/);
646
- });
647
-
648
- it("shows the live preview region", () => {
649
- assert.match(editor(), /47 messages match/);
650
- });
651
-
652
- it("keeps scope and expiry live and editable on an anchor-locked (existing) filter (reader #266)", () => {
389
+ it("keeps scope and expiry live and editable on a persisted filter (reader #266)", () => {
653
390
  const html = editor({
654
391
  rule: { ...demoRule, scope: "until", until: "2027-09-01" },
655
- anchorLocked: true,
392
+ persisted: true,
656
393
  });
657
394
  assert.match(html, /aria-label="Rule scope"/);
658
395
  assert.match(html, /aria-label="Expiry date"/);
659
396
  assert.match(html, /aria-label="Rule name"/);
660
397
  });
661
398
 
662
- it("drops the once option from the scope toggle on an anchor-locked filter", () => {
663
- const locked = editor({ anchorLocked: true });
664
- assert.doesNotMatch(locked, />Just once</);
665
- const unlocked = editor({ anchorLocked: false });
666
- assert.match(unlocked, />Just once</);
667
- });
668
-
669
- it("locks the widen chip and explains why only when one is present", () => {
670
- const withWiden = editor({
671
- rule: { ...demoRule, widen: { anchorCount: 2 } },
672
- anchorLocked: true,
673
- });
674
- assert.doesNotMatch(
675
- withWiden,
676
- /aria-label="Remove the similar-mail widen"/,
677
- );
678
- assert.match(withWiden, /similar-mail match is fixed to the message/);
679
-
680
- const literal = editor({
681
- rule: { ...demoRule, widen: undefined },
682
- anchorLocked: true,
683
- });
684
- assert.doesNotMatch(literal, /similar-mail match is fixed/);
685
- });
686
-
687
- it("never offers to add a widen on an anchor-locked filter, even when the deployment can serve it", () => {
688
- const html = editor({
689
- rule: { ...demoRule, widen: undefined },
690
- anchorLocked: true,
691
- semanticAvailable: true,
692
- });
693
- assert.doesNotMatch(html, /…and similar/);
399
+ it("drops the once option from the scope toggle on a persisted filter", () => {
400
+ const persisted = editor({ persisted: true });
401
+ assert.doesNotMatch(persisted, />Just once</);
402
+ const fresh = editor({ persisted: false });
403
+ assert.match(fresh, />Just once</);
694
404
  });
695
405
  });
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * The filter rule as the user edits it (RFC 038).
3
3
  *
4
- * A rule is literal clauses combined under one match operator, an optional
5
- * semantic widen, an action, and a scope. This module is the vocabulary the
6
- * chip editor renders — a design model driven from fixtures, not the API.
7
- * Naming tracks the RFC: rule, clause, widen, scope.
4
+ * A rule is literal clauses combined under one match operator, an action, and
5
+ * a scope. This module is the vocabulary the chip editor renders — a design
6
+ * model driven from fixtures, not the API. Naming tracks the RFC: rule,
7
+ * clause, scope.
8
8
  */
9
9
 
10
10
  import type { FolderTreeNode } from "../lib/folder-tree.js";
@@ -27,9 +27,8 @@ export interface RuleClause {
27
27
  field: ClauseField;
28
28
  value: string;
29
29
  /**
30
- * A `From` clause the server derived from the selection because the widen
31
- * could not run (#251). It is an ordinary visible, editable chip — this flag
32
- * only annotates where it came from.
30
+ * A clause prefilled from the selection (#251). It is an ordinary visible,
31
+ * editable chip — this flag only annotates where it came from.
33
32
  */
34
33
  derived?: boolean;
35
34
  }
@@ -37,34 +36,9 @@ export interface RuleClause {
37
36
  /** How the clauses combine. Maps to the API's `And` / `Or`. */
38
37
  export type MatchOperator = "all" | "any";
39
38
 
40
- /**
41
- * What the rule matches on (RFC 038 D2/D3). `similar` rides the semantic widen
42
- * off the messages the rule was started from; `properties` uses literal clauses
43
- * only — sender, subject, list — and needs no vector pipeline at all. A surface
44
- * that offers both opens on `similar` wherever the deployment can serve it.
45
- */
46
- export type RuleMatchMode = "similar" | "properties";
47
-
48
- const matchModeLabels: Record<RuleMatchMode, string> = {
49
- similar: "Anything similar",
50
- properties: "Its properties",
51
- };
52
-
53
- export function matchModeLabel(mode: RuleMatchMode): string {
54
- return matchModeLabels[mode];
55
- }
56
-
57
- const matchModeHints: Record<RuleMatchMode, string> = {
58
- similar: "Reads the messages you picked and finds more that read like them.",
59
- properties:
60
- "Matches on what the messages say about themselves — sender, subject, list. No reading involved.",
61
- };
62
-
63
- /** One line saying what a match mode actually does, so the choice is never a
64
- * guess (ux.md). */
65
- export function matchModeHint(mode: RuleMatchMode): string {
66
- return matchModeHints[mode];
67
- }
39
+ /** What matching on a message's properties does, in one line (ux.md). */
40
+ export const PROPERTIES_MATCH_HINT =
41
+ "Matches on what the messages say about themselves — sender, subject, list. No reading involved.";
68
42
 
69
43
  /**
70
44
  * When the rule stops (RFC 038 D1). `once` is a one-time action, `standing`
@@ -72,26 +46,9 @@ export function matchModeHint(mode: RuleMatchMode): string {
72
46
  */
73
47
  export type RuleScope = "once" | "standing" | "until";
74
48
 
75
- /**
76
- * The semantic widen (RFC 038 D3): one chip backed by the anchor mechanism.
77
- * Absent from a rule means the chip is not present; a deployment that cannot
78
- * serve the widen never offers it at all.
79
- */
80
- export interface RuleWiden {
81
- /** Anchors the similarity rides on — "similar to these N". */
82
- anchorCount: number;
83
- /**
84
- * The rule carries an anchor this deployment cannot evaluate — created
85
- * elsewhere, capability since lost (RFC 038 D4). The chip lists as inactive,
86
- * the rule matches by its literal clauses only, and nothing claims otherwise.
87
- */
88
- inactive?: boolean;
89
- }
90
-
91
49
  export interface FilterRule {
92
50
  clauses: RuleClause[];
93
51
  matchOperator: MatchOperator;
94
- widen?: RuleWiden;
95
52
  /** The move-to-folder action's destination. Absent leaves mail in place. */
96
53
  moveMailboxId?: string;
97
54
  /**
@@ -116,15 +73,10 @@ export interface LabelOption {
116
73
  * The live match count (RFC 038 D1). `stale` marks a count the editor already
117
74
  * moved past — a clause changed after it was counted, so the number on screen
118
75
  * is the previous rule's until the next preview lands.
119
- *
120
- * `indexEmpty` is the server saying the semantic index had nothing to answer
121
- * with (issue #452). A zero counted against an empty index is a fact about the
122
- * index, not about the rule, and reading it as "no mail matches" talks a user
123
- * out of a rule that will match plenty once indexing catches up.
124
76
  */
125
77
  export type PreviewCount =
126
78
  | { status: "loading" }
127
- | { status: "ready"; count: number; stale?: boolean; indexEmpty?: boolean }
79
+ | { status: "ready"; count: number; stale?: boolean }
128
80
  | { status: "error"; reason: string };
129
81
 
130
82
  const clauseFieldLabels: Record<ClauseField, string> = {
@@ -158,24 +110,19 @@ export function clauseFieldHint(field: ClauseField): string | undefined {
158
110
 
159
111
  /**
160
112
  * Whether a clause field matches on message body text, which only the live
161
- * index-time filter and the semantic widen can read.
113
+ * index-time filter can read.
162
114
  *
163
- * The vector-free matcher serves `From`/`Subject` from the core thread rows and
115
+ * The organize matcher serves `From`/`Subject` from the core thread rows and
164
116
  * carries no faithful body, so it rejects a body-text clause outright rather
165
117
  * than narrowing the match silently (`bodyContentRejection`,
166
- * backend/service/organize.ts). A rule with no active widen therefore cannot be
167
- * counted or applied one-time with such a clause in it — it can only be a
168
- * standing rule, where the index-time matcher reads the whole body.
118
+ * backend/service/organize.ts). Such a clause therefore cannot be counted or
119
+ * applied one-time — it can only be a standing rule, where the index-time
120
+ * matcher reads the whole body.
169
121
  */
170
122
  export function matchesBodyText(field: ClauseField): boolean {
171
123
  return field === "HasWords";
172
124
  }
173
125
 
174
- /** Whether the rule's semantic widen is present and evaluable. */
175
- export function hasActiveWiden(rule: FilterRule): boolean {
176
- return rule.widen !== undefined && !rule.widen.inactive;
177
- }
178
-
179
126
  /**
180
127
  * Whether the rule carries a live way to match. Without one the predicate is
181
128
  * empty, and a rule with an empty predicate matches nothing — not the mail
@@ -183,16 +130,14 @@ export function hasActiveWiden(rule: FilterRule): boolean {
183
130
  * asks the question here, so none of them can save that shape.
184
131
  */
185
132
  export function hasMatcher(rule: FilterRule): boolean {
186
- return rule.clauses.length > 0 || hasActiveWiden(rule);
133
+ return rule.clauses.length > 0;
187
134
  }
188
135
 
189
136
  /**
190
- * The rule's body-text clauses that nothing on its current match path can read
191
- * — a `HasWords` chip with no active widen behind it. Empty for every rule the
192
- * literal matcher can evaluate.
137
+ * The rule's body-text clauses the organize matcher cannot read — a
138
+ * `HasWords` chip. Empty for every rule the literal matcher can evaluate.
193
139
  */
194
140
  export function unreadableBodyClauses(rule: FilterRule): RuleClause[] {
195
- if (hasActiveWiden(rule)) return [];
196
141
  return rule.clauses.filter((clause) => matchesBodyText(clause.field));
197
142
  }
198
143
 
@@ -205,10 +150,6 @@ export const clauseFieldOrder: ClauseField[] = [
205
150
  "FromDomain",
206
151
  ];
207
152
 
208
- export function widenChipLabel(widen: RuleWiden): string {
209
- return `Similar to these ${widen.anchorCount}`;
210
- }
211
-
212
153
  const matchOperatorLabels: Record<MatchOperator, string> = {
213
154
  all: "Match all",
214
155
  any: "Match any",
@@ -230,11 +171,6 @@ export function matchJoinWord(operator: MatchOperator): string {
230
171
  export function previewCountSummary(preview: PreviewCount): string {
231
172
  if (preview.status === "loading") return "Counting matches…";
232
173
  if (preview.status === "error") return preview.reason;
233
- // An index with nothing in it counted nothing, so there is no count to mark
234
- // as recounting. The sentence is about the index, not about the rule, and it
235
- // reads the same whichever predicate is on screen.
236
- if (preview.indexEmpty)
237
- return "Still indexing — nothing to match against yet";
238
174
  if (preview.count === 0) return "No mail matches yet";
239
175
  const noun = preview.count === 1 ? "message" : "messages";
240
176
  const base = `${preview.count} ${noun} match`;
@@ -265,7 +201,7 @@ export function commitLabel(scope: RuleScope): string {
265
201
  */
266
202
  export const ruleBlockedCopy = {
267
203
  noMatch: "Add a clause so the rule has something to match.",
268
- // A one-time apply runs the vector-free matcher, which cannot read message
204
+ // A one-time apply runs the organize matcher, which cannot read message
269
205
  // bodies. Saved as a rule the same clause works, so say that rather than
270
206
  // refusing the clause outright.
271
207
  bodyTextOnce:
@@ -278,7 +214,7 @@ export const ruleBlockedCopy = {
278
214
  } as const;
279
215
 
280
216
  /**
281
- * What the count region says when there is no count to be had. The vector-free
217
+ * What the count region says when there is no count to be had. The organize
282
218
  * matcher will not read message bodies, so a `HasWords` clause cannot be counted
283
219
  * before it is saved — which is a different answer from a count of zero, and
284
220
  * the only one that keeps an empty sample from reading as "this matches
@@ -356,7 +292,6 @@ export const demoRule: FilterRule = {
356
292
  { id: "c2", field: "Subject", value: "pull request" },
357
293
  ],
358
294
  matchOperator: "all",
359
- widen: { anchorCount: 2 },
360
295
  moveMailboxId: "mbx-archive",
361
296
  scope: "standing",
362
297
  name: "GitHub notifications",
@@ -71,13 +71,6 @@ describe("FilterSheet", () => {
71
71
  });
72
72
  assert.match(html, /aria-label="Clear filters"/);
73
73
  });
74
-
75
- it("is flat: no overlay, scrim, shadow, or rounded-corner chrome", () => {
76
- const html = render({ expanded: true });
77
- assert.doesNotMatch(html, /shadow-/);
78
- assert.doesNotMatch(html, /rounded-b-2xl/);
79
- assert.doesNotMatch(html, /role="slider"/);
80
- });
81
74
  });
82
75
 
83
76
  describe("FilterSheet under a FilterPanelProvider", () => {
@@ -24,10 +24,6 @@ describe("FolderManageActions", () => {
24
24
  assert.match(html, /aria-label="Delete Travel"/);
25
25
  });
26
26
 
27
- it("leaves a deletable folder's delete pressable", () => {
28
- assert.doesNotMatch(render({}), /disabled=""/);
29
- });
30
-
31
27
  it("states why a folder stays, in the control's own name", () => {
32
28
  const html = render({
33
29
  deleteBlockedReason: "The inbox can't be deleted.",
@@ -39,13 +35,4 @@ describe("FolderManageActions", () => {
39
35
  assert.match(html, /disabled=""/);
40
36
  assert.match(html, /title="The inbox can&#x27;t be deleted."/);
41
37
  });
42
-
43
- it("takes the surface's own wording for each control", () => {
44
- const html = render({
45
- renameLabel: (label) => `Hernoem ${label}`,
46
- deleteLabel: (label) => `Verwijder ${label}`,
47
- });
48
- assert.match(html, /aria-label="Hernoem Travel"/);
49
- assert.match(html, /aria-label="Verwijder Travel"/);
50
- });
51
38
  });