alinea 2.0.0-preview.4 → 2.0.0-preview.6

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 (187) hide show
  1. package/dist/.init/content/pages/welcome.json +1 -1
  2. package/dist/.init/src/cms.ts +1 -4
  3. package/dist/LICENSES.md +137 -137
  4. package/dist/adapter/next/cms.js +5 -1
  5. package/dist/adapter/next/handler.js +35 -6
  6. package/dist/adapter/next/previews.js +7 -1
  7. package/dist/adapter/next/syncCheck.d.ts +12 -0
  8. package/dist/adapter/next/syncCheck.js +59 -0
  9. package/dist/adapter/next/with-alinea.d.ts +0 -8
  10. package/dist/adapter/next/with-alinea.js +43 -19
  11. package/dist/adapter/vite/plugin.js +9 -4
  12. package/dist/backend/Handler.js +106 -0
  13. package/dist/backend/api/GithubApi.js +16 -7
  14. package/dist/backend/api/ProxyMedia.d.ts +3 -0
  15. package/dist/backend/api/ProxyMedia.js +39 -0
  16. package/dist/backend/api/S3Uploads.d.ts +1 -1
  17. package/dist/backend/router/Router.js +2 -0
  18. package/dist/backend/util/Syncable.js +1 -1
  19. package/dist/bundled.d.ts +166 -73
  20. package/dist/chunks/{chunk-XMOVGDFI.js → chunk-7IOKMUKO.js} +1 -1
  21. package/dist/chunks/{chunk-O7XWTMCB.js → chunk-D6RGFNUW.js} +73 -72
  22. package/dist/chunks/{chunk-VXZM6V4P.js → chunk-OFEKTDRF.js} +41 -41
  23. package/dist/cli/Generate.js +3 -4
  24. package/dist/cli/Serve.js +3 -2
  25. package/dist/cli/bin.js +1 -1
  26. package/dist/cli/generate/FillCache.d.ts +1 -1
  27. package/dist/cli/generate/FillCache.js +20 -9
  28. package/dist/cli/generate/GenerateDashboard.js +1 -0
  29. package/dist/cli/serve/CreateLocalServer.d.ts +1 -1
  30. package/dist/cli/serve/CreateLocalServer.js +42 -34
  31. package/dist/cli/serve/DevServer.js +1 -0
  32. package/dist/cli/static/init/cms.js +1 -4
  33. package/dist/cli/util/ContentType.d.ts +1 -0
  34. package/dist/cli/util/ContentType.js +36 -0
  35. package/dist/cli/util/Emitter.js +1 -1
  36. package/dist/cloud/CloudHandshake.d.ts +6 -0
  37. package/dist/cloud/CloudHandshake.js +67 -10
  38. package/dist/cloud/CloudRemote.js +24 -11
  39. package/dist/components/Breadcrumbs.js +7 -7
  40. package/dist/components/Button.js +5 -5
  41. package/dist/components/Calendar.js +7 -7
  42. package/dist/components/Checkbox.js +8 -8
  43. package/dist/components/CheckboxGroup.js +5 -5
  44. package/dist/components/ColorSwatch.js +5 -5
  45. package/dist/components/ColorSwatchPicker.js +7 -7
  46. package/dist/components/ComboBox.js +14 -14
  47. package/dist/components/DateField.js +8 -8
  48. package/dist/components/DatePicker.js +10 -10
  49. package/dist/components/DateRangePicker.js +11 -11
  50. package/dist/components/Dialog.js +5 -5
  51. package/dist/components/Disclosure.js +11 -11
  52. package/dist/components/DropZone.js +5 -5
  53. package/dist/components/Label.js +9 -9
  54. package/dist/components/Link.js +5 -5
  55. package/dist/components/List.d.ts +1 -1
  56. package/dist/components/List.js +37 -36
  57. package/dist/components/Menu.js +9 -9
  58. package/dist/components/Modal.js +8 -8
  59. package/dist/components/MultipleSelect.js +33 -33
  60. package/dist/components/NumberField.js +11 -11
  61. package/dist/components/Popover.js +5 -5
  62. package/dist/components/ProgressCircle.js +8 -8
  63. package/dist/components/RadioGroup.js +7 -7
  64. package/dist/components/SearchField.js +10 -10
  65. package/dist/components/Select.js +12 -12
  66. package/dist/components/Surface.js +3 -3
  67. package/dist/components/Switch.js +7 -7
  68. package/dist/components/Table.js +11 -11
  69. package/dist/components/Tabs.js +9 -9
  70. package/dist/components/TagGroup.js +7 -7
  71. package/dist/components/TextField.js +10 -10
  72. package/dist/components/TimeField.js +5 -5
  73. package/dist/components/Toggle.js +5 -5
  74. package/dist/components/Toolbar.js +6 -6
  75. package/dist/components/Tooltip.js +8 -8
  76. package/dist/components/Tree.js +13 -13
  77. package/dist/core/Config.d.ts +10 -3
  78. package/dist/core/Config.js +16 -1
  79. package/dist/core/Graph.d.ts +2 -2
  80. package/dist/core/Role.js +16 -14
  81. package/dist/core/TextDoc.d.ts +2 -0
  82. package/dist/core/TextDoc.js +1 -0
  83. package/dist/core/Workspace.d.ts +6 -5
  84. package/dist/core/db/EntryIndex.d.ts +3 -0
  85. package/dist/core/db/EntryIndex.js +55 -0
  86. package/dist/core/db/EntryTransaction.js +34 -32
  87. package/dist/core/db/EntryUrlConflictError.js +1 -1
  88. package/dist/core/db/LinkResolver.d.ts +8 -2
  89. package/dist/core/db/LinkResolver.js +27 -5
  90. package/dist/core/field/RichTextField.js +16 -10
  91. package/dist/core/media/MediaLocation.d.ts +9 -15
  92. package/dist/core/media/MediaLocation.js +29 -19
  93. package/dist/core/media/MediaTypes.js +1 -2
  94. package/dist/dashboard/App.js +4 -4
  95. package/dist/dashboard/app/ActivityStatus.js +31 -37
  96. package/dist/dashboard/app/AppShell.js +2 -2
  97. package/dist/dashboard/app/AuthView.js +12 -12
  98. package/dist/dashboard/app/Badge.js +2 -2
  99. package/dist/dashboard/app/CompactField.js +9 -9
  100. package/dist/dashboard/app/DashboardErrorBoundary.js +6 -6
  101. package/dist/dashboard/app/EntryFields.d.ts +3 -1
  102. package/dist/dashboard/app/EntryFields.js +11 -8
  103. package/dist/dashboard/app/EntryHeader.js +116 -84
  104. package/dist/dashboard/app/EntryHeaderActions.d.ts +21 -4
  105. package/dist/dashboard/app/EntryHeaderActions.js +48 -27
  106. package/dist/dashboard/app/EntryReferences.js +6 -6
  107. package/dist/dashboard/app/EntrySidebar.js +15 -15
  108. package/dist/dashboard/app/EntrySidebarPreview.js +4 -4
  109. package/dist/dashboard/app/EntryTranslationBanner.d.ts +3 -1
  110. package/dist/dashboard/app/EntryTranslationBanner.js +23 -20
  111. package/dist/dashboard/app/Explorer.d.ts +4 -2
  112. package/dist/dashboard/app/Explorer.js +53 -49
  113. package/dist/dashboard/app/ExplorerCards.js +31 -31
  114. package/dist/dashboard/app/ExplorerFileCard.js +16 -16
  115. package/dist/dashboard/app/ExplorerList.js +14 -15
  116. package/dist/dashboard/app/ExplorerModal.js +4 -4
  117. package/dist/dashboard/app/ExplorerTable.js +54 -54
  118. package/dist/dashboard/app/LinkPicker.js +5 -5
  119. package/dist/dashboard/app/LocaleMenu.d.ts +7 -0
  120. package/dist/dashboard/app/LocaleMenu.js +34 -18
  121. package/dist/dashboard/app/ReadOnlyBadge.d.ts +4 -0
  122. package/dist/dashboard/app/ReadOnlyBadge.js +33 -0
  123. package/dist/dashboard/app/SidebarTree.d.ts +3 -6
  124. package/dist/dashboard/app/SidebarTree.js +62 -57
  125. package/dist/dashboard/app/WorkspaceMenu.js +16 -16
  126. package/dist/dashboard/app/WorkspaceRoots.js +21 -21
  127. package/dist/dashboard/app/editor/FileEditor.d.ts +2 -3
  128. package/dist/dashboard/app/editor/FileEditor.js +24 -27
  129. package/dist/dashboard/app/editor/FilePreview.js +4 -4
  130. package/dist/dashboard/app/modals/CreateEntry.js +5 -5
  131. package/dist/dashboard/app/pages/EntryPage.js +72 -29
  132. package/dist/dashboard/app/pages/RootPage.js +3 -3
  133. package/dist/dashboard/app/pages/SplashPage.js +45 -45
  134. package/dist/dashboard/app/pages/UsersPage.js +36 -36
  135. package/dist/dashboard/app/ui/DashboardModal.js +21 -21
  136. package/dist/dashboard/app/ui/Rail.js +5 -5
  137. package/dist/dashboard/app/ui/Sidebar.js +2 -2
  138. package/dist/dashboard/atoms/activity.d.ts +0 -2
  139. package/dist/dashboard/atoms/activity.js +4 -10
  140. package/dist/dashboard/atoms/editor.d.ts +2 -1
  141. package/dist/dashboard/atoms/editor.js +4 -2
  142. package/dist/dashboard/atoms/entry.d.ts +2 -0
  143. package/dist/dashboard/atoms/entry.js +32 -14
  144. package/dist/dashboard/atoms/explorer.d.ts +4 -3
  145. package/dist/dashboard/atoms/explorer.js +61 -22
  146. package/dist/dashboard/atoms/link.d.ts +1 -1
  147. package/dist/dashboard/atoms/link.js +39 -55
  148. package/dist/dashboard/atoms/root.d.ts +7 -2
  149. package/dist/dashboard/atoms/root.js +51 -16
  150. package/dist/dashboard/atoms/upload.d.ts +1 -0
  151. package/dist/dashboard/atoms/upload.js +2 -1
  152. package/dist/dashboard/boot/ActivityEvent.d.ts +1 -1
  153. package/dist/dashboard/boot/DashboardWorker.js +2 -28
  154. package/dist/dashboard/fixture/cms.js +1 -4
  155. package/dist/dashboard/hook/UseSaveShortcut.d.ts +1 -0
  156. package/dist/dashboard/hook/UseSaveShortcut.js +24 -0
  157. package/dist/dashboard/hooks.d.ts +1 -1
  158. package/dist/dashboard/hooks.js +12 -3
  159. package/dist/field/check/CheckField.view.js +2 -2
  160. package/dist/field/code/CodeField.view.js +11 -11
  161. package/dist/field/date/DateField.view.js +5 -5
  162. package/dist/field/link/ImageLink.js +1 -3
  163. package/dist/field/link/LinkField.view.js +88 -62
  164. package/dist/field/list/ListField.view.js +25 -25
  165. package/dist/field/metadata/MetadataField.d.ts +3 -3
  166. package/dist/field/metadata/MetadataField.view.js +27 -20
  167. package/dist/field/object/ObjectField.view.js +11 -4
  168. package/dist/field/richtext/PickTextLink.js +5 -2
  169. package/dist/field/richtext/ReferenceLink.d.ts +2 -0
  170. package/dist/field/richtext/ReferenceLink.js +5 -0
  171. package/dist/field/richtext/RichTextBlock.js +2 -2
  172. package/dist/field/richtext/RichTextExtensions.js +24 -24
  173. package/dist/field/richtext/RichTextField.view.js +2 -2
  174. package/dist/field/richtext/RichTextInsertMenu.js +3 -3
  175. package/dist/field/richtext/extensions/Link.d.ts +1 -0
  176. package/dist/field/richtext/extensions/Link.js +1 -0
  177. package/dist/field/select/SelectField.view.js +1 -1
  178. package/dist/field/time/TimeField.d.ts +0 -2
  179. package/dist/field/time/TimeField.view.js +1 -1
  180. package/dist/index.css +44 -38
  181. package/dist/next.cjs +96 -19
  182. package/dist/picker/entry/EntryPicker.js +10 -12
  183. package/dist/picker/entry/EntryReference.d.ts +2 -0
  184. package/dist/picker/entry/EntryReference.js +1 -0
  185. package/dist/types.d.ts +0 -1
  186. package/package.json +1 -1
  187. package/dist/chunks/{chunk-6V4TAD2N.js → chunk-DNJX6CRV.js} +4 -4
@@ -1,5 +1,5 @@
1
1
  {
2
- "_id": "3JJbJ2F3Dep25BJMlZoVBBFy25h",
2
+ "_id": "3JUoCAhRGalhjQEYxS2BD7bVGVb",
3
3
  "_type": "Page",
4
4
  "_index": "a0",
5
5
  "_seeded": "welcome.json",
@@ -17,7 +17,6 @@ export const cms = createCMS({
17
17
  main: Config.workspace('Example', {
18
18
  source: 'content',
19
19
  mediaDir: 'public/media',
20
- mediaUrl: '/media',
21
20
  roots: {
22
21
  pages: Config.root('Example site', {
23
22
  contains: ['Page']
@@ -39,7 +38,5 @@ export const cms = createCMS({
39
38
 
40
39
  // The handler route URL
41
40
  handlerUrl: '/api/cms',
42
-
43
- // The admin dashboard will be bundled in this static file
44
- dashboardFile: 'admin.html'
41
+ adminPath: '/admin'
45
42
  })
package/dist/LICENSES.md CHANGED
@@ -2,32 +2,6 @@ This file contains the licenses of the bundled modules in this distribution.
2
2
 
3
3
  ===
4
4
 
5
- # rado@1.3.0-preview.6 (MIT)
6
-
7
- MIT License
8
-
9
- Copyright (c) 2024 Ben Merckx
10
-
11
- Permission is hereby granted, free of charge, to any person obtaining a copy
12
- of this software and associated documentation files (the "Software"), to deal
13
- in the Software without restriction, including without limitation the rights
14
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
- copies of the Software, and to permit persons to whom the Software is
16
- furnished to do so, subject to the following conditions:
17
-
18
- The above copyright notice and this permission notice shall be included in all
19
- copies or substantial portions of the Software.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
- SOFTWARE.
28
-
29
- ===
30
-
31
5
  # jotai@3.0.0 (MIT)
32
6
 
33
7
  MIT License
@@ -55,7 +29,7 @@ SOFTWARE.
55
29
 
56
30
  ===
57
31
 
58
- # @internationalized/date@3.12.1 (Apache-2.0)
32
+ # react-aria-components@1.17.0 (Apache-2.0)
59
33
 
60
34
  Apache License
61
35
  Version 2.0, January 2004
@@ -262,11 +236,37 @@ SOFTWARE.
262
236
 
263
237
  ===
264
238
 
265
- # jotai-family@1.1.0 (MIT)
239
+ # rado@1.3.0-preview.6 (MIT)
266
240
 
267
241
  MIT License
268
242
 
269
- Copyright (c) 2025 Poimandres
243
+ Copyright (c) 2024 Ben Merckx
244
+
245
+ Permission is hereby granted, free of charge, to any person obtaining a copy
246
+ of this software and associated documentation files (the "Software"), to deal
247
+ in the Software without restriction, including without limitation the rights
248
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
249
+ copies of the Software, and to permit persons to whom the Software is
250
+ furnished to do so, subject to the following conditions:
251
+
252
+ The above copyright notice and this permission notice shall be included in all
253
+ copies or substantial portions of the Software.
254
+
255
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
256
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
257
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
258
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
259
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
260
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
261
+ SOFTWARE.
262
+
263
+ ===
264
+
265
+ # microcbor@1.2.1 (MIT)
266
+
267
+ MIT License
268
+
269
+ Copyright (c) 2021 Joel Gustafson
270
270
 
271
271
  Permission is hereby granted, free of charge, to any person obtaining a copy
272
272
  of this software and associated documentation files (the "Software"), to deal
@@ -289,7 +289,7 @@ SOFTWARE.
289
289
 
290
290
  ===
291
291
 
292
- # react-stately@3.46.0 (Apache-2.0)
292
+ # @internationalized/date@3.12.1 (Apache-2.0)
293
293
 
294
294
  Apache License
295
295
  Version 2.0, January 2004
@@ -494,33 +494,6 @@ SOFTWARE.
494
494
  limitations under the License.
495
495
 
496
496
 
497
- ===
498
-
499
- # microcbor@1.2.1 (MIT)
500
-
501
- MIT License
502
-
503
- Copyright (c) 2021 Joel Gustafson
504
-
505
- Permission is hereby granted, free of charge, to any person obtaining a copy
506
- of this software and associated documentation files (the "Software"), to deal
507
- in the Software without restriction, including without limitation the rights
508
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
509
- copies of the Software, and to permit persons to whom the Software is
510
- furnished to do so, subject to the following conditions:
511
-
512
- The above copyright notice and this permission notice shall be included in all
513
- copies or substantial portions of the Software.
514
-
515
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
516
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
517
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
518
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
519
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
520
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
521
- SOFTWARE.
522
-
523
-
524
497
  ===
525
498
 
526
499
  # @tiptap/core@3.30.5 (MIT)
@@ -550,7 +523,7 @@ SOFTWARE.
550
523
 
551
524
  ===
552
525
 
553
- # react-aria-components@1.17.0 (Apache-2.0)
526
+ # react-stately@3.46.0 (Apache-2.0)
554
527
 
555
528
  Apache License
556
529
  Version 2.0, January 2004
@@ -755,6 +728,33 @@ SOFTWARE.
755
728
  limitations under the License.
756
729
 
757
730
 
731
+ ===
732
+
733
+ # jotai-family@1.1.0 (MIT)
734
+
735
+ MIT License
736
+
737
+ Copyright (c) 2025 Poimandres
738
+
739
+ Permission is hereby granted, free of charge, to any person obtaining a copy
740
+ of this software and associated documentation files (the "Software"), to deal
741
+ in the Software without restriction, including without limitation the rights
742
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
743
+ copies of the Software, and to permit persons to whom the Software is
744
+ furnished to do so, subject to the following conditions:
745
+
746
+ The above copyright notice and this permission notice shall be included in all
747
+ copies or substantial portions of the Software.
748
+
749
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
750
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
751
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
752
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
753
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
754
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
755
+ SOFTWARE.
756
+
757
+
758
758
  ===
759
759
 
760
760
  # jotai-location@0.6.2 (MIT)
@@ -989,29 +989,6 @@ THE SOFTWARE.
989
989
  limitations under the License.
990
990
 
991
991
 
992
- ===
993
-
994
- # htmlparser2@9.1.0 (MIT)
995
-
996
- Copyright 2010, 2011, Chris Winberry <chris@winberry.net>. All rights reserved.
997
- Permission is hereby granted, free of charge, to any person obtaining a copy
998
- of this software and associated documentation files (the "Software"), to
999
- deal in the Software without restriction, including without limitation the
1000
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
1001
- sell copies of the Software, and to permit persons to whom the Software is
1002
- furnished to do so, subject to the following conditions:
1003
-
1004
- The above copyright notice and this permission notice shall be included in
1005
- all copies or substantial portions of the Software.
1006
-
1007
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1008
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1009
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1010
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1011
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1012
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1013
- IN THE SOFTWARE.
1014
-
1015
992
  ===
1016
993
 
1017
994
  # @badgateway/oauth2-client@3.3.1 (MIT)
@@ -1041,54 +1018,53 @@ SOFTWARE.
1041
1018
 
1042
1019
  ===
1043
1020
 
1044
- # domutils@3.2.2 (BSD-2-Clause)
1045
-
1046
- Copyright (c) Felix Böhm
1047
- All rights reserved.
1048
-
1049
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1050
-
1051
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
1052
-
1053
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
1054
-
1055
- THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
1056
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1057
-
1058
-
1059
- ===
1060
-
1061
- # domhandler@5.0.3 (BSD-2-Clause)
1021
+ # use-sync-external-store@1.6.0 (MIT)
1062
1022
 
1063
- Copyright (c) Felix Böhm
1064
- All rights reserved.
1023
+ MIT License
1065
1024
 
1066
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1025
+ Copyright (c) Meta Platforms, Inc. and affiliates.
1067
1026
 
1068
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
1027
+ Permission is hereby granted, free of charge, to any person obtaining a copy
1028
+ of this software and associated documentation files (the "Software"), to deal
1029
+ in the Software without restriction, including without limitation the rights
1030
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1031
+ copies of the Software, and to permit persons to whom the Software is
1032
+ furnished to do so, subject to the following conditions:
1069
1033
 
1070
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
1034
+ The above copyright notice and this permission notice shall be included in all
1035
+ copies or substantial portions of the Software.
1071
1036
 
1072
- THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
1073
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1037
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1038
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1039
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1040
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1041
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1042
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1043
+ SOFTWARE.
1074
1044
 
1075
1045
 
1076
1046
  ===
1077
1047
 
1078
- # entities@4.5.0 (BSD-2-Clause)
1079
-
1080
- Copyright (c) Felix Böhm
1081
- All rights reserved.
1082
-
1083
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1084
-
1085
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
1086
-
1087
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
1088
-
1089
- THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
1090
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1048
+ # htmlparser2@9.1.0 (MIT)
1091
1049
 
1050
+ Copyright 2010, 2011, Chris Winberry <chris@winberry.net>. All rights reserved.
1051
+ Permission is hereby granted, free of charge, to any person obtaining a copy
1052
+ of this software and associated documentation files (the "Software"), to
1053
+ deal in the Software without restriction, including without limitation the
1054
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
1055
+ sell copies of the Software, and to permit persons to whom the Software is
1056
+ furnished to do so, subject to the following conditions:
1057
+
1058
+ The above copyright notice and this permission notice shall be included in
1059
+ all copies or substantial portions of the Software.
1060
+
1061
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1062
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1063
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1064
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1065
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1066
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1067
+ IN THE SOFTWARE.
1092
1068
 
1093
1069
  ===
1094
1070
 
@@ -1146,29 +1122,53 @@ SOFTWARE.
1146
1122
 
1147
1123
  ===
1148
1124
 
1149
- # use-sync-external-store@1.6.0 (MIT)
1125
+ # domutils@3.2.2 (BSD-2-Clause)
1150
1126
 
1151
- MIT License
1127
+ Copyright (c) Felix Böhm
1128
+ All rights reserved.
1152
1129
 
1153
- Copyright (c) Meta Platforms, Inc. and affiliates.
1130
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1154
1131
 
1155
- Permission is hereby granted, free of charge, to any person obtaining a copy
1156
- of this software and associated documentation files (the "Software"), to deal
1157
- in the Software without restriction, including without limitation the rights
1158
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1159
- copies of the Software, and to permit persons to whom the Software is
1160
- furnished to do so, subject to the following conditions:
1132
+ Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
1161
1133
 
1162
- The above copyright notice and this permission notice shall be included in all
1163
- copies or substantial portions of the Software.
1134
+ Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
1164
1135
 
1165
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1166
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1167
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1168
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1169
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1170
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1171
- SOFTWARE.
1136
+ THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
1137
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1138
+
1139
+
1140
+ ===
1141
+
1142
+ # domhandler@5.0.3 (BSD-2-Clause)
1143
+
1144
+ Copyright (c) Felix Böhm
1145
+ All rights reserved.
1146
+
1147
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1148
+
1149
+ Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
1150
+
1151
+ Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
1152
+
1153
+ THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
1154
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1155
+
1156
+
1157
+ ===
1158
+
1159
+ # entities@4.5.0 (BSD-2-Clause)
1160
+
1161
+ Copyright (c) Felix Böhm
1162
+ All rights reserved.
1163
+
1164
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1165
+
1166
+ Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
1167
+
1168
+ Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
1169
+
1170
+ THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS,
1171
+ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1172
1172
 
1173
1173
 
1174
1174
  ===
@@ -19,6 +19,7 @@ import { getPreviewPayloadFromCookies } from "alinea/preview/PreviewCookies";
19
19
  import { Headers } from "@alinea/iso";
20
20
  import { cache } from "react";
21
21
  import { requestContext } from "./context.js";
22
+ import { syncIfStale } from "./syncCheck.js";
22
23
  import { jsx } from "react/jsx-runtime";
23
24
  var NextCMS = class extends CMS {
24
25
  constructor(config) {
@@ -92,7 +93,10 @@ var NextCMS = class extends CMS {
92
93
  const db = await this.bundledDb;
93
94
  const syncInterval = request.disableSync ? Number.POSITIVE_INFINITY : request.syncInterval ?? this.config.syncInterval;
94
95
  if (hasPreview) return db.resolve(request);
95
- if (!isBuild) await this.throttle(() => db.syncWith(client), syncInterval);
96
+ if (!isBuild) {
97
+ const settled = await syncIfStale(db, client, syncInterval);
98
+ if (!settled) await this.throttle(() => db.syncWith(client), syncInterval);
99
+ }
96
100
  return db.resolve(request);
97
101
  }
98
102
  async #authenticatedClient() {
@@ -19,6 +19,7 @@ import { trace } from "alinea/core/Trace";
19
19
  import { NextCMS } from "./cms.js";
20
20
  import { requestContext } from "./context.js";
21
21
  import { createDevRemote } from "./DevRemote.js";
22
+ import { revalidateContentSha } from "./syncCheck.js";
22
23
  function createHandler(input) {
23
24
  const options = input instanceof NextCMS ? { cms: input } : input;
24
25
  const config = options.cms.config;
@@ -36,18 +37,34 @@ function createHandler(input) {
36
37
  const handleBackend = createCoreHandler({
37
38
  ...options,
38
39
  remote,
39
- db
40
+ db,
41
+ // Revalidate the shared content sha before the user-provided hook so
42
+ // page revalidation triggered there already sees the fresh sha when
43
+ // RSC renders resolve. Invalidation never throws (failures are
44
+ // swallowed inside revalidateContentSha).
45
+ afterCommit: async (context) => {
46
+ await revalidateContentSha();
47
+ await options.afterCommit?.(context);
48
+ }
40
49
  });
41
50
  const handle = async (request) => {
42
51
  const url = new URL(request.url);
43
- const { searchParams } = url;
44
52
  const context = await requestContext(config, request);
45
53
  const handlerPath = handlerPathname(config, url);
46
- if (url.pathname !== handlerPath)
47
- return new Response(`Expected handler to be served on ${handlerPath}`, {
48
- status: 400
49
- });
54
+ const rewrittenFile = rewrittenFilePath(config, request);
50
55
  try {
56
+ if (rewrittenFile !== void 0) {
57
+ const backendUrl = new URL(url);
58
+ backendUrl.pathname = handlerPath;
59
+ backendUrl.searchParams.set("file", rewrittenFile);
60
+ backendUrl.searchParams.set("delivery", "proxy");
61
+ return await handleBackend(new Request(backendUrl, request), context);
62
+ }
63
+ if (url.pathname !== handlerPath)
64
+ return new Response(`Expected handler to be served on ${handlerPath}`, {
65
+ status: 400
66
+ });
67
+ const { searchParams } = url;
51
68
  const previews = new JWTPreviews(context.apiKey);
52
69
  const previewToken = searchParams.get("preview");
53
70
  if (previewToken) {
@@ -79,6 +96,18 @@ function createHandler(input) {
79
96
  function handlerPathname(config, requestUrl) {
80
97
  return new URL(Config.handlerUrl(config), requestUrl).pathname;
81
98
  }
99
+ function rewrittenFilePath(config, request) {
100
+ if (request.method !== "GET" && request.method !== "HEAD") return;
101
+ const url = new URL(request.url);
102
+ const fileRoot = new URL(Config.filePathname(config, ""), url).pathname;
103
+ const prefix = `${fileRoot}/`;
104
+ if (!url.pathname.startsWith(prefix)) return;
105
+ try {
106
+ return decodeURIComponent(url.pathname.slice(prefix.length));
107
+ } catch {
108
+ return;
109
+ }
110
+ }
82
111
  export {
83
112
  createHandler,
84
113
  handlerPathname
@@ -19,12 +19,18 @@ function NextPreviews({
19
19
  const [previewDisabled, setPreviewDisabled] = useState(false);
20
20
  const pathname = usePathname();
21
21
  const adminUrl = new URL(dashboardUrl, location.origin);
22
+ const host = window.parent !== window ? window.parent : window.opener;
23
+ let hostOrigin = adminUrl.origin;
24
+ try {
25
+ if (host?.location.origin === location.origin) hostOrigin = location.origin;
26
+ } catch {
27
+ }
22
28
  const entryParams = new URLSearchParams({ url: pathname });
23
29
  if (workspace) entryParams.set("workspace", workspace);
24
30
  if (root) entryParams.set("root", root);
25
31
  const editUrl = new URL(`#/edit?${entryParams}`, adminUrl);
26
32
  const { isPreviewing } = usePreview({
27
- hostOrigin: adminUrl.origin,
33
+ hostOrigin,
28
34
  async preview(update) {
29
35
  if (!update) return;
30
36
  const success = await setPreviewCookies(update.payload);
@@ -0,0 +1,12 @@
1
+ import type { Client } from 'alinea/core/Client';
2
+ import type { LocalDB } from 'alinea/core/db/LocalDB';
3
+ export declare const CONTENT_SHA_TAG = "alinea-content-sha";
4
+ export declare function revalidateContentSha(): Promise<void>;
5
+ /**
6
+ * Sync the isolate-local db only when it is behind the shared content sha.
7
+ * Returns true when the freshness question is settled here (synced, forced,
8
+ * or explicitly disabled) and the caller can skip its throttled sync.
9
+ * Returns false when the sha could not be determined, so the caller falls
10
+ * back to its existing throttle behavior.
11
+ */
12
+ export declare function syncIfStale(db: LocalDB, client: Client, syncInterval?: number): Promise<boolean>;
@@ -0,0 +1,59 @@
1
+ import "../../chunks/chunk-CQ52GEHY.js";
2
+
3
+ // src/adapter/next/syncCheck.ts
4
+ import { ReadonlyTree } from "alinea/core/source/Tree";
5
+ var CONTENT_SHA_TAG = "alinea-content-sha";
6
+ var SHA_REVALIDATE_SECONDS = 60;
7
+ var SENTINEL_SHA = ReadonlyTree.EMPTY.sha;
8
+ var inflight;
9
+ function latestSha(client) {
10
+ if (inflight) return inflight;
11
+ inflight = loadLatestSha(client).finally(() => {
12
+ inflight = void 0;
13
+ });
14
+ return inflight;
15
+ }
16
+ async function loadLatestSha(client) {
17
+ try {
18
+ const { unstable_cache } = await import("next/cache.js");
19
+ const getSha = unstable_cache(
20
+ async () => {
21
+ const tree = await client.getTreeIfDifferent(SENTINEL_SHA);
22
+ return tree?.sha;
23
+ },
24
+ ["alinea-content-sha"],
25
+ { revalidate: SHA_REVALIDATE_SECONDS, tags: [CONTENT_SHA_TAG] }
26
+ );
27
+ return await getSha();
28
+ } catch {
29
+ try {
30
+ const tree = await client.getTreeIfDifferent(SENTINEL_SHA);
31
+ return tree?.sha;
32
+ } catch {
33
+ return void 0;
34
+ }
35
+ }
36
+ }
37
+ async function revalidateContentSha() {
38
+ try {
39
+ const { revalidateTag } = await import("next/cache.js");
40
+ revalidateTag(CONTENT_SHA_TAG, { expire: 0 });
41
+ } catch {
42
+ }
43
+ }
44
+ async function syncIfStale(db, client, syncInterval) {
45
+ if (syncInterval === Number.POSITIVE_INFINITY) return true;
46
+ if (syncInterval === 0) {
47
+ await db.syncWith(client);
48
+ return true;
49
+ }
50
+ const expected = await latestSha(client);
51
+ if (!expected) return false;
52
+ if (expected !== db.sha) await db.syncWith(client);
53
+ return true;
54
+ }
55
+ export {
56
+ CONTENT_SHA_TAG,
57
+ revalidateContentSha,
58
+ syncIfStale
59
+ };
@@ -1,11 +1,3 @@
1
1
  import type { NextConfig } from 'next/dist/types.js';
2
- export interface WithAlineaOptions {
3
- /**
4
- * Base path where the dashboard is mounted.
5
- *
6
- * @default '/admin'
7
- */
8
- adminPath?: string;
9
- }
10
2
  export declare function createCMS(): void;
11
3
  export declare function withAlinea(config?: NextConfig): NextConfig;