@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
|
@@ -1,31 +1,126 @@
|
|
|
1
|
-
|
|
1
|
+
var _a;
|
|
2
|
+
import { humanizeFieldKey } from "./builder.js";
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
+
* Fluent chain for the `richtext` field. Storage is Tiptap's
|
|
4
5
|
* ProseMirror JSON shape, round-tripped through the `json` storage
|
|
5
|
-
* primitive. The
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* primitive. The constraint walker rejects nodes/marks/blocks outside
|
|
7
|
+
* the allowlist (and unsafe link hrefs) server-side — there is
|
|
8
|
+
* deliberately no `.sanitize()` on this chain, so a custom callback
|
|
9
|
+
* can never bypass that enforcement.
|
|
9
10
|
*/
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
11
|
+
export class RichtextFieldBuilder {
|
|
12
|
+
#key;
|
|
13
|
+
#state;
|
|
14
|
+
constructor(key, state = {}) {
|
|
15
|
+
this.#key = key;
|
|
16
|
+
this.#state = state;
|
|
17
|
+
}
|
|
18
|
+
#fork(patch) {
|
|
19
|
+
return new _a(this.#key, {
|
|
20
|
+
...this.#state,
|
|
21
|
+
...patch,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
/** Override the derived (humanized-key) label. */
|
|
25
|
+
label(label) {
|
|
26
|
+
return this.#fork({ label });
|
|
27
|
+
}
|
|
28
|
+
/** Help text rendered under the label. */
|
|
29
|
+
description(description) {
|
|
30
|
+
return this.#fork({ description });
|
|
31
|
+
}
|
|
32
|
+
/** Default for absent keys — a ProseMirror doc JSON value, applied
|
|
33
|
+
* at read decode (and seeded into the admin form). */
|
|
34
|
+
default(value) {
|
|
35
|
+
return this.#fork({ default: value });
|
|
36
|
+
}
|
|
37
|
+
/** Mark the field required. */
|
|
38
|
+
required() {
|
|
39
|
+
return this.#fork({ required: true });
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Column span within the box's 12-column grid — a universal layout
|
|
43
|
+
* hint; surfaces that can't honor it (the entry editor rail) ignore it.
|
|
44
|
+
*/
|
|
45
|
+
span(span) {
|
|
46
|
+
return this.#fork({ span });
|
|
47
|
+
}
|
|
48
|
+
/** Capability gate for this field — see `MetaBoxFieldBase.capability`. */
|
|
49
|
+
capability(capability) {
|
|
50
|
+
return this.#fork({ capability });
|
|
51
|
+
}
|
|
52
|
+
/** Opt this field's value into public REST responses (default-deny). */
|
|
53
|
+
showInApi() {
|
|
54
|
+
return this.#fork({ showInApi: true });
|
|
55
|
+
}
|
|
56
|
+
/** Rule factory: this field's value equals `value` — pass the rule
|
|
57
|
+
* to a dependent field's `.visibleWhen()`. */
|
|
58
|
+
is(value) {
|
|
59
|
+
return { key: this.#key, op: "eq", value };
|
|
60
|
+
}
|
|
61
|
+
/** Rule factory: this field's value differs from `value`. */
|
|
62
|
+
isNot(value) {
|
|
63
|
+
return { key: this.#key, op: "neq", value };
|
|
64
|
+
}
|
|
65
|
+
/** Rule factory: this field has no value (unset or cleared). */
|
|
66
|
+
isEmpty() {
|
|
67
|
+
return { key: this.#key, op: "empty" };
|
|
68
|
+
}
|
|
69
|
+
/** Rule factory: this field has a value. */
|
|
70
|
+
isNotEmpty() {
|
|
71
|
+
return { key: this.#key, op: "not_empty" };
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Show this field only when every rule passes (one AND group) —
|
|
75
|
+
* rules come from sibling fields' condition factories. Replaces any
|
|
76
|
+
* previously declared condition; `.orVisibleWhen()` adds
|
|
77
|
+
* alternatives.
|
|
78
|
+
*/
|
|
79
|
+
visibleWhen(...rules) {
|
|
80
|
+
return this.#fork({ visibleWhen: [rules] });
|
|
81
|
+
}
|
|
82
|
+
/** Add an OR alternative — one more AND group of rules. */
|
|
83
|
+
orVisibleWhen(...rules) {
|
|
84
|
+
return this.#fork({
|
|
85
|
+
visibleWhen: [...(this.#state.visibleWhen ?? []), rules],
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/** Mark allowlist (`bold`, `italic`, `link`, …). Omitted = deny all. */
|
|
89
|
+
marks(marks) {
|
|
90
|
+
return this.#fork({ marks });
|
|
91
|
+
}
|
|
92
|
+
/** Node allowlist (`heading`, `bulletList`, …). Omitted = deny all but doc/paragraph/text. */
|
|
93
|
+
nodes(nodes) {
|
|
94
|
+
return this.#fork({ nodes });
|
|
95
|
+
}
|
|
96
|
+
/** Embedded-block allowlist. Omitted = deny all. */
|
|
97
|
+
blocks(blocks) {
|
|
98
|
+
return this.#fork({ blocks });
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Custom validation — `true` for valid, or an i18n-able failure
|
|
102
|
+
* message (sync or async). Runs after the injected allowlist walker.
|
|
103
|
+
*/
|
|
104
|
+
validate(validate) {
|
|
105
|
+
return this.#fork({ validate });
|
|
106
|
+
}
|
|
107
|
+
/** Compile the chain into the wire/manifest field definition. */
|
|
108
|
+
build() {
|
|
109
|
+
return {
|
|
110
|
+
...this.#state,
|
|
111
|
+
key: this.#key,
|
|
112
|
+
label: this.#state.label ?? humanizeFieldKey(this.#key),
|
|
113
|
+
type: "json",
|
|
114
|
+
inputType: "richtext",
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
_a = RichtextFieldBuilder;
|
|
119
|
+
/**
|
|
120
|
+
* Rich text stored as ProseMirror JSON, constrained by the
|
|
121
|
+
* `.marks()` / `.nodes()` / `.blocks()` allowlists.
|
|
122
|
+
*/
|
|
123
|
+
export function richtext(key) {
|
|
124
|
+
return new RichtextFieldBuilder(key);
|
|
30
125
|
}
|
|
31
126
|
//# sourceMappingURL=richtext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"richtext.js","sourceRoot":"","sources":["../../../src/plugin/fields/richtext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"richtext.js","sourceRoot":"","sources":["../../../src/plugin/fields/richtext.ts"],"names":[],"mappings":";AAWA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAiBhD;;;;;;;GAOG;AACH,MAAM,OAAO,oBAAoB;IAUtB,IAAI,CAAS;IACb,MAAM,CAAqB;IAEpC,YAAY,GAAW,EAAE,QAA4B,EAAE;QACrD,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,KAAkC;QACtC,OAAO,IAAI,EAAoB,CAAI,IAAI,CAAC,IAAI,EAA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IAAI,CAAC;YACvD,IAAI,EAAE,MAAM;YACZ,SAAS,EAAE,UAAU;SACtB,CAAC;IACJ,CAAC;CACF;;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAmB,GAAM;IAC/C,OAAO,IAAI,oBAAoB,CAAC,GAAG,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -1,20 +1,160 @@
|
|
|
1
1
|
import type { Label } from "../../i18n/label.js";
|
|
2
|
-
import type { MetaBoxFieldOption, MetaBoxFieldSpan, SelectMetaBoxField } from "../manifest.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import type { FieldBuilder, MetaBoxFieldOption, MetaBoxFieldSpan, MetaBoxFieldValidate, MultiSelectMetaBoxField, SelectAppearance, SelectMetaBoxField, SingleSelectMetaBoxField } from "../manifest.js";
|
|
3
|
+
import type { MetaFieldCondition, MetaFieldConditionRule } from "./condition.js";
|
|
4
|
+
/**
|
|
5
|
+
* An option passed to `.options()` — either the full `{ value, label }`
|
|
6
|
+
* shape or a string shorthand whose label derives from the humanized
|
|
7
|
+
* value (`"videoHero"` → "Video hero").
|
|
8
|
+
*/
|
|
9
|
+
export type SelectOptionInput = string | MetaBoxFieldOption;
|
|
10
|
+
/** Literal value union inferred from an `.options()` array. */
|
|
11
|
+
type OptionValue<T extends SelectOptionInput> = T extends string ? T : T extends MetaBoxFieldOption ? T["value"] : never;
|
|
12
|
+
/** Appearances legal for the given cardinality — radio and the dropdown
|
|
13
|
+
* are single-only, checkboxes multi-only, buttons works on both. */
|
|
14
|
+
type AppearanceFor<Multiple extends boolean> = Multiple extends true ? "buttons" | "checkboxes" : "select" | "radio" | "buttons";
|
|
15
|
+
interface SelectFieldState {
|
|
16
|
+
readonly visibleWhen?: MetaFieldCondition;
|
|
6
17
|
readonly options: readonly MetaBoxFieldOption[];
|
|
7
|
-
readonly
|
|
18
|
+
readonly multiple?: true;
|
|
19
|
+
readonly max?: number;
|
|
20
|
+
readonly appearance?: SelectAppearance;
|
|
21
|
+
readonly label?: Label;
|
|
8
22
|
readonly description?: Label;
|
|
9
|
-
readonly default?: string;
|
|
23
|
+
readonly default?: string | readonly string[];
|
|
24
|
+
readonly required?: true;
|
|
10
25
|
readonly span?: MetaBoxFieldSpan;
|
|
11
26
|
readonly capability?: string;
|
|
27
|
+
readonly showInApi?: true;
|
|
12
28
|
readonly sanitize?: (value: unknown) => unknown;
|
|
29
|
+
readonly validate?: MetaBoxFieldValidate;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Entry point of the `select()` chain — only `.options()` is available
|
|
33
|
+
* until the option list is declared, so a choice field without choices
|
|
34
|
+
* can't reach `build()` (registration surfaces require a `build`
|
|
35
|
+
* method).
|
|
36
|
+
*/
|
|
37
|
+
export declare class SelectFieldSeed<K extends string = string> {
|
|
38
|
+
#private;
|
|
39
|
+
constructor(key: K);
|
|
40
|
+
/** Declare the option list — infers the value literal union. */
|
|
41
|
+
options<const Options extends readonly SelectOptionInput[]>(options: Options): SelectFieldBuilder<OptionValue<Options[number]>, K>;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Fluent chain for choice fields. Immutable — every call returns a
|
|
45
|
+
* fresh instance, so a shared base chain can be forked without
|
|
46
|
+
* aliasing.
|
|
47
|
+
*
|
|
48
|
+
* Type parameters are the declaration's compile-time state: `O` is the
|
|
49
|
+
* option literal union inferred by `.options()`; `Multiple` is the
|
|
50
|
+
* cardinality (`.multiple()` flips it and the stored shape); `A` is
|
|
51
|
+
* the chosen appearance, tracked so cardinality-illegal combinations
|
|
52
|
+
* (radio + multiple) fail to compile in either call order; `V` is the
|
|
53
|
+
* phantom read type — `O | undefined` unadorned, an array after
|
|
54
|
+
* `.multiple()`, narrowed by `.required()` / `.default()`. All purely
|
|
55
|
+
* type-level — nothing at runtime carries them.
|
|
56
|
+
*/
|
|
57
|
+
export declare class SelectFieldBuilder<O extends string, K extends string = string, Multiple extends boolean = false, A extends SelectAppearance | undefined = undefined, V = O | undefined, S = O | undefined> implements FieldBuilder<SelectMetaBoxField> {
|
|
58
|
+
#private;
|
|
59
|
+
/** Phantom literal key of the field — type-level only, never assigned. */
|
|
60
|
+
readonly _key: K;
|
|
61
|
+
/** Phantom read type of the field — type-level only, never assigned. */
|
|
62
|
+
readonly _value: V;
|
|
63
|
+
/** Phantom stored shape — `.required()` narrows it (write-enforced);
|
|
64
|
+
* `.default()` does not (defaults apply at decode time). */
|
|
65
|
+
readonly _stored: S;
|
|
66
|
+
/** Phantom cardinality/appearance markers backing the compile-time
|
|
67
|
+
* gating of `.multiple()`, `.max()`, and `.appearance()`. */
|
|
68
|
+
readonly _multiple: Multiple;
|
|
69
|
+
readonly _appearance: A;
|
|
70
|
+
constructor(key: string, state: SelectFieldState);
|
|
71
|
+
/**
|
|
72
|
+
* Store an array of selected option values instead of a single one
|
|
73
|
+
* (`type` flips to `json`). A type-level gate keeps it legal:
|
|
74
|
+
* declare cardinality right after `.options()` — before `.default()`
|
|
75
|
+
* / `.required()` narrow the value — and never after a single-only
|
|
76
|
+
* `.appearance()` (`"select"` / `"radio"`).
|
|
77
|
+
*/
|
|
78
|
+
multiple(this: undefined extends V ? SelectFieldBuilder<O, K, false, "buttons" | undefined, V, S> : never): SelectFieldBuilder<O, K, true, A, readonly O[] | undefined, readonly O[] | undefined>;
|
|
79
|
+
/**
|
|
80
|
+
* Cap the selection count — multi-value fields only. Carried on the
|
|
81
|
+
* definition and the wire today; server-side enforcement lands with
|
|
82
|
+
* the generic constraint walker.
|
|
83
|
+
*/
|
|
84
|
+
max(this: SelectFieldBuilder<O, K, true, A, V, S>, max: number): SelectFieldBuilder<O, K, true, A, V, S>;
|
|
85
|
+
/**
|
|
86
|
+
* Pick the admin control rendering the option list — the pure-UI
|
|
87
|
+
* axis; the value shape never changes. Single-value fields accept
|
|
88
|
+
* `"select"` (dropdown, the default), `"radio"`, and `"buttons"`;
|
|
89
|
+
* multi-value fields accept `"buttons"` (the default) and
|
|
90
|
+
* `"checkboxes"`.
|
|
91
|
+
*/
|
|
92
|
+
appearance<A2 extends AppearanceFor<Multiple>>(appearance: A2): SelectFieldBuilder<O, K, Multiple, A2, V, S>;
|
|
93
|
+
/** Override the derived (humanized-key) label. */
|
|
94
|
+
label(label: Label): SelectFieldBuilder<O, K, Multiple, A, V, S>;
|
|
95
|
+
/** Help text rendered under the label. */
|
|
96
|
+
description(description: Label): SelectFieldBuilder<O, K, Multiple, A, V, S>;
|
|
97
|
+
/** Admin-form prefill for unsaved keys — narrows away `undefined`. */
|
|
98
|
+
default(value: Multiple extends true ? readonly O[] : O): SelectFieldBuilder<O, K, Multiple, A, NonNullable<V>, S>;
|
|
99
|
+
/** Mark the field required — narrows away `undefined`. */
|
|
100
|
+
required(): SelectFieldBuilder<O, K, Multiple, A, NonNullable<V>, NonNullable<S>>;
|
|
101
|
+
/**
|
|
102
|
+
* Column span within the box's 12-column grid — a universal layout
|
|
103
|
+
* hint; surfaces that can't honor it (the entry editor rail) ignore it.
|
|
104
|
+
*/
|
|
105
|
+
span(span: MetaBoxFieldSpan): SelectFieldBuilder<O, K, Multiple, A, V, S>;
|
|
106
|
+
/** Capability gate for this field — see `MetaBoxFieldBase.capability`. */
|
|
107
|
+
capability(capability: string): SelectFieldBuilder<O, K, Multiple, A, V, S>;
|
|
108
|
+
/** Opt this field's value into public REST responses (default-deny). */
|
|
109
|
+
showInApi(): SelectFieldBuilder<O, K, Multiple, A, V, S>;
|
|
110
|
+
/** Rule factory: this field's value equals `value` — pass the rule
|
|
111
|
+
* to a dependent field's `.visibleWhen()`. The comparand is typed
|
|
112
|
+
* by the chain's cardinality: one option value, or the exact
|
|
113
|
+
* selection array after `.multiple()`. */
|
|
114
|
+
is(value: NonNullable<S>): MetaFieldConditionRule;
|
|
115
|
+
/** Rule factory: this field's value differs from `value`. */
|
|
116
|
+
isNot(value: NonNullable<S>): MetaFieldConditionRule;
|
|
117
|
+
/** Rule factory: this field has no value (unset or cleared). */
|
|
118
|
+
isEmpty(): MetaFieldConditionRule;
|
|
119
|
+
/** Rule factory: this field has a value. */
|
|
120
|
+
isNotEmpty(): MetaFieldConditionRule;
|
|
121
|
+
/** Rule factory: the selection includes `value` — multi-value only. */
|
|
122
|
+
contains(this: SelectFieldBuilder<O, K, true, A, V, S>, value: O): MetaFieldConditionRule;
|
|
123
|
+
/** Rule factory: the selection does not include `value` — multi-value only. */
|
|
124
|
+
notContains(this: SelectFieldBuilder<O, K, true, A, V, S>, value: O): MetaFieldConditionRule;
|
|
125
|
+
/** Rule factory: more than `count` options selected — multi-value only. */
|
|
126
|
+
countGt(this: SelectFieldBuilder<O, K, true, A, V, S>, count: number): MetaFieldConditionRule;
|
|
127
|
+
/** Rule factory: fewer than `count` options selected — multi-value only. */
|
|
128
|
+
countLt(this: SelectFieldBuilder<O, K, true, A, V, S>, count: number): MetaFieldConditionRule;
|
|
129
|
+
/**
|
|
130
|
+
* Show this field only when every rule passes (one AND group) —
|
|
131
|
+
* rules come from sibling fields' condition factories. Replaces any
|
|
132
|
+
* previously declared condition; `.orVisibleWhen()` adds
|
|
133
|
+
* alternatives.
|
|
134
|
+
*/
|
|
135
|
+
visibleWhen(...rules: MetaFieldConditionRule[]): SelectFieldBuilder<O, K, Multiple, A, V, S>;
|
|
136
|
+
/** Add an OR alternative — one more AND group of rules. */
|
|
137
|
+
orVisibleWhen(...rules: MetaFieldConditionRule[]): SelectFieldBuilder<O, K, Multiple, A, V, S>;
|
|
138
|
+
/** Normalising transform, applied after coercion and before persistence. */
|
|
139
|
+
sanitize(sanitize: (value: NonNullable<V>) => NonNullable<V>): SelectFieldBuilder<O, K, Multiple, A, V, S>;
|
|
140
|
+
/**
|
|
141
|
+
* Custom validation — `true` for valid, or an i18n-able failure
|
|
142
|
+
* message (sync or async). Runs after `.sanitize()` and the
|
|
143
|
+
* declarative constraints.
|
|
144
|
+
*/
|
|
145
|
+
validate(validate: (value: NonNullable<V>) => true | Label | Promise<true | Label>): SelectFieldBuilder<O, K, Multiple, A, V, S>;
|
|
146
|
+
/** Compile the chain into the wire/manifest field definition —
|
|
147
|
+
* the `multiple`/`type`-correlated variant matching the chain's
|
|
148
|
+
* cardinality. */
|
|
149
|
+
build(): Multiple extends true ? MultiSelectMetaBoxField : SingleSelectMetaBoxField;
|
|
13
150
|
}
|
|
14
151
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
152
|
+
* Choice field over a fixed option list —
|
|
153
|
+
* `select("size").options(["s", "m", "l"])`. Single-value by default;
|
|
154
|
+
* `.multiple()` stores an array, `.appearance()` picks the admin
|
|
155
|
+
* control. The option list is required: only `.options()` is available
|
|
156
|
+
* on the bare constructor.
|
|
18
157
|
*/
|
|
19
|
-
export declare function select(
|
|
158
|
+
export declare function select<K extends string>(key: K): SelectFieldSeed<K>;
|
|
159
|
+
export {};
|
|
20
160
|
//# sourceMappingURL=select.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/plugin/fields/select.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/plugin/fields/select.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,kBAAkB,EAClB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AAGxB;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,kBAAkB,CAAC;AAE5D,+DAA+D;AAC/D,KA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,CAAC;IAI9C,2DAA2D;IAC3D,aAAa,CACX,GAAG,KAAK,EAAE,sBAAsB,EAAE,GACjC,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAM9C,4EAA4E;IAC5E,QAAQ,CACN,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,CAAC,GAClD,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAI9C;;;;OAIG;IACH,QAAQ,CACN,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,KAAK,GAAG,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,GACxE,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAI9C;;uBAEmB;IACnB,KAAK,IAAI,QAAQ,SAAS,IAAI,GAC1B,uBAAuB,GACvB,wBAAwB;CAoB7B;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,CAAC,CAEnE"}
|
|
@@ -1,21 +1,209 @@
|
|
|
1
|
+
var _a;
|
|
2
|
+
import { humanizeFieldKey } from "./builder.js";
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
4
|
+
* Entry point of the `select()` chain — only `.options()` is available
|
|
5
|
+
* until the option list is declared, so a choice field without choices
|
|
6
|
+
* can't reach `build()` (registration surfaces require a `build`
|
|
7
|
+
* method).
|
|
5
8
|
*/
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
export class SelectFieldSeed {
|
|
10
|
+
#key;
|
|
11
|
+
constructor(key) {
|
|
12
|
+
this.#key = key;
|
|
13
|
+
}
|
|
14
|
+
/** Declare the option list — infers the value literal union. */
|
|
15
|
+
options(options) {
|
|
16
|
+
return new SelectFieldBuilder(this.#key, {
|
|
17
|
+
options: options.map((opt) => typeof opt === "string"
|
|
18
|
+
? { value: opt, label: humanizeFieldKey(opt) }
|
|
19
|
+
: opt),
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Fluent chain for choice fields. Immutable — every call returns a
|
|
25
|
+
* fresh instance, so a shared base chain can be forked without
|
|
26
|
+
* aliasing.
|
|
27
|
+
*
|
|
28
|
+
* Type parameters are the declaration's compile-time state: `O` is the
|
|
29
|
+
* option literal union inferred by `.options()`; `Multiple` is the
|
|
30
|
+
* cardinality (`.multiple()` flips it and the stored shape); `A` is
|
|
31
|
+
* the chosen appearance, tracked so cardinality-illegal combinations
|
|
32
|
+
* (radio + multiple) fail to compile in either call order; `V` is the
|
|
33
|
+
* phantom read type — `O | undefined` unadorned, an array after
|
|
34
|
+
* `.multiple()`, narrowed by `.required()` / `.default()`. All purely
|
|
35
|
+
* type-level — nothing at runtime carries them.
|
|
36
|
+
*/
|
|
37
|
+
export class SelectFieldBuilder {
|
|
38
|
+
#key;
|
|
39
|
+
#state;
|
|
40
|
+
constructor(key, state) {
|
|
41
|
+
this.#key = key;
|
|
42
|
+
this.#state = state;
|
|
43
|
+
}
|
|
44
|
+
#fork(patch) {
|
|
45
|
+
return new _a(this.#key, {
|
|
46
|
+
...this.#state,
|
|
47
|
+
...patch,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Store an array of selected option values instead of a single one
|
|
52
|
+
* (`type` flips to `json`). A type-level gate keeps it legal:
|
|
53
|
+
* declare cardinality right after `.options()` — before `.default()`
|
|
54
|
+
* / `.required()` narrow the value — and never after a single-only
|
|
55
|
+
* `.appearance()` (`"select"` / `"radio"`).
|
|
56
|
+
*/
|
|
57
|
+
multiple() {
|
|
58
|
+
// The conditional this-type erases the class shape inside the body;
|
|
59
|
+
// restore it to reach the private #fork.
|
|
60
|
+
const self = this;
|
|
61
|
+
return self.#fork({ multiple: true });
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Cap the selection count — multi-value fields only. Carried on the
|
|
65
|
+
* definition and the wire today; server-side enforcement lands with
|
|
66
|
+
* the generic constraint walker.
|
|
67
|
+
*/
|
|
68
|
+
max(max) {
|
|
69
|
+
return this.#fork({ max });
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Pick the admin control rendering the option list — the pure-UI
|
|
73
|
+
* axis; the value shape never changes. Single-value fields accept
|
|
74
|
+
* `"select"` (dropdown, the default), `"radio"`, and `"buttons"`;
|
|
75
|
+
* multi-value fields accept `"buttons"` (the default) and
|
|
76
|
+
* `"checkboxes"`.
|
|
77
|
+
*/
|
|
78
|
+
appearance(appearance) {
|
|
79
|
+
return this.#fork({ appearance });
|
|
80
|
+
}
|
|
81
|
+
/** Override the derived (humanized-key) label. */
|
|
82
|
+
label(label) {
|
|
83
|
+
return this.#fork({ label });
|
|
84
|
+
}
|
|
85
|
+
/** Help text rendered under the label. */
|
|
86
|
+
description(description) {
|
|
87
|
+
return this.#fork({ description });
|
|
88
|
+
}
|
|
89
|
+
/** Admin-form prefill for unsaved keys — narrows away `undefined`. */
|
|
90
|
+
default(value) {
|
|
91
|
+
return this.#fork({ default: value });
|
|
92
|
+
}
|
|
93
|
+
/** Mark the field required — narrows away `undefined`. */
|
|
94
|
+
required() {
|
|
95
|
+
return this.#fork({
|
|
96
|
+
required: true,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Column span within the box's 12-column grid — a universal layout
|
|
101
|
+
* hint; surfaces that can't honor it (the entry editor rail) ignore it.
|
|
102
|
+
*/
|
|
103
|
+
span(span) {
|
|
104
|
+
return this.#fork({ span });
|
|
105
|
+
}
|
|
106
|
+
/** Capability gate for this field — see `MetaBoxFieldBase.capability`. */
|
|
107
|
+
capability(capability) {
|
|
108
|
+
return this.#fork({ capability });
|
|
109
|
+
}
|
|
110
|
+
/** Opt this field's value into public REST responses (default-deny). */
|
|
111
|
+
showInApi() {
|
|
112
|
+
return this.#fork({ showInApi: true });
|
|
113
|
+
}
|
|
114
|
+
/** Rule factory: this field's value equals `value` — pass the rule
|
|
115
|
+
* to a dependent field's `.visibleWhen()`. The comparand is typed
|
|
116
|
+
* by the chain's cardinality: one option value, or the exact
|
|
117
|
+
* selection array after `.multiple()`. */
|
|
118
|
+
is(value) {
|
|
119
|
+
return { key: this.#key, op: "eq", value };
|
|
120
|
+
}
|
|
121
|
+
/** Rule factory: this field's value differs from `value`. */
|
|
122
|
+
isNot(value) {
|
|
123
|
+
return { key: this.#key, op: "neq", value };
|
|
124
|
+
}
|
|
125
|
+
/** Rule factory: this field has no value (unset or cleared). */
|
|
126
|
+
isEmpty() {
|
|
127
|
+
return { key: this.#key, op: "empty" };
|
|
128
|
+
}
|
|
129
|
+
/** Rule factory: this field has a value. */
|
|
130
|
+
isNotEmpty() {
|
|
131
|
+
return { key: this.#key, op: "not_empty" };
|
|
132
|
+
}
|
|
133
|
+
/** Rule factory: the selection includes `value` — multi-value only. */
|
|
134
|
+
contains(value) {
|
|
135
|
+
return { key: this.#key, op: "contains", value };
|
|
136
|
+
}
|
|
137
|
+
/** Rule factory: the selection does not include `value` — multi-value only. */
|
|
138
|
+
notContains(value) {
|
|
139
|
+
return { key: this.#key, op: "not_contains", value };
|
|
140
|
+
}
|
|
141
|
+
/** Rule factory: more than `count` options selected — multi-value only. */
|
|
142
|
+
countGt(count) {
|
|
143
|
+
return { key: this.#key, op: "count_gt", value: count };
|
|
144
|
+
}
|
|
145
|
+
/** Rule factory: fewer than `count` options selected — multi-value only. */
|
|
146
|
+
countLt(count) {
|
|
147
|
+
return { key: this.#key, op: "count_lt", value: count };
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Show this field only when every rule passes (one AND group) —
|
|
151
|
+
* rules come from sibling fields' condition factories. Replaces any
|
|
152
|
+
* previously declared condition; `.orVisibleWhen()` adds
|
|
153
|
+
* alternatives.
|
|
154
|
+
*/
|
|
155
|
+
visibleWhen(...rules) {
|
|
156
|
+
return this.#fork({ visibleWhen: [rules] });
|
|
157
|
+
}
|
|
158
|
+
/** Add an OR alternative — one more AND group of rules. */
|
|
159
|
+
orVisibleWhen(...rules) {
|
|
160
|
+
return this.#fork({
|
|
161
|
+
visibleWhen: [...(this.#state.visibleWhen ?? []), rules],
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
/** Normalising transform, applied after coercion and before persistence. */
|
|
165
|
+
sanitize(sanitize) {
|
|
166
|
+
return this.#fork({ sanitize: sanitize });
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Custom validation — `true` for valid, or an i18n-able failure
|
|
170
|
+
* message (sync or async). Runs after `.sanitize()` and the
|
|
171
|
+
* declarative constraints.
|
|
172
|
+
*/
|
|
173
|
+
validate(validate) {
|
|
174
|
+
return this.#fork({ validate: validate });
|
|
175
|
+
}
|
|
176
|
+
/** Compile the chain into the wire/manifest field definition —
|
|
177
|
+
* the `multiple`/`type`-correlated variant matching the chain's
|
|
178
|
+
* cardinality. */
|
|
179
|
+
build() {
|
|
180
|
+
const { multiple, ...state } = this.#state;
|
|
181
|
+
// Option membership, de-dupe, and `.max()` selection counts are
|
|
182
|
+
// enforced server-side by the constraint walker.
|
|
183
|
+
const common = {
|
|
184
|
+
...state,
|
|
185
|
+
key: this.#key,
|
|
186
|
+
label: state.label ?? humanizeFieldKey(this.#key),
|
|
187
|
+
inputType: "select",
|
|
188
|
+
};
|
|
189
|
+
// Branch so each arm satisfies its correlated `multiple`/`type`
|
|
190
|
+
// variant; the cast collapses the runtime union onto the
|
|
191
|
+
// `Multiple`-conditional return, which TS can't correlate itself.
|
|
192
|
+
const field = multiple
|
|
193
|
+
? { ...common, type: "json", multiple: true }
|
|
194
|
+
: { ...common, type: "string" };
|
|
195
|
+
return field;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
_a = SelectFieldBuilder;
|
|
199
|
+
/**
|
|
200
|
+
* Choice field over a fixed option list —
|
|
201
|
+
* `select("size").options(["s", "m", "l"])`. Single-value by default;
|
|
202
|
+
* `.multiple()` stores an array, `.appearance()` picks the admin
|
|
203
|
+
* control. The option list is required: only `.options()` is available
|
|
204
|
+
* on the bare constructor.
|
|
205
|
+
*/
|
|
206
|
+
export function select(key) {
|
|
207
|
+
return new SelectFieldSeed(key);
|
|
20
208
|
}
|
|
21
209
|
//# sourceMappingURL=select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../src/plugin/fields/select.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../src/plugin/fields/select.ts"],"names":[],"mappings":";AAeA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAuChD;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IACjB,IAAI,CAAI;IAEjB,YAAY,GAAM;QAChB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,CAAC;IAED,gEAAgE;IAChE,OAAO,CACL,OAAgB;QAEhB,OAAO,IAAI,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE;YACvC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAC3B,OAAO,GAAG,KAAK,QAAQ;gBACrB,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,gBAAgB,CAAC,GAAG,CAAC,EAAE;gBAC9C,CAAC,CAAC,GAAG,CACR;SACF,CAAC,CAA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AC,IAAI,CAAC,IAAI,CAAC;YACjD,SAAS,EAAE,QAAQ;SACX,CAAC;QACX,gEAAgE;QAChE,yDAAyD;QACzD,kEAAkE;QAClE,MAAM,KAAK,GAAuB,QAAQ;YACxC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC7C,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QAClC,OAAO,KAEqB,CAAC;IAC/B,CAAC;CACF;;AAED;;;;;;GAMG;AACH,MAAM,UAAU,MAAM,CAAmB,GAAM;IAC7C,OAAO,IAAI,eAAe,CAAC,GAAG,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MetaBoxField } from "../manifest.js";
|
|
2
|
+
import type { SubFieldContainer } from "./errors.js";
|
|
3
|
+
/**
|
|
4
|
+
* Validate the child fields of a composite field (`repeater` / `group`)
|
|
5
|
+
* at registration: key shape, prototype-pollution guard, uniqueness,
|
|
6
|
+
* and the not-yet-implemented nested-condition rejection. Nested
|
|
7
|
+
* repeaters and groups are permitted — each composite validates its own
|
|
8
|
+
* immediate children, so arbitrarily deep nesting is covered as each
|
|
9
|
+
* builder is constructed.
|
|
10
|
+
*/
|
|
11
|
+
export declare function assertSubFields(container: SubFieldContainer, containerKey: string, subFields: readonly MetaBoxField[]): void;
|
|
12
|
+
//# sourceMappingURL=sub-fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sub-fields.d.ts","sourceRoot":"","sources":["../../../src/plugin/fields/sub-fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAmBrD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,iBAAiB,EAC5B,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,SAAS,YAAY,EAAE,GACjC,IAAI,CAqCN"}
|