rimecms 1.3.0 → 1.4.1
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.d.ts +131 -0
- 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/index.d.ts +7 -0
- 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
|
@@ -12,6 +12,7 @@ import { prototypeKebab } from '../prototype/naming.js';
|
|
|
12
12
|
import { isCamelCase } from '../../util/string.js';
|
|
13
13
|
/** A field name: letters, digits and `_`, a letter first after any `_`: `_hello_guys`, `fooBar` */
|
|
14
14
|
const FIELD_NAME = /^_*[a-zA-Z][a-zA-Z0-9_]*$/;
|
|
15
|
+
/** The values that appear more than once, each once: `['a', 'b', 'a']` -> `['a']`. */
|
|
15
16
|
function hasDuplicates(arr) {
|
|
16
17
|
return [...new Set(arr.filter((e, i, a) => a.indexOf(e) !== i))];
|
|
17
18
|
}
|
|
@@ -62,107 +63,112 @@ function validateSlugs(config) {
|
|
|
62
63
|
}
|
|
63
64
|
return errors;
|
|
64
65
|
}
|
|
65
|
-
/**
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
/** Where a message points: `collection pages`. */
|
|
67
|
+
const where = ({ prototype }) => `${prototype.type} ${prototype.slug}`;
|
|
68
|
+
/** The names a level writes under: each form field's, and each tab's. */
|
|
69
|
+
const namesAtLevel = (fields) => fields.flatMap((field) => {
|
|
70
|
+
if (field instanceof TabsBuilder)
|
|
71
|
+
return field.get.tabs.map((tab) => tab.name);
|
|
72
|
+
return isFormField(field) ? [field.name] : [];
|
|
73
|
+
});
|
|
74
|
+
/** A relation names a collection that exists, and is not `$root()`. */
|
|
75
|
+
const relationRules = (field, scope) => {
|
|
76
|
+
const errors = [];
|
|
77
|
+
if (!scope.collectionSlugs.includes(field.get.relationTo)) {
|
|
78
|
+
errors.push(`Relation field ${field.name} references unknown collection ${field.get.relationTo}, in ${where(scope)}`);
|
|
74
79
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
80
|
+
// A relation is junction rows, and the base row has no junction. A reference that must sit
|
|
81
|
+
// there is a text column with `$references(slug, { resolve: true })`.
|
|
82
|
+
if (field.get.root) {
|
|
83
|
+
errors.push(`Relation field ${field.name} can't be $root(), in ${where(scope)}`);
|
|
78
84
|
}
|
|
79
85
|
return errors;
|
|
80
86
|
};
|
|
81
|
-
|
|
87
|
+
/**
|
|
88
|
+
* A block name holds no ".", two blocks of one name in a prototype are the same block, and an
|
|
89
|
+
* array default names only the block types the field declares.
|
|
90
|
+
*
|
|
91
|
+
* A blocks rule, not a walk: it compares whole block builders, which a node does not carry.
|
|
92
|
+
*/
|
|
93
|
+
const blocksRules = (field, scope) => {
|
|
82
94
|
const errors = [];
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
errors.push(`Relation field ${field.name} references unknown collection ${field.get.relationTo}, in ${documentConfig.type} ${documentConfig.slug}`);
|
|
95
|
+
for (const block of field.get.blocks) {
|
|
96
|
+
// A "." splits the path segment that carries the block name
|
|
97
|
+
if (block.name.includes('.')) {
|
|
98
|
+
errors.push(`Block ${block.name} of ${where(scope)} can't hold a "."`);
|
|
88
99
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
100
|
+
if (block.name in scope.blocks) {
|
|
101
|
+
if (JSON.stringify(scope.blocks[block.name]) !== JSON.stringify(block)) {
|
|
102
|
+
errors.push(`Each block with same name should be identical (block ${block.name})`);
|
|
103
|
+
}
|
|
93
104
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const namesAtLevel = (fields) => fields.flatMap((field) => {
|
|
97
|
-
if (field instanceof TabsBuilder)
|
|
98
|
-
return field.get.tabs.map((tab) => tab.name);
|
|
99
|
-
return isFormField(field) ? [field.name] : [];
|
|
100
|
-
});
|
|
101
|
-
const validateFields = (fields) => {
|
|
102
|
-
for (const duplicate of hasDuplicates(namesAtLevel(fields))) {
|
|
103
|
-
errors.push(`Duplicate field or tab '${duplicate}' in ${documentConfig.type} '${documentConfig.slug}'`);
|
|
105
|
+
else {
|
|
106
|
+
scope.blocks[block.name] = block;
|
|
104
107
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
errors.push(`Field ${field.name} of ${documentConfig.type} ${documentConfig.slug} with a resolved reference, can't be localized`);
|
|
115
|
-
}
|
|
116
|
-
// Check for malformed field.name
|
|
117
|
-
if (!FIELD_NAME.test(field.name)) {
|
|
118
|
-
errors.push(`Field ${field.name} of ${documentConfig.type} ${documentConfig.slug} should be camelCase`);
|
|
119
|
-
}
|
|
120
|
-
// A blocks rule, not a walk: it compares whole block builders, which a node does not carry.
|
|
121
|
-
if (field instanceof BlocksBuilder) {
|
|
122
|
-
for (const block of field.get.blocks) {
|
|
123
|
-
// A "." splits the path segment that carries the block name
|
|
124
|
-
if (block.name.includes('.')) {
|
|
125
|
-
errors.push(`Block ${block.name} of ${documentConfig.type} ${documentConfig.slug} can't hold a "."`);
|
|
126
|
-
}
|
|
127
|
-
if (block.name in registeredBlocks) {
|
|
128
|
-
const blockDefinedButDiffer = JSON.stringify(registeredBlocks[block.name]) !== JSON.stringify(block);
|
|
129
|
-
if (blockDefinedButDiffer) {
|
|
130
|
-
errors.push(`Each block with same name should be identique (block ${block.name})`);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
registeredBlocks[block.name] = block;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
// A default names block types this list declares. A function default is checked when
|
|
138
|
-
// it runs.
|
|
139
|
-
const initial = field.get.defaultValue;
|
|
140
|
-
if (Array.isArray(initial)) {
|
|
141
|
-
try {
|
|
142
|
-
field.use.completeDefault(initial);
|
|
143
|
-
}
|
|
144
|
-
catch (error) {
|
|
145
|
-
errors.push(`${error.message}, in ${documentConfig.type} ${documentConfig.slug}`);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
else if (field instanceof RelationFieldBuilder) {
|
|
150
|
-
validateRelationField(field);
|
|
151
|
-
}
|
|
152
|
-
else if ((field instanceof PickOneFieldBuilder || field instanceof PickManyFieldBuilder) &&
|
|
153
|
-
!field.get.options?.length) {
|
|
154
|
-
errors.push(`Field ${field.name} of ${documentConfig.type} ${documentConfig.slug} should have at least one option`);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
// Every block type, every tab, a group's and a tree row's fields: one level each.
|
|
158
|
-
for (const node of field.use.nodes()) {
|
|
159
|
-
validateFields(node.fields);
|
|
160
|
-
}
|
|
108
|
+
}
|
|
109
|
+
// A function default is checked when it runs.
|
|
110
|
+
const initial = field.get.defaultValue;
|
|
111
|
+
if (Array.isArray(initial)) {
|
|
112
|
+
try {
|
|
113
|
+
field.use.completeDefault(initial);
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
errors.push(`${error.message}, in ${where(scope)}`);
|
|
161
117
|
}
|
|
162
|
-
}
|
|
163
|
-
validateFields(documentConfig.fields);
|
|
118
|
+
}
|
|
164
119
|
return errors;
|
|
165
120
|
};
|
|
121
|
+
/** The rules one form field follows, whatever its level. */
|
|
122
|
+
const fieldRules = (field, scope) => {
|
|
123
|
+
if (!isFormField(field))
|
|
124
|
+
return [];
|
|
125
|
+
const errors = [];
|
|
126
|
+
// A `$root()` field sits on the base row, which has no locales branch.
|
|
127
|
+
if (field.get.root && field.get.localized) {
|
|
128
|
+
errors.push(`Field ${field.name} of ${where(scope)} with $root(), can't be localized`);
|
|
129
|
+
}
|
|
130
|
+
// A resolved reference is joined from a column of the row; a localized column is on the
|
|
131
|
+
// locales branch, where no join reaches it.
|
|
132
|
+
if (field._references?.resolve && field.get.localized) {
|
|
133
|
+
errors.push(`Field ${field.name} of ${where(scope)} with a resolved reference, can't be localized`);
|
|
134
|
+
}
|
|
135
|
+
// `id` is the document's own column, and each block's and tree row's: no field takes it. A
|
|
136
|
+
// config rime derives (a `$` slug) may: the upload folders' id is their path.
|
|
137
|
+
if (field.name === 'id' && !scope.prototype.slug.startsWith('$')) {
|
|
138
|
+
errors.push(`Field id of ${where(scope)}: "id" is reserved for the document's and each row's id`);
|
|
139
|
+
}
|
|
140
|
+
if (!FIELD_NAME.test(field.name)) {
|
|
141
|
+
errors.push(`Field ${field.name} of ${where(scope)} should hold only letters, digits and underscores, with a letter first after any leading underscore`);
|
|
142
|
+
}
|
|
143
|
+
if (field instanceof BlocksBuilder) {
|
|
144
|
+
errors.push(...blocksRules(field, scope));
|
|
145
|
+
}
|
|
146
|
+
if (field instanceof RelationFieldBuilder) {
|
|
147
|
+
errors.push(...relationRules(field, scope));
|
|
148
|
+
}
|
|
149
|
+
if ((field instanceof PickOneFieldBuilder || field instanceof PickManyFieldBuilder) &&
|
|
150
|
+
!field.get.options?.length) {
|
|
151
|
+
errors.push(`Field ${field.name} of ${where(scope)} should have at least one option`);
|
|
152
|
+
}
|
|
153
|
+
return errors;
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* The rules of one level of fields, then of each level below it: every block type, every tab, a
|
|
157
|
+
* group's and a tree row's fields.
|
|
158
|
+
*/
|
|
159
|
+
const fieldErrors = (fields, scope) => [
|
|
160
|
+
...hasDuplicates(namesAtLevel(fields)).map((name) => `Duplicate field or tab '${name}' in ${scope.prototype.type} '${scope.prototype.slug}'`),
|
|
161
|
+
...fields.flatMap((field) => [
|
|
162
|
+
...fieldRules(field, scope),
|
|
163
|
+
...field.use.nodes().flatMap((node) => fieldErrors(node.fields, scope))
|
|
164
|
+
])
|
|
165
|
+
];
|
|
166
|
+
/** The field rules of every collection, then of every area. */
|
|
167
|
+
const validateFields = (config) => {
|
|
168
|
+
const collectionSlugs = config.collections.map((c) => c.slug);
|
|
169
|
+
return [...config.collections, ...config.areas].flatMap((prototype) => fieldErrors(prototype.fields, { prototype, collectionSlugs, blocks: {} }));
|
|
170
|
+
};
|
|
171
|
+
/** `config.$adapter` is set. */
|
|
166
172
|
const hasDatabase = (config) => {
|
|
167
173
|
const hasDatabaseName = '$adapter' in config;
|
|
168
174
|
if (!hasDatabaseName) {
|
|
@@ -207,6 +213,10 @@ function validateKebabs(config) {
|
|
|
207
213
|
}
|
|
208
214
|
return errors;
|
|
209
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* Runs each rule group in turn and stops at the first that fails: clears the dev cache, logs the
|
|
218
|
+
* group's errors, and answers `false`.
|
|
219
|
+
*/
|
|
210
220
|
function validate(config) {
|
|
211
221
|
const validateFunctions = [
|
|
212
222
|
hasDuplicateSlug,
|
package/dist/core/constants.d.ts
CHANGED
|
@@ -7,7 +7,10 @@ export declare const PARAMS: {
|
|
|
7
7
|
* @example ?/update&autoSave=true&versionId=abc
|
|
8
8
|
*/
|
|
9
9
|
readonly AUTO_SAVE: "autoSave";
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* How many levels of relations a read resolves into documents.
|
|
12
|
+
* @example ?depth=1
|
|
13
|
+
*/
|
|
11
14
|
readonly DEPTH: "depth";
|
|
12
15
|
/**
|
|
13
16
|
* Make a new version. The update starts from the row the other parameters select — the
|
|
@@ -32,11 +35,12 @@ export declare const PARAMS: {
|
|
|
32
35
|
*/
|
|
33
36
|
readonly LATEST: "latest";
|
|
34
37
|
/**
|
|
35
|
-
*
|
|
38
|
+
* At most this many documents in a list.
|
|
36
39
|
* @example ?limit=4
|
|
37
40
|
*/
|
|
38
41
|
readonly LIMIT: "limit";
|
|
39
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* The locale a read or a write is for.
|
|
40
44
|
* @example ?locale=en
|
|
41
45
|
*/
|
|
42
46
|
readonly LOCALE: "locale";
|
|
@@ -45,7 +49,8 @@ export declare const PARAMS: {
|
|
|
45
49
|
*/
|
|
46
50
|
readonly OFFSET: "offset";
|
|
47
51
|
/**
|
|
48
|
-
*
|
|
52
|
+
* `false` keeps the panel's create action from redirecting to the new document: a create made
|
|
53
|
+
* from a nested form stays where it is (panel/pages/collection-document/actions.server.ts).
|
|
49
54
|
* @example ?redirect=false
|
|
50
55
|
*/
|
|
51
56
|
readonly REDIRECT: "redirect";
|
|
@@ -58,7 +63,10 @@ export declare const PARAMS: {
|
|
|
58
63
|
* @example ?sort=-title
|
|
59
64
|
*/
|
|
60
65
|
readonly SORT: "sort";
|
|
61
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* The version a read or an update is for, by its id.
|
|
68
|
+
* @example ?versionId=abc
|
|
69
|
+
*/
|
|
62
70
|
readonly VERSION_ID: "versionId";
|
|
63
71
|
/**
|
|
64
72
|
* The upload folder the panel list opens at; the create form sends it on as `_path`.
|
package/dist/core/constants.js
CHANGED
|
@@ -7,7 +7,10 @@ export const PARAMS = {
|
|
|
7
7
|
* @example ?/update&autoSave=true&versionId=abc
|
|
8
8
|
*/
|
|
9
9
|
AUTO_SAVE: 'autoSave',
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* How many levels of relations a read resolves into documents.
|
|
12
|
+
* @example ?depth=1
|
|
13
|
+
*/
|
|
11
14
|
DEPTH: 'depth',
|
|
12
15
|
/**
|
|
13
16
|
* Make a new version. The update starts from the row the other parameters select — the
|
|
@@ -32,11 +35,12 @@ export const PARAMS = {
|
|
|
32
35
|
*/
|
|
33
36
|
LATEST: 'latest',
|
|
34
37
|
/**
|
|
35
|
-
*
|
|
38
|
+
* At most this many documents in a list.
|
|
36
39
|
* @example ?limit=4
|
|
37
40
|
*/
|
|
38
41
|
LIMIT: 'limit',
|
|
39
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* The locale a read or a write is for.
|
|
40
44
|
* @example ?locale=en
|
|
41
45
|
*/
|
|
42
46
|
LOCALE: 'locale',
|
|
@@ -45,7 +49,8 @@ export const PARAMS = {
|
|
|
45
49
|
*/
|
|
46
50
|
OFFSET: 'offset',
|
|
47
51
|
/**
|
|
48
|
-
*
|
|
52
|
+
* `false` keeps the panel's create action from redirecting to the new document: a create made
|
|
53
|
+
* from a nested form stays where it is (panel/pages/collection-document/actions.server.ts).
|
|
49
54
|
* @example ?redirect=false
|
|
50
55
|
*/
|
|
51
56
|
REDIRECT: 'redirect',
|
|
@@ -58,7 +63,10 @@ export const PARAMS = {
|
|
|
58
63
|
* @example ?sort=-title
|
|
59
64
|
*/
|
|
60
65
|
SORT: 'sort',
|
|
61
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* The version a read or an update is for, by its id.
|
|
68
|
+
* @example ?versionId=abc
|
|
69
|
+
*/
|
|
62
70
|
VERSION_ID: 'versionId',
|
|
63
71
|
/**
|
|
64
72
|
* The upload folder the panel list opens at; the create form sends it on as `_path`.
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
export declare const PACKAGE_NAME = "rimecms";
|
|
2
|
+
/**
|
|
3
|
+
* Whether this code runs from the rime repository rather than from an installed `rimecms`: a
|
|
4
|
+
* path test on this module's URL. Then rime's version is read from the root `package.json`,
|
|
5
|
+
* generated types carry eslint-disable lines, and the Vite plugin reloads on edits to
|
|
6
|
+
* `src/lib/core/config`.
|
|
7
|
+
*/
|
|
2
8
|
export declare const IS_RIME_REPO: boolean;
|
|
9
|
+
/** The app's `node_modules/.rime`: the dev cache of codegen memos and the `rime generate` mark. */
|
|
3
10
|
export declare const RIME_DEV_CACHE_DIR: string;
|
|
4
11
|
/** Consumer branding image convention: drop a file at static/assets/panel/panel.jpg. */
|
|
5
12
|
export declare const PANEL_AUTH_IMAGE = "/assets/panel/panel.jpg";
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
export const PACKAGE_NAME = 'rimecms';
|
|
3
|
+
/**
|
|
4
|
+
* Whether this code runs from the rime repository rather than from an installed `rimecms`: a
|
|
5
|
+
* path test on this module's URL. Then rime's version is read from the root `package.json`,
|
|
6
|
+
* generated types carry eslint-disable lines, and the Vite plugin reloads on edits to
|
|
7
|
+
* `src/lib/core/config`.
|
|
8
|
+
*/
|
|
3
9
|
export const IS_RIME_REPO = !import.meta.url.includes('/node_modules/rimecms/');
|
|
10
|
+
/** The app's `node_modules/.rime`: the dev cache of codegen memos and the `rime generate` mark. */
|
|
4
11
|
export const RIME_DEV_CACHE_DIR = path.resolve(process.cwd(), 'node_modules', '.rime');
|
|
5
12
|
/** Consumer branding image convention: drop a file at static/assets/panel/panel.jpg. */
|
|
6
13
|
export const PANEL_AUTH_IMAGE = '/assets/panel/panel.jpg';
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
/** The string stored under `key`, false when nothing is. */
|
|
1
2
|
declare function get(key: string): string | false;
|
|
3
|
+
/** Stores `value` under `key`, creating node_modules/.rime when needed. */
|
|
2
4
|
declare function set(key: string, value: string): void;
|
|
3
5
|
/**
|
|
4
|
-
*
|
|
6
|
+
* Whether `content` hashes to what is stored under `key`. Stores nothing.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* the
|
|
8
|
+
* `matches` and `remember` are the two verbs for a memo — content that is only ever compared,
|
|
9
|
+
* never read back. Every codegen step asks the same question: is this the string I was given
|
|
10
|
+
* last time? Storing the answer as a digest keeps a 400KB serialized config out of
|
|
11
|
+
* `node_modules/.rime` and makes the comparison a fixed 64 bytes:
|
|
9
12
|
*
|
|
10
13
|
* ```ts
|
|
11
14
|
* if (cache.matches('config', memo)) return;
|
|
@@ -13,13 +16,13 @@ declare function set(key: string, value: string): void;
|
|
|
13
16
|
* cache.remember('config', memo);
|
|
14
17
|
* ```
|
|
15
18
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
19
|
+
* A step stores its memo only once its work succeeded: a memo written before would skip the
|
|
20
|
+
* work forever after a failure.
|
|
18
21
|
*/
|
|
19
|
-
/** Whether `content` hashes to what is stored under `key`. Stores nothing. */
|
|
20
22
|
declare function matches(key: string, content: string): boolean;
|
|
21
23
|
/** Records `content` under `key`, as its digest. */
|
|
22
24
|
declare function remember(key: string, content: string): void;
|
|
25
|
+
/** Removes what is stored under `key`. */
|
|
23
26
|
declare function del(key: string): void;
|
|
24
27
|
/** Removes every stored entry: the whole node_modules/.rime folder, whether or not it exists. */
|
|
25
28
|
declare function clear(): void;
|
|
@@ -2,10 +2,7 @@ import { createHash } from 'node:crypto';
|
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { RIME_DEV_CACHE_DIR } from '../constants.server.js';
|
|
5
|
-
|
|
6
|
-
if (!fs.existsSync(RIME_DEV_CACHE_DIR) && dev) {
|
|
7
|
-
fs.mkdirSync(RIME_DEV_CACHE_DIR);
|
|
8
|
-
}
|
|
5
|
+
/** The string stored under `key`, false when nothing is. */
|
|
9
6
|
function get(key) {
|
|
10
7
|
const keyPath = path.join(RIME_DEV_CACHE_DIR, key + '.txt');
|
|
11
8
|
const exist = fs.existsSync(keyPath);
|
|
@@ -14,6 +11,7 @@ function get(key) {
|
|
|
14
11
|
}
|
|
15
12
|
return false;
|
|
16
13
|
}
|
|
14
|
+
/** Stores `value` under `key`, creating node_modules/.rime when needed. */
|
|
17
15
|
function set(key, value) {
|
|
18
16
|
if (!fs.existsSync(RIME_DEV_CACHE_DIR)) {
|
|
19
17
|
fs.mkdirSync(RIME_DEV_CACHE_DIR);
|
|
@@ -23,11 +21,12 @@ function set(key, value) {
|
|
|
23
21
|
}
|
|
24
22
|
const digest = (content) => createHash('sha256').update(content).digest('hex');
|
|
25
23
|
/**
|
|
26
|
-
*
|
|
24
|
+
* Whether `content` hashes to what is stored under `key`. Stores nothing.
|
|
27
25
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* the
|
|
26
|
+
* `matches` and `remember` are the two verbs for a memo — content that is only ever compared,
|
|
27
|
+
* never read back. Every codegen step asks the same question: is this the string I was given
|
|
28
|
+
* last time? Storing the answer as a digest keeps a 400KB serialized config out of
|
|
29
|
+
* `node_modules/.rime` and makes the comparison a fixed 64 bytes:
|
|
31
30
|
*
|
|
32
31
|
* ```ts
|
|
33
32
|
* if (cache.matches('config', memo)) return;
|
|
@@ -35,10 +34,9 @@ const digest = (content) => createHash('sha256').update(content).digest('hex');
|
|
|
35
34
|
* cache.remember('config', memo);
|
|
36
35
|
* ```
|
|
37
36
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
37
|
+
* A step stores its memo only once its work succeeded: a memo written before would skip the
|
|
38
|
+
* work forever after a failure.
|
|
40
39
|
*/
|
|
41
|
-
/** Whether `content` hashes to what is stored under `key`. Stores nothing. */
|
|
42
40
|
function matches(key, content) {
|
|
43
41
|
return get(key) === digest(content);
|
|
44
42
|
}
|
|
@@ -46,6 +44,7 @@ function matches(key, content) {
|
|
|
46
44
|
function remember(key, content) {
|
|
47
45
|
set(key, digest(content));
|
|
48
46
|
}
|
|
47
|
+
/** Removes what is stored under `key`. */
|
|
49
48
|
function del(key) {
|
|
50
49
|
const keyPath = path.join(RIME_DEV_CACHE_DIR, key + '.txt');
|
|
51
50
|
if (fs.existsSync(keyPath)) {
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs `vite build` and packs a deployable ./app: the build, package.json and an index.js server
|
|
3
|
+
* (templates/build.ts). `withStorage` adds ./storage, `withStatic` ./static, `withEnv` a
|
|
4
|
+
* production .env. Prints the commands to run next.
|
|
5
|
+
*/
|
|
1
6
|
export declare const build: (args: {
|
|
2
7
|
withEnv?: boolean;
|
|
3
8
|
withStatic?: boolean;
|
|
@@ -24,6 +24,11 @@ const installCommands = {
|
|
|
24
24
|
runEnv: 'bunx rime env'
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Runs `vite build` and packs a deployable ./app: the build, package.json and an index.js server
|
|
29
|
+
* (templates/build.ts). `withStorage` adds ./storage, `withStatic` ./static, `withEnv` a
|
|
30
|
+
* production .env. Prints the commands to run next.
|
|
31
|
+
*/
|
|
27
32
|
export const build = async (args) => {
|
|
28
33
|
const bun = usesBunScripts();
|
|
29
34
|
// -w ships the database: refused while the adapter asks for a step first, `rime db:move` for a
|
|
@@ -52,6 +57,11 @@ export const build = async (args) => {
|
|
|
52
57
|
process.exitCode = 1;
|
|
53
58
|
return;
|
|
54
59
|
}
|
|
60
|
+
if (!existsSync('./build')) {
|
|
61
|
+
logger.error('[✗] ./build not found: the SvelteKit adapter writes elsewhere, nothing packaged');
|
|
62
|
+
process.exitCode = 1;
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
55
65
|
// Create app directory
|
|
56
66
|
mkdirSync('./app', { recursive: true });
|
|
57
67
|
// Move build folder
|
|
@@ -71,8 +81,13 @@ export const build = async (args) => {
|
|
|
71
81
|
}
|
|
72
82
|
}
|
|
73
83
|
if (args.withStatic) {
|
|
74
|
-
|
|
75
|
-
|
|
84
|
+
if (existsSync('./static')) {
|
|
85
|
+
cpSync('./static', './app/static', { recursive: true });
|
|
86
|
+
logger.debug('[✓] static directory copied');
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
logger.warn('No static directory to copy (skip)');
|
|
90
|
+
}
|
|
76
91
|
}
|
|
77
92
|
// Create main entry server file
|
|
78
93
|
writeFileSync('./app/index.js', nodeServer);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* `rime clear`: removes the database adapter's files, then everything rime generated or keeps for
|
|
3
3
|
* itself. Loads no config: the adapter's hooks come from the module `rime init` or the last dev
|
|
4
4
|
* boot recorded in `node_modules/.rime`, else from the default adapter's, as after a fresh install.
|
|
5
|
+
* Asks first, with the list above, unless `force`.
|
|
5
6
|
*/
|
|
6
7
|
export declare const clear: (args: {
|
|
7
8
|
force?: boolean;
|
|
@@ -7,7 +7,7 @@ import path from 'node:path';
|
|
|
7
7
|
import { CONFIG_DIR, GENERATED_DIR } from '../../constants.server.js';
|
|
8
8
|
import { importAdapterHooks, recordedHooksModule } from '../util/adapter-hooks.server.js';
|
|
9
9
|
import { prompt } from '../util/prompt.server.js';
|
|
10
|
-
const clearMessage = `Are you sure you want to delete all related rime files
|
|
10
|
+
const clearMessage = `Are you sure you want to delete all related rime files:
|
|
11
11
|
- the files of the database adapter
|
|
12
12
|
- ./storage/uploads
|
|
13
13
|
- ./src/routes/(rime)
|
|
@@ -23,11 +23,12 @@ const clearMessage = `Are you sure you want to delete all related rime files (Y/
|
|
|
23
23
|
* `rime clear`: removes the database adapter's files, then everything rime generated or keeps for
|
|
24
24
|
* itself. Loads no config: the adapter's hooks come from the module `rime init` or the last dev
|
|
25
25
|
* boot recorded in `node_modules/.rime`, else from the default adapter's, as after a fresh install.
|
|
26
|
+
* Asks first, with the list above, unless `force`.
|
|
26
27
|
*/
|
|
27
28
|
export const clear = async (args) => {
|
|
28
29
|
let shouldProceed = true;
|
|
29
30
|
if (!args.force) {
|
|
30
|
-
const response = await prompt(`${clearMessage}
|
|
31
|
+
const response = await prompt(`${clearMessage}(y/N)`, 'n');
|
|
31
32
|
shouldProceed = response.trim().toLowerCase() === 'y';
|
|
32
33
|
}
|
|
33
34
|
if (!shouldProceed) {
|
|
@@ -113,6 +113,27 @@ function rewriteSpecifiers(distDir, pkgName, pairs) {
|
|
|
113
113
|
fs.writeFileSync(file, rewritten);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* Whether an `exports` entry has the shape this command writes: `./X/module` pointing, through
|
|
118
|
+
* `types`, `browser` and `default` alone, at module files of `./dist/X/`.
|
|
119
|
+
*
|
|
120
|
+
* ```jsonc
|
|
121
|
+
* "./ui/module": { "browser": "./dist/ui/module.js", "default": "./dist/ui/module.server.js" } // written
|
|
122
|
+
* "./widgets/module": { "default": "./dist/ui/widgets/module.js" } // the author's alias
|
|
123
|
+
* "./widgets/module": "./src/widgets/module.js" // the author's
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
function isWritten(key, value) {
|
|
127
|
+
const subpath = key.match(/^\.\/(.+)\/module$/)?.[1];
|
|
128
|
+
if (!subpath || typeof value !== 'object' || value === null || !('default' in value)) {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
const dir = './' + path.posix.join('dist', subpath);
|
|
132
|
+
return Object.entries(value).every(([condition, target]) => ['types', 'browser', 'default'].includes(condition) &&
|
|
133
|
+
typeof target === 'string' &&
|
|
134
|
+
path.posix.dirname(target) === dir &&
|
|
135
|
+
/^module(\.server|\.browser)?\.(js|ts|d\.ts)$/.test(path.posix.basename(target)));
|
|
136
|
+
}
|
|
116
137
|
/**
|
|
117
138
|
* One `exports` entry per pair, plus a `default` for every other entry that lacks one: an entry
|
|
118
139
|
* with no `default` fails to resolve through the map.
|
|
@@ -121,10 +142,10 @@ function writeExports(root, distDir, pairs, stubs) {
|
|
|
121
142
|
const pkgPath = path.join(root, 'package.json');
|
|
122
143
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
123
144
|
const exportsMap = pkg.exports ?? {};
|
|
124
|
-
// Idempotent:
|
|
125
|
-
//
|
|
126
|
-
for (const key of Object.
|
|
127
|
-
if (key
|
|
145
|
+
// Idempotent: the entries a previous run wrote go, so a pair that disappeared leaves none
|
|
146
|
+
// behind. The author's own `/module` entries stay.
|
|
147
|
+
for (const [key, value] of Object.entries(exportsMap)) {
|
|
148
|
+
if (isWritten(key, value))
|
|
128
149
|
delete exportsMap[key];
|
|
129
150
|
}
|
|
130
151
|
for (const [subpath, entry] of pairs) {
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sanitizes the config, writes the modules declaration, then loads the config once in a
|
|
3
|
+
* throwaway Vite server, which runs codegen: routes, schema, types. `force` first empties
|
|
4
|
+
* node_modules/.rime and src/routes/(rime).
|
|
5
|
+
*/
|
|
1
6
|
export declare const generate: (args: {
|
|
2
7
|
force?: boolean;
|
|
3
8
|
}) => Promise<void>;
|
|
@@ -7,6 +7,11 @@ import { logger } from '../../../logger.server.js';
|
|
|
7
7
|
import { trycatch } from '../../../../util/function.js';
|
|
8
8
|
import { mkdirSync, rmSync } from 'fs';
|
|
9
9
|
import path from 'path';
|
|
10
|
+
/**
|
|
11
|
+
* Sanitizes the config, writes the modules declaration, then loads the config once in a
|
|
12
|
+
* throwaway Vite server, which runs codegen: routes, schema, types. `force` first empties
|
|
13
|
+
* node_modules/.rime and src/routes/(rime).
|
|
14
|
+
*/
|
|
10
15
|
export const generate = async (args) => {
|
|
11
16
|
const { force } = args;
|
|
12
17
|
/**
|
|
@@ -21,7 +26,7 @@ export const generate = async (args) => {
|
|
|
21
26
|
logger.error(err.message);
|
|
22
27
|
}
|
|
23
28
|
}
|
|
24
|
-
|
|
29
|
+
/**
|
|
25
30
|
* Delete routes/(rime) folder
|
|
26
31
|
*/
|
|
27
32
|
function clearRoutes() {
|
|
@@ -32,12 +37,6 @@ export const generate = async (args) => {
|
|
|
32
37
|
logger.error(err.message);
|
|
33
38
|
}
|
|
34
39
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Sanitize the user config into GENERATED_DIR (`src/+rime.generated` by default)
|
|
37
|
-
*/
|
|
38
|
-
async function sanitizeConfig() {
|
|
39
|
-
await sanitize();
|
|
40
|
-
}
|
|
41
40
|
/**
|
|
42
41
|
* Create the vite devServer
|
|
43
42
|
*/
|
|
@@ -74,7 +73,7 @@ export const generate = async (args) => {
|
|
|
74
73
|
cache.set('.cli', `${process.pid} ${Date.now()}`);
|
|
75
74
|
try {
|
|
76
75
|
ensureUserConfigExist();
|
|
77
|
-
await
|
|
76
|
+
await sanitize();
|
|
78
77
|
// Normal `vite dev` writes this from `configureServer`'s `listening` event, which never
|
|
79
78
|
// fires here — this command's own Vite server runs in `middlewareMode` (no `httpServer`).
|
|
80
79
|
regenerateModulesDeclaration();
|
|
@@ -6,5 +6,12 @@ type Args = {
|
|
|
6
6
|
/** The database adapter: `sqlite`, or a package with a `hooks` entry. */
|
|
7
7
|
adapter?: string;
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* `rime init`: sets a SvelteKit app up for rime. Writes .env, src/env.ts and the .gitignore
|
|
11
|
+
* entries, records the database adapter and lets it write its own files, then writes the config,
|
|
12
|
+
* the Bun scripts (with `bun`), adapter-node and the Vite plugin. Installs the dependencies unless
|
|
13
|
+
* `skipInstall`, then runs `generate({ force: true })`. `name` names the database; without it the
|
|
14
|
+
* package name is used, asked for unless `force`.
|
|
15
|
+
*/
|
|
9
16
|
export declare const init: ({ force, name: incomingName, skipInstall, bun, adapter: adapterName }: Args) => Promise<void>;
|
|
10
17
|
export {};
|