From 8ff599c0f2b329d13b40f1256ae2ead5c1c1691a Mon Sep 17 00:00:00 2001 From: Marek Piasecki Date: Wed, 18 Jan 2023 19:10:14 +0100 Subject: [PATCH] finish usage description --- src/main.imba | 14 ++++- src/views.json | 2 +- src/views/usage.imba | 130 ++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 141 insertions(+), 5 deletions(-) diff --git a/src/main.imba b/src/main.imba index 2db5eba..833b577 100644 --- a/src/main.imba +++ b/src/main.imba @@ -6,7 +6,7 @@ global css .activated bgc:violet3 .disabled, .disabled@hover filter:grayscale(100%) .zoomed scale:1.05 - .button d:inline-block m:2px bgc:none c:violet7 td:none bxs:sm us:none + .button d:inline-block m:2px bgc:none c:violet7 td:none bxs:sm us:none cursor:pointer .button@hover, .button.active bxs:md filter:hue-rotate(5deg) mb:0px pt: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 @@ -56,11 +56,17 @@ tag imba-code < pre <.url> url if url +tag code-inline < imba-code + css + d:inline + code d:inline-block tag c-el css d:inline c:gray3 tag c-op < c-el css c:white fw:bold +tag c-fl < c-el + css c:purple5 tag c-c < c-el css c:blue3 tag c-com < c-el @@ -82,6 +88,10 @@ tag c-tag-def < c-el "tag " <[c:green5 d:inline]> +tag c-let < c-el + + "let " + tag pro-tip @@ -92,7 +102,7 @@ import './views/home.imba' import './views/installation.imba' import './views/usage.imba' -tag view-examples +tag view-use-cases "Examples:" tag view-why-to-use-it diff --git a/src/views.json b/src/views.json index 4af5974..3d0d18e 100644 --- a/src/views.json +++ b/src/views.json @@ -1 +1 @@ -["home","examples","why-to-use-it","installation","usage"] \ No newline at end of file +["home","use-cases","why-to-use-it","installation","usage"] \ No newline at end of file diff --git a/src/views/usage.imba b/src/views/usage.imba index a9ee512..de4d474 100644 --- a/src/views/usage.imba +++ b/src/views/usage.imba @@ -3,6 +3,12 @@ tag view-usage "This integration provides " 3 " components:" + "ref" + ", " + "toggle" + " and " + "router" + "."

<.bordered> "" @@ -98,12 +104,12 @@ tag view-usage """
"A bit more complex example:" - + """ { 'my-app'} { 'self'} { "pro-ref-f{ ' view'}{ '='}{ 'v'}"} { 'for'} v { 'in'} { 'R'}{ '.'}views { 'render menu'} - { "pro-router"} { 'slot for current view'} + { "pro-router"} { 'slot for current view'} { 'view-hello'} { 'self'} 'Hello World!' @@ -123,7 +129,127 @@ tag view-usage "pro-router{ ' view'}{ '='}{ 'R'}{ '.'}param{<.c-br> '('}{ 'subview'}{<.c-br> ')'}"
+ "Pro-router tips" + "Further reading is not about functionalities provided by this package itself but the ones you will be using straight from pro-router." +
+
+ <.example> + "{ 'R'}{ '.'}param{<.c-br> '('}{ 'key'}{<.c-br> ')'}" +

+ "Use it to receive param value for given { 'key' }." +
+ "Value will be automatically processed with key { 'getter' } if provided." +
+ "It's awesome because you immidietaly work on a real object." +
+ + <.example> + "{ 'R'}{ '.'}params{ '.'}key" +

"You can ommit getter by going straight for the parameter." +
+
+ <.example> + "{ 'R'}{ '.'}write{<.c-br> '('}{ 'key'}{ ','} value{<.c-br> ')'}" +

+ "Use it to store the { 'value' } under given param { 'key' }." +
+ "Value will be automatically processed with key { 'setter' } if provided." +
+ "It's awesome because you can easily store anything in a nice format this way." + + "Writing doesn't change browser history. This way you can bind directly user input to url." + + "input{ '$v'} type{ '='}{ 'text'} value{ '='}{ 'R'}{ '.'}param{<.c-br> '('}{ 'user-input'}{<.c-br> ')'} { '@keyup='}{ 'R'}{ '.'}write{<.c-br> '('}{ 'user-input'}{ ', '}{ '$v'}{ '.'}value{<.c-br> ')'}" + + + "Using getters and setters" + "This is very simple yet powerful feature which can fullfil many different functions." +
+
+ "Format a nice url:" + + "{ 'R'}{ '.'}setters{ '.'}title { '='} { 'do'} { '|'}{ 'v' }{ '|'} v{ '.'}replaceAll{<.c-br> '('}{ ' '}{ ', '}{ '-'}{<.c-br> ')'}" +
+ "{ 'R'}{ '.'}getters{ '.'}title { '='} { 'do'} { '|'}{ 'v' }{ '|'} v{ '.'}replaceAll{<.c-br> '('}{ '-'}{ ', '}{ ' '}{<.c-br> ')'}" + + +