@ilamanownuk/blog-kit 0.0.0-stage → 0.1.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.
@@ -0,0 +1,215 @@
1
+ /* @ilamanownuk/blog-kit — no Tailwind needed. Override the --bk-* variables on :root or any ancestor. */
2
+ :root {
3
+ --bk-accent: #997b2d;
4
+ --bk-accent-contrast: #fff;
5
+ --bk-fg: #1c1c1c;
6
+ --bk-muted-fg: #6b7280;
7
+ --bk-bg: #fff;
8
+ --bk-surface: #f9fafb;
9
+ --bk-muted: #f3f4f6;
10
+ --bk-border: #e5e7eb;
11
+ --bk-danger: #b91c1c;
12
+ --bk-radius: 0.5rem;
13
+ --bk-font: inherit;
14
+ --bk-editor-min-height: 360px;
15
+ --bk-code-bg: #1c1c1c;
16
+ --bk-code-fg: #f5f5f5;
17
+ --bk-mark-bg: #fde68a;
18
+ }
19
+
20
+ /* ---------- Content (editor + renderer) ---------- */
21
+ .bk-rich {
22
+ font-size: 1rem;
23
+ line-height: 2.1;
24
+ overflow-wrap: anywhere;
25
+ color: var(--bk-fg);
26
+ font-family: var(--bk-font);
27
+ }
28
+ .bk-rich[dir="rtl"] { text-align: right; }
29
+ .bk-rich[dir="ltr"] { text-align: left; }
30
+ .bk-rich > *:first-child { margin-top: 0; }
31
+ .bk-rich p { margin: 0 0 1rem; }
32
+ .bk-rich h2 { margin: 2rem 0 0.75rem; font-size: 1.35rem; font-weight: 800; line-height: 1.5; }
33
+ .bk-rich h3 { margin: 1.5rem 0 0.5rem; font-size: 1.15rem; font-weight: 700; line-height: 1.5; }
34
+ .bk-rich h4 { margin: 1.25rem 0 0.5rem; font-size: 1rem; font-weight: 700; line-height: 1.5; }
35
+ .bk-rich a { color: var(--bk-accent); text-decoration: underline; text-underline-offset: 4px; }
36
+ .bk-rich ul, .bk-rich ol { margin: 0 0 1rem; padding-inline-start: 1.25rem; }
37
+ .bk-rich ul { list-style-type: disc; }
38
+ .bk-rich ol { list-style-type: decimal; }
39
+ .bk-rich li + li { margin-top: 0.4rem; }
40
+ .bk-rich li > p { margin-bottom: 0; }
41
+ .bk-rich blockquote {
42
+ margin-block: 1.5rem;
43
+ margin-inline: 0;
44
+ border-inline-start: 4px solid var(--bk-accent);
45
+ padding-inline-start: 1rem;
46
+ font-style: italic;
47
+ opacity: 0.85;
48
+ }
49
+ .bk-rich pre {
50
+ margin-block: 1rem;
51
+ overflow-x: auto;
52
+ border-radius: var(--bk-radius);
53
+ background: var(--bk-code-bg);
54
+ color: var(--bk-code-fg);
55
+ padding: 0.75rem 1rem;
56
+ direction: ltr;
57
+ text-align: left;
58
+ font-size: 0.875rem;
59
+ line-height: 1.6;
60
+ }
61
+ .bk-rich code { border-radius: 0.25rem; background: rgb(0 0 0 / 0.06); padding: 0.1rem 0.3rem; font-size: 0.875em; }
62
+ .bk-rich pre code { background: none; padding: 0; }
63
+ .bk-rich mark { border-radius: 0.2rem; background-color: var(--bk-mark-bg); padding: 0 0.15rem; color: inherit; }
64
+ .bk-rich hr { margin-block: 2rem; border: 0; border-top: 1px solid rgb(0 0 0 / 0.12); }
65
+ .bk-rich img { display: block; margin-block: 1.5rem; height: auto; max-width: 100%; border-radius: 1rem; }
66
+ .bk-rich iframe { display: block; margin-block: 1.5rem; aspect-ratio: 16 / 9; width: 100%; border: 0; border-radius: 1rem; }
67
+ .bk-rich table { display: block; margin-block: 1.5rem; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
68
+ .bk-rich th, .bk-rich td { min-width: 4rem; border: 1px solid rgb(0 0 0 / 0.15); padding: 0.4rem 0.75rem; vertical-align: top; }
69
+ .bk-rich th { background: rgb(0 0 0 / 0.04); font-weight: 700; }
70
+ .bk-rich th > p, .bk-rich td > p { margin-bottom: 0; }
71
+
72
+ /* ---------- Tiptap / ProseMirror ---------- */
73
+ .tiptap p.is-editor-empty:first-child::before {
74
+ content: attr(data-placeholder);
75
+ float: inline-start;
76
+ height: 0;
77
+ pointer-events: none;
78
+ color: var(--bk-muted-fg);
79
+ }
80
+ .tiptap .selectedCell { background: var(--bk-muted); }
81
+ .tiptap img.ProseMirror-selectednode,
82
+ .tiptap iframe.ProseMirror-selectednode { outline: 2px solid var(--bk-accent); }
83
+ .tiptap iframe { pointer-events: none; }
84
+
85
+ /* ---------- Editor shell ---------- */
86
+ .bk-editor {
87
+ overflow: hidden;
88
+ border: 1px solid var(--bk-border);
89
+ border-radius: var(--bk-radius);
90
+ background: var(--bk-bg);
91
+ color: var(--bk-fg);
92
+ font-family: var(--bk-font);
93
+ }
94
+ .bk-editor.bk-invalid { border-color: var(--bk-danger); }
95
+ .bk-editor-content { min-height: var(--bk-editor-min-height); padding: 0.75rem 1rem; outline: none; }
96
+ .bk-editor-content:focus { outline: none; }
97
+
98
+ .bk-toolbar {
99
+ position: sticky;
100
+ top: 0;
101
+ z-index: 10;
102
+ display: flex;
103
+ flex-wrap: wrap;
104
+ align-items: center;
105
+ gap: 0.25rem;
106
+ padding: 0.375rem;
107
+ border-bottom: 1px solid var(--bk-border);
108
+ background: var(--bk-surface);
109
+ }
110
+ .bk-sep { width: 1px; height: 1.25rem; margin-inline: 0.125rem; background: var(--bk-border); }
111
+ .bk-table-tools { display: flex; flex-wrap: wrap; gap: 0.25rem; width: 100%; padding-top: 0.375rem; border-top: 1px solid var(--bk-border); }
112
+
113
+ /* ---------- Primitives ---------- */
114
+ .bk-btn {
115
+ display: inline-flex;
116
+ align-items: center;
117
+ justify-content: center;
118
+ gap: 0.375rem;
119
+ border: 1px solid transparent;
120
+ border-radius: calc(var(--bk-radius) - 2px);
121
+ background: transparent;
122
+ color: inherit;
123
+ font: inherit;
124
+ font-size: 0.875rem;
125
+ line-height: 1;
126
+ cursor: pointer;
127
+ white-space: nowrap;
128
+ }
129
+ .bk-btn:disabled { opacity: 0.45; cursor: not-allowed; }
130
+ .bk-btn:focus-visible { outline: 2px solid var(--bk-accent); outline-offset: 1px; }
131
+ .bk-btn svg { flex: none; width: 1rem; height: 1rem; }
132
+ .bk-btn-icon { width: 2rem; height: 2rem; padding: 0; }
133
+ .bk-btn-sm { height: 1.75rem; padding: 0 0.5rem; font-size: 0.75rem; }
134
+ .bk-btn-md { height: 2.25rem; padding: 0 0.875rem; }
135
+ .bk-btn-ghost:hover:not(:disabled) { background: var(--bk-muted); }
136
+ .bk-btn-outline { border-color: var(--bk-border); background: var(--bk-bg); }
137
+ .bk-btn-outline:hover:not(:disabled) { background: var(--bk-muted); }
138
+ .bk-btn-primary { background: var(--bk-accent); color: var(--bk-accent-contrast); }
139
+ .bk-btn-primary:hover:not(:disabled) { filter: brightness(0.92); }
140
+ .bk-btn.bk-pressed { background: var(--bk-muted); color: var(--bk-accent); }
141
+
142
+ .bk-input {
143
+ box-sizing: border-box;
144
+ width: 100%;
145
+ height: 2.25rem;
146
+ padding: 0 0.625rem;
147
+ border: 1px solid var(--bk-border);
148
+ border-radius: calc(var(--bk-radius) - 2px);
149
+ background: var(--bk-bg);
150
+ color: inherit;
151
+ font: inherit;
152
+ font-size: 0.875rem;
153
+ }
154
+ .bk-input:focus-visible { outline: 2px solid var(--bk-accent); outline-offset: 0; }
155
+ .bk-label { font-size: 0.875rem; font-weight: 600; }
156
+ .bk-error { margin: 0; font-size: 0.75rem; color: var(--bk-danger); }
157
+ .bk-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; }
158
+ .bk-spin { animation: bk-spin 1s linear infinite; }
159
+ @keyframes bk-spin { to { transform: rotate(360deg); } }
160
+
161
+ .bk-popover { position: relative; display: inline-flex; }
162
+ .bk-popover-content {
163
+ position: absolute;
164
+ inset-block-start: calc(100% + 0.25rem);
165
+ inset-inline-start: 0;
166
+ z-index: 20;
167
+ padding: 0.5rem;
168
+ border: 1px solid var(--bk-border);
169
+ border-radius: var(--bk-radius);
170
+ background: var(--bk-bg);
171
+ box-shadow: 0 8px 24px rgb(0 0 0 / 0.12);
172
+ }
173
+ .bk-colors { display: flex; align-items: center; gap: 0.375rem; }
174
+ .bk-swatch { width: 1.5rem; height: 1.5rem; padding: 0; border: 1px solid var(--bk-border); border-radius: 999px; cursor: pointer; }
175
+
176
+ /* ---------- Dialogs ---------- */
177
+ .bk-dialog {
178
+ box-sizing: border-box;
179
+ width: min(28rem, calc(100vw - 2rem));
180
+ margin: auto;
181
+ padding: 0;
182
+ border: 1px solid var(--bk-border);
183
+ border-radius: calc(var(--bk-radius) + 4px);
184
+ background: var(--bk-bg);
185
+ color: var(--bk-fg);
186
+ font-family: var(--bk-font);
187
+ box-shadow: 0 16px 48px rgb(0 0 0 / 0.2);
188
+ }
189
+ .bk-dialog::backdrop { background: rgb(0 0 0 / 0.5); }
190
+ .bk-dialog-wide { width: min(56rem, calc(100vw - 2rem)); }
191
+ .bk-dialog-body { display: flex; flex-direction: column; max-height: 85vh; }
192
+ .bk-form { display: flex; flex-direction: column; gap: 1rem; padding: 1.25rem; }
193
+ .bk-field { display: flex; flex-direction: column; gap: 0.375rem; }
194
+ .bk-dialog-title, .bk-dialog-header h2 { margin: 0; font-size: 1.05rem; font-weight: 700; }
195
+ .bk-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 1rem; border-bottom: 1px solid var(--bk-border); }
196
+ .bk-dialog-footer { display: flex; justify-content: flex-end; gap: 0.5rem; }
197
+ .bk-actions { display: flex; gap: 0.5rem; }
198
+ .bk-actions-start { justify-content: flex-start; flex-wrap: wrap; }
199
+ .bk-image-preview { max-width: 100%; max-height: 12rem; object-fit: contain; border-radius: var(--bk-radius); border: 1px solid var(--bk-border); }
200
+
201
+ .bk-media-toolbar { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.75rem; padding: 1rem; border-bottom: 1px solid var(--bk-border); }
202
+ .bk-media-toolbar .bk-input { max-width: 20rem; flex: 1; }
203
+ .bk-media-upload { display: flex; flex-direction: column; gap: 0.375rem; }
204
+ .bk-media-body { flex: 1; min-height: 12rem; overflow-y: auto; padding: 1rem; }
205
+ .bk-media-footer { align-items: center; justify-content: space-between; padding: 1rem; border-top: 1px solid var(--bk-border); }
206
+ .bk-media-empty { padding: 2rem; border: 1px dashed var(--bk-border); border-radius: var(--bk-radius); text-align: center; font-size: 0.875rem; color: var(--bk-muted-fg); }
207
+ .bk-media-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; margin: 0; padding: 0; list-style: none; }
208
+ @media (min-width: 640px) { .bk-media-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
209
+ @media (min-width: 768px) { .bk-media-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
210
+ .bk-media-item { position: relative; display: block; width: 100%; aspect-ratio: 1; padding: 0; overflow: hidden; border: 1px solid var(--bk-border); border-radius: var(--bk-radius); background: var(--bk-muted); cursor: pointer; }
211
+ .bk-media-item:focus-visible { outline: 2px solid var(--bk-accent); }
212
+ .bk-media-item.bk-selected { border-color: var(--bk-accent); box-shadow: 0 0 0 2px var(--bk-accent); }
213
+ .bk-media-item img { width: 100%; height: 100%; object-fit: cover; margin: 0; border-radius: 0; }
214
+ .bk-media-check { position: absolute; inset-block-start: 0.375rem; inset-inline-end: 0.375rem; display: flex; width: 1.5rem; height: 1.5rem; align-items: center; justify-content: center; border-radius: 999px; background: var(--bk-accent); color: var(--bk-accent-contrast); }
215
+ .bk-pager { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; }
package/package.json CHANGED
@@ -1,6 +1,109 @@
1
1
  {
2
2
  "name": "@ilamanownuk/blog-kit",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Reusable Tiptap blog editor for Next.js: Aparat/YouTube embeds, image upload, media library picker, server-side sanitizer and renderer.",
5
+ "license": "MIT",
6
+ "packageManager": "pnpm@12.18.0",
7
+ "type": "module",
8
+ "author": "ilamanownuk",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/ilamanownuk/blog-kit.git"
12
+ },
13
+ "homepage": "https://github.com/ilamanownuk/blog-kit#readme",
14
+ "bugs": {
15
+ "url": "https://github.com/ilamanownuk/blog-kit/issues"
16
+ },
17
+ "keywords": [
18
+ "tiptap",
19
+ "rich-text-editor",
20
+ "blog",
21
+ "nextjs",
22
+ "rtl",
23
+ "persian",
24
+ "aparat",
25
+ "sanitize-html"
26
+ ],
27
+ "sideEffects": [
28
+ "*.css"
29
+ ],
30
+ "files": [
31
+ "dist",
32
+ "README.md",
33
+ "LICENSE"
34
+ ],
35
+ "main": "./dist/index.cjs",
36
+ "module": "./dist/index.js",
37
+ "types": "./dist/index.d.ts",
38
+ "exports": {
39
+ ".": {
40
+ "import": {
41
+ "types": "./dist/index.d.ts",
42
+ "default": "./dist/index.js"
43
+ },
44
+ "require": {
45
+ "types": "./dist/index.d.cts",
46
+ "default": "./dist/index.cjs"
47
+ }
48
+ },
49
+ "./renderer": {
50
+ "import": {
51
+ "types": "./dist/renderer.d.ts",
52
+ "default": "./dist/renderer.js"
53
+ },
54
+ "require": {
55
+ "types": "./dist/renderer.d.cts",
56
+ "default": "./dist/renderer.cjs"
57
+ }
58
+ },
59
+ "./server": {
60
+ "import": {
61
+ "types": "./dist/server.d.ts",
62
+ "default": "./dist/server.js"
63
+ },
64
+ "require": {
65
+ "types": "./dist/server.d.cts",
66
+ "default": "./dist/server.cjs"
67
+ }
68
+ },
69
+ "./styles.css": "./dist/styles.css",
70
+ "./package.json": "./package.json"
71
+ },
72
+ "publishConfig": {
73
+ "access": "public"
74
+ },
75
+ "scripts": {
76
+ "build": "tsup",
77
+ "typecheck": "tsc --noEmit",
78
+ "test": "vitest run",
79
+ "prepublishOnly": "pnpm typecheck && pnpm test && pnpm build"
80
+ },
81
+ "peerDependencies": {
82
+ "react": ">=19",
83
+ "react-dom": ">=19"
84
+ },
85
+ "dependencies": {
86
+ "@tiptap/extension-highlight": "3.32.0",
87
+ "@tiptap/extension-image": "3.32.0",
88
+ "@tiptap/extension-placeholder": "3.32.0",
89
+ "@tiptap/extension-table": "3.32.0",
90
+ "@tiptap/extension-text-align": "3.32.0",
91
+ "@tiptap/extension-text-style": "3.32.0",
92
+ "@tiptap/pm": "3.32.0",
93
+ "@tiptap/react": "3.32.0",
94
+ "@tiptap/starter-kit": "3.32.0",
95
+ "lucide-react": "1.28.0",
96
+ "sanitize-html": "2.17.0"
97
+ },
98
+ "devDependencies": {
99
+ "@types/node": "^24.19.2",
100
+ "@types/react": "19.2.18",
101
+ "@types/react-dom": "19.2.4",
102
+ "@types/sanitize-html": "2.16.2",
103
+ "react": "19.2.8",
104
+ "react-dom": "19.2.8",
105
+ "tsup": "^8.5.0",
106
+ "typescript": "5.9.3",
107
+ "vitest": "^3.2.4"
108
+ }
109
+ }