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
Show 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'
;
...
...
@@ -10,7 +10,7 @@ const ANNOTATION_COUNT_ATTR = 'data-hypothesis-annotation-count';
* display annotation count.
*/
function
annotationCounts
(
rootEl
,
crossframe
)
{
export
default
function
annotationCounts
(
rootEl
,
crossframe
)
{
crossframe
.
on
(
events
.
PUBLIC_ANNOTATION_COUNT_CHANGED
,
updateAnnotationCountElems
...
...
@@ -23,5 +23,3 @@ function annotationCounts(rootEl, crossframe) {
});
}
}
module
.
exports
=
annotationCounts
;
src/annotator/annotation-sync.js
View file @
73dd54e1
...
...
@@ -3,7 +3,7 @@
//
// It also listens for events from Guest when new annotations are created or
// annotations successfully anchor and relays these to the sidebar app.
function
AnnotationSync
(
bridge
,
options
)
{
export
default
function
AnnotationSync
(
bridge
,
options
)
{
const
self
=
this
;
this
.
bridge
=
bridge
;
...
...
@@ -174,5 +174,3 @@ AnnotationSync.prototype._format = function(ann) {
msg
:
ann
,
};
};
module
.
exports
=
AnnotationSync
;
src/annotator/features.js
View file @
73dd54e1
const
events
=
require
(
'../shared/bridge-events'
)
;
const
warnOnce
=
require
(
'../shared/warn-once'
)
;
import
events
from
'../shared/bridge-events'
;
import
warnOnce
from
'../shared/warn-once'
;
let
_features
=
{};
...
...
@@ -7,7 +7,7 @@ const _set = features => {
_features
=
features
||
{};
};
module
.
exports
=
{
export
default
{
init
:
function
(
crossframe
)
{
crossframe
.
on
(
events
.
FEATURE_FLAGS_UPDATED
,
_set
);
},
...
...
src/annotator/frame-observer.js
View file @
73dd54e1
let
FrameUtil
=
require
(
'./util/frame-util'
);
let
debounce
=
require
(
'lodash.debounce'
);
import
debounce
from
'lodash.debounce'
;
import
*
as
FrameUtil
from
'./util/frame-util'
;
// Find difference of two arrays
let
difference
=
(
arrayA
,
arrayB
)
=>
{
return
arrayA
.
filter
(
x
=>
!
arrayB
.
includes
(
x
));
};
const
DEBOUNCE_WAIT
=
40
;
export
const
DEBOUNCE_WAIT
=
40
;
class
FrameObserver
{
export
default
class
FrameObserver
{
constructor
(
target
)
{
this
.
_target
=
target
;
this
.
_handledFrames
=
[];
...
...
@@ -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')
htmlAnchoring
=
require
(
'./anchoring/html'
)
highlighter
=
require
(
'./highlighter'
)
rangeUtil
=
require
(
'./range-util'
)
selections
=
require
(
'./selections'
)
{
default
:
selections
}
=
require
(
'./selections'
)
xpathRange
=
require
(
'./anchoring/range'
)
{
normalizeURI
}
=
require
(
'./util/url'
)
...
...
src/annotator/pdfjs-rendering-states.js
View file @
73dd54e1
...
...
@@ -12,4 +12,4 @@ const RenderingStates = {
FINISHED
:
3
,
};
module
.
exports
=
RenderingStates
;
export
default
RenderingStates
;
src/annotator/plugin/cross-frame.coffee
View file @
73dd54e1
Plugin
=
require
(
'../plugin'
)
AnnotationSync
=
require
(
'../annotation-sync'
)
Bridge
=
require
(
'../../shared/bridge'
)
Discovery
=
require
(
'../../shared/discovery'
)
{
default
:
AnnotationSync
}
=
require
(
'../annotation-sync'
)
{
default
:
Bridge
}
=
require
(
'../../shared/bridge'
)
{
default
:
Discovery
}
=
require
(
'../../shared/discovery'
)
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.
extract
=
extract
=
(
obj
,
keys
...)
->
...
...
src/annotator/plugin/pdf.coffee
View file @
73dd54e1
Plugin
=
require
(
'../plugin'
)
RenderingStates
=
require
(
'../pdfjs-rendering-states'
)
{
default
:
RenderingStates
}
=
require
(
'../pdfjs-rendering-states'
)
module
.
exports
=
class
PDF
extends
Plugin
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`. */
function
selectedRange
(
document
)
{
...
...
@@ -21,7 +21,7 @@ function selectedRange(document) {
*
* @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
// making a selection with the mouse.
let
isMouseDown
;
...
...
@@ -54,5 +54,3 @@ function selections(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';
* @param {Object} showFn - Function which shows the sidebar.
*/
function
trigger
(
rootEl
,
showFn
)
{
export
default
function
trigger
(
rootEl
,
showFn
)
{
const
triggerElems
=
rootEl
.
querySelectorAll
(
'['
+
SIDEBAR_TRIGGER_BTN_ATTR
+
']'
);
...
...
@@ -22,5 +22,3 @@ function trigger(rootEl, showFn) {
event
.
stopPropagation
();
}
}
module
.
exports
=
trigger
;
src/annotator/sidebar.coffee
View file @
73dd54e1
...
...
@@ -3,10 +3,10 @@ raf = require('raf')
Hammer
=
require
(
'hammerjs'
)
Host
=
require
(
'./host'
)
annotationCounts
=
require
(
'./annotation-counts'
)
sidebarTrigger
=
require
(
'./sidebar-trigger'
)
events
=
require
(
'../shared/bridge-events'
)
features
=
require
(
'./features'
)
{
default
:
annotationCounts
}
=
require
(
'./annotation-counts'
)
{
default
:
sidebarTrigger
}
=
require
(
'./sidebar-trigger'
)
{
default
:
events
}
=
require
(
'../shared/bridge-events'
)
{
default
:
features
}
=
require
(
'./features'
)
# Minimum width to which the frame can be resized.
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'
)
{
$imports
}
=
require
(
'../sidebar'
)
...
...
src/shared/bridge-events.js
View file @
73dd54e1
...
...
@@ -2,7 +2,7 @@
* This module defines the set of global events that are dispatched
* across the bridge between the sidebar and annotator
*/
module
.
exports
=
{
export
default
{
// 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
* API on top of it.
*/
class
Bridge
{
export
default
class
Bridge
{
constructor
()
{
this
.
links
=
[];
this
.
channelListeners
=
{};
...
...
@@ -167,5 +167,3 @@ class Bridge {
return
this
;
}
}
module
.
exports
=
Bridge
;
src/shared/discovery.js
View file @
73dd54e1
...
...
@@ -30,7 +30,7 @@
* 5. Clients listen for "ack" messages. When they receive one from a server
* they call the callback to `startDiscovery`.
*/
class
Discovery
{
export
default
class
Discovery
{
/**
* @param {Window} target
* @param {Object} options
...
...
@@ -227,5 +227,3 @@ class Discovery {
.
replace
(
/
\D
/g
,
''
);
}
}
module
.
exports
=
Discovery
;
src/shared/frame-rpc.js
View file @
73dd54e1
...
...
@@ -29,9 +29,7 @@
const
VERSION
=
'1.0.0'
;
module
.
exports
=
RPC
;
function
RPC
(
src
,
dst
,
origin
,
methods
)
{
export
default
function
RPC
(
src
,
dst
,
origin
,
methods
)
{
if
(
!
(
this
instanceof
RPC
))
return
new
RPC
(
src
,
dst
,
origin
,
methods
);
const
self
=
this
;
this
.
src
=
src
;
...
...
src/shared/warn-once.js
View file @
73dd54e1
...
...
@@ -11,7 +11,7 @@ let shownWarnings = {};
* are concatenated into a string key which is used to determine if the warning
* has been logged before.
*/
function
warnOnce
(...
args
)
{
export
default
function
warnOnce
(...
args
)
{
const
key
=
args
.
join
();
if
(
key
in
shownWarnings
)
{
return
;
...
...
@@ -23,5 +23,3 @@ function warnOnce(...args) {
warnOnce
.
reset
=
()
=>
{
shownWarnings
=
{};
};
module
.
exports
=
warnOnce
;
src/sidebar/services/test/persisted-defaults-test.js
View file @
73dd54e1
import
fakeReduxStore
from
'../../test/fake-redux-store'
;
import
persistedDefaults
from
'../persisted-defaults'
;
const
DEFAULT_KEYS
=
{
...
...
yarn.lock
View file @
73dd54e1
...
...
@@ -1453,9 +1453,9 @@ babel-plugin-istanbul@^6.0.0:
test-exclude "^6.0.0"
babel-plugin-mockable-imports@^1.5.1:
version "1.
5.2
"
resolved "https://registry.yarnpkg.com/babel-plugin-mockable-imports/-/babel-plugin-mockable-imports-1.
5.2.tgz#bd2095f0c10496ca74de236a7ee096b0062abb74
"
integrity sha512-
R2UdySrsMaOr/6Jrj27V5Ryy6Gpt7d398fggqtZ3fd1/OF2rpJcb9ymjbGx2NLm4P9NQyvqAU570YtgWmA71RA
==
version "1.
6.0
"
resolved "https://registry.yarnpkg.com/babel-plugin-mockable-imports/-/babel-plugin-mockable-imports-1.
6.0.tgz#ae8c817327bc84a6258915456934d7d8d5a67999
"
integrity sha512-
+CpQXtdmLBT/AaU4lM2EFwE5DnYVtHprpmzSrQls0Zd0FaHcGKJPdN10PQMachMNVh38rADXTd5TwGNMvHW85g
==
babel-plugin-transform-async-to-promises@^0.8.6:
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