@domicile-desktop/manganese-bar 1.0.0 → 1.1.2

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.
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "dependencies": {
3
- "@domicile-desktop/component-library": "1.0.0",
4
- "@domicile-desktop/manganese-host": "1.0.0",
3
+ "@domicile-desktop/component-library": "2.1.0",
4
+ "@domicile-desktop/manganese-host": "2.0.2",
5
5
  "@pandacss/dev": "^1.12.1",
6
6
  "react": "^19.2.8"
7
7
  },
8
8
  "description": "Manganese's top bar: three columns of items over a scrim, and the context each item reads.",
9
9
  "devDependencies": {
10
10
  "@cprussin/tsconfig": "^5.0.0",
11
- "@domicile-desktop/test-support": "0.0.1",
11
+ "@domicile-desktop/test-support": "0.0.2",
12
12
  "@pandacss/preset-panda": "^1.12.1",
13
13
  "@testing-library/react": "^16.3.3",
14
14
  "@testing-library/user-event": "^14.6.7",
@@ -19,8 +19,7 @@
19
19
  "typescript": "^7.0.2"
20
20
  },
21
21
  "engines": {
22
- "bun": ">=1.4.2",
23
- "node": ">=24"
22
+ "bun": ">=1.4.2"
24
23
  },
25
24
  "exports": {
26
25
  "./bar-context": "./src/bar-context.ts",
@@ -51,5 +50,5 @@
51
50
  "test:unit": "bun test"
52
51
  },
53
52
  "type": "module",
54
- "version": "1.0.0"
53
+ "version": "1.1.2"
55
54
  }
package/src/TopBar.tsx CHANGED
@@ -42,9 +42,13 @@ export const TOP_BAR = 32;
42
42
  */
43
43
  export const TopBar = memo(({ layout }: { layout: BarLayout }) => (
44
44
  <header className={barStyles} style={{ blockSize: `${TOP_BAR}px` }}>
45
- <div className={startStyles}>{fluid(layout.left, "wide", "start")}</div>
46
- <div className={centerStyles}>{fluid(layout.center, "none", "start")}</div>
47
- <div className={endStyles}>{fluid(layout.right, "wide", "end")}</div>
45
+ <div className={startStyles}>
46
+ {fluid(layout.left, "wide", "start", layout.left.length - 1)}
47
+ </div>
48
+ <div className={centerStyles}>
49
+ {fluid(layout.center, "none", "start", undefined)}
50
+ </div>
51
+ <div className={endStyles}>{fluid(layout.right, "wide", "end", 0)}</div>
48
52
  </header>
49
53
  ));
50
54
 
@@ -101,10 +105,22 @@ const centerStyles = css({ justifySelf: "center" });
101
105
  // Most items are 28px buttons around a 15px icon, so icons sit 29px apart.
102
106
  const endStyles = hstack({ gap: 0, justify: "flex-end", marginInline: -2 });
103
107
 
104
- /** `items`, each in a `FluidItem`, keeping their keys. */
105
- const fluid = (items: readonly ReactNode[], gap: Gap, anchor: Anchor) =>
106
- Children.map(items, (item) => (
107
- <FluidItem anchor={anchor} gap={gap}>
108
+ /**
109
+ * `items`, each in a `FluidItem`, keeping their keys. The one at `open`, beside
110
+ * the bar's empty middle, may spill into it while it resizes.
111
+ */
112
+ const fluid = (
113
+ items: readonly ReactNode[],
114
+ gap: Gap,
115
+ anchor: Anchor,
116
+ open: number | undefined,
117
+ ) =>
118
+ Children.map(items, (item, index) => (
119
+ <FluidItem
120
+ anchor={anchor}
121
+ gap={gap}
122
+ overflow={index === open ? "visible" : "clip"}
123
+ >
108
124
  {item}
109
125
  </FluidItem>
110
126
  ));
@@ -3,11 +3,11 @@ import { css } from '../css/index.mjs';
3
3
 
4
4
  const aspectRatioConfig = {
5
5
  transform(props, { map }) {
6
- const { ratio = 4 / 3, ...rest } = props;
6
+ const { ratio = 1.3333333333333333, ...rest } = props;
7
7
  return {
8
8
  position: "relative",
9
9
  _before: {
10
- content: `""`,
10
+ content: '""',
11
11
  display: "block",
12
12
  height: "0",
13
13
  paddingBottom: map(ratio, (r) => `${1 / r * 100}%`)
@@ -3,8 +3,7 @@ import { css } from '../css/index.mjs';
3
3
 
4
4
  const bleedConfig = {
5
5
  transform(props, { map, isCssUnit, isCssVar }) {
6
- const { inline, block, ...rest } = props;
7
- const valueFn = (v) => isCssUnit(v) || isCssVar(v) ? v : `token(spacing.${v}, ${v})`;
6
+ const { inline, block, ...rest } = props, valueFn = (v) => isCssUnit(v) || isCssVar(v) ? v : `token(spacing.${v}, ${v})`;
8
7
  return {
9
8
  "--bleed-x": map(inline, valueFn),
10
9
  "--bleed-y": map(block, valueFn),
@@ -11,28 +11,22 @@ transform(props, { map }) {
11
11
  position: "absolute",
12
12
  insetBlockStart: map(placement, (v) => {
13
13
  const [side] = v.split("-");
14
- const map2 = { top: offsetY, middle: "50%", bottom: "auto" };
15
- return map2[side];
14
+ return { top: offsetY, middle: "50%", bottom: "auto" }[side];
16
15
  }),
17
16
  insetBlockEnd: map(placement, (v) => {
18
17
  const [side] = v.split("-");
19
- const map2 = { top: "auto", middle: "50%", bottom: offsetY };
20
- return map2[side];
18
+ return { top: "auto", middle: "50%", bottom: offsetY }[side];
21
19
  }),
22
20
  insetInlineStart: map(placement, (v) => {
23
21
  const [, align] = v.split("-");
24
- const map2 = { start: offsetX, center: "50%", end: "auto" };
25
- return map2[align];
22
+ return { start: offsetX, center: "50%", end: "auto" }[align];
26
23
  }),
27
24
  insetInlineEnd: map(placement, (v) => {
28
25
  const [, align] = v.split("-");
29
- const map2 = { start: "auto", center: "50%", end: offsetX };
30
- return map2[align];
26
+ return { start: "auto", center: "50%", end: offsetX }[align];
31
27
  }),
32
28
  translate: map(placement, (v) => {
33
- const [side, align] = v.split("-");
34
- const mapX = { start: "-50%", center: "-50%", end: "50%" };
35
- const mapY = { top: "-50%", middle: "-50%", bottom: "50%" };
29
+ const [side, align] = v.split("-"), mapX = { start: "-50%", center: "-50%", end: "50%" }, mapY = { top: "-50%", middle: "-50%", bottom: "50%" };
36
30
  return `${mapX[align]} ${mapY[side]}`;
37
31
  }),
38
32
  ...rest
@@ -3,8 +3,7 @@ import { css } from '../css/index.mjs';
3
3
 
4
4
  const gridItemConfig = {
5
5
  transform(props, { map }) {
6
- const { colSpan, rowSpan, colStart, rowStart, colEnd, rowEnd, ...rest } = props;
7
- const spanFn = (v) => v === "auto" ? v : `span ${v}`;
6
+ const { colSpan, rowSpan, colStart, rowStart, colEnd, rowEnd, ...rest } = props, spanFn = (v) => v === "auto" ? v : `span ${v}`;
8
7
  return {
9
8
  gridColumn: colSpan != null ? map(colSpan, spanFn) : void 0,
10
9
  gridRow: rowSpan != null ? map(rowSpan, spanFn) : void 0,
@@ -3,8 +3,7 @@ import { css } from '../css/index.mjs';
3
3
 
4
4
  const gridConfig = {
5
5
  transform(props, { map, isCssUnit }) {
6
- const { columnGap, rowGap, gap, columns, minChildWidth, ...rest } = props;
7
- const getValue = (v) => isCssUnit(v) ? v : `token(sizes.${v}, ${v})`;
6
+ const { columnGap, rowGap, gap, columns, minChildWidth, ...rest } = props, getValue = (v) => isCssUnit(v) ? v : `token(sizes.${v}, ${v})`;
8
7
  return {
9
8
  display: "grid",
10
9
  gridTemplateColumns: columns != null ? map(columns, (v) => `repeat(${v}, minmax(0, 1fr))`) : minChildWidth != null ? map(minChildWidth, (v) => `repeat(auto-fit, minmax(${getValue(v)}, 1fr))`) : void 0,
@@ -9,7 +9,7 @@ transform(props) {
9
9
  position: "absolute",
10
10
  inset: "0",
11
11
  zIndex: "0",
12
- ...props["_before"]
12
+ ...props._before
13
13
  },
14
14
  ...props
15
15
  };
@@ -8,9 +8,9 @@ transform(props, { map, isCssUnit, isCssVar }) {
8
8
  alignSelf: "stretch",
9
9
  justifySelf: "stretch",
10
10
  flex: map(size, (v) => {
11
- if (v == null) return "1";
12
- const val = isCssUnit(v) || isCssVar(v) ? v : `token(spacing.${v}, ${v})`;
13
- return `0 0 ${val}`;
11
+ if (v == null)
12
+ return "1";
13
+ return `0 0 ${isCssUnit(v) || isCssVar(v) ? v : `token(spacing.${v}, ${v})`}`;
14
14
  }),
15
15
  ...rest
16
16
  };
@@ -4,7 +4,7 @@ import { css } from '../css/index.mjs';
4
4
  const visuallyHiddenConfig = {
5
5
  transform(props) {
6
6
  return {
7
- srOnly: true,
7
+ srOnly: !0,
8
8
  ...props
9
9
  };
10
10
  }}
@@ -169,7 +169,7 @@ export interface UtilityValues {
169
169
  transitionProperty: "common" | "colors" | "size" | "position" | "background";
170
170
  transition: "all" | "common" | "size" | "position" | "background" | "colors" | "opacity" | "shadow" | "transform";
171
171
  animation: Tokens["animations"];
172
- animationName: "bounce" | "iconArcRipple" | "iconArcSearch" | "iconArmReach" | "iconArmSwing" | "iconArrowWind" | "iconBellClapper" | "iconBellNudge" | "iconBellSwing" | "iconBoltStrike" | "iconBubbleTip" | "iconCapsuleBob" | "iconCheckDraw" | "iconCoreIn" | "iconCoreOut" | "iconDotBlink" | "iconDownloadDrop" | "iconGearTurn" | "iconKeyholePulse" | "iconKeyPress" | "iconLineWrite" | "iconMoonIn" | "iconMoonOut" | "iconMoonRock" | "iconPartSpread" | "iconPupilGlance" | "iconRayIn" | "iconRayOut" | "iconRayPulse" | "iconShackleLift" | "iconShackleShut" | "iconTrayGive" | "iconWavePull" | "iconWavePush" | "levelToastEnter" | "levelToastHold" | "levelToastHoldAgain" | "noticeShown" | "ping" | "pulse" | "spin" | "themeSwipeFromBottom" | "themeSwipeFromTop" | "toastCountdown";
172
+ animationName: "bounce" | "iconArcRipple" | "iconArcSearch" | "iconArmReach" | "iconArmSwing" | "iconArrowWind" | "iconBellClapper" | "iconBellNudge" | "iconBellSwing" | "iconBoltStrike" | "iconBubbleTip" | "iconCapsuleBob" | "iconCheckDraw" | "iconCoreIn" | "iconCoreOut" | "iconDotBlink" | "iconDownloadDrop" | "iconGearTurn" | "iconKeyholePulse" | "iconKeyPress" | "iconLineWrite" | "iconMoonIn" | "iconMoonOut" | "iconMoonRock" | "iconPartSpread" | "iconPupilGlance" | "iconRayIn" | "iconRayOut" | "iconRayPulse" | "iconShackleLift" | "iconShackleShut" | "iconSparkleTwinkle" | "iconSparkleWink" | "iconTrayGive" | "iconWavePull" | "iconWavePush" | "levelToastEnter" | "levelToastHold" | "levelToastHoldAgain" | "noticeShown" | "ping" | "pulse" | "spin" | "themeSwipeFromBottom" | "themeSwipeFromTop" | "toastCountdown";
173
173
  animationTimingFunction: Tokens["easings"];
174
174
  animationDuration: Tokens["durations"];
175
175
  animationDelay: Tokens["durations"];