@delmaredigital/payload-experiments 0.4.0-rc.5 → 0.4.0-rc.7
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/admin/blocks/BlockPanel.js +6 -4
- package/dist/admin/blocks/inject.js +1 -0
- package/dist/admin/blocks/model.d.ts +3 -2
- package/dist/admin/blocks/model.js +8 -4
- package/dist/admin/copy/blocks.d.ts +3 -2
- package/dist/admin/copy/blocks.js +7 -6
- package/dist/admin/copy/newTest.d.ts +1 -1
- package/dist/admin/copy/newTest.js +1 -1
- package/dist/admin/surface/ResultsRoute.js +2 -1
- package/dist/admin/surface/TestsHome.d.ts +2 -1
- package/dist/admin/surface/TestsHome.js +91 -37
- package/dist/admin/surface/TestsSurface.js +3 -0
- package/dist/admin/surface/home.model.d.ts +2 -0
- package/dist/admin/surface/newTest/NewTest.js +16 -18
- package/dist/admin/surface/newTest/PageWizard.js +1 -0
- package/dist/admin/surface/newTest/newTest.css +3 -1
- package/dist/admin/views/TestsSurfaceClient.d.ts +3 -0
- package/dist/admin/views/TestsSurfaceClient.js +11 -0
- package/dist/admin/views/buildSurfaceProps.js +10 -3
- package/dist/blocks/bindings.js +8 -14
- package/dist/blocks/placementLanguages.d.ts +7 -0
- package/dist/blocks/placementLanguages.js +27 -0
- package/dist/blocks/placementLocale.d.ts +23 -7
- package/dist/blocks/placementLocale.js +221 -66
- package/dist/db/appends.d.ts +13 -0
- package/dist/db/appends.js +49 -0
- package/dist/db/bulkPlacementRemoval.js +8 -4
- package/dist/endpoints/contentLocale.d.ts +6 -0
- package/dist/endpoints/contentLocale.js +15 -0
- package/dist/endpoints/deleteImpact.d.ts +6 -0
- package/dist/endpoints/deleteImpact.js +206 -0
- package/dist/endpoints/index.js +7 -0
- package/dist/endpoints/pages.js +7 -3
- package/dist/endpoints/placementStatus.js +6 -1
- package/dist/endpoints/preflight.d.ts +1 -1
- package/dist/endpoints/preflight.js +17 -2
- package/dist/exports/adminClient.d.ts +1 -1
- package/dist/exports/adminClient.js +1 -1
- package/dist/exports/index.d.ts +1 -1
- package/dist/goals/fairness.js +43 -34
- package/dist/hooks/blockRemovalRule.d.ts +4 -3
- package/dist/hooks/blockRemovalRule.js +33 -9
- package/dist/hooks/pageGuard.d.ts +3 -0
- package/dist/hooks/pageGuard.js +34 -24
- package/dist/hooks/puckNestedTests.d.ts +8 -0
- package/dist/hooks/puckNestedTests.js +36 -0
- package/dist/lib/placementPages.d.ts +2 -1
- package/dist/lib/placementPages.js +10 -2
- package/dist/manifest/compile.d.ts +2 -1
- package/dist/manifest/compile.js +5 -1
- package/dist/puck/ExperimentPicker.d.ts +2 -1
- package/dist/puck/ExperimentPicker.js +37 -30
- package/dist/puck/ExperimentSlot.js +3 -1
- package/dist/puck/copy.d.ts +1 -0
- package/dist/puck/copy.js +1 -0
- package/dist/puck/editor/ConfigureTestDrawer.d.ts +8 -4
- package/dist/puck/editor/ConfigureTestDrawer.js +4 -2
- package/dist/puck/editor/CreateExperimentDrawer.d.ts +2 -1
- package/dist/puck/editor/CreateExperimentDrawer.js +24 -20
- package/dist/puck/editor/EditorControls.d.ts +1 -1
- package/dist/puck/editor/EditorControls.js +1 -1
- package/dist/puck/editor/ExperimentSlotEditor.js +405 -394
- package/dist/puck/editor/LeftoverVersions.d.ts +4 -2
- package/dist/puck/editor/LeftoverVersions.js +23 -44
- package/dist/puck/editor/QuickTestActions.js +2 -2
- package/dist/puck/editor/VersionBuilder.d.ts +41 -13
- package/dist/puck/editor/VersionBuilder.js +461 -224
- package/dist/puck/editor/armWrites.d.ts +9 -2
- package/dist/puck/editor/armWrites.js +40 -2
- package/dist/puck/editor/armsCache.d.ts +1 -1
- package/dist/puck/editor/armsCache.js +2 -1
- package/dist/puck/editor/blockClipboard.d.ts +16 -0
- package/dist/puck/editor/blockClipboard.js +20 -0
- package/dist/puck/editor/copy.d.ts +27 -26
- package/dist/puck/editor/copy.js +28 -26
- package/dist/puck/editor/createTest.d.ts +3 -0
- package/dist/puck/editor/createTest.js +33 -0
- package/dist/puck/editor/editor.chrome.css +138 -17
- package/dist/puck/editor/editor.css +156 -22
- package/dist/puck/editor/editor.model.d.ts +2 -1
- package/dist/puck/editor/editor.model.js +3 -3
- package/dist/puck/editor/experimentOutlinePlugin.js +1 -1
- package/dist/puck/editor/localPlacements.d.ts +5 -2
- package/dist/puck/editor/localPlacements.js +32 -18
- package/dist/puck/editor/placementsCache.d.ts +18 -12
- package/dist/puck/editor/placementsCache.js +52 -47
- package/dist/puck/editor/sidebar.d.ts +2 -6
- package/dist/puck/editor/sidebar.js +3 -6
- package/dist/puck/editor/usePlacementNotice.d.ts +1 -1
- package/dist/puck/editor/usePlacementNotice.js +4 -3
- package/dist/puck/experimentSlug.d.ts +2 -0
- package/dist/puck/experimentSlug.js +3 -0
- package/dist/puck/nestedTestCopy.d.ts +8 -0
- package/dist/puck/nestedTestCopy.js +22 -0
- package/dist/puck/nestedTests.d.ts +17 -0
- package/dist/puck/nestedTests.js +30 -0
- package/dist/puck/slotConfig.d.ts +1 -1
- package/dist/puck/slotConfig.js +17 -4
- package/dist/puck/visibility.d.ts +20 -0
- package/dist/puck/visibility.js +81 -0
- package/dist/server/recordContentChange.js +37 -20
- package/dist/server/resolveExperimentData.js +6 -3
- package/dist/testSurface/PreviewLinks.js +6 -2
- package/dist/testSurface/api.d.ts +6 -3
- package/dist/testSurface/api.js +10 -6
- package/dist/testSurface/contentLocaleURL.d.ts +2 -0
- package/dist/testSurface/contentLocaleURL.js +3 -0
- package/dist/testSurface/copy/common.d.ts +4 -0
- package/dist/testSurface/copy/common.js +8 -4
- package/dist/testSurface/copy/languages.d.ts +11 -0
- package/dist/testSurface/copy/languages.js +7 -0
- package/dist/testSurface/copy/readiness.d.ts +2 -1
- package/dist/testSurface/copy/readiness.js +2 -1
- package/dist/testSurface/copy/testPage.d.ts +28 -6
- package/dist/testSurface/copy/testPage.js +28 -6
- package/dist/testSurface/placementLabel.d.ts +8 -0
- package/dist/testSurface/placementLabel.js +24 -0
- package/dist/testSurface/placements/placementLabels.d.ts +2 -0
- package/dist/testSurface/placements/placementLabels.js +2 -1
- package/dist/testSurface/results/results.css +1 -1
- package/dist/testSurface/results/results.model.d.ts +1 -1
- package/dist/testSurface/surface/contracts.d.ts +2 -0
- package/dist/testSurface/surface/editorPlacement.d.ts +5 -0
- package/dist/testSurface/surface/editorPlacement.js +18 -0
- package/dist/testSurface/surface/pageBlock/pageBlock.model.js +2 -1
- package/dist/testSurface/surface/pageBlock/parts.js +24 -6
- package/dist/testSurface/surface/readiness/ActionDialogs.js +28 -34
- package/dist/testSurface/surface/readiness/readiness.model.js +9 -2
- package/dist/testSurface/surface/results/useResults.d.ts +4 -1
- package/dist/testSurface/surface/test/DeleteTest.d.ts +15 -0
- package/dist/testSurface/surface/test/DeleteTest.js +171 -0
- package/dist/testSurface/surface/test/GoalSection.js +101 -74
- package/dist/testSurface/surface/test/TestSurface.js +29 -9
- package/dist/testSurface/surface/test/fields.d.ts +1 -3
- package/dist/testSurface/surface/test/fields.js +5 -35
- package/dist/testSurface/surface/useTestDocument.d.ts +2 -1
- package/dist/testSurface/surface/useTestDocument.js +20 -4
- package/dist/testSurface/useApi.d.ts +4 -1
- package/dist/transitions/checkStart.d.ts +4 -1
- package/dist/transitions/checkStart.js +117 -14
- package/dist/transitions/contentFields.js +9 -5
- package/dist/transitions/makeContent.js +29 -9
- package/dist/transitions/nestedPlacementNames.d.ts +5 -0
- package/dist/transitions/nestedPlacementNames.js +33 -0
- package/dist/transitions/pageVersions.js +3 -1
- package/dist/transitions/placementInteractions.js +7 -4
- package/dist/transitions/placements.d.ts +26 -1
- package/dist/transitions/placements.js +239 -87
- package/dist/transitions/preflightData.d.ts +2 -1
- package/dist/transitions/preflightData.js +66 -3
- package/dist/transitions/start.js +4 -1
- package/dist/types/endpoints.d.ts +35 -1
- package/dist/types/endpoints.js +1 -1
- package/dist/types/puck.d.ts +1 -0
- package/dist/types/surface.d.ts +2 -0
- package/dist/ui/Button.js +2 -2
- package/dist/ui/Inputs.d.ts +4 -3
- package/dist/ui/Inputs.js +7 -4
- package/dist/ui/SelectControl.d.ts +33 -0
- package/dist/ui/SelectControl.js +504 -0
- package/dist/ui/Tabs.d.ts +0 -1
- package/dist/ui/Tabs.js +28 -40
- package/dist/ui/ui.css +18 -5
- package/package.json +3 -2
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import type { Arm } from '../../types/contracts.js';
|
|
1
|
+
import type { Arm, ArmKey } from '../../types/contracts.js';
|
|
2
|
+
import type { ArmSlot } from '../../types/puck.js';
|
|
2
3
|
import type { EditorExperiment } from './editor.model.js';
|
|
3
4
|
export declare class ArmWriteError extends Error {
|
|
4
5
|
}
|
|
6
|
+
/** Refuse obsolete intents before a no-op can become a successful PATCH. */
|
|
7
|
+
export declare function removeVersionArms(arms: Arm[], key: ArmKey): Arm[];
|
|
8
|
+
export declare function addVersionArms(arms: Arm[]): Arm[];
|
|
9
|
+
export declare function setVersionTraffic(arms: Arm[], key: ArmKey, weight: number): Arm[];
|
|
10
|
+
export declare function renameVersionArms(arms: Arm[], key: ArmKey, label: string): Arm[];
|
|
11
|
+
export declare function addLeftoverArms(arms: Arm[], slot: ArmSlot): Arm[];
|
|
5
12
|
export declare function readExperiment(url: string, signal?: AbortSignal): Promise<EditorExperiment>;
|
|
6
13
|
/** Each intent is applied to a fresh document, guarded by the collection's compare-and-set header. */
|
|
7
|
-
export declare function writeArms(url: string, transform: (arms: Arm[]) => Arm[], publish: (doc: EditorExperiment) => void, { draftOnly }?: {
|
|
14
|
+
export declare function writeArms(url: string, transform: (arms: Arm[]) => Arm[], publish: (doc: EditorExperiment) => EditorExperiment | void, { draftOnly }?: {
|
|
8
15
|
draftOnly?: boolean;
|
|
9
16
|
}): Promise<Arm[]>;
|
|
@@ -1,10 +1,46 @@
|
|
|
1
1
|
import { checkArms } from '../../collections/experiments/armInvariants.js';
|
|
2
2
|
import { issueMessage } from '../../arms/copy.js';
|
|
3
|
-
import { totalWeight, withSlotsFor } from '../../arms/model.js';
|
|
3
|
+
import { addVariant, balanceWeight, removeArm, splitEvenly, totalWeight, withSlotsFor } from '../../arms/model.js';
|
|
4
4
|
import { XP_IF_UPDATED_AT_HEADER } from '../../constants.js';
|
|
5
|
+
import { slotLabels } from '../copy.js';
|
|
5
6
|
import { editorCopy, writeRefusal } from './copy.js';
|
|
6
7
|
export class ArmWriteError extends Error {
|
|
7
8
|
}
|
|
9
|
+
/** Refuse obsolete intents before a no-op can become a successful PATCH. */ export function removeVersionArms(arms, key) {
|
|
10
|
+
if (!arms.some((arm)=>arm.key === key && arm.kind !== 'control')) throw new ArmWriteError(editorCopy.staleEdit);
|
|
11
|
+
return splitEvenly(removeArm(arms, key));
|
|
12
|
+
}
|
|
13
|
+
export function addVersionArms(arms) {
|
|
14
|
+
const next = addVariant(arms, 'block');
|
|
15
|
+
if (next.length === arms.length) throw new ArmWriteError(editorCopy.staleEdit);
|
|
16
|
+
return next;
|
|
17
|
+
}
|
|
18
|
+
export function setVersionTraffic(arms, key, weight) {
|
|
19
|
+
if (!arms.some((arm)=>arm.key === key) || arms.length < 2) throw new ArmWriteError(editorCopy.staleEdit);
|
|
20
|
+
return balanceWeight(arms, key, weight);
|
|
21
|
+
}
|
|
22
|
+
export function renameVersionArms(arms, key, label) {
|
|
23
|
+
if (!arms.some((arm)=>arm.key === key)) throw new ArmWriteError(editorCopy.staleEdit);
|
|
24
|
+
return arms.map((arm)=>arm.key === key ? {
|
|
25
|
+
...arm,
|
|
26
|
+
label
|
|
27
|
+
} : arm);
|
|
28
|
+
}
|
|
29
|
+
export function addLeftoverArms(arms, slot) {
|
|
30
|
+
if (slot === 'control' || arms.some((arm)=>arm.key === slot) || !arms.some((arm)=>arm.kind === 'control') || arms.filter((arm)=>arm.kind === 'variant').length >= 3) throw new ArmWriteError(editorCopy.staleEdit);
|
|
31
|
+
const next = [
|
|
32
|
+
...arms
|
|
33
|
+
];
|
|
34
|
+
const holdout = next.findIndex((arm)=>arm.kind === 'holdout');
|
|
35
|
+
next.splice(holdout < 0 ? next.length : holdout, 0, {
|
|
36
|
+
key: slot,
|
|
37
|
+
slot,
|
|
38
|
+
kind: 'variant',
|
|
39
|
+
label: slotLabels[slot],
|
|
40
|
+
weight: 0
|
|
41
|
+
});
|
|
42
|
+
return next;
|
|
43
|
+
}
|
|
8
44
|
export async function readExperiment(url, signal) {
|
|
9
45
|
const response = await fetch(url, {
|
|
10
46
|
credentials: 'include',
|
|
@@ -33,7 +69,9 @@ export async function readExperiment(url, signal) {
|
|
|
33
69
|
}
|
|
34
70
|
/** Each intent is applied to a fresh document, guarded by the collection's compare-and-set header. */ export async function writeArms(url, transform, publish, { draftOnly = false } = {}) {
|
|
35
71
|
const fresh = await readExperiment(`${url}?depth=0`);
|
|
36
|
-
publish(fresh);
|
|
72
|
+
const accepted = publish(fresh) ?? fresh;
|
|
73
|
+
// A later cache read can supersede this baseline before this GET finishes.
|
|
74
|
+
if (accepted.updatedAt !== fresh.updatedAt) throw new ArmWriteError(editorCopy.staleEdit);
|
|
37
75
|
if (draftOnly && fresh.status !== 'draft') throw new ArmWriteError(editorCopy.draftOnly);
|
|
38
76
|
if (fresh.status !== 'draft' && fresh.status !== 'stopped') throw new ArmWriteError(editorCopy.locked[fresh.status]);
|
|
39
77
|
if (!fresh.updatedAt || !Array.isArray(fresh.arms)) throw new ArmWriteError(editorCopy.writeUnreadable);
|
|
@@ -9,7 +9,7 @@ export declare function acquireArms(testId: DocId): () => void;
|
|
|
9
9
|
/** Share the request, but abort it only after its last mounted consumer leaves. */
|
|
10
10
|
export declare function loadArms(testId: DocId, load: (signal: AbortSignal) => Promise<EditorExperiment>, signal: AbortSignal): Promise<EditorExperiment>;
|
|
11
11
|
export declare function subscribe(listener: () => void): () => void;
|
|
12
|
-
export declare function publishExperiment(testId: DocId, doc: EditorExperiment):
|
|
12
|
+
export declare function publishExperiment(testId: DocId, doc: EditorExperiment): EditorExperiment;
|
|
13
13
|
/** undefined means unknown. */
|
|
14
14
|
export declare function setArms(testId: DocId, arms: string[] | undefined): void;
|
|
15
15
|
export declare function useArms(testId: DocId | undefined): Arms | undefined;
|
|
@@ -71,13 +71,14 @@ export function publishExperiment(testId, doc) {
|
|
|
71
71
|
const previous = cache.get(String(testId))?.doc;
|
|
72
72
|
// Surface reads and chrome writes share this producer too. A GET that began
|
|
73
73
|
// before a save cannot overwrite its newer server timestamp when it finishes.
|
|
74
|
-
if (previous?.updatedAt && doc.updatedAt && Date.parse(previous.updatedAt) > Date.parse(doc.updatedAt)) return;
|
|
74
|
+
if (previous?.updatedAt && doc.updatedAt && Date.parse(previous.updatedAt) > Date.parse(doc.updatedAt)) return previous;
|
|
75
75
|
revisions.set(String(testId), (revisions.get(String(testId)) ?? 0) + 1);
|
|
76
76
|
cache.set(String(testId), {
|
|
77
77
|
arms: doc.arms.map((arm)=>arm.key),
|
|
78
78
|
doc
|
|
79
79
|
});
|
|
80
80
|
for (const listener of listeners)listener();
|
|
81
|
+
return doc;
|
|
81
82
|
}
|
|
82
83
|
/** undefined means unknown. */ export function setArms(testId, arms) {
|
|
83
84
|
revisions.set(String(testId), (revisions.get(String(testId)) ?? 0) + 1);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentData } from '@puckeditor/core';
|
|
2
|
+
type PasteArgs = {
|
|
3
|
+
block: ComponentData;
|
|
4
|
+
destination: {
|
|
5
|
+
ancestors: readonly {
|
|
6
|
+
type: string;
|
|
7
|
+
}[];
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export declare function canPasteExperiment({ block, destination }: PasteArgs): true | string;
|
|
11
|
+
export declare const experimentClipboard: {
|
|
12
|
+
blockClipboard: {
|
|
13
|
+
canPaste: typeof canPasteExperiment;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { nestedTests } from '../nestedTests.js';
|
|
2
|
+
import { editorCopy } from './copy.js';
|
|
3
|
+
export function canPasteExperiment({ block, destination }) {
|
|
4
|
+
const ancestors = destination.ancestors.map((ancestor)=>({
|
|
5
|
+
type: ancestor.type,
|
|
6
|
+
props: {}
|
|
7
|
+
}));
|
|
8
|
+
if (nestedTests(block, {
|
|
9
|
+
includeHidden: true,
|
|
10
|
+
ancestors
|
|
11
|
+
}).length) return editorCopy.nestedPaste;
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
// Spread into the component config so older Puck typings and hosts accept the
|
|
15
|
+
// extra key. payload-puck 0.12.1 invokes it; 0.12.0 simply ignores it.
|
|
16
|
+
export const experimentClipboard = {
|
|
17
|
+
blockClipboard: {
|
|
18
|
+
canPaste: canPasteExperiment
|
|
19
|
+
}
|
|
20
|
+
};
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export declare const editorCopy: {
|
|
2
|
+
readonly nested: (outer?: string, inner?: string) => string;
|
|
3
|
+
readonly nestedHidden: (outer?: string) => string;
|
|
4
|
+
readonly nestedPaste: "A test can't go inside another test's version.";
|
|
5
|
+
readonly hidden: "This block is hidden, so visitors won't see this test here.";
|
|
6
|
+
readonly hiddenOn: (sizes: string) => string;
|
|
2
7
|
readonly retrySetup: "Retry";
|
|
3
8
|
readonly controlsUnavailable: "Test controls couldn't load.";
|
|
4
9
|
readonly setupForbidden: "You don't have access to set up tests.";
|
|
@@ -14,29 +19,23 @@ export declare const editorCopy: {
|
|
|
14
19
|
readonly openInTab: "Open in a new tab";
|
|
15
20
|
readonly closeConfigure: "Close";
|
|
16
21
|
readonly selectBlock: "Select this test block";
|
|
17
|
-
readonly
|
|
18
|
-
readonly
|
|
19
|
-
readonly
|
|
20
|
-
readonly draft: "This block shows the Original to everyone until the test starts.";
|
|
22
|
+
readonly deleted: "The test for this block was deleted.";
|
|
23
|
+
readonly unbound: "This Experiment block has no test yet.";
|
|
24
|
+
readonly draft: (label: string) => string;
|
|
21
25
|
readonly running: "Changing this content mid-test mixes two versions in one result";
|
|
22
26
|
readonly decided: (winner: string) => string;
|
|
23
|
-
readonly archived:
|
|
24
|
-
readonly
|
|
25
|
-
readonly
|
|
27
|
+
readonly archived: (winner: string) => string;
|
|
28
|
+
readonly archivedOriginal: (original: string, discarded: boolean) => string;
|
|
29
|
+
readonly copy: (label?: string) => string;
|
|
30
|
+
readonly copyEmpty: (label?: string) => string;
|
|
26
31
|
readonly enterName: "Enter a name to create the test.";
|
|
27
|
-
readonly
|
|
28
|
-
readonly
|
|
29
|
-
readonly dropZone: (slot: "control" | "variantA" | "variantB" | "variantC") => string;
|
|
30
|
-
readonly replaceConfirm: (label: string) => string;
|
|
32
|
+
readonly dropZone: (label: string) => string;
|
|
33
|
+
readonly replaceConfirm: (label: string, original?: string) => string;
|
|
31
34
|
readonly replace: "Replace";
|
|
32
|
-
readonly
|
|
33
|
-
readonly
|
|
35
|
+
readonly pageFallback: "Page";
|
|
36
|
+
readonly createLabel: "Set up test";
|
|
37
|
+
readonly existingTest: "Use an existing test";
|
|
34
38
|
readonly sharedTest: "This test is also used in another place. Changes here affect that test.";
|
|
35
|
-
readonly detach: "Remove the test from this block";
|
|
36
|
-
readonly detachTitle: "Remove the test from this block?";
|
|
37
|
-
readonly detachHelp: "Show the Original on this page? All version content stays in this block. The test and its results are kept. Save the page to keep this change.";
|
|
38
|
-
readonly stopToDetach: "Stop the test to remove it from this block.";
|
|
39
|
-
readonly detachRunningHelp: "Show the Original here? The test keeps running in its other place. All version content stays in this block. Save the page to keep this change.";
|
|
40
39
|
readonly createdUnbound: "The test was created, but this block changed or was removed. Open the test to continue.";
|
|
41
40
|
readonly creating: "Creating…";
|
|
42
41
|
readonly cancel: "Cancel";
|
|
@@ -53,20 +52,21 @@ export declare const editorCopy: {
|
|
|
53
52
|
readonly deleteContent: "Delete its content";
|
|
54
53
|
readonly deleteContentTitle: (label: string) => string;
|
|
55
54
|
readonly deleteContentHelp: (label: string, count: number) => string;
|
|
56
|
-
readonly draftOnly: "Only draft tests can add this version.
|
|
57
|
-
readonly leftovers: (labels: string) => string;
|
|
55
|
+
readonly draftOnly: "Only draft tests can add this version. Use a different test to include it.";
|
|
58
56
|
readonly outsideTest: (label: string) => string;
|
|
57
|
+
readonly showVersion: (label: string) => string;
|
|
59
58
|
readonly tabs: "Test versions";
|
|
60
59
|
readonly add: "Add variant";
|
|
61
|
-
readonly menu: (label: string) => string;
|
|
62
60
|
readonly testGroup: "Test";
|
|
63
61
|
readonly versionsGroup: "Versions";
|
|
64
|
-
readonly
|
|
65
|
-
readonly
|
|
66
|
-
readonly
|
|
62
|
+
readonly moreGroup: "More";
|
|
63
|
+
readonly differentTest: "Use a different test";
|
|
64
|
+
readonly createAnother: "Create a test";
|
|
65
|
+
readonly readOnlyVersions: "You don't have permission to change this test's versions.";
|
|
66
|
+
readonly traffic: "Traffic (%)";
|
|
67
|
+
readonly percent: "%";
|
|
68
|
+
readonly saved: "Saved";
|
|
67
69
|
readonly removeVersion: "Remove version";
|
|
68
|
-
readonly rename: "Rename";
|
|
69
|
-
readonly renameLabel: "Version name";
|
|
70
70
|
readonly emptyLabel: "Enter a name for this version.";
|
|
71
71
|
readonly remove: "Remove";
|
|
72
72
|
readonly removeTitle: (label: string) => string;
|
|
@@ -76,6 +76,7 @@ export declare const editorCopy: {
|
|
|
76
76
|
readonly removed: "Save the page to finish removing this version's content.";
|
|
77
77
|
readonly removeUncleared: "The version was removed from the test, but its content couldn't be cleared here. Delete it from the outline, then save the page.";
|
|
78
78
|
readonly lockedGeneric: "This test's versions can't change. View the test page for details.";
|
|
79
|
+
readonly holdoutContent: "Holdout visitors see the Original.";
|
|
79
80
|
readonly holdoutPeople: (label: string, count: string) => string;
|
|
80
81
|
readonly weight: (label: string) => string;
|
|
81
82
|
readonly invalidShare: "Use a whole number from 0 to 100.";
|
package/dist/puck/editor/copy.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import { nestedTestCopy } from '../nestedTestCopy.js';
|
|
1
2
|
import { ARM_LABELS } from '../../labels/arms.js';
|
|
2
3
|
export const editorCopy = {
|
|
4
|
+
nested: nestedTestCopy.editor,
|
|
5
|
+
nestedHidden: nestedTestCopy.hidden,
|
|
6
|
+
nestedPaste: "A test can't go inside another test's version.",
|
|
7
|
+
hidden: "This block is hidden, so visitors won't see this test here.",
|
|
8
|
+
hiddenOn: (sizes)=>`This block is hidden on ${sizes}. Visitors on ${sizes} are still counted in this test.`,
|
|
3
9
|
retrySetup: 'Retry',
|
|
4
10
|
controlsUnavailable: "Test controls couldn't load.",
|
|
5
11
|
setupForbidden: "You don't have access to set up tests.",
|
|
@@ -9,29 +15,23 @@ export const editorCopy = {
|
|
|
9
15
|
openInTab: 'Open in a new tab',
|
|
10
16
|
closeConfigure: 'Close',
|
|
11
17
|
selectBlock: 'Select this test block',
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
draft: 'This block shows the Original to everyone until the test starts.',
|
|
18
|
+
deleted: 'The test for this block was deleted.',
|
|
19
|
+
unbound: 'This Experiment block has no test yet.',
|
|
20
|
+
draft: (label)=>`This block shows the ${label} to everyone until the test starts.`,
|
|
16
21
|
running: 'Changing this content mid-test mixes two versions in one result',
|
|
17
22
|
decided: (winner)=>`Decided: ${winner}. Use 'Make it the content' on the test to finish.`,
|
|
18
|
-
archived:
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
archived: (winner)=>`Archived: this block serves ${winner}, or nothing if that version is empty. To keep the content without the test, move it out of this Experiment block on the canvas, then remove the Experiment block.`,
|
|
24
|
+
archivedOriginal: (original, discarded)=>`${discarded ? 'Winner discarded' : 'Archived without a winner'}: this block shows ${original}, or nothing if it is empty. To keep it without the test, move its content out on the canvas, then remove this Experiment block.`,
|
|
25
|
+
copy: (label = ARM_LABELS.control)=>`Copy ${label} here`,
|
|
26
|
+
copyEmpty: (label = ARM_LABELS.control)=>`Add content to the ${label} before copying it.`,
|
|
21
27
|
enterName: 'Enter a name to create the test.',
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
dropZone: (slot)=>slot === 'control' ? 'Drop the original content here' : `Drop ${editorCopy.labels[slot]} content here`,
|
|
25
|
-
replaceConfirm: (label)=>`${label} already has content. Replace it with a copy of the Original?`,
|
|
28
|
+
dropZone: (label)=>`Drop ${label} content here`,
|
|
29
|
+
replaceConfirm: (label, original = ARM_LABELS.control)=>`${label} already has content. Replace it with a copy of the ${original}?`,
|
|
26
30
|
replace: 'Replace',
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
pageFallback: 'Page',
|
|
32
|
+
createLabel: 'Set up test',
|
|
33
|
+
existingTest: 'Use an existing test',
|
|
29
34
|
sharedTest: 'This test is also used in another place. Changes here affect that test.',
|
|
30
|
-
detach: 'Remove the test from this block',
|
|
31
|
-
detachTitle: 'Remove the test from this block?',
|
|
32
|
-
detachHelp: 'Show the Original on this page? All version content stays in this block. The test and its results are kept. Save the page to keep this change.',
|
|
33
|
-
stopToDetach: 'Stop the test to remove it from this block.',
|
|
34
|
-
detachRunningHelp: 'Show the Original here? The test keeps running in its other place. All version content stays in this block. Save the page to keep this change.',
|
|
35
35
|
createdUnbound: 'The test was created, but this block changed or was removed. Open the test to continue.',
|
|
36
36
|
creating: 'Creating…',
|
|
37
37
|
cancel: 'Cancel',
|
|
@@ -48,20 +48,21 @@ export const editorCopy = {
|
|
|
48
48
|
deleteContent: 'Delete its content',
|
|
49
49
|
deleteContentTitle: (label)=>`Delete ${label} content?`,
|
|
50
50
|
deleteContentHelp: (label, count)=>`This deletes the ${count} ${count === 1 ? 'block' : 'blocks'} in ${label} from this page. Save the page to keep this change.`,
|
|
51
|
-
draftOnly: 'Only draft tests can add this version.
|
|
52
|
-
leftovers: (labels)=>`3 versions have content outside this test: ${labels}. Visitors never see them.`,
|
|
51
|
+
draftOnly: 'Only draft tests can add this version. Use a different test to include it.',
|
|
53
52
|
outsideTest: (label)=>`${label} · not in this test`,
|
|
53
|
+
showVersion: (label)=>`Show ${label} on the page`,
|
|
54
54
|
tabs: 'Test versions',
|
|
55
55
|
add: 'Add variant',
|
|
56
|
-
menu: (label)=>`Options for ${label}`,
|
|
57
56
|
testGroup: 'Test',
|
|
58
57
|
versionsGroup: 'Versions',
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
moreGroup: 'More',
|
|
59
|
+
differentTest: 'Use a different test',
|
|
60
|
+
createAnother: 'Create a test',
|
|
61
|
+
readOnlyVersions: "You don't have permission to change this test's versions.",
|
|
62
|
+
traffic: 'Traffic (%)',
|
|
63
|
+
percent: '%',
|
|
64
|
+
saved: 'Saved',
|
|
62
65
|
removeVersion: 'Remove version',
|
|
63
|
-
rename: 'Rename',
|
|
64
|
-
renameLabel: 'Version name',
|
|
65
66
|
emptyLabel: 'Enter a name for this version.',
|
|
66
67
|
remove: 'Remove',
|
|
67
68
|
removeTitle: (label)=>`Remove ${label}?`,
|
|
@@ -71,6 +72,7 @@ export const editorCopy = {
|
|
|
71
72
|
removed: "Save the page to finish removing this version's content.",
|
|
72
73
|
removeUncleared: "The version was removed from the test, but its content couldn't be cleared here. Delete it from the outline, then save the page.",
|
|
73
74
|
lockedGeneric: "This test's versions can't change. View the test page for details.",
|
|
75
|
+
holdoutContent: 'Holdout visitors see the Original.',
|
|
74
76
|
holdoutPeople: (label, count)=>`${label}: ${count} people (not compared)`,
|
|
75
77
|
weight: (label)=>`${label} traffic (%)`,
|
|
76
78
|
invalidShare: 'Use a whole number from 0 to 100.',
|
|
@@ -5,3 +5,6 @@ export declare class CreateRefused extends Error {
|
|
|
5
5
|
}
|
|
6
6
|
/** Shared lookup, complete draft creation and one retry for a racing slug collision. */
|
|
7
7
|
export declare function createTest(api: string, input: Omit<Parameters<typeof newTestBody>[0], 'slug'>): Promise<ExperimentRef>;
|
|
8
|
+
/** Choose a free display name before the existing slug/creation path. Called only by Set up test.
|
|
9
|
+
* Names are not unique: two editors may choose the same display name. Slugs are guarded separately. */
|
|
10
|
+
export declare function createBlockTest(api: string, pageTitle: string, arms: Parameters<typeof newTestBody>[0]['arms']): Promise<ExperimentRef>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fetchAllDocs } from '../../lib/fetchAllDocs.js';
|
|
1
2
|
import { editorCopy } from './copy.js';
|
|
2
3
|
import { isSlugCollision, newTestBody, slugify, slugCandidate } from './editor.model.js';
|
|
3
4
|
/** Only a server refusal may supply editor-facing error text. */ export class CreateRefused extends Error {
|
|
@@ -59,3 +60,35 @@ function refusalMessage(body) {
|
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
62
|
}
|
|
63
|
+
// Keep generated names readable and bounded, including the numbered suffix.
|
|
64
|
+
const NAME_MAX_LENGTH = 200;
|
|
65
|
+
function blockTestName(title, index) {
|
|
66
|
+
const suffix = index === 1 ? ' test' : ` test ${index}`;
|
|
67
|
+
// Do not leave half a surrogate pair at the title boundary.
|
|
68
|
+
return title.slice(0, NAME_MAX_LENGTH - suffix.length).replace(/[\uD800-\uDBFF]$/, '').trimEnd() + suffix;
|
|
69
|
+
}
|
|
70
|
+
/** Choose a free display name before the existing slug/creation path. Called only by Set up test.
|
|
71
|
+
* Names are not unique: two editors may choose the same display name. Slugs are guarded separately. */ export async function createBlockTest(api, pageTitle, arms) {
|
|
72
|
+
const title = pageTitle.trim() || editorCopy.pageFallback;
|
|
73
|
+
const base = blockTestName(title, 1);
|
|
74
|
+
// A short common prefix also matches candidates whose title is trimmed for a number.
|
|
75
|
+
const query = new URLSearchParams({
|
|
76
|
+
depth: '0',
|
|
77
|
+
'select[name]': 'true',
|
|
78
|
+
'where[name][like]': base.slice(0, 64).replace(/[\uD800-\uDBFF]$/, '')
|
|
79
|
+
});
|
|
80
|
+
const response = await fetchAllDocs(`${api}/xp-experiments?${query}`, {
|
|
81
|
+
credentials: 'include'
|
|
82
|
+
});
|
|
83
|
+
if (!response.ok) throw new CreateRefused(refusalMessage(response.body));
|
|
84
|
+
const taken = new Set(response.docs.map((doc)=>doc.name));
|
|
85
|
+
for(let index = 1;; index++){
|
|
86
|
+
const name = blockTestName(title, index);
|
|
87
|
+
if (!taken.has(name)) return createTest(api, {
|
|
88
|
+
name,
|
|
89
|
+
kind: 'block',
|
|
90
|
+
unitType: 'visitor',
|
|
91
|
+
arms
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
.xp-slot-header {
|
|
20
20
|
display: flex;
|
|
21
|
-
flex-wrap:
|
|
21
|
+
flex-wrap: nowrap;
|
|
22
22
|
align-items: center;
|
|
23
23
|
gap: var(--xp-space-2);
|
|
24
24
|
cursor: pointer;
|
|
@@ -39,7 +39,11 @@
|
|
|
39
39
|
color: var(--xp-text);
|
|
40
40
|
font: inherit;
|
|
41
41
|
font-weight: 600;
|
|
42
|
-
|
|
42
|
+
min-width: 0;
|
|
43
|
+
flex: 1;
|
|
44
|
+
white-space: nowrap;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
text-overflow: ellipsis;
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
.xp-slot-editor > .xp-ui-tabs > .xp-ui-tabs-header {
|
|
@@ -94,7 +98,7 @@
|
|
|
94
98
|
gap: var(--xp-space-4);
|
|
95
99
|
}
|
|
96
100
|
|
|
97
|
-
.xp-slot-confirm {
|
|
101
|
+
.xp-slot-copy-confirm {
|
|
98
102
|
padding: var(--xp-space-2) var(--xp-space-3);
|
|
99
103
|
border: 1px solid var(--xp-warning);
|
|
100
104
|
border-radius: var(--xp-radius);
|
|
@@ -114,16 +118,6 @@
|
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
.xp-slot-editor .xp-ui-tabs-header { display: flex; flex-wrap: wrap; align-items: stretch; }
|
|
117
|
-
.xp-slot-version-actions { display: contents; }
|
|
118
|
-
.xp-slot-version-anchor { position: relative; display: flex; align-items: center; border-bottom: 1px solid var(--xp-border); }
|
|
119
|
-
.xp-slot-version-rename { flex: 1 0 100%; min-width: 0; padding-top: var(--xp-space-2); }
|
|
120
|
-
.xp-slot-version-menu {
|
|
121
|
-
position: absolute; top: 100%; inset-inline-end: 0; z-index: 5;
|
|
122
|
-
display: grid; min-width: 180px; padding: var(--xp-space-2);
|
|
123
|
-
box-shadow: 0 8px 24px var(--xp-overlay);
|
|
124
|
-
background: var(--xp-surface); border: 1px solid var(--xp-border); border-radius: var(--xp-radius);
|
|
125
|
-
}
|
|
126
|
-
.xp-slot-version-menu .xp-ui-button { justify-content: start; }
|
|
127
121
|
.xp-slot-weight-inputs, .xp-slot-people { display: flex; flex-wrap: wrap; gap: var(--xp-space-3); }
|
|
128
122
|
.xp-slot-weight-inputs { align-items: flex-start; }
|
|
129
123
|
.xp-slot-weight-inputs .xp-ui-field { flex: 1 1 120px; max-width: 200px; }
|
|
@@ -138,7 +132,23 @@
|
|
|
138
132
|
[class*="_PuckFields"] .xp-slot-root .xp-ui-error { color: var(--xp-error); }
|
|
139
133
|
[class*="_PuckFields"] .xp-slot-root .xp-ui-help { color: var(--xp-text-2); }
|
|
140
134
|
[class*="_PuckFields"] .xp-slot-root .xp-ui-field label { color: var(--xp-text); }
|
|
141
|
-
|
|
135
|
+
/* Native popovers keep this ancestry in the top layer. The fallback portals to
|
|
136
|
+
the nearest open dialog or owner-document body, copying the trigger's --xp-*
|
|
137
|
+
tokens; outside the field subtree, shared ui.css supplies the menu colors. */
|
|
138
|
+
[class*="_PuckFields"] .xp-slot-root .xp-ui-combobox { color: var(--xp-text); background: var(--xp-surface); border-color: var(--xp-border-strong); }
|
|
139
|
+
[class*="_PuckFields"] .xp-slot-root .xp-ui-combobox:hover { border-color: var(--xp-text-3); }
|
|
140
|
+
[class*="_PuckFields"] .xp-slot-root .xp-ui-combobox:focus-visible { outline: 2px solid var(--xp-focus); }
|
|
141
|
+
[class*="_PuckFields"] .xp-slot-root .xp-ui-combobox[aria-invalid='true'] { border-color: var(--xp-error); }
|
|
142
|
+
[class*="_PuckFields"] .xp-slot-root .xp-ui-combobox:disabled { opacity: 1; color: var(--xp-text-2); background: var(--xp-surface-3); border-color: var(--xp-border-strong); }
|
|
143
|
+
[class*="_PuckFields"] .xp-slot-root .xp-ui-combobox > span:first-child { color: inherit; }
|
|
144
|
+
[class*="_PuckFields"] .xp-slot-root .xp-ui-combobox-chevron { border-right-color: var(--xp-text-2); border-bottom-color: var(--xp-text-2); }
|
|
145
|
+
[class*="_PuckFields"] .xp-slot-root .xp-ui-combobox-popup { color: var(--xp-text); background: var(--xp-surface); border-color: var(--xp-border-strong); }
|
|
146
|
+
[class*="_PuckFields"] .xp-slot-root .xp-ui-combobox-option { color: var(--xp-text); }
|
|
147
|
+
[class*="_PuckFields"] .xp-slot-root .xp-ui-combobox-option[data-active='true'] { color: var(--xp-text); background: var(--xp-surface-3); outline: 1px solid var(--xp-border-strong); }
|
|
148
|
+
[class*="_PuckFields"] .xp-slot-root .xp-ui-combobox-option[aria-disabled='true'] { color: var(--xp-text-3); }
|
|
149
|
+
[class*="_PuckFields"] .xp-slot-root .xp-ui-combobox-group { color: var(--xp-text-2); }
|
|
150
|
+
[class*="_PuckFields"] .xp-puck-field .xp-ui-button:disabled,
|
|
151
|
+
[class*="_PuckFields"] .xp-puck-field .xp-ui-button[aria-disabled='true'] {
|
|
142
152
|
opacity: 1;
|
|
143
153
|
background: var(--xp-surface-3);
|
|
144
154
|
border-color: var(--xp-border-strong);
|
|
@@ -169,11 +179,122 @@
|
|
|
169
179
|
|
|
170
180
|
.xp-slot-editor .xp-ui-tabbar { flex: 1 1 auto; min-width: 0; }
|
|
171
181
|
|
|
172
|
-
.xp-slot-weight-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--xp-space-2); }
|
|
173
182
|
.xp-slot-sidebar { display: grid; gap: var(--xp-space-4); }
|
|
174
183
|
.xp-slot-sidebar section, .xp-slot-sidebar section > div { display: grid; gap: var(--xp-space-3); }
|
|
175
|
-
.xp-slot-sidebar h4 { margin: 0; font: inherit; font-weight: 600; }
|
|
176
184
|
.xp-slot-sidebar .xp-slot-weight-inputs { display: grid; }
|
|
177
185
|
.xp-slot-sidebar .xp-slot-weight-inputs .xp-ui-field { max-width: none; flex: 1 1 100%; }
|
|
178
186
|
|
|
179
|
-
|
|
187
|
+
/* Grid stretching must not turn a status chip into a full-width bar. */
|
|
188
|
+
.xp-slot-sidebar .xp-ui-status { justify-self: start; width: max-content; }
|
|
189
|
+
.xp-slot-sidebar fieldset { min-width: 0; }
|
|
190
|
+
|
|
191
|
+
.xp-slot-header .xp-ui-status { flex: none; }
|
|
192
|
+
|
|
193
|
+
.xp-slot-title-sentence {
|
|
194
|
+
white-space: normal;
|
|
195
|
+
overflow: visible;
|
|
196
|
+
overflow-wrap: anywhere;
|
|
197
|
+
text-overflow: clip;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/* Compact field cards fit the Puck sidebar and wrap by their own available width. */
|
|
201
|
+
.xp-slot-sidebar .xp-slot-test-heading {
|
|
202
|
+
display: grid;
|
|
203
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
204
|
+
align-items: start;
|
|
205
|
+
gap: var(--xp-space-2);
|
|
206
|
+
}
|
|
207
|
+
.xp-slot-test-heading > strong { min-width: 0; overflow-wrap: anywhere; }
|
|
208
|
+
.xp-slot-sidebar .xp-ui-banner {
|
|
209
|
+
min-width: 0;
|
|
210
|
+
padding: var(--xp-space-2) var(--xp-space-3);
|
|
211
|
+
gap: var(--xp-space-2);
|
|
212
|
+
font: var(--xp-text-small);
|
|
213
|
+
overflow-wrap: anywhere;
|
|
214
|
+
}
|
|
215
|
+
.xp-slot-sidebar .xp-ui-banner > p { min-width: 0; }
|
|
216
|
+
.xp-slot-version-controls, .xp-slot-weights { display: grid; gap: var(--xp-space-2); min-width: 0; }
|
|
217
|
+
.xp-slot-sidebar .xp-slot-weight-inputs { gap: var(--xp-space-2); }
|
|
218
|
+
.xp-slot-version-item { min-width: 0; }
|
|
219
|
+
.xp-slot-version-group {
|
|
220
|
+
display: grid;
|
|
221
|
+
gap: var(--xp-space-2);
|
|
222
|
+
padding: var(--xp-space-2);
|
|
223
|
+
border: 1px solid var(--xp-border-strong);
|
|
224
|
+
border-radius: var(--xp-radius-control);
|
|
225
|
+
background: var(--xp-surface);
|
|
226
|
+
min-width: 0;
|
|
227
|
+
container-type: inline-size;
|
|
228
|
+
}
|
|
229
|
+
.xp-slot-version-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) 72px; align-items: start; gap: var(--xp-space-half) var(--xp-space-2); min-width: 0; }
|
|
230
|
+
.xp-slot-version-open {
|
|
231
|
+
position: relative;
|
|
232
|
+
grid-area: 1 / 1;
|
|
233
|
+
min-width: 24px;
|
|
234
|
+
min-height: 32px;
|
|
235
|
+
padding: 0;
|
|
236
|
+
border: 0;
|
|
237
|
+
border-radius: var(--xp-radius-control);
|
|
238
|
+
background: transparent;
|
|
239
|
+
cursor: pointer;
|
|
240
|
+
}
|
|
241
|
+
.xp-slot-version-open::before { content: ''; position: absolute; inset-block: 4px; inset-inline-start: 0; width: 3px; border-radius: 2px; background: var(--xp-border-strong); }
|
|
242
|
+
.xp-slot-version-open[aria-pressed='true']::before { background: var(--xp-focus); }
|
|
243
|
+
.xp-slot-version-open:focus-visible { outline: 2px solid var(--xp-focus); outline-offset: 2px; }
|
|
244
|
+
.xp-slot-version-open:disabled { cursor: not-allowed; }
|
|
245
|
+
/* Flatten only field layout boxes so their feedback uses the entire card row. */
|
|
246
|
+
.xp-slot-version-name, .xp-slot-version-traffic, .xp-slot-version-row .xp-ui-field { display: contents; }
|
|
247
|
+
.xp-slot-version-name .xp-ui-input { grid-area: 1 / 2; min-width: 0; font-weight: 600; }
|
|
248
|
+
.xp-slot-version-traffic .xp-ui-input { grid-area: 1 / 3; min-width: 0; }
|
|
249
|
+
.xp-slot-version-label { grid-area: 1 / 2 / auto / -1; align-self: center; min-width: 0; overflow-wrap: anywhere; }
|
|
250
|
+
.xp-slot-version-row .xp-ui-error { grid-column: 1 / -1; margin: 0; }
|
|
251
|
+
/* Reserve one feedback line. Visibility preserves geometry between saves. */
|
|
252
|
+
.xp-slot-version-saved { grid-column: 1 / -1; min-height: 16px; margin: 0; font: var(--xp-text-small); }
|
|
253
|
+
.xp-slot-version-row:has(.xp-ui-error) .xp-slot-version-saved { display: none; }
|
|
254
|
+
.xp-slot-version-row > .xp-slot-version-actions, .xp-slot-version-help { grid-column: 1 / -1; margin: 0; }
|
|
255
|
+
@container (max-width: 220px) {
|
|
256
|
+
.xp-slot-version-group > .xp-slot-version-row { grid-template-columns: 24px minmax(0, 1fr); }
|
|
257
|
+
.xp-slot-version-traffic .xp-ui-input { grid-area: 2 / 2; width: 72px; justify-self: end; }
|
|
258
|
+
.xp-slot-version-traffic .xp-slot-percent { grid-area: 2 / 2; }
|
|
259
|
+
}
|
|
260
|
+
.xp-slot-version-row .xp-ui-field > label {
|
|
261
|
+
position: absolute;
|
|
262
|
+
width: 1px;
|
|
263
|
+
height: 1px;
|
|
264
|
+
padding: 0;
|
|
265
|
+
margin: -1px;
|
|
266
|
+
overflow: hidden;
|
|
267
|
+
clip-path: inset(50%);
|
|
268
|
+
white-space: nowrap;
|
|
269
|
+
}
|
|
270
|
+
.xp-slot-version-row .xp-ui-input { height: 32px; padding-inline: var(--xp-space-2); font-size: 13px; }
|
|
271
|
+
.xp-slot-version-row .xp-ui-input--number { padding-inline-end: 22px; appearance: textfield; }
|
|
272
|
+
.xp-slot-version-row .xp-ui-input--number::-webkit-inner-spin-button,
|
|
273
|
+
.xp-slot-version-row .xp-ui-input--number::-webkit-outer-spin-button { appearance: none; margin: 0; }
|
|
274
|
+
.xp-slot-percent { position: relative; grid-area: 1 / 3; justify-self: end; inset-inline-end: var(--xp-space-2); top: 6px; font: var(--xp-text-small); color: var(--xp-text-2); pointer-events: none; }
|
|
275
|
+
.xp-slot-version-actions { display: flex; align-items: stretch; gap: var(--xp-space-one-half); min-width: 0; }
|
|
276
|
+
.xp-slot-version-actions > * { flex: 1 1 0; min-width: 0; }
|
|
277
|
+
.xp-slot-version-actions > div { display: flex; }
|
|
278
|
+
.xp-slot-version-actions .xp-ui-button { flex: 1; height: auto; min-height: 30px; padding: var(--xp-space-1) var(--xp-space-one-half); font-size: 12px; line-height: 16px; }
|
|
279
|
+
/* Match the solid disabled-button pattern without fading readable field values. */
|
|
280
|
+
.xp-slot-sidebar .xp-ui-input[aria-disabled='true'] {
|
|
281
|
+
opacity: 1;
|
|
282
|
+
background: var(--xp-surface-3);
|
|
283
|
+
border-color: var(--xp-border-strong);
|
|
284
|
+
color: var(--xp-text-2);
|
|
285
|
+
cursor: not-allowed;
|
|
286
|
+
}
|
|
287
|
+
.xp-slot-lock-notice {
|
|
288
|
+
padding: var(--xp-space-2) var(--xp-space-3);
|
|
289
|
+
border: 1px solid var(--xp-warning-border);
|
|
290
|
+
border-radius: var(--xp-radius-control);
|
|
291
|
+
background: var(--xp-warning-bg);
|
|
292
|
+
color: var(--xp-warning);
|
|
293
|
+
font: var(--xp-text-small);
|
|
294
|
+
overflow-wrap: anywhere;
|
|
295
|
+
scroll-margin-block: var(--xp-space-3);
|
|
296
|
+
}
|
|
297
|
+
.xp-slot-lock-notice[data-attention='true'] { border-color: var(--xp-error-border); background: var(--xp-error-bg); color: var(--xp-error); outline: 2px solid var(--xp-error); outline-offset: 2px; }
|
|
298
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
299
|
+
.xp-slot-lock-notice { transition: outline-color 180ms; }
|
|
300
|
+
}
|