@epa-wg/custom-element-dist 0.0.33 → 0.0.34

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 (175) hide show
  1. package/.claude/settings.local.json +18 -0
  2. package/.github/workflows/deploy.yml +59 -0
  3. package/.idea/copilot.data.migration.agent.xml +6 -0
  4. package/.idea/copilot.data.migration.ask.xml +6 -0
  5. package/.idea/copilot.data.migration.edit.xml +6 -0
  6. package/.idea/custom-element-dist.iml +2 -0
  7. package/.storybook/main.ts +20 -17
  8. package/.storybook/preview.ts +23 -23
  9. package/README.md +6 -4
  10. package/coverage/block-navigation.js +1 -1
  11. package/coverage/coverage-final.json +4 -3
  12. package/coverage/index.html +34 -19
  13. package/coverage/sorter.js +21 -7
  14. package/coverage/src/custom-element/coverage.svg +1 -1
  15. package/coverage/src/custom-element/custom-element.js/coverage.svg +1 -1
  16. package/coverage/src/custom-element/custom-element.js.html +435 -378
  17. package/coverage/src/custom-element/http-request.js/coverage.svg +1 -1
  18. package/coverage/src/custom-element/http-request.js.html +38 -17
  19. package/coverage/src/custom-element/index.html +26 -26
  20. package/coverage/src/custom-element/local-storage.js.html +1 -1
  21. package/coverage/src/custom-element/location-element.js.html +1 -1
  22. package/coverage/src/custom-element/module-url.js.html +1 -1
  23. package/coverage/src/index.html +1 -1
  24. package/coverage/src/material/theme/colors.js/coverage.svg +10 -0
  25. package/coverage/src/material/theme/colors.js.html +217 -0
  26. package/coverage/src/material/theme/coverage.svg +10 -0
  27. package/coverage/src/material/theme/index.html +116 -0
  28. package/coverage/src/mocks/handlers.ts.html +1 -1
  29. package/coverage/src/mocks/index.html +1 -1
  30. package/coverage/src/stories/frame.canvas.ts.html +1 -1
  31. package/coverage/src/stories/http-request.stories.ts.html +1 -1
  32. package/coverage/src/stories/index.html +1 -1
  33. package/coverage/src/stories/testStoryBook.ts.html +12 -12
  34. package/coverage/src/sum.ts.html +1 -1
  35. package/dist/{custom-element-WnOqmEOe.js → custom-element-BoYMoUtP.js} +193 -183
  36. package/dist/custom-element-BqtjrCRF.cjs +97 -0
  37. package/dist/custom-element-bundle.cjs +1 -1
  38. package/dist/custom-element-bundle.js +3 -3
  39. package/dist/demo/a.html +10 -3
  40. package/dist/demo/a.svg +26 -26
  41. package/dist/demo/html-template.html +4 -3
  42. package/dist/demo/s.xml +3856 -67
  43. package/dist/demo/s.xslt +13 -72
  44. package/dist/demo/s1.xml +3706 -0
  45. package/dist/http-request-DSaowcG1.cjs +1 -0
  46. package/dist/{http-request-BOvP4KTl.js → http-request-DTCzZ1gc.js} +15 -9
  47. package/package.json +2 -2
  48. package/public/demo/a.html +10 -3
  49. package/public/demo/a.svg +26 -26
  50. package/public/demo/html-template.html +4 -3
  51. package/public/demo/s.xml +3856 -67
  52. package/public/demo/s.xslt +13 -72
  53. package/public/demo/s1.xml +3706 -0
  54. package/src/custom-element/custom-element.js +28 -9
  55. package/src/custom-element/demo/a.html +10 -3
  56. package/src/custom-element/demo/a.svg +26 -26
  57. package/src/custom-element/demo/html-template.html +4 -3
  58. package/src/custom-element/demo/s.xml +3856 -67
  59. package/src/custom-element/demo/s.xslt +13 -72
  60. package/src/custom-element/demo/s1.xml +3706 -0
  61. package/src/custom-element/http-request.js +7 -0
  62. package/src/custom-element/ide/web-types-dce.json +1 -1
  63. package/src/custom-element/ide/web-types-xsl.json +1 -1
  64. package/src/material/angular.css +987 -987
  65. package/src/material/components/action.html +262 -0
  66. package/src/material/components/autocomplete.html +167 -239
  67. package/src/material/components/badge.html +238 -239
  68. package/src/material/components/dropdown.html +0 -1
  69. package/src/material/components/icon-link.html +160 -161
  70. package/src/material/components/icon.html +251 -252
  71. package/src/material/components/input.html +569 -570
  72. package/src/material/components/menu.html +235 -236
  73. package/src/material/components.html +157 -158
  74. package/src/material/demo.css +36 -36
  75. package/src/material/index.html +109 -110
  76. package/src/material/material.css +356 -356
  77. package/src/material/theme/Base-Principles.md +339 -0
  78. package/src/material/theme/README.md +298 -18
  79. package/src/material/theme/UI Domain Model in web applications.svg +1 -0
  80. package/src/material/theme/User Semantic Theme tokens.svg +1 -0
  81. package/src/material/theme/action-pending-poc.html +62 -0
  82. package/src/material/theme/actions-color.html +141 -0
  83. package/src/material/theme/colors-light.html +631 -0
  84. package/src/material/theme/colors-native.html +51 -0
  85. package/src/material/theme/colors-poc.html +66 -0
  86. package/src/material/theme/colors.html +297 -0
  87. package/src/material/theme/colors.js +44 -0
  88. package/src/material/theme/consumer-theme.css +745 -0
  89. package/src/material/theme/semantic.css +132 -132
  90. package/src/material/theme/style-bug.html +123 -0
  91. package/src/material/theme/theme-data.css +43 -0
  92. package/src/material/theme/theme-data.xhtml +2926 -0
  93. package/src/material/theme/todo.md +274 -0
  94. package/src/material/theme/tokens/action-colors.png +0 -0
  95. package/src/material/theme/tokens/cem-article-illustration-4x1-letterbox-2000x500.png +0 -0
  96. package/src/material/theme/tokens/cem-breakpoints.md +519 -0
  97. package/src/material/theme/tokens/cem-colors.md +715 -0
  98. package/src/material/theme/tokens/cem-consumerflow-typography-matrix.svg +198 -0
  99. package/src/material/theme/tokens/cem-coupling.md +372 -0
  100. package/src/material/theme/tokens/cem-data-vs-reading-numerals.svg +164 -0
  101. package/src/material/theme/tokens/cem-dimension.md +625 -0
  102. package/src/material/theme/tokens/cem-layering.md +562 -0
  103. package/src/material/theme/tokens/cem-m3-parity.md +343 -0
  104. package/src/material/theme/tokens/cem-responsive.md +238 -0
  105. package/src/material/theme/tokens/cem-shape.md +691 -0
  106. package/src/material/theme/tokens/cem-stroke-density-illustration-4to1-v3.svg +102 -0
  107. package/src/material/theme/tokens/cem-stroke.md +480 -0
  108. package/src/material/theme/tokens/cem-timing.md +198 -0
  109. package/src/material/theme/tokens/cem-typography-model-stack.svg +64 -0
  110. package/src/material/theme/tokens/cem-voice-fonts-typography.md +718 -0
  111. package/src/material/theme/tokens/cem-voice-ladder.svg +91 -0
  112. package/src/material/theme/tokens/chips.png +0 -0
  113. package/src/material/theme/tokens/columns-page.png +0 -0
  114. package/src/material/theme/tokens/initials.png +0 -0
  115. package/src/material/theme/tokens/nav-buttons.png +0 -0
  116. package/src/material/theme/tokens/script.png +0 -0
  117. package/src/material/theme/tokens/sufler.png +0 -0
  118. package/src/material/theme/tokens/typography-icons.png +0 -0
  119. package/src/mocks/versions.mock.ts +1 -1
  120. package/src/stories/__screenshots__/dom-merge.test.stories.ts/dom-merge-dom-merge-OrderPreservingOn2ndTransform-1.png +0 -0
  121. package/src/stories/__screenshots__/xslt-conditionals.test.stories.ts/xslt-conditionals-xslt-conditionals-MultipleIfOrderingWorkaround-1.png +0 -0
  122. package/src/stories/dom-merge.test.stories.ts +25 -1
  123. package/src/stories/xslt-conditionals.test.stories.ts +492 -0
  124. package/src/stories/xslt-if.test.stories.ts +89 -0
  125. package/storybook-static/assets/{Color-F6OSRLHC-Cbp293x2.js → Color-F6OSRLHC-CzTOSlqB.js} +1 -1
  126. package/storybook-static/assets/{Configure-BrFr4SLE.js → Configure-7GqRsAoJ.js} +1 -1
  127. package/storybook-static/assets/{DocsRenderer-CFRXHY34-DhHzJiIO.js → DocsRenderer-CFRXHY34-Duc5rSIm.js} +2 -2
  128. package/storybook-static/assets/{attributes.test.stories-Gg9LQTEK.js → attributes.test.stories-DYuxF8h1.js} +1 -1
  129. package/storybook-static/assets/{css.test.stories-B_3ltOrx.js → css.test.stories-LOmvINyb.js} +1 -1
  130. package/storybook-static/assets/{custom-element-CPnvJnn8.js → custom-element-Bwx7otrT.js} +6 -6
  131. package/storybook-static/assets/{dom-merge.test.stories-nQxcgLoM.js → dom-merge.test.stories-CEKhWjaS.js} +47 -6
  132. package/storybook-static/assets/entry-preview-BNCt9WBs.js +26 -0
  133. package/storybook-static/assets/{entry-preview-docs-Dwczwtsc.js → entry-preview-docs-CbF8-81D.js} +2 -2
  134. package/storybook-static/assets/{external-template.test.stories-DZ-rjnfd.js → external-template.test.stories-jHu0wsJ-.js} +1 -1
  135. package/storybook-static/assets/{form.test.stories-DQhPYtMj.js → form.test.stories-CUyUnmwP.js} +1 -1
  136. package/storybook-static/assets/{frame.canvas-ClTqYyMN.js → frame.canvas-E5n9h6j1.js} +1 -1
  137. package/storybook-static/assets/{handlers-CLkps6Nz.js → handlers-F7GUfMqr.js} +1 -1
  138. package/storybook-static/assets/http-request-BWeEEBkP.js +1 -0
  139. package/storybook-static/assets/{http-request.stories-jo0f73nw.js → http-request.stories-wyX5-QOv.js} +1 -1
  140. package/storybook-static/assets/{iframe-CZwRpnn9.js → iframe-BS_DPWl0.js} +11 -11
  141. package/storybook-static/assets/{index-Dr4PwNfd.js → index-CGuyH0k-.js} +87 -87
  142. package/storybook-static/assets/{index-CJQtnF9V.js → index-DB7LLObI.js} +1 -1
  143. package/storybook-static/assets/index-DO1nmyvI.js +11 -0
  144. package/storybook-static/assets/{index-B68YUdzy.js → index-V1EGs-wm.js} +3 -3
  145. package/storybook-static/assets/{local-storage.test.stories-uA5EKRPf.js → local-storage.test.stories-BxOhsf1k.js} +1 -1
  146. package/storybook-static/assets/{location-element.test.stories-Cu-6Elcg.js → location-element.test.stories-DqhvvUoa.js} +1 -1
  147. package/storybook-static/assets/{module-url.test.stories-CD_wusXQ.js → module-url.test.stories-C1gG9G7Y.js} +1 -1
  148. package/storybook-static/assets/{preview-BFlNN3Wj.js → preview-Bn8igYMp.js} +1 -1
  149. package/storybook-static/assets/{preview-CuCH40jj.js → preview-Cwy1XFu2.js} +2 -2
  150. package/storybook-static/assets/{preview-Cm4PPhHS.js → preview-D6sehqkw.js} +1 -1
  151. package/storybook-static/assets/{set-url.test.stories-CY7B9BVZ.js → set-url.test.stories-BKQNdknJ.js} +1 -1
  152. package/storybook-static/assets/{slice-events.test.stories-BVnPXm6e.js → slice-events.test.stories-ChqULCeA.js} +1 -1
  153. package/storybook-static/assets/{slots.test.stories-Dxsa9KdA.js → slots.test.stories-BlyLoCRe.js} +1 -1
  154. package/storybook-static/assets/{version-select.test.stories-Buga1PAa.js → version-select.test.stories-CPGSh1tR.js} +1 -1
  155. package/storybook-static/assets/xslt-conditionals.test.stories-YC6QPqWZ.js +633 -0
  156. package/storybook-static/assets/xslt-if.test.stories-BRSWy2-x.js +71 -0
  157. package/storybook-static/demo/a.html +10 -3
  158. package/storybook-static/demo/a.svg +26 -26
  159. package/storybook-static/demo/html-template.html +4 -3
  160. package/storybook-static/demo/s.xml +3856 -67
  161. package/storybook-static/demo/s.xslt +13 -72
  162. package/storybook-static/demo/s1.xml +3706 -0
  163. package/storybook-static/iframe.html +2 -2
  164. package/storybook-static/index.json +1 -1
  165. package/storybook-static/project.json +1 -1
  166. package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js +69 -66
  167. package/storybook-static/sb-addons/essentials-docs-3/manager-bundle.js +62 -59
  168. package/dist/custom-element-6slVaFEs.cjs +0 -97
  169. package/dist/http-request-DPrY7mGh.cjs +0 -1
  170. package/storybook-static/assets/attributes.test.stories-CzWkKw0e.js +0 -1
  171. package/storybook-static/assets/entry-preview-DHVXbf3x.js +0 -26
  172. package/storybook-static/assets/external-template.test.stories-BivZqBTp.js +0 -1
  173. package/storybook-static/assets/http-request-DNq59pnj.js +0 -1
  174. package/storybook-static/assets/index-BwkS7JH_.js +0 -8
  175. package/storybook-static/assets/module-url.test.stories-CTjUAk3J.js +0 -1
@@ -0,0 +1,562 @@
1
+ # CEM D4 Layering — Signed Depth, Planes, and Appearance Shifts
2
+
3
+ **Status:** Canonical
4
+ **Last updated:** 2025-12-21
5
+ **Taxonomy placement:** D4. Layering (treats *depth + elevation* as one consumer concept)
6
+
7
+ CEM uses **layering** as the umbrella term for:
8
+
9
+ - **Depth (signed):** behind vs in front of the base plane (*recess* vs *lift*).
10
+ - **Elevation (positive):** steps above the base plane (*raised*, *floating*, *overlay*, *command*).
11
+ - **Planes (rendering):** global stacking rules for overlays/modals, independent of local nesting.
12
+
13
+ **Companion specs:**
14
+ - **D0. Color (Emotional Palette)** ([`cem-colors.md`](./cem-colors.md)) — tonal "dig down" vs "lift up"
15
+ - **D1. Space & Rhythm** ([`cem-dimension.md`](./cem-dimension.md)) — breathing room coupling
16
+ - **D3. Shape — Bend** ([`cem-shape.md`](./cem-shape.md)) — bend roles for overlays/modals
17
+ - **D5. Stroke & Separation** ([`cem-stroke.md`](./cem-stroke.md)) — contour reinforcement, especially in forced-colors
18
+ - **D7. Time & Motion** ([`cem-timing.md`](./cem-timing.md)) — lift/drop transitions and reduced-motion behavior
19
+ - **Action states** ([discussion #14](https://github.com/EPA-WG/custom-element-dist/discussions/14)) — visual priority order and interaction escalation semantics
20
+
21
+ ## Contents
22
+
23
+ 1. [What layering means to users](#1-what-layering-means-to-users)
24
+ 2. [Consumer layering vocabulary](#2-consumer-layering-vocabulary)
25
+ 3. [User-flow journey through layering](#3-user-flow-journey-through-layering)
26
+ 4. [Design goals](#4-design-goals)
27
+ 5. [Signed ladder and planes](#5-signed-ladder-and-planes)
28
+ 6. [Token model](#6-token-model-basis--endpoints--adapters)
29
+ 7. [Basis tokens and appearance-change principle](#7-basis-tokens-the-canonical-signed-ladder)
30
+ 8. [Semantic endpoints contract](#8-semantic-endpoints-product-facing-contract)
31
+ 9. [Representation channels](#9-representation-channels)
32
+ 10. [Scrim](#10-scrim)
33
+ 11. [Action states and the color ladder](#11-action-states-must-align-with-layering-and-the-color-ladder)
34
+ 12. [Cross-dimension coupling](#12-cross-dimension-coupling)
35
+ 13. [Accessibility and forced-colors requirements](#13-accessibility-and-forced-colors-requirements)
36
+ 14. [Component mapping matrix](#14-component-mapping-matrix)
37
+ 15. [Implementation guidance](#15-implementation-guidance)
38
+ 16. [Canonical token summary](#16-canonical-token-summary)
39
+ 17. [Governance and versioning](#17-governance-and-versioning)
40
+ 18. [Migration notes](#18-migration-notes)
41
+ 19. [References](#19-references)
42
+
43
+ ---
44
+
45
+ ## 1. What layering means to users
46
+
47
+ Layering communicates **relationship and intent** before interaction:
48
+
49
+ - **Where am I?** (shell vs work)
50
+ - **What belongs together?** (grouping vs separation)
51
+ - **What can I act on?** (affordance prominence)
52
+ - **What requires my decision?** (modal commitment)
53
+
54
+ In consumer language, layering typically reads as:
55
+
56
+ - **Back layer:** context and scaffolding (navigation, filters).
57
+ - **Work layer:** primary reading/doing.
58
+ - **Interruption/command:** transient overlays and modal decisions.
59
+
60
+ Layering exists to support three outcomes:
61
+
62
+ 1) **Orientation** — know what is “infrastructure” vs “work.”
63
+ 2) **Separability** — see boundaries without reading.
64
+ 3) **Commitment clarity** — distinguish “context” from “decision.”
65
+
66
+ ---
67
+
68
+ ## 2. Consumer layering vocabulary
69
+
70
+ ### 2.1 Common terms
71
+
72
+ - **Layer / plane:** a named region with stable intent (back, work, overlay).
73
+ - **Stack / z-order:** physical draw order.
74
+ - **Recessed / inset:** visually “dug down” behind the base.
75
+ - **Raised / floating:** visually “lifted” above the base.
76
+ - **Overlay / popover:** transient contextual layer above other content.
77
+ - **Command / modal:** must-respond decision layer.
78
+
79
+ ### 2.2 Semantic tiers are not a z-index ladder
80
+
81
+ The tier number communicates **priority and meaning** (user psychology), not guaranteed draw order. Physical stacking may differ because of clipping, portals, and platform APIs. That physical mismatch **does not** change the semantic contract.
82
+
83
+ **Normative rules**
84
+
85
+ - **MUST NOT** use `--cem-elevation-*` as a z-index value.
86
+ - **MUST NOT** infer semantic tier from physical draw order.
87
+ - **MUST** preserve semantic meaning even when physical stacking differs.
88
+ - **MUST** treat **Command** as the owner of modality (scrim, focus trap, blocked interaction), even if an Overlay renders above it.
89
+ - **MUST** apply dismissal precedence: dismiss the topmost Overlay first, then the Command layer (if present).
90
+
91
+ **Discriminator rules: Overlay vs Floating**
92
+
93
+ Use these rules when physical appearance could be misread (notably when overlays appear over dialogs).
94
+
95
+ - Choose **Overlay** when the UI is a **separate transient layer artifact** with its own dismissal semantics (appears/disappears without becoming part of layout).
96
+ Typical: menus, popovers, autocomplete lists, date pickers, **tooltips**.
97
+
98
+ - Choose **Floating** when the UI is the **same object** as in the work context, temporarily lifted for affordance while remaining part of the current task.
99
+ Typical: hover lift, “picked-up” cards, **dragged items**.
100
+
101
+ **Examples (required interpretation)**
102
+
103
+ - **Tooltip over a dialog:** Tooltip remains **Overlay** (contextual helper). Physical topness does not outrank the dialog’s “must respond” semantics; it dismisses first.
104
+ - **Dragging while a dialog is present:** The dragged object remains **Floating** (same work object lifted). The drag ghost may portal above for clipping, but it **MUST NOT** be reclassified as Overlay.
105
+
106
+ ### 2.3 7-tier canonical ladder
107
+
108
+ CEM defines exactly **7 canonical tiers**. The ladder is signed: two recess rungs, one base rung, and four lift rungs.
109
+
110
+ > The ladder is designed to be perceptually distinct and implementable across light/dark/contrast themes.
111
+
112
+ | Signed tier | Token | Canonical name | Intended meaning | Typical examples |
113
+ |--------------:|---------------------|-------------------|-------------------------------------|-----------------------------------------|
114
+ | **−2** | `--cem-recess-2` | **Deep recessed** | infrastructure far behind attention | deep shell wells, backstage panels |
115
+ | **−1** | `--cem-recess-1` | **Recessed** | back context behind work | side navigation rail, filter plane |
116
+ | **0** | `--cem-elevation-0` | **Base** | ground / canvas | app background, page canvas |
117
+ | **+1** | `--cem-elevation-1` | **Raised** | work region separation | cards, primary panels, editors |
118
+ | **+2** | `--cem-elevation-2` | **Floating** | interactive lift / grouped focus | hover-lift regions, dragged items |
119
+ | **+3** | `--cem-elevation-3` | **Overlay** | contextual transient layer | menus, tooltips, popovers, select lists |
120
+ | **+4** | `--cem-elevation-4` | **Command** | must respond / modal decision | dialogs, blocking confirmations |
121
+
122
+ ### 2.4 Terminology disclaimer
123
+
124
+ 1) **One consumer term:** “layering” is the shared vocabulary for elevation and recess.
125
+ 2) **Signed meaning:** both “dig down” and “lift up” are first-class.
126
+ 3) **Multiple channels:** tone, contour, shadow, blur/material, space, and motion are coordinated.
127
+ 4) **Theme resilience:** the ladder works in light/dark/forced-colors.
128
+ 5) **Avoid false importance:** overlays can render above commands physically, but they must not steal semantic priority.
129
+
130
+ ---
131
+
132
+ ## 3. User-flow journey through layering
133
+
134
+ Layering is experienced as the user moves through a interaction flow.
135
+
136
+ ### 3.1 Landing (orient)
137
+
138
+ - The user identifies **Back vs Work** immediately.
139
+ - Recess is used to make scaffolding feel “behind.”
140
+ - Back layer gives orientation without competing for attention.
141
+ - Base establishes the canvas and reading comfort.
142
+
143
+ ```
144
+ [ Back layer ] | [ Work layer ]
145
+ (nav/context) | (primary content)
146
+ ```
147
+
148
+ ### 3.2 Scanning (compare)
149
+
150
+ - The user needs separability at speed.
151
+ - Work layer regions should be visually grouped (Raised).
152
+ - Recess reduces noise in scaffolding regions.
153
+
154
+ ### 3.3 Interacting (act)
155
+
156
+ - Floating lift signals “this is the active object.”
157
+ - Focus/hover are reinforced without changing the underlying layer role.
158
+
159
+ ### 3.4 Contextualizing (choose)
160
+
161
+ - Overlay provides contextual options near the trigger, above the work.
162
+ - Overlay must remain dismissible and non-modal.
163
+ - If an overlay blocks reading or causes ambiguity, it has become a Command.
164
+
165
+ ### 3.5 Deciding (commit)
166
+
167
+ - Command is the highest semantic priority.
168
+ - Command forces a decision with scrim and focus trap.
169
+ - Any Overlay displayed above a Command remains subordinate and dismisses first.
170
+
171
+ ---
172
+
173
+ ## 4. Design goals
174
+
175
+ - **Semantic clarity:** layers communicate intent (shell vs work vs command).
176
+ - **Minimal ladder:** seven tiers only; no micro-tiers as defaults.
177
+ - **Theme resilience:** semantics stay constant across light/dark/contrast and density.
178
+ - **Accessibility:** layering must remain readable in forced-colors (contour substitutes for shadow/tone).
179
+ - **Portability:** the model maps to web, native, and component libraries.
180
+
181
+ ---
182
+
183
+ ## 5. Signed ladder and planes
184
+
185
+ Layering is a composition of:
186
+
187
+ - **Semantic tier** (the signed ladder rung)
188
+ - **Plane** (the global rendering order / portal)
189
+
190
+ ### 5.1 Planes
191
+
192
+ CEM defines five named planes (semantic layer roles). They are typically implemented with portals.
193
+
194
+ - **Back plane** — recessed context.
195
+ - **Base plane** — canvas.
196
+ - **Work plane** — primary doing/reading.
197
+ - **Overlay plane** — contextual transient UI.
198
+ - **Command plane** — modal decisions.
199
+
200
+ **Normative rules**
201
+
202
+ - Overlays and commands **MUST** render in global planes to avoid clipping by scroll containers.
203
+ - A component’s **semantic tier** is independent of its **rendering plane**.
204
+
205
+ ### 5.2 Physical stacking exceptions are allowed
206
+
207
+ A tooltip can render above a dialog while remaining an **Overlay-tier** element.
208
+
209
+ This is not a contradiction; it reflects two truths:
210
+
211
+ - **Physical topness** is about rendering constraints (portals, clipping, platform APIs).
212
+ - **Semantic topness** is about attention and commitment (what the user must respond to).
213
+
214
+ ---
215
+
216
+ ## 6. Token model (basis → endpoints → adapters)
217
+
218
+ CEM D4 defines three layers of contract.
219
+
220
+ ### 6.1 Basis tokens (rungs)
221
+
222
+ Basis tokens are the minimal numeric “rungs.” They encode signed tier meaning.
223
+
224
+ - `--cem-recess-2`
225
+ - `--cem-recess-1`
226
+ - `--cem-elevation-0`
227
+ - `--cem-elevation-1`
228
+ - `--cem-elevation-2`
229
+ - `--cem-elevation-3`
230
+ - `--cem-elevation-4`
231
+
232
+ ### 6.2 Semantic endpoints (product-facing)
233
+
234
+ Semantic endpoints are what components use. They map to basis rungs.
235
+
236
+ - `--cem-layer-back`
237
+ - `--cem-layer-base`
238
+ - `--cem-layer-work`
239
+ - `--cem-layer-overlay`
240
+ - `--cem-layer-command`
241
+
242
+ ### 6.3 Adapters (appearance channels)
243
+
244
+ Adapters describe how the rung is rendered:
245
+
246
+ - tonal shift (color ladder)
247
+ - shadow recipe
248
+ - contour/stroke reinforcement
249
+ - material/blur recipe
250
+ - spacing adjustments
251
+ - motion/transition recipe
252
+
253
+ Adapters can vary per theme/density without changing semantics.
254
+
255
+ ---
256
+
257
+ ## 7. Basis tokens: the canonical signed ladder
258
+
259
+ ### 7.1 Required rung tokens
260
+
261
+ The 7-tier ladder rungs are required and must remain stable.
262
+
263
+ ### 7.2 Appearance-change principle
264
+
265
+ When moving by one rung, **at least one** of the following must change in a perceivable way (and ideally two in high-density UI):
266
+
267
+ - **Tone** (surface/container tone, chroma shift)
268
+ - **Contour** (stroke/outline, especially in forced-colors)
269
+ - **Shadow** (soft separation)
270
+ - **Material** (blur/opacity)
271
+ - **Space** (inset/gap or breathing room)
272
+ - **Motion** (lift/drop transition)
273
+
274
+ Recess should primarily use **tone and contour** (shadows are often imperceptible “into” the page).
275
+
276
+ Lift should primarily use **tone + shadow**, with contour as a fallback.
277
+
278
+ ---
279
+
280
+ ## 8. Semantic endpoints: product-facing contract
281
+
282
+ Semantic endpoints allow components to express layering without knowing numeric rungs.
283
+
284
+ ### 8.1 Canonical endpoints
285
+
286
+ | Endpoint | Maps to rung | Meaning |
287
+ |-----------------------|---------------------|---------------------------------|
288
+ | `--cem-layer-back` | `--cem-recess-1` | back layer: context behind work |
289
+ | `--cem-layer-base` | `--cem-elevation-0` | canvas/base |
290
+ | `--cem-layer-work` | `--cem-elevation-1` | primary work regions |
291
+ | `--cem-layer-overlay` | `--cem-elevation-3` | contextual transient UI |
292
+ | `--cem-layer-command` | `--cem-elevation-4` | must respond: modal decision |
293
+
294
+ > Note: `--cem-elevation-2` (Floating) is most often an **internal component choice** within the Work layer (e.g., a temporary lifted region), not a global plane.
295
+
296
+ ### 8.2 Optional endpoints
297
+
298
+ Optional endpoints are allowed only if they remain stable and scoped,
299
+ and if they map cleanly to an existing rung without creating new “micro tiers”.
300
+
301
+ Examples:
302
+
303
+ - `--cem-layer-back-deep` → `--cem-layer-back` + `--cem-recess-2`
304
+ - `--cem-layer-work-floating` → `--cem-layer-work` + `--cem-elevation-2`
305
+
306
+ ---
307
+
308
+ ## 9. Representation channels
309
+
310
+ Layering cues are multi-channel. No single channel is reliable across all themes.
311
+
312
+ ### 9.1 Tone and the color ladder
313
+
314
+ The CEM color ladder is the primary driver of “dig down” vs “lift up.”
315
+
316
+ **Rules**
317
+
318
+ - Recess **SHOULD** move toward neutral/gray (less chroma/brand energy).
319
+ - Lift **SHOULD** move toward brighter/branded tones (more chroma/energy).
320
+ - Tone changes must preserve text contrast; do not “flip” text color unless the rung truly becomes Overlay/Command.
321
+
322
+ ### 9.2 Shadow
323
+
324
+ - Shadows **MAY** be reduced in dark themes; tonal separation must still carry the meaning.
325
+ - Recess relies less on shadow; “negative shadow” is generally not readable.
326
+ - Shadow should never be the only separator.
327
+
328
+ ### 9.3 Contour / stroke
329
+
330
+ - Back and Base **SHOULD** rely on contour in high-density layouts and forced-colors.
331
+ - Back and Base layers **SHOULD** have minimal contour.
332
+ - Work and above **SHOULD** provide optional contour reinforcement for dense layouts.
333
+ - Overlay and Command **MUST** remain legible if shadows are removed.
334
+
335
+ ### 9.4 Material / blur
336
+
337
+ Where supported, material/blur can reinforce overlay separation, but **MUST NOT** replace tone/contrast requirements.
338
+
339
+ ### 9.5 Space (inset and gap)
340
+
341
+ Layers with higher semantic priority **SHOULD** “earn” breathing room (inset and/or gap) in comfort density modes.
342
+
343
+ - Recess can be communicated by reduced padding/visual weight, but never by reducing hit targets.
344
+
345
+ ### 9.6 Motion
346
+
347
+ Lift/drop transitions **MAY** reinforce the ladder, but the meaning must remain clear in reduced-motion settings.
348
+
349
+ - Lift/drop transitions are allowed for state changes (hover, focus) but must not change semantic tier.
350
+
351
+ ---
352
+
353
+ ## 10. Scrim
354
+
355
+ Scrim communicates modality and commitment.
356
+
357
+ ### 10.1 Scrim usage matrix
358
+
359
+ | Layer role | Typical components | Scrim | Notes |
360
+ |--------------------|---------------------------------|-----------------|-------------------------------------------------------------|
361
+ | Back / Base / Work | nav, content | none | scrim would reduce usability |
362
+ | Overlay | menus, popovers, tooltips | optional (rare) | only if overlay must strongly detach from busy content |
363
+ | Command | dialogs, blocking confirmations | **required** | command owns modality, focus trap, and dismissal precedence |
364
+
365
+ ### 10.2 Command owns modality
366
+
367
+ - Command **MUST** trap focus (or equivalent modality) and own the scrim.
368
+ - Overlay **MUST NOT** break modality; it may appear above physically, but remains subordinate in semantics and dismissal precedence.
369
+ - Dismissal precedence: **dismiss the topmost Overlay first, then Command**.
370
+
371
+ ---
372
+
373
+ ## 11. Action states must align with layering and the color ladder
374
+
375
+ ### 11.1 Alignment rule: one direction, two dimensions
376
+
377
+ Layering (signed depth) and action states (visual priority order) must not contradict each other.
378
+
379
+ - “More urgent / more interactive” states **SHOULD NOT** be rendered with recess cues.
380
+ - “Less available / less interactive” states **SHOULD NOT** be rendered with lift cues.
381
+
382
+ ### 11.2 State escalation should not change layer role
383
+
384
+ State changes (hover, focus, pressed, selected, disabled, readonly) **MUST NOT** change the layer endpoint. They may adjust **rung rendering** (tone/contour/shadow) within a bounded range.
385
+
386
+ Action states must align with layering cues and color ladder direction.
387
+
388
+ A button becoming hovered does not become an Overlay. State changes should be expressed as **micro-shifts** within the component’s assigned layer role.
389
+
390
+
391
+ ### 11.3 Recommended state → signed shift mapping (default guidance)
392
+
393
+ This guidance assumes the component’s base endpoint is correct.
394
+
395
+ - **Default:** no signed shift change.
396
+ - **Hover / focus:** +0 → +1 *appearance reinforcement* (often contour and/or slightly increased tonal separation).
397
+ - **Pressed:** may “press toward base” visually *without* reducing salience (tactile cue, not hierarchy reversal).
398
+ - **Selected:** treat as a *meaning* change (often tone), not necessarily as a rung change.
399
+ - **Readonly / disabled:** allow a **recess cue** (typically −1 via tone/contour) without moving planes.
400
+
401
+ ### 11.4 Active/pressed tactile rule
402
+
403
+ Pressed feedback may reduce shadow (a “press in”), but **MUST** preserve the state’s prominence via tone/contour so the user does not read it as “disabled or background.”
404
+
405
+ ---
406
+
407
+ ## 12. Cross-dimension coupling
408
+
409
+ Layering relies on other dimensions for robustness:
410
+
411
+ - **D0 Color ladder:** supplies tonal recipes for recess and lift.
412
+ - **D5 Stroke:** provides contour when tone/shadow are insufficient or unavailable.
413
+ - **D1 Space:** higher-priority layers may gain breathing room in comfort density.
414
+ - **D7 Motion:** transitions can reinforce, never replace, the ladder.
415
+
416
+ Layering **MUST NOT** rename or duplicate these dimensions; it only defines coupling invariants.
417
+
418
+ ---
419
+
420
+ ## 13. Accessibility and forced-colors requirements
421
+
422
+ ### 13.1 Depth is not the only signal
423
+
424
+ Layer meaning must remain readable without shadows and with limited color (e.g., high-contrast themes). Therefore:
425
+
426
+ - At least one non-shadow signal (tone or contour) **MUST** remain.
427
+ - Focus indicators **MUST** remain visible across all tiers.
428
+
429
+ ### 13.2 Forced-colors
430
+
431
+ In forced-colors:
432
+
433
+ - Tier meaning **SHOULD** be expressed primarily via contour and spacing.
434
+ - Do not rely on subtle tonal deltas.
435
+
436
+ ---
437
+
438
+ ## 14. Component mapping matrix
439
+
440
+ This matrix maps common component families to **layer endpoints** and their **default rung**.
441
+
442
+ | Component family | Layer endpoint | Default rung | Notes |
443
+ |------------------------------------|-----------------------|---------------------|----------------------------------------------------|
444
+ | App shell (chrome) | `--cem-layer-back` | `--cem-recess-1` | recessed context; low brand energy |
445
+ | Backstage wells (rare) | `--cem-layer-back` | `--cem-recess-2` | use sparingly; avoid turning the UI into “tunnels” |
446
+ | Page canvas | `--cem-layer-base` | `--cem-elevation-0` | ground / canvas |
447
+ | Main content panels | `--cem-layer-work` | `--cem-elevation-1` | default work separation |
448
+ | Floating affordances (within work) | `--cem-layer-work` | `--cem-elevation-2` | same object lifted (hover/drag) |
449
+ | Tooltip | `--cem-layer-overlay` | `--cem-elevation-3` | may portal above dialogs; remains Overlay |
450
+ | Menu / popover / select list | `--cem-layer-overlay` | `--cem-elevation-3` | portal/top-layer; dismiss precedence above dialog |
451
+ | Sheet (non-blocking) | `--cem-layer-overlay` | `--cem-elevation-3` | optional scrim only if required |
452
+ | Dialog / confirmation | `--cem-layer-command` | `--cem-elevation-4` | owns modality, scrim, focus trap |
453
+ | Toast / global banner | `--cem-layer-overlay` | `--cem-elevation-3` | if it blocks progress, treat as Command |
454
+
455
+ ---
456
+
457
+ ## 15. Implementation guidance
458
+
459
+ ### 15.1 Keep semantics separate from z-index
460
+
461
+ - Use layer endpoints and rung tokens for **meaning**.
462
+ - Use a dedicated z-index policy (framework-specific) for **stacking mechanics**.
463
+
464
+ ### 15.2 Example CSS pattern (illustrative)
465
+
466
+ The following demonstrates the mapping shape; it is not a required implementation.
467
+
468
+ ```css
469
+ /* Semantic endpoints select a rung; adapters render the rung. */
470
+
471
+ .cem-layer--work { --cem-rung: var(--cem-elevation-1); }
472
+ .cem-layer--overlay { --cem-rung: var(--cem-elevation-3); }
473
+ .cem-layer--command { --cem-rung: var(--cem-elevation-4); }
474
+
475
+ /* Adapter hooks (tone/shadow/contour) are theme-specific. */
476
+ .cem-layer {
477
+ background: var(--cem-layer-tone, Canvas);
478
+ box-shadow: var(--cem-layer-shadow, none);
479
+ outline: var(--cem-layer-contour, none);
480
+ }
481
+ ```
482
+
483
+ ### 15.3 Dismissal and focus precedence
484
+
485
+ - Escape closes the topmost Overlay first.
486
+ - If no overlays remain, escape closes the Command (if allowed).
487
+
488
+ ---
489
+
490
+ ## 16. Canonical token summary
491
+
492
+ ### 16.1 Required rung tokens
493
+
494
+ - `--cem-recess-2`
495
+ - `--cem-recess-1`
496
+ - `--cem-elevation-0`
497
+ - `--cem-elevation-1`
498
+ - `--cem-elevation-2`
499
+ - `--cem-elevation-3`
500
+ - `--cem-elevation-4`
501
+
502
+ ### 16.2 Required semantic endpoints
503
+
504
+ - `--cem-layer-back`
505
+ - `--cem-layer-base`
506
+ - `--cem-layer-work`
507
+ - `--cem-layer-overlay`
508
+ - `--cem-layer-command`
509
+
510
+ ### 16.3 Optional semantic endpoints (allowed)
511
+
512
+ - `--cem-layer-back-deep` → `--cem-layer-back` + `--cem-recess-2`
513
+ - `--cem-layer-work-floating` → `--cem-layer-work` + `--cem-elevation-2`
514
+
515
+ ---
516
+
517
+ ## 17. Governance and versioning
518
+
519
+ ### 17.1 Breaking (major)
520
+
521
+ Treat as breaking if you:
522
+
523
+ - Rename or remove any canonical rung token or endpoint.
524
+ - Change the semantic meaning of a rung or endpoint.
525
+ - Change the meaning of “Command owns modality” or dismissal precedence.
526
+
527
+ ### 17.2 Non-breaking (minor/patch)
528
+
529
+ Treat as minor/patch if you:
530
+
531
+ - Adjust adapter recipes (tone/shadow/contour) per theme/density while preserving semantics.
532
+ - Add optional endpoints with stable consumer meaning (and clear mapping to existing rungs).
533
+ - Clarify documentation or add mapping guidance.
534
+
535
+ ---
536
+
537
+ ## 18. Migration notes
538
+
539
+ This spec is the canonical D4 contract for layering (signed depth).
540
+
541
+ - Legacy elevation tokens may be kept as **internal aliases**.
542
+ - Prefer `--cem-elevation-*`, `--cem-recess-*`, and `--cem-layer-*` as the public CEM contract going forward.
543
+
544
+ ---
545
+
546
+ ## 19. References
547
+
548
+ ### Internal
549
+
550
+ - Action states in visual priority order (EPA-WG `custom-element-dist` discussion #14): https://github.com/EPA-WG/custom-element-dist/discussions/14
551
+
552
+ ### External
553
+
554
+ - Material Design Backdrop (back layer / front layer): https://m2.material.io/components/backdrop
555
+ - Material Design 3 — Elevation: https://m3.material.io/styles/elevation
556
+ - Android Developers — Material 3 elevation guidance (tonal + shadow): https://developer.android.com/develop/ui/compose/designsystems/material3#elevation
557
+ - Fluent 2 Design System — Elevation: https://fluent2.microsoft.design/elevation
558
+ - Windows apps — Depth, z-depth, and shadow: https://learn.microsoft.com/en-us/windows/apps/design/layout/depth-shadow
559
+ - Apple Human Interface Guidelines — Materials: https://developer.apple.com/design/human-interface-guidelines/materials
560
+ - Apple Human Interface Guidelines — Popovers: https://developer.apple.com/design/human-interface-guidelines/popovers
561
+ - Atlassian Design System — Elevation (includes z-index guidance): https://atlassian.design/foundations/elevation
562
+ - Atlassian Design System — Portal (stacking context): https://atlassian.design/components/portal