@plexui/styles 0.1.35 → 0.1.36

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.
@@ -1,5 +1,7 @@
1
1
  @layer components {.Menu {
2
2
  /* Top-level selector needs to exist */
3
+ }/* A menu opened from a Dialog laid out as on a phone takes its phone rules here (Menu.tsx) */.PhoneScope {
4
+ display: contents;
3
5
  }.MenuList[data-pill] {
4
6
  --menu-radius: var(--menu-radius-pill, 22px);
5
7
  --menu-gutter: var(--menu-pill-gutter);
@@ -750,7 +752,7 @@
750
752
  background: var(--menu-mobile-background, var(--color-surface-elevated));
751
753
  }
752
754
 
753
- :where([data-plex-layout="phone"]) :where([data-theme="dark"]) .MenuList {
755
+ :where([data-theme="dark"]) :where([data-plex-layout="phone"]) .MenuList, :where([data-plex-layout="phone"]) :where([data-theme="dark"]) .MenuList {
754
756
  backdrop-filter: var(--menu-mobile-backdrop-filter, none);
755
757
  }
756
758
 
@@ -894,7 +896,10 @@
894
896
  width: var(--menu-check-size, 18px);
895
897
  height: var(--menu-check-size, 18px);
896
898
  color: inherit;
897
- }/* Phone submenu geometry is solved against the whole viewport/footer boundary.
899
+ }/* The items of a submenu (Menu.tsx SubContent). They lie in the panel itself; a phone submenu scrolls them under its
900
+ heading row (below). */.SubmenuItems {
901
+ display: contents;
902
+ }/* Phone submenu geometry is solved against the whole viewport/footer boundary.
898
903
  Retain the primitive's collection and focus behavior, not its side-space width. */@media (max-width: 767px) {
899
904
  .MenuList[data-submenu]:not([data-submenu-positioned]) {
900
905
  visibility: hidden;
@@ -927,8 +932,32 @@
927
932
  font-weight: var(--font-weight-semibold);
928
933
  }
929
934
 
935
+ /* The heading row stays in place and only the items under it scroll, in a submenu taller than the room it has
936
+ (owner, plan 176: the row that closes the submenu is always in reach). */
937
+ .MenuList[data-submenu-phone] {
938
+ display: flex;
939
+ flex-direction: column;
940
+ overflow: hidden;
941
+ }
942
+
943
+ .MenuList[data-submenu-phone] > :is([data-submenu-collapse], .Separator) {
944
+ flex: none;
945
+ }
946
+
947
+ /* Across the panel's inline padding, into which a pressed row's capsule reaches: it scrolls only down */
948
+ .MenuList[data-submenu-phone] > .SubmenuItems {
949
+ display: block;
950
+ flex: 1 1 auto;
951
+ min-height: 0;
952
+ margin-inline: calc(-1 * var(--menu-padding-inline, var(--menu-gutter)));
953
+ padding-inline: var(--menu-padding-inline, var(--menu-gutter));
954
+ overflow: hidden auto;
955
+ overscroll-behavior: contain;
956
+ -webkit-overflow-scrolling: touch;
957
+ }
958
+
930
959
  /* A submenu that starts with its own separator keeps only the one under its heading row */
931
- [data-submenu-collapse] + .Separator + .Separator {
960
+ .MenuList[data-submenu-phone] > .SubmenuItems > .Separator:first-child {
932
961
  display: none;
933
962
  }
934
963
 
@@ -950,8 +979,10 @@
950
979
  transition: scale var(--motion-enter) var(--cubic-enter), transform-origin 0s;
951
980
  }
952
981
 
982
+ /* Its rows take no press: one on the parent collapses the submenu and chooses nothing (owner, plan 176) */
953
983
  .MenuList[data-submenu-over] > * {
954
984
  opacity: 0.5;
985
+ pointer-events: none;
955
986
  }
956
987
 
957
988
  /* A submenu grows out of the row that opened it, in step with the parent stepping back: from the middle of its top,
@@ -1009,8 +1040,32 @@
1009
1040
  font-weight: var(--font-weight-semibold);
1010
1041
  }
1011
1042
 
1043
+ /* The heading row stays in place and only the items under it scroll, in a submenu taller than the room it has
1044
+ (owner, plan 176: the row that closes the submenu is always in reach). */
1045
+ :where([data-plex-layout="phone"]) .MenuList[data-submenu-phone] {
1046
+ display: flex;
1047
+ flex-direction: column;
1048
+ overflow: hidden;
1049
+ }
1050
+
1051
+ :where([data-plex-layout="phone"]) .MenuList[data-submenu-phone] > :is([data-submenu-collapse], .Separator) {
1052
+ flex: none;
1053
+ }
1054
+
1055
+ /* Across the panel's inline padding, into which a pressed row's capsule reaches: it scrolls only down */
1056
+ :where([data-plex-layout="phone"]) .MenuList[data-submenu-phone] > .SubmenuItems {
1057
+ display: block;
1058
+ flex: 1 1 auto;
1059
+ min-height: 0;
1060
+ margin-inline: calc(-1 * var(--menu-padding-inline, var(--menu-gutter)));
1061
+ padding-inline: var(--menu-padding-inline, var(--menu-gutter));
1062
+ overflow: hidden auto;
1063
+ overscroll-behavior: contain;
1064
+ -webkit-overflow-scrolling: touch;
1065
+ }
1066
+
1012
1067
  /* A submenu that starts with its own separator keeps only the one under its heading row */
1013
- :where([data-plex-layout="phone"]) [data-submenu-collapse] + .Separator + .Separator {
1068
+ :where([data-plex-layout="phone"]) .MenuList[data-submenu-phone] > .SubmenuItems > .Separator:first-child {
1014
1069
  display: none;
1015
1070
  }
1016
1071
 
@@ -1032,8 +1087,10 @@
1032
1087
  transition: scale var(--motion-enter) var(--cubic-enter), transform-origin 0s;
1033
1088
  }
1034
1089
 
1090
+ /* Its rows take no press: one on the parent collapses the submenu and chooses nothing (owner, plan 176) */
1035
1091
  :where([data-plex-layout="phone"]) .MenuList[data-submenu-over] > * {
1036
1092
  opacity: 0.5;
1093
+ pointer-events: none;
1037
1094
  }
1038
1095
 
1039
1096
  /* A submenu grows out of the row that opened it, in step with the parent stepping back: from the middle of its top,
@@ -74,7 +74,7 @@
74
74
  background: var(--popover-mobile-background, var(--color-surface-elevated));
75
75
  }
76
76
 
77
- :where([data-plex-layout="phone"]) :where([data-theme="dark"]) .Popover {
77
+ :where([data-theme="dark"]) :where([data-plex-layout="phone"]) .Popover, :where([data-plex-layout="phone"]) :where([data-theme="dark"]) .Popover {
78
78
  backdrop-filter: var(--popover-mobile-backdrop-filter, none);
79
79
  }@keyframes shake {
80
80
  0% {
@@ -501,7 +501,7 @@ background: var(--gray-25);
501
501
  background: var(--menu-mobile-background, var(--color-surface-elevated));
502
502
  }
503
503
 
504
- :where([data-plex-layout="phone"]) :where([data-theme="dark"]) .MenuList {
504
+ :where([data-theme="dark"]) :where([data-plex-layout="phone"]) .MenuList, :where([data-plex-layout="phone"]) :where([data-theme="dark"]) .MenuList {
505
505
  backdrop-filter: var(--menu-mobile-backdrop-filter, none);
506
506
  }
507
507
 
@@ -36,9 +36,12 @@
36
36
  --mobile-knob-lens-shadow: 0 4.5px 8px rgb(0 0 0 / 12%), 0 0 0 0.33px rgb(0 0 0 / 20%), inset 0 0.5px 0 rgb(255 255 255 / 16%), inset 0 -0.5px 0 rgb(255 255 255 / 16%);
37
37
  /* Dark menus and Select lists are glass, as native iOS 26 pop-up menus and popovers are: the glass
38
38
  of the buttons, alpha-12, over a blurred backdrop (iOS2 IMG_5524, 5525, 5528: a sheet of 28 shows at
39
- 56, a card of 44 at 69, a switch behind spreads over about 10pt). Light menus keep the elevated
40
- surface; the blur applies in dark only. */
41
- --menu-mobile-backdrop-filter: blur(10px);
39
+ 56, a card of 44 at 69). The page under it does not read through: the white knob of a switch behind
40
+ the menu (37 by 24pt, IMG_5524) spreads to 55 by 37pt at half its height and keeps a third of its
41
+ strength (IMG_5525), a blur of 18 (14 to 20 by the width, the height and the peak); text under it is
42
+ gone. A blur of 10 left the page's text at 1.5 to 3:1 against its background, readable (plan 176).
43
+ Light menus keep the elevated surface; the blur applies in dark only. */
44
+ --menu-mobile-backdrop-filter: blur(18px);
42
45
  /* A popover takes the material of the menus: iOS 26 presents an action sheet from its source in the same
43
46
  dark glass (iOS2 IMG_5528: a card of 44 under it at 65 to 69, the sheet of 28 at 55). */
44
47
  --popover-mobile-background: var(--menu-mobile-background);
@@ -111,9 +114,12 @@
111
114
  --mobile-knob-lens-shadow: 0 4.5px 8px rgb(0 0 0 / 12%), 0 0 0 0.33px rgb(0 0 0 / 20%), inset 0 0.5px 0 rgb(255 255 255 / 16%), inset 0 -0.5px 0 rgb(255 255 255 / 16%);
112
115
  /* Dark menus and Select lists are glass, as native iOS 26 pop-up menus and popovers are: the glass
113
116
  of the buttons, alpha-12, over a blurred backdrop (iOS2 IMG_5524, 5525, 5528: a sheet of 28 shows at
114
- 56, a card of 44 at 69, a switch behind spreads over about 10pt). Light menus keep the elevated
115
- surface; the blur applies in dark only. */
116
- --menu-mobile-backdrop-filter: blur(10px);
117
+ 56, a card of 44 at 69). The page under it does not read through: the white knob of a switch behind
118
+ the menu (37 by 24pt, IMG_5524) spreads to 55 by 37pt at half its height and keeps a third of its
119
+ strength (IMG_5525), a blur of 18 (14 to 20 by the width, the height and the peak); text under it is
120
+ gone. A blur of 10 left the page's text at 1.5 to 3:1 against its background, readable (plan 176).
121
+ Light menus keep the elevated surface; the blur applies in dark only. */
122
+ --menu-mobile-backdrop-filter: blur(18px);
117
123
  /* A popover takes the material of the menus: iOS 26 presents an action sheet from its source in the same
118
124
  dark glass (iOS2 IMG_5528: a card of 44 under it at 65 to 69, the sheet of 28 at 55). */
119
125
  --popover-mobile-background: var(--menu-mobile-background);
@@ -74,7 +74,7 @@
74
74
  --mobile-knob-lens-scale: calc(58 / 38) calc(38 / 24);
75
75
  --mobile-knob-lens-background: rgb(255 255 255 / 9%);
76
76
  --mobile-knob-lens-shadow: 0 4.5px 8px rgb(0 0 0 / 12%), 0 0 0 0.33px rgb(0 0 0 / 20%), inset 0 0.5px 0 rgb(255 255 255 / 16%), inset 0 -0.5px 0 rgb(255 255 255 / 16%);
77
- --menu-mobile-backdrop-filter: blur(10px);
77
+ --menu-mobile-backdrop-filter: blur(18px);
78
78
  --popover-mobile-background: var(--menu-mobile-background);
79
79
  --popover-mobile-backdrop-filter: var(--menu-mobile-backdrop-filter);
80
80
  --dialog-alert-backdrop-filter: blur(10px);
@@ -114,7 +114,7 @@
114
114
  --mobile-knob-lens-scale: calc(58 / 38) calc(38 / 24);
115
115
  --mobile-knob-lens-background: rgb(255 255 255 / 9%);
116
116
  --mobile-knob-lens-shadow: 0 4.5px 8px rgb(0 0 0 / 12%), 0 0 0 0.33px rgb(0 0 0 / 20%), inset 0 0.5px 0 rgb(255 255 255 / 16%), inset 0 -0.5px 0 rgb(255 255 255 / 16%);
117
- --menu-mobile-backdrop-filter: blur(10px);
117
+ --menu-mobile-backdrop-filter: blur(18px);
118
118
  --popover-mobile-background: var(--menu-mobile-background);
119
119
  --popover-mobile-backdrop-filter: var(--menu-mobile-backdrop-filter);
120
120
  --dialog-alert-backdrop-filter: blur(10px);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexui/styles",
3
- "version": "0.1.35",
3
+ "version": "0.1.36",
4
4
  "description": "Framework-agnostic CSS for Plex UI: design tokens, globals and component styles",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -15,6 +15,8 @@ const PHONE_FEATURE = /^\(\s*(?:max-width\s*:\s*767(?:\.98)?px|width\s*<=?\s*767
15
15
  const DESKTOP_FEATURE = /^\(\s*(?:min-width\s*:\s*768px|width\s*>=\s*768px)\s*\)$/i
16
16
  const MEDIA_TYPE = /^(?:only\s+)?(?:screen|all)$/i
17
17
  const ROOT_COMPOUND = /^(?::root|html|body)(?=$|[\s>+~.[:#])((?:\[[^\]]*\]|:[\w-]+(?:\([^)]*\))?|\.[\w-]+)*)/
18
+ // The theme of the light and dark mixins (mixins.mjs), set on the root or on a part of the page
19
+ const THEME_COMPOUND = /^:where\(\[data-theme=(?:"(?:light|dark)"|'(?:light|dark)'|light|dark)\]\)(?=\s)/
18
20
 
19
21
  /** Splits on commas outside parentheses and brackets. */
20
22
  const splitList = (value) => {
@@ -59,7 +61,8 @@ export const isDesktopMedia = (params) =>
59
61
 
60
62
  /**
61
63
  * The selector for elements inside the scope: after a leading `:root`, `html` or `body` (and what it carries), so
62
- * tokens set on the root are set on the scope instead, or before the selector.
64
+ * tokens set on the root are set on the scope instead, or before the selector. A rule of one theme (the dark and
65
+ * light mixins) applies in the scope whether the theme is set outside it, as on the root, or inside it.
63
66
  * @param {string} selector
64
67
  */
65
68
  export const scopeSelector = (selector) => {
@@ -68,6 +71,8 @@ export const scopeSelector = (selector) => {
68
71
  const rest = selector.slice(root[0].length).trim()
69
72
  return `${root[0]} :where(${PHONE_SCOPE})${rest ? ` ${rest}` : ""}`
70
73
  }
74
+ const theme = THEME_COMPOUND.exec(selector)
75
+ if (theme) return `${theme[0]} :where(${PHONE_SCOPE}) ${selector.slice(theme[0].length).trim()}, :where(${PHONE_SCOPE}) ${selector}`
71
76
  return `:where(${PHONE_SCOPE}) ${selector}`
72
77
  }
73
78