Commit Graph

668 Commits

Author SHA1 Message Date
tophf
c12d3fc5e3 convert USO styles to USO-archive on update 2021-02-04 14:10:30 +03:00
tophf
8ee964c045 simplify rerouteHotkeys to avoid enabling it twice 2021-02-02 22:49:00 +03:00
tophf
c41a5f92c3 preserve dirty after importing moz-format [v2], fixes #1163 2021-02-02 00:33:56 +03:00
tophf
eb5fd90dc7 remember CM bookmarks on reload/revisit 2021-01-12 17:39:24 +03:00
tophf
fe176c9b62 [compact layout] show sections TOC on first click 2021-01-09 13:21:06 +03:00
tophf
ac7b33d7e0 fix resizing of last section if page is scrolled 2021-01-07 14:52:38 +03:00
tophf
39e03b0a9f fix autocomplete after var(, autocompleteOnTyping 2021-01-07 14:52:38 +03:00
tophf
767b2017e0 wait for main stylesheet to load before forcing layout 2021-01-05 19:54:49 +03:00
tophf
dfb9135f6a stylelint 13.8.0 2021-01-05 18:51:01 +03:00
tophf
7d6b4fc8ac csslint: code cosmetics 2021-01-05 18:27:46 +03:00
tophf
57233db546 csslint: add 'shorthand-overrides' rule 2021-01-05 12:14:26 +03:00
tophf
cb85fe9392 get the full list of stylelint rules 2021-01-04 09:28:59 +03:00
tophf
fdbfb23547
API groups + use executeScript for early injection (#1149)
* parserlib: fast section extraction, tweaks and speedups
* csslint: "simple-not" rule
* csslint: enable and fix "selector-newline" rule
* simplify db: resolve with result
* simplify download()
* remove noCode param as it wastes more time/memory on copying
* styleManager: switch style<->data names to reflect their actual contents
* inline method bodies to avoid indirection and enable better autocomplete/hint/jump support in IDE
* upgrade getEventKeyName to handle mouse clicks
* don't trust location.href as it hides text fragment
* getAllKeys is implemented since Chrome48, FF44
* allow recoverable css errors + async'ify usercss.js
* openManage: unminimize windows
* remove the obsolete Chrome pre-65 workaround
* fix temporal dead zone in apply.js
* ff bug workaround for simple editor window
* consistent window scrolling in scrollToEditor and jumpToPos
* rework waitForSelector and collapsible <details>
* blank paint frame workaround for new Chrome
* extract stuff from edit.js and load on demand
* simplify regexpTester::isShown
* move MozDocMapper to sections-util.js
* extract fitSelectBox()
* initialize router earlier
* use helpPopup.close()
* fix autofocus in popups, follow-up to 5bb1b5ef
* clone objects in prefs.get() + cosmetics
* reuse getAll result for INC
2021-01-01 17:27:58 +03:00
tophf
1e614fa2bc don't count&title removed sections 2020-12-15 01:52:10 +03:00
tophf
775d77a3a8 clone change positions to avoid breaking CodeMirror 2020-12-10 23:25:07 +03:00
tophf
579750fbc0 fix linting when style was initially error-free
regressed in e6f94378
2020-12-10 11:00:24 +03:00
tophf
75cf46aaa7 fix search-target-editor style 2020-12-08 23:03:13 +03:00
tophf
26a539bd62 fix closestVisible nearby check 2020-12-08 18:50:14 +03:00
tophf
e6f94378bf re-enable linter after import + async'ify
regressed in 420733b9
2020-11-29 14:25:07 +03:00
tophf
207afccd65
improve autocomplete (#1136)
* fix interaction when search overlay splits `styles`
* handle @rules and @-moz-document functions
* show props in stylus-lang
2020-11-28 23:29:33 +03:00
tophf
6847681ed3 fix findSections for {} + detect reusedEnd 2020-11-27 15:10:03 +03:00
tophf
a87c49f0fc autoresize embedded popup for config dialogs 2020-11-27 15:09:16 +03:00
tophf
cb64a6bac9 use jumpToPos more, fix coords calc 2020-11-26 17:04:51 +03:00
tophf
6451eb533c switch to styleMissingName 2020-11-26 12:09:11 +03:00
tophf
355f240779 add a suffix in editor title 2020-11-26 12:04:42 +03:00
tophf
a91183e1bb fix scrolling in jumpToPos 2020-11-25 23:28:22 +03:00
tophf
c635f2e38c monkeypatch next/prevBookmark commands to use jumpToPos 2020-11-24 15:17:14 +03:00
tophf
657798d219 improve bookmarking + rework codemirror-factory.js
* pull editing-only stuff from codemirror-default.js
* switch throttledSetOption to IntersectionObserver
2020-11-24 13:16:51 +03:00
tophf
b4ca17c531 call rerouteHotkeys when restoring scrollInfo
...because we intentionally don't focus any CM in this case as it's bugged as hell
2020-11-24 13:16:51 +03:00
tophf
32cca90ddd limit button reposition to usercss (8b58b228 fixup) 2020-11-24 12:54:39 +03:00
tophf
8b58b22825 [simple-window editor] embed popup as iframe 2020-11-24 12:16:23 +03:00
tophf
70e3ba15b7 use 'default' internally for the default theme element
* the pref won't be influenced by the current UI language
* also reset to 'default' if failed to load the theme's css file
2020-11-20 16:10:15 +03:00
tophf
420733b93a
PatchCSP + tweaks/fixes/features (#1107)
* add Patch CSP option
* show style version, size, and update age in manager
* add scope selector to style search in manager
* keep scroll position and selections in tab's session
* directly install usercss from raw github links
* ditch localStorage, use on-demand SessionStore proxy
* simplify localization
* allow <code> tag in i18n-html
* keep &nbsp; nodes in HTML templates
* API.getAllStyles is actually faster with code untouched
* fix fitToContent when applies-to is taller than window
* dedupe linter.enableForEditor calls
* prioritize visible CMs in refreshOnViewListener
* don't scroll to last style on editing a new one
* delay colorview for invisible CMs
* eslint comma-dangle error + autofix files
* styleViaXhr: also toggle for disableAll pref
* styleViaXhr: allow cookies for sandbox CSP
* simplify notes in options
* simplify getStylesViaXhr
* oldUI fixups:
  * remove separator before 1st applies-to
  * center name bubbles
* fix updateToc focus on a newly added section
* fix fitToContent when cloning section
* remove CSS `contain` as it makes no difference
* replace overrides with declarative CSS + code cosmetics
* simplify adjustWidth and make it work in FF
2020-11-18 14:17:15 +03:00
tophf
0b3e027bfd auto-promisify browser.* methods on call 2020-11-13 20:07:43 +03:00
tophf
dc4819e7d0
Merge pull request #1101 from tophf/import-prefs
import/export options in backup json
2020-11-09 21:18:23 +03:00
tophf
ff1fa07267 import/export options in backup json
* import options on demand
* auto-grant declarativeContent
* include lint configs and usercss template
* simplify exportFile as crbug.com/798705 was fixed
2020-11-09 21:12:14 +03:00
tophf
a94969e47d remove padding from linter report items
(icons already take care of proper spacing)
2020-11-08 20:29:10 +03:00
tophf
4ac92a4f9b unbork marks in linter report
CodeMirror 5.58+ uses an additional class name for common stuff
2020-11-08 20:29:09 +03:00
tophf
5e5fecbcfe
editor: section labels, TOC, tweaks (#1086)
* section labels, TOC, speedups and fixes

* show section numbers in widgets
* debounce livePreview in usercss editor
* better fixed header and compact layout compatibility
* fix section sizing for compact layout + layout speedup
* DocFuncMapper + cosmetics + fix Clone button
* don't run linter during initSections
* remove unused/unnecessary DOM polyfills
* report invalid @document function as parser error
* rewrite section finder
* simplify focusedViaClick
* simplify setPreprocessor and make it synchronous
* throttle offscreen line widgets in usercss with lots of sections
* add on, off aliases for add/removeEventListener + onOff
* use on/off aliases in changed files
* use getters in more places
2020-11-08 11:12:42 +03:00
tophf
635fc705f9 correctly clear gutter marks for sublime bookmarks 2020-11-04 17:47:41 +03:00
tophf
6d7bd650e9 strip stylelint warnings for // comments with @preprocessor 2020-10-28 13:19:17 +03:00
tophf
a81e1b8ac3 async'ify worker-util, reduce indirection 2020-10-28 13:19:17 +03:00
tophf
4764f91453 fix radiateArray when focusing search with extra CMs around 2020-10-28 13:08:00 +03:00
tophf
2747d3930b simplify resizing of editor-in-new-window 2020-10-26 18:04:37 +03:00
tophf
2c674bdc0c remove the extraneous margin between applies-to 2020-10-26 18:04:35 +03:00
tophf
2ed936af00 don't autojump to first match when opening search 2020-10-26 18:04:34 +03:00
tophf
89431615b3
improve colorpicker dialog (#1079)
* switch to a user-resizable palette
* allow moving
* remove hideDelay
2020-10-26 18:03:41 +03:00
tophf
4fade0fdfe async'ify replaceStyle 2020-10-26 17:33:23 +03:00
tophf
34ad3cfaef embed replaceSections as replace option of initSections 2020-10-26 17:24:11 +03:00
tophf
4eabdf3f57 warn when paste-importing usercss with @preprocessor 2020-10-25 22:36:41 +03:00
tophf
2af83ee846 remove more -webkit- prefixes 2020-10-23 21:32:02 +03:00
tophf
54605c838b set customName only on user input 2020-10-22 23:48:17 +03:00
tophf
e6e7d7d158 leave name input empty in new usercss style 2020-10-22 23:47:46 +03:00
tophf
2d9785be6e clear dirty upon swapping style 2020-10-22 23:31:09 +03:00
tophf
0199b2c0bb preserve dirty after importing moz-format, fixes #1075 2020-10-22 23:18:58 +03:00
narcolepticinsomniac
76e2a90392 moz-format CM focus style 2020-10-22 15:05:54 +03:00
tophf
bc6c9c826a make editor load even faster
* reorder scripts
* make style request earlier
2020-10-22 15:03:07 +03:00
tophf
2e1a903cc7 fix local name customization for usercss/legacy 2020-10-22 15:01:49 +03:00
tophf
3cb9cbb862
show a palette for current editor in color picker (#1068)
also keep the dialog visible for 30 seconds instead of 5
2020-10-18 16:40:11 +03:00
tophf
a71b621bf9 remove -webkit- prefix on standardized features 2020-10-14 19:48:59 +03:00
tophf
9e487b03e5
tweak editor (#1063)
* also apply live-preview if an unsaved style was disabled

* use box-shadow instead of outline for focus everywhere

* allow focus outline on click in text/search input or textarea

* search inputs should use the same style as text inputs

* also use box-shadow focus on delete buttons

* remove URLSearchParams workaround, not needed since Chrome 55

* use `once` in addEventListener, available since Chrome 55

* update USO bug workarounds, remove obsolete ones

* ping/pong to fix openURL with `message` in FF

* use unprefixed CSS filter, available since Chrome 53

* use unprefixed CSS user-select, available since Chrome 54

* focus tweaks

* also use text query in inline search for Stylus category

* use event.key, available since Chrome 51

Co-authored-by: narcolepticinsomniac
2020-10-13 21:14:54 +03:00
tophf
60fc6f2456
Editor fixes, make sectioned editor open quickly again (#1061)
* make usercss editor full-height again

* make sectioned editor open quickly again

* remove leftovers

* autofocus when add/clone button is clicked

* don't fit to content on clicking the add button

* scroll the window to show a manually added section entirely

* autofocus on a manually added applies-to

* disable Save button while loading

* use standard CSS for a focused CodeMirror outline

* trigger refresh sooner by one viewport in advance

* declare refreshOnView as a standard function

* run fixedHeader asynchronously to prevent self-triggering

* account for header in compact mode when fitting to content

* code cosmetics
2020-10-11 17:13:25 +03:00
tophf
ad24ee0c15
switch to USO-archive for inline search in popup, #1056 2020-10-11 16:53:42 +03:00
tophf
11ce144efb remove the redundant stylus-lang warning filter 2020-10-09 19:40:11 +03:00
tophf
4913da2e19 use installation url on known sites as homepage 2020-10-09 13:47:58 +03:00
tophf
a01bd3cd61 update polyfill for Chrome>=55 2020-10-08 11:19:18 +03:00
tophf
3f6c85637c Containment Module L2 (WD, 2020-06-03) 2020-10-02 12:41:57 +03:00
tophf
30983db679
Scroll Anchoring L1 (ED 2020-09-18) (#1038) 2020-09-22 06:56:53 -04:00
tophf
fa1496ecb8
use tab.pendingUrl (#1040) 2020-09-22 06:54:48 -04:00
tophf
5109f9abb3
CodeMirror 5.57 (#1023)
* codemirror 5.57

* dedupe the props defined in new codemirror
2020-08-23 11:44:27 -04:00
eight
a0172c262c
Fix: enable linter after processing metadata (#1018) 2020-08-17 21:06:52 +08:00
tophf
54b1f218e0
Enhance: promisify chrome into browser, drop promisify (#866)
* promisify `chrome` into `browser`

* comment

* comment

* comment

* Add: a naive browser polyfill

* Fix: polyfill doesn't detect content script env correctly

Co-authored-by: eight04 <eight04@gmail.com>
2020-08-14 20:16:01 +08:00
tophf
3d94c641b3
CodeMirror 5.56 + csslint update (#1014)
* CodeMirror 5.56

* csslint: Overscroll Behavior L1 (ED 2020-01-16)

* don't list rare/obsolete/future/existing css props
2020-08-13 13:58:09 -04:00
tophf
d18314357f
use onBoundsChanged to remember editor size/position (#1007) 2020-08-02 00:00:44 -04:00
tophf
f8402a2211
use mousewheel to change focused "input[type=number], select" (#1010)
* use mousewheel to change focused "input[type=number], select"

* revert 0f394fa8 (no longer needed)
2020-08-01 23:50:12 -04:00
tophf
0f394fa8d8 don't scroll CM when target is a scrollable input 2020-08-01 18:00:08 +03:00
tophf
c43315e697
restore Shift-Ctrl-Wheel to scroll window in multi-section mode (#1005) 2020-07-29 21:26:38 -04:00
tophf
e1807c8851 restore autosize-on-type of find input 2020-07-24 07:42:58 +03:00
tophf
7e195594b5
show all spaces in find input in firefox (#1002) 2020-07-23 17:27:29 -04:00
tophf
787466fc40
consume leftovers when auto-completing properties (#992) 2020-07-14 16:25:19 -04:00
tophf
60a37af0e0
add a hotkey & right-click to beautify silently (#972)
* add a hotkey & right-click to beautify silently

* fix closestVisible
2020-06-22 12:14:41 -04:00
tophf
a1b0eb7df1
show sublime bookmarks (#951)
* remove redundant setGutterMarker optimization

* show sublime bookmarks
2020-06-01 00:54:49 -04:00
tophf
7ab0651e4d
add ":" to prop names in css autocomplete menu (#915) 2020-05-01 01:52:18 -04:00
narcolepticinsomniac
0b4e946c82
CM scrollbar pointer-events (#902) 2020-04-17 07:36:37 -04:00
narcolepticinsomniac
50aecffe4c
set min-height outside of query (#873) 2020-03-03 11:13:21 -05:00
Rob Garrison
9d765e91c6 Update vendor dependencies 2020-02-02 11:07:22 -06:00
narcolepticinsomniac
1f12d50aaf
Embed options in manager (#828)
* Embed options in manager

* fix indent again

* Fix edit URL detected as manage URL when creating manager style from popup

* Syntax, hash only, and prevent empty hash

* Fix: move origin check to background

* Rename eslintrc

* Refactor: openURL

* Add: fixme comment about openEditor

* Fix: allow activating manager in other windows

* Add: trimHash method

* Fix: limit the scope of styleViaAPI

* Breaking: add router, keep search params

* Fix: focus options when activated

* Add: some fixme

* Fix: remove unused fixme

* Fix: minor

* Fix: remove unused message

* Add: doc

* Change: activate manager in other windows

* Fix: make sure sender is available in getTabUrlPrefix

* Add: openManage API

* Change: reuse editor in openEditor

* Fix: greedly pop the buffer

* Fix: backward detection

* Fix: remove unused important

* Fix: remove unused workaround

* Fix: avoid empty search param

* Change: detect all kinds of manager in openManage

* Fix: minor

* Manage button text

Co-authored-by: eight <eight04@gmail.com>
2020-02-01 23:36:54 -05:00
tophf
d3ee6d9498 fix an infinite loop in editor search with /^/ or /$/ (#832) 2020-01-27 21:39:36 -05:00
tophf
c0fd71dda6 only recalc applies-to css on live-update if style targets the editor 2019-10-13 20:59:50 +03:00
tophf
5459130111 find @-moz-doc sections faster in the editor (#786)
* find @-moz-doc sections faster in the editor

* only recreate widgets if section data is changed

* CodeMirror speedup: reuse the old folding marks

* add a reminder to remove the CodeMirror hack in the future

* use precise getTokenAt

* check doc type for string/comment to be more mode-agnostic

* fix setGutterMarker hack

* fix skipSpace: EOL is a space too

* move deepEqual next to deepCopy

* fix getTokenTypeAt check for some cases

* remove the unnecessary \s*
2019-09-25 04:44:33 -04:00
narcolepticinsomniac
793dc20722
linter and compact layout improvements (#749)
* linter and compact layout improvements

Closes #748

While investigating the best way to fix linter scrolling, when I double-checked the compact layout, an old bug I meant to fix a long time ago was immediately apparent. Basically, the linter adds/removes errors as you type, causing the editor to bounce up and down, making it practically unusable. 

This PR fixes scrolling, and also collapses options and the linter in the compact layout, but always shows the collapsed linter so you're aware of the error count without the content jumping. It also collapses options in the non-compact layout if the viewport is too short to accommodate them, factoring in the min-height of the linter. All automatic collapsing factors in whether a linter is active so they can adjust accordingly, and disables the setting of collapsed state prefs, since we're deciding the pref anyway, and this allows for re-expanding on resize based on the previous pref.

It's quite possible I failed to account for certain scenarios, so try to break it. Also think it's problematic for the linter to not always be visible if enabled, so I hooked up a 40px fixed header on scroll with just the linter in it for the compact layout.

A few other little details are included. I removed redundant line and column numbers spelled out at the end of lint messages to prevent horizontal overflow. I noticed that the expand/collapse prefs do not toggle correctly when clicking directly on the details-marker arrow. Simplest solution was covering them with the `h2` (we may wanna hook up the manager as well). Also, unrelated, but I switched to opacity to hide resizing sectioned editors, because `visibility: hidden;` breaks editor auto-focus.

If either of you guys wanna fix any bugs, or improve any code, feel free to just commit to this PR directly.

* linter and compact layout improvements

* linter and compact layout improvements

* No usercss scroll listener and delay header check

* Some code tweaks
2019-08-04 13:09:50 -04:00
Rob Garrison
b7b6ed2ff5 Update vendor libraries
Codemirror & Dropbox sdk
2019-07-08 04:59:28 -05:00
eight
6fbc291b19 Fix: single editor doesn't stretch to full height (#728)
* Fix: single editor doesn't stretch to full height

* Fix: remove redundant selectors
2019-06-20 15:36:53 -04:00
eight
d1db77e5b0 Add: auto resize editors on init in section editor (#729)
* Add: auto resize section editor on init

* Fix: calculate cm height correctly

* Fix: query heights before set

* Fix: work with small layout, hide sections before ready
2019-06-20 15:36:27 -04:00
stonecrusher
b48817fe01 Update Stylelint defaults for Stylus-lang at-rules (#695)
* Update Stylelint defaults for Stylus-lang at-rules

* Minor tweak
2019-04-14 08:39:22 -05:00
Rob Garrison
ab83ed8f0f Fix linter config issues. Closes #689 2019-04-05 07:42:37 -05:00
tophf
55189f1fdd CSSLint and parserlib (#646)
* CSSLint: add mask-image

https://drafts.fxtf.org/css-masking-1/#the-mask-image

* CSSLint: update <image> type

https://drafts.csswg.org/css-images-3/#typedef-image

* CodeMirror CSS mode: add 'mask-image'

* CodeMirror CSS mode: add CSS Round Display L1

https://www.w3.org/TR/css-round-display-1/

* CSSLint: CSS Round Display L1 (ED 2018-09-26)

https://drafts.csswg.org/css-round-display/

* CSSLint: CSS Environment Variables L1 (ED 2018-08-03)

https://drafts.csswg.org/css-env-1/

* CSSLint: parts of CSS Overflow Module L3 (WD 2018-07-31)

only overflow-* properties are added since the rest seem tentative
https://www.w3.org/TR/css-overflow-3/

* CSSLint: Selectors L4 :is() supersedes :matches()

https://drafts.csswg.org/selectors-4/#matches

* CSSLint: Text Decoration L3 (CR 2018-06-26)

https://drafts.csswg.org/css-text-decor-3/

* CSSLint: fix '&&' in grammarParser

consequences:
* fixed text-shadow
* fixed <display-listitem>
* switched to a string in <shadow>

* CSSLint: fix definition for 'rotate'

* CSSLint: fix applyEmbeddedOverrides

* CSSLint: update definition for 'rotate'

* CSSLint: reset parserlib cache when inline overrides change

* CSSLint: code cosmetics

* CSSLint: fixup d5971e9c

* CSSLint: code cosmetics

* CSSLint: start ignoring from the comment's line number
2019-03-03 16:55:15 -06:00
eight
dfb9db34c3 Fix: update live preview when the style is toggled/replaced (#662) 2019-02-03 14:00:13 -05:00
Rob Garrison
e8ba51f940 Fix applies to alignment 2019-01-17 06:41:47 -06:00
Rob Garrison
0c8e69fb9d Make beautify options persistent. Fixes #630 2018-12-27 07:53:37 -06:00