Skip to content

Commit e9e4570

Browse files
authored
Merge pull request #736 from atom-minimap/parcel
2 parents f8d49f7 + cea6197 commit e9e4570

24 files changed

+14518
-3764
lines changed

.github/workflows/CI.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- ubuntu-latest
1616
- macos-latest
1717
- windows-latest
18-
atom_channel: [stable, nightly]
18+
atom_channel: [stable, beta]
1919
steps:
2020
- uses: actions/checkout@v2
2121
- uses: UziTech/action-setup-atom@v1
@@ -24,9 +24,11 @@ jobs:
2424
- name: Versions
2525
run: apm -v
2626

27-
- name: Install APM dependencies
27+
- name: Install dependencies and build
2828
run: |
29-
apm install
29+
apm install --production
30+
npm install --only=dev
31+
npm run build
3032
3133
- name: Run Ubuntu tests
3234
if: ${{ contains(matrix.os, 'ubuntu') }}
@@ -45,7 +47,7 @@ jobs:
4547
- uses: actions/checkout@v2
4648
with:
4749
fetch-depth: 0
48-
- uses: actions/setup-node@v1
50+
- uses: actions/setup-node@v2
4951
with:
5052
node-version: "12.x"
5153
- name: Install NPM dependencies
@@ -62,13 +64,13 @@ jobs:
6264
steps:
6365
- uses: actions/checkout@v2
6466
- uses: UziTech/action-setup-atom@v1
65-
- uses: actions/setup-node@v1
67+
- uses: actions/setup-node@v2
6668
with:
6769
node-version: "12.x"
6870
- name: NPM install
6971
run: npm install
70-
# - name: Build and Commit
71-
# run: npm run build-commit
72+
- name: Build and Commit
73+
run: npm run build-commit
7274
- name: Release 🎉
7375
uses: cycjimmy/semantic-release-action@v2
7476
with:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ npm-debug.log
33
node_modules
44
.live-archive
55
pages
6+
dist
7+
.parcel-cache

lib/adapters/legacy-adapter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* @access private
55
*/
6-
module.exports = class LegacyAdapter {
6+
export default class LegacyAdapter {
77
constructor (textEditor) { this.textEditor = textEditor }
88

99
enableCache () { this.useCache = true }

lib/adapters/stable-adapter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* @access private
55
*/
6-
module.exports = class StableAdapter {
6+
export default class StableAdapter {
77
constructor (textEditor) {
88
this.textEditor = textEditor
99
this.textEditorElement = atom.views.getView(this.textEditor)

lib/canvas-layer.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1+
'use babel'
12
'use strict'
23

34
/**
45
* @access private
56
*/
6-
module.exports = class CanvasLayer {
7+
export default class CanvasLayer {
78
constructor () {
89
/**
910
* The onscreen canvas.
1011
* @type {HTMLCanvasElement}
1112
*/
1213
this.canvas = document.createElement('canvas')
1314

14-
const desynchronized = process.platform !== "linux"
15+
const desynchronized = process.platform !== 'linux'
1516

1617
/**
1718
* The onscreen canvas context.

lib/config.json

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
{
2+
"plugins": {
3+
"type": "object",
4+
"properties": {}
5+
},
6+
"autoToggle": {
7+
"title": "Show Minimap On Atom Start",
8+
"type": "boolean",
9+
"default": true,
10+
"order": 1
11+
},
12+
"displayMinimapOnLeft": {
13+
"type": "boolean",
14+
"default": false,
15+
"order": 2
16+
},
17+
"displayCodeHighlights": {
18+
"type": "boolean",
19+
"default": true,
20+
"description": "Toggles the render of the buffer tokens in the minimap.",
21+
"order": 3
22+
},
23+
"displayPluginsControls": {
24+
"type": "boolean",
25+
"default": true,
26+
"description": "You need to restart Atom for this setting to be effective.",
27+
"order": 4
28+
},
29+
"minimapScrollIndicator": {
30+
"type": "boolean",
31+
"default": true,
32+
"description": "Toggles the display of a side line showing which part of the buffer is currently displayed by the minimap. This side line will only appear if the minimap is taller than the editor view height.",
33+
"order": 5
34+
},
35+
"adjustMinimapWidthToSoftWrap": {
36+
"type": "boolean",
37+
"default": true,
38+
"description": "If this option is enabled and Soft Wrap is checked then the Minimap max width is set to the Preferred Line Length value.",
39+
"order": 6
40+
},
41+
"adjustMinimapWidthOnlyIfSmaller": {
42+
"type": "boolean",
43+
"default": true,
44+
"description": "If this option and `adjustMinimapWidthToSoftWrap` are enabled the minimap width will never go past the limit sets by CSS. On the other hand, when disabled the minimap will expand to honor the preferred line width.",
45+
"order": 7
46+
},
47+
"ignoreWhitespacesInTokens": {
48+
"type": "boolean",
49+
"default": false,
50+
"description": "When enabled, text editor tokens are rendered as plain blocks, with no regards to the whitespaces they contains.",
51+
"order": 8
52+
},
53+
"charWidth": {
54+
"type": "number",
55+
"default": 1,
56+
"minimum": 0.5,
57+
"order": 9
58+
},
59+
"charHeight": {
60+
"type": "number",
61+
"default": 2,
62+
"minimum": 0.5,
63+
"order": 10
64+
},
65+
"interline": {
66+
"type": "number",
67+
"default": 1,
68+
"minimum": 0,
69+
"description": "The space between lines in the minimap in pixels.",
70+
"order": 11
71+
},
72+
"textOpacity": {
73+
"type": "number",
74+
"default": 0.6,
75+
"minimum": 0,
76+
"maximum": 1,
77+
"description": "The opacity used to render the line's text in the minimap.",
78+
"order": 12
79+
},
80+
"moveCursorOnMinimapClick": {
81+
"type": "boolean",
82+
"default": false,
83+
"description": "Moves the cursor to the beginning of the target line when clicking on the minimap",
84+
"order": 13
85+
},
86+
"independentMinimapScroll": {
87+
"type": "boolean",
88+
"title": "Independent Minimap Scroll On Mouse Wheel Events",
89+
"default": false,
90+
"description": "When enabled, using the mouse wheel over the Minimap will make it scroll independently of the text editor. The Minimap will still sync with the editor whenever the editor is scrolled, but it will no longer relay the mouse wheel events to the editor.",
91+
"order": 14
92+
},
93+
"scrollSensitivity": {
94+
"type": "number",
95+
"default": 0.5,
96+
"description": "The scrolling speed when the `Independent Minimap Scroll On Mouse Wheel Events` setting is enabled.",
97+
"order": 15
98+
},
99+
"smoothScrolling": {
100+
"type": "boolean",
101+
"default": false,
102+
"description": "Whether to offset the minimap canvas when scrolling to keep the scroll smooth. When `true` the minimap canvas will be offseted, resulting in a smoother scroll, but with the side-effect of a blurry minimap when the canvas is placed between pixels. When `false` the canvas will always stay at the same position, and will never look blurry, but the scroll will appear more jagged.",
103+
"order": 16
104+
},
105+
"createPluginInDevMode": {
106+
"type": "boolean",
107+
"default": false,
108+
"order": 17
109+
},
110+
"absoluteMode": {
111+
"type": "boolean",
112+
"default": false,
113+
"description": "When enabled the text editor content will be able to flow below the minimap.",
114+
"order": 18
115+
},
116+
"adjustAbsoluteModeHeight": {
117+
"type": "boolean",
118+
"default": false,
119+
"description": "When enabled and `Absolute Mode` is also enabled, the minimap height will be adjusted to only take the space required by the text editor content, leaving the space below triggering mouse events on the text editor. **Be aware this can have some impact on performances as the minimap canvases will be resized every time a change in the editor make its height change.**",
120+
"order": 19
121+
},
122+
"redrawDelay": {
123+
"type": "number",
124+
"default": 400,
125+
"minimum": 0,
126+
"maximum": 2000,
127+
"description": "Controls how often (in ms) the minimap should redraw itself after changing the text editor's contents. Setting this to 100ms or higher could dramatically improve editor responsiveness when working with large files. A value of 0 will cause the minimap to redraw itself immediately on each change.",
128+
"order": 20
129+
},
130+
"devicePixelRatioRounding": {
131+
"type": "boolean",
132+
"default": true,
133+
"description": "Toggles the rounding of the devicePixelRatio in the minimap.",
134+
"order": 21
135+
},
136+
"useHardwareAcceleration": {
137+
"type": "boolean",
138+
"default": true,
139+
"order": 22
140+
},
141+
"scrollAnimation": {
142+
"type": "boolean",
143+
"default": false,
144+
"description": "Enables animations when scrolling by clicking on the minimap.",
145+
"order": 23
146+
},
147+
"scrollAnimationDuration": {
148+
"type": "integer",
149+
"default": 300,
150+
"description": "The duration of scrolling animations when clicking on the minimap.",
151+
"order": 24
152+
},
153+
"maxTokensInOneLine": {
154+
"type": "integer",
155+
"default": 160,
156+
"description": "The maximum number of tokens that are rendered for each line.",
157+
"order": 25
158+
}
159+
}

lib/decoration.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict'
22

3-
const _ = require('underscore-plus')
4-
const { Emitter } = require('atom')
3+
import { Emitter } from 'atom'
54

65
let idCounter = 0
76
const nextId = function () { return idCounter++ }
@@ -11,7 +10,7 @@ const nextId = function () { return idCounter++ }
1110
*
1211
* It has the same API than the `Decoration` class of a text editor.
1312
*/
14-
module.exports = class Decoration {
13+
export default class Decoration {
1514
/**
1615
* Returns `true` if the passed-in decoration properties matches the
1716
* specified type.
@@ -21,7 +20,7 @@ module.exports = class Decoration {
2120
* @return {boolean} whether the decoration properties match the type
2221
*/
2322
static isType (decorationProperties, type) {
24-
if (_.isArray(decorationProperties.type)) {
23+
if (Array.isArray(decorationProperties.type)) {
2524
if (decorationProperties.type.indexOf(type) >= 0) { return true }
2625
return false
2726
} else {

lib/decorators/element.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22

3-
const { registerOrUpdateElement } = require('atom-utils-plus')
3+
import { registerOrUpdateElement } from 'atom-utils-plus'
44

55
/**
66
* Generates a decorator function to convert a class into a custom element
@@ -34,6 +34,6 @@ const { registerOrUpdateElement } = require('atom-utils-plus')
3434
* // ...
3535
* }
3636
*/
37-
module.exports = function element (cls, elementName) {
37+
export default function element (cls, elementName) {
3838
return registerOrUpdateElement(elementName, { class: cls })
3939
}

lib/decorators/include.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* // ...
1313
* }
1414
*/
15-
module.exports = function include (cls, ...mixins) {
15+
export default function include (cls, ...mixins) {
1616
mixins.forEach((mixin) => { includeMixin(cls, mixin) })
1717
}
1818

0 commit comments

Comments
 (0)