Skip to content

Commit

Permalink
Merge pull request #5 from mvc-works/calcit-0.7
Browse files Browse the repository at this point in the history
upgrade calcit 0.7
  • Loading branch information
NoEgAm authored Jun 5, 2023
2 parents d212803 + 742d4fe commit 3de0b41
Show file tree
Hide file tree
Showing 8 changed files with 1,277 additions and 1,294 deletions.
31 changes: 16 additions & 15 deletions .github/workflows/upload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,26 @@ on:

jobs:
test:
runs-on: ubuntu-20.04
# runs-on: ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3

- name: ACTIONS_ALLOW_UNSECURE_COMMANDS
id: ACTIONS_ALLOW_UNSECURE_COMMANDS
run: echo 'ACTIONS_ALLOW_UNSECURE_COMMANDS=true' >> $GITHUB_ENV
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'yarn'

- name: add cr
run: |
mkdir -p $GITHUB_WORKSPACE/bin
wget -O $GITHUB_WORKSPACE/bin/cr http://repo.calcit-lang.org/binaries/linux/cr
chmod +x $GITHUB_WORKSPACE/bin/cr
echo "::add-path::$GITHUB_WORKSPACE/bin"
- uses: supplypike/setup-bin@v3
with:
uri: 'https://github.com/calcit-lang/calcit/releases/download/0.7.0-a5/cr'
name: 'cr'
version: '0.7.0-a5'

- name: "prepare modules"
run: >
mkdir -p ~/.config/calcit/modules/ && cd ~/.config/calcit/modules/
- uses: supplypike/setup-bin@v3
with:
uri: 'https://github.com/calcit-lang/calcit/releases/download/0.7.0-a5/caps'
name: 'caps'
version: '0.7.0-a5'

- name: "compiles to js"
run: >
Expand Down
1,994 changes: 993 additions & 1,001 deletions calcit.cirru

Large diffs are not rendered by default.

159 changes: 79 additions & 80 deletions compact.cirru
Original file line number Diff line number Diff line change
@@ -1,34 +1,39 @@

{} (:package |pointed-prompt)
:configs $ {} (:init-fn |pointed-prompt.app.main/main!) (:reload-fn |pointed-prompt.app.main/reload!)
:configs $ {} (:init-fn |pointed-prompt.app.main/main!) (:reload-fn |pointed-prompt.app.main/reload!) (:version |0.0.5-a3)
:modules $ []
:version |0.0.5-a1
:entries $ {}
:files $ {}
|pointed-prompt.core $ {}
|pointed-prompt.app.main $ {}
:defs $ {}
|listen! $ quote
defn listen! ()
set! (.-onclick js/window)
fn (event) (js/console.log event) (.!stopPropagation event)
prompt-at!
[] (.-pageX event) (.-pageY event)
{} $ :textarea?
> (js/Math.random 1) 0.5
fn (content) (js/console.log content)
set! (.-clearPrompt js/window) clear-prompt!
|main! $ quote
defn main! () (load-console-formatter!) (listen!) (println "\"App Started")
|reload! $ quote
defn reload! () (listen!) (println "\"Code updated.")
:ns $ quote
ns pointed-prompt.core $ :require
[] pointed-prompt.util.styles :refer $ [] hsl style->string layout-row layout-column layout-expand font-code font-normal
ns pointed-prompt.app.main $ :require
pointed-prompt.core :refer $ prompt-at! clear-prompt!
|pointed-prompt.core $ {}
:defs $ {}
|style-container $ quote
def style-container $ {} (:position :absolute) (:padding "\"10px 12px")
:background-color $ hsl 0 0 30 0.9
:border $ str "\"1px solid " (hsl 0 0 30)
:width 240
:border-radius "\"2px"
|style-input $ quote
def style-input $ {} (:outline :none) (:font-family font-normal) (:line-height "\"20px") (:font-size 14) (:padding "\"6px 8px") (:width "\"100%") (:border-radius "\"2px") (:border :none) (:height 28)
|style-close $ quote
def style-close $ {} (:margin-left 8) (:font-family "\"Helvetica, sans-serif") (:font-size 24) (:font-weight 100)
:color $ hsl 0 80 80
:cursor :pointer
|style-submit $ quote
def style-submit $ {} (:margin-left 8)
:color $ hsl 200 80 80
:cursor :pointer
:font-size 14
:font-family font-normal
|*box-root $ quote (defatom *box-root nil)
|clear-prompt! $ quote
defn clear-prompt! () $ if (some? @*box-root)
let
created $ if (some? @*box-root)
js/parseFloat $ .-createdTime (.-dataset @*box-root)
, 0
duration $ - (js/window.performance.now) created
if (> duration 100) (.!remove @*box-root)
|prompt-at! $ quote
defn prompt-at! (position options cb)
let
Expand Down Expand Up @@ -94,76 +99,70 @@
.!remove root
.!appendChild js/document.body root
.!select input
|clear-prompt! $ quote
defn clear-prompt! () $ if (some? @*box-root)
let
created $ if (some? @*box-root)
js/parseFloat $ .-createdTime (.-dataset @*box-root)
, 0
duration $ - (js/window.performance.now) created
if (> duration 100) (.!remove @*box-root)
|style-close $ quote
def style-close $ {} (:margin-left 8) (:font-family "\"Helvetica, sans-serif") (:font-size 24) (:font-weight 100)
:color $ hsl 0 80 80
:cursor :pointer
|style-container $ quote
def style-container $ {} (:position :absolute) (:padding "\"10px 12px")
:background-color $ hsl 0 0 30 0.9
:border $ str "\"1px solid " (hsl 0 0 30)
:width 240
:border-radius "\"2px"
|style-input $ quote
def style-input $ {} (:outline :none) (:font-family font-normal) (:line-height "\"20px") (:font-size 14) (:padding "\"6px 8px") (:width "\"100%") (:border-radius "\"2px") (:border :none) (:height 28)
|style-submit $ quote
def style-submit $ {} (:margin-left 8)
:color $ hsl 200 80 80
:cursor :pointer
:font-size 14
:font-family font-normal
:ns $ quote
ns pointed-prompt.core $ :require
[] pointed-prompt.util.styles :refer $ [] hsl style->string layout-row layout-column layout-expand font-code font-normal
|pointed-prompt.util.styles $ {}
:ns $ quote (ns pointed-prompt.util.styles)
:defs $ {}
|style->string $ quote
defn style->string (styles)
-> styles (.to-list)
map $ fn (entry)
let
k $ first entry
style-name $ turn-string k
v $ get-style-value (last entry) (dashed->camel style-name)
str style-name |: (escape-html v) |;
join-str |
|hsl $ quote
defn hsl (h s l ? arg)
let
a $ either arg 1
str "\"hsl(" h "\"," s "\"%," l "\"%," a "\")"
|font-code $ quote (def font-code "|Source Code Pro, Menlo, Ubuntu Mono, Consolas, monospace")
|layout-column $ quote
def layout-column $ {} (:display |flex) (:align-items |stretch) (:flex-direction |column)
|layout-expand $ quote
def layout-expand $ {} (:flex 1) (:overflow :auto)
|dashed->camel $ quote
defn dashed->camel (x)
.!replace x dashed-letter-pattern $ fn (cc pos prop)
.!toUpperCase $ aget cc 1
|dashed-letter-pattern $ quote
def dashed-letter-pattern $ new js/RegExp "\"-[a-z]" "\"g"
|escape-html $ quote
defn escape-html (text)
if (nil? text) "\"" $ -> text (.replace "|\"" |&quot;) (.replace |< |&lt;) (.replace |> |&gt;) (.replace &newline "\"&#13;&#10;")
|font-code $ quote (def font-code "|Source Code Pro, Menlo, Ubuntu Mono, Consolas, monospace")
|font-normal $ quote (def font-normal "|Hind, Helvatica, Arial, sans-serif")
|get-style-value $ quote
defn get-style-value (x prop)
cond
string? x
, x
(keyword? x) (turn-string x)
(tag? x) (turn-string x)
(number? x)
if (.!test pattern-non-dimension-props prop) (str x) (str x "\"px")
true $ str x
|dashed->camel $ quote
defn dashed->camel (x)
.!replace x dashed-letter-pattern $ fn (cc pos prop)
.!toUpperCase $ aget cc 1
|pattern-non-dimension-props $ quote
def pattern-non-dimension-props $ new js/RegExp "\"acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera" "\"i"
|dashed-letter-pattern $ quote
def dashed-letter-pattern $ new js/RegExp "\"-[a-z]" "\"g"
|hsl $ quote
defn hsl (h s l ? arg)
let
a $ either arg 1
str "\"hsl(" h "\"," s "\"%," l "\"%," a "\")"
|layout-column $ quote
def layout-column $ {} (:display |flex) (:align-items |stretch) (:flex-direction |column)
|layout-expand $ quote
def layout-expand $ {} (:flex 1) (:overflow :auto)
|layout-row $ quote
def layout-row $ {} (:display |flex) (:align-items |stretch) (:flex-direction |row)
|pointed-prompt.app.main $ {}
:ns $ quote
ns pointed-prompt.app.main $ :require
pointed-prompt.core :refer $ prompt-at! clear-prompt!
:defs $ {}
|main! $ quote
defn main! () (load-console-formatter!) (listen!) (println "\"App Started")
|reload! $ quote
defn reload! () (listen!) (println "\"Code updated.")
|listen! $ quote
defn listen! ()
set! (.-onclick js/window)
fn (event) (js/console.log event) (.!stopPropagation event)
prompt-at!
[] (.-pageX event) (.-pageY event)
{} $ :textarea?
> (js/Math.random 1) 0.5
fn (content) (js/console.log content)
set! (.-clearPrompt js/window) clear-prompt!
|pattern-non-dimension-props $ quote
def pattern-non-dimension-props $ new js/RegExp "\"acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera" "\"i"
|style->string $ quote
defn style->string (styles)
-> styles (.to-list)
map $ fn (entry)
let
k $ first entry
style-name $ turn-string k
v $ get-style-value (last entry) (dashed->camel style-name)
str style-name |: (escape-html v) |;
join-str |
:ns $ quote (ns pointed-prompt.util.styles)
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<body>

<div class="app" >Click anywhere to try dialog..</div>
<script type="module" src="./main.js" ></script>
<script type="module" src="./main.mjs" ></script>

</body>
</html>
10 changes: 0 additions & 10 deletions main.js

This file was deleted.

10 changes: 10 additions & 0 deletions main.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

import { main_$x_ } from "./js-out/pointed-prompt.app.main.mjs"

main_$x_()

if (import.meta.hot) {
import.meta.hot.accept('./js-out/pointed-prompt.app.main.mjs', (main) => {
main.reload_$x_()
})
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"version": "0.0.5-a2",
"version": "0.0.5-a3",
"dependencies": {
"@calcit/procs": "^0.5.15"
"@calcit/procs": "^0.7.0-a5"
},
"devDependencies": {
"vite": "^2.7.12"
"vite": "^4.3.9"
}
}
Loading

0 comments on commit 3de0b41

Please sign in to comment.