@vonage/vvd-context
Advanced tools
Comparing version 0.17.2 to 0.18.0
@@ -0,1 +1,17 @@ | ||
# Change Log | ||
All notable changes to this project will be documented in this file. | ||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. | ||
# [0.18.0](https://github.com/vonage/vivid/compare/v0.17.2...v0.18.0) (2021-01-01) | ||
### Features | ||
* iss 520/viv 212 headers elements ([#524](https://github.com/vonage/vivid/issues/524)) ([20eaa8c](https://github.com/vonage/vivid/commit/20eaa8c26b3771b226d0478eccfdac23e8a3a3b0)), closes [#520](https://github.com/vonage/vivid/issues/520) [#520](https://github.com/vonage/vivid/issues/520) [#520](https://github.com/vonage/vivid/issues/520) [#520](https://github.com/vonage/vivid/issues/520) [#520](https://github.com/vonage/vivid/issues/520) [#520](https://github.com/vonage/vivid/issues/520) [#520](https://github.com/vonage/vivid/issues/520) [#520](https://github.com/vonage/vivid/issues/520) [#520](https://github.com/vonage/vivid/issues/520) | ||
## [0.17.2](https://github.com/vonage/vivid/compare/v0.17.1...v0.17.2) (2020-12-17) | ||
@@ -98,4 +114,1 @@ | ||
# [0.10.0](https://github.com/vonage/vivid/compare/v0.9.0...v0.10.0) (2020-09-22) | ||
{ | ||
"name": "@vonage/vvd-context", | ||
"version": "0.17.2", | ||
"version": "0.18.0", | ||
"description": "> TODO: description", | ||
"homepage": "https://github.com/Vonage/vivid/tree/master/components/context#readme", | ||
"license": "ISC", | ||
"type": "module", | ||
"main": "vvd-context.js", | ||
@@ -27,3 +28,3 @@ "module": "vvd-context.js", | ||
"dependencies": { | ||
"@vonage/vvd-core": "^0.17.2", | ||
"@vonage/vvd-core": "^0.18.0", | ||
"lit-element": "^2.4.0", | ||
@@ -33,7 +34,7 @@ "tslib": "^2.0.3" | ||
"devDependencies": { | ||
"@vonage/vvd-design-tokens": "^0.17.2", | ||
"@vonage/vvd-foundation": "^0.17.2", | ||
"@vonage/vvd-typography": "^0.17.2" | ||
"@vonage/vvd-design-tokens": "^0.18.0", | ||
"@vonage/vvd-foundation": "^0.18.0", | ||
"@vonage/vvd-typography": "^0.18.0" | ||
}, | ||
"gitHead": "f0c1b7cd302d70dfaaccc3b8d7ea18ddb696bb0e" | ||
"gitHead": "e65e9327cb0aac0ed1b8c8b6281a63dd643d65c5" | ||
} |
import { css } from 'lit-element'; | ||
export const style = css `body{--vvd-typography-font-family: SpeziaWebVariable;--vvd-typography-font-size: 16px;--vvd-typography-font-stretch: 50%;--vvd-typography-font-weight: 400;--vvd-typography-letter-spacing: 0px;--vvd-typography-line-height: 24px;--vvd-typography-text-decoration: none;--vvd-typography-text-transform: none;font-family:var(--vvd-typography-font-family);font-size:var(--vvd-typography-font-size);font-stretch:var(--vvd-typography-font-stretch);font-weight:var(--vvd-typography-font-weight);letter-spacing:var(--vvd-typography-letter-spacing);line-height:var(--vvd-typography-line-height);text-decoration:var(--vvd-typography-text-decoration);text-transform:var(--vvd-typography-text-transform)}@supports(font-size-adjust: 1){body{font-size-adjust:.5}}b,strong{--vvd-typography-font-family: SpeziaWebVariable;--vvd-typography-font-size: 16px;--vvd-typography-font-stretch: 50%;--vvd-typography-font-weight: 600;--vvd-typography-letter-spacing: 0px;--vvd-typography-line-height: 24px;--vvd-typography-text-decoration: none;--vvd-typography-text-transform: none;font-family:var(--vvd-typography-font-family);font-size:var(--vvd-typography-font-size);font-stretch:var(--vvd-typography-font-stretch);font-weight:var(--vvd-typography-font-weight);letter-spacing:var(--vvd-typography-letter-spacing);line-height:var(--vvd-typography-line-height);text-decoration:var(--vvd-typography-text-decoration);text-transform:var(--vvd-typography-text-transform)}h1{--vvd-typography-font-family: SpeziaWebVariable;--vvd-typography-font-size: 52px;--vvd-typography-font-stretch: 75%;--vvd-typography-font-weight: 500;--vvd-typography-letter-spacing: 0px;--vvd-typography-line-height: 68px;--vvd-typography-text-decoration: none;--vvd-typography-text-transform: none;font-family:var(--vvd-typography-font-family);font-size:var(--vvd-typography-font-size);font-stretch:var(--vvd-typography-font-stretch);font-weight:var(--vvd-typography-font-weight);letter-spacing:var(--vvd-typography-letter-spacing);line-height:var(--vvd-typography-line-height);text-decoration:var(--vvd-typography-text-decoration);text-transform:var(--vvd-typography-text-transform)}h2{--vvd-typography-font-family: SpeziaWebVariable;--vvd-typography-font-size: 40px;--vvd-typography-font-stretch: 75%;--vvd-typography-font-weight: 500;--vvd-typography-letter-spacing: 0px;--vvd-typography-line-height: 52px;--vvd-typography-text-decoration: none;--vvd-typography-text-transform: none;font-family:var(--vvd-typography-font-family);font-size:var(--vvd-typography-font-size);font-stretch:var(--vvd-typography-font-stretch);font-weight:var(--vvd-typography-font-weight);letter-spacing:var(--vvd-typography-letter-spacing);line-height:var(--vvd-typography-line-height);text-decoration:var(--vvd-typography-text-decoration);text-transform:var(--vvd-typography-text-transform)}h3{--vvd-typography-font-family: SpeziaWebVariable;--vvd-typography-font-size: 26px;--vvd-typography-font-stretch: 75%;--vvd-typography-font-weight: 500;--vvd-typography-letter-spacing: 0px;--vvd-typography-line-height: 36px;--vvd-typography-text-decoration: none;--vvd-typography-text-transform: none;font-family:var(--vvd-typography-font-family);font-size:var(--vvd-typography-font-size);font-stretch:var(--vvd-typography-font-stretch);font-weight:var(--vvd-typography-font-weight);letter-spacing:var(--vvd-typography-letter-spacing);line-height:var(--vvd-typography-line-height);text-decoration:var(--vvd-typography-text-decoration);text-transform:var(--vvd-typography-text-transform)}h6{--vvd-typography-font-family: SpeziaWebVariable;--vvd-typography-font-size: 14px;--vvd-typography-font-stretch: 50%;--vvd-typography-font-weight: 400;--vvd-typography-letter-spacing: 0px;--vvd-typography-line-height: 20px;--vvd-typography-text-decoration: none;--vvd-typography-text-transform: none;font-family:var(--vvd-typography-font-family);font-size:var(--vvd-typography-font-size);font-stretch:var(--vvd-typography-font-stretch);font-weight:var(--vvd-typography-font-weight);letter-spacing:var(--vvd-typography-letter-spacing);line-height:var(--vvd-typography-line-height);text-decoration:var(--vvd-typography-text-decoration);text-transform:var(--vvd-typography-text-transform)}p{width:60ch;max-width:100%}code{--vvd-typography-font-family: SpeziaMonoWebVariable;--vvd-typography-font-size: 16px;--vvd-typography-font-stretch: 50%;--vvd-typography-font-weight: 400;--vvd-typography-letter-spacing: 0px;--vvd-typography-line-height: 16px;--vvd-typography-text-decoration: none;--vvd-typography-text-transform: none;font-family:var(--vvd-typography-font-family);font-size:var(--vvd-typography-font-size);font-stretch:var(--vvd-typography-font-stretch);font-weight:var(--vvd-typography-font-weight);letter-spacing:var(--vvd-typography-letter-spacing);line-height:var(--vvd-typography-line-height);text-decoration:var(--vvd-typography-text-decoration);text-transform:var(--vvd-typography-text-transform)}b,strong{--vvd-typography-font-family: SpeziaWebVariable;--vvd-typography-font-size: 16px;--vvd-typography-font-stretch: 50%;--vvd-typography-font-weight: 600;--vvd-typography-letter-spacing: 0px;--vvd-typography-line-height: 24px;--vvd-typography-text-decoration: none;--vvd-typography-text-transform: none;font-family:var(--vvd-typography-font-family);font-size:var(--vvd-typography-font-size);font-stretch:var(--vvd-typography-font-stretch);font-weight:var(--vvd-typography-font-weight);letter-spacing:var(--vvd-typography-letter-spacing);line-height:var(--vvd-typography-line-height);text-decoration:var(--vvd-typography-text-decoration);text-transform:var(--vvd-typography-text-transform)}a{--vvd-typography-font-family: SpeziaWebVariable;--vvd-typography-font-size: 16px;--vvd-typography-font-stretch: 50%;--vvd-typography-font-weight: 400;--vvd-typography-letter-spacing: 0px;--vvd-typography-line-height: 24px;--vvd-typography-text-decoration: underline;--vvd-typography-text-transform: none;font-family:var(--vvd-typography-font-family);font-size:var(--vvd-typography-font-size);font-stretch:var(--vvd-typography-font-stretch);font-weight:var(--vvd-typography-font-weight);letter-spacing:var(--vvd-typography-letter-spacing);line-height:var(--vvd-typography-line-height);text-decoration:var(--vvd-typography-text-decoration);text-transform:var(--vvd-typography-text-transform)}samp,kbd,var{--vvd-typography-font-family: SpeziaMonoWebVariable;--vvd-typography-font-size: 16px;--vvd-typography-font-stretch: 50%;--vvd-typography-font-weight: 400;--vvd-typography-letter-spacing: 0px;--vvd-typography-line-height: 16px;--vvd-typography-text-decoration: none;--vvd-typography-text-transform: none;font-family:var(--vvd-typography-font-family);font-size:var(--vvd-typography-font-size);font-stretch:var(--vvd-typography-font-stretch);font-weight:var(--vvd-typography-font-weight);letter-spacing:var(--vvd-typography-letter-spacing);line-height:var(--vvd-typography-line-height);text-decoration:var(--vvd-typography-text-decoration);text-transform:var(--vvd-typography-text-transform);display:block;border-radius:4px}body{background-color:var(--vvd-color-base);color:var(--vvd-color-on-base)}code{background-color:var(--vvd-color-surface);color:#bb3700}a{color:#871eff}body{margin:0;padding:0}code{padding:3px 4px;border-radius:6px}`; | ||
export const style = css `body{font:400 ultra-condensed 16px / 24px SpeziaWebVariable;letter-spacing:0px;text-decoration:none;text-transform:none}@supports(font-size-adjust: 1){body{font-size-adjust:.5}}h1{font:500 condensed 66px / 88px SpeziaWebVariable;letter-spacing:0px;text-decoration:none;text-transform:none}h2{font:500 condensed 52px / 68px SpeziaWebVariable;letter-spacing:0px;text-decoration:none;text-transform:none}h3{font:500 condensed 40px / 52px SpeziaWebVariable;letter-spacing:0px;text-decoration:none;text-transform:none}h4{font:500 condensed 32px / 44px SpeziaWebVariable;letter-spacing:0px;text-decoration:none;text-transform:none}h5{font:500 condensed 26px / 36px SpeziaWebVariable;letter-spacing:0px;text-decoration:none;text-transform:none}h6{font:500 condensed 20px / 28px SpeziaWebVariable;letter-spacing:0px;text-decoration:none;text-transform:none}p{width:60ch;max-width:100%}code,kbd,samp{font-family:"SpeziaMonoWebVariable",monospace}b,strong{font-weight:600}a{text-decoration:underline}var{font:400 ultra-condensed 16px / 16px SpeziaMonoWebVariable;letter-spacing:0px;text-decoration:none;text-transform:none;display:block;border-radius:4px}body{background-color:var(--vvd-color-base);color:var(--vvd-color-on-base)}code{background-color:var(--vvd-color-surface);color:#bb3700}a{color:#871eff}body{margin:0;padding:0}code{padding:3px 4px;border-radius:6px}`; | ||
//# sourceMappingURL=vvd-context.css.js.map |
import '@vonage/vvd-core'; | ||
declare const _default: { | ||
install: typeof install; | ||
mount: typeof mount; | ||
}; | ||
export default _default; | ||
/** | ||
* installs Vivid context (styles) into the target scope | ||
* mounts Vivid context (styles) into the target scope / document | ||
* - target scope may by any `Document` or `DocumentFragment` (including `ShadowRoot`) | ||
* - default target (when not specified) is the document visible in the current scope | ||
* - the API is idempotent, the style/s will be mounted only once, even if API called multiple times | ||
* | ||
* @param {Document | DocumentFragment} target - target document/shadow root to mount the CSS into | ||
* @throws {Error} error - if the provided target argument is `null` or not a Node of type `Document` / `DocumentFragment` | ||
*/ | ||
declare function install(target?: Document): Promise<void>; | ||
declare function mount(target?: Document | DocumentFragment): Promise<void>; |
import '@vonage/vvd-core'; | ||
export default { | ||
install, | ||
mount, | ||
}; | ||
const CONTEXT_STYLE_IDENTIFIER = 'vivid-context-style'; | ||
const CONTEXT_STYLE_CLASS_IDENTIFIER = 'vivid-context-style'; | ||
let STYLE_FETCHED_PROMISE; | ||
/** | ||
* installs Vivid context (styles) into the target scope | ||
* mounts Vivid context (styles) into the target scope / document | ||
* - target scope may by any `Document` or `DocumentFragment` (including `ShadowRoot`) | ||
* - default target (when not specified) is the document visible in the current scope | ||
* - the API is idempotent, the style/s will be mounted only once, even if API called multiple times | ||
* | ||
* @param {Document | DocumentFragment} target - target document/shadow root to mount the CSS into | ||
* @throws {Error} error - if the provided target argument is `null` or not a Node of type `Document` / `DocumentFragment` | ||
*/ | ||
async function install(target = document) { | ||
var _a; | ||
async function mount(target = document) { | ||
if (!target || | ||
@@ -16,10 +22,27 @@ (target.nodeType !== Node.DOCUMENT_NODE && | ||
} | ||
const { style } = await import('./vvd-context.css'); | ||
let styleElement = target.querySelector(`.${CONTEXT_STYLE_IDENTIFIER}`); | ||
if (!styleElement) { | ||
styleElement = ((_a = target.ownerDocument) !== null && _a !== void 0 ? _a : target).createElement('style'); | ||
const styleElement = await obtainStyleElement(target); | ||
if (!target.querySelector(`.${CONTEXT_STYLE_CLASS_IDENTIFIER}`)) { | ||
if (target.nodeType === Node.DOCUMENT_NODE) { | ||
target.head.appendChild(styleElement); | ||
} | ||
else { | ||
target.appendChild(styleElement); | ||
} | ||
} | ||
styleElement.innerHTML = style.cssText; | ||
(target.head || target).appendChild(styleElement); | ||
} | ||
async function obtainStyleElement(target) { | ||
const styleContent = await obtainStyleContent(); | ||
const styleElement = (target.ownerDocument | ||
? target.ownerDocument | ||
: target).createElement('style'); | ||
styleElement.className = CONTEXT_STYLE_CLASS_IDENTIFIER; | ||
styleElement.innerHTML = styleContent.cssText; | ||
return styleElement; | ||
} | ||
async function obtainStyleContent() { | ||
if (!STYLE_FETCHED_PROMISE) { | ||
STYLE_FETCHED_PROMISE = import('./vvd-context.css.js').then((d) => d.style); | ||
} | ||
return STYLE_FETCHED_PROMISE; | ||
} | ||
//# sourceMappingURL=vvd-context.js.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
10
69
1
46
Yes
28028
+ Added@vonage/vvd-core@0.18.0(transitive)
+ Added@vonage/vvd-fonts@0.18.0(transitive)
+ Added@vonage/vvd-scheme@0.18.0(transitive)
- Removed@vonage/vvd-core@0.17.2(transitive)
- Removed@vonage/vvd-fonts@0.17.2(transitive)
- Removed@vonage/vvd-scheme@0.17.2(transitive)
Updated@vonage/vvd-core@^0.18.0