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

@vonage/vvd-core

Package Overview
Dependencies
Maintainers
14
Versions
126
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vonage/vvd-core - npm Package Compare versions

Comparing version 0.15.0 to 0.15.1

9

CHANGELOG.md

@@ -0,1 +1,10 @@

## [0.15.1](https://github.com/vonage/vivid/compare/v0.15.0...v0.15.1) (2020-11-09)
### Features
* iss 398/viv 224 core declarative config ([#416](https://github.com/vonage/vivid/issues/416)) ([6228dfe](https://github.com/vonage/vivid/commit/6228dfe9494187b81ae7b073611005e598dc928b)), closes [#398](https://github.com/vonage/vivid/issues/398) [#398](https://github.com/vonage/vivid/issues/398) [#398](https://github.com/vonage/vivid/issues/398) [#398](https://github.com/vonage/vivid/issues/398) [#398](https://github.com/vonage/vivid/issues/398) [#398](https://github.com/vonage/vivid/issues/398) [#398](https://github.com/vonage/vivid/issues/398) [#398](https://github.com/vonage/vivid/issues/398) [#398](https://github.com/vonage/vivid/issues/398) [#398](https://github.com/vonage/vivid/issues/398)
# [0.15.0](https://github.com/vonage/vivid/compare/v0.14.0...v0.15.0) (2020-10-27)

@@ -2,0 +11,0 @@

8

package.json
{
"name": "@vonage/vvd-core",
"version": "0.15.0",
"version": "0.15.1",
"description": "> TODO: description",

@@ -27,7 +27,7 @@ "author": "yinonov <yinon@hotmail.com>",

"dependencies": {
"@vonage/vvd-fonts": "^0.15.0",
"@vonage/vvd-scheme": "^0.15.0",
"@vonage/vvd-fonts": "^0.15.1",
"@vonage/vvd-scheme": "^0.15.1",
"tslib": "^2.0.3"
},
"gitHead": "08d85f2fcdd8c8f1e88406005957bb5ae31f82dd"
"gitHead": "dbdd8832c267aa9da9dcb92f8a951aad1a39c2d8"
}

@@ -1,7 +0,10 @@

import { Configuration } from './vvd-configurer.js';
import { SchemeOption } from '@vonage/vvd-scheme';
export interface Configuration {
scheme?: SchemeOption;
}
declare const _default: Readonly<{
set: typeof applyConfiguration;
settled: Promise<unknown[]>;
set: typeof safeApplyConfiguration;
settled: Promise<Record<string, unknown>>;
}>;
export default _default;
declare function applyConfiguration(configuration: Partial<Configuration>): Promise<unknown[]>;
declare function safeApplyConfiguration(configuration: Partial<Configuration>): Promise<Record<string, unknown>>;

@@ -1,22 +0,67 @@

import configurer from './vvd-configurer.js';
import fonts from '@vonage/vvd-fonts/vvd-fonts.js';
import schemeService from '@vonage/vvd-scheme';
const VVD_CONTEXT_ATTRIBUTE = 'data-vvd-context', NONE_INIT_VALUE = 'none', VALID_CONFIGURATION_KEYS = ['scheme'];
let coreAutoInitDone;
if (configurer.initialConfiguration.autoInit) {
coreAutoInitDone = applyConfiguration(configurer.initialConfiguration);
const initialConfiguration = _buildConfiguration();
if (initialConfiguration.autoInit) {
coreAutoInitDone = _applyConfiguration(initialConfiguration);
}
else {
coreAutoInitDone = Promise.reject('auto-init unavailable when "none" used');
coreAutoInitDone = Promise.reject(`auto-init unavailable when '${NONE_INIT_VALUE}' used`);
}
export default Object.freeze({
set: applyConfiguration,
set: safeApplyConfiguration,
settled: coreAutoInitDone,
});
async function applyConfiguration(configuration) {
configurer.validateConfiguration(configuration);
return init(configuration);
async function safeApplyConfiguration(configuration) {
_validateConfiguration(configuration);
return _applyConfiguration(configuration);
}
async function init(configuration) {
return Promise.all([fonts.init(), schemeService.set(configuration.scheme)]);
async function _applyConfiguration(configuration) {
const allResults = await Promise.all([
fonts.init(),
schemeService.set(configuration.scheme),
]);
return Object.freeze({
fonts: allResults[0],
scheme: allResults[1],
});
}
function _buildConfiguration() {
const result = {
autoInit: true,
};
const vvdContextAttrValue = document.documentElement.getAttribute(VVD_CONTEXT_ATTRIBUTE);
if (vvdContextAttrValue === NONE_INIT_VALUE) {
result.autoInit = false;
}
else if (vvdContextAttrValue) {
const parsed = _parseVvdContextAttr(vvdContextAttrValue);
Object.assign(result, parsed);
}
return result;
}
function _validateConfiguration(configuration) {
const extraParams = Object.keys(configuration).filter((k) => !VALID_CONFIGURATION_KEYS.includes(k));
if (extraParams.length) {
console.warn(`unexpected configuration part/s '${extraParams}', only some of '${VALID_CONFIGURATION_KEYS}' expected`);
}
}
function _parseVvdContextAttr(value) {
const tokens = value.trim().split(/\s+/);
return tokens.reduce((result, token) => {
if (/^theme:/.test(token)) {
if (result.scheme) {
console.error(`theme vivid context defined multiple times, only the first (${result.scheme}) will be effective`);
}
else {
result.scheme = token.replace(/^theme:/, '');
}
}
else {
console.warn(`unsupported token '${token}' in vivid context`);
}
return result;
}, {});
}
//# sourceMappingURL=vvd-core.js.map

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