@multiplatform.one/theme 10.10.2 → 10.10.3

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplatform.one/theme",
3
- "version": "10.10.2",
3
+ "version": "10.10.3",
4
4
  "description": "Tamagui theme system for multiplatform.one",
5
5
  "keywords": [
6
6
  "multiplatform",
@@ -163,8 +163,8 @@
163
163
  "access": "public"
164
164
  },
165
165
  "dependencies": {
166
- "@multiplatform.one/platform": "^10.10.2",
167
- "@multiplatform.one/store": "^10.10.2",
166
+ "@multiplatform.one/platform": "^10.10.3",
167
+ "@multiplatform.one/store": "^10.10.3",
168
168
  "@tamagui/animations-react-native": "3.2.3",
169
169
  "@tamagui/colors": "3.2.3",
170
170
  "@tamagui/config": "3.2.3",
@@ -178,8 +178,8 @@
178
178
  },
179
179
  "devDependencies": {
180
180
  "@expo/prebuild-config": "58.0.19",
181
- "@multiplatform.one/config": "10.10.2",
182
- "@multiplatform.one/test-utils": "10.10.2",
181
+ "@multiplatform.one/config": "10.10.3",
182
+ "@multiplatform.one/test-utils": "10.10.3",
183
183
  "@tamagui/animations-css": "3.2.3",
184
184
  "@tamagui/animations-reanimated": "3.2.3",
185
185
  "@tamagui/build": "3.2.3",
@@ -148,6 +148,17 @@ function enterExitObjects(source: string): string[] {
148
148
  return objects;
149
149
  }
150
150
 
151
+ /**
152
+ * LC-178's one exception: a sheet presents by travelling its whole height
153
+ * from the edge it hangs from. Only these surfaces may write that offset.
154
+ */
155
+ const sheetPresentations = new Set(["components/src/SheetModal/index.tsx"]);
156
+
157
+ function travelsPastGap(file: string, expression: string, source: string, limit: number): boolean {
158
+ if (sheetPresentations.has(file) && /^-?100%$/.test(expression.trim())) return false;
159
+ return numbersIn(expression, source).some((value) => value > limit);
160
+ }
161
+
151
162
  function numbersIn(expression: string, source: string): number[] {
152
163
  const values = [...expression.matchAll(/-?\d+(?:\.\d+)?/g)].map((m) => Math.abs(Number(m[0])));
153
164
  for (const [identifier] of expression.matchAll(/[A-Za-z_$][\w$]*/g)) {
@@ -228,9 +239,10 @@ describe("LC-178 MOTION-CHARACTER: quick in, quicker out, short and still", () =
228
239
  const source = readFileSync(file, "utf8");
229
240
  for (const object of enterExitObjects(source)) {
230
241
  seen += 1;
231
- const where = `${path.relative(publicRoot, file)}: ${object}`;
242
+ const relative = path.relative(publicRoot, file);
243
+ const where = `${relative}: ${object}`;
232
244
  for (const [, axis, expression] of object.matchAll(/\b([xy])\s*:\s*([^,}]+)/g)) {
233
- if (numbersIn(expression, source).some((value) => value > limit)) {
245
+ if (travelsPastGap(relative, expression, source, limit)) {
234
246
  travel.push(`${where} (${axis} past gapLg ${limit})`);
235
247
  }
236
248
  }
@@ -243,4 +255,12 @@ describe("LC-178 MOTION-CHARACTER: quick in, quicker out, short and still", () =
243
255
  expect(travel).toEqual([]);
244
256
  expect(opacity).toEqual([]);
245
257
  });
258
+
259
+ it("lets only a listed sheet surface travel its whole height", () => {
260
+ const limit = GAP_LG_KNOB.gapLg;
261
+ expect(travelsPastGap("components/src/SheetModal/index.tsx", "-100%", "", limit)).toBe(false);
262
+ expect(travelsPastGap("components/src/SheetModal/index.tsx", "-50%", "", limit)).toBe(true);
263
+ expect(travelsPastGap("components/src/Toast/index.tsx", "-100%", "", limit)).toBe(true);
264
+ expect(travelsPastGap("components/src/Toast/index.tsx", "8", "", limit)).toBe(false);
265
+ });
246
266
  });