@brianyu28/dialexis 0.5.2 → 0.7.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.
package/dist/dialexis.mjs CHANGED
@@ -1,255 +1,255 @@
1
- import { FontWeight as L, Color as t, Text as h, getTextContentLength as Co, Rectangle as k, Group as z, Mask as No, Line as To, Presentation as xo } from "presenter";
2
- const Ao = "#0a0a0a", ko = { "": { 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 } }, Po = {
3
- backgroundColor: Ao,
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: ko
5
+ styles: Go
6
6
  };
7
- function K(o, e, r = !1) {
8
- if (typeof o == "string") {
9
- const c = P(e, "");
10
- return o.split(`
11
- `).map((a) => [{ text: a, color: c, fontWeight: L.NORMAL }]);
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 o.map(
14
- (c) => c.map((a) => ({
15
- text: a.content,
16
- color: P(e, a.type),
17
- fontWeight: r && j(e, a.type) ? L.BOLD : L.NORMAL
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 P(o, e) {
22
- const r = o.styles[e];
23
- if (r !== void 0 && r.color !== null)
24
- return t(r.color);
25
- if (e === "")
26
- throw new Error(`Theme did not define a style for token type: ${e}`);
27
- const c = e.split(".").slice(0, -1).join(".");
28
- return P(o, c);
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 j(o, e) {
31
- const r = o.styles[e];
32
- if (r !== void 0)
33
- return r.bold;
34
- if (e === "")
35
- throw new Error(`Theme did not define a style for token type: ${e}`);
36
- const c = e.split(".").slice(0, -1).join(".");
37
- return j(o, c);
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 Go = "'Noto Sans Mono', monospace", A = 2, Oo = 0.29, yo = 0.6, Do = 1.07;
40
- function Wo(o, e) {
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: r = !1,
43
- backgroundColor: c = null,
44
- backgroundRounding: a = 10,
45
- characterDescentHeight: O = Oo,
46
- characterWidth: d = yo,
47
- colCount: q = null,
48
- firstLineNumber: y = 1,
49
- focusColor: J = t(21, 52, 104),
50
- focusLineStart: Q = 1,
51
- focusLineEnd: Z = 1,
52
- focusColStart: oo = 1,
53
- focusColEnd: eo = 1,
54
- focusPaddingX: D = 0,
55
- focusPaddingY: M = 0,
56
- focusOffsetX: F = 0,
57
- focusOffsetY: U = 0,
58
- focusRounding: to = 0,
59
- fontFamily: S = Go,
60
- fragments: no = [],
61
- groupProps: ro = {},
62
- isBackgroundVisible: lo = !0,
63
- isFocusVisible: co = !1,
64
- lineNumberColor: io = t.WHITE,
65
- padding: f = 10,
66
- scrollCol: ao = 1,
67
- scrollLine: so = 1,
68
- lineCount: fo = null,
69
- lineHeight: u = Do,
70
- textProps: m = {},
71
- theme: C = Po
72
- } = e, n = m.fontSize ?? 100, s = m.lineSpacing ?? 1.15, b = K(o, C), uo = String(y + b.length - 1), g = r ? uo.length + A : 0, bo = Math.max(
73
- ...b.map((l) => l.reduce((i, E) => i + E.text.length, 0))
74
- ), N = ((q ?? bo) + g) * d * n, T = V({
75
- descenderHeight: O,
76
- fontSize: n,
77
- lineCount: fo ?? b.length,
78
- lineHeight: u,
79
- lineSpacing: s
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 x = null;
82
- r && (x = h(
83
- b.map((l, i) => [
81
+ let U = null;
82
+ t && (U = E(
83
+ L.map((i, a) => [
84
84
  {
85
- text: String(y + i).padStart(
86
- g - A,
85
+ text: String(h + a).padStart(
86
+ R - w,
87
87
  " "
88
- ) + " ".repeat(A),
89
- color: io
88
+ ) + " ".repeat(w),
89
+ color: ao
90
90
  }
91
91
  ]),
92
92
  {
93
- fontFamily: S,
94
- fontSize: n,
95
- lineSpacing: s,
96
- ...m,
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 go = Co(b), w = h(b, {
103
- fontFamily: S,
104
- fontSize: n,
105
- lineSpacing: s,
106
- ...m,
107
- x: g * d * n,
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
- }), H = no.map((l) => {
110
- const i = K(l.code, C);
111
- return h(i, {
112
- fontFamily: S,
113
- fontSize: n,
114
- lineSpacing: s,
115
- ...l.textProps,
116
- x: (g + l.startCol - 1) * d * n,
117
- y: (l.startLine - 1) * u * s * n
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 ho(l, i) {
120
+ function Lo(i, a) {
121
121
  return {
122
- x: (g + i - 1) * d * n,
123
- y: (l - 1) * u * s * n
122
+ x: (R + a - 1) * s * l,
123
+ y: (i - 1) * p * d * l
124
124
  };
125
125
  }
126
- const Lo = k({
127
- width: N + f * 2,
128
- height: T + f * 2,
129
- fill: c ?? t(C.backgroundColor),
130
- rounding: a,
131
- opacity: lo ? 1 : 0
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 I(l, i, E, mo, Eo) {
133
+ function v(i, a, x, Co, mo) {
134
134
  const {
135
- focusPaddingX: W = D,
136
- focusPaddingY: X = M,
137
- focusOffsetX: Ro = F,
138
- focusOffsetY: So = U
139
- } = Eo ?? {};
135
+ focusPaddingX: q = Y,
136
+ focusPaddingY: J = _,
137
+ focusOffsetX: So = W,
138
+ focusOffsetY: xo = z
139
+ } = mo ?? {};
140
140
  return {
141
- x: (g + E - 1) * d * n - W + Ro,
142
- y: (l - 1) * u * s * n - X + So,
143
- width: (mo - E + 1) * d * n + W * 2,
144
- height: V({
145
- descenderHeight: O,
146
- fontSize: n,
147
- lineCount: i - l + 1,
148
- lineHeight: u,
149
- lineSpacing: s
150
- }) + X * 2
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 Y = k({
154
- ...I(Q, Z, oo, eo, {
155
- focusOffsetX: F,
156
- focusOffsetY: U,
157
- focusPaddingX: D,
158
- focusPaddingY: M
153
+ const V = N({
154
+ ...v(k, P, y, ro, {
155
+ focusOffsetX: W,
156
+ focusOffsetY: z,
157
+ focusPaddingX: Y,
158
+ focusPaddingY: _
159
159
  }),
160
- fill: J,
161
- rounding: to,
162
- opacity: co ? 1 : 0
160
+ fillColor: C,
161
+ cornerRadius: no,
162
+ opacity: so ? 1 : 0
163
163
  });
164
- function _(l, i = 1) {
164
+ function j(i, a = 1) {
165
165
  return {
166
- x: f - (i - 1) * d * n,
167
- y: f - (l - 1) * u * s * n
166
+ x: b - (a - 1) * s * l,
167
+ y: b - (i - 1) * p * d * l
168
168
  };
169
169
  }
170
- const B = z(
171
- [...x !== null ? [x] : [], Y, w, ...H],
170
+ const $ = T(
171
+ [...U !== null ? [U] : [], V, K, ...X],
172
172
  {
173
- ..._(so, ao)
173
+ ...j(uo, fo)
174
174
  }
175
- ), po = No([B], {
176
- width: N + f * 2,
177
- height: T + f * 2
175
+ ), Eo = To([$], {
176
+ width: M + b * 2,
177
+ height: D + b * 2
178
178
  });
179
179
  return {
180
- block: z([Lo, po], {
181
- height: T + f * 2,
182
- width: N + f * 2,
183
- ...ro
180
+ block: T([Ro, Eo], {
181
+ height: D + b * 2,
182
+ width: M + b * 2,
183
+ ...co
184
184
  }),
185
- content: B,
186
- focus: Y,
187
- fragments: H,
188
- getContentPosition: _,
189
- getFocusPosition: I,
190
- getFragmentPosition: ho,
191
- length: go,
192
- text: w
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 V({
196
- descenderHeight: o = 0,
197
- fontSize: e,
198
- lineCount: r,
199
- lineHeight: c,
200
- lineSpacing: a
195
+ function Z({
196
+ descenderHeight: e = 0,
197
+ fontSize: o,
198
+ lineCount: t,
199
+ lineHeight: n,
200
+ lineSpacing: c
201
201
  }) {
202
- return e * // Each line takes up its height
203
- (r * c + // Each line other than the last line takes up extra space for line spacing
204
- Math.max(r - 1, 0) * c * (a - 1) + // Add space for descenders
205
- o);
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 p = {
208
- BACKGROUND: t(28, 28, 28),
209
- PRIMARY: t(255, 255, 255),
210
- TEXT: t(255, 255, 255),
211
- BLACK: t(0, 0, 0),
212
- WHITE: t(255, 255, 255),
213
- GRAY1: t(106, 106, 106),
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: t(65, 65, 65),
215
+ GRAY2: r(65, 65, 65),
216
216
  // Dark gray
217
- GRAY3: t(224, 224, 224),
217
+ GRAY3: r(224, 224, 224),
218
218
  // Light gray
219
- BLUE1: t(125, 157, 224),
219
+ BLUE1: r(125, 157, 224),
220
220
  // Light blue
221
- BLUE2: t(51, 56, 215),
221
+ BLUE2: r(51, 56, 215),
222
222
  // Dark blue
223
- GREEN1: t(102, 208, 89),
223
+ GREEN1: r(102, 208, 89),
224
224
  // Light green
225
- GREEN2: t(73, 143, 64),
225
+ GREEN2: r(73, 143, 64),
226
226
  // Dark green
227
- PURPLE1: t(136, 83, 173),
227
+ PURPLE1: r(136, 83, 173),
228
228
  // Medium purple
229
- PURPLE2: t(178, 126, 215),
229
+ PURPLE2: r(178, 126, 215),
230
230
  // Light purple
231
- RED1: t(225, 103, 103),
231
+ RED1: r(225, 103, 103),
232
232
  // Light red
233
- RED2: t(182, 75, 75),
233
+ RED2: r(182, 75, 75),
234
234
  // Dark red
235
- YELLOW1: t(240, 243, 90),
235
+ YELLOW1: r(240, 243, 90),
236
236
  // Medium yellow
237
- YELLOW2: t(231, 249, 147)
237
+ YELLOW2: r(231, 249, 147)
238
238
  // Lighter yellow
239
- }, v = {
239
+ }, eo = {
240
240
  PRIMARY: "'Open Sans', sans-serif",
241
241
  CODE: "'Noto Sans Mono', monospace"
242
- }, R = {
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
- }, Mo = {
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 Fo(o = null) {
271
- return To({
272
- color: p.PRIMARY,
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 Uo(o = null) {
279
- return xo({
280
- backgroundColor: p.BACKGROUND,
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 wo(o = null) {
285
- return k({
286
- fill: p.BLUE1,
287
- rounding: $.NORMAL,
288
- height: 500,
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
- const G = {
294
- color: p.TEXT,
295
- fontFamily: v.PRIMARY,
296
- fontSize: R.NORMAL
297
- };
298
- function Ho(o, e = null) {
299
- return h(o, {
300
- ...G,
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 Io(o, e = null) {
305
- return h(o, {
306
- ...G,
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 Yo(o, e = null) {
313
- return h(o, {
314
- ...G,
315
- fontSize: R.LARGE,
316
- fontWeight: L.BOLD,
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 Xo = {
378
+ const Vo = {
321
379
  // Constants
322
- Color: p,
323
- Font: v,
324
- FontSize: R,
325
- Rounding: $,
326
- Size: Mo,
380
+ Color: f,
381
+ Font: eo,
382
+ FontSize: A,
383
+ Rounding: to,
384
+ Size: Fo,
327
385
  // Components
328
- Line: Fo,
386
+ Line: Ho,
329
387
  MainTitleText: Io,
330
- Rectangle: wo,
331
- Text: Ho,
332
- TitleText: Yo,
388
+ Rectangle: _o,
389
+ Text: H,
390
+ TitleText: Bo,
333
391
  // Presentation
334
- Presentation: Uo
392
+ Presentation: Yo
335
393
  };
336
- function zo(o, e = {}) {
394
+ function jo(e, o = {}) {
337
395
  return {
338
- code: o,
396
+ code: e,
339
397
  startLine: 1,
340
398
  startCol: 1,
341
399
  textProps: {},
342
- ...e
400
+ ...o
343
401
  };
344
402
  }
345
403
  export {
346
- Wo as CodeBlock,
347
- zo as CodeFragment,
348
- Xo as Spark
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.5.2",
3
+ "version": "0.7.0",
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.7.3"
47
+ "presenter": "^0.9.1"
48
48
  },
49
49
  "lint-staged": {
50
50
  "**/*": [