@roottale/cms-core 0.60.0 → 0.61.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/index.d.cts CHANGED
@@ -576,4 +576,23 @@ declare function sitePatternPresentationAttributes(presentation: SitePatternPres
576
576
  readonly cssVariables: Readonly<Record<string, string>>;
577
577
  };
578
578
 
579
- export { BLOCK_NAME_PATTERN, type BindingResolver, type Block, type BlockBinding, type BlockDefinition, type BlockRegistry, type CategoryTreeEntry, type CategoryTreePresentation, type CategoryTreeTerm, type ClientHydrationSpec, DEFAULT_SITE_PATTERN_PRESENTATION, EMPTY_SITE_PATTERN_PLACEMENTS, type EmbedProvider, FIELD_BINDING_SOURCE, FIELD_BINDING_SOURCE_ALIAS, type FaqEntry, IMAGE_ALT_MAX_LENGTH, INTERNAL_CONTENT_LINK_CLASS, INTERNAL_CONTENT_LINK_PENDING_ATTR, INTERNAL_CONTENT_LINK_PENDING_CLASS, INTERNAL_CONTENT_LINK_TOKEN_SOURCE, type InternalContentLinkResolver, type InternalContentLinkToken, LEGACY_BLOG_DETAIL_PATH, type NormalizedEmbed, PHASE_1_CORE_BLOCKS, PHASE_1_CSP, POST_FOOTER_SLOT, type PatternSlots, type Phase1CoreBlockName, type PreviewTokenPayload, type PublicPathContext, type PublicPathPost, type PublicPathPresentation, type RoutablePost, type RouteCollection, SITE_PATTERN_BUTTON_COLORS_MAX, SITE_PATTERN_KEY_PATTERN, SITE_PATTERN_PLACEMENTS_KEY, SITE_PATTERN_SLOTS, type SitePatternLayout, type SitePatternLinkStyle, type SitePatternPlacementRule, type SitePatternPlacements, type SitePatternPresentation, type SitePatternSlotKey, applyBlockBindings, bindingSrcValue, bindingTextValue, blockSchema, boundFieldValue, chainResolvers, createFieldBindingResolver, emptyPatternSlots, ensureImportedHtmlDocumentRoots, ensureStableIds, extractFaqEntries, faqPageJsonLd, findInternalContentLinkTokens, findSitePatternPlacementRule, htmlToPlainText, injectStableIdsTree, internalContentKeyFromPath, internalContentLinkResolverFrom, internalContentPathIndex, isAllowedEmbedSrc, isAllowedMapEmbedSrc, isInCollectionMode, isSitePatternSlotKey, isValidBlock, isValidSitePatternKey, issuePreviewToken, normalizeEmbed, normalizeHexColor, normalizeImageAlt, parseBlock, postsForCollection, postsInAnyCollection, postsNotInAnyCollection, readSitePatternPlacements, readSitePatternPresentation, referencedSitePatternKeys, renderInternalContentLinksInHtml, renderInternalContentLinksInText, resolveCategoryPath, resolveCategoryTreeChain, resolveCategoryTreeEntryPath, resolveCategoryTreeHubPaths, resolvePatternSlots, resolvePostCategorySlug, resolvePostCollection, resolvePostPath, resolvePostPublicPath, resolvePostUrl, sanitizeHtml, sanitizeImportedCss, sanitizeImportedHtml, scopeImportedCss, serializeBlock, setSitePatternPlacementRule, sitePatternButtonColor, sitePatternPresentationAttributes, validateCollections, verifyPreviewToken };
579
+ /** 편집기와 공개 렌더러가 공유하는 허용 서식. 기본값은 사이트 CSS를 따른다. */
580
+ declare const CMS_FONT_SIZES: readonly [14, 16, 18, 20, 24, 28, 32];
581
+ declare const CMS_LINE_HEIGHTS: readonly [1.2, 1.5, 1.8, 2, 2.4];
582
+ declare const CMS_PARAGRAPH_SPACINGS: readonly [0, 8, 16, 24, 32];
583
+ declare const CMS_IMAGE_WIDTHS: readonly [25, 50, 75, 100];
584
+ declare function cmsFontSize(value: unknown): string | null;
585
+ declare function cmsLineHeight(value: unknown): number | null;
586
+ declare function cmsParagraphSpacing(value: unknown): string | null;
587
+ declare function cmsImageWidth(value: unknown): string | null;
588
+ declare function cmsImageAlign(value: unknown): "left" | "center" | "right" | null;
589
+ declare function cmsImageStyle(attrs: Record<string, unknown>): {
590
+ display?: string | undefined;
591
+ marginLeft?: string | undefined;
592
+ marginRight?: string | undefined;
593
+ width?: string | undefined;
594
+ maxWidth?: string | undefined;
595
+ height?: string | undefined;
596
+ };
597
+
598
+ export { BLOCK_NAME_PATTERN, type BindingResolver, type Block, type BlockBinding, type BlockDefinition, type BlockRegistry, CMS_FONT_SIZES, CMS_IMAGE_WIDTHS, CMS_LINE_HEIGHTS, CMS_PARAGRAPH_SPACINGS, type CategoryTreeEntry, type CategoryTreePresentation, type CategoryTreeTerm, type ClientHydrationSpec, DEFAULT_SITE_PATTERN_PRESENTATION, EMPTY_SITE_PATTERN_PLACEMENTS, type EmbedProvider, FIELD_BINDING_SOURCE, FIELD_BINDING_SOURCE_ALIAS, type FaqEntry, IMAGE_ALT_MAX_LENGTH, INTERNAL_CONTENT_LINK_CLASS, INTERNAL_CONTENT_LINK_PENDING_ATTR, INTERNAL_CONTENT_LINK_PENDING_CLASS, INTERNAL_CONTENT_LINK_TOKEN_SOURCE, type InternalContentLinkResolver, type InternalContentLinkToken, LEGACY_BLOG_DETAIL_PATH, type NormalizedEmbed, PHASE_1_CORE_BLOCKS, PHASE_1_CSP, POST_FOOTER_SLOT, type PatternSlots, type Phase1CoreBlockName, type PreviewTokenPayload, type PublicPathContext, type PublicPathPost, type PublicPathPresentation, type RoutablePost, type RouteCollection, SITE_PATTERN_BUTTON_COLORS_MAX, SITE_PATTERN_KEY_PATTERN, SITE_PATTERN_PLACEMENTS_KEY, SITE_PATTERN_SLOTS, type SitePatternLayout, type SitePatternLinkStyle, type SitePatternPlacementRule, type SitePatternPlacements, type SitePatternPresentation, type SitePatternSlotKey, applyBlockBindings, bindingSrcValue, bindingTextValue, blockSchema, boundFieldValue, chainResolvers, cmsFontSize, cmsImageAlign, cmsImageStyle, cmsImageWidth, cmsLineHeight, cmsParagraphSpacing, createFieldBindingResolver, emptyPatternSlots, ensureImportedHtmlDocumentRoots, ensureStableIds, extractFaqEntries, faqPageJsonLd, findInternalContentLinkTokens, findSitePatternPlacementRule, htmlToPlainText, injectStableIdsTree, internalContentKeyFromPath, internalContentLinkResolverFrom, internalContentPathIndex, isAllowedEmbedSrc, isAllowedMapEmbedSrc, isInCollectionMode, isSitePatternSlotKey, isValidBlock, isValidSitePatternKey, issuePreviewToken, normalizeEmbed, normalizeHexColor, normalizeImageAlt, parseBlock, postsForCollection, postsInAnyCollection, postsNotInAnyCollection, readSitePatternPlacements, readSitePatternPresentation, referencedSitePatternKeys, renderInternalContentLinksInHtml, renderInternalContentLinksInText, resolveCategoryPath, resolveCategoryTreeChain, resolveCategoryTreeEntryPath, resolveCategoryTreeHubPaths, resolvePatternSlots, resolvePostCategorySlug, resolvePostCollection, resolvePostPath, resolvePostPublicPath, resolvePostUrl, sanitizeHtml, sanitizeImportedCss, sanitizeImportedHtml, scopeImportedCss, serializeBlock, setSitePatternPlacementRule, sitePatternButtonColor, sitePatternPresentationAttributes, validateCollections, verifyPreviewToken };
package/dist/index.d.ts CHANGED
@@ -576,4 +576,23 @@ declare function sitePatternPresentationAttributes(presentation: SitePatternPres
576
576
  readonly cssVariables: Readonly<Record<string, string>>;
577
577
  };
578
578
 
579
- export { BLOCK_NAME_PATTERN, type BindingResolver, type Block, type BlockBinding, type BlockDefinition, type BlockRegistry, type CategoryTreeEntry, type CategoryTreePresentation, type CategoryTreeTerm, type ClientHydrationSpec, DEFAULT_SITE_PATTERN_PRESENTATION, EMPTY_SITE_PATTERN_PLACEMENTS, type EmbedProvider, FIELD_BINDING_SOURCE, FIELD_BINDING_SOURCE_ALIAS, type FaqEntry, IMAGE_ALT_MAX_LENGTH, INTERNAL_CONTENT_LINK_CLASS, INTERNAL_CONTENT_LINK_PENDING_ATTR, INTERNAL_CONTENT_LINK_PENDING_CLASS, INTERNAL_CONTENT_LINK_TOKEN_SOURCE, type InternalContentLinkResolver, type InternalContentLinkToken, LEGACY_BLOG_DETAIL_PATH, type NormalizedEmbed, PHASE_1_CORE_BLOCKS, PHASE_1_CSP, POST_FOOTER_SLOT, type PatternSlots, type Phase1CoreBlockName, type PreviewTokenPayload, type PublicPathContext, type PublicPathPost, type PublicPathPresentation, type RoutablePost, type RouteCollection, SITE_PATTERN_BUTTON_COLORS_MAX, SITE_PATTERN_KEY_PATTERN, SITE_PATTERN_PLACEMENTS_KEY, SITE_PATTERN_SLOTS, type SitePatternLayout, type SitePatternLinkStyle, type SitePatternPlacementRule, type SitePatternPlacements, type SitePatternPresentation, type SitePatternSlotKey, applyBlockBindings, bindingSrcValue, bindingTextValue, blockSchema, boundFieldValue, chainResolvers, createFieldBindingResolver, emptyPatternSlots, ensureImportedHtmlDocumentRoots, ensureStableIds, extractFaqEntries, faqPageJsonLd, findInternalContentLinkTokens, findSitePatternPlacementRule, htmlToPlainText, injectStableIdsTree, internalContentKeyFromPath, internalContentLinkResolverFrom, internalContentPathIndex, isAllowedEmbedSrc, isAllowedMapEmbedSrc, isInCollectionMode, isSitePatternSlotKey, isValidBlock, isValidSitePatternKey, issuePreviewToken, normalizeEmbed, normalizeHexColor, normalizeImageAlt, parseBlock, postsForCollection, postsInAnyCollection, postsNotInAnyCollection, readSitePatternPlacements, readSitePatternPresentation, referencedSitePatternKeys, renderInternalContentLinksInHtml, renderInternalContentLinksInText, resolveCategoryPath, resolveCategoryTreeChain, resolveCategoryTreeEntryPath, resolveCategoryTreeHubPaths, resolvePatternSlots, resolvePostCategorySlug, resolvePostCollection, resolvePostPath, resolvePostPublicPath, resolvePostUrl, sanitizeHtml, sanitizeImportedCss, sanitizeImportedHtml, scopeImportedCss, serializeBlock, setSitePatternPlacementRule, sitePatternButtonColor, sitePatternPresentationAttributes, validateCollections, verifyPreviewToken };
579
+ /** 편집기와 공개 렌더러가 공유하는 허용 서식. 기본값은 사이트 CSS를 따른다. */
580
+ declare const CMS_FONT_SIZES: readonly [14, 16, 18, 20, 24, 28, 32];
581
+ declare const CMS_LINE_HEIGHTS: readonly [1.2, 1.5, 1.8, 2, 2.4];
582
+ declare const CMS_PARAGRAPH_SPACINGS: readonly [0, 8, 16, 24, 32];
583
+ declare const CMS_IMAGE_WIDTHS: readonly [25, 50, 75, 100];
584
+ declare function cmsFontSize(value: unknown): string | null;
585
+ declare function cmsLineHeight(value: unknown): number | null;
586
+ declare function cmsParagraphSpacing(value: unknown): string | null;
587
+ declare function cmsImageWidth(value: unknown): string | null;
588
+ declare function cmsImageAlign(value: unknown): "left" | "center" | "right" | null;
589
+ declare function cmsImageStyle(attrs: Record<string, unknown>): {
590
+ display?: string | undefined;
591
+ marginLeft?: string | undefined;
592
+ marginRight?: string | undefined;
593
+ width?: string | undefined;
594
+ maxWidth?: string | undefined;
595
+ height?: string | undefined;
596
+ };
597
+
598
+ export { BLOCK_NAME_PATTERN, type BindingResolver, type Block, type BlockBinding, type BlockDefinition, type BlockRegistry, CMS_FONT_SIZES, CMS_IMAGE_WIDTHS, CMS_LINE_HEIGHTS, CMS_PARAGRAPH_SPACINGS, type CategoryTreeEntry, type CategoryTreePresentation, type CategoryTreeTerm, type ClientHydrationSpec, DEFAULT_SITE_PATTERN_PRESENTATION, EMPTY_SITE_PATTERN_PLACEMENTS, type EmbedProvider, FIELD_BINDING_SOURCE, FIELD_BINDING_SOURCE_ALIAS, type FaqEntry, IMAGE_ALT_MAX_LENGTH, INTERNAL_CONTENT_LINK_CLASS, INTERNAL_CONTENT_LINK_PENDING_ATTR, INTERNAL_CONTENT_LINK_PENDING_CLASS, INTERNAL_CONTENT_LINK_TOKEN_SOURCE, type InternalContentLinkResolver, type InternalContentLinkToken, LEGACY_BLOG_DETAIL_PATH, type NormalizedEmbed, PHASE_1_CORE_BLOCKS, PHASE_1_CSP, POST_FOOTER_SLOT, type PatternSlots, type Phase1CoreBlockName, type PreviewTokenPayload, type PublicPathContext, type PublicPathPost, type PublicPathPresentation, type RoutablePost, type RouteCollection, SITE_PATTERN_BUTTON_COLORS_MAX, SITE_PATTERN_KEY_PATTERN, SITE_PATTERN_PLACEMENTS_KEY, SITE_PATTERN_SLOTS, type SitePatternLayout, type SitePatternLinkStyle, type SitePatternPlacementRule, type SitePatternPlacements, type SitePatternPresentation, type SitePatternSlotKey, applyBlockBindings, bindingSrcValue, bindingTextValue, blockSchema, boundFieldValue, chainResolvers, cmsFontSize, cmsImageAlign, cmsImageStyle, cmsImageWidth, cmsLineHeight, cmsParagraphSpacing, createFieldBindingResolver, emptyPatternSlots, ensureImportedHtmlDocumentRoots, ensureStableIds, extractFaqEntries, faqPageJsonLd, findInternalContentLinkTokens, findSitePatternPlacementRule, htmlToPlainText, injectStableIdsTree, internalContentKeyFromPath, internalContentLinkResolverFrom, internalContentPathIndex, isAllowedEmbedSrc, isAllowedMapEmbedSrc, isInCollectionMode, isSitePatternSlotKey, isValidBlock, isValidSitePatternKey, issuePreviewToken, normalizeEmbed, normalizeHexColor, normalizeImageAlt, parseBlock, postsForCollection, postsInAnyCollection, postsNotInAnyCollection, readSitePatternPlacements, readSitePatternPresentation, referencedSitePatternKeys, renderInternalContentLinksInHtml, renderInternalContentLinksInText, resolveCategoryPath, resolveCategoryTreeChain, resolveCategoryTreeEntryPath, resolveCategoryTreeHubPaths, resolvePatternSlots, resolvePostCategorySlug, resolvePostCollection, resolvePostPath, resolvePostPublicPath, resolvePostUrl, sanitizeHtml, sanitizeImportedCss, sanitizeImportedHtml, scopeImportedCss, serializeBlock, setSitePatternPlacementRule, sitePatternButtonColor, sitePatternPresentationAttributes, validateCollections, verifyPreviewToken };
package/dist/index.js CHANGED
@@ -1553,8 +1553,49 @@ function sitePatternPresentationAttributes(presentation) {
1553
1553
  cssVariables
1554
1554
  };
1555
1555
  }
1556
+
1557
+ // src/editor-formatting.ts
1558
+ var CMS_FONT_SIZES = [14, 16, 18, 20, 24, 28, 32];
1559
+ var CMS_LINE_HEIGHTS = [1.2, 1.5, 1.8, 2, 2.4];
1560
+ var CMS_PARAGRAPH_SPACINGS = [0, 8, 16, 24, 32];
1561
+ var CMS_IMAGE_WIDTHS = [25, 50, 75, 100];
1562
+ function cmsFontSize(value) {
1563
+ if (typeof value !== "string") return null;
1564
+ return CMS_FONT_SIZES.some((size) => value === `${size}px`) ? value : null;
1565
+ }
1566
+ function cmsLineHeight(value) {
1567
+ if (typeof value !== "number" && typeof value !== "string") return null;
1568
+ return CMS_LINE_HEIGHTS.find((size) => String(size) === String(value)) ?? null;
1569
+ }
1570
+ function cmsParagraphSpacing(value) {
1571
+ if (typeof value !== "string") return null;
1572
+ return CMS_PARAGRAPH_SPACINGS.some((size) => value === `${size}px`) ? value : null;
1573
+ }
1574
+ function cmsImageWidth(value) {
1575
+ if (typeof value !== "string") return null;
1576
+ return CMS_IMAGE_WIDTHS.some((size) => value === `${size}%`) ? value : null;
1577
+ }
1578
+ function cmsImageAlign(value) {
1579
+ return value === "left" || value === "center" || value === "right" ? value : null;
1580
+ }
1581
+ function cmsImageStyle(attrs) {
1582
+ const width = cmsImageWidth(attrs.displayWidth);
1583
+ const align = cmsImageAlign(attrs.imageAlign);
1584
+ return {
1585
+ ...width ? { width, maxWidth: "100%", height: "auto" } : {},
1586
+ ...align ? {
1587
+ display: "block",
1588
+ marginLeft: align === "left" ? "0" : "auto",
1589
+ marginRight: align === "right" ? "0" : "auto"
1590
+ } : {}
1591
+ };
1592
+ }
1556
1593
  export {
1557
1594
  BLOCK_NAME_PATTERN,
1595
+ CMS_FONT_SIZES,
1596
+ CMS_IMAGE_WIDTHS,
1597
+ CMS_LINE_HEIGHTS,
1598
+ CMS_PARAGRAPH_SPACINGS,
1558
1599
  DEFAULT_SITE_PATTERN_PRESENTATION,
1559
1600
  EMPTY_SITE_PATTERN_PLACEMENTS,
1560
1601
  FIELD_BINDING_SOURCE,
@@ -1578,6 +1619,12 @@ export {
1578
1619
  blockSchema,
1579
1620
  boundFieldValue,
1580
1621
  chainResolvers,
1622
+ cmsFontSize,
1623
+ cmsImageAlign,
1624
+ cmsImageStyle,
1625
+ cmsImageWidth,
1626
+ cmsLineHeight,
1627
+ cmsParagraphSpacing,
1581
1628
  createFieldBindingResolver,
1582
1629
  emptyPatternSlots,
1583
1630
  ensureImportedHtmlDocumentRoots,