@ihabdevteam/core 0.438.0 → 0.441.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +3 -3
  3. package/dist/components.cjs.js +190 -180
  4. package/dist/components.esm.css +1 -1
  5. package/dist/hooks.cjs.js +5 -5
  6. package/dist/i18n.cjs.js +3 -3
  7. package/dist/ihabdevteam-core.cjs.js +196 -186
  8. package/dist/ihabdevteam-core.d.ts +435 -5
  9. package/dist/packages/core/src/components/Breadcrumb.css +52 -0
  10. package/dist/packages/core/src/components/Breadcrumb.d.ts +19 -1
  11. package/dist/packages/core/src/components/Breadcrumb.js +12 -4
  12. package/dist/packages/core/src/components/Button.css +9 -2
  13. package/dist/packages/core/src/components/CardSection.css +26 -0
  14. package/dist/packages/core/src/components/CardSection.d.ts +32 -0
  15. package/dist/packages/core/src/components/CardSection.js +23 -0
  16. package/dist/packages/core/src/components/FolderGrid.css +28 -0
  17. package/dist/packages/core/src/components/FolderGrid.d.ts +47 -0
  18. package/dist/packages/core/src/components/FolderGrid.js +68 -0
  19. package/dist/packages/core/src/components/FolderHead.css +8 -0
  20. package/dist/packages/core/src/components/FolderHead.d.ts +42 -0
  21. package/dist/packages/core/src/components/FolderHead.js +62 -0
  22. package/dist/packages/core/src/components/FolderSearchSections.d.ts +25 -0
  23. package/dist/packages/core/src/components/FolderSearchSections.js +18 -0
  24. package/dist/packages/core/src/components/FolderTreeButton.css +2 -0
  25. package/dist/packages/core/src/components/FolderTreeButton.d.ts +34 -0
  26. package/dist/packages/core/src/components/FolderTreeButton.js +44 -0
  27. package/dist/packages/core/src/components/Popup/ConfirmPopup.d.ts +8 -2
  28. package/dist/packages/core/src/components/Popup/ConfirmPopup.js +3 -3
  29. package/dist/packages/core/src/components/Tooltip/FolderTreeTooltip.css +99 -0
  30. package/dist/packages/core/src/components/Tooltip/FolderTreeTooltip.d.ts +60 -0
  31. package/dist/packages/core/src/components/Tooltip/FolderTreeTooltip.js +81 -0
  32. package/dist/packages/core/src/components/Tooltip/Tooltip.d.ts +6 -0
  33. package/dist/packages/core/src/components/Tooltip/Tooltip.js +10 -4
  34. package/dist/packages/core/src/components.d.ts +12 -0
  35. package/dist/packages/core/src/components.js +8 -0
  36. package/dist/packages/core/src/hooks/useCardDragToGroup.d.ts +33 -0
  37. package/dist/packages/core/src/hooks/useCardDragToGroup.js +52 -0
  38. package/dist/packages/core/src/hooks/useFolderBrowse.d.ts +30 -0
  39. package/dist/packages/core/src/hooks/useFolderBrowse.js +38 -0
  40. package/dist/packages/core/src/hooks.d.ts +2 -0
  41. package/dist/packages/core/src/hooks.js +3 -0
  42. package/dist/packages/core/src/i18n/locales/en.json +10 -0
  43. package/dist/packages/core/src/i18n/locales/ko.json +9 -0
  44. package/dist/packages/core/src/utils/folderMenu.d.ts +27 -0
  45. package/dist/packages/core/src/utils/folderMenu.js +19 -0
  46. package/dist/packages/core/src/utils/folderPath.d.ts +50 -0
  47. package/dist/packages/core/src/utils/folderPath.js +98 -0
  48. package/dist/packages/core/src/utils/lucideIconSet.js +4 -0
  49. package/dist/packages/core/src/utils.d.ts +3 -0
  50. package/dist/packages/core/src/utils.js +3 -0
  51. package/dist/packages/core/src/version.d.ts +1 -1
  52. package/dist/packages/core/src/version.js +1 -1
  53. package/dist/utils.cjs.js +175 -165
  54. package/package.json +3 -3
@@ -0,0 +1,50 @@
1
+ /** @public 화면에 보일 이름 — 길의 마지막 마디 */
2
+ export declare function folderLeaf(path: string): string;
3
+ /** @public 한 층 위 폴더의 길 — 맨 위 폴더면 `null`(맨 위) */
4
+ export declare function folderParent(path: string): string | null;
5
+ /** @public 폴더 안에 새 폴더의 길을 짓는다 — `parent` 가 없으면 맨 위에 선다 */
6
+ export declare const folderJoin: (parent: string | null, name: string) => string;
7
+ /** @public 새 폴더 이름으로 쓸 수 있나 — 비지 않고, 길을 가르는 글자가 없어야 한다 */
8
+ export declare const isFolderNameOk: (name: string) => boolean;
9
+ /** @public `path` 가 `ancestor` 그 자체이거나 그 아래인가 */
10
+ export declare const isInFolder: (path: string | null | undefined, ancestor: string) => boolean;
11
+ /**
12
+ * 적힌 길들에 **중간 폴더를 채워** 돌려준다(받은 차례를 지키고, 중간 폴더는 그 하위가 처음 나온 자리 앞에 선다).
13
+ * 같은 길은 한 번만.
14
+ * @public
15
+ */
16
+ export declare function withAncestors(paths: readonly string[]): string[];
17
+ /** @public `parent` 바로 아래의 폴더들(한 층만) — `parent` 가 `null` 이면 맨 위의 폴더들. 받은 차례 그대로 */
18
+ export declare function folderChildren(paths: readonly string[], parent: string | null): string[];
19
+ /** @public 맨 위에서 그 폴더까지의 길 — 층마다 `{ path, label }`(길 · 보일 이름) */
20
+ export declare function folderTrail(path: string): {
21
+ path: string;
22
+ label: string;
23
+ }[];
24
+ /** @public 폴더 나무를 **펼친 차례**로 — 부모 바로 뒤에 그 자식들이 선다. 층은 0 부터 */
25
+ export declare function folderTree(paths: readonly string[]): {
26
+ path: string;
27
+ label: string;
28
+ depth: number;
29
+ }[];
30
+ /**
31
+ * 폴더 `from` 을 `toParent` 안으로 **옮겼을 때** `path` 의 새 길(사장님 지시 2026-11-13 "드래드 해서 다른 폴더에 넣거나 뺄 수
32
+ * 있도록"). `path` 가 `from` 그 자체나 그 아래면 앞머리를 갈아 돌려주고, 상관없는 길이면 `undefined`.
33
+ * `toParent` 가 `null` 이면 맨 위로 뺀다.
34
+ * @public
35
+ */
36
+ export declare function folderMoved(path: string | null | undefined, from: string, toParent: string | null): string | undefined;
37
+ /**
38
+ * 폴더 `from` 을 `toParent` 안으로 옮길 수 있나 — 제 자신 · 제 아래로는 못 들어가고, 이미 그 자리에 있으면 옮길 것이 없다.
39
+ * (같은 이름이 그 자리에 이미 있는지는 부르는 쪽이 본다 — 있는 폴더를 아는 것은 그쪽이다.)
40
+ * @public
41
+ */
42
+ export declare const canMoveFolder: (from: string, toParent: string | null) => boolean;
43
+ /**
44
+ * 폴더 `from` 을 `into` 안으로 옮기려 할 때의 **판정** — 세 화면(나의 단어표 · 단어훈련 · 문장훈련)이 같은 말을 따로 적고 있었다.
45
+ * · `noop` — 옮길 것이 없다(제 자신 · 제 아래 · 이미 그 자리)
46
+ * · `clash` — 그 자리에 같은 이름의 폴더가 이미 있다(알린다 — `folderTree.moveClash`)
47
+ * · `ok` — 옮긴다. 새 길은 `folderMoved(from, from, into)`
48
+ * @public
49
+ */
50
+ export declare function folderMoveVerdict(from: string, into: string | null, existing: readonly string[]): 'ok' | 'clash' | 'noop';
@@ -0,0 +1,98 @@
1
+ /**
2
+ * **폴더 안의 폴더 — 이름을 길로 적는다.** (말귀 청 (435), 사장님 지시 2026-11-13 "core에 포함 시켜야 할게 있다면 포함시키고")
3
+ *
4
+ * 폴더와 그 안에 든 것이 **이름 글자로 이어져 있는** 자료(외래키가 아니라, 든 것의 `group` 과 폴더의 이름이 같은 글자면 그 안)에서
5
+ * 폴더에 층을 준다: 「앙」 안의 「하위」 를 `앙/하위` 로 적으면 **자료 꼴을 안 바꾸고** 층이 생긴다. 든 것은 제 폴더의 온 길을
6
+ * 적고, 화면은 길의 마지막 마디만 보인다(`folderLeaf`). 대신 폴더 이름에 `/` 는 못 쓴다(`isFolderNameOk`).
7
+ *
8
+ * **중간 폴더는 적혀 있지 않아도 있는 것으로 친다** — `앙/하위` 만 적혀 있고 `앙` 이 없어도 「앙」 이 선다(`withAncestors`).
9
+ * 옛 자료나 한쪽만 지워진 자료에서 하위 폴더가 통째로 사라져 보이면 안 된다.
10
+ *
11
+ * 그리는 조각은 `FolderHead`(길 · 구조 단추 · 폴더 칸) · `FolderGrid` · `FolderTreeButton` · `FolderTreeTooltip` 이다.
12
+ * 말귀의 나의 단어표 · 나의 단어훈련 · 나의 문장훈련에서 먼저 섰다(2026-11-13).
13
+ */
14
+ const FOLDER_SEP = '/';
15
+ /** 길을 마디로 — 빈 마디는 버린다 */
16
+ const folderParts = (path) => path.split(FOLDER_SEP).filter(part => part !== '');
17
+ /** @public 화면에 보일 이름 — 길의 마지막 마디 */
18
+ export function folderLeaf(path) {
19
+ const parts = folderParts(path);
20
+ /* `.at(-1)` 은 옛 폰(iOS 15.4 아래)에서 터진다 — 길이로 짚는다 */
21
+ return parts[parts.length - 1] ?? path;
22
+ }
23
+ /** @public 한 층 위 폴더의 길 — 맨 위 폴더면 `null`(맨 위) */
24
+ export function folderParent(path) {
25
+ const parts = folderParts(path);
26
+ return parts.length > 1 ? parts.slice(0, -1).join(FOLDER_SEP) : null;
27
+ }
28
+ /** @public 폴더 안에 새 폴더의 길을 짓는다 — `parent` 가 없으면 맨 위에 선다 */
29
+ export const folderJoin = (parent, name) => (parent ? `${parent}${FOLDER_SEP}${name.trim()}` : name.trim());
30
+ /** @public 새 폴더 이름으로 쓸 수 있나 — 비지 않고, 길을 가르는 글자가 없어야 한다 */
31
+ export const isFolderNameOk = (name) => name.trim() !== '' && !name.includes(FOLDER_SEP);
32
+ /** @public `path` 가 `ancestor` 그 자체이거나 그 아래인가 */
33
+ export const isInFolder = (path, ancestor) => !!path && (path === ancestor || path.startsWith(ancestor + FOLDER_SEP));
34
+ /**
35
+ * 적힌 길들에 **중간 폴더를 채워** 돌려준다(받은 차례를 지키고, 중간 폴더는 그 하위가 처음 나온 자리 앞에 선다).
36
+ * 같은 길은 한 번만.
37
+ * @public
38
+ */
39
+ export function withAncestors(paths) {
40
+ const seen = new Set();
41
+ const out = [];
42
+ for (const path of paths) {
43
+ const parts = folderParts(path);
44
+ for (let depth = 1; depth <= parts.length; depth += 1) {
45
+ const at = parts.slice(0, depth).join(FOLDER_SEP);
46
+ if (!seen.has(at)) {
47
+ seen.add(at);
48
+ out.push(at);
49
+ }
50
+ }
51
+ }
52
+ return out;
53
+ }
54
+ /** @public `parent` 바로 아래의 폴더들(한 층만) — `parent` 가 `null` 이면 맨 위의 폴더들. 받은 차례 그대로 */
55
+ export function folderChildren(paths, parent) {
56
+ return withAncestors(paths).filter(path => folderParent(path) === parent);
57
+ }
58
+ /** @public 맨 위에서 그 폴더까지의 길 — 층마다 `{ path, label }`(길 · 보일 이름) */
59
+ export function folderTrail(path) {
60
+ const parts = folderParts(path);
61
+ return parts.map((label, i) => ({ path: parts.slice(0, i + 1).join(FOLDER_SEP), label }));
62
+ }
63
+ /** @public 폴더 나무를 **펼친 차례**로 — 부모 바로 뒤에 그 자식들이 선다. 층은 0 부터 */
64
+ export function folderTree(paths) {
65
+ const all = withAncestors(paths);
66
+ const walk = (parent, depth) => all.filter(path => folderParent(path) === parent)
67
+ .flatMap(path => [{ path, label: folderLeaf(path), depth }, ...walk(path, depth + 1)]);
68
+ return walk(null, 0);
69
+ }
70
+ /**
71
+ * 폴더 `from` 을 `toParent` 안으로 **옮겼을 때** `path` 의 새 길(사장님 지시 2026-11-13 "드래드 해서 다른 폴더에 넣거나 뺄 수
72
+ * 있도록"). `path` 가 `from` 그 자체나 그 아래면 앞머리를 갈아 돌려주고, 상관없는 길이면 `undefined`.
73
+ * `toParent` 가 `null` 이면 맨 위로 뺀다.
74
+ * @public
75
+ */
76
+ export function folderMoved(path, from, toParent) {
77
+ if (!path || !isInFolder(path, from))
78
+ return undefined;
79
+ return folderJoin(toParent, folderLeaf(from)) + path.slice(from.length);
80
+ }
81
+ /**
82
+ * 폴더 `from` 을 `toParent` 안으로 옮길 수 있나 — 제 자신 · 제 아래로는 못 들어가고, 이미 그 자리에 있으면 옮길 것이 없다.
83
+ * (같은 이름이 그 자리에 이미 있는지는 부르는 쪽이 본다 — 있는 폴더를 아는 것은 그쪽이다.)
84
+ * @public
85
+ */
86
+ export const canMoveFolder = (from, toParent) => folderParent(from) !== toParent && !(toParent !== null && isInFolder(toParent, from));
87
+ /**
88
+ * 폴더 `from` 을 `into` 안으로 옮기려 할 때의 **판정** — 세 화면(나의 단어표 · 단어훈련 · 문장훈련)이 같은 말을 따로 적고 있었다.
89
+ * · `noop` — 옮길 것이 없다(제 자신 · 제 아래 · 이미 그 자리)
90
+ * · `clash` — 그 자리에 같은 이름의 폴더가 이미 있다(알린다 — `folderTree.moveClash`)
91
+ * · `ok` — 옮긴다. 새 길은 `folderMoved(from, from, into)`
92
+ * @public
93
+ */
94
+ export function folderMoveVerdict(from, into, existing) {
95
+ if (!canMoveFolder(from, into))
96
+ return 'noop';
97
+ return existing.includes(folderJoin(into, folderLeaf(from))) ? 'clash' : 'ok';
98
+ }
@@ -66,8 +66,10 @@ import ExternalLinkIcon from 'lucide-react/dist/esm/icons/external-link.mjs';
66
66
  import EyeIcon from 'lucide-react/dist/esm/icons/eye.mjs';
67
67
  import FileTextIcon from 'lucide-react/dist/esm/icons/file-text.mjs';
68
68
  import FlipHorizontalIcon from 'lucide-react/dist/esm/icons/flip-horizontal.mjs';
69
+ import FolderIcon from 'lucide-react/dist/esm/icons/folder.mjs';
69
70
  import FolderOpenIcon from 'lucide-react/dist/esm/icons/folder-open.mjs';
70
71
  import FolderPlusIcon from 'lucide-react/dist/esm/icons/folder-plus.mjs';
72
+ import FolderTreeIcon from 'lucide-react/dist/esm/icons/folder-tree.mjs';
71
73
  import GamepadIcon from 'lucide-react/dist/esm/icons/gamepad.mjs';
72
74
  import GavelIcon from 'lucide-react/dist/esm/icons/gavel.mjs';
73
75
  import GitMergeIcon from 'lucide-react/dist/esm/icons/git-merge.mjs';
@@ -250,8 +252,10 @@ export const STATIC_LUCIDE_ICONS = {
250
252
  'eye': EyeIcon,
251
253
  'file-text': FileTextIcon,
252
254
  'flip-horizontal': FlipHorizontalIcon,
255
+ 'folder': FolderIcon,
253
256
  'folder-open': FolderOpenIcon,
254
257
  'folder-plus': FolderPlusIcon,
258
+ 'folder-tree': FolderTreeIcon,
255
259
  'gamepad': GamepadIcon,
256
260
  'gamepad-2': Gamepad2Icon,
257
261
  /* 시각·시간을 뜻하는 이름이 하나도 없었다(말귀 '⋯' 메뉴의 '시간' 항목) */
@@ -24,6 +24,9 @@ export { syllablePron, soundOf, primarySelPart, syllMatchesComp, matchSyllables,
24
24
  export { reorderArray, shuffle, sample } from './utils/array';
25
25
  export { getErrorMessage, toUserErrorMessage, isNetworkErrorMessage, NETWORK_ERROR_MESSAGE } from './utils/errorMessage';
26
26
  export { sortToValue, parseSortValue } from './utils/sortValue';
27
+ export { folderLeaf, folderParent, folderJoin, isFolderNameOk, isInFolder, withAncestors, folderChildren, folderTrail, folderTree, folderMoved, canMoveFolder, folderMoveVerdict, } from './utils/folderPath';
28
+ export { folderMenuItems } from './utils/folderMenu';
29
+ export type { FolderMenuLine } from './utils/folderMenu';
27
30
  export { escapeCsvField, downloadCsvText } from './utils/csv';
28
31
  export { setWordPool, getWordPool } from './utils/wordPool';
29
32
  export type { WordPool, WordPoolEntry } from './utils/wordPool';
@@ -22,6 +22,9 @@ export { syllablePron, soundOf, primarySelPart, syllMatchesComp, matchSyllables,
22
22
  export { reorderArray, shuffle, sample } from './utils/array';
23
23
  export { getErrorMessage, toUserErrorMessage, isNetworkErrorMessage, NETWORK_ERROR_MESSAGE } from './utils/errorMessage';
24
24
  export { sortToValue, parseSortValue } from './utils/sortValue';
25
+ /* 폴더 안의 폴더 — 이름을 길로 적는 셈(말귀 청 (435), 2026-11-13). 그리는 조각은 `FolderHead` 식구다 */
26
+ export { folderLeaf, folderParent, folderJoin, isFolderNameOk, isInFolder, withAncestors, folderChildren, folderTrail, folderTree, folderMoved, canMoveFolder, folderMoveVerdict, } from './utils/folderPath';
27
+ export { folderMenuItems } from './utils/folderMenu'; // 폴더 메뉴의 줄(말귀 청 (437) ㉮)
25
28
  export { escapeCsvField, downloadCsvText } from './utils/csv';
26
29
  export { setWordPool, getWordPool } from './utils/wordPool';
27
30
  export { setTrainingTimeLogger, logTrainingTime, setCrosswordLogger, logCrossword, setTrainingCompletionLogger, logTrainingCompletion } from './utils/trainingLogger';
@@ -46,4 +46,4 @@
46
46
  *
47
47
  * 값은 손으로 적고 `test/coreVersion.test.ts` 가 package.json 과 어긋나면 운다.
48
48
  */
49
- export declare const CORE_VERSION = "0.438.0";
49
+ export declare const CORE_VERSION = "0.441.0";
@@ -46,4 +46,4 @@
46
46
  *
47
47
  * 값은 손으로 적고 `test/coreVersion.test.ts` 가 package.json 과 어긋나면 운다.
48
48
  */
49
- export const CORE_VERSION = '0.438.0';
49
+ export const CORE_VERSION = '0.441.0';