@stylexjs/stylex 0.2.0-beta.15 → 0.2.0-beta.16

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.
@@ -139,12 +139,12 @@ export type Styles = Readonly<{ [namespace: string]: Style }>;
139
139
  export type Style = Readonly</**
140
140
  * > 95 | export type Style = $ReadOnly<{
141
141
  * | ^
142
- * > 96 | [pseudo: string]: CSSProperties,
143
- * | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
144
- * > 97 | ...CSSProperties,
145
- * | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
142
+ * > 96 | ...CSSProperties,
143
+ * | ^^^^^^^^^^^^^^^^^^^
144
+ * > 97 | [pseudo: string]: CSSProperties,
145
+ * | ^^^^^^^^^^^^^^^^^^^
146
146
  * > 98 | ...
147
- * | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
147
+ * | ^^^^^^^^^^^^^^^^^^^
148
148
  * > 99 | }>;
149
149
  * | ^^ Unsupported feature: Translating "object types with spreads, indexers and/or call properties at the same time" is currently not supported.
150
150
  **/
@@ -93,8 +93,8 @@ export type XStyleWithout<+T: { [string]: void, ... }> = XStyle<
93
93
  export type Styles = $ReadOnly<{ [namespace: string]: Style, ... }>;
94
94
 
95
95
  export type Style = $ReadOnly<{
96
- [pseudo: string]: CSSProperties,
97
96
  ...CSSProperties,
97
+ [pseudo: string]: CSSProperties,
98
98
  ...
99
99
  }>;
100
100
 
@@ -367,6 +367,54 @@ exports[`styles vertical-align: top 1`] = `
367
367
 
368
368
  exports[`unsupported style properties "filter" 1`] = `{}`;
369
369
 
370
+ exports[`unsupported style properties "marginEnd" 1`] = `
371
+ {
372
+ "style": {
373
+ "marginEnd": 10,
374
+ },
375
+ }
376
+ `;
377
+
378
+ exports[`unsupported style properties "marginHorizontal" 1`] = `
379
+ {
380
+ "style": {
381
+ "marginInline": 10,
382
+ },
383
+ }
384
+ `;
385
+
386
+ exports[`unsupported style properties "marginStart" 1`] = `
387
+ {
388
+ "style": {
389
+ "marginStart": 10,
390
+ },
391
+ }
392
+ `;
393
+
394
+ exports[`unsupported style properties "marginVertical" 1`] = `
395
+ {
396
+ "style": {
397
+ "marginBlock": 10,
398
+ },
399
+ }
400
+ `;
401
+
402
+ exports[`unsupported style properties "paddingHorizontal" 1`] = `
403
+ {
404
+ "style": {
405
+ "paddingInline": 10,
406
+ },
407
+ }
408
+ `;
409
+
410
+ exports[`unsupported style properties "paddingVertical" 1`] = `
411
+ {
412
+ "style": {
413
+ "paddingBlock": 10,
414
+ },
415
+ }
416
+ `;
417
+
370
418
  exports[`unsupported style properties "transitionProperty" passthrough 1`] = `
371
419
  {
372
420
  "style": {
@@ -413,9 +413,12 @@ describe('unsupported style properties', () => {
413
413
  beforeEach(() => {
414
414
  jest.spyOn(console, 'error');
415
415
  console.error.mockImplementation(() => {});
416
+ jest.spyOn(console, 'warn');
417
+ console.warn.mockImplementation(() => {});
416
418
  });
417
419
  afterEach(() => {
418
420
  console.error.mockRestore();
421
+ console.warn.mockRestore();
419
422
  });
420
423
  test('"filter"', () => {
421
424
  const {
@@ -428,6 +431,72 @@ describe('unsupported style properties', () => {
428
431
  expect(_stylex.stylex.spread(underTest, mockOptions)).toMatchSnapshot();
429
432
  expect(console.error).toHaveBeenCalled();
430
433
  });
434
+ test('"marginStart"', () => {
435
+ const {
436
+ underTest
437
+ } = _stylex.stylex.create({
438
+ underTest: {
439
+ marginStart: 10
440
+ }
441
+ });
442
+ expect(_stylex.stylex.spread(underTest, mockOptions)).toMatchSnapshot();
443
+ expect(console.warn).not.toHaveBeenCalled();
444
+ });
445
+ test('"marginEnd"', () => {
446
+ const {
447
+ underTest
448
+ } = _stylex.stylex.create({
449
+ underTest: {
450
+ marginEnd: 10
451
+ }
452
+ });
453
+ expect(_stylex.stylex.spread(underTest, mockOptions)).toMatchSnapshot();
454
+ expect(console.warn).not.toHaveBeenCalled();
455
+ });
456
+ test('"marginHorizontal"', () => {
457
+ const {
458
+ underTest
459
+ } = _stylex.stylex.create({
460
+ underTest: {
461
+ marginHorizontal: 10
462
+ }
463
+ });
464
+ expect(_stylex.stylex.spread(underTest, mockOptions)).toMatchSnapshot();
465
+ expect(console.warn).toHaveBeenCalled();
466
+ });
467
+ test('"marginVertical"', () => {
468
+ const {
469
+ underTest
470
+ } = _stylex.stylex.create({
471
+ underTest: {
472
+ marginVertical: 10
473
+ }
474
+ });
475
+ expect(_stylex.stylex.spread(underTest, mockOptions)).toMatchSnapshot();
476
+ expect(console.warn).toHaveBeenCalled();
477
+ });
478
+ test('"paddingHorizontal"', () => {
479
+ const {
480
+ underTest
481
+ } = _stylex.stylex.create({
482
+ underTest: {
483
+ paddingHorizontal: 10
484
+ }
485
+ });
486
+ expect(_stylex.stylex.spread(underTest, mockOptions)).toMatchSnapshot();
487
+ expect(console.warn).toHaveBeenCalled();
488
+ });
489
+ test('"paddingVertical"', () => {
490
+ const {
491
+ underTest
492
+ } = _stylex.stylex.create({
493
+ underTest: {
494
+ paddingVertical: 10
495
+ }
496
+ });
497
+ expect(_stylex.stylex.spread(underTest, mockOptions)).toMatchSnapshot();
498
+ expect(console.warn).toHaveBeenCalled();
499
+ });
431
500
  test('"transitionProperty" passthrough', () => {
432
501
  const {
433
502
  underTest
@@ -8,3 +8,4 @@
8
8
  */
9
9
 
10
10
  export declare function errorMsg(msg: string): void;
11
+ export declare function warnMsg(msg: string): void;
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.errorMsg = errorMsg;
7
+ exports.warnMsg = warnMsg;
7
8
  /**
8
9
  * Copyright (c) Meta Platforms, Inc. and affiliates.
9
10
  *
@@ -15,4 +16,7 @@ exports.errorMsg = errorMsg;
15
16
 
16
17
  function errorMsg(msg) {
17
18
  console.error(`stylex: ${msg}`);
19
+ }
20
+ function warnMsg(msg) {
21
+ console.warn(`stylex: ${msg}`);
18
22
  }
@@ -8,3 +8,5 @@
8
8
  */
9
9
 
10
10
  declare export function errorMsg(msg: string): void;
11
+
12
+ declare export function warnMsg(msg: string): void;
@@ -23,16 +23,16 @@ var _parseShadow = require("./parseShadow");
23
23
  *
24
24
  */
25
25
 
26
- const stylePropertyAllowlistSet = new Set(['alignContent', 'alignItems', 'alignSelf', 'aspectRatio', 'backfaceVisibility', 'backgroundColor', 'borderBlockColor', 'borderBlockStyle', 'borderBlockWidth', 'borderBlockEndColor', 'borderBlockEndStyle', 'borderBlockEndWidth', 'borderBlockStartColor', 'borderBlockStartStyle', 'borderBlockStartWidth', 'borderBottomColor', 'borderBottomLeftRadius', 'borderBottomRightRadius', 'borderBottomStyle', 'borderBottomWidth', 'borderEndEndRadius', 'borderEndStartRadius', 'borderColor', 'borderInlineColor', 'borderInlineStyle', 'borderInlineWidth', 'borderInlineEndColor', 'borderInlineEndStyle', 'borderInlineEndWidth', 'borderInlineStartColor', 'borderInlineStartStyle', 'borderInlineStartWidth', 'borderLeftColor', 'borderLeftStyle', 'borderLeftWidth', 'borderRadius', 'borderRightColor', 'borderRightStyle', 'borderRightWidth', 'borderStartEndRadius', 'borderStartStartRadius', 'borderStyle', 'borderTopColor', 'borderTopLeftRadius', 'borderTopRightRadius', 'borderTopStyle', 'borderTopWidth', 'borderWidth', 'bottom', 'color', 'direction', 'display', 'end', 'flex', 'flexBasis', 'flexDirection', 'flexGrow', 'flexShrink', 'flexWrap', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'fontVariant', 'gap', 'gapColumn', 'gapRow', 'height',
26
+ const stylePropertyAllowlistSet = new Set(['alignContent', 'alignItems', 'alignSelf', 'aspectRatio', 'backfaceVisibility', 'backgroundColor', 'borderBlockColor', 'borderBlockStyle', 'borderBlockWidth', 'borderBlockEndColor', 'borderBlockEndStyle', 'borderBlockEndWidth', 'borderBlockStartColor', 'borderBlockStartStyle', 'borderBlockStartWidth', 'borderBottomColor', 'borderBottomLeftRadius', 'borderBottomRightRadius', 'borderBottomStyle', 'borderBottomWidth', 'borderEndEndRadius', 'borderEndStartRadius', 'borderColor', 'borderInlineColor', 'borderInlineStyle', 'borderInlineWidth', 'borderInlineEndColor', 'borderInlineEndStyle', 'borderInlineEndWidth', 'borderInlineStartColor', 'borderInlineStartStyle', 'borderInlineStartWidth', 'borderEndColor', 'borderEndStyle', 'borderEndWidth', 'borderStartColor', 'borderStartStyle', 'borderStartWidth', 'borderLeftColor', 'borderLeftStyle', 'borderLeftWidth', 'borderRadius', 'borderRightColor', 'borderRightStyle', 'borderRightWidth', 'borderStartEndRadius', 'borderStartStartRadius', 'borderStyle', 'borderTopColor', 'borderTopLeftRadius', 'borderTopRightRadius', 'borderTopStyle', 'borderTopWidth', 'borderWidth', 'bottom', 'color', 'direction', 'display', 'end', 'flex', 'flexBasis', 'flexDirection', 'flexGrow', 'flexShrink', 'flexWrap', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'fontVariant', 'gap', 'gapColumn', 'gapRow', 'height',
27
27
  // 'includeFontPadding', Android Only
28
- 'inset', 'insetBlock', 'insetBlockEnd', 'insetBlockStart', 'insetInline', 'insetInlineEnd', 'insetInlineStart', 'justifyContent', 'left', 'letterSpacing', 'lineHeight', 'margin', 'marginBlock', 'marginBlockEnd', 'marginBlockStart', 'marginBottom', 'marginInline', 'marginInlineEnd', 'marginInlineStart', 'marginLeft', 'marginRight', 'marginStart', 'marginTop', 'maxHeight', 'maxWidth', 'minHeight', 'minWidth', 'objectFit', 'opacity', 'overflow', 'padding', 'paddingBlock', 'paddingBlockEnd', 'paddingBlockStart', 'paddingBottom', 'paddingEnd', 'paddingInline', 'paddingInlineEnd', 'paddingInlineStart', 'paddingLeft', 'paddingRight', 'paddingStart', 'paddingTop', 'pointerEvents', 'position', 'resizeMode', 'right', 'shadowColor', 'shadowOffset', 'shadowOpacity', 'shadowRadius', 'shadowWidth', 'start', 'textAlign', 'textDecorationLine', 'textDecorationColor',
28
+ 'inset', 'insetBlock', 'insetBlockEnd', 'insetBlockStart', 'insetInline', 'insetInlineEnd', 'insetInlineStart', 'justifyContent', 'left', 'letterSpacing', 'lineHeight', 'margin', 'marginBlock', 'marginBlockEnd', 'marginBlockStart', 'marginBottom', 'marginEnd', 'marginInline', 'marginInlineEnd', 'marginInlineStart', 'marginLeft', 'marginRight', 'marginStart', 'marginTop', 'maxHeight', 'maxWidth', 'minHeight', 'minWidth', 'objectFit', 'opacity', 'overflow', 'padding', 'paddingBlock', 'paddingBlockEnd', 'paddingBlockStart', 'paddingBottom', 'paddingEnd', 'paddingInline', 'paddingInlineEnd', 'paddingInlineStart', 'paddingLeft', 'paddingRight', 'paddingStart', 'paddingTop', 'pointerEvents', 'position', 'resizeMode', 'right', 'shadowColor', 'shadowOffset', 'shadowOpacity', 'shadowRadius', 'shadowWidth', 'start', 'textAlign', 'textDecorationLine', 'textDecorationColor',
29
29
  // iOS Only
30
30
  'textDecorationStyle',
31
31
  // iOS Only
32
32
  'textShadowColor', 'textShadowOffset', 'textShadowRadius', 'textTransform', 'tintColor', 'transform', 'top', 'userSelect', 'verticalAlign',
33
33
  // Android Only
34
- 'width', 'writingDirection',
35
- // iOS Only
34
+ 'width',
35
+ // 'writingDirection', // iOS Only
36
36
  'zIndex']);
37
37
  function isReactNativeStyleProp(propName) {
38
38
  return stylePropertyAllowlistSet.has(propName) || propName.startsWith('--');
@@ -151,6 +151,18 @@ function preprocessCreate(style) {
151
151
  width: offsetX
152
152
  };
153
153
  processedStyle.textShadowRadius = blurRadius;
154
+ } else if (propName === 'marginHorizontal') {
155
+ (0, _errorMsg.warnMsg)('"marginHorizontal" is deprecated. Use "marginInline".');
156
+ processedStyle.marginInline = styleValue;
157
+ } else if (propName === 'marginVertical') {
158
+ (0, _errorMsg.warnMsg)('"marginVertical" is deprecated. Use "marginBlock".');
159
+ processedStyle.marginBlock = styleValue;
160
+ } else if (propName === 'paddingHorizontal') {
161
+ (0, _errorMsg.warnMsg)('"paddingHorizontal" is deprecated. Use "paddingInline".');
162
+ processedStyle.paddingInline = styleValue;
163
+ } else if (propName === 'paddingVertical') {
164
+ (0, _errorMsg.warnMsg)('"paddingVertical" is deprecated. Use "paddingBlock".');
165
+ processedStyle.paddingBlock = styleValue;
154
166
  } else {
155
167
  processedStyle[propName] = styleValue;
156
168
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stylexjs/stylex",
3
- "version": "0.2.0-beta.15",
3
+ "version": "0.2.0-beta.16",
4
4
  "description": "A library for defining styles for optimized user interfaces.",
5
5
  "main": "lib/stylex.js",
6
6
  "react-native": "lib/native/stylex.js",
@@ -20,7 +20,7 @@
20
20
  "utility-types": "^3.10.0"
21
21
  },
22
22
  "devDependencies": {
23
- "@stylexjs/scripts": "0.2.0-beta.15"
23
+ "@stylexjs/scripts": "0.2.0-beta.16"
24
24
  },
25
25
  "jest": {},
26
26
  "files": [