@focus-reactive/payload-plugin-translator 0.6.0 → 0.6.2
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/README.md +172 -306
- package/dist/client/app/cache/CacheProvider.d.ts +1 -1
- package/dist/client/app/cache/CacheProvider.export.d.ts +1 -1
- package/dist/client/app/cache/CacheProvider.export.js +2 -2
- package/dist/client/app/cache/CacheProvider.js +5 -5
- package/dist/client/app/config/TranslateKitConfigContext.d.ts +1 -1
- package/dist/client/app/config/TranslateKitConfigContext.js +3 -3
- package/dist/client/app/config/index.d.ts +2 -2
- package/dist/client/app/config/index.js +1 -1
- package/dist/client/entities/translation/api/mutations/useCancelCollectionTranslations.js +7 -7
- package/dist/client/entities/translation/api/mutations/useCancelDocumentTranslation.js +7 -7
- package/dist/client/entities/translation/api/mutations/useQueueDocumentTranslation.d.ts +1 -1
- package/dist/client/entities/translation/api/mutations/useQueueDocumentTranslation.js +8 -8
- package/dist/client/entities/translation/api/mutations/useQueueDocumentTranslations.js +6 -6
- package/dist/client/entities/translation/api/mutations/useRunDocumentTranslation.js +7 -7
- package/dist/client/entities/translation/api/mutations/useTranslateField.d.ts +1 -1
- package/dist/client/entities/translation/api/queries/useCollectionTranslationStatus.d.ts +2 -2
- package/dist/client/entities/translation/api/queries/useCollectionTranslationStatus.js +9 -10
- package/dist/client/entities/translation/api/queries/useDocumentTranslation.d.ts +2 -2
- package/dist/client/entities/translation/api/queries/useDocumentTranslation.js +9 -10
- package/dist/client/entities/translation/index.d.ts +12 -12
- package/dist/client/entities/translation/index.js +11 -11
- package/dist/client/entities/translation/model/types.d.ts +1 -1
- package/dist/client/entities/translation/ui/CompletedTranslationStatus/CompletedTranslationStatus.js +12 -12
- package/dist/client/entities/translation/ui/CompletedTranslationStatus/index.d.ts +1 -1
- package/dist/client/entities/translation/ui/CompletedTranslationStatus/index.js +1 -1
- package/dist/client/entities/translation/ui/CompletedTranslationStatus/styles.module.scss +1 -1
- package/dist/client/entities/translation/ui/FailedTranslationStatus/FailedTranslationStatus.js +8 -8
- package/dist/client/entities/translation/ui/FailedTranslationStatus/index.d.ts +1 -1
- package/dist/client/entities/translation/ui/FailedTranslationStatus/index.js +1 -1
- package/dist/client/entities/translation/ui/FailedTranslationStatus/styles.module.scss +1 -1
- package/dist/client/entities/translation/ui/PendingTranslationStatus/PendingTranslationStatus.js +14 -14
- package/dist/client/entities/translation/ui/PendingTranslationStatus/index.d.ts +1 -1
- package/dist/client/entities/translation/ui/PendingTranslationStatus/index.js +1 -1
- package/dist/client/entities/translation/ui/RunningTranslationStatus/RunningTranslationStatus.js +13 -13
- package/dist/client/entities/translation/ui/RunningTranslationStatus/index.d.ts +1 -1
- package/dist/client/entities/translation/ui/RunningTranslationStatus/index.js +1 -1
- package/dist/client/entities/translation/ui/TranslationDirection/TranslationDirection.d.ts +1 -1
- package/dist/client/entities/translation/ui/TranslationDirection/TranslationDirection.js +2 -2
- package/dist/client/entities/translation/ui/TranslationDirection/index.d.ts +1 -1
- package/dist/client/entities/translation/ui/TranslationDirection/index.js +1 -1
- package/dist/client/entities/translation/ui/TranslationDirection/styles.module.scss +1 -1
- package/dist/client/features/collection-translation-form/index.client.d.ts +1 -1
- package/dist/client/features/collection-translation-form/index.client.js +1 -1
- package/dist/client/features/collection-translation-form/index.d.ts +3 -3
- package/dist/client/features/collection-translation-form/index.js +2 -2
- package/dist/client/features/collection-translation-form/model/constants.d.ts +1 -1
- package/dist/client/features/collection-translation-form/model/constants.js +9 -9
- package/dist/client/features/collection-translation-form/model/form-model.d.ts +1 -1
- package/dist/client/features/collection-translation-form/model/index.d.ts +1 -1
- package/dist/client/features/collection-translation-form/model/index.js +1 -1
- package/dist/client/features/collection-translation-form/model/schema.d.ts +1 -1
- package/dist/client/features/collection-translation-form/model/schema.js +6 -6
- package/dist/client/features/collection-translation-form/ui/CollectionTranslationForm.d.ts +1 -1
- package/dist/client/features/collection-translation-form/ui/index.d.ts +1 -1
- package/dist/client/features/collection-translation-form/ui/index.js +1 -1
- package/dist/client/features/collection-translation-form/ui/styles.module.scss +1 -1
- package/dist/client/features/collection-translation-popup/index.d.ts +1 -1
- package/dist/client/features/collection-translation-popup/index.js +1 -1
- package/dist/client/features/collection-translation-popup/ui/CollectionTranslationPopup.d.ts +1 -1
- package/dist/client/features/collection-translation-popup/ui/styles.module.scss +1 -1
- package/dist/client/features/collection-translation-progress/index.d.ts +1 -1
- package/dist/client/features/collection-translation-progress/index.js +1 -1
- package/dist/client/features/collection-translation-progress/ui/CollectionTranslationProgress.d.ts +2 -2
- package/dist/client/features/collection-translation-progress/ui/CollectionTranslationProgress.js +13 -13
- package/dist/client/features/collection-translation-progress/ui/styles.module.scss +1 -1
- package/dist/client/features/document-translation-progress-failed/index.d.ts +1 -1
- package/dist/client/features/document-translation-progress-failed/index.js +1 -1
- package/dist/client/features/document-translation-progress-failed/ui/DocumentTranslationProgressFailed.d.ts +2 -2
- package/dist/client/features/document-translation-progress-failed/ui/DocumentTranslationProgressFailed.js +3 -3
- package/dist/client/features/document-translation-progress-pending/index.d.ts +1 -1
- package/dist/client/features/document-translation-progress-pending/index.js +1 -1
- package/dist/client/features/document-translation-progress-pending/ui/DocumentTranslationProgressPending.d.ts +2 -2
- package/dist/client/features/document-translation-progress-pending/ui/DocumentTranslationProgressPending.js +5 -5
- package/dist/client/features/document-translation-progress-running/index.d.ts +1 -1
- package/dist/client/features/document-translation-progress-running/index.js +1 -1
- package/dist/client/features/document-translation-progress-running/ui/DocumentTranslationProgressRunning.d.ts +2 -2
- package/dist/client/features/document-translation-progress-running/ui/DocumentTranslationProgressRunning.js +3 -3
- package/dist/client/features/open-document-translation-popup/index.d.ts +1 -1
- package/dist/client/features/open-document-translation-popup/index.js +1 -1
- package/dist/client/features/open-document-translation-popup/ui/styles.module.scss +1 -1
- package/dist/client/features/translate-document-form/index.client.d.ts +1 -1
- package/dist/client/features/translate-document-form/index.client.js +1 -1
- package/dist/client/features/translate-document-form/index.d.ts +3 -3
- package/dist/client/features/translate-document-form/index.js +2 -2
- package/dist/client/features/translate-document-form/model/constants.d.ts +1 -1
- package/dist/client/features/translate-document-form/model/constants.js +11 -11
- package/dist/client/features/translate-document-form/model/form-model.d.ts +1 -1
- package/dist/client/features/translate-document-form/model/index.d.ts +1 -1
- package/dist/client/features/translate-document-form/model/index.js +1 -1
- package/dist/client/features/translate-document-form/model/schema.d.ts +1 -1
- package/dist/client/features/translate-document-form/model/schema.js +5 -5
- package/dist/client/features/translate-document-form/ui/DocumentTranslationForm.d.ts +1 -1
- package/dist/client/features/translate-document-form/ui/index.d.ts +1 -1
- package/dist/client/features/translate-document-form/ui/index.js +1 -1
- package/dist/client/features/translate-document-form/ui/styles.module.scss +1 -1
- package/dist/client/shared/lib/errors/handleApiError.d.ts +1 -1
- package/dist/client/shared/lib/errors/handleApiError.js +2 -2
- package/dist/client/shared/lib/forms/handle-form-error.d.ts +1 -1
- package/dist/client/shared/lib/forms/handle-form-error.js +6 -6
- package/dist/client/shared/lib/payload/hooks/useCollectionDashboardUrlParams.d.ts +1 -1
- package/dist/client/shared/lib/payload/hooks/useCollectionDashboardUrlParams.js +1 -1
- package/dist/client/shared/lib/payload/hooks/useCollectionDocumentUrlParams.d.ts +1 -1
- package/dist/client/shared/lib/payload/hooks/useCollectionDocumentUrlParams.js +2 -2
- package/dist/client/shared/lib/payload/hooks/useLocaleOptions.js +2 -2
- package/dist/client/shared/lib/utils/errors/handleApiError.d.ts +1 -1
- package/dist/client/shared/lib/utils/errors/handleApiError.js +2 -2
- package/dist/client/shared/lib/utils/react/useToggle.js +1 -1
- package/dist/client/shared/providers/CacheClientProvider/CacheClientProvider.factory.d.ts +2 -2
- package/dist/client/shared/providers/CacheClientProvider/CacheClientProvider.factory.js +3 -3
- package/dist/client/shared/providers/CacheClientProvider/index.d.ts +1 -1
- package/dist/client/shared/providers/CacheClientProvider/index.js +1 -1
- package/dist/client/shared/types/AccessGuard.d.ts +1 -1
- package/dist/client/shared/ui/Alert/Alert.d.ts +2 -2
- package/dist/client/shared/ui/Alert/Alert.js +18 -18
- package/dist/client/shared/ui/Alert/index.d.ts +1 -1
- package/dist/client/shared/ui/Alert/index.js +1 -1
- package/dist/client/shared/ui/Alert/styles.module.scss +1 -1
- package/dist/client/shared/ui/Button/index.d.ts +1 -1
- package/dist/client/shared/ui/Button/index.js +1 -1
- package/dist/client/shared/ui/Button/styles.module.scss +6 -3
- package/dist/client/shared/ui/Checkbox/Checkbox.d.ts +2 -2
- package/dist/client/shared/ui/Checkbox/Checkbox.js +4 -4
- package/dist/client/shared/ui/Checkbox/index.d.ts +1 -1
- package/dist/client/shared/ui/Checkbox/index.js +1 -1
- package/dist/client/shared/ui/Checkbox/styles.module.scss +1 -1
- package/dist/client/shared/ui/ColorIndicator/ColorIndicator.d.ts +2 -2
- package/dist/client/shared/ui/ColorIndicator/ColorIndicator.js +2 -2
- package/dist/client/shared/ui/ColorIndicator/index.d.ts +1 -1
- package/dist/client/shared/ui/ColorIndicator/index.js +1 -1
- package/dist/client/shared/ui/ColorIndicator/styles.module.scss +1 -1
- package/dist/client/shared/ui/Description/Description.d.ts +3 -3
- package/dist/client/shared/ui/Description/Description.js +4 -4
- package/dist/client/shared/ui/Description/index.d.ts +1 -1
- package/dist/client/shared/ui/Description/index.js +1 -1
- package/dist/client/shared/ui/Description/styles.module.scss +1 -1
- package/dist/client/shared/ui/Divider/Divider.d.ts +4 -4
- package/dist/client/shared/ui/Divider/Divider.js +4 -4
- package/dist/client/shared/ui/Divider/index.d.ts +1 -1
- package/dist/client/shared/ui/Divider/index.js +1 -1
- package/dist/client/shared/ui/Divider/styles.module.scss +1 -1
- package/dist/client/shared/ui/Label/Label.d.ts +2 -2
- package/dist/client/shared/ui/Label/Label.js +3 -3
- package/dist/client/shared/ui/Label/index.d.ts +1 -1
- package/dist/client/shared/ui/Label/index.js +1 -1
- package/dist/client/shared/ui/Label/styles.module.scss +1 -1
- package/dist/client/shared/ui/Loading/Loading.d.ts +1 -1
- package/dist/client/shared/ui/Loading/Loading.js +9 -9
- package/dist/client/shared/ui/Loading/index.d.ts +1 -1
- package/dist/client/shared/ui/Loading/index.js +1 -1
- package/dist/client/shared/ui/Loading/styles.module.scss +2 -2
- package/dist/client/shared/ui/Popup/Popup.d.ts +1 -1
- package/dist/client/shared/ui/Popup/index.d.ts +1 -1
- package/dist/client/shared/ui/Popup/index.js +1 -1
- package/dist/client/shared/ui/Popup/styles.module.scss +1 -1
- package/dist/client/shared/ui/ProgressBar/ProgressBar.d.ts +2 -2
- package/dist/client/shared/ui/ProgressBar/ProgressBar.js +3 -3
- package/dist/client/shared/ui/ProgressBar/index.d.ts +1 -1
- package/dist/client/shared/ui/ProgressBar/index.js +1 -1
- package/dist/client/shared/ui/ProgressBar/styles.module.scss +1 -1
- package/dist/client/shared/ui/Select/index.d.ts +1 -1
- package/dist/client/shared/ui/Select/index.js +1 -1
- package/dist/client/shared/ui/Select/styles.module.scss +1 -1
- package/dist/client/shared/ui/StatusCounter/StatusCounter.d.ts +2 -2
- package/dist/client/shared/ui/StatusCounter/StatusCounter.js +13 -13
- package/dist/client/shared/ui/StatusCounter/index.d.ts +1 -1
- package/dist/client/shared/ui/StatusCounter/index.js +1 -1
- package/dist/client/shared/ui/StatusCounter/styles.module.scss +1 -1
- package/dist/client/shared/ui/StatusIndicator/StatusIndicator.d.ts +3 -3
- package/dist/client/shared/ui/StatusIndicator/StatusIndicator.js +4 -4
- package/dist/client/shared/ui/StatusIndicator/index.d.ts +1 -1
- package/dist/client/shared/ui/StatusIndicator/index.js +1 -1
- package/dist/client/shared/ui/StatusIndicator/styles.module.scss +1 -1
- package/dist/client/shared/ui/Tooltip/Tooltip.d.ts +2 -2
- package/dist/client/shared/ui/Tooltip/Tooltip.js +4 -4
- package/dist/client/shared/ui/Tooltip/index.d.ts +1 -1
- package/dist/client/shared/ui/Tooltip/index.js +1 -1
- package/dist/client/shared/ui/Tooltip/styles.module.scss +5 -5
- package/dist/client/shared/ui/form/FormCheckbox/FormCheckbox.d.ts +1 -1
- package/dist/client/shared/ui/form/FormCheckbox/FormCheckbox.js +6 -6
- package/dist/client/shared/ui/form/FormCheckbox/index.d.ts +1 -1
- package/dist/client/shared/ui/form/FormCheckbox/index.js +1 -1
- package/dist/client/shared/ui/form/FormCheckbox/styles.module.scss +1 -1
- package/dist/client/shared/ui/form/FormCheckboxPublish/FormCheckboxPublish.js +5 -5
- package/dist/client/shared/ui/form/FormCheckboxPublish/index.d.ts +1 -1
- package/dist/client/shared/ui/form/FormCheckboxPublish/index.js +1 -1
- package/dist/client/shared/ui/form/FormCheckboxPublish/styles.module.scss +1 -1
- package/dist/client/shared/ui/form/FormSelect/FormSelect.d.ts +5 -5
- package/dist/client/shared/ui/form/FormSelect/FormSelect.js +9 -9
- package/dist/client/shared/ui/form/FormSelect/index.d.ts +1 -1
- package/dist/client/shared/ui/form/FormSelect/index.js +1 -1
- package/dist/client/shared/ui/form/FormSelectLocale/FormSelectLocale.d.ts +1 -1
- package/dist/client/shared/ui/form/FormSelectLocale/FormSelectLocale.js +2 -2
- package/dist/client/shared/ui/form/FormSelectLocale/index.d.ts +1 -1
- package/dist/client/shared/ui/form/FormSelectLocale/index.js +1 -1
- package/dist/client/shared/ui/form/FormSelectStrategy/FormSelectStrategy.d.ts +2 -2
- package/dist/client/shared/ui/form/FormSelectStrategy/FormSelectStrategy.js +9 -9
- package/dist/client/shared/ui/form/FormSelectStrategy/index.d.ts +2 -2
- package/dist/client/shared/ui/form/FormSelectStrategy/index.js +1 -1
- package/dist/client/shared/ui/form/FormSelectStrategy/styles.module.scss +1 -1
- package/dist/client/shared/utils/componentPath.js +1 -1
- package/dist/client/widgets/bulk-translation-dashboard/index.d.ts +1 -1
- package/dist/client/widgets/bulk-translation-dashboard/index.js +1 -1
- package/dist/client/widgets/bulk-translation-dashboard/ui/BulkTranslationDashboard.export.d.ts +2 -2
- package/dist/client/widgets/bulk-translation-dashboard/ui/BulkTranslationDashboard.export.js +3 -3
- package/dist/client/widgets/bulk-translation-dashboard/ui/BulkTranslationDashboard.js +11 -11
- package/dist/client/widgets/bulk-translation-dashboard/ui/BulkTranslationDashboard.server.d.ts +2 -2
- package/dist/client/widgets/bulk-translation-dashboard/ui/BulkTranslationDashboard.server.js +3 -3
- package/dist/client/widgets/bulk-translation-dashboard/ui/index.d.ts +1 -1
- package/dist/client/widgets/bulk-translation-dashboard/ui/index.js +1 -1
- package/dist/client/widgets/translate-document/index.d.ts +1 -1
- package/dist/client/widgets/translate-document/index.js +1 -1
- package/dist/client/widgets/translate-document/ui/TranslateDocument.export.d.ts +3 -3
- package/dist/client/widgets/translate-document/ui/TranslateDocument.export.js +3 -3
- package/dist/client/widgets/translate-document/ui/TranslateDocument.js +16 -16
- package/dist/client/widgets/translate-document/ui/TranslateDocument.server.d.ts +2 -2
- package/dist/client/widgets/translate-document/ui/TranslateDocument.server.js +3 -3
- package/dist/client/widgets/translate-document/ui/index.d.ts +1 -1
- package/dist/client/widgets/translate-document/ui/index.js +1 -1
- package/dist/client/widgets/translate-field-control/ui/TranslateFieldControl.export.d.ts +1 -1
- package/dist/client/widgets/translate-field-control/ui/styles.module.scss +1 -1
- package/dist/{server/modules/translation-levels → composition/levels}/collectionLevel.d.ts +1 -1
- package/dist/{server/modules/translation-levels → composition/levels}/collectionLevel.js +1 -1
- package/dist/{server/modules/translation-levels → composition/levels}/documentLevel.d.ts +1 -1
- package/dist/{server/modules/translation-levels → composition/levels}/documentLevel.js +1 -1
- package/dist/{server/modules/translation-levels → composition/levels}/fieldLevel.d.ts +1 -1
- package/dist/{server/modules/translation-levels → composition/levels}/fieldLevel.js +1 -1
- package/dist/composition/levels/index.d.ts +3 -0
- package/dist/composition/levels/index.js +5 -0
- package/dist/{server/modules/translation-levels → composition/levels}/useDocTranslationApi.d.ts +1 -1
- package/dist/{server/modules/translation-levels → composition/levels}/useDocTranslationApi.js +1 -1
- package/dist/core/content-projection/contentProjector.d.ts +28 -0
- package/dist/core/content-projection/contentProjector.js +97 -0
- package/dist/core/content-projection/fingerprinter.d.ts +28 -0
- package/dist/core/content-projection/fingerprinter.js +29 -0
- package/dist/core/content-projection/idPath.d.ts +48 -0
- package/dist/core/content-projection/idPath.js +64 -0
- package/dist/core/content-projection/translatableLeaf.d.ts +27 -0
- package/dist/core/content-projection/translatableLeaf.js +37 -0
- package/dist/core/field-config/getFieldConfig.d.ts +23 -0
- package/dist/{server/shared → core}/field-config/getFieldConfig.js +5 -5
- package/dist/{server/shared → core}/field-config/index.d.ts +3 -3
- package/dist/core/field-config/index.js +4 -0
- package/dist/{server/shared → core}/field-traversal/findFieldByPath.d.ts +2 -3
- package/dist/core/field-traversal/guards.d.ts +19 -0
- package/dist/core/field-traversal/guards.js +20 -0
- package/dist/core/field-traversal/index.d.ts +7 -0
- package/dist/core/field-traversal/index.js +7 -0
- package/dist/{server/shared → core}/field-traversal/kernel.d.ts +7 -8
- package/dist/{server/shared → core}/field-traversal/kernel.js +6 -6
- package/dist/core/field-traversal/predicates.d.ts +24 -0
- package/dist/core/field-traversal/predicates.js +17 -0
- package/dist/{server/shared → core}/field-traversal/types.d.ts +129 -27
- package/dist/{server/shared → core}/field-traversal/types.js +6 -0
- package/dist/{server/shared → core}/field-traversal/walkFields.d.ts +2 -3
- package/dist/core/index.d.ts +10 -0
- package/dist/core/index.js +14 -0
- package/dist/{server/shared → core}/lexical/collectTextNodes.d.ts +1 -1
- package/dist/{server/shared → core}/lexical/collectTextNodes.js +1 -1
- package/dist/{server/shared → core}/lexical/guards.d.ts +1 -1
- package/dist/{server/shared → core}/lexical/guards.js +4 -4
- package/dist/core/lexical/index.d.ts +6 -0
- package/dist/core/lexical/index.js +6 -0
- package/dist/{server/shared → core}/lexical/isEmptyRichText.d.ts +1 -1
- package/dist/{server/shared → core}/lexical/isEmptyRichText.js +3 -3
- package/dist/{server/shared → core}/lexical/traverseLexicalTree.d.ts +1 -1
- package/dist/{server/shared → core}/lexical/traverseLexicalTree.js +1 -1
- package/dist/core/lexical/types.d.ts +33 -0
- package/dist/core/lexical/types.js +11 -0
- package/dist/{server/modules → core}/translation-pipeline/TranslationPipeline.d.ts +4 -4
- package/dist/{server/modules → core}/translation-pipeline/TranslationPipeline.js +1 -1
- package/dist/{server/modules → core}/translation-pipeline/stages/data-reconciler/DataReconciler.d.ts +2 -2
- package/dist/{server/modules → core}/translation-pipeline/stages/data-reconciler/DataReconciler.js +3 -2
- package/dist/core/translation-pipeline/stages/data-reconciler/index.d.ts +2 -0
- package/dist/core/translation-pipeline/stages/data-reconciler/index.js +4 -0
- package/dist/{server/modules → core}/translation-pipeline/stages/field-collector/FieldChunkCollector.d.ts +2 -2
- package/dist/{server/modules → core}/translation-pipeline/stages/field-collector/FieldChunkCollector.js +18 -4
- package/dist/{server/modules → core}/translation-pipeline/stages/field-collector/FieldChunkCollector.stage.d.ts +2 -2
- package/dist/{server/modules → core}/translation-pipeline/stages/field-collector/FieldChunkCollector.stage.js +2 -2
- package/dist/core/translation-pipeline/stages/field-collector/index.d.ts +2 -0
- package/dist/core/translation-pipeline/stages/field-collector/index.js +4 -0
- package/dist/core/translation-pipeline/stages/index.d.ts +6 -0
- package/dist/core/translation-pipeline/stages/index.js +7 -0
- package/dist/{server/modules → core}/translation-pipeline/stages/text-expander/PlainTextExpander.d.ts +2 -2
- package/dist/{server/modules → core}/translation-pipeline/stages/text-expander/PlainTextExpander.js +2 -2
- package/dist/{server/modules → core}/translation-pipeline/stages/text-expander/RichTextExpander.d.ts +2 -2
- package/dist/{server/modules → core}/translation-pipeline/stages/text-expander/RichTextExpander.js +3 -3
- package/dist/{server/modules → core}/translation-pipeline/stages/text-expander/TextChunkExpander.d.ts +2 -2
- package/dist/{server/modules → core}/translation-pipeline/stages/text-expander/TextChunkExpander.stage.d.ts +2 -2
- package/dist/{server/modules → core}/translation-pipeline/stages/text-expander/TextChunkExpander.stage.js +4 -4
- package/dist/{server/modules → core}/translation-pipeline/stages/text-expander/TextExpander.interface.d.ts +1 -1
- package/dist/core/translation-pipeline/stages/text-expander/index.d.ts +6 -0
- package/dist/core/translation-pipeline/stages/text-expander/index.js +6 -0
- package/dist/{server/modules → core}/translation-pipeline/stages/translation/Translation.stage.d.ts +2 -2
- package/dist/{server/modules → core}/translation-pipeline/stages/translation/Translation.stage.js +1 -1
- package/dist/core/translation-pipeline/stages/translation/index.d.ts +1 -0
- package/dist/core/translation-pipeline/stages/translation/index.js +3 -0
- package/dist/{server/modules → core}/translation-pipeline/stages/translation-applicator/TranslationMutator.d.ts +1 -1
- package/dist/{server/modules → core}/translation-pipeline/stages/translation-applicator/TranslationMutator.js +1 -1
- package/dist/{server/modules → core}/translation-pipeline/stages/translation-applicator/TranslationMutator.stage.d.ts +1 -1
- package/dist/{server/modules → core}/translation-pipeline/stages/translation-applicator/TranslationMutator.stage.js +2 -2
- package/dist/core/translation-pipeline/stages/translation-applicator/index.d.ts +2 -0
- package/dist/core/translation-pipeline/stages/translation-applicator/index.js +4 -0
- package/dist/{server/modules → core}/translation-pipeline/strategies/Overwrite.strategy.d.ts +1 -1
- package/dist/{server/modules → core}/translation-pipeline/strategies/Overwrite.strategy.js +1 -1
- package/dist/{server/modules → core}/translation-pipeline/strategies/SkipExisting.strategy.d.ts +1 -1
- package/dist/{server/modules → core}/translation-pipeline/strategies/SkipExisting.strategy.js +3 -1
- package/dist/core/translation-pipeline/strategies/index.d.ts +13 -0
- package/dist/{server/modules → core}/translation-pipeline/strategies/index.js +4 -4
- package/dist/{server/modules → core}/translation-pipeline/translateContent.d.ts +2 -2
- package/dist/{server/modules → core}/translation-pipeline/types/FieldChunk.d.ts +3 -3
- package/dist/{server/modules → core}/translation-pipeline/types/Pipeline.d.ts +2 -2
- package/dist/{server/modules → core}/translation-pipeline/types/PipelineContext.d.ts +4 -4
- package/dist/{server/modules → core}/translation-pipeline/types/TextChunk.d.ts +3 -3
- package/dist/{server/modules → core}/translation-pipeline/types/TextChunk.js +2 -2
- package/dist/core/translation-pipeline/types/index.d.ts +5 -0
- package/dist/core/translation-pipeline/types/index.js +3 -0
- package/dist/core/translation-providers/index.d.ts +1 -0
- package/dist/core/translation-providers/index.js +5 -0
- package/dist/core/utils/index.d.ts +2 -0
- package/dist/core/utils/index.js +4 -0
- package/dist/{server/shared → core}/utils/isEmpty.js +2 -2
- package/dist/{server/shared → core}/utils/isObject.js +1 -1
- package/dist/field-actions.d.ts +1 -1
- package/dist/field-config.d.ts +1 -1
- package/dist/field-config.js +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +4 -4
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.js +1 -1
- package/dist/server/features/_lib/collection-utils.d.ts +1 -1
- package/dist/server/features/_lib/index.d.ts +1 -1
- package/dist/server/features/_lib/index.js +1 -1
- package/dist/server/features/cancel/index.d.ts +1 -1
- package/dist/server/features/cancel/index.js +1 -1
- package/dist/server/features/cancel-by-collection/index.d.ts +1 -1
- package/dist/server/features/cancel-by-collection/index.js +1 -1
- package/dist/server/features/cancel-by-collection/model.d.ts +2 -2
- package/dist/server/features/cancel-by-collection/model.js +1 -1
- package/dist/server/features/createTranslationRoutes.d.ts +1 -1
- package/dist/server/features/enqueue-translation/index.d.ts +1 -1
- package/dist/server/features/enqueue-translation/index.js +1 -1
- package/dist/server/features/enqueue-translation/model.d.ts +2 -2
- package/dist/server/features/enqueue-translation/model.js +4 -4
- package/dist/server/features/get-collection-status/index.d.ts +1 -1
- package/dist/server/features/get-collection-status/index.js +1 -1
- package/dist/server/features/get-collection-status/model.d.ts +3 -3
- package/dist/server/features/get-collection-status/model.js +1 -1
- package/dist/server/features/get-document-status/index.d.ts +2 -2
- package/dist/server/features/get-document-status/index.js +2 -2
- package/dist/server/features/run-translation/index.d.ts +1 -1
- package/dist/server/features/run-translation/index.js +1 -1
- package/dist/server/features/translate-document/handler.d.ts +3 -2
- package/dist/server/features/translate-document/handler.js +1 -1
- package/dist/server/features/translate-document/index.d.ts +1 -1
- package/dist/server/features/translate-document/model.d.ts +2 -7
- package/dist/server/features/translate-document/model.js +1 -2
- package/dist/server/features/translate-field/handler.js +1 -1
- package/dist/server/features/translate-field/index.d.ts +2 -1
- package/dist/server/features/translate-field/model.d.ts +2 -19
- package/dist/server/features/translate-field/resolveFieldSubtree.js +1 -1
- package/dist/server/features/translate-field/route.d.ts +1 -1
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +3 -3
- package/dist/server/modules/index.d.ts +2 -2
- package/dist/server/modules/index.js +2 -2
- package/dist/server/modules/task-runner/TaskRunner.interface.d.ts +2 -2
- package/dist/server/modules/task-runner/TaskRunnerProvider.interface.d.ts +1 -1
- package/dist/server/modules/task-runner/index.d.ts +1 -1
- package/dist/server/modules/task-runner/payload-jobs-runner/index.d.ts +2 -2
- package/dist/server/modules/task-runner/payload-jobs-runner/index.js +1 -1
- package/dist/server/modules/task-runner/sync-runner/index.d.ts +1 -1
- package/dist/server/modules/task-runner/sync-runner/index.js +1 -1
- package/dist/server/modules/translation-levels/PluginConfigBuilder.d.ts +3 -3
- package/dist/server/modules/translation-levels/index.d.ts +1 -4
- package/dist/server/modules/translation-levels/index.js +1 -3
- package/dist/server/modules/translation-levels/types.d.ts +3 -3
- package/dist/server/shared/access/AnyAccessGuard.d.ts +1 -1
- package/dist/server/shared/access/handler.d.ts +1 -1
- package/dist/server/shared/access/index.d.ts +3 -3
- package/dist/server/shared/access/index.js +1 -1
- package/dist/server/shared/access/types.d.ts +1 -1
- package/dist/server/shared/guards/collection-guards.d.ts +1 -1
- package/dist/server/shared/guards/collection-guards.js +2 -2
- package/dist/server/shared/guards/field-guards.d.ts +9 -20
- package/dist/server/shared/guards/field-guards.js +5 -20
- package/dist/server/shared/guards/index.d.ts +3 -3
- package/dist/server/shared/guards/index.js +2 -2
- package/dist/server/shared/http/ServerResponse.js +15 -15
- package/dist/server/shared/http/index.d.ts +3 -3
- package/dist/server/shared/http/index.js +3 -3
- package/dist/server/shared/http/withAccessCheck.d.ts +2 -2
- package/dist/server/shared/http/withAccessCheck.js +1 -1
- package/dist/server/shared/http/withErrorHandler.js +3 -3
- package/dist/server/shared/index.d.ts +6 -5
- package/dist/server/shared/index.js +4 -3
- package/dist/server/shared/utils/filterLocalizedFields.js +2 -2
- package/dist/server/shared/utils/getByPath.js +2 -2
- package/dist/server/shared/utils/index.d.ts +9 -9
- package/dist/server/shared/utils/index.js +8 -8
- package/dist/server/shared/utils/normalizePath.js +3 -3
- package/dist/server/shared/utils/setByPath.js +2 -2
- package/dist/translation-providers/index.d.ts +2 -0
- package/dist/translation-providers/index.js +10 -0
- package/dist/{server/modules/translation-providers → translation-providers/openai}/OpenAITranslation.provider.d.ts +1 -1
- package/dist/{server/modules/translation-providers → translation-providers/openai}/OpenAITranslation.provider.js +1 -1
- package/dist/translation-providers/openai/index.d.ts +1 -0
- package/dist/translation-providers/openai/index.js +5 -0
- package/dist/types/CollectionSchemaMap.d.ts +6 -0
- package/dist/types/CollectionSchemaMap.js +6 -0
- package/dist/{client/shared/types → types}/PayloadComponentExport.d.ts +1 -1
- package/dist/types/index.d.ts +4 -1
- package/dist/types/wire/field-translation.d.ts +17 -0
- package/dist/types/wire/field-translation.js +7 -0
- package/package.json +3 -1
- package/dist/server/modules/translation-pipeline/stages/data-reconciler/index.d.ts +0 -2
- package/dist/server/modules/translation-pipeline/stages/data-reconciler/index.js +0 -4
- package/dist/server/modules/translation-pipeline/stages/field-collector/index.d.ts +0 -2
- package/dist/server/modules/translation-pipeline/stages/field-collector/index.js +0 -4
- package/dist/server/modules/translation-pipeline/stages/index.d.ts +0 -6
- package/dist/server/modules/translation-pipeline/stages/index.js +0 -7
- package/dist/server/modules/translation-pipeline/stages/text-expander/index.d.ts +0 -6
- package/dist/server/modules/translation-pipeline/stages/text-expander/index.js +0 -6
- package/dist/server/modules/translation-pipeline/stages/translation/index.d.ts +0 -1
- package/dist/server/modules/translation-pipeline/stages/translation/index.js +0 -3
- package/dist/server/modules/translation-pipeline/stages/translation-applicator/index.d.ts +0 -2
- package/dist/server/modules/translation-pipeline/stages/translation-applicator/index.js +0 -4
- package/dist/server/modules/translation-pipeline/strategies/index.d.ts +0 -13
- package/dist/server/modules/translation-pipeline/types/index.d.ts +0 -5
- package/dist/server/modules/translation-pipeline/types/index.js +0 -3
- package/dist/server/modules/translation-providers/index.d.ts +0 -2
- package/dist/server/modules/translation-providers/index.js +0 -3
- package/dist/server/shared/field-config/getFieldConfig.d.ts +0 -20
- package/dist/server/shared/field-config/index.js +0 -4
- package/dist/server/shared/field-traversal/index.d.ts +0 -5
- package/dist/server/shared/field-traversal/index.js +0 -5
- package/dist/server/shared/lexical/index.d.ts +0 -6
- package/dist/server/shared/lexical/index.js +0 -6
- package/dist/server/shared/lexical/types.d.ts +0 -19
- package/dist/server/shared/lexical/types.js +0 -8
- /package/dist/{server/shared → core}/field-config/types.d.ts +0 -0
- /package/dist/{server/shared → core}/field-config/types.js +0 -0
- /package/dist/{server/shared → core}/field-traversal/findFieldByPath.js +0 -0
- /package/dist/{server/shared → core}/field-traversal/walkFields.js +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/index.d.ts +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/index.js +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/stages/data-reconciler/DataReconciler.stage.d.ts +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/stages/data-reconciler/DataReconciler.stage.js +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/stages/text-expander/TextChunkExpander.js +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/stages/text-expander/TextExpander.interface.js +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/strategies/TranslationStrategy.interface.d.ts +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/strategies/TranslationStrategy.interface.js +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/translateContent.js +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/types/FieldChunk.js +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/types/Pipeline.js +0 -0
- /package/dist/{server/modules → core}/translation-pipeline/types/PipelineContext.js +0 -0
- /package/dist/{server/modules → core}/translation-providers/TranslationProvider.interface.d.ts +0 -0
- /package/dist/{server/modules → core}/translation-providers/TranslationProvider.interface.js +0 -0
- /package/dist/{server/shared → core}/utils/isEmpty.d.ts +0 -0
- /package/dist/{server/shared → core}/utils/isObject.d.ts +0 -0
- /package/dist/{client/shared/types → types}/PayloadComponentExport.js +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single definition of "which leaf is translatable, and what its source text is" — shared by
|
|
3
|
+
* the read-only {@link projectTranslatableContent} (for the provenance fingerprint) and the
|
|
4
|
+
* translation pipeline's `FieldChunkCollector`, so the two can never disagree on the translatable
|
|
5
|
+
* set (slice 6 design, option B, `docs/plans/2026-06-30-slice6-contentprojector-idpath-design.md`).
|
|
6
|
+
*
|
|
7
|
+
* Payload-free (structural {@link FieldLike} + owned `Serialized*` views only) so it can move to
|
|
8
|
+
* `@repo/translator-core` unchanged.
|
|
9
|
+
*/ import { isFieldExcludedFromTranslation } from "../field-config";
|
|
10
|
+
import { collectSerializedLexicalTextNodes } from "../lexical/collectTextNodes";
|
|
11
|
+
import { isSerializedLexicalRoot } from "../lexical/guards";
|
|
12
|
+
/** The field types this package translates (mirrors `isTranslatableField`, payload-free). */ const isTranslatableFieldType = (field)=>field.type === "text" || field.type === "textarea" || field.type === "richText";
|
|
13
|
+
/** Mirrors `isLocalizedField` structurally. */ const isLocalizedFieldLike = (field)=>field.localized === true;
|
|
14
|
+
/**
|
|
15
|
+
* The leaf-SELECTION decision shared by projection and translation: a leaf is a translation target
|
|
16
|
+
* iff it is a translatable text type, localized, and not excluded via `custom.translateKit`.
|
|
17
|
+
* Independent of the value present — the value governs whether there is text to emit, not selection.
|
|
18
|
+
*/ export const isTranslatableLeaf = (field)=>isTranslatableFieldType(field) && isLocalizedFieldLike(field) && !isFieldExcludedFromTranslation(field);
|
|
19
|
+
/**
|
|
20
|
+
* The shared notion of a leaf's translatable source text, at PROJECTION (field-level) granularity:
|
|
21
|
+
* - `richText` → the normalized join of its non-empty Lexical text nodes (the same nodes the
|
|
22
|
+
* pipeline expands per-node for write-back), trimmed; `null` when it holds no text.
|
|
23
|
+
* - plain `text`/`textarea` → the trimmed string; `null` when empty or not a string.
|
|
24
|
+
*
|
|
25
|
+
* Returns `null` (rather than `""`) for "no translatable text", so callers uniformly skip it.
|
|
26
|
+
*/ export const leafSourceText = (field, value)=>{
|
|
27
|
+
if (field.type === "richText") {
|
|
28
|
+
if (!isSerializedLexicalRoot(value)) return null;
|
|
29
|
+
const text = collectSerializedLexicalTextNodes(value.root).map((ref)=>ref.node.text).join("").trim();
|
|
30
|
+
return text.length > 0 ? text : null;
|
|
31
|
+
}
|
|
32
|
+
if (typeof value !== "string") return null;
|
|
33
|
+
const trimmed = value.trim();
|
|
34
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=translatableLeaf.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { FieldTranslationConfig } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Extract translation configuration from a Payload field.
|
|
4
|
+
*
|
|
5
|
+
* @param field - The field to extract config from (only its `custom` extension point is read)
|
|
6
|
+
* @returns The translation configuration, or empty object if not defined
|
|
7
|
+
*/
|
|
8
|
+
export declare function getFieldTranslationConfig(field: {
|
|
9
|
+
custom?: Record<string, unknown>;
|
|
10
|
+
}): FieldTranslationConfig;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated Use `getFieldTranslationConfig` instead
|
|
13
|
+
*/
|
|
14
|
+
export declare const getTranslateKitFieldConfig: typeof getFieldTranslationConfig;
|
|
15
|
+
/**
|
|
16
|
+
* Check if a field should be excluded from translation.
|
|
17
|
+
*
|
|
18
|
+
* @param field - The field to check (only its `custom` extension point is read)
|
|
19
|
+
* @returns true if the field has `translateKit.exclude: true`
|
|
20
|
+
*/
|
|
21
|
+
export declare function isFieldExcludedFromTranslation(field: {
|
|
22
|
+
custom?: Record<string, unknown>;
|
|
23
|
+
}): boolean;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { TRANSLATE_KIT_CUSTOM_KEY } from
|
|
1
|
+
import { TRANSLATE_KIT_CUSTOM_KEY } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* Extract translation configuration from a Payload field.
|
|
4
4
|
*
|
|
5
|
-
* @param field - The
|
|
5
|
+
* @param field - The field to extract config from (only its `custom` extension point is read)
|
|
6
6
|
* @returns The translation configuration, or empty object if not defined
|
|
7
7
|
*/ export function getFieldTranslationConfig(field) {
|
|
8
|
-
if (!field.custom || typeof field.custom !==
|
|
8
|
+
if (!field.custom || typeof field.custom !== "object") {
|
|
9
9
|
return {};
|
|
10
10
|
}
|
|
11
11
|
const config = field.custom[TRANSLATE_KIT_CUSTOM_KEY];
|
|
12
|
-
if (!config || typeof config !==
|
|
12
|
+
if (!config || typeof config !== "object") {
|
|
13
13
|
return {};
|
|
14
14
|
}
|
|
15
15
|
return config;
|
|
@@ -20,7 +20,7 @@ import { TRANSLATE_KIT_CUSTOM_KEY } from './types';
|
|
|
20
20
|
/**
|
|
21
21
|
* Check if a field should be excluded from translation.
|
|
22
22
|
*
|
|
23
|
-
* @param field - The
|
|
23
|
+
* @param field - The field to check (only its `custom` extension point is read)
|
|
24
24
|
* @returns true if the field has `translateKit.exclude: true`
|
|
25
25
|
*/ export function isFieldExcludedFromTranslation(field) {
|
|
26
26
|
return getFieldTranslationConfig(field).exclude === true;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { getFieldTranslationConfig, getTranslateKitFieldConfig, isFieldExcludedFromTranslation } from
|
|
2
|
-
export { TRANSLATE_KIT_CUSTOM_KEY } from
|
|
3
|
-
export type { FieldTranslationConfig, TranslateKitFieldConfig } from
|
|
1
|
+
export { getFieldTranslationConfig, getTranslateKitFieldConfig, isFieldExcludedFromTranslation, } from "./getFieldConfig";
|
|
2
|
+
export { TRANSLATE_KIT_CUSTOM_KEY } from "./types";
|
|
3
|
+
export type { FieldTranslationConfig, TranslateKitFieldConfig } from "./types";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { LeafField } from "./types";
|
|
1
|
+
import type { FieldLike, LeafField } from "./types";
|
|
3
2
|
/**
|
|
4
3
|
* Outcome of navigating a field schema by a path of segment names (see {@link findFieldByPath}).
|
|
5
4
|
*
|
|
@@ -52,4 +51,4 @@ export type FieldPathResult = {
|
|
|
52
51
|
* @returns A {@link FieldPathResult}.
|
|
53
52
|
* @public
|
|
54
53
|
*/
|
|
55
|
-
export declare function findFieldByPath(fields:
|
|
54
|
+
export declare function findFieldByPath(fields: FieldLike[], segments: string[], data?: unknown): FieldPathResult;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { FieldLike, TabsFieldLike } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Type guard: Checks if a field is a tabs field.
|
|
4
|
+
*/
|
|
5
|
+
export declare function isTabsField(field: FieldLike): field is TabsFieldLike;
|
|
6
|
+
/**
|
|
7
|
+
* Type guard: Checks if value is a block item (has blockType property).
|
|
8
|
+
*/
|
|
9
|
+
export declare function isBlockItem(value: unknown): value is Record<string, unknown> & {
|
|
10
|
+
blockType: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Type guard: Checks if value has a fields array property.
|
|
14
|
+
* Works with any field/tab-like object; narrows to the framework-agnostic {@link FieldLike}
|
|
15
|
+
* so the field-traversal kernel that consumes it stays free of Payload types.
|
|
16
|
+
*/
|
|
17
|
+
export declare function hasFields(value: unknown): value is {
|
|
18
|
+
fields: FieldLike[];
|
|
19
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { isObject } from "../utils/isObject";
|
|
2
|
+
/**
|
|
3
|
+
* Type guard: Checks if a field is a tabs field.
|
|
4
|
+
*/ export function isTabsField(field) {
|
|
5
|
+
return field.type === "tabs";
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Type guard: Checks if value is a block item (has blockType property).
|
|
9
|
+
*/ export function isBlockItem(value) {
|
|
10
|
+
return isObject(value) && "blockType" in value && typeof value.blockType === "string";
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Type guard: Checks if value has a fields array property.
|
|
14
|
+
* Works with any field/tab-like object; narrows to the framework-agnostic {@link FieldLike}
|
|
15
|
+
* so the field-traversal kernel that consumes it stays free of Payload types.
|
|
16
|
+
*/ export function hasFields(value) {
|
|
17
|
+
return isObject(value) && "fields" in value && Array.isArray(value.fields);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=guards.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { findFieldByPath } from "./findFieldByPath";
|
|
2
|
+
export type { FieldPathResult } from "./findFieldByPath";
|
|
3
|
+
export { hasFields, isBlockItem, isTabsField } from "./guards";
|
|
4
|
+
export { classifyField, matchElementById, resolveBlockFields, tabScopes } from "./kernel";
|
|
5
|
+
export { fieldAffectsData, fieldIsArrayType, fieldIsBlockType, fieldIsGroupType, tabHasName, } from "./predicates";
|
|
6
|
+
export type { ArrayFieldLike, BlockLike, BlocksFieldLike, ChildCursor, ChildOutput, ContainerInfo, FieldLike, FieldStructure, FieldWalker, GroupFieldLike, LeafField, LeafFieldLike, TabLike, TabScope, TabsFieldLike, WalkSignal, } from "./types";
|
|
7
|
+
export { walkFields } from "./walkFields";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { findFieldByPath } from "./findFieldByPath";
|
|
2
|
+
export { hasFields, isBlockItem, isTabsField } from "./guards";
|
|
3
|
+
export { classifyField, matchElementById, resolveBlockFields, tabScopes } from "./kernel";
|
|
4
|
+
export { fieldAffectsData, fieldIsArrayType, fieldIsBlockType, fieldIsGroupType, tabHasName } from "./predicates";
|
|
5
|
+
export { walkFields } from "./walkFields";
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { FieldStructure, TabScope } from "./types";
|
|
1
|
+
import type { BlocksFieldLike, FieldLike, FieldStructure, TabScope, TabsFieldLike } from "./types";
|
|
3
2
|
/**
|
|
4
|
-
* Classify a single
|
|
3
|
+
* Classify a single {@link FieldLike} into a discriminated {@link FieldStructure} — the
|
|
5
4
|
* one place that encodes how Payload field types map onto data boundaries.
|
|
6
5
|
*
|
|
7
6
|
* Traversals switch on the result instead of re-deriving the predicate chain
|
|
@@ -39,12 +38,12 @@ import type { FieldStructure, TabScope } from "./types";
|
|
|
39
38
|
* @see {@link walkFields} — the recursive engine built on this classification.
|
|
40
39
|
* @public
|
|
41
40
|
*/
|
|
42
|
-
export declare function classifyField(field:
|
|
41
|
+
export declare function classifyField(field: FieldLike): FieldStructure;
|
|
43
42
|
/**
|
|
44
43
|
* Flatten a `tabs` field's tabs into {@link TabScope}s, absorbing the named/unnamed +
|
|
45
44
|
* `hasFields` handling that field traversals would otherwise each repeat.
|
|
46
45
|
*
|
|
47
|
-
* @param field - A
|
|
46
|
+
* @param field - A {@link TabsFieldLike}.
|
|
48
47
|
* @returns One {@link TabScope} per tab that has fields, in declaration order:
|
|
49
48
|
* - a **named** tab → `{ named: true, tab }` — it opens a data boundary at `tab.name`, and
|
|
50
49
|
* the `NamedTab` is surfaced so callers can read its `name`/`fields`/config;
|
|
@@ -60,12 +59,12 @@ export declare function classifyField(field: Field): FieldStructure;
|
|
|
60
59
|
* ```
|
|
61
60
|
* @public
|
|
62
61
|
*/
|
|
63
|
-
export declare function tabScopes(field:
|
|
62
|
+
export declare function tabScopes(field: TabsFieldLike): TabScope[];
|
|
64
63
|
/**
|
|
65
64
|
* Resolve the child `fields` for a single `blocks` element by matching its `blockType`
|
|
66
65
|
* against the field's block definitions.
|
|
67
66
|
*
|
|
68
|
-
* @param field - A
|
|
67
|
+
* @param field - A {@link BlocksFieldLike} carrying inline block definitions.
|
|
69
68
|
* @param item - The data for one block element (expected to carry a `blockType` string).
|
|
70
69
|
* @returns The matched block's `fields`, or `null` when `item` is not a block object or its
|
|
71
70
|
* `blockType` matches no defined block.
|
|
@@ -82,7 +81,7 @@ export declare function tabScopes(field: TabsField): TabScope[];
|
|
|
82
81
|
* ```
|
|
83
82
|
* @public
|
|
84
83
|
*/
|
|
85
|
-
export declare function resolveBlockFields(field:
|
|
84
|
+
export declare function resolveBlockFields(field: BlocksFieldLike, item: unknown): FieldLike[] | null;
|
|
86
85
|
/**
|
|
87
86
|
* Find the element of a parallel data array that corresponds to `refItem` by `id` — not by
|
|
88
87
|
* position.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { hasFields, isBlockItem, isTabsField } from "
|
|
3
|
-
import {
|
|
1
|
+
import { isObject } from "../utils/isObject";
|
|
2
|
+
import { hasFields, isBlockItem, isTabsField } from "./guards";
|
|
3
|
+
import { fieldAffectsData, fieldIsArrayType, fieldIsBlockType, fieldIsGroupType, tabHasName } from "./predicates";
|
|
4
4
|
/**
|
|
5
|
-
* Classify a single
|
|
5
|
+
* Classify a single {@link FieldLike} into a discriminated {@link FieldStructure} — the
|
|
6
6
|
* one place that encodes how Payload field types map onto data boundaries.
|
|
7
7
|
*
|
|
8
8
|
* Traversals switch on the result instead of re-deriving the predicate chain
|
|
@@ -88,7 +88,7 @@ import { isObject } from "../utils";
|
|
|
88
88
|
* Flatten a `tabs` field's tabs into {@link TabScope}s, absorbing the named/unnamed +
|
|
89
89
|
* `hasFields` handling that field traversals would otherwise each repeat.
|
|
90
90
|
*
|
|
91
|
-
* @param field - A
|
|
91
|
+
* @param field - A {@link TabsFieldLike}.
|
|
92
92
|
* @returns One {@link TabScope} per tab that has fields, in declaration order:
|
|
93
93
|
* - a **named** tab → `{ named: true, tab }` — it opens a data boundary at `tab.name`, and
|
|
94
94
|
* the `NamedTab` is surfaced so callers can read its `name`/`fields`/config;
|
|
@@ -121,7 +121,7 @@ import { isObject } from "../utils";
|
|
|
121
121
|
* Resolve the child `fields` for a single `blocks` element by matching its `blockType`
|
|
122
122
|
* against the field's block definitions.
|
|
123
123
|
*
|
|
124
|
-
* @param field - A
|
|
124
|
+
* @param field - A {@link BlocksFieldLike} carrying inline block definitions.
|
|
125
125
|
* @param item - The data for one block element (expected to carry a `blockType` string).
|
|
126
126
|
* @returns The matched block's `fields`, or `null` when `item` is not a block object or its
|
|
127
127
|
* `blockType` matches no defined block.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ArrayFieldLike, BlocksFieldLike, FieldLike, GroupFieldLike, TabLike } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Framework-agnostic re-implementations of Payload's field predicates, defined over the
|
|
4
|
+
* structural {@link FieldLike} family so this traversal layer carries no `payload` import.
|
|
5
|
+
* Each matches `payload/shared` exactly on every field type (pinned by `predicates.test.ts`);
|
|
6
|
+
* the parity guard must stay green before the classifier can rely on these.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
/** True for an `array` field. Mirrors `payload/shared`'s `fieldIsArrayType`. */
|
|
11
|
+
export declare const fieldIsArrayType: (field: FieldLike) => field is ArrayFieldLike;
|
|
12
|
+
/** True for a `blocks` field. Mirrors `payload/shared`'s `fieldIsBlockType`. */
|
|
13
|
+
export declare const fieldIsBlockType: (field: FieldLike) => field is BlocksFieldLike;
|
|
14
|
+
/** True for a `group` field. Mirrors `payload/shared`'s `fieldIsGroupType`. */
|
|
15
|
+
export declare const fieldIsGroupType: (field: FieldLike) => field is GroupFieldLike;
|
|
16
|
+
/**
|
|
17
|
+
* True when a field carries data (has a `name`) and is not a presentational `ui` field.
|
|
18
|
+
* Mirrors `payload/shared`'s `fieldAffectsData`.
|
|
19
|
+
*/
|
|
20
|
+
export declare const fieldAffectsData: (field: FieldLike) => boolean;
|
|
21
|
+
/** True when a tab has a `name` (so it opens a data boundary). Mirrors `payload/shared`'s `tabHasName`. */
|
|
22
|
+
export declare const tabHasName: (tab: TabLike) => tab is TabLike & {
|
|
23
|
+
name: string;
|
|
24
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Framework-agnostic re-implementations of Payload's field predicates, defined over the
|
|
3
|
+
* structural {@link FieldLike} family so this traversal layer carries no `payload` import.
|
|
4
|
+
* Each matches `payload/shared` exactly on every field type (pinned by `predicates.test.ts`);
|
|
5
|
+
* the parity guard must stay green before the classifier can rely on these.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/ /** True for an `array` field. Mirrors `payload/shared`'s `fieldIsArrayType`. */ export const fieldIsArrayType = (field)=>field.type === "array";
|
|
9
|
+
/** True for a `blocks` field. Mirrors `payload/shared`'s `fieldIsBlockType`. */ export const fieldIsBlockType = (field)=>field.type === "blocks";
|
|
10
|
+
/** True for a `group` field. Mirrors `payload/shared`'s `fieldIsGroupType`. */ export const fieldIsGroupType = (field)=>field.type === "group";
|
|
11
|
+
/**
|
|
12
|
+
* True when a field carries data (has a `name`) and is not a presentational `ui` field.
|
|
13
|
+
* Mirrors `payload/shared`'s `fieldAffectsData`.
|
|
14
|
+
*/ export const fieldAffectsData = (field)=>"name" in field && field.type !== "ui";
|
|
15
|
+
/** True when a tab has a `name` (so it opens a data boundary). Mirrors `payload/shared`'s `tabHasName`. */ export const tabHasName = (tab)=>"name" in tab;
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=predicates.js.map
|
|
@@ -1,16 +1,112 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* A block definition as this layer needs to read it: a `slug` to match a data element's
|
|
3
|
+
* `blockType` against, and the child `fields` to descend into. Structurally a superset-compatible
|
|
4
|
+
* shape of Payload's `Block` (Payload's concrete `Block` is assignable to this).
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export interface BlockLike {
|
|
9
|
+
slug: string;
|
|
10
|
+
fields: FieldLike[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A tab as this layer needs to read it: an optional `name` (present → it opens a data boundary;
|
|
14
|
+
* absent → it flattens into the parent scope) and its child `fields`. Payload's `Tab`
|
|
15
|
+
* (`NamedTab | UnnamedTab`) is assignable to this.
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export interface TabLike {
|
|
20
|
+
name?: string;
|
|
21
|
+
fields: FieldLike[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The structural shape of a single field this traversal layer reads — a framework-agnostic
|
|
25
|
+
* superset that Payload's concrete `Field` union is assignable to. The layer only ever reads
|
|
26
|
+
* `type` (to classify), `name`/`localized`/`custom` (leaf data + translation config), and the
|
|
27
|
+
* container members `fields`/`blocks`/`tabs` (to descend). Nothing Payload-specific leaks in.
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export interface FieldLike {
|
|
32
|
+
type: string;
|
|
33
|
+
name?: string;
|
|
34
|
+
localized?: boolean;
|
|
35
|
+
custom?: Record<string, unknown>;
|
|
36
|
+
fields?: FieldLike[];
|
|
37
|
+
blocks?: BlockLike[];
|
|
38
|
+
tabs?: TabLike[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A `group` field: a named data boundary whose child `fields` live one level down at `name`.
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
export interface GroupFieldLike extends FieldLike {
|
|
46
|
+
type: "group";
|
|
47
|
+
name: string;
|
|
48
|
+
fields: FieldLike[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* An `array` field: a named, repeating data boundary. Its `fields` describe one element; the
|
|
52
|
+
* data carries N elements keyed by index.
|
|
53
|
+
*
|
|
54
|
+
* @public
|
|
55
|
+
*/
|
|
56
|
+
export interface ArrayFieldLike extends FieldLike {
|
|
57
|
+
type: "array";
|
|
58
|
+
name: string;
|
|
59
|
+
fields: FieldLike[];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A `blocks` field: a named, polymorphic repeating boundary. Each element's child fields are
|
|
63
|
+
* resolved per element by matching its `blockType` against `blocks[].slug`.
|
|
64
|
+
*
|
|
65
|
+
* @public
|
|
66
|
+
*/
|
|
67
|
+
export interface BlocksFieldLike extends FieldLike {
|
|
68
|
+
type: "blocks";
|
|
69
|
+
name: string;
|
|
70
|
+
blocks: BlockLike[];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A `tabs` field: carries `tabs` (not `fields`) and is non-data-affecting. Expand with
|
|
74
|
+
* `tabScopes` into named/unnamed {@link TabScope}s.
|
|
75
|
+
*
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
export interface TabsFieldLike extends FieldLike {
|
|
79
|
+
type: "tabs";
|
|
80
|
+
tabs: TabLike[];
|
|
81
|
+
}
|
|
2
82
|
/**
|
|
3
83
|
* A data-affecting field the engine routes to `leaf`: a scalar/relational leaf, never a
|
|
4
|
-
* container (`group`/`array`/`blocks`)
|
|
5
|
-
*
|
|
6
|
-
*
|
|
84
|
+
* container (`group`/`array`/`blocks`/`tabs`). The `never` guards on the container members are
|
|
85
|
+
* what exclude containers — a `FieldLike` carrying `fields`/`blocks`/`tabs` is NOT assignable
|
|
86
|
+
* here, so leaf dispatch can never silently widen onto a container, and `name` is always present.
|
|
87
|
+
*
|
|
88
|
+
* @public
|
|
89
|
+
*/
|
|
90
|
+
export interface LeafFieldLike {
|
|
91
|
+
name: string;
|
|
92
|
+
type: string;
|
|
93
|
+
localized?: boolean;
|
|
94
|
+
custom?: Record<string, unknown>;
|
|
95
|
+
fields?: never;
|
|
96
|
+
blocks?: never;
|
|
97
|
+
tabs?: never;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Back-compat alias for {@link LeafFieldLike}. Existing consumers (and `index.ts`) re-export
|
|
101
|
+
* `LeafField`; the leaf is now defined structurally rather than as a narrowing of Payload's
|
|
102
|
+
* `FieldAffectingData`.
|
|
7
103
|
*
|
|
8
104
|
* @public
|
|
9
105
|
*/
|
|
10
|
-
export type LeafField =
|
|
106
|
+
export type LeafField = LeafFieldLike;
|
|
11
107
|
/**
|
|
12
|
-
* Structural classification of a single
|
|
13
|
-
* how
|
|
108
|
+
* Structural classification of a single field — the one place that encodes
|
|
109
|
+
* how field types map onto data boundaries (the dispatch order
|
|
14
110
|
* `tabs → transparent → group → array → blocks → leaf`).
|
|
15
111
|
*
|
|
16
112
|
* Consumed by {@link FieldWalker}/`walkFields` (the exhaustive, data-parallel walks)
|
|
@@ -29,33 +125,33 @@ export type LeafField = Exclude<FieldAffectingData, ArrayField | BlocksField | N
|
|
|
29
125
|
*/
|
|
30
126
|
export type FieldStructure = {
|
|
31
127
|
kind: "tabs";
|
|
32
|
-
field:
|
|
128
|
+
field: TabsFieldLike;
|
|
33
129
|
} | {
|
|
34
130
|
kind: "transparent";
|
|
35
|
-
fields:
|
|
131
|
+
fields: FieldLike[];
|
|
36
132
|
} | {
|
|
37
133
|
kind: "presentational";
|
|
38
134
|
} | {
|
|
39
135
|
kind: "group";
|
|
40
136
|
name: string;
|
|
41
|
-
fields:
|
|
42
|
-
field:
|
|
137
|
+
fields: FieldLike[];
|
|
138
|
+
field: GroupFieldLike;
|
|
43
139
|
} | {
|
|
44
140
|
kind: "array";
|
|
45
141
|
name: string;
|
|
46
|
-
fields:
|
|
47
|
-
field:
|
|
142
|
+
fields: FieldLike[];
|
|
143
|
+
field: ArrayFieldLike;
|
|
48
144
|
} | {
|
|
49
145
|
kind: "blocks";
|
|
50
146
|
name: string;
|
|
51
|
-
field:
|
|
147
|
+
field: BlocksFieldLike;
|
|
52
148
|
} | {
|
|
53
149
|
kind: "leaf";
|
|
54
150
|
name: string;
|
|
55
|
-
field:
|
|
151
|
+
field: LeafFieldLike;
|
|
56
152
|
};
|
|
57
153
|
/**
|
|
58
|
-
* A tab flattened by `tabScopes`. A named tab opens a data boundary, so its
|
|
154
|
+
* A tab flattened by `tabScopes`. A named tab opens a data boundary, so its {@link TabLike}
|
|
59
155
|
* is surfaced (the walker passes it to `enterObject`, and `tab.name` is the data key).
|
|
60
156
|
* An unnamed tab flattens into the parent data scope, so only its `fields` are needed.
|
|
61
157
|
*
|
|
@@ -64,10 +160,12 @@ export type FieldStructure = {
|
|
|
64
160
|
*/
|
|
65
161
|
export type TabScope = {
|
|
66
162
|
named: true;
|
|
67
|
-
tab:
|
|
163
|
+
tab: TabLike & {
|
|
164
|
+
name: string;
|
|
165
|
+
};
|
|
68
166
|
} | {
|
|
69
167
|
named: false;
|
|
70
|
-
fields:
|
|
168
|
+
fields: FieldLike[];
|
|
71
169
|
};
|
|
72
170
|
/**
|
|
73
171
|
* Control signal a walker callback can return instead of descending.
|
|
@@ -88,7 +186,7 @@ export type WalkSignal = "skip" | "stop";
|
|
|
88
186
|
export interface ChildCursor<Cursor extends object> {
|
|
89
187
|
cursor: Cursor;
|
|
90
188
|
/** Child fields to walk under this item. For `blocks`, the resolved `block.fields`. */
|
|
91
|
-
fields:
|
|
189
|
+
fields: FieldLike[];
|
|
92
190
|
/** Index/key this child sits at; surfaced back to `combine`. */
|
|
93
191
|
key: string | number;
|
|
94
192
|
}
|
|
@@ -109,15 +207,17 @@ export type ContainerInfo = {
|
|
|
109
207
|
field: null;
|
|
110
208
|
} | {
|
|
111
209
|
kind: "object";
|
|
112
|
-
field:
|
|
210
|
+
field: GroupFieldLike | (TabLike & {
|
|
211
|
+
name: string;
|
|
212
|
+
});
|
|
113
213
|
key: string;
|
|
114
214
|
} | {
|
|
115
215
|
kind: "list";
|
|
116
|
-
field:
|
|
216
|
+
field: ArrayFieldLike | BlocksFieldLike;
|
|
117
217
|
key: string;
|
|
118
218
|
} | {
|
|
119
219
|
kind: "element";
|
|
120
|
-
field:
|
|
220
|
+
field: ArrayFieldLike | BlocksFieldLike;
|
|
121
221
|
key: string | number;
|
|
122
222
|
};
|
|
123
223
|
/**
|
|
@@ -172,16 +272,18 @@ export interface ChildOutput<Out> {
|
|
|
172
272
|
*/
|
|
173
273
|
export interface FieldWalker<Cursor extends object, Out> {
|
|
174
274
|
/** Enter a single-object boundary (named `group` or named tab). Return the child cursor, or a signal. */
|
|
175
|
-
enterObject(field:
|
|
275
|
+
enterObject(field: GroupFieldLike | (TabLike & {
|
|
276
|
+
name: string;
|
|
277
|
+
}), cursor: Cursor): Cursor | WalkSignal;
|
|
176
278
|
/** Enter an `array`/`blocks` boundary. Return one {@link ChildCursor} per element, or a signal. */
|
|
177
|
-
enterList(field:
|
|
279
|
+
enterList(field: ArrayFieldLike | BlocksFieldLike, cursor: Cursor): ChildCursor<Cursor>[] | WalkSignal;
|
|
178
280
|
/**
|
|
179
|
-
* Visit a data-affecting leaf. `field` is a {@link
|
|
281
|
+
* Visit a data-affecting leaf. `field` is a {@link LeafFieldLike} — the engine has already
|
|
180
282
|
* resolved it via the `fieldAffectsData` guard and excluded containers/tabs, so `field.name`
|
|
181
|
-
* is always present and callers never touch the raw
|
|
283
|
+
* is always present and callers never touch the raw field union. Return its output, or
|
|
182
284
|
* `undefined` to drop it.
|
|
183
285
|
*/
|
|
184
|
-
leaf(field:
|
|
286
|
+
leaf(field: LeafFieldLike, cursor: Cursor): Out | undefined;
|
|
185
287
|
/**
|
|
186
288
|
* Assemble a container from its children's outputs (called bottom-up). Build-tree
|
|
187
289
|
* callers reconstruct here; collectors return `undefined`. Return `undefined` to drop
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
+
* A block definition as this layer needs to read it: a `slug` to match a data element's
|
|
3
|
+
* `blockType` against, and the child `fields` to descend into. Structurally a superset-compatible
|
|
4
|
+
* shape of Payload's `Block` (Payload's concrete `Block` is assignable to this).
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/ /**
|
|
2
8
|
* Behaviour a caller plugs into {@link walkFields}. The engine owns structural dispatch and
|
|
3
9
|
* recursion over the **schema**; the caller owns the **data** via the opaque `Cursor`
|
|
4
10
|
* (1..n parallel data trees plus any path live there) and decides what to produce.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { FieldWalker } from "./types";
|
|
1
|
+
import type { FieldLike, FieldWalker } from "./types";
|
|
3
2
|
/**
|
|
4
3
|
* Depth-first walk of a Payload field **schema**, driving a caller-supplied
|
|
5
4
|
* {@link FieldWalker}. The single traversal engine this package's data operations build on
|
|
@@ -48,4 +47,4 @@ import type { FieldWalker } from "./types";
|
|
|
48
47
|
* @see {@link FieldWalker} for the full visitor contract and the caller shapes it subsumes.
|
|
49
48
|
* @public
|
|
50
49
|
*/
|
|
51
|
-
export declare function walkFields<Cursor extends object, Out>(fields:
|
|
50
|
+
export declare function walkFields<Cursor extends object, Out>(fields: FieldLike[], root: Cursor, walker: FieldWalker<Cursor, Out>): Out | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type { TranslationProvider, TranslationInput, TranslationOutput, TranslationIndex, } from "./translation-providers";
|
|
2
|
+
export { TranslationPipeline, translateContent } from "./translation-pipeline";
|
|
3
|
+
export type { TranslateContentArgs, TranslationStrategy } from "./translation-pipeline";
|
|
4
|
+
export { projectTranslatableContent } from "./content-projection/contentProjector";
|
|
5
|
+
export type { ProjectionEntry } from "./content-projection/contentProjector";
|
|
6
|
+
export { fingerprint } from "./content-projection/fingerprinter";
|
|
7
|
+
export { makeIdPath } from "./content-projection/idPath";
|
|
8
|
+
export type { IdPath, PathSegment } from "./content-projection/idPath";
|
|
9
|
+
export { classifyField, findFieldByPath, hasFields, isBlockItem, isTabsField, matchElementById, resolveBlockFields, tabScopes, walkFields, } from "./field-traversal";
|
|
10
|
+
export type { ArrayFieldLike, BlockLike, BlocksFieldLike, FieldLike, FieldStructure, FieldWalker, GroupFieldLike, LeafField, LeafFieldLike, TabLike, TabScope, TabsFieldLike, } from "./field-traversal";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Framework-agnostic translator core. No payload / @payloadcms / next / react.
|
|
2
|
+
// The plugin (adapter) re-exports the public bits from here.
|
|
3
|
+
// Translation provider PORT (contract) only — dependency-free. The built-in OpenAI
|
|
4
|
+
// implementation lives in the plugin src/providers (outside core) so this barrel never pulls `openai`.
|
|
5
|
+
// Translation pipeline
|
|
6
|
+
export { TranslationPipeline, translateContent } from "./translation-pipeline";
|
|
7
|
+
// Content projection
|
|
8
|
+
export { projectTranslatableContent } from "./content-projection/contentProjector";
|
|
9
|
+
export { fingerprint } from "./content-projection/fingerprinter";
|
|
10
|
+
export { makeIdPath } from "./content-projection/idPath";
|
|
11
|
+
// Field traversal
|
|
12
|
+
export { classifyField, findFieldByPath, hasFields, isBlockItem, isTabsField, matchElementById, resolveBlockFields, tabScopes, walkFields } from "./field-traversal";
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SerializedLexicalNode, SerializedTextNodeRef } from
|
|
1
|
+
import type { SerializedLexicalNode, SerializedTextNodeRef } from "./types";
|
|
2
2
|
/**
|
|
3
3
|
* Traverses serialized Lexical JSON and returns all non-empty text node references.
|
|
4
4
|
* Only collects text nodes with content (after trimming whitespace).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hasChildren, isSerializedLexicalTextNode } from
|
|
1
|
+
import { hasChildren, isSerializedLexicalTextNode } from "./guards";
|
|
2
2
|
/**
|
|
3
3
|
* Recursively collects text node references from serialized Lexical JSON.
|
|
4
4
|
*/ function collectTextNodesRecursive(node, refs) {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { isObject } from
|
|
1
|
+
import { isObject } from "../utils/isObject";
|
|
2
2
|
/**
|
|
3
3
|
* Type guard: Checks if value is a serialized Lexical root structure.
|
|
4
4
|
*/ export function isSerializedLexicalRoot(value) {
|
|
5
|
-
return isObject(value) &&
|
|
5
|
+
return isObject(value) && "root" in value && isObject(value.root);
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* Type guard: Checks if node is a serialized Lexical text node.
|
|
9
9
|
*/ export function isSerializedLexicalTextNode(node) {
|
|
10
|
-
return node.type ===
|
|
10
|
+
return node.type === "text" && "text" in node && typeof node.text === "string";
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Type guard: Checks if node has children array.
|
|
14
14
|
*/ export function hasChildren(node) {
|
|
15
|
-
return
|
|
15
|
+
return "children" in node && Array.isArray(node.children);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
//# sourceMappingURL=guards.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type { SerializedTextNodeRef, SerializedLexicalRoot, SerializedLexicalNode, SerializedTextNode, SerializedRootNode, } from "./types";
|
|
2
|
+
export type { SerializedLexicalNodeWithChildren } from "./guards";
|
|
3
|
+
export { isSerializedLexicalRoot, isSerializedLexicalTextNode, hasChildren } from "./guards";
|
|
4
|
+
export { isEmptyRichText } from "./isEmptyRichText";
|
|
5
|
+
export { traverseLexicalTree } from "./traverseLexicalTree";
|
|
6
|
+
export { collectSerializedLexicalTextNodes } from "./collectTextNodes";
|