@taekwondo-db/web-app 0.0.0-stage → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +297 -2
  3. package/assets/css/abstracts/base.css +54 -0
  4. package/assets/css/abstracts/variables.css +125 -0
  5. package/assets/css/components/breadcrumb.css +14 -0
  6. package/assets/css/components/card.css +35 -0
  7. package/assets/css/components/categories.css +200 -0
  8. package/assets/css/components/detail.css +591 -0
  9. package/assets/css/components/grade.css +79 -0
  10. package/assets/css/components/header.css +131 -0
  11. package/assets/css/components/language.css +38 -0
  12. package/assets/css/components/layout.css +151 -0
  13. package/assets/css/components/link.css +26 -0
  14. package/assets/css/components/result.css +123 -0
  15. package/assets/css/components/search.css +193 -0
  16. package/assets/css/components/tag.css +137 -0
  17. package/assets/css/style.css +17 -0
  18. package/assets/fonts/noto-serif-kr.css +28 -0
  19. package/assets/js/email.js +11 -0
  20. package/assets/js/gallery.js +30 -0
  21. package/assets/js/language.js +11 -0
  22. package/assets/js/main.js +17 -0
  23. package/assets/js/pwa.js +48 -0
  24. package/assets/js/search.js +276 -0
  25. package/assets/js/sorting.js +26 -0
  26. package/bin/taekwondo-db.js +145 -0
  27. package/content/_content.gotmpl +27 -0
  28. package/hugo.toml +32 -0
  29. package/i18n/de.json +107 -0
  30. package/i18n/en.json +107 -0
  31. package/i18n/ko.json +107 -0
  32. package/layouts/404.html +23 -0
  33. package/layouts/_partials/breadcrumb.html +11 -0
  34. package/layouts/_partials/categories.html +17 -0
  35. package/layouts/_partials/category-cards.html +36 -0
  36. package/layouts/_partials/category-group.html +7 -0
  37. package/layouts/_partials/category-section.html +15 -0
  38. package/layouts/_partials/category-tile.html +4 -0
  39. package/layouts/_partials/description.html +10 -0
  40. package/layouts/_partials/email.html +6 -0
  41. package/layouts/_partials/favicons.html +42 -0
  42. package/layouts/_partials/fonts.html +33 -0
  43. package/layouts/_partials/grade-badge.html +11 -0
  44. package/layouts/_partials/grade-name.html +14 -0
  45. package/layouts/_partials/head.html +17 -0
  46. package/layouts/_partials/header.html +38 -0
  47. package/layouts/_partials/historic.html +23 -0
  48. package/layouts/_partials/icon.html +13 -0
  49. package/layouts/_partials/language-label.html +3 -0
  50. package/layouts/_partials/language.html +13 -0
  51. package/layouts/_partials/page-title.html +13 -0
  52. package/layouts/_partials/scripts.html +25 -0
  53. package/layouts/_partials/search-form.html +11 -0
  54. package/layouts/_partials/search-index.html +40 -0
  55. package/layouts/_partials/source-entry.html +13 -0
  56. package/layouts/_partials/t.html +2 -0
  57. package/layouts/_partials/technique/photo.html +45 -0
  58. package/layouts/_partials/technique/word-meaning.html +33 -0
  59. package/layouts/_partials/technique-name.html +5 -0
  60. package/layouts/_partials/technique-row.html +17 -0
  61. package/layouts/_partials/term/list.html +24 -0
  62. package/layouts/_partials/term-name.html +4 -0
  63. package/layouts/_partials/url.html +11 -0
  64. package/layouts/_shortcodes/email.html +2 -0
  65. package/layouts/_shortcodes/operator.html +18 -0
  66. package/layouts/baseof.html +39 -0
  67. package/layouts/group/page.html +24 -0
  68. package/layouts/groups.html +48 -0
  69. package/layouts/home.html +19 -0
  70. package/layouts/page.html +17 -0
  71. package/layouts/source/page.html +67 -0
  72. package/layouts/technique/page.html +160 -0
  73. package/layouts/term/page.html +97 -0
  74. package/lib/database.js +33 -0
  75. package/lib/export.js +423 -0
  76. package/lib/service-worker.js +167 -0
  77. package/lib/validate.js +179 -0
  78. package/package.json +42 -5
@@ -0,0 +1,131 @@
1
+ /* SiteHeader: logo, area navigation, compact search, language switch. */
2
+
3
+ .site-header {
4
+ background: var(--color-surface);
5
+ border-bottom: 1px solid var(--color-border);
6
+ }
7
+
8
+ .site-header__inner {
9
+ display: flex;
10
+ flex-wrap: wrap;
11
+ align-items: center;
12
+ gap: var(--space-4) var(--space-8);
13
+ max-width: var(--container-max);
14
+ margin: 0 auto;
15
+ padding: 14px var(--space-8);
16
+ box-sizing: border-box;
17
+ }
18
+
19
+ .site-brand {
20
+ display: flex;
21
+ align-items: center;
22
+ gap: 10px;
23
+ color: var(--color-text);
24
+ font-size: var(--text-lg);
25
+ font-weight: 700;
26
+ }
27
+
28
+ .site-brand:hover {
29
+ color: var(--color-text);
30
+ text-decoration: none;
31
+ }
32
+
33
+ .app-logo {
34
+ display: block;
35
+ width: auto;
36
+ height: auto;
37
+ max-width: 10rem;
38
+ max-height: 2.5rem;
39
+ }
40
+
41
+ .nav-areas {
42
+ display: flex;
43
+ flex-wrap: wrap;
44
+ gap: var(--space-1);
45
+ }
46
+
47
+ .nav-areas a {
48
+ padding: var(--space-2) var(--space-3);
49
+ border-radius: var(--radius-sm);
50
+ color: var(--color-text-secondary);
51
+ }
52
+
53
+ .nav-areas a:hover {
54
+ background: var(--color-surface-muted);
55
+ text-decoration: none;
56
+ }
57
+
58
+ .nav-areas a[aria-current="page"] {
59
+ background: var(--color-accent-soft);
60
+ color: var(--color-accent);
61
+ font-weight: 600;
62
+ }
63
+
64
+ .site-header__end {
65
+ display: flex;
66
+ flex: 1 1 220px;
67
+ flex-wrap: wrap;
68
+ align-items: center;
69
+ justify-content: flex-end;
70
+ gap: var(--space-4);
71
+ }
72
+
73
+ /*
74
+ * On a phone the header would otherwise stack into three rows. Brand and
75
+ * section navigation share the first row, search and language switch the
76
+ * second — `__end` takes the full width and splits it between them.
77
+ */
78
+ @media (max-width: 767.98px) {
79
+ .site-header__inner {
80
+ padding-left: var(--space-4);
81
+ padding-right: var(--space-4);
82
+ gap: var(--space-3);
83
+ }
84
+
85
+ .site-brand {
86
+ flex: 1 1 0;
87
+ min-width: 0;
88
+ font-size: var(--text-base);
89
+ }
90
+
91
+ .site-brand span {
92
+ overflow: hidden;
93
+ text-overflow: ellipsis;
94
+ white-space: nowrap;
95
+ }
96
+
97
+ .nav-areas {
98
+ flex: none;
99
+ }
100
+
101
+ /*
102
+ * A grid rather than a flex row: `minmax(0, 1fr)` lets the search column
103
+ * shrink all the way down, while the language switch keeps its content
104
+ * width. Flex shrinking alone leaves the field at its content size and
105
+ * pushes the switch off the right edge.
106
+ */
107
+ .site-header__end {
108
+ flex: 1 1 100%;
109
+ display: grid;
110
+ grid-template-columns: minmax(0, 1fr) auto;
111
+ align-items: center;
112
+ gap: var(--space-2);
113
+ }
114
+
115
+ /*
116
+ * Pin both to their column. The entry page has no compact search, and
117
+ * without this the language switch would fall into the empty first column
118
+ * and stretch across it.
119
+ */
120
+ .site-header__end > .search-field--compact {
121
+ grid-column: 1;
122
+ }
123
+
124
+ .site-header__end > .lang-select {
125
+ grid-column: 2;
126
+ }
127
+
128
+ .app-logo {
129
+ max-height: 2rem;
130
+ }
131
+ }
@@ -0,0 +1,38 @@
1
+ /* Language chooser — a select, so it holds any number of languages. */
2
+
3
+ .lang-select select {
4
+ height: var(--touch-target);
5
+ max-width: 11rem;
6
+ padding: 0 var(--space-7) 0 var(--space-3);
7
+ border: 1px solid var(--color-border-strong);
8
+ border-radius: var(--radius-md);
9
+ background-color: var(--color-surface);
10
+ color: var(--color-text);
11
+ font: inherit;
12
+ font-size: var(--text-sm);
13
+ line-height: 1.2;
14
+
15
+ /* Own caret: the native one differs wildly between platforms. */
16
+ appearance: none;
17
+ background-image: linear-gradient(45deg, transparent 50%, var(--color-icon-muted) 50%),
18
+ linear-gradient(135deg, var(--color-icon-muted) 50%, transparent 50%);
19
+ background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
20
+ background-size: 5px 5px, 5px 5px;
21
+ background-repeat: no-repeat;
22
+ }
23
+
24
+ .lang-select select:hover {
25
+ border-color: var(--color-text-muted);
26
+ }
27
+
28
+ .lang-select select:focus-visible {
29
+ border-color: var(--color-accent);
30
+ box-shadow: 0 0 0 4px var(--color-focus-ring);
31
+ outline: none;
32
+ }
33
+
34
+ @media (max-width: 767.98px) {
35
+ .lang-select select {
36
+ max-width: 8.5rem;
37
+ }
38
+ }
@@ -0,0 +1,151 @@
1
+ /*
2
+ * Page frame: the header spans the full width, the content sits in a centred
3
+ * container. Detail pages may grow wider than the entry and search pages.
4
+ */
5
+
6
+ .app-shell {
7
+ display: flex;
8
+ min-height: 100%;
9
+ flex-direction: column;
10
+ }
11
+
12
+ .app-main {
13
+ width: 100%;
14
+ max-width: var(--container-max);
15
+ margin: 0 auto;
16
+ padding: var(--space-6) var(--space-8) var(--space-12);
17
+ box-sizing: border-box;
18
+ flex-grow: 1;
19
+ }
20
+
21
+ .app-main--narrow {
22
+ max-width: var(--container-narrow);
23
+ padding-top: var(--space-8);
24
+ }
25
+
26
+ .app-main--home {
27
+ max-width: 1080px;
28
+ padding-top: var(--space-12);
29
+ }
30
+
31
+ .stack {
32
+ display: flex;
33
+ flex-direction: column;
34
+ gap: var(--space-6);
35
+ }
36
+
37
+ .stack-lg {
38
+ display: flex;
39
+ flex-direction: column;
40
+ gap: var(--space-10);
41
+ }
42
+
43
+ @media (max-width: 575.98px) {
44
+ .app-main {
45
+ padding-left: var(--space-4);
46
+ padding-right: var(--space-4);
47
+ }
48
+ }
49
+
50
+ /*
51
+ * Entry page: the search is the main thing, so it gets a centred block of its
52
+ * own above the category overview. Once something has been typed the heading
53
+ * steps aside and the results take over.
54
+ */
55
+ .home-hero {
56
+ display: flex;
57
+ flex-direction: column;
58
+ gap: var(--space-8);
59
+ width: 100%;
60
+ max-width: 820px;
61
+ margin: 0 auto;
62
+ }
63
+
64
+ .home-hero__text {
65
+ display: flex;
66
+ flex-direction: column;
67
+ align-items: center;
68
+ gap: var(--space-3);
69
+ text-align: center;
70
+ }
71
+
72
+ .home-hero__text h1 {
73
+ margin: 0;
74
+ font-size: 44px;
75
+ line-height: 1.15;
76
+ }
77
+
78
+ .home-hero__text p {
79
+ margin: 0;
80
+ font-size: var(--text-lg);
81
+ color: var(--color-text-secondary);
82
+ }
83
+
84
+ @media (max-width: 575.98px) {
85
+ .home-hero__text h1 {
86
+ font-size: 32px;
87
+ }
88
+ }
89
+
90
+ .site-footer {
91
+ width: 100%;
92
+ max-width: var(--container-max);
93
+ margin: 0 auto;
94
+ padding: var(--space-5) var(--space-8) var(--space-8);
95
+ box-sizing: border-box;
96
+ border-top: 1px solid var(--color-border);
97
+ font-size: var(--text-xs);
98
+ color: var(--color-text-muted);
99
+ display: flex;
100
+ flex-wrap: wrap;
101
+ justify-content: space-between;
102
+ gap: var(--space-2) var(--space-5);
103
+ }
104
+
105
+ .site-footer__info {
106
+ display: flex;
107
+ flex-direction: column;
108
+ gap: var(--space-1);
109
+ }
110
+
111
+ .site-footer__links {
112
+ display: flex;
113
+ flex-wrap: wrap;
114
+ gap: var(--space-5);
115
+ }
116
+
117
+ .site-footer a {
118
+ color: inherit;
119
+ text-decoration: none;
120
+ }
121
+
122
+ .site-footer a:hover {
123
+ color: var(--color-text);
124
+ text-decoration: underline;
125
+ }
126
+
127
+ @media (max-width: 575.98px) {
128
+ .site-footer {
129
+ padding-left: var(--space-4);
130
+ padding-right: var(--space-4);
131
+ }
132
+ }
133
+
134
+ /*
135
+ * Every page is a document of its own. Where supported, the browser fades
136
+ * from one to the next instead of flashing a blank frame in between.
137
+ */
138
+ @media (prefers-reduced-motion: no-preference) {
139
+ @view-transition {
140
+ navigation: auto;
141
+ }
142
+ }
143
+
144
+ .home-hero__text > .pill-outline {
145
+ align-self: center;
146
+ }
147
+
148
+ .not-found__hangeul {
149
+ font-size: var(--text-lg);
150
+ color: var(--color-text-muted);
151
+ }
@@ -0,0 +1,26 @@
1
+ a {
2
+ text-decoration: none;
3
+
4
+ &:hover {
5
+ text-decoration: underline;
6
+ }
7
+ }
8
+
9
+ /*
10
+ * References inside running text (descriptions). Underlined, unlike other
11
+ * links, because colour alone does not set them apart from the prose.
12
+ * Terms get a dotted line: they lead to a word, not to a technique.
13
+ */
14
+ .description-ref {
15
+ text-decoration: underline;
16
+ text-decoration-thickness: 1px;
17
+ text-underline-offset: 0.2em;
18
+
19
+ &:hover {
20
+ text-decoration-thickness: 2px;
21
+ }
22
+ }
23
+
24
+ .description-ref--term {
25
+ text-decoration-style: dotted;
26
+ }
@@ -0,0 +1,123 @@
1
+ /* Search results: filter chips, then one list per type inside a card. */
2
+
3
+ .filter-chips {
4
+ display: flex;
5
+ flex-wrap: wrap;
6
+ gap: var(--space-2);
7
+ }
8
+
9
+ .filter-chips button {
10
+ height: 40px;
11
+ padding: 0 var(--space-4);
12
+ border: 1px solid var(--color-border-strong);
13
+ border-radius: var(--radius-pill);
14
+ background: var(--color-surface);
15
+ color: var(--color-text);
16
+ font: inherit;
17
+ font-size: var(--text-section);
18
+ }
19
+
20
+ .filter-chips button:hover {
21
+ border-color: var(--color-text-muted);
22
+ }
23
+
24
+ .filter-chips button[aria-pressed="true"] {
25
+ border-color: var(--color-text);
26
+ background: var(--color-text);
27
+ color: #fff;
28
+ font-weight: 600;
29
+ }
30
+
31
+ .result-list {
32
+ list-style: none;
33
+ margin: 0;
34
+ padding: 0;
35
+ background: var(--color-surface);
36
+ border: 1px solid var(--color-border);
37
+ border-radius: var(--radius-lg);
38
+ overflow: hidden;
39
+ }
40
+
41
+ .result-list li + li {
42
+ border-top: 1px solid var(--color-divider);
43
+ }
44
+
45
+ .result-row {
46
+ display: flex;
47
+ align-items: center;
48
+ gap: var(--space-4);
49
+ min-height: 56px;
50
+ padding: 14px var(--space-5);
51
+ box-sizing: border-box;
52
+ color: var(--color-text);
53
+ }
54
+
55
+ .result-row:hover,
56
+ .result-row:focus-visible {
57
+ background: var(--color-surface-muted);
58
+ text-decoration: none;
59
+ }
60
+
61
+ .result-row:focus-visible {
62
+ outline-offset: -2px;
63
+ }
64
+
65
+ .result-row__text {
66
+ display: flex;
67
+ flex: 1;
68
+ min-width: 0;
69
+ flex-direction: column;
70
+ }
71
+
72
+ /*
73
+ * Plain text, not a flex row: the name is one string, and the `<mark>` around
74
+ * a search hit must not become a flex item with a gap beside it.
75
+ */
76
+ .result-row__name {
77
+ font-size: var(--text-lg);
78
+ font-weight: 600;
79
+ color: var(--color-accent);
80
+ }
81
+
82
+ .result-row__translation {
83
+ color: var(--color-text-secondary);
84
+ }
85
+
86
+ .no-results {
87
+ color: var(--color-text-muted);
88
+ }
89
+
90
+ /*
91
+ * The result component is a block of its own: chips first, then one section
92
+ * per type. On the entry page it lines up with the search field above it.
93
+ */
94
+ .search-results {
95
+ display: flex;
96
+ flex-direction: column;
97
+ gap: var(--space-6);
98
+ width: 100%;
99
+ max-width: 820px;
100
+ margin: 0 auto;
101
+ }
102
+
103
+ /*
104
+ * On a phone the row is mostly text: the chevron costs more width than the
105
+ * hint is worth, and the tag belongs next to the name rather than floating in
106
+ * the vertical middle of a wrapped row.
107
+ */
108
+ @media (max-width: 575.98px) {
109
+ .result-row {
110
+ align-items: flex-start;
111
+ gap: var(--space-3);
112
+ padding: var(--space-3) var(--space-4);
113
+ }
114
+
115
+ .result-row .icon {
116
+ display: none;
117
+ }
118
+
119
+ .result-row .tag,
120
+ .result-row .grade-badge {
121
+ margin-top: 2px;
122
+ }
123
+ }
@@ -0,0 +1,193 @@
1
+ /* SearchField — large on the entry and search pages, compact in the header. */
2
+
3
+ .search-form {
4
+ display: flex;
5
+ flex-direction: column;
6
+ }
7
+
8
+ .search-field {
9
+ display: flex;
10
+ align-items: center;
11
+ gap: var(--space-3);
12
+ height: 60px;
13
+ padding: 0 var(--space-2) 0 18px;
14
+ box-sizing: border-box;
15
+ background: var(--color-surface);
16
+ border: 1.5px solid var(--color-border-strong);
17
+ border-radius: var(--radius-lg);
18
+ box-shadow: 0 1px 2px rgb(22 24 29 / 6%);
19
+ }
20
+
21
+ .search-field:focus-within {
22
+ border-color: var(--color-accent);
23
+ box-shadow: 0 0 0 4px var(--color-focus-ring);
24
+ }
25
+
26
+ .search-field input {
27
+ flex: 1;
28
+ min-width: 0;
29
+ border: 0;
30
+ background: transparent;
31
+ font: inherit;
32
+ font-size: var(--text-lg);
33
+ color: var(--color-text);
34
+ outline: none;
35
+ }
36
+
37
+ .search-field input::placeholder {
38
+ color: var(--color-text-muted);
39
+ }
40
+
41
+ .search-clear {
42
+ display: flex;
43
+ align-items: center;
44
+ justify-content: center;
45
+ width: var(--touch-target);
46
+ height: var(--touch-target);
47
+ border: 0;
48
+ border-radius: var(--radius-md);
49
+ background: transparent;
50
+ color: var(--color-text-muted);
51
+ }
52
+
53
+ .search-clear:hover {
54
+ background: var(--color-surface-muted);
55
+ color: var(--color-text);
56
+ }
57
+
58
+ /* Compact variant for the header. */
59
+ .search-field--compact {
60
+ flex: 0 1 280px;
61
+ min-width: 200px;
62
+ height: var(--touch-target);
63
+ padding: 0 var(--space-3);
64
+ border-width: 1px;
65
+ border-radius: var(--radius-md);
66
+ background: #fafaf9;
67
+ box-shadow: none;
68
+ }
69
+
70
+ .search-field--compact input {
71
+ font-size: var(--text-section);
72
+ }
73
+
74
+ .visually-hidden-label {
75
+ position: absolute;
76
+ width: 1px;
77
+ height: 1px;
78
+ overflow: hidden;
79
+ clip-path: inset(50%);
80
+ white-space: nowrap;
81
+ }
82
+
83
+ /*
84
+ * On a phone the compact field shares its row with the language switch. Basis
85
+ * `0` rather than `auto`: the field must take the space that is left over, not
86
+ * claim the width of its own content and push the switch off the screen.
87
+ */
88
+ @media (max-width: 767.98px) {
89
+ .search-field--compact {
90
+ width: 100%;
91
+ min-width: 0;
92
+ }
93
+ }
94
+
95
+ /* Header trigger: looks like the compact field, opens the search dialog. */
96
+ .search-trigger {
97
+ color: var(--color-text-muted);
98
+ font: inherit;
99
+ font-size: var(--text-section);
100
+ text-align: left;
101
+ cursor: text;
102
+ }
103
+
104
+ .search-trigger span {
105
+ overflow: hidden;
106
+ text-overflow: ellipsis;
107
+ white-space: nowrap;
108
+ }
109
+
110
+ .search-trigger:hover {
111
+ border-color: var(--color-accent-border);
112
+ }
113
+
114
+ .search-trigger:focus-visible {
115
+ border-color: var(--color-accent);
116
+ box-shadow: 0 0 0 4px var(--color-focus-ring);
117
+ outline: none;
118
+ }
119
+
120
+ .search-dialog-host {
121
+ display: contents;
122
+ }
123
+
124
+ /*
125
+ * The panel fills the whole dialog, so a click that lands on the dialog
126
+ * element itself can only have hit the backdrop.
127
+ */
128
+ .search-dialog {
129
+ width: min(820px, 100% - 2 * var(--space-4));
130
+ max-width: none;
131
+ max-height: calc(100dvh - 2 * var(--space-12));
132
+ margin: var(--space-12) auto auto;
133
+ padding: 0;
134
+ border: 0;
135
+ border-radius: var(--radius-xl);
136
+ background: var(--color-bg);
137
+ box-shadow: 0 24px 64px rgb(22 24 29 / 24%);
138
+ }
139
+
140
+ .search-dialog::backdrop {
141
+ background: rgb(22 24 29 / 40%);
142
+ }
143
+
144
+ .search-dialog__panel {
145
+ padding: var(--space-6);
146
+ }
147
+
148
+ .search-dialog__bar {
149
+ display: flex;
150
+ align-items: center;
151
+ gap: var(--space-2);
152
+ }
153
+
154
+ .search-dialog__bar .search-form {
155
+ flex: 1;
156
+ min-width: 0;
157
+ }
158
+
159
+ .search-dialog__close {
160
+ display: flex;
161
+ flex: none;
162
+ align-items: center;
163
+ justify-content: center;
164
+ width: var(--touch-target);
165
+ height: var(--touch-target);
166
+ border: 0;
167
+ border-radius: var(--radius-md);
168
+ background: transparent;
169
+ color: var(--color-text-muted);
170
+ }
171
+
172
+ .search-dialog__close:hover {
173
+ background: var(--color-surface-muted);
174
+ color: var(--color-text);
175
+ }
176
+
177
+ body:has(.search-dialog[open]) {
178
+ overflow: hidden;
179
+ }
180
+
181
+ @media (max-width: 575.98px) {
182
+ .search-dialog {
183
+ width: 100%;
184
+ height: 100dvh;
185
+ max-height: none;
186
+ margin: 0;
187
+ border-radius: 0;
188
+ }
189
+
190
+ .search-dialog__panel {
191
+ padding: var(--space-4);
192
+ }
193
+ }