Browse Source

write first pages of documentation

master
Marek Piasecki 2 years ago
parent
commit
eeda1812fc
  1. 1
      src/logo.svg
  2. 173
      src/main.imba

1
src/logo.svg

@ -0,0 +1 @@
<svg width="300" viewBox="0 0 250 95.354691"><text style="line-height:125%" x="36.909" y="41.764" font-size="55.069" letter-spacing="2.692" fill="#ae81ff">""</text><text style="line-height:125%" x="124.447" letter-spacing="2.692" fill="#ae81ff" y="40" font-size="55.069">{ }</text><path d="M82.72 55.069l18.116-27.535L82.756 0h17.371l18.08 27.534-18.08 27.535H82.72z"></path><path d="M11.025 37.495c2.924 0 5.087 2.72 5.087 6.191 0 3.472-2.163 6.434-5.087 6.392H5.604V37.495zm-9.654-4.203c-.762 0-1.371.61-1.371 1.401v32.518c0 .761.64 1.401 1.401 1.401h2.802c.792 0 1.401-.64 1.401-1.401v-12.93h7.127c5.665 0 8.985-4.869 8.985-10.595 0-5.725-3.32-10.394-8.985-10.394zM35.166 46.815c1.919 0 3.015 1.249 3.777 2.437l2.527 3.959c.488.792 1.523 1.401 2.285 1.401h3.563c.792 0 1.005-.61.518-1.401l-2.71-4.294c-1.22-1.92-2.133-2.985-3.381-3.442 3.076-.61 5.604-2.132 5.604-5.421 0-4.203-3.32-6.762-7.767-6.762H27.308c-.761 0-1.37.61-1.37 1.401v18.518c0 .761.64 1.401 1.4 1.401h2.803c.791 0 1.4-.64 1.4-1.401v-6.396h3.625zm2.71-9.32c1.706 0 3.869.61 3.869 2.559 0 1.949-2.163 2.558-3.868 2.558h-6.335v-5.117h6.335zM62.805 36.856c4.568 0 6.365 2.528 6.365 7.096 0 4.569-1.797 7.097-6.365 7.097-4.569 0-6.366-2.528-6.366-7.097 0-4.568 1.797-7.096 6.366-7.096zm-11.97 7.096c0 7.919 4.356 11.117 11.97 11.117 7.614 0 11.97-3.198 11.97-11.117 0-7.919-4.356-11.116-11.97-11.116-7.614 0-11.97 3.197-11.97 11.116z"></path><path d="M35.07 72.815c1.919 0 3.015 1.249 3.777 2.437l2.528 3.959c.487.792 1.522 1.401 2.284 1.401h3.563c.792 0 1.005-.61.518-1.401l-2.71-4.294c-1.219-1.92-2.133-2.985-3.381-3.442 3.076-.61 5.604-2.132 5.604-5.421 0-4.203-3.32-6.762-7.767-6.762H27.212c-.761 0-1.37.61-1.37 1.401v18.518c0 .761.64 1.401 1.4 1.401h2.803c.792 0 1.4-.64 1.4-1.401v-6.396h3.625zm2.71-9.32c1.706 0 3.869.61 3.869 2.559 0 1.949-2.163 2.558-3.868 2.558h-6.335v-5.117h6.335zM62.709 62.856c4.568 0 6.365 2.528 6.365 7.096 0 4.569-1.797 7.097-6.365 7.097-4.569 0-6.366-2.528-6.366-7.097 0-4.568 1.797-7.096 6.366-7.096zm-11.97 7.096c0 7.919 4.356 11.117 11.97 11.117 7.614 0 11.97-3.198 11.97-11.117 0-7.919-4.356-11.116-11.97-11.116-7.614 0-11.97 3.197-11.97 11.116zM88.432 76.53c-2.71 0-3.929-1.4-3.929-4.324V60.693c0-.791-.64-1.4-1.4-1.4H80.33c-.792 0-1.432.609-1.432 1.4v11.483c0 5.39 3.168 8.558 9.381 8.558h2.68c6.213 0 9.38-3.168 9.38-8.558V60.693c0-.791-.639-1.4-1.43-1.4h-2.772c-.762 0-1.401.609-1.401 1.4v11.513c0 2.924-1.218 4.325-3.93 4.325h-2.375zM105.37 59.292c-.792 0-1.402.61-1.402 1.401v1.401c0 .792.61 1.401 1.401 1.401h6.64v15.746c0 .762.64 1.371 1.4 1.371h2.803c.761 0 1.4-.61 1.4-1.37V63.494h6.64c.792 0 1.401-.609 1.401-1.4v-1.402c0-.791-.609-1.4-1.4-1.4h-18.884zM148.14 59.292h-17.147c-.762 0-1.401.61-1.401 1.37v18.519c0 .791.609 1.431 1.4 1.431h17.087c.792 0 1.401-.64 1.401-1.401V77.78c0-.762-.61-1.371-1.37-1.371h-12.914v-4.386h11.147c.761 0 1.401-.64 1.401-1.4V69.22c0-.761-.64-1.4-1.401-1.4h-11.147v-4.326h12.944c.761 0 1.4-.609 1.4-1.4v-1.402c0-.791-.639-1.4-1.4-1.4zM162.973 72.815c1.919 0 3.015 1.249 3.777 2.437l2.528 3.959c.487.792 1.523 1.401 2.284 1.401h3.563c.792 0 1.005-.61.518-1.401l-2.71-4.294c-1.219-1.92-2.132-2.985-3.381-3.442 3.076-.61 5.604-2.132 5.604-5.421 0-4.203-3.32-6.762-7.767-6.762h-12.274c-.761 0-1.37.61-1.37 1.401v18.518c0 .761.64 1.401 1.4 1.401h2.803c.792 0 1.4-.64 1.4-1.401v-6.396h3.625zm2.71-9.32c1.706 0 3.869.61 3.869 2.559 0 1.949-2.163 2.558-3.868 2.558h-6.335v-5.117h6.335z"></path><path d="M172.215 88.167c0 1.28.731 2.01 2.01 2.01h1.828c1.28 0 2.01-.73 2.01-2.01v-.944c0-1.28-.73-2.01-2.01-2.01h-1.827c-1.28 0-2.01.73-2.01 2.01v.944zM188.034 75.01a.897.897 0 0 0-.914-.914h-3.32a.897.897 0 0 0-.913.914v13.34c0 2.68-1.066 3.472-1.98 3.472-.579 0-.975-.213-1.523-.213h-.457a.897.897 0 0 0-.913.913v1.614c0 .457.395.792.913.914.914.213 2.437.305 3.35.305 3.625 0 5.757-2.132 5.757-7.005V75.01zm-5.208-4.386c0 1.066.64 1.706 1.705 1.706h1.858c1.066 0 1.706-.64 1.706-1.706v-.518c0-1.066-.64-1.705-1.706-1.705h-1.858c-1.066 0-1.705.64-1.705 1.705v.518zM208.704 85.517c0-6.213-11.239-4.751-11.239-7.279 0-.853.853-1.431 2.955-1.431 1.31 0 2.436.365 2.954 1.005.396.487.944.792 1.705.792h2.224a.897.897 0 0 0 .913-.914c0-3.168-3.167-4.264-8.162-4.264-4.294 0-7.736 1.37-7.736 4.812 0 6.152 11.239 4.751 11.239 7.28 0 .852-.853 1.43-3.412 1.43-1.31 0-2.436-.365-2.954-1.004-.396-.488-.944-.792-1.705-.792h-2.224a.897.897 0 0 0-.913.913c0 3.168 3.167 4.264 8.162 4.264 4.751 0 8.193-1.37 8.193-4.812z"></path></svg>

After

Width:  |  Height:  |  Size: 4.4 KiB

173
src/main.imba

@ -1,13 +1,172 @@
css
html, body m:0 p:0
body ff:mono bgc:gray9
a c:violet6 td:none td@hover:underline
.active, .activated filter:brightness(130%)
.button d:inline-block m:2px bgc:none c:violet7 td:none bxs:sm us:none
.button@hover, .button.active bxs:md filter:hue-rotate(5deg) ml:0px pl:12px td:none
.button, code, .bordered p:10px bd:2px solid violet5 rd:10px d:inline-block
.bordered p:2.5px bw:1.5px c:violet9
.night filter:invert(100%)
.gradient
bg:linear-gradient(to right,violet7,blue6,violet7)
fw:normal
-webkit-background-clip:text
-webkit-text-fill-color:transparent
tag App tag App
<self[d:bbox]> css
<pro-ref view=v> v for v in R.views d:bbox mx:auto my:50px bgc:white p:40px rd:5px maw:1024px of:auto
<pro-ref view="d"> 'd' @lt-xs m:0 px:0 rd:0
<pro-toggle param="O">
<label> "O" <self.night=R.param('night')>
<input type='checkbox' checked=R.param('O')> <param-preview>
<h2.gradient> "pro-router-imba2: Imba2 integration with pro-router"
<[d:flex flw:wrap w:100% jc:space-between]>
<Menu>
<pro-router[mx:40px maw:750px]>
###
<pro-ref view="b" params={ project: 2}> "b/project/2" <pro-ref view="b" params={ project: 2}> "b/project/2"
<pro-ref-f view="c" params={ book: 3}> "c/book/3" <pro-ref-f view="c" params={ book: 3}> "c/book/3"
<pro-router>
<input$v type='text' value=R.param('e') @keyup=R.write('e', $v.value)> <input$v type='text' value=R.param('e') @keyup=R.write('e', $v.value)>
###
tag Menu
<self[d:flex fld:column mx:auto mb: 50px]>
<pro-ref.button view=v> v.toUpperCase! for v in R.views
###
<pro-ref.button view="foo"> 'WRONG WAY!'
<pro-toggle.button param="night">
<label> "NIGHT"
<input type='checkbox' checked=R.param('night')>
###
tag param-preview
<self> "{R.view}: {JSON.stringify(R.params).replace(/"/g, ' ')}"
extend tag view-home
<self>
"What is "
<b> "pro-router"
" you can see here: "
<a href="http://router.maniak.pro"> "router.maniak.pro"
<br>
"What is "
<a href="https://imba.io"> "imba"
" you surely know."
<br>
"This package integrates both."
<br>
<br>
"Go to your project directory and run:"
<br>
<br>
<code> "npm install pro-router-imba2 --save"
tag view-installation
<self>
"For your convenience package provides "
<b> "vite plugin"
" and installation command"
"."
<br>
"Vite plugin will automatically define views for the router. Thanks to pro-router paradigm you will not write route definitions at all."
<br>
<br>
"1. Create imba project (or go to directory of an existing one):"
<br>
<pre><code>
"""
npx imba create my-app
cd my-app
npm install
"""
<br>
"2. Install pro-router-imba2 and run development server:"
<pre><code>
"""
npm install pro-router-imba2 --save
npx pro-router init
npm run dev
"""
<br>
"3. Add "
<.bordered> "<pro-router>"
" component to your app (in "
<.bordered> "src/main.imba"
" file)."
<br>
"The simplest application would look like this:"
<imba-code file='src/main.imba'>
"""
imba{<c-op> '.'}mount {<c-tag> 'pro-router'}
"""
<br>
"A bit more complex example:"
<imba-code>
"""
{<c-tag-def> 'my-app'}
{<c-tag> 'self'}
{<c-tag> "pro-ref{<c-el> ' view'}{<c-op> '='}{<c-el> 'v'}"} {<c-op> 'for'} v {<c-op> 'in'} {<c-c> 'R'}{<c-op> '.'}views {<c-com> 'render menu'}
{<c-tag> "pro-router"} {<c-com> 'slot for current view'}
{<c-tag-def> 'view-home'}
{<c-tag> 'self'} 'Hello World!'
{<c-tag-def> 'view-another-view'}
{<c-tag> 'self'} 'This is another view.'
imba{<c-op> '.'}mount {<c-tag> 'my-app'}
"""
<br>
"4. Everything is already set."
tag imba-code < pre
prop file
css bgc:gray8 d:block
code bd:0 rd:0
&.file bgc:amber3 d:block
&.content c:gray3
<self>
<code.file> file if file
<code.content><slot>
tag c-el
css d:inline c:gray3
tag c-op < c-el
css c:white fw:bold
tag c-c < c-el
css c:blue3
tag c-com < c-el
css c:gray5
<self>
"# "
<slot>
###
tag c-class < c-el
<self[c:amber4]>
<c-dot>
<slot>
###
tag c-tag < c-el
<self[c:white]>
"<"
<[c:blue4 d:inline]><slot>
">"
tag c-tag-def < c-el
<self[c:blue4]>
"tag "
<[c:green5 d:inline]><slot>
tag view-usage
<self> "List of components"
tag view-examples
<self> "Examples:"
tag view-why-to-use-it
<self> "Why?"
imba.mount <App> if import.meta.env.MODE is 'development' imba.mount <App> if import.meta.env.MODE is 'development'
Loading…
Cancel
Save