Does anyone know where is the github repo for the re-com site - https://re-com.day8.com.au/#/layout? I saw some unbalanced brackets in the doc
Whoops. Thank you! I overlooked the fact that the site was in the same repo
Also, if you click on any specific component, the top of the page will have two links - one for the component source code, and the other for the page source code.
Is there an equivalent of ClojureDocs for ClojureScript?
I don't know if it is equivalent, but I'm always using https://cljs.github.io/api/
Yes, this one I know of. The main strength of ClojureDocs (to me) is the community provided recipes. I find them super useful. So I was just wondering if there is a similar site for CLJS.
I am comfortable with Clojure. Which book would you suggest for ClojureScript?
Most of clojuredocs is valable for clojurescript too though
I wish clojuredocs integration in cider would work for clojurescript
Nice. Did not know about the ClojureDocs integration in CIDER. Just tried it out. Strangely, it does not have documentation for loop
. Is it using an older snapshot?
Hmm donβt know, it should work
Hola. I'm using shadow-cljs and the generated source-map appears to map all output line columns to 1, so the mapping doesn't work. For instance, the output of decode-source-map:
{:version 3,
:sources ["zprint/finish.cljc"],
:mappings {:537 ["1 => zprint/finish.cljc 336:1 p__41998"
"1 => zprint/finish.cljc 336:1 cljs.core.nth"
"1 => zprint/finish.cljc 336:1 vec__42000"
"1 => zprint/finish.cljc 336:1 vec__42000"
"1 => zprint/finish.cljc 336:1 vec__42000"
"1 => zprint/finish.cljc 340:19 focus-begin"],
:238 [""],
:419 ["1 => zprint/finish.cljc 285:1 s"
"1 => zprint/finish.cljc 290:3 s"
"1 => zprint/finish.cljc 290:9 nl-split"
"1 => zprint/finish.cljc 290:18 nl-split"
"1 => zprint/finish.cljc 290:18 nl-split"
"1 => zprint/finish.cljc 290:19 clojure.string.split"
"1 => zprint/finish.cljc 290:40 clojure.string.split"
"1 => zprint/finish.cljc 290:40 clojure.string.split"
"1 => zprint/finish.cljc 290:45 s"],
...
Anyone got an idea what the problem might be? In the browser I can't jump to the right line, and I suspect it is due to this. I've compared the source-map with one generated by boot
, there it is fine. The compiler option :source-map true
is the same for both.
Given that boot works, this might be worth asking in #shadow-cljs
Ah, thanks. I didn't see there was a more specific channel. π
There are clearly several entries that aren't column 1? so "all output" doesn't seem accurate?
are you looking at the wrong "column"? the one that references the sources index? that'll always be 1 since there is only one file?
Those are the line numbers of the output file, if I understand it correctly. And then inside those value lists you see all of them start with "1 => ...", those should be the columns.
I'll generate a working one. And I think I just found a shadow-cljs version where it worked. Perhaps I can manually bisect my way to where it changed.
feel free to set up a reproducible repo. As far as I can tell source maps work perfectly fine
Yeah, I can't reproduce what I think I just saw. Same behaviour now with the older shadow-cljs version. I'll dig a bit deeper and post again in the other channel.
@thheller: https://github.com/thheller/shadow-cljs/issues/871#issuecomment-839832132
Any thoughts on why this:
Ξ» clj -Srepro -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "RELEASE"}}}' -M -m cljs.main --repl
Downloading: org/clojure/clojurescript/maven-metadata.xml from central
ClojureScript 1.10.844
cljs.user=> (ns foo.bar)
Either hangs indefinitely or throws this:
Execution error (InternalError) at (<cljs repl>:1).
too much recursion
I can reproduce it now as well, but only when the initial page was left there an the REPL session has been recreated.
It seems that the problem is due to clojure.browser.repl/bootstrap
being called multiple times. And goog.require
ends up calling itself.
Great to hear someone else was able to reproduce it as well. Thanks for trying it out! I also filed an http://ask.clojure.org question about this issue, in case you feel like weighing in there: https://ask.clojure.org/index.php/10602/evaluating-an-ns-form-clojurescript-repl-throws-rangeerror
weird. cannot reproduce
I can't reproduce this either.
I'm on Zulu JDK 16, FWIW.
I can reproduce it with OpenJDK 11, too, though. π
When it throws, does *e
in the REPL produce anything?
No.
Unfortunately.
Hi
Iβm on 1.10.844
and I have an issue with <http://goog.net|goog.net>.cookies.set
Looks like it is complied from
https://github.com/google/closure-library/blob/ff84fa63944b428da36006ec940b3b349a8d66d3/closure/goog/net/cookies.js#L167
to
hba.set = function(n, t, h) {
var e = !1;
if ("object" == typeof h) {
var l = h.Lh;
e = h.Mh || !1;
var r = h.domain || void 0
, b = h.path || void 0
, u = h.Lg
}
if (/[;=\s]/.test(n))
throw Error('Invalid cookie name "' + n + '"');
if (/[;\r\n]/.test(t))
throw Error('Invalid cookie value "' + t + '"');
void 0 === u && (u = -1),
this.Oc.cookie = n + "=" + t + (r ? ";domain=" + r : "") + (b ? ";path=" + b : "") + (0 > u ? "" : 0 == u ? ";expires=" + new Date(1970,1,1).toUTCString() : ";expires=" + new Date(Date.now() + 1e3 * u).toUTCString()) + (e ? ";secure" : "") + (null != l ? ";samesite=" + l : "")
}
As you can see some params are renamed (see argument h
) like h.Lh
Is it expected?it is expected. is this causing issues for you?
Yes, basically I cannot pass maxAge
param b/c it becomes something like Lh
BTW, path
and domain
are left untouched
are you calling this from javascript or clojurescript?
oh i'm following you now. It's not the arguments to the function but the properties on an options object that are being renamed
from cljs, a pass it as #js {:maxAge 999 :path "/"}
Iβve also tried to construct <http://goog.net|goog.net>.Cookies.SetOptions
but it didnβt help
Looks like it warrants an issue on their GitHub.
I don't think any of the keys allowed in options
should be renamed.
I think you can hot-fix it in your own code with
(defn ^:export f [^js x]
(.-maxAge x))
You don't have to use it - it should simply create an extern for maxAge
thus preventing it from being renamed. But I haven't tested this approach.
Thanks!
Maybe it is better to write externs manually then?
For <http://goog.net|goog.net>.Cookies.SetOptions
Not a fan of this idea though
passing #js
is not right
nor is externs
SetOptions
should work and it should be determined why it isn't
the Closure type annotations tell you that SetOptions
is required as 3rd parameter
@il.tmfv you absolutely cannot call set directly from non-compiled code
I wouldn't do that myself. I would simply use that workaround above and create an issue on Closure's GitHub that you linked.
if that's what you're doing then it's still trivial to fix
you can write an fn that takes the unmunged parameters and then constructs SetOptions
Is it true for Closure API in general? If not, how to tell the difference?
@p-himik there's nothing to see here
it's exactly the same for all Closure compiled stuff
How to properly construct it? Iβve tried this, but it feels wrong:
(let [cookie-options (SetOptions.)
_ (gobj/set cookie-options "maxAge" (* 60 60))
_ (gobj/set cookie-options "path" "/")]
(.set goog.net.cookies
"checkout-data"
"xxx"
cookie-options))
You can use doto
to make it more concise and get rid of let
.
@il.tmfv won't work
https://google.github.io/closure-library/api/goog.net.Cookies.SetOptions.html
And I think you can't use gobj/set
here because it has to be munged. Just (set! ...)
.
these are the docs, you must supply a type w/ those properties not JSON stuff
(deftype Options [domain maxAge path sameSite secure])
or write some Closure JS and import that etc. this is relatively well supported - how transit-js -> transit-cljs works
Thanks! will try and report
But <http://goog.net|goog.net>.Cookies.SetOptions
is a type, no?
Why wouldn't using
(doto (SetOptions.)
(set! -maxAge 3600)
(set! -path "/"))
work?@dnolen thanks again! deftype
helped
@p-himik interface
I can also reproduce it on a different machine that's running a different OS, Java version, and even CPU architecture. Really weird.
But this works just fine on my end, in :advanced
:
(ns app.core
(:require [goog.net.Cookies :refer [SetOptions]])
(:import (<http://goog.net|goog.net> cookies)))
(.set cookies "checkout-data" "xxx"
(doto (SetOptions.)
(set! -maxAge 31536000)
(set! -path "/")))
@il.tmfv or rather you're right that will work too, but the important thing is
https://google.github.io/closure-library/api/goog.net.Cookies.html
Cookies.SetOptions
is defined as an interface here - so you can supply anything that matches
but yes using SetOptions
works instead of creating deftype
but the takeaway just to drive the point home
1. For Closure stuff externs is never the right answer
2. Do not pass runtime stuff to compiled code if you have not established an adapter
But here https://google.github.io/closure-library/api/goog.net.Cookies.SetOptions.html it says record
and not interface
.
Not sure if Closure treats the terms as interchangeable or there's a discrepancy in documentation.
pretty sure it can be both?
In this case - seems like it. And I can find neither documentation nor usage examples on how @record
and @interface
are different for GCC.
OK, this is browser-related, maybe a browser extension messing with something. I can reproduce the issue with Firefox, but not with Safari.
...or not. It sometimes hangs with Safari, too. Oh well.
When it hangs, you should be able to pause JS execution and see the current stack trace.
Via the browser's DevTools.
Oh, yes, good tip, will try that. :thumbsup::skin-tone-2: ...except my browser crashed when I tried doing that. :P
Time to try all the browsers. :)
Heh, I guess so. π
pretty interesting news - https://workspaceupdates.googleblog.com/2021/05/Google-Docs-Canvas-Based-Rendering-Update.html
would nice if there were more engineering / technical details
Hmm, their demo combines canvas
with svg
.
I wonder if that just means they're going to use flutter. I think flutter was already canvas based.