@pygmalionjs/pygmalion 0.19.0 → 0.20.1

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,60 @@
1
+ import type { StoryboardEnvironment } from './designImport.js';
2
+ /**
3
+ * One value of a catalog condition axis.
4
+ *
5
+ * The environment is what the value means to the browser: boot storage,
6
+ * permissions, devices, an opaque screen preset. It is merged into the
7
+ * storyboard baseline, so every capture fingerprint, flow session and
8
+ * Application run re-resolves under it. An option without an environment is a
9
+ * pure catalog choice and leaves existing capture identities untouched.
10
+ */
11
+ export interface CatalogConditionAxisOptionDef {
12
+ value: string;
13
+ label: string;
14
+ description?: string;
15
+ environment?: StoryboardEnvironment;
16
+ }
17
+ /**
18
+ * One independent condition the whole catalog can be seen under.
19
+ *
20
+ * A session preset is a single runtime choice; a preview environment control
21
+ * dresses only the live preview. Products also have flags that cut across both:
22
+ * a color scheme, an account level, a feature entitlement. Each is its own axis
23
+ * with stable value ids. Screens say in `conditions` which values they exist
24
+ * under; a screen that names no axis exists under every value of it.
25
+ *
26
+ * Without `defaultValue` an unselected axis constrains nothing, the same way the
27
+ * legacy "Default" session shows every runtime. With one, the default is the
28
+ * effective value from the start.
29
+ */
30
+ export interface CatalogConditionAxisDef {
31
+ id: string;
32
+ label: string;
33
+ description?: string;
34
+ defaultValue?: string;
35
+ options: readonly CatalogConditionAxisOptionDef[];
36
+ }
37
+ /** Explicit selections only; defaults stay implicit. */
38
+ export type CatalogConditionSelections = Readonly<Record<string, string>>;
39
+ /** Values, per axis id, a screen exists under. Absent axes mean every value. */
40
+ export type ScreenConditionDeclaration = Readonly<Record<string, readonly string[]>>;
41
+ /**
42
+ * One editor's declared condition axes, the explicit selections, and the
43
+ * environment they contribute to the storyboard baseline.
44
+ */
45
+ export declare function createConditionAxes(deps: {
46
+ setStoryboardBaselineEnvironment(environment?: StoryboardEnvironment): void;
47
+ }): {
48
+ setConditionAxes: (next: readonly CatalogConditionAxisDef[]) => void;
49
+ getConditionAxes: () => readonly CatalogConditionAxisDef[];
50
+ getConditionAxisValue: (axisId: string) => string | null | undefined;
51
+ getConditionAxisSelections: () => CatalogConditionSelections;
52
+ selectConditionAxisValue: (axisId: string, value: string | null) => void;
53
+ clearConditionAxisSelections: () => void;
54
+ getConditionAxesEnvironment: () => StoryboardEnvironment | undefined;
55
+ isInSelectedConditions: (conditions: ScreenConditionDeclaration | undefined) => boolean;
56
+ conditionDeclarationIssues: (conditions: ScreenConditionDeclaration | undefined) => string[];
57
+ subscribeConditionAxes: (listener: () => void) => () => void;
58
+ getConditionAxesRevision: () => number;
59
+ };
60
+ export type ConditionAxes = ReturnType<typeof createConditionAxes>;
@@ -1,11 +1,13 @@
1
+ import { type ScreenConditionDeclaration } from './conditionAxes.js';
2
+ import type { StoryboardEnvironment } from './designImport.js';
1
3
  export declare function createEditorDeclarations(): {
2
4
  setPreviewDependencyDigests: (routes: readonly {
3
5
  path?: string;
4
6
  dependencyDigest?: string;
5
7
  }[] | null) => void;
6
8
  previewDependencyDigest: (route: string) => string | undefined;
7
- routePreviewFrameRecipe: (page: import("./previewBootstrap.js").PreviewFramePage, baselineEnvironment?: import("./designImport.js").StoryboardEnvironment) => import("./previewBootstrap.js").RoutePreviewFrameRecipe;
8
- createRoutePreviewFrameFingerprint: (page: import("./previewBootstrap.js").PreviewFramePage, previewRevision: string, baselineEnvironment?: import("./designImport.js").StoryboardEnvironment) => string;
9
+ routePreviewFrameRecipe: (page: import("./previewBootstrap.js").PreviewFramePage, baselineEnvironment?: StoryboardEnvironment) => import("./previewBootstrap.js").RoutePreviewFrameRecipe;
10
+ createRoutePreviewFrameFingerprint: (page: import("./previewBootstrap.js").PreviewFramePage, previewRevision: string, baselineEnvironment?: StoryboardEnvironment) => string;
9
11
  setDesignImportController: (controller: import("./designImport.js").DesignImportController | null) => void;
10
12
  getDesignImportController: () => import("./designImport.js").DesignImportController | null;
11
13
  setSurfaceClassifications: (classifications: readonly import("./surfaceDemands.js").SurfaceClassification[] | undefined) => void;
@@ -20,17 +22,33 @@ export declare function createEditorDeclarations(): {
20
22
  subscribeStoryboardGraph: (listener: () => void) => () => void;
21
23
  bumpPreviewIdentityEpoch: () => void;
22
24
  getPreviewIdentityEpoch: () => number;
23
- setStoryboardBaselineEnvironment: (environment?: import("./designImport.js").StoryboardEnvironment) => void;
24
- getStoryboardBaselineEnvironment: () => import("./designImport.js").StoryboardEnvironment | undefined;
25
+ setStoryboardBaselineEnvironment: (environment?: StoryboardEnvironment) => void;
26
+ getStoryboardBaselineEnvironment: () => StoryboardEnvironment | undefined;
25
27
  setPreviewEnvironmentControls: (next: readonly import("./previewEnvironmentControls.js").PreviewEnvironmentControlDef[]) => void;
26
28
  getPreviewEnvironmentControls: () => readonly import("./previewEnvironmentControls.js").PreviewEnvironmentControlDef[];
27
29
  getPreviewEnvironmentControlSelections: () => Readonly<Record<string, string>>;
28
30
  getPreviewEnvironmentControlValue: (controlId: string) => string | undefined;
29
31
  setPreviewEnvironmentControlValue: (controlId: string, value: string) => void;
30
32
  clearPreviewEnvironmentControlValues: () => void;
31
- getPreviewEnvironmentOverride: () => import("./designImport.js").StoryboardEnvironment | undefined;
33
+ getPreviewEnvironmentOverride: () => StoryboardEnvironment | undefined;
32
34
  subscribePreviewEnvironmentControls: (listener: () => void) => () => void;
33
35
  getPreviewEnvironmentControlRevision: () => number;
36
+ isPageInSelectedConditions: (page: {
37
+ runtimes?: readonly string[];
38
+ conditions?: ScreenConditionDeclaration;
39
+ }) => boolean;
40
+ setStoryboardDiscoveryBaselineEnvironment: (environment?: StoryboardEnvironment) => void;
41
+ setConditionAxes: (next: readonly import("./conditionAxes.js").CatalogConditionAxisDef[]) => void;
42
+ getConditionAxes: () => readonly import("./conditionAxes.js").CatalogConditionAxisDef[];
43
+ getConditionAxisValue: (axisId: string) => string | null | undefined;
44
+ getConditionAxisSelections: () => import("./conditionAxes.js").CatalogConditionSelections;
45
+ selectConditionAxisValue: (axisId: string, value: string | null) => void;
46
+ clearConditionAxisSelections: () => void;
47
+ getConditionAxesEnvironment: () => StoryboardEnvironment | undefined;
48
+ isInSelectedConditions: (conditions: ScreenConditionDeclaration | undefined) => boolean;
49
+ conditionDeclarationIssues: (conditions: ScreenConditionDeclaration | undefined) => string[];
50
+ subscribeConditionAxes: (listener: () => void) => () => void;
51
+ getConditionAxesRevision: () => number;
34
52
  setSessionPresets: (next: readonly import("./sessionPresets.js").SessionPresetDef[]) => void;
35
53
  getSessionPresets: () => import("./sessionPresets.js").SessionPresetDef[];
36
54
  getSelectedSessionPreset: () => number | null;
@@ -258,6 +258,12 @@ export interface DesignImportPage {
258
258
  * runtime — only the screens a runtime cannot reach at all need to say so.
259
259
  */
260
260
  runtimes?: readonly string[];
261
+ /**
262
+ * Values, per condition axis id, this screen exists under. An absent axis
263
+ * means every value of it; unknown ids or values hide the screen and are
264
+ * reported as declaration issues rather than passing silently.
265
+ */
266
+ conditions?: Readonly<Record<string, readonly string[]>>;
261
267
  scenarioId?: string;
262
268
  /**
263
269
  * Every scenario this screen demonstrates. Coverage is the whole set; the
@@ -400,6 +406,12 @@ export interface DesignImportInitialPage {
400
406
  * runtime — only the screens a runtime cannot reach at all need to say so.
401
407
  */
402
408
  runtimes?: readonly string[];
409
+ /**
410
+ * Values, per condition axis id, this screen exists under. An absent axis
411
+ * means every value of it; unknown ids or values hide the screen and are
412
+ * reported as declaration issues rather than passing silently.
413
+ */
414
+ conditions?: Readonly<Record<string, readonly string[]>>;
403
415
  scenarioId?: string;
404
416
  /** Every authored scenario this initial screen demonstrates. */
405
417
  scenarioIds?: readonly string[];
@@ -7,6 +7,7 @@ import type { FrameBranchKindDef, FrameLabelLabels } from './frameLabels.js';
7
7
  import type { ScreenLaneDef } from './frameLanes.js';
8
8
  import { type ScreenStateAxisDef } from './interactiveStates.js';
9
9
  import type { PreviewEnvironmentControlDef } from './previewEnvironmentControls.js';
10
+ import type { CatalogConditionAxisDef } from './conditionAxes.js';
10
11
  import type { RegistryEntry } from './registry.js';
11
12
  import type { ScenarioCoverageClaim } from './scenarioCoverage.js';
12
13
  import type { ScreenCardDef } from './screenCards.js';
@@ -55,6 +56,8 @@ export interface PygmalionRevisionCatalogV1 {
55
56
  viewportPresets?: readonly ViewportPresetDef[];
56
57
  sessionPresets?: readonly SessionPresetDef[];
57
58
  previewEnvironmentControls?: readonly PreviewEnvironmentControlDef[];
59
+ /** Independent catalog conditions every screen, capture and run resolves under. */
60
+ conditionAxes?: readonly CatalogConditionAxisDef[];
58
61
  screenFlows?: readonly ScreenFlowPath[];
59
62
  scenarioCoverage?: readonly ScenarioCoverageClaim[];
60
63
  screenDimensions?: readonly ScreenDimensionDef[];
@@ -4,6 +4,7 @@ import type { FrameBranchKindDef, FrameLabelLabels } from './frameLabels.js';
4
4
  import type { ScreenLaneDef } from './frameLanes.js';
5
5
  import type { ScreenStateAxisDef } from './interactiveStates.js';
6
6
  import type { PreviewEnvironmentControlDef } from './previewEnvironmentControls.js';
7
+ import type { CatalogConditionAxisDef } from './conditionAxes.js';
7
8
  import type { ComponentRegistry, RegistryEntry } from './registry.js';
8
9
  import type { ScenarioCoverageClaim } from './scenarioCoverage.js';
9
10
  import type { ScreenCardDef } from './screenCards.js';
@@ -27,6 +28,7 @@ export interface RevisionCatalogDeclarations {
27
28
  viewportPresets?: readonly ViewportPresetDef[];
28
29
  sessionPresets?: readonly SessionPresetDef[];
29
30
  previewEnvironmentControls?: readonly PreviewEnvironmentControlDef[];
31
+ conditionAxes?: readonly CatalogConditionAxisDef[];
30
32
  screenFlows?: readonly ScreenFlowPath[];
31
33
  scenarioCoverage?: readonly ScenarioCoverageClaim[];
32
34
  screenDimensions?: readonly ScreenDimensionDef[];
@@ -205,6 +205,12 @@ export interface PageModel {
205
205
  * a runtime cannot reach at all need to say so.
206
206
  */
207
207
  runtimes?: readonly string[];
208
+ /**
209
+ * Values, per condition axis id, this screen exists under. An absent axis
210
+ * means every value of it; unknown ids or values hide the screen and are
211
+ * reported as declaration issues rather than passing silently.
212
+ */
213
+ conditions?: Readonly<Record<string, readonly string[]>>;
208
214
  scenarioId?: string;
209
215
  /** Every scenario the screen demonstrates; coverage counts this set. */
210
216
  scenarioIds?: readonly string[];
@@ -2,6 +2,11 @@ import type { StoryboardEnvironment } from './designImport.js';
2
2
  export declare const STORYBOARD_ENVIRONMENT_QUERY: "__pygmalion_environment";
3
3
  export declare const STORYBOARD_ENVIRONMENT_CONTROL: "/__pygmalion-storyboard/environment";
4
4
  export declare function mergeStoryboardEnvironment(base?: StoryboardEnvironment, override?: StoryboardEnvironment): StoryboardEnvironment | undefined;
5
+ /**
6
+ * Drops record keys the merge left empty so a composed environment reads, and
7
+ * hashes, the same as one declared directly. `undefined` when nothing remains.
8
+ */
9
+ export declare function compactStoryboardEnvironment(environment?: StoryboardEnvironment): StoryboardEnvironment | undefined;
5
10
  /**
6
11
  * Boot-time environment derived from a screen preset — parity with the Node
7
12
  * capture runtime's init script, which installs the preset global and seeds
@@ -174,6 +174,8 @@ export { SourceRefControl } from './ui/SourceRefControl.js';
174
174
  export type { SourceRefControlProps } from './ui/SourceRefControl.js';
175
175
  export type { TokenDef } from './editor/tokens.js';
176
176
  import type { SessionPresetDef } from './editor/sessionPresets.js';
177
+ import type { CatalogConditionAxisDef } from './editor/conditionAxes.js';
178
+ export type { CatalogConditionAxisDef, CatalogConditionAxisOptionDef, CatalogConditionSelections, ScreenConditionDeclaration, } from './editor/conditionAxes.js';
177
179
  export type { ViewportPresetDef } from './editor/viewportPresets.js';
178
180
  export type { SessionPresetDef } from './editor/sessionPresets.js';
179
181
  export { GENERIC_ASSERTION_SHARE, MIN_UNVERIFIED_REASON_LENGTH, detectStateGroupCandidates, hooksInSelector, summarizeConditionCoverage, validateHookTargeting, validateScreenConformance, } from './editor/screenConformance.js';
@@ -237,6 +239,13 @@ export interface PygmalionEditorProps {
237
239
  sessionPresets?: readonly SessionPresetDef[];
238
240
  /** Host-declared browser conditions shown in the active frame's Preview inspector. */
239
241
  previewEnvironmentControls?: readonly PreviewEnvironmentControlDef[];
242
+ /**
243
+ * Independent catalog conditions — a color scheme, an account level — that
244
+ * every screen, capture and run resolves under. Screens name the values they
245
+ * exist in through `conditions`; an option's environment joins the storyboard
246
+ * baseline so captures re-resolve when the value changes.
247
+ */
248
+ conditionAxes?: readonly CatalogConditionAxisDef[];
240
249
  /** A public importer that provides unified control over code inventory and importing of entire DOM layers. */
241
250
  designImport?: DesignImportController;
242
251
  /** Called with cumulative changes when editing a token in the Assets panel — the host is responsible for writing back (file saving). */
@@ -1,7 +1,7 @@
1
1
  import type { EditorDeclarations } from '../editor/declarations.js';
2
2
 
3
3
  export interface WorkspaceConditionsProps {
4
- declarations: Pick<EditorDeclarations, 'getSessionPresets' | 'getSelectedSessionPreset' | 'selectSessionPreset' | 'subscribeSessionPresets' | 'getPreviewEnvironmentControls' | 'getPreviewEnvironmentControlValue' | 'getPreviewEnvironmentControlSelections' | 'setPreviewEnvironmentControlValue' | 'clearPreviewEnvironmentControlValues' | 'subscribePreviewEnvironmentControls' | 'getPreviewEnvironmentControlRevision'>;
4
+ declarations: Pick<EditorDeclarations, 'getSessionPresets' | 'getSelectedSessionPreset' | 'selectSessionPreset' | 'subscribeSessionPresets' | 'getConditionAxes' | 'getConditionAxisValue' | 'getConditionAxisSelections' | 'selectConditionAxisValue' | 'clearConditionAxisSelections' | 'subscribeConditionAxes' | 'getConditionAxesRevision' | 'getPreviewEnvironmentControls' | 'getPreviewEnvironmentControlValue' | 'getPreviewEnvironmentControlSelections' | 'setPreviewEnvironmentControlValue' | 'clearPreviewEnvironmentControlValues' | 'subscribePreviewEnvironmentControls' | 'getPreviewEnvironmentControlRevision'>;
5
5
  }
6
6
  /** Present declared catalog sessions and preview values without interpreting product policy. */
7
7
  export declare function WorkspaceConditions({ declarations }: WorkspaceConditionsProps): import("react").JSX.Element | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pygmalionjs/pygmalion",
3
- "version": "0.19.0",
3
+ "version": "0.20.1",
4
4
  "description": "Code-backed DOM design sandbox and visual QA editor",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {