@riverbankcms/sdk 0.151.0 → 0.153.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.
Files changed (316) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/dist/{EventEmbeddedCheckoutStep-BBHbM22D.mjs → EventEmbeddedCheckoutStep-veN-QiAE.mjs} +10 -9
  3. package/dist/{PreviewEditorSidebar-BHplI9HE.mjs → PreviewEditorSidebar-jI_4DTZY.mjs} +4 -3
  4. package/dist/{PreviewEditorUI-DuyN8nsD.mjs → PreviewEditorUI-ORkVZhfu.mjs} +5 -4
  5. package/dist/{SdkPreviewModeRuntime-CR5ypwxJ.mjs → SdkPreviewModeRuntime-DaNqevI1.mjs} +341 -164
  6. package/dist/{SiteChromeCustomizeContext-D5t6joF_.mjs → SiteChromeCustomizeContext-CgNuBHC0.mjs} +27124 -39230
  7. package/dist/ThemedButton-X2UxhW6F.mjs +16525 -0
  8. package/dist/_dts/ai/src/contracts/proposals.d.ts +52 -52
  9. package/dist/_dts/ai/src/contracts/siteStyleProposalSchemas.d.ts +2357 -7859
  10. package/dist/_dts/api/src/bookingOperations.d.ts +5 -3
  11. package/dist/_dts/api/src/commercePortalEndpoints.d.ts +4 -0
  12. package/dist/_dts/api/src/communications.d.ts +19 -5
  13. package/dist/_dts/api/src/endpoints.d.ts +7 -0
  14. package/dist/_dts/api/src/index.d.ts +1 -1
  15. package/dist/_dts/api/src/indexExtendedTypes.d.ts +1 -1
  16. package/dist/_dts/api/src/navigation/types.d.ts +7 -0
  17. package/dist/_dts/api/src/navigation.d.ts +1 -1
  18. package/dist/_dts/api/src/publicAppointmentBookingContracts.d.ts +10 -1
  19. package/dist/_dts/api/src/sdkThemeWire.d.ts +186 -1434
  20. package/dist/_dts/api/src/shared-contracts.d.ts +10 -0
  21. package/dist/_dts/api/src/siteAssets.d.ts +1 -0
  22. package/dist/_dts/api/src/siteInfrastructure.d.ts +2 -1
  23. package/dist/_dts/api/src/teamMembers.d.ts +2 -27
  24. package/dist/_dts/block-form/src/widgets/RepeaterField/components/layoutGridDomain.d.ts +3 -13
  25. package/dist/_dts/blocks/src/contracts/index.d.ts +1 -0
  26. package/dist/_dts/blocks/src/definitions.d.ts +1 -1
  27. package/dist/_dts/blocks/src/index.d.ts +2 -0
  28. package/dist/_dts/blocks/src/lib/media.d.ts +1 -0
  29. package/dist/_dts/blocks/src/lib/picsum.d.ts +2 -2
  30. package/dist/_dts/blocks/src/pageRenderPreparation.d.ts +1 -0
  31. package/dist/_dts/blocks/src/pageRendererContracts.d.ts +2 -1
  32. package/dist/_dts/blocks/src/primitives/content/utils/sanitizeHref.d.ts +1 -1
  33. package/dist/_dts/blocks/src/system/blocks/event-registration.d.ts +4 -4
  34. package/dist/_dts/blocks/src/system/blocks/events/eventSelectionFields.d.ts +1 -1
  35. package/dist/_dts/blocks/src/system/blocks/events/shared/schemas.d.ts +212 -804
  36. package/dist/_dts/blocks/src/system/blocks/events/shared/types.d.ts +7 -2
  37. package/dist/_dts/blocks/src/system/blocks/location-map.d.ts +1 -1
  38. package/dist/_dts/blocks/src/system/blocks/media-text.d.ts +45 -45
  39. package/dist/_dts/blocks/src/system/blocks/offerings-preview/model.d.ts +2 -0
  40. package/dist/_dts/blocks/src/system/blocks/shared/teamMembers.d.ts +4 -7
  41. package/dist/_dts/blocks/src/system/blocks/team-members.d.ts +2 -2
  42. package/dist/_dts/blocks/src/system/customize/backgrounds.d.ts +6 -6
  43. package/dist/_dts/blocks/src/system/fields/backgroundContent.d.ts +377 -1
  44. package/dist/_dts/blocks/src/system/helpers/backgroundMedia.d.ts +6 -2
  45. package/dist/_dts/blocks/src/system/helpers/normalizeMailingListBlockContent.d.ts +2 -0
  46. package/dist/_dts/blocks/src/system/helpers/resolveBackground.d.ts +3 -3
  47. package/dist/_dts/blocks/src/system/layout/repeaterGrid.d.ts +12 -5
  48. package/dist/_dts/blocks/src/system/manifest/fieldValidation/index.d.ts +3 -3
  49. package/dist/_dts/blocks/src/system/manifest/schema.d.ts +24 -24
  50. package/dist/_dts/blocks/src/system/manifest/validation.d.ts +2 -0
  51. package/dist/_dts/blocks/src/system/node/fragments/lookSlot.d.ts +1 -1
  52. package/dist/_dts/blocks/src/system/registry.d.ts +14 -2
  53. package/dist/_dts/blocks/src/system/runtime/api/client.d.ts +0 -5
  54. package/dist/_dts/blocks/src/system/runtime/api/index.d.ts +2 -0
  55. package/dist/_dts/blocks/src/system/runtime/api/schemas/events.d.ts +971 -0
  56. package/dist/_dts/blocks/src/system/runtime/api/schemas/waitlist-claims.d.ts +42 -0
  57. package/dist/_dts/blocks/src/system/runtime/api/types/appointments.d.ts +10 -2
  58. package/dist/_dts/blocks/src/system/runtime/api/types/events.d.ts +10 -136
  59. package/dist/_dts/blocks/src/system/runtime/components/registry.client.d.ts +48 -6
  60. package/dist/_dts/blocks/src/system/runtime/components/runtime-backed-blocks.d.ts +24 -3
  61. package/dist/_dts/blocks/src/system/runtime/hooks/useBookingFlowController.d.ts +1 -1
  62. package/dist/_dts/blocks/src/system/runtime/hooks/useBookingSubmission.state.d.ts +2 -0
  63. package/dist/_dts/blocks/src/system/runtime/hooks/useHeadlessBookingFlow.d.ts +5 -1
  64. package/dist/_dts/blocks/src/system/runtime/hooks/useHeadlessBookingFlow.state.d.ts +1 -1
  65. package/dist/_dts/blocks/src/system/runtime/lookSurfaces.d.ts +2 -2
  66. package/dist/_dts/blocks/src/system/runtime/nodes/ImageResolveContext.d.ts +1 -1
  67. package/dist/_dts/blocks/src/system/runtime/nodes/appointment-services.d.ts +50 -202
  68. package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.headless.state.d.ts +51 -1
  69. package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.state.d.ts +6 -2
  70. package/dist/_dts/blocks/src/system/runtime/nodes/carousel.client.hooks.d.ts +6 -0
  71. package/dist/_dts/blocks/src/system/runtime/nodes/carousel.client.state.d.ts +7 -0
  72. package/dist/_dts/blocks/src/system/runtime/nodes/event-details/lookPresentation.d.ts +2 -2
  73. package/dist/_dts/blocks/src/system/runtime/nodes/event-details/presentation.d.ts +1 -1
  74. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/BookingEntryViews.d.ts +42 -0
  75. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/EventEmbeddedCheckoutStep.d.ts +4 -1
  76. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/EventRegistrationBookingLayer.d.ts +19 -9
  77. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/EventRegistrationPayment.d.ts +4 -2
  78. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/EventRegistrationSurface.d.ts +24 -9
  79. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/EventRegistrationWizardContent.d.ts +4 -2
  80. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/EventSelectionStep.d.ts +5 -4
  81. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/GuestDetailsSection.d.ts +1 -1
  82. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/PaymentStatusStep.d.ts +2 -0
  83. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/SingleTicketEntitlementNote.d.ts +11 -0
  84. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/SuccessStep.d.ts +4 -0
  85. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/TicketSelectionStep.d.ts +5 -0
  86. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/VerifyingTimeoutStep.d.ts +2 -0
  87. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/bookingCardDisplay.d.ts +31 -0
  88. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/bookingEntry.d.ts +154 -0
  89. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/bookingFocus.d.ts +12 -0
  90. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/event-registration.headless.contract.d.ts +2 -2
  91. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/event-registration.headless.planning.d.ts +2 -2
  92. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/eventSourceRecovery.d.ts +9 -0
  93. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/finishedBooking.d.ts +77 -0
  94. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/index.d.ts +0 -1
  95. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/offeringNoun.d.ts +12 -0
  96. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/paymentResponse.d.ts +2 -1
  97. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationCompletion.d.ts +33 -1
  98. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationDerivations.d.ts +11 -0
  99. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationDisplay.d.ts +31 -0
  100. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationDraft.state.d.ts +60 -0
  101. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationErrorRecovery.d.ts +1 -1
  102. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationEventAdapter.d.ts +3 -0
  103. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationStateMachine.d.ts +58 -10
  104. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationSurface.d.ts +17 -0
  105. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/types.d.ts +23 -7
  106. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useBookingBarFacts.d.ts +12 -0
  107. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationRecoveryRequest.d.ts +3 -0
  108. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationStripeReturn.d.ts +4 -0
  109. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationSubmit.d.ts +4 -11
  110. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationWizard.d.ts +1563 -31
  111. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventSourceRecovery.d.ts +2 -12
  112. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/usePaymentStatusRecovery.d.ts +147 -4
  113. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/utils.d.ts +50 -2
  114. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/waitlistClaimRestoration.d.ts +6 -5
  115. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/wizardSteps.d.ts +85 -15
  116. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration.interactive.d.ts +53 -8
  117. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/CardListItem.d.ts +1 -1
  118. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/MonthLookView.d.ts +10 -3
  119. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/eventCollectionContract.d.ts +290 -882
  120. package/dist/_dts/blocks/src/system/runtime/nodes/file-download.d.ts +3 -2
  121. package/dist/_dts/blocks/src/system/runtime/nodes/media.d.ts +22 -90
  122. package/dist/_dts/blocks/src/system/runtime/nodes/mediaContext.d.ts +69 -0
  123. package/dist/_dts/blocks/src/system/runtime/shared/bookingPaymentOptionCopy.d.ts +5 -1
  124. package/dist/_dts/blocks/src/system/runtime/shared/bookingPaymentOptions.d.ts +37 -1
  125. package/dist/_dts/blocks/src/system/runtime/shared/components/ModalShell.d.ts +9 -2
  126. package/dist/_dts/blocks/src/system/runtime/shared/components/PaymentChoiceRows.d.ts +28 -0
  127. package/dist/_dts/blocks/src/system/runtime/shared/components/StepIndicator.d.ts +6 -8
  128. package/dist/_dts/blocks/src/system/runtime/shared/components/index.d.ts +2 -2
  129. package/dist/_dts/blocks/src/system/runtime/shared/index.d.ts +2 -2
  130. package/dist/_dts/blocks/src/system/runtime/shared/useWaitlistClaim.d.ts +9 -12
  131. package/dist/_dts/blocks/src/system/runtime/shared/useWaitlistClaim.state.d.ts +15 -0
  132. package/dist/_dts/blocks/src/system/runtime/shared/utils/themePortalRoot.d.ts +10 -15
  133. package/dist/_dts/blocks/src/system/transforms/registry/index.d.ts +2 -0
  134. package/dist/_dts/blocks/src/system/transforms/registry/links.d.ts +2 -0
  135. package/dist/_dts/commerce/src/purchase/bookingInstalmentSchedule.d.ts +2 -0
  136. package/dist/_dts/commerce/src/purchase/bookingPaymentSelection.d.ts +6 -0
  137. package/dist/_dts/commerce/src/purchase/confirmationEmailPayment.d.ts +14 -14
  138. package/dist/_dts/commerce/src/purchase/confirmationPayment.d.ts +65 -0
  139. package/dist/_dts/commerce/src/purchase/confirmationPaymentSchema.d.ts +66 -0
  140. package/dist/_dts/commerce/src/purchase/index.d.ts +2 -0
  141. package/dist/_dts/commerce/src/purchase/orderPaymentState.d.ts +8 -0
  142. package/dist/_dts/content-model/src/content-types/schema.d.ts +3 -3
  143. package/dist/_dts/content-model/src/templates/defaults.d.ts +2 -2
  144. package/dist/_dts/core/src/appointment-booking-terms.d.ts +20 -0
  145. package/dist/_dts/core/src/booking-payment-schemas.d.ts +70 -0
  146. package/dist/_dts/core/src/branded.d.ts +0 -2
  147. package/dist/_dts/core/src/demo-claim-access.d.ts +1 -1
  148. package/dist/_dts/core/src/demo-claim-readiness.d.ts +18 -0
  149. package/dist/_dts/core/src/demo-lifecycle-status.d.ts +1 -1
  150. package/dist/_dts/core/src/demo-warm-pool-target.d.ts +1 -1
  151. package/dist/_dts/core/src/index.d.ts +4 -0
  152. package/dist/_dts/core/src/mailing-list-runtime.d.ts +2 -2
  153. package/dist/_dts/core/src/mailing-list-setup-parser.d.ts +9 -1
  154. package/dist/_dts/core/src/mailing-list-setup.d.ts +9 -1
  155. package/dist/_dts/core/src/mailing-list-submission.d.ts +1 -1
  156. package/dist/_dts/core/src/mailing-list-targeting-availability.d.ts +68 -0
  157. package/dist/_dts/core/src/mailing-list-targeting.d.ts +11 -1
  158. package/dist/_dts/core/src/ticket-quantity.d.ts +13 -0
  159. package/dist/_dts/db/src/generated/supabase/database.types.d.ts +106 -36
  160. package/dist/_dts/editor/src/chrome/chromeLayers.d.ts +7 -0
  161. package/dist/_dts/editor/src/index.d.ts +1 -0
  162. package/dist/_dts/editor-blocks/src/index.d.ts +1 -0
  163. package/dist/_dts/editor-blocks/src/media/MediaField.d.ts +2 -2
  164. package/dist/_dts/editor-blocks/src/media/admitEditorMediaField.d.ts +4 -0
  165. package/dist/_dts/editor-blocks/src/widgets/link/LinkAddressInput.d.ts +8 -0
  166. package/dist/_dts/editor-blocks/src/widgets/link/LinkContentList.d.ts +12 -0
  167. package/dist/_dts/editor-blocks/src/widgets/link/LinkPicker.d.ts +5 -1
  168. package/dist/_dts/editor-blocks/src/widgets/link/LinkPickerDialog.d.ts +3 -3
  169. package/dist/_dts/editor-blocks/src/widgets/link/LinkSummary.d.ts +8 -2
  170. package/dist/_dts/editor-blocks/src/widgets/link/LinkWidget.d.ts +4 -3
  171. package/dist/_dts/editor-blocks/src/widgets/link/LinkWidgetContext.d.ts +2 -1
  172. package/dist/_dts/editor-blocks/src/widgets/link/draft.d.ts +44 -0
  173. package/dist/_dts/editor-blocks/src/widgets/link/presentation.d.ts +13 -0
  174. package/dist/_dts/editor-blocks/src/widgets/link/types.d.ts +14 -0
  175. package/dist/_dts/editor-blocks/src/widgets/link/useRoutableContent.d.ts +2 -0
  176. package/dist/_dts/editor-blocks/src/widgets/link/utils.d.ts +5 -4
  177. package/dist/_dts/editor-blocks/src/widgets/mailing-list-targeting/MailingListTargetingField.d.ts +1 -1
  178. package/dist/_dts/editor-blocks/src/widgets/mailing-list-targeting/targetingState.d.ts +13 -8
  179. package/dist/_dts/media-core/src/assetsInUseSummary.d.ts +6 -0
  180. package/dist/_dts/media-core/src/contentMediaAudit.d.ts +3 -2
  181. package/dist/_dts/media-core/src/fileStorage.d.ts +4 -3
  182. package/dist/_dts/media-core/src/index.d.ts +5 -0
  183. package/dist/_dts/media-core/src/media.d.ts +406 -0
  184. package/dist/_dts/media-core/src/mediaIdentifierSchema.d.ts +3 -0
  185. package/dist/_dts/media-core/src/mediaKinds.d.ts +2 -0
  186. package/dist/_dts/media-core/src/mediaUsageProjection.d.ts +13 -1
  187. package/dist/_dts/media-core/src/mediaWriteNormalizer.d.ts +2 -6
  188. package/dist/_dts/media-core/src/portableMediaReferences.d.ts +8 -21
  189. package/dist/_dts/media-core/src/renderableMediaAsset.d.ts +28 -14
  190. package/dist/_dts/media-core/src/renderableMediaAssetAdmission.d.ts +15 -0
  191. package/dist/_dts/media-core/src/storageObjectKey.d.ts +12 -0
  192. package/dist/_dts/media-editor/src/CropDialog.d.ts +6 -3
  193. package/dist/_dts/media-editor/src/MediaEditor.d.ts +2 -1
  194. package/dist/_dts/media-editor/src/MediaPreview.d.ts +3 -3
  195. package/dist/_dts/media-editor/src/cropEditorSource.d.ts +5 -7
  196. package/dist/_dts/media-editor/src/editorMediaState.d.ts +29 -0
  197. package/dist/_dts/media-editor/src/mediaSelection.d.ts +1 -2
  198. package/dist/_dts/media-editor/src/runtimeMediaAssetState.d.ts +4 -5
  199. package/dist/_dts/media-editor/src/types.d.ts +1 -1
  200. package/dist/_dts/media-editor/src/utils.d.ts +0 -1
  201. package/dist/_dts/media-react/src/components/cropChangePolicy.d.ts +4 -1
  202. package/dist/_dts/media-react/src/components/cropGeometry.d.ts +1 -0
  203. package/dist/_dts/media-react/src/components/useImageCropperController.d.ts +1 -0
  204. package/dist/_dts/media-react/src/hooks/useSupabaseMediaUploader.d.ts +1 -1
  205. package/dist/_dts/media-react/src/internal/supabaseResumableUpload.d.ts +13 -0
  206. package/dist/_dts/preview-next/src/client/blocks/BlockBackgroundChooser.d.ts +2 -1
  207. package/dist/_dts/preview-next/src/client/blocks/previewCustomizeSelectedMedia.d.ts +11 -12
  208. package/dist/_dts/preview-next/src/client/preview/previewModeRootAttribute.d.ts +11 -0
  209. package/dist/_dts/sdk/src/contracts/content.d.ts +2 -45
  210. package/dist/_dts/sdk/src/contracts/index.d.ts +1 -1
  211. package/dist/_dts/sdk/src/contracts/rendering.d.ts +3 -3
  212. package/dist/_dts/sdk/src/index.d.ts +1 -0
  213. package/dist/_dts/sdk/src/rendering/blocks-page-renderer.d.ts +0 -1
  214. package/dist/_dts/sdk/src/rendering/image.d.ts +14 -4
  215. package/dist/_dts/sdk/src/rendering/index.d.ts +5 -2
  216. package/dist/_dts/sdk/src/rendering/link.d.ts +5 -0
  217. package/dist/_dts/sdk/src/rendering/mediaAssets.d.ts +2 -4
  218. package/dist/_dts/sdk/src/rendering/overrides.d.ts +1 -0
  219. package/dist/_dts/sdk/src/version.d.ts +1 -1
  220. package/dist/_dts/theme-core/src/accordions/types.d.ts +1 -1
  221. package/dist/_dts/theme-core/src/blocks/opaquePanels.d.ts +3 -3
  222. package/dist/_dts/theme-core/src/boxBackgroundSchema.d.ts +397 -26
  223. package/dist/_dts/theme-core/src/buttons/types.d.ts +21 -21
  224. package/dist/_dts/theme-core/src/cards/types.d.ts +34 -34
  225. package/dist/_dts/theme-core/src/generated/containerResponsiveThemeCss.d.ts +1 -1
  226. package/dist/_dts/theme-core/src/inputs/types.d.ts +3 -3
  227. package/dist/_dts/theme-core/src/lib/media.d.ts +2 -616
  228. package/dist/_dts/theme-core/src/mock-themes/all.d.ts +261 -2619
  229. package/dist/_dts/theme-core/src/palette/curated/types.d.ts +1 -1
  230. package/dist/_dts/theme-core/src/schema.d.ts +548 -3187
  231. package/dist/_dts/theme-core/src/site-styles/backgroundAppearance.d.ts +2 -2
  232. package/dist/_dts/theme-core/src/site-styles/runtimeBackgroundResolution.d.ts +9 -9
  233. package/dist/_dts/theme-core/src/site-styles/styleTags.d.ts +1 -1
  234. package/dist/_dts/theme-core/src/site-styles/tokenRecipes.d.ts +1 -1
  235. package/dist/_dts/theme-core/src/styles/skinTokens.d.ts +2 -2
  236. package/dist/_dts/theme-core/src/typography/schema.d.ts +2 -2
  237. package/dist/client/BookingMailingListNote-DrchYW1m.mjs +386 -0
  238. package/dist/client/{CardListItem-ZDLYh6dL.mjs → CardListItem-CC_GVmF6.mjs} +5 -5
  239. package/dist/client/CheckIcon-CpyXr-Kg.mjs +35 -0
  240. package/dist/client/{CheckboxChoice-M-3HycLw.mjs → CheckboxChoice-Dq30m3DO.mjs} +1 -1
  241. package/dist/client/{DemoBookingPortalAccess-BMtvPTWE.mjs → DemoBookingPortalAccess-ojwbVUmx.mjs} +85 -85
  242. package/dist/client/{EventCombined.client-DUm_DOxW.mjs → EventCombined.client-DyN0v0Xk.mjs} +7 -9
  243. package/dist/client/{EventEmbeddedCheckoutStep-DsNNzgRm.mjs → EventEmbeddedCheckoutStep-CgfpKc3n.mjs} +11 -10
  244. package/dist/client/{EventListing.client-DjNYGUVm.mjs → EventListing.client-CuOuvYMz.mjs} +2 -2
  245. package/dist/client/{LeafletStaticMap-DuFiOHq_.mjs → LeafletStaticMap-B0WhRr3j.mjs} +1 -1
  246. package/dist/client/{ModalShell-CqkBvBIC.mjs → ModalShell-BXzucfR6.mjs} +83 -12
  247. package/dist/client/{RichText-LjPCUGGi.mjs → RichText-C1fIXBzA.mjs} +50 -34
  248. package/dist/client/{ThemedButton-DZKjtaDD.mjs → ThemedButton-B7HFqFBg.mjs} +1 -2
  249. package/dist/client/{accordion-Qe--SILD.mjs → accordion-DCDVWSye.mjs} +1 -1
  250. package/dist/client/{bookingForm-3BCl4g_f.mjs → bookingForm-BJ3C4GlM.mjs} +321 -154
  251. package/dist/client/bookings.mjs +118607 -22429
  252. package/dist/client/{carousel-h2YjKOS2.mjs → carousel-BSCBhfHY.mjs} +2 -2
  253. package/dist/client/{carousel.client-BLrd4hmY.mjs → carousel.client-GEtOGsxo.mjs} +46 -41
  254. package/dist/client/{cart-5NeiigVd.mjs → cart-Yv-aAtck.mjs} +3 -3
  255. package/dist/client/{checkout-G4UWjOEw.mjs → checkout-B9xDkl30.mjs} +3 -3
  256. package/dist/client/client.mjs +37511 -33793
  257. package/dist/client/{context-GK4-AVAh.mjs → context-BOGe3rIA.mjs} +275 -10
  258. package/dist/client/{eventCalendar-Prw3Yo_L.mjs → eventCalendar-D6M0T9hs.mjs} +18 -17
  259. package/dist/client/{eventCombined-BUugi6__.mjs → eventCombined-NM4UFBq8.mjs} +4 -4
  260. package/dist/client/{eventDetails-CBHUda-R.mjs → eventDetails-f_FhV4O8.mjs} +3 -4
  261. package/dist/client/{eventListing-CQeG45Dg.mjs → eventListing-WLkfAROh.mjs} +4 -4
  262. package/dist/client/{eventRegistration-Dif3p3oJ.mjs → eventRegistration-D3ejfLvW.mjs} +2209 -2144
  263. package/dist/client/{form-Cf0WMtfG.mjs → form-D5Or2Jyu.mjs} +5 -6
  264. package/dist/client/{headerSection-Bqdr3JWp.mjs → headerSection-hWgnv27V.mjs} +9 -9
  265. package/dist/client/hooks.mjs +17278 -16106
  266. package/dist/client/{locationMap-BVvPou4O.mjs → locationMap-Di1K0O2S.mjs} +3 -4
  267. package/dist/client/{media-47fcnhzD.mjs → media-D29-F1u_.mjs} +183 -362
  268. package/dist/client/mediaContext-CwbbimYB.mjs +135 -0
  269. package/dist/client/{newsletterForm-Cx-1dnic.mjs → newsletterForm-CwxcwTNO.mjs} +5 -5
  270. package/dist/client/{productDetail-DaUMaJYk.mjs → productDetail-BLSnhPdA.mjs} +3 -3
  271. package/dist/client/{productList-BKQlWEKE.mjs → productList-oGytONOX.mjs} +3 -3
  272. package/dist/client/{propsDecoder-DO5iXphQ.mjs → propsDecoder-lf_dTeZS.mjs} +18659 -14473
  273. package/dist/client/renderableMediaAssetAdmission-CHkXYDC_.mjs +143 -0
  274. package/dist/client/rendering/client.mjs +58971 -55722
  275. package/dist/client/rendering/islands.mjs +20 -23
  276. package/dist/client/rendering.mjs +41610 -37917
  277. package/dist/client/{routeIslandApiConfig-BNm0Z3-g.mjs → routeIslandApiConfig-Bc_WVPS8.mjs} +1 -1
  278. package/dist/client/{shop-D7ytcFBC.mjs → shop-BQ3bR7fA.mjs} +16 -14
  279. package/dist/client/{shop-commerce-D68-hHy2.mjs → shop-commerce-DDPll6ZC.mjs} +9 -9
  280. package/dist/client/{shop-commerce-store-Cu7X2lyu.mjs → shop-commerce-store-DO-e1pTe.mjs} +1 -1
  281. package/dist/client/{shopShared-D12rxE69.mjs → shopShared-BylM9jh1.mjs} +5 -5
  282. package/dist/client/themePortalRoot-DS92SRVZ.mjs +47 -0
  283. package/dist/client/{TerminalPanel-DOTSUCO0.mjs → useDiscountCodeUi-B1Puub2v.mjs} +60 -77
  284. package/dist/client/{useEventPagination-jgKa67KV.mjs → useEventPagination-BBhkmQaT.mjs} +6 -8
  285. package/dist/preview-next/before-render.mjs +96 -4
  286. package/dist/preview-next/client/runtime.mjs +3 -3
  287. package/dist/preview-next/keepAlive.mjs +7 -0
  288. package/dist/preview-next/middleware.mjs +7 -0
  289. package/dist/{sdk-runtime-4cCWO_3i.mjs → sdk-runtime-DWCvhJGu.mjs} +1 -1
  290. package/dist/server/components.mjs +21820 -19902
  291. package/dist/server/config-validation.mjs +1786 -642
  292. package/dist/server/config.mjs +1786 -642
  293. package/dist/server/data.mjs +17220 -16076
  294. package/dist/server/index.mjs +234 -2
  295. package/dist/server/next.mjs +22505 -20528
  296. package/dist/server/page-converter.mjs +7587 -6572
  297. package/dist/server/prebuild.mjs +1 -1
  298. package/dist/server/rendering/server.mjs +20487 -19044
  299. package/dist/server/rendering.mjs +21844 -19901
  300. package/dist/server/routing.mjs +19186 -17961
  301. package/dist/server/server.mjs +1874 -695
  302. package/dist/server/theme-bridge.mjs +1371 -914
  303. package/dist/server/theme.mjs +154 -37
  304. package/dist/{spinner-tSdG9YvG.mjs → spinner-BYM-Y81w.mjs} +1 -1
  305. package/dist/styles/index.css +1088 -721
  306. package/package.json +1 -1
  307. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/OrderSummary.d.ts +0 -15
  308. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useWaitlistClaimRestoration.d.ts +0 -22
  309. package/dist/_dts/blocks/src/system/runtime/shared/components/SelectableOptionCard.d.ts +0 -30
  310. package/dist/client/BookingMailingListNote-DlDSs5Vm.mjs +0 -567
  311. package/dist/client/colorStyles-DTunOThj.mjs +0 -1316
  312. package/dist/client/pricing-CMD0kADd.mjs +0 -314
  313. package/dist/client/result-DRW7JWXz.mjs +0 -30
  314. package/dist/client/scrollToBlock-C86BYkyV.mjs +0 -17
  315. package/dist/client/themePortalRoot-AGs4cE7t.mjs +0 -30
  316. package/dist/spinner-BL3kW9Uh.mjs +0 -803
@@ -1,1316 +0,0 @@
1
- import { n as ok, t as err } from "./result-DRW7JWXz.mjs";
2
- import { z } from "zod";
3
- //#region ../core/src/branded.ts
4
- const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
5
- function parseUuidBrand(value, unsafeConstructor) {
6
- if (typeof value !== "string") return err({ kind: "not_string" });
7
- const normalized = value.trim().toLowerCase();
8
- if (normalized.length === 0) return err({ kind: "empty_string" });
9
- if (!UUID_PATTERN.test(normalized)) return err({ kind: "invalid_uuid" });
10
- return ok(unsafeConstructor(normalized));
11
- }
12
- const unsafeAsEventOfferingId = (id) => id;
13
- const unsafeAsEventSeriesId = (id) => id;
14
- const unsafeAsMediaAssetId = (id) => id;
15
- const unsafeAsStorageBucketName = (value) => value;
16
- const unsafeAsStoragePath = (value) => value;
17
- const unsafeAsFormId = (id) => id;
18
- const unsafeAsPassId = (id) => id;
19
- const unsafeAsCustomerPassId = (id) => id;
20
- const unsafeAsAppointmentServiceId = (id) => id;
21
- const unsafeAsAppointmentResourceId = (id) => id;
22
- const unsafeAsContentVersionId = (id) => id;
23
- const parseEventOfferingId = (value) => parseUuidBrand(value, unsafeAsEventOfferingId);
24
- const parseContentVersionId = (value) => parseUuidBrand(value, unsafeAsContentVersionId);
25
- const parseEventSeriesId = (value) => parseUuidBrand(value, unsafeAsEventSeriesId);
26
- //#endregion
27
- //#region ../media-core/src/transformRect.ts
28
- function isValidTransformRectStructure(rect) {
29
- if (!Array.isArray(rect) || rect.length !== 4) return false;
30
- const [left, top, width, height] = rect;
31
- return Number.isFinite(left) && Number.isFinite(top) && Number.isFinite(width) && Number.isFinite(height) && left >= 0 && top >= 0 && width > 0 && height > 0;
32
- }
33
- //#endregion
34
- //#region ../media-core/src/aspectTransforms.ts
35
- const DEFAULT_RECT_EPSILON = .5;
36
- function parseAspectRatioValue(value) {
37
- if (typeof value === "number") return Number.isFinite(value) && value > 0 ? value : void 0;
38
- if (typeof value !== "string") return void 0;
39
- const normalized = value.trim();
40
- if (!normalized) return void 0;
41
- if (normalized === "auto") return void 0;
42
- if (normalized.includes(":") || normalized.includes("/")) {
43
- const delimiter = normalized.includes(":") ? ":" : "/";
44
- const [wRaw, hRaw] = normalized.split(delimiter);
45
- const width = Number(wRaw?.trim());
46
- const height = Number(hRaw?.trim());
47
- if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0) return;
48
- return width / height;
49
- }
50
- const numeric = Number(normalized);
51
- if (!Number.isFinite(numeric) || numeric <= 0) return void 0;
52
- return numeric;
53
- }
54
- const MAX_ASPECT_DISTANCE = .25;
55
- function resolveMediaTransformForAspect(transform, targetAspect) {
56
- if (!transform) return {};
57
- const base = {
58
- rect: transform.rect,
59
- hotspot: transform.hotspot,
60
- rotation: transform.rotation
61
- };
62
- const target = parseAspectRatioValue(targetAspect);
63
- const crops = transform.aspectCrops;
64
- if (!target || !crops || Object.keys(crops).length === 0) return base;
65
- let best = null;
66
- let bestDistance = Number.POSITIVE_INFINITY;
67
- for (const [key, candidate] of Object.entries(crops)) {
68
- const candidateAspect = parseAspectRatioValue(candidate.aspect ?? key);
69
- if (!candidateAspect) continue;
70
- const distance = Math.abs(Math.log(candidateAspect / target));
71
- if (distance < bestDistance) {
72
- best = candidate;
73
- bestDistance = distance;
74
- }
75
- }
76
- if (!best) return base;
77
- if (bestDistance > MAX_ASPECT_DISTANCE) return base;
78
- return {
79
- rect: best.rect ?? base.rect,
80
- hotspot: best.hotspot ?? base.hotspot,
81
- rotation: best.rotation ?? base.rotation
82
- };
83
- }
84
- function isValidTransformRect(rect) {
85
- return isValidTransformRectStructure(rect);
86
- }
87
- function isExplicitRectCrop(rect, sourceWidth, sourceHeight, epsilon = DEFAULT_RECT_EPSILON) {
88
- if (!isValidTransformRect(rect)) return false;
89
- if (!(typeof sourceWidth === "number" && Number.isFinite(sourceWidth) && sourceWidth > 0 && typeof sourceHeight === "number" && Number.isFinite(sourceHeight) && sourceHeight > 0)) return true;
90
- const [x, y, width, height] = rect;
91
- return !(Math.abs(x) <= epsilon && Math.abs(y) <= epsilon && Math.abs(width - sourceWidth) <= epsilon && Math.abs(height - sourceHeight) <= epsilon);
92
- }
93
- //#endregion
94
- //#region ../theme-core/src/surfaces/foregroundContract.ts
95
- const SURFACE_FOREGROUND_CSS_VARS = {
96
- text: "--rb-surface-text-color",
97
- heading: "--rb-surface-heading-color",
98
- link: "--rb-surface-link-color",
99
- linkHover: "--rb-surface-link-hover-color",
100
- supporting: "--rb-surface-supporting-color",
101
- muted: "--rb-surface-muted-color",
102
- line: "--rb-surface-line-color",
103
- mark: "--rb-surface-mark-color"
104
- };
105
- const DEFAULT_SURFACE_TEXT_COLOR = "rgb(var(--tb-text, 17 24 39))";
106
- const DEFAULT_SURFACE_LINK_COLOR = "rgb(var(--tb-primary, var(--tb-text, 17 24 39)))";
107
- const DEFAULT_SURFACE_SUPPORTING_COLOR = "rgb(var(--tb-mutedText, 100 116 139))";
108
- const DEFAULT_ROLE_FALLBACKS = {
109
- text: DEFAULT_SURFACE_TEXT_COLOR,
110
- heading: DEFAULT_SURFACE_TEXT_COLOR,
111
- link: DEFAULT_SURFACE_LINK_COLOR,
112
- linkHover: DEFAULT_SURFACE_LINK_COLOR,
113
- supporting: DEFAULT_SURFACE_SUPPORTING_COLOR,
114
- muted: DEFAULT_SURFACE_SUPPORTING_COLOR
115
- };
116
- function requireSurfaceColorValue(role, value) {
117
- const normalized = value.trim();
118
- if (normalized.length === 0) throw new RangeError(`Surface foreground ${role} must be a non-empty CSS color.`);
119
- return normalized;
120
- }
121
- function completeSurfaceForegrounds(input) {
122
- const text = requireSurfaceColorValue("text", input.text);
123
- const link = input.link === void 0 ? text : requireSurfaceColorValue("link", input.link);
124
- return {
125
- text,
126
- heading: input.heading === void 0 ? text : requireSurfaceColorValue("heading", input.heading),
127
- link,
128
- linkHover: input.linkHover === void 0 ? link : requireSurfaceColorValue("linkHover", input.linkHover),
129
- muted: input.muted === void 0 ? text : requireSurfaceColorValue("muted", input.muted),
130
- supporting: input.supporting === void 0 ? text : requireSurfaceColorValue("supporting", input.supporting)
131
- };
132
- }
133
- function surfaceForegroundValue(role, outsideProviderFallback = DEFAULT_ROLE_FALLBACKS[role]) {
134
- const roleVariable = SURFACE_FOREGROUND_CSS_VARS[role];
135
- const fallback = requireSurfaceColorValue("fallback", outsideProviderFallback);
136
- if (role === "text") return `var(${roleVariable}, ${fallback})`;
137
- if (role === "linkHover") return `var(${roleVariable}, ${surfaceForegroundValue("link", fallback)})`;
138
- return `var(${roleVariable}, var(${SURFACE_FOREGROUND_CSS_VARS.text}, ${fallback}))`;
139
- }
140
- function surfaceForegroundValueWithOpacity(role, opacityPercent) {
141
- if (!Number.isFinite(opacityPercent) || opacityPercent < 0 || opacityPercent > 100) throw new RangeError("Surface foreground opacity must be between 0 and 100.");
142
- return `color-mix(in srgb, ${surfaceForegroundValue(role)} ${opacityPercent}%, transparent)`;
143
- }
144
- function surfaceForegroundStyle(input) {
145
- const foregrounds = completeSurfaceForegrounds(input);
146
- return {
147
- color: foregrounds.text,
148
- [SURFACE_FOREGROUND_CSS_VARS.text]: foregrounds.text,
149
- [SURFACE_FOREGROUND_CSS_VARS.heading]: foregrounds.heading,
150
- [SURFACE_FOREGROUND_CSS_VARS.link]: foregrounds.link,
151
- [SURFACE_FOREGROUND_CSS_VARS.linkHover]: foregrounds.linkHover,
152
- [SURFACE_FOREGROUND_CSS_VARS.supporting]: foregrounds.supporting,
153
- ...input.muted === void 0 ? {} : { [SURFACE_FOREGROUND_CSS_VARS.muted]: foregrounds.muted },
154
- "--rb-surface-link-hover-decoration": hoverDecoration(input)
155
- };
156
- }
157
- function surfaceForegroundDeclarations(input) {
158
- return Object.entries(surfaceForegroundStyle(input)).map(([property, value]) => `${property}: ${value};`);
159
- }
160
- function hoverDecoration(input) {
161
- return input.hoverDecoration ?? "underline";
162
- }
163
- //#endregion
164
- //#region ../theme-core/src/palette/utils/colorConversion.ts
165
- function hexToRgb(hex) {
166
- const h = hex.replace(/^#/, "");
167
- const m = h.length === 3 ? h.split("").map((c) => c + c).join("") : h;
168
- if (m.length !== 6) throw new Error("Bad hex");
169
- const int = parseInt(m, 16);
170
- return {
171
- r: int >> 16 & 255,
172
- g: int >> 8 & 255,
173
- b: int & 255
174
- };
175
- }
176
- function srgbToLinear(u) {
177
- const x = u / 255;
178
- return x <= .04045 ? x / 12.92 : Math.pow((x + .055) / 1.055, 2.4);
179
- }
180
- //#endregion
181
- //#region ../theme-core/src/palette/utils/contrast.ts
182
- function relativeLuminance(r, g, b) {
183
- const R = srgbToLinear(r), G = srgbToLinear(g), B = srgbToLinear(b);
184
- return .2126 * R + .7152 * G + .0722 * B;
185
- }
186
- //#endregion
187
- //#region ../theme-core/src/tokens/colorTokenParts.ts
188
- function parseOpacityPercent(source) {
189
- const trimmed = source.trim();
190
- if (!trimmed) return null;
191
- if (!/^\d{1,3}(?:\.\d+)?$/.test(trimmed)) return null;
192
- const value = Number(trimmed);
193
- if (!Number.isFinite(value)) return null;
194
- if (value < 0 || value > 100) return null;
195
- return value;
196
- }
197
- function parseColorTokenParts(source) {
198
- const trimmed = source.trim();
199
- if (trimmed.startsWith("raw:")) return {
200
- kind: "raw",
201
- value: trimmed.slice(4)
202
- };
203
- const [token, opacityRaw, extra] = trimmed.split("/");
204
- if (!token || extra !== void 0) return {
205
- kind: "invalid",
206
- token: trimmed
207
- };
208
- if (opacityRaw === void 0) return {
209
- kind: "token",
210
- token,
211
- opacityPercent: null
212
- };
213
- const opacityPercent = parseOpacityPercent(opacityRaw);
214
- if (opacityPercent === null) return {
215
- kind: "invalid",
216
- token: trimmed
217
- };
218
- return {
219
- kind: "token",
220
- token,
221
- opacityPercent
222
- };
223
- }
224
- //#endregion
225
- //#region ../theme-core/src/tokens/blockColorTokens.ts
226
- const blockColorTokenNames = [
227
- "text",
228
- "heading",
229
- "mutedText",
230
- "surface",
231
- "background",
232
- "foreground",
233
- "border",
234
- "primary",
235
- "secondary",
236
- "accent",
237
- "success",
238
- "warning",
239
- "info",
240
- "error",
241
- "destructive",
242
- "scrim",
243
- "shadow",
244
- "onPrimary",
245
- "onSecondary",
246
- "onAccent",
247
- "onSuccess",
248
- "onWarning",
249
- "onInfo",
250
- "onError",
251
- "onDestructive",
252
- "onSurface",
253
- "onText"
254
- ];
255
- new Set(blockColorTokenNames);
256
- //#endregion
257
- //#region ../theme-core/src/tokens/themeColorTokens.ts
258
- /**
259
- * Known palette role token names. This is the low-level source of truth for
260
- * palette roles used by palette variants, Theme V2 schemas, and runtime color
261
- * reference parsing.
262
- */
263
- const PALETTE_TOKEN_NAMES = [
264
- "primary",
265
- "primaryForeground",
266
- "secondary",
267
- "accent",
268
- "success",
269
- "warning",
270
- "destructive",
271
- "background",
272
- "surface",
273
- "surfaceAlt",
274
- "muted",
275
- "text",
276
- "border"
277
- ];
278
- const paletteTokenNameSchema = z.enum(PALETTE_TOKEN_NAMES);
279
- const themeColorBaseTokenNames = [
280
- ...PALETTE_TOKEN_NAMES,
281
- ...blockColorTokenNames,
282
- "white",
283
- "neutral",
284
- "primaryText",
285
- "secondaryForeground",
286
- "accentForeground"
287
- ];
288
- const themeColorBaseTokenSet = new Set(themeColorBaseTokenNames);
289
- const themeColorShadeSteps = [
290
- "50",
291
- "100",
292
- "200",
293
- "300",
294
- "400",
295
- "500",
296
- "600",
297
- "700",
298
- "800",
299
- "900",
300
- "950"
301
- ];
302
- const shadeStepSet = new Set(themeColorShadeSteps);
303
- function isKnownBaseToken(value) {
304
- return themeColorBaseTokenSet.has(value);
305
- }
306
- function isKnownShadeToken(value) {
307
- const match = value.match(/^([a-zA-Z][a-zA-Z0-9]*)(?:-([0-9]{2,3}))$/);
308
- if (!match) return false;
309
- const [, base, shade] = match;
310
- return Boolean(base && shade && isKnownBaseToken(base) && shadeStepSet.has(shade));
311
- }
312
- function isThemeColorTokenBase(value) {
313
- return isKnownBaseToken(value) || isKnownShadeToken(value);
314
- }
315
- function isThemeColorToken(value) {
316
- if (typeof value !== "string") return false;
317
- const parts = parseColorTokenParts(value);
318
- return parts.kind === "token" && isThemeColorTokenBase(parts.token);
319
- }
320
- function parseThemeColorToken(value) {
321
- if (!isThemeColorToken(value)) return null;
322
- return value.trim();
323
- }
324
- const themeColorTokenSchema = z.string().min(1).refine((value) => Boolean(isThemeColorToken(value)), "Expected a known Theme V2 color token");
325
- //#endregion
326
- //#region ../theme-core/src/palette/colors.ts
327
- const HEX_COLOR_REGEX = /^#[0-9a-f]{6}$/;
328
- const NORMALIZABLE_HEX_REGEX = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
329
- const THEME_PALETTE_COLOR_ORDER = [
330
- "primary",
331
- "secondary",
332
- "accent",
333
- "success",
334
- "warning",
335
- "destructive",
336
- "background",
337
- "surface",
338
- "surfaceAlt",
339
- "muted",
340
- "text",
341
- "primaryForeground",
342
- "border"
343
- ];
344
- const hexColorSchema = z.string().regex(HEX_COLOR_REGEX, "Hex must be #RRGGBB (lowercase)").transform((value) => value);
345
- const paletteModeSchema = z.enum(["light", "dark"]);
346
- const PALETTE_VALUE_KEY_PREFIX = "palette-value:v1|";
347
- z.string().regex(/^[0-9a-f]{64}$/, "Palette hash must be a lowercase SHA-256 value").transform((value) => value);
348
- const paletteColorsSchema = z.object({
349
- primary: hexColorSchema,
350
- primaryForeground: hexColorSchema,
351
- secondary: hexColorSchema,
352
- accent: hexColorSchema,
353
- success: hexColorSchema,
354
- warning: hexColorSchema,
355
- destructive: hexColorSchema,
356
- background: hexColorSchema,
357
- surface: hexColorSchema,
358
- surfaceAlt: hexColorSchema,
359
- muted: hexColorSchema,
360
- text: hexColorSchema,
361
- border: hexColorSchema
362
- }).strict().transform((value) => value);
363
- function normalizePaletteHex(value) {
364
- if (!NORMALIZABLE_HEX_REGEX.test(value)) return null;
365
- const normalized = value.toLowerCase();
366
- if (normalized.length === 7) return normalized;
367
- const triplet = normalized.slice(1);
368
- const red = triplet.charAt(0);
369
- const green = triplet.charAt(1);
370
- const blue = triplet.charAt(2);
371
- return `#${red}${red}${green}${green}${blue}${blue}`;
372
- }
373
- function paletteColorsFromEntries(entries) {
374
- const values = {};
375
- for (const entry of entries) {
376
- const parsedRole = paletteTokenNameSchema.safeParse(entry.name);
377
- if (!parsedRole.success) return {
378
- ok: false,
379
- error: {
380
- kind: "unknown-role",
381
- role: entry.name
382
- }
383
- };
384
- const role = parsedRole.data;
385
- if (values[role] !== void 0) return {
386
- ok: false,
387
- error: {
388
- kind: "duplicate-role",
389
- role
390
- }
391
- };
392
- const hex = normalizePaletteHex(entry.hex);
393
- if (!hex) return {
394
- ok: false,
395
- error: {
396
- kind: "invalid-color",
397
- role,
398
- value: entry.hex
399
- }
400
- };
401
- values[role] = hex;
402
- }
403
- const missing = PALETTE_TOKEN_NAMES.filter((role) => values[role] === void 0);
404
- if (missing.length > 0) return {
405
- ok: false,
406
- error: {
407
- kind: "missing-roles",
408
- roles: missing
409
- }
410
- };
411
- return {
412
- ok: true,
413
- colors: paletteColorsSchema.parse(values)
414
- };
415
- }
416
- function requirePaletteColorsFromEntries(entries) {
417
- const result = paletteColorsFromEntries(entries);
418
- if (result.ok) return result.colors;
419
- throw new Error(`Invalid complete palette: ${result.error.kind}`);
420
- }
421
- function paletteColorEntries(colors) {
422
- return THEME_PALETTE_COLOR_ORDER.map((name) => ({
423
- name,
424
- hex: colors[name]
425
- }));
426
- }
427
- function paletteColorFingerprint(colors) {
428
- return PALETTE_TOKEN_NAMES.map((name) => `${name}:${colors[name]}`).join("|");
429
- }
430
- function canonicalPaletteHashInput(colors, mode) {
431
- return `${mode}|${paletteColorFingerprint(colors)}`;
432
- }
433
- /**
434
- * Stable curated-catalogue identity. Do not reorder roles: the order comes
435
- * from PALETTE_TOKEN_NAMES through canonicalPaletteHashInput.
436
- */
437
- function paletteValueKey(colors, mode) {
438
- return `${PALETTE_VALUE_KEY_PREFIX}${canonicalPaletteHashInput(colors, mode)}`;
439
- }
440
- /** Parses only the exact v1 canonical form emitted by paletteValueKey. */
441
- function parsePaletteValueKey(value) {
442
- if (typeof value !== "string" || !value.startsWith(PALETTE_VALUE_KEY_PREFIX)) return null;
443
- const [rawMode, ...rawRoles] = value.slice(17).split("|");
444
- const mode = paletteModeSchema.safeParse(rawMode);
445
- if (!mode.success || rawRoles.length !== PALETTE_TOKEN_NAMES.length) return null;
446
- const colors = paletteColorsFromEntries(rawRoles.map((roleValue) => {
447
- const separator = roleValue.indexOf(":");
448
- return separator === -1 ? {
449
- name: "",
450
- hex: ""
451
- } : {
452
- name: roleValue.slice(0, separator),
453
- hex: roleValue.slice(separator + 1)
454
- };
455
- }));
456
- if (!colors.ok || paletteValueKey(colors.colors, mode.data) !== value) return null;
457
- return value;
458
- }
459
- const paletteValueKeySchema = z.string().transform((value, ctx) => {
460
- const parsed = parsePaletteValueKey(value);
461
- if (parsed) return parsed;
462
- ctx.addIssue({
463
- code: "custom",
464
- message: "Invalid canonical palette value key"
465
- });
466
- return z.NEVER;
467
- });
468
- //#endregion
469
- //#region ../theme-core/src/buttons/types.ts
470
- /**
471
- * Standard semantic variant roles a theme exposes.
472
- *
473
- * Block content references variants by role; the active theme determines
474
- * what each role looks like.
475
- */
476
- const VARIANT_ROLES = [
477
- "primary",
478
- "secondary",
479
- "outline",
480
- "ghost",
481
- "accent"
482
- ];
483
- /**
484
- * Canonical persisted/CSS-safe button variant identifier.
485
- *
486
- * IDs become class selectors, so keep the contract deliberately narrower than
487
- * an arbitrary string and shared with every authoring/runtime boundary.
488
- */
489
- const buttonVariantIdSchema = z.string().min(1).max(50).regex(/^[a-z0-9-]+$/, "Button variant IDs may contain lowercase letters, numbers, and hyphens only").refine((value) => value !== "link" && value !== "tertiary", { message: "Retired button role IDs are not valid variant IDs" });
490
- /**
491
- * Magic alias the CSS generator emits for the highest-priority variant.
492
- *
493
- * Shared between generator and renderer so neither side hard-codes the string.
494
- */
495
- const DEFAULT_VARIANT_ALIAS_ID = "default";
496
- function parseOpaqueButtonColourToken(value) {
497
- const token = parseThemeColorToken(value);
498
- if (token === null) return null;
499
- const parts = parseColorTokenParts(token);
500
- return parts.kind === "token" && parts.opacityPercent === null ? token : null;
501
- }
502
- function unsafeAsOpaqueButtonColourToken(value) {
503
- return value;
504
- }
505
- const opaqueButtonColourTokenSchema = themeColorTokenSchema.refine((value) => parseOpaqueButtonColourToken(value) !== null, "Button colour tokens must be opaque").transform((value) => {
506
- const token = parseOpaqueButtonColourToken(value);
507
- if (token === null) throw new Error("Invariant: opaque button token passed its schema");
508
- return token;
509
- });
510
- const contextualButtonHoverSchema = z.strictObject({
511
- kind: z.literal("shade-shift"),
512
- seedToken: opaqueButtonColourTokenSchema,
513
- fallbackDirection: z.enum(["lighter", "darker"]),
514
- preferredToken: opaqueButtonColourTokenSchema.optional()
515
- });
516
- const buttonShadeAmountSchema = z.number().finite().min(0).max(900).multipleOf(100);
517
- const buttonShadowIntensitySchema = z.enum([
518
- "subtle",
519
- "medium",
520
- "strong"
521
- ]);
522
- /**
523
- * The complete persisted button-effect contract.
524
- *
525
- * Navigation has its own generic interactive-effect model. Button variants use
526
- * this closed union so unsupported effect IDs, unknown option keys, and unsafe
527
- * CSS values cannot become representable after the schema boundary.
528
- */
529
- const buttonPressOffsetSchema = z.strictObject({
530
- x: z.number().int().min(0).max(12),
531
- y: z.number().int().min(0).max(12)
532
- });
533
- const buttonEffectApplicationSchema = z.discriminatedUnion("effectId", [
534
- z.strictObject({
535
- effectId: z.literal("darken-background"),
536
- options: z.strictObject({ amount: buttonShadeAmountSchema.optional() }).optional()
537
- }),
538
- z.strictObject({
539
- effectId: z.literal("lighten-background"),
540
- options: z.strictObject({ amount: buttonShadeAmountSchema.optional() }).optional()
541
- }),
542
- z.strictObject({
543
- effectId: z.literal("background-on-hover"),
544
- options: z.strictObject({ colorToken: opaqueButtonColourTokenSchema.optional() }).optional()
545
- }),
546
- z.strictObject({
547
- effectId: z.literal("animated-gradient"),
548
- options: z.strictObject({ direction: z.enum(["horizontal", "vertical"]).optional() }).optional()
549
- }),
550
- z.strictObject({
551
- effectId: z.literal("drop-shadow"),
552
- options: z.strictObject({ intensity: buttonShadowIntensitySchema.optional() }).optional()
553
- }),
554
- z.strictObject({
555
- effectId: z.literal("inner-shadow"),
556
- options: z.strictObject({}).optional()
557
- }),
558
- z.strictObject({
559
- effectId: z.literal("neumorphic-shadow"),
560
- options: z.strictObject({
561
- mode: z.enum(["raised", "pressed"]).optional(),
562
- intensity: buttonShadowIntensitySchema.optional()
563
- }).optional()
564
- }),
565
- z.strictObject({
566
- effectId: z.literal("retro-3d-shadow"),
567
- options: z.strictObject({}).optional()
568
- }),
569
- z.strictObject({
570
- effectId: z.literal("scale-up"),
571
- options: z.strictObject({ scale: z.enum([
572
- "1.02",
573
- "1.03",
574
- "1.05",
575
- "1.10"
576
- ]).optional() }).optional()
577
- }),
578
- z.strictObject({
579
- effectId: z.literal("scale-down"),
580
- options: z.strictObject({ scale: z.enum([
581
- "0.90",
582
- "0.95",
583
- "0.97",
584
- "0.98"
585
- ]).optional() }).optional()
586
- }),
587
- z.strictObject({
588
- effectId: z.literal("lift"),
589
- options: z.strictObject({ amount: z.enum([
590
- "0.25",
591
- "0.5",
592
- "1"
593
- ]).optional() }).optional()
594
- }),
595
- z.strictObject({
596
- effectId: z.literal("press-down"),
597
- options: z.strictObject({ offset: buttonPressOffsetSchema.optional() }).optional()
598
- }),
599
- z.strictObject({
600
- effectId: z.literal("pop"),
601
- options: z.strictObject({ intensity: z.enum([
602
- "subtle",
603
- "medium",
604
- "dramatic"
605
- ]).optional() }).optional()
606
- }),
607
- z.strictObject({
608
- effectId: z.literal("border-bottom-grow"),
609
- options: z.strictObject({
610
- height: z.union([z.literal(1), z.literal(2)]).optional(),
611
- origin: z.enum([
612
- "left",
613
- "center",
614
- "right"
615
- ]).optional(),
616
- persistent: z.boolean().optional(),
617
- colourRole: z.literal("mark").optional()
618
- }).optional()
619
- }),
620
- z.strictObject({
621
- effectId: z.literal("sketchy-border"),
622
- options: z.strictObject({ intensity: buttonShadowIntensitySchema.optional() }).optional()
623
- })
624
- ]);
625
- const cornerStyleSchema = z.enum([
626
- "square",
627
- "rounded",
628
- "pill"
629
- ]);
630
- const shadowSizeSchema = z.enum([
631
- "none",
632
- "low",
633
- "medium",
634
- "high"
635
- ]);
636
- const textTransformSchema = z.enum([
637
- "none",
638
- "uppercase",
639
- "lowercase",
640
- "capitalize"
641
- ]);
642
- const fontWeightSchema = z.union([
643
- z.literal(500),
644
- z.literal(600),
645
- z.literal(700),
646
- z.literal(800)
647
- ]);
648
- const buttonTypographySchema = z.enum(["body", "heading"]);
649
- const letterSpacingSchema = z.enum([
650
- "tight",
651
- "normal",
652
- "loose"
653
- ]);
654
- const hoverTransformSchema = z.enum([
655
- "none",
656
- "lift",
657
- "scale",
658
- "press"
659
- ]);
660
- z.enum(["none", "token"]);
661
- const buttonPaddingPresetSchema = z.enum([
662
- "compact",
663
- "default",
664
- "spacious"
665
- ]);
666
- const gradientStyleSchema = z.enum([
667
- "linear",
668
- "radial",
669
- "conic"
670
- ]);
671
- const gradientSharpnessSchema = z.enum([
672
- "smooth",
673
- "medium",
674
- "hard"
675
- ]);
676
- const prioritySchema = z.union([
677
- z.literal(1),
678
- z.literal(2),
679
- z.literal(3)
680
- ]);
681
- const variantRoleSchema = z.enum(VARIANT_ROLES);
682
- const buttonSurfaceFallbackSchema = z.discriminatedUnion("kind", [z.strictObject({ kind: z.literal("surface-outline") }), z.strictObject({
683
- kind: z.literal("variant"),
684
- role: variantRoleSchema
685
- })]);
686
- const standardButtonSurfacePolicy = {
687
- primary: [{ kind: "surface-outline" }],
688
- secondary: [{ kind: "surface-outline" }, {
689
- kind: "variant",
690
- role: "primary"
691
- }],
692
- outline: [{ kind: "surface-outline" }],
693
- ghost: [{ kind: "surface-outline" }],
694
- accent: [{ kind: "surface-outline" }, {
695
- kind: "variant",
696
- role: "primary"
697
- }]
698
- };
699
- const STANDARD_BUTTON_SURFACE_POLICY = Object.freeze(Object.fromEntries(VARIANT_ROLES.map((role) => [role, Object.freeze([...standardButtonSurfacePolicy[role]])])));
700
- function createStandardButtonSurfacePolicy() {
701
- return Object.fromEntries(VARIANT_ROLES.map((role) => [role, [...STANDARD_BUTTON_SURFACE_POLICY[role]]]));
702
- }
703
- const buttonSurfacePolicyShape = Object.fromEntries(VARIANT_ROLES.map((role) => [role, z.array(buttonSurfaceFallbackSchema).max(VARIANT_ROLES.length)]));
704
- const buttonSurfacePolicySchema = z.strictObject(buttonSurfacePolicyShape);
705
- const buttonSizeNameSchema = z.enum([
706
- "sm",
707
- "md",
708
- "lg",
709
- "xl"
710
- ]);
711
- /**
712
- * CSS padding string in `"<vertical> <horizontal>"` shorthand form.
713
- *
714
- * Exactly two space-separated CSS length tokens. Each token is either the
715
- * literal `0` or a number followed by `rem`/`em`/`px`/`%`. This lets the
716
- * generator trust the shape rather than defensively defaulting downstream.
717
- */
718
- const PADDING_TOKEN_PATTERN = /^(?:0|\d+(?:\.\d+)?(?:rem|em|px|%))$/;
719
- const paddingShorthandSchema = z.string().refine((value) => {
720
- const parts = value.split(/\s+/).filter(Boolean);
721
- return parts.length === 2 && parts.every((token) => PADDING_TOKEN_PATTERN.test(token));
722
- }, { message: "Padding must be two space-separated CSS length tokens (e.g. \"0.5rem 1rem\"). Use `0` for zero." });
723
- const buttonSizeConfigSchema = z.object({
724
- padding: paddingShorthandSchema,
725
- fontSize: z.string().optional()
726
- });
727
- /**
728
- * `xl` is optional on the wire so themes persisted before the `xl` size was
729
- * added (e.g. SWTS) continue to parse. When `xl` is missing the schema
730
- * backfills it from `lg`, keeping `ButtonSizes` a complete `sm/md/lg/xl` map
731
- * downstream — generators never need to deal with an undefined `xl`.
732
- */
733
- const buttonSizesSchema = z.object({
734
- sm: buttonSizeConfigSchema,
735
- md: buttonSizeConfigSchema,
736
- lg: buttonSizeConfigSchema,
737
- xl: buttonSizeConfigSchema.optional()
738
- }).transform(({ sm, md, lg, xl }) => ({
739
- sm,
740
- md,
741
- lg,
742
- xl: xl ?? lg
743
- }));
744
- const buttonGlobalSettingsBaseSchema = z.strictObject({
745
- cornerStyle: cornerStyleSchema,
746
- cornerRadius: z.number().min(0).max(24).optional(),
747
- /**
748
- * Family-level shadow inherited by variants that don't set their own.
749
- * Optional and flat-by-default: when omitted, buttons carry no drop shadow
750
- * (`elevation: 'none'`). A personality opts the whole family into a shadow by
751
- * setting this; individual variants still override. There is no system-level
752
- * shadow-by-default — shadows only appear when explicitly declared.
753
- */
754
- shadow: shadowSizeSchema.optional(),
755
- textTransform: textTransformSchema,
756
- fontWeight: fontWeightSchema,
757
- typography: buttonTypographySchema.optional(),
758
- fontSize: z.string().optional(),
759
- letterSpacing: letterSpacingSchema.optional(),
760
- italic: z.boolean().optional(),
761
- paddingPreset: buttonPaddingPresetSchema.optional(),
762
- hoverTransform: hoverTransformSchema,
763
- gradientStyle: gradientStyleSchema.optional(),
764
- gradientAngle: z.number().min(0).max(360).optional(),
765
- gradientSharpness: gradientSharpnessSchema.optional()
766
- });
767
- const buttonGlobalSettingsSchema = z.discriminatedUnion("hoverColor", [buttonGlobalSettingsBaseSchema.extend({
768
- hoverColor: z.literal("none"),
769
- hoverColorToken: z.never().optional()
770
- }), buttonGlobalSettingsBaseSchema.extend({
771
- hoverColor: z.literal("token"),
772
- hoverColorToken: opaqueButtonColourTokenSchema
773
- })]);
774
- const gradientDirectionSchema = z.enum([
775
- "to-r",
776
- "to-l",
777
- "to-t",
778
- "to-b",
779
- "to-tr",
780
- "to-tl",
781
- "to-br",
782
- "to-bl"
783
- ]);
784
- const buttonColourTreatmentSchema = z.discriminatedUnion("type", [
785
- z.strictObject({
786
- type: z.literal("solid"),
787
- colorToken: opaqueButtonColourTokenSchema
788
- }),
789
- z.strictObject({
790
- type: z.literal("gradient"),
791
- stops: z.array(opaqueButtonColourTokenSchema).min(2).transform((stops) => {
792
- const [first, second, ...rest] = stops;
793
- if (first === void 0 || second === void 0) throw new Error("Invariant: gradient stops passed the minimum length schema");
794
- return [
795
- first,
796
- second,
797
- ...rest
798
- ];
799
- }),
800
- direction: gradientDirectionSchema,
801
- foregroundToken: opaqueButtonColourTokenSchema
802
- }),
803
- z.strictObject({
804
- type: z.literal("surface"),
805
- role: z.literal("link")
806
- })
807
- ]);
808
- const buttonBackgroundSchema = buttonColourTreatmentSchema;
809
- const buttonBorderSchema = z.strictObject({
810
- widthClass: z.string(),
811
- marksBoundary: z.literal(true).optional(),
812
- ring: z.literal(true).optional(),
813
- boundaryInk: opaqueButtonColourTokenSchema.optional()
814
- });
815
- const buttonVariantAffordanceSchema = z.strictObject({ iconId: z.string().min(1) });
816
- const variantShadowSchema = z.strictObject({
817
- elevation: z.enum([
818
- "none",
819
- "low",
820
- "medium",
821
- "high"
822
- ]),
823
- softness: z.enum([
824
- "crisp",
825
- "soft",
826
- "hard"
827
- ]).nullable(),
828
- position: z.enum(["bottom", "bottom-right"]).default("bottom"),
829
- colorToken: opaqueButtonColourTokenSchema.optional()
830
- });
831
- /** Recipe states own every visual property; treatment owns its readable label. */
832
- const buttonVisualAppearanceSchema = z.strictObject({
833
- background: buttonColourTreatmentSchema,
834
- text: z.literal("treatment"),
835
- border: z.union([z.literal("none"), buttonBorderSchema]),
836
- borderRadius: z.string(),
837
- shadow: z.union([z.literal("focus-indicator"), variantShadowSchema]),
838
- sizes: buttonSizesSchema,
839
- typography: z.strictObject({
840
- fontWeight: fontWeightSchema,
841
- typography: buttonTypographySchema,
842
- fontSize: z.string().nullable(),
843
- letterSpacing: z.union([letterSpacingSchema, z.literal("heading")]).nullable(),
844
- italic: z.boolean(),
845
- textTransform: textTransformSchema
846
- }),
847
- effects: z.array(buttonEffectApplicationSchema),
848
- contextualHover: contextualButtonHoverSchema.optional()
849
- });
850
- const buttonVisualStatesSchema = z.strictObject({
851
- base: buttonVisualAppearanceSchema.extend({ shadow: variantShadowSchema }),
852
- hover: buttonVisualAppearanceSchema.extend({ shadow: variantShadowSchema }),
853
- focus: buttonVisualAppearanceSchema.extend({ shadow: z.literal("focus-indicator") }),
854
- active: buttonVisualAppearanceSchema.extend({ shadow: variantShadowSchema }),
855
- disabled: buttonVisualAppearanceSchema.extend({ shadow: variantShadowSchema })
856
- });
857
- const variantEffectsSchema = z.strictObject({
858
- base: z.array(buttonEffectApplicationSchema).optional(),
859
- hover: z.array(buttonEffectApplicationSchema).optional(),
860
- active: z.array(buttonEffectApplicationSchema).optional(),
861
- focus: z.array(buttonEffectApplicationSchema).optional()
862
- });
863
- /**
864
- * Per-variant size overrides schema — every entry is optional.
865
- *
866
- * For each size key present, the values override the theme's `sizes` config
867
- * for that size on this variant. Missing sizes fall through to theme.sizes,
868
- * then system defaults.
869
- */
870
- const variantSizeOverridesSchema = z.object({
871
- sm: buttonSizeConfigSchema.optional(),
872
- md: buttonSizeConfigSchema.optional(),
873
- lg: buttonSizeConfigSchema.optional(),
874
- xl: buttonSizeConfigSchema.optional()
875
- });
876
- /**
877
- * Unified variant schema. Every variant participates in the size system; the
878
- * optional `sizes` field lets a variant scale differently than the theme
879
- * default (e.g. link-style variants declaring zero horizontal padding at
880
- * every size).
881
- */
882
- const buttonVariantSchema = z.strictObject({
883
- id: buttonVariantIdSchema,
884
- name: z.string().min(1).max(20),
885
- enabled: z.boolean(),
886
- priority: prioritySchema,
887
- visualStates: buttonVisualStatesSchema.optional(),
888
- background: buttonBackgroundSchema,
889
- /** Tailwind radius token (e.g. `'rounded-md'`). Omit to inherit from `global.cornerStyle`. */
890
- borderRadius: z.string().optional(),
891
- shadow: variantShadowSchema.optional(),
892
- border: buttonBorderSchema.optional(),
893
- hoverBackgroundToken: opaqueButtonColourTokenSchema.optional(),
894
- contextualHover: contextualButtonHoverSchema.optional(),
895
- effects: variantEffectsSchema.optional(),
896
- sizes: variantSizeOverridesSchema.optional(),
897
- affordance: buttonVariantAffordanceSchema.optional()
898
- });
899
- const buttonSystemSchema = z.strictObject({
900
- global: buttonGlobalSettingsSchema,
901
- variants: z.array(buttonVariantSchema).min(1).max(6),
902
- sizes: buttonSizesSchema.optional(),
903
- surfacePolicy: buttonSurfacePolicySchema.optional(),
904
- surfaceContexts: z.record(z.string(), z.strictObject({ primary: opaqueButtonColourTokenSchema })).optional()
905
- }).superRefine((system, ctx) => {
906
- const seen = /* @__PURE__ */ new Set();
907
- system.variants.forEach((variant, index) => {
908
- if (seen.has(variant.id)) ctx.addIssue({
909
- code: "custom",
910
- path: [
911
- "variants",
912
- index,
913
- "id"
914
- ],
915
- message: `Duplicate button variant ID: ${variant.id}`
916
- });
917
- seen.add(variant.id);
918
- });
919
- });
920
- //#endregion
921
- //#region ../theme-core/src/buttons/styles/domain.ts
922
- const PUBLIC_BUTTON_ROLES = VARIANT_ROLES;
923
- function defineButtonStyleRecipe(recipe) {
924
- return recipe;
925
- }
926
- function mapButtonVisualAppearances(states, transform) {
927
- return {
928
- base: transform(states.base, "base"),
929
- hover: transform(states.hover, "hover"),
930
- focus: transform(states.focus, "focus"),
931
- active: transform(states.active, "active"),
932
- disabled: transform(states.disabled, "disabled")
933
- };
934
- }
935
- function mapButtonRoleAppearances(roles, transform) {
936
- const role = (name) => transform(roles[name], name);
937
- return {
938
- primary: role("primary"),
939
- secondary: role("secondary"),
940
- outline: role("outline"),
941
- ghost: role("ghost"),
942
- accent: role("accent")
943
- };
944
- }
945
- function materializeButtonRoles(definitions) {
946
- return {
947
- primary: materializeCompleteRole("primary", definitions.primary),
948
- secondary: materializeCompleteRole("secondary", definitions.secondary),
949
- outline: materializeCompleteRole("outline", definitions.outline),
950
- ghost: materializeCompleteRole("ghost", definitions.ghost),
951
- accent: materializeCompleteRole("accent", definitions.accent)
952
- };
953
- }
954
- function resolveButtonStyleRecipe(recipe, parameters) {
955
- const parsedParameters = recipe.parameterSchema.safeParse(parameters);
956
- if (!parsedParameters.success) return {
957
- kind: "error",
958
- error: {
959
- kind: "invalid-parameters",
960
- styleId: recipe.id,
961
- issues: parsedParameters.error.issues.map((issue) => issue.message)
962
- }
963
- };
964
- const definition = recipe.defineSystem(parsedParameters.data);
965
- const roles = materializeButtonRoles(definition.roles);
966
- const buttonSystem = {
967
- global: buttonFamilyProjection(roles.primary),
968
- sizes: roles.primary.visualStates?.base.sizes,
969
- variants: PUBLIC_BUTTON_ROLES.map((role) => roles[role]),
970
- surfacePolicy: definition.surfacePolicy ?? createStandardButtonSurfacePolicy()
971
- };
972
- const parsedButtonSystem = buttonSystemSchema.safeParse(buttonSystem);
973
- if (!parsedButtonSystem.success) return {
974
- kind: "error",
975
- error: {
976
- kind: "invalid-button-system",
977
- styleId: recipe.id,
978
- issues: parsedButtonSystem.error.issues.map((issue) => issue.message)
979
- }
980
- };
981
- return {
982
- kind: "resolved",
983
- buttonSystem: parsedButtonSystem.data
984
- };
985
- }
986
- /** Historical family metadata remains a projection; recipes never read it. */
987
- function buttonFamilyProjection(primary) {
988
- const base = primary.visualStates.base;
989
- const type = base.typography;
990
- return {
991
- cornerStyle: base.borderRadius === "rounded-none" ? "square" : base.borderRadius === "rounded-full" ? "pill" : "rounded",
992
- shadow: base.shadow.elevation,
993
- fontWeight: type.fontWeight,
994
- textTransform: type.textTransform,
995
- typography: type.typography,
996
- ...type.fontSize === null ? {} : { fontSize: type.fontSize },
997
- ...type.letterSpacing === null || type.letterSpacing === "heading" ? {} : { letterSpacing: type.letterSpacing },
998
- ...type.italic ? { italic: true } : {},
999
- hoverTransform: "none",
1000
- hoverColor: "none"
1001
- };
1002
- }
1003
- function materializeCompleteRole(role, appearance) {
1004
- return {
1005
- visualStates: appearance.states,
1006
- background: appearance.states.base.background,
1007
- borderRadius: appearance.states.base.borderRadius,
1008
- ...appearance.states.base.border === "none" ? {} : { border: appearance.states.base.border },
1009
- shadow: appearance.states.base.shadow,
1010
- sizes: appearance.states.base.sizes,
1011
- effects: Object.fromEntries([
1012
- "base",
1013
- "hover",
1014
- "focus",
1015
- "active"
1016
- ].flatMap((state) => {
1017
- const effects = appearance.states[state].effects;
1018
- return effects.length === 0 ? [] : [[state, effects]];
1019
- })),
1020
- ...appearance.states.hover.contextualHover ? { contextualHover: appearance.states.hover.contextualHover } : {},
1021
- ...appearance.affordance ? { affordance: appearance.affordance } : {},
1022
- id: role,
1023
- name: roleName(role),
1024
- enabled: true,
1025
- priority: rolePriority(role)
1026
- };
1027
- }
1028
- function roleName(role) {
1029
- return role.charAt(0).toUpperCase() + role.slice(1);
1030
- }
1031
- function rolePriority(role) {
1032
- if (role === "primary") return 1;
1033
- if (role === "secondary") return 2;
1034
- return 3;
1035
- }
1036
- //#endregion
1037
- //#region ../theme-core/src/utils/tokenOrColor.ts
1038
- /**
1039
- * Runtime color-reference fields intentionally accept any string, including
1040
- * the legacy empty-string "no color" sentinel. Semantic validation needs
1041
- * palette context and happens in `parseThemeColorReference`.
1042
- */
1043
- const tokenOrCssColorValueSchema = z.string();
1044
- const CSS_COLOR_FUNCTION_PATTERN = /^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix|light-dark)\(/i;
1045
- const CSS_HEX_COLOR_PATTERN = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
1046
- const CSS_COLOR_KEYWORDS = /* @__PURE__ */ new Set([
1047
- "transparent",
1048
- "currentcolor",
1049
- "inherit",
1050
- "initial",
1051
- "revert",
1052
- "revert-layer",
1053
- "unset"
1054
- ]);
1055
- const COMMON_CSS_NAMED_COLORS = /* @__PURE__ */ new Set([
1056
- "black",
1057
- "blue",
1058
- "gray",
1059
- "green",
1060
- "grey",
1061
- "orange",
1062
- "pink",
1063
- "purple",
1064
- "red",
1065
- "white",
1066
- "yellow"
1067
- ]);
1068
- function isCssColorLiteral(value) {
1069
- const trimmed = value.trim();
1070
- if (!trimmed) return false;
1071
- return CSS_HEX_COLOR_PATTERN.test(trimmed) || CSS_COLOR_FUNCTION_PATTERN.test(trimmed) || /^var\(/i.test(trimmed) || CSS_COLOR_KEYWORDS.has(trimmed.toLowerCase());
1072
- }
1073
- function parseThemeToken(token) {
1074
- const trimmed = token.trim();
1075
- const match = trimmed.match(/^(.*?)-(\d{2,3})$/);
1076
- if (!match) return {
1077
- role: trimmed,
1078
- shade: null
1079
- };
1080
- const role = match[1] ?? trimmed;
1081
- const shade = match[2] ? Number(match[2]) : null;
1082
- return {
1083
- role,
1084
- shade: Number.isFinite(shade) ? shade : null
1085
- };
1086
- }
1087
- function parseContextThemeColorToken(value, context) {
1088
- const parts = parseColorTokenParts(value);
1089
- if (parts.kind !== "token") return null;
1090
- if (!(Boolean(context?.palette?.[value.trim()]) || parts.opacityPercent !== null && Boolean(context?.palette?.[parts.token]))) return null;
1091
- return value.trim();
1092
- }
1093
- function isTokenShapedTypo(value) {
1094
- if (COMMON_CSS_NAMED_COLORS.has(value.toLowerCase())) return false;
1095
- if (!/^[a-zA-Z][a-zA-Z0-9]*(?:-[a-zA-Z0-9]+)*(?:\/[^/]+)?$/.test(value)) return false;
1096
- return !isCssColorLiteral(value);
1097
- }
1098
- function warnUnknownThemeColorReference(value) {
1099
- if (!isTokenShapedTypo(value)) return;
1100
- console.warn(`[theme-core] Unknown Theme V2 color token "${value}" treated as literal CSS. Use raw:* for deliberate custom CSS values.`);
1101
- }
1102
- function parseThemeColorReference(input, context) {
1103
- const trimmed = input.trim();
1104
- if (trimmed.startsWith("raw:")) return {
1105
- kind: "literal-css",
1106
- value: trimmed.slice(4)
1107
- };
1108
- const contextToken = parseContextThemeColorToken(trimmed, context);
1109
- if (contextToken) return {
1110
- kind: "palette-context-token",
1111
- token: contextToken
1112
- };
1113
- const knownToken = parseThemeColorToken(trimmed);
1114
- if (knownToken) return {
1115
- kind: "theme-token",
1116
- token: knownToken
1117
- };
1118
- warnUnknownThemeColorReference(trimmed);
1119
- return {
1120
- kind: "literal-css",
1121
- value: trimmed
1122
- };
1123
- }
1124
- function resolveThemeColorReferenceValue(input, context) {
1125
- const reference = parseThemeColorReference(input, context);
1126
- return reference.kind === "literal-css" ? reference.value : rgbColorValue(reference.token);
1127
- }
1128
- function resolveTokenOrCssColorValue(input, context) {
1129
- return resolveThemeColorReferenceValue(input, context);
1130
- }
1131
- function resolveOnColorForThemeToken(token) {
1132
- if (!parseThemeColorToken(token)) return null;
1133
- const parts = parseColorTokenParts(token);
1134
- if (parts.kind !== "token") return null;
1135
- const { role, shade } = parseThemeToken(parts.token);
1136
- const normalizedRole = role.trim();
1137
- if (!normalizedRole) return null;
1138
- if (!shade) return rgbColorValue(`on${normalizedRole.charAt(0).toUpperCase() + normalizedRole.slice(1)}`);
1139
- return shade <= 400 ? "#000000" : "#FFFFFF";
1140
- }
1141
- //#endregion
1142
- //#region ../theme-core/src/buttons/buttonColourContract.ts
1143
- const BUTTON_VISUAL_STATES = [
1144
- "base",
1145
- "hover",
1146
- "focus",
1147
- "active",
1148
- "disabled"
1149
- ];
1150
- //#endregion
1151
- //#region ../theme-core/src/buttons/buttonSurfaceContext.ts
1152
- /**
1153
- * Break an inherited surface contract when a nested element establishes a
1154
- * backing whose colours cannot be proven (for example an image or gradient).
1155
- */
1156
- function contextualButtonSurfaceResetStyles() {
1157
- return Object.fromEntries(VARIANT_ROLES.flatMap((role) => Object.entries(resetActionVariables(role))));
1158
- }
1159
- function resetActionVariables(role) {
1160
- const styles = {};
1161
- for (const state of BUTTON_VISUAL_STATES) for (const property of [
1162
- "background-color",
1163
- "background-image",
1164
- "color"
1165
- ]) styles[actionVariableName(role, state, property)] = "initial";
1166
- for (const [state, property] of [
1167
- ["base", "outline"],
1168
- ["base", "outline-offset"],
1169
- ["focus", "outline"],
1170
- ["focus", "outline-offset"],
1171
- ["focus", "box-shadow"]
1172
- ]) styles[actionVariableName(role, state, property)] = "initial";
1173
- return styles;
1174
- }
1175
- function actionVariableName(role, state, property) {
1176
- return `--rb-action-${role}-${state}-${property}`;
1177
- }
1178
- //#endregion
1179
- //#region ../theme-core/src/surfaces/opaqueSurface.ts
1180
- /**
1181
- * The declarations that make an element own its surface: `color`, every
1182
- * `--rb-surface-*` role and every `--rb-action-*` variable. Card roles and
1183
- * opaque block panels both publish through this, so a nested surface can never
1184
- * inherit a band's light text or its band-resolved buttons.
1185
- */
1186
- function opaqueSurfaceDeclarations(surface, arrangement = false) {
1187
- if (surface.kind === "inherit") return inheritedSurfaceDeclarations(arrangement);
1188
- const foreground = surface.foreground;
1189
- return [
1190
- ...surfaceForegroundDeclarations({
1191
- text: colorValue(foreground.text),
1192
- heading: colorValue(foreground.heading),
1193
- link: colorValue(foreground.link),
1194
- linkHover: colorValue(foreground.linkHover),
1195
- supporting: colorValue(foreground.supporting),
1196
- ...arrangement ? { muted: colorValue(foreground.muted) } : {},
1197
- hoverDecoration: surface.hoverDecoration
1198
- }),
1199
- ...arrangement && surface.decorations !== void 0 ? [`${SURFACE_FOREGROUND_CSS_VARS.line}: ${surface.decorations.line};`, `${SURFACE_FOREGROUND_CSS_VARS.mark}: ${surface.decorations.mark};`] : [],
1200
- ...Object.entries(surface.buttonContext.styles).map(([property, value]) => `${property}: ${value};`)
1201
- ];
1202
- }
1203
- function colorValue(token) {
1204
- const parsed = parseThemeColorToken(token);
1205
- return parsed ? rgbColorValue(parsed) : token;
1206
- }
1207
- /** Every property a surface publishes, set to `inherit`. */
1208
- function inheritedSurfaceDeclarations(arrangement) {
1209
- return [
1210
- "color",
1211
- ...Object.entries(SURFACE_FOREGROUND_CSS_VARS).filter(([role]) => arrangement || role !== "line" && role !== "mark" && role !== "muted").map(([, variable]) => variable),
1212
- "--rb-surface-link-hover-decoration",
1213
- ...Object.keys(contextualButtonSurfaceResetStyles())
1214
- ].map((property) => `${property}: inherit;`);
1215
- }
1216
- //#endregion
1217
- //#region ../theme-core/src/utils/colorStyles.ts
1218
- const COLOR_VAR_PREFIX = "--tb-";
1219
- function parseToken(source) {
1220
- const parts = parseColorTokenParts(source);
1221
- if (parts.kind === "raw") return {
1222
- token: source,
1223
- raw: parts.value
1224
- };
1225
- if (parts.kind === "invalid") return { token: source };
1226
- return {
1227
- token: parts.token,
1228
- opacityPercent: parts.opacityPercent === null ? void 0 : parts.opacityPercent
1229
- };
1230
- }
1231
- const SURFACE_TEXT_ROLE_BY_TOKEN = {
1232
- text: "text",
1233
- heading: "heading",
1234
- mutedText: "supporting"
1235
- };
1236
- function surfaceRoleForTextToken(token) {
1237
- return Object.prototype.hasOwnProperty.call(SURFACE_TEXT_ROLE_BY_TOKEN, token) ? SURFACE_TEXT_ROLE_BY_TOKEN[token] : null;
1238
- }
1239
- /**
1240
- * Converts a theme color token to a CSS rgb value.
1241
- * This is the primary function for applying theme colors to CSS properties.
1242
- *
1243
- * @param token - Theme color token (semantic, with opacity, or raw)
1244
- * @returns CSS color value (rgb with optional alpha, or raw CSS value)
1245
- *
1246
- * @example
1247
- * rgbColorValue('primary') // => 'rgb(var(--tb-primary))'
1248
- * rgbColorValue('surface/95') // => 'rgb(var(--tb-surface) / 0.95)'
1249
- * rgbColorValue('raw:transparent') // => 'transparent'
1250
- */
1251
- function rgbColorValue(token) {
1252
- const { token: baseToken, opacityPercent, raw } = parseToken(token);
1253
- if (raw) return raw;
1254
- const cssVar = `${COLOR_VAR_PREFIX}${baseToken}`;
1255
- if (opacityPercent === void 0) return `rgb(var(${cssVar}))`;
1256
- return `rgb(var(${cssVar}) / ${opacityPercent / 100})`;
1257
- }
1258
- /**
1259
- * Creates a backgroundColor style object from a theme token.
1260
- *
1261
- * @param token - Theme color token
1262
- * @returns CSSProperties with backgroundColor
1263
- */
1264
- function backgroundColorStyle(token) {
1265
- return { backgroundColor: rgbColorValue(token) };
1266
- }
1267
- /**
1268
- * Converts a text color token to a CSS color value that follows the enclosing
1269
- * surface. The semantic text tokens (`text`, `heading`, `mutedText`) resolve
1270
- * to the surface foreground variables, so text adapts when a section's
1271
- * background changes; any other token is a fixed theme color.
1272
- *
1273
- * @param token - Theme color token
1274
- * @returns CSS color value
1275
- */
1276
- function textColorValue(token) {
1277
- const parsed = parseToken(token);
1278
- const surfaceRole = parsed.raw ? null : surfaceRoleForTextToken(parsed.token);
1279
- if (!surfaceRole) return rgbColorValue(token);
1280
- return parsed.opacityPercent === void 0 ? surfaceForegroundValue(surfaceRole) : surfaceForegroundValueWithOpacity(surfaceRole, parsed.opacityPercent);
1281
- }
1282
- /**
1283
- * Creates a text color style object from a theme token.
1284
- *
1285
- * @param token - Theme color token
1286
- * @returns CSSProperties with color
1287
- */
1288
- function textColorStyle(token) {
1289
- return { color: textColorValue(token) };
1290
- }
1291
- /**
1292
- * Merges multiple CSSProperties objects into a single object.
1293
- * Later styles override earlier ones. Undefined values are filtered out.
1294
- * Returns undefined if the merged result is empty.
1295
- *
1296
- * @param styles - Variable number of CSSProperties objects (can be undefined)
1297
- * @returns Merged CSSProperties object, or undefined if empty
1298
- *
1299
- * @example
1300
- * mergeStyles(
1301
- * backgroundColorStyle('surface'),
1302
- * textColorStyle('text'),
1303
- * borderColorStyle('border')
1304
- * )
1305
- * // => { backgroundColor: '...', color: '...', borderColor: '...' }
1306
- */
1307
- function mergeStyles(...styles) {
1308
- const merged = {};
1309
- for (const style of styles) {
1310
- if (!style) continue;
1311
- Object.assign(merged, style);
1312
- }
1313
- return Object.keys(merged).length ? merged : void 0;
1314
- }
1315
- //#endregion
1316
- export { themeColorTokenSchema as A, unsafeAsAppointmentServiceId as B, paletteColorsSchema as C, requirePaletteColorsFromEntries as D, paletteValueKeySchema as E, resolveMediaTransformForAspect as F, unsafeAsStorageBucketName as G, unsafeAsFormId as H, parseContentVersionId as I, unsafeAsStoragePath as K, parseEventOfferingId as L, hexToRgb as M, isExplicitRectCrop as N, parseThemeColorToken as O, parseAspectRatioValue as P, parseEventSeriesId as R, paletteColorsFromEntries as S, paletteValueKey as T, unsafeAsMediaAssetId as U, unsafeAsCustomerPassId as V, unsafeAsPassId as W, buttonSystemSchema as _, isCssColorLiteral as a, hexColorSchema as b, tokenOrCssColorValueSchema as c, mapButtonRoleAppearances as d, mapButtonVisualAppearances as f, buttonSizeNameSchema as g, VARIANT_ROLES as h, opaqueSurfaceDeclarations as i, relativeLuminance as j, themeColorShadeSteps as k, PUBLIC_BUTTON_ROLES as l, DEFAULT_VARIANT_ALIAS_ID as m, mergeStyles as n, resolveOnColorForThemeToken as o, resolveButtonStyleRecipe as p, textColorStyle as r, resolveTokenOrCssColorValue as s, backgroundColorStyle as t, defineButtonStyleRecipe as u, buttonVisualStatesSchema as v, paletteModeSchema as w, paletteColorEntries as x, unsafeAsOpaqueButtonColourToken as y, unsafeAsAppointmentResourceId as z };