@ng-prism/core 22.5.0 → 22.6.0

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.
Files changed (118) hide show
  1. package/README.md +2 -0
  2. package/dist/app/canvas/prism-canvas-toolbar.component.d.ts +22 -1
  3. package/dist/app/canvas/prism-canvas-toolbar.component.d.ts.map +1 -1
  4. package/dist/app/canvas/prism-canvas-toolbar.component.js +111 -38
  5. package/dist/app/canvas/state-chips.d.ts +50 -0
  6. package/dist/app/canvas/state-chips.d.ts.map +1 -0
  7. package/dist/app/canvas/state-chips.js +40 -0
  8. package/dist/app/component-head/prism-component-head.component.d.ts +1 -0
  9. package/dist/app/component-head/prism-component-head.component.d.ts.map +1 -1
  10. package/dist/app/component-head/prism-component-head.component.js +11 -6
  11. package/dist/app/component-head/prism-head-info.component.d.ts +2 -1
  12. package/dist/app/component-head/prism-head-info.component.d.ts.map +1 -1
  13. package/dist/app/component-head/prism-head-info.component.js +30 -7
  14. package/dist/app/directives/resize-value.d.ts +1 -1
  15. package/dist/app/directives/resize-value.js +1 -1
  16. package/dist/app/discovery-manifest.d.ts +2 -2
  17. package/dist/app/discovery-manifest.d.ts.map +1 -1
  18. package/dist/app/discovery-manifest.js +15 -3
  19. package/dist/app/overview/open-in-playground.d.ts +11 -0
  20. package/dist/app/overview/open-in-playground.d.ts.map +1 -0
  21. package/dist/app/overview/open-in-playground.js +12 -0
  22. package/dist/app/overview/overview-matrix.d.ts +79 -0
  23. package/dist/app/overview/overview-matrix.d.ts.map +1 -0
  24. package/dist/app/overview/overview-matrix.js +98 -0
  25. package/dist/app/overview/overview-visibility.d.ts +10 -2
  26. package/dist/app/overview/overview-visibility.d.ts.map +1 -1
  27. package/dist/app/overview/overview-visibility.js +14 -3
  28. package/dist/app/overview/prism-overview-cell.component.d.ts +23 -2
  29. package/dist/app/overview/prism-overview-cell.component.d.ts.map +1 -1
  30. package/dist/app/overview/prism-overview-cell.component.js +133 -27
  31. package/dist/app/overview/prism-overview-matrix.component.d.ts +29 -0
  32. package/dist/app/overview/prism-overview-matrix.component.d.ts.map +1 -0
  33. package/dist/app/overview/prism-overview-matrix.component.js +164 -0
  34. package/dist/app/overview/prism-overview.component.d.ts +4 -0
  35. package/dist/app/overview/prism-overview.component.d.ts.map +1 -1
  36. package/dist/app/overview/prism-overview.component.js +37 -14
  37. package/dist/app/panels/a11y/a11y-core.plugin.d.ts.map +1 -1
  38. package/dist/app/panels/a11y/a11y-core.plugin.js +0 -1
  39. package/dist/app/panels/controls/controls-plugin.d.ts.map +1 -1
  40. package/dist/app/panels/controls/controls-plugin.js +1 -2
  41. package/dist/app/panels/events/events-plugin.d.ts.map +1 -1
  42. package/dist/app/panels/events/events-plugin.js +1 -2
  43. package/dist/app/pseudo/pseudo-state-marker.d.ts +32 -10
  44. package/dist/app/pseudo/pseudo-state-marker.d.ts.map +1 -1
  45. package/dist/app/pseudo/pseudo-state-marker.js +83 -67
  46. package/dist/app/pseudo/pseudo-targets.d.ts +11 -0
  47. package/dist/app/pseudo/pseudo-targets.d.ts.map +1 -0
  48. package/dist/app/pseudo/pseudo-targets.js +46 -0
  49. package/dist/app/pseudo/state-fit.d.ts +28 -0
  50. package/dist/app/pseudo/state-fit.d.ts.map +1 -0
  51. package/dist/app/pseudo/state-fit.js +97 -0
  52. package/dist/app/renderer/input-bindings.d.ts +16 -0
  53. package/dist/app/renderer/input-bindings.d.ts.map +1 -0
  54. package/dist/app/renderer/input-bindings.js +21 -0
  55. package/dist/app/renderer/known-inputs.d.ts +8 -1
  56. package/dist/app/renderer/known-inputs.d.ts.map +1 -1
  57. package/dist/app/renderer/known-inputs.js +13 -5
  58. package/dist/app/renderer/prism-renderer.component.d.ts +10 -3
  59. package/dist/app/renderer/prism-renderer.component.d.ts.map +1 -1
  60. package/dist/app/renderer/prism-renderer.component.js +51 -29
  61. package/dist/app/renderer/projectable-content.d.ts +8 -1
  62. package/dist/app/renderer/projectable-content.d.ts.map +1 -1
  63. package/dist/app/renderer/projectable-content.js +40 -29
  64. package/dist/app/renderer/rendered-key.d.ts +20 -6
  65. package/dist/app/renderer/rendered-key.d.ts.map +1 -1
  66. package/dist/app/renderer/rendered-key.js +25 -8
  67. package/dist/app/renderer/snippet-generator.js +7 -5
  68. package/dist/app/services/prism-pseudo-state.service.d.ts +59 -14
  69. package/dist/app/services/prism-pseudo-state.service.d.ts.map +1 -1
  70. package/dist/app/services/prism-pseudo-state.service.js +86 -29
  71. package/dist/app/services/prism-renderer.service.d.ts +17 -0
  72. package/dist/app/services/prism-renderer.service.d.ts.map +1 -1
  73. package/dist/app/services/prism-renderer.service.js +37 -2
  74. package/dist/app/services/prism-url-state.service.d.ts.map +1 -1
  75. package/dist/app/services/prism-url-state.service.js +39 -8
  76. package/dist/app/theme/prism-default-theme.d.ts.map +1 -1
  77. package/dist/app/theme/prism-default-theme.js +6 -5
  78. package/dist/builder/config-loader/deprecated-options.d.ts +7 -0
  79. package/dist/builder/config-loader/deprecated-options.d.ts.map +1 -0
  80. package/dist/builder/config-loader/deprecated-options.js +23 -0
  81. package/dist/builder/manifest/runtime-manifest.generator.d.ts.map +1 -1
  82. package/dist/builder/manifest/runtime-manifest.generator.js +3 -2
  83. package/dist/builder/scanner/component.scanner.d.ts.map +1 -1
  84. package/dist/builder/scanner/component.scanner.js +20 -1
  85. package/dist/builder/scanner/entry-point-discovery.d.ts +5 -0
  86. package/dist/builder/scanner/entry-point-discovery.d.ts.map +1 -1
  87. package/dist/builder/scanner/entry-point-discovery.js +14 -0
  88. package/dist/builder/scanner/entry-point.scanner.d.ts +3 -1
  89. package/dist/builder/scanner/entry-point.scanner.d.ts.map +1 -1
  90. package/dist/builder/scanner/entry-point.scanner.js +7 -6
  91. package/dist/builder/scanner/input.extractor.d.ts.map +1 -1
  92. package/dist/builder/scanner/input.extractor.js +22 -3
  93. package/dist/builder/scanner/pseudo-states.d.ts +1 -0
  94. package/dist/builder/scanner/pseudo-states.d.ts.map +1 -1
  95. package/dist/builder/scanner/pseudo-states.js +1 -1
  96. package/dist/builder/scanner/scanner.d.ts +2 -2
  97. package/dist/builder/scanner/scanner.d.ts.map +1 -1
  98. package/dist/builder/scanner/scanner.js +16 -6
  99. package/dist/builder/scanner/showcase-diagnostics.js +9 -9
  100. package/dist/builder/scanner/showcase-states.d.ts +17 -0
  101. package/dist/builder/scanner/showcase-states.d.ts.map +1 -0
  102. package/dist/builder/scanner/showcase-states.js +58 -0
  103. package/dist/builder/scanner/source-file-cache.d.ts +26 -0
  104. package/dist/builder/scanner/source-file-cache.d.ts.map +1 -0
  105. package/dist/builder/scanner/source-file-cache.js +60 -0
  106. package/dist/builder/shared/prism-pipeline.d.ts.map +1 -1
  107. package/dist/builder/shared/prism-pipeline.js +28 -13
  108. package/dist/decorator/index.d.ts +1 -1
  109. package/dist/decorator/index.d.ts.map +1 -1
  110. package/dist/decorator/showcase.types.d.ts +23 -0
  111. package/dist/decorator/showcase.types.d.ts.map +1 -1
  112. package/dist/plugin/index.d.ts +1 -1
  113. package/dist/plugin/index.d.ts.map +1 -1
  114. package/dist/plugin/plugin.types.d.ts +44 -5
  115. package/dist/plugin/plugin.types.d.ts.map +1 -1
  116. package/package.json +1 -1
  117. package/src/builder/build/schema.json +6 -6
  118. package/src/builder/serve/schema.json +6 -6
@@ -1,24 +1,48 @@
1
+ import type { ShowcaseState } from '../../decorator/showcase.types.js';
1
2
  import { type ForcedPseudoStates, type PseudoState } from '../../shared/pseudo-state.type.js';
2
3
  import { PseudoStateMarker } from '../pseudo/pseudo-state-marker.js';
4
+ import type { StateFit } from '../pseudo/state-fit.js';
3
5
  import * as i0 from "@angular/core";
4
6
  /** Per state: forced on (`true`) or off (`false`) on top of what the variant declares. */
5
7
  export type PseudoStateOverride = Partial<Record<PseudoState, boolean>>;
8
+ /** What the canvas forces, in the two layers the marker takes. */
9
+ export interface PseudoLayers {
10
+ /** The variant's own states, with the user's toggles on top: forced as they are. */
11
+ base: ForcedPseudoStates | null;
12
+ /** The active state's pseudo: forced only where {@link PrismPseudoStateService.canvasFit} says it fits. `null` when no state applies, or the toggles switched off all of it. */
13
+ state: ForcedPseudoStates | null;
14
+ }
6
15
  /**
7
- * `declared` with the user's toggles from the tools menu on top.
16
+ * The variant's and the active state's pseudo states with the user's toggles
17
+ * from the tools menu on top.
8
18
  *
9
- * Returns `declared` itself while nothing is toggled, so the renderer, which
10
- * waits for the exact states object it was given, is not sent a copy. A state
11
- * switched on from the menu applies to the whole component (`true`), the way a
12
- * pointer over it would. One the variant declares keeps its own target.
19
+ * Returns the two objects it was given while nothing is toggled, so the
20
+ * renderer, which waits for the exact objects it handed the marker, is not sent
21
+ * a copy. A state switched on from the menu applies to the whole component
22
+ * (`true`), the way a pointer over it would, and lands in `base`, which the fit
23
+ * rule does not touch. One the variant or the state declares keeps its own
24
+ * target in its own layer, except that a state which does not fit
25
+ * (`stateFits: false`) is not applied, so a class only it declares is forced on
26
+ * the whole component instead. The state layer itself is the same either way:
27
+ * the marker still gets it, to see when the state fits again. A state switched
28
+ * off leaves both layers. Once the
29
+ * toggles have switched off every class the active state declares, its layer is
30
+ * `null`: that is the user's doing, not a state that forces nothing. A state
31
+ * that declares nothing itself (a slot the scanner could not evaluate) stays an
32
+ * empty object, so the marker can report it.
13
33
  */
14
- export declare function withOverride(declared: ForcedPseudoStates | null, override: PseudoStateOverride): ForcedPseudoStates | null;
34
+ export declare function splitLayers(variantPseudo: ForcedPseudoStates | null, statePseudo: ForcedPseudoStates | null, override: PseudoStateOverride, stateFits?: boolean): PseudoLayers;
15
35
  /**
16
- * The pseudo states the canvas forces on the active variant.
36
+ * The pseudo states the canvas forces on the active variant and the active
37
+ * component-level state.
17
38
  *
18
- * `declared` is `Variant.pseudo`. The tools menu can switch states on and off
19
- * on top of it; like the background override, that toggle is transient and
20
- * resets when the variant or the component changes. Capture mode ignores it:
21
- * it is session UI state and must not shape a baseline.
39
+ * `declared` is `Variant.pseudo`, `activeState` is the `ShowcaseState` picked
40
+ * in `PrismRendererService.activeStateIndex`. They are two layers
41
+ * ({@link PseudoLayers}) because only the state's is subject to the fit rule.
42
+ * The tools menu can switch single states on and off on top of both; like the
43
+ * background override, that toggle is transient and resets when the variant, the
44
+ * state or the component changes. Capture mode ignores it, but applies the
45
+ * state: session UI state must not shape a baseline, the addressed cell must.
22
46
  *
23
47
  * Also owns the document's {@link PseudoStyleSheets}, which every marker shares
24
48
  * so each stylesheet is rewritten once, whether the Playground canvas or an
@@ -29,15 +53,36 @@ export declare class PrismPseudoStateService {
29
53
  private readonly renderer;
30
54
  private readonly capture;
31
55
  private readonly stylesheets;
56
+ private readonly activeVariant;
32
57
  readonly declared: import("@angular/core").Signal<Partial<Record<PseudoState, import("../../shared/pseudo-state.type.js").PseudoTarget>> | null>;
58
+ /** The component-level state on the canvas, whether or not the active variant takes part in it. */
59
+ readonly activeState: import("@angular/core").Signal<ShowcaseState | null>;
60
+ /** `'states: false'` when the active variant opts out while a state is active, else `null`. */
61
+ readonly stateExclusion: import("@angular/core").Signal<string | null>;
62
+ /** What the active state forces: its pseudo, `null` when none is active or the variant opted out. */
63
+ private readonly statePseudo;
33
64
  private readonly _override;
34
65
  readonly override: import("@angular/core").Signal<Partial<Record<PseudoState, boolean>>>;
35
- /** What the canvas forces: `declared`, with the user's toggles on top outside capture mode. */
36
- readonly effective: import("@angular/core").Signal<Partial<Record<PseudoState, import("../../shared/pseudo-state.type.js").PseudoTarget>> | null>;
66
+ /**
67
+ * Whether the active state fits the rendered canvas. Written by the
68
+ * renderer from its marker, `null` while no state is applied.
69
+ */
70
+ readonly canvasFit: import("@angular/core").WritableSignal<StateFit | null>;
71
+ /** `canvasFit` before the first render counts as fitting; a computed so a changed reason alone does not rebuild `layers`. */
72
+ private readonly stateFits;
73
+ /** What the canvas forces: `declared` and the active state with the user's toggles on top, which capture mode leaves out. */
74
+ readonly layers: import("@angular/core").Signal<PseudoLayers>;
37
75
  constructor();
76
+ /** Whether `state` is forced on the canvas now: by the variant, or by the active state while it fits. */
38
77
  isForced(state: PseudoState): boolean;
78
+ /**
79
+ * Whether the active variant declares `state`, or the active state does
80
+ * while it fits. A state that does not fit is not applied, so what it
81
+ * declares is no longer a default the menu can switch off: switching it on
82
+ * forces it on the whole component.
83
+ */
39
84
  isDeclared(state: PseudoState): boolean;
40
- /** Flips `state` against what is forced now. Flipping it back to what the variant declares drops the toggle. */
85
+ /** Flips `state` against what is forced now. Flipping it back to what the variant or state declares drops the toggle. */
41
86
  toggle(state: PseudoState): void;
42
87
  clearOverride(): void;
43
88
  /** A marker for one rendered component, sharing this app's rewritten stylesheets. */
@@ -1 +1 @@
1
- {"version":3,"file":"prism-pseudo-state.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-pseudo-state.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,kBAAkB,EAAiB,KAAK,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAC7G,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;;AAMrE,0FAA0F;AAC1F,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;AAExE;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI,EAAE,QAAQ,EAAE,mBAAmB,GAAG,kBAAkB,GAAG,IAAI,CAY1H;AAED;;;;;;;;;;;GAWG;AACH,qBACa,uBAAuB;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkC;IAC7D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgC;IACzD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA+B;IACvD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA2C;IAEvE,QAAQ,CAAC,QAAQ,gIAKd;IAEH,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmC;IAC7D,QAAQ,CAAC,QAAQ,wEAA+B;IAEhD,+FAA+F;IAC/F,QAAQ,CAAC,SAAS,gIAA0I;;IAU5J,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAIrC,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAIvC,gHAAgH;IAChH,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAYhC,aAAa,IAAI,IAAI;IAIrB,qFAAqF;IACrF,YAAY,IAAI,iBAAiB;yCArDxB,uBAAuB;;CAwDnC"}
1
+ {"version":3,"file":"prism-pseudo-state.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-pseudo-state.service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAW,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,KAAK,kBAAkB,EAAiB,KAAK,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAC7G,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;;AAKvD,0FAA0F;AAC1F,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;AAExE,kEAAkE;AAClE,MAAM,WAAW,YAAY;IACzB,oFAAoF;IACpF,IAAI,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAChC,gLAAgL;IAChL,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CACvB,aAAa,EAAE,kBAAkB,GAAG,IAAI,EACxC,WAAW,EAAE,kBAAkB,GAAG,IAAI,EACtC,QAAQ,EAAE,mBAAmB,EAC7B,SAAS,UAAO,GACjB,YAAY,CAqBd;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBACa,uBAAuB;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkC;IAC7D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgC;IACzD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA+B;IACvD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA2C;IAEvE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAI3B;IAEH,QAAQ,CAAC,QAAQ,gIAAmF;IAEpG,mGAAmG;IACnG,QAAQ,CAAC,WAAW,uDAKjB;IAEH,+FAA+F;IAC/F,QAAQ,CAAC,cAAc,gDAA0H;IAEjJ,qGAAqG;IACrG,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA6H;IAEzJ,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmC;IAC7D,QAAQ,CAAC,QAAQ,wEAA+B;IAEhD;;;OAGG;IACH,QAAQ,CAAC,SAAS,0DAAiC;IAEnD,6HAA6H;IAC7H,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAoD;IAE9E,6HAA6H;IAC7H,QAAQ,CAAC,MAAM,+CAGZ;;IAWH,yGAAyG;IACzG,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAMrC;;;;;OAKG;IACH,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAIvC,yHAAyH;IACzH,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAYhC,aAAa,IAAI,IAAI;IAIrB,qFAAqF;IACrF,YAAY,IAAI,iBAAiB;yCA1FxB,uBAAuB;;CA6FnC"}
@@ -8,32 +8,56 @@ import { PrismNavigationService } from './prism-navigation.service.js';
8
8
  import { PrismRendererService } from './prism-renderer.service.js';
9
9
  import * as i0 from "@angular/core";
10
10
  /**
11
- * `declared` with the user's toggles from the tools menu on top.
11
+ * The variant's and the active state's pseudo states with the user's toggles
12
+ * from the tools menu on top.
12
13
  *
13
- * Returns `declared` itself while nothing is toggled, so the renderer, which
14
- * waits for the exact states object it was given, is not sent a copy. A state
15
- * switched on from the menu applies to the whole component (`true`), the way a
16
- * pointer over it would. One the variant declares keeps its own target.
14
+ * Returns the two objects it was given while nothing is toggled, so the
15
+ * renderer, which waits for the exact objects it handed the marker, is not sent
16
+ * a copy. A state switched on from the menu applies to the whole component
17
+ * (`true`), the way a pointer over it would, and lands in `base`, which the fit
18
+ * rule does not touch. One the variant or the state declares keeps its own
19
+ * target in its own layer, except that a state which does not fit
20
+ * (`stateFits: false`) is not applied, so a class only it declares is forced on
21
+ * the whole component instead. The state layer itself is the same either way:
22
+ * the marker still gets it, to see when the state fits again. A state switched
23
+ * off leaves both layers. Once the
24
+ * toggles have switched off every class the active state declares, its layer is
25
+ * `null`: that is the user's doing, not a state that forces nothing. A state
26
+ * that declares nothing itself (a slot the scanner could not evaluate) stays an
27
+ * empty object, so the marker can report it.
17
28
  */
18
- export function withOverride(declared, override) {
29
+ export function splitLayers(variantPseudo, statePseudo, override, stateFits = true) {
19
30
  if (Object.keys(override).length === 0)
20
- return declared;
21
- const states = {};
22
- for (const state of PSEUDO_STATES) {
23
- const forced = override[state];
24
- const target = forced === undefined ? declared?.[state] : forced ? (declared?.[state] ?? true) : undefined;
25
- if (target !== undefined)
26
- states[state] = target;
31
+ return { base: variantPseudo, state: statePseudo };
32
+ const base = {};
33
+ const state = {};
34
+ for (const name of PSEUDO_STATES) {
35
+ const forced = override[name];
36
+ if (forced === false)
37
+ continue;
38
+ const fromVariant = variantPseudo?.[name];
39
+ const fromState = statePseudo?.[name];
40
+ if (fromVariant !== undefined)
41
+ base[name] = fromVariant;
42
+ if (fromState !== undefined)
43
+ state[name] = fromState;
44
+ if (forced && fromVariant === undefined && (fromState === undefined || !stateFits))
45
+ base[name] = true;
27
46
  }
28
- return Object.keys(states).length > 0 ? states : null;
47
+ const switchedOff = Object.keys(state).length === 0 && Object.keys(statePseudo ?? {}).length > 0;
48
+ return { base: Object.keys(base).length > 0 ? base : null, state: statePseudo && !switchedOff ? state : null };
29
49
  }
30
50
  /**
31
- * The pseudo states the canvas forces on the active variant.
51
+ * The pseudo states the canvas forces on the active variant and the active
52
+ * component-level state.
32
53
  *
33
- * `declared` is `Variant.pseudo`. The tools menu can switch states on and off
34
- * on top of it; like the background override, that toggle is transient and
35
- * resets when the variant or the component changes. Capture mode ignores it:
36
- * it is session UI state and must not shape a baseline.
54
+ * `declared` is `Variant.pseudo`, `activeState` is the `ShowcaseState` picked
55
+ * in `PrismRendererService.activeStateIndex`. They are two layers
56
+ * ({@link PseudoLayers}) because only the state's is subject to the fit rule.
57
+ * The tools menu can switch single states on and off on top of both; like the
58
+ * background override, that toggle is transient and resets when the variant, the
59
+ * state or the component changes. Capture mode ignores it, but applies the
60
+ * state: session UI state must not shape a baseline, the addressed cell must.
37
61
  *
38
62
  * Also owns the document's {@link PseudoStyleSheets}, which every marker shares
39
63
  * so each stylesheet is rewritten once, whether the Playground canvas or an
@@ -44,33 +68,66 @@ export class PrismPseudoStateService {
44
68
  renderer = inject(PrismRendererService);
45
69
  capture = inject(PrismCaptureService);
46
70
  stylesheets = new PseudoStyleSheets(inject(DOCUMENT));
47
- declared = computed(() => {
71
+ activeVariant = computed(() => {
48
72
  const comp = this.navigation.activeComponent();
49
- if (!comp)
50
- return null;
51
- return comp.meta.showcaseConfig.variants?.[this.renderer.activeVariantIndex()]?.pseudo ?? null;
73
+ return comp?.meta.showcaseConfig.variants?.[this.renderer.activeVariantIndex()] ?? null;
52
74
  }, /* @ts-ignore */
75
+ ...(ngDevMode ? [{ debugName: "activeVariant" }] : /* istanbul ignore next */ []));
76
+ declared = computed(() => this.activeVariant()?.pseudo ?? null, /* @ts-ignore */
53
77
  ...(ngDevMode ? [{ debugName: "declared" }] : /* istanbul ignore next */ []));
78
+ /** The component-level state on the canvas, whether or not the active variant takes part in it. */
79
+ activeState = computed(() => {
80
+ const index = this.renderer.activeStateIndex();
81
+ if (index === null)
82
+ return null;
83
+ return this.navigation.activeComponent()?.meta.showcaseConfig.states?.[index] ?? null;
84
+ }, /* @ts-ignore */
85
+ ...(ngDevMode ? [{ debugName: "activeState" }] : /* istanbul ignore next */ []));
86
+ /** `'states: false'` when the active variant opts out while a state is active, else `null`. */
87
+ stateExclusion = computed(() => (this.activeState() && this.activeVariant()?.states === false ? 'states: false' : null), /* @ts-ignore */
88
+ ...(ngDevMode ? [{ debugName: "stateExclusion" }] : /* istanbul ignore next */ []));
89
+ /** What the active state forces: its pseudo, `null` when none is active or the variant opted out. */
90
+ statePseudo = computed(() => (this.stateExclusion() === null ? (this.activeState()?.pseudo ?? null) : null), /* @ts-ignore */
91
+ ...(ngDevMode ? [{ debugName: "statePseudo" }] : /* istanbul ignore next */ []));
54
92
  _override = signal({}, /* @ts-ignore */
55
93
  ...(ngDevMode ? [{ debugName: "_override" }] : /* istanbul ignore next */ []));
56
94
  override = this._override.asReadonly();
57
- /** What the canvas forces: `declared`, with the user's toggles on top outside capture mode. */
58
- effective = computed(() => (this.capture.active() ? this.declared() : withOverride(this.declared(), this._override())), /* @ts-ignore */
59
- ...(ngDevMode ? [{ debugName: "effective" }] : /* istanbul ignore next */ []));
95
+ /**
96
+ * Whether the active state fits the rendered canvas. Written by the
97
+ * renderer from its marker, `null` while no state is applied.
98
+ */
99
+ canvasFit = signal(null, /* @ts-ignore */
100
+ ...(ngDevMode ? [{ debugName: "canvasFit" }] : /* istanbul ignore next */ []));
101
+ /** `canvasFit` before the first render counts as fitting; a computed so a changed reason alone does not rebuild `layers`. */
102
+ stateFits = computed(() => this.canvasFit()?.fits !== false, /* @ts-ignore */
103
+ ...(ngDevMode ? [{ debugName: "stateFits" }] : /* istanbul ignore next */ []));
104
+ /** What the canvas forces: `declared` and the active state with the user's toggles on top, which capture mode leaves out. */
105
+ layers = computed(() => splitLayers(this.declared(), this.statePseudo(), this.capture.active() ? {} : this._override(), this.stateFits()), { ...(ngDevMode ? { debugName: "layers" } : /* istanbul ignore next */ {}),
106
+ // A reset to `{}` writes a fresh override and would hand out a new wrapper around the same two objects, which re-applies the marker for nothing.
107
+ equal: (a, b) => a.base === b.base && a.state === b.state });
60
108
  constructor() {
61
109
  effect(() => {
62
110
  this.navigation.activeComponent();
63
111
  this.renderer.activeVariantIndex();
112
+ this.renderer.activeStateIndex();
64
113
  this._override.set({});
65
114
  });
66
115
  }
116
+ /** Whether `state` is forced on the canvas now: by the variant, or by the active state while it fits. */
67
117
  isForced(state) {
68
- return this.effective()?.[state] !== undefined;
118
+ const { base, state: layer } = this.layers();
119
+ return base?.[state] !== undefined || (!!this.canvasFit()?.fits && layer?.[state] !== undefined);
69
120
  }
121
+ /**
122
+ * Whether the active variant declares `state`, or the active state does
123
+ * while it fits. A state that does not fit is not applied, so what it
124
+ * declares is no longer a default the menu can switch off: switching it on
125
+ * forces it on the whole component.
126
+ */
70
127
  isDeclared(state) {
71
- return this.declared()?.[state] !== undefined;
128
+ return this.declared()?.[state] !== undefined || (this.stateFits() && this.statePseudo()?.[state] !== undefined);
72
129
  }
73
- /** Flips `state` against what is forced now. Flipping it back to what the variant declares drops the toggle. */
130
+ /** Flips `state` against what is forced now. Flipping it back to what the variant or state declares drops the toggle. */
74
131
  toggle(state) {
75
132
  const forced = !this.isForced(state);
76
133
  this._override.update((override) => {
@@ -10,14 +10,31 @@ export declare function computeVariantState(comp: RuntimeComponent, index: numbe
10
10
  export declare class PrismRendererService {
11
11
  private readonly navigationService;
12
12
  readonly activeVariantIndex: import("@angular/core").WritableSignal<number>;
13
+ /**
14
+ * Position in `ShowcaseConfig.states` of the component-level state on the
15
+ * canvas, `null` for none. Part of the addressed cell next to the variant:
16
+ * it survives a variant change and goes with the component.
17
+ */
18
+ readonly activeStateIndex: import("@angular/core").WritableSignal<number | null>;
13
19
  readonly inputValues: import("@angular/core").WritableSignal<Record<string, unknown>>;
14
20
  readonly activeContent: import("@angular/core").WritableSignal<string | Record<string, string> | undefined>;
15
21
  readonly renderedElement: import("@angular/core").WritableSignal<Element | null>;
16
22
  readonly dirtyInputCount: import("@angular/core").Signal<number>;
23
+ /** The component the variant, the state and the inputs belong to, `null` before the first. */
17
24
  private _lastClassName;
25
+ constructor();
18
26
  resetForComponent(comp: RuntimeComponent): void;
27
+ /**
28
+ * Brings the variant, the state and the inputs in line with `comp`: a full
29
+ * reset when it is another component than the last one, else the variant
30
+ * and the state clamped to what it still declares and the inputs kept.
31
+ * Runs on every navigation and again when the renderer mounts, which then
32
+ * finds the component current and keeps what an Overview cell or a restore
33
+ * selected.
34
+ */
19
35
  reconcileForComponent(comp: RuntimeComponent): void;
20
36
  selectVariant(index: number): void;
37
+ selectState(index: number | null): void;
21
38
  updateInput(name: string, value: unknown): void;
22
39
  resetInputsToVariantDefaults(): void;
23
40
  private applyVariant;
@@ -1 +1 @@
1
- {"version":3,"file":"prism-renderer.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-renderer.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;;AAGrE,MAAM,WAAW,oBAAoB;IACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;CAC9D;AAED,wBAAgB,mBAAmB,CAC/B,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;IAAE,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;CAAO,GAC9E,oBAAoB,CA6CtB;AAaD,qBACa,oBAAoB;IAC7B,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAkC;IAEpE,QAAQ,CAAC,kBAAkB,iDAAa;IACxC,QAAQ,CAAC,WAAW,kEAAuC;IAC3D,QAAQ,CAAC,aAAa,sFAAkE;IACxF,QAAQ,CAAC,eAAe,yDAAgC;IAExD,QAAQ,CAAC,eAAe,yCAarB;IAEH,OAAO,CAAC,cAAc,CAAuB;IAE7C,iBAAiB,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;IAM/C,qBAAqB,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;IA+CnD,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAOlC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAI/C,4BAA4B,IAAI,IAAI;IAOpC,OAAO,CAAC,YAAY;yCAhGX,oBAAoB;;CAyGhC"}
1
+ {"version":3,"file":"prism-renderer.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-renderer.service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;;AAGrE,MAAM,WAAW,oBAAoB;IACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;CAC9D;AAED,wBAAgB,mBAAmB,CAC/B,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;IAAE,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;CAAO,GAC9E,oBAAoB,CA6CtB;AAaD,qBACa,oBAAoB;IAC7B,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAkC;IAEpE,QAAQ,CAAC,kBAAkB,iDAAa;IACxC;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,wDAA+B;IACxD,QAAQ,CAAC,WAAW,kEAAuC;IAC3D,QAAQ,CAAC,aAAa,sFAAkE;IACxF,QAAQ,CAAC,eAAe,yDAAgC;IAExD,QAAQ,CAAC,eAAe,yCAarB;IAEH,8FAA8F;IAC9F,OAAO,CAAC,cAAc,CAAuB;;IAc7C,iBAAiB,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;IAO/C;;;;;;;OAOG;IACH,qBAAqB,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;IAoDnD,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAOlC,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAIvC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAI/C,4BAA4B,IAAI,IAAI;IAOpC,OAAO,CAAC,YAAY;yCArIX,oBAAoB;;CA8IhC"}
@@ -1,4 +1,4 @@
1
- import { computed, inject, Injectable, signal } from '@angular/core';
1
+ import { computed, effect, inject, Injectable, signal, untracked } from '@angular/core';
2
2
  import { PrismNavigationService } from './prism-navigation.service.js';
3
3
  import * as i0 from "@angular/core";
4
4
  export function computeVariantState(comp, index, options = {}) {
@@ -57,6 +57,13 @@ export class PrismRendererService {
57
57
  navigationService = inject(PrismNavigationService);
58
58
  activeVariantIndex = signal(0, /* @ts-ignore */
59
59
  ...(ngDevMode ? [{ debugName: "activeVariantIndex" }] : /* istanbul ignore next */ []));
60
+ /**
61
+ * Position in `ShowcaseConfig.states` of the component-level state on the
62
+ * canvas, `null` for none. Part of the addressed cell next to the variant:
63
+ * it survives a variant change and goes with the component.
64
+ */
65
+ activeStateIndex = signal(null, /* @ts-ignore */
66
+ ...(ngDevMode ? [{ debugName: "activeStateIndex" }] : /* istanbul ignore next */ []));
60
67
  inputValues = signal({}, /* @ts-ignore */
61
68
  ...(ngDevMode ? [{ debugName: "inputValues" }] : /* istanbul ignore next */ []));
62
69
  activeContent = signal(undefined, /* @ts-ignore */
@@ -78,20 +85,45 @@ export class PrismRendererService {
78
85
  return count;
79
86
  }, /* @ts-ignore */
80
87
  ...(ngDevMode ? [{ debugName: "dirtyInputCount" }] : /* istanbul ignore next */ []));
88
+ /** The component the variant, the state and the inputs belong to, `null` before the first. */
81
89
  _lastClassName = null;
90
+ constructor() {
91
+ // The variant and the state go with the component in every view, so the reset on a switch follows
92
+ // navigation, not the renderer: the shell mounts `<prism-renderer>` in the Playground only, and the Overview
93
+ // keeps its view when the sidebar picks another component. A root effect, created before the URL service's,
94
+ // so it runs first in the same flush and the URL never sees the previous component's cell on the new one.
95
+ effect(() => {
96
+ const comp = this.navigationService.activeComponent();
97
+ if (comp)
98
+ untracked(() => this.reconcileForComponent(comp));
99
+ });
100
+ }
82
101
  resetForComponent(comp) {
83
102
  this._lastClassName = comp.meta.className;
84
103
  this.activeVariantIndex.set(0);
104
+ this.activeStateIndex.set(null);
85
105
  this.applyVariant(0, comp);
86
106
  }
107
+ /**
108
+ * Brings the variant, the state and the inputs in line with `comp`: a full
109
+ * reset when it is another component than the last one, else the variant
110
+ * and the state clamped to what it still declares and the inputs kept.
111
+ * Runs on every navigation and again when the renderer mounts, which then
112
+ * finds the component current and keeps what an Overview cell or a restore
113
+ * selected.
114
+ */
87
115
  reconcileForComponent(comp) {
88
116
  const prev = this._lastClassName;
89
117
  this._lastClassName = comp.meta.className;
90
118
  if (prev !== null && prev !== comp.meta.className) {
91
119
  this.activeVariantIndex.set(0);
120
+ this.activeStateIndex.set(null);
92
121
  this.applyVariant(0, comp);
93
122
  return;
94
123
  }
124
+ const stateIndex = this.activeStateIndex();
125
+ if (stateIndex !== null && stateIndex >= (comp.meta.showcaseConfig.states?.length ?? 0))
126
+ this.activeStateIndex.set(null);
95
127
  const variants = comp.meta.showcaseConfig.variants ?? [];
96
128
  const maxIndex = Math.max(0, variants.length - 1);
97
129
  const preservedIndex = Math.min(this.activeVariantIndex(), maxIndex);
@@ -125,6 +157,9 @@ export class PrismRendererService {
125
157
  if (comp)
126
158
  this.applyVariant(index, comp);
127
159
  }
160
+ selectState(index) {
161
+ this.activeStateIndex.set(index);
162
+ }
128
163
  updateInput(name, value) {
129
164
  this.inputValues.update((prev) => ({ ...prev, [name]: value }));
130
165
  }
@@ -147,4 +182,4 @@ export class PrismRendererService {
147
182
  (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PrismRendererService, [{
148
183
  type: Injectable,
149
184
  args: [{ providedIn: 'root' }]
150
- }], null, null); })();
185
+ }], () => [], null); })();
@@ -1 +1 @@
1
- {"version":3,"file":"prism-url-state.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-url-state.service.ts"],"names":[],"mappings":";AAgBA,qBACa,oBAAoB;IAC7B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgC;IAChE,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAkC;IACpE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgC;IAChE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA6B;IAC1D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwB;IAC/C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAE7C,OAAO,CAAC,YAAY,CAAS;IAE7B,IAAI,IAAI,IAAI;IAqBZ,OAAO,CAAC,cAAc;IA2CtB,OAAO,CAAC,UAAU;yCA1ET,oBAAoB;;CA+GhC"}
1
+ {"version":3,"file":"prism-url-state.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-url-state.service.ts"],"names":[],"mappings":";AAiCA,qBACa,oBAAoB;IAC7B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgC;IAChE,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAkC;IACpE,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAgC;IAChE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA6B;IAC1D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwB;IAC/C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAE7C,OAAO,CAAC,YAAY,CAAS;IAE7B,IAAI,IAAI,IAAI;IAsBZ,OAAO,CAAC,cAAc;IA2DtB,OAAO,CAAC,UAAU;yCA3FT,oBAAoB;;CAmIhC"}
@@ -8,10 +8,25 @@ import * as i0 from "@angular/core";
8
8
  const PARAM_COMPONENT = 'component';
9
9
  const PARAM_PAGE = 'page';
10
10
  const PARAM_VARIANT = 'variant';
11
+ const PARAM_STATE = 'state';
11
12
  const PARAM_VIEW = 'view';
12
13
  const DEFAULT_VIEW = 'renderer';
13
14
  const PARAM_PANEL = 'panel';
14
15
  const DEFAULT_PANEL = 'controls';
16
+ /** The index a `variant` parameter addresses in a list of `count` variants, `0` for anything that is not one. */
17
+ function parseVariantIndex(param, count) {
18
+ if (param === null)
19
+ return 0;
20
+ const index = parseInt(param, 10);
21
+ return !Number.isNaN(index) && index >= 0 && index < count ? index : 0;
22
+ }
23
+ /** The index a `state` parameter addresses in a list of `count` states, `null` for anything that is not one. */
24
+ function parseStateIndex(param, count) {
25
+ if (param === null || !/^\d+$/.test(param))
26
+ return null;
27
+ const index = Number(param);
28
+ return index < count ? index : null;
29
+ }
15
30
  export class PrismUrlStateService {
16
31
  manifestService = inject(PrismManifestService);
17
32
  navigationService = inject(PrismNavigationService);
@@ -27,11 +42,12 @@ export class PrismUrlStateService {
27
42
  effect(() => {
28
43
  const item = this.navigationService.activeItem();
29
44
  const variantIndex = this.rendererService.activeVariantIndex();
45
+ const stateIndex = this.rendererService.activeStateIndex();
30
46
  const viewId = this.panelService.activeViewId();
31
47
  const panelId = this.panelService.activePanelId();
32
48
  if (this.suppressSync)
33
49
  return;
34
- this.writeToUrl(item, variantIndex, viewId, panelId);
50
+ this.writeToUrl(item, variantIndex, stateIndex, viewId, panelId);
35
51
  }, { injector: this.injector });
36
52
  window.addEventListener('popstate', () => this.restoreFromUrl());
37
53
  }
@@ -40,21 +56,32 @@ export class PrismUrlStateService {
40
56
  const componentClassName = params.get(PARAM_COMPONENT);
41
57
  const pageTitle = params.get(PARAM_PAGE);
42
58
  const variantParam = params.get(PARAM_VARIANT);
59
+ const stateParam = params.get(PARAM_STATE);
43
60
  const viewId = params.get(PARAM_VIEW);
44
61
  const panelId = params.get(PARAM_PANEL);
62
+ let stateIndex = null;
45
63
  this.suppressSync = true;
46
64
  try {
47
65
  if (componentClassName) {
48
66
  const comp = this.manifestService.components().find((c) => c.meta.className === componentClassName);
49
67
  if (comp) {
68
+ const previousClassName = this.navigationService.activeComponent()?.meta.className;
50
69
  this.navigationService.select(comp);
51
- if (variantParam !== null) {
52
- const index = parseInt(variantParam, 10);
53
- const maxIndex = (comp.meta.showcaseConfig.variants?.length ?? 1) - 1;
54
- if (!Number.isNaN(index) && index >= 0 && index <= maxIndex) {
55
- this.rendererService.activeVariantIndex.set(index);
56
- }
70
+ // Switching to another component resets the variant and the state
71
+ // once `PrismRendererService` follows the navigation, after this
72
+ // restore. Starting the component here makes it the current one
73
+ // before the indexes below are set, so that reset, and the renderer
74
+ // mounting it, keep them (a popstate between components). Not for
75
+ // the component already on screen: a popstate that addresses it (a
76
+ // hash link inside it fires one) must keep the control overrides.
77
+ if (previousClassName !== comp.meta.className) {
78
+ this.rendererService.resetForComponent(comp);
57
79
  }
80
+ const variantIndex = parseVariantIndex(variantParam, comp.meta.showcaseConfig.variants?.length ?? 1);
81
+ if (variantIndex !== this.rendererService.activeVariantIndex()) {
82
+ this.rendererService.selectVariant(variantIndex);
83
+ }
84
+ stateIndex = parseStateIndex(stateParam, comp.meta.showcaseConfig.states?.length ?? 0);
58
85
  }
59
86
  }
60
87
  else if (pageTitle) {
@@ -63,6 +90,7 @@ export class PrismUrlStateService {
63
90
  this.navigationService.selectPage(page);
64
91
  }
65
92
  }
93
+ this.rendererService.selectState(stateIndex);
66
94
  if (viewId) {
67
95
  this.panelService.activeViewId.set(viewId);
68
96
  }
@@ -74,7 +102,7 @@ export class PrismUrlStateService {
74
102
  this.suppressSync = false;
75
103
  }
76
104
  }
77
- writeToUrl(item, variantIndex, viewId, panelId) {
105
+ writeToUrl(item, variantIndex, stateIndex, viewId, panelId) {
78
106
  // Built from scratch, never from the current search string: parameters the
79
107
  // app does not own must not survive a navigation. `?capture=1` relies on
80
108
  // this; the "capture flag" specs pin the guarantee.
@@ -84,6 +112,9 @@ export class PrismUrlStateService {
84
112
  if (variantIndex > 0) {
85
113
  params.set(PARAM_VARIANT, String(variantIndex));
86
114
  }
115
+ if (stateIndex !== null) {
116
+ params.set(PARAM_STATE, String(stateIndex));
117
+ }
87
118
  }
88
119
  else if (item?.kind === 'page') {
89
120
  params.set(PARAM_PAGE, item.data.title);
@@ -1 +1 @@
1
- {"version":3,"file":"prism-default-theme.d.ts","sourceRoot":"","sources":["../../../src/app/theme/prism-default-theme.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAyCnD,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAyCpD,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA0DpD,CAAC;AAEF,eAAO,MAAM,mBAAmB,wBAAmB,CAAC"}
1
+ {"version":3,"file":"prism-default-theme.d.ts","sourceRoot":"","sources":["../../../src/app/theme/prism-default-theme.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAyCnD,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAyCpD,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA2DpD,CAAC;AAEF,eAAO,MAAM,mBAAmB,wBAAmB,CAAC"}
@@ -91,13 +91,14 @@ export const PRISM_BASE_TOKENS = {
91
91
  '--dur-base': '0.2s',
92
92
  '--dur-slow': '0.3s',
93
93
  /**
94
- * Chrome density. Set on the shell host, so a consuming app can compact or
95
- * loosen the entire interface from CSS alone:
94
+ * Chrome density. A consuming app compacts or loosens the entire interface
95
+ * with one token in ng-prism.config.ts:
96
96
  *
97
- * prism-shell { --density: .8 }
97
+ * theme: { '--density': '0.8' }
98
98
  *
99
- * There is no signal, service or menu behind this. The whole
100
- * control surface is the custom property.
99
+ * The band heights below resolve it on <html>, where every token is set,
100
+ * so a --density on a descendant such as prism-shell doesn't reach them.
101
+ * There is no signal, service or menu behind this.
101
102
  */
102
103
  '--density': '1',
103
104
  '--band-header': 'calc(40px * var(--density))',
@@ -0,0 +1,7 @@
1
+ import type { NgPrismConfig } from '../../plugin/plugin.types.js';
2
+ /**
3
+ * One notice per deprecated option the config or one of its plugins sets.
4
+ * They never had an effect, so the notice only asks to remove them.
5
+ */
6
+ export declare function describeDeprecatedOptions(config: NgPrismConfig, configFile: string): string[];
7
+ //# sourceMappingURL=deprecated-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecated-options.d.ts","sourceRoot":"","sources":["../../../src/builder/config-loader/deprecated-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAOlE;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAe7F"}
@@ -0,0 +1,23 @@
1
+ /** Config options declared since the first release that nothing has ever read. */
2
+ const DEPRECATED_CONFIG_OPTIONS = ['ui', 'themeStylesheet', 'headless', 'appComponent'];
3
+ const NEVER_HAD_AN_EFFECT = 'which is deprecated and will be removed in 23.0.0. It has never had an effect; remove it.';
4
+ /**
5
+ * One notice per deprecated option the config or one of its plugins sets.
6
+ * They never had an effect, so the notice only asks to remove them.
7
+ */
8
+ export function describeDeprecatedOptions(config, configFile) {
9
+ const notices = [];
10
+ for (const option of DEPRECATED_CONFIG_OPTIONS) {
11
+ if (config[option] !== undefined)
12
+ notices.push(`${configFile} sets "${option}", ${NEVER_HAD_AN_EFFECT}`);
13
+ }
14
+ for (const plugin of config.plugins ?? []) {
15
+ if (plugin.wrapComponent !== undefined)
16
+ notices.push(`plugin "${plugin.name}" sets wrapComponent, ${NEVER_HAD_AN_EFFECT}`);
17
+ for (const panel of plugin.panels ?? []) {
18
+ if (panel.position !== undefined)
19
+ notices.push(`plugin "${plugin.name}" sets position on panel "${panel.id}", ${NEVER_HAD_AN_EFFECT}`);
20
+ }
21
+ }
22
+ return notices;
23
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-manifest.generator.d.ts","sourceRoot":"","sources":["../../../src/builder/manifest/runtime-manifest.generator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAa,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAGhF,MAAM,WAAW,sBAAsB;IACnC,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAoHD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,sBAAsB,GAAG,MAAM,CAkF/E"}
1
+ {"version":3,"file":"runtime-manifest.generator.d.ts","sourceRoot":"","sources":["../../../src/builder/manifest/runtime-manifest.generator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAa,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAGhF,MAAM,WAAW,sBAAsB;IACnC,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAqHD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,sBAAsB,GAAG,MAAM,CAkF/E"}
@@ -68,8 +68,9 @@ function generateWrapperClass(comp) {
68
68
  attrs = '';
69
69
  importsArray = `[${comp.className}]`;
70
70
  }
71
- const inputBindings = bindableInputs.map((i) => ` [${i.name}]="${i.name}()"`).join('');
72
- const outputBindings = comp.outputs.map((o) => ` (${o.name})="${o.name}.emit($event)"`).join('');
71
+ // The wrapper declares its inputs and outputs under the member names and binds the directive's public ones.
72
+ const inputBindings = bindableInputs.map((i) => ` [${i.alias ?? i.name}]="${i.name}()"`).join('');
73
+ const outputBindings = comp.outputs.map((o) => ` (${o.alias ?? o.name})="${o.name}.emit($event)"`).join('');
73
74
  const template = `<${tag}${attrs} ${directiveAttr}${inputBindings}${outputBindings}>{{ __prismContent__() }}</${tag}>`;
74
75
  const members = [];
75
76
  for (const i of bindableInputs) {
@@ -1 +1 @@
1
- {"version":3,"file":"component.scanner.d.ts","sourceRoot":"","sources":["../../../src/builder/scanner/component.scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAiDrE;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,WAAW,GAAE,MAAM,EAAO,EAAE,OAAO,cAAoB,GAAG,gBAAgB,EAAE,CAsEzJ"}
1
+ {"version":3,"file":"component.scanner.d.ts","sourceRoot":"","sources":["../../../src/builder/scanner/component.scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAkDrE;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,WAAW,GAAE,MAAM,EAAO,EAAE,OAAO,cAAoB,GAAG,gBAAgB,EAAE,CAsEzJ"}