sandcms 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/admin/Admin.svelte +7 -5
- package/dist/admin/AssetAttachment.svelte +8 -3
- package/dist/admin/AssetAttachment.svelte.d.ts +3 -0
- package/dist/admin/Editor.svelte +5 -9
- package/dist/admin/Fields.svelte +2 -1
- package/dist/admin/Gallery.svelte +221 -76
- package/dist/admin/Inbox.svelte +3 -2
- package/dist/admin/MediaPicker.svelte +36 -20
- package/dist/admin/Navigation.svelte +13 -2
- package/dist/admin/Pages.svelte +195 -0
- package/dist/admin/Pages.svelte.d.ts +7 -0
- package/dist/admin/Shell.svelte +27 -5
- package/dist/admin/SortableList.svelte +82 -61
- package/dist/admin/SortableList.svelte.d.ts +3 -1
- package/dist/admin/Users.svelte +8 -3
- package/dist/admin/generated/admin.css +300 -20
- package/dist/admin/navigation.d.ts +9 -0
- package/dist/admin/navigation.js +20 -1
- package/dist/admin/types.d.ts +1 -0
- package/dist/blueprints/labels.d.ts +6 -0
- package/dist/blueprints/labels.js +14 -0
- package/dist/blueprints/load.js +11 -2
- package/dist/blueprints/types.d.ts +2 -2
- package/dist/cli/admin.d.ts +39 -0
- package/dist/cli/admin.js +95 -0
- package/dist/cli/backup.js +4 -4
- package/dist/cli/doctor.d.ts +8 -1
- package/dist/cli/doctor.js +19 -9
- package/dist/cli/email-test.d.ts +3 -0
- package/dist/cli/email-test.js +20 -0
- package/dist/cli/files.js +2 -1
- package/dist/cli/index.js +373 -135
- package/dist/cli/rebaseline.d.ts +10 -0
- package/dist/cli/rebaseline.js +117 -0
- package/dist/cli/upgrade.js +17 -9
- package/dist/env.d.ts +0 -8
- package/dist/env.js +0 -8
- package/dist/notification-fields.js +2 -1
- package/dist/server/admin-load.d.ts +72 -0
- package/dist/server/admin-load.js +20 -0
- package/dist/server/api-keys.d.ts +96 -0
- package/dist/server/api-keys.js +115 -0
- package/dist/server/api.js +16 -61
- package/dist/server/cms.d.ts +0 -5
- package/dist/server/cms.js +4 -3
- package/dist/server/db/auto-migrate.d.ts +0 -4
- package/dist/server/db/auto-migrate.js +12 -3
- package/dist/server/db/legacy.d.ts +13 -0
- package/dist/server/db/legacy.js +60 -0
- package/dist/server/db/migration-data.js +2 -38
- package/dist/server/db/migrations/{0000_foundation.sql → 0000_baseline.sql} +120 -4
- package/dist/server/db/migrations/meta/0000_snapshot.json +578 -3
- package/dist/server/db/migrations/meta/_journal.json +2 -65
- package/dist/server/db/schema.js +8 -6
- package/dist/server/db/store.d.ts +25 -2
- package/dist/server/db/store.js +90 -26
- package/dist/server/forms.js +2 -1
- package/dist/server/media/runner.d.ts +1 -1
- package/dist/server/media/runner.js +1 -1
- package/dist/server/media/service.d.ts +0 -4
- package/dist/server/media/service.js +0 -2
- package/dist/server/media/verify.d.ts +28 -0
- package/dist/server/media/verify.js +94 -2
- package/dist/server/platform/snapshots.js +3 -3
- package/docs/acceptance.md +2 -2
- package/docs/api.md +15 -1
- package/docs/cloudflare.md +9 -41
- package/docs/content.md +18 -3
- package/docs/deployment.md +97 -34
- package/docs/email.md +6 -0
- package/docs/forms.md +1 -1
- package/docs/media.md +10 -1
- package/docs/package.md +4 -4
- package/docs/releases.md +21 -1
- package/docs/upgrades.md +41 -7
- package/package.json +4 -10
- package/templates/Dockerfile +6 -2
- package/templates/integration.ts +10 -5
- package/templates/openship.json +9 -0
- package/templates/sandcms/config.yaml +1 -0
- package/dist/server/db/migrations/0001_independent_password_resets.sql +0 -3
- package/dist/server/db/migrations/0002_email_failure_reason.sql +0 -1
- package/dist/server/db/migrations/0003_direct_r2_uploads.sql +0 -10
- package/dist/server/db/migrations/0004_agent_api_keys.sql +0 -38
- package/dist/server/db/migrations/0005_api_retention_and_pagination.sql +0 -3
- package/dist/server/db/migrations/0006_durable_media_deletion.sql +0 -7
- package/dist/server/db/migrations/0007_content_and_job_indexes.sql +0 -2
- package/dist/server/db/migrations/0008_search_text_cache.sql +0 -45
- package/dist/server/db/migrations/0009_local_media.sql +0 -9
- package/dist/server/db/migrations/meta/0001_snapshot.json +0 -1197
- package/dist/server/db/migrations/meta/0002_snapshot.json +0 -1204
- package/dist/server/db/migrations/meta/0003_snapshot.json +0 -1281
- package/dist/server/db/migrations/meta/0004_snapshot.json +0 -1546
- package/dist/server/db/migrations/meta/0005_snapshot.json +0 -1572
- package/dist/server/db/migrations/meta/0006_snapshot.json +0 -1627
- package/dist/server/db/migrations/meta/0007_snapshot.json +0 -1643
- package/dist/server/db/migrations/meta/0008_snapshot.json +0 -1711
- package/dist/server/db/migrations/meta/0009_snapshot.json +0 -1763
- package/dist/server/media/import-r2.d.ts +0 -56
- package/dist/server/media/import-r2.js +0 -342
- package/dist/worker/index.d.ts +0 -10
- package/dist/worker/index.js +0 -460
- package/dist/worker/local.d.ts +0 -5
- package/dist/worker/local.js +0 -57
- package/dist/worker/source.d.ts +0 -2
- package/dist/worker/source.js +0 -31
- package/dist/worker/svg.d.ts +0 -1
- package/dist/worker/svg.js +0 -2
- package/dist/worker/uploads.d.ts +0 -22
- package/dist/worker/uploads.js +0 -48
|
@@ -1481,10 +1481,6 @@
|
|
|
1481
1481
|
--sandcms-tw-blur: blur(8px);
|
|
1482
1482
|
filter: var(--sandcms-tw-blur, ) var(--sandcms-tw-brightness, ) var(--sandcms-tw-contrast, ) var(--sandcms-tw-grayscale, ) var(--sandcms-tw-hue-rotate, ) var(--sandcms-tw-invert, ) var(--sandcms-tw-saturate, ) var(--sandcms-tw-sepia, ) var(--sandcms-tw-drop-shadow, );
|
|
1483
1483
|
}
|
|
1484
|
-
.sepia {
|
|
1485
|
-
--sandcms-tw-sepia: sepia(100%);
|
|
1486
|
-
filter: var(--sandcms-tw-blur, ) var(--sandcms-tw-brightness, ) var(--sandcms-tw-contrast, ) var(--sandcms-tw-grayscale, ) var(--sandcms-tw-hue-rotate, ) var(--sandcms-tw-invert, ) var(--sandcms-tw-saturate, ) var(--sandcms-tw-sepia, ) var(--sandcms-tw-drop-shadow, );
|
|
1487
|
-
}
|
|
1488
1484
|
.transition-all {
|
|
1489
1485
|
transition-property: all;
|
|
1490
1486
|
transition-timing-function: var(--sandcms-tw-ease, var(--sandcms-default-transition-timing-function));
|
|
@@ -2340,6 +2336,9 @@
|
|
|
2340
2336
|
.sm\:flex-row {
|
|
2341
2337
|
flex-direction: row;
|
|
2342
2338
|
}
|
|
2339
|
+
.sm\:justify-between {
|
|
2340
|
+
justify-content: space-between;
|
|
2341
|
+
}
|
|
2343
2342
|
.sm\:justify-end {
|
|
2344
2343
|
justify-content: flex-end;
|
|
2345
2344
|
}
|
|
@@ -2955,6 +2954,8 @@
|
|
|
2955
2954
|
}
|
|
2956
2955
|
:scope {
|
|
2957
2956
|
--sandcms-cms-bar-height: 56px;
|
|
2957
|
+
--sandcms-cms-sidebar-inset: 22px;
|
|
2958
|
+
--sandcms-cms-site-mark: 24px;
|
|
2958
2959
|
font-family: 'SandCMS Geist', sans-serif;
|
|
2959
2960
|
font-size: 14px;
|
|
2960
2961
|
line-height: 1.5;
|
|
@@ -2989,8 +2990,14 @@
|
|
|
2989
2990
|
.cms-sidebar > .cms-wordmark {
|
|
2990
2991
|
flex-shrink: 0;
|
|
2991
2992
|
height: var(--sandcms-cms-bar-height);
|
|
2993
|
+
padding: 0 var(--sandcms-cms-sidebar-inset);
|
|
2992
2994
|
border-bottom: 1px solid var(--sandcms-border);
|
|
2993
2995
|
}
|
|
2996
|
+
.cms-sidebar > .cms-wordmark svg {
|
|
2997
|
+
flex-shrink: 0;
|
|
2998
|
+
width: var(--sandcms-cms-site-mark);
|
|
2999
|
+
height: var(--sandcms-cms-site-mark);
|
|
3000
|
+
}
|
|
2994
3001
|
.cms-wordmark svg {
|
|
2995
3002
|
color: var(--sandcms-primary);
|
|
2996
3003
|
}
|
|
@@ -2998,7 +3005,7 @@
|
|
|
2998
3005
|
display: flex;
|
|
2999
3006
|
gap: 10px;
|
|
3000
3007
|
align-items: center;
|
|
3001
|
-
padding: 14px
|
|
3008
|
+
padding: 14px var(--sandcms-cms-sidebar-inset);
|
|
3002
3009
|
border-bottom: 1px solid var(--sandcms-border);
|
|
3003
3010
|
}
|
|
3004
3011
|
.cms-site strong, .cms-profile strong {
|
|
@@ -3019,13 +3026,19 @@
|
|
|
3019
3026
|
display: grid;
|
|
3020
3027
|
place-items: center;
|
|
3021
3028
|
flex-shrink: 0;
|
|
3022
|
-
width:
|
|
3023
|
-
height:
|
|
3029
|
+
width: var(--sandcms-cms-site-mark);
|
|
3030
|
+
height: var(--sandcms-cms-site-mark);
|
|
3024
3031
|
background: var(--sandcms-background);
|
|
3025
3032
|
border: 1px solid var(--sandcms-border);
|
|
3026
3033
|
font-size: 12px;
|
|
3027
3034
|
font-weight: 550;
|
|
3028
3035
|
}
|
|
3036
|
+
.cms-site-logo {
|
|
3037
|
+
flex-shrink: 0;
|
|
3038
|
+
width: var(--sandcms-cms-site-mark);
|
|
3039
|
+
height: var(--sandcms-cms-site-mark);
|
|
3040
|
+
object-fit: contain;
|
|
3041
|
+
}
|
|
3029
3042
|
.cms-sidebar nav {
|
|
3030
3043
|
flex: 1;
|
|
3031
3044
|
overflow-y: auto;
|
|
@@ -3321,6 +3334,20 @@
|
|
|
3321
3334
|
overflow: hidden;
|
|
3322
3335
|
text-overflow: ellipsis;
|
|
3323
3336
|
}
|
|
3337
|
+
.cms-sort {
|
|
3338
|
+
display: inline-flex;
|
|
3339
|
+
align-items: center;
|
|
3340
|
+
gap: 4px;
|
|
3341
|
+
font: inherit;
|
|
3342
|
+
cursor: pointer;
|
|
3343
|
+
}
|
|
3344
|
+
.cms-sort:hover {
|
|
3345
|
+
color: var(--sandcms-foreground);
|
|
3346
|
+
}
|
|
3347
|
+
.cms-page-path {
|
|
3348
|
+
font-family: var(--sandcms-font-mono, ui-monospace, monospace);
|
|
3349
|
+
font-size: 12px;
|
|
3350
|
+
}
|
|
3324
3351
|
.cms-actions {
|
|
3325
3352
|
display: flex;
|
|
3326
3353
|
gap: 8px;
|
|
@@ -3677,21 +3704,277 @@
|
|
|
3677
3704
|
display: grid;
|
|
3678
3705
|
gap: 8px;
|
|
3679
3706
|
}
|
|
3680
|
-
.cms-
|
|
3707
|
+
.cms-gallery {
|
|
3708
|
+
display: grid;
|
|
3709
|
+
gap: 12px;
|
|
3710
|
+
}
|
|
3711
|
+
.cms-sortable.cms-sortable-grid {
|
|
3712
|
+
grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
|
|
3713
|
+
}
|
|
3714
|
+
.cms-sortable-grid > .cms-sortable-row {
|
|
3715
|
+
display: block;
|
|
3716
|
+
padding: 0;
|
|
3717
|
+
border: 0;
|
|
3718
|
+
min-width: 0;
|
|
3719
|
+
}
|
|
3720
|
+
.cms-sortable-grid > .cms-sortable-row.cms-drag-over {
|
|
3721
|
+
background: none;
|
|
3722
|
+
outline-offset: 3px;
|
|
3723
|
+
}
|
|
3724
|
+
.cms-sortable-grid > .cms-sortable-row.cms-dragging {
|
|
3725
|
+
opacity: 0.5;
|
|
3726
|
+
}
|
|
3727
|
+
.cms-gallery-tile {
|
|
3681
3728
|
display: flex;
|
|
3682
|
-
|
|
3683
|
-
|
|
3729
|
+
flex-direction: column;
|
|
3730
|
+
height: 100%;
|
|
3731
|
+
border: 1px solid var(--sandcms-border);
|
|
3732
|
+
background: var(--sandcms-card);
|
|
3733
|
+
}
|
|
3734
|
+
.cms-gallery-tile[data-invalid] {
|
|
3735
|
+
border-color: var(--sandcms-destructive);
|
|
3736
|
+
}
|
|
3737
|
+
.cms-gallery-tile > .cms-error {
|
|
3738
|
+
padding: 0 10px 10px;
|
|
3684
3739
|
font-size: 11px;
|
|
3685
3740
|
}
|
|
3686
|
-
.cms-
|
|
3687
|
-
|
|
3688
|
-
|
|
3741
|
+
.cms-gallery-media {
|
|
3742
|
+
position: relative;
|
|
3743
|
+
aspect-ratio: 4 / 3;
|
|
3744
|
+
background: var(--sandcms-muted);
|
|
3745
|
+
overflow: clip;
|
|
3746
|
+
}
|
|
3747
|
+
.cms-gallery-media > img {
|
|
3748
|
+
position: absolute;
|
|
3749
|
+
inset: 0;
|
|
3750
|
+
width: 100%;
|
|
3751
|
+
height: 100%;
|
|
3752
|
+
object-fit: contain;
|
|
3753
|
+
}
|
|
3754
|
+
.cms-gallery-media > img.cms-gallery-backdrop {
|
|
3689
3755
|
object-fit: cover;
|
|
3756
|
+
filter: blur(18px) saturate(1.1) brightness(0.9);
|
|
3757
|
+
transform: scale(1.25);
|
|
3690
3758
|
}
|
|
3691
|
-
.cms-
|
|
3692
|
-
|
|
3759
|
+
.cms-gallery-missing {
|
|
3760
|
+
display: flex;
|
|
3761
|
+
height: 100%;
|
|
3762
|
+
flex-direction: column;
|
|
3763
|
+
align-items: center;
|
|
3764
|
+
justify-content: center;
|
|
3765
|
+
gap: 6px;
|
|
3766
|
+
color: var(--sandcms-muted-foreground);
|
|
3767
|
+
font-size: 11px;
|
|
3768
|
+
}
|
|
3769
|
+
.cms-gallery-handle {
|
|
3770
|
+
position: absolute;
|
|
3771
|
+
top: 8px;
|
|
3772
|
+
left: 8px;
|
|
3773
|
+
}
|
|
3774
|
+
.cms-gallery-handle > .cms-drag-handle {
|
|
3775
|
+
display: inline-flex;
|
|
3776
|
+
align-items: center;
|
|
3777
|
+
gap: 3px;
|
|
3778
|
+
height: 26px;
|
|
3779
|
+
padding: 0 8px 0 6px;
|
|
3780
|
+
line-height: 1;
|
|
3781
|
+
border-radius: 0;
|
|
3782
|
+
background: var(--sandcms-background);
|
|
3783
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
3784
|
+
background: color-mix(in oklch, var(--sandcms-background) 88%, transparent);
|
|
3785
|
+
}
|
|
3786
|
+
color: var(--sandcms-foreground);
|
|
3787
|
+
font-size: 11px;
|
|
3788
|
+
font-weight: 600;
|
|
3789
|
+
font-variant-numeric: tabular-nums;
|
|
3790
|
+
box-shadow: 0 1px 2px oklch(0 0 0 / 0.15);
|
|
3791
|
+
}
|
|
3792
|
+
.cms-gallery-corner {
|
|
3793
|
+
position: absolute;
|
|
3794
|
+
top: 8px;
|
|
3795
|
+
right: 8px;
|
|
3796
|
+
display: flex;
|
|
3797
|
+
gap: 4px;
|
|
3798
|
+
}
|
|
3799
|
+
.cms-gallery-corner > button {
|
|
3800
|
+
background: var(--sandcms-background);
|
|
3801
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
3802
|
+
background: color-mix(in oklch, var(--sandcms-background) 88%, transparent);
|
|
3803
|
+
}
|
|
3804
|
+
box-shadow: 0 1px 2px oklch(0 0 0 / 0.15);
|
|
3805
|
+
}
|
|
3806
|
+
.cms-gallery-corner > .cms-gallery-alt-warning {
|
|
3807
|
+
background: oklch(0.85 0.17 85);
|
|
3808
|
+
color: oklch(0.3 0.08 60);
|
|
3809
|
+
}
|
|
3810
|
+
.cms-gallery-corner > .cms-gallery-alt-warning:hover {
|
|
3811
|
+
background: oklch(0.8 0.17 80);
|
|
3812
|
+
}
|
|
3813
|
+
.cms-gallery-corner > .cms-gallery-remove:hover {
|
|
3814
|
+
background: var(--sandcms-destructive);
|
|
3815
|
+
color: var(--sandcms-primary-foreground);
|
|
3816
|
+
}
|
|
3817
|
+
.cms-gallery-handle > .cms-drag-handle > span {
|
|
3818
|
+
display: block;
|
|
3819
|
+
min-width: 1ch;
|
|
3820
|
+
line-height: 1;
|
|
3821
|
+
text-align: center;
|
|
3822
|
+
}
|
|
3823
|
+
.cms-gallery-status {
|
|
3824
|
+
position: absolute;
|
|
3825
|
+
bottom: 8px;
|
|
3826
|
+
left: 8px;
|
|
3827
|
+
padding: 2px 6px;
|
|
3828
|
+
background: var(--sandcms-foreground);
|
|
3829
|
+
color: var(--sandcms-background);
|
|
3830
|
+
font-size: 10px;
|
|
3831
|
+
font-weight: 600;
|
|
3832
|
+
text-transform: capitalize;
|
|
3833
|
+
}
|
|
3834
|
+
@media (hover: hover) {
|
|
3835
|
+
.cms-gallery-corner > .cms-gallery-remove {
|
|
3836
|
+
opacity: 0;
|
|
3837
|
+
transition: opacity 120ms;
|
|
3838
|
+
}
|
|
3839
|
+
.cms-gallery-tile:hover .cms-gallery-remove, .cms-gallery-tile:focus-within .cms-gallery-remove {
|
|
3840
|
+
opacity: 1;
|
|
3841
|
+
}
|
|
3842
|
+
}
|
|
3843
|
+
.cms-gallery-meta {
|
|
3844
|
+
display: flex;
|
|
3845
|
+
align-items: center;
|
|
3846
|
+
gap: 4px;
|
|
3847
|
+
padding: 8px 4px 8px 10px;
|
|
3848
|
+
}
|
|
3849
|
+
.cms-gallery-filename {
|
|
3850
|
+
overflow: hidden;
|
|
3851
|
+
font-size: 12px;
|
|
3852
|
+
font-weight: 500;
|
|
3853
|
+
text-overflow: ellipsis;
|
|
3854
|
+
white-space: nowrap;
|
|
3855
|
+
}
|
|
3856
|
+
.cms-gallery-summary {
|
|
3857
|
+
display: flex;
|
|
3858
|
+
align-items: center;
|
|
3859
|
+
gap: 6px;
|
|
3860
|
+
min-width: 0;
|
|
3861
|
+
overflow: hidden;
|
|
3862
|
+
color: var(--sandcms-muted-foreground);
|
|
3863
|
+
font-size: 11px;
|
|
3864
|
+
white-space: nowrap;
|
|
3865
|
+
}
|
|
3866
|
+
.cms-gallery-tile[data-invalid] .cms-gallery-summary {
|
|
3867
|
+
color: var(--sandcms-destructive);
|
|
3868
|
+
}
|
|
3869
|
+
.cms-gallery-summary-text {
|
|
3870
|
+
min-width: 0;
|
|
3871
|
+
overflow: hidden;
|
|
3872
|
+
text-overflow: ellipsis;
|
|
3873
|
+
}
|
|
3874
|
+
.cms-gallery-dot {
|
|
3875
|
+
flex: none;
|
|
3876
|
+
width: 6px;
|
|
3877
|
+
height: 6px;
|
|
3878
|
+
border-radius: 999px;
|
|
3879
|
+
background: var(--sandcms-primary);
|
|
3880
|
+
}
|
|
3881
|
+
.cms-gallery-dialog-title {
|
|
3882
|
+
overflow: hidden;
|
|
3883
|
+
padding-right: 28px;
|
|
3884
|
+
text-overflow: ellipsis;
|
|
3885
|
+
white-space: nowrap;
|
|
3886
|
+
}
|
|
3887
|
+
.cms-gallery-dialog {
|
|
3888
|
+
max-width: min(760px, calc(100% - 2rem)) !important;
|
|
3889
|
+
max-height: 88vh;
|
|
3890
|
+
overflow-y: auto;
|
|
3891
|
+
}
|
|
3892
|
+
.cms-gallery-dialog-body {
|
|
3893
|
+
display: grid;
|
|
3894
|
+
grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
|
|
3895
|
+
gap: 20px;
|
|
3896
|
+
align-items: start;
|
|
3897
|
+
}
|
|
3898
|
+
.cms-gallery-preview > img {
|
|
3899
|
+
display: block;
|
|
3900
|
+
width: 100%;
|
|
3901
|
+
height: auto;
|
|
3902
|
+
max-height: 360px;
|
|
3903
|
+
object-fit: contain;
|
|
3904
|
+
background: var(--sandcms-muted);
|
|
3905
|
+
}
|
|
3906
|
+
.cms-gallery-preview > .cms-gallery-missing {
|
|
3907
|
+
aspect-ratio: 4 / 3;
|
|
3908
|
+
height: auto;
|
|
3909
|
+
background: var(--sandcms-muted);
|
|
3910
|
+
}
|
|
3911
|
+
.cms-gallery-details {
|
|
3912
|
+
display: grid;
|
|
3913
|
+
gap: 16px;
|
|
3914
|
+
}
|
|
3915
|
+
.cms-gallery-detail {
|
|
3916
|
+
position: relative;
|
|
3917
|
+
display: grid;
|
|
3918
|
+
gap: 8px;
|
|
3919
|
+
}
|
|
3920
|
+
.cms-gallery-detail-head {
|
|
3921
|
+
display: flex;
|
|
3922
|
+
align-items: center;
|
|
3923
|
+
justify-content: space-between;
|
|
3924
|
+
gap: 8px;
|
|
3925
|
+
min-height: 24px;
|
|
3926
|
+
}
|
|
3927
|
+
.cms-gallery-detail-label {
|
|
3928
|
+
font-size: 12px;
|
|
3929
|
+
font-weight: 500;
|
|
3930
|
+
}
|
|
3931
|
+
.cms-gallery-detail .cms-field > :is(label, h3):first-child {
|
|
3932
|
+
display: flex;
|
|
3933
|
+
align-items: center;
|
|
3934
|
+
min-height: 24px;
|
|
3935
|
+
margin: 0;
|
|
3936
|
+
padding-right: 72px;
|
|
3937
|
+
}
|
|
3938
|
+
.cms-gallery-detail > .cms-gallery-reset {
|
|
3939
|
+
position: absolute;
|
|
3940
|
+
top: 0;
|
|
3941
|
+
right: 0;
|
|
3942
|
+
z-index: 1;
|
|
3943
|
+
}
|
|
3944
|
+
.cms-gallery-inherited {
|
|
3945
|
+
padding: 7px 10px;
|
|
3946
|
+
border: 1px dashed var(--sandcms-border);
|
|
3947
|
+
color: var(--sandcms-foreground);
|
|
3948
|
+
font-size: 12px;
|
|
3693
3949
|
overflow-wrap: anywhere;
|
|
3694
3950
|
}
|
|
3951
|
+
.cms-gallery-inherited-empty {
|
|
3952
|
+
color: var(--sandcms-muted-foreground);
|
|
3953
|
+
}
|
|
3954
|
+
.cms-gallery-inherited-warning {
|
|
3955
|
+
display: flex;
|
|
3956
|
+
align-items: center;
|
|
3957
|
+
gap: 6px;
|
|
3958
|
+
border-color: oklch(0.8 0.15 80);
|
|
3959
|
+
background: oklch(0.85 0.17 85 / 0.12);
|
|
3960
|
+
color: var(--sandcms-foreground);
|
|
3961
|
+
}
|
|
3962
|
+
.cms-gallery-inherited-warning > svg {
|
|
3963
|
+
flex: none;
|
|
3964
|
+
color: oklch(0.65 0.16 65);
|
|
3965
|
+
}
|
|
3966
|
+
@media (max-width: 640px) {
|
|
3967
|
+
.cms-sortable.cms-sortable-grid {
|
|
3968
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
3969
|
+
gap: 10px;
|
|
3970
|
+
}
|
|
3971
|
+
.cms-gallery-dialog-body {
|
|
3972
|
+
grid-template-columns: minmax(0, 1fr);
|
|
3973
|
+
}
|
|
3974
|
+
.cms-gallery-preview > img {
|
|
3975
|
+
max-height: 220px;
|
|
3976
|
+
}
|
|
3977
|
+
}
|
|
3695
3978
|
.cms-usages a {
|
|
3696
3979
|
text-decoration: underline;
|
|
3697
3980
|
}
|
|
@@ -3809,13 +4092,13 @@
|
|
|
3809
4092
|
outline: 2px solid currentColor;
|
|
3810
4093
|
outline-offset: 2px;
|
|
3811
4094
|
}
|
|
3812
|
-
:scope:where([data-theme='dark'], [data-theme='dark'] *) [data-slot='attachment-media'] img, :scope:where([data-theme='dark'], [data-theme='dark'] *) .cms-asset-preview, :scope:where([data-theme='dark'], [data-theme='dark'] *) .cms-
|
|
4095
|
+
:scope:where([data-theme='dark'], [data-theme='dark'] *) [data-slot='attachment-media'] img, :scope:where([data-theme='dark'], [data-theme='dark'] *) .cms-asset-preview, :scope:where([data-theme='dark'], [data-theme='dark'] *) .cms-gallery-media, :scope:where([data-theme='dark'], [data-theme='dark'] *) .cms-gallery-preview > img {
|
|
3813
4096
|
background-color: oklch(0.86 0.003 56);
|
|
3814
4097
|
background-image: conic-gradient( oklch(0.78 0.004 56) 25%, transparent 0 50%, oklch(0.78 0.004 56) 0 75%, transparent 0 );
|
|
3815
4098
|
background-size: 16px 16px;
|
|
3816
4099
|
}
|
|
3817
4100
|
@media (prefers-color-scheme: dark) {
|
|
3818
|
-
:scope:where([data-theme='system'], [data-theme='system'] *) [data-slot='attachment-media'] img, :scope:where([data-theme='system'], [data-theme='system'] *) .cms-asset-preview, :scope:where([data-theme='system'], [data-theme='system'] *) .cms-
|
|
4101
|
+
:scope:where([data-theme='system'], [data-theme='system'] *) [data-slot='attachment-media'] img, :scope:where([data-theme='system'], [data-theme='system'] *) .cms-asset-preview, :scope:where([data-theme='system'], [data-theme='system'] *) .cms-gallery-media, :scope:where([data-theme='system'], [data-theme='system'] *) .cms-gallery-preview > img {
|
|
3819
4102
|
background-color: oklch(0.86 0.003 56);
|
|
3820
4103
|
background-image: conic-gradient( oklch(0.78 0.004 56) 25%, transparent 0 50%, oklch(0.78 0.004 56) 0 75%, transparent 0 );
|
|
3821
4104
|
background-size: 16px 16px;
|
|
@@ -4254,9 +4537,6 @@ a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible
|
|
|
4254
4537
|
.cms-login-card {
|
|
4255
4538
|
padding: 25px;
|
|
4256
4539
|
}
|
|
4257
|
-
.cms-selected-image {
|
|
4258
|
-
flex-wrap: wrap;
|
|
4259
|
-
}
|
|
4260
4540
|
.cms-media-grid {
|
|
4261
4541
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
4262
4542
|
gap: 12px;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
import type { Blueprint } from '../blueprints/types.js';
|
|
2
|
+
export declare const pagesHref = "/admin/pages";
|
|
3
|
+
/** Pages in the default Pages group are listed on the Pages screen instead of the sidebar. */
|
|
4
|
+
export declare const inPagesIndex: (blueprint: Blueprint) => boolean;
|
|
2
5
|
export declare function navigationGroups<T extends Blueprint>(blueprints: T[]): {
|
|
3
6
|
group: string | false;
|
|
4
7
|
blueprints: T[];
|
|
8
|
+
href?: string;
|
|
5
9
|
}[];
|
|
6
10
|
export declare const blueprintHref: (blueprint: Blueprint) => string;
|
|
7
11
|
export declare const navigationSelected: (pathname: string, href: string) => boolean;
|
|
12
|
+
/** The public path of an entry from its blueprint's `preview` template, if any. */
|
|
13
|
+
export declare const previewPath: (blueprint: Pick<Blueprint, "preview"> | undefined, entry: {
|
|
14
|
+
id: string;
|
|
15
|
+
draft: Record<string, unknown>;
|
|
16
|
+
} | null | undefined) => string | null;
|
package/dist/admin/navigation.js
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
|
+
export const pagesHref = '/admin/pages';
|
|
2
|
+
/** Pages in the default Pages group are listed on the Pages screen instead of the sidebar. */
|
|
3
|
+
export const inPagesIndex = (blueprint) => blueprint.kind === 'page' && (blueprint.navigation?.group ?? 'Pages') === 'Pages';
|
|
1
4
|
export function navigationGroups(blueprints) {
|
|
2
5
|
const items = [];
|
|
3
6
|
const groups = new Map();
|
|
4
7
|
// Preserve the existing kind order, then blueprint order within each kind.
|
|
5
8
|
for (const kind of ['page', 'collection', 'form', 'site']) {
|
|
6
9
|
for (const blueprint of blueprints.filter((b) => b.kind === kind)) {
|
|
7
|
-
|
|
10
|
+
if (inPagesIndex(blueprint)) {
|
|
11
|
+
let item = groups.get(pagesHref);
|
|
12
|
+
if (!item) {
|
|
13
|
+
item = { group: 'Pages', blueprints: [], href: pagesHref };
|
|
14
|
+
groups.set(pagesHref, item);
|
|
15
|
+
items.push(item);
|
|
16
|
+
}
|
|
17
|
+
item.blueprints.push(blueprint);
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
const group = blueprint.navigation?.group ?? false;
|
|
8
21
|
if (group === false) {
|
|
9
22
|
items.push({ group, blueprints: [blueprint] });
|
|
10
23
|
}
|
|
@@ -23,3 +36,9 @@ export function navigationGroups(blueprints) {
|
|
|
23
36
|
}
|
|
24
37
|
export const blueprintHref = (blueprint) => `/admin/${blueprint.kind === 'form' ? 'forms' : 'content'}/${blueprint.id}`;
|
|
25
38
|
export const navigationSelected = (pathname, href) => pathname === href || pathname.startsWith(href + '/');
|
|
39
|
+
/** The public path of an entry from its blueprint's `preview` template, if any. */
|
|
40
|
+
export const previewPath = (blueprint, entry) => entry && blueprint?.preview
|
|
41
|
+
? blueprint.preview
|
|
42
|
+
.replace('{slug}', encodeURIComponent(String(entry.draft.slug ?? entry.id)))
|
|
43
|
+
.replace('{id}', entry.id)
|
|
44
|
+
: null;
|
package/dist/admin/types.d.ts
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Turns a machine key such as `meta_title` or `ctaLabel` into a readable label. */
|
|
2
|
+
export declare function humanizeKey(key: string): string;
|
|
3
|
+
/** Explicit blueprint labels win; otherwise the key is humanized. */
|
|
4
|
+
export declare function fieldLabel(key: string, field?: {
|
|
5
|
+
label?: string;
|
|
6
|
+
}): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Turns a machine key such as `meta_title` or `ctaLabel` into a readable label. */
|
|
2
|
+
export function humanizeKey(key) {
|
|
3
|
+
const words = key
|
|
4
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
5
|
+
.replace(/[_-]+/g, ' ')
|
|
6
|
+
.trim()
|
|
7
|
+
.replace(/\s+/g, ' ')
|
|
8
|
+
.toLowerCase();
|
|
9
|
+
return words ? words.charAt(0).toUpperCase() + words.slice(1) : key;
|
|
10
|
+
}
|
|
11
|
+
/** Explicit blueprint labels win; otherwise the key is humanized. */
|
|
12
|
+
export function fieldLabel(key, field) {
|
|
13
|
+
return field?.label ?? humanizeKey(key);
|
|
14
|
+
}
|
package/dist/blueprints/load.js
CHANGED
|
@@ -204,10 +204,19 @@ const anyBlueprint = z.discriminatedUnion('kind', [blueprint, fileBlueprint]);
|
|
|
204
204
|
const config = z
|
|
205
205
|
.object({
|
|
206
206
|
name: z.string().min(1),
|
|
207
|
+
/** Admin sidebar logo: a root-relative path or http(s) URL, or false for the site initial. */
|
|
208
|
+
logo: z
|
|
209
|
+
.union([
|
|
210
|
+
z.literal(false),
|
|
211
|
+
z
|
|
212
|
+
.string()
|
|
213
|
+
.regex(/^(\/(?!\/)|https?:\/\/)\S+$/, 'Use a path starting with / (for example /logo.svg), an http(s) URL, or false')
|
|
214
|
+
])
|
|
215
|
+
.optional(),
|
|
207
216
|
media: z
|
|
208
217
|
.object({
|
|
209
|
-
/**
|
|
210
|
-
workerUrl: z.
|
|
218
|
+
/** Removed in 0.8.0. Still accepted and ignored so existing config.yaml files keep loading. */
|
|
219
|
+
workerUrl: z.string().optional(),
|
|
211
220
|
photographerCollection: key.optional(),
|
|
212
221
|
defaultFileBlueprint: key.optional(),
|
|
213
222
|
uploadLimit: z.number().int().min(1).max(500_000_000).default(100_000_000),
|
|
@@ -80,9 +80,9 @@ export interface ImagePreset {
|
|
|
80
80
|
}
|
|
81
81
|
export interface SiteConfig {
|
|
82
82
|
name: string;
|
|
83
|
+
/** Admin sidebar logo; omitted uses the page favicon, false shows the site initial. */
|
|
84
|
+
logo?: string | false;
|
|
83
85
|
media: {
|
|
84
|
-
/** @deprecated 0.7.0: only read by `sandcms media import-r2`. */
|
|
85
|
-
workerUrl?: string;
|
|
86
86
|
photographerCollection?: string;
|
|
87
87
|
defaultFileBlueprint?: string;
|
|
88
88
|
uploadLimit: number;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Store } from '../server/db/store.js';
|
|
2
|
+
export declare function findUser(store: Store, email: string): {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
email: string;
|
|
6
|
+
emailVerified: boolean;
|
|
7
|
+
image: string | null;
|
|
8
|
+
createdAt: Date;
|
|
9
|
+
updatedAt: Date;
|
|
10
|
+
role: "admin" | "editor";
|
|
11
|
+
mustChangePassword: boolean;
|
|
12
|
+
twoFactorEnabled: boolean | null;
|
|
13
|
+
};
|
|
14
|
+
export declare function listUsers(store: Store): {
|
|
15
|
+
email: string;
|
|
16
|
+
name: string;
|
|
17
|
+
role: "admin" | "editor";
|
|
18
|
+
twoFactor: boolean;
|
|
19
|
+
mustChangePassword: boolean;
|
|
20
|
+
activeSessions: number;
|
|
21
|
+
createdAt: string;
|
|
22
|
+
}[];
|
|
23
|
+
export declare function removeUser(store: Store, email: string): {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
email: string;
|
|
27
|
+
emailVerified: boolean;
|
|
28
|
+
image: string | null;
|
|
29
|
+
createdAt: Date;
|
|
30
|
+
updatedAt: Date;
|
|
31
|
+
role: "admin" | "editor";
|
|
32
|
+
mustChangePassword: boolean;
|
|
33
|
+
twoFactorEnabled: boolean | null;
|
|
34
|
+
};
|
|
35
|
+
export declare function setRole(store: Store, email: string, role: string): boolean;
|
|
36
|
+
/** End the sessions of one user, or of every user when `email` is undefined. Returns the number ended. */
|
|
37
|
+
export declare function signOut(store: Store, email?: string): number;
|
|
38
|
+
/** Revoke every API key of the user with this email, auditing each. Returns the number revoked. */
|
|
39
|
+
export declare function revokeOwnerKeys(store: Store, email: string): number;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// Operator commands for users and their API keys. They act as `operator` in the audit log.
|
|
2
|
+
import { count, eq, gt } from 'drizzle-orm';
|
|
3
|
+
import { apikey, audit, session, user } from '../server/db/schema.js';
|
|
4
|
+
import { deleteUser } from '../server/auth.js';
|
|
5
|
+
import { revokeApiKey } from '../server/api-keys.js';
|
|
6
|
+
const ACTOR = 'operator';
|
|
7
|
+
function auditEntry(db, action, detail) {
|
|
8
|
+
db.insert(audit)
|
|
9
|
+
.values({ id: crypto.randomUUID(), action, actor: ACTOR, detail, createdAt: Date.now() })
|
|
10
|
+
.run();
|
|
11
|
+
}
|
|
12
|
+
export function findUser(store, email) {
|
|
13
|
+
const found = store.db
|
|
14
|
+
.select()
|
|
15
|
+
.from(user)
|
|
16
|
+
.where(eq(user.email, email.trim().toLowerCase()))
|
|
17
|
+
.get();
|
|
18
|
+
if (!found)
|
|
19
|
+
throw new Error(`No user with email ${email}`);
|
|
20
|
+
return found;
|
|
21
|
+
}
|
|
22
|
+
export function listUsers(store) {
|
|
23
|
+
const now = new Date();
|
|
24
|
+
const sessions = new Map(store.db
|
|
25
|
+
.select({ userId: session.userId, count: count() })
|
|
26
|
+
.from(session)
|
|
27
|
+
.where(gt(session.expiresAt, now))
|
|
28
|
+
.groupBy(session.userId)
|
|
29
|
+
.all()
|
|
30
|
+
.map((row) => [row.userId, row.count]));
|
|
31
|
+
return store.db
|
|
32
|
+
.select()
|
|
33
|
+
.from(user)
|
|
34
|
+
.orderBy(user.email)
|
|
35
|
+
.all()
|
|
36
|
+
.map((u) => ({
|
|
37
|
+
email: u.email,
|
|
38
|
+
name: u.name,
|
|
39
|
+
role: u.role,
|
|
40
|
+
twoFactor: Boolean(u.twoFactorEnabled),
|
|
41
|
+
mustChangePassword: u.mustChangePassword,
|
|
42
|
+
activeSessions: sessions.get(u.id) ?? 0,
|
|
43
|
+
createdAt: u.createdAt.toISOString()
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
export function removeUser(store, email) {
|
|
47
|
+
const target = findUser(store, email);
|
|
48
|
+
deleteUser(store, target.id, ACTOR);
|
|
49
|
+
return target;
|
|
50
|
+
}
|
|
51
|
+
export function setRole(store, email, role) {
|
|
52
|
+
if (role !== 'admin' && role !== 'editor')
|
|
53
|
+
throw new Error('Role must be admin or editor');
|
|
54
|
+
return store.db.transaction((tx) => {
|
|
55
|
+
const target = tx.select().from(user).where(eq(user.email, email.trim().toLowerCase())).get();
|
|
56
|
+
if (!target)
|
|
57
|
+
throw new Error(`No user with email ${email}`);
|
|
58
|
+
if (target.role === role)
|
|
59
|
+
return false;
|
|
60
|
+
if (target.role === 'admin' &&
|
|
61
|
+
tx.select({ id: user.id }).from(user).where(eq(user.role, 'admin')).all().length <= 1)
|
|
62
|
+
throw new Error('Keep at least one admin');
|
|
63
|
+
tx.update(user).set({ role, updatedAt: new Date() }).where(eq(user.id, target.id)).run();
|
|
64
|
+
auditEntry(tx, 'user.role', { id: target.id, from: target.role, to: role });
|
|
65
|
+
return true;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/** End the sessions of one user, or of every user when `email` is undefined. Returns the number ended. */
|
|
69
|
+
export function signOut(store, email) {
|
|
70
|
+
return store.db.transaction((tx) => {
|
|
71
|
+
let ended;
|
|
72
|
+
if (email) {
|
|
73
|
+
const target = tx.select().from(user).where(eq(user.email, email.trim().toLowerCase())).get();
|
|
74
|
+
if (!target)
|
|
75
|
+
throw new Error(`No user with email ${email}`);
|
|
76
|
+
ended = tx.delete(session).where(eq(session.userId, target.id)).returning().all().length;
|
|
77
|
+
auditEntry(tx, 'user.sign-out', { id: target.id, sessions: ended });
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
ended = tx.delete(session).returning().all().length;
|
|
81
|
+
auditEntry(tx, 'user.sign-out-all', { sessions: ended });
|
|
82
|
+
}
|
|
83
|
+
return ended;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/** Revoke every API key of the user with this email, auditing each. Returns the number revoked. */
|
|
87
|
+
export function revokeOwnerKeys(store, email) {
|
|
88
|
+
const owner = findUser(store, email);
|
|
89
|
+
const ids = store.db
|
|
90
|
+
.select({ id: apikey.id })
|
|
91
|
+
.from(apikey)
|
|
92
|
+
.where(eq(apikey.referenceId, owner.id))
|
|
93
|
+
.all();
|
|
94
|
+
return ids.filter((key) => revokeApiKey(store, key.id, ACTOR)).length;
|
|
95
|
+
}
|
package/dist/cli/backup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Database } from 'bun:sqlite';
|
|
2
2
|
import { existsSync, mkdirSync, renameSync, unlinkSync, chmodSync, realpathSync } from 'node:fs';
|
|
3
3
|
import { resolve, dirname } from 'node:path';
|
|
4
|
-
import { openStore, volumeGuard,
|
|
4
|
+
import { openStore, volumeGuard, schemaHistory, databasePath } from '../server/db/store.js';
|
|
5
5
|
export function verifyBackup(path) {
|
|
6
6
|
const db = new Database(path, { readonly: true });
|
|
7
7
|
try {
|
|
@@ -9,12 +9,12 @@ export function verifyBackup(path) {
|
|
|
9
9
|
if (integrity.integrity_check !== 'ok')
|
|
10
10
|
throw new Error('Backup failed integrity check');
|
|
11
11
|
const version = db.query('PRAGMA user_version').get();
|
|
12
|
-
if (version.user_version
|
|
12
|
+
if (version.user_version < 1)
|
|
13
13
|
throw new Error('Incompatible backup schema');
|
|
14
14
|
if (db.query('PRAGMA foreign_key_check').all().length)
|
|
15
15
|
throw new Error('Backup contains invalid references');
|
|
16
|
-
//
|
|
17
|
-
|
|
16
|
+
// Names and hashes: a newer release's non-breaking migrations are accepted, like at start-up.
|
|
17
|
+
schemaHistory(db);
|
|
18
18
|
}
|
|
19
19
|
finally {
|
|
20
20
|
db.close();
|