rimecms 1.3.0 → 1.4.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/dist/adapter-sqlite/collection.server.js +2 -1
- package/dist/adapter-sqlite/columns.server.d.ts +42 -61
- package/dist/adapter-sqlite/columns.server.js +50 -111
- package/dist/adapter-sqlite/generate-schema/column.server.d.ts +8 -6
- package/dist/adapter-sqlite/generate-schema/column.server.js +13 -49
- package/dist/adapter-sqlite/generate-schema/index.server.d.ts +1 -0
- package/dist/adapter-sqlite/generate-schema/index.server.js +6 -0
- package/dist/adapter-sqlite/generate-schema/relations/junction.server.d.ts +3 -3
- package/dist/adapter-sqlite/generate-schema/relations/junction.server.js +3 -3
- package/dist/adapter-sqlite/generate-schema/root.server.d.ts +4 -0
- package/dist/adapter-sqlite/generate-schema/root.server.js +26 -33
- package/dist/adapter-sqlite/generate-schema/templates.server.d.ts +0 -22
- package/dist/adapter-sqlite/generate-schema/templates.server.js +0 -33
- package/dist/adapter-sqlite/generate-schema/write.server.d.ts +6 -0
- package/dist/adapter-sqlite/generate-schema/write.server.js +6 -0
- package/dist/adapter-sqlite/index.server.js +5 -0
- package/dist/adapter-sqlite/locales.server.js +1 -4
- package/dist/adapter-sqlite/order-by.server.d.ts +6 -0
- package/dist/adapter-sqlite/order-by.server.js +6 -0
- package/dist/adapter-sqlite/read.server.d.ts +12 -1
- package/dist/adapter-sqlite/read.server.js +94 -38
- package/dist/adapter-sqlite/registry.server.d.ts +2 -2
- package/dist/adapter-sqlite/registry.server.js +2 -2
- package/dist/adapter-sqlite/relations.server.d.ts +5 -0
- package/dist/adapter-sqlite/relations.server.js +27 -7
- package/dist/adapter-sqlite/repeatable.server.d.ts +4 -1
- package/dist/adapter-sqlite/repeatable.server.js +4 -1
- package/dist/adapter-sqlite/select.server.d.ts +6 -0
- package/dist/adapter-sqlite/select.server.js +56 -113
- package/dist/adapter-sqlite/table.server.js +7 -0
- package/dist/adapter-sqlite/transform.server.js +8 -2
- package/dist/adapter-sqlite/where.server.d.ts +11 -0
- package/dist/adapter-sqlite/where.server.js +237 -236
- package/dist/adapter-sqlite/write.server.d.ts +5 -0
- package/dist/adapter-sqlite/write.server.js +9 -7
- package/dist/core/adapter.d.ts +36 -12
- package/dist/core/auth/access.d.ts +3 -5
- package/dist/core/auth/access.js +3 -5
- package/dist/core/auth/augment.js +3 -4
- package/dist/core/auth/augment.server.d.ts +4 -0
- package/dist/core/auth/augment.server.js +4 -0
- package/dist/core/auth/better-auth/config.server.d.ts +24 -16
- package/dist/core/auth/better-auth/config.server.js +6 -0
- package/dist/core/auth/better-auth/hooks.server.js +17 -5
- package/dist/core/auth/better-auth/instance.server.d.ts +38 -32
- package/dist/core/auth/better-auth/permissions.d.ts +8 -7
- package/dist/core/auth/better-auth/permissions.js +1 -0
- package/dist/core/auth/better-auth-tables.server.d.ts +5 -6
- package/dist/core/auth/better-auth-tables.server.js +5 -6
- package/dist/core/auth/constant.d.ts +3 -3
- package/dist/core/auth/constant.js +3 -3
- package/dist/core/auth/constant.server.d.ts +3 -3
- package/dist/core/auth/constant.server.js +3 -3
- package/dist/core/auth/handler/index.server.js +2 -6
- package/dist/core/auth/hooks/create-better-auth-user.server.d.ts +4 -2
- package/dist/core/auth/hooks/create-better-auth-user.server.js +132 -185
- package/dist/core/auth/hooks/forward-roles.server.d.ts +2 -1
- package/dist/core/auth/hooks/forward-roles.server.js +3 -3
- package/dist/core/auth/hooks/populate-api-key.server.d.ts +2 -2
- package/dist/core/auth/hooks/populate-api-key.server.js +11 -3
- package/dist/core/auth/hooks/prevent-user-mutations.server.d.ts +2 -2
- package/dist/core/auth/hooks/prevent-user-mutations.server.js +5 -4
- package/dist/core/auth/hooks/sign-in-new-user.server.d.ts +5 -6
- package/dist/core/auth/hooks/sign-in-new-user.server.js +5 -6
- package/dist/core/auth/staff/derive.d.ts +10 -0
- package/dist/core/auth/staff/derive.js +10 -0
- package/dist/core/auth/tables.d.ts +4 -0
- package/dist/core/auth/tables.js +4 -0
- package/dist/core/auth/types.d.ts +10 -5
- package/dist/core/auth/validate-config.d.ts +1 -3
- package/dist/core/auth/validate-config.js +2 -4
- package/dist/core/boot.server.d.ts +38 -32
- package/dist/core/codegen.server.js +8 -2
- package/dist/core/config/build.d.ts +1 -1
- package/dist/core/config/build.server.d.ts +2 -1
- package/dist/core/config/build.server.js +1 -0
- package/dist/core/config/context.server.d.ts +3 -9
- package/dist/core/config/context.server.js +3 -9
- package/dist/core/config/index.server.d.ts +4 -2
- package/dist/core/config/index.server.js +4 -2
- package/dist/core/config/types.d.ts +13 -4
- package/dist/core/config/validate.server.d.ts +4 -0
- package/dist/core/config/validate.server.js +100 -90
- package/dist/core/constants.d.ts +13 -5
- package/dist/core/constants.js +13 -5
- package/dist/core/constants.server.d.ts +7 -0
- package/dist/core/constants.server.js +7 -0
- package/dist/core/dev/cache.server.d.ts +10 -7
- package/dist/core/dev/cache.server.js +10 -11
- package/dist/core/dev/cli/commands/build.d.ts +5 -0
- package/dist/core/dev/cli/commands/build.js +17 -2
- package/dist/core/dev/cli/commands/clear.server.d.ts +1 -0
- package/dist/core/dev/cli/commands/clear.server.js +3 -2
- package/dist/core/dev/cli/commands/generate-exports.server.js +25 -4
- package/dist/core/dev/cli/commands/generate.server.d.ts +5 -0
- package/dist/core/dev/cli/commands/generate.server.js +7 -8
- package/dist/core/dev/cli/commands/init.server.d.ts +7 -0
- package/dist/core/dev/cli/commands/init.server.js +34 -7
- package/dist/core/dev/cli/index.js +16 -14
- package/dist/core/dev/cli/templates/build.d.ts +4 -0
- package/dist/core/dev/cli/templates/build.js +4 -0
- package/dist/core/dev/cli/templates/init.d.ts +2 -1
- package/dist/core/dev/cli/templates/init.js +17 -9
- package/dist/core/dev/cli/util/package-manager.server.d.ts +6 -1
- package/dist/core/dev/cli/util/package-manager.server.js +14 -10
- package/dist/core/dev/cli/util/package.server.d.ts +1 -0
- package/dist/core/dev/cli/util/package.server.js +2 -2
- package/dist/core/dev/cli/util/project-name.d.ts +2 -1
- package/dist/core/dev/cli/util/project-name.js +6 -4
- package/dist/core/dev/cli/util/prompt.server.d.ts +2 -1
- package/dist/core/dev/cli/util/prompt.server.js +2 -1
- package/dist/core/dev/codegen/routes/common.server.d.ts +12 -0
- package/dist/core/dev/codegen/routes/common.server.js +9 -17
- package/dist/core/dev/codegen/routes/custom-css.server.d.ts +3 -9
- package/dist/core/dev/codegen/routes/custom-css.server.js +8 -34
- package/dist/core/dev/codegen/routes/index.server.d.ts +4 -5
- package/dist/core/dev/codegen/routes/index.server.js +33 -17
- package/dist/core/dev/codegen/routes/util.server.d.ts +13 -23
- package/dist/core/dev/codegen/routes/util.server.js +15 -25
- package/dist/core/dev/codegen/runtime/index.server.d.ts +2 -3
- package/dist/core/dev/codegen/runtime/index.server.js +2 -3
- package/dist/core/dev/codegen/runtime/parse-exports.server.js +10 -3
- package/dist/core/dev/codegen/sanitize/index.server.d.ts +11 -1
- package/dist/core/dev/codegen/sanitize/index.server.js +81 -50
- package/dist/core/dev/codegen/types/index.server.d.ts +2 -4
- package/dist/core/dev/codegen/types/index.server.js +6 -10
- package/dist/core/dev/codegen/types/templates.server.d.ts +4 -2
- package/dist/core/dev/codegen/types/templates.server.js +13 -26
- package/dist/core/dev/config-memo.server.js +6 -7
- package/dist/core/dev/constants.server.d.ts +4 -2
- package/dist/core/dev/constants.server.js +7 -4
- package/dist/core/dev/ensure.server.d.ts +5 -0
- package/dist/core/dev/ensure.server.js +11 -6
- package/dist/core/dev/env.server.d.ts +3 -1
- package/dist/core/dev/env.server.js +3 -1
- package/dist/core/dev/vite.server.d.ts +10 -0
- package/dist/core/dev/vite.server.js +13 -1
- package/dist/core/errors/handler.server.d.ts +9 -3
- package/dist/core/errors/handler.server.js +11 -6
- package/dist/core/errors/index.d.ts +21 -1
- package/dist/core/errors/index.js +23 -3
- package/dist/core/fields/builders/boolean-builder.d.ts +4 -0
- package/dist/core/fields/builders/boolean-builder.js +6 -1
- package/dist/core/fields/builders/field-builder.d.ts +16 -4
- package/dist/core/fields/builders/field-builder.js +11 -0
- package/dist/core/fields/builders/form-field-builder.d.ts +46 -2
- package/dist/core/fields/builders/form-field-builder.js +47 -2
- package/dist/core/fields/builders/index.d.ts +0 -2
- package/dist/core/fields/builders/index.js +0 -2
- package/dist/core/fields/builders/select-builder.d.ts +13 -2
- package/dist/core/fields/builders/select-builder.js +13 -1
- package/dist/core/fields/initial.d.ts +4 -1
- package/dist/core/fields/types.d.ts +5 -6
- package/dist/core/fields/util.d.ts +9 -14
- package/dist/core/fields/util.js +10 -15
- package/dist/core/fields/validate.d.ts +3 -0
- package/dist/core/fields/validate.js +3 -0
- package/dist/core/fields/walk.d.ts +4 -1
- package/dist/core/fields/walk.js +1 -2
- package/dist/core/handler.server.d.ts +5 -0
- package/dist/core/handler.server.js +15 -1
- package/dist/core/i18n/en/common.d.ts +28 -0
- package/dist/core/i18n/en/common.js +28 -0
- package/dist/core/i18n/en/errors.d.ts +6 -0
- package/dist/core/i18n/en/errors.js +6 -0
- package/dist/core/i18n/en/fields.d.ts +11 -0
- package/dist/core/i18n/en/fields.js +12 -1
- package/dist/core/i18n/fr/common.d.ts +28 -0
- package/dist/core/i18n/fr/common.js +29 -0
- package/dist/core/i18n/fr/errors.d.ts +6 -0
- package/dist/core/i18n/fr/errors.js +6 -0
- package/dist/core/i18n/fr/fields.d.ts +11 -0
- package/dist/core/i18n/fr/fields.js +12 -1
- package/dist/core/i18n/index.d.ts +1 -0
- package/dist/core/i18n/index.js +7 -0
- package/dist/core/i18n/register.server.js +1 -1
- package/dist/core/locale/types.d.ts +2 -6
- package/dist/core/logger.server.js +8 -2
- package/dist/core/panel/configure.js +2 -2
- package/dist/core/panel/types.d.ts +4 -2
- package/dist/core/pipeline/build-document.server.d.ts +2 -2
- package/dist/core/pipeline/build-document.server.js +2 -2
- package/dist/core/pipeline/build.server.js +2 -12
- package/dist/core/{prototype/shared/versions/hooks → pipeline}/fallback-data-from-original.d.ts +6 -6
- package/dist/core/{prototype/shared/versions/hooks → pipeline}/fallback-data-from-original.js +5 -5
- package/dist/core/pipeline/hooks/original-config-map.server.d.ts +3 -2
- package/dist/core/pipeline/hooks/original-config-map.server.js +3 -2
- package/dist/core/pipeline/hooks/process-document-fields.server.d.ts +2 -1
- package/dist/core/pipeline/hooks/process-document-fields.server.js +4 -9
- package/dist/core/pipeline/hooks/sort-document-props.server.js +4 -3
- package/dist/core/pipeline/hooks/validate-fields.server.d.ts +15 -1
- package/dist/core/pipeline/hooks/validate-fields.server.js +142 -47
- package/dist/core/pipeline/persist/blocks/extract.server.d.ts +5 -0
- package/dist/core/pipeline/persist/blocks/extract.server.js +5 -0
- package/dist/core/pipeline/persist/blocks/index.server.d.ts +3 -7
- package/dist/core/pipeline/persist/blocks/index.server.js +3 -8
- package/dist/core/pipeline/persist/relations/diff.server.js +1 -0
- package/dist/core/pipeline/persist/relations/extract.server.d.ts +1 -0
- package/dist/core/pipeline/persist/relations/extract.server.js +2 -0
- package/dist/core/pipeline/persist/relations/index.server.d.ts +6 -0
- package/dist/core/pipeline/persist/relations/index.server.js +31 -8
- package/dist/core/pipeline/persist/repeatable.server.d.ts +21 -12
- package/dist/core/pipeline/persist/repeatable.server.js +28 -4
- package/dist/core/pipeline/persist/tree/extract.server.d.ts +5 -0
- package/dist/core/pipeline/persist/tree/extract.server.js +6 -8
- package/dist/core/pipeline/persist/tree/index.server.d.ts +5 -0
- package/dist/core/pipeline/persist/tree/index.server.js +5 -0
- package/dist/core/pipeline/populate-relations.server.d.ts +1 -0
- package/dist/core/pipeline/populate-relations.server.js +1 -0
- package/dist/core/pipeline/run.server.d.ts +26 -17
- package/dist/core/pipeline/run.server.js +51 -9
- package/dist/core/pipeline/types.d.ts +30 -7
- package/dist/core/pipeline/without-denied-fields.d.ts +15 -0
- package/dist/core/pipeline/without-denied-fields.js +53 -2
- package/dist/core/plugins/api-init/index.server.d.ts +8 -0
- package/dist/core/plugins/api-init/index.server.js +8 -0
- package/dist/core/plugins/cache/HeaderButton.svelte +15 -6
- package/dist/core/plugins/cache/cache.server.d.ts +9 -0
- package/dist/core/plugins/cache/cache.server.js +9 -0
- package/dist/core/plugins/cache/handler.server.d.ts +5 -0
- package/dist/core/plugins/cache/handler.server.js +5 -0
- package/dist/core/plugins/cache/module.server.d.ts +4 -19
- package/dist/core/plugins/cache/module.server.js +5 -1
- package/dist/core/plugins/cache/types.d.ts +6 -0
- package/dist/core/plugins/index.d.ts +1 -0
- package/dist/core/plugins/index.js +1 -0
- package/dist/core/plugins/mailer/index.server.d.ts +5 -2
- package/dist/core/plugins/mailer/index.server.js +4 -0
- package/dist/core/plugins/plugins.server.d.ts +1 -0
- package/dist/core/plugins/plugins.server.js +1 -0
- package/dist/core/plugins/sse/client.js +4 -0
- package/dist/core/prototype/area/definition.server.d.ts +2 -3
- package/dist/core/prototype/area/definition.server.js +2 -3
- package/dist/core/prototype/area/operations/find.d.ts +5 -0
- package/dist/core/prototype/area/operations/find.js +5 -0
- package/dist/core/prototype/area/rest/endpoint.server.d.ts +3 -3
- package/dist/core/prototype/area/rest/endpoint.server.js +3 -3
- package/dist/core/prototype/area/rest/get.server.d.ts +2 -1
- package/dist/core/prototype/area/rest/get.server.js +2 -1
- package/dist/core/prototype/area/rest/update.server.d.ts +2 -1
- package/dist/core/prototype/area/rest/update.server.js +2 -1
- package/dist/core/prototype/collection/api.server.d.ts +15 -1
- package/dist/core/prototype/collection/api.server.js +16 -0
- package/dist/core/prototype/collection/augment-label.d.ts +9 -0
- package/dist/core/prototype/collection/augment-label.js +9 -0
- package/dist/core/prototype/collection/definition.d.ts +1 -1
- package/dist/core/prototype/collection/definition.js +1 -1
- package/dist/core/prototype/collection/hooks/merge-with-initial.server.d.ts +3 -3
- package/dist/core/prototype/collection/hooks/merge-with-initial.server.js +3 -3
- package/dist/core/prototype/collection/hooks.server.d.ts +2 -6
- package/dist/core/prototype/collection/hooks.server.js +8 -9
- package/dist/core/prototype/collection/nested/hooks/add-children.server.d.ts +3 -1
- package/dist/core/prototype/collection/nested/hooks/add-children.server.js +19 -11
- package/dist/core/prototype/collection/nested/hooks/index.server.d.ts +1 -0
- package/dist/core/prototype/collection/nested/hooks/index.server.js +1 -0
- package/dist/core/prototype/collection/nested/hooks/place-at-end.server.d.ts +10 -0
- package/dist/core/prototype/collection/nested/hooks/place-at-end.server.js +24 -0
- package/dist/core/prototype/collection/nested/move.server.d.ts +35 -0
- package/dist/core/prototype/collection/nested/move.server.js +74 -0
- package/dist/core/prototype/collection/operations/count.d.ts +19 -0
- package/dist/core/prototype/collection/operations/count.js +23 -0
- package/dist/core/prototype/collection/operations/create.d.ts +16 -0
- package/dist/core/prototype/collection/operations/create.js +46 -26
- package/dist/core/prototype/collection/operations/delete-by-id.d.ts +5 -0
- package/dist/core/prototype/collection/operations/delete-by-id.js +5 -0
- package/dist/core/prototype/collection/operations/delete.d.ts +8 -0
- package/dist/core/prototype/collection/operations/delete.js +8 -0
- package/dist/core/prototype/collection/operations/duplicate.d.ts +8 -0
- package/dist/core/prototype/collection/operations/duplicate.js +12 -0
- package/dist/core/prototype/collection/operations/find-by-id.d.ts +5 -0
- package/dist/core/prototype/collection/operations/find-by-id.js +5 -0
- package/dist/core/prototype/collection/operations/find.d.ts +6 -1
- package/dist/core/prototype/collection/operations/find.js +7 -2
- package/dist/core/prototype/collection/rest/count.server.d.ts +5 -0
- package/dist/core/prototype/collection/rest/count.server.js +12 -0
- package/dist/core/prototype/collection/rest/create.server.d.ts +2 -1
- package/dist/core/prototype/collection/rest/create.server.js +2 -1
- package/dist/core/prototype/collection/rest/delete-by-id.server.d.ts +1 -3
- package/dist/core/prototype/collection/rest/delete-by-id.server.js +1 -3
- package/dist/core/prototype/collection/rest/get-by-id.server.d.ts +2 -1
- package/dist/core/prototype/collection/rest/get-by-id.server.js +2 -1
- package/dist/core/prototype/collection/rest/get.server.d.ts +2 -1
- package/dist/core/prototype/collection/rest/get.server.js +2 -1
- package/dist/core/prototype/collection/rest/index.server.js +5 -0
- package/dist/core/prototype/collection/rest/lock.server.js +0 -5
- package/dist/core/prototype/collection/rest/move.server.d.ts +11 -0
- package/dist/core/prototype/collection/rest/move.server.js +34 -0
- package/dist/core/prototype/collection/rest/update-by-id.server.d.ts +3 -1
- package/dist/core/prototype/collection/rest/update-by-id.server.js +3 -1
- package/dist/core/prototype/collection/thumbnail/hooks/set-document-thumbnail.server.js +17 -9
- package/dist/core/prototype/collection/upload/boot/index.server.d.ts +3 -5
- package/dist/core/prototype/collection/upload/boot/index.server.js +3 -5
- package/dist/core/prototype/collection/upload/directories/configure.server.js +1 -2
- package/dist/core/prototype/collection/upload/directories/create.server.d.ts +15 -0
- package/dist/core/prototype/collection/upload/directories/create.server.js +19 -0
- package/dist/core/prototype/collection/upload/directories/derive.js +2 -2
- package/dist/core/prototype/collection/upload/directories/pipeline.server.js +5 -4
- package/dist/core/prototype/collection/upload/disk/save.server.d.ts +9 -5
- package/dist/core/prototype/collection/upload/disk/save.server.js +19 -6
- package/dist/core/prototype/collection/upload/ensure.server.d.ts +2 -7
- package/dist/core/prototype/collection/upload/ensure.server.js +2 -7
- package/dist/core/prototype/collection/upload/handler.server.d.ts +4 -0
- package/dist/core/prototype/collection/upload/handler.server.js +13 -4
- package/dist/core/prototype/collection/upload/hooks/convert-base64.server.d.ts +3 -10
- package/dist/core/prototype/collection/upload/hooks/convert-base64.server.js +5 -18
- package/dist/core/prototype/collection/upload/hooks/delete-folder-contents.server.d.ts +10 -0
- package/dist/core/prototype/collection/upload/hooks/delete-folder-contents.server.js +30 -0
- package/dist/core/prototype/collection/upload/hooks/extract-path.server.d.ts +1 -1
- package/dist/core/prototype/collection/upload/hooks/extract-path.server.js +1 -1
- package/dist/core/prototype/collection/upload/hooks/handle-path-creation.server.js +8 -20
- package/dist/core/prototype/collection/upload/hooks/index.server.d.ts +2 -5
- package/dist/core/prototype/collection/upload/hooks/index.server.js +2 -5
- package/dist/core/prototype/collection/upload/hooks/populate-sizes.server.d.ts +4 -2
- package/dist/core/prototype/collection/upload/hooks/populate-sizes.server.js +18 -19
- package/dist/core/prototype/collection/upload/hooks/process-file-upload.server.d.ts +3 -1
- package/dist/core/prototype/collection/upload/hooks/process-file-upload.server.js +16 -3
- package/dist/core/prototype/collection/upload/hooks/update-directory-children.server.js +3 -2
- package/dist/core/prototype/collection/upload/module.d.ts +4 -2
- package/dist/core/prototype/collection/upload/module.js +12 -17
- package/dist/core/prototype/collection/upload/module.server.d.ts +3 -4
- package/dist/core/prototype/collection/upload/module.server.js +3 -4
- package/dist/core/prototype/collection/upload/types.d.ts +21 -6
- package/dist/core/prototype/collection/upload/util/client.d.ts +2 -2
- package/dist/core/prototype/collection/upload/util/client.js +2 -2
- package/dist/core/prototype/collection/upload/util/config.d.ts +1 -0
- package/dist/core/prototype/collection/upload/util/converter.server.d.ts +5 -0
- package/dist/core/prototype/collection/upload/util/converter.server.js +16 -24
- package/dist/core/prototype/collection/upload/util/mime.d.ts +60 -0
- package/dist/core/prototype/collection/upload/util/mime.js +94 -4
- package/dist/core/prototype/collection/upload/util/path.d.ts +5 -1
- package/dist/core/prototype/collection/upload/util/path.js +9 -12
- package/dist/core/prototype/define.d.ts +14 -0
- package/dist/core/prototype/define.js +14 -0
- package/dist/core/prototype/shared/title/find-title.js +1 -0
- package/dist/core/prototype/shared/title/select.d.ts +2 -2
- package/dist/core/prototype/shared/title/select.js +2 -2
- package/dist/core/prototype/shared/url/hooks/set-live-url.server.js +2 -3
- package/dist/core/prototype/shared/versions/augment.js +8 -4
- package/dist/core/prototype/shared/versions/hooks/handle-new-version.server.js +6 -2
- package/dist/core/prototype/shared/versions/validate-config.server.js +1 -2
- package/dist/core/prototype/types.d.ts +0 -5
- package/dist/core/rime.server.d.ts +3 -2
- package/dist/core/rime.server.js +3 -2
- package/dist/core/routes/context.server.d.ts +11 -0
- package/dist/core/routes/context.server.js +11 -0
- package/dist/core/routes/handler.server.d.ts +4 -3
- package/dist/core/routes/handler.server.js +4 -3
- package/dist/core/routes/panel-navigation.d.ts +4 -5
- package/dist/core/routes/panel-navigation.js +4 -8
- package/dist/core/routes/util.d.ts +8 -2
- package/dist/core/routes/util.js +10 -4
- package/dist/fields/blocks/component/AddBlockButton.svelte +1 -0
- package/dist/fields/blocks/component/Blocks.svelte +15 -11
- package/dist/fields/blocks/component/focus/BlocksFocus.svelte +22 -10
- package/dist/fields/blocks/component/focus/LayersList.svelte +5 -0
- package/dist/fields/blocks/component/focus/Palette.svelte +0 -1
- package/dist/fields/blocks/component/focus/Renders.svelte +5 -4
- package/dist/fields/blocks/component/focus/Renders.svelte.d.ts +2 -1
- package/dist/fields/blocks/component/focus/focus.svelte.js +42 -13
- package/dist/fields/blocks/component/picker/BlockPicker.svelte +2 -2
- package/dist/fields/blocks/index.d.ts +16 -0
- package/dist/fields/blocks/index.js +15 -2
- package/dist/fields/checkbox/component/Checkbox.svelte +1 -0
- package/dist/fields/combobox/component/ComboBox.svelte +3 -2
- package/dist/fields/combobox/index.d.ts +1 -0
- package/dist/fields/combobox/index.js +1 -0
- package/dist/fields/component/index.d.ts +3 -0
- package/dist/fields/component/index.js +3 -0
- package/dist/fields/date/component/Date.svelte +8 -5
- package/dist/fields/date/index.d.ts +1 -0
- package/dist/fields/date/index.js +1 -0
- package/dist/fields/email/component/Email.svelte +8 -5
- package/dist/fields/email/index.d.ts +1 -0
- package/dist/fields/email/index.js +1 -0
- package/dist/fields/group/component/Group.svelte +8 -15
- package/dist/fields/group/index.d.ts +7 -1
- package/dist/fields/group/index.js +5 -4
- package/dist/fields/link/component/Link.svelte +19 -8
- package/dist/fields/link/component/RessourceInput.svelte +68 -47
- package/dist/fields/link/index.d.ts +12 -0
- package/dist/fields/link/index.js +14 -1
- package/dist/fields/number/component/Number.svelte +1 -0
- package/dist/fields/number/index.js +5 -3
- package/dist/fields/radio/component/Radio.svelte +12 -3
- package/dist/fields/radio/index.d.ts +1 -0
- package/dist/fields/radio/index.js +1 -0
- package/dist/fields/relation/component/Cell.svelte +4 -4
- package/dist/fields/relation/component/Relation.svelte +92 -131
- package/dist/fields/relation/component/Relation.svelte.d.ts +0 -1
- package/dist/fields/relation/component/RelationInline.svelte +22 -27
- package/dist/fields/relation/component/default/Default.svelte +50 -19
- package/dist/fields/relation/component/default/Default.svelte.d.ts +12 -1
- package/dist/fields/relation/component/types.d.ts +5 -3
- package/dist/fields/relation/component/upload/Browse.svelte +50 -41
- package/dist/fields/relation/component/upload/Browse.svelte.d.ts +6 -1
- package/dist/fields/relation/component/upload/Upload.svelte +8 -3
- package/dist/fields/relation/component/upload/Upload.svelte.d.ts +0 -1
- package/dist/fields/relation/index.d.ts +27 -10
- package/dist/fields/relation/index.js +16 -0
- package/dist/fields/relation/populate.js +1 -0
- package/dist/fields/relation/query.d.ts +22 -0
- package/dist/fields/relation/query.js +29 -0
- package/dist/fields/relation/relation.test-d.js +11 -0
- package/dist/fields/repeatable/RepeatableActions.svelte +4 -0
- package/dist/fields/repeatable/RepeatableActions.svelte.d.ts +4 -0
- package/dist/fields/repeatable.js +3 -21
- package/dist/fields/rich-text/client.d.ts +26 -0
- package/dist/fields/rich-text/client.js +26 -0
- package/dist/fields/rich-text/component/RichTextInline.svelte +2 -9
- package/dist/fields/rich-text/component/RichTextInline.svelte.d.ts +2 -9
- package/dist/fields/rich-text/component/bubble-menu/bubble-menu.svelte +2 -0
- package/dist/fields/rich-text/component/bubble-menu/icon-button/icon-button.css +0 -1
- package/dist/fields/rich-text/component/bubble-menu/icon-button/icon-button.svelte +1 -2
- package/dist/fields/rich-text/component/bubble-menu/node-selector/node-selector.css +0 -1
- package/dist/fields/rich-text/component/bubble-menu/node-selector/node-selector.svelte +9 -6
- package/dist/fields/rich-text/component/context.svelte.d.ts +1 -0
- package/dist/fields/rich-text/component/context.svelte.js +1 -0
- package/dist/fields/rich-text/component/drag-handle/drag-handle.css +0 -1
- package/dist/fields/rich-text/component/drag-handle/drag-handle.svelte +1 -0
- package/dist/fields/rich-text/component/styles/editor.css +0 -1
- package/dist/fields/rich-text/component/styles/field.css +10 -11
- package/dist/fields/rich-text/core/build-editor-config.d.ts +15 -6
- package/dist/fields/rich-text/core/build-editor-config.js +47 -66
- package/dist/fields/rich-text/core/extensions/current-node/current-node.css +1 -0
- package/dist/fields/rich-text/core/extensions/current-node/current-node.d.ts +2 -2
- package/dist/fields/rich-text/core/extensions/current-node/current-node.js +3 -4
- package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle-plugin.d.ts +5 -0
- package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle-plugin.js +40 -77
- package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle.d.ts +1 -1
- package/dist/fields/rich-text/core/extensions/drag-handle/drag-handle.js +1 -1
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/cloneElement.d.ts +4 -0
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/cloneElement.js +5 -0
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/dragHandler.d.ts +5 -0
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/dragHandler.js +11 -13
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/findNextElementFromCursor.d.ts +6 -8
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/findNextElementFromCursor.js +9 -14
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getInnerCoords.d.ts +1 -0
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getInnerCoords.js +6 -5
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getOuterNode.d.ts +3 -1
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getOuterNode.js +8 -21
- package/dist/fields/rich-text/core/features/blockquote.js +5 -1
- package/dist/fields/rich-text/core/features/bold.js +0 -3
- package/dist/fields/rich-text/core/features/bullet-list.js +5 -1
- package/dist/fields/rich-text/core/features/fields/extension.d.ts +1 -0
- package/dist/fields/rich-text/core/features/fields/extension.js +1 -0
- package/dist/fields/rich-text/core/features/fields/fields-form.svelte +54 -0
- package/dist/fields/rich-text/core/features/fields/fields-form.svelte.d.ts +14 -0
- package/dist/fields/rich-text/core/features/fields/fields.svelte +30 -35
- package/dist/fields/rich-text/core/features/fields/index.d.ts +2 -0
- package/dist/fields/rich-text/core/features/fields/index.js +1 -0
- package/dist/fields/rich-text/core/features/heading.js +19 -68
- package/dist/fields/rich-text/core/features/hr/hr.css +1 -2
- package/dist/fields/rich-text/core/features/hr/hr.js +5 -1
- package/dist/fields/rich-text/core/features/index.d.ts +1 -0
- package/dist/fields/rich-text/core/features/index.js +1 -0
- package/dist/fields/rich-text/core/features/json-attribute.d.ts +1 -1
- package/dist/fields/rich-text/core/features/json-attribute.js +1 -1
- package/dist/fields/rich-text/core/features/link/component/link-selector.svelte +61 -58
- package/dist/fields/rich-text/core/features/link/component/link-selector.svelte.d.ts +3 -1
- package/dist/fields/rich-text/core/features/link/index.d.ts +5 -0
- package/dist/fields/rich-text/core/features/link/index.js +2 -14
- package/dist/fields/rich-text/core/features/ordered-list.js +5 -1
- package/dist/fields/rich-text/core/features/paragraph.js +5 -1
- package/dist/fields/rich-text/core/features/pick-dialog.svelte +16 -4
- package/dist/fields/rich-text/core/features/pick-dialog.svelte.d.ts +7 -3
- package/dist/fields/rich-text/core/features/resource/index.d.ts +1 -0
- package/dist/fields/rich-text/core/features/resource/index.js +1 -0
- package/dist/fields/rich-text/core/features/resource/resource-extension.d.ts +1 -0
- package/dist/fields/rich-text/core/features/resource/resource-extension.js +8 -6
- package/dist/fields/rich-text/core/features/resource/resource.svelte +38 -49
- package/dist/fields/rich-text/core/features/resource/types.d.ts +1 -0
- package/dist/fields/rich-text/core/features/upload/index.d.ts +1 -0
- package/dist/fields/rich-text/core/features/upload/index.js +2 -1
- package/dist/fields/rich-text/core/features/upload/upload-extension.d.ts +6 -0
- package/dist/fields/rich-text/core/features/upload/upload-extension.js +2 -2
- package/dist/fields/{relation/component → rich-text/core/features}/upload/upload.css +1 -2
- package/dist/fields/rich-text/core/features/upload/upload.svelte +47 -73
- package/dist/fields/rich-text/core/features/upload/upload.svelte.d.ts +1 -0
- package/dist/fields/rich-text/core/render-rich-text.svelte +30 -16
- package/dist/fields/rich-text/core/rich-text-editor-core.svelte +8 -3
- package/dist/fields/rich-text/core/rich-text-editor-core.svelte.d.ts +1 -0
- package/dist/fields/rich-text/core/svelte/constant.d.ts +1 -0
- package/dist/fields/rich-text/core/svelte/constant.js +1 -0
- package/dist/fields/rich-text/core/svelte/node-view-renderer.svelte.d.ts +10 -0
- package/dist/fields/rich-text/core/svelte/node-view-renderer.svelte.js +23 -6
- package/dist/fields/rich-text/core/svelte/node-view-wrapper.svelte +6 -2
- package/dist/fields/rich-text/core/svelte/node-view-wrapper.svelte.d.ts +1 -0
- package/dist/fields/rich-text/core/svelte/renderer.d.ts +1 -0
- package/dist/fields/rich-text/core/svelte/renderer.js +1 -0
- package/dist/fields/rich-text/core/types.d.ts +11 -0
- package/dist/fields/rich-text/index.d.ts +2 -0
- package/dist/fields/rich-text/index.js +12 -7
- package/dist/fields/rich-text/json.d.ts +6 -4
- package/dist/fields/rich-text/json.js +6 -4
- package/dist/fields/select/component/Select.svelte +37 -12
- package/dist/fields/select/index.d.ts +2 -1
- package/dist/fields/select/index.js +1 -0
- package/dist/fields/separator/index.d.ts +1 -0
- package/dist/fields/separator/index.js +1 -0
- package/dist/fields/slug/component/Slug.svelte +14 -13
- package/dist/fields/slug/index.d.ts +11 -0
- package/dist/fields/slug/index.js +11 -0
- package/dist/fields/tabs/component/Tabs.svelte +4 -7
- package/dist/fields/tabs/index.d.ts +10 -0
- package/dist/fields/tabs/index.js +10 -0
- package/dist/fields/text/component/TextInline.svelte +12 -10
- package/dist/fields/text/index.d.ts +7 -0
- package/dist/fields/text/index.js +9 -2
- package/dist/fields/textarea/index.d.ts +3 -0
- package/dist/fields/textarea/index.js +5 -2
- package/dist/fields/time/index.d.ts +1 -0
- package/dist/fields/time/index.js +4 -6
- package/dist/fields/toggle/component/Toggle.svelte +1 -0
- package/dist/fields/toggle/index.d.ts +1 -0
- package/dist/fields/toggle/index.js +1 -0
- package/dist/fields/tree/component/AddItemButton.svelte +3 -2
- package/dist/fields/tree/component/AddItemButton.svelte.d.ts +1 -1
- package/dist/fields/tree/component/Tree.svelte +16 -57
- package/dist/fields/tree/component/TreeBlock.svelte +26 -40
- package/dist/fields/tree/component/props.d.ts +3 -2
- package/dist/fields/tree/index.js +14 -2
- package/dist/fields/tree/util.js +0 -3
- package/dist/fields/types.d.ts +23 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/live/Consumer.svelte +6 -0
- package/dist/live/LiveEdit.svelte +23 -5
- package/dist/live/LiveEdit.svelte.d.ts +2 -1
- package/dist/live/Provider.svelte +5 -1
- package/dist/live/context.svelte.d.ts +3 -4
- package/dist/live/context.svelte.js +9 -6
- package/dist/panel/components/Root.svelte +7 -1
- package/dist/panel/components/fields/FieldsPreview.svelte +15 -1
- package/dist/panel/components/fields/Label.svelte +2 -0
- package/dist/panel/components/fields/RenderFields.svelte +12 -1
- package/dist/panel/components/fields/fieldset.svelte.d.ts +7 -1
- package/dist/panel/components/fields/fieldset.svelte.js +7 -1
- package/dist/panel/components/fields/setting.css +7 -0
- package/dist/panel/components/sections/auth/AuthForm.svelte +4 -1
- package/dist/panel/components/sections/collection/Avatar.svelte +1 -1
- package/dist/panel/components/sections/collection/bulk-upload/FileDrop.svelte +3 -0
- package/dist/panel/components/sections/collection/bulk-upload/PageDrop.svelte +11 -1
- package/dist/panel/components/sections/collection/folder/FolderEdit.svelte +10 -1
- package/dist/panel/components/sections/collection/folder/FolderWithActions.svelte +45 -34
- package/dist/panel/components/sections/collection/folder/Folders.svelte +1 -0
- package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte +8 -3
- package/dist/panel/components/sections/collection/grid/CollectionGrid.svelte.d.ts +2 -1
- package/dist/panel/components/sections/collection/grid/create-directory-dialog/CreateDirectoryDialog.svelte +3 -1
- package/dist/panel/components/sections/collection/grid/grid-item/GridItem.svelte +4 -0
- package/dist/panel/components/sections/collection/header/ButtonCreate.svelte +1 -5
- package/dist/panel/components/sections/collection/header/SearchInput.svelte +2 -0
- package/dist/panel/components/sections/collection/header/SelectUI.svelte +25 -5
- package/dist/panel/components/sections/collection/list/CollectionList.svelte +4 -1
- package/dist/panel/components/sections/collection/list/row/Row.svelte +16 -16
- package/dist/panel/components/sections/collection/list/row/Row.svelte.d.ts +4 -4
- package/dist/panel/components/sections/collection/tree/CollectionTree.svelte +4 -80
- package/dist/panel/components/sections/collection/tree/CollectionTreeNode.svelte +18 -8
- package/dist/panel/components/sections/collection/tree/sortable.d.ts +11 -0
- package/dist/panel/components/sections/collection/tree/sortable.js +45 -0
- package/dist/panel/components/sections/collection/upload-thumb-cell/UploadThumbCell.svelte +5 -3
- package/dist/panel/components/sections/collection/upload-thumb-cell/UploadThumbCell.svelte.d.ts +0 -1
- package/dist/panel/components/sections/commands/CommandPalette.svelte +5 -0
- package/dist/panel/components/sections/document/AuthAPIKeyDialog.svelte +14 -4
- package/dist/panel/components/sections/document/AuthAPIKeyDialog.svelte.d.ts +2 -0
- package/dist/panel/components/sections/document/AuthFooter.svelte +37 -31
- package/dist/panel/components/sections/document/AuthFooter.svelte.d.ts +0 -2
- package/dist/panel/components/sections/document/ButtonSave.svelte +2 -6
- package/dist/panel/components/sections/document/ButtonSave.svelte.d.ts +1 -3
- package/dist/panel/components/sections/document/ButtonStatus.svelte +24 -11
- package/dist/panel/components/sections/document/ChangeSlugDialog.svelte +16 -0
- package/dist/panel/components/sections/document/CurrentlyEdited.svelte +5 -3
- package/dist/panel/components/sections/document/CurrentlyEdited.svelte.d.ts +1 -0
- package/dist/panel/components/sections/document/Document.svelte +29 -18
- package/dist/panel/components/sections/document/DocumentChildren.svelte +48 -41
- package/dist/panel/components/sections/document/Header.svelte +13 -11
- package/dist/panel/components/sections/document/Settings.svelte +127 -157
- package/dist/panel/components/sections/document/Versions.svelte +11 -2
- package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte +32 -13
- package/dist/panel/components/sections/document/upload-header/UploadHeader.svelte.d.ts +2 -0
- package/dist/panel/components/sections/document/upload-header/drop-zone/DropZone.svelte +24 -10
- package/dist/panel/components/sections/document/upload-header/drop-zone/DropZone.svelte.d.ts +3 -0
- package/dist/panel/components/sections/live/LiveEditPanel.svelte +11 -5
- package/dist/panel/components/sections/live/LiveEditPanel.svelte.d.ts +10 -3
- package/dist/panel/components/sections/live/LiveFloatingUI.svelte +18 -2
- package/dist/panel/components/sections/live/LiveFloatingUI.svelte.d.ts +3 -0
- package/dist/panel/components/ui/button/button.svelte +0 -3
- package/dist/panel/components/ui/calendar/calendar.css +0 -1
- package/dist/panel/components/ui/calendar/calendar.svelte.d.ts +1 -1
- package/dist/panel/components/ui/card-resource/card-resource.svelte +17 -3
- package/dist/panel/components/ui/card-resource/card-resource.svelte.d.ts +2 -0
- package/dist/panel/components/ui/checkbox/checkbox.svelte.d.ts +1 -1
- package/dist/panel/components/ui/command/command-count.css +6 -0
- package/dist/panel/components/ui/command/command-count.svelte +15 -0
- package/dist/panel/components/ui/command/command-count.svelte.d.ts +9 -0
- package/dist/panel/components/ui/command/command-dialog.css +2 -0
- package/dist/panel/components/ui/command/command-input-select.svelte +5 -0
- package/dist/panel/components/ui/command/filter.d.ts +10 -0
- package/dist/panel/components/ui/command/filter.js +11 -0
- package/dist/panel/components/ui/command/index.d.ts +2 -1
- package/dist/panel/components/ui/command/index.js +2 -1
- package/dist/panel/components/ui/context-menu/context-menu.css +2 -2
- package/dist/panel/components/ui/dialog/dialog-content.css +4 -1
- package/dist/panel/components/ui/dialog/dialog-content.svelte +8 -1
- package/dist/panel/components/ui/dialog/dialog-overlay.css +2 -1
- package/dist/panel/components/ui/dropdown-menu/dropdown-menu-content.css +2 -2
- package/dist/panel/components/ui/input/input.svelte +3 -0
- package/dist/panel/components/ui/language-switcher/LanguageSwitcher.svelte +1 -1
- package/dist/panel/components/ui/layer/layer.svelte.d.ts +22 -0
- package/dist/panel/components/ui/layer/layer.svelte.js +37 -0
- package/dist/panel/components/ui/nav/Nav.svelte +4 -9
- package/dist/panel/components/ui/nav/NavGroup.svelte +6 -6
- package/dist/panel/components/ui/nav/NavItem.svelte +1 -0
- package/dist/panel/components/ui/nav/NavItem.svelte.d.ts +1 -0
- package/dist/panel/components/ui/nav/UserButton.svelte +4 -4
- package/dist/panel/components/ui/page-header/PageHeader.svelte +1 -5
- package/dist/panel/components/ui/page-header/PageHeader.svelte.d.ts +1 -0
- package/dist/panel/components/ui/popover/popover-content.css +2 -1
- package/dist/panel/components/ui/radio-row-group/radio-row-group.css +0 -1
- package/dist/panel/components/ui/scroll-area/scroll-area-scrollbar.svelte +3 -4
- package/dist/panel/components/ui/scroll-area/scroll-area-scrollbar.svelte.d.ts +1 -1
- package/dist/panel/components/ui/scroll-area/scroll-area.css +0 -6
- package/dist/panel/components/ui/scroll-area/scroll-area.svelte +4 -1
- package/dist/panel/components/ui/sheet/index.d.ts +1 -1
- package/dist/panel/components/ui/sheet/sheet-content.svelte +13 -2
- package/dist/panel/components/ui/sheet/sheet-content.svelte.d.ts +3 -0
- package/dist/panel/components/ui/sheet/sheet.css +11 -43
- package/dist/panel/components/ui/sonner/sonner.css +5 -0
- package/dist/panel/components/ui/switch/switch.svelte.d.ts +1 -1
- package/dist/panel/components/ui/tag/tag.svelte +8 -1
- package/dist/panel/components/ui/tooltip/tooltip-content.svelte +1 -1
- package/dist/panel/components/ui/tree/tree-rows.css +1 -8
- package/dist/panel/context/api-proxy.svelte.d.ts +2 -0
- package/dist/panel/context/api-proxy.svelte.js +30 -4
- package/dist/panel/context/blocks-ops.d.ts +6 -0
- package/dist/panel/context/blocks-ops.js +6 -0
- package/dist/panel/context/bulk-delete.d.ts +4 -3
- package/dist/panel/context/bulk-delete.js +13 -7
- package/dist/panel/context/collection.svelte.d.ts +10 -22
- package/dist/panel/context/collection.svelte.js +73 -115
- package/dist/panel/context/commands.svelte.js +5 -0
- package/dist/panel/context/config.svelte.js +2 -0
- package/dist/panel/context/createContext.svelte.d.ts +1 -0
- package/dist/panel/context/createContext.svelte.js +1 -0
- package/dist/panel/context/documentForm.svelte.d.ts +4 -2
- package/dist/panel/context/documentForm.svelte.js +87 -159
- package/dist/panel/context/errors.svelte.d.ts +8 -0
- package/dist/panel/context/errors.svelte.js +8 -0
- package/dist/panel/context/form.svelte.d.ts +8 -1
- package/dist/panel/context/form.svelte.js +37 -40
- package/dist/panel/context/livePanel.svelte.d.ts +3 -0
- package/dist/panel/context/locale.svelte.js +3 -0
- package/dist/panel/context/nav.svelte.js +9 -21
- package/dist/panel/context/tree-ops.d.ts +14 -0
- package/dist/panel/context/tree-ops.js +70 -0
- package/dist/panel/context/versions.svelte.d.ts +6 -0
- package/dist/panel/context/versions.svelte.js +18 -0
- package/dist/panel/index.d.ts +1 -10
- package/dist/panel/pages/area/Area.svelte +1 -1
- package/dist/panel/pages/area/actions.server.js +1 -0
- package/dist/panel/pages/area/load.server.d.ts +1 -0
- package/dist/panel/pages/area/load.server.js +1 -1
- package/dist/panel/pages/auth/forgot-password/ForgotPassword.svelte +23 -16
- package/dist/panel/pages/auth/forgot-password/load.server.d.ts +1 -0
- package/dist/panel/pages/auth/forgot-password/load.server.js +3 -5
- package/dist/panel/pages/auth/image.server.d.ts +6 -0
- package/dist/panel/pages/auth/image.server.js +19 -0
- package/dist/panel/pages/auth/reset-password/ResetPassword.svelte +22 -15
- package/dist/panel/pages/auth/reset-password/load.server.d.ts +3 -0
- package/dist/panel/pages/auth/reset-password/load.server.js +5 -5
- package/dist/panel/pages/auth/sign-in/actions.server.js +33 -25
- package/dist/panel/pages/auth/sign-in/load.server.d.ts +4 -0
- package/dist/panel/pages/auth/sign-in/load.server.js +6 -5
- package/dist/panel/pages/collection/Collection.svelte.d.ts +1 -1
- package/dist/panel/pages/collection/CollectionPage.svelte +31 -27
- package/dist/panel/pages/collection/CollectionPage.svelte.d.ts +1 -1
- package/dist/panel/pages/collection/load.server.d.ts +5 -2
- package/dist/panel/pages/collection/load.server.js +53 -54
- package/dist/panel/pages/collection-document/CollectionDocument.svelte +1 -1
- package/dist/panel/pages/collection-document/actions.server.js +3 -11
- package/dist/panel/pages/collection-document/load.server.d.ts +5 -0
- package/dist/panel/pages/collection-document/load.server.js +10 -3
- package/dist/panel/pages/dashboard/load.server.d.ts +3 -0
- package/dist/panel/pages/dashboard/load.server.js +19 -8
- package/dist/panel/pages/live/Live.svelte +45 -45
- package/dist/panel/pages/live/load.server.d.ts +5 -0
- package/dist/panel/pages/live/load.server.js +5 -0
- package/dist/panel/pages/shared/DocumentPage.svelte +9 -5
- package/dist/panel/pages/shared/DocumentPage.svelte.d.ts +0 -1
- package/dist/panel/style/font.css +1 -1
- package/dist/panel/style/index.css +21 -6
- package/dist/panel/style/palette.css +1 -1
- package/dist/panel/style/size.css +1 -0
- package/dist/panel/style/z-index.css +18 -0
- package/dist/panel/types.d.ts +0 -1
- package/dist/panel/util/Sortable.d.ts +6 -1
- package/dist/panel/util/Sortable.js +6 -1
- package/dist/panel/util/auth.d.ts +18 -0
- package/dist/panel/util/auth.js +25 -0
- package/dist/panel/util/candidates.svelte.d.ts +118 -0
- package/dist/panel/util/candidates.svelte.js +176 -0
- package/dist/panel/util/count.d.ts +19 -0
- package/dist/panel/util/count.js +20 -0
- package/dist/panel/util/dataError.d.ts +1 -0
- package/dist/panel/util/dataError.js +1 -0
- package/dist/panel/util/storage.d.ts +13 -0
- package/dist/panel/util/storage.js +37 -0
- package/dist/panel/util/time.d.ts +7 -1
- package/dist/panel/util/time.js +19 -5
- package/dist/panel/util/upload-file.d.ts +0 -8
- package/dist/panel/util/upload-file.js +6 -12
- package/dist/server.js +3 -0
- package/dist/util/form-data.d.ts +3 -3
- package/dist/util/form-data.js +4 -2
- package/dist/util/function.d.ts +7 -6
- package/dist/util/function.js +7 -6
- package/dist/util/object.d.ts +10 -11
- package/dist/util/object.js +21 -55
- package/dist/util/random.d.ts +8 -12
- package/dist/util/random.js +34 -88
- package/dist/util/string.js +76 -114
- package/dist/util/types.d.ts +2 -0
- package/package.json +12 -15
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getComputedStyle.d.ts +0 -1
- package/dist/fields/rich-text/core/extensions/drag-handle/helpers/getComputedStyle.js +0 -4
- package/dist/fields/rich-text/core/features/link/component/link-selector.css +0 -0
- package/dist/fields/rich-text/core/features/resource/resource.css +0 -0
- package/dist/panel/style/util.css +0 -3
- package/dist/panel/util/once.svelte.d.ts +0 -3
- package/dist/panel/util/once.svelte.js +0 -12
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IS_RIME_REPO, PACKAGE_NAME } from '../../../constants.server.js';
|
|
2
2
|
import { makeDocTypeName } from '../../../prototype/naming.js';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* A doc type: `BaseDoc`, the `extendsTypes`, and `content`, the member lines the caller joined.
|
|
5
|
+
* The index signature lets a document carry keys no field declares.
|
|
6
6
|
*/
|
|
7
7
|
export const templateDocType = (slug, content, extendsTypes = []) => `
|
|
8
8
|
export type ${makeDocTypeName(slug)} = BaseDoc & ${extendsTypes.map((name) => `${name} & `).join('')} {
|
|
@@ -16,31 +16,16 @@ export type ${makeDocTypeName(slug)} = BaseDoc & ${extendsTypes.map((name) => `$
|
|
|
16
16
|
export const templateRegister = (config) => {
|
|
17
17
|
const collections = (config.collections || []).filter((c) => c._generateTypes !== false);
|
|
18
18
|
const areas = (config.areas || []).filter((c) => c._generateTypes !== false);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*
|
|
27
|
-
* Collections only: a versions table is registered as a collection in its own right, and this map is
|
|
28
|
-
* read nowhere but in `RegisterCollection` below.
|
|
29
|
-
*/
|
|
30
|
-
const versionsSlugs = new Map((config.collections ?? []).map((c) => [c.slug, c._versions?.slug]));
|
|
31
|
-
const registerCollections = collections.length
|
|
19
|
+
// A versions table is a collection of its own with the doc type of the config it versions,
|
|
20
|
+
// a collection's or an area's.
|
|
21
|
+
const entries = [
|
|
22
|
+
...collections.map((c) => [c.slug, c.slug]),
|
|
23
|
+
...[...collections, ...areas].filter((c) => c._versions).map((c) => [c._versions.slug, c.slug])
|
|
24
|
+
];
|
|
25
|
+
const registerCollections = entries.length
|
|
32
26
|
? [
|
|
33
27
|
'\tinterface RegisterCollection {',
|
|
34
|
-
|
|
35
|
-
.map((collection) => {
|
|
36
|
-
let collectionRegister = `\t\t'${collection.slug}': ${makeDocTypeName(collection.slug)}`;
|
|
37
|
-
const versionsSlug = versionsSlugs.get(collection.slug);
|
|
38
|
-
if (versionsSlug) {
|
|
39
|
-
collectionRegister += `\n\t\t'${versionsSlug}': ${makeDocTypeName(collection.slug)}`;
|
|
40
|
-
}
|
|
41
|
-
return collectionRegister;
|
|
42
|
-
})
|
|
43
|
-
.join('\n')};`,
|
|
28
|
+
...entries.map(([slug, owner]) => `\t\t'${slug}': ${makeDocTypeName(owner)};`),
|
|
44
29
|
'\t}'
|
|
45
30
|
]
|
|
46
31
|
: [];
|
|
@@ -69,6 +54,8 @@ export const templateDeclareVirtualModule = (schemaSpecifier) => [
|
|
|
69
54
|
? [`declare module '$rime/schema' {`, `\texport * from '${schemaSpecifier}';`, `}`]
|
|
70
55
|
: [])
|
|
71
56
|
].join('\n');
|
|
57
|
+
/** The `App.Locals` declaration. `rimeConfigServerPath` imports the generated server config from
|
|
58
|
+
* src/, for the type of `locals.rime`. */
|
|
72
59
|
export const templateLocals = (rimeConfigServerPath) => `declare global {
|
|
73
60
|
namespace App {
|
|
74
61
|
interface Locals {
|
|
@@ -99,7 +86,7 @@ export const templateLocals = (rimeConfigServerPath) => `declare global {
|
|
|
99
86
|
type: string;
|
|
100
87
|
}
|
|
101
88
|
| undefined;
|
|
102
|
-
/**
|
|
89
|
+
/** The request's rime context: config, auth and the local API (createRimeContext(event)). */
|
|
103
90
|
rime: ReturnType<
|
|
104
91
|
Awaited<
|
|
105
92
|
typeof import('${rimeConfigServerPath}').default
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CONFIG_DIR, PANEL_ROUTE } from './constants.server.js';
|
|
2
2
|
import { restSurface } from './prototype-routes.server.js';
|
|
3
|
-
import { templatesSurface } from './codegen/routes/common.server.js';
|
|
3
|
+
import { componentFilename, templatesSurface } from './codegen/routes/common.server.js';
|
|
4
4
|
import { rimeVersion } from './version.server.js';
|
|
5
5
|
/**
|
|
6
6
|
* Serializes one flattened config value for the memo: a builder by its `compile()` output, a
|
|
@@ -13,17 +13,16 @@ const serializeValue = (value) => {
|
|
|
13
13
|
return 'undefined';
|
|
14
14
|
switch (typeof value) {
|
|
15
15
|
case 'function':
|
|
16
|
-
// A Svelte component (its dev SSR build carries a `render` stub) serializes by name
|
|
17
|
-
// other function by its source.
|
|
16
|
+
// A Svelte component (its dev SSR build carries a `render` stub) serializes by name and file:
|
|
17
|
+
// a page imports it from that file. Any other function serializes by its source.
|
|
18
18
|
if (Object.prototype.hasOwnProperty.call(value, 'render')) {
|
|
19
|
-
return `func:${value.name}`;
|
|
19
|
+
return `func:${value.name}:${componentFilename(value) ?? ''}`;
|
|
20
20
|
}
|
|
21
21
|
return `func:${value.toString()}`;
|
|
22
22
|
case 'object':
|
|
23
23
|
try {
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
// resolved copy, so that is what gets serialized.
|
|
24
|
+
// A builder that keeps its state in private class fields (`TabBuilder`) has no own keys
|
|
25
|
+
// for `flattenConfig` to walk: its `compile()` output is serialized instead.
|
|
27
26
|
if (typeof value.compile === 'function') {
|
|
28
27
|
return serializeValue(value.compile());
|
|
29
28
|
}
|
|
@@ -17,6 +17,8 @@ export declare function relativeImportSpecifier(fromDir: string, toAbsolutePath:
|
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
19
|
export declare function libImportSpecifier(absolutePath: string): string | null;
|
|
20
|
+
/** The generated server config, as a root-relative path:
|
|
21
|
+
* `src/+rime.generated/rime.config.server.ts`. */
|
|
20
22
|
export declare function generatedConfigServerPath(): string;
|
|
21
23
|
/** Where the panel/live route templates (common.server.ts) and the generated hooks.server.ts
|
|
22
24
|
* should import the client/server config from — a relative import specifier computed from
|
|
@@ -27,8 +29,8 @@ export declare function configImportPaths(fromDir: string): {
|
|
|
27
29
|
client: string;
|
|
28
30
|
server: string;
|
|
29
31
|
};
|
|
30
|
-
/**
|
|
31
|
-
*
|
|
32
|
+
/** The absolute path of the generated drizzle schema, `<GENERATED_DIR>/schema.server.ts` under
|
|
33
|
+
* `projectRoot`. */
|
|
32
34
|
export declare function schemaPath(projectRoot?: string): string;
|
|
33
35
|
/** The param matchers rime generates, which the app's own params file spreads:
|
|
34
36
|
*
|
|
@@ -7,7 +7,8 @@ export const CONFIG_DIR = env.RIME_CONFIG_DIR || 'src/+rime';
|
|
|
7
7
|
export const GENERATED_DIR = `${CONFIG_DIR}.generated`;
|
|
8
8
|
const INPUT_DIR = path.basename(CONFIG_DIR);
|
|
9
9
|
export const OUTPUT_DIR = `${INPUT_DIR}.generated`;
|
|
10
|
-
//
|
|
10
|
+
// The folders under src/ the config may not be: SvelteKit's lib, routes and params, and static.
|
|
11
|
+
// A subfolder of one is allowed (`src/lib/+rime`).
|
|
11
12
|
const RESERVED_DIRS = new Set(['lib', 'routes', 'static', 'params'].map((d) => path.resolve(SRC_ROOT, d)));
|
|
12
13
|
/** Prevent user CONFIG_DIR to be set :
|
|
13
14
|
* - on a SvelteKit folder by mistake
|
|
@@ -32,7 +33,7 @@ if (!isValidSlug(PANEL_ROUTE)) {
|
|
|
32
33
|
* with `./` or `../` so it never gets mistaken for a bare package specifier. */
|
|
33
34
|
export function relativeImportSpecifier(fromDir, toAbsolutePath) {
|
|
34
35
|
const rel = path.relative(fromDir, toAbsolutePath).split(path.sep).join('/');
|
|
35
|
-
return rel.startsWith('
|
|
36
|
+
return rel.startsWith('../') ? rel : `./${rel}`;
|
|
36
37
|
}
|
|
37
38
|
/** A `#lib/...` specifier for a file under src/lib, null for any other file. Ambient
|
|
38
39
|
* declarations (`declare module '...' { export * from '...' }`) need it: they cannot re-export
|
|
@@ -56,6 +57,8 @@ function generatedFilePath(file) {
|
|
|
56
57
|
.split(path.sep)
|
|
57
58
|
.join('/');
|
|
58
59
|
}
|
|
60
|
+
/** The generated server config, as a root-relative path:
|
|
61
|
+
* `src/+rime.generated/rime.config.server.ts`. */
|
|
59
62
|
export function generatedConfigServerPath() {
|
|
60
63
|
return generatedFilePath('rime.config.server.ts');
|
|
61
64
|
}
|
|
@@ -70,8 +73,8 @@ export function configImportPaths(fromDir) {
|
|
|
70
73
|
server: relativeImportSpecifier(fromDir, path.resolve(root, GENERATED_DIR, 'rime.config.server.js'))
|
|
71
74
|
};
|
|
72
75
|
}
|
|
73
|
-
/**
|
|
74
|
-
*
|
|
76
|
+
/** The absolute path of the generated drizzle schema, `<GENERATED_DIR>/schema.server.ts` under
|
|
77
|
+
* `projectRoot`. */
|
|
75
78
|
export function schemaPath(projectRoot = process.cwd()) {
|
|
76
79
|
return path.resolve(projectRoot, GENERATED_DIR, 'schema.server.ts');
|
|
77
80
|
}
|
|
@@ -6,4 +6,9 @@ export declare function ensureGeneratedConfig(): string;
|
|
|
6
6
|
* Ensure user config exists — the CONFIG_DIR folder convention.
|
|
7
7
|
*/
|
|
8
8
|
export declare function ensureUserConfigExist(): void;
|
|
9
|
+
/**
|
|
10
|
+
* Throws on the first piece `rime init` should have set up and is missing: the required
|
|
11
|
+
* variables, src/hooks.server.ts, the config, its generated copy, the schema. Runs in dev when the
|
|
12
|
+
* dev server starts listening (vite.server.ts).
|
|
13
|
+
*/
|
|
9
14
|
export declare const ensureHasInit: () => void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { CONFIG_DIR, GENERATED_DIR, generatedConfigServerPath, schemaPath } from './constants.server.js';
|
|
4
|
+
import { env } from './env.server.js';
|
|
4
5
|
const projectRoot = process.cwd();
|
|
5
6
|
/**
|
|
6
7
|
* Returns the generated server config's path. Throws when sanitize has not written it.
|
|
@@ -38,13 +39,12 @@ function ensureSchema() {
|
|
|
38
39
|
throw new Error('Unable to find schema, did you run rime init');
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
|
-
/**
|
|
42
|
-
* Ensure .env exists
|
|
43
|
-
*/
|
|
42
|
+
/** The variables the app refuses to start without, read from the shell or the .env files. */
|
|
44
43
|
function ensureEnv() {
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
47
|
-
throw new Error(
|
|
44
|
+
const missing = ['SITE_URL', 'BETTER_AUTH_SECRET'].filter((name) => !env[name]);
|
|
45
|
+
if (missing.length) {
|
|
46
|
+
throw new Error(`Missing ${missing.join(', ')}: set them in .env or in the environment`);
|
|
47
|
+
}
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Ensure hooks.server exists
|
|
@@ -54,6 +54,11 @@ function ensureHooks() {
|
|
|
54
54
|
if (!existsSync(hooksServerFile))
|
|
55
55
|
throw new Error('Missing src/hooks.server.ts file');
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Throws on the first piece `rime init` should have set up and is missing: the required
|
|
59
|
+
* variables, src/hooks.server.ts, the config, its generated copy, the schema. Runs in dev when the
|
|
60
|
+
* dev server starts listening (vite.server.ts).
|
|
61
|
+
*/
|
|
57
62
|
export const ensureHasInit = () => {
|
|
58
63
|
ensureEnv();
|
|
59
64
|
ensureHooks();
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
* plugin. Read the way SvelteKit reads it, the shell first:
|
|
4
4
|
*
|
|
5
5
|
* ```
|
|
6
|
-
* shell > .env
|
|
6
|
+
* shell > .env.<mode>.local > .env.<mode> > .env.local > .env
|
|
7
7
|
* ```
|
|
8
8
|
*
|
|
9
|
+
* where <mode> is NODE_ENV, `development` when it is unset.
|
|
10
|
+
*
|
|
9
11
|
* The app itself reads `$app/env/private` and `$app/env/public`.
|
|
10
12
|
*/
|
|
11
13
|
export declare const env: Record<string, string>;
|
|
@@ -4,9 +4,11 @@ import { loadEnv } from 'vite';
|
|
|
4
4
|
* plugin. Read the way SvelteKit reads it, the shell first:
|
|
5
5
|
*
|
|
6
6
|
* ```
|
|
7
|
-
* shell > .env
|
|
7
|
+
* shell > .env.<mode>.local > .env.<mode> > .env.local > .env
|
|
8
8
|
* ```
|
|
9
9
|
*
|
|
10
|
+
* where <mode> is NODE_ENV, `development` when it is unset.
|
|
11
|
+
*
|
|
10
12
|
* The app itself reads `$app/env/private` and `$app/env/public`.
|
|
11
13
|
*/
|
|
12
14
|
export const env = loadEnv(process.env.NODE_ENV || 'development', process.cwd(), '');
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { Plugin } from 'vite';
|
|
2
|
+
/**
|
|
3
|
+
* Writes src/rime.modules.generated.d.ts: one `declare module '$rime/modules:<path>'` per pair
|
|
4
|
+
* under src/lib, re-exporting the server half (the client half when there is none). Removes the
|
|
5
|
+
* file when src/lib holds no pair.
|
|
6
|
+
*/
|
|
2
7
|
export declare function regenerateModulesDeclaration(): void;
|
|
3
8
|
/**
|
|
4
9
|
* Whether `file`, an absolute path as the watcher reports it, sits inside the config folder
|
|
@@ -11,4 +16,9 @@ export declare function regenerateModulesDeclaration(): void;
|
|
|
11
16
|
* ```
|
|
12
17
|
*/
|
|
13
18
|
export declare const isInConfigDir: (file: string, configDir: string) => boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The `rimecms/vite` plugin. It resolves `$rime/config`, `$rime/schema` and `$rime/modules:<path>`,
|
|
21
|
+
* and in dev it checks that `rime init` ran, keeps the modules declaration current, and
|
|
22
|
+
* re-sanitizes the config folder on every edit, which reloads the config and runs codegen.
|
|
23
|
+
*/
|
|
14
24
|
export declare function rime(): Plugin;
|
|
@@ -10,6 +10,11 @@ import { CONFIG_DIR, generatedConfigServerPath, libImportSpecifier, schemaPath }
|
|
|
10
10
|
import { ensureHasInit } from './ensure.server.js';
|
|
11
11
|
import { logSettings } from './env.server.js';
|
|
12
12
|
const dev = process.env.NODE_ENV === 'development';
|
|
13
|
+
/**
|
|
14
|
+
* Writes src/rime.modules.generated.d.ts: one `declare module '$rime/modules:<path>'` per pair
|
|
15
|
+
* under src/lib, re-exporting the server half (the client half when there is none). Removes the
|
|
16
|
+
* file when src/lib holds no pair.
|
|
17
|
+
*/
|
|
13
18
|
export function regenerateModulesDeclaration() {
|
|
14
19
|
const libDir = path.resolve(process.cwd(), 'src/lib');
|
|
15
20
|
const blocks = Array.from(scanModulePairs(libDir))
|
|
@@ -41,6 +46,11 @@ export function regenerateModulesDeclaration() {
|
|
|
41
46
|
* ```
|
|
42
47
|
*/
|
|
43
48
|
export const isInConfigDir = (file, configDir) => path.resolve(file).startsWith(path.resolve(process.cwd(), configDir) + path.sep);
|
|
49
|
+
/**
|
|
50
|
+
* The `rimecms/vite` plugin. It resolves `$rime/config`, `$rime/schema` and `$rime/modules:<path>`,
|
|
51
|
+
* and in dev it checks that `rime init` ran, keeps the modules declaration current, and
|
|
52
|
+
* re-sanitizes the config folder on every edit, which reloads the config and runs codegen.
|
|
53
|
+
*/
|
|
44
54
|
export function rime() {
|
|
45
55
|
logger.configure(logSettings);
|
|
46
56
|
/** Two reserved names, always resolved to *the currently running app's* generated
|
|
@@ -81,7 +91,8 @@ export function rime() {
|
|
|
81
91
|
configureServer(server) {
|
|
82
92
|
// Ahead of Vite's own middlewares: no request reaches storage/, the uploads and the database
|
|
83
93
|
server.middlewares.use(denyStorage);
|
|
84
|
-
//
|
|
94
|
+
// Once the server listens: check the init files, write the modules declaration, and empty
|
|
95
|
+
// node_modules/.rime when started with --rebuild
|
|
85
96
|
server.httpServer?.once('listening', () => {
|
|
86
97
|
dev && ensureHasInit();
|
|
87
98
|
regenerateModulesDeclaration();
|
|
@@ -185,6 +196,7 @@ export function rime() {
|
|
|
185
196
|
}
|
|
186
197
|
};
|
|
187
198
|
},
|
|
199
|
+
/** Inside this repo only: an edit under src/lib/core/config reloads `$rime/config`. */
|
|
188
200
|
async handleHotUpdate({ server, file }) {
|
|
189
201
|
function invalidateVModule(moduleId) {
|
|
190
202
|
const module = server.moduleGraph.getModuleById(resolvedVModule(moduleId));
|
|
@@ -9,9 +9,15 @@ import type { HandleServerError } from '@sveltejs/kit/hooks';
|
|
|
9
9
|
* if (!doc) throw new RimeError(RimeError.NOT_FOUND);
|
|
10
10
|
* ```
|
|
11
11
|
*
|
|
12
|
-
* A `RimeError`
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* A `RimeError` answers with its own status; a 4xx keeps its message, a 5xx sends its code only
|
|
13
|
+
* and logs the message with its stack. A better-auth `APIError` answers with its own status and
|
|
14
|
+
* message. Anything else is a 500 whose message stays on the server, logged with its stack. An
|
|
15
|
+
* `error()` already has its status, and SvelteKit answers it as is.
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* new RimeError(RimeError.NOT_FOUND, 'no page home'); // 404 "not_found — no page home"
|
|
19
|
+
* new RimeError(RimeError.UPLOAD, 'File not found: /srv/x.jpg'); // 500 "upload_error"
|
|
20
|
+
* ```
|
|
15
21
|
*/
|
|
16
22
|
export declare const handleError: HandleServerError;
|
|
17
23
|
/**
|
|
@@ -11,9 +11,15 @@ import { RimeError, RimeFormError } from './index.js';
|
|
|
11
11
|
* if (!doc) throw new RimeError(RimeError.NOT_FOUND);
|
|
12
12
|
* ```
|
|
13
13
|
*
|
|
14
|
-
* A `RimeError`
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* A `RimeError` answers with its own status; a 4xx keeps its message, a 5xx sends its code only
|
|
15
|
+
* and logs the message with its stack. A better-auth `APIError` answers with its own status and
|
|
16
|
+
* message. Anything else is a 500 whose message stays on the server, logged with its stack. An
|
|
17
|
+
* `error()` already has its status, and SvelteKit answers it as is.
|
|
18
|
+
*
|
|
19
|
+
* ```ts
|
|
20
|
+
* new RimeError(RimeError.NOT_FOUND, 'no page home'); // 404 "not_found — no page home"
|
|
21
|
+
* new RimeError(RimeError.UPLOAD, 'File not found: /srv/x.jpg'); // 500 "upload_error"
|
|
22
|
+
* ```
|
|
17
23
|
*/
|
|
18
24
|
export const handleError = ({ error, event, kind }) => {
|
|
19
25
|
if (kind !== 'unknown')
|
|
@@ -22,10 +28,9 @@ export const handleError = ({ error, event, kind }) => {
|
|
|
22
28
|
if (error instanceof RimeError) {
|
|
23
29
|
if (error.status >= 500) {
|
|
24
30
|
logger.error(`${error.status} ${line}\n${error.stack}`);
|
|
31
|
+
return { status: error.status, message: error.code };
|
|
25
32
|
}
|
|
26
|
-
|
|
27
|
-
logger.debug(`${error.status} ${line} — ${error.message}`);
|
|
28
|
-
}
|
|
33
|
+
logger.debug(`${error.status} ${line} — ${error.message}`);
|
|
29
34
|
return { status: error.status, message: error.message };
|
|
30
35
|
}
|
|
31
36
|
if (error instanceof APIError) {
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import type { FormErrors } from '../../panel/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* An error rime throws to answer a request: `code` is one of the static codes, the message reads
|
|
4
|
+
* `code — message`, and `status` is the code's HTTP status (500 for a code that has none).
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* throw new RimeError(RimeError.NOT_FOUND); // 404 "not_found"
|
|
8
|
+
* throw new RimeError(RimeError.BAD_REQUEST, 'pages is not an area'); // 400 "bad_request — pages…"
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
2
11
|
declare class RimeError extends Error {
|
|
3
12
|
static BAD_REQUEST: string;
|
|
4
13
|
static CONFIG_ERROR: string;
|
|
@@ -15,14 +24,24 @@ declare class RimeError extends Error {
|
|
|
15
24
|
status: number;
|
|
16
25
|
constructor(code: string, message?: string, ...args: any);
|
|
17
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* A 400 carrying one error code per field path, which the panel shows beside each field. The
|
|
29
|
+
* message lists them, translated: `title: Required, link: Invalid URL`.
|
|
30
|
+
*/
|
|
18
31
|
declare class RimeFormError extends RimeError {
|
|
19
32
|
static INVALID_DATE: string;
|
|
20
33
|
static INVALID_EMAIL: string;
|
|
21
34
|
static INVALID_FIELD: string;
|
|
22
35
|
static INVALID_PHONE: string;
|
|
23
36
|
static INVALID_SLUG: string;
|
|
37
|
+
static INVALID_TIME: string;
|
|
24
38
|
static INVALID_URL: string;
|
|
39
|
+
static NOT_A_BOOLEAN: string;
|
|
40
|
+
static NOT_A_NUMBER: string;
|
|
25
41
|
static NOT_A_STRING: string;
|
|
42
|
+
static NOT_AN_OPTION: string;
|
|
43
|
+
static NUMBER_TOO_LARGE: string;
|
|
44
|
+
static NUMBER_TOO_SMALL: string;
|
|
26
45
|
static PASSWORD_LOWERCASE_MISSING: string;
|
|
27
46
|
static PASSWORD_MIN_8: string;
|
|
28
47
|
static PASSWORD_MISMATCH: string;
|
|
@@ -39,13 +58,14 @@ declare class RimeFormError extends RimeError {
|
|
|
39
58
|
}
|
|
40
59
|
export { RimeError, RimeFormError };
|
|
41
60
|
/**
|
|
42
|
-
* The text of a field or form error.
|
|
61
|
+
* The text of a field or form error. A leading `kind::` is dropped; a rime error code is
|
|
43
62
|
* translated, any other string is a validator's own message and is shown as is.
|
|
44
63
|
*
|
|
45
64
|
* ```ts
|
|
46
65
|
* errorText('required::required_field'); // 'Required'
|
|
47
66
|
* errorText('url::invalid_url'); // 'Invalid URL'
|
|
48
67
|
* errorText('Starts with a capital'); // 'Starts with a capital'
|
|
68
|
+
* errorText('Format HH::MM'); // 'Format HH::MM'
|
|
49
69
|
* ```
|
|
50
70
|
*/
|
|
51
71
|
export declare function errorText(error: string): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t__ } from '../i18n/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* The HTTP status of each code that is the client's doing. Any other code is the server's: 500,
|
|
4
|
-
* logged with its stack.
|
|
4
|
+
* logged with its stack, and answered with the code alone.
|
|
5
5
|
*/
|
|
6
6
|
const CLIENT_STATUS = {
|
|
7
7
|
bad_request: 400,
|
|
@@ -11,6 +11,15 @@ const CLIENT_STATUS = {
|
|
|
11
11
|
unauthorized: 403,
|
|
12
12
|
not_found: 404
|
|
13
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* An error rime throws to answer a request: `code` is one of the static codes, the message reads
|
|
16
|
+
* `code — message`, and `status` is the code's HTTP status (500 for a code that has none).
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* throw new RimeError(RimeError.NOT_FOUND); // 404 "not_found"
|
|
20
|
+
* throw new RimeError(RimeError.BAD_REQUEST, 'pages is not an area'); // 400 "bad_request — pages…"
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
14
23
|
class RimeError extends Error {
|
|
15
24
|
static BAD_REQUEST = 'bad_request';
|
|
16
25
|
static CONFIG_ERROR = 'config_error';
|
|
@@ -31,14 +40,24 @@ class RimeError extends Error {
|
|
|
31
40
|
this.status = CLIENT_STATUS[code] ?? 500;
|
|
32
41
|
}
|
|
33
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* A 400 carrying one error code per field path, which the panel shows beside each field. The
|
|
45
|
+
* message lists them, translated: `title: Required, link: Invalid URL`.
|
|
46
|
+
*/
|
|
34
47
|
class RimeFormError extends RimeError {
|
|
35
48
|
static INVALID_DATE = 'invalid_date';
|
|
36
49
|
static INVALID_EMAIL = 'invalid_email';
|
|
37
50
|
static INVALID_FIELD = 'invalid_field';
|
|
38
51
|
static INVALID_PHONE = 'invalid_phone';
|
|
39
52
|
static INVALID_SLUG = 'invalid_slug';
|
|
53
|
+
static INVALID_TIME = 'invalid_time';
|
|
40
54
|
static INVALID_URL = 'invalid_url';
|
|
55
|
+
static NOT_A_BOOLEAN = 'not_a_boolean';
|
|
56
|
+
static NOT_A_NUMBER = 'not_a_number';
|
|
41
57
|
static NOT_A_STRING = 'not_a_string';
|
|
58
|
+
static NOT_AN_OPTION = 'not_an_option';
|
|
59
|
+
static NUMBER_TOO_LARGE = 'number_too_large';
|
|
60
|
+
static NUMBER_TOO_SMALL = 'number_too_small';
|
|
42
61
|
static PASSWORD_LOWERCASE_MISSING = 'password_lowercase_missing';
|
|
43
62
|
static PASSWORD_MIN_8 = 'password_min_8';
|
|
44
63
|
static PASSWORD_MISMATCH = 'password_mismatch';
|
|
@@ -61,16 +80,17 @@ class RimeFormError extends RimeError {
|
|
|
61
80
|
export { RimeError, RimeFormError };
|
|
62
81
|
const CODES = new Set([...Object.values(RimeError), ...Object.values(RimeFormError)]);
|
|
63
82
|
/**
|
|
64
|
-
* The text of a field or form error.
|
|
83
|
+
* The text of a field or form error. A leading `kind::` is dropped; a rime error code is
|
|
65
84
|
* translated, any other string is a validator's own message and is shown as is.
|
|
66
85
|
*
|
|
67
86
|
* ```ts
|
|
68
87
|
* errorText('required::required_field'); // 'Required'
|
|
69
88
|
* errorText('url::invalid_url'); // 'Invalid URL'
|
|
70
89
|
* errorText('Starts with a capital'); // 'Starts with a capital'
|
|
90
|
+
* errorText('Format HH::MM'); // 'Format HH::MM'
|
|
71
91
|
* ```
|
|
72
92
|
*/
|
|
73
93
|
export function errorText(error) {
|
|
74
|
-
const code = error.
|
|
94
|
+
const code = error.replace(/^[a-z]+::/, '');
|
|
75
95
|
return CODES.has(code) ? t__(`errors.${code}`) : code;
|
|
76
96
|
}
|
|
@@ -6,6 +6,10 @@ type BooleanField = FormField & {
|
|
|
6
6
|
defaultValue?: boolean | DefaultValueFn<boolean>;
|
|
7
7
|
validate?: FieldValidationFunc<BooleanField>;
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* A checkbox or a toggle: starts `false`, and only a missing value is empty (`false` is an
|
|
11
|
+
* answer). Its own check refuses anything but a boolean.
|
|
12
|
+
*/
|
|
9
13
|
export declare class BooleanFieldBuilder<T extends BooleanField = BooleanField> extends FormFieldBuilder<T> {
|
|
10
14
|
constructor(name: string, type: string);
|
|
11
15
|
get dataType(): 'boolean';
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
import { RimeFormError } from '../../errors/index.js';
|
|
1
2
|
import { FormFieldBuilder } from './form-field-builder.js';
|
|
3
|
+
/**
|
|
4
|
+
* A checkbox or a toggle: starts `false`, and only a missing value is empty (`false` is an
|
|
5
|
+
* answer). Its own check refuses anything but a boolean.
|
|
6
|
+
*/
|
|
2
7
|
export class BooleanFieldBuilder extends FormFieldBuilder {
|
|
3
8
|
constructor(name, type) {
|
|
4
9
|
super(name, type);
|
|
5
10
|
this.field.defaultValue = false;
|
|
6
11
|
// `false` is a value: only a missing one is empty.
|
|
7
12
|
this.field.isEmpty = (value) => typeof value !== 'boolean';
|
|
8
|
-
this.field.validate = (value) => typeof value === 'boolean' ||
|
|
13
|
+
this.field.validate = (value) => typeof value === 'boolean' || RimeFormError.NOT_A_BOOLEAN;
|
|
9
14
|
// A form sends a checked box as 'true' or 'on', and 'false' for an explicit no
|
|
10
15
|
this.beforeValidate((value) => value === 'true' || value === 'on' ? true : value === 'false' ? false : value);
|
|
11
16
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { Component } from 'svelte';
|
|
2
2
|
import type { Field, FieldAccess } from '../../../fields/types.js';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* The compiled shape of a config tree: every FieldBuilder replaced by its plain field, at every
|
|
5
|
+
* depth.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* WithoutBuilders<BlocksField>['blocks'] // the compiled blocks, not BlockBuilder[]
|
|
9
|
+
* ```
|
|
9
10
|
*/
|
|
10
11
|
export type WithoutBuilders<T> = T extends FieldBuilder<infer F> ? WithoutBuilders<F> : T extends Array<infer U> ? U extends FieldBuilder<infer F> ? F[] : U extends {
|
|
11
12
|
compile(): infer R;
|
|
@@ -71,17 +72,28 @@ export type NodeStorage = {
|
|
|
71
72
|
export type ValueNode = FieldNode & {
|
|
72
73
|
value: unknown;
|
|
73
74
|
};
|
|
75
|
+
/**
|
|
76
|
+
* What every field is built from: the plain `field` object a config holds, the setters an author
|
|
77
|
+
* chains, and `get`/`use` to read it and run it.
|
|
78
|
+
*/
|
|
74
79
|
export declare class FieldBuilder<T extends Field = Field> {
|
|
75
80
|
field: T;
|
|
81
|
+
/** A field with no name yet, of `type`, shown in the live-edit panel until `live(false)`. */
|
|
76
82
|
constructor(type: string);
|
|
77
83
|
get name(): string;
|
|
84
|
+
/** A CSS class the field's component adds to its root element. */
|
|
78
85
|
className(str: string): this;
|
|
86
|
+
/**
|
|
87
|
+
* The field as plain data, for the client config and the panel: `field` with its `component`
|
|
88
|
+
* and its table `cell`.
|
|
89
|
+
*/
|
|
79
90
|
compile(): WithoutBuilders<T> & {
|
|
80
91
|
component: Component<any>;
|
|
81
92
|
cell?: Component<{
|
|
82
93
|
value: any;
|
|
83
94
|
}> | null;
|
|
84
95
|
};
|
|
96
|
+
/** Whether the field shows in the live-edit panel beside the site preview. On by default. */
|
|
85
97
|
live(bool: boolean): this;
|
|
86
98
|
get type(): string;
|
|
87
99
|
/**
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What every field is built from: the plain `field` object a config holds, the setters an author
|
|
3
|
+
* chains, and `get`/`use` to read it and run it.
|
|
4
|
+
*/
|
|
1
5
|
export class FieldBuilder {
|
|
2
6
|
field;
|
|
7
|
+
/** A field with no name yet, of `type`, shown in the live-edit panel until `live(false)`. */
|
|
3
8
|
constructor(type) {
|
|
4
9
|
this.field = {
|
|
5
10
|
name: '',
|
|
@@ -10,10 +15,15 @@ export class FieldBuilder {
|
|
|
10
15
|
get name() {
|
|
11
16
|
return this.field.name;
|
|
12
17
|
}
|
|
18
|
+
/** A CSS class the field's component adds to its root element. */
|
|
13
19
|
className(str) {
|
|
14
20
|
this.field.className = str;
|
|
15
21
|
return this;
|
|
16
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* The field as plain data, for the client config and the panel: `field` with its `component`
|
|
25
|
+
* and its table `cell`.
|
|
26
|
+
*/
|
|
17
27
|
compile() {
|
|
18
28
|
return {
|
|
19
29
|
...this.field,
|
|
@@ -21,6 +31,7 @@ export class FieldBuilder {
|
|
|
21
31
|
cell: this.cell || undefined
|
|
22
32
|
};
|
|
23
33
|
}
|
|
34
|
+
/** Whether the field shows in the live-edit panel beside the site preview. On by default. */
|
|
24
35
|
live(bool) {
|
|
25
36
|
this.field.live = bool;
|
|
26
37
|
return this;
|