Compare commits

...

6 Commits

Author SHA1 Message Date
github-actions[bot]
14721d1e0f Version Packages 2021-04-20 12:58:41 +02:00
Thomas Allmer
0f6709ac4b fix(mdjs-preview): initial setting should come from the element 2021-04-20 12:55:32 +02:00
Thomas Allmer
ed86ff2346 fix(cli): do not set data-localize-lang in the simulator iframe html tag 2021-04-20 12:55:32 +02:00
Mathieu Puech
c675820163 fix: windows path issue avoid filtering of index section of collections 2021-04-20 12:28:19 +02:00
Konstantinos Norgias
f4a0ab559f fix: add changeset & update drawer 2021-04-20 12:27:12 +02:00
Konstantinos Norgias
a8cdaebab1 fix(simulator): document shadowRoot n/a in iframe 2021-04-20 12:27:12 +02:00
9 changed files with 52 additions and 20 deletions

View File

@@ -1,5 +1,13 @@
# @rocket/cli
## 0.6.2
### Patch Changes
- ed86ff2: Do not set `data-localize-lang` in the simulator iframe html tag
- f4a0ab5: Pass document shadowRoot to iframe
- c675820: fix: windows path issue avoid filtering of index section of collections
## 0.6.1
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@rocket/cli",
"version": "0.6.1",
"version": "0.6.2",
"publishConfig": {
"access": "public"
},
@@ -73,6 +73,7 @@
"fs-extra": "^9.0.1",
"micromatch": "^4.0.2",
"plugins-manager": "^0.2.1",
"slash": "^3.0.0",
"utf8": "^3.0.0"
},
"types": "dist-types/index.d.ts"

View File

@@ -35,7 +35,6 @@
if (urlParts.get('language')) {
document.documentElement.setAttribute('lang', urlParts.get('language'));
document.documentElement.setAttribute('data-lang', urlParts.get('language'));
document.documentElement.setAttribute('data-localize-lang', urlParts.get('language'));
}
if (urlParts.get('story-key')) {
document.documentElement.setAttribute('story-key', urlParts.get('story-key'));
@@ -47,7 +46,7 @@
}
const mod = await import(urlParts.get('story-file'));
render(mod[urlParts.get('story-key')](), document.body);
render(mod[urlParts.get('story-key')]({ shadowRoot: document }), document.body);
}
window.addEventListener('hashchange', onHashChange, false);

View File

@@ -1,5 +1,6 @@
const path = require('path');
const fs = require('fs');
const slash = require('slash');
const { readdirSync } = require('fs');
function getDirectories(source) {
@@ -23,7 +24,7 @@ const rocketCollections = {
let docs = [
...collection.getFilteredByGlob(`${_inputDirCwdRelative}/${section}/**/*.md`),
];
docs = docs.filter(page => page.inputPath !== `./${indexSection}`);
docs = docs.filter(page => page.inputPath !== `./${slash(indexSection)}`);
return docs;
});

View File

@@ -35,7 +35,7 @@
"preset"
],
"dependencies": {
"@rocket/drawer": "^0.1.2",
"@rocket/drawer": "^0.1.3",
"@rocket/navigation": "^0.2.1"
}
}

View File

@@ -1,5 +1,11 @@
# @mdjs/mdjs-preview
## 0.4.1
### Patch Changes
- 0f6709a: Make sure initial settings are taken from the element if nothing is yet stored
## 0.4.0
### Minor Changes

View File

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

View File

@@ -72,7 +72,7 @@ export class MdJsPreview extends LitElement {
this.languages = [
{ key: 'en', name: 'English' },
{ key: 'en-US', name: 'English (United States)' },
{ key: 'en-US', name: 'English (United Kingdom)' },
{ key: 'en-GB', name: 'English (United Kingdom)' },
{ key: 'de', name: 'German' },
{ key: 'es', name: 'Spanish' },
{ key: 'fi', name: 'Finnish' },

View File

@@ -40,6 +40,8 @@ function storeSettings() {
}
}
let hasGlobalStateBeenSetBefore = false;
function restoreSettings() {
for (const _sharedStateKey of Object.keys(_sharedStates)) {
const sharedStateKey = /** @type {keyof _sharedStates} */ (_sharedStateKey);
@@ -55,6 +57,7 @@ function restoreSettings() {
default:
_sharedStates[sharedStateKey] = restoredValue;
}
hasGlobalStateBeenSetBefore = true;
}
}
}
@@ -66,27 +69,30 @@ restoreSettings();
* @param {import('./MdJsPreview.js').MdJsPreview} target
*/
export function applySharedStates(target) {
for (const _sharedStateKey of Object.keys(_sharedStates)) {
const sharedStateKey = /** @type {keyof _sharedStates} */ (_sharedStateKey);
switch (sharedStateKey) {
case 'autoHeight':
case 'deviceMode':
case 'rememberSettings':
case 'edgeDistance':
target[sharedStateKey] = _sharedStates[sharedStateKey];
break;
default:
target[sharedStateKey] = _sharedStates[sharedStateKey];
if (hasGlobalStateBeenSetBefore) {
for (const _sharedStateKey of Object.keys(_sharedStates)) {
const sharedStateKey = /** @type {keyof _sharedStates} */ (_sharedStateKey);
switch (sharedStateKey) {
case 'autoHeight':
case 'deviceMode':
case 'rememberSettings':
case 'edgeDistance':
target[sharedStateKey] = _sharedStates[sharedStateKey];
break;
default:
target[sharedStateKey] = _sharedStates[sharedStateKey];
}
}
} else {
_saveToSharedStates(target);
}
}
/**
*
* @param {import('./MdJsPreview.js').MdJsPreview} target
* @param {Function} subscribedFn
*/
export function saveToSharedStates(target, subscribedFn) {
function _saveToSharedStates(target) {
let updated = false;
for (const _sharedStateKey of Object.keys(_sharedStates)) {
const sharedStateKey = /** @type {keyof _sharedStates} */ (_sharedStateKey);
@@ -102,8 +108,19 @@ export function saveToSharedStates(target, subscribedFn) {
_sharedStates[sharedStateKey] = target[sharedStateKey];
}
updated = true;
hasGlobalStateBeenSetBefore = true;
}
}
return updated;
}
/**
*
* @param {import('./MdJsPreview.js').MdJsPreview} target
* @param {Function} subscribedFn
*/
export function saveToSharedStates(target, subscribedFn) {
const updated = _saveToSharedStates(target);
if (updated) {
storeSettings();
for (const subscribeFn of subscribeFns) {