Compare commits

...

3 Commits

Author SHA1 Message Date
github-actions[bot]
08574c9b31 Version Packages 2022-01-05 09:34:58 +01:00
gvangeest
e81b77f236 fix(mdjs-preview): separate preview and viewer theme styling 2022-01-03 18:36:09 +01:00
qa46hx
456b8e78f0 fix(mdjs-preview): add css variable to border-color of viewer 2021-12-05 13:30:28 +01:00
4 changed files with 20 additions and 13 deletions

View File

@@ -1,5 +1,12 @@
# @mdjs/mdjs-preview # @mdjs/mdjs-preview
## 0.5.6
### Patch Changes
- e81b77f: Change theme attribute into preview-theme attribute to separate theme styling of the preview section and the full mdjs viewer.
- 456b8e7: Add css variable to style border-color of the mdjs-viewer
## 0.5.5 ## 0.5.5
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@mdjs/mdjs-preview", "name": "@mdjs/mdjs-preview",
"version": "0.5.5", "version": "0.5.6",
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
}, },

View File

@@ -61,7 +61,7 @@ export class MdJsPreview extends ScopedElementsMixin(LitElement) {
platforms: { type: Array }, platforms: { type: Array },
size: { type: String }, size: { type: String },
sizes: { type: Array }, sizes: { type: Array },
theme: { type: String, reflect: true }, previewTheme: { type: String, reflect: true, attribute: 'preview-theme' },
themes: { type: Array }, themes: { type: Array },
language: { type: String }, language: { type: String },
languages: { type: Array }, languages: { type: Array },
@@ -82,7 +82,7 @@ export class MdJsPreview extends ScopedElementsMixin(LitElement) {
this.__supportsClipboard = 'clipboard' in navigator; this.__supportsClipboard = 'clipboard' in navigator;
this.__copyButtonText = 'Copy Code'; this.__copyButtonText = 'Copy Code';
this.theme = 'light'; this.previewTheme = 'light';
/** @type {{ key: string, name: string }[]} */ /** @type {{ key: string, name: string }[]} */
this.themes = [ this.themes = [
// { key: 'light', name: 'Light' }, // { key: 'light', name: 'Light' },
@@ -286,7 +286,7 @@ export class MdJsPreview extends ScopedElementsMixin(LitElement) {
const params = new URLSearchParams(); const params = new URLSearchParams();
params.set('story-file', sanitize(mdjsSetupScript.src, 'js')); params.set('story-file', sanitize(mdjsSetupScript.src, 'js'));
params.set('story-key', this.key); params.set('story-key', this.key);
params.set('theme', this.theme); params.set('theme', this.previewTheme);
params.set('platform', this.platform); params.set('platform', this.platform);
params.set('language', this.language); params.set('language', this.language);
params.set('edge-distance', this.edgeDistance.toString()); params.set('edge-distance', this.edgeDistance.toString());
@@ -439,20 +439,20 @@ export class MdJsPreview extends ScopedElementsMixin(LitElement) {
@change=${ @change=${
/** @param {Event} ev */ ev => { /** @param {Event} ev */ ev => {
if (ev.target) { if (ev.target) {
this.theme = /** @type {HTMLInputElement} */ (ev.target).value; this.previewTheme = /** @type {HTMLInputElement} */ (ev.target).value;
} }
} }
} }
> >
${this.themes.map( ${this.themes.map(
theme => html` previewTheme => html`
<label class="${this.theme === theme.key ? 'selected' : ''}"> <label class="${this.previewTheme === previewTheme.key ? 'selected' : ''}">
<span>${theme.name}</span> <span>${previewTheme.name}</span>
<input <input
type="radio" type="radio"
name="theme" name="theme"
value="${theme.key}" value="${previewTheme.key}"
?checked=${this.theme === theme.key} ?checked=${this.previewTheme === previewTheme.key}
/> />
</label> </label>
`, `,
@@ -686,11 +686,11 @@ export class MdJsPreview extends ScopedElementsMixin(LitElement) {
} }
:host(:not([device-mode])) #wrapper { :host(:not([device-mode])) #wrapper {
border: 2px solid #4caf50; border: 2px solid var(--primary-lines-color, #4caf50);
} }
iframe { iframe {
border: 2px solid #4caf50; border: 2px solid var(--primary-lines-color, #4caf50);
background: #fff; background: #fff;
} }

View File

@@ -1,7 +1,7 @@
const _sharedStates = { const _sharedStates = {
platform: 'web', platform: 'web',
size: 'webSmall', size: 'webSmall',
theme: 'light', previewTheme: 'light',
language: 'en', language: 'en',
autoHeight: true, autoHeight: true,
deviceMode: false, deviceMode: false,