diff --git a/web/app/assets/css/main.css b/web/app/assets/css/main.css index 3c1ee09b..77208997 100644 --- a/web/app/assets/css/main.css +++ b/web/app/assets/css/main.css @@ -68,7 +68,8 @@ --diff-added: oklch(53.282% 0.16399 143.531 / 0.3); --diff-removed: oklch(57.909% 0.23191 28.689 / 0.3); - --diff-modified: oklch(70% 0.12 270 / 0.2); + --diff-added-foreground: oklch(42% 0.13 143.5); + --diff-removed-foreground: oklch(45% 0.18 28.7); --diff-text-added: oklch(53.282% 0.16399 143.531 / 0.3); --diff-text-removed: oklch(57.909% 0.23191 28.689 / 0.3); --diff-field-added: oklch(53.282% 0.16399 143.531 / 0.2); @@ -238,7 +239,8 @@ --diff-added: oklch(64.522% 0.20475 143.722 / 0.25); --diff-removed: oklch(49.991% 0.1933 29.256 / 0.25); - --diff-modified: oklch(70% 0.12 270 / 0.3); + --diff-added-foreground: oklch(82% 0.15 143.7); + --diff-removed-foreground: oklch(80% 0.1 29.3); --diff-text-added: oklch(64.522% 0.20475 143.722 / 0.25); --diff-text-removed: oklch(49.991% 0.1933 29.256 / 0.25); --diff-field-added: oklch(64.522% 0.20475 143.722 / 0.2); @@ -350,7 +352,8 @@ --color-diff-added: var(--diff-added); --color-diff-removed: var(--diff-removed); - --color-diff-modified: var(--diff-modified); + --color-diff-added-foreground: var(--diff-added-foreground); + --color-diff-removed-foreground: var(--diff-removed-foreground); --color-diff-text-added: var(--diff-text-added); --color-diff-text-removed: var(--diff-text-removed); --color-diff-field-added: var(--diff-field-added); @@ -664,10 +667,6 @@ @apply bg-diff-removed; } -.diff-modified { - @apply bg-diff-modified; -} - .diff-overlay-anchor { @apply relative; } @@ -684,8 +683,8 @@ @apply rounded-md bg-diff-removed; } -.diff-overlay.diff-modified { - @apply rounded-md bg-diff-modified; +li.diff-checkbox-changed > label { + @apply rounded-sm bg-diff-added outline-[0.15em] outline-diff-added; } .diff-text-added { @@ -698,15 +697,13 @@ /* horizontal rules: pseudo-element overlay around the thin line */ hr.diff-added, -hr.diff-removed, -hr.diff-modified { +hr.diff-removed { @apply relative overflow-visible; background: none; } hr.diff-added::before, -hr.diff-removed::before, -hr.diff-modified::before { +hr.diff-removed::before { @apply pointer-events-none absolute rounded-md; content: ""; inset: -0.5em -0.2em -0.4em -0.2em; @@ -719,7 +716,3 @@ hr.diff-added::before { hr.diff-removed::before { @apply bg-diff-removed; } - -hr.diff-modified::before { - @apply bg-diff-modified; -} diff --git a/web/app/components/editor/attribute-names.ts b/web/app/components/editor/attribute-names.ts new file mode 100644 index 00000000..476c8d82 --- /dev/null +++ b/web/app/components/editor/attribute-names.ts @@ -0,0 +1,4 @@ +// node attribute name constants to avoid circular import issues between +// editor modules + +export const NODE_COMMENT_ID_ATTR = "nodeCommentId" diff --git a/web/app/components/editor/blocks/figma/FigmaBlock.nuxt.test.ts b/web/app/components/editor/blocks/figma/FigmaBlock.nuxt.test.ts index bc740f70..7ce6fce6 100644 --- a/web/app/components/editor/blocks/figma/FigmaBlock.nuxt.test.ts +++ b/web/app/components/editor/blocks/figma/FigmaBlock.nuxt.test.ts @@ -137,7 +137,6 @@ describe("", { concurrent: false }, () => { it.for([ { status: "added", expected: "diff-added" }, { status: "removed", expected: "diff-removed" }, - { status: "modified", expected: "diff-modified" }, ])( "marks a $status embed with its diff overlay", async ({ status, expected }, { expect }) => { @@ -147,6 +146,21 @@ describe("", { concurrent: false }, () => { }, ) + it("counts a modified embed's changes instead of tinting it", async ({ + expect, + }) => { + const wrapper = await mountFigma({ + src: FIGMA_URL, + diffStatus: "modified", + oldNode: { attrs: { uid: "figma-1", src: OTHER_FIGMA_URL } }, + }) + + expect(wrapper.find(".diff-overlay").exists()).toBe(false) + expect(wrapper.text()).toContain( + t("editor.diff-change-marker.label", { removed: 1, added: 1 }), + ) + }) + it("shows no diff overlay on an unchanged embed", async ({ expect }) => { const wrapper = await mountFigma({ src: FIGMA_URL, diff --git a/web/app/components/editor/blocks/figma/FigmaBlock.vue b/web/app/components/editor/blocks/figma/FigmaBlock.vue index ee68d82a..3f7be025 100644 --- a/web/app/components/editor/blocks/figma/FigmaBlock.vue +++ b/web/app/components/editor/blocks/figma/FigmaBlock.vue @@ -3,6 +3,7 @@ import { nodeViewProps, NodeViewWrapper } from "@tiptap/vue-3" import { computePosition, flip, offset, shift } from "@floating-ui/dom" import { cn } from "~/lib/utils" import { DiffStatus } from "~/components/editor/diff/position-map" +import DiffChangeMarker from "~/components/editor/diff/DiffChangeMarker.vue" import { isFigmaUrl, convertToEmbedUrl } from "./index" const props = defineProps(nodeViewProps) @@ -35,8 +36,6 @@ const diffClass = computed(() => { return "diff-added" case DiffStatus.Removed: return "diff-removed" - case DiffStatus.Modified: - return "diff-modified" default: return null } @@ -263,6 +262,7 @@ onBeforeUnmount(() => { :style="{ height: `${displayHeight}px` }" allowfullscreen /> +