@brianyu28/dialexis 0.6.0 → 0.7.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/dist/dialexis.mjs +293 -233
- package/dist/index.d.ts +2 -0
- package/dist/objects/GraphNode.d.ts +28 -0
- package/dist/objects/TextRect.d.ts +13 -0
- package/package.json +2 -2
package/dist/dialexis.mjs
CHANGED
|
@@ -1,255 +1,255 @@
|
|
|
1
|
-
import { FontWeight as
|
|
2
|
-
const
|
|
3
|
-
backgroundColor:
|
|
1
|
+
import { FontWeight as m, Color as r, Text as E, getTextContentLength as No, Rectangle as N, Group as T, Mask as To, Circle as Ao, Anchor as F, Line as ko, Presentation as Po } from "presenter";
|
|
2
|
+
const yo = "#0a0a0a", Go = { "": { color: "#e6edf3", bold: !1 }, Error: { color: "#f85149", bold: !1 }, Keyword: { color: "#ff7b72", bold: !1 }, "Keyword.Constant": { color: "#79c0ff", bold: !1 }, "Keyword.Pseudo": { color: "#79c0ff", bold: !1 }, Name: { color: "#e6edf3", bold: !1 }, "Name.Class": { color: "#f0883e", bold: !0 }, "Name.Constant": { color: "#79c0ff", bold: !0 }, "Name.Decorator": { color: "#d2a8ff", bold: !0 }, "Name.Entity": { color: "#ffa657", bold: !1 }, "Name.Exception": { color: "#f0883e", bold: !0 }, "Name.Function": { color: "#d2a8ff", bold: !0 }, "Name.Label": { color: "#79c0ff", bold: !0 }, "Name.Namespace": { color: "#ff7b72", bold: !1 }, "Name.Property": { color: "#79c0ff", bold: !1 }, "Name.Tag": { color: "#7ee787", bold: !1 }, "Name.Variable": { color: "#79c0ff", bold: !1 }, Literal: { color: "#a5d6ff", bold: !1 }, "Literal.Date": { color: "#79c0ff", bold: !1 }, "Literal.String": { color: "#a5d6ff", bold: !1 }, "Literal.String.Affix": { color: "#79c0ff", bold: !1 }, "Literal.String.Delimiter": { color: "#79c0ff", bold: !1 }, "Literal.String.Escape": { color: "#79c0ff", bold: !1 }, "Literal.String.Heredoc": { color: "#79c0ff", bold: !1 }, "Literal.String.Regex": { color: "#79c0ff", bold: !1 }, "Literal.Number": { color: "#a5d6ff", bold: !1 }, Comment: { color: "#8b949e", bold: !1 }, "Comment.Preproc": { color: "#8b949e", bold: !0 }, "Comment.Special": { color: "#8b949e", bold: !0 }, Operator: { color: "#ff7b72", bold: !0 }, Generic: { color: "#e6edf3", bold: !1 }, "Generic.Deleted": { color: "#ffa198", bold: !1 }, "Generic.Emph": { color: null, bold: !1 }, "Generic.Error": { color: "#ffa198", bold: !1 }, "Generic.Heading": { color: "#79c0ff", bold: !0 }, "Generic.Inserted": { color: "#56d364", bold: !1 }, "Generic.Output": { color: "#8b949e", bold: !1 }, "Generic.Prompt": { color: "#8b949e", bold: !1 }, "Generic.Strong": { color: null, bold: !0 }, "Generic.EmphStrong": { color: null, bold: !0 }, "Generic.Subheading": { color: "#79c0ff", bold: !1 }, "Generic.Traceback": { color: "#ff7b72", bold: !1 }, "Generic.Underline": { color: null, bold: !1 }, "Text.Whitespace": { color: "#6e7681", bold: !1 } }, Oo = {
|
|
3
|
+
backgroundColor: yo,
|
|
4
4
|
"//comment": "Pygments GitHub Dark theme with a darker background color.",
|
|
5
|
-
styles:
|
|
5
|
+
styles: Go
|
|
6
6
|
};
|
|
7
|
-
function
|
|
8
|
-
if (typeof
|
|
9
|
-
const
|
|
10
|
-
return
|
|
11
|
-
`).map((
|
|
7
|
+
function Q(e, o, t = !1) {
|
|
8
|
+
if (typeof e == "string") {
|
|
9
|
+
const n = I(o, "");
|
|
10
|
+
return e.split(`
|
|
11
|
+
`).map((c) => [{ text: c, color: n, fontWeight: m.NORMAL }]);
|
|
12
12
|
}
|
|
13
|
-
return
|
|
14
|
-
(
|
|
15
|
-
text:
|
|
16
|
-
color:
|
|
17
|
-
fontWeight:
|
|
13
|
+
return e.map(
|
|
14
|
+
(n) => n.map((c) => ({
|
|
15
|
+
text: c.content,
|
|
16
|
+
color: I(o, c.type),
|
|
17
|
+
fontWeight: t && oo(o, c.type) ? m.BOLD : m.NORMAL
|
|
18
18
|
}))
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
24
|
-
return t
|
|
25
|
-
if (
|
|
26
|
-
throw new Error(`Theme did not define a style for token type: ${
|
|
27
|
-
const
|
|
28
|
-
return
|
|
21
|
+
function I(e, o) {
|
|
22
|
+
const t = e.styles[o];
|
|
23
|
+
if (t !== void 0 && t.color !== null)
|
|
24
|
+
return r(t.color);
|
|
25
|
+
if (o === "")
|
|
26
|
+
throw new Error(`Theme did not define a style for token type: ${o}`);
|
|
27
|
+
const n = o.split(".").slice(0, -1).join(".");
|
|
28
|
+
return I(e, n);
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
return
|
|
34
|
-
if (
|
|
35
|
-
throw new Error(`Theme did not define a style for token type: ${
|
|
36
|
-
const
|
|
37
|
-
return
|
|
30
|
+
function oo(e, o) {
|
|
31
|
+
const t = e.styles[o];
|
|
32
|
+
if (t !== void 0)
|
|
33
|
+
return t.bold;
|
|
34
|
+
if (o === "")
|
|
35
|
+
throw new Error(`Theme did not define a style for token type: ${o}`);
|
|
36
|
+
const n = o.split(".").slice(0, -1).join(".");
|
|
37
|
+
return oo(e, n);
|
|
38
38
|
}
|
|
39
|
-
const
|
|
40
|
-
function
|
|
39
|
+
const Mo = "'Noto Sans Mono', monospace", w = 2, Do = 0.29, Uo = 0.6, wo = 1;
|
|
40
|
+
function Ko(e, o) {
|
|
41
41
|
const {
|
|
42
|
-
areLineNumbersVisible:
|
|
43
|
-
backgroundColor:
|
|
44
|
-
backgroundRounding:
|
|
45
|
-
characterDescentHeight:
|
|
46
|
-
characterWidth:
|
|
47
|
-
colCount:
|
|
48
|
-
firstLineNumber:
|
|
49
|
-
focusColor:
|
|
50
|
-
focusLineStart:
|
|
51
|
-
focusLineEnd:
|
|
52
|
-
focusColStart:
|
|
53
|
-
focusColEnd:
|
|
54
|
-
focusPaddingX:
|
|
55
|
-
focusPaddingY:
|
|
56
|
-
focusOffsetX:
|
|
57
|
-
focusOffsetY:
|
|
58
|
-
focusRounding:
|
|
59
|
-
fontFamily:
|
|
60
|
-
fragments:
|
|
61
|
-
groupProps:
|
|
62
|
-
isBackgroundVisible:
|
|
63
|
-
isFocusVisible:
|
|
64
|
-
lineNumberColor:
|
|
65
|
-
padding:
|
|
66
|
-
scrollCol:
|
|
67
|
-
scrollLine:
|
|
68
|
-
lineCount:
|
|
69
|
-
lineHeight:
|
|
70
|
-
textProps:
|
|
71
|
-
theme:
|
|
72
|
-
} =
|
|
73
|
-
...
|
|
74
|
-
),
|
|
75
|
-
descenderHeight:
|
|
76
|
-
fontSize:
|
|
77
|
-
lineCount:
|
|
78
|
-
lineHeight:
|
|
79
|
-
lineSpacing:
|
|
42
|
+
areLineNumbersVisible: t = !1,
|
|
43
|
+
backgroundColor: n = null,
|
|
44
|
+
backgroundRounding: c = 10,
|
|
45
|
+
characterDescentHeight: u = Do,
|
|
46
|
+
characterWidth: s = Uo,
|
|
47
|
+
colCount: g = null,
|
|
48
|
+
firstLineNumber: h = 1,
|
|
49
|
+
focusColor: C = r(21, 52, 104),
|
|
50
|
+
focusLineStart: k = 1,
|
|
51
|
+
focusLineEnd: P = 1,
|
|
52
|
+
focusColStart: y = 1,
|
|
53
|
+
focusColEnd: ro = 1,
|
|
54
|
+
focusPaddingX: Y = 0,
|
|
55
|
+
focusPaddingY: _ = 0,
|
|
56
|
+
focusOffsetX: W = 0,
|
|
57
|
+
focusOffsetY: z = 0,
|
|
58
|
+
focusRounding: no = 0,
|
|
59
|
+
fontFamily: G = Mo,
|
|
60
|
+
fragments: lo = [],
|
|
61
|
+
groupProps: co = {},
|
|
62
|
+
isBackgroundVisible: io = !0,
|
|
63
|
+
isFocusVisible: so = !1,
|
|
64
|
+
lineNumberColor: ao = r.WHITE,
|
|
65
|
+
padding: b = 10,
|
|
66
|
+
scrollCol: fo = 1,
|
|
67
|
+
scrollLine: uo = 1,
|
|
68
|
+
lineCount: go = null,
|
|
69
|
+
lineHeight: p = wo,
|
|
70
|
+
textProps: S = {},
|
|
71
|
+
theme: O = Oo
|
|
72
|
+
} = o, l = S.fontSize ?? 100, d = S.lineSpacing ?? 1.15, L = Q(e, O), bo = String(h + L.length - 1), R = t ? bo.length + w : 0, ho = Math.max(
|
|
73
|
+
...L.map((i) => i.reduce((a, x) => a + x.text.length, 0))
|
|
74
|
+
), M = ((g ?? ho) + R) * s * l, D = Z({
|
|
75
|
+
descenderHeight: u,
|
|
76
|
+
fontSize: l,
|
|
77
|
+
lineCount: go ?? L.length,
|
|
78
|
+
lineHeight: p,
|
|
79
|
+
lineSpacing: d
|
|
80
80
|
});
|
|
81
|
-
let
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
let U = null;
|
|
82
|
+
t && (U = E(
|
|
83
|
+
L.map((i, a) => [
|
|
84
84
|
{
|
|
85
|
-
text: String(
|
|
86
|
-
|
|
85
|
+
text: String(h + a).padStart(
|
|
86
|
+
R - w,
|
|
87
87
|
" "
|
|
88
|
-
) + " ".repeat(
|
|
89
|
-
color:
|
|
88
|
+
) + " ".repeat(w),
|
|
89
|
+
color: ao
|
|
90
90
|
}
|
|
91
91
|
]),
|
|
92
92
|
{
|
|
93
|
-
fontFamily:
|
|
94
|
-
fontSize:
|
|
95
|
-
lineSpacing:
|
|
96
|
-
...
|
|
93
|
+
fontFamily: G,
|
|
94
|
+
fontSize: l,
|
|
95
|
+
lineSpacing: d,
|
|
96
|
+
...S,
|
|
97
97
|
length: null,
|
|
98
98
|
x: 0,
|
|
99
99
|
y: 0
|
|
100
100
|
}
|
|
101
101
|
));
|
|
102
|
-
const
|
|
103
|
-
fontFamily:
|
|
104
|
-
fontSize:
|
|
105
|
-
lineSpacing:
|
|
106
|
-
...
|
|
107
|
-
x:
|
|
102
|
+
const po = No(L), K = E(L, {
|
|
103
|
+
fontFamily: G,
|
|
104
|
+
fontSize: l,
|
|
105
|
+
lineSpacing: d,
|
|
106
|
+
...S,
|
|
107
|
+
x: R * s * l,
|
|
108
108
|
y: 0
|
|
109
|
-
}),
|
|
110
|
-
const
|
|
111
|
-
return
|
|
112
|
-
fontFamily:
|
|
113
|
-
fontSize:
|
|
114
|
-
lineSpacing:
|
|
115
|
-
...
|
|
116
|
-
x: (
|
|
117
|
-
y: (
|
|
109
|
+
}), X = lo.map((i) => {
|
|
110
|
+
const a = Q(i.code, O);
|
|
111
|
+
return E(a, {
|
|
112
|
+
fontFamily: G,
|
|
113
|
+
fontSize: l,
|
|
114
|
+
lineSpacing: d,
|
|
115
|
+
...i.textProps,
|
|
116
|
+
x: (R + i.startCol - 1) * s * l,
|
|
117
|
+
y: (i.startLine - 1) * p * d * l
|
|
118
118
|
});
|
|
119
119
|
});
|
|
120
|
-
function
|
|
120
|
+
function Lo(i, a) {
|
|
121
121
|
return {
|
|
122
|
-
x: (
|
|
123
|
-
y: (
|
|
122
|
+
x: (R + a - 1) * s * l,
|
|
123
|
+
y: (i - 1) * p * d * l
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
|
-
const
|
|
127
|
-
width:
|
|
128
|
-
height:
|
|
129
|
-
fillColor:
|
|
130
|
-
cornerRadius:
|
|
131
|
-
opacity:
|
|
126
|
+
const Ro = N({
|
|
127
|
+
width: M + b * 2,
|
|
128
|
+
height: D + b * 2,
|
|
129
|
+
fillColor: n ?? r(O.backgroundColor),
|
|
130
|
+
cornerRadius: c,
|
|
131
|
+
opacity: io ? 1 : 0
|
|
132
132
|
});
|
|
133
|
-
function
|
|
133
|
+
function v(i, a, x, Co, mo) {
|
|
134
134
|
const {
|
|
135
|
-
focusPaddingX:
|
|
136
|
-
focusPaddingY:
|
|
137
|
-
focusOffsetX:
|
|
138
|
-
focusOffsetY:
|
|
139
|
-
} =
|
|
135
|
+
focusPaddingX: q = Y,
|
|
136
|
+
focusPaddingY: J = _,
|
|
137
|
+
focusOffsetX: So = W,
|
|
138
|
+
focusOffsetY: xo = z
|
|
139
|
+
} = mo ?? {};
|
|
140
140
|
return {
|
|
141
|
-
x: (
|
|
142
|
-
y: (
|
|
143
|
-
width: (
|
|
144
|
-
height:
|
|
145
|
-
descenderHeight:
|
|
146
|
-
fontSize:
|
|
147
|
-
lineCount:
|
|
148
|
-
lineHeight:
|
|
149
|
-
lineSpacing:
|
|
150
|
-
}) +
|
|
141
|
+
x: (R + x - 1) * s * l - q + So,
|
|
142
|
+
y: (i - 1) * p * d * l - J + xo,
|
|
143
|
+
width: (Co - x + 1) * s * l + q * 2,
|
|
144
|
+
height: Z({
|
|
145
|
+
descenderHeight: u,
|
|
146
|
+
fontSize: l,
|
|
147
|
+
lineCount: a - i + 1,
|
|
148
|
+
lineHeight: p,
|
|
149
|
+
lineSpacing: d
|
|
150
|
+
}) + J * 2
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
|
-
const
|
|
154
|
-
...
|
|
155
|
-
focusOffsetX:
|
|
156
|
-
focusOffsetY:
|
|
157
|
-
focusPaddingX:
|
|
158
|
-
focusPaddingY:
|
|
153
|
+
const V = N({
|
|
154
|
+
...v(k, P, y, ro, {
|
|
155
|
+
focusOffsetX: W,
|
|
156
|
+
focusOffsetY: z,
|
|
157
|
+
focusPaddingX: Y,
|
|
158
|
+
focusPaddingY: _
|
|
159
159
|
}),
|
|
160
|
-
fillColor:
|
|
161
|
-
cornerRadius:
|
|
162
|
-
opacity:
|
|
160
|
+
fillColor: C,
|
|
161
|
+
cornerRadius: no,
|
|
162
|
+
opacity: so ? 1 : 0
|
|
163
163
|
});
|
|
164
|
-
function
|
|
164
|
+
function j(i, a = 1) {
|
|
165
165
|
return {
|
|
166
|
-
x:
|
|
167
|
-
y:
|
|
166
|
+
x: b - (a - 1) * s * l,
|
|
167
|
+
y: b - (i - 1) * p * d * l
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
|
-
const
|
|
171
|
-
[...
|
|
170
|
+
const $ = T(
|
|
171
|
+
[...U !== null ? [U] : [], V, K, ...X],
|
|
172
172
|
{
|
|
173
|
-
...
|
|
173
|
+
...j(uo, fo)
|
|
174
174
|
}
|
|
175
|
-
),
|
|
176
|
-
width:
|
|
177
|
-
height:
|
|
175
|
+
), Eo = To([$], {
|
|
176
|
+
width: M + b * 2,
|
|
177
|
+
height: D + b * 2
|
|
178
178
|
});
|
|
179
179
|
return {
|
|
180
|
-
block:
|
|
181
|
-
height:
|
|
182
|
-
width:
|
|
183
|
-
...
|
|
180
|
+
block: T([Ro, Eo], {
|
|
181
|
+
height: D + b * 2,
|
|
182
|
+
width: M + b * 2,
|
|
183
|
+
...co
|
|
184
184
|
}),
|
|
185
|
-
content:
|
|
186
|
-
focus:
|
|
187
|
-
fragments:
|
|
188
|
-
getContentPosition:
|
|
189
|
-
getFocusPosition:
|
|
190
|
-
getFragmentPosition:
|
|
191
|
-
length:
|
|
192
|
-
text:
|
|
185
|
+
content: $,
|
|
186
|
+
focus: V,
|
|
187
|
+
fragments: X,
|
|
188
|
+
getContentPosition: j,
|
|
189
|
+
getFocusPosition: v,
|
|
190
|
+
getFragmentPosition: Lo,
|
|
191
|
+
length: po,
|
|
192
|
+
text: K
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
|
-
function
|
|
196
|
-
descenderHeight:
|
|
197
|
-
fontSize:
|
|
198
|
-
lineCount:
|
|
199
|
-
lineHeight:
|
|
200
|
-
lineSpacing:
|
|
195
|
+
function Z({
|
|
196
|
+
descenderHeight: e = 0,
|
|
197
|
+
fontSize: o,
|
|
198
|
+
lineCount: t,
|
|
199
|
+
lineHeight: n,
|
|
200
|
+
lineSpacing: c
|
|
201
201
|
}) {
|
|
202
|
-
return
|
|
203
|
-
(
|
|
204
|
-
Math.max(
|
|
205
|
-
|
|
202
|
+
return o * // Each line takes up its height
|
|
203
|
+
(t * n + // Each line other than the last line takes up extra space for line spacing
|
|
204
|
+
Math.max(t - 1, 0) * n * (c - 1) + // Add space for descenders
|
|
205
|
+
e);
|
|
206
206
|
}
|
|
207
|
-
const
|
|
208
|
-
BACKGROUND:
|
|
209
|
-
PRIMARY:
|
|
210
|
-
TEXT:
|
|
211
|
-
BLACK:
|
|
212
|
-
WHITE:
|
|
213
|
-
GRAY1:
|
|
207
|
+
const f = {
|
|
208
|
+
BACKGROUND: r(28, 28, 28),
|
|
209
|
+
PRIMARY: r(255, 255, 255),
|
|
210
|
+
TEXT: r(255, 255, 255),
|
|
211
|
+
BLACK: r(0, 0, 0),
|
|
212
|
+
WHITE: r(255, 255, 255),
|
|
213
|
+
GRAY1: r(106, 106, 106),
|
|
214
214
|
// Medium gray
|
|
215
|
-
GRAY2:
|
|
215
|
+
GRAY2: r(65, 65, 65),
|
|
216
216
|
// Dark gray
|
|
217
|
-
GRAY3:
|
|
217
|
+
GRAY3: r(224, 224, 224),
|
|
218
218
|
// Light gray
|
|
219
|
-
BLUE1:
|
|
219
|
+
BLUE1: r(125, 157, 224),
|
|
220
220
|
// Light blue
|
|
221
|
-
BLUE2:
|
|
221
|
+
BLUE2: r(51, 56, 215),
|
|
222
222
|
// Dark blue
|
|
223
|
-
GREEN1:
|
|
223
|
+
GREEN1: r(102, 208, 89),
|
|
224
224
|
// Light green
|
|
225
|
-
GREEN2:
|
|
225
|
+
GREEN2: r(73, 143, 64),
|
|
226
226
|
// Dark green
|
|
227
|
-
PURPLE1:
|
|
227
|
+
PURPLE1: r(136, 83, 173),
|
|
228
228
|
// Medium purple
|
|
229
|
-
PURPLE2:
|
|
229
|
+
PURPLE2: r(178, 126, 215),
|
|
230
230
|
// Light purple
|
|
231
|
-
RED1:
|
|
231
|
+
RED1: r(225, 103, 103),
|
|
232
232
|
// Light red
|
|
233
|
-
RED2:
|
|
233
|
+
RED2: r(182, 75, 75),
|
|
234
234
|
// Dark red
|
|
235
|
-
YELLOW1:
|
|
235
|
+
YELLOW1: r(240, 243, 90),
|
|
236
236
|
// Medium yellow
|
|
237
|
-
YELLOW2:
|
|
237
|
+
YELLOW2: r(231, 249, 147)
|
|
238
238
|
// Lighter yellow
|
|
239
|
-
},
|
|
239
|
+
}, eo = {
|
|
240
240
|
PRIMARY: "'Open Sans', sans-serif",
|
|
241
241
|
CODE: "'Noto Sans Mono', monospace"
|
|
242
|
-
},
|
|
242
|
+
}, A = {
|
|
243
243
|
SMALL: 80,
|
|
244
244
|
NORMAL: 110,
|
|
245
245
|
MEDIUM: 160,
|
|
246
246
|
LARGE: 200,
|
|
247
247
|
XLARGE: 230
|
|
248
|
-
},
|
|
248
|
+
}, to = {
|
|
249
249
|
SMALL: 10,
|
|
250
250
|
NORMAL: 20,
|
|
251
251
|
LARGE: 30
|
|
252
|
-
},
|
|
252
|
+
}, Fo = {
|
|
253
253
|
PRIMARY: {
|
|
254
254
|
width: 3840,
|
|
255
255
|
height: 2160
|
|
@@ -266,84 +266,144 @@ const p = {
|
|
|
266
266
|
width: 7680,
|
|
267
267
|
height: 4320
|
|
268
268
|
}
|
|
269
|
+
}, B = {
|
|
270
|
+
color: f.TEXT,
|
|
271
|
+
fontFamily: eo.PRIMARY,
|
|
272
|
+
fontSize: A.NORMAL
|
|
269
273
|
};
|
|
270
|
-
function
|
|
271
|
-
return
|
|
272
|
-
|
|
273
|
-
isRounded: !0,
|
|
274
|
-
width: 20,
|
|
274
|
+
function H(e, o = null) {
|
|
275
|
+
return E(e, {
|
|
276
|
+
...B,
|
|
275
277
|
...o
|
|
276
278
|
});
|
|
277
279
|
}
|
|
278
|
-
function
|
|
279
|
-
return
|
|
280
|
-
|
|
280
|
+
function Io(e, o = null) {
|
|
281
|
+
return E(e, {
|
|
282
|
+
...B,
|
|
283
|
+
fontSize: A.XLARGE,
|
|
284
|
+
fontWeight: m.BOLD,
|
|
281
285
|
...o
|
|
282
286
|
});
|
|
283
287
|
}
|
|
284
|
-
function
|
|
285
|
-
return
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
width: 500,
|
|
288
|
+
function Bo(e, o = null) {
|
|
289
|
+
return E(e, {
|
|
290
|
+
...B,
|
|
291
|
+
fontSize: A.LARGE,
|
|
292
|
+
fontWeight: m.BOLD,
|
|
290
293
|
...o
|
|
291
294
|
});
|
|
292
295
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
296
|
+
function Xo(e = {}) {
|
|
297
|
+
const {
|
|
298
|
+
size: o = 200,
|
|
299
|
+
x: t = 0,
|
|
300
|
+
y: n = 0,
|
|
301
|
+
opacity: c = 1,
|
|
302
|
+
circleProps: u = {},
|
|
303
|
+
groupProps: s = {},
|
|
304
|
+
textProps: g = void 0
|
|
305
|
+
} = e, h = Ao({
|
|
306
|
+
radius: o / 2,
|
|
307
|
+
fillColor: f.PRIMARY,
|
|
308
|
+
strokeColor: f.BLUE1,
|
|
309
|
+
strokeWidth: o / 10,
|
|
310
|
+
x: o / 2,
|
|
311
|
+
y: o / 2,
|
|
312
|
+
...u
|
|
313
|
+
}), C = g !== void 0 ? H(g.text ?? "", {
|
|
314
|
+
anchor: F.CENTER,
|
|
315
|
+
color: r.BLACK,
|
|
316
|
+
x: o / 2,
|
|
317
|
+
y: o / 2,
|
|
318
|
+
fontSize: o * 0.5,
|
|
319
|
+
...g
|
|
320
|
+
}) : void 0, k = T([h, ...C !== void 0 ? [C] : []], {
|
|
321
|
+
width: o,
|
|
322
|
+
height: o,
|
|
323
|
+
x: t,
|
|
324
|
+
y: n,
|
|
325
|
+
anchor: F.CENTER,
|
|
326
|
+
opacity: c,
|
|
327
|
+
...s
|
|
328
|
+
});
|
|
329
|
+
function P() {
|
|
330
|
+
return { x: t, y: n - o / 2 - 30 };
|
|
331
|
+
}
|
|
332
|
+
function y() {
|
|
333
|
+
return { x: t, y: n + o / 2 + 30 };
|
|
334
|
+
}
|
|
335
|
+
return { circle: h, text: C, group: k, x: t, y: n, size: o, top: P, bottom: y };
|
|
336
|
+
}
|
|
337
|
+
function vo(e, { groupProps: o = {}, rectProps: t = {}, textProps: n = {} } = {}) {
|
|
338
|
+
const c = t.height ?? 300, u = t.width ?? 800, s = N({
|
|
339
|
+
strokeColor: f.BLUE1,
|
|
340
|
+
strokeWidth: 20,
|
|
341
|
+
fillColor: f.PRIMARY,
|
|
342
|
+
cornerRadius: 20,
|
|
343
|
+
...t,
|
|
344
|
+
height: c,
|
|
345
|
+
width: u
|
|
346
|
+
}), g = H(e, {
|
|
347
|
+
color: f.BLACK,
|
|
348
|
+
anchor: F.CENTER,
|
|
349
|
+
x: u / 2,
|
|
350
|
+
y: c / 2,
|
|
351
|
+
...n
|
|
352
|
+
});
|
|
353
|
+
return { group: T([s, g], { width: u, height: c, ...o }), rect: s, text: g };
|
|
354
|
+
}
|
|
355
|
+
function Ho(e = null) {
|
|
356
|
+
return ko({
|
|
357
|
+
color: f.PRIMARY,
|
|
358
|
+
isRounded: !0,
|
|
359
|
+
width: 20,
|
|
301
360
|
...e
|
|
302
361
|
});
|
|
303
362
|
}
|
|
304
|
-
function
|
|
305
|
-
return
|
|
306
|
-
|
|
307
|
-
fontSize: R.XLARGE,
|
|
308
|
-
fontWeight: L.BOLD,
|
|
363
|
+
function Yo(e = null) {
|
|
364
|
+
return Po({
|
|
365
|
+
backgroundColor: f.BACKGROUND,
|
|
309
366
|
...e
|
|
310
367
|
});
|
|
311
368
|
}
|
|
312
|
-
function
|
|
313
|
-
return
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
369
|
+
function _o(e = null) {
|
|
370
|
+
return N({
|
|
371
|
+
fillColor: f.BLUE1,
|
|
372
|
+
cornerRadius: to.NORMAL,
|
|
373
|
+
height: 500,
|
|
374
|
+
width: 500,
|
|
317
375
|
...e
|
|
318
376
|
});
|
|
319
377
|
}
|
|
320
|
-
const
|
|
378
|
+
const Vo = {
|
|
321
379
|
// Constants
|
|
322
|
-
Color:
|
|
323
|
-
Font:
|
|
324
|
-
FontSize:
|
|
325
|
-
Rounding:
|
|
326
|
-
Size:
|
|
380
|
+
Color: f,
|
|
381
|
+
Font: eo,
|
|
382
|
+
FontSize: A,
|
|
383
|
+
Rounding: to,
|
|
384
|
+
Size: Fo,
|
|
327
385
|
// Components
|
|
328
|
-
Line:
|
|
386
|
+
Line: Ho,
|
|
329
387
|
MainTitleText: Io,
|
|
330
|
-
Rectangle:
|
|
331
|
-
Text:
|
|
332
|
-
TitleText:
|
|
388
|
+
Rectangle: _o,
|
|
389
|
+
Text: H,
|
|
390
|
+
TitleText: Bo,
|
|
333
391
|
// Presentation
|
|
334
|
-
Presentation:
|
|
392
|
+
Presentation: Yo
|
|
335
393
|
};
|
|
336
|
-
function
|
|
394
|
+
function jo(e, o = {}) {
|
|
337
395
|
return {
|
|
338
|
-
code:
|
|
396
|
+
code: e,
|
|
339
397
|
startLine: 1,
|
|
340
398
|
startCol: 1,
|
|
341
399
|
textProps: {},
|
|
342
|
-
...
|
|
400
|
+
...o
|
|
343
401
|
};
|
|
344
402
|
}
|
|
345
403
|
export {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
Xo as
|
|
404
|
+
Ko as CodeBlock,
|
|
405
|
+
jo as CodeFragment,
|
|
406
|
+
Xo as GraphNode,
|
|
407
|
+
Vo as Spark,
|
|
408
|
+
vo as TextRect
|
|
349
409
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { CodeBlock } from "./objects/CodeBlock";
|
|
2
|
+
export { GraphNode } from "./objects/GraphNode";
|
|
3
|
+
export { TextRect } from "./objects/TextRect";
|
|
2
4
|
export { Spark } from "./themes/spark/Spark";
|
|
3
5
|
export { type CodeBlockContent } from "./types/CodeBlockContent";
|
|
4
6
|
export { type CodeBlockTheme } from "./types/CodeBlockTheme";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Circle, Group, Text } from "presenter";
|
|
2
|
+
interface GraphNodeProps {
|
|
3
|
+
readonly size: number;
|
|
4
|
+
readonly x: number;
|
|
5
|
+
readonly y: number;
|
|
6
|
+
readonly opacity: number;
|
|
7
|
+
readonly circleProps: Partial<Circle>;
|
|
8
|
+
readonly groupProps: Partial<Group>;
|
|
9
|
+
readonly textProps: Partial<Text> | undefined;
|
|
10
|
+
}
|
|
11
|
+
interface Return {
|
|
12
|
+
readonly circle: Circle;
|
|
13
|
+
readonly text: Text | undefined;
|
|
14
|
+
readonly group: Group;
|
|
15
|
+
readonly x: number;
|
|
16
|
+
readonly y: number;
|
|
17
|
+
readonly size: number;
|
|
18
|
+
readonly top: () => {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
};
|
|
22
|
+
readonly bottom: () => {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export declare function GraphNode(props?: Partial<GraphNodeProps>): Return;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Group, Rectangle, Text, type TextContent } from "presenter";
|
|
2
|
+
export interface TextRect {
|
|
3
|
+
groupProps: Partial<Group>;
|
|
4
|
+
rectProps: Partial<Rectangle>;
|
|
5
|
+
textProps: Partial<Text>;
|
|
6
|
+
}
|
|
7
|
+
interface Return {
|
|
8
|
+
readonly group: Group;
|
|
9
|
+
readonly text: Text;
|
|
10
|
+
readonly rect: Rectangle;
|
|
11
|
+
}
|
|
12
|
+
export declare function TextRect(text: TextContent, { groupProps, rectProps, textProps }?: Partial<TextRect>): Return;
|
|
13
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brianyu28/dialexis",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Presentation library built with Presenter.js",
|
|
5
5
|
"main": "dist/dialexis.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"vite": "^6.1.5"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"presenter": "^0.
|
|
47
|
+
"presenter": "^0.9.4"
|
|
48
48
|
},
|
|
49
49
|
"lint-staged": {
|
|
50
50
|
"**/*": [
|