create-heresay 0.2.50 → 0.2.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-heresay",
3
- "version": "0.2.50",
3
+ "version": "0.2.52",
4
4
  "description": "Set up your own Heresay: in-app feedback that every report gets a hearing. Creates a Firebase project in your Google account and deploys the dashboard, API and SDK to it.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/release/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.50
1
+ 0.2.52
@@ -1,3 +1,3 @@
1
1
  /** The Heresay release. Bumped by the release script; the CLI and /v1/health report it. */
2
- export const VERSION = '0.2.50';
2
+ export const VERSION = '0.2.52';
3
3
  //# sourceMappingURL=version.js.map
@@ -591,7 +591,12 @@
591
591
  { a: 'thanks', label: 'Thank-you line after sending', c: [['', 'None']], text: 'e.g. Thanks! We read every one.', max: 160 },
592
592
  ]},
593
593
  { group: 'The panel', items: [
594
- { a: 'panel', label: 'Where it opens', c: [['', 'Next to the button'], ['sheet', 'Side sheet'], ['center', 'Middle of the screen']], hint: 'The bar layout ignores this; its Your reports view opens next to the button.' },
594
+ { a: 'panel', label: 'Where it opens', c: [['', 'Next to the button'], ['sheet', 'Side sheet'], ['center', 'Middle of the screen']], hint: 'The bar layout ignores this; its Your reports view opens next to the button.',
595
+ when: function (c) { return c.button !== 'none'; } },
596
+ // Only for an app's own button. Not a tag attribute of its own: "beside" becomes data-panel="beside".
597
+ { a: 'opens', virtual: true, label: 'Opens', c: [['', 'Centred (recommended)'], ['beside', 'Next to your button']],
598
+ hint: 'From your own button the panel opens as a centred window with the page dimmed (the bar layout docks at the bottom centre). Next to your button puts it beside the button that was clicked.',
599
+ when: function (c) { return c.button === 'none'; } },
595
600
  { a: 'width', label: 'Width', c: [['', 'Regular'], ['narrow', 'Narrow'], ['wide', 'Wide']] },
596
601
  { a: 'backdrop', label: 'Behind it', c: [['', 'Dim the page'], ['clear', 'Leave the page clear'], ['blur', 'Blur']] },
597
602
  { a: 'preferences', label: 'Name and email row', c: [['', 'Show'], ['hide', 'Hide']], hint: 'Hide it if your app calls identify() and asks nothing else.' },
@@ -606,11 +611,11 @@
606
611
  function designAttrs(cfg) {
607
612
  var c = Object.assign({}, cfg);
608
613
  // One attribute says where the button goes: the tab and "no button" cases fold into data-position.
609
- if (c.button === 'none') { c.position = 'none'; c.button = ''; c.style = ''; }
614
+ if (c.button === 'none') { c.position = 'none'; c.button = ''; c.style = ''; c.panel = c.opens === 'beside' ? 'beside' : ''; }
610
615
  else if (c.style === 'tab' && (!c.position || /^bottom-(left|right|center)$/.test(c.position))) {
611
616
  c.position = c.position === 'bottom-left' ? 'left-tab' : 'right-tab'; c.style = '';
612
617
  }
613
- return DESIGN_ITEMS.filter(function (it) { return c[it.a]; }).map(function (it) { return ['data-' + it.a, c[it.a]]; });
618
+ return DESIGN_ITEMS.filter(function (it) { return !it.virtual && c[it.a]; }).map(function (it) { return ['data-' + it.a, c[it.a]]; });
614
619
  }
615
620
 
616
621
  function designTag(p, cfg) {
@@ -660,6 +665,8 @@
660
665
  if (cfg.button === 'none') {
661
666
  out.push(el('p', { class: 'hint', text: 'Then open it from your own menu item:' }));
662
667
  out.push(codeBlock('window.Heresay?.open();'));
668
+ out.push(el('p', { class: 'hint', text: 'Add our mark to your button, so people recognise it from app to app:' }));
669
+ out.push(codeBlock('<button data-heresay-open><span data-heresay-mark></span> Report a problem</button>'));
663
670
  }
664
671
  return out;
665
672
  },
@@ -669,7 +676,10 @@
669
676
  'Keep it where it is and keep the framework\'s own way of writing it (for example next/script in Next.js). ' +
670
677
  'Remove any other design attributes it has (data-layout, data-position, data-offset, data-button, data-label, data-style, data-size, data-fill, data-shadow, data-hide-on, data-accent, data-mark, data-theme, data-font, data-lang, data-placeholder, data-types, data-thanks, data-panel, data-width, data-backdrop, data-preferences, data-intro); keep data-key, data-version and anything about the signed-in user.\n\n' +
671
678
  designTag(p, cfg) + '\n' +
672
- (cfg.button === 'none' ? '\nThere is no floating button now, so add a "Send feedback" item to the app\'s own help or account menu that calls window.Heresay?.open().\n' : '') +
679
+ (cfg.button === 'none' ? '\nThere is no floating button now, so add a "Send feedback" item to the app\'s own help or account menu that calls window.Heresay?.open(). ' +
680
+ (cfg.opens === 'beside'
681
+ ? 'It opens next to that item (data-panel="beside").'
682
+ : 'It opens as a centred window with the page dimmed; that is the default, so there is no data-panel attribute. Add data-panel="beside" only if it should open next to the item.') + '\n' : '') +
673
683
  (a.some(function (x) { return x[0] === 'data-intro'; }) ? '' : '\nIf the app doesn\'t call window.Heresay?.introduce() yet, call it once the main screen appears.\n') +
674
684
  '\nFor what each option does, read the Heresay guide customize-web (heresay_guide, or npx -y heresay@latest guide customize-web).';
675
685
  },
@@ -700,8 +710,10 @@
700
710
  var changed = el('span', { class: 'hint' });
701
711
 
702
712
  function save() { try { localStorage.setItem(KEY, JSON.stringify(cfg)); } catch (e) { /* private mode */ } }
713
+ var whens = [];
703
714
  function redraw() {
704
715
  save();
716
+ whens.forEach(function (f) { f(); });
705
717
  preview.draw(cfg, show, dark);
706
718
  var n = kit.changes(cfg);
707
719
  changed.textContent = n ? n + ' change' + (n === 1 ? '' : 's') + ' from the recommended setup' : 'The recommended setup';
@@ -740,7 +752,9 @@
740
752
  };
741
753
  chips.appendChild(input);
742
754
  }
743
- controls.appendChild(el('div', { class: 'design-item' }, [el('b', { text: it.label }), chips, it.hint ? el('p', { class: 'hint', text: it.hint }) : null]));
755
+ var item = el('div', { class: 'design-item' }, [el('b', { text: it.label }), chips, it.hint ? el('p', { class: 'hint', text: it.hint }) : null]);
756
+ controls.appendChild(item);
757
+ if (it.when) whens.push(function () { item.hidden = !it.when(cfg); });
744
758
  sync();
745
759
  });
746
760
  });
@@ -869,8 +883,13 @@
869
883
  return { el: box, draw: function (cfg, show, dark) { box.innerHTML = appleMock(p, cfg, show, dark); fit(); } };
870
884
  },
871
885
  code: function (cfg) {
872
- return [el('p', { class: 'hint', text: 'In your App’s init():' }), codeBlock(swiftConfigure(p, cfg)),
886
+ var out = [el('p', { class: 'hint', text: 'In your App’s init():' }), codeBlock(swiftConfigure(p, cfg)),
873
887
  el('p', { class: 'hint', text: 'And on the root view:' }), codeBlock(swiftAttach(p, cfg))];
888
+ if (cfg.entry === 'none') {
889
+ out.push(el('p', { class: 'hint', text: 'Add our mark to your button, so people recognise it from app to app:' }));
890
+ out.push(codeBlock('Button { Heresay.present() } label: {\n Label { Text("Report a problem") } icon: { HeresayMarkIcon() }\n}'));
891
+ }
892
+ return out;
874
893
  },
875
894
  prompt: function (cfg) {
876
895
  return 'Update how Heresay is set up in this ' + (mac ? 'macOS' : 'iOS') + ' app (the Heresay.configure call with key "' + p.key + '") so it matches this. ' +
@@ -81,7 +81,7 @@
81
81
  <p>The defaults are what we recommend: change only what your app needs. The easiest way is the dashboard: open an app and choose <b>Design</b> to try each option on the real widget and copy the tag. The first value is the default.</p>
82
82
  <table><tr><th>Attribute</th><th>Values</th></tr>
83
83
  <tr><td><code>data-layout</code></td><td><code>composer</code> (default: type pills and a text box) · <code>steps</code> (pick what it is, then say it) · <code>bar</code> (a compact box beside the button). See <a href="#layouts">Layouts</a>.</td></tr>
84
- <tr><td><code>data-position</code></td><td><code>bottom-right</code> · <code>bottom-left</code> · <code>top-right</code> · <code>top-left</code> · <code>bottom-center</code> · <code>left-tab</code> · <code>right-tab</code> (a tab on the side edge) · <code>none</code> (no button: your own feedback or help menu item calls <code>Heresay.open()</code>)</td></tr>
84
+ <tr><td><code>data-position</code></td><td><code>bottom-right</code> · <code>bottom-left</code> · <code>top-right</code> · <code>top-left</code> · <code>bottom-center</code> · <code>left-tab</code> · <code>right-tab</code> (a tab on the side edge) · <code>none</code> (no button: put <code>data-heresay-open</code> on your own feedback or help menu item, or call <code>Heresay.open()</code>; the panel opens centred, or next to it with <code>data-panel="beside"</code>)</td></tr>
85
85
  <tr><td><code>data-offset</code></td><td><code>20</code> px from the edges, or <code>x,y</code> like <code>24,96</code> (at most 400), to sit above a chat bubble, cookie banner or tab bar</td></tr>
86
86
  <tr><td><code>data-hide-on</code></td><td>paths where the button stays hidden, like <code>/checkout,/login</code></td></tr>
87
87
  <tr><td><code>data-label</code></td><td><code>Report</code>, or your own words up to 40 characters</td></tr>
@@ -111,6 +111,8 @@
111
111
  <tr><td><code>Heresay.on("sent", fn)</code></td><td>Calls <code>fn({ id, type })</code> after each report is sent, to thank people or count it in your analytics. Returns a function that stops it.</td></tr>
112
112
  <tr><td><code>Heresay.introduce({ title, body })</code></td><td>Once per device, a small bubble over the button says what it's for, so people know it exists. Call it when your main screen is up (after sign-in or onboarding), or add <code>data-intro="auto"</code> to the tag. Later calls do nothing. <code>title</code> and <code>body</code> are optional, to use your own words.</td></tr>
113
113
  <tr><td><code>Heresay.nudge()</code></td><td>Your app saw trouble itself, such as an error screen or a retry that failed: a small note by the button offers to report it. <code>nudge({ stuck: true })</code> for someone who seems unsure. Works without <code>data-nudge</code>; the same limits apply. Returns whether it showed.</td></tr>
114
+ <tr><td><code>data-heresay-open</code></td><td>Put it on any element (<code>data-heresay-open="broken"</code> starts as that type) and a click opens the panel from it, with no JavaScript. By default (and recommended) that is a centred window with the page dimmed; the bar layout docks at the bottom centre. Add <code>data-panel="beside"</code> to the script tag to open it next to the element instead (<code>Heresay.open({ anchor: element })</code> does the same from code). Code with no click opens it centred; phones get a bottom sheet; <code>data-panel</code> sheet, center or corner wins. Clicking outside closes it and keeps the draft. In Swift, <code>Heresay.present()</code> from your own button opens a centred sheet; add <code>.heresayAnchor()</code> to that button for a popover next to it on iPad and Mac.</td></tr>
115
+ <tr><td><code>data-heresay-mark</code></td><td>Put it on an empty element inside your own button (<code>&lt;button data-heresay-open&gt;&lt;span data-heresay-mark&gt;&lt;/span&gt; Report a problem&lt;/button&gt;</code>) and it is filled with the Heresay mark, 1em square and hidden from screen readers, so the button is recognisable from app to app. It takes your <code>data-accent</code> (unless <code>data-mark="heresay"</code>); <code>data-heresay-mark="currentColor"</code> takes the text colour. Elements added later are filled too; elements without the attribute are never touched. In Swift, use <code>HeresayMarkIcon()</code> in a <code>Label</code>.</td></tr>
114
116
  <tr><td><code>Heresay.openPreferences()</code></td><td>Open Your reports with &ldquo;Your name and email&rdquo; expanded. People who aren't signed in can add a name and an email for replies. Both are optional and saved on their device.</td></tr>
115
117
  <tr><td><code>Heresay.close()</code></td><td>Close the panel.</td></tr></table>
116
118
  <p>Each report also carries the page it came from: its title, its address without the query string, and the window size.</p>
@@ -1,6 +1,103 @@
1
1
  {
2
- "about": "Features added to Heresay since apps were first installed. An agent in a connected repo checks these with whats_new, tells the person what's new, and asks before adding any. `detect` is what the code contains once a feature is in; `platforms` limits it to those apps; `sign_in` limits it to apps that answered that.",
2
+ "about": "Features added to Heresay since apps were first installed. An agent in a connected repo checks these with whats_new, tells the person what's new, and asks before adding any. `detect` is what the code contains once a feature is in; `platforms` limits it to those apps; `sign_in` limits it to apps that answered that. `when` (optional, strings, or an object keyed by web/swift): offer the feature only if the code contains any of them. `detect` may be keyed the same way. `offer`: recommended (offer on its own) or optional (offered only right after a version update that introduced it).",
3
3
  "changes": [
4
+ {
5
+ "id": "open-next-to-trigger",
6
+ "since": "0.2.51",
7
+ "offer": "optional",
8
+ "title": "Open the Report panel next to the app's own Report button (optional)",
9
+ "summary": "When the app opens Heresay from its own Report, Feedback or Help item, the panel opens as a centred window with the page dimmed. That is the recommended default, so most apps need nothing. If the person prefers it right beside that item, set data-panel=\"beside\" (web) or add .heresayAnchor() to the button (Swift). Ask: centred window (recommended) or next to your button?",
10
+ "platforms": [
11
+ "web",
12
+ "ios",
13
+ "macos"
14
+ ],
15
+ "when": {
16
+ "web": [
17
+ "data-position=\"none\"",
18
+ "data-position='none'",
19
+ "data-button=\"none\"",
20
+ "Heresay.open("
21
+ ],
22
+ "swift": [
23
+ "Heresay.present("
24
+ ]
25
+ },
26
+ "detect": {
27
+ "web": [
28
+ "data-heresay-open"
29
+ ],
30
+ "swift": [
31
+ "heresayAnchor"
32
+ ]
33
+ },
34
+ "how": {
35
+ "web": "guide customize-web, How it opens (data-panel=\"beside\" on the script tag)",
36
+ "ios": "guide customize-apple, Placement (.heresayAnchor())",
37
+ "macos": "guide customize-apple, Placement (.heresayAnchor())"
38
+ }
39
+ },
40
+ {
41
+ "id": "mark-in-own-button",
42
+ "since": "0.2.51",
43
+ "offer": "optional",
44
+ "title": "Put the Heresay mark in the app's own Report button (optional)",
45
+ "summary": "The app has its own Report, Feedback or Help button. Adding the Heresay mark to it (mark plus label, or a round mark-only button) makes it recognisable from app to app. Web: an empty <span data-heresay-mark></span> inside the button. Swift: HeresayMarkIcon() in a Label. Ask: add the mark to your button?",
46
+ "platforms": [
47
+ "web",
48
+ "ios",
49
+ "macos"
50
+ ],
51
+ "when": {
52
+ "web": [
53
+ "data-heresay-open",
54
+ "data-position=\"none\"",
55
+ "data-position='none'",
56
+ "Heresay.open("
57
+ ],
58
+ "swift": [
59
+ "Heresay.present("
60
+ ]
61
+ },
62
+ "detect": {
63
+ "web": [
64
+ "data-heresay-mark"
65
+ ],
66
+ "swift": [
67
+ "HeresayMark"
68
+ ]
69
+ },
70
+ "how": {
71
+ "web": "guide customize-web, The mark in your own button",
72
+ "ios": "guide customize-apple, The mark in your own button",
73
+ "macos": "guide customize-apple, The mark in your own button"
74
+ }
75
+ },
76
+ {
77
+ "id": "layouts",
78
+ "since": "0.2.50",
79
+ "offer": "optional",
80
+ "title": "Pick another Report panel layout",
81
+ "summary": "Three layouts exist: composer (type pills and a text box; the default and recommended for most apps), steps (guided rows; consumer apps) and bar (a compact floating bar; dense pro tools). Only worth changing if the app clearly fits another.",
82
+ "platforms": [
83
+ "web",
84
+ "ios",
85
+ "macos"
86
+ ],
87
+ "detect": {
88
+ "web": [
89
+ "data-layout"
90
+ ],
91
+ "swift": [
92
+ "layout:"
93
+ ]
94
+ },
95
+ "how": {
96
+ "web": "guide customize-web, Layout",
97
+ "ios": "guide customize-apple, Layout",
98
+ "macos": "guide customize-apple, Layout"
99
+ }
100
+ },
4
101
  {
5
102
  "id": "crash-reports",
6
103
  "since": "0.2.48",
@@ -69,16 +69,45 @@ and `.bottom` dock at the bottom, top ones at the top).
69
69
  macOS Help › Report a Problem… with `HeresayCommands`) every layout works the same. Every
70
70
  `position` works with every layout.
71
71
 
72
+ ## How it opens
73
+
74
+ | How it's opened | iPhone | iPad / Mac |
75
+ | --- | --- | --- |
76
+ | The floating button (`.heresayReportButton()`, any position) | bottom sheet (bar layout: docked bar) | popover beside the button |
77
+ | Your own button calling `Heresay.present()`, no `.heresayAnchor()` (recommended) | bottom sheet (bar layout: docked bar) | centred sheet on the window (iPad: form sheet) |
78
+ | Your own button with `.heresayAnchor()` (opt-in), which calls `Heresay.present()` | bottom sheet (bar layout: docked bar) | popover pointing at that button |
79
+ | `Heresay.present()` from code with no anchor (an error screen, say) | bottom sheet | sheet on the window (iPad: form sheet) |
80
+ | Mac menu bar Help › Report a Problem… / ⌥⌘R (`HeresayCommands`) | n/a | sheet on the key window |
81
+
82
+ Tapping or clicking outside a popover, or swiping down a sheet, closes it; what was typed and the
83
+ chosen type are kept for next time (cleared after sending). A Mac window sheet can't be closed by
84
+ clicking outside, so use Escape or the close button. The bar layout stays a docked bar everywhere.
85
+
72
86
  ## When to change what
73
87
 
74
88
  | The app has... | Do this |
75
89
  | --- | --- |
76
- | Its own feedback or help button | `.heresay()` instead of `.heresayReportButton()`; that button calls `Heresay.present()` |
90
+ | Its own feedback or help button | `.heresay()` (no floating button) and the button calls `Heresay.present()`: a centred sheet (recommended). Add `.heresayAnchor()` to that button only if the person wants it next to the button (iPad and Mac popover). Ask: "Open Heresay as a centred window (recommended) or next to your button?" |
77
91
  | macOS | the default: `.heresay()` plus `.commands { HeresayCommands() }` (Help › Report a Problem…, ⌥⌘R) |
78
92
  | A tab bar or toolbar in the bottom right | `position: .bottomLeading`, or `offset: 80` |
79
93
  | Screens where the button is in the way | `hiddenOnScreens: ["Checkout"]`, and those screens call `Heresay.setScreen("Checkout")` |
80
94
  | An error screen | a button calling `Heresay.present(type: .broken, text: "<what failed>")` |
81
95
 
96
+ ## The mark in your own button
97
+
98
+ `HeresayMarkIcon()` is the mark sized to the surrounding text and tinted (`HeresayMarkIcon(color: .primary)`
99
+ follows the text). `HeresayMark()` is the bare `Shape` for a custom size.
100
+
101
+ ```swift
102
+ Button { Heresay.present() } label: {
103
+ Label { Text("Report a problem") } icon: { HeresayMarkIcon() }
104
+ }
105
+ ```
106
+
107
+ ## What to recommend
108
+
109
+ The design choices worth proposing to the person (own-button mark, wording, where, error screens, brand) are listed with their reasons in guide `install-apple`, "What to recommend". Propose, explain in a sentence, accept their answer; never apply a design change unasked.
110
+
82
111
  ## Calls
83
112
 
84
113
  - `Heresay.identify(id:label:email:)`, `Heresay.identify()` on sign-out.
@@ -72,26 +72,59 @@ editors, admin screens, data tables) where a panel would cover the work. The pag
72
72
  - After sending, the bar shows a check, "Sent. Replies show under Your reports." and Done. Your
73
73
  reports opens the normal Your reports panel, and its back arrow returns to the bar.
74
74
  - On phones (under 600px) the bar docks to the bottom edge at full width and rides above the keyboard.
75
- - `data-panel` is ignored by the bar. There is no backdrop.
75
+ - `data-panel` is ignored by the bar, except `beside` (next to the app's own button). There is no backdrop.
76
76
  - Tag: `<script src="SDK_URL" data-key="KEY" data-layout="bar" defer></script>`
77
77
 
78
78
  **With `data-position`.** The panel or bar opens beside the button, in its corner, away from the
79
79
  edge, with room for the button and the same `data-offset`; with `left-tab` or `right-tab` it sits
80
- beside the tab, vertically centred. With `data-position="none"` (the app opens it with
81
- `Heresay.open()` from its own menu) it takes the named corner, bottom-right by default, with no button
82
- to leave room for. Examples:
80
+ beside the tab, vertically centred. With `data-position="none"` the app opens it from its own
81
+ item (see How it opens): a centred window by default, or next to that item with `data-panel="beside"`; the named corner
82
+ is used only for the nudge note. Examples:
83
83
  `data-layout="steps" data-position="bottom-left"`, `data-layout="bar" data-position="none"`.
84
84
 
85
+ ## How it opens
86
+
87
+ | How it is opened | Where the panel appears (web, any layout) |
88
+ | --- | --- |
89
+ | Floating button (any position or tab) | Beside the button |
90
+ | The app's own trigger (`Heresay.open()` called during a click or key press, or any element with `data-heresay-open`), no `data-panel` | **A centred window with the page dimmed (the default and the recommendation).** Bar layout: docked at the bottom centre |
91
+ | The app's own trigger with `data-panel="beside"` (opt-in) | A popover next to that trigger, on the side with the most room (right of a left-sidebar item, left of a right-sidebar item, below a header button, above a footer item), aligned to its edge and kept on screen |
92
+ | `data-panel="beside"` and a trigger inside a menu that closes when clicked | Next to where the trigger was at the moment of the click |
93
+ | Code with no click (an error screen, a timer) | Centred, page dimmed |
94
+ | The "Something not working?" note with no floating button | The note sits in the bottom corner; the panel then opens in that corner |
95
+ | Page scrolls or resizes while it is open (`beside`) | Stays attached to the trigger, always fully on screen |
96
+ | Phones (under 600px) | Bottom sheet (bar: docked bar), whatever the trigger |
97
+
98
+ `data-panel="sheet"` (full-height side), `data-panel="center"` and `data-panel="corner"` always win over the
99
+ trigger. Clicking outside the panel closes it and focus returns to the trigger; the typed text and chosen type
100
+ are kept until the report is sent. `Heresay.open({ anchor: element })` (an element or a rectangle
101
+ `{ left, top, width, height }`) also centres the window unless `data-panel="beside"` is set.
102
+
85
103
  ## Placement
86
104
 
87
105
  | The app has... | Do this |
88
106
  | --- | --- |
89
- | Its own feedback or help menu item | `data-position="none"`; the item calls `window.Heresay?.open()` |
107
+ | Its own feedback or help menu item | `data-position="none"`, plus `data-heresay-open` on that element (preferred, no JavaScript; `data-heresay-open="broken"` starts as that type) or `onclick` calling `window.Heresay?.open()`. The panel opens as a centred window (recommended); ask the person "Open Heresay as a centred window (recommended) or next to your button?" and add `data-panel="beside"` only if they pick next to the button |
90
108
  | A chat bubble, cookie banner or bottom nav in the bottom right | `data-position="bottom-left"` or `data-offset="20,96"` |
91
109
  | A mobile bottom tab bar | `data-offset="16,72"` |
92
110
  | Pages where it's in the way | `data-hide-on="/checkout,/login"` |
93
111
  | An error screen | a button calling `window.Heresay?.open({ type: 'broken', text: '<what failed>' })` |
94
112
 
113
+ ## The mark in your own button
114
+
115
+ `data-heresay-mark` on any element (an empty `<span>` inside the app's own button) fills it with the
116
+ Heresay mark, 1em square and hidden from screen readers. It takes the accent (`data-accent`, unless
117
+ `data-mark="heresay"`); `data-heresay-mark="currentColor"` takes the text colour. Elements added later
118
+ are filled too; elements without the attribute are never touched.
119
+
120
+ ```html
121
+ <button data-heresay-open><span data-heresay-mark></span> Report a problem</button>
122
+ ```
123
+
124
+ ## What to recommend
125
+
126
+ The design choices worth proposing to the person (own-button mark, wording, where, error screens, brand) are listed with their reasons in guide `install-web`, "What to recommend". Propose, explain in a sentence, accept their answer; never apply a design change unasked.
127
+
95
128
  ## Calls
96
129
 
97
130
  - `Heresay?.identify({ id, label, email })`, `identify()` on sign-out.
@@ -1,5 +1,5 @@
1
1
  {
2
- "skill_version": 9,
2
+ "skill_version": 13,
3
3
  "topics": {
4
4
  "start": "What Heresay is, the rules, and which topic to read next",
5
5
  "install-web": "Add the Heresay web SDK to an app, for any framework, and prove it works",
@@ -40,9 +40,14 @@ struct MyApp: App {
40
40
  | --- | --- |
41
41
  | iOS | `.heresayReportButton()` on the root view |
42
42
  | macOS | `.heresay()` on the root view, and `.commands { HeresayCommands() }` on the `WindowGroup` (Help › Report a Problem…, ⌥⌘R) |
43
- | The app has its own feedback or help button | `.heresay()` (no corner button); that button calls `Heresay.present()` |
43
+ | The app has its own feedback or help button | `.heresay()` (no corner button) and the button calls `Heresay.present()`: a centred sheet, the recommended default. Add `.heresayAnchor()` to that button only if the person wants it next to the button (a popover pointing at it on iPad and Mac). **Ask the person:** "Open Heresay as a centred window (recommended) or next to your button?" |
44
44
  | Something in the bottom-right corner, or a tab bar | `HeresayStyle(position: .bottomLeading)` or `offset: 80`: see `customize-apple` |
45
45
 
46
+ How it opens: the floating button and an anchored button (`.heresayAnchor()`) open a bottom sheet on
47
+ iPhone (bar layout: docked bar) and a popover on iPad and Mac; `Heresay.present()` with no anchor, the
48
+ recommended way from the app's own button, opens a centred sheet (iPad: form sheet); Mac
49
+ Help › Report a Problem… opens a sheet on the window. The dashboard's Design page shows both.
50
+
46
51
  ## 4. Who is signed in (required if people sign in)
47
52
 
48
53
  Where the app learns who is signed in, and on sign-out:
@@ -71,6 +76,23 @@ MainView().onAppear { Heresay.introduce() }
71
76
 
72
77
  Leave everything else; the defaults are recommended. Change nothing else in the app.
73
78
 
79
+ ## What to recommend
80
+
81
+ Propose each of these when it applies, say why in one sentence, and accept the person's answer. Never
82
+ apply a design change without asking; the person decides.
83
+
84
+ - **The app's own button keeps the Heresay mark.** Mark plus label, or a round mark-only button; Swift: `Label { Text("Report a problem") } icon: { HeresayMarkIcon() }` (sizes to the font, tinted; `HeresayMark()` is the bare shape). Why: people recognise the mark from app to app.
85
+ - **Floating button: a pill with the mark and "Report" (the default).** Icon-only round only when space is tight; never a bare text link. Why: the pill is the easiest to find.
86
+ - **Wording: short and neutral.** "Report", "Feedback" or "Report a problem"; never "Bug", "Complaint" or "Contact support". Why: people hold back when it sounds like blame or a ticket.
87
+ - **Where: where people look when stuck.** Bottom of the sidebar, the Help menu, or a header help icon; never buried in Settings. Why: a report is made in the moment of frustration.
88
+ - **Error screens and empty states: a "Tell the team" link** calling `Heresay.present(type: .broken, text:)`. Why: that is when people most want to say something, and the text arrives filled in.
89
+ - **Brand: the app's accent colour** (`Heresay.configure(…, accent: .purple)`); the mark follows it. Why: it looks like part of the app.
90
+ - **Mac: always the Help menu.** `.commands { HeresayCommands() }` gives Help › Report a Problem… and ⌥⌘R, even when the app also has a button. Why: it is where Mac users look, and the shortcut is the same in every app.
91
+ - **First run:** `introduce()` once on the main screen, and `identify` when people sign in. Why: people learn the button exists, and nobody is asked their name.
92
+ - **Layout: composer** unless the app clearly suits steps (consumer, mobile-first) or bar (dense pro tools). Why: composer is the quickest to fill in.
93
+ - **Own button opens:** centred (recommended, the default); `.heresayAnchor()` only if the person asks. Why: a centred window never hides what the person is reporting on.
94
+ - **iPad toolbar.** A button in the navigation-bar toolbar must stay centred (no `.heresayAnchor()`): an anchored popover there covers the button.
95
+
74
96
  ## 7. Prove it
75
97
 
76
98
  Call `check_install`: it finds the key in this repo's code by itself (`found_in_code`). Build and
@@ -42,12 +42,34 @@ attributes to the same tag (`data-position`, `data-offset`, `data-hide-on`; valu
42
42
  | The app has... | Do this |
43
43
  | --- | --- |
44
44
  | Nothing in that corner | Nothing. Keep the default. |
45
- | Its own feedback or help menu item | `data-position="none"`, and that item calls `window.Heresay?.open()` |
45
+ | Its own feedback or help menu item | `data-position="none"`, and `data-heresay-open` on that element (preferred, no JavaScript) or `onclick` calling `window.Heresay?.open()`. **Ask the person first** (see below). Default: a centred window. `data-panel="beside"` opens it next to the item |
46
46
  | A chat widget, cookie banner or bottom nav in the bottom right | `data-position="bottom-left"`, or `data-offset="20,96"` to sit above it |
47
47
  | A mobile bottom tab bar | `data-offset="16,72"` (its height plus a margin) |
48
48
  | Pages where it gets in the way (checkout, login) | `data-hide-on="/checkout,/login"` |
49
49
  | An error screen | A button there: `window.Heresay?.open({ type: 'broken', text: '<what failed>' })` |
50
50
 
51
+ **If the app has its own feedback or help item, ask the person before you finish:** "Open Heresay as a
52
+ centred window (recommended) or next to your button?" Centred needs nothing extra. Next to the button
53
+ adds `data-panel="beside"` to the script tag. Tell them the dashboard's Design page shows both.
54
+
55
+ ### How it opens
56
+
57
+ | How it is opened | Where the panel appears (web, any layout) |
58
+ | --- | --- |
59
+ | Floating button (any position or tab) | Beside the button |
60
+ | The app's own trigger (`Heresay.open()` called during a click or key press, or any element with `data-heresay-open`), no `data-panel` | **A centred window with the page dimmed (the default and the recommendation).** Bar layout: docked at the bottom centre |
61
+ | The app's own trigger with `data-panel="beside"` (opt-in) | A popover next to that trigger, on the side with the most room (right of a left-sidebar item, left of a right-sidebar item, below a header button, above a footer item), aligned to its edge and kept on screen |
62
+ | `data-panel="beside"` and a trigger inside a menu that closes when clicked | Next to where the trigger was at the moment of the click |
63
+ | Code with no click (an error screen, a timer) | Centred, page dimmed |
64
+ | The "Something not working?" note with no floating button | The note sits in the bottom corner; the panel then opens in that corner |
65
+ | Page scrolls or resizes while it is open (`beside`) | Stays attached to the trigger, always fully on screen |
66
+ | Phones (under 600px) | Bottom sheet (bar: docked bar), whatever the trigger |
67
+
68
+ `data-panel="sheet"` (full-height side), `data-panel="center"` and `data-panel="corner"` always win over the
69
+ trigger. Clicking outside the panel closes it and focus returns to the trigger; the typed text and chosen type
70
+ are kept until the report is sent. `Heresay.open({ anchor: element })` (an element or a rectangle
71
+ `{ left, top, width, height }`) also centres the window unless `data-panel="beside"` is set.
72
+
51
73
  ### Layout (optional)
52
74
 
53
75
  `data-layout` chooses the form: `composer` (the default: type pills and a text box; right for most
@@ -89,6 +111,21 @@ your own dialog. If the app has a "What's new" area, add a line there too.
89
111
 
90
112
  Leave everything else; the defaults are recommended. Change nothing else in the app.
91
113
 
114
+ ## What to recommend
115
+
116
+ Propose each of these when it applies, say why in one sentence, and accept the person's answer. Never
117
+ apply a design change without asking; the person decides.
118
+
119
+ - **The app's own button keeps the Heresay mark.** Mark plus label, or a round mark-only button; web: `<button data-heresay-open><span data-heresay-mark></span> Report a problem</button>` (`data-heresay-mark="currentColor"` takes the text colour; the accent otherwise). Why: people recognise the mark from app to app.
120
+ - **Floating button: a pill with the mark and "Report" (the default).** Icon-only round only when space is tight; never a bare text link. Why: the pill is the easiest to find.
121
+ - **Wording: short and neutral.** "Report", "Feedback" or "Report a problem"; never "Bug", "Complaint" or "Contact support". Why: people hold back when it sounds like blame or a ticket.
122
+ - **Where: where people look when stuck.** Bottom of the sidebar, the Help menu, or a header help icon; never buried in Settings. Why: a report is made in the moment of frustration.
123
+ - **Error screens and empty states: a "Tell the team" link** calling `window.Heresay?.open({ type: 'broken', text })`. Why: that is when people most want to say something, and the text arrives filled in.
124
+ - **Brand: the app's accent colour** (`data-accent`); the mark follows it. Why: it looks like part of the app.
125
+ - **First run:** `introduce()` once on the main screen, and `identify` when people sign in. Why: people learn the button exists, and nobody is asked their name.
126
+ - **Layout: composer** unless the app clearly suits steps (consumer, mobile-first) or bar (dense pro tools). Why: composer is the quickest to fill in.
127
+ - **Own button opens:** centred (recommended, the default); `data-panel="beside"` only if the person asks. Why: a centred window never hides what the person is reporting on.
128
+
92
129
  ## 7. Prove it
93
130
 
94
131
  Call `check_install`. `found_in_code` means the key is in this repo; `seen_running` means the
@@ -0,0 +1,176 @@
1
+ {
2
+ "about": "What each Heresay release changed, in plain words. `users`: what the people using an app with Heresay will see. `developers`: what a developer can now do or must know. `action`: a code change an app needs, if any. `features`: ids from changes.json that this release introduced. Read by whats_new to explain an update before it is applied. A release cannot be cut without an entry here (scripts/release.mjs).",
3
+ "versions": [
4
+ {
5
+ "version": "0.2.52",
6
+ "users": [
7
+ "A new report never opens with last time's type already selected; only an unsent message (with its type) is kept.",
8
+ "The page behind the centred Report window is dimmed more, so the window stands out, especially in dark apps."
9
+ ],
10
+ "developers": [],
11
+ "action": "None required.",
12
+ "date": "2026-11-23"
13
+ },
14
+ {
15
+ "version": "0.2.51",
16
+ "users": [
17
+ "When an app opens Heresay from its own button, the panel now opens centred (it used to sit in the bottom-right corner)",
18
+ "Clicking or tapping outside the panel closes it, and what they had typed is kept for next time."
19
+ ],
20
+ "developers": [
21
+ "Web: an app's own button (data-heresay-open, or Heresay.open() from a click) opens a centred window with the page dimmed; the bar layout docks at the bottom centre. data-panel=\"beside\" opens it next to the button instead.",
22
+ "Swift: Heresay.present() from your own button opens a centred sheet; add .heresayAnchor() to that button to open it next to the button on iPad and Mac.",
23
+ "Opened by code with no click, the panel is centred.",
24
+ "Web: data-heresay-mark on any element (an empty span inside your own button) is filled with the Heresay mark, 1em square; data-heresay-mark=\"currentColor\" takes the text colour, otherwise the accent. Swift: HeresayMarkIcon() sizes the mark to the text. The dashboard's Design page shows a snippet when the button is \"Never\"."
25
+ ],
26
+ "features": [
27
+ "open-next-to-trigger",
28
+ "mark-in-own-button"
29
+ ],
30
+ "date": "2026-11-23"
31
+ },
32
+ {
33
+ "version": "0.2.50",
34
+ "date": "2026-11-23",
35
+ "users": [
36
+ "The Report panel was redesigned: no tabs, compact type pills, a shorter intro, and a sent view after reporting.",
37
+ "Name and email sit under Your reports instead of the form; reporters no longer see trail controls.",
38
+ "On iOS and macOS 26 the panel uses the system glass look."
39
+ ],
40
+ "developers": [
41
+ "Three layouts: composer (default), steps, bar. Web data-layout, Swift HeresayStyle(layout:).",
42
+ "data-position takes bottom-right, bottom-left, top-right, top-left, bottom-center, left-tab, right-tab or none.",
43
+ "Agent guides are clearer about placement and layout."
44
+ ],
45
+ "action": "None required. Check where the Report button sits if the app positioned it by hand.",
46
+ "features": [
47
+ "layouts"
48
+ ]
49
+ },
50
+ {
51
+ "version": "0.2.49",
52
+ "date": "2026-11-23",
53
+ "users": [],
54
+ "developers": [
55
+ "iOS runs that were never active are no longer counted as crashes in crash reports."
56
+ ]
57
+ },
58
+ {
59
+ "version": "0.2.48",
60
+ "date": "2026-11-10",
61
+ "users": [
62
+ "After a crash, hang, out-of-memory or force quit, an app that turned on crash reports sends it by itself at the next launch."
63
+ ],
64
+ "developers": [
65
+ "crashReports: .send on iOS and macOS; it waits in the inbox like any report. Off until the app turns it on."
66
+ ],
67
+ "features": [
68
+ "crash-reports"
69
+ ]
70
+ },
71
+ {
72
+ "version": "0.2.47",
73
+ "date": "2026-11-07",
74
+ "users": [],
75
+ "developers": [
76
+ "Setup reserves a clean address, heresay-<name>.web.app."
77
+ ]
78
+ },
79
+ {
80
+ "version": "0.2.46",
81
+ "date": "2026-11-07",
82
+ "users": [],
83
+ "developers": [
84
+ "The dashboard is served at the root of a Heresay."
85
+ ]
86
+ },
87
+ {
88
+ "version": "0.2.45",
89
+ "date": "2026-11-06",
90
+ "users": [],
91
+ "developers": [
92
+ "Backup and restore for a Heresay; setup and connect polish, named sites, runs with no terminal."
93
+ ]
94
+ },
95
+ {
96
+ "version": "0.2.44",
97
+ "date": "2026-11-06",
98
+ "users": [],
99
+ "developers": [
100
+ "Lite hosting on the free Spark plan, with fewer database reads."
101
+ ]
102
+ },
103
+ {
104
+ "version": "0.2.43",
105
+ "date": "2026-10-27",
106
+ "users": [],
107
+ "developers": [
108
+ "Telegram alerts are formatted: bold headline, type, id and an Open link."
109
+ ]
110
+ },
111
+ {
112
+ "version": "0.2.42",
113
+ "date": "2026-10-27",
114
+ "users": [],
115
+ "developers": [
116
+ "Notifications are small modules on the dashboard; the Telegram webhook registers on any save."
117
+ ]
118
+ },
119
+ {
120
+ "version": "0.2.41",
121
+ "date": "2026-10-27",
122
+ "users": [],
123
+ "developers": [
124
+ "Select and accept several open reports at once. A long file sent from a chat app arrives as one request."
125
+ ]
126
+ },
127
+ {
128
+ "version": "0.2.40",
129
+ "date": "2026-10-26",
130
+ "users": [],
131
+ "developers": [
132
+ "Act on Heresay notifications from Telegram."
133
+ ]
134
+ },
135
+ {
136
+ "version": "0.2.39",
137
+ "date": "2026-10-26",
138
+ "users": [],
139
+ "developers": [
140
+ "A connected Telegram bot gets the Heresay logo as its picture."
141
+ ]
142
+ },
143
+ {
144
+ "version": "0.2.38",
145
+ "date": "2026-10-25",
146
+ "users": [],
147
+ "developers": [
148
+ "The dashboard updates itself (delta polling), without reloading."
149
+ ]
150
+ },
151
+ {
152
+ "version": "0.2.37",
153
+ "date": "2026-10-23",
154
+ "users": [],
155
+ "developers": [
156
+ "Every report's source is labelled the same way in the list and on the report. The dashboard's dark mode uses the on-dark logo."
157
+ ]
158
+ },
159
+ {
160
+ "version": "0.2.36",
161
+ "date": "2026-10-21",
162
+ "users": [],
163
+ "developers": [
164
+ "Agents see every app on their repo. A dead Heresay address is an error, not \"nothing to do\"."
165
+ ]
166
+ },
167
+ {
168
+ "version": "0.2.35",
169
+ "date": "2026-10-19",
170
+ "users": [],
171
+ "developers": [
172
+ "Dashboard dark mode follows the device, with an Auto/Light/Dark toggle. A Heresay can deploy to a named hosting site (HERESAY_SITE)."
173
+ ]
174
+ }
175
+ ]
176
+ }
@@ -1,45 +1,84 @@
1
1
  # What's new in Heresay
2
2
 
3
3
  Heresay keeps changing after an app has it: new versions of the Heresay itself and the Swift
4
- package, and new features. In a connected repo, bring these up with the person and **ask before
5
- applying any**.
6
-
7
- ## When to check
8
-
9
- - **When a chat starts.** In Claude Code, a session-start check (`.claude/settings.json`, added
10
- by `heresay connect`) does it and tells you what it found. Other agents: call `whats_new`
11
- (or run `npx -y heresay@latest updates`) once early in the conversation, whatever it is about.
12
- - **At the start of every Heresay task**, call `whats_new` yourself.
13
-
14
- ## What to do with it
15
-
16
- 1. If it returns nothing, carry on. Don't mention it.
17
- 2. If it returns updates, tell the person in one short sentence each, in their words, not ours,
18
- for example: "Heresay has a newer Swift package (0.2.22) with more context in reports. Want me
19
- to update it?" One question for all of them is fine. If they asked about something else,
20
- help with that first and ask at the end of your reply.
21
- 3. **Never apply an update without a yes.** It changes what the app's users see.
22
- - Yes: follow its `how` (below), then `check_install` for that app.
23
- - No: call `skip_update` with its id (or `npx heresay updates --skip <id>`), so nobody asks
24
- again. It is recorded in `.claude/skills/heresay/decisions.json`; commit that. A skipped
25
- version is asked about again when a newer one comes out.
26
- - Not now: leave it; it comes up again in a later chat.
4
+ package, and new features. In a connected repo, bring these up with the person, explain them, and
5
+ **ask before applying any**. A version update is never just a bump: what the app's users see may
6
+ change, and the person should hear that first.
7
+
8
+ ## 1. Notice
9
+
10
+ - **When a chat starts.** In Claude Code a session-start check (`.claude/settings.json`, added by
11
+ `heresay connect`) tells you what it found. Other agents: call `whats_new` (or run
12
+ `npx -y heresay@latest updates`) once early in the conversation, whatever it is about.
13
+ - **At the start of every Heresay task**, and when asked to "update Heresay": call `whats_new`.
14
+ - If it returns nothing, carry on and don't mention it. If the person asked about something else,
15
+ help with that first and raise the updates at the end of your reply.
16
+
17
+ ## 2. Explain each item, in plain words
18
+
19
+ For every update, say three things, in the person's words, not ours:
20
+
21
+ - **What the app's users will see.** For a version update read `notes`: each release lists
22
+ `users` (what the people using the app see), `developers` (what changes for whoever builds it)
23
+ and `action` (a code change needed, if any). If `users` has anything, say so first: "the Report
24
+ panel your users see was redesigned: no tabs, compact type pills..."
25
+ - **What code changes.** Often none (web apps get Report button changes from the Heresay with no
26
+ code change); for a feature, the lines or attributes it adds.
27
+ - **Your recommendation for this app, with a reason.** Look at the app. An app with its own
28
+ "Report a problem" menu item or sidebar row should use `open-next-to-trigger`: the panel opens
29
+ beside that item instead of in a corner. A dense editor may suit the `bar` layout; most apps
30
+ should keep the default. Say "I'd add it because..." or "I'd skip it because...". Don't just
31
+ read out the list.
32
+
33
+ Fields you get: `id`, `title`, `summary`, `how` (the guide to follow), `notes` and `then` on version
34
+ updates, `offer` on features (`recommended`, or `optional`: only offered right after the version
35
+ that introduced it).
36
+
37
+ ## 3. Ask, per item
38
+
39
+ **Add it / Not now / Never.** One question covering several items is fine if each is clear.
40
+ **Never apply an update without a yes**: it changes what the app's users see.
41
+
42
+ ## 4. Apply
43
+
44
+ Follow the item's `how` (a guide), run `check_install` for the app, and **commit each item
45
+ separately** so any one can be reverted. For a version update, read `notes[].action` and do what
46
+ it says.
47
+
48
+ ## 5. Show the result
49
+
50
+ Say where to see it: the screen and what to click or tap ("open Settings, press Report a problem:
51
+ the panel opens next to it"). If you can run the app, take a screenshot and show it.
52
+
53
+ ## 6. Chain
54
+
55
+ After a version update, look at its `then`: the features that version introduced that fit this
56
+ app. Explain and offer each the same way (steps 2 to 5). Don't offer them before the update is
57
+ applied, or when the person said Not now to the update.
58
+
59
+ ## 7. Remember
60
+
61
+ - **Never**: call `skip_update` with the id (or `npx heresay updates --skip <id>`). It is recorded
62
+ in `.claude/skills/heresay/decisions.json`; commit that. A newer version of a skipped version
63
+ update is asked about once more.
64
+ - **Not now**: leave it. It comes up again in a later chat.
65
+ - **Yes**: nothing to record; once applied it stops being offered.
27
66
 
28
67
  ## The kinds of update
29
68
 
30
69
  - **`instance@x.y.z`: this team's Heresay is behind.** The dashboard, the API and the web Report
31
- button (web apps load it from the Heresay, so they get it with no code change). Whoever set the
32
- Heresay up runs `npx create-heresay update`; it signs in to Google with their account. Offer to
33
- run it only if that's the person you're talking to.
70
+ button (web apps load it from the Heresay, so they get it with no code change, but their users
71
+ see the new button). Whoever set the Heresay up runs `npx create-heresay update`; it signs in to
72
+ Google with their account. Offer to run it only if that's the person you're talking to.
34
73
  - **`swift@x.y.z`: the Swift package is behind.** Xcode: File › Packages › Update to Latest
35
74
  Package Versions. A Swift package: `swift package update heresay-swift`. From a terminal for an
36
75
  Xcode project: delete the `heresay-swift` pin from its `Package.resolved` and run
37
- `xcodebuild -resolvePackageDependencies`. Build, read the CHANGELOG for anything that needs a
38
- code change, and commit `Package.resolved`.
76
+ `xcodebuild -resolvePackageDependencies`. Build, do what the notes' `action` says, commit
77
+ `Package.resolved`. The package also ships `CHANGELOG.md`.
39
78
  - **`agent-files@N`: this repo's Heresay agent files are old.** Run
40
79
  `npx -y heresay@latest connect --update` and commit what it lists, in its own commit.
41
- - **Anything else is a feature this app doesn't use yet**, from this Heresay's feature list. Its
42
- `how` names the guide to follow.
80
+ - **Anything else is a feature this app doesn't use yet.** Its `how` names the guide to follow.
43
81
 
44
- If the tool isn't there (an older `heresay` package), read `/guides/changes.json` on this Heresay
45
- and check the code for each entry's `detect` strings yourself.
82
+ If the tool isn't there (an older `heresay` package), read `/guides/releases.json` and
83
+ `/guides/changes.json` on this Heresay and check the code for each entry's `when` and `detect`
84
+ strings yourself.
@@ -27,7 +27,9 @@
27
27
  * data-placeholder, data-thanks, data-types ("broken,confusing,improvement,idea")
28
28
  * Layout: data-layout composer (default: type pills and a text box) | steps (pick what it is,
29
29
  * then say it) | bar (a compact floating composer beside the button)
30
- * Panel: data-panel corner (default) | sheet | center (bar ignores it)
30
+ * Panel: data-panel corner (default beside the floating button) | sheet | center | beside
31
+ * (beside: next to the app's own button; without it an app's own
32
+ * button opens a centred window, or a docked bar. bar ignores the rest)
31
33
  * data-width regular (default) | narrow | wide
32
34
  * data-backdrop dim (default) | clear | blur
33
35
  * data-preferences show (default) | hide ("Your name and email" in Your reports)
@@ -238,7 +240,7 @@
238
240
  var HIDE_ON = attr('hide-on').split(',').map(function (p) { return p.trim().replace(/\/+$/, ''); })
239
241
  .filter(function (p) { return p.charAt(0) === '/'; });
240
242
  var LAYOUT = pick('layout', ['composer', 'steps', 'bar'], 'composer');
241
- var PANEL = pick('panel', ['corner', 'sheet', 'center'], 'corner');
243
+ var PANEL = pick('panel', ['corner', 'sheet', 'center', 'beside'], '');
242
244
  var WIDTH = ({ narrow: 320, wide: 460 })[attr('width').toLowerCase()] || 360;
243
245
  var BACKDROP = pick('backdrop', ['dim', 'clear', 'blur'], 'dim');
244
246
  var PREFS_ROW = pick('preferences', ['show', 'hide'], 'show') === 'show';
@@ -1091,11 +1093,14 @@
1091
1093
  // the panel
1092
1094
  '.scrim{position:fixed;inset:0;z-index:2147483001;background:rgba(0,0,0,.35);display:flex;align-items:flex-end;justify-content:flex-end;padding:var(--fb-pad,16px)}',
1093
1095
  '.scrim.l{justify-content:flex-start}.scrim.c{justify-content:center}.scrim.t{align-items:flex-start}.scrim.side{align-items:center}',
1094
- '.scrim.center{align-items:center;justify-content:center;padding:16px}',
1096
+ '.scrim.center{align-items:center;justify-content:center;padding:16px}.scrim.center.dim{background:rgba(0,0,0,.55)}',
1095
1097
  '.scrim.sheet{padding:0;align-items:stretch}',
1096
1098
  '.panel{animation:fb-rise .2s ease-out}.scrim.t .panel{animation-name:fb-drop}.scrim.center .panel,.scrim.side .panel{animation-name:fb-fade}',
1097
1099
  '@keyframes fb-rise{from{opacity:0;transform:translateY(8px)}}@keyframes fb-drop{from{opacity:0;transform:translateY(-8px)}}',
1098
1100
  '.scrim.clear{background:none}',
1101
+ '.scrim.anch{padding:0!important;display:block}.scrim.anch>.panel,.scrim.anch>.barbox{position:fixed;left:0;top:0}',
1102
+ '.scrim.bar.center{pointer-events:auto;background:rgba(0,0,0,.55)}.scrim.bar.center.clear{background:none}',
1103
+ '.scrim.bar.center.blur{background:rgba(0,0,0,.18);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}',
1099
1104
  '.scrim.blur{background:rgba(0,0,0,.18);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px)}',
1100
1105
  '.panel{width:min(var(--fb-w),100%);max-height:min(600px,calc(100vh - 32px));display:flex;flex-direction:column;overflow:hidden;background:var(--fb-bg);',
1101
1106
  'border-radius:16px;box-shadow:0 12px 40px rgba(16,24,40,.16),0 0 0 1px var(--fb-ring)}',
@@ -1247,15 +1252,53 @@
1247
1252
  return n;
1248
1253
  }
1249
1254
 
1255
+ var MARK_BODY = 'M174 100L177 105L180 110L181 116L180 121L178 126L174 131L169 134L164 137L159 139L154 141L149 143L146 146L143 149L141 154L139 159L137 164L134 169L131 174L126 178L121 180L116 181L110 180L105 177L100 174L95 170L91 167L87 164L83 163L79 162L74 162L69 163L63 164L57 164L51 164L46 162L41 159L38 154L36 149L36 143L36 137L37 131L38 126L38 121L37 117L36 113L33 109L30 105L26 100L23 95L20 90L19 84L20 79L22 74L26 69L31 66L36 63L41 61L46 59L51 57L54 54L57 51L59 46L61 41L63 36L66 31L69 26L74 22L79 20L84 19L90 20L95 23L100 26L105 30L109 33L113 36L117 37L121 38L126 38L131 37L137 36L143 36L149 36L154 38L159 41L162 46L164 51L164 57L164 63L163 69L162 74L162 79L163 83L164 87L167 91L170 95Z';
1256
+ var MARK_EYE = 'M-13 12 C-13 -8 -2 -24 17 -32 L20 -25 C8 -18 2 -9 3 -1 A13 13 0 1 1 -13 12 Z';
1257
+ var EYE_A = 'translate(80 106) rotate(-24) scale(1.25)', EYE_B = 'translate(124 101) rotate(-24) scale(1.25)';
1258
+
1250
1259
  /** The Heresay mark, compact: a soft wave with quote-mark eyes. Drawn from a constant string.
1251
1260
  * `glance` makes it the loader: the eyes look left, look right, blink. */
1252
1261
  function markEl(glance) {
1253
1262
  var s = document.createElement('span');
1254
1263
  s.className = glance ? 'mark glance' : 'mark';
1255
- s.innerHTML = '<svg viewBox="0 0 200 200" width="22" height="22" aria-hidden="true"><path d="M174 100L177 105L180 110L181 116L180 121L178 126L174 131L169 134L164 137L159 139L154 141L149 143L146 146L143 149L141 154L139 159L137 164L134 169L131 174L126 178L121 180L116 181L110 180L105 177L100 174L95 170L91 167L87 164L83 163L79 162L74 162L69 163L63 164L57 164L51 164L46 162L41 159L38 154L36 149L36 143L36 137L37 131L38 126L38 121L37 117L36 113L33 109L30 105L26 100L23 95L20 90L19 84L20 79L22 74L26 69L31 66L36 63L41 61L46 59L51 57L54 54L57 51L59 46L61 41L63 36L66 31L69 26L74 22L79 20L84 19L90 20L95 23L100 26L105 30L109 33L113 36L117 37L121 38L126 38L131 37L137 36L143 36L149 36L154 38L159 41L162 46L164 51L164 57L164 63L163 69L162 74L162 79L163 83L164 87L167 91L170 95Z" fill="currentColor"/><g class="eyes"><g class="e" style="transform-origin:80px 106px"><path class="eye" d="M-13 12 C-13 -8 -2 -24 17 -32 L20 -25 C8 -18 2 -9 3 -1 A13 13 0 1 1 -13 12 Z" transform="translate(80 106) rotate(-24) scale(1.25)"/></g><g class="e" style="transform-origin:124px 101px"><path class="eye" d="M-13 12 C-13 -8 -2 -24 17 -32 L20 -25 C8 -18 2 -9 3 -1 A13 13 0 1 1 -13 12 Z" transform="translate(124 101) rotate(-24) scale(1.25)"/></g></g></svg>';
1264
+ s.innerHTML = '<svg viewBox="0 0 200 200" width="22" height="22" aria-hidden="true"><path d="' + MARK_BODY + '" fill="currentColor"/><g class="eyes">' +
1265
+ '<g class="e" style="transform-origin:80px 106px"><path class="eye" d="' + MARK_EYE + '" transform="' + EYE_A + '"/></g>' +
1266
+ '<g class="e" style="transform-origin:124px 101px"><path class="eye" d="' + MARK_EYE + '" transform="' + EYE_B + '"/></g></g></svg>';
1256
1267
  return s;
1257
1268
  }
1258
1269
 
1270
+ /**
1271
+ * `data-heresay-mark` on any element of the host page (an empty span inside the app's own
1272
+ * button): filled with the Heresay mark, 1em square, hidden from screen readers. Coloured with
1273
+ * the accent (data-accent, unless data-mark="heresay"), or with the text colour when the
1274
+ * attribute is "currentColor". The eyes are real holes (a mask), so it sits on any background.
1275
+ * Elements added later are filled too. Nothing without the attribute is touched.
1276
+ */
1277
+ var markSeq = 0;
1278
+ function fillMark(n) {
1279
+ if (n.getAttribute('data-heresay-filled') != null) return;
1280
+ n.setAttribute('data-heresay-filled', '');
1281
+ var id = 'heresay-m' + (++markSeq), acc = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(attr('accent')) && pick('mark', ['accent', 'heresay'], 'accent') === 'accent' ? attr('accent') : '#0b5e57';
1282
+ var col = (n.getAttribute('data-heresay-mark') || '').trim().toLowerCase() === 'currentcolor' ? 'currentColor' : acc;
1283
+ n.setAttribute('aria-hidden', 'true');
1284
+ n.style.display = 'inline-flex'; n.style.width = '1em'; n.style.height = '1em'; n.style.verticalAlign = '-0.125em'; n.style.color = col;
1285
+ n.innerHTML = '<svg viewBox="0 0 200 200" width="1em" height="1em" aria-hidden="true" focusable="false" style="display:block"><mask id="' + id + '"><rect width="200" height="200" fill="#fff"/>' +
1286
+ '<path d="' + MARK_EYE + '" transform="' + EYE_A + '" fill="#000"/><path d="' + MARK_EYE + '" transform="' + EYE_B + '" fill="#000"/></mask>' +
1287
+ '<path d="' + MARK_BODY + '" fill="currentColor" mask="url(#' + id + ')"/></svg>';
1288
+ }
1289
+ function fillMarks(root) {
1290
+ if (root.nodeType !== 1) return;
1291
+ if (root.hasAttribute('data-heresay-mark')) fillMark(root);
1292
+ var all = root.querySelectorAll ? root.querySelectorAll('[data-heresay-mark]') : [];
1293
+ for (var k = 0; k < all.length; k++) fillMark(all[k]);
1294
+ }
1295
+ function watchMarks() {
1296
+ fillMarks(document.documentElement);
1297
+ if (window.MutationObserver) new MutationObserver(function (ms) {
1298
+ for (var a = 0; a < ms.length; a++) for (var b = 0; b < ms[a].addedNodes.length; b++) fillMarks(ms[a].addedNodes[b]);
1299
+ }).observe(document.documentElement, { childList: true, subtree: true });
1300
+ }
1301
+ watchMarks();
1259
1302
 
1260
1303
  var PLACE = POS.join(' ') + (STYLE === 'tab' ? ' side' : '');
1261
1304
  var fabDot = el('span', { class: 'dot', hidden: '' });
@@ -1263,7 +1306,7 @@
1263
1306
  class: ['fab', PLACE, 'st-' + STYLE, 'sz-' + SIZE, 'sh-' + pick('shadow', ['soft', 'none', 'strong'], 'soft'),
1264
1307
  pick('fill', ['neutral', 'accent'], 'neutral') === 'accent' ? 'fill' : '', BUTTON === 'desktop' ? 'desktop' : ''].join(' '),
1265
1308
  type: 'button', 'aria-haspopup': 'dialog', title: S.reportAria + ' · ' + S.powered,
1266
- onclick: function () { open(); },
1309
+ onclick: function () { if (scrim) close(); else open(); },
1267
1310
  }, [markEl(), el('span', { class: 'lbl', text: LABEL }), fabDot]);
1268
1311
  if (BUTTON !== 'none') root.appendChild(fab);
1269
1312
 
@@ -1320,17 +1363,25 @@
1320
1363
  return top + 'px ' + (POS[0] === 'r' ? side : 12) + 'px ' + bottom + 'px ' + (POS[0] === 'l' ? side : 12) + 'px';
1321
1364
  }
1322
1365
 
1323
- function open(which) {
1366
+ function open(which, o) {
1324
1367
  if (dead) return;
1325
1368
  if (scrim) { if (which) { view = which; renderPanel(); } return; }
1326
1369
  if (bubble) { bubble.remove(); bubble = null; }
1327
1370
  if (nudgeEl) { nudgeEl.remove(); nudgeEl = null; }
1328
- lastFocus = document.activeElement;
1371
+ o = o || {};
1372
+ anchor = o.corner ? null : detect(o.anchor);
1373
+ cornerOpen = !!o.corner;
1374
+ lastFocus = anchor && anchor.el ? anchor.el : document.activeElement;
1329
1375
  view = which || (unseen() ? 'mine' : 'new');
1330
- scrim = el('div', { class: surface(), onclick: function (e) { if (e.target === scrim && !barUp()) close(); } });
1376
+ scrim = el('div', { class: surface(), onclick: function (e) {
1377
+ if (e.target !== scrim || Date.now() - menuClosedAt < 600) return;
1378
+ if (!barUp() || scrim.classList.contains('center')) close();
1379
+ } });
1331
1380
  scrim.style.setProperty('--fb-pad', panelPad());
1332
1381
  scrim.addEventListener('keydown', function (e) { if (e.key === 'Escape') close(); });
1333
1382
  root.appendChild(scrim);
1383
+ window.addEventListener('scroll', queue, true);
1384
+ window.addEventListener('resize', queue);
1334
1385
  if (LAYOUT === 'bar' && window.visualViewport) {
1335
1386
  window.visualViewport.addEventListener('resize', keyboard);
1336
1387
  window.visualViewport.addEventListener('scroll', keyboard);
@@ -1343,10 +1394,139 @@
1343
1394
  /** The bar is a small non-modal composer; Your reports (and everything else) is the panel. */
1344
1395
  function barUp() { return LAYOUT === 'bar' && view !== 'mine'; }
1345
1396
  function surface() {
1346
- if (barUp()) return 'scrim ' + PLACE + ' bar';
1347
- var cls = LAYOUT === 'bar' ? PLACE + ' corner' : PANEL === 'center' ? 'center' : PLACE + (PANEL === 'sheet' ? ' sheet' : ' corner');
1348
- return 'scrim ' + cls + ' ' + BACKDROP;
1397
+ var m = opensAs();
1398
+ if (barUp()) return 'scrim bar ' + (m === 'anchor' ? 'anch' : m === 'dock' ? 'c' : m === 'center' ? 'center ' + BACKDROP : PLACE);
1399
+ var cls = LAYOUT === 'bar' ? '' : PANEL === 'center' ? 'center' : PANEL === 'sheet' ? PLACE + ' sheet' : '';
1400
+ if (!cls) cls = m === 'anchor' ? 'anch' : m === 'center' ? 'center' : PLACE + ' corner';
1401
+ return 'scrim ' + cls + ' ' + (cls === 'anch' ? 'clear' : BACKDROP);
1402
+ }
1403
+
1404
+ // ---- where the panel opens ---------------------------------------------------------------
1405
+ // Beside the floating button. From the app's own trigger (the element just clicked, a
1406
+ // [data-heresay-open] element, or open({ anchor })): a centred window with the page dimmed (the bar
1407
+ // docks at the bottom centre), or next to the trigger with data-panel="beside". Centred when code
1408
+ // opened it with no click and there is no button. A bottom sheet on phones.
1409
+ // data-panel sheet, center and corner always win.
1410
+ var recent = null; // the last trusted pointer or key target: { el, rect, t }
1411
+ var anchor = null; // the trigger of the open panel: { el, rect }
1412
+ var cornerOpen = false; // opened from the nudge: the corner it sits in
1413
+ var closedBy = null; // an outside click just closed the panel: { el, t }
1414
+ var menuClosedAt = 0;
1415
+ var INTERACTIVE = 'a,button,[role=button],[role=menuitem],[data-heresay-open]';
1416
+
1417
+ function rectOf(n) {
1418
+ var r = n.getBoundingClientRect();
1419
+ return { left: r.left, top: r.top, right: r.right, bottom: r.bottom, width: r.width, height: r.height };
1420
+ }
1421
+ function pathOf(e) { return e.composedPath ? e.composedPath() : [e.target]; }
1422
+ function markTrigger(e) {
1423
+ if (!e.isTrusted) return;
1424
+ if (e.type === 'keydown' && e.key !== 'Enter' && e.key !== ' ') return;
1425
+ var p = pathOf(e);
1426
+ if (p.indexOf(host) >= 0) { recent = null; return; }
1427
+ var t = p[0];
1428
+ if (!t || t.nodeType !== 1) t = e.target;
1429
+ if (!t || !t.closest) return;
1430
+ t = t.closest(INTERACTIVE) || t;
1431
+ if (t === document.body || t === document.documentElement) { recent = null; return; }
1432
+ recent = { el: t, rect: rectOf(t), t: Date.now() };
1433
+ }
1434
+ function anchorFrom(a) {
1435
+ if (!a) return null;
1436
+ if (a.nodeType === 1) return a === host ? null : { el: a, rect: rectOf(a) };
1437
+ var l = +(a.left != null ? a.left : a.x), t = +(a.top != null ? a.top : a.y);
1438
+ var w = a.width != null ? +a.width : +a.right - l, h = a.height != null ? +a.height : +a.bottom - t;
1439
+ if (!isFinite(l + t + w + h)) return null;
1440
+ return { el: null, rect: { left: l, top: t, right: l + w, bottom: t + h, width: w, height: h } };
1441
+ }
1442
+ function detect(explicit) {
1443
+ var a = anchorFrom(explicit);
1444
+ if (a) return a;
1445
+ return recent && Date.now() - recent.t < 1000 ? { el: recent.el, rect: recent.rect } : null;
1446
+ }
1447
+ /** After an outside click closed the panel on this trigger, the click that follows must not reopen it. */
1448
+ function toggledOff(el) {
1449
+ var t = el || (recent && recent.el);
1450
+ return !!(closedBy && closedBy.el && t === closedBy.el && Date.now() - closedBy.t < 700);
1451
+ }
1452
+ function opensAs() {
1453
+ if (media('(max-width:599px)')) return 'corner';
1454
+ if (anchor && PANEL !== 'corner') return PANEL === 'beside' ? 'anchor' : LAYOUT === 'bar' ? 'dock' : 'center';
1455
+ return cornerOpen || fabShowing() ? 'corner' : 'center';
1456
+ }
1457
+ function rectNow() {
1458
+ if (anchor.el && anchor.el.isConnected) {
1459
+ var r = rectOf(anchor.el);
1460
+ if (r.width || r.height) anchor.rect = r;
1461
+ }
1462
+ return anchor.rect;
1463
+ }
1464
+ var ro = null, raf = 0;
1465
+ function queue() { if (!raf) raf = requestAnimationFrame(function () { raf = 0; place(); }); }
1466
+ /** Put the panel beside the trigger, away from the nearest screen edge, fully on screen. */
1467
+ function place() {
1468
+ if (!scrim || !anchor || !scrim.classList.contains('anch')) return;
1469
+ var box = scrim.firstElementChild;
1470
+ if (!box) return;
1471
+ var vw = document.documentElement.clientWidth || window.innerWidth, vh = window.innerHeight, M = 12, G = 10;
1472
+ var w = Math.min(WIDTH, vw - 2 * M);
1473
+ box.style.width = w + 'px';
1474
+ box.style.maxHeight = Math.min(600, vh - 2 * M) + 'px';
1475
+ var h = box.offsetHeight, r = rectNow();
1476
+ var room = { right: vw - r.right, left: r.left, below: vh - r.bottom, above: r.top };
1477
+ var away = { left: 'right', right: 'left', top: 'below', bottom: 'above' };
1478
+ var edges = { left: r.left, right: vw - r.right, top: r.top, bottom: vh - r.bottom };
1479
+ var near = Object.keys(edges).sort(function (a, b) { return edges[a] - edges[b]; })[0];
1480
+ var sides = [away[near]].concat(['right', 'left', 'below', 'above'].filter(function (s) { return s !== away[near]; })
1481
+ .sort(function (a, b) { return room[b] - room[a]; }));
1482
+ var fits = function (s) { return room[s] >= ((s === 'right' || s === 'left') ? w : h) + G + M; };
1483
+ var side = sides.filter(fits)[0] || sides.slice().sort(function (a, b) { return room[b] - room[a]; })[0];
1484
+ var x, y;
1485
+ if (side === 'right' || side === 'left') {
1486
+ x = side === 'right' ? r.right + G : r.left - G - w;
1487
+ y = r.top + r.height / 2 > vh / 2 ? r.bottom - h : r.top;
1488
+ } else {
1489
+ y = side === 'below' ? r.bottom + G : r.top - G - h;
1490
+ x = r.left + r.width / 2 < vw / 2 ? r.left : r.right - w;
1491
+ }
1492
+ x = Math.max(M, Math.min(x, vw - M - w));
1493
+ y = Math.max(M, Math.min(y, vh - M - h));
1494
+ box.style.left = x + 'px';
1495
+ box.style.top = y + 'px';
1496
+ scrim.classList.toggle('t', y + h / 2 < vh / 2);
1497
+ if (typeof ResizeObserver === 'function') {
1498
+ if (!ro) ro = new ResizeObserver(queue);
1499
+ ro.disconnect();
1500
+ ro.observe(box);
1501
+ }
1349
1502
  }
1503
+
1504
+ ['pointerdown', 'click', 'keydown'].forEach(function (t) { document.addEventListener(t, markTrigger, true); });
1505
+ // A press outside the panel closes it (the bar's type menu first). The draft and type are kept.
1506
+ // Presses inside Heresay's own shadow DOM never count; its dimmed backdrop closes through its own click.
1507
+ document.addEventListener('pointerdown', function (e) {
1508
+ if (!scrim || !e.isTrusted) return;
1509
+ var path = pathOf(e), mine = path.indexOf(host) >= 0;
1510
+ if (barMenuClose) {
1511
+ var inMenu = path.some(function (n) { return n && n.classList && (n.classList.contains('bmenu') || n.classList.contains('tchip')); });
1512
+ if (!inMenu && barMenuClose()) { menuClosedAt = Date.now(); return; }
1513
+ }
1514
+ if (mine) return;
1515
+ closedBy = { el: recent && recent.el, t: Date.now() };
1516
+ close('outside');
1517
+ }, true);
1518
+ // Any element with data-heresay-open opens the panel from itself; the value may be a type.
1519
+ document.addEventListener('click', function (e) {
1520
+ var p = pathOf(e);
1521
+ if (p.indexOf(host) >= 0) return;
1522
+ var t = null;
1523
+ for (var i = 0; i < p.length && !t; i++) if (p[i] && p[i].nodeType === 1 && p[i].hasAttribute('data-heresay-open')) t = p[i];
1524
+ if (!t) return;
1525
+ if (t.tagName === 'A' && (!t.hasAttribute('href') || t.getAttribute('href') === '#')) e.preventDefault();
1526
+ if (scrim) { close(); return; }
1527
+ if (toggledOff(t)) return;
1528
+ window.Heresay.open({ type: (t.getAttribute('data-heresay-open') || '').toLowerCase().trim(), anchor: t });
1529
+ }, true);
1350
1530
  /** On a phone the bar docks above the keyboard: lift it by what the keyboard covers. */
1351
1531
  function keyboard() {
1352
1532
  if (!scrim) return;
@@ -1354,7 +1534,7 @@
1354
1534
  scrim.style.setProperty('--fb-kb', Math.max(0, Math.round(window.innerHeight - v.height - v.offsetTop)) + 'px');
1355
1535
  }
1356
1536
 
1357
- function close() {
1537
+ function close(how) {
1358
1538
  if (!scrim) return;
1359
1539
  if (view === 'mine') markSeen();
1360
1540
  if (window.visualViewport) {
@@ -1363,12 +1543,19 @@
1363
1543
  }
1364
1544
  scrim.remove();
1365
1545
  scrim = null;
1546
+ window.removeEventListener('scroll', queue, true);
1547
+ window.removeEventListener('resize', queue);
1548
+ if (ro) ro.disconnect();
1549
+ anchor = null;
1366
1550
  barMenuClose = null;
1367
1551
  listBox = null; hdDot = null; hdMine = null;
1368
1552
  state.justSent = false;
1369
1553
  prefsOpen = false;
1554
+ // Only an unsent message is kept. A type picked with nothing written is dropped, so the next
1555
+ // report never opens with last time's choice already selected.
1556
+ if (!String(state.draft || '').trim()) { state.type = null; state.draft = ''; }
1370
1557
  renderBadge();
1371
- if (lastFocus && lastFocus.focus) lastFocus.focus();
1558
+ if (how !== 'outside' && lastFocus && lastFocus.focus && lastFocus.isConnected !== false) lastFocus.focus();
1372
1559
  }
1373
1560
 
1374
1561
  var CLOSE_ICON = 'M6 6l12 12M18 6L6 18';
@@ -1396,7 +1583,7 @@
1396
1583
  scrim.className = surface();
1397
1584
  barMenuClose = null;
1398
1585
  hdDot = hdMine = null;
1399
- if (barUp()) { renderBar(); return; }
1586
+ if (barUp()) { renderBar(); place(); return; }
1400
1587
  var body, first, picking = LAYOUT === 'steps' && view === 'new' && !state.type;
1401
1588
  if (view === 'sent') body = sentView();
1402
1589
  else if (view === 'mine') body = listView();
@@ -1405,6 +1592,7 @@
1405
1592
  el('div', { class: 'grab', 'aria-hidden': 'true' }, [el('i')]), body, foot(picking),
1406
1593
  ]);
1407
1594
  scrim.appendChild(panel);
1595
+ place();
1408
1596
  renderBadge();
1409
1597
  first = panel.querySelector(view === 'sent' ? '.send' : view === 'mine' ? '.ib' : state.type ? 'textarea' : picking ? '.pick' : '[role=radio]');
1410
1598
  // On touch, a focused pill or row would look picked before anyone tapped it: focus the dialog itself.
@@ -1568,14 +1756,8 @@
1568
1756
  ]);
1569
1757
  }
1570
1758
 
1571
- // Closes the bar's type menu; set while the bar is showing, so a click elsewhere can close it.
1759
+ // Closes the bar's type menu and says whether it was open; set while the bar is showing.
1572
1760
  var barMenuClose = null;
1573
- document.addEventListener('pointerdown', function (e) {
1574
- if (!barMenuClose) return;
1575
- var path = e.composedPath ? e.composedPath() : [];
1576
- var inside = path.some(function (n) { return n && n.classList && (n.classList.contains('bmenu') || n.classList.contains('tchip')); });
1577
- if (!inside) barMenuClose();
1578
- }, true);
1579
1761
 
1580
1762
  /** Bar: one compact composer. [Type v] [text.....] (send), then Your reports, Powered by, close. */
1581
1763
  function renderBar() {
@@ -1626,9 +1808,10 @@
1626
1808
  items.forEach(function (b) { b.setAttribute('aria-checked', String(b.getAttribute('data-type') === state.type)); });
1627
1809
  };
1628
1810
  var shut = function (back) {
1629
- if (menu.hidden) return;
1811
+ if (menu.hidden) return false;
1630
1812
  menu.hidden = true; chip.setAttribute('aria-expanded', 'false');
1631
1813
  if (back) chip.focus();
1814
+ return true;
1632
1815
  };
1633
1816
  var show = function (last) {
1634
1817
  menu.hidden = false; chip.setAttribute('aria-expanded', 'true');
@@ -1906,7 +2089,7 @@
1906
2089
  done();
1907
2090
  var as = stuck ? 'confusing' : 'broken';
1908
2091
  if (!state.type && OFFERED.some(function (t) { return t.id === as; })) state.type = as;
1909
- open('new');
2092
+ open('new', { corner: true });
1910
2093
  } }),
1911
2094
  ]),
1912
2095
  foot(),
@@ -1943,9 +2126,10 @@
1943
2126
  /** Open the report form. { type, text } fill it in; the reporter still reviews and sends. */
1944
2127
  open: function (o) {
1945
2128
  o = o || {};
2129
+ if (!o.anchor && toggledOff()) return;
1946
2130
  if (OFFERED.some(function (t) { return t.id === o.type; })) state.type = o.type;
1947
2131
  if (o.text != null) state.draft = String(o.text).slice(0, 2000);
1948
- open('new');
2132
+ open('new', { anchor: o.anchor });
1949
2133
  },
1950
2134
  openPreferences: function () { if (PREFS_ROW) { prefsOpen = true; open('mine'); } },
1951
2135
  /** Show the one-time introduction now. False if it was already shown on this device. */
@@ -1960,6 +2144,6 @@
1960
2144
  listeners.push(fn);
1961
2145
  return function () { listeners = listeners.filter(function (f) { return f !== fn; }); };
1962
2146
  },
1963
- close: close,
2147
+ close: function () { close(); },
1964
2148
  };
1965
2149
  })();