@cord-sdk/components
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -1,2 +0,2 @@ | ||
import { BadgeStyle, JsonValue } from '@cord-sdk/types'; | ||
import type { BadgeStyle, JsonValue } from '@cord-sdk/types'; | ||
export declare const componentNames: { | ||
@@ -20,2 +20,4 @@ readonly 'cord-collaboration': "Collaboration"; | ||
readonly 'show-presence': "boolean"; | ||
readonly 'show-all-activity': "boolean"; | ||
readonly 'exclude-viewer-from-presence': "boolean"; | ||
}; | ||
@@ -53,2 +55,4 @@ readonly MultipleCursors: { | ||
readonly 'show-launcher': "boolean"; | ||
readonly 'show-all-activity': "boolean"; | ||
readonly 'exclude-viewer-from-presence': "boolean"; | ||
}; | ||
@@ -55,0 +59,0 @@ readonly SidebarLauncher: { |
@@ -5,3 +5,3 @@ 'use strict'; | ||
var componentNames = { | ||
const componentNames = { | ||
'cord-collaboration': 'Collaboration', | ||
@@ -17,3 +17,3 @@ 'cord-multiple-cursors': 'MultipleCursors', | ||
}; | ||
var componentAttributes = { | ||
const componentAttributes = { | ||
Collaboration: { | ||
@@ -23,2 +23,4 @@ context: 'json', | ||
'show-presence': 'boolean', | ||
'show-all-activity': 'boolean', | ||
'exclude-viewer-from-presence': 'boolean', | ||
}, | ||
@@ -56,2 +58,4 @@ MultipleCursors: { | ||
'show-launcher': 'boolean', | ||
'show-all-activity': 'boolean', | ||
'exclude-viewer-from-presence': 'boolean', | ||
}, | ||
@@ -72,15 +76,13 @@ SidebarLauncher: { | ||
}; | ||
var enumAttributeConverter = function (possibleValues) { return function (value) { | ||
return value === null | ||
? undefined | ||
: possibleValues.includes(value) | ||
? value | ||
: undefined; | ||
}; }; | ||
var attributeToPropertyConverters = { | ||
json: function (value) { return (value ? JSON.parse(value) : undefined); }, | ||
boolean: function (value) { return value === 'true'; }, | ||
number: function (value) { return (value ? parseInt(value) : undefined); }, | ||
string: function (value) { return value !== null && value !== void 0 ? value : undefined; }, | ||
array: function (value) { return value === null || value === void 0 ? void 0 : value.split(',').filter(function (x) { return x.length > 0; }); }, | ||
const enumAttributeConverter = (possibleValues) => (value) => value === null | ||
? undefined | ||
: possibleValues.includes(value) | ||
? value | ||
: undefined; | ||
const attributeToPropertyConverters = { | ||
json: (value) => (value ? JSON.parse(value) : undefined), | ||
boolean: (value) => value === 'true', | ||
number: (value) => (value ? parseInt(value) : undefined), | ||
string: (value) => value !== null && value !== void 0 ? value : undefined, | ||
array: (value) => value === null || value === void 0 ? void 0 : value.split(',').filter((x) => x.length > 0), | ||
'badge-style': enumAttributeConverter([ | ||
@@ -92,11 +94,9 @@ 'none', | ||
}; | ||
var propertyToAttributeConverters = { | ||
json: function (value) { | ||
return value !== undefined ? JSON.stringify(value) : undefined; | ||
}, | ||
boolean: function (value) { return value === null || value === void 0 ? void 0 : value.toString(); }, | ||
number: function (value) { return value === null || value === void 0 ? void 0 : value.toString(); }, | ||
string: function (value) { return (value === undefined ? undefined : value || ''); }, | ||
array: function (value) { return value === null || value === void 0 ? void 0 : value.join(','); }, | ||
'badge-style': function (value) { return (value === undefined ? undefined : value || ''); }, | ||
const propertyToAttributeConverters = { | ||
json: (value) => value !== undefined ? JSON.stringify(value) : undefined, | ||
boolean: (value) => value === null || value === void 0 ? void 0 : value.toString(), | ||
number: (value) => value === null || value === void 0 ? void 0 : value.toString(), | ||
string: (value) => (value === undefined ? undefined : value || ''), | ||
array: (value) => value === null || value === void 0 ? void 0 : value.join(','), | ||
'badge-style': (value) => (value === undefined ? undefined : value || ''), | ||
}; | ||
@@ -108,8 +108,7 @@ function attributeNameToPropName(attributeName) { | ||
} | ||
var propsToAttributeConverter = function (attributeMetadata) { return function (props) { | ||
var result = {}; | ||
for (var _i = 0, _a = Object.keys(attributeMetadata); _i < _a.length; _i++) { | ||
var key = _a[_i]; | ||
var attributeName = key; | ||
var propName = attributeNameToPropName(attributeName); | ||
const propsToAttributeConverter = (attributeMetadata) => (props) => { | ||
const result = {}; | ||
for (const key of Object.keys(attributeMetadata)) { | ||
const attributeName = key; | ||
const propName = attributeNameToPropName(attributeName); | ||
if (propName in props) { | ||
@@ -120,3 +119,3 @@ result[attributeName] = propertyToAttributeConverters[attributeMetadata[attributeName]](props[propName]); | ||
return result; | ||
}; }; | ||
}; | ||
@@ -123,0 +122,0 @@ exports.attributeNameToPropName = attributeNameToPropName; |
{ | ||
"name": "@cord-sdk/components", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"homepage": "https://docs.cord.com/", | ||
@@ -22,3 +22,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"@cord-sdk/types": "*" | ||
"@cord-sdk/types": "0.0.4" | ||
}, | ||
@@ -25,0 +25,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
314
1
12773
+ Added@cord-sdk/types@0.0.4(transitive)
- Removed@cord-sdk/types@1.47.2(transitive)
Updated@cord-sdk/types@0.0.4