diff --git a/calcit.cirru b/calcit.cirru index 804171c..36c0cbb 100644 --- a/calcit.cirru +++ b/calcit.cirru @@ -1893,6 +1893,8 @@ |T $ %{} :Leaf (:at 1722445823902) (:by |rJG4IHzWf) (:text |{}) |h $ %{} :Expr (:at 1743534815013) (:by |rJG4IHzWf) :data $ {} + |D $ %{} :Leaf (:at 1743791561079) (:by |rJG4IHzWf) (:text |memof1-call-by) + |L $ %{} :Leaf (:at 1743791670288) (:by |rJG4IHzWf) (:text |:abort-loading) |T $ %{} :Leaf (:at 1743534817391) (:by |rJG4IHzWf) (:text |comp-abort) |b $ %{} :Expr (:at 1743534818469) (:by |rJG4IHzWf) :data $ {} @@ -1950,6 +1952,7 @@ |b $ %{} :Leaf (:at 1743618321522) (:by |rJG4IHzWf) (:text |state) |T $ %{} :Expr (:at 1722445823902) (:by |rJG4IHzWf) :data $ {} + |D $ %{} :Leaf (:at 1743789389667) (:by |rJG4IHzWf) (:text |memof1-call) |T $ %{} :Leaf (:at 1722445823902) (:by |rJG4IHzWf) (:text |comp-md-block) |b $ %{} :Expr (:at 1722482337736) (:by |rJG4IHzWf) :data $ {} @@ -2080,6 +2083,8 @@ |T $ %{} :Leaf (:at 1734771434966) (:by |rJG4IHzWf) (:text |{}) |l $ %{} :Expr (:at 1743534831936) (:by |rJG4IHzWf) :data $ {} + |D $ %{} :Leaf (:at 1743791544305) (:by |rJG4IHzWf) (:text |memof1-call-by) + |L $ %{} :Leaf (:at 1743791666549) (:by |rJG4IHzWf) (:text |:abort-streaming) |T $ %{} :Leaf (:at 1743534838825) (:by |rJG4IHzWf) (:text |comp-abort) |h $ %{} :Expr (:at 1743534846789) (:by |rJG4IHzWf) :data $ {} @@ -2309,10 +2314,17 @@ :data $ {} |T $ %{} :Leaf (:at 1722536206569) (:by |rJG4IHzWf) (:text |:keycode) |b $ %{} :Leaf (:at 1722536206569) (:by |rJG4IHzWf) (:text |e) - |h $ %{} :Expr (:at 1722536206569) (:by |rJG4IHzWf) + |h $ %{} :Expr (:at 1744033011488) (:by |rJG4IHzWf) :data $ {} - |T $ %{} :Leaf (:at 1722536206569) (:by |rJG4IHzWf) (:text |:meta?) - |b $ %{} :Leaf (:at 1722536206569) (:by |rJG4IHzWf) (:text |e) + |D $ %{} :Leaf (:at 1744033013622) (:by |rJG4IHzWf) (:text |or) + |T $ %{} :Expr (:at 1722536206569) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1722536206569) (:by |rJG4IHzWf) (:text |:meta?) + |b $ %{} :Leaf (:at 1722536206569) (:by |rJG4IHzWf) (:text |e) + |b $ %{} :Expr (:at 1722536206569) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1744033018115) (:by |rJG4IHzWf) (:text |:ctrl?) + |b $ %{} :Leaf (:at 1722536206569) (:by |rJG4IHzWf) (:text |e) |l $ %{} :Expr (:at 1722536419205) (:by |rJG4IHzWf) :data $ {} |T $ %{} :Leaf (:at 1722536419900) (:by |rJG4IHzWf) (:text |on-submit) @@ -2321,6 +2333,99 @@ |T $ %{} :Leaf (:at 1722536424418) (:by |rJG4IHzWf) (:text |:content) |b $ %{} :Leaf (:at 1722536426394) (:by |rJG4IHzWf) (:text |state) |h $ %{} :Leaf (:at 1722536427678) (:by |rJG4IHzWf) (:text |d!) + |t $ %{} :Expr (:at 1743789654239) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789657842) (:by |rJG4IHzWf) (:text |:on-focus) + |b $ %{} :Expr (:at 1743789658169) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789658421) (:by |rJG4IHzWf) (:text |fn) + |b $ %{} :Expr (:at 1743789659028) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789659217) (:by |rJG4IHzWf) (:text |e) + |b $ %{} :Leaf (:at 1743789659715) (:by |rJG4IHzWf) (:text |d!) + |h $ %{} :Expr (:at 1743789660367) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789665209) (:by |rJG4IHzWf) (:text |let) + |b $ %{} :Expr (:at 1743789665470) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Expr (:at 1743789665702) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789666481) (:by |rJG4IHzWf) (:text |target) + |b $ %{} :Expr (:at 1743789671868) (:by |rJG4IHzWf) + :data $ {} + |D $ %{} :Leaf (:at 1743789676016) (:by |rJG4IHzWf) (:text |.-target) + |T $ %{} :Expr (:at 1743789666857) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789669577) (:by |rJG4IHzWf) (:text |:event) + |b $ %{} :Leaf (:at 1743789670190) (:by |rJG4IHzWf) (:text |e) + |b $ %{} :Expr (:at 1743789800120) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789804226) (:by |rJG4IHzWf) (:text |class-list) + |b $ %{} :Expr (:at 1743789804928) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789811521) (:by |rJG4IHzWf) (:text |.-classList) + |b $ %{} :Leaf (:at 1743789813183) (:by |rJG4IHzWf) (:text |target) + |h $ %{} :Expr (:at 1743789817355) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789817696) (:by |rJG4IHzWf) (:text |if) + |b $ %{} :Expr (:at 1743789826415) (:by |rJG4IHzWf) + :data $ {} + |D $ %{} :Leaf (:at 1743789827001) (:by |rJG4IHzWf) (:text |not) + |T $ %{} :Expr (:at 1743789818052) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789887751) (:by |rJG4IHzWf) (:text |.!contains) + |b $ %{} :Leaf (:at 1743789821670) (:by |rJG4IHzWf) (:text |class-list) + |h $ %{} :Leaf (:at 1743789854087) (:by |rJG4IHzWf) (:text "|\"focus-within") + |h $ %{} :Expr (:at 1743789828059) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789842706) (:by |rJG4IHzWf) (:text |.!add) + |b $ %{} :Leaf (:at 1743789844159) (:by |rJG4IHzWf) (:text |class-list) + |h $ %{} :Leaf (:at 1743789877875) (:by |rJG4IHzWf) (:text "|\"focus-within") + |u $ %{} :Expr (:at 1743789654239) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789860058) (:by |rJG4IHzWf) (:text |:on-blur) + |b $ %{} :Expr (:at 1743789658169) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789658421) (:by |rJG4IHzWf) (:text |fn) + |b $ %{} :Expr (:at 1743789659028) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789659217) (:by |rJG4IHzWf) (:text |e) + |b $ %{} :Leaf (:at 1743789659715) (:by |rJG4IHzWf) (:text |d!) + |h $ %{} :Expr (:at 1743789660367) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789665209) (:by |rJG4IHzWf) (:text |let) + |b $ %{} :Expr (:at 1743789665470) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Expr (:at 1743789665702) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789666481) (:by |rJG4IHzWf) (:text |target) + |b $ %{} :Expr (:at 1743789671868) (:by |rJG4IHzWf) + :data $ {} + |D $ %{} :Leaf (:at 1743789676016) (:by |rJG4IHzWf) (:text |.-target) + |T $ %{} :Expr (:at 1743789666857) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789669577) (:by |rJG4IHzWf) (:text |:event) + |b $ %{} :Leaf (:at 1743789670190) (:by |rJG4IHzWf) (:text |e) + |b $ %{} :Expr (:at 1743789800120) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789804226) (:by |rJG4IHzWf) (:text |class-list) + |b $ %{} :Expr (:at 1743789804928) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789811521) (:by |rJG4IHzWf) (:text |.-classList) + |b $ %{} :Leaf (:at 1743789813183) (:by |rJG4IHzWf) (:text |target) + |h $ %{} :Expr (:at 1743789817355) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789817696) (:by |rJG4IHzWf) (:text |if) + |b $ %{} :Expr (:at 1743789818052) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789886262) (:by |rJG4IHzWf) (:text |.!contains) + |b $ %{} :Leaf (:at 1743789821670) (:by |rJG4IHzWf) (:text |class-list) + |h $ %{} :Leaf (:at 1743789854087) (:by |rJG4IHzWf) (:text "|\"focus-within") + |h $ %{} :Expr (:at 1743789828059) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789870113) (:by |rJG4IHzWf) (:text |.!remove) + |b $ %{} :Leaf (:at 1743789844159) (:by |rJG4IHzWf) (:text |class-list) + |h $ %{} :Leaf (:at 1743789874092) (:by |rJG4IHzWf) (:text "|\"focus-within") |l $ %{} :Expr (:at 1722536206569) (:by |rJG4IHzWf) :data $ {} |T $ %{} :Leaf (:at 1722536206569) (:by |rJG4IHzWf) (:text |button) @@ -3042,6 +3147,10 @@ :data $ {} |T $ %{} :Leaf (:at 1723009698867) (:by |rJG4IHzWf) (:text |:transform) |b $ %{} :Leaf (:at 1723009885600) (:by |rJG4IHzWf) (:text "|\"translate(50%,0)") + |v $ %{} :Expr (:at 1743789977674) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789993943) (:by |rJG4IHzWf) (:text |:transform-properties) + |b $ %{} :Leaf (:at 1743790061669) (:by |rJG4IHzWf) (:text "|\"height") |h $ %{} :Expr (:at 1723009270885) (:by |rJG4IHzWf) :data $ {} |T $ %{} :Leaf (:at 1723009298734) (:by |rJG4IHzWf) (:text "|\"&:focus-within") @@ -3212,7 +3321,7 @@ |l $ %{} :Expr (:at 1723010440562) (:by |rJG4IHzWf) :data $ {} |T $ %{} :Leaf (:at 1723010440562) (:by |rJG4IHzWf) (:text |:height) - |b $ %{} :Leaf (:at 1723010556927) (:by |rJG4IHzWf) (:text "|\"160px") + |b $ %{} :Leaf (:at 1744033277128) (:by |rJG4IHzWf) (:text "|\"max(160px,20vh)") |o $ %{} :Expr (:at 1723010440562) (:by |rJG4IHzWf) :data $ {} |T $ %{} :Leaf (:at 1723010440562) (:by |rJG4IHzWf) (:text |:width) @@ -3223,14 +3332,14 @@ |b $ %{} :Leaf (:at 1723010547772) (:by |rJG4IHzWf) (:text "|\"320ms") |h $ %{} :Expr (:at 1722964849581) (:by |rJG4IHzWf) :data $ {} - |T $ %{} :Leaf (:at 1723010457510) (:by |rJG4IHzWf) (:text "|\"&:focus-within") + |T $ %{} :Leaf (:at 1743789904682) (:by |rJG4IHzWf) (:text "|\"&.focus-within") |b $ %{} :Expr (:at 1722964850928) (:by |rJG4IHzWf) :data $ {} |T $ %{} :Leaf (:at 1722964851279) (:by |rJG4IHzWf) (:text |{}) |l $ %{} :Expr (:at 1723010440562) (:by |rJG4IHzWf) :data $ {} |T $ %{} :Leaf (:at 1723010440562) (:by |rJG4IHzWf) (:text |:height) - |b $ %{} :Leaf (:at 1723010494761) (:by |rJG4IHzWf) (:text "|\"260px") + |b $ %{} :Leaf (:at 1744033285597) (:by |rJG4IHzWf) (:text "|\"max(260px,40vh)") |submit-message! $ %{} :CodeEntry (:doc |) :code $ %{} :Expr (:at 1722409346610) (:by |rJG4IHzWf) :data $ {} @@ -3581,6 +3690,14 @@ |h $ %{} :Expr (:at 1739122274807) (:by |rJG4IHzWf) :data $ {} |T $ %{} :Leaf (:at 1739122275363) (:by |rJG4IHzWf) (:text |GoogleGenerativeAI) + |zn $ %{} :Expr (:at 1743789279617) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789289349) (:by |rJG4IHzWf) (:text |memof.once) + |b $ %{} :Leaf (:at 1743789290043) (:by |rJG4IHzWf) (:text |:refer) + |h $ %{} :Expr (:at 1743789290349) (:by |rJG4IHzWf) + :data $ {} + |T $ %{} :Leaf (:at 1743789318472) (:by |rJG4IHzWf) (:text |memof1-call) + |b $ %{} :Leaf (:at 1743791566514) (:by |rJG4IHzWf) (:text |memof1-call-by) |app.config $ %{} :FileEntry :defs $ {} |chrome-extension? $ %{} :CodeEntry (:doc |) diff --git a/compact.cirru b/compact.cirru index c593c20..7de57df 100644 --- a/compact.cirru +++ b/compact.cirru @@ -248,7 +248,7 @@ {} $ :class-name (str-spaced style-message-list) if (:loading? state) div ({}) - comp-abort $ str (turn-str model) "\" loading..." + memof1-call-by :abort-loading comp-abort $ str (turn-str model) "\" loading..." if not $ blank? (:answer state) div ({}) @@ -256,7 +256,7 @@ json-pattern? $ :answer state pre $ {} (:class-name style-code-content) :inner-text $ :answer state - comp-md-block + memof1-call comp-md-block -> (:answer state) (either "\"") .!replace pattern-spaced-code $ str &newline "\"```" {} $ :class-name style-md-content @@ -274,7 +274,7 @@ ; d! $ :: :change-model .show model-plugin d! div ({}) - comp-abort $ str (turn-str model) "\" streaming..." + memof1-call-by :abort-streaming comp-abort $ str (turn-str model) "\" streaming..." if (:done? state) div {} $ :class-name (str-spaced css/row-middle) @@ -306,8 +306,20 @@ if and = 13 $ :keycode e - :meta? e + or (:meta? e) (:ctrl? e) on-submit (:content state) d! + :on-focus $ fn (e d!) + let + target $ .-target (:event e) + class-list $ .-classList target + if + not $ .!contains class-list "\"focus-within" + .!add class-list "\"focus-within" + :on-blur $ fn (e d!) + let + target $ .-target (:event e) + class-list $ .-classList target + if (.!contains class-list "\"focus-within") (.!remove class-list "\"focus-within") button $ {} :class-name $ str-spaced css/button style-submit :inner-text "\"Generate" @@ -422,7 +434,7 @@ |style-message-box $ %{} :CodeEntry (:doc |) :code $ quote defstyle style-message-box $ {} - "\"&" $ {} (:position :absolute) (:bottom 0) (:opacity 0.9) (:max-width 1200) (:width "\"100%") (:right "\"50%") (:padding "\"8px") (:margin :auto) (:transition-duration "\"300ms") (:transform "\"translate(50%,0)") + "\"&" $ {} (:position :absolute) (:bottom 0) (:opacity 0.9) (:max-width 1200) (:width "\"100%") (:right "\"50%") (:padding "\"8px") (:margin :auto) (:transition-duration "\"300ms") (:transform "\"translate(50%,0)") (:transform-properties "\"height") "\"&:focus-within" $ {} (:opacity 1) (:transform "\"translate(50%,0)") |style-message-list $ %{} :CodeEntry (:doc |) :code $ quote @@ -447,8 +459,8 @@ |style-textbox $ %{} :CodeEntry (:doc |) :code $ quote defstyle style-textbox $ {} - "\"&" $ {} (:border-radius 12) (:height "\"160px") (:width "\"100%") (:transition-duration "\"320ms") - "\"&:focus-within" $ {} (:height "\"260px") + "\"&" $ {} (:border-radius 12) (:height "\"max(160px,20vh)") (:width "\"100%") (:transition-duration "\"320ms") + "\"&.focus-within" $ {} (:height "\"max(260px,40vh)") |submit-message! $ %{} :CodeEntry (:doc |) :code $ quote defn submit-message! (cursor state prompt-text model d!) (hint-fn async) @@ -492,6 +504,7 @@ respo-alerts.core :refer $ use-modal-menu "\"../extension/get-selected" :refer $ get-selected "\"@google/generative-ai" :refer $ GoogleGenerativeAI + memof.once :refer $ memof1-call memof1-call-by |app.config $ %{} :FileEntry :defs $ {} |chrome-extension? $ %{} :CodeEntry (:doc |)