@vivix-labs/ads-compare 0.0.0-stage → 1.0.0-beta

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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 VIVIX
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,136 @@
1
+ /* packages/studio-workbench/src/ad-comparison-picker.css */
2
+ .ad-video-picker.vx-dialog {
3
+ width: min(860px, calc(100vw - 32px));
4
+ max-width: calc(100vw - 32px);
5
+ height: min(720px, calc(100dvh - 48px));
6
+ max-height: calc(100dvh - 48px);
7
+ display: flex;
8
+ flex-direction: column;
9
+ overflow: hidden;
10
+ }
11
+ .ad-video-picker .vx-dialog-body {
12
+ display: flex;
13
+ flex-direction: column;
14
+ gap: 20px;
15
+ min-height: 0;
16
+ flex: 1;
17
+ overflow-y: auto;
18
+ }
19
+ .ad-video-picker-toolbar {
20
+ position: sticky;
21
+ top: 0;
22
+ z-index: 1;
23
+ flex-shrink: 0;
24
+ background: var(--vx-background-dialog);
25
+ display: flex;
26
+ align-items: center;
27
+ justify-content: space-between;
28
+ gap: 16px;
29
+ }
30
+ .ad-video-picker-toolbar .vx-search-input {
31
+ width: min(100%, 340px);
32
+ }
33
+ .ad-video-picker-toolbar > span,
34
+ .ad-video-choice-meta,
35
+ .ad-video-picker-empty {
36
+ color: var(--vx-text-secondary-readable);
37
+ font-size: 12px;
38
+ }
39
+ .ad-video-picker-toolbar > span {
40
+ white-space: nowrap;
41
+ }
42
+ .ad-video-picker-grid {
43
+ display: grid;
44
+ grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
45
+ gap: 20px 16px;
46
+ }
47
+ .ad-video-choice {
48
+ display: flex;
49
+ flex-direction: column;
50
+ gap: 6px;
51
+ min-width: 0;
52
+ padding: 0 0 8px;
53
+ border: 0;
54
+ border-radius: 10px;
55
+ text-align: left;
56
+ font: inherit;
57
+ color: var(--vx-text-primary);
58
+ background: transparent;
59
+ cursor: pointer;
60
+ }
61
+ .ad-video-choice:focus-visible {
62
+ outline: 2px solid var(--vx-media-selection-color, #568b72);
63
+ outline-offset: 4px;
64
+ }
65
+ .ad-video-choice:disabled {
66
+ cursor: default;
67
+ }
68
+ .ad-video-choice-preview {
69
+ position: relative;
70
+ display: flex;
71
+ align-items: center;
72
+ justify-content: center;
73
+ width: 100%;
74
+ aspect-ratio: 1;
75
+ overflow: hidden;
76
+ border-radius: 8px;
77
+ background: var(--vx-surface-input);
78
+ color: var(--vx-text-secondary-readable);
79
+ font-size: 12px;
80
+ }
81
+ .ad-video-choice-preview video {
82
+ width: 100%;
83
+ height: 100%;
84
+ object-fit: contain;
85
+ transition: transform 150ms ease;
86
+ }
87
+ .ad-video-choice:not(:disabled):hover .ad-video-choice-preview video {
88
+ transform: scale(1.025);
89
+ }
90
+ .ad-video-choice[aria-pressed=true] .ad-video-choice-preview {
91
+ box-shadow: inset 0 0 0 2px var(--vx-media-selection-color, #568b72);
92
+ }
93
+ .ad-video-choice:disabled .ad-video-choice-preview {
94
+ opacity: 0.6;
95
+ }
96
+ .ad-video-choice-duration {
97
+ position: absolute;
98
+ right: 8px;
99
+ bottom: 8px;
100
+ padding: 2px 4px;
101
+ border-radius: 4px;
102
+ background: #0009;
103
+ color: #fff;
104
+ font-size: 11px;
105
+ }
106
+ .ad-video-choice-title {
107
+ font-size: 14px;
108
+ font-weight: 600;
109
+ }
110
+ .ad-video-choice-state {
111
+ font-size: 12px;
112
+ color: var(--vx-media-selection-color, #568b72);
113
+ }
114
+ .ad-video-choice:disabled .ad-video-choice-state {
115
+ color: var(--vx-text-secondary-readable);
116
+ }
117
+ .ad-video-picker-empty {
118
+ margin: 24px 0;
119
+ text-align: center;
120
+ }
121
+ @media (max-width: 480px) {
122
+ .ad-video-picker-toolbar {
123
+ align-items: stretch;
124
+ flex-direction: column;
125
+ gap: 8px;
126
+ }
127
+ .ad-video-picker-grid {
128
+ grid-template-columns: repeat(2, minmax(0, 1fr));
129
+ gap: 16px 12px;
130
+ }
131
+ }
132
+ @media (prefers-reduced-motion: reduce) {
133
+ .ad-video-choice-preview video {
134
+ transition: none;
135
+ }
136
+ }
@@ -0,0 +1,271 @@
1
+ // packages/studio-workbench/src/ad-view-panels.tsx
2
+ import * as React3 from "react";
3
+
4
+ // packages/ui-system/dist/button.js
5
+ import { jsx as _jsx2, jsxs as _jsxs } from "react/jsx-runtime";
6
+
7
+ // packages/ui-system/dist/icon.js
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ function Icon({ name, size }) {
10
+ return _jsx("span", { "aria-hidden": "true", className: "vx-icon", "data-icon": name, style: size === void 0 ? void 0 : { "--vx-icon-size": `${size}px` } });
11
+ }
12
+
13
+ // packages/ui-system/dist/button-variants.js
14
+ var buttonVariants = {
15
+ "text-filled-sm": { size: 32, appearance: "filled", shape: "text", width: 215 },
16
+ "text-filled-leading-sm": { size: 32, appearance: "filled", shape: "text" },
17
+ "text-ghost-sm": { size: 32, appearance: "ghost", shape: "text" },
18
+ "text-on-content-sm": { size: 32, appearance: "on-content", shape: "text" },
19
+ "text-tonal-sm": { size: 32, appearance: "tonal", shape: "text" },
20
+ // The medium recipes are shared by all dialog footer actions.
21
+ "text-filled-md": { size: 40, appearance: "filled", shape: "text" },
22
+ "text-tonal-md": { size: 40, appearance: "tonal", shape: "text" },
23
+ "text-ghost-md": { size: 40, appearance: "ghost", shape: "text" },
24
+ "icon-ghost-md": { size: 40, appearance: "ghost", shape: "icon" },
25
+ "text-filled-lg": { size: 44, appearance: "filled", shape: "text", width: 412 },
26
+ "text-tonal-lg": { size: 44, appearance: "tonal", shape: "text", width: 412 },
27
+ "text-outline-lg": {
28
+ size: 44,
29
+ appearance: "outline",
30
+ shape: "text",
31
+ width: 412
32
+ },
33
+ "pill-filled": { size: 44, appearance: "filled", shape: "pill" },
34
+ "pill-plain": { size: 48, appearance: "plain", shape: "pill" },
35
+ "pill-small": { size: 32, appearance: "plain", shape: "pill" },
36
+ "icon-outline-sm": { size: 32, appearance: "outline", shape: "icon" },
37
+ "icon-on-content": { size: 24, appearance: "on-content", shape: "icon" },
38
+ "icon-outline-lg": { size: 48, appearance: "outline", shape: "icon" },
39
+ // Compact bare action: reuse the transparent/default and surface-hover ghost treatment.
40
+ "icon-bare-xs": { size: 24, appearance: "ghost", shape: "icon" },
41
+ "icon-ghost-sm": { size: 32, appearance: "ghost", shape: "icon" },
42
+ "icon-ghost-lg": { size: 48, appearance: "ghost", shape: "icon" },
43
+ "icon-circle-sm": { size: 32, appearance: "filled", shape: "circle" },
44
+ "icon-circle-lg": { size: 44, appearance: "filled", shape: "circle" }
45
+ };
46
+
47
+ // packages/ui-system/dist/button.js
48
+ function ButtonFrame({ label, variant, loading = false, width, children, disabled, type = "button", style, className, ...props }) {
49
+ const spec = buttonVariants[variant];
50
+ const buttonStyle = "width" in spec ? { ...style, "--vx-button-width": `${spec.width}px` } : style;
51
+ return _jsxs("button", { ...props, type, className: className ? `vx-button ${className}` : "vx-button", "data-variant": variant, "data-appearance": spec.appearance, "data-shape": spec.shape, "data-size": spec.size, "data-width": width, "data-state": loading ? "loading" : disabled ? "disabled" : "default", style: buttonStyle, disabled: disabled || loading, "aria-label": label, "aria-busy": loading || void 0, children: [_jsx2("span", { className: "vx-button-content", children }), loading && _jsx2("span", { className: "vx-button-loading", "aria-hidden": "true" })] });
52
+ }
53
+ function Button({ variant = "text-filled-sm", leadingIcon, trailingIcon, ...props }) {
54
+ return _jsxs(ButtonFrame, { ...props, variant, children: [leadingIcon && _jsx2(Icon, { name: leadingIcon }), _jsx2("span", { className: "vx-button-label", children: props.label }), trailingIcon && _jsx2("span", { className: "vx-button-trailing", children: _jsx2(Icon, { name: trailingIcon }) })] });
55
+ }
56
+ function IconButton({ icon, variant = "icon-ghost-sm", ...props }) {
57
+ return _jsx2(ButtonFrame, { ...props, variant, children: _jsx2(Icon, { name: icon }) });
58
+ }
59
+
60
+ // packages/ui-system/dist/search-input.js
61
+ import { jsx as _jsx3, jsxs as _jsxs2 } from "react/jsx-runtime";
62
+ import { useRef, useState } from "react";
63
+ function SearchInput({ label, value, onValueChange, size = "medium", placeholder = "Type to search...", ...props }) {
64
+ const input = useRef(null);
65
+ const composing = useRef(false);
66
+ const [draft, setDraft] = useState(null);
67
+ return _jsxs2("div", { className: "vx-search-input", "data-size": size, children: [_jsx3(Icon, { name: "search" }), _jsx3("input", { ...props, ref: input, type: "search", "aria-label": label, placeholder, value: draft ?? value, onChange: (event) => {
68
+ const next = event.currentTarget.value;
69
+ if (composing.current)
70
+ setDraft(next);
71
+ else if (next !== value)
72
+ onValueChange(next);
73
+ }, onCompositionStart: (event) => {
74
+ composing.current = true;
75
+ setDraft(event.currentTarget.value);
76
+ }, onCompositionEnd: (event) => {
77
+ composing.current = false;
78
+ setDraft(null);
79
+ if (event.currentTarget.value !== value)
80
+ onValueChange(event.currentTarget.value);
81
+ } }), (draft ?? value) && _jsx3(IconButton, { icon: "clear", label: `Clear ${label}`, className: "vx-search-clear", disabled: props.disabled, onClick: () => {
82
+ onValueChange("");
83
+ input.current?.focus();
84
+ } })] });
85
+ }
86
+
87
+ // packages/ui-system/dist/dialog.js
88
+ import { jsx as _jsx4, jsxs as _jsxs3 } from "react/jsx-runtime";
89
+ import { useEffect, useId, useLayoutEffect, useRef as useRef2 } from "react";
90
+ function Dialog({ title, open, onOpenChange, children, actions, className }) {
91
+ const ref = useRef2(null);
92
+ const heading = useId();
93
+ useEffect(() => {
94
+ const dialog = ref.current;
95
+ if (!dialog || dialog.open === open)
96
+ return;
97
+ if (open)
98
+ dialog.showModal();
99
+ else
100
+ dialog.close();
101
+ }, [open]);
102
+ useLayoutEffect(() => {
103
+ const dialog = ref.current;
104
+ return () => {
105
+ if (dialog?.open)
106
+ dialog.close();
107
+ };
108
+ }, []);
109
+ return _jsxs3("dialog", { ref, className: className ? `vx-dialog ${className}` : "vx-dialog", "aria-labelledby": heading, onCancel: (event) => {
110
+ event.preventDefault();
111
+ event.stopPropagation();
112
+ onOpenChange(false);
113
+ }, onClose: (event) => {
114
+ if (open && !event.currentTarget.open)
115
+ onOpenChange(false);
116
+ }, children: [_jsxs3("header", { children: [_jsx4("h2", { id: heading, children: title }), _jsx4(IconButton, { icon: "close", label: "Close dialog", onClick: () => onOpenChange(false) })] }), _jsx4("div", { className: "vx-dialog-body", children }), actions && _jsx4("footer", { children: actions })] });
117
+ }
118
+
119
+ // packages/studio-workbench/src/ad-player.tsx
120
+ import * as React from "react";
121
+ import { jsx, jsxs } from "react/jsx-runtime";
122
+
123
+ // packages/studio-workbench/src/ad-comparison-picker.tsx
124
+ import * as React2 from "react";
125
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
126
+ var identity = (input) => JSON.stringify(input);
127
+ function Preview({
128
+ candidate,
129
+ resolve
130
+ }) {
131
+ const [url, setUrl] = React2.useState("");
132
+ const [unavailable, setUnavailable] = React2.useState(false);
133
+ React2.useEffect(() => {
134
+ let active = true;
135
+ setUrl("");
136
+ setUnavailable(false);
137
+ void resolve(candidate.ref).then(
138
+ (location) => {
139
+ if (active) setUrl(location.previewUrl);
140
+ },
141
+ () => {
142
+ if (active) setUnavailable(true);
143
+ }
144
+ );
145
+ return () => {
146
+ active = false;
147
+ };
148
+ }, [candidate.ref.storeId, candidate.ref.objectId, candidate.ref.versionId]);
149
+ return /* @__PURE__ */ jsxs2("span", { className: "ad-video-choice-preview", children: [
150
+ url && !unavailable ? /* @__PURE__ */ jsx2(
151
+ "video",
152
+ {
153
+ src: url,
154
+ muted: true,
155
+ playsInline: true,
156
+ preload: "metadata",
157
+ "aria-hidden": "true",
158
+ onError: () => setUnavailable(true)
159
+ }
160
+ ) : /* @__PURE__ */ jsx2("span", { children: unavailable ? "Preview unavailable" : "Loading preview\u2026" }),
161
+ candidate.durationMs != null && /* @__PURE__ */ jsxs2("span", { className: "ad-video-choice-duration", children: [
162
+ Number((candidate.durationMs / 1e3).toFixed(2)),
163
+ "s"
164
+ ] })
165
+ ] });
166
+ }
167
+ function AdComparisonPicker({
168
+ slotId,
169
+ slots,
170
+ candidates,
171
+ resolve,
172
+ onChoose,
173
+ onClose
174
+ }) {
175
+ const [query, setQuery] = React2.useState("");
176
+ const column = slots.findIndex((slot) => slot.id === slotId) + 1;
177
+ const matching = candidates.filter(
178
+ (candidate) => candidate.label.toLocaleLowerCase().includes(query.trim().toLocaleLowerCase())
179
+ );
180
+ return /* @__PURE__ */ jsxs2(
181
+ Dialog,
182
+ {
183
+ title: "Choose video",
184
+ open: true,
185
+ onOpenChange: (open) => {
186
+ if (!open) onClose();
187
+ },
188
+ className: "ad-video-picker",
189
+ children: [
190
+ /* @__PURE__ */ jsxs2("div", { className: "ad-video-picker-toolbar", children: [
191
+ /* @__PURE__ */ jsx2(
192
+ SearchInput,
193
+ {
194
+ label: "Search videos",
195
+ placeholder: "Search scenes or versions\u2026",
196
+ value: query,
197
+ onValueChange: setQuery
198
+ }
199
+ ),
200
+ /* @__PURE__ */ jsxs2("span", { children: [
201
+ matching.length,
202
+ " ",
203
+ matching.length === 1 ? "video" : "videos",
204
+ " \xB7 Column ",
205
+ column
206
+ ] })
207
+ ] }),
208
+ /* @__PURE__ */ jsx2("div", { className: "ad-video-picker-grid", "aria-label": "Project videos", children: matching.map((candidate) => {
209
+ const used = slots.findIndex(
210
+ (slot) => slot.id !== slotId && identity(slot.input) === identity(candidate.input)
211
+ );
212
+ const current = slots.some(
213
+ (slot) => slot.id === slotId && identity(slot.input) === identity(candidate.input)
214
+ );
215
+ return /* @__PURE__ */ jsxs2(
216
+ "button",
217
+ {
218
+ type: "button",
219
+ className: "ad-video-choice",
220
+ disabled: used >= 0,
221
+ "aria-label": `Choose ${candidate.label}`,
222
+ "aria-pressed": current,
223
+ onClick: () => onChoose(candidate.input),
224
+ children: [
225
+ /* @__PURE__ */ jsx2(Preview, { candidate, resolve }),
226
+ /* @__PURE__ */ jsx2("span", { className: "ad-video-choice-title", children: candidate.title }),
227
+ /* @__PURE__ */ jsxs2("span", { className: "ad-video-choice-meta", children: [
228
+ "Version ",
229
+ candidate.versionNumber,
230
+ candidate.input.kind === "edit" ? " \xB7 Edited" : ""
231
+ ] }),
232
+ /* @__PURE__ */ jsx2("span", { className: "ad-video-choice-state", children: used >= 0 ? `In column ${used + 1}` : current ? "Current video" : "Add to column" })
233
+ ]
234
+ },
235
+ identity(candidate.input)
236
+ );
237
+ }) }),
238
+ !matching.length && /* @__PURE__ */ jsx2("p", { className: "ad-video-picker-empty", role: "status", children: candidates.length ? "No videos match your search." : "No playable videos in this project yet." })
239
+ ]
240
+ }
241
+ );
242
+ }
243
+
244
+ // packages/studio-workbench/src/ad-view-panels.tsx
245
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
246
+ function AdCompareView({ Compare, compareProps, picker, onBack }) {
247
+ return /* @__PURE__ */ jsxs3("section", { className: "ad-panel ad-compare", children: [
248
+ /* @__PURE__ */ jsxs3("div", { className: "ad-section-heading", children: [
249
+ /* @__PURE__ */ jsx3("h1", { children: "Compare" }),
250
+ /* @__PURE__ */ jsx3(Button, { label: "Back to film", variant: "text-ghost-sm", onClick: onBack })
251
+ ] }),
252
+ Compare ? /* @__PURE__ */ jsx3(Compare, { ...compareProps }) : /* @__PURE__ */ jsxs3("div", { className: "ad-empty", children: [
253
+ /* @__PURE__ */ jsx3("h2", { children: "Compare video candidates" }),
254
+ /* @__PURE__ */ jsx3("p", { children: "Enable the media tools plugin to compare videos." })
255
+ ] }),
256
+ picker && /* @__PURE__ */ jsx3(AdComparisonPicker, { ...picker })
257
+ ] });
258
+ }
259
+
260
+ // packages/ads-compare/src/client.tsx
261
+ function activate(client) {
262
+ client.registerUI({
263
+ id: "compare",
264
+ title: "Ads Compare",
265
+ kind: "component",
266
+ component: AdCompareView
267
+ });
268
+ }
269
+ export {
270
+ activate as default
271
+ };
package/dist/client.js ADDED
@@ -0,0 +1,3 @@
1
+ import './client-code.css';
2
+ export { default } from './client-code.js';
3
+ export * from './client-code.js';
package/package.json CHANGED
@@ -1,6 +1,21 @@
1
1
  {
2
2
  "name": "@vivix-labs/ads-compare",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.0-beta",
4
+ "type": "module",
5
+ "publishConfig": {
6
+ "access": "public",
7
+ "registry": "https://registry.npmjs.org/",
8
+ "tag": "beta"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "studio-plugin.json"
13
+ ],
14
+ "exports": {
15
+ "./client": "./dist/client.js"
16
+ },
17
+ "peerDependencies": {
18
+ "react": "^19.0.0",
19
+ "react-dom": "^19.0.0"
20
+ }
6
21
  }
@@ -0,0 +1,8 @@
1
+ {
2
+ "manifestVersion": "0.2",
3
+ "id": "vivix.ads-compare",
4
+ "requirements": {
5
+ "studioPluginApi": "^0.2.1"
6
+ },
7
+ "requestedAccess": []
8
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.