@roottale/cms-core 0.56.0 → 0.58.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/CHANGELOG.md +40 -0
- package/dist/index.cjs +348 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +153 -1
- package/dist/index.d.ts +153 -1
- package/dist/index.js +319 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -382,6 +382,58 @@ declare function ensureImportedHtmlDocumentRoots(html: string, allowedAssetUrls?
|
|
|
382
382
|
/** 저장된 안전 CSS가 같은 importedHtml 블록 밖으로 새지 않도록 범위를 고정한다. */
|
|
383
383
|
declare function scopeImportedCss(css: string, scope: string, allowedAssetUrls?: readonly string[]): string;
|
|
384
384
|
|
|
385
|
+
declare const INTERNAL_CONTENT_LINK_TOKEN_SOURCE: string;
|
|
386
|
+
interface InternalContentLinkToken {
|
|
387
|
+
/** 토큰이 시작하는 문자 인덱스(텍스트 기준). */
|
|
388
|
+
readonly index: number;
|
|
389
|
+
/** 원문 토큰 전체(`[[internal:…|…]]`). */
|
|
390
|
+
readonly raw: string;
|
|
391
|
+
/** 소문자로 정규화한 키. */
|
|
392
|
+
readonly key: string;
|
|
393
|
+
/** 표시 문구(앞뒤 공백 제거). */
|
|
394
|
+
readonly label: string;
|
|
395
|
+
}
|
|
396
|
+
/** 텍스트 안의 토큰을 앞에서부터 모두 찾는다. 겹치지 않는다. */
|
|
397
|
+
declare function findInternalContentLinkTokens(text: string): InternalContentLinkToken[];
|
|
398
|
+
/** 공개 경로(`/faq/a/b/slug`) → 키(`faq.a.b.slug`). 조각이 없으면 null. */
|
|
399
|
+
declare function internalContentKeyFromPath(path: string | null | undefined): string | null;
|
|
400
|
+
/** 키 → 공개 경로. 없으면 null(문구만 표시). */
|
|
401
|
+
type InternalContentLinkResolver = (key: string) => string | null;
|
|
402
|
+
interface InternalContentPathEntry {
|
|
403
|
+
/** 저장된 정규 공개 경로(`/faq/a/b/slug`). 없으면 대상이 아니다. */
|
|
404
|
+
readonly path?: string | null;
|
|
405
|
+
/** 옛 slug 목록 — 옛 키로 남은 본문도 현재 주소로 이어 준다. */
|
|
406
|
+
readonly previousSlugs?: readonly string[] | null;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* 발행 글 목록에서 "키 → 현재 경로" 색인을 만든다. 옛 slug 도 같은 글로 등록한다
|
|
410
|
+
* (경로 마지막 조각을 옛 slug 로 바꾼 키). 현재 경로가 옛 키와 겹치면 현재가 이긴다.
|
|
411
|
+
*/
|
|
412
|
+
declare function internalContentPathIndex(entries: Iterable<InternalContentPathEntry>): Map<string, string>;
|
|
413
|
+
/** Map 이나 함수 어느 쪽이든 resolver 로. */
|
|
414
|
+
declare function internalContentLinkResolverFrom(source: InternalContentLinkResolver | ReadonlyMap<string, string> | null | undefined): InternalContentLinkResolver;
|
|
415
|
+
/** 링크로 렌더된 토큰의 class — 사이트 CSS 가 잡을 고리. */
|
|
416
|
+
declare const INTERNAL_CONTENT_LINK_CLASS = "rt-internal-link";
|
|
417
|
+
/** 대상이 아직 없어 문구만 남긴 토큰의 class·data 속성. */
|
|
418
|
+
declare const INTERNAL_CONTENT_LINK_PENDING_CLASS = "rt-internal-link--pending";
|
|
419
|
+
declare const INTERNAL_CONTENT_LINK_PENDING_ATTR = "data-rt-internal-link-pending";
|
|
420
|
+
/**
|
|
421
|
+
* 이미 이스케이프된 텍스트 한 구간의 토큰을 HTML 로 바꾼다. 텍스트 부분은 다시
|
|
422
|
+
* 이스케이프하지 않는다(정화기가 이미 처리한 값). 토큰이 없으면 원문 그대로.
|
|
423
|
+
*/
|
|
424
|
+
declare function renderInternalContentLinksInText(text: string, resolve: InternalContentLinkResolver): {
|
|
425
|
+
readonly html: string;
|
|
426
|
+
readonly hasTokens: boolean;
|
|
427
|
+
};
|
|
428
|
+
/**
|
|
429
|
+
* 정화된 HTML(원문 보존 블록 등)의 텍스트 구간에만 토큰을 적용한다. `<a>`·`<code>`·
|
|
430
|
+
* `<pre>` 안과 태그 속성값은 건드리지 않는다.
|
|
431
|
+
*/
|
|
432
|
+
declare function renderInternalContentLinksInHtml(html: string, resolve: InternalContentLinkResolver): {
|
|
433
|
+
readonly html: string;
|
|
434
|
+
readonly hasTokens: boolean;
|
|
435
|
+
};
|
|
436
|
+
|
|
385
437
|
interface PreviewTokenPayload {
|
|
386
438
|
postId: string;
|
|
387
439
|
expiresAt: Date;
|
|
@@ -419,4 +471,104 @@ declare function injectStableIdsTree(blocks: readonly (Omit<Block, "_id"> & {
|
|
|
419
471
|
_id?: string;
|
|
420
472
|
})[]): Block[];
|
|
421
473
|
|
|
422
|
-
|
|
474
|
+
/**
|
|
475
|
+
* 공통 블록(Site Patterns) — 여러 글에 같은 자리로 붙는 재사용 블록의 순수 규칙.
|
|
476
|
+
*
|
|
477
|
+
* 블록 본문은 ROOT-ADMIN 이 `site_patterns` 에 저장하고, "어느 자리(slot)에 어느
|
|
478
|
+
* 유형(collection)의 글이면 어떤 블록"인지는 배치 규칙(`settings.site_pattern_placements`)
|
|
479
|
+
* 으로 정한다. 공개 API 는 글마다 `pattern_slots`(자리 → 블록 key | null) 를 계산해
|
|
480
|
+
* 내려주므로 FRONT 는 규칙을 몰라도 된다. 이 파일은 api-core(계산)·tenant-admin(편집)·
|
|
481
|
+
* cms-renderer-next(렌더)가 같은 판정을 공유하기 위한 프레임워크 비의존 모듈이다.
|
|
482
|
+
*
|
|
483
|
+
* 규칙 판정:
|
|
484
|
+
* - 자리는 `SITE_PATTERN_SLOTS` 에 선언된 것만 계산한다(미선언 자리는 무시).
|
|
485
|
+
* - 글의 `collectionKey` 와 같은 규칙이 있으면 그 규칙(블록 없음 = null 도 명시적 결정).
|
|
486
|
+
* - 없으면 `collectionKey: null`(모든 글 기본) 규칙.
|
|
487
|
+
* - 가리키는 블록이 발행 상태가 아니면 null(FRONT 가 미발행 블록을 그리지 않게).
|
|
488
|
+
*/
|
|
489
|
+
/** 블록을 놓을 수 있는 자리. key 는 공개 API `pattern_slots` 의 키와 같다. */
|
|
490
|
+
declare const SITE_PATTERN_SLOTS: readonly [{
|
|
491
|
+
readonly key: "post_footer";
|
|
492
|
+
readonly label: "글 하단";
|
|
493
|
+
readonly description: "글 본문 바로 아래";
|
|
494
|
+
}];
|
|
495
|
+
type SitePatternSlotKey = (typeof SITE_PATTERN_SLOTS)[number]["key"];
|
|
496
|
+
declare const POST_FOOTER_SLOT: SitePatternSlotKey;
|
|
497
|
+
/** 배치 규칙을 담는 `settings` 키. */
|
|
498
|
+
declare const SITE_PATTERN_PLACEMENTS_KEY = "site_pattern_placements";
|
|
499
|
+
/** 블록 key 형식 — 소문자·숫자·`-`·`_`, 64자 이하, 영숫자로 시작. */
|
|
500
|
+
declare const SITE_PATTERN_KEY_PATTERN: RegExp;
|
|
501
|
+
declare function isValidSitePatternKey(key: string): boolean;
|
|
502
|
+
declare function isSitePatternSlotKey(value: string): value is SitePatternSlotKey;
|
|
503
|
+
/**
|
|
504
|
+
* 배치 규칙 1건. `collectionKey: null` = 모든 글의 기본값, 문자열 = 그 유형의 글만.
|
|
505
|
+
* `patternKey: null` = 이 자리에 블록을 놓지 않는다(유형 규칙이면 기본값 덮어쓰기).
|
|
506
|
+
*/
|
|
507
|
+
interface SitePatternPlacementRule {
|
|
508
|
+
readonly slot: SitePatternSlotKey;
|
|
509
|
+
readonly collectionKey: string | null;
|
|
510
|
+
readonly patternKey: string | null;
|
|
511
|
+
}
|
|
512
|
+
interface SitePatternPlacements {
|
|
513
|
+
readonly rules: readonly SitePatternPlacementRule[];
|
|
514
|
+
}
|
|
515
|
+
declare const EMPTY_SITE_PATTERN_PLACEMENTS: SitePatternPlacements;
|
|
516
|
+
/** 글 1건의 자리별 블록 key. 선언된 모든 자리를 키로 가진다(없으면 null). */
|
|
517
|
+
type PatternSlots = Record<string, string | null>;
|
|
518
|
+
/**
|
|
519
|
+
* 저장된 값(unknown) → 정규화된 배치 규칙. 형식이 틀린 항목·미선언 자리는 버리고,
|
|
520
|
+
* 같은 (slot, collectionKey) 는 마지막 항목이 이긴다. 이중 인코딩된 JSON 문자열도 받는다.
|
|
521
|
+
*/
|
|
522
|
+
declare function readSitePatternPlacements(raw: unknown): SitePatternPlacements;
|
|
523
|
+
/** (slot, collectionKey) 에 해당하는 규칙. 없으면 undefined(= 기본값으로 위임). */
|
|
524
|
+
declare function findSitePatternPlacementRule(placements: SitePatternPlacements, slot: SitePatternSlotKey, collectionKey: string | null): SitePatternPlacementRule | undefined;
|
|
525
|
+
/**
|
|
526
|
+
* 규칙 1건을 갈아 끼운 새 배치 규칙을 돌려준다(불변). `patternKey: undefined` 는
|
|
527
|
+
* "규칙 삭제 = 기본값으로 위임"이다 — 유형 규칙에서 "표시 안 함"(null)과 구분된다.
|
|
528
|
+
*/
|
|
529
|
+
declare function setSitePatternPlacementRule(placements: SitePatternPlacements, target: {
|
|
530
|
+
slot: SitePatternSlotKey;
|
|
531
|
+
collectionKey: string | null;
|
|
532
|
+
}, patternKey: string | null | undefined): SitePatternPlacements;
|
|
533
|
+
/** 선언된 자리마다 null 인 빈 결과 — 규칙이나 발행 블록이 없을 때의 기본 응답. */
|
|
534
|
+
declare function emptyPatternSlots(): PatternSlots;
|
|
535
|
+
/**
|
|
536
|
+
* 글 1건의 자리별 블록 key 를 계산한다. `publishedKeys` 에 없는 블록(미발행·삭제)은 null.
|
|
537
|
+
*/
|
|
538
|
+
declare function resolvePatternSlots(post: {
|
|
539
|
+
readonly collectionKey: string | null;
|
|
540
|
+
}, placements: SitePatternPlacements, publishedKeys: ReadonlySet<string>): PatternSlots;
|
|
541
|
+
/**
|
|
542
|
+
* 규칙에서 참조하는 블록 key 집합 — 어드민이 "이 블록은 어디에 쓰이는가"를 표시하거나
|
|
543
|
+
* 삭제 전 경고할 때 쓴다.
|
|
544
|
+
*/
|
|
545
|
+
declare function referencedSitePatternKeys(placements: SitePatternPlacements): ReadonlySet<string>;
|
|
546
|
+
type SitePatternLayout = "plain" | "card";
|
|
547
|
+
type SitePatternLinkStyle = "text" | "buttons";
|
|
548
|
+
interface SitePatternPresentation {
|
|
549
|
+
/** `plain` = 본문처럼 흐름에 놓임, `card` = 배경색이 있는 카드. */
|
|
550
|
+
readonly layout: SitePatternLayout;
|
|
551
|
+
/** 카드 배경색(hex). layout 이 card 일 때만 의미. */
|
|
552
|
+
readonly background: string;
|
|
553
|
+
/** 마지막 문단의 링크를 버튼으로 그릴지. */
|
|
554
|
+
readonly linkStyle: SitePatternLinkStyle;
|
|
555
|
+
/** 버튼 배경색(hex, 순서대로 1·2·3…; 링크가 더 많으면 마지막 색을 반복). 글자는 흰색. */
|
|
556
|
+
readonly buttonColors: readonly string[];
|
|
557
|
+
}
|
|
558
|
+
declare const DEFAULT_SITE_PATTERN_PRESENTATION: SitePatternPresentation;
|
|
559
|
+
declare const SITE_PATTERN_BUTTON_COLORS_MAX = 4;
|
|
560
|
+
declare function normalizeHexColor(value: unknown): string | null;
|
|
561
|
+
/** 저장된 값(unknown) → 표시 형태. 틀린 값은 기본값으로 채운다(절대 throw 하지 않음). */
|
|
562
|
+
declare function readSitePatternPresentation(raw: unknown): SitePatternPresentation;
|
|
563
|
+
/** 버튼 n번째(0부터)의 색 — 링크가 색 개수보다 많으면 마지막 색을 반복. */
|
|
564
|
+
declare function sitePatternButtonColor(presentation: SitePatternPresentation, index: number): string;
|
|
565
|
+
/**
|
|
566
|
+
* FRONT 가 래퍼 요소에 얹을 data 속성과 CSS 변수. 사이트 CSS 는 이 변수만 읽는다 —
|
|
567
|
+
* `data-pattern-layout`·`data-pattern-link-style`, `--rt-pattern-bg`, `--rt-pattern-btn-1..n`.
|
|
568
|
+
*/
|
|
569
|
+
declare function sitePatternPresentationAttributes(presentation: SitePatternPresentation): {
|
|
570
|
+
readonly dataset: Readonly<Record<string, string>>;
|
|
571
|
+
readonly cssVariables: Readonly<Record<string, string>>;
|
|
572
|
+
};
|
|
573
|
+
|
|
574
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -382,6 +382,58 @@ declare function ensureImportedHtmlDocumentRoots(html: string, allowedAssetUrls?
|
|
|
382
382
|
/** 저장된 안전 CSS가 같은 importedHtml 블록 밖으로 새지 않도록 범위를 고정한다. */
|
|
383
383
|
declare function scopeImportedCss(css: string, scope: string, allowedAssetUrls?: readonly string[]): string;
|
|
384
384
|
|
|
385
|
+
declare const INTERNAL_CONTENT_LINK_TOKEN_SOURCE: string;
|
|
386
|
+
interface InternalContentLinkToken {
|
|
387
|
+
/** 토큰이 시작하는 문자 인덱스(텍스트 기준). */
|
|
388
|
+
readonly index: number;
|
|
389
|
+
/** 원문 토큰 전체(`[[internal:…|…]]`). */
|
|
390
|
+
readonly raw: string;
|
|
391
|
+
/** 소문자로 정규화한 키. */
|
|
392
|
+
readonly key: string;
|
|
393
|
+
/** 표시 문구(앞뒤 공백 제거). */
|
|
394
|
+
readonly label: string;
|
|
395
|
+
}
|
|
396
|
+
/** 텍스트 안의 토큰을 앞에서부터 모두 찾는다. 겹치지 않는다. */
|
|
397
|
+
declare function findInternalContentLinkTokens(text: string): InternalContentLinkToken[];
|
|
398
|
+
/** 공개 경로(`/faq/a/b/slug`) → 키(`faq.a.b.slug`). 조각이 없으면 null. */
|
|
399
|
+
declare function internalContentKeyFromPath(path: string | null | undefined): string | null;
|
|
400
|
+
/** 키 → 공개 경로. 없으면 null(문구만 표시). */
|
|
401
|
+
type InternalContentLinkResolver = (key: string) => string | null;
|
|
402
|
+
interface InternalContentPathEntry {
|
|
403
|
+
/** 저장된 정규 공개 경로(`/faq/a/b/slug`). 없으면 대상이 아니다. */
|
|
404
|
+
readonly path?: string | null;
|
|
405
|
+
/** 옛 slug 목록 — 옛 키로 남은 본문도 현재 주소로 이어 준다. */
|
|
406
|
+
readonly previousSlugs?: readonly string[] | null;
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* 발행 글 목록에서 "키 → 현재 경로" 색인을 만든다. 옛 slug 도 같은 글로 등록한다
|
|
410
|
+
* (경로 마지막 조각을 옛 slug 로 바꾼 키). 현재 경로가 옛 키와 겹치면 현재가 이긴다.
|
|
411
|
+
*/
|
|
412
|
+
declare function internalContentPathIndex(entries: Iterable<InternalContentPathEntry>): Map<string, string>;
|
|
413
|
+
/** Map 이나 함수 어느 쪽이든 resolver 로. */
|
|
414
|
+
declare function internalContentLinkResolverFrom(source: InternalContentLinkResolver | ReadonlyMap<string, string> | null | undefined): InternalContentLinkResolver;
|
|
415
|
+
/** 링크로 렌더된 토큰의 class — 사이트 CSS 가 잡을 고리. */
|
|
416
|
+
declare const INTERNAL_CONTENT_LINK_CLASS = "rt-internal-link";
|
|
417
|
+
/** 대상이 아직 없어 문구만 남긴 토큰의 class·data 속성. */
|
|
418
|
+
declare const INTERNAL_CONTENT_LINK_PENDING_CLASS = "rt-internal-link--pending";
|
|
419
|
+
declare const INTERNAL_CONTENT_LINK_PENDING_ATTR = "data-rt-internal-link-pending";
|
|
420
|
+
/**
|
|
421
|
+
* 이미 이스케이프된 텍스트 한 구간의 토큰을 HTML 로 바꾼다. 텍스트 부분은 다시
|
|
422
|
+
* 이스케이프하지 않는다(정화기가 이미 처리한 값). 토큰이 없으면 원문 그대로.
|
|
423
|
+
*/
|
|
424
|
+
declare function renderInternalContentLinksInText(text: string, resolve: InternalContentLinkResolver): {
|
|
425
|
+
readonly html: string;
|
|
426
|
+
readonly hasTokens: boolean;
|
|
427
|
+
};
|
|
428
|
+
/**
|
|
429
|
+
* 정화된 HTML(원문 보존 블록 등)의 텍스트 구간에만 토큰을 적용한다. `<a>`·`<code>`·
|
|
430
|
+
* `<pre>` 안과 태그 속성값은 건드리지 않는다.
|
|
431
|
+
*/
|
|
432
|
+
declare function renderInternalContentLinksInHtml(html: string, resolve: InternalContentLinkResolver): {
|
|
433
|
+
readonly html: string;
|
|
434
|
+
readonly hasTokens: boolean;
|
|
435
|
+
};
|
|
436
|
+
|
|
385
437
|
interface PreviewTokenPayload {
|
|
386
438
|
postId: string;
|
|
387
439
|
expiresAt: Date;
|
|
@@ -419,4 +471,104 @@ declare function injectStableIdsTree(blocks: readonly (Omit<Block, "_id"> & {
|
|
|
419
471
|
_id?: string;
|
|
420
472
|
})[]): Block[];
|
|
421
473
|
|
|
422
|
-
|
|
474
|
+
/**
|
|
475
|
+
* 공통 블록(Site Patterns) — 여러 글에 같은 자리로 붙는 재사용 블록의 순수 규칙.
|
|
476
|
+
*
|
|
477
|
+
* 블록 본문은 ROOT-ADMIN 이 `site_patterns` 에 저장하고, "어느 자리(slot)에 어느
|
|
478
|
+
* 유형(collection)의 글이면 어떤 블록"인지는 배치 규칙(`settings.site_pattern_placements`)
|
|
479
|
+
* 으로 정한다. 공개 API 는 글마다 `pattern_slots`(자리 → 블록 key | null) 를 계산해
|
|
480
|
+
* 내려주므로 FRONT 는 규칙을 몰라도 된다. 이 파일은 api-core(계산)·tenant-admin(편집)·
|
|
481
|
+
* cms-renderer-next(렌더)가 같은 판정을 공유하기 위한 프레임워크 비의존 모듈이다.
|
|
482
|
+
*
|
|
483
|
+
* 규칙 판정:
|
|
484
|
+
* - 자리는 `SITE_PATTERN_SLOTS` 에 선언된 것만 계산한다(미선언 자리는 무시).
|
|
485
|
+
* - 글의 `collectionKey` 와 같은 규칙이 있으면 그 규칙(블록 없음 = null 도 명시적 결정).
|
|
486
|
+
* - 없으면 `collectionKey: null`(모든 글 기본) 규칙.
|
|
487
|
+
* - 가리키는 블록이 발행 상태가 아니면 null(FRONT 가 미발행 블록을 그리지 않게).
|
|
488
|
+
*/
|
|
489
|
+
/** 블록을 놓을 수 있는 자리. key 는 공개 API `pattern_slots` 의 키와 같다. */
|
|
490
|
+
declare const SITE_PATTERN_SLOTS: readonly [{
|
|
491
|
+
readonly key: "post_footer";
|
|
492
|
+
readonly label: "글 하단";
|
|
493
|
+
readonly description: "글 본문 바로 아래";
|
|
494
|
+
}];
|
|
495
|
+
type SitePatternSlotKey = (typeof SITE_PATTERN_SLOTS)[number]["key"];
|
|
496
|
+
declare const POST_FOOTER_SLOT: SitePatternSlotKey;
|
|
497
|
+
/** 배치 규칙을 담는 `settings` 키. */
|
|
498
|
+
declare const SITE_PATTERN_PLACEMENTS_KEY = "site_pattern_placements";
|
|
499
|
+
/** 블록 key 형식 — 소문자·숫자·`-`·`_`, 64자 이하, 영숫자로 시작. */
|
|
500
|
+
declare const SITE_PATTERN_KEY_PATTERN: RegExp;
|
|
501
|
+
declare function isValidSitePatternKey(key: string): boolean;
|
|
502
|
+
declare function isSitePatternSlotKey(value: string): value is SitePatternSlotKey;
|
|
503
|
+
/**
|
|
504
|
+
* 배치 규칙 1건. `collectionKey: null` = 모든 글의 기본값, 문자열 = 그 유형의 글만.
|
|
505
|
+
* `patternKey: null` = 이 자리에 블록을 놓지 않는다(유형 규칙이면 기본값 덮어쓰기).
|
|
506
|
+
*/
|
|
507
|
+
interface SitePatternPlacementRule {
|
|
508
|
+
readonly slot: SitePatternSlotKey;
|
|
509
|
+
readonly collectionKey: string | null;
|
|
510
|
+
readonly patternKey: string | null;
|
|
511
|
+
}
|
|
512
|
+
interface SitePatternPlacements {
|
|
513
|
+
readonly rules: readonly SitePatternPlacementRule[];
|
|
514
|
+
}
|
|
515
|
+
declare const EMPTY_SITE_PATTERN_PLACEMENTS: SitePatternPlacements;
|
|
516
|
+
/** 글 1건의 자리별 블록 key. 선언된 모든 자리를 키로 가진다(없으면 null). */
|
|
517
|
+
type PatternSlots = Record<string, string | null>;
|
|
518
|
+
/**
|
|
519
|
+
* 저장된 값(unknown) → 정규화된 배치 규칙. 형식이 틀린 항목·미선언 자리는 버리고,
|
|
520
|
+
* 같은 (slot, collectionKey) 는 마지막 항목이 이긴다. 이중 인코딩된 JSON 문자열도 받는다.
|
|
521
|
+
*/
|
|
522
|
+
declare function readSitePatternPlacements(raw: unknown): SitePatternPlacements;
|
|
523
|
+
/** (slot, collectionKey) 에 해당하는 규칙. 없으면 undefined(= 기본값으로 위임). */
|
|
524
|
+
declare function findSitePatternPlacementRule(placements: SitePatternPlacements, slot: SitePatternSlotKey, collectionKey: string | null): SitePatternPlacementRule | undefined;
|
|
525
|
+
/**
|
|
526
|
+
* 규칙 1건을 갈아 끼운 새 배치 규칙을 돌려준다(불변). `patternKey: undefined` 는
|
|
527
|
+
* "규칙 삭제 = 기본값으로 위임"이다 — 유형 규칙에서 "표시 안 함"(null)과 구분된다.
|
|
528
|
+
*/
|
|
529
|
+
declare function setSitePatternPlacementRule(placements: SitePatternPlacements, target: {
|
|
530
|
+
slot: SitePatternSlotKey;
|
|
531
|
+
collectionKey: string | null;
|
|
532
|
+
}, patternKey: string | null | undefined): SitePatternPlacements;
|
|
533
|
+
/** 선언된 자리마다 null 인 빈 결과 — 규칙이나 발행 블록이 없을 때의 기본 응답. */
|
|
534
|
+
declare function emptyPatternSlots(): PatternSlots;
|
|
535
|
+
/**
|
|
536
|
+
* 글 1건의 자리별 블록 key 를 계산한다. `publishedKeys` 에 없는 블록(미발행·삭제)은 null.
|
|
537
|
+
*/
|
|
538
|
+
declare function resolvePatternSlots(post: {
|
|
539
|
+
readonly collectionKey: string | null;
|
|
540
|
+
}, placements: SitePatternPlacements, publishedKeys: ReadonlySet<string>): PatternSlots;
|
|
541
|
+
/**
|
|
542
|
+
* 규칙에서 참조하는 블록 key 집합 — 어드민이 "이 블록은 어디에 쓰이는가"를 표시하거나
|
|
543
|
+
* 삭제 전 경고할 때 쓴다.
|
|
544
|
+
*/
|
|
545
|
+
declare function referencedSitePatternKeys(placements: SitePatternPlacements): ReadonlySet<string>;
|
|
546
|
+
type SitePatternLayout = "plain" | "card";
|
|
547
|
+
type SitePatternLinkStyle = "text" | "buttons";
|
|
548
|
+
interface SitePatternPresentation {
|
|
549
|
+
/** `plain` = 본문처럼 흐름에 놓임, `card` = 배경색이 있는 카드. */
|
|
550
|
+
readonly layout: SitePatternLayout;
|
|
551
|
+
/** 카드 배경색(hex). layout 이 card 일 때만 의미. */
|
|
552
|
+
readonly background: string;
|
|
553
|
+
/** 마지막 문단의 링크를 버튼으로 그릴지. */
|
|
554
|
+
readonly linkStyle: SitePatternLinkStyle;
|
|
555
|
+
/** 버튼 배경색(hex, 순서대로 1·2·3…; 링크가 더 많으면 마지막 색을 반복). 글자는 흰색. */
|
|
556
|
+
readonly buttonColors: readonly string[];
|
|
557
|
+
}
|
|
558
|
+
declare const DEFAULT_SITE_PATTERN_PRESENTATION: SitePatternPresentation;
|
|
559
|
+
declare const SITE_PATTERN_BUTTON_COLORS_MAX = 4;
|
|
560
|
+
declare function normalizeHexColor(value: unknown): string | null;
|
|
561
|
+
/** 저장된 값(unknown) → 표시 형태. 틀린 값은 기본값으로 채운다(절대 throw 하지 않음). */
|
|
562
|
+
declare function readSitePatternPresentation(raw: unknown): SitePatternPresentation;
|
|
563
|
+
/** 버튼 n번째(0부터)의 색 — 링크가 색 개수보다 많으면 마지막 색을 반복. */
|
|
564
|
+
declare function sitePatternButtonColor(presentation: SitePatternPresentation, index: number): string;
|
|
565
|
+
/**
|
|
566
|
+
* FRONT 가 래퍼 요소에 얹을 data 속성과 CSS 변수. 사이트 CSS 는 이 변수만 읽는다 —
|
|
567
|
+
* `data-pattern-layout`·`data-pattern-link-style`, `--rt-pattern-bg`, `--rt-pattern-btn-1..n`.
|
|
568
|
+
*/
|
|
569
|
+
declare function sitePatternPresentationAttributes(presentation: SitePatternPresentation): {
|
|
570
|
+
readonly dataset: Readonly<Record<string, string>>;
|
|
571
|
+
readonly cssVariables: Readonly<Record<string, string>>;
|
|
572
|
+
};
|
|
573
|
+
|
|
574
|
+
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 };
|