@daybook/feedback 1.2.2 → 1.3.0

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/dist/widget.js CHANGED
@@ -18,6 +18,8 @@ export class FeedbackWidget {
18
18
  this.mode = 'idle';
19
19
  this.anchor = null;
20
20
  this.detach = [];
21
+ /** Which of the five shapes the launcher takes. */
22
+ this.buttonStyle = 'pill';
21
23
  /** How far the host page's own floating buttons push us out of that corner. */
22
24
  this.clearance = 0;
23
25
  /**
@@ -77,15 +79,8 @@ export class FeedbackWidget {
77
79
  style.textContent = '';
78
80
  return;
79
81
  }
80
- const declarations = [];
81
- // Each value is validated against a shape rather than passed through. A colour that is not a
82
- // colour would otherwise close the property and let the rest of the string be read as CSS.
83
- if (isColor(theme.accent))
84
- declarations.push(`--pm-accent: ${theme.accent}`);
85
- const radius = { none: '0', sm: '6px', md: '12px', lg: '18px' }[theme.cornerRadius ?? 'md'];
86
- if (radius)
87
- declarations.push(`--pm-radius: ${radius}`);
88
- style.textContent = declarations.length > 0 ? `:host { ${declarations.join('; ')} }` : '';
82
+ style.textContent = themeVars(theme);
83
+ this.buttonStyle = buttonStyleOf(theme);
89
84
  // The corner is deliberately NOT written here. Where the widget sits is decided by one method
90
85
  // that also has to account for the host page's furniture, and two style blocks both claiming
91
86
  // --pm-bottom is how the second one silently wins.
@@ -274,16 +269,69 @@ export class FeedbackWidget {
274
269
  return { offered: true, checked: asked !== 'optional' };
275
270
  }
276
271
  /**
277
- * Takes the widget off the screen and hands back the undo.
272
+ * Takes the widget off the screen, rings what the report is about, and hands back the undo.
278
273
  *
279
- * For the screen capture. Everything here lives in one host element, so hiding is one property —
280
- * and it is `visibility`, not `display`, because removing the panel from layout would reflow the
281
- * host page underneath it and the picture would be of a page that never existed.
274
+ * For the screen capture. It is `visibility`, not `display`, because removing the panel from
275
+ * layout would reflow the host page underneath it and the picture would be of a page that never
276
+ * existed.
277
+ *
278
+ * The UI hides but the host element stays visible, because the ring is drawn inside it. That is
279
+ * the whole reason to do it here rather than on the page: a report used to arrive as a selector,
280
+ * a text snapshot and a picture of a whole screen, leaving whoever read it to work out which of
281
+ * forty things on that screen the sentence was about. Now the picture says.
282
282
  */
283
283
  conceal() {
284
- const previous = this.host.style.visibility;
285
- this.host.style.visibility = 'hidden';
286
- return () => { this.host.style.visibility = previous; };
284
+ const layer = this.root.getElementById('layer');
285
+ const previous = layer.style.visibility;
286
+ layer.style.visibility = 'hidden';
287
+ const ring = this.ringAnchor();
288
+ return () => {
289
+ layer.style.visibility = previous;
290
+ ring?.remove();
291
+ };
292
+ }
293
+ /**
294
+ * A ring over the pinned element, drawn in our own shadow root.
295
+ *
296
+ * Not on the element itself. Setting a style on somebody else's node means fighting their
297
+ * specificity, risking a reflow that changes the picture being taken, and owning the undo — and
298
+ * the undo is the part that bites: hidePrivate already exists to blur private fields for a frame,
299
+ * and its comment is about exactly this, that a page left permanently altered because a capture
300
+ * threw is worse than the bug being reported. A rectangle in our own layer touches nothing.
301
+ *
302
+ * No scrim over the rest, tempting as it is. A screenshot is also the record of what the page
303
+ * looked like, and dimming it changes the colours in a report that may well be about the colours.
304
+ * The ring is doubled — red, white, red — so it carries on a dark page and on a light one without
305
+ * altering either.
306
+ *
307
+ * Resolved at capture time rather than at pick time: the composer may have been open for a while,
308
+ * and where the element is NOW is where the picture will show it.
309
+ */
310
+ ringAnchor() {
311
+ const selector = this.anchor?.selector;
312
+ if (!selector)
313
+ return null;
314
+ let target = null;
315
+ try {
316
+ target = document.querySelector(selector);
317
+ }
318
+ catch {
319
+ // A selector the page has since invalidated. No ring beats an exception mid-capture.
320
+ return null;
321
+ }
322
+ if (!target)
323
+ return null;
324
+ const rect = target.getBoundingClientRect();
325
+ if (rect.width < 1 || rect.height < 1)
326
+ return null;
327
+ const ring = document.createElement('div');
328
+ ring.className = 'ring';
329
+ ring.style.left = `${rect.left - RING_PAD}px`;
330
+ ring.style.top = `${rect.top - RING_PAD}px`;
331
+ ring.style.width = `${rect.width + RING_PAD * 2}px`;
332
+ ring.style.height = `${rect.height + RING_PAD * 2}px`;
333
+ this.root.appendChild(ring);
334
+ return ring;
287
335
  }
288
336
  /**
289
337
  * Makes the panel draggable by its header, and snaps it to a side when it is let go near one.
@@ -468,9 +516,7 @@ export class FeedbackWidget {
468
516
  return note;
469
517
  }
470
518
  launcher() {
471
- const button = document.createElement('button');
472
- button.className = 'launcher';
473
- button.textContent = this.launcherLabel ?? 'Feedback';
519
+ const button = launcherButton(this.buttonStyle, this.launcherLabel ?? 'Feedback');
474
520
  button.title = this.options.hotkey === null
475
521
  ? 'Report a problem'
476
522
  : `Report a problem (${(this.options.hotkey ?? 'f').toUpperCase()})`;
@@ -547,7 +593,7 @@ export class FeedbackWidget {
547
593
  <div id="status" class="status"></div>
548
594
 
549
595
  <div class="panel__foot">
550
- <span class="panel__note">Sends the page, your browser, and recent errors.</span>
596
+ <span class="panel__note">Sends this page's contents, your browser, and recent errors.</span>
551
597
  <button id="cancel" class="ghost">Cancel</button>
552
598
  <button id="send" class="primary">Send</button>
553
599
  </div>`;
@@ -746,6 +792,8 @@ export async function copyText(text) {
746
792
  }
747
793
  /** The margin every edge of the widget keeps from the frame. */
748
794
  const EDGE = 16;
795
+ /** How far the ring sits outside the element it marks, so it frames rather than covers. */
796
+ const RING_PAD = 3;
749
797
  /** Enough of the header must stay reachable to drag it back. */
750
798
  const HANDLE = 56;
751
799
  /**
@@ -808,20 +856,137 @@ function isColor(value) {
808
856
  return typeof value === 'string'
809
857
  && /^(#[0-9a-f]{3,8}|rgba?\([\d\s.,%/]+\)|hsla?\([\d\s.,%/deg]+\)|[a-z]{3,20})$/i.test(value.trim());
810
858
  }
859
+ /**
860
+ * The two palettes, as declaration lists.
861
+ *
862
+ * Written once and used twice: the stylesheet takes them for its default and its media query, and a
863
+ * workspace that has chosen light or dark takes the same string for the theme block. Two copies of
864
+ * fourteen colours would agree on the day they were written and not for long after.
865
+ */
866
+ /**
867
+ * The mark, inline.
868
+ *
869
+ * A speech bubble because it is the one shape nobody has to be taught. Drawn with currentColor so
870
+ * it belongs to whichever preset it is in — filled white on a pill, accent-coloured in an outline.
871
+ */
872
+ const ICON = '<svg class="launcher__icon" viewBox="0 0 16 16" fill="none" aria-hidden="true">'
873
+ + '<path d="M2 6.2C2 4.4 3.4 3 5.2 3h5.6C12.6 3 14 4.4 14 6.2v2.6c0 1.8-1.4 3.2-3.2 3.2H7l-3 2.4'
874
+ + 'v-2.5A3.2 3.2 0 0 1 2 8.8V6.2Z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round"/></svg>';
875
+ /**
876
+ * A theme, as the declarations it becomes. Shared so the preview cannot drift from the real thing.
877
+ *
878
+ * Every value is validated against a shape rather than passed through: a colour that is not a
879
+ * colour would otherwise close the property and let the rest of the string be read as CSS, and this
880
+ * string arrives from a server.
881
+ */
882
+ function themeVars(theme) {
883
+ const declarations = [];
884
+ if (isColor(theme.accent))
885
+ declarations.push(`--pm-accent: ${theme.accent}`);
886
+ const radius = { none: '0', sm: '6px', md: '12px', lg: '18px' }[theme.cornerRadius ?? 'md'];
887
+ if (radius)
888
+ declarations.push(`--pm-radius: ${radius}`);
889
+ // System is the default and is what the base stylesheet already does, so "auto" writes nothing at
890
+ // all. Only a workspace that has overruled the reader gets a palette pinned here — where it beats
891
+ // the media query by being a later stylesheet at the same specificity.
892
+ if (theme.colorScheme === 'dark')
893
+ declarations.push(DARK);
894
+ else if (theme.colorScheme === 'light')
895
+ declarations.push(LIGHT);
896
+ return declarations.length > 0 ? `:host { ${declarations.join('; ')} }` : '';
897
+ }
898
+ const buttonStyleOf = (theme) => BUTTON_STYLES.includes(theme.buttonStyle)
899
+ ? theme.buttonStyle
900
+ : 'pill';
901
+ /**
902
+ * The launcher, as an element. One builder, so the settings screen shows the real button.
903
+ *
904
+ * The icon is markup rather than a font or an image: one is a network request on somebody else's
905
+ * page and the other is a glyph that may not be there. The label is escaped on the way in — it
906
+ * arrives from the handshake, and everything from there is treated as data.
907
+ */
908
+ function launcherButton(style, label) {
909
+ const button = document.createElement('button');
910
+ button.className = `launcher launcher--${style}`;
911
+ if (style === 'icon') {
912
+ button.innerHTML = ICON;
913
+ // Nothing to read, so the name has to come from somewhere. Without this the button is announced
914
+ // as "button" and a screen reader user has no idea what it does.
915
+ button.setAttribute('aria-label', label);
916
+ }
917
+ else if (style === 'pill-icon') {
918
+ button.innerHTML = `${ICON}<span>${escapeHtml(label)}</span>`;
919
+ }
920
+ else {
921
+ button.textContent = label;
922
+ }
923
+ return button;
924
+ }
925
+ /**
926
+ * Draws the launcher, and only the launcher, inside an element you own.
927
+ *
928
+ * For a settings screen that has to show what a theme will look like before anybody saves it. It is
929
+ * the real button with the real stylesheet in a real shadow root: a second implementation in the
930
+ * console's own CSS would be a picture of the widget rather than the widget, and would begin lying
931
+ * the first time either one changed.
932
+ *
933
+ * Nothing else comes with it — no handshake, no listeners, no page-level positioning — so it is
934
+ * safe to call ten times on one screen. Call it again to change the theme; it replaces what it drew.
935
+ */
936
+ export function previewLauncher(into, theme = {}) {
937
+ const root = into.shadowRoot ?? into.attachShadow({ mode: 'open' });
938
+ const label = typeof theme.launcherLabel === 'string' && theme.launcherLabel.length > 0
939
+ ? theme.launcherLabel.slice(0, 24)
940
+ : 'Feedback';
941
+ root.innerHTML = `<style>${STYLES}</style><style>${themeVars(theme)}</style>`;
942
+ const button = launcherButton(buttonStyleOf(theme), label);
943
+ // In place, not pinned to the viewport: the caller is laying these out in a row.
944
+ button.classList.add('launcher--preview');
945
+ button.disabled = true;
946
+ root.appendChild(button);
947
+ }
948
+ /** The button shapes a workspace can choose between. Anything else falls back to the first. */
949
+ const BUTTON_STYLES = ['pill', 'pill-icon', 'icon', 'text', 'outline'];
950
+ const LIGHT = '--pm-surface: #fff; --pm-ink: #171717; --pm-muted: #525252; --pm-faint: #a3a3a3; --pm-line: #e5e5e5; --pm-line-strong: #d4d4d4; --pm-sunken: #f5f5f5; --pm-kbd: #404040; --pm-warn: #b45309; --pm-good: #047857; --pm-good-bg: #ecfdf5; --pm-good-line: #a7f3d0; --pm-accent: #171717; --pm-on-accent: #fafafa;';
951
+ const DARK = '--pm-surface: #1c1c1c; --pm-ink: #fafafa; --pm-muted: #a3a3a3; --pm-faint: #737373; --pm-line: #333; --pm-line-strong: #454545; --pm-sunken: #262626; --pm-kbd: #d4d4d4; --pm-warn: #fbbf24; --pm-good: #34d399; --pm-good-bg: #05271f; --pm-good-line: #065f46; --pm-accent: #fafafa; --pm-on-accent: #171717;';
811
952
  const STYLES = `
953
+ /*
954
+ Every colour in this file is one of these, and there are two sets of them.
955
+
956
+ Not for fashion: the widget is a panel laid over somebody else's page, and a white card on a dark
957
+ application is a flashbang. It followed the host's scheme in exactly one respect before — it did
958
+ not, and was always light.
959
+
960
+ System is the default and costs no JavaScript: the media query below is in the base stylesheet, so
961
+ a widget nobody has configured tracks the reader's own setting. A workspace that picks light or
962
+ dark gets those values written into the theme block instead, which is a later stylesheet at the
963
+ same specificity and therefore wins over the query.
964
+
965
+ The accent pair is inverse emphasis — a dark pill on a light page, a light pill on a dark one —
966
+ because the launcher sits on the HOST page rather than on our panel, and a near-black button on a
967
+ near-black application is a button nobody finds. A host that sets its own accent gets white text
968
+ on it, unchanged from before; we cannot compute contrast in CSS and guessing wrong is worse than
969
+ the one case where a very pale brand colour needs its own care.
970
+ */
812
971
  :host {
813
972
  all: initial;
814
973
 
815
- /* Defaults, overridden by the theme block the handshake fills in.
816
- Offsets rather than a keyword: a custom property can hold a value, not a property name, so
817
- "put it on the left" has to be four numbers and not one word. */
818
- --pm-accent: #171717;
974
+ ${LIGHT}
975
+
819
976
  --pm-radius: 12px;
977
+
978
+ /* Offsets rather than a keyword: a custom property can hold a value, not a property name, so
979
+ "put it on the left" has to be four numbers and not one word. */
820
980
  --pm-left: auto;
821
981
  --pm-right: 16px;
822
982
  --pm-top: auto;
823
983
  --pm-bottom: 16px;
824
984
  }
985
+
986
+ @media (prefers-color-scheme: dark) {
987
+ :host { ${DARK} }
988
+ }
989
+ }
825
990
  * { box-sizing: border-box; font-family: system-ui, -apple-system, sans-serif }
826
991
  @media (prefers-reduced-motion: reduce) { .launcher { transition: none } }
827
992
  #layer { position: fixed; inset: 0; pointer-events: none }
@@ -833,16 +998,67 @@ const STYLES = `
833
998
  reads as a bug. Honoured only where motion is welcome. */
834
999
  transition: bottom .18s ease, top .18s ease;
835
1000
  padding: 9px 14px; border: 0; border-radius: 999px; cursor: pointer;
836
- background: var(--pm-accent); color: #fafafa; font-size: 13px; font-weight: 500;
1001
+ background: var(--pm-accent); color: var(--pm-on-accent); font-size: 13px; font-weight: 500;
837
1002
  box-shadow: 0 2px 12px rgba(0,0,0,.3);
838
1003
  }
839
1004
  .launcher:hover { filter: brightness(1.15) }
840
1005
  .launcher--pending { cursor: default; opacity: .85 }
841
1006
  .launcher--pending:hover { filter: none }
1007
+ .launcher__icon { flex: none; width: 15px; height: 15px; display: block }
1008
+ /* For previewLauncher: in the flow of a settings page rather than pinned to a corner. */
1009
+ .launcher--preview { position: static; cursor: default; opacity: 1 }
1010
+
1011
+ /*
1012
+ Five buttons, because one button cannot be right for every page it is a guest on.
1013
+
1014
+ A product with its own bold chat bubble does not want a second bold pill beside it; a spare
1015
+ documentation site does not want a filled button at all; a dense application often wants the
1016
+ smallest possible mark. The set is deliberately small — five things somebody can look at and
1017
+ choose between in a moment, rather than a colour picker and a padding field.
1018
+
1019
+ Every one of them keeps the same hit area at the same corner, so the clearance measurement and
1020
+ the placement work unchanged whichever is picked.
1021
+ */
1022
+ .launcher { display: inline-flex; align-items: center; gap: 7px }
1023
+
1024
+ /* Filled and round. The default, and the one that reads as a product feature. */
1025
+ .launcher--pill {}
1026
+
1027
+ /* The same, with the icon in front for pages where a word alone reads as body text. */
1028
+ .launcher--pill-icon {}
1029
+
1030
+ /* The mark on its own, for a corner that is already busy. */
1031
+ .launcher--icon { padding: 10px; border-radius: 999px }
1032
+
1033
+ /* No fill at all. For a page whose own furniture is quiet and would be shouted over. */
1034
+ .launcher--text {
1035
+ background: transparent; color: var(--pm-ink); box-shadow: none;
1036
+ padding: 6px 8px; text-decoration: underline; text-underline-offset: 3px;
1037
+ }
1038
+ .launcher--text:hover { filter: none; color: var(--pm-accent) }
1039
+
1040
+ /* Outlined: present without being loud, and it inherits the accent rather than filling with it. */
1041
+ .launcher--outline {
1042
+ background: transparent; color: var(--pm-accent);
1043
+ border: 1px solid currentColor; box-shadow: none;
1044
+ }
1045
+ .launcher--outline:hover { filter: none; background: var(--pm-sunken) }
842
1046
  .mask {
843
1047
  position: fixed; inset: 0; pointer-events: auto; cursor: crosshair;
844
1048
  background: rgba(23,23,23,.12);
845
1049
  }
1050
+ /*
1051
+ The pinned element, ringed for the screenshot.
1052
+
1053
+ Three rings rather than one: a red line alone disappears against a red button, and a white one
1054
+ disappears against a white card. Red, then white, then a soft red — one of the three is always
1055
+ against something it contrasts with, on any page, without touching that page's own colours.
1056
+ */
1057
+ .ring {
1058
+ position: fixed; pointer-events: none; border-radius: 3px;
1059
+ border: 2px solid #ef4444;
1060
+ box-shadow: 0 0 0 2px rgba(255,255,255,.85), 0 0 0 5px rgba(239,68,68,.35);
1061
+ }
846
1062
  /*
847
1063
  Bottom, not top.
848
1064
 
@@ -854,18 +1070,18 @@ const STYLES = `
854
1070
  */
855
1071
  .hint {
856
1072
  position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%);
857
- padding: 7px 12px; border-radius: 8px; background: #171717; color: #fafafa;
1073
+ padding: 7px 12px; border-radius: 8px; background: var(--pm-ink); color: var(--pm-on-accent);
858
1074
  font-size: 12px; white-space: nowrap;
859
1075
  }
860
1076
  kbd {
861
- padding: 1px 5px; border-radius: 4px; background: #404040;
1077
+ padding: 1px 5px; border-radius: 4px; background: var(--pm-kbd); color: var(--pm-surface);
862
1078
  font-family: ui-monospace, monospace; font-size: 11px;
863
1079
  }
864
1080
  .panel {
865
1081
  position: fixed; width: 380px; max-width: calc(100vw - 32px); pointer-events: auto;
866
1082
  left: var(--pm-left); right: var(--pm-right);
867
1083
  top: var(--pm-top); bottom: var(--pm-bottom);
868
- padding: 16px; border-radius: var(--pm-radius); background: #fff; color: #171717;
1084
+ padding: 16px; border-radius: var(--pm-radius); background: var(--pm-surface); color: var(--pm-ink);
869
1085
  box-shadow: 0 8px 32px rgba(0,0,0,.24); font-size: 13px;
870
1086
  }
871
1087
  .panel__head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px }
@@ -881,29 +1097,29 @@ kbd {
881
1097
  */
882
1098
  .drag { cursor: grab; touch-action: none; user-select: none }
883
1099
  .drag:active { cursor: grabbing }
884
- .panel__grip { flex: none; color: #bdbdbd; font-size: 15px; line-height: 16px; letter-spacing: -1px }
885
- .drag:hover .panel__grip { color: #a3a3a3 }
1100
+ .panel__grip { flex: none; color: var(--pm-faint); font-size: 15px; line-height: 16px; letter-spacing: -1px }
1101
+ .drag:hover .panel__grip { color: var(--pm-muted) }
886
1102
  .panel--dragging { box-shadow: 0 16px 48px rgba(0,0,0,.32); opacity: .92 }
887
1103
 
888
1104
  /* An incomplete report, said plainly. Amber rather than red: the words arrived. */
889
- .sent__warn { margin-top: 6px; color: #b45309; font-size: 11px; line-height: 1.4 }
1105
+ .sent__warn { margin-top: 6px; color: var(--pm-warn); font-size: 11px; line-height: 1.4 }
890
1106
 
891
1107
  /* The anchor leads: it is what the reporter pointed at, and the part they need to recognise. */
892
1108
  .panel__anchor {
893
- color: #737373; font-size: 11px;
1109
+ color: var(--pm-muted); font-size: 11px;
894
1110
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
895
1111
  }
896
1112
  .panel__close {
897
1113
  margin-left: auto; border: 0; background: none; cursor: pointer;
898
- color: #a3a3a3; font-size: 20px; line-height: 1; padding: 0 2px;
1114
+ color: var(--pm-faint); font-size: 20px; line-height: 1; padding: 0 2px;
899
1115
  }
900
- .panel__close:hover { color: #171717 }
1116
+ .panel__close:hover { color: var(--pm-ink) }
901
1117
 
902
1118
  /* A confirmation, not a form. */
903
1119
  .panel--sent { display: flex; align-items: flex-start; gap: 10px }
904
1120
  .sent__tick {
905
1121
  flex: none; width: 24px; height: 24px; border-radius: 999px;
906
- background: #ecfdf5; color: #047857;
1122
+ background: var(--pm-good-bg); color: var(--pm-good);
907
1123
  display: grid; place-items: center; font-size: 14px;
908
1124
  }
909
1125
  .sent__body { min-width: 0 }
@@ -912,28 +1128,28 @@ kbd {
912
1128
  .sent__ref { display: flex; align-items: center; gap: 6px; margin: 4px 0 2px }
913
1129
  .sent__id {
914
1130
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
915
- color: #171717; background: #f5f5f5; border-radius: 5px; padding: 2px 6px;
1131
+ color: var(--pm-ink); background: var(--pm-sunken); border-radius: 5px; padding: 2px 6px;
916
1132
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
917
1133
  }
918
1134
  .sent__copy {
919
- flex: none; border: 1px solid #e5e5e5; border-radius: 6px; background: #fff;
920
- color: #525252; cursor: pointer; font-size: 11px; padding: 3px 8px;
1135
+ flex: none; border: 1px solid var(--pm-line); border-radius: 6px; background: var(--pm-surface);
1136
+ color: var(--pm-muted); cursor: pointer; font-size: 11px; padding: 3px 8px;
921
1137
  }
922
- .sent__copy:hover { border-color: #a3a3a3; color: #171717 }
923
- .sent__copy--done { border-color: #a7f3d0; background: #ecfdf5; color: #047857 }
1138
+ .sent__copy:hover { border-color: var(--pm-faint); color: var(--pm-ink) }
1139
+ .sent__copy--done { border-color: var(--pm-good-line); background: var(--pm-good-bg); color: var(--pm-good) }
924
1140
 
925
1141
  .panel__kinds { display: flex; gap: 6px; margin: 8px 0 }
926
1142
  .kind {
927
- flex: 1; padding: 5px 0; border: 1px solid #e5e5e5; border-radius: 7px;
928
- background: #fff; color: #525252; cursor: pointer; font-size: 12px; text-transform: capitalize;
1143
+ flex: 1; padding: 5px 0; border: 1px solid var(--pm-line); border-radius: 7px;
1144
+ background: var(--pm-surface); color: var(--pm-muted); cursor: pointer; font-size: 12px; text-transform: capitalize;
929
1145
  }
930
- .kind--on { border-color: #171717; background: #171717; color: #fff }
1146
+ .kind--on { border-color: var(--pm-ink); background: var(--pm-ink); color: var(--pm-surface) }
931
1147
  textarea, input[type=email] {
932
- width: 100%; padding: 8px; margin-bottom: 8px; border: 1px solid #e5e5e5;
933
- border-radius: 8px; font-size: 13px; resize: vertical; color: #171717; background: #fff;
1148
+ width: 100%; padding: 8px; margin-bottom: 8px; border: 1px solid var(--pm-line);
1149
+ border-radius: 8px; font-size: 13px; resize: vertical; color: var(--pm-ink); background: var(--pm-surface);
934
1150
  }
935
- textarea:focus, input:focus { outline: 2px solid #171717; outline-offset: -1px }
936
- .shot { display: flex; align-items: center; gap: 6px; color: #525252; font-size: 12px }
1151
+ textarea:focus, input:focus { outline: 2px solid var(--pm-ink); outline-offset: -1px }
1152
+ .shot { display: flex; align-items: center; gap: 6px; color: var(--pm-muted); font-size: 12px }
937
1153
 
938
1154
  /*
939
1155
  One row. Cancel used to sit ABOVE Send in a stacked span, which read as a label for it rather than
@@ -941,16 +1157,16 @@ textarea:focus, input:focus { outline: 2px solid #171717; outline-offset: -1px }
941
1157
  */
942
1158
  .panel__foot {
943
1159
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
944
- padding-top: 12px; border-top: 1px solid #f0f0f0;
1160
+ padding-top: 12px; border-top: 1px solid var(--pm-sunken);
945
1161
  }
946
- .panel__note { flex: 1; color: #a3a3a3; font-size: 10px; line-height: 1.3 }
1162
+ .panel__note { flex: 1; color: var(--pm-faint); font-size: 10px; line-height: 1.3 }
947
1163
  .primary, .ghost {
948
1164
  padding: 6px 12px; border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 500;
949
1165
  }
950
- .primary { border: 0; background: #171717; color: #fff }
1166
+ .primary { border: 0; background: var(--pm-ink); color: var(--pm-surface) }
951
1167
  .primary:disabled { opacity: .5; cursor: default }
952
- .ghost { border: 0; background: transparent; color: #737373 }
953
- .status { margin-top: 6px; color: #b45309; font-size: 11px; min-height: 0 }
1168
+ .ghost { border: 0; background: transparent; color: var(--pm-muted) }
1169
+ .status { margin-top: 6px; color: var(--pm-warn); font-size: 11px; min-height: 0 }
954
1170
  /*
955
1171
  One attachment area, holding both ways of adding a picture. They were a checkbox and a dropzone
956
1172
  stacked — two affordances for one job, and together the busiest part of a panel whose busiest part
@@ -958,16 +1174,16 @@ textarea:focus, input:focus { outline: 2px solid #171717; outline-offset: -1px }
958
1174
  */
959
1175
  .drop {
960
1176
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
961
- margin-top: 8px; padding: 8px 10px; border: 1px dashed #d4d4d4; border-radius: 8px;
962
- color: #a3a3a3; font-size: 11px;
1177
+ margin-top: 8px; padding: 8px 10px; border: 1px dashed var(--pm-line-strong); border-radius: 8px;
1178
+ color: var(--pm-faint); font-size: 11px;
963
1179
  }
964
- .drop__or { color: #a3a3a3 }
965
- .drop--over { border-color: #171717; color: #171717; background: #fafafa }
1180
+ .drop__or { color: var(--pm-faint) }
1181
+ .drop--over { border-color: var(--pm-ink); color: var(--pm-ink); background: var(--pm-sunken) }
966
1182
  .files { display: flex; flex-direction: column; gap: 4px; margin-top: 8px }
967
- .file { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #525252 }
968
- .file--bad { color: #b45309 }
1183
+ .file { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--pm-muted) }
1184
+ .file--bad { color: var(--pm-warn) }
969
1185
  .file img { width: 28px; height: 28px; object-fit: cover; border-radius: 4px }
970
1186
  .file__icon { width: 28px; text-align: center }
971
1187
  .file__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
972
- .link { border: 0; background: transparent; color: #525252; cursor: pointer; font-size: 11px; text-decoration: underline }
1188
+ .link { border: 0; background: transparent; color: var(--pm-muted); cursor: pointer; font-size: 11px; text-decoration: underline }
973
1189
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daybook/feedback",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "description": "In-app feedback for the web: point at what is wrong, and everything a triager needs is captured automatically.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",