@oddmash/juliya 0.4.0 → 0.4.1
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/package.json +38 -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/package.json
CHANGED
|
@@ -1,78 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oddmash/juliya",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.1",
|
|
5
5
|
"description": "Locale-aware text wrapping for Korean, English, Japanese and Simplified Chinese",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"packageManager": "pnpm@11.25.0",
|
|
7
8
|
"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
|
-
}
|
|
9
|
+
".": { "types": "./dist/index.d.ts", "import": "./dist/index.js" },
|
|
10
|
+
"./ko": { "types": "./dist/core/locales/ko.d.ts", "import": "./dist/core/locales/ko.js" },
|
|
11
|
+
"./en": { "types": "./dist/core/locales/en.d.ts", "import": "./dist/core/locales/en.js" },
|
|
12
|
+
"./ja": { "types": "./dist/core/locales/ja.d.ts", "import": "./dist/core/locales/ja.js" },
|
|
13
|
+
"./zh": { "types": "./dist/core/locales/zh.d.ts", "import": "./dist/core/locales/zh.js" },
|
|
14
|
+
"./browser": { "types": "./dist/dom/index.d.ts", "import": "./dist/dom/index.js" },
|
|
15
|
+
"./dom": { "types": "./dist/dom/index.d.ts", "import": "./dist/dom/index.js" },
|
|
16
|
+
"./react": { "types": "./dist/adapters/react/index.d.ts", "import": "./dist/adapters/react/index.js" },
|
|
17
|
+
"./react/server": { "types": "./dist/adapters/react/server.d.ts", "import": "./dist/adapters/react/server.js" },
|
|
18
|
+
"./vue": { "types": "./dist/adapters/vue/index.d.ts", "import": "./dist/adapters/vue/index.js" },
|
|
19
|
+
"./svelte": { "types": "./dist/adapters/svelte/index.d.ts", "import": "./dist/adapters/svelte/index.js" }
|
|
52
20
|
},
|
|
53
|
-
"files": [
|
|
54
|
-
"dist",
|
|
55
|
-
"README.md",
|
|
56
|
-
"NOTICE.md"
|
|
57
|
-
],
|
|
21
|
+
"files": ["dist", "README.md", "NOTICE.md"],
|
|
58
22
|
"publishConfig": {
|
|
59
23
|
"access": "public",
|
|
60
24
|
"registry": "https://registry.npmjs.org/"
|
|
61
25
|
},
|
|
62
26
|
"sideEffects": false,
|
|
63
|
-
"
|
|
64
|
-
"
|
|
27
|
+
"scripts": {
|
|
28
|
+
"lint": "eslint . --max-warnings 0",
|
|
29
|
+
"lint:fix": "eslint . --fix --max-warnings 0",
|
|
30
|
+
"build": "node scripts/clean-dist.mjs && tsc -p tsconfig.json",
|
|
31
|
+
"test": "pnpm run build && node --test test/*.test.mjs",
|
|
32
|
+
"test:next": "pnpm run build && pnpm --dir test/next-app run build",
|
|
33
|
+
"test:hydration": "pnpm run build && pnpm --dir test/next-app run test:hydration",
|
|
34
|
+
"test:frameworks": "pnpm run build && pnpm --dir test/framework-app test",
|
|
35
|
+
"test:browser": "pnpm run test:next && pnpm --dir test/next-app run test:browser",
|
|
36
|
+
"test:package": "pnpm run build && node --test test/package.mjs",
|
|
37
|
+
"build:site": "pnpm run build && pnpm --dir site run build",
|
|
38
|
+
"test:site": "pnpm run build:site && node --test test/site.mjs",
|
|
39
|
+
"prepack": "pnpm run build"
|
|
65
40
|
},
|
|
66
|
-
"
|
|
67
|
-
|
|
41
|
+
"engines": { "node": ">=20" },
|
|
42
|
+
"peerDependencies": { "react": "^18.2.0 || ^19.0.0" },
|
|
43
|
+
"peerDependenciesMeta": { "react": { "optional": true } },
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"eslint": "10.14.0",
|
|
46
|
+
"typescript-eslint": "8.72.2",
|
|
47
|
+
"@types/react": "19.3.0",
|
|
48
|
+
"react": "19.3.1",
|
|
49
|
+
"react-dom": "19.3.1",
|
|
50
|
+
"typescript": "6.0.3"
|
|
68
51
|
},
|
|
69
|
-
"
|
|
70
|
-
"react": {
|
|
71
|
-
"optional": true
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
"repository": {
|
|
75
|
-
"type": "git",
|
|
76
|
-
"url": "https://github.com/Oddmash/kowrap.git"
|
|
77
|
-
}
|
|
52
|
+
"repository": { "type": "git", "url": "git+https://github.com/Oddmash/juliya.git" }
|
|
78
53
|
}
|