@openbooknetwork/hesap 0.2.3 → 0.3.0
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.
- package/package.json +2 -2
- package/src/client.css +89 -1
- package/src/families/counters/client.css +89 -1
- package/src/families/counters/client.js +9 -12
- package/src/families/counters/count-figures.js +23 -3
- package/src/families/counters/count-model.js +5 -0
- package/src/families/counters/count.js +27 -4
- package/src/families/counters/count.mjs +5 -3
- package/src/families/counters/counter.js +11 -0
- package/src/families/counters/i18n/en.yaml +68 -0
- package/src/families/counters/i18n/tr.yaml +68 -0
- package/src/families/counters/index.mjs +9 -6
- package/src/families/counters/match-figures.js +60 -0
- package/src/families/counters/match-goals.js +63 -0
- package/src/families/counters/match-model.js +84 -0
- package/src/families/counters/match.js +379 -0
- package/src/families/counters/match.mjs +96 -0
- package/src/families/counters/order-figures.js +46 -0
- package/src/families/counters/order-model.js +69 -0
- package/src/families/counters/order.js +199 -0
- package/src/families/counters/order.mjs +62 -0
- package/src/families/counters/reading.js +66 -0
- package/src/families/counters/scenes.js +18 -0
- package/src/i18n/en.yaml +68 -0
- package/src/i18n/tr.yaml +68 -0
- package/src/kit/panel.js +7 -4
- package/src/node.mjs +10 -0
package/src/i18n/en.yaml
CHANGED
|
@@ -99,3 +99,71 @@ counters_hint-count-on: "Start from {box} and say the next number for each count
|
|
|
99
99
|
counters_hint-count-back: "Start from {start} and say the number before for each counter you take away. Stop at {target}."
|
|
100
100
|
counters_roll: Roll the ball
|
|
101
101
|
counters_set-up: Set up the pins
|
|
102
|
+
counters_ctl-top: Top row
|
|
103
|
+
counters_ctl-bottom: Bottom row
|
|
104
|
+
counters_ctl-spread: Spacing
|
|
105
|
+
counters_match-unpaired: Without a partner
|
|
106
|
+
counters_match-pairs: Pairs
|
|
107
|
+
counters_word-same: The same
|
|
108
|
+
counters_tag-more: more
|
|
109
|
+
counters_tag-fewer: fewer
|
|
110
|
+
counters_tag-same: the same
|
|
111
|
+
counters_tag-more-n: "{n} more"
|
|
112
|
+
counters_tag-fewer-n: "{n} fewer"
|
|
113
|
+
counters_match-top: Top row
|
|
114
|
+
counters_match-bottom: Bottom row
|
|
115
|
+
counters_match-counted: Last number said
|
|
116
|
+
counters_match-added: Added
|
|
117
|
+
counters_match-taken: Taken away
|
|
118
|
+
counters_match-chairs-top: Players
|
|
119
|
+
counters_match-chairs-bottom: Chairs
|
|
120
|
+
counters_chairs-stop: Stop the music
|
|
121
|
+
counters_chairs-next: Next round
|
|
122
|
+
counters_chairs-again: Play again
|
|
123
|
+
counters_row-now: now
|
|
124
|
+
counters_row-before: before
|
|
125
|
+
counters_match-trail-top: Now
|
|
126
|
+
counters_match-trail-bottom: Before
|
|
127
|
+
counters_one-less: one less
|
|
128
|
+
counters_one-more: one more
|
|
129
|
+
counters_sides-count: Number
|
|
130
|
+
counters_sides-before: Number before
|
|
131
|
+
counters_sides-after: Number after
|
|
132
|
+
counters_reading-less: "{a} is less than {b}"
|
|
133
|
+
counters_reading-same: "{a} is the same as {b}"
|
|
134
|
+
counters_reading-greater: "{a} is greater than {b}"
|
|
135
|
+
counters_is-less: is less than
|
|
136
|
+
counters_is-greater: is greater than
|
|
137
|
+
counters_least: least
|
|
138
|
+
counters_greatest: greatest
|
|
139
|
+
counters_show-rows: Show the rows
|
|
140
|
+
counters_order-top: First number
|
|
141
|
+
counters_order-bottom: Second number
|
|
142
|
+
counters_order-top-rows: "First, full rows"
|
|
143
|
+
counters_order-top-last: "First, last row"
|
|
144
|
+
counters_order-bottom-rows: "Second, full rows"
|
|
145
|
+
counters_order-bottom-last: "Second, last row"
|
|
146
|
+
counters_reading-equal: "{a} is equal to {b}"
|
|
147
|
+
counters_verdict-true: "true"
|
|
148
|
+
counters_verdict-false: "false"
|
|
149
|
+
counters_sign: Sign
|
|
150
|
+
counters_match-reading: In words
|
|
151
|
+
counters_match-verdict: The line is
|
|
152
|
+
counters_match-scoreboard-top: Home
|
|
153
|
+
counters_match-scoreboard-bottom: Away
|
|
154
|
+
counters_score-top: Home goal
|
|
155
|
+
counters_score-bottom: Away goal
|
|
156
|
+
counters_new-match: New match
|
|
157
|
+
counters_goal-same-rows: "Make the top row the same as the bottom row, then press Check."
|
|
158
|
+
counters_note-same-rows-top: Some counters of the top row have no partner.
|
|
159
|
+
counters_note-same-rows-bottom: Some counters of the bottom row have no partner.
|
|
160
|
+
counters_hint-same-rows: "Draw a line from each top counter to a bottom counter. The counters left without a line show what to change."
|
|
161
|
+
counters_goal-one-less: "Give the top row one counter fewer than the bottom row, then press Check."
|
|
162
|
+
counters_note-one-less-over: The top row has too many counters.
|
|
163
|
+
counters_note-one-less-short: The top row has too few counters.
|
|
164
|
+
counters_hint-one-less: "Pair the rows. One counter fewer leaves one counter of the bottom row without a partner."
|
|
165
|
+
counters_goal-right-sign: "Put the sign between the two rows that makes the line true, then press Check."
|
|
166
|
+
counters_note-right-sign-more: The top row has more counters than this sign says.
|
|
167
|
+
counters_note-right-sign-fewer: The top row has fewer counters than this sign says.
|
|
168
|
+
counters_hint-right-sign: "Draw a line from each top counter to a bottom counter. The row with counters left without a partner has more, and the open side of the sign faces it. With no counter left, the sign is =."
|
|
169
|
+
counters_new-numbers: New numbers
|
package/src/i18n/tr.yaml
CHANGED
|
@@ -99,3 +99,71 @@ counters_hint-count-on: "{box} sayısından başlayın ve kutunun yanına koydu
|
|
|
99
99
|
counters_hint-count-back: "{start} sayısından başlayın ve aldığınız her sayaç için bir önceki sayıyı söyleyin. {target} sayısında durun."
|
|
100
100
|
counters_roll: Topu yuvarla
|
|
101
101
|
counters_set-up: Lobutları diz
|
|
102
|
+
counters_ctl-top: Üst sıra
|
|
103
|
+
counters_ctl-bottom: Alt sıra
|
|
104
|
+
counters_ctl-spread: Aralık
|
|
105
|
+
counters_match-unpaired: Eşi olmayan
|
|
106
|
+
counters_match-pairs: Çiftler
|
|
107
|
+
counters_word-same: Aynı
|
|
108
|
+
counters_tag-more: daha çok
|
|
109
|
+
counters_tag-fewer: daha az
|
|
110
|
+
counters_tag-same: aynı
|
|
111
|
+
counters_tag-more-n: "{n} daha çok"
|
|
112
|
+
counters_tag-fewer-n: "{n} daha az"
|
|
113
|
+
counters_match-top: Üst sıra
|
|
114
|
+
counters_match-bottom: Alt sıra
|
|
115
|
+
counters_match-counted: Son söylenen sayı
|
|
116
|
+
counters_match-added: Eklenen
|
|
117
|
+
counters_match-taken: Çıkarılan
|
|
118
|
+
counters_match-chairs-top: Oyuncular
|
|
119
|
+
counters_match-chairs-bottom: Sandalyeler
|
|
120
|
+
counters_chairs-stop: Müziği durdur
|
|
121
|
+
counters_chairs-next: Sonraki tur
|
|
122
|
+
counters_chairs-again: Yeniden oyna
|
|
123
|
+
counters_row-now: şimdi
|
|
124
|
+
counters_row-before: önce
|
|
125
|
+
counters_match-trail-top: Şimdi
|
|
126
|
+
counters_match-trail-bottom: Önce
|
|
127
|
+
counters_one-less: bir eksik
|
|
128
|
+
counters_one-more: bir fazla
|
|
129
|
+
counters_sides-count: Sayı
|
|
130
|
+
counters_sides-before: Önceki sayı
|
|
131
|
+
counters_sides-after: Sonraki sayı
|
|
132
|
+
counters_reading-less: "{a}, {b} sayısından küçüktür"
|
|
133
|
+
counters_reading-same: "{a}, {b} ile aynıdır"
|
|
134
|
+
counters_reading-greater: "{a}, {b} sayısından büyüktür"
|
|
135
|
+
counters_is-less: küçüktür
|
|
136
|
+
counters_is-greater: büyüktür
|
|
137
|
+
counters_least: en küçük
|
|
138
|
+
counters_greatest: en büyük
|
|
139
|
+
counters_show-rows: Sıraları göster
|
|
140
|
+
counters_order-top: Birinci sayı
|
|
141
|
+
counters_order-bottom: İkinci sayı
|
|
142
|
+
counters_order-top-rows: "Birinci, tam sıralar"
|
|
143
|
+
counters_order-top-last: "Birinci, son sıra"
|
|
144
|
+
counters_order-bottom-rows: "İkinci, tam sıralar"
|
|
145
|
+
counters_order-bottom-last: "İkinci, son sıra"
|
|
146
|
+
counters_reading-equal: "{a}, {b} sayısına eşittir"
|
|
147
|
+
counters_verdict-true: "doğru"
|
|
148
|
+
counters_verdict-false: "yanlış"
|
|
149
|
+
counters_sign: İşaret
|
|
150
|
+
counters_match-reading: Sözle
|
|
151
|
+
counters_match-verdict: Satır
|
|
152
|
+
counters_match-scoreboard-top: Ev sahibi
|
|
153
|
+
counters_match-scoreboard-bottom: Deplasman
|
|
154
|
+
counters_score-top: Ev sahibi golü
|
|
155
|
+
counters_score-bottom: Deplasman golü
|
|
156
|
+
counters_new-match: Yeni maç
|
|
157
|
+
counters_goal-same-rows: "Üst sırayı alt sırayla aynı yapın, sonra Kontrol et düğmesine basın."
|
|
158
|
+
counters_note-same-rows-top: Üst sıradaki bazı sayaçların eşi yok.
|
|
159
|
+
counters_note-same-rows-bottom: Alt sıradaki bazı sayaçların eşi yok.
|
|
160
|
+
counters_hint-same-rows: "Her üst sayaçtan bir alt sayaca çizgi çizin. Çizgisiz kalan sayaçlar neyi değiştireceğinizi gösterir."
|
|
161
|
+
counters_goal-one-less: "Üst sıraya alt sıradan bir sayaç az verin, sonra Kontrol et düğmesine basın."
|
|
162
|
+
counters_note-one-less-over: Üst sırada fazla sayaç var.
|
|
163
|
+
counters_note-one-less-short: Üst sırada eksik sayaç var.
|
|
164
|
+
counters_hint-one-less: "Sıraları eşleştirin. Bir sayaç az olunca alt sıranın bir sayacı eşsiz kalır."
|
|
165
|
+
counters_goal-right-sign: "İki sıranın arasına satırı doğru yapan işareti koyun, sonra Kontrol et düğmesine basın."
|
|
166
|
+
counters_note-right-sign-more: Üst sırada bu işaretin söylediğinden çok sayaç var.
|
|
167
|
+
counters_note-right-sign-fewer: Üst sırada bu işaretin söylediğinden az sayaç var.
|
|
168
|
+
counters_hint-right-sign: "Her üst sayaçtan bir alt sayaca çizgi çizin. Eşsiz sayacı kalan sırada daha çok sayaç vardır ve işaretin açık yanı ona bakar. Hiç sayaç kalmazsa işaret = olur."
|
|
169
|
+
counters_new-numbers: Yeni sayılar
|
package/src/kit/panel.js
CHANGED
|
@@ -56,15 +56,18 @@ export function segment({ id, label, items, value, pick }) {
|
|
|
56
56
|
set(value);
|
|
57
57
|
return { el, set, get: () => value };
|
|
58
58
|
}
|
|
59
|
-
// stepper is a whole number with a button on each side to take one away or add one.
|
|
60
|
-
|
|
59
|
+
// stepper is a whole number with a button on each side to take one away or add one. A stepper made with shown: false
|
|
60
|
+
// keeps its number out of sight and out of speech and holds its room, for a page whose reader must not read the
|
|
61
|
+
// count, and show puts the number on or off.
|
|
62
|
+
export function stepper({ id, label, min, max, step = 1, value, write = String, change, shown = true }) {
|
|
61
63
|
const out = h('output'), less = h('button', { type: 'button', 'aria-label': `${label} −` }, '−'), more = h('button', { type: 'button', 'aria-label': `${label} +` }, '+');
|
|
62
64
|
const el = h('div', { class: 'hesap-step', role: 'group', 'aria-label': label, 'data-ref': id }, [h('span', {}, label), less, out, more]);
|
|
63
65
|
const set = v => { value = Math.max(min, Math.min(max, v)); out.textContent = write(value); less.disabled = value <= min; more.disabled = value >= max; };
|
|
64
66
|
less.addEventListener('click', () => { set(value - step); change(value); });
|
|
65
67
|
more.addEventListener('click', () => { set(value + step); change(value); });
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
const show = on => { out.style.visibility = on ? '' : 'hidden'; out.setAttribute('aria-hidden', on ? 'false' : 'true'); };
|
|
69
|
+
set(value); show(shown);
|
|
70
|
+
return { el, set, show, get: () => value };
|
|
68
71
|
}
|
|
69
72
|
// row groups parts of the panel: ctl for controls, out for readouts, acts for buttons.
|
|
70
73
|
export const row = (kind, parts) => h('div', { class: `hesap-${kind}` }, parts.filter(Boolean).map(p => p.el ?? p));
|
package/src/node.mjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// What every family's Node half shares: escaping, the link pattern of a text, the links object kitap asks for and
|
|
2
2
|
// the checks every challenge gets.
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
import { loadCatalogues } from '@openbooknetwork/kitap';
|
|
3
5
|
import { dice } from './kit/random.js';
|
|
6
|
+
import { fill } from './kit/format.js';
|
|
4
7
|
|
|
5
8
|
export const esc = s => String(s ?? '').replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
6
9
|
export const list = ids => [...ids].join(', ');
|
|
@@ -48,3 +51,10 @@ export function value(v) {
|
|
|
48
51
|
const kind = v.slider ? 'slider' : 'stepper', [lo, hi] = v[kind];
|
|
49
52
|
return { n: v.start ?? lo, ctl: { kind, lo, hi } };
|
|
50
53
|
}
|
|
54
|
+
// string reads one of hesap's strings in a language, for a link that shows a word. A language hesap has no strings
|
|
55
|
+
// for reads the English ones. vars fill the string's {name} places.
|
|
56
|
+
const I18N = fileURLToPath(new URL('./i18n/', import.meta.url)), STRINGS = new Map();
|
|
57
|
+
export function string(lang, key, vars) {
|
|
58
|
+
if (!STRINGS.has(lang)) { const cats = loadCatalogues(I18N, [lang, 'en']); STRINGS.set(lang, cats[lang] ?? cats.en); }
|
|
59
|
+
return fill(STRINGS.get(lang)[key], vars);
|
|
60
|
+
}
|