Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

11.9 KB
Raw Blame
/**
 * Copyright (c) Microsoft Corporation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

:root {
  --annotations-blue: 54 116 209;
}

/* --annotation-color: each rect sets this inline to its own palette colour;
   falls back to the brand blue so draft / unstyled cases still read correctly. */
.annotations-layer,
.annotations-rect,
.annotations-popover,
.annotations-color-swatch {
  --annotation-color: var(--annotations-blue);
}

.annotations-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  outline: none;
  cursor: crosshair;
}

.annotations-layer::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.annotations-action-btn {
  height: 26px;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--color-neutral-subtle);
  color: var(--color-fg-default);
  border: 1px solid var(--color-border-muted);
  border-radius: 999px;
  cursor: pointer;
  line-height: 1;
}

:root.dark-mode .annotations-action-btn {
  background: var(--color-neutral-muted);
  border-color: var(--color-border-default);
}

.annotations-action-btn:hover:not(:disabled) {
  background: var(--color-neutral-muted);
}

.annotations-action-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.annotations-action-btn.danger {
  background: transparent;
  color: var(--color-danger-fg);
  border-color: var(--color-border-muted);
}

.annotations-action-btn.danger:hover:not(:disabled) {
  background: var(--color-danger-subtle);
}

.annotations-rect {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid rgb(var(--annotation-color));
  background: rgb(var(--annotation-color) / 0.12);
  cursor: pointer;
  transition: box-shadow 120ms ease;
}

.annotations-rect:hover {
  box-shadow: 0 0 0 3px rgb(var(--annotation-color) / 0.25);
}

.annotations-rect.selected {
  box-shadow: 0 0 0 3px rgb(var(--annotation-color) / 0.4);
  border-style: solid;
  border-color: rgb(var(--annotation-color));
  cursor: move;
}

.annotations-rect.draft {
  border-style: dashed;
  background: rgb(var(--annotation-color) / 0.18);
  pointer-events: none;
}

.annotations-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 1.5px solid rgb(var(--annotation-color));
  border-radius: 2px;
  box-sizing: border-box;
  z-index: 1;
}

.annotations-handle-nw { left: -6px; top: -6px; cursor: nwse-resize; }
.annotations-handle-n  { left: 50%; top: -6px; margin-left: -5px; cursor: ns-resize; }
.annotations-handle-ne { right: -6px; top: -6px; cursor: nesw-resize; }
.annotations-handle-e  { right: -6px; top: 50%; margin-top: -5px; cursor: ew-resize; }
.annotations-handle-se { right: -6px; bottom: -6px; cursor: nwse-resize; }
.annotations-handle-s  { left: 50%; bottom: -6px; margin-left: -5px; cursor: ns-resize; }
.annotations-handle-sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.annotations-handle-w  { left: -6px; top: 50%; margin-top: -5px; cursor: ew-resize; }

.annotations-label {
  position: absolute;
  top: -2px;
  left: -2px;
  max-width: calc(100% + 4px);
  padding: 2px 6px;
  background: rgb(var(--annotation-color));
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  border-radius: 2px 2px 2px 0;
  transform: translateY(-100%);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: text;
}

.annotations-label:hover {
  background: rgb(var(--annotation-color) / 0.85);
}

.annotations-popover {
  position: absolute;
  min-width: 220px;
  max-width: 320px;
  background: var(--color-canvas-overlay);
  border: 1px solid var(--color-border-default);
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
  cursor: default;
}

.annotations-textarea {
  width: 100%;
  min-height: 64px;
  resize: vertical;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 12px;
  color: var(--color-fg-default);
  background: var(--color-canvas-default);
  border: 1px solid var(--color-border-muted);
  border-radius: 6px;
  outline: none;
  box-sizing: border-box;
}

.annotations-textarea:focus {
  border-color: rgb(var(--annotation-color));
}

.annotations-popover-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.annotations-popover-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.annotations-color-picker {
  display: flex;
  align-items: center;
  gap: 4px;
}

.annotations-color-swatch {
  width: 14px;
  height: 14px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: rgb(var(--annotation-color));
  cursor: pointer;
  transition: box-shadow 120ms ease, transform 120ms ease;
}

.annotations-color-swatch:hover {
  box-shadow: 0 0 0 2px rgb(var(--annotation-color) / 0.35);
}

.annotations-color-swatch.selected {
  border-color: var(--color-fg-default);
  transform: scale(1.1);
}

.annotate-modal-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  box-shadow: 0 0 0 1px var(--color-border-muted), 0 0 8px var(--color-border-muted);
}


/* -- Annotate sidebar -- */
.annotate-sidebar {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-canvas-subtle);
  border-left: 1px solid var(--color-border-muted);
  min-height: 0;
}

.annotate-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: 40px;
  min-height: 40px;
  padding: 0 8px;
  border-bottom: 1px solid var(--color-border-muted);
  background: var(--color-canvas-overlay);
}

:root.light-mode .annotate-sidebar-header {
  background: var(--color-canvas-subtle);
}

.annotate-sidebar-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.annotate-sidebar-thumb {
  position: relative;
  flex-shrink: 0;
  border: 1px solid var(--color-border-muted);
  border-radius: 6px;
  background: var(--color-canvas-default);
  overflow: hidden;
}

.annotate-sidebar-thumb:hover {
  border-color: var(--color-border-default);
}

.annotate-sidebar-thumb.selected {
  border-color: var(--color-accent-fg, #2f81f7);
  box-shadow: 0 0 0 1px var(--color-accent-fg, #2f81f7);
}

.annotate-sidebar-thumb-button {
  display: block;
  width: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.annotate-sidebar-thumb-img-wrap {
  position: relative;
  display: block;
  width: 100%;
  background: var(--color-canvas-overlay);
  overflow: hidden;
}

.annotate-sidebar-thumb-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.annotate-sidebar-thumb-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.annotate-sidebar-thumb-rect {
  position: absolute;
  border: 1.5px solid rgb(var(--annotation-color));
  background: rgb(var(--annotation-color) / 0.12);
  border-radius: 2px;
  pointer-events: none;
  box-sizing: border-box;
}

.annotate-sidebar-thumb-rect.hovered {
  background: rgb(var(--annotation-color) / 0.32);
}

.annotate-sidebar-thumb-remove.toolbar-button {
  position: absolute;
  top: 4px;
  right: 4px;
  padding: 2px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 120ms ease;
  z-index: 1;
}

.annotate-sidebar-thumb-remove.toolbar-button:not(:disabled):hover {
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
}

.annotate-sidebar-thumb:hover .annotate-sidebar-thumb-remove,
.annotate-sidebar-thumb-remove:focus-visible {
  opacity: 1;
}

.annotate-sidebar-comments {
  list-style: none;
  margin: 0;
  padding: 4px 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.annotate-sidebar-comment {
  display: block;
  width: 100%;
  text-align: left;
  background: rgb(var(--annotation-color) / 0.12);
  border: 1px solid rgb(var(--annotation-color) / 0.35);
  border-radius: 4px;
  color: var(--color-fg-default);
  font-size: 11px;
  line-height: 1.4;
  padding: 3px 6px;
  cursor: pointer;
  white-space: pre-wrap;
  word-break: break-word;
}

.annotate-sidebar-comment:hover {
  background: rgb(var(--annotation-color) / 0.2);
}

.annotate-sidebar-comment.empty {
  color: var(--color-fg-muted);
  font-style: italic;
}

/* auto-grow textarea: the wrapper mirrors content in ::after so the grid row
   expands to fit, and the textarea fills the same cell */
.annotate-sidebar-feedback-wrap {
  display: grid;
  margin: 8px 8px 4px;
  flex-shrink: 0;
}

.annotate-sidebar-feedback-wrap::after {
  content: attr(data-value) ' ';
  white-space: pre-wrap;
  word-break: break-word;
  visibility: hidden;
  /* same box-model as the textarea */
  padding: 6px 8px;
  font-size: 12px;
  font-family: inherit;
  border: 1px solid transparent;
  border-radius: 4px;
  min-height: 56px;
  grid-area: 1 / 1 / 2 / 2;
}

.annotate-sidebar-feedback {
  grid-area: 1 / 1 / 2 / 2;
  padding: 6px 8px;
  background: var(--vscode-input-background, #1e1e1e);
  color: var(--vscode-input-foreground, #cccccc);
  border: 1px solid var(--color-border-muted);
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  resize: none;
  min-height: 56px;
  overflow: hidden;
  outline: none;
}

.annotate-sidebar-feedback:focus {
  border-color: var(--vscode-focusBorder, #007fd4);
}

.annotate-sidebar-submit {
  margin: 4px 8px 8px;
  padding: 8px 12px;
  background: var(--color-accent-fg, #2f81f7);
  color: white;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  flex-shrink: 0;
}

.annotate-sidebar-submit:hover:not(:disabled) {
  filter: brightness(1.05);
}

.annotate-sidebar-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* -- Annotate overlay (drawn on top of the live screen) -- */
.annotate-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.55);
  z-index: 100;
  min-height: 0;
}

.annotate-overlay-window {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border-default);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  background: var(--color-canvas-default);
  min-height: 0;
}

.annotate-overlay-chrome {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 40px;
  min-height: 40px;
  padding: 0 8px;
  background: var(--color-canvas-overlay);
  border-bottom: 1px solid var(--color-border-muted);
}

:root.light-mode .annotate-overlay-chrome {
  background: var(--color-canvas-subtle);
}

.annotate-overlay-titlebar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 4px;
  font-size: 13px;
  color: var(--color-fg-default);
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.annotate-overlay-title-text {
  font-weight: 500;
  color: var(--color-fg-default);
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  max-width: 40%;
}

.annotate-overlay-title-sep {
  color: var(--color-fg-subtle);
}

.annotate-overlay-title-url {
  flex: 1;
  font-family: var(--monospace-font, monospace);
  font-size: 12px;
  color: var(--color-fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.annotate-overlay-canvas {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 12px;
  background: var(--color-canvas-default);
}