@ng-prism/core 22.4.1 → 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 (131) hide show
  1. package/README.md +2 -0
  2. package/dist/app/canvas/prism-canvas-toolbar.component.d.ts +33 -2
  3. package/dist/app/canvas/prism-canvas-toolbar.component.d.ts.map +1 -1
  4. package/dist/app/canvas/prism-canvas-toolbar.component.js +135 -28
  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 +22 -4
  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 +29 -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 +145 -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-selector.d.ts +24 -0
  44. package/dist/app/pseudo/pseudo-selector.d.ts.map +1 -0
  45. package/dist/app/pseudo/pseudo-selector.js +136 -0
  46. package/dist/app/pseudo/pseudo-state-marker.d.ts +66 -0
  47. package/dist/app/pseudo/pseudo-state-marker.d.ts.map +1 -0
  48. package/dist/app/pseudo/pseudo-state-marker.js +165 -0
  49. package/dist/app/pseudo/pseudo-stylesheets.d.ts +49 -0
  50. package/dist/app/pseudo/pseudo-stylesheets.d.ts.map +1 -0
  51. package/dist/app/pseudo/pseudo-stylesheets.js +137 -0
  52. package/dist/app/pseudo/pseudo-targets.d.ts +11 -0
  53. package/dist/app/pseudo/pseudo-targets.d.ts.map +1 -0
  54. package/dist/app/pseudo/pseudo-targets.js +46 -0
  55. package/dist/app/pseudo/state-fit.d.ts +28 -0
  56. package/dist/app/pseudo/state-fit.d.ts.map +1 -0
  57. package/dist/app/pseudo/state-fit.js +97 -0
  58. package/dist/app/renderer/input-bindings.d.ts +16 -0
  59. package/dist/app/renderer/input-bindings.d.ts.map +1 -0
  60. package/dist/app/renderer/input-bindings.js +21 -0
  61. package/dist/app/renderer/known-inputs.d.ts +8 -1
  62. package/dist/app/renderer/known-inputs.d.ts.map +1 -1
  63. package/dist/app/renderer/known-inputs.js +13 -5
  64. package/dist/app/renderer/prism-renderer.component.d.ts +18 -1
  65. package/dist/app/renderer/prism-renderer.component.d.ts.map +1 -1
  66. package/dist/app/renderer/prism-renderer.component.js +68 -22
  67. package/dist/app/renderer/projectable-content.d.ts +8 -1
  68. package/dist/app/renderer/projectable-content.d.ts.map +1 -1
  69. package/dist/app/renderer/projectable-content.js +40 -29
  70. package/dist/app/renderer/rendered-key.d.ts +38 -0
  71. package/dist/app/renderer/rendered-key.d.ts.map +1 -0
  72. package/dist/app/renderer/rendered-key.js +34 -0
  73. package/dist/app/renderer/snippet-generator.js +7 -5
  74. package/dist/app/services/prism-capture.service.d.ts +2 -0
  75. package/dist/app/services/prism-capture.service.d.ts.map +1 -1
  76. package/dist/app/services/prism-capture.service.js +25 -0
  77. package/dist/app/services/prism-pseudo-state.service.d.ts +93 -0
  78. package/dist/app/services/prism-pseudo-state.service.d.ts.map +1 -0
  79. package/dist/app/services/prism-pseudo-state.service.js +155 -0
  80. package/dist/app/services/prism-renderer.service.d.ts +17 -0
  81. package/dist/app/services/prism-renderer.service.d.ts.map +1 -1
  82. package/dist/app/services/prism-renderer.service.js +37 -2
  83. package/dist/app/services/prism-url-state.service.d.ts.map +1 -1
  84. package/dist/app/services/prism-url-state.service.js +39 -8
  85. package/dist/app/theme/prism-default-theme.d.ts.map +1 -1
  86. package/dist/app/theme/prism-default-theme.js +6 -5
  87. package/dist/builder/config-loader/deprecated-options.d.ts +7 -0
  88. package/dist/builder/config-loader/deprecated-options.d.ts.map +1 -0
  89. package/dist/builder/config-loader/deprecated-options.js +23 -0
  90. package/dist/builder/manifest/runtime-manifest.generator.d.ts.map +1 -1
  91. package/dist/builder/manifest/runtime-manifest.generator.js +3 -2
  92. package/dist/builder/scanner/component.scanner.d.ts.map +1 -1
  93. package/dist/builder/scanner/component.scanner.js +27 -0
  94. package/dist/builder/scanner/entry-point-discovery.d.ts +5 -0
  95. package/dist/builder/scanner/entry-point-discovery.d.ts.map +1 -1
  96. package/dist/builder/scanner/entry-point-discovery.js +14 -0
  97. package/dist/builder/scanner/entry-point.scanner.d.ts +3 -1
  98. package/dist/builder/scanner/entry-point.scanner.d.ts.map +1 -1
  99. package/dist/builder/scanner/entry-point.scanner.js +7 -6
  100. package/dist/builder/scanner/input.extractor.d.ts.map +1 -1
  101. package/dist/builder/scanner/input.extractor.js +22 -3
  102. package/dist/builder/scanner/pseudo-states.d.ts +12 -0
  103. package/dist/builder/scanner/pseudo-states.d.ts.map +1 -0
  104. package/dist/builder/scanner/pseudo-states.js +58 -0
  105. package/dist/builder/scanner/scanner.d.ts +2 -2
  106. package/dist/builder/scanner/scanner.d.ts.map +1 -1
  107. package/dist/builder/scanner/scanner.js +16 -6
  108. package/dist/builder/scanner/showcase-diagnostics.js +9 -9
  109. package/dist/builder/scanner/showcase-states.d.ts +17 -0
  110. package/dist/builder/scanner/showcase-states.d.ts.map +1 -0
  111. package/dist/builder/scanner/showcase-states.js +58 -0
  112. package/dist/builder/scanner/source-file-cache.d.ts +26 -0
  113. package/dist/builder/scanner/source-file-cache.d.ts.map +1 -0
  114. package/dist/builder/scanner/source-file-cache.js +60 -0
  115. package/dist/builder/shared/prism-pipeline.d.ts.map +1 -1
  116. package/dist/builder/shared/prism-pipeline.js +28 -13
  117. package/dist/decorator/index.d.ts +1 -1
  118. package/dist/decorator/index.d.ts.map +1 -1
  119. package/dist/decorator/showcase.types.d.ts +33 -0
  120. package/dist/decorator/showcase.types.d.ts.map +1 -1
  121. package/dist/plugin/index.d.ts +3 -1
  122. package/dist/plugin/index.d.ts.map +1 -1
  123. package/dist/plugin/index.js +1 -0
  124. package/dist/plugin/plugin.types.d.ts +53 -7
  125. package/dist/plugin/plugin.types.d.ts.map +1 -1
  126. package/dist/shared/pseudo-state.type.d.ts +22 -0
  127. package/dist/shared/pseudo-state.type.d.ts.map +1 -0
  128. package/dist/shared/pseudo-state.type.js +2 -0
  129. package/package.json +1 -1
  130. package/src/builder/build/schema.json +6 -6
  131. package/src/builder/serve/schema.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"projectable-content.d.ts","sourceRoot":"","sources":["../../../src/app/renderer/projectable-content.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,EAAE,EAAE,CAsCtF"}
1
+ {"version":3,"file":"projectable-content.d.ts","sourceRoot":"","sources":["../../../src/app/renderer/projectable-content.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,EAAE,SAAS,MAAM,EAAE,EAAE,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,EAAE,EAAE,CAcrK"}
@@ -5,43 +5,54 @@
5
5
  * Shared by the Playground stage and the Overview cells: both project the same
6
6
  * developer-authored content, and the slot-selector handling is the one piece
7
7
  * of that neither wants to own twice.
8
+ *
9
+ * `createComponent` hands `projectableNodes[i]` to the i-th `<ng-content>` of
10
+ * the template and never looks at selectors, so the lists are ordered by the
11
+ * component's `ngContentSelectors` (`reflectComponentType`): `default` (or a
12
+ * plain string) goes to the `*` slot, every other key to the slot whose
13
+ * `select` it names. A key no slot takes is dropped and reported to
14
+ * `onUnmatchedKey`.
8
15
  */
9
16
  // SAFETY: `content` originates from `@Showcase({ variants: [{ content }] })`
10
17
  // in developer-authored source code. It is trusted by ng-prism's threat model
11
18
  // (see SECURITY.md). Sanitization would strip the Angular component/directive
12
19
  // selectors that variant content is meant to project.
13
- export function parseContentToNodes(content) {
14
- if (typeof content === 'string') {
15
- return [htmlToNodes(content)];
20
+ export function parseContentToNodes(content, ngContentSelectors, onUnmatchedKey) {
21
+ const byKey = typeof content === 'string' ? { default: content } : content;
22
+ const slotKeys = ngContentSelectors.map((selector) => (selector.trim() === '*' ? 'default' : selector.trim()));
23
+ for (const key of Object.keys(byKey)) {
24
+ if (!slotKeys.includes(key))
25
+ onUnmatchedKey?.(key);
16
26
  }
17
- const defaultNodes = content['default'] ? htmlToNodes(content['default']) : [];
18
- const result = [defaultNodes];
19
- for (const [selector, html] of Object.entries(content)) {
20
- if (selector === 'default')
21
- continue;
22
- const wrapper = document.createElement('div');
23
- // SAFETY: trusted developer-authored HTML, see SECURITY.md.
24
- wrapper.innerHTML = html;
25
- const nodes = [];
26
- for (const child of Array.from(wrapper.childNodes)) {
27
- const el = document.createElement('div');
28
- // SAFETY: trusted developer-authored HTML (see SECURITY.md).
29
- el.innerHTML = child.outerHTML ?? child.textContent ?? '';
30
- const projected = el.firstChild;
31
- if (projected && projected instanceof Element) {
32
- applySelector(projected, selector);
33
- nodes.push(projected);
34
- }
35
- else if (projected) {
36
- const span = document.createElement('span');
37
- applySelector(span, selector);
38
- span.textContent = child.textContent;
39
- nodes.push(span);
40
- }
27
+ return slotKeys.map((key) => {
28
+ const html = byKey[key];
29
+ if (html === undefined)
30
+ return [];
31
+ return key === 'default' ? htmlToNodes(html) : namedSlotNodes(html, key);
32
+ });
33
+ }
34
+ // SAFETY: trusted developer-authored HTML, see SECURITY.md.
35
+ function namedSlotNodes(html, selector) {
36
+ const wrapper = document.createElement('div');
37
+ wrapper.innerHTML = html;
38
+ const nodes = [];
39
+ for (const child of Array.from(wrapper.childNodes)) {
40
+ const el = document.createElement('div');
41
+ // SAFETY: trusted developer-authored HTML (see SECURITY.md).
42
+ el.innerHTML = child.outerHTML ?? child.textContent ?? '';
43
+ const projected = el.firstChild;
44
+ if (projected && projected instanceof Element) {
45
+ applySelector(projected, selector);
46
+ nodes.push(projected);
47
+ }
48
+ else if (projected) {
49
+ const span = document.createElement('span');
50
+ applySelector(span, selector);
51
+ span.textContent = child.textContent;
52
+ nodes.push(span);
41
53
  }
42
- result.push(nodes);
43
54
  }
44
- return result;
55
+ return nodes;
45
56
  }
46
57
  // SAFETY: see `parseContentToNodes` above and SECURITY.md. `html` is trusted
47
58
  // developer-authored variant content from the `@Showcase` decorator.
@@ -0,0 +1,38 @@
1
+ import type { RuntimeComponent } from '../../plugin/plugin.types.js';
2
+ import type { ForcedPseudoStates } from '../../shared/pseudo-state.type.js';
3
+ import type { AppliedPseudoStates } from '../pseudo/pseudo-state-marker.js';
4
+ export interface RenderedKeyInput {
5
+ component: RuntimeComponent | null;
6
+ variantIndex: number;
7
+ /** The component-level state on the canvas, `null` when none is active. */
8
+ stateIndex: number | null;
9
+ /** The rendered component's host element, `null` while nothing is rendered. */
10
+ element: Element | null;
11
+ /** The pseudo states the variant forces, `null` when it forces none. */
12
+ pseudo: ForcedPseudoStates | null;
13
+ /** The active state's pseudo, `null` when no state applies to the variant. */
14
+ state: ForcedPseudoStates | null;
15
+ /** What the canvas marker has the states in place for. */
16
+ pseudoApplied: AppliedPseudoStates | null;
17
+ }
18
+ /**
19
+ * The value of `data-prism-rendered` on `.demo-wrap`, or `null` while the
20
+ * variant is not ready to be inspected: `<className>:<variantIndex>`, with
21
+ * `:<stateIndex>` while a component-level state is active.
22
+ *
23
+ * Screenshot runners wait on this marker, so a variant that forces pseudo
24
+ * states, or has a state layer, only gets it once those exact objects are in
25
+ * place on this exact element. A runner then captures the forced state with no
26
+ * change on its side. A variant without forced states is not held back. The
27
+ * index is there for an opted-out variant too (`state` is `null`), so a runner
28
+ * waiting for its cell finds it.
29
+ */
30
+ export declare function resolveRenderedKey({ component, variantIndex, stateIndex, element, pseudo, state, pseudoApplied }: RenderedKeyInput): string | null;
31
+ /**
32
+ * The value of `data-prism-excluded` on `.demo-wrap`, or `null` when the cell
33
+ * shows what it was asked for: why the active state is not part of this
34
+ * variant, either because the variant opted out (`exclusion`) or because the
35
+ * marker found the state does not fit the rendered component.
36
+ */
37
+ export declare function resolveExcludedReason(stateIndex: number | null, exclusion: string | null, applied: AppliedPseudoStates | null): string | null;
38
+ //# sourceMappingURL=rendered-key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rendered-key.d.ts","sourceRoot":"","sources":["../../../src/app/renderer/rendered-key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAG5E,MAAM,WAAW,gBAAgB;IAC7B,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,2EAA2E;IAC3E,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,+EAA+E;IAC/E,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACxB,wEAAwE;IACxE,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAClC,8EAA8E;IAC9E,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACjC,0DAA0D;IAC1D,aAAa,EAAE,mBAAmB,GAAG,IAAI,CAAC;CAC7C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,gBAAgB,GAAG,MAAM,GAAG,IAAI,CAOlJ;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,mBAAmB,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAI7I"}
@@ -0,0 +1,34 @@
1
+ import { forcesAnyState } from '../pseudo/pseudo-targets.js';
2
+ /**
3
+ * The value of `data-prism-rendered` on `.demo-wrap`, or `null` while the
4
+ * variant is not ready to be inspected: `<className>:<variantIndex>`, with
5
+ * `:<stateIndex>` while a component-level state is active.
6
+ *
7
+ * Screenshot runners wait on this marker, so a variant that forces pseudo
8
+ * states, or has a state layer, only gets it once those exact objects are in
9
+ * place on this exact element. A runner then captures the forced state with no
10
+ * change on its side. A variant without forced states is not held back. The
11
+ * index is there for an opted-out variant too (`state` is `null`), so a runner
12
+ * waiting for its cell finds it.
13
+ */
14
+ export function resolveRenderedKey({ component, variantIndex, stateIndex, element, pseudo, state, pseudoApplied }) {
15
+ if (!element || !component)
16
+ return null;
17
+ if ((forcesAnyState(pseudo) || state !== null) && (pseudoApplied?.root !== element || pseudoApplied.states !== pseudo || pseudoApplied.state !== state))
18
+ return null;
19
+ const key = `${component.meta.className}:${variantIndex}`;
20
+ return stateIndex === null ? key : `${key}:${stateIndex}`;
21
+ }
22
+ /**
23
+ * The value of `data-prism-excluded` on `.demo-wrap`, or `null` when the cell
24
+ * shows what it was asked for: why the active state is not part of this
25
+ * variant, either because the variant opted out (`exclusion`) or because the
26
+ * marker found the state does not fit the rendered component.
27
+ */
28
+ export function resolveExcludedReason(stateIndex, exclusion, applied) {
29
+ if (stateIndex === null)
30
+ return null;
31
+ if (exclusion !== null)
32
+ return exclusion;
33
+ return applied?.fit?.fits === false ? applied.fit.reason : null;
34
+ }
@@ -35,7 +35,7 @@ export function generateSnippet(selector, inputs, values, explicitKeys, content,
35
35
  // that defaults to `true` has to show its explicit `false`.
36
36
  if (input.defaultValue === undefined && typeof value === 'boolean' && !value)
37
37
  continue;
38
- pushAttribute(attributes, input.name, value);
38
+ pushAttribute(attributes, input.alias ?? input.name, value);
39
39
  }
40
40
  for (const [name, value] of Object.entries(values)) {
41
41
  if (processed.has(name))
@@ -112,7 +112,7 @@ function generateDirectiveSnippet(selector, inputs, values, explicitKeys, conten
112
112
  // that defaults to `true` has to show its explicit `false`.
113
113
  if (input.defaultValue === undefined && typeof value === 'boolean' && !value)
114
114
  continue;
115
- pushAttribute(attributes, input.name, value);
115
+ pushAttribute(attributes, input.alias ?? input.name, value);
116
116
  }
117
117
  for (const [name, value] of Object.entries(values)) {
118
118
  if (processed.has(name))
@@ -124,7 +124,9 @@ function generateDirectiveSnippet(selector, inputs, values, explicitKeys, conten
124
124
  pushAttribute(attributes, name, value);
125
125
  }
126
126
  const projectedContent = content ?? (typeof values['__prismContent__'] === 'string' ? values['__prismContent__'] : undefined);
127
- const allAttrs = [...hostAttrs, directiveAttr, ...attributes].join(' ');
127
+ // An input aliased to the directive's own selector already puts the directive on the host.
128
+ const selectorAttrs = attributes.some((a) => a.startsWith(`${directiveAttr}=`) || a.startsWith(`[${directiveAttr}]=`)) ? [] : [directiveAttr];
129
+ const allAttrs = [...hostAttrs, ...selectorAttrs, ...attributes].join(' ');
128
130
  const contentHtml = resolveContentHtml(projectedContent);
129
131
  if (!contentHtml) {
130
132
  if (!allAttrs)
@@ -132,7 +134,7 @@ function generateDirectiveSnippet(selector, inputs, values, explicitKeys, conten
132
134
  const singleLine = `<${tag} ${allAttrs} />`;
133
135
  if (singleLine.length <= 80)
134
136
  return singleLine;
135
- const indented = [...hostAttrs, directiveAttr, ...attributes].map((a) => ` ${a}`).join('\n');
137
+ const indented = [...hostAttrs, ...selectorAttrs, ...attributes].map((a) => ` ${a}`).join('\n');
136
138
  return `<${tag}\n${indented} />`;
137
139
  }
138
140
  const openTag = `<${tag} ${allAttrs}>`;
@@ -140,7 +142,7 @@ function generateDirectiveSnippet(selector, inputs, values, explicitKeys, conten
140
142
  const singleLine = `${openTag}${contentHtml}${closeTag}`;
141
143
  if (singleLine.length <= 80)
142
144
  return singleLine;
143
- const allAttrsList = [...hostAttrs, directiveAttr, ...attributes];
145
+ const allAttrsList = [...hostAttrs, ...selectorAttrs, ...attributes];
144
146
  if (allAttrsList.length <= 2) {
145
147
  return `${openTag}\n ${contentHtml}\n${closeTag}`;
146
148
  }
@@ -3,6 +3,8 @@ import * as i0 from "@angular/core";
3
3
  export declare const CAPTURE_PARAM = "capture";
4
4
  /** Attribute set on `<html>` while capture mode is active. */
5
5
  export declare const CAPTURE_ATTRIBUTE = "data-prism-capture";
6
+ /** Room in px capture mode leaves around a component that forces pseudo states, for a focus ring drawn outside its box. */
7
+ export declare const CAPTURE_PSEUDO_ROOM = 8;
6
8
  /**
7
9
  * Everything capture mode makes see-through for `bg: 'transparent'`.
8
10
  *
@@ -1 +1 @@
1
- {"version":3,"file":"prism-capture.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-capture.service.ts"],"names":[],"mappings":";AAEA,sFAAsF;AACtF,eAAO,MAAM,aAAa,YAAY,CAAC;AAEvC,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAItD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,4BAA4B,QAE4H,CAAC;AA2FtK;;;;;;;;;;;;;;;GAeG;AACH,qBACa,mBAAmB;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6F;IAErH,kEAAkE;IAClE,QAAQ,CAAC,MAAM,0CAA6B;;IAM5C,OAAO,CAAC,eAAe;yCAVd,mBAAmB;;CAoB/B;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAKzD"}
1
+ {"version":3,"file":"prism-capture.service.d.ts","sourceRoot":"","sources":["../../../src/app/services/prism-capture.service.ts"],"names":[],"mappings":";AAEA,sFAAsF;AACtF,eAAO,MAAM,aAAa,YAAY,CAAC;AAEvC,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAItD,2HAA2H;AAC3H,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,4BAA4B,QAE4H,CAAC;AAkHtK;;;;;;;;;;;;;;;GAeG;AACH,qBACa,mBAAmB;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA6F;IAErH,kEAAkE;IAClE,QAAQ,CAAC,MAAM,0CAA6B;;IAM5C,OAAO,CAAC,eAAe;yCAVd,mBAAmB;;CAoB/B;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAKzD"}
@@ -5,6 +5,8 @@ export const CAPTURE_PARAM = 'capture';
5
5
  /** Attribute set on `<html>` while capture mode is active. */
6
6
  export const CAPTURE_ATTRIBUTE = 'data-prism-capture';
7
7
  const STYLE_ELEMENT_ID = 'ng-prism-capture-styles';
8
+ /** Room in px capture mode leaves around a component that forces pseudo states, for a focus ring drawn outside its box. */
9
+ export const CAPTURE_PSEUDO_ROOM = 8;
8
10
  /**
9
11
  * Everything capture mode makes see-through for `bg: 'transparent'`.
10
12
  *
@@ -68,6 +70,19 @@ const CAPTURE_CANVAS_ONLY_SELECTOR = `[${CAPTURE_ATTRIBUTE}] ` + `:is(.prism-she
68
70
  * padding gone it sits flush against the component, so capture mode removes the
69
71
  * paint and keeps the geometry. {@link CAPTURE_TRANSPARENT_SELECTOR} does not
70
72
  * cover this: an outline is not a background.
73
+ *
74
+ * A variant that forces pseudo states (`.demo-wrap[data-pseudo]`) gets 8px of
75
+ * room around the component. `.demo-wrap` hugs the component's box, but a focus
76
+ * ring is drawn outside it (an `outline` with an offset, a `box-shadow` halo),
77
+ * so a screenshot of the bare box would crop it. The negative margin takes the
78
+ * padding back out of layout, so the component sits and sizes exactly as
79
+ * without it, and `content-box` keeps the padding outside a `stretch` variant's
80
+ * width. That width gives up the room where the canvas is narrower than
81
+ * `max-width` plus the room, so the room stays inside the canvas instead of
82
+ * being clipped on one side and scrolling on the other; from there on
83
+ * `max-width` clamps it to the width it has without the room. Only these
84
+ * variants: any other change to `.demo-wrap`'s box would move every existing
85
+ * baseline.
71
86
  */
72
87
  const CAPTURE_STYLES = `
73
88
  [${CAPTURE_ATTRIBUTE}] *,
@@ -106,6 +121,16 @@ ${CAPTURE_CANVAS_ONLY_SELECTOR} {
106
121
  [${CAPTURE_ATTRIBUTE}] .prism-canvas-wrap:has(.prism-canvas-stage) {
107
122
  grid-template-rows: minmax(0, 1fr) !important;
108
123
  }
124
+
125
+ [${CAPTURE_ATTRIBUTE}] .demo-wrap[data-pseudo] {
126
+ box-sizing: content-box !important;
127
+ padding: ${CAPTURE_PSEUDO_ROOM}px !important;
128
+ margin: -${CAPTURE_PSEUDO_ROOM}px !important;
129
+ }
130
+
131
+ [${CAPTURE_ATTRIBUTE}] .demo-wrap[data-pseudo][data-canvas-layout='stretch'] {
132
+ width: calc(100% - ${2 * CAPTURE_PSEUDO_ROOM}px) !important;
133
+ }
109
134
  `;
110
135
  /**
111
136
  * Capture-isolation mode, for external screenshot runners.
@@ -0,0 +1,93 @@
1
+ import type { ShowcaseState } from '../../decorator/showcase.types.js';
2
+ import { type ForcedPseudoStates, type PseudoState } from '../../shared/pseudo-state.type.js';
3
+ import { PseudoStateMarker } from '../pseudo/pseudo-state-marker.js';
4
+ import type { StateFit } from '../pseudo/state-fit.js';
5
+ import * as i0 from "@angular/core";
6
+ /** Per state: forced on (`true`) or off (`false`) on top of what the variant declares. */
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
+ }
15
+ /**
16
+ * The variant's and the active state's pseudo states with the user's toggles
17
+ * from the tools menu on top.
18
+ *
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.
33
+ */
34
+ export declare function splitLayers(variantPseudo: ForcedPseudoStates | null, statePseudo: ForcedPseudoStates | null, override: PseudoStateOverride, stateFits?: boolean): PseudoLayers;
35
+ /**
36
+ * The pseudo states the canvas forces on the active variant and the active
37
+ * component-level state.
38
+ *
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.
46
+ *
47
+ * Also owns the document's {@link PseudoStyleSheets}, which every marker shares
48
+ * so each stylesheet is rewritten once, whether the Playground canvas or an
49
+ * Overview cell asks first.
50
+ */
51
+ export declare class PrismPseudoStateService {
52
+ private readonly navigation;
53
+ private readonly renderer;
54
+ private readonly capture;
55
+ private readonly stylesheets;
56
+ private readonly activeVariant;
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;
64
+ private readonly _override;
65
+ readonly override: import("@angular/core").Signal<Partial<Record<PseudoState, boolean>>>;
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>;
75
+ constructor();
76
+ /** Whether `state` is forced on the canvas now: by the variant, or by the active state while it fits. */
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
+ */
84
+ isDeclared(state: PseudoState): boolean;
85
+ /** Flips `state` against what is forced now. Flipping it back to what the variant or state declares drops the toggle. */
86
+ toggle(state: PseudoState): void;
87
+ clearOverride(): void;
88
+ /** A marker for one rendered component, sharing this app's rewritten stylesheets. */
89
+ createMarker(): PseudoStateMarker;
90
+ static ɵfac: i0.ɵɵFactoryDeclaration<PrismPseudoStateService, never>;
91
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
92
+ }
93
+ //# sourceMappingURL=prism-pseudo-state.service.d.ts.map
@@ -0,0 +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,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,EAA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yHAAyH;IACzH,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IAYhC,aAAa,IAAI,IAAI;IAIrB,qFAAqF;IACrF,YAAY,IAAI,iBAAiB;yCA1FxB,uBAAuB;;CA6FnC"}
@@ -0,0 +1,155 @@
1
+ import { DOCUMENT } from '@angular/common';
2
+ import { computed, effect, inject, Injectable, signal } from '@angular/core';
3
+ import { PSEUDO_STATES } from '../../shared/pseudo-state.type.js';
4
+ import { PseudoStateMarker } from '../pseudo/pseudo-state-marker.js';
5
+ import { PseudoStyleSheets } from '../pseudo/pseudo-stylesheets.js';
6
+ import { PrismCaptureService } from './prism-capture.service.js';
7
+ import { PrismNavigationService } from './prism-navigation.service.js';
8
+ import { PrismRendererService } from './prism-renderer.service.js';
9
+ import * as i0 from "@angular/core";
10
+ /**
11
+ * The variant's and the active state's pseudo states with the user's toggles
12
+ * from the tools menu on top.
13
+ *
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.
28
+ */
29
+ export function splitLayers(variantPseudo, statePseudo, override, stateFits = true) {
30
+ if (Object.keys(override).length === 0)
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;
46
+ }
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 };
49
+ }
50
+ /**
51
+ * The pseudo states the canvas forces on the active variant and the active
52
+ * component-level state.
53
+ *
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.
61
+ *
62
+ * Also owns the document's {@link PseudoStyleSheets}, which every marker shares
63
+ * so each stylesheet is rewritten once, whether the Playground canvas or an
64
+ * Overview cell asks first.
65
+ */
66
+ export class PrismPseudoStateService {
67
+ navigation = inject(PrismNavigationService);
68
+ renderer = inject(PrismRendererService);
69
+ capture = inject(PrismCaptureService);
70
+ stylesheets = new PseudoStyleSheets(inject(DOCUMENT));
71
+ activeVariant = computed(() => {
72
+ const comp = this.navigation.activeComponent();
73
+ return comp?.meta.showcaseConfig.variants?.[this.renderer.activeVariantIndex()] ?? null;
74
+ }, /* @ts-ignore */
75
+ ...(ngDevMode ? [{ debugName: "activeVariant" }] : /* istanbul ignore next */ []));
76
+ declared = computed(() => this.activeVariant()?.pseudo ?? null, /* @ts-ignore */
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 */ []));
92
+ _override = signal({}, /* @ts-ignore */
93
+ ...(ngDevMode ? [{ debugName: "_override" }] : /* istanbul ignore next */ []));
94
+ override = this._override.asReadonly();
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 });
108
+ constructor() {
109
+ effect(() => {
110
+ this.navigation.activeComponent();
111
+ this.renderer.activeVariantIndex();
112
+ this.renderer.activeStateIndex();
113
+ this._override.set({});
114
+ });
115
+ }
116
+ /** Whether `state` is forced on the canvas now: by the variant, or by the active state while it fits. */
117
+ isForced(state) {
118
+ const { base, state: layer } = this.layers();
119
+ return base?.[state] !== undefined || (!!this.canvasFit()?.fits && layer?.[state] !== undefined);
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
+ */
127
+ isDeclared(state) {
128
+ return this.declared()?.[state] !== undefined || (this.stateFits() && this.statePseudo()?.[state] !== undefined);
129
+ }
130
+ /** Flips `state` against what is forced now. Flipping it back to what the variant or state declares drops the toggle. */
131
+ toggle(state) {
132
+ const forced = !this.isForced(state);
133
+ this._override.update((override) => {
134
+ const next = { ...override };
135
+ if (forced === this.isDeclared(state))
136
+ delete next[state];
137
+ else
138
+ next[state] = forced;
139
+ return next;
140
+ });
141
+ }
142
+ clearOverride() {
143
+ this._override.set({});
144
+ }
145
+ /** A marker for one rendered component, sharing this app's rewritten stylesheets. */
146
+ createMarker() {
147
+ return new PseudoStateMarker(this.stylesheets);
148
+ }
149
+ static ɵfac = function PrismPseudoStateService_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || PrismPseudoStateService)(); };
150
+ static ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: PrismPseudoStateService, factory: PrismPseudoStateService.ɵfac, providedIn: 'root' });
151
+ }
152
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(PrismPseudoStateService, [{
153
+ type: Injectable,
154
+ args: [{ providedIn: 'root' }]
155
+ }], () => [], null); })();
@@ -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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