@lowdefy/docs-content 0.0.0-experimental-20260928120643 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/content/actions/link.md +0 -17
- package/content/actions/login.md +5 -23
- package/content/actions/logout.md +5 -5
- package/content/actions/pdfmake.md +2 -2
- package/content/actions/setdarkmode.md +2 -2
- package/content/agents/agent-properties.md +2 -4
- package/content/agents/agentchat.md +6 -21
- package/content/agents/agentconversations.md +2 -2
- package/content/concepts/ai-agent-docs.md +101 -313
- package/content/concepts/cli.md +3 -34
- package/content/concepts/connections-and-requests.md +0 -402
- package/content/concepts/custom-html.md +0 -40
- package/content/concepts/custom-styling.md +5 -50
- package/content/concepts/events-and-actions.md +2 -64
- package/content/concepts/i18n.md +2 -7
- package/content/concepts/keyboard-shortcuts.md +2 -2
- package/content/concepts/layout-overview.md +1 -1
- package/content/concepts/logger.md +0 -81
- package/content/concepts/lowdefy-schema.md +1 -4
- package/content/concepts/menus.md +7 -7
- package/content/concepts/module-authoring.md +2 -2
- package/content/connections/anthropic.md +2 -162
- package/content/connections/awss3.md +0 -54
- package/content/connections/google.md +2 -162
- package/content/connections/mongodb.md +3 -121
- package/content/connections/openai-connection.md +2 -162
- package/content/container-blocks/affix.md +7 -47
- package/content/container-blocks/alert.md +24 -76
- package/content/container-blocks/badge.md +24 -100
- package/content/container-blocks/box.md +9 -9
- package/content/container-blocks/card.md +25 -80
- package/content/container-blocks/carousel.md +7 -60
- package/content/container-blocks/collapse.md +9 -87
- package/content/container-blocks/configprovider.md +13 -35
- package/content/container-blocks/confirmmodal.md +23 -69
- package/content/container-blocks/content.md +98 -62
- package/content/container-blocks/descriptions.md +4 -45
- package/content/container-blocks/drawer.md +28 -92
- package/content/container-blocks/dropdownmenu.md +31 -119
- package/content/container-blocks/flex.md +62 -40
- package/content/container-blocks/footer.md +11 -15
- package/content/container-blocks/googlemapsheatmap.md +1 -1
- package/content/container-blocks/googlemapsscript.md +2 -2
- package/content/container-blocks/header.md +36 -71
- package/content/container-blocks/label.md +7 -34
- package/content/container-blocks/layout.md +34 -52
- package/content/container-blocks/masonry.md +71 -17
- package/content/container-blocks/mobilemenu.md +88 -131
- package/content/container-blocks/modal.md +26 -114
- package/content/container-blocks/pageheadermenu.md +31 -81
- package/content/container-blocks/pagesidebarlayout.md +26 -169
- package/content/container-blocks/pagesidermenu.md +42 -95
- package/content/container-blocks/popover.md +31 -34
- package/content/container-blocks/result.md +21 -32
- package/content/container-blocks/sider.md +122 -85
- package/content/container-blocks/span.md +7 -7
- package/content/container-blocks/spinner.md +3 -3
- package/content/container-blocks/splitter.md +68 -150
- package/content/container-blocks/tabs.md +12 -64
- package/content/container-blocks/tooltip.md +46 -22
- package/content/container-blocks/watermark.md +4 -22
- package/content/controls/reject.md +2 -4
- package/content/controls/throw.md +0 -1
- package/content/controls/try.md +2 -3
- package/content/deployment/deployment-environments.md +6 -8
- package/content/deployment/docker.md +7 -22
- package/content/deployment/node-server.md +0 -4
- package/content/deployment/vercel.md +6 -13
- package/content/display-blocks/aggrid.md +11 -26
- package/content/display-blocks/anchor.md +15 -15
- package/content/display-blocks/avatar.md +37 -57
- package/content/display-blocks/breadcrumb.md +21 -70
- package/content/display-blocks/button.md +18 -92
- package/content/display-blocks/calendar.md +0 -12
- package/content/display-blocks/dangeroushtml.md +1 -1
- package/content/display-blocks/difflist.md +1 -1
- package/content/display-blocks/difftimeline.md +1 -1
- package/content/display-blocks/divider.md +3 -64
- package/content/display-blocks/dropdownbutton.md +28 -79
- package/content/display-blocks/echart.md +1 -35
- package/content/display-blocks/floatbutton.md +42 -129
- package/content/display-blocks/html.md +1 -61
- package/content/display-blocks/icon.md +67 -250
- package/content/display-blocks/menu.md +73 -145
- package/content/display-blocks/message.md +124 -38
- package/content/display-blocks/notification.md +222 -94
- package/content/display-blocks/paragraph.md +9 -59
- package/content/display-blocks/progress.md +17 -96
- package/content/display-blocks/qrcode.md +4 -19
- package/content/display-blocks/s3download.md +1 -1
- package/content/display-blocks/search.md +7 -17
- package/content/display-blocks/skeletonbutton.md +0 -1
- package/content/display-blocks/skeletoninput.md +0 -1
- package/content/display-blocks/statistic.md +17 -75
- package/content/display-blocks/steps.md +25 -58
- package/content/display-blocks/tag.md +17 -102
- package/content/display-blocks/title.md +11 -50
- package/content/display-blocks/tour.md +23 -33
- package/content/input-blocks/autocomplete.md +9 -81
- package/content/input-blocks/buttonselector.md +8 -45
- package/content/input-blocks/checkboxselector.md +7 -97
- package/content/input-blocks/checkboxswitch.md +3 -33
- package/content/input-blocks/colorselector.md +14 -63
- package/content/input-blocks/daterangeselector.md +45 -165
- package/content/input-blocks/dateselector.md +41 -139
- package/content/input-blocks/datetimeselector.md +49 -158
- package/content/input-blocks/inputgallery.md +3 -3
- package/content/input-blocks/monthselector.md +52 -120
- package/content/input-blocks/multipleselector.md +39 -150
- package/content/input-blocks/numberinput.md +12 -98
- package/content/input-blocks/pagination.md +14 -70
- package/content/input-blocks/paragraphinput.md +37 -51
- package/content/input-blocks/passwordinput.md +6 -60
- package/content/input-blocks/phonenumberinput.md +26 -59
- package/content/input-blocks/radioselector.md +7 -83
- package/content/input-blocks/ratingslider.md +26 -57
- package/content/input-blocks/s3uploadbutton.md +24 -24
- package/content/input-blocks/s3uploaddragger.md +3 -3
- package/content/input-blocks/s3uploadphoto.md +5 -5
- package/content/input-blocks/segmentedselector.md +32 -72
- package/content/input-blocks/selector.md +21 -109
- package/content/input-blocks/switch.md +17 -65
- package/content/input-blocks/textarea.md +3 -32
- package/content/input-blocks/textinput.md +28 -69
- package/content/input-blocks/tiptapmentioninput.md +1 -1
- package/content/input-blocks/titleinput.md +12 -39
- package/content/input-blocks/treeinput.md +25 -49
- package/content/input-blocks/treemultipleselector.md +10 -127
- package/content/input-blocks/treeselector.md +9 -97
- package/content/input-blocks/upload.md +15 -64
- package/content/input-blocks/uploaddragger.md +1 -17
- package/content/input-blocks/uploadphoto.md +1 -18
- package/content/input-blocks/weekselector.md +55 -120
- package/content/list-blocks/controlledlist.md +15 -24
- package/content/list-blocks/list.md +11 -11
- package/content/list-blocks/masonrylist.md +34 -7
- package/content/migration/upgrade-guide.md +0 -1
- package/content/operators/_app.md +1 -2
- package/content/operators/_error.md +1 -23
- package/content/operators/_get.md +6 -6
- package/content/operators/_operator.md +3 -17
- package/content/operators/_ref.md +0 -258
- package/content/operators/_type.md +3 -14
- package/content/operators/_user.md +3 -3
- package/content/other/introduction.md +1 -1
- package/content/plugins/plugins-dev.md +0 -66
- package/content/plugins/plugins-introduction.md +1 -27
- package/content/testing/e2e-configuration.md +1 -8
- package/content/testing/e2e-getting-started.md +1 -1
- package/content/testing/e2e-introduction.md +1 -1
- package/content/tutorial/tutorial-actions-operators.md +2 -2
- package/content/tutorial/tutorial-add-blocks.md +2 -2
- package/content/tutorial/tutorial-create-page.md +2 -48
- package/content/tutorial/tutorial-display-data-page.md +3 -3
- package/content/tutorial/tutorial-requests-sql.md +0 -153
- package/content/tutorial/tutorial-start.md +1 -66
- package/content/user-authentication/login-and-logout.md +8 -158
- package/content/user-authentication/users-introduction.md +0 -8
- package/index.json +2 -6065
- package/package.json +1 -7
- package/scripts/extractAgentDocs.js +4 -36
- package/content/actions/emailotpsend.md +0 -58
- package/content/actions/emailotpverify.md +0 -77
- package/content/actions/getlocalstorage.md +0 -41
- package/content/actions/magiclinkverify.md +0 -113
- package/content/actions/posthogalias.md +0 -29
- package/content/actions/posthogcapture.md +0 -49
- package/content/actions/posthogcapturepageleave.md +0 -38
- package/content/actions/posthogfeatureflag.md +0 -50
- package/content/actions/posthoggroup.md +0 -37
- package/content/actions/posthogidentify.md +0 -54
- package/content/actions/posthoginit.md +0 -66
- package/content/actions/posthogoptin.md +0 -29
- package/content/actions/posthogoptout.md +0 -29
- package/content/actions/posthogpageview.md +0 -37
- package/content/actions/posthogreloadfeatureflags.md +0 -47
- package/content/actions/posthogreset.md +0 -28
- package/content/actions/posthogsetpersonproperties.md +0 -36
- package/content/actions/removelocalstorage.md +0 -26
- package/content/actions/setlocalstorage.md +0 -32
- package/content/adapter-reference/mongodbauthadapter.md +0 -46
- package/content/agents/agents-introduction.md +0 -107
- package/content/callback-reference/auth0logoutcallback.md +0 -54
- package/content/concepts/blocks.md +0 -150
- package/content/concepts/dynamic-page-content.md +0 -304
- package/content/concepts/html-attributes.md +0 -285
- package/content/concepts/lowdefy-api.md +0 -1110
- package/content/concepts/notifications.md +0 -155
- package/content/concepts/page-and-app-state.md +0 -244
- package/content/concepts/theming.md +0 -582
- package/content/connections/aigateway.md +0 -368
- package/content/connections/axioshttp.md +0 -181
- package/content/controls/while.md +0 -46
- package/content/display-blocks/clickablehtml.md +0 -239
- package/content/display-blocks/eventlog.md +0 -363
- package/content/display-blocks/pollingtimer.md +0 -263
- package/content/input-blocks/captcha.md +0 -40
- package/content/input-blocks/placesautocomplete.md +0 -319
- package/content/input-blocks/tagmultipleselector.md +0 -114
- package/content/input-blocks/tagselector.md +0 -114
- package/content/migration/auth-upgrade.md +0 -327
- package/content/migration/v3-to-v4.md +0 -417
- package/content/migration/v6-to-v7.md +0 -222
- package/content/operators/_cron.md +0 -292
- package/content/other/mongodbadapter.md +0 -3
- package/content/plugins/plugins-icon-sets.md +0 -267
- package/content/plugins/posthog.md +0 -275
- package/content/provider-reference/auth-js-providers.md +0 -107
- package/content/provider-reference/openidconnectprovider.md +0 -44
- package/content/testing/config-tests.md +0 -278
- package/content/tutorial/tutorial-requests-api.md +0 -155
- package/content/user-authentication/auth-configuration.md +0 -266
- package/content/user-authentication/auth-steps.md +0 -138
- package/content/user-authentication/mcp-oauth.md +0 -292
- package/content/user-authentication/organizations.md +0 -221
- package/content/user-authentication/protected-pages-apis.md +0 -97
- package/content/user-authentication/roles.md +0 -49
- package/content/user-authentication/two-factor.md +0 -229
- package/content/user-authentication/user-object.md +0 -58
- package/content/websockets/websocket-publish.md +0 -108
- package/content/websockets/websocket-subscriptions.md +0 -100
- package/content/websockets/websockets-introduction.md +0 -97
- package/hazards.json +0 -44
- package/scripts/hashDocSources.js +0 -38
- package/scripts/recordSourceHashes.js +0 -88
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
# _cron
|
|
2
|
-
|
|
3
|
-
The `_cron` operator works with [cron expressions](https://en.wikipedia.org/wiki/Cron#CRON_expression). It can calculate the next and previous occurrences of a schedule, describe a schedule in a human readable sentence, test if an expression is valid, and return the parsed fields of an expression.
|
|
4
|
-
|
|
5
|
-
A cron expression has five fields, `minute hour day-of-month month day-of-week`, and an optional leading seconds field. For example, `0 9 * * 1` is "At 09:00 AM, only on Monday".
|
|
6
|
-
|
|
7
|
-
The supported syntax is:
|
|
8
|
-
- `*` for any value, `?` as an alias of `*`, lists like `1,3,5`, ranges like `1-5` and steps like `*/15` or `0-30/10`.
|
|
9
|
-
- Month names (`JAN` to `DEC`) and day names (`SUN` to `SAT`). Day of week `0` and `7` are both Sunday.
|
|
10
|
-
- `L` for the last day of the month in the day-of-month field, and `5L` for the last Friday of the month in the day-of-week field.
|
|
11
|
-
- `#` for the nth weekday of the month, like `1#2` for the second Monday.
|
|
12
|
-
- The aliases `@yearly`, `@annually`, `@monthly`, `@weekly`, `@daily`, `@hourly`, `@minutely`, `@secondly`, `@weekdays` and `@weekends`.
|
|
13
|
-
|
|
14
|
-
The Jenkins style `H` hash token is not supported, since it would pick a different random time each time the operator is evaluated. `W` (nearest weekday), a year field and `@reboot` are not supported either. A blank expression (`""` or only whitespace) is treated as a missing expression.
|
|
15
|
-
|
|
16
|
-
When both day-of-month and day-of-week are restricted, an occurrence matches either of them, as in standard cron.
|
|
17
|
-
|
|
18
|
-
> `_cron` accepts a wider grammar than the `schedules` of [scheduled endpoints](/api#scheduled-endpoints-cron), which only accept five numeric fields and can not restrict day-of-month and day-of-week together. An expression that `_cron.validate` accepts is not always a valid endpoint schedule.
|
|
19
|
-
|
|
20
|
-
Every method takes the cron expression as a string, or as the `expression` property of an object when more arguments are needed:
|
|
21
|
-
|
|
22
|
-
```yaml
|
|
23
|
-
_cron.next: 0 9 * * 1
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
```yaml
|
|
27
|
-
_cron.next:
|
|
28
|
-
expression: 0 9 * * 1
|
|
29
|
-
timezone: Europe/London
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
This operator is provided by the `@lowdefy/operators-cron` plugin package.
|
|
33
|
-
|
|
34
|
-
# Operator methods:
|
|
35
|
-
|
|
36
|
-
## _cron.next
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
(expression: string): date
|
|
40
|
-
(arguments: {
|
|
41
|
-
expression: string,
|
|
42
|
-
from?: date | string,
|
|
43
|
-
timezone?: string,
|
|
44
|
-
count?: integer
|
|
45
|
-
}): date | date[]
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
The `_cron.next` method returns the next occurrence of a cron expression after the `from` date. An occurrence exactly at `from` is not included. When `count` is greater than 1, an array of the next `count` occurrences is returned, in chronological order.
|
|
49
|
-
|
|
50
|
-
On a daylight saving time change in the evaluated `timezone`, a time that is skipped when the clocks go forward runs an hour later, and a time that repeats when the clocks go back runs once, at its first occurrence. Schedules that run every hour or more often run through both repeated hours.
|
|
51
|
-
|
|
52
|
-
An error is thrown if the cron expression is missing, is invalid, or never occurs (like `0 0 31 2 *`).
|
|
53
|
-
|
|
54
|
-
#### Arguments
|
|
55
|
-
|
|
56
|
-
###### expression
|
|
57
|
-
The cron expression, for example `0 9 * * 1`. Required.
|
|
58
|
-
|
|
59
|
-
###### from
|
|
60
|
-
The date to calculate the next occurrence from, as a date or an ISO 8601 date string like `2024-01-01` or `2024-01-01T09:00:00Z`. Other date strings are not accepted, since JavaScript engines parse them differently. Defaults to the current date and time.
|
|
61
|
-
|
|
62
|
-
###### timezone
|
|
63
|
-
The [IANA timezone name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones), for example `Europe/London`, that the cron expression is evaluated in. Defaults to the timezone of the environment that evaluates the operator.
|
|
64
|
-
|
|
65
|
-
###### count
|
|
66
|
-
The number of occurrences to return, an integer from 1 to 1000. A `count` of 1 returns a single date, a `count` greater than 1 returns an array of dates. Defaults to 1.
|
|
67
|
-
|
|
68
|
-
#### Examples
|
|
69
|
-
|
|
70
|
-
###### Next occurrence:
|
|
71
|
-
```yaml
|
|
72
|
-
_cron.next: 0 9 * * 1
|
|
73
|
-
```
|
|
74
|
-
Returns: The date of the next Monday at 09:00.
|
|
75
|
-
|
|
76
|
-
###### Next occurrence in a timezone, from a given date:
|
|
77
|
-
```yaml
|
|
78
|
-
_cron.next:
|
|
79
|
-
expression: 0 9 * * 1
|
|
80
|
-
from:
|
|
81
|
-
_date: 2024-01-01T00:00:00.000Z
|
|
82
|
-
timezone: UTC
|
|
83
|
-
```
|
|
84
|
-
Returns: `2024-01-01T09:00:00.000Z`
|
|
85
|
-
|
|
86
|
-
###### The next three occurrences:
|
|
87
|
-
```yaml
|
|
88
|
-
_cron.next:
|
|
89
|
-
expression: 0 9 * * 1
|
|
90
|
-
from:
|
|
91
|
-
_date: 2024-01-01T00:00:00.000Z
|
|
92
|
-
timezone: UTC
|
|
93
|
-
count: 3
|
|
94
|
-
```
|
|
95
|
-
Returns: `[2024-01-01T09:00:00.000Z, 2024-01-08T09:00:00.000Z, 2024-01-15T09:00:00.000Z]`
|
|
96
|
-
|
|
97
|
-
## _cron.previous
|
|
98
|
-
|
|
99
|
-
```
|
|
100
|
-
(expression: string): date
|
|
101
|
-
(arguments: {
|
|
102
|
-
expression: string,
|
|
103
|
-
from?: date | string,
|
|
104
|
-
timezone?: string,
|
|
105
|
-
count?: integer
|
|
106
|
-
}): date | date[]
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
The `_cron.previous` method returns the previous occurrence of a cron expression before the `from` date. An occurrence exactly at `from` is not included. When `count` is greater than 1, an array of the previous `count` occurrences is returned, most recent first.
|
|
110
|
-
|
|
111
|
-
An error is thrown if the cron expression is missing, is invalid, or never occurs (like `0 0 31 2 *`).
|
|
112
|
-
|
|
113
|
-
#### Arguments
|
|
114
|
-
|
|
115
|
-
###### expression
|
|
116
|
-
The cron expression, for example `0 9 * * 1`. Required.
|
|
117
|
-
|
|
118
|
-
###### from
|
|
119
|
-
The date to calculate the previous occurrence from, as a date or an ISO 8601 date string like `2024-01-01` or `2024-01-01T09:00:00Z`. Other date strings are not accepted, since JavaScript engines parse them differently. Defaults to the current date and time.
|
|
120
|
-
|
|
121
|
-
###### timezone
|
|
122
|
-
The [IANA timezone name](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones), for example `Europe/London`, that the cron expression is evaluated in. Defaults to the timezone of the environment that evaluates the operator.
|
|
123
|
-
|
|
124
|
-
###### count
|
|
125
|
-
The number of occurrences to return, an integer from 1 to 1000. A `count` of 1 returns a single date, a `count` greater than 1 returns an array of dates. Defaults to 1.
|
|
126
|
-
|
|
127
|
-
#### Examples
|
|
128
|
-
|
|
129
|
-
###### Previous occurrence:
|
|
130
|
-
```yaml
|
|
131
|
-
_cron.previous:
|
|
132
|
-
expression: 0 9 * * 1
|
|
133
|
-
from:
|
|
134
|
-
_date: 2024-01-01T00:00:00.000Z
|
|
135
|
-
timezone: UTC
|
|
136
|
-
```
|
|
137
|
-
Returns: `2023-12-25T09:00:00.000Z`
|
|
138
|
-
|
|
139
|
-
###### The previous three occurrences:
|
|
140
|
-
```yaml
|
|
141
|
-
_cron.previous:
|
|
142
|
-
expression: 0 9 * * 1
|
|
143
|
-
from:
|
|
144
|
-
_date: 2024-01-01T00:00:00.000Z
|
|
145
|
-
timezone: UTC
|
|
146
|
-
count: 3
|
|
147
|
-
```
|
|
148
|
-
Returns: `[2023-12-25T09:00:00.000Z, 2023-12-18T09:00:00.000Z, 2023-12-11T09:00:00.000Z]`
|
|
149
|
-
|
|
150
|
-
## _cron.describe
|
|
151
|
-
|
|
152
|
-
```
|
|
153
|
-
(expression: string): string
|
|
154
|
-
(arguments: {
|
|
155
|
-
expression: string,
|
|
156
|
-
locale?: string,
|
|
157
|
-
verbose?: boolean,
|
|
158
|
-
use24HourTimeFormat?: boolean
|
|
159
|
-
}): string
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
The `_cron.describe` method returns a human readable description of a cron expression, like "At 09:00 AM, only on Monday".
|
|
163
|
-
|
|
164
|
-
An empty string is returned when the expression is `null`, `undefined`, `""` or only whitespace, so the method is safe to use in a label that might not have a schedule yet. Any other expression that `_cron.validate` would return `false` for throws an error, including expressions with the `H` hash token and expressions that never occur.
|
|
165
|
-
|
|
166
|
-
#### Arguments
|
|
167
|
-
|
|
168
|
-
###### expression
|
|
169
|
-
The cron expression, for example `0 9 * * 1`. Required.
|
|
170
|
-
|
|
171
|
-
###### locale
|
|
172
|
-
The locale to describe the expression in, for example `fr`. Defaults to `en`. The supported locale codes are the [cronstrue locales](https://github.com/bradymholt/cRonstrue#supported-locales): `af`, `ar`, `az`, `be`, `bg`, `ca`, `cs`, `da`, `de`, `en`, `es`, `fa`, `fi`, `fr`, `he`, `hr`, `hu`, `id`, `it`, `ja`, `ko`, `my`, `nb`, `nl`, `nn`, `pl`, `pt_BR`, `pt_PT`, `ro`, `ru`, `sk`, `sl`, `sr`, `sv`, `sw`, `tg`, `th`, `tr`, `uk`, `vi`, `zh_CN` and `zh_TW`. Regional codes can be written with a hyphen or an underscore, in any case, so `pt-BR` and `pt_br` are the same as `pt_BR`. An error is thrown for an unsupported locale.
|
|
173
|
-
|
|
174
|
-
All locales are included in the plugin, so there is nothing to install or configure to use them.
|
|
175
|
-
|
|
176
|
-
###### verbose
|
|
177
|
-
Describe the expression in a more verbose sentence. Defaults to `false`.
|
|
178
|
-
|
|
179
|
-
###### use24HourTimeFormat
|
|
180
|
-
Describe times in the 24 hour format. Defaults to the format used by the locale.
|
|
181
|
-
|
|
182
|
-
#### Examples
|
|
183
|
-
|
|
184
|
-
###### Describe a schedule:
|
|
185
|
-
```yaml
|
|
186
|
-
_cron.describe: 0 9 * * 1
|
|
187
|
-
```
|
|
188
|
-
Returns: `"At 09:00 AM, only on Monday"`.
|
|
189
|
-
|
|
190
|
-
###### Describe a schedule in the 24 hour format:
|
|
191
|
-
```yaml
|
|
192
|
-
_cron.describe:
|
|
193
|
-
expression: 0 9 * * 1
|
|
194
|
-
use24HourTimeFormat: true
|
|
195
|
-
```
|
|
196
|
-
Returns: `"At 09:00, only on Monday"`.
|
|
197
|
-
|
|
198
|
-
###### Describe a schedule in another locale:
|
|
199
|
-
```yaml
|
|
200
|
-
_cron.describe:
|
|
201
|
-
expression: 0 9 * * 1
|
|
202
|
-
locale: fr
|
|
203
|
-
```
|
|
204
|
-
Returns: `"À 09:00, uniquement le lundi"`.
|
|
205
|
-
|
|
206
|
-
###### Describe a schedule verbosely:
|
|
207
|
-
```yaml
|
|
208
|
-
_cron.describe:
|
|
209
|
-
expression: '*/5 * * * *'
|
|
210
|
-
verbose: true
|
|
211
|
-
```
|
|
212
|
-
Returns: `"Every 5 minutes, every hour, every day"`.
|
|
213
|
-
|
|
214
|
-
## _cron.validate
|
|
215
|
-
|
|
216
|
-
```
|
|
217
|
-
(expression: any): boolean
|
|
218
|
-
(arguments: { expression: any }): boolean
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
The `_cron.validate` method returns `true` when the cron expression is valid, and `false` when it is not. A missing or blank expression, a value that is not a string, an expression with the `H` hash token and an expression that never occurs (like `0 0 31 2 *`) all return `false`. This method never throws, so it can be used to validate a cron expression captured by an input block.
|
|
222
|
-
|
|
223
|
-
`_cron.validate` checks the `_cron` grammar, which is wider than the `schedules` of [scheduled endpoints](/api#scheduled-endpoints-cron) accept.
|
|
224
|
-
|
|
225
|
-
#### Arguments
|
|
226
|
-
|
|
227
|
-
###### expression
|
|
228
|
-
The cron expression to validate. Any type is accepted.
|
|
229
|
-
|
|
230
|
-
#### Examples
|
|
231
|
-
|
|
232
|
-
###### Validate a schedule:
|
|
233
|
-
```yaml
|
|
234
|
-
_cron.validate: 0 9 * * 1
|
|
235
|
-
```
|
|
236
|
-
Returns: `true`.
|
|
237
|
-
|
|
238
|
-
###### Validate user input:
|
|
239
|
-
```yaml
|
|
240
|
-
- id: schedule
|
|
241
|
-
type: TextInput
|
|
242
|
-
validate:
|
|
243
|
-
- status: error
|
|
244
|
-
message: Not a valid cron expression.
|
|
245
|
-
pass:
|
|
246
|
-
_cron.validate:
|
|
247
|
-
_state: schedule
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
## _cron.fields
|
|
251
|
-
|
|
252
|
-
```
|
|
253
|
-
(expression: string): object
|
|
254
|
-
(arguments: { expression: string }): object
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
The `_cron.fields` method returns the parsed fields of a cron expression as an object with a `second`, `minute`, `hour`, `dayOfMonth`, `month` and `dayOfWeek` key. Each field has the list of `values` it matches, and a `wildcard` boolean that is `true` when the field was given as `*`.
|
|
258
|
-
|
|
259
|
-
An error is thrown if the cron expression is missing, is invalid, or never occurs.
|
|
260
|
-
|
|
261
|
-
#### Arguments
|
|
262
|
-
|
|
263
|
-
###### expression
|
|
264
|
-
The cron expression, for example `0 9 * * 1`. Required.
|
|
265
|
-
|
|
266
|
-
#### Examples
|
|
267
|
-
|
|
268
|
-
###### Fields of a schedule:
|
|
269
|
-
```yaml
|
|
270
|
-
_cron.fields: 0 9 * * 1
|
|
271
|
-
```
|
|
272
|
-
Returns:
|
|
273
|
-
```yaml
|
|
274
|
-
second:
|
|
275
|
-
wildcard: false
|
|
276
|
-
values: [0]
|
|
277
|
-
minute:
|
|
278
|
-
wildcard: false
|
|
279
|
-
values: [0]
|
|
280
|
-
hour:
|
|
281
|
-
wildcard: false
|
|
282
|
-
values: [9]
|
|
283
|
-
dayOfMonth:
|
|
284
|
-
wildcard: true
|
|
285
|
-
values: [1, 2, 3, '...', 31]
|
|
286
|
-
month:
|
|
287
|
-
wildcard: true
|
|
288
|
-
values: [1, 2, 3, '...', 12]
|
|
289
|
-
dayOfWeek:
|
|
290
|
-
wildcard: false
|
|
291
|
-
values: [1]
|
|
292
|
-
```
|
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
# Icon Sets
|
|
2
|
-
|
|
3
|
-
Lowdefy draws icons with [Lucide](https://lucide.dev). An icon-set plugin adds icons as data: a whole set such as Tabler, a few icons of your own, or replacements for Lucide icons. Blocks, Ant Design components and HTML `data-icon` all draw set icons the same way as Lucide icons, with the app's `size`, `strokeWidth` and colour.
|
|
4
|
-
|
|
5
|
-
An icon set holds no React code. Each icon is a plain object that describes its SVG, and the build writes only the icons an app uses into the app bundle.
|
|
6
|
-
|
|
7
|
-
## Declare a set
|
|
8
|
-
|
|
9
|
-
A set has an id in lowercase kebab-case, such as `tabler`. The id is a namespace, so a plugin's `typePrefix` does not change it. Declare it in `types.js` under `iconSets`:
|
|
10
|
-
|
|
11
|
-
```js
|
|
12
|
-
// src/types.js
|
|
13
|
-
export default {
|
|
14
|
-
iconSets: ['tabler'],
|
|
15
|
-
};
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Export the set from a `./iconSets` entry point:
|
|
19
|
-
|
|
20
|
-
```json
|
|
21
|
-
{
|
|
22
|
-
"name": "@my-app/icons-tabler",
|
|
23
|
-
"version": "1.0.0",
|
|
24
|
-
"type": "module",
|
|
25
|
-
"exports": {
|
|
26
|
-
"./iconSets": "./src/iconSets.js",
|
|
27
|
-
"./types": "./src/types.js"
|
|
28
|
-
},
|
|
29
|
-
"files": ["src/*"]
|
|
30
|
-
}
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
The `./iconSets` module runs only in Node, during the build and in the dev server. It exports an object with one entry per set id:
|
|
34
|
-
|
|
35
|
-
```js
|
|
36
|
-
// src/iconSets.js
|
|
37
|
-
export default {
|
|
38
|
-
tabler: {
|
|
39
|
-
attrs: undefined,
|
|
40
|
-
semantic: { edit: 'Pencil', delete: 'Trash' },
|
|
41
|
-
listIcons: async () => ['Pencil', 'Trash' /* ... */],
|
|
42
|
-
loadIcons: async ({ names }) => ({
|
|
43
|
-
Pencil: {
|
|
44
|
-
node: [
|
|
45
|
-
/* ... */
|
|
46
|
-
],
|
|
47
|
-
},
|
|
48
|
-
}),
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
| Key | Required | Description |
|
|
54
|
-
| ----------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
55
|
-
| `listIcons` | Yes | An async function that returns every icon name in the set. Search (`lowdefy_search_icons`) and the build's "did you mean" suggestions use it. |
|
|
56
|
-
| `loadIcons` | Yes | An async function that takes `{ names }` and returns `{ [name]: IconData }` for the names it has. Leave out names it does not have. |
|
|
57
|
-
| `attrs` | No | Root SVG attributes added to every icon of this set, such as `{ fill: 'currentColor', stroke: 'none' }` for a fill-based set. |
|
|
58
|
-
| `semantic` | No | A map from semantic names to icon names in this set. It applies when this set is the app's default set (`theme.icons.set`). |
|
|
59
|
-
|
|
60
|
-
The build calls `loadIcons` only with names the app uses, so a large set costs nothing until an app draws one of its icons.
|
|
61
|
-
|
|
62
|
-
Install the plugin like any other plugin. A set in the same pnpm workspace uses `workspace:*`:
|
|
63
|
-
|
|
64
|
-
```yaml
|
|
65
|
-
plugins:
|
|
66
|
-
- name: '@my-app/icons-tabler'
|
|
67
|
-
version: 'workspace:*'
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
Restart the dev server after you add an icon-set plugin.
|
|
71
|
-
|
|
72
|
-
## Icon names
|
|
73
|
-
|
|
74
|
-
Icon names in a set are PascalCase: `Pencil`, `ArrowLeftRight`. Convert kebab-case file names when you build the set. An app writes a set icon in one of two ways:
|
|
75
|
-
|
|
76
|
-
- `tabler:Pencil` — a qualified name. It resolves only in the `tabler` set.
|
|
77
|
-
- `Pencil` — a set name. It resolves in the app's default set (`theme.icons.set`, which is `lucide` unless the app changes it), then in Lucide.
|
|
78
|
-
|
|
79
|
-
## IconData
|
|
80
|
-
|
|
81
|
-
`loadIcons` returns each icon as `IconData`:
|
|
82
|
-
|
|
83
|
-
```js
|
|
84
|
-
{
|
|
85
|
-
node: [
|
|
86
|
-
['path', { d: 'M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4' }],
|
|
87
|
-
['path', { d: 'M13.5 6.5l4 4' }],
|
|
88
|
-
],
|
|
89
|
-
size: 24,
|
|
90
|
-
}
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
| Key | Description |
|
|
94
|
-
| ----------------- | -------------------------------------------------------------------------------------------------- |
|
|
95
|
-
| `node` | Required. An array of `[tag, attrs, children?]`. `children` is another node array, so groups nest. |
|
|
96
|
-
| `size` | The viewBox size of a square icon: `size: 24` gives `viewBox="0 0 24 24"`. Defaults to 24. |
|
|
97
|
-
| `width`, `height` | Use these instead of `size` for an icon that is not square. |
|
|
98
|
-
| `attrs` | Root SVG attributes for this icon. |
|
|
99
|
-
|
|
100
|
-
Rules for the data:
|
|
101
|
-
|
|
102
|
-
- Attribute names are React names: `strokeWidth`, `fillRule`, `clipRule`, `className`, not `stroke-width` or `class`.
|
|
103
|
-
- The viewBox always starts at `0 0`. For a source with an offset viewBox such as `-2 -2 24 24`, wrap the nodes in `['g', { transform: 'translate(2 2)' }, nodes]`.
|
|
104
|
-
- Root `attrs` never set `strokeWidth`. Stroke width is an app setting (`theme.icons.strokeWidth`), so every set follows it. A set drawn at 1.5, such as Heroicons, should tell apps to set `theme.icons.strokeWidth: 1.5`. A `strokeWidth` on a single node inside `node` is fine.
|
|
105
|
-
- Leave out `key` attributes.
|
|
106
|
-
|
|
107
|
-
Every icon starts from Lucide's root attributes: `fill="none"`, `stroke="currentColor"`, round line caps and joins, and the app's stroke width. Stroke sets on a 24px grid, such as Tabler outline and `@lucide/lab`, need no `attrs`. A fill-based set sets `attrs: { fill: 'currentColor', stroke: 'none' }`. Draw with `currentColor`, so the icon's `color` works.
|
|
108
|
-
|
|
109
|
-
## Layers: the last plugin wins
|
|
110
|
-
|
|
111
|
-
Several plugins can declare the same set id. Each one adds a layer to the set, in `plugins` order. For `lucide`, Lowdefy's built-in Lucide data is the bottom layer.
|
|
112
|
-
|
|
113
|
-
- **Per icon name, the topmost layer that has it wins.** A layer can be partial. A name it lacks falls through to the layers below it.
|
|
114
|
-
- **`semantic` maps layer the same way.** From lowest to highest precedence: the built-in semantic names, then the `semantic` maps of the default set's layers in plugin order, then the app's `theme.icons.aliases`.
|
|
115
|
-
- **Qualified names stay in their set.** `tabler:Pencil` resolves through the `tabler` layers only. If no layer has it, it is unresolved, and the build fails at an icon property. It does not fall back to Lucide.
|
|
116
|
-
|
|
117
|
-
### Add one icon to Lucide
|
|
118
|
-
|
|
119
|
-
A plugin that declares `lucide` and has one icon makes that name work like any Lucide name, without a set prefix:
|
|
120
|
-
|
|
121
|
-
```js
|
|
122
|
-
// types.js
|
|
123
|
-
export default { iconSets: ['lucide'] };
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
```js
|
|
127
|
-
// iconSets.js
|
|
128
|
-
const Invoice = {
|
|
129
|
-
node: [
|
|
130
|
-
['path', { d: 'M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z' }],
|
|
131
|
-
['path', { d: 'M8 8h8' }],
|
|
132
|
-
['path', { d: 'M8 12h8' }],
|
|
133
|
-
['path', { d: 'M8 16h5' }],
|
|
134
|
-
],
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
export default {
|
|
138
|
-
lucide: {
|
|
139
|
-
listIcons: async () => ['Invoice'],
|
|
140
|
-
loadIcons: async ({ names }) => (names.includes('Invoice') ? { Invoice } : {}),
|
|
141
|
-
},
|
|
142
|
-
};
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
```yaml
|
|
146
|
-
- id: invoice_button
|
|
147
|
-
type: Button
|
|
148
|
-
properties:
|
|
149
|
-
title: Invoices
|
|
150
|
-
icon: Invoice
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
### Replace an icon
|
|
154
|
-
|
|
155
|
-
A layer that defines a name Lucide already has replaces it everywhere. If the layer above defines `Pencil`, every `Pencil` in the app draws the new glyph, and so do the semantic `edit` and every block that uses `edit`.
|
|
156
|
-
|
|
157
|
-
## Select a set
|
|
158
|
-
|
|
159
|
-
`theme.icons.set` makes a set the app's default set:
|
|
160
|
-
|
|
161
|
-
```yaml
|
|
162
|
-
theme:
|
|
163
|
-
icons:
|
|
164
|
-
set: tabler
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
- PascalCase names resolve in the Tabler layers first, then in Lucide. Every Lucide name keeps working.
|
|
168
|
-
- The Tabler layers' `semantic` maps override the built-in semantic names. So the set re-skins block icons and Ant Design icons (close buttons, alert status icons, select arrows) as far as its map covers them. Semantic names it leaves out keep their Lucide icons.
|
|
169
|
-
- The app's `theme.icons.aliases` still win over both.
|
|
170
|
-
|
|
171
|
-
`theme.icons.set` must name the built-in `lucide` set or an installed set, or the build fails.
|
|
172
|
-
|
|
173
|
-
## Example: Tabler outline icons
|
|
174
|
-
|
|
175
|
-
[Tabler](https://tabler.io/icons) outline icons use the same 24px grid and stroke attributes as Lucide. The `@tabler/icons` package ships them as node arrays in `tabler-nodes-outline.json`, keyed by kebab-case name. Convert them once, when you build the plugin package, and read the JSON in `iconSets.js`.
|
|
176
|
-
|
|
177
|
-
```js
|
|
178
|
-
// scripts/convertIcons.js - run with `node scripts/convertIcons.js`
|
|
179
|
-
import fs from 'fs';
|
|
180
|
-
|
|
181
|
-
const source = new URL('../node_modules/@tabler/icons/tabler-nodes-outline.json', import.meta.url);
|
|
182
|
-
const target = new URL('../src/tablerOutline.json', import.meta.url);
|
|
183
|
-
|
|
184
|
-
function toPascalCase(name) {
|
|
185
|
-
return name
|
|
186
|
-
.split('-')
|
|
187
|
-
.map((part) => part[0].toUpperCase() + part.slice(1))
|
|
188
|
-
.join('');
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
const nodes = JSON.parse(fs.readFileSync(source, 'utf8'));
|
|
192
|
-
const icons = {};
|
|
193
|
-
Object.entries(nodes).forEach(([name, node]) => {
|
|
194
|
-
icons[toPascalCase(name)] = { node };
|
|
195
|
-
});
|
|
196
|
-
fs.writeFileSync(target, JSON.stringify(icons));
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
`pencil` becomes `Pencil`, and `arrow-left-right` becomes `ArrowLeftRight`. The file already leaves out Tabler's invisible bounding-box path, and its attributes are React names, so it needs no other changes.
|
|
200
|
-
|
|
201
|
-
```js
|
|
202
|
-
// src/iconSets.js
|
|
203
|
-
import { readFile } from 'fs/promises';
|
|
204
|
-
|
|
205
|
-
let iconsPromise;
|
|
206
|
-
|
|
207
|
-
function readIcons() {
|
|
208
|
-
iconsPromise ??= readFile(new URL('./tablerOutline.json', import.meta.url), 'utf8').then(
|
|
209
|
-
JSON.parse
|
|
210
|
-
);
|
|
211
|
-
return iconsPromise;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
async function listIcons() {
|
|
215
|
-
return Object.keys(await readIcons());
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
async function loadIcons({ names }) {
|
|
219
|
-
const icons = await readIcons();
|
|
220
|
-
const found = {};
|
|
221
|
-
names.forEach((name) => {
|
|
222
|
-
if (icons[name]) found[name] = icons[name];
|
|
223
|
-
});
|
|
224
|
-
return found;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
export default {
|
|
228
|
-
tabler: {
|
|
229
|
-
semantic: {
|
|
230
|
-
add: 'Plus',
|
|
231
|
-
close: 'X',
|
|
232
|
-
delete: 'Trash',
|
|
233
|
-
edit: 'Pencil',
|
|
234
|
-
search: 'Search',
|
|
235
|
-
settings: 'Settings',
|
|
236
|
-
},
|
|
237
|
-
listIcons,
|
|
238
|
-
loadIcons,
|
|
239
|
-
},
|
|
240
|
-
};
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
```js
|
|
244
|
-
// src/types.js
|
|
245
|
-
export default { iconSets: ['tabler'] };
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
An app can now use `tabler:Pencil` anywhere, or set `theme.icons.set: tabler` to draw Tabler icons by default.
|
|
249
|
-
|
|
250
|
-
## The react-icons compatibility set
|
|
251
|
-
|
|
252
|
-
Lowdefy 6 and earlier used [react-icons](https://react-icons.github.io/react-icons/) names such as `AiOutlineUser`. `@lowdefy/icons-react-icons` is an icon set, `react-icons`, that holds every react-icons 5.6.0 icon under its old name. Use it when names come from data the build cannot rewrite, such as icon names stored in a database, or for brand icons that Lucide does not have.
|
|
253
|
-
|
|
254
|
-
```yaml
|
|
255
|
-
plugins:
|
|
256
|
-
- name: '@lowdefy/icons-react-icons'
|
|
257
|
-
version: '^7'
|
|
258
|
-
theme:
|
|
259
|
-
icons:
|
|
260
|
-
set: react-icons
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
- Old names such as `AiOutlineUser` resolve in the compatibility set. Lucide names and semantic names still work.
|
|
264
|
-
- The set has no `semantic` map, so block icons and Ant Design icons are Lucide either way.
|
|
265
|
-
- Without `set: react-icons`, reach an old name with its qualified name: `react-icons:FaWhatsapp`.
|
|
266
|
-
|
|
267
|
-
The compatibility set is a migration aid. [V6 to V7](/v6-to-v7) shows how to move an app to Lucide names.
|