Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix defcomp decorating #66

Merged
merged 1 commit into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

- uses: calcit-lang/[email protected]
with:
version: '0.8.43'
version: '0.8.44'

- name: "load deps"
run: caps --ci && yarn
Expand Down
133 changes: 80 additions & 53 deletions calcit.cirru

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions compact.cirru
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

{} (:package |respo)
:configs $ {} (:init-fn |respo.main/main!) (:reload-fn |respo.main/reload!) (:version |0.16.8)
:configs $ {} (:init-fn |respo.main/main!) (:reload-fn |respo.main/reload!) (:version |0.16.9)
:modules $ [] |memof/ |lilac/ |calcit-test/
:entries $ {}
:files $ {}
Expand Down Expand Up @@ -678,22 +678,27 @@
event $ pick-event props
%{} schema/Element (:name tag-name) (:coord nil) (:attrs attrs) (:style styles) (:event event)
:children $ map child-map confirm-child-pair
|decorate-defcomp $ %{} :CodeEntry (:doc "|detect root element under component and add `data-defcomp` mark")
:code $ quote
defn decorate-defcomp (c name)
update c :tree $ fn (tree)
if (&record:matches? tree schema/Element)
update tree :attrs $ fn (attrs)
conj attrs $ [] :data-comp name
, tree
|defcomp $ %{} :CodeEntry (:doc |)
:code $ quote
defmacro defcomp (comp-name params & body)
assert "\"expected symbol of comp-name" $ symbol? comp-name
assert "\"expected list for params" $ list? params
assert "\"some component retured" $ &> (count body) 0
quasiquote $ defn ~comp-name (~ params)
->
decorate-defcomp
extract-effects-list $ %{} schema/Component
:effects $ []
:name $ ~ (turn-tag comp-name)
:tree $ do (~@ body)
update-in ([] :tree :attrs)
fn (attrs)
conj attrs $ [] :data-comp
~ $ turn-string comp-name
~ $ turn-string comp-name
|defeffect $ %{} :CodeEntry (:doc |)
:code $ quote
defmacro defeffect (effect-name args params & body)
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"version": "0.16.8",
"version": "0.16.9",
"dependencies": {
"@calcit/procs": "^0.8.43"
"@calcit/procs": "^0.8.44"
},
"scripts": {
"test": "cr --once --emit-js --init-fn=respo.test.main/main! && node test.mjs"
},
"devDependencies": {
"bottom-tip": "^0.1.5",
"vite": "^5.2.2"
"vite": "^5.2.6"
}
}
22 changes: 11 additions & 11 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.