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

@sanity/schema

Package Overview
Dependencies
Maintainers
7
Versions
1385
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sanity/schema - npm Package Compare versions

Comparing version 0.112.0 to 0.113.0-alpha.f6d0f98d

4

lib/ordering/guessOrderingConfig.js

@@ -33,6 +33,6 @@ 'use strict';

});
}
});
// None of the candidates were found, fallback to all fields
);if (candidates.length === 0) {
if (candidates.length === 0) {
candidates = objectTypeDef.fields.filter(isPrimitive).map(function (field) {

@@ -39,0 +39,0 @@ return field.name;

@@ -51,6 +51,6 @@ 'use strict';

return field.name;
}
});
// Check if we have fields with names that is listed in candidate fields
);var titleField = TITLE_CANDIDATES.find(function (candidate) {
var titleField = TITLE_CANDIDATES.find(function (candidate) {
return stringFieldNames.includes(candidate);

@@ -57,0 +57,0 @@ });

@@ -89,4 +89,3 @@ 'use strict';

return TypeOfTypeOfPerson.extend({ name: 'lol', of: [] });
}, /Cannot override `of` property of subtypes of "array"/
// console.log('TypeOfTypeOfPerson', TypeOfTypeOfPerson.get())
);
}, /Cannot override `of` property of subtypes of "array"/);
// console.log('TypeOfTypeOfPerson', TypeOfTypeOfPerson.get())

@@ -47,8 +47,8 @@ 'use strict';

var span = subTypeDef.span,
var marks = subTypeDef.marks,
styles = subTypeDef.styles,
lists = subTypeDef.lists,
rest = _objectWithoutProperties(subTypeDef, ['span', 'styles', 'lists']);
rest = _objectWithoutProperties(subTypeDef, ['marks', 'styles', 'lists']);
var spansField = createSpansField(span);
var spansField = createSpansField(marks);
var stylesField = createStylesField(styles);

@@ -116,11 +116,11 @@ var listsField = createListsField(lists);

function createMarksField(marks) {
function createDecoratorField(decorators) {
return {
name: 'marks',
name: 'decorators',
type: 'array',
title: 'Marks',
title: 'Decorators',
of: [{ type: 'string' }],
options: {
direction: 'vertical',
list: marks || _defaults2.DEFAULT_MARKS
list: decorators || _defaults2.DEFAULT_DECORATORS
}

@@ -141,17 +141,5 @@ };

var DEFAULT_FIELDS = [_defaults.DEFAULT_LINK_FIELD];
var DEFAULT_ANNOTATIONS = [_defaults.DEFAULT_LINK_ANNOTATION];
function ensureTextField(fields) {
return fields.some(function (style) {
return style.value === 'text';
}) ? fields : [_defaults.DEFAULT_TEXT_FIELD].concat(_toConsumableArray(fields));
}
function createSpansField() {
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var marksField = createMarksField(config.marks);
var fields = [marksField].concat(_toConsumableArray(config.fields ? config.fields : DEFAULT_FIELDS));
function createSpansField(marks) {
return {

@@ -163,5 +151,7 @@ name: 'spans',

type: 'span',
fields: ensureTextField(fields)
fields: [_defaults.DEFAULT_TEXT_FIELD, _defaults.DEFAULT_MARKS_FIELD],
annotations: marks && marks.annotations ? marks.annotations : DEFAULT_ANNOTATIONS,
decorators: marks && marks.decorators ? marks.decorators : _defaults2.DEFAULT_DECORATORS
}]
};
}

@@ -6,10 +6,3 @@ 'use strict';

});
// todo:
var DEFAULT_INDENTATION_FIELD = { // eslint-disable-line no-console
name: 'indentation',
title: 'Indentation',
type: 'number'
};
var DEFAULT_LINK_FIELD = exports.DEFAULT_LINK_FIELD = {
var DEFAULT_LINK_ANNOTATION = exports.DEFAULT_LINK_ANNOTATION = {
type: 'object',

@@ -30,2 +23,9 @@ name: 'link',

var DEFAULT_MARKS_FIELD = exports.DEFAULT_MARKS_FIELD = {
name: 'marks',
type: 'array',
of: [{ type: 'string' }],
title: 'Marks'
};
var LIST_TYPES = exports.LIST_TYPES = {

@@ -51,16 +51,16 @@ bullet: { title: 'Bullet', value: 'bullet' },

var MARK_STRONG = exports.MARK_STRONG = { title: 'Strong', value: 'strong' };
var MARK_EMPHASIS = exports.MARK_EMPHASIS = { title: 'Emphasis', value: 'em' };
var MARK_CODE = exports.MARK_CODE = { title: 'Code', value: 'code' };
var MARK_UNDERLINE = exports.MARK_UNDERLINE = { title: 'Underline', value: 'underline' };
var MARK_STRIKE = exports.MARK_STRIKE = { title: 'Strike', value: 'strike-through' };
var DECORATOR_STRONG = exports.DECORATOR_STRONG = { title: 'Strong', value: 'strong' };
var DECORATOR_EMPHASIS = exports.DECORATOR_EMPHASIS = { title: 'Emphasis', value: 'em' };
var DECORATOR_CODE = exports.DECORATOR_CODE = { title: 'Code', value: 'code' };
var DECORATOR_UNDERLINE = exports.DECORATOR_UNDERLINE = { title: 'Underline', value: 'underline' };
var DECORATOR_STRIKE = exports.DECORATOR_STRIKE = { title: 'Strike', value: 'strike-through' };
var MARKS = exports.MARKS = {
strong: MARK_STRONG,
em: MARK_EMPHASIS,
code: MARK_CODE,
underline: MARK_UNDERLINE,
strikeThrough: MARK_STRIKE
var DECORATORS = exports.DECORATORS = {
strong: DECORATOR_STRONG,
em: DECORATOR_EMPHASIS,
code: DECORATOR_CODE,
underline: DECORATOR_UNDERLINE,
strikeThrough: DECORATOR_STRIKE
};
var DEFAULT_MARKS = exports.DEFAULT_MARKS = [MARKS.strong, MARKS.em, MARKS.code, MARKS.underline, MARKS.strikeThrough];
var DEFAULT_DECORATORS = exports.DEFAULT_DECORATORS = [DECORATORS.strong, DECORATORS.em, DECORATORS.code, DECORATORS.underline, DECORATORS.strikeThrough];

@@ -41,4 +41,10 @@ 'use strict';

var fields = subTypeDef.fields || [];
var _subTypeDef$fields = subTypeDef.fields,
fields = _subTypeDef$fields === undefined ? [] : _subTypeDef$fields,
_subTypeDef$annotatio = subTypeDef.annotations,
annotations = _subTypeDef$annotatio === undefined ? [] : _subTypeDef$annotatio,
_subTypeDef$marks = subTypeDef.marks,
marks = _subTypeDef$marks === undefined ? [] : _subTypeDef$marks;
var parsed = Object.assign((0, _pick3.default)(SPAN_CORE, INHERITED_FIELDS), subTypeDef, {

@@ -61,2 +67,9 @@ type: SPAN_CORE,

(0, _utils.lazyGetter)(parsed, 'annotations', function () {
return annotations.map(extendMember);
});
(0, _utils.lazyGetter)(parsed, 'marks', function () {
return marks.map(extendMember);
});
(0, _utils.lazyGetter)(parsed, 'preview', (0, _createPreviewGetter2.default)(subTypeDef));

@@ -63,0 +76,0 @@

@@ -43,11 +43,2 @@ 'use strict';

var _date = require('./date');
Object.defineProperty(exports, 'date', {
enumerable: true,
get: function get() {
return _date.DateType;
}
});
var _url = require('./url');

@@ -54,0 +45,0 @@

@@ -128,5 +128,5 @@ 'use strict';

}
fieldset.fields.push(field
fieldset.fields.push(field);
// Return the fieldset if its the first time we encounter a field in this fieldset
);return fieldset.fields.length === 1 ? fieldset : null;
return fieldset.fields.length === 1 ? fieldset : null;
}

@@ -133,0 +133,0 @@ return { single: true, field: field };

{
"name": "@sanity/schema",
"version": "0.112.0",
"version": "0.113.0-alpha.f6d0f98d",
"description": "",

@@ -17,4 +17,4 @@ "main": "lib/index.js",

"@types/node": "6.0.52",
"babel-cli": "^6.24.0",
"babel-eslint": "^7.2.1",
"babel-cli": "^6.24.1",
"babel-eslint": "^7.2.3",
"babel-plugin-lodash": "^3.2.11",

@@ -24,9 +24,9 @@ "babel-plugin-syntax-class-properties": "^6.13.0",

"babel-plugin-syntax-object-rest-spread": "^6.13.0",
"babel-plugin-transform-class-properties": "^6.23.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-flow-comments": "^6.22.0",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-preset-es2015": "^6.24.0",
"eslint": "^3.19.0",
"eslint-config-sanity": "^2.1.4",
"eslint-plugin-import": "^2.2.0",
"babel-preset-es2015": "^6.24.1",
"eslint": "^4.6.1",
"eslint-config-sanity": "^3.0.1",
"eslint-plugin-import": "^2.3.0",
"interop-require": "^1.0.0",

@@ -33,0 +33,0 @@ "recursive-readdir": "^2.1.0",

Sorry, the diff of this file is not supported yet

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