Skip to content

Commit

Permalink
Merge pull request #193 from Wakamai-Fondue/more-vue-updates
Browse files Browse the repository at this point in the history
More vue updates
  • Loading branch information
RoelN authored Nov 29, 2024
2 parents dcee2e6 + 5810ce6 commit 4c52b92
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 39 deletions.
2 changes: 1 addition & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default {
that.font = fondue;
that.$nextTick(() => {
that.working = false;
document.getElementById("Fontreport").scrollIntoView();
document.getElementById("report").scrollIntoView();
});
})
.catch(function () {
Expand Down
6 changes: 3 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
@drop.prevent="getFont"
@dragover.prevent="dragStatus(true)"
@mouseout="dragStatus(false)"
@keydown.esc="toggleModal(true)"
@keydown.esc="toggleInfoModal(true)"
tabindex="0"
:class="{ dragging, working }"
>
<TheFondue
@getFont="getFont"
@getExampleFont="getExampleFont"
@toggleModal="toggleModal"
@toggleInfoModal="toggleInfoModal"
:error="error"
/>
<FontReport :font="font" :isExamplefont="isExamplefont" />
<InfoModal v-if="showModal" @toggleModal="toggleModal" />
<InfoModal v-if="showInfoModal" @toggleInfoModal="toggleInfoModal" />
<div class="beta-message">
Heya! You’re looking at the beta site. Comments, bugs or feedback?
<a href="mailto:[email protected]">Let me know!</a>
Expand Down
4 changes: 2 additions & 2 deletions src/components/InfoModal.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import toggleModal from "../mixins/toggleModal.js";
import toggleInfoModal from "../mixins/toggleInfoModal.js";

export default {
mixins: [toggleModal],
mixins: [toggleInfoModal],
};
2 changes: 1 addition & 1 deletion src/components/InfoModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
type="button"
aria-label="Info"
class="info"
@click="toggleModal"
@click="toggleInfoModal"
></button>
<div class="modal-content">
<p class="modal-title">Wakamai Fondue</p>
Expand Down
4 changes: 2 additions & 2 deletions src/components/TheFondue.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import toggleModal from "../mixins/toggleModal.js";
import toggleInfoModal from "../mixins/toggleInfoModal.js";
import FileDrop from "./FileDrop.vue";

export default {
mixins: [toggleModal],
mixins: [toggleInfoModal],
props: ["error"],
components: {
FileDrop,
Expand Down
2 changes: 1 addition & 1 deletion src/components/TheFondue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
type="button"
aria-label="Info"
class="info"
@click="toggleModal"
@click="toggleInfoModal"
></button>
<FileDrop :error="error" />
<a href="https://pixelambacht.nl" target="_blank" class="logo"
Expand Down
10 changes: 5 additions & 5 deletions src/components/report/FeatureControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ export default {
long() {
return this.optionalFeatures.length > 8;
},
},
mounted: function () {
this.updateStyles();
},
methods: {
featureChars() {
// Try to return the "best" layout features
if (
Expand All @@ -39,11 +44,6 @@ export default {
return {};
}
},
},
mounted: function () {
this.updateStyles();
},
methods: {
flipState(feature) {
const states = [1, 0, null];
// If feature is on and showing alternates (so it's state >= 1),
Expand Down
8 changes: 5 additions & 3 deletions src/components/report/FontSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ export default {
};
},
computed: {
hasLocalization() {
return this.font.languageSystems.length > 0;
},
featureLength() {
return this.font.features.length || "no";
},
Expand All @@ -31,4 +28,9 @@ export default {
return count || "no";
},
},
methods: {
hasLocalization() {
return this.font.languageSystems.length > 0;
},
},
};
19 changes: 10 additions & 9 deletions src/components/report/OpenTypeFeatures.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ export default {
data() {
return {
currentStates: [],
hasOptionalFeatures:
this.font.features.filter((f) => f.state !== "fixed").length >
0,
hasRequiredFeatures:
this.font.features.filter((f) => f.state === "fixed").length >
0,
featureChars: this.getFeatureChars(),
};
},
computed: {
Expand All @@ -12,13 +19,9 @@ export default {
requiredFeatures() {
return this.font.features.filter((f) => f.state === "fixed");
},
hasRequiredFeatures() {
return this.requiredFeatures.length > 0;
},
hasOptionalFeatures() {
return this.optionalFeatures.length > 0;
},
featureChars() {
},
methods: {
getFeatureChars() {
// Try to return the "best" layout features
if (
"DFLT" in this.font.featureChars &&
Expand All @@ -38,8 +41,6 @@ export default {
return {};
}
},
},
methods: {
flipState(feature) {
this.currentStates[feature] = 1 - this.currentStates[feature];
},
Expand Down
4 changes: 2 additions & 2 deletions src/components/report/OpenTypeFeatures.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
v-if="lookup['type'] === 3"
:style="getFeatureStyle(feature.tag)"
:data-type="lookup['typeName']"
:key="`lookup_${feature.tag}_${index}`"
:key="`lookup_3_${feature.tag}_${index}`"
class="chars"
contenteditable
spellcheck="false"
Expand All @@ -86,7 +86,7 @@
v-else
:style="getFeatureStyle(feature.tag)"
:data-type="lookup['typeName']"
:key="`lookup_${feature.tag}_${index}`"
:key="`lookup_6_${feature.tag}_${index}`"
class="chars"
contenteditable
spellcheck="false"
Expand Down
7 changes: 2 additions & 5 deletions src/components/report/TextControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ export default {
activeLanguage: null,
languages: this.font.languageSystems,
linkOpticalSize: false,
hasLocalization: this.font.languageSystems.length > 0,
};
},
computed: {
hasLocalization() {
return this.font.languageSystems.length > 0;
},
},

mounted: function () {
// this.$root.$on("unlinkOpticalSize", this.unlinkOpticalSize);
this.updateStyles();
Expand Down
6 changes: 3 additions & 3 deletions src/components/report/TypeTester.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ export default {
styles() {
return this.getStyles();
},
hasLocalization() {
return this.font.languageSystems.length > 0;
},
},
methods: {
updateOpticalSize: function () {
Expand Down Expand Up @@ -71,5 +68,8 @@ export default {
}
return css;
},
hasLocalization() {
return this.font.languageSystems.length > 0;
},
},
};
4 changes: 2 additions & 2 deletions src/mixins/toggleModal.js → src/mixins/toggleInfoModal.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export default {
methods: {
toggleModal() {
toggleInfoModal() {
// Quick and clean way to emit to grandparent
// that modal should be opened/closed
let vm = this;
while (vm) {
vm.$emit("toggleModal");
vm.$emit("toggleInfoModal");
vm = vm.$parent;
}
},
Expand Down

0 comments on commit 4c52b92

Please sign in to comment.