gong-code 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/dist/SKILL-22jccbka.md +1 -0
- package/dist/chunk-01wdn84e.js +8 -0
- package/dist/chunk-04bc74vz.js +243 -0
- package/dist/chunk-05t2vqsb.js +490 -0
- package/dist/chunk-0727wret.js +159 -0
- package/dist/chunk-07rervty.js +200 -0
- package/dist/chunk-0b9nxvyg.js +478 -0
- package/dist/chunk-0e428b73.js +600 -0
- package/dist/chunk-0hqfheht.js +3439 -0
- package/dist/chunk-0pnk52c2.js +116 -0
- package/dist/chunk-0sbddf6m.js +68 -0
- package/dist/chunk-0vf7xb84.js +176 -0
- package/dist/chunk-0yz17yjy.js +1061 -0
- package/dist/chunk-0zscb6c7.js +10 -0
- package/dist/chunk-10p21kq6.js +378 -0
- package/dist/chunk-17k78pmz.js +120 -0
- package/dist/chunk-19jvvqzp.js +1390 -0
- package/dist/chunk-1d5czqnr.js +173 -0
- package/dist/chunk-1gjysfnf.js +13876 -0
- package/dist/chunk-1jjfv0wd.js +467 -0
- package/dist/chunk-1jjzp2pa.js +617 -0
- package/dist/chunk-1m38dj2k.js +155 -0
- package/dist/chunk-1pgttway.js +211 -0
- package/dist/chunk-1vvnx0gb.js +8035 -0
- package/dist/chunk-1ztm9yps.js +49145 -0
- package/dist/chunk-208x1t0m.js +88 -0
- package/dist/chunk-20xqs3yk.js +843 -0
- package/dist/chunk-2b2c0wnn.js +584 -0
- package/dist/chunk-2g07117j.js +541 -0
- package/dist/chunk-2g6p2t3w.js +780 -0
- package/dist/chunk-2kjeaeg7.js +28 -0
- package/dist/chunk-2n0s2dhc.js +12 -0
- package/dist/chunk-2p0hvt8k.js +785 -0
- package/dist/chunk-2qmxg9y7.js +40174 -0
- package/dist/chunk-2qpy8kne.js +28 -0
- package/dist/chunk-2rgbf62a.js +40 -0
- package/dist/chunk-2tx0s41y.js +150 -0
- package/dist/chunk-2x8zk5cz.js +101 -0
- package/dist/chunk-2yqy25z4.js +48 -0
- package/dist/chunk-318g78ty.js +552 -0
- package/dist/chunk-31gfg8tz.js +290 -0
- package/dist/chunk-32n0s532.js +1317 -0
- package/dist/chunk-35dw2r9g.js +137 -0
- package/dist/chunk-36b5zqvn.js +1865 -0
- package/dist/chunk-38kpx69j.js +97 -0
- package/dist/chunk-3b01vp8p.js +815 -0
- package/dist/chunk-3f76a1ek.js +317 -0
- package/dist/chunk-3fd1hkhh.js +4254 -0
- package/dist/chunk-3ffxa7zj.js +8 -0
- package/dist/chunk-3gcj7w95.js +8 -0
- package/dist/chunk-3jf3k40v.js +970 -0
- package/dist/chunk-3k51qfp9.js +9301 -0
- package/dist/chunk-3mhygd2v.js +1180 -0
- package/dist/chunk-3p6y0gvb.js +117 -0
- package/dist/chunk-3r60xdt5.js +93 -0
- package/dist/chunk-43agf6xv.js +8 -0
- package/dist/chunk-46zr418r.js +15 -0
- package/dist/chunk-48k2bs4w.js +118 -0
- package/dist/chunk-4p987a4z.js +84 -0
- package/dist/chunk-4px25pe0.js +776 -0
- package/dist/chunk-4s93jyky.js +113 -0
- package/dist/chunk-4xv8bedf.js +58 -0
- package/dist/chunk-4y382mzd.js +346 -0
- package/dist/chunk-52dzw4bc.js +246 -0
- package/dist/chunk-52qqmh5g.js +110 -0
- package/dist/chunk-53grnhp7.js +8 -0
- package/dist/chunk-59craaxx.js +4249 -0
- package/dist/chunk-5b833jqs.js +96 -0
- package/dist/chunk-5cp2q9sh.js +58 -0
- package/dist/chunk-5dbaxmts.js +87 -0
- package/dist/chunk-5f5sxgp0.js +96 -0
- package/dist/chunk-5mkfderj.js +195 -0
- package/dist/chunk-5qw0mpvq.js +389 -0
- package/dist/chunk-5rxmszm8.js +48 -0
- package/dist/chunk-5ygxa3hr.js +65 -0
- package/dist/chunk-61d5dqq2.js +71 -0
- package/dist/chunk-6350958y.js +272 -0
- package/dist/chunk-65z8hg8j.js +1337 -0
- package/dist/chunk-6aq85gdq.js +8 -0
- package/dist/chunk-6cjh9exg.js +40751 -0
- package/dist/chunk-6e41p5m6.js +187 -0
- package/dist/chunk-6jb6xcnq.js +10511 -0
- package/dist/chunk-6jta29r1.js +20 -0
- package/dist/chunk-6q7f2rrv.js +4757 -0
- package/dist/chunk-6sg0ec6v.js +41 -0
- package/dist/chunk-6v0rhx4e.js +328 -0
- package/dist/chunk-6x5mz95v.js +751 -0
- package/dist/chunk-6xqp51qr.js +87 -0
- package/dist/chunk-6xvyx1s9.js +6957 -0
- package/dist/chunk-6ywh7wgp.js +468 -0
- package/dist/chunk-75ne77gm.js +1920 -0
- package/dist/chunk-77cb06js.js +602 -0
- package/dist/chunk-78n9kfp8.js +1645 -0
- package/dist/chunk-7be87rww.js +277 -0
- package/dist/chunk-7e1qjk3s.js +125 -0
- package/dist/chunk-7e7nxnss.js +360 -0
- package/dist/chunk-7g8156qp.js +55 -0
- package/dist/chunk-7nz71s42.js +3353 -0
- package/dist/chunk-7r078t2x.js +113 -0
- package/dist/chunk-7shx41hj.js +3094 -0
- package/dist/chunk-7yexhdjs.js +216 -0
- package/dist/chunk-83kmfcjv.js +256 -0
- package/dist/chunk-846rr9n1.js +107 -0
- package/dist/chunk-84ncsm1r.js +183 -0
- package/dist/chunk-867x8aq0.js +8936 -0
- package/dist/chunk-8byh30kb.js +1947 -0
- package/dist/chunk-8c8f6gnt.js +432 -0
- package/dist/chunk-8gtdseev.js +454 -0
- package/dist/chunk-8jfh9rq6.js +642 -0
- package/dist/chunk-8n4n4m67.js +800 -0
- package/dist/chunk-8za61tze.js +847 -0
- package/dist/chunk-9029sbq1.js +57 -0
- package/dist/chunk-94dm5rrm.js +673 -0
- package/dist/chunk-9bs8n985.js +329 -0
- package/dist/chunk-9c23776j.js +763 -0
- package/dist/chunk-9e93g81n.js +298 -0
- package/dist/chunk-9f3d61y7.js +548 -0
- package/dist/chunk-9gc3andd.js +422 -0
- package/dist/chunk-9kn3tgpb.js +130 -0
- package/dist/chunk-9m5rn7hk.js +61 -0
- package/dist/chunk-9p4hsd6a.js +50 -0
- package/dist/chunk-9qasfk8n.js +758 -0
- package/dist/chunk-9snp5mn2.js +533 -0
- package/dist/chunk-9tcvras3.js +2331 -0
- package/dist/chunk-a0186ngk.js +57 -0
- package/dist/chunk-a2m8f0aj.js +268 -0
- package/dist/chunk-a2rcafav.js +716 -0
- package/dist/chunk-a9hjdzar.js +160 -0
- package/dist/chunk-aak6ts5n.js +526 -0
- package/dist/chunk-aca3w84n.js +267 -0
- package/dist/chunk-ae76ded0.js +30 -0
- package/dist/chunk-afnjhn3j.js +21933 -0
- package/dist/chunk-ahj70tf0.js +880 -0
- package/dist/chunk-apjsxssq.js +169 -0
- package/dist/chunk-av49wjj1.js +43 -0
- package/dist/chunk-axggebfy.js +206 -0
- package/dist/chunk-az7jpbv8.js +16 -0
- package/dist/chunk-azz7sep6.js +328 -0
- package/dist/chunk-b4tpz2g1.js +93 -0
- package/dist/chunk-bczf2eyq.js +115 -0
- package/dist/chunk-bd95f637.js +208 -0
- package/dist/chunk-bdhdmkya.js +10 -0
- package/dist/chunk-bp0ynk17.js +32 -0
- package/dist/chunk-bq75gxjs.js +90 -0
- package/dist/chunk-btk5jaq6.js +10464 -0
- package/dist/chunk-bv4c48a5.js +120 -0
- package/dist/chunk-byfb105n.js +341 -0
- package/dist/chunk-c0bdmy7w.js +4223 -0
- package/dist/chunk-c20aqkz8.js +641 -0
- package/dist/chunk-c4jg3s2c.js +163 -0
- package/dist/chunk-c61q5cer.js +258 -0
- package/dist/chunk-c9f761sy.js +386 -0
- package/dist/chunk-ca6jkz06.js +157 -0
- package/dist/chunk-ccyg9ap9.js +171374 -0
- package/dist/chunk-cfej8cc7.js +371 -0
- package/dist/chunk-cjqxdnf9.js +23 -0
- package/dist/chunk-ckrs789w.js +8 -0
- package/dist/chunk-cqeq13wg.js +48 -0
- package/dist/chunk-crfj3w5e.js +22821 -0
- package/dist/chunk-ct5x6z7g.js +8066 -0
- package/dist/chunk-cv5h8n8c.js +101 -0
- package/dist/chunk-cwe8h159.js +1563 -0
- package/dist/chunk-cwm234zz.js +908 -0
- package/dist/chunk-d1jkfp45.js +1580 -0
- package/dist/chunk-d3hb1qdr.js +126 -0
- package/dist/chunk-d70d0zer.js +713 -0
- package/dist/chunk-d91tx29f.js +105 -0
- package/dist/chunk-d952pymh.js +20 -0
- package/dist/chunk-d9af3z8k.js +720 -0
- package/dist/chunk-da1n53c2.js +47 -0
- package/dist/chunk-df5c1x8m.js +732 -0
- package/dist/chunk-dkv64xys.js +71 -0
- package/dist/chunk-dm7166v6.js +251 -0
- package/dist/chunk-dr0y5a61.js +258 -0
- package/dist/chunk-drzb0rrd.js +306 -0
- package/dist/chunk-dw1v1q7w.js +37 -0
- package/dist/chunk-e224qet4.js +348 -0
- package/dist/chunk-e50ckbv0.js +1099 -0
- package/dist/chunk-e5gn6by6.js +1165 -0
- package/dist/chunk-e7m3f74m.js +37 -0
- package/dist/chunk-e8ghgwaj.js +295 -0
- package/dist/chunk-ed8k4ya2.js +41 -0
- package/dist/chunk-eh0vnqdz.js +76 -0
- package/dist/chunk-epwrzr35.js +4301 -0
- package/dist/chunk-er9h6sw5.js +5379 -0
- package/dist/chunk-eta5aekm.js +79 -0
- package/dist/chunk-ev5gxscq.js +63 -0
- package/dist/chunk-evp72hv5.js +212 -0
- package/dist/chunk-ex41stfq.js +127 -0
- package/dist/chunk-ezpa510h.js +62 -0
- package/dist/chunk-f0fm6dey.js +477 -0
- package/dist/chunk-f239sbhc.js +152 -0
- package/dist/chunk-f2bj47xf.js +109 -0
- package/dist/chunk-f4t24rq4.js +258 -0
- package/dist/chunk-f9ghvzy8.js +106 -0
- package/dist/chunk-f9rahzgr.js +99 -0
- package/dist/chunk-ff75qzty.js +521 -0
- package/dist/chunk-fj0ctt6q.js +264 -0
- package/dist/chunk-fj7wxdt3.js +221 -0
- package/dist/chunk-fnnpqv92.js +714 -0
- package/dist/chunk-fpd3zzx1.js +26696 -0
- package/dist/chunk-fqv2cn76.js +227 -0
- package/dist/chunk-fqw9j3bj.js +439 -0
- package/dist/chunk-frbcqhz0.js +4984 -0
- package/dist/chunk-fzkj59sg.js +174 -0
- package/dist/chunk-fzpzbpbw.js +248 -0
- package/dist/chunk-g52cpmd1.js +686 -0
- package/dist/chunk-g98m2qe6.js +31 -0
- package/dist/chunk-g9zgq4vy.js +715 -0
- package/dist/chunk-gbpt7tm8.js +687 -0
- package/dist/chunk-gg52jka8.js +373 -0
- package/dist/chunk-gjttphax.js +5793 -0
- package/dist/chunk-gs7vjaas.js +65 -0
- package/dist/chunk-gv8n85j2.js +8 -0
- package/dist/chunk-gxdwm6pt.js +650 -0
- package/dist/chunk-gy8wajg2.js +1014 -0
- package/dist/chunk-gz3647m0.js +200 -0
- package/dist/chunk-gzg07mqh.js +16 -0
- package/dist/chunk-h3zc60tq.js +44 -0
- package/dist/chunk-h4p1qt16.js +74 -0
- package/dist/chunk-h8219f18.js +282 -0
- package/dist/chunk-h9agq92v.js +331 -0
- package/dist/chunk-hhjtpwbj.js +16 -0
- package/dist/chunk-hpgpwzra.js +548 -0
- package/dist/chunk-hsnjvn19.js +80 -0
- package/dist/chunk-hsp9qrry.js +417 -0
- package/dist/chunk-hwz6aq2m.js +3939 -0
- package/dist/chunk-hzph0hbh.js +272 -0
- package/dist/chunk-hzqkss6v.js +153 -0
- package/dist/chunk-j0t31f39.js +1149 -0
- package/dist/chunk-j1qm6n1v.js +30 -0
- package/dist/chunk-j6e4b522.js +81 -0
- package/dist/chunk-j7qfbvxk.js +84 -0
- package/dist/chunk-j7qv3hvm.js +1635 -0
- package/dist/chunk-j8mxc6k6.js +213 -0
- package/dist/chunk-jevj87jn.js +224 -0
- package/dist/chunk-jk2ps88q.js +815 -0
- package/dist/chunk-jz7tbdyv.js +1599 -0
- package/dist/chunk-k36jpjvh.js +300 -0
- package/dist/chunk-k4nmrt3w.js +61 -0
- package/dist/chunk-kavn03r9.js +16606 -0
- package/dist/chunk-kkgav8dm.js +54 -0
- package/dist/chunk-kkq26g5c.js +33 -0
- package/dist/chunk-kp6nepx4.js +106 -0
- package/dist/chunk-ksefybc8.js +1551 -0
- package/dist/chunk-kv147680.js +3436 -0
- package/dist/chunk-kya46axt.js +833 -0
- package/dist/chunk-kyz233ny.js +227 -0
- package/dist/chunk-kzs75xmj.js +143 -0
- package/dist/chunk-m0vrez9w.js +266 -0
- package/dist/chunk-m1wadav3.js +118 -0
- package/dist/chunk-m4rfx3cj.js +221 -0
- package/dist/chunk-mc9zaggs.js +6374 -0
- package/dist/chunk-mcg5ttj4.js +105 -0
- package/dist/chunk-mf4r7918.js +63 -0
- package/dist/chunk-mh9khrt4.js +286 -0
- package/dist/chunk-mhc4szw7.js +22 -0
- package/dist/chunk-mkq0yzp0.js +38 -0
- package/dist/chunk-mr58jv4w.js +256 -0
- package/dist/chunk-mrrx3bmt.js +168 -0
- package/dist/chunk-mtyk3zz6.js +87 -0
- package/dist/chunk-mvgxntv6.js +62 -0
- package/dist/chunk-mwnjydcm.js +102 -0
- package/dist/chunk-mwxt0m3f.js +862 -0
- package/dist/chunk-mz1pxck8.js +998 -0
- package/dist/chunk-n3agghys.js +214 -0
- package/dist/chunk-n6q02ya9.js +442 -0
- package/dist/chunk-nt3y91vh.js +443 -0
- package/dist/chunk-nt837qt9.js +21 -0
- package/dist/chunk-ntgmegfs.js +39 -0
- package/dist/chunk-nwk16bbd.js +30 -0
- package/dist/chunk-p367ay90.js +672 -0
- package/dist/chunk-p7m3x9qk.js +48 -0
- package/dist/chunk-pagmjwp5.js +132 -0
- package/dist/chunk-pbd4r8ek.js +161 -0
- package/dist/chunk-pdkpssgv.js +2422 -0
- package/dist/chunk-pf6z1e35.js +32 -0
- package/dist/chunk-pfzejvpt.js +213 -0
- package/dist/chunk-pktxyhvk.js +400 -0
- package/dist/chunk-pp5xhveq.js +124 -0
- package/dist/chunk-ppnd7a8x.js +38 -0
- package/dist/chunk-pqh2w7dr.js +2202 -0
- package/dist/chunk-pr878d0z.js +240 -0
- package/dist/chunk-psf0y7hy.js +140 -0
- package/dist/chunk-pz2zz2f7.js +1586 -0
- package/dist/chunk-q0xkrxy8.js +890 -0
- package/dist/chunk-q5b0kpr3.js +14369 -0
- package/dist/chunk-q7z3t531.js +334 -0
- package/dist/chunk-qdjjtgwt.js +3183 -0
- package/dist/chunk-qezv7msv.js +26 -0
- package/dist/chunk-qmxn7f86.js +2643 -0
- package/dist/chunk-qqc3b97c.js +15 -0
- package/dist/chunk-qwrp63wh.js +145 -0
- package/dist/chunk-qyvqbst3.js +537 -0
- package/dist/chunk-qztvd4hd.js +465 -0
- package/dist/chunk-r0bvez4y.js +235 -0
- package/dist/chunk-r3z0896k.js +2831 -0
- package/dist/chunk-r4cxb6t7.js +32 -0
- package/dist/chunk-rb8k68m7.js +118 -0
- package/dist/chunk-rdprgm4t.js +42 -0
- package/dist/chunk-rex82hys.js +1710 -0
- package/dist/chunk-rjjakkw2.js +2560 -0
- package/dist/chunk-rka6gcv3.js +304 -0
- package/dist/chunk-rkz12ghm.js +144 -0
- package/dist/chunk-rnc7m1qs.js +436 -0
- package/dist/chunk-rx6z23h0.js +165 -0
- package/dist/chunk-s76582j1.js +28 -0
- package/dist/chunk-sez03qd9.js +7140 -0
- package/dist/chunk-sjvdn2ep.js +130 -0
- package/dist/chunk-smwhyy8p.js +115 -0
- package/dist/chunk-snw7nh0d.js +695 -0
- package/dist/chunk-sqx9c057.js +193 -0
- package/dist/chunk-sscms68s.js +16 -0
- package/dist/chunk-stknnmsb.js +272 -0
- package/dist/chunk-sywdxbs6.js +853 -0
- package/dist/chunk-syxy4pf2.js +782 -0
- package/dist/chunk-t0hpqsqn.js +6157 -0
- package/dist/chunk-tjm70vnw.js +123 -0
- package/dist/chunk-trzh0msn.js +154 -0
- package/dist/chunk-v1z17cpg.js +723 -0
- package/dist/chunk-vsfj449x.js +333 -0
- package/dist/chunk-vvkq20tt.js +287 -0
- package/dist/chunk-vxgdzx6p.js +338 -0
- package/dist/chunk-vxqhjyfz.js +15 -0
- package/dist/chunk-vzsstfmb.js +80 -0
- package/dist/chunk-w1jew5sn.js +69 -0
- package/dist/chunk-w3kwr76v.js +789 -0
- package/dist/chunk-w40netr9.js +59 -0
- package/dist/chunk-w99cpfdg.js +559 -0
- package/dist/chunk-wacn14d2.js +271 -0
- package/dist/chunk-wbhrqrq3.js +3033 -0
- package/dist/chunk-wfg9g0p7.js +17612 -0
- package/dist/chunk-wj3vjsbx.js +93 -0
- package/dist/chunk-wjhq855a.js +372 -0
- package/dist/chunk-wr06gqxh.js +114 -0
- package/dist/chunk-ws0z2y1g.js +195 -0
- package/dist/chunk-wt62wqcj.js +98 -0
- package/dist/chunk-wx4v7ddx.js +42 -0
- package/dist/chunk-wy0t3vb2.js +6101 -0
- package/dist/chunk-wysz7qk4.js +280 -0
- package/dist/chunk-x63fx1vd.js +192 -0
- package/dist/chunk-x8b7vft8.js +132 -0
- package/dist/chunk-x8jhkgxb.js +346 -0
- package/dist/chunk-x9z4q5k5.js +275 -0
- package/dist/chunk-xjd7e9jq.js +126 -0
- package/dist/chunk-xjr0n27e.js +42 -0
- package/dist/chunk-xpwyw7cd.js +24 -0
- package/dist/chunk-xw4ycnyz.js +37 -0
- package/dist/chunk-y66bqywr.js +17303 -0
- package/dist/chunk-ycarry7d.js +157 -0
- package/dist/chunk-ycr0hp6v.js +1486 -0
- package/dist/chunk-yqmaw6hf.js +496 -0
- package/dist/chunk-yrtm7d23.js +602 -0
- package/dist/chunk-yts879rw.js +48 -0
- package/dist/chunk-yvmhx96e.js +347 -0
- package/dist/chunk-ywq00rg4.js +246 -0
- package/dist/chunk-yygeg5mj.js +752 -0
- package/dist/chunk-z0exw850.js +726 -0
- package/dist/chunk-z2dp53wn.js +17 -0
- package/dist/chunk-z4rzc9nd.js +103 -0
- package/dist/chunk-zb0akt77.js +684 -0
- package/dist/chunk-zb2xrj5t.js +1789 -0
- package/dist/chunk-zbptn0ky.js +423 -0
- package/dist/chunk-zd45wbmf.js +1090 -0
- package/dist/chunk-zjkvspz9.js +2050 -0
- package/dist/chunk-zke1sp3x.js +1524 -0
- package/dist/chunk-zv2cvfsv.js +58 -0
- package/dist/chunk-zy4tmqst.js +644 -0
- package/dist/chunk-zygzzzvk.js +192 -0
- package/dist/cli-21v3v6ny.md +1 -0
- package/dist/cli.js +246 -0
- package/dist/server-n5f2q89z.md +1 -0
- package/package.json +161 -0
|
@@ -0,0 +1,800 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
require_jsx_dev_runtime,
|
|
4
|
+
require_react
|
|
5
|
+
} from "./chunk-0yz17yjy.js";
|
|
6
|
+
import {
|
|
7
|
+
__esm,
|
|
8
|
+
__toESM
|
|
9
|
+
} from "./chunk-eta5aekm.js";
|
|
10
|
+
import {
|
|
11
|
+
__INVALID__REF__
|
|
12
|
+
} from "./chunk-ccyg9ap9.js";
|
|
13
|
+
import {
|
|
14
|
+
Ansi,
|
|
15
|
+
TerminalSizeContext,
|
|
16
|
+
ThemedBox_default,
|
|
17
|
+
ThemedText,
|
|
18
|
+
init_TerminalSizeContext,
|
|
19
|
+
init_ink,
|
|
20
|
+
require_compiler_runtime,
|
|
21
|
+
use_input_default
|
|
22
|
+
} from "./chunk-fpd3zzx1.js";
|
|
23
|
+
import {
|
|
24
|
+
init_stringWidth,
|
|
25
|
+
stringWidth
|
|
26
|
+
} from "./chunk-df5c1x8m.js";
|
|
27
|
+
|
|
28
|
+
// src/hooks/useTerminalSize.ts
|
|
29
|
+
function useTerminalSize() {
|
|
30
|
+
const size = import_react.useContext(TerminalSizeContext);
|
|
31
|
+
if (!size) {
|
|
32
|
+
throw new Error("useTerminalSize must be used within an Ink App component");
|
|
33
|
+
}
|
|
34
|
+
return size;
|
|
35
|
+
}
|
|
36
|
+
var import_react;
|
|
37
|
+
var init_useTerminalSize = __esm(() => {
|
|
38
|
+
init_TerminalSizeContext();
|
|
39
|
+
import_react = __toESM(require_react(), 1);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// src/keybindings/match.ts
|
|
43
|
+
function getKeyName(input, key) {
|
|
44
|
+
if (key.escape)
|
|
45
|
+
return "escape";
|
|
46
|
+
if (key.return)
|
|
47
|
+
return "enter";
|
|
48
|
+
if (key.tab)
|
|
49
|
+
return "tab";
|
|
50
|
+
if (key.backspace)
|
|
51
|
+
return "backspace";
|
|
52
|
+
if (key.delete)
|
|
53
|
+
return "delete";
|
|
54
|
+
if (key.upArrow)
|
|
55
|
+
return "up";
|
|
56
|
+
if (key.downArrow)
|
|
57
|
+
return "down";
|
|
58
|
+
if (key.leftArrow)
|
|
59
|
+
return "left";
|
|
60
|
+
if (key.rightArrow)
|
|
61
|
+
return "right";
|
|
62
|
+
if (key.pageUp)
|
|
63
|
+
return "pageup";
|
|
64
|
+
if (key.pageDown)
|
|
65
|
+
return "pagedown";
|
|
66
|
+
if (key.wheelUp)
|
|
67
|
+
return "wheelup";
|
|
68
|
+
if (key.wheelDown)
|
|
69
|
+
return "wheeldown";
|
|
70
|
+
if (key.home)
|
|
71
|
+
return "home";
|
|
72
|
+
if (key.end)
|
|
73
|
+
return "end";
|
|
74
|
+
if (input.length === 1)
|
|
75
|
+
return input.toLowerCase();
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// src/keybindings/parser.ts
|
|
80
|
+
function parseKeystroke(input) {
|
|
81
|
+
const parts = input.split("+");
|
|
82
|
+
const keystroke = {
|
|
83
|
+
key: "",
|
|
84
|
+
ctrl: false,
|
|
85
|
+
alt: false,
|
|
86
|
+
shift: false,
|
|
87
|
+
meta: false,
|
|
88
|
+
super: false
|
|
89
|
+
};
|
|
90
|
+
for (const part of parts) {
|
|
91
|
+
const lower = part.toLowerCase();
|
|
92
|
+
switch (lower) {
|
|
93
|
+
case "ctrl":
|
|
94
|
+
case "control":
|
|
95
|
+
keystroke.ctrl = true;
|
|
96
|
+
break;
|
|
97
|
+
case "alt":
|
|
98
|
+
case "opt":
|
|
99
|
+
case "option":
|
|
100
|
+
keystroke.alt = true;
|
|
101
|
+
break;
|
|
102
|
+
case "shift":
|
|
103
|
+
keystroke.shift = true;
|
|
104
|
+
break;
|
|
105
|
+
case "meta":
|
|
106
|
+
keystroke.meta = true;
|
|
107
|
+
break;
|
|
108
|
+
case "cmd":
|
|
109
|
+
case "command":
|
|
110
|
+
case "super":
|
|
111
|
+
case "win":
|
|
112
|
+
keystroke.super = true;
|
|
113
|
+
break;
|
|
114
|
+
case "esc":
|
|
115
|
+
keystroke.key = "escape";
|
|
116
|
+
break;
|
|
117
|
+
case "return":
|
|
118
|
+
keystroke.key = "enter";
|
|
119
|
+
break;
|
|
120
|
+
case "space":
|
|
121
|
+
keystroke.key = " ";
|
|
122
|
+
break;
|
|
123
|
+
case "\u2191":
|
|
124
|
+
keystroke.key = "up";
|
|
125
|
+
break;
|
|
126
|
+
case "\u2193":
|
|
127
|
+
keystroke.key = "down";
|
|
128
|
+
break;
|
|
129
|
+
case "\u2190":
|
|
130
|
+
keystroke.key = "left";
|
|
131
|
+
break;
|
|
132
|
+
case "\u2192":
|
|
133
|
+
keystroke.key = "right";
|
|
134
|
+
break;
|
|
135
|
+
default:
|
|
136
|
+
keystroke.key = lower;
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return keystroke;
|
|
141
|
+
}
|
|
142
|
+
function parseChord(input) {
|
|
143
|
+
if (input === " ")
|
|
144
|
+
return [parseKeystroke("space")];
|
|
145
|
+
return input.trim().split(/\s+/).map(parseKeystroke);
|
|
146
|
+
}
|
|
147
|
+
function keystrokeToString(ks) {
|
|
148
|
+
const parts = [];
|
|
149
|
+
if (ks.ctrl)
|
|
150
|
+
parts.push("ctrl");
|
|
151
|
+
if (ks.alt)
|
|
152
|
+
parts.push("alt");
|
|
153
|
+
if (ks.shift)
|
|
154
|
+
parts.push("shift");
|
|
155
|
+
if (ks.meta)
|
|
156
|
+
parts.push("meta");
|
|
157
|
+
if (ks.super)
|
|
158
|
+
parts.push("cmd");
|
|
159
|
+
const displayKey = keyToDisplayName(ks.key);
|
|
160
|
+
parts.push(displayKey);
|
|
161
|
+
return parts.join("+");
|
|
162
|
+
}
|
|
163
|
+
function keyToDisplayName(key) {
|
|
164
|
+
switch (key) {
|
|
165
|
+
case "escape":
|
|
166
|
+
return "Esc";
|
|
167
|
+
case " ":
|
|
168
|
+
return "Space";
|
|
169
|
+
case "tab":
|
|
170
|
+
return "tab";
|
|
171
|
+
case "enter":
|
|
172
|
+
return "Enter";
|
|
173
|
+
case "backspace":
|
|
174
|
+
return "Backspace";
|
|
175
|
+
case "delete":
|
|
176
|
+
return "Delete";
|
|
177
|
+
case "up":
|
|
178
|
+
return "\u2191";
|
|
179
|
+
case "down":
|
|
180
|
+
return "\u2193";
|
|
181
|
+
case "left":
|
|
182
|
+
return "\u2190";
|
|
183
|
+
case "right":
|
|
184
|
+
return "\u2192";
|
|
185
|
+
case "pageup":
|
|
186
|
+
return "PageUp";
|
|
187
|
+
case "pagedown":
|
|
188
|
+
return "PageDown";
|
|
189
|
+
case "home":
|
|
190
|
+
return "Home";
|
|
191
|
+
case "end":
|
|
192
|
+
return "End";
|
|
193
|
+
default:
|
|
194
|
+
return key;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function chordToString(chord) {
|
|
198
|
+
return chord.map(keystrokeToString).join(" ");
|
|
199
|
+
}
|
|
200
|
+
function parseBindings(blocks) {
|
|
201
|
+
const bindings = [];
|
|
202
|
+
for (const block of blocks) {
|
|
203
|
+
for (const [key, action] of Object.entries(block.bindings)) {
|
|
204
|
+
bindings.push({
|
|
205
|
+
chord: parseChord(key),
|
|
206
|
+
action,
|
|
207
|
+
context: block.context
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return bindings;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// src/keybindings/resolver.ts
|
|
215
|
+
function getBindingDisplayText(action, context, bindings) {
|
|
216
|
+
const binding = bindings.findLast((b) => b.action === action && b.context === context);
|
|
217
|
+
return binding ? chordToString(binding.chord) : undefined;
|
|
218
|
+
}
|
|
219
|
+
function buildKeystroke(input, key) {
|
|
220
|
+
const keyName = getKeyName(input, key);
|
|
221
|
+
if (!keyName)
|
|
222
|
+
return null;
|
|
223
|
+
const effectiveMeta = key.escape ? false : key.meta;
|
|
224
|
+
return {
|
|
225
|
+
key: keyName,
|
|
226
|
+
ctrl: key.ctrl,
|
|
227
|
+
alt: effectiveMeta,
|
|
228
|
+
shift: key.shift,
|
|
229
|
+
meta: effectiveMeta,
|
|
230
|
+
super: key.super
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
function keystrokesEqual(a, b) {
|
|
234
|
+
return a.key === b.key && a.ctrl === b.ctrl && a.shift === b.shift && (a.alt || a.meta) === (b.alt || b.meta) && a.super === b.super;
|
|
235
|
+
}
|
|
236
|
+
function chordPrefixMatches(prefix, binding) {
|
|
237
|
+
if (prefix.length >= binding.chord.length)
|
|
238
|
+
return false;
|
|
239
|
+
for (let i = 0;i < prefix.length; i++) {
|
|
240
|
+
const prefixKey = prefix[i];
|
|
241
|
+
const bindingKey = binding.chord[i];
|
|
242
|
+
if (!prefixKey || !bindingKey)
|
|
243
|
+
return false;
|
|
244
|
+
if (!keystrokesEqual(prefixKey, bindingKey))
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
return true;
|
|
248
|
+
}
|
|
249
|
+
function chordExactlyMatches(chord, binding) {
|
|
250
|
+
if (chord.length !== binding.chord.length)
|
|
251
|
+
return false;
|
|
252
|
+
for (let i = 0;i < chord.length; i++) {
|
|
253
|
+
const chordKey = chord[i];
|
|
254
|
+
const bindingKey = binding.chord[i];
|
|
255
|
+
if (!chordKey || !bindingKey)
|
|
256
|
+
return false;
|
|
257
|
+
if (!keystrokesEqual(chordKey, bindingKey))
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
function resolveKeyWithChordState(input, key, activeContexts, bindings, pending) {
|
|
263
|
+
if (key.escape && pending !== null) {
|
|
264
|
+
return { type: "chord_cancelled" };
|
|
265
|
+
}
|
|
266
|
+
const currentKeystroke = buildKeystroke(input, key);
|
|
267
|
+
if (!currentKeystroke) {
|
|
268
|
+
if (pending !== null) {
|
|
269
|
+
return { type: "chord_cancelled" };
|
|
270
|
+
}
|
|
271
|
+
return { type: "none" };
|
|
272
|
+
}
|
|
273
|
+
const testChord = pending ? [...pending, currentKeystroke] : [currentKeystroke];
|
|
274
|
+
const ctxSet = new Set(activeContexts);
|
|
275
|
+
const contextBindings = bindings.filter((b) => ctxSet.has(b.context));
|
|
276
|
+
const chordWinners = new Map;
|
|
277
|
+
for (const binding of contextBindings) {
|
|
278
|
+
if (binding.chord.length > testChord.length && chordPrefixMatches(testChord, binding)) {
|
|
279
|
+
chordWinners.set(chordToString(binding.chord), binding.action);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
let hasLongerChords = false;
|
|
283
|
+
for (const action of chordWinners.values()) {
|
|
284
|
+
if (action !== null) {
|
|
285
|
+
hasLongerChords = true;
|
|
286
|
+
break;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
if (hasLongerChords) {
|
|
290
|
+
return { type: "chord_started", pending: testChord };
|
|
291
|
+
}
|
|
292
|
+
let exactMatch;
|
|
293
|
+
for (const binding of contextBindings) {
|
|
294
|
+
if (chordExactlyMatches(testChord, binding)) {
|
|
295
|
+
exactMatch = binding;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (exactMatch) {
|
|
299
|
+
if (exactMatch.action === null) {
|
|
300
|
+
return { type: "unbound" };
|
|
301
|
+
}
|
|
302
|
+
return { type: "match", action: exactMatch.action };
|
|
303
|
+
}
|
|
304
|
+
if (pending !== null) {
|
|
305
|
+
return { type: "chord_cancelled" };
|
|
306
|
+
}
|
|
307
|
+
return { type: "none" };
|
|
308
|
+
}
|
|
309
|
+
var init_resolver = () => {};
|
|
310
|
+
|
|
311
|
+
// src/keybindings/KeybindingContext.tsx
|
|
312
|
+
function KeybindingProvider(t0) {
|
|
313
|
+
const $ = import_compiler_runtime.c(24);
|
|
314
|
+
const {
|
|
315
|
+
bindings,
|
|
316
|
+
pendingChordRef,
|
|
317
|
+
pendingChord,
|
|
318
|
+
setPendingChord,
|
|
319
|
+
activeContexts,
|
|
320
|
+
registerActiveContext,
|
|
321
|
+
unregisterActiveContext,
|
|
322
|
+
handlerRegistryRef,
|
|
323
|
+
children
|
|
324
|
+
} = t0;
|
|
325
|
+
let t1;
|
|
326
|
+
if ($[0] !== bindings) {
|
|
327
|
+
t1 = (action, context) => getBindingDisplayText(action, context, bindings);
|
|
328
|
+
$[0] = bindings;
|
|
329
|
+
$[1] = t1;
|
|
330
|
+
} else {
|
|
331
|
+
t1 = $[1];
|
|
332
|
+
}
|
|
333
|
+
const getDisplay = t1;
|
|
334
|
+
let t2;
|
|
335
|
+
if ($[2] !== handlerRegistryRef) {
|
|
336
|
+
t2 = (registration) => {
|
|
337
|
+
const registry = handlerRegistryRef.current;
|
|
338
|
+
if (!registry) {
|
|
339
|
+
return _temp;
|
|
340
|
+
}
|
|
341
|
+
if (!registry.has(registration.action)) {
|
|
342
|
+
registry.set(registration.action, new Set);
|
|
343
|
+
}
|
|
344
|
+
registry.get(registration.action).add(registration);
|
|
345
|
+
return () => {
|
|
346
|
+
const handlers = registry.get(registration.action);
|
|
347
|
+
if (handlers) {
|
|
348
|
+
handlers.delete(registration);
|
|
349
|
+
if (handlers.size === 0) {
|
|
350
|
+
registry.delete(registration.action);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
};
|
|
355
|
+
$[2] = handlerRegistryRef;
|
|
356
|
+
$[3] = t2;
|
|
357
|
+
} else {
|
|
358
|
+
t2 = $[3];
|
|
359
|
+
}
|
|
360
|
+
const registerHandler = t2;
|
|
361
|
+
let t3;
|
|
362
|
+
if ($[4] !== activeContexts || $[5] !== handlerRegistryRef) {
|
|
363
|
+
t3 = (action_0) => {
|
|
364
|
+
const registry_0 = handlerRegistryRef.current;
|
|
365
|
+
if (!registry_0) {
|
|
366
|
+
return false;
|
|
367
|
+
}
|
|
368
|
+
const handlers_0 = registry_0.get(action_0);
|
|
369
|
+
if (!handlers_0 || handlers_0.size === 0) {
|
|
370
|
+
return false;
|
|
371
|
+
}
|
|
372
|
+
for (const registration_0 of handlers_0) {
|
|
373
|
+
if (activeContexts.has(registration_0.context)) {
|
|
374
|
+
registration_0.handler();
|
|
375
|
+
return true;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
return false;
|
|
379
|
+
};
|
|
380
|
+
$[4] = activeContexts;
|
|
381
|
+
$[5] = handlerRegistryRef;
|
|
382
|
+
$[6] = t3;
|
|
383
|
+
} else {
|
|
384
|
+
t3 = $[6];
|
|
385
|
+
}
|
|
386
|
+
const invokeAction = t3;
|
|
387
|
+
let t4;
|
|
388
|
+
if ($[7] !== bindings || $[8] !== pendingChordRef) {
|
|
389
|
+
t4 = (input, key, contexts) => resolveKeyWithChordState(input, key, contexts, bindings, pendingChordRef.current);
|
|
390
|
+
$[7] = bindings;
|
|
391
|
+
$[8] = pendingChordRef;
|
|
392
|
+
$[9] = t4;
|
|
393
|
+
} else {
|
|
394
|
+
t4 = $[9];
|
|
395
|
+
}
|
|
396
|
+
let t5;
|
|
397
|
+
if ($[10] !== activeContexts || $[11] !== bindings || $[12] !== getDisplay || $[13] !== invokeAction || $[14] !== pendingChord || $[15] !== registerActiveContext || $[16] !== registerHandler || $[17] !== setPendingChord || $[18] !== t4 || $[19] !== unregisterActiveContext) {
|
|
398
|
+
t5 = {
|
|
399
|
+
resolve: t4,
|
|
400
|
+
setPendingChord,
|
|
401
|
+
getDisplayText: getDisplay,
|
|
402
|
+
bindings,
|
|
403
|
+
pendingChord,
|
|
404
|
+
activeContexts,
|
|
405
|
+
registerActiveContext,
|
|
406
|
+
unregisterActiveContext,
|
|
407
|
+
registerHandler,
|
|
408
|
+
invokeAction
|
|
409
|
+
};
|
|
410
|
+
$[10] = activeContexts;
|
|
411
|
+
$[11] = bindings;
|
|
412
|
+
$[12] = getDisplay;
|
|
413
|
+
$[13] = invokeAction;
|
|
414
|
+
$[14] = pendingChord;
|
|
415
|
+
$[15] = registerActiveContext;
|
|
416
|
+
$[16] = registerHandler;
|
|
417
|
+
$[17] = setPendingChord;
|
|
418
|
+
$[18] = t4;
|
|
419
|
+
$[19] = unregisterActiveContext;
|
|
420
|
+
$[20] = t5;
|
|
421
|
+
} else {
|
|
422
|
+
t5 = $[20];
|
|
423
|
+
}
|
|
424
|
+
const value = t5;
|
|
425
|
+
let t6;
|
|
426
|
+
if ($[21] !== children || $[22] !== value) {
|
|
427
|
+
t6 = /* @__PURE__ */ jsx_dev_runtime.jsxDEV(KeybindingContext.Provider, {
|
|
428
|
+
value,
|
|
429
|
+
children
|
|
430
|
+
}, undefined, false, undefined, this);
|
|
431
|
+
$[21] = children;
|
|
432
|
+
$[22] = value;
|
|
433
|
+
$[23] = t6;
|
|
434
|
+
} else {
|
|
435
|
+
t6 = $[23];
|
|
436
|
+
}
|
|
437
|
+
return t6;
|
|
438
|
+
}
|
|
439
|
+
function _temp() {}
|
|
440
|
+
function useOptionalKeybindingContext() {
|
|
441
|
+
return import_react2.useContext(KeybindingContext);
|
|
442
|
+
}
|
|
443
|
+
function useRegisterKeybindingContext(context, t0) {
|
|
444
|
+
const $ = import_compiler_runtime.c(5);
|
|
445
|
+
const isActive = t0 === undefined ? true : t0;
|
|
446
|
+
const keybindingContext = useOptionalKeybindingContext();
|
|
447
|
+
let t1;
|
|
448
|
+
let t2;
|
|
449
|
+
if ($[0] !== context || $[1] !== isActive || $[2] !== keybindingContext) {
|
|
450
|
+
t1 = () => {
|
|
451
|
+
if (!keybindingContext || !isActive) {
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
keybindingContext.registerActiveContext(context);
|
|
455
|
+
return () => {
|
|
456
|
+
keybindingContext.unregisterActiveContext(context);
|
|
457
|
+
};
|
|
458
|
+
};
|
|
459
|
+
t2 = [context, keybindingContext, isActive];
|
|
460
|
+
$[0] = context;
|
|
461
|
+
$[1] = isActive;
|
|
462
|
+
$[2] = keybindingContext;
|
|
463
|
+
$[3] = t1;
|
|
464
|
+
$[4] = t2;
|
|
465
|
+
} else {
|
|
466
|
+
t1 = $[3];
|
|
467
|
+
t2 = $[4];
|
|
468
|
+
}
|
|
469
|
+
import_react2.useLayoutEffect(t1, t2);
|
|
470
|
+
}
|
|
471
|
+
var import_compiler_runtime, import_react2, jsx_dev_runtime, KeybindingContext;
|
|
472
|
+
var init_KeybindingContext = __esm(() => {
|
|
473
|
+
init_resolver();
|
|
474
|
+
import_compiler_runtime = __toESM(require_compiler_runtime(), 1);
|
|
475
|
+
import_react2 = __toESM(require_react(), 1);
|
|
476
|
+
jsx_dev_runtime = __toESM(require_jsx_dev_runtime(), 1);
|
|
477
|
+
KeybindingContext = import_react2.createContext(null);
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
// src/keybindings/useKeybinding.ts
|
|
481
|
+
function useKeybinding(action, handler, options = {}) {
|
|
482
|
+
const { context = "Global", isActive = true } = options;
|
|
483
|
+
const keybindingContext = useOptionalKeybindingContext();
|
|
484
|
+
import_react3.useEffect(() => {
|
|
485
|
+
if (!keybindingContext || !isActive)
|
|
486
|
+
return;
|
|
487
|
+
return keybindingContext.registerHandler({ action, context, handler });
|
|
488
|
+
}, [action, context, handler, keybindingContext, isActive]);
|
|
489
|
+
const handleInput = import_react3.useCallback((input, key, event) => {
|
|
490
|
+
if (!keybindingContext)
|
|
491
|
+
return;
|
|
492
|
+
const contextsToCheck = [
|
|
493
|
+
...keybindingContext.activeContexts,
|
|
494
|
+
context,
|
|
495
|
+
"Global"
|
|
496
|
+
];
|
|
497
|
+
const uniqueContexts = [...new Set(contextsToCheck)];
|
|
498
|
+
const result = keybindingContext.resolve(input, key, uniqueContexts);
|
|
499
|
+
switch (result.type) {
|
|
500
|
+
case "match":
|
|
501
|
+
keybindingContext.setPendingChord(null);
|
|
502
|
+
if (result.action === action) {
|
|
503
|
+
if (handler() !== false) {
|
|
504
|
+
event.stopImmediatePropagation();
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
break;
|
|
508
|
+
case "chord_started":
|
|
509
|
+
keybindingContext.setPendingChord(result.pending);
|
|
510
|
+
event.stopImmediatePropagation();
|
|
511
|
+
break;
|
|
512
|
+
case "chord_cancelled":
|
|
513
|
+
keybindingContext.setPendingChord(null);
|
|
514
|
+
break;
|
|
515
|
+
case "unbound":
|
|
516
|
+
keybindingContext.setPendingChord(null);
|
|
517
|
+
event.stopImmediatePropagation();
|
|
518
|
+
break;
|
|
519
|
+
case "none":
|
|
520
|
+
break;
|
|
521
|
+
}
|
|
522
|
+
}, [action, context, handler, keybindingContext]);
|
|
523
|
+
use_input_default(handleInput, { isActive });
|
|
524
|
+
}
|
|
525
|
+
function useKeybindings(handlers, options = {}) {
|
|
526
|
+
const { context = "Global", isActive = true } = options;
|
|
527
|
+
const keybindingContext = useOptionalKeybindingContext();
|
|
528
|
+
import_react3.useEffect(() => {
|
|
529
|
+
if (!keybindingContext || !isActive)
|
|
530
|
+
return;
|
|
531
|
+
const unregisterFns = [];
|
|
532
|
+
for (const [action, handler] of Object.entries(handlers)) {
|
|
533
|
+
unregisterFns.push(keybindingContext.registerHandler({ action, context, handler }));
|
|
534
|
+
}
|
|
535
|
+
return () => {
|
|
536
|
+
for (const unregister of unregisterFns) {
|
|
537
|
+
unregister();
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
}, [context, handlers, keybindingContext, isActive]);
|
|
541
|
+
const handleInput = import_react3.useCallback((input, key, event) => {
|
|
542
|
+
if (!keybindingContext)
|
|
543
|
+
return;
|
|
544
|
+
const contextsToCheck = [
|
|
545
|
+
...keybindingContext.activeContexts,
|
|
546
|
+
context,
|
|
547
|
+
"Global"
|
|
548
|
+
];
|
|
549
|
+
const uniqueContexts = [...new Set(contextsToCheck)];
|
|
550
|
+
const result = keybindingContext.resolve(input, key, uniqueContexts);
|
|
551
|
+
switch (result.type) {
|
|
552
|
+
case "match":
|
|
553
|
+
keybindingContext.setPendingChord(null);
|
|
554
|
+
if (result.action in handlers) {
|
|
555
|
+
const handler = handlers[result.action];
|
|
556
|
+
if (handler && handler() !== false) {
|
|
557
|
+
event.stopImmediatePropagation();
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
break;
|
|
561
|
+
case "chord_started":
|
|
562
|
+
keybindingContext.setPendingChord(result.pending);
|
|
563
|
+
event.stopImmediatePropagation();
|
|
564
|
+
break;
|
|
565
|
+
case "chord_cancelled":
|
|
566
|
+
keybindingContext.setPendingChord(null);
|
|
567
|
+
break;
|
|
568
|
+
case "unbound":
|
|
569
|
+
keybindingContext.setPendingChord(null);
|
|
570
|
+
event.stopImmediatePropagation();
|
|
571
|
+
break;
|
|
572
|
+
case "none":
|
|
573
|
+
break;
|
|
574
|
+
}
|
|
575
|
+
}, [context, handlers, keybindingContext]);
|
|
576
|
+
use_input_default(handleInput, { isActive });
|
|
577
|
+
}
|
|
578
|
+
var import_react3;
|
|
579
|
+
var init_useKeybinding = __esm(() => {
|
|
580
|
+
init_ink();
|
|
581
|
+
init_KeybindingContext();
|
|
582
|
+
import_react3 = __toESM(require_react(), 1);
|
|
583
|
+
});
|
|
584
|
+
|
|
585
|
+
// src/context/modalContext.tsx
|
|
586
|
+
function useIsInsideModal() {
|
|
587
|
+
return import_react4.useContext(ModalContext) !== null;
|
|
588
|
+
}
|
|
589
|
+
function useModalOrTerminalSize(fallback) {
|
|
590
|
+
const $ = import_compiler_runtime2.c(3);
|
|
591
|
+
const ctx = import_react4.useContext(ModalContext);
|
|
592
|
+
let t0;
|
|
593
|
+
if ($[0] !== ctx || $[1] !== fallback) {
|
|
594
|
+
t0 = ctx ? {
|
|
595
|
+
rows: ctx.rows,
|
|
596
|
+
columns: ctx.columns
|
|
597
|
+
} : fallback;
|
|
598
|
+
$[0] = ctx;
|
|
599
|
+
$[1] = fallback;
|
|
600
|
+
$[2] = t0;
|
|
601
|
+
} else {
|
|
602
|
+
t0 = $[2];
|
|
603
|
+
}
|
|
604
|
+
return t0;
|
|
605
|
+
}
|
|
606
|
+
function useModalScrollRef() {
|
|
607
|
+
return import_react4.useContext(ModalContext)?.scrollRef ?? null;
|
|
608
|
+
}
|
|
609
|
+
var import_compiler_runtime2, import_react4, ModalContext;
|
|
610
|
+
var init_modalContext = __esm(() => {
|
|
611
|
+
import_compiler_runtime2 = __toESM(require_compiler_runtime(), 1);
|
|
612
|
+
import_react4 = __toESM(require_react(), 1);
|
|
613
|
+
ModalContext = import_react4.createContext(null);
|
|
614
|
+
});
|
|
615
|
+
|
|
616
|
+
// src/components/design-system/Divider.tsx
|
|
617
|
+
function Divider(t0) {
|
|
618
|
+
const $ = import_compiler_runtime3.c(21);
|
|
619
|
+
const {
|
|
620
|
+
width,
|
|
621
|
+
color,
|
|
622
|
+
char: t1,
|
|
623
|
+
padding: t2,
|
|
624
|
+
title
|
|
625
|
+
} = t0;
|
|
626
|
+
const char = t1 === undefined ? "\u2500" : t1;
|
|
627
|
+
const padding = t2 === undefined ? 0 : t2;
|
|
628
|
+
const {
|
|
629
|
+
columns: terminalWidth
|
|
630
|
+
} = useTerminalSize();
|
|
631
|
+
const effectiveWidth = Math.max(0, (width ?? terminalWidth) - padding);
|
|
632
|
+
if (title) {
|
|
633
|
+
const titleWidth = stringWidth(title) + 2;
|
|
634
|
+
const sideWidth = Math.max(0, effectiveWidth - titleWidth);
|
|
635
|
+
const leftWidth = Math.floor(sideWidth / 2);
|
|
636
|
+
const rightWidth = sideWidth - leftWidth;
|
|
637
|
+
const t32 = !color;
|
|
638
|
+
let t42;
|
|
639
|
+
if ($[0] !== char || $[1] !== leftWidth) {
|
|
640
|
+
t42 = char.repeat(leftWidth);
|
|
641
|
+
$[0] = char;
|
|
642
|
+
$[1] = leftWidth;
|
|
643
|
+
$[2] = t42;
|
|
644
|
+
} else {
|
|
645
|
+
t42 = $[2];
|
|
646
|
+
}
|
|
647
|
+
let t52;
|
|
648
|
+
if ($[3] !== title) {
|
|
649
|
+
t52 = /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
|
|
650
|
+
dimColor: true,
|
|
651
|
+
children: /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(Ansi, {
|
|
652
|
+
children: title
|
|
653
|
+
}, undefined, false, undefined, this)
|
|
654
|
+
}, undefined, false, undefined, this);
|
|
655
|
+
$[3] = title;
|
|
656
|
+
$[4] = t52;
|
|
657
|
+
} else {
|
|
658
|
+
t52 = $[4];
|
|
659
|
+
}
|
|
660
|
+
let t6;
|
|
661
|
+
if ($[5] !== char || $[6] !== rightWidth) {
|
|
662
|
+
t6 = char.repeat(rightWidth);
|
|
663
|
+
$[5] = char;
|
|
664
|
+
$[6] = rightWidth;
|
|
665
|
+
$[7] = t6;
|
|
666
|
+
} else {
|
|
667
|
+
t6 = $[7];
|
|
668
|
+
}
|
|
669
|
+
let t7;
|
|
670
|
+
if ($[8] !== color || $[9] !== t32 || $[10] !== t42 || $[11] !== t52 || $[12] !== t6) {
|
|
671
|
+
t7 = /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
|
|
672
|
+
color,
|
|
673
|
+
dimColor: t32,
|
|
674
|
+
children: [
|
|
675
|
+
t42,
|
|
676
|
+
" ",
|
|
677
|
+
t52,
|
|
678
|
+
" ",
|
|
679
|
+
t6
|
|
680
|
+
]
|
|
681
|
+
}, undefined, true, undefined, this);
|
|
682
|
+
$[8] = color;
|
|
683
|
+
$[9] = t32;
|
|
684
|
+
$[10] = t42;
|
|
685
|
+
$[11] = t52;
|
|
686
|
+
$[12] = t6;
|
|
687
|
+
$[13] = t7;
|
|
688
|
+
} else {
|
|
689
|
+
t7 = $[13];
|
|
690
|
+
}
|
|
691
|
+
return t7;
|
|
692
|
+
}
|
|
693
|
+
const t3 = !color;
|
|
694
|
+
let t4;
|
|
695
|
+
if ($[14] !== char || $[15] !== effectiveWidth) {
|
|
696
|
+
t4 = char.repeat(effectiveWidth);
|
|
697
|
+
$[14] = char;
|
|
698
|
+
$[15] = effectiveWidth;
|
|
699
|
+
$[16] = t4;
|
|
700
|
+
} else {
|
|
701
|
+
t4 = $[16];
|
|
702
|
+
}
|
|
703
|
+
let t5;
|
|
704
|
+
if ($[17] !== color || $[18] !== t3 || $[19] !== t4) {
|
|
705
|
+
t5 = /* @__PURE__ */ jsx_dev_runtime2.jsxDEV(ThemedText, {
|
|
706
|
+
color,
|
|
707
|
+
dimColor: t3,
|
|
708
|
+
children: t4
|
|
709
|
+
}, undefined, false, undefined, this);
|
|
710
|
+
$[17] = color;
|
|
711
|
+
$[18] = t3;
|
|
712
|
+
$[19] = t4;
|
|
713
|
+
$[20] = t5;
|
|
714
|
+
} else {
|
|
715
|
+
t5 = $[20];
|
|
716
|
+
}
|
|
717
|
+
return t5;
|
|
718
|
+
}
|
|
719
|
+
var import_compiler_runtime3, jsx_dev_runtime2;
|
|
720
|
+
var init_Divider = __esm(() => {
|
|
721
|
+
init_useTerminalSize();
|
|
722
|
+
init_stringWidth();
|
|
723
|
+
init_ink();
|
|
724
|
+
import_compiler_runtime3 = __toESM(require_compiler_runtime(), 1);
|
|
725
|
+
jsx_dev_runtime2 = __toESM(require_jsx_dev_runtime(), 1);
|
|
726
|
+
});
|
|
727
|
+
|
|
728
|
+
// src/components/design-system/Pane.tsx
|
|
729
|
+
function Pane(t0) {
|
|
730
|
+
const $ = import_compiler_runtime4.c(9);
|
|
731
|
+
const {
|
|
732
|
+
children,
|
|
733
|
+
color
|
|
734
|
+
} = t0;
|
|
735
|
+
if (useIsInsideModal()) {
|
|
736
|
+
let t12;
|
|
737
|
+
if ($[0] !== children) {
|
|
738
|
+
t12 = /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
|
|
739
|
+
flexDirection: "column",
|
|
740
|
+
paddingX: 1,
|
|
741
|
+
flexShrink: 0,
|
|
742
|
+
children
|
|
743
|
+
}, undefined, false, undefined, this);
|
|
744
|
+
$[0] = children;
|
|
745
|
+
$[1] = t12;
|
|
746
|
+
} else {
|
|
747
|
+
t12 = $[1];
|
|
748
|
+
}
|
|
749
|
+
return t12;
|
|
750
|
+
}
|
|
751
|
+
let t1;
|
|
752
|
+
if ($[2] !== color) {
|
|
753
|
+
t1 = /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Divider, {
|
|
754
|
+
color
|
|
755
|
+
}, undefined, false, undefined, this);
|
|
756
|
+
$[2] = color;
|
|
757
|
+
$[3] = t1;
|
|
758
|
+
} else {
|
|
759
|
+
t1 = $[3];
|
|
760
|
+
}
|
|
761
|
+
let t2;
|
|
762
|
+
if ($[4] !== children) {
|
|
763
|
+
t2 = /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
|
|
764
|
+
flexDirection: "column",
|
|
765
|
+
paddingX: 2,
|
|
766
|
+
children
|
|
767
|
+
}, undefined, false, undefined, this);
|
|
768
|
+
$[4] = children;
|
|
769
|
+
$[5] = t2;
|
|
770
|
+
} else {
|
|
771
|
+
t2 = $[5];
|
|
772
|
+
}
|
|
773
|
+
let t3;
|
|
774
|
+
if ($[6] !== t1 || $[7] !== t2) {
|
|
775
|
+
t3 = /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ThemedBox_default, {
|
|
776
|
+
flexDirection: "column",
|
|
777
|
+
paddingTop: 1,
|
|
778
|
+
children: [
|
|
779
|
+
t1,
|
|
780
|
+
t2
|
|
781
|
+
]
|
|
782
|
+
}, undefined, true, undefined, this);
|
|
783
|
+
$[6] = t1;
|
|
784
|
+
$[7] = t2;
|
|
785
|
+
$[8] = t3;
|
|
786
|
+
} else {
|
|
787
|
+
t3 = $[8];
|
|
788
|
+
}
|
|
789
|
+
return t3;
|
|
790
|
+
}
|
|
791
|
+
var import_compiler_runtime4, jsx_dev_runtime3;
|
|
792
|
+
var init_Pane = __esm(() => {
|
|
793
|
+
init_modalContext();
|
|
794
|
+
init_ink();
|
|
795
|
+
init_Divider();
|
|
796
|
+
import_compiler_runtime4 = __toESM(require_compiler_runtime(), 1);
|
|
797
|
+
jsx_dev_runtime3 = __toESM(require_jsx_dev_runtime(), 1);
|
|
798
|
+
});
|
|
799
|
+
|
|
800
|
+
export { useTerminalSize, init_useTerminalSize, parseKeystroke, parseChord, chordToString, parseBindings, getBindingDisplayText, resolveKeyWithChordState, init_resolver, KeybindingProvider, useOptionalKeybindingContext, useRegisterKeybindingContext, init_KeybindingContext, useKeybinding, useKeybindings, init_useKeybinding, ModalContext, useIsInsideModal, useModalOrTerminalSize, useModalScrollRef, init_modalContext, Divider, init_Divider, Pane, init_Pane };
|