@sciexpr/presets 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.
- package/dist/index.cjs +631 -0
- package/dist/index.d.cts +72 -0
- package/dist/index.d.ts +72 -0
- package/dist/index.js +582 -0
- package/package.json +63 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,631 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
ALGEBRA_TEMPLATES: () => ALGEBRA_TEMPLATES,
|
|
24
|
+
ALL_CHEM_TEMPLATES: () => ALL_CHEM_TEMPLATES,
|
|
25
|
+
ALL_GREEK: () => ALL_GREEK,
|
|
26
|
+
ALL_MATH_TEMPLATES: () => ALL_MATH_TEMPLATES,
|
|
27
|
+
CALCULUS_TEMPLATES: () => CALCULUS_TEMPLATES,
|
|
28
|
+
COMPOUND_TEMPLATES: () => COMPOUND_TEMPLATES,
|
|
29
|
+
ELECTROCHEM_TEMPLATES: () => ELECTROCHEM_TEMPLATES,
|
|
30
|
+
GREEK_GROUPS: () => GREEK_GROUPS,
|
|
31
|
+
GREEK_LOWERCASE_GROUP: () => GREEK_LOWERCASE_GROUP,
|
|
32
|
+
GREEK_UPPERCASE_GROUP: () => GREEK_UPPERCASE_GROUP,
|
|
33
|
+
LINEAR_ALGEBRA_TEMPLATES: () => LINEAR_ALGEBRA_TEMPLATES,
|
|
34
|
+
PHYSICS_TEMPLATES: () => PHYSICS_TEMPLATES,
|
|
35
|
+
REACTION_TEMPLATES: () => REACTION_TEMPLATES,
|
|
36
|
+
STATS_TEMPLATES: () => STATS_TEMPLATES,
|
|
37
|
+
TRIG_TEMPLATES: () => TRIG_TEMPLATES,
|
|
38
|
+
getAcids: () => getAcids,
|
|
39
|
+
getBases: () => getBases,
|
|
40
|
+
getTemplateById: () => getTemplateById,
|
|
41
|
+
getTemplatesByCategory: () => getTemplatesByCategory,
|
|
42
|
+
searchCompounds: () => searchCompounds,
|
|
43
|
+
searchGreek: () => searchGreek,
|
|
44
|
+
searchGreekWithVariants: () => searchGreekWithVariants,
|
|
45
|
+
searchTemplates: () => searchTemplates
|
|
46
|
+
});
|
|
47
|
+
module.exports = __toCommonJS(index_exports);
|
|
48
|
+
|
|
49
|
+
// src/math-templates.ts
|
|
50
|
+
var CALCULUS_TEMPLATES = [
|
|
51
|
+
{
|
|
52
|
+
id: "derivative-def",
|
|
53
|
+
name: "\u5BFC\u6570\u5B9A\u4E49",
|
|
54
|
+
latex: "f'(x) = \\lim_{h \\to 0} \\frac{f(x+h) - f(x)}{h}",
|
|
55
|
+
category: "calculus",
|
|
56
|
+
description: "\u5BFC\u6570\u7684\u6781\u9650\u5B9A\u4E49",
|
|
57
|
+
tags: ["derivative", "limit", "definition"]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "power-rule",
|
|
61
|
+
name: "\u5E42\u51FD\u6570\u6C42\u5BFC",
|
|
62
|
+
latex: "\\frac{d}{dx} x^{n} = n x^{n-1}",
|
|
63
|
+
category: "calculus",
|
|
64
|
+
description: "\u5E42\u6CD5\u5219",
|
|
65
|
+
tags: ["derivative", "power", "rule"]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: "product-rule",
|
|
69
|
+
name: "\u4E58\u79EF\u6CD5\u5219",
|
|
70
|
+
latex: "\\frac{d}{dx} [f(x) g(x)] = f'(x)g(x) + f(x)g'(x)",
|
|
71
|
+
category: "calculus",
|
|
72
|
+
description: "\u4E58\u79EF\u6C42\u5BFC\u6CD5\u5219",
|
|
73
|
+
tags: ["derivative", "product", "rule"]
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: "chain-rule",
|
|
77
|
+
name: "\u94FE\u5F0F\u6CD5\u5219",
|
|
78
|
+
latex: "\\frac{d}{dx} f(g(x)) = f'(g(x)) \\cdot g'(x)",
|
|
79
|
+
category: "calculus",
|
|
80
|
+
description: "\u94FE\u5F0F\u6C42\u5BFC\u6CD5\u5219",
|
|
81
|
+
tags: ["derivative", "chain", "rule"]
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "integral-def",
|
|
85
|
+
name: "\u5B9A\u79EF\u5206\u5B9A\u4E49",
|
|
86
|
+
latex: "\\int_{a}^{b} f(x) dx = \\lim_{n \\to \\infty} \\sum_{i=1}^{n} f(x_i^*) \\Delta x",
|
|
87
|
+
category: "calculus",
|
|
88
|
+
description: "\u9ECE\u66FC\u548C\u5B9A\u4E49",
|
|
89
|
+
tags: ["integral", "limit", "definition"]
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: "ftc",
|
|
93
|
+
name: "\u5FAE\u79EF\u5206\u57FA\u672C\u5B9A\u7406",
|
|
94
|
+
latex: "\\frac{d}{dx} \\int_{a}^{x} f(t) dt = f(x)",
|
|
95
|
+
category: "calculus",
|
|
96
|
+
description: "\u5FAE\u79EF\u5206\u57FA\u672C\u5B9A\u7406",
|
|
97
|
+
tags: ["integral", "derivative", "fundamental"]
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: "integration-by-parts",
|
|
101
|
+
name: "\u5206\u90E8\u79EF\u5206",
|
|
102
|
+
latex: "\\int u dv = uv - \\int v du",
|
|
103
|
+
category: "calculus",
|
|
104
|
+
description: "\u5206\u90E8\u79EF\u5206\u516C\u5F0F",
|
|
105
|
+
tags: ["integral", "by-parts"]
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: "taylor-series",
|
|
109
|
+
name: "\u6CF0\u52D2\u5C55\u5F00",
|
|
110
|
+
latex: "f(x) = \\sum_{n=0}^{\\infty} \\frac{f^{(n)}(a)}{n!} (x-a)^{n}",
|
|
111
|
+
category: "calculus",
|
|
112
|
+
description: "\u6CF0\u52D2\u7EA7\u6570\u5C55\u5F00",
|
|
113
|
+
tags: ["series", "taylor", "expansion"]
|
|
114
|
+
}
|
|
115
|
+
];
|
|
116
|
+
var ALGEBRA_TEMPLATES = [
|
|
117
|
+
{
|
|
118
|
+
id: "quadratic-formula",
|
|
119
|
+
name: "\u6C42\u6839\u516C\u5F0F",
|
|
120
|
+
latex: "x = \\frac{-b \\pm \\sqrt{b^{2} - 4ac}}{2a}",
|
|
121
|
+
category: "algebra",
|
|
122
|
+
description: "\u4E00\u5143\u4E8C\u6B21\u65B9\u7A0B\u6C42\u6839\u516C\u5F0F",
|
|
123
|
+
tags: ["quadratic", "root"]
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: "discriminant",
|
|
127
|
+
name: "\u5224\u522B\u5F0F",
|
|
128
|
+
latex: "\\Delta = b^{2} - 4ac",
|
|
129
|
+
category: "algebra",
|
|
130
|
+
description: "\u4E8C\u6B21\u65B9\u7A0B\u5224\u522B\u5F0F",
|
|
131
|
+
tags: ["quadratic", "discriminant"]
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
id: "binomial-theorem",
|
|
135
|
+
name: "\u4E8C\u9879\u5F0F\u5B9A\u7406",
|
|
136
|
+
latex: "(a+b)^{n} = \\sum_{k=0}^{n} \\binom{n}{k} a^{n-k} b^{k}",
|
|
137
|
+
category: "algebra",
|
|
138
|
+
description: "\u4E8C\u9879\u5F0F\u5C55\u5F00",
|
|
139
|
+
tags: ["binomial", "theorem"]
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
id: "geometric-series",
|
|
143
|
+
name: "\u7B49\u6BD4\u6570\u5217\u6C42\u548C",
|
|
144
|
+
latex: "\\sum_{k=0}^{n-1} ar^{k} = a \\frac{1 - r^{n}}{1 - r}",
|
|
145
|
+
category: "algebra",
|
|
146
|
+
description: "\u7B49\u6BD4\u6570\u5217\u524D n \u9879\u548C",
|
|
147
|
+
tags: ["series", "geometric"]
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
id: "arithmetic-series",
|
|
151
|
+
name: "\u7B49\u5DEE\u6570\u5217\u6C42\u548C",
|
|
152
|
+
latex: "\\sum_{k=1}^{n} k = \\frac{n(n+1)}{2}",
|
|
153
|
+
category: "algebra",
|
|
154
|
+
description: "\u81EA\u7136\u6570\u6C42\u548C\u516C\u5F0F",
|
|
155
|
+
tags: ["series", "arithmetic"]
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
id: "log-properties",
|
|
159
|
+
name: "\u5BF9\u6570\u8FD0\u7B97",
|
|
160
|
+
latex: "\\log_{a}(xy) = \\log_{a}x + \\log_{a}y",
|
|
161
|
+
category: "algebra",
|
|
162
|
+
description: "\u5BF9\u6570\u4E58\u6CD5\u6027\u8D28",
|
|
163
|
+
tags: ["logarithm", "properties"]
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: "exp-log-inverse",
|
|
167
|
+
name: "\u6307\u6570\u4E0E\u5BF9\u6570",
|
|
168
|
+
latex: "a^{\\log_{a} x} = x",
|
|
169
|
+
category: "algebra",
|
|
170
|
+
description: "\u6307\u6570\u4E0E\u5BF9\u6570\u4E92\u4E3A\u9006\u8FD0\u7B97",
|
|
171
|
+
tags: ["logarithm", "exponential"]
|
|
172
|
+
}
|
|
173
|
+
];
|
|
174
|
+
var TRIG_TEMPLATES = [
|
|
175
|
+
{
|
|
176
|
+
id: "pythagorean-id",
|
|
177
|
+
name: "\u6BD5\u8FBE\u54E5\u62C9\u65AF\u6052\u7B49\u5F0F",
|
|
178
|
+
latex: "\\sin^{2}\\theta + \\cos^{2}\\theta = 1",
|
|
179
|
+
category: "trigonometry",
|
|
180
|
+
description: "\u6BD5\u8FBE\u54E5\u62C9\u65AF\u6052\u7B49\u5F0F",
|
|
181
|
+
tags: ["sin", "cos", "identity"]
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
id: "sin-double-angle",
|
|
185
|
+
name: "\u6B63\u5F26\u500D\u89D2\u516C\u5F0F",
|
|
186
|
+
latex: "\\sin(2\\theta) = 2\\sin\\theta \\cos\\theta",
|
|
187
|
+
category: "trigonometry",
|
|
188
|
+
description: "\u6B63\u5F26\u500D\u89D2\u516C\u5F0F",
|
|
189
|
+
tags: ["sin", "double-angle"]
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
id: "cos-double-angle",
|
|
193
|
+
name: "\u4F59\u5F26\u500D\u89D2\u516C\u5F0F",
|
|
194
|
+
latex: "\\cos(2\\theta) = \\cos^{2}\\theta - \\sin^{2}\\theta",
|
|
195
|
+
category: "trigonometry",
|
|
196
|
+
description: "\u4F59\u5F26\u500D\u89D2\u516C\u5F0F",
|
|
197
|
+
tags: ["cos", "double-angle"]
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
id: "sin-sum",
|
|
201
|
+
name: "\u6B63\u5F26\u548C\u89D2\u516C\u5F0F",
|
|
202
|
+
latex: "\\sin(A+B) = \\sin A \\cos B + \\cos A \\sin B",
|
|
203
|
+
category: "trigonometry",
|
|
204
|
+
description: "\u6B63\u5F26\u548C\u89D2\u516C\u5F0F",
|
|
205
|
+
tags: ["sin", "sum", "angle"]
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
id: "cos-sum",
|
|
209
|
+
name: "\u4F59\u5F26\u548C\u89D2\u516C\u5F0F",
|
|
210
|
+
latex: "\\cos(A+B) = \\cos A \\cos B - \\sin A \\sin B",
|
|
211
|
+
category: "trigonometry",
|
|
212
|
+
description: "\u4F59\u5F26\u548C\u89D2\u516C\u5F0F",
|
|
213
|
+
tags: ["cos", "sum", "angle"]
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
id: "law-of-sines",
|
|
217
|
+
name: "\u6B63\u5F26\u5B9A\u7406",
|
|
218
|
+
latex: "\\frac{a}{\\sin A} = \\frac{b}{\\sin B} = \\frac{c}{\\sin C} = 2R",
|
|
219
|
+
category: "trigonometry",
|
|
220
|
+
description: "\u6B63\u5F26\u5B9A\u7406",
|
|
221
|
+
tags: ["law-of-sines", "triangle"]
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
id: "law-of-cosines",
|
|
225
|
+
name: "\u4F59\u5F26\u5B9A\u7406",
|
|
226
|
+
latex: "c^{2} = a^{2} + b^{2} - 2ab\\cos C",
|
|
227
|
+
category: "trigonometry",
|
|
228
|
+
description: "\u4F59\u5F26\u5B9A\u7406",
|
|
229
|
+
tags: ["law-of-cosines", "triangle"]
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
id: "euler-formula",
|
|
233
|
+
name: "\u6B27\u62C9\u516C\u5F0F",
|
|
234
|
+
latex: "e^{i\\theta} = \\cos\\theta + i\\sin\\theta",
|
|
235
|
+
category: "trigonometry",
|
|
236
|
+
description: "\u6B27\u62C9\u516C\u5F0F",
|
|
237
|
+
tags: ["euler", "complex"]
|
|
238
|
+
}
|
|
239
|
+
];
|
|
240
|
+
var LINEAR_ALGEBRA_TEMPLATES = [
|
|
241
|
+
{
|
|
242
|
+
id: "matrix-mult",
|
|
243
|
+
name: "\u77E9\u9635\u4E58\u6CD5",
|
|
244
|
+
latex: "(AB)_{ij} = \\sum_{k=1}^{n} a_{ik} b_{kj}",
|
|
245
|
+
category: "linear-algebra",
|
|
246
|
+
description: "\u77E9\u9635\u4E58\u6CD5\u5B9A\u4E49",
|
|
247
|
+
tags: ["matrix", "multiplication"]
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
id: "det-2x2",
|
|
251
|
+
name: "\u4E8C\u9636\u884C\u5217\u5F0F",
|
|
252
|
+
latex: "\\det\\begin{pmatrix} a & b \\\\ c & d \\end{pmatrix} = ad - bc",
|
|
253
|
+
category: "linear-algebra",
|
|
254
|
+
description: "2\xD72 \u884C\u5217\u5F0F",
|
|
255
|
+
tags: ["determinant"]
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
id: "eigenvalue",
|
|
259
|
+
name: "\u7279\u5F81\u503C\u65B9\u7A0B",
|
|
260
|
+
latex: "A\\vec{v} = \\lambda \\vec{v}",
|
|
261
|
+
category: "linear-algebra",
|
|
262
|
+
description: "\u7279\u5F81\u503C\u4E0E\u7279\u5F81\u5411\u91CF",
|
|
263
|
+
tags: ["eigenvalue", "eigenvector"]
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
id: "cramers-rule",
|
|
267
|
+
name: "\u514B\u62C9\u9ED8\u6CD5\u5219",
|
|
268
|
+
latex: "x_i = \\frac{\\det(A_i)}{\\det(A)}",
|
|
269
|
+
category: "linear-algebra",
|
|
270
|
+
description: "\u89E3\u7EBF\u6027\u65B9\u7A0B\u7EC4",
|
|
271
|
+
tags: ["cramers-rule", "determinant"]
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
id: "vector-dot",
|
|
275
|
+
name: "\u5411\u91CF\u70B9\u79EF",
|
|
276
|
+
latex: "\\vec{a} \\cdot \\vec{b} = a_1 b_1 + a_2 b_2 + a_3 b_3",
|
|
277
|
+
category: "linear-algebra",
|
|
278
|
+
description: "\u70B9\u79EF",
|
|
279
|
+
tags: ["vector", "dot"]
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
id: "vector-cross",
|
|
283
|
+
name: "\u5411\u91CF\u53C9\u79EF",
|
|
284
|
+
latex: "\\vec{a} \\times \\vec{b} = \\begin{vmatrix} \\vec{i} & \\vec{j} & \\vec{k} \\\\ a_1 & a_2 & a_3 \\\\ b_1 & b_2 & b_3 \\end{vmatrix}",
|
|
285
|
+
category: "linear-algebra",
|
|
286
|
+
description: "\u4E09\u7EF4\u5411\u91CF\u53C9\u79EF",
|
|
287
|
+
tags: ["vector", "cross"]
|
|
288
|
+
}
|
|
289
|
+
];
|
|
290
|
+
var STATS_TEMPLATES = [
|
|
291
|
+
{
|
|
292
|
+
id: "normal-dist",
|
|
293
|
+
name: "\u6B63\u6001\u5206\u5E03",
|
|
294
|
+
latex: "f(x) = \\frac{1}{\\sigma\\sqrt{2\\pi}} e^{-\\frac{(x-\\mu)^{2}}{2\\sigma^{2}}}",
|
|
295
|
+
category: "statistics",
|
|
296
|
+
description: "\u6B63\u6001\u5206\u5E03\u6982\u7387\u5BC6\u5EA6\u51FD\u6570",
|
|
297
|
+
tags: ["normal", "distribution", "gaussian"]
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
id: "bayes-theorem",
|
|
301
|
+
name: "\u8D1D\u53F6\u65AF\u5B9A\u7406",
|
|
302
|
+
latex: "P(A|B) = \\frac{P(B|A) \\cdot P(A)}{P(B)}",
|
|
303
|
+
category: "statistics",
|
|
304
|
+
description: "\u8D1D\u53F6\u65AF\u5B9A\u7406",
|
|
305
|
+
tags: ["bayes", "probability", "conditional"]
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
id: "expected-value",
|
|
309
|
+
name: "\u671F\u671B",
|
|
310
|
+
latex: "E[X] = \\sum_{i} x_i p_i",
|
|
311
|
+
category: "statistics",
|
|
312
|
+
description: "\u79BB\u6563\u671F\u671B",
|
|
313
|
+
tags: ["expected", "value"]
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
id: "variance",
|
|
317
|
+
name: "\u65B9\u5DEE",
|
|
318
|
+
latex: "Var(X) = E[(X - \\mu)^{2}] = E[X^{2}] - (E[X])^{2}",
|
|
319
|
+
category: "statistics",
|
|
320
|
+
description: "\u65B9\u5DEE\u516C\u5F0F",
|
|
321
|
+
tags: ["variance", "standard-deviation"]
|
|
322
|
+
}
|
|
323
|
+
];
|
|
324
|
+
var PHYSICS_TEMPLATES = [
|
|
325
|
+
{
|
|
326
|
+
id: "einstein-emc2",
|
|
327
|
+
name: "\u8D28\u80FD\u65B9\u7A0B",
|
|
328
|
+
latex: "E = mc^{2}",
|
|
329
|
+
category: "physics",
|
|
330
|
+
description: "\u7231\u56E0\u65AF\u5766\u8D28\u80FD\u65B9\u7A0B",
|
|
331
|
+
tags: ["einstein", "energy", "mass"]
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
id: "newton-2nd",
|
|
335
|
+
name: "\u725B\u987F\u7B2C\u4E8C\u5B9A\u5F8B",
|
|
336
|
+
latex: "\\vec{F} = m\\vec{a}",
|
|
337
|
+
category: "physics",
|
|
338
|
+
description: "\u725B\u987F\u7B2C\u4E8C\u5B9A\u5F8B",
|
|
339
|
+
tags: ["newton", "force", "acceleration"]
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
id: "schrodinger",
|
|
343
|
+
name: "\u859B\u5B9A\u8C14\u65B9\u7A0B",
|
|
344
|
+
latex: "i\\hbar \\frac{\\partial}{\\partial t} \\Psi = \\hat{H} \\Psi",
|
|
345
|
+
category: "physics",
|
|
346
|
+
description: "\u542B\u65F6\u859B\u5B9A\u8C14\u65B9\u7A0B",
|
|
347
|
+
tags: ["quantum", "schrodinger"]
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
id: "maxwell-faraday",
|
|
351
|
+
name: "\u6CD5\u62C9\u7B2C\u5B9A\u5F8B",
|
|
352
|
+
latex: "\\nabla \\times \\vec{E} = -\\frac{\\partial\\vec{B}}{\\partial t}",
|
|
353
|
+
category: "physics",
|
|
354
|
+
description: "\u9EA6\u514B\u65AF\u97E6-\u6CD5\u62C9\u7B2C\u65B9\u7A0B",
|
|
355
|
+
tags: ["maxwell", "electromagnetism"]
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
id: "gravitation",
|
|
359
|
+
name: "\u4E07\u6709\u5F15\u529B",
|
|
360
|
+
latex: "F = G \\frac{m_1 m_2}{r^{2}}",
|
|
361
|
+
category: "physics",
|
|
362
|
+
description: "\u725B\u987F\u4E07\u6709\u5F15\u529B\u5B9A\u5F8B",
|
|
363
|
+
tags: ["newton", "gravitation"]
|
|
364
|
+
}
|
|
365
|
+
];
|
|
366
|
+
var ALL_MATH_TEMPLATES = [
|
|
367
|
+
...CALCULUS_TEMPLATES,
|
|
368
|
+
...ALGEBRA_TEMPLATES,
|
|
369
|
+
...TRIG_TEMPLATES,
|
|
370
|
+
...LINEAR_ALGEBRA_TEMPLATES,
|
|
371
|
+
...STATS_TEMPLATES,
|
|
372
|
+
...PHYSICS_TEMPLATES
|
|
373
|
+
];
|
|
374
|
+
function getTemplatesByCategory(category) {
|
|
375
|
+
return ALL_MATH_TEMPLATES.filter((t) => t.category === category);
|
|
376
|
+
}
|
|
377
|
+
function searchTemplates(query) {
|
|
378
|
+
const q = query.toLowerCase();
|
|
379
|
+
return ALL_MATH_TEMPLATES.filter(
|
|
380
|
+
(t) => t.name.toLowerCase().includes(q) || t.description.toLowerCase().includes(q) || t.tags.some((tag) => tag.toLowerCase().includes(q))
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
function getTemplateById(id) {
|
|
384
|
+
return ALL_MATH_TEMPLATES.find((t) => t.id === id);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// src/chem-templates.ts
|
|
388
|
+
var COMPOUND_TEMPLATES = [
|
|
389
|
+
// 无机酸
|
|
390
|
+
{ id: "h2o", name: "\u6C34", latex: "\\ce{H2O}", category: "compound", description: "\u6C34", tags: ["water", "inorganic"] },
|
|
391
|
+
{ id: "h2so4", name: "\u786B\u9178", latex: "\\ce{H2SO4}", category: "compound", description: "\u786B\u9178", tags: ["acid", "strong"] },
|
|
392
|
+
{ id: "hcl", name: "\u76D0\u9178", latex: "\\ce{HCl}", category: "compound", description: "\u76D0\u9178 / \u6C2F\u5316\u6C22", tags: ["acid", "strong"] },
|
|
393
|
+
{ id: "hno3", name: "\u785D\u9178", latex: "\\ce{HNO3}", category: "compound", description: "\u785D\u9178", tags: ["acid", "strong"] },
|
|
394
|
+
{ id: "h3po4", name: "\u78F7\u9178", latex: "\\ce{H3PO4}", category: "compound", description: "\u78F7\u9178", tags: ["acid"] },
|
|
395
|
+
{ id: "naoh", name: "\u6C22\u6C27\u5316\u94A0", latex: "\\ce{NaOH}", category: "compound", description: "\u6C22\u6C27\u5316\u94A0 / \u70E7\u78B1", tags: ["base", "strong"] },
|
|
396
|
+
{ id: "caoh2", name: "\u6C22\u6C27\u5316\u9499", latex: "\\ce{Ca(OH)2}", category: "compound", description: "\u6C22\u6C27\u5316\u9499 / \u719F\u77F3\u7070", tags: ["base"] },
|
|
397
|
+
// 盐
|
|
398
|
+
{ id: "nacl", name: "\u6C2F\u5316\u94A0", latex: "\\ce{NaCl}", category: "compound", description: "\u98DF\u76D0 / \u6C2F\u5316\u94A0", tags: ["salt", "table"] },
|
|
399
|
+
{ id: "na2co3", name: "\u78B3\u9178\u94A0", latex: "\\ce{Na2CO3}", category: "compound", description: "\u7EAF\u78B1 / \u78B3\u9178\u94A0", tags: ["salt", "soda"] },
|
|
400
|
+
{ id: "nahco3", name: "\u78B3\u9178\u6C22\u94A0", latex: "\\ce{NaHCO3}", category: "compound", description: "\u5C0F\u82CF\u6253", tags: ["salt", "baking"] },
|
|
401
|
+
{ id: "caco3", name: "\u78B3\u9178\u9499", latex: "\\ce{CaCO3}", category: "compound", description: "\u77F3\u7070\u77F3 / \u5927\u7406\u77F3", tags: ["salt", "limestone"] },
|
|
402
|
+
{ id: "caso4", name: "\u786B\u9178\u9499", latex: "\\ce{CaSO4}", category: "compound", description: "\u77F3\u818F", tags: ["salt", "gypsum"] },
|
|
403
|
+
// 氧化物
|
|
404
|
+
{ id: "co2", name: "\u4E8C\u6C27\u5316\u78B3", latex: "\\ce{CO2}", category: "compound", description: "\u4E8C\u6C27\u5316\u78B3", tags: ["oxide", "gas"] },
|
|
405
|
+
{ id: "fe2o3", name: "\u6C27\u5316\u94C1", latex: "\\ce{Fe2O3}", category: "compound", description: "\u94C1\u9508 / \u8D64\u94C1\u77FF", tags: ["oxide", "rust"] },
|
|
406
|
+
{ id: "al2o3", name: "\u6C27\u5316\u94DD", latex: "\\ce{Al2O3}", category: "compound", description: "\u6C27\u5316\u94DD", tags: ["oxide"] },
|
|
407
|
+
{ id: "sio2", name: "\u4E8C\u6C27\u5316\u7845", latex: "\\ce{SiO2}", category: "compound", description: "\u77F3\u82F1 / \u4E8C\u6C27\u5316\u7845", tags: ["oxide", "quartz"] },
|
|
408
|
+
// 有机物
|
|
409
|
+
{ id: "ch4", name: "\u7532\u70F7", latex: "\\ce{CH4}", category: "compound", description: "\u7532\u70F7 / \u5929\u7136\u6C14", tags: ["organic", "alkane"] },
|
|
410
|
+
{ id: "c2h5oh", name: "\u4E59\u9187", latex: "\\ce{C2H5OH}", category: "compound", description: "\u9152\u7CBE / \u4E59\u9187", tags: ["organic", "alcohol"] },
|
|
411
|
+
{ id: "c6h12o6", name: "\u8461\u8404\u7CD6", latex: "\\ce{C6H12O6}", category: "compound", description: "\u8461\u8404\u7CD6", tags: ["organic", "sugar"] },
|
|
412
|
+
{ id: "ch3cooh", name: "\u4E59\u9178", latex: "\\ce{CH3COOH}", category: "compound", description: "\u918B\u9178", tags: ["organic", "acid"] }
|
|
413
|
+
];
|
|
414
|
+
var REACTION_TEMPLATES = [
|
|
415
|
+
{
|
|
416
|
+
id: "neutralization",
|
|
417
|
+
name: "\u4E2D\u548C\u53CD\u5E94",
|
|
418
|
+
latex: "\\ce{HCl + NaOH -> NaCl + H2O}",
|
|
419
|
+
category: "reaction",
|
|
420
|
+
description: "\u9178\u78B1\u4E2D\u548C",
|
|
421
|
+
tags: ["neutralization", "acid-base"]
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
id: "combustion-methane",
|
|
425
|
+
name: "\u7532\u70F7\u71C3\u70E7",
|
|
426
|
+
latex: "\\ce{CH4 + 2O2 -> CO2 + 2H2O}",
|
|
427
|
+
category: "reaction",
|
|
428
|
+
description: "\u7532\u70F7\u5B8C\u5168\u71C3\u70E7",
|
|
429
|
+
tags: ["combustion", "organic"]
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
id: "photosynthesis",
|
|
433
|
+
name: "\u5149\u5408\u4F5C\u7528",
|
|
434
|
+
latex: "\\ce{6CO2 + 6H2O ->[\u5149] C6H12O6 + 6O2}",
|
|
435
|
+
category: "reaction",
|
|
436
|
+
description: "\u5149\u5408\u4F5C\u7528\u603B\u53CD\u5E94\u5F0F",
|
|
437
|
+
tags: ["photosynthesis", "biology"]
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
id: "respiration",
|
|
441
|
+
name: "\u7EC6\u80DE\u547C\u5438",
|
|
442
|
+
latex: "\\ce{C6H12O6 + 6O2 -> 6CO2 + 6H2O + \u80FD\u91CF}",
|
|
443
|
+
category: "reaction",
|
|
444
|
+
description: "\u6709\u6C27\u547C\u5438\u603B\u53CD\u5E94\u5F0F",
|
|
445
|
+
tags: ["respiration", "biology"]
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
id: "rust-iron",
|
|
449
|
+
name: "\u94C1\u751F\u9508",
|
|
450
|
+
latex: "\\ce{4Fe + 3O2 + 6H2O -> 4Fe(OH)3}",
|
|
451
|
+
category: "reaction",
|
|
452
|
+
description: "\u94C1\u5728\u6C34\u548C\u6C27\u6C14\u4E2D\u751F\u9508",
|
|
453
|
+
tags: ["rust", "oxidation"]
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
id: "electrolysis-water",
|
|
457
|
+
name: "\u7535\u89E3\u6C34",
|
|
458
|
+
latex: "\\ce{2H2O ->[\u7535\u89E3] 2H2 ^ + O2 ^}",
|
|
459
|
+
category: "reaction",
|
|
460
|
+
description: "\u7535\u89E3\u6C34\u5236\u6C22",
|
|
461
|
+
tags: ["electrolysis", "water"]
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
id: "haber-process",
|
|
465
|
+
name: "\u54C8\u67CF\u6CD5",
|
|
466
|
+
latex: "\\ce{N2 + 3H2 <=>[Fe][\u9AD8\u6E29\u9AD8\u538B] 2NH3}",
|
|
467
|
+
category: "reaction",
|
|
468
|
+
description: "\u5408\u6210\u6C28",
|
|
469
|
+
tags: ["haber", "ammonia", "industrial"]
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
id: "equilibrium",
|
|
473
|
+
name: "\u5316\u5B66\u5E73\u8861",
|
|
474
|
+
latex: "\\ce{aA + bB <=> cC + dD}",
|
|
475
|
+
category: "reaction",
|
|
476
|
+
description: "\u53EF\u9006\u53CD\u5E94\u901A\u7528\u5F0F",
|
|
477
|
+
tags: ["equilibrium", "reversible"]
|
|
478
|
+
}
|
|
479
|
+
];
|
|
480
|
+
var ELECTROCHEM_TEMPLATES = [
|
|
481
|
+
{
|
|
482
|
+
id: "nernst-equation",
|
|
483
|
+
name: "\u80FD\u65AF\u7279\u65B9\u7A0B",
|
|
484
|
+
latex: "E = E^{\\circ} - \\frac{RT}{nF} \\ln Q",
|
|
485
|
+
category: "electrochemistry",
|
|
486
|
+
description: "\u80FD\u65AF\u7279\u65B9\u7A0B",
|
|
487
|
+
tags: ["nernst", "potential"]
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
id: "faraday-law",
|
|
491
|
+
name: "\u6CD5\u62C9\u7B2C\u7535\u89E3\u5B9A\u5F8B",
|
|
492
|
+
latex: "m = \\frac{MIt}{nF}",
|
|
493
|
+
category: "electrochemistry",
|
|
494
|
+
description: "\u6CD5\u62C9\u7B2C\u7535\u89E3\u7B2C\u4E00\u5B9A\u5F8B",
|
|
495
|
+
tags: ["faraday", "electrolysis"]
|
|
496
|
+
}
|
|
497
|
+
];
|
|
498
|
+
var ALL_CHEM_TEMPLATES = [
|
|
499
|
+
...COMPOUND_TEMPLATES,
|
|
500
|
+
...REACTION_TEMPLATES,
|
|
501
|
+
...ELECTROCHEM_TEMPLATES
|
|
502
|
+
];
|
|
503
|
+
function searchCompounds(query) {
|
|
504
|
+
const q = query.toLowerCase();
|
|
505
|
+
return COMPOUND_TEMPLATES.filter(
|
|
506
|
+
(t) => t.name.toLowerCase().includes(q) || t.latex.toLowerCase().includes(q) || t.tags.some((tag) => tag.toLowerCase().includes(q))
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
function getAcids() {
|
|
510
|
+
return COMPOUND_TEMPLATES.filter((t) => t.tags.includes("acid"));
|
|
511
|
+
}
|
|
512
|
+
function getBases() {
|
|
513
|
+
return COMPOUND_TEMPLATES.filter((t) => t.tags.includes("base"));
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// src/greek-presets.ts
|
|
517
|
+
var GREEK_LOWERCASE_GROUP = {
|
|
518
|
+
id: "greek-lowercase",
|
|
519
|
+
label: "Greek Lowercase (\u5C0F\u5199)",
|
|
520
|
+
letters: [
|
|
521
|
+
{ latex: "\\alpha", unicode: "\u03B1", name: "Alpha", englishName: "alpha" },
|
|
522
|
+
{ latex: "\\beta", unicode: "\u03B2", name: "Beta", englishName: "beta" },
|
|
523
|
+
{ latex: "\\gamma", unicode: "\u03B3", name: "Gamma", englishName: "gamma" },
|
|
524
|
+
{ latex: "\\delta", unicode: "\u03B4", name: "Delta", englishName: "delta" },
|
|
525
|
+
{ latex: "\\epsilon", unicode: "\u03B5", name: "Epsilon", englishName: "epsilon", variants: [
|
|
526
|
+
{ latex: "\\varepsilon", unicode: "\u03B5", name: "Epsilon (var)" }
|
|
527
|
+
] },
|
|
528
|
+
{ latex: "\\zeta", unicode: "\u03B6", name: "Zeta", englishName: "zeta" },
|
|
529
|
+
{ latex: "\\eta", unicode: "\u03B7", name: "Eta", englishName: "eta" },
|
|
530
|
+
{ latex: "\\theta", unicode: "\u03B8", name: "Theta", englishName: "theta", variants: [
|
|
531
|
+
{ latex: "\\vartheta", unicode: "\u03D1", name: "Theta (var)" }
|
|
532
|
+
] },
|
|
533
|
+
{ latex: "\\iota", unicode: "\u03B9", name: "Iota", englishName: "iota" },
|
|
534
|
+
{ latex: "\\kappa", unicode: "\u03BA", name: "Kappa", englishName: "kappa" },
|
|
535
|
+
{ latex: "\\lambda", unicode: "\u03BB", name: "Lambda", englishName: "lambda" },
|
|
536
|
+
{ latex: "\\mu", unicode: "\u03BC", name: "Mu", englishName: "mu" },
|
|
537
|
+
{ latex: "\\nu", unicode: "\u03BD", name: "Nu", englishName: "nu" },
|
|
538
|
+
{ latex: "\\xi", unicode: "\u03BE", name: "Xi", englishName: "xi" },
|
|
539
|
+
{ latex: "\\omicron", unicode: "\u03BF", name: "Omicron", englishName: "omicron" },
|
|
540
|
+
{ latex: "\\pi", unicode: "\u03C0", name: "Pi", englishName: "pi", variants: [
|
|
541
|
+
{ latex: "\\varpi", unicode: "\u03D6", name: "Pi (var)" }
|
|
542
|
+
] },
|
|
543
|
+
{ latex: "\\rho", unicode: "\u03C1", name: "Rho", englishName: "rho", variants: [
|
|
544
|
+
{ latex: "\\varrho", unicode: "\u03F1", name: "Rho (var)" }
|
|
545
|
+
] },
|
|
546
|
+
{ latex: "\\sigma", unicode: "\u03C3", name: "Sigma", englishName: "sigma", variants: [
|
|
547
|
+
{ latex: "\\varsigma", unicode: "\u03C2", name: "Sigma (final)" }
|
|
548
|
+
] },
|
|
549
|
+
{ latex: "\\tau", unicode: "\u03C4", name: "Tau", englishName: "tau" },
|
|
550
|
+
{ latex: "\\upsilon", unicode: "\u03C5", name: "Upsilon", englishName: "upsilon" },
|
|
551
|
+
{ latex: "\\phi", unicode: "\u03C6", name: "Phi", englishName: "phi", variants: [
|
|
552
|
+
{ latex: "\\varphi", unicode: "\u03D5", name: "Phi (var)" }
|
|
553
|
+
] },
|
|
554
|
+
{ latex: "\\chi", unicode: "\u03C7", name: "Chi", englishName: "chi" },
|
|
555
|
+
{ latex: "\\psi", unicode: "\u03C8", name: "Psi", englishName: "psi" },
|
|
556
|
+
{ latex: "\\omega", unicode: "\u03C9", name: "Omega", englishName: "omega" }
|
|
557
|
+
]
|
|
558
|
+
};
|
|
559
|
+
var GREEK_UPPERCASE_GROUP = {
|
|
560
|
+
id: "greek-uppercase",
|
|
561
|
+
label: "Greek Uppercase (\u5927\u5199)",
|
|
562
|
+
letters: [
|
|
563
|
+
{ latex: "\\Gamma", unicode: "\u0393", name: "Gamma", englishName: "Gamma" },
|
|
564
|
+
{ latex: "\\Delta", unicode: "\u0394", name: "Delta", englishName: "Delta" },
|
|
565
|
+
{ latex: "\\Theta", unicode: "\u0398", name: "Theta", englishName: "Theta" },
|
|
566
|
+
{ latex: "\\Lambda", unicode: "\u039B", name: "Lambda", englishName: "Lambda" },
|
|
567
|
+
{ latex: "\\Xi", unicode: "\u039E", name: "Xi", englishName: "Xi" },
|
|
568
|
+
{ latex: "\\Pi", unicode: "\u03A0", name: "Pi", englishName: "Pi" },
|
|
569
|
+
{ latex: "\\Sigma", unicode: "\u03A3", name: "Sigma", englishName: "Sigma" },
|
|
570
|
+
{ latex: "\\Upsilon", unicode: "\u03A5", name: "Upsilon", englishName: "Upsilon" },
|
|
571
|
+
{ latex: "\\Phi", unicode: "\u03A6", name: "Phi", englishName: "Phi" },
|
|
572
|
+
{ latex: "\\Psi", unicode: "\u03A8", name: "Psi", englishName: "Psi" },
|
|
573
|
+
{ latex: "\\Omega", unicode: "\u03A9", name: "Omega", englishName: "Omega" }
|
|
574
|
+
]
|
|
575
|
+
};
|
|
576
|
+
var GREEK_GROUPS = [
|
|
577
|
+
GREEK_LOWERCASE_GROUP,
|
|
578
|
+
GREEK_UPPERCASE_GROUP
|
|
579
|
+
];
|
|
580
|
+
var ALL_GREEK = [
|
|
581
|
+
...GREEK_LOWERCASE_GROUP.letters,
|
|
582
|
+
...GREEK_UPPERCASE_GROUP.letters
|
|
583
|
+
];
|
|
584
|
+
function searchGreek(query) {
|
|
585
|
+
const q = query.toLowerCase();
|
|
586
|
+
return ALL_GREEK.filter(
|
|
587
|
+
(l) => l.name.toLowerCase().includes(q) || l.englishName.toLowerCase().includes(q) || l.latex.toLowerCase().includes(q)
|
|
588
|
+
);
|
|
589
|
+
}
|
|
590
|
+
function searchGreekWithVariants(query) {
|
|
591
|
+
const q = query.toLowerCase();
|
|
592
|
+
const results = searchGreek(query);
|
|
593
|
+
for (const letter of ALL_GREEK) {
|
|
594
|
+
if (!letter.variants) continue;
|
|
595
|
+
for (const v of letter.variants) {
|
|
596
|
+
if (v.name.toLowerCase().includes(q) || v.latex.toLowerCase().includes(q)) {
|
|
597
|
+
if (!results.some((r) => r.latex === letter.latex)) {
|
|
598
|
+
results.push(letter);
|
|
599
|
+
}
|
|
600
|
+
break;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
return results;
|
|
605
|
+
}
|
|
606
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
607
|
+
0 && (module.exports = {
|
|
608
|
+
ALGEBRA_TEMPLATES,
|
|
609
|
+
ALL_CHEM_TEMPLATES,
|
|
610
|
+
ALL_GREEK,
|
|
611
|
+
ALL_MATH_TEMPLATES,
|
|
612
|
+
CALCULUS_TEMPLATES,
|
|
613
|
+
COMPOUND_TEMPLATES,
|
|
614
|
+
ELECTROCHEM_TEMPLATES,
|
|
615
|
+
GREEK_GROUPS,
|
|
616
|
+
GREEK_LOWERCASE_GROUP,
|
|
617
|
+
GREEK_UPPERCASE_GROUP,
|
|
618
|
+
LINEAR_ALGEBRA_TEMPLATES,
|
|
619
|
+
PHYSICS_TEMPLATES,
|
|
620
|
+
REACTION_TEMPLATES,
|
|
621
|
+
STATS_TEMPLATES,
|
|
622
|
+
TRIG_TEMPLATES,
|
|
623
|
+
getAcids,
|
|
624
|
+
getBases,
|
|
625
|
+
getTemplateById,
|
|
626
|
+
getTemplatesByCategory,
|
|
627
|
+
searchCompounds,
|
|
628
|
+
searchGreek,
|
|
629
|
+
searchGreekWithVariants,
|
|
630
|
+
searchTemplates
|
|
631
|
+
});
|