--- /dev/null
+export default {
+ props: ['families'],
+ data: function() {
+ return {
+ fontSize: 32,
+ selectedFamily: null,
+ }
+ },
+ computed: {
+ cssStyle() {
+ let res = `font-family: '${this.selectedFamily.name}'; font-size: ${this.fontSize}pt;`;
+ if (this.selectedFamily.isVF) {
+ res += ' font-variation-settings:';
+ }
+ this.selectedFamily.axes.forEach(axis => {
+ res += ` '${axis.tag}' ${axis.value},`;
+ }
+ );
+ return res.slice(0, -1) + ';'; // Remove trailing comma and add semicolon
+ }
+ },
+ template: `
+ <div>
+ <h1>Playground</h1>
+ <select v-model="selectedFamily">
+ <option v-for="family in families" :key="family.name" :value="family">
+ {{ family.name }}
+ </option>
+ </select>
+ <div v-if="selectedFamily">
+ Font size:
+ <input type="range" v-model="fontSize" min="8" max="100" default="32" /> {{ fontSize }}pt
+ <div contenteditable="true" :style="cssStyle" style="border: 1px solid #ccc; padding: 1em;">
+ Hello world
+ </div>
+ <div v-for="axis in selectedFamily.axes" :key="axis.tag">
+ <label>{{ axis.tag }}: {{ axis.value }}</label>
+ <input type="range" v-model="axis.value" :min="axis.min" :max="axis.max" />
+ </div>
+ </div>
+ </div>
+
+ `
+}
\ No newline at end of file
<div id="fonts">
<link v-for="family in gf && gf.families ? gf.families : []" :href="family.url" rel="stylesheet">
</div>
- <button @click="addFontPanel('Maven Pro')">Add Font View</button>
- <button @click="addCategoriesPanel(['/Expressive/Loud'])">Add Tag View</button>
+ <button @click="addFontPanel('Maven Pro')">Tags in font</button>
+ <button @click="addCategoriesPanel(['/Expressive/Loud'])">Tags in category</button>
+ <button @click="addVFViewPanel()">Font explorer</button>
<add-tag :categories="categories" @tag-added="addTag"></add-tag>
<add-category @category-added="addCategory"></add-category>
<div style="display: flex; flex-direction: row; width: 100vw; min-height: 100vh;">
<div v-for="(panel, idx) in panels" :key="idx" :style="{ flex: '1 1 0', minWidth: 0, borderRight: idx < panels.length - 1 ? '1px solid #eee' : 'none', height: '100vh', overflow: 'auto' }">
- <panel :panel="panel" :tags="tags && tags.items ? tags.items : []" @remove="removePanel(idx)"></panel>
+ <panel
+ :panel="panel"
+ :tags="tags && tags.items ? tags.items : []"
+ @remove="removePanel(idx)"
+ ></panel>
</div>
</div>
</div>
import TagView from "./TagView.js";
import AddTag from "./AddTag.js";
import AddCategory from "./AddCategory.js";
+ import VFView from "./VFView.js";
Vue.component('tags-by-font', TagsByFont);
Vue.component('tags-by-categories', TagsByCategories);
Vue.component('tag-view', TagView);
Vue.component('add-tag', AddTag);
Vue.component('add-category', AddCategory);
+ Vue.component('vf-view', VFView);
var app = new Vue({
el: '#app',
addCategoriesPanel(categories) {
this.panels.push({ type: 'categories', categories });
},
+ addVFViewPanel() {
+ this.panels.push({ type: 'vf-view', families: this.gf.families });
+ },
removePanel(idx) {
this.panels.splice(idx, 1);
},
return this.axes.length > 0;
}
get cssStyle() {
- return `font-family: '${this.name}';`;
+ if (!this.isVF) {
+ return `font-family: '${this.name}'; font-size: 32pt;`;
+ }
+ let res = `font-family: '${this.name}'; font-size: 32pt; font-variation-settings:`;
+ this.axes.forEach(axis => {
+ res += ` '${axis.tag}' ${axis.min}..${axis.max},`;
+ });
+ return res.slice(0, -1) + ';'; // Remove trailing comma and add semicolon
}
get url() {
let path = `https://fonts.googleapis.com/css2?family=${this.name.replaceAll(" ", "+")}`