Unverified Commit db679988 authored by Robert Knight's avatar Robert Knight Committed by GitHub

Merge pull request #1673 from hypothesis/convert-services-to-es-modules

Convert src/sidebar/services to ES modules
parents 248458e4 a165c422
const VIA_REFERRER = /^https:\/\/(qa-)?via.hypothes.is\//; const VIA_REFERRER = /^https:\/\/(qa-)?via.hypothes.is\//;
const events = { export const events = {
ANNOTATION_CREATED: 'annotationCreated', ANNOTATION_CREATED: 'annotationCreated',
ANNOTATION_DELETED: 'annotationDeleted', ANNOTATION_DELETED: 'annotationDeleted',
ANNOTATION_FLAGGED: 'annotationFlagged', ANNOTATION_FLAGGED: 'annotationFlagged',
...@@ -70,7 +70,7 @@ function clientType(win, settings = {}) { ...@@ -70,7 +70,7 @@ function clientType(win, settings = {}) {
* application. * application.
*/ */
// @ngInject // @ngInject
function analytics($window, settings) { export default function analytics($window, settings) {
const category = clientType($window, settings); const category = clientType($window, settings);
const noop = () => {}; const noop = () => {};
...@@ -117,7 +117,3 @@ function analytics($window, settings) { ...@@ -117,7 +117,3 @@ function analytics($window, settings) {
events, events,
}; };
} }
analytics.events = events;
module.exports = analytics;
const angular = require('angular'); import angular from 'angular';
const events = require('../events'); import events from '../events';
function getExistingAnnotation(store, id) { function getExistingAnnotation(store, id) {
return store.getState().annotations.annotations.find(function(annot) { return store.getState().annotations.annotations.find(function(annot) {
...@@ -10,7 +10,7 @@ function getExistingAnnotation(store, id) { ...@@ -10,7 +10,7 @@ function getExistingAnnotation(store, id) {
// Wraps the annotation store to trigger events for the CRUD actions // Wraps the annotation store to trigger events for the CRUD actions
// @ngInject // @ngInject
function annotationMapper($rootScope, store, api) { export default function annotationMapper($rootScope, store, api) {
function loadAnnotations(annotations, replies) { function loadAnnotations(annotations, replies) {
annotations = annotations.concat(replies || []); annotations = annotations.concat(replies || []);
...@@ -73,5 +73,3 @@ function annotationMapper($rootScope, store, api) { ...@@ -73,5 +73,3 @@ function annotationMapper($rootScope, store, api) {
flagAnnotation: flagAnnotation, flagAnnotation: flagAnnotation,
}; };
} }
module.exports = annotationMapper;
const SearchClient = require('../search-client'); import SearchClient from '../search-client';
// @ngInject // @ngInject
function annotations(annotationMapper, api, store, streamer, streamFilter) { export default function annotations(
annotationMapper,
api,
store,
streamer,
streamFilter
) {
let searchClient = null; let searchClient = null;
/** /**
...@@ -57,5 +63,3 @@ function annotations(annotationMapper, api, store, streamer, streamFilter) { ...@@ -57,5 +63,3 @@ function annotations(annotationMapper, api, store, streamer, streamFilter) {
load, load,
}; };
} }
module.exports = annotations;
const { retryPromiseOperation } = require('../util/retry'); import { retryPromiseOperation } from '../util/retry';
/** /**
* A service which fetches and caches API route metadata. * A service which fetches and caches API route metadata.
*/ */
// @ngInject // @ngInject
function apiRoutes(settings) { export default function apiRoutes(settings) {
// Cache of route name => route metadata from API root. // Cache of route name => route metadata from API root.
let routeCache; let routeCache;
// Cache of links to pages on the service fetched from the API's "links" // Cache of links to pages on the service fetched from the API's "links"
...@@ -57,5 +57,3 @@ function apiRoutes(settings) { ...@@ -57,5 +57,3 @@ function apiRoutes(settings) {
return { routes, links }; return { routes, links };
} }
module.exports = apiRoutes;
const get = require('lodash.get'); import get from 'lodash.get';
const queryString = require('query-string'); import * as queryString from 'query-string';
const { replaceURLParams } = require('../util/url'); import { replaceURLParams } from '../util/url';
/** /**
* Translate the response from a failed API call into an Error-like object. * Translate the response from a failed API call into an Error-like object.
...@@ -189,7 +189,7 @@ function createAPICall( ...@@ -189,7 +189,7 @@ function createAPICall(
* not use authentication. * not use authentication.
*/ */
// @ngInject // @ngInject
function api(apiRoutes, auth, store) { export default function api(apiRoutes, auth, store) {
const links = apiRoutes.routes(); const links = apiRoutes.routes();
let clientId = null; let clientId = null;
...@@ -247,5 +247,3 @@ function api(apiRoutes, auth, store) { ...@@ -247,5 +247,3 @@ function api(apiRoutes, auth, store) {
// from the `apiRoutes` service. // from the `apiRoutes` service.
}; };
} }
module.exports = api;
...@@ -9,12 +9,13 @@ ...@@ -9,12 +9,13 @@
* change at any time and should write code accordingly. Feature flags should * change at any time and should write code accordingly. Feature flags should
* not be cached, and should not be interrogated only at setup time. * not be cached, and should not be interrogated only at setup time.
*/ */
const events = require('../events');
const bridgeEvents = require('../../shared/bridge-events'); import bridgeEvents from '../../shared/bridge-events';
const warnOnce = require('../../shared/warn-once'); import warnOnce from '../../shared/warn-once';
import events from '../events';
// @ngInject // @ngInject
function features($rootScope, bridge, session) { export default function features($rootScope, bridge, session) {
const _sendFeatureFlags = function() { const _sendFeatureFlags = function() {
const userFeatures = session.state.features; const userFeatures = session.state.features;
bridge.call(bridgeEvents.FEATURE_FLAGS_UPDATED, userFeatures || {}); bridge.call(bridgeEvents.FEATURE_FLAGS_UPDATED, userFeatures || {});
...@@ -59,5 +60,3 @@ function features($rootScope, bridge, session) { ...@@ -59,5 +60,3 @@ function features($rootScope, bridge, session) {
flagEnabled: flagEnabled, flagEnabled: flagEnabled,
}; };
} }
module.exports = features;
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
*/ */
// @ngInject // @ngInject
function flash(toastr) { export default function flash(toastr) {
return { return {
info: toastr.info.bind(toastr), info: toastr.info.bind(toastr),
success: toastr.success.bind(toastr), success: toastr.success.bind(toastr),
...@@ -11,5 +11,3 @@ function flash(toastr) { ...@@ -11,5 +11,3 @@ function flash(toastr) {
error: toastr.error.bind(toastr), error: toastr.error.bind(toastr),
}; };
} }
module.exports = flash;
const debounce = require('lodash.debounce'); import debounce from 'lodash.debounce';
const events = require('../events'); import bridgeEvents from '../../shared/bridge-events';
const bridgeEvents = require('../../shared/bridge-events'); import events from '../events';
const metadata = require('../util/annotation-metadata'); import uiConstants from '../ui-constants';
const uiConstants = require('../ui-constants'); import * as metadata from '../util/annotation-metadata';
/** /**
* @typedef FrameInfo * @typedef FrameInfo
......
...@@ -11,13 +11,13 @@ const DEFAULT_ORGANIZATION = { ...@@ -11,13 +11,13 @@ const DEFAULT_ORGANIZATION = {
encodeURIComponent(require('../../images/icons/logo.svg')), encodeURIComponent(require('../../images/icons/logo.svg')),
}; };
const events = require('../events'); import events from '../events';
const { awaitStateChange } = require('../util/state'); import serviceConfig from '../service-config';
const { combineGroups } = require('../util/groups'); import { combineGroups } from '../util/groups';
const serviceConfig = require('../service-config'); import { awaitStateChange } from '../util/state';
// @ngInject // @ngInject
function groups( export default function groups(
$rootScope, $rootScope,
store, store,
api, api,
...@@ -372,5 +372,3 @@ function groups( ...@@ -372,5 +372,3 @@ function groups(
focus: focus, focus: focus,
}; };
} }
module.exports = groups;
...@@ -25,7 +25,7 @@ class InMemoryStorage { ...@@ -25,7 +25,7 @@ class InMemoryStorage {
* in third-party iframes. * in third-party iframes.
*/ */
// @ngInject // @ngInject
function localStorage($window) { export default function localStorage($window) {
let storage; let storage;
let testKey = 'hypothesis.testKey'; let testKey = 'hypothesis.testKey';
...@@ -63,5 +63,3 @@ function localStorage($window) { ...@@ -63,5 +63,3 @@ function localStorage($window) {
}, },
}; };
} }
module.exports = localStorage;
const events = require('../events'); import events from '../events';
const { resolve } = require('../util/url'); import serviceConfig from '../service-config';
const serviceConfig = require('../service-config'); import { resolve } from '../util/url';
/** /**
* @typedef RefreshOptions * @typedef RefreshOptions
...@@ -21,7 +21,7 @@ const serviceConfig = require('../service-config'); ...@@ -21,7 +21,7 @@ const serviceConfig = require('../service-config');
* Interaction with OAuth endpoints in the annotation service is delegated to * Interaction with OAuth endpoints in the annotation service is delegated to
* the `OAuthClient` class. * the `OAuthClient` class.
*/ */
function auth( export default function auth(
$rootScope, $rootScope,
$window, $window,
OAuthClient, OAuthClient,
...@@ -311,5 +311,3 @@ auth.$inject = [ ...@@ -311,5 +311,3 @@ auth.$inject = [
'localStorage', 'localStorage',
'settings', 'settings',
]; ];
module.exports = auth;
...@@ -23,7 +23,7 @@ const STORAGE_KEY = 'hypothesis.privacy'; ...@@ -23,7 +23,7 @@ const STORAGE_KEY = 'hypothesis.privacy';
* annotations to local storage. * annotations to local storage.
*/ */
// @ngInject // @ngInject
function Permissions(localStorage) { export default function Permissions(localStorage) {
const self = this; const self = this;
function defaultLevel() { function defaultLevel() {
...@@ -125,5 +125,3 @@ function Permissions(localStorage) { ...@@ -125,5 +125,3 @@ function Permissions(localStorage) {
return perms[action].indexOf(userid) !== -1; return perms[action].indexOf(userid) !== -1;
}; };
} }
module.exports = Permissions;
const buildThread = require('../build-thread'); import buildThread from '../build-thread';
const events = require('../events'); import events from '../events';
const memoize = require('../util/memoize'); import * as metadata from '../util/annotation-metadata';
const metadata = require('../util/annotation-metadata'); import memoize from '../util/memoize';
const tabs = require('../util/tabs'); import * as tabs from '../util/tabs';
function truthyKeys(map) { function truthyKeys(map) {
return Object.keys(map).filter(function(k) { return Object.keys(map).filter(function(k) {
...@@ -37,7 +37,12 @@ const sortFns = { ...@@ -37,7 +37,12 @@ const sortFns = {
* The root thread is then displayed by viewer.html * The root thread is then displayed by viewer.html
*/ */
// @ngInject // @ngInject
function RootThread($rootScope, store, searchFilter, viewFilter) { export default function RootThread(
$rootScope,
store,
searchFilter,
viewFilter
) {
/** /**
* Build the root conversation thread from the given UI state. * Build the root conversation thread from the given UI state.
* *
...@@ -145,5 +150,3 @@ function RootThread($rootScope, store, searchFilter, viewFilter) { ...@@ -145,5 +150,3 @@ function RootThread($rootScope, store, searchFilter, viewFilter) {
*/ */
this.thread = memoize(buildRootThread); this.thread = memoize(buildRootThread);
} }
module.exports = RootThread;
...@@ -259,11 +259,9 @@ function generateFacetedFilter(searchtext, focusFilters = {}) { ...@@ -259,11 +259,9 @@ function generateFacetedFilter(searchtext, focusFilters = {}) {
* filter annotations displayed to the user or fetched from the API. * filter annotations displayed to the user or fetched from the API.
*/ */
// @ngInject // @ngInject
function searchFilter() { export default function searchFilter() {
return { return {
toObject, toObject,
generateFacetedFilter, generateFacetedFilter,
}; };
} }
module.exports = searchFilter;
const urlUtil = require('../util/url'); import * as urlUtil from '../util/url';
/** /**
* A function that returns an absolute URL given a link name and params, by * A function that returns an absolute URL given a link name and params, by
...@@ -31,7 +31,7 @@ const urlUtil = require('../util/url'); ...@@ -31,7 +31,7 @@ const urlUtil = require('../util/url');
* *
* @ngInject * @ngInject
*/ */
function serviceUrl(store, apiRoutes) { export default function serviceUrl(store, apiRoutes) {
apiRoutes apiRoutes
.links() .links()
.then(store.updateLinks) .then(store.updateLinks)
...@@ -63,5 +63,3 @@ function serviceUrl(store, apiRoutes) { ...@@ -63,5 +63,3 @@ function serviceUrl(store, apiRoutes) {
return url.url; return url.url;
}; };
} }
module.exports = serviceUrl;
const events = require('../events'); import events from '../events';
const retryUtil = require('../util/retry'); import * as retryUtil from '../util/retry';
const sentry = require('../util/sentry'); import * as sentry from '../util/sentry';
const CACHE_TTL = 5 * 60 * 1000; // 5 minutes const CACHE_TTL = 5 * 60 * 1000; // 5 minutes
...@@ -19,7 +19,7 @@ const CACHE_TTL = 5 * 60 * 1000; // 5 minutes ...@@ -19,7 +19,7 @@ const CACHE_TTL = 5 * 60 * 1000; // 5 minutes
* *
* @ngInject * @ngInject
*/ */
function session( export default function session(
$rootScope, $rootScope,
analytics, analytics,
store, store,
...@@ -188,5 +188,3 @@ function session( ...@@ -188,5 +188,3 @@ function session(
update, update,
}; };
} }
module.exports = session;
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* See https://github.com/hypothesis/h/blob/master/h/streamer/filter.py * See https://github.com/hypothesis/h/blob/master/h/streamer/filter.py
* for the schema. * for the schema.
*/ */
class StreamFilter { export default class StreamFilter {
constructor() { constructor() {
this.resetFilter(); this.resetFilter();
} }
...@@ -47,5 +47,3 @@ class StreamFilter { ...@@ -47,5 +47,3 @@ class StreamFilter {
return this; return this;
} }
} }
module.exports = StreamFilter;
const queryString = require('query-string'); import uuid from 'node-uuid';
const uuid = require('node-uuid'); import * as queryString from 'query-string';
const warnOnce = require('../../shared/warn-once'); import warnOnce from '../../shared/warn-once';
import Socket from '../websocket';
const Socket = require('../websocket');
/** /**
* Open a new WebSocket connection to the Hypothesis push notification service. * Open a new WebSocket connection to the Hypothesis push notification service.
...@@ -19,7 +18,7 @@ const Socket = require('../websocket'); ...@@ -19,7 +18,7 @@ const Socket = require('../websocket');
* @param settings - Application settings * @param settings - Application settings
*/ */
// @ngInject // @ngInject
function Streamer( export default function Streamer(
$rootScope, $rootScope,
annotationMapper, annotationMapper,
store, store,
...@@ -236,5 +235,3 @@ function Streamer( ...@@ -236,5 +235,3 @@ function Streamer(
this.reconnect = reconnect; this.reconnect = reconnect;
this.setConfig = setConfig; this.setConfig = setConfig;
} }
module.exports = Streamer;
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* on frequency of usage. * on frequency of usage.
*/ */
// @ngInject // @ngInject
function tags(localStorage) { export default function tags(localStorage) {
const TAGS_LIST_KEY = 'hypothesis.user.tags.list'; const TAGS_LIST_KEY = 'hypothesis.user.tags.list';
const TAGS_MAP_KEY = 'hypothesis.user.tags.map'; const TAGS_MAP_KEY = 'hypothesis.user.tags.map';
...@@ -78,5 +78,3 @@ function tags(localStorage) { ...@@ -78,5 +78,3 @@ function tags(localStorage) {
store, store,
}; };
} }
module.exports = tags;
const analyticsService = require('../analytics'); import analyticsService from '../analytics';
describe('analytics', function() { describe('analytics', function() {
let $windowStub; let $windowStub;
......
const angular = require('angular'); import angular from 'angular';
const immutable = require('seamless-immutable'); import immutable from 'seamless-immutable';
const annotationMapperFactory = require('../annotation-mapper'); import events from '../../events';
const storeFactory = require('../../store'); import storeFactory from '../../store';
const events = require('../../events'); import annotationMapperFactory from '../annotation-mapper';
describe('annotationMapper', function() { describe('annotationMapper', function() {
const sandbox = sinon.createSandbox(); const sandbox = sinon.createSandbox();
......
const EventEmitter = require('tiny-emitter'); import EventEmitter from 'tiny-emitter';
const annotations = require('../annotations'); import annotations from '../annotations';
const { $imports } = require('../annotations'); import { $imports } from '../annotations';
let searchClients; let searchClients;
let longRunningSearchClient = false; let longRunningSearchClient = false;
......
const apiRoutesFactory = require('../api-routes'); import apiRoutesFactory from '../api-routes';
// Abridged version of the response returned by https://hypothes.is/api, // Abridged version of the response returned by https://hypothes.is/api,
// with the domain name changed. // with the domain name changed.
......
const fetchMock = require('fetch-mock'); import fetchMock from 'fetch-mock';
const apiFactory = require('../api'); import apiFactory from '../api';
// API route directory. // API route directory.
// //
......
const features = require('../features'); import bridgeEvents from '../../../shared/bridge-events';
const { $imports } = require('../features'); import events from '../../events';
const events = require('../../events'); import features from '../features';
const bridgeEvents = require('../../../shared/bridge-events'); import { $imports } from '../features';
describe('h:features - sidebar layer', function() { describe('h:features - sidebar layer', function() {
let fakeBridge; let fakeBridge;
......
const flash = require('../flash'); import flash from '../flash';
describe('sidebar.flash', () => { describe('sidebar.flash', () => {
['info', 'success', 'warning', 'error'].forEach(method => { ['info', 'success', 'warning', 'error'].forEach(method => {
......
const angular = require('angular'); import angular from 'angular';
const EventEmitter = require('tiny-emitter'); import EventEmitter from 'tiny-emitter';
const annotationFixtures = require('../../test/annotation-fixtures'); import events from '../../events';
const events = require('../../events'); import * as annotationFixtures from '../../test/annotation-fixtures';
const createFakeStore = require('../../test/fake-redux-store'); import createFakeStore from '../../test/fake-redux-store';
const { default: FrameSync, formatAnnot } = require('../frame-sync'); import uiConstants from '../../ui-constants';
const uiConstants = require('../../ui-constants'); import FrameSync, { formatAnnot } from '../frame-sync';
const fixtures = { const fixtures = {
ann: Object.assign({ $tag: 't1' }, annotationFixtures.defaultAnnotation()), ann: Object.assign({ $tag: 't1' }, annotationFixtures.defaultAnnotation()),
......
const events = require('../../events'); import events from '../../events';
const fakeReduxStore = require('../../test/fake-redux-store'); import fakeReduxStore from '../../test/fake-redux-store';
const groups = require('../groups'); import groups from '../groups';
/** /**
* Generate a truth table containing every possible combination of a set of * Generate a truth table containing every possible combination of a set of
......
const angular = require('angular'); import angular from 'angular';
const service = require('../local-storage');
import service from '../local-storage';
function windowWithLocalStoragePropertyThatThrows() { function windowWithLocalStoragePropertyThatThrows() {
const win = {}; const win = {};
......
const angular = require('angular'); import angular from 'angular';
const authFactory = require('../oauth-auth'); import events from '../../events';
const events = require('../../events'); import FakeWindow from '../../util/test/fake-window';
import authFactory from '../oauth-auth';
const FakeWindow = require('../../util/test/fake-window');
const DEFAULT_TOKEN_EXPIRES_IN_SECS = 1000; const DEFAULT_TOKEN_EXPIRES_IN_SECS = 1000;
const TOKEN_KEY = 'hypothesis.oauth.hypothes%2Eis.token'; const TOKEN_KEY = 'hypothesis.oauth.hypothes%2Eis.token';
......
const Permissions = require('../permissions'); import Permissions from '../permissions';
const userid = 'acct:flash@gord.on'; const userid = 'acct:flash@gord.on';
......
const angular = require('angular'); import angular from 'angular';
const immutable = require('seamless-immutable'); import immutable from 'seamless-immutable';
const annotationFixtures = require('../../test/annotation-fixtures'); import events from '../../events';
const events = require('../../events'); import * as annotationFixtures from '../../test/annotation-fixtures';
const uiConstants = require('../../ui-constants'); import uiConstants from '../../ui-constants';
const rootThreadFactory = require('../root-thread'); import rootThreadFactory from '../root-thread';
const { $imports } = require('../root-thread'); import { $imports } from '../root-thread';
const fixtures = immutable({ const fixtures = immutable({
emptyThread: { emptyThread: {
......
const searchFilterFactory = require('../search-filter'); import searchFilterFactory from '../search-filter';
const searchFilter = searchFilterFactory(); const searchFilter = searchFilterFactory();
......
const serviceUrlFactory = require('../service-url'); import serviceUrlFactory from '../service-url';
const { $imports } = require('../service-url'); import { $imports } from '../service-url';
/** Return a fake store object. */ /** Return a fake store object. */
function fakeStore() { function fakeStore() {
......
const angular = require('angular'); import angular from 'angular';
const events = require('../../events'); import events from '../../events';
const { events: analyticsEvents } = require('../analytics'); import { events as analyticsEvents } from '../analytics';
const sessionFactory = require('../session'); import sessionFactory from '../session';
const { $imports } = require('../session'); import { $imports } from '../session';
const mock = angular.mock; const mock = angular.mock;
......
const StreamFilter = require('../stream-filter'); import StreamFilter from '../stream-filter';
describe('sidebar/services/stream-filter', () => { describe('sidebar/services/stream-filter', () => {
describe('#addClause', () => { describe('#addClause', () => {
......
const EventEmitter = require('tiny-emitter'); import EventEmitter from 'tiny-emitter';
const Streamer = require('../streamer'); import Streamer from '../streamer';
const { $imports } = require('../streamer'); import { $imports } from '../streamer';
const fixtures = { const fixtures = {
createNotification: { createNotification: {
......
const angular = require('angular'); import angular from 'angular';
const tagsFactory = require('../tags'); import tagsFactory from '../tags';
const TAGS_LIST_KEY = 'hypothesis.user.tags.list'; const TAGS_LIST_KEY = 'hypothesis.user.tags.list';
const TAGS_MAP_KEY = 'hypothesis.user.tags.map'; const TAGS_MAP_KEY = 'hypothesis.user.tags.map';
......
const unicodeFactory = require('../unicode'); import unicodeFactory from '../unicode';
const unicode = unicodeFactory(); const unicode = unicodeFactory();
......
const ViewFilter = require('../view-filter'); import ViewFilter from '../view-filter';
function isoDateWithAge(age) { function isoDateWithAge(age) {
return new Date(Date.now() - age * 1000).toISOString(); return new Date(Date.now() - age * 1000).toISOString();
......
...@@ -10,11 +10,9 @@ ...@@ -10,11 +10,9 @@
const COMBINING_MARKS = /[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E4-\u08FE\u0900-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C01-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C82\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D02\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u192B\u1930-\u193B\u19B0-\u19C0\u19C8\u19C9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1DC0-\u1DE6\u1DFC-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE26]/g; const COMBINING_MARKS = /[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E4-\u08FE\u0900-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C01-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C82\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D02\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u192B\u1930-\u193B\u19B0-\u19C0\u19C8\u19C9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1DC0-\u1DE6\u1DFC-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE26]/g;
// @ngInject // @ngInject
function unicode() { export default function unicode() {
return { return {
normalize: str => str.normalize('NFKD'), normalize: str => str.normalize('NFKD'),
fold: str => str.replace(COMBINING_MARKS, ''), fold: str => str.replace(COMBINING_MARKS, ''),
}; };
} }
module.exports = unicode;
const { quote } = require('../util/annotation-metadata'); import { quote } from '../util/annotation-metadata';
// Prevent Babel inserting helper code after `@ngInject` comment below which // Prevent Babel inserting helper code after `@ngInject` comment below which
// breaks browserify-ngannotate. // breaks browserify-ngannotate.
...@@ -20,7 +20,7 @@ function displayName(ann) { ...@@ -20,7 +20,7 @@ function displayName(ann) {
* which do not match the filter are then hidden. * which do not match the filter are then hidden.
*/ */
// @ngInject // @ngInject
function viewFilter(unicode) { export default function viewFilter(unicode) {
/** /**
* Normalize a field value or query term for comparison. * Normalize a field value or query term for comparison.
*/ */
...@@ -176,5 +176,3 @@ function viewFilter(unicode) { ...@@ -176,5 +176,3 @@ function viewFilter(unicode) {
.map(ann => ann.id); .map(ann => ann.id);
}; };
} }
module.exports = viewFilter;
const angular = require('angular'); import angular from 'angular';
const immutable = require('seamless-immutable'); import immutable from 'seamless-immutable';
const storeFactory = require('../../store'); import rootThreadFactory from '../../services/root-thread';
const rootThreadFactory = require('../../services/root-thread'); import searchFilterFactory from '../../services/search-filter';
const searchFilterFactory = require('../../services/search-filter'); import viewFilterFactory from '../../services/view-filter';
const viewFilterFactory = require('../../services/view-filter'); import storeFactory from '../../store';
const fixtures = immutable({ const fixtures = immutable({
annotations: [ annotations: [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment