diff --git a/content/rehber/acikogretim-mi-orgun-mu-diploma-farki.md b/content/rehber/acikogretim-mi-orgun-mu-diploma-farki.md new file mode 100644 index 0000000..1e639c2 --- /dev/null +++ b/content/rehber/acikogretim-mi-orgun-mu-diploma-farki.md @@ -0,0 +1,136 @@ +--- +baslik: Açıköğretim mi, Örgün mü? Diploma, KYK, Askerlik ve Geçiş Bakımından Fark Nedir? +aciklama: Açıköğretim ile örgün arasındaki farkı resmî metinlerle anlattık: YKS ile ve sınavsız (ikinci üniversite) giriş yolları, 2026-2027 bahar kayıt tarihleri, KYK burs/kredi, askerlik tecili, yatay geçiş, DGS ve örgün programa kayıtlıyken açıköğretime yazılma. +tarih: 2026-11-25 +niyet: 1 +konu: sonrasi +cta_baslik: Açıköğretime karar vermeden önce sıralamanla örgün seçenekleri gör +cta_aciklama: YKS başarı sıralamanla hangi örgün programların hayal, dengeli ve güvenli diliminde olduğunu görebilirsin; sonra açıköğretimi ikinci seçenek olarak tartarsın. Ücretsiz, üyelik gerekmez. +--- + +**Kısa cevap:** Açıköğretim, derslerin büyük ölçüde uzaktan işlendiği, sınavların belirli merkezlerde yapıldığı ve kaydın her dönem yenilendiği bir öğrenim biçimidir; örgün ise yüz yüze eğitimdir. Bu yazıdaki en önemli üç fark resmî metinlerde yazıyor: **KYK burs ve kredisi yalnızca örgün öğretim öğrencilerine verilir**, açık ve uzaktan öğretimde verilmez; Anadolu Üniversitesi açıköğretime **YKS ile yeni kayıt** alır, ayrıca **sınavsız "ikinci üniversite"** kaydı vardır ve bu kayıtla askerlik tecili işlemi yapılmaz; örgün bir programa geçmek isteyen açık/uzaktan öğrencisi için yatay geçişte not ortalaması eşiği 100 üzerinden **90**'dır. "Açıköğretim diploması örgünle aynı mıdır?" sorusuna ise **resmî metinlerde doğrudan bir cevap bulamadık**, bu yüzden "aynıdır" ya da "farklıdır" yazmıyoruz; işe alım ve ilan şartlarında kararı ilanın kendi metni verir. 25 Kasım 2026 itibarıyla Anadolu'nun 2026-2027 bahar dönemi için **yeni kayıt ve ikinci üniversite tarihi açıklanmadı**; yalnızca kayıt yenileme (8-22 Şubat 2027) ve öğrenci affı kaydı (25 Ocak-5 Şubat 2027) tarihleri var. + +Bu yazı Anadolu Üniversitesi Açıköğretim Fakültesi'nin 2026-2027 resmî belgelerine (yönetmelik, öğrenci kılavuzu, takvim) dayanıyor. İstanbul ve Atatürk üniversitelerinin açıköğretim sayfalarını açmadık; onların kuralları farklı olabilir, ilgili bölümlerde ayrıca belirttik. + +```mermaid +%% aria: Açıköğretim mi, örgün mü karar şeması. İlk soru, örgün bir programda okumak isteyip istemediğindir. Evet ise ikinci soru, YKS başarı sıralamanın örgün programlara yetip yetmediğidir. Yetiyorsa yol örgün tercih listesidir. Yetmiyorsa yeniden YKS'ye girip girmeyeceğine bakılır; girebiliyorsan yol yeniden YKS'dir, giremiyorsan aşağıdaki esneklik sorusuna geçilir. Örgün istemiyorsan ya da girememişsen sorulacak şey, KYK burs veya kredi, yurt ve askerlik tecilinin senin için gerekli olup olmadığıdır. Gerekliyse açık ve uzaktan öğretimde KYK burs ve kredi verilmediği için örgün yolu yeniden düşünmen gerekir. Gerekli değilse ve çalışıyorsan ya da esneklik arıyorsan son soru, daha önce kayıtlı olduğun ya da mezun olduğun bir program olup olmadığıdır. Yoksa yol YKS ile açıköğretime yeni kayıttır. Varsa yol sınavsız ikinci üniversitedir; bu yolda ikinci programın katkı payını sen ödersin, askerlik tecili işlemi yapılmaz ve program, okuduğun ya da mezun olduğun alandan farklı olmalıdır. Şemadaki renkler tek başına anlam taşımaz; her kutunun başında büyük harfli bir etiket vardır. +%% altyazi: Açıköğretim bir kapı olarak kalır; önce sıralamanla örgün seçenekleri gör, sonra KYK, yurt ve tecil ihtiyacına göre karar ver. +flowchart TD + A("Tercih sonucu çıktı
ya da çıkmadı") --> B{"Örgün programda
okumak istiyor musun?"} + B -- "evet" --> C{"Sıralaman örgün
programlara yetiyor mu?"} + C -- "evet" --> D("ÖRGÜN
tercih listeni sıralamana göre kur") + C -- "hayır" --> E{"Yeniden YKS'ye
girebilir misin?"} + E -- "evet" --> F("YENİDEN YKS
ÖSYM takvimiyle, bir yıl sonra") + E -- "hayır" --> G + B -- "hayır ya da girmedim" --> G{"KYK burs/kredi, yurt ya da
askerlik tecili senin için şart mı?"} + G -- "evet" --> H("DİKKAT
açık/uzaktan öğretimde KYK burs ve kredi yok,
örgün yolu yeniden düşün") + G -- "hayır, esneklik lazım" --> I{"Önceden kayıtlı ya da mezun
olduğun bir program var mı?"} + I -- "hayır" --> J("AÇIKÖĞRETİM
YKS ile yeni kayıt, TYT ya da alan puanı") + I -- "evet" --> K("KOŞULLU: İKİNCİ ÜNİVERSİTE
sınavsız, farklı alanda,
ikinci programın katkı payı sende, tecil yok") + + classDef uyari fill:#fef3c7,stroke:#f59e0b,color:#92400e + classDef hayal fill:#fee2e2,stroke:#ef4444,color:#991b1b + classDef garanti fill:#d1fae5,stroke:#10b981,color:#065f46 + class H hayal + class K uyari + class D,F,J garanti +``` + +## Açıköğretim, uzaktan ve örgün arasındaki fark nedir? + +Üç ayrı şeyi karıştırmamak gerekiyor: + +- **Açıköğretim:** Anadolu Üniversitesi Açıköğretim Fakültesi gibi, dersleri açık ve uzaktan öğrenme ortamında sunan yapı. Öğrenci kayıt yenileme döneminde ders seçer; ara sınav ve dönem sonu sınavı vardır, bütünleme yoktur (Öğrenci Kılavuzu). +- **Uzaktan öğretim programı:** Normalde örgün eğitim veren bir üniversitenin YKS ile öğrenci aldığı uzaktan programı (ör. Ankara Üniversitesi'nin uzaktan programları). Verimizde 2026'da bu tür program 106 satır. +- **Örgün:** Yüz yüze eğitim. + +| | Açıköğretim | Uzaktan öğretim programı | Örgün | +| --- | --- | --- | --- | +| **Giriş** | YKS ile yeni kayıt; ayrıca sınavsız ikinci üniversite, yatay geçiş, DGS | YKS ile (programın kendi satırı kılavuzda yer alır) | YKS ile | +| **KYK burs ve kredi** | Verilmez | Verilmez | Verilir (koşullar sağlanırsa) | +| **Askerlik tecili** | Anadolu kılavuzuna göre 28 yaşını tamamladığın yılın sonuna kadar talep gönderilir; ikinci üniversite kapsamında tecil işlemi yapılmaz | Resmî metinden teyit edemedik | Askeralma Kanunu md. 20/2'ye göre 28 yaş sınırı | +| **Derslere katılım** | Büyük ölçüde e-öğrenme ortamında; sınavlar sınav merkezlerinde | Üniversitenin uzaktan sistemi | Yüz yüze | +| **Örgün programa yatay geçiş** | Not ortalaması 100 üzerinden 90 ya da kayıt yılındaki puanın hedefin tabanına yetmesi | Aynı hüküm (md. 6/4) | Eşik 60 | +| **DGS** | Önlisans diplomasıyla girilir | — | Önlisans diplomasıyla girilir | + +Tablodaki "Verilmez" satırı için ayrıntı ve kaynak [KYK burs mu, kredi mi?](/rehber/kyk-burs-mu-kredi-mi) yazısında; yatay geçiş eşiği [kurumlar arası yatay geçiş](/rehber/kurumlar-arasi-yatay-gecis-not-ortalamasi-ile) yazısında. + +## Diploma ve transkriptte ne yazar, diploma örgünle aynı mı? + +**Bu soruya resmî bir "evet" ya da "hayır" bulamadık.** Anadolu'nun yönetmeliği ve kılavuzu şunu söylüyor: + +- Diploma, kayıtlı olduğun **programın** lisans ya da önlisans diploması olarak düzenlenir; önlisans için en az 120, lisans için en az 240 AKTS ve en az 2,00 genel not ortalaması gerekir (yönetmelik md. 18). +- 2022-2023 bahar döneminden itibaren mezunlara **dijital diploma** veriliyor, basılı diploma düzenlenmiyor; diploma QR kodla doğrulanıyor. +- Mezuniyet dereceleri diplomaya yazılmıyor, fotoğraf yapıştırılmıyor (md. 18/3-4). +- Transkript karşılığı "Not Durum Belgesi" e-Devlet'ten alınabiliyor. +- Yönetmelik derslerin açıköğretim, uzaktan öğretim ve yüz yüze yöntemlerle yapılabileceğini yazıyor (md. 6/1); bazı programlarda staj ve uygulama dersleri var. + +Bulamadığımız şeyler: diplomada ya da transkriptte öğretim biçimini gösteren bir ifade olup olmadığı, bir kamu kurumunun ilanında açıköğretim mezunlarının kabul edilip edilmediği. Bunları yazmıyoruz. Önemli bir işe ya da kadroya hazırlanıyorsan, hedeflediğin ilanın "aranan nitelikler" kısmını okuyup gerekirse kurumdan yazılı teyit iste. + +## Açıköğretime nasıl girilir: YKS ile mi, sınavsız mı? + +İki ayrı kapı var ve hangisinin açık olduğu durumuna göre değişir. + +**1. YKS ile yeni kayıt.** Anadolu'nun yeni kayıt sayfası şunu yazıyor: en az lise mezunu olacaksın, ÖSYM yerleştirmesiyle kontenjan dâhilinde yerleşeceksin; önlisans için hesaplanan TYT puanı, lisans için ilgili alanın (SAY, SÖZ, EA) puanı gerekiyor. 2026-2027 için ana yerleştirme kaydı 24 Ağustos-4 Eylül 2026, ek yerleştirme kaydı 2-16 Ekim 2026'ydı (sayfa tarihlerin sonuç duyuru gününe göre değişebileceğini de belirtiyor). Ek yerleştirmeyi [ek yerleştirme nedir?](/rehber/ek-yerlestirme-2026) yazısında anlattık. Verimizde (YÖK Atlas kaynaklı, ÖSYM 2026 yerleştirmesi) beş üniversitede toplam **112 açık öğretim programı** var: 47 lisans, 65 önlisans. Lisans programlarının 2026 taban başarı sırası **70.864 ile 1.202.899**, önlisans (TYT) programlarının **310.249 ile 1.585.423** arasında. Yani tek bir sıralama bandı yok; program program değişiyor ([bandlar yazısı](/rehber/siralama-bandlari-hangi-kapilar-acilir)). + +**2. Sınavsız ikinci üniversite (Anadolu).** Kılavuza göre: herhangi bir yükseköğretim kurumundan mezun olanlar ya da Açıköğretim Fakültesi dışındaki örgün/uzaktan programlarda halen kayıtlı olanlar, **mezun oldukları ya da okudukları alan dışındaki** açıköğretim programlarına başvurabilir; lisans eğitimi alanlar lisans ya da önlisans programlarına, önlisans eğitimi alanlar önlisans programlarına. Sayfa kaydı "şartsız, sınavsız" diye tanımlıyor ama programa özel koşulların ayrıca okunması gerektiğini söylüyor. 2026-2027 için çevrimiçi başvuru ve kayıt **17 Ağustos-23 Ekim 2026** olarak yazılı (bazı haberlerde 19 Ekim geçiyor; resmî sayfadaki tarihi esas aldık), yani şu an kapalı. + +**3. Diğer yollar.** Herhangi bir kurumda öğrenciyken yatay geçişle açıköğretime geçebilirsin (kılavuz, yatay geçiş bölümü); önlisans mezunları DGS ile lisansa geçebilir ([DGS ile lisans tamamlama](/rehber/dgs-ile-lisans-tamamlama)); ilişiği kesilmiş olanlar için [öğrenci affı](/rehber/ogrenci-affi-2026-universiteye-donus) kaydı ayrı. + +## 2026-2027 bahar döneminde kayıt ne zaman? + +Anadolu'nun 2026-2027 Türkiye programları takvimine ve kılavuzlarına göre (25 Kasım 2026'da kontrol edildi): + +| İşlem | Bahar 2026-2027 | +| --- | --- | +| **Yeni kayıt (YKS)** | Bahar için tarih yok | +| **İkinci üniversite** | Bahar için tarih yok (başvuru penceresi 23 Ekim 2026'da kapandı) | +| **Yatay ve dikey geçiş** | Bahar için tarih yok (yalnız 7592 sayılı af kapsamındaki yatay geçiş başvurusu 19 Eylül-9 Aralık 2026 olarak görünüyor) | +| **Öğrenci affı kaydı** | 25 Ocak-5 Şubat 2027 | +| **Kayıt yenileme ve ekle-sil (mevcut öğrenci)** | 8-22 Şubat 2027 | +| **Ara sınav / dönem sonu sınavı** | 10-11 Nisan 2027 / 29-30 Mayıs 2027 | + +**Yeni kayıt ve ikinci üniversite için bahar tarihi açıklanmadı.** Takvim sayfasını Ocak'ta yeniden kontrol et; açıklanırsa orada görünür. + +## KYK, askerlik tecili, yatay geçiş ve DGS açısından durum ne? + +- **KYK burs/kredi:** Yalnızca örgün öğretim öğrencilerine verilir; açık, uzaktan, dışarıdan ve yaygın eğitimde okuyanlar kapsam dışıdır. Kaynak ve ayrıntı: [KYK burs mu, kredi mi?](/rehber/kyk-burs-mu-kredi-mi) ve yurt, barınma maliyeti için [yurt, burs ve yıllık maliyet](/rehber/yurt-burs-ve-yillik-maliyet). +- **Katkı payı:** 2026-2027 kararına göre kayıtlı olduğun **tek program** için katkı payı devletçe karşılanıyor; ikinci bir programa kayıt yaptırırsan (çift anadal hariç) ikinci programın katkı payını sen ödüyorsun (Cumhurbaşkanı Kararı md. 10/3). Açıköğretimde ayrıca "dönem öğretim materyal ücreti" var; tutarı Anadolu'nun ilgili sayfasından kontrol et. +- **Askerlik tecili:** Anadolu'nun kılavuzu, 7179 sayılı Askeralma Kanunu md. 20/2'ye dayanarak, açıköğretim öğrencileri için 28 yaşını tamamladıkları yılın sonuna kadar erteleme talebi gönderileceğini yazıyor. **İkinci üniversite kapsamında kayıt yaptıranlar tecil işleminden yararlanamıyor.** Kılavuz, örgün kaydını sildirip tecili açıköğretim üzerinden yürütmek isteyenler için belge şartı da koyuyor. Bireysel durumun için askerlik şubesinden teyit al. +- **Yatay geçiş:** Açık ya da uzaktan öğretimden örgün bir programa geçmek için not ortalamasının 100 üzerinden 90 olması ya da kayıt yılındaki puanının hedef programın o yılki tabanına yetmesi gerekir; ayrıntı [kurumlar arası yatay geçiş](/rehber/kurumlar-arasi-yatay-gecis-not-ortalamasi-ile) yazısında. +- **DGS:** Açıköğretim önlisans mezunu DGS'ye girebilir; öğretim süresi dört ve daha fazla yıl olan bir programdan (açıköğretim dâhil) önlisans diploması alanlar giremez. Ayrıntı [DGS yazısında](/rehber/dgs-ile-lisans-tamamlama). + +## Örgün bir programa kayıtlıyken açıköğretime de yazılabilir miyim? + +**Anadolu için evet, sınavsız ikinci üniversite yoluyla,** ama koşullarla: okuduğun alandan farklı bir program olmalı, başvuru penceresi açık olmalı, ikinci programın katkı payını kendin ödemelisin ve askerlik tecili işlemi açıköğretim üzerinden yapılmaz. Örgün öğrencinin açıköğretimden **ders alması** ise ayrı bir yol: Anadolu'nun yönetmeliği (md. 9) örgün programa kayıtlı öğrencinin toplam kredisinin **yüzde 25**'ini geçmemek koşuluyla Açıköğretim Fakültesi'nden ders alabileceğini yazıyor; notların kendi okuluna aktarılması konusunda üniversite sorumluluk almıyor, yani aldığın dersin kendi bölümünde sayılıp sayılmayacağını başlamadan yazılı sor ([muafiyet yazısı](/rehber/universitede-ilk-hafta-ders-kaydi-muafiyet-kayit-dondurma)). Başka bir üniversitede kendi kaydını koruyarak ders almanın örgün yolu için [özel öğrencilik](/rehber/ozel-ogrenci-nedir-baska-universitede-okumak) yazısına bak. İstanbul ve Atatürk üniversitelerinin ikinci üniversite kuralları için kendi sayfalarına bakman gerekir; onları açıp doğrulamadık. + +## Kime uygun, kime uygun değil? + +| Durum | Açıköğretim | Örgün | +| --- | --- | --- | +| Tam zamanlı çalışıyorsun, ders saatine gelemiyorsun | Uygun olabilir: dersler e-öğrenme ortamında, sınavlar belirli günlerde | Zor | +| KYK burs/kredi ya da yurt senin için şart | Uygun değil: burs ve kredi verilmez | Daha uygun | +| Askerlik tecilini kesintisiz sürdürmen gerekiyor, ikinci üniversite yoluyla geliyorsun | Uygun değil: ikinci üniversitede tecil işlemi yapılmaz | Kendi örgün kaydın tecili sürdürür | +| Zaten bir lisansın var, ikinci diploma istiyorsun | Uygun olabilir (farklı alan şartı, ikinci üniversite) | Yeniden YKS gerekir | +| Önlisans bitirip lisansa geçmek istiyorsun | DGS ile geçilebilir | DGS ile geçilebilir | +| YKS'de örgün programlara sıralaman yetmedi, bir yıl bekleyemiyorsun | Seçenek olabilir; yeniden YKS ve bölümümü sevmedim yollarına da bak | [Bölümümü sevmedim](/rehber/bolumumu-sevmedim-hangi-kapilar-var) ve [üniversite okurken tekrar YKS](/rehber/universite-okurken-tekrar-yks) yazılarına bak | + +Bu tablo karar vermez, ihtiyacı sıralar. Hiçbir satır "buraya yerleşirsin" ya da "şu kadar kolay" anlamına gelmez. + +## Bu karardan önce ne yapmalısın? + +Önerdiğimiz sıra şu: önce YKS sıralamanla hangi örgün programlara yakın olduğunu gör, sonra açıköğretimi bir seçenek olarak tart; KYK, yurt ve tecil gibi örgüne bağlı haklar bu sırayla daha net görünür. KolayTercih'te [bölümler](/bolumler) sayfasından programları sıralamana göre hayal, dengeli ve güvenli diliminde görebilirsin; ürün sana bir yerleşme olasılığı vermez, sadece hangi programların sıralamana yakın olduğunu gösterir. Sonraki YKS'nin tarihleri için [2027 YKS takvimi](/rehber/yks-2027-takvimi) yazısına bak. Önlisans mı lisans mı sorusu açıksa [önlisans mı, lisans mı](/rehber/onlisans-mi-lisans-mi) yazısı karar yapısını anlatıyor. + +## Kaynaklar + +Bilgiler 25 Kasım 2026'da kontrol edildi. + +1. Anadolu Üniversitesi, [Açıköğretim Fakültesi Eğitim-Öğretim ve Sınav Yönetmeliği](https://www.anadolu.edu.tr/uploads/anadolu/files/aof_kilavuz/6ad0c4b7e120c.pdf) (RG 31.07.2025, sayı 32972; 10.07.2026, sayı 33306 değişikliğiyle): md. 6/1, 9, 18. +2. Anadolu Üniversitesi, [2026-2027 Açıköğretim Fakültesi Öğrenci Kılavuzu](https://www.anadolu.edu.tr/uploads/anadolu/files/aof_kilavuz/6a82ab808e519.pdf): diploma (VI.7.1), askerlik tecil işlemleri (VI.3), yatay geçiş, dikey geçiş, ikinci üniversite. +3. Anadolu Üniversitesi, [Açıköğretim Fakültesi akademik takvimi 2026-2027, Türkiye programları](https://www.anadolu.edu.tr/acikogretim/acikogretim-akademik-takvim/turkiye-programlari-2026-2027-ogretim-yili-akademik-takvim): bahar dönemi tarihleri. +4. Anadolu Üniversitesi, [Yeni kayıt (YKS)](https://www.anadolu.edu.tr/acikogretim/nasil-ogrenci-olabilirim/yeni-kayit) ve [İkinci üniversite](https://www.anadolu.edu.tr/acikogretim/nasil-ogrenci-olabilirim/ikinci-universite) sayfaları. +5. Anadolu Üniversitesi, [2026-2027 Güz ve Bahar Dönemi Kayıt Yenileme Kılavuzu](https://www.anadolu.edu.tr/uploads/anadolu/files/aof_kilavuz/6aa13ecf49794.pdf) (bahar kayıt yenileme 8-22 Şubat 2027) ve [Öğrenci Affı Çevrimiçi Kayıt Kılavuzu](https://anadolu.edu.tr/uploads/anadolu/files/aof_kilavuz/6ad5f685a3c5e.pdf) (katkı payı, Cumhurbaşkanı Kararı 15.08.2026, sayı 33341, md. 10/3). +6. 7179 sayılı Askeralma Kanunu md. 20 (kılavuzun alıntısıyla; kanun metni [TBMM](https://tbmm.gov.tr/Yasama/Kanun/f72877c1-2b68-037b-e050-007f01005610) sayfasında). +7. Mevzuat Bilgi Sistemi, [Önlisans ve Lisans Düzeyindeki Programlar Arasında Geçiş, Çift Anadal, Yan Dal ile Kurumlar Arası Kredi Transferi Yapılması Esaslarına İlişkin Yönetmelik](https://www.mevzuat.gov.tr/mevzuat?MevzuatNo=13948&MevzuatTur=7&MevzuatTertip=5): açık/uzaktan öğretimden örgüne geçiş eşiği (md. 6/4) KolayTercih'in [yatay geçiş yazısındaki](/rehber/kurumlar-arasi-yatay-gecis-not-ortalamasi-ile) aktarımıyla. +8. KolayTercih kataloğu (YÖK Atlas kaynaklı, ÖSYM 2026 yerleştirmesi): açık ve uzaktan öğretim program sayıları ve taban başarı sıraları. +9. KolayTercih, [KYK burs mu, kredi mi?](/rehber/kyk-burs-mu-kredi-mi): burs/kredinin yalnız örgün öğretim öğrencilerine verildiği (KYGM Burs ve Kredi Yönetmelikleri). diff --git a/content/rehber/erasmus-degisim-programi-nasil-isler.md b/content/rehber/erasmus-degisim-programi-nasil-isler.md new file mode 100644 index 0000000..f1b9031 --- /dev/null +++ b/content/rehber/erasmus-degisim-programi-nasil-isler.md @@ -0,0 +1,124 @@ +--- +baslik: Erasmus ve Değişim Programları Nasıl İşler, Tercih Yaparken Önemli mi? +aciklama: Erasmus+ öğrenim ve staj hareketliliğini Türkiye Ulusal Ajansı yürütür. Başvuru şartları, ilanların genelde açıldığı dönem, hibe, derslerin sayılması, Farabi ve Mevlana'nın durumu ve bir üniversitenin Erasmus anlaşmalarına tercih öncesi nereden bakılacağı. Garanti vermeden, kaynaklı. +tarih: 2026-11-25 +niyet: 1 +konu: strateji +cta_baslik: Önce sıralamana göre programları gör, sonra anlaşmaları karşılaştır +cta_aciklama: YKS başarı sıralamanla hayal, dengeli ve güvenli dilimlerdeki programlara bakabilir, sonra yakın bulduklarının uluslararası ofis sayfalarındaki anlaşmaları yan yana koyabilirsin. Ücretsiz, üyelik gerekmez. +--- + +**Kısa cevap:** Erasmus+, Avrupa Birliği'nin eğitim programıdır ve Türkiye'de yükseköğretim hareketliliğini **Türkiye Ulusal Ajansı** (ua.gov.tr) yürütür. Kayıtlı olduğun üniversitenin başvurusunu Ulusal Ajans'a yaptığı bir bütçeyle öğrencileri yurt dışına gönderir; sen başvurunu **kendi üniversitenin** uluslararası ofisine yaparsın. Kabaca iki hareketlilik var: bir yarıyıl ya da yıl yurt dışındaki bir üniversitede ders almak (öğrenim) ve bir kurumda çalışmak (staj). Üniversitelerin çoğu ilanını yılın ilk aylarında açıyor; ama bu **genel bir örüntü**, resmî bir takvim değil. Şartlar iki katmanlıdır: Ulusal Ajans'ın 2026 el kitabındaki çerçeve ve üniversitenin ilanındaki ek şartlar (üniversite el kitabından daha sıkı kural koyabilir). Hibe ülke grubuna göre belirlenir, ders sayılması öğrenim anlaşmana, gidebileceğin ülkeler üniversitenin anlaşmalarına bağlıdır; bu yüzden tercih yaparken Erasmus **bir ek ölçüt** olabilir, ama sıralamanı, bölümünü ve şehrini belirleyen ölçüt değildir. Kimsenin gideceğini önceden söyleyemeyiz: seçim puanla, kontenjanla ve bütçeyle olur. + +Kural ve rakamların çoğu Ulusal Ajans'ın **2026 Uygulama El Kitabı**'ndan (Yükseköğretim Kurumları El Kitabı, kaynak 1) alındı; sayfa numaraları o PDF'ye göredir. Üniversite ilanı örneği olarak Ankara Üniversitesi'nin 2026-2027 ilanını kullandık: o ilandaki kurallar o üniversiteye özgüdür. + +```mermaid +%% aria: Erasmus başvurusu karar şeması. Başlangıçta üniversitende kayıtlı mısın diye sorulur. Hayır ise önce kayıt olman gerekir, bu yazının konusu kayıtlı öğrencilerdir. Evet ise ikinci soru, programının birinci sınıfında olup olmadığındır. Birinci sınıf ya da hazırlıktaysan Ulusal Ajans el kitabı başvuruya izin verir, ama bazı üniversiteler kendi ilanında bunu kısıtlar; kendi ilanına bak ve ardından aynı soruya geç. İkinci sınıf ve üzerindeysen doğrudan sonraki soruya geçersin. Sonraki soru, üniversitenin güncel ilanındaki not ortalaması ve dil puanı şartlarını karşılayıp karşılamadığındır. Karşılıyorsan başvuru yapılır ve sonuç puan, kontenjan ve bütçeye göre belirlenir, sonuç garanti değildir. Karşılamıyorsan şartı ne zaman sağlayabileceğine bakılır ve gelecek ilan beklenir. Seçilirsen sıradaki adım öğrenim anlaşmasıdır, derslerin senin programında nasıl sayılacağı yazılı olarak bölümle belirlenir. Şemadaki renkler tek başına anlam taşımaz, her kutunun başında büyük harfli bir etiket vardır. +%% altyazi: Erasmus'ta karar iki katmanda verilir. Çerçeveyi Ulusal Ajans, şartı ve puanı üniversiten belirler; sonuç garanti değildir. +flowchart TD + A("Üniversitende kayıtlı mısın?") --> B{"Programında
kaçıncı sınıftasın?"} + B -- "birinci sınıf ya da hazırlık" --> C("KONTROL
el kitabı başvuruya izin veriyor,
ilan kısıtlayabilir") --> D + B -- "ikinci sınıf ve üzeri" --> D{"İlandaki not ortalaması
ve dil puanı şartı sağlanıyor mu?"} + D -- "evet" --> E("BAŞVURU
puan, kontenjan ve bütçeye göre sonuç;
garanti yok") + D -- "hayır" --> F("BEKLE
şartı ne zaman sağlayacağına bak,
sonraki ilanı izle") + E --> G("SEÇİLİRSEN
öğrenim anlaşması: dersler
senin programında nasıl sayılacak?") + + classDef hayal fill:#fee2e2,stroke:#ef4444,color:#991b1b + classDef uyari fill:#fef3c7,stroke:#f59e0b,color:#92400e + classDef garanti fill:#d1fae5,stroke:#10b981,color:#065f46 + class C,F uyari + class A,B,D uyari + class E,G garanti +``` + +## Erasmus+ öğrenim ve staj hareketliliği nedir, kim yürütür? + +Erasmus+ yükseköğretim hareketliliğini Türkiye'de **Türkiye Ulusal Ajansı** yürütüyor; Avrupa Komisyonu'nun Eurydice sayfası da programı böyle anlatıyor (kaynak 4). Üniversiteler Ulusal Ajans'a başvurup hibe alıyor, öğrenci seçimini ve ilanı üniversitenin Erasmus kurum koordinatörlüğü yapıyor. Yani muhatabın Ulusal Ajans değil, **kendi üniversitenin uluslararası ofisi**. + +Öğrenim hareketliliğinde partner bir üniversitede ders alırsın; staj hareketliliğinde bir kurumda çalışırsın. 2026 el kitabına göre öğrenim hareketliliği en az 2 tam ay (ya da 1 trimester), en çok 12 ay; staj en az 2, en çok 12 ay sürer ve aynı öğrenim kademesinde toplam süre 12 ayı geçemez (s. 12). Staj her sınıfta yapılabilir; son sınıf öğrencileri mezuniyetten sonraki 12 ay içinde de staj yapabilir, ama mezun olmadan başvurmaları şartıyla. Üniversite mezuniyet sonrası stajı kapsam dışında bırakmayı seçebilir; kendi ilanına bak. Bir yarıyıl için 30 AKTS, bir yıl için 60 AKTS bekleniyor (Ankara Üniversitesi ilanı, kaynak 2). + +## Farabi ve Mevlana hâlâ var mı? + +**Resmî kaynaktan teyit edemedik.** İkisi de ayrı programlar: Farabi Türkiye içindeki üniversiteler arası değişimdir ve YÖK tarafından 2009'da başlatılmıştı; Mevlana ise Türkiye'deki ve yurt dışındaki üniversiteler arasındaki değişimdir ve dayanağı 23.08.2011 tarihli Resmî Gazete yönetmeliğiydi. YÖK'ün 2026-2027 için bu programlara dair bir çağrısını ya da kaldırma kararını bulamadık. Bunun yerine bazı üniversitelerin kendi sayfalarında şunu gördük: Yalova Üniversitesi, Farabi'nin şu an pasif olduğunu ve YÖK yeni bir karar verene kadar kapalı kalacağını yazıyor; Cumhuriyet Üniversitesi, Farabi ve Mevlana kapsamındaki değişim faaliyetlerinin yeni bir yönetmelik ya da uygulama takvimi açıklanana kadar yürütülmeyeceğini duyuruyor (kaynak 5 ve 6). Bunlar üniversite beyanıdır, YÖK'ün kendi duyurusu değildir; tarihlerini de teyit edemedik. + +Bu yüzden "Farabi'yle başka şehirde okurum" ya da "Mevlana ile gideceğim" diye plan yapma. Kendi üniversitenin uluslararası ofisine "Farabi ve Mevlana bu yıl yürütülüyor mu?" diye sor. Yurt dışı değişim için asıl çalışan yol, pratikte Erasmus+ ve üniversitelerin kendi ikili anlaşmalarıdır. + +## Erasmus öğrenim, Erasmus staj ve diğer programlar nasıl ayrışıyor? + +| | Erasmus+ öğrenim | Erasmus+ staj | Farabi / Mevlana | +| --- | --- | --- | --- | +| Ne yapılır | Partner üniversitede ders alınır | Bir kurumda staj yapılır | Farabi yurt içi, Mevlana yurt dışı üniversite değişimi | +| Kim yürütür | Türkiye Ulusal Ajansı + üniversitenin koordinatörlüğü | Aynı | YÖK | +| Süre | 2-12 ay (el kitabı, s. 12) | 2-12 ay; mezuniyetten sonraki 12 ay içinde de yapılabilir, mezun olmadan başvurmak şartıyla | Teyit edemedik | +| Başvuru | Kendi üniversiteni ilanı | Aynı; bazı üniversiteler konsorsiyum ilanı açıyor | Güncel durum teyit edilemedi | +| Durum | Yürütülüyor, 2026-2027 ilanları var | Yürütülüyor, 2026 ilanları var | Bazı üniversiteler pasif/uygulanmıyor diyor; YÖK teyidi yok | + +## Başvuru şartları neler, üniversitenin ilanıyla farkı ne? + +Şartlar iki yerde yazılı: Ulusal Ajans'ın 2026 uygulama el kitabı (genel kural) ve üniversitenin ilanı. Üniversite el kitabına aykırı olmamak şartıyla ek ya da daha sıkı şart koyabilir; ayrımı aşağıdaki tabloda gör. Üniversite örneği olarak Ankara Üniversitesi'nin 2026-2027 öğrenim ilanını kullandık (kaynak 2); kendi üniversitenin ilanı farklı olabilir. + +| Şart | Ulusal Ajans el kitabı (genel kural) | Ankara Üniversitesi ilanı (örnek) | +| --- | --- | --- | +| Not ortalaması | Önlisans ve lisans en az 2,20/4,00; yüksek lisans ve doktora en az 2,50/4,00 (s. 12) | Aynı eşikler | +| Transkripti olmayan öğrenci | Hazırlık ve birinci sınıf öğrencisi için lise mezuniyet notu en az 75/100; önlisanstan geçenler için önlisans mezuniyet notu en az 2,20 (s. 12) | Birinci sınıf öğrencileri başvuramaz; birinci sınıfta başvurup ikinci sınıfta yararlanma mümkün | +| Dil | Dil sınavının ağırlığı ve barajı üniversiteye bırakılmış | Fakülteye göre değişen puanlar (YDS ve eşdeğeri üzerinden örneğin 50, 60) | +| Seçim puanı | Akademik başarı %50, dil seviyesi %50; belirli gruplar için ek puan (s. 13) | Aynı mantık, ek kurallarla | +| Daha önce yararlanma | Aynı kademede önceki faaliyet için puandan 10 puan düşer; seçilip feragat etmeden katılmamak da 10 puan düşürür; hareketlilik toplantılarına ya da dil sınavına mazeretsiz katılmama için 5 puan düşürme uygulaması üniversitenin takdirindedir (s. 14) | Önceki her faaliyet için 10 puan | +| Süre sınırı | Aynı kademede toplam 12 ay (s. 12) | Aynı | +| Sınıf kısıtı | Genel bir sınıf kısıtı yazmıyor | Bazı fakültelerde ayrı kural (ör. Tıp'ta yalnız 5. sınıf) | + +Sonuç: "birinci sınıf başvuramaz" gibi bir cümle gördüysen o, el kitabının değil **o üniversitenin** kuralıdır. Bu yüzden kendi ilanını oku ve kendi üniversitenin ek şartlarını ayır. + +## İlanlar ne zaman açılır? + +**Genelde** ocak-mart arasında. Örneğin Ankara Üniversitesi 2026-2027 öğrenim ilanını 7 Ocak 2026'da yayımladı, başvurular 11 Şubat 2026'da sona erdi. Staj ilanları ise yıl boyunca birkaç kez açılabiliyor, bazı üniversiteler konsorsiyum ilanları yayımlıyor. Bunlar **örnek**, ulusal bir takvim değil: ilanı her üniversite kendi açıyor ve tarihler üniversiteden üniversiteye değişiyor. 2027 için kendi üniversitenin ilanını **ocak ayından itibaren** uluslararası ofis sayfasından izle. + +Tercih yapacak bir aday için bunun anlamı şu: yerleştiğin ilk yıl ilanları izleyip not ortalaması ve dil puanı hazırlığını yapabilirsin; ama birçok ilan birinci sınıfın yararlanmasına izin vermiyor (yukarıdaki tabloya bak). + +## Hibe ne kadar, KYK ile birlikte alınır mı? + +Hibe, gideceğin ülkenin grubuna göre belirlenir. Ulusal Ajans'ın 2026 sözleşme dönemi el kitabındaki programla ilişkili ülkeler için aylık bireysel destek tutarları şöyle (s. 21): + +| Ülke grubu | Ülkeler | Aylık öğrenim hibesi | Aylık staj hibesi | +| --- | --- | --- | --- | +| 1. ve 2. grup | Almanya, Avusturya, Belçika, Çekya, Danimarka, Estonya, Finlandiya, Fransa, Güney Kıbrıs Rum Yönetimi, Hollanda, İrlanda, İspanya, İsveç, İtalya, İzlanda, Letonya, Lihtenştayn, Lüksemburg, Malta, Norveç, Portekiz, Slovakya, Slovenya, Yunanistan | 600 € | 750 € | +| 3. grup | Bulgaristan, Hırvatistan, Kuzey Makedonya, Litvanya, Macaristan, Polonya, Romanya, Sırbistan | 450 € | 600 € | + +Bu tutarlar **2026 sözleşme dönemi** içindir ve her yıl değişebilir; sonraki dönemde güncel el kitabına bak. Programla ilişkili olmayan ülkeler için el kitabında ayrı bir tablo var (s. 21; örneğin 1-3 ve 5-12. bölge ülkeleri için aylık 700 € ve 700 €); o ülkelere gidiş üniversitenin anlaşmasına bağlı. Seyahat desteği ayrıca verilir; gerçek hibeni üniversiten ülkene, kalış sürene ve ilanına göre hesaplar. Eski dönemlerin tutarlarını bugünkü hibe sanma. + +İmkânı kısıtlı öğrencilere 2-12 ay arası hareketlilikte aylık **250 avro** ilave hibe sağlanabiliyor; KYK bursu ve benzeri burslar bu "maddi yardım" kapsamında sayılmıyor (el kitabı s. 23; Ankara Üniversitesi ilanı da aynı şekilde yazıyor). + +**KYK bursu ya da kredin değişim döneminde kesilir mi?** El kitabının 18. maddesine ("Ulusal Hibe ve Burslar", s. 32-33) göre üniversite, öğrencinin yurt dışındaki faaliyeti süresince aldığı yükseköğretim burs ve kredilerinin devamını sağlamakla yükümlüdür; bu kazanım faaliyet sırasında sonlandırılamaz, kesintiye uğratılamaz ve azaltılamaz. Ulusal burs ya da kredi şartlarını sağlayan öğrencinin Erasmus hibesinden yararlanma hakkına da sınırlama getirilemez. Bu Ulusal Ajans'ın kuralıdır; KYK'nin kendi mevzuat metnine bu çalışmada ulaşamadık, kyk.gsb.gov.tr ve üniversitenin öğrenci işleri ile teyit et. Burs ve kredi farkı için [KYK burs mu, kredi mi?](/rehber/kyk-burs-mu-kredi-mi), yaşam maliyeti için [yurt, burs ve yıllık maliyet](/rehber/yurt-burs-ve-yillik-maliyet) yazısına bak. Bir de: yurt dışındayken kendi üniversitene kayıtlı kalırsın ve varsa harç ya da öğrenim ücretini ödemeye devam edersin (s. 32, madde 17). + +## Dersler nasıl sayılır? + +Gitmeden önce **öğrenim anlaşması** yapılır: yurt dışında hangi dersleri alacağın ve bunların senin programında hangi derslerin yerine geçeceği yazılı olarak bölümle belirlenir. Ankara Üniversitesi'nin ilanı, başarıyla tamamlanan kredilere tam akademik tanınma sağlandığını, ama öğrencinin başvurduğu üniversiteyle ders uyumunu kontrol etmesi ve bölüm Erasmus koordinatörüne danışması gerektiğini yazıyor (kaynak 2). Yani tanınma otomatik değil, anlaşmanın kendisine bağlı. + +Yönetmelik düzeyindeki dayanak, geçiş yönetmeliğinin 22. maddesidir: özel öğrenci ya da değişim programında alınan ders ve uygulama kredilerinin ilgili yönetim kurulu kararıyla programdaki yükümlülüklerin yerine sayılabileceğini [özel öğrenci yazısında](/rehber/ozel-ogrenci-nedir-baska-universitede-okumak) aktardık. Biz bu maddeyi bu çalışmada doğrudan açıp okuyamadık; oradaki aktarıma dayanıyoruz. Önemli bir fark: özel öğrencilikte kaydın kendi üniversitende kalır ve en fazla iki dönem yararlanırsın; Erasmus ise ayrı bir programdır, kuralları ayrıdır, ikisini karıştırma. Yurt dışında almadığın ya da sayılmayan derslerin dönmeden önce nasıl işleyeceği için [üniversitede ilk hafta, ders kaydı ve muafiyet](/rehber/universitede-ilk-hafta-ders-kaydi-muafiyet-kayit-dondurma) yazısına da bak. + +## Tercih yaparken Erasmus önemli mi? + +**Ek bir ölçüt, ana ölçüt değil.** Erasmus'a gidebilmen için önce o üniversitede ve o bölümde olman gerekiyor; tercih sırası ve yerleşme YKS sıralamana bağlıdır. Yine de aynı sıralama aralığında kalan iki program arasında kaldıysan şu soruları sorabilirsin: + +1. **Üniversitenin anlaşmaları var mı?** Üniversitelerin uluslararası ofis ya da Erasmus koordinatörlüğü sayfalarında genelde partner listesi, kontenjan ve önceki yılların ilanları duruyor. Bölümünün (ya da fakültenin) kendi anlaşmalarına bak; bir üniversitenin genel anlaşma sayısı, senin bölümüne anlaşma olduğu anlamına gelmiyor. +2. **Hangi ülkelerle?** İlan kontenjanı çoğu zaman ülke ve partner bazlı yazılıyor; gitmek istediğin ülkede senin alanından bir partner var mı? +3. **Dil şartı ne?** İlanda yazan dil puanını geçmen gerekiyor; programın yabancı dilde olup olmaması bu açıdan fark yaratabilir. +4. **Kontenjan ve başvuru sayısı?** Eski ilanlardaki kontenjan, kaç kişi başvurdu bilgisi varsa rekabeti anlamak için bakılabilir; ama her yıl değişir. + +Bu ölçütü sıralaman, bölümün ve şehrin yanında nasıl tartacağın için [bölüm mü, üniversite mi, şehir mi?](/rehber/bolum-mu-universite-mi-sehir-mi) yazısındaki karar sırasına bak. Kısaca: önce hangi bölüme girebildiğine ve gerçekten ne okumak istediğine karar ver, Erasmus'u iki yakın seçenek arasındaki bir tartı olarak kullan. "Bu üniversitede Erasmus kolay" gibi bir cümle kuramayız; kimin gideceğini seçim puanı, kontenjan ve bütçe belirliyor. + +## KolayTercih'te bunu nasıl kullanırsın? + +Önce YKS başarı sıralamanla hangi programların hayal, dengeli ve güvenli dilimlerinde olduğuna bak. Yakın bulduğun programların bağlı olduğu üniversitelerin listesini [üniversiteler](/universiteler) ve [bölümler](/bolumler) sayfalarından görebilirsin. Sonra o üniversitelerin uluslararası ofis sayfalarındaki anlaşmaları ve geçmiş ilanları yan yana koy. Ürün Erasmus anlaşmalarını göstermiyor ve kimin gideceği konusunda bir olasılık vermiyor; onu üniversitenin kendi sayfası söyler. + +## Kaynaklar + +Bilgiler 25 Kasım 2026'da kontrol edildi. Kural ve tutarlar Ulusal Ajans'ın 2026 el kitabından alındı; ilan örneği olarak bir üniversite ilanı kullanıldı. + +1. Türkiye Ulusal Ajansı, 2026 Dönemi KA131 Sözleşme Belgeleri sayfasındaki Yükseköğretim Kurumları El Kitabı (2026 Uygulama El Kitabı, değişikliklerden arındırılmış metin; s. 12-14, 21, 23, 32-33): (sayfa: ) +2. Ankara Üniversitesi Erasmus Koordinatörlüğü, 2025 proje dönemi (2026-2027) öğrenim hareketliliği ilanı: +3. Mevzuat Bilgi Sistemi, Önlisans ve Lisans Düzeyindeki Programlar Arasında Geçiş Yönetmeliği (RG 24.04.2010, 27561), md. 22 (metni açıp okuyamadık, özel öğrenci yazımızdaki aktarıma dayanıyor): +4. Avrupa Komisyonu Eurydice, Türkiye, Yükseköğretimde hareketlilik (son güncelleme 17 Mayıs 2025): +5. Yalova Üniversitesi, Farabi Exchange Programme sayfası (üniversite beyanı): +6. Cumhuriyet Üniversitesi Uluslararası İlişkiler Ofisi, Farabi ve Mevlana değişim programlarının uygulanmamasına ilişkin duyuru (üniversite beyanı; yalnız başlığı ve arama özetini görebildik): +7. KolayTercih rehberi: [özel öğrenci](/rehber/ozel-ogrenci-nedir-baska-universitede-okumak), [KYK burs mu, kredi mi?](/rehber/kyk-burs-mu-kredi-mi), [bölüm mü, üniversite mi, şehir mi?](/rehber/bolum-mu-universite-mi-sehir-mi) diff --git a/content/rehber/kyk-bursu-cikmadi-baska-hangi-burslar-var.md b/content/rehber/kyk-bursu-cikmadi-baska-hangi-burslar-var.md new file mode 100644 index 0000000..ea2fc09 --- /dev/null +++ b/content/rehber/kyk-bursu-cikmadi-baska-hangi-burslar-var.md @@ -0,0 +1,136 @@ +--- +baslik: KYK Bursu Çıkmadı: Başka Hangi Burslara, Nereden ve Ne Zaman Bakılır? +aciklama: KYK bursu çıkmadıysa elindeki yollar, KYK bursuyla başka burs birlikte alınır mı (Burs Yönetmeliği m.10), burs türlerine göre nereye bakılacağı, sahte burs ilanını anlama ve burs çıkmazsa bütçe. Resmî kaynaklarla, vaatsiz. +tarih: 2026-11-20 +niyet: 1 +konu: para +cta_baslik: Burs çıkmazsa maliyeti sıralamana göre düşün +cta_aciklama: Sıralamanla hangi programlara yakın olduğunu hayal, dengeli ve güvenli dilimlerinde görüp şehir ve okul türüne göre maliyeti baştan hesaplayabilirsin. Ücretsiz, üyelik gerekmez. +--- + +**Kısa cevap:** KYK (resmî adıyla Gençlik ve Spor Bakanlığı Kredi ve Yurtlar Genel Müdürlüğü, KYGM) bursu çıkmadıysa ilk bakacağın yer sonuç ekranıdır: kredi çıkmış olabilir, hiçbir şey çıkmamış olabilir. Hiçbir şey çıkmadıysa Burs Yönetmeliği'nin 12. maddesi sonuçların açıklanmasından itibaren **30 gün** içinde gerekçeni yazarak yeniden inceleme istemene izin verir; 2026-2027 sonuçları 6 Kasım 2026'da açıklandığı için bu süre kabaca 6 Aralık 2026'da dolar (ekranda yazan tarih esastır). Başka burslar için temel kural şudur: **kamu kurumlarının bursunu alan öğrenci KYK bursu alamaz** (Burs Yönetmeliği m.10/c); özel vakıf ve derneklerin bursları bu kuralın dışında olabilir ama her vakfın kendi kuralı geçerlidir. Bu yazıda tek tek burs adı sıralamadık: önce bursun **türüne** göre nereye bakılacağını, sonra neyi nasıl teyit edeceğini anlattık. Tek tek "şu an açık" ilanı da vermiyoruz; onun yerine hangi kapıya ne zaman bakılacağını gösteren bir takvim var. + +```mermaid +%% aria: KYK bursu çıkmadığında izlenecek karar şeması. Başlangıç noktası e-Devlet'teki sonuç ekranıdır. Ekranda kredi yazıyorsa taahhütname onayı yapılır ve kredi borç olduğu için bütçe planı kurulur; burs isteniyorsa gelecek yıl yeniden başvurulur. Ekranda hiçbir şey çıkmadı yazıyorsa sonuçtan itibaren otuz gün içinde gerekçeli yeniden inceleme istenir. Her iki durumda da sırayla kendi üniversitenin burs ve kısmi zamanlı çalışma birimine, yaşadığın yerin belediyesine ve ilgili kamu kurumlarına, son olarak özel vakıf ve derneklere bakılır. Kamu kurumu bursu alan öğrenci KYK bursu alamaz, özel vakıf bursunun birlikte alınıp alınmadığı vakfın kendi kuralındadır. Her başvuruda adresin resmî alan adı olup olmadığı ve para ya da kart bilgisi istenip istenmediği kontrol edilir; para isteyen ilan sahte sayılır. Şemadaki renkler tek başına anlam taşımaz, her kutuda ne olduğu yazılıdır. +%% altyazi: Burs çıkmadığında sırayla üniversiteye, belediyeye, kamu kurumuna ve vakfa bak; her kapıda önce resmî adresi ve para istenip istenmediğini kontrol et. +flowchart TD + S{"e-Devlet sonuç ekranında
ne yazıyor?"} -- "kredi" --> K("KREDİ ÇIKTI
geri ödemeli borç
taahhütname süresi geçtiyse
KYGM'ye sor") + S -- "hiçbiri" --> H("HİÇBİRİ ÇIKMADI
30 gün içinde gerekçeli
yeniden inceleme iste") + K --> U("1. Üniversitenin burs ve
kısmi zamanlı çalışma birimi") + H --> U + U --> B("2. Belediye ve valilik
destekleri") + B --> KK("3. Kamu kurumu bursları
KYK bursuyla birlikte alınmaz") + KK --> V("4. Özel vakıf ve dernekler
birlikte alma vakfın kuralı") + V --> C{"Başvuru adresi resmî mi,
para ya da kart bilgisi
istiyor mu?"} + C -- "para ya da kart istiyor" --> X("SAHTE OLABİLİR
başvurma") + C -- "resmî ve ücretsiz" --> OK("Başvuruyu yap,
son günü not et") + + classDef uyari fill:#fef3c7,stroke:#f59e0b,color:#92400e + classDef garanti fill:#d1fae5,stroke:#10b981,color:#065f46 + classDef hayal fill:#fee2e2,stroke:#ef4444,color:#991b1b + class K,H,S,C uyari + class OK garanti + class X hayal +``` + +## KYK bursu çıkmadıysa elinde ne var? + +Önce ekranda ne yazdığını ayır, çünkü iki durum farklı: + +- **Kredi çıktıysa:** Bu geri ödemeli bir borçtur, burs değildir. Taahhütname onayının yurt içindeki öğrenciler için son günü 11 Kasım 2026'ydı; kaçırdıysan ne yapılabileceğini KYGM'ye sor, çünkü onaylamayana ödeme yapılmadığını KYGM açıkça söylüyor. Kredinin borç olarak nasıl işlediği [KYK burs mu, kredi mi](/rehber/kyk-burs-mu-kredi-mi) yazısında. +- **Hiçbiri çıkmadıysa:** Burs Yönetmeliği'nin 12. maddesine göre burs verilmeyen öğrenci, sonuçların açıklanmasından itibaren 30 gün içinde, Bakanlığın belirleyeceği usulde ve gerekçesini belirterek durumunun yeniden incelenmesini isteyebilir. Hangi ekrandan yapılacağı yönetmelikte yazmıyor; sonuç ekranındaki yönlendirmeye ya da KYGM'nin iletişim kanallarına bak. İtirazın sonucuna dair bir söz vermiyoruz; bu yazı hangi öğrenciye burs çıkacağını bilmiyor. +- **Burs istiyorsan gelecek yıl:** Başvuru yılda bir kez, geçen iki yılda Ekim ortasında beş günlük pencerede alındı (2025: 13-17 Ekim, 2026: 12-16 Ekim). 2027 tarihi henüz açıklanmadı. + +KYK dışı kapılar aşağıda. Telaşa gerek yok ama süre geçen kapıları da bil: aşağıdaki burs türlerinin çoğunun penceresi Eylül-Kasım arasındadır ve bir kısmı çoktan kapanmıştır. + +## KYK bursuyla başka burs aynı anda alınır mı? + +Cevap burs sahibine göre değişiyor. + +| Durum | Kural | Kaynak | +|---|---|---| +| Kamu kurum ve kuruluşlarından burs, kredi ya da benzeri nakdi yardım alıyorsun | KYK bursu verilmeyen öğrenciler arasındasın | Burs Yönetmeliği m.10/c | +| KYK bursu alırken kamu kurumunun bursunu seçersen | KYK bursun kesilir | Burs Yönetmeliği m.16/2 | +| Özel vakıf ya da dernek bursu alıyorsun | Yönetmeliğin kamu kurumu maddesi bunu saymıyor; ama vakfın kendi şartı geçerli. Örneğin TEV 1 Eylül 2026 duyurusuyla bursunun KYK bursuyla birlikte alınabileceğini açıkladı | Vakfın kendi duyurusu (KYK yazımızda aktarıldı) | +| Üniversitenin kampüs içi kısmi zamanlı çalıştırması | 2547 sayılı Kanun m.46 gereği ücret KYK burs/kredisinin kesilmesine sebep olmaz | [KYK yazısı](/rehber/kyk-burs-mu-kredi-mi) | + +Bu satırlar bursun sana ödenip ödenmeyeceğini söylemez; yalnızca birlikte alma kuralını söyler. Şüphede kalırsan başvurduğun kurumun yönergesindeki "başka burs" maddesini oku ve yazılı sor. + +Vakıf üniversitesindeysen üniversitenin kendi bursunun (giriş bursu, indirim) ayrı kuralları var; ayrım için [vakıf üniversitesi bursu kesilir mi](/rehber/vakif-universitesi-bursu-kesilir-mi) ve [burslu, indirimli, ücretli farkı](/rehber/vakif-universitesi-burslu-indirimli-ucretli-farki) yazılarına bak. + +## Burs türleri haritası: kim verir, neye bakar, ne zaman açılır? + +Aşağıdaki tablo bir **liste değil, harita**: bursu adıyla değil, vereninin türüyle ararsın. "Genelde" dediğimiz zamanlama sütunu bir tahmindir; resmî teyit değildir. Her kurumun penceresi ve şartı yıldan yıla değişir, başvurmadan önce kurumun kendi sayfasından kontrol et. + +| Burs türü | Kim verir | Genelde neye bakar | Genelde ne zaman | Karşılıksız mı | +|---|---|---|---|---| +| Üniversite bursları (başarı, yemek, ihtiyaç) | Üniversitenin öğrenci işleri, sağlık-kültür-spor birimi, mezunlar vakfı | Ekonomik durum, not ortalaması, bölüm | Güz dönemi başı ve dönem içi duyuru; üniversiteye göre değişir | Çoğunlukla evet; şartı kurumun yönergesinde | +| Kısmi zamanlı öğrenci çalıştırma | Üniversite (2547 m.46) | Başvuru ve görev yeri; KYK bursu alana öncelik | Dönem başı | Burs değil, çalışma karşılığı ücret | +| Belediye bursları | İl ve ilçe belediyeleri | Çoğunlukla o ilde ikamet, gelir, başarı | Belediyeye göre; ilanlar belediyenin resmî sayfasında | Kurumun belgesine bak | +| Kamu kurumu bursları (bakanlık, TÜBİTAK, Vakıflar Genel Müdürlüğü gibi) | Kurumun kendisi | Kurumun mevzuatındaki şart (başarı sıralaması, bölüm, gelir) | Kuruma göre; kendi duyurusu | Kurumun mevzuatına bak; KYK bursuyla birlikte alınmaz (m.10/c) | +| Özel vakıf ve dernekler | TEV gibi vakıflar, mezun dernekleri | Gelir, başarı, bölüm | Çoğu Eylül-Kasım arası | Vakfın kendi şartı | + +Üç not: + +- **TÜBİTAK lisans bursları:** tutar ve tarih yıldan yıla değiştiği için yazmıyoruz. Şartı (olimpiyat ya da YKS derecesi gibi) TÜBİTAK'ın kendi "Burslar" sayfasından oku. +- **Bakanlık araştırma bursları:** haberlerde dolaşan kontenjan ve aylık tutar rakamlarını resmî sayfadan teyit edemediğimiz için yazmadık. Rakamı bir habere değil, kurumun kendi duyurusuna bakarak not et. +- **Vakıflar Genel Müdürlüğü ve belediye bursları:** belirli bir il ya da yıl için tarih ve tutar yazmıyoruz; kendi ilinin ve ilçenin resmî sayfasına bak. + +## Hangi kapıya ne zaman bakılır? + +Burs ilanları her gün açılıp kapanıyor; blog ve liste sitelerindeki "açık burslar" tablolarının çoğu tarihsiz ya da eski yıldan kalma. Bu yüzden tek tek ilan saymak yerine her kapının ne zaman açıldığını gösteren takvimi kullan (20 Kasım 2026 itibarıyla): + +| Kapı | Ne zaman bakılır | Nereye bakılır | Not | +|---|---|---|---| +| KYK burs/kredi (yeniden inceleme) | Sonuçtan itibaren 30 gün | e-Devlet sonuç ekranı, KYGM duyuruları | 2026-2027 sonuçları 6 Kasım 2026'da açıklandı | +| KYK burs/kredi yeni başvuru | Ekim ortası (2025 ve 2026'da beş gün) | KYGM duyuruları | 2027 tarihi açıklanmadı | +| Üniversite bursu | Her dönem, kuruma göre | Üniversitenin öğrenci işleri sayfası | İhtiyaç bursu genelde dönem başında | +| Belediye bursu | Belediyeye göre | Belediyenin resmî sayfası | İlan yoksa belediyeye sor | +| Özel vakıf bursu | Çoğu vakıf Eylül-Kasım arası | Vakfın kendi sitesi | Örnek: TEV 2026-2027 üniversite bursu başvurusu 14 Eylül-8 Ekim 2026'daydı, **kapandı**; gelecek yıl Eylül'de yeniden bakılır | +| Kamu kurumu bursu | Kuruma göre | Kurumun kendi duyurusu | KYK bursuyla birlikte alınmaz | + +Takvimde KYK ve TEV satırları resmî duyurulara dayanıyor; öbür satırlar bursların genelde hangi aylarda açıldığını gösterir, kesin tarih değildir. Bir burs ilanı "son gün yakında" diyorsa tarihi kurumun resmî sayfasında gör, sonra başvur. + +## Burs başvurusunda hangi belgeler istenir, sahte burs ilanı nasıl anlaşılır? + +**İstenen belgeler kuruma göre değişir.** KYK başvurusunda belge toplamıyorsun; Bakanlık bilgiyi kamu kurumlarından alıp teyit ediyor. Diğer kurumlarda yaygın istenenler öğrenci belgesi, transkript, nüfus kayıt örneği, gelir beyanı ya da aile maaş belgeleri, ikametgâh belgesidir. Tam liste kurumun başvuru sayfasındadır; listeyi bir blogdan almak yerine oradan al. + +**Sahte ya da şüpheli ilanı ayırt etmek için:** + +- **Başvuru için para isteyen** her ilan şüphelidir. Burs veren kurum, başvuranlardan "işlem ücreti" ya da "dosya parası" istemez. +- **Kart numarası, CVV, e-Devlet şifresi, banka şifresi istenmez.** İstenirse başvuru bitmiştir, devam etme. +- **Alan adına bak:** kamu kurumları `.gov.tr`, belediyeler `.bel.tr`, üniversiteler `.edu.tr` uzantısı kullanır; vakıflar kendi alan adlarını kullanır. Sosyal medyada paylaşılan kısaltılmış link yerine kurumun sitesine kendin gir. +- **Süre baskısı:** "Son 2 saat", "kontenjan doluyor" gibi cümleler dikkat işaretidir. +- **Telefonla gelen "burs kazandınız" mesajı:** kendi başvurmadığın bir burs sonucu gelirse kuruma kendi bildiğin telefon numarasından sor. + +## Burs çıkmazsa bütçeyi nasıl kurarsın? + +Burs bir güvence değildir; planı "çıkmazsa" senaryosuyla kur. Kısa yol: + +1. Barınma, yaşam ve öğrenim kalemlerini ayrı yaz; yöntemi [yurt, burs ve yıllık maliyet](/rehber/yurt-burs-ve-yillik-maliyet) yazısında bulursun. +2. Bursu bütçeye "gelir" olarak değil, **çıkarsa fazladan gelen** olarak yaz. +3. Kredi çıktıysa onu da borç olarak say: geri ödeme, normal öğrenim süresi bittikten iki yıl sonra başlıyor. +4. Aile ile bu konuşmayı tercih listesini vermeden önce yap: [veliler için tercih rehberi](/rehber/veliler-icin-tercih-rehberi). Devlet ve vakıf arasındaki fark bütçeyi en çok değiştiren kalemdir: [devlet mi vakıf mı](/rehber/devlet-mi-vakif-mi). + +## Sık sorulan sorular + +**KYK bursu çıkmadı, itiraz edebilir miyim?** +Evet. Burs Yönetmeliği m.12'ye göre sonuçların açıklanmasından itibaren 30 gün içinde gerekçeni yazarak yeniden inceleme isteyebilirsin. Hangi ekrandan yapılacağı sonuç ekranında ya da KYGM'nin iletişim kanallarında yazar. + +**KYK bursu varken başka burs alabilir miyim?** +Kamu kurumundan burs alıyorsan KYK bursu verilmez (m.10/c). Özel vakıf ve dernek bursları bu maddede sayılmıyor; vakfın kendi kuralına bak. + +**Belediye bursu KYK bursunu engeller mi?** +Yönetmelik "kamu kurum ve kuruluşları"nı 5102 sayılı Kanun'a atıfla tanımlıyor; belediye bursunun bu kapsama girip girmediği bursun kaynağına göre değişebilir. Başvurmadan önce hem belediyeye hem KYGM'ye yazılı sor. + +**Burs çıkmaması benim yeterliliğim hakkında bir şey söyler mi?** +Hayır. Kontenjan her yıl Bakanlıkça belirlenir; kimin burs alacağını değerlendirme sonucu belirler. Bunu resmî kaynaklar yayımlamıyor; biz de tahmin etmiyoruz. + +## Kaynaklar + +Kaynaklara 20 Kasım 2026'da erişildi, aksi belirtilmedikçe. + +- Resmî Gazete, [Gençlik ve Spor Bakanlığı Burs Yönetmeliği](https://www.resmigazete.gov.tr/eskiler/2023/11/20231103-1.htm) (3 Kasım 2023, sayı 32358), m.5 (kamu kurumlarının bursu bildirmesi), m.10/c (kamu kaynaklı burs alana KYK bursu verilmemesi), m.12 (30 gün içinde yeniden inceleme), m.16/2 (kamu bursunu seçince KYK bursunun kesilmesi) +- Kredi ve Yurtlar Genel Müdürlüğü, [Burs/Kredi Sonuçları Açıklandı](https://kygm.gsb.gov.tr/HaberDetaylari/1/305251/burs-kredi-sonuclari-aciklandi.aspx) (6 Kasım 2026) ve [Sıkça Sorulan Sorular](https://kygm.gsb.gov.tr/sayfalar/2446/3200/sikca-sorulan-sorular-kredi-burs.aspx), sonuç tarihi, taahhütname süresi ve KYGM'nin kuralları; ayrıntısı [KYK yazımızda](/rehber/kyk-burs-mu-kredi-mi) +- Türk Eğitim Vakfı, [TEV Bursunun Diğer Burslarla Birlikte Alınmasına İlişkin Bilgilendirme](https://www.tev.org.tr/duyuru/tr/72/TEV-Bursunun-Diger-Burslarla-Birlikte-Alinmasina-Iliskin-Bilgilendirme) (1 Eylül 2026) ve [TEV Üniversite Eğitim Bursu Başvuruları Açıldı](https://www.tev.org.tr/duyuru/tr/74/TEV-Universite-Egitim-Bursu-Basvurulari-Acildi) (14 Eylül-8 Ekim 2026) +- 2547 sayılı [Yükseköğretim Kanunu](https://www.mevzuat.gov.tr/mevzuatmetin/1.5.2547.pdf), madde 46, kısmi zamanlı öğrenci çalıştırma diff --git a/content/rehber/lisans-egitimi-3-yila-mi-iniyor.md b/content/rehber/lisans-egitimi-3-yila-mi-iniyor.md new file mode 100644 index 0000000..92acdfa --- /dev/null +++ b/content/rehber/lisans-egitimi-3-yila-mi-iniyor.md @@ -0,0 +1,129 @@ +--- +baslik: Lisans Eğitimi 3 Yıla mı İniyor? YÖK Ne Dedi, Ne Kesin, 2027'de Tercih Yapacakları Etkiler mi? +aciklama: YÖK Başkanı Özvar 2025'ten beri lisansın üç yılda bitirilebilmesinden söz ediyor; 7 Kasım 2026'da 180 kredi ifadesi haberlere girdi. Resmî bir karar ya da yönetmelik yok. Ne söylendi, ne kesin, ne bilinmiyor ve tercih kararını etkiler mi. +tarih: 2026-11-20 +niyet: 1 +konu: strateji +cta_baslik: Tercih kararını kesinleşmemiş haberlere değil sıralamana göre kur +cta_aciklama: Sıralamanla hangi programların hayal, dengeli ve güvenli diliminde olduğunu görebilirsin. Ücretsiz, üyelik gerekmez. +--- + +**Kısa cevap:** **20 Kasım 2026 itibarıyla lisansı üç yıla indiren bir yasa, yönetmelik ya da YÖK kararı bulamadık; yalnızca YÖK Başkanı Erol Özvar'ın açıklamaları ve haberleri var.** Üç yılda mezuniyet fikri YÖK'ün sayfalarında 2025 Eylül'ünden beri geçiyor ve "isteyen ve başarılı öğrenci" için seçenek olarak anlatılmıştı. 7 Kasım 2026'daki CNN Türk yayınına dayanan haberlerde ise "lisans kredisini 180 kredi içinde formüle edebiliriz" cümlesi yer aldı. Hangi bölümlerin kapsanacağı, ne zaman başlayacağı ve bugün okuyan ya da 2027'de yerleşecek öğrenciyi nasıl etkileyeceği **açıklanmadı**. Bu yüzden bölüm seçimini bu habere göre değiştirmek için bir dayanak yok. + +Bu yazı **20 Kasım 2026'daki bilgiyle** yazıldı. Resmî bir karar ya da yönetmelik çıktığında güncellenecek. Her satır üç etiketten birini taşıyor: **RESMÎ KAYNAKTA VAR**, **HABERLERE GÖRE** (birincil kaynağı bulunamadı) ya da **AÇIKLANMADI**. + +## YÖK Başkanı tam olarak ne söyledi, ne zaman, nerede? + +Tek bir "açıklama" yok; aynı fikir 2025'ten beri farklı ağızlardan ve farklı ayrıntılarla geliyor. Tarih sırasıyla: + +| Tarih | Nerede | Ne söylendi | Kaynak türü | +|---|---|---|---| +| 2 Eylül 2025 (2 Ekim'de güncellendi) | YÖK, "2030 yol haritası" haberi | "Öğrencilerimize üç yılda mezun olabilme imkânı sağlayacak yapısal reformları gündemimize alıyoruz." 240 AKTS'nin gözden geçirilmesi, Avrupa'da birçok ülkede 180 AKTS ile mezuniyet olduğu | **RESMÎ KAYNAKTA VAR** (yok.gov.tr) | +| 21 Ekim 2025 | YÖK haberi | İsteyen ve başarılı öğrencilerin üç yılda bitirebilmesi için çalışma yürütülüyor; ders içeriğini sadeleştirme, yaz okulu; ne yasa ne tarih var | **RESMÎ KAYNAKTA VAR** | +| 17 Kasım 2025 | YÖK haberi | "Bu çalışmalarımız önümüzdeki yıldan itibaren hayata geçirilecektir." Sayfada 180 AKTS ifadesi, bölüm listesi ya da yasa dayanağı yok | **RESMÎ KAYNAKTA VAR** | +| 10 Aralık 2025 | YÖK haberi, rektörlere mesaj | "Müfredatı ve AKTS'yi birlikte gözden geçirelim"; mevcut koşul lisansta en az 240 AKTS | **RESMÎ KAYNAKTA VAR** | +| 20-21 Aralık 2025 | CNN Türk, Hafta Sonu | Bianet'in aktarımına göre: öğrenci yine sekiz yarıyılı bitirecek ama yoğun programla üç yılda, **240 AKTS korunacak**, 2026-2027'ye yetişmezse sonraki dönem | **HABERLERE GÖRE** | +| 7 Kasım 2026 | CNN Türk, Hafta Sonu | Milli Gazete ve Yeni Asır'ın aktarımına göre: "Lisans kredimizi 180 kredi içinde formüle edebiliriz", "3 yıl içinde tamamlayabiliriz", "üniversitelerimizi bir senedir bu konuya hazırlıyoruz"; Türkiye'de lisansta yaklaşık 60, Avrupa'da 20-25 ders olduğu; ders sayılarının gelecek yıldan itibaren azaltılacağı | **HABERLERE GÖRE** | + +İki önemli not var. Birincisi: 7 Kasım 2026 sözlerinin YÖK sitesinde bir haberini bulamadık, yayının kendisini de izleyemedik; bu tarih için elimizde yalnızca haber siteleri var, bu yüzden tırnak içindeki cümleleri "habere göre" diye okuyun. İkincisi: Aralık 2025'te aktarılan hâl (240 AKTS korunur) ile Kasım 2026'da aktarılan hâl (180 kredi) birbirinden farklı. Hangisinin geçerli olduğunu, hatta ikisinin aynı model olup olmadığını YÖK'ün yazılı bir metni olmadan söyleyemeyiz. + +## Bu bir karar mı, çalışma mı? + +Elimizdeki her şey **çalışma** niteliğinde. Bulabildiğimiz resmî kaynaklarda şu yok: Resmî Gazete'de yayımlanmış bir düzenleme, YÖK Genel Kurulu'nun yayımlanmış bir kararı, yeni bir yönetmelik. YÖK'ün Kasım 2026 haber akışında da (20 Kasım'a kadar baktık) üç yıllık lisansa ya da 180 krediye dair bir duyuru yok; 14 Kasım 2026 tarihli çift anadal haberinde de bu ifadeler geçmiyor. Haberlere göre Özvar üniversitelerin senato ve kurullarından gerekli çalışmayı yapmasını istedi; bu, kararın üniversite düzeyinde hazırlandığını gösterir, bir karar çıktığını göstermez. + +Zaman çizelgesi de dikkat çekici: Kasım 2025'te "önümüzdeki yıldan itibaren" denmişti; Aralık 2025'te "2026-2027'ye yetişmezse sonraki dönem" diye aktarıldı. 2026-2027 öğretim yılı başladı ve biz bu dönemde yürürlüğe giren bir üç yıllık lisans düzenlemesi bulamadık. Bunu bir yorum olarak söylemiyoruz, yalnızca söylenen tarih ile bulunan düzenlemeyi yan yana koyuyoruz. + +## Bugün mevzuat ne diyor? + +Bugün yürürlükteki iki hüküm açık. 2547 sayılı Yükseköğretim Kanunu lisansı "ortaöğretime dayalı, **en az sekiz yarıyıllık** bir programı kapsayan yükseköğretim" diye tanımlıyor (madde 3/s). Aynı kanunun 44. maddesi de öğrenim süresi dört yıl olan lisans programlarının azami yedi yılda tamamlanmasını şart koşuyor. Kredi tarafında YÖK'ün 10 Aralık 2025 haberi mevcut koşulu ön lisansta en az 120, lisansta en az 240 AKTS olarak veriyor. + +Bunun anlamı şu: kanundaki tanım "en az sekiz yarıyıl" dediği sürece, altı yarıyıllık (üç yıllık) bir lisans programı bu tanıma uymaz. Sekiz yarıyıllık programın yaz dönemleri ve yoğun takvimle üç yılda bitirilmesi ise ayrı bir modeldir. YÖK hangi modeli seçeceğini ve kanun değişikliği isteyip istemeyeceğini yazılı olarak açıklamadı; haber aktarımları da bu noktada birbirini tutmuyor. Bu yüzden o satır **AÇIKLANMADI**. + +## Hangi bölümler etkilenecek? + +**Açıklanmadı.** Bölüm listesi yok. Haberlerde geçen ayrıntılar şunlar ve hepsi "habere göre" sınıfında: + +- Üç yıllık modelin tüm bölümlerde aynı uygulanmayacağı; mühendislik ve mimarlıkta Avrupa'daki gibi "3+2" (üç yıl lisans, iki yıl ek eğitim) akla getirildiği. +- Diş hekimliği ve eczacılık öğrencilerine, belirli koşulları sağlarlarsa mühendislikte çift ana dal imkânı verilmesi ve bunun 2027-2028 öğretim yılına yetiştirilmesi hedefi. Çift anadal haberi YÖK sitesinde 14 Kasım 2026 tarihli; fakat sayfada başvuru koşulu, süre ya da kontenjan yok. +- Meslek yüksekokullarında dört yarıyıldan en az birinin işletmede geçirilmesi; ilk aşamada Ankara, Bursa, Gaziantep, İstanbul, İzmir, Kocaeli ve Konya'da. Bunun lisansla doğrudan ilgisi yok; ön lisans için bkz. [ön lisans mı lisans mı](/rehber/onlisans-mi-lisans-mi). + +Tıp, hukuk, öğretmenlik gibi alanlar için resmî bir söz bulamadık; tahmin yazmıyoruz. + +## Şu an okuyan ya da 2027'de yerleşecek öğrenciyi etkiler mi? + +**Açıklanmadı.** Haberlerden biri, düzenleme yürürlüğe girene kadar mevcut programların süresi ve mezuniyet koşullarının geçerli olduğunu yazıyor; bu bir YÖK metni değil, haberin kendi cümlesi, ama mantıksal olarak da yürürlükte olan bir mevzuatın kendiliğinden değişmediğini hatırlatıyor. Kimin kapsanacağı (yeni kayıt, mevcut öğrenci, isteyen öğrenci), hangi yıl başlayacağı ve ücret, burs ve KYK süresine nasıl yansıyacağı hakkında resmî söz yok. 2027 YKS ve yerleştirme takvimi bu tartışmadan bağımsız; takvim için [2027 YKS takvimi](/rehber/yks-2027-takvimi). + +## Tercih kararını bugün buna göre değiştirmeli miyim? + +Hayır. Bir bölümü "üç yıla inecek" ya da "inmeyecek" varsayımıyla seçmek için elimizde resmî bir dayanak yok. Bölüm, şehir ve üniversite kararını bugün geçerli olan süre ve koşullarla ver; değişirse değişikliğin kime uygulanacağı da o gün yazılacak. + +```mermaid +%% aria: Haberde gördüğün bir iddianın kesin olup olmadığını anlamak için karar şeması. Başlangıç sorusu, iddianın yok.gov.tr, Resmî Gazete ya da ÖSYM gibi birincil bir kaynakta olup olmadığıdır. Hayırsa kutu kırmızı ve "KESİN DEĞİL, haber ya da yorum" etiketlidir. Evetse ikinci soru sorulur: kaynak yürürlüğe girmiş bir karar mı, yoksa bir söz ya da çalışma mı? Söz ya da çalışmaysa kutu sarı ve "ÇALIŞMA, kesin değil" etiketlidir. Yürürlüğe girmiş bir karar ise üçüncü soru sorulur: kimi kapsadığı ve hangi tarihte başladığı yazıyor mu? Yazıyorsa kutu yeşil ve "KESİN" etiketlidir; yazmıyorsa sarı ve "KISMEN KESİN, ayrıntı eksik" etiketlidir. Üç sonuçta da yapılacak iş aynıdır: bölüm kararını bugün geçerli mevzuatla ver ve resmî kaynağı takip et. +%% altyazi: Bir iddia ancak resmî kaynakta, yürürlükte olan bir karar olarak, kapsamı ve tarihi yazılıysa kesindir; 20 Kasım 2026 itibarıyla üç yıllık lisans bu sınıfta değil. +flowchart TD + A{"İddia yok.gov.tr, Resmî Gazete
ya da ÖSYM'de var mı?"} + A -- "Hayır" --> B("KESİN DEĞİL
Haber ya da yorum") + A -- "Evet" --> C{"Yürürlüğe girmiş bir karar mı,
söz ya da çalışma mı?"} + C -- "Söz ya da çalışma" --> D("ÇALIŞMA, kesin değil") + C -- "Yürürlükte karar" --> E{"Kimi kapsadığı ve
başlangıç tarihi yazıyor mu?"} + E -- "Evet" --> F("KESİN") + E -- "Hayır" --> G("KISMEN KESİN
Ayrıntı eksik") + B --> H("Bölüm kararını bugünkü mevzuatla ver,
resmî kaynağı takip et") + D --> H + F --> H + G --> H + + classDef risk fill:#fee2e2,stroke:#ef4444,color:#991b1b + classDef uyari fill:#fef3c7,stroke:#f59e0b,color:#92400e + classDef garanti fill:#d1fae5,stroke:#10b981,color:#065f46 + class B risk + class D,G uyari + class F garanti +``` + +Şemanın sözel karşılığı: kaynak resmî değilse iddia kesin değildir; resmî ama söz ya da çalışma düzeyindeyse yine kesin değildir; yalnızca yürürlükteki, kapsamı ve tarihi yazılı karar kesindir. Bugünkü üç yıllık lisans haberleri ilk iki gruptadır. + +Neyi takip etmeli: YÖK'ün [haberler](https://www.yok.gov.tr/tr/news) sayfası, [Resmî Gazete](https://www.resmigazete.gov.tr/) ve (yasa değişikliği gerekirse) TBMM gündemi. Bölüm kararının diğer boyutları için [bölüm mü, üniversite mi, şehir mi](/rehber/bolum-mu-universite-mi-sehir-mi), süre kısalmasa bile okul bitirmeyi etkileyen seçenekler için [yatay geçiş, ÇAP ve yandal](/rehber/yatay-gecis-cap-yandal), [hazırlık sınıfı ve öğretim dili](/rehber/hazirlik-sinifi-ve-ogretim-dili) ve ön lisanstan lisansa geçiş için [DGS ile lisans tamamlama](/rehber/dgs-ile-lisans-tamamlama) yazılarına bak. Aynı yaklaşımla yazılmış bir başka "ne kesin, ne değil" yazısı: [Maarif Modeli YKS'yi ne zaman değiştirecek](/rehber/maarif-modeli-yks-ne-zaman-degisecek). + +## Üç yıllık lisans başka ülkelerde nasıl işliyor? + +YÖK'ün Eylül 2025 tarihli resmî haberindeki ifadeyle "Avrupa'nın pek çok ülkesinde öğrenciler 180 AKTS ile mezun olabilmektedir". Bir öğretim yılı 60 AKTS sayıldığı için 180 AKTS üç yıla, 240 AKTS dört yıla karşılık gelir. Üç yıllık lisansın ardından iki yıllık yüksek lisansı içeren "3+2" yapısı için Özvar'ın mühendislik ve mimarlığı örnek verdiği haberlerde aktarılıyor. Ülke ülke karşılaştırmayı bu yazıda vermiyoruz. + +| Model | AKTS | Süre | Türkiye'de durum | +|---|---|---|---| +| Bugünkü lisans | En az 240 (YÖK, 10 Aralık 2025) | Dört yıl | Yürürlükte | +| Üç yıllık lisans (Avrupa'da birçok ülkede) | 180 | Üç yıl | Haberlere göre çalışma; karar yok | +| 3+2 (lisans + yüksek lisans) | 180 + yüksek lisans | Beş yıl | Mühendislik ve mimarlık için haberlerde örnek olarak geçti; karar yok | +| Dört yıllık program, yoğun takvimle üç yılda | 240 korunur (Aralık 2025 aktarımı) | Üç yıl | Haberlere göre; sonradan 180 kredi ifadesi çıktı | + +## Sık sorulan sorular + +**Lisans eğitimi 3 yıla düştü mü?** +Hayır. 20 Kasım 2026 itibarıyla yürürlükte böyle bir düzenleme bulamadık; YÖK Başkanı bir çalışmadan söz ediyor. + +**2027'de üniversiteye girersem üç yılda mezun olur muyum?** +Açıklanmadı. Kimin kapsanacağı ve başlangıç yılı resmî bir kaynakta yazılı değil. + +**Hangi bölümler üç yıla inecek?** +Açıklanmadı. Haberlerde mühendislik ve mimarlık için "3+2" örneği geçti; liste yok. + +**240 AKTS mi, 180 AKTS mi?** +Bugün lisans için en az 240 AKTS var (YÖK, 10 Aralık 2025). Aralık 2025'te 240'ın korunacağı, Kasım 2026'da ise 180 kredinin konuşulduğu aktarıldı; hangisi uygulanacak, bilinmiyor. + +**Tercih listemi buna göre değiştirmeli miyim?** +Hayır; kesinleşmemiş bir çalışmaya göre bölüm seçilmez. Sıralamanla ulaşabildiğin programlara bak ve [tercih listesi nasıl yapılır](/rehber/tercih-listesi-nasil-yapilir) yazısındaki iskeletle ilerle. + +## Kaynaklar + +Resmî sayfalara 20 Kasım 2026'da erişildi. Haber siteleri yalnızca birincil kaynağı bulamadığımız satırlarda ve "habere göre" etiketiyle kullanıldı. + +- YÖK, [Türk Yükseköğretiminin 2030 Yol Haritası](https://www.yok.gov.tr/tr/news/yuksekogretim-kurulu-baskani-ozvar-turk-yuksekogretiminin-2030-yol-haritasini-acikladi-2FZJS) (2 Eylül 2025, 2 Ekim 2025'te güncellendi): üç yılda mezuniyet imkânı, 240 AKTS'nin gözden geçirilmesi. +- YÖK, [Lisans eğitiminin 3 yıla indirilecek olmasından veliler ve öğrenciler memnun](https://www.yok.gov.tr/tr/news/lisans-egitiminin-3-yila-indirilecek-olmasindan-veliler-ve-ogrenciler-memnun-zBMLK) (21 Ekim 2025): isteyen ve başarılı öğrenciler için çalışma, yasa ve tarih yok. +- YÖK, [Özvar: isteyen ve başarılı olan öğrencilerin üniversiteyi 3 yılda bitirebilmelerine imkân sağlayacak düzenleme önümüzdeki yıldan itibaren hayata geçirilecek](https://www.yok.gov.tr/tr/news/yuksekogretim-kurulu-baskani-ozvar-isteyen-ve-basarili-olan-ogrencilerin-universiteyi-3-yilda-bitirebilmelerine-imkan-saglayacak-duzenleme-onumuzdeki-yildan-itibaren-hayata-gecirilecek-Nt9cv) (17 Kasım 2025). +- YÖK, [Özvar'dan rektörlere müfredat ve AKTS mesajı](https://www.yok.gov.tr/tr/news/yuksekogretim-kurulu-baskani-ozvardan-rektorlere-mufredat-ve-akts-mesaji-QbN2s) (10 Aralık 2025): lisansta en az 240 AKTS. +- YÖK, [Çift anadal ile sağlıkta yerli teknoloji ve ilaç geliştirmeye yeni güç](https://www.yok.gov.tr/tr/news/cift-anadal-ile-saglikta-yerli-teknoloji-ve-ilac-gelistirmeye-yeni-guc-5aq3d) (14 Kasım 2026): 3 yıl ya da 180 kredi geçmiyor. +- YÖK, [Haberler](https://www.yok.gov.tr/tr/news): 20 Kasım 2026'ya kadarki başlıklarda üç yıllık lisans ya da 180 kredi duyurusu yok. +- Bianet, [YÖK, 4 yıllık lisans eğitimini 3 yıla düşürmek istiyor](https://bianet.org/haber/yok-4-yillik-lisans-egitimini-3-yila-dusurmek-istiyor-314757) (21 Aralık 2025): CNN Türk yayınının aktarımı; 240 AKTS korunur, sekiz yarıyıl, 2026-2027 ya da sonrası. +- Milli Gazete, [Üniversitelerde eğitim 3 yıla mı düşecek? YÖK Başkanı Özvar açıkladı](https://www.milligazete.com.tr/universitelerde-egitim-3-yila-mi-dusecek-yok-baskani-ozvar-acikladi) (7 Kasım 2026): CNN Türk yayınının aktarımı; 180 kredi, 60 ders, 3+2, çift anadal. +- Yeni Asır, [Üniversite eğitimi kısalacak mı?](https://www.yeniasir.com.tr/yasam/2026/11/07/universite-egitimi-kisalacak-mi-lisans-egitim-suresi-kisalacak-mi-yok-baskani-ozvar-acikladi) (7 Kasım 2026): ders sayılarının gelecek yıldan itibaren azaltılacağı, çift anadal hedefi, işletmede mesleki eğitim. +- Mevzuat Bilgi Sistemi, [2547 sayılı Yükseköğretim Kanunu](https://www.mevzuat.gov.tr/mevzuatmetin/1.5.2547.pdf): madde 3/s (lisans tanımı, en az sekiz yarıyıl), madde 44 (azami süreler). diff --git a/content/rehber/ozel-ogrenci-nedir-baska-universitede-okumak.md b/content/rehber/ozel-ogrenci-nedir-baska-universitede-okumak.md new file mode 100644 index 0000000..e0343d0 --- /dev/null +++ b/content/rehber/ozel-ogrenci-nedir-baska-universitede-okumak.md @@ -0,0 +1,97 @@ +--- +baslik: Özel Öğrenci Nedir? Kendi Üniversitende Kayıtlıyken Başka Üniversitede Okumak +aciklama: Özel öğrencilik, kaydın kendi üniversitende kalıp dersleri başka bir üniversitede almandır. Yönetmeliğin 22. maddesine göre en fazla iki dönem, ücret nereye ödenir, dersler nasıl sayılır, deprem bölgesi üniversiteleri için 2026-2027 haberi ve yatay geçişle farkı. +tarih: 2026-11-20 +niyet: 1 +konu: sonrasi +cta_baslik: Başka bir yol düşünüyorsan sıralamana yakın programlara bak +cta_aciklama: Yatay geçiş, Ek Madde-1 ya da yeniden tercih arasında kaldıysan, YKS başarı sıralamanla hayal, dengeli ve güvenli dilimlerdeki programlara bakabilirsin. Ücretsiz, üyelik gerekmez. +--- + +**Kısa cevap:** Özel öğrencilik, kaydın ve diplomanın **kendi üniversitende kaldığı**, ama sağlık ya da benzeri özel bir durum yüzünden (ya da farklı bir ortam görmek için) bir süre başka bir üniversitede ders aldığın düzenlemedir. Dayanağı, geçiş yönetmeliğinin 22. maddesidir: bir program boyunca **en fazla iki dönem** yararlanılır, öğrenim ücreti ya da katkı payı **kayıtlı olduğun üniversiteye** ödenir, aldığın dersler ilgili yönetim kurulunun kararıyla programındaki yükümlülüklerin yerine sayılabilir ve bu süre öğrenim süresine dâhildir. Yatay geçiş değildir: üniversiteni değiştirmezsin. "Şehri sevmedim" ya da "yatay geçişe notum yetmiyor" gerekçesinin tek başına kabul göreceğini yazamayız; karar iki üniversitenin kendi kurullarındadır ve burada gösterilen resmî metin dışındaki ayrıntılar üniversiteden üniversiteye değişir. + +Bu yazının kural kısmı tek bir metne dayanıyor: "Yükseköğretim Kurumlarında Önlisans ve Lisans Düzeyindeki Programlar Arasında Geçiş, Çift Anadal, Yan Dal ile Kurumlar Arası Kredi Transferi Yapılması Esaslarına İlişkin Yönetmelik" (md. 4/r ve md. 22). Deprem bölgesi kısmı ise YÖK'ün duyurusunu aktaran haberlere dayanıyor; ayrımı ilgili bölümde ayrıca belirttik. + +```mermaid +%% aria: Özel öğrenci mi, başka yol mu karar şeması. Başlangıç sorusu şudur: kaydın kendi üniversitende kalsın, diploman oradan çıksın ister misin. Evet ise ikinci soru, özel öğrencilik için sağlık ya da benzeri özel bir durumun olup olmadığıdır. Varsa yol, iki üniversitenin ilgili kurullarına başvuru yapmaktır; en fazla iki dönem yararlanılır ve karar üniversitelerdedir. Özel bir durum yoksa ve yalnızca farklı ortam görmek istiyorsan yine tanım buna izin verir ama kabul üniversitelerin kendi esaslarına bağlıdır. Kaydın kendi üniversitende kalsın istemiyorsan sorulacak şey, programı mı değiştirmek istediğindir. Aynı ya da eşdeğer programa geçmek istiyorsan kurumlar arası yatay geçiş yolu vardır, puanın hedef programın tabanına yetiyorsa Ek Madde-1 yolu vardır, ikisi de olmuyorsa yeniden YKS yolu vardır. Şemadaki renkler tek başına anlam taşımaz; her kutunun başında büyük harfli bir etiket vardır. +%% altyazi: Özel öğrencilik üniversite değiştirmek değildir; kaydın kalır, karar iki üniversitenin kurullarındadır. +flowchart TD + A("Kaydın kendi üniversitende
kalsın, diploman oradan mı çıksın?") --> B{"Kaydın kalsın mı?"} + B -- "evet" --> C{"Sağlık ya da benzeri
özel bir durum var mı?"} + C -- "evet" --> D("ÖZEL ÖĞRENCİ
iki üniversitenin kurullarına başvuru,
en fazla iki dönem") + C -- "hayır, farklı ortam istiyorum" --> E("KOŞULLU
tanım buna izin veriyor,
kabul üniversitelerin esaslarına bağlı") + B -- "hayır, program değişsin" --> F{"Hangi yol sana uyuyor?"} + F --> G("YATAY GEÇİŞ
eşdeğer program, ortalama şartı,
kontenjan") + F --> H("EK MADDE-1
puanın hedefin tabanına yetiyorsa") + F --> I("YENİDEN YKS
sınava girip yeniden yerleşme") + + classDef hayal fill:#fee2e2,stroke:#ef4444,color:#991b1b + classDef uyari fill:#fef3c7,stroke:#f59e0b,color:#92400e + classDef garanti fill:#d1fae5,stroke:#10b981,color:#065f46 + class E uyari + class A,B,C,F uyari + class D,G,H,I garanti +``` + +## Özel öğrencilik nedir, yatay geçişten farkı ne? + +Yönetmeliğin tanım maddesi (md. 4/r) özel öğrenciyi, bir yükseköğretim kurumunda kayıtlı olup farklı bir yükseköğretim ortamı, kültürü ya da kazanımı edinmek isteyen ya da sağlık gibi özel bir durumu bulunan ve **kayıtları kendi üniversitelerinde kalmak şartıyla** başka bir kurumda eğitim alan öğrenci olarak anlatıyor. Aşağıdaki cümleler madde metninin özetidir; tam metin kaynaklardaki bağlantıda. + +Fark tek cümle: **yatay geçişte kaydın yeni üniversiteye taşınır, özel öğrencilikte kalır.** Diplomayı yine kendi üniversiten verir; ders aldığın üniversite sana diploma vermez. Yatay geçişin şartlarını [kurumlar arası yatay geçiş](/rehber/kurumlar-arasi-yatay-gecis-not-ortalamasi-ile) yazısında anlattık. + +## Kimler başvurabilir, hangi gerekçeler kabul edilir? + +Yönetmelik iki çerçeve çiziyor: farklı bir yükseköğretim ortamı edinmek ya da sağlık gibi özel bir durum. Hangi belgenin, hangi gerekçenin yeterli sayılacağı, **her üniversitenin senatosunun belirlediği esaslarda** yazılıdır. Bu esaslar üniversiteden üniversiteye değiştiği için "şu gerekçe kabul edilir, şu edilmez" diye liste vermiyoruz. Kendi üniversitenin öğrenci işleri sayfasında "özel öğrenci" ya da "özel öğrencilik yönergesi" diye ara. + +İki sınır yönetmelikte açık: Türkçe programdaki öğrenci yabancı dilde öğretim yapan bir programdan ders alacaksa **yeterli yabancı dil düzeyini belgelemek** zorunda (md. 22/6). Yurt dışındaki bir yükseköğretim kurumunda okuyan Türk vatandaşları da özel öğrencilikten en fazla iki dönem yararlanabilir (md. 22/8). + +## Başvuru nasıl yapılır, kim karar verir, ne kadar sürer? + +Başvuru adımlarını (hangi tarihte, hangi form) her üniversite kendisi ilan eder. Yönetmelikten çıkan şudur: + +- **Süre:** Bir program boyunca özel öğrencilikten **en fazla iki dönem** yararlanılır (md. 22/7). +- **Uzatma:** Bu süre yalnız YÖK kararıyla uzatılabilir ve yönetmelik iki durum sayıyor: okuduğun ilde tedavisi mümkün olmayan ciddi bir hastalık (devlet hastanesi ya da devlet üniversitesi hastanesinin sağlık kurulu raporuyla), ya da darp, şiddet gibi fiiller yüzünden kayıtlı olduğun kurumda öğrenime devam edememe. İkinci durumda üniversite yönetim kurulunun teklifi gerekir. +- **Karar mercii:** Aldığın derslerin kayıtlı olduğun programda sayılması ilgili yönetim kurulu kararıyla olur (md. 22/1). Başvurunun iki üniversitede de nasıl onaylandığı üniversitenin esaslarına bağlı; bunu kendi okulunun sayfasından teyit et. + +Kabul garantisi yoktur; başvuru bir talep, karar kurulların. + +## Ücreti ya da katkı payını hangi üniversiteye ödersin? + +Yönetmelik net: öğrenim ücreti ya da katkı payı **kayıtlı olduğun kuruma** ödenir (md. 22/4). Vakıf üniversitelerinde ödenen ücretin **yüzde 80'i** özel öğrenci olunan kuruma aktarılır; yani ödemeyi yine kendi kurumuna yaparsın, paylaşım iki kurum arasında olur. Yaz okulu ayrı: özel öğrenci olarak yaz okuluna katılan, ücreti **dersi aldığı kuruma** öder (md. 22/5). + +Devletten vakfa ya da vakıftan devlete özel öğrencilik yapılıp yapılamayacağı, yönetmeliğin bu maddesinde ayrıca yasaklanmış ya da açıkça izin verilmiş olarak görünmüyor; ödeme hükmü vakıf üniversitesini anıyor. Pratikte bu, kabul eden kurumun esasına kalıyor; yazmadan önce iki kurumdan da teyit et. + +## Aldığın dersler ve notlar nasıl sayılır, mezuniyeti uzatır mı? + +Özel öğrenci olarak ya da değişim programında aldığın ders ve uygulama kredileri, ilgili yönetim kurulunun kararıyla kayıtlı olduğun diploma programındaki yükümlülüklerin yerine **sayılabilir** (md. 22/1); sayılması otomatik değil, karar gerektiriyor. Özel öğrencilikte geçirdiğin süre **öğretim süresine dâhil edilir** (md. 22/2): bu dönemler "ara verme" sayılmaz, normal öğrenim süreni tüketir. Derslerin sayılmaması, tekrar almak zorunda kalman ve mezuniyetinin uzaması demektir. Bu yüzden almadan önce hangi dersin hangisine karşılık sayılacağını bölümünden yazılı sor. Muafiyet mantığı için [üniversitede ilk hafta](/rehber/universitede-ilk-hafta-ders-kaydi-muafiyet-kayit-dondurma) yazısına bak. + +## Deprem bölgesi üniversitelerindeki öğrenciler için hak 2026-2027'de sürüyor mu? + +**Haberlere göre evet.** YÖK'ün, 6 Şubat 2023 depremleri nedeniyle özel öğrenci olarak okuyan öğrencilerin işlemlerinin 2026-2027 öğretim yılında da sürdürüleceğini açıkladığı, YÖK Başkanı Erol Özvar'ın da bunu duyurduğu haberleştirildi (haberler 29-30 Temmuz 2026 tarihli). Haberlere göre kapsam Adıyaman, Hatay, Kahramanmaraş ve Malatya'daki yedi üniversitedir: Adıyaman Üniversitesi, İskenderun Teknik Üniversitesi, Hatay Mustafa Kemal Üniversitesi, İnönü Üniversitesi, Malatya Turgut Özal Üniversitesi, Kahramanmaraş İstiklal Üniversitesi ve Kahramanmaraş Sütçü İmam Üniversitesi. Öğrencinin, okumak istediği devlet üniversitesine dönem başlamadan başvurması gerektiği ve kabul edilen programın kayıtlı olunan programla eşdeğer, öğretim dilinin aynı olması gerektiği aktarılıyor. + +Bu bölümü **yok.gov.tr'deki resmî duyurudan değil, haber sitelerinden** aldık; resmî sayfaya ulaşıp doğrulayamadık. Belge, takvim ve kontenjan ayrıntısı haberlerde yok; bu bölgede kayıtlıysan senin için geçerli olan kendi üniversitenin duyurusu ve YÖK'ün resmî yazısıdır. + +## Özel öğrenci mi, yatay geçiş mi, Ek Madde-1 mi, yeniden YKS mi? + +| Yol | Kayıt nerede kalır | Şart | Süre | Diploma | +| --- | --- | --- | --- | --- | +| **Özel öğrenci** | Kendi üniversitende | Tanımdaki gerekçe (farklı ortam ya da sağlık gibi özel durum); kurulların kararı | Programın boyunca en fazla iki dönem (md. 22/7) | Kendi üniversiten verir | +| **Kurumlar arası yatay geçiş** | Yeni üniversiteye taşınır | Eşdeğer program, ortalama en az 60 ya da puanın hedefin tabanına yetmesi, kontenjan | Lisansta güz öncesi tek ilan dönemi | Yeni üniversiten verir | +| **Ek Madde-1** | Yeni programa taşınır | Kayıt yılındaki puanın hedefin o yılki tabanına yetmesi | Güz için Ağustos'ta; hak bir kez | Yeni program verir | +| **Yeniden YKS** | Yeni yerleştiğin programa | Sınava girip yeniden yerleşmek | ÖSYM takvimiyle, yılda bir | Yeni program verir | + +Yatay geçişin, Ek Madde-1'in ve yeniden sınavın ayrıntıları için [bölümümü sevmedim](/rehber/bolumumu-sevmedim-hangi-kapilar-var), [yatay geçiş, ÇAP ve yandal](/rehber/yatay-gecis-cap-yandal), [Ek Madde-1](/rehber/ek-madde-1-puanim-yetiyor-mu) ve [üniversite okurken tekrar YKS](/rehber/universite-okurken-tekrar-yks) yazılarına bak. Öğrenci affıyla dönenlere tanınan yol için [öğrenci affı yazısı](/rehber/ogrenci-affi-2026-universiteye-donus) var. + +Bir ayrım: "şehri sevmedim" ya da "yatay geçişe notum yetmiyor" yalnız başına özel öğrencilik gerekçesi olarak yazılamaz; yönetmeliğin tanımı farklı bir ortamı da sayıyor ama kabul üniversitelerin takdirinde. Geçici bir çıkış olarak değil, kararın bir parçası olarak düşün. + +## KYK bursu ve yurdu özel öğrencilikte ne olur? + +Sitemizdeki [KYK burs mu, kredi mi?](/rehber/kyk-burs-mu-kredi-mi) yazısı, burs ve kredinin yalnızca örgün öğretim öğrencilerine verildiğini ve özel öğrencilerin kapsam dışı olduğunu aktarıyor; o yazının kaynaklarına bak. Bunun kendi üniversitende kayıtlı olan özel öğrenci için bu dönemde bursunun kesilip kesilmeyeceği anlamına geldiğini **resmî metinden teyit edemedik**, yurt hakkı konusunda da teyitli bilgimiz yok. Karar vermeden önce KYK'ya (kyk.gsb.gov.tr) ve iki üniversitenin öğrenci işlerine sor. + +## Kaynaklar + +Bilgiler 20 Kasım 2026'da kontrol edildi. + +- Mevzuat Bilgi Sistemi, [Yükseköğretim Kurumlarında Önlisans ve Lisans Düzeyindeki Programlar Arasında Geçiş, Çift Anadal, Yan Dal ile Kurumlar Arası Kredi Transferi Yapılması Esaslarına İlişkin Yönetmelik](https://www.mevzuat.gov.tr/mevzuat?MevzuatNo=13948&MevzuatTur=7&MevzuatTertip=5) (RG 24.04.2010, sayı 27561): md. 4/r (özel öğrenci tanımı), md. 22 (değişim programları ve özel öğrenci olarak ders alma: ders sayılması, süre, ücret, yaz okulu, yabancı dil, en fazla iki dönem) +- Deprem bölgesi haberleri (YÖK duyurusunu aktarıyor, resmî sayfa açılmadı): [Cumhuriyet](https://www.cumhuriyet.com.tr/turkiye/deprem-bolgesinde-ozel-ogrencilik-uygulamasi-gelecek-yil-da-devam-edecek-2524811), [Haber7](https://www.haber7.com/egitim/haber/3647225-deprem-bolgesinde-ozel-ogrencilik-uygulamasi-devam-edecek), [Memurlar.net](https://www.memurlar.net/haber/1174081/yok-ten-yeni-karar-7-universitede-ozel-ogrencilik-uygulamasi-surecek.html) +- KolayTercih, [KYK burs mu, kredi mi?](/rehber/kyk-burs-mu-kredi-mi): özel öğrencinin burs/kredi kapsamı dışında olduğu ifadesi diff --git a/content/rehber/tip-fakultesi-kac-siralama-ile-girilir.md b/content/rehber/tip-fakultesi-kac-siralama-ile-girilir.md new file mode 100644 index 0000000..9bc855e --- /dev/null +++ b/content/rehber/tip-fakultesi-kac-siralama-ile-girilir.md @@ -0,0 +1,123 @@ +--- +baslik: Tıp Fakültesine Kaç Sıralamayla Girilir? 2026 Şartı ve Devlet, Vakıf, KKTC Taban Aralıkları +aciklama: Tıp için YÖK başarı sıralaması şartı SAY ilk 50 bin; 2026 yerleştirmesinde devlet, vakıf (burslu, indirimli, ücretli) ve KKTC tıp programlarının taban sıralamaları hangi aralıkta, Türkçe ile İngilizce farkı, 6 yıl ve TUS, sıralaman şartın altındaysa komşu bölümler. +tarih: 2026-11-25 +niyet: 3 +konu: siralama +cta_baslik: Sıralamanla tıp programlarını hayal, dengeli ve güvenli dilimlerde gör +cta_aciklama: SAY sıralamanı gir; tıp ve komşu sağlık programlarını hayal, dengeli ve güvenli dilimleriyle yan yana gör. Ücretsiz, üyelik gerekmez. +--- + +**Kısa cevap:** Tıp programlarını tercih edebilmek için SAY puan türünde **en düşük 50 bininci** başarı sırasına sahip olman gerekir; bu, 2026 YKS kılavuzundaki şarttır ve yalnızca kapıyı açar. Asıl soru taban sıralamasıdır: 2026 yerleştirmesinde (YÖK Atlas verimiz, tabanı veri olan 219 tıp programı) **devlet Türkçe programlarının yarısı yaklaşık 16 bin ve daha iyi sıralamayla doldu, en geniş uç yaklaşık 32,6 bindi**; vakıf burslu programlarda yarısı yaklaşık 9,5 bin ve daha iyi sıralamayla, vakıf ücretli programlarda ise yarısı yaklaşık 39 bin ve daha iyi sıralamayla doldu. Yani "50 bin" şart, tabanın kendisi değil: sıralaman 45 bin ise şartı geçersin ama devlet tıp programlarının çoğu bunun çok üstünde kapanmış durumda, aralığa bakmak gerekir. Bu rakamlar **2026 yerleştirmesinin gerçekleşmiş sonuçlarıdır**; 2027'de aynı tablonun yinelenmesi için bir söz değil, bir referanstır. Yerleşme garantisi ya da olasılığı vermiyoruz. + +Şartın kendisi (tıp, hukuk, mühendislik vb. tüm eşikler) [başarı sıralaması şartları](/rehber/siralama-sartlari-2026) yazısında tek tabloda; burada tekrar etmiyoruz, yalnızca tıpa odaklanıyoruz. + +```mermaid +%% aria: Tıp için sıralama karar şeması. İlk soru, SAY başarı sıralamanın ilk 50 bin içinde olup olmadığıdır. Değilse tıp programlarını listeye yazamazsın; komşu bölümlerin şartlarına bak, ya da mezuna kalmayı düşün. İlk 50 bin içindeysen ikinci soru, sıralamanın hangi taban bandına denk geldiğidir. İlk birkaç bin içindeyse devlet ve vakıf burslu programların üst kısmı da listene girebilir. Yaklaşık on binle yirmi beş bin arasındaysa devlet programlarının orta bandı, vakıf burslu ve indirimli programlar ve KKTC programları listene yakındır. Yaklaşık otuz binle elli bin arasındaysa devlet tabanları çoğunlukla geride kalır; vakıf indirimli ve ücretli programlar, İngilizce programlar ve KKTC programları yakın bandadır ve bunların ücreti ve hazırlık sınıfı maliyeti hesaba katılmalıdır. Şemadaki renkler tek başına anlam taşımaz; her kutuda metin etiketi vardır. Hiçbir kutu yerleşeceğin anlamına gelmez. +%% altyazi: Sıralaman şartı geçiyorsa bile hangi bantta olduğuna bak; şart kapıyı açar, taban sana hangi programların yakın olduğunu gösterir. +flowchart TD + A{"SAY başarı sıralaman
ilk 50 bin içinde mi?"} -- "hayır" --> B("ŞART YOK: tıp programlarını
listeye yazamazsın.
Komşu bölümlere ya da
mezuna kalmaya bak") + A -- "evet" --> C{"Sıralaman hangi bantta?"} + C -- "ilk birkaç bin" --> D("YAKIN: devlet ve vakıf burslu
programların üst kısmı") + C -- "yaklaşık 10 bin - 25 bin" --> E("YAKIN: devlet orta bant,
vakıf burslu ve indirimli,
KKTC programları") + C -- "yaklaşık 30 bin - 50 bin" --> F("DİKKAT: devlet tabanları çoğunlukla
geride; vakıf indirimli, ücretli
ve İngilizce programlar yakın.
Ücret ve hazırlığı hesapla") + + classDef hayal fill:#fee2e2,stroke:#ef4444,color:#991b1b + classDef uyari fill:#fef3c7,stroke:#f59e0b,color:#92400e + classDef garanti fill:#d1fae5,stroke:#10b981,color:#065f46 + class B hayal + class D,E,F uyari +``` + +## Tıp için YÖK başarı sıralaması şartı nedir? + +2026 YKS kılavuzundaki "Tablo 1G" tıp programlarına yerleştirme için **SAY puan türünde en düşük 50 bininci (50.000)** başarı sırasını arıyor. Aynı tabloda hukuk, mimarlık, mühendislik, öğretmenlik, eczacılık (100 bin) ve diş hekimliği (80 bin) de var; ayrıntısı [başarı sıralaması şartları](/rehber/siralama-sartlari-2026) yazısında. + +İki not daha kılavuzdan: + +- **Vakıf üniversiteleri daha sıkı şart koyabilir.** Tablonun dipnotu, vakıf yükseköğretim kurumlarının senato kararıyla söz konusu başarı sırasına göre **daha üstte bir başarı sırası** belirleyebileceğini söylüyor. Bir vakıf tıp programı için 50 bin yetmeyebilir; programın kendi koşulunu ÖSYM kılavuzundaki program satırından ve üniversitenin sayfasından doğrula. +- **Şart tabanı garanti etmez.** Şartı geçmek tercih hakkıdır; yerleşme programın o yıl doluşuna bağlı. + +YÖK Atlas kayıtlarımızda da 2026 tıp programlarının hemen hepsinde asgari başarı sırası alanı 50.000 görünüyor (KKTC dâhil); bu, kılavuz tablosunu destekliyor ama kaynağımız kılavuzun kendisi. + +2027 için kılavuz tercih döneminde yayımlanır; ÖSYM'nin 28 Ekim 2026'daki takvimi yalnızca sınav tarihlerini kapsıyor, tercih tarihi ve yeni kılavuz **açıklanmadı** ([2027 YKS takvimi](/rehber/yks-2027-takvimi)). Eşikleri kılavuz çıkınca yeniden kontrol et. + +## 2026'da tıp programlarının taban sıralamaları hangi aralıktaydı? + +Rakamlar YÖK Atlas'tan derlediğimiz **2026 yerleştirme tabanlarıdır** (her programa yerleşen son adayın başarı sırası). Üniversite adıyla uzun liste vermedik; dağılımı grup grup gösterdik. "Dörtte biri" o gruptaki programların %25'inin bu sıranın ya da daha iyisinin içinde kapandığını, "dörtte üçü" %75'inin bu sıraya kadar kapandığını söyler. Yerleşen sayısı 5'ten az olan çok küçük kontenjanlar ve ortak (UOLP) programlar rakamı çarpıtmasın diye tabloya alınmadı. + +| Grup | Program sayısı | En seçici uç | Dörtte biri | Medyan | Dörtte üçü | En az seçici uç | +| --- | --- | --- | --- | --- | --- | --- | +| **Devlet, Türkçe** | 89 | 2.067 | 11.789 | 16.004 | 19.806 | 32.602 | +| **Devlet, İngilizce** | 15 | 728 | 2.600 | 7.428 | 18.570 | 19.061 | +| **Vakıf, burslu** | 46 | 65 | 5.833 | 9.487 | 14.307 | 18.779 | +| **Vakıf, %25 / %50 indirimli** | 41 | 1.361 | 26.443 | 31.072 | 36.711 | 42.762 | +| **Vakıf, ücretli** | 19 | 27 | 31.193 | 39.173 | 43.902 | 49.111 | +| **KKTC (tüm programlar)** | 9 | 17.098 | 21.775 | 22.202 | 36.420 | 40.963 | + +Tabloyu okurken: + +- **Devlet Türkçe tıp programları** en kalabalık grup ve dar bir bantta toplanıyor: yarısı 16 bin civarına kadar kapandı. 30 bin üstü yalnızca iki programda görüldü. +- **Vakıf burslu** programlar üst bantta: yarısı yaklaşık 9,5 bin ve daha iyi sıralamada. Çok düşük sıra numaralı (65, 27 gibi) satırlar küçük kontenjanlı programlardır; sıralamanı bununla kıyaslama. +- **Vakıf indirimli ve ücretli** programlarda tabanlar 30-50 bin bandına yayılıyor; **şart 50 bin olduğu için en uç satır 49.111'de** duruyor. Sıralaman 40 bin civarındaysa devlet programlarının büyük çoğunluğu geride kalmış olur, ama vakıf ücretli programlar bu bandı kapsar: bu, ücreti de hesaba katman gereken bir yoldur ([vakıf burslu, indirimli, ücretli farkı](/rehber/vakif-universitesi-burslu-indirimli-ucretli-farki), [devlet mi vakıf mı](/rehber/devlet-mi-vakif-mi)). +- **KKTC** tarafında yalnızca 9 program var; tabanları 17 bin ile 41 bin arasında. Denklik ve ücret konularını [KKTC üniversiteleri okunur mu](/rehber/kktc-universiteleri-okunur-mu) yazısında anlattık. + +Bunlar 2026 yerleştirmesinin dağılımı; 2027'nin tabanı kontenjan, aday sayısı ve tercih davranışına göre değişir. Tablo, sıralamanın hangi bantlarda hangi tür programa yakın olduğunu gösterir, "buraya girersin" demez. + +## Türkçe ve İngilizce tıp arasındaki fark ne? + +Aynı yılın verisinde dil farkı belirgindi: + +| Grup (2026) | Program sayısı | En seçici | Medyan | En az seçici | +| --- | --- | --- | --- | --- | +| Devlet, Türkçe | 89 | 2.067 | 16.004 | 32.602 | +| Devlet, İngilizce (İngilizce ve %30 İngilizce) | 15 | 728 | 7.428 | 19.061 | +| Vakıf, Türkçe | 52 | 2.847 | 22.965 | 47.204 | +| Vakıf, İngilizce (İngilizce ve %30 İngilizce) | 54 | 27 | 16.881 | 49.111 | +| KKTC, Türkçe | 4 | 21.622 | 21.775 | 36.436 | +| KKTC, İngilizce | 5 | 17.098 | 22.202 | 40.963 | + +Devlette İngilizce programların medyanı belirgin biçimde daha iyi sıralamada, ama bu eğitim kalitesi değil, **az sayıda ve belirli üniversitelerdeki programların dağılımı**; [hazırlık yazısındaki](/rehber/hazirlik-sinifi-ve-ogretim-dili) uyarı burada da geçerli: etiket kalite göstergesi değildir. Pratik fark şunlar: + +- İngilizce programlarda hazırlık sınıfı çoğu zaman zorunludur; yeterlik sınavını geçemezsen bir yıl hazırlık okursun. Hazırlık normal öğrenim süresine dâhil değildir, yani altı yıllık tıbba hazırlık eklenebilir ([hazırlık sınıfı ve öğretim dili](/rehber/hazirlik-sinifi-ve-ogretim-dili)). +- "(%30 İngilizce)" etiketli programlarda hazırlığın zorunlu olup olmadığı üniversiteden üniversiteye değişir; üniversitenin kendi sayfasından teyit et. +- Vakıf programlarında hazırlıkta kalırsan ücret konusu için [vakıf ücretleri yazısına](/rehber/vakif-universitesi-ucretleri-2026-2027) bak. + +## Tıp eğitimi kaç yıl, mezuniyetten sonra ne olur? + +YÖK Atlas'ta 2026'da öğrenci alan lisans düzeyindeki tıp programlarının **tamamı için süre 6 yıl** görünüyor (kendi verimizde 242 kayıt). Bu sürenin içinde son yıl, fakülte yönetmeliklerinde "intörnlük" ya da aile hekimliği dönemi olarak anılan uygulama yılıdır. Bunu tek bir ulusal metinden teyit edemedik: örnek olarak bir üniversitenin Resmî Gazete'de yayımlanmış tıp fakültesi yönetmeliği altı yıllık eğitimi anlatıyor ve altıncı yılı "aile hekimliği" dönemi olarak adlandırıyor; ad ve ayrıntı fakülteden fakülteye değişebilir, bu yüzden intörnlüğün süresini ve çalışma düzenini yazıda sabit bir rakamla vermiyoruz. Programın kendi yönetmeliğine bak. + +Mezuniyet sonrası uzmanlık için yol **TUS** (Tıpta Uzmanlık Eğitimi Giriş Sınavı): ÖSYM 2026'da TUS'u iki dönem hâlinde yaptı (1. dönem Mart, 2. dönem Ağustos). 2026 TUS 2. dönem başvuru kılavuzunda tabip adayları için sınav tarihi itibarıyla **Sağlık Bakanlığınca diploma tescil işleminin tamamlanmış olması** isteniyor ve ayrıca bedensel ya da ruhsal bir engel bulunmaması ile burstan doğan mecburi hizmetin zamanında bitirilebilir olması koşulları sayılıyor. Uzmanlık branşlarının kontenjan ve tercih kuralları her dönem kılavuzla belirlenir; bu yazıda branş, kontenjan ya da başarı beklentisi vermiyoruz. TUS'un 2027 takvimi için ÖSYM'nin sayfası esastır. + +## Sıralaman şartın hemen altındaysa komşu bölümler ve mezuna kalmak ne olur? + +Aynı kılavuz tablosunda sağlık alanındaki iki komşu şart: **diş hekimliği SAY ilk 80 bin, eczacılık SAY ilk 100 bin**. Aşağıda 2026 tabanları (yerleşen sayısı 5 ve üstü programlar): + +| Bölüm | Kılavuz şartı (SAY) | Devlet taban aralığı (2026) | Vakıf taban aralığı (2026) | +| --- | --- | --- | --- | +| [Tıp](/bolum/tip) | İlk 50 bin | 728 - 32.602 (medyan 16.004 Türkçe, 7.428 İngilizce) | 27 - 49.111 | +| [Diş Hekimliği](/bolum/dis-hekimligi) | İlk 80 bin | 20.226 - 38.944 (74 program) | 10.708 - 79.895 (60 program) | +| [Eczacılık](/bolum/eczacilik) | İlk 100 bin | 30.718 - 48.795 (36 program) | 26.717 - 96.222 (47 program) | + +Dikkat: diş hekimliği devlet tabanları ile tıp devlet tabanlarının üst bandı birbirine yaklaşıyor; vakıf diş hekimliği ve eczacılık programları ise şartın yakınına kadar uzanıyor (en uç satırlar küçük kontenjanlı ve sınırda). Yine de bu, "tıp olmazsa diş hekimliği olur" demek değildir; rakamlar geçmiş yıl tabanlarıdır ve vakıf üniversiteleri daha sıkı koşul koyabilir. + +Sıralaman 50 binin biraz üstündeyse üç yol var: + +- **Komşu bölüm:** Eczacılık ve diş hekimliğinin şartı daha geniş olduğu için bu iki bölüm tıp şartını geçemeyenlere açık kalır. Şartı olmayan sağlık programlarına (ör. [hemşirelik](/bolum/hemsirelik), [fizyoterapi ve rehabilitasyon](/bolum/fizyoterapi-ve-rehabilitasyon)) da bakabilirsin; bu iki bölümün şartı yukarıdaki tabloda yok, ÖSYM kılavuzunda program satırını kontrol et. +- **Mezuna kalmak:** Bir sonraki yıl tıp için sıralamanı yükseltmeyi hedefliyorsan, yerleştirilmenin puan bedelini ve kayıt-dondurma gibi seçenekleri [mezuna kalmak mı, kayıt olmak mı](/rehber/mezuna-kalmak-mi-kayit-olmak-mi) yazısında anlattık. Sıralamanın bir yıl sonra iyileşeceğine dair bir veri ya da vaat yok; karar kişisel. +- **Vakıf ya da KKTC yolu:** Tabanları 30-50 bin bandına yayılan vakıf indirimli/ücretli ve KKTC programları şartı geçen ama devlet tabanının gerisinde kalan adaylara açık bir banttır; maliyet ve denklik ayrı bir karar olarak yukarıdaki yazılarda. + +## Sıralamanla tıp programlarını nasıl görürsün? + +Kendi SAY sıralamanı KolayTercih'e girdiğinde tıp ve komşu programları sıralamana göre **hayal, dengeli ve güvenli** dilimlerde görürsün; dilimler 2026 tabanlarına göre hesaplanır ve yerleşme garantisi ya da olasılığı vermez. Sıralaman tıp şartını geçmiyorsa, yukarıdaki komşu bölümlerle aynı listede karşılaştırabilirsin. Programı kesinleştirmeden önce ÖSYM kılavuzundaki program koşulunu ve üniversitenin kendi duyurusunu mutlaka kontrol et. + +## Kaynaklar + +Bilgiler 25 Kasım 2026'da kontrol edildi. + +1. ÖSYM, [2026 YKS Başvuru Kılavuzu](https://dokuman.osym.gov.tr/pdfdokuman/2026/YKS/basvuru_kilavuz06022026.pdf): "Tablo 1G, Hukuk, Mimarlık, Mühendislik, Tıp, Öğretmenlik, Diş Hekimliği, Eczacılık Programlarına Başvurabilmek İçin En Düşük Başarı Sırası" (tıp SAY 50.000, diş hekimliği 80.000, eczacılık 100.000; vakıf üniversitelerinin senato kararıyla daha üst sıra belirleyebilmesi dipnotu) +2. ÖSYM, [2026-TUS 2. Dönem Başvuru Kılavuzu](https://dokuman.osym.gov.tr/pdfdokuman/2026/TUSDONEM-2/basvuru_kilavuz03072026.pdf), md. 2.1 Başvuru Koşulları (diploma tescili, mecburi hizmet ve diğer koşullar) +3. ÖSYM, TUS duyuruları: [2026-TUS 1. Dönem sınav sonuçları](https://www.osym.gov.tr/TR,33979/2026-tus-1-donem-ve-2026-sts-tip-doktorlugu-1-donem-sinav-sonuclari-aciklandi-15042026.html), [2026-TUS 2. Dönem sınav sonuçları](https://osym.gov.tr/2026-tus-2-donem-ve-2026-sts-tip-doktorlugu-2-donem-sinav-sonuclari-aciklandi) (2026'da iki dönem yapıldığının teyidi) +4. Resmî Gazete, 15 Mart 2017, sayı 30008, [Ömer Halisdemir Üniversitesi Tıp Fakültesi Eğitim-Öğretim ve Sınav Yönetmeliği](https://www.resmigazete.gov.tr/eskiler/2017/03/20170315-4.htm), md. 11: altı yıllık tıp programı ve altıncı yılın "aile hekimliği" dönemi (yalnız bir üniversitenin yönetmeliği, ulusal tek metin değil) +5. KolayTercih, YÖK Atlas 2026 yerleştirme verisi (`data/yokatlas.db`, tıp programlarının taban sıralaması, öğretim dili, burs oranı, süre alanı): bu yazıdaki tüm taban rakamları buradan derlendi +6. KolayTercih iç yazıları: [Başarı sıralaması şartları 2026](/rehber/siralama-sartlari-2026), [Hazırlık sınıfı ve öğretim dili](/rehber/hazirlik-sinifi-ve-ogretim-dili), [Mezuna kalmak mı, kayıt olmak mı](/rehber/mezuna-kalmak-mi-kayit-olmak-mi), [KKTC üniversiteleri okunur mu](/rehber/kktc-universiteleri-okunur-mu) diff --git a/docs/ekip-raporlari/2026-11-25/rehber-acikogretim-mi-orgun-mu-diploma-farki.md b/docs/ekip-raporlari/2026-11-25/rehber-acikogretim-mi-orgun-mu-diploma-farki.md new file mode 100644 index 0000000..c0b2b9a --- /dev/null +++ b/docs/ekip-raporlari/2026-11-25/rehber-acikogretim-mi-orgun-mu-diploma-farki.md @@ -0,0 +1,47 @@ +# Rehber: acikogretim-mi-orgun-mu-diploma-farki (25 Kas 2026) + +Dosya: `content/rehber/acikogretim-mi-orgun-mu-diploma-farki.md` (commit atılmadı). + +## Özet +1. Yazı Anadolu AÖF'ün 2026-2027 resmî belgelerine (yönetmelik, öğrenci kılavuzu, akademik takvim, yeni kayıt / ikinci üniversite sayfaları) dayanıyor; İstanbul ve Atatürk açıköğretim kuralları açılmadı. +2. "Diploma örgünle aynı mı" için resmî "evet/hayır" bulunamadı; yazıda "aynı" denmedi, bulunamadığı açıkça yazıldı. +3. Bahar 2026-2027: yeni kayıt ve ikinci üniversite için tarih yok (25 Kas itibarıyla); kayıt yenileme 8-22 Şub 2027, af kaydı 25 Oca-5 Şub 2027 yazıldı. +4. KYK: yalnız örgün (mevcut kyk-burs-mu-kredi-mi ile uyumlu). Askerlik: Anadolu kılavuzunun ifadesi (28 yaş; ikinci üniversitede tecil işlemi yok). Yatay geçiş 90 eşiği ve DGS mevcut yazılardan, çelişme yok. +5. Ürün yönlendirmesi: önce sıralamanla örgün seçenekler (/bolumler), olasılık/garanti vaadi yok. frontmatter `getRehber` ile ayrıştı, 1 mermaid (aria+altyazı), 3 tablo, 13 iç rehber linki doğrulandı. + +## Doğrulanan bilgiler ve kaynaklar +- AÖF yönetmeliği (md. 6/1, 9, 18; 10.07.2026 değişikliği): https://www.anadolu.edu.tr/uploads/anadolu/files/aof_kilavuz/6ad0c4b7e120c.pdf +- 2026-2027 Öğrenci Kılavuzu (diploma, tecil, yatay/dikey geçiş, ikinci üniversite): https://www.anadolu.edu.tr/uploads/anadolu/files/aof_kilavuz/6a82ab808e519.pdf +- Akademik takvim (bahar): https://www.anadolu.edu.tr/acikogretim/acikogretim-akademik-takvim/turkiye-programlari-2026-2027-ogretim-yili-akademik-takvim +- Yeni kayıt: https://www.anadolu.edu.tr/acikogretim/nasil-ogrenci-olabilirim/yeni-kayit (24 Ağu-4 Eyl, ek yerleştirme 2-16 Eki 2026) +- İkinci üniversite: https://www.anadolu.edu.tr/acikogretim/nasil-ogrenci-olabilirim/ikinci-universite (17 Ağu-23 Eki 2026, "şartsız, sınavsız") +- Kayıt yenileme kılavuzu (bahar 8-22 Şub 2027): .../aof_kilavuz/6aa13ecf49794.pdf; Af kılavuzu (katkı payı, CB Kararı 15.08.2026/33341 md. 10/3): https://anadolu.edu.tr/uploads/anadolu/files/aof_kilavuz/6ad5f685a3c5e.pdf +- Not: PDF'ler WebFetch'in kaydettiği kopyadan pypdf ile okundu (indirme yapılmadı). + +## SQL (sqlite3 -readonly data/yokatlas.db) +```sql +select p.onlisans, count(*), sum(p.kontenjan2026), sum(p.yerlesen2026), min(p.sira2026), max(p.sira2026) +from programs p join program_ozellik o on o.id=p.id where o.ogrenim_turu='Açık Öğretim' group by 1; +-- 0 (lisans): 47 program, taban sırası 70.864-1.202.899; 1 (önlisans): 65 program, 310.249-1.585.423; 5 üniversite +select p.onlisans, count(*) ... where o.ogrenim_turu='Uzaktan Öğretim' group by 1; -- 16 lisans + 90 önlisans = 106 +``` + +## Yazılmayan / çıkarılan iddialar +- "Açıköğretim diploması örgünle aynıdır / KPSS ve kamu ilanında eşittir": resmî kaynakta doğrulanamadı; yazılmadı. +- Diplomada/transkriptte öğretim biçimi ibaresi (2017 YÖK kararı iddiası): yalnız ikincil kaynaklarda (haber, dilekçe sitesi) vardı; yazılmadı. +- Uzaktan program öğrencisinin askerlik tecili: teyit edilemedi, tabloda öyle yazıldı. +- İstanbul ve Atatürk açıköğretim kayıt/ikinci üniversite kuralları ve bahar tarihleri: açılmadı. Ankara Üniv. "uzaktan" kuralları açılmadı. +- Ücret tutarları verilmedi. +- ÖSYM 2026 tercih kılavuzu PDF'i açılmadı; YKS ile yerleştirme Anadolu'nun kendi sayfasından ve veriden aktarıldı. + +## Dikkat: başka yazıyla ilgili not (rehber-editörü) +- `siralama-bandlari-hangi-kapilar-acilir.md` satır 211 "açık/uzaktan lisans 61 program, 5 üniversite, taban 22.484-1.202.899" diyor. Benim sorgumda açık öğretim lisans 47 (taban 70.864-1.202.899), uzaktan lisans 16 (22.484-899.999) = 63; 61 ile uyuşmuyor olabilir (filtre farkı). Düzeltmedim. +- `ek-madde-1-puanim-yetiyor-mu.md` tablosunun "sınavsız ikinci üniversite" sütunu "teyit edilemedi" notuyla duruyor; bu yazının kaynaklarıyla doldurulabilir (düzeltmedim). + +## Engeller +- AÖF/Anadolu "aof.anadolu.edu.tr" ve ikinciuniversite.anadolu.edu.tr sayfaları yüklenmedi (JS); resmî içerik anadolu.edu.tr yollarından alındı. + +## Bilal'den istenen (yayın öncesi) +1. İkinci üniversite başvuru bitişi: resmî sayfada 23 Ekim 2026, bazı haberlerde 19 Ekim 17.00 geçiyor; yazı resmî sayfayı esas alıyor. Canlı sayfada 1 dakikada bakılabilir. +2. Diploma "aynı mı" bölümünün (bilerek cevapsız) yayın tonunu onayla; istenirse YÖK/Anadolu'ya yazılı soru yoluyla doldurulabilir. +3. Yayın sonrası bahar yeni kayıt tarihi açıklanırsa yazı güncellenmeli (Ocak'ta takvim kontrolü). diff --git a/docs/ekip-raporlari/2026-11-25/rehber-erasmus-degisim-programi-nasil-isler.md b/docs/ekip-raporlari/2026-11-25/rehber-erasmus-degisim-programi-nasil-isler.md new file mode 100644 index 0000000..4f39def --- /dev/null +++ b/docs/ekip-raporlari/2026-11-25/rehber-erasmus-degisim-programi-nasil-isler.md @@ -0,0 +1,44 @@ +# Blog: erasmus-degisim-programi-nasil-isler + +## Özet +1. Yazı yazıldı: content/rehber/erasmus-degisim-programi-nasil-isler.md (tarih 2026-11-25, niyet 1, konu strateji). Frontmatter YAML'a uygun (aciklama/baslik içinde ": " yok), mermaid bloğu tek ve kapalı, ünlem yok. +2. ua.gov.tr hem WebFetch'te hem sertifika hatası verdi; sertifika doğrulamasını kapatan curl -k izin sistemi tarafından reddedildi, aşılmadı. Bu yüzden Ulusal Ajans el kitabı açılamadı. +3. Hibe tutarı ve ülke grubu tablosu YAZILMADI (resmî teyit yok). +4. Farabi/Mevlana durumu "resmî kaynaktan teyit edilemedi" diye yazıldı; yalnız üniversite beyanları (Yalova, Cumhuriyet) aktarıldı. +5. KYK'nin değişim döneminde kesilip kesilmediği teyit edilemedi, öyle yazıldı. + +## Doğrulananlar ve kaynaklar +- Erasmus+ yükseköğretim hareketliliğini Türkiye Ulusal Ajansı yürütür: Eurydice (AB Komisyonu) https://eurydice.eacea.ec.europa.eu/tr/eurypedia/turkiye/yuksekogretimde-hareketlilik (son güncelleme 17 May 2025). +- Ankara Üniv. 2026-27 öğrenim ilanı (https://www.erasmus.ankara.edu.tr/2026/01/07/21075/) açıldı, içerik okundu: ilan 7 Oca 2026, son başvuru 11 Şub 2026; not ort. lisans 2,20/4, lisansüstü 2,50/4; fakülteye göre dil puanı (50-75); 1. sınıf başvuramaz (1. sınıfta başvur, 2. sınıfta yararlan); önceki faaliyet başına 10 puan düşüm; kademe başına 12 ay hibe sınırı; 2-12 ay; 250 € ilave hibe (dezavantajlı gruplar); KYK bursu ilave hibede "maddi yardım" sayılmaz; 30/60 AKTS; tam akademik tanınma; el kitabına atıf. +- Ege Üniv. 2026 ilanı seçim sonucu 6 Mar 2026 (yalnız arama özeti, sayfa açılmadı). +- Yalova Üniv. Farabi sayfası açıldı: "currently inactive ... until further notice" (https://yudik.yalova.edu.tr/en/Icerik/Detay/farabi-exchange-programme). Cumhuriyet Üniv. duyurusu: sayfa yalnız başlığı verdi, metin arama özetinden. + +## SQL +Kullanılmadı (sıralama/taban rakamı yok). + +## Yazılmayan / çıkarılan iddialar +- Aylık hibe tutarları ve ülke grupları (2026): resmî tablo açılamadı, internet kaynaklarındaki rakamlar birbiriyle tutarsız. +- Farabi/Mevlana "bitti" iddiası: YÖK teyidi yok, yalnız "bazı üniversiteler uygulanmıyor diyor" yazıldı. +- KYK burs/kredisinin Erasmus'ta kesilmesi: teyit yok. +- Resmî asgari not ortalaması: el kitabı açılamadı; 2,20 yalnız Ankara Üniv. ilanı örneği olarak yazıldı. +- Geçiş yönetmeliği md. 22 (değişim programında alınan derslerin sayılması): mevzuat PDF'i okunamadı (CID font); özel-ogrenci yazısındaki aktarıma dayanıldığı yazıda belirtildi. +- Staj kuralları (2-12 ay, mezun sonrası): yalnız arama özetleri; mezun sonrası staj YAZILMADI. + +## Engeller +- ua.gov.tr sertifika hatası; mevzuat.gov.tr ve bazı üniversite PDF'leri sıkıştırılmış, okunamadı; pdftotext/pdftoppm yok. + +## Başka yazıyla ilgili not (rehber-editoru) +- ozel-ogrenci yazısındaki md. 22 aktarımı bu yazıda da referans alındı; mevzuat metniyle doğrulanması iyi olur. Geçiş yönetmeliği 28/2/2026 (RG 33182) tarihli değişiklik izleri taşıyor; 22. maddeyi etkileyip etkilemediği kontrol edilmedi. + +## Bilal'den istenen (yayın öncesi) +1. ua.gov.tr'yi kendi tarayıcında aç: 2026 el kitabında asgari not ortalaması, süre, staj şartları, aylık hibe tablosu; bulursan yazıdaki "teyit edemedik" yerlerini doldurtalım (~15 dk). +2. YÖK'ün Farabi/Mevlana durumu için resmî bir açıklama var mı bak (yok.gov.tr) (~5 dk). +3. md. 22 ve KYK-Erasmus sorusu için mevzuat.gov.tr/kyk.gsb.gov.tr (~10 dk). + +## GÜNCELLEME (aynı gün): Ulusal Ajans 2026 el kitabı eklendi +Orkestratör el kitabının metnini verdi (scratchpad/ua/elkitabi.txt); s. 21 hibe tablosu, s. 32-33 md. 18 elle doğrulandı. Yazıda yapılanlar: +- Not ort. (2,20 / 2,50), lise notu 75/100, 12 ay sınırı, 2-12 ay, staj mezuniyet sonrası 12 ay, puan düşürmeler, 250 € ilave hibe, KYK bursunun ilave hibede sayılmaması el kitabına (s. 12-14, 23) bağlandı; "birinci sınıf başvuramaz" Ankara Üniv.'ne özgü kural olarak ayrıldı (tablo: el kitabı | Ankara ilanı). +- Hibe tablosu eklendi (2026 sözleşme dönemi, 600/750 ve 450/600 €; her yıl değişebilir notu; Türkiye listelenmedi; programla ilişkisiz ülkeler tek cümle). +- "KYK kesilir mi" md. 18'e göre cevaplandı (kesilemez/azaltılamaz); KYK'nin kendi metni açılamadı notu kaldı. +- Kaynak 1 artık el kitabı; "açılamadı/sertifika" ifadeleri çıkarıldı. Farabi/Mevlana bölümü aynı. +- Hâlâ doğrudan okunmayan: md. 22 (mevzuat), staj konsorsiyumları, Ege seçim tarihi (arama özeti). Bilal'den istenen madde 1 (ua.gov.tr) artık gerekli değil. diff --git a/docs/ekip-raporlari/2026-11-25/rehber-tip-fakultesi-kac-siralama-ile-girilir.md b/docs/ekip-raporlari/2026-11-25/rehber-tip-fakultesi-kac-siralama-ile-girilir.md new file mode 100644 index 0000000..8725d32 --- /dev/null +++ b/docs/ekip-raporlari/2026-11-25/rehber-tip-fakultesi-kac-siralama-ile-girilir.md @@ -0,0 +1,62 @@ +# Rehber raporu: tip-fakultesi-kac-siralama-ile-girilir + +Dosya: content/rehber/tip-fakultesi-kac-siralama-ile-girilir.md (commit atılmadı) + +## Özet +1. Yazı hazır: Kısa cevap, 6 soru-biçimli H2, 1 mermaid (aria + altyazi), 3 tablo, 13 iç link (hepsi dosya olarak var), numaralı kaynaklar. +2. Şart: 2026 YKS Başvuru Kılavuzu Tablo 1G (PDF s.53): tıp SAY 50.000, diş 80.000, eczacılık 100.000; vakıf senatosu daha üst sıra koyabilir (dipnot). siralama-sartlari-2026 ile çelişmiyor. +3. Taban rakamları sira2026 (YÖK Atlas 2026 yerleştirmesi), 219 program; devlet Türkçe medyan 16.004, devlet İngilizce 7.428, vakıf burslu 9.487, vakıf indirimli 31.072, vakıf ücretli 39.173, KKTC 22.202. +4. TUS ve 6 yıl: TUS 2026 2. dönem başvuru kılavuzu md.2.1 ve ÖSYM duyuruları açıldı. İntörnlük için ulusal tek resmî metin bulunamadı, yazıda sabit süre verilmedi. +5. Vaat/olasılık/ünlem yok. + +## Kaynaklar (açılan) +- https://dokuman.osym.gov.tr/pdfdokuman/2026/YKS/basvuru_kilavuz06022026.pdf (metin çıkarıldı, Tablo 1G okundu) +- https://dokuman.osym.gov.tr/pdfdokuman/2026/TUSDONEM-2/basvuru_kilavuz03072026.pdf (md. 2.1) +- ÖSYM TUS duyuru sayfaları (yalnız arama sonucu; sayfa içeriği ayrıca açılmadı): .../TR,33979/... ve osym.gov.tr/2026-tus-2-donem-ve-2026-sts-tip-doktorlugu-2-donem-sinav-sonuclari-aciklandi +- https://www.resmigazete.gov.tr/eskiler/2017/03/20170315-4.htm (Ömer Halisdemir Ü. Tıp Fak. yönetmeliği md.11, WebFetch) + +## Açılamayan / teyit edilemeyen +- Intörnlük süresi ve ulusal çerçeve (YÖK/UÇEP/Sağlık Bakanlığı tek metin): bulunamadı. Yazıda "tek ulusal metinden teyit edemedik" denip bir üniversite yönetmeliği örnek gösterildi. Yazıya 12 ay gibi rakam konmadı. +- TUS duyuru sayfalarının içeriğini doğrudan açmadım (arama özeti); yalnız "2026'da iki dönem yapıldı" bilgisi için kullanıldı. +- Hemşirelik/fizyoterapi için kılavuzda başarı sırası şartı yok (Tablo 1G'de listelenmiyor); yazıda "ÖSYM kılavuzunda program satırını kontrol et" denerek yumuşatıldı. +- KKTC tıp programlarının 50.000 şartına tabi olduğu kılavuz tablosundan değil, program_ozellik.min_basari_sirasi alanından (50000) çıkarım; yazıda bu şekilde belirtildi. + +## SQL (sqlite3 -readonly data/yokatlas.db) +Ortak filtre: isim LIKE 'Tıp%', onlisans=0, sira2026 NOT NULL, isim NOT LIKE '%UOLP%', yerlesen2026>=5, unitur DEVLET/VAKIF/KKTC. 13 program (3 UOLP + yerleşen<5) dışarıda; KKTC uyruklu satırı sira2026 boş. +Grup çeyrekleri sorgusu (en-yakın-sıra, ROW_NUMBER): +```sql +WITH t AS ( + SELECT p.id, p.sira2026 s, + CASE + WHEN p.unitur='DEVLET' AND o.ogrenim_dili LIKE 'İngilizce%' THEN '2 Devlet İngilizce' + WHEN p.unitur='DEVLET' THEN '1 Devlet Türkçe' + WHEN p.unitur='KKTC' THEN '7 KKTC (tümü)' + WHEN p.unitur='VAKIF' AND o.burs_orani='Burslu' THEN '3 Vakıf burslu' + WHEN p.unitur='VAKIF' AND o.burs_orani LIKE '%İndirimli' THEN '4 Vakıf indirimli (%25/%50)' + WHEN p.unitur='VAKIF' AND o.burs_orani='Ücretli' THEN '5 Vakıf ücretli' + ELSE '9 diger' END g + FROM programs p JOIN program_ozellik o ON o.id=p.id + WHERE p.isim LIKE 'Tıp%' AND p.onlisans=0 AND p.sira2026 IS NOT NULL AND p.unitur<>'YURTDISI VAKIF' + AND p.isim NOT LIKE '%UOLP%' AND p.yerlesen2026>=5), +r AS (SELECT g, s, ROW_NUMBER() OVER (PARTITION BY g ORDER BY s) rn, COUNT(*) OVER (PARTITION BY g) n FROM t) +SELECT g, n, MIN(s), + MAX(CASE WHEN rn<=CAST((n+3)/4 AS INT) THEN s END) q1, + MAX(CASE WHEN rn<=CAST((n+1)/2 AS INT) THEN s END) medyan, + MAX(CASE WHEN rn<=CAST((3*n+3)/4 AS INT) THEN s END) q3, MAX(s) FROM r GROUP BY g ORDER BY g; +``` +Dil kırılımı: aynı filtre, CASE ile (DEVLET/VAKIF/KKTC) x (ogrenim_dili LIKE 'İngilizce%' ise İngilizce, değilse Türkçe); min, medyan, max. +Komşu bölümler: isim LIKE 'Diş Hekimliği%' OR 'Eczacılık%', onlisans=0, sira2026 NOT NULL, yerlesen2026>=5, unitur DEVLET/VAKIF; min/medyan/max. +Süre: SELECT sure,count(*) FROM programs WHERE isim LIKE 'Tıp%' AND onlisans=0 AND isim NOT LIKE 'Nükleer%' GROUP BY sure -> 6|242. +30 bin üstü devlet Türkçe: 2 program. + +## Not: bölüm sayfası/başka yazılarla ilgili +- Başka yazıda çelişki gözlemlemedim. siralama-sartlari-2026'daki "Eşikler son yıllarda sabit" cümlesi benim doğrulamamın dışında (yalnız 2026 kılavuzunu açtım). +- Yazının "Devlet İngilizce" grubu içinde "(%30 İngilizce)" programlar da var (program_ozellik.ogrenim_dili 'İngilizce (%30)'). + +## Biçimsel kontrol +- Frontmatter Ruby YAML ile geçerli (baslik, aciklama, tarih, niyet, konu, cta_baslik, cta_aciklama); mermaid bloğu bir adet ve kapalı (``` sayısı 2); metinde ünlem yok; 13 iç linkin hedef dosyası var. Mermaid parse'ı çalıştırılmadı (istenmedi). + +## Bilal'den istenen (yayın öncesi) +1. Sayısal dilim: "yerleşen sayısı >=5" filtresi ve UOLP dışlaması yazıda açıklandı; kabul edip etmediğine bak (3 dk). +2. Intörnlük için resmî ulusal metin (YÖK/Sağlık Bakanlığı) istersen ayrıca teyit gerekir; şimdilik rakamsız (5 dk). +3. Şartlar bölümündeki "vakıflar daha sıkı şart koyabilir" cümlesi kılavuz dipnotundan; teyit için PDF s.53 (2 dk). diff --git a/docs/ekip/YAYIN-KUYRUGU.md b/docs/ekip/YAYIN-KUYRUGU.md index 657e8d1..c3ac05c 100644 --- a/docs/ekip/YAYIN-KUYRUGU.md +++ b/docs/ekip/YAYIN-KUYRUGU.md @@ -19,6 +19,7 @@ Her URL denetimi isteğinden sonra o günün satırı güncellenir. **13'e varı | 22 Eyl 2026 | **6 / 13** | 4 başarılı bildirim + 2 boşa giden istek (arama kutusu dar pencerede kapandı — aşağıdaki nota bak) | | 24 Eyl 2026 | **12 / 12** | 11 başarılı bildirim + 1 boşa giden istek: 12. istekte (`yerlesemedim-ne-yapmaliyim`, yeniden tarama) Search Console **"Kota Aşıldı"** dedi. Yani bu mülkte gerçek günlük sınır **11 başarılı istek**; 12.'yi deneme, o gün dur | | 29 Eki 2026 | **11 / 11** | 11 başarılı bildirim, boşa giden yok; S-015 program sayfaları (aşağıdaki "Program sayfaları" bölümü). Durulan sebep: 24 Eyl'de 12. istek "Kota Aşıldı" demişti | +| 20 Kas 2026 | **3 / 11** | 3 başarılı bildirim, boşa giden yok; 20 Kas rehber yazıları. Mülk Chrome'da `/u/0/` altında açıldı | | *(sonraki bildirim günü)* | — / 11 | Önce aşağıdaki bekleyenler | ### Program sayfaları (S-015, `/universite//-`) — 29 Eki 2026 @@ -100,6 +101,34 @@ for s in kyk-burs-mu-kredi-mi puan-turu-nedir-say-ea-soz-dil-tyt vakif-universit for s in ogrenci-affi-2026-universiteye-donus yks-2027-takvimi msu-askeri-okul-adaylari-2027-basvuru-yks ogretmenlik-bolumu-ags-atama-nasil-isler; do printf "%s -> " "$s"; printf "%s " "$(curl -s -o /dev/null -w "%{http_code}" "https://kolaytercih.com/rehber/$s")"; curl -s https://kolaytercih.com/sitemap.xml | grep -c "/rehber/$s<"; done ``` +## Commit'lendi, push bekliyor — 25 Kas 2026 + +25 Kasım içerik turu: üç `rehber-yazari` (Sonnet) paralel yazdı, konu seçimi ve denetim orkestratörde (frontmatter + iç link + mermaid ayrıştırma sıfır hata; tıp taban rakamları DB'den yeniden sorgulanıp birebir tuttu). Ulusal Ajans sitesi yazara açılmadı; 2026 KA131 Yükseköğretim El Kitabı orkestratörde açılıp Erasmus yazısına işlendi (not ortalaması, süre, hibe tablosu, md. 18 burs/kredi kesilmez). Commit `aed6faa` (aynı commit'te "Yeni" rozeti yalnız son yayım gününün yazılarına bağlandı, 2.12.15). **Push bekliyor:** klon build'i derleme + TypeScript + 1.978 statik sayfayı geçti, son adımda `ENOSPC` ile düştü (disk 1,8 GB boş). Raporlar `docs/ekip-raporlari/2026-11-25/`. + +| Sıra | Adres | Tür | Durum | Not | +|---|---|---|---|---| +| 1 | `/rehber/tip-fakultesi-kac-siralama-ile-girilir` | yeni adres | commit'lendi | Şart 2026 kılavuzu Tablo 1G; taban dağılımı 219 program (`yerlesen2026>=5`, UOLP hariç). İntörnlük süresi rakamsız (ulusal metin bulunamadı). 2027 tabanları gelince tablo yenilenir | +| 2 | `/rehber/acikogretim-mi-orgun-mu-diploma-farki` | yeni adres | commit'lendi | Yalnız Anadolu AÖF belgeleri; "diploma örgünle aynı mı" bilerek cevapsız (resmî metin yok). Ocak'ta bahar yeni kayıt / ikinci üniversite tarihi açıklanırsa güncellenir | +| 3 | `/rehber/erasmus-degisim-programi-nasil-isler` | yeni adres | commit'lendi | Hibe 2026 sözleşme dönemi tutarları; 2027 el kitabı çıkınca tablo yenilenir. Farabi/Mevlana durumu yalnız üniversite beyanlarından (YÖK duyurusu bulunamadı) | + +``` +for s in tip-fakultesi-kac-siralama-ile-girilir acikogretim-mi-orgun-mu-diploma-farki erasmus-degisim-programi-nasil-isler; do printf "%s -> " "$s"; printf "%s " "$(curl -s -o /dev/null -w "%{http_code}" "https://kolaytercih.com/rehber/$s")"; curl -s https://kolaytercih.com/sitemap.xml | grep -c "/rehber/$s<"; done +``` + +## Bildirildi — 20 Kas 2026 + +20 Kasım içerik turu: üç `rehber-yazari` (Sonnet) paralel yazdı, konu seçimi ve denetim orkestratörde. Konular o günün gündeminden: YÖK Başkanı'nın 7 Kasım "lisans 3 yıl / 180 kredi" sözleri, KYK sonuçları (6 Kas) sonrası "bursum çıkmadı" araması, deprem bölgesi özel öğrencilik haberi. Yazarların açamadığı üç resmî metin orkestratörde açılıp yazıya işlendi: 2547 md. 3/s ve md. 44, geçiş yönetmeliği md. 4/r ve md. 22, Burs Yönetmeliği md. 10/c, 12, 16/2. Commit `01da206`, 20 Kas 22:30'da canlıda: üç adres 200 ✓, sitemap sayımı 1 ✓, `pnpm indexnow … --gonder` 3 adres ✓. Search Console: sitemap yeniden gönderildi ("başarıyla gönderildi"; önceki okuma 17 Kas, 22.525 sayfa), üç adres için dizine eklenmesi istendi ✓. + +| Sıra | Adres | Tür | Durum | Not | +|---|---|---|---|---| +| 1 | `/rehber/lisans-egitimi-3-yila-mi-iniyor` | yeni adres | bildirildi | Karar yok; YÖK yazılı metin yayımlarsa (bölüm listesi, başlangıç yılı, 180/240 AKTS) yazı güncellenir. 7 Kasım 2026 satırı yalnız haber kaynaklı | +| 2 | `/rehber/kyk-bursu-cikmadi-baska-hangi-burslar-var` | yeni adres | bildirildi | Burs listesi değil, tür haritası + takvim. 6 Aralık 2026'dan sonra (30 günlük yeniden inceleme süresi dolar) kısa cevap geçmiş zamana çevrilir. Zamanlama sütunu "genelde", resmî teyit değil | +| 3 | `/rehber/ozel-ogrenci-nedir-baska-universitede-okumak` | yeni adres | bildirildi | Deprem bölgesi bölümü haber kaynaklı (29-30 Tem 2026); yok.gov.tr duyurusu bulunursa etiket kalkar. KYK burs/yurt etkisi teyitsiz, yazıda öyle yazıyor | + +``` +for s in lisans-egitimi-3-yila-mi-iniyor kyk-bursu-cikmadi-baska-hangi-burslar-var ozel-ogrenci-nedir-baska-universitede-okumak; do printf "%s -> " "$s"; printf "%s " "$(curl -s -o /dev/null -w "%{http_code}" "https://kolaytercih.com/rehber/$s")"; curl -s https://kolaytercih.com/sitemap.xml | grep -c "/rehber/$s<"; done +``` + ## Yayında, Search Console'a bildirilecek — 25 Eyl 2026 ve sonrası (kota 11) 24 Eyl 2026 saat 17:50'de yayına çıktı (commit `24d4bea`), aynı gün yapılanlar: canlıda 200 ✓, sitemap sayımı 1 ✓, `pnpm indexnow --rehber` 47 adres → HTTP 202 ✓, Search Console sitemap yeniden gönderildi ("Başarılı", 1.014 keşfedilen sayfa) ✓. URL denetimi **yapılmadı** çünkü 24 Eyl kotası dolmuştu (12/12). @@ -159,7 +188,10 @@ for s in yerlesemedim-ne-yapmaliyim obp-nedir-nasil-hesaplanir yatay-gecis-cap-y | https://kolaytercih.com/rehber/yks-2027-takvimi | 24 Eyl 2026 | "Bilinmiyor", sitemap algılanmadı (sayım 1) → istendi | | https://kolaytercih.com/rehber/yapay-zekaya-tercih-sordum-guvenilir-mi | 24 Eyl 2026 | "Bilinmiyor", sitemap algılanmadı (sayım 1) → istendi | | https://kolaytercih.com/rehber/bolumumu-sevmedim-hangi-kapilar-var | 24 Eyl 2026 | "Keşfedildi", sitemap görünüyor → istendi | +| https://kolaytercih.com/rehber/lisans-egitimi-3-yila-mi-iniyor | 20 Kas 2026 | "Keşfedildi - şu anda dizine eklenmiş değil", sitemap görünüyor → istendi | +| https://kolaytercih.com/rehber/kyk-bursu-cikmadi-baska-hangi-burslar-var | 20 Kas 2026 | "Bilinmiyor", sitemap algılanmadı (sayım 1; Google okuma gecikmesi, tekrarlanmaz) → istendi | +| https://kolaytercih.com/rehber/ozel-ogrenci-nedir-baska-universitede-okumak | 20 Kas 2026 | "Bilinmiyor", sitemap algılanmadı (sayım 1) → istendi | -**Site haritası:** `https://kolaytercih.com/sitemap.xml` 24 Eyl 2026'da yeniden gönderildi ("Site haritası başarıyla gönderildi"; önceki satır 22 Eyl, "Başarılı", 904 sayfa keşfedilmiş). Bir önceki gönderim 22 Eyl 2026'da yapılmıştı ("Site haritası başarıyla gönderildi"). Önceki gönderim 21 Eyl, durum "Başarılı", 897 sayfa keşfedilmiş. +**Site haritası:** `https://kolaytercih.com/sitemap.xml` 20 Kas 2026'da yeniden gönderildi. Önceki: 24 Eyl 2026'da yeniden gönderildi ("Site haritası başarıyla gönderildi"; önceki satır 22 Eyl, "Başarılı", 904 sayfa keşfedilmiş). Bir önceki gönderim 22 Eyl 2026'da yapılmıştı ("Site haritası başarıyla gönderildi"). Önceki gönderim 21 Eyl, durum "Başarılı", 897 sayfa keşfedilmiş. **Kotadan kaybedilen 2 istek (22 Eyl — yukarıdaki kota tablosunda 6/13'ün 2'si; notu duruyor ki tekrarlanmasın):** Search Console'un arama kutusu dar pencerede kapandığı için (a) `kyk-burs-mu-kredi-mi` için ikinci kez istek gönderildi, (b) iki adresin birbirine yapışmasıyla oluşan bozuk bir adres denetlendi. Doğru yöntem: pencereyi genişlet → büyüteç düğmesine bas → kutunun açıldığını **gör** → ancak o zaman yaz. Kutuya `form_input` ile değer basma, açılmamış kutuya yazma. diff --git a/docs/tasarim/DESIGN.md b/docs/tasarim/DESIGN.md index 4642a83..fefcc69 100644 --- a/docs/tasarim/DESIGN.md +++ b/docs/tasarim/DESIGN.md @@ -250,7 +250,7 @@ bir dosyaya (`src/components/…`) çıkarılıp iki yer de oradan kullanır. ``` Varyantın ürettiği: `relative isolate cursor-pointer bg-orange-500 text-white hover:bg-orange-600 transition-[background-color,transform] duration-200 active:scale-[0.97] - data-cam:bg-transparent data-cam:hover:bg-transparent`. CTA düz turuncudur; yalnız **CTA yüzeylerinin içinde** `cam="seffaf"` ile mavi boyalı liquid + data-glass-ready:bg-transparent data-glass-ready:hover:bg-transparent`. CTA düz turuncudur; yalnız **CTA yüzeylerinin içinde** `cam="seffaf"` ile mavi boyalı liquid glass olur (12 Kas 2026, §4.50). `cam="cam"` turuncu boyalı varyasyondur, kullanılmıyor. Metin önce, ok sonda. Başta ikon yok. `Sparkles` yok. Kullanım yerinde yalnız yerleşim sınıfı eklenir (`w-full sm:w-auto`, `mt-6`); yükseklik, renk, geçiş yazılmaz. @@ -2076,12 +2076,14 @@ yok" kuralının üçüncü istisnası (başlık üstü eyebrow değil, kart kö "progressive blur" iki kez denendi (güçlü ve hafif), Bilal 12 Kas 2026'da ikisini de kaldırttı — geri önerilmez. - Cam ilk karesini çizene dek ve WebGL2 yoksa rozet düz hâlindedir: `bg-primary` dolu hap, beyaz - CSS şeridi (`kt-yeni-serit`, 5 sn, kenarlar maskeyle erir). `data-cam` gelince zemin ve DOM + CSS şeridi (`kt-yeni-serit`, 5 sn, kenarlar maskeyle erir). `data-glass-ready` gelince zemin ve DOM şeridi bırakılır. - Hareketi azalt: şerit durur, tek ortalı "Yeni" (camda da, düz hâlde de). Ekran okuyucuya `sr-only` "Yeni yazı". Cam yalnız ekrandayken çizilir. -- **Rehber dizininde** (`rehber-izgarasi.tsx`) yazı yayım tarihinden sonraki **14 gün** rozet - taşır (`YENI_GUN`; güncelleme tarihi saymaz). Karar tarayıcıda verilir (sayfa derlemede +- **Rehber dizininde** (`rehber-izgarasi.tsx`) rozeti **yalnız en son yayım gününün yazıları** + taşır (Bilal, 25 Kas 2026: "yeni rozeti sadece bu 3'ünde olmalı"; yeni tur çıkınca önceki + turun rozeti kalkar) ve o gün de yayımdan sonraki **14 günle** sınırlıdır (`YENI_GUN`; + güncelleme tarihi saymaz). Karar tarayıcıda verilir (sayfa derlemede donar), rozet `kt-piksel-belir` ile belirir. `li` üstte 10 px pay bırakır, rozet o payın içinde durur. Izgara **satır satır** dolar (`grid`, 1/2/3 sütun; satırdaki kartlar eşit boy, "Yazıyı oku" dipte): yeni yazılar aynı satırda yan yana durur (Bilal, 12 Kas 2026: "yeniler @@ -2106,6 +2108,26 @@ Bilal (12 Kas 2026): "CTA butonlarını liquid-glass projesinde yaptığım buto liquid glass olsun". Kaynak Bilal'in açık kaynak kiti **Liquid Glass UI** (github.com/bilalgursen/liquid-glass, MIT): `ui/Button.tsx`, `ui/LiquidGlass.tsx`, `ui/glass/runtime.ts`, `ui/glass/physics.ts`. §11.3'e göre çevrildi. +- **Kitin 2.0 sürümüne geçildi** (Bilal, 25 Kas 2026: "burdaki liquid glassları güncel liquid + glass ile güncelle"; site 2.13.0). Motor ve bakış artık kitin kendisidir: + `src/components/liquid-glass/` altında `engine.ts`, `dom-snapshot.ts`, `glass-layer.tsx`, + `glass-lens.tsx` (bilalgursen/liquid-glass@9c65d01) **olduğu gibi** durur, elle değiştirilmez; + kit güncellenince dosyalar yeniden kopyalanır (lint ve `pnpm tasarim:denetim` bu klasörü + kitin biçiminde bırakır). `sivi-cam.tsx` yalnız sarmalayıcıdır: `SiviCam` kitin `GlassLayer`'ının + uyarlaması (ok damlası kendiliğinden bulunur, üstüne gelince ya da `otoDamla`'da ayrılır, + baştaki ikonda sola ayrılır; CTA yüzeyinde yüzeyi canlı çizer ve `--glass-tint` ile maviye + boyanır, globals.css), `KayanCam` kitin `GlassLens`'i, `RozetCami` kitin `GlassBadge` camı. + Kitle gelen davranışlar: basılan yerde ışıklanma (`GLOW`, `LIGHT`), basılı tutup çekince + peşinden gelip jöle gibi dönme (`PULL`), yaklaşan iki cam butonun kaynaşması (`COHESION`), + şeffaf camın kenarında çevresini yansıtması (`MIRROR`; kenardaki sabit mavi çizgi kalktı). + Cam hazır olunca kaba `data-glass-ready` yazılır (`SIVI_KAP` buna bakar); mercek kaba + `data-glass-moving` / `data-glass-traveling`, seçili vurgu `data-glass-highlight` taşır. + Şeffaf camın kırılma, bulanıklık ve ton değerleri kitin varsayılanıdır (kırılma 44 → basınca + 37; CTA yüzeyinde boya %82, dışında ton %60); aşağıdaki maddelerde bunlardan farklı yazan + sayılar (ör. CTA bandında "10 → 32", "%8 büyütür", "%7 beyaz ton") eskidir. Sayfa + bulanıklığı katmanları (`.kt-sayfa-blur`) `data-glass-skip` ile camda çizilmez. 25 Kas + 2026'da 1024 px'te (`/rehber`, ana sayfa kapanışı, sıralama seçenekleri) ve 375 px'te + (ana sayfa, telefon menüsü, açık ve koyu tema) bakıldı; 375 px'te yatay taşma 0. - **Sıvı yalnız cam yüzeylerde** (Bilal, 12 Kas 2026: "gooey animasyonu sadece liquid glass'larda olsun, diğer geliştirmeleri sil"). Renkli ve düz butonlar — turuncu CTA, mavi birincil, ikincil, outline, ikonlu haplar — düzdür: ne cam zemin, ne şişme, ne ok damlası. @@ -2175,7 +2197,7 @@ liquid glass olsun". Kaynak Bilal'in açık kaynak kiti **Liquid Glass UI** (Bilal, 12 Kas 2026: "ikonlar yuvarlakları tam ortalamıyor"). Ölçüldü: satır düğmesinde ve hap damlasında ikon merkezi ile cam dairesinin merkezi arasındaki fark 0 px. Cam kurulunca eski `active:scale` kapanır - (`data-cam:active:scale-100`; büyümeyi cam yapar). WebGL2 yoksa düğme eski düz hâlindedir. + (`data-glass-ready:active:scale-100`; büyümeyi cam yapar). WebGL2 yoksa düğme eski düz hâlindedir. 12 Kas 2026'da 1280 ve 375 px'te, açık ve koyu temada bakıldı; 375 px'te yatay taşma 0. - **Sıvı cam kutusu — `CamSecici`, `src/components/cam-secici.tsx`, `src/lib/cam-tercihi.ts`** (Bilal, 12 Kas 2026: "sitenin en altına camsılığı açıp kapama seçeneği koy, ilham kaynağı deyip @@ -2197,7 +2219,7 @@ Cam kurulunca eski `active:scale` kapanır ortalı durur: tema → resim + kaynak + kutu → iyzico bandı. 12 Kas 2026'da 1280 ve 375 px'te, açık temada bakıldı; yatay taşma 0. - **İçinde yalnız ikon olan her yuvarlak düğme camdır** (Bilal, 12 Kas 2026: "sadece içinde ikon olan - tüm yuvarlak butonlar sıvı cam olmalı"): `SIVI_KAP` + ilk çocuk ``, `data-cam:active:scale-100`. + tüm yuvarlak butonlar sıvı cam olmalı"): `SIVI_KAP` + ilk çocuk ``, `data-glass-ready:active:scale-100`. Kapsam: `DialogContent` ve `AltSayfaKapat` çarpıları, arama kapatma, telefon menüsü açma/kapama, üst çubuktaki "Yapay Zekâ Listem" bağlantısı (ikon yerine `PikselDugmeYuzu`, §4.43; `` ile camsı görünüm kapalıyken de camdır: Bilal, 12 Kas 2026 "hep camsı gözükmeli"; telefon menüsündeki satırda `ListOrdered` ikonu), bildirim çarpısı, liste çekmecesi (temizle, çıkar), sayfalama okları, sihirbaz ve danışman paneli ikon düğmeleri. Yazılı düğmeler ve avatar/rozet gibi düğme olmayan daireler kapsam dışı. @@ -2214,7 +2236,7 @@ Cam kurulunca eski `active:scale` kapanır - **Hareket (kitle aynı):** üstüne gelince cam her yana yüksekliğin %8'i kadar şişer; en ve boy ayrı yaylarla faz farkıyla oturur (damla gibi yalpalar), yazı 1,04'e büyür. Basınca cam ve yazı 1,08'e büyür, gölge derinleşir, bırakınca hafif sekerek döner. İmleç sayfadayken kenar ışığı - ona %40 döner. Yaylar `CAM_YAYI` (`src/lib/hareket.ts`); "sekmesiz" kuralının (§6) Bilal'in + ona %40 döner. Yaylar kitin `SPRINGS`'i (`src/components/liquid-glass/engine.ts`); "sekmesiz" kuralının (§6) Bilal'in istediği istisnasıdır. Ölçek butonun `scale` özelliğine yazılır (yazı camla birlikte büyür); geniş butonda büyüme yan başına 6 px ile sınırlıdır (telefonda tam genişlik butonda yatay taşma olmasın; 375 px'te ölçüldü, taşma 0). @@ -2229,21 +2251,21 @@ Cam kurulunca eski `active:scale` kapanır `ArrowRight` taşıyan cam yüzeyde (`cam="cam"` CTA, karttaki "Yazıyı oku") üstüne gelince gövdenin ucu geri çekilir, ok yüksekliği çapında bir daire olarak ayrılır, aradaki sıvı köprü incelip kopar (aralık yüksekliğin dörtte biri); imleç çıkınca ve basınca geri karışır. Biçim - gölgelendiricide yumuşak birleşimdir, SVG "goo" filtresi yok. Yaylar `CAM_YAYI.damla` / - `damlaDonus`. Yerleşim: `globals.css` kuralı ikonu `data-sivi` ucundaki daire bölgesinin + gölgelendiricide yumuşak birleşimdir, SVG "goo" filtresi yok. Yaylar `SPRINGS.dropletOut` / + `dropletIn`. Yerleşim: `globals.css` kuralı ikonu `data-sivi` ucundaki daire bölgesinin ortasına yerleştirir (`--ok-cap` = buton yüksekliği, `SiviCam` ölçer), yazı kalan gövdede ortalanır; yalnız fareli cihazda. - **Kayan sekme merceği — `KayanCam`** (Bilal, 12 Kas 2026: "tab geçişinde de geçerken liquid glass olsun", "geçerken şeffaf cam olacak, örnekteki gibi"; kit `SegmentedControl`). `SecimHaplari`'nin her kullanımında (§4.22) ve liste dilim sekmelerinde (Hayal · Dengeli · Güvenli, `program-tablosu.tsx`; Bilal: "burada liquid glass geçişi yok, ekle") açılır. Seçim değişince mercek eski vurgunun yerinden yenisine - yayla kayar (`CAM_YAYI.kayma`, hafif sekme). Başta düz vurgu rengindedir (buzlu); yola çıkınca + yayla kayar (`SPRINGS.slide`, hafif sekme). Başta düz vurgu rengindedir (buzlu); yola çıkınca en %12, boy %35 şişer ve **şeffaf cama döner**: altındaki seçenekleri (çip zemini, kenarlığı, etiket, ikon) kenarında büker, ortasında %12 büyütür, kenarda renkleri hafifçe ayrıştırır; kenar ışığı, kostik ve gölge alır. Hedefe yaklaşınca buzlanıp düz vurguya oturur. **Hareket kitin aynısıdır** (Bilal: "tıklayınca, basılı tutunca davranışı aynı olmalı"): basılı tutunca mercek olduğu yerde şişip açılır (seçim değişmez); 4 px'ten sonra sürükleyince - merkezi parmağı sıkı yayla izler (`CAM_YAYI.surukleme`, 40 rad/sn, sekmesiz), bırakınca en + merkezi parmağı sıkı yayla izler (`SPRINGS.drag`, 40 rad/sn, sekmesiz), bırakınca en yakın seçenek seçilir; dokununca seçim **bırakışta** olur ve merkez yeni seçeneğe yumuşak yayla gider (`kayma`, 14 rad/sn, sekme 0,25); hedefe seçenek eninin %6'sı kalana dek mercek açık kalır. Kenar ışığı imlece dönmez (kitte yalnız butonlarda döner). Radix sekmesi basar basmaz @@ -2256,13 +2278,13 @@ Cam kurulunca eski `active:scale` kapanır cam açıldıkça söner. Kap dışındaki sayfa (ör. hero'daki piksel haritası) katmana girmez; cam orada zemin rengini gösterir. Kurulum: kap `relative isolate`, ilk çocuk ``; düz vurgu - `data-cam-vurgu` + `[[data-cam-geziyor]_&]:opacity-0!` taşır (mercek ilk karesini çizince - gizlenir); seçili seçenek `[[data-cam-yolda]_&]:…!` sınıflarıyla yoldayken seçilmemiş gibi + `data-glass-highlight` + `[[data-glass-moving]_&]:opacity-0!` taşır (mercek ilk karesini çizince + gizlenir); seçili seçenek `[[data-glass-traveling]_&]:…!` sınıflarıyla yoldayken seçilmemiş gibi boyanır (şeffaf camın altında okunsun), hedefe yaklaşınca seçili rengine camın altında döner. Durağanken görünen düz vurgudur; WebGL2 yoksa ve hareketi azalt'ta eski `layoutId` kayması/yerinde belirme aynen çalışır. Tema seçici, satır seçimi (`karsilastirma-yorungesi`) ve içindekiler çizgisi cam değildir. -- **Sade karşılık:** ilk kare çizilince butona `data-cam` yazılır ve buton turuncu zeminini +- **Sade karşılık:** ilk kare çizilince butona `data-glass-ready` yazılır ve buton turuncu zeminini bırakır. O ana kadar, WebGL2 yoksa ve bağlam kaybolursa buton eski düz turuncu CTA'dır (`hover:bg-orange-600`, `active:scale-[0.97]`); iki zemin aynı anda görünmez. - **Ne zaman çizilir:** boy ya da tema değişince, ekrana girince, imleç oynayınca ve yaylar diff --git a/eslint.config.mjs b/eslint.config.mjs index e4751bf..72fd7a4 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -17,6 +17,12 @@ const eslintConfig = defineConfig([ // Türkçe TTS sanal ortamı (scripts/seslendir.py); içindeki torch JS dosyaları lint'e girmesin. ".venv-tts/**", ]), + // Liquid Glass UI kiti (DESIGN.md §4.50) olduğu gibi kopyalanır, elle değiştirilmez; + // kitin kendi biçimindeki iki kalıp burada hata sayılmaz. + { + files: ["src/components/liquid-glass/**"], + rules: { "react-hooks/refs": "off", "prefer-const": "off" }, + }, ]); export default eslintConfig; diff --git a/next.config.ts b/next.config.ts index 4eb4086..698ea64 100644 --- a/next.config.ts +++ b/next.config.ts @@ -73,9 +73,8 @@ const nextConfig: NextConfig = { // optimize listesinde yoktur; named import'lar doğrudan alt modüle // çevrilir (dev boot / build modül grafiği küçülür). optimizePackageImports: ["radix-ui"], - // Rotalar arası çapraz solma: React + tarayıcının View - // Transitions API'si (components/sayfa-gecisi.tsx, DESIGN.md §6). - viewTransition: true, + // Rotalar arası çapraz solma (components/sayfa-gecisi.tsx, DESIGN.md §6) + // Next 16.3'ten beri ayarsız çalışır; `viewTransition` anahtarı kalktı. ...(kaynakKisitli ? { // Turbopack'ın Rust tarafı NODE_OPTIONS heap sınırını görmez; bellek diff --git a/package.json b/package.json index 87872ba..cf8ab54 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kolaytercih", - "version": "2.12.13", + "version": "2.13.0", "private": true, "engines": { "node": ">=22" @@ -50,7 +50,7 @@ "marked": "^18.0.7", "mermaid": "^11.16.0", "motion": "^12.42.2", - "next": "16.2.10", + "next": "16.3.8", "next-themes": "^0.4.6", "openai": "^7.4.0", "radix-ui": "^1.6.3", @@ -78,7 +78,7 @@ "@types/react-dom": "^19", "drizzle-kit": "^0.31.10", "eslint": "^9", - "eslint-config-next": "16.2.10", + "eslint-config-next": "16.3.8", "shadcn": "^4.13.1", "tailwindcss": "^4", "tsx": "^4.23.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c49b8a2..a06d84b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -31,7 +31,7 @@ importers: version: 7.0.127(zod@4.4.3) better-auth: specifier: ^1.6.23 - version: 1.6.23(better-sqlite3@12.11.1)(drizzle-kit@0.31.10)(drizzle-orm@0.45.2(@libsql/client@0.17.4)(@types/better-sqlite3@7.6.13)(better-sqlite3@12.11.1)(kysely@0.29.4))(next@16.2.10(@babel/core@7.29.7)(react-dom@19.2.4(react@19.2.4))(react@19.2.4))(react-dom@19.2.4(react@19.2.4))(react@19.2.4) + version: 1.6.23(better-sqlite3@12.11.1)(drizzle-kit@0.31.10)(drizzle-orm@0.45.2(@libsql/client@0.17.4)(@types/better-sqlite3@7.6.13)(better-sqlite3@12.11.1)(kysely@0.29.4))(next@16.3.8(@babel/core@7.29.7)(@types/node@20.19.43)(react-dom@19.2.4(react@19.2.4))(react@19.2.4))(react-dom@19.2.4(react@19.2.4))(react@19.2.4) better-sqlite3: specifier: ^12.11.1 version: 12.11.1 @@ -63,8 +63,8 @@ importers: specifier: ^12.42.2 version: 12.42.2(react-dom@19.2.4(react@19.2.4))(react@19.2.4) next: - specifier: 16.2.10 - version: 16.2.10(@babel/core@7.29.7)(react-dom@19.2.4(react@19.2.4))(react@19.2.4) + specifier: 16.3.8 + version: 16.3.8(@babel/core@7.29.7)(@types/node@20.19.43)(react-dom@19.2.4(react@19.2.4))(react@19.2.4) next-themes: specifier: ^0.4.6 version: 0.4.6(react-dom@19.2.4(react@19.2.4))(react@19.2.4) @@ -142,8 +142,8 @@ importers: specifier: ^9 version: 9.39.5(jiti@2.7.0) eslint-config-next: - specifier: 16.2.10 - version: 16.2.10(@typescript-eslint/parser@8.65.0(eslint@9.39.5(jiti@2.7.0))(typescript@5.9.3))(eslint@9.39.5(jiti@2.7.0))(typescript@5.9.3) + specifier: 16.3.8 + version: 16.3.8(@typescript-eslint/parser@8.65.0(eslint@9.39.5(jiti@2.7.0))(typescript@5.9.3))(eslint@9.39.5(jiti@2.7.0))(typescript@5.9.3) shadcn: specifier: ^4.13.1 version: 4.13.1(typescript@5.9.3) @@ -433,8 +433,8 @@ packages: '@emnapi/runtime@1.10.0': resolution: {integrity: sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==} - '@emnapi/runtime@1.11.2': - resolution: {integrity: sha512-kyOl3X0DuTiT1h2ft8r2fYO8JYtU9a9Xis/zBSiGArNaagCOWx90N1k2wxp18czFDH+OgcWGb5ZP/XMt3dcyPA==} + '@emnapi/runtime@1.11.3': + resolution: {integrity: sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==} '@emnapi/wasi-threads@1.2.1': resolution: {integrity: sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==} @@ -980,136 +980,145 @@ packages: resolution: {integrity: sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==} engines: {node: '>=18'} - '@img/sharp-darwin-arm64@0.34.5': - resolution: {integrity: sha512-imtQ3WMJXbMY4fxb/Ndp6HBTNVtWCUI0WdobyheGf5+ad6xX8VIDO8u2xE4qc/fr08CKG/7dDseFtn6M6g/r3w==} - engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + '@img/sharp-darwin-arm64@0.35.5': + resolution: {integrity: sha512-QRUlFQ0WxvdWyqqG/WtI3iupfD5rBzmCHXSdPsY91sAtVtTo7Q4cb6zOccZ3gqEqkr0f1As1ehLqmEpDsRf+lg==} + engines: {node: '>=20.9.0'} cpu: [arm64] os: [darwin] - '@img/sharp-darwin-x64@0.34.5': - resolution: {integrity: sha512-YNEFAF/4KQ/PeW0N+r+aVVsoIY0/qxxikF2SWdp+NRkmMB7y9LBZAVqQ4yhGCm/H3H270OSykqmQMKLBhBJDEw==} - engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + '@img/sharp-darwin-x64@0.35.5': + resolution: {integrity: sha512-+BR255RhDlpygUpOc/Jdt1nT6DQ3XG/ERo5wbcdOf5Q320dKtPCKPLR1LJs9VGXRaMa8l1uUa0tkCNOXiAxZUw==} + engines: {node: '>=20.9.0'} cpu: [x64] os: [darwin] - '@img/sharp-libvips-darwin-arm64@1.2.4': - resolution: {integrity: sha512-zqjjo7RatFfFoP0MkQ51jfuFZBnVE2pRiaydKJ1G/rHZvnsrHAOcQALIi9sA5co5xenQdTugCvtb1cuf78Vf4g==} + '@img/sharp-freebsd-wasm32@0.35.5': + resolution: {integrity: sha512-Y/z91nEZ4uIBX5X3nfTovjU9lHNKFYbL2lpHCLVNmXQK03VIZvXBBt0KxbPGp2SdGSF+2mQU4e+hQaWOt86iAw==} + engines: {node: '>=20.9.0'} + os: [freebsd] + + '@img/sharp-libvips-darwin-arm64@1.3.4': + resolution: {integrity: sha512-5R89nBYiRdUlSWJxPhO+GVtaXzXSxKnRu/xqMn3KTA3L9EB9Oy/P+Nn2f2vlhPuUdy/Zusb2DarbyTpGCfEDuw==} cpu: [arm64] os: [darwin] - '@img/sharp-libvips-darwin-x64@1.2.4': - resolution: {integrity: sha512-1IOd5xfVhlGwX+zXv2N93k0yMONvUlANylbJw1eTah8K/Jtpi15KC+WSiaX/nBmbm2HxRM1gZ0nSdjSsrZbGKg==} + '@img/sharp-libvips-darwin-x64@1.3.4': + resolution: {integrity: sha512-iR2OKH80yi0U+dUplyh3/xdpFvps6YkCwsXenIJxqxR1v9o+xtKTGbS9H7cps+2Vxjc8B1j96p75NmTGjIhtpQ==} cpu: [x64] os: [darwin] - '@img/sharp-libvips-linux-arm64@1.2.4': - resolution: {integrity: sha512-excjX8DfsIcJ10x1Kzr4RcWe1edC9PquDRRPx3YVCvQv+U5p7Yin2s32ftzikXojb1PIFc/9Mt28/y+iRklkrw==} + '@img/sharp-libvips-linux-arm64@1.3.4': + resolution: {integrity: sha512-Y3dgX/6lE2QhQb+Gxy0WZxfg9MEm/JBjamZpS2IklP7xIQoKN4hzAm7KcMVGtaVDt3neE9OKBC7vAfonA/Lr1A==} cpu: [arm64] os: [linux] - '@img/sharp-libvips-linux-arm@1.2.4': - resolution: {integrity: sha512-bFI7xcKFELdiNCVov8e44Ia4u2byA+l3XtsAj+Q8tfCwO6BQ8iDojYdvoPMqsKDkuoOo+X6HZA0s0q11ANMQ8A==} + '@img/sharp-libvips-linux-arm@1.3.4': + resolution: {integrity: sha512-LmRtTsOHuvM2+wlO2Db37dx5MiZhB0FvSunciw48YjdOkZz9KAiRbm8ujeMOA1INqmei5NapFxYEK1D1ZSidmw==} cpu: [arm] os: [linux] - '@img/sharp-libvips-linux-ppc64@1.2.4': - resolution: {integrity: sha512-FMuvGijLDYG6lW+b/UvyilUWu5Ayu+3r2d1S8notiGCIyYU/76eig1UfMmkZ7vwgOrzKzlQbFSuQfgm7GYUPpA==} + '@img/sharp-libvips-linux-ppc64@1.3.4': + resolution: {integrity: sha512-Le6boB8Tai0Nis+gIxIpKx68UDVVIqdR8Tin5Yf1z2LJJQLDJvCDRqRu+jC2qCoD+eIomonmOwB4smBRxfVpYQ==} cpu: [ppc64] os: [linux] - '@img/sharp-libvips-linux-riscv64@1.2.4': - resolution: {integrity: sha512-oVDbcR4zUC0ce82teubSm+x6ETixtKZBh/qbREIOcI3cULzDyb18Sr/Wcyx7NRQeQzOiHTNbZFF1UwPS2scyGA==} + '@img/sharp-libvips-linux-riscv64@1.3.4': + resolution: {integrity: sha512-aHkkIEHPRdQEegJN20MLmGtxYD9R2wQr3Cwpddnu5+YKMt6Uzax7S9h5gpZTo8wyrGuZSlfQ63OevL5mTyOC7Q==} cpu: [riscv64] os: [linux] - '@img/sharp-libvips-linux-s390x@1.2.4': - resolution: {integrity: sha512-qmp9VrzgPgMoGZyPvrQHqk02uyjA0/QrTO26Tqk6l4ZV0MPWIW6LTkqOIov+J1yEu7MbFQaDpwdwJKhbJvuRxQ==} + '@img/sharp-libvips-linux-s390x@1.3.4': + resolution: {integrity: sha512-ra/mB6MikESDUO7Yg+Mi95bFBb9GsObURuhnOv3OqknjGe9sZrG8tCe9q0xSIGrtLgvgw0gKnFWcK4blSgQOuQ==} cpu: [s390x] os: [linux] - '@img/sharp-libvips-linux-x64@1.2.4': - resolution: {integrity: sha512-tJxiiLsmHc9Ax1bz3oaOYBURTXGIRDODBqhveVHonrHJ9/+k89qbLl0bcJns+e4t4rvaNBxaEZsFtSfAdquPrw==} + '@img/sharp-libvips-linux-x64@1.3.4': + resolution: {integrity: sha512-GJ//SSXbnwSDes02umB3nDJLFcQzw8a18V8fyhqr6tV515tOEMdImjjxj1AoafMRz56F3PHgftnj1QEKSU1zkw==} cpu: [x64] os: [linux] - '@img/sharp-libvips-linuxmusl-arm64@1.2.4': - resolution: {integrity: sha512-FVQHuwx1IIuNow9QAbYUzJ+En8KcVm9Lk5+uGUQJHaZmMECZmOlix9HnH7n1TRkXMS0pGxIJokIVB9SuqZGGXw==} + '@img/sharp-libvips-linuxmusl-arm64@1.3.4': + resolution: {integrity: sha512-hvulFwtjUcagsis6BBxHwGFwWoNZjgYmULGVrZcyfNbjA8hKILbRxGg15/7w5HDyXHXUos/j6baAWqnCyQ2DWA==} cpu: [arm64] os: [linux] - '@img/sharp-libvips-linuxmusl-x64@1.2.4': - resolution: {integrity: sha512-+LpyBk7L44ZIXwz/VYfglaX/okxezESc6UxDSoyo2Ks6Jxc4Y7sGjpgU9s4PMgqgjj1gZCylTieNamqA1MF7Dg==} + '@img/sharp-libvips-linuxmusl-x64@1.3.4': + resolution: {integrity: sha512-6zXKeE/p39I1AmA3cJG35eyBGNqNddLnUXjhwBnsGjFPWqf5VKkDBEqaEkPDoTEtkxwi2vv8Tcr2mDyP4So7Fg==} cpu: [x64] os: [linux] - '@img/sharp-linux-arm64@0.34.5': - resolution: {integrity: sha512-bKQzaJRY/bkPOXyKx5EVup7qkaojECG6NLYswgktOZjaXecSAeCWiZwwiFf3/Y+O1HrauiE3FVsGxFg8c24rZg==} - engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + '@img/sharp-linux-arm64@0.35.5': + resolution: {integrity: sha512-LYVx5JTsOM2CBzmxreh+nl64/3H6Xb09iSLknqH47z2T2DFFxDeFLP5y4dJwe6H7uGQlHPyEEtIqyo3DYsRwdQ==} + engines: {node: '>=20.9.0'} cpu: [arm64] os: [linux] - '@img/sharp-linux-arm@0.34.5': - resolution: {integrity: sha512-9dLqsvwtg1uuXBGZKsxem9595+ujv0sJ6Vi8wcTANSFpwV/GONat5eCkzQo/1O6zRIkh0m/8+5BjrRr7jDUSZw==} - engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + '@img/sharp-linux-arm@0.35.5': + resolution: {integrity: sha512-LEaXK2WdXVK5ykcw0buWyPMsmLLL2vpHLD6yrNSW+JGEL3BZPA4tpKN6iaMc4AxTTAoaX/sU1rOL51lcIz48ZQ==} + engines: {node: '>=20.9.0'} cpu: [arm] os: [linux] - '@img/sharp-linux-ppc64@0.34.5': - resolution: {integrity: sha512-7zznwNaqW6YtsfrGGDA6BRkISKAAE1Jo0QdpNYXNMHu2+0dTrPflTLNkpc8l7MUP5M16ZJcUvysVWWrMefZquA==} - engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + '@img/sharp-linux-ppc64@0.35.5': + resolution: {integrity: sha512-QVxAAq8evVRI9ia2vqgwrmWucn5Dfv+JdWzj75pD8omHLPSP7f8p20O8jxzjCcuCEQEOtYOZUmX1hkiZ0kdevA==} + engines: {node: '>=20.9.0'} cpu: [ppc64] os: [linux] - '@img/sharp-linux-riscv64@0.34.5': - resolution: {integrity: sha512-51gJuLPTKa7piYPaVs8GmByo7/U7/7TZOq+cnXJIHZKavIRHAP77e3N2HEl3dgiqdD/w0yUfiJnII77PuDDFdw==} - engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + '@img/sharp-linux-riscv64@0.35.5': + resolution: {integrity: sha512-LtdreXguaavKODPIfzJ4kffx7UNt1omwtK0rch4EBbbSTXPnxWmYSayXdLJw0fJzQ97kHt1gL/yh4tvU+nCyRQ==} + engines: {node: '>=20.9.0'} cpu: [riscv64] os: [linux] - '@img/sharp-linux-s390x@0.34.5': - resolution: {integrity: sha512-nQtCk0PdKfho3eC5MrbQoigJ2gd1CgddUMkabUj+rBevs8tZ2cULOx46E7oyX+04WGfABgIwmMC0VqieTiR4jg==} - engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + '@img/sharp-linux-s390x@0.35.5': + resolution: {integrity: sha512-UZasTOFiYzotTsGOCu42BfUzP6Tu6Do/947iRm1RsLKvlllxwGcn4RN27LibGWceix4Y+Pmw3jsnTcCQIgWjqA==} + engines: {node: '>=20.9.0'} cpu: [s390x] os: [linux] - '@img/sharp-linux-x64@0.34.5': - resolution: {integrity: sha512-MEzd8HPKxVxVenwAa+JRPwEC7QFjoPWuS5NZnBt6B3pu7EG2Ge0id1oLHZpPJdn3OQK+BQDiw9zStiHBTJQQQQ==} - engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + '@img/sharp-linux-x64@0.35.5': + resolution: {integrity: sha512-SxFtLTeJInhAA9Q836kux2vZNeOBQEx658qvbboZScr0wIARym3IcGmW7KpVD5sbVg0Ojy+udFQdayYIZyoNog==} + engines: {node: '>=20.9.0'} cpu: [x64] os: [linux] - '@img/sharp-linuxmusl-arm64@0.34.5': - resolution: {integrity: sha512-fprJR6GtRsMt6Kyfq44IsChVZeGN97gTD331weR1ex1c1rypDEABN6Tm2xa1wE6lYb5DdEnk03NZPqA7Id21yg==} - engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + '@img/sharp-linuxmusl-arm64@0.35.5': + resolution: {integrity: sha512-9HbMclmI1zlNkFRs3z9/eBtDjfD0sGlrX1z6b1qwmiFY5ElDLh4BC0LPBdVp7z1DXFiKlIcznf+ZlsuZzLxQqg==} + engines: {node: '>=20.9.0'} cpu: [arm64] os: [linux] - '@img/sharp-linuxmusl-x64@0.34.5': - resolution: {integrity: sha512-Jg8wNT1MUzIvhBFxViqrEhWDGzqymo3sV7z7ZsaWbZNDLXRJZoRGrjulp60YYtV4wfY8VIKcWidjojlLcWrd8Q==} - engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + '@img/sharp-linuxmusl-x64@0.35.5': + resolution: {integrity: sha512-4KOphqB035HrVdqLZfCgMzzERrQkkzOwRhl4OAkRO1YCldbaFjySXMaK534Mo0V+LndnlJk+sbUyLeU0ULyD1A==} + engines: {node: '>=20.9.0'} cpu: [x64] os: [linux] - '@img/sharp-wasm32@0.34.5': - resolution: {integrity: sha512-OdWTEiVkY2PHwqkbBI8frFxQQFekHaSSkUIJkwzclWZe64O1X4UlUjqqqLaPbUpMOQk6FBu/HtlGXNblIs0huw==} - engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + '@img/sharp-wasm32@0.35.5': + resolution: {integrity: sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ==} + engines: {node: '>=20.9.0'} + + '@img/sharp-webcontainers-wasm32@0.35.5': + resolution: {integrity: sha512-hfhF/FmoQyTUkA0bIKFOtw536BQSeBMe6BF6QyWlrPxT754+TFLaZ7sKKTfvvM0yJgKgaYTwnFCIZ/GuDw5SUA==} + engines: {node: '>=20.9.0'} cpu: [wasm32] - '@img/sharp-win32-arm64@0.34.5': - resolution: {integrity: sha512-WQ3AgWCWYSb2yt+IG8mnC6Jdk9Whs7O0gxphblsLvdhSpSTtmu69ZG1Gkb6NuvxsNACwiPV6cNSZNzt0KPsw7g==} - engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + '@img/sharp-win32-arm64@0.35.5': + resolution: {integrity: sha512-X4t7g+7ZA5DKblCBEXGjUqqemj4vczING/5viFwAL8h4N3qYeyjwdCvRLHi4EdOUI+2Z7UFlp1VM+p/AuEtm6Q==} + engines: {node: '>=20.9.0'} cpu: [arm64] os: [win32] - '@img/sharp-win32-ia32@0.34.5': - resolution: {integrity: sha512-FV9m/7NmeCmSHDD5j4+4pNI8Cp3aW+JvLoXcTUo0IqyjSfAZJ8dIUmijx1qaJsIiU+Hosw6xM5KijAWRJCSgNg==} - engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + '@img/sharp-win32-ia32@0.35.5': + resolution: {integrity: sha512-5Zm82LoBc43nhwNybZlG7Y1KO//Zhsn306fQl29ZOuStHLGTo3BWL83q3cznX0poxSAMuYL1On/BHBxkBeKr6A==} + engines: {node: ^20.9.0} cpu: [ia32] os: [win32] - '@img/sharp-win32-x64@0.34.5': - resolution: {integrity: sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw==} - engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + '@img/sharp-win32-x64@0.35.5': + resolution: {integrity: sha512-x76eH0vEiHlcMQu8Y8IenntaACtddpT6W0wmXtWrnKcnKI7ME5DdgqhAD6SEWOEl1v2zDvkZDhFA9KnURwpfqg==} + engines: {node: '>=20.9.0'} cpu: [x64] os: [win32] @@ -1208,56 +1217,56 @@ packages: '@neon-rs/load@0.0.4': resolution: {integrity: sha512-kTPhdZyTQxB+2wpiRcFWrDcejc4JI6tkPuS7UZCG4l6Zvc5kU/gGQ/ozvHTh1XR5tS+UlfAfGuPajjzQjCiHCw==} - '@next/env@16.2.10': - resolution: {integrity: sha512-zLPxg9M0MEHmygpj5OuxjQ+vHMiy/K7cSp74G8ecYolmgUWw0RwN02tF56npup/+qaI8JB97hQgS/r2Hb6QwVA==} + '@next/env@16.3.8': + resolution: {integrity: sha512-Al9zqHVV7TJv0eFuOU4U7Lvv74PTih4Ch63sk2xCIpSTkE3udFnaOcnzP2lQVymiL7yS9Cj2iClUXlR3EQ5sEw==} - '@next/eslint-plugin-next@16.2.10': - resolution: {integrity: sha512-Gs8D2m21VnJeFo9qvYIIqJH94frWerWYu41BprU1pLtRVF7PCQNLiFZZ3fG+iPuj3K83Cwv/rt+msLOy8Qgu3Q==} + '@next/eslint-plugin-next@16.3.8': + resolution: {integrity: sha512-eCR9RcLTZrVS+K3+VOhi0xMdUUGNuriCHHhU1ZoABC/QQ/Gp0OWbLKQxV2/9DkmihYdYRcQWFmZXW8M1AMUXYw==} - '@next/swc-darwin-arm64@16.2.10': - resolution: {integrity: sha512-v9IdJCa0H0mbo+8z5zwUpOk1Vj7RjkcI5uNYf5Ws1y6szf/p3Mzl9hLaST8SCt6L9h8NGnruZcd2+o0NTNwDhA==} + '@next/swc-darwin-arm64@16.3.8': + resolution: {integrity: sha512-2JPRMh2nmQG5CiL7cXGL9AGwnPWJQ//cTtAUCT+w511QHk79SYz3LGv/pc5X643B/WEO0rvu3Yww0hqwt3kgeA==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] - '@next/swc-darwin-x64@16.2.10': - resolution: {integrity: sha512-17IS0jJRViROGmA9uGdNR8VPJpfbnaVG7E9qhso5jDLkmyd0lSDORWxbcKINzcFqzZqGwGtMSnrFRxBpuUYjLQ==} + '@next/swc-darwin-x64@16.3.8': + resolution: {integrity: sha512-GZtCCOBKJ4leVIT/Th0llWKhD1ca92lzbQiS5R5ON9QkoiFnilFsebDae1JU2a3HWoKMEmEZWGs1AGLavVM72Q==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] - '@next/swc-linux-arm64-gnu@16.2.10': - resolution: {integrity: sha512-GRQRsRtuciNJvB54AvvuQTiq0oZtFwa1owQqtZD8wwnGpM2L39MV22kpI72YSXLKIyY40LC66EiLFv4PiicXxg==} + '@next/swc-linux-arm64-gnu@16.3.8': + resolution: {integrity: sha512-O659ygeQYqneJ1fBKMpFxIFqYkYswu8IAS1OCKK/4f3ZgJJm1dRz4fVJZRi/kLLWjnBKnebOePA4WNv+sV1pVA==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@next/swc-linux-arm64-musl@16.2.10': - resolution: {integrity: sha512-zkN9MQYS7UQBro+FnISUq1itaQjXI9xqISzuQ+2bc921NcJ1x4yPCqrn77tVN6/dOOXaaWVX3k6/bR07pPwK+A==} + '@next/swc-linux-arm64-musl@16.3.8': + resolution: {integrity: sha512-dSjKSyWpzxoO1d3DIZZcP4XJcNaKeLmxQMFOiYl5vuBRMmweIqnAhty8tAmRsvTss779cK1FtYnDMj40e4TQlg==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@next/swc-linux-x64-gnu@16.2.10': - resolution: {integrity: sha512-iCVJnwvrPYECvA6WM/7+oo+OiTvedIKLxtCLAZP4xZR3nXa1zmzZyLPbYCmWvpd4CvMYF1EMTafd0ii3DygLvA==} + '@next/swc-linux-x64-gnu@16.3.8': + resolution: {integrity: sha512-lbqOuz3RPRcv+o9msNsJw5x4+Y1ZwPTs6vmL6DCf7i0fZfvng/F59wyeDwqHIvV0mK//RBy/jJkZ+nCKsSMXjQ==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@next/swc-linux-x64-musl@16.2.10': - resolution: {integrity: sha512-ov2g4H0dHY9bPoOU83m91hWT7Iq5qy13bUnyyshLU3HGR1Ownn0X9QpmDPc5iIUaahTp7f7LeGAhV4DSFtackw==} + '@next/swc-linux-x64-musl@16.3.8': + resolution: {integrity: sha512-+316WswI8ScVgZeUd+1KGaXkHhaYQzCjvH/05TZSpJ8zBizb1a4G7DtO7F12jcBIqMOtsz9ji1t48fmKtzqsGA==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@next/swc-win32-arm64-msvc@16.2.10': - resolution: {integrity: sha512-DwAnhLX76HQiFFQNgWlcK+JzlnD1rZ+UK/WY0ZMI/deXpvgnesjNYrqcfo1JzBuz4Kf7o3brIBL0glI1junatA==} + '@next/swc-win32-arm64-msvc@16.3.8': + resolution: {integrity: sha512-ji0gd4kMYUxO+1fJBIbiBVRCjzG/lloiyCccnlebvb1ZJ5qXCPZqYg4Jl1DrrixnWNMKylzgpmMWx0yNDYXlzw==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] - '@next/swc-win32-x64-msvc@16.2.10': - resolution: {integrity: sha512-0JXq3b85Jk9Jg4ntLUbXSPvoDw3gpZou7twuKdoFG2jOw635v7+IiXfTaa0TxVMyx78pUjnrVYwLgjKfX4e6/A==} + '@next/swc-win32-x64-msvc@16.3.8': + resolution: {integrity: sha512-WcTlaKt/TWkh5kUjdJcUmB1XgZ+1c6fz4Y9fDHL73YNSdGaUWjceeWrrlwF0nv19iABYWC4iAq1oX1w4Bn0vfg==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -2063,8 +2072,8 @@ packages: '@standard-schema/spec@1.1.0': resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==} - '@swc/helpers@0.5.15': - resolution: {integrity: sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==} + '@swc/helpers@0.5.23': + resolution: {integrity: sha512-5lSsMOTXURePglDfvuAQUqkGek9Hg2kksOYay2m0+XR++b2NWYL/4sWyuvVBIs8oKnJaxkdi9whaL/sqN13afw==} '@tailwindcss/node@4.3.3': resolution: {integrity: sha512-/T8IKEsf9VTU6tLjgC7+sv2mOPtQxzE2jMw7u4Tt40Tx+QSZxpzh95/H6cMKoja9XuW7iMdLJYBB0o9G1CaAgg==} @@ -3449,8 +3458,8 @@ packages: resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==} engines: {node: '>=12'} - eslint-config-next@16.2.10: - resolution: {integrity: sha512-HSybLOY0QKf39i4FWUqPN0xWiNDi6A6UqJmZtgDkS3zMqjXTqULvj/sueXx3cdCG0mVG+qH6k5/qdegklH1d1w==} + eslint-config-next@16.3.8: + resolution: {integrity: sha512-81vovwMe6NGnoFsl0KUJWzlS+y239i3fdsxs49gSEX3pDQW2cuKy+fxUPXNkQqqx6OCPheYPtBlSufc9aZ0k+w==} peerDependencies: eslint: '>=9.0.0' typescript: '>=3.3.1' @@ -4664,8 +4673,8 @@ packages: react: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc react-dom: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc - next@16.2.10: - resolution: {integrity: sha512-2som5AVXb3kE6Yjine3/mNbBayYF58eguBWIVVUdr1y/L426xyVEgYxgBG+1QC34P2x5E+tcDup6XkuOAX3dCA==} + next@16.3.8: + resolution: {integrity: sha512-U7QEZaTini6wKrb8A8hqLLqYQyCetegKjCpJOyxk642vWoMoU1x5PyZCJFvgYgiptA8xc5j/9xYlZFO7w9Sjmw==} engines: {node: '>=20.9.0'} hasBin: true peerDependencies: @@ -4912,14 +4921,14 @@ packages: resolution: {integrity: sha512-HeP7D2wyhkR+XaK6v4W8oRF62Dsz4flyuczALJp61GckGm42u1saSSJ/0auvcBqxs3jMRFEcPK34At/0JBKdOg==} engines: {node: '>=4'} - postcss@8.4.31: - resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==} - engines: {node: ^10 || ^12 || >=14} - postcss@8.5.21: resolution: {integrity: sha512-v4sDNP3fdNiWMfabO7OwOQdOX8TiQSztKyT1Wj0w+j7LDallJThJRBBBmzVGyYj0crMh7jlV4zepPkiNu9UwDQ==} engines: {node: ^10 || ^12 || >=14} + postcss@8.5.23: + resolution: {integrity: sha512-g50586zr4bZmwFiTlflMu8E0bDTb5I5gertgwAKmsdUlTQIhZtunzUlD1WSzwcVWPoAVpsrA6vlfCD7oXvRwgg==} + engines: {node: ^10 || ^12 || >=14} + postman-request@2.88.1-postman.48: resolution: {integrity: sha512-E32FGh8ig2KDvzo4Byi7Ibr+wK2gNKPSqXoNsvjdCHgDBxSK4sCUwv+aa3zOBUwfiibPImHMy0WdlDSSCTqTuw==} engines: {node: '>= 16'} @@ -5228,9 +5237,14 @@ packages: engines: {node: '>=20.18.1'} hasBin: true - sharp@0.34.5: - resolution: {integrity: sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg==} - engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0} + sharp@0.35.5: + resolution: {integrity: sha512-Ywn4OnzGukp7CDMrp08RQ50YKmuwG47brZgIVPTvBaaAfQlRlygrRqSrxdCiL9M+LlzLBiJ68IR1QqvzHyjC7g==} + engines: {node: '>=20.9.0'} + peerDependencies: + '@types/node': '*' + peerDependenciesMeta: + '@types/node': + optional: true shebang-command@2.0.0: resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} @@ -6101,7 +6115,7 @@ snapshots: tslib: 2.8.1 optional: true - '@emnapi/runtime@1.11.2': + '@emnapi/runtime@1.11.3': dependencies: tslib: 2.8.1 optional: true @@ -6437,98 +6451,108 @@ snapshots: '@img/colour@1.1.0': optional: true - '@img/sharp-darwin-arm64@0.34.5': + '@img/sharp-darwin-arm64@0.35.5': optionalDependencies: - '@img/sharp-libvips-darwin-arm64': 1.2.4 + '@img/sharp-libvips-darwin-arm64': 1.3.4 optional: true - '@img/sharp-darwin-x64@0.34.5': + '@img/sharp-darwin-x64@0.35.5': optionalDependencies: - '@img/sharp-libvips-darwin-x64': 1.2.4 + '@img/sharp-libvips-darwin-x64': 1.3.4 optional: true - '@img/sharp-libvips-darwin-arm64@1.2.4': - optional: true - - '@img/sharp-libvips-darwin-x64@1.2.4': - optional: true - - '@img/sharp-libvips-linux-arm64@1.2.4': - optional: true - - '@img/sharp-libvips-linux-arm@1.2.4': - optional: true - - '@img/sharp-libvips-linux-ppc64@1.2.4': - optional: true - - '@img/sharp-libvips-linux-riscv64@1.2.4': - optional: true - - '@img/sharp-libvips-linux-s390x@1.2.4': - optional: true - - '@img/sharp-libvips-linux-x64@1.2.4': - optional: true - - '@img/sharp-libvips-linuxmusl-arm64@1.2.4': - optional: true - - '@img/sharp-libvips-linuxmusl-x64@1.2.4': - optional: true - - '@img/sharp-linux-arm64@0.34.5': - optionalDependencies: - '@img/sharp-libvips-linux-arm64': 1.2.4 - optional: true - - '@img/sharp-linux-arm@0.34.5': - optionalDependencies: - '@img/sharp-libvips-linux-arm': 1.2.4 - optional: true - - '@img/sharp-linux-ppc64@0.34.5': - optionalDependencies: - '@img/sharp-libvips-linux-ppc64': 1.2.4 - optional: true - - '@img/sharp-linux-riscv64@0.34.5': - optionalDependencies: - '@img/sharp-libvips-linux-riscv64': 1.2.4 - optional: true - - '@img/sharp-linux-s390x@0.34.5': - optionalDependencies: - '@img/sharp-libvips-linux-s390x': 1.2.4 - optional: true - - '@img/sharp-linux-x64@0.34.5': - optionalDependencies: - '@img/sharp-libvips-linux-x64': 1.2.4 - optional: true - - '@img/sharp-linuxmusl-arm64@0.34.5': - optionalDependencies: - '@img/sharp-libvips-linuxmusl-arm64': 1.2.4 - optional: true - - '@img/sharp-linuxmusl-x64@0.34.5': - optionalDependencies: - '@img/sharp-libvips-linuxmusl-x64': 1.2.4 - optional: true - - '@img/sharp-wasm32@0.34.5': + '@img/sharp-freebsd-wasm32@0.35.5': dependencies: - '@emnapi/runtime': 1.11.2 + '@img/sharp-wasm32': 0.35.5 optional: true - '@img/sharp-win32-arm64@0.34.5': + '@img/sharp-libvips-darwin-arm64@1.3.4': optional: true - '@img/sharp-win32-ia32@0.34.5': + '@img/sharp-libvips-darwin-x64@1.3.4': optional: true - '@img/sharp-win32-x64@0.34.5': + '@img/sharp-libvips-linux-arm64@1.3.4': + optional: true + + '@img/sharp-libvips-linux-arm@1.3.4': + optional: true + + '@img/sharp-libvips-linux-ppc64@1.3.4': + optional: true + + '@img/sharp-libvips-linux-riscv64@1.3.4': + optional: true + + '@img/sharp-libvips-linux-s390x@1.3.4': + optional: true + + '@img/sharp-libvips-linux-x64@1.3.4': + optional: true + + '@img/sharp-libvips-linuxmusl-arm64@1.3.4': + optional: true + + '@img/sharp-libvips-linuxmusl-x64@1.3.4': + optional: true + + '@img/sharp-linux-arm64@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linux-arm64': 1.3.4 + optional: true + + '@img/sharp-linux-arm@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linux-arm': 1.3.4 + optional: true + + '@img/sharp-linux-ppc64@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linux-ppc64': 1.3.4 + optional: true + + '@img/sharp-linux-riscv64@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linux-riscv64': 1.3.4 + optional: true + + '@img/sharp-linux-s390x@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linux-s390x': 1.3.4 + optional: true + + '@img/sharp-linux-x64@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linux-x64': 1.3.4 + optional: true + + '@img/sharp-linuxmusl-arm64@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linuxmusl-arm64': 1.3.4 + optional: true + + '@img/sharp-linuxmusl-x64@0.35.5': + optionalDependencies: + '@img/sharp-libvips-linuxmusl-x64': 1.3.4 + optional: true + + '@img/sharp-wasm32@0.35.5': + dependencies: + '@emnapi/runtime': 1.11.3 + optional: true + + '@img/sharp-webcontainers-wasm32@0.35.5': + dependencies: + '@img/sharp-wasm32': 0.35.5 + optional: true + + '@img/sharp-win32-arm64@0.35.5': + optional: true + + '@img/sharp-win32-ia32@0.35.5': + optional: true + + '@img/sharp-win32-x64@0.35.5': optional: true '@jridgewell/gen-mapping@0.3.13': @@ -6643,34 +6667,37 @@ snapshots: '@neon-rs/load@0.0.4': {} - '@next/env@16.2.10': {} + '@next/env@16.3.8': {} - '@next/eslint-plugin-next@16.2.10': + '@next/eslint-plugin-next@16.3.8(eslint@9.39.5(jiti@2.7.0))': dependencies: + '@eslint-community/eslint-utils': 4.9.1(eslint@9.39.5(jiti@2.7.0)) fast-glob: 3.3.1 + transitivePeerDependencies: + - eslint - '@next/swc-darwin-arm64@16.2.10': + '@next/swc-darwin-arm64@16.3.8': optional: true - '@next/swc-darwin-x64@16.2.10': + '@next/swc-darwin-x64@16.3.8': optional: true - '@next/swc-linux-arm64-gnu@16.2.10': + '@next/swc-linux-arm64-gnu@16.3.8': optional: true - '@next/swc-linux-arm64-musl@16.2.10': + '@next/swc-linux-arm64-musl@16.3.8': optional: true - '@next/swc-linux-x64-gnu@16.2.10': + '@next/swc-linux-x64-gnu@16.3.8': optional: true - '@next/swc-linux-x64-musl@16.2.10': + '@next/swc-linux-x64-musl@16.3.8': optional: true - '@next/swc-win32-arm64-msvc@16.2.10': + '@next/swc-win32-arm64-msvc@16.3.8': optional: true - '@next/swc-win32-x64-msvc@16.2.10': + '@next/swc-win32-x64-msvc@16.3.8': optional: true '@noble/ciphers@2.2.0': {} @@ -7516,7 +7543,7 @@ snapshots: '@standard-schema/spec@1.1.0': {} - '@swc/helpers@0.5.15': + '@swc/helpers@0.5.23': dependencies: tslib: 2.8.1 @@ -8117,7 +8144,7 @@ snapshots: dependencies: tweetnacl: 0.14.5 - better-auth@1.6.23(better-sqlite3@12.11.1)(drizzle-kit@0.31.10)(drizzle-orm@0.45.2(@libsql/client@0.17.4)(@types/better-sqlite3@7.6.13)(better-sqlite3@12.11.1)(kysely@0.29.4))(next@16.2.10(@babel/core@7.29.7)(react-dom@19.2.4(react@19.2.4))(react@19.2.4))(react-dom@19.2.4(react@19.2.4))(react@19.2.4): + better-auth@1.6.23(better-sqlite3@12.11.1)(drizzle-kit@0.31.10)(drizzle-orm@0.45.2(@libsql/client@0.17.4)(@types/better-sqlite3@7.6.13)(better-sqlite3@12.11.1)(kysely@0.29.4))(next@16.3.8(@babel/core@7.29.7)(@types/node@20.19.43)(react-dom@19.2.4(react@19.2.4))(react@19.2.4))(react-dom@19.2.4(react@19.2.4))(react@19.2.4): dependencies: '@better-auth/core': 1.6.23(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.3)(kysely@0.29.4)(nanostores@1.4.1) '@better-auth/drizzle-adapter': 1.6.23(@better-auth/core@1.6.23(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.3)(kysely@0.29.4)(nanostores@1.4.1))(@better-auth/utils@0.4.2)(drizzle-orm@0.45.2(@libsql/client@0.17.4)(@types/better-sqlite3@7.6.13)(better-sqlite3@12.11.1)(kysely@0.29.4)) @@ -8140,7 +8167,7 @@ snapshots: better-sqlite3: 12.11.1 drizzle-kit: 0.31.10 drizzle-orm: 0.45.2(@libsql/client@0.17.4)(@types/better-sqlite3@7.6.13)(better-sqlite3@12.11.1)(kysely@0.29.4) - next: 16.2.10(@babel/core@7.29.7)(react-dom@19.2.4(react@19.2.4))(react@19.2.4) + next: 16.3.8(@babel/core@7.29.7)(@types/node@20.19.43)(react-dom@19.2.4(react@19.2.4))(react@19.2.4) react: 19.2.4 react-dom: 19.2.4(react@19.2.4) transitivePeerDependencies: @@ -8918,9 +8945,9 @@ snapshots: escape-string-regexp@5.0.0: {} - eslint-config-next@16.2.10(@typescript-eslint/parser@8.65.0(eslint@9.39.5(jiti@2.7.0))(typescript@5.9.3))(eslint@9.39.5(jiti@2.7.0))(typescript@5.9.3): + eslint-config-next@16.3.8(@typescript-eslint/parser@8.65.0(eslint@9.39.5(jiti@2.7.0))(typescript@5.9.3))(eslint@9.39.5(jiti@2.7.0))(typescript@5.9.3): dependencies: - '@next/eslint-plugin-next': 16.2.10 + '@next/eslint-plugin-next': 16.3.8(eslint@9.39.5(jiti@2.7.0)) eslint: 9.39.5(jiti@2.7.0) eslint-import-resolver-node: 0.3.10 eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.32.0)(eslint@9.39.5(jiti@2.7.0)) @@ -10387,28 +10414,29 @@ snapshots: react: 19.2.4 react-dom: 19.2.4(react@19.2.4) - next@16.2.10(@babel/core@7.29.7)(react-dom@19.2.4(react@19.2.4))(react@19.2.4): + next@16.3.8(@babel/core@7.29.7)(@types/node@20.19.43)(react-dom@19.2.4(react@19.2.4))(react@19.2.4): dependencies: - '@next/env': 16.2.10 - '@swc/helpers': 0.5.15 + '@next/env': 16.3.8 + '@swc/helpers': 0.5.23 baseline-browser-mapping: 2.10.44 caniuse-lite: 1.0.30001806 - postcss: 8.4.31 + postcss: 8.5.23 react: 19.2.4 react-dom: 19.2.4(react@19.2.4) styled-jsx: 5.1.6(@babel/core@7.29.7)(react@19.2.4) optionalDependencies: - '@next/swc-darwin-arm64': 16.2.10 - '@next/swc-darwin-x64': 16.2.10 - '@next/swc-linux-arm64-gnu': 16.2.10 - '@next/swc-linux-arm64-musl': 16.2.10 - '@next/swc-linux-x64-gnu': 16.2.10 - '@next/swc-linux-x64-musl': 16.2.10 - '@next/swc-win32-arm64-msvc': 16.2.10 - '@next/swc-win32-x64-msvc': 16.2.10 - sharp: 0.34.5 + '@next/swc-darwin-arm64': 16.3.8 + '@next/swc-darwin-x64': 16.3.8 + '@next/swc-linux-arm64-gnu': 16.3.8 + '@next/swc-linux-arm64-musl': 16.3.8 + '@next/swc-linux-x64-gnu': 16.3.8 + '@next/swc-linux-x64-musl': 16.3.8 + '@next/swc-win32-arm64-msvc': 16.3.8 + '@next/swc-win32-x64-msvc': 16.3.8 + sharp: 0.35.5(@types/node@20.19.43) transitivePeerDependencies: - '@babel/core' + - '@types/node' - babel-plugin-macros node-abi@3.94.0: @@ -10639,13 +10667,13 @@ snapshots: cssesc: 3.0.0 util-deprecate: 1.0.2 - postcss@8.4.31: + postcss@8.5.21: dependencies: nanoid: 3.3.16 picocolors: 1.1.1 source-map-js: 1.2.1 - postcss@8.5.21: + postcss@8.5.23: dependencies: nanoid: 3.3.16 picocolors: 1.1.1 @@ -11146,36 +11174,38 @@ snapshots: - supports-color - typescript - sharp@0.34.5: + sharp@0.35.5(@types/node@20.19.43): dependencies: '@img/colour': 1.1.0 detect-libc: 2.1.2 semver: 7.8.5 optionalDependencies: - '@img/sharp-darwin-arm64': 0.34.5 - '@img/sharp-darwin-x64': 0.34.5 - '@img/sharp-libvips-darwin-arm64': 1.2.4 - '@img/sharp-libvips-darwin-x64': 1.2.4 - '@img/sharp-libvips-linux-arm': 1.2.4 - '@img/sharp-libvips-linux-arm64': 1.2.4 - '@img/sharp-libvips-linux-ppc64': 1.2.4 - '@img/sharp-libvips-linux-riscv64': 1.2.4 - '@img/sharp-libvips-linux-s390x': 1.2.4 - '@img/sharp-libvips-linux-x64': 1.2.4 - '@img/sharp-libvips-linuxmusl-arm64': 1.2.4 - '@img/sharp-libvips-linuxmusl-x64': 1.2.4 - '@img/sharp-linux-arm': 0.34.5 - '@img/sharp-linux-arm64': 0.34.5 - '@img/sharp-linux-ppc64': 0.34.5 - '@img/sharp-linux-riscv64': 0.34.5 - '@img/sharp-linux-s390x': 0.34.5 - '@img/sharp-linux-x64': 0.34.5 - '@img/sharp-linuxmusl-arm64': 0.34.5 - '@img/sharp-linuxmusl-x64': 0.34.5 - '@img/sharp-wasm32': 0.34.5 - '@img/sharp-win32-arm64': 0.34.5 - '@img/sharp-win32-ia32': 0.34.5 - '@img/sharp-win32-x64': 0.34.5 + '@img/sharp-darwin-arm64': 0.35.5 + '@img/sharp-darwin-x64': 0.35.5 + '@img/sharp-freebsd-wasm32': 0.35.5 + '@img/sharp-libvips-darwin-arm64': 1.3.4 + '@img/sharp-libvips-darwin-x64': 1.3.4 + '@img/sharp-libvips-linux-arm': 1.3.4 + '@img/sharp-libvips-linux-arm64': 1.3.4 + '@img/sharp-libvips-linux-ppc64': 1.3.4 + '@img/sharp-libvips-linux-riscv64': 1.3.4 + '@img/sharp-libvips-linux-s390x': 1.3.4 + '@img/sharp-libvips-linux-x64': 1.3.4 + '@img/sharp-libvips-linuxmusl-arm64': 1.3.4 + '@img/sharp-libvips-linuxmusl-x64': 1.3.4 + '@img/sharp-linux-arm': 0.35.5 + '@img/sharp-linux-arm64': 0.35.5 + '@img/sharp-linux-ppc64': 0.35.5 + '@img/sharp-linux-riscv64': 0.35.5 + '@img/sharp-linux-s390x': 0.35.5 + '@img/sharp-linux-x64': 0.35.5 + '@img/sharp-linuxmusl-arm64': 0.35.5 + '@img/sharp-linuxmusl-x64': 0.35.5 + '@img/sharp-webcontainers-wasm32': 0.35.5 + '@img/sharp-win32-arm64': 0.35.5 + '@img/sharp-win32-ia32': 0.35.5 + '@img/sharp-win32-x64': 0.35.5 + '@types/node': 20.19.43 optional: true shebang-command@2.0.0: diff --git a/scripts/tasarim-denetim.ts b/scripts/tasarim-denetim.ts index a669739..bcb58d1 100644 --- a/scripts/tasarim-denetim.ts +++ b/scripts/tasarim-denetim.ts @@ -4,7 +4,8 @@ * * Çıkış kodu: hata varsa 1, yoksa 0. Uyarılar çıkış kodunu etkilemez. * Kapsam: src/**\/*.tsx. Hariç: src/components/ui (shadcn tabanı) ve - * src/components/dev (yalnızca geliştirici paneli) — bazı kurallarda. + * src/components/dev (yalnızca geliştirici paneli) — bazı kurallarda; + * src/components/liquid-glass (kitten olduğu gibi kopyalanır, §4.50) — tümünde. */ import { readdirSync, readFileSync, statSync } from "node:fs"; import { join, relative } from "node:path"; @@ -34,6 +35,8 @@ type Kural = { const KOK = process.cwd(); const KAYNAK = join(KOK, "src"); const UI_VEYA_DEV = /src\/components\/(ui|dev)\//; +/** Liquid Glass UI kiti olduğu gibi kopyalanır, elle değiştirilmez (DESIGN.md §4.50). */ +const KIT = /src\/components\/liquid-glass\//; function tsxDosyalari(dizin: string): string[] { const sonuc: string[] = []; @@ -350,6 +353,7 @@ const KURALLAR: Kural[] = [ const bulgular: Bulgu[] = []; for (const yol of tsxDosyalari(KAYNAK)) { const gorece = relative(KOK, yol); + if (KIT.test(gorece)) continue; const icerik = readFileSync(yol, "utf8"); for (const k of KURALLAR) { if (!k.uiDahil && UI_VEYA_DEV.test(gorece)) continue; diff --git a/src/app/globals.css b/src/app/globals.css index 42f7e52..49447dc 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -1474,6 +1474,15 @@ html.lenis body { } } +/* CTA yüzeyindeki şeffaf sıvı cam mavi boyalıdır (DESIGN.md §4.50; `SiviCam` boyayı + buradan okur). Mavi bantta bir ton koyu: kendi rengindeki zeminden ayrılsın. */ +[data-cta-yuzey] { + --glass-tint: var(--primary); +} +[data-cta-yuzey][data-cta-ton="mavi"] { + --glass-tint: color-mix(in oklch, var(--primary), black 28%); +} + /* İkonlu buton (DESIGN.md §4.50; `Button` ya da `SIVI_KAP` taşıyan elle yazılmış hap): ikon, üstüne gelince gövdeden damla olarak ayrılan dairenin ortasında durur; yazı kalan gövdede ortalanır. `data-sivi` ikonun ucunu söyler ("son" / diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 6d39cf9..f9e4a43 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -120,9 +120,10 @@ export default function RootLayout({ {/* Site geneli progressive blur — üst ve alt. Stil globals.css'te (.kt-sayfa-blur): iOS/iPadOS'ta fixed + backdrop-filter katmanı kaydırmada ekranın ortasına kayıyor, orada bulanıklık @supports - ile düşürülüp degrade fade korunuyor. */} -
-
+ ile düşürülüp degrade fade korunuyor. Şeffaf sıvı cam bu katmanı + çizmez (`data-glass-skip`, DESIGN.md §4.50): içinden geçen yazı net kırılır. */} +
+
diff --git a/src/app/surum-notlari/page.tsx b/src/app/surum-notlari/page.tsx index 4a54a2b..d01ca46 100644 --- a/src/app/surum-notlari/page.tsx +++ b/src/app/surum-notlari/page.tsx @@ -33,6 +33,30 @@ type Surum = { }; const SURUMLER: Surum[] = [ + { + surum: "2.13.0", + tarih: "25 Kasım 2026", + maddeler: [], + arayuz: [ + "Sıvı cam görünümü yenilendi (sayfanın en altındaki \"Sıvı cam\" kutusunu işaretleyince açılır). Cam butonlar artık bastığın yerden ışıklanıyor; basılı tutup parmağını kaydırınca buton peşinden biraz gelip bırakınca jöle gibi yerine dönüyor.", + "Yan yana duran iki cam buton birbirine yaklaşınca iki su damlası gibi kaynaşıyor. Şeffaf camın kenarı da çevresindeki renkleri hafifçe yansıtıyor.", + ], + }, + { + surum: "2.12.15", + tarih: "25 Kasım 2026", + maddeler: [], + arayuz: [ + "Rehber sayfasında \"Yeni\" işareti artık yalnız en son eklenen yazılarda duruyor. Yeni yazılar gelince önceki yazıların işareti kalkıyor; hangisinin gerçekten yeni olduğunu tek bakışta görürsün.", + ], + }, + { + surum: "2.12.14", + tarih: "20 Kasım 2026", + maddeler: [ + "Bir rehber yazısına, üniversite ya da bölüm sayfasına doğrudan girdiğinde (örneğin Google'dan ya da paylaşılan bir bağlantıdan) sayfa bazen yarım açılıyor, üst menü gelmiyor ve hiçbir yere tıklanmıyordu. Düzeldi; sayfalar artık doğrudan açıldığında da eksiksiz geliyor.", + ], + }, { surum: "2.12.13", tarih: "15 Kasım 2026", diff --git a/src/components/liquid-glass/dom-snapshot.ts b/src/components/liquid-glass/dom-snapshot.ts new file mode 100644 index 0000000..b780224 --- /dev/null +++ b/src/components/liquid-glass/dom-snapshot.ts @@ -0,0 +1,805 @@ +// KolayTercih (DESIGN.md §4.50): Liquid Glass UI 2.0.0'dan (bilalgursen/liquid-glass@9c65d01, +// 24 Kas 2026) olduğu gibi alındı. Elle değiştirilmez; kit güncellenince dosya yeniden kopyalanır. + +// dom-snapshot — paints a DOM subtree into a Canvas2D context at its on-screen position. +// +// A WebGL lens cannot read the page's pixels, so glass that bends the page needs the +// page as a texture. This paints a good-enough picture of it: backgrounds (colours, +// gradients and images, with their size, position and repeat), rounded borders, text, +// inline SVG icons, canvases, images and video (with object-fit) and backdrop blur. +// Siblings are painted in CSS order: negative z-index, content, positioned, positive z-index. +// It is not a browser renderer: no shadows, conic gradients, masks, rotation or +// ::before/::after. An image from another origin is requested again with CORS; if its +// server does not allow that it is left out, because a canvas such an image has touched +// can never become a WebGL texture. Used by `material="clear"` glass, by GlassBadge and, +// through `drawAround`, for what every rim mirrors of the page around it. +// +// COPY THIS FILE VERBATIM. MIT — https://github.com/bilalgursen/liquid-glass + +type Box = { x: number; y: number; w: number; h: number } +type Drawable = HTMLImageElement | HTMLCanvasElement | HTMLVideoElement + +const isVisibleColor = (color: string) => + !!color && color !== 'transparent' && !/rgba\(.*,\s*0\)$/.test(color) && !/\/\s*0\)$/.test(color) + +/** Splits on a separator that is not inside parentheses: "a(1, 2), b" → ["a(1, 2)", "b"]. */ +function splitTop(text: string, separator: string) { + const parts: string[] = [] + let depth = 0 + let start = 0 + for (let i = 0; i < text.length; i++) { + const ch = text[i] + if (ch === '(') depth++ + else if (ch === ')') depth-- + else if (ch === separator && depth === 0) { + parts.push(text.slice(start, i)) + start = i + 1 + } + } + parts.push(text.slice(start)) + return parts.map((part) => part.trim()).filter(Boolean) +} + +/** "40%" or "12px" of a span. */ +const lengthOf = (token: string, span: number) => (token.endsWith('%') ? (span * parseFloat(token)) / 100 : parseFloat(token) || 0) + +/** One axis of a CSS position ("25%", "12px", "right", "calc(100% - 8px)") inside `free` px of room. */ +function along(token: string | undefined, free: number) { + if (!token) return free / 2 + const calc = /^calc\(([-\d.]+)% ([+-]) ([\d.]+)px\)$/.exec(token) + if (calc) return (free * Number(calc[1])) / 100 + (calc[2] === '-' ? -1 : 1) * Number(calc[3]) + if (/^-?[\d.]/.test(token)) return lengthOf(token, free) + return token === 'left' || token === 'top' ? 0 : token === 'right' || token === 'bottom' ? free : free / 2 +} + +/** `background-position`, `object-position` and a gradient's `at …` as an offset into the free room. */ +function placeOf(position: string, freeX: number, freeY: number): [number, number] { + let [a, b, c, d] = splitTop(position, ' ') + // "right 10px bottom 20px": offsets measured from the named edges. + if (d) return [a === 'right' ? freeX - along(b, freeX) : along(b, freeX), c === 'bottom' ? freeY - along(d, freeY) : along(d, freeY)] + if (a === 'top' || a === 'bottom' || b === 'left' || b === 'right') [a, b] = [b, a] + return [along(a, freeX), along(b, freeY)] +} + +// ── Sources: loading, and keeping the canvas readable ──────────────────────── + +const verdicts = new WeakMap() + +/** + * Is this source safe to draw? One image without CORS (or an SVG, in some browsers) + * taints the whole canvas and WebGL can then no longer read it, so each source is + * tried once on a 1×1 canvas first. `key` is whatever makes it a different picture. + */ +function isClean(source: Drawable, key = '') { + const known = verdicts.get(source) + if (known && known.key === key) return known.ok + let ok = false + try { + const probe = document.createElement('canvas') + probe.width = probe.height = 1 + const ctx = probe.getContext('2d', { willReadFrequently: true }) + if (ctx) { + ctx.drawImage(source, 0, 0, 1, 1) + ctx.getImageData(0, 0, 1, 1) + ok = true + } + } catch { + // SecurityError: another origin without CORS. InvalidStateError: a broken image. + } + verdicts.set(source, { key, ok }) + return ok +} + +const waiting = new WeakMap void>>() + +/** True once the image can be drawn. Until then `onStale` is called when it arrives. */ +function isLoaded(image: HTMLImageElement, onStale?: () => void) { + if (image.complete) return image.naturalWidth > 0 + if (!onStale) return false + let callbacks = waiting.get(image) + if (!callbacks) { + const pending = (callbacks = new Set()) + waiting.set(image, pending) + image.addEventListener( + 'load', + () => { + waiting.delete(image) + pending.forEach((notify) => notify()) + }, + { once: true }, + ) + } + callbacks.add(onStale) + return false +} + +const isSameOrigin = (src: string) => { + try { + const url = new URL(src, location.href) + return url.protocol === 'data:' || url.protocol === 'blob:' || url.origin === location.origin + } catch { + return false + } +} + +const copies = new Map() + +/** Our own copy of an image by URL: a CSS background, or an the page loaded without CORS. */ +function imageCopy(src: string) { + let image = copies.get(src) + if (!image) { + if (copies.size > 200) copies.clear() + image = new Image() + if (!isSameOrigin(src)) image.crossOrigin = 'anonymous' + image.decoding = 'async' + image.src = src + copies.set(src, image) + } + return image +} + +/** Draws an image or a video frame into its box the way `object-fit` and `object-position` place it. */ +function drawFitted(ctx: CanvasRenderingContext2D, source: Drawable, sw: number, sh: number, box: Box, radius: number, style: CSSStyleDeclaration) { + const fit = style.objectFit + let w = box.w + let h = box.h + if (fit !== 'fill') { + const contain = Math.min(box.w / sw, box.h / sh) + const k = fit === 'cover' ? Math.max(box.w / sw, box.h / sh) : fit === 'none' ? 1 : fit === 'scale-down' ? Math.min(1, contain) : contain + w = sw * k + h = sh * k + } + const [ox, oy] = placeOf(style.objectPosition, box.w - w, box.h - h) + const clips = radius > 0 || w > box.w + 0.5 || h > box.h + 0.5 + if (clips) { + ctx.save() + ctx.beginPath() + ctx.roundRect(box.x, box.y, box.w, box.h, radius) + ctx.clip() + } + ctx.drawImage(source, box.x + ox, box.y + oy, w, h) + if (clips) ctx.restore() +} + +const svgCache = new WeakMap() +/** Set when this browser treats an SVG image as unreadable: icons are then left out. */ +let svgTaints = false + +/** + * Draws an inline SVG as an image. Colours that come from classes are inlined first. + * Built once per element and rebuilt when the colour, the cache key or the size + * changes, so an animated SVG keeps its first frame instead of rebuilding every call. + */ +function drawSvg(ctx: CanvasRenderingContext2D, svg: SVGSVGElement, color: string, box: Box, onStale: (() => void) | undefined, cacheKey: string) { + if (svgTaints) return + const key = `${color}|${cacheKey}|${Math.round(box.w)}x${Math.round(box.h)}` + let entry = svgCache.get(svg) + if (!entry || entry.key !== key) { + const clone = svg.cloneNode(true) as SVGSVGElement + const originals = [svg, ...svg.querySelectorAll('*')] + const clones = [clone, ...clone.querySelectorAll('*')] + originals.forEach((original, i) => { + const style = getComputedStyle(original) + const target = clones[i] as SVGElement + target.removeAttribute('class') + target.style.fill = style.fill + target.style.stroke = style.stroke + target.style.animation = 'none' + }) + clone.setAttribute('xmlns', 'http://www.w3.org/2000/svg') + clone.setAttribute('width', String(box.w)) + clone.setAttribute('height', String(box.h)) + clone.style.color = color + const image = new Image() + image.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(new XMLSerializer().serializeToString(clone))}` + entry = { key, image } + svgCache.set(svg, entry) + } + if (!isLoaded(entry.image, onStale)) return + if (isClean(entry.image)) ctx.drawImage(entry.image, box.x, box.y, box.w, box.h) + else svgTaints = true +} + +// ── Backgrounds: gradients and images ──────────────────────────────────────── + +type Stop = { color: string; at: number | null; px: boolean } +type Gradient = + | { kind: 'linear'; repeating: boolean; stops: Stop[]; angle: number; corner: string } + | { kind: 'radial'; repeating: boolean; stops: Stop[]; circle: boolean; extent: string; size: string[]; at: string } +type BackgroundImage = { kind: 'url'; src: string } | Gradient + +function parseStops(args: string[], currentColor: string): Stop[] | null { + const stops: Stop[] = [] + for (const arg of args) { + const tokens = splitTop(arg, ' ') + const positions: string[] = [] + while (tokens.length && /^-?[\d.]+(%|px)$/.test(tokens[tokens.length - 1])) positions.unshift(tokens.pop() as string) + if (!tokens.length) continue // a colour hint (a position alone) is skipped + const color = tokens.join(' ').replace(/currentcolor/gi, currentColor) + if (!positions.length) stops.push({ color, at: null, px: false }) + for (const position of positions) stops.push({ color, at: parseFloat(position), px: position.endsWith('px') }) + } + return stops.length > 1 ? stops : null +} + +/** One layer of a computed `background-image`; null for what is not supported (conic gradients, image-set…). */ +function parseImage(text: string, currentColor: string): BackgroundImage | null { + const url = /^url\((['"]?)(.*)\1\)$/.exec(text) + if (url) return { kind: 'url', src: url[2] } + const gradient = /^(repeating-)?(linear|radial)-gradient\(([\s\S]*)\)$/.exec(text) + if (!gradient) return null + const repeating = !!gradient[1] + const args = splitTop(gradient[3], ',') + // The first argument is the direction or the shape, unless it is already a colour. + // "in oklab" (the interpolation space) is dropped: canvas always blends in sRGB. + const first = args[0] ?? '' + const head = first.replace(/\bin\s+[\w-]+(\s+\w+\s+hue)?/i, '').trim() + const spaceOnly = head === '' && first !== '' + if (gradient[2] === 'linear') { + let angle = Math.PI + let corner = '' + let isDirection = spaceOnly + if (/^to\s/.test(head)) { + const v = /top/.test(head) ? 't' : /bottom/.test(head) ? 'b' : '' + const hz = /left/.test(head) ? 'l' : /right/.test(head) ? 'r' : '' + if (v && hz) corner = v + hz + else angle = ({ t: 0, r: Math.PI / 2, b: Math.PI, l: Math.PI * 1.5 } as Record)[v || hz] ?? Math.PI + isDirection = true + } else if (/^-?[\d.]+(deg|grad|rad|turn)$/.test(head)) { + const n = parseFloat(head) + angle = head.endsWith('turn') ? n * Math.PI * 2 : head.endsWith('grad') ? (n * Math.PI) / 200 : head.endsWith('rad') ? n : (n * Math.PI) / 180 + isDirection = true + } + const stops = parseStops(isDirection ? args.slice(1) : args, currentColor) + return stops && { kind: 'linear', repeating, stops, angle, corner } + } + const isShape = spaceOnly || /^(circle|ellipse|closest-|farthest-|at\s|-?[\d.]+(px|%))/.test(head) + const [shape = '', at = 'center'] = isShape ? head.split(/\s*\bat\s+/) : [] + const size = shape.match(/-?[\d.]+(px|%)/g) ?? [] + const stops = parseStops(isShape ? args.slice(1) : args, currentColor) + return ( + stops && { + kind: 'radial', + repeating, + stops, + circle: /circle/.test(shape) || size.length === 1, + extent: /(closest|farthest)-(side|corner)/.exec(shape)?.[0] ?? 'farthest-corner', + size, + at, + } + ) +} + +const parsed = new Map() + +function imagesOf(style: CSSStyleDeclaration) { + const value = style.backgroundImage + const key = /currentcolor/i.test(value) ? `${value}|${style.color}` : value + let images = parsed.get(key) + if (!images) { + if (parsed.size > 300) parsed.clear() + images = splitTop(value, ',').map((image) => parseImage(image, style.color)) + parsed.set(key, images) + } + return images +} + +/** A stop's colour at zero alpha. CSS fades in premultiplied colour, canvas does not, so "transparent" has to keep the hue next to it. */ +function clearOf(color: string) { + const legacy = /^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/.exec(color) + if (legacy) return `rgba(${legacy[1]}, ${legacy[2]}, ${legacy[3]}, 0)` + const modern = /^([a-z-]+\([^/)]+?)\s*(\/[^)]*)?\)$/.exec(color) + return modern ? `${modern[1]} / 0)` : color +} + +/** + * Resolves stop positions along a gradient line `length` px long. Returns the part of + * the line the stops span (`from`..`to`, as fractions of it) and each stop inside that + * part (0..1). `reach`: how far along the line the box extends (repeats cover it). + */ +function rampOf(stops: Stop[], length: number, repeating: boolean, reach = 1) { + const at = stops.map((stop) => (stop.at === null ? null : stop.px ? stop.at / Math.max(length, 1e-6) : stop.at / 100)) + if (at[0] === null) at[0] = 0 + if (at[at.length - 1] === null) at[at.length - 1] = 1 + for (let i = 1; i < at.length; i++) { + if (at[i] === null) { + // Stops without a position are spread evenly between their neighbours. + let j = i + while (at[j] === null) j++ + const a = at[i - 1] as number + const b = Math.max(at[j] as number, a) + for (let k = i; k < j; k++) at[k] = a + ((b - a) * (k - i + 1)) / (j - i + 1) + } + at[i] = Math.max(at[i] as number, at[i - 1] as number) + } + let list: [number, string][] = [] + stops.forEach((stop, i) => { + const p = at[i] as number + const before = stops[i - 1] + const after = stops[i + 1] + // A transparent stop becomes its neighbours' colours at zero alpha (see clearOf). + const fades = !isVisibleColor(stop.color) + const fromBefore = fades && !!before && isVisibleColor(before.color) + const toAfter = fades && !!after && isVisibleColor(after.color) + if (fromBefore) list.push([p, clearOf(before.color)]) + if (toAfter) list.push([p, clearOf(after.color)]) + if (!fromBefore && !toAfter) list.push([p, stop.color]) + }) + let from = list[0][0] + let to = list[list.length - 1][0] + const period = to - from + if (repeating && period > 1e-4) { + const first = Math.floor(-from / period) + const count = Math.ceil((reach - from) / period) - first + if (count > 200) return null + const one = list + list = [] + for (let k = first; k < first + count; k++) for (const [p, color] of one) list.push([p + k * period, color]) + from += first * period + to = from + count * period + } + // Stops that all share one position are a hard edge: keep the line a hair long, or canvas paints nothing. + const span = Math.max(to - from, 0.02 / Math.max(length, 1e-6)) + return { from, to: from + span, stops: list.map(([p, color]): [number, string] => [Math.min(1, Math.max(0, (p - from) / span)), color]) } +} + +/** Fills (0, 0, w, h) with a CSS gradient. */ +function fillGradient(ctx: CanvasRenderingContext2D, gradient: Gradient, w: number, h: number) { + if (gradient.kind === 'linear') { + let angle = gradient.angle + if (gradient.corner) { + // "to top right": the line that puts the two neighbouring corners on the 50 % mark. + const base = Math.atan2(h, w) + angle = ({ tr: base, br: Math.PI - base, bl: Math.PI + base, tl: -base } as Record)[gradient.corner] ?? base + } + const sin = Math.sin(angle) + const cos = Math.cos(angle) + const length = Math.abs(w * sin) + Math.abs(h * cos) + const ramp = rampOf(gradient.stops, length, gradient.repeating) + if (!ramp) return + // The gradient line runs through the centre of the box. + const x = (t: number) => w / 2 + sin * length * (t - 0.5) + const y = (t: number) => h / 2 - cos * length * (t - 0.5) + const fill = ctx.createLinearGradient(x(ramp.from), y(ramp.from), x(ramp.to), y(ramp.to)) + for (const [p, color] of ramp.stops) fill.addColorStop(p, color) + ctx.fillStyle = fill + ctx.fillRect(0, 0, w, h) + return + } + const [cx, cy] = placeOf(gradient.at, w, h) + const dx = [Math.abs(cx), Math.abs(w - cx)] + const dy = [Math.abs(cy), Math.abs(h - cy)] + const pick = gradient.extent.startsWith('closest') ? Math.min : Math.max + let rx = pick(...dx) + let ry = pick(...dy) + if (gradient.size.length) { + rx = lengthOf(gradient.size[0], w) + ry = gradient.size[1] ? lengthOf(gradient.size[1], h) : rx + } else if (gradient.circle) rx = ry = gradient.extent.endsWith('corner') ? Math.hypot(rx, ry) : pick(rx, ry) + else if (gradient.extent.endsWith('corner')) { + rx *= Math.SQRT2 + ry *= Math.SQRT2 + } + if (rx < 0.01 || ry < 0.01) return + const ramp = rampOf(gradient.stops, rx, gradient.repeating, Math.hypot(Math.max(...dx) / rx, Math.max(...dy) / ry)) + if (!ramp) return + const inner = Math.max(0, rx * ramp.from) + const fill = ctx.createRadialGradient(0, 0, inner, 0, 0, Math.max(rx * ramp.to, inner + 1e-3)) + for (const [p, color] of ramp.stops) fill.addColorStop(p, color) + // An ellipse is a circle squeezed along y. + ctx.save() + ctx.translate(cx, cy) + ctx.scale(1, ry / rx) + ctx.fillStyle = fill + ctx.fillRect(-cx, (-cy * rx) / ry, w, (h * rx) / ry) + ctx.restore() +} + +/** + * Paints an element's `background-image` layers. `area` is the box they are sized and + * positioned in, `bounds` the part of it worth painting. The caller has clipped to the box. + */ +function paintBackgrounds(ctx: CanvasRenderingContext2D, style: CSSStyleDeclaration, area: Box, bounds: Box, onStale?: () => void) { + const images = imagesOf(style) + const sizes = splitTop(style.backgroundSize, ',') + const positions = splitTop(style.backgroundPosition, ',') + const repeats = splitTop(style.backgroundRepeat, ',') + // The first layer is the top one: paint from the last. + for (let n = images.length - 1; n >= 0; n--) { + const image = images[n] + if (!image) continue + let source: HTMLImageElement | null = null + let tw = area.w + let th = area.h + if (image.kind === 'url') { + source = imageCopy(image.src) + if (!isLoaded(source, onStale) || !isClean(source)) continue + tw = source.naturalWidth + th = source.naturalHeight + } + // Tile size: gradients have no size of their own and fill the area. + const size = sizes[n % sizes.length] ?? 'auto' + if (size === 'cover' || size === 'contain') { + const k = (size === 'cover' ? Math.max : Math.min)(area.w / tw, area.h / th) + tw *= k + th *= k + } else { + const [sw = 'auto', sh = 'auto'] = splitTop(size, ' ') + const ratio = tw / th + if (sw !== 'auto') tw = lengthOf(sw, area.w) + if (sh !== 'auto') th = lengthOf(sh, area.h) + if (source && sw !== 'auto' && sh === 'auto') th = tw / ratio + if (source && sw === 'auto' && sh !== 'auto') tw = th * ratio + } + if (!(tw >= 0.5 && th >= 0.5)) continue + const [ox, oy] = placeOf(positions[n % positions.length] ?? '0% 0%', area.w - tw, area.h - th) + const repeat = repeats[n % repeats.length] ?? 'repeat' + const [repeatX, repeatY = repeatX] = repeat.split(' ') + const tilesX = repeat !== 'repeat-y' && repeatX !== 'no-repeat' + const tilesY = repeat !== 'repeat-x' && repeatY !== 'no-repeat' + // Only the tiles that reach the visible part. + const x0 = area.x + ox + const y0 = area.y + oy + const i0 = tilesX ? Math.floor((bounds.x - x0) / tw) : 0 + const i1 = tilesX ? Math.floor((bounds.x + bounds.w - x0 - 0.01) / tw) : 0 + const j0 = tilesY ? Math.floor((bounds.y - y0) / th) : 0 + const j1 = tilesY ? Math.floor((bounds.y + bounds.h - y0 - 0.01) / th) : 0 + // A very fine pattern blurs to nothing under glass: not worth hundreds of tiles. + if ((i1 - i0 + 1) * (j1 - j0 + 1) > 400) continue + try { + for (let j = j0; j <= j1; j++) { + for (let i = i0; i <= i1; i++) { + ctx.save() + ctx.translate(x0 + i * tw, y0 + j * th) + if (source) ctx.drawImage(source, 0, 0, tw, th) + else fillGradient(ctx, image as Gradient, tw, th) + ctx.restore() + } + } + } catch { + // A colour this browser's canvas cannot parse: the layer is left out + // (the gradient is built before anything else is saved, so one restore is owed). + ctx.restore() + } + } +} + +// ── Text and backdrop blur ─────────────────────────────────────────────────── + +/** Draws one text node line by line, where the page laid it out and in its own font. */ +function drawText( + ctx: CanvasRenderingContext2D, + node: Text, + style: CSSStyleDeclaration, + originX: number, + originY: number, + lang: string | undefined, + isVisible: (rect: DOMRect) => boolean, +) { + const raw = node.textContent ?? '' + let text = raw.replace(/\s+/g, ' ').trim() + if (!text) return + const range = document.createRange() + range.selectNodeContents(node) + const lines = [...range.getClientRects()].filter((rect) => rect.width > 0.5) + if (!lines.length) return + // The page shows the transformed text. Upper and lower case follow the page's + // language (Turkish i → İ); browsers capitalise without it. + const transform = style.textTransform + if (transform === 'uppercase') text = text.toLocaleUpperCase(lang) + else if (transform === 'lowercase') text = text.toLocaleLowerCase(lang) + else if (transform === 'capitalize') text = text.replace(/(^|\s)(\S)/g, (_, gap: string, letter: string) => gap + letter.toUpperCase()) + const rtl = style.direction === 'rtl' + ctx.font = `${style.fontStyle} ${style.fontWeight} ${style.fontSize} ${style.fontFamily}` + if ('letterSpacing' in ctx) ctx.letterSpacing = style.letterSpacing === 'normal' ? '0px' : style.letterSpacing + ctx.direction = rtl ? 'rtl' : 'ltr' + ctx.textAlign = 'left' + ctx.fillStyle = style.color + ctx.textBaseline = 'alphabetic' + const metrics = ctx.measureText('Hgİş') + const ascent = metrics.fontBoundingBoxAscent + const descent = metrics.fontBoundingBoxDescent + const space = ctx.measureText(' ').width + // Fill each line with as many words as fit (a single line takes them all). + const words = text.split(' ') + let next = 0 + lines.forEach((rect, i) => { + let line = '' + if (i === lines.length - 1) line = words.slice(next).join(' ') + else { + while (next < words.length) { + const candidate = line ? `${line} ${words[next]}` : words[next] + if (line && ctx.measureText(candidate).width > rect.width + 1) break + line = candidate + next++ + } + } + if (!line || !isVisible(rect)) return + // A leading space takes room only after an inline neighbour (not at the start of a + // block): then the line box is wider than its words, and the text starts further in. + const lead = i === 0 && !rtl && /^\s/.test(raw) && rect.width - ctx.measureText(line).width > space * 0.5 ? space : 0 + const baseline = rect.top - originY + (rect.height - (ascent + descent)) / 2 + ascent + ctx.fillText(line, rect.left - originX + lead, baseline) + }) +} + +let scratch: HTMLCanvasElement | undefined + +/** + * Blurs a box of the canvas in place (the counterpart of `backdrop-filter: blur()`). + * Like CSS, only what is inside the box is blurred and its edge pixels repeat outwards, + * so content next to a frosted bar does not bleed into it. + */ +function blurBackdrop(ctx: CanvasRenderingContext2D, box: Box, radius: number, blurPx: number) { + const matrix = ctx.getTransform() + const scale = matrix.a + const left = Math.max(0, Math.floor(box.x * scale + matrix.e)) + const top = Math.max(0, Math.floor(box.y * scale + matrix.f)) + const w = Math.min(ctx.canvas.width, Math.ceil((box.x + box.w) * scale + matrix.e)) - left + const h = Math.min(ctx.canvas.height, Math.ceil((box.y + box.h) * scale + matrix.f)) - top + if (w < 1 || h < 1) return + const pad = Math.ceil(blurPx * scale * 3) + scratch ??= document.createElement('canvas') + scratch.width = w + 2 * pad + scratch.height = h + 2 * pad + const copy = scratch.getContext('2d') + if (!copy) return + copy.imageSmoothingEnabled = false + copy.drawImage(ctx.canvas, left, top, w, h, pad, pad, w, h) + copy.drawImage(scratch, pad, pad, 1, h, 0, pad, pad, h) + copy.drawImage(scratch, pad + w - 1, pad, 1, h, pad + w, pad, pad, h) + copy.drawImage(scratch, 0, pad, w + 2 * pad, 1, 0, 0, w + 2 * pad, pad) + copy.drawImage(scratch, 0, pad + h - 1, w + 2 * pad, 1, 0, pad + h, w + 2 * pad, pad) + ctx.save() + ctx.beginPath() + ctx.roundRect(box.x, box.y, box.w, box.h, radius) + ctx.clip() + ctx.setTransform(1, 0, 0, 1, 0, 0) + ctx.globalAlpha = 1 + ctx.clearRect(left, top, w, h) + ctx.filter = `blur(${blurPx * scale}px)` + ctx.drawImage(scratch, left - pad, top - pad) + ctx.restore() +} + +// ── The walk ───────────────────────────────────────────────────────────────── + +/** + * Where a child paints among its siblings (CSS 2.1 appendix E, per parent): + * 0 negative z-index, 1 content in the flow, 2 positioned and stacking boxes, 3 positive z-index. + */ +function layerOf(style: CSSStyleDeclaration, inFlexOrGrid: boolean): [layer: number, z: number] { + const positioned = style.position !== 'static' + const z = (positioned || inFlexOrGrid) && style.zIndex !== 'auto' ? parseInt(style.zIndex, 10) || 0 : 0 + if (z) return [z < 0 ? 0 : 3, z] + const stacks = + positioned || + style.opacity !== '1' || + style.transform !== 'none' || + style.filter !== 'none' || + style.isolation === 'isolate' || + (style.backdropFilter || 'none') !== 'none' + return [stacks ? 2 : 1, 0] +} + +export type DomSnapshotOptions = { + /** + * The viewport point that lands on the context's origin, in CSS px. + * Pass a `getBoundingClientRect()` result; only `left` and `top` are read. + */ + origin: { left: number; top: number } + /** Visit only elements whose box intersects this viewport rectangle. */ + region?: { left: number; top: number; right: number; bottom: number } + /** Return true to leave an element and everything inside it out. */ + skip?: (element: Element) => boolean + /** Called when an image or an SVG that was not ready has loaded: draw again. */ + onStale?: () => void + /** Any string that changes when icon colours may have changed, such as the theme name. */ + cacheKey?: string + /** + * Filled in by the walk, for a caller that wants to know whether its picture survives a scroll: + * `pinned` gets every fixed or sticky element met, `touched` says one of them reaches the region, + * and `loose` that something painted may move by itself (an animation, an inline transform, a fixed background). + */ + found?: { pinned: Element[]; touched: boolean; loose: boolean } +} + +/** + * Paints `root` and everything inside it into `ctx`. The context must already be + * scaled so that one unit is one CSS px. Boxes that clip their overflow clip their + * children; fixed and sticky elements are painted last, on top. + */ +/** A computed `clip-path` of the `inset()` or `path()` kind as a canvas path; anything else is not clipped. */ +function clipShape(value: string, box: Box): Path2D | null { + if (!value || value === 'none') return null + const path = /^path\((?:[a-z-]+\s*,\s*)?["'](.*)["']\)$/s.exec(value) + if (path) { + const shape = new Path2D() + shape.addPath(new Path2D(path[1]), new DOMMatrix().translate(box.x, box.y)) + return shape + } + const inset = /^inset\((.*)\)$/s.exec(value) + if (!inset) return null + const [sides, round = ''] = inset[1].split(/\s+round\s+/) + const length = (token: string, of: number) => (token.endsWith('%') ? (parseFloat(token) / 100) * of : parseFloat(token) || 0) + const t = sides.trim().split(/\s+/) + const top = length(t[0], box.h) + const right = length(t[1] ?? t[0], box.w) + const bottom = length(t[2] ?? t[0], box.h) + const left = length(t[3] ?? t[1] ?? t[0], box.w) + const w = Math.max(0, box.w - left - right) + const h = Math.max(0, box.h - top - bottom) + const shape = new Path2D() + shape.roundRect(box.x + left, box.y + top, w, h, Math.min(round ? length(round.trim().split(/\s+/)[0], Math.min(w, h)) : 0, w / 2, h / 2)) + return shape +} + +export function drawDom(ctx: CanvasRenderingContext2D, root: Element, options: DomSnapshotOptions) { + const { origin, region, skip, onStale, cacheKey = document.documentElement.className, found } = options + const originX = origin.left + const originY = origin.top + const deferred: { element: Element; opacity: number }[] = [] + const intersects = (rect: DOMRect) => + !region || (rect.right > region.left && rect.left < region.right && rect.bottom > region.top && rect.top < region.bottom) + let lang: string | undefined + try { + lang = Intl.getCanonicalLocales(document.documentElement.lang)[0] + } catch { + // Not a language tag: the default locale's rules apply. + } + + const walk = (element: Element, parentOpacity: number, isDeferred = false, style = getComputedStyle(element)) => { + if (skip?.(element)) return + if (style.display === 'none' || style.visibility === 'hidden') return + const opacity = parentOpacity * Number(style.opacity) + if (opacity < 0.01) return + if (!isDeferred && element !== root && (style.position === 'fixed' || style.position === 'sticky')) { + deferred.push({ element, opacity: parentOpacity }) + found?.pinned.push(element) + return + } + const drawChildren = () => { + const inFlexOrGrid = /flex|grid/.test(style.display) + const children = [...element.childNodes].map((node) => { + const childStyle = node instanceof Element ? getComputedStyle(node) : null + const [layer, z] = childStyle ? layerOf(childStyle, inFlexOrGrid) : [1, 0] + return { node, childStyle, layer, z } + }) + // The sort is stable: within a layer, document order. + children.sort((a, b) => a.layer - b.layer || a.z - b.z) + for (const { node, childStyle } of children) { + if (childStyle) walk(node as Element, opacity, false, childStyle) + else if (node.nodeType === Node.TEXT_NODE) { + ctx.globalAlpha = opacity + drawText(ctx, node as Text, style, originX, originY, lang, intersects) + } + } + } + if (style.display === 'contents') { + drawChildren() + return + } + const rect = element.getBoundingClientRect() + // Screen-reader-only text (a 1 px square) and empty boxes are not painted, a hairline is; + // nothing outside the region is visited. + if (rect.width <= 0 || rect.height <= 0 || (rect.width <= 1 && rect.height <= 1) || !intersects(rect)) return + if (found) { + if (isDeferred) found.touched = true + else if (!found.loose) { + // A transform from a stylesheet stays put (a centred box); one written inline is a script's, and may follow the scroll. + const inline = (element as HTMLElement).style as CSSStyleDeclaration | undefined + found.loose = + style.animationName !== 'none' || + (style.backgroundImage !== 'none' && style.backgroundAttachment.includes('fixed')) || + (!!inline && !!(inline.transform || inline.translate || inline.rotate || inline.scale)) + } + } + const box: Box = { x: rect.left - originX, y: rect.top - originY, w: rect.width, h: rect.height } + // A `clip-path` (inset or path) cuts the box and everything inside it, as on screen. + const shape = clipShape(style.clipPath, box) + if (shape) { + ctx.save() + ctx.clip(shape) + } + try { + paintBox(element, style, rect, box, opacity, drawChildren) + } finally { + if (shape) ctx.restore() + } + } + const paintBox = (element: Element, style: CSSStyleDeclaration, rect: DOMRect, box: Box, opacity: number, drawChildren: () => void) => { + const radius = Math.min(parseFloat(style.borderTopLeftRadius) || 0, rect.width / 2, rect.height / 2) + // Frosted veil (backdrop-filter: blur): blur what is already painted beneath it first, + // otherwise text behind a translucent veil shows up sharp in the glass. + const backdropBlur = /blur\(([\d.]+)px\)/.exec(style.backdropFilter) + if (backdropBlur) blurBackdrop(ctx, box, radius, Number(backdropBlur[1])) + ctx.globalAlpha = opacity + // `background-clip: text` paints the background inside the letters only: no box. + const hasBox = style.backgroundClip !== 'text' + if (hasBox && isVisibleColor(style.backgroundColor)) { + ctx.beginPath() + ctx.roundRect(box.x, box.y, box.w, box.h, radius) + ctx.fillStyle = style.backgroundColor + ctx.fill() + } + if (hasBox && style.backgroundImage !== 'none') { + // The part of the box inside the region: only the tiles that reach it are painted. + const bounds = { ...box } + if (region) { + bounds.x = Math.max(box.x, region.left - originX) + bounds.y = Math.max(box.y, region.top - originY) + bounds.w = Math.min(box.x + box.w, region.right - originX) - bounds.x + bounds.h = Math.min(box.y + box.h, region.bottom - originY) - bounds.y + } + // A fixed background is laid out in the viewport, whatever the element's box. + const area: Box = style.backgroundAttachment.includes('fixed') ? { x: -originX, y: -originY, w: innerWidth, h: innerHeight } : box + ctx.save() + ctx.beginPath() + ctx.roundRect(box.x, box.y, box.w, box.h, radius) + ctx.clip() + paintBackgrounds(ctx, style, area, bounds, onStale) + ctx.restore() + } + const borderWidth = parseFloat(style.borderTopWidth) || 0 + if (borderWidth > 0 && style.borderTopStyle !== 'none' && isVisibleColor(style.borderTopColor)) { + ctx.beginPath() + ctx.roundRect(box.x + borderWidth / 2, box.y + borderWidth / 2, box.w - borderWidth, box.h - borderWidth, Math.max(0, radius - borderWidth / 2)) + ctx.lineWidth = borderWidth + ctx.strokeStyle = style.borderTopColor + ctx.setLineDash(style.borderTopStyle === 'dashed' ? [4, 3] : []) + ctx.stroke() + ctx.setLineDash([]) + } + if (element instanceof SVGSVGElement) { + drawSvg(ctx, element, style.color, box, onStale, cacheKey) + return + } + if (element instanceof HTMLCanvasElement) { + if (element.width && element.height && isClean(element)) ctx.drawImage(element, box.x, box.y, box.w, box.h) + return + } + if (element instanceof HTMLImageElement) { + const src = element.currentSrc || element.src + if (!src) return + // The element itself when the canvas stays readable, otherwise our own CORS copy. + const image = element.complete && element.naturalWidth && isClean(element, src) ? element : imageCopy(src) + if (isLoaded(image, onStale) && isClean(image, src)) drawFitted(ctx, image, image.naturalWidth, image.naturalHeight, box, radius, style) + return + } + if (element instanceof HTMLVideoElement) { + // The current frame; `live` glass follows the playback. + if (element.readyState >= 2 && element.videoWidth && isClean(element, element.currentSrc)) drawFitted(ctx, element, element.videoWidth, element.videoHeight, box, radius, style) + return + } + const clips = element !== root && style.overflow !== 'visible' && element !== document.body && element !== document.documentElement + if (clips) { + ctx.save() + ctx.beginPath() + ctx.roundRect(box.x, box.y, box.w, box.h, radius) + ctx.clip() + } + drawChildren() + if (clips) ctx.restore() + } + walk(root, 1) + for (let i = 0; i < deferred.length; i++) walk(deferred[i].element, deferred[i].opacity, true) + ctx.globalAlpha = 1 +} + +/** + * Paints what surrounds a box of the viewport, `reach` px past it on every side, with the box's + * top-left on the context's origin: what a glass rim mirrors (`GlassLens.reflection`). + */ +export function drawAround( + ctx: CanvasRenderingContext2D, + root: Element, + box: { left: number; top: number; width: number; height: number }, + reach: number, + options: Pick, +) { + drawDom(ctx, root, { + ...options, + origin: box, + region: { left: box.left - reach, top: box.top - reach, right: box.left + box.width + reach, bottom: box.top + box.height + reach }, + }) +} diff --git a/src/components/liquid-glass/engine.ts b/src/components/liquid-glass/engine.ts new file mode 100644 index 0000000..4d05be1 --- /dev/null +++ b/src/components/liquid-glass/engine.ts @@ -0,0 +1,2507 @@ +// KolayTercih (DESIGN.md §4.50): Liquid Glass UI 2.0.0'dan (bilalgursen/liquid-glass@9c65d01, +// 24 Kas 2026) olduğu gibi alındı. Elle değiştirilmez; kit güncellenince dosya yeniden kopyalanır. + +// Liquid Glass engine — one shared WebGL2 context that draws every glass surface on the +// page and copies each result into the surface's own 2D , so a page full of +// glass never hits the browser's WebGL context limit. +// +// Zero dependencies. A GLSL lens with tinted glass, a 1 px border, a frosted resting +// state, an opt-in gooey droplet and an opt-in frosted blur (cards). The rim mirrors what +// surrounds the glass: a colourful neighbour shows on the side that faces it. +// +// Cost model: the loop runs only while a spring moves, a surface is dirty or the +// cursor light changes; at rest it stops completely. Off-screen surfaces are not +// drawn, and neither is a frame that would come out exactly as the one on the canvas. +// `prefers-reduced-motion` freezes every spring at its target. +// If WebGL2 is missing or the context is lost, every surface falls back to plain CSS. +// +// COPY THIS FILE VERBATIM. Do not rewrite or "simplify" the shader: the look comes +// from the exact constants below. MIT — https://github.com/bilalgursen/liquid-glass + +export type Rgb = [number, number, number] +export type Rgba = [number, number, number, number] + +/** One frame of one glass shape. Lengths in CSS px; origin = the canvas's top-left. */ +export type GlassLens = { + /** Canvas position inside its positioned parent, and its size. */ + left: number + top: number + width: number + height: number + /** CSS px per design unit (the shading is designed for a 120-unit-tall lens). */ + unit: number + /** Body centre and half size. */ + cx: number + cy: number + hx: number + hy: number + radius: number + /** Horizontal shift of the body (it pulls back while a droplet separates). */ + bodyX: number + /** Separated droplet: centre x relative to the lens centre, radius, gooey bridge softness. */ + droplet?: { x: number; r: number; k: number } + /** + * A second rounded box melted into the body, in any direction: centre relative to the body's + * centre, half size, corner radius and gooey bridge softness (all CSS px). Omit it and the + * shape is exactly the body (and droplet) alone. + */ + blob?: { + x: number + y: number + hx: number + hy: number + r: number + k: number + /** Gathers the bridge around one point: the softness falls off from `x` (relative to the body's centre) over `w` px, so a thinning bridge narrows into a neck there. */ + neck?: { x: number; w: number } + /** Fades the softness out towards the body's far edge: `amount` 0–1 (0 = none), recovering over `reach` × the body's height from that edge. */ + fade?: { amount: number; reach: number } + /** + * The blob's own glass, when it is not the body's: tint cover (0–1), frost in CSS px, the + * bend's falloff and depth (as `tune.bendCurve` / `tune.bendDepth`) and a white rim line + * (opacity, width in CSS px). It casts no shadow then, and the two glasses melt at the neck. + */ + material?: { frost: number; blur: number; bendCurve: number; bendDepth: number; borderAlpha: number; borderWidth: number } + } + /** Bevel width (design units). */ + bevel: number + /** + * Width of the band that bends the backdrop (design units), when it must not follow + * the bevel: a lens with square corners keeps its bevel within the corner radius but + * still bends as deep as a pill. Omit for the default, `bevel × 0.35`. + */ + band?: number + shadow: number + shadowSoftness: number + shadowOffset: number + /** 0 = flat liquid (no light or shadow), 1 = full glass lighting. */ + strength: number + color: Rgb + surface: Rgb + /** How much the rim thins towards the surface colour (tinted glass). */ + edgeClear: number + border?: Rgb + /** Opacity of the border line (0–1, default 1). */ + borderAlpha?: number + /** Width of the border line in CSS px (default 1). */ + borderWidth?: number + /** Textured lens: paints what lies beneath and bends it. */ + refraction?: { + /** + * Return `false` when both layers came out exactly as the last time, colours included: they + * are not uploaded again, not even on a frame that re-read sizes and colours. + * A painter that declares only `back` has no front layer (none is cleared or uploaded). + */ + paint: (back: CanvasRenderingContext2D, front: CanvasRenderingContext2D) => void | boolean + refract: number + magnify: number + dispersion: number + blurCenter: number + blurEdge: number + /** 1 = frosted (flat `color`), 0 = perfectly clear. */ + frost: number + /** Frosted blur of the backdrop: a gaussian deviation in CSS px, like CSS `blur()`. 0 or omitted = sharp. */ + blur?: number + /** How much of the frost shows over the sharp bend (0–1, default 1). */ + blurMix?: number + /** + * Radial bend, as the old SVG card drew it: each point near the rim looks towards the + * centre, by this fraction of the viewport (0.065 there), falling off as (1 − d/half)^bendCurve, + * and the frost blurs the bent picture. `refract`, `magnify` and the bend band are then unused. + */ + radial?: number + } + /** + * What the rim mirrors, while the glass is clear: the page around it (see MIRROR). `paint` draws it into a context + * whose origin is the canvas's top-left (one unit = one CSS px), `reach` CSS px past the canvas + * on every side; leave the glass itself out. `height` is the glass's own height at rest, in CSS + * px: the rim looks about that far. A neighbour brighter or more colourful than the surface + * shows on the rim that faces it, and the rim light's far side takes its colour. Without it the + * glass mirrors the surface colour alone, which shows nothing. The picture is small and taken + * rarely: when sizes and colours are re-read and when the canvas changes size, a few times a + * second at most. `live` takes it again while the glass moves, too. + */ + reflection?: { paint: (around: CanvasRenderingContext2D, reach: number) => void; height: number; live?: boolean } + /** Fine-tuning of the look. Every field defaults to the kit's own value, noted in brackets. */ + tune?: { + /** × rim light [1] and × its line's thickness [1]. */ + rim?: number + rimWidth?: number + /** × fresnel glow on the lit side [1], × inner shading [1], × top reflection [1], × warm caustic [1]. */ + fresnel?: number + inner?: number + reflection?: number + caustic?: number + /** × what the rim of clear glass mirrors of its surroundings [1] (see `reflection` above; 0 = nothing). */ + mirror?: number + /** Falloff of the bend from the rim inwards, an exponent [1.6]; × how far in it reaches [1]. */ + bendCurve?: number + bendDepth?: number + /** Saturation of what shows through [1]; × the frost at the rim [1]. */ + saturation?: number + frostEdge?: number + } + /** Rim light leans towards the cursor. */ + cursorLight: boolean + /** + * Light let into the glass at one point (a press): centre relative to the body's centre and + * reach, in CSS px, and how strong (0 = none; see GLOW). It brightens all the glass near it alike, a melted blob + * included, unless `blob` says how much of it the blob takes (0–1; 0 keeps the light to the body). `halo` lets it + * spill past one edge, the body's or the blob's (0–1, how much): there + * it brightens the page's colour the same way. Without it nothing shows outside the glass. + */ + glow?: { x: number; y: number; r: number; amount: number; blob?: number; halo?: { around: 'body' | 'blob'; amount: number } } + /** `false`: this glass does not take the light under the pointer (see LIGHT). Every other glass does, unless that light is turned off. */ + pointerLight?: boolean + /** + * Another view this glass continues (one shape drawn by two canvases, each on its side of a + * seam): it takes that view's light of a press (LIGHT) as it is, where it is on screen, instead + * of one of its own, so the light does not stop at the seam. + */ + lightOf?: GlassView + /** Lens centre on screen, for aiming the cursor light. */ + screenX: number + screenY: number + /** + * How large one CSS px of the canvas is on screen: the host's own CSS `scale` and its + * ancestors' (1 when omitted). Glass that melts into its neighbours (COHESION) is measured with it. + */ + scale?: number +} + +export type GlassView = { + canvas: HTMLCanvasElement + ctx: CanvasRenderingContext2D + dirty: boolean + /** + * Set it (and wake the engine) when what lies behind the glass may have changed and the glass + * itself has not, as on scroll: the layers are painted again, sizes and colours are not re-read. + */ + repaint?: boolean + visible: boolean + /** Advance springs; return true while anything still moves. */ + step: (dt: number, reducedMotion: boolean) => boolean + /** The shape to draw, or null to clear. `refresh`: re-read sizes and colours. */ + lens: (refresh: boolean) => GlassLens | null + /** The first frame reached the canvas. */ + drawn?: () => void + /** The GPU context is gone: return to the plain CSS look. */ + lost: () => void + /** + * `true`: a pointer that holds this glass pulls it after itself (see PULL). Buttons ask for it; + * no other glass is pulled. A view may change it at any time: set back to `false`, held glass is let go. + */ + pull?: boolean + /** Set by the engine: a pointer holds this glass and may be pulling it. The press lasts as long, outside the glass too. */ + held?: boolean + /** + * The CSS scale this view wants on its host (1 = none), when it swells its host itself. The + * engine writes the host's `scale`: this, times the stretch of a pull. A view that sets it + * never writes `host.style.scale` itself. + */ + grow?: number + /** + * `true`: this glass is a button (see "The light of a press", above GLOW). A press on it lets + * light in where it lands (GLOW), on top of the light every glass takes under a press (LIGHT). + * Left out, the glass is a surface (a card, a menu, a lens) and takes LIGHT alone. The engine + * hears the press and the keys itself: a view only says what it is. + */ + button?: boolean + /** With `button`: the element a press must land in, when it is not the glass's host. */ + pressArea?: Element + /** + * `false`: this surface does not take the engine's light around a choice pressed in it (see the + * rule above GLOW), because it brings that light itself (GlassPopup's lists do) or wants none. + */ + choices?: boolean + /** + * Set by the engine: where a pull has this glass (px from its rest) and how it stretches its + * host (1 = not at all), as written on the host this frame. A view reads it to undo the stretch + * on its canvas and draw it in the glass instead (GlassLayer and GlassPopup do). + */ + pulled?: { x: number; y: number; sx: number; sy: number } + /** + * Set by the engine: the hosts of the glass this one melts into (COHESION), or none. Melted, + * they are one body with it, so a view leaves them out of its picture of what lies behind + * (GlassLayer does). The list is replaced only when the glass it names changes. + */ + near?: Element[] +} + +export type GlassEngine = { + add: (view: GlassView) => void + remove: (view: GlassView) => void + /** Schedule a frame (call after changing state the springs read). */ + wake: () => void + /** Any CSS colour (oklch, var(), color-mix…) → 0..1 RGBA. */ + resolveColor: (css: string) => Rgba +} + +/** Damped spring. `omega` = speed (rad/s), `zeta` = damping ratio (< 1 bounces). Returns true while moving. */ +export type Spring = { x: number; v: number } +export function stepSpring(s: Spring, target: number, { omega, zeta }: { omega: number; zeta: number }, dt: number) { + const d = s.x - target + if (zeta > 0.9995) { + const b = s.v + omega * d + const e = Math.exp(-omega * dt) + s.x = target + (d + b * dt) * e + s.v = (s.v - omega * b * dt) * e + } else { + const wd = omega * Math.sqrt(1 - zeta * zeta) + const b = (s.v + zeta * omega * d) / wd + const e = Math.exp(-zeta * omega * dt) + const cos = Math.cos(wd * dt) + const sin = Math.sin(wd * dt) + const x = (d * cos + b * sin) * e + s.x = target + x + s.v = e * wd * (b * cos - d * sin) - zeta * omega * x + } + // Thresholds scale with the target so pixel springs do not idle on an invisible tail. + const scale = Math.max(1, Math.abs(target)) + const settled = Math.abs(s.x - target) < 5e-4 * scale && Math.abs(s.v) < 0.005 * scale + if (settled) { + s.x = target + s.v = 0 + } + return !settled +} + +/** + * The light of a press. The rule, kept here and applied by the engine: + * + * - A button is lit by GLOW: a press lets light in where it lands, the light holds a moment and + * fades as it spreads. A view says `button: true` and the engine does the rest (Button, Action + * Button and Button Group, through GlassLayer). The control of a surface that opens (GlassPopup) + * is a button too and brings the same light itself (`glow` on its lens), because there it goes + * on to open the surface. + * - A surface is lit by LIGHT alone: a soft white light where the press lands, for as long as it + * is held. Every glass that is not a button is a surface: a card, a menu or a list that has + * opened, a lens, a thumb, a badge. Nothing asks for it; `pointerLight: false` on a lens opts out. + * - A surface that holds choices also lights up around a choice pressed in it, with GLOW's + * `select` values: a wide, soft light that stays inside the glass. A choice is an option, a + * menu item, or anything marked `data-glass-item` or `data-glass-pick`. The engine does it for + * every surface (a menu, a submenu, a card with rows); the lists of a Select, a Dropdown Menu + * and a Popover bring the same light themselves (theirs leaves with the surface) and say + * `choices: false`. + * - A button takes LIGHT too, beneath its GLOW. No light follows the pointer, and a pointer that + * only rests on the glass lights nothing. + * + * A new component follows the rule by saying what it is: it never draws a light of its own. + * + * GLOW: a press lets light into the glass where it lands. The light paints nothing: it brightens what + * is already there, keeping its colour (luminance L becomes L^(1 / (1 + amount)) at the centre, + * so black stays black and white stays white). These are + * the values for wider controls; GLOW_SMALL, below, holds the same set for small ones. + */ +export const GLOW = { + /** One press, at the centre of the light. Presses that land before the last has faded add up, to `stack` presses at most. */ + amount: 3.55, + stack: 3, + /** + * A choice made inside an open surface: this much of a press, and a light of its own size. It + * is a wide, soft light around the choice (`selectReach` at first, `selectSpread` more as it + * fades, both × the control's height) and it leaves as the surface starts back in. + */ + select: 0.45, + selectReach: 1.6, + selectSpread: 1.2, + /** A choice's light is gone once the surface is this far back in (0–1 of the way open; higher = it leaves sooner). */ + selectLeave: 0.5, + /** The light's reach at first, and how much further it spreads as it fades (both × the control's height). */ + reach: 1.65, + spread: 3, + /** It stays for at least this long (seconds), comes up at `riseSpeed`, fades at `fadeSpeed` and spreads at `spreadSpeed` (springs: higher = faster). */ + hold: 0.2, + riseSpeed: 60, + fadeSpeed: 5.5, + spreadSpeed: 5, + /** + * The press that opens a surface: its light grows with the surface until it covers it whole + * (its reach ends at `cover` × the surface's diagonal). It lets go once the surface is this + * far open (0–1) and fades at `coverFadeSpeed`: a flash, not a wash. + */ + cover: 0.9, + coverUntil: 0.1, + coverFadeSpeed: 10, + /** How much of the light spills past an open surface's edge (0 = none). */ + halo: 0.35, +} +/** + * What the rim mirrors of the page around the glass. Each point of the rim looks outwards and + * takes the colour of what it faces, where that differs from the surface the glass sits on: an + * orange button above a control shows as an orange edge along its top. Only clear glass + * mirrors: glass in its own colour (tinted, or a lens frosted over at rest) shows nothing. + * These values are the look. + */ +export const MIRROR = { + /** + * How much of a neighbour shows on the rim's line (1 at most: the line is the rim light's own, + * as thin as the one that leans towards the cursor), and in the band that begins inside it. + */ + line: 1, + band: 0.7, + /** + * How deep that band goes: this × the glass's shorter half (or its reach, on taller glass). + * The rim's edge looks `reach` far; the look shortens with depth and ends here, so a + * neighbour's picture fills the band where it is near and thins out where the rim turns + * away from it: a crescent on a round glass. + */ + depth: 0.58, + /** How fast the picture fades from the rim inwards, an exponent (1 = evenly, higher = it keeps closer to the rim). */ + fall: 1, + /** How soft the picture is: the patch each point gathers, × the reach (0 = a sharp mirror). */ + soft: 1, + /** How much more than its plain difference from the surface a neighbour counts. */ + gain: 1.8, + /** How much a darker neighbour dims the rim (× the above; 0 = not at all). */ + dim: 0.65, + /** How far the rim's edge looks: this × the glass's height, between `reachMin` and `reachMax` px. */ + reach: 0.55, + reachMin: 24, + reachMax: 96, + /** What a point gathers along its look: shares from its near part, from further out and from its far end. */ + near: 0.25, + mid: 0.35, + far: 0.4, + /** The rim light's far side: its brightness (× the lit side's), and how much of the surroundings' colour it takes (0 = always white). */ + bounce: 0.6, + tint: 1, +} + +/** + * The same light on a small control: a single icon, or a label of about five letters (up to + * roughly twice as wide as it is tall, as in GOOEY). In between the two sets are blended. The + * light stays close to the press there, comes up slower and holds until the surface is half open. + */ +export const GLOW_SMALL: typeof GLOW = { ...GLOW, reach: 0.7, spread: 0.7, riseSpeed: 24, coverUntil: 0.5 } + +/** The light on a morphing control (Popover): GLOW's, staying longer and adding up a little further. */ +export const MORPH_GLOW: typeof GLOW = { ...GLOW, stack: 3.5, hold: 0.5 } +export const MORPH_GLOW_SMALL: typeof GLOW = { ...GLOW_SMALL, stack: MORPH_GLOW.stack, hold: MORPH_GLOW.hold } + +/** + * LIGHT, the light every glass takes under a press and the only one a surface takes (the rule is + * above GLOW): glass lit from within, beginning where the press landed. A press (any + * pointer, or Space / Enter on the focused control) brings it up, and it stays at that point of + * the glass for as long as the press is held, wherever the pointer goes; let go, it sinks back. + * It follows nothing, and a pointer that only rests on the glass lights nothing. It is white laid over the + * glass: strongest at that point, falling off evenly to nothing at its radius, and it never + * leaves the glass. Every glass takes it: the kit's controls, and a surface that opens + * (GlassPopup), on top of its own light (GLOW). A lens that says `pointerLight: false` does not, + * and `on: false` turns it off everywhere. The light and its numbers are those of Glass HQ's liquid-glass 0.0.2 (MIT, + * https://github.com/Glass-HQ/liquid-glass). Read on every frame: do not tune them casually. + */ +export const LIGHT = { + on: true, + /** How white the glass is under the pointer at full light (0–1): on a light page, and on a dark one. */ + strength: 0.3, + strengthDark: 0.16, + /** How much of the full light a press brings. */ + press: 1, + /** The light's radius: `size ×` the glass's longer side, between `sizeMin` and `sizeMax` px. */ + size: 0.9, + sizeMin: 36, + sizeMax: 180, + /** A press comes up in about `rise` seconds, overshooting a little (`riseBounce`: 0 = none), and sinks back in `fade` seconds, without bounce. */ + rise: 0.24, + riseBounce: 0.2, + fade: 0.42, +} + +/** Every spring the kit uses. Hover width/height bounce out of phase: the glass wobbles like a drop. */ +export const SPRINGS = { + press: { omega: 16, zeta: 0.6 }, + hoverX: { omega: 17, zeta: 0.42 }, + hoverY: { omega: 12, zeta: 0.34 }, + /** A droplet separating from the body: slow, one small overshoot. */ + dropletOut: { omega: 5, zeta: 0.72 }, + /** The droplet melting back in (pointer leaves or presses). */ + dropletIn: { omega: 13, zeta: 0.7 }, + /** A lens sliding to the newly selected option. */ + slide: { omega: 14, zeta: 0.75 }, + /** A dragged lens following the finger. */ + drag: { omega: 40, zeta: 0.999 }, +} as const + +/** + * Glass that a held pointer pulls after itself: press it, drag away, and it follows a little way + * through a rubber band, stretches along the pull and thins across it, then swings back like gel + * when let go. It is for buttons: the engine does it for glass whose view says `pull: true` + * (GlassLayer does, so Button, Action Button and Button Group; `pull={false}` there keeps one in + * its place), the innermost one under the press, by moving and stretching its host (CSS + * `translate` and `scale`, content included). The control of a surface that opens (GlassPopup: + * Select, Dropdown Menu, Popover, Menu) is a button too while it is shut, and opens when the press + * is let go on it. No other glass is pulled, and `on: false` here turns it off everywhere. The motion and its numbers are those of Glass HQ's liquid-glass 0.0.2 (MIT, + * https://github.com/Glass-HQ/liquid-glass). Read on every frame: do not tune them casually. + */ +export const PULL = { + on: true, + /** + * Glass whose longer side is at most this (px) is small: it follows the pointer from the point + * it was pressed at. Larger glass moves only once the pointer is past its edge, by how far past. + */ + smallUntil: 72, + /** The furthest the pull moves small glass, px: `smallReach + smallReachPerPx × its longer side`. */ + smallReach: 4, + smallReachPerPx: 0.15, + /** The same for larger glass, `reachMax` at most. */ + reach: 3, + reachPerPx: 0.04, + reachMax: 10, + /** How fast the band stiffens: 0.55 is a scroll view's. */ + resistance: 0.55, + /** Following the pointer takes `follow + followPerPx × the longer side` seconds, without bounce (larger glass is heavier). */ + follow: 0.18, + followPerPx: 5e-4, + /** Let go: back to rest in about `release` seconds, overshooting like gel (`releaseBounce`: 0 = none, towards 1 = more). */ + release: 0.5, + releaseBounce: 0.42, + /** + * The stretch along one axis: `stretch × the pull ÷ the glass's size that way`, plus + * `stretchPerSpeed ×` the pull's own speed and `stretchPerDrift ×` the speed the glass's place + * on the page moves at (px/s). Small glass stretches by `smallStretchMax` at most, larger by + * `stretchMax`. Across, the glass thins by the square root of the stretch. + */ + stretch: 0.5, + stretchPerSpeed: 7e-5, + stretchPerDrift: 5e-5, + smallStretchMax: 0.2, + stretchMax: 0.12, + /** The drift speed is smoothed in at this rate while held, and dies out at `driftOut` (per second). */ + driftIn: 12, + driftOut: 10, +} + +/** + * Cohesion: the glass of two buttons that come near each other melts into one body, as two drops + * of liquid do. Within reach the sides that face each other lean out, nearer still a bridge forms + * between them, and it thins and lets go as they part, whatever brings them together: a pull, a + * swell, the layout. It is for buttons: the engine does it for glass whose view says + * `button: true` (GlassLayer's, so Button, Action Button and Button Group). A surface (a card, a + * menu, a lens) never melts, and a button never melts into glass it sits inside. Each canvas + * draws its own side of the bridge, up to the line where the two glasses are as near, and across + * the bridge they share their looks (bevel, bend, tint, shadow), so the line does not show. Joined, + * the light of a press on one runs on into the other (`light` says how much of it), as far as it + * reaches (GLOW and LIGHT, measured from where the press landed). The shape is a smooth union of + * the glasses' distance fields, the fusion of Liquid Glass Studio (MIT, + * https://github.com/iyinchao/liquid-glass-studio). `on: false` turns it off everywhere. Read on + * every frame: do not tune them casually. + */ +export const COHESION = { + on: true, + /** + * How soft the bridge is: `reach ×` the shorter glass's height, between `reachMin` and + * `reachMax` px. Two glasses begin to melt once the gap between them is under this (it eases in + * until the gap is half of it), and join into one once the gap is under half of it. + */ + reach: 1.2, + reachMin: 2, + reachMax: 6, + /** + * How much of the light of a press on one glass runs on into a glass it has melted into, once + * the bridge between them has some body (0 = none: each keeps its own light; 1 = all of it, as + * one body). Short of that, the light crosses only where the two meet. + */ + light: 0.07, + /** That light fades as it goes into the other glass, as a reflection would: it is down to a third this far from where the two meet (× that glass's half height). */ + lightFade: 1, +} + +/** The bridge's softness between glass of this height (px) and glass as tall or taller (COHESION); 0 while it is off. */ +export function cohesionSoftness(height: number) { + if (!COHESION.on) return 0 + return Math.min(Math.max(COHESION.reach * height, COHESION.reachMin), Math.max(COHESION.reachMin, COHESION.reachMax)) +} + +/** + * Presses the kit sends itself: GlassPopup keeps a press that would open its surface and hands it + * on when it is let go. Such a press is no pointer holding the glass: nothing is pulled or lit by + * it, and no release follows it. Whoever dispatches one adds it here first. + */ +export const HANDED_ON = new WeakSet() + +/** A rubber band: a short pull follows almost one to one, a long one nears `limit` and never reaches it. */ +export function rubberBand(offset: number, limit: number, resistance = 0.55) { + if (!(limit > 0)) return 0 + return Math.sign(offset) * limit * (1 - 1 / ((Math.abs(offset) * resistance) / limit + 1)) +} + +/** + * The gooey popup: a surface (a list, a menu, a popover) that swells out of its anchor as one + * body of glass, holds on by a neck that thins and snaps, and plays the same motion backwards to + * close. Used by GlassPopup (`glass-popup.tsx`). These values are the look: do not tune them casually. + */ +export const GOOEY = { + /** How heavy the two halves are. Heavier glass is thrown less by a jolt and swings back slower. */ + weight: 6, + /** The panel opening: speed, and damping (below 1 it overshoots as it lands). */ + openSpeed: 11, + openDamping: 1, + /** Closing replays the opening backwards, at closeSpeed / openSpeed × its pace (equal = the same pace). */ + closeSpeed: 26, + /** The panel lets go of the trigger once it is this far open (0–1). */ + detachAt: 0.1, + /** How fast the neck thins once it lets go (lower = a slower snap). */ + snapSpeed: 5.6, + /** Bridge softness in px at full strength, and how far the panel leans back towards the trigger. */ + neckSoftness: 50, + neckPull: 11, + /** The jolt when the neck snaps: its strength, how fast it swings, how soon it dies out (higher = sooner). */ + kick: 6, + recoilSpeed: 4, + recoilDamping: 1, + /** How far each half is thrown by a jolt, and how far the trigger sags while attached (px). */ + triggerJolt: 0, + panelJolt: 0, + triggerSag: 6, + /** The list: how far open the panel is when the first option appears (0–1), the delay between options and each one's fade (seconds). */ + itemsAt: 0.85, + itemsGap: 0.06, + itemsFade: 0.22, + /** + * Small controls only: a single icon, or a label of about five letters (up to roughly twice as + * wide as they are tall). The bridge is as wide as the whole control there, so it gets its own + * softness in px (in place of neckSoftness), a fade of that softness towards the control's far + * edge (0–1, and how far in it recovers, × the height) and a neck no thinner than this × the + * height, at first and once it has gathered. Wider controls keep the values above. + */ + smallNeckSoftness: 14, + smallEdgeFade: 1, + smallEdgeReach: 0.5, + smallNeck: 0.6, + smallNeckWide: 1.2, +} + +/** + * The morphing popup: a control that becomes its surface. The surface (Card's glass, as in the + * gooey popup) comes out over the control itself: round all the way, a little past its own box, + * then settled, while the control lets go of its label and its glass gives way to the card. The + * surface's content comes into focus inside it as it grows. Closing is a calmer motion of its + * own: the content goes first and the surface slides back into the control, slowing as it lands. Used by GlassPopup with `opening: 'morph'` (`glass-popup.tsx`). These values are the + * look: do not tune them casually. + */ +export const MORPH = { + /** The side that grows the most: its speed, and damping (below 1 it lands past the surface and comes back). */ + openSpeed: 30, + openDamping: 1, + /** The other side follows on a slower spring with more bounce. */ + crossSpeed: 16, + crossDamping: 0.58, + /** + * While the first side runs ahead of the other, the glass is this much thinner across (× how + * far ahead, 0–1); as the other catches up and passes it, as much wider. + */ + pinch: 0, + /** Corners, frost and the content's focus follow at this speed, without a bounce. */ + calmSpeed: 12, + /** Closing replays the opening backwards, at this × its pace. */ + closePace: 1.7, + /** The control's label is gone once the surface is this far out (0–1). */ + labelOut: 0.02, + /** The content fades in with the calm follow, and is fully visible once that is this far (0–1). */ + contentFade: 0.75, + /** How soft the label gets as it goes, and the content as it starts (a blur, CSS px). */ + labelBlur: 0, + contentBlur: 5.5, + /** How much of the surface's growth the content takes: 1 = it is as small as the glass is, 0 = full size from the start, only cut to the glass. */ + zoom: 1, + /** + * Not gooey: the surface and the control are two shapes laid over each other, with a clean + * edge where they meet. `gooey: 1` melts them there instead, by `softness` CSS px. + */ + gooey: 0, + softness: 40, + /** How the surface starts, in the control's middle: 0 = a circle as tall as the control, 1 = the control's own box. */ + seed: 1, + /** It stays round all the way until the calm follow is this far (0–1); its own corners come after. */ + cornersFrom: 0.3, + /** + * Its weight. At the press the control is thrown down (`kick`: how hard; `throw`: how far a + * throw of 1 carries it, CSS px) and swings back at `swingSpeed`, dying out by `swingDamping` + * (below 1 it swings to and fro). Heavier glass is thrown less and swings slower. + */ + weight: 8, + kick: 8, + swingSpeed: 17.5, + swingDamping: 0.6, + throw: 80, + /** The surface comes out this long after the press (seconds): the control is thrown first. */ + openDelay: 0.1, + /** + * The surface's way into place: as it grows it is carried up to `drop` CSS px above its place + * (negative: below), and comes down `dropDelay` seconds after the press on a soft spring + * (`dropSpeed`; `dropDamping` 1 = no bounce). 0 px = it grows where it is. + */ + drop: 60, + dropDelay: 0.2, + dropSpeed: 9, + dropDamping: 1, + /** Asked to close, the surface stays as it is this long (seconds) before it goes back in. */ + closeDelay: 0, + /** + * `closeSoft: 1`: closing is a motion of its own (`0`: the opening played backwards). The + * surface goes back into the control on one spring with no bounce (`closeSpeed`), slowing as it + * lands, and the control stays still: it is not thrown, does not swell and does not light up. The content + * does not wait for the glass: it is gone `closeFade` seconds after the close begins. A choice's + * light comes into the control with the surface and narrows to `closeGlowReach` (× the control's + * height) as it does, so it does not flood the control. `closeKick`: + * with the opening played backwards, how much of the throw the control takes once the surface + * is back in (× `kick`; 0 = it stays still). + */ + closeSoft: 1, + closeSpeed: 14, + closeFade: 0.12, + closeGlowReach: 1, + closeKick: 1, + /** The control's own glass (clear, lit) gives way to the card's between these two points of the calm follow (0–1). */ + frostFrom: 0, + frostTo: 0.05, +} + +/** + * The growing popup: a control whose glass becomes its menu. One shape on one spring: the + * control's own outline grows into the menu's, wherever the menu lies (below, above or beside + * it), and shrinks back along the same path to close. The side the menu lies on runs ahead and + * the other follows, so the glass pours towards its place instead of scaling up. The control's + * label goes as the glass leaves it; the menu's content stays where it is and the glass opens + * over it. A close that is interrupted carries on from where it is, at the speed it has. It takes + * no light from a press (GLOW is not used here). Used by + * GlassPopup with `opening: 'grow'` (`glass-popup.tsx`). The motion and its numbers are those of + * Glass HQ's liquid-glass 0.0.2 (MIT, https://github.com/Glass-HQ/liquid-glass). These values + * are the look: do not tune them casually. + */ +export const MENU = { + /** Opening takes about `open` seconds and lands a little past the menu (`openBounce`: 0 = not at all, towards 1 = more). */ + open: 0.42, + openBounce: 0.18, + /** Closing: the same, on its own spring. */ + close: 0.32, + closeBounce: 0.1, + /** + * The side the menu lies on leads and the other follows, both as exponents: the leading side + * goes as 1 − (1 − p)^lead, the other as p^follow (1 and 1: both sides grow evenly). + */ + lead: 1.6, + follow: 1.4, + /** + * On the way the corners stay round: no tighter than `round` × the shape's shorter side, until + * the motion is `roundFrom` of the way (0–1), easing to the menu's own corners by `roundUntil`. + */ + round: 0.34, + roundFrom: 0.35, + roundUntil: 0.8, + /** The control's label goes between these two points of the way (0–1), softening by `labelBlur` CSS px. */ + labelFrom: 0.02, + labelTo: 0.3, + labelBlur: 3, + /** The menu's content shows between these two points, coming out of a blur of `contentBlur` CSS px (0 = none: the cheapest). */ + contentFrom: 0.4, + contentTo: 0.9, + /** Closing, the content does not wait for the glass: it is gone this long (seconds) after the close begins. */ + closeFade: 0.12, + contentBlur: 6, + /** The control's glass (clear, lit) gives way to the card's between these two points. Done by `labelTo`, so the label is gone before the menu's layer takes the glass over. */ + frostFrom: 0, + frostTo: 0.3, +} + +export const lerp =(a: number, b: number, t: number) => a + (b - a) * t +export const clamp = (v: number, a = 0, b = 1) => Math.max(a, Math.min(b, v)) +export const smooth = (a: number, b: number, v: number) => { + const t = clamp((v - a) / (b - a)) + return t * t * (3 - 2 * t) +} +export const mixRgb = (a: Rgb, b: Rgb, t: number): Rgb => [lerp(a[0], b[0], t), lerp(a[1], b[1], t), lerp(a[2], b[2], t)] +export const rgbCss = (c: Rgb) => `rgb(${Math.round(c[0] * 255)} ${Math.round(c[1] * 255)} ${Math.round(c[2] * 255)})` + +const isVisibleColor = (c: string) => !!c && c !== 'transparent' && !/rgba\(.*,\s*0\)$/.test(c) && !/\/\s*0\)$/.test(c) + +/** The colour an element sits on: the first ancestor with a painted background. */ +export function surfaceColorOf(el: Element | null): string { + for (let a = el; a; a = a.parentElement) { + const c = getComputedStyle(a).backgroundColor + if (isVisibleColor(c)) return c + } + return getComputedStyle(document.documentElement).colorScheme.includes('dark') ? 'black' : 'white' +} + +/** The lens is designed 120 units tall; every optic below is in those units. */ +export const DESIGN_HEIGHT = 120 + +const VERTEX = `#version 300 es +in vec2 a; +void main() { gl_Position = vec4(a, 0.0, 1.0); } +` + +const FRAGMENT = `#version 300 es +precision highp float; +uniform vec2 uSize, uCenter, uHalf, uLightDir; +uniform float uUnit, uDevicePx, uRadius, uBevel, uBodyX, uBand, uFieldRadius; +uniform vec3 uDrop; +uniform vec4 uBlob; +uniform vec2 uBlobShape, uBlobNeck, uBlobFade; +uniform float uRim, uCaustic, uInner, uTopRefl, uTopBase, uRimWidth, uFresnel; +uniform float uShadow, uShadowSoft, uShadowOffset; +uniform float uLightMix, uEdgeClear; +uniform vec3 uSurface, uColor, uBorder; +uniform float uBorderWidth, uBorderAlpha; +uniform sampler2D uBack, uFront; +uniform float uTextured, uRefract, uMag, uDisp, uBlurCenter, uBlurEdge, uBlurShift, uFrost, uFrostBlur, uFrostMix; +uniform float uFrostEdge, uSaturation, uBendCurve, uEdgeBand; +uniform vec2 uRadial; +uniform vec4 uGlow; +uniform vec2 uGlowHalo; +uniform float uGlowBlob; +uniform vec4 uLight; +uniform vec4 uBlobMat; +uniform vec3 uBlobLine; +uniform float uCssPx; +uniform sampler2D uAround; +uniform vec4 uAroundBox; +uniform float uAroundScale, uReach; +uniform vec4 uMirror, uSeen; +uniform vec2 uBounce; +uniform float uFall, uSoft; +// The glass this one melts into (COHESION), up to four, in this glass's design units. uNear: centre +// (from the lens centre) and half size. uNearShape: corner radius, the radius its bend follows (as +// uFieldRadius), the bridge's softness, bevel. What the two share across the bridge: uNearTint +// (tint colour and how much of it covers clear glass, or the colour of tinted glass), uNearLine +// (rim line colour and opacity), uNearLook (bend, 1 = clear, rim line width, cursor light angle), +// uNearShade (shadow, its softness and offset, its design unit in this glass's), uNearMirror (as +// uMirror.z, uReach and uSoft, and how much it mirrors, × this glass's) and the light of a press, +// uNearGlow and uNearLight (as uGlow and uLight). +// uNearPair: 1 = that glass's canvas lies over this one's; how joined the two are (0 = apart, 1 = +// the bridge between them has some body: the light of a press on either fills both). +uniform float uNearCount; +uniform vec4 uNear[4], uNearShape[4], uNearTint[4], uNearLine[4], uNearLook[4], uNearShade[4], uNearMirror[4], uNearGlow[4], uNearLight[4]; +uniform vec2 uNearPair[4]; +// How far the light of a press runs into the glass it reaches before it has faded (× its half height). +uniform float uNearFade; +out vec4 outColor; + +// design units -> texture uv (textures are uploaded flipped: top row at v = 1) +vec2 toUv(vec2 d) { + vec2 q = d * uUnit; + return clamp(vec2(q.x / uSize.x, 1.0 - q.y / uSize.y), vec2(0.0005), vec2(0.9995)); +} +vec3 backdrop(vec2 st, float lod) { + vec4 c = textureLod(uBack, st, lod); + return c.rgb + (1.0 - c.a) * uSurface; +} +// What surrounds the glass (GlassLens.reflection), at a point of the canvas in design units and +// blurred over spread. Where the picture is empty, or there is none, it is the surface colour. +vec3 around(vec2 d, float spread) { + vec2 st = clamp((d - uAroundBox.xy) / uAroundBox.zw, vec2(0.002), vec2(0.998)); + vec4 c = textureLod(uAround, vec2(st.x, 1.0 - st.y), log2(max(spread * uAroundScale, 1.0))); + return c.rgb + (1.0 - c.a) * uSurface; +} +// Frosted glass: the backdrop under a gaussian blur of deviation sigma (design units), +// gathered from 32 taps on a golden-angle spiral out to 2.5 deviations. Each tap reads a +// mip about as wide as the gap between taps, so the frost stays smooth while the backdrop moves. +vec3 frosted(vec2 p, float sigma) { + float lod = max(log2(sigma * 0.8 * uUnit) - 0.5, 0.0); + vec3 sum = vec3(0.0); + float total = 0.0; + for (int i = 0; i < 32; i++) { + float f = float(i) + 0.5; + float r = sqrt(f / 32.0) * 2.5 * sigma; + float a = f * 2.39996323; + float w = exp(-0.5 * r * r / (sigma * sigma)); + sum += backdrop(toUv(p + r * vec2(cos(a), sin(a))), lod) * w; + total += w; + } + return sum / total; +} +// The sharp bend: the backdrop at p pushed by bend, its colours split slightly. +vec3 bent(vec2 p, vec2 bend, float split, float lod) { + return vec3( + backdrop(toUv(p + bend * (1.0 + split)), lod).r, + backdrop(toUv(p + bend), lod).g, + backdrop(toUv(p + bend * (1.0 - split)), lod).b); +} +float roundRect(vec2 p, vec2 b, float r) { + vec2 q = abs(p) - b + r; + return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - r; +} +float melt(float a, float b, float k) { + float h = clamp(0.5 + 0.5 * (a - b) / k, 0.0, 1.0); + return mix(a, b, h) - k * h * (1.0 - h); +} +// The glass shape: a pill body, smoothly unioned with a separating droplet. +float bodyShape(vec2 p) { + float body = roundRect(p - vec2(uBodyX, 0.0), uHalf, uRadius); + if (uDrop.y <= 0.0) return body; + float d = length(p - vec2(uDrop.x, 0.0)) - uDrop.y; + float k = max(uDrop.z, 1e-3); + float h = clamp(0.5 + 0.5 * (d - body) / k, 0.0, 1.0); + return mix(d, body, h) - k * h * (1.0 - h); +} +// ...and with the optional second box (uBlobShape.y = its bridge softness, 0 = none). +float blobSoft(vec2 p) { + float k = uBlobShape.y; + if (uBlobNeck.y > 0.0) { + float n = (p.x - uBlobNeck.x) / uBlobNeck.y; + // A peaked falloff: as the softness drops, the bridge thins into a thread before it breaks. + k *= exp(0.2 - sqrt(n * n + 0.04)); + } + // On a small body the bridge belongs to the side that faces the second box: towards the far + // edge the softness fades out (uBlobFade: how much, and how far in), or it raises a ridge there. + if (uBlobFade.x > 0.0) { + float back = smoothstep(-uHalf.y, -uHalf.y + 2.0 * uHalf.y * max(uBlobFade.y, 0.01), p.y * sign(uBlob.y)); + k *= mix(1.0, back, uBlobFade.x); + } + return max(k, 1e-3); +} +// The glass's own shape: the body, its droplet and its blob. +float selfShape(vec2 p) { + float s = bodyShape(p); + if (uBlobShape.y <= 0.0) return s; + return melt(roundRect(p - uBlob.xy, uBlob.zw, uBlobShape.x), s, blobSoft(p)); +} +// A glass this one melts into (COHESION): a rounded box. +float nearBox(int i, vec2 p) { + return roundRect(p - uNear[i].xy, uNear[i].zw, uNearShape[i].x); +} +// The shape: its own, melted into every glass within reach. +float shape(vec2 p) { + float s = selfShape(p); + for (int i = 0; i < 4; i++) { + if (float(i) >= uNearCount) break; + s = melt(nearBox(i, p), s, max(uNearShape[i].z, 1e-3)); + } + return s; +} +// What casts the drop shadow: the body alone once a blob has a glass of its own. +float caster(vec2 p) { + return uBlobShape.y > 0.0 && uBlobLine.z > 0.5 ? bodyShape(p) : shape(p); +} +// The body with corners at least as round as the bend is deep (see uBand in main). +float field(vec2 p) { + float f = roundRect(p - vec2(uBodyX, 0.0), uHalf, uFieldRadius); + if (uBlobShape.y > 0.0) f = melt(roundRect(p - uBlob.xy, uBlob.zw, uBlobShape.x), f, blobSoft(p)); + for (int i = 0; i < 4; i++) { + if (float(i) >= uNearCount) break; + f = melt(roundRect(p - uNear[i].xy, uNear[i].zw, uNearShape[i].y), f, max(uNearShape[i].z, 1e-3)); + } + return f; +} +// The reference darkens linear colour; on sRGB values the same factor is k^(1/2.2). +float dim(float k) { return pow(clamp(k, 0.0, 1.0), 1.0 / 2.2); } +vec3 dim(vec3 k) { return pow(clamp(k, 0.0, 1.0), vec3(1.0 / 2.2)); } +float height(vec2 p, float bevel) { + float t = pow(clamp(-shape(p) / bevel, 0.0, 1.0), 1.0 / 1.4); + return sqrt(1.0 - (1.0 - t) * (1.0 - t)); +} +// Radial bend (the SVG card's): towards the centre, strongest at the rim, fading over the +// half size. uRadial is the full bend per axis (design units); uEdgeBand / 0.35 = bendDepth. +float radialRatio(float d) { + return clamp(1.0 - abs(d) / (min(uHalf.x, uHalf.y) * uEdgeBand / 0.35), 0.0, 1.0); +} +// d = shape(q): the caller has it already. +vec2 radialBend(vec2 q, float d) { + vec2 c = q - vec2(uBodyX, 0.0); + float k = pow(radialRatio(d), uBendCurve) * smoothstep(1.5 * uCssPx, -0.5 * uCssPx, d); + return -c / max(length(c), 1e-4) * k * uRadial; +} +// Frost after the bend: every tap is bent on its own, and taps outside the glass are left +// out (the SVG filter saw nothing beyond the card), so the rim keeps its colour. +vec3 frostedRadial(vec2 q, float dq, float sigma) { + float lod = max(log2(sigma * 0.8 * uUnit) - 0.5, 0.0); + vec3 sum = vec3(0.0); + float total = 0.0; + for (int i = 0; i < 32; i++) { + float f = float(i) + 0.5; + float r = sqrt(f / 32.0) * 2.5 * sigma; + float a = f * 2.39996323; + vec2 t = q + r * vec2(cos(a), sin(a)); + // One shape per tap: it masks the tap and bends it. + float dt = shape(t); + float w = exp(-0.5 * r * r / (sigma * sigma)) * step(dt, 0.0); + sum += backdrop(toUv(uCenter + t + radialBend(t, dt)), lod) * w; + total += w; + } + return total > 1e-4 ? sum / total : backdrop(toUv(uCenter + q + radialBend(q, dq)), lod); +} + +void main() { + vec2 px = vec2(gl_FragCoord.x, uSize.y - gl_FragCoord.y); + vec2 local = px / uUnit - uCenter; + float dist = shape(local); + + // Melted into other glass (COHESION), both canvases draw one body: each its own side of the line + // where the two glasses are as near (side: how much nearer the nearest neighbour is here). What + // the look depends on is shared across the bridge: a neighbour takes r / (1 + Σ r) of it, none + // deep in this glass, half on that line, all of it deep in its own glass. Both canvases work out + // the same values on the line, so it does not show. Without neighbours, each is this glass's own. + float side = -1.0; + float share = 1.0; + float mine = dist; + float nearTotal = 1.0; + float nearT[4] = float[4](0.0, 0.0, 0.0, 0.0); + float nearD[4] = float[4](0.0, 0.0, 0.0, 0.0); + float scale = 1.0; + float bevel = uBevel; + float refract = uRefract; + float blurShift = uBlurShift; + float shadowAmount = uShadow; + float shadowSoft = uShadowSoft; + float shadowOffset = uShadowOffset; + float ny = local.y / uHalf.y; + float nx = (local.x - uBodyX) / uHalf.x; + float ly = local.y; + vec2 lightDir = uLightDir; + vec3 lineColor = uBorder; + float lineAlpha = step(1e-4, uBorderWidth) * uBorderAlpha; + float lineWidth = uBorderWidth; + vec3 mirrorShape = vec3(uMirror.z, uReach, uSoft); + float glowNear = 0.0; + float lightNear = 0.0; + float ownLight = 1.0; + if (uNearCount > 0.0) { + mine = selfShape(local); + float nearest = 1e9; + float sumScale = 1.0; + float sumBevel = uBevel; + float sumRefract = uRefract; + vec3 sumShadow = vec3(uShadow, uShadowSoft, uShadowOffset); + vec3 sumPlace = vec3(ny, nx, ly); + vec2 sumDir = uLightDir; + vec3 sumLine = uBorder * lineAlpha; + float sumAlpha = lineAlpha; + float sumWidth = uBorderWidth * lineAlpha; + vec3 sumMirror = mirrorShape; + float apartAll = 0.0; + float glowJoined = 0.0; + float lightJoined = 0.0; + for (int i = 0; i < 4; i++) { + if (float(i) >= uNearCount) break; + float d = nearBox(i, local); + nearD[i] = d; + nearest = min(nearest, d); + // How far this point has gone over to the neighbour: 0 to 1 across the bridge's softness. + float t = clamp(0.5 + (mine - d) / max(uNearShape[i].z, 1e-3), 0.0, 1.0); + nearT[i] = t; + float r = t / max(1.0 - t, 1e-4); + nearTotal += r; + vec4 n = uNear[i]; + sumScale += r * uNearShade[i].w; + sumBevel += r * uNearShape[i].w; + sumRefract += r * uNearLook[i].x; + sumShadow += r * uNearShade[i].xyz; + sumPlace += r * vec3((local.y - n.y) / n.w, (local.x - n.x) / n.z, local.y - n.y); + sumDir += r * vec2(cos(uNearLook[i].w), sin(uNearLook[i].w)); + float a = uNearLine[i].w; + sumLine += r * a * uNearLine[i].rgb; + sumAlpha += r * a; + sumWidth += r * a * uNearLook[i].z; + sumMirror += r * uNearMirror[i].xyz; + // The light of a press on either glass: shared like the rest while they are apart, and all of + // it everywhere once they are joined, so it runs on through the whole body. + // ...fading as it goes deeper into this glass from the line between them, as a reflection would. + float join = uNearPair[i].y * exp(-max(d - mine, 0.0) / max(uHalf.y * uNearFade, 0.5)); + float apart = r * (1.0 - join); + apartAll += apart; + vec2 gd = (local - uNearGlow[i].xy) / max(uNearGlow[i].z, 1.0); + float glow = uNearGlow[i].w * exp(-dot(gd, gd)); + float light = uNearLight[i].w * max(1.0 - length(local - uNearLight[i].xy) / max(uNearLight[i].z, 1e-3), 0.0); + glowNear += apart * glow; + lightNear += apart * light; + glowJoined += join * glow; + lightJoined += join * light; + } + side = mine - nearest; + share = clamp(0.5 - side / (4.0 * uDevicePx), 0.0, 1.0); + // Lengths built into the look (in design units) follow the shared design unit. + scale = sumScale / nearTotal; + bevel = sumBevel / nearTotal; + refract = sumRefract / nearTotal; + blurShift = uBlurShift + log2(max(scale, 1e-3)); + shadowAmount = sumShadow.x / nearTotal; + shadowSoft = sumShadow.y / nearTotal; + shadowOffset = sumShadow.z / nearTotal; + ny = sumPlace.x / nearTotal; + nx = sumPlace.y / nearTotal; + ly = sumPlace.z / nearTotal; + if (dot(sumDir, sumDir) > 1e-6) lightDir = normalize(sumDir); + lineAlpha = sumAlpha / nearTotal; + if (sumAlpha > 1e-4) { + lineColor = sumLine / sumAlpha; + lineWidth = sumWidth / sumAlpha; + } + mirrorShape = sumMirror / nearTotal; + glowNear = glowNear / nearTotal + glowJoined; + lightNear = lightNear / nearTotal + lightJoined; + ownLight = 1.0 - apartAll / nearTotal; + } + + // Drop shadow: tight + ambient, kept near the glass, faded before the canvas edge. + float vFade = smoothstep(-0.1, 0.9, ny) * 0.92 + 0.08; + float outside = smoothstep(-4.0 * scale, 14.0 * scale, dist); + float near = 1.0 - smoothstep(-6.0 * scale, shadowSoft, caster(local - vec2(0.0, shadowOffset))); + float far = 1.0 - smoothstep(-10.0 * scale, shadowSoft * 1.5, caster(local - vec2(0.0, shadowOffset * 1.6))); + float border = min(min(px.x, px.y), min(uSize.x - px.x, uSize.y - px.y)); + float sh = clamp((near + far) * shadowAmount * vFade * outside, 0.0, 0.85) * smoothstep(0.0, 14.0, border); + vec4 outsideCol = vec4(0.0, 0.0, 0.0, 1.0 - dim(1.0 - sh)); + + // Glow (see below): its strength here. It stays inside the glass unless a halo is asked for + // (uGlowHalo: 1 = around the body, 2 = around the blob; and how much). + float glowAt = 0.0; + if (uGlow.w > 0.0) { + vec2 gd = (local - uGlow.xy) / max(uGlow.z, 1.0); + glowAt = uGlow.w * exp(-dot(gd, gd)); + if (uGlowHalo.x > 0.5) { + // Past that edge it brightens the page the same way: the page's own colour at its + // brightest, laid over just thick enough to lift the surface colour to L^(1 / (1 + halo)). + float edgeDist = uGlowHalo.x > 1.5 ? roundRect(local - uBlob.xy, uBlob.zw, uBlobShape.x) : roundRect(local - vec2(uBodyX, 0.0), uHalf, uRadius); + float halo = glowAt * uGlowHalo.y * exp(-max(edgeDist, 0.0) / 28.0) * smoothstep(0.0, 14.0, border); + float pageL = max(dot(uSurface, vec3(0.2126, 0.7152, 0.0722)), 1e-4); + float pageMax = max(max(uSurface.r, uSurface.g), uSurface.b); + float cover = clamp((pow(pageL, 1.0 / (1.0 + halo)) / pageL - 1.0) * pageMax / max(1.0 - pageMax, 1e-3), 0.0, 1.0); + outsideCol = vec4(uSurface / max(pageMax, 1e-3) * cover, cover + outsideCol.a * (1.0 - cover)); + } + } + + // Outside the glass the shadow (and the halo) is the whole pixel: about half of every canvas + // stops here, before the bevel, the bend and the light are worked out. + float aa = max(fwidth(dist), 1e-4); + float mask = 1.0 - smoothstep(-aa, aa, dist); + // Past the line, the neighbour's own canvas draws the body: here only this glass's share of the + // shadow the two cast together. Along the line the two canvases cross-fade over a few px: the + // one beneath draws its glass a little past the line, and the one above fades in over it, so + // what little the two pictures differ by (each blurs its own picture of the page) does not show + // as a line. cover: how much of the glass this canvas draws here. + float cover = 1.0; + if (uNearCount > 0.0) { + outsideCol *= share; + float fade = 4.0 * uCssPx; + for (int i = 0; i < 4; i++) { + if (float(i) >= uNearCount) break; + float s = mine - nearD[i]; + if (uNearPair[i].x > 0.5) cover *= step(s, fade + 2.0 * uDevicePx); + else cover *= smoothstep(fade, -fade, s); + } + if (cover <= 0.0) { + outColor = outsideCol * (1.0 - mask); + return; + } + } + if (mask <= 0.0) { + outColor = outsideCol; + return; + } + + // The lighting belongs to the body. A melted blob takes none of it (no reflection, inner + // shading, rim light or caustic): its face stays flat, and the light fades out where it begins. + float lit = 1.0; + if (uBlobShape.y > 0.0) lit = 1.0 - smoothstep(-2.0, 8.0, roundRect(local - vec2(uBodyX, 0.0), uHalf, uRadius)); + // A blob with a glass of its own: its tint, frost and bend take over where the light leaves. + float own = (1.0 - lit) * uBlobLine.z; + float frostCover = mix(uFrost, uBlobMat.x, own); + float frostBlur = mix(uFrostBlur, uBlobMat.y, own); + float bendCurve = mix(uBendCurve, uBlobMat.z, own); + float edgeBand = mix(uEdgeBand, uBlobMat.w, own); + + // Surface normal from the bevel height field. + float e = 1.25 * scale; + float h = height(local, bevel); + vec2 grad = vec2(height(local + vec2(e, 0.0), bevel) - h, height(local + vec2(0.0, e), bevel) - h) / e; + vec3 normal = normalize(vec3(-grad * 42.0 * scale, 1.0)); + float depth = clamp(1.0 - h, 0.0, 1.0); + float edge = 1.0 - smoothstep(0.0, bevel * edgeBand, -dist); + vec2 dir = normalize(vec2(shape(local + vec2(e, 0.0)) - dist, shape(local + vec2(0.0, e)) - dist) + 1e-6); + + vec3 glass; + if (uTextured > 0.5 && (uRadial.x > 0.0 || uRadial.y > 0.0)) { + // Radial bend, then frost: the old SVG card's rim. + float ratio = radialRatio(dist); + float sharpLod = max(uBlurShift, 0.0); + if (uFrostBlur > 0.0 && dist < 1.0) { + vec3 frost = frostedRadial(local, dist, uFrostBlur * mix(1.0, uFrostEdge, pow(ratio, 1.3))); + glass = uFrostMix < 1.0 ? mix(bent(uCenter + local, radialBend(local, dist), uDisp * 0.35, sharpLod), frost, uFrostMix) : frost; + } else { + glass = bent(uCenter + local, radialBend(local, dist), uDisp * 0.35, sharpLod); + } + if (uSaturation != 1.0) glass = max(mix(vec3(dot(glass, vec3(0.2126, 0.7152, 0.0722))), glass, uSaturation), 0.0); + } else if (uTextured > 0.5) { + // Refraction: magnify the middle, bend inwards at the rim, split colours slightly. + // A lens with square corners (uBand > 0) bends deeper than its corner radius. The + // bend then follows a shape whose corners are at least that round: on the real + // shape its direction would break along the diagonals. Mask and light keep the real shape. + float bendEdge = edge; + vec2 bendDir = dir; + if (uBand > 0.0) { + float fd = field(local); + bendDir = normalize(vec2(field(local + vec2(e, 0.0)) - fd, field(local + vec2(0.0, e)) - fd) + 1e-6); + bendEdge = 1.0 - smoothstep(0.0, uBand, -fd); + } + vec2 magnified = local / (uMag * h + 1.0); + vec2 bend = -bendDir * refract * pow(bendEdge, bendCurve); + float split = uDisp * 0.35 * (1.0 - own); + float lod = max(mix(uBlurCenter, uBlurEdge, pow(bendEdge, 1.3)) + blurShift, 0.0); + vec2 at = uCenter + magnified; + if (frostBlur > 0.0 && dist < 1.0) { + // Frosted (inside the glass only: outside, nothing of it shows). The frost hides the + // colour split, so one bent point is enough; uFrostMix lets the sharp bend show through. + vec3 frost = frosted(at + bend, frostBlur * mix(1.0, uFrostEdge, pow(bendEdge, 1.3))); + glass = uFrostMix < 1.0 ? mix(bent(at, bend, split, lod), frost, uFrostMix) : frost; + } else { + glass = bent(at, bend, split, lod); + } + // Vibrancy: what shows through, more (or less) saturated. + if (uSaturation != 1.0) glass = max(mix(vec3(dot(glass, vec3(0.2126, 0.7152, 0.0722))), glass, uSaturation), 0.0); + } else { + // Tinted glass: its own colour in the middle, thinning towards the rim. + glass = mix(uSurface, uColor, 1.0 - edge * uEdgeClear); + } + + // Top reflection. + float top = ((1.0 - smoothstep(-0.05, 0.75, ny)) * (1.0 - nx * 0.12) * uTopRefl * 0.6 + uTopBase) * lit; + vec3 topDim = dim(1.0 - vec3(1.0, 1.0, 0.72) * top); + glass *= topDim; + vec3 seenThrough = glass; + + // Frosted resting state: a still lens is the flat highlight colour. + glass = mix(glass, uColor, frostCover * step(0.5, uTextured)); + // Melted into a neighbour (COHESION), the glass turns into that one's tint or colour across the + // bridge. Clear glass beside tinted turns all the way by the line, for the tinted side cannot + // draw what lies behind: that one keeps its own look, and the clear side meets it there. + float mirrorShare = 1.0; + if (uNearCount > 0.0) { + vec3 sumLook = glass; + float sumW = 1.0; + float sumMirrors = 1.0; + for (int i = 0; i < 4; i++) { + if (float(i) >= uNearCount) break; + bool clearNear = uNearLook[i].y > 0.5; + float t = clearNear == (uTextured > 0.5) ? nearT[i] : (clearNear ? 0.0 : min(1.0, 2.0 * nearT[i])); + float w = t / max(1.0 - t, 1e-4); + vec3 look = clearNear ? mix(seenThrough, uNearTint[i].rgb, uNearTint[i].a) : mix(uSurface, uNearTint[i].rgb, 1.0 - edge * uEdgeClear) * topDim; + sumLook += w * look; + sumW += w; + sumMirrors += w * uNearMirror[i].w; + } + glass = sumLook / sumW; + // What it mirrors is shared the same way: towards tinted glass, which mirrors nothing, it fades + // out. Each canvas mirrors its own picture of the surroundings, so the mirror fades out across + // the bridge too, to nothing on the line: the middle of one body mirrors nothing anyway. + mirrorShare = sumMirrors / sumW; + for (int i = 0; i < 4; i++) { + if (float(i) >= uNearCount) break; + mirrorShare *= 1.0 - 4.0 * nearT[i] * (1.0 - nearT[i]); + } + } + + // Inner shading: just inside the rim, a wide band on the left, a deep ring. + float up = clamp(-dir.y, 0.0, 1.0); + float right = clamp(dir.x, 0.0, 1.0); + float left = clamp(-dir.x, 0.0, 1.0); + float down = clamp(dir.y, 0.0, 1.0); + float inner = uInner * lit; + float innerBand = smoothstep(bevel * -0.19, bevel * -0.024, dist); + glass *= dim(1.0 - innerBand * (up + left * 0.6 + right * 0.3 + down * 0.15) * inner * 2.2); + float deepBand = smoothstep(bevel * -0.73, bevel * -0.13, dist); + glass *= dim(1.0 - deepBand * left * inner * 2.0); + float hx = (dist + bevel * 0.45) / (bevel * 0.26); + float ring = exp(-hx * hx); + glass *= dim(1.0 - ring * (right * 0.9 + up * 0.5 + left * 0.4 + down * 0.3) * inner * 1.5); + + // Rim light + fresnel; leans a little towards the cursor when there is one. + float fresnel = pow(clamp(1.0 - normal.z, 0.0, 1.0), 6.0); + float rimW = max(uDevicePx * 1.1, scale) * uRimWidth; + float rimLine = 1.0 - smoothstep(0.0, rimW * 1.6, abs(dist + rimW * 1.8)); + float fall = exp(-(ly / (30.0 * scale)) * (ly / (30.0 * scale))); + float studio = right * right * fall * 0.9 + down * down * 0.2 + left * left * 0.55; + float lightCos = dot(dir, lightDir); + float facing = clamp(lightCos, 0.0, 1.0); + float away = clamp(-lightCos, 0.0, 1.0); + float aimed = facing * facing * 0.9 + away * away * 0.55; + float lean = uLightMix * 0.4; + float rimDir = mix(studio, aimed, lean); + float front = mix(right, facing, lean); + float back = mix(left, away, lean); + // What this point of the glass mirrors. The bevel is a curved mirror: its very edge looks far + // out, the way the rim faces there, and the look shortens with depth, down to nothing at the + // band's inner end (uMirror.z). So a neighbour's picture is squeezed into the rim, deepest + // where it is nearest and thinner as the rim turns away from it: a crescent on a round glass, + // on a pill a band that tapers round the ends. Each point gathers a soft patch of the + // surroundings (uSoft wide) at three places along its look, so the picture has no hard edge. + float into = clamp(-dist / mirrorShape.x, 0.0, 1.0); + float look = mirrorShape.y * (1.0 - into); + vec2 rimAt = uCenter + local - dir * dist; + vec2 across = vec2(-dir.y, dir.x) * mirrorShape.z * 0.7; + vec3 seen = vec3(0.0); + for (int i = 0; i < 3; i++) { + vec2 at = rimAt + dir * look * (0.4 + 0.3 * float(i)); + seen += (around(at, mirrorShape.z) * 0.4 + around(at + across, mirrorShape.z) * 0.3 + around(at - across, mirrorShape.z) * 0.3) * uSeen[i]; + } + // The light is white where it lands; the far side and the bottom are lit by what bounces back + // from the surroundings, and take their colour (white from anything dark or grey). + float seenMax = max(max(seen.r, seen.g), seen.b); + vec3 bounce = mix(vec3(1.0), seen / max(seenMax, 1e-3), smoothstep(0.08, 0.5, seenMax) * uBounce.y); + vec3 rimCol = mix(vec3(1.0), bounce, down * 0.6); + rimCol = mix(rimCol, bounce * uBounce.x, back * 0.85); + glass += rimCol * (rimLine * rimDir * uRim + fresnel * front * uFresnel * step(0.001, uRim)) * lit; + + // Reflection: the rim mirrors what differs from the surface the glass sits on. A neighbour + // of another colour shows on the rim that faces it; a darker one dims it a little. + // (uMirror: on the line, in the band inside it, that band's depth, the dimming. uSeen.w: the gain.) + // much: how far what is seen differs from the surface; hue: that difference at full strength. + vec3 differs = (seen - uSurface) * uSeen.w; + float much = max(max(abs(differs.r), abs(differs.g)), abs(differs.b)); + vec3 hue = differs / max(much, 1e-4); + much = min(much, 1.0); + // On the rim it is the rim light's own line, no thicker; the band begins inside that line. + float band = pow(1.0 - into, uFall) * uMirror.y * smoothstep(0.0, rimW * 1.8, -dist); + float mirror = min(lit * max(rimLine * uMirror.x, band), 1.0) * much * mirrorShare; + // What it lacks of the surface's colour is taken out of the glass; then the glass is lifted + // towards the neighbour's colour: dark glass mirrors it on any page. + glass *= 1.0 - max(-hue, 0.0) * mirror * uMirror.w; + glass += max(clamp(uSurface + hue, 0.0, 1.0) - glass, 0.0) * mirror; + + // Glow: light let in at one point, fading smoothly with distance. It brightens whatever glass + // is near, evenly from the middle to the rim, a melted blob included (the halo is above), + // unless the light is kept to the body (uGlowBlob: how much of it the blob takes). + // Melted, the light of a press on a neighbour runs on into this side of the bridge. + float glassL = max(dot(glass, vec3(0.2126, 0.7152, 0.0722)), 1e-4); + float glowHere = glowAt * mix(uGlowBlob, 1.0, lit); + if (uNearCount > 0.0) glowHere = glowHere * ownLight + glowNear; + glass *= pow(glassL, 1.0 / (1.0 + glowHere)) / glassL; + + // Pointer light (LIGHT): white laid over the glass, strongest where the press landed and falling + // off evenly to nothing at its radius. (uLight: its centre, its radius, how white.) + float white = uLight.w > 0.0 ? uLight.w * max(1.0 - length(local - uLight.xy) / max(uLight.z, 1e-3), 0.0) : 0.0; + if (uNearCount > 0.0) white = white * ownLight + lightNear; + if (white > 0.0) glass = mix(glass, vec3(1.0), min(white, 1.0)); + + // Caustic: warm light gathering inside the bottom edge. + glass += vec3(1.0, 0.92, 0.86) * smoothstep(0.72, 0.98, depth) * down * uCaustic * lit; + + // Bordered body (outline buttons): a flat line just inside the edge. + glass = mix(glass, lineColor, smoothstep(-lineWidth - aa, -lineWidth + aa, dist) * lineAlpha); + // ...and the white line of a blob with its own glass. + glass = mix(glass, vec3(1.0), smoothstep(-uBlobLine.x - aa, -uBlobLine.x + aa, dist) * uBlobLine.y * own); + vec4 col = mix(outsideCol, vec4(clamp(glass, 0.0, 1.0), 1.0), mask * cover); + // Front layer (selected labels) sits on the frosted pill and fades as the lens clears. + vec4 fg = texture(uFront, gl_FragCoord.xy / uSize) * mask * cover * uFrost * step(0.5, uTextured); + outColor = fg + col * (1.0 - fg.a); +} +` + +function createEngine(): GlassEngine | null { + const glCanvas = document.createElement('canvas') + const gl = glCanvas.getContext('webgl2', { alpha: true, premultipliedAlpha: true, antialias: false }) + if (!gl) return null + const compile = (type: number, src: string) => { + const s = gl.createShader(type) + if (!s) return null + gl.shaderSource(s, src) + gl.compileShader(s) + if (gl.getShaderParameter(s, gl.COMPILE_STATUS)) return s + console.warn('[liquid-glass] shader failed to compile', gl.getShaderInfoLog(s)) + return null + } + const vs = compile(gl.VERTEX_SHADER, VERTEX) + const fs = compile(gl.FRAGMENT_SHADER, FRAGMENT) + const program = gl.createProgram() + if (!vs || !fs || !program) return null + gl.attachShader(program, vs) + gl.attachShader(program, fs) + gl.linkProgram(program) + if (!gl.getProgramParameter(program, gl.LINK_STATUS)) return null + gl.useProgram(program) + gl.bindBuffer(gl.ARRAY_BUFFER, gl.createBuffer()) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 3, -1, -1, 3]), gl.STATIC_DRAW) + const attr = gl.getAttribLocation(program, 'a') + gl.enableVertexAttribArray(attr) + gl.vertexAttribPointer(attr, 2, gl.FLOAT, false, 0, 0) + + // Two shared canvases for textured lenses: what lies beneath, and what rides on top. + // Each view keeps its own pair of textures, so a frame that only moves the light re-uses them. + const layer = () => { + const canvas = document.createElement('canvas') + return { canvas, ctx: canvas.getContext('2d') } + } + const texture = (mipmapped: boolean) => { + const tex = gl.createTexture() + gl.bindTexture(gl.TEXTURE_2D, tex) + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4)) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, mipmapped ? gl.LINEAR_MIPMAP_LINEAR : gl.LINEAR) + if (mipmapped) gl.generateMipmap(gl.TEXTURE_2D) + return tex + } + const back = layer() + const front = layer() + if (!back.ctx || !front.ctx) return null + type Painted = { back: WebGLTexture | null; front: WebGLTexture | null; w: number; h: number; at: number } + const painted = new Map() + // A third, small one for what surrounds a lens (its reflection), and each view's own texture of it: + // where the picture was taken (the canvas's box then, CSS px) and how far past it it reaches. + const around = layer() + if (!around.ctx) return null + /** `busy`: a picture is due (or was taken) while something on the page moved or was lit: it is taken once all is still. */ + type Mirrored = { tex: WebGLTexture | null; w: number; h: number; at: number; left: number; top: number; reach: number; due: boolean; timer: number; busy: boolean } + /** The pictures of the surroundings taken on this frame. */ + const pictured: Mirrored[] = [] + const mirrored = new Map() + /** Texels per CSS px of that picture: it is only ever seen blurred. */ + const AROUND_SCALE = 0.5 + /** It is taken again this often, at most (ms). */ + const AROUND_EVERY = 400 + /** + * While something on the page moves or is lit, a picture already taken is kept, at most this long + * (ms), and taken again once all is still: taken half way, it would keep a neighbour lit by a + * press after its light has gone (until something took it again). `live` glass does not wait. + */ + const AROUND_WAIT = 2000 + /** Something on the page moved or was lit on the last frame, or so far on this one. */ + let busy = false + let ranLast = false + // What a lens without layers samples (and ignores): a texture unit is never left empty. + const blank = { back: texture(true), front: texture(false) } + /** The page behind a still lens is read again this often while only the light moves (ms). */ + const REPAINT_EVERY = 120 + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true) + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true) + gl.uniform1i(gl.getUniformLocation(program, 'uBack'), 0) + gl.uniform1i(gl.getUniformLocation(program, 'uFront'), 1) + gl.uniform1i(gl.getUniformLocation(program, 'uAround'), 2) + const locations = new Map() + const u = (name: string) => { + if (!locations.has(name)) locations.set(name, gl.getUniformLocation(program, name)) + return locations.get(name) ?? null + } + // Every uniform of a frame goes through `set`, which keeps the values: a view whose frame + // would come out exactly as the one already on its canvas is not drawn again. + const sent: number[] = [] + const set = (name: string, a: number, b?: number, c?: number, d?: number) => { + const at = u(name) + if (b === undefined) gl.uniform1f(at, a) + else if (c === undefined) gl.uniform2f(at, a, b) + else if (d === undefined) gl.uniform3f(at, a, b, c) + else gl.uniform4f(at, a, b, c, d) + sent.push(a, b ?? 0, c ?? 0, d ?? 0) + } + /** What a view's canvas shows now: its uniforms (empty = nothing usable) and its CSS box. */ + const shown = new WeakMap() + + const views = new Set() + const reduced = window.matchMedia('(prefers-reduced-motion: reduce)') + let dead = false + + // Colour resolving: paint any CSS colour into a 1×1 canvas and read it back. + const probeCanvas = document.createElement('canvas') + probeCanvas.width = probeCanvas.height = 1 + const probe = probeCanvas.getContext('2d', { willReadFrequently: true }) + // A colour that means the same on every page and in every theme is resolved once: a scroll + // or a hover asks for the same few again and again, and asking touches the DOM. + const ABSOLUTE = /^(?:#[0-9a-f]{3,8}|(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\([^()]*\)|black|white|transparent)$/i + const resolved = new Map() + const resolveColor = (css: string): Rgba => { + if (!probe) return [1, 1, 1, 1] + const fixed = ABSOLUTE.test(css) && !/currentcolor/i.test(css) + const known = fixed ? resolved.get(css) : undefined + if (known) return [known[0], known[1], known[2], known[3]] + const span = document.createElement('span') + span.style.color = css + // Measured on , never inside a host whose children are observed. + document.body.appendChild(span) + const computed = getComputedStyle(span).color + span.remove() + probe.clearRect(0, 0, 1, 1) + probe.fillStyle = computed + probe.fillRect(0, 0, 1, 1) + const [r, g, b, a] = probe.getImageData(0, 0, 1, 1).data + if (fixed) { + if (resolved.size > 400) resolved.clear() + resolved.set(css, [r / 255, g / 255, b / 255, a / 255]) + } + return [r / 255, g / 255, b / 255, a / 255] + } + + // Cursor light: shared, fades in on the first mouse move, out when the pointer leaves. + const pointer = { x: 0, y: 0, active: false, moved: false, mix: 0 } + + // Pointer light (LIGHT). `beam` is the pointer that lights: where it is, what it is over + // and which pointer is held (`id`, -1 = none). + // Each lit view keeps its own light: how bright (a spring), where on the glass, and why. + const beam = { x: 0, y: 0, over: null as EventTarget | null, id: -1 } + type Lit = { + glow: Spring + /** The light's centre, relative to the lens centre (CSS px). */ + x: number + y: number + press: boolean + key: boolean + /** The glass's host takes no pointer events (a badge): the pointer only has to be over the glass. */ + free: boolean + /** The body on screen, as last drawn: centre, half size and its shift from the lens centre. */ + sx: number + sy: number + hx: number + hy: number + bodyX: number + /** A second box melted into the body (a surface that has opened), as last drawn: its centre from the lens centre, and its half size. */ + blob: { x: number; y: number; hx: number; hy: number } | null + /** The press landed on that box: the light takes its size from it. */ + onBlob: boolean + } + const lights = new Map() + let relit = false + const hostOf = (v: GlassView) => v.canvas.parentElement + /** The pointer is on this glass: inside its body, and on its host (not on something lying over it). */ + const onBlob = (s: Lit) => !!s.blob && Math.abs(beam.x - (s.sx - s.bodyX + s.blob.x)) <= s.blob.hx && Math.abs(beam.y - (s.sy + s.blob.y)) <= s.blob.hy + const under = (v: GlassView, s: Lit) => { + if ((Math.abs(beam.x - s.sx) > s.hx || Math.abs(beam.y - s.sy) > s.hy) && !onBlob(s)) return false + if (s.free) return true + const host = hostOf(v) + return !!host && beam.over instanceof Node && host.contains(beam.over) && !host.matches(':disabled, [data-disabled], [aria-disabled="true"]') + } + /** A press belongs to the innermost glass under it: a button on a card lights up, the card does not. */ + const innermost = (v: GlassView) => { + const host = hostOf(v) + for (const [other, s] of lights) { + const inner = hostOf(other) + if (other !== v && !s.free && other.visible && host && inner && inner !== host && host.contains(inner) && under(other, s)) return false + } + return true + } + /** Advances a view's light; true while it still changes. */ + const stepLight = (v: GlassView, dt: number, still: boolean) => { + const s = lights.get(v) + if (!s) return false + const held = s.press || s.key + const target = LIGHT.on && held ? LIGHT.press : 0 + if (still) { + const changed = s.glow.x !== target + s.glow.x = target + s.glow.v = 0 + return changed + } + return stepSpring(s.glow, target, held ? { omega: (2 * Math.PI) / Math.max(LIGHT.rise, 0.01), zeta: clamp(1 - LIGHT.riseBounce, 0.05, 1) } : { omega: (2 * Math.PI) / Math.max(LIGHT.fade, 0.01), zeta: 1 }, dt) + } + + // The flash of a press on a button (GLOW): the rule above GLOW, applied. A view that says + // `button: true` is lit where a press lands on it (or at its centre, by Space / Enter): the + // light comes up, holds for as long as the press does (`hold` at least) and fades as it + // spreads. Each button keeps its own: how bright, how far it has spread, where it landed (from + // the host's centre, px), how long it still holds, how many presses' worth is asked for, how + // small the glass is (which set of values it takes), its height, and what holds it. + // A surface keeps one too, for a choice pressed in it (`choice`): the same light with GLOW's + // `select` values, measured in the choice's own height. + type Flash = { glow: Spring; spread: Spring; x: number; y: number; hold: number; level: number; small: number; height: number; by: number; key: boolean; choice: boolean } + /** What counts as a choice inside a surface. */ + const CHOICES = ':is([role=option],[role=menuitem],[data-glass-item],[data-glass-pick])' + const flashes = new Map() + const flashTune = (small: number): typeof GLOW => { + if (small <= 0) return GLOW + if (small >= 1) return GLOW_SMALL + const mixed = { ...GLOW } + for (const name of Object.keys(mixed) as (keyof typeof GLOW)[]) mixed[name] = lerp(GLOW[name], GLOW_SMALL[name], small) + return mixed + } + /** + * Light on this glass at this point (viewport px), or at its centre. Presses that land before + * the last has faded add up. `choice`: the element chosen inside a surface, whose light it is. + */ + const flash = (v: GlassView, x?: number, y?: number, choice?: HTMLElement) => { + const host = hostOf(v) + if (!host) return null + let f = flashes.get(v) + if (!f) flashes.set(v, (f = { glow: { x: 0, v: 0 }, spread: { x: 0, v: 0 }, x: 0, y: 0, hold: 0, level: 0, small: 0, height: 0, by: -1, key: false, choice: false })) + const r = host.getBoundingClientRect() + // A light that is still bright keeps spreading from where it is: only a fresh one starts small. + if (f.glow.x < 0.08) f.spread.x = f.spread.v = 0 + f.x = x === undefined ? 0 : clamp(x - (r.left + r.width / 2), -r.width / 2, r.width / 2) + f.y = y === undefined ? 0 : clamp(y - (r.top + r.height / 2), -r.height / 2, r.height / 2) + f.choice = !!choice + f.height = (choice ?? host).offsetHeight + // (A surface takes the wide set of values, whatever its own shape.) + f.small = choice ? 0 : 1 - smooth(2, 2.4, host.offsetWidth / Math.max(f.height, 1)) + const tune = flashTune(f.small) + f.level = Math.min(Math.max(f.glow.x, 0) + (choice ? tune.select : 1), tune.stack) + f.hold = tune.hold + wake() + return f + } + /** Advances a button's flash; true while it still changes. */ + const stepFlash = (v: GlassView, dt: number, still: boolean) => { + const f = flashes.get(v) + if (!f) return false + if (still) { + const changed = f.glow.x !== 0 + f.glow.x = f.glow.v = f.spread.x = f.spread.v = f.hold = 0 + return changed + } + const lit = f.by !== -1 || f.key || f.hold > 0 + const holding = f.hold > 0 + f.hold = Math.max(0, f.hold - dt) + const tune = flashTune(f.small) + const a = stepSpring(f.glow, lit ? f.level : 0, { omega: lit ? tune.riseSpeed : tune.fadeSpeed, zeta: 1 }, dt) + const b = stepSpring(f.spread, lit || f.glow.x > 0.004 ? 1 : 0, { omega: tune.spreadSpeed, zeta: 1 }, dt) + // A press held still changes nothing: the loop rests until the hold runs out or the press ends. + return holding || a || (b && f.glow.x > 0.004) + } + /** The flash as a lens's `glow`, for a lens that brings none of its own. (The canvas is scaled with the host: the light is measured on the page, so it is divided by that scale.) */ + const flashOf = (v: GlassView): GlassLens['glow'] => { + const f = flashes.get(v) + if (!f || f.glow.x <= 0.004) return undefined + const tune = flashTune(f.small) + const k = Math.max(0.5, v.grow ?? 1) + const far = clamp(f.spread.x) + const reach = f.choice ? tune.selectReach + tune.selectSpread * far : tune.reach + tune.spread * far + return { x: f.x / k, y: f.y / k, r: f.height * reach, amount: Math.max(0, f.glow.x) * tune.amount, blob: 1 } + } + + // Pull (PULL): glass a held pointer drags after itself, where the view asks for it (buttons). + // One pointer holds one glass, the innermost under the press. The engine moves its host (CSS `translate`) and stretches it (CSS + // `scale`, times the view's own `grow`), and lets go when the pointer does. + type Pulled = { + /** How far the glass has come after the pointer, each way (px). */ + x: Spring + y: Spring + /** The pointer that holds it: where it pressed, where it is, and where the glass rested then. */ + by: { id: number; x: number; y: number; nowX: number; nowY: number; cx: number; cy: number; lastX: number; lastY: number; size: number } | null + /** How fast the glass's own place on the page moves while held (px/s, smoothed). */ + driftX: number + driftY: number + /** The host's own CSS `translate` (a centring class), which the pull adds to. */ + own: string[] | null + /** What the engine last wrote on the host. */ + moved: string + scaled: string + } + const pulls = new Map() + const pulledOf = (v: GlassView) => { + let p = pulls.get(v) + if (!p) pulls.set(v, (p = { x: { x: 0, v: 0 }, y: { x: 0, v: 0 }, by: null, driftX: 0, driftY: 0, own: null, moved: '', scaled: '' })) + return p + } + /** The centre of the glass on screen where it rests, without the pull. */ + const restOf = (host: HTMLElement, p: Pulled) => { + const r = host.getBoundingClientRect() + return { x: r.left + r.width / 2 - p.x.x, y: r.top + r.height / 2 - p.y.x } + } + const letGo = (v: GlassView, p: Pulled) => { + p.by = null + v.held = false + } + /** Advances a view's pull and writes its host's `translate` and `scale`; true while it still moves. */ + const stepPull = (v: GlassView, dt: number, still: boolean) => { + const p = pulls.get(v) + if (!p && v.grow === undefined) return false + const host = hostOf(v) + if (!host) return false + const s = p ?? pulledOf(v) + if (s.by && (v.pull !== true || !PULL.on)) letGo(v, s) + let sx = 1 + let sy = 1 + let moving = false + if (still) { + s.x.x = s.x.v = s.y.x = s.y.v = s.driftX = s.driftY = 0 + } else if (s.by || s.x.x !== 0 || s.y.x !== 0 || s.x.v !== 0 || s.y.v !== 0 || s.driftX !== 0 || s.driftY !== 0) { + const w = Math.max(host.offsetWidth, 1) + const h = Math.max(host.offsetHeight, 1) + const size = Math.max(w, h) + const small = size <= PULL.smallUntil + let tx = 0 + let ty = 0 + const by = s.by + if (by) { + const at = restOf(host, s) + // Small glass: how far the pointer has gone since the press. Larger: how far past the edge it is. + const dx = small ? by.nowX - by.x - (at.x - by.cx) : by.nowX - clamp(by.nowX, at.x - w / 2, at.x + w / 2) + const dy = small ? by.nowY - by.y - (at.y - by.cy) : by.nowY - clamp(by.nowY, at.y - h / 2, at.y + h / 2) + const limit = small ? PULL.smallReach + PULL.smallReachPerPx * size : Math.min(PULL.reachMax, PULL.reach + PULL.reachPerPx * size) + tx = rubberBand(dx, limit, PULL.resistance) + ty = rubberBand(dy, limit, PULL.resistance) + if (dt > 0) { + s.driftX += ((at.x - by.lastX) / dt - s.driftX) * Math.min(1, dt * PULL.driftIn) + s.driftY += ((at.y - by.lastY) / dt - s.driftY) * Math.min(1, dt * PULL.driftIn) + } + by.lastX = at.x + by.lastY = at.y + } else { + s.driftX = Math.abs(s.driftX) < 1 ? 0 : s.driftX * Math.exp(-dt * PULL.driftOut) + s.driftY = Math.abs(s.driftY) < 1 ? 0 : s.driftY * Math.exp(-dt * PULL.driftOut) + } + const spring = by ? { omega: (2 * Math.PI) / (PULL.follow + PULL.followPerPx * by.size), zeta: 1 } : { omega: (2 * Math.PI) / PULL.release, zeta: 1 - PULL.releaseBounce } + const mx = stepSpring(s.x, tx, spring, dt) + const my = stepSpring(s.y, ty, spring, dt) + const most = small ? PULL.smallStretchMax : PULL.stretchMax + const along = (pull: Spring, length: number, drift: number) => + Math.min(most, (PULL.stretch * Math.abs(pull.x)) / length + PULL.stretchPerSpeed * Math.abs(pull.v) + PULL.stretchPerDrift * Math.abs(drift)) + const kx = along(s.x, w, s.driftX) + const ky = along(s.y, h, s.driftY) + sx = (1 + kx) / Math.sqrt(1 + ky) + sy = (1 + ky) / Math.sqrt(1 + kx) + moving = !!by || mx || my || s.driftX !== 0 || s.driftY !== 0 + } + const on = Math.abs(s.x.x) > 0.01 || Math.abs(s.y.x) > 0.01 + const px = `${s.x.x.toFixed(3)}px` + const py = `${s.y.x.toFixed(3)}px` + const moved = !on ? '' : s.own ? `calc(${s.own[0]} + ${px}) calc(${s.own[1] ?? '0px'} + ${py})` : `${px} ${py}` + const grow = v.grow ?? 1 + const even = Math.abs(sx - 1) < 1e-4 && Math.abs(sy - 1) < 1e-4 + const scaled = even ? (grow === 1 ? '' : grow.toFixed(4)) : `${(grow * sx).toFixed(5)} ${(grow * sy).toFixed(5)}` + // The frame that brings the host to rest is still drawn: a view that draws the pull itself (see `pulled`) must see it end. + if (moved !== s.moved || scaled !== s.scaled) moving = true + if (moved !== s.moved) host.style.translate = s.moved = moved + if (scaled !== s.scaled) host.style.scale = s.scaled = scaled + const at = v.pulled ?? (v.pulled = { x: 0, y: 0, sx: 1, sy: 1 }) + at.x = on ? s.x.x : 0 + at.y = on ? s.y.x : 0 + at.sx = even ? 1 : sx + at.sy = even ? 1 : sy + return moving + } + + /** The way the cursor light comes from for a lens (uLightDir, as an angle), and how much the rim leans to it (uLightMix). */ + const aimOf = (m: GlassLens) => { + const dx = pointer.x - m.screenX + const dy = pointer.y - m.screenY + const d = Math.hypot(dx, dy) + // The light turns in half-degree steps (one step is less than a level of rim light on an + // 8-bit screen), and stays put while it is off: a cursor moving far away, or over glass + // without cursor light, leaves the frame as it is. + const mix = m.cursorLight ? pointer.mix : 0 + const aim = mix > 0 && d > 0.5 ? (Math.round(Math.atan2(dy, dx) * (360 / Math.PI)) * Math.PI) / 360 : -Math.PI / 2 + return { aim, mix } + } + /** A glass's light of a press (LIGHT) as its shader takes it (uLight): centre and radius (canvas px, from the lens centre) and how white; null while it is out. */ + const shineOf = (lit: Lit, m: GlassLens): [number, number, number, number] | null => { + const shine = LIGHT.on && m.pointerLight !== false ? clamp(lit.glow.x) : 0 + if (shine <= 0) return null + const pageL = 0.2126 * m.surface[0] + 0.7152 * m.surface[1] + 0.0722 * m.surface[2] + // (A press on a surface beside the control takes the surface's size, not the control's.) + const side = lit.onBlob && lit.blob ? Math.max(lit.blob.hx, lit.blob.hy) : Math.max(m.hx, m.hy) + const span = clamp(LIGHT.size * 2 * side, LIGHT.sizeMin, Math.max(LIGHT.sizeMin, LIGHT.sizeMax)) + return [lit.x, lit.y, span, shine * clamp(lerp(LIGHT.strengthDark, LIGHT.strength, smooth(0.25, 0.6, pageL)))] + } + + // Cohesion (COHESION): buttons near each other melt into one body. On a frame that changes a + // button, every button on screen is measured as it is (its body on the page, and what its look + // depends on), and each takes the ones within reach, nearest first, four at most. `nears` holds + // what its shader is given for them (uNear… in FRAGMENT): NEAR_VALUES numbers (nine vec4) for each. + type Melt = { + v: GlassView + m: GlassLens + host: Element + /** Screen px per canvas px, and the lens centre on screen (the canvas's own (cx, cy)). */ + g: number + sx: number + sy: number + /** The body on screen: centre, half size, corner radius and the radius its bend follows (px). */ + x: number + y: number + hx: number + hy: number + r: number + fr: number + /** Its height at rest, and one of its design units, on screen (px). */ + rest: number + du: number + } + const NEAR = 4 + const NEAR_NAMES = Array.from({ length: NEAR }, (_, i) => + ['uNear', 'uNearShape', 'uNearTint', 'uNearLine', 'uNearLook', 'uNearShade', 'uNearMirror', 'uNearGlow', 'uNearLight'].map((name) => `${name}[${i}]`), + ) + const NEAR_PAIR = Array.from({ length: NEAR }, (_, i) => `uNearPair[${i}]`) + /** Per neighbour: its vec4s, then whether its canvas lies over this one's and how joined the two are. */ + const NEAR_VALUES = NEAR_NAMES[0].length * 4 + 2 + /** How much a lens mirrors of its surroundings (see `mirror` in `draw`): only clear glass does. */ + const mirrorOf = (m: GlassLens) => (m.refraction ? m.strength * Math.max(0, m.tune?.mirror ?? 1) * clamp((1 - m.refraction.frost) / 0.4) : 0) + /** How far into the glass the mirrored band goes, how far the rim looks, and how soft the picture is (CSS px; see uMirror.z, uReach and uSoft). */ + const mirrorShapeOf = (m: GlassLens) => { + const reached = m.reflection ? clamp(m.reflection.height * MIRROR.reach, MIRROR.reachMin, Math.max(MIRROR.reachMin, MIRROR.reachMax)) : 0 + const deep = Math.max(0.01, MIRROR.depth) * Math.max(1, Math.min(m.hx, m.hy, reached || Infinity)) + return { deep, reach: mirrorOf(m) > 0 && m.reflection ? reached : 0, soft: Math.max(0, MIRROR.soft) * reached } + } + const nears = new Map() + /** The buttons that were on screen when they were last measured: one that comes or goes changes its neighbours. */ + let shownButtons = new Set() + let meltsChanged = false + const measure = (v: GlassView, m: GlassLens | null | undefined): Melt | null => { + const host = hostOf(v) + if (!host || !m || m.width < 2 || m.height < 2) return null + const g = m.scale && m.scale > 0 ? m.scale : 1 + const radius = Math.max(0, Math.min(m.radius, m.hx - 0.5, m.hy - 0.5)) + const band = m.refraction ? (m.band ?? 0) * m.unit : 0 + return { + v, + m, + host, + g, + sx: m.screenX, + sy: m.screenY, + x: m.screenX + m.bodyX * g, + y: m.screenY, + hx: Math.max(m.hx, 0.5 * m.unit) * g, + hy: Math.max(m.hy, 0.5 * m.unit) * g, + r: radius * g, + fr: Math.min(Math.max(radius, band), Math.max(0, Math.min(m.hx, m.hy) - 0.5)) * g, + rest: DESIGN_HEIGHT * m.unit * g, + du: m.unit * g, + } + } + /** + * What glass `a` takes for its neighbour `b` (see uNear… in FRAGMENT), in a's design units, at + * bridge softness `k` (screen px), the two `join`ed this much (0 = apart, 1 = one body for the light). + */ + const nearValues = (a: Melt, b: Melt, k: number, join: number, out: number[]) => { + const to = 1 / a.du + const m = b.m + const r = m.refraction + const width = m.border ? Math.max(0, m.borderWidth ?? 1) : 0 + const line = m.border ?? m.color + out.push((b.x - a.sx) * to, (b.y - a.sy) * to, b.hx * to, b.hy * to) + out.push(b.r * to, b.fr * to, Math.max(k * to, 1e-3), Math.max(m.bevel, 2) * b.du * to) + out.push(m.color[0], m.color[1], m.color[2], r ? clamp(r.frost) : 0) + out.push(line[0], line[1], line[2], width > 0 ? clamp(m.borderAlpha ?? 1) : 0) + out.push((r?.refract ?? 0) * b.du * to, r ? 1 : 0, width * b.g * to, aimOf(m).aim) + out.push(m.shadow * m.strength, m.shadowSoftness * b.du * to, m.shadowOffset * b.du * to, b.du * to) + const shapeB = mirrorShapeOf(m) + const mine = mirrorOf(a.m) + out.push(shapeB.deep * b.g * to, shapeB.reach * b.g * to, shapeB.soft * b.g * to, mine > 0 ? mirrorOf(m) / mine : 0) + // Its light of a press, where it is on screen. + const glow = m.glow ?? flashOf(b.v) + if (glow) out.push((b.sx + glow.x * b.g - a.sx) * to, (b.sy + glow.y * b.g - a.sy) * to, glow.r * b.g * to, Math.max(0, glow.amount)) + else out.push(0, 0, 1, 0) + const lit = lights.get(b.v) + const light = lit ? shineOf(lit, m) : null + if (light) out.push((b.sx + light[0] * b.g - a.sx) * to, (b.sy + light[1] * b.g - a.sy) * to, light[2] * b.g * to, light[3]) + else out.push(0, 0, 1, 0) + // Glass later on the page is painted over glass before it. + out.push(a.host.compareDocumentPosition(b.host) & Node.DOCUMENT_POSITION_FOLLOWING ? 1 : 0, join) + } + /** + * Measures every button on screen and works out each one's neighbours. `lensOf` holds the lenses + * already read this frame; any other is read now. Returns the views whose neighbours (as their + * shaders take them) changed, and those whose `near` changed, which must paint what lies behind again. + */ + const cohere = (lensOf: Map) => { + const pool: Melt[] = [] + const showing = new Set() + for (const v of views) { + if (v.button !== true || !v.visible) continue + showing.add(v) + let m = lensOf.get(v) + if (m === undefined) lensOf.set(v, (m = v.lens(false))) + const at = measure(v, m) + if (at) pool.push(at) + } + shownButtons = showing + const changed = new Set() + const regrouped = new Set() + const melted = new Set() + for (const a of pool) { + const found: { b: Melt; gap: number; k: number; join: number }[] = [] + for (const b of pool) { + if (b === a || a.host.contains(b.host) || b.host.contains(a.host)) continue + const soft = cohesionSoftness(Math.min(a.rest, b.rest)) + if (soft <= 0) continue + const gap = Math.max(Math.abs(b.x - a.x) - a.hx - b.hx, Math.abs(b.y - a.y) - a.hy - b.hy) + // The bridge eases in as they near each other: none at `soft` apart, all of it at half that. + const k = soft * (1 - smooth(0.5, 1, gap / soft)) + // Joined from the moment the bridge forms (half of `soft` apart), fully once it has some body + // (a quarter of `soft` apart); for the light, by as much as COHESION.light lets it run on. + if (k > 0.05) found.push({ b, gap, k, join: (1 - smooth(soft / 4, soft / 2, gap)) * clamp(COHESION.light) }) + } + found.sort((p, q) => p.gap - q.gap) + const values: number[] = [] + const hosts: Element[] = [] + for (const { b, k, join } of found.slice(0, NEAR)) { + nearValues(a, b, k, join, values) + hosts.push(b.host) + } + const was = nears.get(a.v) + if ((was?.length ?? 0) !== values.length || values.some((x, i) => x !== was![i])) changed.add(a.v) + if (values.length) { + nears.set(a.v, values) + melted.add(a.v) + } else nears.delete(a.v) + const before = a.v.near ?? [] + if (before.length !== hosts.length || hosts.some((h) => !before.includes(h))) { + a.v.near = hosts.length ? hosts : undefined + regrouped.add(a.v) + } + } + // A button that has left the screen (or the page) melts into nothing any more. + for (const v of [...nears.keys()]) { + if (melted.has(v)) continue + nears.delete(v) + changed.add(v) + } + return { changed, regrouped } + } + + const draw = (v: GlassView, refresh: boolean, repaint: boolean, read?: GlassLens | null) => { + const m = read !== undefined ? read : v.lens(refresh) + let on = shown.get(v) + if (!on) shown.set(v, (on = { sent: [], box: '' })) + if (!m || m.width < 2 || m.height < 2) { + v.ctx.clearRect(0, 0, v.canvas.width, v.canvas.height) + on.sent.length = 0 + return + } + // The canvas's box is written only when it changes. + const box = `${m.left}|${m.top}|${m.width}|${m.height}` + if (box !== on.box) { + on.box = box + const st = v.canvas.style + st.left = `${m.left}px` + st.top = `${m.top}px` + st.width = `${m.width}px` + st.height = `${m.height}px` + } + const dpr = Math.min(window.devicePixelRatio || 1, 2) + const devW = Math.max(2, Math.round(m.width * dpr)) + const devH = Math.max(2, Math.round(m.height * dpr)) + if (v.canvas.width !== devW || v.canvas.height !== devH) { + v.canvas.width = devW + v.canvas.height = devH + on.sent.length = 0 + } + // The shared GL canvas only grows; each view is drawn into its bottom-left corner. + if (glCanvas.width < devW || glCanvas.height < devH) { + glCanvas.width = Math.max(glCanvas.width, devW) + glCanvas.height = Math.max(glCanvas.height, devH) + } + gl.viewport(0, 0, devW, devH) + + const unit = m.unit + const r = m.refraction + /** The layers are the ones this view was last drawn with. */ + let fresh = true + if (r) { + let p = painted.get(v) + if (!p) painted.set(v, (p = { back: texture(true), front: texture(false), w: 0, h: 0, at: 0 })) + const now = performance.now() + const sized = p.w === devW && p.h === devH + // A painter that takes only `back` has no front layer: none is cleared or uploaded. + const fronted = r.paint.length > 1 + fresh = !repaint && sized && now - p.at < REPAINT_EVERY + gl.activeTexture(gl.TEXTURE0) + gl.bindTexture(gl.TEXTURE_2D, p.back) + if (!fresh) { + for (const l of fronted ? [back, front] : [back]) { + if (l.canvas.width !== devW || l.canvas.height !== devH) { + l.canvas.width = devW + l.canvas.height = devH + } + l.ctx!.setTransform(1, 0, 0, 1, 0, 0) + l.ctx!.clearRect(0, 0, devW, devH) + l.ctx!.setTransform(dpr, 0, 0, dpr, 0, 0) + } + // A painter that says nothing changed keeps the textures it already has. + fresh = r.paint(back.ctx!, front.ctx!) === false && sized + } + if (!fresh) { + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, back.canvas) + gl.generateMipmap(gl.TEXTURE_2D) + } + gl.activeTexture(gl.TEXTURE1) + gl.bindTexture(gl.TEXTURE_2D, fronted ? p.front : blank.front) + if (!fresh) { + if (fronted) gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, front.canvas) + p.w = devW + p.h = devH + p.at = now + } + } else { + gl.activeTexture(gl.TEXTURE0) + gl.bindTexture(gl.TEXTURE_2D, blank.back) + gl.activeTexture(gl.TEXTURE1) + gl.bindTexture(gl.TEXTURE_2D, blank.front) + } + sent.length = 0 + // The surroundings, for the reflection. The picture is taken when it is first needed, and + // again when sizes and colours are re-read or the canvas changes size, AROUND_EVERY apart at + // most (a change that comes sooner waits its turn). A scroll takes none: what surrounds the + // glass rides along. Until then the picture stays where it was taken, even if the canvas has + // moved since. + // Only clear glass mirrors: in full while its own colour covers it no more than a clear + // button's tint does (0.6), less as the cover grows, and not at all once the glass is its + // own colour (tinted glass, a lens frosted over at rest, a control painted in its fill). + // Unlit glass mirrors nothing either. Glass that mirrors nothing takes no picture. + const clear = r ? clamp((1 - r.frost) / 0.4) : 0 + const mirror = m.strength * Math.max(0, m.tune?.mirror ?? 1) * clear + const f = mirror > 0 ? m.reflection : undefined + if (refresh && m.reflection && !f) { + const idle = mirrored.get(v) + if (idle) idle.due = true + } + gl.activeTexture(gl.TEXTURE2) + if (f) { + let a = mirrored.get(v) + if (!a) mirrored.set(v, (a = { tex: texture(true), w: 0, h: 0, at: 0, left: 0, top: 0, reach: 0, due: true, timer: 0, busy: false })) + const taken = a + const reach = clamp(f.height * MIRROR.reach, MIRROR.reachMin, Math.max(MIRROR.reachMin, MIRROR.reachMax)) + const aw = Math.max(2, Math.ceil((m.width + 2 * reach) * AROUND_SCALE)) + const ah = Math.max(2, Math.ceil((m.height + 2 * reach) * AROUND_SCALE)) + const now = performance.now() + gl.bindTexture(gl.TEXTURE_2D, a.tex) + if (refresh || (f.live && repaint) || a.w !== aw || a.h !== ah || a.reach !== reach) a.due = true + if (a.due && a.w && busy && !f.live && now - a.at < AROUND_WAIT) { + // It waits for all to be still (see AROUND_WAIT): the picture it has is kept meanwhile. + a.busy = true + } else if (a.due && a.w && now - a.at < AROUND_EVERY) { + if (!a.timer) + a.timer = window.setTimeout( + () => { + taken.timer = 0 + if (mirrored.get(v) !== taken) return + v.repaint = true + wake() + }, + AROUND_EVERY - (now - a.at), + ) + } else if (a.due) { + a.due = false + if (around.canvas.width !== aw || around.canvas.height !== ah) { + around.canvas.width = aw + around.canvas.height = ah + } + const c = around.ctx! + c.setTransform(1, 0, 0, 1, 0, 0) + c.clearRect(0, 0, aw, ah) + c.setTransform(AROUND_SCALE, 0, 0, AROUND_SCALE, reach * AROUND_SCALE, reach * AROUND_SCALE) + f.paint(c, reach) + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, around.canvas) + gl.generateMipmap(gl.TEXTURE_2D) + a.w = aw + a.h = ah + a.at = now + a.left = m.left + a.top = m.top + a.reach = reach + pictured.push(a) + fresh = false + } + set('uAroundBox', (a.left - m.left - a.reach) / unit, (a.top - m.top - a.reach) / unit, a.w / AROUND_SCALE / unit, a.h / AROUND_SCALE / unit) + set('uAroundScale', AROUND_SCALE * unit) + set('uReach', reach / unit) + } else { + gl.bindTexture(gl.TEXTURE_2D, blank.back) + set('uAroundBox', 0, 0, 1, 1) + set('uAroundScale', 1) + set('uReach', 0) + } + set('uTextured', r ? 1 : 0) + set('uRefract', r?.refract ?? 0) + set('uMag', r?.magnify ?? 0) + set('uDisp', r?.dispersion ?? 0) + set('uBlurCenter', r?.blurCenter ?? 0) + set('uBlurEdge', r?.blurEdge ?? 0) + // Blur level follows screen density (reference: 2.27 device px per design unit). + set('uBlurShift', Math.log2(Math.max((unit * dpr) / 2.27, 1e-3))) + set('uFrost', r?.frost ?? 0) + set('uFrostBlur', Math.max(0, r?.blur ?? 0) / unit) + set('uFrostMix', clamp(r?.blurMix ?? 1)) + // Radial bend: a share of the viewport per axis, as the SVG card's map was. + const radial = Math.max(0, r?.radial ?? 0) + set('uRadial', (radial * window.innerWidth) / unit, (radial * window.innerHeight) / unit) + set('uCssPx', 1 / unit) + set('uSize', devW, devH) + set('uUnit', unit * dpr) + set('uDevicePx', 1 / (unit * dpr)) + set('uCenter', m.cx / unit, m.cy / unit) + set('uHalf', Math.max(m.hx / unit, 0.5), Math.max(m.hy / unit, 0.5)) + const radius = Math.max(0, Math.min(m.radius, m.hx - 0.5, m.hy - 0.5) / unit) + set('uRadius', radius) + const band = r ? (m.band ?? 0) : 0 + set('uBand', band) + set('uFieldRadius', Math.min(Math.max(radius, band), Math.max(0, (Math.min(m.hx, m.hy) - 0.5) / unit))) + set('uBodyX', m.bodyX / unit) + set('uDrop', (m.droplet?.x ?? 0) / unit, (m.droplet?.r ?? 0) / unit, (m.droplet?.k ?? 0) / unit) + const blob = m.blob + set('uBlob', (blob?.x ?? 0) / unit, (blob?.y ?? 0) / unit, (blob?.hx ?? 0) / unit, (blob?.hy ?? 0) / unit) + set('uBlobShape', (blob?.r ?? 0) / unit, (blob?.k ?? 0) / unit) + set('uBlobNeck', (blob?.neck?.x ?? 0) / unit, (blob?.neck?.w ?? 0) / unit) + set('uBlobFade', blob?.fade?.amount ?? 0, blob?.fade?.reach ?? 0.5) + const mat = blob?.material + set('uBlobMat', clamp(mat?.frost ?? 0), Math.max(0, mat?.blur ?? 0) / unit, Math.max(0.05, mat?.bendCurve ?? 1.6), 0.35 * Math.max(0.05, mat?.bendDepth ?? 1)) + set('uBlobLine', Math.max(0, mat?.borderWidth ?? 0) / unit, clamp(mat?.borderAlpha ?? 0), mat ? 1 : 0) + set('uBevel', Math.max(m.bevel, 2)) + const k = m.tune ?? {} + set('uRim', 0.55 * m.strength * (k.rim ?? 1)) + set('uCaustic', 0.08 * m.strength * (k.caustic ?? 1)) + set('uInner', 0.1 * m.strength * (k.inner ?? 1)) + set('uTopRefl', 0.3 * m.strength * (k.reflection ?? 1)) + set('uTopBase', 0.02 * m.strength * (k.reflection ?? 1)) + set('uRimWidth', Math.max(0.05, k.rimWidth ?? 1)) + set('uFresnel', 0.02 * (k.fresnel ?? 1)) + // The band is as deep as a share of the glass's shorter half, and of its reach on glass taller than that. + const reached = m.reflection ? clamp(m.reflection.height * MIRROR.reach, MIRROR.reachMin, Math.max(MIRROR.reachMin, MIRROR.reachMax)) : 0 + const deep = (Math.max(0.01, MIRROR.depth) * Math.max(1, Math.min(m.hx, m.hy, reached || Infinity))) / unit + set('uMirror', clamp(MIRROR.line) * mirror, MIRROR.band * mirror, deep, clamp(MIRROR.dim)) + set('uSoft', (Math.max(0, MIRROR.soft) * reached) / unit) + const shares = Math.max(MIRROR.near + MIRROR.mid + MIRROR.far, 1e-3) + set('uSeen', MIRROR.near / shares, MIRROR.mid / shares, MIRROR.far / shares, Math.max(0, MIRROR.gain)) + // The far side of the rim light takes the surroundings' colour on clear glass only. + set('uBounce', Math.max(0, MIRROR.bounce), clamp(MIRROR.tint) * clear) + set('uFall', Math.max(0.05, MIRROR.fall)) + set('uBendCurve', Math.max(0.05, k.bendCurve ?? 1.6)) + set('uEdgeBand', 0.35 * Math.max(0.05, k.bendDepth ?? 1)) + set('uSaturation', Math.max(0, k.saturation ?? 1)) + set('uFrostEdge', Math.max(0.05, k.frostEdge ?? 1)) + set('uShadow', m.shadow * m.strength) + set('uShadowSoft', m.shadowSoftness) + set('uShadowOffset', m.shadowOffset) + set('uSurface', ...m.surface) + set('uColor', ...m.color) + set('uEdgeClear', m.edgeClear) + set('uBorder', ...(m.border ?? m.color)) + set('uBorderWidth', m.border ? Math.max(0, m.borderWidth ?? 1) / unit : 0) + set('uBorderAlpha', clamp(m.borderAlpha ?? 1)) + const { aim, mix: lightMix } = aimOf(m) + set('uLightDir', Math.cos(aim), Math.sin(aim)) + set('uLightMix', lightMix) + const glow = m.glow ?? flashOf(v) + set('uGlow', (glow?.x ?? 0) / unit, (glow?.y ?? 0) / unit, (glow?.r ?? 0) / unit, Math.max(0, glow?.amount ?? 0)) + set('uGlowHalo', glow?.halo ? (glow.halo.around === 'blob' && blob ? 2 : 1) : 0, clamp(glow?.halo?.amount ?? 0)) + set('uGlowBlob', clamp(glow?.blob ?? 1)) + // Pointer light: what the pointer is doing to this glass is worked out here, where the + // glass's place on screen is fresh; the light itself is advanced once a frame (stepLight). + let lit = lights.get(v) + // A glass that continues another takes that one's light (see `lightOf`), measured from here. + const shared = m.lightOf && m.lightOf !== v ? lights.get(m.lightOf) : undefined + if (shared) { + lit = { ...shared, x: shared.x + shared.sx - shared.bodyX - m.screenX, y: shared.y + shared.sy - m.screenY } + } else if (LIGHT.on && m.pointerLight !== false) { + if (!lit) { + const host = hostOf(v) + lit = { glow: { x: 0, v: 0 }, x: 0, y: 0, press: false, key: false, free: !!host && getComputedStyle(host).pointerEvents === 'none', sx: 0, sy: 0, hx: 0, hy: 0, bodyX: 0, blob: null, onBlob: false } + lights.set(v, lit) + } + lit.sx = m.screenX + m.bodyX + lit.sy = m.screenY + lit.hx = m.hx + lit.hy = m.hy + lit.bodyX = m.bodyX + lit.blob = blob ? { x: blob.x, y: blob.y, hx: blob.hx, hy: blob.hy } : null + // A held pointer lights the glass it is on, or comes onto (a lens arriving under it), until it lets go. + // The light stays at the point of the glass it began at: it does not follow the pointer. + const press = lit.press || (beam.id !== -1 && under(v, lit) && innermost(v)) + if (press !== lit.press) { + relit = true + if (press) { + lit.x = beam.x - m.screenX + lit.y = beam.y - m.screenY + lit.onBlob = onBlob(lit) && (Math.abs(beam.x - lit.sx) > lit.hx || Math.abs(beam.y - lit.sy) > lit.hy) + } + } + lit.press = press + } + const light = lit ? shineOf(lit, m) : null + if (light) set('uLight', light[0] / unit, light[1] / unit, light[2] / unit, light[3]) + else set('uLight', 0, 0, 1, 0) + // The glass it melts into (COHESION), as its shader takes them (see uNear in FRAGMENT). + const near = v.button === true && COHESION.on ? nears.get(v) : undefined + const count = near ? Math.min(NEAR, near.length / NEAR_VALUES) : 0 + set('uNearCount', count) + if (count) set('uNearFade', Math.max(0.01, COHESION.lightFade)) + for (let i = 0; i < count; i++) { + const names = NEAR_NAMES[i] + for (let j = 0; j < names.length; j++) { + const at = i * NEAR_VALUES + j * 4 + set(names[j], near![at], near![at + 1], near![at + 2], near![at + 3]) + } + set(NEAR_PAIR[i], near![i * NEAR_VALUES + NEAR_VALUES - 2], near![i * NEAR_VALUES + NEAR_VALUES - 1]) + } + // The same layers and the same uniforms as the frame on the canvas: nothing to draw. + if (fresh && on.sent.length === sent.length && sent.every((value, i) => value === on.sent[i])) return + on.sent = sent.slice() + gl.drawArrays(gl.TRIANGLES, 0, 3) + v.ctx.clearRect(0, 0, devW, devH) + v.ctx.drawImage(glCanvas, 0, glCanvas.height - devH, devW, devH, 0, 0, devW, devH) + v.drawn?.() + } + + let raf = 0 + let last = 0 + const frame = (now: number) => { + raf = 0 + if (dead) return + const dt = last ? Math.min((now - last) / 1000, 1 / 30) : 1 / 60 + last = now + const still = reduced.matches + const target = pointer.active && !still ? 1 : 0 + const before = pointer.mix + pointer.mix += (target - pointer.mix) * Math.min(1, dt * 6) + if (Math.abs(pointer.mix - target) < 0.002) pointer.mix = target + const relight = pointer.moved || pointer.mix !== before + pointer.moved = false + let running = pointer.mix !== target + busy = ranLast || running + // Buttons melt into each other (COHESION): they are drawn after the rest, once every one has + // been measured, so each melts into the others as they are on this frame. + const melting = COHESION.on + if (!melting && nears.size) { + for (const v of nears.keys()) { + v.near = undefined + v.dirty = true + } + nears.clear() + } + const due: { v: GlassView; refresh: boolean; repaint: boolean }[] = [] + let regroup = meltsChanged + meltsChanged = false + for (const v of views) { + const stepped = v.step(dt, still) + // After the view's own springs: its `grow` is this frame's. + const pulled = stepPull(v, dt, still) + const moving = stepped || pulled + // (Both lights of a press: what a surface takes, and a button's flash.) + const lit = stepLight(v, dt, still) + const flashing = stepFlash(v, dt, still) + const glowing = lit || flashing + if (moving || glowing) running = busy = true + const melts = melting && v.button === true + if (melts && v.visible !== shownButtons.has(v)) regroup = true + if (!v.visible) continue + const again = v.repaint === true + if (moving || glowing || v.dirty || again || relight) { + const refresh = v.dirty + v.dirty = false + v.repaint = false + // Only the light moved: the layers are as they were, so they are not painted again. + if (melts) due.push({ v, refresh, repaint: moving || refresh || again }) + else draw(v, refresh, moving || refresh || again) + } + } + if (melting && (due.length || regroup)) { + const lensOf = new Map() + for (const d of due) lensOf.set(d.v, d.v.lens(d.refresh)) + const { changed, regrouped } = cohere(lensOf) + // A button whose neighbours moved is drawn again too; one that melts into other glass now (or + // no longer) paints what lies behind it again, leaving that glass out (or taking it back in). + for (const d of due) draw(d.v, d.refresh, d.repaint || regrouped.has(d.v), lensOf.get(d.v)) + for (const v of changed) if (v.visible && !due.some((d) => d.v === v)) draw(v, false, regrouped.has(v), lensOf.get(v)) + } + // A view may have woken the engine during this frame (a popup that has just gone back in + // does): the next frame is then already asked for, and asking again would start a second + // loop beside this one, for as long as anything on the page moves. + // A draw found the pointer on (or off) some glass: its light starts on the next frame. + if (relit) running = true + relit = false + // Pictures of the surroundings that waited while something moved or was lit (or were taken + // then, having waited as long as they may) are taken once all is still, at once: the glass + // that takes one is drawn again on the next frame. + if (running) for (const a of pictured) a.busy = true + pictured.length = 0 + ranLast = running + if (running) wake() + else { + if (!raf) last = 0 + let again = false + for (const [v, a] of mirrored) { + if (!a.busy) continue + a.busy = false + a.due = true + a.at = 0 + v.repaint = true + again = true + } + if (again) wake() + } + } + const wake = () => { + if (!raf && !dead) raf = requestAnimationFrame(frame) + } + const invalidateAll = () => { + for (const v of views) v.dirty = true + wake() + } + + window.addEventListener( + 'pointermove', + (e) => { + if (e.pointerType !== 'mouse') return + pointer.x = e.clientX + pointer.y = e.clientY + pointer.active = true + pointer.moved = true + wake() + }, + { passive: true }, + ) + document.documentElement.addEventListener('pointerleave', () => { + pointer.active = false + pointer.moved = true + wake() + }) + // Pull (PULL): a press holds the innermost glass under it that asks to be pulled, and it is + // followed over the whole window until it lets go. + window.addEventListener( + 'pointerdown', + (e) => { + if (!PULL.on || e.button !== 0 || reduced.matches || !(e.target instanceof Node) || HANDED_ON.has(e)) return + let held: GlassView | null = null + let heldHost: HTMLElement | null = null + for (const v of views) { + const host = hostOf(v) + if (v.pull !== true || !host || !host.contains(e.target) || host.matches(':disabled, [data-disabled], [aria-disabled="true"]')) continue + if (pulls.get(v)?.by) return + if (!heldHost || heldHost.contains(host)) { + held = v + heldHost = host + } + } + if (!held || !heldHost) return + const p = pulledOf(held) + // The host's own translate is read while the pull's is off it. + if (!p.moved) { + const own = getComputedStyle(heldHost).translate + p.own = !own || own === 'none' ? null : own.split(' ') + } + const at = restOf(heldHost, p) + p.by = { id: e.pointerId, x: e.clientX, y: e.clientY, nowX: e.clientX, nowY: e.clientY, cx: at.x, cy: at.y, lastX: at.x, lastY: at.y, size: Math.max(heldHost.offsetWidth, heldHost.offsetHeight) } + p.driftX = p.driftY = 0 + held.held = true + wake() + }, + { passive: true, capture: true }, + ) + window.addEventListener( + 'pointermove', + (e) => { + for (const p of pulls.values()) { + if (p.by?.id !== e.pointerId) continue + p.by.nowX = e.clientX + p.by.nowY = e.clientY + wake() + } + }, + { passive: true, capture: true }, + ) + const unhold = (e: PointerEvent) => { + for (const [v, p] of pulls) { + if (p.by?.id !== e.pointerId) continue + letGo(v, p) + wake() + } + } + window.addEventListener('pointerup', unhold, { passive: true, capture: true }) + window.addEventListener('pointercancel', unhold, { passive: true, capture: true }) + // Pointer light (LIGHT): where the lighting pointer is, what it is over and whether it is held. + // Which glass that lights is decided when each glass is drawn, so every change asks for a frame. + const lightMoved = () => { + pointer.moved = true + wake() + } + window.addEventListener( + 'pointermove', + (e) => { + // Only the held pointer counts (a lens may come under it): one that moves over the page without pressing asks for nothing. + if (!LIGHT.on || e.pointerId !== beam.id) return + beam.x = e.clientX + beam.y = e.clientY + beam.over = e.target + lightMoved() + }, + { passive: true, capture: true }, + ) + window.addEventListener( + 'pointerdown', + (e) => { + if (!LIGHT.on || e.button !== 0 || HANDED_ON.has(e)) return + beam.x = e.clientX + beam.y = e.clientY + beam.over = e.target + beam.id = e.pointerId + lightMoved() + }, + { passive: true, capture: true }, + ) + const lift = (e: PointerEvent) => { + if (e.pointerId !== beam.id) return + beam.id = -1 + for (const s of lights.values()) s.press = false + lightMoved() + } + window.addEventListener('pointerup', lift, { passive: true, capture: true }) + window.addEventListener('pointercancel', lift, { passive: true, capture: true }) + // A button's flash (GLOW): a press lights the innermost button under it where it lands, and + // holds it until that pointer lets go; Space or Enter lights the focused button's centre. + window.addEventListener( + 'pointerdown', + (e) => { + if (e.button !== 0 || HANDED_ON.has(e) || !(e.target instanceof Node)) return + // A choice pressed inside a surface lights that surface around it. + const choice = e.target instanceof Element ? e.target.closest(CHOICES) : null + const chosen = choice && !choice.matches('[data-disabled], [aria-disabled="true"]') ? choice : null + let hit: GlassView | null = null + let hitHost: HTMLElement | null = null + for (const v of views) { + const host = hostOf(v) + if (!host || host.matches(':disabled, [data-disabled], [aria-disabled="true"]')) continue + if (v.button === true ? !(v.pressArea ?? host).contains(e.target) : !chosen || v.choices === false || !v.visible || !host.contains(chosen)) continue + if (!hitHost || hitHost.contains(host)) { + hit = v + hitHost = host + } + } + const f = hit && flash(hit, e.clientX, e.clientY, hit.button === true ? undefined : (chosen ?? undefined)) + if (f) f.by = e.pointerId + }, + { passive: true, capture: true }, + ) + const unflash = (e: PointerEvent) => { + for (const f of flashes.values()) { + if (f.by !== e.pointerId) continue + f.by = -1 + wake() + } + } + window.addEventListener('pointerup', unflash, { passive: true, capture: true }) + window.addEventListener('pointercancel', unflash, { passive: true, capture: true }) + const flashKey = (e: KeyboardEvent) => { + if (e.key !== ' ' && e.key !== 'Enter') return + const down = e.type === 'keydown' + if (down && e.repeat) return + if (!down) { + for (const f of flashes.values()) f.key = false + return wake() + } + const focused = document.activeElement + if (!focused) return + // On a surface, the key chooses the focused choice: the light starts at its middle. + const choice = focused.closest(CHOICES) + const chosen = choice && !choice.matches('[data-disabled], [aria-disabled="true"]') ? choice : null + let surface: GlassView | null = null + let surfaceHost: HTMLElement | null = null + for (const v of views) { + const host = hostOf(v) + if (!host || host.matches(':disabled, [data-disabled], [aria-disabled="true"]')) continue + if (v.button === true) { + if (!focused.contains(v.canvas)) continue + const f = flash(v) + if (f) f.key = true + } else if (chosen && v.choices !== false && v.visible && host.contains(chosen) && (!surfaceHost || surfaceHost.contains(host))) { + surface = v + surfaceHost = host + } + } + if (surface && chosen) { + const r = chosen.getBoundingClientRect() + const f = flash(surface, r.left + r.width / 2, r.top + r.height / 2, chosen) + if (f) f.key = true + } + wake() + } + window.addEventListener('keydown', flashKey, true) + window.addEventListener('keyup', flashKey, true) + window.addEventListener( + 'focusout', + () => { + for (const f of flashes.values()) f.key = false + wake() + }, + true, + ) + // Space or Enter on the focused control lights the middle of its glass while the key is down. + const key = (e: KeyboardEvent) => { + if (e.key !== ' ' && e.key !== 'Enter') return + const down = e.type === 'keydown' + if (down && (!LIGHT.on || e.repeat)) return + const focused = document.activeElement + for (const [v, s] of lights) { + const held = down && !s.free && !!focused && focused.contains(v.canvas) + if (held && !s.key && !s.press) { + s.x = s.bodyX + s.y = 0 + } + s.key = held + } + wake() + } + window.addEventListener('keydown', key, true) + window.addEventListener('keyup', key, true) + window.addEventListener( + 'focusout', + () => { + for (const s of lights.values()) s.key = false + wake() + }, + true, + ) + // Theme switches (class="dark", data-theme, color-scheme) re-read every colour. + new MutationObserver(invalidateAll).observe(document.documentElement, { + attributes: true, + attributeFilter: ['class', 'data-theme', 'style'], + }) + new MutationObserver(invalidateAll).observe(document.body, { attributes: true, attributeFilter: ['data-theme'], subtree: true }) + window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', invalidateAll) + // A radial bend scales with the viewport. + window.addEventListener('resize', invalidateAll, { passive: true }) + glCanvas.addEventListener('webglcontextlost', () => { + dead = true + for (const v of views) { + v.lost() + v.ctx.clearRect(0, 0, v.canvas.width, v.canvas.height) + } + // No frame comes after this: the hosts get back what the engine wrote on them. + for (const [v, p] of pulls) { + const host = hostOf(v) + v.held = false + if (host && p.moved) host.style.translate = '' + if (host && p.scaled) host.style.scale = '' + } + pulls.clear() + engine = undefined + }) + + return { + add: (v) => { + views.add(v) + meltsChanged = true + wake() + }, + remove: (v) => { + views.delete(v) + lights.delete(v) + flashes.delete(v) + // The glass that melted into it lets go. + if (v.button === true) { + meltsChanged = true + wake() + } + nears.delete(v) + shownButtons.delete(v) + v.near = undefined + const pulled = pulls.get(v) + if (pulled) { + pulls.delete(v) + v.held = false + const host = hostOf(v) + if (host && pulled.moved) host.style.translate = '' + if (host && pulled.scaled) host.style.scale = '' + } + const a = mirrored.get(v) + if (a) { + mirrored.delete(v) + clearTimeout(a.timer) + gl.deleteTexture(a.tex) + } + const p = painted.get(v) + if (!p) return + painted.delete(v) + gl.deleteTexture(p.back) + gl.deleteTexture(p.front) + }, + wake, + resolveColor, + } +} + +let engine: GlassEngine | null | undefined + +/** The shared engine (created on first use, client only). `null` = no WebGL2: use the CSS look. */ +export function getGlassEngine(): GlassEngine | null { + if (typeof window === 'undefined') return null + if (engine === undefined) engine = createEngine() + return engine +} diff --git a/src/components/liquid-glass/glass-layer.tsx b/src/components/liquid-glass/glass-layer.tsx new file mode 100644 index 0000000..43b7c77 --- /dev/null +++ b/src/components/liquid-glass/glass-layer.tsx @@ -0,0 +1,793 @@ +'use client' + +// KolayTercih (DESIGN.md §4.50): Liquid Glass UI 2.0.0'dan (bilalgursen/liquid-glass@9c65d01, +// 24 Kas 2026) olduğu gibi alındı. Elle değiştirilmez; kit güncellenince dosya yeniden kopyalanır. + +// GlassLayer — turns any positioned element (a button, a link, a pill) into liquid glass. +// Put it as the FIRST child of the host and mark the host with `data-glass-host`: +// +// +// +// Get started +// +// +// The host keeps its own CSS look until the first glass frame is drawn, then the layer +// sets `data-glass-ready` and the host drops its background, border and shadow (the +// glass now draws them). Without WebGL2 nothing changes: the CSS look stays. Clear glass +// also sets `data-glass-tone="light" | "dark"` from the colour it ends up, for the text. +// +// Hover swells the glass with wobbly springs and press grows it (the host scales with it); +// `swell={false}` keeps it still, as a card's glass is. `blur` frosts what clear glass shows. +// The gooey droplet (used only by GlassActionButton): the host's direct child marked +// `data-glass-drop` sits at the end, and the glass separates around it (`apart`) or melts +// back into one body (`merged`). Switching between the two animates, and the glass swells +// once as it does under the pointer. +// `pulse`: change it and the glass answers once, as if hovered and pressed for a moment +// (GlassActionButton does it when its action succeeds). While it does, the host carries `--glass-bend` (two numbers): put `scale: var(--glass-bend, 1)` on the +// content that should stretch with the glass. `pulseHold` (seconds) keeps it swollen longer +// before it lets go. +// Hold the glass and drag away, and it comes after the pointer a little way, stretched along the +// pull, then swings back like gel when let go (PULL in engine.ts): that is for buttons, which all +// stand on this layer. `pull={false}` keeps one in its place. The host is stretched with CSS, label +// included; the glass undoes that on its canvas and draws the stretch itself, so it stays a pill +// and bends what really lies behind it. COPY VERBATIM. +// MIT — https://github.com/bilalgursen/liquid-glass + +import { useEffect, useRef } from 'react' + +import { drawAround, drawDom } from './dom-snapshot' +import { + DESIGN_HEIGHT, + PULL, + SPRINGS, + clamp, + cohesionSoftness, + getGlassEngine, + lerp, + mixRgb, + rgbCss, + smooth, + stepSpring, + surfaceColorOf, + type GlassView, + type Rgb, + type Spring, +} from './engine' + +export type GlassMaterial = 'clear' | 'tinted' +export type GlassDroplet = 'none' | 'apart' | 'merged' + +/** + * Fine-tuning of the glass. Read on every frame: changing a value redraws the glass without + * rebuilding it, so it can follow a slider. Colours and frost apply to clear glass. + */ +export type GlassOptics = { + /** Tint colour, any CSS colour. Default: white on a light page, black on a dark one. */ + tintColor?: string + /** A line just inside the rim: its colour, opacity (0–1, default 0: none) and width in px (default 1). */ + borderColor?: string + borderAlpha?: number + borderWidth?: number + /** With `blur`: how much of the frost shows over the sharp bend (0–1, default 1). */ + frostMix?: number + /** With `blur`: × the frost at the rim, where the glass bends (default 1). */ + frostEdge?: number + /** Saturation of what shows through the glass (default 1; 1.5 = more vivid, 0 = grey). */ + saturation?: number + /** Without frost: blur of the clear glass in its middle and at its rim, in mip levels (default 0.35 and 2.2). */ + clearBlur?: number + clearBlurEdge?: number + /** The bend at the rim, × the kit's own (default 1). */ + refraction?: number + /** + * How the rim bends. `edge` (default): along the rim, as deep as the bevel. `radial`: towards + * the centre, by 6.5% of the viewport × `refraction`, fading over half the glass (`bendCurve` + * sets how fast, `bendDepth` how far), and the frost blurs the bent picture: the SVG card's rim. + */ + bendMode?: 'edge' | 'radial' + /** × how far in from the rim the bend reaches (default 1). */ + bendDepth?: number + /** How sharply the bend falls off from the rim inwards, an exponent (default 1.6; higher = tighter to the rim). */ + bendCurve?: number + /** Colour split at the rim (default 0.12). */ + dispersion?: number + /** Magnification of the middle (default 0). */ + magnify?: number + /** Light on the glass, all of it (default 1). */ + light?: number + /** × the rim light (default 1) and × its line's thickness (default 1). */ + rim?: number + rimWidth?: number + /** × the width of the bevel that shades the rim (default 1). */ + bevel?: number + /** × the fresnel glow, inner shading, top reflection and warm caustic (each default 1). */ + fresnel?: number + inner?: number + reflection?: number + caustic?: number + /** Clear glass: × what the rim mirrors of the page around it, where a colourful neighbour lights the rim that faces it (default 1, 0 = nothing). Tinted glass mirrors nothing. */ + mirror?: number + /** The rim light leans towards the cursor (default true). */ + cursorLight?: boolean + /** The drop shadow: × its strength, softness and offset (each default 1). */ + shadow?: number + shadowSoftness?: number + shadowOffset?: number + /** Dark glass (a black tint, on a dark page): its own tint cover (in place of `tint`) and rim line. Unset values follow the rest. */ + dark?: { tint?: number; borderColor?: string; borderAlpha?: number } +} + +export type GlassLayerProps = { + /** + * `clear`: transparent glass that bends the page behind it (default). + * `tinted`: glass painted in the host's own CSS background colour, with light and shadow. + */ + material?: GlassMaterial + /** + * The host's `[data-glass-drop]` child as a gooey droplet: `apart` (separated; it melts in + * while pressed) or `merged` (one body). Changing it animates the split or the merge. Default `none`. + */ + droplet?: GlassDroplet + /** Clear glass: how much of the tint covers the backdrop (0 = invisible, 1 = solid). */ + tint?: number + /** Clear glass: frost the backdrop with a blur of this many px, like CSS `blur()` (default 0: sharp). */ + blur?: number + /** Clear glass: CSS selector of the ancestor whose content is refracted (default: the page). */ + backdrop?: string + /** Clear glass: repaint the backdrop every frame (for animated content behind the glass). */ + live?: boolean + /** Listen for hover/press on this ancestor instead of the host (e.g. a whole card link). */ + trigger?: string + /** Turn the glass off and keep the host's CSS look. */ + disabled?: boolean + /** Swell on hover and grow when pressed (default). `false` keeps the glass still under the pointer. */ + swell?: boolean + /** + * Change it (a counter) and the glass answers once: it swells as if hovered and pressed for a + * moment. Meanwhile the host has `--glass-bend`, for content that + * stretches with it (`scale: var(--glass-bend, 1)`). Nothing happens on mount, or under reduced motion. + */ + pulse?: unknown + /** How long a pulse stays swollen before it lets go, in seconds (default 0.16: a nod). */ + pulseHold?: number + /** + * Hold the glass and drag: it follows the pointer a little way through a rubber band (small glass + * from where it was pressed, larger glass once the pointer is past its edge), stretches along the + * pull and thins across it, and swings back like gel when let go. The host is moved and scaled + * with CSS `translate` and `scale`, content included. Default `true`; `false` keeps the glass in + * its place. Glass that does not swell (`swell={false}`) is never pulled. + */ + pull?: boolean + /** Fine-tuning: tint colour, a rim line, frost mix, bend, light and shadow (see GlassOptics). */ + optics?: GlassOptics +} + +/** Size of the hover/press response. Matches the kit's Button. */ +const PRESS_SCALE = 1.08 +const HOVER_SCALE = 1.04 +const HOVER_GROW = 0.08 +const MAX_GROW_PX = 6 +/** Gap between the separated droplet and the body, as a share of the height. */ +const DROPLET_GAP = 0.25 +/** A pulse: the glass swells as if hovered and pressed for this long (seconds, unless `pulseHold` says otherwise), then lets go. */ +const PULSE = 0.16 +/** A droplet melting in: the glass nods once it is this far in (0–1 of the way out). */ +const NOD_AT = 0.15 +/** Already hovered, its hover swell is at rest: the pulse pushes its width and height instead (per second). */ +const PULSE_KICK = { x: 24, y: 20 } +/** + * During a pulse the content stretches with the glass, each way by this much of what the pulse + * adds to the glass's swell that way (`--glass-bend`). It comes in and fades at these rates (per second). + * Held swollen, the content does not stay stretched: it evens out at `even`, and as the glass + * lets go it follows at `back` (per second). + */ +const PULSE_BEND = { amount: 0.5, in: 30, out: 5, even: 4, back: 12 } + +/** The CSS the glass relies on. Rendered once per page by (React 19 dedupes it). */ +export const GLASS_CSS = ` +/* Layered, so a utility class on the host (absolute, fixed) still wins over relative. */ +@layer components{:where([data-glass-host]){position:relative;isolation:isolate}} +/* Unlayered on purpose: once the glass draws, it must beat the host's own fill utilities. */ +[data-glass-host][data-glass-ready]{background:transparent!important;border-color:transparent!important;box-shadow:none!important;-webkit-backdrop-filter:none!important;backdrop-filter:none!important} +@keyframes glass-marquee{to{transform:translateX(-50%)}} +[data-glass-marquee]{animation:glass-marquee var(--glass-marquee-duration,5s) linear infinite} +/* Swapped labels and icons rise from a soft blur; a check draws itself in. */ +@keyframes glass-in{from{opacity:0;filter:blur(3px);transform:translateY(4px)}} +[data-glass-in]{animation:glass-in .38s cubic-bezier(.2,.8,.2,1) both} +@keyframes glass-draw{from{stroke-dashoffset:25}} +[data-glass-draw]{stroke-dasharray:25;animation:glass-draw .42s cubic-bezier(.65,0,.35,1) .12s both} +@keyframes glass-spin{to{transform:rotate(1turn)}} +[data-glass-spin]{animation:glass-spin .8s linear infinite} +[data-glass-ready] [data-glass-fallback]{visibility:hidden} +@media (prefers-reduced-motion:reduce){[data-glass-marquee],[data-glass-in],[data-glass-draw],[data-glass-spin]{animation:none}} +` + +/** Injects GLASS_CSS once (React 19 hoists and dedupes ` + ) +} + +export function GlassLayer({ + material = 'clear', + droplet = 'none', + tint = 0.6, + blur = 0, + backdrop, + live = false, + trigger, + disabled = false, + swell = true, + pulse, + pulseHold, + pull = true, + optics, +}: GlassLayerProps) { + const canvasRef = useRef(null) + // The droplet mode changes without rebuilding the glass, so the change itself animates. + const dropletRef = useRef(droplet) + dropletRef.current = droplet + // Tint, frost and optics are read on every frame: changing them redraws, never rebuilds. + const tuneRef = useRef({ tint, blur, optics }) + tuneRef.current = { tint, blur, optics } + const pokeRef = useRef<(() => void) | null>(null) + useEffect(() => pokeRef.current?.(), [droplet, tint, blur, optics]) + // A pulse plays when the value changes, never for the one the glass was mounted with. + const pulseRef = useRef<(() => void) | null>(null) + const pulseHoldRef = useRef(pulseHold) + pulseHoldRef.current = pulseHold + // The droplet splitting off or melting in: the glass swells once, as under a hover. + const nodRef = useRef<(() => void) | null>(null) + const lastDroplet = useRef(droplet) + useEffect(() => { + const from = lastDroplet.current + lastDroplet.current = droplet + if (from !== droplet && from !== 'none' && droplet !== 'none') nodRef.current?.() + }, [droplet]) + const lastPulse = useRef(pulse) + useEffect(() => { + if (Object.is(lastPulse.current, pulse)) return + lastPulse.current = pulse + pulseRef.current?.() + }, [pulse]) + + useEffect(() => { + const canvas = canvasRef.current + const host = canvas?.parentElement + const ctx = canvas?.getContext('2d') + const engine = disabled ? null : getGlassEngine() + if (!canvas || !host || !ctx || !engine) return + + const clear = material === 'clear' + let w = 0 + let h = 0 + let hasDroplet = false + /** The host's own corner radius in px; null = a pill. */ + let corner: number | null = null + let surface: Rgb = [1, 1, 1] + // Colours come from the host's own CSS (rest, hover, selected…) and cross-fade. + let color: [Rgb, Rgb] = [ + [1, 1, 1], + [1, 1, 1], + ] + let border: [Rgb, Rgb] | null = null + /** Clear glass: opacity of the optional rim line (GlassOptics). */ + let borderAlpha = 1 + /** Clear glass: the tint ended up dark (optics.dark applies). */ + let darkGlass = false + let colorT = 1 + let unpaintable = false + let sampled = false + let pressed = false + let hovered = false + let ready = false + const page = { + canvas: document.createElement('canvas'), + ctx: null as CanvasRenderingContext2D | null, + key: '', + at: 0, + stale: true, + /** The surface colour the picture was last filled with. */ + fill: '', + // Where the glass and the page were when the picture was taken, and what the walk found: + // elements pinned to the viewport, and whether everything else scrolls as one piece. + size: '', + lx: 0, + ly: 0, + sx: 0, + sy: 0, + pinned: [] as Element[], + rigid: false, + /** The glass this one melted into when the picture was taken (COHESION): left out of it. */ + near: undefined as Element[] | undefined, + } + const press: Spring = { x: 0, v: 0 } + const growX: Spring = { x: 0, v: 0 } + const growY: Spring = { x: 0, v: 0 } + const scale: Spring = { x: 1, v: 0 } + const drop: Spring = { x: 0, v: 0 } + /** How much the droplet is on its way in (0–1), eased: the bridge is held flat then (see the lens). */ + let closing = 0 + // A pulse: seconds of its swell left, and how much the content bends with it (0–1). + let settle = 0 + /** A nod: seconds left of a hover's swell alone (the droplet splitting off or melting in). */ + let nod = 0 + /** A nod asked for while the droplet is still on its way in: it plays once the two are one body. */ + let nodDue = false + const playNod = () => { + nodDue = false + // Hovered, the hover swell is at rest already: its springs are pushed instead (a pulse's push). + if (hovered) { + growX.v += PULSE_KICK.x + growY.v += PULSE_KICK.y + } else nod = PULSE + } + let bend = 0 + /** The swell the glass is settling at (0–1, eased): the content bends by what is beyond it, so it is even once the glass holds still. */ + let bendFrom = 0 + let bent = '' + /** What this canvas carries to undo a pull's stretch of the host: its `scale`, and the point it is taken about. */ + let unstretched = '' + let unstretchedAt = '' + const setBend = (next: string) => { + if (bent === next) return + bent = next + if (next) host.style.setProperty('--glass-bend', next) + else host.style.removeProperty('--glass-bend') + } + const maxScale = () => 1 + (2 * MAX_GROW_PX) / Math.max(w, 1) + const view: GlassView = { + canvas, + ctx, + dirty: true, + visible: false, + // What this glass is, for the light of a press (see GLOW in engine.ts): one that swells is a + // button and takes the flash of a press; one that holds still (a card) is a surface. + button: swell, + // A button is pulled after the pointer that holds it (PULL); glass that holds still (a card) is not. + pull: pull && swell, + grow: 1, + step: (dt, still) => { + if (still) { + press.x = growX.x = growY.x = press.v = growX.v = growY.v = 0 + drop.x = hasDroplet && dropletRef.current === 'apart' ? 1 : 0 + drop.v = 0 + closing = drop.x ? 0 : 1 + bendFrom = hovered ? 1 : 0 + settle = nod = bend = 0 + nodDue = false + setBend('') + scale.x = 1 + view.grow = 1 + if (colorT !== 1) view.dirty = true + colorT = 1 + return false + } + const greeting = settle > 0 + settle = Math.max(0, settle - dt) + const nodding = nod > 0 + nod = Math.max(0, nod - dt) + const hov = hovered || greeting || nodding ? 1 : 0 + // A pulse swells the glass as a press does, on top of the hover. + // (A pointer that holds the glass to pull it keeps it pressed outside it too.) + const down = pressed || (swell && view.held === true) || greeting + const target = down ? Math.min(PRESS_SCALE, maxScale()) : hov ? Math.min(HOVER_SCALE, maxScale()) : 1 + const a = stepSpring(press, down ? 1 : 0, SPRINGS.press, dt) + const b = stepSpring(growX, hov, SPRINGS.hoverX, dt) + const c = stepSpring(growY, hov, SPRINGS.hoverY, dt) + const d = stepSpring(scale, target, SPRINGS.press, dt) + const apart = dropletRef.current === 'apart' && view.visible && !pressed + const e = hasDroplet ? stepSpring(drop, apart ? 1 : 0, apart ? SPRINGS.dropletOut : SPRINGS.dropletIn, dt) : false + closing = clamp(closing + (apart ? -1 : 1) * dt * 12) + if (nodDue && (apart || drop.x < NOD_AT)) playNod() + // The content follows the glass while the pulse lasts, and lets go as it settles. + bend = clamp(bend + ((greeting ? 1 : 0) - bend) * Math.min(1, dt * (greeting ? PULSE_BEND.in : PULSE_BEND.out))) + if (!greeting && bend < 0.004) bend = 0 + bendFrom = clamp(bendFrom + (hov - bendFrom) * Math.min(1, dt * (hov > bendFrom ? PULSE_BEND.even : PULSE_BEND.back))) + const by = bend * PULSE_BEND.amount * 2 * HOVER_GROW + setBend(bend ? `${(1 + (by * (growX.x - bendFrom) * h) / Math.max(w, 1)).toFixed(4)} ${(1 + by * (growY.x - bendFrom)).toFixed(4)}` : '') + // The engine writes the host's scale: this, times the stretch of a pull. + view.grow = scale.x + const fading = 1 - colorT > 0.004 + colorT = fading ? colorT + (1 - colorT) * Math.min(1, dt * 14) : 1 + return a || b || c || d || e || greeting || nodding || nodDue || bend > 0 || fading || (clear && live && view.visible) + }, + lens: (refresh) => { + if (refresh) { + w = host.offsetWidth + h = host.offsetHeight + // The glass takes the host's corners (`rounded-lg`); round enough is a pill. + const rounding = getComputedStyle(host).borderTopLeftRadius + const px = rounding.endsWith('%') ? (Math.min(w, h) * parseFloat(rounding)) / 100 : parseFloat(rounding) || 0 + corner = px >= Math.min(w, h) / 2 - 0.5 ? null : px + // The droplet: a direct child marked `data-glass-drop`, laid out by its owner at the end. + const had = hasDroplet + hasDroplet = dropletRef.current !== 'none' && [...host.children].some((c) => c.hasAttribute('data-glass-drop')) + // Springs step before shapes are read: one more frame lets the droplet start moving. + if (hasDroplet !== had) engine.wake() + const s = engine.resolveColor(surfaceColorOf(host.parentElement)) + surface = [s[0], s[1], s[2]] + if (clear) { + const o = tuneRef.current.optics + const custom = o?.tintColor || getComputedStyle(host).getPropertyValue('--glass-tint').trim() + const luminance = 0.2126 * surface[0] + 0.7152 * surface[1] + 0.0722 * surface[2] + const t = custom ? engine.resolveColor(custom) : null + const tc: Rgb = t ? [t[0], t[1], t[2]] : luminance > 0.5 ? [1, 1, 1] : [0, 0, 0] + // Light or dark glass: lets the host pick a readable text colour (data-[glass-tone=…]:). + const tone = 0.2126 * tc[0] + 0.7152 * tc[1] + 0.0722 * tc[2] > 0.5 ? 'light' : 'dark' + if (host.dataset.glassTone !== tone) host.dataset.glassTone = tone + darkGlass = tone === 'dark' + color = [tc, tc] + // An optional line just inside the rim. + const line = darkGlass ? { ...o, ...o?.dark } : o + const bc = line?.borderColor && (line.borderAlpha ?? 0) > 0 ? engine.resolveColor(line.borderColor) : null + border = bc ? [[bc[0], bc[1], bc[2]], [bc[0], bc[1], bc[2]]] : null + borderAlpha = bc ? clamp((line?.borderAlpha ?? 0) * bc[3]) : 1 + colorT = 1 + sampled = true + } else { + // Read the host's own fill and border with the glass briefly lifted. + const had = 'glassReady' in host.dataset + const transition = host.style.transition + host.style.transition = 'none' + if (had) delete host.dataset.glassReady + const st = getComputedStyle(host) + const fill = engine.resolveColor(st.backgroundColor) + const bw = st.borderTopStyle === 'solid' ? parseFloat(st.borderTopWidth) || 0 : 0 + const bc = engine.resolveColor(st.borderTopColor) + const cannot = st.backgroundImage !== 'none' || (st.borderTopStyle !== 'solid' && st.borderTopStyle !== 'none') + if (had) { + host.dataset.glassReady = '' + void getComputedStyle(host).backgroundColor + } + host.style.transition = transition + const next = mixRgb(surface, [fill[0], fill[1], fill[2]], fill[3]) + const nextBorder: Rgb | null = bw > 0 && bc[3] > 0.02 ? mixRgb(next, [bc[0], bc[1], bc[2]], bc[3]) : null + unpaintable = cannot || (fill[3] < 0.02 && !nextBorder) + const now = sampled ? mixRgb(color[0], color[1], colorT) : next + const nowBorder = sampled && border ? mixRgb(border[0], border[1], colorT) : (nextBorder ?? next) + const changed = sampled && (now.some((v, i) => Math.abs(v - next[i]) > 0.004) || !!border !== !!nextBorder) + color = [now, next] + border = nextBorder ? [nowBorder, nextBorder] : null + colorT = changed ? 0 : 1 + sampled = true + if (changed) engine.wake() + } + } + if (w < 2 || h < 2) return null + if (unpaintable) { + if (ready) { + ready = false + delete host.dataset.glassReady + } + return null + } + // The host itself is scaled; the glass inside the canvas is divided by that scale. + const p = clamp(press.x, -0.12, 1.15) + const s = Math.max(0.5, scale.x) + const k = lerp(1, Math.min(PRESS_SCALE, maxScale()), p) / s + const grow = (h * HOVER_GROW) / s + const t = hasDroplet ? clamp(drop.x, 0, 1.06) : 0 + const pull = h * (1 + DROPLET_GAP) * t + const hy = (h / 2) * k + grow * growY.x + // Swollen, the droplet's end sits a little off the body's. It joins it as the two + // become one, or the end would jump when the droplet goes (the spring's last + // ripple brings it back for a moment). + const dropX = (w / 2 - h / 2) * k + grow * lerp(growX.x - growY.x, growX.x * 0.5, smooth(0, 0.15, t)) + // The canvas keeps 8px beside the glass and 10px above it, and more whenever the glass + // swells past that (a push while it is already swollen): its end is never cut off. + const reach = Math.max((w / 2) * k + grow * growX.x, t > 0.001 ? dropX + hy : 0) + // A pull stretches the host. That stretch is undone on this canvas and drawn by the glass + // itself: it stays a pill with round ends, as long and as thin as the pull makes it, and + // bends what really lies behind it (not a picture of it, pulled out of shape with the host). + const px = view.pulled?.sx ?? 1 + const py = view.pulled?.sy ?? 1 + // Room for the longest a pull can make it, taken once: a canvas that changed size on + // every frame of a pull would be painted from scratch each time. + const most = px === 1 && py === 1 ? 0 : Math.max(w, h) <= PULL.smallUntil ? PULL.smallStretchMax : PULL.stretchMax + // A button also keeps room for its side of a bridge to glass it melts into (COHESION). + const melt = swell ? Math.ceil(cohesionSoftness(h) / 4) + 3 : 0 + const padX = Math.max(8, Math.ceil(reach * (1 + most) - w / 2 + 2), melt) + const padTop = Math.max(10, Math.ceil(hy * (1 + most) - h / 2 + 2), melt) + const padBottom = Math.round(h * 0.8 + 4) + const origin = `${padX + w / 2}px ${padTop + h / 2}px` + const undo = px === 1 && py === 1 ? '' : `${(1 / px).toFixed(6)} ${(1 / py).toFixed(6)}` + if (undo !== unstretched || (undo && origin !== unstretchedAt)) { + canvas.style.transformOrigin = unstretchedAt = origin + canvas.style.scale = unstretched = undo + } + const rect = host.getBoundingClientRect() + const pc = clamp(press.x) + const unit = h / DESIGN_HEIGHT + const bevel = lerp(DESIGN_HEIGHT * 0.42, 62, pc) + // Square corners swell with the glass. + const radius = corner === null ? 999 : corner * (hy / (h / 2)) + const { tint, blur, optics: o } = tuneRef.current + // The engine scales the shadow with the light too; divide it back out, so they tune apart. + const strength = Math.max(clamp(o?.light ?? 1, 0, 3), 1e-4) + // The gooey bridge opens as the droplet leaves and closes once it has snapped. + const bridge = h * 0.34 * py * smooth(0, 0.15, t) * (1 - smooth(0.8, 1, t)) + // On its way in, the droplet ends up inside the body's end, and a bridge that soft would + // swell that end past the body (it grew, then shrank as the droplet went). There the + // bridge only fills the dip between the two: the end stays as tall as the rest. + const dip = Math.hypot(hy * py, (pull * k * px) / 2) - hy * py + return { + // The canvas is placed against the padding box; the glass is measured on the border box. + left: -padX - host.clientLeft, + top: -padTop - host.clientTop, + width: w + 2 * padX, + height: h + padTop + padBottom, + unit, + cx: padX + w / 2, + cy: padTop + h / 2, + hx: ((w / 2 - pull / 2) * k + grow * growX.x) * px, + hy: hy * py, + radius, + bodyX: (-pull / 2) * k * px, + droplet: + t > 0.001 + ? { + x: dropX * px, + r: hy * py, + k: lerp(bridge, Math.min(bridge, 4 * dip), closing), + } + : undefined, + // Shading bands deeper than a square corner would meet in diagonal seams: the bevel + // stays within the corner, and the bend keeps the depth it has on a pill. + bevel: (corner === null ? bevel : Math.min(bevel, (radius / unit) * 1.2)) * Math.max(0.05, o?.bevel ?? 1), + band: corner === null || hasDroplet ? undefined : bevel * 0.35 * Math.max(0.05, o?.bendDepth ?? 1), + shadow: (0.12 * lerp(0.55, 1, pc) * Math.max(0, o?.shadow ?? 1)) / strength, + shadowSoftness: 34 * lerp(0.6, 1, pc) * Math.max(0.05, o?.shadowSoftness ?? 1), + shadowOffset: 22 * lerp(0.5, 1, pc) * Math.max(0, o?.shadowOffset ?? 1), + strength, + tune: o && { + rim: o.rim, + rimWidth: o.rimWidth, + fresnel: o.fresnel, + inner: o.inner, + reflection: o.reflection, + caustic: o.caustic, + mirror: o.mirror, + bendCurve: o.bendCurve, + bendDepth: o.bendDepth, + saturation: o.saturation, + frostEdge: o.frostEdge, + }, + color: mixRgb(color[0], color[1], colorT), + border: border ? mixRgb(border[0], border[1], colorT) : undefined, + borderAlpha: clear ? borderAlpha : undefined, + borderWidth: clear ? o?.borderWidth : undefined, + surface, + edgeClear: 0.2, + cursorLight: o?.cursorLight ?? true, + pointerLight: true, + // What the rim of clear glass mirrors: the page around it. Tinted glass mirrors nothing. + reflection: !clear ? undefined : { + height: h, + live, + paint: (around, reach) => { + const r = host.getBoundingClientRect() + const box = { left: r.left + (r.width - w) / 2 - padX, top: r.top + (r.height - h) / 2 - padTop, width: w + 2 * padX, height: h + padTop + padBottom } + drawAround(around, (backdrop ? host.closest(backdrop) : null) ?? document.body, box, reach, { + skip: (el) => el === host || el.hasAttribute('data-glass-skip'), + onStale: dirty, + }) + }, + }, + refraction: clear + ? { + paint: (back) => { + back.translate(padX, padTop) + const fill = rgbCss(surface) + const recoloured = fill !== page.fill + page.fill = fill + back.fillStyle = fill + back.fillRect(-padX, -padTop, w + 2 * padX, h + padTop + padBottom) + const root = (backdrop ? host.closest(backdrop) : null) ?? document.body + const r = host.getBoundingClientRect() + const lx = r.left + (r.width - w) / 2 + const ly = r.top + (r.height - h) / 2 + const target = back.canvas + const key = `${target.width}:${target.height}:${Math.round(lx * 2)}:${Math.round(ly * 2)}:${Math.round(scrollX)}:${Math.round(scrollY)}` + const now = performance.now() + if (!page.ctx) page.ctx = page.canvas.getContext('2d') + const region = { left: lx - padX, top: ly - padTop, right: lx + w + padX, bottom: ly + h + padBottom } + // Scrolling with the page, the glass keeps the same page behind it: the picture it has + // is still right. Not when something in it moves by itself, or is pinned to the + // viewport (a sticky header) and touches the glass, now or when it was painted. + const rides = + !live && + page.rigid && + page.size === `${target.width}:${target.height}` && + Math.abs(lx - page.lx + scrollX - page.sx) < 0.05 && + Math.abs(ly - page.ly + scrollY - page.sy) < 0.05 && + !page.pinned.some((el) => { + const b = el.getBoundingClientRect() + return b.width > 0 && b.height > 0 && b.right > region.left && b.left < region.right && b.bottom > region.top && b.top < region.bottom + }) + // Glass this one melts into (COHESION) is the same body now: the picture leaves it out. + if (page.near !== view.near) { + page.near = view.near + page.stale = true + } + // The page is re-painted when the glass moves over it, and at most every 120 ms otherwise. + // `live` reads it again every frame at 60 Hz, and every second or third frame on a faster display. + const again = !!page.ctx && (page.stale || (key !== page.key && !rides) || now - page.at > (live ? 12 : 120)) + if (page.ctx && again) { + page.stale = false + page.key = key + page.at = now + page.size = `${target.width}:${target.height}` + page.lx = lx + page.ly = ly + page.sx = scrollX + page.sy = scrollY + if (page.canvas.width !== target.width || page.canvas.height !== target.height) { + page.canvas.width = target.width + page.canvas.height = target.height + } + const pc2 = page.ctx + pc2.setTransform(1, 0, 0, 1, 0, 0) + pc2.clearRect(0, 0, target.width, target.height) + pc2.setTransform(back.getTransform()) + const found = { pinned: [] as Element[], touched: false, loose: false } + drawDom(pc2, root, { + origin: { left: lx, top: ly }, + region, + skip: (el) => el === host || el.hasAttribute('data-glass-skip') || !!view.near?.includes(el), + onStale: () => { + page.stale = true + view.dirty = true + engine.wake() + }, + found, + }) + page.pinned = found.pinned + page.rigid = !found.loose && !found.touched + } + back.save() + back.setTransform(1, 0, 0, 1, 0, 0) + back.drawImage(page.canvas, 0, 0) + back.restore() + // The same picture of the page as last time: the engine keeps its texture. + return again || recoloured + }, + refract: lerp(44, 37, pc) * Math.max(0, o?.refraction ?? 1), + magnify: Math.max(0, o?.magnify ?? 0), + dispersion: Math.max(0, o?.dispersion ?? 0.12), + blurCenter: Math.max(0, o?.clearBlur ?? 0.35), + blurEdge: Math.max(0, o?.clearBlurEdge ?? 2.2), + frost: clamp(darkGlass ? (o?.dark?.tint ?? tint) : tint), + blur, + blurMix: o?.frostMix, + radial: o?.bendMode === 'radial' ? 0.065 * Math.max(0, o?.refraction ?? 1) : undefined, + } + : undefined, + screenX: rect.left + rect.width / 2, + screenY: rect.top + rect.height / 2, + // The host's scale on screen (its own and its ancestors'), without a pull's stretch, which the canvas undoes. + scale: rect.width / Math.max(w * px, 1e-3), + } + }, + drawn: () => { + if (ready) return + ready = true + host.dataset.glassReady = '' + }, + lost: () => { + delete host.dataset.glassReady + view.grow = 1 + }, + } + + const isDisabled = () => host.matches(":disabled, [aria-disabled='true']") + const dirty = () => { + view.dirty = true + engine.wake() + } + pokeRef.current = dirty + // The nod: a hover's swell alone, for PULSE seconds. A droplet melting in swells once it is + // in: pushed while it is still out, its end would stick out past the body's. + nodRef.current = () => { + if (!swell || host.matches(':disabled')) return + if (hasDroplet && dropletRef.current === 'merged' && drop.x >= NOD_AT) nodDue = true + else playNod() + dirty() + } + // The pulse (see `pulse`): the glass swells as under a hover and a press at once, and lets + // go. Hovered, its hover swell is at rest already: those springs are pushed, so it wobbles. + pulseRef.current = () => { + if (!swell || host.matches(':disabled')) return + if (hovered) { + growX.v += PULSE_KICK.x + growY.v += PULSE_KICK.y + } + settle = Math.max(0, pulseHoldRef.current ?? PULSE) + dirty() + } + const onDown = () => { + if (!swell || isDisabled()) return + pressed = true + engine.wake() + } + const onUp = () => { + pressed = false + engine.wake() + } + const onEnter = (e: PointerEvent) => { + if (!swell || e.pointerType !== 'mouse' || isDisabled()) return + hovered = true + dirty() + } + const onLeave = () => { + pressed = false + hovered = false + dirty() + } + const target: HTMLElement = (trigger ? host.closest(trigger) : null) ?? host + if (target !== host) view.pressArea = target + target.addEventListener('pointerdown', onDown) + target.addEventListener('pointerup', onUp) + target.addEventListener('pointercancel', onUp) + target.addEventListener('pointerenter', onEnter) + target.addEventListener('pointerleave', onLeave) + const io = new IntersectionObserver(([entry]) => { + view.visible = entry.isIntersecting + dirty() + }) + io.observe(host) + const ro = new ResizeObserver(dirty) + ro.observe(host) + // Content changes (label, selected state) re-check the droplet and colours. + const mo = new MutationObserver(dirty) + mo.observe(host, { + childList: true, + attributes: true, + attributeFilter: ['class', 'disabled', 'aria-pressed', 'aria-checked', 'aria-selected', 'aria-expanded', 'data-state'], + }) + // A scroll changes what lies behind, never the glass: sizes and colours are not read again. + const onScroll = () => { + view.repaint = true + engine.wake() + } + if (clear) addEventListener('scroll', onScroll, { passive: true, capture: true }) + engine.add(view) + + return () => { + engine.remove(view) + ctx.clearRect(0, 0, canvas.width, canvas.height) + io.disconnect() + ro.disconnect() + mo.disconnect() + removeEventListener('scroll', onScroll, { capture: true }) + target.removeEventListener('pointerdown', onDown) + target.removeEventListener('pointerup', onUp) + target.removeEventListener('pointercancel', onUp) + target.removeEventListener('pointerenter', onEnter) + target.removeEventListener('pointerleave', onLeave) + delete host.dataset.glassReady + delete host.dataset.glassTone + host.style.removeProperty('--glass-bend') + canvas.style.scale = '' + pokeRef.current = null + pulseRef.current = null + nodRef.current = null + } + }, [material, backdrop, live, trigger, disabled, swell, pull]) + + return ( + <> + + + + ) +} + +export default GlassLayer diff --git a/src/components/liquid-glass/glass-lens.tsx b/src/components/liquid-glass/glass-lens.tsx new file mode 100644 index 0000000..6bb6f77 --- /dev/null +++ b/src/components/liquid-glass/glass-lens.tsx @@ -0,0 +1,475 @@ +'use client' + +// KolayTercih (DESIGN.md §4.50): Liquid Glass UI 2.0.0'dan (bilalgursen/liquid-glass@9c65d01, +// 24 Kas 2026) olduğu gibi alındı. Elle değiştirilmez; kit güncellenince dosya yeniden kopyalanır. + +// GlassLens — the sliding glass lens of a segmented control / tab bar. Bring your own +// options (Radix Tabs, a radiogroup, anything) and put the lens first in the container: +// +//
+// +// {options.map(o => ( +// +// ))} +//
+// +// Contract: options carry role="radio" or role="tab"; the selected option contains the +// flat highlight element marked `data-glass-highlight`. Its background colour is the +// lens colour and its corners are the lens's corners: `rounded-full` travels as a pill, +// `rounded-lg` as a rounded rectangle, and the corners grow with the lens as it swells. +// When the selection changes the lens leaves the old highlight, swells into clear glass +// that bends and magnifies the options it passes, then settles into the flat highlight +// again. Press and hold opens the lens in place; drag it and release to select. While +// the lens is visible the container carries: +// data-glass-moving — hide the flat highlight: [[data-glass-moving]_&]:opacity-0 +// data-glass-traveling — paint the selected label as unselected, so it reads under clear glass +// Without WebGL2 or with reduced motion the highlight simply jumps. COPY VERBATIM. MIT. + +import { useEffect, useRef } from 'react' + +import { drawAround } from './dom-snapshot' +import { GlassStyles } from './glass-layer' +import { SPRINGS, clamp, getGlassEngine, lerp, stepSpring, surfaceColorOf, type GlassView, type Rgb, type Spring } from './engine' + +/** One option is designed 80 units tall; the optics are scaled to the slider's 120-unit lens. */ +const OPTION_UNITS = 80 +const OPTICS = (OPTION_UNITS * 1.35) / 120 +/** The lens swells while it travels: width +12 %, height +35 %. */ +const TRAVEL_W = 0.12 +const TRAVEL_H = 0.35 + +/** An option's centre and size; `r` = its corner radius in px, null for a pill. */ +type Box = { x: number; y: number; w: number; h: number; r: number | null } + +/** The corner radius of `el` in px (`rounded-lg`, `50%`) on a w × h box. */ +function cornerOf(el: Element, w: number, h: number) { + const v = getComputedStyle(el).borderTopLeftRadius + return v.endsWith('%') ? (Math.min(w, h) * parseFloat(v)) / 100 : parseFloat(v) || 0 +} + +const svgCache = new WeakMap>() + +function drawSvg(ctx: CanvasRenderingContext2D, el: SVGSVGElement, color: string, x: number, y: number, w: number, h: number, redraw: () => void) { + let byColor = svgCache.get(el) + if (!byColor) svgCache.set(el, (byColor = new Map())) + let img = byColor.get(color) + if (!img) { + const clone = el.cloneNode(true) as SVGSVGElement + clone.removeAttribute('class') + clone.setAttribute('xmlns', 'http://www.w3.org/2000/svg') + clone.setAttribute('width', String(w)) + clone.setAttribute('height', String(h)) + clone.style.color = color + img = new Image() + img.onload = redraw + img.src = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(new XMLSerializer().serializeToString(clone))}` + byColor.set(color, img) + } + if (img.complete && img.naturalWidth) ctx.drawImage(img, x, y, w, h) +} + +const visible = (c: string) => !!c && c !== 'transparent' && !/rgba\(.*,\s*0\)$/.test(c) && !/\/\s*0\)$/.test(c) + +/** Paints the container into `back` (everything beneath the lens) and the labels into `front` in the selected colour. */ +function paintOptions(back: CanvasRenderingContext2D, front: CanvasRenderingContext2D, root: HTMLElement, selectedColor: string, redraw: () => void) { + const o = root.getBoundingClientRect() + let lang: string | undefined + try { + lang = Intl.getCanonicalLocales(document.documentElement.lang)[0] + } catch { + // Not a language tag: the default locale's rules apply. + } + const walk = (el: Element) => { + if (el instanceof HTMLCanvasElement || el.hasAttribute('data-glass-highlight')) return + const st = getComputedStyle(el) + if (st.display === 'none' || st.visibility === 'hidden') return + const r = el.getBoundingClientRect() + const x = r.left - o.left + const y = r.top - o.top + if (el instanceof SVGSVGElement) { + if (r.width < 1 || r.height < 1) return + drawSvg(back, el, st.color, x, y, r.width, r.height, redraw) + drawSvg(front, el, selectedColor, x, y, r.width, r.height, redraw) + return + } + if (st.display !== 'contents' && r.width > 1 && r.height > 1) { + const radius = Math.min(parseFloat(st.borderTopLeftRadius) || 0, r.width / 2, r.height / 2) + if (visible(st.backgroundColor)) { + back.beginPath() + back.roundRect(x, y, r.width, r.height, radius) + back.fillStyle = st.backgroundColor + back.fill() + } + const bw = parseFloat(st.borderTopWidth) || 0 + if (bw > 0 && st.borderTopStyle !== 'none' && visible(st.borderTopColor)) { + back.beginPath() + back.roundRect(x + bw / 2, y + bw / 2, r.width - bw, r.height - bw, Math.max(0, radius - bw / 2)) + back.lineWidth = bw + back.strokeStyle = st.borderTopColor + back.stroke() + } + } + for (const n of el.childNodes) { + if (n instanceof Element) walk(n) + else if (n.nodeType === Node.TEXT_NODE && n.textContent?.trim()) { + const range = document.createRange() + range.selectNodeContents(n) + const m = range.getBoundingClientRect() + if (m.width < 1) continue + // Labels are drawn as the page shows them (`uppercase` tabs). + const raw = n.textContent.trim() + const text = st.textTransform === 'uppercase' ? raw.toLocaleUpperCase(lang) : st.textTransform === 'lowercase' ? raw.toLocaleLowerCase(lang) : raw + for (const [ctx, color] of [ + [back, st.color], + [front, selectedColor], + ] as const) { + ctx.font = `${st.fontStyle} ${st.fontWeight} ${st.fontSize} ${st.fontFamily}` + ctx.letterSpacing = st.letterSpacing === 'normal' ? '0px' : st.letterSpacing + ctx.textAlign = 'left' + ctx.textBaseline = 'alphabetic' + const mt = ctx.measureText(text) + ctx.fillStyle = color + ctx.fillText(text, m.left - o.left, m.top - o.top + (m.height - mt.fontBoundingBoxAscent - mt.fontBoundingBoxDescent) / 2 + mt.fontBoundingBoxAscent) + } + } + } + } + walk(root) +} + +export type GlassLensProps = { + /** The selected value (any change slides the lens). `null` = nothing selected. */ + value: string | number | null + disabled?: boolean +} + +export function GlassLens({ value, disabled = false }: GlassLensProps) { + const canvasRef = useRef(null) + const syncRef = useRef<((slide: boolean) => void) | null>(null) + + useEffect(() => { + const canvas = canvasRef.current + const root = canvas?.parentElement + const ctx = canvas?.getContext('2d') + const engine = disabled ? null : getGlassEngine() + if (!canvas || !root || !ctx || !engine) return + const reduced = window.matchMedia('(prefers-reduced-motion: reduce)') + + let target: Box | null = null + let active = false + let pressed = false + let dragX: number | null = null + let color: Rgb = [0, 0, 0] + let surface: Rgb = [1, 1, 1] + let selectedColor = 'white' + const mx: Spring = { x: 0, v: 0 } + const my: Spring = { x: 0, v: 0 } + const mw: Spring = { x: 0, v: 0 } + const mh: Spring = { x: 0, v: 0 } + /** Corner radius (px) of a rounded-rectangle lens; it travels with the size. */ + const mr: Spring = { x: 0, v: 0 } + const press: Spring = { x: 0, v: 0 } + const place = (b: Box) => { + mx.x = b.x + my.x = b.y + mw.x = b.w + mh.x = b.h + mr.x = b.r ?? Math.min(b.w, b.h) / 2 + mx.v = my.v = mw.v = mh.v = mr.v = 0 + } + const options = () => + [...root.querySelectorAll('[role="radio"], [role="tab"]')].map((el) => { + const a = root.getBoundingClientRect() + const b = el.getBoundingClientRect() + return { el, x: b.left - a.left + b.width / 2, y: b.top - a.top + b.height / 2, w: b.width, h: b.height } + }) + const nearest = (x: number, y: number) => { + let best: ReturnType[number] | null = null + let d = Infinity + for (const o of options()) { + const dd = Math.abs(o.x - x) + Math.abs(o.y - y) * 4 + if (dd < d) { + d = dd + best = o + } + } + return best + } + const stop = () => { + active = false + press.x = press.v = 0 + if (target) place(target) + delete root.dataset.glassMoving + delete root.dataset.glassTraveling + view.dirty = true + setTimeout(() => { + const el = root.querySelector('[data-glass-highlight]')?.parentElement + if (!active && el) selectedColor = getComputedStyle(el).color + }, 400) + } + const start = () => { + if (active || !target) return + place(target) + active = true + } + + const view: GlassView = { + canvas, + ctx, + dirty: false, + visible: false, + step: (dt, still) => { + if (!active || !target) return false + if (still) { + stop() + return false + } + let goal: Box = target + if (dragX !== null) { + const all = options() + const near = nearest(dragX, my.x) + if (near && all.length) { + const xs = all.map((o) => o.x) + goal = { x: clamp(dragX, Math.min(...xs), Math.max(...xs)), y: near.y, w: near.w, h: near.h, r: target.r } + } + } + const spring = dragX !== null ? SPRINGS.drag : SPRINGS.slide + const a = stepSpring(mx, goal.x, spring, dt) + const b = stepSpring(my, goal.y, spring, dt) + const c = stepSpring(mw, goal.w, spring, dt) + const d = stepSpring(mh, goal.h, spring, dt) + const f = goal.r !== null && stepSpring(mr, goal.r, spring, dt) + // The lens stays clear until it is within 6 % of an option's width from its target. + const traveling = dragX === null && Math.hypot(mx.x - goal.x, my.x - goal.y) > target.w * 0.06 + const open = pressed || traveling + if (!open) delete root.dataset.glassTraveling + else if ('glassMoving' in root.dataset) root.dataset.glassTraveling = '' + const e = stepSpring(press, open ? 1 : 0, SPRINGS.press, dt) + const moving = a || b || c || d || e || f + if (!moving && !pressed) stop() + return moving + }, + lens: () => { + if (!active || !target) return null + const p = clamp(press.x, -0.12, 1.15) + const pc = clamp(press.x) + const frost = 1 - pc + const padX = 16 + // Room for the larger of the lens and its target: it may travel between sizes. + const tall = Math.max(target.h, mh.x) + const padTop = Math.round(tall * 0.3 + 6) + const padBottom = Math.round(tall * 1.1 + 8) + const box = root.getBoundingClientRect() + // The optics follow the lens's own height, so they scale as it changes size. + const unit = mh.x / OPTION_UNITS + const swell = 1 + TRAVEL_H * p + const hx = (mw.x / 2) * (1 + TRAVEL_W * p) + const hy = (mh.x / 2) * swell + const bevel = lerp(OPTION_UNITS * 0.42, 62 * OPTICS, pc) + const pill = target.r === null + // The highlight's corners, growing with the glass; a pill stays a pill. + const radius = pill ? 999 : Math.min(mr.x * swell, hx, hy) + return { + left: -padX, + top: -padTop, + width: root.offsetWidth + 2 * padX, + height: root.offsetHeight + padTop + padBottom, + unit, + cx: padX + mx.x, + cy: padTop + my.x, + hx, + hy, + radius, + bodyX: 0, + // Shading deeper than a square corner would meet in diagonal seams: the bevel stays + // within the corner, and the bend keeps the depth it has on a pill. + bevel: pill ? bevel : Math.min(bevel, (radius / unit) * 1.2), + band: pill ? undefined : bevel * 0.35, + shadow: 0.12 * lerp(0.55, 1, pc), + shadowSoftness: 34 * OPTICS * lerp(0.6, 1, pc), + shadowOffset: 22 * OPTICS * lerp(0.5, 1, pc), + strength: pc, + color, + surface, + edgeClear: 0, + refraction: { + paint: (back, front) => { + back.translate(padX, padTop) + front.translate(padX, padTop) + paintOptions(back, front, root, selectedColor, () => { + view.dirty = true + engine.wake() + }) + }, + refract: lerp(6, 37, pc) * OPTICS * lerp(0.06, 1, pc), + magnify: 0.12 * pc, + dispersion: 0.12 * pc, + blurCenter: lerp(0.35, 4, frost), + blurEdge: lerp(2.2, 4, frost), + frost, + }, + cursorLight: true, + pointerLight: true, + // What the lens's rim mirrors while it travels (clear): the page around the options. + reflection: { + height: tall, + paint: (around, reach) => { + drawAround(around, document.body, { left: box.left - padX, top: box.top - padTop, width: root.offsetWidth + 2 * padX, height: root.offsetHeight + padTop + padBottom }, reach, { + skip: (el) => el === canvas || el.hasAttribute('data-glass-skip'), + onStale: () => { + view.dirty = true + engine.wake() + }, + }) + }, + }, + screenX: box.left + mx.x, + screenY: box.top + my.x, + } + }, + // The flat highlight hides only once the lens has drawn its first frame. + drawn: () => { + if (!active || 'glassMoving' in root.dataset) return + root.dataset.glassMoving = '' + root.dataset.glassTraveling = '' + }, + lost: () => { + pressed = false + dragX = null + stop() + }, + } + + const measure = (): Box | null => { + const hl = root.querySelector('[data-glass-highlight]') + const el = hl?.parentElement + if (!hl || !el) return null + const a = root.getBoundingClientRect() + const b = el.getBoundingClientRect() + if (b.width < 2 || b.height < 2) return null + const c = engine.resolveColor(getComputedStyle(hl).backgroundColor) + color = [c[0], c[1], c[2]] + const s = engine.resolveColor(surfaceColorOf(root.parentElement)) + surface = [s[0], s[1], s[2]] + const st = getComputedStyle(el) + if (!active) selectedColor = st.color + // The corners the highlight shows: its own, or its option's when the option clips it. + let r = cornerOf(hl, b.width, b.height) + if (st.overflowX !== 'visible' || st.overflowY !== 'visible') r = Math.max(r, cornerOf(el, b.width, b.height)) + const w = b.width + const h = b.height + return { x: b.left - a.left + w / 2, y: b.top - a.top + h / 2, w, h, r: r >= Math.min(w, h) / 2 - 0.5 ? null : r } + } + const sync = (slide: boolean) => { + const keepColor = selectedColor + const old = target + const next = measure() + const same = + !!next && + !!old && + Math.abs(next.x - old.x) < 0.5 && + Math.abs(next.y - old.y) < 0.5 && + Math.abs(next.w - old.w) < 0.5 && + Math.abs(next.h - old.h) < 0.5 && + next.r === old.r + if (same) return + if (!slide || !next || !old || !view.visible || reduced.matches) { + target = next + if (active && !pressed) stop() + return + } + selectedColor = keepColor + start() + target = next + engine.wake() + } + syncRef.current = sync + sync(false) + + // Press, drag, release. The pointer is not captured: a tap still clicks the option. + let downX = 0 + let moved = false + const localX = (e: PointerEvent) => e.clientX - root.getBoundingClientRect().left + const onMove = (e: PointerEvent) => { + const x = localX(e) + if (!moved && Math.abs(x - downX) < 4) return + moved = true + dragX = x + engine.wake() + } + const onUp = (e: PointerEvent) => { + removeEventListener('pointermove', onMove) + removeEventListener('pointerup', onUp) + removeEventListener('pointercancel', onUp) + pressed = false + if (moved && dragX !== null && e.type === 'pointerup') { + const near = nearest(dragX, my.x) + if (near && !near.el.querySelector('[data-glass-highlight]')) { + near.el.dispatchEvent(new MouseEvent('mousedown', { bubbles: true, cancelable: true, button: 0 })) + near.el.click() + } + } + dragX = null + engine.wake() + } + const onDown = (e: PointerEvent) => { + if (e.button !== 0 || reduced.matches || !target || !view.visible) return + if (!(e.target instanceof Element) || !e.target.closest('[role="radio"], [role="tab"]')) return + pressed = true + moved = false + downX = localX(e) + start() + addEventListener('pointermove', onMove) + addEventListener('pointerup', onUp) + addEventListener('pointercancel', onUp) + engine.wake() + } + root.addEventListener('pointerdown', onDown) + const touchAction = root.style.touchAction + root.style.touchAction = 'pan-y' + const io = new IntersectionObserver(([entry]) => { + view.visible = entry.isIntersecting + }) + io.observe(root) + const ro = new ResizeObserver(() => { + if (!active) sync(false) + }) + ro.observe(root) + engine.add(view) + + return () => { + engine.remove(view) + ctx.clearRect(0, 0, canvas.width, canvas.height) + io.disconnect() + ro.disconnect() + root.removeEventListener('pointerdown', onDown) + removeEventListener('pointermove', onMove) + removeEventListener('pointerup', onUp) + removeEventListener('pointercancel', onUp) + root.style.touchAction = touchAction + syncRef.current = null + delete root.dataset.glassMoving + delete root.dataset.glassTraveling + } + }, [disabled]) + + useEffect(() => { + syncRef.current?.(true) + }, [value]) + + return ( + <> + + + + ) +} + +export default GlassLens diff --git a/src/components/mobil-menu.tsx b/src/components/mobil-menu.tsx index 6ca86e2..d1b9946 100644 --- a/src/components/mobil-menu.tsx +++ b/src/components/mobil-menu.tsx @@ -132,7 +132,7 @@ export function MobilMenu({ : "Menü" } data-ucus-hedefi="mobil" - className={cn(SIVI_KAP, "kt-dokunma relative flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-full border border-slate-200 bg-card text-slate-900 outline-none transition-[background-color,transform] duration-150 hover:bg-slate-100 focus-visible:ring-3 focus-visible:ring-ring/50 active:scale-[0.96] data-cam:active:scale-100 motion-reduce:transition-none sm:size-12")} + className={cn(SIVI_KAP, "kt-dokunma relative flex size-9 shrink-0 cursor-pointer items-center justify-center rounded-full border border-slate-200 bg-card text-slate-900 outline-none transition-[background-color,transform] duration-150 hover:bg-slate-100 focus-visible:ring-3 focus-visible:ring-ring/50 active:scale-[0.96] data-glass-ready:active:scale-100 motion-reduce:transition-none sm:size-12")} > @@ -210,7 +210,7 @@ export function MobilMenu({