Update deps

This commit is contained in:
Simon Prévost 2020-04-08 08:44:52 -04:00
parent b71142c76d
commit 04cf73b5c8
15 changed files with 3073 additions and 3845 deletions

View File

@ -100,6 +100,7 @@ lint-template-hbs:
.PHONY: type-check .PHONY: type-check
type-check: ## Type-check typescript files type-check: ## Type-check typescript files
cd webapp && npx tsc cd webapp && npx tsc
cd jipt && npx tsc
.PHONY: test .PHONY: test
test: ## Run the test suite test: ## Run the test suite

View File

@ -18,7 +18,7 @@ export default class ProjectFetcher {
return data.data && data.data.viewer.project; return data.data && data.data.viewer.project;
} }
private async graphql(config: Config) { private graphql(config: Config) {
const query = `query ProjectDetails($project_id: ID!) { const query = `query ProjectDetails($project_id: ID!) {
viewer { viewer {
project(id: $project_id) { project(id: $project_id) {

4840
jipt/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"devDependencies": { "devDependencies": {
"parcel-bundler": "1.11.0", "parcel-bundler": "1.12.4",
"typescript": "3.3.1" "typescript": "3.8.3"
} }
} }

View File

@ -13,7 +13,7 @@ export interface Config {
const state = new State({ const state = new State({
nodes: new WeakMap(), nodes: new WeakMap(),
projectTranslations: {}, projectTranslations: new Map(),
refs: new Map(), refs: new Map(),
}); });

View File

@ -23,7 +23,7 @@ export default class LiveNode {
return !!this.state.nodes.get(node); return !!this.state.nodes.get(node);
} }
matchAttributes(node: Element) { matchAttributes(node: HTMLElement) {
Array.from(node.attributes).forEach((attribute) => { Array.from(node.attributes).forEach((attribute) => {
const translation = this.findTranslationByValue(attribute.value); const translation = this.findTranslationByValue(attribute.value);
if (!translation || !translation.text) return; if (!translation || !translation.text) return;
@ -61,15 +61,17 @@ export default class LiveNode {
if (newContent === node.nodeValue) return; if (newContent === node.nodeValue) return;
parentNode.innerHTML = this.replaceValue(parentNode.innerHTML, newContent); parentNode.innerHTML = this.replaceValue(parentNode.innerHTML, newContent);
const newNode = parentNode.getElementsByClassName(ACCENT_CLASS)[0]; const newNode = parentNode.getElementsByClassName(
ACCENT_CLASS
)[0] as HTMLElement;
Mutation.nodeStyleRefresh(newNode, translation); Mutation.nodeStyleRefresh(newNode, translation);
this.state.addReference(newNode, translation); this.state.addReference(newNode, translation);
} }
evaluate(node: Element) { evaluate(node: HTMLElement) {
node.childNodes && node.childNodes &&
node.childNodes.forEach((node: Element) => { node.childNodes.forEach((node: HTMLElement) => {
this.evaluate(node); this.evaluate(node);
if (node.attributes) this.matchAttributes(node); if (node.attributes) this.matchAttributes(node);
}); });
@ -87,7 +89,7 @@ export default class LiveNode {
return value.match(ACCENT_REGEX); return value.match(ACCENT_REGEX);
} }
private findTranslationByValue(value) { private findTranslationByValue(value: string) {
if (!value) return; if (!value) return;
const match = this.valueMatch(value); const match = this.valueMatch(value);

View File

@ -18,12 +18,12 @@ export default class Mutation {
this.liveNode = liveNode; this.liveNode = liveNode;
} }
static nodeChange(node: Element, meta: any, text: string) { static nodeChange(node: HTMLElement, meta: any, text: string) {
this.textNodeChange(node, meta, text); this.textNodeChange(node, meta, text);
this.attributeNodeChange(node, meta, text); this.attributeNodeChange(node, meta, text);
} }
static nodeStyleRefresh(node: Element, translation: Translation) { static nodeStyleRefresh(node: HTMLElement, translation: Translation) {
node.removeAttribute('class'); node.removeAttribute('class');
if (translation.isConflicted) { if (translation.isConflicted) {
@ -33,7 +33,7 @@ export default class Mutation {
} }
} }
private static textNodeChange(node: Element, meta: any, text: string) { private static textNodeChange(node: HTMLElement, meta: any, text: string) {
if (node.innerHTML === text) return; if (node.innerHTML === text) return;
let updatedText = text; let updatedText = text;
@ -44,7 +44,11 @@ export default class Mutation {
if (!meta.head) this.handleUpdatedNodeStyles(node); if (!meta.head) this.handleUpdatedNodeStyles(node);
} }
private static attributeNodeChange(node, meta, text) { private static attributeNodeChange(
node: HTMLElement,
meta: any,
text: string
) {
if (!meta.attributeName) return; if (!meta.attributeName) return;
if (node.getAttribute(meta.attributeName) === text) return; if (node.getAttribute(meta.attributeName) === text) return;
@ -78,7 +82,9 @@ export default class Mutation {
handleNodeMutation(node) { handleNodeMutation(node) {
if (node.nodeType === Node.TEXT_NODE) this.liveNode.matchText(node.target); if (node.nodeType === Node.TEXT_NODE) this.liveNode.matchText(node.target);
if (node.type === 'childList') { if (node.type === 'childList') {
node.addedNodes.forEach((node: Element) => this.liveNode.evaluate(node)); node.addedNodes.forEach((node: HTMLElement) =>
this.liveNode.evaluate(node)
);
} }
if (node.type === 'attributes') this.liveNode.matchAttributes(node.target); if (node.type === 'attributes') this.liveNode.matchAttributes(node.target);
if (node.type === 'characterData') this.liveNode.matchText(node.target); if (node.type === 'characterData') this.liveNode.matchText(node.target);

View File

@ -13,16 +13,22 @@ interface Translation {
text: string; text: string;
} }
interface Args {
refs: Map<string, RefState>;
nodes: WeakMap<HTMLElement, NodeState>;
projectTranslations: Map<string, Translation>;
}
/* /*
The State is a singleton component that keeps track of references The State is a singleton component that keeps track of references
used in all components. With the state, you can request a NodeElement from a translation, vice and versa. used in all components. With the state, you can request a NodeElement from a translation, vice and versa.
*/ */
export default class State { export default class State {
refs: Map<string, RefState>; refs: Map<string, RefState>;
nodes: Map<HTMLElement, NodeState>; nodes: WeakMap<HTMLElement, NodeState>;
projectTranslations: Map<string, Translation>; projectTranslations: Map<string, Translation>;
constructor(properties) { constructor(properties: Args) {
this.refs = properties.refs; this.refs = properties.refs;
this.nodes = properties.nodes; this.nodes = properties.nodes;
this.projectTranslations = properties.projectTranslations; this.projectTranslations = properties.projectTranslations;
@ -36,7 +42,7 @@ export default class State {
localStorage.setItem('accent-current-revision', id); localStorage.setItem('accent-current-revision', id);
} }
addReference(node, translation, meta = {}) { addReference(node: HTMLElement, translation: Translation, meta = {}) {
this.addTranslationRef(translation, node, meta); this.addTranslationRef(translation, node, meta);
this.addNodeRef(node, translation); this.addNodeRef(node, translation);
} }
@ -45,7 +51,11 @@ export default class State {
return this.projectTranslations[id]; return this.projectTranslations[id];
} }
private addTranslationRef(translation, node, meta = {}) { private addTranslationRef(
translation: Translation,
node: HTMLElement,
meta = {}
) {
const match = this.refs.get(translation.id); const match = this.refs.get(translation.id);
const elements = match ? match.elements : new Map(); const elements = match ? match.elements : new Map();
elements.set(node, meta); elements.set(node, meta);
@ -53,9 +63,9 @@ export default class State {
this.refs.set(translation.id, {elements}); this.refs.set(translation.id, {elements});
} }
private addNodeRef(node, translation, meta = {}) { private addNodeRef(node: HTMLElement, translation: Translation, meta = {}) {
const match = this.nodes.get(node); const match = this.nodes.get(node);
const keys = match ? match.keys : new Set(); const keys: Set<string> = match ? match.keys : new Set();
keys.add(translation.key); keys.add(translation.key);
this.nodes.set(node, {keys, meta}); this.nodes.set(node, {keys, meta});

View File

@ -1,6 +1,8 @@
{ {
"compilerOptions": { "compilerOptions": {
"allowJs": false,
"lib": ["dom", "es2015"], "lib": ["dom", "es2015"],
"noEmit": true,
"downlevelIteration": true "downlevelIteration": true
} }
} }

View File

@ -10,7 +10,6 @@
@import 'reset'; @import 'reset';
@import 'base'; @import 'base';
@import 'classes'; @import 'classes';
@import 'reset-select';
@import 'html-components/emoji-picker'; @import 'html-components/emoji-picker';
@import 'html-components/sub-navigation'; @import 'html-components/sub-navigation';

View File

@ -1,13 +1,13 @@
:global(.filters) { .filters {
padding: 15px; padding: 15px;
border-radius: 3px; border-radius: 3px;
background: $color-light-background; background: $color-light-background;
:global(&.filters--white) { &.filters--white {
background: #fff; background: #fff;
} }
:global(.ember-power-select-trigger) { .ember-power-select-trigger {
padding: 5px 10px; padding: 5px 10px;
background: #fff; background: #fff;
box-shadow: none; box-shadow: none;
@ -17,44 +17,44 @@
color: var(--color-black-opacity-70); color: var(--color-black-opacity-70);
&:focus, &:focus,
:global(&.ember-power-select-trigger--active) { &.ember-power-select-trigger--active {
background: $color-light-background; background: $color-light-background;
border: 1px solid rgba($color-black, 0.1); border: 1px solid rgba($color-black, 0.1);
} }
} }
} }
:global(.filters-wrapper) { .filters-wrapper {
position: relative; position: relative;
} }
:global(.queryForm-filters) { .queryForm-filters {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-top: 6px; margin-top: 6px;
} }
:global(.queryForm-filters-column) { .queryForm-filters-column {
display: flex; display: flex;
flex-grow: 1; flex-grow: 1;
} }
:global(.queryForm-filter) { .queryForm-filter {
display: flex; display: flex;
align-items: center; align-items: center;
margin-top: 10px; margin-top: 2px;
margin-right: 15px; margin-right: 15px;
} }
:global(.queryForm-filter-label) { .queryForm-filter-label {
margin-right: 10px; margin-right: 10px;
color: $color-grey; color: $color-grey;
font-size: 12px; font-size: 12px;
font-style: italic; font-style: italic;
} }
:global(.queryForm-filter-select) { .queryForm-filter-select {
font-size: 13px; font-size: 13px;
min-width: 130px; min-width: 130px;
} }

View File

@ -38,16 +38,8 @@
} }
} }
.modalList {
display: none;
}
@media (max-width: ($screen-sm)) { @media (max-width: ($screen-sm)) {
.acc-modal__wrapper { .acc-modal__wrapper {
padding: 30px 10px; padding: 30px 10px;
} }
.modalList {
display: block;
}
} }

View File

@ -1,30 +0,0 @@
.resetSelect {
position: relative;
display: inline-block;
vertical-align: middle;
border-radius: 3px;
&:before,
&:after {
content: '';
position: absolute;
pointer-events: none;
}
&:after {
content: '';
transform: rotate(90deg);
top: 50%;
right: 0;
}
}
.resetSelect-tag {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
margin: 0;
border: 0;
cursor: pointer;
outline: none;
}

1938
webapp/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -38,8 +38,8 @@
"cached-path-relative": "1.0.2", "cached-path-relative": "1.0.2",
"color": "3.1.2", "color": "3.1.2",
"cryptiles": "4.1.3", "cryptiles": "4.1.3",
"date-fns": "2.8.1", "date-fns": "2.11.1",
"diff": "4.0.1", "diff": "4.0.2",
"ember-auto-import": "1.5.3", "ember-auto-import": "1.5.3",
"ember-checkbox-with-label": "2.0.0", "ember-checkbox-with-label": "2.0.0",
"ember-cli": "3.17.0", "ember-cli": "3.17.0",
@ -48,8 +48,8 @@
"ember-cli-babel-polyfills": "2.0.1", "ember-cli-babel-polyfills": "2.0.1",
"ember-cli-content-security-policy": "1.1.1", "ember-cli-content-security-policy": "1.1.1",
"ember-cli-dependency-checker": "3.2.0", "ember-cli-dependency-checker": "3.2.0",
"ember-cli-flash": "1.8.0", "ember-cli-flash": "1.8.1",
"ember-cli-htmlbars": "4.2.0", "ember-cli-htmlbars": "4.2.3",
"ember-cli-inject-live-reload": "2.0.2", "ember-cli-inject-live-reload": "2.0.2",
"ember-cli-sass": "10.0.1", "ember-cli-sass": "10.0.1",
"ember-cli-shims": "1.2.0", "ember-cli-shims": "1.2.0",
@ -59,17 +59,17 @@
"ember-concurrency-decorators": "1.0.0", "ember-concurrency-decorators": "1.0.0",
"ember-css-modules": "1.2.1", "ember-css-modules": "1.2.1",
"ember-css-modules-sass": "1.0.1", "ember-css-modules-sass": "1.0.1",
"ember-fetch": "^7.0.0", "ember-fetch": "8.0.1",
"ember-inline-svg": "1.0.0", "ember-inline-svg": "1.0.0",
"ember-intl": "4.3.0", "ember-intl": "4.3.0",
"ember-load-initializers": "2.1.1", "ember-load-initializers": "2.1.1",
"ember-power-select": "4.0.0", "ember-power-select": "4.0.0",
"ember-radio-button": "2.0.1", "ember-radio-button": "2.0.1",
"ember-resolver": "7.0.0", "ember-resolver": "7.0.0",
"ember-source": "3.17.2", "ember-source": "3.17.3",
"ember-wormhole": "0.5.5", "ember-wormhole": "0.5.5",
"graphql": "14.6.0", "graphql": "14.6.0",
"graphql-tag": "2.10.1", "graphql-tag": "2.10.3",
"hoek": "6.1.3", "hoek": "6.1.3",
"loader.js": "4.7.0", "loader.js": "4.7.0",
"merge": "1.2.1", "merge": "1.2.1",
@ -87,8 +87,8 @@
"@types/ember__test-helpers": "0.7.10", "@types/ember__test-helpers": "0.7.10",
"@types/mocha": "5.2.7", "@types/mocha": "5.2.7",
"@types/rsvp": "4.0.3", "@types/rsvp": "4.0.3",
"babel-eslint": "10.0.3", "babel-eslint": "10.1.0",
"ember-cli-bundle-analyzer": "0.1.0", "ember-cli-bundle-analyzer": "0.2.0",
"ember-cli-chai": "0.5.0", "ember-cli-chai": "0.5.0",
"ember-cli-mocha": "0.15.0", "ember-cli-mocha": "0.15.0",
"ember-cli-sri": "2.1.1", "ember-cli-sri": "2.1.1",