@bettercms-ai/types 1.39.0 → 1.40.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/README.md +18 -18
- package/dist/index.d.ts +20 -7
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/package.json +34 -34
package/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
# @bettercms-ai/types
|
|
2
|
-
|
|
3
|
-
Pure TypeScript type definitions for BetterCMS.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @bettercms-ai/types --registry=https://npm.pkg.github.com/
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
import type { Workspace, Page, ContentBlock } from "@bettercms-ai/types"
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## License
|
|
18
|
-
Private - bettercms.ai
|
|
1
|
+
# @bettercms-ai/types
|
|
2
|
+
|
|
3
|
+
Pure TypeScript type definitions for BetterCMS.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @bettercms-ai/types --registry=https://npm.pkg.github.com/
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import type { Workspace, Page, ContentBlock } from "@bettercms-ai/types"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## License
|
|
18
|
+
Private - bettercms.ai
|
package/dist/index.d.ts
CHANGED
|
@@ -1280,14 +1280,25 @@ declare function splitButtonStyle(style: BlockStyle | undefined): {
|
|
|
1280
1280
|
};
|
|
1281
1281
|
/**
|
|
1282
1282
|
* The style keys a PAGE FIELD takes (`pages.field_styles`, keyed by field path): its width and
|
|
1283
|
-
* placement, the space above and below it,
|
|
1284
|
-
*
|
|
1285
|
-
*
|
|
1283
|
+
* placement, the space above and below it, its text alignment, font size and weight, and `size` — a
|
|
1284
|
+
* whole element's Small / Large (a button's). Every key but `size` is a `BlockStyle` key, so it
|
|
1285
|
+
* keeps the token set and the CSS table it already has — a field never gets a second scale.
|
|
1286
|
+
* 🔴 Twin: `FIELD_STYLE_KEYS` in the dashboard's fieldStyle.ts.
|
|
1286
1287
|
*/
|
|
1287
|
-
declare const FIELD_STYLE_KEYS: readonly ["contentWidth", "contentAlign", "marginTop", "marginBottom", "align", "fontSize", "weight"];
|
|
1288
|
+
declare const FIELD_STYLE_KEYS: readonly ["contentWidth", "contentAlign", "marginTop", "marginBottom", "align", "fontSize", "weight", "size"];
|
|
1288
1289
|
type FieldStyleKey = (typeof FIELD_STYLE_KEYS)[number];
|
|
1290
|
+
/** A field element's Small / Large. Medium is UNSET — no "md" token is ever stored. */
|
|
1291
|
+
type FieldSize = "sm" | "lg";
|
|
1292
|
+
/**
|
|
1293
|
+
* `size` → the element's `zoom`, which scales the WHOLE element (padding, font, icon, border) — what
|
|
1294
|
+
* Small / Large mean for a button whose CSS the site wrote. Any other value (`md` included) paints
|
|
1295
|
+
* nothing. 🔴 Inlined in the convert helper (`STYLE_SIZE_ZOOM`), parity-tested against this table.
|
|
1296
|
+
*/
|
|
1297
|
+
declare const FIELD_SIZE_ZOOM: Readonly<Record<FieldSize, string>>;
|
|
1289
1298
|
/** One field's style. */
|
|
1290
|
-
type FieldStyle = Pick<BlockStyle, FieldStyleKey
|
|
1299
|
+
type FieldStyle = Pick<BlockStyle, Exclude<FieldStyleKey, "size">> & {
|
|
1300
|
+
size?: FieldSize;
|
|
1301
|
+
};
|
|
1291
1302
|
/** A page's field styles, keyed by field path (the `data-bcms-field` address). */
|
|
1292
1303
|
type FieldStyles = Record<string, FieldStyle>;
|
|
1293
1304
|
/** Only the field keys of `style` (an empty object for none). */
|
|
@@ -1296,7 +1307,9 @@ declare function pickFieldStyle(style: BlockStyle | Record<string, unknown> | nu
|
|
|
1296
1307
|
* A field's declarations, for its OWN element (`fieldAttrs`). Spacing, alignment, size and weight are
|
|
1297
1308
|
* `blockStyleToCss`'s. The width is `blockStyleToInnerCss`'s column, drawn on the element itself —
|
|
1298
1309
|
* a field has no wrapper to nest a column in — so its placement becomes left/right margins, and
|
|
1299
|
-
* the vertical margins the spacing set stay. `
|
|
1310
|
+
* the vertical margins the spacing set stay. `size` (`FIELD_SIZE_ZOOM`) is LAST, so a style without
|
|
1311
|
+
* it keeps the exact declarations, in the exact order, it always had. `undefined` when nothing
|
|
1312
|
+
* applies (no `style` at all).
|
|
1300
1313
|
*/
|
|
1301
1314
|
declare function fieldStyleToCss(style: BlockStyle | Record<string, unknown> | null | undefined): Record<string, string | number> | undefined;
|
|
1302
1315
|
/**
|
|
@@ -2847,4 +2860,4 @@ declare function regionOf<E extends {
|
|
|
2847
2860
|
el: E;
|
|
2848
2861
|
}[], el: unknown): string | null;
|
|
2849
2862
|
|
|
2850
|
-
export { type AlignToken, type ApiError, type ApiKey, type ApiKeyPermission, type ApiKeyTokenType, type ArrayZoneConfig, type AssertEqual, type AuthResponse, type AuthSession, type AuthUser, BLOCK_BINDINGS, BREAKPOINTS, BUTTON_ICONS, BUTTON_ICON_NAMES, BUTTON_LOOK_KEYS, BUTTON_PLACEMENT_KEYS, BUTTON_SIZES, BUTTON_VARIANTS, type BetterCMSErrorCode, type BgToken, type BindingKind, type BlockBinding, type BlockHoverStyle, type BlockStyle, type BlockType, type ButtonBlock, type ButtonIcon, type ButtonLinkCandidate, type ButtonLookKey, type ButtonProps, type ButtonSizeName, type ButtonValue, type ButtonVariant, COMPONENT_PROP_TYPES, type CanonicalInputDefinition, type CollectionBlock, type CollectionFilter, type CollectionProps, type ColorToken, type ColumnsBlock, type ColumnsProps, type Component, type ComponentBlock, type ComponentCategory, type ComponentFormPropRef, type ComponentPropDef, type ComponentPropType, type ComponentPropUi, type ComponentProps, type ComponentSubField, type ComponentVariantGroup, type Content, type ContentBlock, type ContentEntry, type ContentModel, type ContentModelField, type ContentModelFieldType, type ContentModelFieldUi, type ContentPageResult, type ContentResponse, type ContentWidthToken, type CornerToken, DIALOG_SELECTOR, DOCK_BUDGET, DOCK_ICON_NAMES, DOCK_ICON_NAME_SET, type DeepReadonly, type DeliveredLayout, type DeliveryComponent, type DeliveryEntry, type DeliveryEntrySeo, type DeliveryList, type DeliveryPage, type DerivedLocator, type DockBudget, type DockFieldLike, type DockFieldsetLike, type DockIconName, type DockInputRef, type DockLane, type DockNode, type DockPropGroupLike, type DockScreen, type ElementLike, type ExpandedBinding, FIELD_STYLE_KEYS, FOOTER_SECTION_ID, type FieldConfig, type FieldStyle, type FieldStyleKey, type FieldStyles, type Fieldset, type FieldsetKind, type FieldsetUiBefore, type FontSizeToken, type FooterBlock, type FooterColumn, type FooterProps, type Form, type FormBlock, type FormField, type FormProps, type FormSubmission, type HeadingBlock, type HeadingProps, type ImageBlock, type ImageProps, LANDMARK_SELECTOR, LAYOUT_SECTION_ICONS, LAYOUT_SECTION_ICON_SET, LINK_RELS, type LandmarkChainElement, type LandmarkElement, type LayoutComponentItem, type LayoutDataDocument, type LayoutFieldDefinition, type LayoutFieldItem, type LayoutFieldType, type LayoutScalarFieldType, type LayoutSection, type LayoutSectionIcon, type LayoutSectionItem, type LayoutStructureDocument, type LayoutZone, type LinkRel, type LocatorGrammar, MAIN_SELECTOR, type ManagementLayoutCommand, type MediaAsset, type MediaCaptionTrack, type MediaFieldValue, NAVIGATION_SECTION_ID, type NavLink, type NavbarBlock, type NavbarProps, PAGE_CONTENT_ANCHOR_ID, type Page, type PageLayoutOverrideDataDocument, type PageLayoutOverrideDocument, type PageLayoutOverrideState, type PageLayoutOverrideStructureDocument, type PageLayoutSectionOverride, type PageLayoutSectionStructureOverride, type PageMetaJson, type PageOnlyLayoutSection, type PageSectionPlacement, type PaginatedResult, type Perspective, type PortableTextDocument, type PortableTextNode, type PropGroup, RESPONSIVE_CSS, type RadiusToken, type ReadButtonValue, type Redirect, type ReservedLayoutSection, type ResolvedLayoutNode, type RichTextBlock, type RichTextProps, SECTION_DOCTRINE, SECTION_SPACE_TOKENS, SLOT_ITEMS_CAP, SLOT_MAX_ITEMS, SPACE_BOTTOM_TOKENS, SPACE_STEP_TOKENS, type SectionBlock, type SectionProps, type SectionSpaceToken, type ShadowToken, type ShowIf, type ShowIfRule, type SignInInput, type SignUpInput, type SiteSeoDefaults, type SlideItem, type SliderBlock, type SliderProps, type SlotItem, type SlotValue, type SpaceStepToken, type SpaceToken, type SpacerBlock, type SpacerProps, type TabItem, type TabsBlock, type TabsProps, type TextBlock, type TextProps, type ThemeToken, type UiBefore, type UiOrigin, type VariantInputMapping, type VideoBlock, type VideoProps, type VisibilityWindow, type WeightToken, type WindowState, type Workspace, type ZoneField, anchorTargetRel, blockStyleToColumnCss, blockStyleToCss, blockStyleToInnerCss, buttonBlockProps, buttonIconOf, buttonIconSvg, buttonLinkPairs, buttonValueOfInstance, buttonValueProblem, buttonVariantOf, candidateRole, componentInstanceAddresses, componentPropTargetKey, derivedPairs, dockBudget, dockScreens, expandBlockBindings, fieldStyleCssText, fieldStyleToCss, formatPropsAttribute, getBlockType, headingPaintCss, hideOnAttr, inWindow, isBlock, isChromeLandmark, keyWords, landmarkRegions, locatorFor, normalizeWindow, parsePropsAttribute, pickFieldStyle, readButtonValue, readPath, regionOf, safeCssUrl, slotItems, spaceTokenCss, splitButtonStyle, usesHideOn, visibleBlocks, visibleDeliveredLayout, visibleLayoutStructure, windowState, withButtonLookProps };
|
|
2863
|
+
export { type AlignToken, type ApiError, type ApiKey, type ApiKeyPermission, type ApiKeyTokenType, type ArrayZoneConfig, type AssertEqual, type AuthResponse, type AuthSession, type AuthUser, BLOCK_BINDINGS, BREAKPOINTS, BUTTON_ICONS, BUTTON_ICON_NAMES, BUTTON_LOOK_KEYS, BUTTON_PLACEMENT_KEYS, BUTTON_SIZES, BUTTON_VARIANTS, type BetterCMSErrorCode, type BgToken, type BindingKind, type BlockBinding, type BlockHoverStyle, type BlockStyle, type BlockType, type ButtonBlock, type ButtonIcon, type ButtonLinkCandidate, type ButtonLookKey, type ButtonProps, type ButtonSizeName, type ButtonValue, type ButtonVariant, COMPONENT_PROP_TYPES, type CanonicalInputDefinition, type CollectionBlock, type CollectionFilter, type CollectionProps, type ColorToken, type ColumnsBlock, type ColumnsProps, type Component, type ComponentBlock, type ComponentCategory, type ComponentFormPropRef, type ComponentPropDef, type ComponentPropType, type ComponentPropUi, type ComponentProps, type ComponentSubField, type ComponentVariantGroup, type Content, type ContentBlock, type ContentEntry, type ContentModel, type ContentModelField, type ContentModelFieldType, type ContentModelFieldUi, type ContentPageResult, type ContentResponse, type ContentWidthToken, type CornerToken, DIALOG_SELECTOR, DOCK_BUDGET, DOCK_ICON_NAMES, DOCK_ICON_NAME_SET, type DeepReadonly, type DeliveredLayout, type DeliveryComponent, type DeliveryEntry, type DeliveryEntrySeo, type DeliveryList, type DeliveryPage, type DerivedLocator, type DockBudget, type DockFieldLike, type DockFieldsetLike, type DockIconName, type DockInputRef, type DockLane, type DockNode, type DockPropGroupLike, type DockScreen, type ElementLike, type ExpandedBinding, FIELD_SIZE_ZOOM, FIELD_STYLE_KEYS, FOOTER_SECTION_ID, type FieldConfig, type FieldSize, type FieldStyle, type FieldStyleKey, type FieldStyles, type Fieldset, type FieldsetKind, type FieldsetUiBefore, type FontSizeToken, type FooterBlock, type FooterColumn, type FooterProps, type Form, type FormBlock, type FormField, type FormProps, type FormSubmission, type HeadingBlock, type HeadingProps, type ImageBlock, type ImageProps, LANDMARK_SELECTOR, LAYOUT_SECTION_ICONS, LAYOUT_SECTION_ICON_SET, LINK_RELS, type LandmarkChainElement, type LandmarkElement, type LayoutComponentItem, type LayoutDataDocument, type LayoutFieldDefinition, type LayoutFieldItem, type LayoutFieldType, type LayoutScalarFieldType, type LayoutSection, type LayoutSectionIcon, type LayoutSectionItem, type LayoutStructureDocument, type LayoutZone, type LinkRel, type LocatorGrammar, MAIN_SELECTOR, type ManagementLayoutCommand, type MediaAsset, type MediaCaptionTrack, type MediaFieldValue, NAVIGATION_SECTION_ID, type NavLink, type NavbarBlock, type NavbarProps, PAGE_CONTENT_ANCHOR_ID, type Page, type PageLayoutOverrideDataDocument, type PageLayoutOverrideDocument, type PageLayoutOverrideState, type PageLayoutOverrideStructureDocument, type PageLayoutSectionOverride, type PageLayoutSectionStructureOverride, type PageMetaJson, type PageOnlyLayoutSection, type PageSectionPlacement, type PaginatedResult, type Perspective, type PortableTextDocument, type PortableTextNode, type PropGroup, RESPONSIVE_CSS, type RadiusToken, type ReadButtonValue, type Redirect, type ReservedLayoutSection, type ResolvedLayoutNode, type RichTextBlock, type RichTextProps, SECTION_DOCTRINE, SECTION_SPACE_TOKENS, SLOT_ITEMS_CAP, SLOT_MAX_ITEMS, SPACE_BOTTOM_TOKENS, SPACE_STEP_TOKENS, type SectionBlock, type SectionProps, type SectionSpaceToken, type ShadowToken, type ShowIf, type ShowIfRule, type SignInInput, type SignUpInput, type SiteSeoDefaults, type SlideItem, type SliderBlock, type SliderProps, type SlotItem, type SlotValue, type SpaceStepToken, type SpaceToken, type SpacerBlock, type SpacerProps, type TabItem, type TabsBlock, type TabsProps, type TextBlock, type TextProps, type ThemeToken, type UiBefore, type UiOrigin, type VariantInputMapping, type VideoBlock, type VideoProps, type VisibilityWindow, type WeightToken, type WindowState, type Workspace, type ZoneField, anchorTargetRel, blockStyleToColumnCss, blockStyleToCss, blockStyleToInnerCss, buttonBlockProps, buttonIconOf, buttonIconSvg, buttonLinkPairs, buttonValueOfInstance, buttonValueProblem, buttonVariantOf, candidateRole, componentInstanceAddresses, componentPropTargetKey, derivedPairs, dockBudget, dockScreens, expandBlockBindings, fieldStyleCssText, fieldStyleToCss, formatPropsAttribute, getBlockType, headingPaintCss, hideOnAttr, inWindow, isBlock, isChromeLandmark, keyWords, landmarkRegions, locatorFor, normalizeWindow, parsePropsAttribute, pickFieldStyle, readButtonValue, readPath, regionOf, safeCssUrl, slotItems, spaceTokenCss, splitButtonStyle, usesHideOn, visibleBlocks, visibleDeliveredLayout, visibleLayoutStructure, windowState, withButtonLookProps };
|
package/dist/index.js
CHANGED
|
@@ -377,7 +377,8 @@ function splitButtonStyle(style) {
|
|
|
377
377
|
paint: Object.keys(paint).length ? paint : void 0
|
|
378
378
|
};
|
|
379
379
|
}
|
|
380
|
-
var FIELD_STYLE_KEYS = ["contentWidth", "contentAlign", "marginTop", "marginBottom", "align", "fontSize", "weight"];
|
|
380
|
+
var FIELD_STYLE_KEYS = ["contentWidth", "contentAlign", "marginTop", "marginBottom", "align", "fontSize", "weight", "size"];
|
|
381
|
+
var FIELD_SIZE_ZOOM = { sm: "0.875", lg: "1.125" };
|
|
381
382
|
var FIELD_KEY_SET = new Set(FIELD_STYLE_KEYS);
|
|
382
383
|
function pickFieldStyle(style) {
|
|
383
384
|
const out = {};
|
|
@@ -389,6 +390,8 @@ function fieldStyleToCss(style) {
|
|
|
389
390
|
const picked = pickFieldStyle(style);
|
|
390
391
|
const css = { ...blockStyleToCss(picked) };
|
|
391
392
|
Object.assign(css, blockStyleToColumnCss(picked));
|
|
393
|
+
const zoom = own(FIELD_SIZE_ZOOM, picked.size);
|
|
394
|
+
if (zoom) css.zoom = zoom;
|
|
392
395
|
return Object.keys(css).length ? css : void 0;
|
|
393
396
|
}
|
|
394
397
|
function blockStyleToColumnCss(style) {
|
|
@@ -3103,6 +3106,7 @@ export {
|
|
|
3103
3106
|
DOCK_BUDGET,
|
|
3104
3107
|
DOCK_ICON_NAMES,
|
|
3105
3108
|
DOCK_ICON_NAME_SET,
|
|
3109
|
+
FIELD_SIZE_ZOOM,
|
|
3106
3110
|
FIELD_STYLE_KEYS,
|
|
3107
3111
|
FOOTER_SECTION_ID,
|
|
3108
3112
|
LANDMARK_SELECTOR,
|