@cosmicdrift/kumiko-samples 0.389.0 → 0.390.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/packages/bundled-features/package.json +25 -13
- package/packages/bundled-features/src/audit/feature.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/auth-user-row.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/bootstrap.ts +13 -1
- package/packages/bundled-features/src/auth-email-password/changes.json +6 -0
- package/packages/bundled-features/src/auth-email-password/feature.ts +2 -2
- package/packages/bundled-features/src/auth-email-password/handlers/change-password.write.ts +7 -7
- package/packages/bundled-features/src/auth-email-password/handlers/confirm-account-unlock.write.ts +3 -3
- package/packages/bundled-features/src/auth-email-password/handlers/confirm-token-flow.ts +5 -5
- package/packages/bundled-features/src/auth-email-password/handlers/invite-accept-with-login.write.ts +9 -7
- package/packages/bundled-features/src/auth-email-password/handlers/invite-accept.write.ts +11 -7
- package/packages/bundled-features/src/auth-email-password/handlers/invite-create.write.ts +4 -4
- package/packages/bundled-features/src/auth-email-password/handlers/invite-info.query.ts +2 -2
- package/packages/bundled-features/src/auth-email-password/handlers/invite-signup-complete.write.ts +9 -7
- package/packages/bundled-features/src/auth-email-password/handlers/login.write.ts +23 -16
- package/packages/bundled-features/src/auth-email-password/handlers/reset-password.write.ts +3 -2
- package/packages/bundled-features/src/auth-email-password/handlers/signup-confirm.write.ts +12 -12
- package/packages/bundled-features/src/auth-email-password/handlers/signup-request.write.ts +12 -8
- package/packages/bundled-features/src/auth-email-password/handlers/switch-tenant-mfa-gate.write.ts +4 -2
- package/packages/bundled-features/src/auth-email-password/handlers/token-request-handler.ts +2 -2
- package/packages/bundled-features/src/auth-email-password/handlers/verify-email.write.ts +3 -2
- package/packages/bundled-features/src/auth-email-password/seeding.ts +14 -9
- package/packages/bundled-features/src/auth-foundation/feature.ts +13 -4
- package/packages/bundled-features/src/auth-mfa/handlers/disable.write.ts +5 -5
- package/packages/bundled-features/src/auth-mfa/handlers/enable-confirm-preauth.write.ts +24 -14
- package/packages/bundled-features/src/auth-mfa/handlers/enable-confirm.write.ts +9 -3
- package/packages/bundled-features/src/auth-mfa/handlers/enable-start-preauth.write.ts +6 -1
- package/packages/bundled-features/src/auth-mfa/handlers/enable-start.write.ts +3 -1
- package/packages/bundled-features/src/auth-mfa/handlers/reencrypt.job.ts +14 -9
- package/packages/bundled-features/src/auth-mfa/handlers/regenerate-recovery.write.ts +5 -4
- package/packages/bundled-features/src/auth-mfa/handlers/verify.write.ts +25 -14
- package/packages/bundled-features/src/auth-mfa/mfa-code-verifier.ts +10 -4
- package/packages/bundled-features/src/auth-mfa/mfa-status-checker.ts +9 -3
- package/packages/bundled-features/src/auth-mfa/verify-factor.ts +1 -1
- package/packages/bundled-features/src/billing-foundation/billing-info-query.ts +2 -2
- package/packages/bundled-features/src/billing-foundation/changes.json +6 -0
- package/packages/bundled-features/src/billing-foundation/consumer-protection/consent-gate.ts +1 -1
- package/packages/bundled-features/src/billing-foundation/consumer-protection/issue-confirmation.ts +5 -5
- package/packages/bundled-features/src/billing-foundation/consumer-protection/register-consent.ts +10 -7
- package/packages/bundled-features/src/billing-foundation/consumer-protection/register-termination.ts +15 -12
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-open-cancels.ts +22 -0
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-provider-lock.ts +4 -0
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-receipt-limit.ts +4 -4
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-record.ts +17 -58
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-request.ts +10 -8
- package/packages/bundled-features/src/billing-foundation/consumer-protection/termination-revoke.ts +18 -15
- package/packages/bundled-features/src/billing-foundation/events.ts +1 -1
- package/packages/bundled-features/src/billing-foundation/feature.ts +8 -3
- package/packages/bundled-features/src/billing-foundation/get-subscription-for-tenant.ts +1 -1
- package/packages/bundled-features/src/billing-foundation/handlers/process-event.write.ts +5 -5
- package/packages/bundled-features/src/billing-foundation/handlers/process-payment-event.write.ts +3 -3
- package/packages/bundled-features/src/billing-foundation/plan-catalog.ts +2 -2
- package/packages/bundled-features/src/billing-foundation/projection.ts +1 -1
- package/packages/bundled-features/src/billing-foundation/types.ts +1 -1
- package/packages/bundled-features/src/cap-counter/aggregate-id.ts +1 -1
- package/packages/bundled-features/src/cap-counter/book-cap-usage.ts +5 -4
- package/packages/bundled-features/src/cap-counter/cap-reservation.ts +1 -1
- package/packages/bundled-features/src/cap-counter/constants.ts +1 -1
- package/packages/bundled-features/src/cap-counter/feature.ts +2 -2
- package/packages/bundled-features/src/cap-counter/handlers/increment-rolling.write.ts +1 -1
- package/packages/bundled-features/src/cap-counter/reservation-chain.ts +1 -1
- package/packages/bundled-features/src/cap-counter/with-cap-enforcement.ts +4 -4
- package/packages/bundled-features/src/cap-overview/handlers/caps-usage.query.ts +1 -1
- package/packages/bundled-features/src/cap-overview/handlers/tenant-caps-list.query.ts +1 -1
- package/packages/bundled-features/src/compliance-profiles/seeding.ts +12 -7
- package/packages/bundled-features/src/config/feature.ts +6 -6
- package/packages/bundled-features/src/config/handlers/cascade.query.ts +1 -1
- package/packages/bundled-features/src/config/handlers/readiness.query.ts +1 -1
- package/packages/bundled-features/src/config/handlers/reencrypt.job.ts +23 -13
- package/packages/bundled-features/src/config/handlers/reset.write.ts +3 -3
- package/packages/bundled-features/src/config/handlers/selected-extensions.query.ts +1 -1
- package/packages/bundled-features/src/config/handlers/set.write.ts +4 -4
- package/packages/bundled-features/src/config/handlers/values.query.ts +1 -1
- package/packages/bundled-features/src/crypto-shredding/handlers/forget-subject.write.ts +8 -8
- package/packages/bundled-features/src/crypto-shredding/resolve-file-bytes-deleter.ts +3 -3
- package/packages/bundled-features/src/custom-fields/changes.json +6 -0
- package/packages/bundled-features/src/custom-fields/handlers/clear-custom-field.write.ts +1 -1
- package/packages/bundled-features/src/custom-fields/handlers/delete-system-field.write.ts +1 -1
- package/packages/bundled-features/src/custom-fields/handlers/delete-tenant-field.write.ts +1 -1
- package/packages/bundled-features/src/custom-fields/handlers/set-custom-field.write.ts +1 -1
- package/packages/bundled-features/src/custom-fields/index.ts +4 -0
- package/packages/bundled-features/src/data-retention/feature.ts +1 -1
- package/packages/bundled-features/src/data-retention/run-retention-cleanup.ts +12 -2
- package/packages/bundled-features/src/delivery/attempt-log.ts +1 -1
- package/packages/bundled-features/src/delivery/delivery-service.ts +6 -5
- package/packages/bundled-features/src/delivery/feature.ts +2 -2
- package/packages/bundled-features/src/delivery/jobs.ts +11 -11
- package/packages/bundled-features/src/delivery/testing.ts +1 -1
- package/packages/bundled-features/src/document-ingest-foundation/events.ts +1 -1
- package/packages/bundled-features/src/feature-toggles/handlers/registered.query.ts +1 -1
- package/packages/bundled-features/src/feature-toggles/handlers/set.write.ts +1 -1
- package/packages/bundled-features/src/feature-toggles/toggle-sync-signal.ts +1 -1
- package/packages/bundled-features/src/file-derivatives/feature.ts +2 -2
- package/packages/bundled-features/src/file-derivatives/handlers/public-variant-by-file-ref.query.ts +5 -1
- package/packages/bundled-features/src/file-derivatives/handlers/public-variant.query.ts +7 -5
- package/packages/bundled-features/src/file-foundation/feature.ts +1 -1
- package/packages/bundled-features/src/file-foundation/read-file-ref-content.ts +7 -5
- package/packages/bundled-features/src/file-provider-s3/feature.ts +4 -1
- package/packages/bundled-features/src/files-tenant-data/handlers/sweep-orphaned-derivatives.job.ts +8 -8
- package/packages/bundled-features/src/form-draft/feature.ts +1 -1
- package/packages/bundled-features/src/form-draft/handlers/cleanup.job.ts +22 -12
- package/packages/bundled-features/src/form-draft/handlers/discard.write.ts +3 -3
- package/packages/bundled-features/src/form-draft/handlers/get.query.ts +1 -1
- package/packages/bundled-features/src/foundation-shared/config-helpers.ts +1 -1
- package/packages/bundled-features/src/inbound-mail-foundation/events.ts +1 -1
- package/packages/bundled-features/src/inbound-mail-foundation/feature.ts +1 -1
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/account-state.ts +2 -2
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/connect-account.write.ts +1 -1
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/disconnect-account.write.ts +1 -1
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/ingest-message.write.ts +10 -10
- package/packages/bundled-features/src/inbound-mail-foundation/handlers/update-account.write.ts +1 -1
- package/packages/bundled-features/src/inbound-mail-foundation/projection.ts +1 -1
- package/packages/bundled-features/src/inbound-mail-foundation/watch-supervisor.ts +1 -1
- package/packages/bundled-features/src/inbound-provider-imap/feature.ts +4 -1
- package/packages/bundled-features/src/jobs/changes.json +6 -0
- package/packages/bundled-features/src/jobs/events.ts +1 -1
- package/packages/bundled-features/src/jobs/handlers/consumer.write.ts +7 -4
- package/packages/bundled-features/src/jobs/handlers/projection-rebuild.job.ts +1 -1
- package/packages/bundled-features/src/jobs/handlers/reindex-entity.job.ts +11 -5
- package/packages/bundled-features/src/jobs/handlers/retention-cleanup.job.ts +1 -1
- package/packages/bundled-features/src/jobs/handlers/retry.write.ts +1 -1
- package/packages/bundled-features/src/jobs/handlers/stale-run-sweep.job.ts +1 -1
- package/packages/bundled-features/src/jobs/handlers/trigger.write.ts +2 -2
- package/packages/bundled-features/src/jobs/job-run-logger.ts +139 -90
- package/packages/bundled-features/src/legal-pages/README.md +1 -1
- package/packages/bundled-features/src/legal-pages/lib/boot-check.ts +12 -8
- package/packages/bundled-features/src/mail-foundation/feature.ts +2 -2
- package/packages/bundled-features/src/mail-transport-smtp/changes.json +6 -0
- package/packages/bundled-features/src/mail-transport-smtp/feature.ts +4 -1
- package/packages/bundled-features/src/managed-pages/seeding.ts +13 -8
- package/packages/bundled-features/src/notes-history/handlers/add-note.write.ts +1 -1
- package/packages/bundled-features/src/personal-access-tokens/feature.ts +1 -1
- package/packages/bundled-features/src/personal-access-tokens/handlers/create.write.ts +2 -2
- package/packages/bundled-features/src/personal-access-tokens/handlers/revoke.write.ts +1 -1
- package/packages/bundled-features/src/rate-limiting/handlers/status.query.ts +2 -2
- package/packages/bundled-features/src/readiness/handlers/status.query.ts +4 -1
- package/packages/bundled-features/src/renderer-foundation/api.ts +3 -3
- package/packages/bundled-features/src/secrets/announce-secret-change.ts +4 -4
- package/packages/bundled-features/src/secrets/feature.ts +9 -9
- package/packages/bundled-features/src/secrets/handlers/delete.write.ts +4 -3
- package/packages/bundled-features/src/secrets/handlers/rotate.job.ts +13 -8
- package/packages/bundled-features/src/secrets/handlers/set.write.ts +4 -3
- package/packages/bundled-features/src/secrets/secrets-context.ts +16 -6
- package/packages/bundled-features/src/secrets/write-gate.ts +1 -1
- package/packages/bundled-features/src/seo/feature.ts +1 -1
- package/packages/bundled-features/src/sessions/changes.json +12 -0
- package/packages/bundled-features/src/sessions/feature.ts +1 -1
- package/packages/bundled-features/src/sessions/handlers/cleanup.job.ts +2 -2
- package/packages/bundled-features/src/sessions/handlers/detail.query.ts +5 -2
- package/packages/bundled-features/src/sessions/handlers/list.query.ts +5 -2
- package/packages/bundled-features/src/sessions/handlers/mine.query.ts +5 -2
- package/packages/bundled-features/src/sessions/handlers/revoke-all-for-user.write.ts +3 -3
- package/packages/bundled-features/src/sessions/handlers/revoke-all-others.write.ts +1 -1
- package/packages/bundled-features/src/sessions/handlers/revoke.write.ts +1 -1
- package/packages/bundled-features/src/sessions/screens.ts +8 -4
- package/packages/bundled-features/src/sessions/session-revoked-event.ts +1 -1
- package/packages/bundled-features/src/sessions/web/session-device-cell.tsx +10 -12
- package/packages/bundled-features/src/sessions/web/user-agent.ts +12 -0
- package/packages/bundled-features/src/shared/index.ts +15 -0
- package/packages/bundled-features/src/shared/purge-files-reaching-subject.ts +12 -2
- package/packages/bundled-features/src/shared/require-for-tenant.ts +7 -5
- package/packages/bundled-features/src/shared/stream-tenant-backfill.ts +201 -0
- package/packages/bundled-features/src/shared/stream-tenant-derived-state.ts +107 -0
- package/packages/bundled-features/src/step-dispatcher/feature.ts +1 -1
- package/packages/bundled-features/src/subscription-dodo/plugin-methods.ts +1 -1
- package/packages/bundled-features/src/subscription-dodo/runtime.ts +7 -7
- package/packages/bundled-features/src/subscription-stripe/plugin-methods.ts +5 -3
- package/packages/bundled-features/src/subscription-stripe/runtime.ts +7 -7
- package/packages/bundled-features/src/template-resolver/api.ts +3 -3
- package/packages/bundled-features/src/template-resolver/changes.json +18 -0
- package/packages/bundled-features/src/template-resolver/handlers/bundle-import.ts +5 -4
- package/packages/bundled-features/src/template-resolver/handlers/copy-locale.write.ts +2 -2
- package/packages/bundled-features/src/template-resolver/handlers/export-bundle.query.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/overview.query.ts +2 -2
- package/packages/bundled-features/src/template-resolver/handlers/send-test-shared.ts +1 -1
- package/packages/bundled-features/src/template-resolver/handlers/send-test.write.ts +2 -2
- package/packages/bundled-features/src/template-resolver/handlers/tenant-override-selection.ts +6 -2
- package/packages/bundled-features/src/template-resolver/handlers/tenant-overrides.query.ts +4 -2
- package/packages/bundled-features/src/template-resolver/handlers/usage.query.ts +1 -1
- package/packages/bundled-features/src/template-resolver/seeding.ts +12 -2
- package/packages/bundled-features/src/template-resolver/store-template-resource.ts +18 -13
- package/packages/bundled-features/src/template-resolver/template-resources.ts +4 -4
- package/packages/bundled-features/src/template-resolver/testing.ts +2 -2
- package/packages/bundled-features/src/template-resolver/web/document-insert-fields.tsx +222 -0
- package/packages/bundled-features/src/template-resolver/web/document-insert-model.ts +164 -0
- package/packages/bundled-features/src/template-resolver/web/document-insert-panel.tsx +115 -0
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-bubble.tsx +177 -0
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-content.tsx +38 -0
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-context.ts +119 -0
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-editor.tsx +51 -1098
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-helpers.ts +161 -0
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-layout.tsx +83 -0
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-toolbar-groups.tsx +153 -0
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-toolbar.tsx +182 -0
- package/packages/bundled-features/src/template-resolver/web/editor-handle.ts +18 -0
- package/packages/bundled-features/src/template-resolver/web/placeholder-line-editor.tsx +19 -6
- package/packages/bundled-features/src/template-resolver/web/use-document-tiptap-model.ts +138 -0
- package/packages/bundled-features/src/tenant/changes.json +19 -0
- package/packages/bundled-features/src/tenant/handlers/cancel-invitation.write.ts +1 -1
- package/packages/bundled-features/src/tenant/handlers/memberships.query.ts +1 -1
- package/packages/bundled-features/src/tenant/handlers/remove-member.write.ts +2 -2
- package/packages/bundled-features/src/tenant/handlers/update-member-roles.write.ts +1 -1
- package/packages/bundled-features/src/tenant/index.ts +5 -0
- package/packages/bundled-features/src/tenant/invited-membership.ts +6 -1
- package/packages/bundled-features/src/tenant/schema/tenant.ts +4 -1
- package/packages/bundled-features/src/tenant/seeding.ts +65 -62
- package/packages/bundled-features/src/tenant/stream-tenant-backfill.ts +115 -0
- package/packages/bundled-features/src/tenant/testing.ts +77 -0
- package/packages/bundled-features/src/tenant-handover/events.ts +1 -1
- package/packages/bundled-features/src/tenant-handover/handlers/claim.write.ts +1 -1
- package/packages/bundled-features/src/tenant-lifecycle/feature.ts +5 -5
- package/packages/bundled-features/src/tenant-lifecycle/handlers/cancel-destruction.write.ts +22 -10
- package/packages/bundled-features/src/tenant-lifecycle/handlers/request-destruction.write.ts +22 -11
- package/packages/bundled-features/src/tenant-lifecycle/run-tenant-destroy.ts +23 -12
- package/packages/bundled-features/src/tenant-lifecycle/stages.ts +7 -3
- package/packages/bundled-features/src/tenant-lifecycle/testing.ts +9 -8
- package/packages/bundled-features/src/tier-engine/entity.ts +1 -1
- package/packages/bundled-features/src/tier-engine/feature.ts +8 -3
- package/packages/bundled-features/src/tier-engine/handlers/active-tier.query.ts +3 -3
- package/packages/bundled-features/src/tier-engine/handlers/get-tenant-tier.query.ts +7 -1
- package/packages/bundled-features/src/tier-engine/handlers/set-tenant-tier.write.ts +3 -3
- package/packages/bundled-features/src/user/db/queries/stream-tenant-backfill.ts +71 -97
- package/packages/bundled-features/src/user/handlers/find-for-auth.query.ts +2 -2
- package/packages/bundled-features/src/user/handlers/update-roles.ts +2 -2
- package/packages/bundled-features/src/user/index.ts +2 -0
- package/packages/bundled-features/src/user/invited-global-roles.ts +6 -1
- package/packages/bundled-features/src/user/principal-status.ts +1 -1
- package/packages/bundled-features/src/user/seeding.ts +24 -6
- package/packages/bundled-features/src/user/testing.ts +22 -0
- package/packages/bundled-features/src/user-data-rights/COMPLIANCE.md +1 -1
- package/packages/bundled-features/src/user-data-rights/README.md +1 -1
- package/packages/bundled-features/src/user-data-rights/audit-download.ts +12 -2
- package/packages/bundled-features/src/user-data-rights/changes.json +24 -0
- package/packages/bundled-features/src/user-data-rights/feature.ts +29 -24
- package/packages/bundled-features/src/user-data-rights/handlers/confirm-deletion-by-token.write.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/handlers/deletion-grace-period.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/handlers/download-by-job.query.ts +2 -2
- package/packages/bundled-features/src/user-data-rights/handlers/download-by-token.query.ts +2 -2
- package/packages/bundled-features/src/user-data-rights/handlers/request-deletion.write.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/handlers/restrict-account.write.ts +4 -4
- package/packages/bundled-features/src/user-data-rights/handlers/run-forget-cleanup.write.ts +12 -6
- package/packages/bundled-features/src/user-data-rights/index.ts +2 -0
- package/packages/bundled-features/src/user-data-rights/lib/mail-transport-resolver.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/lib/storage-provider-resolver.ts +1 -1
- package/packages/bundled-features/src/user-data-rights/lib/update-user-lifecycle.ts +6 -1
- package/packages/bundled-features/src/user-data-rights/run-export-jobs.ts +8 -2
- package/packages/bundled-features/src/user-data-rights/run-forget-cleanup.ts +14 -3
- package/packages/bundled-features/src/user-data-rights/run-user-export.ts +11 -1
- package/packages/bundled-features/src/user-data-rights/web/constants.ts +10 -0
- package/packages/bundled-features/src/user-data-rights/web/index.ts +6 -1
- package/packages/bundled-features/src/user-profile/handlers/change-email.write.ts +8 -6
- package/packages/bundled-features/src/waitlist/handlers/export-purge.write.ts +1 -1
- package/packages/bundled-features/src/waitlist/handlers/invite.write.ts +2 -2
- package/packages/bundled-features/src/waitlist/handlers/reject.write.ts +1 -1
- package/packages/bundled-features/src/waitlist/handlers/submit.write.ts +9 -4
- package/packages/bundled-features/src/waitlist/legacy-migrate.ts +6 -1
- package/packages/bundled-features/src/waitlist/link-on-signup.ts +7 -1
- package/packages/bundled-features/src/workflow-runner/changes.json +6 -0
- package/packages/bundled-features/src/workflow-runner/db/queries/due-runs.ts +1 -1
- package/packages/bundled-features/src/workflow-runner/event-subscriber.ts +4 -3
- package/packages/bundled-features/src/workflow-runner/event-trigger.ts +2 -1
- package/packages/bundled-features/src/workflow-runner/feature.ts +2 -2
- package/packages/bundled-features/src/workflow-runner/handlers/resume-run.write.ts +8 -8
- package/packages/bundled-features/src/workflow-runner/runner.ts +6 -4
- package/samples/apps/cap-billing-demo/src/feature.ts +19 -5
- package/samples/apps/config-demo/src/app/server.ts +1 -1
- package/samples/apps/styleguide/src/app/server.ts +2 -2
- package/samples/apps/use-all-bundled/feature-manifest.json +1 -1
- package/samples/apps/use-all-bundled/src/app/seed.ts +12 -2
- package/samples/apps/user-data-rights-demo/README.md +1 -1
- package/samples/apps/user-data-rights-demo/src/feature.ts +3 -2
- package/samples/recipes/api-worker-split/README.md +2 -1
- package/samples/recipes/api-worker-split/src/feature.ts +2 -1
- package/samples/recipes/cross-feature-events/README.md +5 -5
- package/samples/recipes/cross-feature-events/package.json +1 -1
- package/samples/recipes/cross-feature-events/src/feature.ts +4 -4
- package/samples/recipes/event-sourcing/README.md +5 -5
- package/samples/recipes/event-sourcing/package.json +1 -1
- package/samples/recipes/event-sourcing/src/feature.ts +15 -15
- package/samples/recipes/files-post-processing/README.md +1 -1
- package/samples/recipes/files-post-processing/package.json +1 -1
- package/samples/recipes/files-post-processing/src/feature.ts +6 -4
- package/samples/recipes/lane-routing/package.json +1 -1
- package/samples/recipes/legal-pages/README.md +2 -2
- package/samples/recipes/lifecycle-hooks/README.md +2 -2
- package/samples/recipes/lifecycle-hooks/src/feature.ts +1 -1
- package/samples/recipes/managed-config/README.md +3 -3
- package/samples/recipes/search/README.md +1 -1
- package/samples/recipes/search/src/feature.ts +3 -3
- package/samples/recipes/secrets-demo/README.md +1 -1
- package/samples/recipes/secrets-demo/src/feature.ts +5 -2
- package/samples/recipes/state-machine/src/events.ts +1 -1
- package/samples/recipes/state-machine/src/reducer.ts +1 -1
- package/samples/recipes/workflow-engine/src/resume-loop.ts +4 -4
- package/samples/recipes/workflow-engine/src/workflow-runner.ts +2 -2
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import type { Editor } from "@tiptap/core";
|
|
2
|
+
import { BubbleMenu } from "@tiptap/react/menus";
|
|
3
|
+
import type { ReactNode } from "react";
|
|
4
|
+
import { DOCUMENT_BLOCK_ATTRIBUTE } from "./document-editor-extensions.ts";
|
|
5
|
+
import type { TiptapContext } from "./document-tiptap-context.ts";
|
|
6
|
+
import {
|
|
7
|
+
buttonTargetLabel,
|
|
8
|
+
findRepeatTable,
|
|
9
|
+
toggleRepeatHeader,
|
|
10
|
+
} from "./document-tiptap-helpers.ts";
|
|
11
|
+
|
|
12
|
+
// The bubble menu registers its plugin once per mount, so a rebuilt editor needs a fresh mount.
|
|
13
|
+
const editorMountKeys = new WeakMap<Editor, number>();
|
|
14
|
+
let lastMountKey = 0;
|
|
15
|
+
function mountKeyOf(editor: Editor): number {
|
|
16
|
+
const known = editorMountKeys.get(editor);
|
|
17
|
+
if (known !== undefined) return known;
|
|
18
|
+
lastMountKey += 1;
|
|
19
|
+
const created = lastMountKey;
|
|
20
|
+
editorMountKeys.set(editor, created);
|
|
21
|
+
return created;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Board .hb: a small bar that straddles the block's top frame line on the right; above a table it sits fully
|
|
25
|
+
// outside so the header row stays readable.
|
|
26
|
+
const BUBBLE_BAR_CLASS =
|
|
27
|
+
"flex w-max items-center gap-1 rounded border border-input bg-popover p-px text-xs [&_button]:h-5 [&_button]:px-1.5 [&_button]:text-[10px]";
|
|
28
|
+
|
|
29
|
+
function bubbleOffset(editor: Editor): (args: { rects: { floating: { height: number } } }) => {
|
|
30
|
+
mainAxis: number;
|
|
31
|
+
crossAxis: number;
|
|
32
|
+
} {
|
|
33
|
+
return ({ rects }) => ({
|
|
34
|
+
mainAxis: findRepeatTable(editor) !== null ? 2 : -rects.floating.height / 2,
|
|
35
|
+
crossAxis: -8,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const BUBBLE_MENU_PLUGIN_KEY = "documentBlockOptions";
|
|
40
|
+
|
|
41
|
+
// The options bar belongs to the block frame, not to the caret inside it.
|
|
42
|
+
function selectedBlockReference(editor: Editor): {
|
|
43
|
+
getBoundingClientRect: () => DOMRect;
|
|
44
|
+
getClientRects: () => DOMRect[];
|
|
45
|
+
contextElement: Element;
|
|
46
|
+
} | null {
|
|
47
|
+
const { node } = editor.view.domAtPos(editor.state.selection.from);
|
|
48
|
+
const start = node instanceof Element ? node : node.parentElement;
|
|
49
|
+
const block = start?.closest(`[${DOCUMENT_BLOCK_ATTRIBUTE}], table`);
|
|
50
|
+
if (block === null || block === undefined) return null;
|
|
51
|
+
return {
|
|
52
|
+
getBoundingClientRect: () => block.getBoundingClientRect(),
|
|
53
|
+
getClientRects: () => [block.getBoundingClientRect()],
|
|
54
|
+
contextElement: block,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// The bubble is first measured before React has filled it, so it sits at the wrong place until a second pass.
|
|
59
|
+
function repositionBubble(editor: Editor): void {
|
|
60
|
+
if (editor.isDestroyed) return;
|
|
61
|
+
editor.view.dispatch(editor.state.tr.setMeta(BUBBLE_MENU_PLUGIN_KEY, "updatePosition"));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function repeatBarLabelOf(c: TiptapContext): string {
|
|
65
|
+
const { t, repeatListLabel } = c;
|
|
66
|
+
return repeatListLabel === undefined
|
|
67
|
+
? t("template-resolver.documentEditor.repeat")
|
|
68
|
+
: t("template-resolver.documentEditor.repeatBarList", { list: repeatListLabel });
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function renderBlockOptionsBar(
|
|
72
|
+
c: TiptapContext,
|
|
73
|
+
selectedBlock: { readonly type: "resource" | "button"; readonly detail: string },
|
|
74
|
+
): ReactNode {
|
|
75
|
+
const { t, Button, editor } = c;
|
|
76
|
+
return (
|
|
77
|
+
<div className={BUBBLE_BAR_CLASS} data-testid="document-block-options">
|
|
78
|
+
<span className="px-1.5 text-[10px] text-muted-foreground">
|
|
79
|
+
{selectedBlock.type === "resource"
|
|
80
|
+
? t("template-resolver.documentEditor.resourceKey")
|
|
81
|
+
: t("template-resolver.documentEditor.buttonTarget")}
|
|
82
|
+
{": "}
|
|
83
|
+
{selectedBlock.type === "button" ? (
|
|
84
|
+
<strong>{buttonTargetLabel(selectedBlock.detail, c.variableLabels)}</strong>
|
|
85
|
+
) : (
|
|
86
|
+
<code>{selectedBlock.detail}</code>
|
|
87
|
+
)}
|
|
88
|
+
</span>
|
|
89
|
+
<Button
|
|
90
|
+
type="button"
|
|
91
|
+
size="sm"
|
|
92
|
+
variant="danger-ghost"
|
|
93
|
+
onClick={() => {
|
|
94
|
+
editor.chain().focus().deleteNode(selectedBlock.type).run();
|
|
95
|
+
}}
|
|
96
|
+
>
|
|
97
|
+
{t("template-resolver.documentEditor.removeBlock")}
|
|
98
|
+
</Button>
|
|
99
|
+
</div>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function renderBubbleRepeatBar(c: TiptapContext): ReactNode {
|
|
104
|
+
const { t, Button, editor } = c;
|
|
105
|
+
const repeatTable = c.activeState?.repeatTable ?? null;
|
|
106
|
+
return (
|
|
107
|
+
repeatTable !== null && (
|
|
108
|
+
<div data-testid="document-repeat-bar" className={BUBBLE_BAR_CLASS}>
|
|
109
|
+
<span className="px-1.5 text-[10px] uppercase tracking-wide text-muted-foreground">
|
|
110
|
+
{repeatBarLabelOf(c)}
|
|
111
|
+
</span>
|
|
112
|
+
<Button
|
|
113
|
+
type="button"
|
|
114
|
+
variant="secondary"
|
|
115
|
+
size="sm"
|
|
116
|
+
pressed={repeatTable.headerRepeats}
|
|
117
|
+
onClick={() => toggleRepeatHeader(editor)}
|
|
118
|
+
>
|
|
119
|
+
{t("template-resolver.documentEditor.repeatHeader")}
|
|
120
|
+
</Button>
|
|
121
|
+
</div>
|
|
122
|
+
)
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function renderBubbleMenu(c: TiptapContext): ReactNode {
|
|
127
|
+
const { editor } = c;
|
|
128
|
+
const selectedBlock = c.activeState?.selectedBlock ?? null;
|
|
129
|
+
return (
|
|
130
|
+
<BubbleMenu
|
|
131
|
+
key={mountKeyOf(editor)}
|
|
132
|
+
pluginKey={BUBBLE_MENU_PLUGIN_KEY}
|
|
133
|
+
editor={editor}
|
|
134
|
+
options={{
|
|
135
|
+
strategy: "fixed",
|
|
136
|
+
placement: "top-end",
|
|
137
|
+
offset: bubbleOffset(editor),
|
|
138
|
+
scrollTarget: c.canvasScroller ?? window,
|
|
139
|
+
onShow: () => requestAnimationFrame(() => repositionBubble(editor)),
|
|
140
|
+
}}
|
|
141
|
+
getReferencedVirtualElement={() => selectedBlockReference(editor)}
|
|
142
|
+
shouldShow={({ editor: e, element }) =>
|
|
143
|
+
// A leading image is selected by default; the bubble belongs to a deliberate selection.
|
|
144
|
+
(e.isFocused || element.contains(document.activeElement)) &&
|
|
145
|
+
(e.isActive("resource") || e.isActive("button") || findRepeatTable(e) !== null)
|
|
146
|
+
}
|
|
147
|
+
>
|
|
148
|
+
{selectedBlock !== null ? renderBlockOptionsBar(c, selectedBlock) : renderBubbleRepeatBar(c)}
|
|
149
|
+
</BubbleMenu>
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function renderInlineRepeatBar(c: TiptapContext): ReactNode {
|
|
154
|
+
const { t, Button, editor } = c;
|
|
155
|
+
const repeatTable = c.activeState?.repeatTable ?? null;
|
|
156
|
+
return (
|
|
157
|
+
repeatTable !== null &&
|
|
158
|
+
!c.readOnly &&
|
|
159
|
+
!c.canvas && (
|
|
160
|
+
<div
|
|
161
|
+
data-testid="document-repeat-bar"
|
|
162
|
+
className="flex flex-wrap items-center gap-3 border-b border-input bg-muted/40 px-2 py-1 text-xs"
|
|
163
|
+
>
|
|
164
|
+
<span className="font-medium">{repeatBarLabelOf(c)}</span>
|
|
165
|
+
<Button
|
|
166
|
+
type="button"
|
|
167
|
+
variant="secondary"
|
|
168
|
+
size="sm"
|
|
169
|
+
pressed={repeatTable.headerRepeats}
|
|
170
|
+
onClick={() => toggleRepeatHeader(editor)}
|
|
171
|
+
>
|
|
172
|
+
{t("template-resolver.documentEditor.repeatHeader")}
|
|
173
|
+
</Button>
|
|
174
|
+
</div>
|
|
175
|
+
)
|
|
176
|
+
);
|
|
177
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { cn } from "@cosmicdrift/kumiko-renderer/web";
|
|
2
|
+
import type { Editor } from "@tiptap/core";
|
|
3
|
+
import { EditorContent } from "@tiptap/react";
|
|
4
|
+
import type { ReactNode } from "react";
|
|
5
|
+
|
|
6
|
+
export function renderEditorContent(editor: Editor, canvas: boolean, hosted: boolean): ReactNode {
|
|
7
|
+
return (
|
|
8
|
+
<EditorContent
|
|
9
|
+
editor={editor}
|
|
10
|
+
className={cn(
|
|
11
|
+
!canvas && "min-h-40 px-3 py-2 text-base outline-none md:text-sm",
|
|
12
|
+
canvas && "text-sm",
|
|
13
|
+
"[&_.ProseMirror-focused_.ProseMirror-selectednode]:ring-2 [&_.ProseMirror-focused_.ProseMirror-selectednode]:ring-primary",
|
|
14
|
+
hosted
|
|
15
|
+
? "[&_.ProseMirror]:outline-none"
|
|
16
|
+
: "[&_.ProseMirror]:min-h-40 [&_.ProseMirror]:outline-none",
|
|
17
|
+
"[&_ul]:list-disc [&_ol]:list-decimal [&_ul]:pl-6 [&_ol]:pl-6",
|
|
18
|
+
"[&_h1]:text-xl [&_h1]:font-bold [&_h2]:text-lg [&_h2]:font-bold [&_h3]:text-base [&_h3]:font-bold",
|
|
19
|
+
"[&_a]:underline [&_a]:text-primary",
|
|
20
|
+
"[&_strong]:font-bold [&_em]:italic [&_u]:underline",
|
|
21
|
+
canvas
|
|
22
|
+
? "[&_table]:mb-2 [&_table]:mt-6 [&_.ProseMirror>:first-child_table]:mt-0 [&_.ProseMirror>table:first-child]:mt-0 [&_td:last-child>p[data-size=small][data-align=right]]:whitespace-nowrap"
|
|
23
|
+
: "[&_table]:my-2",
|
|
24
|
+
"[&_table]:w-full [&_table]:border-collapse",
|
|
25
|
+
"[&_td]:border-b [&_td]:border-border [&_td]:px-2 [&_td]:py-1.5 [&_td>p]:m-0 [&_th>p]:m-0",
|
|
26
|
+
"[&_th]:border-b [&_th]:border-border [&_th]:px-2 [&_th]:py-1.5 [&_th]:text-left [&_th]:text-xs [&_th]:font-medium [&_th]:text-muted-foreground",
|
|
27
|
+
"[&_tr[data-each]>td]:bg-muted/50",
|
|
28
|
+
"[&_[data-align=left]]:text-left [&_[data-align=center]]:text-center [&_[data-align=right]]:text-right [&_[data-align=justify]]:text-justify",
|
|
29
|
+
"[&_p[data-size=small]]:text-xs [&_p[data-size=small]]:text-muted-foreground",
|
|
30
|
+
"[&_a[data-button]]:inline-block [&_a[data-button]]:rounded-full [&_a[data-button]]:bg-primary [&_a[data-button]]:px-4 [&_a[data-button]]:py-1.5 [&_a[data-button]]:text-primary-foreground [&_a[data-button]]:no-underline",
|
|
31
|
+
// A chip in the button would be primary on primary; it inverts to stay readable.
|
|
32
|
+
"[&_a[data-button]_[data-variable-chip]]:border-primary-foreground/40 [&_a[data-button]_[data-variable-chip]]:bg-primary-foreground/15 [&_a[data-button]_[data-variable-chip]]:text-primary-foreground",
|
|
33
|
+
"[&_hr]:my-3 [&_hr]:border-input",
|
|
34
|
+
"[&_.is-editor-empty]:before:pointer-events-none [&_.is-editor-empty]:before:float-left [&_.is-editor-empty]:before:h-0 [&_.is-editor-empty]:before:text-muted-foreground [&_.is-editor-empty]:before:content-[attr(data-placeholder)]",
|
|
35
|
+
)}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { usePrimitives } from "@cosmicdrift/kumiko-renderer";
|
|
2
|
+
import type { Editor } from "@tiptap/core";
|
|
3
|
+
import type { Dispatch, SetStateAction } from "react";
|
|
4
|
+
import {
|
|
5
|
+
type ActiveState,
|
|
6
|
+
BLOCK_PANEL,
|
|
7
|
+
HEADING_LEVELS,
|
|
8
|
+
isParagraphStyle,
|
|
9
|
+
type PanelKind,
|
|
10
|
+
} from "./document-tiptap-helpers.ts";
|
|
11
|
+
import type { DocumentToolbarBlock } from "./document-toolbar-blocks.ts";
|
|
12
|
+
import type { DocumentEditorLabels } from "./use-document-tiptap-model.ts";
|
|
13
|
+
|
|
14
|
+
type Translate = (key: string, params?: Readonly<Record<string, unknown>>) => string;
|
|
15
|
+
type Primitives = ReturnType<typeof usePrimitives>;
|
|
16
|
+
|
|
17
|
+
export type TiptapContext = {
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly t: Translate;
|
|
20
|
+
readonly Button: Primitives["Button"];
|
|
21
|
+
readonly Field: Primitives["Field"];
|
|
22
|
+
readonly Input: Primitives["Input"];
|
|
23
|
+
readonly ActionOverflowMenu: Primitives["ActionOverflowMenu"];
|
|
24
|
+
readonly editor: Editor;
|
|
25
|
+
readonly readOnly: boolean;
|
|
26
|
+
readonly canvas: boolean;
|
|
27
|
+
readonly compact: boolean;
|
|
28
|
+
readonly hosted: boolean;
|
|
29
|
+
readonly labels: DocumentEditorLabels;
|
|
30
|
+
readonly activeState: ActiveState | null;
|
|
31
|
+
readonly openPanel: PanelKind | null;
|
|
32
|
+
readonly setOpenPanel: Dispatch<SetStateAction<PanelKind | null>>;
|
|
33
|
+
readonly canvasScroller: HTMLElement | null;
|
|
34
|
+
readonly setCanvasScroller: Dispatch<SetStateAction<HTMLElement | null>>;
|
|
35
|
+
readonly showHtml: boolean;
|
|
36
|
+
readonly setShowHtml: Dispatch<SetStateAction<boolean>>;
|
|
37
|
+
readonly blocks: readonly DocumentToolbarBlock[];
|
|
38
|
+
readonly variables: readonly string[];
|
|
39
|
+
readonly imageVariables: readonly string[];
|
|
40
|
+
readonly variableLabels: Readonly<Record<string, string>>;
|
|
41
|
+
readonly stableLabels: Readonly<Record<string, string>>;
|
|
42
|
+
readonly togglePanel: (kind: PanelKind) => void;
|
|
43
|
+
readonly runBlock: (block: DocumentToolbarBlock) => void;
|
|
44
|
+
readonly setBlockStyle: (style: string) => void;
|
|
45
|
+
readonly repeatListLabel: string | undefined;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type TiptapContextInput = Pick<
|
|
49
|
+
TiptapContext,
|
|
50
|
+
| "id"
|
|
51
|
+
| "t"
|
|
52
|
+
| "Button"
|
|
53
|
+
| "Field"
|
|
54
|
+
| "Input"
|
|
55
|
+
| "ActionOverflowMenu"
|
|
56
|
+
| "editor"
|
|
57
|
+
| "readOnly"
|
|
58
|
+
| "canvas"
|
|
59
|
+
| "compact"
|
|
60
|
+
| "hosted"
|
|
61
|
+
| "labels"
|
|
62
|
+
| "activeState"
|
|
63
|
+
| "openPanel"
|
|
64
|
+
| "setOpenPanel"
|
|
65
|
+
| "canvasScroller"
|
|
66
|
+
| "setCanvasScroller"
|
|
67
|
+
| "showHtml"
|
|
68
|
+
| "setShowHtml"
|
|
69
|
+
| "blocks"
|
|
70
|
+
| "variables"
|
|
71
|
+
| "imageVariables"
|
|
72
|
+
| "variableLabels"
|
|
73
|
+
| "stableLabels"
|
|
74
|
+
>;
|
|
75
|
+
|
|
76
|
+
function repeatListLabelOf(
|
|
77
|
+
activeState: ActiveState | null,
|
|
78
|
+
variableLabels: Readonly<Record<string, string>>,
|
|
79
|
+
): string | undefined {
|
|
80
|
+
const repeatTable = activeState?.repeatTable ?? null;
|
|
81
|
+
return repeatTable !== null && repeatTable.lists.length === 1
|
|
82
|
+
? (variableLabels[repeatTable.lists[0] ?? ""] ?? repeatTable.lists[0])
|
|
83
|
+
: undefined;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function buildTiptapContext(input: TiptapContextInput): TiptapContext {
|
|
87
|
+
const { editor, setOpenPanel } = input;
|
|
88
|
+
const togglePanel = (kind: PanelKind): void =>
|
|
89
|
+
setOpenPanel((current) => (current === kind ? null : kind));
|
|
90
|
+
|
|
91
|
+
const setBlockStyle = (style: string): void => {
|
|
92
|
+
// skip: not a paragraph style value
|
|
93
|
+
if (!isParagraphStyle(style)) return;
|
|
94
|
+
const chain = editor.chain().focus();
|
|
95
|
+
if (style === "paragraph") chain.setParagraph().run();
|
|
96
|
+
else chain.setHeading({ level: HEADING_LEVELS[style] }).run();
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const runBlock = (block: DocumentToolbarBlock): void => {
|
|
100
|
+
const panel = BLOCK_PANEL[block];
|
|
101
|
+
if (panel) {
|
|
102
|
+
togglePanel(panel);
|
|
103
|
+
// skip: panel blocks open their panel instead of inserting directly
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const chain = editor.chain().focus();
|
|
107
|
+
if (block === "table") chain.insertTable({ rows: 3, cols: 2, withHeaderRow: true }).run();
|
|
108
|
+
else if (block === "divider") chain.insertContent({ type: "divider" }).run();
|
|
109
|
+
else if (block === "pageBreak") chain.insertContent({ type: "pageBreak" }).run();
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
...input,
|
|
114
|
+
togglePanel,
|
|
115
|
+
runBlock,
|
|
116
|
+
setBlockStyle,
|
|
117
|
+
repeatListLabel: repeatListLabelOf(input.activeState, input.variableLabels),
|
|
118
|
+
};
|
|
119
|
+
}
|