Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
73dd54e1
Unverified
Commit
73dd54e1
authored
Jan 20, 2020
by
Robert Knight
Committed by
GitHub
Jan 20, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1703 from hypothesis/convert-remaining-es-modules
Convert remaining CommonJS modules to ES modules
parents
d3505e58
9e83ff3b
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
36 additions
and
55 deletions
+36
-55
annotation-counts.js
src/annotator/annotation-counts.js
+2
-4
annotation-sync.js
src/annotator/annotation-sync.js
+1
-3
features.js
src/annotator/features.js
+3
-3
frame-observer.js
src/annotator/frame-observer.js
+5
-7
guest.coffee
src/annotator/guest.coffee
+1
-1
pdfjs-rendering-states.js
src/annotator/pdfjs-rendering-states.js
+1
-1
cross-frame.coffee
src/annotator/plugin/cross-frame.coffee
+4
-4
pdf.coffee
src/annotator/plugin/pdf.coffee
+1
-1
selections.js
src/annotator/selections.js
+2
-4
sidebar-trigger.js
src/annotator/sidebar-trigger.js
+1
-3
sidebar.coffee
src/annotator/sidebar.coffee
+4
-4
sidebar-test.coffee
src/annotator/test/sidebar-test.coffee
+1
-1
bridge-events.js
src/shared/bridge-events.js
+1
-1
bridge.js
src/shared/bridge.js
+3
-5
discovery.js
src/shared/discovery.js
+1
-3
frame-rpc.js
src/shared/frame-rpc.js
+1
-3
warn-once.js
src/shared/warn-once.js
+1
-3
persisted-defaults-test.js
src/sidebar/services/test/persisted-defaults-test.js
+0
-1
yarn.lock
yarn.lock
+3
-3
No files found.
src/annotator/annotation-counts.js
View file @
73dd54e1
const
events
=
require
(
'../shared/bridge-events'
)
;
import
events
from
'../shared/bridge-events'
;
const
ANNOTATION_COUNT_ATTR
=
'data-hypothesis-annotation-count'
;
const
ANNOTATION_COUNT_ATTR
=
'data-hypothesis-annotation-count'
;
...
@@ -10,7 +10,7 @@ const ANNOTATION_COUNT_ATTR = 'data-hypothesis-annotation-count';
...
@@ -10,7 +10,7 @@ const ANNOTATION_COUNT_ATTR = 'data-hypothesis-annotation-count';
* display annotation count.
* display annotation count.
*/
*/
function
annotationCounts
(
rootEl
,
crossframe
)
{
export
default
function
annotationCounts
(
rootEl
,
crossframe
)
{
crossframe
.
on
(
crossframe
.
on
(
events
.
PUBLIC_ANNOTATION_COUNT_CHANGED
,
events
.
PUBLIC_ANNOTATION_COUNT_CHANGED
,
updateAnnotationCountElems
updateAnnotationCountElems
...
@@ -23,5 +23,3 @@ function annotationCounts(rootEl, crossframe) {
...
@@ -23,5 +23,3 @@ function annotationCounts(rootEl, crossframe) {
});
});
}
}
}
}
module
.
exports
=
annotationCounts
;
src/annotator/annotation-sync.js
View file @
73dd54e1
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
//
//
// It also listens for events from Guest when new annotations are created or
// It also listens for events from Guest when new annotations are created or
// annotations successfully anchor and relays these to the sidebar app.
// annotations successfully anchor and relays these to the sidebar app.
function
AnnotationSync
(
bridge
,
options
)
{
export
default
function
AnnotationSync
(
bridge
,
options
)
{
const
self
=
this
;
const
self
=
this
;
this
.
bridge
=
bridge
;
this
.
bridge
=
bridge
;
...
@@ -174,5 +174,3 @@ AnnotationSync.prototype._format = function(ann) {
...
@@ -174,5 +174,3 @@ AnnotationSync.prototype._format = function(ann) {
msg
:
ann
,
msg
:
ann
,
};
};
};
};
module
.
exports
=
AnnotationSync
;
src/annotator/features.js
View file @
73dd54e1
const
events
=
require
(
'../shared/bridge-events'
)
;
import
events
from
'../shared/bridge-events'
;
const
warnOnce
=
require
(
'../shared/warn-once'
)
;
import
warnOnce
from
'../shared/warn-once'
;
let
_features
=
{};
let
_features
=
{};
...
@@ -7,7 +7,7 @@ const _set = features => {
...
@@ -7,7 +7,7 @@ const _set = features => {
_features
=
features
||
{};
_features
=
features
||
{};
};
};
module
.
exports
=
{
export
default
{
init
:
function
(
crossframe
)
{
init
:
function
(
crossframe
)
{
crossframe
.
on
(
events
.
FEATURE_FLAGS_UPDATED
,
_set
);
crossframe
.
on
(
events
.
FEATURE_FLAGS_UPDATED
,
_set
);
},
},
...
...
src/annotator/frame-observer.js
View file @
73dd54e1
let
FrameUtil
=
require
(
'./util/frame-util'
);
import
debounce
from
'lodash.debounce'
;
let
debounce
=
require
(
'lodash.debounce'
);
import
*
as
FrameUtil
from
'./util/frame-util'
;
// Find difference of two arrays
// Find difference of two arrays
let
difference
=
(
arrayA
,
arrayB
)
=>
{
let
difference
=
(
arrayA
,
arrayB
)
=>
{
return
arrayA
.
filter
(
x
=>
!
arrayB
.
includes
(
x
));
return
arrayA
.
filter
(
x
=>
!
arrayB
.
includes
(
x
));
};
};
const
DEBOUNCE_WAIT
=
40
;
export
const
DEBOUNCE_WAIT
=
40
;
class
FrameObserver
{
export
default
class
FrameObserver
{
constructor
(
target
)
{
constructor
(
target
)
{
this
.
_target
=
target
;
this
.
_target
=
target
;
this
.
_handledFrames
=
[];
this
.
_handledFrames
=
[];
...
@@ -70,6 +71,3 @@ class FrameObserver {
...
@@ -70,6 +71,3 @@ class FrameObserver {
}
}
}
}
}
}
FrameObserver
.
DEBOUNCE_WAIT
=
DEBOUNCE_WAIT
;
module
.
exports
=
FrameObserver
;
src/annotator/guest.coffee
View file @
73dd54e1
...
@@ -10,7 +10,7 @@ adder = require('./adder')
...
@@ -10,7 +10,7 @@ adder = require('./adder')
htmlAnchoring
=
require
(
'./anchoring/html'
)
htmlAnchoring
=
require
(
'./anchoring/html'
)
highlighter
=
require
(
'./highlighter'
)
highlighter
=
require
(
'./highlighter'
)
rangeUtil
=
require
(
'./range-util'
)
rangeUtil
=
require
(
'./range-util'
)
selections
=
require
(
'./selections'
)
{
default
:
selections
}
=
require
(
'./selections'
)
xpathRange
=
require
(
'./anchoring/range'
)
xpathRange
=
require
(
'./anchoring/range'
)
{
normalizeURI
}
=
require
(
'./util/url'
)
{
normalizeURI
}
=
require
(
'./util/url'
)
...
...
src/annotator/pdfjs-rendering-states.js
View file @
73dd54e1
...
@@ -12,4 +12,4 @@ const RenderingStates = {
...
@@ -12,4 +12,4 @@ const RenderingStates = {
FINISHED
:
3
,
FINISHED
:
3
,
};
};
module
.
exports
=
RenderingStates
;
export
default
RenderingStates
;
src/annotator/plugin/cross-frame.coffee
View file @
73dd54e1
Plugin
=
require
(
'../plugin'
)
Plugin
=
require
(
'../plugin'
)
AnnotationSync
=
require
(
'../annotation-sync'
)
{
default
:
AnnotationSync
}
=
require
(
'../annotation-sync'
)
Bridge
=
require
(
'../../shared/bridge'
)
{
default
:
Bridge
}
=
require
(
'../../shared/bridge'
)
Discovery
=
require
(
'../../shared/discovery'
)
{
default
:
Discovery
}
=
require
(
'../../shared/discovery'
)
FrameUtil
=
require
(
'../util/frame-util'
)
FrameUtil
=
require
(
'../util/frame-util'
)
FrameObserver
=
require
(
'../frame-observer'
)
{
default
:
FrameObserver
}
=
require
(
'../frame-observer'
)
# Extracts individual keys from an object and returns a new one.
# Extracts individual keys from an object and returns a new one.
extract
=
extract
=
(
obj
,
keys
...)
->
extract
=
extract
=
(
obj
,
keys
...)
->
...
...
src/annotator/plugin/pdf.coffee
View file @
73dd54e1
Plugin
=
require
(
'../plugin'
)
Plugin
=
require
(
'../plugin'
)
RenderingStates
=
require
(
'../pdfjs-rendering-states'
)
{
default
:
RenderingStates
}
=
require
(
'../pdfjs-rendering-states'
)
module
.
exports
=
class
PDF
extends
Plugin
module
.
exports
=
class
PDF
extends
Plugin
documentLoaded
:
null
documentLoaded
:
null
...
...
src/annotator/selections.js
View file @
73dd54e1
const
observable
=
require
(
'./util/observable'
)
;
import
*
as
observable
from
'./util/observable'
;
/** Returns the selected `DOMRange` in `document`. */
/** Returns the selected `DOMRange` in `document`. */
function
selectedRange
(
document
)
{
function
selectedRange
(
document
)
{
...
@@ -21,7 +21,7 @@ function selectedRange(document) {
...
@@ -21,7 +21,7 @@ function selectedRange(document) {
*
*
* @return Observable<DOMRange|null>
* @return Observable<DOMRange|null>
*/
*/
function
selections
(
document
)
{
export
default
function
selections
(
document
)
{
// Get a stream of selection changes that occur whilst the user is not
// Get a stream of selection changes that occur whilst the user is not
// making a selection with the mouse.
// making a selection with the mouse.
let
isMouseDown
;
let
isMouseDown
;
...
@@ -54,5 +54,3 @@ function selections(document) {
...
@@ -54,5 +54,3 @@ function selections(document) {
return
selectedRange
(
document
);
return
selectedRange
(
document
);
});
});
}
}
module
.
exports
=
selections
;
src/annotator/sidebar-trigger.js
View file @
73dd54e1
...
@@ -8,7 +8,7 @@ const SIDEBAR_TRIGGER_BTN_ATTR = 'data-hypothesis-trigger';
...
@@ -8,7 +8,7 @@ const SIDEBAR_TRIGGER_BTN_ATTR = 'data-hypothesis-trigger';
* @param {Object} showFn - Function which shows the sidebar.
* @param {Object} showFn - Function which shows the sidebar.
*/
*/
function
trigger
(
rootEl
,
showFn
)
{
export
default
function
trigger
(
rootEl
,
showFn
)
{
const
triggerElems
=
rootEl
.
querySelectorAll
(
const
triggerElems
=
rootEl
.
querySelectorAll
(
'['
+
SIDEBAR_TRIGGER_BTN_ATTR
+
']'
'['
+
SIDEBAR_TRIGGER_BTN_ATTR
+
']'
);
);
...
@@ -22,5 +22,3 @@ function trigger(rootEl, showFn) {
...
@@ -22,5 +22,3 @@ function trigger(rootEl, showFn) {
event
.
stopPropagation
();
event
.
stopPropagation
();
}
}
}
}
module
.
exports
=
trigger
;
src/annotator/sidebar.coffee
View file @
73dd54e1
...
@@ -3,10 +3,10 @@ raf = require('raf')
...
@@ -3,10 +3,10 @@ raf = require('raf')
Hammer
=
require
(
'hammerjs'
)
Hammer
=
require
(
'hammerjs'
)
Host
=
require
(
'./host'
)
Host
=
require
(
'./host'
)
annotationCounts
=
require
(
'./annotation-counts'
)
{
default
:
annotationCounts
}
=
require
(
'./annotation-counts'
)
sidebarTrigger
=
require
(
'./sidebar-trigger'
)
{
default
:
sidebarTrigger
}
=
require
(
'./sidebar-trigger'
)
events
=
require
(
'../shared/bridge-events'
)
{
default
:
events
}
=
require
(
'../shared/bridge-events'
)
features
=
require
(
'./features'
)
{
default
:
features
}
=
require
(
'./features'
)
# Minimum width to which the frame can be resized.
# Minimum width to which the frame can be resized.
MIN_RESIZE
=
280
MIN_RESIZE
=
280
...
...
src/annotator/test/sidebar-test.coffee
View file @
73dd54e1
events
=
require
(
'../../shared/bridge-events'
)
{
default
:
events
}
=
require
(
'../../shared/bridge-events'
)
Sidebar
=
require
(
'../sidebar'
)
Sidebar
=
require
(
'../sidebar'
)
{
$imports
}
=
require
(
'../sidebar'
)
{
$imports
}
=
require
(
'../sidebar'
)
...
...
src/shared/bridge-events.js
View file @
73dd54e1
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* This module defines the set of global events that are dispatched
* This module defines the set of global events that are dispatched
* across the bridge between the sidebar and annotator
* across the bridge between the sidebar and annotator
*/
*/
module
.
exports
=
{
export
default
{
// Events that the sidebar sends to the annotator
// Events that the sidebar sends to the annotator
// ----------------------------------------------
// ----------------------------------------------
...
...
src/shared/bridge.js
View file @
73dd54e1
const
extend
=
require
(
'extend'
)
;
import
extend
from
'extend'
;
const
RPC
=
require
(
'./frame-rpc'
)
;
import
RPC
from
'./frame-rpc'
;
/**
/**
* The Bridge service sets up a channel between frames and provides an events
* The Bridge service sets up a channel between frames and provides an events
* API on top of it.
* API on top of it.
*/
*/
class
Bridge
{
export
default
class
Bridge
{
constructor
()
{
constructor
()
{
this
.
links
=
[];
this
.
links
=
[];
this
.
channelListeners
=
{};
this
.
channelListeners
=
{};
...
@@ -167,5 +167,3 @@ class Bridge {
...
@@ -167,5 +167,3 @@ class Bridge {
return
this
;
return
this
;
}
}
}
}
module
.
exports
=
Bridge
;
src/shared/discovery.js
View file @
73dd54e1
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
* 5. Clients listen for "ack" messages. When they receive one from a server
* 5. Clients listen for "ack" messages. When they receive one from a server
* they call the callback to `startDiscovery`.
* they call the callback to `startDiscovery`.
*/
*/
class
Discovery
{
export
default
class
Discovery
{
/**
/**
* @param {Window} target
* @param {Window} target
* @param {Object} options
* @param {Object} options
...
@@ -227,5 +227,3 @@ class Discovery {
...
@@ -227,5 +227,3 @@ class Discovery {
.
replace
(
/
\D
/g
,
''
);
.
replace
(
/
\D
/g
,
''
);
}
}
}
}
module
.
exports
=
Discovery
;
src/shared/frame-rpc.js
View file @
73dd54e1
...
@@ -29,9 +29,7 @@
...
@@ -29,9 +29,7 @@
const
VERSION
=
'1.0.0'
;
const
VERSION
=
'1.0.0'
;
module
.
exports
=
RPC
;
export
default
function
RPC
(
src
,
dst
,
origin
,
methods
)
{
function
RPC
(
src
,
dst
,
origin
,
methods
)
{
if
(
!
(
this
instanceof
RPC
))
return
new
RPC
(
src
,
dst
,
origin
,
methods
);
if
(
!
(
this
instanceof
RPC
))
return
new
RPC
(
src
,
dst
,
origin
,
methods
);
const
self
=
this
;
const
self
=
this
;
this
.
src
=
src
;
this
.
src
=
src
;
...
...
src/shared/warn-once.js
View file @
73dd54e1
...
@@ -11,7 +11,7 @@ let shownWarnings = {};
...
@@ -11,7 +11,7 @@ let shownWarnings = {};
* are concatenated into a string key which is used to determine if the warning
* are concatenated into a string key which is used to determine if the warning
* has been logged before.
* has been logged before.
*/
*/
function
warnOnce
(...
args
)
{
export
default
function
warnOnce
(...
args
)
{
const
key
=
args
.
join
();
const
key
=
args
.
join
();
if
(
key
in
shownWarnings
)
{
if
(
key
in
shownWarnings
)
{
return
;
return
;
...
@@ -23,5 +23,3 @@ function warnOnce(...args) {
...
@@ -23,5 +23,3 @@ function warnOnce(...args) {
warnOnce
.
reset
=
()
=>
{
warnOnce
.
reset
=
()
=>
{
shownWarnings
=
{};
shownWarnings
=
{};
};
};
module
.
exports
=
warnOnce
;
src/sidebar/services/test/persisted-defaults-test.js
View file @
73dd54e1
import
fakeReduxStore
from
'../../test/fake-redux-store'
;
import
fakeReduxStore
from
'../../test/fake-redux-store'
;
import
persistedDefaults
from
'../persisted-defaults'
;
import
persistedDefaults
from
'../persisted-defaults'
;
const
DEFAULT_KEYS
=
{
const
DEFAULT_KEYS
=
{
...
...
yarn.lock
View file @
73dd54e1
...
@@ -1453,9 +1453,9 @@ babel-plugin-istanbul@^6.0.0:
...
@@ -1453,9 +1453,9 @@ babel-plugin-istanbul@^6.0.0:
test-exclude "^6.0.0"
test-exclude "^6.0.0"
babel-plugin-mockable-imports@^1.5.1:
babel-plugin-mockable-imports@^1.5.1:
version "1.
5.2
"
version "1.
6.0
"
resolved "https://registry.yarnpkg.com/babel-plugin-mockable-imports/-/babel-plugin-mockable-imports-1.
5.2.tgz#bd2095f0c10496ca74de236a7ee096b0062abb74
"
resolved "https://registry.yarnpkg.com/babel-plugin-mockable-imports/-/babel-plugin-mockable-imports-1.
6.0.tgz#ae8c817327bc84a6258915456934d7d8d5a67999
"
integrity sha512-
R2UdySrsMaOr/6Jrj27V5Ryy6Gpt7d398fggqtZ3fd1/OF2rpJcb9ymjbGx2NLm4P9NQyvqAU570YtgWmA71RA
==
integrity sha512-
+CpQXtdmLBT/AaU4lM2EFwE5DnYVtHprpmzSrQls0Zd0FaHcGKJPdN10PQMachMNVh38rADXTd5TwGNMvHW85g
==
babel-plugin-transform-async-to-promises@^0.8.6:
babel-plugin-transform-async-to-promises@^0.8.6:
version "0.8.15"
version "0.8.15"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment