@remit/ui 0.0.222 → 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 (200) hide show
  1. package/package.json +12 -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 +1 -1
  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-search-view.render.test.ts +0 -16
  99. package/src/components/mobile-search-view.stories.tsx +8 -11
  100. package/src/components/mobile-search-view.tsx +1 -1
  101. package/src/components/nav-sidebar.keyboard.test.ts +0 -8
  102. package/src/components/nav-sidebar.render.test.ts +2 -133
  103. package/src/components/new-folder-form.render.test.ts +0 -26
  104. package/src/components/outbox-row.render.test.ts +0 -9
  105. package/src/components/pane-layout.render.test.ts +0 -18
  106. package/src/components/plain-text-editor.mount.test.ts +0 -16
  107. package/src/components/popover-menu.render.test.ts +0 -11
  108. package/src/components/progress-bar.render.test.ts +0 -14
  109. package/src/components/quarantine-report.test.ts +0 -8
  110. package/src/components/quarantine-section.render.test.ts +16 -13
  111. package/src/components/quarantine-section.stories.tsx +11 -8
  112. package/src/components/reading-pane.render.test.ts +2 -106
  113. package/src/components/reading-pane.stories.tsx +3 -0
  114. package/src/components/refresh-button.render.test.ts +0 -9
  115. package/src/components/rescue-from-spam-flow.render.test.ts +0 -24
  116. package/src/components/rich-text-editor.mount.test.ts +0 -19
  117. package/src/components/rich-text-image-node.ts +11 -9
  118. package/src/components/role-appointment-list.render.test.ts +0 -49
  119. package/src/components/role-appointment-prompt.render.test.ts +0 -79
  120. package/src/components/row-actions.render.test.ts +0 -34
  121. package/src/components/search-bar.render.test.ts +0 -44
  122. package/src/components/search-chip-input.render.test.ts +0 -71
  123. package/src/components/search-conversion-notice.stories.tsx +0 -6
  124. package/src/components/search-conversion-notice.tsx +3 -9
  125. package/src/components/search-conversion.render.test.ts +0 -52
  126. package/src/components/search-conversion.ts +2 -18
  127. package/src/components/search-result-row.tsx +5 -26
  128. package/src/components/search-results.render.test.ts +0 -68
  129. package/src/components/search-results.stories.tsx +0 -30
  130. package/src/components/search-results.tsx +1 -1
  131. package/src/components/security-select.render.test.ts +1 -14
  132. package/src/components/selection-top-bar.render.test.ts +0 -180
  133. package/src/components/selection-wizard-fixtures.ts +0 -2
  134. package/src/components/selection-wizard.render.test.ts +7 -212
  135. package/src/components/selection-wizard.stories.tsx +24 -164
  136. package/src/components/selection-wizard.tsx +10 -86
  137. package/src/components/self-update.render.test.ts +0 -113
  138. package/src/components/sender-trust-indicator.render.test.ts +0 -30
  139. package/src/components/shell-top-bar.render.test.ts +0 -31
  140. package/src/components/shell-top-bar.stories.tsx +7 -0
  141. package/src/components/shell-top-bar.tsx +11 -2
  142. package/src/components/slide-panel.render.test.ts +0 -18
  143. package/src/components/suggest-list.render.test.ts +0 -6
  144. package/src/components/swipeable-row.gesture.test.ts +0 -15
  145. package/src/components/swipeable-row.render.test.ts +0 -7
  146. package/src/components/sync-warning-fixtures.ts +22 -0
  147. package/src/components/sync-warning-report.ts +38 -0
  148. package/src/components/sync-warning-row.tsx +51 -0
  149. package/src/components/sync-warning-section.render.test.ts +19 -0
  150. package/src/components/sync-warning-section.stories.tsx +94 -0
  151. package/src/components/sync-warning-section.tsx +56 -0
  152. package/src/components/touch-list-body.render.test.ts +0 -29
  153. package/src/components/wizard.render.test.ts +0 -22
  154. package/src/filter-presets.test.ts +1 -107
  155. package/src/index.ts +40 -30
  156. package/src/lib/compose-language.test.ts +0 -11
  157. package/src/lib/email-render-treatment.test.ts +0 -21
  158. package/src/lib/keymap.test.ts +0 -32
  159. package/src/lib/property-prefill.ts +2 -2
  160. package/src/lib/search-rule.test.ts +0 -4
  161. package/src/lib/search-rule.ts +0 -9
  162. package/src/lib/sender-derivation.ts +3 -5
  163. package/src/lib/use-list-cursor.test.ts +0 -7
  164. package/src/lib/use-list-keyboard.test.ts +0 -14
  165. package/src/lib/use-modal-focus.test.ts +0 -20
  166. package/src/lib/use-selection.hook.test.ts +0 -13
  167. package/src/lib/use-selection.test.ts +0 -101
  168. package/src/lib/wizard-steps.test.ts +18 -79
  169. package/src/lib/wizard-steps.ts +27 -67
  170. package/src/mcp-pages.ts +36 -0
  171. package/src/category-presentation.test.ts +0 -76
  172. package/src/components/account-service-status.render.test.ts +0 -82
  173. package/src/components/app-password-hint.render.test.ts +0 -23
  174. package/src/components/app-top-bar.render.test.ts +0 -59
  175. package/src/components/auth-card.render.test.ts +0 -24
  176. package/src/components/auth-footer.render.test.ts +0 -17
  177. package/src/components/auth-hero.render.test.ts +0 -31
  178. package/src/components/auto-moved-badge.render.test.ts +0 -65
  179. package/src/components/button.render.test.ts +0 -29
  180. package/src/components/calendar-event-chip.render.test.ts +0 -67
  181. package/src/components/calendar-parse-badge.render.test.ts +0 -40
  182. package/src/components/checkbox.render.test.ts +0 -65
  183. package/src/components/compose-form-shell.render.test.ts +0 -106
  184. package/src/components/dialog.render.test.ts +0 -51
  185. package/src/components/field-label.render.test.ts +0 -16
  186. package/src/components/mail-action-toolbar.render.test.ts +0 -43
  187. package/src/components/nav-link-surface.render.test.ts +0 -126
  188. package/src/components/new-folder-action.render.test.ts +0 -44
  189. package/src/components/pane-header.render.test.ts +0 -22
  190. package/src/components/pull-to-refresh.render.test.ts +0 -46
  191. package/src/components/recurrence-scope-prompt.render.test.ts +0 -36
  192. package/src/components/rescue-banner.render.test.ts +0 -32
  193. package/src/components/rescue-candidate-row.render.test.ts +0 -68
  194. package/src/components/search-token-chip.render.test.ts +0 -42
  195. package/src/components/self-update-dot.tsx +0 -32
  196. package/src/components/settings-primitives.render.test.ts +0 -160
  197. package/src/lib/email-layout-clamp.test.ts +0 -139
  198. package/src/lib/label-color.test.ts +0 -25
  199. package/src/lib/semantic-off.ts +0 -20
  200. package/src/stories-viewport-globals.test.ts +0 -77
@@ -1,4 +1,4 @@
1
- import { Plus, Sparkles, X } from "lucide-react";
1
+ import { Plus, X } from "lucide-react";
2
2
  import { cn } from "../lib/cn.js";
3
3
  import { useSuggestList } from "../lib/use-suggest-list.js";
4
4
  import { Button } from "./button.js";
@@ -8,8 +8,6 @@ import {
8
8
  clauseFieldLabel,
9
9
  clauseFieldOrder,
10
10
  type RuleClause,
11
- type RuleWiden,
12
- widenChipLabel,
13
11
  } from "./filter-rule.js";
14
12
  import { Input } from "./input.js";
15
13
  import { Select } from "./select.js";
@@ -62,63 +60,6 @@ export function ClauseChip({ clause, onEdit, onRemove }: ClauseChipProps) {
62
60
  );
63
61
  }
64
62
 
65
- export interface WidenChipProps {
66
- widen: RuleWiden;
67
- onRemove?: () => void;
68
- }
69
-
70
- function WidenRemoveButton({ onRemove }: { onRemove: () => void }) {
71
- return (
72
- <button
73
- type="button"
74
- onClick={onRemove}
75
- aria-label="Remove the similar-mail widen"
76
- className="flex size-4 items-center justify-center rounded-full hover:bg-fg-subtle/20"
77
- >
78
- <X className="size-3" />
79
- </button>
80
- );
81
- }
82
-
83
- /**
84
- * The semantic widen as one chip (RFC 038 D3). Active it reads "…and anything
85
- * similar" with the anchor count; inactive it says the deployment cannot
86
- * evaluate it and the rule matches by its literal clauses only (D4). Either
87
- * way it is removable like any other chip — a dead anchor is exactly what a
88
- * user needs to be able to take off a degraded rule.
89
- */
90
- export function WidenChip({ widen, onRemove }: WidenChipProps) {
91
- if (widen.inactive) {
92
- return (
93
- <span
94
- className={cn(
95
- chipShell,
96
- "border-dashed border-line-strong bg-surface-sunken text-fg-subtle",
97
- )}
98
- >
99
- <Sparkles className="size-3 shrink-0" aria-hidden="true" />
100
- <span className="line-through">{widenChipLabel(widen)}</span>
101
- <span className="text-2xs">not available here</span>
102
- {onRemove && <WidenRemoveButton onRemove={onRemove} />}
103
- </span>
104
- );
105
- }
106
-
107
- return (
108
- <span
109
- className={cn(
110
- chipShell,
111
- "border-accent-2 bg-accent-2-soft text-accent-2",
112
- )}
113
- >
114
- <Sparkles className="size-3 shrink-0" aria-hidden="true" />
115
- <span className="font-medium">…and anything similar</span>
116
- <span className="text-2xs opacity-80">{widenChipLabel(widen)}</span>
117
- {onRemove && <WidenRemoveButton onRemove={onRemove} />}
118
- </span>
119
- );
120
- }
121
-
122
63
  export interface AddChipButtonProps {
123
64
  label: string;
124
65
  onClick?: () => void;
@@ -258,12 +258,6 @@ describe("FilterRuleEditor move destination", () => {
258
258
  assert.equal(byText("Move matches to W / o / r / k"), undefined);
259
259
  });
260
260
 
261
- it("offers no create affordance without onCreateFolder", async () => {
262
- await mount();
263
- await openTree();
264
- assert.equal(byAriaLabel("New folder"), null);
265
- });
266
-
267
261
  it("creates a folder inside another and makes it the destination", async () => {
268
262
  const created: { name: string; parentPath: string }[] = [];
269
263
  const picked: string[] = [];
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from "@storybook/react-vite";
2
2
  import { useMemo, useState } from "react";
3
- import { ClauseChip, ClauseEditor, WidenChip } from "./filter-clause-chip.js";
3
+ import { ClauseChip, ClauseEditor } from "./filter-clause-chip.js";
4
4
  import { FilterPreviewCount } from "./filter-preview-count.js";
5
5
  import {
6
6
  type ClauseField,
@@ -16,7 +16,6 @@ import {
16
16
  type LabelOption,
17
17
  type PreviewCount,
18
18
  type RuleClause,
19
- type RuleMatchMode,
20
19
  } from "./filter-rule.js";
21
20
  import {
22
21
  type ClauseEditState,
@@ -55,9 +54,6 @@ const READY = (count: number, stale?: boolean): PreviewCount => ({
55
54
  */
56
55
  function LiveEditor({
57
56
  initialRule,
58
- semanticAvailable = true,
59
- initialMatchMode,
60
- propertyRule,
61
57
  labels = demoLabels,
62
58
  initialClauseEdit,
63
59
  folders = demoFolders,
@@ -69,14 +65,8 @@ function LiveEditor({
69
65
  folders?: FolderTreeNode[];
70
66
  /** The provider's hierarchy separator; `""` is a flat namespace. */
71
67
  delimiter?: string;
72
- semanticAvailable?: boolean;
73
- /** Offers the match-mode control; omit to render the editor without one. */
74
- initialMatchMode?: RuleMatchMode;
75
68
  /** Opens on the clause form, for the stories about editing a clause. */
76
69
  initialClauseEdit?: ClauseEditState;
77
- /** What the properties mode prefills — the app derives this from the
78
- * selection's senders and subjects. */
79
- propertyRule?: FilterRule;
80
70
  labels?: LabelOption[];
81
71
  onCreateFolder?: (
82
72
  name: string,
@@ -86,13 +76,12 @@ function LiveEditor({
86
76
  onCreateLabel?: (name: string) => Promise<LabelOption>;
87
77
  }) {
88
78
  const [rule, setRule] = useState<FilterRule>(initialRule);
89
- const [matchMode, setMatchMode] = useState(initialMatchMode);
90
79
  const [clauseEdit, setClauseEdit] = useState<ClauseEditState | undefined>(
91
80
  initialClauseEdit,
92
81
  );
93
82
 
94
83
  const preview = useMemo<PreviewCount>(
95
- () => READY(rule.clauses.length * 23 + (rule.widen ? 40 : 0)),
84
+ () => READY(rule.clauses.length * 23),
96
85
  [rule],
97
86
  );
98
87
 
@@ -143,35 +132,9 @@ function LiveEditor({
143
132
  });
144
133
  },
145
134
  onCancelClause: () => setClauseEdit(undefined),
146
- onAddWiden: () => {
147
- setRule((r) => ({ ...r, widen: { anchorCount: 2 } }));
148
- },
149
- onRemoveWiden: () => {
150
- setRule((r) => ({ ...r, widen: undefined }));
151
- },
152
135
  onChangeMatchOperator: (matchOperator) => {
153
136
  setRule((r) => ({ ...r, matchOperator }));
154
137
  },
155
- onChangeMatchMode: (mode) => {
156
- setMatchMode(mode);
157
- // The app rebuilds only the matchers, keeping the action and scope; the
158
- // story does the same with its two fixture rules.
159
- setRule((r) =>
160
- mode === "properties"
161
- ? {
162
- ...r,
163
- clauses: (propertyRule ?? demoSenderFallbackRule).clauses,
164
- matchOperator: "any",
165
- widen: undefined,
166
- }
167
- : {
168
- ...r,
169
- clauses: initialRule.clauses,
170
- matchOperator: initialRule.matchOperator,
171
- widen: initialRule.widen ?? { anchorCount: 2 },
172
- },
173
- );
174
- },
175
138
  onChangeMove: (moveMailboxId) =>
176
139
  setRule((r) => ({ ...r, moveMailboxId: moveMailboxId || undefined })),
177
140
  onChangeLabel: (labelId) =>
@@ -188,8 +151,6 @@ function LiveEditor({
188
151
  delimiter={delimiter}
189
152
  labels={labels}
190
153
  preview={preview}
191
- semanticAvailable={semanticAvailable}
192
- matchMode={matchMode}
193
154
  clauseEdit={clauseEdit}
194
155
  clauseSuggestions={
195
156
  clauseEdit
@@ -213,26 +174,7 @@ export const Interactive: Story = {
213
174
  render: () => <LiveEditor initialRule={demoRule} />,
214
175
  };
215
176
 
216
- /**
217
- * The Organize surface, where the rule can be matched either way. It opens on
218
- * "Anything similar" — semantic is still the default — and switching to
219
- * "Its properties" drops the widen for the clauses derived from the messages
220
- * that were selected. Switch back and the widen returns.
221
- */
222
- export const MatchModeSemanticDefault: Story = {
223
- render: () => (
224
- <LiveEditor
225
- initialRule={{ ...demoRule, clauses: [] }}
226
- initialMatchMode="similar"
227
- propertyRule={demoSenderFallbackRule}
228
- />
229
- ),
230
- };
231
-
232
- /**
233
- * Properties matching with one sender behind the whole selection — a single
234
- * `From` chip, no semantics involved. Editable like any other chip.
235
- */
177
+ /** One sender behind the whole selection — a single `From` chip, editable like any other. */
236
178
  export const MatchOnSenderProperty: Story = {
237
179
  render: () => (
238
180
  <LiveEditor
@@ -242,24 +184,16 @@ export const MatchOnSenderProperty: Story = {
242
184
  scope: "once",
243
185
  name: "",
244
186
  }}
245
- initialMatchMode="properties"
246
- propertyRule={demoSenderFallbackRule}
247
187
  />
248
188
  ),
249
189
  };
250
190
 
251
191
  /**
252
- * Properties matching when the senders differ: the prefill falls back to the
253
- * part the selected subjects share, so the rule still starts somewhere useful.
192
+ * When the senders differ, the prefill falls back to the part the selected
193
+ * subjects share, so the rule still starts somewhere useful.
254
194
  */
255
195
  export const MatchOnSubjectProperty: Story = {
256
- render: () => (
257
- <LiveEditor
258
- initialRule={demoSubjectPrefillRule}
259
- initialMatchMode="properties"
260
- propertyRule={demoSubjectPrefillRule}
261
- />
262
- ),
196
+ render: () => <LiveEditor initialRule={demoSubjectPrefillRule} />,
263
197
  };
264
198
 
265
199
  /**
@@ -271,8 +205,7 @@ export const MatchOnSubjectProperty: Story = {
271
205
  export const ClauseValueSuggestions: Story = {
272
206
  render: () => (
273
207
  <LiveEditor
274
- initialRule={{ ...demoRule, widen: undefined }}
275
- semanticAvailable={false}
208
+ initialRule={demoRule}
276
209
  initialClauseEdit={{ mode: "add", draft: { field: "From", value: "" } }}
277
210
  />
278
211
  ),
@@ -285,8 +218,7 @@ export const ClauseValueSuggestions: Story = {
285
218
  export const DomainClauseSuggestions: Story = {
286
219
  render: () => (
287
220
  <LiveEditor
288
- initialRule={{ ...demoRule, widen: undefined }}
289
- semanticAvailable={false}
221
+ initialRule={demoRule}
290
222
  initialClauseEdit={{
291
223
  mode: "add",
292
224
  draft: { field: "FromDomain", value: "" },
@@ -303,8 +235,7 @@ export const DomainClauseSuggestions: Story = {
303
235
  export const ClauseValueNoMatches: Story = {
304
236
  render: () => (
305
237
  <LiveEditor
306
- initialRule={{ ...demoRule, widen: undefined }}
307
- semanticAvailable={false}
238
+ initialRule={demoRule}
308
239
  initialClauseEdit={{
309
240
  mode: "add",
310
241
  draft: { field: "From", value: "someone@nowhere.test" },
@@ -320,8 +251,7 @@ export const ClauseValueNoMatches: Story = {
320
251
  export const SubjectClauseStaysFreeText: Story = {
321
252
  render: () => (
322
253
  <LiveEditor
323
- initialRule={{ ...demoRule, widen: undefined }}
324
- semanticAvailable={false}
254
+ initialRule={demoRule}
325
255
  initialClauseEdit={{
326
256
  mode: "add",
327
257
  draft: { field: "Subject", value: "receipt" },
@@ -725,7 +655,7 @@ export const AnyOfTheseClauses: Story = {
725
655
  render: () => <LiveEditor initialRule={demoVocabularyRule} />,
726
656
  };
727
657
 
728
- /** A one-time rule — no name, no widen, the commit reads "Apply now". */
658
+ /** A one-time rule — no name, the commit reads "Apply now". */
729
659
  export const OneTimeMove: Story = {
730
660
  args: {
731
661
  rule: {
@@ -739,13 +669,12 @@ export const OneTimeMove: Story = {
739
669
  },
740
670
  };
741
671
 
742
- /** Standing scope with a widen — the "keep doing this" rule. */
743
- export const StandingWithWiden: Story = {
672
+ /** Standing scope — the "keep doing this" rule. */
673
+ export const Standing: Story = {
744
674
  args: {
745
675
  rule: demoRule,
746
676
  folders: demoFolders,
747
677
  preview: READY(47),
748
- semanticAvailable: true,
749
678
  },
750
679
  };
751
680
 
@@ -760,57 +689,24 @@ export const UntilADate: Story = {
760
689
  },
761
690
  folders: demoFolders,
762
691
  preview: READY(31),
763
- semanticAvailable: true,
764
692
  },
765
693
  };
766
694
 
767
695
  /**
768
- * The sender-fallback (#251) as chips: the derived From clauses are ordinary
769
- * visible, editable chips, not an invisible substitution.
696
+ * Clauses derived from the selection (#251) as chips: ordinary visible,
697
+ * editable chips, not an invisible substitution.
770
698
  */
771
- export const SenderFallbackChips: Story = {
772
- render: () => (
773
- <LiveEditor
774
- initialRule={demoSenderFallbackRule}
775
- semanticAvailable={false}
776
- />
777
- ),
778
- };
779
-
780
- /**
781
- * The deployment cannot serve the widen (RFC 038 D4): the "…and similar" add is
782
- * not offered and the rule matches by its literal clauses only.
783
- */
784
- export const SemanticUnavailable: Story = {
785
- args: {
786
- rule: { ...demoRule, widen: undefined },
787
- folders: demoFolders,
788
- preview: READY(24),
789
- semanticAvailable: false,
790
- },
791
- };
792
-
793
- /**
794
- * A standing rule that carries an anchor this deployment cannot evaluate — the
795
- * widen chip lists as inactive and nothing claims similarity is running.
796
- */
797
- export const DegradedStandingWiden: Story = {
798
- args: {
799
- rule: { ...demoRule, widen: { anchorCount: 2, inactive: true } },
800
- folders: demoFolders,
801
- preview: READY(19),
802
- semanticAvailable: false,
803
- },
699
+ export const DerivedSenderChips: Story = {
700
+ render: () => <LiveEditor initialRule={demoSenderFallbackRule} />,
804
701
  };
805
702
 
806
703
  /**
807
- * Editing a persisted filter (RFC 038 D6, reader #266): scope and expiry stay
808
- * live and editable — a standing filter can move to "until a date" and back,
809
- * or its date can change. The semantic anchor is the one thing fixed at
810
- * creation: the widen chip renders display-only with a one-line note, and
811
- * "Just once" drops out of the scope toggle since no saved filter can hold it.
704
+ * Editing a persisted filter (reader #266): scope and expiry stay live and
705
+ * editable — a standing filter can move to "until a date" and back, or its date
706
+ * can change. "Just once" drops out of the scope toggle since no saved filter
707
+ * can hold it.
812
708
  */
813
- export const AnchorLocked: Story = {
709
+ export const Persisted: Story = {
814
710
  args: {
815
711
  rule: {
816
712
  ...demoRule,
@@ -820,8 +716,7 @@ export const AnchorLocked: Story = {
820
716
  },
821
717
  folders: demoFolders,
822
718
  preview: READY(31),
823
- semanticAvailable: false,
824
- anchorLocked: true,
719
+ persisted: true,
825
720
  },
826
721
  };
827
722
 
@@ -835,7 +730,6 @@ export const BlockedEmpty: Story = {
835
730
  },
836
731
  folders: demoFolders,
837
732
  preview: READY(0),
838
- semanticAvailable: true,
839
733
  },
840
734
  };
841
735
 
@@ -845,7 +739,6 @@ export const PreviewLoading: Story = {
845
739
  rule: demoRule,
846
740
  folders: demoFolders,
847
741
  preview: { status: "loading" },
848
- semanticAvailable: true,
849
742
  },
850
743
  };
851
744
 
@@ -859,7 +752,6 @@ export const PreviewStale: Story = {
859
752
  rule: demoRule,
860
753
  folders: demoFolders,
861
754
  preview: READY(47, true),
862
- semanticAvailable: true,
863
755
  },
864
756
  };
865
757
 
@@ -869,13 +761,12 @@ export const PreviewError: Story = {
869
761
  rule: demoRule,
870
762
  folders: demoFolders,
871
763
  preview: { status: "error", reason: "Couldn't reach the server to count." },
872
- semanticAvailable: true,
873
764
  },
874
765
  };
875
766
 
876
767
  type ChipStory = StoryObj;
877
768
 
878
- /** Every clause and widen chip in isolation, including edit and inactive states. */
769
+ /** Every clause chip in isolation, including the edit state. */
879
770
  export const ChipGallery: ChipStory = {
880
771
  render: () => {
881
772
  const fields: ClauseField[] = [
@@ -908,8 +799,6 @@ export const ChipGallery: ChipStory = {
908
799
  onEdit={() => {}}
909
800
  onRemove={() => {}}
910
801
  />
911
- <WidenChip widen={{ anchorCount: 2 }} onRemove={() => {}} />
912
- <WidenChip widen={{ anchorCount: 2, inactive: true }} />
913
802
  </div>
914
803
  <ClauseEditor
915
804
  draft={{ field: "ListId", value: "python-dev.python.org" }}
@@ -922,9 +811,6 @@ export const ChipGallery: ChipStory = {
922
811
  <div className="space-y-2">
923
812
  <FilterPreviewCount preview={{ status: "loading" }} />
924
813
  <FilterPreviewCount preview={READY(0)} />
925
- <FilterPreviewCount
926
- preview={{ status: "ready", count: 0, indexEmpty: true }}
927
- />
928
814
  <FilterPreviewCount preview={READY(412)} />
929
815
  <FilterPreviewCount preview={READY(47, true)} />
930
816
  <FilterPreviewCount
@@ -6,7 +6,6 @@ import {
6
6
  ClauseChip,
7
7
  type ClauseDraft,
8
8
  ClauseEditor,
9
- WidenChip,
10
9
  } from "./filter-clause-chip.js";
11
10
  import { FilterPreviewCount } from "./filter-preview-count.js";
12
11
  import {
@@ -17,11 +16,8 @@ import {
17
16
  type LabelOption,
18
17
  type MatchOperator,
19
18
  matchJoinWord,
20
- matchModeHint,
21
- matchModeLabel,
22
19
  matchOperatorLabel,
23
20
  type PreviewCount,
24
- type RuleMatchMode,
25
21
  type RuleScope,
26
22
  } from "./filter-rule.js";
27
23
  import { FolderTreePicker } from "./folder-tree-picker.js";
@@ -53,20 +49,6 @@ export interface FilterRuleEditorProps {
53
49
  * cannot. Absent on the Organize surface, which converts nothing.
54
50
  */
55
51
  notice?: ReactNode;
56
- /**
57
- * Whether the deployment can serve the semantic widen (RFC 038 D4). When
58
- * false the "…and anything similar" chip is never offered — an already-present
59
- * widen still renders, marked inactive.
60
- */
61
- semanticAvailable?: boolean;
62
- /**
63
- * What the rule matches on, when the surface lets the user choose (RFC 038
64
- * D2/D3). Present only where both modes are reachable — the Organize flow on
65
- * a deployment that can serve the widen. Absent leaves the mode control off
66
- * entirely, which is every other entry point onto this editor.
67
- */
68
- matchMode?: RuleMatchMode;
69
- onChangeMatchMode?: (mode: RuleMatchMode) => void;
70
52
  /**
71
53
  * The clause fields the add/edit picker offers, in menu order. Defaults to the
72
54
  * whole vocabulary; a consumer narrows it to the fields its deployment can
@@ -74,20 +56,11 @@ export interface FilterRuleEditorProps {
74
56
  */
75
57
  clauseFields?: ClauseField[];
76
58
  /**
77
- * Whether the semantic anchor is fixed and cannot be added, removed, or
78
- * repointed (RFC 038 D6, reader #266). True for an existing, persisted
79
- * filter — the update endpoint carries no anchor field at all, so
80
- * repointing one would silently change what a saved filter matches with
81
- * nothing visible changing, and that deserves a new filter instead. The
82
- * widen chip renders display-only (no remove affordance regardless of
83
- * `onRemoveWiden`) and carries a one-line note explaining why.
84
- *
85
- * Scope and expiry are NOT covered by this flag — they stay editable even
86
- * on an existing filter (reader #266). The only other thing this locks is
87
- * the "Just once" scope option, meaningless for an already-persisted
88
- * filter, which is dropped from the scope toggle.
59
+ * The rule is an existing, persisted filter (reader #266). "Just once" is
60
+ * meaningless for it, so the scope toggle drops that option; scope and
61
+ * expiry otherwise stay editable.
89
62
  */
90
- anchorLocked?: boolean;
63
+ persisted?: boolean;
91
64
  /**
92
65
  * Values worth offering for the clause being edited — the consumer derives
93
66
  * them from the field and what has been typed so far (known senders for
@@ -104,8 +77,6 @@ export interface FilterRuleEditorProps {
104
77
  onChangeDraftValue?: (value: string) => void;
105
78
  onSubmitClause?: () => void;
106
79
  onCancelClause?: () => void;
107
- onAddWiden?: () => void;
108
- onRemoveWiden?: () => void;
109
80
  onChangeMatchOperator?: (operator: MatchOperator) => void;
110
81
  onChangeMove?: (mailboxId: string) => void;
111
82
  /**
@@ -141,11 +112,6 @@ const matchOptions: { value: MatchOperator; label: string }[] = [
141
112
  { value: "any", label: matchOperatorLabel("any") },
142
113
  ];
143
114
 
144
- const matchModeOptions: { value: RuleMatchMode; label: string }[] = [
145
- { value: "similar", label: matchModeLabel("similar") },
146
- { value: "properties", label: matchModeLabel("properties") },
147
- ];
148
-
149
115
  const scopeOptions: { value: RuleScope; label: string }[] = [
150
116
  { value: "once", label: "Just once" },
151
117
  { value: "standing", label: "Keep doing this" },
@@ -454,11 +420,8 @@ export function FilterRuleEditor({
454
420
  labels = [],
455
421
  preview,
456
422
  notice,
457
- semanticAvailable = false,
458
- matchMode,
459
- onChangeMatchMode,
460
423
  clauseFields,
461
- anchorLocked = false,
424
+ persisted = false,
462
425
  clauseSuggestions,
463
426
  clauseEdit,
464
427
  onStartAddClause,
@@ -468,8 +431,6 @@ export function FilterRuleEditor({
468
431
  onChangeDraftValue,
469
432
  onSubmitClause,
470
433
  onCancelClause,
471
- onAddWiden,
472
- onRemoveWiden,
473
434
  onChangeMatchOperator,
474
435
  onChangeMove,
475
436
  onCreateFolder,
@@ -481,16 +442,14 @@ export function FilterRuleEditor({
481
442
  onCommit,
482
443
  onCancel,
483
444
  }: FilterRuleEditorProps) {
484
- const activeWiden = rule.widen && !rule.widen.inactive ? 1 : 0;
485
- const matcherCount = rule.clauses.length + activeWiden;
486
- const showOperator = matcherCount >= 2;
445
+ const showOperator = rule.clauses.length >= 2;
487
446
  const join = matchJoinWord(rule.matchOperator);
488
447
  const blockedReason = commitBlockedReason(rule, preview);
489
448
  const needsName = rule.scope === "standing" || rule.scope === "until";
490
449
  // A persisted filter is always Standing or Temporary — "once" was never a
491
450
  // scope a saved row could hold, so an existing filter's editor never offers
492
451
  // it (reader #266).
493
- const availableScopeOptions = anchorLocked
452
+ const availableScopeOptions = persisted
494
453
  ? scopeOptions.filter((option) => option.value !== "once")
495
454
  : scopeOptions;
496
455
 
@@ -506,23 +465,6 @@ export function FilterRuleEditor({
506
465
  <div className="min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4">
507
466
  {notice}
508
467
 
509
- {matchMode && (
510
- <section className="space-y-1.5">
511
- <p className="text-xs font-medium text-fg-muted">Match on</p>
512
- <SegmentedControl
513
- name="rule-match-mode"
514
- size="sm"
515
- aria-label="What the rule matches on"
516
- options={matchModeOptions}
517
- value={matchMode}
518
- onChange={(value) => onChangeMatchMode?.(value)}
519
- />
520
- <p className="text-2xs text-fg-subtle">
521
- {matchModeHint(matchMode)}
522
- </p>
523
- </section>
524
- )}
525
-
526
468
  <section className="space-y-3">
527
469
  <div className="flex flex-wrap items-center gap-1.5">
528
470
  {rule.clauses.map((clause, index) => (
@@ -540,30 +482,9 @@ export function FilterRuleEditor({
540
482
  </Fragment>
541
483
  ))}
542
484
 
543
- {rule.widen && (
544
- <>
545
- {rule.clauses.length > 0 && !rule.widen.inactive && (
546
- <span className="text-2xs font-medium uppercase text-fg-subtle">
547
- {join}
548
- </span>
549
- )}
550
- <WidenChip
551
- widen={rule.widen}
552
- onRemove={anchorLocked ? undefined : onRemoveWiden}
553
- />
554
- </>
555
- )}
556
-
557
485
  {!clauseEdit && (
558
486
  <AddChipButton label="Add clause" onClick={onStartAddClause} />
559
487
  )}
560
- {!rule.widen &&
561
- !anchorLocked &&
562
- semanticAvailable &&
563
- matchMode !== "properties" &&
564
- !clauseEdit && (
565
- <AddChipButton label="…and similar" onClick={onAddWiden} />
566
- )}
567
488
  </div>
568
489
 
569
490
  {clauseEdit && (
@@ -579,13 +500,6 @@ export function FilterRuleEditor({
579
500
  />
580
501
  )}
581
502
 
582
- {anchorLocked && rule.widen && (
583
- <p className="text-2xs text-fg-subtle">
584
- This filter's similar-mail match is fixed to the message it was
585
- created from — create a new filter to change it.
586
- </p>
587
- )}
588
-
589
503
  {showOperator && (
590
504
  <div className="flex items-center gap-2">
591
505
  <span className="text-xs text-fg-muted">Match</span>