@riverbankcms/sdk 0.111.0 → 0.119.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/{PreviewEditorSidebar-CTR6LUhN.mjs → PreviewEditorSidebar-C7TXFitV.mjs} +4 -4
- package/dist/{PreviewEditorUI-DZg15Zip.mjs → PreviewEditorUI-_1JIHTXS.mjs} +3 -3
- package/dist/{PreviewQueryProvider-kkmjklLG.mjs → PreviewQueryProvider-nKUT4TL-.mjs} +1 -1
- package/dist/{SdkPreviewModeRuntime-DeOTAFvR.mjs → SdkPreviewModeRuntime-CvJTVgWa.mjs} +2579 -34325
- package/dist/{SiteChromeCustomizeContext-DOSDLCiJ.mjs → SiteChromeCustomizeContext-66QfCbAS.mjs} +64625 -32791
- package/dist/_dts/ai/src/contracts/proposals.d.ts +5211 -639
- package/dist/_dts/ai/src/designer/themePatch.d.ts +1 -1
- package/dist/_dts/api/src/bookingAdjustments.d.ts +30 -36
- package/dist/_dts/api/src/bookingConfig.d.ts +26 -1
- package/dist/_dts/api/src/bookingRecords.d.ts +6 -74
- package/dist/_dts/api/src/bookingRefundOutcomes.d.ts +3 -3
- package/dist/_dts/api/src/contentRuntime.d.ts +5 -1
- package/dist/_dts/api/src/customerMembershipOutcomes.d.ts +4 -4
- package/dist/_dts/api/src/endpoints.d.ts +35 -0
- package/dist/_dts/api/src/event-presentation.d.ts +4 -0
- package/dist/_dts/api/src/index.d.ts +4 -4
- package/dist/_dts/api/src/navigation/dashboardBookingsNav.d.ts +4 -1
- package/dist/_dts/api/src/navigation/dashboardSettingsNav.d.ts +2 -2
- package/dist/_dts/api/src/sdk-event-upsert.d.ts +2 -2
- package/dist/_dts/api/src/sdkContracts.d.ts +85 -7
- package/dist/_dts/api/src/siteBanner.d.ts +8 -8
- package/dist/_dts/api/src/siteOperations.d.ts +1 -1
- package/dist/_dts/api/src/sitePlatformEndpoints.d.ts +32 -4
- package/dist/_dts/block-form/src/widgets/RichTextField/richTextFieldDefaults.d.ts +3 -12
- package/dist/_dts/block-form/src/widgets/RichTextField/richTextFieldSchema.d.ts +1 -5
- package/dist/_dts/blocks/src/bindings/index.d.ts +1 -10
- package/dist/_dts/blocks/src/index.d.ts +3 -6
- package/dist/_dts/blocks/src/primitives/content/primitives.d.ts +2 -2
- package/dist/_dts/blocks/src/system/blocks/body-text.d.ts +2 -2
- package/dist/_dts/blocks/src/system/blocks/events/recurring-schedule.d.ts +2 -2
- package/dist/_dts/blocks/src/system/blocks/events/shared/schemas.d.ts +2 -8
- package/dist/_dts/blocks/src/system/blocks/feature-card-icons.d.ts +2 -2
- package/dist/_dts/blocks/src/system/blocks/feature-cards.d.ts +3 -3
- package/dist/_dts/blocks/src/system/blocks/form.d.ts +2 -15
- package/dist/_dts/blocks/src/system/blocks/intro.d.ts +2 -2
- package/dist/_dts/blocks/src/system/blocks/media-text.d.ts +66 -66
- package/dist/_dts/blocks/src/system/blocks/newsletter-signup.d.ts +2 -16
- package/dist/_dts/blocks/src/system/blocks/site-footer.d.ts +0 -3
- package/dist/_dts/blocks/src/system/fragments/index.d.ts +0 -1
- package/dist/_dts/blocks/src/system/manifest/fieldValidation/index.d.ts +19 -2
- package/dist/_dts/blocks/src/system/manifest/richTextSchema.d.ts +8 -70
- package/dist/_dts/blocks/src/system/manifest/schema.d.ts +1 -0
- package/dist/_dts/blocks/src/system/manifest/validation.d.ts +6 -0
- package/dist/_dts/blocks/src/system/node/schema.d.ts +4 -4
- package/dist/_dts/blocks/src/system/runtime/nodes/basic.d.ts +1 -10
- package/dist/_dts/blocks/src/system/runtime/nodes/buttonAffordance.d.ts +5 -21
- package/dist/_dts/blocks/src/system/runtime/nodes/richText-coerce.d.ts +14 -2
- package/dist/_dts/blocks/src/system/transforms/typed.d.ts +1 -1
- package/dist/_dts/content-editor/src/controller/seedDraftBaselinesFromBlocks.d.ts +1 -1
- package/dist/_dts/content-editor/src/hooks/useBlockAutosave.d.ts +17 -1
- package/dist/_dts/content-editor/src/hooks/useDebouncedLatestSave.d.ts +1 -1
- package/dist/_dts/content-editor/src/hooks/useSimpleAutosave.d.ts +1 -1
- package/dist/_dts/content-editor/src/ui/editorSnapshot.d.ts +3 -2
- package/dist/_dts/content-editor/src/ui/editorUiStore.d.ts +2 -2
- package/dist/_dts/content-editor/src/ui/stores/autosaveStore.d.ts +1 -1
- package/dist/_dts/content-editor/src/ui/stores/types.d.ts +1 -1
- package/dist/_dts/content-model/src/content-types/builtins.d.ts +3 -15
- package/dist/_dts/content-model/src/content-types/entryValidation.d.ts +2 -0
- package/dist/_dts/content-model/src/content-types/schema.d.ts +1 -1
- package/dist/_dts/content-model/src/templates/defaults.d.ts +1 -21
- package/dist/_dts/core/src/editor-state.d.ts +14 -1
- package/dist/_dts/core/src/footer-composition.d.ts +2 -1
- package/dist/_dts/core/src/index.d.ts +1 -0
- package/dist/_dts/core/src/rich-text.d.ts +16 -0
- package/dist/_dts/db/src/generated/supabase/database.types.d.ts +189 -86
- package/dist/_dts/editor/src/index.d.ts +1 -1
- package/dist/_dts/editor/src/primitives/rich-text/utils.d.ts +3 -5
- package/dist/_dts/editor-blocks/src/BlockEditor.d.ts +1 -1
- package/dist/_dts/editor-blocks/src/block-editor/BlockCard.d.ts +2 -1
- package/dist/_dts/editor-blocks/src/block-editor/BlockCardHeader.d.ts +2 -1
- package/dist/_dts/editor-blocks/src/block-editor/blockDraftBaselineSeed.d.ts +15 -0
- package/dist/_dts/editor-blocks/src/block-editor/hooks/useBlockBaselineSync.d.ts +3 -7
- package/dist/_dts/editor-blocks/src/block-editor/hooks/useBlockDuplication.d.ts +12 -0
- package/dist/_dts/editor-blocks/src/block-editor/types.d.ts +1 -0
- package/dist/_dts/editor-blocks/src/block-editor/utils.d.ts +1 -1
- package/dist/_dts/editor-blocks/src/index.d.ts +6 -5
- package/dist/_dts/editor-blocks/src/widgets/rich-text/RichTextField.d.ts +2 -2
- package/dist/_dts/media-core/src/contentMediaAudit.d.ts +104 -0
- package/dist/_dts/media-core/src/contentMediaAuditFieldAdapter.d.ts +8 -0
- package/dist/_dts/media-core/src/contentMediaSnapshotAudit.d.ts +22 -0
- package/dist/_dts/media-core/src/index.d.ts +3 -1
- package/dist/_dts/sdk/src/cli/commands/event.d.ts +18 -1
- package/dist/_dts/sdk/src/cli/commands/push/execute/theme.d.ts +2 -16
- package/dist/_dts/sdk/src/cli/content/reader.d.ts +8 -5
- package/dist/_dts/sdk/src/client/management/events.d.ts +2 -1
- package/dist/_dts/sdk/src/client/management/index.d.ts +1 -1
- package/dist/_dts/sdk/src/client/management/types.d.ts +36 -9
- package/dist/_dts/sdk/src/config/typed-entries.d.ts +7 -7
- package/dist/_dts/sdk/src/config/validation.d.ts +7 -7
- package/dist/_dts/sdk/src/contracts/content.d.ts +5 -15
- package/dist/_dts/sdk/src/contracts/index.d.ts +1 -1
- package/dist/_dts/sdk/src/contracts/system-block-content.d.ts +12 -25
- package/dist/_dts/sdk/src/contracts/theme.d.ts +2 -18
- package/dist/_dts/sdk/src/manifest/passes/pass1-fields.d.ts +1 -1
- package/dist/_dts/sdk/src/manifest/three-pass-converter.d.ts +4 -4
- package/dist/_dts/sdk/src/rendering/helpers/bindings.d.ts +1 -2
- package/dist/_dts/sdk/src/rendering/helpers/index.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/islands/types.d.ts +2 -13
- package/dist/_dts/sdk/src/theme/index.d.ts +0 -29
- package/dist/_dts/sdk/src/version.d.ts +1 -1
- package/dist/_dts/site-commands/src/commands.d.ts +31 -18
- package/dist/_dts/theme-core/src/buttons/affordanceIcons.d.ts +2 -2
- package/dist/_dts/theme-core/src/buttons/core.d.ts +0 -1
- package/dist/_dts/theme-core/src/buttons/effectClassification.d.ts +22 -9
- package/dist/_dts/theme-core/src/buttons/effects/presets/background.d.ts +1 -2
- package/dist/_dts/theme-core/src/buttons/effects/presets/border.d.ts +1 -2
- package/dist/_dts/theme-core/src/buttons/effects/presets/overlay.d.ts +3 -1
- package/dist/_dts/theme-core/src/buttons/effects/presets/shadow.d.ts +2 -2
- package/dist/_dts/theme-core/src/buttons/effects/types.d.ts +8 -18
- package/dist/_dts/theme-core/src/buttons/generateButtonCss.d.ts +2 -2
- package/dist/_dts/theme-core/src/buttons/generateDefaultButtonSystem.d.ts +5 -5
- package/dist/_dts/theme-core/src/buttons/index.d.ts +1 -4
- package/dist/_dts/theme-core/src/buttons/parseThemeForPersistence.d.ts +36 -0
- package/dist/_dts/theme-core/src/buttons/types.d.ts +1638 -93
- package/dist/_dts/theme-core/src/cards/types.d.ts +13 -13
- package/dist/_dts/theme-core/src/mock-themes/all.d.ts +969 -69
- package/dist/_dts/theme-core/src/navigation/types.d.ts +2 -2
- package/dist/_dts/theme-core/src/recommend/generateThemes.d.ts +0 -1
- package/dist/_dts/theme-core/src/schema.d.ts +1100 -116
- package/dist/_dts/theme-core/src/site-styles/backgroundAppearance.d.ts +2 -2
- package/dist/_dts/theme-core/src/site-styles/designState.d.ts +14 -14
- package/dist/_dts/theme-core/src/site-styles/generatedSchemas.d.ts +2 -2
- package/dist/_dts/theme-core/src/site-styles/pageDesignIntent.d.ts +4 -4
- package/dist/_dts/theme-core/src/site-styles/previewCompiler.d.ts +6 -0
- package/dist/cli/index.mjs +5706 -4852
- package/dist/cli/init-docs/content/cli-reference.md +40 -1
- package/dist/cli/init-docs/content/content-management.md +6 -0
- package/dist/client/{DiscountCodeDisclosure-C4xvTBux.mjs → DiscountCodeDisclosure-DIWj-P9v.mjs} +1 -1
- package/dist/client/{EventCombined.client-Cr7G131j.mjs → EventCombined.client-De8YWBSr.mjs} +2 -2
- package/dist/client/{EventListing.client-CAjbseNy.mjs → EventListing.client-seHTjimY.mjs} +2 -2
- package/dist/client/{LeafletStaticMap-BMlWfwz3.mjs → LeafletStaticMap-BmQxFcJW.mjs} +1 -1
- package/dist/client/{MagicLinkForm-ChdFz96y.mjs → MagicLinkForm-OoJAIUIj.mjs} +1 -1
- package/dist/client/{StepIndicator-7D3GaBeM.mjs → StepIndicator-CiZ8kdPk.mjs} +2 -2
- package/dist/client/{accordion-D8JTs2Si.mjs → accordion-6lnN__XJ.mjs} +1 -1
- package/dist/client/{bookingForm-H3DCRBHs.mjs → bookingForm-5uyqhONU.mjs} +6 -6
- package/dist/client/bookings.mjs +2219 -527
- package/dist/client/{carousel-DMr_QWlz.mjs → carousel-Dtnifil_.mjs} +1 -1
- package/dist/client/{cart-DWMbfBdR.mjs → cart-5Tc5S7NV.mjs} +3 -3
- package/dist/client/{checkout-zmfdkXLx.mjs → checkout-CYKKN5Hr.mjs} +3 -3
- package/dist/client/client.mjs +2498 -2384
- package/dist/client/{colorTokenParts-FSS3al6l.mjs → colorStyles-BWpj_h4C.mjs} +88 -1
- package/dist/client/{courseRegistration-Z_mn18jy.mjs → courseRegistration-CxCBybB4.mjs} +6 -6
- package/dist/client/{eventCalendar-CYp0YJGF.mjs → eventCalendar-Xj2jZS9X.mjs} +4 -4
- package/dist/client/{eventCombined-rKyYZUa9.mjs → eventCombined-CgcMoOgM.mjs} +2 -2
- package/dist/client/{eventDetails-X0ZaUuMj.mjs → eventDetails-CEAH8Edc.mjs} +3 -3
- package/dist/client/{eventListing-W1SuL7EP.mjs → eventListing-qyPVQ0wP.mjs} +2 -2
- package/dist/client/{eventRegistration-ClWricui.mjs → eventRegistration-DDu79CtL.mjs} +6 -6
- package/dist/client/{form--eKPwAAD.mjs → form-Bc7JKI7I.mjs} +1 -1
- package/dist/client/{headerSection-BSeGr-FS.mjs → headerSection-vTku_LEl.mjs} +2 -2
- package/dist/client/hooks.mjs +373 -555
- package/dist/client/{locationMap-BpOrtNYn.mjs → locationMap-Bg7X4Jna.mjs} +3 -3
- package/dist/client/{media-DoF0dcVx.mjs → media-CNE1Z-wb.mjs} +1 -2
- package/dist/client/{newsletterForm-Bt7it7Dy.mjs → newsletterForm-lpylVdp5.mjs} +1 -1
- package/dist/client/{pricing-BTjSDDr4.mjs → pricing-DE8fjJiT.mjs} +1 -1
- package/dist/client/{productDetail-ICnVTcCg.mjs → productDetail-D7Bo2RMH.mjs} +3 -3
- package/dist/client/{productList-ZHr6D604.mjs → productList-VjnZqiqN.mjs} +3 -3
- package/dist/client/{propsDecoder-wWN0tBDF.mjs → propsDecoder-DreFXjNP.mjs} +2212 -621
- package/dist/client/rendering/client.mjs +21612 -21646
- package/dist/client/rendering/islands.mjs +20 -20
- package/dist/client/rendering.mjs +1571 -1547
- package/dist/client/{shop-C1u_BUn0.mjs → shop-IRsHHbf7.mjs} +5 -5
- package/dist/client/{shop-commerce-CleZdRha.mjs → shop-commerce-gnI8PieZ.mjs} +27 -10
- package/dist/client/{shop-commerce-store-ycnoB2Ce.mjs → shop-commerce-store-BTbrhObn.mjs} +1 -1
- package/dist/client/{shopShared-CPhByt2a.mjs → shopShared-D6KS2_qk.mjs} +3 -3
- package/dist/client/{useDiscountCodeUi-cStSQI6C.mjs → useDiscountCodeUi-DCccGCxV.mjs} +1 -1
- package/dist/client/{useEventFilters-DKPN7hSY.mjs → useEventFilters-eGs3rPZQ.mjs} +3 -104
- package/dist/client/{usePolling-BKAd6pkZ.mjs → usePolling-CvSU2sur.mjs} +2 -2
- package/dist/preview-next/before-render.mjs +57 -0
- package/dist/preview-next/client/runtime.mjs +4 -4
- package/dist/preview-next/middleware.mjs +57 -0
- package/dist/{previewAuthStore-BkT1D06A.mjs → previewAuthStore-DN7vcRsv.mjs} +57 -0
- package/dist/{sdk-runtime-hu3wr3ng.mjs → sdk-runtime-DaOiA7ct.mjs} +2 -2
- package/dist/{separator-Bln8izQ9.mjs → separator-CqRhcCxD.mjs} +1 -1
- package/dist/server/components.mjs +4092 -4108
- package/dist/server/config-template-validation.mjs +4 -23
- package/dist/server/config-validation.mjs +373 -555
- package/dist/server/config.mjs +410 -558
- package/dist/server/data.mjs +373 -555
- package/dist/server/index.mjs +58 -1
- package/dist/server/next.mjs +32958 -32926
- package/dist/server/page-converter.mjs +369 -526
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/rendering/server.mjs +5371 -3174
- package/dist/server/rendering.mjs +4099 -4124
- package/dist/server/routing.mjs +758 -966
- package/dist/server/server.mjs +448 -632
- package/dist/server/theme-bridge.mjs +472 -525
- package/dist/server/theme.mjs +1074 -392
- package/package.json +1 -1
- package/dist/_dts/blocks/src/primitives/content/components/Button.d.ts +0 -40
- package/dist/_dts/blocks/src/system/fragments/library/footerBottomText.d.ts +0 -19
- package/dist/_dts/media-core/src/legacyMediaValue.d.ts +0 -11
- package/dist/_dts/theme-core/src/styles/buttons.d.ts +0 -27
- package/dist/_dts/theme-core/src/styles/buttonsLibrary.d.ts +0 -2
- package/dist/_dts/theme-core/src/styles/glow.d.ts +0 -3
- package/dist/client/colorStyles-gcTh5yZT.mjs +0 -89
package/package.json
CHANGED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { HydratedTheme } from "../../../../../theme-core/src/schema";
|
|
3
|
-
type BaseButtonProps = {
|
|
4
|
-
theme: HydratedTheme;
|
|
5
|
-
children?: React.ReactNode;
|
|
6
|
-
size?: "sm" | "md" | "lg" | "xl";
|
|
7
|
-
className?: string;
|
|
8
|
-
glow?: string;
|
|
9
|
-
variant?: string;
|
|
10
|
-
};
|
|
11
|
-
export type OutlineButtonProps = BaseButtonProps & {
|
|
12
|
-
borderThickness?: string;
|
|
13
|
-
background?: string;
|
|
14
|
-
color?: string;
|
|
15
|
-
};
|
|
16
|
-
export type SolidButtonProps = BaseButtonProps & {
|
|
17
|
-
subtleGradient?: boolean;
|
|
18
|
-
background?: string;
|
|
19
|
-
};
|
|
20
|
-
export type GradientButtonProps = BaseButtonProps & {
|
|
21
|
-
gradient: unknown;
|
|
22
|
-
};
|
|
23
|
-
export type ButtonProps = BaseButtonProps & Partial<OutlineButtonProps> & Partial<SolidButtonProps> & Partial<GradientButtonProps> & {
|
|
24
|
-
styles?: React.CSSProperties;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Generic Button component
|
|
28
|
-
*
|
|
29
|
-
* Supports both old button system (via ButtonSpec) and new button system (via variant prop).
|
|
30
|
-
* When variant is provided and theme.buttons exists, uses CSS variables from the new system.
|
|
31
|
-
* Otherwise falls back to the old resolveButton logic.
|
|
32
|
-
*/
|
|
33
|
-
export declare function Button({ theme, children, className, size, variant, styles, }: ButtonProps): React.JSX.Element;
|
|
34
|
-
export declare const PrimaryButton: ({ theme, children, className, size, }: BaseButtonProps) => React.JSX.Element;
|
|
35
|
-
export declare const SecondaryButton: ({ theme, children, className, size, }: BaseButtonProps) => React.JSX.Element;
|
|
36
|
-
export declare const GhostButton: ({ theme, children, className, size, }: BaseButtonProps) => React.JSX.Element;
|
|
37
|
-
export declare const LinkButton: ({ theme, children, className, size, }: BaseButtonProps) => React.JSX.Element;
|
|
38
|
-
export declare const CtaGradientButton: ({ theme, children, className, size, }: BaseButtonProps) => React.JSX.Element;
|
|
39
|
-
export declare const AccentButton: ({ theme, children, className, size, }: BaseButtonProps) => React.JSX.Element;
|
|
40
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare const footerBottomTextFragment: import("..").DefinedFragment<{
|
|
2
|
-
readonly fields: readonly [{
|
|
3
|
-
readonly id: "bodyText";
|
|
4
|
-
readonly type: "richText";
|
|
5
|
-
readonly label: "Body text";
|
|
6
|
-
readonly description: "Appears in the main footer area.";
|
|
7
|
-
readonly ui: {
|
|
8
|
-
readonly variant: "limited";
|
|
9
|
-
};
|
|
10
|
-
}, {
|
|
11
|
-
readonly id: "bottomText";
|
|
12
|
-
readonly type: "richText";
|
|
13
|
-
readonly label: "Bottom bar text";
|
|
14
|
-
readonly description: "Appears in the optional footer bottom bar.";
|
|
15
|
-
readonly ui: {
|
|
16
|
-
readonly variant: "limited";
|
|
17
|
-
};
|
|
18
|
-
}];
|
|
19
|
-
}>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export type LegacyStringMediaFieldConfig = Readonly<{
|
|
2
|
-
type: 'media' | 'file';
|
|
3
|
-
mediaKinds?: readonly string[] | null;
|
|
4
|
-
fileKinds?: readonly string[] | null;
|
|
5
|
-
}>;
|
|
6
|
-
export type LegacyStringMediaValue = Readonly<{
|
|
7
|
-
type: string;
|
|
8
|
-
src: string;
|
|
9
|
-
}>;
|
|
10
|
-
export declare function legacyStringMediaTypeForField(field: LegacyStringMediaFieldConfig): string;
|
|
11
|
-
export declare function normalizeLegacyStringMediaValueForField(value: unknown, field: LegacyStringMediaFieldConfig): unknown;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { CSSProperties } from 'react';
|
|
2
|
-
import type { HydratedTheme } from '../schema';
|
|
3
|
-
export type ButtonSlot = 'primary' | 'secondary' | 'ghost' | 'link' | 'ctaGradient' | 'accent';
|
|
4
|
-
export type ButtonEmphasis = 'solid' | 'outline' | 'ghost' | 'link';
|
|
5
|
-
export type ButtonFill = 'flat' | 'gradient' | 'duotone';
|
|
6
|
-
export type ButtonSpec = {
|
|
7
|
-
id: string;
|
|
8
|
-
slot: ButtonSlot;
|
|
9
|
-
emphasis: ButtonEmphasis;
|
|
10
|
-
role: string;
|
|
11
|
-
fill: ButtonFill;
|
|
12
|
-
weight: number;
|
|
13
|
-
constraints?: {
|
|
14
|
-
minContrast?: number;
|
|
15
|
-
allowGradient?: boolean;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export type ButtonResolved = {
|
|
19
|
-
className: string;
|
|
20
|
-
style?: CSSProperties;
|
|
21
|
-
};
|
|
22
|
-
export declare function resolveButton(spec: ButtonSpec, theme: HydratedTheme, options?: {
|
|
23
|
-
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
24
|
-
}): ButtonResolved;
|
|
25
|
-
export declare function suggestButtons(theme: HydratedTheme, library: ButtonSpec[], max?: number): ButtonSpec[];
|
|
26
|
-
export declare function getButtonCornersClass(theme: HydratedTheme): string;
|
|
27
|
-
export declare function getButtonSizeClass(size: 'sm' | 'md' | 'lg' | 'xl'): string;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { n as surfaceForegroundValue, r as surfaceForegroundValueWithOpacity, t as parseColorTokenParts } from "./colorTokenParts-FSS3al6l.mjs";
|
|
2
|
-
//#region ../theme-core/src/utils/colorStyles.ts
|
|
3
|
-
const COLOR_VAR_PREFIX = "--tb-";
|
|
4
|
-
function parseToken(source) {
|
|
5
|
-
const parts = parseColorTokenParts(source);
|
|
6
|
-
if (parts.kind === "raw") return {
|
|
7
|
-
token: source,
|
|
8
|
-
raw: parts.value
|
|
9
|
-
};
|
|
10
|
-
if (parts.kind === "invalid") return { token: source };
|
|
11
|
-
return {
|
|
12
|
-
token: parts.token,
|
|
13
|
-
opacityPercent: parts.opacityPercent === null ? void 0 : parts.opacityPercent
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
const SURFACE_TEXT_ROLE_BY_TOKEN = {
|
|
17
|
-
text: "text",
|
|
18
|
-
heading: "heading",
|
|
19
|
-
mutedText: "supporting"
|
|
20
|
-
};
|
|
21
|
-
function surfaceRoleForTextToken(token) {
|
|
22
|
-
return Object.prototype.hasOwnProperty.call(SURFACE_TEXT_ROLE_BY_TOKEN, token) ? SURFACE_TEXT_ROLE_BY_TOKEN[token] : null;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Converts a theme color token to a CSS rgb value.
|
|
26
|
-
* This is the primary function for applying theme colors to CSS properties.
|
|
27
|
-
*
|
|
28
|
-
* @param token - Theme color token (semantic, with opacity, or raw)
|
|
29
|
-
* @returns CSS color value (rgb with optional alpha, or raw CSS value)
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* rgbColorValue('primary') // => 'rgb(var(--tb-primary))'
|
|
33
|
-
* rgbColorValue('surface/95') // => 'rgb(var(--tb-surface) / 0.95)'
|
|
34
|
-
* rgbColorValue('raw:transparent') // => 'transparent'
|
|
35
|
-
*/
|
|
36
|
-
function rgbColorValue(token) {
|
|
37
|
-
const { token: baseToken, opacityPercent, raw } = parseToken(token);
|
|
38
|
-
if (raw) return raw;
|
|
39
|
-
const cssVar = `${COLOR_VAR_PREFIX}${baseToken}`;
|
|
40
|
-
if (opacityPercent === void 0) return `rgb(var(${cssVar}))`;
|
|
41
|
-
return `rgb(var(${cssVar}) / ${opacityPercent / 100})`;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Creates a backgroundColor style object from a theme token.
|
|
45
|
-
*
|
|
46
|
-
* @param token - Theme color token
|
|
47
|
-
* @returns CSSProperties with backgroundColor
|
|
48
|
-
*/
|
|
49
|
-
function backgroundColorStyle(token) {
|
|
50
|
-
return { backgroundColor: rgbColorValue(token) };
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Creates a text color style object from a theme token.
|
|
54
|
-
*
|
|
55
|
-
* @param token - Theme color token
|
|
56
|
-
* @returns CSSProperties with color
|
|
57
|
-
*/
|
|
58
|
-
function textColorStyle(token) {
|
|
59
|
-
const parsed = parseToken(token);
|
|
60
|
-
const surfaceRole = parsed.raw ? null : surfaceRoleForTextToken(parsed.token);
|
|
61
|
-
if (surfaceRole) return { color: parsed.opacityPercent === void 0 ? surfaceForegroundValue(surfaceRole) : surfaceForegroundValueWithOpacity(surfaceRole, parsed.opacityPercent) };
|
|
62
|
-
return { color: rgbColorValue(token) };
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Merges multiple CSSProperties objects into a single object.
|
|
66
|
-
* Later styles override earlier ones. Undefined values are filtered out.
|
|
67
|
-
* Returns undefined if the merged result is empty.
|
|
68
|
-
*
|
|
69
|
-
* @param styles - Variable number of CSSProperties objects (can be undefined)
|
|
70
|
-
* @returns Merged CSSProperties object, or undefined if empty
|
|
71
|
-
*
|
|
72
|
-
* @example
|
|
73
|
-
* mergeStyles(
|
|
74
|
-
* backgroundColorStyle('surface'),
|
|
75
|
-
* textColorStyle('text'),
|
|
76
|
-
* borderColorStyle('border')
|
|
77
|
-
* )
|
|
78
|
-
* // => { backgroundColor: '...', color: '...', borderColor: '...' }
|
|
79
|
-
*/
|
|
80
|
-
function mergeStyles(...styles) {
|
|
81
|
-
const merged = {};
|
|
82
|
-
for (const style of styles) {
|
|
83
|
-
if (!style) continue;
|
|
84
|
-
Object.assign(merged, style);
|
|
85
|
-
}
|
|
86
|
-
return Object.keys(merged).length ? merged : void 0;
|
|
87
|
-
}
|
|
88
|
-
//#endregion
|
|
89
|
-
export { textColorStyle as i, mergeStyles as n, rgbColorValue as r, backgroundColorStyle as t };
|