pagescms 0.0.0-stage → 3.0.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/LICENSE +21 -0
- package/README.md +66 -2
- package/dist/package/_headers +7 -0
- package/dist/package/cli.mjs +138 -0
- package/dist/package/config-CAscGjBB.js +123 -0
- package/dist/package/config.mjs +1 -0
- package/dist/package/favicon.ico +0 -0
- package/dist/package/favicon.svg +16 -0
- package/dist/package/generate-B-YdQuMX.js +48 -0
- package/dist/package/generate.mjs +1 -0
- package/dist/package/images/astro-blog-template.webp +0 -0
- package/dist/package/images/eleventy-blog-template.webp +0 -0
- package/dist/package/images/email-logo.png +0 -0
- package/dist/package/images/nextjs-blog-template.webp +0 -0
- package/dist/package/images/social-card.png +0 -0
- package/dist/package/migrate.mjs +184 -0
- package/dist/package/reference/docs/configuration/actions.md +160 -0
- package/dist/package/reference/docs/configuration/components.md +56 -0
- package/dist/package/reference/docs/configuration/content/filename.md +63 -0
- package/dist/package/reference/docs/configuration/content/formats.md +63 -0
- package/dist/package/reference/docs/configuration/content/index.md +138 -0
- package/dist/package/reference/docs/configuration/content/view.md +52 -0
- package/dist/package/reference/docs/configuration/fields/block.md +62 -0
- package/dist/package/reference/docs/configuration/fields/boolean.md +22 -0
- package/dist/package/reference/docs/configuration/fields/code.md +29 -0
- package/dist/package/reference/docs/configuration/fields/date.md +35 -0
- package/dist/package/reference/docs/configuration/fields/file.md +34 -0
- package/dist/package/reference/docs/configuration/fields/image.md +48 -0
- package/dist/package/reference/docs/configuration/fields/index.md +130 -0
- package/dist/package/reference/docs/configuration/fields/number.md +28 -0
- package/dist/package/reference/docs/configuration/fields/object.md +63 -0
- package/dist/package/reference/docs/configuration/fields/reference.md +64 -0
- package/dist/package/reference/docs/configuration/fields/rich-text.md +126 -0
- package/dist/package/reference/docs/configuration/fields/select.md +48 -0
- package/dist/package/reference/docs/configuration/fields/string.md +31 -0
- package/dist/package/reference/docs/configuration/fields/text.md +30 -0
- package/dist/package/reference/docs/configuration/fields/uuid.md +28 -0
- package/dist/package/reference/docs/configuration/index.md +88 -0
- package/dist/package/reference/docs/configuration/localization.md +138 -0
- package/dist/package/reference/docs/configuration/media.md +77 -0
- package/dist/package/reference/docs/configuration/settings.md +85 -0
- package/dist/package/reference/docs/extending/custom-field.md +107 -0
- package/dist/package/reference/docs/extending/field-api.md +71 -0
- package/dist/package/reference/docs/extending/plugins.md +67 -0
- package/dist/package/reference/docs/guides/actions.md +14 -0
- package/dist/package/reference/docs/guides/collaborators.md +43 -0
- package/dist/package/reference/docs/guides/editing.md +36 -0
- package/dist/package/reference/docs/guides/media.md +24 -0
- package/dist/package/reference/docs/guides/translations.md +40 -0
- package/dist/package/reference/docs/how-it-works.md +33 -0
- package/dist/package/reference/docs/index.md +25 -0
- package/dist/package/reference/docs/quick-start.md +87 -0
- package/dist/package/reference/docs/reference.md +84 -0
- package/dist/package/reference/docs/self-hosting/cloudflare.md +62 -0
- package/dist/package/reference/docs/self-hosting/environment-variables.md +84 -0
- package/dist/package/reference/docs/self-hosting/github-app.md +54 -0
- package/dist/package/reference/docs/self-hosting/index.md +44 -0
- package/dist/package/reference/docs/self-hosting/netlify.md +41 -0
- package/dist/package/reference/docs/self-hosting/node.md +42 -0
- package/dist/package/reference/docs/self-hosting/upgrading.md +44 -0
- package/dist/package/reference/docs/self-hosting/vercel.md +41 -0
- package/dist/package/reference/docs.json +119 -0
- package/dist/package/reference/manifest.json +190 -0
- package/dist/package/reference.md +79 -0
- package/dist/package/serve-D2bbxXbp.js +25 -0
- package/dist/package/smtp.mjs +13 -0
- package/dist/package/vite-BUlNpf2j.js +260 -0
- package/dist/package/vite.mjs +1 -0
- package/dist/types/client/api/account.d.ts +33 -0
- package/dist/types/client/api/actions.d.ts +67 -0
- package/dist/types/client/api/activity.d.ts +4 -0
- package/dist/types/client/api/admin.d.ts +11 -0
- package/dist/types/client/api/auth.d.ts +375 -0
- package/dist/types/client/api/authentication.d.ts +2 -0
- package/dist/types/client/api/cache.d.ts +6 -0
- package/dist/types/client/api/collaborators.d.ts +13 -0
- package/dist/types/client/api/collections.d.ts +4 -0
- package/dist/types/client/api/configuration.d.ts +10 -0
- package/dist/types/client/api/dashboard.d.ts +2 -0
- package/dist/types/client/api/entries.d.ts +14 -0
- package/dist/types/client/api/entry-write.d.ts +3394 -0
- package/dist/types/client/api/fixed-file.d.ts +11 -0
- package/dist/types/client/api/index.d.ts +8 -0
- package/dist/types/client/api/local-account.d.ts +1 -0
- package/dist/types/client/api/media.d.ts +38 -0
- package/dist/types/client/api/reference.d.ts +7 -0
- package/dist/types/client/api/repositories.d.ts +1 -0
- package/dist/types/client/api/repository-search.d.ts +6 -0
- package/dist/types/client/api/repository.d.ts +14 -0
- package/dist/types/client/queries/admin.d.ts +179 -0
- package/dist/types/client/queries/content.d.ts +2012 -0
- package/dist/types/client/queries/file-history.d.ts +13 -0
- package/dist/types/client/queries/keys.d.ts +32 -0
- package/dist/types/client/queries/references.d.ts +59 -0
- package/dist/types/client/queries/repository-invalidation.d.ts +7 -0
- package/dist/types/client/queries/repository.d.ts +271 -0
- package/dist/types/client/queries/session.d.ts +116 -0
- package/dist/types/client.d.ts +1 -0
- package/dist/types/components/action-history-menu.d.ts +11 -0
- package/dist/types/components/code-editor-language.d.ts +1 -0
- package/dist/types/components/code-editor.d.ts +23 -0
- package/dist/types/components/code-field.d.ts +10 -0
- package/dist/types/components/collaborator-identity.d.ts +5 -0
- package/dist/types/components/collaborator-invite-input.d.ts +8 -0
- package/dist/types/components/collaborators-loading.d.ts +2 -0
- package/dist/types/components/collection-entry-creator.d.ts +14 -0
- package/dist/types/components/component-preloading.d.ts +1 -0
- package/dist/types/components/content-entry-editor.d.ts +20 -0
- package/dist/types/components/content-entry-skeleton.d.ts +4 -0
- package/dist/types/components/content-icon.d.ts +8 -0
- package/dist/types/components/dropdown-loading-row.d.ts +5 -0
- package/dist/types/components/editor-layout.d.ts +5 -0
- package/dist/types/components/editor-skeleton.d.ts +4 -0
- package/dist/types/components/error-alert.d.ts +6 -0
- package/dist/types/components/file-editor-history.d.ts +4 -0
- package/dist/types/components/file-editor-menu.d.ts +12 -0
- package/dist/types/components/github-icon.d.ts +2 -0
- package/dist/types/components/gradient-avatar-fallback.d.ts +4 -0
- package/dist/types/components/media-file-icon.d.ts +4 -0
- package/dist/types/components/media-thumbnail.d.ts +18 -0
- package/dist/types/components/operation-error.d.ts +18 -0
- package/dist/types/components/option-combobox.d.ts +24 -0
- package/dist/types/components/otp-verification-form.d.ts +13 -0
- package/dist/types/components/repository-action-buttons.d.ts +24 -0
- package/dist/types/components/repository-breadcrumb.d.ts +11 -0
- package/dist/types/components/repository-page-header.d.ts +15 -0
- package/dist/types/components/repository-shell.d.ts +26 -0
- package/dist/types/components/rich-text-field.d.ts +13 -0
- package/dist/types/components/root-error.d.ts +2 -0
- package/dist/types/components/search-input.d.ts +7 -0
- package/dist/types/components/settings-back-link.d.ts +4 -0
- package/dist/types/components/settings-layout.d.ts +17 -0
- package/dist/types/components/settings-loading.d.ts +2 -0
- package/dist/types/components/settings-row.d.ts +2 -0
- package/dist/types/components/sign-in-form.d.ts +6 -0
- package/dist/types/components/startup-error.d.ts +1 -0
- package/dist/types/components/structured-content-field.d.ts +23 -0
- package/dist/types/components/table-pager.d.ts +9 -0
- package/dist/types/components/ui/alert-dialog.d.ts +18 -0
- package/dist/types/components/ui/alert.d.ts +10 -0
- package/dist/types/components/ui/avatar.d.ts +12 -0
- package/dist/types/components/ui/badge.d.ts +9 -0
- package/dist/types/components/ui/breadcrumb.d.ts +11 -0
- package/dist/types/components/ui/button-group.d.ts +11 -0
- package/dist/types/components/ui/button.d.ts +10 -0
- package/dist/types/components/ui/card.d.ts +11 -0
- package/dist/types/components/ui/checkbox.d.ts +4 -0
- package/dist/types/components/ui/collapsible.d.ts +5 -0
- package/dist/types/components/ui/combobox.d.ts +27 -0
- package/dist/types/components/ui/command.d.ts +18 -0
- package/dist/types/components/ui/dialog.d.ts +17 -0
- package/dist/types/components/ui/dropdown-menu.d.ts +29 -0
- package/dist/types/components/ui/editor/blockquote.d.ts +3 -0
- package/dist/types/components/ui/editor/document.d.ts +6 -0
- package/dist/types/components/ui/editor/html-policy.d.ts +20 -0
- package/dist/types/components/ui/editor/image.d.ts +12 -0
- package/dist/types/components/ui/editor/index.d.ts +52 -0
- package/dist/types/components/ui/editor/preserve.d.ts +39 -0
- package/dist/types/components/ui/editor/slash-command/commands-list.d.ts +24 -0
- package/dist/types/components/ui/editor/slash-command/commands.d.ts +14 -0
- package/dist/types/components/ui/editor/slash-command/suggestion.d.ts +42 -0
- package/dist/types/components/ui/empty.d.ts +11 -0
- package/dist/types/components/ui/field.d.ts +24 -0
- package/dist/types/components/ui/input-group.d.ts +16 -0
- package/dist/types/components/ui/input-otp.d.ts +11 -0
- package/dist/types/components/ui/input.d.ts +3 -0
- package/dist/types/components/ui/label.d.ts +4 -0
- package/dist/types/components/ui/pagination.d.ts +17 -0
- package/dist/types/components/ui/popover.d.ts +10 -0
- package/dist/types/components/ui/progress.d.ts +4 -0
- package/dist/types/components/ui/radio-group.d.ts +5 -0
- package/dist/types/components/ui/scroll-area.d.ts +5 -0
- package/dist/types/components/ui/select.d.ts +15 -0
- package/dist/types/components/ui/separator.d.ts +4 -0
- package/dist/types/components/ui/sheet.d.ts +14 -0
- package/dist/types/components/ui/sidebar.d.ts +69 -0
- package/dist/types/components/ui/skeleton.d.ts +2 -0
- package/dist/types/components/ui/sonner.d.ts +3 -0
- package/dist/types/components/ui/spinner.d.ts +3 -0
- package/dist/types/components/ui/switch.d.ts +6 -0
- package/dist/types/components/ui/table.d.ts +19 -0
- package/dist/types/components/ui/tabs.d.ts +11 -0
- package/dist/types/components/ui/textarea.d.ts +3 -0
- package/dist/types/components/ui/toggle-group.d.ts +10 -0
- package/dist/types/components/ui/toggle.d.ts +9 -0
- package/dist/types/components/ui/tooltip.d.ts +7 -0
- package/dist/types/deployment/builtins/resend-email.server.d.ts +2 -0
- package/dist/types/deployment/conformance/media-storage.d.ts +15 -0
- package/dist/types/deployment/contracts/client.d.ts +17 -0
- package/dist/types/deployment/contracts/server.server.d.ts +15 -0
- package/dist/types/deployment/contracts/version.d.ts +4 -0
- package/dist/types/deployment/default/client.d.ts +2 -0
- package/dist/types/deployment/default/server.server.d.ts +2 -0
- package/dist/types/features/account/account-copy.d.ts +11 -0
- package/dist/types/features/account/account-deleted-notice.d.ts +3 -0
- package/dist/types/features/account/account-menu.d.ts +7 -0
- package/dist/types/features/account/account-messages.d.ts +2 -0
- package/dist/types/features/account/app-header.d.ts +6 -0
- package/dist/types/features/account/content-editing-preferences.d.ts +3 -0
- package/dist/types/features/account/delete-account.d.ts +6 -0
- package/dist/types/features/account/language-field.d.ts +6 -0
- package/dist/types/features/account/language-preference.d.ts +4 -0
- package/dist/types/features/account/local-account-data.d.ts +1 -0
- package/dist/types/features/account/local-account-storage.d.ts +8 -0
- package/dist/types/features/account/profile-editor.d.ts +51 -0
- package/dist/types/features/account/profile-fields.d.ts +17 -0
- package/dist/types/features/account/profile-loading.d.ts +1 -0
- package/dist/types/features/account/profile-picture.d.ts +13 -0
- package/dist/types/features/account/profile-settings.d.ts +8 -0
- package/dist/types/features/account/profile-setup-heading.d.ts +1 -0
- package/dist/types/features/account/profile-setup.d.ts +5 -0
- package/dist/types/features/account/require-profile.d.ts +6 -0
- package/dist/types/features/account/sign-in-layout.d.ts +5 -0
- package/dist/types/features/account/sign-in-page.d.ts +9 -0
- package/dist/types/features/account/theme-preference.d.ts +1 -0
- package/dist/types/features/account/use-account-preferences.d.ts +14 -0
- package/dist/types/features/account/use-profile-editor.d.ts +41 -0
- package/dist/types/features/account/use-profile-update.d.ts +19 -0
- package/dist/types/features/activity/activity-feed-item.d.ts +7 -0
- package/dist/types/features/activity/activity-feed-skeleton.d.ts +1 -0
- package/dist/types/features/activity/activity-feed.d.ts +11 -0
- package/dist/types/features/activity/activity-query.d.ts +5 -0
- package/dist/types/features/admin/action-run-status.d.ts +5 -0
- package/dist/types/features/admin/actions-page.d.ts +9 -0
- package/dist/types/features/admin/actions-skeleton.d.ts +1 -0
- package/dist/types/features/admin/admin-loading.d.ts +5 -0
- package/dist/types/features/admin/admin-page.d.ts +2 -0
- package/dist/types/features/admin/allowlist-table.d.ts +12 -0
- package/dist/types/features/admin/cache-copy.d.ts +4 -0
- package/dist/types/features/admin/cache-files-trigger.d.ts +1 -0
- package/dist/types/features/admin/cache-files.d.ts +6 -0
- package/dist/types/features/admin/cache-page.d.ts +6 -0
- package/dist/types/features/admin/cache-skeleton.d.ts +1 -0
- package/dist/types/features/admin/collaborators-page.d.ts +6 -0
- package/dist/types/features/admin/collaborators-skeleton.d.ts +2 -0
- package/dist/types/features/admin/configuration-contribution.d.ts +5 -0
- package/dist/types/features/admin/configuration-page.d.ts +9 -0
- package/dist/types/features/admin/configuration-setup.d.ts +1 -0
- package/dist/types/features/admin/configuration-skeleton.d.ts +1 -0
- package/dist/types/features/admin/plugin-page.d.ts +14 -0
- package/dist/types/features/admin/repository-actions-page.d.ts +1 -0
- package/dist/types/features/admin/repository-admin-access.d.ts +6 -0
- package/dist/types/features/admin/repository-admin-page.d.ts +12 -0
- package/dist/types/features/admin/repository-configuration-page.d.ts +1 -0
- package/dist/types/features/admin/sign-in-allowlist.d.ts +1 -0
- package/dist/types/features/admin/use-action-run-tracking.d.ts +5 -0
- package/dist/types/features/collaborators/collaborator-status.d.ts +4 -0
- package/dist/types/features/collaborators/collaborators-contribution.d.ts +5 -0
- package/dist/types/features/collections/collection-cell.d.ts +25 -0
- package/dist/types/features/collections/collection-header.d.ts +28 -0
- package/dist/types/features/collections/collection-model.d.ts +32 -0
- package/dist/types/features/collections/collection-page.d.ts +4 -0
- package/dist/types/features/collections/collection-skeleton.d.ts +1 -0
- package/dist/types/features/collections/collection-table-layout.d.ts +18 -0
- package/dist/types/features/collections/collection-table.d.ts +44 -0
- package/dist/types/features/content/content-mutations.d.ts +78 -0
- package/dist/types/features/content/unavailable-entry.d.ts +6 -0
- package/dist/types/features/content/use-entry-actions.d.ts +100 -0
- package/dist/types/features/dashboard/about-dialog.d.ts +2 -0
- package/dist/types/features/dashboard/branch-manager.d.ts +8 -0
- package/dist/types/features/dashboard/branch-picker.d.ts +2 -0
- package/dist/types/features/dashboard/create-branch-dialog.d.ts +8 -0
- package/dist/types/features/dashboard/recent-repositories.d.ts +14 -0
- package/dist/types/features/dashboard/recent-repository-list.d.ts +3 -0
- package/dist/types/features/dashboard/relative-time.d.ts +1 -0
- package/dist/types/features/dashboard/repository-dashboard.d.ts +13 -0
- package/dist/types/features/dashboard/repository-loading.d.ts +10 -0
- package/dist/types/features/dashboard/repository-selector.d.ts +10 -0
- package/dist/types/features/dashboard/repository-template-preview.d.ts +8 -0
- package/dist/types/features/dashboard/repository-templates.d.ts +5 -0
- package/dist/types/features/drafts/collection-creation.d.ts +20 -0
- package/dist/types/features/drafts/draft-discard-dialog.d.ts +8 -0
- package/dist/types/features/drafts/draft-field-preview.d.ts +10 -0
- package/dist/types/features/drafts/draft-merge-dialog.d.ts +11 -0
- package/dist/types/features/drafts/draft-merge-fields.d.ts +2 -0
- package/dist/types/features/drafts/draft-read-cache.d.ts +13 -0
- package/dist/types/features/drafts/draft-save-button.d.ts +19 -0
- package/dist/types/features/drafts/draft-session.d.ts +63 -0
- package/dist/types/features/drafts/draft-store.d.ts +44 -0
- package/dist/types/features/drafts/merge-draft.d.ts +22 -0
- package/dist/types/features/drafts/relative-age.d.ts +1 -0
- package/dist/types/features/drafts/saved-draft-menu.d.ts +6 -0
- package/dist/types/features/drafts/use-content-draft.d.ts +30 -0
- package/dist/types/features/drafts/use-draft-merge.d.ts +15 -0
- package/dist/types/features/drafts/use-duplicate-entry.d.ts +7 -0
- package/dist/types/features/drafts/use-review-viewport.d.ts +28 -0
- package/dist/types/features/editor/commit-message-dialog.d.ts +8 -0
- package/dist/types/features/editor/editor-component-loaders.d.ts +8 -0
- package/dist/types/features/editor/entry-breadcrumb.d.ts +28 -0
- package/dist/types/features/editor/entry-page-header.d.ts +9 -0
- package/dist/types/features/editor/entry-title.d.ts +13 -0
- package/dist/types/features/editor/field-locale-menu.d.ts +10 -0
- package/dist/types/features/editor/field-locale-values.d.ts +5 -0
- package/dist/types/features/editor/fields/core-field-renderers.d.ts +1 -0
- package/dist/types/features/editor/fields/custom-field-components.d.ts +3 -0
- package/dist/types/features/editor/fields/field-renderer-registry.d.ts +23 -0
- package/dist/types/features/editor/fields/field-types.d.ts +15 -0
- package/dist/types/features/editor/fields/field-validation.d.ts +27 -0
- package/dist/types/features/editor/fields/structured-field-options.d.ts +9 -0
- package/dist/types/features/editor/fields/use-reference-options.d.ts +14 -0
- package/dist/types/features/editor/file-locale-menu.d.ts +26 -0
- package/dist/types/features/editor/locale-context.d.ts +31 -0
- package/dist/types/features/editor/locale-selection.d.ts +13 -0
- package/dist/types/features/editor/rich-text-media.d.ts +10 -0
- package/dist/types/features/editor/start-translation-dialog.d.ts +10 -0
- package/dist/types/features/editor/translation-preferences.d.ts +8 -0
- package/dist/types/features/editor/translation-start.d.ts +13 -0
- package/dist/types/features/media/media-breadcrumb.d.ts +8 -0
- package/dist/types/features/media/media-browser.d.ts +23 -0
- package/dist/types/features/media/media-delivery.d.ts +35 -0
- package/dist/types/features/media/media-drag-overlay.d.ts +1 -0
- package/dist/types/features/media/media-entry.d.ts +21 -0
- package/dist/types/features/media/media-folder-tree.d.ts +8 -0
- package/dist/types/features/media/media-model.d.ts +22 -0
- package/dist/types/features/media/media-move-dialog.d.ts +12 -0
- package/dist/types/features/media/media-mutations.d.ts +43 -0
- package/dist/types/features/media/media-page.d.ts +6 -0
- package/dist/types/features/media/media-picker-dialog.d.ts +14 -0
- package/dist/types/features/media/media-skeleton.d.ts +6 -0
- package/dist/types/features/media/media-upload.d.ts +28 -0
- package/dist/types/features/media/media-view.d.ts +3 -0
- package/dist/types/features/media/upload-conflict-dialog.d.ts +5 -0
- package/dist/types/features/media/upload-conflicts.d.ts +47 -0
- package/dist/types/features/pending-writes/account-operation.d.ts +10 -0
- package/dist/types/features/pending-writes/pending-write.d.ts +9 -0
- package/dist/types/features/pending-writes/use-operation.d.ts +30 -0
- package/dist/types/features/plugins/standalone-plugin-page.d.ts +4 -0
- package/dist/types/features/plugins/standalone-plugin-routes.d.ts +9 -0
- package/dist/types/features/repository/configuration-required.d.ts +10 -0
- package/dist/types/features/repository/overview-draft-actions.d.ts +5 -0
- package/dist/types/features/repository/overview-entry.d.ts +6 -0
- package/dist/types/features/repository/overview-file-item.d.ts +8 -0
- package/dist/types/features/repository/overview-loading.d.ts +4 -0
- package/dist/types/features/repository/overview-local-files.d.ts +10 -0
- package/dist/types/features/repository/overview-media-upload.d.ts +8 -0
- package/dist/types/features/repository/overview-shortcuts.d.ts +11 -0
- package/dist/types/features/repository/overview.d.ts +7 -0
- package/dist/types/features/repository/repository-loading.d.ts +2 -0
- package/dist/types/features/repository/repository-route-resource.d.ts +8 -0
- package/dist/types/features/repository/repository-route-state.d.ts +8 -0
- package/dist/types/features/repository/repository-shell-loading.d.ts +1 -0
- package/dist/types/features/repository/repository-unavailable-error.d.ts +2 -0
- package/dist/types/features/repository/use-overview-files.d.ts +9 -0
- package/dist/types/features/settings/account-access-table.d.ts +8 -0
- package/dist/types/features/settings/account-settings-contribution.d.ts +4 -0
- package/dist/types/features/settings/settings-navigation.d.ts +14 -0
- package/dist/types/features/settings/shared-projects.d.ts +3 -0
- package/dist/types/features/settings/user-settings-skeleton.d.ts +5 -0
- package/dist/types/features/settings/user-settings.d.ts +1 -0
- package/dist/types/fields/definition.d.ts +23 -0
- package/dist/types/fields/registry.d.ts +2 -0
- package/dist/types/hooks/use-media-github-link.d.ts +10 -0
- package/dist/types/hooks/use-mobile.d.ts +1 -0
- package/dist/types/hooks/use-page-scrolled.d.ts +1 -0
- package/dist/types/hooks/use-repository-coordinates.d.ts +7 -0
- package/dist/types/hooks/use-repository-github-link.d.ts +2 -0
- package/dist/types/hooks/use-route-retry.d.ts +5 -0
- package/dist/types/hooks/use-sidebar-scroll.d.ts +5 -0
- package/dist/types/hooks/use-unsaved-warning.d.ts +1 -0
- package/dist/types/i18n/catalogs.d.ts +3 -0
- package/dist/types/i18n/dates.d.ts +3 -0
- package/dist/types/i18n/document-title.d.ts +10 -0
- package/dist/types/i18n/error-catalogs.d.ts +4 -0
- package/dist/types/i18n/errors.d.ts +13 -0
- package/dist/types/i18n/known-errors.d.ts +2 -0
- package/dist/types/i18n/locale.d.ts +6 -0
- package/dist/types/i18n/localized-error.d.ts +4 -0
- package/dist/types/i18n/localized-route-head.d.ts +5 -0
- package/dist/types/i18n/message.d.ts +8 -0
- package/dist/types/i18n/plugin-catalogs.d.ts +3 -0
- package/dist/types/i18n/test-provider.d.ts +4 -0
- package/dist/types/integrations/tanstack-query/devtools.d.ts +5 -0
- package/dist/types/integrations/tanstack-query/root-provider.d.ts +4 -0
- package/dist/types/lib/access-denial.d.ts +10 -0
- package/dist/types/lib/action-run-tracker.d.ts +34 -0
- package/dist/types/lib/action-run-tracking.d.ts +9 -0
- package/dist/types/lib/actions.d.ts +32 -0
- package/dist/types/lib/activity.d.ts +23 -0
- package/dist/types/lib/auth-error.d.ts +1 -0
- package/dist/types/lib/auth-redirect.d.ts +2 -0
- package/dist/types/lib/authentication.d.ts +20 -0
- package/dist/types/lib/avatar-gradient.d.ts +1 -0
- package/dist/types/lib/base64.d.ts +3 -0
- package/dist/types/lib/cn.d.ts +1 -0
- package/dist/types/lib/collaborator-invites.d.ts +4 -0
- package/dist/types/lib/collaborator-key.d.ts +2 -0
- package/dist/types/lib/collaborator-status.d.ts +1 -0
- package/dist/types/lib/commit-message.d.ts +27 -0
- package/dist/types/lib/component-loader.d.ts +2 -0
- package/dist/types/lib/component-preloading.d.ts +11 -0
- package/dist/types/lib/configuration-completion.d.ts +10 -0
- package/dist/types/lib/content-field-values.d.ts +8 -0
- package/dist/types/lib/content-field.d.ts +2 -0
- package/dist/types/lib/content-filename.d.ts +6 -0
- package/dist/types/lib/content-icon-loader.d.ts +2 -0
- package/dist/types/lib/content-operations.d.ts +15 -0
- package/dist/types/lib/content-validation.d.ts +5 -0
- package/dist/types/lib/core-route-paths.d.ts +2 -0
- package/dist/types/lib/date-field.d.ts +4 -0
- package/dist/types/lib/deferred-component.d.ts +8 -0
- package/dist/types/lib/field-value-shapes.d.ts +11 -0
- package/dist/types/lib/field-values.d.ts +9 -0
- package/dist/types/lib/file-history.d.ts +2 -0
- package/dist/types/lib/file-types.d.ts +13 -0
- package/dist/types/lib/i18n-media.d.ts +4 -0
- package/dist/types/lib/i18n-schema.d.ts +44 -0
- package/dist/types/lib/i18n-values.d.ts +21 -0
- package/dist/types/lib/i18n.d.ts +43 -0
- package/dist/types/lib/icon-name.d.ts +1 -0
- package/dist/types/lib/markdown-images.d.ts +2 -0
- package/dist/types/lib/media-assets.d.ts +9 -0
- package/dist/types/lib/media-field-values.d.ts +20 -0
- package/dist/types/lib/media-upload-name.d.ts +3 -0
- package/dist/types/lib/media-variants.d.ts +4 -0
- package/dist/types/lib/notifications.d.ts +16 -0
- package/dist/types/lib/operation-error.d.ts +3 -0
- package/dist/types/lib/page-title.d.ts +9 -0
- package/dist/types/lib/profile.d.ts +6 -0
- package/dist/types/lib/reference-pages.d.ts +12 -0
- package/dist/types/lib/repository-identity.d.ts +18 -0
- package/dist/types/lib/repository-page-path.d.ts +4 -0
- package/dist/types/lib/repository.d.ts +13 -0
- package/dist/types/lib/select-options.d.ts +4 -0
- package/dist/types/lib/use-raw-search.d.ts +2 -0
- package/dist/types/package/cli.d.ts +2 -0
- package/dist/types/package/cloudflare-project-routes.d.ts +2 -0
- package/dist/types/package/config.d.ts +41 -0
- package/dist/types/package/configured-icons.d.ts +2 -0
- package/dist/types/package/constants.d.ts +2 -0
- package/dist/types/package/deploy-config.d.ts +1 -0
- package/dist/types/package/generate.d.ts +10 -0
- package/dist/types/package/icon-path.d.ts +2 -0
- package/dist/types/package/load.d.ts +1 -0
- package/dist/types/package/migrate.d.ts +31 -0
- package/dist/types/package/node-middleware.d.ts +7 -0
- package/dist/types/package/runtime.d.ts +20 -0
- package/dist/types/package/runtime.server.d.ts +11 -0
- package/dist/types/package/serve.d.ts +5 -0
- package/dist/types/package/server-entry.d.ts +1 -0
- package/dist/types/package/smtp.d.ts +9 -0
- package/dist/types/package/smtp.server.d.ts +2 -0
- package/dist/types/package/vite.d.ts +23 -0
- package/dist/types/plugins/client.d.ts +129 -0
- package/dist/types/plugins/compose.server.d.ts +30 -0
- package/dist/types/plugins/email/cloudflare.server.d.ts +6 -0
- package/dist/types/plugins/email/resend.server.d.ts +2 -0
- package/dist/types/plugins/email/smtp.server.d.ts +15 -0
- package/dist/types/plugins/identity.d.ts +4 -0
- package/dist/types/plugins/server.d.ts +83 -0
- package/dist/types/routeTree.gen.d.ts +592 -0
- package/dist/types/router.d.ts +6 -0
- package/dist/types/routes/__root.d.ts +8 -0
- package/dist/types/routes/admin.d.ts +17 -0
- package/dist/types/routes/auth.error.d.ts +4 -0
- package/dist/types/routes/auth.redirect.d.ts +5 -0
- package/dist/types/routes/github.$owner.$repo.$branch.$page.d.ts +11 -0
- package/dist/types/routes/github.$owner.$repo.$branch.actions.d.ts +13 -0
- package/dist/types/routes/github.$owner.$repo.$branch.cache.d.ts +11 -0
- package/dist/types/routes/github.$owner.$repo.$branch.collaborators.d.ts +11 -0
- package/dist/types/routes/github.$owner.$repo.$branch.collection.$name.d.ts +90 -0
- package/dist/types/routes/github.$owner.$repo.$branch.collection.$name_.edit.$.d.ts +11 -0
- package/dist/types/routes/github.$owner.$repo.$branch.collection.$name_.entry.$.d.ts +15 -0
- package/dist/types/routes/github.$owner.$repo.$branch.collection.$name_.new.d.ts +28 -0
- package/dist/types/routes/github.$owner.$repo.$branch.configuration.d.ts +11 -0
- package/dist/types/routes/github.$owner.$repo.$branch.d.ts +6 -0
- package/dist/types/routes/github.$owner.$repo.$branch.file.$name.d.ts +19 -0
- package/dist/types/routes/github.$owner.$repo.$branch.index.d.ts +32 -0
- package/dist/types/routes/github.$owner.$repo.$branch.media.$name.d.ts +14 -0
- package/dist/types/routes/github.$owner.$repo.index.d.ts +7 -0
- package/dist/types/routes/index.d.ts +11 -0
- package/dist/types/routes/onboarding.d.ts +7 -0
- package/dist/types/routes/settings.d.ts +1 -0
- package/dist/types/routes/sign-in.d.ts +11 -0
- package/dist/types/server/access/policy.d.ts +108 -0
- package/dist/types/server/access/repository-identity-policy.d.ts +3 -0
- package/dist/types/server/access/repository-identity.d.ts +65 -0
- package/dist/types/server/access/repository-policy.d.ts +33 -0
- package/dist/types/server/access/repository.d.ts +227 -0
- package/dist/types/server/account/account.d.ts +39 -0
- package/dist/types/server/account/deletion.d.ts +15 -0
- package/dist/types/server/account/preferences.d.ts +6 -0
- package/dist/types/server/actions/actions.d.ts +152 -0
- package/dist/types/server/activity/capture.d.ts +33 -0
- package/dist/types/server/activity/details.d.ts +23 -0
- package/dist/types/server/activity/store.d.ts +50 -0
- package/dist/types/server/activity/webhook.d.ts +4 -0
- package/dist/types/server/admin/access.d.ts +4 -0
- package/dist/types/server/admin/admin.d.ts +43 -0
- package/dist/types/server/admin/sign-in-allowlist.d.ts +16 -0
- package/dist/types/server/auth/index.d.ts +751 -0
- package/dist/types/server/auth/oauth-account.d.ts +23 -0
- package/dist/types/server/auth/oauth-token-adapter.d.ts +2 -0
- package/dist/types/server/auth/oauth-token-crypto.d.ts +7 -0
- package/dist/types/server/auth/rate-limit.d.ts +3 -0
- package/dist/types/server/auth/secret-crypto.d.ts +5 -0
- package/dist/types/server/auth/sign-in-allowlist.d.ts +4 -0
- package/dist/types/server/cache/configuration-access.d.ts +33 -0
- package/dist/types/server/cache/configuration-read.d.ts +5 -0
- package/dist/types/server/cache/configuration.d.ts +67 -0
- package/dist/types/server/cache/directory-store.d.ts +35 -0
- package/dist/types/server/cache/directory.d.ts +65 -0
- package/dist/types/server/cache/policy.d.ts +14 -0
- package/dist/types/server/cache/repository-read.d.ts +3 -0
- package/dist/types/server/cache/repository.d.ts +30 -0
- package/dist/types/server/collaborators/api.d.ts +2 -0
- package/dist/types/server/collaborators/branches.d.ts +7 -0
- package/dist/types/server/collaborators/collaborators.d.ts +90 -0
- package/dist/types/server/collaborators/membership-match.d.ts +5 -0
- package/dist/types/server/collaborators/shared-projects.d.ts +13 -0
- package/dist/types/server/content/collection.d.ts +67 -0
- package/dist/types/server/content/conflict.d.ts +1 -0
- package/dist/types/server/content/entry-editor.d.ts +2308 -0
- package/dist/types/server/content/localized-directory.d.ts +7 -0
- package/dist/types/server/content/reference.d.ts +26 -0
- package/dist/types/server/content/write-response.d.ts +7 -0
- package/dist/types/server/context-cloudflare.d.ts +1050 -0
- package/dist/types/server/context-node.d.ts +1051 -0
- package/dist/types/server/context.d.ts +1094 -0
- package/dist/types/server/csrf.d.ts +2 -0
- package/dist/types/server/db/client.d.ts +10 -0
- package/dist/types/server/db/core.d.ts +27 -0
- package/dist/types/server/db/schema.d.ts +3270 -0
- package/dist/types/server/db/sql.d.ts +8 -0
- package/dist/types/server/email/email.d.ts +15 -0
- package/dist/types/server/email/templates.d.ts +36 -0
- package/dist/types/server/email/translations.d.ts +121 -0
- package/dist/types/server/github/account.d.ts +7 -0
- package/dist/types/server/github/api.d.ts +208 -0
- package/dist/types/server/github/app-install.d.ts +2 -0
- package/dist/types/server/github/app.d.ts +21 -0
- package/dist/types/server/github/installation-token-cache.d.ts +5 -0
- package/dist/types/server/github/large-collection.d.ts +2 -0
- package/dist/types/server/github/webhook-response.d.ts +2 -0
- package/dist/types/server/github/webhook.d.ts +37 -0
- package/dist/types/server/http.d.ts +7 -0
- package/dist/types/server/index.d.ts +5 -0
- package/dist/types/server/media/media.d.ts +145 -0
- package/dist/types/server/media/preview.d.ts +8 -0
- package/dist/types/server/media/provider.d.ts +233 -0
- package/dist/types/server/repository/activity.d.ts +2 -0
- package/dist/types/server/repository/branches.d.ts +12 -0
- package/dist/types/server/repository/provider.d.ts +155 -0
- package/dist/types/server/repository/repositories.d.ts +55 -0
- package/dist/types/server/request-body.d.ts +4 -0
- package/dist/types/server/routes/account.d.ts +4 -0
- package/dist/types/server/routes/actions.d.ts +4 -0
- package/dist/types/server/routes/activity.d.ts +4 -0
- package/dist/types/server/routes/admin.d.ts +4 -0
- package/dist/types/server/routes/app-version.d.ts +1 -0
- package/dist/types/server/routes/auth.d.ts +4 -0
- package/dist/types/server/routes/cache.d.ts +4 -0
- package/dist/types/server/routes/collaborators.d.ts +4 -0
- package/dist/types/server/routes/configuration.d.ts +4 -0
- package/dist/types/server/routes/entries.d.ts +4 -0
- package/dist/types/server/routes/health.d.ts +6 -0
- package/dist/types/server/routes/index.d.ts +3 -0
- package/dist/types/server/routes/media.d.ts +4 -0
- package/dist/types/server/routes/plugin-request.d.ts +3 -0
- package/dist/types/server/routes/plugins.d.ts +4 -0
- package/dist/types/server/routes/repositories.d.ts +4 -0
- package/dist/types/server/routes/shared.d.ts +16 -0
- package/dist/types/server/routes/webhooks.d.ts +4 -0
- package/dist/types/server/runtime/runtime-ports.d.ts +4 -0
- package/dist/types/server/runtime-config.d.ts +41 -0
- package/dist/types/server/services/account-language.d.ts +3 -0
- package/dist/types/server/services/account.d.ts +41 -0
- package/dist/types/server/services/actions.d.ts +107 -0
- package/dist/types/server/services/activity.d.ts +51 -0
- package/dist/types/server/services/admin.d.ts +61 -0
- package/dist/types/server/services/authentication-state.d.ts +3 -0
- package/dist/types/server/services/cache-management.d.ts +41 -0
- package/dist/types/server/services/cache.d.ts +25 -0
- package/dist/types/server/services/collaborators.d.ts +22 -0
- package/dist/types/server/services/configuration-editor.d.ts +36 -0
- package/dist/types/server/services/configuration.d.ts +20 -0
- package/dist/types/server/services/content.d.ts +4764 -0
- package/dist/types/server/services/context.d.ts +37 -0
- package/dist/types/server/services/dashboard.d.ts +20 -0
- package/dist/types/server/services/entry-translations.d.ts +9 -0
- package/dist/types/server/services/errors.d.ts +14 -0
- package/dist/types/server/services/index.d.ts +12 -0
- package/dist/types/server/services/local-account-data.d.ts +4 -0
- package/dist/types/server/services/media.d.ts +96 -0
- package/dist/types/server/services/reference.d.ts +10 -0
- package/dist/types/server/services/repository.d.ts +40 -0
- package/dist/types/shared/account-preferences.d.ts +13 -0
- package/dist/types/shared/application-operations.d.ts +2 -0
- package/dist/types/shared/collection-presentation.d.ts +13 -0
- package/dist/types/shared/configuration-compatibility.d.ts +10 -0
- package/dist/types/shared/configuration-components.d.ts +4 -0
- package/dist/types/shared/configuration-content.d.ts +21 -0
- package/dist/types/shared/configuration-discovery.d.ts +3 -0
- package/dist/types/shared/configuration-names.d.ts +7 -0
- package/dist/types/shared/configuration-navigation.d.ts +25 -0
- package/dist/types/shared/configuration-schema.d.ts +653 -0
- package/dist/types/shared/configuration-settings.d.ts +4 -0
- package/dist/types/shared/configuration-source.d.ts +17 -0
- package/dist/types/shared/configuration-yaml.d.ts +23 -0
- package/dist/types/shared/configuration.d.ts +4 -0
- package/dist/types/shared/content-conflict.d.ts +2 -0
- package/dist/types/shared/content-serialization.d.ts +18 -0
- package/dist/types/shared/field-validation-error.d.ts +3 -0
- package/dist/types/shared/git-path.d.ts +11 -0
- package/dist/types/shared/json.d.ts +13 -0
- package/dist/types/shared/media-error.d.ts +9 -0
- package/dist/types/shared/repository-search.d.ts +5 -0
- package/dist/types/shared/repository-templates.d.ts +17 -0
- package/dist/types/shared/requests/account.d.ts +16 -0
- package/dist/types/shared/requests/action.d.ts +52 -0
- package/dist/types/shared/requests/activity.d.ts +7 -0
- package/dist/types/shared/requests/admin.d.ts +35 -0
- package/dist/types/shared/requests/branch.d.ts +7 -0
- package/dist/types/shared/requests/cache.d.ts +22 -0
- package/dist/types/shared/requests/collaborator.d.ts +20 -0
- package/dist/types/shared/requests/collection.d.ts +10 -0
- package/dist/types/shared/requests/configuration.d.ts +21 -0
- package/dist/types/shared/requests/entry-write.d.ts +108 -0
- package/dist/types/shared/requests/entry.d.ts +17 -0
- package/dist/types/shared/requests/fixed-file.d.ts +8 -0
- package/dist/types/shared/requests/local-account.d.ts +4 -0
- package/dist/types/shared/requests/media.d.ts +135 -0
- package/dist/types/shared/requests/reference.d.ts +14 -0
- package/dist/types/shared/requests/repository-template.d.ts +6 -0
- package/dist/types/shared/requests/repository.d.ts +6 -0
- package/dist/types/shared/requests/ui-language.d.ts +4 -0
- package/dist/types/shared/sign-in-allowlist.d.ts +18 -0
- package/dist/types/shared/yaml-aliases.d.ts +1 -0
- package/docs/public/configuration/actions.md +160 -0
- package/docs/public/configuration/components.md +56 -0
- package/docs/public/configuration/content/filename.md +63 -0
- package/docs/public/configuration/content/formats.md +63 -0
- package/docs/public/configuration/content/index.md +138 -0
- package/docs/public/configuration/content/view.md +52 -0
- package/docs/public/configuration/fields/block.md +62 -0
- package/docs/public/configuration/fields/boolean.md +22 -0
- package/docs/public/configuration/fields/code.md +29 -0
- package/docs/public/configuration/fields/date.md +35 -0
- package/docs/public/configuration/fields/file.md +34 -0
- package/docs/public/configuration/fields/image.md +48 -0
- package/docs/public/configuration/fields/index.md +130 -0
- package/docs/public/configuration/fields/number.md +28 -0
- package/docs/public/configuration/fields/object.md +63 -0
- package/docs/public/configuration/fields/reference.md +64 -0
- package/docs/public/configuration/fields/rich-text.md +126 -0
- package/docs/public/configuration/fields/select.md +48 -0
- package/docs/public/configuration/fields/string.md +31 -0
- package/docs/public/configuration/fields/text.md +30 -0
- package/docs/public/configuration/fields/uuid.md +28 -0
- package/docs/public/configuration/index.md +88 -0
- package/docs/public/configuration/localization.md +138 -0
- package/docs/public/configuration/media.md +77 -0
- package/docs/public/configuration/settings.md +85 -0
- package/docs/public/docs.json +119 -0
- package/docs/public/extending/custom-field.md +107 -0
- package/docs/public/extending/field-api.md +71 -0
- package/docs/public/extending/plugins.md +67 -0
- package/docs/public/guides/actions.md +14 -0
- package/docs/public/guides/collaborators.md +43 -0
- package/docs/public/guides/editing.md +36 -0
- package/docs/public/guides/media.md +24 -0
- package/docs/public/guides/translations.md +40 -0
- package/docs/public/how-it-works.md +33 -0
- package/docs/public/index.md +25 -0
- package/docs/public/quick-start.md +87 -0
- package/docs/public/reference.md +84 -0
- package/docs/public/self-hosting/cloudflare.md +62 -0
- package/docs/public/self-hosting/environment-variables.md +84 -0
- package/docs/public/self-hosting/github-app.md +54 -0
- package/docs/public/self-hosting/index.md +44 -0
- package/docs/public/self-hosting/netlify.md +41 -0
- package/docs/public/self-hosting/node.md +42 -0
- package/docs/public/self-hosting/upgrading.md +44 -0
- package/docs/public/self-hosting/vercel.md +41 -0
- package/drizzle/0000_wet_overlord.sql +268 -0
- package/drizzle/meta/0000_snapshot.json +1858 -0
- package/drizzle/meta/_journal.json +13 -0
- package/index.html +53 -0
- package/package.json +368 -3
- package/public/_headers +7 -0
- package/public/favicon.ico +0 -0
- package/public/favicon.svg +16 -0
- package/public/images/astro-blog-template.webp +0 -0
- package/public/images/eleventy-blog-template.webp +0 -0
- package/public/images/email-logo.png +0 -0
- package/public/images/nextjs-blog-template.webp +0 -0
- package/public/images/social-card.png +0 -0
- package/public/reference/docs/configuration/actions.md +160 -0
- package/public/reference/docs/configuration/components.md +56 -0
- package/public/reference/docs/configuration/content/filename.md +63 -0
- package/public/reference/docs/configuration/content/formats.md +63 -0
- package/public/reference/docs/configuration/content/index.md +138 -0
- package/public/reference/docs/configuration/content/view.md +52 -0
- package/public/reference/docs/configuration/fields/block.md +62 -0
- package/public/reference/docs/configuration/fields/boolean.md +22 -0
- package/public/reference/docs/configuration/fields/code.md +29 -0
- package/public/reference/docs/configuration/fields/date.md +35 -0
- package/public/reference/docs/configuration/fields/file.md +34 -0
- package/public/reference/docs/configuration/fields/image.md +48 -0
- package/public/reference/docs/configuration/fields/index.md +130 -0
- package/public/reference/docs/configuration/fields/number.md +28 -0
- package/public/reference/docs/configuration/fields/object.md +63 -0
- package/public/reference/docs/configuration/fields/reference.md +64 -0
- package/public/reference/docs/configuration/fields/rich-text.md +126 -0
- package/public/reference/docs/configuration/fields/select.md +48 -0
- package/public/reference/docs/configuration/fields/string.md +31 -0
- package/public/reference/docs/configuration/fields/text.md +30 -0
- package/public/reference/docs/configuration/fields/uuid.md +28 -0
- package/public/reference/docs/configuration/index.md +88 -0
- package/public/reference/docs/configuration/localization.md +138 -0
- package/public/reference/docs/configuration/media.md +77 -0
- package/public/reference/docs/configuration/settings.md +85 -0
- package/public/reference/docs/extending/custom-field.md +107 -0
- package/public/reference/docs/extending/field-api.md +71 -0
- package/public/reference/docs/extending/plugins.md +67 -0
- package/public/reference/docs/guides/actions.md +14 -0
- package/public/reference/docs/guides/collaborators.md +43 -0
- package/public/reference/docs/guides/editing.md +36 -0
- package/public/reference/docs/guides/media.md +24 -0
- package/public/reference/docs/guides/translations.md +40 -0
- package/public/reference/docs/how-it-works.md +33 -0
- package/public/reference/docs/index.md +25 -0
- package/public/reference/docs/quick-start.md +87 -0
- package/public/reference/docs/reference.md +84 -0
- package/public/reference/docs/self-hosting/cloudflare.md +62 -0
- package/public/reference/docs/self-hosting/environment-variables.md +84 -0
- package/public/reference/docs/self-hosting/github-app.md +54 -0
- package/public/reference/docs/self-hosting/index.md +44 -0
- package/public/reference/docs/self-hosting/netlify.md +41 -0
- package/public/reference/docs/self-hosting/node.md +42 -0
- package/public/reference/docs/self-hosting/upgrading.md +44 -0
- package/public/reference/docs/self-hosting/vercel.md +41 -0
- package/public/reference/docs.json +119 -0
- package/public/reference/manifest.json +190 -0
- package/public/reference.md +79 -0
- package/scripts/collaborators.mjs +470 -0
- package/scripts/setup-github-app.mjs +837 -0
- package/src/client/api/account.ts +48 -0
- package/src/client/api/actions.ts +53 -0
- package/src/client/api/activity.ts +17 -0
- package/src/client/api/admin.ts +25 -0
- package/src/client/api/auth.ts +8 -0
- package/src/client/api/authentication.ts +8 -0
- package/src/client/api/cache.ts +18 -0
- package/src/client/api/collaborators.ts +18 -0
- package/src/client/api/collections.ts +26 -0
- package/src/client/api/configuration.ts +38 -0
- package/src/client/api/dashboard.ts +6 -0
- package/src/client/api/entries.ts +53 -0
- package/src/client/api/entry-write.ts +54 -0
- package/src/client/api/fixed-file.ts +23 -0
- package/src/client/api/index.ts +98 -0
- package/src/client/api/local-account.ts +5 -0
- package/src/client/api/media.ts +62 -0
- package/src/client/api/reference.ts +9 -0
- package/src/client/api/repositories.ts +7 -0
- package/src/client/api/repository-search.ts +18 -0
- package/src/client/api/repository.ts +39 -0
- package/src/client/queries/admin.ts +19 -0
- package/src/client/queries/content.ts +114 -0
- package/src/client/queries/file-history.ts +44 -0
- package/src/client/queries/keys.ts +56 -0
- package/src/client/queries/references.ts +124 -0
- package/src/client/queries/repository-invalidation.ts +27 -0
- package/src/client/queries/repository.ts +96 -0
- package/src/client/queries/session.ts +45 -0
- package/src/client.tsx +15 -0
- package/src/components/action-history-menu.tsx +273 -0
- package/src/components/code-editor-language.ts +29 -0
- package/src/components/code-editor.tsx +146 -0
- package/src/components/code-field.tsx +42 -0
- package/src/components/collaborator-identity.tsx +34 -0
- package/src/components/collaborator-invite-input.tsx +160 -0
- package/src/components/collaborators-loading.tsx +53 -0
- package/src/components/collection-entry-creator.tsx +558 -0
- package/src/components/component-preloading.tsx +23 -0
- package/src/components/content-entry-editor.tsx +1240 -0
- package/src/components/content-entry-skeleton.tsx +200 -0
- package/src/components/content-icon.tsx +51 -0
- package/src/components/dropdown-loading-row.tsx +19 -0
- package/src/components/editor-layout.tsx +16 -0
- package/src/components/editor-skeleton.tsx +21 -0
- package/src/components/error-alert.tsx +44 -0
- package/src/components/file-editor-history.tsx +191 -0
- package/src/components/file-editor-menu.tsx +113 -0
- package/src/components/github-icon.tsx +17 -0
- package/src/components/gradient-avatar-fallback.tsx +39 -0
- package/src/components/media-file-icon.tsx +40 -0
- package/src/components/media-thumbnail.tsx +199 -0
- package/src/components/operation-error.tsx +161 -0
- package/src/components/option-combobox.tsx +195 -0
- package/src/components/otp-verification-form.tsx +125 -0
- package/src/components/repository-action-buttons.tsx +547 -0
- package/src/components/repository-breadcrumb.tsx +169 -0
- package/src/components/repository-page-header.tsx +97 -0
- package/src/components/repository-shell.tsx +938 -0
- package/src/components/rich-text-field.tsx +324 -0
- package/src/components/root-error.tsx +77 -0
- package/src/components/search-input.tsx +37 -0
- package/src/components/settings-back-link.tsx +43 -0
- package/src/components/settings-layout.tsx +178 -0
- package/src/components/settings-loading.tsx +19 -0
- package/src/components/settings-row.ts +9 -0
- package/src/components/sign-in-form.tsx +285 -0
- package/src/components/startup-error.tsx +93 -0
- package/src/components/structured-content-field.tsx +1900 -0
- package/src/components/table-pager.tsx +62 -0
- package/src/components/ui/alert-dialog.tsx +199 -0
- package/src/components/ui/alert.tsx +78 -0
- package/src/components/ui/avatar.tsx +113 -0
- package/src/components/ui/badge.tsx +53 -0
- package/src/components/ui/breadcrumb.tsx +128 -0
- package/src/components/ui/button-group.tsx +84 -0
- package/src/components/ui/button.tsx +67 -0
- package/src/components/ui/card.tsx +102 -0
- package/src/components/ui/checkbox.tsx +38 -0
- package/src/components/ui/collapsible.tsx +31 -0
- package/src/components/ui/combobox.tsx +336 -0
- package/src/components/ui/command.tsx +202 -0
- package/src/components/ui/dialog.tsx +174 -0
- package/src/components/ui/dropdown-menu.tsx +279 -0
- package/src/components/ui/editor/blockquote.ts +45 -0
- package/src/components/ui/editor/document.ts +29 -0
- package/src/components/ui/editor/html-policy.ts +945 -0
- package/src/components/ui/editor/image.ts +309 -0
- package/src/components/ui/editor/index.tsx +1383 -0
- package/src/components/ui/editor/preserve.ts +494 -0
- package/src/components/ui/editor/slash-command/commands-list.tsx +122 -0
- package/src/components/ui/editor/slash-command/commands.ts +66 -0
- package/src/components/ui/editor/slash-command/suggestion.tsx +305 -0
- package/src/components/ui/editor/typeset.css +1120 -0
- package/src/components/ui/empty.tsx +104 -0
- package/src/components/ui/field.tsx +246 -0
- package/src/components/ui/input-group.tsx +155 -0
- package/src/components/ui/input-otp.tsx +84 -0
- package/src/components/ui/input.tsx +18 -0
- package/src/components/ui/label.tsx +23 -0
- package/src/components/ui/pagination.tsx +153 -0
- package/src/components/ui/popover.tsx +86 -0
- package/src/components/ui/progress.tsx +29 -0
- package/src/components/ui/radio-group.tsx +41 -0
- package/src/components/ui/scroll-area.tsx +52 -0
- package/src/components/ui/select.tsx +206 -0
- package/src/components/ui/separator.tsx +25 -0
- package/src/components/ui/sheet.tsx +152 -0
- package/src/components/ui/sidebar.tsx +693 -0
- package/src/components/ui/skeleton.tsx +14 -0
- package/src/components/ui/sonner.tsx +88 -0
- package/src/components/ui/spinner.tsx +24 -0
- package/src/components/ui/switch.tsx +32 -0
- package/src/components/ui/table.tsx +165 -0
- package/src/components/ui/tabs.tsx +88 -0
- package/src/components/ui/textarea.tsx +17 -0
- package/src/components/ui/toggle-group.tsx +89 -0
- package/src/components/ui/toggle.tsx +47 -0
- package/src/components/ui/tooltip.tsx +54 -0
- package/src/deployment/builtins/resend-email.server.ts +75 -0
- package/src/deployment/conformance/media-storage.ts +177 -0
- package/src/deployment/contracts/client.ts +331 -0
- package/src/deployment/contracts/server.server.ts +55 -0
- package/src/deployment/contracts/version.ts +8 -0
- package/src/deployment/default/client.ts +6 -0
- package/src/deployment/default/server.server.ts +8 -0
- package/src/features/account/account-copy.ts +17 -0
- package/src/features/account/account-deleted-notice.tsx +23 -0
- package/src/features/account/account-menu.tsx +139 -0
- package/src/features/account/account-messages.ts +4 -0
- package/src/features/account/app-header.tsx +46 -0
- package/src/features/account/content-editing-preferences.tsx +104 -0
- package/src/features/account/delete-account.tsx +236 -0
- package/src/features/account/language-field.tsx +79 -0
- package/src/features/account/language-preference.tsx +101 -0
- package/src/features/account/local-account-data.tsx +131 -0
- package/src/features/account/local-account-storage.ts +82 -0
- package/src/features/account/profile-editor.ts +269 -0
- package/src/features/account/profile-fields.tsx +156 -0
- package/src/features/account/profile-loading.tsx +51 -0
- package/src/features/account/profile-picture.tsx +272 -0
- package/src/features/account/profile-settings.tsx +50 -0
- package/src/features/account/profile-setup-heading.tsx +17 -0
- package/src/features/account/profile-setup.tsx +171 -0
- package/src/features/account/require-profile.ts +40 -0
- package/src/features/account/sign-in-layout.tsx +29 -0
- package/src/features/account/sign-in-page.tsx +45 -0
- package/src/features/account/theme-preference.tsx +89 -0
- package/src/features/account/use-account-preferences.ts +96 -0
- package/src/features/account/use-profile-editor.ts +102 -0
- package/src/features/account/use-profile-update.ts +64 -0
- package/src/features/activity/activity-feed-item.tsx +320 -0
- package/src/features/activity/activity-feed-skeleton.tsx +28 -0
- package/src/features/activity/activity-feed.tsx +113 -0
- package/src/features/activity/activity-query.ts +17 -0
- package/src/features/admin/action-run-status.tsx +103 -0
- package/src/features/admin/actions-page.tsx +869 -0
- package/src/features/admin/actions-skeleton.tsx +155 -0
- package/src/features/admin/admin-loading.tsx +165 -0
- package/src/features/admin/admin-page.tsx +573 -0
- package/src/features/admin/allowlist-table.tsx +125 -0
- package/src/features/admin/cache-copy.ts +12 -0
- package/src/features/admin/cache-files-trigger.tsx +17 -0
- package/src/features/admin/cache-files.tsx +196 -0
- package/src/features/admin/cache-page.tsx +302 -0
- package/src/features/admin/cache-skeleton.tsx +76 -0
- package/src/features/admin/collaborators-page.tsx +425 -0
- package/src/features/admin/collaborators-skeleton.tsx +95 -0
- package/src/features/admin/configuration-contribution.tsx +44 -0
- package/src/features/admin/configuration-page.tsx +303 -0
- package/src/features/admin/configuration-setup.tsx +51 -0
- package/src/features/admin/configuration-skeleton.tsx +68 -0
- package/src/features/admin/plugin-page.tsx +115 -0
- package/src/features/admin/repository-actions-page.tsx +32 -0
- package/src/features/admin/repository-admin-access.ts +35 -0
- package/src/features/admin/repository-admin-page.tsx +75 -0
- package/src/features/admin/repository-configuration-page.tsx +18 -0
- package/src/features/admin/sign-in-allowlist.tsx +381 -0
- package/src/features/admin/use-action-run-tracking.ts +32 -0
- package/src/features/collaborators/collaborator-status.tsx +47 -0
- package/src/features/collaborators/collaborators-contribution.tsx +59 -0
- package/src/features/collections/collection-cell.tsx +336 -0
- package/src/features/collections/collection-header.tsx +233 -0
- package/src/features/collections/collection-model.ts +232 -0
- package/src/features/collections/collection-page.tsx +836 -0
- package/src/features/collections/collection-skeleton.tsx +106 -0
- package/src/features/collections/collection-table-layout.tsx +158 -0
- package/src/features/collections/collection-table.tsx +828 -0
- package/src/features/content/content-mutations.ts +544 -0
- package/src/features/content/unavailable-entry.tsx +64 -0
- package/src/features/content/use-entry-actions.tsx +399 -0
- package/src/features/dashboard/about-dialog.tsx +212 -0
- package/src/features/dashboard/branch-manager.tsx +118 -0
- package/src/features/dashboard/branch-picker.ts +17 -0
- package/src/features/dashboard/create-branch-dialog.tsx +182 -0
- package/src/features/dashboard/recent-repositories.ts +119 -0
- package/src/features/dashboard/recent-repository-list.tsx +82 -0
- package/src/features/dashboard/relative-time.ts +30 -0
- package/src/features/dashboard/repository-dashboard.tsx +174 -0
- package/src/features/dashboard/repository-loading.tsx +119 -0
- package/src/features/dashboard/repository-selector.tsx +398 -0
- package/src/features/dashboard/repository-template-preview.tsx +46 -0
- package/src/features/dashboard/repository-templates.tsx +237 -0
- package/src/features/drafts/collection-creation.ts +78 -0
- package/src/features/drafts/draft-discard-dialog.tsx +90 -0
- package/src/features/drafts/draft-field-preview.tsx +128 -0
- package/src/features/drafts/draft-merge-dialog.tsx +322 -0
- package/src/features/drafts/draft-merge-fields.ts +25 -0
- package/src/features/drafts/draft-read-cache.ts +73 -0
- package/src/features/drafts/draft-save-button.tsx +240 -0
- package/src/features/drafts/draft-session.ts +374 -0
- package/src/features/drafts/draft-store.ts +438 -0
- package/src/features/drafts/merge-draft.ts +131 -0
- package/src/features/drafts/relative-age.ts +13 -0
- package/src/features/drafts/saved-draft-menu.tsx +108 -0
- package/src/features/drafts/use-content-draft.tsx +157 -0
- package/src/features/drafts/use-draft-merge.tsx +253 -0
- package/src/features/drafts/use-duplicate-entry.ts +124 -0
- package/src/features/drafts/use-review-viewport.ts +61 -0
- package/src/features/editor/commit-message-dialog.tsx +100 -0
- package/src/features/editor/editor-component-loaders.ts +35 -0
- package/src/features/editor/entry-breadcrumb.ts +64 -0
- package/src/features/editor/entry-page-header.tsx +51 -0
- package/src/features/editor/entry-title.ts +55 -0
- package/src/features/editor/field-locale-menu.tsx +166 -0
- package/src/features/editor/field-locale-values.ts +69 -0
- package/src/features/editor/fields/core-field-renderers.tsx +300 -0
- package/src/features/editor/fields/custom-field-components.ts +15 -0
- package/src/features/editor/fields/field-renderer-registry.ts +45 -0
- package/src/features/editor/fields/field-types.ts +15 -0
- package/src/features/editor/fields/field-validation.tsx +174 -0
- package/src/features/editor/fields/structured-field-options.ts +66 -0
- package/src/features/editor/fields/use-reference-options.ts +47 -0
- package/src/features/editor/file-locale-menu.tsx +487 -0
- package/src/features/editor/locale-context.tsx +264 -0
- package/src/features/editor/locale-selection.tsx +63 -0
- package/src/features/editor/rich-text-media.ts +134 -0
- package/src/features/editor/start-translation-dialog.tsx +136 -0
- package/src/features/editor/translation-preferences.ts +58 -0
- package/src/features/editor/translation-start.ts +35 -0
- package/src/features/media/media-breadcrumb.tsx +84 -0
- package/src/features/media/media-browser.tsx +1236 -0
- package/src/features/media/media-delivery.ts +348 -0
- package/src/features/media/media-drag-overlay.tsx +59 -0
- package/src/features/media/media-entry.tsx +417 -0
- package/src/features/media/media-folder-tree.tsx +216 -0
- package/src/features/media/media-model.ts +60 -0
- package/src/features/media/media-move-dialog.tsx +97 -0
- package/src/features/media/media-mutations.ts +351 -0
- package/src/features/media/media-page.tsx +24 -0
- package/src/features/media/media-picker-dialog.tsx +123 -0
- package/src/features/media/media-skeleton.tsx +97 -0
- package/src/features/media/media-upload.ts +340 -0
- package/src/features/media/media-view.ts +16 -0
- package/src/features/media/upload-conflict-dialog.tsx +126 -0
- package/src/features/media/upload-conflicts.ts +166 -0
- package/src/features/pending-writes/account-operation.ts +44 -0
- package/src/features/pending-writes/pending-write.ts +41 -0
- package/src/features/pending-writes/use-operation.ts +158 -0
- package/src/features/plugins/standalone-plugin-page.tsx +31 -0
- package/src/features/plugins/standalone-plugin-routes.tsx +70 -0
- package/src/features/repository/configuration-required.tsx +91 -0
- package/src/features/repository/overview-draft-actions.tsx +28 -0
- package/src/features/repository/overview-entry.ts +59 -0
- package/src/features/repository/overview-file-item.tsx +115 -0
- package/src/features/repository/overview-loading.tsx +94 -0
- package/src/features/repository/overview-local-files.tsx +138 -0
- package/src/features/repository/overview-media-upload.tsx +183 -0
- package/src/features/repository/overview-shortcuts.tsx +138 -0
- package/src/features/repository/overview.tsx +88 -0
- package/src/features/repository/repository-loading.ts +12 -0
- package/src/features/repository/repository-route-resource.ts +26 -0
- package/src/features/repository/repository-route-state.tsx +147 -0
- package/src/features/repository/repository-shell-loading.tsx +228 -0
- package/src/features/repository/repository-unavailable-error.tsx +90 -0
- package/src/features/repository/use-overview-files.ts +74 -0
- package/src/features/settings/account-access-table.tsx +69 -0
- package/src/features/settings/account-settings-contribution.tsx +88 -0
- package/src/features/settings/settings-navigation.ts +99 -0
- package/src/features/settings/shared-projects.tsx +246 -0
- package/src/features/settings/user-settings-skeleton.tsx +132 -0
- package/src/features/settings/user-settings.tsx +426 -0
- package/src/fields/custom/README.md +56 -0
- package/src/fields/definition.ts +45 -0
- package/src/fields/registry.ts +9 -0
- package/src/hooks/use-media-github-link.ts +29 -0
- package/src/hooks/use-mobile.ts +19 -0
- package/src/hooks/use-page-scrolled.ts +14 -0
- package/src/hooks/use-repository-coordinates.ts +15 -0
- package/src/hooks/use-repository-github-link.ts +8 -0
- package/src/hooks/use-route-retry.ts +27 -0
- package/src/hooks/use-sidebar-scroll.ts +48 -0
- package/src/hooks/use-unsaved-warning.ts +14 -0
- package/src/i18n/catalogs.ts +37 -0
- package/src/i18n/dates.ts +19 -0
- package/src/i18n/document-title.tsx +22 -0
- package/src/i18n/error-catalogs.ts +37 -0
- package/src/i18n/errors.ts +71 -0
- package/src/i18n/known-errors.ts +2738 -0
- package/src/i18n/lingui.config.mjs +18 -0
- package/src/i18n/locale.ts +51 -0
- package/src/i18n/localized-error.tsx +7 -0
- package/src/i18n/localized-route-head.tsx +82 -0
- package/src/i18n/message.ts +34 -0
- package/src/i18n/plugin-catalogs.ts +97 -0
- package/src/i18n/po.d.ts +5 -0
- package/src/i18n/test-provider.tsx +12 -0
- package/src/integrations/tanstack-query/devtools.tsx +6 -0
- package/src/integrations/tanstack-query/root-provider.tsx +26 -0
- package/src/lib/access-denial.ts +96 -0
- package/src/lib/action-run-tracker.ts +144 -0
- package/src/lib/action-run-tracking.ts +204 -0
- package/src/lib/actions.ts +105 -0
- package/src/lib/activity.ts +119 -0
- package/src/lib/auth-error.ts +15 -0
- package/src/lib/auth-redirect.ts +29 -0
- package/src/lib/authentication.ts +22 -0
- package/src/lib/avatar-gradient.ts +10 -0
- package/src/lib/base64.ts +29 -0
- package/src/lib/cn.ts +1 -0
- package/src/lib/collaborator-invites.ts +55 -0
- package/src/lib/collaborator-key.ts +4 -0
- package/src/lib/collaborator-status.ts +10 -0
- package/src/lib/commit-message.ts +149 -0
- package/src/lib/component-loader.ts +13 -0
- package/src/lib/component-preloading.ts +152 -0
- package/src/lib/configuration-completion.ts +61 -0
- package/src/lib/configuration-reference.d.mts +2 -0
- package/src/lib/configuration-reference.mjs +5 -0
- package/src/lib/content-field-values.ts +157 -0
- package/src/lib/content-field.ts +5 -0
- package/src/lib/content-filename.ts +116 -0
- package/src/lib/content-icon-loader.ts +42 -0
- package/src/lib/content-operations.ts +49 -0
- package/src/lib/content-validation.ts +68 -0
- package/src/lib/core-route-paths.ts +15 -0
- package/src/lib/date-field.ts +53 -0
- package/src/lib/deferred-component.tsx +42 -0
- package/src/lib/field-value-shapes.ts +94 -0
- package/src/lib/field-values.ts +467 -0
- package/src/lib/file-history.ts +9 -0
- package/src/lib/file-types.ts +88 -0
- package/src/lib/i18n-media.ts +77 -0
- package/src/lib/i18n-schema.ts +38 -0
- package/src/lib/i18n-values.ts +428 -0
- package/src/lib/i18n.ts +408 -0
- package/src/lib/icon-name.ts +2 -0
- package/src/lib/markdown-images.ts +156 -0
- package/src/lib/media-assets.ts +39 -0
- package/src/lib/media-field-values.ts +378 -0
- package/src/lib/media-upload-name.ts +41 -0
- package/src/lib/media-variants.ts +18 -0
- package/src/lib/notifications.ts +156 -0
- package/src/lib/operation-error.ts +9 -0
- package/src/lib/page-title.ts +13 -0
- package/src/lib/profile.ts +50 -0
- package/src/lib/reference-pages.ts +24 -0
- package/src/lib/repository-identity.ts +73 -0
- package/src/lib/repository-page-path.ts +29 -0
- package/src/lib/repository.ts +68 -0
- package/src/lib/select-options.ts +23 -0
- package/src/lib/use-raw-search.ts +9 -0
- package/src/locales/de/messages.po +5696 -0
- package/src/locales/en/messages.po +6125 -0
- package/src/locales/es/messages.po +5919 -0
- package/src/locales/fr/messages.po +6125 -0
- package/src/locales/ja/messages.po +5696 -0
- package/src/locales/pt-BR/messages.po +5919 -0
- package/src/locales/zh-CN/messages.po +5919 -0
- package/src/package/cli.ts +132 -0
- package/src/package/cloudflare-project-routes.ts +16 -0
- package/src/package/config.ts +224 -0
- package/src/package/configured-icons.ts +58 -0
- package/src/package/constants.ts +4 -0
- package/src/package/deploy-config.ts +59 -0
- package/src/package/generate.ts +108 -0
- package/src/package/icon-path.ts +9 -0
- package/src/package/libsql-web.mjs +1 -0
- package/src/package/libsql.mjs +1 -0
- package/src/package/load.ts +19 -0
- package/src/package/migrate.ts +365 -0
- package/src/package/node-middleware.ts +29 -0
- package/src/package/runtime.server.ts +66 -0
- package/src/package/runtime.ts +115 -0
- package/src/package/serve.ts +47 -0
- package/src/package/server-entry.ts +1 -0
- package/src/package/smtp.server.ts +52 -0
- package/src/package/smtp.ts +24 -0
- package/src/package/vite.ts +376 -0
- package/src/plugins/client.ts +141 -0
- package/src/plugins/compose.server.ts +429 -0
- package/src/plugins/email/cloudflare.server.ts +58 -0
- package/src/plugins/email/resend.server.ts +12 -0
- package/src/plugins/email/smtp.server.ts +77 -0
- package/src/plugins/identity.ts +17 -0
- package/src/plugins/server.ts +106 -0
- package/src/routeTree.gen.ts +510 -0
- package/src/router.tsx +49 -0
- package/src/routes/__root.tsx +149 -0
- package/src/routes/admin.tsx +77 -0
- package/src/routes/auth.error.tsx +64 -0
- package/src/routes/auth.redirect.tsx +12 -0
- package/src/routes/github.$owner.$repo.$branch.$page.tsx +54 -0
- package/src/routes/github.$owner.$repo.$branch.actions.tsx +41 -0
- package/src/routes/github.$owner.$repo.$branch.cache.tsx +42 -0
- package/src/routes/github.$owner.$repo.$branch.collaborators.tsx +58 -0
- package/src/routes/github.$owner.$repo.$branch.collection.$name.tsx +96 -0
- package/src/routes/github.$owner.$repo.$branch.collection.$name_.edit.$.tsx +13 -0
- package/src/routes/github.$owner.$repo.$branch.collection.$name_.entry.$.tsx +95 -0
- package/src/routes/github.$owner.$repo.$branch.collection.$name_.new.tsx +125 -0
- package/src/routes/github.$owner.$repo.$branch.configuration.tsx +49 -0
- package/src/routes/github.$owner.$repo.$branch.file.$name.tsx +81 -0
- package/src/routes/github.$owner.$repo.$branch.index.tsx +57 -0
- package/src/routes/github.$owner.$repo.$branch.media.$name.tsx +104 -0
- package/src/routes/github.$owner.$repo.$branch.tsx +203 -0
- package/src/routes/github.$owner.$repo.index.tsx +104 -0
- package/src/routes/index.tsx +65 -0
- package/src/routes/onboarding.tsx +51 -0
- package/src/routes/settings.tsx +39 -0
- package/src/routes/sign-in.tsx +71 -0
- package/src/server/access/policy.ts +316 -0
- package/src/server/access/repository-identity-policy.ts +120 -0
- package/src/server/access/repository-identity.ts +361 -0
- package/src/server/access/repository-policy.ts +85 -0
- package/src/server/access/repository.ts +759 -0
- package/src/server/account/account.ts +62 -0
- package/src/server/account/deletion.ts +74 -0
- package/src/server/account/preferences.ts +50 -0
- package/src/server/actions/actions.ts +767 -0
- package/src/server/activity/capture.ts +228 -0
- package/src/server/activity/details.ts +154 -0
- package/src/server/activity/store.ts +174 -0
- package/src/server/activity/webhook.ts +159 -0
- package/src/server/admin/access.ts +9 -0
- package/src/server/admin/admin.ts +159 -0
- package/src/server/admin/sign-in-allowlist.ts +60 -0
- package/src/server/auth/index.ts +284 -0
- package/src/server/auth/oauth-account.ts +131 -0
- package/src/server/auth/oauth-token-adapter.ts +48 -0
- package/src/server/auth/oauth-token-crypto.ts +56 -0
- package/src/server/auth/rate-limit.ts +56 -0
- package/src/server/auth/secret-crypto.ts +57 -0
- package/src/server/auth/sign-in-allowlist.ts +33 -0
- package/src/server/cache/configuration-access.ts +23 -0
- package/src/server/cache/configuration-read.ts +30 -0
- package/src/server/cache/configuration.ts +483 -0
- package/src/server/cache/directory-store.ts +314 -0
- package/src/server/cache/directory.ts +735 -0
- package/src/server/cache/policy.ts +69 -0
- package/src/server/cache/repository-read.ts +119 -0
- package/src/server/cache/repository.ts +345 -0
- package/src/server/collaborators/api.ts +39 -0
- package/src/server/collaborators/branches.ts +72 -0
- package/src/server/collaborators/collaborators.ts +600 -0
- package/src/server/collaborators/membership-match.ts +10 -0
- package/src/server/collaborators/shared-projects.ts +51 -0
- package/src/server/content/collection.ts +301 -0
- package/src/server/content/conflict.ts +11 -0
- package/src/server/content/entry-editor.ts +1487 -0
- package/src/server/content/localized-directory.ts +104 -0
- package/src/server/content/reference.ts +347 -0
- package/src/server/content/write-response.ts +32 -0
- package/src/server/context-cloudflare.ts +91 -0
- package/src/server/context-node.ts +80 -0
- package/src/server/context.ts +262 -0
- package/src/server/csrf.ts +27 -0
- package/src/server/db/client.ts +56 -0
- package/src/server/db/core.ts +69 -0
- package/src/server/db/schema.ts +447 -0
- package/src/server/db/sql.ts +49 -0
- package/src/server/email/email.ts +19 -0
- package/src/server/email/templates.ts +233 -0
- package/src/server/email/translations.ts +144 -0
- package/src/server/github/account.ts +72 -0
- package/src/server/github/api.ts +1375 -0
- package/src/server/github/app-install.ts +15 -0
- package/src/server/github/app.ts +228 -0
- package/src/server/github/installation-token-cache.ts +23 -0
- package/src/server/github/large-collection.ts +48 -0
- package/src/server/github/webhook-response.ts +81 -0
- package/src/server/github/webhook.ts +1013 -0
- package/src/server/http.ts +56 -0
- package/src/server/index.ts +57 -0
- package/src/server/media/media.ts +884 -0
- package/src/server/media/preview.ts +145 -0
- package/src/server/media/provider.ts +722 -0
- package/src/server/repository/activity.ts +20 -0
- package/src/server/repository/branches.ts +35 -0
- package/src/server/repository/provider.ts +237 -0
- package/src/server/repository/repositories.ts +340 -0
- package/src/server/request-body.ts +33 -0
- package/src/server/routes/account.ts +107 -0
- package/src/server/routes/actions.ts +65 -0
- package/src/server/routes/activity.ts +17 -0
- package/src/server/routes/admin.ts +46 -0
- package/src/server/routes/app-version.ts +51 -0
- package/src/server/routes/auth.ts +35 -0
- package/src/server/routes/cache.ts +41 -0
- package/src/server/routes/collaborators.ts +32 -0
- package/src/server/routes/configuration.ts +35 -0
- package/src/server/routes/entries.ts +103 -0
- package/src/server/routes/health.ts +78 -0
- package/src/server/routes/index.ts +154 -0
- package/src/server/routes/media.ts +95 -0
- package/src/server/routes/plugin-request.ts +110 -0
- package/src/server/routes/plugins.ts +30 -0
- package/src/server/routes/repositories.ts +68 -0
- package/src/server/routes/shared.ts +109 -0
- package/src/server/routes/webhooks.ts +11 -0
- package/src/server/runtime/runtime-ports.ts +7 -0
- package/src/server/runtime-config.ts +284 -0
- package/src/server/services/account-language.ts +21 -0
- package/src/server/services/account.ts +145 -0
- package/src/server/services/actions.ts +361 -0
- package/src/server/services/activity.ts +339 -0
- package/src/server/services/admin.ts +106 -0
- package/src/server/services/authentication-state.ts +58 -0
- package/src/server/services/cache-management.ts +165 -0
- package/src/server/services/cache.ts +100 -0
- package/src/server/services/collaborators.ts +138 -0
- package/src/server/services/configuration-editor.ts +272 -0
- package/src/server/services/configuration.ts +102 -0
- package/src/server/services/content.ts +598 -0
- package/src/server/services/context.ts +91 -0
- package/src/server/services/dashboard.ts +74 -0
- package/src/server/services/entry-translations.ts +44 -0
- package/src/server/services/errors.ts +159 -0
- package/src/server/services/index.ts +48 -0
- package/src/server/services/local-account-data.ts +91 -0
- package/src/server/services/media.ts +507 -0
- package/src/server/services/reference.ts +39 -0
- package/src/server/services/repository.ts +188 -0
- package/src/shadcn-tailwind.css +674 -0
- package/src/shared/account-preferences.ts +55 -0
- package/src/shared/application-operations.ts +40 -0
- package/src/shared/collection-presentation.ts +32 -0
- package/src/shared/configuration-compatibility.ts +192 -0
- package/src/shared/configuration-components.ts +98 -0
- package/src/shared/configuration-content.ts +120 -0
- package/src/shared/configuration-discovery.ts +111 -0
- package/src/shared/configuration-names.ts +52 -0
- package/src/shared/configuration-navigation.ts +166 -0
- package/src/shared/configuration-schema.ts +1257 -0
- package/src/shared/configuration-settings.ts +22 -0
- package/src/shared/configuration-source.ts +186 -0
- package/src/shared/configuration-yaml.ts +206 -0
- package/src/shared/configuration.ts +296 -0
- package/src/shared/content-conflict.ts +6 -0
- package/src/shared/content-serialization.ts +252 -0
- package/src/shared/field-validation-error.ts +32 -0
- package/src/shared/git-path.ts +68 -0
- package/src/shared/json.ts +30 -0
- package/src/shared/media-error.ts +23 -0
- package/src/shared/repository-search.ts +43 -0
- package/src/shared/repository-templates.ts +22 -0
- package/src/shared/requests/account.ts +37 -0
- package/src/shared/requests/action.ts +169 -0
- package/src/shared/requests/activity.ts +31 -0
- package/src/shared/requests/admin.ts +98 -0
- package/src/shared/requests/branch.ts +25 -0
- package/src/shared/requests/cache.ts +62 -0
- package/src/shared/requests/collaborator.ts +49 -0
- package/src/shared/requests/collection.ts +32 -0
- package/src/shared/requests/configuration.ts +41 -0
- package/src/shared/requests/entry-write.ts +221 -0
- package/src/shared/requests/entry.ts +35 -0
- package/src/shared/requests/fixed-file.ts +29 -0
- package/src/shared/requests/local-account.ts +5 -0
- package/src/shared/requests/media.ts +215 -0
- package/src/shared/requests/reference.ts +51 -0
- package/src/shared/requests/repository-template.ts +32 -0
- package/src/shared/requests/repository.ts +28 -0
- package/src/shared/requests/ui-language.ts +15 -0
- package/src/shared/sign-in-allowlist.ts +77 -0
- package/src/shared/yaml-aliases.ts +25 -0
- package/src/styles.css +453 -0
|
@@ -0,0 +1,945 @@
|
|
|
1
|
+
import { TemplateLexer, templateLinks } from './preserve'
|
|
2
|
+
import type { templateSyntax } from './preserve'
|
|
3
|
+
import type { I18n } from '@lingui/core'
|
|
4
|
+
import { msg } from '@lingui/core/macro'
|
|
5
|
+
import DOMPurify from 'dompurify'
|
|
6
|
+
import {
|
|
7
|
+
Extension as TiptapExtension,
|
|
8
|
+
Node as TiptapNode,
|
|
9
|
+
Mark as TiptapMark,
|
|
10
|
+
generateJSON,
|
|
11
|
+
} from '@tiptap/core'
|
|
12
|
+
import type { JSONContent, Editor } from '@tiptap/core'
|
|
13
|
+
import { Lexer, Marked, marked } from 'marked'
|
|
14
|
+
import { NodeSelection, TextSelection } from '@tiptap/pm/state'
|
|
15
|
+
import type { EditorView, ViewMutationRecord } from '@tiptap/pm/view'
|
|
16
|
+
import { DOMSerializer, Slice } from '@tiptap/pm/model'
|
|
17
|
+
import type { Node as ProseMirrorNode } from '@tiptap/pm/model'
|
|
18
|
+
|
|
19
|
+
export type MarkdownHtmlPolicy = {
|
|
20
|
+
keep?: string[]
|
|
21
|
+
strip?: string[]
|
|
22
|
+
drop?: string[]
|
|
23
|
+
/** Additional attributes to preserve. Unsafe attributes and URLs remain forbidden. */
|
|
24
|
+
attributes?: string[]
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// A native selectionchange can arrive after the first keypress. Commit a click
|
|
28
|
+
// in text immediately when the previous selection was an atomic source item.
|
|
29
|
+
export function selectClickedText(view: EditorView, event: MouseEvent) {
|
|
30
|
+
if (!(view.state.selection instanceof NodeSelection)) return false
|
|
31
|
+
if (
|
|
32
|
+
event.target instanceof Element &&
|
|
33
|
+
event.target.closest('[contenteditable="false"]')
|
|
34
|
+
)
|
|
35
|
+
return false
|
|
36
|
+
const selection = view.dom.ownerDocument.getSelection()
|
|
37
|
+
const anchor = selection?.anchorNode
|
|
38
|
+
if (
|
|
39
|
+
!selection?.isCollapsed ||
|
|
40
|
+
!anchor ||
|
|
41
|
+
anchor.nodeType !== 3 ||
|
|
42
|
+
!view.dom.contains(anchor)
|
|
43
|
+
)
|
|
44
|
+
return false
|
|
45
|
+
const position = view.posAtDOM(anchor, selection.anchorOffset)
|
|
46
|
+
if (!view.state.doc.resolve(position).parent.inlineContent) return false
|
|
47
|
+
view.dispatch(
|
|
48
|
+
view.state.tr.setSelection(TextSelection.create(view.state.doc, position)),
|
|
49
|
+
)
|
|
50
|
+
return true
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function createMarkdownParser(
|
|
54
|
+
syntax?: ReturnType<typeof templateSyntax>,
|
|
55
|
+
) {
|
|
56
|
+
const parser = new Marked()
|
|
57
|
+
if (syntax?.enabled) {
|
|
58
|
+
parser.Lexer = TemplateLexer
|
|
59
|
+
parser.lexer = (source, options = parser.defaults) =>
|
|
60
|
+
new TemplateLexer(options).lex(source)
|
|
61
|
+
parser.use(templateLinks(syntax))
|
|
62
|
+
}
|
|
63
|
+
// Tiptap types this option as the global callable marked export, but its
|
|
64
|
+
// manager uses the same lexer/use/parse methods supplied by a Marked instance.
|
|
65
|
+
return Object.assign(parser, {
|
|
66
|
+
getDefaults: marked.getDefaults,
|
|
67
|
+
}) as unknown as typeof marked
|
|
68
|
+
}
|
|
69
|
+
const htmlMarkdown = createMarkdownParser()
|
|
70
|
+
|
|
71
|
+
const containers = [
|
|
72
|
+
'div',
|
|
73
|
+
'section',
|
|
74
|
+
'article',
|
|
75
|
+
'aside',
|
|
76
|
+
'header',
|
|
77
|
+
'footer',
|
|
78
|
+
'details',
|
|
79
|
+
'summary',
|
|
80
|
+
'dl',
|
|
81
|
+
'dt',
|
|
82
|
+
'dd',
|
|
83
|
+
]
|
|
84
|
+
const safeAttributes = [
|
|
85
|
+
'class',
|
|
86
|
+
'id',
|
|
87
|
+
'href',
|
|
88
|
+
'src',
|
|
89
|
+
'alt',
|
|
90
|
+
'title',
|
|
91
|
+
'width',
|
|
92
|
+
'height',
|
|
93
|
+
'colspan',
|
|
94
|
+
'rowspan',
|
|
95
|
+
'start',
|
|
96
|
+
'open',
|
|
97
|
+
]
|
|
98
|
+
const forbiddenTags = [
|
|
99
|
+
'script',
|
|
100
|
+
'style',
|
|
101
|
+
'iframe',
|
|
102
|
+
'object',
|
|
103
|
+
'embed',
|
|
104
|
+
'form',
|
|
105
|
+
'input',
|
|
106
|
+
'button',
|
|
107
|
+
'textarea',
|
|
108
|
+
'select',
|
|
109
|
+
'meta',
|
|
110
|
+
'link',
|
|
111
|
+
'base',
|
|
112
|
+
'math',
|
|
113
|
+
'template',
|
|
114
|
+
'foreignobject',
|
|
115
|
+
'use',
|
|
116
|
+
'image',
|
|
117
|
+
'animate',
|
|
118
|
+
'animatemotion',
|
|
119
|
+
'animatetransform',
|
|
120
|
+
'set',
|
|
121
|
+
]
|
|
122
|
+
|
|
123
|
+
const svgTags = new Set([
|
|
124
|
+
'svg',
|
|
125
|
+
'g',
|
|
126
|
+
'defs',
|
|
127
|
+
'path',
|
|
128
|
+
'circle',
|
|
129
|
+
'ellipse',
|
|
130
|
+
'rect',
|
|
131
|
+
'line',
|
|
132
|
+
'polyline',
|
|
133
|
+
'polygon',
|
|
134
|
+
'title',
|
|
135
|
+
'desc',
|
|
136
|
+
'text',
|
|
137
|
+
'tspan',
|
|
138
|
+
'lineargradient',
|
|
139
|
+
'radialgradient',
|
|
140
|
+
'stop',
|
|
141
|
+
'clippath',
|
|
142
|
+
'mask',
|
|
143
|
+
])
|
|
144
|
+
const svgAttributes = new Set([
|
|
145
|
+
'class',
|
|
146
|
+
'id',
|
|
147
|
+
'xmlns',
|
|
148
|
+
'viewbox',
|
|
149
|
+
'width',
|
|
150
|
+
'height',
|
|
151
|
+
'x',
|
|
152
|
+
'y',
|
|
153
|
+
'x1',
|
|
154
|
+
'y1',
|
|
155
|
+
'x2',
|
|
156
|
+
'y2',
|
|
157
|
+
'cx',
|
|
158
|
+
'cy',
|
|
159
|
+
'r',
|
|
160
|
+
'rx',
|
|
161
|
+
'ry',
|
|
162
|
+
'd',
|
|
163
|
+
'points',
|
|
164
|
+
'fill',
|
|
165
|
+
'fill-rule',
|
|
166
|
+
'fill-opacity',
|
|
167
|
+
'stroke',
|
|
168
|
+
'stroke-width',
|
|
169
|
+
'stroke-linecap',
|
|
170
|
+
'stroke-linejoin',
|
|
171
|
+
'stroke-miterlimit',
|
|
172
|
+
'stroke-dasharray',
|
|
173
|
+
'stroke-dashoffset',
|
|
174
|
+
'stroke-opacity',
|
|
175
|
+
'opacity',
|
|
176
|
+
'transform',
|
|
177
|
+
'preserveaspectratio',
|
|
178
|
+
'offset',
|
|
179
|
+
'stop-color',
|
|
180
|
+
'stop-opacity',
|
|
181
|
+
'gradientunits',
|
|
182
|
+
'gradienttransform',
|
|
183
|
+
'spreadmethod',
|
|
184
|
+
'fx',
|
|
185
|
+
'fy',
|
|
186
|
+
'text-anchor',
|
|
187
|
+
'dominant-baseline',
|
|
188
|
+
'font-size',
|
|
189
|
+
'clip-path',
|
|
190
|
+
'mask',
|
|
191
|
+
'role',
|
|
192
|
+
'aria-label',
|
|
193
|
+
'aria-labelledby',
|
|
194
|
+
'aria-describedby',
|
|
195
|
+
'aria-hidden',
|
|
196
|
+
'focusable',
|
|
197
|
+
])
|
|
198
|
+
|
|
199
|
+
function isSvg(element: Element) {
|
|
200
|
+
return element.namespaceURI === 'http://www.w3.org/2000/svg'
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function matches(element: Element, selectors: string[] = []) {
|
|
204
|
+
return selectors.some((selector) => {
|
|
205
|
+
try {
|
|
206
|
+
return element.matches(selector)
|
|
207
|
+
} catch {
|
|
208
|
+
return false
|
|
209
|
+
}
|
|
210
|
+
})
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function action(element: Element, policy?: MarkdownHtmlPolicy) {
|
|
214
|
+
if (matches(element, policy?.drop)) return 'drop'
|
|
215
|
+
if (matches(element, policy?.strip)) return 'strip'
|
|
216
|
+
if (matches(element, policy?.keep)) return 'keep'
|
|
217
|
+
return null
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/** Apply selectors to the original tree, then sanitize every retained descendant. */
|
|
221
|
+
export function sanitizeEditorHtml(html: string, policy?: MarkdownHtmlPolicy) {
|
|
222
|
+
if (typeof document === 'undefined') return ''
|
|
223
|
+
const template = document.createElement('template')
|
|
224
|
+
// Sanitization comes before selectors as well as after them, so forbidden elements
|
|
225
|
+
// cannot be converted into visible text or recovered through a keep rule.
|
|
226
|
+
template.innerHTML = DOMPurify.sanitize(html, {
|
|
227
|
+
FORBID_TAGS: forbiddenTags,
|
|
228
|
+
FORBID_ATTR: ['style', 'srcdoc', 'is'],
|
|
229
|
+
ADD_ATTR: policy?.attributes ?? [],
|
|
230
|
+
})
|
|
231
|
+
const decisions = new Map(
|
|
232
|
+
Array.from(template.content.querySelectorAll('*')).map((element) => [
|
|
233
|
+
element,
|
|
234
|
+
action(element, policy),
|
|
235
|
+
]),
|
|
236
|
+
)
|
|
237
|
+
const visit = (element: Element) => {
|
|
238
|
+
if (isSvg(element) && !svgTags.has(element.localName.toLowerCase())) {
|
|
239
|
+
element.remove()
|
|
240
|
+
return
|
|
241
|
+
}
|
|
242
|
+
const decision = decisions.get(element)
|
|
243
|
+
if (decision === 'drop') {
|
|
244
|
+
element.remove()
|
|
245
|
+
return
|
|
246
|
+
}
|
|
247
|
+
for (const child of Array.from(element.children)) visit(child)
|
|
248
|
+
if (decision === 'strip') {
|
|
249
|
+
element.replaceWith(document.createTextNode(element.textContent))
|
|
250
|
+
return
|
|
251
|
+
}
|
|
252
|
+
for (const attribute of Array.from(element.attributes)) {
|
|
253
|
+
const name = attribute.name.toLowerCase()
|
|
254
|
+
if (isSvg(element)) {
|
|
255
|
+
// Static SVG only: no links, external resources, styles or animation.
|
|
256
|
+
if (
|
|
257
|
+
!svgAttributes.has(name) ||
|
|
258
|
+
/\\|\/\*|\*\//.test(attribute.value) ||
|
|
259
|
+
(/url\s*\(/i.test(attribute.value) &&
|
|
260
|
+
!/^url\(\s*['"]?#[\w.-]+['"]?\s*\)$/i.test(attribute.value))
|
|
261
|
+
) {
|
|
262
|
+
element.removeAttribute(attribute.name)
|
|
263
|
+
}
|
|
264
|
+
continue
|
|
265
|
+
}
|
|
266
|
+
if (
|
|
267
|
+
!safeAttributes.includes(name) &&
|
|
268
|
+
!policy?.attributes?.includes(name)
|
|
269
|
+
) {
|
|
270
|
+
element.removeAttribute(attribute.name)
|
|
271
|
+
}
|
|
272
|
+
// Internal source-node metadata must never be accepted from pasted HTML.
|
|
273
|
+
if (
|
|
274
|
+
name.startsWith('on') ||
|
|
275
|
+
name === 'style' ||
|
|
276
|
+
name.startsWith('data-editor-')
|
|
277
|
+
) {
|
|
278
|
+
element.removeAttribute(attribute.name)
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
for (const element of Array.from(template.content.children)) visit(element)
|
|
283
|
+
return DOMPurify.sanitize(template.innerHTML, {
|
|
284
|
+
FORBID_TAGS: forbiddenTags,
|
|
285
|
+
FORBID_ATTR: ['style', 'srcdoc', 'is'],
|
|
286
|
+
ADD_ATTR: policy?.attributes ?? [],
|
|
287
|
+
})
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/** Close kept clipboard nodes; plain-text pastes have no kept nodes and use normal handling. */
|
|
291
|
+
export function pasteKeptHtml(view: EditorView, slice: Slice) {
|
|
292
|
+
const kept: ProseMirrorNode[] = []
|
|
293
|
+
slice.content.descendants((node) => {
|
|
294
|
+
if (
|
|
295
|
+
node.type.name.startsWith('htmlContainer_') ||
|
|
296
|
+
node.type.name.startsWith('keptHtml') ||
|
|
297
|
+
node.marks.some((mark) => mark.type.name === 'htmlSpan')
|
|
298
|
+
)
|
|
299
|
+
kept.push(node)
|
|
300
|
+
})
|
|
301
|
+
if (kept.length === 0) return false
|
|
302
|
+
// transformPastedHTML already sanitized and applied selectors to the original tree.
|
|
303
|
+
view.dispatch(
|
|
304
|
+
view.state.tr
|
|
305
|
+
.replaceSelection(new Slice(slice.content, 0, 0))
|
|
306
|
+
.scrollIntoView()
|
|
307
|
+
.setMeta('paste', true)
|
|
308
|
+
.setMeta('uiEvent', 'paste'),
|
|
309
|
+
)
|
|
310
|
+
return true
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// Stored fragments have already passed selector rules. Reapply only the safety
|
|
314
|
+
// boundary when rendering/exporting; positional rules must not run repeatedly.
|
|
315
|
+
function sanitizeStoredHtml(html: string, policy?: MarkdownHtmlPolicy) {
|
|
316
|
+
return sanitizeEditorHtml(
|
|
317
|
+
html,
|
|
318
|
+
policy?.attributes ? { attributes: policy.attributes } : undefined,
|
|
319
|
+
)
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
const omitted = (block: boolean): JSONContent => ({
|
|
323
|
+
type: block ? 'omittedHtmlBlock' : 'omittedHtmlInline',
|
|
324
|
+
})
|
|
325
|
+
const sourceNode = (source: string, block: boolean): JSONContent => ({
|
|
326
|
+
type: block ? 'htmlSourceBlock' : 'htmlSourceInline',
|
|
327
|
+
attrs: { source },
|
|
328
|
+
})
|
|
329
|
+
|
|
330
|
+
function sourceMarkdown(source: string, block: boolean) {
|
|
331
|
+
// Opaque components remain source. If edited source includes browser-executable
|
|
332
|
+
// HTML, export it as code rather than letting the source node bypass the policy.
|
|
333
|
+
const template = document.createElement('template')
|
|
334
|
+
template.innerHTML = source
|
|
335
|
+
const purifier = DOMPurify(window)
|
|
336
|
+
const unsafe = Array.from(template.content.querySelectorAll('*')).some(
|
|
337
|
+
(element) =>
|
|
338
|
+
forbiddenTags.includes(element.tagName.toLowerCase()) ||
|
|
339
|
+
Array.from(element.attributes).some((attribute) => {
|
|
340
|
+
const name = attribute.name.toLowerCase()
|
|
341
|
+
return (
|
|
342
|
+
name.startsWith('on') ||
|
|
343
|
+
['style', 'srcdoc', 'is'].includes(name) ||
|
|
344
|
+
([
|
|
345
|
+
'href',
|
|
346
|
+
'src',
|
|
347
|
+
'xlink:href',
|
|
348
|
+
'action',
|
|
349
|
+
'formaction',
|
|
350
|
+
'poster',
|
|
351
|
+
'background',
|
|
352
|
+
].includes(name) &&
|
|
353
|
+
!purifier.isValidAttribute(
|
|
354
|
+
element.tagName.toLowerCase(),
|
|
355
|
+
name,
|
|
356
|
+
attribute.value,
|
|
357
|
+
))
|
|
358
|
+
)
|
|
359
|
+
}),
|
|
360
|
+
)
|
|
361
|
+
if (!unsafe) return source
|
|
362
|
+
const runs = source.match(/`+/g) ?? []
|
|
363
|
+
const delimiter = '`'.repeat(
|
|
364
|
+
Math.max(block ? 2 : 0, ...runs.map((run) => run.length)) + 1,
|
|
365
|
+
)
|
|
366
|
+
return block
|
|
367
|
+
? `${delimiter}html\n${source}\n${delimiter}`
|
|
368
|
+
: `${delimiter} ${source.replace(/\n/g, ' ')} ${delimiter}`
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
function serializeNode(editor: Editor, node: JSONContent) {
|
|
372
|
+
const inert = document.implementation.createHTMLDocument()
|
|
373
|
+
const dom = DOMSerializer.fromSchema(editor.schema).serializeNode(
|
|
374
|
+
editor.schema.nodeFromJSON(node),
|
|
375
|
+
{ document: inert },
|
|
376
|
+
)
|
|
377
|
+
const template = inert.createElement('template')
|
|
378
|
+
template.content.append(dom)
|
|
379
|
+
return template.innerHTML
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// Use Marked's HTML tokens, including its handling of quoted attributes and code,
|
|
383
|
+
// rather than matching closing tags with a regular expression.
|
|
384
|
+
function htmlFragment(src: string) {
|
|
385
|
+
if (!src.startsWith('<')) return undefined
|
|
386
|
+
const tokens = new Lexer(htmlMarkdown.defaults).inlineTokens(src)
|
|
387
|
+
const first = tokens.at(0)
|
|
388
|
+
if (!first || first.type !== 'html') return undefined
|
|
389
|
+
const opening = first.raw.match(/^<([\w-]+)(?:\s|\/?>)/)
|
|
390
|
+
if (!opening || first.raw.endsWith('/>') || /^<!--/.test(first.raw))
|
|
391
|
+
return first.raw
|
|
392
|
+
const tag = opening.at(1)?.toLowerCase()
|
|
393
|
+
if (['br', 'hr', 'img', 'input', 'meta', 'link', 'wbr'].includes(tag ?? ''))
|
|
394
|
+
return first.raw
|
|
395
|
+
let depth = 0
|
|
396
|
+
let raw = ''
|
|
397
|
+
for (const token of tokens) {
|
|
398
|
+
raw += token.raw
|
|
399
|
+
if (token.type !== 'html') continue
|
|
400
|
+
const name = token.raw.match(/^<(\/?)([\w-]+)(?:\s|\/?>)/)
|
|
401
|
+
if (name?.at(2)?.toLowerCase() !== tag) continue
|
|
402
|
+
depth += name?.at(1) ? -1 : token.raw.endsWith('/>') ? 0 : 1
|
|
403
|
+
if (depth === 0) return raw
|
|
404
|
+
}
|
|
405
|
+
return first.raw
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
function expandMarkdownHtml(html: string, policy?: MarkdownHtmlPolicy) {
|
|
409
|
+
const parser = new Marked()
|
|
410
|
+
// A standalone icon is a block child, not a Markdown paragraph containing SVG.
|
|
411
|
+
parser.use({
|
|
412
|
+
extensions: [
|
|
413
|
+
{
|
|
414
|
+
name: 'svgBlock',
|
|
415
|
+
level: 'block',
|
|
416
|
+
tokenizer(src) {
|
|
417
|
+
if (!/^<svg(?:\s|>)/i.test(src)) return undefined
|
|
418
|
+
const raw = htmlFragment(src)
|
|
419
|
+
return raw ? { type: 'svgBlock', raw } : undefined
|
|
420
|
+
},
|
|
421
|
+
renderer(token) {
|
|
422
|
+
return token.raw
|
|
423
|
+
},
|
|
424
|
+
},
|
|
425
|
+
],
|
|
426
|
+
})
|
|
427
|
+
const expand = (fragment: string): string => {
|
|
428
|
+
const raw = htmlFragment(fragment)
|
|
429
|
+
if (!raw) return fragment
|
|
430
|
+
const parts = new Lexer(htmlMarkdown.defaults).inlineTokens(raw)
|
|
431
|
+
const opening = parts.at(0)
|
|
432
|
+
const closing = parts.at(-1)
|
|
433
|
+
if (!opening) return fragment
|
|
434
|
+
const name = opening.raw
|
|
435
|
+
.match(/^<([\w-]+)(?:\s|>)/)
|
|
436
|
+
?.at(1)
|
|
437
|
+
?.toLowerCase()
|
|
438
|
+
if (
|
|
439
|
+
!name ||
|
|
440
|
+
![...containers, 'span'].includes(name) ||
|
|
441
|
+
closing?.type !== 'html' ||
|
|
442
|
+
!closing.raw.toLowerCase().startsWith(`</${name}`)
|
|
443
|
+
)
|
|
444
|
+
return fragment
|
|
445
|
+
const template = document.createElement('template')
|
|
446
|
+
template.innerHTML = opening.raw
|
|
447
|
+
const root = template.content.firstElementChild
|
|
448
|
+
if (!root || action(root, policy) !== 'keep') return fragment
|
|
449
|
+
const inner = raw.slice(opening.raw.length, -closing.raw.length)
|
|
450
|
+
// Parse the original source once. DOM innerHTML would escape blockquote/code
|
|
451
|
+
// characters and parsing it repeatedly would reinterpret escaped Markdown.
|
|
452
|
+
const content =
|
|
453
|
+
name === 'span' || name === 'summary'
|
|
454
|
+
? parser.parseInline(inner, { async: false })
|
|
455
|
+
: parser.parse(inner, { async: false })
|
|
456
|
+
return opening.raw + content + closing.raw + fragment.slice(raw.length)
|
|
457
|
+
}
|
|
458
|
+
parser.use({ renderer: { html: (token) => expand(token.text) } })
|
|
459
|
+
return expand(html)
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
export function createMarkdownHtmlExtensions(
|
|
463
|
+
policy?: MarkdownHtmlPolicy,
|
|
464
|
+
i18n?: I18n,
|
|
465
|
+
) {
|
|
466
|
+
let currentEditor: Editor
|
|
467
|
+
const nodes: ReturnType<typeof TiptapNode.create>[] = containers.map((tag) =>
|
|
468
|
+
TiptapNode.create({
|
|
469
|
+
name: `htmlContainer_${tag}`,
|
|
470
|
+
group: tag === 'dt' || tag === 'dd' ? undefined : 'block',
|
|
471
|
+
content:
|
|
472
|
+
tag === 'dl'
|
|
473
|
+
? '(htmlContainer_dt | htmlContainer_dd)*'
|
|
474
|
+
: tag === 'summary' || tag === 'dt'
|
|
475
|
+
? 'inline*'
|
|
476
|
+
: 'block*',
|
|
477
|
+
defining: true,
|
|
478
|
+
addAttributes() {
|
|
479
|
+
return {
|
|
480
|
+
attributes: {
|
|
481
|
+
default: {},
|
|
482
|
+
parseHTML: (element) =>
|
|
483
|
+
Object.fromEntries(
|
|
484
|
+
Array.from(element.attributes)
|
|
485
|
+
.filter(
|
|
486
|
+
(attribute) =>
|
|
487
|
+
safeAttributes.includes(attribute.name) ||
|
|
488
|
+
policy?.attributes?.includes(attribute.name),
|
|
489
|
+
)
|
|
490
|
+
.map((attribute) => [attribute.name, attribute.value]),
|
|
491
|
+
),
|
|
492
|
+
renderHTML: (attrs) =>
|
|
493
|
+
attrs['attributes'] as Record<string, string>,
|
|
494
|
+
},
|
|
495
|
+
}
|
|
496
|
+
},
|
|
497
|
+
parseHTML() {
|
|
498
|
+
return [
|
|
499
|
+
{
|
|
500
|
+
tag,
|
|
501
|
+
getAttrs: (element) => {
|
|
502
|
+
if (action(element, policy) === 'keep') return {}
|
|
503
|
+
// A kept definition list needs its structural children, just as
|
|
504
|
+
// a table needs rows and cells; no extra keep rules are required.
|
|
505
|
+
const list =
|
|
506
|
+
tag === 'dt' || tag === 'dd' ? element.closest('dl') : null
|
|
507
|
+
return list && action(list, policy) === 'keep' ? {} : false
|
|
508
|
+
},
|
|
509
|
+
},
|
|
510
|
+
]
|
|
511
|
+
},
|
|
512
|
+
renderHTML({ HTMLAttributes }) {
|
|
513
|
+
return [tag, HTMLAttributes, 0]
|
|
514
|
+
},
|
|
515
|
+
...(tag === 'details'
|
|
516
|
+
? {
|
|
517
|
+
addNodeView() {
|
|
518
|
+
return ({ node }: { node: ProseMirrorNode }) => {
|
|
519
|
+
const dom = document.createElement('details')
|
|
520
|
+
for (const [name, value] of Object.entries(
|
|
521
|
+
node.attrs['attributes'] ?? {},
|
|
522
|
+
))
|
|
523
|
+
dom.setAttribute(name, String(value))
|
|
524
|
+
// Keep descendants accessible for editing without changing saved open state.
|
|
525
|
+
dom.open = true
|
|
526
|
+
dom.addEventListener('toggle', () => {
|
|
527
|
+
if (!dom.open) dom.open = true
|
|
528
|
+
})
|
|
529
|
+
return {
|
|
530
|
+
dom,
|
|
531
|
+
contentDOM: dom,
|
|
532
|
+
ignoreMutation: (mutation: ViewMutationRecord) =>
|
|
533
|
+
mutation.type === 'attributes' &&
|
|
534
|
+
mutation.target === dom &&
|
|
535
|
+
mutation.attributeName === 'open',
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
},
|
|
539
|
+
}
|
|
540
|
+
: {}),
|
|
541
|
+
renderMarkdown(node) {
|
|
542
|
+
return serializeNode(currentEditor, node)
|
|
543
|
+
},
|
|
544
|
+
}),
|
|
545
|
+
)
|
|
546
|
+
|
|
547
|
+
for (const block of [false, true]) {
|
|
548
|
+
nodes.push(
|
|
549
|
+
TiptapNode.create({
|
|
550
|
+
name: block ? 'omittedHtmlBlock' : 'omittedHtmlInline',
|
|
551
|
+
group: block ? 'block' : 'inline',
|
|
552
|
+
inline: !block,
|
|
553
|
+
atom: true,
|
|
554
|
+
selectable: false,
|
|
555
|
+
renderHTML() {
|
|
556
|
+
return [block ? 'div' : 'span', { hidden: '' }]
|
|
557
|
+
},
|
|
558
|
+
renderMarkdown() {
|
|
559
|
+
return ''
|
|
560
|
+
},
|
|
561
|
+
}),
|
|
562
|
+
)
|
|
563
|
+
nodes.push(
|
|
564
|
+
TiptapNode.create({
|
|
565
|
+
name: block ? 'htmlSourceBlock' : 'htmlSourceInline',
|
|
566
|
+
group: block ? 'block' : 'inline',
|
|
567
|
+
inline: !block,
|
|
568
|
+
atom: true,
|
|
569
|
+
addAttributes() {
|
|
570
|
+
return { source: { default: '', rendered: false } }
|
|
571
|
+
},
|
|
572
|
+
// Source is text in HTML output; it must not become executable markup.
|
|
573
|
+
renderHTML({ node }) {
|
|
574
|
+
return [block ? 'pre' : 'code', {}, node.attrs['source'] as string]
|
|
575
|
+
},
|
|
576
|
+
renderMarkdown(node) {
|
|
577
|
+
return sourceMarkdown(String(node.attrs?.['source'] ?? ''), block)
|
|
578
|
+
},
|
|
579
|
+
addNodeView() {
|
|
580
|
+
return ({ node, getPos, editor }) => {
|
|
581
|
+
const dom = document.createElement(block ? 'pre' : 'code')
|
|
582
|
+
dom.dataset['editorHtmlSource'] = ''
|
|
583
|
+
dom.textContent = String(node.attrs['source'] ?? '')
|
|
584
|
+
const updateTitle = () => {
|
|
585
|
+
dom.title = i18n
|
|
586
|
+
? i18n._(msg({ message: 'Double-click to edit source' }))
|
|
587
|
+
: 'Double-click to edit source'
|
|
588
|
+
}
|
|
589
|
+
updateTitle()
|
|
590
|
+
const unsubscribe = i18n?.on('change', updateTitle)
|
|
591
|
+
dom.contentEditable = 'false'
|
|
592
|
+
dom.addEventListener('dblclick', () => {
|
|
593
|
+
if (!editor.isEditable) return
|
|
594
|
+
const source = window.prompt(
|
|
595
|
+
i18n ? i18n._(msg({ message: 'Edit source' })) : 'Edit source',
|
|
596
|
+
String(node.attrs['source'] ?? ''),
|
|
597
|
+
)
|
|
598
|
+
const pos = getPos()
|
|
599
|
+
if (source !== null && typeof pos === 'number') {
|
|
600
|
+
editor.view.dispatch(
|
|
601
|
+
editor.state.tr.setNodeMarkup(pos, undefined, { source }),
|
|
602
|
+
)
|
|
603
|
+
}
|
|
604
|
+
})
|
|
605
|
+
return { dom, destroy: unsubscribe }
|
|
606
|
+
}
|
|
607
|
+
},
|
|
608
|
+
}),
|
|
609
|
+
)
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
const inlineTags = [
|
|
613
|
+
'a',
|
|
614
|
+
'strong',
|
|
615
|
+
'b',
|
|
616
|
+
'em',
|
|
617
|
+
'i',
|
|
618
|
+
'u',
|
|
619
|
+
's',
|
|
620
|
+
'del',
|
|
621
|
+
'code',
|
|
622
|
+
'img',
|
|
623
|
+
'br',
|
|
624
|
+
'span',
|
|
625
|
+
'abbr',
|
|
626
|
+
'cite',
|
|
627
|
+
'q',
|
|
628
|
+
'time',
|
|
629
|
+
'small',
|
|
630
|
+
'sub',
|
|
631
|
+
'sup',
|
|
632
|
+
'kbd',
|
|
633
|
+
'mark',
|
|
634
|
+
'label',
|
|
635
|
+
]
|
|
636
|
+
const rawDom = (source: string, block: boolean) => {
|
|
637
|
+
const template = document.createElement('template')
|
|
638
|
+
template.innerHTML = sanitizeStoredHtml(source, policy)
|
|
639
|
+
if (
|
|
640
|
+
template.content.childNodes.length === 1 &&
|
|
641
|
+
template.content.firstElementChild
|
|
642
|
+
)
|
|
643
|
+
return template.content.firstElementChild
|
|
644
|
+
const wrapper = document.createElement(block ? 'div' : 'span')
|
|
645
|
+
wrapper.appendChild(template.content)
|
|
646
|
+
return wrapper
|
|
647
|
+
}
|
|
648
|
+
for (const block of [false, true]) {
|
|
649
|
+
nodes.push(
|
|
650
|
+
TiptapNode.create({
|
|
651
|
+
name: block ? 'keptHtmlBlock' : 'keptHtmlInline',
|
|
652
|
+
group: block ? 'block' : 'inline',
|
|
653
|
+
inline: !block,
|
|
654
|
+
atom: true,
|
|
655
|
+
priority: 50,
|
|
656
|
+
addAttributes() {
|
|
657
|
+
return { source: { default: '', rendered: false } }
|
|
658
|
+
},
|
|
659
|
+
parseHTML() {
|
|
660
|
+
return [
|
|
661
|
+
{
|
|
662
|
+
tag: '*',
|
|
663
|
+
priority: 2000,
|
|
664
|
+
getAttrs: (element) => {
|
|
665
|
+
const tag = element.tagName.toLowerCase()
|
|
666
|
+
if (tag === 'svg') {
|
|
667
|
+
const inline = Boolean(
|
|
668
|
+
element.closest(
|
|
669
|
+
'p, h1, h2, h3, h4, h5, h6, span, a, summary',
|
|
670
|
+
),
|
|
671
|
+
)
|
|
672
|
+
return inline === !block
|
|
673
|
+
? { source: sanitizeStoredHtml(element.outerHTML, policy) }
|
|
674
|
+
: false
|
|
675
|
+
}
|
|
676
|
+
// A single linked image has its own editable image node.
|
|
677
|
+
if (
|
|
678
|
+
tag === 'a' &&
|
|
679
|
+
element.children.length === 1 &&
|
|
680
|
+
element.firstElementChild?.tagName === 'IMG' &&
|
|
681
|
+
!element.textContent.trim()
|
|
682
|
+
)
|
|
683
|
+
return false
|
|
684
|
+
const nestedSpan =
|
|
685
|
+
tag === 'span' &&
|
|
686
|
+
Array.from(element.querySelectorAll('span')).some(
|
|
687
|
+
(child) => action(child, policy) === 'keep',
|
|
688
|
+
)
|
|
689
|
+
if (
|
|
690
|
+
containers.includes(tag) ||
|
|
691
|
+
(tag === 'span' && !nestedSpan) ||
|
|
692
|
+
inlineTags.includes(tag) === block ||
|
|
693
|
+
action(element, policy) !== 'keep'
|
|
694
|
+
)
|
|
695
|
+
return false
|
|
696
|
+
return {
|
|
697
|
+
source: sanitizeStoredHtml(element.outerHTML, policy),
|
|
698
|
+
}
|
|
699
|
+
},
|
|
700
|
+
},
|
|
701
|
+
]
|
|
702
|
+
},
|
|
703
|
+
renderHTML({ node }) {
|
|
704
|
+
return rawDom(String(node.attrs['source'] ?? ''), block)
|
|
705
|
+
},
|
|
706
|
+
renderMarkdown(node) {
|
|
707
|
+
return sanitizeStoredHtml(
|
|
708
|
+
String(node.attrs?.['source'] ?? ''),
|
|
709
|
+
policy,
|
|
710
|
+
)
|
|
711
|
+
},
|
|
712
|
+
addNodeView() {
|
|
713
|
+
return ({ node, editor, getPos }) => {
|
|
714
|
+
const dom = rawDom(
|
|
715
|
+
String(node.attrs['source'] ?? ''),
|
|
716
|
+
block,
|
|
717
|
+
) as HTMLElement
|
|
718
|
+
dom.setAttribute('contenteditable', 'false')
|
|
719
|
+
const updateTitle = () => {
|
|
720
|
+
dom.title = i18n
|
|
721
|
+
? i18n._(msg({ message: 'Double-click to edit HTML' }))
|
|
722
|
+
: 'Double-click to edit HTML'
|
|
723
|
+
}
|
|
724
|
+
updateTitle()
|
|
725
|
+
const unsubscribe = i18n?.on('change', updateTitle)
|
|
726
|
+
// Keep native selection from replacing the fragment selection in Firefox.
|
|
727
|
+
dom.addEventListener('mousedown', (event) => {
|
|
728
|
+
event.preventDefault()
|
|
729
|
+
if (editor.isEditable) editor.view.focus()
|
|
730
|
+
})
|
|
731
|
+
// Preview links are content to edit, never navigation controls.
|
|
732
|
+
dom.addEventListener('click', (event) => {
|
|
733
|
+
event.preventDefault()
|
|
734
|
+
if (!editor.isEditable) return
|
|
735
|
+
const pos = getPos()
|
|
736
|
+
if (typeof pos !== 'number') return
|
|
737
|
+
editor.view.focus()
|
|
738
|
+
editor.view.dispatch(
|
|
739
|
+
editor.state.tr.setSelection(
|
|
740
|
+
NodeSelection.create(editor.state.doc, pos),
|
|
741
|
+
),
|
|
742
|
+
)
|
|
743
|
+
})
|
|
744
|
+
dom.addEventListener('auxclick', (event) => event.preventDefault())
|
|
745
|
+
dom.addEventListener('dblclick', () => {
|
|
746
|
+
if (!editor.isEditable) return
|
|
747
|
+
const source = window.prompt(
|
|
748
|
+
i18n ? i18n._(msg({ message: 'Edit HTML' })) : 'Edit HTML',
|
|
749
|
+
String(node.attrs['source'] ?? ''),
|
|
750
|
+
)
|
|
751
|
+
const pos = getPos()
|
|
752
|
+
if (source !== null && typeof pos === 'number')
|
|
753
|
+
editor.view.dispatch(
|
|
754
|
+
editor.state.tr.setNodeMarkup(pos, undefined, {
|
|
755
|
+
source: sanitizeEditorHtml(source, policy),
|
|
756
|
+
}),
|
|
757
|
+
)
|
|
758
|
+
})
|
|
759
|
+
return { dom, destroy: unsubscribe }
|
|
760
|
+
}
|
|
761
|
+
},
|
|
762
|
+
}),
|
|
763
|
+
)
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
nodes.push(
|
|
767
|
+
TiptapNode.create({
|
|
768
|
+
name: 'markdownHtmlPolicy',
|
|
769
|
+
priority: 110,
|
|
770
|
+
onBeforeCreate() {
|
|
771
|
+
currentEditor = this.editor
|
|
772
|
+
},
|
|
773
|
+
group: 'block',
|
|
774
|
+
atom: true,
|
|
775
|
+
renderHTML() {
|
|
776
|
+
return ['div', { hidden: '' }]
|
|
777
|
+
},
|
|
778
|
+
markdownTokenName: 'html',
|
|
779
|
+
markdownTokenizer: {
|
|
780
|
+
name: 'htmlPolicyBlock',
|
|
781
|
+
level: 'block',
|
|
782
|
+
start: (src) => {
|
|
783
|
+
const match = /(?:^|\n)</.exec(src)
|
|
784
|
+
return match ? match.index + (match[0].startsWith('\n') ? 1 : 0) : -1
|
|
785
|
+
},
|
|
786
|
+
tokenize: (src) => {
|
|
787
|
+
const raw = htmlFragment(src)
|
|
788
|
+
return raw && /^(?:[ \t]*\n|[ \t]*$)/.test(src.slice(raw.length))
|
|
789
|
+
? { type: 'html', raw, text: raw, block: true }
|
|
790
|
+
: undefined
|
|
791
|
+
},
|
|
792
|
+
},
|
|
793
|
+
parseMarkdown(token) {
|
|
794
|
+
const block = Boolean(token['block'])
|
|
795
|
+
const html = String(token.raw ?? token.text ?? '')
|
|
796
|
+
const original = document.createElement('template')
|
|
797
|
+
original.innerHTML = html
|
|
798
|
+
const root = original.content.firstElementChild
|
|
799
|
+
const decision = root ? action(root, policy) : null
|
|
800
|
+
if (decision === 'drop') return omitted(block)
|
|
801
|
+
if (decision === 'strip') {
|
|
802
|
+
const text = document.createElement('template')
|
|
803
|
+
text.innerHTML = sanitizeEditorHtml(html, policy)
|
|
804
|
+
const value = text.content.textContent
|
|
805
|
+
if (!value) return omitted(block)
|
|
806
|
+
return block
|
|
807
|
+
? { type: 'paragraph', content: [{ type: 'text', text: value }] }
|
|
808
|
+
: { type: 'text', text: value }
|
|
809
|
+
}
|
|
810
|
+
// Unsupported syntax anywhere in a fragment must not disappear inside
|
|
811
|
+
// an otherwise editable wrapper. Keep that fragment as visible source.
|
|
812
|
+
const opaque = new Lexer(htmlMarkdown.defaults)
|
|
813
|
+
.inlineTokens(html)
|
|
814
|
+
.some((part) => {
|
|
815
|
+
if (part.type !== 'html') return false
|
|
816
|
+
if (part.raw.startsWith('<!--')) return true
|
|
817
|
+
const component = part.raw.match(/^<([A-Z][\w.-]*)(?:\s|\/?>)/)
|
|
818
|
+
return Boolean(
|
|
819
|
+
component?.[1] && component[1] !== component[1].toUpperCase(),
|
|
820
|
+
)
|
|
821
|
+
})
|
|
822
|
+
if (opaque) return sourceNode(html, block)
|
|
823
|
+
const safe = sanitizeEditorHtml(
|
|
824
|
+
expandMarkdownHtml(html, policy),
|
|
825
|
+
policy,
|
|
826
|
+
)
|
|
827
|
+
if (!safe.trim()) return omitted(block)
|
|
828
|
+
const parsed = generateJSON(
|
|
829
|
+
!block && /^<svg(?:\s|>)/i.test(safe) ? `<p>${safe}</p>` : safe,
|
|
830
|
+
currentEditor.extensionManager.extensions,
|
|
831
|
+
) as JSONContent
|
|
832
|
+
if (block)
|
|
833
|
+
return parsed.content?.length ? parsed.content : omitted(true)
|
|
834
|
+
const inline =
|
|
835
|
+
parsed.content?.flatMap((node) =>
|
|
836
|
+
node.type === 'paragraph' ? (node.content ?? []) : [node],
|
|
837
|
+
) ?? []
|
|
838
|
+
if (
|
|
839
|
+
inline.some(
|
|
840
|
+
(node) =>
|
|
841
|
+
!new Map(Object.entries(currentEditor.schema.nodes)).get(
|
|
842
|
+
node.type ?? '',
|
|
843
|
+
)?.isInline,
|
|
844
|
+
)
|
|
845
|
+
)
|
|
846
|
+
return sourceNode(html, false)
|
|
847
|
+
return inline.length ? inline : omitted(false)
|
|
848
|
+
},
|
|
849
|
+
}),
|
|
850
|
+
)
|
|
851
|
+
// Inline HTML must use a custom token: Tiptap's built-in inline HTML path
|
|
852
|
+
// bypasses parseMarkdown hooks and would otherwise bypass our filtering.
|
|
853
|
+
const blockHandler = nodes.at(-1)
|
|
854
|
+
if (!blockHandler) throw new Error('Missing HTML policy handler')
|
|
855
|
+
nodes.push(
|
|
856
|
+
blockHandler.extend({
|
|
857
|
+
name: 'markdownHtmlPolicyInline',
|
|
858
|
+
markdownTokenName: 'htmlPolicyInline',
|
|
859
|
+
markdownTokenizer: {
|
|
860
|
+
name: 'htmlPolicyInline',
|
|
861
|
+
level: 'inline',
|
|
862
|
+
start: '<',
|
|
863
|
+
tokenize: (src) => {
|
|
864
|
+
const raw = htmlFragment(src)
|
|
865
|
+
return raw
|
|
866
|
+
? { type: 'htmlPolicyInline', raw, text: raw, block: false }
|
|
867
|
+
: undefined
|
|
868
|
+
},
|
|
869
|
+
},
|
|
870
|
+
}),
|
|
871
|
+
)
|
|
872
|
+
const span = TiptapMark.create({
|
|
873
|
+
name: 'htmlSpan',
|
|
874
|
+
addAttributes() {
|
|
875
|
+
return {
|
|
876
|
+
attributes: {
|
|
877
|
+
default: {},
|
|
878
|
+
parseHTML: (element) =>
|
|
879
|
+
Object.fromEntries(
|
|
880
|
+
Array.from(element.attributes)
|
|
881
|
+
.filter(
|
|
882
|
+
(attribute) =>
|
|
883
|
+
safeAttributes.includes(attribute.name) ||
|
|
884
|
+
policy?.attributes?.includes(attribute.name),
|
|
885
|
+
)
|
|
886
|
+
.map((attribute) => [attribute.name, attribute.value]),
|
|
887
|
+
),
|
|
888
|
+
renderHTML: (attrs) => attrs['attributes'] as Record<string, string>,
|
|
889
|
+
},
|
|
890
|
+
}
|
|
891
|
+
},
|
|
892
|
+
parseHTML() {
|
|
893
|
+
return [
|
|
894
|
+
{
|
|
895
|
+
tag: 'span',
|
|
896
|
+
getAttrs: (element) =>
|
|
897
|
+
action(element, policy) === 'keep' ? {} : false,
|
|
898
|
+
},
|
|
899
|
+
]
|
|
900
|
+
},
|
|
901
|
+
renderHTML({ HTMLAttributes }) {
|
|
902
|
+
return ['span', HTMLAttributes, 0]
|
|
903
|
+
},
|
|
904
|
+
renderMarkdown(node, helpers) {
|
|
905
|
+
const element = document.createElement('span')
|
|
906
|
+
for (const [name, value] of Object.entries(
|
|
907
|
+
node.attrs?.['attributes'] ?? {},
|
|
908
|
+
))
|
|
909
|
+
element.setAttribute(name, String(value))
|
|
910
|
+
return element.outerHTML.replace(
|
|
911
|
+
'</span>',
|
|
912
|
+
helpers.renderChildren(node) + '</span>',
|
|
913
|
+
)
|
|
914
|
+
},
|
|
915
|
+
})
|
|
916
|
+
const linkAttributes = TiptapExtension.create({
|
|
917
|
+
name: 'htmlLinkAttributes',
|
|
918
|
+
addGlobalAttributes() {
|
|
919
|
+
// Leave Link's own attributes (especially href) under its control so URL
|
|
920
|
+
// edits cannot be overwritten by preserved source attributes.
|
|
921
|
+
const native = ['href', 'target', 'rel', 'class', 'title']
|
|
922
|
+
const attributes = [
|
|
923
|
+
...new Set(['id', ...(policy?.attributes ?? [])]),
|
|
924
|
+
].filter(
|
|
925
|
+
(name) =>
|
|
926
|
+
!native.includes(name) && !/^on/i.test(name) && name !== 'style',
|
|
927
|
+
)
|
|
928
|
+
return [
|
|
929
|
+
{
|
|
930
|
+
types: ['link'],
|
|
931
|
+
attributes: Object.fromEntries(
|
|
932
|
+
attributes.map((name) => [
|
|
933
|
+
name,
|
|
934
|
+
{
|
|
935
|
+
default: null,
|
|
936
|
+
parseHTML: (element: HTMLElement) => element.getAttribute(name),
|
|
937
|
+
},
|
|
938
|
+
]),
|
|
939
|
+
),
|
|
940
|
+
},
|
|
941
|
+
]
|
|
942
|
+
},
|
|
943
|
+
})
|
|
944
|
+
return [...nodes, span, linkAttributes]
|
|
945
|
+
}
|