@lowdefy/docs 4.0.0-alpha.6 → 4.0.0-alpha.7

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.
Files changed (146) hide show
  1. package/CHANGELOG.md +75 -104
  2. package/actions/JsAction.yaml +6 -6
  3. package/blocks/container/Affix.yaml +1 -1
  4. package/blocks/container/Alert.yaml +2 -2
  5. package/blocks/container/Badge.yaml +1 -1
  6. package/blocks/container/Box.yaml +1 -1
  7. package/blocks/container/Card.yaml +1 -1
  8. package/blocks/container/Collapse.yaml +1 -1
  9. package/blocks/container/Comment.yaml +4 -4
  10. package/blocks/container/ConfirmModal.yaml +1 -1
  11. package/blocks/container/Descriptions.yaml +2 -2
  12. package/blocks/container/Drawer.yaml +1 -1
  13. package/blocks/container/Label.yaml +1 -2
  14. package/blocks/container/Modal.yaml +1 -1
  15. package/blocks/container/PageHCF.yaml +1 -1
  16. package/blocks/container/PageHCSF.yaml +1 -1
  17. package/blocks/container/PageHSCF.yaml +1 -1
  18. package/blocks/container/PageHeaderMenu.yaml +3 -3
  19. package/blocks/container/PageSHCF.yaml +1 -1
  20. package/blocks/container/PageSiderMenu.yaml +3 -3
  21. package/blocks/container/Result.yaml +2 -2
  22. package/blocks/container/Span.yaml +1 -1
  23. package/blocks/container/Spin.yaml +2 -2
  24. package/blocks/container/Tabs.yaml +2 -2
  25. package/blocks/container/Tooltip.yaml +1 -1
  26. package/blocks/display/Anchor.yaml +1 -2
  27. package/blocks/display/Avatar.yaml +1 -2
  28. package/blocks/display/Breadcrumb.yaml +2 -3
  29. package/blocks/display/Button.yaml +7 -7
  30. package/blocks/display/DangerousHtml.yaml +1 -1
  31. package/blocks/display/DangerousMarkdown.yaml +1 -1
  32. package/blocks/display/Divider.yaml +1 -3
  33. package/blocks/display/EChart.yaml +1 -1
  34. package/blocks/display/Html.yaml +2 -2
  35. package/blocks/display/Icon.yaml +1 -3
  36. package/blocks/display/Img.yaml +1 -1
  37. package/blocks/display/Markdown.yaml +5 -6
  38. package/blocks/display/MarkdownWithCode.yaml +3 -5
  39. package/blocks/display/Menu.yaml +3 -3
  40. package/blocks/display/Message.yaml +1 -1
  41. package/blocks/display/MobileMenu.yaml +3 -4
  42. package/blocks/display/Notification.yaml +2 -2
  43. package/blocks/display/Paragraph.yaml +2 -4
  44. package/blocks/display/Progress.yaml +8 -9
  45. package/blocks/display/Skeleton.yaml +1 -2
  46. package/blocks/display/Statistic.yaml +3 -5
  47. package/blocks/display/Title.yaml +1 -1
  48. package/blocks/input/AutoComplete.yaml +1 -2
  49. package/blocks/input/ButtonSelector.yaml +1 -2
  50. package/blocks/input/CheckboxSelector.yaml +1 -2
  51. package/blocks/input/CheckboxSwitch.yaml +1 -1
  52. package/blocks/input/ChromeColorSelector.yaml +1 -2
  53. package/blocks/input/CircleColorSelector.yaml +1 -2
  54. package/blocks/input/ColorSelector.yaml +1 -2
  55. package/blocks/input/CompactColorSelector.yaml +1 -2
  56. package/blocks/input/DateRangeSelector.yaml +1 -2
  57. package/blocks/input/DateSelector.yaml +1 -2
  58. package/blocks/input/DateTimeSelector.yaml +1 -2
  59. package/blocks/input/GithubColorSelector.yaml +1 -2
  60. package/blocks/input/MonthSelector.yaml +1 -2
  61. package/blocks/input/MultipleSelector.yaml +1 -1
  62. package/blocks/input/NumberInput.yaml +1 -1
  63. package/blocks/input/Pagination.yaml +3 -3
  64. package/blocks/input/ParagraphInput.yaml +1 -1
  65. package/blocks/input/PasswordInput.yaml +1 -1
  66. package/blocks/input/RadioSelector.yaml +1 -1
  67. package/blocks/input/RatingSlider.yaml +1 -1
  68. package/blocks/input/S3UploadButton.yaml +1 -1
  69. package/blocks/input/Selector.yaml +1 -1
  70. package/blocks/input/SliderColorSelector.yaml +1 -1
  71. package/blocks/input/SwatchesColorSelector.yaml +1 -1
  72. package/blocks/input/Switch.yaml +1 -1
  73. package/blocks/input/TextArea.yaml +1 -2
  74. package/blocks/input/TextInput.yaml +7 -7
  75. package/blocks/input/TitleInput.yaml +1 -1
  76. package/blocks/input/TwitterColorSelector.yaml +1 -1
  77. package/blocks/input/WeekSelector.yaml +1 -1
  78. package/blocks/list/ControlledList.yaml +18 -18
  79. package/blocks/list/List.yaml +16 -17
  80. package/blocks/list/TimelineList.yaml +23 -22
  81. package/concepts/cli.yaml +7 -7
  82. package/concepts/custom-blocks.yaml +16 -2
  83. package/concepts/custom-code.yaml +5 -4
  84. package/concepts/lowdefy-schema.yaml +5 -4
  85. package/connections/AxiosHttp.yaml +1 -1
  86. package/connections/Knex.yaml +7 -7
  87. package/connections/MongoDB.yaml +176 -47
  88. package/deployment/aws-lambda.yaml +3 -3
  89. package/deployment/docker.yaml +4 -4
  90. package/deployment/node-server.yaml +1 -1
  91. package/howto/generate-csv.yaml.njk +7 -6
  92. package/howto/generate-pdf.yaml.njk +21 -21
  93. package/howto/generateCsv/lowdefy.yaml +32 -31
  94. package/howto/generatePdf/lowdefy.yaml +10 -9
  95. package/introduction.yaml +1 -1
  96. package/lowdefy.yaml +1 -1
  97. package/menus.yaml +26 -29
  98. package/operators/_actions.yaml +2 -2
  99. package/operators/_get.yaml +6 -6
  100. package/operators/_js.yaml +2 -2
  101. package/operators/_ref.yaml +40 -6
  102. package/operators/_yaml.yaml +39 -15
  103. package/package.json +6 -7
  104. package/pages.yaml +8 -8
  105. package/public/sitemap.xml +204 -204
  106. package/templates/blocks/defaultValueTransformer.js +4 -2
  107. package/templates/blocks/exampleTransformer.js +1 -1
  108. package/templates/blocks/propertiesFormTransformer.js +3 -3
  109. package/templates/blocks/propertiesGetterTransformer.js +2 -2
  110. package/templates/blocks/schemaTransformer.js +1 -1
  111. package/templates/blocks/template.yaml.njk +3 -4
  112. package/templates/blog.yaml.njk +5 -5
  113. package/templates/cli_command.yaml.njk +2 -2
  114. package/templates/footer.yaml.njk +18 -18
  115. package/templates/general.yaml.njk +4 -4
  116. package/templates/generateSitemap.js +1 -2
  117. package/templates/header.yaml +2 -2
  118. package/templates/navigation_buttons.yaml +2 -2
  119. package/templates/operatorsMethodTransformer.js +2 -2
  120. package/templates/test/array.test.js +146 -166
  121. package/templates/test/boolean.test.js +13 -17
  122. package/templates/test/button.test.js +21 -25
  123. package/templates/test/color.test.js +21 -23
  124. package/templates/test/enum.test.js +15 -19
  125. package/templates/test/icon.test.js +17 -21
  126. package/templates/test/integer.test.js +13 -17
  127. package/templates/test/manual.test.js +66 -74
  128. package/templates/test/number.test.js +13 -17
  129. package/templates/test/object.test.js +90 -98
  130. package/templates/test/oneOf.test.js +108 -120
  131. package/templates/test/string.test.js +13 -17
  132. package/templates/test/yaml.test.js +96 -112
  133. package/tutorial/tutorial-actions-operators-config.yaml +4 -4
  134. package/tutorial/tutorial-actions-operators.yaml +6 -6
  135. package/tutorial/tutorial-add-blocks-config.yaml +4 -4
  136. package/tutorial/tutorial-add-blocks.yaml +4 -4
  137. package/tutorial/tutorial-create-page-config.yaml +2 -2
  138. package/tutorial/tutorial-create-page.yaml +4 -4
  139. package/tutorial/tutorial-deploy.yaml +2 -2
  140. package/tutorial/tutorial-requests-config.yaml +4 -4
  141. package/tutorial/tutorial-requests.yaml +2 -2
  142. package/tutorial/tutorial-start.yaml +6 -6
  143. package/users/login-and-logout.yaml +2 -2
  144. package/users/protected-pages.yaml +2 -2
  145. package/users/roles.yaml +2 -2
  146. package/users/users-introduction.yaml +2 -2
@@ -46,7 +46,7 @@ _ref:
46
46
  textAlign: center
47
47
  properties:
48
48
  title: Generate & Download PDF
49
- icon: DownloadOutlined
49
+ icon: AiOutlinedDownload
50
50
  color: '#6293F8'
51
51
  events:
52
52
  onMount:
@@ -90,13 +90,13 @@ _ref:
90
90
  qty: 2
91
91
  price: 60.667
92
92
  code: X12-49A
93
- onClick:
94
- - id: generate_pdf
95
- type: JsAction
93
+ onClick: []
94
+ {# - id: generate_pdf
95
+ type: JsAction # TODO:
96
96
  params:
97
97
  name: pdfMake
98
98
  args:
99
- _ref: howto/generatePdf/inv_template.yaml
99
+ _ref: howto/generatePdf/inv_template.yaml #}
100
100
 
101
101
  - id: md2
102
102
  type: MarkdownWithCode
@@ -109,7 +109,7 @@ _ref:
109
109
  textAlign: center
110
110
  properties:
111
111
  title: Share this post
112
- icon: UploadOutlined
112
+ icon: AiOutlinedUpload
113
113
  color: '#6293F8'
114
114
  events:
115
115
  onClick:
@@ -237,7 +237,7 @@ _ref:
237
237
  ###### /lowdefy.yaml
238
238
  ```yaml
239
239
  name: Generate a PDF
240
- lowdefy: 3.23.1
240
+ lowdefy: 3.23.2
241
241
 
242
242
  app:
243
243
  html:
@@ -252,11 +252,11 @@ _ref:
252
252
  type: Button
253
253
  properties:
254
254
  title: Download PDF
255
- icon: DownloadOutlined
255
+ icon: AiOutlinedDownload
256
256
  events:
257
257
  onClick:
258
258
  - id: make_pdf
259
- type: JsAction
259
+ type: JsAction # TODO:
260
260
  params:
261
261
  name: pdfMake
262
262
  args:
@@ -277,11 +277,11 @@ _ref:
277
277
  textAlign: center
278
278
  properties:
279
279
  title: Download PDF
280
- icon: DownloadOutlined
280
+ icon: AiOutlinedDownload
281
281
  events:
282
- onClick:
283
- - id: make_pdf
284
- type: JsAction
282
+ onClick: []
283
+ {# - id: make_pdf
284
+ type: JsAction # TODO:
285
285
  params:
286
286
  name: pdfMake
287
287
  args:
@@ -291,7 +291,7 @@ _ref:
291
291
  fontSize: 10
292
292
  content:
293
293
  - text: This pdf has been generated with Lowdefy and pdfMake.
294
- bold: true
294
+ bold: true #}
295
295
  - id: md4
296
296
  type: MarkdownWithCode
297
297
  properties:
@@ -302,7 +302,7 @@ _ref:
302
302
 
303
303
  ###### /lowdefy.yaml
304
304
  ```yaml
305
- lowdefy: 3.23.1
305
+ lowdefy: 3.23.2
306
306
  name: Generate PDF from data with Lowdefy
307
307
 
308
308
  app:
@@ -370,7 +370,7 @@ _ref:
370
370
  events:
371
371
  onClick:
372
372
  - id: make_pdf
373
- type: JsAction
373
+ type: JsAction # TODO:
374
374
  params:
375
375
  name: pdfMake
376
376
  args:
@@ -591,7 +591,7 @@ _ref:
591
591
  textAlign: center
592
592
  properties:
593
593
  title: Generate Invoice
594
- icon: DownloadOutlined
594
+ icon: AiOutlinedDownload
595
595
  color: '#6293F8'
596
596
  events:
597
597
  onMount:
@@ -635,13 +635,13 @@ _ref:
635
635
  qty: 2
636
636
  price: 60.667
637
637
  code: X12-49A
638
- onClick:
639
- - id: generate_pdf
640
- type: JsAction
638
+ onClick: []
639
+ {# - id: generate_pdf
640
+ type: JsAction # TODO:
641
641
  params:
642
642
  name: pdfMake
643
643
  args:
644
- _ref: howto/generatePdf/inv_template.yaml
644
+ _ref: howto/generatePdf/inv_template.yaml #}
645
645
  - id: md5
646
646
  type: MarkdownWithCode
647
647
  properties:
@@ -1,4 +1,4 @@
1
- lowdefy: 3.23.1
1
+ lowdefy: 3.23.2
2
2
  name: Generate PDF from data with Lowdefy
3
3
 
4
4
  app:
@@ -23,36 +23,37 @@ pages:
23
23
  color: '#1890ff'
24
24
  events:
25
25
  onClick:
26
- - id: generate_csv
27
- type: JsAction
28
- params:
29
- name: csvMake
30
- args:
31
- - profiles.csv # csv filename
32
- - - Username: booker12 # an array of data, usually a reference
33
- Identifier: 9012
34
- FirstName: Rachel
35
- LastName: Booker
36
- - Username: grey07
37
- Identifier: 2070
38
- FirstName: Laura
39
- LastName: Grey
40
- - Username: johnson81
41
- Identifier: 4081
42
- FirstName: Craig
43
- LastName: Johnson
44
- - Username: jenkins46
45
- Identifier: 9346
46
- FirstName: Mary
47
- LastName: Jenkins
48
- - Username: smith79
49
- Identifier: 5079
50
- FirstName: Jamie
51
- LastName: Smith
52
- - - Username # an array of field definitions
53
- - Identifier
54
- - FirstName
55
- - LastName
26
+ []
27
+ # - id: generate_csv
28
+ # type: JsAction # TODO:
29
+ # params:
30
+ # name: csvMake
31
+ # args:
32
+ # - profiles.csv # csv filename
33
+ # - - Username: booker12 # an array of data, usually a reference
34
+ # Identifier: 9012
35
+ # FirstName: Rachel
36
+ # LastName: Booker
37
+ # - Username: grey07
38
+ # Identifier: 2070
39
+ # FirstName: Laura
40
+ # LastName: Grey
41
+ # - Username: johnson81
42
+ # Identifier: 4081
43
+ # FirstName: Craig
44
+ # LastName: Johnson
45
+ # - Username: jenkins46
46
+ # Identifier: 9346
47
+ # FirstName: Mary
48
+ # LastName: Jenkins
49
+ # - Username: smith79
50
+ # Identifier: 5079
51
+ # FirstName: Jamie
52
+ # LastName: Smith
53
+ # - - Username # an array of field definitions
54
+ # - Identifier
55
+ # - FirstName
56
+ # - LastName
56
57
  footer:
57
58
  blocks:
58
59
  - id: footer
@@ -1,4 +1,4 @@
1
- lowdefy: 3.23.1
1
+ lowdefy: 3.23.2
2
2
  name: Generate PDF from data with Lowdefy
3
3
 
4
4
  app:
@@ -68,7 +68,7 @@ pages:
68
68
  title: Generate PDF from data with Lowdefy
69
69
  subTitle: <a href="https://docs.lowdefy.com/generate-pdf-document-from-data">Read the full how to guide</a>
70
70
  icon:
71
- name: PrinterTwoTone
71
+ name: AiTwoTonePrinter
72
72
  color: '#ff0000'
73
73
  areas:
74
74
  extra:
@@ -99,13 +99,14 @@ pages:
99
99
  color: '#1890ff'
100
100
  events:
101
101
  onClick:
102
- - id: make_pdf
103
- type: JsAction
104
- params:
105
- name: pdfMake
106
- args:
107
- _ref:
108
- path: inv_template.yaml
102
+ []
103
+ # - id: make_pdf
104
+ # type: JsAction # TODO:
105
+ # params:
106
+ # name: pdfMake
107
+ # args:
108
+ # _ref:
109
+ # path: inv_template.yaml
109
110
  footer:
110
111
  blocks:
111
112
  - id: footer
package/introduction.yaml CHANGED
@@ -84,7 +84,7 @@ _ref:
84
84
  properties:
85
85
  block: true
86
86
  hideActionLoading: true
87
- icon: RocketOutlined
87
+ icon: AiOutlinedRocket
88
88
  size: large
89
89
  title: Start the tutorial
90
90
  type: primary
package/lowdefy.yaml CHANGED
@@ -13,7 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
  name: '@lowdefy/docs'
16
- lowdefy: 3.23.1
16
+ lowdefy: 4.0.0-alpha.7
17
17
  licence: Apache-2.0
18
18
 
19
19
  cli:
package/menus.yaml CHANGED
@@ -5,12 +5,12 @@
5
5
  pageId: introduction
6
6
  properties:
7
7
  title: Introduction
8
- icon: CoffeeOutlined
8
+ icon: AiOutlinedCoffee
9
9
  - id: tutorial
10
10
  type: MenuGroup
11
11
  properties:
12
12
  title: Tutorial
13
- icon: RocketOutlined
13
+ icon: AiOutlinedRocket
14
14
  links:
15
15
  - id: tutorial-start
16
16
  type: MenuLink
@@ -51,7 +51,7 @@
51
51
  type: MenuGroup
52
52
  properties:
53
53
  title: How To
54
- icon: QuestionOutlined
54
+ icon: AiOutlinedQuestion
55
55
  links:
56
56
  - id: generate-csv
57
57
  type: MenuLink
@@ -67,7 +67,7 @@
67
67
  type: MenuGroup
68
68
  properties:
69
69
  title: Concepts
70
- icon: BulbOutlined
70
+ icon: AiOutlinedBulb
71
71
  links:
72
72
  - id: overview
73
73
  type: MenuLink
@@ -143,7 +143,7 @@
143
143
  type: MenuGroup
144
144
  properties:
145
145
  title: Deployment
146
- icon: CloudUploadOutlined
146
+ icon: AiOutlinedCloudUpload
147
147
  links:
148
148
  - id: aws-lambda
149
149
  type: MenuLink
@@ -169,7 +169,7 @@
169
169
  type: MenuGroup
170
170
  properties:
171
171
  title: User Authentication
172
- icon: TeamOutlined
172
+ icon: AiOutlinedTeam
173
173
  links:
174
174
  - id: users
175
175
  type: MenuLink
@@ -206,7 +206,7 @@
206
206
  type: MenuGroup
207
207
  properties:
208
208
  title: Input Blocks
209
- icon: FormOutlined
209
+ icon: AiOutlinedForm
210
210
  links:
211
211
  - id: AutoComplete
212
212
  type: MenuLink
@@ -268,9 +268,9 @@
268
268
  - id: RatingSlider
269
269
  type: MenuLink
270
270
  pageId: RatingSlider
271
- - id: S3UploadButton
272
- type: MenuLink
273
- pageId: S3UploadButton
271
+ # - id: S3UploadButton
272
+ # type: MenuLink
273
+ # pageId: S3UploadButton
274
274
  - id: Selector
275
275
  type: MenuLink
276
276
  pageId: Selector
@@ -302,7 +302,7 @@
302
302
  type: MenuGroup
303
303
  properties:
304
304
  title: Display Blocks
305
- icon: PictureOutlined
305
+ icon: AiOutlinedPicture
306
306
  links:
307
307
  - id: Alert
308
308
  type: MenuLink
@@ -381,7 +381,7 @@
381
381
  type: MenuGroup
382
382
  properties:
383
383
  title: Container Blocks
384
- icon: ContainerOutlined
384
+ icon: AiOutlinedContainer
385
385
  links:
386
386
  - id: Affix
387
387
  type: MenuLink
@@ -437,9 +437,9 @@
437
437
  - id: Span
438
438
  type: MenuLink
439
439
  pageId: Span
440
- - id: Spin
441
- type: MenuLink
442
- pageId: Spin
440
+ # - id: Spin
441
+ # type: MenuLink
442
+ # pageId: Spin
443
443
  - id: Tabs
444
444
  type: MenuLink
445
445
  pageId: Tabs
@@ -451,7 +451,7 @@
451
451
  type: MenuGroup
452
452
  properties:
453
453
  title: List Blocks
454
- icon: OrderedListOutlined
454
+ icon: AiOutlinedOrderedList
455
455
  links:
456
456
  - id: ControlledList
457
457
  type: MenuLink
@@ -463,7 +463,7 @@
463
463
  type: MenuGroup
464
464
  properties:
465
465
  title: Connections
466
- icon: ApiOutlined
466
+ icon: AiOutlinedApi
467
467
  links:
468
468
  - id: AmazonRedshift
469
469
  type: MenuLink
@@ -533,14 +533,11 @@
533
533
  type: MenuGroup
534
534
  properties:
535
535
  title: Actions
536
- icon: ThunderboltOutlined
536
+ icon: AiOutlinedThunderbolt
537
537
  links:
538
538
  - id: CallMethod
539
539
  type: MenuLink
540
540
  pageId: CallMethod
541
- - id: JsAction
542
- type: MenuLink
543
- pageId: JsAction
544
541
  - id: Link
545
542
  type: MenuLink
546
543
  pageId: Link
@@ -587,11 +584,11 @@
587
584
  - id: Wait
588
585
  type: MenuLink
589
586
  pageId: Wait
590
- - id: operators
587
+ - id: operators-menu-group
591
588
  type: MenuGroup
592
589
  properties:
593
590
  title: Operators
594
- icon: ToolOutlined
591
+ icon: AiOutlinedTool
595
592
  links:
596
593
  - id: _actions
597
594
  type: MenuLink
@@ -659,9 +656,9 @@
659
656
  - id: _input
660
657
  type: MenuLink
661
658
  pageId: _input
662
- - id: _js
663
- type: MenuLink
664
- pageId: _js
659
+ # - id: _js
660
+ # type: MenuLink
661
+ # pageId: _js
665
662
  - id: _json
666
663
  type: MenuLink
667
664
  pageId: _json
@@ -771,13 +768,13 @@
771
768
  type: MenuGroup
772
769
  properties:
773
770
  title: Lowdefy Versions
774
- icon: BranchesOutlined
771
+ icon: AiOutlinedBranches
775
772
  links:
776
- - id: v3.23.1
773
+ - id: v3.23.2
777
774
  type: MenuLink
778
775
  url: https://docs.lowdefy.com
779
776
  properties:
780
- title: v3.23.1
777
+ title: v3.23.2
781
778
  - id: v3.22.0
782
779
  type: MenuLink
783
780
  url: https://61519bcb8b8ed4412aae3057--lowdefy-docs.netlify.app
@@ -77,7 +77,7 @@ _ref:
77
77
  First register a custom JavaScript action: `getNormalizedEigenvector`
78
78
  ```yaml
79
79
  # file: lowdefy.yaml
80
- lowdefy: '3.23.1'
80
+ lowdefy: '3.23.2'
81
81
  app:
82
82
  html:
83
83
  appendHead: |
@@ -97,7 +97,7 @@ _ref:
97
97
  events:
98
98
  onClick:
99
99
  - id: get_normalized_eigenvector
100
- type: JsAction
100
+ type: JsAction # TODO:
101
101
  params:
102
102
  name: getNormalizedEigenvector
103
103
  args:
@@ -53,12 +53,12 @@ _ref:
53
53
  key:
54
54
  _state: status
55
55
  from:
56
- new: PlusCircleTwoTone
57
- escalated: ExclamationCircleOutlined
58
- investigation_started: ToolTwoTone
59
- client_contacted: SoundTwoTone
60
- awaiting_confirmation: LikeOutlined
61
- closed: StopOutlined
56
+ new: AiTwoTonePlusCircle
57
+ escalated: AiOutlinedExclamationCircle
58
+ investigation_started: AiTwoToneTool
59
+ client_contacted: AiTwoToneSound
60
+ awaiting_confirmation: AiOutlinedLike
61
+ closed: AiOutlinedStop
62
62
  ```
63
63
  Returns: The icon corresponding to the status in state.
64
64
 
@@ -51,7 +51,7 @@ _ref:
51
51
  ```yaml
52
52
  # lowdefy.yaml
53
53
  name: make-me-primes
54
- lowdefy: '3.23.1'
54
+ lowdefy: '3.23.2'
55
55
  app:
56
56
  html:
57
57
  # This HTML will be appended to the head HTML tag in the Lowdefy app
@@ -119,7 +119,7 @@ _ref:
119
119
  ```yaml
120
120
  # file: lowdefy.yaml
121
121
  name: my-chart
122
- lowdefy: '3.23.1'
122
+ lowdefy: '3.23.2'
123
123
  app:
124
124
  html:
125
125
  appendHead:
@@ -59,6 +59,12 @@ _ref:
59
59
 
60
60
  A transformer is a JavaScript function that receives the result of the `_ref` operator, and its `vars` as arguments. The value returned by this function will be included in the configuration as the final result of the `_ref` operator. The `transformer` argument should be the file path (relative to the root of the project) to a JavaScript file that exports a transformer function.
61
61
 
62
+ ###### CommonJS and ES Modules
63
+
64
+ Both [CommonJS](https://nodejs.org/api/modules.html) and [ES Modules](https://nodejs.org/api/esm.html) are supported for in resolver and transformer functions. By default the functions are imported as CommonJs modules, and the function should be exported as a default export (`module.exports = transformer`). Files can also use the `.cjs` file extension to indicate they are CommonJs modules.
65
+
66
+ To use ES Modules, either use files with `.mjs` file extension, or add a `package.json` in the project directory file with `"type": "module"` set. When using ES Modules, the functions should also be a default export (`export default transformer;`)
67
+
62
68
  arguments: |
63
69
  ###### string
64
70
  The file path to the referenced file, from the root of the project directory.
@@ -73,7 +79,7 @@ _ref:
73
79
  ###### Reference pages:
74
80
  ```yaml
75
81
  # lowdefy.yaml
76
- lowdefy: '3.23.1'
82
+ lowdefy: '3.23.2'
77
83
  pages:
78
84
  - _ref: pages/page1.yaml
79
85
  - _ref: pages/page2.yaml
@@ -94,7 +100,7 @@ _ref:
94
100
  ```
95
101
  Returns:
96
102
  ```
97
- lowdefy: '3.23.1'
103
+ lowdefy: '3.23.2'
98
104
  pages:
99
105
  - id: page1
100
106
  type: PageHeaderMenu
@@ -170,8 +176,8 @@ _ref:
170
176
 
171
177
  ```js
172
178
  // resolvers/useLocalOrSharedConfig.js
173
- const fs = require('fs')
174
- const path = require('path')
179
+ const fs = require('fs');
180
+ const path = require('path');
175
181
  const { promisify } = require('util');
176
182
 
177
183
  const readFilePromise = promisify(fs.readFile);
@@ -197,7 +203,7 @@ _ref:
197
203
 
198
204
  ```yaml
199
205
  // lowdefy.yaml
200
- lowdefy: 3.23.1
206
+ lowdefy: 3.23.2
201
207
 
202
208
  cli:
203
209
  refResolver: resolvers/useLocalOrSharedConfig.js
@@ -223,10 +229,38 @@ _ref:
223
229
  ```
224
230
  ```yaml
225
231
  // lowdefy.yaml
226
- lowdefy: 3.23.1
232
+ lowdefy: 3.23.2
227
233
 
228
234
  pages:
229
235
  - _ref:
230
236
  path: pages/page1.yaml
231
237
  transformer: transformers/addFooter.js
232
238
  ```
239
+ ###### Using ES Modules with `.mjs` file extension:
240
+
241
+ ```js
242
+ // resolvers/useLocalOrSharedConfig.mjs
243
+ import fs from 'fs';
244
+ import path from 'path';
245
+ import { promisify } from 'util';
246
+
247
+ const readFilePromise = promisify(fs.readFile);
248
+
249
+ async function useLocalOrSharedConfig(refPath, vars, context) {
250
+ let fileContent
251
+ try {
252
+ fileContent = await readFilePromise(path.resolve(refPath), 'utf8');
253
+ return fileContent;
254
+ } catch (error) {
255
+ if (error.code === 'ENOENT') {
256
+ fileContent = readFilePromise(path.resolve('../shared', refPath), 'utf8');
257
+ return fileContent;
258
+ }
259
+ throw error;
260
+ }
261
+
262
+
263
+ }
264
+
265
+ export default useLocalOrSharedConfig;
266
+ ```
@@ -25,22 +25,36 @@ _ref:
25
25
  - name: parse
26
26
  types: |
27
27
  ```
28
- (value: string): any
28
+ ({on: string, options?: object}): object
29
+ ([on: string, options?: object]): object
29
30
  ```
30
31
  description: |
31
32
  The `_yaml.parse` method parses a YAML string into an object.
32
33
  arguments: |
33
- ###### string
34
- The string to parse.
34
+ ###### object
35
+ - `on: string`: String to parse.
36
+ - `options?: object`: Optional settings. See the [YAML.parse: method here](https://eemeli.org/yaml/#parse-options) for supported settings.
37
+
35
38
  examples: |
36
39
  ###### Parse a YAML string:
37
40
  ```yaml
38
- _yaml.parse: |
39
- key: Value
40
- boolean: true
41
- array:
42
- - 1
43
- - 2
41
+ _yaml.parse:
42
+ on: |
43
+ key: Value
44
+ boolean: true
45
+ array:
46
+ - 1
47
+ - 2
48
+ ```
49
+ or:
50
+ ```yaml
51
+ _yaml.parse:
52
+ - |
53
+ key: Value
54
+ boolean: true
55
+ array:
56
+ - 1
57
+ - 2
44
58
  ```
45
59
  Returns:
46
60
  ```
@@ -61,17 +75,27 @@ _ref:
61
75
  arguments: |
62
76
  ###### object
63
77
  - `on: any`: The object to stringify.
64
- - `options: object`: Optional settings. See the [YAML.dump method here](https://www.npmjs.com/package/js-yaml) for supported settings.
78
+ - `options?: object`: Optional settings. See the [YAML.stringify: method here](https://eemeli.org/yaml/#tostring-options) for supported settings.
65
79
 
66
80
  examples: |
67
81
  ###### Stringify an object as YAML:
68
82
  ```yaml
69
83
  _yaml.stringify:
70
- key: Value
71
- boolean: true
72
- array:
73
- - 1
74
- - 2
84
+ on:
85
+ key: Value
86
+ boolean: true
87
+ array:
88
+ - 1
89
+ - 2
90
+ ```
91
+ or:
92
+ ```yaml
93
+ _yaml.stringify:
94
+ - key: Value
95
+ boolean: true
96
+ array:
97
+ - 1
98
+ - 2
75
99
  ```
76
100
  Returns (as a string):
77
101
  ```text