@json-layout/vocabulary 2.13.1 → 2.13.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 +1 -1
- package/src/normalize.js +13 -2
- package/types/normalize.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@json-layout/vocabulary",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.3",
|
|
4
4
|
"description": "Main JSON Layout vocabulary as JSON schemas and Typescript types. Also contains some small utility functions to validate and normalize annotations.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
package/src/normalize.js
CHANGED
|
@@ -210,7 +210,9 @@ function getPartialCompObject (layoutKeyword) {
|
|
|
210
210
|
*/
|
|
211
211
|
function looksPure (expression) {
|
|
212
212
|
const expr = typeof expression === 'string' ? expression : expression.expr
|
|
213
|
-
|
|
213
|
+
// a cheap text check, so it also lists the optional-chaining and bracket spellings
|
|
214
|
+
return !['rootData.', 'rootData[', 'rootData?.', 'parent.data', 'parent?.data', "parent['data']", 'parent["data"]', 'parent.parent', 'parent?.parent']
|
|
215
|
+
.some((read) => expr.includes(read))
|
|
214
216
|
}
|
|
215
217
|
|
|
216
218
|
/**
|
|
@@ -822,7 +824,16 @@ export function normalizeLayoutFragment (key, schemaFragment, schemaPath, option
|
|
|
822
824
|
errors.push(err.message)
|
|
823
825
|
if (err.cause && Array.isArray(err.cause)) errors.push(...err.cause)
|
|
824
826
|
errors.push('failed to normalize layout, use default component')
|
|
825
|
-
|
|
827
|
+
// Clear the keyword that was actually read, not always `layout`: a oneOf child
|
|
828
|
+
// takes its keyword from `oneOfLayout` and a patternProperties child from
|
|
829
|
+
// `patternPropertiesLayout`, so clearing `layout` left the bad value in place, the
|
|
830
|
+
// retry failed the same way, and the node fell through to comp "none". For a oneOf
|
|
831
|
+
// that is not cosmetic — a variant selector that becomes "none" stops merging its
|
|
832
|
+
// branch into the parent, and the data silently stops matching the state tree.
|
|
833
|
+
const layoutKeyword = schemaChild === 'oneOf'
|
|
834
|
+
? 'oneOfLayout'
|
|
835
|
+
: schemaChild === 'patternProperties' ? 'patternPropertiesLayout' : 'layout'
|
|
836
|
+
const layout = normalizeValidLayoutFragment(key, { ...schemaFragment, [layoutKeyword]: {} }, type, nullable, schemaPath, options, schemaChild)
|
|
826
837
|
return { layout, errors }
|
|
827
838
|
} catch (/** @type {any} */err) {
|
|
828
839
|
errors.push(err.message)
|
package/types/normalize.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../src/normalize.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../src/normalize.js"],"names":[],"mappings":"AAmyBA;;;;;;;;;GASG;AACH,6CATW,MAAM,GAAG,MAAM,kBACf,cAAc,cACd,MAAM,WACL,OAAO,YAAY,EAAE,gBAAgB,gBACtC,OAAO,GAAG,mBAAmB,cAC7B,MAAM,GAAG,SAAS,kBAClB,OAAO,GACL;IAAC,MAAM,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAC,CAiCxD;;;AAvhBM,uDAHI,cAAc,GACZ,CAAC,cAAc,EAAE,MAAM,CAAC,GAAG,SAAS,CA6BhD;AAMM,sDAHI,cAAc,GACZ;IAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAC,CAkCzD;+BA5WY,OAAO,YAAY,EAAE,gBAAgB;gCACrC,OAAO,YAAY,EAAE,iBAAiB;oBACtC,OAAO,YAAY,EAAE,KAAK;uBAC1B,OAAO,YAAY,EAAE,QAAQ;6BAC7B,OAAO,YAAY,EAAE,cAAc;yBACnC,OAAO,YAAY,EAAE,UAAU;+BAC/B,OAAO,YAAY,EAAE,gBAAgB;4BACrC,OAAO,YAAY,EAAE,aAAa;8BAClC,OAAO,YAAY,EAAE,eAAe;gCACpC,OAAO,YAAY,EAAE,iBAAiB;6BACtC,OAAO,YAAY,EAAE,cAAc"}
|