@wix/zero-config-implementation 1.74.0 → 1.76.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.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { B as t, D as e, E as o, I as n, N as c, P as l, R as i, a as p, V as E, b as m, c as x, d as f, e as d, f as u, h as C, i as I, j as k, k as y, l as A, m as D, n as P, o as R, p as h, q as B, r as M, s as T, t as b, w } from "./index-FEhWzHzO.js";
1
+ import { B as t, D as e, E as o, I as n, N as c, P as l, R as i, a as p, V as E, b as m, c as x, d as f, e as d, f as u, h as C, i as I, j as k, k as y, l as A, m as D, n as P, o as R, p as h, q as B, r as M, s as T, t as b, w } from "./index-CukAHhd0.js";
2
2
  import "react";
3
3
  export {
4
4
  t as BaseError,
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "registry": "https://registry.npmjs.org/",
5
5
  "access": "public"
6
6
  },
7
- "version": "1.74.0",
7
+ "version": "1.76.0",
8
8
  "description": "Core library for extracting component manifests from JS and CSS files",
9
9
  "type": "module",
10
10
  "main": "dist/index.js",
@@ -40,8 +40,7 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@wix/builder-services-wrapper": "^1.42.0",
43
- "@wix/react-component-schema": "1.7.0",
44
- "import-meta-resolve": "^4.2.0"
43
+ "@wix/react-component-schema": "1.7.0"
45
44
  },
46
45
  "devDependencies": {
47
46
  "@faker-js/faker": "^10.2.0",
@@ -57,6 +56,7 @@
57
56
  "modern-errors-cli": "^6.0.0",
58
57
  "neverthrow": "^8.2.0",
59
58
  "parse5": "^7.1.2",
59
+ "import-meta-resolve": "^4.2.0",
60
60
  "react-docgen-typescript": "^2.4.0",
61
61
  "sass": "^1.98.0",
62
62
  "tsconfck": "^3.1.6",
@@ -82,5 +82,5 @@
82
82
  ]
83
83
  }
84
84
  },
85
- "falconPackageHash": "9af6c0faf11670fde2ed8a2ae3c7eac531b2a4a90069d9192b84da4d"
85
+ "falconPackageHash": "961c9ff14e1a1aaf443e4e28497e18b4774e7858411e613df8e151d3"
86
86
  }
@@ -87,27 +87,38 @@ describe('buildDataItem — container dataType', () => {
87
87
  resolvedType,
88
88
  })
89
89
 
90
- it('maps a React `ReactNode` semantic type to dataType container', () => {
90
+ const expectedContainerData = {
91
+ containerType: 'simple',
92
+ simple: {
93
+ behaviors: { selectable: true },
94
+ layout: { containerResizeDirection: 'vertical', height: 240 },
95
+ },
96
+ }
97
+
98
+ it('maps a React `ReactNode` semantic type to dataType container with placeholder container data', () => {
91
99
  const result = buildDataItem(
92
100
  buildProp('content', 'ReactNode', { kind: 'semantic', value: 'ReactNode', source: '@types/react' }),
93
101
  )
94
102
  expect(result.isOk()).toBe(true)
95
103
  expect(result._unsafeUnwrap().dataType).toBe('container')
104
+ expect(result._unsafeUnwrap().container).toEqual(expectedContainerData)
96
105
  })
97
106
 
98
- it('maps a React `ReactElement` semantic type to dataType container', () => {
107
+ it('maps a React `ReactElement` semantic type to dataType container with placeholder container data', () => {
99
108
  const result = buildDataItem(
100
109
  buildProp('icon', 'ReactElement', { kind: 'semantic', value: 'ReactElement', source: 'react' }),
101
110
  )
102
111
  expect(result.isOk()).toBe(true)
103
112
  expect(result._unsafeUnwrap().dataType).toBe('container')
113
+ expect(result._unsafeUnwrap().container).toEqual(expectedContainerData)
104
114
  })
105
115
 
106
- it('maps a Wix `Container` semantic type to dataType container', () => {
116
+ it('maps a Wix `Container` semantic type to dataType container with placeholder container data', () => {
107
117
  const result = buildDataItem(
108
118
  buildProp('children', 'Container', { kind: 'semantic', value: 'Container', source: '@wix/editor-react-types' }),
109
119
  )
110
120
  expect(result.isOk()).toBe(true)
111
121
  expect(result._unsafeUnwrap().dataType).toBe('container')
122
+ expect(result._unsafeUnwrap().container).toEqual(expectedContainerData)
112
123
  })
113
124
  })
@@ -13,7 +13,7 @@
13
13
  */
14
14
 
15
15
  import type { DataItem, DomEvent } from '@wix/react-component-schema'
16
- import { DATA, DOM_EVENT, MEDIA } from '@wix/react-component-schema'
16
+ import { CONTAINER_TYPE, DATA, DOM_EVENT, LAYOUT, MEDIA } from '@wix/react-component-schema'
17
17
  import type { Result } from 'neverthrow'
18
18
  import { err, ok } from 'neverthrow'
19
19
  import { ParseError } from '../errors'
@@ -25,6 +25,9 @@ import { formatDisplayName } from './utils'
25
25
 
26
26
  const { DATA_TYPE } = DATA
27
27
 
28
+ // Placeholder height (in pixels) for the static container layout.
29
+ const DEFAULT_CONTAINER_HEIGHT = 240
30
+
28
31
  type ParseErrorInstance = InstanceType<typeof ParseError>
29
32
 
30
33
  function getBindingsForPath(propUsages: TrackingStores['propUsages'], path: string): DOMBinding[] {
@@ -365,6 +368,7 @@ function handleSemanticType({
365
368
  if (source === '@types/react' || source === 'react') {
366
369
  if (semanticValue === 'ReactNode' || semanticValue === 'ReactElement') {
367
370
  dataItem.dataType = DATA_TYPE.container
371
+ dataItem.container = buildSimpleContainerData()
368
372
  } else {
369
373
  dataItem.dataType = DATA_TYPE.text
370
374
  dataItem.text = {}
@@ -491,5 +495,23 @@ function applyDataToBuilderType({
491
495
  attributes: collectUsedA11yAttributes(propUsages, propPath),
492
496
  }
493
497
  break
498
+ case 'container':
499
+ // dataType is already set to `container` by the caller.
500
+ dataItem.container = buildSimpleContainerData()
501
+ break
502
+ }
503
+ }
504
+
505
+ /**
506
+ * Builds the static `container` configuration emitted for every container-typed
507
+ * prop (React `ReactNode`/`ReactElement` and Wix `Container`).
508
+ */
509
+ function buildSimpleContainerData(): NonNullable<DataItem['container']> {
510
+ return {
511
+ containerType: CONTAINER_TYPE.simple,
512
+ simple: {
513
+ behaviors: { selectable: true },
514
+ layout: { containerResizeDirection: LAYOUT.CONTENT_RESIZE_DIRECTION.vertical, height: DEFAULT_CONTAINER_HEIGHT },
515
+ },
494
516
  }
495
517
  }