0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-02 12:28:54 -05:00

📚 Update documentation.

This commit is contained in:
Andrey Antukh 2020-08-18 19:40:49 +02:00
parent 6c67c3c71b
commit c2fe4b0ccc
4 changed files with 62 additions and 66 deletions

View file

@ -13,7 +13,7 @@ you can emit the event to reset zoom level by typing this at the
console (there is autocompletion for help): console (there is autocompletion for help):
```javascript ```javascript
uxbox.main.store.emit_BANG_(uxbox.main.data.workspace.reset_zoom) app.main.store.emit_BANG_(app.main.data.workspace.reset_zoom)
``` ```
@ -26,7 +26,7 @@ some annotations on screen, to help understanding what's happening.
To activate it, open the javascript console and type To activate it, open the javascript console and type
```javascript ```javascript
uxbox.util.debug.toggle_debug("option") app.util.debug.toggle_debug("option")
``` ```
Current options are `bounding-boxes`, `group`, `events` and Current options are `bounding-boxes`, `group`, `events` and
@ -35,8 +35,8 @@ Current options are `bounding-boxes`, `group`, `events` and
You can also activate or deactivate all visual aids with You can also activate or deactivate all visual aids with
```javascript ```javascript
uxbox.util.debug.debug_all() app.util.debug.debug_all()
uxbox.util.debug.debug_none() app.util.debug.debug_none()
``` ```
@ -46,11 +46,11 @@ There are also some useful functions to visualize the global state or
any complex object. To use them from clojure: any complex object. To use them from clojure:
```clojure ```clojure
(ns uxbox.util.debug) (ns app.util.debug)
(logjs <msg> <var>) ; to print the value of a variable (logjs <msg> <var>) ; to print the value of a variable
(tap <fn>) ; to include a function with side effect (e.g. logjs) in a transducer. (tap <fn>) ; to include a function with side effect (e.g. logjs) in a transducer.
(ns uxbox.main.store) (ns app.main.store)
(dump-state) ; to print in console all the global state (dump-state) ; to print in console all the global state
(dump-objects) ; to print in console all objects in workspace (dump-objects) ; to print in console all objects in workspace
``` ```
@ -58,8 +58,8 @@ any complex object. To use them from clojure:
But last ones are most commonly used from javscript console: But last ones are most commonly used from javscript console:
``` ```
uxbox.main.store.dump_state() app.main.store.dump_state()
uxbox.main.store.dump_objects() app.main.store.dump_objects()
``` ```
@ -71,17 +71,17 @@ format located in `resources/images/icons`. The gulp task will
generate the sprite and the embedd it into the `index.html`. generate the sprite and the embedd it into the `index.html`.
Then, you can reference the icon from the sprite using the Then, you can reference the icon from the sprite using the
`uxbox.builtins.icons/icon-xref` macro: `app.builtins.icons/icon-xref` macro:
```clojure ```clojure
(ns some.namespace (ns some.namespace
(:require-macros [uxbox.builtins.icons :refer [icon-xref]])) (:require-macros [app.main.ui.icons :refer [icon-xref]]))
(icon-xref :arrow) (icon-xref :arrow)
``` ```
For performance reasons, all used icons are statically defined in the For performance reasons, all used icons are statically defined in the
`src/uxbox/buitings/icons.cljs` file. `src/app/main/ui/icons.cljs` file.
@ -96,7 +96,7 @@ looks like this:
```json ```json
{ {
"auth.email-or-username" : { "auth.email-or-username" : {
"used-in" : [ "src/uxbox/main/ui/auth/login.cljs:61" ], "used-in" : [ "src/app/main/ui/auth/login.cljs:61" ],
"translations" : { "translations" : {
"en" : "Email or Username", "en" : "Email or Username",
"fr" : "adresse email ou nom d'utilisateur" "fr" : "adresse email ou nom d'utilisateur"
@ -140,7 +140,7 @@ command for reformat the file, and track the usage locations (the
"used-in" list) before commiting the file into the repository: "used-in" list) before commiting the file into the repository:
```bash ```bash
clojure -Adev locales.clj collect src/uxbox/main/ resources/locales.json clojure -Adev locales.clj collect src/app/main/ resources/locales.json
``` ```
NOTE: Later, we will need to think and implement the way to export and NOTE: Later, we will need to think and implement the way to export and
@ -154,11 +154,11 @@ You have two aproaches for translate strings: one for general purpose
and other specific for React components (that leverages reactivity for and other specific for React components (that leverages reactivity for
language changes). language changes).
The `uxbox.util.i18n/tr` is the general purpose function. This is a The `app.util.i18n/tr` is the general purpose function. This is a
simple use case example: simple use case example:
```clojure ```clojure
(require '[uxbox.util.i18n :refer [tr]) (require '[app.util.i18n :refer [tr])
(tr "auth.email-or-username") (tr "auth.email-or-username")
;; => "Email or Username" ;; => "Email or Username"
@ -169,7 +169,7 @@ need to pass an additional parameter marked as counter in order to
allow the system know when to show the plural: allow the system know when to show the plural:
```clojure ```clojure
(require '[uxbox.util.i18n :as i18n :refer [tr]]) (require '[app.util.i18n :as i18n :refer [tr]])
(tr "ds.num-projects" (i18n/c 10)) (tr "ds.num-projects" (i18n/c 10))
;; => "10 projects" ;; => "10 projects"
@ -178,11 +178,11 @@ allow the system know when to show the plural:
;; => "1 project" ;; => "1 project"
``` ```
For React components, you have `uxbox.util.i18n/use-locale` hook For React components, you have `app.util.i18n/use-locale` hook
and the `uxbox.util.i18n/t` function: and the `app.util.i18n/t` function:
```clojure ```clojure
(require '[uxbox.util.i18n :as i18n :refer [t]]) (require '[app.util.i18n :as i18n :refer [t]])
(mf/defc my-component (mf/defc my-component
[props] [props]

View file

@ -11,7 +11,7 @@ good amount of content (usually used for just test the application or
perform performance tweaks on queries). perform performance tweaks on queries).
In order to load fixtures, enter to the REPL environment executing the In order to load fixtures, enter to the REPL environment executing the
`bin/repl` script, and then execute `(uxbox.fixtures/run {:preset :small})`. `bin/repl` script, and then execute `(app.cli.fixtures/run {:preset :small})`.
You also can execute this as a standalone script with: You also can execute this as a standalone script with:
@ -34,8 +34,8 @@ If you have a REPL access to the running process, you can execute it
from there: from there:
```clojure ```clojure
(require 'uxbox.fixtures) (require 'app.cli.fixtures)
(uxbox.fixtures/run :small) (app.cli.fixtures/run :small)
``` ```
To access to the running process repl you usually will execute this To access to the running process repl you usually will execute this

View file

@ -19,7 +19,7 @@ Example:
This asserts are only executed on development mode. On production This asserts are only executed on development mode. On production
environment all assets like this will be ignored by runtime. environment all assets like this will be ignored by runtime.
**spec/assert**: using the `uxbox.common.spec/assert` macro. **spec/assert**: using the `app.common.spec/assert` macro.
Also, if you are using clojure.spec, you have the spec based Also, if you are using clojure.spec, you have the spec based
`clojure.spec.alpha/assert` macro. In the same way as the `clojure.spec.alpha/assert` macro. In the same way as the
@ -30,7 +30,7 @@ Example:
````clojure ````clojure
(require '[clojure.spec.alpha :as s] (require '[clojure.spec.alpha :as s]
'[uxbox.common.spec :as us]) '[app.common.spec :as us])
(s/def ::number number?) (s/def ::number number?)
@ -46,14 +46,14 @@ completely removed.
Example: Example:
```clojure ```clojure
(require '[uxbox.common.spec :as us]) (require '[app.common.spec :as us])
(us/verify ::number 3) (us/verify ::number 3)
``` ```
This macro enables you have assetions on production code. This macro enables you have assetions on production code.
**Why don't use the `clojure.spec.alpha/assert` instead of the `uxbox.common.spec/assert`?** **Why don't use the `clojure.spec.alpha/assert` instead of the `app.common.spec/assert`?**
The uxbox variant does not peforms additional runtime checks for know The uxbox variant does not peforms additional runtime checks for know
if asserts are disabled in "runtime". As a result it generates much if asserts are disabled in "runtime". As a result it generates much

View file

@ -4,12 +4,8 @@
## Frontend configuration parameters ## ## Frontend configuration parameters ##
**Only available at build time!** Not needed.
- `-e UXBOX_PUBLIC_URI=...` (defaults to `http://localhost:6060`)
- `-e UXBOX_GOOGLE_CLIENT_ID=...` (defaults to `true`)
- `-e UXBOX_LOGIN_WITH_LDAP=...` (defaults to `false`)
- `-e UXBOX_DEMO_WARNING=...` (defaults to `true`)
## Backend configuration parameters ## ## Backend configuration parameters ##
@ -21,41 +17,41 @@ environment variables.
This is a probably incomplete list of available options (with This is a probably incomplete list of available options (with
respective defaults): respective defaults):
- `UXBOX_HTTP_SERVER_PORT=6060` - `APP_HTTP_SERVER_PORT=6060`
- `UXBOX_PUBLIC_URI=http://localhost:3449` - `APP_PUBLIC_URI=http://localhost:3449`
- `UXBOX_DATABASE_USERNAME=` (default undefined, used from uri) - `APP_DATABASE_USERNAME=` (default undefined, used from uri)
- `UXBOX_DATABASE_PASSWORD=` (default undefined, used from uri) - `APP_DATABASE_PASSWORD=` (default undefined, used from uri)
- `UXBOX_DATABASE_URI=postgresql://127.0.0.1/uxbox` - `APP_DATABASE_URI=postgresql://127.0.0.1/app`
- `UXBOX_MEDIA_DIRECTORY=resources/public/media` - `APP_MEDIA_DIRECTORY=resources/public/media`
- `UXBOX_MEDIA_URI=http://localhost:6060/media/` - `APP_MEDIA_URI=http://localhost:6060/media/`
- `UXBOX_ASSETS_DIRECTORY=resources/public/static` - `APP_ASSETS_DIRECTORY=resources/public/static`
- `UXBOX_ASSETS_URI=ehttp://localhost:6060/static/` - `APP_ASSETS_URI=ehttp://localhost:6060/static/`
- `UXBOX_SENDMAIL_BACKEND=console` - `APP_SENDMAIL_BACKEND=console`
- `UXBOX_SENDMAIL_REPLY_TO=no-reply@nodomain.com` - `APP_SENDMAIL_REPLY_TO=no-reply@nodomain.com`
- `UXBOX_SENDMAIL_FROM=no-reply@nodomain.com` - `APP_SENDMAIL_FROM=no-reply@nodomain.com`
- `UXBOX_SMTP_HOST=` (default undefined) - `APP_SMTP_HOST=` (default undefined)
- `UXBOX_SMTP_PORT=` (default undefined) - `APP_SMTP_PORT=` (default undefined)
- `UXBOX_SMTP_USER=` (default undefined) - `APP_SMTP_USER=` (default undefined)
- `UXBOX_SMTP_PASSWORD=` (default undefined) - `APP_SMTP_PASSWORD=` (default undefined)
- `UXBOX_SMTP_SSL=` (default to `false`) - `APP_SMTP_SSL=` (default to `false`)
- `UXBOX_SMTP_TLS=` (default to `false`) - `APP_SMTP_TLS=` (default to `false`)
- `UXBOX_REGISTRATION_ENABLED=true` - `APP_REGISTRATION_ENABLED=true`
- `UXBOX_REGISTRATION_DOMAIN_WHITELIST=""` (comma-separated domains, defaults to `""` which means that all domains are allowed) - `APP_REGISTRATION_DOMAIN_WHITELIST=""` (comma-separated domains, defaults to `""` which means that all domains are allowed)
- `UXBOX_DEBUG_HUMANIZE_TRANSIT=true` - `APP_DEBUG_HUMANIZE_TRANSIT=true`
- `UXBOX_LDAP_AUTH_HOST=` (default undefined) - `APP_LDAP_AUTH_HOST=` (default undefined)
- `UXBOX_LDAP_AUTH_PORT=` (default undefined) - `APP_LDAP_AUTH_PORT=` (default undefined)
- `UXBOX_LDAP_AUTH_VERSION=3` - `APP_LDAP_AUTH_VERSION=3`
- `UXBOX_LDAP_BIND_DN=` (default undefined) - `APP_LDAP_BIND_DN=` (default undefined)
- `UXBOX_LDAP_BIND_PASSWORD=` (default undefined) - `APP_LDAP_BIND_PASSWORD=` (default undefined)
- `UXBOX_LDAP_AUTH_SSL=` (default `false`) - `APP_LDAP_AUTH_SSL=` (default `false`)
- `UXBOX_LDAP_AUTH_STARTTLS=` (default `false`) - `APP_LDAP_AUTH_STARTTLS=` (default `false`)
- `UXBOX_LDAP_AUTH_BASE_DN=` (default undefined) - `APP_LDAP_AUTH_BASE_DN=` (default undefined)
- `UXBOX_LDAP_AUTH_USER_QUERY=(|(uid=$username)(mail=$username))` - `APP_LDAP_AUTH_USER_QUERY=(|(uid=$username)(mail=$username))`
- `UXBOX_LDAP_AUTH_USERNAME_ATTRIBUTE=uid` - `APP_LDAP_AUTH_USERNAME_ATTRIBUTE=uid`
- `UXBOX_LDAP_AUTH_EMAIL_ATTRIBUTE=mail` - `APP_LDAP_AUTH_EMAIL_ATTRIBUTE=mail`
- `UXBOX_LDAP_AUTH_FULLNAME_ATTRIBUTE=displayName` - `APP_LDAP_AUTH_FULLNAME_ATTRIBUTE=displayName`
- `UXBOX_LDAP_AUTH_AVATAR_ATTRIBUTE=jpegPhoto` - `APP_LDAP_AUTH_AVATAR_ATTRIBUTE=jpegPhoto`
## REPL ## ## REPL ##
@ -102,6 +98,6 @@ clojure -Adev -X:fn-media-loader :path ../path/to/config.edn
If you have a REPL access to the running process, you can execute it from there: If you have a REPL access to the running process, you can execute it from there:
```clojure ```clojure
(require 'uxbox.media-loader) (require 'app.cli.media-loader)
(uxbox.media-loader/run* "/path/to/config.edn") (uxbox.media-loader/run* "/path/to/config.edn")
``` ```