adyou 0.6.14 → 0.6.15
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.
|
@@ -112,7 +112,8 @@ export const textW = (t, fs) => [...t].reduce((n, ch) => n + (ch === ' ' ? 0.3 :
|
|
|
112
112
|
/** 헤드라인 줄나눔 — 「오늘의 입술, 틴트 한 / 번」·「나에게 맞는 컬러 / 찾기」처럼 넘치는 자리에서 끊겨 한 어절이 떨어지는 것을 막는다(2026-09-17 사장님).
|
|
113
113
|
* 규칙: 한 줄에 들어가면 그대로 · 두 줄이면 모든 어절 경계 후보 중 (① 쉼표·물음표·마침표·가운뎃점 뒤 우선 ② 두 줄 길이 균형 ③ 마지막 줄이 한 어절(≤4wlen)이면 강한 벌점 ④ 두 줄 모두 폭 안) 비용 최소 · 세 줄 이상은 뒤에서부터 채워 마지막 줄 고아를 피한다 */
|
|
114
114
|
export function breakLines(text, fs, maxW, maxLines = 3) {
|
|
115
|
-
|
|
115
|
+
// 쉼표·물음표 뒤에 띄어쓰기가 없으면(「분양정보,몇 개」) 어절이 붙어 엉뚱한 자리에서 나뉜다 → 문장부호 뒤 공백 정규화
|
|
116
|
+
const raw = String(text || '').replace(/([,,、!?!?.])(?=[^\s\d,.!?])/g, '$1 ').trim().split(/\s+/).filter(Boolean);
|
|
116
117
|
// 한 글자 어절(「한」「다」「그」)은 다음 어절과 한 덩어리 — 「틴트 한 / 번」 금지
|
|
117
118
|
const words = [];
|
|
118
119
|
for (let i = 0; i < raw.length; i++) {
|
|
@@ -15,7 +15,7 @@ const LANG_NAME = { ko: 'Korean', en: 'English', ja: 'Japanese', 'zh-TW': 'Tradi
|
|
|
15
15
|
export const langName = (l) => LANG_NAME[l] || LANG_NAME[l.split('-')[0]] || l;
|
|
16
16
|
/** 훅 길이 제한 — 한글·전각 12자(wlen 24) · 라틴은 단어 경계에서 자른다(잘린 단어 금지) */
|
|
17
17
|
export function fitHook(t) {
|
|
18
|
-
const s = t.trim().replace(/\s+/g, ' ');
|
|
18
|
+
const s = t.trim().replace(/([,,、!?!?])(?=[^\s\d,.!?])/g, '$1 ').replace(/\s+/g, ' ');
|
|
19
19
|
if (wlen(s) <= 30)
|
|
20
20
|
return s;
|
|
21
21
|
// 🔴 한글도 어절 경계에서 — 글자 단위로 자르면 「현대건설이 짓는, 힐스테이」(힐스테이트 실사고 · 2026-09-17). 한도 15자(wlen 30) · 줄나눔은 렌더가 맡는다
|
package/package.json
CHANGED