@openbooknetwork/hesap 0.2.3 → 0.3.1
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 +254 -1
- package/src/families/counters/add-figures.js +85 -0
- package/src/families/counters/add-goals.js +82 -0
- package/src/families/counters/add-model.js +82 -0
- package/src/families/counters/add.js +442 -0
- package/src/families/counters/add.mjs +102 -0
- package/src/families/counters/bonds.js +5 -5
- package/src/families/counters/client.css +126 -1
- package/src/families/counters/client.js +10 -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 +31 -9
- package/src/families/counters/count.mjs +5 -3
- package/src/families/counters/counter.js +25 -0
- package/src/families/counters/goals.js +1 -9
- package/src/families/counters/i18n/en.yaml +142 -30
- package/src/families/counters/i18n/tr.yaml +116 -4
- package/src/families/counters/index.mjs +11 -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 +93 -0
- package/src/families/counters/match.js +399 -0
- package/src/families/counters/match.mjs +102 -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/families/line/client.css +118 -0
- package/src/families/line/client.js +12 -0
- package/src/families/line/figures.js +143 -0
- package/src/families/line/goals.js +168 -0
- package/src/families/line/i18n/en.yaml +61 -0
- package/src/families/line/i18n/tr.yaml +61 -0
- package/src/families/line/index.mjs +227 -0
- package/src/families/line/lens.js +49 -0
- package/src/families/line/line.js +624 -0
- package/src/families/line/model.js +219 -0
- package/src/families.mjs +2 -1
- package/src/i18n/en.yaml +211 -31
- package/src/i18n/tr.yaml +184 -4
- package/src/kit/i18n/en.yaml +8 -1
- package/src/kit/i18n/tr.yaml +7 -0
- package/src/kit/kit.css +9 -0
- package/src/kit/panel.js +9 -4
- package/src/kit/random.js +9 -0
- package/src/kit/written.js +70 -0
- package/src/node.mjs +13 -1
package/src/i18n/tr.yaml
CHANGED
|
@@ -9,10 +9,17 @@ hesap_start: Başlat
|
|
|
9
9
|
hesap_time: Zaman
|
|
10
10
|
hesap_reset: Baştan başla
|
|
11
11
|
hesap_undo: Geri al
|
|
12
|
+
hesap_check: Kontrol et
|
|
12
13
|
hesap_hint: İpucu
|
|
13
14
|
hesap_another: Bir tane daha
|
|
14
15
|
hesap_solved: Çözüldü
|
|
15
16
|
hesap_not-yet: Henüz çözülmedi.
|
|
17
|
+
hesap_written: İşlem
|
|
18
|
+
hesap_written-reading: Sözle
|
|
19
|
+
hesap_written-plus: "{a} artı {b} eşittir {c}"
|
|
20
|
+
hesap_written-minus: "{a} eksi {b} eşittir {c}"
|
|
21
|
+
hesap_written-plus-open: "{a} artı {b}"
|
|
22
|
+
hesap_written-minus-open: "{a} eksi {b}"
|
|
16
23
|
counters_lead: "Sayaçlara dokunun, onları sürükleyin ve sayıların onları nasıl izlediğine bakın."
|
|
17
24
|
counters_whole: Bütün
|
|
18
25
|
counters_first: Birinci parça
|
|
@@ -29,8 +36,8 @@ counters_one-found: Bulunan ikililer
|
|
|
29
36
|
counters_one-ways: Tüm ikililer
|
|
30
37
|
counters_two-first: Kırmızı
|
|
31
38
|
counters_two-second: Mavi
|
|
32
|
-
counters_cup-first:
|
|
33
|
-
counters_cup-second:
|
|
39
|
+
counters_cup-first: Bilinen parça
|
|
40
|
+
counters_cup-second: Bilinmeyen parça
|
|
34
41
|
counters_cup-added: Eklenen mavi
|
|
35
42
|
counters_pins-first: Ayakta
|
|
36
43
|
counters_pins-empty: Devrilen
|
|
@@ -42,7 +49,6 @@ counters_fill: İkinci çerçeveyi doldur
|
|
|
42
49
|
counters_unfill: İkinci çerçeveyi boşalt
|
|
43
50
|
counters_lift: Bardağı kaldır
|
|
44
51
|
counters_lower: Bardağı geri koy
|
|
45
|
-
counters_check: Kontrol et
|
|
46
52
|
counters_blue: Mavi sayaçlar
|
|
47
53
|
counters_tray: Tepsi
|
|
48
54
|
counters_pile: Yığın
|
|
@@ -58,7 +64,7 @@ counters_list-splits: "{x} sayısının ayrımları"
|
|
|
58
64
|
counters_list-pairs: "{x} yapan ikililer"
|
|
59
65
|
counters_goal-make-whole: "Kırmızı tepside {part} sayaç var. Çerçeve {whole} sayaç tutacak biçimde mavi sayaçları ayarlayın, sonra Kontrol et düğmesine basın."
|
|
60
66
|
counters_goal-make-whole-two: "Kırmızı tepside {part} sayaç var. İki çerçeve {whole} sayaç tutacak biçimde mavi sayaçları ayarlayın, sonra Kontrol et düğmesine basın."
|
|
61
|
-
counters_goal-hidden-part: "Bütün {whole},
|
|
67
|
+
counters_goal-hidden-part: "Bütün {whole}, bilinen parça {part}. Bardağın altındaki parçayı tepside kurun, sonra bardağı kaldırın."
|
|
62
68
|
counters_note-short: Bazı hücreler hâlâ boş.
|
|
63
69
|
counters_note-over: Bazı sayaçlara hücre kalmadı.
|
|
64
70
|
counters_note-more: Tepside bardaktakinden çok sayaç var.
|
|
@@ -99,3 +105,177 @@ counters_hint-count-on: "{box} sayısından başlayın ve kutunun yanına koydu
|
|
|
99
105
|
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
106
|
counters_roll: Topu yuvarla
|
|
101
107
|
counters_set-up: Lobutları diz
|
|
108
|
+
counters_ctl-top: Üst sıra
|
|
109
|
+
counters_ctl-bottom: Alt sıra
|
|
110
|
+
counters_ctl-spread: Aralık
|
|
111
|
+
counters_match-unpaired: Eşleşmeyen
|
|
112
|
+
counters_match-pairs: Eşleşenler
|
|
113
|
+
counters_word-same: Aynı
|
|
114
|
+
counters_tag-more: daha çok
|
|
115
|
+
counters_tag-fewer: daha az
|
|
116
|
+
counters_tag-same: aynı
|
|
117
|
+
counters_tag-more-n: "{n} daha çok"
|
|
118
|
+
counters_tag-fewer-n: "{n} daha az"
|
|
119
|
+
counters_match-top: Üst sıra
|
|
120
|
+
counters_match-bottom: Alt sıra
|
|
121
|
+
counters_match-counted: Son söylenen sayı
|
|
122
|
+
counters_match-added: Eklenen
|
|
123
|
+
counters_match-taken: Çıkarılan
|
|
124
|
+
counters_match-chairs-top: Oyuncular
|
|
125
|
+
counters_match-chairs-bottom: Sandalyeler
|
|
126
|
+
counters_chairs-stop: Müziği durdur
|
|
127
|
+
counters_chairs-next: Sonraki tur
|
|
128
|
+
counters_chairs-again: Yeniden oyna
|
|
129
|
+
counters_row-now: şimdi
|
|
130
|
+
counters_row-before: önce
|
|
131
|
+
counters_match-trail-top: Şimdi
|
|
132
|
+
counters_match-trail-bottom: Önce
|
|
133
|
+
counters_one-less: bir eksik
|
|
134
|
+
counters_one-more: bir fazla
|
|
135
|
+
counters_sides-count: Sayı
|
|
136
|
+
counters_sides-before: Önceki sayı
|
|
137
|
+
counters_sides-after: Sonraki sayı
|
|
138
|
+
counters_reading-less: "{a}, {b} sayısından küçüktür"
|
|
139
|
+
counters_reading-same: "{a}, {b} ile aynıdır"
|
|
140
|
+
counters_reading-greater: "{a}, {b} sayısından büyüktür"
|
|
141
|
+
counters_is-less: küçüktür
|
|
142
|
+
counters_is-greater: büyüktür
|
|
143
|
+
counters_least: en küçük
|
|
144
|
+
counters_greatest: en büyük
|
|
145
|
+
counters_show-rows: Sıraları göster
|
|
146
|
+
counters_order-top: Birinci sayı
|
|
147
|
+
counters_order-bottom: İkinci sayı
|
|
148
|
+
counters_order-top-rows: "Birinci, tam sıralar"
|
|
149
|
+
counters_order-top-last: "Birinci, son sıra"
|
|
150
|
+
counters_order-bottom-rows: "İkinci, tam sıralar"
|
|
151
|
+
counters_order-bottom-last: "İkinci, son sıra"
|
|
152
|
+
counters_reading-equal: "{a}, {b} sayısına eşittir"
|
|
153
|
+
counters_verdict-true: "doğru"
|
|
154
|
+
counters_verdict-false: "yanlış"
|
|
155
|
+
counters_sign: İşaret
|
|
156
|
+
counters_match-reading: Sözle
|
|
157
|
+
counters_match-verdict: İfade
|
|
158
|
+
counters_match-scoreboard-top: Ev sahibi
|
|
159
|
+
counters_match-scoreboard-bottom: Deplasman
|
|
160
|
+
counters_score-top: Ev sahibi golü
|
|
161
|
+
counters_score-bottom: Deplasman golü
|
|
162
|
+
counters_new-match: Yeni maç
|
|
163
|
+
counters_goal-same-rows: "Üst sırayı alt sırayla aynı yapın, sonra Kontrol et düğmesine basın."
|
|
164
|
+
counters_note-same-rows-top: Üst sıradaki bazı sayaçlar eşleşmedi.
|
|
165
|
+
counters_note-same-rows-bottom: Alt sıradaki bazı sayaçlar eşleşmedi.
|
|
166
|
+
counters_hint-same-rows: "Her üst sayaçtan bir alt sayaca çizgi çizin. Çizgisiz kalan sayaçlar neyi değiştireceğinizi gösterir."
|
|
167
|
+
counters_goal-one-less: "Üst sıraya alt sıradan bir sayaç az verin, sonra Kontrol et düğmesine basın."
|
|
168
|
+
counters_note-one-less-over: Üst sırada fazla sayaç var.
|
|
169
|
+
counters_note-one-less-short: Üst sırada eksik sayaç var.
|
|
170
|
+
counters_hint-one-less: "Sıraları eşleştirin. Bir sayaç az olunca alt sıranın bir sayacı eşleşmeden kalır."
|
|
171
|
+
counters_goal-right-sign: "İki sıranın arasına ifadeyi doğru yapan işareti koyun, sonra Kontrol et düğmesine basın."
|
|
172
|
+
counters_note-right-sign-more: Üst sırada bu işaretin söylediğinden çok sayaç var.
|
|
173
|
+
counters_note-right-sign-fewer: Üst sırada bu işaretin söylediğinden az sayaç var.
|
|
174
|
+
counters_hint-right-sign: "Her üst sayaçtan bir alt sayaca çizgi çizin. Eşleşmeyen sayacı kalan sırada daha çok sayaç vardır ve işaretin açık yanı ona bakar. Hiç sayaç kalmazsa işaret = olur."
|
|
175
|
+
counters_new-numbers: Yeni sayılar
|
|
176
|
+
counters_add-first: Birinci sayı
|
|
177
|
+
counters_add-second: İkinci sayı
|
|
178
|
+
counters_add-waiting: Bekleyen
|
|
179
|
+
counters_add-sum: Toplam
|
|
180
|
+
counters_add-dice-sum: Çerçevelerdeki sayaçlar
|
|
181
|
+
counters_add-roll: Zar at
|
|
182
|
+
counters_add-die: "{x} gösteren zar"
|
|
183
|
+
counters_add-counter-waiting: Bekleyen sayaç
|
|
184
|
+
counters_add-counter-joined: Bir araya getirilen sayaç
|
|
185
|
+
counters_add-take-second: Çıkan
|
|
186
|
+
counters_add-left: Fark
|
|
187
|
+
counters_add-take-counter: Sayaç
|
|
188
|
+
counters_add-take-ring: Çıkan sayacın halkası
|
|
189
|
+
counters_add-shelf-first: Sabah
|
|
190
|
+
counters_add-shelf-second: Öğleden sonra
|
|
191
|
+
counters_add-shelf-sum: Satılan
|
|
192
|
+
counters_add-shelf-written: Satılan kavanozlar
|
|
193
|
+
counters_add-shelf-written-left: Kalan kavanozlar
|
|
194
|
+
counters_add-shelf-reading: Satılan kavanozlar sözle
|
|
195
|
+
counters_add-shelf-reading-left: Kalan kavanozlar sözle
|
|
196
|
+
counters_add-shelf-crate: Satış kasası
|
|
197
|
+
counters_add-shelf-jar: Raftaki kavanoz
|
|
198
|
+
counters_add-sold-jar: "Kasadaki kavanoz, {x}"
|
|
199
|
+
counters_add-to-ten: 10'a tamamlayan
|
|
200
|
+
counters_add-rest: Diğer parça
|
|
201
|
+
counters_add-seedling: Fide
|
|
202
|
+
counters_add-sprout: Filiz
|
|
203
|
+
counters_add-seed-waiting: Paketteki tohum
|
|
204
|
+
counters_add-seed-joined: Viyoldeki filiz
|
|
205
|
+
counters_goal-find-sum: "{a} ile {b} sayısının toplamını Toplam düğmeleriyle ayarlayın, sonra Kontrol et düğmesine basın."
|
|
206
|
+
counters_goal-find-sum-done: "{a} sayaçlık bir grup ile {b} sayaçlık bir grup bir araya gelince {sum} eder."
|
|
207
|
+
counters_note-find-sum-less: "Toplam {n} sayısından küçük."
|
|
208
|
+
counters_note-find-sum-greater: "Toplam {n} sayısından büyük."
|
|
209
|
+
counters_hint-find-sum: "Çerçevelerde {a} kırmızı sayaç ve onlarla bir araya gelen {b} mavi sayaç düşünün. {a} sayısından başlayıp her mavi sayaç için bir sayı ileri sayın."
|
|
210
|
+
counters_goal-steps-to-ten: "{calc} için 10'a tamamlayan ve Diğer parça düğmelerini ayarlayın, sonra Kontrol et düğmesine basın."
|
|
211
|
+
counters_goal-steps-to-ten-done: "{line}; {toTen} ve {rest}."
|
|
212
|
+
counters_note-steps-to-ten-past: "{step}, 10'u geçiyor."
|
|
213
|
+
counters_note-steps-to-ten-short: "{step}, 10'a varmıyor."
|
|
214
|
+
counters_note-steps-to-ten-more: "10'a tamamlayan ve Diğer parça, {second} sayısından çok ediyor."
|
|
215
|
+
counters_note-steps-to-ten-less: "10'a tamamlayan ve Diğer parça, {second} sayısından az ediyor."
|
|
216
|
+
counters_hint-steps-to-ten-plus: "10'a tamamlayan, {first} ile 10 eden sayıdır. Diğer parça, {second} sayısından geriye kalandır."
|
|
217
|
+
counters_hint-steps-to-ten-minus: "Ona kadar, {first} sayısının dolu onluğundan sonraki sayaçların sayısıdır. Diğer parça, {second} sayısından geriye kalandır."
|
|
218
|
+
counters_add-take-to-ten: Ona kadar
|
|
219
|
+
counters_goal-steps-to-ten-minus: "{calc} için Ona kadar ve Diğer parça düğmelerini ayarlayın, sonra Kontrol et düğmesine basın."
|
|
220
|
+
counters_add-shelf-left: Kalan
|
|
221
|
+
line_lead: "Noktayı doğru boyunca hareket ettirin ve çizgisindeki sayıyı okuyun."
|
|
222
|
+
line_jump-left: Sola zıpla
|
|
223
|
+
line_jump-right: Sağa zıpla
|
|
224
|
+
line_point: Noktadaki sayı
|
|
225
|
+
line_point-short: Nokta
|
|
226
|
+
line_second: İkinci noktadaki sayı
|
|
227
|
+
line_second-short: İkinci nokta
|
|
228
|
+
line_jumps: Zıplamalar
|
|
229
|
+
line_step: Adım
|
|
230
|
+
line_from: Sol uç
|
|
231
|
+
line_to: Sağ uç
|
|
232
|
+
line_point-name: Nokta
|
|
233
|
+
line_second-name: İkinci nokta
|
|
234
|
+
line_reading-later: "{a}, {b} sayısından büyüktür"
|
|
235
|
+
line_reading-both: "İki nokta da {a} üzerinde"
|
|
236
|
+
line_goal-place: "Noktayı {target} üzerine koyun, sonra Kontrol et düğmesine basın."
|
|
237
|
+
line_goal-place-done: "Nokta {target} üzerinde."
|
|
238
|
+
line_note-place-left: Nokta sayının solunda.
|
|
239
|
+
line_note-place-right: Nokta sayının sağında.
|
|
240
|
+
line_ten-before: Önceki onluk
|
|
241
|
+
line_ten-after: Sonraki onluk
|
|
242
|
+
line_placed: Yerleşen kartlar
|
|
243
|
+
line_placed-short: Yerleşen
|
|
244
|
+
line_placed-of: "{n} / {all}"
|
|
245
|
+
line_open-gap: "{a} ile {b} arasındaki aralık"
|
|
246
|
+
line_card: "Kart {x}"
|
|
247
|
+
line_find: Bul
|
|
248
|
+
line_show: Göster
|
|
249
|
+
line_next: Sonraki
|
|
250
|
+
line_middle: Orta
|
|
251
|
+
line_van: Kamyonet
|
|
252
|
+
line_estimate: Tahmin
|
|
253
|
+
line_open-book: Kitabı aç
|
|
254
|
+
line_bookmark: Ayraç
|
|
255
|
+
line_hint-place-unmarked: "Orta düğmesine basın. Sayı ortadan önce mi sonra mı? Sonra ortaya ve yakın uca ne kadar uzak olduğunu kestirin."
|
|
256
|
+
line_goal-place-unmarked-done: "Nokta {target} sayısına yakın."
|
|
257
|
+
line_between: "{a} ile {b} arasında"
|
|
258
|
+
line_gaps-unequal: Bazı aralıklar ötekilerden uzun.
|
|
259
|
+
line_gaps-equal: Bütün aralıklar eşit.
|
|
260
|
+
line_mark-name: "Çizgi {x}"
|
|
261
|
+
line_mark-left: Solundaki aralık daha uzun
|
|
262
|
+
line_mark-right: Sağındaki aralık daha uzun
|
|
263
|
+
line_mark-even: İki aralığı eşit
|
|
264
|
+
line_start: Başlangıç
|
|
265
|
+
line_goal-jump: "{start} sayısından zıplayarak {calc} işlemini bulun, sonra Kontrol et düğmesine basın."
|
|
266
|
+
line_note-jump-few: Zıplamalar az.
|
|
267
|
+
line_note-jump-many: Zıplamalar çok.
|
|
268
|
+
line_new-line: Yeni doğru
|
|
269
|
+
line_goal-place-unmarked: "Noktayı {target} sayısına yakın koyun, sonra Kontrol et düğmesine basın."
|
|
270
|
+
line_find-short: Bul
|
|
271
|
+
line_hint-place-on: "Sayının arasında durduğu iki uzun çizgiyi bulun. Soldakinden ileri ya da sağdakinden geri zıplayarak sayın."
|
|
272
|
+
line_hint-place-back: "Sayının arasında durduğu iki uzun çizgiyi bulun. Soldakinden ileri ya da sağdakinden geri zıplayarak sayın."
|
|
273
|
+
line_hint-place-two-labels-on: "Yan yana iki etiket adımı verir. Bir etiketten sayıya kadar zıplamaları sayın."
|
|
274
|
+
line_hint-place-two-labels-back: "Yan yana iki etiket adımı verir. Bir etiketten sayıya kadar zıplamaları sayın."
|
|
275
|
+
line_hint-jump-plus: "Başlangıçtaki sayıyı söyleyin, sonra her zıplamada bir sayı sayın. + için sağa, − için sola zıplayın."
|
|
276
|
+
line_hint-jump-minus: "Başlangıçtaki sayıyı söyleyin, sonra her zıplamada bir sayı sayın. + için sağa, − için sola zıplayın."
|
|
277
|
+
line_hint-jump-plus-one: "Başlangıçtaki sayıyı söyleyin, sonra her zıplamada bir sayı sayın. + için sağa, − için sola zıplayın."
|
|
278
|
+
line_hint-jump-minus-one: "Başlangıçtaki sayıyı söyleyin, sonra her zıplamada bir sayı sayın. + için sağa, − için sola zıplayın."
|
|
279
|
+
line_note-jump-way-plus: Nokta yanlış yöne zıpladı.
|
|
280
|
+
line_note-jump-way-minus: Nokta yanlış yöne zıpladı.
|
|
281
|
+
line_note-jump-few-none: Zıplamalar az.
|
package/src/kit/i18n/en.yaml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
hint: Move the figure and watch the numbers
|
|
1
|
+
hint: "Move things on the figure and watch the numbers change."
|
|
2
2
|
tab_map: Figure
|
|
3
3
|
map_data: Data
|
|
4
4
|
map_view: View
|
|
@@ -9,7 +9,14 @@ hesap_start: Start
|
|
|
9
9
|
hesap_time: Time
|
|
10
10
|
hesap_reset: Start again
|
|
11
11
|
hesap_undo: Undo
|
|
12
|
+
hesap_check: Check
|
|
12
13
|
hesap_hint: Hint
|
|
13
14
|
hesap_another: Another one
|
|
14
15
|
hesap_solved: Solved
|
|
15
16
|
hesap_not-yet: Not solved yet.
|
|
17
|
+
hesap_written: Number sentence
|
|
18
|
+
hesap_written-reading: In words
|
|
19
|
+
hesap_written-plus: "{a} plus {b} is equal to {c}"
|
|
20
|
+
hesap_written-minus: "{a} minus {b} is equal to {c}"
|
|
21
|
+
hesap_written-plus-open: "{a} plus {b}"
|
|
22
|
+
hesap_written-minus-open: "{a} minus {b}"
|
package/src/kit/i18n/tr.yaml
CHANGED
|
@@ -9,7 +9,14 @@ hesap_start: Başlat
|
|
|
9
9
|
hesap_time: Zaman
|
|
10
10
|
hesap_reset: Baştan başla
|
|
11
11
|
hesap_undo: Geri al
|
|
12
|
+
hesap_check: Kontrol et
|
|
12
13
|
hesap_hint: İpucu
|
|
13
14
|
hesap_another: Bir tane daha
|
|
14
15
|
hesap_solved: Çözüldü
|
|
15
16
|
hesap_not-yet: Henüz çözülmedi.
|
|
17
|
+
hesap_written: İşlem
|
|
18
|
+
hesap_written-reading: Sözle
|
|
19
|
+
hesap_written-plus: "{a} artı {b} eşittir {c}"
|
|
20
|
+
hesap_written-minus: "{a} eksi {b} eşittir {c}"
|
|
21
|
+
hesap_written-plus-open: "{a} artı {b}"
|
|
22
|
+
hesap_written-minus-open: "{a} eksi {b}"
|
package/src/kit/kit.css
CHANGED
|
@@ -87,3 +87,12 @@ aside.story .place[data-formula] .katex-display>.katex{text-align:start}
|
|
|
87
87
|
/* The peek card sits above the panel. A figure stays clear of the card by leaving --hesap-peek free at its foot. */
|
|
88
88
|
.peek{bottom:calc(var(--hesap-panel,0px) + .571rem)}
|
|
89
89
|
}
|
|
90
|
+
|
|
91
|
+
/* The written line of a calculation under a figure, such as 5 + 3 = 8. A number takes its group's colour through
|
|
92
|
+
the family's class, and the signs and the answer are ink. A link underlines the numbers it points to, and a link
|
|
93
|
+
to the whole line underlines the line. */
|
|
94
|
+
.hesap .hesap-written{font-size:34px;font-weight:700;white-space:pre;fill:var(--ink);stroke:none;text-anchor:middle;dominant-baseline:central;font-variant-numeric:tabular-nums;pointer-events:none}
|
|
95
|
+
.hesap .hesap-written.hesap-written-step{font-size:26px}
|
|
96
|
+
.hesap .hesap-written [data-ref]{stroke:none}
|
|
97
|
+
.hesap .hesap-written .hesap-written-num{fill:var(--c,var(--ink))}
|
|
98
|
+
.hesap .hesap-written .hesap-written-hot,.hesap .hesap-written.hesap-written-hot{text-decoration:underline}
|
package/src/kit/panel.js
CHANGED
|
@@ -47,6 +47,8 @@ export function button({ label, act, press, primary = false, glyph = null, compa
|
|
|
47
47
|
if (press) el.addEventListener('click', press);
|
|
48
48
|
return el;
|
|
49
49
|
}
|
|
50
|
+
// check is the button that commits a challenge's answer. T gives the shared strings, and press runs once per press.
|
|
51
|
+
export const check = ({ T, press }) => button({ label: T('check'), act: 'check', primary: true, press });
|
|
50
52
|
// segment is one choice out of a few, each a button. items are [value, words] pairs.
|
|
51
53
|
export function segment({ id, label, items, value, pick }) {
|
|
52
54
|
const buttons = items.map(([v, words]) => h('button', { type: 'button', 'data-v': v }, words));
|
|
@@ -56,15 +58,18 @@ export function segment({ id, label, items, value, pick }) {
|
|
|
56
58
|
set(value);
|
|
57
59
|
return { el, set, get: () => value };
|
|
58
60
|
}
|
|
59
|
-
// stepper is a whole number with a button on each side to take one away or add one.
|
|
60
|
-
|
|
61
|
+
// stepper is a whole number with a button on each side to take one away or add one. A stepper made with shown: false
|
|
62
|
+
// keeps its number out of sight and out of speech and holds its room, for a page whose reader must not read the
|
|
63
|
+
// count, and show puts the number on or off.
|
|
64
|
+
export function stepper({ id, label, min, max, step = 1, value, write = String, change, shown = true }) {
|
|
61
65
|
const out = h('output'), less = h('button', { type: 'button', 'aria-label': `${label} −` }, '−'), more = h('button', { type: 'button', 'aria-label': `${label} +` }, '+');
|
|
62
66
|
const el = h('div', { class: 'hesap-step', role: 'group', 'aria-label': label, 'data-ref': id }, [h('span', {}, label), less, out, more]);
|
|
63
67
|
const set = v => { value = Math.max(min, Math.min(max, v)); out.textContent = write(value); less.disabled = value <= min; more.disabled = value >= max; };
|
|
64
68
|
less.addEventListener('click', () => { set(value - step); change(value); });
|
|
65
69
|
more.addEventListener('click', () => { set(value + step); change(value); });
|
|
66
|
-
|
|
67
|
-
|
|
70
|
+
const show = on => { out.style.visibility = on ? '' : 'hidden'; out.setAttribute('aria-hidden', on ? 'false' : 'true'); };
|
|
71
|
+
set(value); show(shown);
|
|
72
|
+
return { el, set, show, get: () => value };
|
|
68
73
|
}
|
|
69
74
|
// row groups parts of the panel: ctl for controls, out for readouts, acts for buttons.
|
|
70
75
|
export const row = (kind, parts) => h('div', { class: `hesap-${kind}` }, parts.filter(Boolean).map(p => p.el ?? p));
|
package/src/kit/random.js
CHANGED
|
@@ -33,3 +33,12 @@ export function dice(seed) {
|
|
|
33
33
|
const shuffle = items => { const a = [...items]; for (let i = a.length - 1; i > 0; i--) { const j = int(0, i); [a[i], a[j]] = [a[j], a[i]]; } return a; };
|
|
34
34
|
return { next, int, pick: items => items[int(0, items.length - 1)], shuffle, some: (items, n) => shuffle(items).slice(0, n) };
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
// another draws a goal's target that differs from the last one, so Another one always changes the figure.
|
|
38
|
+
export function another(goal, c, spec, dice, last) {
|
|
39
|
+
for (let i = 0; i < 40; i++) {
|
|
40
|
+
const t = goal.draw(c, spec, dice);
|
|
41
|
+
if (!last || JSON.stringify(t) !== JSON.stringify(last)) return t;
|
|
42
|
+
}
|
|
43
|
+
return goal.draw(c, spec, dice);
|
|
44
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
// The written line of a calculation under a figure, such as 5 + 3 = 8, or 13 − 8 before the figure shows the
|
|
2
|
+
// answer. The model half gives a line's words and its reading aloud, and the build and the browser both use it, so a
|
|
3
|
+
// text and its live value agree. writtenLine draws a line in a family's figure.
|
|
4
|
+
import { svg as el } from './dom.js';
|
|
5
|
+
|
|
6
|
+
export const PLUS = '+', MINUS = '−';
|
|
7
|
+
// A line is { a, sign, b }, the number before the sign, the sign and the number after it. A line with open: true
|
|
8
|
+
// leaves out its answer.
|
|
9
|
+
export const answerOf = line => line.sign === PLUS ? line.a + line.b : line.a - line.b;
|
|
10
|
+
|
|
11
|
+
// parts gives the pieces of a line in order. A number carries its role: a and b for the numbers either side of the
|
|
12
|
+
// sign, and c for the answer.
|
|
13
|
+
export function parts(line) {
|
|
14
|
+
const out = [{ role: 'a', n: line.a }, { sign: line.sign }, { role: 'b', n: line.b }];
|
|
15
|
+
if (!line.open) out.push({ sign: '=' }, { role: 'c', n: answerOf(line) });
|
|
16
|
+
return out;
|
|
17
|
+
}
|
|
18
|
+
// words writes a line, such as "5 + 3 = 8". int writes a number in the page's language.
|
|
19
|
+
export const words = (line, int) => parts(line).map(p => p.sign ?? int(p.n)).join(' ');
|
|
20
|
+
// The kit's string of the line in words. The four strings take the numbers as {a}, {b} and {c}.
|
|
21
|
+
export const readingKey = line => `written-${line.sign === PLUS ? 'plus' : 'minus'}${line.open ? '-open' : ''}`;
|
|
22
|
+
// reading says a line in words, such as "5 plus 3 is equal to 8". T reads the kit's strings without their prefix
|
|
23
|
+
// hesap_, as a family's T does in the browser.
|
|
24
|
+
export const reading = (line, int, T) => T(readingKey(line), { a: int(line.a), b: int(line.b), c: int(answerOf(line)) });
|
|
25
|
+
|
|
26
|
+
// The size of a written line in a figure's units, the size of the numbers of the line of two numbers in counters/match.
|
|
27
|
+
export const SIZE = 34;
|
|
28
|
+
// The size of a step line.
|
|
29
|
+
export const STEP_SIZE = 26;
|
|
30
|
+
// widthOf gives the room a line of these words takes, a little wider than its digits and signs.
|
|
31
|
+
export const widthOf = text => text.length * SIZE * 0.6;
|
|
32
|
+
|
|
33
|
+
// A link of a line that does not show reads this, such as a step of making ten while the figure does not show it.
|
|
34
|
+
export const DASH = '–';
|
|
35
|
+
|
|
36
|
+
// writtenLine makes a line with its middle at 0, 0. refs gives the link id of each role, and cls the class that
|
|
37
|
+
// colours a number in its group's colour, such as { a: 'counters-a', b: 'counters-b' }. A role without a class is
|
|
38
|
+
// written in ink, as the signs are. A line whose roles change with the figure carries its own refs and cls. A step
|
|
39
|
+
// line, such as a step of making ten under the line of the calculation, is written smaller.
|
|
40
|
+
export function writtenLine({ refs = {}, cls = {}, step = false } = {}) {
|
|
41
|
+
const text = el('text', { class: `hesap-written${step ? ' hesap-written-step' : ''}`, display: 'none' });
|
|
42
|
+
let said = null, drawn = null, lit = new Set();
|
|
43
|
+
const paint = () => { for (const t of text.querySelectorAll('[data-ref]')) t.classList.toggle('hesap-written-hot', lit.has(t.dataset.ref)); };
|
|
44
|
+
return {
|
|
45
|
+
el: text,
|
|
46
|
+
// set writes the line and says whether it changed words it showed already, for a flash. A line of null takes the
|
|
47
|
+
// line off the figure.
|
|
48
|
+
set(line, int) {
|
|
49
|
+
text.setAttribute('display', line ? 'inline' : 'none');
|
|
50
|
+
const r = line?.refs ?? refs, c = line?.cls ?? cls, now = line ? words(line, int) : null, key = line ? JSON.stringify([now, r, c]) : null;
|
|
51
|
+
if (key === drawn) return false;
|
|
52
|
+
const first = said === null, changed = now !== said;
|
|
53
|
+
said = now; drawn = key;
|
|
54
|
+
text.replaceChildren(...(line ? parts(line).flatMap((p, i) => {
|
|
55
|
+
const gap = i ? ' ' : '';
|
|
56
|
+
if (p.sign) return [`${gap}${p.sign}`];
|
|
57
|
+
const span = el('tspan', { class: ['hesap-written-num', c[p.role]].filter(Boolean).join(' '), 'data-ref': r[p.role] });
|
|
58
|
+
span.textContent = int(p.n);
|
|
59
|
+
return [gap, span];
|
|
60
|
+
}) : []));
|
|
61
|
+
paint();
|
|
62
|
+
return !first && !!line && changed;
|
|
63
|
+
},
|
|
64
|
+
words: () => said,
|
|
65
|
+
at(x, y) { text.setAttribute('x', x); text.setAttribute('y', y); },
|
|
66
|
+
// light marks the numbers a link points to, together with the family's part of the figure. whole names the
|
|
67
|
+
// links that mark the whole line, such as written and reading.
|
|
68
|
+
light(id, on, whole = []) { if (on) lit.add(id); else lit.delete(id); paint(); text.classList.toggle('hesap-written-hot', whole.some(w => lit.has(w))); },
|
|
69
|
+
};
|
|
70
|
+
}
|
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(', ');
|
|
@@ -41,10 +44,19 @@ export function drawn(goal, c, spec, { at, ctx, starts }) {
|
|
|
41
44
|
export function hidden(readout, hides, at, ctx) {
|
|
42
45
|
for (const id of readout) if (hides.includes(id)) ctx.fail(at, `readout names "${id}", which gives the challenge's answer away, leave it out`);
|
|
43
46
|
}
|
|
44
|
-
// value reads a field that is a number, a slider or a
|
|
47
|
+
// value reads a field that is a number, a slider, a stepper or a segment as its starting value and its control. A
|
|
48
|
+
// segment's control holds its items, and a slider's or a stepper's its range.
|
|
45
49
|
export function value(v) {
|
|
46
50
|
if (v == null) return { n: null, ctl: null };
|
|
47
51
|
if (typeof v === 'number') return { n: v, ctl: null };
|
|
52
|
+
if (v.segment) return { n: v.start ?? v.segment[0], ctl: { kind: 'segment', items: v.segment } };
|
|
48
53
|
const kind = v.slider ? 'slider' : 'stepper', [lo, hi] = v[kind];
|
|
49
54
|
return { n: v.start ?? lo, ctl: { kind, lo, hi } };
|
|
50
55
|
}
|
|
56
|
+
// string reads one of hesap's strings in a language, for a link that shows a word. A language hesap has no strings
|
|
57
|
+
// for reads the English ones. vars fill the string's {name} places.
|
|
58
|
+
const I18N = fileURLToPath(new URL('./i18n/', import.meta.url)), STRINGS = new Map();
|
|
59
|
+
export function string(lang, key, vars) {
|
|
60
|
+
if (!STRINGS.has(lang)) { const cats = loadCatalogues(I18N, [lang, 'en']); STRINGS.set(lang, cats[lang] ?? cats.en); }
|
|
61
|
+
return fill(STRINGS.get(lang)[key], vars);
|
|
62
|
+
}
|