@multiplatform.one/theme 8.3.0 → 8.5.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 (248) hide show
  1. package/dist/cjs/audit/constraintAudit.native.js.map +1 -1
  2. package/dist/cjs/audit/designTokens.native.js.map +1 -1
  3. package/dist/cjs/audit/diffReport.native.js.map +1 -1
  4. package/dist/cjs/audit/index.native.js.map +1 -1
  5. package/dist/cjs/audit/themeMatrix.native.js.map +1 -1
  6. package/dist/cjs/dates.native.js.map +1 -1
  7. package/dist/cjs/devWarn.native.js.map +1 -1
  8. package/dist/cjs/expo.native.js.map +1 -1
  9. package/dist/cjs/figma/figmaTokens.native.js.map +1 -1
  10. package/dist/cjs/font.native.js.map +1 -1
  11. package/dist/cjs/fonts/createFontLoader.native.js.map +1 -1
  12. package/dist/cjs/fonts/index.native.js.map +1 -1
  13. package/dist/cjs/fonts/interFaces.native.js.map +1 -1
  14. package/dist/cjs/fonts/types.native.js.map +1 -1
  15. package/dist/cjs/index.gnome.cjs +4 -1
  16. package/dist/cjs/index.gnome.native.js +3 -0
  17. package/dist/cjs/index.gnome.native.js.map +1 -1
  18. package/dist/cjs/index.native.js +1 -1
  19. package/dist/cjs/index.native.js.map +1 -1
  20. package/dist/cjs/keyboardFocusRing.native.js.map +1 -1
  21. package/dist/cjs/menuRow.cjs +1 -1
  22. package/dist/cjs/menuRow.native.js +1 -1
  23. package/dist/cjs/menuRow.native.js.map +1 -1
  24. package/dist/cjs/nativeTwins.native.js.map +1 -1
  25. package/dist/cjs/numbers.native.js.map +1 -1
  26. package/dist/cjs/theme/Heading.native.js.map +1 -1
  27. package/dist/cjs/theme/IconSlot.native.js.map +1 -1
  28. package/dist/cjs/theme/Intent.native.js.map +1 -1
  29. package/dist/cjs/theme/Preset.native.js.map +1 -1
  30. package/dist/cjs/theme/PresetContext.native.js.map +1 -1
  31. package/dist/cjs/theme/Surface.native.js.map +1 -1
  32. package/dist/cjs/theme/Text.native.js.map +1 -1
  33. package/dist/cjs/theme/Tint.native.js.map +1 -1
  34. package/dist/cjs/theme/accentInk.cjs +6 -2
  35. package/dist/cjs/theme/accentInk.native.js +6 -2
  36. package/dist/cjs/theme/accentInk.native.js.map +1 -1
  37. package/dist/cjs/theme/activateThemeConfig.native.js.map +1 -1
  38. package/dist/cjs/theme/animations/css.native.js.map +1 -1
  39. package/dist/cjs/theme/animations/index.native.js.map +1 -1
  40. package/dist/cjs/theme/animations/reactNative.native.js.map +1 -1
  41. package/dist/cjs/theme/chartPalette.cjs +3 -3
  42. package/dist/cjs/theme/chartPalette.native.js +5 -4
  43. package/dist/cjs/theme/chartPalette.native.js.map +1 -1
  44. package/dist/cjs/theme/colorRules.cjs +5 -0
  45. package/dist/cjs/theme/colorRules.native.js +6 -0
  46. package/dist/cjs/theme/colorRules.native.js.map +1 -1
  47. package/dist/cjs/theme/controlTiers.cjs +9 -5
  48. package/dist/cjs/theme/controlTiers.native.js +10 -5
  49. package/dist/cjs/theme/controlTiers.native.js.map +1 -1
  50. package/dist/cjs/theme/cookies.native.js.map +1 -1
  51. package/dist/cjs/theme/createDefaultThemeConfig.native.js.map +1 -1
  52. package/dist/cjs/theme/createThemes.cjs +212 -8
  53. package/dist/cjs/theme/createThemes.native.js +397 -12
  54. package/dist/cjs/theme/createThemes.native.js.map +1 -1
  55. package/dist/cjs/theme/dedupeInherited.native.js.map +1 -1
  56. package/dist/cjs/theme/defaults/accent.native.js.map +1 -1
  57. package/dist/cjs/theme/defaults/base.native.js.map +1 -1
  58. package/dist/cjs/theme/defaults/builderOptions.cjs +9 -4
  59. package/dist/cjs/theme/defaults/builderOptions.native.js +9 -4
  60. package/dist/cjs/theme/defaults/builderOptions.native.js.map +1 -1
  61. package/dist/cjs/theme/defaults/categoryFonts.native.js.map +1 -1
  62. package/dist/cjs/theme/defaults/fonts.native.js.map +1 -1
  63. package/dist/cjs/theme/defaults/house.native.js.map +1 -1
  64. package/dist/cjs/theme/defaults/index.native.js.map +1 -1
  65. package/dist/cjs/theme/devtools/ColorLineVisualizer.native.js.map +1 -1
  66. package/dist/cjs/theme/devtools/ThemeDevtoolsPanel.native.js.map +1 -1
  67. package/dist/cjs/theme/devtools/animationOptions.native.js.map +1 -1
  68. package/dist/cjs/theme/devtools/buildSnapshot.native.js.map +1 -1
  69. package/dist/cjs/theme/devtools/index.native.js.map +1 -1
  70. package/dist/cjs/theme/devtools/knobIcons.native.js.map +1 -1
  71. package/dist/cjs/theme/devtools/vizConstants.native.js.map +1 -1
  72. package/dist/cjs/theme/dynamicType.native.js.map +1 -1
  73. package/dist/cjs/theme/fieldFocus.native.js.map +1 -1
  74. package/dist/cjs/theme/fillContrast.cjs +4 -1
  75. package/dist/cjs/theme/fillContrast.native.js +4 -1
  76. package/dist/cjs/theme/fillContrast.native.js.map +1 -1
  77. package/dist/cjs/theme/focusState.native.js.map +1 -1
  78. package/dist/cjs/theme/fontCategoryMetrics.native.js.map +1 -1
  79. package/dist/cjs/theme/fontCategoryStacks.native.js.map +1 -1
  80. package/dist/cjs/theme/glyphPaint.native.js.map +1 -1
  81. package/dist/cjs/theme/glyphTint.native.js.map +1 -1
  82. package/dist/cjs/theme/groupGeometry.native.js.map +1 -1
  83. package/dist/cjs/theme/index.cjs +1 -0
  84. package/dist/cjs/theme/index.native.js +1 -0
  85. package/dist/cjs/theme/index.native.js.map +1 -1
  86. package/dist/cjs/theme/intents.native.js.map +1 -1
  87. package/dist/cjs/theme/knobs.native.js.map +1 -1
  88. package/dist/cjs/theme/layoutTokens.native.js.map +1 -1
  89. package/dist/cjs/theme/listRows.native.js.map +1 -1
  90. package/dist/cjs/theme/mergedTokens.native.js.map +1 -1
  91. package/dist/cjs/theme/motion.native.js.map +1 -1
  92. package/dist/cjs/theme/motionStops.native.js.map +1 -1
  93. package/dist/cjs/theme/motionTiming.native.js.map +1 -1
  94. package/dist/cjs/theme/nativeMonoFamily.native.js.map +1 -1
  95. package/dist/cjs/theme/nativePresetSwitch.native.js.map +1 -1
  96. package/dist/cjs/theme/nativeSchemePreference.native.js.map +1 -1
  97. package/dist/cjs/theme/nativeTheme.native.js.map +1 -1
  98. package/dist/cjs/theme/nativeTransitionProps.native.js.map +1 -1
  99. package/dist/cjs/theme/overlaySurfaces.native.js.map +1 -1
  100. package/dist/cjs/theme/pageGutter.native.js.map +1 -1
  101. package/dist/cjs/theme/preset.types.native.js.map +1 -1
  102. package/dist/cjs/theme/presetPreview.native.js.map +1 -1
  103. package/dist/cjs/theme/presetStore.native.js.map +1 -1
  104. package/dist/cjs/theme/presetUserSync.native.js.map +1 -1
  105. package/dist/cjs/theme/presets.native.js.map +1 -1
  106. package/dist/cjs/theme/radiusClass.native.js.map +1 -1
  107. package/dist/cjs/theme/radiusClassTable.generated.native.js.map +1 -1
  108. package/dist/cjs/theme/ramps.native.js.map +1 -1
  109. package/dist/cjs/theme/readableColor.cjs +20 -9
  110. package/dist/cjs/theme/readableColor.native.js +20 -9
  111. package/dist/cjs/theme/readableColor.native.js.map +1 -1
  112. package/dist/cjs/theme/recipeInputs.native.js.map +1 -1
  113. package/dist/cjs/theme/recipes.native.js.map +1 -1
  114. package/dist/cjs/theme/resolveKnobs.cjs +4 -1
  115. package/dist/cjs/theme/resolveKnobs.native.js +4 -1
  116. package/dist/cjs/theme/resolveKnobs.native.js.map +1 -1
  117. package/dist/cjs/theme/scale/activeScale.native.js.map +1 -1
  118. package/dist/cjs/theme/scale/deriveRecipeInputs.native.js.map +1 -1
  119. package/dist/cjs/theme/scale/generateScale.native.js.map +1 -1
  120. package/dist/cjs/theme/scale/index.native.js.map +1 -1
  121. package/dist/cjs/theme/scale/scaleAttribute.native.js.map +1 -1
  122. package/dist/cjs/theme/scale/scaleCss.native.js.map +1 -1
  123. package/dist/cjs/theme/scale/scaleFonts.native.js.map +1 -1
  124. package/dist/cjs/theme/scale/scaleInputs.native.js.map +1 -1
  125. package/dist/cjs/theme/scale/themeScales.native.js.map +1 -1
  126. package/dist/cjs/theme/scale/useActiveScale.native.js.map +1 -1
  127. package/dist/cjs/theme/schemeStore.native.js.map +1 -1
  128. package/dist/cjs/theme/shared.native.js.map +1 -1
  129. package/dist/cjs/theme/sizeRecipes.native.js.map +1 -1
  130. package/dist/cjs/theme/subsetThemes.native.js.map +1 -1
  131. package/dist/cjs/theme/themeValue.native.js.map +1 -1
  132. package/dist/cjs/theme/tileSizes.native.js.map +1 -1
  133. package/dist/cjs/theme/tintHues.native.js.map +1 -1
  134. package/dist/cjs/theme/tokenNumber.cjs +34 -0
  135. package/dist/cjs/theme/tokenNumber.native.js +39 -0
  136. package/dist/cjs/theme/tokenNumber.native.js.map +1 -0
  137. package/dist/cjs/theme/touchManipulation.native.js.map +1 -1
  138. package/dist/cjs/theme/useResolvedKnobs.native.js.map +1 -1
  139. package/dist/cjs/theme/useTouchSurface.native.js.map +1 -1
  140. package/dist/cjs/theme/v3TokenRoles.native.js.map +1 -1
  141. package/dist/esm/index.gnome.mjs +3 -2
  142. package/dist/esm/index.gnome.mjs.map +1 -1
  143. package/dist/esm/index.gnome.native.js +3 -2
  144. package/dist/esm/index.gnome.native.js.map +1 -1
  145. package/dist/esm/menuRow.mjs +1 -1
  146. package/dist/esm/menuRow.native.js +1 -1
  147. package/dist/esm/theme/accentInk.mjs +6 -3
  148. package/dist/esm/theme/accentInk.mjs.map +1 -1
  149. package/dist/esm/theme/accentInk.native.js +6 -3
  150. package/dist/esm/theme/accentInk.native.js.map +1 -1
  151. package/dist/esm/theme/chartPalette.mjs +3 -3
  152. package/dist/esm/theme/chartPalette.mjs.map +1 -1
  153. package/dist/esm/theme/chartPalette.native.js +5 -4
  154. package/dist/esm/theme/chartPalette.native.js.map +1 -1
  155. package/dist/esm/theme/colorRules.mjs +5 -1
  156. package/dist/esm/theme/colorRules.mjs.map +1 -1
  157. package/dist/esm/theme/colorRules.native.js +6 -1
  158. package/dist/esm/theme/colorRules.native.js.map +1 -1
  159. package/dist/esm/theme/controlTiers.mjs +9 -6
  160. package/dist/esm/theme/controlTiers.mjs.map +1 -1
  161. package/dist/esm/theme/controlTiers.native.js +10 -6
  162. package/dist/esm/theme/controlTiers.native.js.map +1 -1
  163. package/dist/esm/theme/createThemes.mjs +215 -12
  164. package/dist/esm/theme/createThemes.mjs.map +1 -1
  165. package/dist/esm/theme/createThemes.native.js +400 -16
  166. package/dist/esm/theme/createThemes.native.js.map +1 -1
  167. package/dist/esm/theme/defaults/builderOptions.mjs +10 -6
  168. package/dist/esm/theme/defaults/builderOptions.mjs.map +1 -1
  169. package/dist/esm/theme/defaults/builderOptions.native.js +10 -6
  170. package/dist/esm/theme/defaults/builderOptions.native.js.map +1 -1
  171. package/dist/esm/theme/fillContrast.mjs +5 -2
  172. package/dist/esm/theme/fillContrast.mjs.map +1 -1
  173. package/dist/esm/theme/fillContrast.native.js +5 -2
  174. package/dist/esm/theme/fillContrast.native.js.map +1 -1
  175. package/dist/esm/theme/index.mjs +1 -0
  176. package/dist/esm/theme/index.mjs.map +1 -1
  177. package/dist/esm/theme/index.native.js +1 -0
  178. package/dist/esm/theme/index.native.js.map +1 -1
  179. package/dist/esm/theme/nativeTheme.mjs.map +1 -1
  180. package/dist/esm/theme/nativeTheme.native.js.map +1 -1
  181. package/dist/esm/theme/readableColor.mjs +20 -9
  182. package/dist/esm/theme/readableColor.mjs.map +1 -1
  183. package/dist/esm/theme/readableColor.native.js +20 -9
  184. package/dist/esm/theme/readableColor.native.js.map +1 -1
  185. package/dist/esm/theme/resolveKnobs.mjs +4 -1
  186. package/dist/esm/theme/resolveKnobs.mjs.map +1 -1
  187. package/dist/esm/theme/resolveKnobs.native.js +4 -1
  188. package/dist/esm/theme/resolveKnobs.native.js.map +1 -1
  189. package/dist/esm/theme/tokenNumber.mjs +9 -0
  190. package/dist/esm/theme/tokenNumber.mjs.map +1 -0
  191. package/dist/esm/theme/tokenNumber.native.js +11 -0
  192. package/dist/esm/theme/tokenNumber.native.js.map +1 -0
  193. package/package.json +5 -5
  194. package/src/figma/figmaTokens.spec.ts +2 -1
  195. package/src/index.gnome.ts +2 -0
  196. package/src/menuRow.palette.spec.ts +20 -7
  197. package/src/menuRow.spec.ts +2 -2
  198. package/src/menuRow.ts +3 -3
  199. package/src/theme/accentInk.ts +8 -2
  200. package/src/theme/accentOnSurface.spec.tsx +6 -1
  201. package/src/theme/chartPalette.spec.ts +2 -2
  202. package/src/theme/chartPalette.ts +9 -9
  203. package/src/theme/colorRules.ts +13 -0
  204. package/src/theme/controlEdges.spec.ts +114 -0
  205. package/src/theme/controlTiers.ts +18 -9
  206. package/src/theme/createDefaultThemeConfig.spec.ts +135 -12
  207. package/src/theme/createThemes.ts +363 -24
  208. package/src/theme/defaults/builderOptions.ts +25 -8
  209. package/src/theme/defaults/secondaryInk.spec.ts +10 -5
  210. package/src/theme/fillContrast.spec.ts +8 -2
  211. package/src/theme/fillContrast.ts +10 -2
  212. package/src/theme/houseGround.spec.ts +1 -1
  213. package/src/theme/index.ts +1 -0
  214. package/src/theme/nativeTheme.tsx +1 -1
  215. package/src/theme/readableColor.ts +23 -11
  216. package/src/theme/recipes.ts +1 -0
  217. package/src/theme/resolveKnobs.spec.ts +4 -4
  218. package/src/theme/resolveKnobs.ts +6 -4
  219. package/src/theme/selectionFill.spec.ts +58 -0
  220. package/src/theme/switchThumb.spec.ts +13 -1
  221. package/src/theme/themeKeyRegistry.spec.ts +26 -0
  222. package/src/theme/tokenNumber.spec.tsx +47 -0
  223. package/src/theme/tokenNumber.ts +18 -0
  224. package/types/index.gnome.d.ts +2 -1
  225. package/types/index.gnome.d.ts.map +1 -1
  226. package/types/menuRow.d.ts +5 -5
  227. package/types/theme/accentInk.d.ts +1 -0
  228. package/types/theme/accentInk.d.ts.map +1 -1
  229. package/types/theme/chartPalette.d.ts +2 -2
  230. package/types/theme/colorRules.d.ts +9 -0
  231. package/types/theme/colorRules.d.ts.map +1 -1
  232. package/types/theme/controlTiers.d.ts +11 -5
  233. package/types/theme/controlTiers.d.ts.map +1 -1
  234. package/types/theme/createThemes.d.ts +21 -12
  235. package/types/theme/createThemes.d.ts.map +1 -1
  236. package/types/theme/defaults/builderOptions.d.ts +9 -1
  237. package/types/theme/defaults/builderOptions.d.ts.map +1 -1
  238. package/types/theme/fillContrast.d.ts.map +1 -1
  239. package/types/theme/index.d.ts +1 -0
  240. package/types/theme/index.d.ts.map +1 -1
  241. package/types/theme/nativeTheme.d.ts +1 -1
  242. package/types/theme/nativeTheme.d.ts.map +1 -1
  243. package/types/theme/readableColor.d.ts.map +1 -1
  244. package/types/theme/recipes.d.ts +3 -0
  245. package/types/theme/recipes.d.ts.map +1 -1
  246. package/types/theme/resolveKnobs.d.ts.map +1 -1
  247. package/types/theme/tokenNumber.d.ts +10 -0
  248. package/types/theme/tokenNumber.d.ts.map +1 -0
@@ -37,6 +37,7 @@ __export(createThemes_exports, {
37
37
  houseComponentThemes: () => houseComponentThemes,
38
38
  houseGrandChildrenThemes: () => houseGrandChildrenThemes,
39
39
  houseTemplates: () => houseTemplates,
40
+ postPassThemeKeys: () => postPassThemeKeys,
40
41
  tintHueNames: () => import_tintHues.tintHueNames
41
42
  });
42
43
  module.exports = __toCommonJS(createThemes_exports);
@@ -47,6 +48,7 @@ var import_colorRules = require("./colorRules.cjs");
47
48
  var import_builderOptions = require("./defaults/builderOptions.cjs");
48
49
  var import_ramps = require("./ramps.cjs");
49
50
  var import_accentInk = require("./accentInk.cjs");
51
+ var import_dedupeInherited = require("./dedupeInherited.cjs");
50
52
  var import_tintHues = require("./tintHues.cjs");
51
53
  const intentInkFloor = {
52
54
  /** Stored hsla(41, 99%, 30%, 1); 4.54:1 on $color2, dE76 2.54. */
@@ -68,9 +70,34 @@ const lightSurfaceGrouped = {
68
70
  backgroundFocus: import_theme_builder.PALETTE_BACKGROUND_OFFSET,
69
71
  backgroundActive: import_theme_builder.PALETTE_BACKGROUND_OFFSET
70
72
  };
73
+ const fillKeys = ["background", "backgroundHover", "backgroundPress", "backgroundFocus", "backgroundActive"];
74
+ const edgeKeys = ["borderColor", "borderColorHover", "borderColorFocus", "borderColorPress"];
75
+ function liftOneStep(template) {
76
+ const lifted = {
77
+ ...template
78
+ };
79
+ for (const key of [...fillKeys, ...edgeKeys]) lifted[key] = template[key] + 1;
80
+ return lifted;
81
+ }
82
+ const darkSurfaceGrouped = {
83
+ ...liftOneStep(import_v5.v5Templates.dark_surface1),
84
+ selectFill: import_theme_builder.PALETTE_BACKGROUND_OFFSET + 4,
85
+ selectPress: import_theme_builder.PALETTE_BACKGROUND_OFFSET + 5
86
+ };
87
+ const darkBasePage = {
88
+ ...import_v5.v5Templates.dark_base,
89
+ background: import_theme_builder.PALETTE_BACKGROUND_OFFSET,
90
+ backgroundActive: import_theme_builder.PALETTE_BACKGROUND_OFFSET,
91
+ backgroundFocus: import_theme_builder.PALETTE_BACKGROUND_OFFSET + 1,
92
+ backgroundHover: import_theme_builder.PALETTE_BACKGROUND_OFFSET + 1,
93
+ backgroundPress: import_theme_builder.PALETTE_BACKGROUND_OFFSET + 1
94
+ };
71
95
  const houseTemplates = {
72
96
  ...import_v5.v5Templates,
73
- light_surface1: lightSurfaceGrouped
97
+ light_surface1: lightSurfaceGrouped,
98
+ dark_base: darkBasePage,
99
+ dark_surface1: darkSurfaceGrouped,
100
+ dark_surface2: liftOneStep(import_v5.v5Templates.dark_surface2)
74
101
  };
75
102
  const houseComponentThemes = {
76
103
  Button: {
@@ -223,7 +250,7 @@ function holdAccentFloor(themes) {
223
250
  if (!base?.accentBackground || !base.accentColor) continue;
224
251
  const paper = luminanceOf(base.color1);
225
252
  const ink = luminanceOf(base.color12);
226
- const surfaces = [base.color1, base.color2, base.color3, base.color4].map(luminanceOf);
253
+ const surfaces = [base.color1, base.color2, base.color3, base.color4, ...(scheme === "dark" ? [base.color5] : [])].map(luminanceOf);
227
254
  if (paper === null || ink === null || surfaces.some(lum => lum === null)) continue;
228
255
  const steps = Array.from({
229
256
  length: 12
@@ -276,12 +303,146 @@ function holdSelectionSurface(themes) {
276
303
  color4: held,
277
304
  ...(theme.borderColor === scope.color4 ? {
278
305
  borderColor: held
306
+ } : null),
307
+ ...(theme.selectFill === scope.color4 ? {
308
+ selectFill: held
279
309
  } : null)
280
310
  };
281
311
  }
282
312
  }
283
313
  return out;
284
314
  }
315
+ function holdDarkEdges(themes) {
316
+ const out = {
317
+ ...themes
318
+ };
319
+ const scopes = Object.keys(themes).filter(name => /^dark(_[a-z]+)?$/.test(name));
320
+ const ownerOf = name => scopes.filter(scope => name === scope || name.startsWith(`${scope}_`)).reduce((longest, scope) => scope.length > longest.length ? scope : longest, "");
321
+ for (const scopeName of scopes) {
322
+ if (/_(accent|active)$/.test(scopeName)) continue;
323
+ const scope = themes[scopeName];
324
+ const ramp = Array.from({
325
+ length: 12
326
+ }, (_, index) => scope[`color${index + 1}`]);
327
+ const grounds = [scope.background, scope.color4].map(color => luminanceOf(color));
328
+ if (grounds.some(ground => ground === null)) continue;
329
+ const brightest = Math.max(...grounds);
330
+ const clears = color => {
331
+ const luminance = luminanceOf(color);
332
+ return luminance !== null && luminance > brightest && grounds.every(ground => (0, import_colorRules.contrastRatio)(luminance, ground) >= import_builderOptions.darkHairlineContrast);
333
+ };
334
+ const hairline = ramp.findIndex((color, index) => index < 11 && clears(color));
335
+ if (hairline < 0) continue;
336
+ const medium = hairline + 1;
337
+ for (const [name, theme] of Object.entries(themes)) {
338
+ if (ownerOf(name) !== scopeName) continue;
339
+ const surface = name === scopeName || theme.background === scope.color4;
340
+ const step = ramp.indexOf(theme.borderColor);
341
+ const shift = surface && step >= 0 ? medium - step : 0;
342
+ const moved = {};
343
+ if ("borderColorHairline" in theme || name === scopeName) moved.borderColorHairline = ramp[hairline];
344
+ if (shift > 0) {
345
+ for (const key of ["borderColor", "borderColorHover", "borderColorFocus", "borderColorPress"]) {
346
+ const at = ramp.indexOf(theme[key]);
347
+ if (at >= 0) moved[key] = ramp[Math.min(11, at + shift)];
348
+ }
349
+ }
350
+ out[name] = {
351
+ ...out[name],
352
+ ...moved
353
+ };
354
+ }
355
+ }
356
+ return out;
357
+ }
358
+ function holdControlEdges(themes) {
359
+ const out = {
360
+ ...themes
361
+ };
362
+ const firstClearing = (neutral, grounds) => {
363
+ const lums = grounds.map(ground => luminanceOf(ground));
364
+ if (lums.some(lum => lum === null)) return -1;
365
+ const darkest = Math.min(...lums);
366
+ const brightest = Math.max(...lums);
367
+ const light = (0, import_colorRules.isLightGround)(grounds[0]);
368
+ return neutral.findIndex(color => {
369
+ const lum = luminanceOf(color);
370
+ return lum !== null && (light ? lum < darkest : lum > brightest) && lums.every(ground => (0, import_colorRules.contrastRatio)(lum, ground) >= import_colorRules.minContrastRatio);
371
+ });
372
+ };
373
+ const resolved = (name, key) => {
374
+ for (let at = name; at; at = at.slice(0, Math.max(0, at.lastIndexOf("_")))) {
375
+ const value = (out[at] ?? themes[at])?.[key];
376
+ if (value !== void 0) return value;
377
+ if (!at.includes("_")) break;
378
+ }
379
+ return void 0;
380
+ };
381
+ for (const scheme of ["light", "dark"]) {
382
+ const root = themes[scheme];
383
+ if (!root) continue;
384
+ const neutral = Array.from({
385
+ length: 12
386
+ }, (_, index) => root[`color${index + 1}`]);
387
+ const fieldEdges = scopeName => {
388
+ const scope = themes[scopeName];
389
+ const field = `${scopeName}_Input`;
390
+ const edge = firstClearing(neutral, [scope.background, resolved(field, "background")]);
391
+ if (edge < 0) return void 0;
392
+ const ramp = Array.from({
393
+ length: 12
394
+ }, (_, index) => scope[`color${index + 1}`]);
395
+ const stepOf = color => {
396
+ const lum = luminanceOf(color);
397
+ if (lum === null) return -1;
398
+ return ramp.reduce((best, step, index) => Math.abs((luminanceOf(step) ?? 2) - lum) < Math.abs((luminanceOf(ramp[best]) ?? 2) - lum) ? index : best, 0);
399
+ };
400
+ const rest = stepOf(resolved(field, "borderColor"));
401
+ const hover = stepOf(resolved(field, "borderColorHover"));
402
+ return {
403
+ borderColorField: neutral[edge],
404
+ borderColorFieldHover: neutral[Math.min(11, Math.max(edge, edge + hover - rest))]
405
+ };
406
+ };
407
+ const rootFields = fieldEdges(scheme);
408
+ const rootControl = firstClearing(neutral, [root.background]);
409
+ if (!rootFields || rootControl < 0) continue;
410
+ out[scheme] = {
411
+ ...out[scheme],
412
+ ...rootFields,
413
+ borderColorControl: neutral[rootControl],
414
+ switchTrackOffBorder: scheme === "light" ? neutral[rootControl] : root.switchTrackOff
415
+ };
416
+ const scopes = Object.keys(themes).filter(name => new RegExp(`^${scheme}_[a-z]+$`).test(name) && !/_(accent|active)$/.test(name));
417
+ const pages = [root.background, ...scopes.filter(name => !semanticIntentNames.has(name.slice(scheme.length + 1))).map(name => themes[name].background)];
418
+ for (const scopeName of scopes) {
419
+ const scope = themes[scopeName];
420
+ const patch = {};
421
+ if (scheme === "dark" && "switchTrackOff" in scope) patch.switchTrackOffBorder = scope.switchTrackOff;
422
+ if (semanticIntentNames.has(scopeName.slice(scheme.length + 1))) {
423
+ const field = `${scopeName}_Input`;
424
+ const ramp = Array.from({
425
+ length: 12
426
+ }, (_, index) => scope[`color${index + 1}`]);
427
+ const edge = firstClearing(ramp, [...pages, resolved(field, "background")]);
428
+ patch.borderColorField = edge < 0 ? resolved(field, "borderColor") : ramp[edge];
429
+ patch.borderColorFieldHover = edge < 0 ? resolved(field, "borderColorHover") : ramp[Math.min(11, edge + 1)];
430
+ } else {
431
+ const fields = fieldEdges(scopeName);
432
+ if (fields) {
433
+ for (const [key, value] of Object.entries(fields)) if (value !== rootFields[key]) patch[key] = value;
434
+ }
435
+ const control = firstClearing(neutral, [scope.background]);
436
+ if (control >= 0 && control !== rootControl) patch.borderColorControl = neutral[control];
437
+ }
438
+ if (Object.keys(patch).length > 0) out[scopeName] = {
439
+ ...out[scopeName],
440
+ ...patch
441
+ };
442
+ }
443
+ }
444
+ return out;
445
+ }
285
446
  const selectedTintContrastRatio = 1.1;
286
447
  const neutralSelectedTintContrastRatio = 1.25;
287
448
  const achromaticChannelSpread = 8;
@@ -349,7 +510,7 @@ const switchRaisedAlphaStep = 0.04;
349
510
  function raisedGrounds(themes, scheme) {
350
511
  if (scheme === "light") return [];
351
512
  const hues = Object.entries(themes).filter(([name]) => new RegExp(`^${scheme}_[a-z]+$`).test(name)).filter(([name]) => !/_(accent|active)$/.test(name));
352
- return [themes[scheme]?.color4, ...hues.map(([, theme]) => theme.color4)].filter(color => typeof color === "string");
513
+ return [themes[scheme], ...hues.map(([, theme]) => theme)].flatMap(theme => [theme?.color4, theme?.color5]).filter(color => typeof color === "string");
353
514
  }
354
515
  function holdSwitchTrack(themes) {
355
516
  const out = {
@@ -358,11 +519,24 @@ function holdSwitchTrack(themes) {
358
519
  for (const scheme of ["light", "dark"]) {
359
520
  const base = themes[scheme];
360
521
  if (!base) continue;
361
- const paint = switchTrackPaint(base, base.accentBackground, base.background, raisedGrounds(themes, scheme));
522
+ const paint = switchTrackPaint(base, base.accentBackground, (0, import_colorRules.switchOffGround)(base), raisedGrounds(themes, scheme));
362
523
  if (paint) out[scheme] = {
363
524
  ...base,
364
525
  ...paint
365
526
  };
527
+ if (scheme !== "dark" || !paint) continue;
528
+ for (const intent of semanticIntentNames) {
529
+ const scope = themes[`${scheme}_${intent}`];
530
+ const off = luminanceOf(paint.switchTrackOff);
531
+ if (!scope?.color4 || !scope.color5 || off === null) continue;
532
+ const holds = (0, import_colorRules.inSwitchOffBand)(paint.switchTrackOff, scope.color4) && [scope.color4, scope.color5].every(ground => (0, import_colorRules.contrastRatio)(off, luminanceOf(ground) ?? off) >= import_colorRules.plateContrastRatio);
533
+ if (holds) continue;
534
+ const track = switchTrackPaint(base, scope.accentBackground ?? base.accentBackground, scope.color4, [base.color4, scope.color4, scope.color5]);
535
+ if (track) out[`${scheme}_${intent}`] = {
536
+ ...scope,
537
+ ...track
538
+ };
539
+ }
366
540
  }
367
541
  return out;
368
542
  }
@@ -526,7 +700,7 @@ function holdColorThemeAccent(themes) {
526
700
  if (!scope || ramp.some(step => !step)) continue;
527
701
  const paper = luminanceOf(scope.color1);
528
702
  const ink = luminanceOf(scope.color12);
529
- const surfaces = [scope.color1, scope.color2, scope.color3, scope.color4].map(luminanceOf);
703
+ const surfaces = [scope.color1, scope.color2, scope.color3, scope.color4, ...(scheme === "dark" ? [scope.color5] : [])].map(luminanceOf);
530
704
  if (paper === null || ink === null || surfaces.some(lum => lum === null)) continue;
531
705
  const labels = [scope.color1, scope.color12].sort((a, b) => luminanceOf(b) - luminanceOf(a));
532
706
  const solid = holdFillLabel(ramp[8], ramp.slice(0, 11), labels, paper);
@@ -542,8 +716,9 @@ function holdColorThemeAccent(themes) {
542
716
  };
543
717
  const rootOn = luminanceOf(base.switchTrackOff);
544
718
  const fillLum = luminanceOf(fill);
545
- const rootHolds = rootOn === null || fillLum === null || (0, import_colorRules.contrastRatio)(rootOn, fillLum) >= switchStateContrastRatio;
546
- const track = rootHolds ? void 0 : switchTrackPaint(base, fill, scope.background, (0, import_colorRules.isLightGround)(scope.background) ? [] : [scope.color4]);
719
+ const switchGround = (0, import_colorRules.switchOffGround)(scope) ?? scope.background;
720
+ const rootHolds = rootOn === null || fillLum === null || (0, import_colorRules.contrastRatio)(rootOn, fillLum) >= switchStateContrastRatio && (0, import_colorRules.inSwitchOffBand)(base.switchTrackOff, switchGround) && ((0, import_colorRules.isLightGround)(scope.background) ? [] : [scope.color4, scope.color5]).every(ground => (0, import_colorRules.contrastRatio)(rootOn, luminanceOf(ground) ?? rootOn) >= import_colorRules.plateContrastRatio);
721
+ const track = rootHolds ? void 0 : switchTrackPaint(base, fill, switchGround, (0, import_colorRules.isLightGround)(scope.background) ? [] : [base.color4, scope.color4, scope.color5]);
547
722
  for (const [name, theme] of Object.entries(themes)) {
548
723
  if (name === scopeName) {
549
724
  out[name] = {
@@ -653,6 +828,34 @@ function holdHouseAccent(themes) {
653
828
  }
654
829
  return out;
655
830
  }
831
+ function holdHouseIdentityInk(themes) {
832
+ const out = {
833
+ ...themes
834
+ };
835
+ for (const scheme of ["light", "dark"]) {
836
+ const base = themes[scheme];
837
+ const blueInk = themes[`${scheme}_blue`]?.identityInk;
838
+ if (!base?.identityInk || !blueInk || base.identityInk === blueInk) continue;
839
+ const held = Array.from({
840
+ length: 12
841
+ }, (_, index) => index + 1).every(step => base[`accent${step}`] !== void 0 && base[`accent${step}`] === base[`blue${step}`]);
842
+ if (!held) continue;
843
+ for (const [name, theme] of Object.entries(themes)) {
844
+ if (name !== scheme && !name.startsWith(`${scheme}_`)) continue;
845
+ const scope = name.split("_")[1];
846
+ if (scope === "accent" || childrenHues.includes(scope)) continue;
847
+ if (theme.identityInk !== base.identityInk) continue;
848
+ const values = (0, import_dedupeInherited.resolveThemeThroughParents)(themes, name);
849
+ if ((0, import_accentInk.pickIdentityInk)([blueInk], (0, import_accentInk.pageSurfaces)(name, values)) === blueInk) {
850
+ out[name] = {
851
+ ...theme,
852
+ identityInk: blueInk
853
+ };
854
+ }
855
+ }
856
+ }
857
+ return out;
858
+ }
656
859
  const defaultLightShadows = {
657
860
  shadow1: "rgba(0,0,0,0.04)",
658
861
  shadow2: "rgba(0,0,0,0.08)",
@@ -707,6 +910,7 @@ function isChromatic(color) {
707
910
  const channels = [1, 3, 5].map(index => Number.parseInt(hex.slice(index, index + 2), 16));
708
911
  return Math.max(...channels) - Math.min(...channels) >= 24;
709
912
  }
913
+ const postPassThemeKeys = ["accentOnSurface", "borderColorControl", "borderColorField", "borderColorFieldHover", "borderColorHairline", "identityInk", "selectedBackground", "selectedColor", "switchTrackOff", "switchTrackOffBorder", "switchTrackOffHover", "switchTrackOffPress"];
710
914
  function createThemesBuilder(baseTheme, accentTheme, options) {
711
915
  const getTheme = options?.getTheme ? sanitizeGetTheme(options.getTheme) : void 0;
712
916
  const base = {
@@ -776,7 +980,7 @@ function createThemesBuilder(baseTheme, accentTheme, options) {
776
980
  createThemesProps.getTheme = getTheme;
777
981
  }
778
982
  const initialTheme = (0, import_theme_builder.createThemes)(createThemesProps);
779
- const themes = (0, import_accentInk.withIdentityInk)((0, import_accentInk.withAccentOnSurface)(holdFocusRingAccent(holdHouseAccent(holdColorThemeAccent(holdSwitchTrack(holdSyntaxFloor(holdNamedInkFloor(holdSelectedState(holdAccentFloor(holdSelectionSurface(neutralizeSemanticEntryText(neutralizeTintText(initialTheme)))))))))))));
983
+ const themes = holdHouseIdentityInk((0, import_accentInk.withIdentityInk)((0, import_accentInk.withAccentOnSurface)(holdFocusRingAccent(holdControlEdges(holdHouseAccent(holdColorThemeAccent(holdSwitchTrack(holdSyntaxFloor(holdNamedInkFloor(holdSelectedState(holdAccentFloor(holdDarkEdges(holdSelectionSurface(neutralizeSemanticEntryText(neutralizeTintText(initialTheme))))))))))))))));
780
984
  return {
781
985
  themes() {
782
986
  return themes;