alinea 2.0.0-preview.3 → 2.0.0-preview.5

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 (225) 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 +148 -94
  4. package/dist/adapter/next/DevRemote.js +10 -2
  5. package/dist/adapter/next/cms.js +5 -1
  6. package/dist/adapter/next/handler.js +35 -6
  7. package/dist/adapter/next/previews.js +7 -0
  8. package/dist/adapter/next/syncCheck.d.ts +12 -0
  9. package/dist/adapter/next/syncCheck.js +59 -0
  10. package/dist/adapter/next/with-alinea.d.ts +0 -8
  11. package/dist/adapter/next/with-alinea.js +43 -19
  12. package/dist/adapter/vite/plugin.js +9 -4
  13. package/dist/backend/Handler.js +120 -7
  14. package/dist/backend/api/BasicAuth.d.ts +1 -1
  15. package/dist/backend/api/BasicAuth.js +14 -14
  16. package/dist/backend/api/OAuth2.d.ts +3 -3
  17. package/dist/backend/api/OAuth2.js +7 -4
  18. package/dist/backend/api/ProxyMedia.d.ts +3 -0
  19. package/dist/backend/api/ProxyMedia.js +39 -0
  20. package/dist/backend/api/S3Uploads.d.ts +1 -1
  21. package/dist/backend/router/Router.js +2 -0
  22. package/dist/backend/util/Syncable.js +1 -1
  23. package/dist/bundled.d.ts +260 -95
  24. package/dist/chunks/{chunk-HFBZMKIN.js → chunk-A6M3PNJT.js} +1 -1
  25. package/dist/chunks/{chunk-Y7XOMJOC.js → chunk-CFNRVI3Y.js} +220 -247
  26. package/dist/chunks/chunk-D6UJHBJJ.js +183 -0
  27. package/dist/chunks/chunk-TIJTT5ZI.js +228 -0
  28. package/dist/cli/Generate.js +1 -3
  29. package/dist/cli/Serve.js +3 -2
  30. package/dist/cli/bin.js +1 -1
  31. package/dist/cli/generate/GenerateDashboard.js +1 -0
  32. package/dist/cli/serve/CreateLocalServer.d.ts +1 -1
  33. package/dist/cli/serve/CreateLocalServer.js +42 -34
  34. package/dist/cli/serve/LocalAuth.js +1 -1
  35. package/dist/cli/static/init/cms.js +1 -4
  36. package/dist/cli/util/ContentType.d.ts +1 -0
  37. package/dist/cli/util/ContentType.js +36 -0
  38. package/dist/cloud/AuthResult.d.ts +2 -0
  39. package/dist/cloud/CloudHandshake.d.ts +13 -0
  40. package/dist/cloud/CloudHandshake.js +121 -0
  41. package/dist/cloud/CloudRemote.d.ts +4 -1
  42. package/dist/cloud/CloudRemote.js +40 -9
  43. package/dist/components/Calendar.js +7 -7
  44. package/dist/components/Checkbox.js +2 -2
  45. package/dist/components/ColorSwatchPicker.js +2 -2
  46. package/dist/components/ComboBox.js +12 -12
  47. package/dist/components/DateField.js +4 -4
  48. package/dist/components/DatePicker.js +4 -4
  49. package/dist/components/DateRangePicker.js +8 -8
  50. package/dist/components/Disclosure.js +7 -7
  51. package/dist/components/Label.js +5 -5
  52. package/dist/components/List.d.ts +1 -1
  53. package/dist/components/List.js +29 -28
  54. package/dist/components/Menu.js +2 -2
  55. package/dist/components/MultipleSelect.js +25 -25
  56. package/dist/components/NumberField.js +3 -3
  57. package/dist/components/ProgressCircle.js +4 -4
  58. package/dist/components/SearchField.js +6 -6
  59. package/dist/components/Select.js +7 -7
  60. package/dist/components/Surface.js +3 -3
  61. package/dist/components/Table.js +6 -6
  62. package/dist/components/Tabs.js +2 -2
  63. package/dist/components/TagGroup.js +2 -2
  64. package/dist/components/TextField.js +4 -4
  65. package/dist/components/TimeField.js +1 -1
  66. package/dist/components/Toggle.d.ts +1 -1
  67. package/dist/components/Toolbar.js +1 -1
  68. package/dist/components/Tree.js +7 -7
  69. package/dist/core/Config.d.ts +10 -3
  70. package/dist/core/Config.js +16 -1
  71. package/dist/core/Connection.d.ts +7 -4
  72. package/dist/core/Entry.d.ts +6 -0
  73. package/dist/core/Entry.js +10 -0
  74. package/dist/core/Graph.d.ts +2 -2
  75. package/dist/core/Id.d.ts +1 -0
  76. package/dist/core/Id.js +8 -0
  77. package/dist/core/Role.js +16 -14
  78. package/dist/core/TextDoc.d.ts +2 -0
  79. package/dist/core/TextDoc.js +1 -0
  80. package/dist/core/Workspace.d.ts +6 -5
  81. package/dist/core/db/EntryIndex.d.ts +3 -0
  82. package/dist/core/db/EntryIndex.js +62 -0
  83. package/dist/core/db/EntryTransaction.js +33 -12
  84. package/dist/core/db/EntryUrlConflictError.js +1 -1
  85. package/dist/core/db/LinkResolver.d.ts +8 -2
  86. package/dist/core/db/LinkResolver.js +27 -5
  87. package/dist/core/db/Operation.js +4 -3
  88. package/dist/core/field/RichTextField.js +16 -10
  89. package/dist/core/media/MediaLocation.d.ts +9 -15
  90. package/dist/core/media/MediaLocation.js +29 -19
  91. package/dist/core/media/MediaTypes.js +1 -2
  92. package/dist/dashboard/App.js +30 -16
  93. package/dist/dashboard/StoryProvider.js +2 -2
  94. package/dist/dashboard/app/AccessDenied.js +4 -4
  95. package/dist/dashboard/app/ActivityStatus.js +22 -21
  96. package/dist/dashboard/app/AppShell.js +2 -2
  97. package/dist/dashboard/app/AppearanceToggle.d.ts +1 -0
  98. package/dist/dashboard/app/AppearanceToggle.js +43 -0
  99. package/dist/dashboard/app/AuthView.d.ts +1 -1
  100. package/dist/dashboard/app/AuthView.js +19 -21
  101. package/dist/dashboard/app/CompactField.js +13 -13
  102. package/dist/dashboard/app/DashboardErrorBoundary.js +26 -14
  103. package/dist/dashboard/app/DashboardLayout.js +15 -8
  104. package/dist/dashboard/app/DashboardMeta.d.ts +2 -1
  105. package/dist/dashboard/app/DashboardMeta.js +20 -5
  106. package/dist/dashboard/app/EntryFields.d.ts +3 -1
  107. package/dist/dashboard/app/EntryFields.js +17 -14
  108. package/dist/dashboard/app/EntryHeader.js +134 -102
  109. package/dist/dashboard/app/EntryHeaderActions.d.ts +21 -4
  110. package/dist/dashboard/app/EntryHeaderActions.js +48 -27
  111. package/dist/dashboard/app/EntryReferences.js +16 -16
  112. package/dist/dashboard/app/EntrySidebar.js +24 -24
  113. package/dist/dashboard/app/EntrySidebarPreview.js +16 -15
  114. package/dist/dashboard/app/EntryTranslationBanner.d.ts +3 -1
  115. package/dist/dashboard/app/EntryTranslationBanner.js +24 -21
  116. package/dist/dashboard/app/Explorer.d.ts +4 -2
  117. package/dist/dashboard/app/Explorer.js +70 -66
  118. package/dist/dashboard/app/ExplorerCards.js +49 -49
  119. package/dist/dashboard/app/ExplorerFileCard.js +18 -18
  120. package/dist/dashboard/app/ExplorerList.js +21 -22
  121. package/dist/dashboard/app/ExplorerModal.js +1 -1
  122. package/dist/dashboard/app/ExplorerPickerContent.js +2 -2
  123. package/dist/dashboard/app/ExplorerTable.js +68 -68
  124. package/dist/dashboard/app/ImagePicker.js +7 -7
  125. package/dist/dashboard/app/LinkPicker.js +17 -22
  126. package/dist/dashboard/app/LocaleMenu.d.ts +7 -0
  127. package/dist/dashboard/app/LocaleMenu.js +31 -17
  128. package/dist/dashboard/app/ReadOnlyBadge.d.ts +4 -0
  129. package/dist/dashboard/app/ReadOnlyBadge.js +33 -0
  130. package/dist/dashboard/app/SidebarLayout.js +4 -4
  131. package/dist/dashboard/app/SidebarTree.d.ts +3 -6
  132. package/dist/dashboard/app/SidebarTree.js +66 -61
  133. package/dist/dashboard/app/WorkspaceMenu.d.ts +10 -3
  134. package/dist/dashboard/app/WorkspaceMenu.js +87 -66
  135. package/dist/dashboard/app/WorkspaceMenu.stories.d.ts +2 -0
  136. package/dist/dashboard/app/WorkspaceRoots.d.ts +3 -1
  137. package/dist/dashboard/app/WorkspaceRoots.js +88 -113
  138. package/dist/dashboard/app/editor/FileEditor.d.ts +2 -3
  139. package/dist/dashboard/app/editor/FileEditor.js +35 -38
  140. package/dist/dashboard/app/editor/FilePreview.js +3 -3
  141. package/dist/dashboard/app/editor/MediaAltField.view.js +4 -4
  142. package/dist/dashboard/app/modals/CreateEntry.js +10 -10
  143. package/dist/dashboard/app/pages/EntryPage.js +85 -44
  144. package/dist/dashboard/app/pages/RootPage.js +4 -4
  145. package/dist/dashboard/app/pages/SplashPage.d.ts +3 -0
  146. package/dist/dashboard/app/pages/SplashPage.js +414 -0
  147. package/dist/dashboard/app/pages/UsersPage.js +38 -38
  148. package/dist/dashboard/app/ui/DashboardModal.js +16 -16
  149. package/dist/dashboard/app/ui/Rail.js +2 -2
  150. package/dist/dashboard/app/ui/Sidebar.js +2 -2
  151. package/dist/dashboard/atoms/ReactiveNode.js +1 -1
  152. package/dist/dashboard/atoms/activity.d.ts +0 -1
  153. package/dist/dashboard/atoms/activity.js +3 -5
  154. package/dist/dashboard/atoms/auth.d.ts +2 -0
  155. package/dist/dashboard/atoms/auth.js +6 -2
  156. package/dist/dashboard/atoms/config.js +1 -1
  157. package/dist/dashboard/atoms/core.js +2 -2
  158. package/dist/dashboard/atoms/create.js +1 -1
  159. package/dist/dashboard/atoms/dashboard.js +2 -2
  160. package/dist/dashboard/atoms/editor.d.ts +2 -1
  161. package/dist/dashboard/atoms/editor.js +5 -3
  162. package/dist/dashboard/atoms/entry.d.ts +2 -0
  163. package/dist/dashboard/atoms/entry.js +34 -16
  164. package/dist/dashboard/atoms/explorer.d.ts +5 -6
  165. package/dist/dashboard/atoms/explorer.js +68 -31
  166. package/dist/dashboard/atoms/graph.d.ts +1 -0
  167. package/dist/dashboard/atoms/graph.js +7 -2
  168. package/dist/dashboard/atoms/link.d.ts +1 -1
  169. package/dist/dashboard/atoms/link.js +41 -57
  170. package/dist/dashboard/atoms/nav.d.ts +4 -3
  171. package/dist/dashboard/atoms/nav.js +10 -5
  172. package/dist/dashboard/atoms/preview.js +1 -1
  173. package/dist/dashboard/atoms/root.d.ts +7 -2
  174. package/dist/dashboard/atoms/root.js +53 -18
  175. package/dist/dashboard/atoms/upload.d.ts +1 -0
  176. package/dist/dashboard/atoms/upload.js +3 -2
  177. package/dist/dashboard/atoms/user.d.ts +1 -1
  178. package/dist/dashboard/atoms/user.js +8 -6
  179. package/dist/dashboard/atoms/utils.js +2 -2
  180. package/dist/dashboard/boot/Boot.js +2 -4
  181. package/dist/dashboard/boot/DashboardWorker.js +35 -29
  182. package/dist/dashboard/editor/UseField.js +6 -6
  183. package/dist/dashboard/fixture/cms.d.ts +12 -0
  184. package/dist/dashboard/fixture/cms.js +54 -6
  185. package/dist/dashboard/hook/UseGraph.js +4 -4
  186. package/dist/dashboard/hook/UseRoot.js +4 -4
  187. package/dist/dashboard/hook/UseSaveShortcut.d.ts +1 -0
  188. package/dist/dashboard/hook/UseSaveShortcut.js +24 -0
  189. package/dist/dashboard/hooks.d.ts +1 -1
  190. package/dist/dashboard/hooks.js +28 -19
  191. package/dist/field/code/CodeField.view.js +12 -12
  192. package/dist/field/link/ImageLink.js +1 -3
  193. package/dist/field/link/LinkField.view.js +97 -71
  194. package/dist/field/list/ListField.view.js +23 -23
  195. package/dist/field/localiser/LocalisedField.view.js +76 -5
  196. package/dist/field/metadata/MetadataField.d.ts +3 -3
  197. package/dist/field/metadata/MetadataField.view.js +27 -20
  198. package/dist/field/object/ObjectField.view.js +11 -4
  199. package/dist/field/richtext/PickTextLink.js +11 -8
  200. package/dist/field/richtext/ReferenceLink.d.ts +2 -0
  201. package/dist/field/richtext/ReferenceLink.js +5 -0
  202. package/dist/field/richtext/RichTextBlock.js +6 -6
  203. package/dist/field/richtext/RichTextBlocks.js +1 -1
  204. package/dist/field/richtext/RichTextExtensions.js +22 -22
  205. package/dist/field/richtext/RichTextField.view.js +9 -9
  206. package/dist/field/richtext/RichTextInsertMenu.js +3 -3
  207. package/dist/field/richtext/RichTextState.js +1 -1
  208. package/dist/field/richtext/extensions/Link.d.ts +1 -0
  209. package/dist/field/richtext/extensions/Link.js +1 -0
  210. package/dist/field/text/TextField.view.js +2 -2
  211. package/dist/field/time/TimeField.d.ts +0 -2
  212. package/dist/field/time/TimeField.view.js +1 -1
  213. package/dist/index.css +459 -66
  214. package/dist/next.cjs +96 -19
  215. package/dist/picker/entry/EntryPicker.js +10 -12
  216. package/dist/picker/entry/EntryReference.d.ts +2 -0
  217. package/dist/picker/entry/EntryReference.js +1 -0
  218. package/dist/preview/RegisterPreview.d.ts +1 -1
  219. package/dist/preview/RegisterPreview.js +4 -6
  220. package/dist/preview/react.d.ts +5 -1
  221. package/dist/preview/react.js +12 -9
  222. package/dist/types.d.ts +0 -1
  223. package/package.json +1 -1
  224. package/dist/chunks/chunk-STAJCW4Z.js +0 -322
  225. package/dist/chunks/chunk-U4VOHNR2.js +0 -210
@@ -1,5 +1,5 @@
1
1
  {
2
- "_id": "3J5B7YiszA6gly0Vumu4zjLeUNP",
2
+ "_id": "3JSRaU6nbvzZquWO5cyuADRWGRm",
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
@@ -28,11 +28,11 @@ SOFTWARE.
28
28
 
29
29
  ===
30
30
 
31
- # microcbor@1.2.1 (MIT)
31
+ # jotai@3.0.0 (MIT)
32
32
 
33
33
  MIT License
34
34
 
35
- Copyright (c) 2021 Joel Gustafson
35
+ Copyright (c) 2020 Poimandres
36
36
 
37
37
  Permission is hereby granted, free of charge, to any person obtaining a copy
38
38
  of this software and associated documentation files (the "Software"), to deal
@@ -262,7 +262,61 @@ SOFTWARE.
262
262
 
263
263
  ===
264
264
 
265
- # @internationalized/date@3.12.1 (Apache-2.0)
265
+ # microcbor@1.2.1 (MIT)
266
+
267
+ MIT License
268
+
269
+ Copyright (c) 2021 Joel Gustafson
270
+
271
+ Permission is hereby granted, free of charge, to any person obtaining a copy
272
+ of this software and associated documentation files (the "Software"), to deal
273
+ in the Software without restriction, including without limitation the rights
274
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
275
+ copies of the Software, and to permit persons to whom the Software is
276
+ furnished to do so, subject to the following conditions:
277
+
278
+ The above copyright notice and this permission notice shall be included in all
279
+ copies or substantial portions of the Software.
280
+
281
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
282
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
283
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
284
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
285
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
286
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
287
+ SOFTWARE.
288
+
289
+
290
+ ===
291
+
292
+ # jotai-location@0.6.2 (MIT)
293
+
294
+ The MIT License (MIT)
295
+
296
+ Copyright (c) 2022 Daishi Kato
297
+
298
+ Permission is hereby granted, free of charge, to any person obtaining a copy
299
+ of this software and associated documentation files (the "Software"), to deal
300
+ in the Software without restriction, including without limitation the rights
301
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
302
+ copies of the Software, and to permit persons to whom the Software is
303
+ furnished to do so, subject to the following conditions:
304
+
305
+ The above copyright notice and this permission notice shall be included in
306
+ all copies or substantial portions of the Software.
307
+
308
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
309
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
310
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
311
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
312
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
313
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
314
+ THE SOFTWARE.
315
+
316
+
317
+ ===
318
+
319
+ # react-stately@3.46.0 (Apache-2.0)
266
320
 
267
321
  Apache License
268
322
  Version 2.0, January 2004
@@ -469,34 +523,7 @@ SOFTWARE.
469
523
 
470
524
  ===
471
525
 
472
- # @tiptap/core@3.30.5 (MIT)
473
-
474
- MIT License
475
-
476
- Copyright (c) 2025, Tiptap GmbH
477
-
478
- Permission is hereby granted, free of charge, to any person obtaining a copy
479
- of this software and associated documentation files (the "Software"), to deal
480
- in the Software without restriction, including without limitation the rights
481
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
482
- copies of the Software, and to permit persons to whom the Software is
483
- furnished to do so, subject to the following conditions:
484
-
485
- The above copyright notice and this permission notice shall be included in all
486
- copies or substantial portions of the Software.
487
-
488
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
489
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
490
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
491
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
492
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
493
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
494
- SOFTWARE.
495
-
496
-
497
- ===
498
-
499
- # react-stately@3.46.0 (Apache-2.0)
526
+ # @internationalized/date@3.12.1 (Apache-2.0)
500
527
 
501
528
  Apache License
502
529
  Version 2.0, January 2004
@@ -703,11 +730,11 @@ SOFTWARE.
703
730
 
704
731
  ===
705
732
 
706
- # jotai-location@0.6.2 (MIT)
733
+ # jotai-family@1.1.0 (MIT)
707
734
 
708
- The MIT License (MIT)
735
+ MIT License
709
736
 
710
- Copyright (c) 2022 Daishi Kato
737
+ Copyright (c) 2025 Poimandres
711
738
 
712
739
  Permission is hereby granted, free of charge, to any person obtaining a copy
713
740
  of this software and associated documentation files (the "Software"), to deal
@@ -716,25 +743,25 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
716
743
  copies of the Software, and to permit persons to whom the Software is
717
744
  furnished to do so, subject to the following conditions:
718
745
 
719
- The above copyright notice and this permission notice shall be included in
720
- all copies or substantial portions of the Software.
746
+ The above copyright notice and this permission notice shall be included in all
747
+ copies or substantial portions of the Software.
721
748
 
722
749
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
723
750
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
724
751
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
725
752
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
726
753
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
727
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
728
- THE SOFTWARE.
754
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
755
+ SOFTWARE.
729
756
 
730
757
 
731
758
  ===
732
759
 
733
- # @badgateway/oauth2-client@3.3.1 (MIT)
760
+ # @tiptap/core@3.30.5 (MIT)
734
761
 
735
762
  MIT License
736
763
 
737
- Copyright (c) 2019-2025 Evert Pot
764
+ Copyright (c) 2025, Tiptap GmbH
738
765
 
739
766
  Permission is hereby granted, free of charge, to any person obtaining a copy
740
767
  of this software and associated documentation files (the "Software"), to deal
@@ -755,6 +782,29 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
755
782
  SOFTWARE.
756
783
 
757
784
 
785
+ ===
786
+
787
+ # htmlparser2@9.1.0 (MIT)
788
+
789
+ Copyright 2010, 2011, Chris Winberry <chris@winberry.net>. All rights reserved.
790
+ Permission is hereby granted, free of charge, to any person obtaining a copy
791
+ of this software and associated documentation files (the "Software"), to
792
+ deal in the Software without restriction, including without limitation the
793
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
794
+ sell copies of the Software, and to permit persons to whom the Software is
795
+ furnished to do so, subject to the following conditions:
796
+
797
+ The above copyright notice and this permission notice shall be included in
798
+ all copies or substantial portions of the Software.
799
+
800
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
801
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
802
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
803
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
804
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
805
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
806
+ IN THE SOFTWARE.
807
+
758
808
  ===
759
809
 
760
810
  # react-aria@3.48.0 (Apache-2.0)
@@ -991,61 +1041,11 @@ SOFTWARE.
991
1041
 
992
1042
  ===
993
1043
 
994
- # use-sync-external-store@1.6.0 (MIT)
995
-
996
- MIT License
997
-
998
- Copyright (c) Meta Platforms, Inc. and affiliates.
999
-
1000
- Permission is hereby granted, free of charge, to any person obtaining a copy
1001
- of this software and associated documentation files (the "Software"), to deal
1002
- in the Software without restriction, including without limitation the rights
1003
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1004
- copies of the Software, and to permit persons to whom the Software is
1005
- furnished to do so, subject to the following conditions:
1006
-
1007
- The above copyright notice and this permission notice shall be included in all
1008
- copies or substantial portions of the Software.
1009
-
1010
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1011
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1012
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1013
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1014
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1015
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1016
- SOFTWARE.
1017
-
1018
-
1019
- ===
1020
-
1021
- # htmlparser2@9.1.0 (MIT)
1022
-
1023
- Copyright 2010, 2011, Chris Winberry <chris@winberry.net>. All rights reserved.
1024
- Permission is hereby granted, free of charge, to any person obtaining a copy
1025
- of this software and associated documentation files (the "Software"), to
1026
- deal in the Software without restriction, including without limitation the
1027
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
1028
- sell copies of the Software, and to permit persons to whom the Software is
1029
- furnished to do so, subject to the following conditions:
1030
-
1031
- The above copyright notice and this permission notice shall be included in
1032
- all copies or substantial portions of the Software.
1033
-
1034
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1035
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1036
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1037
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1038
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1039
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1040
- IN THE SOFTWARE.
1041
-
1042
- ===
1043
-
1044
- # fp16@1.0.0 (MIT)
1044
+ # @badgateway/oauth2-client@3.3.1 (MIT)
1045
1045
 
1046
1046
  MIT License
1047
1047
 
1048
- Copyright (c) 2021 Joel Gustafson
1048
+ Copyright (c) 2019-2025 Evert Pot
1049
1049
 
1050
1050
  Permission is hereby granted, free of charge, to any person obtaining a copy
1051
1051
  of this software and associated documentation files (the "Software"), to deal
@@ -1117,6 +1117,60 @@ THIS IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRE
1117
1117
  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1118
1118
 
1119
1119
 
1120
+ ===
1121
+
1122
+ # use-sync-external-store@1.6.0 (MIT)
1123
+
1124
+ MIT License
1125
+
1126
+ Copyright (c) Meta Platforms, Inc. and affiliates.
1127
+
1128
+ Permission is hereby granted, free of charge, to any person obtaining a copy
1129
+ of this software and associated documentation files (the "Software"), to deal
1130
+ in the Software without restriction, including without limitation the rights
1131
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1132
+ copies of the Software, and to permit persons to whom the Software is
1133
+ furnished to do so, subject to the following conditions:
1134
+
1135
+ The above copyright notice and this permission notice shall be included in all
1136
+ copies or substantial portions of the Software.
1137
+
1138
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1139
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1140
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1141
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1142
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1143
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1144
+ SOFTWARE.
1145
+
1146
+
1147
+ ===
1148
+
1149
+ # fp16@1.0.0 (MIT)
1150
+
1151
+ MIT License
1152
+
1153
+ Copyright (c) 2021 Joel Gustafson
1154
+
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:
1161
+
1162
+ The above copyright notice and this permission notice shall be included in all
1163
+ copies or substantial portions of the Software.
1164
+
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.
1172
+
1173
+
1120
1174
  ===
1121
1175
 
1122
1176
  # dom-serializer@2.0.0 (MIT)
@@ -1136,7 +1190,7 @@ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
1136
1190
 
1137
1191
  ===
1138
1192
 
1139
- # @internationalized/string@3.2.8 (Apache-2.0)
1193
+ # @internationalized/number@3.6.6 (Apache-2.0)
1140
1194
 
1141
1195
  Apache License
1142
1196
  Version 2.0, January 2004
@@ -1343,7 +1397,7 @@ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
1343
1397
 
1344
1398
  ===
1345
1399
 
1346
- # @internationalized/number@3.6.6 (Apache-2.0)
1400
+ # @internationalized/string@3.2.8 (Apache-2.0)
1347
1401
 
1348
1402
  Apache License
1349
1403
  Version 2.0, January 2004
@@ -12,8 +12,16 @@ function createDevRemote(context, config) {
12
12
  applyAuth: context.applyAuth
13
13
  });
14
14
  const auth = {
15
- async authenticate() {
16
- return Response.json({ type: AuthResultType.Authenticated });
15
+ async authenticate(_request, options) {
16
+ const user = await client.user();
17
+ if (!user)
18
+ throw new MissingCredentialsError(
19
+ "Missing forwarded development authentication"
20
+ );
21
+ return Response.json({
22
+ type: AuthResultType.Authenticated,
23
+ ...await options.authenticated(user)
24
+ });
17
25
  },
18
26
  async verify() {
19
27
  const user = await client.user();
@@ -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,11 +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({
33
+ hostOrigin,
27
34
  async preview(update) {
28
35
  if (!update) return;
29
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;