@oddmash/juliya 0.4.0 → 0.4.2
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 +34 -37
- package/dist/core/scoring.js +2 -0
- package/dist/dom/inline.d.ts +3 -2
- package/dist/dom/inline.js +100 -27
- package/dist/dom/observe-element.d.ts +1 -1
- package/dist/dom/observe-element.js +34 -17
- package/dist/dom/observe.js +1 -1
- package/package.json +40 -63
package/README.md
CHANGED
|
@@ -1,59 +1,56 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Juliya (줄이야)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[English](https://github.com/Oddmash/juliya#readme) · [한국어](https://github.com/Oddmash/juliya/blob/main/docs/readme/ko.md) · [日本語](https://github.com/Oddmash/juliya/blob/main/docs/readme/ja.md) · [简体中文](https://github.com/Oddmash/juliya/blob/main/docs/readme/zh.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Juliya is a locale-aware text wrapping library for readable headings and short passages in Korean, English, Japanese, and Simplified Chinese. It combines language-specific break boundaries with measured layout width instead of relying on character counts alone.
|
|
6
6
|
|
|
7
|
-
[
|
|
7
|
+
[Playground](https://oddmash.github.io/juliya/en/#editor) | [Documentation](https://oddmash.github.io/juliya/en/docs/) | [npm](https://www.npmjs.com/package/@oddmash/juliya)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Choose a language
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
| Language | Entry point | Locale |
|
|
12
|
+
| --- | --- | --- |
|
|
13
|
+
| Korean | `@oddmash/juliya/ko` | `ko` |
|
|
14
|
+
| English | `@oddmash/juliya/en` | `en` |
|
|
15
|
+
| Japanese | `@oddmash/juliya/ja` | `ja` |
|
|
16
|
+
| Simplified Chinese | `@oddmash/juliya/zh` | `zh`, `zh-Hans` |
|
|
14
17
|
|
|
15
18
|
```ts
|
|
16
|
-
import { wrap } from '@oddmash/
|
|
19
|
+
import { wrap } from '@oddmash/juliya/en';
|
|
17
20
|
|
|
18
|
-
const lines = wrap('
|
|
19
|
-
width:
|
|
20
|
-
measure: text => [...text].length,
|
|
21
|
+
const lines = wrap('Read every line naturally.', {
|
|
22
|
+
width: 12,
|
|
23
|
+
measure: (text) => [...text].length,
|
|
21
24
|
});
|
|
22
25
|
```
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
새 브랜드 패키지 `@oddmash/juliya`는 동일한 구현과 언어별 진입점으로 발행할 예정입니다. 신규 패키지가 발행되면 `@oddmash/juliya/ko`, `@oddmash/juliya/en`, `@oddmash/juliya/ja`, `@oddmash/juliya/zh`로 가져올 수 있습니다. 기존 패키지는 삭제하거나 덮어쓰지 않습니다.
|
|
27
|
+
This example uses character counts for illustration. The DOM and framework adapters measure actual font and container width. The default root entry point uses Korean unless a locale is selected explicitly.
|
|
27
28
|
|
|
28
|
-
## React
|
|
29
|
-
|
|
30
|
-
신규 버전의 `JuliyaProvider`로 애플리케이션 언어를 한 번 설정하면 그 하위의 `JuliyaText`와 `useJuliya`가 언어를 공유합니다.
|
|
29
|
+
## React and Next.js
|
|
31
30
|
|
|
32
31
|
```tsx
|
|
33
32
|
import { JuliyaProvider, JuliyaText } from '@oddmash/juliya/react';
|
|
34
33
|
|
|
35
|
-
<JuliyaProvider locale="
|
|
36
|
-
<JuliyaText as="h1"
|
|
37
|
-
<JuliyaText as="p"
|
|
34
|
+
<JuliyaProvider locale="en">
|
|
35
|
+
<JuliyaText as="h1">Read every line naturally.</JuliyaText>
|
|
36
|
+
<JuliyaText as="p">Wrap text based on the available space.</JuliyaText>
|
|
38
37
|
</JuliyaProvider>
|
|
39
38
|
```
|
|
40
39
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
두 패키지를 함께 사용하는 경우 Provider와 하위 컴포넌트는 동일한 패키지에서 가져오세요. [React 및 i18n 연동 예제](docs/guide/react.md)를 참고하세요.
|
|
40
|
+
The provider shares its locale with child components and hooks. An explicit locale on a child takes precedence. See the [React guide](https://oddmash.github.io/juliya/en/docs/react/).
|
|
44
41
|
|
|
45
|
-
##
|
|
42
|
+
## Try in a browser
|
|
46
43
|
|
|
47
|
-
|
|
44
|
+
Save this Korean example as `index.html` and open it in a browser with an internet connection. The standalone example uses the verified Juliya 0.4.0 CDN entry point.
|
|
48
45
|
|
|
49
46
|
```html
|
|
50
47
|
<!doctype html>
|
|
51
48
|
<html lang="ko">
|
|
52
49
|
<meta charset="utf-8">
|
|
53
|
-
<title>
|
|
50
|
+
<title>Juliya 예제</title>
|
|
54
51
|
<p id="title" style="max-width: 220px; font-size: 24px">팀의 모든 문서를 한곳에서 관리하세요</p>
|
|
55
52
|
<script type="module">
|
|
56
|
-
import { mountKowrap } from 'https://cdn.jsdelivr.net/npm/@oddmash/
|
|
53
|
+
import { mountKowrap } from 'https://cdn.jsdelivr.net/npm/@oddmash/juliya@0.4.0/dist/dom/index.js/+esm';
|
|
57
54
|
|
|
58
55
|
const title = document.getElementById('title');
|
|
59
56
|
mountKowrap(title, { text: title.textContent });
|
|
@@ -61,16 +58,16 @@ import { JuliyaProvider, JuliyaText } from '@oddmash/juliya/react';
|
|
|
61
58
|
</html>
|
|
62
59
|
```
|
|
63
60
|
|
|
64
|
-
##
|
|
61
|
+
## Features
|
|
65
62
|
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
63
|
+
- Language-specific line breaking and balanced line widths.
|
|
64
|
+
- Automatic recalculation when the container or font changes.
|
|
65
|
+
- Explicit line breaks and nested inline markup preservation.
|
|
66
|
+
- React, Next.js, Vue, Svelte, and plain HTML support.
|
|
67
|
+
- Heuristic language rules, not comprehensive natural-language analysis. Best suited to headings and short passages.
|
|
71
68
|
|
|
72
|
-
##
|
|
69
|
+
## Migrating from Kowrap
|
|
73
70
|
|
|
74
|
-
kowrap
|
|
71
|
+
`@oddmash/kowrap@0.4.0` is the final legacy release. All future updates and fixes are published exclusively as `@oddmash/juliya`. Existing versions remain available. Switch the package name while retaining the public API and subpath imports. Compatibility names such as `mountKowrap`, `WrapText`, and `useKowrap` remain available in Juliya.
|
|
75
72
|
|
|
76
|
-
[
|
|
73
|
+
[Migration and usage](https://oddmash.github.io/juliya/en/docs/) | [Contributing](CONTRIBUTING.md) | [MIT License](LICENSE)
|
package/dist/core/scoring.js
CHANGED
|
@@ -7,6 +7,8 @@ const numeralModifier = /^(?:한|두|세|네|다섯|여섯|일곱|여덟|아홉|
|
|
|
7
7
|
const counterHead = /^(?:개|명|건|번|권|회|종|가지|대|장|쪽|줄|단계|시간|분|초|일|개월|년|주)(?:의|이|가|을|를|은|는|에|로|으로|와|과|도|만|부터|까지|에서|에게|이나|나|씩|마다|으로는|로는)?[.,!?。!?…]?$/u;
|
|
8
8
|
const compounds = {
|
|
9
9
|
공통: ["패키지", "코드", "컴포넌트", "모듈"],
|
|
10
|
+
패키지: ["매니저"],
|
|
11
|
+
계약: ["런타임"],
|
|
10
12
|
디자인: ["시스템", "토큰"],
|
|
11
13
|
배포: ["구조", "단위", "경계", "결과"],
|
|
12
14
|
사용: ["범위", "경험", "환경"],
|
package/dist/dom/inline.d.ts
CHANGED
|
@@ -11,8 +11,9 @@ export declare const readInline: (element: HTMLElement) => {
|
|
|
11
11
|
runs: Run[];
|
|
12
12
|
};
|
|
13
13
|
export declare const breakOffsets: (lines: WrappedLine[]) => number[];
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
type ReadAuthorMarkup = <T>(read: () => T) => T;
|
|
15
|
+
export declare const observeInline: (element: HTMLElement, getOptions: () => InlineKowrapOptions, onBreaks: (offsets: number[]) => void, readAuthorMarkup?: ReadAuthorMarkup) => {
|
|
16
|
+
refresh: (force?: boolean) => void;
|
|
16
17
|
destroy: () => void;
|
|
17
18
|
};
|
|
18
19
|
export declare const mountInline: (element: HTMLElement, initial: InlineKowrapOptions) => {
|
package/dist/dom/inline.js
CHANGED
|
@@ -26,48 +26,88 @@ export const readInline = (element) => {
|
|
|
26
26
|
return { text, runs };
|
|
27
27
|
};
|
|
28
28
|
export const breakOffsets = (lines) => lines.slice(0, -1).filter((line) => !line.breakAfter).map((line) => line.end);
|
|
29
|
-
|
|
29
|
+
const readStyledRuns = (element) => {
|
|
30
30
|
const { text, runs } = readInline(element);
|
|
31
|
-
const options = getOptions();
|
|
32
|
-
if (!layout) {
|
|
33
|
-
onBreaks(breakOffsets(manualLines(text, options.forcedBreaks)));
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
31
|
const view = element.ownerDocument.defaultView;
|
|
37
|
-
const
|
|
32
|
+
const styles = new Map();
|
|
38
33
|
const styled = [];
|
|
39
34
|
for (const run of runs) {
|
|
40
35
|
const parent = run.node.parentElement;
|
|
41
36
|
const font = fontOf(view.getComputedStyle(parent));
|
|
42
37
|
const language = languageOf(parent);
|
|
43
38
|
const key = JSON.stringify([font, language]);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
const previous = styled.at(-1);
|
|
50
|
-
if (previous?.key === key && previous.end === run.start)
|
|
51
|
-
previous.end = run.end;
|
|
39
|
+
styles.set(key, { font, language });
|
|
40
|
+
const last = styled.at(-1);
|
|
41
|
+
if (last?.key === key && last.end === run.start)
|
|
42
|
+
last.end = run.end;
|
|
52
43
|
else
|
|
53
|
-
styled.push({ start: run.start, end: run.end, key
|
|
44
|
+
styled.push({ start: run.start, end: run.end, key });
|
|
54
45
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
46
|
+
return { text, styles, styled };
|
|
47
|
+
};
|
|
48
|
+
export const observeInline = (element, getOptions, onBreaks, readAuthorMarkup) => {
|
|
49
|
+
let previous;
|
|
50
|
+
let forceAuthorRead = false;
|
|
51
|
+
const observer = observeElementLayout(element, (layout) => {
|
|
52
|
+
const options = getOptions();
|
|
53
|
+
if (!layout) {
|
|
54
|
+
previous = undefined;
|
|
55
|
+
onBreaks(breakOffsets(manualLines(readInline(element).text, options.forcedBreaks)));
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const { locale, strategy, breakLongWords, forcedBreaks } = options;
|
|
59
|
+
const signatureOf = ({ text, styled }) => JSON.stringify([text, layout.width, locale, strategy, breakLongWords, forcedBreaks, styled]);
|
|
60
|
+
const rendered = readStyledRuns(element);
|
|
61
|
+
const signature = signatureOf(rendered);
|
|
62
|
+
if (!forceAuthorRead && previous?.signature === signature && previous.measure === layout.measure) {
|
|
63
|
+
onBreaks(previous.offsets);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const author = readAuthorMarkup ? readAuthorMarkup(() => readStyledRuns(element)) : rendered;
|
|
67
|
+
const authorSignature = signatureOf(author);
|
|
68
|
+
const { text, styles, styled } = author;
|
|
69
|
+
if (previous?.authorSignature === authorSignature && previous.measure === layout.measure) {
|
|
70
|
+
onBreaks(previous.offsets);
|
|
71
|
+
previous.signature = readAuthorMarkup ? signatureOf(readStyledRuns(element)) : signature;
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const measures = new Map();
|
|
75
|
+
for (const [key, { font, language }] of styles) {
|
|
76
|
+
measures.set(key, createLocalizedCanvasMeasure(font, element.ownerDocument, language));
|
|
77
|
+
}
|
|
78
|
+
const measureRange = (start, end) => styled.reduce((width, run) => {
|
|
79
|
+
const left = Math.max(start, run.start);
|
|
80
|
+
const right = Math.min(end, run.end);
|
|
81
|
+
return left < right ? width + measures.get(run.key)(text.slice(left, right)) : width;
|
|
82
|
+
}, 0);
|
|
83
|
+
const offsets = breakOffsets(wrap(text, { ...options, ...layout, measureRange }));
|
|
84
|
+
onBreaks(offsets);
|
|
85
|
+
previous = { signature: readAuthorMarkup ? signatureOf(readStyledRuns(element)) : signature, authorSignature, measure: layout.measure, offsets };
|
|
86
|
+
});
|
|
87
|
+
return {
|
|
88
|
+
...observer,
|
|
89
|
+
refresh: (force = true) => {
|
|
90
|
+
forceAuthorRead = force;
|
|
91
|
+
try {
|
|
92
|
+
observer.refresh();
|
|
93
|
+
}
|
|
94
|
+
finally {
|
|
95
|
+
forceAuthorRead = false;
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
};
|
|
62
100
|
export const mountInline = (element, initial) => {
|
|
63
101
|
let options = initial;
|
|
64
102
|
let undo = [];
|
|
65
103
|
let previous = [];
|
|
104
|
+
const generated = new Set();
|
|
66
105
|
let mutations;
|
|
67
106
|
const restore = () => {
|
|
68
107
|
undo.reverse().forEach((apply) => apply());
|
|
69
108
|
undo = [];
|
|
70
109
|
previous = [];
|
|
110
|
+
generated.clear();
|
|
71
111
|
mutations?.takeRecords();
|
|
72
112
|
};
|
|
73
113
|
const render = (offsets) => {
|
|
@@ -82,6 +122,7 @@ export const mountInline = (element, initial) => {
|
|
|
82
122
|
const { node, start } = run;
|
|
83
123
|
const br = element.ownerDocument.createElement("br");
|
|
84
124
|
br.setAttribute(inlineBreakAttribute, "");
|
|
125
|
+
generated.add(br);
|
|
85
126
|
const position = offset - start;
|
|
86
127
|
if (position === node.length) {
|
|
87
128
|
node.after(br);
|
|
@@ -102,15 +143,47 @@ export const mountInline = (element, initial) => {
|
|
|
102
143
|
previous = offsets;
|
|
103
144
|
mutations?.takeRecords();
|
|
104
145
|
};
|
|
105
|
-
const
|
|
146
|
+
const readAuthorMarkup = (read) => {
|
|
147
|
+
if (!generated.size)
|
|
148
|
+
return read();
|
|
149
|
+
const positions = Array.from(element.querySelectorAll("br")).filter((br) => generated.has(br)).map((br) => ({ br, parent: br.parentNode, next: br.nextSibling }));
|
|
150
|
+
const selection = element.ownerDocument.getSelection();
|
|
151
|
+
const anchor = selection?.anchorNode;
|
|
152
|
+
const focus = selection?.focusNode;
|
|
153
|
+
const anchorOffset = selection?.anchorOffset ?? 0;
|
|
154
|
+
const focusOffset = selection?.focusOffset ?? 0;
|
|
155
|
+
try {
|
|
156
|
+
positions.forEach(({ br }) => br.remove());
|
|
157
|
+
return read();
|
|
158
|
+
}
|
|
159
|
+
finally {
|
|
160
|
+
positions.reverse().forEach(({ br, parent, next }) => parent.insertBefore(br, next));
|
|
161
|
+
if (selection && anchor && focus && (element.contains(anchor) || element.contains(focus)) &&
|
|
162
|
+
(selection.anchorNode !== anchor || selection.focusNode !== focus || selection.anchorOffset !== anchorOffset || selection.focusOffset !== focusOffset)) {
|
|
163
|
+
selection.setBaseAndExtent(anchor, anchorOffset, focus, focusOffset);
|
|
164
|
+
}
|
|
165
|
+
mutations?.takeRecords();
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
const observer = observeInline(element, () => options, render, readAuthorMarkup);
|
|
106
169
|
const Mutation = element.ownerDocument.defaultView?.MutationObserver;
|
|
107
170
|
if (Mutation) {
|
|
108
|
-
mutations = new Mutation(() => {
|
|
171
|
+
mutations = new Mutation((records) => {
|
|
172
|
+
if (records.some((record) => record.type !== "attributes"))
|
|
173
|
+
restore();
|
|
174
|
+
observer.refresh();
|
|
175
|
+
});
|
|
109
176
|
mutations.observe(element, { subtree: true, childList: true, characterData: true, attributes: true, attributeFilter: ["class", "style", "lang"] });
|
|
110
177
|
}
|
|
178
|
+
const refresh = () => {
|
|
179
|
+
const records = mutations?.takeRecords() ?? [];
|
|
180
|
+
if (records.some((record) => record.type !== "attributes"))
|
|
181
|
+
restore();
|
|
182
|
+
observer.refresh();
|
|
183
|
+
};
|
|
111
184
|
return {
|
|
112
|
-
update: (next) => {
|
|
113
|
-
refresh
|
|
185
|
+
update: (next) => { options = next; refresh(); },
|
|
186
|
+
refresh,
|
|
114
187
|
destroy: () => { observer.destroy(); mutations?.disconnect(); restore(); },
|
|
115
188
|
restore,
|
|
116
189
|
};
|
|
@@ -5,7 +5,7 @@ export interface ElementLayout {
|
|
|
5
5
|
measure: Measure;
|
|
6
6
|
}
|
|
7
7
|
export declare const fontOf: (computed: CSSStyleDeclaration) => CanvasMeasureOptions;
|
|
8
|
-
export declare const observeElementLayout: (element: HTMLElement, onLayout: (layout: ElementLayout | undefined) => void) => {
|
|
8
|
+
export declare const observeElementLayout: (element: HTMLElement, onLayout: (layout: ElementLayout | undefined) => void, skipUnchangedResize?: boolean) => {
|
|
9
9
|
refresh: () => void;
|
|
10
10
|
destroy: () => void;
|
|
11
11
|
};
|
|
@@ -18,7 +18,7 @@ export const fontOf = (computed) => ({
|
|
|
18
18
|
wordSpacing: spacing(computed.wordSpacing),
|
|
19
19
|
fontKerning: computed.fontKerning,
|
|
20
20
|
});
|
|
21
|
-
export const observeElementLayout = (element, onLayout) => {
|
|
21
|
+
export const observeElementLayout = (element, onLayout, skipUnchangedResize = false) => {
|
|
22
22
|
const doc = element.ownerDocument;
|
|
23
23
|
const view = doc.defaultView;
|
|
24
24
|
if (!view) {
|
|
@@ -30,7 +30,9 @@ export const observeElementLayout = (element, onLayout) => {
|
|
|
30
30
|
let measure;
|
|
31
31
|
let observedWidth;
|
|
32
32
|
let frame;
|
|
33
|
-
|
|
33
|
+
let published = false;
|
|
34
|
+
let lastLayout;
|
|
35
|
+
const update = (contentWidth, fromObserver = false) => {
|
|
34
36
|
if (!active)
|
|
35
37
|
return;
|
|
36
38
|
let layout;
|
|
@@ -63,30 +65,45 @@ export const observeElementLayout = (element, onLayout) => {
|
|
|
63
65
|
catch {
|
|
64
66
|
layout = undefined;
|
|
65
67
|
}
|
|
68
|
+
if (skipUnchangedResize && fromObserver && published && layout?.width === lastLayout?.width && layout?.measure === lastLayout?.measure)
|
|
69
|
+
return;
|
|
70
|
+
published = true;
|
|
71
|
+
lastLayout = layout;
|
|
66
72
|
onLayout(layout);
|
|
67
73
|
};
|
|
74
|
+
let pendingWidth;
|
|
75
|
+
let pendingRefresh = false;
|
|
76
|
+
const schedule = (width, force = false) => {
|
|
77
|
+
if (!active)
|
|
78
|
+
return;
|
|
79
|
+
if (width !== undefined)
|
|
80
|
+
pendingWidth = width;
|
|
81
|
+
pendingRefresh ||= force;
|
|
82
|
+
const flush = () => {
|
|
83
|
+
frame = undefined;
|
|
84
|
+
const nextWidth = pendingWidth;
|
|
85
|
+
const fromObserver = !pendingRefresh;
|
|
86
|
+
pendingWidth = undefined;
|
|
87
|
+
pendingRefresh = false;
|
|
88
|
+
update(nextWidth, fromObserver);
|
|
89
|
+
};
|
|
90
|
+
if (!view.requestAnimationFrame)
|
|
91
|
+
flush();
|
|
92
|
+
else if (frame === undefined)
|
|
93
|
+
frame = view.requestAnimationFrame(flush);
|
|
94
|
+
};
|
|
68
95
|
const refresh = () => update();
|
|
96
|
+
const onResize = () => schedule(undefined, true);
|
|
69
97
|
const onFonts = () => {
|
|
70
98
|
measure = undefined;
|
|
71
|
-
|
|
99
|
+
schedule(undefined, true);
|
|
72
100
|
};
|
|
73
101
|
const Observer = view.ResizeObserver ?? globalThis.ResizeObserver;
|
|
74
102
|
const observer = Observer ? new Observer((entries) => {
|
|
75
|
-
|
|
76
|
-
if (width === undefined || !view.requestAnimationFrame) {
|
|
77
|
-
update(width);
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
if (frame !== undefined)
|
|
81
|
-
view.cancelAnimationFrame(frame);
|
|
82
|
-
// Rendering can change the observed element's height.
|
|
83
|
-
frame = view.requestAnimationFrame(() => {
|
|
84
|
-
frame = undefined;
|
|
85
|
-
update(width);
|
|
86
|
-
});
|
|
103
|
+
schedule(entries?.[0]?.contentRect.width);
|
|
87
104
|
}) : undefined;
|
|
88
105
|
observer?.observe(element);
|
|
89
|
-
view.addEventListener("resize",
|
|
106
|
+
view.addEventListener("resize", onResize);
|
|
90
107
|
doc.fonts?.addEventListener("loadingdone", onFonts);
|
|
91
108
|
void doc.fonts?.ready.then(onFonts);
|
|
92
109
|
update();
|
|
@@ -95,7 +112,7 @@ export const observeElementLayout = (element, onLayout) => {
|
|
|
95
112
|
if (frame !== undefined)
|
|
96
113
|
view.cancelAnimationFrame(frame);
|
|
97
114
|
observer?.disconnect();
|
|
98
|
-
view.removeEventListener("resize",
|
|
115
|
+
view.removeEventListener("resize", onResize);
|
|
99
116
|
doc.fonts?.removeEventListener("loadingdone", onFonts);
|
|
100
117
|
};
|
|
101
118
|
return { refresh, destroy };
|
package/dist/dom/observe.js
CHANGED
package/package.json
CHANGED
|
@@ -1,78 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oddmash/juliya",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.2",
|
|
5
5
|
"description": "Locale-aware text wrapping for Korean, English, Japanese and Simplified Chinese",
|
|
6
|
+
"homepage": "https://oddmash.github.io/juliya/",
|
|
7
|
+
"keywords": ["text-wrapping", "line-breaking", "typography", "internationalization", "korean", "japanese", "chinese", "react", "vue", "svelte"],
|
|
6
8
|
"type": "module",
|
|
9
|
+
"packageManager": "pnpm@11.25.0",
|
|
7
10
|
"exports": {
|
|
8
|
-
".": {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
"./
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
"./
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
"./ja": {
|
|
21
|
-
"types": "./dist/core/locales/ja.d.ts",
|
|
22
|
-
"import": "./dist/core/locales/ja.js"
|
|
23
|
-
},
|
|
24
|
-
"./zh": {
|
|
25
|
-
"types": "./dist/core/locales/zh.d.ts",
|
|
26
|
-
"import": "./dist/core/locales/zh.js"
|
|
27
|
-
},
|
|
28
|
-
"./browser": {
|
|
29
|
-
"types": "./dist/dom/index.d.ts",
|
|
30
|
-
"import": "./dist/dom/index.js"
|
|
31
|
-
},
|
|
32
|
-
"./dom": {
|
|
33
|
-
"types": "./dist/dom/index.d.ts",
|
|
34
|
-
"import": "./dist/dom/index.js"
|
|
35
|
-
},
|
|
36
|
-
"./react": {
|
|
37
|
-
"types": "./dist/adapters/react/index.d.ts",
|
|
38
|
-
"import": "./dist/adapters/react/index.js"
|
|
39
|
-
},
|
|
40
|
-
"./react/server": {
|
|
41
|
-
"types": "./dist/adapters/react/server.d.ts",
|
|
42
|
-
"import": "./dist/adapters/react/server.js"
|
|
43
|
-
},
|
|
44
|
-
"./vue": {
|
|
45
|
-
"types": "./dist/adapters/vue/index.d.ts",
|
|
46
|
-
"import": "./dist/adapters/vue/index.js"
|
|
47
|
-
},
|
|
48
|
-
"./svelte": {
|
|
49
|
-
"types": "./dist/adapters/svelte/index.d.ts",
|
|
50
|
-
"import": "./dist/adapters/svelte/index.js"
|
|
51
|
-
}
|
|
11
|
+
".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
|
|
12
|
+
"./ko": { "types": "./dist/core/locales/ko.d.ts", "import": "./dist/core/locales/ko.js" },
|
|
13
|
+
"./en": { "types": "./dist/core/locales/en.d.ts", "import": "./dist/core/locales/en.js" },
|
|
14
|
+
"./ja": { "types": "./dist/core/locales/ja.d.ts", "import": "./dist/core/locales/ja.js" },
|
|
15
|
+
"./zh": { "types": "./dist/core/locales/zh.d.ts", "import": "./dist/core/locales/zh.js" },
|
|
16
|
+
"./browser": { "types": "./dist/dom/index.d.ts", "import": "./dist/dom/index.js" },
|
|
17
|
+
"./dom": { "types": "./dist/dom/index.d.ts", "import": "./dist/dom/index.js" },
|
|
18
|
+
"./react": { "types": "./dist/adapters/react/index.d.ts", "import": "./dist/adapters/react/index.js" },
|
|
19
|
+
"./react/server": { "types": "./dist/adapters/react/server.d.ts", "import": "./dist/adapters/react/server.js" },
|
|
20
|
+
"./vue": { "types": "./dist/adapters/vue/index.d.ts", "import": "./dist/adapters/vue/index.js" },
|
|
21
|
+
"./svelte": { "types": "./dist/adapters/svelte/index.d.ts", "import": "./dist/adapters/svelte/index.js" }
|
|
52
22
|
},
|
|
53
|
-
"files": [
|
|
54
|
-
"dist",
|
|
55
|
-
"README.md",
|
|
56
|
-
"NOTICE.md"
|
|
57
|
-
],
|
|
23
|
+
"files": ["dist", "README.md", "NOTICE.md"],
|
|
58
24
|
"publishConfig": {
|
|
59
25
|
"access": "public",
|
|
60
26
|
"registry": "https://registry.npmjs.org/"
|
|
61
27
|
},
|
|
62
28
|
"sideEffects": false,
|
|
63
|
-
"
|
|
64
|
-
"
|
|
29
|
+
"scripts": {
|
|
30
|
+
"lint": "eslint . --max-warnings 0",
|
|
31
|
+
"lint:fix": "eslint . --fix --max-warnings 0",
|
|
32
|
+
"build": "node scripts/clean-dist.mjs && tsc -p tsconfig.json",
|
|
33
|
+
"test": "pnpm run build && node --test test/*.test.mjs",
|
|
34
|
+
"test:next": "pnpm run build && pnpm --dir test/next-app run build",
|
|
35
|
+
"test:hydration": "pnpm run build && pnpm --dir test/next-app run test:hydration",
|
|
36
|
+
"test:frameworks": "pnpm run build && pnpm --dir test/framework-app test",
|
|
37
|
+
"test:browser": "pnpm run test:next && pnpm --dir test/next-app run test:browser",
|
|
38
|
+
"test:package": "pnpm run build && node --test test/package.mjs",
|
|
39
|
+
"build:site": "pnpm run build && pnpm --dir site run build",
|
|
40
|
+
"test:site": "pnpm run build:site && node --test test/site.mjs",
|
|
41
|
+
"prepack": "pnpm run build"
|
|
65
42
|
},
|
|
66
|
-
"
|
|
67
|
-
|
|
43
|
+
"engines": { "node": ">=20" },
|
|
44
|
+
"peerDependencies": { "react": "^18.2.0 || ^19.0.0" },
|
|
45
|
+
"peerDependenciesMeta": { "react": { "optional": true } },
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"eslint": "10.14.0",
|
|
48
|
+
"typescript-eslint": "8.72.2",
|
|
49
|
+
"@types/react": "19.3.0",
|
|
50
|
+
"react": "19.3.1",
|
|
51
|
+
"react-dom": "19.3.1",
|
|
52
|
+
"typescript": "6.0.3"
|
|
68
53
|
},
|
|
69
|
-
"
|
|
70
|
-
"react": {
|
|
71
|
-
"optional": true
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
"repository": {
|
|
75
|
-
"type": "git",
|
|
76
|
-
"url": "https://github.com/Oddmash/kowrap.git"
|
|
77
|
-
}
|
|
54
|
+
"repository": { "type": "git", "url": "git+https://github.com/Oddmash/juliya.git" }
|
|
78
55
|
}
|