emdash 0.31.1 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adapters-C0ONzkUP.d.mts → adapters-BMyNSSZi.d.mts} +9 -1
- package/dist/adapters-BMyNSSZi.d.mts.map +1 -0
- package/dist/after-CBU2vkoO.mjs +96 -0
- package/dist/after-CBU2vkoO.mjs.map +1 -0
- package/dist/{allowed-origins-CCEi9bPI.mjs → allowed-origins-CG1pACtS.mjs} +2 -2
- package/dist/{allowed-origins-CCEi9bPI.mjs.map → allowed-origins-CG1pACtS.mjs.map} +1 -1
- package/dist/api/route-utils.d.mts +3 -4
- package/dist/api/route-utils.d.mts.map +1 -1
- package/dist/api/route-utils.mjs +23 -21
- package/dist/api/route-utils.mjs.map +1 -1
- package/dist/api/schemas/index.d.mts +2 -2
- package/dist/api/schemas/index.mjs +5 -5
- package/dist/{api-BkqFzIu4.mjs → api-D2hunekQ.mjs} +254 -48
- package/dist/api-D2hunekQ.mjs.map +1 -0
- package/dist/{api-tokens-uPt8UDpx.mjs → api-tokens-CSND0i1z.mjs} +2 -2
- package/dist/{api-tokens-uPt8UDpx.mjs.map → api-tokens-CSND0i1z.mjs.map} +1 -1
- package/dist/{apply-DuXsqll7.mjs → apply-kwNEJW2l.mjs} +36 -23
- package/dist/apply-kwNEJW2l.mjs.map +1 -0
- package/dist/astro/index.d.mts +12 -12
- package/dist/astro/index.mjs +17 -3
- package/dist/astro/index.mjs.map +1 -1
- package/dist/astro/middleware/auth.d.mts +10 -10
- package/dist/astro/middleware/auth.mjs +8 -8
- package/dist/astro/middleware/redirect.d.mts.map +1 -1
- package/dist/astro/middleware/redirect.mjs +8 -8
- package/dist/astro/middleware/redirect.mjs.map +1 -1
- package/dist/astro/middleware/request-context.mjs +4 -4
- package/dist/astro/middleware/setup.mjs +1 -1
- package/dist/astro/middleware.d.mts +10 -10
- package/dist/astro/middleware.d.mts.map +1 -1
- package/dist/astro/middleware.mjs +370 -171
- package/dist/astro/middleware.mjs.map +1 -1
- package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +7 -7
- package/dist/astro/routes/api/admin/allowed-domains/index.mjs +7 -7
- package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +4 -4
- package/dist/astro/routes/api/admin/api-tokens/index.mjs +5 -5
- package/dist/astro/routes/api/admin/byline-fields/_slug_/usage.mjs +5 -5
- package/dist/astro/routes/api/admin/byline-fields/_slug_.mjs +10 -10
- package/dist/astro/routes/api/admin/byline-fields/index.mjs +10 -10
- package/dist/astro/routes/api/admin/byline-fields/reorder.mjs +10 -10
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +19 -18
- package/dist/astro/routes/api/admin/bylines/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs +19 -18
- package/dist/astro/routes/api/admin/bylines/_id_/translations.mjs.map +1 -1
- package/dist/astro/routes/api/admin/bylines/index.mjs +19 -19
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs +16 -16
- package/dist/astro/routes/api/admin/comments/_id_/status.mjs.map +1 -1
- package/dist/astro/routes/api/admin/comments/_id_.mjs +7 -7
- package/dist/astro/routes/api/admin/comments/bulk.mjs +12 -12
- package/dist/astro/routes/api/admin/comments/counts.mjs +7 -7
- package/dist/astro/routes/api/admin/comments/index.mjs +12 -12
- package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +5 -5
- package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +4 -4
- package/dist/astro/routes/api/admin/media-usage/repair.mjs +13 -11
- package/dist/astro/routes/api/admin/media-usage/repair.mjs.map +1 -1
- package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +4 -4
- package/dist/astro/routes/api/admin/oauth-clients/index.mjs +4 -4
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +47 -44
- package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +47 -44
- package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +46 -43
- package/dist/astro/routes/api/admin/plugins/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/mcp.mjs +5 -5
- package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs +46 -43
- package/dist/astro/routes/api/admin/plugins/_id_/settings.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +46 -43
- package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +46 -43
- package/dist/astro/routes/api/admin/plugins/_id_/update.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/index.mjs +46 -43
- package/dist/astro/routes/api/admin/plugins/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +3 -3
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +46 -43
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +46 -43
- package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +46 -43
- package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs +46 -43
- package/dist/astro/routes/api/admin/plugins/registry/_id_/uninstall.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs +47 -44
- package/dist/astro/routes/api/admin/plugins/registry/_id_/update.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs +46 -43
- package/dist/astro/routes/api/admin/plugins/registry/artifact.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/registry/install.mjs +47 -44
- package/dist/astro/routes/api/admin/plugins/registry/install.mjs.map +1 -1
- package/dist/astro/routes/api/admin/plugins/updates.mjs +46 -43
- package/dist/astro/routes/api/admin/plugins/updates.mjs.map +1 -1
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +46 -43
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +3 -3
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +46 -43
- package/dist/astro/routes/api/admin/themes/marketplace/index.mjs.map +1 -1
- package/dist/astro/routes/api/admin/users/_id_/disable.mjs +3 -3
- package/dist/astro/routes/api/admin/users/_id_/enable.mjs +2 -2
- package/dist/astro/routes/api/admin/users/_id_/index.mjs +8 -8
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +5 -5
- package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs.map +1 -1
- package/dist/astro/routes/api/admin/users/index.mjs +7 -7
- package/dist/astro/routes/api/auth/dev-bypass.mjs +7 -6
- package/dist/astro/routes/api/auth/dev-bypass.mjs.map +1 -1
- package/dist/astro/routes/api/auth/invite/accept.mjs +2 -2
- package/dist/astro/routes/api/auth/invite/complete.mjs +12 -12
- package/dist/astro/routes/api/auth/invite/index.mjs +10 -10
- package/dist/astro/routes/api/auth/invite/index.mjs.map +1 -1
- package/dist/astro/routes/api/auth/invite/register-options.mjs +11 -11
- package/dist/astro/routes/api/auth/logout.mjs +3 -3
- package/dist/astro/routes/api/auth/magic-link/send.mjs +12 -12
- package/dist/astro/routes/api/auth/magic-link/send.mjs.map +1 -1
- package/dist/astro/routes/api/auth/magic-link/verify.mjs +3 -3
- package/dist/astro/routes/api/auth/me.mjs +8 -8
- package/dist/astro/routes/api/auth/mode.mjs +3 -3
- package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +4 -4
- package/dist/astro/routes/api/auth/oauth/_provider_.mjs +2 -2
- package/dist/astro/routes/api/auth/passkey/_id_.mjs +7 -7
- package/dist/astro/routes/api/auth/passkey/index.mjs +2 -2
- package/dist/astro/routes/api/auth/passkey/options.mjs +13 -13
- package/dist/astro/routes/api/auth/passkey/register/options.mjs +11 -11
- package/dist/astro/routes/api/auth/passkey/register/verify.mjs +12 -12
- package/dist/astro/routes/api/auth/passkey/verify.mjs +12 -12
- package/dist/astro/routes/api/auth/signup/complete.mjs +12 -12
- package/dist/astro/routes/api/auth/signup/request.mjs +12 -12
- package/dist/astro/routes/api/auth/signup/request.mjs.map +1 -1
- package/dist/astro/routes/api/auth/signup/verify.mjs +2 -2
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +18 -18
- package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs.map +1 -1
- package/dist/astro/routes/api/comments/_collection_/_contentId_/reactions.mjs +15 -15
- package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +4 -4
- package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +4 -4
- package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +14 -14
- package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +9 -9
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.mjs +19 -17
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/children.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.mjs +19 -17
- package/dist/astro/routes/api/content/_collection_/_id_/references/_relation_/parents.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +4 -4
- package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +9 -9
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +17 -16
- package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +4 -4
- package/dist/astro/routes/api/content/_collection_/_id_.d.mts.map +1 -1
- package/dist/astro/routes/api/content/_collection_/_id_.mjs +10 -10
- package/dist/astro/routes/api/content/_collection_/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/content/_collection_/authors.mjs +3 -3
- package/dist/astro/routes/api/content/_collection_/index.mjs +9 -9
- package/dist/astro/routes/api/content/_collection_/trash.mjs +8 -8
- package/dist/astro/routes/api/dashboard.mjs +9 -9
- package/dist/astro/routes/api/dev/emails.mjs +3 -3
- package/dist/astro/routes/api/import/probe.d.mts +3 -3
- package/dist/astro/routes/api/import/probe.mjs +19 -19
- package/dist/astro/routes/api/import/wordpress/analyze.mjs +4 -4
- package/dist/astro/routes/api/import/wordpress/execute.d.mts +11 -11
- package/dist/astro/routes/api/import/wordpress/execute.mjs +16 -15
- package/dist/astro/routes/api/import/wordpress/execute.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress/media.d.mts +10 -10
- package/dist/astro/routes/api/import/wordpress/media.mjs +10 -10
- package/dist/astro/routes/api/import/wordpress/prepare.mjs +11 -11
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +11 -11
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +13 -11
- package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs.map +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +1 -1
- package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +19 -19
- package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +11 -11
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +28 -27
- package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs.map +1 -1
- package/dist/astro/routes/api/manifest.mjs +5 -5
- package/dist/astro/routes/api/mcp.mjs +42 -42
- package/dist/astro/routes/api/media/_id_/confirm.d.mts.map +1 -1
- package/dist/astro/routes/api/media/_id_/confirm.mjs +106 -37
- package/dist/astro/routes/api/media/_id_/confirm.mjs.map +1 -1
- package/dist/astro/routes/api/media/_id_/upload.d.mts +8 -0
- package/dist/astro/routes/api/media/_id_/upload.d.mts.map +1 -0
- package/dist/astro/routes/api/media/_id_/upload.mjs +168 -0
- package/dist/astro/routes/api/media/_id_/upload.mjs.map +1 -0
- package/dist/astro/routes/api/media/_id_/usage.mjs +15 -13
- package/dist/astro/routes/api/media/_id_/usage.mjs.map +1 -1
- package/dist/astro/routes/api/media/_id_.d.mts.map +1 -1
- package/dist/astro/routes/api/media/_id_.mjs +22 -15
- package/dist/astro/routes/api/media/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/media/file/_...key_.mjs +2 -2
- package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +3 -3
- package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +3 -3
- package/dist/astro/routes/api/media/providers/index.mjs +3 -3
- package/dist/astro/routes/api/media/upload-url.d.mts.map +1 -1
- package/dist/astro/routes/api/media/upload-url.mjs +35 -24
- package/dist/astro/routes/api/media/upload-url.mjs.map +1 -1
- package/dist/astro/routes/api/media.mjs +14 -13
- package/dist/astro/routes/api/media.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs +12 -11
- package/dist/astro/routes/api/menus/_name_/items/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_/items.mjs +12 -11
- package/dist/astro/routes/api/menus/_name_/items.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_/reorder.mjs +12 -11
- package/dist/astro/routes/api/menus/_name_/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_/translations.mjs +12 -11
- package/dist/astro/routes/api/menus/_name_/translations.mjs.map +1 -1
- package/dist/astro/routes/api/menus/_name_.mjs +12 -11
- package/dist/astro/routes/api/menus/_name_.mjs.map +1 -1
- package/dist/astro/routes/api/menus/index.mjs +12 -11
- package/dist/astro/routes/api/menus/index.mjs.map +1 -1
- package/dist/astro/routes/api/oauth/authorize.mjs +6 -6
- package/dist/astro/routes/api/oauth/device/authorize.mjs +6 -6
- package/dist/astro/routes/api/oauth/device/code.mjs +9 -9
- package/dist/astro/routes/api/oauth/device/token.mjs +8 -8
- package/dist/astro/routes/api/oauth/register.mjs +3 -3
- package/dist/astro/routes/api/oauth/token/refresh.mjs +6 -6
- package/dist/astro/routes/api/oauth/token/revoke.mjs +6 -6
- package/dist/astro/routes/api/oauth/token.mjs +6 -6
- package/dist/astro/routes/api/openapi.json.mjs +62 -9
- package/dist/astro/routes/api/openapi.json.mjs.map +1 -1
- package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +5 -5
- package/dist/astro/routes/api/redirects/404s/index.mjs +12 -12
- package/dist/astro/routes/api/redirects/404s/summary.mjs +12 -12
- package/dist/astro/routes/api/redirects/_id_.mjs +14 -13
- package/dist/astro/routes/api/redirects/_id_.mjs.map +1 -1
- package/dist/astro/routes/api/redirects/index.mjs +14 -13
- package/dist/astro/routes/api/redirects/index.mjs.map +1 -1
- package/dist/astro/routes/api/relations/_id_/index.mjs +19 -17
- package/dist/astro/routes/api/relations/_id_/index.mjs.map +1 -1
- package/dist/astro/routes/api/relations/_id_/translations.mjs +14 -12
- package/dist/astro/routes/api/relations/_id_/translations.mjs.map +1 -1
- package/dist/astro/routes/api/relations/index.mjs +19 -17
- package/dist/astro/routes/api/relations/index.mjs.map +1 -1
- package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +3 -3
- package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +4 -4
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +46 -43
- package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +46 -43
- package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +46 -43
- package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +46 -43
- package/dist/astro/routes/api/schema/collections/_slug_/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/index.mjs +46 -43
- package/dist/astro/routes/api/schema/collections/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/collections/reorder.d.mts +8 -0
- package/dist/astro/routes/api/schema/collections/reorder.d.mts.map +1 -0
- package/dist/astro/routes/api/schema/collections/reorder.mjs +66 -0
- package/dist/astro/routes/api/schema/collections/reorder.mjs.map +1 -0
- package/dist/astro/routes/api/schema/index.mjs +12 -8
- package/dist/astro/routes/api/schema/index.mjs.map +1 -1
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs +46 -43
- package/dist/astro/routes/api/schema/orphans/_slug_.mjs.map +1 -1
- package/dist/astro/routes/api/schema/orphans/index.mjs +46 -43
- package/dist/astro/routes/api/schema/orphans/index.mjs.map +1 -1
- package/dist/astro/routes/api/search/enable.d.mts +1 -0
- package/dist/astro/routes/api/search/enable.d.mts.map +1 -1
- package/dist/astro/routes/api/search/enable.mjs +18 -13
- package/dist/astro/routes/api/search/enable.mjs.map +1 -1
- package/dist/astro/routes/api/search/index.mjs +12 -11
- package/dist/astro/routes/api/search/index.mjs.map +1 -1
- package/dist/astro/routes/api/search/rebuild.mjs +14 -13
- package/dist/astro/routes/api/search/rebuild.mjs.map +1 -1
- package/dist/astro/routes/api/search/stats.mjs +8 -7
- package/dist/astro/routes/api/search/stats.mjs.map +1 -1
- package/dist/astro/routes/api/search/suggest.mjs +12 -11
- package/dist/astro/routes/api/search/suggest.mjs.map +1 -1
- package/dist/astro/routes/api/sections/_slug_.mjs +11 -11
- package/dist/astro/routes/api/sections/index.mjs +11 -11
- package/dist/astro/routes/api/settings/backups/archives/_name_.mjs +7 -7
- package/dist/astro/routes/api/settings/backups/archives/index.mjs +6 -6
- package/dist/astro/routes/api/settings/backups/export.mjs +7 -7
- package/dist/astro/routes/api/settings/backups/index.mjs +8 -8
- package/dist/astro/routes/api/settings/email.mjs +5 -5
- package/dist/astro/routes/api/settings.mjs +16 -16
- package/dist/astro/routes/api/setup/admin-verify.mjs +13 -13
- package/dist/astro/routes/api/setup/admin.mjs +12 -12
- package/dist/astro/routes/api/setup/dev-bypass.mjs +31 -29
- package/dist/astro/routes/api/setup/dev-bypass.mjs.map +1 -1
- package/dist/astro/routes/api/setup/dev-reset.mjs +3 -3
- package/dist/astro/routes/api/setup/index.mjs +33 -31
- package/dist/astro/routes/api/setup/index.mjs.map +1 -1
- package/dist/astro/routes/api/setup/status.mjs +4 -4
- package/dist/astro/routes/api/snapshot.mjs +9 -9
- package/dist/astro/routes/api/taxonomies/_name_/reorder.d.mts +8 -0
- package/dist/astro/routes/api/taxonomies/_name_/reorder.d.mts.map +1 -0
- package/dist/astro/routes/api/taxonomies/_name_/reorder.mjs +43 -0
- package/dist/astro/routes/api/taxonomies/_name_/reorder.mjs.map +1 -0
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs +17 -16
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_/translations.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +17 -16
- package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.d.mts.map +1 -1
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +22 -18
- package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs.map +1 -1
- package/dist/astro/routes/api/taxonomies/index.mjs +17 -16
- package/dist/astro/routes/api/taxonomies/index.mjs.map +1 -1
- package/dist/astro/routes/api/themes/preview.mjs +7 -7
- package/dist/astro/routes/api/typegen.mjs +5 -5
- package/dist/astro/routes/api/well-known/auth.mjs +2 -2
- package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +2 -2
- package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +2 -2
- package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +8 -8
- package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +11 -11
- package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +11 -11
- package/dist/astro/routes/api/widget-areas/_name_.mjs +6 -6
- package/dist/astro/routes/api/widget-areas/index.mjs +11 -11
- package/dist/astro/routes/api/widget-components.mjs +3 -3
- package/dist/astro/routes/robots.txt.mjs +9 -9
- package/dist/astro/routes/sitemap-_collection_.xml.mjs +13 -13
- package/dist/astro/routes/sitemap.xml.mjs +10 -10
- package/dist/astro/types.d.mts +20 -13
- package/dist/astro/types.d.mts.map +1 -1
- package/dist/auth/providers/github.d.mts +1 -1
- package/dist/auth/providers/google.d.mts +1 -1
- package/dist/{authorize-6WPZa1xZ.mjs → authorize-qRhWQnel.mjs} +2 -2
- package/dist/{authorize-6WPZa1xZ.mjs.map → authorize-qRhWQnel.mjs.map} +1 -1
- package/dist/{backup-DoW-H0r4.mjs → backup-CtA6LDNw.mjs} +5 -5
- package/dist/{backup-DoW-H0r4.mjs.map → backup-CtA6LDNw.mjs.map} +1 -1
- package/dist/{byline-BTOxUlFF.mjs → byline-Cp6csL84.mjs} +9 -9
- package/dist/{byline-BTOxUlFF.mjs.map → byline-Cp6csL84.mjs.map} +1 -1
- package/dist/{byline-fields-CdU_LTF1.mjs → byline-fields-CNc0Yq5i.mjs} +2 -2
- package/dist/{byline-fields-CdU_LTF1.mjs.map → byline-fields-CNc0Yq5i.mjs.map} +1 -1
- package/dist/{byline-registry-BCuOp4UF.mjs → byline-registry-ZkPKqEwC.mjs} +4 -4
- package/dist/{byline-registry-BCuOp4UF.mjs.map → byline-registry-ZkPKqEwC.mjs.map} +1 -1
- package/dist/{bylines-Bc-3xtpz.mjs → bylines-CEj5CdT4.mjs} +7 -7
- package/dist/{bylines-Bc-3xtpz.mjs.map → bylines-CEj5CdT4.mjs.map} +1 -1
- package/dist/{bylines-oVN0iPwX.mjs → bylines-cf-C9lmF.mjs} +5 -5
- package/dist/{bylines-oVN0iPwX.mjs.map → bylines-cf-C9lmF.mjs.map} +1 -1
- package/dist/cache-C9FptTFR.mjs +108 -0
- package/dist/cache-C9FptTFR.mjs.map +1 -0
- package/dist/{challenge-store-BFzgFRog.mjs → challenge-store-D9VNKELo.mjs} +1 -1
- package/dist/{challenge-store-BFzgFRog.mjs.map → challenge-store-D9VNKELo.mjs.map} +1 -1
- package/dist/{chunks-Bq-5DPrD.mjs → chunks-DbYzib_k.mjs} +2 -2
- package/dist/{chunks-Bq-5DPrD.mjs.map → chunks-DbYzib_k.mjs.map} +1 -1
- package/dist/cli/index.mjs +41 -32
- package/dist/cli/index.mjs.map +1 -1
- package/dist/client/cf-access.d.mts +1 -1
- package/dist/client/index.d.mts +1 -1
- package/dist/client/index.mjs +2 -2
- package/dist/{comment-B9cUud8H.mjs → comment-BIkJ6Fil.mjs} +3 -3
- package/dist/{comment-B9cUud8H.mjs.map → comment-BIkJ6Fil.mjs.map} +1 -1
- package/dist/{comment-reaction-VUXO981F.mjs → comment-reaction-D-laEceb.mjs} +2 -2
- package/dist/{comment-reaction-VUXO981F.mjs.map → comment-reaction-D-laEceb.mjs.map} +1 -1
- package/dist/{comments-PXj1E9Si.mjs → comments-0_w6KChA.mjs} +3 -3
- package/dist/{comments-PXj1E9Si.mjs.map → comments-0_w6KChA.mjs.map} +1 -1
- package/dist/{components-DZkL4Fx0.mjs → components-BPxrRjpE.mjs} +1 -1
- package/dist/{components-DZkL4Fx0.mjs.map → components-BPxrRjpE.mjs.map} +1 -1
- package/dist/{config-B6b_BobR.mjs → config-DyF3OKg_.mjs} +15 -10
- package/dist/config-DyF3OKg_.mjs.map +1 -0
- package/dist/{content-BC43pICM.mjs → content-CJ94NEx5.mjs} +170 -117
- package/dist/content-CJ94NEx5.mjs.map +1 -0
- package/dist/{content-refresh-CPMSauD3.mjs → content-refresh-Xw7aKmou.mjs} +7 -7
- package/dist/{content-refresh-CPMSauD3.mjs.map → content-refresh-Xw7aKmou.mjs.map} +1 -1
- package/dist/{context-DOurRIrb.mjs → context-C_1nrqnW.mjs} +14 -14
- package/dist/{context-DOurRIrb.mjs.map → context-C_1nrqnW.mjs.map} +1 -1
- package/dist/{cron-BlKIMD_e.mjs → cron-DRV-UC4K.mjs} +1 -1
- package/dist/{cron-BlKIMD_e.mjs.map → cron-DRV-UC4K.mjs.map} +1 -1
- package/dist/{dashboard-CBm4zhc3.mjs → dashboard-DINnNVVU.mjs} +5 -5
- package/dist/{dashboard-CBm4zhc3.mjs.map → dashboard-DINnNVVU.mjs.map} +1 -1
- package/dist/db/index.d.mts +3 -3
- package/dist/db/index.mjs +3 -2
- package/dist/db/index.mjs.map +1 -1
- package/dist/db/libsql.d.mts +1 -1
- package/dist/db/postgres.d.mts +1 -1
- package/dist/db/sqlite.d.mts +1 -1
- package/dist/{default-C4v9KP56.mjs → default-BD2FG0xV.mjs} +1 -1
- package/dist/{default-C4v9KP56.mjs.map → default-BD2FG0xV.mjs.map} +1 -1
- package/dist/deferred-tasks-C-WRCcKo.d.mts +9 -0
- package/dist/deferred-tasks-C-WRCcKo.d.mts.map +1 -0
- package/dist/{device-flow-BeA6lUS1.mjs → device-flow-CTqd8mud.mjs} +5 -5
- package/dist/{device-flow-BeA6lUS1.mjs.map → device-flow-CTqd8mud.mjs.map} +1 -1
- package/dist/{dialect-helpers-BtOwo2us.mjs → dialect-helpers-BSbfaO3F.mjs} +43 -16
- package/dist/dialect-helpers-BSbfaO3F.mjs.map +1 -0
- package/dist/{email-console-C-9Ng8DM.mjs → email-console-C6WdcWbL.mjs} +1 -1
- package/dist/{email-console-C-9Ng8DM.mjs.map → email-console-C6WdcWbL.mjs.map} +1 -1
- package/dist/{error-DJ98TRbQ.mjs → error-oh_9i6bR.mjs} +3 -3
- package/dist/{error-DJ98TRbQ.mjs.map → error-oh_9i6bR.mjs.map} +1 -1
- package/dist/{errors-DtEXIQQV.mjs → errors-BucQ8VYz.mjs} +2 -1
- package/dist/errors-BucQ8VYz.mjs.map +1 -0
- package/dist/{escape-CFedIB1C.mjs → escape-CXps5F_v.mjs} +1 -1
- package/dist/{escape-CFedIB1C.mjs.map → escape-CXps5F_v.mjs.map} +1 -1
- package/dist/{field-defs-cache-KfNJ_qLQ.mjs → field-defs-cache-WD82dMQq.mjs} +4 -4
- package/dist/{field-defs-cache-KfNJ_qLQ.mjs.map → field-defs-cache-WD82dMQq.mjs.map} +1 -1
- package/dist/{fts-manager-hyCU9OOp.mjs → fts-manager-BITakW_R.mjs} +37 -13
- package/dist/fts-manager-BITakW_R.mjs.map +1 -0
- package/dist/{hash-DFFrkivP.mjs → hash-Cg0TXJPV.mjs} +8 -4
- package/dist/hash-Cg0TXJPV.mjs.map +1 -0
- package/dist/{hreflang-CIxH_LKz.d.mts → hreflang-BaLCNcDx.d.mts} +2 -2
- package/dist/{hreflang-CIxH_LKz.d.mts.map → hreflang-BaLCNcDx.d.mts.map} +1 -1
- package/dist/{hreflang-CbYeCzl9.mjs → hreflang-BdZuVBhL.mjs} +7 -7
- package/dist/{hreflang-CbYeCzl9.mjs.map → hreflang-BdZuVBhL.mjs.map} +1 -1
- package/dist/{import-oDYCgNYQ.mjs → import-C-9uqyT3.mjs} +6 -6
- package/dist/{import-oDYCgNYQ.mjs.map → import-C-9uqyT3.mjs.map} +1 -1
- package/dist/{index-BZJ_5FOX.d.mts → index-M37iz29I.d.mts} +112 -37
- package/dist/index-M37iz29I.d.mts.map +1 -0
- package/dist/{index-BEui-cRd.d.mts → index-MGw47uWq.d.mts} +3 -3
- package/dist/{index-BEui-cRd.d.mts.map → index-MGw47uWq.d.mts.map} +1 -1
- package/dist/index.d.mts +19 -19
- package/dist/index.mjs +69 -67
- package/dist/{load-Dg5gtWma.mjs → load-DV1DZuUJ.mjs} +2 -2
- package/dist/{load-Dg5gtWma.mjs.map → load-DV1DZuUJ.mjs.map} +1 -1
- package/dist/{loader-D4rigvjR.mjs → loader-CGugY7Zl.mjs} +29 -15
- package/dist/loader-CGugY7Zl.mjs.map +1 -0
- package/dist/{manifest-schema-bCq54i7F.mjs → manifest-schema-Da7kj23y.mjs} +1 -1
- package/dist/{manifest-schema-bCq54i7F.mjs.map → manifest-schema-Da7kj23y.mjs.map} +1 -1
- package/dist/media/index.d.mts +1 -1
- package/dist/media/local-runtime.d.mts +12 -12
- package/dist/media/local-runtime.mjs +8 -8
- package/dist/{media-its1WLYv.mjs → media-BP7S-nHT.mjs} +60 -15
- package/dist/media-BP7S-nHT.mjs.map +1 -0
- package/dist/{media-BJ6SRY3g.mjs → media-OhYL-7Io.mjs} +8 -4
- package/dist/{media-BJ6SRY3g.mjs.map → media-OhYL-7Io.mjs.map} +1 -1
- package/dist/{media-allowlist-jUppPWFy.mjs → media-allowlist-D-peH1H5.mjs} +1 -1
- package/dist/{media-allowlist-jUppPWFy.mjs.map → media-allowlist-D-peH1H5.mjs.map} +1 -1
- package/dist/{media-upload-DNu3QySc.mjs → media-upload-DtrwU2B0.mjs} +7 -7
- package/dist/{media-upload-DNu3QySc.mjs.map → media-upload-DtrwU2B0.mjs.map} +1 -1
- package/dist/{media-url-BCm5vBn6.mjs → media-url-DYs_YLOx.mjs} +1 -1
- package/dist/{media-url-BCm5vBn6.mjs.map → media-url-DYs_YLOx.mjs.map} +1 -1
- package/dist/{media-usage-DPQ3K4xB.mjs → media-usage-BlxfTkN0.mjs} +8 -8
- package/dist/{media-usage-DPQ3K4xB.mjs.map → media-usage-BlxfTkN0.mjs.map} +1 -1
- package/dist/{menus-BMGzWyWH.mjs → menus-BcQWxeXu.mjs} +5 -5
- package/dist/{menus-BMGzWyWH.mjs.map → menus-BcQWxeXu.mjs.map} +1 -1
- package/dist/{menus-CPf_SW7u.mjs → menus-Y54RDPIN.mjs} +215 -38
- package/dist/menus-Y54RDPIN.mjs.map +1 -0
- package/dist/{mode-fiXRMfeA.mjs → mode-BWyTBe3I.mjs} +1 -1
- package/dist/{mode-fiXRMfeA.mjs.map → mode-BWyTBe3I.mjs.map} +1 -1
- package/dist/{oauth-authorization-oqfbBuMH.mjs → oauth-authorization-ClvktmrL.mjs} +5 -5
- package/dist/{oauth-authorization-oqfbBuMH.mjs.map → oauth-authorization-ClvktmrL.mjs.map} +1 -1
- package/dist/{oauth-clients-BlrUHAsf.mjs → oauth-clients-8ao-U66l.mjs} +1 -1
- package/dist/{oauth-clients-BlrUHAsf.mjs.map → oauth-clients-8ao-U66l.mjs.map} +1 -1
- package/dist/{oauth-state-store-DnvjRMy6.mjs → oauth-state-store-B1ofdTiQ.mjs} +1 -1
- package/dist/{oauth-state-store-DnvjRMy6.mjs.map → oauth-state-store-B1ofdTiQ.mjs.map} +1 -1
- package/dist/{oauth-user-lookup-oUllxvAv.mjs → oauth-user-lookup-CscEuIiR.mjs} +1 -1
- package/dist/{oauth-user-lookup-oUllxvAv.mjs.map → oauth-user-lookup-CscEuIiR.mjs.map} +1 -1
- package/dist/object-cache/memory.d.mts +1 -1
- package/dist/{object-cache-Bok5j2ae.mjs → object-cache-71tPfV4A.mjs} +106 -5
- package/dist/object-cache-71tPfV4A.mjs.map +1 -0
- package/dist/{options-BqMkWfYa.d.mts → options-CA4eVX6P.d.mts} +3 -3
- package/dist/{options-BqMkWfYa.d.mts.map → options-CA4eVX6P.d.mts.map} +1 -1
- package/dist/{options-BlmBHTvX.mjs → options-CBXIHUoT.mjs} +1 -1
- package/dist/{options-BlmBHTvX.mjs.map → options-CBXIHUoT.mjs.map} +1 -1
- package/dist/page/index.d.mts +2 -2
- package/dist/{parse-53zyxlpv.mjs → parse-CJKNuewM.mjs} +2 -2
- package/dist/{parse-53zyxlpv.mjs.map → parse-CJKNuewM.mjs.map} +1 -1
- package/dist/{passkey-config-C-SKpc0-.mjs → passkey-config-D-zrzMJI.mjs} +1 -1
- package/dist/{passkey-config-C-SKpc0-.mjs.map → passkey-config-D-zrzMJI.mjs.map} +1 -1
- package/dist/{placeholder-Dop47JMM.d.mts → placeholder-DaeNS-VG.d.mts} +1 -1
- package/dist/{placeholder-Dop47JMM.d.mts.map → placeholder-DaeNS-VG.d.mts.map} +1 -1
- package/dist/plugin-types.d.mts +1 -1
- package/dist/plugin-utils.d.mts +10 -10
- package/dist/plugins/adapt-sandbox-entry.d.mts +10 -10
- package/dist/plugins/adapt-sandbox-entry.mjs +2 -2
- package/dist/{portable-text-sDj92Kxv.mjs → portable-text-B_kqBmXB.mjs} +1 -1
- package/dist/{portable-text-sDj92Kxv.mjs.map → portable-text-B_kqBmXB.mjs.map} +1 -1
- package/dist/{preview-D4Jnbfx7.mjs → preview-BU6PaLpM.mjs} +2 -2
- package/dist/{preview-D4Jnbfx7.mjs.map → preview-BU6PaLpM.mjs.map} +1 -1
- package/dist/{public-url-DSGTnJFw.mjs → public-url-Ox9oOlgp.mjs} +14 -3
- package/dist/public-url-Ox9oOlgp.mjs.map +1 -0
- package/dist/{query-Bz9bWZfm.mjs → query-C5w7PsRQ.mjs} +43 -44
- package/dist/query-C5w7PsRQ.mjs.map +1 -0
- package/dist/{query-DdFGHzQF.mjs → query-rC9HKv1N.mjs} +4 -4
- package/dist/{query-DdFGHzQF.mjs.map → query-rC9HKv1N.mjs.map} +1 -1
- package/dist/{rate-limit-D3IEiUi2.mjs → rate-limit-kug6q99V.mjs} +2 -2
- package/dist/{rate-limit-D3IEiUi2.mjs.map → rate-limit-kug6q99V.mjs.map} +1 -1
- package/dist/{redirect-BoUac4NT.mjs → redirect-DIJxXKOG.mjs} +3 -3
- package/dist/{redirect-BoUac4NT.mjs.map → redirect-DIJxXKOG.mjs.map} +1 -1
- package/dist/{redirect-Botom7X6.mjs → redirect-Egf2R9yP.mjs} +1 -1
- package/dist/{redirect-Botom7X6.mjs.map → redirect-Egf2R9yP.mjs.map} +1 -1
- package/dist/{redirects-ChbpqKiS.mjs → redirects-Bzm812bY.mjs} +5 -5
- package/dist/{redirects-ChbpqKiS.mjs.map → redirects-Bzm812bY.mjs.map} +1 -1
- package/dist/{redirects-D457qwt0.mjs → redirects-G8wAhWAf.mjs} +25 -7
- package/dist/redirects-G8wAhWAf.mjs.map +1 -0
- package/dist/{registry-y21kjhfG.mjs → registry-Dbodb4Uo.mjs} +59 -14
- package/dist/registry-Dbodb4Uo.mjs.map +1 -0
- package/dist/{relation-Du0r04E0.mjs → relation-Cbe3Sd3m.mjs} +3 -3
- package/dist/{relation-Du0r04E0.mjs.map → relation-Cbe3Sd3m.mjs.map} +1 -1
- package/dist/{relations-CZMpBqEd.mjs → relations-Bw_E1TXo.mjs} +3 -3
- package/dist/{relations-CZMpBqEd.mjs.map → relations-Bw_E1TXo.mjs.map} +1 -1
- package/dist/{relations-qKmSj9KM.d.mts → relations-G2ta7GIl.d.mts} +50 -12
- package/dist/relations-G2ta7GIl.d.mts.map +1 -0
- package/dist/{relations-DtX1UMBH.mjs → relations-qHwpUe66.mjs} +6 -6
- package/dist/{relations-DtX1UMBH.mjs.map → relations-qHwpUe66.mjs.map} +1 -1
- package/dist/request-context.d.mts +3 -0
- package/dist/request-context.d.mts.map +1 -1
- package/dist/request-context.mjs.map +1 -1
- package/dist/{request-meta-DzXYYI-n.mjs → request-meta-Df-jFbAd.mjs} +2 -2
- package/dist/{request-meta-DzXYYI-n.mjs.map → request-meta-Df-jFbAd.mjs.map} +1 -1
- package/dist/{resolve-DFr4kq72.mjs → resolve-DZzG4HqM.mjs} +2 -2
- package/dist/{resolve-DFr4kq72.mjs.map → resolve-DZzG4HqM.mjs.map} +1 -1
- package/dist/{runner-BdeLEgad.mjs → runner-BFTrkYhu.mjs} +497 -213
- package/dist/runner-BFTrkYhu.mjs.map +1 -0
- package/dist/{runner-Dd8m8k9F.d.mts → runner-BaADli8l.d.mts} +2 -2
- package/dist/{runner-Dd8m8k9F.d.mts.map → runner-BaADli8l.d.mts.map} +1 -1
- package/dist/runtime.d.mts +11 -11
- package/dist/runtime.mjs +3 -3
- package/dist/{schema-BH8P8vaC.mjs → schema-CiQXr6_F.mjs} +3 -3
- package/dist/{schema-BH8P8vaC.mjs.map → schema-CiQXr6_F.mjs.map} +1 -1
- package/dist/{scopes-DTIkIaGA.mjs → scopes-CNJVT5i5.mjs} +3 -3
- package/dist/{scopes-DTIkIaGA.mjs.map → scopes-CNJVT5i5.mjs.map} +1 -1
- package/dist/{search-D-Yhpmvs.mjs → search-FZhx5dDU.mjs} +7 -7
- package/dist/{search-D-Yhpmvs.mjs.map → search-FZhx5dDU.mjs.map} +1 -1
- package/dist/{secrets-CQ-69kF9.mjs → secrets-DLd8RXee.mjs} +4 -4
- package/dist/{secrets-CQ-69kF9.mjs.map → secrets-DLd8RXee.mjs.map} +1 -1
- package/dist/{sections-CzVBAKjw.mjs → sections-BrIrMUCn.mjs} +3 -3
- package/dist/{sections-CzVBAKjw.mjs.map → sections-BrIrMUCn.mjs.map} +1 -1
- package/dist/seed/index.d.mts +2 -2
- package/dist/seed/index.mjs +25 -23
- package/dist/seo/index.d.mts +3 -3
- package/dist/seo/index.mjs +18 -16
- package/dist/seo/index.mjs.map +1 -1
- package/dist/{seo-C3GDfT0V.mjs → seo-CobNfOvb.mjs} +2 -2
- package/dist/{seo-C3GDfT0V.mjs.map → seo-CobNfOvb.mjs.map} +1 -1
- package/dist/{seo-kJzVAmmu.mjs → seo-DTHRntNC.mjs} +3 -3
- package/dist/{seo-kJzVAmmu.mjs.map → seo-DTHRntNC.mjs.map} +1 -1
- package/dist/{service-CQnc276a.mjs → service-B-pYGPgR.mjs} +4 -4
- package/dist/{service-CQnc276a.mjs.map → service-B-pYGPgR.mjs.map} +1 -1
- package/dist/{session-user-DbHqKDKe.mjs → session-user-BvM9-zNl.mjs} +2 -2
- package/dist/{session-user-DbHqKDKe.mjs.map → session-user-BvM9-zNl.mjs.map} +1 -1
- package/dist/{settings-Dtc0DU31.mjs → settings-DPHau-WH.mjs} +3 -3
- package/dist/{settings-Dtc0DU31.mjs.map → settings-DPHau-WH.mjs.map} +1 -1
- package/dist/{settings-C2PaBS49.mjs → settings-kJhGiQ4z.mjs} +7 -7
- package/dist/{settings-C2PaBS49.mjs.map → settings-kJhGiQ4z.mjs.map} +1 -1
- package/dist/{setup-complete-CdIlqloh.mjs → setup-complete-u50Qm8rY.mjs} +2 -2
- package/dist/{setup-complete-CdIlqloh.mjs.map → setup-complete-u50Qm8rY.mjs.map} +1 -1
- package/dist/{setup-nonce-DqiIPr-J.mjs → setup-nonce-DCjiiOD2.mjs} +1 -1
- package/dist/{setup-nonce-DqiIPr-J.mjs.map → setup-nonce-DCjiiOD2.mjs.map} +1 -1
- package/dist/{single-flight-cache-C2exrGAi.mjs → single-flight-cache-DW3w11Pu.mjs} +1 -1
- package/dist/{single-flight-cache-C2exrGAi.mjs.map → single-flight-cache-DW3w11Pu.mjs.map} +1 -1
- package/dist/site-url-I-lJ5kma.mjs +16 -0
- package/dist/site-url-I-lJ5kma.mjs.map +1 -0
- package/dist/{snapshot-BdpUJKD-.mjs → snapshot-I_fjLDaD.mjs} +2 -2
- package/dist/{snapshot-BdpUJKD-.mjs.map → snapshot-I_fjLDaD.mjs.map} +1 -1
- package/dist/{ssrf-CviKqWmq.mjs → ssrf-CTa6v21i.mjs} +1 -1
- package/dist/{ssrf-CviKqWmq.mjs.map → ssrf-CTa6v21i.mjs.map} +1 -1
- package/dist/{state-xxv6ZTMv.mjs → state-CQvoefYP.mjs} +1 -1
- package/dist/{state-xxv6ZTMv.mjs.map → state-CQvoefYP.mjs.map} +1 -1
- package/dist/{status-COfycGIU.mjs → status-CIsmlC1E.mjs} +1 -1
- package/dist/{status-COfycGIU.mjs.map → status-CIsmlC1E.mjs.map} +1 -1
- package/dist/storage/local.d.mts +1 -1
- package/dist/storage/local.mjs +1 -1
- package/dist/storage/s3.d.mts +1 -1
- package/dist/storage/s3.mjs +2 -2
- package/dist/storage/s3.mjs.map +1 -1
- package/dist/{taxonomies-BN6M9Nrv.mjs → taxonomies-CKuaZER5.mjs} +90 -9
- package/dist/taxonomies-CKuaZER5.mjs.map +1 -0
- package/dist/{taxonomies-r7pqLBCn.mjs → taxonomies-CLN1N92E.mjs} +57 -32
- package/dist/taxonomies-CLN1N92E.mjs.map +1 -0
- package/dist/{taxonomy-0mCI25HN.mjs → taxonomy-pOrB2kZe.mjs} +142 -15
- package/dist/taxonomy-pOrB2kZe.mjs.map +1 -0
- package/dist/{tokens-DVltpO2D.mjs → tokens-DagaJGK8.mjs} +1 -1
- package/dist/{tokens-DVltpO2D.mjs.map → tokens-DagaJGK8.mjs.map} +1 -1
- package/dist/{transaction-D0FOsb3X.mjs → transaction-NQj4VJ7Z.mjs} +1 -1
- package/dist/{transaction-D0FOsb3X.mjs.map → transaction-NQj4VJ7Z.mjs.map} +1 -1
- package/dist/{transport-Vd7VdqHv.d.mts → transport-CAwTaTp_.d.mts} +1 -1
- package/dist/{transport-Vd7VdqHv.d.mts.map → transport-CAwTaTp_.d.mts.map} +1 -1
- package/dist/{transport-CKrlqSpD.mjs → transport-DVsa5YYo.mjs} +1 -1
- package/dist/{transport-CKrlqSpD.mjs.map → transport-DVsa5YYo.mjs.map} +1 -1
- package/dist/{trusted-proxy-CwjQj0YG.mjs → trusted-proxy-D20_7fyX.mjs} +1 -1
- package/dist/{trusted-proxy-CwjQj0YG.mjs.map → trusted-proxy-D20_7fyX.mjs.map} +1 -1
- package/dist/{types-BfYUPJdP.d.mts → types-BGWPMiBO.d.mts} +2 -2
- package/dist/{types-BfYUPJdP.d.mts.map → types-BGWPMiBO.d.mts.map} +1 -1
- package/dist/{types-iVeZ5g6N.d.mts → types-BK6U01Ro.d.mts} +1 -1
- package/dist/{types-iVeZ5g6N.d.mts.map → types-BK6U01Ro.d.mts.map} +1 -1
- package/dist/{types-BD40g7zz.mjs → types-BjxTKxrZ.mjs} +1 -1
- package/dist/{types-BD40g7zz.mjs.map → types-BjxTKxrZ.mjs.map} +1 -1
- package/dist/{types-Kmaxdarz.d.mts → types-BnFP1M3J.d.mts} +22 -1
- package/dist/types-BnFP1M3J.d.mts.map +1 -0
- package/dist/{types-C7U0HlEr.d.mts → types-C8oz_ayJ.d.mts} +1 -1
- package/dist/{types-C7U0HlEr.d.mts.map → types-C8oz_ayJ.d.mts.map} +1 -1
- package/dist/{types-B4vm81VH.d.mts → types-CbUcuxxc.d.mts} +1 -1
- package/dist/{types-B4vm81VH.d.mts.map → types-CbUcuxxc.d.mts.map} +1 -1
- package/dist/{types-CrRUFdej.mjs → types-Cd8iuS1J.mjs} +10 -3
- package/dist/{types-CrRUFdej.mjs.map → types-Cd8iuS1J.mjs.map} +1 -1
- package/dist/types-CtzytVXn.mjs +18 -0
- package/dist/types-CtzytVXn.mjs.map +1 -0
- package/dist/{types-BvB7gDOD.d.mts → types-Cz8hNch2.d.mts} +5 -5
- package/dist/{types-BvB7gDOD.d.mts.map → types-Cz8hNch2.d.mts.map} +1 -1
- package/dist/{types-B97jg3aW.d.mts → types-DLG4IFEQ.d.mts} +1 -1
- package/dist/{types-B97jg3aW.d.mts.map → types-DLG4IFEQ.d.mts.map} +1 -1
- package/dist/{types-DPKhI5ib.d.mts → types-Dc4ntQjQ.d.mts} +18 -1
- package/dist/types-Dc4ntQjQ.d.mts.map +1 -0
- package/dist/{types-BNfPHfay.d.mts → types-LoagAGzH.d.mts} +1 -1
- package/dist/{types-BNfPHfay.d.mts.map → types-LoagAGzH.d.mts.map} +1 -1
- package/dist/{types-o7xo7VgH.mjs → types-NBI3rF-_.mjs} +3 -2
- package/dist/types-NBI3rF-_.mjs.map +1 -0
- package/dist/upload-attempts-D8QAFLUJ.mjs +27 -0
- package/dist/upload-attempts-D8QAFLUJ.mjs.map +1 -0
- package/dist/{user-aTXqmXBz.mjs → user-DBrq4UVq.mjs} +3 -3
- package/dist/{user-aTXqmXBz.mjs.map → user-DBrq4UVq.mjs.map} +1 -1
- package/dist/{utils-BbUgmeZG.mjs → utils-hLzi_2Fn.mjs} +2 -2
- package/dist/{utils-BbUgmeZG.mjs.map → utils-hLzi_2Fn.mjs.map} +1 -1
- package/dist/{validate-VPnKoIzW.mjs → validate-BpwoDOgt.mjs} +25 -2
- package/dist/validate-BpwoDOgt.mjs.map +1 -0
- package/dist/{validate-DULfgpJP.d.mts → validate-C3oSmA7F.d.mts} +15 -5
- package/dist/validate-C3oSmA7F.d.mts.map +1 -0
- package/dist/{validate-CDT1jl6_.mjs → validate-mKo3RxBM.mjs} +4 -4
- package/dist/{validate-CDT1jl6_.mjs.map → validate-mKo3RxBM.mjs.map} +1 -1
- package/dist/{validation-DlD0E35W.mjs → validation-BgpucsvF.mjs} +11 -9
- package/dist/{validation-DlD0E35W.mjs.map → validation-BgpucsvF.mjs.map} +1 -1
- package/dist/version-C4PnpmoV.mjs +7 -0
- package/dist/{version-BRMngh9I.mjs.map → version-C4PnpmoV.mjs.map} +1 -1
- package/dist/{widgets-5fipNkMT.mjs → widgets-CJJtkiKh.mjs} +3 -3
- package/dist/{widgets-5fipNkMT.mjs.map → widgets-CJJtkiKh.mjs.map} +1 -1
- package/dist/{wxr-taxonomies-DrihupaC.mjs → wxr-taxonomies-9PPSy8X6.mjs} +4 -4
- package/dist/{wxr-taxonomies-DrihupaC.mjs.map → wxr-taxonomies-9PPSy8X6.mjs.map} +1 -1
- package/dist/{wxr-taxonomies-B4tMuN5T.d.mts → wxr-taxonomies-Bkpp_2tK.d.mts} +1 -1
- package/dist/{wxr-taxonomies-B4tMuN5T.d.mts.map → wxr-taxonomies-Bkpp_2tK.d.mts.map} +1 -1
- package/dist/{zod-generator-CwkHWz4f.mjs → zod-generator-CG64Hnbh.mjs} +3 -3
- package/dist/{zod-generator-CwkHWz4f.mjs.map → zod-generator-CG64Hnbh.mjs.map} +1 -1
- package/package.json +12 -8
- package/src/after.ts +6 -1
- package/src/api/errors.ts +1 -0
- package/src/api/handlers/content.ts +45 -4
- package/src/api/handlers/marketplace.ts +14 -0
- package/src/api/handlers/media.ts +4 -4
- package/src/api/handlers/registry.ts +14 -0
- package/src/api/handlers/revision.ts +19 -5
- package/src/api/handlers/schema.ts +37 -0
- package/src/api/handlers/snapshot.ts +1 -1
- package/src/api/handlers/taxonomies.ts +111 -10
- package/src/api/openapi/document.ts +84 -3
- package/src/api/public-url.ts +14 -2
- package/src/api/schemas/media.ts +9 -2
- package/src/api/schemas/schema.ts +13 -0
- package/src/api/schemas/search.ts +2 -0
- package/src/api/schemas/taxonomies.ts +34 -1
- package/src/api/site-url.ts +16 -6
- package/src/astro/integration/routes.ts +19 -0
- package/src/astro/integration/runtime.ts +13 -0
- package/src/astro/integration/virtual-modules.ts +2 -0
- package/src/astro/middleware/redirect.ts +2 -10
- package/src/astro/middleware/scoped-db.ts +35 -4
- package/src/astro/middleware.ts +56 -22
- package/src/astro/routes/api/admin/comments/[id]/status.ts +1 -1
- package/src/astro/routes/api/admin/users/[id]/send-recovery.ts +2 -2
- package/src/astro/routes/api/auth/invite/index.ts +2 -2
- package/src/astro/routes/api/auth/magic-link/send.ts +2 -2
- package/src/astro/routes/api/auth/signup/request.ts +2 -2
- package/src/astro/routes/api/comments/[collection]/[contentId]/index.ts +1 -1
- package/src/astro/routes/api/content/[collection]/[id].ts +3 -1
- package/src/astro/routes/api/media/[id]/confirm.ts +148 -59
- package/src/astro/routes/api/media/[id]/upload.ts +262 -0
- package/src/astro/routes/api/media/[id].ts +19 -10
- package/src/astro/routes/api/media/upload-url.ts +28 -31
- package/src/astro/routes/api/schema/collections/reorder.ts +31 -0
- package/src/astro/routes/api/schema/index.ts +2 -0
- package/src/astro/routes/api/search/enable.ts +5 -1
- package/src/astro/routes/api/search/rebuild.ts +6 -1
- package/src/astro/routes/api/taxonomies/[name]/reorder.ts +41 -0
- package/src/astro/routes/api/taxonomies/[name]/terms/index.ts +6 -3
- package/src/astro/types.ts +7 -0
- package/src/cleanup.ts +54 -26
- package/src/cli/commands/dev.ts +13 -3
- package/src/cli/commands/export-seed.ts +2 -0
- package/src/cli/index.ts +1 -1
- package/src/components/CommentForm.astro +1 -1
- package/src/components/Comments.astro +1 -1
- package/src/components/InlinePortableTextEditor.tsx +175 -31
- package/src/components/OrderedList.astro +14 -0
- package/src/components/PortableText.astro +26 -4
- package/src/components/code-mark.ts +11 -0
- package/src/components/index.ts +12 -1
- package/src/components/ordered-list.ts +549 -0
- package/src/content/converters/numbered-list.ts +148 -0
- package/src/content/converters/portable-text-to-prosemirror.ts +59 -9
- package/src/content/converters/prosemirror-to-portable-text.ts +23 -12
- package/src/content/converters/types.ts +2 -0
- package/src/content/portable-text-lists.ts +205 -0
- package/src/database/dialect-helpers.ts +41 -22
- package/src/database/migrations/054_media_upload_attempts.ts +41 -0
- package/src/database/migrations/055_content_translation_group_locale_index.ts +67 -0
- package/src/database/migrations/056_taxonomy_term_sort_order.ts +189 -0
- package/src/database/migrations/057_collection_hidden.ts +24 -0
- package/src/database/migrations/058_collection_sort_order.ts +20 -0
- package/src/database/migrations/059_revision_prune_queue.ts +36 -0
- package/src/database/migrations/runner.ts +12 -0
- package/src/database/repositories/content.ts +193 -183
- package/src/database/repositories/media.ts +158 -28
- package/src/database/repositories/revision.ts +82 -17
- package/src/database/repositories/taxonomy.ts +202 -7
- package/src/database/repositories/types.ts +7 -0
- package/src/database/types.ts +23 -1
- package/src/database/validate.ts +39 -0
- package/src/db/adapters.ts +8 -0
- package/src/deferred-tasks.ts +71 -0
- package/src/emdash-runtime.ts +277 -88
- package/src/i18n/config.ts +17 -10
- package/src/index.ts +3 -0
- package/src/loader.ts +46 -24
- package/src/media/upload-attempts.ts +33 -0
- package/src/media/usage/gc.ts +50 -0
- package/src/object-cache/index.ts +160 -3
- package/src/plugins/routes.ts +34 -0
- package/src/plugins/storage-indexes.ts +50 -11
- package/src/query.ts +50 -44
- package/src/redirects/cache.ts +79 -19
- package/src/request-context.ts +3 -0
- package/src/scheduled-publish.ts +6 -1
- package/src/schema/registry.ts +95 -3
- package/src/schema/types.ts +24 -0
- package/src/search/fts-manager.ts +50 -10
- package/src/search/index.ts +2 -0
- package/src/search/types.ts +6 -0
- package/src/seed/apply.ts +22 -2
- package/src/seed/types.ts +10 -0
- package/src/storage/s3.ts +1 -1
- package/src/taxonomies/index.ts +11 -7
- package/src/taxonomies/term-counts.ts +56 -28
- package/src/ui-comments.ts +19 -0
- package/src/ui.ts +11 -3
- package/src/utils/hash.ts +14 -3
- package/src/virtual-modules.d.ts +8 -0
- package/dist/adapters-C0ONzkUP.d.mts.map +0 -1
- package/dist/after-B1IIdH3Y.mjs +0 -29
- package/dist/after-B1IIdH3Y.mjs.map +0 -1
- package/dist/api-BkqFzIu4.mjs.map +0 -1
- package/dist/apply-DuXsqll7.mjs.map +0 -1
- package/dist/cache-DDwy3JDW.mjs +0 -65
- package/dist/cache-DDwy3JDW.mjs.map +0 -1
- package/dist/config-B6b_BobR.mjs.map +0 -1
- package/dist/content-BC43pICM.mjs.map +0 -1
- package/dist/dialect-helpers-BtOwo2us.mjs.map +0 -1
- package/dist/errors-DtEXIQQV.mjs.map +0 -1
- package/dist/fts-manager-hyCU9OOp.mjs.map +0 -1
- package/dist/hash-DFFrkivP.mjs.map +0 -1
- package/dist/index-BZJ_5FOX.d.mts.map +0 -1
- package/dist/loader-D4rigvjR.mjs.map +0 -1
- package/dist/media-its1WLYv.mjs.map +0 -1
- package/dist/menus-CPf_SW7u.mjs.map +0 -1
- package/dist/object-cache-Bok5j2ae.mjs.map +0 -1
- package/dist/public-url-DSGTnJFw.mjs.map +0 -1
- package/dist/query-Bz9bWZfm.mjs.map +0 -1
- package/dist/redirects-D457qwt0.mjs.map +0 -1
- package/dist/registry-y21kjhfG.mjs.map +0 -1
- package/dist/relations-qKmSj9KM.d.mts.map +0 -1
- package/dist/runner-BdeLEgad.mjs.map +0 -1
- package/dist/site-url-NGJT6NTU.mjs +0 -13
- package/dist/site-url-NGJT6NTU.mjs.map +0 -1
- package/dist/taxonomies-BN6M9Nrv.mjs.map +0 -1
- package/dist/taxonomies-r7pqLBCn.mjs.map +0 -1
- package/dist/taxonomy-0mCI25HN.mjs.map +0 -1
- package/dist/types-DPKhI5ib.d.mts.map +0 -1
- package/dist/types-Kmaxdarz.d.mts.map +0 -1
- package/dist/types-o7xo7VgH.mjs.map +0 -1
- package/dist/validate-DULfgpJP.d.mts.map +0 -1
- package/dist/validate-VPnKoIzW.mjs.map +0 -1
- package/dist/version-BRMngh9I.mjs +0 -7
- /package/dist/{api-tokens-Cvmixds7.mjs → api-tokens-Dai9dND0.mjs} +0 -0
- /package/dist/{ssrf-BB__xfNM.mjs → ssrf-Cj568Dgs.mjs} +0 -0
- /package/dist/{types-CK0LxPUQ.mjs → types-DKuWPYV5.mjs} +0 -0
|
@@ -0,0 +1,549 @@
|
|
|
1
|
+
import { mergeAttributes, wrappingInputRule } from "@tiptap/core";
|
|
2
|
+
import { OrderedList } from "@tiptap/extension-list";
|
|
3
|
+
import { Fragment, type Node as ProseMirrorNode, Slice } from "@tiptap/pm/model";
|
|
4
|
+
import { Plugin, Selection, type EditorState, type Transaction } from "@tiptap/pm/state";
|
|
5
|
+
import { canJoin, dropPoint } from "@tiptap/pm/transform";
|
|
6
|
+
import type { EditorView } from "@tiptap/pm/view";
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
deriveLegacyListId,
|
|
10
|
+
normalizeListId,
|
|
11
|
+
normalizeListStart,
|
|
12
|
+
} from "../content/converters/numbered-list.js";
|
|
13
|
+
|
|
14
|
+
const ORDERED_LIST_INPUT_REGEX = /^(\d+)\.\s$/;
|
|
15
|
+
|
|
16
|
+
declare module "@tiptap/core" {
|
|
17
|
+
interface Commands<ReturnType> {
|
|
18
|
+
orderedListContinuity: {
|
|
19
|
+
continueOrderedList: () => ReturnType;
|
|
20
|
+
restartOrderedList: () => ReturnType;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface OrderedListDescriptor {
|
|
26
|
+
node: ProseMirrorNode;
|
|
27
|
+
pos: number;
|
|
28
|
+
depth: number;
|
|
29
|
+
context: string;
|
|
30
|
+
contextPos: number | null;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface OrderedListNormalization {
|
|
34
|
+
pos: number;
|
|
35
|
+
attrs: Record<string, unknown>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function createListId(): string {
|
|
39
|
+
return (
|
|
40
|
+
globalThis.crypto?.randomUUID?.() ??
|
|
41
|
+
`list-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function createRepairId(sourceId: string, scope: string, attempt: number): string {
|
|
46
|
+
const base = deriveLegacyListId(`repair:${sourceId}:${scope}`);
|
|
47
|
+
const suffix = `:${attempt.toString(36)}`;
|
|
48
|
+
return `${base.slice(0, 128 - suffix.length)}${suffix}`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function collectOrderedLists(doc: ProseMirrorNode): OrderedListDescriptor[] {
|
|
52
|
+
const lists: OrderedListDescriptor[] = [];
|
|
53
|
+
doc.descendants((node, pos) => {
|
|
54
|
+
if (node.type.name !== "orderedList") return;
|
|
55
|
+
const resolved = doc.resolve(pos);
|
|
56
|
+
let context = "root";
|
|
57
|
+
let contextPos: number | null = null;
|
|
58
|
+
for (let depth = resolved.depth; depth > 0; depth--) {
|
|
59
|
+
if (resolved.node(depth).type.name === "listItem") {
|
|
60
|
+
contextPos = resolved.before(depth);
|
|
61
|
+
context = `listItem:${contextPos}`;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (contextPos === null && resolved.depth > 0) {
|
|
66
|
+
contextPos = resolved.before(resolved.depth);
|
|
67
|
+
context = `${resolved.node(resolved.depth).type.name}:${contextPos}`;
|
|
68
|
+
}
|
|
69
|
+
lists.push({ node, pos, depth: resolved.depth, context, contextPos });
|
|
70
|
+
});
|
|
71
|
+
return lists;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function normalizeOrderedListDocument(doc: ProseMirrorNode): OrderedListNormalization[] {
|
|
75
|
+
const lists = collectOrderedLists(doc);
|
|
76
|
+
const canonicalBySourceScope = new Map<string, string>();
|
|
77
|
+
const assignedCanonicalIds = new Set<string>();
|
|
78
|
+
const prepared = lists.map((list) => {
|
|
79
|
+
const sourceId =
|
|
80
|
+
normalizeListId(list.node.attrs.listId) ??
|
|
81
|
+
deriveLegacyListId(`pm:${list.pos}:${list.depth}:${list.context}`);
|
|
82
|
+
const scope = JSON.stringify([list.depth, list.context]);
|
|
83
|
+
const sourceScope = JSON.stringify([sourceId, scope]);
|
|
84
|
+
let listId = canonicalBySourceScope.get(sourceScope);
|
|
85
|
+
if (!listId) {
|
|
86
|
+
if (!assignedCanonicalIds.has(sourceId)) {
|
|
87
|
+
listId = sourceId;
|
|
88
|
+
} else {
|
|
89
|
+
let attempt = 0;
|
|
90
|
+
do {
|
|
91
|
+
listId = createRepairId(sourceId, scope, attempt++);
|
|
92
|
+
} while (assignedCanonicalIds.has(listId));
|
|
93
|
+
}
|
|
94
|
+
canonicalBySourceScope.set(sourceScope, listId);
|
|
95
|
+
assignedCanonicalIds.add(listId);
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
...list,
|
|
99
|
+
listId,
|
|
100
|
+
scopeKey: JSON.stringify([listId, list.depth, list.context]),
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const bases = new Map<string, number>();
|
|
105
|
+
for (const list of prepared) {
|
|
106
|
+
const listStart = normalizeListStart(list.node.attrs.listStart);
|
|
107
|
+
if (listStart !== undefined && !bases.has(list.scopeKey)) {
|
|
108
|
+
bases.set(list.scopeKey, listStart);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
for (const list of prepared) {
|
|
112
|
+
if (!bases.has(list.scopeKey)) {
|
|
113
|
+
bases.set(list.scopeKey, normalizeListStart(list.node.attrs.start) ?? 1);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const counts = new Map<string, number>();
|
|
118
|
+
const changes: OrderedListNormalization[] = [];
|
|
119
|
+
for (const list of prepared) {
|
|
120
|
+
const listStart = bases.get(list.scopeKey)!;
|
|
121
|
+
const count = counts.get(list.scopeKey) ?? 0;
|
|
122
|
+
const start = normalizeListStart(listStart + count) ?? 1;
|
|
123
|
+
counts.set(list.scopeKey, count + list.node.childCount);
|
|
124
|
+
if (
|
|
125
|
+
list.node.attrs.listId !== list.listId ||
|
|
126
|
+
list.node.attrs.listStart !== listStart ||
|
|
127
|
+
list.node.attrs.start !== start
|
|
128
|
+
) {
|
|
129
|
+
changes.push({
|
|
130
|
+
pos: list.pos,
|
|
131
|
+
attrs: { ...list.node.attrs, listId: list.listId, listStart, start },
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return changes;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function applyNormalization(state: EditorState): Transaction | null {
|
|
139
|
+
const changes = normalizeOrderedListDocument(state.doc);
|
|
140
|
+
if (changes.length === 0) {
|
|
141
|
+
const lists = collectOrderedLists(state.doc);
|
|
142
|
+
const hasJoin = lists.some((list, index) => {
|
|
143
|
+
const next = lists[index + 1];
|
|
144
|
+
return (
|
|
145
|
+
next !== undefined &&
|
|
146
|
+
next.pos === list.pos + list.node.nodeSize &&
|
|
147
|
+
next.depth === list.depth &&
|
|
148
|
+
next.context === list.context &&
|
|
149
|
+
normalizeListId(next.node.attrs.listId) === normalizeListId(list.node.attrs.listId) &&
|
|
150
|
+
normalizeListStart(next.node.attrs.listStart) ===
|
|
151
|
+
normalizeListStart(list.node.attrs.listStart)
|
|
152
|
+
);
|
|
153
|
+
});
|
|
154
|
+
if (!hasJoin) return null;
|
|
155
|
+
}
|
|
156
|
+
const transaction = state.tr;
|
|
157
|
+
for (const change of changes) {
|
|
158
|
+
transaction.setNodeMarkup(change.pos, undefined, change.attrs);
|
|
159
|
+
}
|
|
160
|
+
const normalizedLists = collectOrderedLists(transaction.doc);
|
|
161
|
+
const joinPositions = normalizedLists.flatMap((list, index) => {
|
|
162
|
+
const next = normalizedLists[index + 1];
|
|
163
|
+
return next !== undefined &&
|
|
164
|
+
next.pos === list.pos + list.node.nodeSize &&
|
|
165
|
+
next.depth === list.depth &&
|
|
166
|
+
next.context === list.context &&
|
|
167
|
+
normalizeListId(next.node.attrs.listId) === normalizeListId(list.node.attrs.listId) &&
|
|
168
|
+
normalizeListStart(next.node.attrs.listStart) ===
|
|
169
|
+
normalizeListStart(list.node.attrs.listStart)
|
|
170
|
+
? [next.pos]
|
|
171
|
+
: [];
|
|
172
|
+
});
|
|
173
|
+
for (const pos of joinPositions.toReversed()) {
|
|
174
|
+
if (canJoin(transaction.doc, pos)) transaction.join(pos);
|
|
175
|
+
}
|
|
176
|
+
if (!transaction.docChanged) return null;
|
|
177
|
+
return transaction;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export function remapPastedSlice(slice: Slice): Slice {
|
|
181
|
+
const identities = new Map<string, { listId: string; listStart: number }>();
|
|
182
|
+
let missingIndex = 0;
|
|
183
|
+
const mapFragment = (fragment: Fragment, depth: number, parentContext: string): Fragment => {
|
|
184
|
+
const children: ProseMirrorNode[] = [];
|
|
185
|
+
fragment.forEach((node, _offset, index) => {
|
|
186
|
+
const childContext =
|
|
187
|
+
node.type.name === "listItem" ? `${parentContext}/listItem:${index}` : parentContext;
|
|
188
|
+
const content = mapFragment(node.content, depth + 1, childContext);
|
|
189
|
+
if (node.type.name !== "orderedList") {
|
|
190
|
+
children.push(node.copy(content));
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const sourceId = normalizeListId(node.attrs.listId) ?? `missing:${missingIndex++}`;
|
|
194
|
+
const scope = JSON.stringify([sourceId, depth, parentContext]);
|
|
195
|
+
let identity = identities.get(scope);
|
|
196
|
+
if (!identity) {
|
|
197
|
+
identity = {
|
|
198
|
+
listId: createListId(),
|
|
199
|
+
listStart:
|
|
200
|
+
normalizeListStart(node.attrs.start) ?? normalizeListStart(node.attrs.listStart) ?? 1,
|
|
201
|
+
};
|
|
202
|
+
identities.set(scope, identity);
|
|
203
|
+
}
|
|
204
|
+
children.push(
|
|
205
|
+
node.type.create(
|
|
206
|
+
{ ...node.attrs, ...identity, start: identity.listStart },
|
|
207
|
+
content,
|
|
208
|
+
node.marks,
|
|
209
|
+
),
|
|
210
|
+
);
|
|
211
|
+
});
|
|
212
|
+
return Fragment.fromArray(children);
|
|
213
|
+
};
|
|
214
|
+
return new Slice(mapFragment(slice.content, 0, "root"), slice.openStart, slice.openEnd);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
function sliceHasOrderedList(slice: Slice): boolean {
|
|
218
|
+
let found = false;
|
|
219
|
+
slice.content.descendants((node) => {
|
|
220
|
+
if (node.type.name !== "orderedList") return true;
|
|
221
|
+
found = true;
|
|
222
|
+
return false;
|
|
223
|
+
});
|
|
224
|
+
return found;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function displayedStartAtSelection(
|
|
228
|
+
state: EditorState,
|
|
229
|
+
): { listId: string; listStart: number } | null {
|
|
230
|
+
const current = collectOrderedLists(state.doc).findLast(
|
|
231
|
+
(list) =>
|
|
232
|
+
state.selection.from >= list.pos && state.selection.from <= list.pos + list.node.nodeSize,
|
|
233
|
+
);
|
|
234
|
+
if (!current) return null;
|
|
235
|
+
const listId = normalizeListId(current.node.attrs.listId);
|
|
236
|
+
const start = normalizeListStart(current.node.attrs.start);
|
|
237
|
+
if (!listId || start === undefined) return null;
|
|
238
|
+
let precedingItems = 0;
|
|
239
|
+
current.node.forEach((child, offset) => {
|
|
240
|
+
if (current.pos + 1 + offset + child.nodeSize <= state.selection.from) precedingItems++;
|
|
241
|
+
});
|
|
242
|
+
return {
|
|
243
|
+
listId,
|
|
244
|
+
listStart: normalizeListStart(start + precedingItems) ?? 1,
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function rewriteSliceIdentity(
|
|
249
|
+
slice: Slice,
|
|
250
|
+
sourceId: string,
|
|
251
|
+
listId: string,
|
|
252
|
+
listStart: number,
|
|
253
|
+
): Slice {
|
|
254
|
+
const mapFragment = (fragment: Fragment): Fragment => {
|
|
255
|
+
const children: ProseMirrorNode[] = [];
|
|
256
|
+
fragment.forEach((node) => {
|
|
257
|
+
const content = mapFragment(node.content);
|
|
258
|
+
children.push(
|
|
259
|
+
node.type.name === "orderedList" && normalizeListId(node.attrs.listId) === sourceId
|
|
260
|
+
? node.type.create(
|
|
261
|
+
{ ...node.attrs, listId, listStart, start: listStart },
|
|
262
|
+
content,
|
|
263
|
+
node.marks,
|
|
264
|
+
)
|
|
265
|
+
: node.copy(content),
|
|
266
|
+
);
|
|
267
|
+
});
|
|
268
|
+
return Fragment.fromArray(children);
|
|
269
|
+
};
|
|
270
|
+
return new Slice(mapFragment(slice.content), slice.openStart, slice.openEnd);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
export function prepareCopiedSlice(slice: Slice, state: EditorState): Slice {
|
|
274
|
+
const selected = displayedStartAtSelection(state);
|
|
275
|
+
if (!selected) return slice;
|
|
276
|
+
let updated = false;
|
|
277
|
+
const mapFragment = (fragment: Fragment): Fragment => {
|
|
278
|
+
const children: ProseMirrorNode[] = [];
|
|
279
|
+
fragment.forEach((node) => {
|
|
280
|
+
const isFirstSelectedList =
|
|
281
|
+
!updated &&
|
|
282
|
+
node.type.name === "orderedList" &&
|
|
283
|
+
normalizeListId(node.attrs.listId) === selected.listId;
|
|
284
|
+
if (isFirstSelectedList) updated = true;
|
|
285
|
+
const content = mapFragment(node.content);
|
|
286
|
+
if (isFirstSelectedList) {
|
|
287
|
+
children.push(
|
|
288
|
+
node.type.create({ ...node.attrs, start: selected.listStart }, content, node.marks),
|
|
289
|
+
);
|
|
290
|
+
} else {
|
|
291
|
+
children.push(node.copy(content));
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
return Fragment.fromArray(children);
|
|
295
|
+
};
|
|
296
|
+
return new Slice(mapFragment(slice.content), slice.openStart, slice.openEnd);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export function remapMovedSlice(slice: Slice, state: EditorState): Slice {
|
|
300
|
+
const selected = displayedStartAtSelection(state);
|
|
301
|
+
if (!selected) return slice;
|
|
302
|
+
return rewriteSliceIdentity(slice, selected.listId, createListId(), selected.listStart);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function findCurrentList(state: EditorState): {
|
|
306
|
+
current: OrderedListDescriptor;
|
|
307
|
+
lists: OrderedListDescriptor[];
|
|
308
|
+
} | null {
|
|
309
|
+
const lists = collectOrderedLists(state.doc);
|
|
310
|
+
const current = lists.findLast(
|
|
311
|
+
(list) =>
|
|
312
|
+
state.selection.from >= list.pos && state.selection.to <= list.pos + list.node.nodeSize,
|
|
313
|
+
);
|
|
314
|
+
if (!current) return null;
|
|
315
|
+
const intersecting = lists.filter(
|
|
316
|
+
(list) =>
|
|
317
|
+
list.depth === current.depth &&
|
|
318
|
+
list.context === current.context &&
|
|
319
|
+
state.selection.from < list.pos + list.node.nodeSize &&
|
|
320
|
+
state.selection.to > list.pos,
|
|
321
|
+
);
|
|
322
|
+
return intersecting.length === 1 ? { current, lists } : null;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function rewriteListTail(
|
|
326
|
+
state: EditorState,
|
|
327
|
+
dispatch: ((transaction: Transaction) => void) | undefined,
|
|
328
|
+
mode: "continue" | "restart",
|
|
329
|
+
): boolean {
|
|
330
|
+
const selected = findCurrentList(state);
|
|
331
|
+
if (!selected) return false;
|
|
332
|
+
const { current, lists } = selected;
|
|
333
|
+
const currentId = normalizeListId(current.node.attrs.listId);
|
|
334
|
+
if (!currentId) return false;
|
|
335
|
+
const compatible = lists.filter(
|
|
336
|
+
(list) => list.depth === current.depth && list.context === current.context,
|
|
337
|
+
);
|
|
338
|
+
const predecessor = compatible.findLast((list) => list.pos < current.pos);
|
|
339
|
+
const predecessorId = predecessor ? normalizeListId(predecessor.node.attrs.listId) : undefined;
|
|
340
|
+
if (mode === "continue" && (!predecessorId || predecessorId === currentId)) {
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
if (!dispatch) return true;
|
|
344
|
+
const listId = mode === "continue" ? predecessorId! : createListId();
|
|
345
|
+
const listStart =
|
|
346
|
+
mode === "continue" ? (normalizeListStart(predecessor!.node.attrs.listStart) ?? 1) : 1;
|
|
347
|
+
const transaction = state.tr;
|
|
348
|
+
for (const list of compatible) {
|
|
349
|
+
if (list.pos < current.pos || normalizeListId(list.node.attrs.listId) !== currentId) continue;
|
|
350
|
+
transaction.setNodeMarkup(list.pos, undefined, {
|
|
351
|
+
...list.node.attrs,
|
|
352
|
+
listId,
|
|
353
|
+
listStart,
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
dispatch(transaction);
|
|
357
|
+
return true;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function buildDropTransaction(
|
|
361
|
+
state: EditorState,
|
|
362
|
+
slice: Slice,
|
|
363
|
+
insertPos: number,
|
|
364
|
+
deleteSource: boolean,
|
|
365
|
+
): { transaction: Transaction; from: number; to: number } | null {
|
|
366
|
+
const transaction = state.tr;
|
|
367
|
+
if (deleteSource) transaction.deleteSelection();
|
|
368
|
+
const from = transaction.mapping.map(insertPos);
|
|
369
|
+
const beforeInsert = transaction.doc;
|
|
370
|
+
transaction.replaceRange(from, from, slice);
|
|
371
|
+
if (transaction.doc.eq(beforeInsert)) return null;
|
|
372
|
+
let to = from;
|
|
373
|
+
transaction.mapping.maps.at(-1)?.forEach((_oldFrom, _oldTo, _newFrom, newTo) => {
|
|
374
|
+
to = Math.max(to, newTo);
|
|
375
|
+
});
|
|
376
|
+
return { transaction, from, to };
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
function handleMovedListDrop(
|
|
380
|
+
view: EditorView,
|
|
381
|
+
event: DragEvent,
|
|
382
|
+
slice: Slice,
|
|
383
|
+
moved: boolean,
|
|
384
|
+
): boolean {
|
|
385
|
+
if (!sliceHasOrderedList(slice)) return false;
|
|
386
|
+
const eventPos = view.posAtCoords({ left: event.clientX, top: event.clientY });
|
|
387
|
+
if (!eventPos) return false;
|
|
388
|
+
const insertPos = dropPoint(view.state.doc, eventPos.pos, slice) ?? eventPos.pos;
|
|
389
|
+
if (!moved) {
|
|
390
|
+
const dropped = buildDropTransaction(view.state, remapPastedSlice(slice), insertPos, false);
|
|
391
|
+
if (!dropped) return false;
|
|
392
|
+
const selectionPos = Math.min(dropped.to, dropped.transaction.doc.content.size);
|
|
393
|
+
dropped.transaction.setSelection(
|
|
394
|
+
Selection.near(dropped.transaction.doc.resolve(selectionPos), -1),
|
|
395
|
+
);
|
|
396
|
+
view.focus();
|
|
397
|
+
view.dispatch(dropped.transaction.setMeta("uiEvent", "drop").scrollIntoView());
|
|
398
|
+
return true;
|
|
399
|
+
}
|
|
400
|
+
const selected = findCurrentList(view.state);
|
|
401
|
+
if (!selected) return false;
|
|
402
|
+
const preview = buildDropTransaction(view.state, slice, insertPos, true);
|
|
403
|
+
if (!preview) return false;
|
|
404
|
+
const sourceContextPos = selected.current.contextPos;
|
|
405
|
+
const mappedSourceContextPos =
|
|
406
|
+
sourceContextPos === null ? null : preview.transaction.mapping.map(sourceContextPos, 1);
|
|
407
|
+
const remainsInContext = collectOrderedLists(preview.transaction.doc).some(
|
|
408
|
+
(list) =>
|
|
409
|
+
list.pos < preview.to &&
|
|
410
|
+
list.pos + list.node.nodeSize > preview.from &&
|
|
411
|
+
list.depth === selected.current.depth &&
|
|
412
|
+
list.contextPos === mappedSourceContextPos,
|
|
413
|
+
);
|
|
414
|
+
if (remainsInContext) return false;
|
|
415
|
+
const remapped = remapMovedSlice(slice, view.state);
|
|
416
|
+
if (remapped === slice) return false;
|
|
417
|
+
const dropped = buildDropTransaction(view.state, remapped, insertPos, true);
|
|
418
|
+
if (!dropped) return false;
|
|
419
|
+
const selectionPos = Math.min(dropped.to, dropped.transaction.doc.content.size);
|
|
420
|
+
dropped.transaction.setSelection(
|
|
421
|
+
Selection.near(dropped.transaction.doc.resolve(selectionPos), -1),
|
|
422
|
+
);
|
|
423
|
+
view.focus();
|
|
424
|
+
view.dispatch(dropped.transaction.setMeta("uiEvent", "drop").scrollIntoView());
|
|
425
|
+
return true;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
export const EmDashOrderedList = OrderedList.extend({
|
|
429
|
+
addAttributes() {
|
|
430
|
+
const parent = this.parent?.() ?? {};
|
|
431
|
+
return {
|
|
432
|
+
...parent,
|
|
433
|
+
start: {
|
|
434
|
+
...parent.start,
|
|
435
|
+
parseHTML: (element) =>
|
|
436
|
+
normalizeListStart(Number(element.dataset.emdashListFirst)) ??
|
|
437
|
+
normalizeListStart(Number(element.getAttribute("start"))) ??
|
|
438
|
+
1,
|
|
439
|
+
},
|
|
440
|
+
listId: {
|
|
441
|
+
default: null,
|
|
442
|
+
parseHTML: (element) => normalizeListId(element.dataset.emdashListId) ?? null,
|
|
443
|
+
rendered: false,
|
|
444
|
+
},
|
|
445
|
+
listStart: {
|
|
446
|
+
default: null,
|
|
447
|
+
parseHTML: (element) => normalizeListStart(Number(element.dataset.emdashListStart)) ?? null,
|
|
448
|
+
rendered: false,
|
|
449
|
+
},
|
|
450
|
+
};
|
|
451
|
+
},
|
|
452
|
+
|
|
453
|
+
renderHTML({ HTMLAttributes, node }) {
|
|
454
|
+
const { start: _start, ...attributesWithoutStart } = HTMLAttributes;
|
|
455
|
+
const start = normalizeListStart(node.attrs.start) ?? 1;
|
|
456
|
+
const continuityAttributes = {
|
|
457
|
+
"data-emdash-list-id": normalizeListId(node.attrs.listId),
|
|
458
|
+
"data-emdash-list-start": normalizeListStart(node.attrs.listStart),
|
|
459
|
+
"data-emdash-list-first": start,
|
|
460
|
+
};
|
|
461
|
+
return start === 1
|
|
462
|
+
? [
|
|
463
|
+
"ol",
|
|
464
|
+
mergeAttributes(
|
|
465
|
+
this.options.HTMLAttributes,
|
|
466
|
+
attributesWithoutStart,
|
|
467
|
+
continuityAttributes,
|
|
468
|
+
),
|
|
469
|
+
0,
|
|
470
|
+
]
|
|
471
|
+
: [
|
|
472
|
+
"ol",
|
|
473
|
+
mergeAttributes(
|
|
474
|
+
this.options.HTMLAttributes,
|
|
475
|
+
{ ...attributesWithoutStart, start },
|
|
476
|
+
continuityAttributes,
|
|
477
|
+
),
|
|
478
|
+
0,
|
|
479
|
+
];
|
|
480
|
+
},
|
|
481
|
+
|
|
482
|
+
addCommands() {
|
|
483
|
+
return {
|
|
484
|
+
toggleOrderedList:
|
|
485
|
+
() =>
|
|
486
|
+
({ commands, chain }) => {
|
|
487
|
+
if (this.editor.isActive(this.name)) {
|
|
488
|
+
return commands.toggleList(
|
|
489
|
+
this.name,
|
|
490
|
+
this.options.itemTypeName,
|
|
491
|
+
this.options.keepMarks,
|
|
492
|
+
);
|
|
493
|
+
}
|
|
494
|
+
return chain()
|
|
495
|
+
.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
496
|
+
.updateAttributes(this.name, {
|
|
497
|
+
listId: createListId(),
|
|
498
|
+
listStart: 1,
|
|
499
|
+
})
|
|
500
|
+
.run();
|
|
501
|
+
},
|
|
502
|
+
continueOrderedList:
|
|
503
|
+
() =>
|
|
504
|
+
({ state, dispatch }) =>
|
|
505
|
+
rewriteListTail(state, dispatch, "continue"),
|
|
506
|
+
restartOrderedList:
|
|
507
|
+
() =>
|
|
508
|
+
({ state, dispatch }) =>
|
|
509
|
+
rewriteListTail(state, dispatch, "restart"),
|
|
510
|
+
};
|
|
511
|
+
},
|
|
512
|
+
|
|
513
|
+
addInputRules() {
|
|
514
|
+
return [
|
|
515
|
+
wrappingInputRule({
|
|
516
|
+
find: ORDERED_LIST_INPUT_REGEX,
|
|
517
|
+
type: this.type,
|
|
518
|
+
getAttributes: (match) => {
|
|
519
|
+
const listStart = normalizeListStart(Number(match[1])) ?? 1;
|
|
520
|
+
return { start: listStart, listStart, listId: createListId() };
|
|
521
|
+
},
|
|
522
|
+
joinPredicate: () => false,
|
|
523
|
+
}),
|
|
524
|
+
];
|
|
525
|
+
},
|
|
526
|
+
|
|
527
|
+
addProseMirrorPlugins() {
|
|
528
|
+
return [
|
|
529
|
+
new Plugin({
|
|
530
|
+
appendTransaction: (_transactions, _oldState, newState) => applyNormalization(newState),
|
|
531
|
+
props: {
|
|
532
|
+
transformCopied: (slice, view) => prepareCopiedSlice(slice, view.state),
|
|
533
|
+
handleDrop: handleMovedListDrop,
|
|
534
|
+
handlePaste(view, _event, slice) {
|
|
535
|
+
if (!sliceHasOrderedList(slice)) return false;
|
|
536
|
+
view.dispatch(
|
|
537
|
+
view.state.tr
|
|
538
|
+
.replaceSelection(remapPastedSlice(slice))
|
|
539
|
+
.setMeta("paste", true)
|
|
540
|
+
.setMeta("uiEvent", "paste")
|
|
541
|
+
.scrollIntoView(),
|
|
542
|
+
);
|
|
543
|
+
return true;
|
|
544
|
+
},
|
|
545
|
+
},
|
|
546
|
+
}),
|
|
547
|
+
];
|
|
548
|
+
},
|
|
549
|
+
});
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type { ProseMirrorDocument, ProseMirrorNode } from "./types.js";
|
|
2
|
+
|
|
3
|
+
export const MAX_ORDERED_LIST_START = 2_147_483_647;
|
|
4
|
+
|
|
5
|
+
export interface OrderedListMetadata {
|
|
6
|
+
listId: string;
|
|
7
|
+
listStart: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function normalizeListId(value: unknown): string | undefined {
|
|
11
|
+
if (typeof value !== "string") return undefined;
|
|
12
|
+
const normalized = value.trim();
|
|
13
|
+
return normalized.length > 0 && normalized.length <= 128 ? normalized : undefined;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function normalizeListStart(value: unknown): number | undefined {
|
|
17
|
+
return typeof value === "number" &&
|
|
18
|
+
Number.isInteger(value) &&
|
|
19
|
+
value >= 1 &&
|
|
20
|
+
value <= MAX_ORDERED_LIST_START
|
|
21
|
+
? value
|
|
22
|
+
: undefined;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function deriveLegacyListId(seed: string): string {
|
|
26
|
+
const readable = `legacy:${seed}`;
|
|
27
|
+
if (readable.length <= 128) return readable;
|
|
28
|
+
let hash = 2_166_136_261;
|
|
29
|
+
for (let i = 0; i < seed.length; i++) {
|
|
30
|
+
hash ^= seed.charCodeAt(i);
|
|
31
|
+
hash = Math.imul(hash, 16_777_619);
|
|
32
|
+
}
|
|
33
|
+
return `legacy:${seed.slice(0, 96)}:${(hash >>> 0).toString(36)}:${seed.length.toString(36)}`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function readOrderedListMetadata(
|
|
37
|
+
attrs: Record<string, unknown> | undefined,
|
|
38
|
+
fallbackId: string,
|
|
39
|
+
): OrderedListMetadata {
|
|
40
|
+
return {
|
|
41
|
+
listId: normalizeListId(attrs?.listId) ?? deriveLegacyListId(fallbackId),
|
|
42
|
+
listStart: normalizeListStart(attrs?.listStart) ?? normalizeListStart(attrs?.start) ?? 1,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface ProseMirrorListDescriptor {
|
|
47
|
+
node: ProseMirrorNode;
|
|
48
|
+
path: string;
|
|
49
|
+
depth: number;
|
|
50
|
+
context: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function collectProseMirrorOrderedLists(doc: ProseMirrorDocument): ProseMirrorListDescriptor[] {
|
|
54
|
+
const lists: ProseMirrorListDescriptor[] = [];
|
|
55
|
+
const visit = (node: ProseMirrorNode, path: string, depth: number, context: string) => {
|
|
56
|
+
if (node.type === "orderedList") lists.push({ node, path, depth, context });
|
|
57
|
+
for (const [index, child] of (node.content ?? []).entries()) {
|
|
58
|
+
const childPath = `${path}:${index}`;
|
|
59
|
+
visit(
|
|
60
|
+
child,
|
|
61
|
+
childPath,
|
|
62
|
+
depth + 1,
|
|
63
|
+
child.type === "listItem" ? `listItem:${childPath}` : context,
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
for (const [index, node] of doc.content.entries()) {
|
|
68
|
+
visit(node, `root:${index}`, 0, "root");
|
|
69
|
+
}
|
|
70
|
+
return lists;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function cloneProseMirrorNode(node: ProseMirrorNode): ProseMirrorNode {
|
|
74
|
+
return {
|
|
75
|
+
...node,
|
|
76
|
+
attrs: node.attrs ? { ...node.attrs } : undefined,
|
|
77
|
+
content: node.content?.map(cloneProseMirrorNode),
|
|
78
|
+
marks: node.marks?.map((mark) => ({
|
|
79
|
+
...mark,
|
|
80
|
+
attrs: mark.attrs ? { ...mark.attrs } : undefined,
|
|
81
|
+
})),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function createRepairId(sourceId: string, scope: string, attempt: number): string {
|
|
86
|
+
const base = deriveLegacyListId(`repair:${sourceId}:${scope}`);
|
|
87
|
+
const suffix = `:${attempt.toString(36)}`;
|
|
88
|
+
return `${base.slice(0, 128 - suffix.length)}${suffix}`;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function normalizeProseMirrorOrderedListJson(doc: ProseMirrorDocument): ProseMirrorDocument {
|
|
92
|
+
const normalized = {
|
|
93
|
+
...doc,
|
|
94
|
+
content: doc.content.map(cloneProseMirrorNode),
|
|
95
|
+
};
|
|
96
|
+
const canonicalBySourceScope = new Map<string, string>();
|
|
97
|
+
const assignedCanonicalIds = new Set<string>();
|
|
98
|
+
const lists = collectProseMirrorOrderedLists(normalized).map((list) => {
|
|
99
|
+
const sourceId =
|
|
100
|
+
normalizeListId(list.node.attrs?.listId) ??
|
|
101
|
+
deriveLegacyListId(`pm-json:${list.path}:${list.depth}:${list.context}`);
|
|
102
|
+
const scope = JSON.stringify([list.depth, list.context]);
|
|
103
|
+
const sourceScope = JSON.stringify([sourceId, scope]);
|
|
104
|
+
let listId = canonicalBySourceScope.get(sourceScope);
|
|
105
|
+
if (!listId) {
|
|
106
|
+
if (!assignedCanonicalIds.has(sourceId)) {
|
|
107
|
+
listId = sourceId;
|
|
108
|
+
} else {
|
|
109
|
+
let attempt = 0;
|
|
110
|
+
do {
|
|
111
|
+
listId = createRepairId(sourceId, scope, attempt++);
|
|
112
|
+
} while (assignedCanonicalIds.has(listId));
|
|
113
|
+
}
|
|
114
|
+
canonicalBySourceScope.set(sourceScope, listId);
|
|
115
|
+
assignedCanonicalIds.add(listId);
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
...list,
|
|
119
|
+
listId,
|
|
120
|
+
scopeKey: JSON.stringify([listId, list.depth, list.context]),
|
|
121
|
+
};
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
const bases = new Map<string, number>();
|
|
125
|
+
for (const list of lists) {
|
|
126
|
+
const listStart = normalizeListStart(list.node.attrs?.listStart);
|
|
127
|
+
if (listStart !== undefined && !bases.has(list.scopeKey)) {
|
|
128
|
+
bases.set(list.scopeKey, listStart);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
for (const list of lists) {
|
|
132
|
+
if (!bases.has(list.scopeKey)) {
|
|
133
|
+
bases.set(list.scopeKey, normalizeListStart(list.node.attrs?.start) ?? 1);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const counts = new Map<string, number>();
|
|
138
|
+
for (const list of lists) {
|
|
139
|
+
const listStart = bases.get(list.scopeKey)!;
|
|
140
|
+
const count = counts.get(list.scopeKey) ?? 0;
|
|
141
|
+
const start = normalizeListStart(listStart + count) ?? 1;
|
|
142
|
+
const directItemCount =
|
|
143
|
+
list.node.content?.filter((node) => node.type === "listItem").length ?? 0;
|
|
144
|
+
counts.set(list.scopeKey, count + directItemCount);
|
|
145
|
+
list.node.attrs = { ...list.node.attrs, listId: list.listId, listStart, start };
|
|
146
|
+
}
|
|
147
|
+
return normalized;
|
|
148
|
+
}
|