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:
commit
9d273692d2
1
.github/ISSUE_TEMPLATE.md
vendored
1
.github/ISSUE_TEMPLATE.md
vendored
|
@ -1,5 +1,6 @@
|
||||||
* **Browser**:
|
* **Browser**:
|
||||||
* **Operating System**:
|
* **Operating System**:
|
||||||
|
* **Stylus Version**:
|
||||||
* **Screenshot**:
|
* **Screenshot**:
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
|
@ -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": {
|
"meta_invalidSelectEmptyOptions": {
|
||||||
"message": "Invalid @var select: options list is empty",
|
"message": "Invalid @var select: options list is empty",
|
||||||
"description": "Error displayed when the value of @var select is invalid"
|
"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": {
|
"meta_invalidSelectMultipleDefaults": {
|
||||||
"message": "Invalid @var select: multiple default options are defined",
|
"message": "Invalid @var select: multiple default options are defined",
|
||||||
"description": "Error displayed when the value of @var select is invalid"
|
"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": {
|
"meta_invalidSelectValueMismatch": {
|
||||||
"message": "Invalid @var select: value doesn't exist in the option list",
|
"message": "Invalid @var select: value doesn't exist in the option list",
|
||||||
"description": "Error displayed when the value of @var select is invalid"
|
"description": "Error displayed when the value of @var select is invalid"
|
||||||
|
|
|
@ -92,6 +92,7 @@
|
||||||
<script src="edit/beautify.js"></script>
|
<script src="edit/beautify.js"></script>
|
||||||
<script src="edit/show-keymap-help.js"></script>
|
<script src="edit/show-keymap-help.js"></script>
|
||||||
<script src="edit/refresh-on-view.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/source-editor.js"></script>
|
||||||
<script src="edit/sections-editor-section.js"></script>
|
<script src="edit/sections-editor-section.js"></script>
|
||||||
|
|
61
edit/codemirror-themes.js
Normal file
61
edit/codemirror-themes.js
Normal 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'
|
||||||
|
];
|
60
edit/edit.js
60
edit/edit.js
|
@ -2,7 +2,7 @@
|
||||||
createSourceEditor queryTabs sessionStorageHash getOwnTab FIREFOX API tryCatch
|
createSourceEditor queryTabs sessionStorageHash getOwnTab FIREFOX API tryCatch
|
||||||
closeCurrentTab messageBox debounce workerUtil
|
closeCurrentTab messageBox debounce workerUtil
|
||||||
beautify ignoreChromeError
|
beautify ignoreChromeError
|
||||||
moveFocus msg createSectionsEditor rerouteHotkeys */
|
moveFocus msg createSectionsEditor rerouteHotkeys CODEMIRROR_THEMES */
|
||||||
/* exported showCodeMirrorPopup editorWorker toggleContextMenuDelete */
|
/* exported showCodeMirrorPopup editorWorker toggleContextMenuDelete */
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -46,63 +46,7 @@ preinit();
|
||||||
if (!chrome.runtime.getPackageDirectoryEntry) {
|
if (!chrome.runtime.getPackageDirectoryEntry) {
|
||||||
const themes = [
|
const themes = [
|
||||||
chrome.i18n.getMessage('defaultTheme'),
|
chrome.i18n.getMessage('defaultTheme'),
|
||||||
/* populate-theme-start */
|
...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',
|
|
||||||
/* populate-theme-end */
|
|
||||||
];
|
];
|
||||||
localStorage.codeMirrorThemes = themes.join(' ');
|
localStorage.codeMirrorThemes = themes.join(' ');
|
||||||
return Promise.resolve(themes);
|
return Promise.resolve(themes);
|
||||||
|
|
|
@ -31,7 +31,8 @@ function createMetaCompiler(cm) {
|
||||||
from: cm.posFromIndex((err.index || 0) + match.index),
|
from: cm.posFromIndex((err.index || 0) + match.index),
|
||||||
to: 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,
|
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];
|
meta = match[0];
|
||||||
|
|
|
@ -146,7 +146,8 @@ Object.assign(linter, (() => {
|
||||||
severityIcon.textContent = anno.severity;
|
severityIcon.textContent = anno.severity;
|
||||||
line.textContent = anno.from.line + 1;
|
line.textContent = anno.from.line + 1;
|
||||||
col.textContent = anno.from.ch + 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);
|
message.textContent = clipString(anno.message, 100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"archiver": "^3.0.0",
|
"archiver": "^3.0.0",
|
||||||
"codemirror": "^5.41.0",
|
"codemirror": "^5.41.0",
|
||||||
|
"endent": "^1.2.0",
|
||||||
"eslint": "^5.8.0",
|
"eslint": "^5.8.0",
|
||||||
"fs-extra": "^7.0.0",
|
"fs-extra": "^7.0.0",
|
||||||
"jsonlint": "^1.6.3",
|
"jsonlint": "^1.6.3",
|
||||||
|
@ -18,8 +19,8 @@
|
||||||
"stylelint-bundle": "^8.0.0",
|
"stylelint-bundle": "^8.0.0",
|
||||||
"stylus-lang-bundle": "^0.54.5",
|
"stylus-lang-bundle": "^0.54.5",
|
||||||
"updates": "^5.1.2",
|
"updates": "^5.1.2",
|
||||||
|
"usercss-meta": "^0.8.3",
|
||||||
"web-ext": "^2.9.1",
|
"web-ext": "^2.9.1",
|
||||||
"usercss-meta": "^0.8.1",
|
|
||||||
"webext-tx-fix": "^0.3.1"
|
"webext-tx-fix": "^0.3.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
const fs = require('fs-extra');
|
const fs = require('fs-extra');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const endent = require('endent');
|
||||||
|
|
||||||
// Update theme names list in codemirror-editing-hook.js
|
// Update theme names list in codemirror-editing-hook.js
|
||||||
async function getThemes() {
|
async function getThemes() {
|
||||||
|
@ -14,21 +15,15 @@ async function getThemes() {
|
||||||
.sort();
|
.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) {
|
async function updateHook(themes) {
|
||||||
const fileName = path.join(__dirname, '..', 'edit/codemirror-editing-hooks.js');
|
const fileName = path.join(__dirname, '..', 'edit/codemirror-themes.js');
|
||||||
const content = await fs.readFile(fileName, 'utf-8');
|
fs.writeFile(fileName, endent`
|
||||||
fs.writeFile(fileName, replaceThemes(content, themes));
|
/* 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) {
|
function exit(err) {
|
||||||
|
|
4
vendor/usercss-meta/README.md
vendored
4
vendor/usercss-meta/README.md
vendored
|
@ -1,5 +1,5 @@
|
||||||
## usercss-meta v0.8.1
|
## usercss-meta v0.8.3
|
||||||
|
|
||||||
usercss-meta installed via npm - source repo:
|
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
|
||||||
|
|
2
vendor/usercss-meta/usercss-meta.min.js
vendored
2
vendor/usercss-meta/usercss-meta.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user