@k34a/blog 0.0.17 → 0.0.18
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.
|
@@ -1,14 +1,166 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { Box as
|
|
4
|
-
import { IconHash as
|
|
5
|
-
import { BannerImage as
|
|
6
|
-
import
|
|
7
|
-
function
|
|
8
|
-
return
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
import { jsx as u, jsxs as y } from "react/jsx-runtime";
|
|
3
|
+
import { Box as S, Stack as M, Title as R, Text as D, Flex as P, Badge as B } from "@mantine/core";
|
|
4
|
+
import { IconHash as $ } from "@tabler/icons-react";
|
|
5
|
+
import { BannerImage as q } from "./banner-image.js";
|
|
6
|
+
import A from "./description.js";
|
|
7
|
+
function C(e) {
|
|
8
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
9
|
+
}
|
|
10
|
+
function I(e) {
|
|
11
|
+
if (Object.prototype.hasOwnProperty.call(e, "__esModule")) return e;
|
|
12
|
+
var o = e.default;
|
|
13
|
+
if (typeof o == "function") {
|
|
14
|
+
var a = function r() {
|
|
15
|
+
var n = !1;
|
|
16
|
+
try {
|
|
17
|
+
n = this instanceof r;
|
|
18
|
+
} catch {
|
|
19
|
+
}
|
|
20
|
+
return n ? Reflect.construct(o, arguments, this.constructor) : o.apply(this, arguments);
|
|
21
|
+
};
|
|
22
|
+
a.prototype = o.prototype;
|
|
23
|
+
} else a = {};
|
|
24
|
+
return Object.defineProperty(a, "__esModule", { value: !0 }), Object.keys(e).forEach(function(r) {
|
|
25
|
+
var n = Object.getOwnPropertyDescriptor(e, r);
|
|
26
|
+
Object.defineProperty(a, r, n.get ? n : {
|
|
27
|
+
enumerable: !0,
|
|
28
|
+
get: function() {
|
|
29
|
+
return e[r];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}), a;
|
|
33
|
+
}
|
|
34
|
+
var l = { exports: {} };
|
|
35
|
+
/*!
|
|
36
|
+
* reading-time
|
|
37
|
+
* Copyright (c) Nicolas Gryman <ngryman@gmail.com>
|
|
38
|
+
* MIT Licensed
|
|
39
|
+
*/
|
|
40
|
+
var x, w;
|
|
41
|
+
function v() {
|
|
42
|
+
if (w) return x;
|
|
43
|
+
w = 1;
|
|
44
|
+
function e(t, s) {
|
|
45
|
+
return s.some(
|
|
46
|
+
([i, f]) => i <= t && t <= f
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
function o(t) {
|
|
50
|
+
if (typeof t != "string")
|
|
51
|
+
return !1;
|
|
52
|
+
const s = t.charCodeAt(0);
|
|
53
|
+
return e(
|
|
54
|
+
s,
|
|
55
|
+
[
|
|
56
|
+
// Hiragana (Katakana not included on purpose,
|
|
57
|
+
// context: https://github.com/ngryman/reading-time/pull/35#issuecomment-853364526)
|
|
58
|
+
// If you think Katakana should be included and have solid reasons, improvement is welcomed
|
|
59
|
+
[12352, 12447],
|
|
60
|
+
// CJK Unified ideographs
|
|
61
|
+
[19968, 40959],
|
|
62
|
+
// Hangul
|
|
63
|
+
[44032, 55203],
|
|
64
|
+
// CJK extensions
|
|
65
|
+
[131072, 191456]
|
|
66
|
+
]
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
function a(t) {
|
|
70
|
+
return `
|
|
71
|
+
\r `.includes(t);
|
|
72
|
+
}
|
|
73
|
+
function r(t) {
|
|
74
|
+
if (typeof t != "string")
|
|
75
|
+
return !1;
|
|
76
|
+
const s = t.charCodeAt(0);
|
|
77
|
+
return e(
|
|
78
|
+
s,
|
|
79
|
+
[
|
|
80
|
+
[33, 47],
|
|
81
|
+
[58, 64],
|
|
82
|
+
[91, 96],
|
|
83
|
+
[123, 126],
|
|
84
|
+
// CJK Symbols and Punctuation
|
|
85
|
+
[12288, 12351],
|
|
86
|
+
// Full-width ASCII punctuation variants
|
|
87
|
+
[65280, 65519]
|
|
88
|
+
]
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
function n(t, s = {}) {
|
|
92
|
+
let i = 0, f = 0, h = t.length - 1;
|
|
93
|
+
const j = s.wordsPerMinute || 200, m = s.wordBound || a;
|
|
94
|
+
for (; m(t[f]); ) f++;
|
|
95
|
+
for (; m(t[h]); ) h--;
|
|
96
|
+
const d = `${t}
|
|
97
|
+
`;
|
|
98
|
+
for (let c = f; c <= h; c++)
|
|
99
|
+
if ((o(d[c]) || !m(d[c]) && (m(d[c + 1]) || o(d[c + 1]))) && i++, o(d[c]))
|
|
100
|
+
for (; c <= h && (r(d[c + 1]) || m(d[c + 1])); )
|
|
101
|
+
c++;
|
|
102
|
+
const g = i / j, O = Math.round(g * 60 * 1e3);
|
|
103
|
+
return {
|
|
104
|
+
text: Math.ceil(g.toFixed(2)) + " min read",
|
|
105
|
+
minutes: g,
|
|
106
|
+
time: O,
|
|
107
|
+
words: i
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
return x = n, x;
|
|
111
|
+
}
|
|
112
|
+
const z = {}, E = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
113
|
+
__proto__: null,
|
|
114
|
+
default: z
|
|
115
|
+
}, Symbol.toStringTag, { value: "Module" })), T = /* @__PURE__ */ I(E);
|
|
116
|
+
/*!
|
|
117
|
+
* reading-time
|
|
118
|
+
* Copyright (c) Nicolas Gryman <ngryman@gmail.com>
|
|
119
|
+
* MIT Licensed
|
|
120
|
+
*/
|
|
121
|
+
var p, _;
|
|
122
|
+
function F() {
|
|
123
|
+
if (_) return p;
|
|
124
|
+
_ = 1;
|
|
125
|
+
const e = v(), o = T.Transform, a = T;
|
|
126
|
+
function r(n) {
|
|
127
|
+
if (!(this instanceof r))
|
|
128
|
+
return new r(n);
|
|
129
|
+
o.call(this, { objectMode: !0 }), this.options = n || {}, this.stats = {
|
|
130
|
+
minutes: 0,
|
|
131
|
+
time: 0,
|
|
132
|
+
words: 0
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
return a.inherits(r, o), r.prototype._transform = function(n, t, s) {
|
|
136
|
+
const i = e(n.toString(t), this.options);
|
|
137
|
+
this.stats.minutes += i.minutes, this.stats.time += i.time, this.stats.words += i.words, s();
|
|
138
|
+
}, r.prototype._flush = function(n) {
|
|
139
|
+
this.stats.text = Math.ceil(this.stats.minutes.toFixed(2)) + " min read", this.push(this.stats), n();
|
|
140
|
+
}, p = r, p;
|
|
141
|
+
}
|
|
142
|
+
var b;
|
|
143
|
+
function U() {
|
|
144
|
+
return b || (b = 1, l.exports.default = l.exports = v(), l.exports.readingTimeStream = F()), l.exports;
|
|
145
|
+
}
|
|
146
|
+
var W = U();
|
|
147
|
+
const k = /* @__PURE__ */ C(W);
|
|
148
|
+
function Q(e) {
|
|
149
|
+
const o = new Date(e.created_at), a = new Date(e.updated_at), r = (i) => i.toLocaleDateString("en-US", {
|
|
150
|
+
year: "numeric",
|
|
151
|
+
month: "long",
|
|
152
|
+
day: "numeric"
|
|
153
|
+
}), n = e.description.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim(), t = k(n), s = a.getTime() !== o.getTime();
|
|
154
|
+
return /* @__PURE__ */ u(S, { maw: 800, mx: "auto", px: "sm", py: "lg", children: /* @__PURE__ */ y(M, { gap: "md", children: [
|
|
155
|
+
/* @__PURE__ */ u(R, { order: 1, children: e.title }),
|
|
156
|
+
/* @__PURE__ */ y(D, { size: "sm", c: "dimmed", children: [
|
|
157
|
+
t.text,
|
|
158
|
+
" · Written on ",
|
|
159
|
+
r(o),
|
|
160
|
+
s && ` · Updated on ${r(a)}`
|
|
161
|
+
] }),
|
|
162
|
+
e.banner_image && /* @__PURE__ */ u(
|
|
163
|
+
q,
|
|
12
164
|
{
|
|
13
165
|
id: e.id,
|
|
14
166
|
src: e.banner_image,
|
|
@@ -16,27 +168,27 @@ function b(e) {
|
|
|
16
168
|
config: e.config
|
|
17
169
|
}
|
|
18
170
|
),
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
|
|
171
|
+
/* @__PURE__ */ u(
|
|
172
|
+
A,
|
|
21
173
|
{
|
|
22
174
|
articleId: e.id,
|
|
23
175
|
html: e.description,
|
|
24
176
|
config: e.config
|
|
25
177
|
}
|
|
26
178
|
),
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
|
|
179
|
+
/* @__PURE__ */ u(P, { wrap: "wrap", gap: "md", align: "center", mb: "lg", children: e.tags.map((i) => /* @__PURE__ */ u("a", { href: i.href, children: /* @__PURE__ */ u(
|
|
180
|
+
B,
|
|
29
181
|
{
|
|
30
182
|
size: "md",
|
|
31
183
|
color: "sky.5",
|
|
32
184
|
variant: "outline",
|
|
33
|
-
leftSection: /* @__PURE__ */
|
|
185
|
+
leftSection: /* @__PURE__ */ u($, { size: 14 }),
|
|
34
186
|
style: { cursor: "pointer" },
|
|
35
|
-
children:
|
|
187
|
+
children: i.name
|
|
36
188
|
}
|
|
37
|
-
) },
|
|
189
|
+
) }, i.name)) })
|
|
38
190
|
] }) });
|
|
39
191
|
}
|
|
40
192
|
export {
|
|
41
|
-
|
|
193
|
+
Q as default
|
|
42
194
|
};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@k34a/blog",
|
|
3
3
|
"description": "Create and share articles with your audience.",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.18",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
],
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"dom-serializer": "^2.0.0",
|
|
59
|
-
"htmlparser2": "^10.0.0"
|
|
59
|
+
"htmlparser2": "^10.0.0",
|
|
60
|
+
"reading-time": "^1.5.0"
|
|
60
61
|
}
|
|
61
62
|
}
|