note-blog-kit 0.0.0-stage → 0.2.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,427 @@
1
+ /*
2
+ * note-blog-kit のデフォルト CSS(任意)。import 'note-blog-kit/styles.css' で読み込む。
3
+ *
4
+ * - すべてのルールは @layer note-blog-kit の中にある。レイヤーに入っていない利用者の CSS はこれより優先される
5
+ * (利用者がレイヤーを使っている場合の順序は README を参照)
6
+ * - 色・フォント・余白などは --nbk-* 変数で上書きできる(:root や任意の親要素で指定する)
7
+ * - セレクタは :root と nbk- から始まるクラス名だけを使い、サイトの他の要素には影響しない
8
+ */
9
+ @layer note-blog-kit {
10
+ :root {
11
+ --nbk-font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", meiryo, sans-serif;
12
+ --nbk-color-text: #08131a;
13
+ --nbk-color-muted: #6e7b85;
14
+ --nbk-color-accent: #41c9b4;
15
+ --nbk-color-border: #e6e6e6;
16
+ --nbk-color-placeholder: #f2f2f2;
17
+ /* カードの背景。既定は透明(ページの背景色をそのまま使う) */
18
+ --nbk-color-surface: transparent;
19
+ --nbk-color-badge-bg: #08131a;
20
+ --nbk-color-badge-text: #fff;
21
+ --nbk-radius: 8px;
22
+ --nbk-list-gap: 24px;
23
+ --nbk-card-min-width: 280px;
24
+ /* 本文(NoteArticleBody)。既定は note の本文に合わせる */
25
+ --nbk-body-max-width: 620px;
26
+ --nbk-body-font-size: 18px;
27
+ --nbk-body-line-height: 2;
28
+ --nbk-body-gap: 1.5em;
29
+ --nbk-color-subtle: #f5f8fa;
30
+ --nbk-color-button-bg: #08131a;
31
+ --nbk-color-button-text: #fff;
32
+ }
33
+
34
+ /* 一覧 */
35
+ .nbk-article-list {
36
+ display: grid;
37
+ grid-template-columns: repeat(auto-fill, minmax(min(var(--nbk-card-min-width), 100%), 1fr));
38
+ gap: var(--nbk-list-gap);
39
+ margin: 0;
40
+ padding: 0;
41
+ list-style: none;
42
+ font-family: var(--nbk-font-family);
43
+ color: var(--nbk-color-text);
44
+ }
45
+
46
+ .nbk-article-list__item {
47
+ display: flex;
48
+ min-width: 0;
49
+ }
50
+
51
+ .nbk-article-list--empty {
52
+ display: block;
53
+ }
54
+
55
+ .nbk-article-list__empty {
56
+ margin: 0;
57
+ padding: calc(var(--nbk-list-gap) * 2) 0;
58
+ color: var(--nbk-color-muted);
59
+ font-size: 0.875rem;
60
+ text-align: center;
61
+ }
62
+
63
+ /* カード */
64
+ .nbk-card {
65
+ position: relative;
66
+ display: flex;
67
+ flex-direction: column;
68
+ gap: 8px;
69
+ width: 100%;
70
+ min-width: 0;
71
+ font-family: var(--nbk-font-family);
72
+ color: var(--nbk-color-text);
73
+ background: var(--nbk-color-surface);
74
+ }
75
+
76
+ .nbk-card__eyecatch {
77
+ display: block;
78
+ width: 100%;
79
+ height: auto;
80
+ aspect-ratio: 1280 / 670;
81
+ object-fit: cover;
82
+ border: 1px solid var(--nbk-color-border);
83
+ border-radius: var(--nbk-radius);
84
+ background: var(--nbk-color-placeholder);
85
+ }
86
+
87
+ .nbk-card__title {
88
+ display: -webkit-box;
89
+ margin: 4px 0 0;
90
+ overflow: hidden;
91
+ font-size: 1rem;
92
+ font-weight: 700;
93
+ line-height: 1.5;
94
+ overflow-wrap: anywhere;
95
+ -webkit-box-orient: vertical;
96
+ -webkit-line-clamp: 3;
97
+ line-clamp: 3;
98
+ }
99
+
100
+ .nbk-card__link {
101
+ color: inherit;
102
+ text-decoration: none;
103
+ transition: color 0.15s ease;
104
+ }
105
+
106
+ /*
107
+ * カード全体をクリックできるようにする。
108
+ * カード内に別のリンク(タグなど)を足す場合は、その要素に position: relative と z-index を付けて上に出す
109
+ */
110
+ .nbk-card__link::after {
111
+ position: absolute;
112
+ inset: 0;
113
+ content: "";
114
+ border-radius: var(--nbk-radius);
115
+ }
116
+
117
+ .nbk-card__link:hover {
118
+ color: var(--nbk-color-accent);
119
+ }
120
+
121
+ .nbk-card__link:focus-visible {
122
+ outline: none;
123
+ }
124
+
125
+ .nbk-card__link:focus-visible::after {
126
+ outline: 2px solid var(--nbk-color-accent);
127
+ outline-offset: 4px;
128
+ }
129
+
130
+ .nbk-card__date {
131
+ color: var(--nbk-color-muted);
132
+ font-size: 0.75rem;
133
+ line-height: 1.5;
134
+ }
135
+
136
+ .nbk-card__badge {
137
+ align-self: flex-start;
138
+ padding: 2px 8px;
139
+ color: var(--nbk-color-badge-text);
140
+ font-size: 0.6875rem;
141
+ font-weight: 700;
142
+ line-height: 1.5;
143
+ background: var(--nbk-color-badge-bg);
144
+ border-radius: 999px;
145
+ }
146
+
147
+ .nbk-card__excerpt {
148
+ display: -webkit-box;
149
+ margin: 0;
150
+ overflow: hidden;
151
+ color: var(--nbk-color-muted);
152
+ font-size: 0.875rem;
153
+ line-height: 1.7;
154
+ overflow-wrap: anywhere;
155
+ -webkit-box-orient: vertical;
156
+ -webkit-line-clamp: 3;
157
+ line-clamp: 3;
158
+ }
159
+
160
+ .nbk-card__tags {
161
+ display: flex;
162
+ flex-wrap: wrap;
163
+ gap: 4px 8px;
164
+ margin: 0;
165
+ padding: 0;
166
+ list-style: none;
167
+ }
168
+
169
+ .nbk-card__tag {
170
+ color: var(--nbk-color-muted);
171
+ font-size: 0.75rem;
172
+ line-height: 1.5;
173
+ }
174
+
175
+ /* ページ送り */
176
+ .nbk-pagination {
177
+ display: flex;
178
+ align-items: center;
179
+ justify-content: center;
180
+ gap: 16px;
181
+ margin: calc(var(--nbk-list-gap) * 1.5) 0;
182
+ font-family: var(--nbk-font-family);
183
+ color: var(--nbk-color-text);
184
+ }
185
+
186
+ .nbk-pagination__prev,
187
+ .nbk-pagination__next {
188
+ display: inline-flex;
189
+ align-items: center;
190
+ padding: 8px 20px;
191
+ color: inherit;
192
+ font-size: 0.875rem;
193
+ font-weight: 700;
194
+ text-decoration: none;
195
+ border: 1px solid var(--nbk-color-border);
196
+ border-radius: 999px;
197
+ transition:
198
+ color 0.15s ease,
199
+ border-color 0.15s ease;
200
+ }
201
+
202
+ .nbk-pagination__prev:hover,
203
+ .nbk-pagination__next:hover {
204
+ color: var(--nbk-color-accent);
205
+ border-color: var(--nbk-color-accent);
206
+ }
207
+
208
+ .nbk-pagination__prev:focus-visible,
209
+ .nbk-pagination__next:focus-visible {
210
+ outline: 2px solid var(--nbk-color-accent);
211
+ outline-offset: 2px;
212
+ }
213
+
214
+ .nbk-pagination__status {
215
+ color: var(--nbk-color-muted);
216
+ font-size: 0.875rem;
217
+ }
218
+
219
+ /* 本文。要素ごとに付く nbk-body__* クラスだけに当てる */
220
+ .nbk-body {
221
+ max-width: var(--nbk-body-max-width);
222
+ margin: 0 auto;
223
+ font-family: var(--nbk-font-family);
224
+ font-size: var(--nbk-body-font-size);
225
+ line-height: var(--nbk-body-line-height);
226
+ color: var(--nbk-color-text);
227
+ overflow-wrap: anywhere;
228
+ }
229
+
230
+ .nbk-body__p,
231
+ .nbk-body__ul,
232
+ .nbk-body__ol,
233
+ .nbk-body__blockquote,
234
+ .nbk-body__figure,
235
+ .nbk-body__pre,
236
+ .nbk-body__table,
237
+ .nbk-toc,
238
+ .nbk-embed,
239
+ .nbk-body__more {
240
+ margin: 0 0 var(--nbk-body-gap);
241
+ }
242
+
243
+ /* リストの項目の中の段落(note はリストの項目を段落で包む)や、最後の段落の下に余白を残さない */
244
+ .nbk-body__p:last-child {
245
+ margin-bottom: 0;
246
+ }
247
+
248
+ .nbk-body__h2,
249
+ .nbk-body__h3,
250
+ .nbk-body__h4 {
251
+ margin: 2.5em 0 var(--nbk-body-gap);
252
+ font-weight: 700;
253
+ line-height: 1.5;
254
+ }
255
+
256
+ .nbk-body__h2 {
257
+ font-size: 1.333em;
258
+ }
259
+
260
+ .nbk-body__h3 {
261
+ font-size: 1.111em;
262
+ }
263
+
264
+ .nbk-body__h4 {
265
+ font-size: 1em;
266
+ }
267
+
268
+ .nbk-body__a {
269
+ color: inherit;
270
+ text-decoration: underline;
271
+ text-underline-offset: 0.2em;
272
+ }
273
+
274
+ .nbk-body__a:hover {
275
+ color: var(--nbk-color-accent);
276
+ }
277
+
278
+ .nbk-body__ul,
279
+ .nbk-body__ol {
280
+ padding-left: 1.5em;
281
+ }
282
+
283
+ .nbk-body__blockquote {
284
+ padding: 0 0 0 1em;
285
+ color: var(--nbk-color-muted);
286
+ text-align: left;
287
+ border-left: 4px solid var(--nbk-color-border);
288
+ }
289
+
290
+ .nbk-body__figure {
291
+ text-align: center;
292
+ }
293
+
294
+ .nbk-body__img {
295
+ max-width: 100%;
296
+ height: auto;
297
+ vertical-align: bottom;
298
+ }
299
+
300
+ .nbk-body__figcaption {
301
+ margin-top: 0.5em;
302
+ color: var(--nbk-color-muted);
303
+ font-size: 0.75em;
304
+ }
305
+
306
+ .nbk-body__figcaption:empty {
307
+ display: none;
308
+ }
309
+
310
+ .nbk-body__pre {
311
+ padding: 1em;
312
+ overflow-x: auto;
313
+ font-size: 0.8em;
314
+ line-height: 1.7;
315
+ background: var(--nbk-color-subtle);
316
+ border-radius: var(--nbk-radius);
317
+ }
318
+
319
+ .nbk-body__code {
320
+ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
321
+ }
322
+
323
+ .nbk-body__hr {
324
+ margin: 2.5em 0;
325
+ border: 0;
326
+ border-top: 1px solid var(--nbk-color-border);
327
+ }
328
+
329
+ .nbk-body__table {
330
+ display: block;
331
+ overflow-x: auto;
332
+ border-collapse: collapse;
333
+ font-size: 0.875em;
334
+ }
335
+
336
+ .nbk-body__th,
337
+ .nbk-body__td {
338
+ padding: 0.5em 0.75em;
339
+ border: 1px solid var(--nbk-color-border);
340
+ }
341
+
342
+ /* 目次 */
343
+ .nbk-toc {
344
+ padding: 1em 1.5em;
345
+ background: var(--nbk-color-subtle);
346
+ border-radius: var(--nbk-radius);
347
+ }
348
+
349
+ .nbk-toc__title {
350
+ margin: 0 0 0.5em;
351
+ font-weight: 700;
352
+ }
353
+
354
+ .nbk-toc__list {
355
+ margin: 0;
356
+ padding: 0;
357
+ list-style: none;
358
+ font-size: 0.875em;
359
+ line-height: 1.8;
360
+ }
361
+
362
+ .nbk-toc__item {
363
+ margin: 0;
364
+ }
365
+
366
+ .nbk-toc__item--h2 {
367
+ font-weight: 700;
368
+ }
369
+
370
+ .nbk-toc__item--h3 {
371
+ padding-left: 1em;
372
+ }
373
+
374
+ .nbk-toc__link {
375
+ color: inherit;
376
+ text-decoration: none;
377
+ }
378
+
379
+ .nbk-toc__link:hover {
380
+ color: var(--nbk-color-accent);
381
+ }
382
+
383
+ /* 埋め込み */
384
+ .nbk-embed {
385
+ padding: 1em;
386
+ border: 1px solid var(--nbk-color-border);
387
+ border-radius: var(--nbk-radius);
388
+ }
389
+
390
+ .nbk-embed__link {
391
+ color: inherit;
392
+ text-decoration: none;
393
+ overflow-wrap: anywhere;
394
+ }
395
+
396
+ .nbk-embed__link:hover {
397
+ color: var(--nbk-color-accent);
398
+ }
399
+
400
+ /* 続きは note で */
401
+ .nbk-body__more {
402
+ text-align: center;
403
+ }
404
+
405
+ .nbk-body__more-link {
406
+ display: inline-block;
407
+ padding: 0.5em 2em;
408
+ color: var(--nbk-color-button-text);
409
+ font-size: 0.875em;
410
+ font-weight: 700;
411
+ text-decoration: none;
412
+ background: var(--nbk-color-button-bg);
413
+ border-radius: 999px;
414
+ }
415
+
416
+ .nbk-body__more-link:hover {
417
+ opacity: 0.8;
418
+ }
419
+
420
+ @media (prefers-reduced-motion: reduce) {
421
+ .nbk-card__link,
422
+ .nbk-pagination__prev,
423
+ .nbk-pagination__next {
424
+ transition: none;
425
+ }
426
+ }
427
+ }
package/package.json CHANGED
@@ -1,6 +1,112 @@
1
1
  {
2
2
  "name": "note-blog-kit",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.0",
4
+ "description": "Show your own note articles as a blog on React / Next.js sites (unofficial)",
5
+ "license": "MIT",
6
+ "author": "ludy-kida",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/ludy-kida/note-blog-kit.git",
10
+ "directory": "packages/note-blog-kit"
11
+ },
12
+ "keywords": [
13
+ "note",
14
+ "blog",
15
+ "react",
16
+ "nextjs",
17
+ "rss"
18
+ ],
19
+ "type": "module",
20
+ "sideEffects": [
21
+ "**/*.css"
22
+ ],
23
+ "engines": {
24
+ "node": ">=22.12"
25
+ },
26
+ "files": [
27
+ "dist"
28
+ ],
29
+ "bin": {
30
+ "note-blog-kit": "./dist/cli/index.js"
31
+ },
32
+ "exports": {
33
+ ".": {
34
+ "import": {
35
+ "types": "./dist/index.d.ts",
36
+ "default": "./dist/index.js"
37
+ },
38
+ "require": {
39
+ "types": "./dist/index.d.cts",
40
+ "default": "./dist/index.cjs"
41
+ }
42
+ },
43
+ "./server": {
44
+ "import": {
45
+ "types": "./dist/server/index.d.ts",
46
+ "default": "./dist/server/index.js"
47
+ },
48
+ "require": {
49
+ "types": "./dist/server/index.d.cts",
50
+ "default": "./dist/server/index.cjs"
51
+ }
52
+ },
53
+ "./react": {
54
+ "import": {
55
+ "types": "./dist/react/index.d.ts",
56
+ "default": "./dist/react/index.js"
57
+ },
58
+ "require": {
59
+ "types": "./dist/react/index.d.cts",
60
+ "default": "./dist/react/index.cjs"
61
+ }
62
+ },
63
+ "./next": {
64
+ "import": {
65
+ "types": "./dist/next/index.d.ts",
66
+ "default": "./dist/next/index.js"
67
+ },
68
+ "require": {
69
+ "types": "./dist/next/index.d.cts",
70
+ "default": "./dist/next/index.cjs"
71
+ }
72
+ },
73
+ "./styles.css": "./dist/styles.css",
74
+ "./package.json": "./package.json"
75
+ },
76
+ "main": "./dist/index.cjs",
77
+ "module": "./dist/index.js",
78
+ "types": "./dist/index.d.ts",
79
+ "publishConfig": {
80
+ "access": "public"
81
+ },
82
+ "dependencies": {
83
+ "sanitize-html": "^2.18.2",
84
+ "zod": "^4.6.7"
85
+ },
86
+ "peerDependencies": {
87
+ "react": "^18.0.0 || ^19.0.0"
88
+ },
89
+ "peerDependenciesMeta": {
90
+ "react": {
91
+ "optional": true
92
+ }
93
+ },
94
+ "devDependencies": {
95
+ "@testing-library/dom": "^10.4.2",
96
+ "@testing-library/react": "^16.3.3",
97
+ "@types/react": "^19.3.0",
98
+ "@types/react-dom": "^19.3.0",
99
+ "@types/sanitize-html": "^2.16.2",
100
+ "happy-dom": "^21.0.4",
101
+ "react": "^19.3.1",
102
+ "react-dom": "^19.3.1"
103
+ },
104
+ "scripts": {
105
+ "build": "tsup",
106
+ "typecheck": "tsc --noEmit",
107
+ "api": "node ../../scripts/run-api-extractor.mjs",
108
+ "api:check": "node ../../scripts/run-api-extractor.mjs --check",
109
+ "check:dist": "publint --strict && attw --pack . --profile node16 --exclude-entrypoints ./styles.css",
110
+ "size": "size-limit"
111
+ }
6
112
  }