Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@json-layout/core

Package Overview
Dependencies
Maintainers
0
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@json-layout/core - npm Package Compare versions

Comparing version 0.35.0 to 1.0.0

4

package.json
{
"name": "@json-layout/core",
"version": "0.35.0",
"version": "1.0.0",
"description": "Compilation and state management utilities for JSON Layout.",

@@ -62,3 +62,3 @@ "type": "module",

"dependencies": {
"@json-layout/vocabulary": "^0.23.2",
"@json-layout/vocabulary": "^1.0.0",
"ajv": "^8.12.0",

@@ -65,0 +65,0 @@ "ajv-errors": "^3.0.0",

// import Debug from 'debug'
import { normalizeLayoutFragment, isSwitchStruct, isGetItemsExpression, isGetItemsFetch, isItemsLayout, getSchemaFragmentType, isCompositeLayout } from '@json-layout/vocabulary'
import { normalizeLayoutFragment, isSwitchStruct, isGetItemsExpression, isGetItemsFetch, isItemsLayout, getSchemaFragmentType, isCompositeLayout, childIsCompObject } from '@json-layout/vocabulary'
import { makeSkeletonTree } from './skeleton-tree.js'

@@ -95,5 +95,19 @@ import { partialResolveRefs } from './utils/resolve-refs.js'

/**
* @param {import('@json-layout/vocabulary').Child} child
*/
const prepareLayoutChild = (child) => {
if (child.if) pushExpression(expressions, child.if)
if (childIsCompObject(child)) {
for (const grandChild of child.children) prepareLayoutChild(grandChild)
}
}
const compObjects = isSwitchStruct(normalizedLayout) ? normalizedLayout.switch : [normalizedLayout]
for (const compObject of compObjects) {
if (compObject.if) pushExpression(expressions, compObject.if)
if (isCompositeLayout(compObject, options.components)) {
for (const child of compObject.children) prepareLayoutChild(child)
}

@@ -100,0 +114,0 @@ if (schema.const !== undefined && compObject.constData === undefined) compObject.constData = schema.const

@@ -245,2 +245,3 @@ import { isSwitchStruct, childIsCompObject, isCompositeLayout, isFocusableLayout, isItemsLayout, isGetItemsExpression, isGetItemsFetch, isListLayout } from '@json-layout/vocabulary'

* @param {import('@json-layout/vocabulary').NormalizedLayout} normalizedLayout
* @param {import('@json-layout/vocabulary').Child | null} childDefinition
* @param {import('./types.js').StateNodeOptions} options

@@ -254,3 +255,3 @@ * @param {import('../index.js').CompiledLayout} compiledLayout

*/
const getCompObject = (normalizedLayout, options, compiledLayout, display, data, rootData, parentContext) => {
const getCompObject = (normalizedLayout, childDefinition, options, compiledLayout, display, data, rootData, parentContext) => {
if (isSwitchStruct(normalizedLayout)) {

@@ -263,9 +264,9 @@ for (const compObject of normalizedLayout.switch) {

} else {
if (normalizedLayout.if) {
if (evalExpression(compiledLayout.expressions, normalizedLayout.if, data, options, display, normalizedLayout, compiledLayout.validates, rootData, parentContext)) {
return normalizedLayout
}
} else {
return normalizedLayout
if (childDefinition?.if && !evalExpression(compiledLayout.expressions, childDefinition.if, data, options, display, normalizedLayout, compiledLayout.validates, rootData, parentContext)) {
return { comp: 'none' }
}
if (normalizedLayout.if && !evalExpression(compiledLayout.expressions, normalizedLayout.if, data, options, display, normalizedLayout, compiledLayout.validates, rootData, parentContext)) {
return { comp: 'none' }
}
return normalizedLayout
}

@@ -353,3 +354,3 @@ return { comp: 'none' }

: compiledLayout.normalizedLayouts[skeleton.pointer]
const layout = getCompObject(normalizedLayout, parentOptions, compiledLayout, parentDisplay, data, context.rootData, parentContext)
const layout = getCompObject(normalizedLayout, childDefinition, parentOptions, compiledLayout, parentDisplay, data, context.rootData, parentContext)
const [display, cols] = getChildDisplay(parentDisplay, childDefinition?.cols ?? layout.cols)

@@ -356,0 +357,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc