aboutsummaryrefslogtreecommitdiff
path: root/ext/css
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-07-17 14:44:36 -0400
committerGitHub <noreply@github.com>2021-07-17 14:44:36 -0400
commit3e938f1a1fdb5064f8d11060685699d3217d16a2 (patch)
treed0589bf9ca95b32b0bc7720c1a3f6e05b767cce4 /ext/css
parenta933cfdc0780f618bb1ae60930a82a2af954e3cd (diff)
Display pronunciation refactor (#1835)
* Simplify svg and container styles * Rename pitch-accent-details to pitch-accent-graph-container * Rename pitch-accent-graph* to pronunciation-graph* * Remove unused template * Omit quotes * Rename pitch-accent-character to pronunciation-mora * Simplify names * Replace pronunciation-mora-inner with pronunciation-character * Improve grouping of nasal characters * Simplify character replacement * Replace pseudo-elements with real elements * Use an element rather than a fragment * Rename functions * Add wrapper * Rename pitch-accent-characters to pronunciation-text-container * Update test data * Update downstep notation generation * Rename pitch-accent-position to pronunciation-downstep-notation-container * Space * Wrap pronunciations in a container node * Update preview * Embed pitch accent styles directly
Diffstat (limited to 'ext/css')
-rw-r--r--ext/css/display-pronunciation.css54
-rw-r--r--ext/css/display.css16
-rw-r--r--ext/css/pitch-accents-preview.css65
-rw-r--r--ext/css/settings.css8
4 files changed, 38 insertions, 105 deletions
diff --git a/ext/css/display-pronunciation.css b/ext/css/display-pronunciation.css
index e26c5952..d416ff75 100644
--- a/ext/css/display-pronunciation.css
+++ b/ext/css/display-pronunciation.css
@@ -22,15 +22,21 @@
--pitch-accent-annotation-color: #ffffff;
}
-.pitch-accent-character {
+.pronunciation-downstep-notation {
+ display: inline;
+}
+
+.pronunciation-text {
+ display: inline;
+}
+.pronunciation-mora {
display: inline-block;
position: relative;
}
-.pitch-accent-character::before {
+.pronunciation-mora-line {
border-color: var(--pitch-accent-annotation-color);
}
-.pitch-accent-character[data-pitch='high']::before {
- content: '';
+.pronunciation-mora[data-pitch=high]>.pronunciation-mora-line {
display: block;
user-select: none;
pointer-events: none;
@@ -42,17 +48,17 @@
border-top-width: 0.1em;
border-top-style: solid;
}
-.pitch-accent-character[data-pitch='high'][data-pitch-next='low']::before {
+.pronunciation-mora[data-pitch=high][data-pitch-next=low]>.pronunciation-mora-line {
right: -0.1em;
height: 0.4em;
border-right-width: 0.1em;
border-right-style: solid;
}
-.pitch-accent-character[data-pitch='high'][data-pitch-next='low'] {
+.pronunciation-mora[data-pitch=high][data-pitch-next=low] {
padding-right: 0.1em;
margin-right: 0.1em;
}
-.pitch-accent-character-devoice-indicator {
+.pronunciation-devoice-indicator {
display: block;
position: absolute;
left: 50%;
@@ -65,7 +71,7 @@
z-index: 1;
transform: translate(-50%, -50%);
}
-.pitch-accent-character-nasal-indicator {
+.pronunciation-nasal-indicator {
display: block;
position: absolute;
right: -0.125em;
@@ -77,48 +83,48 @@
box-sizing: border-box;
z-index: 1;
}
-.pitch-accent-character-nasal-diacritic {
+.pronunciation-nasal-diacritic {
position: absolute;
width: 0;
height: 0;
opacity: 0;
}
-
-.pitch-accent-position::before {
- content: ' [';
+.pronunciation-character {
+ display: inline;
}
-.pitch-accent-position::after {
- content: ']';
+.pronunciation-character-group {
+ display: inline-block;
+ position: relative;
}
-.pitch-accent-graph {
- display: block;
+.pronunciation-graph {
+ display: inline-block;
+ vertical-align: middle;
height: 1.5em;
- transform: translateY(-0.875em);
}
-.pitch-accent-graph-line,
-.pitch-accent-graph-line-tail {
+.pronunciation-graph-line,
+.pronunciation-graph-line-tail {
fill: none;
stroke: var(--pitch-accent-annotation-color);
stroke-width: 5;
}
-.pitch-accent-graph-line-tail {
+.pronunciation-graph-line-tail {
stroke-dasharray: 5 5;
}
-.pitch-accent-graph-dot {
+.pronunciation-graph-dot {
fill: var(--pitch-accent-annotation-color);
stroke: var(--pitch-accent-annotation-color);
stroke-width: 5;
}
-.pitch-accent-graph-dot-downstep1 {
+.pronunciation-graph-dot-downstep1 {
fill: none;
stroke: var(--pitch-accent-annotation-color);
stroke-width: 5;
}
-.pitch-accent-graph-dot-downstep2 {
+.pronunciation-graph-dot-downstep2 {
fill: var(--pitch-accent-annotation-color);
}
-.pitch-accent-graph-triangle {
+.pronunciation-graph-triangle {
fill: none;
stroke: var(--pitch-accent-annotation-color);
stroke-width: 5;
diff --git a/ext/css/display.css b/ext/css/display.css
index f2e36b56..e2591138 100644
--- a/ext/css/display.css
+++ b/ext/css/display.css
@@ -1478,11 +1478,11 @@ button.definition-item-expansion-button:focus:focus-visible+.definition-item-con
.pitch-accent-tag-list:not([data-count='0']) {
margin-right: 0.375em;
}
-.pitch-accent-details {
- display: inline-block;
- height: 0;
- padding: 0 0.25em;
- vertical-align: middle;
+.pronunciation-downstep-notation-container {
+ margin-left: 0.25em;
+}
+.pronunciation-graph-container {
+ margin-left: 0.25em;
}
@@ -1947,13 +1947,13 @@ button.footer-notification-close-button {
:root[data-show-pitch-accent-downstep-notation=true] .pitch-accent-disambiguation[data-type=reading] {
display: none;
}
-:root[data-show-pitch-accent-downstep-notation=false] .pitch-accent-characters {
+:root[data-show-pitch-accent-downstep-notation=false] .pronunciation-text-container {
display: none;
}
-:root[data-show-pitch-accent-position-notation=false] .pitch-accent-position {
+:root[data-show-pitch-accent-position-notation=false] .pronunciation-downstep-notation-container {
display: none;
}
-:root[data-show-pitch-accent-graph=false] .pitch-accent-details {
+:root[data-show-pitch-accent-graph=false] .pronunciation-graph-container {
display: none;
}
diff --git a/ext/css/pitch-accents-preview.css b/ext/css/pitch-accents-preview.css
deleted file mode 100644
index 8ee013b2..00000000
--- a/ext/css/pitch-accents-preview.css
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2020-2021 Yomichan Authors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- */
-
-:root {
- --font-size-no-units: 14;
- --font-size: calc(1px * var(--font-size-no-units));
-
- --line-height-no-units: 20;
- --line-height: calc(var(--line-height-no-units) / var(--font-size-no-units));
-}
-
-html {
- background-color: transparent;
- color: #333333;
-}
-html,
-body {
- margin: 0;
- padding: 0;
- border: 0;
- overflow: hidden;
- width: 100%;
- height: 100%;
- font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
- font-size: var(--font-size);
- line-height: var(--line-height);
-}
-ul {
- margin: 0;
- padding: 0 0 0 1.5em;
-}
-li {
- margin: 0.425em 0;
-}
-
-.content {
- display: flex;
- min-width: 100%;
- min-height: 100%;
- box-sizing: border-box;
- padding: 0;
- flex-flow: column nowrap;
- align-items: center;
- justify-content: center;
-}
-.content-body {
- max-width: 100%;
- width: 700px;
- flex: 0 0 auto;
- height: auto;
-}
diff --git a/ext/css/settings.css b/ext/css/settings.css
index 86a6cdb3..869f52d4 100644
--- a/ext/css/settings.css
+++ b/ext/css/settings.css
@@ -1768,14 +1768,6 @@ code.anki-field-marker {
align-items: flex-start;
}
-#pitch-accents-preview-frame {
- border: none;
- margin: 0;
- padding: 0;
- width: 100%;
- height: calc(0.425em * 4 + 1em * var(--line-height-default) * 3);
-}
-
.translation-text-replacement-entry {
display: grid;
grid-template-columns: auto auto 1fr auto;