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
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
|
17
17
|
--rz-font-mono: 'geist-mono', Consolas, Liberation Mono, Menlo, Courier, monospace;
|
|
18
18
|
|
|
19
|
-
/* 13px body, one pixel a step around it, then
|
|
19
|
+
/* 13px body, one pixel a step around it, then wider steps for titles. */
|
|
20
20
|
--rz-text-2xs: 0.625rem;
|
|
21
21
|
--rz-text-xs: 0.6875rem;
|
|
22
22
|
--rz-text-sm: 0.75rem;
|
|
@@ -447,6 +447,7 @@ video {
|
|
|
447
447
|
--rz-size-72: 18rem;
|
|
448
448
|
--rz-size-80: 20rem;
|
|
449
449
|
|
|
450
|
+
/* Widths: containers, dialogs and breakpoints. */
|
|
450
451
|
--rz-size-xs: 20rem;
|
|
451
452
|
--rz-size-sm: 24rem;
|
|
452
453
|
--rz-size-md: 28rem;
|
|
@@ -474,7 +475,7 @@ video {
|
|
|
474
475
|
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
|
|
475
476
|
--rz-font-mono: 'geist-mono', Consolas, Liberation Mono, Menlo, Courier, monospace;
|
|
476
477
|
|
|
477
|
-
/* 13px body, one pixel a step around it, then
|
|
478
|
+
/* 13px body, one pixel a step around it, then wider steps for titles. */
|
|
478
479
|
--rz-text-2xs: 0.625rem;
|
|
479
480
|
--rz-text-xs: 0.6875rem;
|
|
480
481
|
--rz-text-sm: 0.75rem;
|
|
@@ -500,9 +501,27 @@ video {
|
|
|
500
501
|
--rz-radius-full: 999999px;
|
|
501
502
|
}
|
|
502
503
|
|
|
504
|
+
/*
|
|
505
|
+
* The panel's stacking levels, low to high. Each open modal, sheet or dialog, takes the next level
|
|
506
|
+
* up from `--rz-z-modal` in the order it opened (ui/layer/layer.svelte.ts):
|
|
507
|
+
*
|
|
508
|
+
* a sheet 1010
|
|
509
|
+
* the palette over it 1011
|
|
510
|
+
* a confirm dialog on top 1012
|
|
511
|
+
*
|
|
512
|
+
* A tooltip sits over the page and the sidebar, under the modals. A menu sits over every open
|
|
513
|
+
* modal, a popover over the menu it opens from, and a toast over everything.
|
|
514
|
+
*/
|
|
515
|
+
:root {
|
|
516
|
+
--rz-z-tooltip: 400;
|
|
517
|
+
--rz-z-modal: 1010;
|
|
518
|
+
--rz-z-menu: 1100;
|
|
519
|
+
--rz-z-popover: 500000;
|
|
520
|
+
--rz-z-toast: 999999999;
|
|
521
|
+
}
|
|
503
522
|
/*
|
|
504
523
|
* The palette: grays and an accent in OKLCH, set by four numbers. 0 is the darkest gray.
|
|
505
|
-
*
|
|
524
|
+
* scheme.css turns it into light and dark tokens; the accent and status colors are also read as is.
|
|
506
525
|
*/
|
|
507
526
|
:root {
|
|
508
527
|
--rz-gray-hue: 0;
|
|
@@ -628,10 +647,6 @@ video {
|
|
|
628
647
|
}
|
|
629
648
|
}
|
|
630
649
|
|
|
631
|
-
.uz-upper {
|
|
632
|
-
text-transform: uppercase;
|
|
633
|
-
}
|
|
634
|
-
|
|
635
650
|
:root {
|
|
636
651
|
--rz-input-height: var(--rz-size-9);
|
|
637
652
|
--rz-row-height: var(--rz-size-10);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* The palette: grays and an accent in OKLCH, set by four numbers. 0 is the darkest gray.
|
|
3
|
-
*
|
|
3
|
+
* scheme.css turns it into light and dark tokens; the accent and status colors are also read as is.
|
|
4
4
|
*/
|
|
5
5
|
:root {
|
|
6
6
|
--rz-gray-hue: 0;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The panel's stacking levels, low to high. Each open modal, sheet or dialog, takes the next level
|
|
3
|
+
* up from `--rz-z-modal` in the order it opened (ui/layer/layer.svelte.ts):
|
|
4
|
+
*
|
|
5
|
+
* a sheet 1010
|
|
6
|
+
* the palette over it 1011
|
|
7
|
+
* a confirm dialog on top 1012
|
|
8
|
+
*
|
|
9
|
+
* A tooltip sits over the page and the sidebar, under the modals. A menu sits over every open
|
|
10
|
+
* modal, a popover over the menu it opens from, and a toast over everything.
|
|
11
|
+
*/
|
|
12
|
+
:root {
|
|
13
|
+
--rz-z-tooltip: 400;
|
|
14
|
+
--rz-z-modal: 1010;
|
|
15
|
+
--rz-z-menu: 1100;
|
|
16
|
+
--rz-z-popover: 500000;
|
|
17
|
+
--rz-z-toast: 999999999;
|
|
18
|
+
}
|
package/dist/panel/types.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import Sortable from 'sortablejs';
|
|
2
2
|
import type SortableType from 'sortablejs';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* A Svelte action over SortableJS, `use:sortable`. After a drop the DOM is put back as it was, so
|
|
5
|
+
* the caller's `onEnd` moves its own state and Svelte redraws. A drop in place does not call
|
|
6
|
+
* `onEnd`: a caller that marks "sorting" resets it in `onUnchoose`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useSortable: (sortableProps: SortableType.Options) => {
|
|
4
9
|
sortable: (el: HTMLElement) => Sortable;
|
|
5
10
|
};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import Sortable from 'sortablejs';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* A Svelte action over SortableJS, `use:sortable`. After a drop the DOM is put back as it was, so
|
|
4
|
+
* the caller's `onEnd` moves its own state and Svelte redraws. A drop in place does not call
|
|
5
|
+
* `onEnd`: a caller that marks "sorting" resets it in `onUnchoose`.
|
|
6
|
+
*/
|
|
7
|
+
export const useSortable = (sortableProps) => {
|
|
3
8
|
const sortable = (el) => {
|
|
4
9
|
let childNodes = [];
|
|
5
10
|
let from = null;
|
|
@@ -1,2 +1,20 @@
|
|
|
1
1
|
import { createAuthClient } from 'better-auth/svelte';
|
|
2
|
+
/**
|
|
3
|
+
* better-auth's browser client on `SITE_URL`: the panel signs out and asks for password resets
|
|
4
|
+
* with it.
|
|
5
|
+
*/
|
|
2
6
|
export declare const authClient: ReturnType<typeof createAuthClient>;
|
|
7
|
+
/**
|
|
8
|
+
* Sends one better-auth request and answers its data, or `null` once an error toast says what
|
|
9
|
+
* went wrong in the panel's language. A request that fails on the network answers `null` too.
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* const answer = await authRequest(() => authClient.requestPasswordReset({ email, redirectTo }));
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare const authRequest: <T>(send: () => Promise<{
|
|
16
|
+
data: T | null;
|
|
17
|
+
error: {
|
|
18
|
+
code?: string;
|
|
19
|
+
} | null;
|
|
20
|
+
}>) => Promise<T | null>;
|
package/dist/panel/util/auth.js
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
import { SITE_URL } from '$app/env/public';
|
|
2
|
+
import { t__ } from '../../core/i18n/index.js';
|
|
3
|
+
import { trycatch } from '../../util/function.js';
|
|
2
4
|
import { createAuthClient } from 'better-auth/svelte';
|
|
5
|
+
import { toast } from 'svelte-sonner';
|
|
6
|
+
/**
|
|
7
|
+
* better-auth's browser client on `SITE_URL`: the panel signs out and asks for password resets
|
|
8
|
+
* with it.
|
|
9
|
+
*/
|
|
3
10
|
export const authClient = createAuthClient({
|
|
4
11
|
baseURL: SITE_URL
|
|
5
12
|
});
|
|
13
|
+
/**
|
|
14
|
+
* Sends one better-auth request and answers its data, or `null` once an error toast says what
|
|
15
|
+
* went wrong in the panel's language. A request that fails on the network answers `null` too.
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* const answer = await authRequest(() => authClient.requestPasswordReset({ email, redirectTo }));
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export const authRequest = async (send) => {
|
|
22
|
+
const [failure, answer] = await trycatch(send);
|
|
23
|
+
if (failure || answer.error) {
|
|
24
|
+
// An expired or reused reset link is the one failure a reader can act on
|
|
25
|
+
const invalidLink = answer?.error?.code === 'INVALID_TOKEN';
|
|
26
|
+
toast.error(invalidLink ? t__('common.reset_link_invalid') : t__('common.generic_error'));
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
return answer.data;
|
|
30
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { BuiltCollection } from '../../core/config/types.js';
|
|
2
|
+
import type { GenericDoc } from '../../core/prototype/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The reads of the document pickers: their saved picks, the documents they offer and how many.
|
|
5
|
+
* Each goes through the API proxy, so a save's `invalidate` refreshes it and a locale switch reads
|
|
6
|
+
* it anew. Called while the component initialises: they read the API proxy's context.
|
|
7
|
+
*/
|
|
8
|
+
/** The most documents a search lists. */
|
|
9
|
+
export declare const SEARCH_LIMIT = 20;
|
|
10
|
+
export type PickerWhere = {
|
|
11
|
+
config: Pick<BuiltCollection, 'kebab' | 'asTitle'>;
|
|
12
|
+
/** The picker's own query string, `where[mimeType][like]=image%`, or none. */
|
|
13
|
+
query?: string;
|
|
14
|
+
/** The ids left out: the picks. */
|
|
15
|
+
exclude?: string[];
|
|
16
|
+
/** Only the documents whose title holds this text. */
|
|
17
|
+
search?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The saved picks: every id at once, sorted, so a new order of the same picks reads nothing.
|
|
21
|
+
*
|
|
22
|
+
* ```ts
|
|
23
|
+
* picksURL(targets, ['b', 'a'])
|
|
24
|
+
* // /api/targets?where[id][in_array][0]=a&where[id][in_array][1]=b&depth=1, brackets encoded
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare const picksURL: (config: PickerWhere["config"], ids: string[]) => string;
|
|
28
|
+
/** The first `SEARCH_LIMIT` documents the picker offers; a live form reads them at depth 1. */
|
|
29
|
+
export declare const candidatesURL: (where: PickerWhere, depth?: number) => string;
|
|
30
|
+
/** How many documents the picker could offer, through the collection's count route. */
|
|
31
|
+
export declare const countURL: (where: PickerWhere) => string;
|
|
32
|
+
/**
|
|
33
|
+
* `limit` documents from `offset`, in `sort` order: one step of a list read in steps.
|
|
34
|
+
*
|
|
35
|
+
* ```ts
|
|
36
|
+
* const children = { config: pages, query: 'where[_parent][equals]=blog' };
|
|
37
|
+
* pageURL(children, { sort: '_position', limit: 20, offset: 20 })
|
|
38
|
+
* // /api/pages?where[and][0][_parent][equals]=blog&sort=_position&limit=20&offset=20,
|
|
39
|
+
* // brackets encoded
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare const pageURL: (where: PickerWhere, page: {
|
|
43
|
+
sort: string;
|
|
44
|
+
limit: number;
|
|
45
|
+
offset: number;
|
|
46
|
+
}) => string;
|
|
47
|
+
/**
|
|
48
|
+
* Reads `url` through the API proxy while it is set. While a new url loads, `data` keeps the last
|
|
49
|
+
* answer, so a list or a count does not blank between two reads. A search's read leaves the cache
|
|
50
|
+
* once the search changes or the picker closes, so past searches are not refreshed for the page's
|
|
51
|
+
* life.
|
|
52
|
+
*
|
|
53
|
+
* ```ts
|
|
54
|
+
* const area = useRead<{ doc: GenericDoc }>(() => ({ url: apiUrl('settings') }));
|
|
55
|
+
* area.data?.doc;
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function useRead<T>(read: () => {
|
|
59
|
+
url: string | null;
|
|
60
|
+
search?: string;
|
|
61
|
+
}): {
|
|
62
|
+
/** The answer, the last one while a new url loads; `null` when the read failed. */
|
|
63
|
+
readonly data: T | null;
|
|
64
|
+
/** The read of the current url has answered, or failed. */
|
|
65
|
+
readonly answered: boolean;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* A collection's documents by id, in the order of `ids`. Until the read answers, a pick is drawn
|
|
69
|
+
* from the last answer or from `known`, the docs the picker holds: picked from a list, uploaded or
|
|
70
|
+
* just created. Once the read answers, its docs alone are drawn, so a save's `invalidate` stays
|
|
71
|
+
* the source of truth.
|
|
72
|
+
*
|
|
73
|
+
* ```ts
|
|
74
|
+
* const picks = usePicks(() => ({ config, ids: ['a', 'b'], known: [b] }));
|
|
75
|
+
* picks.docs; // [b] at once, [a, b] once read
|
|
76
|
+
* picks.ready; // the read has answered
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export declare function usePicks(options: () => {
|
|
80
|
+
config: PickerWhere['config'];
|
|
81
|
+
ids: string[];
|
|
82
|
+
known?: GenericDoc[];
|
|
83
|
+
}): {
|
|
84
|
+
/** The docs in the order of `ids`; one that cannot be read is left out. */
|
|
85
|
+
readonly docs: GenericDoc[];
|
|
86
|
+
readonly ready: boolean;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* How many documents match, read while `open`.
|
|
90
|
+
*
|
|
91
|
+
* ```ts
|
|
92
|
+
* const left = useCount(() => ({ open: true, config, exclude: ['a'] }));
|
|
93
|
+
* left.count; // null until the read answers
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export declare function useCount(options: () => PickerWhere & {
|
|
97
|
+
open: boolean;
|
|
98
|
+
}): {
|
|
99
|
+
readonly count: number | null;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* The documents a picker offers, read while it is open: the first `SEARCH_LIMIT` whose title holds
|
|
103
|
+
* the search once typing pauses, and how many match in all.
|
|
104
|
+
*
|
|
105
|
+
* ```ts
|
|
106
|
+
* const found = useCandidates(() => ({ open, config, search }));
|
|
107
|
+
* found.docs; // the first 20, null until the read answers
|
|
108
|
+
* found.count; // 143
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export declare function useCandidates(options: () => PickerWhere & {
|
|
112
|
+
open: boolean;
|
|
113
|
+
search: string;
|
|
114
|
+
depth?: number;
|
|
115
|
+
}): {
|
|
116
|
+
readonly docs: GenericDoc[] | null;
|
|
117
|
+
readonly count: number | null;
|
|
118
|
+
};
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { apiUrl } from '../../core/routes/util.js';
|
|
2
|
+
import { getAPIProxyContext } from '../context/api-proxy.svelte.js';
|
|
3
|
+
import qs from 'qs';
|
|
4
|
+
/**
|
|
5
|
+
* The reads of the document pickers: their saved picks, the documents they offer and how many.
|
|
6
|
+
* Each goes through the API proxy, so a save's `invalidate` refreshes it and a locale switch reads
|
|
7
|
+
* it anew. Called while the component initialises: they read the API proxy's context.
|
|
8
|
+
*/
|
|
9
|
+
/** The most documents a search lists. */
|
|
10
|
+
export const SEARCH_LIMIT = 20;
|
|
11
|
+
/** The pause in typing before a search is read. */
|
|
12
|
+
const SEARCH_PAUSE = 250;
|
|
13
|
+
/** The `where` of a picker's reads: its query, the picks left out, the title search. */
|
|
14
|
+
function whereOf({ config, query = '', exclude = [], search }) {
|
|
15
|
+
const and = [
|
|
16
|
+
qs.parse(query).where,
|
|
17
|
+
exclude.length && { id: { not_in_array: exclude } },
|
|
18
|
+
search && { [config.asTitle]: { like: `%${search}%` } }
|
|
19
|
+
].filter(Boolean);
|
|
20
|
+
return and.length ? { and } : undefined;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The saved picks: every id at once, sorted, so a new order of the same picks reads nothing.
|
|
24
|
+
*
|
|
25
|
+
* ```ts
|
|
26
|
+
* picksURL(targets, ['b', 'a'])
|
|
27
|
+
* // /api/targets?where[id][in_array][0]=a&where[id][in_array][1]=b&depth=1, brackets encoded
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export const picksURL = (config, ids) => {
|
|
31
|
+
const where = { id: { in_array: [...ids].sort() } };
|
|
32
|
+
return `${apiUrl(config.kebab)}?${qs.stringify({ where, depth: 1 })}`;
|
|
33
|
+
};
|
|
34
|
+
/** The first `SEARCH_LIMIT` documents the picker offers; a live form reads them at depth 1. */
|
|
35
|
+
export const candidatesURL = (where, depth) => {
|
|
36
|
+
const params = qs.stringify({ where: whereOf(where), limit: SEARCH_LIMIT, depth });
|
|
37
|
+
return `${apiUrl(where.config.kebab)}?${params}`;
|
|
38
|
+
};
|
|
39
|
+
/** How many documents the picker could offer, through the collection's count route. */
|
|
40
|
+
export const countURL = (where) => {
|
|
41
|
+
const params = qs.stringify({ where: whereOf(where) });
|
|
42
|
+
return `${apiUrl(where.config.kebab)}/count${params ? `?${params}` : ''}`;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* `limit` documents from `offset`, in `sort` order: one step of a list read in steps.
|
|
46
|
+
*
|
|
47
|
+
* ```ts
|
|
48
|
+
* const children = { config: pages, query: 'where[_parent][equals]=blog' };
|
|
49
|
+
* pageURL(children, { sort: '_position', limit: 20, offset: 20 })
|
|
50
|
+
* // /api/pages?where[and][0][_parent][equals]=blog&sort=_position&limit=20&offset=20,
|
|
51
|
+
* // brackets encoded
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export const pageURL = (where, page) => `${apiUrl(where.config.kebab)}?${qs.stringify({ where: whereOf(where), ...page })}`;
|
|
55
|
+
/**
|
|
56
|
+
* Reads `url` through the API proxy while it is set. While a new url loads, `data` keeps the last
|
|
57
|
+
* answer, so a list or a count does not blank between two reads. A search's read leaves the cache
|
|
58
|
+
* once the search changes or the picker closes, so past searches are not refreshed for the page's
|
|
59
|
+
* life.
|
|
60
|
+
*
|
|
61
|
+
* ```ts
|
|
62
|
+
* const area = useRead<{ doc: GenericDoc }>(() => ({ url: apiUrl('settings') }));
|
|
63
|
+
* area.data?.doc;
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export function useRead(read) {
|
|
67
|
+
const APIProxy = getAPIProxyContext();
|
|
68
|
+
// A string and a boolean: the resource changes only when the url does
|
|
69
|
+
const url = $derived(read().url);
|
|
70
|
+
const searched = $derived(!!read().search);
|
|
71
|
+
const resource = $derived(url ? APIProxy.getRessource(url) : null);
|
|
72
|
+
let last = $state.raw(null);
|
|
73
|
+
$effect(() => {
|
|
74
|
+
if (resource?.data)
|
|
75
|
+
last = resource.data;
|
|
76
|
+
});
|
|
77
|
+
$effect(() => {
|
|
78
|
+
if (!url || !searched)
|
|
79
|
+
return;
|
|
80
|
+
const current = url;
|
|
81
|
+
return () => APIProxy.drop(current);
|
|
82
|
+
});
|
|
83
|
+
return {
|
|
84
|
+
/** The answer, the last one while a new url loads; `null` when the read failed. */
|
|
85
|
+
get data() {
|
|
86
|
+
if (!resource)
|
|
87
|
+
return null;
|
|
88
|
+
return resource.data ?? (resource.isLoading ? last : null);
|
|
89
|
+
},
|
|
90
|
+
/** The read of the current url has answered, or failed. */
|
|
91
|
+
get answered() {
|
|
92
|
+
return !!resource && !resource.isLoading;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* A collection's documents by id, in the order of `ids`. Until the read answers, a pick is drawn
|
|
98
|
+
* from the last answer or from `known`, the docs the picker holds: picked from a list, uploaded or
|
|
99
|
+
* just created. Once the read answers, its docs alone are drawn, so a save's `invalidate` stays
|
|
100
|
+
* the source of truth.
|
|
101
|
+
*
|
|
102
|
+
* ```ts
|
|
103
|
+
* const picks = usePicks(() => ({ config, ids: ['a', 'b'], known: [b] }));
|
|
104
|
+
* picks.docs; // [b] at once, [a, b] once read
|
|
105
|
+
* picks.ready; // the read has answered
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export function usePicks(options) {
|
|
109
|
+
const read = useRead(() => {
|
|
110
|
+
const { config, ids } = options();
|
|
111
|
+
return { url: ids.length ? picksURL(config, ids) : null };
|
|
112
|
+
});
|
|
113
|
+
return {
|
|
114
|
+
/** The docs in the order of `ids`; one that cannot be read is left out. */
|
|
115
|
+
get docs() {
|
|
116
|
+
const { ids, known = [] } = options();
|
|
117
|
+
const answer = read.data?.docs ?? [];
|
|
118
|
+
const held = read.answered ? answer : [...answer, ...known];
|
|
119
|
+
return ids.flatMap((id) => held.find((doc) => doc.id === id) ?? []);
|
|
120
|
+
},
|
|
121
|
+
get ready() {
|
|
122
|
+
return !options().ids.length || read.answered;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* How many documents match, read while `open`.
|
|
128
|
+
*
|
|
129
|
+
* ```ts
|
|
130
|
+
* const left = useCount(() => ({ open: true, config, exclude: ['a'] }));
|
|
131
|
+
* left.count; // null until the read answers
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
export function useCount(options) {
|
|
135
|
+
const read = useRead(() => {
|
|
136
|
+
const { open, ...where } = options();
|
|
137
|
+
return { url: open ? countURL(where) : null, search: where.search };
|
|
138
|
+
});
|
|
139
|
+
return {
|
|
140
|
+
get count() {
|
|
141
|
+
return read.data?.count ?? null;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* The documents a picker offers, read while it is open: the first `SEARCH_LIMIT` whose title holds
|
|
147
|
+
* the search once typing pauses, and how many match in all.
|
|
148
|
+
*
|
|
149
|
+
* ```ts
|
|
150
|
+
* const found = useCandidates(() => ({ open, config, search }));
|
|
151
|
+
* found.docs; // the first 20, null until the read answers
|
|
152
|
+
* found.count; // 143
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
export function useCandidates(options) {
|
|
156
|
+
/** The search once typing pauses. */
|
|
157
|
+
let text = $state('');
|
|
158
|
+
$effect(() => {
|
|
159
|
+
const value = options().search.trim();
|
|
160
|
+
const timer = setTimeout(() => (text = value), SEARCH_PAUSE);
|
|
161
|
+
return () => clearTimeout(timer);
|
|
162
|
+
});
|
|
163
|
+
const read = useRead(() => {
|
|
164
|
+
const { open, depth, ...where } = options();
|
|
165
|
+
return { url: open ? candidatesURL({ ...where, search: text }, depth) : null, search: text };
|
|
166
|
+
});
|
|
167
|
+
const total = useCount(() => ({ ...options(), search: text }));
|
|
168
|
+
return {
|
|
169
|
+
get docs() {
|
|
170
|
+
return read.data?.docs ?? null;
|
|
171
|
+
},
|
|
172
|
+
get count() {
|
|
173
|
+
return total.count;
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** The key with the plural modifiers past one: `common.x` for 1, `common.x|m|p` for 2. */
|
|
2
|
+
export declare const byCount: (key: string, count: number) => string;
|
|
3
|
+
/**
|
|
4
|
+
* A count in words, singular for one.
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* counted('common.collection_count_drafts', 3); // '3 drafts'
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
10
|
+
export declare const counted: (key: string, count: number) => string;
|
|
11
|
+
/**
|
|
12
|
+
* A collection's documents in words: files in an upload collection.
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* documentsCounted(24, false); // '24 documents'
|
|
16
|
+
* documentsCounted(1, true); // '1 file'
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const documentsCounted: (count: number, isUpload: boolean) => string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { t__ } from '../../core/i18n/index.js';
|
|
2
|
+
/** The key with the plural modifiers past one: `common.x` for 1, `common.x|m|p` for 2. */
|
|
3
|
+
export const byCount = (key, count) => (count === 1 ? key : `${key}|m|p`);
|
|
4
|
+
/**
|
|
5
|
+
* A count in words, singular for one.
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* counted('common.collection_count_drafts', 3); // '3 drafts'
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export const counted = (key, count) => t__(byCount(key, count), String(count));
|
|
12
|
+
/**
|
|
13
|
+
* A collection's documents in words: files in an upload collection.
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* documentsCounted(24, false); // '24 documents'
|
|
17
|
+
* documentsCounted(1, true); // '1 file'
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export const documentsCounted = (count, isUpload) => counted(isUpload ? 'common.collection_count_files' : 'common.collection_count', count);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The browser's localStorage, guarded: where site data is blocked, or on a server, a read
|
|
3
|
+
* answers null and a write keeps nothing.
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* writeStored('rz-panel-collapsed', 'true');
|
|
7
|
+
* readStored('rz-panel-collapsed'); // 'true', or null where storage is blocked
|
|
8
|
+
* writeStored('rz-open:abc', null); // removes the key
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare const readStored: (key: string) => string | null;
|
|
12
|
+
/** Keeps `value` under `key`, or removes the key for `null`. */
|
|
13
|
+
export declare const writeStored: (key: string, value: string | null) => void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The browser's localStorage, guarded: where site data is blocked, or on a server, a read
|
|
3
|
+
* answers null and a write keeps nothing.
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* writeStored('rz-panel-collapsed', 'true');
|
|
7
|
+
* readStored('rz-panel-collapsed'); // 'true', or null where storage is blocked
|
|
8
|
+
* writeStored('rz-open:abc', null); // removes the key
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export const readStored = (key) => {
|
|
12
|
+
// Node 25+ warns on any read of its own `localStorage`: a server reads nothing
|
|
13
|
+
if (typeof window === 'undefined')
|
|
14
|
+
return null;
|
|
15
|
+
try {
|
|
16
|
+
return localStorage.getItem(key);
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
/** Keeps `value` under `key`, or removes the key for `null`. */
|
|
23
|
+
export const writeStored = (key, value) => {
|
|
24
|
+
if (typeof window === 'undefined')
|
|
25
|
+
return;
|
|
26
|
+
try {
|
|
27
|
+
if (value === null) {
|
|
28
|
+
localStorage.removeItem(key);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
localStorage.setItem(key, value);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// Storage blocked: the choice holds for the visit, it is just not remembered
|
|
36
|
+
}
|
|
37
|
+
};
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { type Translate } from '../../core/i18n/index.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Whether `formatWhen` writes `date` relative to `now`, `2 h ago` or `Yesterday`, rather than as
|
|
4
|
+
* a date: within 7 calendar days.
|
|
5
|
+
*/
|
|
6
|
+
export declare const isRelative: (date: Date | string, now: Date) => boolean;
|
|
7
|
+
/**
|
|
8
|
+
* How long ago a date was, short: relative within a week, the date after. Under 24 hours it
|
|
9
|
+
* counts hours; past that, calendar days. An invalid date reads as ''.
|
|
4
10
|
*
|
|
5
11
|
* ```ts
|
|
6
12
|
* formatWhen(twoHoursAgo, now, 'en') // '2 h ago'
|
package/dist/panel/util/time.js
CHANGED
|
@@ -2,9 +2,19 @@ import { t__ } from '../../core/i18n/index.js';
|
|
|
2
2
|
const MINUTE = 60;
|
|
3
3
|
const HOUR = 60 * MINUTE;
|
|
4
4
|
const DAY = 24 * HOUR;
|
|
5
|
-
|
|
5
|
+
/** Midnight of the day a date falls on, in milliseconds. */
|
|
6
|
+
const dayOf = (date) => new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
|
|
7
|
+
/** Calendar days from `then` to `now`. Math.round absorbs the hour a daylight-saving change adds
|
|
8
|
+
* or removes between the two midnights. */
|
|
9
|
+
const daysBetween = (then, now) => Math.round((dayOf(now) - dayOf(then)) / (DAY * 1000));
|
|
6
10
|
/**
|
|
7
|
-
*
|
|
11
|
+
* Whether `formatWhen` writes `date` relative to `now`, `2 h ago` or `Yesterday`, rather than as
|
|
12
|
+
* a date: within 7 calendar days.
|
|
13
|
+
*/
|
|
14
|
+
export const isRelative = (date, now) => daysBetween(new Date(date), now) < 7;
|
|
15
|
+
/**
|
|
16
|
+
* How long ago a date was, short: relative within a week, the date after. Under 24 hours it
|
|
17
|
+
* counts hours; past that, calendar days. An invalid date reads as ''.
|
|
8
18
|
*
|
|
9
19
|
* ```ts
|
|
10
20
|
* formatWhen(twoHoursAgo, now, 'en') // '2 h ago'
|
|
@@ -15,17 +25,21 @@ const WEEK = 7 * DAY;
|
|
|
15
25
|
*/
|
|
16
26
|
export function formatWhen(date, now, lang, t = t__) {
|
|
17
27
|
const then = new Date(date);
|
|
28
|
+
if (Number.isNaN(then.getTime()))
|
|
29
|
+
return '';
|
|
18
30
|
const seconds = Math.max(0, (now.getTime() - then.getTime()) / 1000);
|
|
31
|
+
const days = daysBetween(then, now);
|
|
19
32
|
if (seconds < MINUTE)
|
|
20
33
|
return t('common.time_now');
|
|
21
34
|
if (seconds < HOUR)
|
|
22
35
|
return t('common.time_minutes_ago', String(Math.floor(seconds / MINUTE)));
|
|
23
36
|
if (seconds < DAY)
|
|
24
37
|
return t('common.time_hours_ago', String(Math.floor(seconds / HOUR)));
|
|
25
|
-
|
|
38
|
+
// 0 on the 25-hour day of a daylight-saving change, 24 hours or more after its first hour
|
|
39
|
+
if (days <= 1)
|
|
26
40
|
return t('common.time_yesterday');
|
|
27
|
-
if (
|
|
28
|
-
return t('common.time_days_ago', String(
|
|
41
|
+
if (isRelative(then, now))
|
|
42
|
+
return t('common.time_days_ago', String(days));
|
|
29
43
|
const sameYear = then.getFullYear() === now.getFullYear();
|
|
30
44
|
return new Intl.DateTimeFormat(lang, {
|
|
31
45
|
day: 'numeric',
|