Merge remote-tracking branch 'upstream/master'

* upstream/master:
  Chore: include stylus version in the issue template (#549)
  Update usercss-meta (#540)
  Fix: output codemirror themes to a separated file (#538)
This commit is contained in:
dana 2018-11-10 07:12:17 -08:00
commit 9d273692d2
11 changed files with 111 additions and 78 deletions

View File

@ -1,5 +1,6 @@
* **Browser**:
* **Operating System**:
* **Stylus Version**:
* **Screenshot**:
<!--

View File

@ -774,14 +774,42 @@
}
}
},
"meta_invalidRangeUnits": {
"message": "Invalid @var $type$: '$units$' is not a valid unit",
"description": "Error displayed when the value of @var range or @var number is invalid",
"placeholders": {
"type": {
"content": "$1"
},
"units": {
"content": "$2"
}
}
},
"meta_invalidSelect": {
"message": "Invalid @var select: the default value must be an array or an object",
"description": "Error displayed when the value of @var select is invalid"
},
"meta_invalidSelectValue": {
"message": "Invalid @var select: values inside the array/object must be a string",
"description": "Error displayed when the value of @var select is invalid"
},
"meta_invalidSelectEmptyOptions": {
"message": "Invalid @var select: options list is empty",
"description": "Error displayed when the value of @var select is invalid"
},
"meta_invalidSelectLabel": {
"message": "Invalid @var select: option label is empty",
"description": "Error displayed when the value of @var select is invalid"
},
"meta_invalidSelectMultipleDefaults": {
"message": "Invalid @var select: multiple default options are defined",
"description": "Error displayed when the value of @var select is invalid"
},
"meta_invalidSelectNameDuplicated": {
"message": "Invalid @var select: option name is duplicated",
"description": "Error displayed when the value of @var select is invalid"
},
"meta_invalidSelectValueMismatch": {
"message": "Invalid @var select: value doesn't exist in the option list",
"description": "Error displayed when the value of @var select is invalid"

View File

@ -92,6 +92,7 @@
<script src="edit/beautify.js"></script>
<script src="edit/show-keymap-help.js"></script>
<script src="edit/refresh-on-view.js"></script>
<script src="edit/codemirror-themes.js"></script>
<script src="edit/source-editor.js"></script>
<script src="edit/sections-editor-section.js"></script>

61
edit/codemirror-themes.js Normal file
View File

@ -0,0 +1,61 @@
/* exported CODEMIRROR_THEMES */
// this file is generated by update-codemirror-themes.js
'use strict';
const CODEMIRROR_THEMES = [
'3024-day',
'3024-night',
'abcdef',
'ambiance',
'ambiance-mobile',
'base16-dark',
'base16-light',
'bespin',
'blackboard',
'cobalt',
'colorforth',
'darcula',
'dracula',
'duotone-dark',
'duotone-light',
'eclipse',
'elegant',
'erlang-dark',
'gruvbox-dark',
'hopscotch',
'icecoder',
'idea',
'isotope',
'lesser-dark',
'liquibyte',
'lucario',
'material',
'mbo',
'mdn-like',
'midnight',
'monokai',
'neat',
'neo',
'night',
'oceanic-next',
'panda-syntax',
'paraiso-dark',
'paraiso-light',
'pastel-on-dark',
'railscasts',
'rubyblue',
'seti',
'shadowfox',
'solarized',
'ssms',
'the-matrix',
'tomorrow-night-bright',
'tomorrow-night-eighties',
'ttcn',
'twilight',
'vibrant-ink',
'xq-dark',
'xq-light',
'yeti',
'zenburn'
];

View File

@ -2,7 +2,7 @@
createSourceEditor queryTabs sessionStorageHash getOwnTab FIREFOX API tryCatch
closeCurrentTab messageBox debounce workerUtil
beautify ignoreChromeError
moveFocus msg createSectionsEditor rerouteHotkeys */
moveFocus msg createSectionsEditor rerouteHotkeys CODEMIRROR_THEMES */
/* exported showCodeMirrorPopup editorWorker toggleContextMenuDelete */
'use strict';
@ -46,63 +46,7 @@ preinit();
if (!chrome.runtime.getPackageDirectoryEntry) {
const themes = [
chrome.i18n.getMessage('defaultTheme'),
/* populate-theme-start */
'3024-day',
'3024-night',
'abcdef',
'ambiance',
'ambiance-mobile',
'base16-dark',
'base16-light',
'bespin',
'blackboard',
'cobalt',
'colorforth',
'darcula',
'dracula',
'duotone-dark',
'duotone-light',
'eclipse',
'elegant',
'erlang-dark',
'gruvbox-dark',
'hopscotch',
'icecoder',
'idea',
'isotope',
'lesser-dark',
'liquibyte',
'lucario',
'material',
'mbo',
'mdn-like',
'midnight',
'monokai',
'neat',
'neo',
'night',
'oceanic-next',
'panda-syntax',
'paraiso-dark',
'paraiso-light',
'pastel-on-dark',
'railscasts',
'rubyblue',
'seti',
'shadowfox',
'solarized',
'ssms',
'the-matrix',
'tomorrow-night-bright',
'tomorrow-night-eighties',
'ttcn',
'twilight',
'vibrant-ink',
'xq-dark',
'xq-light',
'yeti',
'zenburn',
/* populate-theme-end */
...CODEMIRROR_THEMES
];
localStorage.codeMirrorThemes = themes.join(' ');
return Promise.resolve(themes);

View File

@ -31,7 +31,8 @@ function createMetaCompiler(cm) {
from: cm.posFromIndex((err.index || 0) + match.index),
to: cm.posFromIndex((err.index || 0) + match.index),
message: err.code && chrome.i18n.getMessage(`meta_${err.code}`, err.args) || err.message,
severity: err.code === 'unknownMeta' ? 'warning' : 'error'
severity: err.code === 'unknownMeta' ? 'warning' : 'error',
rule: err.code
})
);
meta = match[0];

View File

@ -146,7 +146,8 @@ Object.assign(linter, (() => {
severityIcon.textContent = anno.severity;
line.textContent = anno.from.line + 1;
col.textContent = anno.from.ch + 1;
message.title = clipString(anno.message, 1000) + `\n(${anno.rule})`;
message.title = clipString(anno.message, 1000) +
(anno.rule ? `\n(${anno.rule})` : '');
message.textContent = clipString(anno.message, 100);
}
}

View File

@ -8,6 +8,7 @@
"devDependencies": {
"archiver": "^3.0.0",
"codemirror": "^5.41.0",
"endent": "^1.2.0",
"eslint": "^5.8.0",
"fs-extra": "^7.0.0",
"jsonlint": "^1.6.3",
@ -18,8 +19,8 @@
"stylelint-bundle": "^8.0.0",
"stylus-lang-bundle": "^0.54.5",
"updates": "^5.1.2",
"usercss-meta": "^0.8.3",
"web-ext": "^2.9.1",
"usercss-meta": "^0.8.1",
"webext-tx-fix": "^0.3.1"
},
"scripts": {

View File

@ -3,6 +3,7 @@
const fs = require('fs-extra');
const path = require('path');
const endent = require('endent');
// Update theme names list in codemirror-editing-hook.js
async function getThemes() {
@ -14,21 +15,15 @@ async function getThemes() {
.sort();
}
function replaceThemes(content, themes) {
const lineFeed = content.includes('\r\n') ? '\r\n' : '\n';
return content.replace(
/(\x20+)(\/\*\s*populate-theme-start\s*\*\/)[\s\S]+?(\/\*\s*populate-theme-end\s*\*\/)/,
(_, indent, intro, outro) =>
indent + intro + lineFeed +
themes.map(_ => `${indent}'${_}',`).join(lineFeed) + lineFeed +
indent + outro
);
}
async function updateHook(themes) {
const fileName = path.join(__dirname, '..', 'edit/codemirror-editing-hooks.js');
const content = await fs.readFile(fileName, 'utf-8');
fs.writeFile(fileName, replaceThemes(content, themes));
const fileName = path.join(__dirname, '..', 'edit/codemirror-themes.js');
fs.writeFile(fileName, endent`
/* exported CODEMIRROR_THEMES */
// this file is generated by update-codemirror-themes.js
'use strict';
const CODEMIRROR_THEMES = ${JSON.stringify(themes, null, 2)};
`.replace(/"/g, "'") + '\n');
}
function exit(err) {

View File

@ -1,5 +1,5 @@
## usercss-meta v0.8.1
## usercss-meta v0.8.3
usercss-meta installed via npm - source repo:
https://unpkg.com/usercss-meta@0.8.1/dist/usercss-meta.min.js
https://unpkg.com/usercss-meta@0.8.3/dist/usercss-meta.min.js

File diff suppressed because one or more lines are too long