@immense/vue-pom-generator 1.0.108 → 1.0.109
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/RELEASE_NOTES.md +31 -36
- package/dist/index.cjs +66 -147
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +66 -147
- package/dist/index.mjs.map +1 -1
- package/dist/plugin/runtime/annotator/client.d.ts +1 -1
- package/dist/plugin/runtime/annotator/client.d.ts.map +1 -1
- package/dist/plugin/runtime/annotator/styles.d.ts +1 -1
- package/dist/plugin/runtime/annotator/styles.d.ts.map +1 -1
- package/dist/tests/annotator-keyboard.test.d.ts +2 -0
- package/dist/tests/annotator-keyboard.test.d.ts.map +1 -0
- package/dist/tests/annotator-preview.test.d.ts +2 -0
- package/dist/tests/annotator-preview.test.d.ts.map +1 -0
- package/package.json +1 -1
- package/plugin/runtime/annotator/client.ts +23 -137
- package/plugin/runtime/annotator/styles.ts +43 -26
|
@@ -52,7 +52,6 @@ declare class AnnotatorRuntime {
|
|
|
52
52
|
private clampToolbarPosition;
|
|
53
53
|
private applyToolbarPosition;
|
|
54
54
|
private attachToolbarDrag;
|
|
55
|
-
private onWindowKeyDown;
|
|
56
55
|
private setInspectMode;
|
|
57
56
|
private stopInspectModePreservingPending;
|
|
58
57
|
private elementFromPoint;
|
|
@@ -63,6 +62,7 @@ declare class AnnotatorRuntime {
|
|
|
63
62
|
private attachFloating;
|
|
64
63
|
private openInputForDraft;
|
|
65
64
|
private openInputForExistingAnnotation;
|
|
65
|
+
private createPanelCloseButton;
|
|
66
66
|
private openPreview;
|
|
67
67
|
private openSettings;
|
|
68
68
|
private disposeCurrentPanel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../plugin/runtime/annotator/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAA8E,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAGzH,OAAO,EAA2B,KAAK,k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\n --vpg-annotator-accent: #4f46e5;\n --vpg-annotator-accent-strong: #4338ca;\n --vpg-annotator-bg: rgba(15, 23, 42, 0.96);\n --vpg-annotator-bg-soft: rgba(30, 41, 59, 0.96);\n --vpg-annotator-border: rgba(148, 163, 184, 0.28);\n --vpg-annotator-text: #e2e8f0;\n --vpg-annotator-text-soft: #94a3b8;\n --vpg-annotator-shadow: 0 16px 40px rgba(15, 23, 42, 0.26);\n --vpg-annotator-radius: 0px;\n --vpg-annotator-edge-offset: 20px;\n color: var(--vpg-annotator-text);\n font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n}\n\n[data-vpg-annotator-root],\n[data-vpg-annotator-root] *,\n[data-vpg-annotator-root] *::before,\n[data-vpg-annotator-root] *::after {\n box-sizing: border-box;\n}\n\n.vpg-annotator-layer {\n position: fixed;\n inset: 0;\n pointer-events: none;\n}\n\n.vpg-annotator-layer--markers {\n z-index: 2147483646;\n}\n\n.vpg-annotator-layer--panels {\n z-index: 2147483647;\n}\n\n.vpg-annotator-toolbar,\n.vpg-annotator-panel,\n.vpg-annotator-input,\n.vpg-annotator-settings,\n.vpg-annotator-toast {\n background: var(--vpg-annotator-bg);\n border: 1px solid var(--vpg-annotator-border);\n box-shadow: var(--vpg-annotator-shadow);\n backdrop-filter: blur(18px);\n}\n\n.vpg-annotator-toolbar {\n position: fixed;\n right: var(--vpg-annotator-edge-offset);\n bottom: var(--vpg-annotator-edge-offset);\n z-index: 2147483647;\n display: flex;\n gap: 8px;\n align-items: center;\n padding: 8px;\n border-radius: var(--vpg-annotator-radius);\n user-select: none;\n}\n\n.vpg-annotator-toolbar-handle,\n.vpg-annotator-btn {\n appearance: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 32px;\n min-height: 32px;\n padding: 7px 10px;\n border: 1px solid var(--vpg-annotator-border);\n border-radius: var(--vpg-annotator-radius);\n background: var(--vpg-annotator-bg-soft);\n color: var(--vpg-annotator-text);\n font-size: 12px;\n font-weight: 600;\n line-height: 1;\n}\n\n.vpg-annotator-toolbar-handle {\n padding: 0;\n cursor: grab;\n touch-action: none;\n}\n\n.vpg-annotator-toolbar--dragging,\n.vpg-annotator-toolbar--dragging * {\n cursor: grabbing !important;\n}\n\n.vpg-annotator-btn {\n cursor: pointer;\n}\n\n.vpg-annotator-btn--icon {\n width: 32px;\n padding: 0;\n}\n\n.vpg-annotator-btn:hover,\n.vpg-annotator-toolbar-handle:hover {\n border-color: rgba(99, 102, 241, 0.45);\n}\n\n.vpg-annotator-btn:disabled {\n opacity: 0.45;\n cursor: not-allowed;\n}\n\n.vpg-annotator-btn--primary,\n.vpg-annotator-btn[aria-pressed=\"true\"] {\n background: var(--vpg-annotator-accent);\n border-color: var(--vpg-annotator-accent);\n color: white;\n}\n\n.vpg-annotator-icon {\n width: 16px;\n height: 16px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n}\n\n.vpg-annotator-icon svg {\n width: 100%;\n height: 100%;\n display: block;\n fill: none;\n stroke: currentColor;\n stroke-width: 1.5;\n stroke-linecap: round;\n stroke-linejoin: round;\n}\n\n.vpg-annotator-count {\n padding-left: 4px;\n white-space: nowrap;\n}\n\n.vpg-annotator-panel,\n.vpg-annotator-input,\n.vpg-annotator-settings {\n position: fixed;\n z-index: 2147483647;\n min-width: 300px;\n max-width: min(560px, calc(100vw - 24px));\n border-radius: var(--vpg-annotator-radius);\n overflow: visible;\n pointer-events: auto;\n visibility: hidden;\n}\n\n.vpg-annotator-settings {\n min-width: 260px;\n max-width: min(320px, calc(100vw - 24px));\n}\n\n.vpg-annotator-arrow {\n position: absolute;\n z-index: 0;\n width: 14px;\n height: 14px;\n background: var(--vpg-annotator-bg);\n border: 1px solid var(--vpg-annotator-border);\n transform: rotate(45deg);\n}\n\n.vpg-annotator-panel[data-placement^=\"top\"] .vpg-annotator-arrow,\n.vpg-annotator-input[data-placement^=\"top\"] .vpg-annotator-arrow,\n.vpg-annotator-settings[data-placement^=\"top\"] .vpg-annotator-arrow {\n border-top: none;\n border-left: none;\n}\n\n.vpg-annotator-panel[data-placement^=\"bottom\"] .vpg-annotator-arrow,\n.vpg-annotator-input[data-placement^=\"bottom\"] .vpg-annotator-arrow,\n.vpg-annotator-settings[data-placement^=\"bottom\"] .vpg-annotator-arrow {\n border-right: none;\n border-bottom: none;\n}\n\n.vpg-annotator-panel[data-placement^=\"left\"] .vpg-annotator-arrow,\n.vpg-annotator-input[data-placement^=\"left\"] .vpg-annotator-arrow,\n.vpg-annotator-settings[data-placement^=\"left\"] .vpg-annotator-arrow {\n border-left: none;\n border-bottom: none;\n}\n\n.vpg-annotator-panel[data-placement^=\"right\"] .vpg-annotator-arrow,\n.vpg-annotator-input[data-placement^=\"right\"] .vpg-annotator-arrow,\n.vpg-annotator-settings[data-placement^=\"right\"] .vpg-annotator-arrow {\n border-top: none;\n border-right: none;\n}\n\n.vpg-annotator-panel-body,\n.vpg-annotator-input-body,\n.vpg-annotator-settings-body {\n position: relative;\n z-index: 1;\n padding: 14px;\n}\n\n.vpg-annotator-heading {\n margin: 0 0 6px;\n font-size: 13px;\n font-weight: 700;\n}\n\n.vpg-annotator-subtle {\n margin: 0;\n font-size: 12px;\n color: var(--vpg-annotator-text-soft);\n}\n\n.vpg-annotator-textarea,\n.vpg-annotator-comment,\n.vpg-annotator-select {\n width: 100%;\n border: 1px solid var(--vpg-annotator-border);\n border-radius: var(--vpg-annotator-radius);\n background: rgba(15, 23, 42, 0.72);\n color: var(--vpg-annotator-text);\n}\n\n.vpg-annotator-textarea,\n.vpg-annotator-comment {\n padding: 10px 12px;\n font-size: 12px;\n line-height: 1.55;\n}\n\n.vpg-annotator-textarea {\n min-height: 220px;\n margin-top: 12px;\n resize: vertical;\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;\n}\n\n.vpg-annotator-comment {\n min-height: 92px;\n resize: vertical;\n font-family: inherit;\n}\n\n.vpg-annotator-input-meta {\n min-height: 160px;\n margin-bottom: 10px;\n}\n\n.vpg-annotator-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n margin-top: 12px;\n}\n\n.vpg-annotator-actions {\n display: flex;\n gap: 8px;\n justify-content: flex-end;\n margin-top: 12px;\n}\n\n.vpg-annotator-field {\n display: grid;\n gap: 6px;\n margin-top: 12px;\n}\n\n.vpg-annotator-
|
|
2
|
+
export declare const ANNOTATOR_STYLES = "\n[data-vpg-annotator-root] {\n --vpg-annotator-accent: #4f46e5;\n --vpg-annotator-accent-strong: #4338ca;\n --vpg-annotator-bg: rgba(15, 23, 42, 0.96);\n --vpg-annotator-bg-soft: rgba(30, 41, 59, 0.96);\n --vpg-annotator-border: rgba(148, 163, 184, 0.28);\n --vpg-annotator-text: #e2e8f0;\n --vpg-annotator-text-soft: #94a3b8;\n --vpg-annotator-shadow: 0 16px 40px rgba(15, 23, 42, 0.26);\n --vpg-annotator-radius: 0px;\n --vpg-annotator-edge-offset: 20px;\n color: var(--vpg-annotator-text);\n font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n}\n\n[data-vpg-annotator-root],\n[data-vpg-annotator-root] *,\n[data-vpg-annotator-root] *::before,\n[data-vpg-annotator-root] *::after {\n box-sizing: border-box;\n}\n\n.vpg-annotator-layer {\n position: fixed;\n inset: 0;\n pointer-events: none;\n}\n\n.vpg-annotator-layer--markers {\n z-index: 2147483646;\n}\n\n.vpg-annotator-layer--panels {\n z-index: 2147483647;\n}\n\n.vpg-annotator-toolbar,\n.vpg-annotator-panel,\n.vpg-annotator-input,\n.vpg-annotator-settings,\n.vpg-annotator-toast {\n background: var(--vpg-annotator-bg);\n border: 1px solid var(--vpg-annotator-border);\n box-shadow: var(--vpg-annotator-shadow);\n backdrop-filter: blur(18px);\n}\n\n.vpg-annotator-toolbar {\n position: fixed;\n right: var(--vpg-annotator-edge-offset);\n bottom: var(--vpg-annotator-edge-offset);\n z-index: 2147483647;\n display: flex;\n gap: 8px;\n align-items: center;\n padding: 8px;\n border-radius: var(--vpg-annotator-radius);\n user-select: none;\n}\n\n.vpg-annotator-toolbar-handle,\n.vpg-annotator-btn {\n appearance: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 32px;\n min-height: 32px;\n padding: 7px 10px;\n border: 1px solid var(--vpg-annotator-border);\n border-radius: var(--vpg-annotator-radius);\n background: var(--vpg-annotator-bg-soft);\n color: var(--vpg-annotator-text);\n font-size: 12px;\n font-weight: 600;\n line-height: 1;\n}\n\n.vpg-annotator-toolbar-handle {\n padding: 0;\n cursor: grab;\n touch-action: none;\n}\n\n.vpg-annotator-toolbar--dragging,\n.vpg-annotator-toolbar--dragging * {\n cursor: grabbing !important;\n}\n\n.vpg-annotator-btn {\n cursor: pointer;\n}\n\n.vpg-annotator-btn--icon {\n width: 32px;\n padding: 0;\n}\n\n.vpg-annotator-btn:hover,\n.vpg-annotator-toolbar-handle:hover {\n border-color: rgba(99, 102, 241, 0.45);\n}\n\n.vpg-annotator-btn:disabled {\n opacity: 0.45;\n cursor: not-allowed;\n}\n\n.vpg-annotator-btn--primary,\n.vpg-annotator-btn[aria-pressed=\"true\"] {\n background: var(--vpg-annotator-accent);\n border-color: var(--vpg-annotator-accent);\n color: white;\n}\n\n.vpg-annotator-icon {\n width: 16px;\n height: 16px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n}\n\n.vpg-annotator-icon svg {\n width: 100%;\n height: 100%;\n display: block;\n fill: none;\n stroke: currentColor;\n stroke-width: 1.5;\n stroke-linecap: round;\n stroke-linejoin: round;\n}\n\n.vpg-annotator-count {\n padding-left: 4px;\n white-space: nowrap;\n}\n\n.vpg-annotator-panel,\n.vpg-annotator-input,\n.vpg-annotator-settings {\n position: fixed;\n z-index: 2147483647;\n min-width: 300px;\n max-width: min(560px, calc(100vw - 24px));\n border-radius: var(--vpg-annotator-radius);\n overflow: visible;\n pointer-events: auto;\n visibility: hidden;\n}\n\n.vpg-annotator-settings {\n min-width: 260px;\n max-width: min(320px, calc(100vw - 24px));\n}\n\n.vpg-annotator-panel--preview {\n min-width: min(720px, calc(100vw - 24px));\n max-width: min(940px, calc(100vw - 24px));\n}\n\n.vpg-annotator-panel--preview .vpg-annotator-textarea {\n height: min(52vh, 440px);\n resize: vertical;\n font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n white-space: pre;\n overflow: auto;\n}\n\n\n.vpg-annotator-arrow {\n position: absolute;\n z-index: 0;\n width: 14px;\n height: 14px;\n background: var(--vpg-annotator-bg);\n border: 1px solid var(--vpg-annotator-border);\n transform: rotate(45deg);\n}\n\n.vpg-annotator-panel[data-placement^=\"top\"] .vpg-annotator-arrow,\n.vpg-annotator-input[data-placement^=\"top\"] .vpg-annotator-arrow,\n.vpg-annotator-settings[data-placement^=\"top\"] .vpg-annotator-arrow {\n border-top: none;\n border-left: none;\n}\n\n.vpg-annotator-panel[data-placement^=\"bottom\"] .vpg-annotator-arrow,\n.vpg-annotator-input[data-placement^=\"bottom\"] .vpg-annotator-arrow,\n.vpg-annotator-settings[data-placement^=\"bottom\"] .vpg-annotator-arrow {\n border-right: none;\n border-bottom: none;\n}\n\n.vpg-annotator-panel[data-placement^=\"left\"] .vpg-annotator-arrow,\n.vpg-annotator-input[data-placement^=\"left\"] .vpg-annotator-arrow,\n.vpg-annotator-settings[data-placement^=\"left\"] .vpg-annotator-arrow {\n border-left: none;\n border-bottom: none;\n}\n\n.vpg-annotator-panel[data-placement^=\"right\"] .vpg-annotator-arrow,\n.vpg-annotator-input[data-placement^=\"right\"] .vpg-annotator-arrow,\n.vpg-annotator-settings[data-placement^=\"right\"] .vpg-annotator-arrow {\n border-top: none;\n border-right: none;\n}\n\n.vpg-annotator-panel-body,\n.vpg-annotator-input-body,\n.vpg-annotator-settings-body {\n position: relative;\n z-index: 1;\n padding: 14px;\n}\n\n.vpg-annotator-heading {\n margin: 0 0 6px;\n font-size: 13px;\n font-weight: 700;\n}\n\n.vpg-annotator-subtle {\n margin: 0;\n font-size: 12px;\n color: var(--vpg-annotator-text-soft);\n}\n\n.vpg-annotator-textarea,\n.vpg-annotator-comment,\n.vpg-annotator-select {\n width: 100%;\n border: 1px solid var(--vpg-annotator-border);\n border-radius: var(--vpg-annotator-radius);\n background: rgba(15, 23, 42, 0.72);\n color: var(--vpg-annotator-text);\n}\n\n.vpg-annotator-textarea,\n.vpg-annotator-comment {\n padding: 10px 12px;\n font-size: 12px;\n line-height: 1.55;\n}\n\n.vpg-annotator-textarea {\n min-height: 220px;\n margin-top: 12px;\n resize: vertical;\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;\n}\n\n.vpg-annotator-comment {\n min-height: 92px;\n resize: vertical;\n font-family: inherit;\n}\n\n.vpg-annotator-input-meta {\n min-height: 160px;\n margin-bottom: 10px;\n}\n\n.vpg-annotator-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n margin-top: 12px;\n}\n\n.vpg-annotator-actions {\n display: flex;\n gap: 8px;\n justify-content: flex-end;\n margin-top: 12px;\n}\n\n.vpg-annotator-field {\n display: grid;\n gap: 6px;\n margin-top: 12px;\n}\n\n.vpg-annotator-label {\n font-size: 12px;\n font-weight: 600;\n color: var(--vpg-annotator-text-soft);\n}\n\n.vpg-annotator-select,\n.vpg-annotator-checkbox {\n accent-color: var(--vpg-annotator-accent);\n}\n\n.vpg-annotator-select {\n padding: 8px 10px;\n}\n\n.vpg-annotator-highlight {\n position: fixed;\n z-index: 2147483646;\n pointer-events: none;\n border: 2px solid var(--vpg-annotator-accent);\n border-radius: var(--vpg-annotator-radius);\n background: rgba(79, 70, 229, 0.08);\n box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);\n}\n\n.vpg-annotator-highlight-label {\n position: absolute;\n left: 0;\n top: -30px;\n max-width: min(520px, calc(100vw - 24px));\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n border-radius: var(--vpg-annotator-radius);\n background: var(--vpg-annotator-accent);\n color: white;\n padding: 5px 10px;\n font-size: 12px;\n font-weight: 700;\n}\n\n.vpg-annotator-shield {\n position: fixed;\n inset: 0;\n z-index: 2147483645;\n background: transparent;\n cursor: crosshair;\n}\n\n.vpg-annotator-marker {\n position: absolute;\n z-index: 2147483646;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 24px;\n height: 24px;\n pointer-events: auto;\n border: none;\n border-radius: var(--vpg-annotator-radius);\n background: var(--vpg-annotator-accent);\n color: white;\n font-size: 12px;\n font-weight: 700;\n cursor: pointer;\n box-shadow: 0 8px 20px rgba(15, 23, 42, 0.28);\n}\n\n.vpg-annotator-toast {\n position: fixed;\n right: 24px;\n bottom: 86px;\n z-index: 2147483647;\n padding: 8px 12px;\n border-radius: var(--vpg-annotator-radius);\n color: var(--vpg-annotator-text);\n font-size: 12px;\n font-weight: 600;\n}\n\n.vpg-annotator-heading-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n}\n\n.vpg-annotator-heading-row .vpg-annotator-heading {\n margin-bottom: 4px;\n}\n\n.vpg-annotator-panel-close {\n margin-left: auto;\n background: transparent;\n border: none;\n color: var(--vpg-annotator-text-soft);\n font-size: 16px;\n line-height: 1;\n padding: 2px 6px;\n cursor: pointer;\n border-radius: var(--vpg-annotator-radius);\n}\n\n.vpg-annotator-panel-close:hover {\n color: var(--vpg-annotator-text);\n background: var(--vpg-annotator-bg-soft);\n}\n";
|
|
3
3
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../plugin/runtime/annotator/styles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,4BAA4B,CAAC;AAE7D,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../plugin/runtime/annotator/styles.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,4BAA4B,CAAC;AAE7D,eAAO,MAAM,gBAAgB,2yRAyY5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotator-keyboard.test.d.ts","sourceRoot":"","sources":["../../tests/annotator-keyboard.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotator-preview.test.d.ts","sourceRoot":"","sources":["../../tests/annotator-preview.test.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -41,49 +41,25 @@ interface ButtonOptions {
|
|
|
41
41
|
primary?: boolean;
|
|
42
42
|
pressed?: boolean;
|
|
43
43
|
disabled?: boolean;
|
|
44
|
-
shortcut?: string;
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
type ToolbarIconName = "drag" | "inspect" | "preview" | "copy" | "clear" | "settings";
|
|
48
47
|
|
|
49
48
|
const TOOLBAR_ICON_MARKUP: Record<ToolbarIconName, string> = {
|
|
50
49
|
drag: '<svg viewBox="0 0 16 16"><path d="M5 3h1v1H5zM10 3h1v1h-1zM5 7h1v1H5zM10 7h1v1h-1zM5 11h1v1H5zM10 11h1v1h-1z" fill="currentColor" stroke="none" /></svg>',
|
|
51
|
-
inspect: '<svg viewBox="0 0 16 16"><path d="M8
|
|
50
|
+
inspect: '<svg viewBox="0 0 16 16"><circle cx="8" cy="8" r="4.5"/><path d="M8 1v2.5M8 12.5v2.5M1 8h2.5M12.5 8h2.5"/><circle cx="8" cy="8" r="0.9" fill="currentColor" stroke="none"/></svg>',
|
|
52
51
|
preview: '<svg viewBox="0 0 16 16"><path d="M1.5 8s2.4-4 6.5-4 6.5 4 6.5 4-2.4 4-6.5 4-6.5-4-6.5-4Z"/><circle cx="8" cy="8" r="1.8"/></svg>',
|
|
53
52
|
copy: '<svg viewBox="0 0 16 16"><path d="M6 2.5h6.5v9H6z"/><path d="M3.5 5.5H5v6.5h5.5v1.5h-7z"/></svg>',
|
|
54
53
|
clear: '<svg viewBox="0 0 16 16"><path d="M2.5 4.5h11"/><path d="M6 2.5h4"/><path d="M5 4.5v8"/><path d="M8 4.5v8"/><path d="M11 4.5v8"/><path d="M4 4.5h8l-.6 9H4.6z"/></svg>',
|
|
55
54
|
settings: '<svg viewBox="0 0 16 16"><path d="M8 2.2l1 .6 1.2-.2.8 1 .9.7-.3 1.2.5 1-.5 1 .3 1.2-.9.7-.8 1-1.2-.2-1 .6-1-.6-1.2.2-.8-1-.9-.7.3-1.2-.5-1 .5-1-.3-1.2.9-.7.8-1 1.2.2z"/><circle cx="8" cy="8" r="2.2"/></svg>',
|
|
56
55
|
};
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
select: "S",
|
|
60
|
-
preview: "P",
|
|
61
|
-
copy: "C",
|
|
62
|
-
clear: "X",
|
|
63
|
-
settings: ",",
|
|
64
|
-
cancel: "Esc",
|
|
65
|
-
} as const;
|
|
66
|
-
|
|
67
|
-
function formatShortcutTitle(label: string, shortcut: string | undefined): string {
|
|
68
|
-
return shortcut ? `${label} (${shortcut})` : label;
|
|
69
|
-
}
|
|
57
|
+
|
|
70
58
|
|
|
71
59
|
function isInsideAnnotatorTree(node: EventTarget | null): boolean {
|
|
72
60
|
return node instanceof Element && !!node.closest(`[${ANNOTATOR_ROOT_ATTR}]`);
|
|
73
61
|
}
|
|
74
62
|
|
|
75
|
-
function isEditableTarget(node: EventTarget | null): boolean {
|
|
76
|
-
if (!(node instanceof Element)) {
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (node instanceof HTMLInputElement || node instanceof HTMLTextAreaElement || node instanceof HTMLSelectElement) {
|
|
81
|
-
return true;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return node.closest('[contenteditable=""], [contenteditable="true"]') !== null;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
63
|
function getElementSummary(element: Element): string {
|
|
88
64
|
const testId = element.getAttribute("data-testid");
|
|
89
65
|
if (testId) {
|
|
@@ -178,10 +154,7 @@ function createButtonBase(label: string, onClick: () => void, options: ButtonOpt
|
|
|
178
154
|
button.className = `vpg-annotator-btn${options.primary ? " vpg-annotator-btn--primary" : ""}`;
|
|
179
155
|
button.setAttribute(ANNOTATOR_ROOT_ATTR, "");
|
|
180
156
|
button.setAttribute("aria-label", label);
|
|
181
|
-
button.title =
|
|
182
|
-
if (options.shortcut) {
|
|
183
|
-
button.setAttribute("aria-keyshortcuts", options.shortcut);
|
|
184
|
-
}
|
|
157
|
+
button.title = label;
|
|
185
158
|
if (options.pressed) {
|
|
186
159
|
button.setAttribute("aria-pressed", "true");
|
|
187
160
|
}
|
|
@@ -282,8 +255,7 @@ class AnnotatorRuntime {
|
|
|
282
255
|
constructor(options: AnnotatorClientOptions) {
|
|
283
256
|
this.options = options;
|
|
284
257
|
this.settings = this.loadSettings();
|
|
285
|
-
this.annotations = this.loadAnnotations();
|
|
286
|
-
this.toolbarPosition = this.loadToolbarPosition();
|
|
258
|
+
this.annotations = this.loadAnnotations(); this.toolbarPosition = this.loadToolbarPosition();
|
|
287
259
|
}
|
|
288
260
|
|
|
289
261
|
mount() {
|
|
@@ -349,27 +321,22 @@ class AnnotatorRuntime {
|
|
|
349
321
|
|
|
350
322
|
const selectButton = createIconButton(this.inspectMode ? "Stop selecting" : "Select element", "inspect", () => {
|
|
351
323
|
this.setInspectMode(!this.inspectMode);
|
|
352
|
-
}, { primary: this.inspectMode, pressed: this.inspectMode
|
|
324
|
+
}, { primary: this.inspectMode, pressed: this.inspectMode });
|
|
353
325
|
|
|
354
326
|
const previewButton = createIconButton("Preview annotations", "preview", () => this.openPreview(), {
|
|
355
327
|
disabled: this.annotations.length === 0,
|
|
356
|
-
shortcut: SHORTCUT_LABELS.preview,
|
|
357
328
|
});
|
|
358
329
|
this.previewButton = previewButton;
|
|
359
330
|
|
|
360
331
|
const copyButton = createIconButton("Copy annotations", "copy", () => this.copyAnnotations(), {
|
|
361
332
|
disabled: this.annotations.length === 0,
|
|
362
|
-
shortcut: SHORTCUT_LABELS.copy,
|
|
363
333
|
});
|
|
364
334
|
|
|
365
335
|
const clearButton = createIconButton("Clear annotations", "clear", () => this.clearAnnotations(), {
|
|
366
336
|
disabled: this.annotations.length === 0,
|
|
367
|
-
shortcut: SHORTCUT_LABELS.clear,
|
|
368
337
|
});
|
|
369
338
|
|
|
370
|
-
const settingsButton = createIconButton("Annotator settings", "settings", () => this.openSettings()
|
|
371
|
-
shortcut: SHORTCUT_LABELS.settings,
|
|
372
|
-
});
|
|
339
|
+
const settingsButton = createIconButton("Annotator settings", "settings", () => this.openSettings());
|
|
373
340
|
this.settingsButton = settingsButton;
|
|
374
341
|
|
|
375
342
|
this.toolbarEl.append(handle, selectButton, previewButton, copyButton, clearButton, settingsButton, count);
|
|
@@ -403,7 +370,6 @@ class AnnotatorRuntime {
|
|
|
403
370
|
this.renderMarkers();
|
|
404
371
|
this.applyToolbarPosition();
|
|
405
372
|
});
|
|
406
|
-
window.addEventListener("keydown", (event) => this.onWindowKeyDown(event), true);
|
|
407
373
|
}
|
|
408
374
|
|
|
409
375
|
private loadSettings(): AnnotatorSettings {
|
|
@@ -552,69 +518,6 @@ class AnnotatorRuntime {
|
|
|
552
518
|
});
|
|
553
519
|
}
|
|
554
520
|
|
|
555
|
-
private onWindowKeyDown(event: KeyboardEvent) {
|
|
556
|
-
if (event.defaultPrevented || event.metaKey || event.ctrlKey || event.altKey) {
|
|
557
|
-
return;
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
if (event.key === "Escape") {
|
|
561
|
-
if (!this.inspectMode && !this.currentPanelEl) {
|
|
562
|
-
return;
|
|
563
|
-
}
|
|
564
|
-
event.preventDefault();
|
|
565
|
-
if (this.inspectMode) {
|
|
566
|
-
this.setInspectMode(false);
|
|
567
|
-
}
|
|
568
|
-
else {
|
|
569
|
-
this.closePanel();
|
|
570
|
-
}
|
|
571
|
-
return;
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
if (isEditableTarget(event.target)) {
|
|
575
|
-
return;
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
const key = event.key.toLowerCase();
|
|
579
|
-
if (key === SHORTCUT_LABELS.select.toLowerCase()) {
|
|
580
|
-
event.preventDefault();
|
|
581
|
-
this.setInspectMode(!this.inspectMode);
|
|
582
|
-
return;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
if (key === SHORTCUT_LABELS.preview.toLowerCase()) {
|
|
586
|
-
if (!this.annotations.length) {
|
|
587
|
-
return;
|
|
588
|
-
}
|
|
589
|
-
event.preventDefault();
|
|
590
|
-
this.openPreview();
|
|
591
|
-
return;
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
if (key === SHORTCUT_LABELS.copy.toLowerCase()) {
|
|
595
|
-
if (!this.annotations.length) {
|
|
596
|
-
return;
|
|
597
|
-
}
|
|
598
|
-
event.preventDefault();
|
|
599
|
-
void this.copyAnnotations();
|
|
600
|
-
return;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
if (key === SHORTCUT_LABELS.clear.toLowerCase()) {
|
|
604
|
-
if (!this.annotations.length) {
|
|
605
|
-
return;
|
|
606
|
-
}
|
|
607
|
-
event.preventDefault();
|
|
608
|
-
this.clearAnnotations();
|
|
609
|
-
return;
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
if (event.key === SHORTCUT_LABELS.settings) {
|
|
613
|
-
event.preventDefault();
|
|
614
|
-
this.openSettings();
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
|
|
618
521
|
private setInspectMode(next: boolean) {
|
|
619
522
|
this.inspectMode = next;
|
|
620
523
|
this.shieldEl.hidden = !next;
|
|
@@ -826,12 +729,23 @@ class AnnotatorRuntime {
|
|
|
826
729
|
this.openInputForDraft(reference);
|
|
827
730
|
}
|
|
828
731
|
|
|
732
|
+
private createPanelCloseButton(ariaLabel: string) {
|
|
733
|
+
const closeButton = document.createElement("button");
|
|
734
|
+
closeButton.type = "button";
|
|
735
|
+
closeButton.className = "vpg-annotator-panel-close";
|
|
736
|
+
closeButton.setAttribute(ANNOTATOR_ROOT_ATTR, "");
|
|
737
|
+
closeButton.setAttribute("aria-label", ariaLabel);
|
|
738
|
+
closeButton.textContent = "\u00D7";
|
|
739
|
+
closeButton.addEventListener("click", () => this.closePanel());
|
|
740
|
+
return closeButton;
|
|
741
|
+
}
|
|
742
|
+
|
|
829
743
|
private openPreview() {
|
|
830
744
|
if (!this.previewButton || this.annotations.length === 0) {
|
|
831
745
|
return;
|
|
832
746
|
}
|
|
833
747
|
|
|
834
|
-
const { panel, body, arrowEl } = this.createPanelBase("vpg-annotator-panel");
|
|
748
|
+
const { panel, body, arrowEl } = this.createPanelBase("vpg-annotator-panel vpg-annotator-panel--preview");
|
|
835
749
|
const title = document.createElement("div");
|
|
836
750
|
title.className = "vpg-annotator-heading";
|
|
837
751
|
title.textContent = "Annotation preview";
|
|
@@ -842,7 +756,10 @@ class AnnotatorRuntime {
|
|
|
842
756
|
textarea.className = "vpg-annotator-textarea";
|
|
843
757
|
textarea.readOnly = true;
|
|
844
758
|
textarea.value = formatAnnotations(this.annotations, this.settings.outputDetail, window.location.href);
|
|
845
|
-
|
|
759
|
+
const headerRow = document.createElement("div");
|
|
760
|
+
headerRow.className = "vpg-annotator-heading-row";
|
|
761
|
+
headerRow.append(title, this.createPanelCloseButton("Close preview"));
|
|
762
|
+
body.append(headerRow, subtitle, textarea);
|
|
846
763
|
|
|
847
764
|
this.showPanel(panel, () => this.attachFloating(this.previewButton!, panel, arrowEl, "top-start", ["top-start", "left-start", "top-end", "left-end"]));
|
|
848
765
|
}
|
|
@@ -887,38 +804,7 @@ class AnnotatorRuntime {
|
|
|
887
804
|
});
|
|
888
805
|
showComponentField.append(showComponentCopy, showComponentCheckbox);
|
|
889
806
|
|
|
890
|
-
|
|
891
|
-
shortcutsField.className = "vpg-annotator-field";
|
|
892
|
-
const shortcutsLabel = document.createElement("div");
|
|
893
|
-
shortcutsLabel.className = "vpg-annotator-label";
|
|
894
|
-
shortcutsLabel.textContent = "Keyboard shortcuts";
|
|
895
|
-
const shortcutsList = document.createElement("div");
|
|
896
|
-
shortcutsList.className = "vpg-annotator-shortcuts";
|
|
897
|
-
|
|
898
|
-
for (const [shortcut, description] of [
|
|
899
|
-
[SHORTCUT_LABELS.select, "Toggle selection mode"],
|
|
900
|
-
[SHORTCUT_LABELS.preview, "Open preview"],
|
|
901
|
-
[SHORTCUT_LABELS.copy, "Copy annotations"],
|
|
902
|
-
[SHORTCUT_LABELS.clear, "Clear annotations"],
|
|
903
|
-
[SHORTCUT_LABELS.settings, "Open settings"],
|
|
904
|
-
[SHORTCUT_LABELS.cancel, "Close panel / cancel selection"],
|
|
905
|
-
] as const) {
|
|
906
|
-
const row = document.createElement("div");
|
|
907
|
-
row.className = "vpg-annotator-shortcut-row";
|
|
908
|
-
const text = document.createElement("span");
|
|
909
|
-
text.className = "vpg-annotator-subtle";
|
|
910
|
-
text.textContent = description;
|
|
911
|
-
const kbd = document.createElement("kbd");
|
|
912
|
-
kbd.className = "vpg-annotator-kbd";
|
|
913
|
-
kbd.setAttribute(ANNOTATOR_ROOT_ATTR, "");
|
|
914
|
-
kbd.textContent = shortcut;
|
|
915
|
-
row.append(text, kbd);
|
|
916
|
-
shortcutsList.appendChild(row);
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
shortcutsField.append(shortcutsLabel, shortcutsList);
|
|
920
|
-
|
|
921
|
-
body.append(title, detailField, showComponentField, shortcutsField);
|
|
807
|
+
body.append(title, detailField, showComponentField);
|
|
922
808
|
this.showPanel(panel, () => this.attachFloating(this.settingsButton!, panel, arrowEl, "top-start", ["top-start", "left-start", "top-end", "left-end"]));
|
|
923
809
|
}
|
|
924
810
|
|
|
@@ -158,6 +158,20 @@ export const ANNOTATOR_STYLES = `
|
|
|
158
158
|
max-width: min(320px, calc(100vw - 24px));
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
+
.vpg-annotator-panel--preview {
|
|
162
|
+
min-width: min(720px, calc(100vw - 24px));
|
|
163
|
+
max-width: min(940px, calc(100vw - 24px));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.vpg-annotator-panel--preview .vpg-annotator-textarea {
|
|
167
|
+
height: min(52vh, 440px);
|
|
168
|
+
resize: vertical;
|
|
169
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
170
|
+
white-space: pre;
|
|
171
|
+
overflow: auto;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
|
|
161
175
|
.vpg-annotator-arrow {
|
|
162
176
|
position: absolute;
|
|
163
177
|
z-index: 0;
|
|
@@ -272,18 +286,6 @@ export const ANNOTATOR_STYLES = `
|
|
|
272
286
|
margin-top: 12px;
|
|
273
287
|
}
|
|
274
288
|
|
|
275
|
-
.vpg-annotator-shortcuts {
|
|
276
|
-
display: grid;
|
|
277
|
-
gap: 8px;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
.vpg-annotator-shortcut-row {
|
|
281
|
-
display: flex;
|
|
282
|
-
align-items: center;
|
|
283
|
-
justify-content: space-between;
|
|
284
|
-
gap: 12px;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
289
|
.vpg-annotator-label {
|
|
288
290
|
font-size: 12px;
|
|
289
291
|
font-weight: 600;
|
|
@@ -299,20 +301,6 @@ export const ANNOTATOR_STYLES = `
|
|
|
299
301
|
padding: 8px 10px;
|
|
300
302
|
}
|
|
301
303
|
|
|
302
|
-
.vpg-annotator-kbd {
|
|
303
|
-
min-width: 32px;
|
|
304
|
-
padding: 4px 8px;
|
|
305
|
-
border: 1px solid var(--vpg-annotator-border);
|
|
306
|
-
border-radius: var(--vpg-annotator-radius);
|
|
307
|
-
background: rgba(15, 23, 42, 0.72);
|
|
308
|
-
color: var(--vpg-annotator-text);
|
|
309
|
-
font: inherit;
|
|
310
|
-
font-size: 11px;
|
|
311
|
-
font-weight: 700;
|
|
312
|
-
line-height: 1;
|
|
313
|
-
text-align: center;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
304
|
.vpg-annotator-highlight {
|
|
317
305
|
position: fixed;
|
|
318
306
|
z-index: 2147483646;
|
|
@@ -344,6 +332,7 @@ export const ANNOTATOR_STYLES = `
|
|
|
344
332
|
inset: 0;
|
|
345
333
|
z-index: 2147483645;
|
|
346
334
|
background: transparent;
|
|
335
|
+
cursor: crosshair;
|
|
347
336
|
}
|
|
348
337
|
|
|
349
338
|
.vpg-annotator-marker {
|
|
@@ -376,4 +365,32 @@ export const ANNOTATOR_STYLES = `
|
|
|
376
365
|
font-size: 12px;
|
|
377
366
|
font-weight: 600;
|
|
378
367
|
}
|
|
368
|
+
|
|
369
|
+
.vpg-annotator-heading-row {
|
|
370
|
+
display: flex;
|
|
371
|
+
align-items: center;
|
|
372
|
+
justify-content: space-between;
|
|
373
|
+
gap: 8px;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.vpg-annotator-heading-row .vpg-annotator-heading {
|
|
377
|
+
margin-bottom: 4px;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
.vpg-annotator-panel-close {
|
|
381
|
+
margin-left: auto;
|
|
382
|
+
background: transparent;
|
|
383
|
+
border: none;
|
|
384
|
+
color: var(--vpg-annotator-text-soft);
|
|
385
|
+
font-size: 16px;
|
|
386
|
+
line-height: 1;
|
|
387
|
+
padding: 2px 6px;
|
|
388
|
+
cursor: pointer;
|
|
389
|
+
border-radius: var(--vpg-annotator-radius);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.vpg-annotator-panel-close:hover {
|
|
393
|
+
color: var(--vpg-annotator-text);
|
|
394
|
+
background: var(--vpg-annotator-bg-soft);
|
|
395
|
+
}
|
|
379
396
|
`;
|