@plumix/core 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cache/embedded-tags.d.ts +5 -0
- package/dist/cache/embedded-tags.d.ts.map +1 -0
- package/dist/cache/embedded-tags.js +30 -0
- package/dist/cache/embedded-tags.js.map +1 -0
- package/dist/entries/read-service.d.ts.map +1 -1
- package/dist/entries/read-service.js +5 -3
- package/dist/entries/read-service.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/plugin/errors.d.ts +7 -1
- package/dist/plugin/errors.d.ts.map +1 -1
- package/dist/plugin/errors.js +5 -0
- package/dist/plugin/errors.js.map +1 -1
- package/dist/plugin/fields/builder.d.ts +106 -0
- package/dist/plugin/fields/builder.d.ts.map +1 -0
- package/dist/plugin/fields/builder.js +162 -0
- package/dist/plugin/fields/builder.js.map +1 -0
- package/dist/plugin/fields/color.d.ts +78 -18
- package/dist/plugin/fields/color.d.ts.map +1 -1
- package/dist/plugin/fields/color.js +116 -25
- package/dist/plugin/fields/color.js.map +1 -1
- package/dist/plugin/fields/condition.d.ts +40 -0
- package/dist/plugin/fields/condition.d.ts.map +1 -0
- package/dist/plugin/fields/condition.js +115 -0
- package/dist/plugin/fields/condition.js.map +1 -0
- package/dist/plugin/fields/contributions.d.ts +233 -0
- package/dist/plugin/fields/contributions.d.ts.map +1 -0
- package/dist/plugin/fields/contributions.js +1 -0
- package/dist/plugin/fields/contributions.js.map +1 -0
- package/dist/plugin/fields/entry.d.ts +18 -22
- package/dist/plugin/fields/entry.d.ts.map +1 -1
- package/dist/plugin/fields/entry.js +13 -21
- package/dist/plugin/fields/entry.js.map +1 -1
- package/dist/plugin/fields/errors.d.ts +23 -11
- package/dist/plugin/fields/errors.d.ts.map +1 -1
- package/dist/plugin/fields/errors.js +20 -13
- package/dist/plugin/fields/errors.js.map +1 -1
- package/dist/plugin/fields/group.d.ts +90 -0
- package/dist/plugin/fields/group.d.ts.map +1 -0
- package/dist/plugin/fields/group.js +124 -0
- package/dist/plugin/fields/group.js.map +1 -0
- package/dist/plugin/fields/index.d.ts +22 -45
- package/dist/plugin/fields/index.d.ts.map +1 -1
- package/dist/plugin/fields/index.js +25 -30
- package/dist/plugin/fields/index.js.map +1 -1
- package/dist/plugin/fields/json.d.ts +71 -9
- package/dist/plugin/fields/json.d.ts.map +1 -1
- package/dist/plugin/fields/json.js +110 -16
- package/dist/plugin/fields/json.js.map +1 -1
- package/dist/plugin/fields/link.d.ts +96 -0
- package/dist/plugin/fields/link.d.ts.map +1 -0
- package/dist/plugin/fields/link.js +160 -0
- package/dist/plugin/fields/link.js.map +1 -0
- package/dist/plugin/fields/number.d.ts +86 -13
- package/dist/plugin/fields/number.d.ts.map +1 -1
- package/dist/plugin/fields/number.js +133 -20
- package/dist/plugin/fields/number.js.map +1 -1
- package/dist/plugin/fields/range.d.ts +101 -17
- package/dist/plugin/fields/range.d.ts.map +1 -1
- package/dist/plugin/fields/range.js +153 -38
- package/dist/plugin/fields/range.js.map +1 -1
- package/dist/plugin/fields/reference.d.ts +171 -0
- package/dist/plugin/fields/reference.d.ts.map +1 -0
- package/dist/plugin/fields/reference.js +193 -0
- package/dist/plugin/fields/reference.js.map +1 -0
- package/dist/plugin/fields/repeater.d.ts +111 -8
- package/dist/plugin/fields/repeater.d.ts.map +1 -1
- package/dist/plugin/fields/repeater.js +157 -66
- package/dist/plugin/fields/repeater.js.map +1 -1
- package/dist/plugin/fields/richtext-validate.d.ts +7 -0
- package/dist/plugin/fields/richtext-validate.d.ts.map +1 -1
- package/dist/plugin/fields/richtext-validate.js +11 -5
- package/dist/plugin/fields/richtext-validate.js.map +1 -1
- package/dist/plugin/fields/richtext.d.ts +78 -12
- package/dist/plugin/fields/richtext.d.ts.map +1 -1
- package/dist/plugin/fields/richtext.js +121 -26
- package/dist/plugin/fields/richtext.js.map +1 -1
- package/dist/plugin/fields/select.d.ts +150 -10
- package/dist/plugin/fields/select.d.ts.map +1 -1
- package/dist/plugin/fields/select.js +205 -17
- package/dist/plugin/fields/select.js.map +1 -1
- package/dist/plugin/fields/sub-fields.d.ts +12 -0
- package/dist/plugin/fields/sub-fields.d.ts.map +1 -0
- package/dist/plugin/fields/sub-fields.js +62 -0
- package/dist/plugin/fields/sub-fields.js.map +1 -0
- package/dist/plugin/fields/temporal.d.ts +124 -0
- package/dist/plugin/fields/temporal.d.ts.map +1 -0
- package/dist/plugin/fields/temporal.js +180 -0
- package/dist/plugin/fields/temporal.js.map +1 -0
- package/dist/plugin/fields/term.d.ts +11 -16
- package/dist/plugin/fields/term.d.ts.map +1 -1
- package/dist/plugin/fields/term.js +11 -19
- package/dist/plugin/fields/term.js.map +1 -1
- package/dist/plugin/fields/toggle.d.ts +97 -0
- package/dist/plugin/fields/toggle.d.ts.map +1 -0
- package/dist/plugin/fields/toggle.js +135 -0
- package/dist/plugin/fields/toggle.js.map +1 -0
- package/dist/plugin/fields/user.d.ts +14 -26
- package/dist/plugin/fields/user.d.ts.map +1 -1
- package/dist/plugin/fields/user.js +11 -25
- package/dist/plugin/fields/user.js.map +1 -1
- package/dist/plugin/lookup.d.ts +70 -1
- package/dist/plugin/lookup.d.ts.map +1 -1
- package/dist/plugin/manifest.d.ts +308 -128
- package/dist/plugin/manifest.d.ts.map +1 -1
- package/dist/plugin/manifest.js +94 -4
- package/dist/plugin/manifest.js.map +1 -1
- package/dist/plugin/setup-context.d.ts +5 -4
- package/dist/plugin/setup-context.d.ts.map +1 -1
- package/dist/plugin/setup-context.js +10 -3
- package/dist/plugin/setup-context.js.map +1 -1
- package/dist/plugin/validation/meta-box-fields.d.ts.map +1 -1
- package/dist/plugin/validation/meta-box-fields.js +16 -0
- package/dist/plugin/validation/meta-box-fields.js.map +1 -1
- package/dist/route/render/build-resolved-entries.d.ts.map +1 -1
- package/dist/route/render/build-resolved-entries.js +7 -2
- package/dist/route/render/build-resolved-entries.js.map +1 -1
- package/dist/route/render/render-template.d.ts.map +1 -1
- package/dist/route/render/render-template.js +12 -2
- package/dist/route/render/render-template.js.map +1 -1
- package/dist/route/render/template-builders.d.ts +15 -10
- package/dist/route/render/template-builders.d.ts.map +1 -1
- package/dist/route/render/template-builders.js.map +1 -1
- package/dist/rpc/base.d.ts +7 -0
- package/dist/rpc/base.d.ts.map +1 -1
- package/dist/rpc/errors.d.ts +7 -0
- package/dist/rpc/errors.d.ts.map +1 -1
- package/dist/rpc/errors.js +16 -0
- package/dist/rpc/errors.js.map +1 -1
- package/dist/rpc/meta/core.d.ts +89 -10
- package/dist/rpc/meta/core.d.ts.map +1 -1
- package/dist/rpc/meta/core.js +465 -282
- package/dist/rpc/meta/core.js.map +1 -1
- package/dist/rpc/meta/field-messages.d.ts +67 -0
- package/dist/rpc/meta/field-messages.d.ts.map +1 -0
- package/dist/rpc/meta/field-messages.js +67 -0
- package/dist/rpc/meta/field-messages.js.map +1 -0
- package/dist/rpc/meta/field-pipeline.d.ts +52 -0
- package/dist/rpc/meta/field-pipeline.d.ts.map +1 -0
- package/dist/rpc/meta/field-pipeline.js +501 -0
- package/dist/rpc/meta/field-pipeline.js.map +1 -0
- package/dist/rpc/procedures/auth/allowed-domains/create.d.ts +7 -0
- package/dist/rpc/procedures/auth/allowed-domains/create.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/allowed-domains/delete.d.ts +7 -0
- package/dist/rpc/procedures/auth/allowed-domains/delete.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/allowed-domains/index.d.ts +28 -0
- package/dist/rpc/procedures/auth/allowed-domains/index.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/allowed-domains/list.d.ts +7 -0
- package/dist/rpc/procedures/auth/allowed-domains/list.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/allowed-domains/update.d.ts +7 -0
- package/dist/rpc/procedures/auth/allowed-domains/update.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/api-tokens/admin-list.d.ts +7 -0
- package/dist/rpc/procedures/auth/api-tokens/admin-list.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/api-tokens/admin-revoke.d.ts +7 -0
- package/dist/rpc/procedures/auth/api-tokens/admin-revoke.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/api-tokens/create.d.ts +7 -0
- package/dist/rpc/procedures/auth/api-tokens/create.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/api-tokens/index.d.ts +35 -0
- package/dist/rpc/procedures/auth/api-tokens/index.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/api-tokens/list.d.ts +7 -0
- package/dist/rpc/procedures/auth/api-tokens/list.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/api-tokens/revoke.d.ts +7 -0
- package/dist/rpc/procedures/auth/api-tokens/revoke.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/credentials/delete.d.ts +7 -0
- package/dist/rpc/procedures/auth/credentials/delete.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/credentials/index.d.ts +21 -0
- package/dist/rpc/procedures/auth/credentials/index.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/credentials/list.d.ts +7 -0
- package/dist/rpc/procedures/auth/credentials/list.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/credentials/rename.d.ts +7 -0
- package/dist/rpc/procedures/auth/credentials/rename.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/device-flow/approve.d.ts +7 -0
- package/dist/rpc/procedures/auth/device-flow/approve.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/device-flow/deny.d.ts +7 -0
- package/dist/rpc/procedures/auth/device-flow/deny.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/device-flow/index.d.ts +21 -0
- package/dist/rpc/procedures/auth/device-flow/index.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/device-flow/lookup.d.ts +7 -0
- package/dist/rpc/procedures/auth/device-flow/lookup.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/index.d.ts +154 -0
- package/dist/rpc/procedures/auth/index.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/login-links.d.ts +7 -0
- package/dist/rpc/procedures/auth/login-links.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/mailer/index.d.ts +7 -0
- package/dist/rpc/procedures/auth/mailer/index.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/mailer/test-send.d.ts +7 -0
- package/dist/rpc/procedures/auth/mailer/test-send.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/oauth-providers.d.ts +7 -0
- package/dist/rpc/procedures/auth/oauth-providers.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/session.d.ts +7 -0
- package/dist/rpc/procedures/auth/session.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/sessions/index.d.ts +21 -0
- package/dist/rpc/procedures/auth/sessions/index.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/sessions/list.d.ts +7 -0
- package/dist/rpc/procedures/auth/sessions/list.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/sessions/revoke-others.d.ts +7 -0
- package/dist/rpc/procedures/auth/sessions/revoke-others.d.ts.map +1 -1
- package/dist/rpc/procedures/auth/sessions/revoke.d.ts +7 -0
- package/dist/rpc/procedures/auth/sessions/revoke.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/activity.d.ts +7 -0
- package/dist/rpc/procedures/entry/activity.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/bulk.d.ts +21 -0
- package/dist/rpc/procedures/entry/bulk.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/create-preview-link.d.ts +7 -0
- package/dist/rpc/procedures/entry/create-preview-link.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/create.d.ts +8 -1
- package/dist/rpc/procedures/entry/create.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/create.js +8 -8
- package/dist/rpc/procedures/entry/create.js.map +1 -1
- package/dist/rpc/procedures/entry/dashboard.d.ts +14 -0
- package/dist/rpc/procedures/entry/dashboard.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/delete-permanent.d.ts +7 -0
- package/dist/rpc/procedures/entry/delete-permanent.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/discard-draft.d.ts +7 -0
- package/dist/rpc/procedures/entry/discard-draft.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/duplicate.d.ts +7 -0
- package/dist/rpc/procedures/entry/duplicate.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/duplicate.js +2 -2
- package/dist/rpc/procedures/entry/duplicate.js.map +1 -1
- package/dist/rpc/procedures/entry/get.d.ts +7 -0
- package/dist/rpc/procedures/entry/get.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/get.js +2 -2
- package/dist/rpc/procedures/entry/get.js.map +1 -1
- package/dist/rpc/procedures/entry/index.d.ts +156 -2
- package/dist/rpc/procedures/entry/index.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/list.d.ts +7 -0
- package/dist/rpc/procedures/entry/list.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/lookup.d.ts +8 -2
- package/dist/rpc/procedures/entry/lookup.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/lookup.js +60 -1
- package/dist/rpc/procedures/entry/lookup.js.map +1 -1
- package/dist/rpc/procedures/entry/meta.d.ts +37 -3
- package/dist/rpc/procedures/entry/meta.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/meta.js +63 -7
- package/dist/rpc/procedures/entry/meta.js.map +1 -1
- package/dist/rpc/procedures/entry/publish.d.ts +7 -0
- package/dist/rpc/procedures/entry/publish.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/publish.js +6 -4
- package/dist/rpc/procedures/entry/publish.js.map +1 -1
- package/dist/rpc/procedures/entry/refresh-block-loader.d.ts +7 -0
- package/dist/rpc/procedures/entry/refresh-block-loader.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/restore.d.ts +7 -0
- package/dist/rpc/procedures/entry/restore.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/revisions.d.ts +56 -0
- package/dist/rpc/procedures/entry/revisions.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/schemas.d.ts +2 -2
- package/dist/rpc/procedures/entry/schemas.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/schemas.js +9 -2
- package/dist/rpc/procedures/entry/schemas.js.map +1 -1
- package/dist/rpc/procedures/entry/trash.d.ts +7 -0
- package/dist/rpc/procedures/entry/trash.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/update.d.ts +8 -1
- package/dist/rpc/procedures/entry/update.d.ts.map +1 -1
- package/dist/rpc/procedures/entry/update.js +77 -18
- package/dist/rpc/procedures/entry/update.js.map +1 -1
- package/dist/rpc/procedures/lookup/index.d.ts +14 -0
- package/dist/rpc/procedures/lookup/index.d.ts.map +1 -1
- package/dist/rpc/procedures/lookup/list.d.ts +7 -0
- package/dist/rpc/procedures/lookup/list.d.ts.map +1 -1
- package/dist/rpc/procedures/lookup/resolve.d.ts +7 -0
- package/dist/rpc/procedures/lookup/resolve.d.ts.map +1 -1
- package/dist/rpc/procedures/lookup/resolve.js +1 -1
- package/dist/rpc/procedures/lookup/resolve.js.map +1 -1
- package/dist/rpc/procedures/search/index.d.ts +7 -0
- package/dist/rpc/procedures/search/index.d.ts.map +1 -1
- package/dist/rpc/procedures/settings/get.d.ts +7 -0
- package/dist/rpc/procedures/settings/get.d.ts.map +1 -1
- package/dist/rpc/procedures/settings/index.d.ts +14 -0
- package/dist/rpc/procedures/settings/index.d.ts.map +1 -1
- package/dist/rpc/procedures/settings/upsert.d.ts +7 -0
- package/dist/rpc/procedures/settings/upsert.d.ts.map +1 -1
- package/dist/rpc/procedures/settings/upsert.js +9 -0
- package/dist/rpc/procedures/settings/upsert.js.map +1 -1
- package/dist/rpc/procedures/term/create.d.ts +7 -0
- package/dist/rpc/procedures/term/create.d.ts.map +1 -1
- package/dist/rpc/procedures/term/create.js +3 -3
- package/dist/rpc/procedures/term/create.js.map +1 -1
- package/dist/rpc/procedures/term/delete.d.ts +7 -0
- package/dist/rpc/procedures/term/delete.d.ts.map +1 -1
- package/dist/rpc/procedures/term/get.d.ts +7 -0
- package/dist/rpc/procedures/term/get.d.ts.map +1 -1
- package/dist/rpc/procedures/term/index.d.ts +35 -0
- package/dist/rpc/procedures/term/index.d.ts.map +1 -1
- package/dist/rpc/procedures/term/list.d.ts +7 -0
- package/dist/rpc/procedures/term/list.d.ts.map +1 -1
- package/dist/rpc/procedures/term/lookup.d.ts +7 -2
- package/dist/rpc/procedures/term/lookup.d.ts.map +1 -1
- package/dist/rpc/procedures/term/lookup.js +26 -0
- package/dist/rpc/procedures/term/lookup.js.map +1 -1
- package/dist/rpc/procedures/term/meta.d.ts +3 -2
- package/dist/rpc/procedures/term/meta.d.ts.map +1 -1
- package/dist/rpc/procedures/term/meta.js +7 -5
- package/dist/rpc/procedures/term/meta.js.map +1 -1
- package/dist/rpc/procedures/term/update.d.ts +7 -0
- package/dist/rpc/procedures/term/update.d.ts.map +1 -1
- package/dist/rpc/procedures/term/update.js +4 -4
- package/dist/rpc/procedures/term/update.js.map +1 -1
- package/dist/rpc/procedures/user/cancel-email-change.d.ts +7 -0
- package/dist/rpc/procedures/user/cancel-email-change.d.ts.map +1 -1
- package/dist/rpc/procedures/user/delete.d.ts +7 -0
- package/dist/rpc/procedures/user/delete.d.ts.map +1 -1
- package/dist/rpc/procedures/user/disable.d.ts +7 -0
- package/dist/rpc/procedures/user/disable.d.ts.map +1 -1
- package/dist/rpc/procedures/user/enable.d.ts +7 -0
- package/dist/rpc/procedures/user/enable.d.ts.map +1 -1
- package/dist/rpc/procedures/user/get.d.ts +7 -0
- package/dist/rpc/procedures/user/get.d.ts.map +1 -1
- package/dist/rpc/procedures/user/get.js +2 -2
- package/dist/rpc/procedures/user/get.js.map +1 -1
- package/dist/rpc/procedures/user/index.d.ts +77 -0
- package/dist/rpc/procedures/user/index.d.ts.map +1 -1
- package/dist/rpc/procedures/user/invite.d.ts +7 -0
- package/dist/rpc/procedures/user/invite.d.ts.map +1 -1
- package/dist/rpc/procedures/user/list.d.ts +7 -0
- package/dist/rpc/procedures/user/list.d.ts.map +1 -1
- package/dist/rpc/procedures/user/lookup.d.ts +6 -2
- package/dist/rpc/procedures/user/lookup.d.ts.map +1 -1
- package/dist/rpc/procedures/user/lookup.js +29 -0
- package/dist/rpc/procedures/user/lookup.js.map +1 -1
- package/dist/rpc/procedures/user/meta.d.ts +3 -2
- package/dist/rpc/procedures/user/meta.d.ts.map +1 -1
- package/dist/rpc/procedures/user/meta.js +7 -5
- package/dist/rpc/procedures/user/meta.js.map +1 -1
- package/dist/rpc/procedures/user/pending-email-change.d.ts +7 -0
- package/dist/rpc/procedures/user/pending-email-change.d.ts.map +1 -1
- package/dist/rpc/procedures/user/request-email-change.d.ts +7 -0
- package/dist/rpc/procedures/user/request-email-change.d.ts.map +1 -1
- package/dist/rpc/procedures/user/set-locale.d.ts +7 -0
- package/dist/rpc/procedures/user/set-locale.d.ts.map +1 -1
- package/dist/rpc/procedures/user/update.d.ts +7 -0
- package/dist/rpc/procedures/user/update.d.ts.map +1 -1
- package/dist/rpc/procedures/user/update.js +4 -4
- package/dist/rpc/procedures/user/update.js.map +1 -1
- package/dist/rpc/router.d.ts +457 -2
- package/dist/rpc/router.d.ts.map +1 -1
- package/dist/rpc/validation.d.ts +1 -0
- package/dist/rpc/validation.d.ts.map +1 -1
- package/dist/rpc/validation.js +1 -0
- package/dist/rpc/validation.js.map +1 -1
- package/dist/runtime/dispatcher.d.ts.map +1 -1
- package/dist/runtime/dispatcher.js +20 -10
- package/dist/runtime/dispatcher.js.map +1 -1
- package/dist/seo/feed.d.ts.map +1 -1
- package/dist/seo/feed.js +7 -1
- package/dist/seo/feed.js.map +1 -1
- package/dist/settings-core.js +1 -1
- package/dist/settings-core.js.map +1 -1
- package/dist/template-registry.d.ts +0 -16
- package/dist/template-registry.d.ts.map +1 -1
- package/dist/terms/read-service.js +2 -2
- package/dist/terms/read-service.js.map +1 -1
- package/dist/test/traced-context.d.ts +1 -1
- package/dist/test/traced-context.d.ts.map +1 -1
- package/dist/test/traced-context.js +2 -2
- package/dist/test/traced-context.js.map +1 -1
- package/package.json +2 -2
- package/dist/plugin/fields/checkbox.d.ts +0 -19
- package/dist/plugin/fields/checkbox.d.ts.map +0 -1
- package/dist/plugin/fields/checkbox.js +0 -20
- package/dist/plugin/fields/checkbox.js.map +0 -1
- package/dist/plugin/fields/date.d.ts +0 -24
- package/dist/plugin/fields/date.d.ts.map +0 -1
- package/dist/plugin/fields/date.js +0 -23
- package/dist/plugin/fields/date.js.map +0 -1
- package/dist/plugin/fields/datetime.d.ts +0 -26
- package/dist/plugin/fields/datetime.d.ts.map +0 -1
- package/dist/plugin/fields/datetime.js +0 -25
- package/dist/plugin/fields/datetime.js.map +0 -1
- package/dist/plugin/fields/email.d.ts +0 -17
- package/dist/plugin/fields/email.d.ts.map +0 -1
- package/dist/plugin/fields/email.js +0 -18
- package/dist/plugin/fields/email.js.map +0 -1
- package/dist/plugin/fields/entry-list.d.ts +0 -28
- package/dist/plugin/fields/entry-list.d.ts.map +0 -1
- package/dist/plugin/fields/entry-list.js +0 -31
- package/dist/plugin/fields/entry-list.js.map +0 -1
- package/dist/plugin/fields/multiselect.d.ts +0 -21
- package/dist/plugin/fields/multiselect.d.ts.map +0 -1
- package/dist/plugin/fields/multiselect.js +0 -43
- package/dist/plugin/fields/multiselect.js.map +0 -1
- package/dist/plugin/fields/password.d.ts +0 -24
- package/dist/plugin/fields/password.d.ts.map +0 -1
- package/dist/plugin/fields/password.js +0 -25
- package/dist/plugin/fields/password.js.map +0 -1
- package/dist/plugin/fields/radio.d.ts +0 -16
- package/dist/plugin/fields/radio.d.ts.map +0 -1
- package/dist/plugin/fields/radio.js +0 -17
- package/dist/plugin/fields/radio.js.map +0 -1
- package/dist/plugin/fields/repeater-validate.d.ts +0 -34
- package/dist/plugin/fields/repeater-validate.d.ts.map +0 -1
- package/dist/plugin/fields/repeater-validate.js +0 -104
- package/dist/plugin/fields/repeater-validate.js.map +0 -1
- package/dist/plugin/fields/term-list.d.ts +0 -27
- package/dist/plugin/fields/term-list.d.ts.map +0 -1
- package/dist/plugin/fields/term-list.js +0 -30
- package/dist/plugin/fields/term-list.js.map +0 -1
- package/dist/plugin/fields/text.d.ts +0 -37
- package/dist/plugin/fields/text.d.ts.map +0 -1
- package/dist/plugin/fields/text.js +0 -31
- package/dist/plugin/fields/text.js.map +0 -1
- package/dist/plugin/fields/textarea.d.ts +0 -20
- package/dist/plugin/fields/textarea.d.ts.map +0 -1
- package/dist/plugin/fields/textarea.js +0 -21
- package/dist/plugin/fields/textarea.js.map +0 -1
- package/dist/plugin/fields/time.d.ts +0 -24
- package/dist/plugin/fields/time.d.ts.map +0 -1
- package/dist/plugin/fields/time.js +0 -23
- package/dist/plugin/fields/time.js.map +0 -1
- package/dist/plugin/fields/url.d.ts +0 -17
- package/dist/plugin/fields/url.d.ts.map +0 -1
- package/dist/plugin/fields/url.js +0 -18
- package/dist/plugin/fields/url.js.map +0 -1
- package/dist/plugin/fields/user-list.d.ts +0 -29
- package/dist/plugin/fields/user-list.d.ts.map +0 -1
- package/dist/plugin/fields/user-list.js +0 -31
- package/dist/plugin/fields/user-list.js.map +0 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { FieldConfigError } from "./errors.js";
|
|
2
|
+
// Mirrors `META_FIELD_KEY_RE` in plugin/validation/meta-box-fields.ts.
|
|
3
|
+
// The top-level registrar validates field keys against this regex but
|
|
4
|
+
// doesn't recurse into composite children, so repeater / group enforce
|
|
5
|
+
// it locally — guards row/member-object shape and protects against
|
|
6
|
+
// duplicate-key clobber.
|
|
7
|
+
const SUBFIELD_KEY_RE = /^[a-zA-Z0-9_:-]+$/;
|
|
8
|
+
// `__proto__` / `constructor` / `prototype` match the key regex but
|
|
9
|
+
// writing them into a fresh object literal mutates the prototype chain.
|
|
10
|
+
// Reject at registration regardless of regex pass.
|
|
11
|
+
const FORBIDDEN_SUBFIELD_KEYS = new Set([
|
|
12
|
+
"__proto__",
|
|
13
|
+
"constructor",
|
|
14
|
+
"prototype",
|
|
15
|
+
]);
|
|
16
|
+
/**
|
|
17
|
+
* Validate the child fields of a composite field (`repeater` / `group`)
|
|
18
|
+
* at registration: key shape, prototype-pollution guard, uniqueness,
|
|
19
|
+
* and the not-yet-implemented nested-condition rejection. Nested
|
|
20
|
+
* repeaters and groups are permitted — each composite validates its own
|
|
21
|
+
* immediate children, so arbitrarily deep nesting is covered as each
|
|
22
|
+
* builder is constructed.
|
|
23
|
+
*/
|
|
24
|
+
export function assertSubFields(container, containerKey, subFields) {
|
|
25
|
+
const seen = new Set();
|
|
26
|
+
for (const sf of subFields) {
|
|
27
|
+
if (FORBIDDEN_SUBFIELD_KEYS.has(sf.key)) {
|
|
28
|
+
throw FieldConfigError.subFieldKeyForbidden({
|
|
29
|
+
container,
|
|
30
|
+
containerKey,
|
|
31
|
+
subFieldKey: sf.key,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
if (!SUBFIELD_KEY_RE.test(sf.key)) {
|
|
35
|
+
throw FieldConfigError.subFieldKeyInvalid({
|
|
36
|
+
container,
|
|
37
|
+
containerKey,
|
|
38
|
+
subFieldKey: sf.key,
|
|
39
|
+
pattern: SUBFIELD_KEY_RE.source,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
if (seen.has(sf.key)) {
|
|
43
|
+
throw FieldConfigError.subFieldDuplicate({
|
|
44
|
+
container,
|
|
45
|
+
containerKey,
|
|
46
|
+
subFieldKey: sf.key,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
// Nested conditions aren't wired: the admin evaluator and the write
|
|
50
|
+
// pipeline both read driver values from the top-level box scope, so
|
|
51
|
+
// a row/member `visibleWhen` would register a silent no-op.
|
|
52
|
+
if (sf.visibleWhen !== undefined) {
|
|
53
|
+
throw FieldConfigError.subFieldCondition({
|
|
54
|
+
container,
|
|
55
|
+
containerKey,
|
|
56
|
+
subFieldKey: sf.key,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
seen.add(sf.key);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=sub-fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sub-fields.js","sourceRoot":"","sources":["../../../src/plugin/fields/sub-fields.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,uEAAuE;AACvE,sEAAsE;AACtE,uEAAuE;AACvE,mEAAmE;AACnE,yBAAyB;AACzB,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAE5C,oEAAoE;AACpE,wEAAwE;AACxE,mDAAmD;AACnD,MAAM,uBAAuB,GAAwB,IAAI,GAAG,CAAC;IAC3D,WAAW;IACX,aAAa;IACb,WAAW;CACZ,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAC7B,SAA4B,EAC5B,YAAoB,EACpB,SAAkC;IAElC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,EAAE,IAAI,SAAS,EAAE,CAAC;QAC3B,IAAI,uBAAuB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;YACxC,MAAM,gBAAgB,CAAC,oBAAoB,CAAC;gBAC1C,SAAS;gBACT,YAAY;gBACZ,WAAW,EAAE,EAAE,CAAC,GAAG;aACpB,CAAC,CAAC;QACL,CAAC;QACD,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;YAClC,MAAM,gBAAgB,CAAC,kBAAkB,CAAC;gBACxC,SAAS;gBACT,YAAY;gBACZ,WAAW,EAAE,EAAE,CAAC,GAAG;gBACnB,OAAO,EAAE,eAAe,CAAC,MAAM;aAChC,CAAC,CAAC;QACL,CAAC;QACD,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;YACrB,MAAM,gBAAgB,CAAC,iBAAiB,CAAC;gBACvC,SAAS;gBACT,YAAY;gBACZ,WAAW,EAAE,EAAE,CAAC,GAAG;aACpB,CAAC,CAAC;QACL,CAAC;QACD,oEAAoE;QACpE,oEAAoE;QACpE,4DAA4D;QAC5D,IAAI,EAAE,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACjC,MAAM,gBAAgB,CAAC,iBAAiB,CAAC;gBACvC,SAAS;gBACT,YAAY;gBACZ,WAAW,EAAE,EAAE,CAAC,GAAG;aACpB,CAAC,CAAC;QACL,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { Label } from "../../i18n/label.js";
|
|
2
|
+
import type { FieldBuilder, MetaBoxFieldSpan, MetaBoxFieldValidate, TemporalInputType, TemporalMetaBoxField } from "../manifest.js";
|
|
3
|
+
import type { MetaFieldCondition, MetaFieldConditionRule } from "./condition.js";
|
|
4
|
+
export type { TemporalInputType } from "../manifest.js";
|
|
5
|
+
/** Read type after `.returns("date")` — optionality carries over from `V`. */
|
|
6
|
+
type ProjectedDate<V> = undefined extends V ? Date | undefined : Date;
|
|
7
|
+
interface TemporalFieldState {
|
|
8
|
+
readonly visibleWhen?: MetaFieldCondition;
|
|
9
|
+
readonly label?: Label;
|
|
10
|
+
readonly description?: Label;
|
|
11
|
+
readonly default?: string;
|
|
12
|
+
readonly required?: true;
|
|
13
|
+
readonly span?: MetaBoxFieldSpan;
|
|
14
|
+
readonly capability?: string;
|
|
15
|
+
readonly showInApi?: true;
|
|
16
|
+
readonly min?: string;
|
|
17
|
+
readonly max?: string;
|
|
18
|
+
readonly returns?: "date";
|
|
19
|
+
readonly sanitize?: (value: unknown) => unknown;
|
|
20
|
+
readonly validate?: MetaBoxFieldValidate;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Fluent chain for the temporal fields (`date`, `datetime`, `time`).
|
|
24
|
+
* Storage is always the ISO-shaped string the native input produces —
|
|
25
|
+
* the phantom stored shape `S` stays a string even when
|
|
26
|
+
* `.returns("date")` projects the read type `V` to a JS `Date` at
|
|
27
|
+
* decode time. `.sanitize()` / `.validate()` run on the write side,
|
|
28
|
+
* so their callbacks always see the stored string regardless of the
|
|
29
|
+
* read projection.
|
|
30
|
+
*/
|
|
31
|
+
export declare class TemporalFieldBuilder<Input extends TemporalInputType = TemporalInputType, K extends string = string, V extends string | Date | undefined = string | undefined, S extends string | undefined = string | undefined> implements FieldBuilder<TemporalMetaBoxField<Input>> {
|
|
32
|
+
#private;
|
|
33
|
+
/** Phantom literal key of the field — type-level only, never assigned. */
|
|
34
|
+
readonly _key: K;
|
|
35
|
+
/** Phantom read type of the field — type-level only, never assigned. */
|
|
36
|
+
readonly _value: V;
|
|
37
|
+
/** Phantom stored shape of the field — type-level only, never assigned. */
|
|
38
|
+
readonly _stored: S;
|
|
39
|
+
constructor(inputType: Input, key: string, state?: TemporalFieldState);
|
|
40
|
+
/** Override the derived (humanized-key) label. */
|
|
41
|
+
label(label: Label): TemporalFieldBuilder<Input, K, V, S>;
|
|
42
|
+
/** Help text rendered under the label. */
|
|
43
|
+
description(description: Label): TemporalFieldBuilder<Input, K, V, S>;
|
|
44
|
+
/**
|
|
45
|
+
* Default for absent keys — an ISO string in the field's stored
|
|
46
|
+
* shape, applied at read decode (and seeded into the admin form).
|
|
47
|
+
* Narrows the read type to non-optional; the stored shape stays
|
|
48
|
+
* optional.
|
|
49
|
+
*/
|
|
50
|
+
default(value: string): TemporalFieldBuilder<Input, K, NonNullable<V>, S>;
|
|
51
|
+
/** Mark the field required — narrows the read and stored types to non-optional. */
|
|
52
|
+
required(): TemporalFieldBuilder<Input, K, NonNullable<V>, string>;
|
|
53
|
+
/**
|
|
54
|
+
* Column span within the box's 12-column grid — a universal layout
|
|
55
|
+
* hint; surfaces that can't honor it (the entry editor rail) ignore it.
|
|
56
|
+
*/
|
|
57
|
+
span(span: MetaBoxFieldSpan): TemporalFieldBuilder<Input, K, V, S>;
|
|
58
|
+
/** Capability gate for this field — see `MetaBoxFieldBase.capability`. */
|
|
59
|
+
capability(capability: string): TemporalFieldBuilder<Input, K, V, S>;
|
|
60
|
+
/** Opt this field's value into public REST responses (default-deny). */
|
|
61
|
+
showInApi(): TemporalFieldBuilder<Input, K, V, S>;
|
|
62
|
+
/** Rule factory: this field's value equals `value` — pass the rule
|
|
63
|
+
* to a dependent field's `.visibleWhen()`. */
|
|
64
|
+
is(value: string): MetaFieldConditionRule;
|
|
65
|
+
/** Rule factory: this field's value differs from `value`. */
|
|
66
|
+
isNot(value: string): MetaFieldConditionRule;
|
|
67
|
+
/** Rule factory: this field has no value (unset or cleared). */
|
|
68
|
+
isEmpty(): MetaFieldConditionRule;
|
|
69
|
+
/** Rule factory: this field has a value. */
|
|
70
|
+
isNotEmpty(): MetaFieldConditionRule;
|
|
71
|
+
/**
|
|
72
|
+
* Show this field only when every rule passes (one AND group) —
|
|
73
|
+
* rules come from sibling fields' condition factories. Replaces any
|
|
74
|
+
* previously declared condition; `.orVisibleWhen()` adds
|
|
75
|
+
* alternatives.
|
|
76
|
+
*/
|
|
77
|
+
visibleWhen(...rules: MetaFieldConditionRule[]): TemporalFieldBuilder<Input, K, V, S>;
|
|
78
|
+
/** Add an OR alternative — one more AND group of rules. */
|
|
79
|
+
orVisibleWhen(...rules: MetaFieldConditionRule[]): TemporalFieldBuilder<Input, K, V, S>;
|
|
80
|
+
/** Lower bound in the field's stored ISO shape, enforced by the constraint walker. */
|
|
81
|
+
min(min: string): TemporalFieldBuilder<Input, K, V, S>;
|
|
82
|
+
/** Upper bound in the field's stored ISO shape, enforced by the constraint walker. */
|
|
83
|
+
max(max: string): TemporalFieldBuilder<Input, K, V, S>;
|
|
84
|
+
/**
|
|
85
|
+
* Project reads to a JS `Date` at decode time — the read type
|
|
86
|
+
* follows; storage remains the ISO string. Wall-clock components
|
|
87
|
+
* anchor to UTC (`date` at UTC midnight, `time` on 1970-01-01 UTC)
|
|
88
|
+
* so they survive any server/browser timezone split — read them
|
|
89
|
+
* back with `getUTC*` or `timeZone: "UTC"` formatting. `Date`
|
|
90
|
+
* values written back encode from UTC components symmetrically.
|
|
91
|
+
*/
|
|
92
|
+
returns(shape: "date"): TemporalFieldBuilder<Input, K, ProjectedDate<V>, S>;
|
|
93
|
+
/**
|
|
94
|
+
* Normalising transform, applied after coercion and before
|
|
95
|
+
* persistence. Always receives the stored ISO string — the
|
|
96
|
+
* `.returns("date")` projection is read-side only.
|
|
97
|
+
*/
|
|
98
|
+
sanitize(sanitize: (value: string) => string): TemporalFieldBuilder<Input, K, V, S>;
|
|
99
|
+
/**
|
|
100
|
+
* Custom validation — `true` for valid, or an i18n-able failure
|
|
101
|
+
* message (sync or async). Runs after `.sanitize()` on the stored
|
|
102
|
+
* ISO string.
|
|
103
|
+
*/
|
|
104
|
+
validate(validate: (value: string) => true | Label | Promise<true | Label>): TemporalFieldBuilder<Input, K, V, S>;
|
|
105
|
+
/** Compile the chain into the wire/manifest field definition. */
|
|
106
|
+
build(): TemporalMetaBoxField<Input>;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Date-only field, stored as `YYYY-MM-DD`. Renders as a native
|
|
110
|
+
* `<input type="date">` in the admin. `.returns("date")` reads a JS
|
|
111
|
+
* `Date` instead of the ISO string.
|
|
112
|
+
*/
|
|
113
|
+
export declare function date<K extends string>(key: K): TemporalFieldBuilder<"date", K>;
|
|
114
|
+
/**
|
|
115
|
+
* Date + time field, stored as `YYYY-MM-DDTHH:MM` (optional `:SS`) —
|
|
116
|
+
* naive local time from `<input type="datetime-local">`.
|
|
117
|
+
*/
|
|
118
|
+
export declare function datetime<K extends string>(key: K): TemporalFieldBuilder<"datetime", K>;
|
|
119
|
+
/**
|
|
120
|
+
* Time-only field, stored as `HH:MM` (optional `:SS`). Combine with a
|
|
121
|
+
* `date` field when both are needed.
|
|
122
|
+
*/
|
|
123
|
+
export declare function time<K extends string>(key: K): TemporalFieldBuilder<"time", K>;
|
|
124
|
+
//# sourceMappingURL=temporal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"temporal.d.ts","sourceRoot":"","sources":["../../../src/plugin/fields/temporal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,kBAAkB,EAClB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AAKxB,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,8EAA8E;AAC9E,KAAK,aAAa,CAAC,CAAC,IAAI,SAAS,SAAS,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAAC;AAEtE,UAAU,kBAAkB;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,kBAAkB,CAAC;IAC1C,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACjC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC;IAC1B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAA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,CAAC,EAAE,CAAC,CAAC;IAIvC;;;;OAIG;IACH,QAAQ,CACN,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,KAAK,GAAG,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,GAChE,oBAAoB,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAIvC,iEAAiE;IACjE,KAAK,IAAI,oBAAoB,CAAC,KAAK,CAAC;CAyBrC;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EACnC,GAAG,EAAE,CAAC,GACL,oBAAoB,CAAC,MAAM,EAAE,CAAC,CAAC,CAEjC;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EACvC,GAAG,EAAE,CAAC,GACL,oBAAoB,CAAC,UAAU,EAAE,CAAC,CAAC,CAErC;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EACnC,GAAG,EAAE,CAAC,GACL,oBAAoB,CAAC,MAAM,EAAE,CAAC,CAAC,CAEjC"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { isValidTemporalValue } from "../manifest.js";
|
|
3
|
+
import { humanizeFieldKey } from "./builder.js";
|
|
4
|
+
import { FieldConfigError } from "./errors.js";
|
|
5
|
+
/**
|
|
6
|
+
* Fluent chain for the temporal fields (`date`, `datetime`, `time`).
|
|
7
|
+
* Storage is always the ISO-shaped string the native input produces —
|
|
8
|
+
* the phantom stored shape `S` stays a string even when
|
|
9
|
+
* `.returns("date")` projects the read type `V` to a JS `Date` at
|
|
10
|
+
* decode time. `.sanitize()` / `.validate()` run on the write side,
|
|
11
|
+
* so their callbacks always see the stored string regardless of the
|
|
12
|
+
* read projection.
|
|
13
|
+
*/
|
|
14
|
+
export class TemporalFieldBuilder {
|
|
15
|
+
#inputType;
|
|
16
|
+
#key;
|
|
17
|
+
#state;
|
|
18
|
+
constructor(inputType, key, state = {}) {
|
|
19
|
+
this.#inputType = inputType;
|
|
20
|
+
this.#key = key;
|
|
21
|
+
this.#state = state;
|
|
22
|
+
}
|
|
23
|
+
#fork(patch) {
|
|
24
|
+
return new _a(this.#inputType, this.#key, {
|
|
25
|
+
...this.#state,
|
|
26
|
+
...patch,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/** Override the derived (humanized-key) label. */
|
|
30
|
+
label(label) {
|
|
31
|
+
return this.#fork({ label });
|
|
32
|
+
}
|
|
33
|
+
/** Help text rendered under the label. */
|
|
34
|
+
description(description) {
|
|
35
|
+
return this.#fork({ description });
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Default for absent keys — an ISO string in the field's stored
|
|
39
|
+
* shape, applied at read decode (and seeded into the admin form).
|
|
40
|
+
* Narrows the read type to non-optional; the stored shape stays
|
|
41
|
+
* optional.
|
|
42
|
+
*/
|
|
43
|
+
default(value) {
|
|
44
|
+
return this.#fork({ default: value });
|
|
45
|
+
}
|
|
46
|
+
/** Mark the field required — narrows the read and stored types to non-optional. */
|
|
47
|
+
required() {
|
|
48
|
+
return this.#fork({ required: true });
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Column span within the box's 12-column grid — a universal layout
|
|
52
|
+
* hint; surfaces that can't honor it (the entry editor rail) ignore it.
|
|
53
|
+
*/
|
|
54
|
+
span(span) {
|
|
55
|
+
return this.#fork({ span });
|
|
56
|
+
}
|
|
57
|
+
/** Capability gate for this field — see `MetaBoxFieldBase.capability`. */
|
|
58
|
+
capability(capability) {
|
|
59
|
+
return this.#fork({ capability });
|
|
60
|
+
}
|
|
61
|
+
/** Opt this field's value into public REST responses (default-deny). */
|
|
62
|
+
showInApi() {
|
|
63
|
+
return this.#fork({ showInApi: true });
|
|
64
|
+
}
|
|
65
|
+
/** Rule factory: this field's value equals `value` — pass the rule
|
|
66
|
+
* to a dependent field's `.visibleWhen()`. */
|
|
67
|
+
is(value) {
|
|
68
|
+
return { key: this.#key, op: "eq", value };
|
|
69
|
+
}
|
|
70
|
+
/** Rule factory: this field's value differs from `value`. */
|
|
71
|
+
isNot(value) {
|
|
72
|
+
return { key: this.#key, op: "neq", value };
|
|
73
|
+
}
|
|
74
|
+
/** Rule factory: this field has no value (unset or cleared). */
|
|
75
|
+
isEmpty() {
|
|
76
|
+
return { key: this.#key, op: "empty" };
|
|
77
|
+
}
|
|
78
|
+
/** Rule factory: this field has a value. */
|
|
79
|
+
isNotEmpty() {
|
|
80
|
+
return { key: this.#key, op: "not_empty" };
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Show this field only when every rule passes (one AND group) —
|
|
84
|
+
* rules come from sibling fields' condition factories. Replaces any
|
|
85
|
+
* previously declared condition; `.orVisibleWhen()` adds
|
|
86
|
+
* alternatives.
|
|
87
|
+
*/
|
|
88
|
+
visibleWhen(...rules) {
|
|
89
|
+
return this.#fork({ visibleWhen: [rules] });
|
|
90
|
+
}
|
|
91
|
+
/** Add an OR alternative — one more AND group of rules. */
|
|
92
|
+
orVisibleWhen(...rules) {
|
|
93
|
+
return this.#fork({
|
|
94
|
+
visibleWhen: [...(this.#state.visibleWhen ?? []), rules],
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
/** Lower bound in the field's stored ISO shape, enforced by the constraint walker. */
|
|
98
|
+
min(min) {
|
|
99
|
+
return this.#fork({ min });
|
|
100
|
+
}
|
|
101
|
+
/** Upper bound in the field's stored ISO shape, enforced by the constraint walker. */
|
|
102
|
+
max(max) {
|
|
103
|
+
return this.#fork({ max });
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Project reads to a JS `Date` at decode time — the read type
|
|
107
|
+
* follows; storage remains the ISO string. Wall-clock components
|
|
108
|
+
* anchor to UTC (`date` at UTC midnight, `time` on 1970-01-01 UTC)
|
|
109
|
+
* so they survive any server/browser timezone split — read them
|
|
110
|
+
* back with `getUTC*` or `timeZone: "UTC"` formatting. `Date`
|
|
111
|
+
* values written back encode from UTC components symmetrically.
|
|
112
|
+
*/
|
|
113
|
+
returns(shape) {
|
|
114
|
+
return this.#fork({ returns: shape });
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Normalising transform, applied after coercion and before
|
|
118
|
+
* persistence. Always receives the stored ISO string — the
|
|
119
|
+
* `.returns("date")` projection is read-side only.
|
|
120
|
+
*/
|
|
121
|
+
sanitize(sanitize) {
|
|
122
|
+
return this.#fork({ sanitize: sanitize });
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Custom validation — `true` for valid, or an i18n-able failure
|
|
126
|
+
* message (sync or async). Runs after `.sanitize()` on the stored
|
|
127
|
+
* ISO string.
|
|
128
|
+
*/
|
|
129
|
+
validate(validate) {
|
|
130
|
+
return this.#fork({ validate: validate });
|
|
131
|
+
}
|
|
132
|
+
/** Compile the chain into the wire/manifest field definition. */
|
|
133
|
+
build() {
|
|
134
|
+
// A typo'd bound would otherwise silently reject every write —
|
|
135
|
+
// bounds compare lexicographically against the stored shape, so a
|
|
136
|
+
// malformed one sorts nonsensically. Fail loudly at registration.
|
|
137
|
+
for (const bound of ["min", "max"]) {
|
|
138
|
+
const value = this.#state[bound];
|
|
139
|
+
if (value !== undefined &&
|
|
140
|
+
!isValidTemporalValue(this.#inputType, value)) {
|
|
141
|
+
throw FieldConfigError.temporalBoundInvalid({
|
|
142
|
+
fieldKey: this.#key,
|
|
143
|
+
bound,
|
|
144
|
+
value,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
...this.#state,
|
|
150
|
+
key: this.#key,
|
|
151
|
+
label: this.#state.label ?? humanizeFieldKey(this.#key),
|
|
152
|
+
type: "string",
|
|
153
|
+
inputType: this.#inputType,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
_a = TemporalFieldBuilder;
|
|
158
|
+
/**
|
|
159
|
+
* Date-only field, stored as `YYYY-MM-DD`. Renders as a native
|
|
160
|
+
* `<input type="date">` in the admin. `.returns("date")` reads a JS
|
|
161
|
+
* `Date` instead of the ISO string.
|
|
162
|
+
*/
|
|
163
|
+
export function date(key) {
|
|
164
|
+
return new TemporalFieldBuilder("date", key);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Date + time field, stored as `YYYY-MM-DDTHH:MM` (optional `:SS`) —
|
|
168
|
+
* naive local time from `<input type="datetime-local">`.
|
|
169
|
+
*/
|
|
170
|
+
export function datetime(key) {
|
|
171
|
+
return new TemporalFieldBuilder("datetime", key);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Time-only field, stored as `HH:MM` (optional `:SS`). Combine with a
|
|
175
|
+
* `date` field when both are needed.
|
|
176
|
+
*/
|
|
177
|
+
export function time(key) {
|
|
178
|
+
return new TemporalFieldBuilder("time", key);
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=temporal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"temporal.js","sourceRoot":"","sources":["../../../src/plugin/fields/temporal.ts"],"names":[],"mappings":";AAYA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAuB/C;;;;;;;;GAQG;AACH,MAAM,OAAO,oBAAoB;IAatB,UAAU,CAAQ;IAClB,IAAI,CAAS;IACb,MAAM,CAAqB;IAEpC,YAAY,SAAgB,EAAE,GAAW,EAAE,QAA4B,EAAE;QACvE,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,KAAK,CAIH,KAAkC;QAElC,OAAO,IAAI,EAAoB,CAC7B,IAAI,CAAC,UAAU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;IAED,iEAAiE;IACjE,KAAK;QACH,+DAA+D;QAC/D,kEAAkE;QAClE,kEAAkE;QAClE,KAAK,MAAM,KAAK,IAAI,CAAC,KAAK,EAAE,KAAK,CAAU,EAAE,CAAC;YAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACjC,IACE,KAAK,KAAK,SAAS;gBACnB,CAAC,oBAAoB,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,EAC7C,CAAC;gBACD,MAAM,gBAAgB,CAAC,oBAAoB,CAAC;oBAC1C,QAAQ,EAAE,IAAI,CAAC,IAAI;oBACnB,KAAK;oBACL,KAAK;iBACN,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QACD,OAAO;YACL,GAAG,IAAI,CAAC,MAAM;YACd,GAAG,EAAE,IAAI,CAAC,IAAI;YACd,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;YACvD,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,IAAI,CAAC,UAAU;SAC3B,CAAC;IACJ,CAAC;CACF;;AAED;;;;GAIG;AACH,MAAM,UAAU,IAAI,CAClB,GAAM;IAEN,OAAO,IAAI,oBAAoB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC/C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CACtB,GAAM;IAEN,OAAO,IAAI,oBAAoB,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;AACnD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,IAAI,CAClB,GAAM;IAEN,OAAO,IAAI,oBAAoB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { MetaBoxFieldSpan, TermReferenceMetaBoxField } from "../manifest.js";
|
|
1
|
+
import { ReferenceFieldBuilder } from "./reference.js";
|
|
3
2
|
/**
|
|
4
3
|
* Public scope shape for the `term()` reference field. Carried on
|
|
5
4
|
* the field's `referenceTarget.scope`; the term `LookupAdapter`
|
|
@@ -11,24 +10,20 @@ export interface TermFieldScope {
|
|
|
11
10
|
* Restrict matches to these taxonomies. Required at the field
|
|
12
11
|
* level — term references without a taxonomy filter would surface
|
|
13
12
|
* tags + categories + custom taxonomies in one indistinct list.
|
|
13
|
+
* Seeded from the `term()` constructor argument.
|
|
14
14
|
*/
|
|
15
15
|
readonly termTaxonomies: readonly string[];
|
|
16
16
|
}
|
|
17
|
-
export interface TermFieldOptions {
|
|
18
|
-
readonly key: string;
|
|
19
|
-
readonly label: Label;
|
|
20
|
-
readonly required?: boolean;
|
|
21
|
-
readonly description?: Label;
|
|
22
|
-
readonly default?: string;
|
|
23
|
-
readonly span?: MetaBoxFieldSpan;
|
|
24
|
-
readonly capability?: string;
|
|
25
|
-
readonly termTaxonomies: readonly string[];
|
|
26
|
-
}
|
|
27
17
|
/**
|
|
28
|
-
* Build a typed `term` reference field
|
|
29
|
-
*
|
|
18
|
+
* Build a typed `term` reference field —
|
|
19
|
+
* `term("primary", ["category"])`. The required taxonomy scope is the
|
|
20
|
+
* constructor's second argument; `.multiple()` flips to an id array.
|
|
21
|
+
*
|
|
22
|
+
* Storage is the bare term id (an id array under `.multiple()`). Reads
|
|
23
|
+
* hydrate to the term summary by default (`.returns("id")` opts back
|
|
24
|
+
* to the bare id); single reads stay optional (a target can orphan).
|
|
30
25
|
* The admin renders a picker that calls the lookup RPC with
|
|
31
|
-
* `{ kind: "term", scope
|
|
26
|
+
* `{ kind: "term", scope }`.
|
|
32
27
|
*/
|
|
33
|
-
export declare function term(
|
|
28
|
+
export declare function term<K extends string>(key: K, termTaxonomies: readonly string[]): ReferenceFieldBuilder<"term", K>;
|
|
34
29
|
//# sourceMappingURL=term.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"term.d.ts","sourceRoot":"","sources":["../../../src/plugin/fields/term.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"term.d.ts","sourceRoot":"","sources":["../../../src/plugin/fields/term.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EACnC,GAAG,EAAE,CAAC,EACN,cAAc,EAAE,SAAS,MAAM,EAAE,GAChC,qBAAqB,CAAC,MAAM,EAAE,CAAC,CAAC,CAElC"}
|
|
@@ -1,24 +1,16 @@
|
|
|
1
|
+
import { ReferenceFieldBuilder } from "./reference.js";
|
|
1
2
|
/**
|
|
2
|
-
* Build a typed `term` reference field
|
|
3
|
-
*
|
|
3
|
+
* Build a typed `term` reference field —
|
|
4
|
+
* `term("primary", ["category"])`. The required taxonomy scope is the
|
|
5
|
+
* constructor's second argument; `.multiple()` flips to an id array.
|
|
6
|
+
*
|
|
7
|
+
* Storage is the bare term id (an id array under `.multiple()`). Reads
|
|
8
|
+
* hydrate to the term summary by default (`.returns("id")` opts back
|
|
9
|
+
* to the bare id); single reads stay optional (a target can orphan).
|
|
4
10
|
* The admin renders a picker that calls the lookup RPC with
|
|
5
|
-
* `{ kind: "term", scope
|
|
11
|
+
* `{ kind: "term", scope }`.
|
|
6
12
|
*/
|
|
7
|
-
export function term(
|
|
8
|
-
|
|
9
|
-
termTaxonomies: options.termTaxonomies,
|
|
10
|
-
};
|
|
11
|
-
return {
|
|
12
|
-
key: options.key,
|
|
13
|
-
label: options.label,
|
|
14
|
-
type: "string",
|
|
15
|
-
inputType: "term",
|
|
16
|
-
referenceTarget: { kind: "term", scope },
|
|
17
|
-
required: options.required,
|
|
18
|
-
description: options.description,
|
|
19
|
-
default: options.default,
|
|
20
|
-
span: options.span,
|
|
21
|
-
capability: options.capability,
|
|
22
|
-
};
|
|
13
|
+
export function term(key, termTaxonomies) {
|
|
14
|
+
return new ReferenceFieldBuilder("term", key, { termTaxonomies });
|
|
23
15
|
}
|
|
24
16
|
//# sourceMappingURL=term.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"term.js","sourceRoot":"","sources":["../../../src/plugin/fields/term.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"term.js","sourceRoot":"","sources":["../../../src/plugin/fields/term.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAkBvD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,IAAI,CAClB,GAAM,EACN,cAAiC;IAEjC,OAAO,IAAI,qBAAqB,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,cAAc,EAAE,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { Label } from "../../i18n/label.js";
|
|
2
|
+
import type { FieldBuilder, MetaBoxFieldSpan, MetaBoxFieldValidate, ToggleMetaBoxField } from "../manifest.js";
|
|
3
|
+
import type { MetaFieldCondition, MetaFieldConditionRule } from "./condition.js";
|
|
4
|
+
interface ToggleFieldState {
|
|
5
|
+
readonly visibleWhen?: MetaFieldCondition;
|
|
6
|
+
readonly onText?: Label;
|
|
7
|
+
readonly offText?: Label;
|
|
8
|
+
readonly label?: Label;
|
|
9
|
+
readonly description?: Label;
|
|
10
|
+
readonly default?: boolean;
|
|
11
|
+
readonly required?: true;
|
|
12
|
+
readonly span?: MetaBoxFieldSpan;
|
|
13
|
+
readonly capability?: string;
|
|
14
|
+
readonly showInApi?: true;
|
|
15
|
+
readonly sanitize?: (value: unknown) => unknown;
|
|
16
|
+
readonly validate?: MetaBoxFieldValidate;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Fluent chain for the boolean switch field. Immutable — every call
|
|
20
|
+
* returns a fresh instance, so a shared base chain can be forked
|
|
21
|
+
* without aliasing. `V` is the phantom read type: `boolean |
|
|
22
|
+
* undefined` unadorned, narrowed to `boolean` by `.required()` /
|
|
23
|
+
* `.default()`. Purely type-level — nothing at runtime carries it.
|
|
24
|
+
*/
|
|
25
|
+
export declare class ToggleFieldBuilder<K extends string = string, V extends boolean | undefined = boolean | undefined, S extends boolean | undefined = boolean | undefined> implements FieldBuilder<ToggleMetaBoxField> {
|
|
26
|
+
#private;
|
|
27
|
+
/** Phantom literal key of the field — type-level only, never assigned. */
|
|
28
|
+
readonly _key: K;
|
|
29
|
+
/** Phantom read type of the field — type-level only, never assigned. */
|
|
30
|
+
readonly _value: V;
|
|
31
|
+
/** Phantom stored shape — `.required()` narrows it (write-enforced);
|
|
32
|
+
* `.default()` does not (defaults apply at decode time). */
|
|
33
|
+
readonly _stored: S;
|
|
34
|
+
constructor(key: K, state?: ToggleFieldState);
|
|
35
|
+
/** Label shown beside the switch while it is on. */
|
|
36
|
+
onText(onText: Label): ToggleFieldBuilder<K, V, S>;
|
|
37
|
+
/** Label shown beside the switch while it is off. */
|
|
38
|
+
offText(offText: Label): ToggleFieldBuilder<K, V, S>;
|
|
39
|
+
/** Override the derived (humanized-key) label. */
|
|
40
|
+
label(label: Label): ToggleFieldBuilder<K, V, S>;
|
|
41
|
+
/** Help text rendered under the label. */
|
|
42
|
+
description(description: Label): ToggleFieldBuilder<K, V, S>;
|
|
43
|
+
/** Admin-form prefill for unsaved keys — narrows the read type to `boolean`. */
|
|
44
|
+
default(value: boolean): ToggleFieldBuilder<K, boolean, S>;
|
|
45
|
+
/** Mark the field required — narrows the read type to `boolean`. */
|
|
46
|
+
required(): ToggleFieldBuilder<K, boolean, boolean>;
|
|
47
|
+
/**
|
|
48
|
+
* Column span within the box's 12-column grid — a universal layout
|
|
49
|
+
* hint; surfaces that can't honor it (the entry editor rail) ignore it.
|
|
50
|
+
*/
|
|
51
|
+
span(span: MetaBoxFieldSpan): ToggleFieldBuilder<K, V, S>;
|
|
52
|
+
/** Capability gate for this field — see `MetaBoxFieldBase.capability`. */
|
|
53
|
+
capability(capability: string): ToggleFieldBuilder<K, V, S>;
|
|
54
|
+
/** Opt this field's value into public REST responses (default-deny). */
|
|
55
|
+
showInApi(): ToggleFieldBuilder<K, V, S>;
|
|
56
|
+
/** Rule factory: this field's value equals `value` — pass the rule
|
|
57
|
+
* to a dependent field's `.visibleWhen()`. */
|
|
58
|
+
is(value: boolean): MetaFieldConditionRule;
|
|
59
|
+
/** Rule factory: this field's value differs from `value`. */
|
|
60
|
+
isNot(value: boolean): MetaFieldConditionRule;
|
|
61
|
+
/** Rule factory: this field has no value (unset or cleared). */
|
|
62
|
+
isEmpty(): MetaFieldConditionRule;
|
|
63
|
+
/** Rule factory: this field has a value. */
|
|
64
|
+
isNotEmpty(): MetaFieldConditionRule;
|
|
65
|
+
/** Rule factory: the switch is on. */
|
|
66
|
+
isOn(): MetaFieldConditionRule;
|
|
67
|
+
/** Rule factory: the switch is off. `neq true` rather than
|
|
68
|
+
* `eq false`, so an unset toggle (which renders as off) counts. */
|
|
69
|
+
isOff(): MetaFieldConditionRule;
|
|
70
|
+
/**
|
|
71
|
+
* Show this field only when every rule passes (one AND group) —
|
|
72
|
+
* rules come from sibling fields' condition factories. Replaces any
|
|
73
|
+
* previously declared condition; `.orVisibleWhen()` adds
|
|
74
|
+
* alternatives.
|
|
75
|
+
*/
|
|
76
|
+
visibleWhen(...rules: MetaFieldConditionRule[]): ToggleFieldBuilder<K, V, S>;
|
|
77
|
+
/** Add an OR alternative — one more AND group of rules. */
|
|
78
|
+
orVisibleWhen(...rules: MetaFieldConditionRule[]): ToggleFieldBuilder<K, V, S>;
|
|
79
|
+
/** Normalising transform, applied after coercion and before persistence. */
|
|
80
|
+
sanitize(sanitize: (value: NonNullable<V>) => NonNullable<V>): ToggleFieldBuilder<K, V, S>;
|
|
81
|
+
/**
|
|
82
|
+
* Custom validation — `true` for valid, or an i18n-able failure
|
|
83
|
+
* message (sync or async). Runs after `.sanitize()` and the
|
|
84
|
+
* declarative constraints.
|
|
85
|
+
*/
|
|
86
|
+
validate(validate: (value: NonNullable<V>) => true | Label | Promise<true | Label>): ToggleFieldBuilder<K, V, S>;
|
|
87
|
+
/** Compile the chain into the wire/manifest field definition. */
|
|
88
|
+
build(): ToggleMetaBoxField;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Boolean switch field — `toggle("featured").onText("Yes").offText("No")`.
|
|
92
|
+
* Reads as `boolean | undefined`, narrowed by `.required()` /
|
|
93
|
+
* `.default()`.
|
|
94
|
+
*/
|
|
95
|
+
export declare function toggle<K extends string>(key: K): ToggleFieldBuilder<K>;
|
|
96
|
+
export {};
|
|
97
|
+
//# sourceMappingURL=toggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../../src/plugin/fields/toggle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,kBAAkB,EAClB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AAGxB,UAAU,gBAAgB;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,kBAAkB,CAAC;IAC1C,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC;IACzB,QAA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