mesdan 1.1.2 → 1.1.6

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 (100) hide show
  1. package/README.md +100 -22
  2. package/package.json +10 -5
  3. package/{teshir → sevk}/aletler/harf-buyuk-mu.d.ts +0 -1
  4. package/{teshir → sevk}/aletler/harf-kelime-basinda-mi.d.ts +0 -1
  5. package/{teshir → sevk}/aletler/harf-kucuk-mu.d.ts +0 -1
  6. package/{teshir/aletler/harf-tedkiki.d.ts → sevk/aletler/harf-tedkiki-dizi.d.ts} +1 -2
  7. package/sevk/aletler/harf-tedkiki-dizi.js +69 -0
  8. package/sevk/aletler/harf-tedkiki-kume.d.ts +6 -0
  9. package/sevk/aletler/harf-tedkiki-kume.js +104 -0
  10. package/{teshir → sevk}/aletler/tebdil-alem-mevkisini.d.ts +0 -1
  11. package/sevk/ihrac/ek--osmani-mesdan.d.ts +1 -0
  12. package/sevk/ihrac/ek--osmani-mesdan.js +91 -0
  13. package/sevk/ihrac/ek--sagdan-sola.d.ts +1 -0
  14. package/sevk/ihrac/ek--sagdan-sola.js +13 -0
  15. package/sevk/ihrac/metinger--lexical.d.ts +1 -0
  16. package/sevk/ihrac/metinger--lexical.js +41 -0
  17. package/{teshir/kanca → sevk/ihrac}/use-mesdan.d.ts +0 -1
  18. package/{teshir/kanca → sevk/ihrac}/use-mesdan.js +4 -4
  19. package/sevk/index.d.ts +2 -0
  20. package/sevk/index.js +2 -0
  21. package/{teshir/nev → sevk/nevi}/alem-mevkisi.d.ts +0 -1
  22. package/{teshir/nev → sevk/nevi}/kelam-unsuru.d.ts +0 -1
  23. package/{teshir/nev → sevk/nevi}/mes-hadisesi.d.ts +0 -1
  24. package/{teshir/nev → sevk/nevi}/netice-metni-tadil-et.d.ts +0 -1
  25. package/{teshir/nev → sevk/nevi}/netice-osmani-harf-tadili.d.ts +0 -1
  26. package/sevk/nevi/ortak.d.ts +1 -0
  27. package/sevk/nevi/ortak.js +1 -0
  28. package/{teshir/nev → sevk/nevi}/tadili-metin-emri.d.ts +0 -1
  29. package/sevk/nuve/kanca/ekle-osmani-metne-harf.d.ts +4 -0
  30. package/sevk/nuve/kanca/ekle-osmani-metne-harf.js +111 -0
  31. package/sevk/nuve/kanca/harf-latiniden-osmaniye-eski.d.ts +1 -0
  32. package/sevk/nuve/kanca/harf-latiniden-osmaniye-eski.js +360 -0
  33. package/{teshir/nuve → sevk/nuve/kanca}/kaydir-alemi.d.ts +1 -2
  34. package/{teshir/nuve → sevk/nuve/kanca}/kaydir-alemi.js +1 -1
  35. package/sevk/nuve/kanca/sil-osmani-metinden-harf-basra.d.ts +3 -0
  36. package/sevk/nuve/kanca/sil-osmani-metinden-harf-basra.js +45 -0
  37. package/sevk/nuve/kanca/sil-osmani-metinden-harf-sonra.d.ts +3 -0
  38. package/{teshir/nuve → sevk/nuve/kanca}/sil-osmani-metinden-harf-sonra.js +7 -7
  39. package/sevk/nuve/kanca/tadil-et-metni.d.ts +5 -0
  40. package/{teshir/nuve → sevk/nuve/kanca}/tadil-et-metni.js +2 -2
  41. package/{teshir/nuve → sevk/nuve/kanca}/tensih-zihinden.d.ts +0 -1
  42. package/{teshir/nuve → sevk/nuve/kanca}/tensih-zihne.d.ts +0 -1
  43. package/{teshir/nuve → sevk/nuve/lexical}/harf-latiniden-osmaniye.d.ts +0 -1
  44. package/sevk/nuve/lexical/harf-latiniden-osmaniye.js +37 -0
  45. package/sevk/nuve/lexical/harf-tebdilleri.d.ts +14 -0
  46. package/sevk/nuve/lexical/harf-tebdilleri.js +169 -0
  47. package/sevk/nuve/lexical/sil-harf-metingerde.d.ts +3 -0
  48. package/sevk/nuve/lexical/sil-harf-metingerde.js +56 -0
  49. package/sevk/nuve/lexical/silinecek-osmani-harf-adedi.d.ts +3 -0
  50. package/sevk/nuve/lexical/silinecek-osmani-harf-adedi.js +80 -0
  51. package/sevk/nuve/lexical/tebdil-metni-osmaniye.d.ts +10 -0
  52. package/sevk/nuve/lexical/tebdil-metni-osmaniye.js +17 -0
  53. package/sevk/nuve/sabit.d.ts +1 -0
  54. package/sevk/nuve/sabit.js +1 -0
  55. package/teshir/aletler/harf-buyuk-mu.d.ts.map +0 -1
  56. package/teshir/aletler/harf-kelime-basinda-mi.d.ts.map +0 -1
  57. package/teshir/aletler/harf-kucuk-mu.d.ts.map +0 -1
  58. package/teshir/aletler/harf-tedkiki.d.ts.map +0 -1
  59. package/teshir/aletler/harf-tedkiki.js +0 -69
  60. package/teshir/aletler/tebdil-alem-mevkisini.d.ts.map +0 -1
  61. package/teshir/index.d.ts +0 -2
  62. package/teshir/index.d.ts.map +0 -1
  63. package/teshir/index.js +0 -1
  64. package/teshir/kanca/use-mesdan.d.ts.map +0 -1
  65. package/teshir/nev/alem-mevkisi.d.ts.map +0 -1
  66. package/teshir/nev/kelam-unsuru.d.ts.map +0 -1
  67. package/teshir/nev/mes-hadisesi.d.ts.map +0 -1
  68. package/teshir/nev/netice-metni-tadil-et.d.ts.map +0 -1
  69. package/teshir/nev/netice-osmani-harf-tadili.d.ts.map +0 -1
  70. package/teshir/nev/tadili-metin-emri.d.ts.map +0 -1
  71. package/teshir/nuve/ekle-osmani-metne-harf.d.ts +0 -5
  72. package/teshir/nuve/ekle-osmani-metne-harf.d.ts.map +0 -1
  73. package/teshir/nuve/ekle-osmani-metne-harf.js +0 -111
  74. package/teshir/nuve/harf-latiniden-osmaniye.d.ts.map +0 -1
  75. package/teshir/nuve/harf-latiniden-osmaniye.js +0 -358
  76. package/teshir/nuve/kaydir-alemi.d.ts.map +0 -1
  77. package/teshir/nuve/sil-osmani-metinden-harf-basra.d.ts +0 -4
  78. package/teshir/nuve/sil-osmani-metinden-harf-basra.d.ts.map +0 -1
  79. package/teshir/nuve/sil-osmani-metinden-harf-basra.js +0 -45
  80. package/teshir/nuve/sil-osmani-metinden-harf-sonra.d.ts +0 -4
  81. package/teshir/nuve/sil-osmani-metinden-harf-sonra.d.ts.map +0 -1
  82. package/teshir/nuve/tadil-et-metni.d.ts +0 -6
  83. package/teshir/nuve/tadil-et-metni.d.ts.map +0 -1
  84. package/teshir/nuve/tensih-zihinden.d.ts.map +0 -1
  85. package/teshir/nuve/tensih-zihne.d.ts.map +0 -1
  86. package/teshir/tedkik/harf-latiniden-osmaniye.tedkik.d.ts +0 -2
  87. package/teshir/tedkik/harf-latiniden-osmaniye.tedkik.d.ts.map +0 -1
  88. package/teshir/tedkik/harf-latiniden-osmaniye.tedkik.js +0 -137
  89. /package/{teshir → sevk}/aletler/harf-buyuk-mu.js +0 -0
  90. /package/{teshir → sevk}/aletler/harf-kelime-basinda-mi.js +0 -0
  91. /package/{teshir → sevk}/aletler/harf-kucuk-mu.js +0 -0
  92. /package/{teshir → sevk}/aletler/tebdil-alem-mevkisini.js +0 -0
  93. /package/{teshir/nev → sevk/nevi}/alem-mevkisi.js +0 -0
  94. /package/{teshir/nev → sevk/nevi}/kelam-unsuru.js +0 -0
  95. /package/{teshir/nev → sevk/nevi}/mes-hadisesi.js +0 -0
  96. /package/{teshir/nev → sevk/nevi}/netice-metni-tadil-et.js +0 -0
  97. /package/{teshir/nev → sevk/nevi}/netice-osmani-harf-tadili.js +0 -0
  98. /package/{teshir/nev → sevk/nevi}/tadili-metin-emri.js +0 -0
  99. /package/{teshir/nuve → sevk/nuve/kanca}/tensih-zihinden.js +0 -0
  100. /package/{teshir/nuve → sevk/nuve/kanca}/tensih-zihne.js +0 -0
package/README.md CHANGED
@@ -45,7 +45,7 @@ import React from 'react';
45
45
  import { useMesdan } from 'mesdan';
46
46
 
47
47
  const TemelMesdan = () => {
48
- const [metin, metinSahasıİması] = useMesdan<HTMLInputElement>({
48
+ const { metin, metinSahasıİması } = useMesdan<HTMLInputElement>({
49
49
  ibtidaiMetin: '',
50
50
  tekSatırMı: true, // `true` ise <input>, `false` ise <textarea>
51
51
  });
@@ -80,27 +80,31 @@ export default TemelMesdan;
80
80
 
81
81
  ## Kancanın Vâsılatı (Return Values)
82
82
 
83
- Kanca, dört unsurdan müteşekkil bir dizi (array) döndürür:
83
+ Kanca, dört unsurdan müteşekkil bir dizi (array) vâsıl eder:
84
84
 
85
85
  ```ts
86
- type MesdanVasılatı<T> = [
87
- metin: string,
88
- metinSahasıİması: RefObject<T | null>,
89
- tebdilMetin: (yeniMetin: string) => void,
90
- tebdilLatiniMi: (latiniMi: boolean) => void,
91
- ];
86
+ type MesdanCevabı<T> = {
87
+ metinSahasıİması: RefObject<T | null>;
88
+ metin: string;
89
+ tebdilMetin: (yeniMetin: string) => void;
90
+ latiniMi: boolean;
91
+ tebdilLatiniMi: (latiniMi: boolean) => void;
92
+ };
92
93
  ```
93
94
 
94
- 1. **`metin`** (`string`):
95
- Metin sahasının cârî değeri.
96
-
97
- 2. **`metinSahasıİması`** (`RefObject`):
95
+ 1. **`metinSahasıİması`** (`RefObject`):
98
96
  `input` veya `textarea` unsuruna banılacak olan `ref`. (ba-mak => bağlamak, rapt etmek)
99
97
 
98
+ 2. **`metin`** (`string`):
99
+ Metin sahasının cârî değeri.
100
+
100
101
  3. **`tebdilMetin`** (`(yeniMetin: string) => void`):
101
102
  Metni haricen (programmatically) değiştirir.
102
103
 
103
- 4. **`tebdilLatiniMi`** (`(latiniMi: boolean) => void`):
104
+ 4. **`latiniMi`** (`boolean`):
105
+ Kancanın o anki yazım haletini gösterir (false Elifba, true Alfabe).
106
+
107
+ 5. **`tebdilLatiniMi`** (`(latiniMi: boolean) => void`):
104
108
  Haleti Elifba ile Alfabe değiştirmek için kullanılır.
105
109
 
106
110
  ## İleri Seviye Kullanım Misâlleri (Advanced Usage Examples)
@@ -113,7 +117,7 @@ type MesdanVasılatı<T> = [
113
117
  import { useMesdan } from 'mesdan';
114
118
 
115
119
  const AdidSatırlıMesdan = () => {
116
- const [metin, metinSahasıİması] = useMesdan<HTMLTextAreaElement>({
120
+ const { metin, metinSahasıİması } = useMesdan<HTMLTextAreaElement>({
117
121
  ibtidaiMetin: '',
118
122
  tekSatırMı: false,
119
123
  });
@@ -133,7 +137,7 @@ import { useMesdan } from 'mesdan';
133
137
  const HariçtenİdareliMesdan = () => {
134
138
  const [hariciMetin, tayinHariciMetin] = useState('');
135
139
 
136
- const [, metinSahasıİması] = useMesdan<HTMLInputElement>({
140
+ const { metinSahasıİması } = useMesdan<HTMLInputElement>({
137
141
  tekSatırMı: true,
138
142
 
139
143
  metin: hariciMetin,
@@ -159,18 +163,14 @@ import { useState } from 'react';
159
163
  import { useMesdan } from 'mesdan';
160
164
 
161
165
  const LisanZirliMesdan = () => {
162
- const [latiniMi, tayinLatiniMi] = useState(false);
163
-
164
- const [metin, metinSahasıİması, , tebdilLatiniMi] = useMesdan<HTMLInputElement>({
166
+ const { metin, metinSahasıİması, latiniMi, tebdilLatiniMi } = useMesdan<HTMLInputElement>({
165
167
  ibtidaiMetin: '',
166
168
  tekSatırMı: true,
167
169
  latiniMi: latiniMi,
168
170
  });
169
171
 
170
172
  const ifaZir = () => {
171
- const yeniHalet = !latiniMi;
172
- tayinLatiniMi(yeniHalet);
173
- tebdilLatiniMi(yeniHalet);
173
+ tebdilLatiniMi(!latiniMi);
174
174
  };
175
175
 
176
176
  return (
@@ -196,7 +196,7 @@ const LisanZirliMesdan = () => {
196
196
  import { useMesdan } from 'mesdan';
197
197
 
198
198
  const HariçtenMetinTebdilliMesdan = () => {
199
- const [metin, metinSahasıİması, tebdilMetin] = useMesdan<HTMLTextAreaElement>({
199
+ const { metin, metinSahasıİması, tebdilMetin } = useMesdan<HTMLTextAreaElement>({
200
200
  tekSatırMı: false,
201
201
  });
202
202
 
@@ -209,6 +209,84 @@ const HariçtenMetinTebdilliMesdan = () => {
209
209
  };
210
210
  ```
211
211
 
212
+ ## Lexical İlâvesi: OsmaniMesdanEki
213
+
214
+ `mesdan` menbaı, [Lexical](https://lexical.dev/) zengin metingeri (rich text editor) ile Osmanî Türkçe yazmayı kolaylaştıran bir ilâve (plugin) de sunmaktadır. `OsmaniMesdanEki`, metingerin içine yerleştirildiğinde Latin hurufatlı mesdanlardan Osmanî Türkçe yazma imkânı sağlar.
215
+
216
+ Bu ilâveyi kullanmak için azîmenizde Lexical'in kurulu olması gerekir.
217
+
218
+ ### Lexical ile Kullanım
219
+
220
+ `OsmaniMesdanEki` ilâvesi bir unsur (component) olup, `LexicalComposer` unsurunun içine yerleştirilmelidir. Herhangi bir görünür unsur oluşturmaz; bunun yerine metingerin hâline erişerek mesdan vaqalarını takip ve idâre eder.
221
+
222
+ Aşağıda Lexical metingerinin temel bir misâli verilmiştir:
223
+
224
+ ```tsx
225
+ import { LexicalComposer } from '@lexical/react/LexicalComposer';
226
+ import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin';
227
+ import { ContentEditable } from '@lexical/react/LexicalContentEditable';
228
+ import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin';
229
+ import LexicalErrorBoundary from '@lexical/react/LexicalErrorBoundary';
230
+
231
+ import { OsmaniMesdanEki } from 'mesdan';
232
+
233
+ const tarz = {};
234
+
235
+ const iptidaiAyarlar = {
236
+ namespace: 'OsmaniEditor',
237
+ theme: tarz,
238
+ onError: (hata: Error) => console.error(hata),
239
+ };
240
+
241
+ const LexicalMetigeri = () => {
242
+ return (
243
+ <LexicalComposer initialConfig={ibdaiAyarlar}>
244
+ <div className="editor-container" style={{ position: 'relative' }}>
245
+ <RichTextPlugin
246
+ contentEditable={
247
+ <ContentEditable
248
+ dir="rtl"
249
+ style={{
250
+ border: '1px solid #ccc',
251
+ minHeight: '150px',
252
+ padding: '10px',
253
+ direction: 'rtl',
254
+ textAlign: 'right',
255
+ }}
256
+ />
257
+ }
258
+ placeholder={
259
+ <div
260
+ style={{
261
+ position: 'absolute',
262
+ top: '10px',
263
+ right: '10px',
264
+ color: '#aaa',
265
+ pointerEvents: 'none',
266
+ }}
267
+ >
268
+ الفبا ايله‌ ياز...
269
+ </div>
270
+ }
271
+ ErrorBoundary={LexicalErrorBoundary}
272
+ />
273
+
274
+ <HistoryPlugin />
275
+ <OsmaniMesdanEki />
276
+ </div>
277
+ </LexicalComposer>
278
+ );
279
+ };
280
+
281
+ export default LexicalMetigeri;
282
+ ```
283
+
284
+ #### Îzah (Explanation)
285
+
286
+ 1. **`LexicalComposer`**: Bütün Lexical metingeri bu unsur ile sarmalanmalıdır.
287
+ 2. **`ContentEditable`**: Kullanıcının metin girdiği asıl sahadır. Osmanî metin için `dir="rtl"` ve alâkalı CSS hassalarını (`direction`, `textAlign`) eklemek, doğru bir yazım tecrübesi için elzemdir.
288
+ 3. **`OsmaniMesdanEki`**: Bu ilâveyi `LexicalComposer`'ın herhangi bir yerine yerleştirmeniz kâfidir.
289
+
212
290
  ## Anahtar Kelimeler (Keywords)
213
291
 
214
292
  osmanlıca, türkçe, türki, osmani, turkish, elifba, keyboard, tercüme, ottoman, latini, react, hook
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mesdan",
3
- "version": "1.1.2",
3
+ "version": "1.1.6",
4
4
  "description": "Latinî mesdan ile Osmanî metin yazmak için hazırlanmış bir alettir.",
5
5
  "keywords": [
6
6
  "osmanlıca",
@@ -15,26 +15,31 @@
15
15
  "latini"
16
16
  ],
17
17
  "type": "module",
18
- "main": "teshir/index.js",
19
- "types": "teshir/index.d.ts",
18
+ "main": "sevk/index.js",
19
+ "types": "sevk/index.d.ts",
20
20
  "scripts": {
21
- "kur": "rm -rf teshir && tsc -p .",
21
+ "çat": "vite",
22
+ "kur": "rm -rf sevk && tsc -p .",
22
23
  "tecrübe": "tsx watch memba/index.ts",
23
24
  "tedkik": "jest"
24
25
  },
25
26
  "author": "KadimElifba",
26
27
  "license": "MIT",
27
28
  "devDependencies": {
29
+ "@lexical/react": "^0.38.2",
28
30
  "@types/jest": "^29.5.12",
29
31
  "@types/react": "^18.2.64 || ^19.0.8",
30
32
  "@types/react-dom": "^18.2.19 || ^19.0.3",
33
+ "@vitejs/plugin-react": "^5.1.0",
31
34
  "jest": "^29.7.0",
35
+ "lexical": "^0.38.2",
32
36
  "prettier": "^3.6.2",
33
37
  "react": "^18.2.0 || ^19.0.0",
34
38
  "react-dom": "^18.2.0 || ^19.0.0",
35
39
  "ts-jest": "^29.1.2",
36
40
  "tsx": "^4.7.1",
37
- "typescript": "^5.3.3"
41
+ "typescript": "^5.3.3",
42
+ "vite": "^7.2.2"
38
43
  },
39
44
  "peerDependencies": {
40
45
  "@types/react": ">=18.0.0 <20.0.0",
@@ -1,2 +1 @@
1
1
  export declare function harfBüyükMü(harf: string): boolean;
2
- //# sourceMappingURL=harf-buyuk-mu.d.ts.map
@@ -1,2 +1 @@
1
1
  export declare function harfKelimeBaşındaMı(sonHarf: string): boolean;
2
- //# sourceMappingURL=harf-kelime-basinda-mi.d.ts.map
@@ -1,2 +1 @@
1
1
  export declare function harfKücükMü(harf: string): boolean;
2
- //# sourceMappingURL=harf-kucuk-mu.d.ts.map
@@ -1,6 +1,5 @@
1
1
  export declare function harekeMi(harf: string): boolean;
2
2
  export declare function tenvinMi(harf: string): boolean;
3
3
  export declare function şeddeMi(harf: string): boolean;
4
- export declare function kesmeMi(harf: string): boolean;
4
+ export declare function kesekMi(harf: string): boolean;
5
5
  export declare function gayriİşaretlerdenMi(harf: string): boolean;
6
- //# sourceMappingURL=harf-tedkiki.d.ts.map
@@ -0,0 +1,69 @@
1
+ export function harekeMi(harf) {
2
+ if (harekeler.includes(harf)) {
3
+ return true;
4
+ }
5
+ return false;
6
+ }
7
+ export function tenvinMi(harf) {
8
+ if (tenvinler.includes(harf)) {
9
+ return true;
10
+ }
11
+ return false;
12
+ }
13
+ export function şeddeMi(harf) {
14
+ if (şeddeler.includes(harf)) {
15
+ return true;
16
+ }
17
+ return false;
18
+ }
19
+ export function kesekMi(harf) {
20
+ if (harf.endsWith('\u200C')) {
21
+ return true;
22
+ }
23
+ return false;
24
+ }
25
+ export function gayriİşaretlerdenMi(harf) {
26
+ if (gayriİşaretler.includes(harf)) {
27
+ return true;
28
+ }
29
+ return false;
30
+ }
31
+ const şeddeler = [
32
+ '\u064E' + '\u0651', // Fetha + Şedde
33
+ '\u0650' + '\u0651', // Kesra + Şedde
34
+ '\u064F' + '\u0651', // Damme + Şedde
35
+ ];
36
+ const harekeler = [
37
+ '\u064E', // Fetha
38
+ '\u0650', // Kesra
39
+ '\u064F', // Damme
40
+ '\u0652', // Sukun
41
+ '\u0651', // Şedde Yalnız
42
+ ];
43
+ const tenvinler = [
44
+ '\u064B', // Fetha Tenvin
45
+ '\u064D', // Kesra Tenvin
46
+ '\u064C', // Damme Tenvin
47
+ ];
48
+ const gayriİşaretler = [
49
+ '\u0653', // Med
50
+ '\u0670', // Elif Üst
51
+ '\u0656', // Elif Alt
52
+ '\u0654', // Hemze Üst
53
+ '\u0655', // Hemze Alt
54
+ ];
55
+ const işaretler = [
56
+ '\u0653', // Med
57
+ '\u064E', // Fetha
58
+ '\u0650', // Kesra
59
+ '\u064F', // Damme
60
+ '\u0652', // Sukun
61
+ '\u0651', // Şedde
62
+ '\u064D', // Kesra Tenvin
63
+ '\u064B', // Fetha Tenvin
64
+ '\u064C', // Damme Tenvin
65
+ '\u0670', // Elif Üst
66
+ '\u0656', // Elif Alt
67
+ '\u0654', // Hemze Üst
68
+ '\u0655', // Hemze Alt
69
+ ];
@@ -0,0 +1,6 @@
1
+ export declare function harekeMi(harf: string): boolean;
2
+ export declare function tenvinMi(harf: string): boolean;
3
+ export declare function şeddeMi(harf: string): boolean;
4
+ export declare function kesekMi(harf: string): boolean;
5
+ export declare function gayriİşaretlerdenMi(harf: string): boolean;
6
+ export declare function tağyirMesiMi(metin: string): boolean;
@@ -0,0 +1,104 @@
1
+ const şeddeler = new Set([
2
+ '\u064E' + '\u0651', // Fetha + Şedde
3
+ '\u0650' + '\u0651', // Kesra + Şedde
4
+ '\u064F' + '\u0651', // Damme + Şedde
5
+ '\u0651' + '\u064E', // Şedde + Fetha
6
+ '\u0651' + '\u0650', // Şedde + Kesra
7
+ '\u0651' + '\u064F', // Şedde + Damme
8
+ ]);
9
+ const harekeler = new Set([
10
+ '\u064E', // Fetha
11
+ '\u0650', // Kesra
12
+ '\u064F', // Damme
13
+ '\u0652', // Sukun
14
+ '\u0651', // Şedde Yalnız
15
+ ]);
16
+ const tenvinler = new Set([
17
+ '\u064B', // Fetha Tenvin
18
+ '\u064D', // Kesra Tenvin
19
+ '\u064C', // Damme Tenvin
20
+ ]);
21
+ const gayriİşaretler = new Set([
22
+ '\u0653', // Med
23
+ '\u0670', // Elif Üst
24
+ '\u0656', // Elif Alt
25
+ '\u0654', // Hemze Üst
26
+ '\u0655', // Hemze Alt
27
+ ]);
28
+ // This can remain an array as it's not used in a performance-critical lookup function.
29
+ const işaretler = [
30
+ '\u0653', // Med
31
+ '\u064E', // Fetha
32
+ '\u0650', // Kesra
33
+ '\u064F', // Damme
34
+ '\u0652', // Sukun
35
+ '\u0651', // Şedde
36
+ '\u064D', // Kesra Tenvin
37
+ '\u064B', // Fetha Tenvin
38
+ '\u064C', // Damme Tenvin
39
+ '\u0670', // Elif Üst
40
+ '\u0656', // Elif Alt
41
+ '\u0654', // Hemze Üst
42
+ '\u0655', // Hemze Alt
43
+ ];
44
+ export function harekeMi(harf) {
45
+ return harekeler.has(harf);
46
+ }
47
+ export function tenvinMi(harf) {
48
+ return tenvinler.has(harf);
49
+ }
50
+ export function şeddeMi(harf) {
51
+ return şeddeler.has(harf);
52
+ }
53
+ export function kesekMi(harf) {
54
+ return harf.endsWith('\u200C');
55
+ }
56
+ export function gayriİşaretlerdenMi(harf) {
57
+ return gayriİşaretler.has(harf);
58
+ }
59
+ // CapsLock, Alt, Shift, Ctrl, NumLock, Backspace, Tab
60
+ // ArrowDown, ArrowUp, ArrowRight, ArrowLeft
61
+ // Enter, Delete, Home, PageUp, PageDown, End, Pause, Escape, AltGraph, Dead
62
+ // F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12
63
+ const tağyirMesleri = new Set([
64
+ // Modifier keys
65
+ 'capslock',
66
+ 'alt',
67
+ 'shift',
68
+ 'ctrl',
69
+ 'numlock',
70
+ 'altgraph',
71
+ // Navigation keys
72
+ 'backspace',
73
+ 'tab',
74
+ 'enter',
75
+ 'delete',
76
+ 'home',
77
+ 'end',
78
+ 'pageup',
79
+ 'pagedown',
80
+ 'pause',
81
+ 'escape',
82
+ 'dead',
83
+ // Arrow keys
84
+ 'arrowup',
85
+ 'arrowdown',
86
+ 'arrowleft',
87
+ 'arrowright',
88
+ // Function keys
89
+ 'f1',
90
+ 'f2',
91
+ 'f3',
92
+ 'f4',
93
+ 'f5',
94
+ 'f6',
95
+ 'f7',
96
+ 'f8',
97
+ 'f9',
98
+ 'f10',
99
+ 'f11',
100
+ 'f12',
101
+ ]);
102
+ export function tağyirMesiMi(metin) {
103
+ return tağyirMesleri.has(metin.toLowerCase());
104
+ }
@@ -1,3 +1,2 @@
1
1
  export declare function tebdilAlemMevkisini(metinSahası: HTMLTextAreaElement | HTMLInputElement, mevki: number, celbiNazar?: boolean): void;
2
2
  export declare function tebdilAlemMevkisiniMenzilIle(metinSahası: HTMLTextAreaElement | HTMLInputElement, başMevki: number, sonMevki: number, celbiNazar?: boolean): void;
3
- //# sourceMappingURL=tebdil-alem-mevkisini.d.ts.map
@@ -0,0 +1 @@
1
+ export declare const OsmaniMesdanEki: () => null;
@@ -0,0 +1,91 @@
1
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
2
+ import { $getSelection, $isRangeSelection, COMMAND_PRIORITY_HIGH, KEY_DOWN_COMMAND } from 'lexical';
3
+ import { useEffect } from 'react';
4
+ import { harfLatinidenOsmaniye } from '../nuve/lexical/harf-latiniden-osmaniye';
5
+ import { silOsmaniHarfiBaşra, silOsmaniHarfiSonra } from '../nuve/lexical/sil-harf-metingerde';
6
+ import { LATIN_HURUFATI_VE_RAKAMATI_REGEX } from '../nuve/sabit';
7
+ export const OsmaniMesdanEki = () => {
8
+ const [metinger] = useLexicalComposerContext();
9
+ useEffect(() => {
10
+ const removeKeyDownListener = metinger.registerCommand(KEY_DOWN_COMMAND, vaqa => {
11
+ const { key: ca, shiftKey, altKey, metaKey, ctrlKey } = vaqa;
12
+ if (ctrlKey || metaKey)
13
+ return false; // ker ve fer çalışsın diye
14
+ // ArrowDown, ArrowUp, ArrowRight, ArrowLeft
15
+ // Enter, Delete, Home, PageUp, PageDown, End, Pause, Escape, AltGraph
16
+ // F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12
17
+ if (ca === 'Enter') {
18
+ return false;
19
+ }
20
+ if (ca === 'Backspace') {
21
+ silOsmaniHarfiBaşra(metinger, vaqa);
22
+ return true;
23
+ }
24
+ if (ca === 'Delete') {
25
+ silOsmaniHarfiSonra(metinger, vaqa);
26
+ return true;
27
+ }
28
+ if (ca === 'ArrowLeft' || ca === 'ArrowRight') {
29
+ vaqa.preventDefault();
30
+ vaqa.stopPropagation();
31
+ metinger.update(() => {
32
+ const selection = $getSelection();
33
+ if (!$isRangeSelection(selection) || !selection.isCollapsed())
34
+ return;
35
+ const backward = ca === 'ArrowRight';
36
+ const granularity = vaqa.ctrlKey ? 'word' : 'character';
37
+ selection.modify('move', backward, granularity);
38
+ });
39
+ return true;
40
+ }
41
+ if (ca === 'Home' || ca === 'End') {
42
+ vaqa.preventDefault();
43
+ vaqa.stopPropagation();
44
+ metinger.update(() => {
45
+ const selection = $getSelection();
46
+ if (!$isRangeSelection(selection) || !selection.isCollapsed())
47
+ return;
48
+ const backward = ca === 'Home'; // Home → move to start of line
49
+ selection.modify('move', backward, 'lineboundary');
50
+ });
51
+ return true;
52
+ }
53
+ // Up and Down: let browser handle them
54
+ if (ca === 'ArrowUp' || ca === 'ArrowDown') {
55
+ return false;
56
+ }
57
+ if (LATIN_HURUFATI_VE_RAKAMATI_REGEX.test(ca)) {
58
+ vaqa.preventDefault();
59
+ vaqa.stopPropagation();
60
+ metinger.update(() => {
61
+ const selection = $getSelection();
62
+ if (!$isRangeSelection(selection))
63
+ return;
64
+ const anchor = selection.anchor;
65
+ const offset = anchor.offset;
66
+ const node = anchor.getNode();
67
+ const marMetin = node.getTextContent().slice(0, offset);
68
+ const marHarf = marMetin.slice(-1);
69
+ const osmanliHarf = harfLatinidenOsmaniye(ca, marHarf, shiftKey, altKey);
70
+ selection.insertText(osmanliHarf);
71
+ });
72
+ return true;
73
+ }
74
+ return false;
75
+ }, COMMAND_PRIORITY_HIGH);
76
+ // --- Node transform: only handle pasted text ---
77
+ // const removeNodeTransform = editor.registerNodeTransform(TextNode, node => {
78
+ // const text = node.getTextContent();
79
+ // if (!LATIN_HURUFATI_VE_RAKAMATI_REGEX.test(text)) return;
80
+ // const transformed = tebdilMetniOsmaniye(text, { shiftKey: false, altKey: false });
81
+ // if (transformed !== text) {
82
+ // node.setTextContent(transformed);
83
+ // }
84
+ // });
85
+ return () => {
86
+ removeKeyDownListener();
87
+ // removeNodeTransform();
88
+ };
89
+ }, [metinger]);
90
+ return null;
91
+ };
@@ -0,0 +1 @@
1
+ export declare function SağdanSolaEki(): null;
@@ -0,0 +1,13 @@
1
+ import { useEffect } from 'react';
2
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
3
+ import { $getRoot } from 'lexical';
4
+ export function SağdanSolaEki() {
5
+ const [editor] = useLexicalComposerContext();
6
+ useEffect(() => {
7
+ editor.update(() => {
8
+ const root = $getRoot();
9
+ root.setDirection('rtl');
10
+ });
11
+ }, [editor]);
12
+ return null;
13
+ }
@@ -0,0 +1 @@
1
+ export declare const LexicalMetinger: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,41 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { LexicalComposer } from '@lexical/react/LexicalComposer';
3
+ import { ContentEditable } from '@lexical/react/LexicalContentEditable';
4
+ import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary';
5
+ import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin';
6
+ import { PlainTextPlugin } from '@lexical/react/LexicalPlainTextPlugin';
7
+ import { OsmaniMesdanEki } from './ek--osmani-mesdan';
8
+ import { SağdanSolaEki } from './ek--sagdan-sola';
9
+ const theme = {};
10
+ const initialConfig = {
11
+ namespace: 'OsmaniMesdanEki',
12
+ theme,
13
+ onError(hata) {
14
+ console.error('Lexical hatâsı:', hata);
15
+ },
16
+ };
17
+ export const LexicalMetinger = () => {
18
+ return (_jsx("div", { dir: "rtl", className: "amiri-regular", style: { textAlign: 'right' }, children: _jsx(LexicalComposer, { initialConfig: initialConfig, children: _jsxs("div", { style: {
19
+ position: 'relative',
20
+ border: '1px solid #ccc',
21
+ padding: '10px',
22
+ borderRadius: '8px',
23
+ background: '#fff',
24
+ }, children: [_jsx(PlainTextPlugin, { contentEditable: _jsx(ContentEditable, { dir: "rtl", style: {
25
+ outline: 'none',
26
+ minHeight: '150px',
27
+ textAlign: 'right',
28
+ direction: 'rtl',
29
+ unicodeBidi: 'plaintext',
30
+ fontFamily: '"Scheherazade New", "Amiri", serif',
31
+ fontSize: '20px',
32
+ lineHeight: 1.6,
33
+ } }), placeholder: _jsx("div", { style: {
34
+ position: 'absolute',
35
+ top: 10,
36
+ right: 12,
37
+ color: '#aaa',
38
+ pointerEvents: 'none',
39
+ fontFamily: '"Scheherazade New", "Amiri", serif',
40
+ }, children: "\u0627\u0644\u0641\u0628\u0627 \u0627\u064A\u0644\u0647\u200C \u064A\u0627\u0632..." }), ErrorBoundary: LexicalErrorBoundary }), _jsx(HistoryPlugin, {}), _jsx(SağdanSolaEki, {}), _jsx(OsmaniMesdanEki, {})] }) }) }));
41
+ };
@@ -16,4 +16,3 @@ type MesdanCevabı<T> = {
16
16
  };
17
17
  export declare const useMesdan: <T extends HTMLInputElement | HTMLTextAreaElement>({ ibtidaiMetin, tekSatırMı, latiniMi: ibtidaiLatiniMi, aramaTalepEdilince, metin: metinHarici, tayinMetin: tayinMetinHarici, }: MesdanHususları) => MesdanCevabı<T>;
18
18
  export {};
19
- //# sourceMappingURL=use-mesdan.d.ts.map
@@ -1,8 +1,8 @@
1
- import { useEffect, useRef, useState, useLayoutEffect, useCallback } from 'react';
1
+ import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
2
2
  import { harfBüyükMü } from '../aletler/harf-buyuk-mu';
3
- import { hazırlaAlemMevkisini, hazırlaAlemMevkisiniMenzilli } from '../nev/alem-mevkisi';
4
- import { TadiliMetinEmri } from '../nev/tadili-metin-emri';
5
- import { Talimat_MetniTadilEt } from '../nuve/tadil-et-metni';
3
+ import { hazırlaAlemMevkisini, hazırlaAlemMevkisiniMenzilli } from '../nevi/alem-mevkisi';
4
+ import { TadiliMetinEmri } from '../nevi/tadili-metin-emri';
5
+ import { Talimat_MetniTadilEt } from '../nuve/kanca/tadil-et-metni';
6
6
  export const useMesdan = ({ ibtidaiMetin = '', tekSatırMı, latiniMi: ibtidaiLatiniMi = false, aramaTalepEdilince, metin: metinHarici, tayinMetin: tayinMetinHarici, }) => {
7
7
  const [metinDahili, tayinMetinDahili] = useState(ibtidaiMetin);
8
8
  const [latiniMi, tayinLatiniMi] = useState(ibtidaiLatiniMi);
@@ -0,0 +1,2 @@
1
+ export { useMesdan } from './ihrac/use-mesdan';
2
+ export { OsmaniMesdanEki } from './ihrac/ek--osmani-mesdan';
package/sevk/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { useMesdan } from './ihrac/use-mesdan';
2
+ export { OsmaniMesdanEki } from './ihrac/ek--osmani-mesdan';
@@ -5,4 +5,3 @@ export type AlemMevkisi = {
5
5
  export declare function alAleminİlkHalini(): AlemMevkisi;
6
6
  export declare function hazırlaAlemMevkisini(mevki: number): AlemMevkisi;
7
7
  export declare function hazırlaAlemMevkisiniMenzilli(baş: number, son: number): AlemMevkisi;
8
- //# sourceMappingURL=alem-mevkisi.d.ts.map
@@ -17,4 +17,3 @@ export type KelamUnsuru = {
17
17
  hareke: Hareke;
18
18
  tenvin: Tenvin;
19
19
  };
20
- //# sourceMappingURL=kelam-unsuru.d.ts.map
@@ -4,4 +4,3 @@ export type MesHadisesi = {
4
4
  altBasılıMı: boolean;
5
5
  capsLockBasılıMı: boolean;
6
6
  };
7
- //# sourceMappingURL=mes-hadisesi.d.ts.map
@@ -4,4 +4,3 @@ export type Netice_MetniTadilEt = {
4
4
  alemMevkisiTadilSonrası: AlemMevkisi;
5
5
  sahneYenidenÇizilsinMi: boolean;
6
6
  };
7
- //# sourceMappingURL=netice-metni-tadil-et.d.ts.map
@@ -2,4 +2,3 @@ export type Netice_OsmaniHarfTadili = {
2
2
  metinOsmani: string;
3
3
  alemBaşMevkisi: number;
4
4
  };
5
- //# sourceMappingURL=netice-osmani-harf-tadili.d.ts.map
@@ -0,0 +1 @@
1
+ export type Adet = number;
@@ -0,0 +1 @@
1
+ export {};